Snap for 8352742 from 64e00f31038f45e57568250dfae32f2234af3241 to tm-release

Change-Id: I85947e0352364aaa01cfbeda451e5661ac627e9f
diff --git a/.azure-pipelines/ci.yml b/.azure-pipelines/ci.yml
index 3feb85a..d0efa77 100644
--- a/.azure-pipelines/ci.yml
+++ b/.azure-pipelines/ci.yml
@@ -1,14 +1,14 @@
 variables:
   coverage: false
 
-trigger: ['master', '3.9', '3.8', '3.7']
+trigger: ['main', '3.10', '3.9', '3.8', '3.7']
 
 jobs:
 - job: Prebuild
   displayName: Pre-build checks
 
   pool:
-    vmImage: ubuntu-18.04
+    vmImage: ubuntu-20.04
 
   steps:
   - template: ./prebuild-checks.yml
@@ -20,7 +20,7 @@
   condition: and(succeeded(), eq(dependencies.Prebuild.outputs['docs.run'], 'true'))
 
   pool:
-    vmImage: ubuntu-18.04
+    vmImage: ubuntu-20.04
 
   steps:
   - template: ./docs-steps.yml
@@ -40,7 +40,7 @@
     testRunPlatform: macos
 
   pool:
-    vmImage: macos-10.14
+    vmImage: macos-10.15
 
   steps:
   - template: ./macos-steps.yml
@@ -52,12 +52,12 @@
   condition: and(succeeded(), eq(dependencies.Prebuild.outputs['tests.run'], 'true'))
 
   pool:
-    vmImage: ubuntu-18.04
+    vmImage: ubuntu-20.04
 
   variables:
     testRunTitle: '$(build.sourceBranchName)-linux'
     testRunPlatform: linux
-    openssl_version: 1.1.1g
+    openssl_version: 1.1.1n
 
   steps:
   - template: ./posix-steps.yml
@@ -78,12 +78,12 @@
     )
 
   pool:
-    vmImage: ubuntu-18.04
+    vmImage: ubuntu-20.04
 
   variables:
     testRunTitle: '$(Build.SourceBranchName)-linux-coverage'
     testRunPlatform: linux-coverage
-    openssl_version: 1.1.1g
+    openssl_version: 1.1.1n
 
   steps:
   - template: ./posix-steps.yml
diff --git a/.azure-pipelines/docs-steps.yml b/.azure-pipelines/docs-steps.yml
index eaf4ad0..647daff 100644
--- a/.azure-pipelines/docs-steps.yml
+++ b/.azure-pipelines/docs-steps.yml
@@ -12,11 +12,12 @@
   inputs:
     versionSpec: '>=3.6'
 
-- script: python -m pip install sphinx==2.2.0 blurb python-docs-theme
+- script: python -m pip install -r requirements.txt
+  workingDirectory: '$(build.sourcesDirectory)/Doc'
   displayName: 'Install build dependencies'
 
 - ${{ if ne(parameters.latex, 'true') }}:
-  - script: make check suspicious html PYTHON=python
+  - script: make check html PYTHON=python
     workingDirectory: '$(build.sourcesDirectory)/Doc'
     displayName: 'Build documentation'
 
@@ -31,7 +32,7 @@
 - ${{ if eq(parameters.upload, 'true') }}:
   - task: PublishBuildArtifacts@1
     displayName: 'Publish docs'
-  
+
     inputs:
       PathToPublish: '$(build.sourcesDirectory)/Doc/build'
       ArtifactName: docs
diff --git a/.azure-pipelines/pr.yml b/.azure-pipelines/pr.yml
index 2e94af3..a4f3246 100644
--- a/.azure-pipelines/pr.yml
+++ b/.azure-pipelines/pr.yml
@@ -1,14 +1,14 @@
 variables:
   coverage: false
 
-pr: ['master', '3.9', '3.8', '3.7']
+pr: ['main', '3.10', '3.9', '3.8', '3.7']
 
 jobs:
 - job: Prebuild
   displayName: Pre-build checks
 
   pool:
-    vmImage: ubuntu-18.04
+    vmImage: ubuntu-20.04
 
   steps:
   - template: ./prebuild-checks.yml
@@ -20,7 +20,7 @@
   condition: and(succeeded(), eq(dependencies.Prebuild.outputs['docs.run'], 'true'))
 
   pool:
-    vmImage: ubuntu-18.04
+    vmImage: ubuntu-20.04
 
   steps:
   - template: ./docs-steps.yml
@@ -38,7 +38,7 @@
     testRunPlatform: macos
 
   pool:
-    vmImage: macos-10.14
+    vmImage: macos-10.15
 
   steps:
   - template: ./macos-steps.yml
@@ -52,12 +52,12 @@
   condition: and(succeeded(), eq(dependencies.Prebuild.outputs['tests.run'], 'true'))
 
   pool:
-    vmImage: ubuntu-18.04
+    vmImage: ubuntu-20.04
 
   variables:
     testRunTitle: '$(system.pullRequest.TargetBranch)-linux'
     testRunPlatform: linux
-    openssl_version: 1.1.1g
+    openssl_version: 1.1.1n
 
   steps:
   - template: ./posix-steps.yml
@@ -78,12 +78,12 @@
     )
 
   pool:
-    vmImage: ubuntu-18.04
+    vmImage: ubuntu-20.04
 
   variables:
     testRunTitle: '$(Build.SourceBranchName)-linux-coverage'
     testRunPlatform: linux-coverage
-    openssl_version: 1.1.1g
+    openssl_version: 1.1.1n
 
   steps:
   - template: ./posix-steps.yml
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..81445d2
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,12 @@
+root = true
+
+[*.{py,c,cpp,h,rst,md,yml}]
+trim_trailing_whitespace = true
+insert_final_newline = true
+indent_style = space
+
+[*.{py,c,cpp,h}]
+indent_size = 4
+
+[*.yml]
+indent_size = 2
diff --git a/.gitattributes b/.gitattributes
index bec16a0..be369d2 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -40,16 +40,11 @@
 PC/readme.txt text eol=crlf
 
 # Generated files
-# https://github.com/github/linguist#generated-code
-Include/graminit.h          linguist-generated=true
-Python/graminit.h           linguist-generated=true
-Modules/clinic/*.h          linguist-generated=true
-Objects/clinic/*.h          linguist-generated=true
-PC/clinic/*.h               linguist-generated=true
-Python/clinic/*.h           linguist-generated=true
+# https://github.com/github/linguist/blob/master/docs/overrides.md
+**/clinic/*.h               linguist-generated=true
 Python/importlib.h          linguist-generated=true
 Python/importlib_external.h linguist-generated=true
-Include/Python-ast.h        linguist-generated=true
+Include/internal/pycore_ast.h   linguist-generated=true
 Python/Python-ast.c         linguist-generated=true
 Include/opcode.h            linguist-generated=true
 Python/opcode_targets.h     linguist-generated=true
@@ -59,3 +54,13 @@
 Include/token.h             linguist-generated=true
 Lib/token.py                linguist-generated=true
 Parser/token.c              linguist-generated=true
+
+# Language aware diff headers
+# https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more
+# https://gist.github.com/tekin/12500956bd56784728e490d8cef9cb81
+*.c     diff=cpp
+*.h     diff=cpp
+*.css   diff=css
+*.html  diff=html
+*.py    diff=python
+*.md    diff=markdown
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index eb6fc2c..9a5bc63 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -9,10 +9,17 @@
 
 # Core
 **/*context*                  @1st1
-**/*genobject*                @1st1
+**/*genobject*                @1st1 @markshannon
 **/*hamt*                     @1st1
 Objects/set*                  @rhettinger
-Objects/dict*                 @methane
+Objects/dict*                 @methane @markshannon
+Objects/type*                 @markshannon
+Objects/codeobject.c          @markshannon
+Objects/frameobject.c         @markshannon
+Objects/call.c                @markshannon
+Python/ceval.c                @markshannon
+Python/compile.c              @markshannon
+Python/ast_opt.c              @isidentical
 
 # Hashing
 **/*hashlib*                  @python/crypto-team @tiran
@@ -72,11 +79,21 @@
 /Modules/gcmodule.c           @pablogsal
 /Doc/library/gc.rst           @pablogsal
 
-# Parser/Pgen
-/Parser/pgen/                 @pablogsal
-/Parser/pegen/                @pablogsal @lysnikolaou
+# Parser
+/Parser/                      @pablogsal @lysnikolaou
 /Tools/peg_generator/         @pablogsal @lysnikolaou
 /Lib/test/test_peg_generator/ @pablogsal @lysnikolaou
+/Grammar/python.gram          @pablogsal @lysnikolaou
+
+# AST
+Python/ast.c                  @isidentical
+Parser/asdl.py                @isidentical
+Parser/asdl_c.py              @isidentical
+Lib/ast.py                    @isidentical
+
+# Mock
+/Lib/unittest/mock.py         @cjw296
+/Lib/unittest/test/testmock/* @cjw296
 
 # SQLite 3
 **/*sqlite*                   @berkerpeksag
@@ -111,7 +128,7 @@
 
 **/*idlelib*                  @terryjreedy
 
-**/*typing*                   @gvanrossum @ilevkivskyi
+**/*typing*                   @gvanrossum @Fidget-Spinner @JelleZijlstra
 
 **/*asyncore                  @giampaolo
 **/*asynchat                  @giampaolo
diff --git a/.github/CONTRIBUTING.rst b/.github/CONTRIBUTING.rst
index 7f912e8..a81935d 100644
--- a/.github/CONTRIBUTING.rst
+++ b/.github/CONTRIBUTING.rst
@@ -8,18 +8,18 @@
 
   + `Stable buildbots <http://buildbot.python.org/3.x.stable/>`_
 
+- 3.9
+
+  + `Stable buildbots <http://buildbot.python.org/3.9.stable/>`_
+
+- 3.8
+
+  + `Stable buildbots <http://buildbot.python.org/3.8.stable/>`_
+
 - 3.7
 
   + `Stable buildbots <http://buildbot.python.org/3.7.stable/>`_
 
-- 3.6
-
-  + `Stable buildbots <http://buildbot.python.org/3.6.stable/>`_
-
-- 2.7
-
-  + `Stable buildbots <http://buildbot.python.org/2.7.stable/>`_
-
 
 Thank You
 ---------
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
index 36c4e27..b084593 100644
--- a/.github/FUNDING.yml
+++ b/.github/FUNDING.yml
@@ -1 +1,2 @@
 custom: https://www.python.org/psf/donations/python-dev/
+github: [python]
diff --git a/.github/SECURITY.md b/.github/SECURITY.md
index 28aea94..82ae4ca 100644
--- a/.github/SECURITY.md
+++ b/.github/SECURITY.md
@@ -10,9 +10,8 @@
 ## Reporting a Vulnerability
 
 Please read the guidelines on reporting security issues [on the
-official website](
-https://www.python.org/news/security/#reporting-security-issues-in-python
-) for instructions on how to report a security-related problem to
+official website](https://www.python.org/dev/security/) for
+instructions on how to report a security-related problem to
 the Python team responsibly.
 
 To reach the response team, email `security at python dot org`. 
diff --git a/.github/codecov.yml b/.github/codecov.yml
deleted file mode 100644
index ea504f4..0000000
--- a/.github/codecov.yml
+++ /dev/null
@@ -1,30 +0,0 @@
-codecov:
-  strict_yaml_branch: master
-  notify:
-    require_ci_to_pass: true
-comment: off
-ignore:
-  - "Doc/**/*"
-  - "Misc/**/*"
-  - "Mac/**/*"
-  - "PC/**/*"
-  - "PCbuild/**/*"
-  - "Tools/**/*"
-  - "Grammar/*"
-coverage:
-  precision: 2
-  range: 70...90
-  round: down
-  status:
-    changes: off
-    project: off
-    patch: off
-parsers:
-  gcov:
-    branch_detection:
-      conditional: true
-      loop: true
-      macro: false
-      method: false
-  javascript:
-    enable_partials: false
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 0000000..e90677b
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,9 @@
+version: 2
+updates:
+  - package-ecosystem: "github-actions"
+    directory: "/"
+    schedule:
+      interval: "monthly"
+    labels:
+      - "skip issue"
+      - "skip news"
diff --git a/.github/problem-matchers/gcc.json b/.github/problem-matchers/gcc.json
new file mode 100644
index 0000000..bd5ab6c
--- /dev/null
+++ b/.github/problem-matchers/gcc.json
@@ -0,0 +1,18 @@
+{
+    "__comment": "Taken from vscode-cpptools's Extension/package.json gcc rule",
+    "problemMatcher": [
+        {
+            "owner": "gcc-problem-matcher",
+            "pattern": [
+                {
+                    "regexp": "^(.*):(\\d+):(\\d+):\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$",
+                    "file": 1,
+                    "line": 2,
+                    "column": 3,
+                    "severity": 4,
+                    "message": 5
+                }
+            ]
+        }
+    ]
+}
\ No newline at end of file
diff --git a/.github/problem-matchers/msvc.json b/.github/problem-matchers/msvc.json
new file mode 100644
index 0000000..303a36b
--- /dev/null
+++ b/.github/problem-matchers/msvc.json
@@ -0,0 +1,19 @@
+{
+    "__comment": "Taken from vscode's vs/workbench/contrib/tasks/common/problemMatcher.ts msCompile rule",
+    "problemMatcher": [
+      {
+        "owner": "msvc-problem-matcher",
+        "pattern": [
+          {
+            "regexp": "^(?:\\s+\\d+\\>)?([^\\s].*)\\((\\d+),?(\\d+)?(?:,\\d+,\\d+)?\\)\\s*:\\s+(error|warning|info)\\s+(\\w{1,2}\\d+)\\s*:\\s*(.*)$",
+            "file": 1,
+            "line": 2,
+            "column": 3,
+            "severity": 4,
+            "code": 5,
+            "message": 6
+          }
+        ]
+      }
+    ]
+  }
\ No newline at end of file
diff --git a/.github/problem-matchers/sphinx.json b/.github/problem-matchers/sphinx.json
new file mode 100644
index 0000000..228415f
--- /dev/null
+++ b/.github/problem-matchers/sphinx.json
@@ -0,0 +1,40 @@
+{
+    "problemMatcher": [
+        {
+            "owner": "sphinx-problem-matcher",
+            "pattern": [
+                {
+                    "regexp": "^(.*):(\\d+):\\s+(\\w*):\\s+(.*)$",
+                    "file": 1,
+                    "line": 2,
+                    "severity": 3,
+                    "message": 4
+                }
+            ]
+        },
+        {
+            "owner": "sphinx-problem-matcher-loose",
+            "pattern": [
+                {
+                    "_comment": "A bit of a looser pattern, doesn't look for line numbers, just looks for file names relying on them to start with / and end with .rst",
+                    "regexp": "(\/.*\\.rst):\\s+(\\w*):\\s+(.*)$",
+                    "file": 1,
+                    "severity": 2,
+                    "message": 3
+                }
+            ]
+        },
+        {
+            "owner": "sphinx-problem-matcher-loose-no-severity",
+            "pattern": [
+                {
+                    "_comment": "Looks for file names ending with .rst and line numbers but without severity",
+                    "regexp": "^(.*\\.rst):(\\d+):(.*)$",
+                    "file": 1,
+                    "line": 2,
+                    "message": 3
+                }
+            ]           
+        }
+    ]
+}
\ No newline at end of file
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 3d7c990..8bd506c 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -7,12 +7,14 @@
   push:
     branches:
     - master
+    - 3.10
     - 3.9
     - 3.8
     - 3.7
   pull_request:
     branches:
     - master
+    - 3.10
     - 3.9
     - 3.8
     - 3.7
@@ -23,13 +25,15 @@
     runs-on: ubuntu-latest
     outputs:
       run_tests: ${{ steps.check.outputs.run_tests }}
+      run_ssl_tests: ${{ steps.check.outputs.run_ssl_tests }}
     steps:
       - uses: actions/checkout@v2
       - name: Check for source changes
         id: check
         run: |
-          if [ -z "GITHUB_BASE_REF" ]; then
+          if [ -z "$GITHUB_BASE_REF" ]; then
             echo '::set-output name=run_tests::true'
+            echo '::set-output name=run_ssl_tests::true'
           else
             git fetch origin $GITHUB_BASE_REF --depth=1
             # git diff "origin/$GITHUB_BASE_REF..." (3 dots) may be more
@@ -46,8 +50,31 @@
             #
             # https://github.com/python/core-workflow/issues/373
             git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc)' && echo '::set-output name=run_tests::true' || true
+            git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qE '(ssl|hashlib|hmac|^.github)' && echo '::set-output name=run_ssl_tests::true' || true
           fi
 
+  check_abi:
+    name: 'Check if the ABI has changed'
+    runs-on: ubuntu-20.04
+    needs: check_source
+    if: needs.check_source.outputs.run_tests == 'true'
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions/setup-python@v2
+      - name: Install Dependencies
+        run: |
+            sudo ./.github/workflows/posix-deps-apt.sh
+            sudo apt-get install -yq abigail-tools
+      - name: Build CPython
+        env:
+          CFLAGS: -g3 -O0
+        run: |
+          # Build Python with the libpython dynamic library
+          ./configure --enable-shared
+          make -j4
+      - name: Check for changes in the ABI
+        run: make check-abidump
+
   check_generated_files:
     name: 'Check if generated files are up to date'
     runs-on: ubuntu-latest
@@ -58,28 +85,47 @@
       - uses: actions/setup-python@v2
       - name: Install Dependencies
         run: sudo ./.github/workflows/posix-deps-apt.sh
+      - name: Add ccache to PATH
+        run: echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
+      - name: Configure ccache action
+        uses: hendrikmuhs/ccache-action@v1
+      - name: Check Autoconf version 2.69 and aclocal 1.16.3
+        run: |
+          grep "Generated by GNU Autoconf 2.69" configure
+          grep "aclocal 1.16.3" aclocal.m4
+          grep -q "runstatedir" configure
+          grep -q "PKG_PROG_PKG_CONFIG" aclocal.m4
+      - name: Regenerate autoconf files
+        run: docker run --rm -v $(pwd):/src quay.io/tiran/cpython_autoconf:269
       - name: Build CPython
         run: |
-          ./configure --with-pydebug
+          # Build Python with the libpython dynamic library
+          ./configure --with-pydebug --enable-shared
           make -j4 regen-all
+          make regen-stdlib-module-names
       - name: Check for changes
         run: |
           changes=$(git status --porcelain)
           # Check for changes in regenerated files
-          if ! test -z "$changes"
-          then
-            echo "Generated files not up to date. Perhaps you forgot to run make regen-all ;)"
+          if test -n "$changes"; then
+            echo "Generated files not up to date."
+            echo "Perhaps you forgot to run make regen-all or build.bat --regen. ;)"
+            echo "configure files must be regenerated with a specific, unpatched version of autoconf."
             echo "$changes"
             exit 1
           fi
       - name: Check exported libpython symbols
         run: make smelly
+      - name: Check limited ABI symbols
+        run: make check-limited-abi
 
   build_win32:
     name: 'Windows (x86)'
     runs-on: windows-latest
     needs: check_source
     if: needs.check_source.outputs.run_tests == 'true'
+    env:
+       IncludeUwp: 'true'
     steps:
     - uses: actions/checkout@v2
     - name: Build CPython
@@ -94,8 +140,12 @@
     runs-on: windows-latest
     needs: check_source
     if: needs.check_source.outputs.run_tests == 'true'
+    env:
+       IncludeUwp: 'true'
     steps:
     - uses: actions/checkout@v2
+    - name: Register MSVC problem matcher
+      run: echo "::add-matcher::.github/problem-matchers/msvc.json"
     - name: Build CPython
       run: .\PCbuild\build.bat -e -p x64
     - name: Display build info
@@ -108,10 +158,16 @@
     runs-on: macos-latest
     needs: check_source
     if: needs.check_source.outputs.run_tests == 'true'
+    env:
+      PYTHONSTRICTEXTENSIONBUILD: 1
     steps:
     - uses: actions/checkout@v2
+    - name: Prepare homebrew environment variables
+      run: |
+        echo "LDFLAGS=-L$(brew --prefix tcl-tk)/lib" >> $GITHUB_ENV
+        echo "PKG_CONFIG_PATH=$(brew --prefix openssl@1.1)/lib/pkgconfig:$(brew --prefix tcl-tk)/lib/pkgconfig" >> $GITHUB_ENV
     - name: Configure CPython
-      run: ./configure --with-pydebug --with-openssl=/usr/local/opt/openssl --prefix=/opt/python-dev
+      run: ./configure --with-pydebug --prefix=/opt/python-dev
     - name: Build CPython
       run: make -j4
     - name: Display build info
@@ -121,29 +177,90 @@
 
   build_ubuntu:
     name: 'Ubuntu'
-    runs-on: ubuntu-latest
+    runs-on: ubuntu-20.04
     needs: check_source
     if: needs.check_source.outputs.run_tests == 'true'
     env:
-      OPENSSL_VER: 1.1.1f
+      OPENSSL_VER: 1.1.1n
+      PYTHONSTRICTEXTENSIONBUILD: 1
     steps:
     - uses: actions/checkout@v2
+    - name: Register gcc problem matcher
+      run: echo "::add-matcher::.github/problem-matchers/gcc.json"
     - name: Install Dependencies
       run: sudo ./.github/workflows/posix-deps-apt.sh
+    - name: Configure OpenSSL env vars
+      run: |
+        echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> $GITHUB_ENV
+        echo "OPENSSL_DIR=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}" >> $GITHUB_ENV
+        echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
     - name: 'Restore OpenSSL build'
       id: cache-openssl
-      uses: actions/cache@v2.1.3
+      uses: actions/cache@v2.1.4
       with:
         path: ./multissl/openssl/${{ env.OPENSSL_VER }}
         key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
     - name: Install OpenSSL
       if: steps.cache-openssl.outputs.cache-hit != 'true'
-      run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $PWD/multissl --openssl $OPENSSL_VER --system Linux
+      run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $OPENSSL_VER --system Linux
+    - name: Add ccache to PATH
+      run: |
+        echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
+    - name: Configure ccache action
+      uses: hendrikmuhs/ccache-action@v1
     - name: Configure CPython
-      run: ./configure --with-pydebug --with-openssl=$PWD/multissl/openssl/$OPENSSL_VER
+      run: ./configure --with-pydebug --with-openssl=$OPENSSL_DIR
     - name: Build CPython
       run: make -j4
     - name: Display build info
       run: make pythoninfo
     - name: Tests
       run: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu"
+
+  build_ubuntu_ssltests:
+    name: 'Ubuntu SSL tests with OpenSSL'
+    runs-on: ubuntu-20.04
+    needs: check_source
+    if: needs.check_source.outputs.run_tests == 'true' && needs.check_source.outputs.run_ssl_tests == 'true'
+    strategy:
+      fail-fast: false
+      matrix:
+        openssl_ver: [1.1.1n, 3.0.2]
+    env:
+      OPENSSL_VER: ${{ matrix.openssl_ver }}
+      MULTISSL_DIR: ${{ github.workspace }}/multissl
+      OPENSSL_DIR: ${{ github.workspace }}/multissl/openssl/${{ matrix.openssl_ver }}
+      LD_LIBRARY_PATH: ${{ github.workspace }}/multissl/openssl/${{ matrix.openssl_ver }}/lib
+    steps:
+    - uses: actions/checkout@v2
+    - name: Register gcc problem matcher
+      run: echo "::add-matcher::.github/problem-matchers/gcc.json"
+    - name: Install Dependencies
+      run: sudo ./.github/workflows/posix-deps-apt.sh
+    - name: Configure OpenSSL env vars
+      run: |
+        echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> $GITHUB_ENV
+        echo "OPENSSL_DIR=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}" >> $GITHUB_ENV
+        echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
+    - name: 'Restore OpenSSL build'
+      id: cache-openssl
+      uses: actions/cache@v2.1.4
+      with:
+        path: ./multissl/openssl/${{ env.OPENSSL_VER }}
+        key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
+    - name: Install OpenSSL
+      if: steps.cache-openssl.outputs.cache-hit != 'true'
+      run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $OPENSSL_VER --system Linux
+    - name: Add ccache to PATH
+      run: |
+        echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
+    - name: Configure ccache action
+      uses: hendrikmuhs/ccache-action@v1
+    - name: Configure CPython
+      run: ./configure --with-pydebug --with-openssl=$OPENSSL_DIR
+    - name: Build CPython
+      run: make -j4
+    - name: Display build info
+      run: make pythoninfo
+    - name: SSL tests
+      run: ./python Lib/test/ssltests.py
diff --git a/.github/workflows/build_msi.yml b/.github/workflows/build_msi.yml
index 3664ccb..28ce06f 100644
--- a/.github/workflows/build_msi.yml
+++ b/.github/workflows/build_msi.yml
@@ -4,21 +4,21 @@
   push:
     branches:
     - master
+    - 3.10
     - 3.9
     - 3.8
     - 3.7
     paths:
     - 'Tools/msi/**'
-    - 'Lib/ensurepip/**'
   pull_request:
     branches:
     - master
+    - 3.10
     - 3.9
     - 3.8
     - 3.7
     paths:
     - 'Tools/msi/**'
-    - 'Lib/ensurepip/**'
 
 jobs:
   build_win32:
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
deleted file mode 100644
index 6092f41..0000000
--- a/.github/workflows/coverage.yml
+++ /dev/null
@@ -1,92 +0,0 @@
-name: Coverage
-
-on:
-  push:
-    branches:
-    - master
-    - 3.9
-    - 3.8
-    - 3.7
-    paths-ignore:
-    - 'Doc/**'
-    - 'Misc/**'
-  #pull_request:
-  #  branches:
-  #  - master
-  #  - 3.9
-  #  - 3.8
-  #  - 3.7
-  #  paths-ignore:
-  #  - 'Doc/**'
-  #  - 'Misc/**'
-
-jobs:
-  coverage_ubuntu:
-    name: 'Ubuntu (Coverage)'
-    runs-on: ubuntu-latest
-    env:
-      OPENSSL_VER: 1.1.1f
-    steps:
-    - uses: actions/checkout@v2
-    - name: Install Dependencies
-      run: sudo ./.github/workflows/posix-deps-apt.sh
-    - name: 'Restore OpenSSL build'
-      id: cache-openssl
-      uses: actions/cache@v2.1.3
-      with:
-        path: ./multissl/openssl/${{ env.OPENSSL_VER }}
-        key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
-    - name: Install OpenSSL
-      if: steps.cache-openssl.outputs.cache-hit != 'true'
-      run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $PWD/multissl --openssl $OPENSSL_VER --system Linux
-    - name: Configure CPython
-      run: ./configure --with-openssl=$PWD/multissl/openssl/$OPENSSL_VER
-    - name: Build CPython
-      run: make -j4
-    - name: Display build info
-      run: make pythoninfo
-    - name: 'Coverage Preparation'
-      run: |
-        ./python -m venv .venv
-        source ./.venv/bin/activate
-        python -m pip install -U coverage
-        python -m pip install -r Misc/requirements-test.txt
-        python -m test.pythoninfo
-    - name: 'Tests with coverage'
-      run: >
-        source ./.venv/bin/activate &&
-        xvfb-run python -m coverage
-        run --branch --pylib
-        -m test
-        --fail-env-changed
-        -uall,-cpu
-        -x test_multiprocessing_fork
-        -x test_multiprocessing_forkserver
-        -x test_multiprocessing_spawn
-        -x test_concurrent_futures
-        || true
-    - name: 'Publish code coverage results'
-      run: |
-        source ./.venv/bin/activate
-        bash <(curl -s https://codecov.io/bash) -y .github/codecov.yml
-      env:
-        CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
-
-  c_coverage_ubuntu:
-    name: 'Ubuntu (C Coverage)'
-    runs-on: ubuntu-latest
-    steps:
-    - uses: actions/checkout@v2
-    - name: Install Dependencies
-      run: sudo ./.github/workflows/posix-deps-apt.sh
-    - name: Configure CPython
-      run: ./configure
-    - name: 'Build CPython and measure coverage'
-      run: xvfb-run make -j4 coverage-report
-    - name: 'Publish code coverage results'
-      if: always()
-      run: |
-        make pythoninfo
-        bash <(curl -s https://codecov.io/bash) -y .github/codecov.yml
-      env:
-        CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml
index 02e7c86..4426238 100644
--- a/.github/workflows/doc.yml
+++ b/.github/workflows/doc.yml
@@ -12,6 +12,7 @@
   pull_request:
     branches:
     - master
+    - 3.10
     - 3.9
     - 3.8
     - 3.7
@@ -25,6 +26,8 @@
     runs-on: ubuntu-latest
     steps:
     - uses: actions/checkout@v2
+    - name: Register Sphinx problem matcher
+      run: echo "::add-matcher::.github/problem-matchers/sphinx.json"
     - name: 'Install Dependencies'
       run: sudo ./.github/workflows/posix-deps-apt.sh && sudo apt-get install wamerican
     - name: 'Configure CPython'
@@ -34,9 +37,9 @@
     - name: 'Install build dependencies'
       run: make -C Doc/ PYTHON=../python venv
     - name: 'Build documentation'
-      run: xvfb-run make -C Doc/ PYTHON=../python SPHINXOPTS="-q -W -j4" doctest suspicious html
+      run: xvfb-run make -C Doc/ PYTHON=../python SPHINXOPTS="-q -W --keep-going -j4" doctest html suspicious
     - name: 'Upload'
-      uses: actions/upload-artifact@v2.2.1
+      uses: actions/upload-artifact@v2.2.2
       with:
         name: doc-html
         path: Doc/build/html
diff --git a/.github/workflows/posix-deps-apt.sh b/.github/workflows/posix-deps-apt.sh
index 5c7b998..0119843 100755
--- a/.github/workflows/posix-deps-apt.sh
+++ b/.github/workflows/posix-deps-apt.sh
@@ -3,11 +3,13 @@
 
 apt-get -yq install \
     build-essential \
+    ccache \
     gdb \
     lcov \
     libbz2-dev \
     libffi-dev \
     libgdbm-dev \
+    libgdbm-compat-dev \
     liblzma-dev \
     libncurses5-dev \
     libreadline6-dev \
diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml
new file mode 100644
index 0000000..26806fa
--- /dev/null
+++ b/.github/workflows/stale.yml
@@ -0,0 +1,22 @@
+name: Mark stale pull requests
+
+on:
+  schedule:
+  - cron: "0 0 * * *"
+
+permissions:
+  pull-requests: write
+
+jobs:
+  stale:
+
+    runs-on: ubuntu-latest
+
+    steps:
+    - uses: actions/stale@v3
+      with:
+        repo-token: ${{ secrets.GITHUB_TOKEN }}
+        stale-pr-message: 'This PR is stale because it has been open for 30 days with no activity.'
+        stale-pr-label: 'stale'
+        days-before-stale: 30
+        days-before-close: -1
diff --git a/.gitignore b/.gitignore
index 80dcf34..09d08c8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -35,6 +35,7 @@
 .coverage
 .mypy_cache/
 .pytest_cache/
+.DS_Store
 
 *.exe
 !Lib/distutils/command/*.exe
@@ -60,6 +61,15 @@
 !Lib/test/data/README
 /Makefile
 /Makefile.pre
+Mac/Makefile
+Mac/PythonLauncher/Info.plist
+Mac/PythonLauncher/Makefile
+Mac/PythonLauncher/Python Launcher
+Mac/PythonLauncher/Python Launcher.app/*
+Mac/Resources/app/Info.plist
+Mac/Resources/framework/Info.plist
+Mac/pythonw
+/*.framework/
 Misc/python.pc
 Misc/python-embed.pc
 Misc/python-config.sh
@@ -102,6 +112,8 @@
 /config.log
 /config.status
 /config.status.lineno
+# hendrikmuhs/ccache-action@v1
+/.ccache
 /platform
 /profile-clean-stamp
 /profile-run-stamp
@@ -124,3 +136,9 @@
 # Ignore ./python binary on Unix but still look into ./Python/ directory.
 /python
 !/Python/
+
+# Artifacts generated by 3.11 lying around when switching branches:
+/_bootstrap_python
+/Programs/_freeze_module
+/Python/deepfreeze/
+/Python/frozen_modules/
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
index 5d9f420..ee6cabe 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -10,7 +10,7 @@
 
 env:
   global:
-    - OPENSSL=1.1.1f
+    - OPENSSL=1.1.1k
     - OPENSSL_DIR="$HOME/multissl/openssl/${OPENSSL}"
     - PATH="${OPENSSL_DIR}/bin:$PATH"
     - CFLAGS="-I${OPENSSL_DIR}/include"
@@ -18,6 +18,7 @@
     # Set rpath with env var instead of -Wl,-rpath linker flag
     # OpenSSL ignores LDFLAGS when linking bin/openssl
     - LD_RUN_PATH="${OPENSSL_DIR}/lib"
+    - PYTHONSTRICTEXTENSIONBUILD=1
 
 branches:
   only:
@@ -53,7 +54,7 @@
         - cd Doc
         - make venv PYTHON=python
       script:
-        - make check suspicious html SPHINXOPTS="-q -W -j4"
+        - make check html suspicious SPHINXOPTS="-q -W -j4"
     - name: "Documentation tests"
       os: linux
       language: c
@@ -69,59 +70,6 @@
         - make -C Doc/ PYTHON=../python venv
       script:
         xvfb-run make -C Doc/ PYTHON=../python SPHINXOPTS="-q -W -j4" doctest
-    - name: "Test code coverage (Python)"
-      os: linux
-      language: c
-      compiler: gcc
-      env: OPTIONAL=true
-      addons:
-        apt:
-          packages:
-            - xvfb
-      before_script:
-        - |
-            if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]
-            then
-              echo "Don't run Python coverage on pull requests."
-              exit
-            fi
-        - ./configure
-        - make -j4
-        # Need a venv that can parse covered code.
-        - ./python -m venv venv
-        - ./venv/bin/python -m pip install -U coverage
-        - ./venv/bin/python -m pip install -r Misc/requirements-test.txt
-        - ./venv/bin/python -m test.pythoninfo
-      script:
-        # Skip tests that re-run the entire test suite.
-        - xvfb-run ./venv/bin/python -m coverage run --branch --pylib -m test --fail-env-changed -uall,-cpu -x test_multiprocessing_fork -x test_multiprocessing_forkserver -x test_multiprocessing_spawn -x test_concurrent_futures || true
-      after_script:  # Probably should be after_success once test suite updated to run under coverage.py.
-        # Make the `coverage` command available to Codecov w/ a version of Python that can parse all source files.
-        - source ./venv/bin/activate
-        - bash <(curl -s https://codecov.io/bash) -y .github/codecov.yml
-    - name: "Test code coverage (C)"
-      os: linux
-      language: c
-      compiler: gcc
-      env: OPTIONAL=true
-      addons:
-        apt:
-          packages:
-            - lcov
-            - xvfb
-      before_script:
-        - |
-            if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]
-            then
-              echo "Don't run C coverage on pull requests."
-              exit
-            fi
-        - ./configure
-      script:
-        - xvfb-run make -j4 coverage-report
-      after_script:  # Probably should be after_success once test suite updated to run under coverage.py.
-        - make pythoninfo
-        - bash <(curl -s https://codecov.io/bash) -y .github/codecov.yml
 
 
 before_install:
@@ -170,6 +118,7 @@
   - eval "$(pyenv init -)"
   - pyenv global 3.8
   - PYTHON_FOR_REGEN=python3.8 make -j4 regen-all
+  - make regen-stdlib-module-names
   - changes=`git status --porcelain`
   - |
       # Check for changes in regenerated files
@@ -190,6 +139,8 @@
   - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./python Tools/scripts/patchcheck.py --travis $TRAVIS_PULL_REQUEST; fi
   # Check that all symbols exported by libpython start with "Py" or "_Py"
   - make smelly
+  # Check that all symbols in the limited abi are present
+  - make check-limited-abi
   # `-r -w` implicitly provided through `make buildbottest`.
   - |
     if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
diff --git a/Android-bionic.bp b/Android-bionic.bp
index 3068173..690f831 100644
--- a/Android-bionic.bp
+++ b/Android-bionic.bp
@@ -54,8 +54,6 @@
         "Modules/_multiprocessing/semaphore.c",
         "Modules/_opcode.c",
         "Modules/_operator.c",
-        "Modules/parsermodule.c",
-        "Modules/_peg_parser.c",
         "Modules/_pickle.c",
         "Modules/posixmodule.c",
         "Modules/_posixsubprocess.c",
diff --git a/Android-darwin_x86_64.bp b/Android-darwin_x86_64.bp
index ec05518..a6b7c26 100644
--- a/Android-darwin_x86_64.bp
+++ b/Android-darwin_x86_64.bp
@@ -37,7 +37,6 @@
         "Modules/_multiprocessing/semaphore.c",
         "Modules/_opcode.c",
         "Modules/_operator.c",
-        "Modules/_peg_parser.c",
         "Modules/_pickle.c",
         "Modules/_posixsubprocess.c",
         "Modules/_queuemodule.c",
@@ -73,7 +72,6 @@
         "Modules/mathmodule.c",
         "Modules/md5module.c",
         "Modules/mmapmodule.c",
-        "Modules/parsermodule.c",
         "Modules/posixmodule.c",
         "Modules/pwdmodule.c",
         "Modules/pyexpat.c",
diff --git a/Android-linux_x86_64.bp b/Android-linux_x86_64.bp
index 55ed076..234b38d 100644
--- a/Android-linux_x86_64.bp
+++ b/Android-linux_x86_64.bp
@@ -56,8 +56,6 @@
         "Modules/_multiprocessing/semaphore.c",
         "Modules/_opcode.c",
         "Modules/_operator.c",
-        "Modules/parsermodule.c",
-        "Modules/_peg_parser.c",
         "Modules/_pickle.c",
         "Modules/posixmodule.c",
         "Modules/_posixsubprocess.c",
diff --git a/Android.bp b/Android.bp
index 8c10965..26b6fe6 100644
--- a/Android.bp
+++ b/Android.bp
@@ -139,16 +139,16 @@
             local_include_dirs: ["android/bionic/pyconfig"],
         },
         android_arm: {
-            cflags: ["-DSOABI=\"cpython-39android-arm-android-bionic\""],
+            cflags: ["-DSOABI=\"cpython-310android-arm-android-bionic\""],
         },
         android_arm64: {
-            cflags: ["-DSOABI=\"cpython-39android-arm64-android-bionic\""],
+            cflags: ["-DSOABI=\"cpython-310android-arm64-android-bionic\""],
         },
         android_x86: {
-            cflags: ["-DSOABI=\"cpython-39android-x86-android-bionic\""],
+            cflags: ["-DSOABI=\"cpython-310android-x86-android-bionic\""],
         },
         android_x86_64: {
-            cflags: ["-DSOABI=\"cpython-39android-x86_64-android-bionic\""],
+            cflags: ["-DSOABI=\"cpython-310android-x86_64-android-bionic\""],
         },
         host: {
             // Host builds are moving to prebuilts, which has a higher risk of
@@ -161,14 +161,14 @@
             cflags: [
                 "-Wno-deprecated-declarations",
                 "-Wno-pointer-arith",
-                "-DSOABI=\"cpython-39android-x86_64-darwin\"",
+                "-DSOABI=\"cpython-310android-x86_64-darwin\"",
             ],
         },
         linux_bionic: {
             // NB linux_bionic is a 'host' architecture but it uses the bionic libc like 'android'
             // targets so use the android pyconfig.
             local_include_dirs: ["android/bionic/pyconfig"],
-            cflags: ["-DSOABI=\"cpython-39android-x86_64-linux-bionic\""],
+            cflags: ["-DSOABI=\"cpython-310android-x86_64-linux-bionic\""],
         },
         linux_glibc_x86: {
             enabled: false,
@@ -178,11 +178,11 @@
         },
         linux_glibc_x86_64: {
             local_include_dirs: ["android/linux_x86_64/pyconfig"],
-            cflags: ["-DSOABI=\"cpython-39android-x86_64-linux-gnu\""],
+            cflags: ["-DSOABI=\"cpython-310android-x86_64-linux-gnu\""],
         },
         linux_musl_x86_64: {
             local_include_dirs: ["android/linux_x86_64/pyconfig"],
-            cflags: ["-DSOABI=\"cpython-39android-x86_64-linux-gnu\""],
+            cflags: ["-DSOABI=\"cpython-310android-x86_64-linux-gnu\""],
         },
         windows: {
             enabled: false,
@@ -211,19 +211,13 @@
     cflags: ["-DPy_BUILD_CORE", "-DPLATLIBDIR=\"lib\""],
     srcs: [
         // Makefile.pre.in PEGEN_OBJS
-        "Parser/pegen/pegen.c",
-        "Parser/pegen/parse.c",
-        "Parser/pegen/parse_string.c",
-        "Parser/pegen/peg_api.c",
+        "Parser/pegen.c",
+        "Parser/parser.c",
+        "Parser/string_parser.c",
+        "Parser/peg_api.c",
 
         // Makefile.pre.in PARSER_OBJS
-        "Parser/acceler.c",
-        "Parser/grammar1.c",
-        "Parser/listnode.c",
         "Parser/myreadline.c",
-        "Parser/node.c",
-        "Parser/parser.c",
-        "Parser/parsetok.c",
         "Parser/token.c",
         "Parser/tokenizer.c",
 
@@ -270,6 +264,7 @@
         "Objects/typeobject.c",
         "Objects/unicodeobject.c",
         "Objects/unicodectype.c",
+        "Objects/unionobject.c",
         "Objects/weakrefobject.c",
 
         // Makefile.pre.in PYTHON_OBJS
@@ -294,7 +289,6 @@
         "Python/getcopyright.c",
         "Python/getplatform.c",
         "Python/getversion.c",
-        "Python/graminit.c",
         "Python/hamt.c",
         "Python/hashtable.c",
         "Python/import.c",
@@ -305,7 +299,6 @@
         "Python/mysnprintf.c",
         "Python/mystrtoul.c",
         "Python/pathconfig.c",
-        "Python/peephole.c",
         "Python/preconfig.c",
         "Python/pyarena.c",
         "Python/pyctype.c",
@@ -329,6 +322,7 @@
         "Python/dtoa.c",
         "Python/formatter_unicode.c",
         "Python/fileutils.c",
+        "Python/suggestions.c",
         "Python/dynload_shlib.c",
     ],
 
@@ -352,7 +346,7 @@
     name: "py3-launcher-defaults",
     defaults: ["py3-interp-defaults", "cpython3-interp-host-prebuilts"],
     cflags: [
-        "-DVERSION=\"3.9\"",
+        "-DVERSION=\"3.10\"",
         "-DVPATH=\"\"",
         "-DPREFIX=\"\"",
         "-DEXEC_PREFIX=\"\"",
@@ -535,6 +529,7 @@
             ],
         },
         darwin: {
+            cflags: ["-D__APPLE_USE_RFC_3542"],
             srcs: [":py3-c-modules-darwin_x86_64"],
             static_libs: [
                 "libopenssl_ssl",
diff --git a/Doc/Makefile b/Doc/Makefile
index f653d70..24528a1 100644
--- a/Doc/Makefile
+++ b/Doc/Makefile
@@ -137,14 +137,22 @@
 htmlview: html
 	 $(PYTHON) -c "import webbrowser; webbrowser.open('build/html/index.html')"
 
-clean:
-	-rm -rf build/* $(VENVDIR)/*
+clean: clean-venv
+	-rm -rf build/*
+
+clean-venv:
+	rm -rf $(VENVDIR)
 
 venv:
-	$(PYTHON) -m venv $(VENVDIR)
-	$(VENVDIR)/bin/python3 -m pip install -U pip setuptools
-	$(VENVDIR)/bin/python3 -m pip install -r requirements.txt
-	@echo "The venv has been created in the $(VENVDIR) directory"
+	@if [ -d $(VENVDIR) ] ; then \
+		echo "venv already exists."; \
+		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; \
+		echo "The venv has been created in the $(VENVDIR) directory"; \
+	fi
 
 dist:
 	rm -rf dist
@@ -202,6 +210,7 @@
 
 check:
 	$(PYTHON) tools/rstlint.py -i tools -i $(VENVDIR) -i README.rst
+	$(PYTHON) tools/rstlint.py ../Misc/NEWS.d/next/
 
 serve:
 	$(PYTHON) ../Tools/scripts/serve.py build/html
@@ -215,12 +224,11 @@
 
 # for development releases: always build
 autobuild-dev:
-	make dist SPHINXOPTS='$(SPHINXOPTS) -Ea -A daily=1 -A switchers=1'
-	-make suspicious
+	make dist SPHINXOPTS='$(SPHINXOPTS) -Ea -A daily=1'
 
 # for quick rebuilds (HTML only)
 autobuild-dev-html:
-	make html SPHINXOPTS='$(SPHINXOPTS) -Ea -A daily=1 -A switchers=1'
+	make html SPHINXOPTS='$(SPHINXOPTS) -Ea -A daily=1'
 
 # for stable releases: only build if not in pre-release stage (alpha, beta)
 # release candidate downloads are okay, since the stable tree can be in that stage
diff --git a/Doc/README.rst b/Doc/README.rst
index 380ea4f..7e8a27b 100644
--- a/Doc/README.rst
+++ b/Doc/README.rst
@@ -28,28 +28,31 @@
 Using make
 ----------
 
-To get started on UNIX, you can create a virtual environment with the command ::
+To get started on UNIX, you can create a virtual environment and build
+documentation with the commands::
 
   make venv
-
-That will install all the tools necessary to build the documentation. Assuming
-the virtual environment was created in the ``venv`` directory (the default;
-configurable with the VENVDIR variable), you can run the following command to
-build the HTML output files::
-
   make html
 
-By default, if the virtual environment is not created, the Makefile will
-look for instances of sphinxbuild and blurb installed on your process PATH
-(configurable with the SPHINXBUILD and BLURB variables).
+The virtual environment in the ``venv`` directory will contain all the tools
+necessary to build the documentation downloaded and installed from PyPI.
+If you'd like to create the virtual environment in a different location,
+you can specify it using the ``VENVDIR`` variable.
+
+You can also skip creating the virtual environment altogether, in which case
+the Makefile will look for instances of ``sphinxbuild`` and ``blurb``
+installed on your process ``PATH`` (configurable with the ``SPHINXBUILD`` and
+``BLURB`` variables).
 
 On Windows, we try to emulate the Makefile as closely as possible with a
 ``make.bat`` file. If you need to specify the Python interpreter to use,
-set the PYTHON environment variable instead.
+set the PYTHON environment variable.
 
 Available make targets are:
 
-* "clean", which removes all build files.
+* "clean", which removes all build files and the virtual environment.
+
+* "clean-venv", which removes the virtual environment directory.
 
 * "venv", which creates a virtual environment with all necessary tools
   installed.
diff --git a/Doc/bugs.rst b/Doc/bugs.rst
index a17f04d..b3d0577 100644
--- a/Doc/bugs.rst
+++ b/Doc/bugs.rst
@@ -41,7 +41,7 @@
 ==============================
 
 Bug reports for Python itself should be submitted via the Python Bug Tracker
-(https://bugs.python.org/).  The bug tracker offers a Web form which allows
+(https://bugs.python.org/).  The bug tracker offers a web form which allows
 pertinent information to be entered and submitted to the developers.
 
 The first step in filing a report is to determine whether the problem has
@@ -80,7 +80,7 @@
       Article which goes into some detail about how to create a useful bug report.
       This describes what kind of information is useful and why it is useful.
 
-   `Bug Report Writing Guidelines <https://developer.mozilla.org/en-US/docs/Mozilla/QA/Bug_writing_guidelines>`_
+   `Bug Writing Guidelines <https://bugzilla.mozilla.org/page.cgi?id=bug-writing.html>`_
       Information about writing a good bug report.  Some of this is specific to the
       Mozilla project, but describes general good practices.
 
diff --git a/Doc/c-api/apiabiversion.rst b/Doc/c-api/apiabiversion.rst
index b8a8f2f..04050f7 100644
--- a/Doc/c-api/apiabiversion.rst
+++ b/Doc/c-api/apiabiversion.rst
@@ -6,34 +6,57 @@
 API and ABI Versioning
 ***********************
 
-``PY_VERSION_HEX`` is the Python version number encoded in a single integer.
+CPython exposes its version number in the following macros.
+Note that these correspond to the version code is **built** with,
+not necessarily the version used at **run time**.
 
-For example if the ``PY_VERSION_HEX`` is set to ``0x030401a2``, the underlying
-version information can be found by treating it as a 32 bit number in
-the following manner:
+See :ref:`stable` for a discussion of API and ABI stability across versions.
 
-   +-------+-------------------------+------------------------------------------------+
-   | Bytes | Bits (big endian order) | Meaning                                        |
-   +=======+=========================+================================================+
-   | ``1`` |       ``1-8``           |  ``PY_MAJOR_VERSION`` (the ``3`` in            |
-   |       |                         |  ``3.4.1a2``)                                  |
-   +-------+-------------------------+------------------------------------------------+
-   | ``2`` |       ``9-16``          |  ``PY_MINOR_VERSION`` (the ``4`` in            |
-   |       |                         |  ``3.4.1a2``)                                  |
-   +-------+-------------------------+------------------------------------------------+
-   | ``3`` |       ``17-24``         |  ``PY_MICRO_VERSION`` (the ``1`` in            |
-   |       |                         |  ``3.4.1a2``)                                  |
-   +-------+-------------------------+------------------------------------------------+
-   | ``4`` |       ``25-28``         |  ``PY_RELEASE_LEVEL`` (``0xA`` for alpha,      |
-   |       |                         |  ``0xB`` for beta, ``0xC`` for release         |
-   |       |                         |  candidate and ``0xF`` for final), in this     |
-   |       |                         |  case it is alpha.                             |
-   +-------+-------------------------+------------------------------------------------+
-   |       |       ``29-32``         |  ``PY_RELEASE_SERIAL`` (the ``2`` in           |
-   |       |                         |  ``3.4.1a2``, zero for final releases)         |
-   +-------+-------------------------+------------------------------------------------+
+.. c:macro:: PY_MAJOR_VERSION
 
-Thus ``3.4.1a2`` is hexversion ``0x030401a2``.
+   The ``3`` in ``3.4.1a2``.
+
+.. c:macro:: PY_MINOR_VERSION
+
+   The ``4`` in ``3.4.1a2``.
+
+.. c:macro:: PY_MICRO_VERSION
+
+   The ``1`` in ``3.4.1a2``.
+
+.. c:macro:: PY_RELEASE_LEVEL
+
+   The ``a`` in ``3.4.1a2``.
+   This can be ``0xA`` for alpha, ``0xB`` for beta, ``0xC`` for release
+   candidate or ``0xF`` for final.
+
+.. c:macro:: PY_RELEASE_SERIAL
+
+   The ``2`` in ``3.4.1a2``. Zero for final releases.
+
+.. c:macro:: PY_VERSION_HEX
+
+   The Python version number encoded in a single integer.
+
+   The underlying version information can be found by treating it as a 32 bit
+   number in the following manner:
+
+   +-------+-------------------------+-------------------------+--------------------------+
+   | Bytes | Bits (big endian order) | Meaning                 | Value for ``3.4.1a2``    |
+   +=======+=========================+=========================+==========================+
+   |   1   |         1-8             |  ``PY_MAJOR_VERSION``   | ``0x03``                 |
+   +-------+-------------------------+-------------------------+--------------------------+
+   |   2   |         9-16            |  ``PY_MINOR_VERSION``   | ``0x04``                 |
+   +-------+-------------------------+-------------------------+--------------------------+
+   |   3   |         17-24           |  ``PY_MICRO_VERSION``   | ``0x01``                 |
+   +-------+-------------------------+-------------------------+--------------------------+
+   |   4   |         25-28           |  ``PY_RELEASE_LEVEL``   | ``0xA``                  |
+   +       +-------------------------+-------------------------+--------------------------+
+   |       |         29-32           |  ``PY_RELEASE_SERIAL``  | ``0x2``                  |
+   +-------+-------------------------+-------------------------+--------------------------+
+
+   Thus ``3.4.1a2`` is hexversion ``0x030401a2`` and ``3.10.0`` is
+   hexversion ``0x030a00f0``.
+
 
 All the given macros are defined in :source:`Include/patchlevel.h`.
-
diff --git a/Doc/c-api/arg.rst b/Doc/c-api/arg.rst
index a187a8f..1d93b35 100644
--- a/Doc/c-api/arg.rst
+++ b/Doc/c-api/arg.rst
@@ -55,13 +55,11 @@
 
 .. note::
 
-   For all ``#`` variants of formats (``s#``, ``y#``, etc.), the type of
-   the length argument (int or :c:type:`Py_ssize_t`) is controlled by
-   defining the macro :c:macro:`PY_SSIZE_T_CLEAN` before including
-   :file:`Python.h`.  If the macro was defined, length is a
-   :c:type:`Py_ssize_t` rather than an :c:type:`int`. This behavior will change
-   in a future Python version to only support :c:type:`Py_ssize_t` and
-   drop :c:type:`int` support. It is best to always define :c:macro:`PY_SSIZE_T_CLEAN`.
+   For all ``#`` variants of formats (``s#``, ``y#``, etc.), the macro
+   :c:macro:`PY_SSIZE_T_CLEAN` must be defined before including
+   :file:`Python.h`. On Python 3.9 and older, the type of the length argument
+   is :c:type:`Py_ssize_t` if the :c:macro:`PY_SSIZE_T_CLEAN` macro is defined,
+   or int otherwise.
 
 
 ``s`` (:class:`str`) [const char \*]
@@ -90,7 +88,7 @@
    In this case the resulting C string may contain embedded NUL bytes.
    Unicode objects are converted to C strings using ``'utf-8'`` encoding.
 
-``s#`` (:class:`str`, read-only :term:`bytes-like object`) [const char \*, int or :c:type:`Py_ssize_t`]
+``s#`` (:class:`str`, read-only :term:`bytes-like object`) [const char \*, :c:type:`Py_ssize_t`]
    Like ``s*``, except that it doesn't accept mutable objects.
    The result is stored into two C variables,
    the first one a pointer to a C string, the second one its length.
@@ -105,7 +103,7 @@
    Like ``s*``, but the Python object may also be ``None``, in which case the
    ``buf`` member of the :c:type:`Py_buffer` structure is set to ``NULL``.
 
-``z#`` (:class:`str`, read-only :term:`bytes-like object` or ``None``) [const char \*, int or :c:type:`Py_ssize_t`]
+``z#`` (:class:`str`, read-only :term:`bytes-like object` or ``None``) [const char \*, :c:type:`Py_ssize_t`]
    Like ``s#``, but the Python object may also be ``None``, in which case the C
    pointer is set to ``NULL``.
 
@@ -124,7 +122,7 @@
    bytes-like objects.  **This is the recommended way to accept
    binary data.**
 
-``y#`` (read-only :term:`bytes-like object`) [const char \*, int or :c:type:`Py_ssize_t`]
+``y#`` (read-only :term:`bytes-like object`) [const char \*, :c:type:`Py_ssize_t`]
    This variant on ``s#`` doesn't accept Unicode objects, only bytes-like
    objects.
 
@@ -151,16 +149,16 @@
       Previously, :exc:`TypeError` was raised when embedded null code points
       were encountered in the Python string.
 
-   .. deprecated-removed:: 3.3 4.0
+   .. deprecated-removed:: 3.3 3.12
       Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
       :c:func:`PyUnicode_AsWideCharString`.
 
-``u#`` (:class:`str`) [const Py_UNICODE \*, int or :c:type:`Py_ssize_t`]
+``u#`` (:class:`str`) [const Py_UNICODE \*, :c:type:`Py_ssize_t`]
    This variant on ``u`` stores into two C variables, the first one a pointer to a
    Unicode data buffer, the second one its length.  This variant allows
    null code points.
 
-   .. deprecated-removed:: 3.3 4.0
+   .. deprecated-removed:: 3.3 3.12
       Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
       :c:func:`PyUnicode_AsWideCharString`.
 
@@ -168,15 +166,15 @@
    Like ``u``, but the Python object may also be ``None``, in which case the
    :c:type:`Py_UNICODE` pointer is set to ``NULL``.
 
-   .. deprecated-removed:: 3.3 4.0
+   .. deprecated-removed:: 3.3 3.12
       Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
       :c:func:`PyUnicode_AsWideCharString`.
 
-``Z#`` (:class:`str` or ``None``) [const Py_UNICODE \*, int or :c:type:`Py_ssize_t`]
+``Z#`` (:class:`str` or ``None``) [const Py_UNICODE \*, :c:type:`Py_ssize_t`]
    Like ``u#``, but the Python object may also be ``None``, in which case the
    :c:type:`Py_UNICODE` pointer is set to ``NULL``.
 
-   .. deprecated-removed:: 3.3 4.0
+   .. deprecated-removed:: 3.3 3.12
       Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
       :c:func:`PyUnicode_AsWideCharString`.
 
@@ -213,7 +211,7 @@
    recoding them.  Instead, the implementation assumes that the byte string object uses
    the encoding passed in as parameter.
 
-``es#`` (:class:`str`) [const char \*encoding, char \*\*buffer, int or :c:type:`Py_ssize_t` \*buffer_length]
+``es#`` (:class:`str`) [const char \*encoding, char \*\*buffer, :c:type:`Py_ssize_t` \*buffer_length]
    This variant on ``s#`` is used for encoding Unicode into a character buffer.
    Unlike the ``es`` format, this variant allows input data which contains NUL
    characters.
@@ -244,7 +242,7 @@
    In both cases, *\*buffer_length* is set to the length of the encoded data
    without the trailing NUL byte.
 
-``et#`` (:class:`str`, :class:`bytes` or :class:`bytearray`) [const char \*encoding, char \*\*buffer, int or :c:type:`Py_ssize_t` \*buffer_length]
+``et#`` (:class:`str`, :class:`bytes` or :class:`bytearray`) [const char \*encoding, char \*\*buffer, :c:type:`Py_ssize_t` \*buffer_length]
    Same as ``es#`` except that byte string objects are passed through without recoding
    them. Instead, the implementation assumes that the byte string object uses the
    encoding passed in as parameter.
@@ -484,7 +482,8 @@
    *min* and no more than *max*; *min* and *max* may be equal.  Additional
    arguments must be passed to the function, each of which should be a pointer to a
    :c:type:`PyObject*` variable; these will be filled in with the values from
-   *args*; they will contain borrowed references.  The variables which correspond
+   *args*; they will contain :term:`borrowed references <borrowed reference>`.
+   The variables which correspond
    to optional parameters not given by *args* will not be filled in; these should
    be initialized by the caller. This function returns true on success and false if
    *args* is not a tuple or contains the wrong number of elements; an exception
@@ -549,7 +548,7 @@
       Convert a null-terminated C string to a Python :class:`str` object using ``'utf-8'``
       encoding. If the C string pointer is ``NULL``, ``None`` is used.
 
-   ``s#`` (:class:`str` or ``None``) [const char \*, int or :c:type:`Py_ssize_t`]
+   ``s#`` (:class:`str` or ``None``) [const char \*, :c:type:`Py_ssize_t`]
       Convert a C string and its length to a Python :class:`str` object using ``'utf-8'``
       encoding. If the C string pointer is ``NULL``, the length is ignored and
       ``None`` is returned.
@@ -558,14 +557,14 @@
       This converts a C string to a Python :class:`bytes` object.  If the C
       string pointer is ``NULL``, ``None`` is returned.
 
-   ``y#`` (:class:`bytes`) [const char \*, int or :c:type:`Py_ssize_t`]
+   ``y#`` (:class:`bytes`) [const char \*, :c:type:`Py_ssize_t`]
       This converts a C string and its lengths to a Python object.  If the C
       string pointer is ``NULL``, ``None`` is returned.
 
    ``z`` (:class:`str` or ``None``) [const char \*]
       Same as ``s``.
 
-   ``z#`` (:class:`str` or ``None``) [const char \*, int or :c:type:`Py_ssize_t`]
+   ``z#`` (:class:`str` or ``None``) [const char \*, :c:type:`Py_ssize_t`]
       Same as ``s#``.
 
    ``u`` (:class:`str`) [const wchar_t \*]
@@ -573,7 +572,7 @@
       data to a Python Unicode object.  If the Unicode buffer pointer is ``NULL``,
       ``None`` is returned.
 
-   ``u#`` (:class:`str`) [const wchar_t \*, int or :c:type:`Py_ssize_t`]
+   ``u#`` (:class:`str`) [const wchar_t \*, :c:type:`Py_ssize_t`]
       Convert a Unicode (UTF-16 or UCS-4) data buffer and its length to a Python
       Unicode object.   If the Unicode buffer pointer is ``NULL``, the length is ignored
       and ``None`` is returned.
@@ -581,7 +580,7 @@
    ``U`` (:class:`str` or ``None``) [const char \*]
       Same as ``s``.
 
-   ``U#`` (:class:`str` or ``None``) [const char \*, int or :c:type:`Py_ssize_t`]
+   ``U#`` (:class:`str` or ``None``) [const char \*, :c:type:`Py_ssize_t`]
       Same as ``s#``.
 
    ``i`` (:class:`int`) [int]
diff --git a/Doc/c-api/bool.rst b/Doc/c-api/bool.rst
index ce8de6e..c197d44 100644
--- a/Doc/c-api/bool.rst
+++ b/Doc/c-api/bool.rst
@@ -13,7 +13,8 @@
 
 .. c:function:: int PyBool_Check(PyObject *o)
 
-   Return true if *o* is of type :c:data:`PyBool_Type`.
+   Return true if *o* is of type :c:data:`PyBool_Type`.  This function always
+   succeeds.
 
 
 .. c:var:: PyObject* Py_False
diff --git a/Doc/c-api/bytearray.rst b/Doc/c-api/bytearray.rst
index b2f409c..30bcfc7 100644
--- a/Doc/c-api/bytearray.rst
+++ b/Doc/c-api/bytearray.rst
@@ -25,13 +25,13 @@
 .. c:function:: int PyByteArray_Check(PyObject *o)
 
    Return true if the object *o* is a bytearray object or an instance of a
-   subtype of the bytearray type.
+   subtype of the bytearray type.  This function always succeeds.
 
 
 .. c:function:: int PyByteArray_CheckExact(PyObject *o)
 
    Return true if the object *o* is a bytearray object, but not an instance of a
-   subtype of the bytearray type.
+   subtype of the bytearray type.  This function always succeeds.
 
 
 Direct API functions
diff --git a/Doc/c-api/bytes.rst b/Doc/c-api/bytes.rst
index 0e33ed2..de65701 100644
--- a/Doc/c-api/bytes.rst
+++ b/Doc/c-api/bytes.rst
@@ -25,13 +25,13 @@
 .. c:function:: int PyBytes_Check(PyObject *o)
 
    Return true if the object *o* is a bytes object or an instance of a subtype
-   of the bytes type.
+   of the bytes type.  This function always succeeds.
 
 
 .. c:function:: int PyBytes_CheckExact(PyObject *o)
 
    Return true if the object *o* is a bytes object, but not an instance of a
-   subtype of the bytes type.
+   subtype of the bytes type.  This function always succeeds.
 
 
 .. c:function:: PyObject* PyBytes_FromString(const char *v)
diff --git a/Doc/c-api/call.rst b/Doc/c-api/call.rst
index 31dc9c8..739b5e9 100644
--- a/Doc/c-api/call.rst
+++ b/Doc/c-api/call.rst
@@ -185,7 +185,7 @@
 Various functions are available for calling a Python object.
 Each converts its arguments to a convention supported by the called object –
 either *tp_call* or vectorcall.
-In order to do as litle conversion as possible, pick one that best fits
+In order to do as little conversion as possible, pick one that best fits
 the format of data you have available.
 
 The following table summarizes the available functions;
diff --git a/Doc/c-api/capsule.rst b/Doc/c-api/capsule.rst
index 5eb313c..908e926 100644
--- a/Doc/c-api/capsule.rst
+++ b/Doc/c-api/capsule.rst
@@ -34,7 +34,8 @@
 
 .. c:function:: int PyCapsule_CheckExact(PyObject *p)
 
-   Return true if its argument is a :c:type:`PyCapsule`.
+   Return true if its argument is a :c:type:`PyCapsule`.  This function always
+   succeeds.
 
 
 .. c:function:: PyObject* PyCapsule_New(void *pointer, const char *name, PyCapsule_Destructor destructor)
diff --git a/Doc/c-api/cell.rst b/Doc/c-api/cell.rst
index 8408f7e..ac4ef5a 100644
--- a/Doc/c-api/cell.rst
+++ b/Doc/c-api/cell.rst
@@ -27,7 +27,8 @@
 
 .. c:function:: int PyCell_Check(ob)
 
-   Return true if *ob* is a cell object; *ob* must not be ``NULL``.
+   Return true if *ob* is a cell object; *ob* must not be ``NULL``.  This
+   function always succeeds.
 
 
 .. c:function:: PyObject* PyCell_New(PyObject *ob)
diff --git a/Doc/c-api/code.rst b/Doc/c-api/code.rst
index 6f8c41c..6e18a42 100644
--- a/Doc/c-api/code.rst
+++ b/Doc/c-api/code.rst
@@ -27,7 +27,7 @@
 
 .. c:function:: int PyCode_Check(PyObject *co)
 
-   Return true if *co* is a :class:`code` object.
+   Return true if *co* is a :class:`code` object.  This function always succeeds.
 
 .. c:function:: int PyCode_GetNumFree(PyCodeObject *co)
 
@@ -51,3 +51,11 @@
    Return a new empty code object with the specified filename,
    function name, and first line number.  It is illegal to
    :func:`exec` or :func:`eval` the resulting code object.
+
+.. c:function:: int PyCode_Addr2Line(PyCodeObject *co, int byte_offset)
+
+    Return the line number of the instruction that occurs on or before ``byte_offset`` and ends after it.
+    If you just need the line number of a frame, use :c:func:`PyFrame_GetLineNumber` instead.
+
+    For efficiently iterating over the line numbers in a code object, use `the API described in PEP 626
+    <https://www.python.org/dev/peps/pep-0626/#out-of-process-debuggers-and-profilers>`_.
diff --git a/Doc/c-api/codec.rst b/Doc/c-api/codec.rst
index 172dcb3..235c77c 100644
--- a/Doc/c-api/codec.rst
+++ b/Doc/c-api/codec.rst
@@ -10,6 +10,14 @@
    As side effect, this tries to load the :mod:`encodings` package, if not yet
    done, to make sure that it is always first in the list of search functions.
 
+.. c:function:: int PyCodec_Unregister(PyObject *search_function)
+
+   Unregister a codec search function and clear the registry's cache.
+   If the search function is not registered, do nothing.
+   Return 0 on success. Raise an exception and return -1 on error.
+
+   .. versionadded:: 3.10
+
 .. c:function:: int PyCodec_KnownEncoding(const char *encoding)
 
    Return ``1`` or ``0`` depending on whether there is a registered codec for
diff --git a/Doc/c-api/complex.rst b/Doc/c-api/complex.rst
index 06dbb25..c258946 100644
--- a/Doc/c-api/complex.rst
+++ b/Doc/c-api/complex.rst
@@ -46,9 +46,9 @@
    :c:type:`Py_complex` representation.
 
 
-.. c:function:: Py_complex _Py_c_neg(Py_complex complex)
+.. c:function:: Py_complex _Py_c_neg(Py_complex num)
 
-   Return the negation of the complex number *complex*, using the C
+   Return the negation of the complex number *num*, using the C
    :c:type:`Py_complex` representation.
 
 
@@ -94,13 +94,13 @@
 .. c:function:: int PyComplex_Check(PyObject *p)
 
    Return true if its argument is a :c:type:`PyComplexObject` or a subtype of
-   :c:type:`PyComplexObject`.
+   :c:type:`PyComplexObject`.  This function always succeeds.
 
 
 .. c:function:: int PyComplex_CheckExact(PyObject *p)
 
    Return true if its argument is a :c:type:`PyComplexObject`, but not a subtype of
-   :c:type:`PyComplexObject`.
+   :c:type:`PyComplexObject`.  This function always succeeds.
 
 
 .. c:function:: PyObject* PyComplex_FromCComplex(Py_complex v)
diff --git a/Doc/c-api/concrete.rst b/Doc/c-api/concrete.rst
index c1d9fa1..84224dc 100644
--- a/Doc/c-api/concrete.rst
+++ b/Doc/c-api/concrete.rst
@@ -115,3 +115,4 @@
    coro.rst
    contextvars.rst
    datetime.rst
+   typehints.rst
diff --git a/Doc/c-api/contextvars.rst b/Doc/c-api/contextvars.rst
index 9c08881..d970f54 100644
--- a/Doc/c-api/contextvars.rst
+++ b/Doc/c-api/contextvars.rst
@@ -107,9 +107,9 @@
 .. c:function:: PyObject *PyContextVar_New(const char *name, PyObject *def)
 
    Create a new ``ContextVar`` object.  The *name* parameter is used
-   for introspection and debug purposes.  The *def* parameter may optionally
-   specify the default value for the context variable.  If an error has
-   occurred, this function returns ``NULL``.
+   for introspection and debug purposes.  The *def* parameter specifies
+   a default value for the context variable, or ``NULL`` for no default.
+   If an error has occurred, this function returns ``NULL``.
 
 .. c:function:: int PyContextVar_Get(PyObject *var, PyObject *default_value, PyObject **value)
 
@@ -124,13 +124,12 @@
    - the default value of *var*, if not ``NULL``;
    - ``NULL``
 
-   If the value was found, the function will create a new reference to it.
+   Except for ``NULL``, the function returns a new reference.
 
 .. c:function:: PyObject *PyContextVar_Set(PyObject *var, PyObject *value)
 
-   Set the value of *var* to *value* in the current context.  Returns a
-   pointer to a :c:type:`PyObject` object, or ``NULL`` if an error
-   has occurred.
+   Set the value of *var* to *value* in the current context.  Returns
+   a new token object for this change, or ``NULL`` if an error has occurred.
 
 .. c:function:: int PyContextVar_Reset(PyObject *var, PyObject *token)
 
diff --git a/Doc/c-api/conversion.rst b/Doc/c-api/conversion.rst
index b310fcb..7b4cc1c 100644
--- a/Doc/c-api/conversion.rst
+++ b/Doc/c-api/conversion.rst
@@ -11,45 +11,41 @@
 .. c:function:: int PyOS_snprintf(char *str, size_t size,  const char *format, ...)
 
    Output not more than *size* bytes to *str* according to the format string
-   *format* and the extra arguments. See the Unix man page :manpage:`snprintf(2)`.
+   *format* and the extra arguments. See the Unix man page :manpage:`snprintf(3)`.
 
 
 .. c:function:: int PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va)
 
    Output not more than *size* bytes to *str* according to the format string
    *format* and the variable argument list *va*. Unix man page
-   :manpage:`vsnprintf(2)`.
+   :manpage:`vsnprintf(3)`.
 
 :c:func:`PyOS_snprintf` and :c:func:`PyOS_vsnprintf` wrap the Standard C library
 functions :c:func:`snprintf` and :c:func:`vsnprintf`. Their purpose is to
 guarantee consistent behavior in corner cases, which the Standard C functions do
 not.
 
-The wrappers ensure that *str*[*size*-1] is always ``'\0'`` upon return. They
+The wrappers ensure that ``str[size-1]`` is always ``'\0'`` upon return. They
 never write more than *size* bytes (including the trailing ``'\0'``) into str.
-Both functions require that ``str != NULL``, ``size > 0`` and ``format !=
-NULL``.
-
-If the platform doesn't have :c:func:`vsnprintf` and the buffer size needed to
-avoid truncation exceeds *size* by more than 512 bytes, Python aborts with a
-:c:func:`Py_FatalError`.
+Both functions require that ``str != NULL``, ``size > 0``, ``format != NULL``
+and ``size < INT_MAX``.
 
 The return value (*rv*) for these functions should be interpreted as follows:
 
 * When ``0 <= rv < size``, the output conversion was successful and *rv*
   characters were written to *str* (excluding the trailing ``'\0'`` byte at
-  *str*[*rv*]).
+  ``str[rv]``).
 
 * When ``rv >= size``, the output conversion was truncated and a buffer with
-  ``rv + 1`` bytes would have been needed to succeed. *str*[*size*-1] is ``'\0'``
+  ``rv + 1`` bytes would have been needed to succeed. ``str[size-1]`` is ``'\0'``
   in this case.
 
-* When ``rv < 0``, "something bad happened." *str*[*size*-1] is ``'\0'`` in
+* When ``rv < 0``, "something bad happened." ``str[size-1]`` is ``'\0'`` in
   this case too, but the rest of *str* is undefined. The exact cause of the error
   depends on the underlying platform.
 
-The following functions provide locale-independent string to number conversions.
 
+The following functions provide locale-independent string to number conversions.
 
 .. c:function:: double PyOS_string_to_double(const char *s, char **endptr, PyObject *overflow_exception)
 
diff --git a/Doc/c-api/coro.rst b/Doc/c-api/coro.rst
index 2260944..caa855a 100644
--- a/Doc/c-api/coro.rst
+++ b/Doc/c-api/coro.rst
@@ -24,6 +24,7 @@
 .. c:function:: int PyCoro_CheckExact(PyObject *ob)
 
    Return true if *ob*'s type is :c:type:`PyCoro_Type`; *ob* must not be ``NULL``.
+   This function always succeeds.
 
 
 .. c:function:: PyObject* PyCoro_New(PyFrameObject *frame, PyObject *name, PyObject *qualname)
diff --git a/Doc/c-api/datetime.rst b/Doc/c-api/datetime.rst
index bd4f1ff..4c4e4bc 100644
--- a/Doc/c-api/datetime.rst
+++ b/Doc/c-api/datetime.rst
@@ -28,61 +28,66 @@
 .. c:function:: int PyDate_Check(PyObject *ob)
 
    Return true if *ob* is of type :c:data:`PyDateTime_DateType` or a subtype of
-   :c:data:`PyDateTime_DateType`.  *ob* must not be ``NULL``.
+   :c:data:`PyDateTime_DateType`.  *ob* must not be ``NULL``.  This function always
+   succeeds.
 
 
 .. c:function:: int PyDate_CheckExact(PyObject *ob)
 
    Return true if *ob* is of type :c:data:`PyDateTime_DateType`. *ob* must not be
-   ``NULL``.
+   ``NULL``.  This function always succeeds.
 
 
 .. c:function:: int PyDateTime_Check(PyObject *ob)
 
    Return true if *ob* is of type :c:data:`PyDateTime_DateTimeType` or a subtype of
-   :c:data:`PyDateTime_DateTimeType`.  *ob* must not be ``NULL``.
+   :c:data:`PyDateTime_DateTimeType`.  *ob* must not be ``NULL``.  This function always
+   succeeds.
 
 
 .. c:function:: int PyDateTime_CheckExact(PyObject *ob)
 
    Return true if *ob* is of type :c:data:`PyDateTime_DateTimeType`. *ob* must not
-   be ``NULL``.
+   be ``NULL``.  This function always succeeds.
 
 
 .. c:function:: int PyTime_Check(PyObject *ob)
 
    Return true if *ob* is of type :c:data:`PyDateTime_TimeType` or a subtype of
-   :c:data:`PyDateTime_TimeType`.  *ob* must not be ``NULL``.
+   :c:data:`PyDateTime_TimeType`.  *ob* must not be ``NULL``.  This function always
+   succeeds.
 
 
 .. c:function:: int PyTime_CheckExact(PyObject *ob)
 
    Return true if *ob* is of type :c:data:`PyDateTime_TimeType`. *ob* must not be
-   ``NULL``.
+   ``NULL``.  This function always succeeds.
 
 
 .. c:function:: int PyDelta_Check(PyObject *ob)
 
    Return true if *ob* is of type :c:data:`PyDateTime_DeltaType` or a subtype of
-   :c:data:`PyDateTime_DeltaType`.  *ob* must not be ``NULL``.
+   :c:data:`PyDateTime_DeltaType`.  *ob* must not be ``NULL``.  This function always
+   succeeds.
 
 
 .. c:function:: int PyDelta_CheckExact(PyObject *ob)
 
    Return true if *ob* is of type :c:data:`PyDateTime_DeltaType`. *ob* must not be
-   ``NULL``.
+   ``NULL``.  This function always succeeds.
 
 
 .. c:function:: int PyTZInfo_Check(PyObject *ob)
 
    Return true if *ob* is of type :c:data:`PyDateTime_TZInfoType` or a subtype of
-   :c:data:`PyDateTime_TZInfoType`.  *ob* must not be ``NULL``.
+   :c:data:`PyDateTime_TZInfoType`.  *ob* must not be ``NULL``.  This function always
+   succeeds.
 
 
 .. c:function:: int PyTZInfo_CheckExact(PyObject *ob)
 
    Return true if *ob* is of type :c:data:`PyDateTime_TZInfoType`. *ob* must not be
-   ``NULL``.
+   ``NULL``.  This function always succeeds.
 
 
 Macros to create objects:
@@ -185,6 +190,11 @@
 
    Return the microsecond, as an int from 0 through 999999.
 
+.. c:function:: PyObject* PyDateTime_DATE_GET_TZINFO(PyDateTime_DateTime *o)
+
+   Return the tzinfo (which may be ``None``).
+
+   .. versionadded:: 3.10
 
 Macros to extract fields from time objects.  The argument must be an instance of
 :c:data:`PyDateTime_Time`, including subclasses. The argument must not be ``NULL``,
@@ -209,6 +219,12 @@
 
    Return the microsecond, as an int from 0 through 999999.
 
+.. c:function:: PyObject* PyDateTime_TIME_GET_TZINFO(PyDateTime_Time *o)
+
+   Return the tzinfo (which may be ``None``).
+
+   .. versionadded:: 3.10
+
 
 Macros to extract fields from time delta objects.  The argument must be an
 instance of :c:data:`PyDateTime_Delta`, including subclasses. The argument must
diff --git a/Doc/c-api/descriptor.rst b/Doc/c-api/descriptor.rst
index 1005140..b32c113 100644
--- a/Doc/c-api/descriptor.rst
+++ b/Doc/c-api/descriptor.rst
@@ -32,8 +32,8 @@
 
 .. c:function:: int PyDescr_IsData(PyObject *descr)
 
-   Return true if the descriptor objects *descr* describes a data attribute, or
-   false if it describes a method.  *descr* must be a descriptor object; there is
+   Return non-zero if the descriptor objects *descr* describes a data attribute, or
+   ``0`` if it describes a method.  *descr* must be a descriptor object; there is
    no error checking.
 
 
diff --git a/Doc/c-api/dict.rst b/Doc/c-api/dict.rst
index 8c626c7..d257c9b 100644
--- a/Doc/c-api/dict.rst
+++ b/Doc/c-api/dict.rst
@@ -22,13 +22,13 @@
 .. c:function:: int PyDict_Check(PyObject *p)
 
    Return true if *p* is a dict object or an instance of a subtype of the dict
-   type.
+   type.  This function always succeeds.
 
 
 .. c:function:: int PyDict_CheckExact(PyObject *p)
 
    Return true if *p* is a dict object, but not an instance of a subtype of
-   the dict type.
+   the dict type.  This function always succeeds.
 
 
 .. c:function:: PyObject* PyDict_New()
@@ -102,6 +102,10 @@
    :meth:`__eq__` methods will get suppressed.
    To get error reporting use :c:func:`PyDict_GetItemWithError()` instead.
 
+   .. versionchanged:: 3.10
+      Calling this API without :term:`GIL` held had been allowed for historical
+      reason. It is no longer allowed.
+
 
 .. c:function:: PyObject* PyDict_GetItemWithError(PyObject *p, PyObject *key)
 
diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst
index 247b6d6..bcd9621 100644
--- a/Doc/c-api/exceptions.rst
+++ b/Doc/c-api/exceptions.rst
@@ -100,7 +100,7 @@
    This is the most common way to set the error indicator.  The first argument
    specifies the exception type; it is normally one of the standard exceptions,
    e.g. :c:data:`PyExc_RuntimeError`.  You need not increment its reference count.
-   The second argument is an error message; it is decoded from ``'utf-8``'.
+   The second argument is an error message; it is decoded from ``'utf-8'``.
 
 
 .. c:function:: void PyErr_SetObject(PyObject *type, PyObject *value)
@@ -182,8 +182,8 @@
 .. c:function:: PyObject* PyErr_SetFromErrnoWithFilename(PyObject *type, const char *filename)
 
    Similar to :c:func:`PyErr_SetFromErrnoWithFilenameObject`, but the filename
-   is given as a C string.  *filename* is decoded from the filesystem encoding
-   (:func:`os.fsdecode`).
+   is given as a C string.  *filename* is decoded from the :term:`filesystem
+   encoding and error handler`.
 
 
 .. c:function:: PyObject* PyErr_SetFromWindowsErr(int ierr)
@@ -253,6 +253,14 @@
    .. versionadded:: 3.3
 
 
+.. c:function:: PyObject* PyErr_SetImportErrorSubclass(PyObject *exception, PyObject *msg, PyObject *name, PyObject *path)
+
+   Much like :c:func:`PyErr_SetImportError` but this function allows for
+   specifying a subclass of :exc:`ImportError` to raise.
+
+   .. versionadded:: 3.6
+
+
 .. c:function:: void PyErr_SyntaxLocationObject(PyObject *filename, int lineno, int col_offset)
 
    Set file, line, and offset information for the current exception.  If the
@@ -266,7 +274,7 @@
 .. c:function:: void PyErr_SyntaxLocationEx(const char *filename, int lineno, int col_offset)
 
    Like :c:func:`PyErr_SyntaxLocationObject`, but *filename* is a byte string
-   decoded from the filesystem encoding (:func:`os.fsdecode`).
+   decoded from the :term:`filesystem encoding and error handler`.
 
    .. versionadded:: 3.2
 
@@ -320,13 +328,6 @@
    :mod:`warnings` module and the :option:`-W` option in the command line
    documentation.  There is no C API for warning control.
 
-.. c:function:: PyObject* PyErr_SetImportErrorSubclass(PyObject *exception, PyObject *msg, PyObject *name, PyObject *path)
-
-   Much like :c:func:`PyErr_SetImportError` but this function allows for
-   specifying a subclass of :exc:`ImportError` to raise.
-
-   .. versionadded:: 3.6
-
 
 .. c:function:: int PyErr_WarnExplicitObject(PyObject *category, PyObject *message, PyObject *filename, int lineno, PyObject *module, PyObject *registry)
 
@@ -343,7 +344,7 @@
 
    Similar to :c:func:`PyErr_WarnExplicitObject` except that *message* and
    *module* are UTF-8 encoded strings, and *filename* is decoded from the
-   filesystem encoding (:func:`os.fsdecode`).
+   :term:`filesystem encoding and error handler`.
 
 
 .. c:function:: int PyErr_WarnFormat(PyObject *category, Py_ssize_t stack_level, const char *format, ...)
@@ -505,29 +506,73 @@
       single: SIGINT
       single: KeyboardInterrupt (built-in exception)
 
-   This function interacts with Python's signal handling.  It checks whether a
-   signal has been sent to the processes and if so, invokes the corresponding
-   signal handler.  If the :mod:`signal` module is supported, this can invoke a
-   signal handler written in Python.  In all cases, the default effect for
-   :const:`SIGINT` is to raise the  :exc:`KeyboardInterrupt` exception.  If an
-   exception is raised the error indicator is set and the function returns ``-1``;
-   otherwise the function returns ``0``.  The error indicator may or may not be
-   cleared if it was previously set.
+   This function interacts with Python's signal handling.
+
+   If the function is called from the main thread and under the main Python
+   interpreter, it checks whether a signal has been sent to the processes
+   and if so, invokes the corresponding signal handler.  If the :mod:`signal`
+   module is supported, this can invoke a signal handler written in Python.
+
+   The function attempts to handle all pending signals, and then returns ``0``.
+   However, if a Python signal handler raises an exception, the error
+   indicator is set and the function returns ``-1`` immediately (such that
+   other pending signals may not have been handled yet: they will be on the
+   next :c:func:`PyErr_CheckSignals()` invocation).
+
+   If the function is called from a non-main thread, or under a non-main
+   Python interpreter, it does nothing and returns ``0``.
+
+   This function can be called by long-running C code that wants to
+   be interruptible by user requests (such as by pressing Ctrl-C).
+
+   .. note::
+      The default Python signal handler for :const:`SIGINT` raises the
+      :exc:`KeyboardInterrupt` exception.
 
 
 .. c:function:: void PyErr_SetInterrupt()
 
    .. index::
+      module: signal
       single: SIGINT
       single: KeyboardInterrupt (built-in exception)
 
-   Simulate the effect of a :const:`SIGINT` signal arriving. The next time
-   :c:func:`PyErr_CheckSignals` is called,  the Python signal handler for
-   :const:`SIGINT` will be called.
+   Simulate the effect of a :const:`SIGINT` signal arriving.
+   This is equivalent to ``PyErr_SetInterruptEx(SIGINT)``.
 
-   If :const:`SIGINT` isn't handled by Python (it was set to
-   :data:`signal.SIG_DFL` or :data:`signal.SIG_IGN`), this function does
-   nothing.
+   .. note::
+      This function is async-signal-safe.  It can be called without
+      the :term:`GIL` and from a C signal handler.
+
+
+.. c:function:: int PyErr_SetInterruptEx(int signum)
+
+   .. index::
+      module: signal
+      single: KeyboardInterrupt (built-in exception)
+
+   Simulate the effect of a signal arriving. The next time
+   :c:func:`PyErr_CheckSignals` is called,  the Python signal handler for
+   the given signal number will be called.
+
+   This function can be called by C code that sets up its own signal handling
+   and wants Python signal handlers to be invoked as expected when an
+   interruption is requested (for example when the user presses Ctrl-C
+   to interrupt an operation).
+
+   If the given signal isn't handled by Python (it was set to
+   :data:`signal.SIG_DFL` or :data:`signal.SIG_IGN`), it will be ignored.
+
+   If *signum* is outside of the allowed range of signal numbers, ``-1``
+   is returned.  Otherwise, ``0`` is returned.  The error indicator is
+   never changed by this function.
+
+   .. note::
+      This function is async-signal-safe.  It can be called without
+      the :term:`GIL` and from a C signal handler.
+
+   .. versionadded:: 3.10
+
 
 .. c:function:: int PySignal_SetWakeupFd(int fd)
 
diff --git a/Doc/c-api/float.rst b/Doc/c-api/float.rst
index b29937d..c107243 100644
--- a/Doc/c-api/float.rst
+++ b/Doc/c-api/float.rst
@@ -22,13 +22,13 @@
 .. c:function:: int PyFloat_Check(PyObject *p)
 
    Return true if its argument is a :c:type:`PyFloatObject` or a subtype of
-   :c:type:`PyFloatObject`.
+   :c:type:`PyFloatObject`.  This function always succeeds.
 
 
 .. c:function:: int PyFloat_CheckExact(PyObject *p)
 
    Return true if its argument is a :c:type:`PyFloatObject`, but not a subtype of
-   :c:type:`PyFloatObject`.
+   :c:type:`PyFloatObject`.  This function always succeeds.
 
 
 .. c:function:: PyObject* PyFloat_FromString(PyObject *str)
diff --git a/Doc/c-api/function.rst b/Doc/c-api/function.rst
index bb416f4..ad00842 100644
--- a/Doc/c-api/function.rst
+++ b/Doc/c-api/function.rst
@@ -26,7 +26,7 @@
 .. c:function:: int PyFunction_Check(PyObject *o)
 
    Return true if *o* is a function object (has type :c:data:`PyFunction_Type`).
-   The parameter must not be ``NULL``.
+   The parameter must not be ``NULL``.  This function always succeeds.
 
 
 .. c:function:: PyObject* PyFunction_New(PyObject *code, PyObject *globals)
@@ -61,9 +61,11 @@
 
 .. c:function:: PyObject* PyFunction_GetModule(PyObject *op)
 
-   Return the *__module__* attribute of the function object *op*. This is normally
-   a string containing the module name, but can be set to any other object by
-   Python code.
+   Return a :term:`borrowed reference` to the *__module__* attribute of the
+   function object *op*. It can be *NULL*.
+
+   This is normally a string containing the module name, but can be set to any
+   other object by Python code.
 
 
 .. c:function:: PyObject* PyFunction_GetDefaults(PyObject *op)
diff --git a/Doc/c-api/gcsupport.rst b/Doc/c-api/gcsupport.rst
index eee114c..8c90d1e 100644
--- a/Doc/c-api/gcsupport.rst
+++ b/Doc/c-api/gcsupport.rst
@@ -33,6 +33,26 @@
 #. Once all the fields which may contain references to other containers are
    initialized, it must call :c:func:`PyObject_GC_Track`.
 
+Similarly, the deallocator for the object must conform to a similar pair of
+rules:
+
+#. Before fields which refer to other containers are invalidated,
+   :c:func:`PyObject_GC_UnTrack` must be called.
+
+#. The object's memory must be deallocated using :c:func:`PyObject_GC_Del`.
+
+   .. warning::
+      If a type adds the Py_TPFLAGS_HAVE_GC, then it *must* implement at least
+      a :c:member:`~PyTypeObject.tp_traverse` handler or explicitly use one
+      from its subclass or subclasses.
+
+      When calling :c:func:`PyType_Ready` or some of the APIs that indirectly
+      call it like :c:func:`PyType_FromSpecWithBases` or
+      :c:func:`PyType_FromSpec` the interpreter will automatically populate the
+      :c:member:`~PyTypeObject.tp_flags`, :c:member:`~PyTypeObject.tp_traverse`
+      and :c:member:`~PyTypeObject.tp_clear` fields if the type inherits from a
+      class that implements the garbage collector protocol and the child class
+      does *not* include the :const:`Py_TPFLAGS_HAVE_GC` flag.
 
 .. c:function:: TYPE* PyObject_GC_New(TYPE, PyTypeObject *type)
 
@@ -88,14 +108,6 @@
 
    .. versionadded:: 3.9
 
-Similarly, the deallocator for the object must conform to a similar pair of
-rules:
-
-#. Before fields which refer to other containers are invalidated,
-   :c:func:`PyObject_GC_UnTrack` must be called.
-
-#. The object's memory must be deallocated using :c:func:`PyObject_GC_Del`.
-
 
 .. c:function:: void PyObject_GC_Del(void *op)
 
@@ -173,3 +185,46 @@
    this method (don't just call :c:func:`Py_DECREF` on a reference).  The
    collector will call this method if it detects that this object is involved
    in a reference cycle.
+
+
+Controlling the Garbage Collector State
+---------------------------------------
+
+The C-API provides the following functions for controlling
+garbage collection runs.
+
+.. c:function:: Py_ssize_t PyGC_Collect(void)
+
+   Perform a full garbage collection, if the garbage collector is enabled.
+   (Note that :func:`gc.collect` runs it unconditionally.)
+
+   Returns the number of collected + unreachable objects which cannot
+   be collected.
+   If the garbage collector is disabled or already collecting,
+   returns ``0`` immediately.
+   Errors during garbage collection are passed to :data:`sys.unraisablehook`.
+   This function does not raise exceptions.
+
+
+.. c:function:: int PyGC_Enable(void)
+
+   Enable the garbage collector: similar to :func:`gc.enable`.
+   Returns the previous state, 0 for disabled and 1 for enabled.
+
+   .. versionadded:: 3.10
+
+
+.. c:function:: int PyGC_Disable(void)
+
+   Disable the garbage collector: similar to :func:`gc.disable`.
+   Returns the previous state, 0 for disabled and 1 for enabled.
+
+   .. versionadded:: 3.10
+
+
+.. c:function:: int PyGC_IsEnabled(void)
+
+   Query the state of the garbage collector: similar to :func:`gc.isenabled`.
+   Returns the current state, 0 for disabled and 1 for enabled.
+
+   .. versionadded:: 3.10
diff --git a/Doc/c-api/gen.rst b/Doc/c-api/gen.rst
index 7441092..0eb5922 100644
--- a/Doc/c-api/gen.rst
+++ b/Doc/c-api/gen.rst
@@ -22,12 +22,14 @@
 
 .. c:function:: int PyGen_Check(PyObject *ob)
 
-   Return true if *ob* is a generator object; *ob* must not be ``NULL``.
+   Return true if *ob* is a generator object; *ob* must not be ``NULL``.  This
+   function always succeeds.
 
 
 .. c:function:: int PyGen_CheckExact(PyObject *ob)
 
-   Return true if *ob*'s type is :c:type:`PyGen_Type`; *ob* must not be ``NULL``.
+   Return true if *ob*'s type is :c:type:`PyGen_Type`; *ob* must not be
+   ``NULL``.  This function always succeeds.
 
 
 .. c:function:: PyObject* PyGen_New(PyFrameObject *frame)
diff --git a/Doc/c-api/import.rst b/Doc/c-api/import.rst
index c6fc330..d2ae6b6 100644
--- a/Doc/c-api/import.rst
+++ b/Doc/c-api/import.rst
@@ -299,4 +299,8 @@
    field; failure to provide the sentinel value can result in a memory fault.
    Returns ``0`` on success or ``-1`` if insufficient memory could be allocated to
    extend the internal table.  In the event of failure, no modules are added to the
-   internal table.  This should be called before :c:func:`Py_Initialize`.
+   internal table.  This must be called before :c:func:`Py_Initialize`.
+
+   If Python is initialized multiple times, :c:func:`PyImport_AppendInittab` or
+   :c:func:`PyImport_ExtendInittab` must be called before each Python
+   initialization.
diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst
index 7f06648..9ac3039 100644
--- a/Doc/c-api/init.rst
+++ b/Doc/c-api/init.rst
@@ -151,8 +151,9 @@
 
 .. c:var:: int Py_LegacyWindowsFSEncodingFlag
 
-   If the flag is non-zero, use the ``mbcs`` encoding instead of the UTF-8
-   encoding for the filesystem encoding.
+   If the flag is non-zero, use the ``mbcs`` encoding with ``replace`` error
+   handler, instead of the UTF-8 encoding with ``surrogatepass`` error handler,
+   for the :term:`filesystem encoding and error handler`.
 
    Set to ``1`` if the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` environment
    variable is set to a non-empty string.
@@ -375,6 +376,12 @@
    The returned string points into static storage; the caller should not modify its
    value.
 
+   This function should not be called before :c:func:`Py_Initialize`, otherwise
+   it returns ``NULL``.
+
+   .. versionchanged:: 3.10
+      It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
+
 
 .. c:function:: wchar_t* Py_GetPrefix()
 
@@ -388,6 +395,12 @@
    script at build time.  The value is available to Python code as ``sys.prefix``.
    It is only useful on Unix.  See also the next function.
 
+   This function should not be called before :c:func:`Py_Initialize`, otherwise
+   it returns ``NULL``.
+
+   .. versionchanged:: 3.10
+      It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
+
 
 .. c:function:: wchar_t* Py_GetExecPrefix()
 
@@ -423,6 +436,12 @@
    while having :file:`/usr/local/plat` be a different filesystem for each
    platform.
 
+   This function should not be called before :c:func:`Py_Initialize`, otherwise
+   it returns ``NULL``.
+
+   .. versionchanged:: 3.10
+      It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
+
 
 .. c:function:: wchar_t* Py_GetProgramFullPath()
 
@@ -436,6 +455,12 @@
    static storage; the caller should not modify its value.  The value is available
    to Python code as ``sys.executable``.
 
+   This function should not be called before :c:func:`Py_Initialize`, otherwise
+   it returns ``NULL``.
+
+   .. versionchanged:: 3.10
+      It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
+
 
 .. c:function:: wchar_t* Py_GetPath()
 
@@ -448,14 +473,20 @@
    (set by :c:func:`Py_SetProgramName` above) and some environment variables.
    The returned string consists of a series of directory names separated by a
    platform dependent delimiter character.  The delimiter character is ``':'``
-   on Unix and Mac OS X, ``';'`` on Windows.  The returned string points into
+   on Unix and macOS, ``';'`` on Windows.  The returned string points into
    static storage; the caller should not modify its value.  The list
    :data:`sys.path` is initialized with this value on interpreter startup; it
    can be (and usually is) modified later to change the search path for loading
    modules.
 
+   This function should not be called before :c:func:`Py_Initialize`, otherwise
+   it returns ``NULL``.
+
    .. XXX should give the exact rules
 
+   .. versionchanged:: 3.10
+      It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
+
 
 .. c:function::  void Py_SetPath(const wchar_t *)
 
@@ -469,7 +500,7 @@
    default search path but uses the one provided instead.  This is useful if
    Python is embedded by an application that has full knowledge of the location
    of all modules.  The path components should be separated by the platform
-   dependent delimiter character, which is ``':'`` on Unix and Mac OS X, ``';'``
+   dependent delimiter character, which is ``':'`` on Unix and macOS, ``';'``
    on Windows.
 
    This also causes :data:`sys.executable` to be set to the program
@@ -510,7 +541,7 @@
    Return the platform identifier for the current platform.  On Unix, this is
    formed from the "official" name of the operating system, converted to lower
    case, followed by the major revision number; e.g., for Solaris 2.x, which is
-   also known as SunOS 5.x, the value is ``'sunos5'``.  On Mac OS X, it is
+   also known as SunOS 5.x, the value is ``'sunos5'``.  On macOS, it is
    ``'darwin'``.  On Windows, it is ``'win'``.  The returned string points into
    static storage; the caller should not modify its value.  The value is available
    to Python code as ``sys.platform``.
@@ -637,6 +668,12 @@
    :c:func:`Py_SetPythonHome`, or the value of the :envvar:`PYTHONHOME`
    environment variable if it is set.
 
+   This function should not be called before :c:func:`Py_Initialize`, otherwise
+   it returns ``NULL``.
+
+   .. versionchanged:: 3.10
+      It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
+
 
 .. _threads:
 
@@ -1076,7 +1113,7 @@
 
    Get the current frame of the Python thread state *tstate*.
 
-   Return a strong reference. Return ``NULL`` if no frame is currently
+   Return a :term:`strong reference`. Return ``NULL`` if no frame is currently
    executing.
 
    See also :c:func:`PyEval_GetFrame`.
@@ -1155,7 +1192,7 @@
 
    .. versionadded:: 3.9
 
-.. c:function:: void _PyInterpreterState_SetEvalFrameFunc(PyInterpreterState *interp, _PyFrameEvalFunction eval_frame);
+.. c:function:: void _PyInterpreterState_SetEvalFrameFunc(PyInterpreterState *interp, _PyFrameEvalFunction eval_frame)
 
    Set the frame evaluation function.
 
diff --git a/Doc/c-api/init_config.rst b/Doc/c-api/init_config.rst
index f2b82a0..b8b4151 100644
--- a/Doc/c-api/init_config.rst
+++ b/Doc/c-api/init_config.rst
@@ -8,46 +8,24 @@
 
 .. versionadded:: 3.8
 
-Structures:
+Python can be initialized with :c:func:`Py_InitializeFromConfig` and the
+:c:type:`PyConfig` structure. It can be preinitialized with
+:c:func:`Py_PreInitialize` and the :c:type:`PyPreConfig` structure.
 
-* :c:type:`PyConfig`
-* :c:type:`PyPreConfig`
-* :c:type:`PyStatus`
-* :c:type:`PyWideStringList`
+There are two kinds of configuration:
 
-Functions:
+* The :ref:`Python Configuration <init-python-config>` can be used to build a
+  customized Python which behaves as the regular Python. For example,
+  environments variables and command line arguments are used to configure
+  Python.
 
-* :c:func:`PyConfig_Clear`
-* :c:func:`PyConfig_InitIsolatedConfig`
-* :c:func:`PyConfig_InitPythonConfig`
-* :c:func:`PyConfig_Read`
-* :c:func:`PyConfig_SetArgv`
-* :c:func:`PyConfig_SetBytesArgv`
-* :c:func:`PyConfig_SetBytesString`
-* :c:func:`PyConfig_SetString`
-* :c:func:`PyConfig_SetWideStringList`
-* :c:func:`PyPreConfig_InitIsolatedConfig`
-* :c:func:`PyPreConfig_InitPythonConfig`
-* :c:func:`PyStatus_Error`
-* :c:func:`PyStatus_Exception`
-* :c:func:`PyStatus_Exit`
-* :c:func:`PyStatus_IsError`
-* :c:func:`PyStatus_IsExit`
-* :c:func:`PyStatus_NoMemory`
-* :c:func:`PyStatus_Ok`
-* :c:func:`PyWideStringList_Append`
-* :c:func:`PyWideStringList_Insert`
-* :c:func:`Py_ExitStatusException`
-* :c:func:`Py_InitializeFromConfig`
-* :c:func:`Py_PreInitialize`
-* :c:func:`Py_PreInitializeFromArgs`
-* :c:func:`Py_PreInitializeFromBytesArgs`
-* :c:func:`Py_RunMain`
-* :c:func:`Py_GetArgcArgv`
+* The :ref:`Isolated Configuration <init-isolated-conf>` can be used to embed
+  Python into an application. It isolates Python from the system. For example,
+  environments variables are ignored, the LC_CTYPE locale is left unchanged and
+  no signal handler is registered.
 
-The preconfiguration (``PyPreConfig`` type) is stored in
-``_PyRuntime.preconfig`` and the configuration (``PyConfig`` type) is stored in
-``PyInterpreterState.config``.
+The :c:func:`Py_RunMain` function can be used to write a customized Python
+program.
 
 See also :ref:`Initialization, Finalization, and Threads <initialization>`.
 
@@ -55,8 +33,47 @@
    :pep:`587` "Python Initialization Configuration".
 
 
+Example
+=======
+
+Example of customized Python always running in isolated mode::
+
+    int main(int argc, char **argv)
+    {
+        PyStatus status;
+
+        PyConfig config;
+        PyConfig_InitPythonConfig(&config);
+        config.isolated = 1;
+
+        /* Decode command line arguments.
+           Implicitly preinitialize Python (in isolated mode). */
+        status = PyConfig_SetBytesArgv(&config, argc, argv);
+        if (PyStatus_Exception(status)) {
+            goto exception;
+        }
+
+        status = Py_InitializeFromConfig(&config);
+        if (PyStatus_Exception(status)) {
+            goto exception;
+        }
+        PyConfig_Clear(&config);
+
+        return Py_RunMain();
+
+    exception:
+        PyConfig_Clear(&config);
+        if (PyStatus_IsExit(status)) {
+            return status.exitcode;
+        }
+        /* Display the error message and exit the process with
+           non-zero exit code */
+        Py_ExitStatusException(status);
+    }
+
+
 PyWideStringList
-----------------
+================
 
 .. c:type:: PyWideStringList
 
@@ -95,7 +112,7 @@
       List items.
 
 PyStatus
---------
+========
 
 .. c:type:: PyStatus
 
@@ -128,6 +145,8 @@
 
       Initialization error with a message.
 
+      *err_msg* must not be ``NULL``.
+
    .. c:function:: PyStatus PyStatus_NoMemory(void)
 
       Memory allocation failure (out of memory).
@@ -185,15 +204,11 @@
 
 
 PyPreConfig
------------
+===========
 
 .. c:type:: PyPreConfig
 
-   Structure used to preinitialize Python:
-
-   * Set the Python memory allocator
-   * Configure the LC_CTYPE locale
-   * Set the UTF-8 mode
+   Structure used to preinitialize Python.
 
    Function to initialize a preconfiguration:
 
@@ -211,56 +226,89 @@
 
    .. c:member:: int allocator
 
-      Name of the memory allocator:
+      Name of the Python memory allocators:
 
       * ``PYMEM_ALLOCATOR_NOT_SET`` (``0``): don't change memory allocators
-        (use defaults)
-      * ``PYMEM_ALLOCATOR_DEFAULT`` (``1``): default memory allocators
-      * ``PYMEM_ALLOCATOR_DEBUG`` (``2``): default memory allocators with
-        debug hooks
-      * ``PYMEM_ALLOCATOR_MALLOC`` (``3``): force usage of ``malloc()``
+        (use defaults).
+      * ``PYMEM_ALLOCATOR_DEFAULT`` (``1``): :ref:`default memory allocators
+        <default-memory-allocators>`.
+      * ``PYMEM_ALLOCATOR_DEBUG`` (``2``): :ref:`default memory allocators
+        <default-memory-allocators>` with :ref:`debug hooks
+        <pymem-debug-hooks>`.
+      * ``PYMEM_ALLOCATOR_MALLOC`` (``3``): use ``malloc()`` of the C library.
       * ``PYMEM_ALLOCATOR_MALLOC_DEBUG`` (``4``): force usage of
-        ``malloc()`` with debug hooks
+        ``malloc()`` with :ref:`debug hooks <pymem-debug-hooks>`.
       * ``PYMEM_ALLOCATOR_PYMALLOC`` (``5``): :ref:`Python pymalloc memory
-        allocator <pymalloc>`
+        allocator <pymalloc>`.
       * ``PYMEM_ALLOCATOR_PYMALLOC_DEBUG`` (``6``): :ref:`Python pymalloc
-        memory allocator <pymalloc>` with debug hooks
+        memory allocator <pymalloc>` with :ref:`debug hooks
+        <pymem-debug-hooks>`.
 
-      ``PYMEM_ALLOCATOR_PYMALLOC`` and ``PYMEM_ALLOCATOR_PYMALLOC_DEBUG``
-      are not supported if Python is configured using ``--without-pymalloc``
+      ``PYMEM_ALLOCATOR_PYMALLOC`` and ``PYMEM_ALLOCATOR_PYMALLOC_DEBUG`` are
+      not supported if Python is :option:`configured using --without-pymalloc
+      <--without-pymalloc>`.
 
       See :ref:`Memory Management <memory>`.
 
+      Default: ``PYMEM_ALLOCATOR_NOT_SET``.
+
    .. c:member:: int configure_locale
 
-      Set the LC_CTYPE locale to the user preferred locale? If equals to 0, set
-      :c:member:`coerce_c_locale` and :c:member:`coerce_c_locale_warn` to 0.
+      Set the LC_CTYPE locale to the user preferred locale?
+
+      If equals to 0, set :c:member:`~PyPreConfig.coerce_c_locale` and
+      :c:member:`~PyPreConfig.coerce_c_locale_warn` members to 0.
+
+      See the :term:`locale encoding`.
+
+      Default: ``1`` in Python config, ``0`` in isolated config.
 
    .. c:member:: int coerce_c_locale
 
-      If equals to 2, coerce the C locale; if equals to 1, read the LC_CTYPE
-      locale to decide if it should be coerced.
+      If equals to 2, coerce the C locale.
+
+      If equals to 1, read the LC_CTYPE locale to decide if it should be
+      coerced.
+
+      See the :term:`locale encoding`.
+
+      Default: ``-1`` in Python config, ``0`` in isolated config.
 
    .. c:member:: int coerce_c_locale_warn
 
       If non-zero, emit a warning if the C locale is coerced.
 
+      Default: ``-1`` in Python config, ``0`` in isolated config.
+
    .. c:member:: int dev_mode
 
-      See :c:member:`PyConfig.dev_mode`.
+      If non-zero, enables the :ref:`Python Development Mode <devmode>`:
+      see :c:member:`PyConfig.dev_mode`.
+
+      Default: ``-1`` in Python mode, ``0`` in isolated mode.
 
    .. c:member:: int isolated
 
-      See :c:member:`PyConfig.isolated`.
+      Isolated mode: see :c:member:`PyConfig.isolated`.
 
-   .. c:member:: int legacy_windows_fs_encoding (Windows only)
+      Default: ``0`` in Python mode, ``1`` in isolated mode.
 
-      If non-zero, disable UTF-8 Mode, set the Python filesystem encoding to
-      ``mbcs``, set the filesystem error handler to ``replace``.
+   .. c:member:: int legacy_windows_fs_encoding
+
+      If non-zero:
+
+      * Set :c:member:`PyPreConfig.utf8_mode` to ``0``,
+      * Set :c:member:`PyConfig.filesystem_encoding` to ``"mbcs"``,
+      * Set :c:member:`PyConfig.filesystem_errors` to ``"replace"``.
+
+      Initialized the from :envvar:`PYTHONLEGACYWINDOWSFSENCODING` environment
+      variable value.
 
       Only available on Windows. ``#ifdef MS_WINDOWS`` macro can be used for
       Windows specific code.
 
+      Default: ``0``.
+
    .. c:member:: int parse_argv
 
       If non-zero, :c:func:`Py_PreInitializeFromArgs` and
@@ -268,16 +316,39 @@
       same way the regular Python parses command line arguments: see
       :ref:`Command Line Arguments <using-on-cmdline>`.
 
+      Default: ``1`` in Python config, ``0`` in isolated config.
+
    .. c:member:: int use_environment
 
-      See :c:member:`PyConfig.use_environment`.
+      Use :ref:`environment variables <using-on-envvars>`? See
+      :c:member:`PyConfig.use_environment`.
+
+      Default: ``1`` in Python config and ``0`` in isolated config.
 
    .. c:member:: int utf8_mode
 
-      If non-zero, enable the UTF-8 mode.
+      If non-zero, enable the :ref:`Python UTF-8 Mode <utf8-mode>`.
 
-Preinitialization with PyPreConfig
-----------------------------------
+      Set by the :option:`-X utf8 <-X>` command line option and the
+      :envvar:`PYTHONUTF8` environment variable.
+
+      Default: ``-1`` in Python config and ``0`` in isolated config.
+
+
+.. _c-preinit:
+
+Preinitialize Python with PyPreConfig
+=====================================
+
+The preinitialization of Python:
+
+* Set the Python memory allocators (:c:member:`PyPreConfig.allocator`)
+* Configure the LC_CTYPE locale (:term:`locale encoding`)
+* Set the :ref:`Python UTF-8 Mode <utf8-mode>`
+  (:c:member:`PyPreConfig.utf8_mode`)
+
+The current preconfiguration (``PyPreConfig`` type) is stored in
+``_PyRuntime.preconfig``.
 
 Functions to preinitialize Python:
 
@@ -285,15 +356,25 @@
 
    Preinitialize Python from *preconfig* preconfiguration.
 
+   *preconfig* must not be ``NULL``.
+
 .. c:function:: PyStatus Py_PreInitializeFromBytesArgs(const PyPreConfig *preconfig, int argc, char * const *argv)
 
-   Preinitialize Python from *preconfig* preconfiguration and command line
-   arguments (bytes strings).
+   Preinitialize Python from *preconfig* preconfiguration.
+
+   Parse *argv* command line arguments (bytes strings) if
+   :c:member:`~PyPreConfig.parse_argv` of *preconfig* is non-zero.
+
+   *preconfig* must not be ``NULL``.
 
 .. c:function:: PyStatus Py_PreInitializeFromArgs(const PyPreConfig *preconfig, int argc, wchar_t * const * argv)
 
-   Preinitialize Python from *preconfig* preconfiguration and command line
-   arguments (wide strings).
+   Preinitialize Python from *preconfig* preconfiguration.
+
+   Parse *argv* command line arguments (wide strings) if
+   :c:member:`~PyPreConfig.parse_argv` of *preconfig* is non-zero.
+
+   *preconfig* must not be ``NULL``.
 
 The caller is responsible to handle exceptions (error or exit) using
 :c:func:`PyStatus_Exception` and :c:func:`Py_ExitStatusException`.
@@ -303,7 +384,7 @@
 command line arguments, the command line arguments must also be passed to
 preinitialize Python, since they have an effect on the pre-configuration
 like encodings. For example, the :option:`-X utf8 <-X>` command line option
-enables the UTF-8 Mode.
+enables the :ref:`Python UTF-8 Mode <utf8-mode>`.
 
 ``PyMem_SetAllocator()`` can be called after :c:func:`Py_PreInitialize` and
 before :c:func:`Py_InitializeFromConfig` to install a custom memory allocator.
@@ -311,11 +392,12 @@
 :c:member:`PyPreConfig.allocator` is set to ``PYMEM_ALLOCATOR_NOT_SET``.
 
 Python memory allocation functions like :c:func:`PyMem_RawMalloc` must not be
-used before Python preinitialization, whereas calling directly ``malloc()`` and
-``free()`` is always safe. :c:func:`Py_DecodeLocale` must not be called before
-the preinitialization.
+used before the Python preinitialization, whereas calling directly ``malloc()``
+and ``free()`` is always safe. :c:func:`Py_DecodeLocale` must not be called
+before the Python preinitialization.
 
-Example using the preinitialization to enable the UTF-8 Mode::
+Example using the preinitialization to enable
+the :ref:`Python UTF-8 Mode <utf8-mode>`::
 
     PyStatus status;
     PyPreConfig preconfig;
@@ -328,7 +410,7 @@
         Py_ExitStatusException(status);
     }
 
-    /* at this point, Python will speak UTF-8 */
+    /* at this point, Python speaks UTF-8 */
 
     Py_Initialize();
     /* ... use Python API here ... */
@@ -336,53 +418,60 @@
 
 
 PyConfig
---------
+========
 
 .. c:type:: PyConfig
 
    Structure containing most parameters to configure Python.
 
+   When done, the :c:func:`PyConfig_Clear` function must be used to release the
+   configuration memory.
+
    Structure methods:
 
    .. c:function:: void PyConfig_InitPythonConfig(PyConfig *config)
 
-      Initialize configuration with :ref:`Python Configuration
+      Initialize configuration with the :ref:`Python Configuration
       <init-python-config>`.
 
    .. c:function:: void PyConfig_InitIsolatedConfig(PyConfig *config)
 
-      Initialize configuration with :ref:`Isolated Configuration
+      Initialize configuration with the :ref:`Isolated Configuration
       <init-isolated-conf>`.
 
    .. c:function:: PyStatus PyConfig_SetString(PyConfig *config, wchar_t * const *config_str, const wchar_t *str)
 
       Copy the wide character string *str* into ``*config_str``.
 
-      Preinitialize Python if needed.
+      :ref:`Preinitialize Python <c-preinit>` if needed.
 
    .. c:function:: PyStatus PyConfig_SetBytesString(PyConfig *config, wchar_t * const *config_str, const char *str)
 
-      Decode *str* using ``Py_DecodeLocale()`` and set the result into ``*config_str``.
+      Decode *str* using :c:func:`Py_DecodeLocale` and set the result into
+      ``*config_str``.
 
-      Preinitialize Python if needed.
+      :ref:`Preinitialize Python <c-preinit>` if needed.
 
    .. c:function:: PyStatus PyConfig_SetArgv(PyConfig *config, int argc, wchar_t * const *argv)
 
-      Set command line arguments from wide character strings.
+      Set command line arguments (:c:member:`~PyConfig.argv` member of
+      *config*) from the *argv* list of wide character strings.
 
-      Preinitialize Python if needed.
+      :ref:`Preinitialize Python <c-preinit>` if needed.
 
    .. c:function:: PyStatus PyConfig_SetBytesArgv(PyConfig *config, int argc, char * const *argv)
 
-      Set command line arguments: decode bytes using :c:func:`Py_DecodeLocale`.
+      Set command line arguments (:c:member:`~PyConfig.argv` member of
+      *config*) from the *argv* list of bytes strings. Decode bytes using
+      :c:func:`Py_DecodeLocale`.
 
-      Preinitialize Python if needed.
+      :ref:`Preinitialize Python <c-preinit>` if needed.
 
    .. c:function:: PyStatus PyConfig_SetWideStringList(PyConfig *config, PyWideStringList *list, Py_ssize_t length, wchar_t **items)
 
       Set the list of wide strings *list* to *length* and *items*.
 
-      Preinitialize Python if needed.
+      :ref:`Preinitialize Python <c-preinit>` if needed.
 
    .. c:function:: PyStatus PyConfig_Read(PyConfig *config)
 
@@ -390,24 +479,37 @@
 
       Fields which are already initialized are left unchanged.
 
-      Preinitialize Python if needed.
+      The :c:func:`PyConfig_Read` function only parses
+      :c:member:`PyConfig.argv` arguments once: :c:member:`PyConfig.parse_argv`
+      is set to ``2`` after arguments are parsed. Since Python arguments are
+      strippped from :c:member:`PyConfig.argv`, parsing arguments twice would
+      parse the application options as Python options.
+
+      :ref:`Preinitialize Python <c-preinit>` if needed.
+
+      .. versionchanged:: 3.10
+         The :c:member:`PyConfig.argv` arguments are now only parsed once,
+         :c:member:`PyConfig.parse_argv` is set to ``2`` after arguments are
+         parsed, and arguments are only parsed if
+         :c:member:`PyConfig.parse_argv` equals ``1``.
 
    .. c:function:: void PyConfig_Clear(PyConfig *config)
 
       Release configuration memory.
 
-   Most ``PyConfig`` methods preinitialize Python if needed. In that case, the
-   Python preinitialization configuration in based on the :c:type:`PyConfig`.
-   If configuration fields which are in common with :c:type:`PyPreConfig` are
-   tuned, they must be set before calling a :c:type:`PyConfig` method:
+   Most ``PyConfig`` methods :ref:`preinitialize Python <c-preinit>` if needed.
+   In that case, the Python preinitialization configuration
+   (:c:type:`PyPreConfig`) in based on the :c:type:`PyConfig`. If configuration
+   fields which are in common with :c:type:`PyPreConfig` are tuned, they must
+   be set before calling a :c:type:`PyConfig` method:
 
-   * :c:member:`~PyConfig.dev_mode`
-   * :c:member:`~PyConfig.isolated`
-   * :c:member:`~PyConfig.parse_argv`
-   * :c:member:`~PyConfig.use_environment`
+   * :c:member:`PyConfig.dev_mode`
+   * :c:member:`PyConfig.isolated`
+   * :c:member:`PyConfig.parse_argv`
+   * :c:member:`PyConfig.use_environment`
 
    Moreover, if :c:func:`PyConfig_SetArgv` or :c:func:`PyConfig_SetBytesArgv`
-   is used, this method must be called first, before other methods, since the
+   is used, this method must be called before other methods, since the
    preinitialization configuration depends on command line arguments (if
    :c:member:`parse_argv` is non-zero).
 
@@ -418,90 +520,205 @@
 
    .. c:member:: PyWideStringList argv
 
-      Command line arguments, :data:`sys.argv`. See
-      :c:member:`~PyConfig.parse_argv` to parse :c:member:`~PyConfig.argv` the
-      same way the regular Python parses Python command line arguments. If
-      :c:member:`~PyConfig.argv` is empty, an empty string is added to ensure
-      that :data:`sys.argv` always exists and is never empty.
+      Command line arguments: :data:`sys.argv`.
+
+      Set :c:member:`~PyConfig.parse_argv` to ``1`` to parse
+      :c:member:`~PyConfig.argv` the same way the regular Python parses Python
+      command line arguments and then to strip Python arguments from
+      :c:member:`~PyConfig.argv`.
+
+      If :c:member:`~PyConfig.argv` is empty, an empty string is added to
+      ensure that :data:`sys.argv` always exists and is never empty.
+
+      Default: ``NULL``.
+
+      See also the :c:member:`~PyConfig.orig_argv` member.
 
    .. c:member:: wchar_t* base_exec_prefix
 
       :data:`sys.base_exec_prefix`.
 
+      Default: ``NULL``.
+
+      Part of the :ref:`Python Path Configuration <init-path-config>` output.
+
    .. c:member:: wchar_t* base_executable
 
-      :data:`sys._base_executable`: ``__PYVENV_LAUNCHER__`` environment
-      variable value, or copy of :c:member:`PyConfig.executable`.
+      Python base executable: :data:`sys._base_executable`.
+
+      Set by the :envvar:`__PYVENV_LAUNCHER__` environment variable.
+
+      Set from :c:member:`PyConfig.executable` if ``NULL``.
+
+      Default: ``NULL``.
+
+      Part of the :ref:`Python Path Configuration <init-path-config>` output.
 
    .. c:member:: wchar_t* base_prefix
 
       :data:`sys.base_prefix`.
 
-   .. c:member:: wchar_t* platlibdir
+      Default: ``NULL``.
 
-      :data:`sys.platlibdir`: platform library directory name, set at configure time
-      by ``--with-platlibdir``, overrideable by the ``PYTHONPLATLIBDIR``
-      environment variable.
-
-      .. versionadded:: 3.9
+      Part of the :ref:`Python Path Configuration <init-path-config>` output.
 
    .. c:member:: int buffered_stdio
 
-      If equals to 0, enable unbuffered mode, making the stdout and stderr
-      streams unbuffered.
+      If equals to 0 and :c:member:`~PyConfig.configure_c_stdio` is non-zero,
+      disable buffering on the C streams stdout and stderr.
+
+      Set to 0 by the :option:`-u` command line option and the
+      :envvar:`PYTHONUNBUFFERED` environment variable.
 
       stdin is always opened in buffered mode.
 
+      Default: ``1``.
+
    .. c:member:: int bytes_warning
 
       If equals to 1, issue a warning when comparing :class:`bytes` or
       :class:`bytearray` with :class:`str`, or comparing :class:`bytes` with
-      :class:`int`. If equal or greater to 2, raise a :exc:`BytesWarning`
-      exception.
+      :class:`int`.
+
+      If equal or greater to 2, raise a :exc:`BytesWarning` exception in these
+      cases.
+
+      Incremented by the :option:`-b` command line option.
+
+      Default: ``0``.
+
+   .. c:member:: int warn_default_encoding
+
+      If non-zero, emit a :exc:`EncodingWarning` warning when :class:`io.TextIOWrapper`
+      uses its default encoding. See :ref:`io-encoding-warning` for details.
+
+      Default: ``0``.
+
+      .. versionadded:: 3.10
 
    .. c:member:: wchar_t* check_hash_pycs_mode
 
-      Control the validation behavior of hash-based ``.pyc`` files (see
-      :pep:`552`): :option:`--check-hash-based-pycs` command line option value.
+      Control the validation behavior of hash-based ``.pyc`` files:
+      value of the :option:`--check-hash-based-pycs` command line option.
 
-      Valid values: ``always``, ``never`` and ``default``.
+      Valid values:
 
-      The default value is: ``default``.
+      - ``L"always"``: Hash the source file for invalidation regardless of
+        value of the 'check_source' flag.
+      - ``L"never"``: Assume that hash-based pycs always are valid.
+      - ``L"default"``: The 'check_source' flag in hash-based pycs
+        determines invalidation.
+
+      Default: ``L"default"``.
+
+      See also :pep:`552` "Deterministic pycs".
 
    .. c:member:: int configure_c_stdio
 
-      If non-zero, configure C standard streams (``stdio``, ``stdout``,
-      ``stdout``). For example, set their mode to ``O_BINARY`` on Windows.
+      If non-zero, configure C standard streams:
+
+      * On Windows, set the binary mode (``O_BINARY``) on stdin, stdout and
+        stderr.
+      * If :c:member:`~PyConfig.buffered_stdio` equals zero, disable buffering
+        of stdin, stdout and stderr streams.
+      * If :c:member:`~PyConfig.interactive` is non-zero, enable stream
+        buffering on stdin and stdout (only stdout on Windows).
+
+      Default: ``1`` in Python config, ``0`` in isolated config.
 
    .. c:member:: int dev_mode
 
       If non-zero, enable the :ref:`Python Development Mode <devmode>`.
 
+      Default: ``-1`` in Python mode, ``0`` in isolated mode.
+
    .. c:member:: int dump_refs
 
+      Dump Python references?
+
       If non-zero, dump all objects which are still alive at exit.
 
-      ``Py_TRACE_REFS`` macro must be defined in build.
+      Set to ``1`` by the :envvar:`PYTHONDUMPREFS` environment variable.
+
+      Need a special build of Python with the ``Py_TRACE_REFS`` macro defined:
+      see the :option:`configure --with-trace-refs option <--with-trace-refs>`.
+
+      Default: ``0``.
 
    .. c:member:: wchar_t* exec_prefix
 
-      :data:`sys.exec_prefix`.
+      The site-specific directory prefix where the platform-dependent Python
+      files are installed: :data:`sys.exec_prefix`.
+
+      Default: ``NULL``.
+
+      Part of the :ref:`Python Path Configuration <init-path-config>` output.
 
    .. c:member:: wchar_t* executable
 
+      The absolute path of the executable binary for the Python interpreter:
       :data:`sys.executable`.
 
+      Default: ``NULL``.
+
+      Part of the :ref:`Python Path Configuration <init-path-config>` output.
+
    .. c:member:: int faulthandler
 
+      Enable faulthandler?
+
       If non-zero, call :func:`faulthandler.enable` at startup.
 
+      Set to ``1`` by :option:`-X faulthandler <-X>` and the
+      :envvar:`PYTHONFAULTHANDLER` environment variable.
+
+      Default: ``-1`` in Python mode, ``0`` in isolated mode.
+
    .. c:member:: wchar_t* filesystem_encoding
 
-      Filesystem encoding, :func:`sys.getfilesystemencoding`.
+      :term:`Filesystem encoding <filesystem encoding and error handler>`:
+      :func:`sys.getfilesystemencoding`.
+
+      On macOS, Android and VxWorks: use ``"utf-8"`` by default.
+
+      On Windows: use ``"utf-8"`` by default, or ``"mbcs"`` if
+      :c:member:`~PyPreConfig.legacy_windows_fs_encoding` of
+      :c:type:`PyPreConfig` is non-zero.
+
+      Default encoding on other platforms:
+
+      * ``"utf-8"`` if :c:member:`PyPreConfig.utf8_mode` is non-zero.
+      * ``"ascii"`` if Python detects that ``nl_langinfo(CODESET)`` announces
+        the ASCII encoding (or Roman8 encoding on HP-UX), whereas the
+        ``mbstowcs()`` function decodes from a different encoding (usually
+        Latin1).
+      * ``"utf-8"`` if ``nl_langinfo(CODESET)`` returns an empty string.
+      * Otherwise, use the :term:`locale encoding`:
+        ``nl_langinfo(CODESET)`` result.
+
+      At Python startup, the encoding name is normalized to the Python codec
+      name. For example, ``"ANSI_X3.4-1968"`` is replaced with ``"ascii"``.
+
+      See also the :c:member:`~PyConfig.filesystem_errors` member.
 
    .. c:member:: wchar_t* filesystem_errors
 
-      Filesystem encoding errors, :func:`sys.getfilesystemencodeerrors`.
+      :term:`Filesystem error handler <filesystem encoding and error handler>`:
+      :func:`sys.getfilesystemencodeerrors`.
+
+      On Windows: use ``"surrogatepass"`` by default, or ``"replace"``  if
+      :c:member:`~PyPreConfig.legacy_windows_fs_encoding` of
+      :c:type:`PyPreConfig` is non-zero.
+
+      On other platforms: use ``"surrogateescape"`` by default.
+
+      Supported error handlers:
+
+      * ``"strict"``
+      * ``"surrogateescape"``
+      * ``"surrogatepass"`` (only supported with the UTF-8 encoding)
+
+      See also the :c:member:`~PyConfig.filesystem_encoding` member.
 
    .. c:member:: unsigned long hash_seed
    .. c:member:: int use_hash_seed
@@ -509,30 +726,62 @@
       Randomized hash function seed.
 
       If :c:member:`~PyConfig.use_hash_seed` is zero, a seed is chosen randomly
-      at Pythonstartup, and :c:member:`~PyConfig.hash_seed` is ignored.
+      at Python startup, and :c:member:`~PyConfig.hash_seed` is ignored.
+
+      Set by the :envvar:`PYTHONHASHSEED` environment variable.
+
+      Default *use_hash_seed* value: ``-1`` in Python mode, ``0`` in isolated
+      mode.
 
    .. c:member:: wchar_t* home
 
       Python home directory.
 
-      Initialized from :envvar:`PYTHONHOME` environment variable value by
-      default.
+      If :c:func:`Py_SetPythonHome` has been called, use its argument if it is
+      not ``NULL``.
+
+      Set by the :envvar:`PYTHONHOME` environment variable.
+
+      Default: ``NULL``.
+
+      Part of the :ref:`Python Path Configuration <init-path-config>` input.
 
    .. c:member:: int import_time
 
       If non-zero, profile import time.
 
+      Set the ``1`` by the :option:`-X importtime <-X>` option and the
+      :envvar:`PYTHONPROFILEIMPORTTIME` environment variable.
+
+      Default: ``0``.
+
    .. c:member:: int inspect
 
       Enter interactive mode after executing a script or a command.
 
+      If greater than 0, enable inspect: when a script is passed as first
+      argument or the -c option is used, enter interactive mode after executing
+      the script or the command, even when :data:`sys.stdin` does not appear to
+      be a terminal.
+
+      Incremented by the :option:`-i` command line option. Set to ``1`` if the
+      :envvar:`PYTHONINSPECT` environment variable is non-empty.
+
+      Default: ``0``.
+
    .. c:member:: int install_signal_handlers
 
-      Install signal handlers?
+      Install Python signal handlers?
+
+      Default: ``1`` in Python mode, ``0`` in isolated mode.
 
    .. c:member:: int interactive
 
-      Interactive mode.
+      If greater than 0, enable the interactive mode (REPL).
+
+      Incremented by the :option:`-i` command line option.
+
+      Default: ``0``.
 
    .. c:member:: int isolated
 
@@ -546,95 +795,227 @@
       * Set :c:member:`~PyConfig.use_environment` and
         :c:member:`~PyConfig.user_site_directory` to 0.
 
+      Default: ``0`` in Python mode, ``1`` in isolated mode.
+
+      See also :c:member:`PyPreConfig.isolated`.
+
    .. c:member:: int legacy_windows_stdio
 
       If non-zero, use :class:`io.FileIO` instead of
       :class:`io.WindowsConsoleIO` for :data:`sys.stdin`, :data:`sys.stdout`
       and :data:`sys.stderr`.
 
+      Set to ``1`` if the :envvar:`PYTHONLEGACYWINDOWSSTDIO` environment
+      variable is set to a non-empty string.
+
       Only available on Windows. ``#ifdef MS_WINDOWS`` macro can be used for
       Windows specific code.
 
+      Default: ``0``.
+
+      See also the :pep:`528` (Change Windows console encoding to UTF-8).
+
    .. c:member:: int malloc_stats
 
       If non-zero, dump statistics on :ref:`Python pymalloc memory allocator
       <pymalloc>` at exit.
 
-      The option is ignored if Python is built using ``--without-pymalloc``.
+      Set to ``1`` by the :envvar:`PYTHONMALLOCSTATS` environment variable.
+
+      The option is ignored if Python is :option:`configured using
+      the --without-pymalloc option <--without-pymalloc>`.
+
+      Default: ``0``.
+
+   .. c:member:: wchar_t* platlibdir
+
+      Platform library directory name: :data:`sys.platlibdir`.
+
+      Set by the :envvar:`PYTHONPLATLIBDIR` environment variable.
+
+      Default: value of the ``PLATLIBDIR`` macro which is set by the
+      :option:`configure --with-platlibdir option <--with-platlibdir>`
+      (default: ``"lib"``).
+
+      Part of the :ref:`Python Path Configuration <init-path-config>` input.
+
+      .. versionadded:: 3.9
 
    .. c:member:: wchar_t* pythonpath_env
 
-      Module search paths as a string separated by ``DELIM``
+      Module search paths (:data:`sys.path`) as a string separated by ``DELIM``
       (:data:`os.path.pathsep`).
 
-      Initialized from :envvar:`PYTHONPATH` environment variable value by
-      default.
+      Set by the :envvar:`PYTHONPATH` environment variable.
+
+      Default: ``NULL``.
+
+      Part of the :ref:`Python Path Configuration <init-path-config>` input.
 
    .. c:member:: PyWideStringList module_search_paths
    .. c:member:: int module_search_paths_set
 
-      :data:`sys.path`. If :c:member:`~PyConfig.module_search_paths_set` is
-      equal to 0, the :c:member:`~PyConfig.module_search_paths` is overridden
-      by the function calculating the :ref:`Path Configuration
-      <init-path-config>`.
+      Module search paths: :data:`sys.path`.
+
+      If :c:member:`~PyConfig.module_search_paths_set` is equal to 0, the
+      function calculating the :ref:`Python Path Configuration <init-path-config>`
+      overrides the :c:member:`~PyConfig.module_search_paths` and sets
+      :c:member:`~PyConfig.module_search_paths_set` to ``1``.
+
+      Default: empty list (``module_search_paths``) and ``0``
+      (``module_search_paths_set``).
+
+      Part of the :ref:`Python Path Configuration <init-path-config>` output.
 
    .. c:member:: int optimization_level
 
       Compilation optimization level:
 
-      * 0: Peephole optimizer (and ``__debug__`` is set to ``True``)
-      * 1: Remove assertions, set ``__debug__`` to ``False``
-      * 2: Strip docstrings
+      * ``0``: Peephole optimizer, set ``__debug__`` to ``True``.
+      * ``1``: Level 0, remove assertions, set ``__debug__`` to ``False``.
+      * ``2``: Level 1, strip docstrings.
+
+      Incremented by the :option:`-O` command line option. Set to the
+      :envvar:`PYTHONOPTIMIZE` environment variable value.
+
+      Default: ``0``.
+
+   .. c:member:: PyWideStringList orig_argv
+
+      The list of the original command line arguments passed to the Python
+      executable: :data:`sys.orig_argv`.
+
+      If :c:member:`~PyConfig.orig_argv` list is empty and
+      :c:member:`~PyConfig.argv` is not a list only containing an empty
+      string, :c:func:`PyConfig_Read` copies :c:member:`~PyConfig.argv` into
+      :c:member:`~PyConfig.orig_argv` before modifying
+      :c:member:`~PyConfig.argv` (if :c:member:`~PyConfig.parse_argv` is
+      non-zero).
+
+      See also the :c:member:`~PyConfig.argv` member and the
+      :c:func:`Py_GetArgcArgv` function.
+
+      Default: empty list.
+
+      .. versionadded:: 3.10
 
    .. c:member:: int parse_argv
 
-      If non-zero, parse :c:member:`~PyConfig.argv` the same way the regular
-      Python command line arguments, and strip Python arguments from
-      :c:member:`~PyConfig.argv`: see :ref:`Command Line Arguments
-      <using-on-cmdline>`.
+      Parse command line arguments?
+
+      If equals to ``1``, parse :c:member:`~PyConfig.argv` the same way the regular
+      Python parses :ref:`command line arguments <using-on-cmdline>`, and strip
+      Python arguments from :c:member:`~PyConfig.argv`.
+
+      The :c:func:`PyConfig_Read` function only parses
+      :c:member:`PyConfig.argv` arguments once: :c:member:`PyConfig.parse_argv`
+      is set to ``2`` after arguments are parsed. Since Python arguments are
+      strippped from :c:member:`PyConfig.argv`, parsing arguments twice would
+      parse the application options as Python options.
+
+      Default: ``1`` in Python mode, ``0`` in isolated mode.
+
+      .. versionchanged:: 3.10
+         The :c:member:`PyConfig.argv` arguments are now only parsed if
+         :c:member:`PyConfig.parse_argv` equals to ``1``.
 
    .. c:member:: int parser_debug
 
-      If non-zero, turn on parser debugging output (for expert only, depending
+      Parser debug mode. If greater than 0, turn on parser debugging output (for expert only, depending
       on compilation options).
 
+      Incremented by the :option:`-d` command line option. Set to the
+      :envvar:`PYTHONDEBUG` environment variable value.
+
+      Default: ``0``.
+
    .. c:member:: int pathconfig_warnings
 
-      If equal to 0, suppress warnings when calculating the :ref:`Path
-      Configuration <init-path-config>` (Unix only, Windows does not log any
-      warning). Otherwise, warnings are written into ``stderr``.
+      On Unix, if non-zero, calculating the :ref:`Python Path Configuration
+      <init-path-config>` can log warnings into ``stderr``. If equals to 0,
+      suppress these warnings.
+
+      It has no effect on Windows.
+
+      Default: ``1`` in Python mode, ``0`` in isolated mode.
+
+      Part of the :ref:`Python Path Configuration <init-path-config>` input.
 
    .. c:member:: wchar_t* prefix
 
-      :data:`sys.prefix`.
+      The site-specific directory prefix where the platform independent Python
+      files are installed: :data:`sys.prefix`.
+
+      Default: ``NULL``.
+
+      Part of the :ref:`Python Path Configuration <init-path-config>` output.
 
    .. c:member:: wchar_t* program_name
 
-      Program name. Used to initialize :c:member:`~PyConfig.executable`, and in
-      early error messages.
+      Program name used to initialize :c:member:`~PyConfig.executable` and in
+      early error messages during Python initialization.
+
+      * If :func:`Py_SetProgramName` has been called, use its argument.
+      * On macOS, use :envvar:`PYTHONEXECUTABLE` environment variable if set.
+      * If the ``WITH_NEXT_FRAMEWORK`` macro is defined, use
+        :envvar:`__PYVENV_LAUNCHER__` environment variable if set.
+      * Use ``argv[0]`` of :c:member:`~PyConfig.argv` if available and
+        non-empty.
+      * Otherwise, use ``L"python"`` on Windows, or ``L"python3"`` on other
+        platforms.
+
+      Default: ``NULL``.
+
+      Part of the :ref:`Python Path Configuration <init-path-config>` input.
 
    .. c:member:: wchar_t* pycache_prefix
 
-      :data:`sys.pycache_prefix`: ``.pyc`` cache prefix.
+      Directory where cached ``.pyc`` files are written:
+      :data:`sys.pycache_prefix`.
+
+      Set by the :option:`-X pycache_prefix=PATH <-X>` command line option and
+      the :envvar:`PYTHONPYCACHEPREFIX` environment variable.
 
       If ``NULL``, :data:`sys.pycache_prefix` is set to ``None``.
 
+      Default: ``NULL``.
+
    .. c:member:: int quiet
 
-      Quiet mode. For example, don't display the copyright and version messages
-      in interactive mode.
+      Quiet mode. If greater than 0, don't display the copyright and version at
+      Python startup in interactive mode.
+
+      Incremented by the :option:`-q` command line option.
+
+      Default: ``0``.
 
    .. c:member:: wchar_t* run_command
 
-      ``python3 -c COMMAND`` argument. Used by :c:func:`Py_RunMain`.
+      Value of the :option:`-c` command line option.
+
+      Used by :c:func:`Py_RunMain`.
+
+      Default: ``NULL``.
 
    .. c:member:: wchar_t* run_filename
 
-      ``python3 FILENAME`` argument. Used by :c:func:`Py_RunMain`.
+      Filename passed on the command line: trailing command line argument
+      without :option:`-c` or :option:`-m`.
+
+      For example, it is set to ``script.py`` by the ``python3 script.py arg``
+      command.
+
+      Used by :c:func:`Py_RunMain`.
+
+      Default: ``NULL``.
 
    .. c:member:: wchar_t* run_module
 
-      ``python3 -m MODULE`` argument. Used by :c:func:`Py_RunMain`.
+      Value of the :option:`-m` command line option.
+
+      Used by :c:func:`Py_RunMain`.
+
+      Default: ``NULL``.
 
    .. c:member:: int show_ref_count
 
@@ -642,76 +1023,156 @@
 
       Set to 1 by :option:`-X showrefcount <-X>` command line option.
 
-      Need a debug build of Python (``Py_REF_DEBUG`` macro must be defined).
+      Need a :ref:`debug build of Python <debug-build>` (the ``Py_REF_DEBUG``
+      macro must be defined).
+
+      Default: ``0``.
 
    .. c:member:: int site_import
 
       Import the :mod:`site` module at startup?
 
+      If equal to zero, disable the import of the module site and the
+      site-dependent manipulations of :data:`sys.path` that it entails.
+
+      Also disable these manipulations if the :mod:`site` module is explicitly
+      imported later (call :func:`site.main` if you want them to be triggered).
+
+      Set to ``0`` by the :option:`-S` command line option.
+
+      :data:`sys.flags.no_site` is set to the inverted value of
+      :c:member:`~PyConfig.site_import`.
+
+      Default: ``1``.
+
    .. c:member:: int skip_source_first_line
 
-      Skip the first line of the source?
+      If non-zero, skip the first line of the :c:member:`PyConfig.run_filename`
+      source.
+
+      It allows the usage of non-Unix forms of ``#!cmd``. This is intended for
+      a DOS specific hack only.
+
+      Set to ``1`` by the :option:`-x` command line option.
+
+      Default: ``0``.
 
    .. c:member:: wchar_t* stdio_encoding
    .. c:member:: wchar_t* stdio_errors
 
       Encoding and encoding errors of :data:`sys.stdin`, :data:`sys.stdout` and
-      :data:`sys.stderr`.
+      :data:`sys.stderr` (but :data:`sys.stderr` always uses
+      ``"backslashreplace"`` error handler).
+
+      If :c:func:`Py_SetStandardStreamEncoding` has been called, use its
+      *error* and *errors* arguments if they are not ``NULL``.
+
+      Use the :envvar:`PYTHONIOENCODING` environment variable if it is
+      non-empty.
+
+      Default encoding:
+
+      * ``"UTF-8"`` if :c:member:`PyPreConfig.utf8_mode` is non-zero.
+      * Otherwise, use the :term:`locale encoding`.
+
+      Default error handler:
+
+      * On Windows: use ``"surrogateescape"``.
+      * ``"surrogateescape"`` if :c:member:`PyPreConfig.utf8_mode` is non-zero,
+        or if the LC_CTYPE locale is "C" or "POSIX".
+      * ``"strict"`` otherwise.
 
    .. c:member:: int tracemalloc
 
+      Enable tracemalloc?
+
       If non-zero, call :func:`tracemalloc.start` at startup.
 
+      Set by :option:`-X tracemalloc=N <-X>` command line option and by the
+      :envvar:`PYTHONTRACEMALLOC` environment variable.
+
+      Default: ``-1`` in Python mode, ``0`` in isolated mode.
+
    .. c:member:: int use_environment
 
-      If greater than 0, use :ref:`environment variables <using-on-envvars>`.
+      Use :ref:`environment variables <using-on-envvars>`?
+
+      If equals to zero, ignore the :ref:`environment variables
+      <using-on-envvars>`.
+
+      Default: ``1`` in Python config and ``0`` in isolated config.
 
    .. c:member:: int user_site_directory
 
-      If non-zero, add user site directory to :data:`sys.path`.
+      If non-zero, add the user site directory to :data:`sys.path`.
+
+      Set to ``0`` by the :option:`-s` and :option:`-I` command line options.
+
+      Set to ``0`` by the :envvar:`PYTHONNOUSERSITE` environment variable.
+
+      Default: ``1`` in Python mode, ``0`` in isolated mode.
 
    .. c:member:: int verbose
 
-      If non-zero, enable verbose mode.
+      Verbose mode. If greater than 0, print a message each time a module is
+      imported, showing the place (filename or built-in module) from which
+      it is loaded.
+
+      If greater or equal to 2, print a message for each file that is checked
+      for when searching for a module. Also provides information on module
+      cleanup at exit.
+
+      Incremented by the :option:`-v` command line option.
+
+      Set to the :envvar:`PYTHONVERBOSE` environment variable value.
+
+      Default: ``0``.
 
    .. c:member:: PyWideStringList warnoptions
 
-      :data:`sys.warnoptions`: options of the :mod:`warnings` module to build
-      warnings filters: lowest to highest priority.
+      Options of the :mod:`warnings` module to build warnings filters, lowest
+      to highest priority: :data:`sys.warnoptions`.
 
       The :mod:`warnings` module adds :data:`sys.warnoptions` in the reverse
       order: the last :c:member:`PyConfig.warnoptions` item becomes the first
       item of :data:`warnings.filters` which is checked first (highest
       priority).
 
+      The :option:`-W` command line options adds its value to
+      :c:member:`~PyConfig.warnoptions`, it can be used multiple times.
+
+      The :envvar:`PYTHONWARNINGS` environment variable can also be used to add
+      warning options. Multiple options can be specified, separated by commas
+      (``,``).
+
+      Default: empty list.
+
    .. c:member:: int write_bytecode
 
-      If non-zero, write ``.pyc`` files.
+      If equal to 0, Python won't try to write ``.pyc`` files on the import of
+      source modules.
+
+      Set to ``0`` by the :option:`-B` command line option and the
+      :envvar:`PYTHONDONTWRITEBYTECODE` environment variable.
 
       :data:`sys.dont_write_bytecode` is initialized to the inverted value of
       :c:member:`~PyConfig.write_bytecode`.
 
+      Default: ``1``.
+
    .. c:member:: PyWideStringList xoptions
 
-      :data:`sys._xoptions`.
+      Values of the :option:`-X` command line options: :data:`sys._xoptions`.
 
-   .. c:member:: int _use_peg_parser
+      Default: empty list.
 
-      Enable PEG parser? Default: 1.
+If :c:member:`~PyConfig.parse_argv` is non-zero, :c:member:`~PyConfig.argv`
+arguments are parsed the same way the regular Python parses :ref:`command line
+arguments <using-on-cmdline>`, and Python arguments are stripped from
+:c:member:`~PyConfig.argv`.
 
-      Set to 0 by :option:`-X oldparser <-X>` and :envvar:`PYTHONOLDPARSER`.
-
-      See also :pep:`617`.
-
-      .. deprecated-removed:: 3.9 3.10
-
-If ``parse_argv`` is non-zero, ``argv`` arguments are parsed the same
-way the regular Python parses command line arguments, and Python
-arguments are stripped from ``argv``: see :ref:`Command Line Arguments
-<using-on-cmdline>`.
-
-The ``xoptions`` options are parsed to set other options: see :option:`-X`
-option.
+The :c:member:`~PyConfig.xoptions` options are parsed to set other options: see
+the :option:`-X` command line option.
 
 .. versionchanged:: 3.9
 
@@ -719,7 +1180,7 @@
 
 
 Initialization with PyConfig
-----------------------------
+============================
 
 Function to initialize Python:
 
@@ -730,9 +1191,15 @@
 The caller is responsible to handle exceptions (error or exit) using
 :c:func:`PyStatus_Exception` and :c:func:`Py_ExitStatusException`.
 
-If ``PyImport_FrozenModules``, ``PyImport_AppendInittab()`` or
-``PyImport_ExtendInittab()`` are used, they must be set or called after Python
-preinitialization and before the Python initialization.
+If :c:func:`PyImport_FrozenModules`, :c:func:`PyImport_AppendInittab` or
+:c:func:`PyImport_ExtendInittab` are used, they must be set or called after
+Python preinitialization and before the Python initialization. If Python is
+initialized multiple times, :c:func:`PyImport_AppendInittab` or
+:c:func:`PyImport_ExtendInittab` must be called before each Python
+initialization.
+
+The current configuration (``PyConfig`` type) is stored in
+``PyInterpreterState.config``.
 
 Example setting the program name::
 
@@ -747,17 +1214,17 @@
         status = PyConfig_SetString(&config, &config.program_name,
                                     L"/path/to/my_program");
         if (PyStatus_Exception(status)) {
-            goto fail;
+            goto exception;
         }
 
         status = Py_InitializeFromConfig(&config);
         if (PyStatus_Exception(status)) {
-            goto fail;
+            goto exception;
         }
         PyConfig_Clear(&config);
         return;
 
-    fail:
+    exception:
         PyConfig_Clear(&config);
         Py_ExitStatusException(status);
     }
@@ -777,7 +1244,7 @@
 
            Implicitly preinitialize Python. */
         status = PyConfig_SetBytesString(&config, &config.program_name,
-                                      program_name);
+                                         program_name);
         if (PyStatus_Exception(status)) {
             goto done;
         }
@@ -813,7 +1280,7 @@
 .. _init-isolated-conf:
 
 Isolated Configuration
-----------------------
+======================
 
 :c:func:`PyPreConfig_InitIsolatedConfig` and
 :c:func:`PyConfig_InitIsolatedConfig` functions create a configuration to
@@ -826,7 +1293,7 @@
 LC_CTYPE locale are left unchanged. Signal handlers are not installed.
 
 Configuration files are still used with this configuration. Set the
-:ref:`Path Configuration <init-path-config>` ("output fields") to ignore these
+:ref:`Python Path Configuration <init-path-config>` ("output fields") to ignore these
 configuration files and avoid the function computing the default path
 configuration.
 
@@ -834,7 +1301,7 @@
 .. _init-python-config:
 
 Python Configuration
---------------------
+====================
 
 :c:func:`PyPreConfig_InitPythonConfig` and :c:func:`PyConfig_InitPythonConfig`
 functions create a configuration to build a customized Python which behaves as
@@ -843,50 +1310,16 @@
 Environments variables and command line arguments are used to configure
 Python, whereas global configuration variables are ignored.
 
-This function enables C locale coercion (:pep:`538`) and UTF-8 Mode
+This function enables C locale coercion (:pep:`538`)
+and :ref:`Python UTF-8 Mode <utf8-mode>`
 (:pep:`540`) depending on the LC_CTYPE locale, :envvar:`PYTHONUTF8` and
 :envvar:`PYTHONCOERCECLOCALE` environment variables.
 
-Example of customized Python always running in isolated mode::
-
-    int main(int argc, char **argv)
-    {
-        PyStatus status;
-
-        PyConfig config;
-        PyConfig_InitPythonConfig(&config);
-        config.isolated = 1;
-
-        /* Decode command line arguments.
-           Implicitly preinitialize Python (in isolated mode). */
-        status = PyConfig_SetBytesArgv(&config, argc, argv);
-        if (PyStatus_Exception(status)) {
-            goto fail;
-        }
-
-        status = Py_InitializeFromConfig(&config);
-        if (PyStatus_Exception(status)) {
-            goto fail;
-        }
-        PyConfig_Clear(&config);
-
-        return Py_RunMain();
-
-    fail:
-        PyConfig_Clear(&config);
-        if (PyStatus_IsExit(status)) {
-            return status.exitcode;
-        }
-        /* Display the error message and exit the process with
-           non-zero exit code */
-        Py_ExitStatusException(status);
-    }
-
 
 .. _init-path-config:
 
-Path Configuration
-------------------
+Python Path Configuration
+=========================
 
 :c:type:`PyConfig` contains multiple fields for the path configuration:
 
@@ -966,7 +1399,7 @@
 
 
 Py_RunMain()
-------------
+============
 
 .. c:function:: int Py_RunMain(void)
 
@@ -986,15 +1419,17 @@
 
 
 Py_GetArgcArgv()
-----------------
+================
 
 .. c:function:: void Py_GetArgcArgv(int *argc, wchar_t ***argv)
 
    Get the original command line arguments, before Python modified them.
 
+   See also :c:member:`PyConfig.orig_argv` member.
+
 
 Multi-Phase Initialization Private Provisional API
---------------------------------------------------
+==================================================
 
 This section is a private provisional API introducing multi-phase
 initialization, the core feature of the :pep:`432`:
diff --git a/Doc/c-api/intro.rst b/Doc/c-api/intro.rst
index 7ca8693..2d85d30 100644
--- a/Doc/c-api/intro.rst
+++ b/Doc/c-api/intro.rst
@@ -326,7 +326,7 @@
 caller). When a function passes ownership of a reference on to its caller, the
 caller is said to receive a *new* reference.  When no ownership is transferred,
 the caller is said to *borrow* the reference. Nothing needs to be done for a
-borrowed reference.
+:term:`borrowed reference`.
 
 Conversely, when a calling function passes in a reference to an  object, there
 are two possibilities: the function *steals* a  reference to the object, or it
@@ -742,43 +742,22 @@
 frequently-used builds will be described in the remainder of this section.
 
 Compiling the interpreter with the :c:macro:`Py_DEBUG` macro defined produces
-what is generally meant by "a debug build" of Python. :c:macro:`Py_DEBUG` is
-enabled in the Unix build by adding ``--with-pydebug`` to the
-:file:`./configure` command.  It is also implied by the presence of the
+what is generally meant by :ref:`a debug build of Python <debug-build>`.
+:c:macro:`Py_DEBUG` is enabled in the Unix build by adding
+:option:`--with-pydebug` to the :file:`./configure` command.
+It is also implied by the presence of the
 not-Python-specific :c:macro:`_DEBUG` macro.  When :c:macro:`Py_DEBUG` is enabled
 in the Unix build, compiler optimization is disabled.
 
-In addition to the reference count debugging described below, the following
-extra checks are performed:
+In addition to the reference count debugging described below, extra checks are
+performed, see :ref:`Python Debug Build <debug-build>`.
 
-* Extra checks are added to the object allocator.
-
-* Extra checks are added to the parser and compiler.
-
-* Downcasts from wide types to narrow types are checked for loss of information.
-
-* A number of assertions are added to the dictionary and set implementations.
-  In addition, the set object acquires a :meth:`test_c_api` method.
-
-* Sanity checks of the input arguments are added to frame creation.
-
-* The storage for ints is initialized with a known invalid pattern to catch
-  reference to uninitialized digits.
-
-* Low-level tracing and extra exception checking are added to the runtime
-  virtual machine.
-
-* Extra checks are added to the memory arena implementation.
-
-* Extra debugging is added to the thread module.
-
-There may be additional checks not mentioned here.
-
-Defining :c:macro:`Py_TRACE_REFS` enables reference tracing.  When defined, a
-circular doubly linked list of active objects is maintained by adding two extra
+Defining :c:macro:`Py_TRACE_REFS` enables reference tracing
+(see the :option:`configure --with-trace-refs option <--with-trace-refs>`).
+When defined, a circular doubly linked list of active objects is maintained by adding two extra
 fields to every :c:type:`PyObject`.  Total allocations are tracked as well.  Upon
 exit, all existing references are printed.  (In interactive mode this happens
-after every statement run by the interpreter.)  Implied by :c:macro:`Py_DEBUG`.
+after every statement run by the interpreter.)
 
 Please refer to :file:`Misc/SpecialBuilds.txt` in the Python source distribution
 for more detailed information.
diff --git a/Doc/c-api/iter.rst b/Doc/c-api/iter.rst
index a2992b3..3e388bb 100644
--- a/Doc/c-api/iter.rst
+++ b/Doc/c-api/iter.rst
@@ -9,15 +9,23 @@
 
 .. c:function:: int PyIter_Check(PyObject *o)
 
-   Return true if the object *o* supports the iterator protocol.
+   Return non-zero if the object *o* can be safely passed to
+   :c:func:`PyIter_Next`, and ``0`` otherwise.  This function always succeeds.
 
+.. c:function:: int PyAIter_Check(PyObject *o)
+
+   Returns non-zero if the object 'obj' provides :class:`AsyncIterator`
+   protocols, and ``0`` otherwise.  This function always succeeds.
+
+   .. versionadded:: 3.10
 
 .. c:function:: PyObject* PyIter_Next(PyObject *o)
 
-   Return the next value from the iteration *o*.  The object must be an iterator
-   (it is up to the caller to check this).  If there are no remaining values,
-   returns ``NULL`` with no exception set.  If an error occurs while retrieving
-   the item, returns ``NULL`` and passes along the exception.
+   Return the next value from the iterator *o*.  The object must be an iterator
+   according to :c:func:`PyIter_Check` (it is up to the caller to check this).
+   If there are no remaining values, returns ``NULL`` with no exception set.
+   If an error occurs while retrieving the item, returns ``NULL`` and passes
+   along the exception.
 
 To write a loop which iterates over an iterator, the C code should look
 something like this::
@@ -44,3 +52,21 @@
    else {
        /* continue doing useful work */
    }
+
+
+.. c:type:: PySendResult
+
+   The enum value used to represent different results of :c:func:`PyIter_Send`.
+
+   .. versionadded:: 3.10
+
+
+.. c:function:: PySendResult PyIter_Send(PyObject *iter, PyObject *arg, PyObject **presult)
+
+   Sends the *arg* value into the iterator *iter*. Returns:
+
+   - ``PYGEN_RETURN`` if iterator returns. Return value is returned via *presult*.
+   - ``PYGEN_NEXT`` if iterator yields. Yielded value is returned via *presult*.
+   - ``PYGEN_ERROR`` if iterator has raised and exception. *presult* is set to ``NULL``.
+
+   .. versionadded:: 3.10
diff --git a/Doc/c-api/iterator.rst b/Doc/c-api/iterator.rst
index 4d91e4a..3fcf099 100644
--- a/Doc/c-api/iterator.rst
+++ b/Doc/c-api/iterator.rst
@@ -21,7 +21,8 @@
 
 .. c:function:: int PySeqIter_Check(op)
 
-   Return true if the type of *op* is :c:data:`PySeqIter_Type`.
+   Return true if the type of *op* is :c:data:`PySeqIter_Type`.  This function
+   always succeeds.
 
 
 .. c:function:: PyObject* PySeqIter_New(PyObject *seq)
@@ -39,7 +40,8 @@
 
 .. c:function:: int PyCallIter_Check(op)
 
-   Return true if the type of *op* is :c:data:`PyCallIter_Type`.
+   Return true if the type of *op* is :c:data:`PyCallIter_Type`.  This
+   function always succeeds.
 
 
 .. c:function:: PyObject* PyCallIter_New(PyObject *callable, PyObject *sentinel)
diff --git a/Doc/c-api/list.rst b/Doc/c-api/list.rst
index 0bc0785..f338e2a 100644
--- a/Doc/c-api/list.rst
+++ b/Doc/c-api/list.rst
@@ -22,13 +22,13 @@
 .. c:function:: int PyList_Check(PyObject *p)
 
    Return true if *p* is a list object or an instance of a subtype of the list
-   type.
+   type.  This function always succeeds.
 
 
 .. c:function:: int PyList_CheckExact(PyObject *p)
 
    Return true if *p* is a list object, but not an instance of a subtype of
-   the list type.
+   the list type.  This function always succeeds.
 
 
 .. c:function:: PyObject* PyList_New(Py_ssize_t len)
diff --git a/Doc/c-api/long.rst b/Doc/c-api/long.rst
index 22e59ce..4201490 100644
--- a/Doc/c-api/long.rst
+++ b/Doc/c-api/long.rst
@@ -27,13 +27,13 @@
 .. c:function:: int PyLong_Check(PyObject *p)
 
    Return true if its argument is a :c:type:`PyLongObject` or a subtype of
-   :c:type:`PyLongObject`.
+   :c:type:`PyLongObject`.  This function always succeeds.
 
 
 .. c:function:: int PyLong_CheckExact(PyObject *p)
 
    Return true if its argument is a :c:type:`PyLongObject`, but not a subtype of
-   :c:type:`PyLongObject`.
+   :c:type:`PyLongObject`.  This function always succeeds.
 
 
 .. c:function:: PyObject* PyLong_FromLong(long v)
@@ -94,15 +94,6 @@
    are no digits, :exc:`ValueError` will be raised.
 
 
-.. c:function:: PyObject* PyLong_FromUnicode(Py_UNICODE *u, Py_ssize_t length, int base)
-
-   Convert a sequence of Unicode digits to a Python integer value.
-
-   .. deprecated-removed:: 3.3 3.10
-      Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
-      :c:func:`PyLong_FromUnicodeObject`.
-
-
 .. c:function:: PyObject* PyLong_FromUnicodeObject(PyObject *u, int base)
 
    Convert a sequence of Unicode digits in the string *u* to a Python integer
@@ -125,9 +116,8 @@
       single: OverflowError (built-in exception)
 
    Return a C :c:type:`long` representation of *obj*.  If *obj* is not an
-   instance of :c:type:`PyLongObject`, first call its :meth:`__index__` or
-   :meth:`__int__` method (if present) to convert it to a
-   :c:type:`PyLongObject`.
+   instance of :c:type:`PyLongObject`, first call its :meth:`__index__` method
+   (if present) to convert it to a :c:type:`PyLongObject`.
 
    Raise :exc:`OverflowError` if the value of *obj* is out of range for a
    :c:type:`long`.
@@ -137,16 +127,15 @@
    .. versionchanged:: 3.8
       Use :meth:`__index__` if available.
 
-   .. deprecated:: 3.8
-      Using :meth:`__int__` is deprecated.
+   .. versionchanged:: 3.10
+      This function will no longer use :meth:`__int__`.
 
 
 .. c:function:: long PyLong_AsLongAndOverflow(PyObject *obj, int *overflow)
 
    Return a C :c:type:`long` representation of *obj*.  If *obj* is not an
-   instance of :c:type:`PyLongObject`, first call its :meth:`__index__` or
-   :meth:`__int__` method (if present) to convert it to a
-   :c:type:`PyLongObject`.
+   instance of :c:type:`PyLongObject`, first call its :meth:`__index__`
+   method (if present) to convert it to a :c:type:`PyLongObject`.
 
    If the value of *obj* is greater than :const:`LONG_MAX` or less than
    :const:`LONG_MIN`, set *\*overflow* to ``1`` or ``-1``, respectively, and
@@ -158,8 +147,8 @@
    .. versionchanged:: 3.8
       Use :meth:`__index__` if available.
 
-   .. deprecated:: 3.8
-      Using :meth:`__int__` is deprecated.
+   .. versionchanged:: 3.10
+      This function will no longer use :meth:`__int__`.
 
 
 .. c:function:: long long PyLong_AsLongLong(PyObject *obj)
@@ -168,9 +157,8 @@
       single: OverflowError (built-in exception)
 
    Return a C :c:type:`long long` representation of *obj*.  If *obj* is not an
-   instance of :c:type:`PyLongObject`, first call its :meth:`__index__` or
-   :meth:`__int__` method (if present) to convert it to a
-   :c:type:`PyLongObject`.
+   instance of :c:type:`PyLongObject`, first call its :meth:`__index__` method
+   (if present) to convert it to a :c:type:`PyLongObject`.
 
    Raise :exc:`OverflowError` if the value of *obj* is out of range for a
    :c:type:`long long`.
@@ -180,16 +168,15 @@
    .. versionchanged:: 3.8
       Use :meth:`__index__` if available.
 
-   .. deprecated:: 3.8
-      Using :meth:`__int__` is deprecated.
+   .. versionchanged:: 3.10
+      This function will no longer use :meth:`__int__`.
 
 
 .. c:function:: long long PyLong_AsLongLongAndOverflow(PyObject *obj, int *overflow)
 
    Return a C :c:type:`long long` representation of *obj*.  If *obj* is not an
-   instance of :c:type:`PyLongObject`, first call its :meth:`__index__` or
-   :meth:`__int__` method (if present) to convert it to a
-   :c:type:`PyLongObject`.
+   instance of :c:type:`PyLongObject`, first call its :meth:`__index__` method
+   (if present) to convert it to a :c:type:`PyLongObject`.
 
    If the value of *obj* is greater than :const:`LLONG_MAX` or less than
    :const:`LLONG_MIN`, set *\*overflow* to ``1`` or ``-1``, respectively,
@@ -203,8 +190,8 @@
    .. versionchanged:: 3.8
       Use :meth:`__index__` if available.
 
-   .. deprecated:: 3.8
-      Using :meth:`__int__` is deprecated.
+   .. versionchanged:: 3.10
+      This function will no longer use :meth:`__int__`.
 
 
 .. c:function:: Py_ssize_t PyLong_AsSsize_t(PyObject *pylong)
@@ -274,10 +261,9 @@
 
 .. c:function:: unsigned long PyLong_AsUnsignedLongMask(PyObject *obj)
 
-   Return a C :c:type:`unsigned long` representation of *obj*.  If *obj*
-   is not an instance of :c:type:`PyLongObject`, first call its
-   :meth:`__index__` or :meth:`__int__` method (if present) to convert
-   it to a :c:type:`PyLongObject`.
+   Return a C :c:type:`unsigned long` representation of *obj*.  If *obj* is not
+   an instance of :c:type:`PyLongObject`, first call its :meth:`__index__`
+   method (if present) to convert it to a :c:type:`PyLongObject`.
 
    If the value of *obj* is out of range for an :c:type:`unsigned long`,
    return the reduction of that value modulo ``ULONG_MAX + 1``.
@@ -288,16 +274,16 @@
    .. versionchanged:: 3.8
       Use :meth:`__index__` if available.
 
-   .. deprecated:: 3.8
-      Using :meth:`__int__` is deprecated.
+   .. versionchanged:: 3.10
+      This function will no longer use :meth:`__int__`.
 
 
 .. c:function:: unsigned long long PyLong_AsUnsignedLongLongMask(PyObject *obj)
 
    Return a C :c:type:`unsigned long long` representation of *obj*.  If *obj*
    is not an instance of :c:type:`PyLongObject`, first call its
-   :meth:`__index__` or :meth:`__int__` method (if present) to convert
-   it to a :c:type:`PyLongObject`.
+   :meth:`__index__` method (if present) to convert it to a
+   :c:type:`PyLongObject`.
 
    If the value of *obj* is out of range for an :c:type:`unsigned long long`,
    return the reduction of that value modulo ``ULLONG_MAX + 1``.
@@ -308,8 +294,8 @@
    .. versionchanged:: 3.8
       Use :meth:`__index__` if available.
 
-   .. deprecated:: 3.8
-      Using :meth:`__int__` is deprecated.
+   .. versionchanged:: 3.10
+      This function will no longer use :meth:`__int__`.
 
 
 .. c:function:: double PyLong_AsDouble(PyObject *pylong)
diff --git a/Doc/c-api/memory.rst b/Doc/c-api/memory.rst
index 87425bc..0746d9a 100644
--- a/Doc/c-api/memory.rst
+++ b/Doc/c-api/memory.rst
@@ -92,6 +92,38 @@
    statistics of the :ref:`pymalloc memory allocator <pymalloc>` every time a
    new pymalloc object arena is created, and on shutdown.
 
+Allocator Domains
+=================
+
+All allocating functions belong to one of three different "domains" (see also
+:c:type:`PyMemAllocatorDomain`). These domains represent different allocation
+strategies and are optimized for different purposes. The specific details on
+how every domain allocates memory or what internal functions each domain calls
+is considered an implementation detail, but for debugging purposes a simplified
+table can be found at :ref:`here <default-memory-allocators>`. There is no hard
+requirement to use the memory returned by the allocation functions belonging to
+a given domain for only the purposes hinted by that domain (although this is the
+recommended practice). For example, one could use the memory returned by
+:c:func:`PyMem_RawMalloc` for allocating Python objects or the memory returned
+by :c:func:`PyObject_Malloc` for allocating memory for buffers.
+
+The three allocation domains are:
+
+* Raw domain: intended for allocating memory for general-purpose memory
+  buffers where the allocation *must* go to the system allocator or where the
+  allocator can operate without the :term:`GIL`. The memory is requested directly
+  to the system.
+
+* "Mem" domain: intended for allocating memory for Python buffers and
+  general-purpose memory buffers where the allocation must be performed with
+  the :term:`GIL` held. The memory is taken from the Python private heap.
+
+* Object domain: intended for allocating memory belonging to Python objects. The
+  memory is taken from the Python private heap.
+
+When freeing memory previously allocated by the allocating functions belonging to a
+given domain,the matching specific deallocating functions must be used. For example,
+:c:func:`PyMem_Free` must be used to free memory allocated using :c:func:`PyMem_Malloc`.
 
 Raw Memory Interface
 ====================
@@ -272,6 +304,12 @@
 behavior when requesting zero bytes, are available for allocating and releasing
 memory from the Python heap.
 
+.. note::
+    There is no guarantee that the memory returned by these allocators can be
+    successfully casted to a Python object when intercepting the allocating
+    functions in this domain by the methods described in
+    the :ref:`Customize Memory Allocators <customize-memory-allocators>` section.
+
 The :ref:`default object allocator <default-memory-allocators>` uses the
 :ref:`pymalloc memory allocator <pymalloc>`.
 
@@ -347,12 +385,15 @@
 
 Legend:
 
-* Name: value for :envvar:`PYTHONMALLOC` environment variable
+* Name: value for :envvar:`PYTHONMALLOC` environment variable.
 * ``malloc``: system allocators from the standard C library, C functions:
-  :c:func:`malloc`, :c:func:`calloc`, :c:func:`realloc` and :c:func:`free`
-* ``pymalloc``: :ref:`pymalloc memory allocator <pymalloc>`
-* "+ debug": with debug hooks installed by :c:func:`PyMem_SetupDebugHooks`
+  :c:func:`malloc`, :c:func:`calloc`, :c:func:`realloc` and :c:func:`free`.
+* ``pymalloc``: :ref:`pymalloc memory allocator <pymalloc>`.
+* "+ debug": with :ref:`debug hooks on the Python memory allocators
+  <pymem-debug-hooks>`.
+* "Debug build": :ref:`Python build in debug mode <debug-build>`.
 
+.. _customize-memory-allocators:
 
 Customize Memory Allocators
 ===========================
@@ -438,45 +479,113 @@
 
 .. c:function:: void PyMem_SetupDebugHooks(void)
 
-   Setup hooks to detect bugs in the Python memory allocator functions.
+   Setup :ref:`debug hooks in the Python memory allocators <pymem-debug-hooks>`
+   to detect memory errors.
 
-   Newly allocated memory is filled with the byte ``0xCD`` (``CLEANBYTE``),
-   freed memory is filled with the byte ``0xDD`` (``DEADBYTE``). Memory blocks
-   are surrounded by "forbidden bytes" (``FORBIDDENBYTE``: byte ``0xFD``).
 
-   Runtime checks:
+.. _pymem-debug-hooks:
 
-   - Detect API violations, ex: :c:func:`PyObject_Free` called on a buffer
-     allocated by :c:func:`PyMem_Malloc`
-   - Detect write before the start of the buffer (buffer underflow)
-   - Detect write after the end of the buffer (buffer overflow)
-   - Check that the :term:`GIL <global interpreter lock>` is held when
-     allocator functions of :c:data:`PYMEM_DOMAIN_OBJ` (ex:
-     :c:func:`PyObject_Malloc`) and :c:data:`PYMEM_DOMAIN_MEM` (ex:
-     :c:func:`PyMem_Malloc`) domains are called
+Debug hooks on the Python memory allocators
+===========================================
 
-   On error, the debug hooks use the :mod:`tracemalloc` module to get the
-   traceback where a memory block was allocated. The traceback is only
-   displayed if :mod:`tracemalloc` is tracing Python memory allocations and the
-   memory block was traced.
+When :ref:`Python is built in debug mode <debug-build>`, the
+:c:func:`PyMem_SetupDebugHooks` function is called at the :ref:`Python
+preinitialization <c-preinit>` to setup debug hooks on Python memory allocators
+to detect memory errors.
 
-   These hooks are :ref:`installed by default <default-memory-allocators>` if
-   Python is compiled in debug
-   mode. The :envvar:`PYTHONMALLOC` environment variable can be used to install
-   debug hooks on a Python compiled in release mode.
+The :envvar:`PYTHONMALLOC` environment variable can be used to install debug
+hooks on a Python compiled in release mode (ex: ``PYTHONMALLOC=debug``).
 
-   .. versionchanged:: 3.6
-      This function now also works on Python compiled in release mode.
-      On error, the debug hooks now use :mod:`tracemalloc` to get the traceback
-      where a memory block was allocated. The debug hooks now also check
-      if the GIL is held when functions of :c:data:`PYMEM_DOMAIN_OBJ` and
-      :c:data:`PYMEM_DOMAIN_MEM` domains are called.
+The :c:func:`PyMem_SetupDebugHooks` function can be used to set debug hooks
+after calling :c:func:`PyMem_SetAllocator`.
 
-   .. versionchanged:: 3.8
-      Byte patterns ``0xCB`` (``CLEANBYTE``), ``0xDB`` (``DEADBYTE``) and
-      ``0xFB`` (``FORBIDDENBYTE``) have been replaced with ``0xCD``, ``0xDD``
-      and ``0xFD`` to use the same values than Windows CRT debug ``malloc()``
-      and ``free()``.
+These debug hooks fill dynamically allocated memory blocks with special,
+recognizable bit patterns. Newly allocated memory is filled with the byte
+``0xCD`` (``PYMEM_CLEANBYTE``), freed memory is filled with the byte ``0xDD``
+(``PYMEM_DEADBYTE``). Memory blocks are surrounded by "forbidden bytes"
+filled with the byte ``0xFD`` (``PYMEM_FORBIDDENBYTE``). Strings of these bytes
+are unlikely to be valid addresses, floats, or ASCII strings.
+
+Runtime checks:
+
+- Detect API violations. For example, detect if :c:func:`PyObject_Free` is
+  called on a memory block allocated by :c:func:`PyMem_Malloc`.
+- Detect write before the start of the buffer (buffer underflow).
+- Detect write after the end of the buffer (buffer overflow).
+- Check that the :term:`GIL <global interpreter lock>` is held when
+  allocator functions of :c:data:`PYMEM_DOMAIN_OBJ` (ex:
+  :c:func:`PyObject_Malloc`) and :c:data:`PYMEM_DOMAIN_MEM` (ex:
+  :c:func:`PyMem_Malloc`) domains are called.
+
+On error, the debug hooks use the :mod:`tracemalloc` module to get the
+traceback where a memory block was allocated. The traceback is only displayed
+if :mod:`tracemalloc` is tracing Python memory allocations and the memory block
+was traced.
+
+Let *S* = ``sizeof(size_t)``. ``2*S`` bytes are added at each end of each block
+of *N* bytes requested.  The memory layout is like so, where p represents the
+address returned by a malloc-like or realloc-like function (``p[i:j]`` means
+the slice of bytes from ``*(p+i)`` inclusive up to ``*(p+j)`` exclusive; note
+that the treatment of negative indices differs from a Python slice):
+
+``p[-2*S:-S]``
+    Number of bytes originally asked for.  This is a size_t, big-endian (easier
+    to read in a memory dump).
+``p[-S]``
+    API identifier (ASCII character):
+
+    * ``'r'`` for :c:data:`PYMEM_DOMAIN_RAW`.
+    * ``'m'`` for :c:data:`PYMEM_DOMAIN_MEM`.
+    * ``'o'`` for :c:data:`PYMEM_DOMAIN_OBJ`.
+
+``p[-S+1:0]``
+    Copies of PYMEM_FORBIDDENBYTE.  Used to catch under- writes and reads.
+
+``p[0:N]``
+    The requested memory, filled with copies of PYMEM_CLEANBYTE, used to catch
+    reference to uninitialized memory.  When a realloc-like function is called
+    requesting a larger memory block, the new excess bytes are also filled with
+    PYMEM_CLEANBYTE.  When a free-like function is called, these are
+    overwritten with PYMEM_DEADBYTE, to catch reference to freed memory.  When
+    a realloc- like function is called requesting a smaller memory block, the
+    excess old bytes are also filled with PYMEM_DEADBYTE.
+
+``p[N:N+S]``
+    Copies of PYMEM_FORBIDDENBYTE.  Used to catch over- writes and reads.
+
+``p[N+S:N+2*S]``
+    Only used if the ``PYMEM_DEBUG_SERIALNO`` macro is defined (not defined by
+    default).
+
+    A serial number, incremented by 1 on each call to a malloc-like or
+    realloc-like function.  Big-endian ``size_t``.  If "bad memory" is detected
+    later, the serial number gives an excellent way to set a breakpoint on the
+    next run, to capture the instant at which this block was passed out.  The
+    static function bumpserialno() in obmalloc.c is the only place the serial
+    number is incremented, and exists so you can set such a breakpoint easily.
+
+A realloc-like or free-like function first checks that the PYMEM_FORBIDDENBYTE
+bytes at each end are intact.  If they've been altered, diagnostic output is
+written to stderr, and the program is aborted via Py_FatalError().  The other
+main failure mode is provoking a memory error when a program reads up one of
+the special bit patterns and tries to use it as an address.  If you get in a
+debugger then and look at the object, you're likely to see that it's entirely
+filled with PYMEM_DEADBYTE (meaning freed memory is getting used) or
+PYMEM_CLEANBYTE (meaning uninitialized memory is getting used).
+
+.. versionchanged:: 3.6
+   The :c:func:`PyMem_SetupDebugHooks` function now also works on Python
+   compiled in release mode.  On error, the debug hooks now use
+   :mod:`tracemalloc` to get the traceback where a memory block was allocated.
+   The debug hooks now also check if the GIL is held when functions of
+   :c:data:`PYMEM_DOMAIN_OBJ` and :c:data:`PYMEM_DOMAIN_MEM` domains are
+   called.
+
+.. versionchanged:: 3.8
+   Byte patterns ``0xCB`` (``PYMEM_CLEANBYTE``), ``0xDB`` (``PYMEM_DEADBYTE``)
+   and ``0xFB`` (``PYMEM_FORBIDDENBYTE``) have been replaced with ``0xCD``,
+   ``0xDD`` and ``0xFD`` to use the same values than Windows CRT debug
+   ``malloc()`` and ``free()``.
 
 
 .. _pymalloc:
@@ -499,6 +608,10 @@
 * :c:func:`mmap` and :c:func:`munmap` if available,
 * :c:func:`malloc` and :c:func:`free` otherwise.
 
+This allocator is disabled if Python is configured with the
+:option:`--without-pymalloc` option. It can also be disabled at runtime using
+the :envvar:`PYTHONMALLOC` environment variable (ex: ``PYTHONMALLOC=malloc``).
+
 Customize pymalloc Arena Allocator
 ----------------------------------
 
@@ -516,7 +629,7 @@
    +--------------------------------------------------+---------------------------------------+
    | ``void* alloc(void *ctx, size_t size)``          | allocate an arena of size bytes       |
    +--------------------------------------------------+---------------------------------------+
-   | ``void free(void *ctx, size_t size, void *ptr)`` | free an arena                         |
+   | ``void free(void *ctx, void *ptr, size_t size)`` | free an arena                         |
    +--------------------------------------------------+---------------------------------------+
 
 .. c:function:: void PyObject_GetArenaAllocator(PyObjectArenaAllocator *allocator)
@@ -601,4 +714,3 @@
 
 These will be explained in the next chapter on defining and implementing new
 object types in C.
-
diff --git a/Doc/c-api/memoryview.rst b/Doc/c-api/memoryview.rst
index de429e5..24f8c93 100644
--- a/Doc/c-api/memoryview.rst
+++ b/Doc/c-api/memoryview.rst
@@ -45,7 +45,8 @@
 .. c:function:: int PyMemoryView_Check(PyObject *obj)
 
    Return true if the object *obj* is a memoryview object.  It is not
-   currently allowed to create subclasses of :class:`memoryview`.
+   currently allowed to create subclasses of :class:`memoryview`.  This
+   function always succeeds.
 
 
 .. c:function:: Py_buffer *PyMemoryView_GET_BUFFER(PyObject *mview)
diff --git a/Doc/c-api/method.rst b/Doc/c-api/method.rst
index 0a5341c..2385225 100644
--- a/Doc/c-api/method.rst
+++ b/Doc/c-api/method.rst
@@ -22,6 +22,7 @@
 
    Return true if *o* is an instance method object (has type
    :c:data:`PyInstanceMethod_Type`).  The parameter must not be ``NULL``.
+   This function always succeeds.
 
 
 .. c:function:: PyObject* PyInstanceMethod_New(PyObject *func)
@@ -64,7 +65,7 @@
 .. c:function:: int PyMethod_Check(PyObject *o)
 
    Return true if *o* is a method object (has type :c:data:`PyMethod_Type`).  The
-   parameter must not be ``NULL``.
+   parameter must not be ``NULL``.  This function always succeeds.
 
 
 .. c:function:: PyObject* PyMethod_New(PyObject *func, PyObject *self)
diff --git a/Doc/c-api/module.rst b/Doc/c-api/module.rst
index 6e9474b..94c8d9f 100644
--- a/Doc/c-api/module.rst
+++ b/Doc/c-api/module.rst
@@ -19,12 +19,13 @@
 .. c:function:: int PyModule_Check(PyObject *p)
 
    Return true if *p* is a module object, or a subtype of a module object.
+   This function always succeeds.
 
 
 .. c:function:: int PyModule_CheckExact(PyObject *p)
 
    Return true if *p* is a module object, but not a subtype of
-   :c:data:`PyModule_Type`.
+   :c:data:`PyModule_Type`.  This function always succeeds.
 
 
 .. c:function:: PyObject* PyModule_NewObject(PyObject *name)
@@ -220,6 +221,12 @@
       than 0 and the module state (as returned by :c:func:`PyModule_GetState`)
       is ``NULL``.
 
+      Like :c:member:`PyTypeObject.tp_clear`, this function is not *always*
+      called before a module is deallocated. For example, when reference
+      counting is enough to determine that an object is no longer used,
+      the cyclic garbage collector is not involved and
+      :c:member:`~PyModuleDef.m_free` is called directly.
+
       .. versionchanged:: 3.9
          No longer called before the module state is allocated.
 
@@ -264,7 +271,7 @@
       instead; only use this if you are sure you need it.
 
 Before it is returned from in the initialization function, the resulting module
-object is typically populated using functions like :c:func:`PyModule_AddObject`.
+object is typically populated using functions like :c:func:`PyModule_AddObjectRef`.
 
 .. _multi-phase-initialization:
 
@@ -437,26 +444,102 @@
 initialization), can use the following functions to help initialize the module
 state:
 
+.. c:function:: int PyModule_AddObjectRef(PyObject *module, const char *name, PyObject *value)
+
+   Add an object to *module* as *name*.  This is a convenience function which
+   can be used from the module's initialization function.
+
+   On success, return ``0``. On error, raise an exception and return ``-1``.
+
+   Return ``NULL`` if *value* is ``NULL``. It must be called with an exception
+   raised in this case.
+
+   Example usage::
+
+       static int
+       add_spam(PyObject *module, int value)
+       {
+           PyObject *obj = PyLong_FromLong(value);
+           if (obj == NULL) {
+               return -1;
+           }
+           int res = PyModule_AddObjectRef(module, "spam", obj);
+           Py_DECREF(obj);
+           return res;
+        }
+
+   The example can also be written without checking explicitly if *obj* is
+   ``NULL``::
+
+       static int
+       add_spam(PyObject *module, int value)
+       {
+           PyObject *obj = PyLong_FromLong(value);
+           int res = PyModule_AddObjectRef(module, "spam", obj);
+           Py_XDECREF(obj);
+           return res;
+        }
+
+   Note that ``Py_XDECREF()`` should be used instead of ``Py_DECREF()`` in
+   this case, since *obj* can be ``NULL``.
+
+   .. versionadded:: 3.10
+
+
 .. c:function:: int PyModule_AddObject(PyObject *module, const char *name, PyObject *value)
 
-   Add an object to *module* as *name*.  This is a convenience function which can
-   be used from the module's initialization function.  This steals a reference to
-   *value* on success. Return ``-1`` on error, ``0`` on success.
+   Similar to :c:func:`PyModule_AddObjectRef`, but steals a reference to
+   *value* on success (if it returns ``0``).
+
+   The new :c:func:`PyModule_AddObjectRef` function is recommended, since it is
+   easy to introduce reference leaks by misusing the
+   :c:func:`PyModule_AddObject` function.
 
    .. note::
 
-      Unlike other functions that steal references, ``PyModule_AddObject()`` only
-      decrements the reference count of *value* **on success**.
+      Unlike other functions that steal references, ``PyModule_AddObject()``
+      only decrements the reference count of *value* **on success**.
 
       This means that its return value must be checked, and calling code must
-      :c:func:`Py_DECREF` *value* manually on error. Example usage::
+      :c:func:`Py_DECREF` *value* manually on error.
 
-         Py_INCREF(spam);
-         if (PyModule_AddObject(module, "spam", spam) < 0) {
-             Py_DECREF(module);
-             Py_DECREF(spam);
-             return NULL;
-         }
+   Example usage::
+
+      static int
+      add_spam(PyObject *module, int value)
+      {
+          PyObject *obj = PyLong_FromLong(value);
+          if (obj == NULL) {
+              return -1;
+          }
+          if (PyModule_AddObject(module, "spam", obj) < 0) {
+              Py_DECREF(obj);
+              return -1;
+          }
+          // PyModule_AddObject() stole a reference to obj:
+          // Py_DECREF(obj) is not needed here
+          return 0;
+      }
+
+   The example can also be written without checking explicitly if *obj* is
+   ``NULL``::
+
+      static int
+      add_spam(PyObject *module, int value)
+      {
+          PyObject *obj = PyLong_FromLong(value);
+          if (PyModule_AddObject(module, "spam", obj) < 0) {
+              Py_XDECREF(obj);
+              return -1;
+          }
+          // PyModule_AddObject() stole a reference to obj:
+          // Py_DECREF(obj) is not needed here
+          return 0;
+      }
+
+   Note that ``Py_XDECREF()`` should be used instead of ``Py_DECREF()`` in
+   this case, since *obj* can be ``NULL``.
+
 
 .. c:function:: int PyModule_AddIntConstant(PyObject *module, const char *name, long value)
 
diff --git a/Doc/c-api/number.rst b/Doc/c-api/number.rst
index 620204c..37979bb 100644
--- a/Doc/c-api/number.rst
+++ b/Doc/c-api/number.rst
@@ -256,6 +256,10 @@
    Returns the *o* converted to a Python int on success or ``NULL`` with a
    :exc:`TypeError` exception raised on failure.
 
+   .. versionchanged:: 3.10
+      The result always has exact type :class:`int`.  Previously, the result
+      could have been an instance of a subclass of ``int``.
+
 
 .. c:function:: PyObject* PyNumber_ToBase(PyObject *n, int base)
 
diff --git a/Doc/c-api/object.rst b/Doc/c-api/object.rst
index a387b4a..41a3aff 100644
--- a/Doc/c-api/object.rst
+++ b/Doc/c-api/object.rst
@@ -81,8 +81,9 @@
    return ``0`` on success.  This is the equivalent of the Python statement
    ``o.attr_name = v``.
 
-   If *v* is ``NULL``, the attribute is deleted, however this feature is
-   deprecated in favour of using :c:func:`PyObject_DelAttr`.
+   If *v* is ``NULL``, the attribute is deleted. This behaviour is deprecated
+   in favour of using :c:func:`PyObject_DelAttr`, but there are currently no
+   plans to remove it.
 
 
 .. c:function:: int PyObject_SetAttrString(PyObject *o, const char *attr_name, PyObject *v)
@@ -297,8 +298,8 @@
 
 .. c:function:: int PyObject_TypeCheck(PyObject *o, PyTypeObject *type)
 
-   Return true if the object *o* is of type *type* or a subtype of *type*.  Both
-   parameters must be non-``NULL``.
+   Return non-zero if the object *o* is of type *type* or a subtype of *type*, and
+   ``0`` otherwise.  Both parameters must be non-``NULL``.
 
 
 .. c:function:: Py_ssize_t PyObject_Size(PyObject *o)
@@ -311,12 +312,12 @@
    returned.  This is the equivalent to the Python expression ``len(o)``.
 
 
-.. c:function:: Py_ssize_t PyObject_LengthHint(PyObject *o, Py_ssize_t default)
+.. c:function:: Py_ssize_t PyObject_LengthHint(PyObject *o, Py_ssize_t defaultvalue)
 
    Return an estimated length for the object *o*. First try to return its
    actual length, then an estimate using :meth:`~object.__length_hint__`, and
    finally return the default value. On error return ``-1``. This is the
-   equivalent to the Python expression ``operator.length_hint(o, default)``.
+   equivalent to the Python expression ``operator.length_hint(o, defaultvalue)``.
 
    .. versionadded:: 3.4
 
@@ -356,3 +357,14 @@
    iterator for the object argument, or the object  itself if the object is already
    an iterator.  Raises :exc:`TypeError` and returns ``NULL`` if the object cannot be
    iterated.
+
+
+.. c:function:: PyObject* PyObject_GetAIter(PyObject *o)
+
+   This is the equivalent to the Python expression ``aiter(o)``. Takes an
+   :class:`AsyncIterable` object and returns an :class:`AsyncIterator` for it.
+   This is typically a new iterator but if the argument is an
+   :class:`AsyncIterator`, this returns itself. Raises :exc:`TypeError` and
+   returns ``NULL`` if the object cannot be iterated.
+
+   .. versionadded:: 3.10
diff --git a/Doc/c-api/refcounting.rst b/Doc/c-api/refcounting.rst
index 0df12c6..391907c 100644
--- a/Doc/c-api/refcounting.rst
+++ b/Doc/c-api/refcounting.rst
@@ -13,8 +13,14 @@
 
 .. c:function:: void Py_INCREF(PyObject *o)
 
-   Increment the reference count for object *o*.  The object must not be ``NULL``; if
-   you aren't sure that it isn't ``NULL``, use :c:func:`Py_XINCREF`.
+   Increment the reference count for object *o*.
+
+   This function is usually used to convert a :term:`borrowed reference` to a
+   :term:`strong reference` in-place. The :c:func:`Py_NewRef` function can be
+   used to create a new :term:`strong reference`.
+
+   The object must not be ``NULL``; if you aren't sure that it isn't
+   ``NULL``, use :c:func:`Py_XINCREF`.
 
 
 .. c:function:: void Py_XINCREF(PyObject *o)
@@ -22,13 +28,55 @@
    Increment the reference count for object *o*.  The object may be ``NULL``, in
    which case the macro has no effect.
 
+   See also :c:func:`Py_XNewRef`.
+
+
+.. c:function:: PyObject* Py_NewRef(PyObject *o)
+
+   Create a new :term:`strong reference` to an object: increment the reference
+   count of the object *o* and return the object *o*.
+
+   When the :term:`strong reference` is no longer needed, :c:func:`Py_DECREF`
+   should be called on it to decrement the object reference count.
+
+   The object *o* must not be ``NULL``; use :c:func:`Py_XNewRef` if *o* can be
+   ``NULL``.
+
+   For example::
+
+       Py_INCREF(obj);
+       self->attr = obj;
+
+   can be written as::
+
+       self->attr = Py_NewRef(obj);
+
+   See also :c:func:`Py_INCREF`.
+
+   .. versionadded:: 3.10
+
+
+.. c:function:: PyObject* Py_XNewRef(PyObject *o)
+
+   Similar to :c:func:`Py_NewRef`, but the object *o* can be NULL.
+
+   If the object *o* is ``NULL``, the function just returns ``NULL``.
+
+   .. versionadded:: 3.10
+
 
 .. c:function:: void Py_DECREF(PyObject *o)
 
-   Decrement the reference count for object *o*.  The object must not be ``NULL``; if
-   you aren't sure that it isn't ``NULL``, use :c:func:`Py_XDECREF`.  If the reference
-   count reaches zero, the object's type's deallocation function (which must not be
-   ``NULL``) is invoked.
+   Decrement the reference count for object *o*.
+
+   If the reference count reaches zero, the object's type's deallocation
+   function (which must not be ``NULL``) is invoked.
+
+   This function is usually used to delete a :term:`strong reference` before
+   exiting its scope.
+
+   The object must not be ``NULL``; if you aren't sure that it isn't ``NULL``,
+   use :c:func:`Py_XDECREF`.
 
    .. warning::
 
diff --git a/Doc/c-api/reflection.rst b/Doc/c-api/reflection.rst
index 9207d86..fe7741a 100644
--- a/Doc/c-api/reflection.rst
+++ b/Doc/c-api/reflection.rst
@@ -31,22 +31,22 @@
    See also :c:func:`PyThreadState_GetFrame`.
 
 
-.. c:function:: int PyFrame_GetBack(PyFrameObject *frame)
+.. c:function:: PyFrameObject* PyFrame_GetBack(PyFrameObject *frame)
 
    Get the *frame* next outer frame.
 
-   Return a strong reference, or ``NULL`` if *frame* has no outer frame.
+   Return a :term:`strong reference`, or ``NULL`` if *frame* has no outer frame.
 
    *frame* must not be ``NULL``.
 
    .. versionadded:: 3.9
 
 
-.. c:function:: int PyFrame_GetCode(PyFrameObject *frame)
+.. c:function:: PyCodeObject* PyFrame_GetCode(PyFrameObject *frame)
 
    Get the *frame* code.
 
-   Return a strong reference.
+   Return a :term:`strong reference`.
 
    *frame* must not be ``NULL``. The result (frame code) cannot be ``NULL``.
 
diff --git a/Doc/c-api/set.rst b/Doc/c-api/set.rst
index 879f394..eca19c4 100644
--- a/Doc/c-api/set.rst
+++ b/Doc/c-api/set.rst
@@ -53,28 +53,35 @@
 .. c:function:: int PySet_Check(PyObject *p)
 
    Return true if *p* is a :class:`set` object or an instance of a subtype.
+   This function always succeeds.
 
 .. c:function:: int PyFrozenSet_Check(PyObject *p)
 
    Return true if *p* is a :class:`frozenset` object or an instance of a
-   subtype.
+   subtype.  This function always succeeds.
 
 .. c:function:: int PyAnySet_Check(PyObject *p)
 
    Return true if *p* is a :class:`set` object, a :class:`frozenset` object, or an
-   instance of a subtype.
+   instance of a subtype.  This function always succeeds.
 
+.. c:function:: int PySet_CheckExact(PyObject *p)
+
+   Return true if *p* is a :class:`set` object but not an instance of a
+   subtype.  This function always succeeds.
+
+   .. versionadded:: 3.10
 
 .. c:function:: int PyAnySet_CheckExact(PyObject *p)
 
    Return true if *p* is a :class:`set` object or a :class:`frozenset` object but
-   not an instance of a subtype.
+   not an instance of a subtype.  This function always succeeds.
 
 
 .. c:function:: int PyFrozenSet_CheckExact(PyObject *p)
 
    Return true if *p* is a :class:`frozenset` object but not an instance of a
-   subtype.
+   subtype.  This function always succeeds.
 
 
 .. c:function:: PyObject* PySet_New(PyObject *iterable)
diff --git a/Doc/c-api/slice.rst b/Doc/c-api/slice.rst
index 48a58c6..8271d9a 100644
--- a/Doc/c-api/slice.rst
+++ b/Doc/c-api/slice.rst
@@ -14,7 +14,8 @@
 
 .. c:function:: int PySlice_Check(PyObject *ob)
 
-   Return true if *ob* is a slice object; *ob* must not be ``NULL``.
+   Return true if *ob* is a slice object; *ob* must not be ``NULL``.  This
+   function always succeeds.
 
 
 .. c:function:: PyObject* PySlice_New(PyObject *start, PyObject *stop, PyObject *step)
diff --git a/Doc/c-api/stable.rst b/Doc/c-api/stable.rst
index 9c05cb3..4ae20e9 100644
--- a/Doc/c-api/stable.rst
+++ b/Doc/c-api/stable.rst
@@ -2,37 +2,157 @@
 
 .. _stable:
 
-***********************************
+***************
+C API Stability
+***************
+
+Python's C API is covered by the Backwards Compatibility Policy, :pep:`387`.
+While the C API will change with every minor release (e.g. from 3.9 to 3.10),
+most changes will be source-compatible, typically by only adding new API.
+Changing existing API or removing API is only done after a deprecation period
+or to fix serious issues.
+
+CPython's Application Binary Interface (ABI) is forward- and
+backwards-compatible across a minor release (if these are compiled the same
+way; see :ref:`stable-abi-platform` below).
+So, code compiled for Python 3.10.0 will work on 3.10.8 and vice versa,
+but will need to be compiled separately for 3.9.x and 3.10.x.
+
+Names prefixed by an underscore, such as ``_Py_InternalState``,
+are private API that can change without notice even in patch releases.
+
+
 Stable Application Binary Interface
-***********************************
+===================================
 
-Traditionally, the C API of Python will change with every release.  Most changes
-will be source-compatible, typically by only adding API, rather than changing
-existing API or removing API (although some interfaces do get removed after
-being deprecated first).
+Python 3.2 introduced the *Limited API*, a subset of Python's C API.
+Extensions that only use the Limited API can be
+compiled once and work with multiple versions of Python.
+Contents of the Limited API are :ref:`listed below <stable-abi-list>`.
 
-Unfortunately, the API compatibility does not extend to binary compatibility
-(the ABI). The reason is primarily the evolution of struct definitions, where
-addition of a new field, or changing the type of a field, might not break the
-API, but can break the ABI.  As a consequence, extension modules need to be
-recompiled for every Python release (although an exception is possible on Unix
-when none of the affected interfaces are used). In addition, on Windows,
-extension modules link with a specific pythonXY.dll and need to be recompiled to
-link with a newer one.
+To enable this, Python provides a *Stable ABI*: a set of symbols that will
+remain compatible across Python 3.x versions. The Stable ABI contains symbols
+exposed in the Limited API, but also other ones – for example, functions
+necessary to support older versions of the Limited API.
 
-Since Python 3.2, a subset of the API has been declared to guarantee a stable
-ABI. Extension modules wishing to use this API (called "limited API") need to
-define ``Py_LIMITED_API``. A number of interpreter details then become hidden
-from the extension module; in return, a module is built that works on any 3.x
-version (x>=2) without recompilation.
+(For simplicity, this document talks about *extensions*, but the Limited API
+and Stable ABI work the same way for all uses of the API – for example,
+embedding Python.)
 
-In some cases, the stable ABI needs to be extended with new functions.
-Extension modules wishing to use these new APIs need to set ``Py_LIMITED_API``
-to the ``PY_VERSION_HEX`` value (see :ref:`apiabiversion`) of the minimum Python
-version they want to support (e.g. ``0x03030000`` for Python 3.3). Such modules
-will work on all subsequent Python releases, but fail to load (because of
-missing symbols) on the older releases.
+.. c:macro:: Py_LIMITED_API
 
-As of Python 3.2, the set of functions available to the limited API is
-documented in :pep:`384`.  In the C API documentation, API elements that are not
-part of the limited API are marked as "Not part of the limited API."
+   Define this macro before including ``Python.h`` to opt in to only use
+   the Limited API, and to select the Limited API version.
+
+   Define ``Py_LIMITED_API`` to the value of :c:data:`PY_VERSION_HEX`
+   corresponding to the lowest Python version your extension supports.
+   The extension will work without recompilation with all Python 3 releases
+   from the specified one onward, and can use Limited API introduced up to that
+   version.
+
+   Rather than using the ``PY_VERSION_HEX`` macro directly, hardcode a minimum
+   minor version (e.g. ``0x030A0000`` for Python 3.10) for stability when
+   compiling with future Python versions.
+
+   You can also define ``Py_LIMITED_API`` to ``3``. This works the same as
+   ``0x03020000`` (Python 3.2, the version that introduced Limited API).
+
+On Windows, extensions that use the Stable ABI should be linked against
+``python3.dll`` rather than a version-specific library such as
+``python39.dll``.
+
+On some platforms, Python will look for and load shared library files named
+with the ``abi3`` tag (e.g. ``mymodule.abi3.so``).
+It does not check if such extensions conform to a Stable ABI.
+The user (or their packaging tools) need to ensure that, for example,
+extensions built with the 3.10+ Limited API are not installed for lower
+versions of Python.
+
+All functions in the Stable ABI are present as functions in Python's shared
+library, not solely as macros. This makes them usable from languages that don't
+use the C preprocessor.
+
+
+Limited API Scope and Performance
+---------------------------------
+
+The goal for the Limited API is to allow everything that is possible with the
+full C API, but possibly with a performance penalty.
+
+For example, while :c:func:`PyList_GetItem` is available, its “unsafe” macro
+variant :c:func:`PyList_GET_ITEM` is not.
+The macro can be faster because it can rely on version-specific implementation
+details of the list object.
+
+Without ``Py_LIMITED_API`` defined, some C API functions are inlined or
+replaced by macros.
+Defining ``Py_LIMITED_API`` disables this inlining, allowing stability as
+Python's data structures are improved, but possibly reducing performance.
+
+By leaving out the ``Py_LIMITED_API`` definition, it is possible to compile
+a Limited API extension with a version-specific ABI. This can improve
+performance for that Python version, but will limit compatibility.
+Compiling with ``Py_LIMITED_API`` will then yield an extension that can be
+distributed where a version-specific one is not available – for example,
+for prereleases of an upcoming Python version.
+
+
+Limited API Caveats
+-------------------
+
+Note that compiling with ``Py_LIMITED_API`` is *not* a complete guarantee that
+code conforms to the Limited API or the Stable ABI. ``Py_LIMITED_API`` only
+covers definitions, but an API also includes other issues, such as expected
+semantics.
+
+One issue that ``Py_LIMITED_API`` does not guard against is calling a function
+with arguments that are invalid in a lower Python version.
+For example, consider a function that starts accepting ``NULL`` for an
+argument. In Python 3.9, ``NULL`` now selects a default behavior, but in
+Python 3.8, the argument will be used directly, causing a ``NULL`` dereference
+and crash. A similar argument works for fields of structs.
+
+Another issue is that some struct fields are currently not hidden when
+``Py_LIMITED_API`` is defined, even though they're part of the Limited API.
+
+For these reasons, we recommend testing an extension with *all* minor Python
+versions it supports, and preferably to build with the *lowest* such version.
+
+We also recommend reviewing documentation of all used API to check
+if it is explicitly part of the Limited API. Even with ``Py_LIMITED_API``
+defined, a few private declarations are exposed for technical reasons (or
+even unintentionally, as bugs).
+
+Also note that the Limited API is not necessarily stable: compiling with
+``Py_LIMITED_API`` with Python 3.8 means that the extension will
+run with Python 3.12, but it will not necessarily *compile* with Python 3.12.
+In particular, parts of the Limited API may be deprecated and removed,
+provided that the Stable ABI stays stable.
+
+
+.. _stable-abi-platform:
+
+Platform Considerations
+=======================
+
+ABI stability depends not only on Python, but also on the compiler used,
+lower-level libraries and compiler options. For the purposes of the Stable ABI,
+these details define a “platform”. They usually depend on the OS
+type and processor architecture
+
+It is the responsibility of each particular distributor of Python
+to ensure that all Python versions on a particular platform are built
+in a way that does not break the Stable ABI.
+This is the case with Windows and macOS releases from ``python.org`` and many
+third-party distributors.
+
+
+.. _stable-abi-list:
+
+Contents of Limited API
+=======================
+
+
+Currently, the Limited API includes the following items:
+
+.. limited-api-list::
diff --git a/Doc/c-api/structures.rst b/Doc/c-api/structures.rst
index 0a0e03f..05c54cc 100644
--- a/Doc/c-api/structures.rst
+++ b/Doc/c-api/structures.rst
@@ -62,12 +62,44 @@
    See documentation of :c:type:`PyVarObject` above.
 
 
-.. c:macro:: Py_TYPE(o)
+.. c:function:: int Py_Is(const PyObject *x, const PyObject *y)
 
-   This macro is used to access the :attr:`ob_type` member of a Python object.
-   It expands to::
+   Test if the *x* object is the *y* object, the same as ``x is y`` in Python.
 
-      (((PyObject*)(o))->ob_type)
+   .. versionadded:: 3.10
+
+
+.. c:function:: int Py_IsNone(const PyObject *x)
+
+   Test if an object is the ``None`` singleton,
+   the same as ``x is None`` in Python.
+
+   .. versionadded:: 3.10
+
+
+.. c:function:: int Py_IsTrue(const PyObject *x)
+
+   Test if an object is the ``True`` singleton,
+   the same as ``x is True`` in Python.
+
+   .. versionadded:: 3.10
+
+
+.. c:function:: int Py_IsFalse(const PyObject *x)
+
+   Test if an object is the ``False`` singleton,
+   the same as ``x is False`` in Python.
+
+   .. versionadded:: 3.10
+
+
+.. c:function:: PyTypeObject* Py_TYPE(const PyObject *o)
+
+   Get the type of the Python object *o*.
+
+   Return a :term:`borrowed reference`.
+
+   The :c:func:`Py_SET_TYPE` function must be used to set an object type.
 
 
 .. c:function:: int Py_IS_TYPE(PyObject *o, PyTypeObject *type)
@@ -85,13 +117,13 @@
    .. versionadded:: 3.9
 
 
-.. c:macro:: Py_REFCNT(o)
+.. c:function:: Py_ssize_t Py_REFCNT(const PyObject *o)
 
-   This macro is used to access the :attr:`ob_refcnt` member of a Python
-   object.
-   It expands to::
+   Get the reference count of the Python object *o*.
 
-      (((PyObject*)(o))->ob_refcnt)
+   .. versionchanged:: 3.10
+      :c:func:`Py_REFCNT()` is changed to the inline static function.
+      Use :c:func:`Py_SET_REFCNT()` to set an object reference count.
 
 
 .. c:function:: void Py_SET_REFCNT(PyObject *o, Py_ssize_t refcnt)
@@ -101,12 +133,11 @@
    .. versionadded:: 3.9
 
 
-.. c:macro:: Py_SIZE(o)
+.. c:function:: Py_ssize_t Py_SIZE(const PyVarObject *o)
 
-   This macro is used to access the :attr:`ob_size` member of a Python object.
-   It expands to::
+   Get the size of the Python object *o*.
 
-      (((PyVarObject*)(o))->ob_size)
+   The :c:func:`Py_SET_SIZE` function must be used to set an object size.
 
 
 .. c:function:: void Py_SET_SIZE(PyVarObject *o, Py_ssize_t size)
@@ -259,10 +290,12 @@
    of :c:type:`PyObject*` values indicating the arguments and the third
    parameter is the number of arguments (the length of the array).
 
-   This is not part of the :ref:`limited API <stable>`.
-
    .. versionadded:: 3.7
 
+   .. versionchanged:: 3.10
+
+      ``METH_FASTCALL`` is now part of the stable ABI.
+
 
 .. data:: METH_FASTCALL | METH_KEYWORDS
 
@@ -436,6 +469,21 @@
           {NULL}  /* Sentinel */
       };
 
+
+.. c:function:: PyObject* PyMember_GetOne(const char *obj_addr, struct PyMemberDef *m)
+
+   Get an attribute belonging to the object at address *obj_addr*.  The
+   attribute is described by ``PyMemberDef`` *m*.  Returns ``NULL``
+   on error.
+
+
+.. c:function:: int PyMember_SetOne(char *obj_addr, struct PyMemberDef *m, PyObject *o)
+
+   Set an attribute belonging to the object at address *obj_addr* to object *o*.
+   The attribute to set is described by ``PyMemberDef`` *m*.  Returns ``0``
+   if successful and a negative value on failure.
+
+
 .. c:type:: PyGetSetDef
 
    Structure to define property-like access for a type. See also description of
diff --git a/Doc/c-api/sys.rst b/Doc/c-api/sys.rst
index 9ac9179..97717f5 100644
--- a/Doc/c-api/sys.rst
+++ b/Doc/c-api/sys.rst
@@ -118,22 +118,21 @@
 
 .. c:function:: wchar_t* Py_DecodeLocale(const char* arg, size_t *size)
 
-   Decode a byte string from the locale encoding with the :ref:`surrogateescape
-   error handler <surrogateescape>`: undecodable bytes are decoded as
-   characters in range U+DC80..U+DCFF. If a byte sequence can be decoded as a
-   surrogate character, escape the bytes using the surrogateescape error
-   handler instead of decoding them.
+   .. warning::
+      This function should not be called directly: use the :c:type:`PyConfig`
+      API with the :c:func:`PyConfig_SetBytesString` function which ensures
+      that :ref:`Python is preinitialized <c-preinit>`.
 
-   Encoding, highest priority to lowest priority:
+      This function must not be called before :ref:`Python is preinitialized
+      <c-preinit>` and so that the LC_CTYPE locale is properly configured: see
+      the :c:func:`Py_PreInitialize` function.
 
-   * ``UTF-8`` on macOS, Android, and VxWorks;
-   * ``UTF-8`` on Windows if :c:data:`Py_LegacyWindowsFSEncodingFlag` is zero;
-   * ``UTF-8`` if the Python UTF-8 mode is enabled;
-   * ``ASCII`` if the ``LC_CTYPE`` locale is ``"C"``,
-     ``nl_langinfo(CODESET)`` returns the ``ASCII`` encoding (or an alias),
-     and :c:func:`mbstowcs` and :c:func:`wcstombs` functions uses the
-     ``ISO-8859-1`` encoding.
-   * the current locale encoding.
+   Decode a byte string from the :term:`filesystem encoding and error handler`.
+   If the error handler is :ref:`surrogateescape error handler
+   <surrogateescape>`, undecodable bytes are decoded as characters in range
+   U+DC80..U+DCFF; and if a byte sequence can be decoded as a surrogate
+   character, the bytes are escaped using the surrogateescape error handler
+   instead of decoding them.
 
    Return a pointer to a newly allocated wide character string, use
    :c:func:`PyMem_RawFree` to free the memory. If size is not ``NULL``, write
@@ -143,6 +142,10 @@
    not ``NULL``, ``*size`` is set to ``(size_t)-1`` on memory error or set to
    ``(size_t)-2`` on decoding error.
 
+   The :term:`filesystem encoding and error handler` are selected by
+   :c:func:`PyConfig_Read`: see :c:member:`~PyConfig.filesystem_encoding` and
+   :c:member:`~PyConfig.filesystem_errors` members of :c:type:`PyConfig`.
+
    Decoding errors should never happen, unless there is a bug in the C
    library.
 
@@ -157,7 +160,8 @@
    .. versionadded:: 3.5
 
    .. versionchanged:: 3.7
-      The function now uses the UTF-8 encoding in the UTF-8 mode.
+      The function now uses the UTF-8 encoding in the :ref:`Python UTF-8 Mode
+      <utf8-mode>`.
 
    .. versionchanged:: 3.8
       The function now uses the UTF-8 encoding on Windows if
@@ -166,22 +170,10 @@
 
 .. c:function:: char* Py_EncodeLocale(const wchar_t *text, size_t *error_pos)
 
-   Encode a wide character string to the locale encoding with the
-   :ref:`surrogateescape error handler <surrogateescape>`: surrogate characters
-   in the range U+DC80..U+DCFF are converted to bytes 0x80..0xFF.
-
-   Encoding, highest priority to lowest priority:
-
-   * ``UTF-8`` on macOS, Android, and VxWorks;
-   * ``UTF-8`` on Windows if :c:data:`Py_LegacyWindowsFSEncodingFlag` is zero;
-   * ``UTF-8`` if the Python UTF-8 mode is enabled;
-   * ``ASCII`` if the ``LC_CTYPE`` locale is ``"C"``,
-     ``nl_langinfo(CODESET)`` returns the ``ASCII`` encoding (or an alias),
-     and :c:func:`mbstowcs` and :c:func:`wcstombs` functions uses the
-     ``ISO-8859-1`` encoding.
-   * the current locale encoding.
-
-   The function uses the UTF-8 encoding in the Python UTF-8 mode.
+   Encode a wide character string to the :term:`filesystem encoding and error
+   handler`. If the error handler is :ref:`surrogateescape error handler
+   <surrogateescape>`, surrogate characters in the range U+DC80..U+DCFF are
+   converted to bytes 0x80..0xFF.
 
    Return a pointer to a newly allocated byte string, use :c:func:`PyMem_Free`
    to free the memory. Return ``NULL`` on encoding error or memory allocation
@@ -190,9 +182,18 @@
    If error_pos is not ``NULL``, ``*error_pos`` is set to ``(size_t)-1`` on
    success,  or set to the index of the invalid character on encoding error.
 
+   The :term:`filesystem encoding and error handler` are selected by
+   :c:func:`PyConfig_Read`: see :c:member:`~PyConfig.filesystem_encoding` and
+   :c:member:`~PyConfig.filesystem_errors` members of :c:type:`PyConfig`.
+
    Use the :c:func:`Py_DecodeLocale` function to decode the bytes string back
    to a wide character string.
 
+   .. warning::
+      This function must not be called before :ref:`Python is preinitialized
+      <c-preinit>` and so that the LC_CTYPE locale is properly configured: see
+      the :c:func:`Py_PreInitialize` function.
+
    .. seealso::
 
       The :c:func:`PyUnicode_EncodeFSDefault` and
@@ -201,7 +202,8 @@
    .. versionadded:: 3.5
 
    .. versionchanged:: 3.7
-      The function now uses the UTF-8 encoding in the UTF-8 mode.
+      The function now uses the UTF-8 encoding in the :ref:`Python UTF-8 Mode
+      <utf8-mode>`.
 
    .. versionchanged:: 3.8
       The function now uses the UTF-8 encoding on Windows if
diff --git a/Doc/c-api/tuple.rst b/Doc/c-api/tuple.rst
index bf751e44..6919e61 100644
--- a/Doc/c-api/tuple.rst
+++ b/Doc/c-api/tuple.rst
@@ -21,14 +21,14 @@
 
 .. c:function:: int PyTuple_Check(PyObject *p)
 
-   Return true if *p* is a tuple object or an instance of a subtype of the tuple
-   type.
+   Return true if *p* is a tuple object or an instance of a subtype of the
+   tuple type.  This function always succeeds.
 
 
 .. c:function:: int PyTuple_CheckExact(PyObject *p)
 
    Return true if *p* is a tuple object, but not an instance of a subtype of the
-   tuple type.
+   tuple type.  This function always succeeds.
 
 
 .. c:function:: PyObject* PyTuple_New(Py_ssize_t len)
@@ -57,7 +57,7 @@
 .. c:function:: PyObject* PyTuple_GetItem(PyObject *p, Py_ssize_t pos)
 
    Return the object at position *pos* in the tuple pointed to by *p*.  If *pos* is
-   out of bounds, return ``NULL`` and set an :exc:`IndexError` exception.
+   negative or out of bounds, return ``NULL`` and set an :exc:`IndexError` exception.
 
 
 .. c:function:: PyObject* PyTuple_GET_ITEM(PyObject *p, Py_ssize_t pos)
diff --git a/Doc/c-api/type.rst b/Doc/c-api/type.rst
index 822360e..c472e8d 100644
--- a/Doc/c-api/type.rst
+++ b/Doc/c-api/type.rst
@@ -13,7 +13,7 @@
    The C structure of the objects used to describe built-in types.
 
 
-.. c:var:: PyObject* PyType_Type
+.. c:var:: PyTypeObject PyType_Type
 
    This is the type object for type objects; it is the same object as
    :class:`type` in the Python layer.
@@ -23,12 +23,14 @@
 
    Return non-zero if the object *o* is a type object, including instances of
    types derived from the standard type object.  Return 0 in all other cases.
+   This function always succeeds.
 
 
 .. c:function:: int PyType_CheckExact(PyObject *o)
 
-   Return non-zero if the object *o* is a type object, but not a subtype of the
-   standard type object.  Return 0 in all other cases.
+   Return non-zero if the object *o* is a type object, but not a subtype of
+   the standard type object.  Return 0 in all other cases.  This function
+   always succeeds.
 
 
 .. c:function:: unsigned int PyType_ClearCache()
@@ -95,6 +97,15 @@
    from a type's base class.  Return ``0`` on success, or return ``-1`` and sets an
    exception on error.
 
+   .. note::
+       If some of the base classes implements the GC protocol and the provided
+       type does not include the :const:`Py_TPFLAGS_HAVE_GC` in its flags, then
+       the GC protocol will be automatically implemented from its parents. On
+       the contrary, if the type being created does include
+       :const:`Py_TPFLAGS_HAVE_GC` in its flags then it **must** implement the
+       GC protocol itself by at least implementing the
+       :c:member:`~PyTypeObject.tp_traverse` handle.
+
 .. c:function:: void* PyType_GetSlot(PyTypeObject *type, int slot)
 
    Return the function pointer stored in the given slot. If the
@@ -105,10 +116,12 @@
 
    See :c:member:`PyType_Slot.slot` for possible values of the *slot* argument.
 
-   An exception is raised if *type* is not a heap type.
-
    .. versionadded:: 3.4
 
+   .. versionchanged:: 3.10
+      :c:func:`PyType_GetSlot` can now accept all types.
+      Previously, it was limited to :ref:`heap types <heap-types>`.
+
 .. c:function:: PyObject* PyType_GetModule(PyTypeObject *type)
 
    Return the module object associated with the given type when the type was
@@ -149,12 +162,11 @@
 
 .. c:function:: PyObject* PyType_FromModuleAndSpec(PyObject *module, PyType_Spec *spec, PyObject *bases)
 
-   Creates and returns a heap type object from the *spec*
+   Creates and returns a :ref:`heap type <heap-types>` from the *spec*
    (:const:`Py_TPFLAGS_HEAPTYPE`).
 
-   If *bases* is a tuple, the created heap type contains all types contained
-   in it as base types.
-
+   The *bases* argument can be used to specify base classes; it can either
+   be only one class or a tuple of classes.
    If *bases* is ``NULL``, the *Py_tp_bases* slot is used instead.
    If that also is ``NULL``, the *Py_tp_base* slot is used instead.
    If that also is ``NULL``, the new type derives from :class:`object`.
@@ -162,7 +174,7 @@
    The *module* argument can be used to record the module in which the new
    class is defined. It must be a module object or ``NULL``.
    If not ``NULL``, the module is associated with the new type and can later be
-   retreived with :c:func:`PyType_GetModule`.
+   retrieved with :c:func:`PyType_GetModule`.
    The associated module is not inherited by subclasses; it must be specified
    for each class individually.
 
@@ -170,6 +182,11 @@
 
    .. versionadded:: 3.9
 
+   .. versionchanged:: 3.10
+
+      The function now accepts a single class as the *bases* argument and
+      ``NULL`` as the ``tp_doc`` slot.
+
 .. c:function:: PyObject* PyType_FromSpecWithBases(PyType_Spec *spec, PyObject *bases)
 
    Equivalent to ``PyType_FromModuleAndSpec(NULL, spec, bases)``.
@@ -262,4 +279,4 @@
       The desired value of the slot. In most cases, this is a pointer
       to a function.
 
-      May not be ``NULL``.
+      Slots other than ``Py_tp_doc`` may not be ``NULL``.
diff --git a/Doc/c-api/typehints.rst b/Doc/c-api/typehints.rst
new file mode 100644
index 0000000..dfda96a
--- /dev/null
+++ b/Doc/c-api/typehints.rst
@@ -0,0 +1,47 @@
+.. highlight:: c
+
+.. _typehintobjects:
+
+Objects for Type Hinting
+------------------------
+
+Various built-in types for type hinting are provided.  Currently,
+two types exist -- :ref:`GenericAlias <types-genericalias>` and
+:ref:`Union <types-union>`.  Only ``GenericAlias`` is exposed to C.
+
+.. c:function:: PyObject* Py_GenericAlias(PyObject *origin, PyObject *args)
+
+   Create a :ref:`GenericAlias <types-genericalias>` object.
+   Equivalent to calling the Python class
+   :class:`types.GenericAlias`.  The *origin* and *args* arguments set the
+   ``GenericAlias``\ 's ``__origin__`` and ``__args__`` attributes respectively.
+   *origin* should be a :c:type:`PyTypeObject*`, and *args* can be a
+   :c:type:`PyTupleObject*` or any ``PyObject*``.  If *args* passed is
+   not a tuple, a 1-tuple is automatically constructed and ``__args__`` is set
+   to ``(args,)``.
+   Minimal checking is done for the arguments, so the function will succeed even
+   if *origin* is not a type.
+   The ``GenericAlias``\ 's ``__parameters__`` attribute is constructed lazily
+   from ``__args__``.  On failure, an exception is raised and ``NULL`` is
+   returned.
+
+   Here's an example of how to make an extension type generic::
+
+      ...
+      static PyMethodDef my_obj_methods[] = {
+          // Other methods.
+          ...
+          {"__class_getitem__", (PyCFunction)Py_GenericAlias, METH_O|METH_CLASS, "See PEP 585"}
+          ...
+      }
+
+   .. seealso:: The data model method :meth:`__class_getitem__`.
+
+   .. versionadded:: 3.9
+
+.. c:var:: PyTypeObject Py_GenericAliasType
+
+   The C type of the object returned by :c:func:`Py_GenericAlias`. Equivalent to
+   :class:`types.GenericAlias` in Python.
+
+   .. versionadded:: 3.9
diff --git a/Doc/c-api/typeobj.rst b/Doc/c-api/typeobj.rst
index ddcb8ae..9349220 100644
--- a/Doc/c-api/typeobj.rst
+++ b/Doc/c-api/typeobj.rst
@@ -189,136 +189,138 @@
 .. table::
    :widths: 26,17,12
 
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | Slot                                                    | :ref:`Type <slot-typedefs-table>` | special      |
-   |                                                         |                                   | methods      |
-   +=========================================================+===================================+==============+
-   | :c:member:`~PyAsyncMethods.am_await`                    | :c:type:`unaryfunc`               | __await__    |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyAsyncMethods.am_aiter`                    | :c:type:`unaryfunc`               | __aiter__    |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyAsyncMethods.am_anext`                    | :c:type:`unaryfunc`               | __anext__    |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   |                                                                                                            |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_add`                     | :c:type:`binaryfunc`              | __add__      |
-   |                                                         |                                   | __radd__     |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_inplace_add`             | :c:type:`binaryfunc`              | __iadd__     |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_subtract`                | :c:type:`binaryfunc`              | __sub__      |
-   |                                                         |                                   | __rsub__     |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_inplace_subtract`        | :c:type:`binaryfunc`              | __sub__      |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_multiply`                | :c:type:`binaryfunc`              | __mul__      |
-   |                                                         |                                   | __rmul__     |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_inplace_multiply`        | :c:type:`binaryfunc`              | __mul__      |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_remainder`               | :c:type:`binaryfunc`              | __mod__      |
-   |                                                         |                                   | __rmod__     |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_inplace_remainder`       | :c:type:`binaryfunc`              | __mod__      |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_divmod`                  | :c:type:`binaryfunc`              | __divmod__   |
-   |                                                         |                                   | __rdivmod__  |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_power`                   | :c:type:`ternaryfunc`             | __pow__      |
-   |                                                         |                                   | __rpow__     |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_inplace_power`           | :c:type:`ternaryfunc`             | __pow__      |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_negative`                | :c:type:`unaryfunc`               | __neg__      |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_positive`                | :c:type:`unaryfunc`               | __pos__      |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_absolute`                | :c:type:`unaryfunc`               | __abs__      |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_bool`                    | :c:type:`inquiry`                 | __bool__     |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_invert`                  | :c:type:`unaryfunc`               | __invert__   |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_lshift`                  | :c:type:`binaryfunc`              | __lshift__   |
-   |                                                         |                                   | __rlshift__  |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_inplace_lshift`          | :c:type:`binaryfunc`              | __lshift__   |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_rshift`                  | :c:type:`binaryfunc`              | __rshift__   |
-   |                                                         |                                   | __rrshift__  |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_inplace_rshift`          | :c:type:`binaryfunc`              | __rshift__   |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_and`                     | :c:type:`binaryfunc`              | __and__      |
-   |                                                         |                                   | __rand__     |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_inplace_and`             | :c:type:`binaryfunc`              | __and__      |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_xor`                     | :c:type:`binaryfunc`              | __xor__      |
-   |                                                         |                                   | __rxor__     |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_inplace_xor`             | :c:type:`binaryfunc`              | __xor__      |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_or`                      | :c:type:`binaryfunc`              | __or__       |
-   |                                                         |                                   | __ror__      |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_inplace_or`              | :c:type:`binaryfunc`              | __or__       |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_int`                     | :c:type:`unaryfunc`               | __int__      |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_reserved`                | void *                            |              |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_float`                   | :c:type:`unaryfunc`               | __float__    |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_floor_divide`            | :c:type:`binaryfunc`              | __floordiv__ |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_inplace_floor_divide`    | :c:type:`binaryfunc`              | __floordiv__ |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_true_divide`             | :c:type:`binaryfunc`              | __truediv__  |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_inplace_true_divide`     | :c:type:`binaryfunc`              | __truediv__  |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_index`                   | :c:type:`unaryfunc`               | __index__    |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_matrix_multiply`         | :c:type:`binaryfunc`              | __matmul__   |
-   |                                                         |                                   | __rmatmul__  |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyNumberMethods.nb_inplace_matrix_multiply` | :c:type:`binaryfunc`              | __matmul__   |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   |                                                                                                            |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyMappingMethods.mp_length`                 | :c:type:`lenfunc`                 | __len__      |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyMappingMethods.mp_subscript`              | :c:type:`binaryfunc`              | __getitem__  |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyMappingMethods.mp_ass_subscript`          | :c:type:`objobjargproc`           | __setitem__, |
-   |                                                         |                                   | __delitem__  |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   |                                                                                                            |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PySequenceMethods.sq_length`                | :c:type:`lenfunc`                 | __len__      |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PySequenceMethods.sq_concat`                | :c:type:`binaryfunc`              | __add__      |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PySequenceMethods.sq_repeat`                | :c:type:`ssizeargfunc`            | __mul__      |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PySequenceMethods.sq_item`                  | :c:type:`ssizeargfunc`            | __getitem__  |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PySequenceMethods.sq_ass_item`              | :c:type:`ssizeobjargproc`         | __setitem__  |
-   |                                                         |                                   | __delitem__  |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PySequenceMethods.sq_contains`              | :c:type:`objobjproc`              | __contains__ |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PySequenceMethods.sq_inplace_concat`        | :c:type:`binaryfunc`              | __iadd__     |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PySequenceMethods.sq_inplace_repeat`        | :c:type:`ssizeargfunc`            | __imul__     |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   |                                                                                                            |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyBufferProcs.bf_getbuffer`                 | :c:func:`getbufferproc`           |              |
-   +---------------------------------------------------------+-----------------------------------+--------------+
-   | :c:member:`~PyBufferProcs.bf_releasebuffer`             | :c:func:`releasebufferproc`       |              |
-   +---------------------------------------------------------+-----------------------------------+--------------+
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | Slot                                                    | :ref:`Type <slot-typedefs-table>` | special       |
+   |                                                         |                                   | methods       |
+   +=========================================================+===================================+===============+
+   | :c:member:`~PyAsyncMethods.am_await`                    | :c:type:`unaryfunc`               | __await__     |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyAsyncMethods.am_aiter`                    | :c:type:`unaryfunc`               | __aiter__     |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyAsyncMethods.am_anext`                    | :c:type:`unaryfunc`               | __anext__     |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyAsyncMethods.am_send`                     | :c:type:`sendfunc`                |               |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   |                                                                                                             |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_add`                     | :c:type:`binaryfunc`              | __add__       |
+   |                                                         |                                   | __radd__      |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_inplace_add`             | :c:type:`binaryfunc`              | __iadd__      |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_subtract`                | :c:type:`binaryfunc`              | __sub__       |
+   |                                                         |                                   | __rsub__      |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_inplace_subtract`        | :c:type:`binaryfunc`              | __isub__      |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_multiply`                | :c:type:`binaryfunc`              | __mul__       |
+   |                                                         |                                   | __rmul__      |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_inplace_multiply`        | :c:type:`binaryfunc`              | __imul__      |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_remainder`               | :c:type:`binaryfunc`              | __mod__       |
+   |                                                         |                                   | __rmod__      |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_inplace_remainder`       | :c:type:`binaryfunc`              | __imod__      |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_divmod`                  | :c:type:`binaryfunc`              | __divmod__    |
+   |                                                         |                                   | __rdivmod__   |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_power`                   | :c:type:`ternaryfunc`             | __pow__       |
+   |                                                         |                                   | __rpow__      |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_inplace_power`           | :c:type:`ternaryfunc`             | __ipow__      |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_negative`                | :c:type:`unaryfunc`               | __neg__       |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_positive`                | :c:type:`unaryfunc`               | __pos__       |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_absolute`                | :c:type:`unaryfunc`               | __abs__       |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_bool`                    | :c:type:`inquiry`                 | __bool__      |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_invert`                  | :c:type:`unaryfunc`               | __invert__    |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_lshift`                  | :c:type:`binaryfunc`              | __lshift__    |
+   |                                                         |                                   | __rlshift__   |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_inplace_lshift`          | :c:type:`binaryfunc`              | __ilshift__   |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_rshift`                  | :c:type:`binaryfunc`              | __rshift__    |
+   |                                                         |                                   | __rrshift__   |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_inplace_rshift`          | :c:type:`binaryfunc`              | __irshift__   |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_and`                     | :c:type:`binaryfunc`              | __and__       |
+   |                                                         |                                   | __rand__      |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_inplace_and`             | :c:type:`binaryfunc`              | __iand__      |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_xor`                     | :c:type:`binaryfunc`              | __xor__       |
+   |                                                         |                                   | __rxor__      |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_inplace_xor`             | :c:type:`binaryfunc`              | __ixor__      |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_or`                      | :c:type:`binaryfunc`              | __or__        |
+   |                                                         |                                   | __ror__       |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_inplace_or`              | :c:type:`binaryfunc`              | __ior__       |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_int`                     | :c:type:`unaryfunc`               | __int__       |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_reserved`                | void *                            |               |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_float`                   | :c:type:`unaryfunc`               | __float__     |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_floor_divide`            | :c:type:`binaryfunc`              | __floordiv__  |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_inplace_floor_divide`    | :c:type:`binaryfunc`              | __ifloordiv__ |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_true_divide`             | :c:type:`binaryfunc`              | __truediv__   |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_inplace_true_divide`     | :c:type:`binaryfunc`              | __itruediv__  |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_index`                   | :c:type:`unaryfunc`               | __index__     |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_matrix_multiply`         | :c:type:`binaryfunc`              | __matmul__    |
+   |                                                         |                                   | __rmatmul__   |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyNumberMethods.nb_inplace_matrix_multiply` | :c:type:`binaryfunc`              | __imatmul__   |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   |                                                                                                             |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyMappingMethods.mp_length`                 | :c:type:`lenfunc`                 | __len__       |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyMappingMethods.mp_subscript`              | :c:type:`binaryfunc`              | __getitem__   |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyMappingMethods.mp_ass_subscript`          | :c:type:`objobjargproc`           | __setitem__,  |
+   |                                                         |                                   | __delitem__   |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   |                                                                                                             |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PySequenceMethods.sq_length`                | :c:type:`lenfunc`                 | __len__       |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PySequenceMethods.sq_concat`                | :c:type:`binaryfunc`              | __add__       |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PySequenceMethods.sq_repeat`                | :c:type:`ssizeargfunc`            | __mul__       |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PySequenceMethods.sq_item`                  | :c:type:`ssizeargfunc`            | __getitem__   |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PySequenceMethods.sq_ass_item`              | :c:type:`ssizeobjargproc`         | __setitem__   |
+   |                                                         |                                   | __delitem__   |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PySequenceMethods.sq_contains`              | :c:type:`objobjproc`              | __contains__  |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PySequenceMethods.sq_inplace_concat`        | :c:type:`binaryfunc`              | __iadd__      |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PySequenceMethods.sq_inplace_repeat`        | :c:type:`ssizeargfunc`            | __imul__      |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   |                                                                                                             |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyBufferProcs.bf_getbuffer`                 | :c:func:`getbufferproc`           |               |
+   +---------------------------------------------------------+-----------------------------------+---------------+
+   | :c:member:`~PyBufferProcs.bf_releasebuffer`             | :c:func:`releasebufferproc`       |               |
+   +---------------------------------------------------------+-----------------------------------+---------------+
 
 .. _slot-typedefs-table:
 
@@ -474,36 +476,20 @@
 --------------
 
 The type object structure extends the :c:type:`PyVarObject` structure. The
-:attr:`ob_size` field is used for dynamic types (created by  :func:`type_new`,
+:attr:`ob_size` field is used for dynamic types (created by :func:`type_new`,
 usually called from a class statement). Note that :c:data:`PyType_Type` (the
 metatype) initializes :c:member:`~PyTypeObject.tp_itemsize`, which means that its instances (i.e.
 type objects) *must* have the :attr:`ob_size` field.
 
 
-.. c:member:: PyObject* PyObject._ob_next
-             PyObject* PyObject._ob_prev
-
-   These fields are only present when the macro ``Py_TRACE_REFS`` is defined.
-   Their initialization to ``NULL`` is taken care of by the ``PyObject_HEAD_INIT``
-   macro.  For statically allocated objects, these fields always remain ``NULL``.
-   For dynamically allocated objects, these two fields are used to link the object
-   into a doubly-linked list of *all* live objects on the heap.  This could be used
-   for various debugging purposes; currently the only use is to print the objects
-   that are still alive at the end of a run when the environment variable
-   :envvar:`PYTHONDUMPREFS` is set.
-
-   **Inheritance:**
-
-   These fields are not inherited by subtypes.
-
-
 .. c:member:: Py_ssize_t PyObject.ob_refcnt
 
    This is the type object's reference count, initialized to ``1`` by the
-   ``PyObject_HEAD_INIT`` macro.  Note that for statically allocated type objects,
-   the type's instances (objects whose :attr:`ob_type` points back to the type) do
-   *not* count as references.  But for dynamically allocated type objects, the
-   instances *do* count as references.
+   ``PyObject_HEAD_INIT`` macro.  Note that for :ref:`statically allocated type
+   objects <static-types>`, the type's instances (objects whose :attr:`ob_type`
+   points back to the type) do *not* count as references.  But for
+   :ref:`dynamically allocated type objects <heap-types>`, the instances *do*
+   count as references.
 
    **Inheritance:**
 
@@ -533,13 +519,36 @@
    This field is inherited by subtypes.
 
 
+.. c:member:: PyObject* PyObject._ob_next
+             PyObject* PyObject._ob_prev
+
+   These fields are only present when the macro ``Py_TRACE_REFS`` is defined
+   (see the :option:`configure --with-trace-refs option <--with-trace-refs>`).
+
+   Their initialization to ``NULL`` is taken care of by the
+   ``PyObject_HEAD_INIT`` macro.  For :ref:`statically allocated objects
+   <static-types>`, these fields always remain ``NULL``.  For :ref:`dynamically
+   allocated objects <heap-types>`, these two fields are used to link the
+   object into a doubly-linked list of *all* live objects on the heap.
+
+   This could be used for various debugging purposes; currently the only uses
+   are the :func:`sys.getobjects` function and to print the objects that are
+   still alive at the end of a run when the environment variable
+   :envvar:`PYTHONDUMPREFS` is set.
+
+   **Inheritance:**
+
+   These fields are not inherited by subtypes.
+
+
 PyVarObject Slots
 -----------------
 
 .. c:member:: Py_ssize_t PyVarObject.ob_size
 
-   For statically allocated type objects, this should be initialized to zero.  For
-   dynamically allocated type objects, this field has a special internal meaning.
+   For :ref:`statically allocated type objects <static-types>`, this should be
+   initialized to zero. For :ref:`dynamically allocated type objects
+   <heap-types>`, this field has a special internal meaning.
 
    **Inheritance:**
 
@@ -564,11 +573,13 @@
    :class:`T` defined in module :mod:`M` in subpackage :mod:`Q` in package :mod:`P`
    should have the :c:member:`~PyTypeObject.tp_name` initializer ``"P.Q.M.T"``.
 
-   For dynamically allocated type objects, this should just be the type name, and
+   For :ref:`dynamically allocated type objects <heap-types>`,
+   this should just be the type name, and
    the module name explicitly stored in the type dict as the value for key
    ``'__module__'``.
 
-   For statically allocated type objects, the tp_name field should contain a dot.
+   For :ref:`statically allocated type objects <static-types>`,
+   the *tp_name* field should contain a dot.
    Everything before the last dot is made accessible as the :attr:`__module__`
    attribute, and everything after the last dot is made accessible as the
    :attr:`~definition.__name__` attribute.
@@ -657,6 +668,18 @@
    :c:func:`PyObject_GC_Del` if the instance was allocated using
    :c:func:`PyObject_GC_New` or :c:func:`PyObject_GC_NewVar`.
 
+   If the type supports garbage collection (has the :const:`Py_TPFLAGS_HAVE_GC`
+   flag bit set), the destructor should call :c:func:`PyObject_GC_UnTrack`
+   before clearing any member fields.
+
+   .. code-block:: c
+
+     static void foo_dealloc(foo_object *self) {
+         PyObject_GC_UnTrack(self);
+         Py_CLEAR(self->ref);
+         Py_TYPE(self)->tp_free((PyObject *)self);
+     }
+
    Finally, if the type is heap allocated (:const:`Py_TPFLAGS_HEAPTYPE`), the
    deallocator should decrement the reference count for its type object after
    calling the type deallocator. In order to avoid dangling pointers, the
@@ -723,7 +746,7 @@
    always inherited. If it's not, then the subclass won't use
    :ref:`vectorcall <vectorcall>`, except when
    :c:func:`PyVectorcall_Call` is explicitly called.
-   This is in particular the case for `heap types`_
+   This is in particular the case for :ref:`heap types <heap-types>`
    (including subclasses defined in Python).
 
 
@@ -1086,8 +1109,7 @@
 
       This is a bitmask of all the bits that pertain to the existence of certain
       fields in the type object and its extension structures. Currently, it includes
-      the following bits: :const:`Py_TPFLAGS_HAVE_STACKLESS_EXTENSION`,
-      :const:`Py_TPFLAGS_HAVE_VERSION_TAG`.
+      the following bits: :const:`Py_TPFLAGS_HAVE_STACKLESS_EXTENSION`.
 
       **Inheritance:**
 
@@ -1114,7 +1136,7 @@
 
       **Inheritance:**
 
-      This flag is never inherited by heap types.
+      This flag is never inherited by :ref:`heap types <heap-types>`.
       For extension types, it is inherited whenever
       :c:member:`~PyTypeObject.tp_descr_get` is inherited.
 
@@ -1161,12 +1183,88 @@
 
       **Inheritance:**
 
-      This bit is inherited for *static* subtypes if
+      This bit is inherited for :ref:`static subtypes <static-types>` if
       :c:member:`~PyTypeObject.tp_call` is also inherited.
-      `Heap types`_ do not inherit ``Py_TPFLAGS_HAVE_VECTORCALL``.
+      :ref:`Heap types <heap-types>` do not inherit ``Py_TPFLAGS_HAVE_VECTORCALL``.
 
       .. versionadded:: 3.9
 
+   .. data:: Py_TPFLAGS_IMMUTABLETYPE
+
+      This bit is set for type objects that are immutable: type attributes cannot be set nor deleted.
+
+      :c:func:`PyType_Ready` automatically applies this flag to
+      :ref:`static types <static-types>`.
+
+      **Inheritance:**
+
+      This flag is not inherited.
+
+      .. versionadded:: 3.10
+
+   .. data:: Py_TPFLAGS_DISALLOW_INSTANTIATION
+
+      Disallow creating instances of the type: set
+      :c:member:`~PyTypeObject.tp_new` to NULL and don't create the ``__new__``
+      key in the type dictionary.
+
+      The flag must be set before creating the type, not after. For example, it
+      must be set before :c:func:`PyType_Ready` is called on the type.
+
+      The flag is set automatically on :ref:`static types <static-types>` if
+      :c:member:`~PyTypeObject.tp_base` is NULL or ``&PyBaseObject_Type`` and
+      :c:member:`~PyTypeObject.tp_new` is NULL.
+
+      **Inheritance:**
+
+      This flag is not inherited.
+
+      .. versionadded:: 3.10
+
+
+   .. data:: Py_TPFLAGS_MAPPING
+
+      This bit indicates that instances of the class may match mapping patterns
+      when used as the subject of a :keyword:`match` block. It is automatically
+      set when registering or subclassing :class:`collections.abc.Mapping`, and
+      unset when registering :class:`collections.abc.Sequence`.
+
+      .. note::
+
+         :const:`Py_TPFLAGS_MAPPING` and :const:`Py_TPFLAGS_SEQUENCE` are
+         mutually exclusive; it is an error to enable both flags simultaneously.
+
+      **Inheritance:**
+
+      This flag is inherited by types that do not already set
+      :const:`Py_TPFLAGS_SEQUENCE`.
+
+      .. seealso:: :pep:`634` -- Structural Pattern Matching: Specification
+
+      .. versionadded:: 3.10
+
+
+   .. data:: Py_TPFLAGS_SEQUENCE
+
+      This bit indicates that instances of the class may match sequence patterns
+      when used as the subject of a :keyword:`match` block. It is automatically
+      set when registering or subclassing :class:`collections.abc.Sequence`, and
+      unset when registering :class:`collections.abc.Mapping`.
+
+      .. note::
+
+         :const:`Py_TPFLAGS_MAPPING` and :const:`Py_TPFLAGS_SEQUENCE` are
+         mutually exclusive; it is an error to enable both flags simultaneously.
+
+      **Inheritance:**
+
+      This flag is inherited by types that do not already set
+      :const:`Py_TPFLAGS_MAPPING`.
+
+      .. seealso:: :pep:`634` -- Structural Pattern Matching: Specification
+
+      .. versionadded:: 3.10
+
 
 .. c:member:: const char* PyTypeObject.tp_doc
 
@@ -1213,8 +1311,9 @@
    :func:`~gc.get_referents` function will include it.
 
    .. warning::
-       When implementing :c:member:`~PyTypeObject.tp_traverse`, only the members
-       that the instance *owns* (by having strong references to them) must be
+       When implementing :c:member:`~PyTypeObject.tp_traverse`, only the
+       members that the instance *owns* (by having :term:`strong references
+       <strong reference>` to them) must be
        visited. For instance, if an object supports weak references via the
        :c:member:`~PyTypeObject.tp_weaklist` slot, the pointer supporting
        the linked list (what *tp_weaklist* points to) must **not** be
@@ -1227,9 +1326,8 @@
    :c:func:`local_traverse` to have these specific names; don't name them just
    anything.
 
-   Heap-allocated types (:const:`Py_TPFLAGS_HEAPTYPE`, such as those created
-   with :c:func:`PyType_FromSpec` and similar APIs) hold a reference to their
-   type. Their traversal function must therefore either visit
+   Instances of :ref:`heap-allocated types <heap-types>` hold a reference to
+   their type. Their traversal function must therefore either visit
    :c:func:`Py_TYPE(self) <Py_TYPE>`, or delegate this responsibility by
    calling ``tp_traverse`` of another heap-allocated type (such as a
    heap-allocated superclass).
@@ -1294,6 +1392,12 @@
    so that *self* knows the contained object can no longer be used.  The
    :c:func:`Py_CLEAR` macro performs the operations in a safe order.
 
+   Note that :c:member:`~PyTypeObject.tp_clear` is not *always* called
+   before an instance is deallocated. For example, when reference counting
+   is enough to determine that an object is no longer used, the cyclic garbage
+   collector is not involved and :c:member:`~PyTypeObject.tp_dealloc` is
+   called directly.
+
    Because the goal of :c:member:`~PyTypeObject.tp_clear` functions is to break reference cycles,
    it's not necessary to clear contained objects like Python strings or Python
    integers, which can't participate in reference cycles. On the other hand, it may
@@ -1416,9 +1520,9 @@
 
 .. c:member:: getiterfunc PyTypeObject.tp_iter
 
-   An optional pointer to a function that returns an iterator for the object.  Its
-   presence normally signals that the instances of this type are iterable (although
-   sequences may be iterable without this function).
+   An optional pointer to a function that returns an :term:`iterator` for the
+   object.  Its presence normally signals that the instances of this type are
+   :term:`iterable` (although sequences may be iterable without this function).
 
    This function has the same signature as :c:func:`PyObject_GetIter`::
 
@@ -1431,8 +1535,8 @@
 
 .. c:member:: iternextfunc PyTypeObject.tp_iternext
 
-   An optional pointer to a function that returns the next item in an iterator.
-   The signature is::
+   An optional pointer to a function that returns the next item in an
+   :term:`iterator`. The signature is::
 
       PyObject *tp_iternext(PyObject *self);
 
@@ -1644,8 +1748,8 @@
 
    **Default:**
 
-   This slot has no default.  For static types, if the field is
-   ``NULL`` then no :attr:`__dict__` gets created for instances.
+   This slot has no default.  For :ref:`static types <static-types>`, if the
+   field is ``NULL`` then no :attr:`__dict__` gets created for instances.
 
 
 .. c:member:: initproc PyTypeObject.tp_init
@@ -1680,7 +1784,7 @@
 
    **Default:**
 
-   For static types this field does not have a default.
+   For :ref:`static types <static-types>` this field does not have a default.
 
 
 .. c:member:: allocfunc PyTypeObject.tp_alloc
@@ -1729,16 +1833,20 @@
    in :c:member:`~PyTypeObject.tp_new`, while for mutable types, most initialization should be
    deferred to :c:member:`~PyTypeObject.tp_init`.
 
+   Set the :const:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag to disallow creating
+   instances of the type in Python.
+
    **Inheritance:**
 
-   This field is inherited by subtypes, except it is not inherited by static types
-   whose :c:member:`~PyTypeObject.tp_base` is ``NULL`` or ``&PyBaseObject_Type``.
+   This field is inherited by subtypes, except it is not inherited by
+   :ref:`static types <static-types>` whose :c:member:`~PyTypeObject.tp_base`
+   is ``NULL`` or ``&PyBaseObject_Type``.
 
    **Default:**
 
-   For static types this field has no default.  This means if the
-   slot is defined as ``NULL``, the type cannot be called to create new
-   instances; presumably there is some other way to create
+   For :ref:`static types <static-types>` this field has no default.
+   This means if the slot is defined as ``NULL``, the type cannot be called
+   to create new instances; presumably there is some other way to create
    instances, like a factory function.
 
 
@@ -1780,7 +1888,7 @@
 
    (The only example of this are types themselves.  The metatype,
    :c:data:`PyType_Type`, defines this function to distinguish between statically
-   and dynamically allocated types.)
+   and :ref:`dynamically allocated types <heap-types>`.)
 
    **Inheritance:**
 
@@ -1891,6 +1999,17 @@
    For this field to be taken into account (even through inheritance),
    you must also set the :const:`Py_TPFLAGS_HAVE_FINALIZE` flags bit.
 
+   Also, note that, in a garbage collected Python,
+   :c:member:`~PyTypeObject.tp_dealloc` may be called from
+   any Python thread, not just the thread which created the object (if the object
+   becomes part of a refcount cycle, that cycle might be collected by a garbage
+   collection on any thread).  This is not a problem for Python API calls, since
+   the thread on which tp_dealloc is called will own the Global Interpreter Lock
+   (GIL). However, if the object being destroyed in turn destroys objects from some
+   other C or C++ library, care should be taken to ensure that destroying those
+   objects on the thread which called tp_dealloc will not violate any assumptions
+   of the library.
+
    **Inheritance:**
 
    This field is inherited by subtypes.
@@ -1915,21 +2034,10 @@
    .. versionadded:: 3.9 (the field exists since 3.8 but it's only used since 3.9)
 
 
-Also, note that, in a garbage collected Python, :c:member:`~PyTypeObject.tp_dealloc` may be called from
-any Python thread, not just the thread which created the object (if the object
-becomes part of a refcount cycle, that cycle might be collected by a garbage
-collection on any thread).  This is not a problem for Python API calls, since
-the thread on which tp_dealloc is called will own the Global Interpreter Lock
-(GIL). However, if the object being destroyed in turn destroys objects from some
-other C or C++ library, care should be taken to ensure that destroying those
-objects on the thread which called tp_dealloc will not violate any assumptions
-of the library.
+.. _static-types:
 
-
-.. _heap-types:
-
-Heap Types
-----------
+Static Types
+------------
 
 Traditionally, types defined in C code are *static*, that is,
 a static :c:type:`PyTypeObject` structure is defined directly in code
@@ -1949,12 +2057,20 @@
 any extension modules using static types must be compiled for a specific
 Python minor version.
 
-An alternative to static types is *heap-allocated types*, or *heap types*
-for short, which correspond closely to classes created by Python's
-``class`` statement.
+
+.. _heap-types:
+
+Heap Types
+----------
+
+An alternative to :ref:`static types <static-types>` is *heap-allocated types*,
+or *heap types* for short, which correspond closely to classes created by
+Python's ``class`` statement. Heap types have the :const:`Py_TPFLAGS_HEAPTYPE`
+flag set.
 
 This is done by filling a :c:type:`PyType_Spec` structure and calling
-:c:func:`PyType_FromSpecWithBases`.
+:c:func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases`,
+or :c:func:`PyType_FromModuleAndSpec`.
 
 
 .. _number-structs:
@@ -2303,6 +2419,7 @@
             unaryfunc am_await;
             unaryfunc am_aiter;
             unaryfunc am_anext;
+            sendfunc am_send;
         } PyAsyncMethods;
 
 .. c:member:: unaryfunc PyAsyncMethods.am_await
@@ -2311,8 +2428,8 @@
 
       PyObject *am_await(PyObject *self);
 
-   The returned object must be an iterator, i.e. :c:func:`PyIter_Check` must
-   return ``1`` for it.
+   The returned object must be an :term:`iterator`, i.e. :c:func:`PyIter_Check`
+   must return ``1`` for it.
 
    This slot may be set to ``NULL`` if an object is not an :term:`awaitable`.
 
@@ -2322,7 +2439,8 @@
 
       PyObject *am_aiter(PyObject *self);
 
-   Must return an :term:`awaitable` object.  See :meth:`__anext__` for details.
+   Must return an :term:`asynchronous iterator` object.
+   See :meth:`__anext__` for details.
 
    This slot may be set to ``NULL`` if an object does not implement
    asynchronous iteration protocol.
@@ -2336,6 +2454,17 @@
    Must return an :term:`awaitable` object.  See :meth:`__anext__` for details.
    This slot may be set to ``NULL``.
 
+.. c:member:: sendfunc PyAsyncMethods.am_send
+
+   The signature of this function is::
+
+      PySendResult am_send(PyObject *self, PyObject *arg, PyObject **result);
+
+   See :c:func:`PyIter_Send` for details.
+   This slot may be set to ``NULL``.
+
+   .. versionadded:: 3.10
+
 
 .. _slot-typedefs:
 
@@ -2431,6 +2560,10 @@
 
 .. c:type:: PyObject *(*binaryfunc)(PyObject *, PyObject *)
 
+.. c:type:: PySendResult (*sendfunc)(PyObject *, PyObject *, PyObject **)
+
+   See :c:member:`~PyAsyncMethods.am_send`.
+
 .. c:type:: PyObject *(*ternaryfunc)(PyObject *, PyObject *, PyObject *)
 
 .. c:type:: PyObject *(*ssizeargfunc)(PyObject *, Py_ssize_t)
@@ -2452,7 +2585,7 @@
 cases.  For more examples, practical info, and a tutorial, see
 :ref:`defining-new-types` and :ref:`new-types-topics`.
 
-A basic static type::
+A basic :ref:`static type <static-types>`::
 
    typedef struct {
        PyObject_HEAD
@@ -2541,7 +2674,8 @@
    };
 
 A str subclass that cannot be subclassed and cannot be called
-to create instances (e.g. uses a separate factory func)::
+to create instances (e.g. uses a separate factory func) using
+:c:data:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag::
 
    typedef struct {
        PyUnicodeObject raw;
@@ -2554,12 +2688,11 @@
        .tp_basicsize = sizeof(MyStr),
        .tp_base = NULL,  // set to &PyUnicode_Type in module init
        .tp_doc = "my custom str",
-       .tp_flags = Py_TPFLAGS_DEFAULT,
-       .tp_new = NULL,
+       .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION,
        .tp_repr = (reprfunc)myobj_repr,
    };
 
-The simplest static type (with fixed-length instances)::
+The simplest :ref:`static type <static-types>` with fixed-length instances::
 
    typedef struct {
        PyObject_HEAD
@@ -2570,7 +2703,7 @@
        .tp_name = "mymod.MyObject",
    };
 
-The simplest static type (with variable-length instances)::
+The simplest :ref:`static type <static-types>` with variable-length instances::
 
    typedef struct {
        PyObject_VAR_HEAD
diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst
index 8a312ae..a08cebc 100644
--- a/Doc/c-api/unicode.rst
+++ b/Doc/c-api/unicode.rst
@@ -19,8 +19,7 @@
 
 :c:type:`Py_UNICODE*` and UTF-8 representations are created on demand and cached
 in the Unicode object.  The :c:type:`Py_UNICODE*` representation is deprecated
-and inefficient; it should be avoided in performance- or memory-sensitive
-situations.
+and inefficient.
 
 Due to the transition between the old APIs and the new APIs, Unicode objects
 can internally be in two states depending on how they were created:
@@ -91,13 +90,13 @@
 .. c:function:: int PyUnicode_Check(PyObject *o)
 
    Return true if the object *o* is a Unicode object or an instance of a Unicode
-   subtype.
+   subtype.  This function always succeeds.
 
 
 .. c:function:: int PyUnicode_CheckExact(PyObject *o)
 
    Return true if the object *o* is a Unicode object, but not an instance of a
-   subtype.
+   subtype.  This function always succeeds.
 
 
 .. c:function:: int PyUnicode_READY(PyObject *o)
@@ -150,7 +149,7 @@
       ``PyUnicode_WCHAR_KIND`` is deprecated.
 
 
-.. c:function:: int PyUnicode_KIND(PyObject *o)
+.. c:function:: unsigned int PyUnicode_KIND(PyObject *o)
 
    Return one of the PyUnicode kind constants (see above) that indicate how many
    bytes per character this Unicode object uses to store its data.  *o* has to
@@ -269,57 +268,57 @@
 the Python configuration.
 
 
-.. c:function:: int Py_UNICODE_ISSPACE(Py_UNICODE ch)
+.. c:function:: int Py_UNICODE_ISSPACE(Py_UCS4 ch)
 
    Return ``1`` or ``0`` depending on whether *ch* is a whitespace character.
 
 
-.. c:function:: int Py_UNICODE_ISLOWER(Py_UNICODE ch)
+.. c:function:: int Py_UNICODE_ISLOWER(Py_UCS4 ch)
 
    Return ``1`` or ``0`` depending on whether *ch* is a lowercase character.
 
 
-.. c:function:: int Py_UNICODE_ISUPPER(Py_UNICODE ch)
+.. c:function:: int Py_UNICODE_ISUPPER(Py_UCS4 ch)
 
    Return ``1`` or ``0`` depending on whether *ch* is an uppercase character.
 
 
-.. c:function:: int Py_UNICODE_ISTITLE(Py_UNICODE ch)
+.. c:function:: int Py_UNICODE_ISTITLE(Py_UCS4 ch)
 
    Return ``1`` or ``0`` depending on whether *ch* is a titlecase character.
 
 
-.. c:function:: int Py_UNICODE_ISLINEBREAK(Py_UNICODE ch)
+.. c:function:: int Py_UNICODE_ISLINEBREAK(Py_UCS4 ch)
 
    Return ``1`` or ``0`` depending on whether *ch* is a linebreak character.
 
 
-.. c:function:: int Py_UNICODE_ISDECIMAL(Py_UNICODE ch)
+.. c:function:: int Py_UNICODE_ISDECIMAL(Py_UCS4 ch)
 
    Return ``1`` or ``0`` depending on whether *ch* is a decimal character.
 
 
-.. c:function:: int Py_UNICODE_ISDIGIT(Py_UNICODE ch)
+.. c:function:: int Py_UNICODE_ISDIGIT(Py_UCS4 ch)
 
    Return ``1`` or ``0`` depending on whether *ch* is a digit character.
 
 
-.. c:function:: int Py_UNICODE_ISNUMERIC(Py_UNICODE ch)
+.. c:function:: int Py_UNICODE_ISNUMERIC(Py_UCS4 ch)
 
    Return ``1`` or ``0`` depending on whether *ch* is a numeric character.
 
 
-.. c:function:: int Py_UNICODE_ISALPHA(Py_UNICODE ch)
+.. c:function:: int Py_UNICODE_ISALPHA(Py_UCS4 ch)
 
    Return ``1`` or ``0`` depending on whether *ch* is an alphabetic character.
 
 
-.. c:function:: int Py_UNICODE_ISALNUM(Py_UNICODE ch)
+.. c:function:: int Py_UNICODE_ISALNUM(Py_UCS4 ch)
 
    Return ``1`` or ``0`` depending on whether *ch* is an alphanumeric character.
 
 
-.. c:function:: int Py_UNICODE_ISPRINTABLE(Py_UNICODE ch)
+.. c:function:: int Py_UNICODE_ISPRINTABLE(Py_UCS4 ch)
 
    Return ``1`` or ``0`` depending on whether *ch* is a printable character.
    Nonprintable characters are those characters defined in the Unicode character
@@ -333,7 +332,7 @@
 These APIs can be used for fast direct character conversions:
 
 
-.. c:function:: Py_UNICODE Py_UNICODE_TOLOWER(Py_UNICODE ch)
+.. c:function:: Py_UCS4 Py_UNICODE_TOLOWER(Py_UCS4 ch)
 
    Return the character *ch* converted to lower case.
 
@@ -341,7 +340,7 @@
       This function uses simple case mappings.
 
 
-.. c:function:: Py_UNICODE Py_UNICODE_TOUPPER(Py_UNICODE ch)
+.. c:function:: Py_UCS4 Py_UNICODE_TOUPPER(Py_UCS4 ch)
 
    Return the character *ch* converted to upper case.
 
@@ -349,7 +348,7 @@
       This function uses simple case mappings.
 
 
-.. c:function:: Py_UNICODE Py_UNICODE_TOTITLE(Py_UNICODE ch)
+.. c:function:: Py_UCS4 Py_UNICODE_TOTITLE(Py_UCS4 ch)
 
    Return the character *ch* converted to title case.
 
@@ -357,19 +356,19 @@
       This function uses simple case mappings.
 
 
-.. c:function:: int Py_UNICODE_TODECIMAL(Py_UNICODE ch)
+.. c:function:: int Py_UNICODE_TODECIMAL(Py_UCS4 ch)
 
    Return the character *ch* converted to a decimal positive integer.  Return
    ``-1`` if this is not possible.  This macro does not raise exceptions.
 
 
-.. c:function:: int Py_UNICODE_TODIGIT(Py_UNICODE ch)
+.. c:function:: int Py_UNICODE_TODIGIT(Py_UCS4 ch)
 
    Return the character *ch* converted to a single digit integer. Return ``-1`` if
    this is not possible.  This macro does not raise exceptions.
 
 
-.. c:function:: double Py_UNICODE_TONUMERIC(Py_UNICODE ch)
+.. c:function:: double Py_UNICODE_TONUMERIC(Py_UCS4 ch)
 
    Return the character *ch* converted to a double. Return ``-1.0`` if this is not
    possible.  This macro does not raise exceptions.
@@ -434,7 +433,7 @@
 
    If *u* is ``NULL``, this function behaves like :c:func:`PyUnicode_FromUnicode`
    with the buffer set to ``NULL``.  This usage is deprecated in favor of
-   :c:func:`PyUnicode_New`.
+   :c:func:`PyUnicode_New`, and will be removed in Python 3.12.
 
 
 .. c:function:: PyObject *PyUnicode_FromString(const char *u)
@@ -676,7 +675,7 @@
 Deprecated Py_UNICODE APIs
 """"""""""""""""""""""""""
 
-.. deprecated-removed:: 3.3 4.0
+.. deprecated-removed:: 3.3 3.12
 
 These API functions are deprecated with the implementation of :pep:`393`.
 Extension modules can continue using them, as they will not be removed in Python
@@ -719,8 +718,6 @@
       :c:func:`PyUnicode_AsUCS4`, :c:func:`PyUnicode_AsWideChar`,
       :c:func:`PyUnicode_ReadChar` or similar new APIs.
 
-   .. deprecated-removed:: 3.3 3.10
-
 
 .. c:function:: PyObject* PyUnicode_TransformDecimalToASCII(Py_UNICODE *s, Py_ssize_t size)
 
@@ -728,6 +725,10 @@
    :c:type:`Py_UNICODE` buffer of the given *size* by ASCII digits 0--9
    according to their decimal value.  Return ``NULL`` if an exception occurs.
 
+   .. deprecated-removed:: 3.3 3.11
+      Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
+      :c:func:`Py_UNICODE_TODECIMAL`.
+
 
 .. c:function:: Py_UNICODE* PyUnicode_AsUnicodeAndSize(PyObject *unicode, Py_ssize_t *size)
 
@@ -745,20 +746,6 @@
       :c:func:`PyUnicode_ReadChar` or similar new APIs.
 
 
-.. c:function:: Py_UNICODE* PyUnicode_AsUnicodeCopy(PyObject *unicode)
-
-   Create a copy of a Unicode string ending with a null code point. Return ``NULL``
-   and raise a :exc:`MemoryError` exception on memory allocation failure,
-   otherwise return a new allocated buffer (use :c:func:`PyMem_Free` to free
-   the buffer). Note that the resulting :c:type:`Py_UNICODE*` string may
-   contain embedded null code points, which would cause the string to be
-   truncated when used in most C functions.
-
-   .. versionadded:: 3.2
-
-   Please migrate to using :c:func:`PyUnicode_AsUCS4Copy` or similar new APIs.
-
-
 .. c:function:: Py_ssize_t PyUnicode_GetSize(PyObject *unicode)
 
    Return the size of the deprecated :c:type:`Py_UNICODE` representation, in
@@ -799,7 +786,7 @@
    :c:data:`Py_FileSystemDefaultEncoding` (the locale encoding read at
    Python startup).
 
-   This function ignores the Python UTF-8 mode.
+   This function ignores the :ref:`Python UTF-8 Mode <utf8-mode>`.
 
    .. seealso::
 
@@ -835,7 +822,7 @@
    :c:data:`Py_FileSystemDefaultEncoding` (the locale encoding read at
    Python startup).
 
-   This function ignores the Python UTF-8 mode.
+   This function ignores the :ref:`Python UTF-8 Mode <utf8-mode>`.
 
    .. seealso::
 
@@ -894,8 +881,7 @@
 
 .. c:function:: PyObject* PyUnicode_DecodeFSDefaultAndSize(const char *s, Py_ssize_t size)
 
-   Decode a string using :c:data:`Py_FileSystemDefaultEncoding` and the
-   :c:data:`Py_FileSystemDefaultEncodeErrors` error handler.
+   Decode a string from the :term:`filesystem encoding and error handler`.
 
    If :c:data:`Py_FileSystemDefaultEncoding` is not set, fall back to the
    locale encoding.
@@ -915,8 +901,8 @@
 
 .. c:function:: PyObject* PyUnicode_DecodeFSDefault(const char *s)
 
-   Decode a null-terminated string using :c:data:`Py_FileSystemDefaultEncoding`
-   and the :c:data:`Py_FileSystemDefaultEncodeErrors` error handler.
+   Decode a null-terminated string from the :term:`filesystem encoding and
+   error handler`.
 
    If :c:data:`Py_FileSystemDefaultEncoding` is not set, fall back to the
    locale encoding.
@@ -1022,7 +1008,7 @@
 the default handling defined for the codec.  Default error handling for all
 built-in codecs is "strict" (:exc:`ValueError` is raised).
 
-The codecs all use a similar interface.  Only deviation from the following
+The codecs all use a similar interface.  Only deviations from the following
 generic ones are documented for simplicity.
 
 
@@ -1061,7 +1047,7 @@
    to be used is looked up using the Python codec registry.  Return ``NULL`` if an
    exception was raised by the codec.
 
-   .. deprecated-removed:: 3.3 4.0
+   .. deprecated-removed:: 3.3 3.11
       Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
       :c:func:`PyUnicode_AsEncodedString`.
 
@@ -1114,6 +1100,9 @@
    .. versionchanged:: 3.7
       The return type is now ``const char *`` rather of ``char *``.
 
+   .. versionchanged:: 3.10
+      This function is a part of the :ref:`limited API <stable>`.
+
 
 .. c:function:: const char* PyUnicode_AsUTF8(PyObject *unicode)
 
@@ -1131,7 +1120,7 @@
    return a Python bytes object.  Return ``NULL`` if an exception was raised by
    the codec.
 
-   .. deprecated-removed:: 3.3 4.0
+   .. deprecated-removed:: 3.3 3.11
       Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
       :c:func:`PyUnicode_AsUTF8String`, :c:func:`PyUnicode_AsUTF8AndSize` or
       :c:func:`PyUnicode_AsEncodedString`.
@@ -1205,7 +1194,7 @@
 
    Return ``NULL`` if an exception was raised by the codec.
 
-   .. deprecated-removed:: 3.3 4.0
+   .. deprecated-removed:: 3.3 3.11
       Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
       :c:func:`PyUnicode_AsUTF32String` or :c:func:`PyUnicode_AsEncodedString`.
 
@@ -1236,7 +1225,7 @@
    ``1``, any byte order mark is copied to the output (where it will result in
    either a ``\ufeff`` or a ``\ufffe`` character).
 
-   After completion, *\*byteorder* is set to the current byte order at the end
+   After completion, ``*byteorder`` is set to the current byte order at the end
    of input data.
 
    If *byteorder* is ``NULL``, the codec starts in native order mode.
@@ -1280,7 +1269,7 @@
 
    Return ``NULL`` if an exception was raised by the codec.
 
-   .. deprecated-removed:: 3.3 4.0
+   .. deprecated-removed:: 3.3 3.11
       Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
       :c:func:`PyUnicode_AsUTF16String` or :c:func:`PyUnicode_AsEncodedString`.
 
@@ -1318,7 +1307,7 @@
    nonzero, whitespace will be encoded in base-64.  Both are set to zero for the
    Python "utf-7" codec.
 
-   .. deprecated-removed:: 3.3 4.0
+   .. deprecated-removed:: 3.3 3.11
       Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
       :c:func:`PyUnicode_AsEncodedString`.
 
@@ -1348,7 +1337,7 @@
    Encode the :c:type:`Py_UNICODE` buffer of the given *size* using Unicode-Escape and
    return a bytes object.  Return ``NULL`` if an exception was raised by the codec.
 
-   .. deprecated-removed:: 3.3 4.0
+   .. deprecated-removed:: 3.3 3.11
       Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
       :c:func:`PyUnicode_AsUnicodeEscapeString`.
 
@@ -1379,7 +1368,7 @@
    Encode the :c:type:`Py_UNICODE` buffer of the given *size* using Raw-Unicode-Escape
    and return a bytes object.  Return ``NULL`` if an exception was raised by the codec.
 
-   .. deprecated-removed:: 3.3 4.0
+   .. deprecated-removed:: 3.3 3.11
       Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
       :c:func:`PyUnicode_AsRawUnicodeEscapeString` or
       :c:func:`PyUnicode_AsEncodedString`.
@@ -1411,7 +1400,7 @@
    return a Python bytes object.  Return ``NULL`` if an exception was raised by
    the codec.
 
-   .. deprecated-removed:: 3.3 4.0
+   .. deprecated-removed:: 3.3 3.11
       Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
       :c:func:`PyUnicode_AsLatin1String` or
       :c:func:`PyUnicode_AsEncodedString`.
@@ -1443,7 +1432,7 @@
    return a Python bytes object.  Return ``NULL`` if an exception was raised by
    the codec.
 
-   .. deprecated-removed:: 3.3 4.0
+   .. deprecated-removed:: 3.3 3.11
       Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
       :c:func:`PyUnicode_AsASCIIString` or
       :c:func:`PyUnicode_AsEncodedString`.
@@ -1454,7 +1443,7 @@
 
 This codec is special in that it can be used to implement many different codecs
 (and this is in fact what was done to obtain most of the standard codecs
-included in the :mod:`encodings` package). The codec uses mapping to encode and
+included in the :mod:`encodings` package). The codec uses mappings to encode and
 decode characters.  The mapping objects provided must support the
 :meth:`__getitem__` mapping interface; dictionaries and sequences work well.
 
@@ -1495,7 +1484,7 @@
    *mapping* object and return the result as a bytes object.  Return ``NULL`` if
    an exception was raised by the codec.
 
-   .. deprecated-removed:: 3.3 4.0
+   .. deprecated-removed:: 3.3 3.11
       Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
       :c:func:`PyUnicode_AsCharmapString` or
       :c:func:`PyUnicode_AsEncodedString`.
@@ -1527,7 +1516,7 @@
    character *mapping* table to it and return the resulting Unicode object.
    Return ``NULL`` when an exception was raised by the codec.
 
-   .. deprecated-removed:: 3.3 4.0
+   .. deprecated-removed:: 3.3 3.11
       Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
       :c:func:`PyUnicode_Translate`. or :ref:`generic codec based API
       <codec-registry>`
@@ -1616,7 +1605,7 @@
 .. c:function:: PyObject* PyUnicode_Splitlines(PyObject *s, int keepend)
 
    Split a Unicode string at line breaks, returning a list of Unicode strings.
-   CRLF is considered to be one line break.  If *keepend* is ``0``, the Line break
+   CRLF is considered to be one line break.  If *keepend* is ``0``, the line break
    characters are not included in the resulting strings.
 
 
diff --git a/Doc/c-api/veryhigh.rst b/Doc/c-api/veryhigh.rst
index 551846e..5b8735d 100644
--- a/Doc/c-api/veryhigh.rst
+++ b/Doc/c-api/veryhigh.rst
@@ -75,6 +75,8 @@
    :c:func:`PyRun_SimpleFile`.  *filename* is decoded from the filesystem
    encoding (:func:`sys.getfilesystemencoding`).  If *filename* is ``NULL``, this
    function uses ``"???"`` as the filename.
+   If *closeit* is true, the file is closed before
+   ``PyRun_SimpleFileExFlags()`` returns.
 
 
 .. c:function:: int PyRun_SimpleString(const char *command)
@@ -112,9 +114,9 @@
 
    Similar to :c:func:`PyRun_SimpleStringFlags`, but the Python source code is read
    from *fp* instead of an in-memory string. *filename* should be the name of
-   the file, it is decoded from the filesystem encoding
-   (:func:`sys.getfilesystemencoding`).  If *closeit* is true, the file is
-   closed before PyRun_SimpleFileExFlags returns.
+   the file, it is decoded from :term:`filesystem encoding and error handler`.
+   If *closeit* is true, the file is closed before
+   ``PyRun_SimpleFileExFlags()`` returns.
 
    .. note::
       On Windows, *fp* should be opened as binary mode (e.g. ``fopen(filename, "rb")``).
@@ -132,7 +134,7 @@
    Read and execute a single statement from a file associated with an
    interactive device according to the *flags* argument.  The user will be
    prompted using ``sys.ps1`` and ``sys.ps2``.  *filename* is decoded from the
-   filesystem encoding (:func:`sys.getfilesystemencoding`).
+   :term:`filesystem encoding and error handler`.
 
    Returns ``0`` when the input was
    executed successfully, ``-1`` if there was an exception, or an error code
@@ -151,9 +153,8 @@
 
    Read and execute statements from a file associated with an interactive device
    until EOF is reached.  The user will be prompted using ``sys.ps1`` and
-   ``sys.ps2``.  *filename* is decoded from the filesystem encoding
-   (:func:`sys.getfilesystemencoding`).  Returns ``0`` at EOF or a negative
-   number upon failure.
+   ``sys.ps2``.  *filename* is decoded from the :term:`filesystem encoding and
+   error handler`.  Returns ``0`` at EOF or a negative number upon failure.
 
 
 .. c:var:: int (*PyOS_InputHook)(void)
@@ -186,52 +187,6 @@
       :c:func:`PyMem_RawRealloc`, instead of being allocated by
       :c:func:`PyMem_Malloc` or :c:func:`PyMem_Realloc`.
 
-
-.. c:function:: struct _node* PyParser_SimpleParseString(const char *str, int start)
-
-   This is a simplified interface to
-   :c:func:`PyParser_SimpleParseStringFlagsFilename` below, leaving  *filename* set
-   to ``NULL`` and *flags* set to ``0``.
-
-   .. deprecated-removed:: 3.9 3.10
-
-
-.. c:function:: struct _node* PyParser_SimpleParseStringFlags( const char *str, int start, int flags)
-
-   This is a simplified interface to
-   :c:func:`PyParser_SimpleParseStringFlagsFilename` below, leaving  *filename* set
-   to ``NULL``.
-
-   .. deprecated-removed:: 3.9 3.10
-
-
-.. c:function:: struct _node* PyParser_SimpleParseStringFlagsFilename( const char *str, const char *filename, int start, int flags)
-
-   Parse Python source code from *str* using the start token *start* according to
-   the *flags* argument.  The result can be used to create a code object which can
-   be evaluated efficiently. This is useful if a code fragment must be evaluated
-   many times. *filename* is decoded from the filesystem encoding
-   (:func:`sys.getfilesystemencoding`).
-
-   .. deprecated-removed:: 3.9 3.10
-
-
-.. c:function:: struct _node* PyParser_SimpleParseFile(FILE *fp, const char *filename, int start)
-
-   This is a simplified interface to :c:func:`PyParser_SimpleParseFileFlags` below,
-   leaving *flags* set to ``0``.
-
-   .. deprecated-removed:: 3.9 3.10
-
-
-.. c:function:: struct _node* PyParser_SimpleParseFileFlags(FILE *fp, const char *filename, int start, int flags)
-
-   Similar to :c:func:`PyParser_SimpleParseStringFlagsFilename`, but the Python
-   source code is read from *fp* instead of an in-memory string.
-
-   .. deprecated-removed:: 3.9 3.10
-
-
 .. c:function:: PyObject* PyRun_String(const char *str, int start, PyObject *globals, PyObject *locals)
 
    This is a simplified interface to :c:func:`PyRun_StringFlags` below, leaving
@@ -272,7 +227,7 @@
 
    Similar to :c:func:`PyRun_StringFlags`, but the Python source code is read from
    *fp* instead of an in-memory string. *filename* should be the name of the file,
-   it is decoded from the filesystem encoding (:func:`sys.getfilesystemencoding`).
+   it is decoded from the :term:`filesystem encoding and error handler`.
    If *closeit* is true, the file is closed before :c:func:`PyRun_FileExFlags`
    returns.
 
@@ -311,7 +266,7 @@
 .. c:function:: PyObject* Py_CompileStringExFlags(const char *str, const char *filename, int start, PyCompilerFlags *flags, int optimize)
 
    Like :c:func:`Py_CompileStringObject`, but *filename* is a byte string
-   decoded from the filesystem encoding (:func:`os.fsdecode`).
+   decoded from the :term:`filesystem encoding and error handler`.
 
    .. versionadded:: 3.2
 
diff --git a/Doc/c-api/weakref.rst b/Doc/c-api/weakref.rst
index e3a9bda..98ebe71 100644
--- a/Doc/c-api/weakref.rst
+++ b/Doc/c-api/weakref.rst
@@ -13,17 +13,18 @@
 
 .. c:function:: int PyWeakref_Check(ob)
 
-   Return true if *ob* is either a reference or proxy object.
+   Return true if *ob* is either a reference or proxy object.  This function
+   always succeeds.
 
 
 .. c:function:: int PyWeakref_CheckRef(ob)
 
-   Return true if *ob* is a reference object.
+   Return true if *ob* is a reference object.  This function always succeeds.
 
 
 .. c:function:: int PyWeakref_CheckProxy(ob)
 
-   Return true if *ob* is a proxy object.
+   Return true if *ob* is a proxy object.  This function always succeeds.
 
 
 .. c:function:: PyObject* PyWeakref_NewRef(PyObject *ob, PyObject *callback)
@@ -57,10 +58,10 @@
 
    .. note::
 
-      This function returns a **borrowed reference** to the referenced object.
+      This function returns a :term:`borrowed reference` to the referenced object.
       This means that you should always call :c:func:`Py_INCREF` on the object
-      except if you know that it cannot be destroyed while you are still
-      using it.
+      except when it cannot be destroyed before the last usage of the borrowed
+      reference.
 
 
 .. c:function:: PyObject* PyWeakref_GET_OBJECT(PyObject *ref)
diff --git a/Doc/conf.py b/Doc/conf.py
index 079d177..cbf201a 100644
--- a/Doc/conf.py
+++ b/Doc/conf.py
@@ -15,8 +15,7 @@
 
 extensions = ['sphinx.ext.coverage', 'sphinx.ext.doctest',
               'pyspecific', 'c_annotations', 'escape4chm',
-              'asdl_highlight', 'peg_highlight']
-
+              'asdl_highlight', 'peg_highlight', 'glossary_search']
 
 doctest_global_setup = '''
 try:
@@ -70,7 +69,8 @@
 html_theme_path = ['tools']
 html_theme_options = {
     'collapsiblesidebar': True,
-    'issues_url': 'https://docs.python.org/3/bugs.html',
+    'issues_url': '/bugs.html',
+    'license_url': '/license.html',
     'root_include_title': False   # We use the version switcher instead.
 }
 
@@ -86,7 +86,7 @@
 
 # Custom sidebar templates, filenames relative to this file.
 html_sidebars = {
-    # Defaults taken from http://www.sphinx-doc.org/en/stable/config.html#confval-html_sidebars
+    # Defaults taken from https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_sidebars
     # Removes the quick search block
     '**': ['localtoc.html', 'relations.html', 'customsourcelink.html'],
     'index': ['indexsidebar.html'],
@@ -226,8 +226,9 @@
 # Options for extensions
 # ----------------------
 
-# Relative filename of the reference count data file.
+# Relative filename of the data files
 refcount_file = 'data/refcounts.dat'
+stable_abi_file = 'data/stable_abi.dat'
 
 # Sphinx 2 and Sphinx 3 compatibility
 # -----------------------------------
@@ -238,3 +239,5 @@
 # bpo-40204: Disable warnings on Sphinx 2 syntax of the C domain since the
 # documentation is built with -W (warnings treated as errors).
 c_warn_on_allowed_pre_v3 = False
+
+strip_signature_backslash = True
diff --git a/Doc/copyright.rst b/Doc/copyright.rst
index 1b90d9f..e64a493 100644
--- a/Doc/copyright.rst
+++ b/Doc/copyright.rst
@@ -4,7 +4,7 @@
 
 Python and this documentation is:
 
-Copyright © 2001-2020 Python Software Foundation. All rights reserved.
+Copyright © 2001-2022 Python Software Foundation. All rights reserved.
 
 Copyright © 2000 BeOpen.com. All rights reserved.
 
diff --git a/Doc/data/python3.10.abi b/Doc/data/python3.10.abi
new file mode 100644
index 0000000..b7886ae
--- /dev/null
+++ b/Doc/data/python3.10.abi
@@ -0,0 +1,20719 @@
+<abi-corpus path='libpython3.10.so' soname='libpython3.10.so.1.0'>
+  <elf-needed>
+    <dependency name='libpthread.so.0'/>
+    <dependency name='libdl.so.2'/>
+    <dependency name='libutil.so.1'/>
+    <dependency name='libm.so.6'/>
+    <dependency name='libc.so.6'/>
+  </elf-needed>
+  <elf-function-symbols>
+    <elf-symbol name='PyAIter_Check' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyArg_Parse' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyArg_ParseTuple' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyArg_ParseTupleAndKeywords' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyArg_UnpackTuple' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyArg_VaParse' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyArg_VaParseTupleAndKeywords' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyArg_ValidateKeywordArguments' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyAsyncGen_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyBool_FromLong' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyBuffer_FillContiguousStrides' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyBuffer_FillInfo' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyBuffer_FromContiguous' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyBuffer_GetPointer' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyBuffer_IsContiguous' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyBuffer_Release' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyBuffer_SizeFromFormat' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyBuffer_ToContiguous' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyByteArray_AsString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyByteArray_Concat' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyByteArray_FromObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyByteArray_FromStringAndSize' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyByteArray_Resize' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyByteArray_Size' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyBytes_AsString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyBytes_AsStringAndSize' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyBytes_Concat' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyBytes_ConcatAndDel' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyBytes_DecodeEscape' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyBytes_FromFormat' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyBytes_FromFormatV' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyBytes_FromObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyBytes_FromString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyBytes_FromStringAndSize' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyBytes_Repr' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyBytes_Size' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCFunction_Call' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCFunction_GetFlags' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCFunction_GetFunction' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCFunction_GetSelf' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCFunction_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCFunction_NewEx' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCMethod_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCallIter_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCallable_Check' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCapsule_GetContext' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCapsule_GetDestructor' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCapsule_GetName' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCapsule_GetPointer' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCapsule_Import' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCapsule_IsValid' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCapsule_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCapsule_SetContext' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCapsule_SetDestructor' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCapsule_SetName' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCapsule_SetPointer' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCell_Get' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCell_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCell_Set' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyClassMethod_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCode_Addr2Line' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCode_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCode_NewEmpty' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCode_NewWithPosOnlyArgs' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCode_Optimize' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCodec_BackslashReplaceErrors' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCodec_Decode' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCodec_Decoder' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCodec_Encode' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCodec_Encoder' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCodec_IgnoreErrors' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCodec_IncrementalDecoder' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCodec_IncrementalEncoder' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCodec_KnownEncoding' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCodec_LookupError' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCodec_NameReplaceErrors' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCodec_Register' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCodec_RegisterError' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCodec_ReplaceErrors' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCodec_StreamReader' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCodec_StreamWriter' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCodec_StrictErrors' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCodec_Unregister' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCodec_XMLCharRefReplaceErrors' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCompile_OpcodeStackEffect' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCompile_OpcodeStackEffectWithJump' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyComplex_AsCComplex' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyComplex_FromCComplex' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyComplex_FromDoubles' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyComplex_ImagAsDouble' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyComplex_RealAsDouble' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyConfig_Clear' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyConfig_InitIsolatedConfig' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyConfig_InitPythonConfig' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyConfig_Read' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyConfig_SetArgv' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyConfig_SetBytesArgv' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyConfig_SetBytesString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyConfig_SetString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyConfig_SetWideStringList' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyContextVar_Get' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyContextVar_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyContextVar_Reset' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyContextVar_Set' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyContext_Copy' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyContext_CopyCurrent' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyContext_Enter' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyContext_Exit' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyContext_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCoro_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDescr_IsData' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDescr_NewClassMethod' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDescr_NewGetSet' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDescr_NewMember' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDescr_NewMethod' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDescr_NewWrapper' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDictProxy_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDict_Clear' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDict_Contains' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDict_Copy' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDict_DelItem' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDict_DelItemString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDict_GetItem' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDict_GetItemString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDict_GetItemWithError' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDict_Items' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDict_Keys' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDict_Merge' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDict_MergeFromSeq2' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDict_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDict_Next' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDict_SetDefault' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDict_SetItem' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDict_SetItemString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDict_Size' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDict_Update' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDict_Values' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_BadArgument' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_BadInternalCall' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_CheckSignals' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_Clear' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_Display' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_ExceptionMatches' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_Fetch' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_Format' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_FormatV' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_GetExcInfo' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_GivenExceptionMatches' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_NewException' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_NewExceptionWithDoc' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_NoMemory' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_NormalizeException' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_Occurred' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_Print' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_PrintEx' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_ProgramText' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_ProgramTextObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_RangedSyntaxLocationObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_ResourceWarning' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_Restore' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_SetExcInfo' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_SetFromErrno' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_SetFromErrnoWithFilename' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_SetFromErrnoWithFilenameObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_SetFromErrnoWithFilenameObjects' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_SetImportError' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_SetImportErrorSubclass' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_SetInterrupt' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_SetInterruptEx' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_SetNone' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_SetObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_SetString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_SyntaxLocation' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_SyntaxLocationEx' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_SyntaxLocationObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_WarnEx' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_WarnExplicit' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_WarnExplicitFormat' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_WarnExplicitObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_WarnFormat' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyErr_WriteUnraisable' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyEval_AcquireLock' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyEval_AcquireThread' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyEval_CallFunction' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyEval_CallMethod' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyEval_CallObjectWithKeywords' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyEval_EvalCode' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyEval_EvalCodeEx' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyEval_EvalFrame' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyEval_EvalFrameEx' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyEval_GetBuiltins' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyEval_GetFrame' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyEval_GetFuncDesc' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyEval_GetFuncName' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyEval_GetGlobals' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyEval_GetLocals' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyEval_InitThreads' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyEval_MergeCompilerFlags' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyEval_ReleaseLock' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyEval_ReleaseThread' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyEval_RestoreThread' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyEval_SaveThread' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyEval_SetProfile' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyEval_SetTrace' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyEval_ThreadsInitialized' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExceptionClass_Name' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyException_GetCause' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyException_GetContext' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyException_GetTraceback' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyException_SetCause' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyException_SetContext' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyException_SetTraceback' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFile_FromFd' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFile_GetLine' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFile_NewStdPrinter' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFile_OpenCode' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFile_OpenCodeObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFile_SetOpenCodeHook' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFile_WriteObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFile_WriteString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFloat_AsDouble' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFloat_FromDouble' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFloat_FromString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFloat_GetInfo' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFloat_GetMax' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFloat_GetMin' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFrame_BlockPop' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFrame_BlockSetup' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFrame_FastToLocals' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFrame_FastToLocalsWithError' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFrame_GetBack' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFrame_GetCode' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFrame_GetLineNumber' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFrame_LocalsToFast' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFrame_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFrozenSet_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFunction_GetAnnotations' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFunction_GetClosure' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFunction_GetCode' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFunction_GetDefaults' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFunction_GetGlobals' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFunction_GetKwDefaults' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFunction_GetModule' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFunction_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFunction_NewWithQualName' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFunction_SetAnnotations' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFunction_SetClosure' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFunction_SetDefaults' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFunction_SetKwDefaults' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyGC_Collect' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyGC_Disable' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyGC_Enable' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyGC_IsEnabled' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyGILState_Check' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyGILState_Ensure' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyGILState_GetThisThreadState' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyGILState_Release' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyGen_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyGen_NewWithQualName' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyHash_GetFuncDef' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyImport_AddModule' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyImport_AddModuleObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyImport_AppendInittab' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyImport_ExecCodeModule' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyImport_ExecCodeModuleEx' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyImport_ExecCodeModuleObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyImport_ExecCodeModuleWithPathnames' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyImport_ExtendInittab' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyImport_GetImporter' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyImport_GetMagicNumber' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyImport_GetMagicTag' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyImport_GetModule' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyImport_GetModuleDict' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyImport_Import' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyImport_ImportFrozenModule' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyImport_ImportFrozenModuleObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyImport_ImportModule' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyImport_ImportModuleLevel' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyImport_ImportModuleLevelObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyImport_ImportModuleNoBlock' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyImport_ReloadModule' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyIndex_Check' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInit__abc' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInit__ast' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInit__codecs' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInit__collections' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInit__functools' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInit__imp' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInit__io' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInit__locale' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInit__operator' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInit__signal' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInit__sre' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInit__stat' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInit__string' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInit__symtable' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInit__thread' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInit__tracemalloc' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInit__weakref' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInit_atexit' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInit_errno' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInit_faulthandler' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInit_gc' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInit_itertools' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInit_posix' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInit_pwd' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInit_time' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInit_xxsubtype' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInstanceMethod_Function' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInstanceMethod_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInterpreterState_Clear' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInterpreterState_Delete' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInterpreterState_Get' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInterpreterState_GetDict' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInterpreterState_GetID' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInterpreterState_Head' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInterpreterState_Main' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInterpreterState_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInterpreterState_Next' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInterpreterState_ThreadHead' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyIter_Check' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyIter_Next' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyIter_Send' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyList_Append' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyList_AsTuple' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyList_GetItem' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyList_GetSlice' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyList_Insert' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyList_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyList_Reverse' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyList_SetItem' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyList_SetSlice' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyList_Size' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyList_Sort' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyLong_AsDouble' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyLong_AsLong' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyLong_AsLongAndOverflow' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyLong_AsLongLong' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyLong_AsLongLongAndOverflow' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyLong_AsSize_t' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyLong_AsSsize_t' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyLong_AsUnsignedLong' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyLong_AsUnsignedLongLong' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyLong_AsUnsignedLongLongMask' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyLong_AsUnsignedLongMask' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyLong_AsVoidPtr' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyLong_FromDouble' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyLong_FromLong' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyLong_FromLongLong' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyLong_FromSize_t' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyLong_FromSsize_t' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyLong_FromString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyLong_FromUnicodeObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyLong_FromUnsignedLong' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyLong_FromUnsignedLongLong' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyLong_FromVoidPtr' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyLong_GetInfo' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMapping_Check' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMapping_GetItemString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMapping_HasKey' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMapping_HasKeyString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMapping_Items' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMapping_Keys' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMapping_Length' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMapping_SetItemString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMapping_Size' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMapping_Values' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMarshal_Init' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMarshal_ReadLastObjectFromFile' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMarshal_ReadLongFromFile' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMarshal_ReadObjectFromFile' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMarshal_ReadObjectFromString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMarshal_ReadShortFromFile' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMarshal_WriteLongToFile' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMarshal_WriteObjectToFile' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMarshal_WriteObjectToString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMem_Calloc' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMem_Free' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMem_GetAllocator' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMem_Malloc' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMem_RawCalloc' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMem_RawFree' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMem_RawMalloc' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMem_RawRealloc' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMem_Realloc' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMem_SetAllocator' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMem_SetupDebugHooks' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMember_GetOne' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMember_SetOne' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMemoryView_FromBuffer' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMemoryView_FromMemory' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMemoryView_FromObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMemoryView_GetContiguous' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMethod_Function' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMethod_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMethod_Self' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyModuleDef_Init' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyModule_AddFunctions' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyModule_AddIntConstant' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyModule_AddObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyModule_AddObjectRef' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyModule_AddStringConstant' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyModule_AddType' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyModule_Create2' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyModule_ExecDef' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyModule_FromDefAndSpec2' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyModule_GetDef' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyModule_GetDict' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyModule_GetFilename' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyModule_GetFilenameObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyModule_GetName' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyModule_GetNameObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyModule_GetState' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyModule_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyModule_NewObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyModule_SetDocString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_Absolute' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_Add' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_And' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_AsSsize_t' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_Check' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_Divmod' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_Float' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_FloorDivide' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_InPlaceAdd' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_InPlaceAnd' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_InPlaceFloorDivide' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_InPlaceLshift' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_InPlaceMatrixMultiply' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_InPlaceMultiply' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_InPlaceOr' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_InPlacePower' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_InPlaceRemainder' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_InPlaceRshift' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_InPlaceSubtract' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_InPlaceTrueDivide' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_InPlaceXor' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_Index' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_Invert' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_Long' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_Lshift' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_MatrixMultiply' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_Multiply' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_Negative' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_Or' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_Positive' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_Power' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_Remainder' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_Rshift' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_Subtract' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_ToBase' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_TrueDivide' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyNumber_Xor' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyODict_DelItem' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyODict_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyODict_SetItem' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyOS_AfterFork' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyOS_AfterFork_Child' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyOS_AfterFork_Parent' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyOS_BeforeFork' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyOS_FSPath' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyOS_InterruptOccurred' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyOS_Readline' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyOS_double_to_string' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyOS_getsig' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyOS_mystricmp' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyOS_mystrnicmp' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyOS_setsig' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyOS_snprintf' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyOS_string_to_double' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyOS_strtol' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyOS_strtoul' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyOS_vsnprintf' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_ASCII' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_AsCharBuffer' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_AsFileDescriptor' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_AsReadBuffer' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_AsWriteBuffer' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_Bytes' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_Call' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_CallFinalizer' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_CallFinalizerFromDealloc' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_CallFunction' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_CallFunctionObjArgs' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_CallMethod' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_CallMethodObjArgs' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_CallNoArgs' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_CallObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_Calloc' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_CheckBuffer' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_CheckReadBuffer' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_ClearWeakRefs' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_CopyData' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_DelItem' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_DelItemString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_Dir' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_Format' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_Free' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_GC_Del' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_GC_IsFinalized' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_GC_IsTracked' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_GC_Track' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_GC_UnTrack' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_GET_WEAKREFS_LISTPTR' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_GenericGetAttr' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_GenericGetDict' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_GenericSetAttr' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_GenericSetDict' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_GetAIter' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_GetArenaAllocator' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_GetAttr' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_GetAttrString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_GetBuffer' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_GetItem' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_GetIter' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_HasAttr' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_HasAttrString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_Hash' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_HashNotImplemented' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_IS_GC' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_Init' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_InitVar' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_IsInstance' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_IsSubclass' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_IsTrue' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_Length' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_LengthHint' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_Malloc' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_Not' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_Print' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_Realloc' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_Repr' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_RichCompare' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_RichCompareBool' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_SelfIter' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_SetArenaAllocator' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_SetAttr' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_SetAttrString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_SetItem' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_Size' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_Str' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_Type' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_VectorcallDict' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyObject_VectorcallMethod' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyPickleBuffer_FromObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyPickleBuffer_GetBuffer' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyPickleBuffer_Release' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyPreConfig_InitIsolatedConfig' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyPreConfig_InitPythonConfig' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyRun_AnyFile' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyRun_AnyFileEx' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyRun_AnyFileExFlags' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyRun_AnyFileFlags' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyRun_File' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyRun_FileEx' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyRun_FileExFlags' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyRun_FileFlags' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyRun_InteractiveLoop' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyRun_InteractiveLoopFlags' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyRun_InteractiveOne' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyRun_InteractiveOneFlags' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyRun_InteractiveOneObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyRun_SimpleFile' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyRun_SimpleFileEx' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyRun_SimpleFileExFlags' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyRun_SimpleString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyRun_SimpleStringFlags' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyRun_String' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyRun_StringFlags' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySeqIter_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySequence_Check' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySequence_Concat' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySequence_Contains' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySequence_Count' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySequence_DelItem' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySequence_DelSlice' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySequence_Fast' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySequence_GetItem' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySequence_GetSlice' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySequence_In' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySequence_InPlaceConcat' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySequence_InPlaceRepeat' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySequence_Index' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySequence_Length' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySequence_List' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySequence_Repeat' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySequence_SetItem' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySequence_SetSlice' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySequence_Size' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySequence_Tuple' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySet_Add' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySet_Clear' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySet_Contains' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySet_Discard' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySet_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySet_Pop' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySet_Size' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySlice_AdjustIndices' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySlice_GetIndices' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySlice_GetIndicesEx' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySlice_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySlice_Unpack' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyState_AddModule' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyState_FindModule' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyState_RemoveModule' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyStaticMethod_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyStatus_Error' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyStatus_Exception' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyStatus_Exit' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyStatus_IsError' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyStatus_IsExit' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyStatus_NoMemory' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyStatus_Ok' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyStructSequence_GetItem' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyStructSequence_InitType' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyStructSequence_InitType2' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyStructSequence_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyStructSequence_NewType' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyStructSequence_SetItem' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySymtable_Lookup' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySys_AddAuditHook' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySys_AddWarnOption' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySys_AddWarnOptionUnicode' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySys_AddXOption' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySys_Audit' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySys_FormatStderr' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySys_FormatStdout' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySys_GetObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySys_GetXOptions' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySys_HasWarnOptions' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySys_ResetWarnOptions' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySys_SetArgv' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySys_SetArgvEx' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySys_SetObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySys_SetPath' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySys_WriteStderr' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySys_WriteStdout' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThreadState_Clear' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThreadState_Delete' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThreadState_DeleteCurrent' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThreadState_Get' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThreadState_GetDict' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThreadState_GetFrame' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThreadState_GetID' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThreadState_GetInterpreter' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThreadState_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThreadState_Next' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThreadState_SetAsyncExc' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThreadState_Swap' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThread_GetInfo' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThread_ReInitTLS' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThread_acquire_lock' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThread_acquire_lock_timed' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThread_allocate_lock' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThread_create_key' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThread_delete_key' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThread_delete_key_value' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThread_exit_thread' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThread_free_lock' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThread_get_key_value' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThread_get_stacksize' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThread_get_thread_ident' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThread_get_thread_native_id' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThread_init_thread' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThread_release_lock' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThread_set_key_value' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThread_set_stacksize' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThread_start_new_thread' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThread_tss_alloc' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThread_tss_create' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThread_tss_delete' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThread_tss_free' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThread_tss_get' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThread_tss_is_created' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyThread_tss_set' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyToken_OneChar' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyToken_ThreeChars' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyToken_TwoChars' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyTraceBack_Here' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyTraceBack_Print' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyTraceMalloc_Track' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyTraceMalloc_Untrack' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyTuple_GetItem' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyTuple_GetSlice' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyTuple_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyTuple_Pack' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyTuple_SetItem' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyTuple_Size' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyType_ClearCache' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyType_FromModuleAndSpec' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyType_FromSpec' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyType_FromSpecWithBases' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyType_GenericAlloc' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyType_GenericNew' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyType_GetFlags' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyType_GetModule' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyType_GetModuleState' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyType_GetSlot' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyType_IsSubtype' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyType_Modified' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyType_Ready' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicodeDecodeError_Create' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicodeDecodeError_GetEncoding' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicodeDecodeError_GetEnd' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicodeDecodeError_GetObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicodeDecodeError_GetReason' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicodeDecodeError_GetStart' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicodeDecodeError_SetEnd' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicodeDecodeError_SetReason' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicodeDecodeError_SetStart' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicodeEncodeError_Create' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicodeEncodeError_GetEncoding' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicodeEncodeError_GetEnd' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicodeEncodeError_GetObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicodeEncodeError_GetReason' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicodeEncodeError_GetStart' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicodeEncodeError_SetEnd' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicodeEncodeError_SetReason' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicodeEncodeError_SetStart' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicodeTranslateError_Create' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicodeTranslateError_GetEnd' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicodeTranslateError_GetObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicodeTranslateError_GetReason' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicodeTranslateError_GetStart' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicodeTranslateError_SetEnd' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicodeTranslateError_SetReason' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicodeTranslateError_SetStart' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_Append' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_AppendAndDel' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_AsASCIIString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_AsCharmapString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_AsDecodedObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_AsDecodedUnicode' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_AsEncodedObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_AsEncodedString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_AsEncodedUnicode' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_AsLatin1String' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_AsRawUnicodeEscapeString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_AsUCS4' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_AsUCS4Copy' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_AsUTF16String' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_AsUTF32String' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_AsUTF8' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_AsUTF8AndSize' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_AsUTF8String' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_AsUnicode' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_AsUnicodeAndSize' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_AsUnicodeEscapeString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_AsWideChar' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_AsWideCharString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_BuildEncodingMap' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_Compare' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_CompareWithASCIIString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_Concat' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_Contains' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_CopyCharacters' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_Count' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_Decode' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_DecodeASCII' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_DecodeCharmap' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_DecodeFSDefault' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_DecodeFSDefaultAndSize' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_DecodeLatin1' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_DecodeLocale' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_DecodeLocaleAndSize' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_DecodeRawUnicodeEscape' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_DecodeUTF16' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_DecodeUTF16Stateful' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_DecodeUTF32' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_DecodeUTF32Stateful' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_DecodeUTF7' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_DecodeUTF7Stateful' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_DecodeUTF8' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_DecodeUTF8Stateful' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_DecodeUnicodeEscape' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_Encode' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_EncodeASCII' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_EncodeCharmap' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_EncodeDecimal' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_EncodeFSDefault' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_EncodeLatin1' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_EncodeLocale' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_EncodeRawUnicodeEscape' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_EncodeUTF16' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_EncodeUTF32' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_EncodeUTF7' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_EncodeUTF8' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_EncodeUnicodeEscape' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_FSConverter' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_FSDecoder' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_Fill' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_Find' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_FindChar' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_Format' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_FromEncodedObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_FromFormat' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_FromFormatV' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_FromKindAndData' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_FromObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_FromOrdinal' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_FromString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_FromStringAndSize' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_FromUnicode' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_FromWideChar' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_GetDefaultEncoding' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_GetLength' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_GetSize' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_InternFromString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_InternImmortal' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_InternInPlace' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_IsIdentifier' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_Join' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_Partition' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_RPartition' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_RSplit' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_ReadChar' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_Replace' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_Resize' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_RichCompare' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_Split' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_Splitlines' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_Substring' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_Tailmatch' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_TransformDecimalToASCII' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_Translate' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_TranslateCharmap' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_WriteChar' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyVectorcall_Call' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyWeakref_GetObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyWeakref_NewProxy' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyWeakref_NewRef' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyWideStringList_Append' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyWideStringList_Insert' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyWrapper_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_AddPendingCall' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_AtExit' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_BuildValue' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_BytesMain' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_CompileString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_CompileStringExFlags' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_CompileStringFlags' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_CompileStringObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_DecRef' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_DecodeLocale' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_EncodeLocale' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_EndInterpreter' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_EnterRecursiveCall' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_Exit' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_ExitStatusException' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_FatalError' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_FdIsInteractive' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_Finalize' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_FinalizeEx' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_FrozenMain' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_GenericAlias' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_GetArgcArgv' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_GetBuildInfo' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_GetCompiler' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_GetCopyright' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_GetExecPrefix' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_GetPath' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_GetPlatform' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_GetPrefix' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_GetProgramFullPath' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_GetProgramName' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_GetPythonHome' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_GetRecursionLimit' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_GetVersion' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_IncRef' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_Initialize' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_InitializeEx' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_InitializeFromConfig' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_Is' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_IsFalse' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_IsInitialized' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_IsNone' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_IsTrue' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_LeaveRecursiveCall' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_Main' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_MakePendingCalls' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_NewInterpreter' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_NewRef' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_PreInitialize' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_PreInitializeFromArgs' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_PreInitializeFromBytesArgs' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_ReprEnter' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_ReprLeave' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_RunMain' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_SetPath' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_SetProgramName' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_SetPythonHome' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_SetRecursionLimit' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_SetStandardStreamEncoding' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_UniversalNewlineFgets' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_VaBuildValue' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_XNewRef' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyAST_Compile' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyAccu_Accumulate' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyAccu_Destroy' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyAccu_Finish' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyAccu_FinishAsList' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyAccu_Init' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyArena_AddPyObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyArena_Free' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyArena_Malloc' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyArena_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyArg_BadArgument' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyArg_CheckPositional' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyArg_NoKeywords' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyArg_NoKwnames' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyArg_NoPositional' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyArg_ParseStack' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyArg_ParseStackAndKeywords' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyArg_ParseStackAndKeywords_SizeT' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyArg_ParseStack_SizeT' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyArg_ParseTupleAndKeywordsFast' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyArg_ParseTupleAndKeywordsFast_SizeT' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyArg_ParseTupleAndKeywords_SizeT' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyArg_ParseTuple_SizeT' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyArg_Parse_SizeT' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyArg_UnpackKeywords' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyArg_UnpackStack' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyArg_VaParseTupleAndKeywordsFast' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyArg_VaParseTupleAndKeywordsFast_SizeT' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyArg_VaParseTupleAndKeywords_SizeT' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyArg_VaParse_SizeT' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyArgv_AsWstrList' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyBytesWriter_Alloc' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyBytesWriter_Dealloc' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyBytesWriter_Finish' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyBytesWriter_Init' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyBytesWriter_Prepare' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyBytesWriter_Resize' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyBytesWriter_WriteBytes' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyBytes_DecodeEscape' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyBytes_FormatEx' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyBytes_FromHex' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyBytes_Join' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyBytes_Resize' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyCode_CheckLineNumber' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyCode_ConstantKey' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyCode_GetExtra' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyCode_SetExtra' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyCodecInfo_GetIncrementalDecoder' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyCodecInfo_GetIncrementalEncoder' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyCodec_DecodeText' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyCodec_EncodeText' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyCodec_Lookup' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyCodec_LookupTextEncoding' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyComplex_FormatAdvancedWriter' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyConfig_AsDict' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyConfig_FromDict' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyConfig_InitCompatConfig' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyContext_NewHamtForTests' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyCrossInterpreterData_Lookup' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyCrossInterpreterData_NewObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyCrossInterpreterData_RegisterClass' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyCrossInterpreterData_Release' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyDebugAllocatorStats' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyDictView_Intersect' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyDictView_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyDict_CheckConsistency' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyDict_ContainsId' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyDict_Contains_KnownHash' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyDict_DebugMallocStats' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyDict_DelItemId' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyDict_DelItemIf' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyDict_DelItem_KnownHash' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyDict_GetItemIdWithError' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyDict_GetItemStringWithError' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyDict_GetItem_KnownHash' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyDict_HasOnlyStringKeys' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyDict_MaybeUntrack' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyDict_MergeEx' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyDict_NewPresized' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyDict_Next' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyDict_Pop' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyDict_SetItemId' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyDict_SetItem_KnownHash' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyDict_SizeOf' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyErr_BadInternalCall' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyErr_ChainExceptions' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyErr_ChainStackItem' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyErr_CheckSignals' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyErr_CheckSignalsTstate' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyErr_Clear' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyErr_Display' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyErr_ExceptionMatches' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyErr_Fetch' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyErr_Format' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyErr_FormatFromCause' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyErr_FormatFromCauseTstate' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyErr_GetExcInfo' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyErr_GetTopmostException' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyErr_NoMemory' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyErr_NormalizeException' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyErr_Print' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyErr_ProgramDecodedTextObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyErr_Restore' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyErr_SetKeyError' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyErr_SetNone' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyErr_SetObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyErr_SetString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyErr_TrySetFromCause' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyErr_WriteUnraisableMsg' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyEval_AddPendingCall' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyEval_CallTracing' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyEval_EvalFrameDefault' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyEval_GetAsyncGenFinalizer' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyEval_GetAsyncGenFirstiter' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyEval_GetBuiltinId' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyEval_GetCoroutineOriginTrackingDepth' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyEval_GetSwitchInterval' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyEval_RequestCodeExtraIndex' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyEval_SetAsyncGenFinalizer' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyEval_SetAsyncGenFirstiter' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyEval_SetCoroutineOriginTrackingDepth' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyEval_SetProfile' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyEval_SetSwitchInterval' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyEval_SetTrace' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyEval_SignalAsyncExc' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyEval_SignalReceived' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyEval_SliceIndex' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyEval_SliceIndexNotNone' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyFloat_DebugMallocStats' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyFloat_FormatAdvancedWriter' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyFloat_Pack2' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyFloat_Pack4' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyFloat_Pack8' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyFloat_Unpack2' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyFloat_Unpack4' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyFloat_Unpack8' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyFrame_DebugMallocStats' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyFunction_Vectorcall' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyGILState_GetInterpreterStateUnsafe' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyGen_FetchStopIterationValue' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyGen_Finalize' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyGen_SetStopIterationValue' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyImport_AcquireLock' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyImport_FindExtensionObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyImport_FixupBuiltin' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyImport_FixupExtensionObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyImport_GetModuleId' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyImport_IsInitialized' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyImport_ReleaseLock' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyImport_SetModule' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyImport_SetModuleString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyInterpreterID_LookUp' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyInterpreterID_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyInterpreterState_Enable' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyInterpreterState_GetConfig' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyInterpreterState_GetConfigCopy' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyInterpreterState_GetEvalFrameFunc' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyInterpreterState_GetIDObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyInterpreterState_GetMainModule' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyInterpreterState_IDDecref' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyInterpreterState_IDIncref' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyInterpreterState_IDInitref' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyInterpreterState_LookUpID' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyInterpreterState_RequireIDRef' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyInterpreterState_RequiresIDRef' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyInterpreterState_SetConfig' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyInterpreterState_SetEvalFrameFunc' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyList_DebugMallocStats' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyList_Extend' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyLong_AsByteArray' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyLong_AsInt' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyLong_AsTime_t' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyLong_Copy' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyLong_DivmodNear' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyLong_FileDescriptor_Converter' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyLong_Format' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyLong_FormatAdvancedWriter' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyLong_FormatBytesWriter' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyLong_FormatWriter' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyLong_Frexp' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyLong_FromByteArray' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyLong_FromBytes' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyLong_FromGid' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyLong_FromTime_t' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyLong_FromUid' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyLong_GCD' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyLong_Lshift' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyLong_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyLong_NumBits' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyLong_Rshift' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyLong_Sign' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyLong_Size_t_Converter' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyLong_UnsignedInt_Converter' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyLong_UnsignedLongLong_Converter' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyLong_UnsignedLong_Converter' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyLong_UnsignedShort_Converter' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyMem_GetAllocatorName' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyMem_GetCurrentAllocatorName' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyMem_RawStrdup' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyMem_RawWcsdup' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyMem_SetDefaultAllocator' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyMem_SetupAllocators' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyMem_Strdup' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyModuleSpec_IsInitializing' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyModule_Clear' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyModule_ClearDict' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyModule_CreateInitialized' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyNamespace_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyNumber_Index' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyOS_InterruptOccurred' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyOS_IsMainThread' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyOS_URandom' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyOS_URandomNonblock' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_AssertFailed' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_Call' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_CallFunction_SizeT' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_CallMethodId' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_CallMethodIdObjArgs' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_CallMethodId_SizeT' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_CallMethod_SizeT' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_Call_Prepend' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_CheckConsistency' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_CheckCrossInterpreterData' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_DebugMallocStats' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_DebugTypeStats' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_Dump' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_FastCallDictTstate' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_FunctionStr' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_GC_Calloc' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_GC_Malloc' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_GC_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_GC_NewVar' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_GC_Resize' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_GenericGetAttrWithDict' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_GenericSetAttrWithDict' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_GetAttrId' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_GetCrossInterpreterData' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_GetDictPtr' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_GetMethod' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_HasLen' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_IsAbstract' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_IsFreed' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_LookupAttr' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_LookupAttrId' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_LookupSpecial' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_MakeTpCall' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_New' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_NewVar' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_NextNotImplemented' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_RealIsInstance' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_RealIsSubclass' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyObject_SetAttrId' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyPreConfig_InitCompatConfig' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyRun_AnyFileObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyRun_InteractiveLoopObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyRun_SimpleFileObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyRuntimeState_Fini' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyRuntimeState_Init' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyRuntime_Finalize' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyRuntime_Initialize' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PySequence_BytesToCharpArray' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PySequence_IterSearch' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PySet_NextEntry' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PySet_Update' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PySlice_FromIndices' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PySlice_GetLongIndices' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyStack_AsDict' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyState_AddModule' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyStructSequence_InitType' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PySys_GetObjectId' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PySys_GetSizeOf' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PySys_SetObjectId' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyThreadState_DeleteCurrent' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyThreadState_DeleteExcept' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyThreadState_GetDict' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyThreadState_Init' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyThreadState_Prealloc' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyThreadState_Swap' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyThreadState_UncheckedGet' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyThread_CurrentExceptions' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyThread_CurrentFrames' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyThread_at_fork_reinit' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTime_AsMicroseconds' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTime_AsMilliseconds' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTime_AsNanosecondsObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTime_AsSecondsDouble' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTime_AsTimespec' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTime_AsTimeval' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTime_AsTimevalTime_t' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTime_AsTimeval_noraise' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTime_FromMillisecondsObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTime_FromNanoseconds' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTime_FromNanosecondsObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTime_FromSeconds' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTime_FromSecondsObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTime_FromTimespec' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTime_FromTimeval' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTime_GetMonotonicClock' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTime_GetMonotonicClockWithInfo' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTime_GetPerfCounter' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTime_GetPerfCounterWithInfo' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTime_GetSystemClock' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTime_GetSystemClockWithInfo' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTime_MulDiv' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTime_ObjectToTime_t' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTime_ObjectToTimespec' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTime_ObjectToTimeval' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTime_gmtime' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTime_localtime' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTraceMalloc_GetTraceback' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTraceback_Add' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTrash_begin' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTrash_cond' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTrash_deposit_object' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTrash_destroy_chain' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTrash_end' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTrash_thread_deposit_object' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTrash_thread_destroy_chain' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTuple_DebugMallocStats' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTuple_MaybeUntrack' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyTuple_Resize' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyType_CalculateMetaclass' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyType_CheckConsistency' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyType_GetDocFromInternalDoc' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyType_GetModuleByDef' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyType_GetTextSignatureFromInternalDoc' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyType_Lookup' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyType_LookupId' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyType_Name' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicodeTranslateError_Create' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicodeWriter_Dealloc' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicodeWriter_Finish' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicodeWriter_Init' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicodeWriter_PrepareInternal' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicodeWriter_PrepareKindInternal' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicodeWriter_WriteASCIIString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicodeWriter_WriteChar' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicodeWriter_WriteLatin1String' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicodeWriter_WriteStr' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicodeWriter_WriteSubstring' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_AsASCIIString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_AsLatin1String' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_AsUTF8String' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_AsUnicode' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_CheckConsistency' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_Copy' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_DecodeRawUnicodeEscapeStateful' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_DecodeUnicodeEscapeInternal' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_DecodeUnicodeEscapeStateful' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_EQ' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_EncodeCharmap' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_EncodeUTF16' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_EncodeUTF32' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_EncodeUTF7' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_EqualToASCIIId' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_EqualToASCIIString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_FastCopyCharacters' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_FastFill' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_FindMaxChar' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_FormatAdvancedWriter' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_FormatLong' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_FromASCII' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_FromId' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_InsertThousandsGrouping' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_IsAlpha' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_IsCaseIgnorable' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_IsCased' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_IsDecimalDigit' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_IsDigit' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_IsLinebreak' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_IsLowercase' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_IsNumeric' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_IsPrintable' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_IsTitlecase' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_IsUppercase' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_IsWhitespace' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_IsXidContinue' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_IsXidStart' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_JoinArray' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_Ready' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_ScanIdentifier' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_ToDecimalDigit' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_ToDigit' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_ToFoldedFull' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_ToLowerFull' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_ToLowercase' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_ToNumeric' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_ToTitleFull' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_ToTitlecase' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_ToUpperFull' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_ToUppercase' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_TransformDecimalAndSpaceToASCII' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_WideCharString_Converter' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_WideCharString_Opt_Converter' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyUnicode_XStrip' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyWarnings_Init' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyWeakref_ClearRef' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyWeakref_GetWeakrefCount' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyWideStringList_AsList' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyWideStringList_Clear' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyWideStringList_Copy' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyWideStringList_Extend' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_BreakPoint' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_BuildValue_SizeT' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_CheckFunctionResult' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_CheckRecursiveCall' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_ClearArgcArgv' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_ClearStandardStreamEncoding' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_CoerceLegacyLocale' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_Dealloc' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_DecRef' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_DecodeLocaleEx' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_DisplaySourceLine' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_DumpExtensionModules' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_EncodeLocaleEx' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_EncodeLocaleRaw' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_FatalErrorFormat' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_FatalErrorFunc' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_FatalError_TstateNULL' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_FdIsInteractive' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_FreeCharPArray' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_GetAllocatedBlocks' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_GetConfig' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_GetConfigsAsDict' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_GetEnv' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_GetErrorHandler' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_GetForceASCII' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_GetLocaleEncoding' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_GetLocaleEncodingObject' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_GetLocaleconvNumeric' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_Gid_Converter' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_HandleSystemExit' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_HashBytes' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_HashDouble' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_HashPointer' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_HashPointerRaw' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_IncRef' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_InitializeMain' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_IsCoreInitialized' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_IsFinalizing' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_IsLocaleCoercionTarget' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_LegacyLocaleDetected' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_NewInterpreter' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_NewReference' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_PreInitializeFromConfig' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_PreInitializeFromPyArgv' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_ResetForceASCII' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_RestoreSignals' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_SetLocaleFromEnv' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_SetProgramFullPath' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_Sigset_Converter' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_SourceAsString' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_UTF8_Edit_Cost' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_Uid_Converter' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_VaBuildStack' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_VaBuildStack_SizeT' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_VaBuildValue_SizeT' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_abspath' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_add_one_to_index_C' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_add_one_to_index_F' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_c_abs' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_c_diff' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_c_neg' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_c_pow' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_c_prod' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_c_quot' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_c_sum' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_closerange' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_convert_optional_to_ssize_t' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_device_encoding' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_dg_dtoa' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_dg_freedtoa' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_dg_infinity' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_dg_stdnan' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_dg_strtod' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_dup' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_fopen_obj' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_fstat' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_fstat_noraise' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_get_387controlword' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_get_blocking' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_get_env_flag' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_get_inheritable' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_get_xoption' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_gitidentifier' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_gitversion' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_hashtable_clear' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_hashtable_compare_direct' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_hashtable_destroy' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_hashtable_foreach' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_hashtable_get' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_hashtable_hash_ptr' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_hashtable_new' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_hashtable_new_full' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_hashtable_set' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_hashtable_size' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_hashtable_steal' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_isabs' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_open' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_open_noraise' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_parse_inf_or_nan' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_read' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_set_387controlword' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_set_blocking' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_set_inheritable' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_set_inheritable_async_safe' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_stat' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_str_to_int' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_strhex' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_strhex_bytes' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_strhex_bytes_with_sep' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_strhex_with_sep' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_string_to_number_with_underscores' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_wfopen' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_wgetcwd' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_wreadlink' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_wrealpath' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_write' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_write_noraise' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+  </elf-function-symbols>
+  <elf-variable-symbols>
+    <elf-symbol name='PyAsyncGen_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyBaseObject_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyBool_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyByteArrayIter_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyByteArray_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyBytesIter_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyBytes_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCFunction_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCMethod_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCallIter_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCapsule_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCell_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyClassMethodDescr_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyClassMethod_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCode_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyComplex_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyContextToken_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyContextVar_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyContext_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyCoro_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDictItems_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDictIterItem_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDictIterKey_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDictIterValue_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDictKeys_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDictProxy_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDictRevIterItem_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDictRevIterKey_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDictRevIterValue_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDictValues_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyDict_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyEllipsis_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyEnum_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_ArithmeticError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_AssertionError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_AttributeError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_BaseException' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_BlockingIOError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_BrokenPipeError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_BufferError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_BytesWarning' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_ChildProcessError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_ConnectionAbortedError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_ConnectionError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_ConnectionRefusedError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_ConnectionResetError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_DeprecationWarning' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_EOFError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_EncodingWarning' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_EnvironmentError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_Exception' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_FileExistsError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_FileNotFoundError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_FloatingPointError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_FutureWarning' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_GeneratorExit' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_IOError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_ImportError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_ImportWarning' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_IndentationError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_IndexError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_InterruptedError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_IsADirectoryError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_KeyError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_KeyboardInterrupt' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_LookupError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_MemoryError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_ModuleNotFoundError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_NameError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_NotADirectoryError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_NotImplementedError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_OSError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_OverflowError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_PendingDeprecationWarning' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_PermissionError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_ProcessLookupError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_RecursionError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_ReferenceError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_ResourceWarning' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_RuntimeError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_RuntimeWarning' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_StopAsyncIteration' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_StopIteration' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_SyntaxError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_SyntaxWarning' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_SystemError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_SystemExit' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_TabError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_TimeoutError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_TypeError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_UnboundLocalError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_UnicodeDecodeError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_UnicodeEncodeError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_UnicodeError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_UnicodeTranslateError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_UnicodeWarning' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_UserWarning' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_ValueError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_Warning' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyExc_ZeroDivisionError' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFilter_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFloat_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFrame_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFrozenSet_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyFunction_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyGen_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyGetSetDescr_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyImport_FrozenModules' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyImport_Inittab' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyInstanceMethod_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyListIter_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyListRevIter_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyList_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyLongRangeIter_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyLong_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMap_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMemberDescr_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMemoryView_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMethodDescr_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyMethod_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyModuleDef_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyModule_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyODictItems_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyODictIter_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyODictKeys_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyODictValues_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyODict_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyOS_InputHook' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyOS_ReadlineFunctionPointer' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyPickleBuffer_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyProperty_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyRangeIter_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyRange_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyReversed_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySeqIter_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySetIter_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySet_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySlice_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyStaticMethod_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyStdPrinter_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PySuper_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyTraceBack_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyTupleIter_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyTuple_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyType_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicodeIter_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyUnicode_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyWrapperDescr_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='PyZip_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_BytesWarningFlag' size='4' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_DebugFlag' size='4' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_DontWriteBytecodeFlag' size='4' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_FileSystemDefaultEncodeErrors' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_FileSystemDefaultEncoding' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_FrozenFlag' size='4' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_GenericAliasType' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_HasFileSystemDefaultEncoding' size='4' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_HashRandomizationFlag' size='4' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_IgnoreEnvironmentFlag' size='4' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_InspectFlag' size='4' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_InteractiveFlag' size='4' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_IsolatedFlag' size='4' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_NoSiteFlag' size='4' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_NoUserSiteDirectory' size='4' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_OptimizeFlag' size='4' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_QuietFlag' size='4' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_UTF8Mode' size='4' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_UnbufferedStdioFlag' size='4' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_VerboseFlag' size='4' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='Py_hexdigits' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyAsyncGenASend_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyAsyncGenAThrow_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyAsyncGenWrappedValue_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyByteArray_empty_string' size='1' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyBytesIOBuffer_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyCoroWrapper_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyHamtItems_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyHamtKeys_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyHamtValues_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyHamt_ArrayNode_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyHamt_BitmapNode_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyHamt_CollisionNode_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyHamt_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyInterpreterID_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyLong_DigitValue' size='256' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyManagedBuffer_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyMethodWrapper_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyNamespace_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyNone_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyNotImplemented_Type' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyOS_ReadlineTState' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyParser_TokenNames' size='520' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyRuntime' size='672' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PySet_Dummy' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyWeakref_CallableProxyType' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyWeakref_ProxyType' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_PyWeakref_RefType' size='408' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_EllipsisObject' size='16' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_FalseStruct' size='32' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_HashSecret' size='24' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_NoneStruct' size='16' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_NotImplementedStruct' size='16' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_PackageContext' size='8' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_SwappedOp' size='24' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_TrueStruct' size='32' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_UnhandledKeyboardInterrupt' size='4' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_ascii_whitespace' size='128' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_ctype_table' size='1024' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_ctype_tolower' size='256' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_ctype_toupper' size='256' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_path_config' size='48' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='_Py_tracemalloc_config' size='12' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+  </elf-variable-symbols>
+  <abi-instr version='1.0' address-size='64' path='./Modules/getbuildinfo.c' comp-dir-path='/src' language='LANG_C99'>
+    <type-decl name='char' size-in-bits='8' id='type-id-1'/>
+    <qualified-type-def type-id='type-id-1' const='yes' id='type-id-2'/>
+    <pointer-type-def type-id='type-id-2' size-in-bits='64' id='type-id-3'/>
+    <function-decl name='_Py_gitidentifier' mangled-name='_Py_gitidentifier' filepath='./Modules/getbuildinfo.c' line='59' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_gitidentifier'>
+      <return type-id='type-id-3'/>
+    </function-decl>
+    <function-decl name='Py_GetBuildInfo' mangled-name='Py_GetBuildInfo' filepath='./Modules/getbuildinfo.c' line='35' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_GetBuildInfo'>
+      <return type-id='type-id-3'/>
+    </function-decl>
+    <type-decl name='void' id='type-id-4'/>
+    <function-decl name='PyOS_snprintf' mangled-name='PyOS_snprintf' filepath='./Include/pyerrors.h' line='310' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Parser/token.c' comp-dir-path='/src' language='LANG_C99'>
+    <qualified-type-def type-id='type-id-3' const='yes' id='type-id-5'/>
+
+    <array-type-def dimensions='1' type-id='type-id-5' size-in-bits='infinite' id='type-id-6'>
+      <subrange length='infinite' id='type-id-7'/>
+
+    </array-type-def>
+    <qualified-type-def type-id='type-id-6' const='yes' id='type-id-8'/>
+    <var-decl name='_PyParser_TokenNames' type-id='type-id-8' mangled-name='_PyParser_TokenNames' visibility='default' filepath='./Include/token.h' line='88' column='1' elf-symbol-id='_PyParser_TokenNames'/>
+    <type-decl name='int' size-in-bits='32' id='type-id-9'/>
+    <function-decl name='PyToken_ThreeChars' mangled-name='PyToken_ThreeChars' filepath='Parser/token.c' line='194' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyToken_ThreeChars'>
+      <parameter type-id='type-id-9' name='c1' filepath='Parser/token.c' line='194' column='1'/>
+      <parameter type-id='type-id-9' name='c2' filepath='Parser/token.c' line='194' column='1'/>
+      <parameter type-id='type-id-9' name='c3' filepath='Parser/token.c' line='194' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyToken_TwoChars' mangled-name='PyToken_TwoChars' filepath='Parser/token.c' line='110' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyToken_TwoChars'>
+      <parameter type-id='type-id-9' name='c1' filepath='Parser/token.c' line='110' column='1'/>
+      <parameter type-id='type-id-9' name='c2' filepath='Parser/token.c' line='110' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyToken_OneChar' mangled-name='PyToken_OneChar' filepath='Parser/token.c' line='79' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyToken_OneChar'>
+      <parameter type-id='type-id-9' name='c1' filepath='Parser/token.c' line='79' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Parser/pegen.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='_PyAST_Name' mangled-name='_PyAST_Name' filepath='./Include/internal/pycore_ast.h' line='775' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_asdl_expr_seq_new' mangled-name='_Py_asdl_expr_seq_new' filepath='./Include/internal/pycore_ast.h' line='74' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__builtin_memmove' mangled-name='memmove' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_Call' mangled-name='_PyAST_Call' filepath='./Include/internal/pycore_ast.h' line='755' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_Dealloc' mangled-name='_Py_Dealloc' filepath='./Include/object.h' line='447' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyArena_AddPyObject' mangled-name='_PyArena_AddPyObject' filepath='./Include/internal/pycore_pyarena.h' line='59' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='strlen' mangled-name='strlen' filepath='/usr/include/string.h' line='385' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_DecodeUTF8' mangled-name='PyUnicode_DecodeUTF8' filepath='./Include/unicodeobject.h' line='454' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_TypeIgnore' mangled-name='_PyAST_TypeIgnore' filepath='./Include/internal/pycore_ast.h' line='835' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_asdl_type_ignore_seq_new' mangled-name='_Py_asdl_type_ignore_seq_new' filepath='./Include/internal/pycore_ast.h' line='147' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_Module' mangled-name='_PyAST_Module' filepath='./Include/internal/pycore_ast.h' line='628' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_FstringParser_ConcatFstring' mangled-name='_PyPegen_FstringParser_ConcatFstring' filepath='Parser/string_parser.h' line='39' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_parsestr' mangled-name='_PyPegen_parsestr' filepath='Parser/string_parser.h' line='37' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_FstringParser_ConcatAndDel' mangled-name='_PyPegen_FstringParser_ConcatAndDel' filepath='Parser/string_parser.h' line='42' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyBytes_ConcatAndDel' mangled-name='PyBytes_ConcatAndDel' filepath='./Include/bytesobject.h' line='45' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_FstringParser_Init' mangled-name='_PyPegen_FstringParser_Init' filepath='Parser/string_parser.h' line='36' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_Constant' mangled-name='_PyAST_Constant' filepath='./Include/internal/pycore_ast.h' line='763' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_FstringParser_Dealloc' mangled-name='_PyPegen_FstringParser_Dealloc' filepath='Parser/string_parser.h' line='44' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_Occurred' mangled-name='PyErr_Occurred' filepath='./Include/pyerrors.h' line='17' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_FstringParser_Finish' mangled-name='_PyPegen_FstringParser_Finish' filepath='Parser/string_parser.h' line='43' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__stack_chk_fail' mangled-name='__stack_chk_fail' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_asdl_keyword_seq_new' mangled-name='_Py_asdl_keyword_seq_new' filepath='./Include/internal/pycore_ast.h' line='111' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyArena_Malloc' mangled-name='_PyArena_Malloc' filepath='./Include/internal/pycore_pyarena.h' line='53' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_ClassDef' mangled-name='_PyAST_ClassDef' filepath='./Include/internal/pycore_ast.h' line='644' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_FunctionDef' mangled-name='_PyAST_FunctionDef' filepath='./Include/internal/pycore_ast.h' line='634' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_AsyncFunctionDef' mangled-name='_PyAST_AsyncFunctionDef' filepath='./Include/internal/pycore_ast.h' line='639' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_asdl_arg_seq_new' mangled-name='_Py_asdl_arg_seq_new' filepath='./Include/internal/pycore_ast.h' line='104' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_arguments' mangled-name='_PyAST_arguments' filepath='./Include/internal/pycore_ast.h' line='794' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_asdl_generic_seq_new' mangled-name='_Py_asdl_generic_seq_new' filepath='./Include/internal/pycore_asdl.h' line='47' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyBytes_AsString' mangled-name='PyBytes_AsString' filepath='./Include/bytesobject.h' line='42' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_arg' mangled-name='_PyAST_arg' filepath='./Include/internal/pycore_ast.h' line='798' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_asdl_pattern_seq_new' mangled-name='_Py_asdl_pattern_seq_new' filepath='./Include/internal/pycore_ast.h' line='140' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_List' mangled-name='_PyAST_List' filepath='./Include/internal/pycore_ast.h' line='778' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_Tuple' mangled-name='_PyAST_Tuple' filepath='./Include/internal/pycore_ast.h' line='781' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_Attribute' mangled-name='_PyAST_Attribute' filepath='./Include/internal/pycore_ast.h' line='766' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_Subscript' mangled-name='_PyAST_Subscript' filepath='./Include/internal/pycore_ast.h' line='769' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_Starred' mangled-name='_PyAST_Starred' filepath='./Include/internal/pycore_ast.h' line='772' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_asdl_int_seq_new' mangled-name='_Py_asdl_int_seq_new' filepath='./Include/internal/pycore_asdl.h' line='49' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_asdl_identifier_seq_new' mangled-name='_Py_asdl_identifier_seq_new' filepath='./Include/internal/pycore_asdl.h' line='48' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_InternFromString' mangled-name='PyUnicode_InternFromString' filepath='./Include/unicodeobject.h' line='264' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_alias' mangled-name='_PyAST_alias' filepath='./Include/internal/pycore_ast.h' line='804' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__builtin_strcpy' mangled-name='strcpy' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_Ready' mangled-name='_PyUnicode_Ready' filepath='./Include/cpython/unicodeobject.h' line='472' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_AsUTF8' mangled-name='PyUnicode_AsUTF8' filepath='./Include/cpython/unicodeobject.h' line='742' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyBytes_FromStringAndSize' mangled-name='PyBytes_FromStringAndSize' filepath='./Include/bytesobject.h' line='34' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_InternInPlace' mangled-name='PyUnicode_InternInPlace' filepath='./Include/unicodeobject.h' line='263' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyTokenizer_FromString' mangled-name='PyTokenizer_FromString' filepath='Parser/tokenizer.h' line='89' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyTokenizer_Free' mangled-name='PyTokenizer_Free' filepath='Parser/tokenizer.h' line='93' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyTokenizer_FromUTF8' mangled-name='PyTokenizer_FromUTF8' filepath='Parser/tokenizer.h' line='90' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyTokenizer_FromFile' mangled-name='PyTokenizer_FromFile' filepath='Parser/tokenizer.h' line='91' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_CompareWithASCIIString' mangled-name='PyUnicode_CompareWithASCIIString' filepath='./Include/unicodeobject.h' line='996' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_ExceptionMatches' mangled-name='PyErr_ExceptionMatches' filepath='./Include/pyerrors.h' line='35' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyMem_Malloc' mangled-name='PyMem_Malloc' filepath='./Include/pymem.h' line='52' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyMem_Calloc' mangled-name='PyMem_Calloc' filepath='./Include/pymem.h' line='53' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyMem_Free' mangled-name='PyMem_Free' filepath='./Include/pymem.h' line='55' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_NoMemory' mangled-name='PyErr_NoMemory' filepath='./Include/pyerrors.h' line='156' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='strchr' mangled-name='strchr' filepath='/usr/include/string.h' line='226' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__errno_location' mangled-name='__errno_location' filepath='/usr/include/errno.h' line='37' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyOS_strtol' mangled-name='PyOS_strtol' filepath='./Include/longobject.h' line='205' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyLong_FromLong' mangled-name='PyLong_FromLong' filepath='./Include/longobject.h' line='18' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyOS_strtoul' mangled-name='PyOS_strtoul' filepath='./Include/longobject.h' line='204' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyOS_string_to_double' mangled-name='PyOS_string_to_double' filepath='./Include/pystrtod.h' line='9' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyComplex_FromCComplex' mangled-name='PyComplex_FromCComplex' filepath='./Include/complexobject.h' line='45' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyLong_FromString' mangled-name='PyLong_FromString' filepath='./Include/longobject.h' line='103' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyFloat_FromDouble' mangled-name='PyFloat_FromDouble' filepath='./Include/floatobject.h' line='45' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='strncmp' mangled-name='strncmp' filepath='/usr/include/string.h' line='140' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyBytes_AsStringAndSize' mangled-name='PyBytes_AsStringAndSize' filepath='./Include/bytesobject.h' line='54' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='strcmp' mangled-name='strcmp' filepath='/usr/include/string.h' line='137' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyMem_Realloc' mangled-name='PyMem_Realloc' filepath='./Include/pymem.h' line='54' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__builtin_strncpy' mangled-name='strncpy' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyTokenizer_Get' mangled-name='PyTokenizer_Get' filepath='Parser/tokenizer.h' line='94' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_SetNone' mangled-name='PyErr_SetNone' filepath='./Include/pyerrors.h' line='11' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__builtin_memcpy' mangled-name='memcpy' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_FromFormatV' mangled-name='PyUnicode_FromFormatV' filepath='./Include/unicodeobject.h' line='254' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_FromStringAndSize' mangled-name='PyUnicode_FromStringAndSize' filepath='./Include/unicodeobject.h' line='130' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='Py_BuildValue' mangled-name='Py_BuildValue' filepath='./Include/modsupport.h' line='49' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyTuple_Pack' mangled-name='PyTuple_Pack' filepath='./Include/tupleobject.h' line='35' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_SetObject' mangled-name='PyErr_SetObject' filepath='./Include/pyerrors.h' line='12' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_ProgramDecodedTextObject' mangled-name='_PyErr_ProgramDecodedTextObject' filepath='./Include/cpython/pyerrors.h' line='189' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_Fetch' mangled-name='PyErr_Fetch' filepath='./Include/pyerrors.h' line='19' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_Str' mangled-name='PyObject_Str' filepath='./Include/object.h' line='266' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_Clear' mangled-name='PyErr_Clear' filepath='./Include/pyerrors.h' line='18' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_Format' mangled-name='PyErr_Format' filepath='./Include/pyerrors.h' line='169' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyImport_ImportModuleNoBlock' mangled-name='PyImport_ImportModuleNoBlock' filepath='./Include/import.h' line='49' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_GetAttrString' mangled-name='PyObject_GetAttrString' filepath='./Include/object.h' line='271' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObject_MakeTpCall' mangled-name='_PyObject_MakeTpCall' filepath='./Include/cpython/abstract.h' line='47' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_CheckFunctionResult' mangled-name='_Py_CheckFunctionResult' filepath='./Include/cpython/abstract.h' line='36' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyThreadState_Get' mangled-name='PyThreadState_Get' filepath='./Include/pystate.h' line='70' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyType_Name' mangled-name='_PyType_Name' filepath='./Include/cpython/object.h' line='299' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_Restore' mangled-name='PyErr_Restore' filepath='./Include/pyerrors.h' line='20' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_parse' mangled-name='_PyPegen_parse' filepath='Parser/pegen.h' line='334' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Parser/parser.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='_PyPegen_expect_token' mangled-name='_PyPegen_expect_token' filepath='Parser/pegen.h' line='133' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_singleton_seq' mangled-name='_PyPegen_singleton_seq' filepath='Parser/pegen.h' line='257' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_insert_memo' mangled-name='_PyPegen_insert_memo' filepath='Parser/pegen.h' line='123' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_seq_insert_in_front' mangled-name='_PyPegen_seq_insert_in_front' filepath='Parser/pegen.h' line='258' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_seq_append_to_end' mangled-name='_PyPegen_seq_append_to_end' filepath='Parser/pegen.h' line='259' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_FunctionType' mangled-name='_PyAST_FunctionType' filepath='./Include/internal/pycore_ast.h' line='632' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_make_module' mangled-name='_PyPegen_make_module' filepath='Parser/pegen.h' line='296' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_function_def_decorators' mangled-name='_PyPegen_function_def_decorators' filepath='Parser/pegen.h' line='282' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_lookahead' mangled-name='_PyPegen_lookahead' filepath='Parser/pegen.h' line='131' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_lookahead_with_int' mangled-name='_PyPegen_lookahead_with_int' filepath='Parser/pegen.h' line='129' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_class_def_decorators' mangled-name='_PyPegen_class_def_decorators' filepath='Parser/pegen.h' line='283' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_get_last_nonnwhitespace_token' mangled-name='_PyPegen_get_last_nonnwhitespace_token' filepath='Parser/pegen.h' line='137' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_While' mangled-name='_PyAST_While' filepath='./Include/internal/pycore_ast.h' line='670' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_raise_error' mangled-name='_PyPegen_raise_error' filepath='Parser/pegen.h' line='143' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_fill_token' mangled-name='_PyPegen_fill_token' filepath='Parser/pegen.h' line='138' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_Match' mangled-name='_PyAST_Match' filepath='./Include/internal/pycore_ast.h' line='682' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_expect_soft_keyword' mangled-name='_PyPegen_expect_soft_keyword' filepath='Parser/pegen.h' line='135' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_Pass' mangled-name='_PyAST_Pass' filepath='./Include/internal/pycore_ast.h' line='705' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_interactive_exit' mangled-name='_PyPegen_interactive_exit' filepath='Parser/pegen.h' line='256' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_Interactive' mangled-name='_PyAST_Interactive' filepath='./Include/internal/pycore_ast.h' line='630' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_Expression' mangled-name='_PyAST_Expression' filepath='./Include/internal/pycore_ast.h' line='631' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_dummy_name' mangled-name='_PyPegen_dummy_name' filepath='Parser/pegen.h' line='148' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_IfExp' mangled-name='_PyAST_IfExp' filepath='./Include/internal/pycore_ast.h' line='726' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_check_legacy_stmt' mangled-name='_PyPegen_check_legacy_stmt' filepath='Parser/pegen.h' line='295' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_name_token' mangled-name='_PyPegen_name_token' filepath='Parser/pegen.h' line='139' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_is_memoized' mangled-name='_PyPegen_is_memoized' filepath='Parser/pegen.h' line='125' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_string_token' mangled-name='_PyPegen_string_token' filepath='Parser/pegen.h' line='141' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_soft_keyword_token' mangled-name='_PyPegen_soft_keyword_token' filepath='Parser/pegen.h' line='136' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_comprehension' mangled-name='_PyAST_comprehension' filepath='./Include/internal/pycore_ast.h' line='787' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_set_expr_context' mangled-name='_PyPegen_set_expr_context' filepath='Parser/pegen.h' line='268' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_NamedExpr' mangled-name='_PyAST_NamedExpr' filepath='./Include/internal/pycore_ast.h' line='714' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_get_expr_name' mangled-name='_PyPegen_get_expr_name' filepath='Parser/pegen.h' line='142' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_key_pattern_pair' mangled-name='_PyPegen_key_pattern_pair' filepath='Parser/pegen.h' line='272' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_MatchAs' mangled-name='_PyAST_MatchAs' filepath='./Include/internal/pycore_ast.h' line='829' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_lookahead_with_name' mangled-name='_PyPegen_lookahead_with_name' filepath='Parser/pegen.h' line='128' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_match_case' mangled-name='_PyAST_match_case' filepath='./Include/internal/pycore_ast.h' line='809' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_get_invalid_target' mangled-name='_PyPegen_get_invalid_target' filepath='Parser/pegen.h' line='304' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_seq_last_item' mangled-name='_PyPegen_seq_last_item' filepath='Parser/pegen.h' line='150' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_update_memo' mangled-name='_PyPegen_update_memo' filepath='Parser/pegen.h' line='124' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_keyword' mangled-name='_PyAST_keyword' filepath='./Include/internal/pycore_ast.h' line='801' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_keyword_or_starred' mangled-name='_PyPegen_keyword_or_starred' filepath='Parser/pegen.h' line='284' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_join_sequences' mangled-name='_PyPegen_join_sequences' filepath='Parser/pegen.h' line='293' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_collect_call_seqs' mangled-name='_PyPegen_collect_call_seqs' filepath='Parser/pegen.h' line='287' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_seq_delete_starred_exprs' mangled-name='_PyPegen_seq_delete_starred_exprs' filepath='Parser/pegen.h' line='286' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_seq_extract_starred_exprs' mangled-name='_PyPegen_seq_extract_starred_exprs' filepath='Parser/pegen.h' line='285' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_nonparen_genexp_in_call' mangled-name='_PyPegen_nonparen_genexp_in_call' filepath='Parser/pegen.h' line='330' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_arguments_parsing_error' mangled-name='_PyPegen_arguments_parsing_error' filepath='Parser/pegen.h' line='329' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_YieldFrom' mangled-name='_PyAST_YieldFrom' filepath='./Include/internal/pycore_ast.h' line='750' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_Yield' mangled-name='_PyAST_Yield' filepath='./Include/internal/pycore_ast.h' line='748' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_key_value_pair' mangled-name='_PyPegen_key_value_pair' filepath='Parser/pegen.h' line='269' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_GeneratorExp' mangled-name='_PyAST_GeneratorExp' filepath='./Include/internal/pycore_ast.h' line='743' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_concatenate_strings' mangled-name='_PyPegen_concatenate_strings' filepath='Parser/pegen.h' line='290' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_number_token' mangled-name='_PyPegen_number_token' filepath='Parser/pegen.h' line='140' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_ListComp' mangled-name='_PyAST_ListComp' filepath='./Include/internal/pycore_ast.h' line='734' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_SetComp' mangled-name='_PyAST_SetComp' filepath='./Include/internal/pycore_ast.h' line='737' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_get_values' mangled-name='_PyPegen_get_values' filepath='Parser/pegen.h' line='271' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_get_keys' mangled-name='_PyPegen_get_keys' filepath='Parser/pegen.h' line='270' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_Dict' mangled-name='_PyAST_Dict' filepath='./Include/internal/pycore_ast.h' line='729' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_Set' mangled-name='_PyAST_Set' filepath='./Include/internal/pycore_ast.h' line='732' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_DictComp' mangled-name='_PyAST_DictComp' filepath='./Include/internal/pycore_ast.h' line='740' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_Slice' mangled-name='_PyAST_Slice' filepath='./Include/internal/pycore_ast.h' line='784' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_Await' mangled-name='_PyAST_Await' filepath='./Include/internal/pycore_ast.h' line='746' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_UnaryOp' mangled-name='_PyAST_UnaryOp' filepath='./Include/internal/pycore_ast.h' line='720' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_BinOp' mangled-name='_PyAST_BinOp' filepath='./Include/internal/pycore_ast.h' line='717' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_cmpop_expr_pair' mangled-name='_PyPegen_cmpop_expr_pair' filepath='Parser/pegen.h' line='265' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_check_barry_as_flufl' mangled-name='_PyPegen_check_barry_as_flufl' filepath='Parser/pegen.h' line='294' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_get_exprs' mangled-name='_PyPegen_get_exprs' filepath='Parser/pegen.h' line='267' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_get_cmpops' mangled-name='_PyPegen_get_cmpops' filepath='Parser/pegen.h' line='266' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_Compare' mangled-name='_PyAST_Compare' filepath='./Include/internal/pycore_ast.h' line='752' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_BoolOp' mangled-name='_PyAST_BoolOp' filepath='./Include/internal/pycore_ast.h' line='711' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_name_default_pair' mangled-name='_PyPegen_name_default_pair' filepath='Parser/pegen.h' line='275' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_star_etc' mangled-name='_PyPegen_star_etc' filepath='Parser/pegen.h' line='277' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_slash_with_default' mangled-name='_PyPegen_slash_with_default' filepath='Parser/pegen.h' line='276' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_Lambda' mangled-name='_PyAST_Lambda' filepath='./Include/internal/pycore_ast.h' line='723' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_empty_arguments' mangled-name='_PyPegen_empty_arguments' filepath='Parser/pegen.h' line='280' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_make_arguments' mangled-name='_PyPegen_make_arguments' filepath='Parser/pegen.h' line='278' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_expect_forced_token' mangled-name='_PyPegen_expect_forced_token' filepath='Parser/pegen.h' line='134' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_add_type_comment_to_arg' mangled-name='_PyPegen_add_type_comment_to_arg' filepath='Parser/pegen.h' line='248' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_new_type_comment' mangled-name='_PyPegen_new_type_comment' filepath='Parser/pegen.h' line='209' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_get_patterns' mangled-name='_PyPegen_get_patterns' filepath='Parser/pegen.h' line='274' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_get_pattern_keys' mangled-name='_PyPegen_get_pattern_keys' filepath='Parser/pegen.h' line='273' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_map_names_to_ids' mangled-name='_PyPegen_map_names_to_ids' filepath='Parser/pegen.h' line='264' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_MatchClass' mangled-name='_PyAST_MatchClass' filepath='./Include/internal/pycore_ast.h' line='823' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_seq_first_item' mangled-name='_PyPegen_seq_first_item' filepath='Parser/pegen.h' line='153' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_MatchMapping' mangled-name='_PyAST_MatchMapping' filepath='./Include/internal/pycore_ast.h' line='819' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_MatchStar' mangled-name='_PyAST_MatchStar' filepath='./Include/internal/pycore_ast.h' line='827' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_lookahead_with_string' mangled-name='_PyPegen_lookahead_with_string' filepath='Parser/pegen.h' line='130' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_ensure_real' mangled-name='_PyPegen_ensure_real' filepath='Parser/pegen.h' line='292' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_ensure_imaginary' mangled-name='_PyPegen_ensure_imaginary' filepath='Parser/pegen.h' line='291' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_MatchOr' mangled-name='_PyAST_MatchOr' filepath='./Include/internal/pycore_ast.h' line='832' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_MatchValue' mangled-name='_PyAST_MatchValue' filepath='./Include/internal/pycore_ast.h' line='811' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_MatchSingleton' mangled-name='_PyAST_MatchSingleton' filepath='./Include/internal/pycore_ast.h' line='813' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_MatchSequence' mangled-name='_PyAST_MatchSequence' filepath='./Include/internal/pycore_ast.h' line='816' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_Try' mangled-name='_PyAST_Try' filepath='./Include/internal/pycore_ast.h' line='687' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_ExceptHandler' mangled-name='_PyAST_ExceptHandler' filepath='./Include/internal/pycore_ast.h' line='790' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_withitem' mangled-name='_PyAST_withitem' filepath='./Include/internal/pycore_ast.h' line='807' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_With' mangled-name='_PyAST_With' filepath='./Include/internal/pycore_ast.h' line='676' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_AsyncWith' mangled-name='_PyAST_AsyncWith' filepath='./Include/internal/pycore_ast.h' line='679' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_For' mangled-name='_PyAST_For' filepath='./Include/internal/pycore_ast.h' line='662' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_AsyncFor' mangled-name='_PyAST_AsyncFor' filepath='./Include/internal/pycore_ast.h' line='666' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_If' mangled-name='_PyAST_If' filepath='./Include/internal/pycore_ast.h' line='673' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_join_names_with_dot' mangled-name='_PyPegen_join_names_with_dot' filepath='Parser/pegen.h' line='261' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_alias_for_star' mangled-name='_PyPegen_alias_for_star' filepath='Parser/pegen.h' line='263' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_seq_count_dots' mangled-name='_PyPegen_seq_count_dots' filepath='Parser/pegen.h' line='262' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_ImportFrom' mangled-name='_PyAST_ImportFrom' filepath='./Include/internal/pycore_ast.h' line='695' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_augoperator' mangled-name='_PyPegen_augoperator' filepath='Parser/pegen.h' line='281' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_AnnAssign' mangled-name='_PyAST_AnnAssign' filepath='./Include/internal/pycore_ast.h' line='659' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_Assign' mangled-name='_PyAST_Assign' filepath='./Include/internal/pycore_ast.h' line='653' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_AugAssign' mangled-name='_PyAST_AugAssign' filepath='./Include/internal/pycore_ast.h' line='656' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_Expr' mangled-name='_PyAST_Expr' filepath='./Include/internal/pycore_ast.h' line='703' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_Break' mangled-name='_PyAST_Break' filepath='./Include/internal/pycore_ast.h' line='707' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_Continue' mangled-name='_PyAST_Continue' filepath='./Include/internal/pycore_ast.h' line='709' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_Return' mangled-name='_PyAST_Return' filepath='./Include/internal/pycore_ast.h' line='649' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_Raise' mangled-name='_PyAST_Raise' filepath='./Include/internal/pycore_ast.h' line='685' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_Import' mangled-name='_PyAST_Import' filepath='./Include/internal/pycore_ast.h' line='693' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_Delete' mangled-name='_PyAST_Delete' filepath='./Include/internal/pycore_ast.h' line='651' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_Assert' mangled-name='_PyAST_Assert' filepath='./Include/internal/pycore_ast.h' line='691' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_Global' mangled-name='_PyAST_Global' filepath='./Include/internal/pycore_ast.h' line='698' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_Nonlocal' mangled-name='_PyAST_Nonlocal' filepath='./Include/internal/pycore_ast.h' line='700' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_seq_flatten' mangled-name='_PyPegen_seq_flatten' filepath='Parser/pegen.h' line='260' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_raise_error_known_location' mangled-name='_PyPegen_raise_error_known_location' filepath='Parser/pegen.h' line='144' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Parser/string_parser.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='_PyAST_JoinedStr' mangled-name='_PyAST_JoinedStr' filepath='./Include/internal/pycore_ast.h' line='761' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_DecodeUTF8Stateful' mangled-name='PyUnicode_DecodeUTF8Stateful' filepath='./Include/unicodeobject.h' line='460' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_AppendAndDel' mangled-name='PyUnicode_AppendAndDel' filepath='./Include/unicodeobject.h' line='835' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_Parser_New' mangled-name='_PyPegen_Parser_New' filepath='Parser/pegen.h' line='250' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_run_parser' mangled-name='_PyPegen_run_parser' filepath='Parser/pegen.h' line='254' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_Parser_Free' mangled-name='_PyPegen_Parser_Free' filepath='Parser/pegen.h' line='251' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_FormattedValue' mangled-name='_PyAST_FormattedValue' filepath='./Include/internal/pycore_ast.h' line='758' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyBytes_DecodeEscape' mangled-name='_PyBytes_DecodeEscape' filepath='./Include/cpython/bytesobject.h' line='28' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_BadInternalCall' mangled-name='_PyErr_BadInternalCall' filepath='./Include/pyerrors.h' line='212' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_SetString' mangled-name='PyErr_SetString' filepath='./Include/pyerrors.h' line='13' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__builtin___sprintf_chk' mangled-name='__sprintf_chk' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_DecodeUnicodeEscapeInternal' mangled-name='_PyUnicode_DecodeUnicodeEscapeInternal' filepath='./Include/cpython/unicodeobject.h' line='847' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_FromFormat' mangled-name='PyUnicode_FromFormat' filepath='./Include/unicodeobject.h' line='258' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_WarnExplicitObject' mangled-name='PyErr_WarnExplicitObject' filepath='./Include/warnings.h' line='30' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_new_identifier' mangled-name='_PyPegen_new_identifier' filepath='Parser/pegen.h' line='249' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Parser/peg_api.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='PySys_Audit' mangled-name='PySys_Audit' filepath='./Include/cpython/sysmodule.h' line='12' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_run_parser_from_file_pointer' mangled-name='_PyPegen_run_parser_from_file_pointer' filepath='Parser/pegen.h' line='252' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPegen_run_parser_from_string' mangled-name='_PyPegen_run_parser_from_string' filepath='Parser/pegen.h' line='255' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Parser/myreadline.c' comp-dir-path='/src' language='LANG_C99'>
+    <class-decl name='_ts' size-in-bits='2240' is-struct='yes' visibility='default' filepath='./Include/cpython/pystate.h' line='60' column='1' id='type-id-10'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='prev' type-id='type-id-11' visibility='default' filepath='./Include/cpython/pystate.h' line='63' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='next' type-id='type-id-11' visibility='default' filepath='./Include/cpython/pystate.h' line='64' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='interp' type-id='type-id-12' visibility='default' filepath='./Include/cpython/pystate.h' line='65' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='frame' type-id='type-id-13' visibility='default' filepath='./Include/cpython/pystate.h' line='68' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='recursion_depth' type-id='type-id-9' visibility='default' filepath='./Include/cpython/pystate.h' line='69' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='288'>
+        <var-decl name='recursion_headroom' type-id='type-id-9' visibility='default' filepath='./Include/cpython/pystate.h' line='70' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='stackcheck_counter' type-id='type-id-9' visibility='default' filepath='./Include/cpython/pystate.h' line='71' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='352'>
+        <var-decl name='tracing' type-id='type-id-9' visibility='default' filepath='./Include/cpython/pystate.h' line='76' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='384'>
+        <var-decl name='cframe' type-id='type-id-14' visibility='default' filepath='./Include/cpython/pystate.h' line='80' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='448'>
+        <var-decl name='c_profilefunc' type-id='type-id-15' visibility='default' filepath='./Include/cpython/pystate.h' line='82' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='512'>
+        <var-decl name='c_tracefunc' type-id='type-id-15' visibility='default' filepath='./Include/cpython/pystate.h' line='83' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='576'>
+        <var-decl name='c_profileobj' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='84' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='640'>
+        <var-decl name='c_traceobj' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='85' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='704'>
+        <var-decl name='curexc_type' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='88' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='768'>
+        <var-decl name='curexc_value' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='89' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='832'>
+        <var-decl name='curexc_traceback' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='90' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='896'>
+        <var-decl name='exc_state' type-id='type-id-17' visibility='default' filepath='./Include/cpython/pystate.h' line='95' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1152'>
+        <var-decl name='exc_info' type-id='type-id-18' visibility='default' filepath='./Include/cpython/pystate.h' line='99' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1216'>
+        <var-decl name='dict' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='101' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1280'>
+        <var-decl name='gilstate_counter' type-id='type-id-9' visibility='default' filepath='./Include/cpython/pystate.h' line='103' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1344'>
+        <var-decl name='async_exc' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='105' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1408'>
+        <var-decl name='thread_id' type-id='type-id-19' visibility='default' filepath='./Include/cpython/pystate.h' line='106' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1472'>
+        <var-decl name='trash_delete_nesting' type-id='type-id-9' visibility='default' filepath='./Include/cpython/pystate.h' line='108' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1536'>
+        <var-decl name='trash_delete_later' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='109' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1600'>
+        <var-decl name='on_delete' type-id='type-id-20' visibility='default' filepath='./Include/cpython/pystate.h' line='134' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1664'>
+        <var-decl name='on_delete_data' type-id='type-id-21' visibility='default' filepath='./Include/cpython/pystate.h' line='135' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1728'>
+        <var-decl name='coroutine_origin_tracking_depth' type-id='type-id-9' visibility='default' filepath='./Include/cpython/pystate.h' line='137' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1792'>
+        <var-decl name='async_gen_firstiter' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='139' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1856'>
+        <var-decl name='async_gen_finalizer' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='140' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1920'>
+        <var-decl name='context' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='142' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1984'>
+        <var-decl name='context_ver' type-id='type-id-22' visibility='default' filepath='./Include/cpython/pystate.h' line='143' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2048'>
+        <var-decl name='id' type-id='type-id-22' visibility='default' filepath='./Include/cpython/pystate.h' line='146' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2112'>
+        <var-decl name='root_cframe' type-id='type-id-23' visibility='default' filepath='./Include/cpython/pystate.h' line='148' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-10' size-in-bits='64' id='type-id-11'/>
+    <class-decl name='_is' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-24'/>
+    <typedef-decl name='PyInterpreterState' type-id='type-id-24' filepath='./Include/pystate.h' line='22' column='1' id='type-id-25'/>
+    <pointer-type-def type-id='type-id-25' size-in-bits='64' id='type-id-12'/>
+    <class-decl name='_frame' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-26'/>
+    <typedef-decl name='PyFrameObject' type-id='type-id-26' filepath='./Include/pyframe.h' line='12' column='1' id='type-id-27'/>
+    <pointer-type-def type-id='type-id-27' size-in-bits='64' id='type-id-13'/>
+    <class-decl name='_cframe' size-in-bits='128' is-struct='yes' visibility='default' filepath='./Include/cpython/pystate.h' line='30' column='1' id='type-id-28'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='use_tracing' type-id='type-id-9' visibility='default' filepath='./Include/cpython/pystate.h' line='41' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='previous' type-id='type-id-29' visibility='default' filepath='./Include/cpython/pystate.h' line='42' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-28' size-in-bits='64' id='type-id-29'/>
+    <typedef-decl name='CFrame' type-id='type-id-28' filepath='./Include/cpython/pystate.h' line='43' column='1' id='type-id-23'/>
+    <pointer-type-def type-id='type-id-23' size-in-bits='64' id='type-id-14'/>
+    <class-decl name='_object' size-in-bits='128' is-struct='yes' visibility='default' filepath='./Include/object.h' line='105' column='1' id='type-id-30'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='ob_refcnt' type-id='type-id-31' visibility='default' filepath='./Include/object.h' line='107' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='ob_type' type-id='type-id-32' visibility='default' filepath='./Include/object.h' line='108' column='1'/>
+      </data-member>
+    </class-decl>
+    <type-decl name='long int' size-in-bits='64' id='type-id-33'/>
+    <typedef-decl name='__ssize_t' type-id='type-id-33' filepath='/usr/include/x86_64-linux-gnu/bits/types.h' line='193' column='1' id='type-id-34'/>
+    <typedef-decl name='ssize_t' type-id='type-id-34' filepath='/usr/include/stdio.h' line='77' column='1' id='type-id-35'/>
+    <typedef-decl name='Py_ssize_t' type-id='type-id-35' filepath='./Include/pyport.h' line='107' column='1' id='type-id-31'/>
+    <class-decl name='_typeobject' size-in-bits='3264' is-struct='yes' visibility='default' filepath='./Include/cpython/object.h' line='191' column='1' id='type-id-36'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='ob_base' type-id='type-id-37' visibility='default' filepath='./Include/cpython/object.h' line='192' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='tp_name' type-id='type-id-3' visibility='default' filepath='./Include/cpython/object.h' line='193' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='tp_basicsize' type-id='type-id-31' visibility='default' filepath='./Include/cpython/object.h' line='194' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='tp_itemsize' type-id='type-id-31' visibility='default' filepath='./Include/cpython/object.h' line='194' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='384'>
+        <var-decl name='tp_dealloc' type-id='type-id-38' visibility='default' filepath='./Include/cpython/object.h' line='198' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='448'>
+        <var-decl name='tp_vectorcall_offset' type-id='type-id-31' visibility='default' filepath='./Include/cpython/object.h' line='199' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='512'>
+        <var-decl name='tp_getattr' type-id='type-id-39' visibility='default' filepath='./Include/cpython/object.h' line='200' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='576'>
+        <var-decl name='tp_setattr' type-id='type-id-40' visibility='default' filepath='./Include/cpython/object.h' line='201' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='640'>
+        <var-decl name='tp_as_async' type-id='type-id-41' visibility='default' filepath='./Include/cpython/object.h' line='202' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='704'>
+        <var-decl name='tp_repr' type-id='type-id-42' visibility='default' filepath='./Include/cpython/object.h' line='204' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='768'>
+        <var-decl name='tp_as_number' type-id='type-id-43' visibility='default' filepath='./Include/cpython/object.h' line='208' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='832'>
+        <var-decl name='tp_as_sequence' type-id='type-id-44' visibility='default' filepath='./Include/cpython/object.h' line='209' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='896'>
+        <var-decl name='tp_as_mapping' type-id='type-id-45' visibility='default' filepath='./Include/cpython/object.h' line='210' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='960'>
+        <var-decl name='tp_hash' type-id='type-id-46' visibility='default' filepath='./Include/cpython/object.h' line='214' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1024'>
+        <var-decl name='tp_call' type-id='type-id-47' visibility='default' filepath='./Include/cpython/object.h' line='215' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1088'>
+        <var-decl name='tp_str' type-id='type-id-42' visibility='default' filepath='./Include/cpython/object.h' line='216' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1152'>
+        <var-decl name='tp_getattro' type-id='type-id-48' visibility='default' filepath='./Include/cpython/object.h' line='217' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1216'>
+        <var-decl name='tp_setattro' type-id='type-id-49' visibility='default' filepath='./Include/cpython/object.h' line='218' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1280'>
+        <var-decl name='tp_as_buffer' type-id='type-id-50' visibility='default' filepath='./Include/cpython/object.h' line='221' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1344'>
+        <var-decl name='tp_flags' type-id='type-id-19' visibility='default' filepath='./Include/cpython/object.h' line='224' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1408'>
+        <var-decl name='tp_doc' type-id='type-id-3' visibility='default' filepath='./Include/cpython/object.h' line='226' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1472'>
+        <var-decl name='tp_traverse' type-id='type-id-51' visibility='default' filepath='./Include/cpython/object.h' line='230' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1536'>
+        <var-decl name='tp_clear' type-id='type-id-52' visibility='default' filepath='./Include/cpython/object.h' line='233' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1600'>
+        <var-decl name='tp_richcompare' type-id='type-id-53' visibility='default' filepath='./Include/cpython/object.h' line='237' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1664'>
+        <var-decl name='tp_weaklistoffset' type-id='type-id-31' visibility='default' filepath='./Include/cpython/object.h' line='240' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1728'>
+        <var-decl name='tp_iter' type-id='type-id-54' visibility='default' filepath='./Include/cpython/object.h' line='243' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1792'>
+        <var-decl name='tp_iternext' type-id='type-id-55' visibility='default' filepath='./Include/cpython/object.h' line='244' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1856'>
+        <var-decl name='tp_methods' type-id='type-id-56' visibility='default' filepath='./Include/cpython/object.h' line='247' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1920'>
+        <var-decl name='tp_members' type-id='type-id-57' visibility='default' filepath='./Include/cpython/object.h' line='248' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1984'>
+        <var-decl name='tp_getset' type-id='type-id-58' visibility='default' filepath='./Include/cpython/object.h' line='249' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2048'>
+        <var-decl name='tp_base' type-id='type-id-59' visibility='default' filepath='./Include/cpython/object.h' line='251' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2112'>
+        <var-decl name='tp_dict' type-id='type-id-16' visibility='default' filepath='./Include/cpython/object.h' line='252' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2176'>
+        <var-decl name='tp_descr_get' type-id='type-id-60' visibility='default' filepath='./Include/cpython/object.h' line='253' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2240'>
+        <var-decl name='tp_descr_set' type-id='type-id-61' visibility='default' filepath='./Include/cpython/object.h' line='254' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2304'>
+        <var-decl name='tp_dictoffset' type-id='type-id-31' visibility='default' filepath='./Include/cpython/object.h' line='255' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2368'>
+        <var-decl name='tp_init' type-id='type-id-62' visibility='default' filepath='./Include/cpython/object.h' line='256' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2432'>
+        <var-decl name='tp_alloc' type-id='type-id-63' visibility='default' filepath='./Include/cpython/object.h' line='257' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2496'>
+        <var-decl name='tp_new' type-id='type-id-64' visibility='default' filepath='./Include/cpython/object.h' line='258' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2560'>
+        <var-decl name='tp_free' type-id='type-id-65' visibility='default' filepath='./Include/cpython/object.h' line='259' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2624'>
+        <var-decl name='tp_is_gc' type-id='type-id-52' visibility='default' filepath='./Include/cpython/object.h' line='260' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2688'>
+        <var-decl name='tp_bases' type-id='type-id-16' visibility='default' filepath='./Include/cpython/object.h' line='261' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2752'>
+        <var-decl name='tp_mro' type-id='type-id-16' visibility='default' filepath='./Include/cpython/object.h' line='262' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2816'>
+        <var-decl name='tp_cache' type-id='type-id-16' visibility='default' filepath='./Include/cpython/object.h' line='263' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2880'>
+        <var-decl name='tp_subclasses' type-id='type-id-16' visibility='default' filepath='./Include/cpython/object.h' line='264' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2944'>
+        <var-decl name='tp_weaklist' type-id='type-id-16' visibility='default' filepath='./Include/cpython/object.h' line='265' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='3008'>
+        <var-decl name='tp_del' type-id='type-id-38' visibility='default' filepath='./Include/cpython/object.h' line='266' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='3072'>
+        <var-decl name='tp_version_tag' type-id='type-id-66' visibility='default' filepath='./Include/cpython/object.h' line='269' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='3136'>
+        <var-decl name='tp_finalize' type-id='type-id-38' visibility='default' filepath='./Include/cpython/object.h' line='271' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='3200'>
+        <var-decl name='tp_vectorcall' type-id='type-id-67' visibility='default' filepath='./Include/cpython/object.h' line='272' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-37' visibility='default' filepath='./Include/object.h' line='115' column='1' id='type-id-68'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='ob_base' type-id='type-id-69' visibility='default' filepath='./Include/object.h' line='116' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='ob_size' type-id='type-id-31' visibility='default' filepath='./Include/object.h' line='117' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='PyObject' type-id='type-id-30' filepath='./Include/object.h' line='109' column='1' id='type-id-69'/>
+    <typedef-decl name='PyVarObject' type-id='type-id-68' filepath='./Include/object.h' line='118' column='1' id='type-id-37'/>
+    <pointer-type-def type-id='type-id-69' size-in-bits='64' id='type-id-16'/>
+    <pointer-type-def type-id='type-id-70' size-in-bits='64' id='type-id-71'/>
+    <typedef-decl name='destructor' type-id='type-id-71' filepath='./Include/object.h' line='201' column='1' id='type-id-38'/>
+    <pointer-type-def type-id='type-id-1' size-in-bits='64' id='type-id-72'/>
+    <pointer-type-def type-id='type-id-73' size-in-bits='64' id='type-id-74'/>
+    <typedef-decl name='getattrfunc' type-id='type-id-74' filepath='./Include/object.h' line='202' column='1' id='type-id-39'/>
+    <pointer-type-def type-id='type-id-75' size-in-bits='64' id='type-id-76'/>
+    <typedef-decl name='setattrfunc' type-id='type-id-76' filepath='./Include/object.h' line='204' column='1' id='type-id-40'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='256' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-77' visibility='default' filepath='./Include/cpython/object.h' line='173' column='1' id='type-id-78'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='am_await' type-id='type-id-79' visibility='default' filepath='./Include/cpython/object.h' line='174' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='am_aiter' type-id='type-id-79' visibility='default' filepath='./Include/cpython/object.h' line='175' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='am_anext' type-id='type-id-79' visibility='default' filepath='./Include/cpython/object.h' line='176' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='am_send' type-id='type-id-80' visibility='default' filepath='./Include/cpython/object.h' line='177' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-81' size-in-bits='64' id='type-id-82'/>
+    <typedef-decl name='unaryfunc' type-id='type-id-82' filepath='./Include/object.h' line='184' column='1' id='type-id-79'/>
+    <type-decl name='unnamed-enum-underlying-type' is-anonymous='yes' size-in-bits='32' alignment-in-bits='32' id='type-id-83'/>
+    <enum-decl name='__anonymous_enum__' is-anonymous='yes' filepath='./Include/object.h' line='635' column='1' id='type-id-84'>
+      <underlying-type type-id='type-id-83'/>
+      <enumerator name='PYGEN_RETURN' value='0'/>
+      <enumerator name='PYGEN_ERROR' value='-1'/>
+      <enumerator name='PYGEN_NEXT' value='1'/>
+    </enum-decl>
+    <typedef-decl name='PySendResult' type-id='type-id-84' filepath='./Include/object.h' line='639' column='1' id='type-id-85'/>
+    <pointer-type-def type-id='type-id-16' size-in-bits='64' id='type-id-86'/>
+    <pointer-type-def type-id='type-id-87' size-in-bits='64' id='type-id-88'/>
+    <typedef-decl name='sendfunc' type-id='type-id-88' filepath='./Include/cpython/object.h' line='171' column='1' id='type-id-80'/>
+    <typedef-decl name='PyAsyncMethods' type-id='type-id-78' filepath='./Include/cpython/object.h' line='178' column='1' id='type-id-77'/>
+    <pointer-type-def type-id='type-id-77' size-in-bits='64' id='type-id-41'/>
+    <typedef-decl name='reprfunc' type-id='type-id-82' filepath='./Include/object.h' line='206' column='1' id='type-id-42'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='2304' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-89' visibility='default' filepath='./Include/cpython/object.h' line='104' column='1' id='type-id-90'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='nb_add' type-id='type-id-91' visibility='default' filepath='./Include/cpython/object.h' line='109' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='nb_subtract' type-id='type-id-91' visibility='default' filepath='./Include/cpython/object.h' line='110' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='nb_multiply' type-id='type-id-91' visibility='default' filepath='./Include/cpython/object.h' line='111' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='nb_remainder' type-id='type-id-91' visibility='default' filepath='./Include/cpython/object.h' line='112' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='nb_divmod' type-id='type-id-91' visibility='default' filepath='./Include/cpython/object.h' line='113' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='nb_power' type-id='type-id-47' visibility='default' filepath='./Include/cpython/object.h' line='114' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='384'>
+        <var-decl name='nb_negative' type-id='type-id-79' visibility='default' filepath='./Include/cpython/object.h' line='115' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='448'>
+        <var-decl name='nb_positive' type-id='type-id-79' visibility='default' filepath='./Include/cpython/object.h' line='116' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='512'>
+        <var-decl name='nb_absolute' type-id='type-id-79' visibility='default' filepath='./Include/cpython/object.h' line='117' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='576'>
+        <var-decl name='nb_bool' type-id='type-id-52' visibility='default' filepath='./Include/cpython/object.h' line='118' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='640'>
+        <var-decl name='nb_invert' type-id='type-id-79' visibility='default' filepath='./Include/cpython/object.h' line='119' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='704'>
+        <var-decl name='nb_lshift' type-id='type-id-91' visibility='default' filepath='./Include/cpython/object.h' line='120' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='768'>
+        <var-decl name='nb_rshift' type-id='type-id-91' visibility='default' filepath='./Include/cpython/object.h' line='121' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='832'>
+        <var-decl name='nb_and' type-id='type-id-91' visibility='default' filepath='./Include/cpython/object.h' line='122' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='896'>
+        <var-decl name='nb_xor' type-id='type-id-91' visibility='default' filepath='./Include/cpython/object.h' line='123' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='960'>
+        <var-decl name='nb_or' type-id='type-id-91' visibility='default' filepath='./Include/cpython/object.h' line='124' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1024'>
+        <var-decl name='nb_int' type-id='type-id-79' visibility='default' filepath='./Include/cpython/object.h' line='125' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1088'>
+        <var-decl name='nb_reserved' type-id='type-id-21' visibility='default' filepath='./Include/cpython/object.h' line='126' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1152'>
+        <var-decl name='nb_float' type-id='type-id-79' visibility='default' filepath='./Include/cpython/object.h' line='127' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1216'>
+        <var-decl name='nb_inplace_add' type-id='type-id-91' visibility='default' filepath='./Include/cpython/object.h' line='129' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1280'>
+        <var-decl name='nb_inplace_subtract' type-id='type-id-91' visibility='default' filepath='./Include/cpython/object.h' line='130' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1344'>
+        <var-decl name='nb_inplace_multiply' type-id='type-id-91' visibility='default' filepath='./Include/cpython/object.h' line='131' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1408'>
+        <var-decl name='nb_inplace_remainder' type-id='type-id-91' visibility='default' filepath='./Include/cpython/object.h' line='132' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1472'>
+        <var-decl name='nb_inplace_power' type-id='type-id-47' visibility='default' filepath='./Include/cpython/object.h' line='133' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1536'>
+        <var-decl name='nb_inplace_lshift' type-id='type-id-91' visibility='default' filepath='./Include/cpython/object.h' line='134' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1600'>
+        <var-decl name='nb_inplace_rshift' type-id='type-id-91' visibility='default' filepath='./Include/cpython/object.h' line='135' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1664'>
+        <var-decl name='nb_inplace_and' type-id='type-id-91' visibility='default' filepath='./Include/cpython/object.h' line='136' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1728'>
+        <var-decl name='nb_inplace_xor' type-id='type-id-91' visibility='default' filepath='./Include/cpython/object.h' line='137' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1792'>
+        <var-decl name='nb_inplace_or' type-id='type-id-91' visibility='default' filepath='./Include/cpython/object.h' line='138' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1856'>
+        <var-decl name='nb_floor_divide' type-id='type-id-91' visibility='default' filepath='./Include/cpython/object.h' line='140' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1920'>
+        <var-decl name='nb_true_divide' type-id='type-id-91' visibility='default' filepath='./Include/cpython/object.h' line='141' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1984'>
+        <var-decl name='nb_inplace_floor_divide' type-id='type-id-91' visibility='default' filepath='./Include/cpython/object.h' line='142' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2048'>
+        <var-decl name='nb_inplace_true_divide' type-id='type-id-91' visibility='default' filepath='./Include/cpython/object.h' line='143' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2112'>
+        <var-decl name='nb_index' type-id='type-id-79' visibility='default' filepath='./Include/cpython/object.h' line='145' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2176'>
+        <var-decl name='nb_matrix_multiply' type-id='type-id-91' visibility='default' filepath='./Include/cpython/object.h' line='147' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2240'>
+        <var-decl name='nb_inplace_matrix_multiply' type-id='type-id-91' visibility='default' filepath='./Include/cpython/object.h' line='148' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-92' size-in-bits='64' id='type-id-93'/>
+    <typedef-decl name='binaryfunc' type-id='type-id-93' filepath='./Include/object.h' line='185' column='1' id='type-id-91'/>
+    <pointer-type-def type-id='type-id-94' size-in-bits='64' id='type-id-95'/>
+    <typedef-decl name='ternaryfunc' type-id='type-id-95' filepath='./Include/object.h' line='186' column='1' id='type-id-47'/>
+    <pointer-type-def type-id='type-id-96' size-in-bits='64' id='type-id-97'/>
+    <typedef-decl name='inquiry' type-id='type-id-97' filepath='./Include/object.h' line='187' column='1' id='type-id-52'/>
+    <pointer-type-def type-id='type-id-4' size-in-bits='64' id='type-id-21'/>
+    <typedef-decl name='PyNumberMethods' type-id='type-id-90' filepath='./Include/cpython/object.h' line='149' column='1' id='type-id-89'/>
+    <pointer-type-def type-id='type-id-89' size-in-bits='64' id='type-id-43'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='640' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-98' visibility='default' filepath='./Include/cpython/object.h' line='151' column='1' id='type-id-99'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='sq_length' type-id='type-id-100' visibility='default' filepath='./Include/cpython/object.h' line='152' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='sq_concat' type-id='type-id-91' visibility='default' filepath='./Include/cpython/object.h' line='153' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='sq_repeat' type-id='type-id-101' visibility='default' filepath='./Include/cpython/object.h' line='154' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='sq_item' type-id='type-id-101' visibility='default' filepath='./Include/cpython/object.h' line='155' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='was_sq_slice' type-id='type-id-21' visibility='default' filepath='./Include/cpython/object.h' line='156' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='sq_ass_item' type-id='type-id-102' visibility='default' filepath='./Include/cpython/object.h' line='157' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='384'>
+        <var-decl name='was_sq_ass_slice' type-id='type-id-21' visibility='default' filepath='./Include/cpython/object.h' line='158' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='448'>
+        <var-decl name='sq_contains' type-id='type-id-103' visibility='default' filepath='./Include/cpython/object.h' line='159' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='512'>
+        <var-decl name='sq_inplace_concat' type-id='type-id-91' visibility='default' filepath='./Include/cpython/object.h' line='161' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='576'>
+        <var-decl name='sq_inplace_repeat' type-id='type-id-101' visibility='default' filepath='./Include/cpython/object.h' line='162' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-104' size-in-bits='64' id='type-id-105'/>
+    <typedef-decl name='lenfunc' type-id='type-id-105' filepath='./Include/object.h' line='188' column='1' id='type-id-100'/>
+    <pointer-type-def type-id='type-id-106' size-in-bits='64' id='type-id-107'/>
+    <typedef-decl name='ssizeargfunc' type-id='type-id-107' filepath='./Include/object.h' line='189' column='1' id='type-id-101'/>
+    <pointer-type-def type-id='type-id-108' size-in-bits='64' id='type-id-109'/>
+    <typedef-decl name='ssizeobjargproc' type-id='type-id-109' filepath='./Include/object.h' line='191' column='1' id='type-id-102'/>
+    <pointer-type-def type-id='type-id-110' size-in-bits='64' id='type-id-111'/>
+    <typedef-decl name='objobjproc' type-id='type-id-111' filepath='./Include/object.h' line='195' column='1' id='type-id-103'/>
+    <typedef-decl name='PySequenceMethods' type-id='type-id-99' filepath='./Include/cpython/object.h' line='163' column='1' id='type-id-98'/>
+    <pointer-type-def type-id='type-id-98' size-in-bits='64' id='type-id-44'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-112' visibility='default' filepath='./Include/cpython/object.h' line='165' column='1' id='type-id-113'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='mp_length' type-id='type-id-100' visibility='default' filepath='./Include/cpython/object.h' line='166' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='mp_subscript' type-id='type-id-91' visibility='default' filepath='./Include/cpython/object.h' line='167' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='mp_ass_subscript' type-id='type-id-114' visibility='default' filepath='./Include/cpython/object.h' line='168' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-115' size-in-bits='64' id='type-id-116'/>
+    <typedef-decl name='objobjargproc' type-id='type-id-116' filepath='./Include/object.h' line='193' column='1' id='type-id-114'/>
+    <typedef-decl name='PyMappingMethods' type-id='type-id-113' filepath='./Include/cpython/object.h' line='169' column='1' id='type-id-112'/>
+    <pointer-type-def type-id='type-id-112' size-in-bits='64' id='type-id-45'/>
+    <typedef-decl name='Py_hash_t' type-id='type-id-31' filepath='./Include/pyport.h' line='116' column='1' id='type-id-117'/>
+    <pointer-type-def type-id='type-id-118' size-in-bits='64' id='type-id-119'/>
+    <typedef-decl name='hashfunc' type-id='type-id-119' filepath='./Include/object.h' line='207' column='1' id='type-id-46'/>
+    <typedef-decl name='getattrofunc' type-id='type-id-93' filepath='./Include/object.h' line='203' column='1' id='type-id-48'/>
+    <typedef-decl name='setattrofunc' type-id='type-id-116' filepath='./Include/object.h' line='205' column='1' id='type-id-49'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='128' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-120' visibility='default' filepath='./Include/cpython/object.h' line='180' column='1' id='type-id-121'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='bf_getbuffer' type-id='type-id-122' visibility='default' filepath='./Include/cpython/object.h' line='181' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='bf_releasebuffer' type-id='type-id-123' visibility='default' filepath='./Include/cpython/object.h' line='182' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='bufferinfo' size-in-bits='640' is-struct='yes' visibility='default' filepath='./Include/cpython/object.h' line='49' column='1' id='type-id-124'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='buf' type-id='type-id-21' visibility='default' filepath='./Include/cpython/object.h' line='50' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='obj' type-id='type-id-16' visibility='default' filepath='./Include/cpython/object.h' line='51' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='len' type-id='type-id-31' visibility='default' filepath='./Include/cpython/object.h' line='52' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='itemsize' type-id='type-id-31' visibility='default' filepath='./Include/cpython/object.h' line='53' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='readonly' type-id='type-id-9' visibility='default' filepath='./Include/cpython/object.h' line='55' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='288'>
+        <var-decl name='ndim' type-id='type-id-9' visibility='default' filepath='./Include/cpython/object.h' line='56' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='format' type-id='type-id-72' visibility='default' filepath='./Include/cpython/object.h' line='57' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='384'>
+        <var-decl name='shape' type-id='type-id-125' visibility='default' filepath='./Include/cpython/object.h' line='58' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='448'>
+        <var-decl name='strides' type-id='type-id-125' visibility='default' filepath='./Include/cpython/object.h' line='59' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='512'>
+        <var-decl name='suboffsets' type-id='type-id-125' visibility='default' filepath='./Include/cpython/object.h' line='60' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='576'>
+        <var-decl name='internal' type-id='type-id-21' visibility='default' filepath='./Include/cpython/object.h' line='61' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-31' size-in-bits='64' id='type-id-125'/>
+    <typedef-decl name='Py_buffer' type-id='type-id-124' filepath='./Include/cpython/object.h' line='62' column='1' id='type-id-126'/>
+    <pointer-type-def type-id='type-id-126' size-in-bits='64' id='type-id-127'/>
+    <pointer-type-def type-id='type-id-128' size-in-bits='64' id='type-id-129'/>
+    <typedef-decl name='getbufferproc' type-id='type-id-129' filepath='./Include/cpython/object.h' line='64' column='1' id='type-id-122'/>
+    <pointer-type-def type-id='type-id-130' size-in-bits='64' id='type-id-131'/>
+    <typedef-decl name='releasebufferproc' type-id='type-id-131' filepath='./Include/cpython/object.h' line='65' column='1' id='type-id-123'/>
+    <typedef-decl name='PyBufferProcs' type-id='type-id-121' filepath='./Include/cpython/object.h' line='183' column='1' id='type-id-120'/>
+    <pointer-type-def type-id='type-id-120' size-in-bits='64' id='type-id-50'/>
+    <type-decl name='unsigned long int' size-in-bits='64' id='type-id-19'/>
+    <pointer-type-def type-id='type-id-132' size-in-bits='64' id='type-id-133'/>
+    <typedef-decl name='visitproc' type-id='type-id-133' filepath='./Include/object.h' line='196' column='1' id='type-id-134'/>
+    <pointer-type-def type-id='type-id-135' size-in-bits='64' id='type-id-136'/>
+    <typedef-decl name='traverseproc' type-id='type-id-136' filepath='./Include/object.h' line='197' column='1' id='type-id-51'/>
+    <pointer-type-def type-id='type-id-137' size-in-bits='64' id='type-id-138'/>
+    <typedef-decl name='richcmpfunc' type-id='type-id-138' filepath='./Include/object.h' line='208' column='1' id='type-id-53'/>
+    <typedef-decl name='getiterfunc' type-id='type-id-82' filepath='./Include/object.h' line='209' column='1' id='type-id-54'/>
+    <typedef-decl name='iternextfunc' type-id='type-id-82' filepath='./Include/object.h' line='210' column='1' id='type-id-55'/>
+    <class-decl name='PyMethodDef' size-in-bits='256' is-struct='yes' visibility='default' filepath='./Include/methodobject.h' line='35' column='1' id='type-id-139'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='ml_name' type-id='type-id-3' visibility='default' filepath='./Include/methodobject.h' line='36' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='ml_meth' type-id='type-id-140' visibility='default' filepath='./Include/methodobject.h' line='37' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='ml_flags' type-id='type-id-9' visibility='default' filepath='./Include/methodobject.h' line='38' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='ml_doc' type-id='type-id-3' visibility='default' filepath='./Include/methodobject.h' line='40' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='PyCFunction' type-id='type-id-93' filepath='./Include/methodobject.h' line='19' column='1' id='type-id-140'/>
+    <pointer-type-def type-id='type-id-139' size-in-bits='64' id='type-id-56'/>
+    <class-decl name='PyMemberDef' size-in-bits='320' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-141'/>
+    <pointer-type-def type-id='type-id-141' size-in-bits='64' id='type-id-57'/>
+    <class-decl name='PyGetSetDef' size-in-bits='320' is-struct='yes' visibility='default' filepath='./Include/descrobject.h' line='11' column='1' id='type-id-142'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='name' type-id='type-id-3' visibility='default' filepath='./Include/descrobject.h' line='12' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='get' type-id='type-id-143' visibility='default' filepath='./Include/descrobject.h' line='13' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='set' type-id='type-id-144' visibility='default' filepath='./Include/descrobject.h' line='14' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='doc' type-id='type-id-3' visibility='default' filepath='./Include/descrobject.h' line='15' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='closure' type-id='type-id-21' visibility='default' filepath='./Include/descrobject.h' line='16' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-145' size-in-bits='64' id='type-id-146'/>
+    <typedef-decl name='getter' type-id='type-id-146' filepath='./Include/descrobject.h' line='8' column='1' id='type-id-143'/>
+    <pointer-type-def type-id='type-id-147' size-in-bits='64' id='type-id-148'/>
+    <typedef-decl name='setter' type-id='type-id-148' filepath='./Include/descrobject.h' line='9' column='1' id='type-id-144'/>
+    <pointer-type-def type-id='type-id-142' size-in-bits='64' id='type-id-58'/>
+    <pointer-type-def type-id='type-id-36' size-in-bits='64' id='type-id-59'/>
+    <typedef-decl name='descrgetfunc' type-id='type-id-95' filepath='./Include/object.h' line='211' column='1' id='type-id-60'/>
+    <typedef-decl name='descrsetfunc' type-id='type-id-116' filepath='./Include/object.h' line='212' column='1' id='type-id-61'/>
+    <typedef-decl name='initproc' type-id='type-id-116' filepath='./Include/object.h' line='213' column='1' id='type-id-62'/>
+    <typedef-decl name='PyTypeObject' type-id='type-id-36' filepath='./Include/object.h' line='66' column='1' id='type-id-149'/>
+    <pointer-type-def type-id='type-id-149' size-in-bits='64' id='type-id-32'/>
+    <pointer-type-def type-id='type-id-150' size-in-bits='64' id='type-id-151'/>
+    <typedef-decl name='allocfunc' type-id='type-id-151' filepath='./Include/object.h' line='215' column='1' id='type-id-63'/>
+    <pointer-type-def type-id='type-id-152' size-in-bits='64' id='type-id-153'/>
+    <typedef-decl name='newfunc' type-id='type-id-153' filepath='./Include/object.h' line='214' column='1' id='type-id-64'/>
+    <pointer-type-def type-id='type-id-154' size-in-bits='64' id='type-id-20'/>
+    <typedef-decl name='freefunc' type-id='type-id-20' filepath='./Include/object.h' line='200' column='1' id='type-id-65'/>
+    <type-decl name='unsigned int' size-in-bits='32' id='type-id-66'/>
+    <qualified-type-def type-id='type-id-16' const='yes' id='type-id-155'/>
+    <pointer-type-def type-id='type-id-155' size-in-bits='64' id='type-id-156'/>
+    <typedef-decl name='size_t' type-id='type-id-19' filepath='/usr/lib/gcc/x86_64-linux-gnu/9/include/stddef.h' line='209' column='1' id='type-id-157'/>
+    <pointer-type-def type-id='type-id-158' size-in-bits='64' id='type-id-159'/>
+    <typedef-decl name='vectorcallfunc' type-id='type-id-159' filepath='./Include/cpython/object.h' line='67' column='1' id='type-id-67'/>
+    <pointer-type-def type-id='type-id-160' size-in-bits='64' id='type-id-161'/>
+    <typedef-decl name='Py_tracefunc' type-id='type-id-161' filepath='./Include/cpython/pystate.h' line='13' column='1' id='type-id-15'/>
+    <class-decl name='_err_stackitem' size-in-bits='256' is-struct='yes' visibility='default' filepath='./Include/cpython/pystate.h' line='45' column='1' id='type-id-162'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='exc_type' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='52' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='exc_value' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='52' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='exc_traceback' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='52' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='previous_item' type-id='type-id-163' visibility='default' filepath='./Include/cpython/pystate.h' line='54' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-162' size-in-bits='64' id='type-id-163'/>
+    <typedef-decl name='_PyErr_StackItem' type-id='type-id-162' filepath='./Include/cpython/pystate.h' line='56' column='1' id='type-id-17'/>
+    <pointer-type-def type-id='type-id-17' size-in-bits='64' id='type-id-18'/>
+    <typedef-decl name='__uint64_t' type-id='type-id-19' filepath='/usr/include/x86_64-linux-gnu/bits/types.h' line='45' column='1' id='type-id-164'/>
+    <typedef-decl name='uint64_t' type-id='type-id-164' filepath='/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h' line='27' column='1' id='type-id-22'/>
+    <typedef-decl name='PyThreadState' type-id='type-id-10' filepath='./Include/pystate.h' line='20' column='1' id='type-id-165'/>
+    <pointer-type-def type-id='type-id-165' size-in-bits='64' id='type-id-166'/>
+    <var-decl name='_PyOS_ReadlineTState' type-id='type-id-166' mangled-name='_PyOS_ReadlineTState' visibility='default' filepath='./Include/cpython/pythonrun.h' line='120' column='1' elf-symbol-id='_PyOS_ReadlineTState'/>
+    <pointer-type-def type-id='type-id-167' size-in-bits='64' id='type-id-168'/>
+    <var-decl name='PyOS_InputHook' type-id='type-id-168' mangled-name='PyOS_InputHook' visibility='default' filepath='./Include/pythonrun.h' line='18' column='1' elf-symbol-id='PyOS_InputHook'/>
+    <class-decl name='_IO_FILE' size-in-bits='1728' is-struct='yes' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h' line='49' column='1' id='type-id-169'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='_flags' type-id='type-id-9' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h' line='51' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='_IO_read_ptr' type-id='type-id-72' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h' line='54' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='_IO_read_end' type-id='type-id-72' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h' line='55' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='_IO_read_base' type-id='type-id-72' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h' line='56' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='_IO_write_base' type-id='type-id-72' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h' line='57' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='_IO_write_ptr' type-id='type-id-72' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h' line='58' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='384'>
+        <var-decl name='_IO_write_end' type-id='type-id-72' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h' line='59' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='448'>
+        <var-decl name='_IO_buf_base' type-id='type-id-72' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h' line='60' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='512'>
+        <var-decl name='_IO_buf_end' type-id='type-id-72' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h' line='61' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='576'>
+        <var-decl name='_IO_save_base' type-id='type-id-72' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h' line='64' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='640'>
+        <var-decl name='_IO_backup_base' type-id='type-id-72' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h' line='65' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='704'>
+        <var-decl name='_IO_save_end' type-id='type-id-72' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h' line='66' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='768'>
+        <var-decl name='_markers' type-id='type-id-170' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h' line='68' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='832'>
+        <var-decl name='_chain' type-id='type-id-171' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h' line='70' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='896'>
+        <var-decl name='_fileno' type-id='type-id-9' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h' line='72' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='928'>
+        <var-decl name='_flags2' type-id='type-id-9' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h' line='73' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='960'>
+        <var-decl name='_old_offset' type-id='type-id-172' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h' line='74' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1024'>
+        <var-decl name='_cur_column' type-id='type-id-173' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h' line='77' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1040'>
+        <var-decl name='_vtable_offset' type-id='type-id-174' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h' line='78' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1048'>
+        <var-decl name='_shortbuf' type-id='type-id-175' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h' line='79' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1088'>
+        <var-decl name='_lock' type-id='type-id-176' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h' line='81' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1152'>
+        <var-decl name='_offset' type-id='type-id-177' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h' line='89' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1216'>
+        <var-decl name='_codecvt' type-id='type-id-178' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h' line='91' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1280'>
+        <var-decl name='_wide_data' type-id='type-id-179' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h' line='92' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1344'>
+        <var-decl name='_freeres_list' type-id='type-id-171' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h' line='93' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1408'>
+        <var-decl name='_freeres_buf' type-id='type-id-21' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h' line='94' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1472'>
+        <var-decl name='__pad5' type-id='type-id-157' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h' line='95' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1536'>
+        <var-decl name='_mode' type-id='type-id-9' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h' line='96' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1568'>
+        <var-decl name='_unused2' type-id='type-id-180' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h' line='98' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='_IO_marker' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-181'/>
+    <pointer-type-def type-id='type-id-181' size-in-bits='64' id='type-id-170'/>
+    <pointer-type-def type-id='type-id-169' size-in-bits='64' id='type-id-171'/>
+    <typedef-decl name='__off_t' type-id='type-id-33' filepath='/usr/include/x86_64-linux-gnu/bits/types.h' line='152' column='1' id='type-id-172'/>
+    <type-decl name='unsigned short int' size-in-bits='16' id='type-id-173'/>
+    <type-decl name='signed char' size-in-bits='8' id='type-id-174'/>
+
+    <array-type-def dimensions='1' type-id='type-id-1' size-in-bits='8' id='type-id-175'>
+      <subrange length='1' type-id='type-id-19' id='type-id-182'/>
+
+    </array-type-def>
+    <typedef-decl name='_IO_lock_t' type-id='type-id-4' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h' line='43' column='1' id='type-id-183'/>
+    <pointer-type-def type-id='type-id-183' size-in-bits='64' id='type-id-176'/>
+    <typedef-decl name='__off64_t' type-id='type-id-33' filepath='/usr/include/x86_64-linux-gnu/bits/types.h' line='153' column='1' id='type-id-177'/>
+    <class-decl name='_IO_codecvt' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-184'/>
+    <pointer-type-def type-id='type-id-184' size-in-bits='64' id='type-id-178'/>
+    <class-decl name='_IO_wide_data' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-185'/>
+    <pointer-type-def type-id='type-id-185' size-in-bits='64' id='type-id-179'/>
+
+    <array-type-def dimensions='1' type-id='type-id-1' size-in-bits='160' id='type-id-180'>
+      <subrange length='20' type-id='type-id-19' id='type-id-186'/>
+
+    </array-type-def>
+    <typedef-decl name='FILE' type-id='type-id-169' filepath='/usr/include/x86_64-linux-gnu/bits/types/FILE.h' line='7' column='1' id='type-id-187'/>
+    <pointer-type-def type-id='type-id-187' size-in-bits='64' id='type-id-188'/>
+    <pointer-type-def type-id='type-id-189' size-in-bits='64' id='type-id-190'/>
+    <var-decl name='PyOS_ReadlineFunctionPointer' type-id='type-id-190' mangled-name='PyOS_ReadlineFunctionPointer' visibility='default' filepath='./Include/cpython/pythonrun.h' line='121' column='1' elf-symbol-id='PyOS_ReadlineFunctionPointer'/>
+    <function-decl name='PyOS_Readline' mangled-name='PyOS_Readline' filepath='Parser/myreadline.c' line='354' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyOS_Readline'>
+      <parameter type-id='type-id-188' name='sys_stdin' filepath='Parser/myreadline.c' line='354' column='1'/>
+      <parameter type-id='type-id-188' name='sys_stdout' filepath='Parser/myreadline.c' line='354' column='1'/>
+      <parameter type-id='type-id-3' name='prompt' filepath='Parser/myreadline.c' line='354' column='1'/>
+      <return type-id='type-id-72'/>
+    </function-decl>
+    <function-decl name='PyEval_SaveThread' mangled-name='PyEval_SaveThread' filepath='./Include/ceval.h' line='118' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyThread_acquire_lock' mangled-name='PyThread_acquire_lock' filepath='./Include/pythread.h' line='35' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='fileno' mangled-name='fileno' filepath='/usr/include/stdio.h' line='786' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='isatty' mangled-name='isatty' filepath='/usr/include/unistd.h' line='779' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyEval_RestoreThread' mangled-name='PyEval_RestoreThread' filepath='./Include/ceval.h' line='119' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyThread_release_lock' mangled-name='PyThread_release_lock' filepath='./Include/pythread.h' line='91' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyMem_RawFree' mangled-name='PyMem_RawFree' filepath='./Include/cpython/pymem.h' line='8' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyThread_allocate_lock' mangled-name='PyThread_allocate_lock' filepath='./Include/pythread.h' line='33' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__fgets_alias' mangled-name='fgets' filepath='/usr/include/x86_64-linux-gnu/bits/stdio2.h' line='245' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_CheckSignals' mangled-name='PyErr_CheckSignals' filepath='./Include/pyerrors.h' line='226' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='clearerr' mangled-name='clearerr' filepath='/usr/include/stdio.h' line='757' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='feof' mangled-name='feof' filepath='/usr/include/stdio.h' line='759' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyOS_InterruptOccurred' mangled-name='_PyOS_InterruptOccurred' filepath='./Include/internal/pycore_pystate.h' line='148' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyMem_RawRealloc' mangled-name='PyMem_RawRealloc' filepath='./Include/cpython/pymem.h' line='7' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__fprintf_chk' mangled-name='__fprintf_chk' filepath='/usr/include/x86_64-linux-gnu/bits/stdio2.h' line='88' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='fflush' mangled-name='fflush' filepath='/usr/include/stdio.h' line='218' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-type size-in-bits='64' id='type-id-81'>
+      <parameter type-id='type-id-16'/>
+      <return type-id='type-id-16'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-158'>
+      <parameter type-id='type-id-16'/>
+      <parameter type-id='type-id-156'/>
+      <parameter type-id='type-id-157'/>
+      <parameter type-id='type-id-16'/>
+      <return type-id='type-id-16'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-92'>
+      <parameter type-id='type-id-16'/>
+      <parameter type-id='type-id-16'/>
+      <return type-id='type-id-16'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-94'>
+      <parameter type-id='type-id-16'/>
+      <parameter type-id='type-id-16'/>
+      <parameter type-id='type-id-16'/>
+      <return type-id='type-id-16'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-137'>
+      <parameter type-id='type-id-16'/>
+      <parameter type-id='type-id-16'/>
+      <parameter type-id='type-id-9'/>
+      <return type-id='type-id-16'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-73'>
+      <parameter type-id='type-id-16'/>
+      <parameter type-id='type-id-72'/>
+      <return type-id='type-id-16'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-106'>
+      <parameter type-id='type-id-16'/>
+      <parameter type-id='type-id-31'/>
+      <return type-id='type-id-16'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-145'>
+      <parameter type-id='type-id-16'/>
+      <parameter type-id='type-id-21'/>
+      <return type-id='type-id-16'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-152'>
+      <parameter type-id='type-id-32'/>
+      <parameter type-id='type-id-16'/>
+      <parameter type-id='type-id-16'/>
+      <return type-id='type-id-16'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-150'>
+      <parameter type-id='type-id-32'/>
+      <parameter type-id='type-id-31'/>
+      <return type-id='type-id-16'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-189'>
+      <parameter type-id='type-id-188'/>
+      <parameter type-id='type-id-188'/>
+      <parameter type-id='type-id-3'/>
+      <return type-id='type-id-72'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-167'>
+      <return type-id='type-id-9'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-96'>
+      <parameter type-id='type-id-16'/>
+      <return type-id='type-id-9'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-160'>
+      <parameter type-id='type-id-16'/>
+      <parameter type-id='type-id-13'/>
+      <parameter type-id='type-id-9'/>
+      <parameter type-id='type-id-16'/>
+      <return type-id='type-id-9'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-110'>
+      <parameter type-id='type-id-16'/>
+      <parameter type-id='type-id-16'/>
+      <return type-id='type-id-9'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-115'>
+      <parameter type-id='type-id-16'/>
+      <parameter type-id='type-id-16'/>
+      <parameter type-id='type-id-16'/>
+      <return type-id='type-id-9'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-147'>
+      <parameter type-id='type-id-16'/>
+      <parameter type-id='type-id-16'/>
+      <parameter type-id='type-id-21'/>
+      <return type-id='type-id-9'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-128'>
+      <parameter type-id='type-id-16'/>
+      <parameter type-id='type-id-127'/>
+      <parameter type-id='type-id-9'/>
+      <return type-id='type-id-9'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-75'>
+      <parameter type-id='type-id-16'/>
+      <parameter type-id='type-id-72'/>
+      <parameter type-id='type-id-16'/>
+      <return type-id='type-id-9'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-108'>
+      <parameter type-id='type-id-16'/>
+      <parameter type-id='type-id-31'/>
+      <parameter type-id='type-id-16'/>
+      <return type-id='type-id-9'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-135'>
+      <parameter type-id='type-id-16'/>
+      <parameter type-id='type-id-134'/>
+      <parameter type-id='type-id-21'/>
+      <return type-id='type-id-9'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-132'>
+      <parameter type-id='type-id-16'/>
+      <parameter type-id='type-id-21'/>
+      <return type-id='type-id-9'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-87'>
+      <parameter type-id='type-id-16'/>
+      <parameter type-id='type-id-16'/>
+      <parameter type-id='type-id-86'/>
+      <return type-id='type-id-85'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-118'>
+      <parameter type-id='type-id-16'/>
+      <return type-id='type-id-117'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-104'>
+      <parameter type-id='type-id-16'/>
+      <return type-id='type-id-31'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-70'>
+      <parameter type-id='type-id-16'/>
+      <return type-id='type-id-4'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-130'>
+      <parameter type-id='type-id-16'/>
+      <parameter type-id='type-id-127'/>
+      <return type-id='type-id-4'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-154'>
+      <parameter type-id='type-id-21'/>
+      <return type-id='type-id-4'/>
+    </function-type>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Parser/tokenizer.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='_Py_dup' mangled-name='_Py_dup' filepath='./Include/cpython/fileutils.h' line='158' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='fdopen' mangled-name='fdopen' filepath='/usr/include/stdio.h' line='279' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='fclose' mangled-name='fclose' filepath='/usr/include/stdio.h' line='213' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_FromString' mangled-name='PyUnicode_FromString' filepath='./Include/unicodeobject.h' line='137' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_FatalErrorFunc' mangled-name='_Py_FatalErrorFunc' filepath='./Include/cpython/pyerrors.h' line='205' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_Substring' mangled-name='PyUnicode_Substring' filepath='./Include/unicodeobject.h' line='142' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_AsUTF8String' mangled-name='PyUnicode_AsUTF8String' filepath='./Include/unicodeobject.h' line='467' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_IsPrintable' mangled-name='_PyUnicode_IsPrintable' filepath='./Include/cpython/unicodeobject.h' line='1149' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_ScanIdentifier' mangled-name='_PyUnicode_ScanIdentifier' filepath='./Include/cpython/unicodeobject.h' line='1169' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyToken_ThreeChars' mangled-name='PyToken_ThreeChars' filepath='./Include/token.h' line='91' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyToken_TwoChars' mangled-name='PyToken_TwoChars' filepath='./Include/token.h' line='90' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__ctype_b_loc' mangled-name='__ctype_b_loc' filepath='/usr/include/ctype.h' line='79' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyToken_OneChar' mangled-name='PyToken_OneChar' filepath='./Include/token.h' line='89' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='strcspn' mangled-name='strcspn' filepath='/usr/include/string.h' line='273' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_BuildValue_SizeT' mangled-name='_Py_BuildValue_SizeT' filepath='./Include/modsupport.h' line='50' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_Decode' mangled-name='PyUnicode_Decode' filepath='./Include/unicodeobject.h' line='362' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyOS_Readline' mangled-name='PyOS_Readline' filepath='./Include/cpython/pythonrun.h' line='119' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PySys_WriteStderr' mangled-name='PySys_WriteStderr' filepath='./Include/sysmodule.h' line='19' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='Py_UniversalNewlineFgets' mangled-name='Py_UniversalNewlineFgets' filepath='./Include/cpython/fileobject.h' line='5' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_AsUTF8AndSize' mangled-name='PyUnicode_AsUTF8AndSize' filepath='./Include/unicodeobject.h' line='483' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_CallNoArgs' mangled-name='PyObject_CallNoArgs' filepath='./Include/abstract.h' line='146' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='getc' mangled-name='getc' filepath='/usr/include/stdio.h' line='486' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='ungetc' mangled-name='ungetc' filepath='/usr/include/stdio.h' line='639' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='ftell' mangled-name='ftell' filepath='/usr/include/stdio.h' line='689' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='lseek' mangled-name='lseek64' filepath='/usr/include/unistd.h' line='337' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObject_CallMethodId_SizeT' mangled-name='_PyObject_CallMethodId_SizeT' filepath='./Include/cpython/abstract.h' line='214' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObject_GetAttrId' mangled-name='_PyObject_GetAttrId' filepath='./Include/cpython/object.h' line='316' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_SetFromErrnoWithFilename' mangled-name='PyErr_SetFromErrnoWithFilename' filepath='./Include/pyerrors.h' line='164' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__ctype_tolower_loc' mangled-name='__ctype_tolower_loc' filepath='/usr/include/ctype.h' line='81' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/abstract.c' comp-dir-path='/src' language='LANG_C99'>
+    <qualified-type-def type-id='type-id-72' const='yes' id='type-id-191'/>
+    <pointer-type-def type-id='type-id-191' size-in-bits='64' id='type-id-192'/>
+    <function-decl name='_Py_FreeCharPArray' mangled-name='_Py_FreeCharPArray' filepath='Objects/abstract.c' line='2980' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_FreeCharPArray'>
+      <parameter type-id='type-id-192' name='array' filepath='Objects/abstract.c' line='2980' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PySequence_BytesToCharpArray' mangled-name='_PySequence_BytesToCharpArray' filepath='Objects/abstract.c' line='2921' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PySequence_BytesToCharpArray'>
+      <parameter type-id='type-id-16' name='self' filepath='Objects/abstract.c' line='2921' column='1'/>
+      <return type-id='type-id-192'/>
+    </function-decl>
+    <function-decl name='PyIter_Send' mangled-name='PyIter_Send' filepath='Objects/abstract.c' line='2887' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyIter_Send'>
+      <parameter type-id='type-id-16' name='iter' filepath='Objects/abstract.c' line='2887' column='1'/>
+      <parameter type-id='type-id-16' name='arg' filepath='Objects/abstract.c' line='2887' column='1'/>
+      <parameter type-id='type-id-86' name='result' filepath='Objects/abstract.c' line='2887' column='1'/>
+      <return type-id='type-id-85'/>
+    </function-decl>
+    <function-decl name='PyAIter_Check' mangled-name='PyAIter_Check' filepath='Objects/abstract.c' line='2855' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyAIter_Check'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/abstract.c' line='2855' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyIter_Check' mangled-name='PyIter_Check' filepath='Objects/abstract.c' line='2847' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyIter_Check'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/abstract.c' line='2855' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyObject_GetAIter' mangled-name='PyObject_GetAIter' filepath='Objects/abstract.c' line='2827' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_GetAIter'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='2827' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyObject_RealIsSubclass' mangled-name='_PyObject_RealIsSubclass' filepath='Objects/abstract.c' line='2794' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_RealIsSubclass'>
+      <parameter type-id='type-id-16' name='derived' filepath='Objects/abstract.c' line='2794' column='1'/>
+      <parameter type-id='type-id-16' name='cls' filepath='Objects/abstract.c' line='2794' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyObject_RealIsInstance' mangled-name='_PyObject_RealIsInstance' filepath='Objects/abstract.c' line='2788' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_RealIsInstance'>
+      <parameter type-id='type-id-16' name='derived' filepath='Objects/abstract.c' line='2794' column='1'/>
+      <parameter type-id='type-id-16' name='cls' filepath='Objects/abstract.c' line='2794' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyObject_IsSubclass' mangled-name='PyObject_IsSubclass' filepath='Objects/abstract.c' line='2780' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_IsSubclass'>
+      <parameter type-id='type-id-16' name='derived' filepath='Objects/abstract.c' line='2780' column='1'/>
+      <parameter type-id='type-id-16' name='cls' filepath='Objects/abstract.c' line='2780' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyObject_IsInstance' mangled-name='PyObject_IsInstance' filepath='Objects/abstract.c' line='2695' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_IsInstance'>
+      <parameter type-id='type-id-16' name='derived' filepath='Objects/abstract.c' line='2780' column='1'/>
+      <parameter type-id='type-id-16' name='cls' filepath='Objects/abstract.c' line='2780' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyMapping_Values' mangled-name='PyMapping_Values' filepath='Objects/abstract.c' line='2473' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMapping_Values'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='2473' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyMapping_Items' mangled-name='PyMapping_Items' filepath='Objects/abstract.c' line='2459' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMapping_Items'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='2473' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyMapping_Keys' mangled-name='PyMapping_Keys' filepath='Objects/abstract.c' line='2445' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMapping_Keys'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='2473' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyMapping_HasKey' mangled-name='PyMapping_HasKey' filepath='Objects/abstract.c' line='2399' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMapping_HasKey'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='2399' column='1'/>
+      <parameter type-id='type-id-16' name='key' filepath='Objects/abstract.c' line='2399' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyMapping_HasKeyString' mangled-name='PyMapping_HasKeyString' filepath='Objects/abstract.c' line='2385' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMapping_HasKeyString'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='2385' column='1'/>
+      <parameter type-id='type-id-3' name='key' filepath='Objects/abstract.c' line='2385' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyMapping_SetItemString' mangled-name='PyMapping_SetItemString' filepath='Objects/abstract.c' line='2366' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMapping_SetItemString'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='2366' column='1'/>
+      <parameter type-id='type-id-3' name='key' filepath='Objects/abstract.c' line='2366' column='1'/>
+      <parameter type-id='type-id-16' name='value' filepath='Objects/abstract.c' line='2366' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyMapping_GetItemString' mangled-name='PyMapping_GetItemString' filepath='Objects/abstract.c' line='2349' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMapping_GetItemString'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='2349' column='1'/>
+      <parameter type-id='type-id-3' name='key' filepath='Objects/abstract.c' line='2349' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyMapping_Length' mangled-name='PyMapping_Length' filepath='Objects/abstract.c' line='2342' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMapping_Length'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='2342' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='PyMapping_Size' mangled-name='PyMapping_Size' filepath='Objects/abstract.c' line='2317' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMapping_Size'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='2317' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='PyMapping_Check' mangled-name='PyMapping_Check' filepath='Objects/abstract.c' line='2310' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMapping_Check'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='2310' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PySequence_Index' mangled-name='PySequence_Index' filepath='Objects/abstract.c' line='2302' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySequence_Index'>
+      <parameter type-id='type-id-16' name='s' filepath='Objects/abstract.c' line='2302' column='1'/>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='2302' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='PySequence_In' mangled-name='PySequence_In' filepath='Objects/abstract.c' line='2296' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySequence_In'>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/abstract.c' line='2296' column='1'/>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/abstract.c' line='2296' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PySequence_Count' mangled-name='PySequence_Count' filepath='Objects/abstract.c' line='2272' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySequence_Count'>
+      <parameter type-id='type-id-16' name='s' filepath='Objects/abstract.c' line='2302' column='1'/>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='2302' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='_PySequence_IterSearch' mangled-name='_PySequence_IterSearch' filepath='Objects/abstract.c' line='2187' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PySequence_IterSearch'>
+      <parameter type-id='type-id-16' name='seq' filepath='Objects/abstract.c' line='2187' column='1'/>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/abstract.c' line='2187' column='1'/>
+      <parameter type-id='type-id-9' name='operation' filepath='Objects/abstract.c' line='2187' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='PySequence_Fast' mangled-name='PySequence_Fast' filepath='Objects/abstract.c' line='2152' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySequence_Fast'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/abstract.c' line='2152' column='1'/>
+      <parameter type-id='type-id-3' name='m' filepath='Objects/abstract.c' line='2152' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PySequence_List' mangled-name='PySequence_List' filepath='Objects/abstract.c' line='2129' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySequence_List'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/abstract.c' line='2129' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PySequence_Tuple' mangled-name='PySequence_Tuple' filepath='Objects/abstract.c' line='2045' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySequence_Tuple'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/abstract.c' line='2045' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PySequence_DelSlice' mangled-name='PySequence_DelSlice' filepath='Objects/abstract.c' line='2022' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySequence_DelSlice'>
+      <parameter type-id='type-id-16' name='s' filepath='Objects/abstract.c' line='2022' column='1'/>
+      <parameter type-id='type-id-31' name='i1' filepath='Objects/abstract.c' line='2022' column='1'/>
+      <parameter type-id='type-id-31' name='i2' filepath='Objects/abstract.c' line='2022' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PySequence_SetSlice' mangled-name='PySequence_SetSlice' filepath='Objects/abstract.c' line='1999' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySequence_SetSlice'>
+      <parameter type-id='type-id-16' name='s' filepath='Objects/abstract.c' line='1999' column='1'/>
+      <parameter type-id='type-id-31' name='i1' filepath='Objects/abstract.c' line='1999' column='1'/>
+      <parameter type-id='type-id-31' name='i2' filepath='Objects/abstract.c' line='1999' column='1'/>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='1999' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PySequence_DelItem' mangled-name='PySequence_DelItem' filepath='Objects/abstract.c' line='1966' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySequence_DelItem'>
+      <parameter type-id='type-id-16' name='s' filepath='Objects/abstract.c' line='1966' column='1'/>
+      <parameter type-id='type-id-31' name='i' filepath='Objects/abstract.c' line='1966' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PySequence_SetItem' mangled-name='PySequence_SetItem' filepath='Objects/abstract.c' line='1933' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySequence_SetItem'>
+      <parameter type-id='type-id-16' name='s' filepath='Objects/abstract.c' line='1933' column='1'/>
+      <parameter type-id='type-id-31' name='i' filepath='Objects/abstract.c' line='1933' column='1'/>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='1933' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PySequence_GetSlice' mangled-name='PySequence_GetSlice' filepath='Objects/abstract.c' line='1911' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySequence_GetSlice'>
+      <parameter type-id='type-id-16' name='s' filepath='Objects/abstract.c' line='1911' column='1'/>
+      <parameter type-id='type-id-31' name='i1' filepath='Objects/abstract.c' line='1911' column='1'/>
+      <parameter type-id='type-id-31' name='i2' filepath='Objects/abstract.c' line='1911' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PySequence_GetItem' mangled-name='PySequence_GetItem' filepath='Objects/abstract.c' line='1881' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySequence_GetItem'>
+      <parameter type-id='type-id-16' name='s' filepath='Objects/abstract.c' line='1881' column='1'/>
+      <parameter type-id='type-id-31' name='i' filepath='Objects/abstract.c' line='1881' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PySequence_InPlaceRepeat' mangled-name='PySequence_InPlaceRepeat' filepath='Objects/abstract.c' line='1847' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySequence_InPlaceRepeat'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='1847' column='1'/>
+      <parameter type-id='type-id-31' name='count' filepath='Objects/abstract.c' line='1847' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PySequence_InPlaceConcat' mangled-name='PySequence_InPlaceConcat' filepath='Objects/abstract.c' line='1818' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySequence_InPlaceConcat'>
+      <parameter type-id='type-id-16' name='s' filepath='Objects/abstract.c' line='1818' column='1'/>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='1818' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PySequence_Repeat' mangled-name='PySequence_Repeat' filepath='Objects/abstract.c' line='1787' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySequence_Repeat'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='1787' column='1'/>
+      <parameter type-id='type-id-31' name='count' filepath='Objects/abstract.c' line='1787' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PySequence_Concat' mangled-name='PySequence_Concat' filepath='Objects/abstract.c' line='1761' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySequence_Concat'>
+      <parameter type-id='type-id-16' name='s' filepath='Objects/abstract.c' line='1761' column='1'/>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='1761' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PySequence_Length' mangled-name='PySequence_Length' filepath='Objects/abstract.c' line='1754' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySequence_Length'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='2342' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='PySequence_Size' mangled-name='PySequence_Size' filepath='Objects/abstract.c' line='1730' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySequence_Size'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='2317' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='PySequence_Check' mangled-name='PySequence_Check' filepath='Objects/abstract.c' line='1721' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySequence_Check'>
+      <parameter type-id='type-id-16' name='s' filepath='Objects/abstract.c' line='1721' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyNumber_ToBase' mangled-name='PyNumber_ToBase' filepath='Objects/abstract.c' line='1702' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_ToBase'>
+      <parameter type-id='type-id-16' name='n' filepath='Objects/abstract.c' line='1702' column='1'/>
+      <parameter type-id='type-id-9' name='base' filepath='Objects/abstract.c' line='1702' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyNumber_Float' mangled-name='PyNumber_Float' filepath='Objects/abstract.c' line='1641' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_Float'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='1641' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyNumber_Long' mangled-name='PyNumber_Long' filepath='Objects/abstract.c' line='1529' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_Long'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='1529' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyNumber_AsSsize_t' mangled-name='PyNumber_AsSsize_t' filepath='Objects/abstract.c' line='1478' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_AsSsize_t'>
+      <parameter type-id='type-id-16' name='item' filepath='Objects/abstract.c' line='1478' column='1'/>
+      <parameter type-id='type-id-16' name='err' filepath='Objects/abstract.c' line='1478' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='PyNumber_Index' mangled-name='PyNumber_Index' filepath='Objects/abstract.c' line='1466' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_Index'>
+      <parameter type-id='type-id-16' name='item' filepath='Objects/abstract.c' line='1466' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyNumber_Index' mangled-name='_PyNumber_Index' filepath='Objects/abstract.c' line='1419' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyNumber_Index'>
+      <parameter type-id='type-id-16' name='item' filepath='Objects/abstract.c' line='1419' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyIndex_Check' mangled-name='PyIndex_Check' filepath='Objects/abstract.c' line='1407' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyIndex_Check'>
+      <parameter type-id='type-id-16' name='s' filepath='Objects/abstract.c' line='1721' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyNumber_Absolute' mangled-name='PyNumber_Absolute' filepath='Objects/abstract.c' line='1389' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_Absolute'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='1389' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyNumber_Invert' mangled-name='PyNumber_Invert' filepath='Objects/abstract.c' line='1372' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_Invert'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='1389' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyNumber_Positive' mangled-name='PyNumber_Positive' filepath='Objects/abstract.c' line='1355' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_Positive'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='1389' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyNumber_Negative' mangled-name='PyNumber_Negative' filepath='Objects/abstract.c' line='1338' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_Negative'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='1389' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyNumber_InPlacePower' mangled-name='PyNumber_InPlacePower' filepath='Objects/abstract.c' line='1328' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_InPlacePower'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/abstract.c' line='1328' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/abstract.c' line='1328' column='1'/>
+      <parameter type-id='type-id-16' name='z' filepath='Objects/abstract.c' line='1328' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyNumber_InPlaceRemainder' mangled-name='PyNumber_InPlaceRemainder' filepath='Objects/abstract.c' line='1321' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_InPlaceRemainder'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyNumber_InPlaceMatrixMultiply' mangled-name='PyNumber_InPlaceMatrixMultiply' filepath='Objects/abstract.c' line='1314' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_InPlaceMatrixMultiply'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyNumber_InPlaceMultiply' mangled-name='PyNumber_InPlaceMultiply' filepath='Objects/abstract.c' line='1285' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_InPlaceMultiply'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/abstract.c' line='1285' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/abstract.c' line='1285' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyNumber_InPlaceAdd' mangled-name='PyNumber_InPlaceAdd' filepath='Objects/abstract.c' line='1262' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_InPlaceAdd'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/abstract.c' line='1285' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/abstract.c' line='1285' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyNumber_InPlaceTrueDivide' mangled-name='PyNumber_InPlaceTrueDivide' filepath='Objects/abstract.c' line='1255' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_InPlaceTrueDivide'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyNumber_InPlaceFloorDivide' mangled-name='PyNumber_InPlaceFloorDivide' filepath='Objects/abstract.c' line='1248' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_InPlaceFloorDivide'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyNumber_InPlaceSubtract' mangled-name='PyNumber_InPlaceSubtract' filepath='Objects/abstract.c' line='1244' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_InPlaceSubtract'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyNumber_InPlaceRshift' mangled-name='PyNumber_InPlaceRshift' filepath='Objects/abstract.c' line='1243' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_InPlaceRshift'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyNumber_InPlaceLshift' mangled-name='PyNumber_InPlaceLshift' filepath='Objects/abstract.c' line='1242' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_InPlaceLshift'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyNumber_InPlaceAnd' mangled-name='PyNumber_InPlaceAnd' filepath='Objects/abstract.c' line='1241' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_InPlaceAnd'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyNumber_InPlaceXor' mangled-name='PyNumber_InPlaceXor' filepath='Objects/abstract.c' line='1240' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_InPlaceXor'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyNumber_InPlaceOr' mangled-name='PyNumber_InPlaceOr' filepath='Objects/abstract.c' line='1239' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_InPlaceOr'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyNumber_Power' mangled-name='PyNumber_Power' filepath='Objects/abstract.c' line='1150' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_Power'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/abstract.c' line='1328' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/abstract.c' line='1328' column='1'/>
+      <parameter type-id='type-id-16' name='z' filepath='Objects/abstract.c' line='1328' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyNumber_Remainder' mangled-name='PyNumber_Remainder' filepath='Objects/abstract.c' line='1144' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_Remainder'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyNumber_TrueDivide' mangled-name='PyNumber_TrueDivide' filepath='Objects/abstract.c' line='1138' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_TrueDivide'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyNumber_FloorDivide' mangled-name='PyNumber_FloorDivide' filepath='Objects/abstract.c' line='1132' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_FloorDivide'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyNumber_MatrixMultiply' mangled-name='PyNumber_MatrixMultiply' filepath='Objects/abstract.c' line='1126' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_MatrixMultiply'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyNumber_Multiply' mangled-name='PyNumber_Multiply' filepath='Objects/abstract.c' line='1107' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_Multiply'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/abstract.c' line='1285' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/abstract.c' line='1285' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyNumber_Add' mangled-name='PyNumber_Add' filepath='Objects/abstract.c' line='1069' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_Add'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/abstract.c' line='1069' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/abstract.c' line='1069' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyNumber_Divmod' mangled-name='PyNumber_Divmod' filepath='Objects/abstract.c' line='1066' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_Divmod'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyNumber_Subtract' mangled-name='PyNumber_Subtract' filepath='Objects/abstract.c' line='1065' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_Subtract'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyNumber_Rshift' mangled-name='PyNumber_Rshift' filepath='Objects/abstract.c' line='1064' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_Rshift'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyNumber_Lshift' mangled-name='PyNumber_Lshift' filepath='Objects/abstract.c' line='1063' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_Lshift'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyNumber_And' mangled-name='PyNumber_And' filepath='Objects/abstract.c' line='1062' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_And'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyNumber_Xor' mangled-name='PyNumber_Xor' filepath='Objects/abstract.c' line='1061' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_Xor'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyNumber_Or' mangled-name='PyNumber_Or' filepath='Objects/abstract.c' line='1060' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_Or'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyNumber_Check' mangled-name='PyNumber_Check' filepath='Objects/abstract.c' line='830' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyNumber_Check'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='830' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyObject_Format' mangled-name='PyObject_Format' filepath='Objects/abstract.c' line='767' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_Format'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/abstract.c' line='767' column='1'/>
+      <parameter type-id='type-id-16' name='format_spec' filepath='Objects/abstract.c' line='767' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyBuffer_Release' mangled-name='PyBuffer_Release' filepath='Objects/abstract.c' line='752' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyBuffer_Release'>
+      <parameter type-id='type-id-127' name='view' filepath='Objects/abstract.c' line='752' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyBuffer_FillInfo' mangled-name='PyBuffer_FillInfo' filepath='Objects/abstract.c' line='713' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyBuffer_FillInfo'>
+      <parameter type-id='type-id-127' name='view' filepath='Objects/abstract.c' line='713' column='1'/>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/abstract.c' line='713' column='1'/>
+      <parameter type-id='type-id-21' name='buf' filepath='Objects/abstract.c' line='713' column='1'/>
+      <parameter type-id='type-id-31' name='len' filepath='Objects/abstract.c' line='713' column='1'/>
+      <parameter type-id='type-id-9' name='readonly' filepath='Objects/abstract.c' line='714' column='1'/>
+      <parameter type-id='type-id-9' name='flags' filepath='Objects/abstract.c' line='714' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyBuffer_FillContiguousStrides' mangled-name='PyBuffer_FillContiguousStrides' filepath='Objects/abstract.c' line='689' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyBuffer_FillContiguousStrides'>
+      <parameter type-id='type-id-9' name='nd' filepath='Objects/abstract.c' line='689' column='1'/>
+      <parameter type-id='type-id-125' name='shape' filepath='Objects/abstract.c' line='689' column='1'/>
+      <parameter type-id='type-id-125' name='strides' filepath='Objects/abstract.c' line='690' column='1'/>
+      <parameter type-id='type-id-9' name='itemsize' filepath='Objects/abstract.c' line='690' column='1'/>
+      <parameter type-id='type-id-1' name='fort' filepath='Objects/abstract.c' line='691' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_CopyData' mangled-name='PyObject_CopyData' filepath='Objects/abstract.c' line='618' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_CopyData'>
+      <parameter type-id='type-id-16' name='dest' filepath='Objects/abstract.c' line='618' column='1'/>
+      <parameter type-id='type-id-16' name='src' filepath='Objects/abstract.c' line='618' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyBuffer_FromContiguous' mangled-name='PyBuffer_FromContiguous' filepath='Objects/abstract.c' line='567' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyBuffer_FromContiguous'>
+      <parameter type-id='type-id-127' name='view' filepath='Objects/abstract.c' line='567' column='1'/>
+      <parameter type-id='type-id-21' name='buf' filepath='Objects/abstract.c' line='567' column='1'/>
+      <parameter type-id='type-id-31' name='len' filepath='Objects/abstract.c' line='567' column='1'/>
+      <parameter type-id='type-id-1' name='fort' filepath='Objects/abstract.c' line='567' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyBuffer_SizeFromFormat' mangled-name='PyBuffer_SizeFromFormat' filepath='Objects/abstract.c' line='525' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyBuffer_SizeFromFormat'>
+      <parameter type-id='type-id-3' name='format' filepath='Objects/abstract.c' line='525' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <qualified-type-def type-id='type-id-31' const='yes' id='type-id-193'/>
+    <pointer-type-def type-id='type-id-193' size-in-bits='64' id='type-id-194'/>
+    <function-decl name='_Py_add_one_to_index_C' mangled-name='_Py_add_one_to_index_C' filepath='Objects/abstract.c' line='509' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_add_one_to_index_C'>
+      <parameter type-id='type-id-9' name='nd' filepath='Objects/abstract.c' line='509' column='1'/>
+      <parameter type-id='type-id-125' name='index' filepath='Objects/abstract.c' line='509' column='1'/>
+      <parameter type-id='type-id-194' name='shape' filepath='Objects/abstract.c' line='509' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_add_one_to_index_F' mangled-name='_Py_add_one_to_index_F' filepath='Objects/abstract.c' line='493' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_add_one_to_index_F'>
+      <parameter type-id='type-id-9' name='nd' filepath='Objects/abstract.c' line='509' column='1'/>
+      <parameter type-id='type-id-125' name='index' filepath='Objects/abstract.c' line='509' column='1'/>
+      <parameter type-id='type-id-194' name='shape' filepath='Objects/abstract.c' line='509' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyBuffer_GetPointer' mangled-name='PyBuffer_GetPointer' filepath='Objects/abstract.c' line='477' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyBuffer_GetPointer'>
+      <parameter type-id='type-id-127' name='view' filepath='Objects/abstract.c' line='477' column='1'/>
+      <parameter type-id='type-id-125' name='indices' filepath='Objects/abstract.c' line='477' column='1'/>
+      <return type-id='type-id-21'/>
+    </function-decl>
+    <function-decl name='PyObject_GetBuffer' mangled-name='PyObject_GetBuffer' filepath='Objects/abstract.c' line='378' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_GetBuffer'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/abstract.c' line='378' column='1'/>
+      <parameter type-id='type-id-127' name='view' filepath='Objects/abstract.c' line='378' column='1'/>
+      <parameter type-id='type-id-9' name='flags' filepath='Objects/abstract.c' line='378' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <pointer-type-def type-id='type-id-21' size-in-bits='64' id='type-id-195'/>
+    <function-decl name='PyObject_AsWriteBuffer' mangled-name='PyObject_AsWriteBuffer' filepath='Objects/abstract.c' line='349' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_AsWriteBuffer'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/abstract.c' line='349' column='1'/>
+      <parameter type-id='type-id-195' name='buffer' filepath='Objects/abstract.c' line='350' column='1'/>
+      <parameter type-id='type-id-125' name='buffer_len' filepath='Objects/abstract.c' line='351' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyObject_AsReadBuffer' mangled-name='PyObject_AsReadBuffer' filepath='Objects/abstract.c' line='342' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_AsReadBuffer'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/abstract.c' line='342' column='1'/>
+      <parameter type-id='type-id-195' name='buffer' filepath='Objects/abstract.c' line='343' column='1'/>
+      <parameter type-id='type-id-125' name='buffer_len' filepath='Objects/abstract.c' line='344' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <pointer-type-def type-id='type-id-3' size-in-bits='64' id='type-id-196'/>
+    <function-decl name='PyObject_AsCharBuffer' mangled-name='PyObject_AsCharBuffer' filepath='Objects/abstract.c' line='335' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_AsCharBuffer'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/abstract.c' line='335' column='1'/>
+      <parameter type-id='type-id-196' name='buffer' filepath='Objects/abstract.c' line='336' column='1'/>
+      <parameter type-id='type-id-125' name='buffer_len' filepath='Objects/abstract.c' line='337' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyObject_CheckReadBuffer' mangled-name='PyObject_CheckReadBuffer' filepath='Objects/abstract.c' line='300' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_CheckReadBuffer'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/abstract.c' line='300' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyObject_CheckBuffer' mangled-name='PyObject_CheckBuffer' filepath='Objects/abstract.c' line='289' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_CheckBuffer'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/abstract.c' line='2855' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyObject_DelItemString' mangled-name='PyObject_DelItemString' filepath='Objects/abstract.c' line='269' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_DelItemString'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='269' column='1'/>
+      <parameter type-id='type-id-3' name='key' filepath='Objects/abstract.c' line='269' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyObject_DelItem' mangled-name='PyObject_DelItem' filepath='Objects/abstract.c' line='235' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_DelItem'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='235' column='1'/>
+      <parameter type-id='type-id-16' name='key' filepath='Objects/abstract.c' line='235' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyObject_SetItem' mangled-name='PyObject_SetItem' filepath='Objects/abstract.c' line='201' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_SetItem'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='201' column='1'/>
+      <parameter type-id='type-id-16' name='key' filepath='Objects/abstract.c' line='201' column='1'/>
+      <parameter type-id='type-id-16' name='value' filepath='Objects/abstract.c' line='201' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyObject_GetItem' mangled-name='PyObject_GetItem' filepath='Objects/abstract.c' line='150' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_GetItem'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='150' column='1'/>
+      <parameter type-id='type-id-16' name='key' filepath='Objects/abstract.c' line='150' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyObject_HasLen' mangled-name='_PyObject_HasLen' filepath='Objects/abstract.c' line='79' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_HasLen'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='2310' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyObject_Length' mangled-name='PyObject_Length' filepath='Objects/abstract.c' line='72' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_Length'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='2342' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='PyObject_Size' mangled-name='PyObject_Size' filepath='Objects/abstract.c' line='53' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_Size'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='53' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='PyObject_Type' mangled-name='PyObject_Type' filepath='Objects/abstract.c' line='39' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_Type'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='39' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <qualified-type-def type-id='type-id-126' const='yes' id='type-id-197'/>
+    <pointer-type-def type-id='type-id-197' size-in-bits='64' id='type-id-198'/>
+    <function-decl name='PyBuffer_IsContiguous' mangled-name='PyBuffer_IsContiguous' filepath='Objects/abstract.c' line='461' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyBuffer_IsContiguous'>
+      <parameter type-id='type-id-198' name='view' filepath='Objects/abstract.c' line='461' column='1'/>
+      <parameter type-id='type-id-1' name='order' filepath='Objects/abstract.c' line='461' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyObject_LengthHint' mangled-name='PyObject_LengthHint' filepath='Objects/abstract.c' line='91' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_LengthHint'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='91' column='1'/>
+      <parameter type-id='type-id-31' name='defaultvalue' filepath='Objects/abstract.c' line='91' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='PyObject_GetIter' mangled-name='PyObject_GetIter' filepath='Objects/abstract.c' line='2801' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_GetIter'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='2801' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyIter_Next' mangled-name='PyIter_Next' filepath='Objects/abstract.c' line='2871' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyIter_Next'>
+      <parameter type-id='type-id-16' name='iter' filepath='Objects/abstract.c' line='2871' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PySequence_Contains' mangled-name='PySequence_Contains' filepath='Objects/abstract.c' line='2281' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySequence_Contains'>
+      <parameter type-id='type-id-16' name='seq' filepath='Objects/abstract.c' line='2281' column='1'/>
+      <parameter type-id='type-id-16' name='ob' filepath='Objects/abstract.c' line='2281' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_FromId' mangled-name='_PyUnicode_FromId' filepath='./Include/cpython/unicodeobject.h' line='1160' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_VectorcallMethod' mangled-name='PyObject_VectorcallMethod' filepath='./Include/cpython/abstract.h' line='187' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyGen_FetchStopIterationValue' mangled-name='_PyGen_FetchStopIterationValue' filepath='./Include/genobject.h' line='44' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObject_LookupAttrId' mangled-name='_PyObject_LookupAttrId' filepath='./Include/cpython/object.h' line='328' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_SetString' mangled-name='_PyErr_SetString' filepath='./Include/internal/pycore_pyerrors.h' line='62' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyType_IsSubtype' mangled-name='PyType_IsSubtype' filepath='./Include/object.h' line='244' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_CheckRecursiveCall' mangled-name='_Py_CheckRecursiveCall' filepath='./Include/internal/pycore_ceval.h' line='83' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_IsTrue' mangled-name='PyObject_IsTrue' filepath='./Include/object.h' line='285' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObject_LookupSpecial' mangled-name='_PyObject_LookupSpecial' filepath='./Include/cpython/object.h' line='302' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_ExceptionMatches' mangled-name='_PyErr_ExceptionMatches' filepath='./Include/internal/pycore_pyerrors.h' line='38' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_Format' mangled-name='_PyErr_Format' filepath='./Include/internal/pycore_pyerrors.h' line='67' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyDict_Values' mangled-name='PyDict_Values' filepath='./Include/dictobject.h' line='30' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyDict_Items' mangled-name='PyDict_Items' filepath='./Include/dictobject.h' line='31' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyDict_Keys' mangled-name='PyDict_Keys' filepath='./Include/dictobject.h' line='29' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_RichCompareBool' mangled-name='PyObject_RichCompareBool' filepath='./Include/object.h' line='270' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyList_New' mangled-name='PyList_New' filepath='./Include/listobject.h' line='28' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyList_Extend' mangled-name='_PyList_Extend' filepath='./Include/cpython/listobject.h' line='24' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTuple_Resize' mangled-name='_PyTuple_Resize' filepath='./Include/cpython/tupleobject.h' line='13' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyTuple_New' mangled-name='PyTuple_New' filepath='./Include/tupleobject.h' line='30' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyList_AsTuple' mangled-name='PyList_AsTuple' filepath='./Include/listobject.h' line='41' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PySlice_FromIndices' mangled-name='_PySlice_FromIndices' filepath='./Include/sliceobject.h' line='36' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyLong_FromSsize_t' mangled-name='PyLong_FromSsize_t' filepath='./Include/longobject.h' line='21' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyLong_Format' mangled-name='_PyLong_Format' filepath='./Include/longobject.h' line='176' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_WarnFormat' mangled-name='PyErr_WarnFormat' filepath='./Include/warnings.h' line='15' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyLong_AsDouble' mangled-name='PyLong_AsDouble' filepath='./Include/longobject.h' line='92' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyFloat_FromString' mangled-name='PyFloat_FromString' filepath='./Include/floatobject.h' line='42' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyLong_Copy' mangled-name='_PyLong_Copy' filepath='./Include/longintrepr.h' line='93' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyLong_FromBytes' mangled-name='_PyLong_FromBytes' filepath='./Include/longobject.h' line='106' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyLong_FromUnicodeObject' mangled-name='PyLong_FromUnicodeObject' filepath='./Include/longobject.h' line='105' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyLong_AsSsize_t' mangled-name='PyLong_AsSsize_t' filepath='./Include/longobject.h' line='25' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_GivenExceptionMatches' mangled-name='PyErr_GivenExceptionMatches' filepath='./Include/pyerrors.h' line='34' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_Clear' mangled-name='_PyErr_Clear' filepath='./Include/internal/pycore_pyerrors.h' line='56' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyLong_Sign' mangled-name='_PyLong_Sign' filepath='./Include/longobject.h' line='114' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_New' mangled-name='PyUnicode_New' filepath='./Include/cpython/unicodeobject.h' line='460' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__builtin_memset' mangled-name='memset' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyImport_ImportModule' mangled-name='PyImport_ImportModule' filepath='./Include/import.h' line='46' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_CallFunctionObjArgs' mangled-name='PyObject_CallFunctionObjArgs' filepath='./Include/abstract.h' line='215' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='Py_GenericAlias' mangled-name='Py_GenericAlias' filepath='./Include/genericaliasobject.h' line='8' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PySeqIter_New' mangled-name='PySeqIter_New' filepath='./Include/iterobject.h' line='16' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/accu.c' comp-dir-path='/src' language='LANG_C99'>
+    <class-decl name='__anonymous_struct__' size-in-bits='128' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-199' visibility='default' filepath='./Include/internal/pycore_accu.h' line='24' column='1' id='type-id-200'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='large' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_accu.h' line='25' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='small' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_accu.h' line='26' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='_PyAccu' type-id='type-id-200' filepath='./Include/internal/pycore_accu.h' line='27' column='1' id='type-id-199'/>
+    <pointer-type-def type-id='type-id-199' size-in-bits='64' id='type-id-201'/>
+    <function-decl name='_PyAccu_Destroy' mangled-name='_PyAccu_Destroy' filepath='Objects/accu.c' line='111' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyAccu_Destroy'>
+      <parameter type-id='type-id-201' name='acc' filepath='Objects/accu.c' line='111' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAccu_Finish' mangled-name='_PyAccu_Finish' filepath='Objects/accu.c' line='93' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyAccu_Finish'>
+      <parameter type-id='type-id-201' name='acc' filepath='Objects/accu.c' line='93' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyAccu_Accumulate' mangled-name='_PyAccu_Accumulate' filepath='Objects/accu.c' line='55' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyAccu_Accumulate'>
+      <parameter type-id='type-id-201' name='acc' filepath='Objects/accu.c' line='55' column='1'/>
+      <parameter type-id='type-id-16' name='unicode' filepath='Objects/accu.c' line='55' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyAccu_Init' mangled-name='_PyAccu_Init' filepath='Objects/accu.c' line='18' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyAccu_Init'>
+      <parameter type-id='type-id-201' name='acc' filepath='Objects/accu.c' line='18' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyAccu_FinishAsList' mangled-name='_PyAccu_FinishAsList' filepath='Objects/accu.c' line='76' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyAccu_FinishAsList'>
+      <parameter type-id='type-id-201' name='acc' filepath='Objects/accu.c' line='76' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_Join' mangled-name='PyUnicode_Join' filepath='./Include/unicodeobject.h' line='922' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyList_SetSlice' mangled-name='PyList_SetSlice' filepath='./Include/listobject.h' line='37' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyList_Append' mangled-name='PyList_Append' filepath='./Include/listobject.h' line='34' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/boolobject.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PyBool_Type' type-id='type-id-149' mangled-name='PyBool_Type' visibility='default' filepath='./Include/boolobject.h' line='10' column='1' elf-symbol-id='PyBool_Type'/>
+    <class-decl name='_longobject' size-in-bits='256' is-struct='yes' visibility='default' filepath='./Include/longintrepr.h' line='85' column='1' id='type-id-202'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='ob_base' type-id='type-id-37' visibility='default' filepath='./Include/longintrepr.h' line='86' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='ob_digit' type-id='type-id-203' visibility='default' filepath='./Include/longintrepr.h' line='87' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='__uint32_t' type-id='type-id-66' filepath='/usr/include/x86_64-linux-gnu/bits/types.h' line='42' column='1' id='type-id-204'/>
+    <typedef-decl name='uint32_t' type-id='type-id-204' filepath='/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h' line='26' column='1' id='type-id-205'/>
+    <typedef-decl name='digit' type-id='type-id-205' filepath='./Include/longintrepr.h' line='45' column='1' id='type-id-206'/>
+
+    <array-type-def dimensions='1' type-id='type-id-206' size-in-bits='32' id='type-id-203'>
+      <subrange length='1' type-id='type-id-19' id='type-id-182'/>
+
+    </array-type-def>
+    <var-decl name='_Py_FalseStruct' type-id='type-id-202' mangled-name='_Py_FalseStruct' visibility='default' filepath='./Include/boolobject.h' line='18' column='1' elf-symbol-id='_Py_FalseStruct'/>
+    <var-decl name='_Py_TrueStruct' type-id='type-id-202' mangled-name='_Py_TrueStruct' visibility='default' filepath='./Include/boolobject.h' line='19' column='1' elf-symbol-id='_Py_TrueStruct'/>
+    <function-decl name='PyBool_FromLong' mangled-name='PyBool_FromLong' filepath='Objects/boolobject.c' line='28' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyBool_FromLong'>
+      <parameter type-id='type-id-33' name='ok' filepath='Objects/boolobject.c' line='28' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyArg_NoKwnames' mangled-name='_PyArg_NoKwnames' filepath='./Include/modsupport.h' line='63' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyArg_CheckPositional' mangled-name='_PyArg_CheckPositional' filepath='./Include/modsupport.h' line='73' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyArg_NoKeywords' mangled-name='_PyArg_NoKeywords' filepath='./Include/modsupport.h' line='62' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyArg_UnpackTuple' mangled-name='PyArg_UnpackTuple' filepath='./Include/modsupport.h' line='48' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/bytes_methods.c' comp-dir-path='/src' language='LANG_C99'>
+
+    <array-type-def dimensions='1' type-id='type-id-2' size-in-bits='infinite' id='type-id-207'>
+      <subrange length='infinite' id='type-id-7'/>
+
+    </array-type-def>
+    <qualified-type-def type-id='type-id-207' const='yes' id='type-id-208'/>
+    <var-decl name='_Py_isspace__doc__' type-id='type-id-208' visibility='default' filepath='./Include/internal/pycore_bytes_methods.h' line='42' column='1'/>
+    <var-decl name='_Py_isalpha__doc__' type-id='type-id-208' visibility='default' filepath='./Include/internal/pycore_bytes_methods.h' line='43' column='1'/>
+    <var-decl name='_Py_isalnum__doc__' type-id='type-id-208' visibility='default' filepath='./Include/internal/pycore_bytes_methods.h' line='44' column='1'/>
+    <var-decl name='_Py_isascii__doc__' type-id='type-id-208' visibility='default' filepath='./Include/internal/pycore_bytes_methods.h' line='45' column='1'/>
+    <var-decl name='_Py_isdigit__doc__' type-id='type-id-208' visibility='default' filepath='./Include/internal/pycore_bytes_methods.h' line='46' column='1'/>
+    <var-decl name='_Py_islower__doc__' type-id='type-id-208' visibility='default' filepath='./Include/internal/pycore_bytes_methods.h' line='47' column='1'/>
+    <var-decl name='_Py_isupper__doc__' type-id='type-id-208' visibility='default' filepath='./Include/internal/pycore_bytes_methods.h' line='48' column='1'/>
+    <var-decl name='_Py_istitle__doc__' type-id='type-id-208' visibility='default' filepath='./Include/internal/pycore_bytes_methods.h' line='49' column='1'/>
+    <var-decl name='_Py_lower__doc__' type-id='type-id-208' visibility='default' filepath='./Include/internal/pycore_bytes_methods.h' line='50' column='1'/>
+    <var-decl name='_Py_upper__doc__' type-id='type-id-208' visibility='default' filepath='./Include/internal/pycore_bytes_methods.h' line='51' column='1'/>
+    <var-decl name='_Py_title__doc__' type-id='type-id-208' visibility='default' filepath='./Include/internal/pycore_bytes_methods.h' line='52' column='1'/>
+    <var-decl name='_Py_capitalize__doc__' type-id='type-id-208' visibility='default' filepath='./Include/internal/pycore_bytes_methods.h' line='53' column='1'/>
+    <var-decl name='_Py_swapcase__doc__' type-id='type-id-208' visibility='default' filepath='./Include/internal/pycore_bytes_methods.h' line='54' column='1'/>
+    <var-decl name='_Py_maketrans__doc__' type-id='type-id-208' visibility='default' filepath='./Include/internal/pycore_bytes_methods.h' line='62' column='1'/>
+    <var-decl name='_Py_find__doc__' type-id='type-id-208' visibility='default' filepath='./Include/internal/pycore_bytes_methods.h' line='56' column='1'/>
+    <var-decl name='_Py_index__doc__' type-id='type-id-208' visibility='default' filepath='./Include/internal/pycore_bytes_methods.h' line='57' column='1'/>
+    <var-decl name='_Py_rfind__doc__' type-id='type-id-208' visibility='default' filepath='./Include/internal/pycore_bytes_methods.h' line='58' column='1'/>
+    <var-decl name='_Py_rindex__doc__' type-id='type-id-208' visibility='default' filepath='./Include/internal/pycore_bytes_methods.h' line='59' column='1'/>
+    <var-decl name='_Py_count__doc__' type-id='type-id-208' visibility='default' filepath='./Include/internal/pycore_bytes_methods.h' line='55' column='1'/>
+    <var-decl name='_Py_startswith__doc__' type-id='type-id-208' visibility='default' filepath='./Include/internal/pycore_bytes_methods.h' line='60' column='1'/>
+    <var-decl name='_Py_endswith__doc__' type-id='type-id-208' visibility='default' filepath='./Include/internal/pycore_bytes_methods.h' line='61' column='1'/>
+    <function-decl name='__builtin_memcmp' mangled-name='memcmp' filepath='/usr/include/string.h' line='64' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyBuffer_Release' mangled-name='PyBuffer_Release' filepath='./Include/cpython/abstract.h' line='326' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_GetBuffer' mangled-name='PyObject_GetBuffer' filepath='./Include/cpython/abstract.h' line='270' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyArg_ParseTuple_SizeT' mangled-name='_PyArg_ParseTuple_SizeT' filepath='./Include/modsupport.h' line='40' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyEval_SliceIndex' mangled-name='_PyEval_SliceIndex' filepath='./Include/cpython/ceval.h' line='29' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyBool_FromLong' mangled-name='PyBool_FromLong' filepath='./Include/boolobject.h' line='38' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='memchr' mangled-name='memchr' filepath='/usr/include/string.h' line='91' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_AsSsize_t' mangled-name='PyNumber_AsSsize_t' filepath='./Include/abstract.h' line='532' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_CheckBuffer' mangled-name='PyObject_CheckBuffer' filepath='./Include/cpython/abstract.h' line='263' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='memrchr' mangled-name='memrchr' filepath='/usr/include/string.h' line='115' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/bytearrayobject.c' comp-dir-path='/src' language='LANG_C99'>
+
+    <array-type-def dimensions='1' type-id='type-id-1' size-in-bits='infinite' id='type-id-209'>
+      <subrange length='infinite' id='type-id-7'/>
+
+    </array-type-def>
+    <var-decl name='_PyByteArray_empty_string' type-id='type-id-209' mangled-name='_PyByteArray_empty_string' visibility='default' filepath='./Include/cpython/bytearrayobject.h' line='20' column='1' elf-symbol-id='_PyByteArray_empty_string'/>
+    <var-decl name='PyByteArray_Type' type-id='type-id-149' mangled-name='PyByteArray_Type' visibility='default' filepath='./Include/bytearrayobject.h' line='22' column='1' elf-symbol-id='PyByteArray_Type'/>
+    <var-decl name='PyByteArrayIter_Type' type-id='type-id-149' mangled-name='PyByteArrayIter_Type' visibility='default' filepath='./Include/bytearrayobject.h' line='23' column='1' elf-symbol-id='PyByteArrayIter_Type'/>
+    <function-decl name='PyByteArray_Concat' mangled-name='PyByteArray_Concat' filepath='Objects/bytearrayobject.c' line='247' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyByteArray_Concat'>
+      <parameter type-id='type-id-16' name='a' filepath='Objects/bytearrayobject.c' line='247' column='1'/>
+      <parameter type-id='type-id-16' name='b' filepath='Objects/bytearrayobject.c' line='247' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyByteArray_Resize' mangled-name='PyByteArray_Resize' filepath='Objects/bytearrayobject.c' line='168' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyByteArray_Resize'>
+      <parameter type-id='type-id-16' name='self' filepath='Objects/bytearrayobject.c' line='168' column='1'/>
+      <parameter type-id='type-id-31' name='requested_size' filepath='Objects/bytearrayobject.c' line='168' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyByteArray_AsString' mangled-name='PyByteArray_AsString' filepath='Objects/bytearrayobject.c' line='159' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyByteArray_AsString'>
+      <parameter type-id='type-id-16' name='self' filepath='Objects/bytearrayobject.c' line='159' column='1'/>
+      <return type-id='type-id-72'/>
+    </function-decl>
+    <function-decl name='PyByteArray_Size' mangled-name='PyByteArray_Size' filepath='Objects/bytearrayobject.c' line='150' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyByteArray_Size'>
+      <parameter type-id='type-id-16' name='self' filepath='Objects/bytearrayobject.c' line='150' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='PyByteArray_FromStringAndSize' mangled-name='PyByteArray_FromStringAndSize' filepath='Objects/bytearrayobject.c' line='106' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyByteArray_FromStringAndSize'>
+      <parameter type-id='type-id-3' name='bytes' filepath='Objects/bytearrayobject.c' line='106' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/bytearrayobject.c' line='106' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyByteArray_FromObject' mangled-name='PyByteArray_FromObject' filepath='Objects/bytearrayobject.c' line='80' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyByteArray_FromObject'>
+      <parameter type-id='type-id-16' name='input' filepath='Objects/bytearrayobject.c' line='80' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyObject_GC_Del' mangled-name='PyObject_GC_Del' filepath='./Include/objimpl.h' line='182' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_bytes_endswith' mangled-name='_Py_bytes_endswith' filepath='./Include/internal/pycore_bytes_methods.h' line='36' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_bytes_startswith' mangled-name='_Py_bytes_startswith' filepath='./Include/internal/pycore_bytes_methods.h' line='35' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_bytes_contains' mangled-name='_Py_bytes_contains' filepath='./Include/internal/pycore_bytes_methods.h' line='34' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_bytes_rindex' mangled-name='_Py_bytes_rindex' filepath='./Include/internal/pycore_bytes_methods.h' line='32' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_bytes_rfind' mangled-name='_Py_bytes_rfind' filepath='./Include/internal/pycore_bytes_methods.h' line='31' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_bytes_index' mangled-name='_Py_bytes_index' filepath='./Include/internal/pycore_bytes_methods.h' line='30' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_bytes_count' mangled-name='_Py_bytes_count' filepath='./Include/internal/pycore_bytes_methods.h' line='33' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_bytes_find' mangled-name='_Py_bytes_find' filepath='./Include/internal/pycore_bytes_methods.h' line='29' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyNumber_Index' mangled-name='_PyNumber_Index' filepath='./Include/cpython/abstract.h' line='373' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyArg_BadArgument' mangled-name='_PyArg_BadArgument' filepath='./Include/modsupport.h' line='72' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyArg_UnpackKeywords' mangled-name='_PyArg_UnpackKeywords' filepath='./Include/modsupport.h' line='124' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyLong_AsInt' mangled-name='_PyLong_AsInt' filepath='./Include/longobject.h' line='30' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_bytes_swapcase' mangled-name='_Py_bytes_swapcase' filepath='./Include/internal/pycore_bytes_methods.h' line='27' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_bytes_capitalize' mangled-name='_Py_bytes_capitalize' filepath='./Include/internal/pycore_bytes_methods.h' line='26' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_bytes_title' mangled-name='_Py_bytes_title' filepath='./Include/internal/pycore_bytes_methods.h' line='25' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_bytes_upper' mangled-name='_Py_bytes_upper' filepath='./Include/internal/pycore_bytes_methods.h' line='24' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_bytes_lower' mangled-name='_Py_bytes_lower' filepath='./Include/internal/pycore_bytes_methods.h' line='23' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_bytes_istitle' mangled-name='_Py_bytes_istitle' filepath='./Include/internal/pycore_bytes_methods.h' line='20' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_bytes_isupper' mangled-name='_Py_bytes_isupper' filepath='./Include/internal/pycore_bytes_methods.h' line='19' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_bytes_islower' mangled-name='_Py_bytes_islower' filepath='./Include/internal/pycore_bytes_methods.h' line='18' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_bytes_isdigit' mangled-name='_Py_bytes_isdigit' filepath='./Include/internal/pycore_bytes_methods.h' line='17' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_bytes_isascii' mangled-name='_Py_bytes_isascii' filepath='./Include/internal/pycore_bytes_methods.h' line='16' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_bytes_isalnum' mangled-name='_Py_bytes_isalnum' filepath='./Include/internal/pycore_bytes_methods.h' line='15' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_bytes_isalpha' mangled-name='_Py_bytes_isalpha' filepath='./Include/internal/pycore_bytes_methods.h' line='14' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_bytes_isspace' mangled-name='_Py_bytes_isspace' filepath='./Include/internal/pycore_bytes_methods.h' line='13' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PySequence_Fast' mangled-name='PySequence_Fast' filepath='./Include/abstract.h' line='715' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_Print' mangled-name='PyErr_Print' filepath='./Include/pythonrun.h' line='12' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_Free' mangled-name='PyObject_Free' filepath='./Include/objimpl.h' line='102' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_GetConfig' mangled-name='_Py_GetConfig' filepath='./Include/cpython/pystate.h' line='245' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_WarnEx' mangled-name='PyErr_WarnEx' filepath='./Include/warnings.h' line='11' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_Malloc' mangled-name='PyObject_Malloc' filepath='./Include/objimpl.h' line='97' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyLong_AsLongAndOverflow' mangled-name='PyLong_AsLongAndOverflow' filepath='./Include/longobject.h' line='24' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_Check' mangled-name='PyNumber_Check' filepath='./Include/abstract.h' line='417' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PySlice_Unpack' mangled-name='PySlice_Unpack' filepath='./Include/sliceobject.h' line='55' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PySlice_AdjustIndices' mangled-name='PySlice_AdjustIndices' filepath='./Include/sliceobject.h' line='57' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_Realloc' mangled-name='PyObject_Realloc' filepath='./Include/objimpl.h' line='101' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObject_New' mangled-name='_PyObject_New' filepath='./Include/objimpl.h' line='131' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyBuffer_ToContiguous' mangled-name='PyBuffer_ToContiguous' filepath='./Include/cpython/abstract.h' line='282' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_DecodeLatin1' mangled-name='PyUnicode_DecodeLatin1' filepath='./Include/unicodeobject.h' line='634' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_strhex_with_sep' mangled-name='_Py_strhex_with_sep' filepath='./Include/pystrhex.h' line='14' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_FromEncodedObject' mangled-name='PyUnicode_FromEncodedObject' filepath='./Include/unicodeobject.h' line='235' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_GetDefaultEncoding' mangled-name='PyUnicode_GetDefaultEncoding' filepath='./Include/unicodeobject.h' line='355' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyList_Reverse' mangled-name='PyList_Reverse' filepath='./Include/listobject.h' line='40' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyBuffer_IsContiguous' mangled-name='PyBuffer_IsContiguous' filepath='./Include/cpython/abstract.h' line='304' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_bytes_maketrans' mangled-name='_Py_bytes_maketrans' filepath='./Include/internal/pycore_bytes_methods.h' line='39' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_AsEncodedString' mangled-name='PyUnicode_AsEncodedString' filepath='./Include/unicodeobject.h' line='412' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_GetIter' mangled-name='PyObject_GetIter' filepath='./Include/abstract.h' line='372' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObject_GC_New' mangled-name='_PyObject_GC_New' filepath='./Include/objimpl.h' line='169' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyBuffer_FillInfo' mangled-name='PyBuffer_FillInfo' filepath='./Include/cpython/abstract.h' line='321' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyBytes_FormatEx' mangled-name='_PyBytes_FormatEx' filepath='./Include/cpython/bytesobject.h' line='18' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyEval_GetBuiltinId' mangled-name='_PyEval_GetBuiltinId' filepath='./Include/cpython/ceval.h' line='16' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyBytes_FromHex' mangled-name='_PyBytes_FromHex' filepath='./Include/cpython/bytesobject.h' line='23' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_LengthHint' mangled-name='PyObject_LengthHint' filepath='./Include/cpython/abstract.h' line='258' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyIter_Next' mangled-name='PyIter_Next' filepath='./Include/abstract.h' line='396' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/bytesobject.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PyBytes_Type' type-id='type-id-149' mangled-name='PyBytes_Type' visibility='default' filepath='./Include/bytesobject.h' line='27' column='1' elf-symbol-id='PyBytes_Type'/>
+    <var-decl name='PyBytesIter_Type' type-id='type-id-149' mangled-name='PyBytesIter_Type' visibility='default' filepath='./Include/bytesobject.h' line='28' column='1' elf-symbol-id='PyBytesIter_Type'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='4416' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-210' visibility='default' filepath='./Include/cpython/bytesobject.h' line='44' column='1' id='type-id-211'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='buffer' type-id='type-id-16' visibility='default' filepath='./Include/cpython/bytesobject.h' line='46' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='allocated' type-id='type-id-31' visibility='default' filepath='./Include/cpython/bytesobject.h' line='49' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='min_size' type-id='type-id-31' visibility='default' filepath='./Include/cpython/bytesobject.h' line='53' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='use_bytearray' type-id='type-id-9' visibility='default' filepath='./Include/cpython/bytesobject.h' line='56' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='224'>
+        <var-decl name='overallocate' type-id='type-id-9' visibility='default' filepath='./Include/cpython/bytesobject.h' line='60' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='use_small_buffer' type-id='type-id-9' visibility='default' filepath='./Include/cpython/bytesobject.h' line='63' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='288'>
+        <var-decl name='small_buffer' type-id='type-id-212' visibility='default' filepath='./Include/cpython/bytesobject.h' line='64' column='1'/>
+      </data-member>
+    </class-decl>
+
+    <array-type-def dimensions='1' type-id='type-id-1' size-in-bits='4096' id='type-id-212'>
+      <subrange length='512' type-id='type-id-19' id='type-id-213'/>
+
+    </array-type-def>
+    <typedef-decl name='_PyBytesWriter' type-id='type-id-211' filepath='./Include/cpython/bytesobject.h' line='65' column='1' id='type-id-210'/>
+    <pointer-type-def type-id='type-id-210' size-in-bits='64' id='type-id-214'/>
+    <function-decl name='_PyBytesWriter_WriteBytes' mangled-name='_PyBytesWriter_WriteBytes' filepath='Objects/bytesobject.c' line='3504' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyBytesWriter_WriteBytes'>
+      <parameter type-id='type-id-214' name='writer' filepath='Objects/bytesobject.c' line='3504' column='1'/>
+      <parameter type-id='type-id-21' name='ptr' filepath='Objects/bytesobject.c' line='3504' column='1'/>
+      <parameter type-id='type-id-21' name='bytes' filepath='Objects/bytesobject.c' line='3505' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/bytesobject.c' line='3505' column='1'/>
+      <return type-id='type-id-21'/>
+    </function-decl>
+    <function-decl name='_PyBytesWriter_Finish' mangled-name='_PyBytesWriter_Finish' filepath='Objects/bytesobject.c' line='3460' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyBytesWriter_Finish'>
+      <parameter type-id='type-id-214' name='writer' filepath='Objects/bytesobject.c' line='3460' column='1'/>
+      <parameter type-id='type-id-21' name='str' filepath='Objects/bytesobject.c' line='3460' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyBytesWriter_Alloc' mangled-name='_PyBytesWriter_Alloc' filepath='Objects/bytesobject.c' line='3430' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyBytesWriter_Alloc'>
+      <parameter type-id='type-id-214' name='writer' filepath='Objects/bytesobject.c' line='3430' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/bytesobject.c' line='3430' column='1'/>
+      <return type-id='type-id-21'/>
+    </function-decl>
+    <function-decl name='_PyBytesWriter_Resize' mangled-name='_PyBytesWriter_Resize' filepath='Objects/bytesobject.c' line='3330' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyBytesWriter_Resize'>
+      <parameter type-id='type-id-214' name='writer' filepath='Objects/bytesobject.c' line='3330' column='1'/>
+      <parameter type-id='type-id-21' name='str' filepath='Objects/bytesobject.c' line='3330' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/bytesobject.c' line='3330' column='1'/>
+      <return type-id='type-id-21'/>
+    </function-decl>
+    <function-decl name='_PyBytesWriter_Dealloc' mangled-name='_PyBytesWriter_Dealloc' filepath='Objects/bytesobject.c' line='3260' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyBytesWriter_Dealloc'>
+      <parameter type-id='type-id-214' name='writer' filepath='Objects/bytesobject.c' line='3260' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyBytesWriter_Init' mangled-name='_PyBytesWriter_Init' filepath='Objects/bytesobject.c' line='3249' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyBytesWriter_Init'>
+      <parameter type-id='type-id-214' name='writer' filepath='Objects/bytesobject.c' line='3249' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyBytes_Resize' mangled-name='_PyBytes_Resize' filepath='Objects/bytesobject.c' line='3010' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyBytes_Resize'>
+      <parameter type-id='type-id-86' name='pv' filepath='Objects/bytesobject.c' line='3010' column='1'/>
+      <parameter type-id='type-id-31' name='newsize' filepath='Objects/bytesobject.c' line='3010' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyBytes_ConcatAndDel' mangled-name='PyBytes_ConcatAndDel' filepath='Objects/bytesobject.c' line='2988' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyBytes_ConcatAndDel'>
+      <parameter type-id='type-id-86' name='pv' filepath='Objects/bytesobject.c' line='2988' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/bytesobject.c' line='2988' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyBytes_FromHex' mangled-name='_PyBytes_FromHex' filepath='Objects/bytesobject.c' line='2359' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyBytes_FromHex'>
+      <parameter type-id='type-id-16' name='string' filepath='Objects/bytesobject.c' line='2359' column='1'/>
+      <parameter type-id='type-id-9' name='use_bytearray' filepath='Objects/bytesobject.c' line='2359' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyBytes_Join' mangled-name='_PyBytes_Join' filepath='Objects/bytesobject.c' line='1840' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyBytes_Join'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/abstract.c' line='1321' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyBytes_Repr' mangled-name='PyBytes_Repr' filepath='Objects/bytesobject.c' line='1292' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyBytes_Repr'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/bytesobject.c' line='1292' column='1'/>
+      <parameter type-id='type-id-9' name='smartquotes' filepath='Objects/bytesobject.c' line='1292' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <pointer-type-def type-id='type-id-72' size-in-bits='64' id='type-id-215'/>
+    <function-decl name='PyBytes_AsStringAndSize' mangled-name='PyBytes_AsStringAndSize' filepath='Objects/bytesobject.c' line='1246' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyBytes_AsStringAndSize'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/bytesobject.c' line='1246' column='1'/>
+      <parameter type-id='type-id-215' name='s' filepath='Objects/bytesobject.c' line='1247' column='1'/>
+      <parameter type-id='type-id-125' name='len' filepath='Objects/bytesobject.c' line='1248' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyBytes_AsString' mangled-name='PyBytes_AsString' filepath='Objects/bytesobject.c' line='1235' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyBytes_AsString'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/bytesobject.c' line='1235' column='1'/>
+      <return type-id='type-id-72'/>
+    </function-decl>
+    <function-decl name='PyBytes_Size' mangled-name='PyBytes_Size' filepath='Objects/bytesobject.c' line='1224' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyBytes_Size'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/bytesobject.c' line='1224' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='PyBytes_DecodeEscape' mangled-name='PyBytes_DecodeEscape' filepath='Objects/bytesobject.c' line='1198' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyBytes_DecodeEscape'>
+      <parameter type-id='type-id-3' name='s' filepath='Objects/bytesobject.c' line='1198' column='1'/>
+      <parameter type-id='type-id-31' name='len' filepath='Objects/bytesobject.c' line='1199' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/bytesobject.c' line='1200' column='1'/>
+      <parameter type-id='type-id-31' name='_unused_unicode' filepath='Objects/bytesobject.c' line='1201' column='1'/>
+      <parameter type-id='type-id-3' name='_unused_recode_encoding' filepath='Objects/bytesobject.c' line='1202' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyBytes_DecodeEscape' mangled-name='_PyBytes_DecodeEscape' filepath='Objects/bytesobject.c' line='1090' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyBytes_DecodeEscape'>
+      <parameter type-id='type-id-3' name='s' filepath='Objects/bytesobject.c' line='1090' column='1'/>
+      <parameter type-id='type-id-31' name='len' filepath='Objects/bytesobject.c' line='1091' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/bytesobject.c' line='1092' column='1'/>
+      <parameter type-id='type-id-196' name='first_invalid_escape' filepath='Objects/bytesobject.c' line='1093' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyBytes_FormatEx' mangled-name='_PyBytes_FormatEx' filepath='Objects/bytesobject.c' line='610' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyBytes_FormatEx'>
+      <parameter type-id='type-id-3' name='format' filepath='Objects/bytesobject.c' line='610' column='1'/>
+      <parameter type-id='type-id-31' name='format_len' filepath='Objects/bytesobject.c' line='610' column='1'/>
+      <parameter type-id='type-id-16' name='args' filepath='Objects/bytesobject.c' line='611' column='1'/>
+      <parameter type-id='type-id-9' name='use_bytearray' filepath='Objects/bytesobject.c' line='611' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyBytes_FromFormat' mangled-name='PyBytes_FromFormat' filepath='Objects/bytesobject.c' line='410' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyBytes_FromFormat'>
+      <parameter type-id='type-id-3' name='format' filepath='Objects/bytesobject.c' line='410' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <class-decl name='__va_list_tag' size-in-bits='192' is-struct='yes' visibility='default' id='type-id-216'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='gp_offset' type-id='type-id-66' visibility='default'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='32'>
+        <var-decl name='fp_offset' type-id='type-id-66' visibility='default'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='overflow_arg_area' type-id='type-id-21' visibility='default'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='reg_save_area' type-id='type-id-21' visibility='default'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-216' size-in-bits='64' id='type-id-217'/>
+    <function-decl name='PyBytes_FromFormatV' mangled-name='PyBytes_FromFormatV' filepath='Objects/bytesobject.c' line='219' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyBytes_FromFormatV'>
+      <parameter type-id='type-id-3' name='format' filepath='Objects/bytesobject.c' line='219' column='1'/>
+      <parameter type-id='type-id-217' name='vargs' filepath='Objects/bytesobject.c' line='219' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyBytes_FromString' mangled-name='PyBytes_FromString' filepath='Objects/bytesobject.c' line='176' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyBytes_FromString'>
+      <parameter type-id='type-id-3' name='str' filepath='Objects/bytesobject.c' line='176' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyBytes_FromStringAndSize' mangled-name='PyBytes_FromStringAndSize' filepath='Objects/bytesobject.c' line='139' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyBytes_FromStringAndSize'>
+      <parameter type-id='type-id-3' name='str' filepath='Objects/bytesobject.c' line='139' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/bytesobject.c' line='139' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyBytes_Concat' mangled-name='PyBytes_Concat' filepath='Objects/bytesobject.c' line='2939' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyBytes_Concat'>
+      <parameter type-id='type-id-86' name='pv' filepath='Objects/bytesobject.c' line='2939' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/bytesobject.c' line='2939' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyBytesWriter_Prepare' mangled-name='_PyBytesWriter_Prepare' filepath='Objects/bytesobject.c' line='3400' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyBytesWriter_Prepare'>
+      <parameter type-id='type-id-214' name='writer' filepath='Objects/bytesobject.c' line='3400' column='1'/>
+      <parameter type-id='type-id-21' name='str' filepath='Objects/bytesobject.c' line='3400' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/bytesobject.c' line='3400' column='1'/>
+      <return type-id='type-id-21'/>
+    </function-decl>
+    <function-decl name='PyBytes_FromObject' mangled-name='PyBytes_FromObject' filepath='Objects/bytesobject.c' line='2818' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyBytes_FromObject'>
+      <parameter type-id='type-id-16' name='x' filepath='Objects/bytesobject.c' line='2818' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyByteArray_Resize' mangled-name='PyByteArray_Resize' filepath='./Include/bytearrayobject.h' line='35' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyByteArray_FromStringAndSize' mangled-name='PyByteArray_FromStringAndSize' filepath='./Include/bytearrayobject.h' line='32' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_NewReference' mangled-name='_Py_NewReference' filepath='./Include/cpython/object.h' line='5' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_HashBytes' mangled-name='_Py_HashBytes' filepath='./Include/pyhash.h' line='14' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_BadArgument' mangled-name='PyErr_BadArgument' filepath='./Include/pyerrors.h' line='155' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_GetItem' mangled-name='PyObject_GetItem' filepath='./Include/abstract.h' line='289' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyLong_FormatBytesWriter' mangled-name='_PyLong_FormatBytesWriter' filepath='./Include/longobject.h' line='184' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyTuple_GetItem' mangled-name='PyTuple_GetItem' filepath='./Include/tupleobject.h' line='32' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_FormatLong' mangled-name='_PyUnicode_FormatLong' filepath='./Include/cpython/unicodeobject.h' line='1157' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_Long' mangled-name='PyNumber_Long' filepath='./Include/abstract.h' line='538' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_ASCII' mangled-name='PyObject_ASCII' filepath='./Include/object.h' line='267' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyFloat_AsDouble' mangled-name='PyFloat_AsDouble' filepath='./Include/floatobject.h' line='49' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyOS_double_to_string' mangled-name='PyOS_double_to_string' filepath='./Include/pystrtod.h' line='15' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__builtin___memmove_chk' mangled-name='__memmove_chk' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_Calloc' mangled-name='PyObject_Calloc' filepath='./Include/objimpl.h' line='99' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/call.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='_PyStack_AsDict' mangled-name='_PyStack_AsDict' filepath='Objects/call.c' line='851' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyStack_AsDict'>
+      <parameter type-id='type-id-156' name='values' filepath='Objects/call.c' line='851' column='1'/>
+      <parameter type-id='type-id-16' name='kwnames' filepath='Objects/call.c' line='851' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyObject_CallFunctionObjArgs' mangled-name='PyObject_CallFunctionObjArgs' filepath='Objects/call.c' line='834' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_CallFunctionObjArgs'>
+      <parameter type-id='type-id-16' name='callable' filepath='Objects/call.c' line='834' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <class-decl name='_Py_Identifier' size-in-bits='128' is-struct='yes' visibility='default' filepath='./Include/cpython/object.h' line='37' column='1' id='type-id-218'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='string' type-id='type-id-3' visibility='default' filepath='./Include/cpython/object.h' line='38' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='index' type-id='type-id-31' visibility='default' filepath='./Include/cpython/object.h' line='41' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-218' size-in-bits='64' id='type-id-219'/>
+    <function-decl name='_PyObject_CallMethodIdObjArgs' mangled-name='_PyObject_CallMethodIdObjArgs' filepath='Objects/call.c' line='803' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_CallMethodIdObjArgs'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/call.c' line='803' column='1'/>
+      <parameter type-id='type-id-219' name='name' filepath='Objects/call.c' line='804' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyObject_CallMethodObjArgs' mangled-name='PyObject_CallMethodObjArgs' filepath='Objects/call.c' line='778' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_CallMethodObjArgs'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/call.c' line='778' column='1'/>
+      <parameter type-id='type-id-16' name='name' filepath='Objects/call.c' line='778' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyObject_VectorcallMethod' mangled-name='PyObject_VectorcallMethod' filepath='Objects/call.c' line='744' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_VectorcallMethod'>
+      <parameter type-id='type-id-16' name='name' filepath='Objects/call.c' line='744' column='1'/>
+      <parameter type-id='type-id-156' name='args' filepath='Objects/call.c' line='744' column='1'/>
+      <parameter type-id='type-id-157' name='nargsf' filepath='Objects/call.c' line='745' column='1'/>
+      <parameter type-id='type-id-16' name='kwnames' filepath='Objects/call.c' line='745' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <typedef-decl name='_Py_Identifier' type-id='type-id-218' filepath='./Include/cpython/object.h' line='42' column='1' id='type-id-220'/>
+    <function-decl name='_PyObject_CallMethodId_SizeT' mangled-name='_PyObject_CallMethodId_SizeT' filepath='Objects/call.c' line='660' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_CallMethodId_SizeT'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/call.c' line='660' column='1'/>
+      <parameter type-id='type-id-219' name='name' filepath='Objects/call.c' line='660' column='1'/>
+      <parameter type-id='type-id-3' name='format' filepath='Objects/call.c' line='661' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyObject_CallMethod_SizeT' mangled-name='_PyObject_CallMethod_SizeT' filepath='Objects/call.c' line='636' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_CallMethod_SizeT'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/call.c' line='636' column='1'/>
+      <parameter type-id='type-id-3' name='name' filepath='Objects/call.c' line='636' column='1'/>
+      <parameter type-id='type-id-3' name='format' filepath='Objects/call.c' line='637' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyObject_CallMethodId' mangled-name='_PyObject_CallMethodId' filepath='Objects/call.c' line='612' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_CallMethodId'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/call.c' line='660' column='1'/>
+      <parameter type-id='type-id-219' name='name' filepath='Objects/call.c' line='660' column='1'/>
+      <parameter type-id='type-id-3' name='format' filepath='Objects/call.c' line='661' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyEval_CallMethod' mangled-name='PyEval_CallMethod' filepath='Objects/call.c' line='589' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyEval_CallMethod'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/call.c' line='636' column='1'/>
+      <parameter type-id='type-id-3' name='name' filepath='Objects/call.c' line='636' column='1'/>
+      <parameter type-id='type-id-3' name='format' filepath='Objects/call.c' line='637' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyObject_CallMethod' mangled-name='PyObject_CallMethod' filepath='Objects/call.c' line='562' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_CallMethod'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/call.c' line='636' column='1'/>
+      <parameter type-id='type-id-3' name='name' filepath='Objects/call.c' line='636' column='1'/>
+      <parameter type-id='type-id-3' name='format' filepath='Objects/call.c' line='637' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyObject_CallFunction_SizeT' mangled-name='_PyObject_CallFunction_SizeT' filepath='Objects/call.c' line='533' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_CallFunction_SizeT'>
+      <parameter type-id='type-id-16' name='callable' filepath='Objects/call.c' line='533' column='1'/>
+      <parameter type-id='type-id-3' name='format' filepath='Objects/call.c' line='533' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyEval_CallFunction' mangled-name='PyEval_CallFunction' filepath='Objects/call.c' line='518' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyEval_CallFunction'>
+      <parameter type-id='type-id-16' name='callable' filepath='Objects/call.c' line='533' column='1'/>
+      <parameter type-id='type-id-3' name='format' filepath='Objects/call.c' line='533' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyObject_CallFunction' mangled-name='PyObject_CallFunction' filepath='Objects/call.c' line='500' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_CallFunction'>
+      <parameter type-id='type-id-16' name='callable' filepath='Objects/call.c' line='533' column='1'/>
+      <parameter type-id='type-id-3' name='format' filepath='Objects/call.c' line='533' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <class-decl name='_ts' size-in-bits='2240' is-struct='yes' visibility='default' filepath='./Include/cpython/pystate.h' line='60' column='1' id='type-id-221'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='prev' type-id='type-id-11' visibility='default' filepath='./Include/cpython/pystate.h' line='63' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='next' type-id='type-id-11' visibility='default' filepath='./Include/cpython/pystate.h' line='64' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='interp' type-id='type-id-222' visibility='default' filepath='./Include/cpython/pystate.h' line='65' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='frame' type-id='type-id-223' visibility='default' filepath='./Include/cpython/pystate.h' line='68' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='recursion_depth' type-id='type-id-9' visibility='default' filepath='./Include/cpython/pystate.h' line='69' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='288'>
+        <var-decl name='recursion_headroom' type-id='type-id-9' visibility='default' filepath='./Include/cpython/pystate.h' line='70' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='stackcheck_counter' type-id='type-id-9' visibility='default' filepath='./Include/cpython/pystate.h' line='71' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='352'>
+        <var-decl name='tracing' type-id='type-id-9' visibility='default' filepath='./Include/cpython/pystate.h' line='76' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='384'>
+        <var-decl name='cframe' type-id='type-id-14' visibility='default' filepath='./Include/cpython/pystate.h' line='80' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='448'>
+        <var-decl name='c_profilefunc' type-id='type-id-15' visibility='default' filepath='./Include/cpython/pystate.h' line='82' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='512'>
+        <var-decl name='c_tracefunc' type-id='type-id-15' visibility='default' filepath='./Include/cpython/pystate.h' line='83' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='576'>
+        <var-decl name='c_profileobj' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='84' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='640'>
+        <var-decl name='c_traceobj' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='85' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='704'>
+        <var-decl name='curexc_type' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='88' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='768'>
+        <var-decl name='curexc_value' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='89' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='832'>
+        <var-decl name='curexc_traceback' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='90' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='896'>
+        <var-decl name='exc_state' type-id='type-id-17' visibility='default' filepath='./Include/cpython/pystate.h' line='95' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1152'>
+        <var-decl name='exc_info' type-id='type-id-18' visibility='default' filepath='./Include/cpython/pystate.h' line='99' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1216'>
+        <var-decl name='dict' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='101' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1280'>
+        <var-decl name='gilstate_counter' type-id='type-id-9' visibility='default' filepath='./Include/cpython/pystate.h' line='103' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1344'>
+        <var-decl name='async_exc' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='105' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1408'>
+        <var-decl name='thread_id' type-id='type-id-19' visibility='default' filepath='./Include/cpython/pystate.h' line='106' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1472'>
+        <var-decl name='trash_delete_nesting' type-id='type-id-9' visibility='default' filepath='./Include/cpython/pystate.h' line='108' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1536'>
+        <var-decl name='trash_delete_later' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='109' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1600'>
+        <var-decl name='on_delete' type-id='type-id-20' visibility='default' filepath='./Include/cpython/pystate.h' line='134' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1664'>
+        <var-decl name='on_delete_data' type-id='type-id-21' visibility='default' filepath='./Include/cpython/pystate.h' line='135' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1728'>
+        <var-decl name='coroutine_origin_tracking_depth' type-id='type-id-9' visibility='default' filepath='./Include/cpython/pystate.h' line='137' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1792'>
+        <var-decl name='async_gen_firstiter' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='139' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1856'>
+        <var-decl name='async_gen_finalizer' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='140' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1920'>
+        <var-decl name='context' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='142' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1984'>
+        <var-decl name='context_ver' type-id='type-id-22' visibility='default' filepath='./Include/cpython/pystate.h' line='143' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2048'>
+        <var-decl name='id' type-id='type-id-22' visibility='default' filepath='./Include/cpython/pystate.h' line='146' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2112'>
+        <var-decl name='root_cframe' type-id='type-id-23' visibility='default' filepath='./Include/cpython/pystate.h' line='148' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='_is' size-in-bits='908160' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_interp.h' line='220' column='1' id='type-id-224'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='next' type-id='type-id-225' visibility='default' filepath='./Include/internal/pycore_interp.h' line='222' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='tstate_head' type-id='type-id-11' visibility='default' filepath='./Include/internal/pycore_interp.h' line='223' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='runtime' type-id='type-id-226' visibility='default' filepath='./Include/internal/pycore_interp.h' line='228' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='id' type-id='type-id-227' visibility='default' filepath='./Include/internal/pycore_interp.h' line='230' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='id_refcount' type-id='type-id-227' visibility='default' filepath='./Include/internal/pycore_interp.h' line='231' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='requires_idref' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_interp.h' line='232' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='384'>
+        <var-decl name='id_mutex' type-id='type-id-228' visibility='default' filepath='./Include/internal/pycore_interp.h' line='233' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='448'>
+        <var-decl name='finalizing' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_interp.h' line='235' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='512'>
+        <var-decl name='ceval' type-id='type-id-229' visibility='default' filepath='./Include/internal/pycore_interp.h' line='237' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='4928'>
+        <var-decl name='gc' type-id='type-id-230' visibility='default' filepath='./Include/internal/pycore_interp.h' line='238' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='6848'>
+        <var-decl name='modules' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='241' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='6912'>
+        <var-decl name='modules_by_index' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='242' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='6976'>
+        <var-decl name='sysdict' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='244' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7040'>
+        <var-decl name='builtins' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='246' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7104'>
+        <var-decl name='importlib' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='248' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7168'>
+        <var-decl name='num_threads' type-id='type-id-33' visibility='default' filepath='./Include/internal/pycore_interp.h' line='251' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7232'>
+        <var-decl name='pythread_stacksize' type-id='type-id-157' visibility='default' filepath='./Include/internal/pycore_interp.h' line='256' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7296'>
+        <var-decl name='codec_search_path' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='258' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7360'>
+        <var-decl name='codec_search_cache' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='259' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7424'>
+        <var-decl name='codec_error_registry' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='260' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7488'>
+        <var-decl name='codecs_initialized' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_interp.h' line='261' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7552'>
+        <var-decl name='config' type-id='type-id-231' visibility='default' filepath='./Include/internal/pycore_interp.h' line='263' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10688'>
+        <var-decl name='dlopenflags' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_interp.h' line='265' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10752'>
+        <var-decl name='dict' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='268' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10816'>
+        <var-decl name='builtins_copy' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='270' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10880'>
+        <var-decl name='import_func' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='271' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10944'>
+        <var-decl name='eval_frame' type-id='type-id-232' visibility='default' filepath='./Include/internal/pycore_interp.h' line='273' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='11008'>
+        <var-decl name='co_extra_user_count' type-id='type-id-31' visibility='default' filepath='./Include/internal/pycore_interp.h' line='275' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='11072'>
+        <var-decl name='co_extra_freefuncs' type-id='type-id-233' visibility='default' filepath='./Include/internal/pycore_interp.h' line='276' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='27392'>
+        <var-decl name='before_forkers' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='279' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='27456'>
+        <var-decl name='after_forkers_parent' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='280' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='27520'>
+        <var-decl name='after_forkers_child' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='281' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='27584'>
+        <var-decl name='tstate_next_unique_id' type-id='type-id-22' visibility='default' filepath='./Include/internal/pycore_interp.h' line='284' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='27648'>
+        <var-decl name='warnings' type-id='type-id-234' visibility='default' filepath='./Include/internal/pycore_interp.h' line='286' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='27904'>
+        <var-decl name='atexit' type-id='type-id-235' visibility='default' filepath='./Include/internal/pycore_interp.h' line='287' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='28032'>
+        <var-decl name='audit_hooks' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='289' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='28096'>
+        <var-decl name='small_ints' type-id='type-id-236' visibility='default' filepath='./Include/internal/pycore_interp.h' line='296' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='44864'>
+        <var-decl name='bytes' type-id='type-id-237' visibility='default' filepath='./Include/internal/pycore_interp.h' line='297' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='61312'>
+        <var-decl name='unicode' type-id='type-id-238' visibility='default' filepath='./Include/internal/pycore_interp.h' line='298' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='78208'>
+        <var-decl name='float_state' type-id='type-id-239' visibility='default' filepath='./Include/internal/pycore_interp.h' line='299' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='78336'>
+        <var-decl name='slice_cache' type-id='type-id-240' visibility='default' filepath='./Include/internal/pycore_interp.h' line='302' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='78400'>
+        <var-decl name='tuple' type-id='type-id-241' visibility='default' filepath='./Include/internal/pycore_interp.h' line='304' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='80320'>
+        <var-decl name='list' type-id='type-id-242' visibility='default' filepath='./Include/internal/pycore_interp.h' line='305' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='85504'>
+        <var-decl name='dict_state' type-id='type-id-243' visibility='default' filepath='./Include/internal/pycore_interp.h' line='306' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='95872'>
+        <var-decl name='frame' type-id='type-id-244' visibility='default' filepath='./Include/internal/pycore_interp.h' line='307' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='96000'>
+        <var-decl name='async_gen' type-id='type-id-245' visibility='default' filepath='./Include/internal/pycore_interp.h' line='308' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='106368'>
+        <var-decl name='context' type-id='type-id-246' visibility='default' filepath='./Include/internal/pycore_interp.h' line='309' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='106496'>
+        <var-decl name='exc_state' type-id='type-id-247' visibility='default' filepath='./Include/internal/pycore_interp.h' line='310' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='106688'>
+        <var-decl name='ast' type-id='type-id-248' visibility='default' filepath='./Include/internal/pycore_interp.h' line='312' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='121728'>
+        <var-decl name='type_cache' type-id='type-id-249' visibility='default' filepath='./Include/internal/pycore_interp.h' line='313' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-224' size-in-bits='64' id='type-id-225'/>
+    <class-decl name='pyruntimestate' size-in-bits='5376' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='61' column='1' id='type-id-250'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='preinitializing' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='63' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='32'>
+        <var-decl name='preinitialized' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='66' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='core_initialized' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='69' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='96'>
+        <var-decl name='initialized' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='72' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='_finalizing' type-id='type-id-251' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='79' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='interpreters' type-id='type-id-252' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='94' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='448'>
+        <var-decl name='xidregistry' type-id='type-id-253' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='99' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='576'>
+        <var-decl name='main_thread' type-id='type-id-19' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='101' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='640'>
+        <var-decl name='exitfuncs' type-id='type-id-254' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='104' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2688'>
+        <var-decl name='nexitfuncs' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='105' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2752'>
+        <var-decl name='ceval' type-id='type-id-255' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='107' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='4480'>
+        <var-decl name='gilstate' type-id='type-id-256' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='108' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='4736'>
+        <var-decl name='preconfig' type-id='type-id-257' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='110' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='5056'>
+        <var-decl name='open_code_hook' type-id='type-id-258' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='114' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='5120'>
+        <var-decl name='open_code_userdata' type-id='type-id-21' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='115' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='5184'>
+        <var-decl name='audit_hook_head' type-id='type-id-259' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='116' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='5248'>
+        <var-decl name='unicode_ids' type-id='type-id-260' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='118' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='_Py_atomic_address' size-in-bits='64' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_atomic.h' line='45' column='1' id='type-id-261'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='_value' type-id='type-id-262' visibility='default' filepath='./Include/internal/pycore_atomic.h' line='46' column='1'/>
+      </data-member>
+    </class-decl>
+    <type-decl name='atomic_uintptr_t' size-in-bits='64' id='type-id-262'/>
+    <typedef-decl name='_Py_atomic_address' type-id='type-id-261' filepath='./Include/internal/pycore_atomic.h' line='47' column='1' id='type-id-251'/>
+    <class-decl name='pyinterpreters' size-in-bits='256' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='81' column='1' id='type-id-252'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='mutex' type-id='type-id-228' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='82' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='head' type-id='type-id-222' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='83' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='main' type-id='type-id-222' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='84' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='next_id' type-id='type-id-227' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='93' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='PyThread_type_lock' type-id='type-id-21' filepath='./Include/pythread.h' line='5' column='1' id='type-id-228'/>
+    <typedef-decl name='PyInterpreterState' type-id='type-id-224' filepath='./Include/pystate.h' line='22' column='1' id='type-id-263'/>
+    <pointer-type-def type-id='type-id-263' size-in-bits='64' id='type-id-222'/>
+    <typedef-decl name='__int64_t' type-id='type-id-33' filepath='/usr/include/x86_64-linux-gnu/bits/types.h' line='44' column='1' id='type-id-264'/>
+    <typedef-decl name='int64_t' type-id='type-id-264' filepath='/usr/include/x86_64-linux-gnu/bits/stdint-intn.h' line='27' column='1' id='type-id-227'/>
+    <class-decl name='_xidregistry' size-in-bits='128' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='96' column='1' id='type-id-253'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='mutex' type-id='type-id-228' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='97' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='head' type-id='type-id-265' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='98' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='_xidregitem' size-in-bits='192' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_interp.h' line='328' column='1' id='type-id-266'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='cls' type-id='type-id-32' visibility='default' filepath='./Include/internal/pycore_interp.h' line='329' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='getdata' type-id='type-id-267' visibility='default' filepath='./Include/internal/pycore_interp.h' line='330' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='next' type-id='type-id-265' visibility='default' filepath='./Include/internal/pycore_interp.h' line='331' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='_xid' size-in-bits='320' is-struct='yes' visibility='default' filepath='./Include/cpython/pystate.h' line='255' column='1' id='type-id-268'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='data' type-id='type-id-21' visibility='default' filepath='./Include/cpython/pystate.h' line='259' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='obj' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='266' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='interp' type-id='type-id-227' visibility='default' filepath='./Include/cpython/pystate.h' line='276' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='new_object' type-id='type-id-269' visibility='default' filepath='./Include/cpython/pystate.h' line='281' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='free' type-id='type-id-20' visibility='default' filepath='./Include/cpython/pystate.h' line='291' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-268' size-in-bits='64' id='type-id-270'/>
+    <pointer-type-def type-id='type-id-271' size-in-bits='64' id='type-id-269'/>
+    <pointer-type-def type-id='type-id-272' size-in-bits='64' id='type-id-273'/>
+    <typedef-decl name='crossinterpdatafunc' type-id='type-id-273' filepath='./Include/cpython/pystate.h' line='302' column='1' id='type-id-267'/>
+    <pointer-type-def type-id='type-id-266' size-in-bits='64' id='type-id-265'/>
+    <pointer-type-def type-id='type-id-274' size-in-bits='64' id='type-id-275'/>
+
+    <array-type-def dimensions='1' type-id='type-id-275' size-in-bits='2048' id='type-id-254'>
+      <subrange length='32' type-id='type-id-19' id='type-id-276'/>
+
+    </array-type-def>
+    <class-decl name='_ceval_runtime_state' size-in-bits='1728' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='16' column='1' id='type-id-255'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='signals_pending' type-id='type-id-277' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='21' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='gil' type-id='type-id-278' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='23' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='_Py_atomic_int' size-in-bits='32' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_atomic.h' line='49' column='1' id='type-id-279'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='_value' type-id='type-id-280' visibility='default' filepath='./Include/internal/pycore_atomic.h' line='50' column='1'/>
+      </data-member>
+    </class-decl>
+    <type-decl name='atomic_int' size-in-bits='32' id='type-id-280'/>
+    <typedef-decl name='_Py_atomic_int' type-id='type-id-279' filepath='./Include/internal/pycore_atomic.h' line='51' column='1' id='type-id-277'/>
+    <class-decl name='_gil_runtime_state' size-in-bits='1664' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_gil.h' line='23' column='1' id='type-id-278'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='interval' type-id='type-id-19' visibility='default' filepath='./Include/internal/pycore_gil.h' line='25' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='last_holder' type-id='type-id-251' visibility='default' filepath='./Include/internal/pycore_gil.h' line='28' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='locked' type-id='type-id-277' visibility='default' filepath='./Include/internal/pycore_gil.h' line='31' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='switch_number' type-id='type-id-19' visibility='default' filepath='./Include/internal/pycore_gil.h' line='33' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='cond' type-id='type-id-281' visibility='default' filepath='./Include/internal/pycore_gil.h' line='37' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='640'>
+        <var-decl name='mutex' type-id='type-id-282' visibility='default' filepath='./Include/internal/pycore_gil.h' line='38' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='960'>
+        <var-decl name='switch_cond' type-id='type-id-281' visibility='default' filepath='./Include/internal/pycore_gil.h' line='42' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1344'>
+        <var-decl name='switch_mutex' type-id='type-id-282' visibility='default' filepath='./Include/internal/pycore_gil.h' line='43' column='1'/>
+      </data-member>
+    </class-decl>
+    <union-decl name='__anonymous_union__' size-in-bits='384' is-anonymous='yes' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h' line='75' column='1' id='type-id-283'>
+      <data-member access='private'>
+        <var-decl name='__data' type-id='type-id-284' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h' line='77' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='__size' type-id='type-id-285' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h' line='78' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='__align' type-id='type-id-286' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h' line='79' column='1'/>
+      </data-member>
+    </union-decl>
+    <class-decl name='__pthread_cond_s' size-in-bits='384' is-struct='yes' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/thread-shared-types.h' line='92' column='1' id='type-id-284'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='' type-id='type-id-287' visibility='default'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='__g_refs' type-id='type-id-288' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/thread-shared-types.h' line='112' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='__g_size' type-id='type-id-288' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/thread-shared-types.h' line='113' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='__g1_orig_size' type-id='type-id-66' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/thread-shared-types.h' line='114' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='288'>
+        <var-decl name='__wrefs' type-id='type-id-66' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/thread-shared-types.h' line='115' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='__g_signals' type-id='type-id-288' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/thread-shared-types.h' line='116' column='1'/>
+      </data-member>
+    </class-decl>
+    <union-decl name='__anonymous_union__' size-in-bits='64' is-anonymous='yes' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/thread-shared-types.h' line='94' column='1' id='type-id-287'>
+      <data-member access='private'>
+        <var-decl name='__wseq' type-id='type-id-289' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/thread-shared-types.h' line='96' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='__wseq32' type-id='type-id-290' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/thread-shared-types.h' line='101' column='1'/>
+      </data-member>
+    </union-decl>
+    <type-decl name='long long unsigned int' size-in-bits='64' id='type-id-289'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='64' is-struct='yes' is-anonymous='yes' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/thread-shared-types.h' line='97' column='1' id='type-id-290'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='__low' type-id='type-id-66' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/thread-shared-types.h' line='99' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='32'>
+        <var-decl name='__high' type-id='type-id-66' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/thread-shared-types.h' line='100' column='1'/>
+      </data-member>
+    </class-decl>
+
+    <array-type-def dimensions='1' type-id='type-id-66' size-in-bits='64' id='type-id-288'>
+      <subrange length='2' type-id='type-id-19' id='type-id-291'/>
+
+    </array-type-def>
+
+    <array-type-def dimensions='1' type-id='type-id-1' size-in-bits='384' id='type-id-285'>
+      <subrange length='48' type-id='type-id-19' id='type-id-292'/>
+
+    </array-type-def>
+    <type-decl name='long long int' size-in-bits='64' id='type-id-286'/>
+    <typedef-decl name='pthread_cond_t' type-id='type-id-283' filepath='/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h' line='80' column='1' id='type-id-281'/>
+    <union-decl name='__anonymous_union__' size-in-bits='320' is-anonymous='yes' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h' line='67' column='1' id='type-id-293'>
+      <data-member access='private'>
+        <var-decl name='__data' type-id='type-id-294' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h' line='69' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='__size' type-id='type-id-295' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h' line='70' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='__align' type-id='type-id-33' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h' line='71' column='1'/>
+      </data-member>
+    </union-decl>
+    <class-decl name='__pthread_mutex_s' size-in-bits='320' is-struct='yes' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/struct_mutex.h' line='22' column='1' id='type-id-294'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='__lock' type-id='type-id-9' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/struct_mutex.h' line='24' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='32'>
+        <var-decl name='__count' type-id='type-id-66' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/struct_mutex.h' line='25' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='__owner' type-id='type-id-9' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/struct_mutex.h' line='26' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='96'>
+        <var-decl name='__nusers' type-id='type-id-66' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/struct_mutex.h' line='28' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='__kind' type-id='type-id-9' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/struct_mutex.h' line='32' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='160'>
+        <var-decl name='__spins' type-id='type-id-296' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/struct_mutex.h' line='34' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='176'>
+        <var-decl name='__elision' type-id='type-id-296' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/struct_mutex.h' line='35' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='__list' type-id='type-id-297' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/struct_mutex.h' line='36' column='1'/>
+      </data-member>
+    </class-decl>
+    <type-decl name='short int' size-in-bits='16' id='type-id-296'/>
+    <class-decl name='__pthread_internal_list' size-in-bits='128' is-struct='yes' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/thread-shared-types.h' line='49' column='1' id='type-id-298'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='__prev' type-id='type-id-299' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/thread-shared-types.h' line='51' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='__next' type-id='type-id-299' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/thread-shared-types.h' line='52' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-298' size-in-bits='64' id='type-id-299'/>
+    <typedef-decl name='__pthread_list_t' type-id='type-id-298' filepath='/usr/include/x86_64-linux-gnu/bits/thread-shared-types.h' line='53' column='1' id='type-id-297'/>
+
+    <array-type-def dimensions='1' type-id='type-id-1' size-in-bits='320' id='type-id-295'>
+      <subrange length='40' type-id='type-id-19' id='type-id-300'/>
+
+    </array-type-def>
+    <typedef-decl name='pthread_mutex_t' type-id='type-id-293' filepath='/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h' line='72' column='1' id='type-id-282'/>
+    <class-decl name='_gilstate_runtime_state' size-in-bits='256' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='29' column='1' id='type-id-256'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='check_enabled' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='32' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='tstate_current' type-id='type-id-251' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='35' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='autoInterpreterState' type-id='type-id-222' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='40' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='autoTSSkey' type-id='type-id-301' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='41' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='_Py_tss_t' size-in-bits='64' is-struct='yes' visibility='default' filepath='./Include/pythread.h' line='143' column='1' id='type-id-302'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='_is_initialized' type-id='type-id-9' visibility='default' filepath='./Include/pythread.h' line='144' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='32'>
+        <var-decl name='_key' type-id='type-id-303' visibility='default' filepath='./Include/pythread.h' line='145' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='pthread_key_t' type-id='type-id-66' filepath='/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h' line='49' column='1' id='type-id-303'/>
+    <typedef-decl name='Py_tss_t' type-id='type-id-302' filepath='./Include/pythread.h' line='123' column='1' id='type-id-301'/>
+    <class-decl name='PyPreConfig' size-in-bits='320' is-struct='yes' visibility='default' filepath='./Include/cpython/initconfig.h' line='47' column='1' id='type-id-304'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='_config_init' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='48' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='32'>
+        <var-decl name='parse_argv' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='52' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='isolated' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='59' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='96'>
+        <var-decl name='use_environment' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='64' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='configure_locale' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='68' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='160'>
+        <var-decl name='coerce_c_locale' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='81' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='coerce_c_locale_warn' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='89' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='224'>
+        <var-decl name='utf8_mode' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='114' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='dev_mode' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='120' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='288'>
+        <var-decl name='allocator' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='124' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='PyPreConfig' type-id='type-id-304' filepath='./Include/cpython/initconfig.h' line='125' column='1' id='type-id-257'/>
+    <typedef-decl name='Py_OpenCodeHookFunction' type-id='type-id-146' filepath='./Include/cpython/fileobject.h' line='12' column='1' id='type-id-258'/>
+    <class-decl name='_Py_AuditHookEntry' size-in-bits='192' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='46' column='1' id='type-id-305'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='next' type-id='type-id-259' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='47' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='hookCFunction' type-id='type-id-306' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='48' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='userData' type-id='type-id-21' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='49' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-305' size-in-bits='64' id='type-id-259'/>
+    <pointer-type-def type-id='type-id-307' size-in-bits='64' id='type-id-308'/>
+    <typedef-decl name='Py_AuditHookFunction' type-id='type-id-308' filepath='./Include/cpython/sysmodule.h' line='10' column='1' id='type-id-306'/>
+    <typedef-decl name='_Py_AuditHookEntry' type-id='type-id-305' filepath='./Include/internal/pycore_runtime.h' line='50' column='1' id='type-id-309'/>
+    <class-decl name='_Py_unicode_runtime_ids' size-in-bits='128' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='52' column='1' id='type-id-260'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='lock' type-id='type-id-228' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='53' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='next_index' type-id='type-id-31' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='56' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-250' size-in-bits='64' id='type-id-226'/>
+    <class-decl name='_ceval_state' size-in-bits='4416' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_interp.h' line='34' column='1' id='type-id-229'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='recursion_limit' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_interp.h' line='35' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='32'>
+        <var-decl name='eval_breaker' type-id='type-id-277' visibility='default' filepath='./Include/internal/pycore_interp.h' line='38' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='gil_drop_request' type-id='type-id-277' visibility='default' filepath='./Include/internal/pycore_interp.h' line='40' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='pending' type-id='type-id-310' visibility='default' filepath='./Include/internal/pycore_interp.h' line='41' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='_pending_calls' size-in-bits='4288' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_interp.h' line='17' column='1' id='type-id-310'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='lock' type-id='type-id-228' visibility='default' filepath='./Include/internal/pycore_interp.h' line='18' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='calls_to_do' type-id='type-id-277' visibility='default' filepath='./Include/internal/pycore_interp.h' line='20' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='96'>
+        <var-decl name='async_exc' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_interp.h' line='24' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='calls' type-id='type-id-311' visibility='default' filepath='./Include/internal/pycore_interp.h' line='29' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='4224'>
+        <var-decl name='first' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_interp.h' line='30' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='4256'>
+        <var-decl name='last' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_interp.h' line='31' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='128' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_interp.h' line='26' column='1' id='type-id-312'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='func' type-id='type-id-313' visibility='default' filepath='./Include/internal/pycore_interp.h' line='27' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='arg' type-id='type-id-21' visibility='default' filepath='./Include/internal/pycore_interp.h' line='28' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-314' size-in-bits='64' id='type-id-313'/>
+
+    <array-type-def dimensions='1' type-id='type-id-312' size-in-bits='4096' id='type-id-311'>
+      <subrange length='32' type-id='type-id-19' id='type-id-276'/>
+
+    </array-type-def>
+    <class-decl name='_gc_runtime_state' size-in-bits='1920' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_gc.h' line='130' column='1' id='type-id-230'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='trash_delete_later' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_gc.h' line='133' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='trash_delete_nesting' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_gc.h' line='135' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='96'>
+        <var-decl name='enabled' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_gc.h' line='137' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='debug' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_gc.h' line='138' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='generations' type-id='type-id-315' visibility='default' filepath='./Include/internal/pycore_gc.h' line='140' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='768'>
+        <var-decl name='generation0' type-id='type-id-316' visibility='default' filepath='./Include/internal/pycore_gc.h' line='141' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='832'>
+        <var-decl name='permanent_generation' type-id='type-id-317' visibility='default' filepath='./Include/internal/pycore_gc.h' line='143' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1024'>
+        <var-decl name='generation_stats' type-id='type-id-318' visibility='default' filepath='./Include/internal/pycore_gc.h' line='144' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1600'>
+        <var-decl name='collecting' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_gc.h' line='146' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1664'>
+        <var-decl name='garbage' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_gc.h' line='148' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1728'>
+        <var-decl name='callbacks' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_gc.h' line='150' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1792'>
+        <var-decl name='long_lived_total' type-id='type-id-31' visibility='default' filepath='./Include/internal/pycore_gc.h' line='157' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1856'>
+        <var-decl name='long_lived_pending' type-id='type-id-31' visibility='default' filepath='./Include/internal/pycore_gc.h' line='161' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='gc_generation' size-in-bits='192' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_gc.h' line='113' column='1' id='type-id-317'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='head' type-id='type-id-319' visibility='default' filepath='./Include/internal/pycore_gc.h' line='114' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='threshold' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_gc.h' line='115' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='160'>
+        <var-decl name='count' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_gc.h' line='116' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='128' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-319' visibility='default' filepath='./Include/internal/pycore_gc.h' line='12' column='1' id='type-id-320'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='_gc_next' type-id='type-id-321' visibility='default' filepath='./Include/internal/pycore_gc.h' line='15' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='_gc_prev' type-id='type-id-321' visibility='default' filepath='./Include/internal/pycore_gc.h' line='19' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='uintptr_t' type-id='type-id-19' filepath='/usr/include/stdint.h' line='90' column='1' id='type-id-321'/>
+    <typedef-decl name='PyGC_Head' type-id='type-id-320' filepath='./Include/internal/pycore_gc.h' line='20' column='1' id='type-id-319'/>
+
+    <array-type-def dimensions='1' type-id='type-id-317' size-in-bits='576' id='type-id-315'>
+      <subrange length='3' type-id='type-id-19' id='type-id-322'/>
+
+    </array-type-def>
+    <pointer-type-def type-id='type-id-319' size-in-bits='64' id='type-id-316'/>
+    <class-decl name='gc_generation_stats' size-in-bits='192' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_gc.h' line='121' column='1' id='type-id-323'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='collections' type-id='type-id-31' visibility='default' filepath='./Include/internal/pycore_gc.h' line='123' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='collected' type-id='type-id-31' visibility='default' filepath='./Include/internal/pycore_gc.h' line='125' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='uncollectable' type-id='type-id-31' visibility='default' filepath='./Include/internal/pycore_gc.h' line='127' column='1'/>
+      </data-member>
+    </class-decl>
+
+    <array-type-def dimensions='1' type-id='type-id-323' size-in-bits='576' id='type-id-318'>
+      <subrange length='3' type-id='type-id-19' id='type-id-322'/>
+
+    </array-type-def>
+    <class-decl name='PyConfig' size-in-bits='3136' is-struct='yes' visibility='default' filepath='./Include/cpython/initconfig.h' line='134' column='1' id='type-id-324'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='_config_init' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='135' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='32'>
+        <var-decl name='isolated' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='137' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='use_environment' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='138' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='96'>
+        <var-decl name='dev_mode' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='139' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='install_signal_handlers' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='140' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='160'>
+        <var-decl name='use_hash_seed' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='141' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='hash_seed' type-id='type-id-19' visibility='default' filepath='./Include/cpython/initconfig.h' line='142' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='faulthandler' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='143' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='288'>
+        <var-decl name='tracemalloc' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='144' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='import_time' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='145' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='352'>
+        <var-decl name='show_ref_count' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='146' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='384'>
+        <var-decl name='dump_refs' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='147' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='416'>
+        <var-decl name='malloc_stats' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='148' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='448'>
+        <var-decl name='filesystem_encoding' type-id='type-id-325' visibility='default' filepath='./Include/cpython/initconfig.h' line='149' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='512'>
+        <var-decl name='filesystem_errors' type-id='type-id-325' visibility='default' filepath='./Include/cpython/initconfig.h' line='150' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='576'>
+        <var-decl name='pycache_prefix' type-id='type-id-325' visibility='default' filepath='./Include/cpython/initconfig.h' line='151' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='640'>
+        <var-decl name='parse_argv' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='152' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='704'>
+        <var-decl name='orig_argv' type-id='type-id-326' visibility='default' filepath='./Include/cpython/initconfig.h' line='153' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='832'>
+        <var-decl name='argv' type-id='type-id-326' visibility='default' filepath='./Include/cpython/initconfig.h' line='154' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='960'>
+        <var-decl name='xoptions' type-id='type-id-326' visibility='default' filepath='./Include/cpython/initconfig.h' line='155' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1088'>
+        <var-decl name='warnoptions' type-id='type-id-326' visibility='default' filepath='./Include/cpython/initconfig.h' line='156' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1216'>
+        <var-decl name='site_import' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='157' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1248'>
+        <var-decl name='bytes_warning' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='158' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1280'>
+        <var-decl name='warn_default_encoding' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='159' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1312'>
+        <var-decl name='inspect' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='160' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1344'>
+        <var-decl name='interactive' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='161' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1376'>
+        <var-decl name='optimization_level' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='162' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1408'>
+        <var-decl name='parser_debug' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='163' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1440'>
+        <var-decl name='write_bytecode' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='164' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1472'>
+        <var-decl name='verbose' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='165' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1504'>
+        <var-decl name='quiet' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='166' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1536'>
+        <var-decl name='user_site_directory' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='167' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1568'>
+        <var-decl name='configure_c_stdio' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='168' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1600'>
+        <var-decl name='buffered_stdio' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='169' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1664'>
+        <var-decl name='stdio_encoding' type-id='type-id-325' visibility='default' filepath='./Include/cpython/initconfig.h' line='170' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1728'>
+        <var-decl name='stdio_errors' type-id='type-id-325' visibility='default' filepath='./Include/cpython/initconfig.h' line='171' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1792'>
+        <var-decl name='check_hash_pycs_mode' type-id='type-id-325' visibility='default' filepath='./Include/cpython/initconfig.h' line='175' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1856'>
+        <var-decl name='pathconfig_warnings' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='178' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1920'>
+        <var-decl name='program_name' type-id='type-id-325' visibility='default' filepath='./Include/cpython/initconfig.h' line='179' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1984'>
+        <var-decl name='pythonpath_env' type-id='type-id-325' visibility='default' filepath='./Include/cpython/initconfig.h' line='180' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2048'>
+        <var-decl name='home' type-id='type-id-325' visibility='default' filepath='./Include/cpython/initconfig.h' line='181' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2112'>
+        <var-decl name='platlibdir' type-id='type-id-325' visibility='default' filepath='./Include/cpython/initconfig.h' line='182' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2176'>
+        <var-decl name='module_search_paths_set' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='185' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2240'>
+        <var-decl name='module_search_paths' type-id='type-id-326' visibility='default' filepath='./Include/cpython/initconfig.h' line='186' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2368'>
+        <var-decl name='executable' type-id='type-id-325' visibility='default' filepath='./Include/cpython/initconfig.h' line='187' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2432'>
+        <var-decl name='base_executable' type-id='type-id-325' visibility='default' filepath='./Include/cpython/initconfig.h' line='188' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2496'>
+        <var-decl name='prefix' type-id='type-id-325' visibility='default' filepath='./Include/cpython/initconfig.h' line='189' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2560'>
+        <var-decl name='base_prefix' type-id='type-id-325' visibility='default' filepath='./Include/cpython/initconfig.h' line='190' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2624'>
+        <var-decl name='exec_prefix' type-id='type-id-325' visibility='default' filepath='./Include/cpython/initconfig.h' line='191' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2688'>
+        <var-decl name='base_exec_prefix' type-id='type-id-325' visibility='default' filepath='./Include/cpython/initconfig.h' line='192' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2752'>
+        <var-decl name='skip_source_first_line' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='195' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2816'>
+        <var-decl name='run_command' type-id='type-id-325' visibility='default' filepath='./Include/cpython/initconfig.h' line='196' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2880'>
+        <var-decl name='run_module' type-id='type-id-325' visibility='default' filepath='./Include/cpython/initconfig.h' line='197' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2944'>
+        <var-decl name='run_filename' type-id='type-id-325' visibility='default' filepath='./Include/cpython/initconfig.h' line='198' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='3008'>
+        <var-decl name='_install_importlib' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='204' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='3040'>
+        <var-decl name='_init_main' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='207' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='3072'>
+        <var-decl name='_isolated_interpreter' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='211' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='wchar_t' type-id='type-id-9' filepath='/usr/lib/gcc/x86_64-linux-gnu/9/include/stddef.h' line='321' column='1' id='type-id-327'/>
+    <pointer-type-def type-id='type-id-327' size-in-bits='64' id='type-id-325'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='128' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-326' visibility='default' filepath='./Include/cpython/initconfig.h' line='31' column='1' id='type-id-328'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='length' type-id='type-id-31' visibility='default' filepath='./Include/cpython/initconfig.h' line='34' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='items' type-id='type-id-329' visibility='default' filepath='./Include/cpython/initconfig.h' line='35' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-325' size-in-bits='64' id='type-id-329'/>
+    <typedef-decl name='PyWideStringList' type-id='type-id-328' filepath='./Include/cpython/initconfig.h' line='36' column='1' id='type-id-326'/>
+    <typedef-decl name='PyConfig' type-id='type-id-324' filepath='./Include/cpython/initconfig.h' line='212' column='1' id='type-id-231'/>
+    <typedef-decl name='PyThreadState' type-id='type-id-221' filepath='./Include/pystate.h' line='20' column='1' id='type-id-330'/>
+    <pointer-type-def type-id='type-id-330' size-in-bits='64' id='type-id-331'/>
+    <class-decl name='_frame' size-in-bits='2880' is-struct='yes' visibility='default' filepath='./Include/cpython/frameobject.h' line='28' column='1' id='type-id-332'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='ob_base' type-id='type-id-37' visibility='default' filepath='./Include/cpython/frameobject.h' line='29' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='f_back' type-id='type-id-333' visibility='default' filepath='./Include/cpython/frameobject.h' line='30' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='f_code' type-id='type-id-334' visibility='default' filepath='./Include/cpython/frameobject.h' line='31' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='f_builtins' type-id='type-id-16' visibility='default' filepath='./Include/cpython/frameobject.h' line='32' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='384'>
+        <var-decl name='f_globals' type-id='type-id-16' visibility='default' filepath='./Include/cpython/frameobject.h' line='33' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='448'>
+        <var-decl name='f_locals' type-id='type-id-16' visibility='default' filepath='./Include/cpython/frameobject.h' line='34' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='512'>
+        <var-decl name='f_valuestack' type-id='type-id-86' visibility='default' filepath='./Include/cpython/frameobject.h' line='35' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='576'>
+        <var-decl name='f_trace' type-id='type-id-16' visibility='default' filepath='./Include/cpython/frameobject.h' line='36' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='640'>
+        <var-decl name='f_stackdepth' type-id='type-id-9' visibility='default' filepath='./Include/cpython/frameobject.h' line='37' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='672'>
+        <var-decl name='f_trace_lines' type-id='type-id-1' visibility='default' filepath='./Include/cpython/frameobject.h' line='38' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='680'>
+        <var-decl name='f_trace_opcodes' type-id='type-id-1' visibility='default' filepath='./Include/cpython/frameobject.h' line='39' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='704'>
+        <var-decl name='f_gen' type-id='type-id-16' visibility='default' filepath='./Include/cpython/frameobject.h' line='42' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='768'>
+        <var-decl name='f_lasti' type-id='type-id-9' visibility='default' filepath='./Include/cpython/frameobject.h' line='44' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='800'>
+        <var-decl name='f_lineno' type-id='type-id-9' visibility='default' filepath='./Include/cpython/frameobject.h' line='45' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='832'>
+        <var-decl name='f_iblock' type-id='type-id-9' visibility='default' filepath='./Include/cpython/frameobject.h' line='46' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='864'>
+        <var-decl name='f_state' type-id='type-id-335' visibility='default' filepath='./Include/cpython/frameobject.h' line='47' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='896'>
+        <var-decl name='f_blockstack' type-id='type-id-336' visibility='default' filepath='./Include/cpython/frameobject.h' line='48' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2816'>
+        <var-decl name='f_localsplus' type-id='type-id-337' visibility='default' filepath='./Include/cpython/frameobject.h' line='49' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-332' size-in-bits='64' id='type-id-333'/>
+    <class-decl name='PyCodeObject' size-in-bits='1408' is-struct='yes' visibility='default' filepath='./Include/cpython/code.h' line='18' column='1' id='type-id-338'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='ob_base' type-id='type-id-69' visibility='default' filepath='./Include/cpython/code.h' line='19' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='co_argcount' type-id='type-id-9' visibility='default' filepath='./Include/cpython/code.h' line='20' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='160'>
+        <var-decl name='co_posonlyargcount' type-id='type-id-9' visibility='default' filepath='./Include/cpython/code.h' line='21' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='co_kwonlyargcount' type-id='type-id-9' visibility='default' filepath='./Include/cpython/code.h' line='22' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='224'>
+        <var-decl name='co_nlocals' type-id='type-id-9' visibility='default' filepath='./Include/cpython/code.h' line='23' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='co_stacksize' type-id='type-id-9' visibility='default' filepath='./Include/cpython/code.h' line='24' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='288'>
+        <var-decl name='co_flags' type-id='type-id-9' visibility='default' filepath='./Include/cpython/code.h' line='25' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='co_firstlineno' type-id='type-id-9' visibility='default' filepath='./Include/cpython/code.h' line='26' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='384'>
+        <var-decl name='co_code' type-id='type-id-16' visibility='default' filepath='./Include/cpython/code.h' line='27' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='448'>
+        <var-decl name='co_consts' type-id='type-id-16' visibility='default' filepath='./Include/cpython/code.h' line='28' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='512'>
+        <var-decl name='co_names' type-id='type-id-16' visibility='default' filepath='./Include/cpython/code.h' line='29' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='576'>
+        <var-decl name='co_varnames' type-id='type-id-16' visibility='default' filepath='./Include/cpython/code.h' line='30' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='640'>
+        <var-decl name='co_freevars' type-id='type-id-16' visibility='default' filepath='./Include/cpython/code.h' line='31' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='704'>
+        <var-decl name='co_cellvars' type-id='type-id-16' visibility='default' filepath='./Include/cpython/code.h' line='32' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='768'>
+        <var-decl name='co_cell2arg' type-id='type-id-125' visibility='default' filepath='./Include/cpython/code.h' line='38' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='832'>
+        <var-decl name='co_filename' type-id='type-id-16' visibility='default' filepath='./Include/cpython/code.h' line='39' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='896'>
+        <var-decl name='co_name' type-id='type-id-16' visibility='default' filepath='./Include/cpython/code.h' line='40' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='960'>
+        <var-decl name='co_linetable' type-id='type-id-16' visibility='default' filepath='./Include/cpython/code.h' line='41' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1024'>
+        <var-decl name='co_zombieframe' type-id='type-id-21' visibility='default' filepath='./Include/cpython/code.h' line='43' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1088'>
+        <var-decl name='co_weakreflist' type-id='type-id-16' visibility='default' filepath='./Include/cpython/code.h' line='44' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1152'>
+        <var-decl name='co_extra' type-id='type-id-21' visibility='default' filepath='./Include/cpython/code.h' line='48' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1216'>
+        <var-decl name='co_opcache_map' type-id='type-id-339' visibility='default' filepath='./Include/cpython/code.h' line='60' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1280'>
+        <var-decl name='co_opcache' type-id='type-id-340' visibility='default' filepath='./Include/cpython/code.h' line='61' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1344'>
+        <var-decl name='co_opcache_flag' type-id='type-id-9' visibility='default' filepath='./Include/cpython/code.h' line='62' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1376'>
+        <var-decl name='co_opcache_size' type-id='type-id-341' visibility='default' filepath='./Include/cpython/code.h' line='63' column='1'/>
+      </data-member>
+    </class-decl>
+    <type-decl name='unsigned char' size-in-bits='8' id='type-id-341'/>
+    <pointer-type-def type-id='type-id-341' size-in-bits='64' id='type-id-339'/>
+    <class-decl name='_PyOpcache' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-342'/>
+    <typedef-decl name='_PyOpcache' type-id='type-id-342' filepath='./Include/cpython/code.h' line='15' column='1' id='type-id-343'/>
+    <pointer-type-def type-id='type-id-343' size-in-bits='64' id='type-id-340'/>
+    <typedef-decl name='PyCodeObject' type-id='type-id-338' filepath='./Include/code.h' line='9' column='1' id='type-id-344'/>
+    <pointer-type-def type-id='type-id-344' size-in-bits='64' id='type-id-334'/>
+    <typedef-decl name='PyFrameState' type-id='type-id-174' filepath='./Include/cpython/frameobject.h' line='20' column='1' id='type-id-335'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='96' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-345' visibility='default' filepath='./Include/cpython/frameobject.h' line='22' column='1' id='type-id-346'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='b_type' type-id='type-id-9' visibility='default' filepath='./Include/cpython/frameobject.h' line='23' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='32'>
+        <var-decl name='b_handler' type-id='type-id-9' visibility='default' filepath='./Include/cpython/frameobject.h' line='24' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='b_level' type-id='type-id-9' visibility='default' filepath='./Include/cpython/frameobject.h' line='25' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='PyTryBlock' type-id='type-id-346' filepath='./Include/cpython/frameobject.h' line='26' column='1' id='type-id-345'/>
+
+    <array-type-def dimensions='1' type-id='type-id-345' size-in-bits='1920' id='type-id-336'>
+      <subrange length='20' type-id='type-id-19' id='type-id-186'/>
+
+    </array-type-def>
+
+    <array-type-def dimensions='1' type-id='type-id-16' size-in-bits='64' id='type-id-337'>
+      <subrange length='1' type-id='type-id-19' id='type-id-182'/>
+
+    </array-type-def>
+    <typedef-decl name='PyFrameObject' type-id='type-id-332' filepath='./Include/pyframe.h' line='12' column='1' id='type-id-347'/>
+    <pointer-type-def type-id='type-id-347' size-in-bits='64' id='type-id-223'/>
+    <pointer-type-def type-id='type-id-348' size-in-bits='64' id='type-id-349'/>
+    <typedef-decl name='_PyFrameEvalFunction' type-id='type-id-349' filepath='./Include/cpython/pystate.h' line='203' column='1' id='type-id-232'/>
+
+    <array-type-def dimensions='1' type-id='type-id-65' size-in-bits='16320' id='type-id-233'>
+      <subrange length='255' type-id='type-id-19' id='type-id-350'/>
+
+    </array-type-def>
+    <class-decl name='_warnings_runtime_state' size-in-bits='256' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_warnings.h' line='11' column='1' id='type-id-234'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='filters' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_warnings.h' line='14' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='once_registry' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_warnings.h' line='15' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='default_action' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_warnings.h' line='16' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='filters_version' type-id='type-id-33' visibility='default' filepath='./Include/internal/pycore_warnings.h' line='17' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='atexit_state' size-in-bits='128' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_interp.h' line='181' column='1' id='type-id-235'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='callbacks' type-id='type-id-351' visibility='default' filepath='./Include/internal/pycore_interp.h' line='182' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='ncallbacks' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_interp.h' line='183' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='96'>
+        <var-decl name='callback_len' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_interp.h' line='184' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-352' visibility='default' filepath='./Include/internal/pycore_interp.h' line='175' column='1' id='type-id-353'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='func' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='176' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='args' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='177' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='kwargs' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='178' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='atexit_callback' type-id='type-id-353' filepath='./Include/internal/pycore_interp.h' line='179' column='1' id='type-id-352'/>
+    <pointer-type-def type-id='type-id-352' size-in-bits='64' id='type-id-354'/>
+    <pointer-type-def type-id='type-id-354' size-in-bits='64' id='type-id-351'/>
+    <typedef-decl name='PyLongObject' type-id='type-id-202' filepath='./Include/longobject.h' line='10' column='1' id='type-id-355'/>
+    <pointer-type-def type-id='type-id-355' size-in-bits='64' id='type-id-356'/>
+
+    <array-type-def dimensions='1' type-id='type-id-356' size-in-bits='16768' id='type-id-236'>
+      <subrange length='262' type-id='type-id-19' id='type-id-357'/>
+
+    </array-type-def>
+    <class-decl name='_Py_bytes_state' size-in-bits='16448' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_interp.h' line='56' column='1' id='type-id-237'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='empty_string' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='57' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='characters' type-id='type-id-358' visibility='default' filepath='./Include/internal/pycore_interp.h' line='58' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='320' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-359' visibility='default' filepath='./Include/cpython/bytesobject.h' line='5' column='1' id='type-id-360'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='ob_base' type-id='type-id-37' visibility='default' filepath='./Include/cpython/bytesobject.h' line='6' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='ob_shash' type-id='type-id-117' visibility='default' filepath='./Include/cpython/bytesobject.h' line='7' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='ob_sval' type-id='type-id-175' visibility='default' filepath='./Include/cpython/bytesobject.h' line='8' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='PyBytesObject' type-id='type-id-360' filepath='./Include/cpython/bytesobject.h' line='15' column='1' id='type-id-359'/>
+    <pointer-type-def type-id='type-id-359' size-in-bits='64' id='type-id-361'/>
+
+    <array-type-def dimensions='1' type-id='type-id-361' size-in-bits='16384' id='type-id-358'>
+      <subrange length='256' type-id='type-id-19' id='type-id-362'/>
+
+    </array-type-def>
+    <class-decl name='_Py_unicode_state' size-in-bits='16896' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_interp.h' line='66' column='1' id='type-id-238'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='empty_string' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='68' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='latin1' type-id='type-id-363' visibility='default' filepath='./Include/internal/pycore_interp.h' line='71' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='16448'>
+        <var-decl name='fs_codec' type-id='type-id-364' visibility='default' filepath='./Include/internal/pycore_interp.h' line='72' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='16704'>
+        <var-decl name='interned' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='82' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='16768'>
+        <var-decl name='ids' type-id='type-id-365' visibility='default' filepath='./Include/internal/pycore_interp.h' line='85' column='1'/>
+      </data-member>
+    </class-decl>
+
+    <array-type-def dimensions='1' type-id='type-id-16' size-in-bits='16384' id='type-id-363'>
+      <subrange length='256' type-id='type-id-19' id='type-id-362'/>
+
+    </array-type-def>
+    <class-decl name='_Py_unicode_fs_codec' size-in-bits='256' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_interp.h' line='49' column='1' id='type-id-364'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='encoding' type-id='type-id-72' visibility='default' filepath='./Include/internal/pycore_interp.h' line='50' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='utf8' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_interp.h' line='51' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='errors' type-id='type-id-72' visibility='default' filepath='./Include/internal/pycore_interp.h' line='52' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='error_handler' type-id='type-id-366' visibility='default' filepath='./Include/internal/pycore_interp.h' line='53' column='1'/>
+      </data-member>
+    </class-decl>
+    <enum-decl name='__anonymous_enum__' is-anonymous='yes' filepath='./Include/cpython/fileutils.h' line='5' column='1' id='type-id-367'>
+      <underlying-type type-id='type-id-83'/>
+      <enumerator name='_Py_ERROR_UNKNOWN' value='0'/>
+      <enumerator name='_Py_ERROR_STRICT' value='1'/>
+      <enumerator name='_Py_ERROR_SURROGATEESCAPE' value='2'/>
+      <enumerator name='_Py_ERROR_REPLACE' value='3'/>
+      <enumerator name='_Py_ERROR_IGNORE' value='4'/>
+      <enumerator name='_Py_ERROR_BACKSLASHREPLACE' value='5'/>
+      <enumerator name='_Py_ERROR_SURROGATEPASS' value='6'/>
+      <enumerator name='_Py_ERROR_XMLCHARREFREPLACE' value='7'/>
+      <enumerator name='_Py_ERROR_OTHER' value='8'/>
+    </enum-decl>
+    <typedef-decl name='_Py_error_handler' type-id='type-id-367' filepath='./Include/cpython/fileutils.h' line='15' column='1' id='type-id-366'/>
+    <class-decl name='_Py_unicode_ids' size-in-bits='128' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_interp.h' line='61' column='1' id='type-id-365'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='size' type-id='type-id-31' visibility='default' filepath='./Include/internal/pycore_interp.h' line='62' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='array' type-id='type-id-86' visibility='default' filepath='./Include/internal/pycore_interp.h' line='63' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='_Py_float_state' size-in-bits='128' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_interp.h' line='88' column='1' id='type-id-239'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='numfree' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_interp.h' line='92' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='free_list' type-id='type-id-368' visibility='default' filepath='./Include/internal/pycore_interp.h' line='93' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-369' visibility='default' filepath='./Include/floatobject.h' line='15' column='1' id='type-id-370'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='ob_base' type-id='type-id-69' visibility='default' filepath='./Include/floatobject.h' line='16' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='ob_fval' type-id='type-id-371' visibility='default' filepath='./Include/floatobject.h' line='17' column='1'/>
+      </data-member>
+    </class-decl>
+    <type-decl name='double' size-in-bits='64' id='type-id-371'/>
+    <typedef-decl name='PyFloatObject' type-id='type-id-370' filepath='./Include/floatobject.h' line='18' column='1' id='type-id-369'/>
+    <pointer-type-def type-id='type-id-369' size-in-bits='64' id='type-id-368'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='320' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-372' visibility='default' filepath='./Include/sliceobject.h' line='22' column='1' id='type-id-373'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='ob_base' type-id='type-id-69' visibility='default' filepath='./Include/sliceobject.h' line='23' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='start' type-id='type-id-16' visibility='default' filepath='./Include/sliceobject.h' line='24' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='stop' type-id='type-id-16' visibility='default' filepath='./Include/sliceobject.h' line='24' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='step' type-id='type-id-16' visibility='default' filepath='./Include/sliceobject.h' line='24' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='PySliceObject' type-id='type-id-373' filepath='./Include/sliceobject.h' line='25' column='1' id='type-id-372'/>
+    <pointer-type-def type-id='type-id-372' size-in-bits='64' id='type-id-240'/>
+    <class-decl name='_Py_tuple_state' size-in-bits='1920' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_interp.h' line='106' column='1' id='type-id-241'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='free_list' type-id='type-id-374' visibility='default' filepath='./Include/internal/pycore_interp.h' line='111' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1280'>
+        <var-decl name='numfree' type-id='type-id-375' visibility='default' filepath='./Include/internal/pycore_interp.h' line='112' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='256' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-376' visibility='default' filepath='./Include/cpython/tupleobject.h' line='5' column='1' id='type-id-377'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='ob_base' type-id='type-id-37' visibility='default' filepath='./Include/cpython/tupleobject.h' line='6' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='ob_item' type-id='type-id-337' visibility='default' filepath='./Include/cpython/tupleobject.h' line='10' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='PyTupleObject' type-id='type-id-377' filepath='./Include/cpython/tupleobject.h' line='11' column='1' id='type-id-376'/>
+    <pointer-type-def type-id='type-id-376' size-in-bits='64' id='type-id-378'/>
+
+    <array-type-def dimensions='1' type-id='type-id-378' size-in-bits='1280' id='type-id-374'>
+      <subrange length='20' type-id='type-id-19' id='type-id-186'/>
+
+    </array-type-def>
+
+    <array-type-def dimensions='1' type-id='type-id-9' size-in-bits='640' id='type-id-375'>
+      <subrange length='20' type-id='type-id-19' id='type-id-186'/>
+
+    </array-type-def>
+    <class-decl name='_Py_list_state' size-in-bits='5184' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_interp.h' line='121' column='1' id='type-id-242'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='free_list' type-id='type-id-379' visibility='default' filepath='./Include/internal/pycore_interp.h' line='122' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='5120'>
+        <var-decl name='numfree' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_interp.h' line='123' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='320' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-380' visibility='default' filepath='./Include/cpython/listobject.h' line='5' column='1' id='type-id-381'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='ob_base' type-id='type-id-37' visibility='default' filepath='./Include/cpython/listobject.h' line='6' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='ob_item' type-id='type-id-86' visibility='default' filepath='./Include/cpython/listobject.h' line='8' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='allocated' type-id='type-id-31' visibility='default' filepath='./Include/cpython/listobject.h' line='21' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='PyListObject' type-id='type-id-381' filepath='./Include/cpython/listobject.h' line='22' column='1' id='type-id-380'/>
+    <pointer-type-def type-id='type-id-380' size-in-bits='64' id='type-id-382'/>
+
+    <array-type-def dimensions='1' type-id='type-id-382' size-in-bits='5120' id='type-id-379'>
+      <subrange length='80' type-id='type-id-19' id='type-id-383'/>
+
+    </array-type-def>
+    <class-decl name='_Py_dict_state' size-in-bits='10368' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_interp.h' line='130' column='1' id='type-id-243'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='free_list' type-id='type-id-384' visibility='default' filepath='./Include/internal/pycore_interp.h' line='132' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='5120'>
+        <var-decl name='numfree' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_interp.h' line='133' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='5184'>
+        <var-decl name='keys_free_list' type-id='type-id-385' visibility='default' filepath='./Include/internal/pycore_interp.h' line='134' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10304'>
+        <var-decl name='keys_numfree' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_interp.h' line='135' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='384' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-386' visibility='default' filepath='./Include/cpython/dictobject.h' line='10' column='1' id='type-id-387'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='ob_base' type-id='type-id-69' visibility='default' filepath='./Include/cpython/dictobject.h' line='11' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='ma_used' type-id='type-id-31' visibility='default' filepath='./Include/cpython/dictobject.h' line='14' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='ma_version_tag' type-id='type-id-22' visibility='default' filepath='./Include/cpython/dictobject.h' line='18' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='ma_keys' type-id='type-id-388' visibility='default' filepath='./Include/cpython/dictobject.h' line='20' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='ma_values' type-id='type-id-86' visibility='default' filepath='./Include/cpython/dictobject.h' line='27' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='_dictkeysobject' size-in-bits='320' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-389'/>
+    <typedef-decl name='PyDictKeysObject' type-id='type-id-389' filepath='./Include/cpython/dictobject.h' line='5' column='1' id='type-id-390'/>
+    <pointer-type-def type-id='type-id-390' size-in-bits='64' id='type-id-388'/>
+    <typedef-decl name='PyDictObject' type-id='type-id-387' filepath='./Include/cpython/dictobject.h' line='28' column='1' id='type-id-386'/>
+    <pointer-type-def type-id='type-id-386' size-in-bits='64' id='type-id-391'/>
+
+    <array-type-def dimensions='1' type-id='type-id-391' size-in-bits='5120' id='type-id-384'>
+      <subrange length='80' type-id='type-id-19' id='type-id-383'/>
+
+    </array-type-def>
+
+    <array-type-def dimensions='1' type-id='type-id-388' size-in-bits='5120' id='type-id-385'>
+      <subrange length='80' type-id='type-id-19' id='type-id-383'/>
+
+    </array-type-def>
+    <class-decl name='_Py_frame_state' size-in-bits='128' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_interp.h' line='138' column='1' id='type-id-244'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='free_list' type-id='type-id-223' visibility='default' filepath='./Include/internal/pycore_interp.h' line='139' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='numfree' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_interp.h' line='141' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='_Py_async_gen_state' size-in-bits='10368' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_interp.h' line='148' column='1' id='type-id-245'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='value_freelist' type-id='type-id-392' visibility='default' filepath='./Include/internal/pycore_interp.h' line='153' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='5120'>
+        <var-decl name='value_numfree' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_interp.h' line='154' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='5184'>
+        <var-decl name='asend_freelist' type-id='type-id-393' visibility='default' filepath='./Include/internal/pycore_interp.h' line='156' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10304'>
+        <var-decl name='asend_numfree' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_interp.h' line='157' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='_PyAsyncGenWrappedValue' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-394'/>
+    <pointer-type-def type-id='type-id-394' size-in-bits='64' id='type-id-395'/>
+
+    <array-type-def dimensions='1' type-id='type-id-395' size-in-bits='5120' id='type-id-392'>
+      <subrange length='80' type-id='type-id-19' id='type-id-383'/>
+
+    </array-type-def>
+    <class-decl name='PyAsyncGenASend' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-396'/>
+    <pointer-type-def type-id='type-id-396' size-in-bits='64' id='type-id-397'/>
+
+    <array-type-def dimensions='1' type-id='type-id-397' size-in-bits='5120' id='type-id-393'>
+      <subrange length='80' type-id='type-id-19' id='type-id-383'/>
+
+    </array-type-def>
+    <class-decl name='_Py_context_state' size-in-bits='128' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_interp.h' line='160' column='1' id='type-id-246'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='freelist' type-id='type-id-398' visibility='default' filepath='./Include/internal/pycore_interp.h' line='162' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='numfree' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_interp.h' line='163' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='_pycontextobject' size-in-bits='384' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-399'/>
+    <typedef-decl name='PyContext' type-id='type-id-399' filepath='./Include/context.h' line='11' column='1' id='type-id-400'/>
+    <pointer-type-def type-id='type-id-400' size-in-bits='64' id='type-id-398'/>
+    <class-decl name='_Py_exc_state' size-in-bits='192' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_interp.h' line='166' column='1' id='type-id-247'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='errnomap' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='168' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='memerrors_freelist' type-id='type-id-401' visibility='default' filepath='./Include/internal/pycore_interp.h' line='169' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='memerrors_numfree' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_interp.h' line='170' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='512' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-402' visibility='default' filepath='./Include/cpython/pyerrors.h' line='13' column='1' id='type-id-403'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='ob_base' type-id='type-id-69' visibility='default' filepath='./Include/cpython/pyerrors.h' line='14' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='dict' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pyerrors.h' line='14' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='args' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pyerrors.h' line='14' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='traceback' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pyerrors.h' line='14' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='context' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pyerrors.h' line='14' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='384'>
+        <var-decl name='cause' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pyerrors.h' line='14' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='448'>
+        <var-decl name='suppress_context' type-id='type-id-1' visibility='default' filepath='./Include/cpython/pyerrors.h' line='14' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='PyBaseExceptionObject' type-id='type-id-403' filepath='./Include/cpython/pyerrors.h' line='15' column='1' id='type-id-402'/>
+    <pointer-type-def type-id='type-id-402' size-in-bits='64' id='type-id-401'/>
+    <class-decl name='ast_state' size-in-bits='15040' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='13' column='1' id='type-id-248'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='initialized' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='14' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='AST_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='15' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='Add_singleton' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='16' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='Add_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='17' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='And_singleton' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='18' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='And_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='19' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='384'>
+        <var-decl name='AnnAssign_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='20' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='448'>
+        <var-decl name='Assert_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='21' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='512'>
+        <var-decl name='Assign_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='22' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='576'>
+        <var-decl name='AsyncFor_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='23' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='640'>
+        <var-decl name='AsyncFunctionDef_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='24' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='704'>
+        <var-decl name='AsyncWith_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='25' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='768'>
+        <var-decl name='Attribute_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='26' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='832'>
+        <var-decl name='AugAssign_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='27' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='896'>
+        <var-decl name='Await_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='28' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='960'>
+        <var-decl name='BinOp_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='29' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1024'>
+        <var-decl name='BitAnd_singleton' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='30' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1088'>
+        <var-decl name='BitAnd_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='31' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1152'>
+        <var-decl name='BitOr_singleton' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='32' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1216'>
+        <var-decl name='BitOr_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='33' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1280'>
+        <var-decl name='BitXor_singleton' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='34' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1344'>
+        <var-decl name='BitXor_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='35' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1408'>
+        <var-decl name='BoolOp_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='36' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1472'>
+        <var-decl name='Break_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='37' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1536'>
+        <var-decl name='Call_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='38' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1600'>
+        <var-decl name='ClassDef_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='39' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1664'>
+        <var-decl name='Compare_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='40' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1728'>
+        <var-decl name='Constant_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='41' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1792'>
+        <var-decl name='Continue_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='42' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1856'>
+        <var-decl name='Del_singleton' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='43' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1920'>
+        <var-decl name='Del_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='44' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1984'>
+        <var-decl name='Delete_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='45' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2048'>
+        <var-decl name='DictComp_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='46' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2112'>
+        <var-decl name='Dict_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='47' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2176'>
+        <var-decl name='Div_singleton' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='48' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2240'>
+        <var-decl name='Div_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='49' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2304'>
+        <var-decl name='Eq_singleton' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='50' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2368'>
+        <var-decl name='Eq_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='51' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2432'>
+        <var-decl name='ExceptHandler_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='52' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2496'>
+        <var-decl name='Expr_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='53' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2560'>
+        <var-decl name='Expression_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='54' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2624'>
+        <var-decl name='FloorDiv_singleton' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='55' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2688'>
+        <var-decl name='FloorDiv_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='56' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2752'>
+        <var-decl name='For_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='57' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2816'>
+        <var-decl name='FormattedValue_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='58' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2880'>
+        <var-decl name='FunctionDef_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='59' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2944'>
+        <var-decl name='FunctionType_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='60' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='3008'>
+        <var-decl name='GeneratorExp_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='61' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='3072'>
+        <var-decl name='Global_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='62' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='3136'>
+        <var-decl name='GtE_singleton' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='63' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='3200'>
+        <var-decl name='GtE_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='64' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='3264'>
+        <var-decl name='Gt_singleton' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='65' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='3328'>
+        <var-decl name='Gt_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='66' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='3392'>
+        <var-decl name='IfExp_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='67' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='3456'>
+        <var-decl name='If_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='68' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='3520'>
+        <var-decl name='ImportFrom_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='69' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='3584'>
+        <var-decl name='Import_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='70' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='3648'>
+        <var-decl name='In_singleton' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='71' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='3712'>
+        <var-decl name='In_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='72' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='3776'>
+        <var-decl name='Interactive_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='73' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='3840'>
+        <var-decl name='Invert_singleton' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='74' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='3904'>
+        <var-decl name='Invert_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='75' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='3968'>
+        <var-decl name='IsNot_singleton' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='76' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='4032'>
+        <var-decl name='IsNot_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='77' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='4096'>
+        <var-decl name='Is_singleton' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='78' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='4160'>
+        <var-decl name='Is_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='79' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='4224'>
+        <var-decl name='JoinedStr_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='80' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='4288'>
+        <var-decl name='LShift_singleton' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='81' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='4352'>
+        <var-decl name='LShift_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='82' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='4416'>
+        <var-decl name='Lambda_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='83' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='4480'>
+        <var-decl name='ListComp_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='84' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='4544'>
+        <var-decl name='List_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='85' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='4608'>
+        <var-decl name='Load_singleton' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='86' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='4672'>
+        <var-decl name='Load_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='87' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='4736'>
+        <var-decl name='LtE_singleton' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='88' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='4800'>
+        <var-decl name='LtE_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='89' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='4864'>
+        <var-decl name='Lt_singleton' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='90' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='4928'>
+        <var-decl name='Lt_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='91' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='4992'>
+        <var-decl name='MatMult_singleton' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='92' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='5056'>
+        <var-decl name='MatMult_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='93' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='5120'>
+        <var-decl name='MatchAs_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='94' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='5184'>
+        <var-decl name='MatchClass_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='95' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='5248'>
+        <var-decl name='MatchMapping_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='96' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='5312'>
+        <var-decl name='MatchOr_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='97' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='5376'>
+        <var-decl name='MatchSequence_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='98' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='5440'>
+        <var-decl name='MatchSingleton_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='99' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='5504'>
+        <var-decl name='MatchStar_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='100' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='5568'>
+        <var-decl name='MatchValue_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='101' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='5632'>
+        <var-decl name='Match_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='102' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='5696'>
+        <var-decl name='Mod_singleton' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='103' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='5760'>
+        <var-decl name='Mod_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='104' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='5824'>
+        <var-decl name='Module_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='105' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='5888'>
+        <var-decl name='Mult_singleton' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='106' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='5952'>
+        <var-decl name='Mult_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='107' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='6016'>
+        <var-decl name='Name_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='108' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='6080'>
+        <var-decl name='NamedExpr_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='109' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='6144'>
+        <var-decl name='Nonlocal_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='110' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='6208'>
+        <var-decl name='NotEq_singleton' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='111' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='6272'>
+        <var-decl name='NotEq_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='112' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='6336'>
+        <var-decl name='NotIn_singleton' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='113' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='6400'>
+        <var-decl name='NotIn_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='114' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='6464'>
+        <var-decl name='Not_singleton' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='115' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='6528'>
+        <var-decl name='Not_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='116' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='6592'>
+        <var-decl name='Or_singleton' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='117' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='6656'>
+        <var-decl name='Or_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='118' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='6720'>
+        <var-decl name='Pass_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='119' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='6784'>
+        <var-decl name='Pow_singleton' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='120' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='6848'>
+        <var-decl name='Pow_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='121' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='6912'>
+        <var-decl name='RShift_singleton' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='122' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='6976'>
+        <var-decl name='RShift_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='123' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7040'>
+        <var-decl name='Raise_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='124' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7104'>
+        <var-decl name='Return_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='125' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7168'>
+        <var-decl name='SetComp_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='126' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7232'>
+        <var-decl name='Set_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='127' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7296'>
+        <var-decl name='Slice_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='128' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7360'>
+        <var-decl name='Starred_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='129' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7424'>
+        <var-decl name='Store_singleton' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='130' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7488'>
+        <var-decl name='Store_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='131' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7552'>
+        <var-decl name='Sub_singleton' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='132' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7616'>
+        <var-decl name='Sub_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='133' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7680'>
+        <var-decl name='Subscript_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='134' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7744'>
+        <var-decl name='Try_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='135' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7808'>
+        <var-decl name='Tuple_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='136' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7872'>
+        <var-decl name='TypeIgnore_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='137' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7936'>
+        <var-decl name='UAdd_singleton' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='138' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='8000'>
+        <var-decl name='UAdd_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='139' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='8064'>
+        <var-decl name='USub_singleton' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='140' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='8128'>
+        <var-decl name='USub_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='141' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='8192'>
+        <var-decl name='UnaryOp_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='142' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='8256'>
+        <var-decl name='While_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='143' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='8320'>
+        <var-decl name='With_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='144' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='8384'>
+        <var-decl name='YieldFrom_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='145' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='8448'>
+        <var-decl name='Yield_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='146' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='8512'>
+        <var-decl name='__dict__' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='147' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='8576'>
+        <var-decl name='__doc__' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='148' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='8640'>
+        <var-decl name='__match_args__' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='149' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='8704'>
+        <var-decl name='__module__' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='150' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='8768'>
+        <var-decl name='_attributes' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='151' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='8832'>
+        <var-decl name='_fields' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='152' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='8896'>
+        <var-decl name='alias_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='153' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='8960'>
+        <var-decl name='annotation' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='154' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='9024'>
+        <var-decl name='arg' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='155' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='9088'>
+        <var-decl name='arg_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='156' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='9152'>
+        <var-decl name='args' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='157' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='9216'>
+        <var-decl name='argtypes' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='158' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='9280'>
+        <var-decl name='arguments_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='159' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='9344'>
+        <var-decl name='asname' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='160' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='9408'>
+        <var-decl name='ast' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='161' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='9472'>
+        <var-decl name='attr' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='162' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='9536'>
+        <var-decl name='bases' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='163' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='9600'>
+        <var-decl name='body' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='164' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='9664'>
+        <var-decl name='boolop_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='165' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='9728'>
+        <var-decl name='cases' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='166' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='9792'>
+        <var-decl name='cause' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='167' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='9856'>
+        <var-decl name='cls' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='168' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='9920'>
+        <var-decl name='cmpop_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='169' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='9984'>
+        <var-decl name='col_offset' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='170' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10048'>
+        <var-decl name='comparators' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='171' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10112'>
+        <var-decl name='comprehension_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='172' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10176'>
+        <var-decl name='context_expr' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='173' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10240'>
+        <var-decl name='conversion' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='174' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10304'>
+        <var-decl name='ctx' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='175' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10368'>
+        <var-decl name='decorator_list' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='176' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10432'>
+        <var-decl name='defaults' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='177' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10496'>
+        <var-decl name='elt' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='178' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10560'>
+        <var-decl name='elts' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='179' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10624'>
+        <var-decl name='end_col_offset' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='180' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10688'>
+        <var-decl name='end_lineno' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='181' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10752'>
+        <var-decl name='exc' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='182' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10816'>
+        <var-decl name='excepthandler_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='183' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10880'>
+        <var-decl name='expr_context_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='184' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10944'>
+        <var-decl name='expr_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='185' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='11008'>
+        <var-decl name='finalbody' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='186' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='11072'>
+        <var-decl name='format_spec' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='187' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='11136'>
+        <var-decl name='func' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='188' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='11200'>
+        <var-decl name='generators' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='189' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='11264'>
+        <var-decl name='guard' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='190' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='11328'>
+        <var-decl name='handlers' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='191' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='11392'>
+        <var-decl name='id' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='192' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='11456'>
+        <var-decl name='ifs' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='193' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='11520'>
+        <var-decl name='is_async' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='194' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='11584'>
+        <var-decl name='items' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='195' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='11648'>
+        <var-decl name='iter' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='196' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='11712'>
+        <var-decl name='key' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='197' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='11776'>
+        <var-decl name='keys' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='198' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='11840'>
+        <var-decl name='keyword_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='199' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='11904'>
+        <var-decl name='keywords' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='200' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='11968'>
+        <var-decl name='kind' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='201' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='12032'>
+        <var-decl name='kw_defaults' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='202' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='12096'>
+        <var-decl name='kwarg' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='203' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='12160'>
+        <var-decl name='kwd_attrs' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='204' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='12224'>
+        <var-decl name='kwd_patterns' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='205' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='12288'>
+        <var-decl name='kwonlyargs' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='206' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='12352'>
+        <var-decl name='left' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='207' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='12416'>
+        <var-decl name='level' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='208' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='12480'>
+        <var-decl name='lineno' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='209' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='12544'>
+        <var-decl name='lower' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='210' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='12608'>
+        <var-decl name='match_case_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='211' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='12672'>
+        <var-decl name='mod_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='212' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='12736'>
+        <var-decl name='module' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='213' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='12800'>
+        <var-decl name='msg' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='214' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='12864'>
+        <var-decl name='name' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='215' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='12928'>
+        <var-decl name='names' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='216' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='12992'>
+        <var-decl name='op' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='217' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='13056'>
+        <var-decl name='operand' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='218' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='13120'>
+        <var-decl name='operator_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='219' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='13184'>
+        <var-decl name='ops' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='220' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='13248'>
+        <var-decl name='optional_vars' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='221' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='13312'>
+        <var-decl name='orelse' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='222' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='13376'>
+        <var-decl name='pattern' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='223' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='13440'>
+        <var-decl name='pattern_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='224' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='13504'>
+        <var-decl name='patterns' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='225' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='13568'>
+        <var-decl name='posonlyargs' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='226' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='13632'>
+        <var-decl name='rest' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='227' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='13696'>
+        <var-decl name='returns' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='228' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='13760'>
+        <var-decl name='right' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='229' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='13824'>
+        <var-decl name='simple' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='230' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='13888'>
+        <var-decl name='slice' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='231' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='13952'>
+        <var-decl name='step' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='232' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='14016'>
+        <var-decl name='stmt_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='233' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='14080'>
+        <var-decl name='subject' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='234' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='14144'>
+        <var-decl name='tag' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='235' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='14208'>
+        <var-decl name='target' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='236' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='14272'>
+        <var-decl name='targets' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='237' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='14336'>
+        <var-decl name='test' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='238' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='14400'>
+        <var-decl name='type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='239' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='14464'>
+        <var-decl name='type_comment' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='240' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='14528'>
+        <var-decl name='type_ignore_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='241' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='14592'>
+        <var-decl name='type_ignores' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='242' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='14656'>
+        <var-decl name='unaryop_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='243' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='14720'>
+        <var-decl name='upper' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='244' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='14784'>
+        <var-decl name='value' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='245' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='14848'>
+        <var-decl name='values' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='246' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='14912'>
+        <var-decl name='vararg' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='247' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='14976'>
+        <var-decl name='withitem_type' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_ast_state.h' line='248' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='type_cache' size-in-bits='786432' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_interp.h' line='199' column='1' id='type-id-249'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='hashtable' type-id='type-id-404' visibility='default' filepath='./Include/internal/pycore_interp.h' line='200' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='type_cache_entry' size-in-bits='192' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_interp.h' line='190' column='1' id='type-id-405'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='version' type-id='type-id-66' visibility='default' filepath='./Include/internal/pycore_interp.h' line='191' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='name' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='192' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='value' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='193' column='1'/>
+      </data-member>
+    </class-decl>
+
+    <array-type-def dimensions='1' type-id='type-id-405' size-in-bits='786432' id='type-id-404'>
+      <subrange length='4096' type-id='type-id-19' id='type-id-406'/>
+
+    </array-type-def>
+    <function-decl name='_PyObject_Call_Prepend' mangled-name='_PyObject_Call_Prepend' filepath='Objects/call.c' line='405' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_Call_Prepend'>
+      <parameter type-id='type-id-331' name='tstate' filepath='Objects/call.c' line='405' column='1'/>
+      <parameter type-id='type-id-16' name='callable' filepath='Objects/call.c' line='405' column='1'/>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/call.c' line='406' column='1'/>
+      <parameter type-id='type-id-16' name='args' filepath='Objects/call.c' line='406' column='1'/>
+      <parameter type-id='type-id-16' name='kwargs' filepath='Objects/call.c' line='406' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyObject_CallObject' mangled-name='PyObject_CallObject' filepath='Objects/call.c' line='387' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_CallObject'>
+      <parameter type-id='type-id-16' name='callable' filepath='Objects/call.c' line='387' column='1'/>
+      <parameter type-id='type-id-16' name='args' filepath='Objects/call.c' line='387' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyEval_CallObjectWithKeywords' mangled-name='PyEval_CallObjectWithKeywords' filepath='Objects/call.c' line='354' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyEval_CallObjectWithKeywords'>
+      <parameter type-id='type-id-16' name='callable' filepath='Objects/call.c' line='354' column='1'/>
+      <parameter type-id='type-id-16' name='args' filepath='Objects/call.c' line='355' column='1'/>
+      <parameter type-id='type-id-16' name='kwargs' filepath='Objects/call.c' line='355' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyFunction_Vectorcall' mangled-name='_PyFunction_Vectorcall' filepath='Objects/call.c' line='332' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyFunction_Vectorcall'>
+      <parameter type-id='type-id-16' name='func' filepath='Objects/call.c' line='332' column='1'/>
+      <parameter type-id='type-id-156' name='stack' filepath='Objects/call.c' line='332' column='1'/>
+      <parameter type-id='type-id-157' name='nargsf' filepath='Objects/call.c' line='333' column='1'/>
+      <parameter type-id='type-id-16' name='kwnames' filepath='Objects/call.c' line='333' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyCFunction_Call' mangled-name='PyCFunction_Call' filepath='Objects/call.c' line='322' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCFunction_Call'>
+      <parameter type-id='type-id-16' name='callable' filepath='Objects/call.c' line='322' column='1'/>
+      <parameter type-id='type-id-16' name='args' filepath='Objects/call.c' line='322' column='1'/>
+      <parameter type-id='type-id-16' name='kwargs' filepath='Objects/call.c' line='322' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyObject_Call' mangled-name='_PyObject_Call' filepath='Objects/call.c' line='276' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_Call'>
+      <parameter type-id='type-id-331' name='tstate' filepath='Objects/call.c' line='276' column='1'/>
+      <parameter type-id='type-id-16' name='callable' filepath='Objects/call.c' line='276' column='1'/>
+      <parameter type-id='type-id-16' name='args' filepath='Objects/call.c' line='277' column='1'/>
+      <parameter type-id='type-id-16' name='kwargs' filepath='Objects/call.c' line='277' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyVectorcall_Call' mangled-name='PyVectorcall_Call' filepath='Objects/call.c' line='229' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyVectorcall_Call'>
+      <parameter type-id='type-id-16' name='callable' filepath='Objects/call.c' line='229' column='1'/>
+      <parameter type-id='type-id-16' name='tuple' filepath='Objects/call.c' line='229' column='1'/>
+      <parameter type-id='type-id-16' name='kwargs' filepath='Objects/call.c' line='229' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyObject_MakeTpCall' mangled-name='_PyObject_MakeTpCall' filepath='Objects/call.c' line='171' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_MakeTpCall'>
+      <parameter type-id='type-id-331' name='tstate' filepath='Objects/call.c' line='171' column='1'/>
+      <parameter type-id='type-id-16' name='callable' filepath='Objects/call.c' line='171' column='1'/>
+      <parameter type-id='type-id-156' name='args' filepath='Objects/call.c' line='172' column='1'/>
+      <parameter type-id='type-id-31' name='nargs' filepath='Objects/call.c' line='172' column='1'/>
+      <parameter type-id='type-id-16' name='keywords' filepath='Objects/call.c' line='173' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyObject_VectorcallDict' mangled-name='PyObject_VectorcallDict' filepath='Objects/call.c' line='162' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_VectorcallDict'>
+      <parameter type-id='type-id-16' name='callable' filepath='Objects/call.c' line='162' column='1'/>
+      <parameter type-id='type-id-156' name='args' filepath='Objects/call.c' line='162' column='1'/>
+      <parameter type-id='type-id-157' name='nargsf' filepath='Objects/call.c' line='163' column='1'/>
+      <parameter type-id='type-id-16' name='kwargs' filepath='Objects/call.c' line='163' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyObject_FastCallDictTstate' mangled-name='_PyObject_FastCallDictTstate' filepath='Objects/call.c' line='118' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_FastCallDictTstate'>
+      <parameter type-id='type-id-331' name='tstate' filepath='Objects/call.c' line='118' column='1'/>
+      <parameter type-id='type-id-16' name='callable' filepath='Objects/call.c' line='118' column='1'/>
+      <parameter type-id='type-id-156' name='args' filepath='Objects/call.c' line='119' column='1'/>
+      <parameter type-id='type-id-157' name='nargsf' filepath='Objects/call.c' line='119' column='1'/>
+      <parameter type-id='type-id-16' name='kwargs' filepath='Objects/call.c' line='120' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyObject_CallNoArgs' mangled-name='PyObject_CallNoArgs' filepath='Objects/call.c' line='110' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_CallNoArgs'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='39' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_Py_CheckFunctionResult' mangled-name='_Py_CheckFunctionResult' filepath='Objects/call.c' line='33' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_CheckFunctionResult'>
+      <parameter type-id='type-id-331' name='tstate' filepath='Objects/call.c' line='33' column='1'/>
+      <parameter type-id='type-id-16' name='callable' filepath='Objects/call.c' line='33' column='1'/>
+      <parameter type-id='type-id-16' name='result' filepath='Objects/call.c' line='34' column='1'/>
+      <parameter type-id='type-id-3' name='where' filepath='Objects/call.c' line='34' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyDict_Next' mangled-name='PyDict_Next' filepath='./Include/dictobject.h' line='27' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_NoMemory' mangled-name='_PyErr_NoMemory' filepath='./Include/internal/pycore_pyerrors.h' line='60' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyDict_SetItem' mangled-name='PyDict_SetItem' filepath='./Include/dictobject.h' line='24' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyDict_NewPresized' mangled-name='_PyDict_NewPresized' filepath='./Include/cpython/dictobject.h' line='51' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObject_GetMethod' mangled-name='_PyObject_GetMethod' filepath='./Include/cpython/object.h' line='330' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyCallable_Check' mangled-name='PyCallable_Check' filepath='./Include/object.h' line='287' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyEval_Vector' mangled-name='_PyEval_Vector' filepath='./Include/internal/pycore_ceval.h' line='50' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTuple_FromArray' mangled-name='_PyTuple_FromArray' filepath='./Include/internal/pycore_tuple.h' line='15' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_FatalErrorFormat' mangled-name='_Py_FatalErrorFormat' filepath='./Include/cpython/pyerrors.h' line='209' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_FormatFromCauseTstate' mangled-name='_PyErr_FormatFromCauseTstate' filepath='./Include/internal/pycore_pyerrors.h' line='79' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_VaBuildStack_SizeT' mangled-name='_Py_VaBuildStack_SizeT' filepath='./Include/modsupport.h' line='28' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_VaBuildStack' mangled-name='_Py_VaBuildStack' filepath='./Include/modsupport.h' line='83' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-type size-in-bits='64' id='type-id-348'>
+      <parameter type-id='type-id-331'/>
+      <parameter type-id='type-id-223'/>
+      <parameter type-id='type-id-9'/>
+      <return type-id='type-id-16'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-271'>
+      <parameter type-id='type-id-270'/>
+      <return type-id='type-id-16'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-272'>
+      <parameter type-id='type-id-16'/>
+      <parameter type-id='type-id-270'/>
+      <return type-id='type-id-9'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-307'>
+      <parameter type-id='type-id-3'/>
+      <parameter type-id='type-id-16'/>
+      <parameter type-id='type-id-21'/>
+      <return type-id='type-id-9'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-314'>
+      <parameter type-id='type-id-21'/>
+      <return type-id='type-id-9'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-274'>
+      <return type-id='type-id-4'/>
+    </function-type>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/capsule.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PyCapsule_Type' type-id='type-id-149' mangled-name='PyCapsule_Type' visibility='default' filepath='./Include/pycapsule.h' line='21' column='1' elf-symbol-id='PyCapsule_Type'/>
+    <function-decl name='PyCapsule_Import' mangled-name='PyCapsule_Import' filepath='Objects/capsule.c' line='195' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCapsule_Import'>
+      <parameter type-id='type-id-3' name='name' filepath='Objects/capsule.c' line='195' column='1'/>
+      <parameter type-id='type-id-9' name='no_block' filepath='Objects/capsule.c' line='195' column='1'/>
+      <return type-id='type-id-21'/>
+    </function-decl>
+    <function-decl name='PyCapsule_SetContext' mangled-name='PyCapsule_SetContext' filepath='Objects/capsule.c' line='181' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCapsule_SetContext'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/capsule.c' line='181' column='1'/>
+      <parameter type-id='type-id-21' name='context' filepath='Objects/capsule.c' line='181' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <typedef-decl name='PyCapsule_Destructor' type-id='type-id-71' filepath='./Include/pycapsule.h' line='23' column='1' id='type-id-407'/>
+    <function-decl name='PyCapsule_SetDestructor' mangled-name='PyCapsule_SetDestructor' filepath='Objects/capsule.c' line='167' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCapsule_SetDestructor'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/capsule.c' line='167' column='1'/>
+      <parameter type-id='type-id-407' name='destructor' filepath='Objects/capsule.c' line='167' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyCapsule_SetName' mangled-name='PyCapsule_SetName' filepath='Objects/capsule.c' line='153' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCapsule_SetName'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/capsule.c' line='153' column='1'/>
+      <parameter type-id='type-id-3' name='name' filepath='Objects/capsule.c' line='153' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyCapsule_SetPointer' mangled-name='PyCapsule_SetPointer' filepath='Objects/capsule.c' line='134' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCapsule_SetPointer'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/capsule.c' line='134' column='1'/>
+      <parameter type-id='type-id-21' name='pointer' filepath='Objects/capsule.c' line='134' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyCapsule_GetContext' mangled-name='PyCapsule_GetContext' filepath='Objects/capsule.c' line='122' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCapsule_GetContext'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/capsule.c' line='122' column='1'/>
+      <return type-id='type-id-21'/>
+    </function-decl>
+    <function-decl name='PyCapsule_GetDestructor' mangled-name='PyCapsule_GetDestructor' filepath='Objects/capsule.c' line='110' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCapsule_GetDestructor'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/capsule.c' line='110' column='1'/>
+      <return type-id='type-id-407'/>
+    </function-decl>
+    <function-decl name='PyCapsule_GetName' mangled-name='PyCapsule_GetName' filepath='Objects/capsule.c' line='98' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCapsule_GetName'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/capsule.c' line='98' column='1'/>
+      <return type-id='type-id-3'/>
+    </function-decl>
+    <function-decl name='PyCapsule_GetPointer' mangled-name='PyCapsule_GetPointer' filepath='Objects/capsule.c' line='80' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCapsule_GetPointer'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/capsule.c' line='80' column='1'/>
+      <parameter type-id='type-id-3' name='name' filepath='Objects/capsule.c' line='80' column='1'/>
+      <return type-id='type-id-21'/>
+    </function-decl>
+    <function-decl name='PyCapsule_New' mangled-name='PyCapsule_New' filepath='Objects/capsule.c' line='44' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCapsule_New'>
+      <parameter type-id='type-id-21' name='pointer' filepath='Objects/capsule.c' line='44' column='1'/>
+      <parameter type-id='type-id-3' name='name' filepath='Objects/capsule.c' line='44' column='1'/>
+      <parameter type-id='type-id-407' name='destructor' filepath='Objects/capsule.c' line='44' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyCapsule_IsValid' mangled-name='PyCapsule_IsValid' filepath='Objects/capsule.c' line='68' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCapsule_IsValid'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/capsule.c' line='153' column='1'/>
+      <parameter type-id='type-id-3' name='name' filepath='Objects/capsule.c' line='153' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/cellobject.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PyCell_Type' type-id='type-id-149' mangled-name='PyCell_Type' visibility='default' filepath='./Include/cellobject.h' line='14' column='1' elf-symbol-id='PyCell_Type'/>
+    <function-decl name='PyCell_Set' mangled-name='PyCell_Set' filepath='Objects/cellobject.c' line='64' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCell_Set'>
+      <parameter type-id='type-id-16' name='derived' filepath='Objects/abstract.c' line='2780' column='1'/>
+      <parameter type-id='type-id-16' name='cls' filepath='Objects/abstract.c' line='2780' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyCell_Get' mangled-name='PyCell_Get' filepath='Objects/cellobject.c' line='53' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCell_Get'>
+      <parameter type-id='type-id-16' name='input' filepath='Objects/bytearrayobject.c' line='80' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyCell_New' mangled-name='PyCell_New' filepath='Objects/cellobject.c' line='7' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCell_New'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/cellobject.c' line='7' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyObject_RichCompare' mangled-name='PyObject_RichCompare' filepath='./Include/object.h' line='269' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/classobject.c' comp-dir-path='/src' language='LANG_C99'>
+    <class-decl name='PyMemberDef' size-in-bits='320' is-struct='yes' visibility='default' filepath='./Include/structmember.h' line='18' column='1' id='type-id-141'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='name' type-id='type-id-3' visibility='default' filepath='./Include/structmember.h' line='19' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='type' type-id='type-id-9' visibility='default' filepath='./Include/structmember.h' line='20' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='offset' type-id='type-id-31' visibility='default' filepath='./Include/structmember.h' line='21' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='flags' type-id='type-id-9' visibility='default' filepath='./Include/structmember.h' line='22' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='doc' type-id='type-id-3' visibility='default' filepath='./Include/structmember.h' line='23' column='1'/>
+      </data-member>
+    </class-decl>
+    <var-decl name='PyMethod_Type' type-id='type-id-149' mangled-name='PyMethod_Type' visibility='default' filepath='./Include/classobject.h' line='20' column='1' elf-symbol-id='PyMethod_Type'/>
+    <var-decl name='PyInstanceMethod_Type' type-id='type-id-149' mangled-name='PyInstanceMethod_Type' visibility='default' filepath='./Include/classobject.h' line='41' column='1' elf-symbol-id='PyInstanceMethod_Type'/>
+    <function-decl name='PyInstanceMethod_New' mangled-name='PyInstanceMethod_New' filepath='Objects/classobject.c' line='378' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInstanceMethod_New'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/cellobject.c' line='7' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyMethod_Self' mangled-name='PyMethod_Self' filepath='Objects/classobject.c' line='25' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMethod_Self'>
+      <parameter type-id='type-id-16' name='im' filepath='Objects/classobject.c' line='25' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyMethod_Function' mangled-name='PyMethod_Function' filepath='Objects/classobject.c' line='15' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMethod_Function'>
+      <parameter type-id='type-id-16' name='im' filepath='Objects/classobject.c' line='25' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyMethod_New' mangled-name='PyMethod_New' filepath='Objects/classobject.c' line='99' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMethod_New'>
+      <parameter type-id='type-id-16' name='func' filepath='Objects/classobject.c' line='99' column='1'/>
+      <parameter type-id='type-id-16' name='self' filepath='Objects/classobject.c' line='99' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyInstanceMethod_Function' mangled-name='PyInstanceMethod_Function' filepath='Objects/classobject.c' line='390' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInstanceMethod_Function'>
+      <parameter type-id='type-id-16' name='im' filepath='Objects/classobject.c' line='390' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyObject_Call' mangled-name='PyObject_Call' filepath='./Include/abstract.h' line='158' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_GetAttr' mangled-name='PyObject_GetAttr' filepath='./Include/object.h' line='274' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_HashPointer' mangled-name='_Py_HashPointer' filepath='./Include/pyhash.h' line='11' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_Hash' mangled-name='PyObject_Hash' filepath='./Include/object.h' line='283' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_ClearWeakRefs' mangled-name='PyObject_ClearWeakRefs' filepath='./Include/object.h' line='288' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyType_Lookup' mangled-name='_PyType_Lookup' filepath='./Include/cpython/object.h' line='300' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyType_Ready' mangled-name='PyType_Ready' filepath='./Include/object.h' line='257' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/codeobject.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PyCode_Type' type-id='type-id-149' mangled-name='PyCode_Type' visibility='default' filepath='./Include/cpython/code.h' line='111' column='1' elf-symbol-id='PyCode_Type'/>
+    <function-decl name='_PyCode_SetExtra' mangled-name='_PyCode_SetExtra' filepath='Objects/codeobject.c' line='1318' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyCode_SetExtra'>
+      <parameter type-id='type-id-16' name='code' filepath='Objects/codeobject.c' line='1318' column='1'/>
+      <parameter type-id='type-id-31' name='index' filepath='Objects/codeobject.c' line='1318' column='1'/>
+      <parameter type-id='type-id-21' name='extra' filepath='Objects/codeobject.c' line='1318' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyCode_GetExtra' mangled-name='_PyCode_GetExtra' filepath='Objects/codeobject.c' line='1297' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyCode_GetExtra'>
+      <parameter type-id='type-id-16' name='code' filepath='Objects/codeobject.c' line='1297' column='1'/>
+      <parameter type-id='type-id-31' name='index' filepath='Objects/codeobject.c' line='1297' column='1'/>
+      <parameter type-id='type-id-195' name='extra' filepath='Objects/codeobject.c' line='1297' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <class-decl name='PyCodeObject' size-in-bits='1408' is-struct='yes' visibility='default' filepath='./Include/cpython/code.h' line='18' column='1' id='type-id-408'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='ob_base' type-id='type-id-69' visibility='default' filepath='./Include/cpython/code.h' line='19' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='co_argcount' type-id='type-id-9' visibility='default' filepath='./Include/cpython/code.h' line='20' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='160'>
+        <var-decl name='co_posonlyargcount' type-id='type-id-9' visibility='default' filepath='./Include/cpython/code.h' line='21' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='co_kwonlyargcount' type-id='type-id-9' visibility='default' filepath='./Include/cpython/code.h' line='22' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='224'>
+        <var-decl name='co_nlocals' type-id='type-id-9' visibility='default' filepath='./Include/cpython/code.h' line='23' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='co_stacksize' type-id='type-id-9' visibility='default' filepath='./Include/cpython/code.h' line='24' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='288'>
+        <var-decl name='co_flags' type-id='type-id-9' visibility='default' filepath='./Include/cpython/code.h' line='25' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='co_firstlineno' type-id='type-id-9' visibility='default' filepath='./Include/cpython/code.h' line='26' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='384'>
+        <var-decl name='co_code' type-id='type-id-16' visibility='default' filepath='./Include/cpython/code.h' line='27' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='448'>
+        <var-decl name='co_consts' type-id='type-id-16' visibility='default' filepath='./Include/cpython/code.h' line='28' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='512'>
+        <var-decl name='co_names' type-id='type-id-16' visibility='default' filepath='./Include/cpython/code.h' line='29' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='576'>
+        <var-decl name='co_varnames' type-id='type-id-16' visibility='default' filepath='./Include/cpython/code.h' line='30' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='640'>
+        <var-decl name='co_freevars' type-id='type-id-16' visibility='default' filepath='./Include/cpython/code.h' line='31' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='704'>
+        <var-decl name='co_cellvars' type-id='type-id-16' visibility='default' filepath='./Include/cpython/code.h' line='32' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='768'>
+        <var-decl name='co_cell2arg' type-id='type-id-125' visibility='default' filepath='./Include/cpython/code.h' line='38' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='832'>
+        <var-decl name='co_filename' type-id='type-id-16' visibility='default' filepath='./Include/cpython/code.h' line='39' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='896'>
+        <var-decl name='co_name' type-id='type-id-16' visibility='default' filepath='./Include/cpython/code.h' line='40' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='960'>
+        <var-decl name='co_linetable' type-id='type-id-16' visibility='default' filepath='./Include/cpython/code.h' line='41' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1024'>
+        <var-decl name='co_zombieframe' type-id='type-id-21' visibility='default' filepath='./Include/cpython/code.h' line='43' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1088'>
+        <var-decl name='co_weakreflist' type-id='type-id-16' visibility='default' filepath='./Include/cpython/code.h' line='44' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1152'>
+        <var-decl name='co_extra' type-id='type-id-21' visibility='default' filepath='./Include/cpython/code.h' line='48' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1216'>
+        <var-decl name='co_opcache_map' type-id='type-id-339' visibility='default' filepath='./Include/cpython/code.h' line='60' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1280'>
+        <var-decl name='co_opcache' type-id='type-id-409' visibility='default' filepath='./Include/cpython/code.h' line='61' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1344'>
+        <var-decl name='co_opcache_flag' type-id='type-id-9' visibility='default' filepath='./Include/cpython/code.h' line='62' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1376'>
+        <var-decl name='co_opcache_size' type-id='type-id-341' visibility='default' filepath='./Include/cpython/code.h' line='63' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='_PyOpcache' size-in-bits='256' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_code.h' line='19' column='1' id='type-id-410'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='u' type-id='type-id-411' visibility='default' filepath='./Include/internal/pycore_code.h' line='23' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='optimized' type-id='type-id-1' visibility='default' filepath='./Include/internal/pycore_code.h' line='24' column='1'/>
+      </data-member>
+    </class-decl>
+    <union-decl name='__anonymous_union__' size-in-bits='192' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_code.h' line='20' column='1' id='type-id-411'>
+      <data-member access='private'>
+        <var-decl name='lg' type-id='type-id-412' visibility='default' filepath='./Include/internal/pycore_code.h' line='21' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='la' type-id='type-id-413' visibility='default' filepath='./Include/internal/pycore_code.h' line='22' column='1'/>
+      </data-member>
+    </union-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-412' visibility='default' filepath='./Include/internal/pycore_code.h' line='7' column='1' id='type-id-414'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='ptr' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_code.h' line='8' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='globals_ver' type-id='type-id-22' visibility='default' filepath='./Include/internal/pycore_code.h' line='9' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='builtins_ver' type-id='type-id-22' visibility='default' filepath='./Include/internal/pycore_code.h' line='10' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='_PyOpcache_LoadGlobal' type-id='type-id-414' filepath='./Include/internal/pycore_code.h' line='11' column='1' id='type-id-412'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-413' visibility='default' filepath='./Include/internal/pycore_code.h' line='13' column='1' id='type-id-415'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='type' type-id='type-id-32' visibility='default' filepath='./Include/internal/pycore_code.h' line='14' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='hint' type-id='type-id-31' visibility='default' filepath='./Include/internal/pycore_code.h' line='15' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='tp_version_tag' type-id='type-id-66' visibility='default' filepath='./Include/internal/pycore_code.h' line='16' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='_PyOpCodeOpt_LoadAttr' type-id='type-id-415' filepath='./Include/internal/pycore_code.h' line='17' column='1' id='type-id-413'/>
+    <typedef-decl name='_PyOpcache' type-id='type-id-410' filepath='./Include/cpython/code.h' line='15' column='1' id='type-id-416'/>
+    <pointer-type-def type-id='type-id-416' size-in-bits='64' id='type-id-409'/>
+    <typedef-decl name='PyCodeObject' type-id='type-id-408' filepath='./Include/code.h' line='9' column='1' id='type-id-417'/>
+    <pointer-type-def type-id='type-id-417' size-in-bits='64' id='type-id-418'/>
+    <function-decl name='PyCode_Addr2Line' mangled-name='PyCode_Addr2Line' filepath='Objects/codeobject.c' line='1246' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCode_Addr2Line'>
+      <parameter type-id='type-id-418' name='co' filepath='Objects/codeobject.c' line='1246' column='1'/>
+      <parameter type-id='type-id-9' name='addrq' filepath='Objects/codeobject.c' line='1246' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyCode_ConstantKey' mangled-name='_PyCode_ConstantKey' filepath='Objects/codeobject.c' line='784' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyCode_ConstantKey'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/codeobject.c' line='784' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyCode_NewEmpty' mangled-name='PyCode_NewEmpty' filepath='Objects/codeobject.c' line='332' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCode_NewEmpty'>
+      <parameter type-id='type-id-3' name='filename' filepath='Objects/codeobject.c' line='332' column='1'/>
+      <parameter type-id='type-id-3' name='funcname' filepath='Objects/codeobject.c' line='332' column='1'/>
+      <parameter type-id='type-id-9' name='firstlineno' filepath='Objects/codeobject.c' line='332' column='1'/>
+      <return type-id='type-id-418'/>
+    </function-decl>
+    <function-decl name='PyCode_New' mangled-name='PyCode_New' filepath='Objects/codeobject.c' line='275' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCode_New'>
+      <parameter type-id='type-id-9' name='argcount' filepath='Objects/codeobject.c' line='275' column='1'/>
+      <parameter type-id='type-id-9' name='kwonlyargcount' filepath='Objects/codeobject.c' line='275' column='1'/>
+      <parameter type-id='type-id-9' name='nlocals' filepath='Objects/codeobject.c' line='276' column='1'/>
+      <parameter type-id='type-id-9' name='stacksize' filepath='Objects/codeobject.c' line='276' column='1'/>
+      <parameter type-id='type-id-9' name='flags' filepath='Objects/codeobject.c' line='276' column='1'/>
+      <parameter type-id='type-id-16' name='code' filepath='Objects/codeobject.c' line='277' column='1'/>
+      <parameter type-id='type-id-16' name='consts' filepath='Objects/codeobject.c' line='277' column='1'/>
+      <parameter type-id='type-id-16' name='names' filepath='Objects/codeobject.c' line='277' column='1'/>
+      <parameter type-id='type-id-16' name='varnames' filepath='Objects/codeobject.c' line='278' column='1'/>
+      <parameter type-id='type-id-16' name='freevars' filepath='Objects/codeobject.c' line='278' column='1'/>
+      <parameter type-id='type-id-16' name='cellvars' filepath='Objects/codeobject.c' line='278' column='1'/>
+      <parameter type-id='type-id-16' name='filename' filepath='Objects/codeobject.c' line='279' column='1'/>
+      <parameter type-id='type-id-16' name='name' filepath='Objects/codeobject.c' line='279' column='1'/>
+      <parameter type-id='type-id-9' name='firstlineno' filepath='Objects/codeobject.c' line='279' column='1'/>
+      <parameter type-id='type-id-16' name='linetable' filepath='Objects/codeobject.c' line='280' column='1'/>
+      <return type-id='type-id-418'/>
+    </function-decl>
+    <function-decl name='PyCode_NewWithPosOnlyArgs' mangled-name='PyCode_NewWithPosOnlyArgs' filepath='Objects/codeobject.c' line='117' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCode_NewWithPosOnlyArgs'>
+      <parameter type-id='type-id-9' name='argcount' filepath='Objects/codeobject.c' line='117' column='1'/>
+      <parameter type-id='type-id-9' name='posonlyargcount' filepath='Objects/codeobject.c' line='117' column='1'/>
+      <parameter type-id='type-id-9' name='kwonlyargcount' filepath='Objects/codeobject.c' line='117' column='1'/>
+      <parameter type-id='type-id-9' name='nlocals' filepath='Objects/codeobject.c' line='118' column='1'/>
+      <parameter type-id='type-id-9' name='stacksize' filepath='Objects/codeobject.c' line='118' column='1'/>
+      <parameter type-id='type-id-9' name='flags' filepath='Objects/codeobject.c' line='118' column='1'/>
+      <parameter type-id='type-id-16' name='code' filepath='Objects/codeobject.c' line='119' column='1'/>
+      <parameter type-id='type-id-16' name='consts' filepath='Objects/codeobject.c' line='119' column='1'/>
+      <parameter type-id='type-id-16' name='names' filepath='Objects/codeobject.c' line='119' column='1'/>
+      <parameter type-id='type-id-16' name='varnames' filepath='Objects/codeobject.c' line='120' column='1'/>
+      <parameter type-id='type-id-16' name='freevars' filepath='Objects/codeobject.c' line='120' column='1'/>
+      <parameter type-id='type-id-16' name='cellvars' filepath='Objects/codeobject.c' line='120' column='1'/>
+      <parameter type-id='type-id-16' name='filename' filepath='Objects/codeobject.c' line='121' column='1'/>
+      <parameter type-id='type-id-16' name='name' filepath='Objects/codeobject.c' line='121' column='1'/>
+      <parameter type-id='type-id-9' name='firstlineno' filepath='Objects/codeobject.c' line='121' column='1'/>
+      <parameter type-id='type-id-16' name='linetable' filepath='Objects/codeobject.c' line='122' column='1'/>
+      <return type-id='type-id-418'/>
+    </function-decl>
+    <class-decl name='_line_offsets' size-in-bits='320' is-struct='yes' visibility='default' filepath='./Include/cpython/code.h' line='144' column='1' id='type-id-419'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='ar_start' type-id='type-id-9' visibility='default' filepath='./Include/cpython/code.h' line='145' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='32'>
+        <var-decl name='ar_end' type-id='type-id-9' visibility='default' filepath='./Include/cpython/code.h' line='146' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='ar_line' type-id='type-id-9' visibility='default' filepath='./Include/cpython/code.h' line='147' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='opaque' type-id='type-id-420' visibility='default' filepath='./Include/cpython/code.h' line='148' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='_opaque' size-in-bits='192' is-struct='yes' visibility='default' filepath='./Include/cpython/code.h' line='138' column='1' id='type-id-420'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='computed_line' type-id='type-id-9' visibility='default' filepath='./Include/cpython/code.h' line='139' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='lo_next' type-id='type-id-3' visibility='default' filepath='./Include/cpython/code.h' line='140' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='limit' type-id='type-id-3' visibility='default' filepath='./Include/cpython/code.h' line='141' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='PyCodeAddressRange' type-id='type-id-419' filepath='./Include/cpython/code.h' line='149' column='1' id='type-id-421'/>
+    <pointer-type-def type-id='type-id-421' size-in-bits='64' id='type-id-422'/>
+    <function-decl name='_PyCode_CheckLineNumber' mangled-name='_PyCode_CheckLineNumber' filepath='Objects/codeobject.c' line='1280' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyCode_CheckLineNumber'>
+      <parameter type-id='type-id-9' name='lasti' filepath='Objects/codeobject.c' line='1280' column='1'/>
+      <parameter type-id='type-id-422' name='bounds' filepath='Objects/codeobject.c' line='1280' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyType_GenericAlloc' mangled-name='PyType_GenericAlloc' filepath='./Include/object.h' line='258' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyComplex_AsCComplex' mangled-name='PyComplex_AsCComplex' filepath='./Include/complexobject.h' line='52' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PySet_NextEntry' mangled-name='_PySet_NextEntry' filepath='./Include/setobject.h' line='71' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyFrozenSet_New' mangled-name='PyFrozenSet_New' filepath='./Include/setobject.h' line='81' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyLong_FromVoidPtr' mangled-name='PyLong_FromVoidPtr' filepath='./Include/longobject.h' line='93' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_Copy' mangled-name='_PyUnicode_Copy' filepath='./Include/cpython/unicodeobject.h' line='477' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyBytes_Resize' mangled-name='_PyBytes_Resize' filepath='./Include/cpython/bytesobject.h' line='17' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_DecodeFSDefault' mangled-name='PyUnicode_DecodeFSDefault' filepath='./Include/unicodeobject.h' line='784' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyBytes_FromString' mangled-name='PyBytes_FromString' filepath='./Include/bytesobject.h' line='35' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyBytes_Size' mangled-name='PyBytes_Size' filepath='./Include/bytesobject.h' line='41' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_Compare' mangled-name='PyUnicode_Compare' filepath='./Include/unicodeobject.h' line='985' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PySequence_Tuple' mangled-name='PySequence_Tuple' filepath='./Include/abstract.h' line='702' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/complexobject.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PyComplex_Type' type-id='type-id-149' mangled-name='PyComplex_Type' visibility='default' filepath='./Include/complexobject.h' line='39' column='1' elf-symbol-id='PyComplex_Type'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='128' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-423' visibility='default' filepath='./Include/complexobject.h' line='10' column='1' id='type-id-424'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='real' type-id='type-id-371' visibility='default' filepath='./Include/complexobject.h' line='11' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='imag' type-id='type-id-371' visibility='default' filepath='./Include/complexobject.h' line='12' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='Py_complex' type-id='type-id-424' filepath='./Include/complexobject.h' line='13' column='1' id='type-id-423'/>
+    <function-decl name='PyComplex_AsCComplex' mangled-name='PyComplex_AsCComplex' filepath='Objects/complexobject.c' line='313' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyComplex_AsCComplex'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/complexobject.c' line='313' column='1'/>
+      <return type-id='type-id-423'/>
+    </function-decl>
+    <function-decl name='PyComplex_ImagAsDouble' mangled-name='PyComplex_ImagAsDouble' filepath='Objects/complexobject.c' line='268' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyComplex_ImagAsDouble'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/complexobject.c' line='268' column='1'/>
+      <return type-id='type-id-371'/>
+    </function-decl>
+    <function-decl name='PyComplex_RealAsDouble' mangled-name='PyComplex_RealAsDouble' filepath='Objects/complexobject.c' line='257' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyComplex_RealAsDouble'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/complexobject.c' line='257' column='1'/>
+      <return type-id='type-id-371'/>
+    </function-decl>
+    <function-decl name='PyComplex_FromDoubles' mangled-name='PyComplex_FromDoubles' filepath='Objects/complexobject.c' line='248' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyComplex_FromDoubles'>
+      <parameter type-id='type-id-371' name='real' filepath='Objects/complexobject.c' line='248' column='1'/>
+      <parameter type-id='type-id-371' name='imag' filepath='Objects/complexobject.c' line='248' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyComplex_FromCComplex' mangled-name='PyComplex_FromCComplex' filepath='Objects/complexobject.c' line='226' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyComplex_FromCComplex'>
+      <parameter type-id='type-id-423' name='cval' filepath='Objects/complexobject.c' line='226' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_Py_c_abs' mangled-name='_Py_c_abs' filepath='Objects/complexobject.c' line='183' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_c_abs'>
+      <parameter type-id='type-id-423' name='z' filepath='Objects/complexobject.c' line='183' column='1'/>
+      <return type-id='type-id-371'/>
+    </function-decl>
+    <function-decl name='_Py_c_pow' mangled-name='_Py_c_pow' filepath='Objects/complexobject.c' line='127' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_c_pow'>
+      <parameter type-id='type-id-423' name='a' filepath='Objects/complexobject.c' line='127' column='1'/>
+      <parameter type-id='type-id-423' name='b' filepath='Objects/complexobject.c' line='127' column='1'/>
+      <return type-id='type-id-423'/>
+    </function-decl>
+    <function-decl name='_Py_c_quot' mangled-name='_Py_c_quot' filepath='Objects/complexobject.c' line='66' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_c_quot'>
+      <parameter type-id='type-id-423' name='a' filepath='Objects/complexobject.c' line='66' column='1'/>
+      <parameter type-id='type-id-423' name='b' filepath='Objects/complexobject.c' line='66' column='1'/>
+      <return type-id='type-id-423'/>
+    </function-decl>
+    <function-decl name='_Py_c_prod' mangled-name='_Py_c_prod' filepath='Objects/complexobject.c' line='53' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_c_prod'>
+      <parameter type-id='type-id-423' name='a' filepath='Objects/complexobject.c' line='53' column='1'/>
+      <parameter type-id='type-id-423' name='b' filepath='Objects/complexobject.c' line='53' column='1'/>
+      <return type-id='type-id-423'/>
+    </function-decl>
+    <function-decl name='_Py_c_neg' mangled-name='_Py_c_neg' filepath='Objects/complexobject.c' line='44' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_c_neg'>
+      <parameter type-id='type-id-423' name='a' filepath='Objects/complexobject.c' line='44' column='1'/>
+      <return type-id='type-id-423'/>
+    </function-decl>
+    <function-decl name='_Py_c_diff' mangled-name='_Py_c_diff' filepath='Objects/complexobject.c' line='35' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_c_diff'>
+      <parameter type-id='type-id-423' name='a' filepath='Objects/complexobject.c' line='53' column='1'/>
+      <parameter type-id='type-id-423' name='b' filepath='Objects/complexobject.c' line='53' column='1'/>
+      <return type-id='type-id-423'/>
+    </function-decl>
+    <function-decl name='_Py_c_sum' mangled-name='_Py_c_sum' filepath='Objects/complexobject.c' line='26' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_c_sum'>
+      <parameter type-id='type-id-423' name='a' filepath='Objects/complexobject.c' line='53' column='1'/>
+      <parameter type-id='type-id-423' name='b' filepath='Objects/complexobject.c' line='53' column='1'/>
+      <return type-id='type-id-423'/>
+    </function-decl>
+    <function-decl name='_Py_HashDouble' mangled-name='_Py_HashDouble' filepath='./Include/pyhash.h' line='10' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='hypot' mangled-name='hypot' filepath='/usr/include/x86_64-linux-gnu/bits/mathcalls.h' line='147' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='pow' mangled-name='pow' filepath='/usr/include/x86_64-linux-gnu/bits/mathcalls.h' line='140' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='atan2' mangled-name='atan2' filepath='/usr/include/x86_64-linux-gnu/bits/mathcalls.h' line='59' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__builtin_sincos' mangled-name='sincos' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='exp' mangled-name='exp' filepath='/usr/include/x86_64-linux-gnu/bits/mathcalls.h' line='95' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='log' mangled-name='log' filepath='/usr/include/x86_64-linux-gnu/bits/mathcalls.h' line='104' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_TransformDecimalAndSpaceToASCII' mangled-name='_PyUnicode_TransformDecimalAndSpaceToASCII' filepath='./Include/cpython/unicodeobject.h' line='995' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_string_to_number_with_underscores' mangled-name='_Py_string_to_number_with_underscores' filepath='./Include/pystrtod.h' line='22' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_Float' mangled-name='PyNumber_Float' filepath='./Include/abstract.h' line='544' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicodeWriter_Init' mangled-name='_PyUnicodeWriter_Init' filepath='./Include/cpython/unicodeobject.h' line='631' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyComplex_FormatAdvancedWriter' mangled-name='_PyComplex_FormatAdvancedWriter' filepath='./Include/complexobject.h' line='58' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicodeWriter_Finish' mangled-name='_PyUnicodeWriter_Finish' filepath='./Include/cpython/unicodeobject.h' line='711' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicodeWriter_Dealloc' mangled-name='_PyUnicodeWriter_Dealloc' filepath='./Include/cpython/unicodeobject.h' line='715' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/descrobject.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PyMethodDescr_Type' type-id='type-id-149' mangled-name='PyMethodDescr_Type' visibility='default' filepath='./Include/descrobject.h' line='79' column='1' elf-symbol-id='PyMethodDescr_Type'/>
+    <var-decl name='PyClassMethodDescr_Type' type-id='type-id-149' mangled-name='PyClassMethodDescr_Type' visibility='default' filepath='./Include/descrobject.h' line='76' column='1' elf-symbol-id='PyClassMethodDescr_Type'/>
+    <var-decl name='PyMemberDescr_Type' type-id='type-id-149' mangled-name='PyMemberDescr_Type' visibility='default' filepath='./Include/descrobject.h' line='78' column='1' elf-symbol-id='PyMemberDescr_Type'/>
+    <var-decl name='PyGetSetDescr_Type' type-id='type-id-149' mangled-name='PyGetSetDescr_Type' visibility='default' filepath='./Include/descrobject.h' line='77' column='1' elf-symbol-id='PyGetSetDescr_Type'/>
+    <var-decl name='PyWrapperDescr_Type' type-id='type-id-149' mangled-name='PyWrapperDescr_Type' visibility='default' filepath='./Include/descrobject.h' line='80' column='1' elf-symbol-id='PyWrapperDescr_Type'/>
+    <var-decl name='_PyMethodWrapper_Type' type-id='type-id-149' mangled-name='_PyMethodWrapper_Type' visibility='default' filepath='./Include/descrobject.h' line='83' column='1' elf-symbol-id='_PyMethodWrapper_Type'/>
+    <var-decl name='PyDictProxy_Type' type-id='type-id-149' mangled-name='PyDictProxy_Type' visibility='default' filepath='./Include/descrobject.h' line='81' column='1' elf-symbol-id='PyDictProxy_Type'/>
+    <var-decl name='PyProperty_Type' type-id='type-id-149' mangled-name='PyProperty_Type' visibility='default' filepath='./Include/descrobject.h' line='103' column='1' elf-symbol-id='PyProperty_Type'/>
+    <function-decl name='PyWrapper_New' mangled-name='PyWrapper_New' filepath='Objects/descrobject.c' line='1436' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyWrapper_New'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/abstract.c' line='1069' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/abstract.c' line='1069' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyDictProxy_New' mangled-name='PyDictProxy_New' filepath='Objects/descrobject.c' line='1233' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyDictProxy_New'>
+      <parameter type-id='type-id-16' name='mapping' filepath='Objects/descrobject.c' line='1233' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyDescr_IsData' mangled-name='PyDescr_IsData' filepath='Objects/descrobject.c' line='997' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyDescr_IsData'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='2310' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <class-decl name='wrapperbase' size-in-bits='448' is-struct='yes' visibility='default' filepath='./Include/descrobject.h' line='26' column='1' id='type-id-425'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='name' type-id='type-id-3' visibility='default' filepath='./Include/descrobject.h' line='27' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='offset' type-id='type-id-9' visibility='default' filepath='./Include/descrobject.h' line='28' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='function' type-id='type-id-21' visibility='default' filepath='./Include/descrobject.h' line='29' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='wrapper' type-id='type-id-426' visibility='default' filepath='./Include/descrobject.h' line='30' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='doc' type-id='type-id-3' visibility='default' filepath='./Include/descrobject.h' line='31' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='flags' type-id='type-id-9' visibility='default' filepath='./Include/descrobject.h' line='32' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='384'>
+        <var-decl name='name_strobj' type-id='type-id-16' visibility='default' filepath='./Include/descrobject.h' line='33' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-427' size-in-bits='64' id='type-id-428'/>
+    <typedef-decl name='wrapperfunc' type-id='type-id-428' filepath='./Include/descrobject.h' line='20' column='1' id='type-id-426'/>
+    <pointer-type-def type-id='type-id-425' size-in-bits='64' id='type-id-429'/>
+    <function-decl name='PyDescr_NewWrapper' mangled-name='PyDescr_NewWrapper' filepath='Objects/descrobject.c' line='983' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyDescr_NewWrapper'>
+      <parameter type-id='type-id-32' name='type' filepath='Objects/descrobject.c' line='983' column='1'/>
+      <parameter type-id='type-id-429' name='base' filepath='Objects/descrobject.c' line='983' column='1'/>
+      <parameter type-id='type-id-21' name='wrapped' filepath='Objects/descrobject.c' line='983' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <typedef-decl name='PyGetSetDef' type-id='type-id-142' filepath='./Include/descrobject.h' line='17' column='1' id='type-id-430'/>
+    <pointer-type-def type-id='type-id-430' size-in-bits='64' id='type-id-431'/>
+    <function-decl name='PyDescr_NewGetSet' mangled-name='PyDescr_NewGetSet' filepath='Objects/descrobject.c' line='971' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyDescr_NewGetSet'>
+      <parameter type-id='type-id-32' name='type' filepath='Objects/descrobject.c' line='971' column='1'/>
+      <parameter type-id='type-id-431' name='getset' filepath='Objects/descrobject.c' line='971' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <typedef-decl name='PyMemberDef' type-id='type-id-141' filepath='./Include/structmember.h' line='24' column='1' id='type-id-432'/>
+    <pointer-type-def type-id='type-id-432' size-in-bits='64' id='type-id-433'/>
+    <function-decl name='PyDescr_NewMember' mangled-name='PyDescr_NewMember' filepath='Objects/descrobject.c' line='959' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyDescr_NewMember'>
+      <parameter type-id='type-id-32' name='type' filepath='Objects/descrobject.c' line='959' column='1'/>
+      <parameter type-id='type-id-433' name='member' filepath='Objects/descrobject.c' line='959' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <typedef-decl name='PyMethodDef' type-id='type-id-139' filepath='./Include/methodobject.h' line='42' column='1' id='type-id-434'/>
+    <pointer-type-def type-id='type-id-434' size-in-bits='64' id='type-id-435'/>
+    <function-decl name='PyDescr_NewClassMethod' mangled-name='PyDescr_NewClassMethod' filepath='Objects/descrobject.c' line='947' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyDescr_NewClassMethod'>
+      <parameter type-id='type-id-32' name='type' filepath='Objects/descrobject.c' line='947' column='1'/>
+      <parameter type-id='type-id-435' name='method' filepath='Objects/descrobject.c' line='947' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyDescr_NewMethod' mangled-name='PyDescr_NewMethod' filepath='Objects/descrobject.c' line='901' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyDescr_NewMethod'>
+      <parameter type-id='type-id-32' name='type' filepath='Objects/descrobject.c' line='901' column='1'/>
+      <parameter type-id='type-id-435' name='method' filepath='Objects/descrobject.c' line='901' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyObject_SetAttrId' mangled-name='_PyObject_SetAttrId' filepath='./Include/cpython/object.h' line='317' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyMapping_Check' mangled-name='PyMapping_Check' filepath='./Include/abstract.h' line='785' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_Type' mangled-name='PyObject_Type' filepath='./Include/abstract.h' line='268' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyType_GetTextSignatureFromInternalDoc' mangled-name='_PyType_GetTextSignatureFromInternalDoc' filepath='./Include/cpython/object.h' line='305' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyType_GetDocFromInternalDoc' mangled-name='_PyType_GetDocFromInternalDoc' filepath='./Include/cpython/object.h' line='304' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTrash_cond' mangled-name='_PyTrash_cond' filepath='./Include/cpython/object.h' line='523' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTrash_end' mangled-name='_PyTrash_end' filepath='./Include/cpython/object.h' line='521' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTrash_begin' mangled-name='_PyTrash_begin' filepath='./Include/cpython/object.h' line='520' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_GC_UnTrack' mangled-name='PyObject_GC_UnTrack' filepath='./Include/objimpl.h' line='180' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyArg_UnpackStack' mangled-name='_PyArg_UnpackStack' filepath='./Include/modsupport.h' line='54' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PySequence_Contains' mangled-name='PySequence_Contains' filepath='./Include/abstract.h' line='744' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyDict_Contains' mangled-name='PyDict_Contains' filepath='./Include/dictobject.h' line='34' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_Or' mangled-name='PyNumber_Or' filepath='./Include/abstract.h' line='516' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_Size' mangled-name='PyObject_Size' filepath='./Include/abstract.h' line='277' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObject_RealIsSubclass' mangled-name='_PyObject_RealIsSubclass' filepath='./Include/cpython/abstract.h' line='357' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyTuple_GetSlice' mangled-name='PyTuple_GetSlice' filepath='./Include/tupleobject.h' line='34' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObject_FunctionStr' mangled-name='_PyObject_FunctionStr' filepath='./Include/cpython/object.h' line='345' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyStack_AsDict' mangled-name='_PyStack_AsDict' filepath='./Include/cpython/abstract.h' line='21' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyMember_SetOne' mangled-name='PyMember_SetOne' filepath='./Include/structmember.h' line='69' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyCMethod_New' mangled-name='PyCMethod_New' filepath='./Include/methodobject.h' line='56' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObject_IsAbstract' mangled-name='_PyObject_IsAbstract' filepath='./Include/cpython/object.h' line='315' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyMember_GetOne' mangled-name='PyMember_GetOne' filepath='./Include/structmember.h' line='68' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_VectorcallDict' mangled-name='PyObject_VectorcallDict' filepath='./Include/cpython/abstract.h' line='138' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-type size-in-bits='64' id='type-id-427'>
+      <parameter type-id='type-id-16'/>
+      <parameter type-id='type-id-16'/>
+      <parameter type-id='type-id-21'/>
+      <return type-id='type-id-16'/>
+    </function-type>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/enumobject.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PyEnum_Type' type-id='type-id-149' mangled-name='PyEnum_Type' visibility='default' filepath='./Include/enumobject.h' line='10' column='1' elf-symbol-id='PyEnum_Type'/>
+    <var-decl name='PyReversed_Type' type-id='type-id-149' mangled-name='PyReversed_Type' visibility='default' filepath='./Include/enumobject.h' line='11' column='1' elf-symbol-id='PyReversed_Type'/>
+    <function-decl name='PySequence_Size' mangled-name='PySequence_Size' filepath='./Include/abstract.h' line='646' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PySequence_GetItem' mangled-name='PySequence_GetItem' filepath='./Include/abstract.h' line='668' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_Add' mangled-name='PyNumber_Add' filepath='./Include/abstract.h' line='422' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_Index' mangled-name='PyNumber_Index' filepath='./Include/abstract.h' line='524' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PySequence_Check' mangled-name='PySequence_Check' filepath='./Include/abstract.h' line='643' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/exceptions.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PyExc_EnvironmentError' type-id='type-id-16' mangled-name='PyExc_EnvironmentError' visibility='default' filepath='./Include/pyerrors.h' line='132' column='1' elf-symbol-id='PyExc_EnvironmentError'/>
+    <var-decl name='PyExc_IOError' type-id='type-id-16' mangled-name='PyExc_IOError' visibility='default' filepath='./Include/pyerrors.h' line='133' column='1' elf-symbol-id='PyExc_IOError'/>
+    <var-decl name='PyExc_BaseException' type-id='type-id-16' mangled-name='PyExc_BaseException' visibility='default' filepath='./Include/pyerrors.h' line='66' column='1' elf-symbol-id='PyExc_BaseException'/>
+    <var-decl name='PyExc_Exception' type-id='type-id-16' mangled-name='PyExc_Exception' visibility='default' filepath='./Include/pyerrors.h' line='67' column='1' elf-symbol-id='PyExc_Exception'/>
+    <var-decl name='PyExc_TypeError' type-id='type-id-16' mangled-name='PyExc_TypeError' visibility='default' filepath='./Include/pyerrors.h' line='103' column='1' elf-symbol-id='PyExc_TypeError'/>
+    <var-decl name='PyExc_StopAsyncIteration' type-id='type-id-16' mangled-name='PyExc_StopAsyncIteration' visibility='default' filepath='./Include/pyerrors.h' line='69' column='1' elf-symbol-id='PyExc_StopAsyncIteration'/>
+    <var-decl name='PyExc_StopIteration' type-id='type-id-16' mangled-name='PyExc_StopIteration' visibility='default' filepath='./Include/pyerrors.h' line='71' column='1' elf-symbol-id='PyExc_StopIteration'/>
+    <var-decl name='PyExc_GeneratorExit' type-id='type-id-16' mangled-name='PyExc_GeneratorExit' visibility='default' filepath='./Include/pyerrors.h' line='72' column='1' elf-symbol-id='PyExc_GeneratorExit'/>
+    <var-decl name='PyExc_SystemExit' type-id='type-id-16' mangled-name='PyExc_SystemExit' visibility='default' filepath='./Include/pyerrors.h' line='102' column='1' elf-symbol-id='PyExc_SystemExit'/>
+    <var-decl name='PyExc_KeyboardInterrupt' type-id='type-id-16' mangled-name='PyExc_KeyboardInterrupt' visibility='default' filepath='./Include/pyerrors.h' line='88' column='1' elf-symbol-id='PyExc_KeyboardInterrupt'/>
+    <var-decl name='PyExc_ImportError' type-id='type-id-16' mangled-name='PyExc_ImportError' visibility='default' filepath='./Include/pyerrors.h' line='82' column='1' elf-symbol-id='PyExc_ImportError'/>
+    <var-decl name='PyExc_ModuleNotFoundError' type-id='type-id-16' mangled-name='PyExc_ModuleNotFoundError' visibility='default' filepath='./Include/pyerrors.h' line='84' column='1' elf-symbol-id='PyExc_ModuleNotFoundError'/>
+    <var-decl name='PyExc_OSError' type-id='type-id-16' mangled-name='PyExc_OSError' visibility='default' filepath='./Include/pyerrors.h' line='81' column='1' elf-symbol-id='PyExc_OSError'/>
+    <var-decl name='PyExc_BlockingIOError' type-id='type-id-16' mangled-name='PyExc_BlockingIOError' visibility='default' filepath='./Include/pyerrors.h' line='113' column='1' elf-symbol-id='PyExc_BlockingIOError'/>
+    <var-decl name='PyExc_ConnectionError' type-id='type-id-16' mangled-name='PyExc_ConnectionError' visibility='default' filepath='./Include/pyerrors.h' line='116' column='1' elf-symbol-id='PyExc_ConnectionError'/>
+    <var-decl name='PyExc_ChildProcessError' type-id='type-id-16' mangled-name='PyExc_ChildProcessError' visibility='default' filepath='./Include/pyerrors.h' line='115' column='1' elf-symbol-id='PyExc_ChildProcessError'/>
+    <var-decl name='PyExc_BrokenPipeError' type-id='type-id-16' mangled-name='PyExc_BrokenPipeError' visibility='default' filepath='./Include/pyerrors.h' line='114' column='1' elf-symbol-id='PyExc_BrokenPipeError'/>
+    <var-decl name='PyExc_ConnectionAbortedError' type-id='type-id-16' mangled-name='PyExc_ConnectionAbortedError' visibility='default' filepath='./Include/pyerrors.h' line='117' column='1' elf-symbol-id='PyExc_ConnectionAbortedError'/>
+    <var-decl name='PyExc_ConnectionRefusedError' type-id='type-id-16' mangled-name='PyExc_ConnectionRefusedError' visibility='default' filepath='./Include/pyerrors.h' line='118' column='1' elf-symbol-id='PyExc_ConnectionRefusedError'/>
+    <var-decl name='PyExc_ConnectionResetError' type-id='type-id-16' mangled-name='PyExc_ConnectionResetError' visibility='default' filepath='./Include/pyerrors.h' line='119' column='1' elf-symbol-id='PyExc_ConnectionResetError'/>
+    <var-decl name='PyExc_FileExistsError' type-id='type-id-16' mangled-name='PyExc_FileExistsError' visibility='default' filepath='./Include/pyerrors.h' line='120' column='1' elf-symbol-id='PyExc_FileExistsError'/>
+    <var-decl name='PyExc_FileNotFoundError' type-id='type-id-16' mangled-name='PyExc_FileNotFoundError' visibility='default' filepath='./Include/pyerrors.h' line='121' column='1' elf-symbol-id='PyExc_FileNotFoundError'/>
+    <var-decl name='PyExc_IsADirectoryError' type-id='type-id-16' mangled-name='PyExc_IsADirectoryError' visibility='default' filepath='./Include/pyerrors.h' line='123' column='1' elf-symbol-id='PyExc_IsADirectoryError'/>
+    <var-decl name='PyExc_NotADirectoryError' type-id='type-id-16' mangled-name='PyExc_NotADirectoryError' visibility='default' filepath='./Include/pyerrors.h' line='124' column='1' elf-symbol-id='PyExc_NotADirectoryError'/>
+    <var-decl name='PyExc_InterruptedError' type-id='type-id-16' mangled-name='PyExc_InterruptedError' visibility='default' filepath='./Include/pyerrors.h' line='122' column='1' elf-symbol-id='PyExc_InterruptedError'/>
+    <var-decl name='PyExc_PermissionError' type-id='type-id-16' mangled-name='PyExc_PermissionError' visibility='default' filepath='./Include/pyerrors.h' line='125' column='1' elf-symbol-id='PyExc_PermissionError'/>
+    <var-decl name='PyExc_ProcessLookupError' type-id='type-id-16' mangled-name='PyExc_ProcessLookupError' visibility='default' filepath='./Include/pyerrors.h' line='126' column='1' elf-symbol-id='PyExc_ProcessLookupError'/>
+    <var-decl name='PyExc_TimeoutError' type-id='type-id-16' mangled-name='PyExc_TimeoutError' visibility='default' filepath='./Include/pyerrors.h' line='127' column='1' elf-symbol-id='PyExc_TimeoutError'/>
+    <var-decl name='PyExc_EOFError' type-id='type-id-16' mangled-name='PyExc_EOFError' visibility='default' filepath='./Include/pyerrors.h' line='79' column='1' elf-symbol-id='PyExc_EOFError'/>
+    <var-decl name='PyExc_RuntimeError' type-id='type-id-16' mangled-name='PyExc_RuntimeError' visibility='default' filepath='./Include/pyerrors.h' line='92' column='1' elf-symbol-id='PyExc_RuntimeError'/>
+    <var-decl name='PyExc_RecursionError' type-id='type-id-16' mangled-name='PyExc_RecursionError' visibility='default' filepath='./Include/pyerrors.h' line='94' column='1' elf-symbol-id='PyExc_RecursionError'/>
+    <var-decl name='PyExc_NotImplementedError' type-id='type-id-16' mangled-name='PyExc_NotImplementedError' visibility='default' filepath='./Include/pyerrors.h' line='96' column='1' elf-symbol-id='PyExc_NotImplementedError'/>
+    <var-decl name='PyExc_NameError' type-id='type-id-16' mangled-name='PyExc_NameError' visibility='default' filepath='./Include/pyerrors.h' line='90' column='1' elf-symbol-id='PyExc_NameError'/>
+    <var-decl name='PyExc_UnboundLocalError' type-id='type-id-16' mangled-name='PyExc_UnboundLocalError' visibility='default' filepath='./Include/pyerrors.h' line='104' column='1' elf-symbol-id='PyExc_UnboundLocalError'/>
+    <var-decl name='PyExc_AttributeError' type-id='type-id-16' mangled-name='PyExc_AttributeError' visibility='default' filepath='./Include/pyerrors.h' line='77' column='1' elf-symbol-id='PyExc_AttributeError'/>
+    <var-decl name='PyExc_SyntaxError' type-id='type-id-16' mangled-name='PyExc_SyntaxError' visibility='default' filepath='./Include/pyerrors.h' line='97' column='1' elf-symbol-id='PyExc_SyntaxError'/>
+    <var-decl name='PyExc_IndentationError' type-id='type-id-16' mangled-name='PyExc_IndentationError' visibility='default' filepath='./Include/pyerrors.h' line='98' column='1' elf-symbol-id='PyExc_IndentationError'/>
+    <var-decl name='PyExc_TabError' type-id='type-id-16' mangled-name='PyExc_TabError' visibility='default' filepath='./Include/pyerrors.h' line='99' column='1' elf-symbol-id='PyExc_TabError'/>
+    <var-decl name='PyExc_LookupError' type-id='type-id-16' mangled-name='PyExc_LookupError' visibility='default' filepath='./Include/pyerrors.h' line='74' column='1' elf-symbol-id='PyExc_LookupError'/>
+    <var-decl name='PyExc_IndexError' type-id='type-id-16' mangled-name='PyExc_IndexError' visibility='default' filepath='./Include/pyerrors.h' line='86' column='1' elf-symbol-id='PyExc_IndexError'/>
+    <var-decl name='PyExc_KeyError' type-id='type-id-16' mangled-name='PyExc_KeyError' visibility='default' filepath='./Include/pyerrors.h' line='87' column='1' elf-symbol-id='PyExc_KeyError'/>
+    <var-decl name='PyExc_ValueError' type-id='type-id-16' mangled-name='PyExc_ValueError' visibility='default' filepath='./Include/pyerrors.h' line='109' column='1' elf-symbol-id='PyExc_ValueError'/>
+    <var-decl name='PyExc_UnicodeError' type-id='type-id-16' mangled-name='PyExc_UnicodeError' visibility='default' filepath='./Include/pyerrors.h' line='105' column='1' elf-symbol-id='PyExc_UnicodeError'/>
+    <var-decl name='PyExc_UnicodeEncodeError' type-id='type-id-16' mangled-name='PyExc_UnicodeEncodeError' visibility='default' filepath='./Include/pyerrors.h' line='106' column='1' elf-symbol-id='PyExc_UnicodeEncodeError'/>
+    <var-decl name='PyExc_UnicodeDecodeError' type-id='type-id-16' mangled-name='PyExc_UnicodeDecodeError' visibility='default' filepath='./Include/pyerrors.h' line='107' column='1' elf-symbol-id='PyExc_UnicodeDecodeError'/>
+    <var-decl name='PyExc_UnicodeTranslateError' type-id='type-id-16' mangled-name='PyExc_UnicodeTranslateError' visibility='default' filepath='./Include/pyerrors.h' line='108' column='1' elf-symbol-id='PyExc_UnicodeTranslateError'/>
+    <var-decl name='PyExc_AssertionError' type-id='type-id-16' mangled-name='PyExc_AssertionError' visibility='default' filepath='./Include/pyerrors.h' line='76' column='1' elf-symbol-id='PyExc_AssertionError'/>
+    <var-decl name='PyExc_ArithmeticError' type-id='type-id-16' mangled-name='PyExc_ArithmeticError' visibility='default' filepath='./Include/pyerrors.h' line='73' column='1' elf-symbol-id='PyExc_ArithmeticError'/>
+    <var-decl name='PyExc_FloatingPointError' type-id='type-id-16' mangled-name='PyExc_FloatingPointError' visibility='default' filepath='./Include/pyerrors.h' line='80' column='1' elf-symbol-id='PyExc_FloatingPointError'/>
+    <var-decl name='PyExc_OverflowError' type-id='type-id-16' mangled-name='PyExc_OverflowError' visibility='default' filepath='./Include/pyerrors.h' line='91' column='1' elf-symbol-id='PyExc_OverflowError'/>
+    <var-decl name='PyExc_ZeroDivisionError' type-id='type-id-16' mangled-name='PyExc_ZeroDivisionError' visibility='default' filepath='./Include/pyerrors.h' line='110' column='1' elf-symbol-id='PyExc_ZeroDivisionError'/>
+    <var-decl name='PyExc_SystemError' type-id='type-id-16' mangled-name='PyExc_SystemError' visibility='default' filepath='./Include/pyerrors.h' line='101' column='1' elf-symbol-id='PyExc_SystemError'/>
+    <var-decl name='PyExc_ReferenceError' type-id='type-id-16' mangled-name='PyExc_ReferenceError' visibility='default' filepath='./Include/pyerrors.h' line='100' column='1' elf-symbol-id='PyExc_ReferenceError'/>
+    <var-decl name='PyExc_MemoryError' type-id='type-id-16' mangled-name='PyExc_MemoryError' visibility='default' filepath='./Include/pyerrors.h' line='89' column='1' elf-symbol-id='PyExc_MemoryError'/>
+    <var-decl name='PyExc_BufferError' type-id='type-id-16' mangled-name='PyExc_BufferError' visibility='default' filepath='./Include/pyerrors.h' line='78' column='1' elf-symbol-id='PyExc_BufferError'/>
+    <var-decl name='PyExc_Warning' type-id='type-id-16' mangled-name='PyExc_Warning' visibility='default' filepath='./Include/pyerrors.h' line='139' column='1' elf-symbol-id='PyExc_Warning'/>
+    <var-decl name='PyExc_UserWarning' type-id='type-id-16' mangled-name='PyExc_UserWarning' visibility='default' filepath='./Include/pyerrors.h' line='140' column='1' elf-symbol-id='PyExc_UserWarning'/>
+    <var-decl name='PyExc_DeprecationWarning' type-id='type-id-16' mangled-name='PyExc_DeprecationWarning' visibility='default' filepath='./Include/pyerrors.h' line='141' column='1' elf-symbol-id='PyExc_DeprecationWarning'/>
+    <var-decl name='PyExc_PendingDeprecationWarning' type-id='type-id-16' mangled-name='PyExc_PendingDeprecationWarning' visibility='default' filepath='./Include/pyerrors.h' line='142' column='1' elf-symbol-id='PyExc_PendingDeprecationWarning'/>
+    <var-decl name='PyExc_SyntaxWarning' type-id='type-id-16' mangled-name='PyExc_SyntaxWarning' visibility='default' filepath='./Include/pyerrors.h' line='143' column='1' elf-symbol-id='PyExc_SyntaxWarning'/>
+    <var-decl name='PyExc_RuntimeWarning' type-id='type-id-16' mangled-name='PyExc_RuntimeWarning' visibility='default' filepath='./Include/pyerrors.h' line='144' column='1' elf-symbol-id='PyExc_RuntimeWarning'/>
+    <var-decl name='PyExc_FutureWarning' type-id='type-id-16' mangled-name='PyExc_FutureWarning' visibility='default' filepath='./Include/pyerrors.h' line='145' column='1' elf-symbol-id='PyExc_FutureWarning'/>
+    <var-decl name='PyExc_ImportWarning' type-id='type-id-16' mangled-name='PyExc_ImportWarning' visibility='default' filepath='./Include/pyerrors.h' line='146' column='1' elf-symbol-id='PyExc_ImportWarning'/>
+    <var-decl name='PyExc_UnicodeWarning' type-id='type-id-16' mangled-name='PyExc_UnicodeWarning' visibility='default' filepath='./Include/pyerrors.h' line='147' column='1' elf-symbol-id='PyExc_UnicodeWarning'/>
+    <var-decl name='PyExc_BytesWarning' type-id='type-id-16' mangled-name='PyExc_BytesWarning' visibility='default' filepath='./Include/pyerrors.h' line='148' column='1' elf-symbol-id='PyExc_BytesWarning'/>
+    <var-decl name='PyExc_EncodingWarning' type-id='type-id-16' mangled-name='PyExc_EncodingWarning' visibility='default' filepath='./Include/pyerrors.h' line='149' column='1' elf-symbol-id='PyExc_EncodingWarning'/>
+    <var-decl name='PyExc_ResourceWarning' type-id='type-id-16' mangled-name='PyExc_ResourceWarning' visibility='default' filepath='./Include/pyerrors.h' line='150' column='1' elf-symbol-id='PyExc_ResourceWarning'/>
+    <function-decl name='_PyErr_TrySetFromCause' mangled-name='_PyErr_TrySetFromCause' filepath='Objects/exceptions.c' line='2939' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyErr_TrySetFromCause'>
+      <parameter type-id='type-id-3' name='format' filepath='Objects/exceptions.c' line='2939' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyUnicodeTranslateError_Create' mangled-name='_PyUnicodeTranslateError_Create' filepath='Objects/exceptions.c' line='2341' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicodeTranslateError_Create'>
+      <parameter type-id='type-id-16' name='object' filepath='Objects/exceptions.c' line='2342' column='1'/>
+      <parameter type-id='type-id-31' name='start' filepath='Objects/exceptions.c' line='2343' column='1'/>
+      <parameter type-id='type-id-31' name='end' filepath='Objects/exceptions.c' line='2343' column='1'/>
+      <parameter type-id='type-id-3' name='reason' filepath='Objects/exceptions.c' line='2343' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <typedef-decl name='Py_UNICODE' type-id='type-id-327' filepath='./Include/cpython/unicodeobject.h' line='10' column='1' id='type-id-436'/>
+    <qualified-type-def type-id='type-id-436' const='yes' id='type-id-437'/>
+    <pointer-type-def type-id='type-id-437' size-in-bits='64' id='type-id-438'/>
+    <function-decl name='PyUnicodeTranslateError_Create' mangled-name='PyUnicodeTranslateError_Create' filepath='Objects/exceptions.c' line='2332' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicodeTranslateError_Create'>
+      <parameter type-id='type-id-438' name='object' filepath='Objects/exceptions.c' line='2333' column='1'/>
+      <parameter type-id='type-id-31' name='length' filepath='Objects/exceptions.c' line='2333' column='1'/>
+      <parameter type-id='type-id-31' name='start' filepath='Objects/exceptions.c' line='2334' column='1'/>
+      <parameter type-id='type-id-31' name='end' filepath='Objects/exceptions.c' line='2334' column='1'/>
+      <parameter type-id='type-id-3' name='reason' filepath='Objects/exceptions.c' line='2334' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicodeDecodeError_Create' mangled-name='PyUnicodeDecodeError_Create' filepath='Objects/exceptions.c' line='2234' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicodeDecodeError_Create'>
+      <parameter type-id='type-id-3' name='encoding' filepath='Objects/exceptions.c' line='2235' column='1'/>
+      <parameter type-id='type-id-3' name='object' filepath='Objects/exceptions.c' line='2235' column='1'/>
+      <parameter type-id='type-id-31' name='length' filepath='Objects/exceptions.c' line='2235' column='1'/>
+      <parameter type-id='type-id-31' name='start' filepath='Objects/exceptions.c' line='2236' column='1'/>
+      <parameter type-id='type-id-31' name='end' filepath='Objects/exceptions.c' line='2236' column='1'/>
+      <parameter type-id='type-id-3' name='reason' filepath='Objects/exceptions.c' line='2236' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicodeEncodeError_Create' mangled-name='PyUnicodeEncodeError_Create' filepath='Objects/exceptions.c' line='2118' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicodeEncodeError_Create'>
+      <parameter type-id='type-id-3' name='encoding' filepath='Objects/exceptions.c' line='2119' column='1'/>
+      <parameter type-id='type-id-438' name='object' filepath='Objects/exceptions.c' line='2119' column='1'/>
+      <parameter type-id='type-id-31' name='length' filepath='Objects/exceptions.c' line='2119' column='1'/>
+      <parameter type-id='type-id-31' name='start' filepath='Objects/exceptions.c' line='2120' column='1'/>
+      <parameter type-id='type-id-31' name='end' filepath='Objects/exceptions.c' line='2120' column='1'/>
+      <parameter type-id='type-id-3' name='reason' filepath='Objects/exceptions.c' line='2120' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicodeTranslateError_GetEnd' mangled-name='PyUnicodeTranslateError_GetEnd' filepath='Objects/exceptions.c' line='1905' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicodeTranslateError_GetEnd'>
+      <parameter type-id='type-id-16' name='exc' filepath='Objects/exceptions.c' line='1905' column='1'/>
+      <parameter type-id='type-id-125' name='end' filepath='Objects/exceptions.c' line='1905' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyUnicodeDecodeError_GetEnd' mangled-name='PyUnicodeDecodeError_GetEnd' filepath='Objects/exceptions.c' line='1887' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicodeDecodeError_GetEnd'>
+      <parameter type-id='type-id-16' name='exc' filepath='Objects/exceptions.c' line='1887' column='1'/>
+      <parameter type-id='type-id-125' name='end' filepath='Objects/exceptions.c' line='1887' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyUnicodeEncodeError_GetEnd' mangled-name='PyUnicodeEncodeError_GetEnd' filepath='Objects/exceptions.c' line='1868' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicodeEncodeError_GetEnd'>
+      <parameter type-id='type-id-16' name='exc' filepath='Objects/exceptions.c' line='1887' column='1'/>
+      <parameter type-id='type-id-125' name='end' filepath='Objects/exceptions.c' line='1887' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyUnicodeTranslateError_GetStart' mangled-name='PyUnicodeTranslateError_GetStart' filepath='Objects/exceptions.c' line='1837' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicodeTranslateError_GetStart'>
+      <parameter type-id='type-id-16' name='exc' filepath='Objects/exceptions.c' line='1905' column='1'/>
+      <parameter type-id='type-id-125' name='end' filepath='Objects/exceptions.c' line='1905' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyUnicodeDecodeError_GetStart' mangled-name='PyUnicodeDecodeError_GetStart' filepath='Objects/exceptions.c' line='1819' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicodeDecodeError_GetStart'>
+      <parameter type-id='type-id-16' name='exc' filepath='Objects/exceptions.c' line='1887' column='1'/>
+      <parameter type-id='type-id-125' name='end' filepath='Objects/exceptions.c' line='1887' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyUnicodeEncodeError_GetStart' mangled-name='PyUnicodeEncodeError_GetStart' filepath='Objects/exceptions.c' line='1800' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicodeEncodeError_GetStart'>
+      <parameter type-id='type-id-16' name='exc' filepath='Objects/exceptions.c' line='1887' column='1'/>
+      <parameter type-id='type-id-125' name='end' filepath='Objects/exceptions.c' line='1887' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyUnicodeDecodeError_GetObject' mangled-name='PyUnicodeDecodeError_GetObject' filepath='Objects/exceptions.c' line='1788' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicodeDecodeError_GetObject'>
+      <parameter type-id='type-id-16' name='im' filepath='Objects/classobject.c' line='390' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyExceptionClass_Name' mangled-name='PyExceptionClass_Name' filepath='Objects/exceptions.c' line='368' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyExceptionClass_Name'>
+      <parameter type-id='type-id-16' name='ob' filepath='Objects/exceptions.c' line='368' column='1'/>
+      <return type-id='type-id-3'/>
+    </function-decl>
+    <function-decl name='PyException_SetContext' mangled-name='PyException_SetContext' filepath='Objects/exceptions.c' line='362' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyException_SetContext'>
+      <parameter type-id='type-id-16' name='self' filepath='Objects/exceptions.c' line='362' column='1'/>
+      <parameter type-id='type-id-16' name='context' filepath='Objects/exceptions.c' line='362' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyException_GetContext' mangled-name='PyException_GetContext' filepath='Objects/exceptions.c' line='353' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyException_GetContext'>
+      <parameter type-id='type-id-16' name='self' filepath='Objects/exceptions.c' line='353' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyException_SetCause' mangled-name='PyException_SetCause' filepath='Objects/exceptions.c' line='345' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyException_SetCause'>
+      <parameter type-id='type-id-16' name='self' filepath='Objects/exceptions.c' line='345' column='1'/>
+      <parameter type-id='type-id-16' name='cause' filepath='Objects/exceptions.c' line='345' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyException_GetCause' mangled-name='PyException_GetCause' filepath='Objects/exceptions.c' line='336' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyException_GetCause'>
+      <parameter type-id='type-id-16' name='self' filepath='Objects/exceptions.c' line='353' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyException_SetTraceback' mangled-name='PyException_SetTraceback' filepath='Objects/exceptions.c' line='330' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyException_SetTraceback'>
+      <parameter type-id='type-id-16' name='self' filepath='Objects/exceptions.c' line='330' column='1'/>
+      <parameter type-id='type-id-16' name='tb' filepath='Objects/exceptions.c' line='330' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyException_GetTraceback' mangled-name='PyException_GetTraceback' filepath='Objects/exceptions.c' line='321' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyException_GetTraceback'>
+      <parameter type-id='type-id-16' name='self' filepath='Objects/exceptions.c' line='353' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicodeEncodeError_GetEncoding' mangled-name='PyUnicodeEncodeError_GetEncoding' filepath='Objects/exceptions.c' line='1770' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicodeEncodeError_GetEncoding'>
+      <parameter type-id='type-id-16' name='im' filepath='Objects/classobject.c' line='390' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicodeEncodeError_GetObject' mangled-name='PyUnicodeEncodeError_GetObject' filepath='Objects/exceptions.c' line='1782' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicodeEncodeError_GetObject'>
+      <parameter type-id='type-id-16' name='im' filepath='Objects/classobject.c' line='390' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicodeEncodeError_SetStart' mangled-name='PyUnicodeEncodeError_SetStart' filepath='Objects/exceptions.c' line='1844' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicodeEncodeError_SetStart'>
+      <parameter type-id='type-id-16' name='exc' filepath='Objects/exceptions.c' line='1844' column='1'/>
+      <parameter type-id='type-id-31' name='start' filepath='Objects/exceptions.c' line='1844' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyUnicodeEncodeError_SetEnd' mangled-name='PyUnicodeEncodeError_SetEnd' filepath='Objects/exceptions.c' line='1912' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicodeEncodeError_SetEnd'>
+      <parameter type-id='type-id-16' name='exc' filepath='Objects/exceptions.c' line='1844' column='1'/>
+      <parameter type-id='type-id-31' name='start' filepath='Objects/exceptions.c' line='1844' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyUnicodeEncodeError_GetReason' mangled-name='PyUnicodeEncodeError_GetReason' filepath='Objects/exceptions.c' line='1935' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicodeEncodeError_GetReason'>
+      <parameter type-id='type-id-16' name='im' filepath='Objects/classobject.c' line='390' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicodeEncodeError_SetReason' mangled-name='PyUnicodeEncodeError_SetReason' filepath='Objects/exceptions.c' line='1956' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicodeEncodeError_SetReason'>
+      <parameter type-id='type-id-16' name='exc' filepath='Objects/exceptions.c' line='1956' column='1'/>
+      <parameter type-id='type-id-3' name='reason' filepath='Objects/exceptions.c' line='1956' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyErr_NormalizeException' mangled-name='PyErr_NormalizeException' filepath='./Include/pyerrors.h' line='36' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObject_GetDictPtr' mangled-name='_PyObject_GetDictPtr' filepath='./Include/cpython/object.h' line='332' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyModule_GetDict' mangled-name='PyModule_GetDict' filepath='./Include/moduleobject.h' line='23' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyDict_SetItemString' mangled-name='PyDict_SetItemString' filepath='./Include/dictobject.h' line='58' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyDict_New' mangled-name='PyDict_New' filepath='./Include/dictobject.h' line='21' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObject_CallFunction_SizeT' mangled-name='_PyObject_CallFunction_SizeT' filepath='./Include/abstract.h' line='198' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_ReadChar' mangled-name='PyUnicode_ReadChar' filepath='./Include/unicodeobject.h' line='184' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_Repr' mangled-name='PyObject_Repr' filepath='./Include/object.h' line='265' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyArg_ParseTupleAndKeywords_SizeT' mangled-name='_PyArg_ParseTupleAndKeywords_SizeT' filepath='./Include/modsupport.h' line='41' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyDict_GetItemWithError' mangled-name='PyDict_GetItemWithError' filepath='./Include/dictobject.h' line='23' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyDict_Copy' mangled-name='PyDict_Copy' filepath='./Include/dictobject.h' line='33' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyDict_SetItemId' mangled-name='_PyDict_SetItemId' filepath='./Include/cpython/dictobject.h' line='67' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_SetAttr' mangled-name='PyObject_SetAttr' filepath='./Include/object.h' line='275' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/genericaliasobject.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='Py_GenericAliasType' type-id='type-id-149' mangled-name='Py_GenericAliasType' visibility='default' filepath='./Include/genericaliasobject.h' line='9' column='1' elf-symbol-id='Py_GenericAliasType'/>
+    <function-decl name='Py_GenericAlias' mangled-name='Py_GenericAlias' filepath='Objects/genericaliasobject.c' line='660' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_GenericAlias'>
+      <parameter type-id='type-id-16' name='origin' filepath='Objects/genericaliasobject.c' line='660' column='1'/>
+      <parameter type-id='type-id-16' name='args' filepath='Objects/genericaliasobject.c' line='660' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyObject_Dir' mangled-name='PyObject_Dir' filepath='./Include/object.h' line='295' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_EqualToASCIIString' mangled-name='_PyUnicode_EqualToASCIIString' filepath='./Include/cpython/unicodeobject.h' line='1018' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_SetAttrString' mangled-name='PyObject_SetAttrString' filepath='./Include/object.h' line='272' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicodeWriter_WriteASCIIString' mangled-name='_PyUnicodeWriter_WriteASCIIString' filepath='./Include/cpython/unicodeobject.h' line='694' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicodeWriter_WriteStr' mangled-name='_PyUnicodeWriter_WriteStr' filepath='./Include/cpython/unicodeobject.h' line='678' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_GenericGetAttr' mangled-name='PyObject_GenericGetAttr' filepath='./Include/object.h' line='278' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/genobject.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PyGen_Type' type-id='type-id-149' mangled-name='PyGen_Type' visibility='default' filepath='./Include/genobject.h' line='35' column='1' elf-symbol-id='PyGen_Type'/>
+    <var-decl name='PyCoro_Type' type-id='type-id-149' mangled-name='PyCoro_Type' visibility='default' filepath='./Include/genobject.h' line='54' column='1' elf-symbol-id='PyCoro_Type'/>
+    <var-decl name='_PyCoroWrapper_Type' type-id='type-id-149' mangled-name='_PyCoroWrapper_Type' visibility='default' filepath='./Include/genobject.h' line='55' column='1' elf-symbol-id='_PyCoroWrapper_Type'/>
+    <var-decl name='PyAsyncGen_Type' type-id='type-id-149' mangled-name='PyAsyncGen_Type' visibility='default' filepath='./Include/genobject.h' line='80' column='1' elf-symbol-id='PyAsyncGen_Type'/>
+    <var-decl name='_PyAsyncGenASend_Type' type-id='type-id-149' mangled-name='_PyAsyncGenASend_Type' visibility='default' filepath='./Include/genobject.h' line='81' column='1' elf-symbol-id='_PyAsyncGenASend_Type'/>
+    <var-decl name='_PyAsyncGenWrappedValue_Type' type-id='type-id-149' mangled-name='_PyAsyncGenWrappedValue_Type' visibility='default' filepath='./Include/genobject.h' line='82' column='1' elf-symbol-id='_PyAsyncGenWrappedValue_Type'/>
+    <var-decl name='_PyAsyncGenAThrow_Type' type-id='type-id-149' mangled-name='_PyAsyncGenAThrow_Type' visibility='default' filepath='./Include/genobject.h' line='83' column='1' elf-symbol-id='_PyAsyncGenAThrow_Type'/>
+    <function-decl name='PyAsyncGen_New' mangled-name='PyAsyncGen_New' filepath='Objects/genobject.c' line='1470' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyAsyncGen_New'>
+      <parameter type-id='type-id-223' name='f' filepath='Objects/genobject.c' line='1470' column='1'/>
+      <parameter type-id='type-id-16' name='name' filepath='Objects/genobject.c' line='1470' column='1'/>
+      <parameter type-id='type-id-16' name='qualname' filepath='Objects/genobject.c' line='1470' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyCoro_New' mangled-name='PyCoro_New' filepath='Objects/genobject.c' line='1198' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCoro_New'>
+      <parameter type-id='type-id-223' name='f' filepath='Objects/genobject.c' line='1198' column='1'/>
+      <parameter type-id='type-id-16' name='name' filepath='Objects/genobject.c' line='1198' column='1'/>
+      <parameter type-id='type-id-16' name='qualname' filepath='Objects/genobject.c' line='1198' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyGen_New' mangled-name='PyGen_New' filepath='Objects/genobject.c' line='869' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyGen_New'>
+      <parameter type-id='type-id-223' name='f' filepath='Objects/genobject.c' line='869' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyGen_NewWithQualName' mangled-name='PyGen_NewWithQualName' filepath='Objects/genobject.c' line='863' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyGen_NewWithQualName'>
+      <parameter type-id='type-id-223' name='f' filepath='Objects/genobject.c' line='863' column='1'/>
+      <parameter type-id='type-id-16' name='name' filepath='Objects/genobject.c' line='863' column='1'/>
+      <parameter type-id='type-id-16' name='qualname' filepath='Objects/genobject.c' line='863' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyGen_FetchStopIterationValue' mangled-name='_PyGen_FetchStopIterationValue' filepath='Objects/genobject.c' line='627' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyGen_FetchStopIterationValue'>
+      <parameter type-id='type-id-86' name='pvalue' filepath='Objects/genobject.c' line='627' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyGen_Finalize' mangled-name='_PyGen_Finalize' filepath='Objects/genobject.c' line='44' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyGen_Finalize'>
+      <parameter type-id='type-id-16' name='self' filepath='Objects/genobject.c' line='44' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyGen_SetStopIterationValue' mangled-name='_PyGen_SetStopIterationValue' filepath='Objects/genobject.c' line='588' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyGen_SetStopIterationValue'>
+      <parameter type-id='type-id-16' name='value' filepath='Objects/genobject.c' line='588' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyErr_FormatFromCause' mangled-name='_PyErr_FormatFromCause' filepath='./Include/cpython/pyerrors.h' line='105' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyFrame_GetLineNumber' mangled-name='PyFrame_GetLineNumber' filepath='./Include/pyframe.h' line='15' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyEval_GetFrame' mangled-name='PyEval_GetFrame' filepath='./Include/ceval.h' line='34' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyIter_Check' mangled-name='PyIter_Check' filepath='./Include/abstract.h' line='382' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyException_GetTraceback' mangled-name='PyException_GetTraceback' filepath='./Include/pyerrors.h' line='40' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_WriteUnraisable' mangled-name='PyErr_WriteUnraisable' filepath='./Include/pyerrors.h' line='222' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_WarnUnawaitedCoroutine' mangled-name='_PyErr_WarnUnawaitedCoroutine' filepath='./Include/warnings.h' line='60' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_ChainStackItem' mangled-name='_PyErr_ChainStackItem' filepath='./Include/internal/pycore_pyerrors.h' line='53' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_CallFinalizerFromDealloc' mangled-name='PyObject_CallFinalizerFromDealloc' filepath='./Include/cpython/object.h' line='335' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/fileobject.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PyStdPrinter_Type' type-id='type-id-149' mangled-name='PyStdPrinter_Type' visibility='default' filepath='./Include/cpython/fileobject.h' line='10' column='1' elf-symbol-id='PyStdPrinter_Type'/>
+    <function-decl name='PyFile_OpenCode' mangled-name='PyFile_OpenCode' filepath='Objects/fileobject.c' line='562' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFile_OpenCode'>
+      <parameter type-id='type-id-3' name='utf8path' filepath='Objects/fileobject.c' line='562' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyFile_SetOpenCodeHook' mangled-name='PyFile_SetOpenCodeHook' filepath='Objects/fileobject.c' line='516' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFile_SetOpenCodeHook'>
+      <parameter type-id='type-id-258' name='hook' filepath='Objects/fileobject.c' line='516' column='1'/>
+      <parameter type-id='type-id-21' name='userData' filepath='Objects/fileobject.c' line='516' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyFile_NewStdPrinter' mangled-name='PyFile_NewStdPrinter' filepath='Objects/fileobject.c' line='329' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFile_NewStdPrinter'>
+      <parameter type-id='type-id-9' name='fd' filepath='Objects/fileobject.c' line='329' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='Py_UniversalNewlineFgets' mangled-name='Py_UniversalNewlineFgets' filepath='Objects/fileobject.c' line='252' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_UniversalNewlineFgets'>
+      <parameter type-id='type-id-72' name='buf' filepath='Objects/fileobject.c' line='252' column='1'/>
+      <parameter type-id='type-id-9' name='n' filepath='Objects/fileobject.c' line='252' column='1'/>
+      <parameter type-id='type-id-188' name='stream' filepath='Objects/fileobject.c' line='252' column='1'/>
+      <parameter type-id='type-id-16' name='fobj' filepath='Objects/fileobject.c' line='252' column='1'/>
+      <return type-id='type-id-72'/>
+    </function-decl>
+    <function-decl name='_PyLong_FileDescriptor_Converter' mangled-name='_PyLong_FileDescriptor_Converter' filepath='Objects/fileobject.c' line='227' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyLong_FileDescriptor_Converter'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/fileobject.c' line='227' column='1'/>
+      <parameter type-id='type-id-21' name='ptr' filepath='Objects/fileobject.c' line='227' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyObject_AsFileDescriptor' mangled-name='PyObject_AsFileDescriptor' filepath='Objects/fileobject.c' line='180' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_AsFileDescriptor'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/fileobject.c' line='180' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyFile_WriteString' mangled-name='PyFile_WriteString' filepath='Objects/fileobject.c' line='150' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFile_WriteString'>
+      <parameter type-id='type-id-3' name='s' filepath='Objects/fileobject.c' line='150' column='1'/>
+      <parameter type-id='type-id-16' name='f' filepath='Objects/fileobject.c' line='150' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyFile_WriteObject' mangled-name='PyFile_WriteObject' filepath='Objects/fileobject.c' line='119' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFile_WriteObject'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/fileobject.c' line='119' column='1'/>
+      <parameter type-id='type-id-16' name='f' filepath='Objects/fileobject.c' line='119' column='1'/>
+      <parameter type-id='type-id-9' name='flags' filepath='Objects/fileobject.c' line='119' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyFile_GetLine' mangled-name='PyFile_GetLine' filepath='Objects/fileobject.c' line='54' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFile_GetLine'>
+      <parameter type-id='type-id-16' name='f' filepath='Objects/fileobject.c' line='54' column='1'/>
+      <parameter type-id='type-id-9' name='n' filepath='Objects/fileobject.c' line='54' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyFile_FromFd' mangled-name='PyFile_FromFd' filepath='Objects/fileobject.c' line='33' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFile_FromFd'>
+      <parameter type-id='type-id-9' name='fd' filepath='Objects/fileobject.c' line='33' column='1'/>
+      <parameter type-id='type-id-3' name='name' filepath='Objects/fileobject.c' line='33' column='1'/>
+      <parameter type-id='type-id-3' name='mode' filepath='Objects/fileobject.c' line='33' column='1'/>
+      <parameter type-id='type-id-9' name='buffering' filepath='Objects/fileobject.c' line='33' column='1'/>
+      <parameter type-id='type-id-3' name='encoding' filepath='Objects/fileobject.c' line='33' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/fileobject.c' line='34' column='1'/>
+      <parameter type-id='type-id-3' name='newline' filepath='Objects/fileobject.c' line='34' column='1'/>
+      <parameter type-id='type-id-9' name='closefd' filepath='Objects/fileobject.c' line='34' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyFile_OpenCodeObject' mangled-name='PyFile_OpenCodeObject' filepath='Objects/fileobject.c' line='536' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFile_OpenCodeObject'>
+      <parameter type-id='type-id-16' name='path' filepath='Objects/fileobject.c' line='536' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='Py_IsInitialized' mangled-name='Py_IsInitialized' filepath='./Include/pylifecycle.h' line='18' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__uflow' mangled-name='__uflow' filepath='/usr/include/stdio.h' line='858' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='flockfile' mangled-name='flockfile' filepath='/usr/include/stdio.h' line='840' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='funlockfile' mangled-name='funlockfile' filepath='/usr/include/stdio.h' line='847' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_write' mangled-name='_Py_write' filepath='./Include/cpython/fileutils.h' line='110' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_AsUTF8String' mangled-name='_PyUnicode_AsUTF8String' filepath='./Include/cpython/unicodeobject.h' line='776' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/floatobject.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PyFloat_Type' type-id='type-id-149' mangled-name='PyFloat_Type' visibility='default' filepath='./Include/floatobject.h' line='21' column='1' elf-symbol-id='PyFloat_Type'/>
+    <qualified-type-def type-id='type-id-341' const='yes' id='type-id-439'/>
+    <pointer-type-def type-id='type-id-439' size-in-bits='64' id='type-id-440'/>
+    <function-decl name='_PyFloat_Unpack8' mangled-name='_PyFloat_Unpack8' filepath='Objects/floatobject.c' line='2568' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyFloat_Unpack8'>
+      <parameter type-id='type-id-440' name='p' filepath='Objects/floatobject.c' line='2568' column='1'/>
+      <parameter type-id='type-id-9' name='le' filepath='Objects/floatobject.c' line='2568' column='1'/>
+      <return type-id='type-id-371'/>
+    </function-decl>
+    <function-decl name='_PyFloat_Unpack4' mangled-name='_PyFloat_Unpack4' filepath='Objects/floatobject.c' line='2490' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyFloat_Unpack4'>
+      <parameter type-id='type-id-440' name='p' filepath='Objects/floatobject.c' line='2568' column='1'/>
+      <parameter type-id='type-id-9' name='le' filepath='Objects/floatobject.c' line='2568' column='1'/>
+      <return type-id='type-id-371'/>
+    </function-decl>
+    <function-decl name='_PyFloat_Unpack2' mangled-name='_PyFloat_Unpack2' filepath='Objects/floatobject.c' line='2420' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyFloat_Unpack2'>
+      <parameter type-id='type-id-440' name='p' filepath='Objects/floatobject.c' line='2420' column='1'/>
+      <parameter type-id='type-id-9' name='le' filepath='Objects/floatobject.c' line='2420' column='1'/>
+      <return type-id='type-id-371'/>
+    </function-decl>
+    <function-decl name='_PyFloat_Pack8' mangled-name='_PyFloat_Pack8' filepath='Objects/floatobject.c' line='2291' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyFloat_Pack8'>
+      <parameter type-id='type-id-371' name='x' filepath='Objects/floatobject.c' line='2291' column='1'/>
+      <parameter type-id='type-id-339' name='p' filepath='Objects/floatobject.c' line='2291' column='1'/>
+      <parameter type-id='type-id-9' name='le' filepath='Objects/floatobject.c' line='2291' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyFloat_Pack4' mangled-name='_PyFloat_Pack4' filepath='Objects/floatobject.c' line='2184' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyFloat_Pack4'>
+      <parameter type-id='type-id-371' name='x' filepath='Objects/floatobject.c' line='2184' column='1'/>
+      <parameter type-id='type-id-339' name='p' filepath='Objects/floatobject.c' line='2184' column='1'/>
+      <parameter type-id='type-id-9' name='le' filepath='Objects/floatobject.c' line='2184' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyFloat_Pack2' mangled-name='_PyFloat_Pack2' filepath='Objects/floatobject.c' line='2080' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyFloat_Pack2'>
+      <parameter type-id='type-id-371' name='x' filepath='Objects/floatobject.c' line='2080' column='1'/>
+      <parameter type-id='type-id-339' name='p' filepath='Objects/floatobject.c' line='2080' column='1'/>
+      <parameter type-id='type-id-9' name='le' filepath='Objects/floatobject.c' line='2080' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyFloat_DebugMallocStats' mangled-name='_PyFloat_DebugMallocStats' filepath='Objects/floatobject.c' line='2059' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyFloat_DebugMallocStats'>
+      <parameter type-id='type-id-188' name='out' filepath='Objects/floatobject.c' line='2059' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyFloat_FromString' mangled-name='PyFloat_FromString' filepath='Objects/floatobject.c' line='181' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFloat_FromString'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/floatobject.c' line='181' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyFloat_FromDouble' mangled-name='PyFloat_FromDouble' filepath='Objects/floatobject.c' line='124' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFloat_FromDouble'>
+      <parameter type-id='type-id-371' name='fval' filepath='Objects/floatobject.c' line='124' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyFloat_GetInfo' mangled-name='PyFloat_GetInfo' filepath='Objects/floatobject.c' line='87' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFloat_GetInfo'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyFloat_GetMin' mangled-name='PyFloat_GetMin' filepath='Objects/floatobject.c' line='43' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFloat_GetMin'>
+      <return type-id='type-id-371'/>
+    </function-decl>
+    <function-decl name='PyFloat_GetMax' mangled-name='PyFloat_GetMax' filepath='Objects/floatobject.c' line='37' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFloat_GetMax'>
+      <return type-id='type-id-371'/>
+    </function-decl>
+    <function-decl name='PyFloat_AsDouble' mangled-name='PyFloat_AsDouble' filepath='Objects/floatobject.c' line='253' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFloat_AsDouble'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/floatobject.c' line='253' column='1'/>
+      <return type-id='type-id-371'/>
+    </function-decl>
+    <function-decl name='ldexp' mangled-name='ldexp' filepath='/usr/include/x86_64-linux-gnu/bits/mathcalls.h' line='101' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_dg_infinity' mangled-name='_Py_dg_infinity' filepath='./Include/internal/pycore_dtoa.h' line='18' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_dg_stdnan' mangled-name='_Py_dg_stdnan' filepath='./Include/internal/pycore_dtoa.h' line='17' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='frexp' mangled-name='frexp' filepath='/usr/include/x86_64-linux-gnu/bits/mathcalls.h' line='98' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyDebugAllocatorStats' mangled-name='_PyDebugAllocatorStats' filepath='./Include/cpython/object.h' line='390' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyStructSequence_InitType2' mangled-name='PyStructSequence_InitType2' filepath='./Include/structseq.h' line='27' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_parse_inf_or_nan' mangled-name='_Py_parse_inf_or_nan' filepath='./Include/pystrtod.h' line='26' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='strtol' mangled-name='strtol' filepath='/usr/include/stdlib.h' line='176' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='fmod' mangled-name='fmod' filepath='/usr/include/x86_64-linux-gnu/bits/mathcalls.h' line='168' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_SetFromErrno' mangled-name='PyErr_SetFromErrno' filepath='./Include/pyerrors.h' line='157' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyLong_Lshift' mangled-name='_PyLong_Lshift' filepath='./Include/longobject.h' line='214' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='modf' mangled-name='modf' filepath='/usr/include/x86_64-linux-gnu/bits/mathcalls.h' line='110' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyLong_FromDouble' mangled-name='PyLong_FromDouble' filepath='./Include/longobject.h' line='22' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_Negative' mangled-name='PyNumber_Negative' filepath='./Include/abstract.h' line='473' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyLong_NumBits' mangled-name='_PyLong_NumBits' filepath='./Include/longobject.h' line='124' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyStructSequence_New' mangled-name='PyStructSequence_New' filepath='./Include/structseq.h' line='32' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_FromASCII' mangled-name='_PyUnicode_FromASCII' filepath='./Include/cpython/unicodeobject.h' line='565' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_get_387controlword' mangled-name='_Py_get_387controlword' filepath='./Include/pymath.h' line='83' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_set_387controlword' mangled-name='_Py_set_387controlword' filepath='./Include/pymath.h' line='84' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_dg_dtoa' mangled-name='_Py_dg_dtoa' filepath='./Include/internal/pycore_dtoa.h' line='14' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_dg_strtod' mangled-name='_Py_dg_strtod' filepath='./Include/internal/pycore_dtoa.h' line='13' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_dg_freedtoa' mangled-name='_Py_dg_freedtoa' filepath='./Include/internal/pycore_dtoa.h' line='16' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='round' mangled-name='round' filepath='/usr/include/x86_64-linux-gnu/bits/mathcalls.h' line='298' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyFloat_FormatAdvancedWriter' mangled-name='_PyFloat_FormatAdvancedWriter' filepath='./Include/floatobject.h' line='107' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/frameobject.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PyFrame_Type' type-id='type-id-149' mangled-name='PyFrame_Type' visibility='default' filepath='./Include/cpython/frameobject.h' line='66' column='1' elf-symbol-id='PyFrame_Type'/>
+    <function-decl name='PyFrame_GetBack' mangled-name='PyFrame_GetBack' filepath='Objects/frameobject.c' line='1172' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFrame_GetBack'>
+      <parameter type-id='type-id-223' name='frame' filepath='Objects/frameobject.c' line='1172' column='1'/>
+      <return type-id='type-id-223'/>
+    </function-decl>
+    <function-decl name='PyFrame_GetCode' mangled-name='PyFrame_GetCode' filepath='Objects/frameobject.c' line='1161' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFrame_GetCode'>
+      <parameter type-id='type-id-223' name='frame' filepath='Objects/frameobject.c' line='1161' column='1'/>
+      <return type-id='type-id-334'/>
+    </function-decl>
+    <function-decl name='_PyFrame_DebugMallocStats' mangled-name='_PyFrame_DebugMallocStats' filepath='Objects/frameobject.c' line='1151' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyFrame_DebugMallocStats'>
+      <parameter type-id='type-id-188' name='out' filepath='Objects/floatobject.c' line='2059' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyFrame_LocalsToFast' mangled-name='PyFrame_LocalsToFast' filepath='Objects/frameobject.c' line='1085' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFrame_LocalsToFast'>
+      <parameter type-id='type-id-223' name='f' filepath='Objects/frameobject.c' line='1085' column='1'/>
+      <parameter type-id='type-id-9' name='clear' filepath='Objects/frameobject.c' line='1085' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyFrame_FastToLocals' mangled-name='PyFrame_FastToLocals' filepath='Objects/frameobject.c' line='1073' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFrame_FastToLocals'>
+      <parameter type-id='type-id-223' name='f' filepath='Objects/frameobject.c' line='1073' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyFrame_FastToLocalsWithError' mangled-name='PyFrame_FastToLocalsWithError' filepath='Objects/frameobject.c' line='1013' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFrame_FastToLocalsWithError'>
+      <parameter type-id='type-id-223' name='f' filepath='Objects/frameobject.c' line='1013' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <pointer-type-def type-id='type-id-345' size-in-bits='64' id='type-id-441'/>
+    <function-decl name='PyFrame_BlockPop' mangled-name='PyFrame_BlockPop' filepath='Objects/frameobject.c' line='904' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFrame_BlockPop'>
+      <parameter type-id='type-id-223' name='f' filepath='Objects/frameobject.c' line='904' column='1'/>
+      <return type-id='type-id-441'/>
+    </function-decl>
+    <function-decl name='PyFrame_BlockSetup' mangled-name='PyFrame_BlockSetup' filepath='Objects/frameobject.c' line='891' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFrame_BlockSetup'>
+      <parameter type-id='type-id-223' name='f' filepath='Objects/frameobject.c' line='891' column='1'/>
+      <parameter type-id='type-id-9' name='type' filepath='Objects/frameobject.c' line='891' column='1'/>
+      <parameter type-id='type-id-9' name='handler' filepath='Objects/frameobject.c' line='891' column='1'/>
+      <parameter type-id='type-id-9' name='level' filepath='Objects/frameobject.c' line='891' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyFrame_New' mangled-name='PyFrame_New' filepath='Objects/frameobject.c' line='863' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFrame_New'>
+      <parameter type-id='type-id-331' name='tstate' filepath='Objects/frameobject.c' line='863' column='1'/>
+      <parameter type-id='type-id-334' name='code' filepath='Objects/frameobject.c' line='863' column='1'/>
+      <parameter type-id='type-id-16' name='globals' filepath='Objects/frameobject.c' line='864' column='1'/>
+      <parameter type-id='type-id-16' name='locals' filepath='Objects/frameobject.c' line='864' column='1'/>
+      <return type-id='type-id-223'/>
+    </function-decl>
+    <function-decl name='PyFrame_GetLineNumber' mangled-name='PyFrame_GetLineNumber' filepath='Objects/frameobject.c' line='42' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFrame_GetLineNumber'>
+      <parameter type-id='type-id-223' name='f' filepath='Objects/frameobject.c' line='42' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyCell_Set' mangled-name='PyCell_Set' filepath='./Include/cellobject.h' line='20' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_DelItem' mangled-name='PyObject_DelItem' filepath='./Include/abstract.h' line='309' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_SetItem' mangled-name='PyObject_SetItem' filepath='./Include/abstract.h' line='297' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyEval_GetBuiltins' mangled-name='_PyEval_GetBuiltins' filepath='./Include/internal/pycore_ceval.h' line='37' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyDict_GetItemIdWithError' mangled-name='_PyDict_GetItemIdWithError' filepath='./Include/cpython/dictobject.h' line='32' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObject_GC_Resize' mangled-name='_PyObject_GC_Resize' filepath='./Include/objimpl.h' line='163' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObject_GC_NewVar' mangled-name='_PyObject_GC_NewVar' filepath='./Include/objimpl.h' line='170' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyCode_InitAddressRange' mangled-name='_PyCode_InitAddressRange' filepath='./Include/cpython/code.h' line='175' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyLineTable_NextAddressRange' mangled-name='PyLineTable_NextAddressRange' filepath='./Include/cpython/code.h' line='181' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyGen_Finalize' mangled-name='_PyGen_Finalize' filepath='./Include/genobject.h' line='46' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyCode_Addr2Line' mangled-name='PyCode_Addr2Line' filepath='./Include/cpython/code.h' line='135' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/funcobject.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PyFunction_Type' type-id='type-id-149' mangled-name='PyFunction_Type' visibility='default' filepath='./Include/funcobject.h' line='53' column='1' elf-symbol-id='PyFunction_Type'/>
+    <var-decl name='PyClassMethod_Type' type-id='type-id-149' mangled-name='PyClassMethod_Type' visibility='default' filepath='./Include/funcobject.h' line='100' column='1' elf-symbol-id='PyClassMethod_Type'/>
+    <var-decl name='PyStaticMethod_Type' type-id='type-id-149' mangled-name='PyStaticMethod_Type' visibility='default' filepath='./Include/funcobject.h' line='101' column='1' elf-symbol-id='PyStaticMethod_Type'/>
+    <function-decl name='PyStaticMethod_New' mangled-name='PyStaticMethod_New' filepath='Objects/funcobject.c' line='1145' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyStaticMethod_New'>
+      <parameter type-id='type-id-16' name='iter' filepath='Objects/abstract.c' line='2871' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyClassMethod_New' mangled-name='PyClassMethod_New' filepath='Objects/funcobject.c' line='949' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyClassMethod_New'>
+      <parameter type-id='type-id-16' name='iter' filepath='Objects/abstract.c' line='2871' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyFunction_SetAnnotations' mangled-name='PyFunction_SetAnnotations' filepath='Objects/funcobject.c' line='235' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFunction_SetAnnotations'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/funcobject.c' line='235' column='1'/>
+      <parameter type-id='type-id-16' name='annotations' filepath='Objects/funcobject.c' line='235' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyFunction_GetAnnotations' mangled-name='PyFunction_GetAnnotations' filepath='Objects/funcobject.c' line='225' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFunction_GetAnnotations'>
+      <parameter type-id='type-id-16' name='im' filepath='Objects/classobject.c' line='25' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyFunction_SetClosure' mangled-name='PyFunction_SetClosure' filepath='Objects/funcobject.c' line='203' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFunction_SetClosure'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/funcobject.c' line='235' column='1'/>
+      <parameter type-id='type-id-16' name='annotations' filepath='Objects/funcobject.c' line='235' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyFunction_GetClosure' mangled-name='PyFunction_GetClosure' filepath='Objects/funcobject.c' line='193' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFunction_GetClosure'>
+      <parameter type-id='type-id-16' name='im' filepath='Objects/classobject.c' line='25' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyFunction_SetKwDefaults' mangled-name='PyFunction_SetKwDefaults' filepath='Objects/funcobject.c' line='172' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFunction_SetKwDefaults'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/funcobject.c' line='235' column='1'/>
+      <parameter type-id='type-id-16' name='annotations' filepath='Objects/funcobject.c' line='235' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyFunction_GetKwDefaults' mangled-name='PyFunction_GetKwDefaults' filepath='Objects/funcobject.c' line='162' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFunction_GetKwDefaults'>
+      <parameter type-id='type-id-16' name='im' filepath='Objects/classobject.c' line='25' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyFunction_SetDefaults' mangled-name='PyFunction_SetDefaults' filepath='Objects/funcobject.c' line='142' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFunction_SetDefaults'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/funcobject.c' line='235' column='1'/>
+      <parameter type-id='type-id-16' name='annotations' filepath='Objects/funcobject.c' line='235' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyFunction_GetDefaults' mangled-name='PyFunction_GetDefaults' filepath='Objects/funcobject.c' line='132' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFunction_GetDefaults'>
+      <parameter type-id='type-id-16' name='im' filepath='Objects/classobject.c' line='25' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyFunction_GetModule' mangled-name='PyFunction_GetModule' filepath='Objects/funcobject.c' line='122' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFunction_GetModule'>
+      <parameter type-id='type-id-16' name='im' filepath='Objects/classobject.c' line='25' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyFunction_GetGlobals' mangled-name='PyFunction_GetGlobals' filepath='Objects/funcobject.c' line='112' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFunction_GetGlobals'>
+      <parameter type-id='type-id-16' name='im' filepath='Objects/classobject.c' line='25' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyFunction_GetCode' mangled-name='PyFunction_GetCode' filepath='Objects/funcobject.c' line='102' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFunction_GetCode'>
+      <parameter type-id='type-id-16' name='im' filepath='Objects/classobject.c' line='25' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyFunction_New' mangled-name='PyFunction_New' filepath='Objects/funcobject.c' line='96' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFunction_New'>
+      <parameter type-id='type-id-16' name='code' filepath='Objects/funcobject.c' line='96' column='1'/>
+      <parameter type-id='type-id-16' name='globals' filepath='Objects/funcobject.c' line='96' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyFunction_NewWithQualName' mangled-name='PyFunction_NewWithQualName' filepath='Objects/funcobject.c' line='11' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFunction_NewWithQualName'>
+      <parameter type-id='type-id-16' name='code' filepath='Objects/funcobject.c' line='11' column='1'/>
+      <parameter type-id='type-id-16' name='globals' filepath='Objects/funcobject.c' line='11' column='1'/>
+      <parameter type-id='type-id-16' name='qualname' filepath='Objects/funcobject.c' line='11' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyMethod_New' mangled-name='PyMethod_New' filepath='./Include/classobject.h' line='24' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyTuple_Size' mangled-name='PyTuple_Size' filepath='./Include/tupleobject.h' line='31' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyEval_BuiltinsFromGlobals' mangled-name='_PyEval_BuiltinsFromGlobals' filepath='./Include/internal/pycore_ceval.h' line='38' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/interpreteridobject.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='_PyInterpreterID_Type' type-id='type-id-149' mangled-name='_PyInterpreterID_Type' visibility='default' filepath='./Include/cpython/interpreteridobject.h' line='7' column='1' elf-symbol-id='_PyInterpreterID_Type'/>
+    <class-decl name='_is' size-in-bits='908160' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_interp.h' line='220' column='1' id='type-id-442'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='next' type-id='type-id-225' visibility='default' filepath='./Include/internal/pycore_interp.h' line='222' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='tstate_head' type-id='type-id-11' visibility='default' filepath='./Include/internal/pycore_interp.h' line='223' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='runtime' type-id='type-id-443' visibility='default' filepath='./Include/internal/pycore_interp.h' line='228' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='id' type-id='type-id-227' visibility='default' filepath='./Include/internal/pycore_interp.h' line='230' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='id_refcount' type-id='type-id-227' visibility='default' filepath='./Include/internal/pycore_interp.h' line='231' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='requires_idref' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_interp.h' line='232' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='384'>
+        <var-decl name='id_mutex' type-id='type-id-228' visibility='default' filepath='./Include/internal/pycore_interp.h' line='233' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='448'>
+        <var-decl name='finalizing' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_interp.h' line='235' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='512'>
+        <var-decl name='ceval' type-id='type-id-229' visibility='default' filepath='./Include/internal/pycore_interp.h' line='237' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='4928'>
+        <var-decl name='gc' type-id='type-id-230' visibility='default' filepath='./Include/internal/pycore_interp.h' line='238' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='6848'>
+        <var-decl name='modules' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='241' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='6912'>
+        <var-decl name='modules_by_index' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='242' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='6976'>
+        <var-decl name='sysdict' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='244' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7040'>
+        <var-decl name='builtins' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='246' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7104'>
+        <var-decl name='importlib' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='248' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7168'>
+        <var-decl name='num_threads' type-id='type-id-33' visibility='default' filepath='./Include/internal/pycore_interp.h' line='251' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7232'>
+        <var-decl name='pythread_stacksize' type-id='type-id-157' visibility='default' filepath='./Include/internal/pycore_interp.h' line='256' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7296'>
+        <var-decl name='codec_search_path' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='258' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7360'>
+        <var-decl name='codec_search_cache' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='259' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7424'>
+        <var-decl name='codec_error_registry' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='260' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7488'>
+        <var-decl name='codecs_initialized' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_interp.h' line='261' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7552'>
+        <var-decl name='config' type-id='type-id-231' visibility='default' filepath='./Include/internal/pycore_interp.h' line='263' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10688'>
+        <var-decl name='dlopenflags' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_interp.h' line='265' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10752'>
+        <var-decl name='dict' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='268' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10816'>
+        <var-decl name='builtins_copy' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='270' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10880'>
+        <var-decl name='import_func' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='271' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10944'>
+        <var-decl name='eval_frame' type-id='type-id-232' visibility='default' filepath='./Include/internal/pycore_interp.h' line='273' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='11008'>
+        <var-decl name='co_extra_user_count' type-id='type-id-31' visibility='default' filepath='./Include/internal/pycore_interp.h' line='275' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='11072'>
+        <var-decl name='co_extra_freefuncs' type-id='type-id-233' visibility='default' filepath='./Include/internal/pycore_interp.h' line='276' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='27392'>
+        <var-decl name='before_forkers' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='279' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='27456'>
+        <var-decl name='after_forkers_parent' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='280' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='27520'>
+        <var-decl name='after_forkers_child' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='281' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='27584'>
+        <var-decl name='tstate_next_unique_id' type-id='type-id-22' visibility='default' filepath='./Include/internal/pycore_interp.h' line='284' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='27648'>
+        <var-decl name='warnings' type-id='type-id-234' visibility='default' filepath='./Include/internal/pycore_interp.h' line='286' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='27904'>
+        <var-decl name='atexit' type-id='type-id-235' visibility='default' filepath='./Include/internal/pycore_interp.h' line='287' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='28032'>
+        <var-decl name='audit_hooks' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='289' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='28096'>
+        <var-decl name='small_ints' type-id='type-id-236' visibility='default' filepath='./Include/internal/pycore_interp.h' line='296' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='44864'>
+        <var-decl name='bytes' type-id='type-id-237' visibility='default' filepath='./Include/internal/pycore_interp.h' line='297' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='61312'>
+        <var-decl name='unicode' type-id='type-id-238' visibility='default' filepath='./Include/internal/pycore_interp.h' line='298' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='78208'>
+        <var-decl name='float_state' type-id='type-id-239' visibility='default' filepath='./Include/internal/pycore_interp.h' line='299' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='78336'>
+        <var-decl name='slice_cache' type-id='type-id-240' visibility='default' filepath='./Include/internal/pycore_interp.h' line='302' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='78400'>
+        <var-decl name='tuple' type-id='type-id-241' visibility='default' filepath='./Include/internal/pycore_interp.h' line='304' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='80320'>
+        <var-decl name='list' type-id='type-id-242' visibility='default' filepath='./Include/internal/pycore_interp.h' line='305' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='85504'>
+        <var-decl name='dict_state' type-id='type-id-243' visibility='default' filepath='./Include/internal/pycore_interp.h' line='306' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='95872'>
+        <var-decl name='frame' type-id='type-id-444' visibility='default' filepath='./Include/internal/pycore_interp.h' line='307' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='96000'>
+        <var-decl name='async_gen' type-id='type-id-245' visibility='default' filepath='./Include/internal/pycore_interp.h' line='308' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='106368'>
+        <var-decl name='context' type-id='type-id-246' visibility='default' filepath='./Include/internal/pycore_interp.h' line='309' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='106496'>
+        <var-decl name='exc_state' type-id='type-id-247' visibility='default' filepath='./Include/internal/pycore_interp.h' line='310' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='106688'>
+        <var-decl name='ast' type-id='type-id-248' visibility='default' filepath='./Include/internal/pycore_interp.h' line='312' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='121728'>
+        <var-decl name='type_cache' type-id='type-id-249' visibility='default' filepath='./Include/internal/pycore_interp.h' line='313' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='pyruntimestate' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-445'/>
+    <pointer-type-def type-id='type-id-445' size-in-bits='64' id='type-id-443'/>
+    <class-decl name='_Py_frame_state' size-in-bits='128' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_interp.h' line='138' column='1' id='type-id-444'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='free_list' type-id='type-id-13' visibility='default' filepath='./Include/internal/pycore_interp.h' line='139' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='numfree' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_interp.h' line='141' column='1'/>
+      </data-member>
+    </class-decl>
+    <function-decl name='_PyInterpreterID_LookUp' mangled-name='_PyInterpreterID_LookUp' filepath='Objects/interpreteridobject.c' line='287' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyInterpreterID_LookUp'>
+      <parameter type-id='type-id-16' name='requested_id' filepath='Objects/interpreteridobject.c' line='287' column='1'/>
+      <return type-id='type-id-222'/>
+    </function-decl>
+    <function-decl name='_PyInterpreterState_GetIDObject' mangled-name='_PyInterpreterState_GetIDObject' filepath='Objects/interpreteridobject.c' line='274' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyInterpreterState_GetIDObject'>
+      <parameter type-id='type-id-222' name='interp' filepath='Objects/interpreteridobject.c' line='274' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyInterpreterID_New' mangled-name='_PyInterpreterID_New' filepath='Objects/interpreteridobject.c' line='268' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyInterpreterID_New'>
+      <parameter type-id='type-id-227' name='id' filepath='Objects/interpreteridobject.c' line='268' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyLong_AsLongLong' mangled-name='PyLong_AsLongLong' filepath='./Include/longobject.h' line='98' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyInterpreterState_LookUpID' mangled-name='_PyInterpreterState_LookUpID' filepath='./Include/internal/pycore_interp.h' line='334' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyInterpreterState_IDIncref' mangled-name='_PyInterpreterState_IDIncref' filepath='./Include/internal/pycore_interp.h' line='337' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyInterpreterState_IDDecref' mangled-name='_PyInterpreterState_IDDecref' filepath='./Include/internal/pycore_interp.h' line='338' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyInterpreterState_IDInitref' mangled-name='_PyInterpreterState_IDInitref' filepath='./Include/internal/pycore_interp.h' line='336' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyInterpreterState_GetID' mangled-name='PyInterpreterState_GetID' filepath='./Include/pystate.h' line='46' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyLong_FromLongLong' mangled-name='PyLong_FromLongLong' filepath='./Include/longobject.h' line='96' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyArg_ParseTupleAndKeywords' mangled-name='PyArg_ParseTupleAndKeywords' filepath='./Include/modsupport.h' line='41' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyLong_AsLongLongAndOverflow' mangled-name='PyLong_AsLongLongAndOverflow' filepath='./Include/longobject.h' line='101' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/iterobject.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PySeqIter_Type' type-id='type-id-149' mangled-name='PySeqIter_Type' visibility='default' filepath='./Include/iterobject.h' line='8' column='1' elf-symbol-id='PySeqIter_Type'/>
+    <var-decl name='PyCallIter_Type' type-id='type-id-149' mangled-name='PyCallIter_Type' visibility='default' filepath='./Include/iterobject.h' line='9' column='1' elf-symbol-id='PyCallIter_Type'/>
+    <var-decl name='_PyAnextAwaitable_Type' type-id='type-id-149' visibility='default' filepath='./Include/iterobject.h' line='11' column='1'/>
+    <function-decl name='PyCallIter_New' mangled-name='PyCallIter_New' filepath='Objects/iterobject.c' line='181' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCallIter_New'>
+      <parameter type-id='type-id-16' name='callable' filepath='Objects/iterobject.c' line='181' column='1'/>
+      <parameter type-id='type-id-16' name='sentinel' filepath='Objects/iterobject.c' line='181' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PySeqIter_New' mangled-name='PySeqIter_New' filepath='Objects/iterobject.c' line='15' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySeqIter_New'>
+      <parameter type-id='type-id-16' name='seq' filepath='Objects/iterobject.c' line='15' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyCoro_GetAwaitableIter' mangled-name='_PyCoro_GetAwaitableIter' filepath='./Include/genobject.h' line='58' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyGen_SetStopIterationValue' mangled-name='_PyGen_SetStopIterationValue' filepath='./Include/genobject.h' line='43' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_CallMethod' mangled-name='PyObject_CallMethod' filepath='./Include/abstract.h' line='194' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObject_HasLen' mangled-name='_PyObject_HasLen' filepath='./Include/cpython/abstract.h' line='253' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/listobject.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PyList_Type' type-id='type-id-149' mangled-name='PyList_Type' visibility='default' filepath='./Include/listobject.h' line='20' column='1' elf-symbol-id='PyList_Type'/>
+    <var-decl name='PyListIter_Type' type-id='type-id-149' mangled-name='PyListIter_Type' visibility='default' filepath='./Include/listobject.h' line='21' column='1' elf-symbol-id='PyListIter_Type'/>
+    <var-decl name='PyListRevIter_Type' type-id='type-id-149' mangled-name='PyListRevIter_Type' visibility='default' filepath='./Include/listobject.h' line='22' column='1' elf-symbol-id='PyListRevIter_Type'/>
+    <function-decl name='PyList_AsTuple' mangled-name='PyList_AsTuple' filepath='Objects/listobject.c' line='2504' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyList_AsTuple'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/listobject.c' line='2504' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyList_Reverse' mangled-name='PyList_Reverse' filepath='Objects/listobject.c' line='2490' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyList_Reverse'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/listobject.c' line='2490' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyList_Sort' mangled-name='PyList_Sort' filepath='Objects/listobject.c' line='2461' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyList_Sort'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/listobject.c' line='2461' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyList_Extend' mangled-name='_PyList_Extend' filepath='Objects/listobject.c' line='978' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyList_Extend'>
+      <parameter type-id='type-id-382' name='self' filepath='Objects/listobject.c' line='978' column='1'/>
+      <parameter type-id='type-id-16' name='iterable' filepath='Objects/listobject.c' line='978' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyList_SetSlice' mangled-name='PyList_SetSlice' filepath='Objects/listobject.c' line='723' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyList_SetSlice'>
+      <parameter type-id='type-id-16' name='a' filepath='Objects/listobject.c' line='723' column='1'/>
+      <parameter type-id='type-id-31' name='ilow' filepath='Objects/listobject.c' line='723' column='1'/>
+      <parameter type-id='type-id-31' name='ihigh' filepath='Objects/listobject.c' line='723' column='1'/>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/listobject.c' line='723' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyList_GetSlice' mangled-name='PyList_GetSlice' filepath='Objects/listobject.c' line='482' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyList_GetSlice'>
+      <parameter type-id='type-id-16' name='a' filepath='Objects/listobject.c' line='482' column='1'/>
+      <parameter type-id='type-id-31' name='ilow' filepath='Objects/listobject.c' line='482' column='1'/>
+      <parameter type-id='type-id-31' name='ihigh' filepath='Objects/listobject.c' line='482' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyList_Append' mangled-name='PyList_Append' filepath='Objects/listobject.c' line='320' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyList_Append'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/listobject.c' line='320' column='1'/>
+      <parameter type-id='type-id-16' name='newitem' filepath='Objects/listobject.c' line='320' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyList_Insert' mangled-name='PyList_Insert' filepath='Objects/listobject.c' line='295' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyList_Insert'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/listobject.c' line='295' column='1'/>
+      <parameter type-id='type-id-31' name='where' filepath='Objects/listobject.c' line='295' column='1'/>
+      <parameter type-id='type-id-16' name='newitem' filepath='Objects/listobject.c' line='295' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyList_SetItem' mangled-name='PyList_SetItem' filepath='Objects/listobject.c' line='245' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyList_SetItem'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/listobject.c' line='245' column='1'/>
+      <parameter type-id='type-id-31' name='i' filepath='Objects/listobject.c' line='245' column='1'/>
+      <parameter type-id='type-id-16' name='newitem' filepath='Objects/listobject.c' line='246' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyList_GetItem' mangled-name='PyList_GetItem' filepath='Objects/listobject.c' line='225' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyList_GetItem'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/listobject.c' line='225' column='1'/>
+      <parameter type-id='type-id-31' name='i' filepath='Objects/listobject.c' line='225' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyList_Size' mangled-name='PyList_Size' filepath='Objects/listobject.c' line='199' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyList_Size'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/bytesobject.c' line='1224' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='PyList_New' mangled-name='PyList_New' filepath='Objects/listobject.c' line='140' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyList_New'>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/listobject.c' line='140' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyList_DebugMallocStats' mangled-name='_PyList_DebugMallocStats' filepath='Objects/listobject.c' line='131' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyList_DebugMallocStats'>
+      <parameter type-id='type-id-188' name='out' filepath='Objects/floatobject.c' line='2059' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_GC_Track' mangled-name='PyObject_GC_Track' filepath='./Include/objimpl.h' line='175' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyEval_SliceIndexNotNone' mangled-name='_PyEval_SliceIndexNotNone' filepath='./Include/cpython/ceval.h' line='30' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicodeWriter_WriteChar' mangled-name='_PyUnicodeWriter_WriteChar' filepath='./Include/cpython/unicodeobject.h' line='671' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='Py_ReprLeave' mangled-name='Py_ReprLeave' filepath='./Include/object.h' line='300' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='Py_ReprEnter' mangled-name='Py_ReprEnter' filepath='./Include/object.h' line='299' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/longobject.c' comp-dir-path='/src' language='LANG_C99'>
+
+    <array-type-def dimensions='1' type-id='type-id-341' size-in-bits='2048' id='type-id-446'>
+      <subrange length='256' type-id='type-id-19' id='type-id-362'/>
+
+    </array-type-def>
+    <var-decl name='_PyLong_DigitValue' type-id='type-id-446' mangled-name='_PyLong_DigitValue' visibility='default' filepath='./Include/longobject.h' line='79' column='1' elf-symbol-id='_PyLong_DigitValue'/>
+    <var-decl name='PyLong_Type' type-id='type-id-149' mangled-name='PyLong_Type' visibility='default' filepath='./Include/longobject.h' line='12' column='1' elf-symbol-id='PyLong_Type'/>
+    <function-decl name='PyLong_GetInfo' mangled-name='PyLong_GetInfo' filepath='Objects/longobject.c' line='5688' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyLong_GetInfo'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyLong_DivmodNear' mangled-name='_PyLong_DivmodNear' filepath='Objects/longobject.c' line='5064' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyLong_DivmodNear'>
+      <parameter type-id='type-id-16' name='a' filepath='Objects/longobject.c' line='5064' column='1'/>
+      <parameter type-id='type-id-16' name='b' filepath='Objects/longobject.c' line='5064' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyLong_GCD' mangled-name='_PyLong_GCD' filepath='Objects/longobject.c' line='4702' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyLong_GCD'>
+      <parameter type-id='type-id-16' name='aarg' filepath='Objects/longobject.c' line='4702' column='1'/>
+      <parameter type-id='type-id-16' name='barg' filepath='Objects/longobject.c' line='4702' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyLong_Lshift' mangled-name='_PyLong_Lshift' filepath='Objects/longobject.c' line='4510' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyLong_Lshift'>
+      <parameter type-id='type-id-16' name='a' filepath='Objects/longobject.c' line='4510' column='1'/>
+      <parameter type-id='type-id-157' name='shiftby' filepath='Objects/longobject.c' line='4510' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyLong_Rshift' mangled-name='_PyLong_Rshift' filepath='Objects/longobject.c' line='4439' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyLong_Rshift'>
+      <parameter type-id='type-id-16' name='a' filepath='Objects/longobject.c' line='4510' column='1'/>
+      <parameter type-id='type-id-157' name='shiftby' filepath='Objects/longobject.c' line='4510' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyLong_Frexp' mangled-name='_PyLong_Frexp' filepath='Objects/longobject.c' line='2738' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyLong_Frexp'>
+      <parameter type-id='type-id-356' name='a' filepath='Objects/longobject.c' line='2738' column='1'/>
+      <parameter type-id='type-id-125' name='e' filepath='Objects/longobject.c' line='2738' column='1'/>
+      <return type-id='type-id-371'/>
+    </function-decl>
+    <function-decl name='PyLong_FromUnicodeObject' mangled-name='PyLong_FromUnicodeObject' filepath='Objects/longobject.c' line='2497' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyLong_FromUnicodeObject'>
+      <parameter type-id='type-id-16' name='u' filepath='Objects/longobject.c' line='2497' column='1'/>
+      <parameter type-id='type-id-9' name='base' filepath='Objects/longobject.c' line='2497' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyLong_FromBytes' mangled-name='_PyLong_FromBytes' filepath='Objects/longobject.c' line='2477' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyLong_FromBytes'>
+      <parameter type-id='type-id-3' name='s' filepath='Objects/longobject.c' line='2477' column='1'/>
+      <parameter type-id='type-id-31' name='len' filepath='Objects/longobject.c' line='2477' column='1'/>
+      <parameter type-id='type-id-9' name='base' filepath='Objects/longobject.c' line='2477' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyLong_FromString' mangled-name='PyLong_FromString' filepath='Objects/longobject.c' line='2116' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyLong_FromString'>
+      <parameter type-id='type-id-3' name='str' filepath='Objects/longobject.c' line='2116' column='1'/>
+      <parameter type-id='type-id-215' name='pend' filepath='Objects/longobject.c' line='2116' column='1'/>
+      <parameter type-id='type-id-9' name='base' filepath='Objects/longobject.c' line='2116' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyLong_FormatBytesWriter' mangled-name='_PyLong_FormatBytesWriter' filepath='Objects/longobject.c' line='1965' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyLong_FormatBytesWriter'>
+      <parameter type-id='type-id-214' name='writer' filepath='Objects/longobject.c' line='1965' column='1'/>
+      <parameter type-id='type-id-72' name='str' filepath='Objects/longobject.c' line='1965' column='1'/>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/longobject.c' line='1966' column='1'/>
+      <parameter type-id='type-id-9' name='base' filepath='Objects/longobject.c' line='1967' column='1'/>
+      <parameter type-id='type-id-9' name='alternate' filepath='Objects/longobject.c' line='1967' column='1'/>
+      <return type-id='type-id-72'/>
+    </function-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='448' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-447' visibility='default' filepath='./Include/cpython/unicodeobject.h' line='603' column='1' id='type-id-448'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='buffer' type-id='type-id-16' visibility='default' filepath='./Include/cpython/unicodeobject.h' line='604' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='data' type-id='type-id-21' visibility='default' filepath='./Include/cpython/unicodeobject.h' line='605' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='kind' type-id='type-id-449' visibility='default' filepath='./Include/cpython/unicodeobject.h' line='606' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='160'>
+        <var-decl name='maxchar' type-id='type-id-450' visibility='default' filepath='./Include/cpython/unicodeobject.h' line='607' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='size' type-id='type-id-31' visibility='default' filepath='./Include/cpython/unicodeobject.h' line='608' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='pos' type-id='type-id-31' visibility='default' filepath='./Include/cpython/unicodeobject.h' line='609' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='min_length' type-id='type-id-31' visibility='default' filepath='./Include/cpython/unicodeobject.h' line='612' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='384'>
+        <var-decl name='min_char' type-id='type-id-450' visibility='default' filepath='./Include/cpython/unicodeobject.h' line='615' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='416'>
+        <var-decl name='overallocate' type-id='type-id-341' visibility='default' filepath='./Include/cpython/unicodeobject.h' line='618' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='424'>
+        <var-decl name='readonly' type-id='type-id-341' visibility='default' filepath='./Include/cpython/unicodeobject.h' line='622' column='1'/>
+      </data-member>
+    </class-decl>
+    <enum-decl name='PyUnicode_Kind' filepath='./Include/cpython/unicodeobject.h' line='313' column='1' id='type-id-449'>
+      <underlying-type type-id='type-id-83'/>
+      <enumerator name='PyUnicode_WCHAR_KIND' value='0'/>
+      <enumerator name='PyUnicode_1BYTE_KIND' value='1'/>
+      <enumerator name='PyUnicode_2BYTE_KIND' value='2'/>
+      <enumerator name='PyUnicode_4BYTE_KIND' value='4'/>
+    </enum-decl>
+    <typedef-decl name='Py_UCS4' type-id='type-id-205' filepath='./Include/unicodeobject.h' line='102' column='1' id='type-id-450'/>
+    <typedef-decl name='_PyUnicodeWriter' type-id='type-id-448' filepath='./Include/cpython/unicodeobject.h' line='623' column='1' id='type-id-447'/>
+    <pointer-type-def type-id='type-id-447' size-in-bits='64' id='type-id-451'/>
+    <function-decl name='_PyLong_FormatWriter' mangled-name='_PyLong_FormatWriter' filepath='Objects/longobject.c' line='1952' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyLong_FormatWriter'>
+      <parameter type-id='type-id-451' name='writer' filepath='Objects/longobject.c' line='1952' column='1'/>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/longobject.c' line='1953' column='1'/>
+      <parameter type-id='type-id-9' name='base' filepath='Objects/longobject.c' line='1954' column='1'/>
+      <parameter type-id='type-id-9' name='alternate' filepath='Objects/longobject.c' line='1954' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyLong_Format' mangled-name='_PyLong_Format' filepath='Objects/longobject.c' line='1938' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyLong_Format'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/longobject.c' line='1938' column='1'/>
+      <parameter type-id='type-id-9' name='base' filepath='Objects/longobject.c' line='1938' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyLong_Size_t_Converter' mangled-name='_PyLong_Size_t_Converter' filepath='Objects/longobject.c' line='1424' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyLong_Size_t_Converter'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/longobject.c' line='1424' column='1'/>
+      <parameter type-id='type-id-21' name='ptr' filepath='Objects/longobject.c' line='1424' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyLong_UnsignedLongLong_Converter' mangled-name='_PyLong_UnsignedLongLong_Converter' filepath='Objects/longobject.c' line='1407' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyLong_UnsignedLongLong_Converter'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/longobject.c' line='1424' column='1'/>
+      <parameter type-id='type-id-21' name='ptr' filepath='Objects/longobject.c' line='1424' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyLong_UnsignedLong_Converter' mangled-name='_PyLong_UnsignedLong_Converter' filepath='Objects/longobject.c' line='1390' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyLong_UnsignedLong_Converter'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/longobject.c' line='1424' column='1'/>
+      <parameter type-id='type-id-21' name='ptr' filepath='Objects/longobject.c' line='1424' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyLong_UnsignedInt_Converter' mangled-name='_PyLong_UnsignedInt_Converter' filepath='Objects/longobject.c' line='1368' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyLong_UnsignedInt_Converter'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/longobject.c' line='1368' column='1'/>
+      <parameter type-id='type-id-21' name='ptr' filepath='Objects/longobject.c' line='1368' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyLong_UnsignedShort_Converter' mangled-name='_PyLong_UnsignedShort_Converter' filepath='Objects/longobject.c' line='1346' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyLong_UnsignedShort_Converter'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/longobject.c' line='1368' column='1'/>
+      <parameter type-id='type-id-21' name='ptr' filepath='Objects/longobject.c' line='1368' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <pointer-type-def type-id='type-id-9' size-in-bits='64' id='type-id-452'/>
+    <function-decl name='PyLong_AsLongLongAndOverflow' mangled-name='PyLong_AsLongLongAndOverflow' filepath='Objects/longobject.c' line='1270' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyLong_AsLongLongAndOverflow'>
+      <parameter type-id='type-id-16' name='vv' filepath='Objects/longobject.c' line='1270' column='1'/>
+      <parameter type-id='type-id-452' name='overflow' filepath='Objects/longobject.c' line='1270' column='1'/>
+      <return type-id='type-id-286'/>
+    </function-decl>
+    <function-decl name='PyLong_AsUnsignedLongLongMask' mangled-name='PyLong_AsUnsignedLongLongMask' filepath='Objects/longobject.c' line='1236' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyLong_AsUnsignedLongLongMask'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/longobject.c' line='1236' column='1'/>
+      <return type-id='type-id-289'/>
+    </function-decl>
+    <function-decl name='PyLong_AsLongLong' mangled-name='PyLong_AsLongLong' filepath='Objects/longobject.c' line='1119' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyLong_AsLongLong'>
+      <parameter type-id='type-id-16' name='vv' filepath='Objects/longobject.c' line='1119' column='1'/>
+      <return type-id='type-id-286'/>
+    </function-decl>
+    <function-decl name='PyLong_AsVoidPtr' mangled-name='PyLong_AsVoidPtr' filepath='Objects/longobject.c' line='991' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyLong_AsVoidPtr'>
+      <parameter type-id='type-id-16' name='vv' filepath='Objects/longobject.c' line='991' column='1'/>
+      <return type-id='type-id-21'/>
+    </function-decl>
+    <function-decl name='PyLong_FromVoidPtr' mangled-name='PyLong_FromVoidPtr' filepath='Objects/longobject.c' line='974' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyLong_FromVoidPtr'>
+      <parameter type-id='type-id-21' name='p' filepath='Objects/longobject.c' line='974' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyLong_AsByteArray' mangled-name='_PyLong_AsByteArray' filepath='Objects/longobject.c' line='839' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyLong_AsByteArray'>
+      <parameter type-id='type-id-356' name='v' filepath='Objects/longobject.c' line='839' column='1'/>
+      <parameter type-id='type-id-339' name='bytes' filepath='Objects/longobject.c' line='840' column='1'/>
+      <parameter type-id='type-id-157' name='n' filepath='Objects/longobject.c' line='840' column='1'/>
+      <parameter type-id='type-id-9' name='little_endian' filepath='Objects/longobject.c' line='841' column='1'/>
+      <parameter type-id='type-id-9' name='is_signed' filepath='Objects/longobject.c' line='841' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyLong_FromByteArray' mangled-name='_PyLong_FromByteArray' filepath='Objects/longobject.c' line='728' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyLong_FromByteArray'>
+      <parameter type-id='type-id-440' name='bytes' filepath='Objects/longobject.c' line='728' column='1'/>
+      <parameter type-id='type-id-157' name='n' filepath='Objects/longobject.c' line='728' column='1'/>
+      <parameter type-id='type-id-9' name='little_endian' filepath='Objects/longobject.c' line='729' column='1'/>
+      <parameter type-id='type-id-9' name='is_signed' filepath='Objects/longobject.c' line='729' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyLong_NumBits' mangled-name='_PyLong_NumBits' filepath='Objects/longobject.c' line='698' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyLong_NumBits'>
+      <parameter type-id='type-id-16' name='vv' filepath='Objects/longobject.c' line='698' column='1'/>
+      <return type-id='type-id-157'/>
+    </function-decl>
+    <function-decl name='_PyLong_Sign' mangled-name='_PyLong_Sign' filepath='Objects/longobject.c' line='680' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyLong_Sign'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/abstract.c' line='2855' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyLong_AsUnsignedLongMask' mangled-name='PyLong_AsUnsignedLongMask' filepath='Objects/longobject.c' line='656' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyLong_AsUnsignedLongMask'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/longobject.c' line='656' column='1'/>
+      <return type-id='type-id-19'/>
+    </function-decl>
+    <function-decl name='PyLong_AsSize_t' mangled-name='PyLong_AsSize_t' filepath='Objects/longobject.c' line='583' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyLong_AsSize_t'>
+      <parameter type-id='type-id-16' name='vv' filepath='Objects/longobject.c' line='583' column='1'/>
+      <return type-id='type-id-157'/>
+    </function-decl>
+    <function-decl name='PyLong_AsUnsignedLong' mangled-name='PyLong_AsUnsignedLong' filepath='Objects/longobject.c' line='539' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyLong_AsUnsignedLong'>
+      <parameter type-id='type-id-16' name='vv' filepath='Objects/longobject.c' line='539' column='1'/>
+      <return type-id='type-id-19'/>
+    </function-decl>
+    <function-decl name='PyLong_AsSsize_t' mangled-name='PyLong_AsSsize_t' filepath='Objects/longobject.c' line='484' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyLong_AsSsize_t'>
+      <parameter type-id='type-id-16' name='vv' filepath='Objects/longobject.c' line='484' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='_PyLong_AsInt' mangled-name='_PyLong_AsInt' filepath='Objects/longobject.c' line='466' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyLong_AsInt'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/longobject.c' line='466' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyLong_AsLongAndOverflow' mangled-name='PyLong_AsLongAndOverflow' filepath='Objects/longobject.c' line='370' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyLong_AsLongAndOverflow'>
+      <parameter type-id='type-id-16' name='vv' filepath='Objects/longobject.c' line='370' column='1'/>
+      <parameter type-id='type-id-452' name='overflow' filepath='Objects/longobject.c' line='370' column='1'/>
+      <return type-id='type-id-33'/>
+    </function-decl>
+    <function-decl name='PyLong_FromDouble' mangled-name='PyLong_FromDouble' filepath='Objects/longobject.c' line='293' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyLong_FromDouble'>
+      <parameter type-id='type-id-371' name='dval' filepath='Objects/longobject.c' line='293' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyLong_FromSize_t' mangled-name='PyLong_FromSize_t' filepath='Objects/longobject.c' line='285' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyLong_FromSize_t'>
+      <parameter type-id='type-id-157' name='ival' filepath='Objects/longobject.c' line='285' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyLong_FromUnsignedLongLong' mangled-name='PyLong_FromUnsignedLongLong' filepath='Objects/longobject.c' line='277' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyLong_FromUnsignedLongLong'>
+      <parameter type-id='type-id-289' name='ival' filepath='Objects/longobject.c' line='277' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyLong_Copy' mangled-name='_PyLong_Copy' filepath='Objects/longobject.c' line='145' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyLong_Copy'>
+      <parameter type-id='type-id-356' name='src' filepath='Objects/longobject.c' line='145' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyLong_New' mangled-name='_PyLong_New' filepath='Objects/longobject.c' line='121' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyLong_New'>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/longobject.c' line='121' column='1'/>
+      <return type-id='type-id-356'/>
+    </function-decl>
+    <function-decl name='PyLong_FromLong' mangled-name='PyLong_FromLong' filepath='Objects/longobject.c' line='173' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyLong_FromLong'>
+      <parameter type-id='type-id-33' name='ival' filepath='Objects/longobject.c' line='173' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyLong_FromUnsignedLong' mangled-name='PyLong_FromUnsignedLong' filepath='Objects/longobject.c' line='269' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyLong_FromUnsignedLong'>
+      <parameter type-id='type-id-19' name='ival' filepath='Objects/longobject.c' line='269' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyLong_AsLong' mangled-name='PyLong_AsLong' filepath='Objects/longobject.c' line='449' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyLong_AsLong'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/longobject.c' line='449' column='1'/>
+      <return type-id='type-id-33'/>
+    </function-decl>
+    <function-decl name='PyLong_FromLongLong' mangled-name='PyLong_FromLongLong' filepath='Objects/longobject.c' line='1028' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyLong_FromLongLong'>
+      <parameter type-id='type-id-286' name='ival' filepath='Objects/longobject.c' line='1028' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyLong_FromSsize_t' mangled-name='PyLong_FromSsize_t' filepath='Objects/longobject.c' line='1075' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyLong_FromSsize_t'>
+      <parameter type-id='type-id-31' name='ival' filepath='Objects/longobject.c' line='1075' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyLong_AsUnsignedLongLong' mangled-name='PyLong_AsUnsignedLongLong' filepath='Objects/longobject.c' line='1171' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyLong_AsUnsignedLongLong'>
+      <parameter type-id='type-id-16' name='vv' filepath='Objects/longobject.c' line='1171' column='1'/>
+      <return type-id='type-id-289'/>
+    </function-decl>
+    <function-decl name='PyLong_AsDouble' mangled-name='PyLong_AsDouble' filepath='Objects/longobject.c' line='2850' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyLong_AsDouble'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/longobject.c' line='2850' column='1'/>
+      <return type-id='type-id-371'/>
+    </function-decl>
+    <function-decl name='_PyUnicodeWriter_PrepareInternal' mangled-name='_PyUnicodeWriter_PrepareInternal' filepath='./Include/cpython/unicodeobject.h' line='648' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyBytesWriter_Prepare' mangled-name='_PyBytesWriter_Prepare' filepath='./Include/cpython/bytesobject.h' line='94' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_EqualToASCIIId' mangled-name='_PyUnicode_EqualToASCIIId' filepath='./Include/cpython/unicodeobject.h' line='1010' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_Bytes' mangled-name='PyObject_Bytes' filepath='./Include/object.h' line='268' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyLong_FormatAdvancedWriter' mangled-name='_PyLong_FormatAdvancedWriter' filepath='./Include/longobject.h' line='193' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/dictobject.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PyDict_Type' type-id='type-id-149' mangled-name='PyDict_Type' visibility='default' filepath='./Include/dictobject.h' line='15' column='1' elf-symbol-id='PyDict_Type'/>
+    <var-decl name='PyDictIterKey_Type' type-id='type-id-149' mangled-name='PyDictIterKey_Type' visibility='default' filepath='./Include/dictobject.h' line='79' column='1' elf-symbol-id='PyDictIterKey_Type'/>
+    <var-decl name='PyDictIterValue_Type' type-id='type-id-149' mangled-name='PyDictIterValue_Type' visibility='default' filepath='./Include/dictobject.h' line='80' column='1' elf-symbol-id='PyDictIterValue_Type'/>
+    <var-decl name='PyDictIterItem_Type' type-id='type-id-149' mangled-name='PyDictIterItem_Type' visibility='default' filepath='./Include/dictobject.h' line='81' column='1' elf-symbol-id='PyDictIterItem_Type'/>
+    <var-decl name='PyDictRevIterKey_Type' type-id='type-id-149' mangled-name='PyDictRevIterKey_Type' visibility='default' filepath='./Include/dictobject.h' line='83' column='1' elf-symbol-id='PyDictRevIterKey_Type'/>
+    <var-decl name='PyDictRevIterItem_Type' type-id='type-id-149' mangled-name='PyDictRevIterItem_Type' visibility='default' filepath='./Include/dictobject.h' line='84' column='1' elf-symbol-id='PyDictRevIterItem_Type'/>
+    <var-decl name='PyDictRevIterValue_Type' type-id='type-id-149' mangled-name='PyDictRevIterValue_Type' visibility='default' filepath='./Include/dictobject.h' line='85' column='1' elf-symbol-id='PyDictRevIterValue_Type'/>
+    <var-decl name='PyDictKeys_Type' type-id='type-id-149' mangled-name='PyDictKeys_Type' visibility='default' filepath='./Include/dictobject.h' line='66' column='1' elf-symbol-id='PyDictKeys_Type'/>
+    <var-decl name='PyDictItems_Type' type-id='type-id-149' mangled-name='PyDictItems_Type' visibility='default' filepath='./Include/dictobject.h' line='68' column='1' elf-symbol-id='PyDictItems_Type'/>
+    <var-decl name='PyDictValues_Type' type-id='type-id-149' mangled-name='PyDictValues_Type' visibility='default' filepath='./Include/dictobject.h' line='67' column='1' elf-symbol-id='PyDictValues_Type'/>
+    <function-decl name='PyObject_GenericGetDict' mangled-name='PyObject_GenericGetDict' filepath='Objects/dictobject.c' line='4990' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_GenericGetDict'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/dictobject.c' line='4990' column='1'/>
+      <parameter type-id='type-id-21' name='context' filepath='Objects/dictobject.c' line='4990' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyDictView_Intersect' mangled-name='_PyDictView_Intersect' filepath='Objects/dictobject.c' line='4441' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyDictView_Intersect'>
+      <parameter type-id='type-id-16' name='self' filepath='Objects/dictobject.c' line='4441' column='1'/>
+      <parameter type-id='type-id-16' name='other' filepath='Objects/dictobject.c' line='4441' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyDict_DelItemString' mangled-name='PyDict_DelItemString' filepath='Objects/dictobject.c' line='3629' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyDict_DelItemString'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/dictobject.c' line='3629' column='1'/>
+      <parameter type-id='type-id-3' name='key' filepath='Objects/dictobject.c' line='3629' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <pointer-type-def type-id='type-id-220' size-in-bits='64' id='type-id-453'/>
+    <function-decl name='_PyDict_DelItemId' mangled-name='_PyDict_DelItemId' filepath='Objects/dictobject.c' line='3620' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyDict_DelItemId'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/dictobject.c' line='3620' column='1'/>
+      <parameter type-id='type-id-453' name='key' filepath='Objects/dictobject.c' line='3620' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyDict_SetItemString' mangled-name='PyDict_SetItemString' filepath='Objects/dictobject.c' line='3606' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyDict_SetItemString'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/dictobject.c' line='3606' column='1'/>
+      <parameter type-id='type-id-3' name='key' filepath='Objects/dictobject.c' line='3606' column='1'/>
+      <parameter type-id='type-id-16' name='item' filepath='Objects/dictobject.c' line='3606' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyDict_SetItemId' mangled-name='_PyDict_SetItemId' filepath='Objects/dictobject.c' line='3596' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyDict_SetItemId'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/dictobject.c' line='3596' column='1'/>
+      <parameter type-id='type-id-219' name='key' filepath='Objects/dictobject.c' line='3596' column='1'/>
+      <parameter type-id='type-id-16' name='item' filepath='Objects/dictobject.c' line='3596' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyDict_GetItemString' mangled-name='PyDict_GetItemString' filepath='Objects/dictobject.c' line='3582' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyDict_GetItemString'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/dictobject.c' line='3582' column='1'/>
+      <parameter type-id='type-id-3' name='key' filepath='Objects/dictobject.c' line='3582' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyDict_ContainsId' mangled-name='_PyDict_ContainsId' filepath='Objects/dictobject.c' line='3425' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyDict_ContainsId'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/dictobject.c' line='3425' column='1'/>
+      <parameter type-id='type-id-219' name='key' filepath='Objects/dictobject.c' line='3425' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyDict_Contains_KnownHash' mangled-name='_PyDict_Contains_KnownHash' filepath='Objects/dictobject.c' line='3412' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyDict_Contains_KnownHash'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/dictobject.c' line='3412' column='1'/>
+      <parameter type-id='type-id-16' name='key' filepath='Objects/dictobject.c' line='3412' column='1'/>
+      <parameter type-id='type-id-117' name='hash' filepath='Objects/dictobject.c' line='3412' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyDict_Contains' mangled-name='PyDict_Contains' filepath='Objects/dictobject.c' line='3391' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyDict_Contains'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/dictobject.c' line='3391' column='1'/>
+      <parameter type-id='type-id-16' name='key' filepath='Objects/dictobject.c' line='3391' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <class-decl name='_dictkeysobject' size-in-bits='320' is-struct='yes' visibility='default' filepath='Objects/dict-common.h' line='22' column='1' id='type-id-389'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='dk_refcnt' type-id='type-id-31' visibility='default' filepath='Objects/dict-common.h' line='23' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='dk_size' type-id='type-id-31' visibility='default' filepath='Objects/dict-common.h' line='26' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='dk_lookup' type-id='type-id-454' visibility='default' filepath='Objects/dict-common.h' line='41' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='dk_usable' type-id='type-id-31' visibility='default' filepath='Objects/dict-common.h' line='44' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='dk_nentries' type-id='type-id-31' visibility='default' filepath='Objects/dict-common.h' line='47' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='dk_indices' type-id='type-id-209' visibility='default' filepath='Objects/dict-common.h' line='62' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-455' size-in-bits='64' id='type-id-456'/>
+    <typedef-decl name='dict_lookup_func' type-id='type-id-456' filepath='Objects/dict-common.h' line='14' column='1' id='type-id-454'/>
+    <function-decl name='_PyDict_SizeOf' mangled-name='_PyDict_SizeOf' filepath='Objects/dictobject.c' line='3272' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyDict_SizeOf'>
+      <parameter type-id='type-id-391' name='mp' filepath='Objects/dictobject.c' line='3272' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='PyDict_SetDefault' mangled-name='PyDict_SetDefault' filepath='Objects/dictobject.c' line='3021' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyDict_SetDefault'>
+      <parameter type-id='type-id-16' name='d' filepath='Objects/dictobject.c' line='3021' column='1'/>
+      <parameter type-id='type-id-16' name='key' filepath='Objects/dictobject.c' line='3021' column='1'/>
+      <parameter type-id='type-id-16' name='defaultobj' filepath='Objects/dictobject.c' line='3021' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyDict_Items' mangled-name='PyDict_Items' filepath='Objects/dictobject.c' line='2872' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyDict_Items'>
+      <parameter type-id='type-id-16' name='mp' filepath='Objects/dictobject.c' line='2872' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyDict_Values' mangled-name='PyDict_Values' filepath='Objects/dictobject.c' line='2862' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyDict_Values'>
+      <parameter type-id='type-id-16' name='mp' filepath='Objects/dictobject.c' line='2872' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyDict_Keys' mangled-name='PyDict_Keys' filepath='Objects/dictobject.c' line='2852' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyDict_Keys'>
+      <parameter type-id='type-id-16' name='mp' filepath='Objects/dictobject.c' line='2872' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyDict_Size' mangled-name='PyDict_Size' filepath='Objects/dictobject.c' line='2842' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyDict_Size'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/bytesobject.c' line='1224' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='PyDict_Copy' mangled-name='PyDict_Copy' filepath='Objects/dictobject.c' line='2749' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyDict_Copy'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/dictobject.c' line='2749' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyDict_MergeEx' mangled-name='_PyDict_MergeEx' filepath='Objects/dictobject.c' line='2737' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyDict_MergeEx'>
+      <parameter type-id='type-id-16' name='a' filepath='Objects/dictobject.c' line='2737' column='1'/>
+      <parameter type-id='type-id-16' name='b' filepath='Objects/dictobject.c' line='2737' column='1'/>
+      <parameter type-id='type-id-9' name='override' filepath='Objects/dictobject.c' line='2737' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyDict_Merge' mangled-name='PyDict_Merge' filepath='Objects/dictobject.c' line='2730' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyDict_Merge'>
+      <parameter type-id='type-id-16' name='a' filepath='Objects/dictobject.c' line='2737' column='1'/>
+      <parameter type-id='type-id-16' name='b' filepath='Objects/dictobject.c' line='2737' column='1'/>
+      <parameter type-id='type-id-9' name='override' filepath='Objects/dictobject.c' line='2737' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyDict_Update' mangled-name='PyDict_Update' filepath='Objects/dictobject.c' line='2724' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyDict_Update'>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/abstract.c' line='2296' column='1'/>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/abstract.c' line='2296' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyDict_MergeFromSeq2' mangled-name='PyDict_MergeFromSeq2' filepath='Objects/dictobject.c' line='2462' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyDict_MergeFromSeq2'>
+      <parameter type-id='type-id-16' name='d' filepath='Objects/dictobject.c' line='2462' column='1'/>
+      <parameter type-id='type-id-16' name='seq2' filepath='Objects/dictobject.c' line='2462' column='1'/>
+      <parameter type-id='type-id-9' name='override' filepath='Objects/dictobject.c' line='2462' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyDict_Next' mangled-name='PyDict_Next' filepath='Objects/dictobject.c' line='1880' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyDict_Next'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/dictobject.c' line='1880' column='1'/>
+      <parameter type-id='type-id-125' name='ppos' filepath='Objects/dictobject.c' line='1880' column='1'/>
+      <parameter type-id='type-id-86' name='pkey' filepath='Objects/dictobject.c' line='1880' column='1'/>
+      <parameter type-id='type-id-86' name='pvalue' filepath='Objects/dictobject.c' line='1880' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyDict_DelItemIf' mangled-name='_PyDict_DelItemIf' filepath='Objects/dictobject.c' line='1727' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyDict_DelItemIf'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/dictobject.c' line='1727' column='1'/>
+      <parameter type-id='type-id-16' name='key' filepath='Objects/dictobject.c' line='1727' column='1'/>
+      <parameter type-id='type-id-97' name='predicate' filepath='Objects/dictobject.c' line='1728' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyDict_DelItem_KnownHash' mangled-name='_PyDict_DelItem_KnownHash' filepath='Objects/dictobject.c' line='1689' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyDict_DelItem_KnownHash'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/dictobject.c' line='1689' column='1'/>
+      <parameter type-id='type-id-16' name='key' filepath='Objects/dictobject.c' line='1689' column='1'/>
+      <parameter type-id='type-id-117' name='hash' filepath='Objects/dictobject.c' line='1689' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyDict_DelItem' mangled-name='PyDict_DelItem' filepath='Objects/dictobject.c' line='1674' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyDict_DelItem'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/dictobject.c' line='1674' column='1'/>
+      <parameter type-id='type-id-16' name='key' filepath='Objects/dictobject.c' line='1674' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyDict_SetItem_KnownHash' mangled-name='_PyDict_SetItem_KnownHash' filepath='Objects/dictobject.c' line='1627' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyDict_SetItem_KnownHash'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/dictobject.c' line='1627' column='1'/>
+      <parameter type-id='type-id-16' name='key' filepath='Objects/dictobject.c' line='1627' column='1'/>
+      <parameter type-id='type-id-16' name='value' filepath='Objects/dictobject.c' line='1627' column='1'/>
+      <parameter type-id='type-id-117' name='hash' filepath='Objects/dictobject.c' line='1628' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyDict_GetItemStringWithError' mangled-name='_PyDict_GetItemStringWithError' filepath='Objects/dictobject.c' line='1545' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyDict_GetItemStringWithError'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/dictobject.c' line='1545' column='1'/>
+      <parameter type-id='type-id-3' name='key' filepath='Objects/dictobject.c' line='1545' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyDict_GetItemIdWithError' mangled-name='_PyDict_GetItemIdWithError' filepath='Objects/dictobject.c' line='1533' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyDict_GetItemIdWithError'>
+      <parameter type-id='type-id-16' name='dp' filepath='Objects/dictobject.c' line='1533' column='1'/>
+      <parameter type-id='type-id-219' name='key' filepath='Objects/dictobject.c' line='1533' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyDict_GetItem' mangled-name='PyDict_GetItem' filepath='Objects/dictobject.c' line='1398' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyDict_GetItem'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/dictobject.c' line='1398' column='1'/>
+      <parameter type-id='type-id-16' name='key' filepath='Objects/dictobject.c' line='1398' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyDict_NewPresized' mangled-name='_PyDict_NewPresized' filepath='Objects/dictobject.c' line='1361' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyDict_NewPresized'>
+      <parameter type-id='type-id-31' name='minused' filepath='Objects/dictobject.c' line='1361' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyDict_MaybeUntrack' mangled-name='_PyDict_MaybeUntrack' filepath='Objects/dictobject.c' line='1002' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyDict_MaybeUntrack'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/dictobject.c' line='1002' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyDict_HasOnlyStringKeys' mangled-name='_PyDict_HasOnlyStringKeys' filepath='Objects/dictobject.c' line='977' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyDict_HasOnlyStringKeys'>
+      <parameter type-id='type-id-16' name='dict' filepath='Objects/dictobject.c' line='977' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyDict_New' mangled-name='PyDict_New' filepath='Objects/dictobject.c' line='742' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyDict_New'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyDict_CheckConsistency' mangled-name='_PyDict_CheckConsistency' filepath='Objects/dictobject.c' line='495' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyDict_CheckConsistency'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/dictobject.c' line='495' column='1'/>
+      <parameter type-id='type-id-9' name='check_content' filepath='Objects/dictobject.c' line='495' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyDict_DebugMallocStats' mangled-name='_PyDict_DebugMallocStats' filepath='Objects/dictobject.c' line='291' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyDict_DebugMallocStats'>
+      <parameter type-id='type-id-188' name='out' filepath='Objects/floatobject.c' line='2059' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyDict_GetItem_KnownHash' mangled-name='_PyDict_GetItem_KnownHash' filepath='Objects/dictobject.c' line='1483' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyDict_GetItem_KnownHash'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/dictobject.c' line='1483' column='1'/>
+      <parameter type-id='type-id-16' name='key' filepath='Objects/dictobject.c' line='1483' column='1'/>
+      <parameter type-id='type-id-117' name='hash' filepath='Objects/dictobject.c' line='1483' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyDict_GetItemWithError' mangled-name='PyDict_GetItemWithError' filepath='Objects/dictobject.c' line='1506' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyDict_GetItemWithError'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/dictobject.c' line='1506' column='1'/>
+      <parameter type-id='type-id-16' name='key' filepath='Objects/dictobject.c' line='1506' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyDict_SetItem' mangled-name='PyDict_SetItem' filepath='Objects/dictobject.c' line='1600' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyDict_SetItem'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/dictobject.c' line='1600' column='1'/>
+      <parameter type-id='type-id-16' name='key' filepath='Objects/dictobject.c' line='1600' column='1'/>
+      <parameter type-id='type-id-16' name='value' filepath='Objects/dictobject.c' line='1600' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyDict_Clear' mangled-name='PyDict_Clear' filepath='Objects/dictobject.c' line='1777' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyDict_Clear'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/dictobject.c' line='1777' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <pointer-type-def type-id='type-id-117' size-in-bits='64' id='type-id-457'/>
+    <function-decl name='_PyDict_Next' mangled-name='_PyDict_Next' filepath='Objects/dictobject.c' line='1818' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyDict_Next'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/dictobject.c' line='1818' column='1'/>
+      <parameter type-id='type-id-125' name='ppos' filepath='Objects/dictobject.c' line='1818' column='1'/>
+      <parameter type-id='type-id-86' name='pkey' filepath='Objects/dictobject.c' line='1818' column='1'/>
+      <parameter type-id='type-id-86' name='pvalue' filepath='Objects/dictobject.c' line='1819' column='1'/>
+      <parameter type-id='type-id-457' name='phash' filepath='Objects/dictobject.c' line='1819' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyDict_Pop' mangled-name='_PyDict_Pop' filepath='Objects/dictobject.c' line='1944' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyDict_Pop'>
+      <parameter type-id='type-id-16' name='callable' filepath='Objects/call.c' line='322' column='1'/>
+      <parameter type-id='type-id-16' name='args' filepath='Objects/call.c' line='322' column='1'/>
+      <parameter type-id='type-id-16' name='kwargs' filepath='Objects/call.c' line='322' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyDictView_New' mangled-name='_PyDictView_New' filepath='Objects/dictobject.c' line='4214' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyDictView_New'>
+      <parameter type-id='type-id-16' name='dict' filepath='Objects/dictobject.c' line='4214' column='1'/>
+      <parameter type-id='type-id-32' name='type' filepath='Objects/dictobject.c' line='4214' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PySet_New' mangled-name='PySet_New' filepath='./Include/setobject.h' line='80' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PySet_Update' mangled-name='_PySet_Update' filepath='./Include/setobject.h' line='72' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObject_CallMethodIdObjArgs' mangled-name='_PyObject_CallMethodIdObjArgs' filepath='./Include/cpython/abstract.h' line='219' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PySet_Add' mangled-name='PySet_Add' filepath='./Include/setobject.h' line='83' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyDictProxy_New' mangled-name='PyDictProxy_New' filepath='./Include/descrobject.h' line='99' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PySequence_List' mangled-name='PySequence_List' filepath='./Include/abstract.h' line='706' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyLong_FromSize_t' mangled-name='PyLong_FromSize_t' filepath='./Include/longobject.h' line='20' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyArg_ValidateKeywordArguments' mangled-name='PyArg_ValidateKeywordArguments' filepath='./Include/modsupport.h' line='47' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_IS_GC' mangled-name='PyObject_IS_GC' filepath='./Include/cpython/objimpl.h' line='83' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_SetKeyError' mangled-name='_PyErr_SetKeyError' filepath='./Include/cpython/pyerrors.h' line='86' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyMapping_Keys' mangled-name='PyMapping_Keys' filepath='./Include/abstract.h' line='834' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_Fetch' mangled-name='_PyErr_Fetch' filepath='./Include/internal/pycore_pyerrors.h' line='32' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_Restore' mangled-name='_PyErr_Restore' filepath='./Include/internal/pycore_pyerrors.h' line='42' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObject_AssertFailed' mangled-name='_PyObject_AssertFailed' filepath='./Include/cpython/object.h' line='435' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-type size-in-bits='64' id='type-id-455'>
+      <parameter type-id='type-id-391'/>
+      <parameter type-id='type-id-16'/>
+      <parameter type-id='type-id-117'/>
+      <parameter type-id='type-id-86'/>
+      <return type-id='type-id-31'/>
+    </function-type>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/odictobject.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PyODict_Type' type-id='type-id-149' mangled-name='PyODict_Type' visibility='default' filepath='./Include/cpython/odictobject.h' line='15' column='1' elf-symbol-id='PyODict_Type'/>
+    <var-decl name='PyODictIter_Type' type-id='type-id-149' mangled-name='PyODictIter_Type' visibility='default' filepath='./Include/cpython/odictobject.h' line='16' column='1' elf-symbol-id='PyODictIter_Type'/>
+    <var-decl name='PyODictKeys_Type' type-id='type-id-149' mangled-name='PyODictKeys_Type' visibility='default' filepath='./Include/cpython/odictobject.h' line='17' column='1' elf-symbol-id='PyODictKeys_Type'/>
+    <var-decl name='PyODictItems_Type' type-id='type-id-149' mangled-name='PyODictItems_Type' visibility='default' filepath='./Include/cpython/odictobject.h' line='18' column='1' elf-symbol-id='PyODictItems_Type'/>
+    <var-decl name='PyODictValues_Type' type-id='type-id-149' mangled-name='PyODictValues_Type' visibility='default' filepath='./Include/cpython/odictobject.h' line='19' column='1' elf-symbol-id='PyODictValues_Type'/>
+    <function-decl name='PyODict_DelItem' mangled-name='PyODict_DelItem' filepath='Objects/odictobject.c' line='1675' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyODict_DelItem'>
+      <parameter type-id='type-id-16' name='od' filepath='Objects/odictobject.c' line='1675' column='1'/>
+      <parameter type-id='type-id-16' name='key' filepath='Objects/odictobject.c' line='1675' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyODict_SetItem' mangled-name='PyODict_SetItem' filepath='Objects/odictobject.c' line='1666' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyODict_SetItem'>
+      <parameter type-id='type-id-16' name='od' filepath='Objects/odictobject.c' line='1666' column='1'/>
+      <parameter type-id='type-id-16' name='key' filepath='Objects/odictobject.c' line='1666' column='1'/>
+      <parameter type-id='type-id-16' name='value' filepath='Objects/odictobject.c' line='1666' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyODict_New' mangled-name='PyODict_New' filepath='Objects/odictobject.c' line='1642' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyODict_New'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyDictView_New' mangled-name='_PyDictView_New' filepath='./Include/cpython/dictobject.h' line='83' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyDict_GetItem' mangled-name='PyDict_GetItem' filepath='./Include/dictobject.h' line='22' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyDict_DelItem_KnownHash' mangled-name='_PyDict_DelItem_KnownHash' filepath='./Include/cpython/dictobject.h' line='39' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_ChainExceptions' mangled-name='_PyErr_ChainExceptions' filepath='./Include/cpython/pyerrors.h' line='92' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyDict_SetItem_KnownHash' mangled-name='_PyDict_SetItem_KnownHash' filepath='./Include/cpython/dictobject.h' line='37' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyDict_Clear' mangled-name='PyDict_Clear' filepath='./Include/dictobject.h' line='26' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyDict_GetItem_KnownHash' mangled-name='_PyDict_GetItem_KnownHash' filepath='./Include/cpython/dictobject.h' line='30' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyDict_SizeOf' mangled-name='_PyDict_SizeOf' filepath='./Include/cpython/dictobject.h' line='55' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyDict_FromKeys' mangled-name='_PyDict_FromKeys' filepath='./Include/cpython/dictobject.h' line='58' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/memoryobject.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='_PyManagedBuffer_Type' type-id='type-id-149' mangled-name='_PyManagedBuffer_Type' visibility='default' filepath='./Include/memoryobject.h' line='10' column='1' elf-symbol-id='_PyManagedBuffer_Type'/>
+    <var-decl name='PyMemoryView_Type' type-id='type-id-149' mangled-name='PyMemoryView_Type' visibility='default' filepath='./Include/memoryobject.h' line='12' column='1' elf-symbol-id='PyMemoryView_Type'/>
+    <function-decl name='PyBuffer_ToContiguous' mangled-name='PyBuffer_ToContiguous' filepath='Objects/memoryobject.c' line='985' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyBuffer_ToContiguous'>
+      <parameter type-id='type-id-21' name='buf' filepath='Objects/memoryobject.c' line='985' column='1'/>
+      <parameter type-id='type-id-127' name='src' filepath='Objects/memoryobject.c' line='985' column='1'/>
+      <parameter type-id='type-id-31' name='len' filepath='Objects/memoryobject.c' line='985' column='1'/>
+      <parameter type-id='type-id-1' name='order' filepath='Objects/memoryobject.c' line='985' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyMemoryView_GetContiguous' mangled-name='PyMemoryView_GetContiguous' filepath='Objects/memoryobject.c' line='920' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMemoryView_GetContiguous'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/memoryobject.c' line='920' column='1'/>
+      <parameter type-id='type-id-9' name='buffertype' filepath='Objects/memoryobject.c' line='920' column='1'/>
+      <parameter type-id='type-id-1' name='order' filepath='Objects/memoryobject.c' line='920' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyMemoryView_FromBuffer' mangled-name='PyMemoryView_FromBuffer' filepath='Objects/memoryobject.c' line='758' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMemoryView_FromBuffer'>
+      <parameter type-id='type-id-127' name='info' filepath='Objects/memoryobject.c' line='758' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyMemoryView_FromMemory' mangled-name='PyMemoryView_FromMemory' filepath='Objects/memoryobject.c' line='729' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMemoryView_FromMemory'>
+      <parameter type-id='type-id-72' name='mem' filepath='Objects/memoryobject.c' line='729' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/memoryobject.c' line='729' column='1'/>
+      <parameter type-id='type-id-9' name='flags' filepath='Objects/memoryobject.c' line='729' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyMemoryView_FromObject' mangled-name='PyMemoryView_FromObject' filepath='Objects/memoryobject.c' line='788' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMemoryView_FromObject'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/memoryobject.c' line='788' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyLong_FromUnsignedLongLong' mangled-name='PyLong_FromUnsignedLongLong' filepath='./Include/longobject.h' line='97' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyLong_FromUnsignedLong' mangled-name='PyLong_FromUnsignedLong' filepath='./Include/longobject.h' line='19' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyLong_AsUnsignedLong' mangled-name='PyLong_AsUnsignedLong' filepath='./Include/longobject.h' line='27' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyLong_AsLong' mangled-name='PyLong_AsLong' filepath='./Include/longobject.h' line='23' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyLong_AsSize_t' mangled-name='PyLong_AsSize_t' filepath='./Include/longobject.h' line='26' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyLong_AsUnsignedLongLong' mangled-name='PyLong_AsUnsignedLongLong' filepath='./Include/longobject.h' line='99' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyLong_AsVoidPtr' mangled-name='PyLong_AsVoidPtr' filepath='./Include/longobject.h' line='94' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_AsASCIIString' mangled-name='PyUnicode_AsASCIIString' filepath='./Include/unicodeobject.h' line='656' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/methodobject.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PyCFunction_Type' type-id='type-id-149' mangled-name='PyCFunction_Type' visibility='default' filepath='./Include/methodobject.h' line='14' column='1' elf-symbol-id='PyCFunction_Type'/>
+    <var-decl name='PyCMethod_Type' type-id='type-id-149' mangled-name='PyCMethod_Type' visibility='default' filepath='./Include/cpython/methodobject.h' line='5' column='1' elf-symbol-id='PyCMethod_Type'/>
+    <function-decl name='PyCFunction_GetFlags' mangled-name='PyCFunction_GetFlags' filepath='Objects/methodobject.c' line='139' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCFunction_GetFlags'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/methodobject.c' line='139' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyCFunction_GetSelf' mangled-name='PyCFunction_GetSelf' filepath='Objects/methodobject.c' line='129' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCFunction_GetSelf'>
+      <parameter type-id='type-id-16' name='input' filepath='Objects/bytearrayobject.c' line='80' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyCFunction_GetFunction' mangled-name='PyCFunction_GetFunction' filepath='Objects/methodobject.c' line='119' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCFunction_GetFunction'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/methodobject.c' line='119' column='1'/>
+      <return type-id='type-id-140'/>
+    </function-decl>
+    <function-decl name='PyCMethod_New' mangled-name='PyCMethod_New' filepath='Objects/methodobject.c' line='44' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCMethod_New'>
+      <parameter type-id='type-id-435' name='ml' filepath='Objects/methodobject.c' line='44' column='1'/>
+      <parameter type-id='type-id-16' name='self' filepath='Objects/methodobject.c' line='44' column='1'/>
+      <parameter type-id='type-id-16' name='module' filepath='Objects/methodobject.c' line='44' column='1'/>
+      <parameter type-id='type-id-32' name='cls' filepath='Objects/methodobject.c' line='44' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyCFunction_NewEx' mangled-name='PyCFunction_NewEx' filepath='Objects/methodobject.c' line='38' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCFunction_NewEx'>
+      <parameter type-id='type-id-435' name='ml' filepath='Objects/methodobject.c' line='38' column='1'/>
+      <parameter type-id='type-id-16' name='self' filepath='Objects/methodobject.c' line='38' column='1'/>
+      <parameter type-id='type-id-16' name='module' filepath='Objects/methodobject.c' line='38' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyCFunction_New' mangled-name='PyCFunction_New' filepath='Objects/methodobject.c' line='32' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCFunction_New'>
+      <parameter type-id='type-id-435' name='ml' filepath='Objects/methodobject.c' line='32' column='1'/>
+      <parameter type-id='type-id-16' name='self' filepath='Objects/methodobject.c' line='32' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyVectorcall_Call' mangled-name='PyVectorcall_Call' filepath='./Include/cpython/abstract.h' line='146' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/moduleobject.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PyModuleDef_Type' type-id='type-id-149' mangled-name='PyModuleDef_Type' visibility='default' filepath='./Include/moduleobject.h' line='41' column='1' elf-symbol-id='PyModuleDef_Type'/>
+    <var-decl name='PyModule_Type' type-id='type-id-149' mangled-name='PyModule_Type' visibility='default' filepath='./Include/moduleobject.h' line='10' column='1' elf-symbol-id='PyModule_Type'/>
+    <function-decl name='_PyModuleSpec_IsInitializing' mangled-name='_PyModuleSpec_IsInitializing' filepath='Objects/moduleobject.c' line='705' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyModuleSpec_IsInitializing'>
+      <parameter type-id='type-id-16' name='spec' filepath='Objects/moduleobject.c' line='705' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyModule_ClearDict' mangled-name='_PyModule_ClearDict' filepath='Objects/moduleobject.c' line='573' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyModule_ClearDict'>
+      <parameter type-id='type-id-16' name='d' filepath='Objects/moduleobject.c' line='573' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyModule_Clear' mangled-name='_PyModule_Clear' filepath='Objects/moduleobject.c' line='565' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyModule_Clear'>
+      <parameter type-id='type-id-16' name='m' filepath='Objects/moduleobject.c' line='565' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyModule_GetState' mangled-name='PyModule_GetState' filepath='Objects/moduleobject.c' line='555' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyModule_GetState'>
+      <parameter type-id='type-id-16' name='m' filepath='Objects/moduleobject.c' line='555' column='1'/>
+      <return type-id='type-id-21'/>
+    </function-decl>
+    <class-decl name='PyModuleDef' size-in-bits='832' is-struct='yes' visibility='default' filepath='./Include/moduleobject.h' line='75' column='1' id='type-id-458'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='m_base' type-id='type-id-459' visibility='default' filepath='./Include/moduleobject.h' line='76' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='m_name' type-id='type-id-3' visibility='default' filepath='./Include/moduleobject.h' line='77' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='384'>
+        <var-decl name='m_doc' type-id='type-id-3' visibility='default' filepath='./Include/moduleobject.h' line='78' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='448'>
+        <var-decl name='m_size' type-id='type-id-31' visibility='default' filepath='./Include/moduleobject.h' line='79' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='512'>
+        <var-decl name='m_methods' type-id='type-id-435' visibility='default' filepath='./Include/moduleobject.h' line='80' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='576'>
+        <var-decl name='m_slots' type-id='type-id-460' visibility='default' filepath='./Include/moduleobject.h' line='81' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='640'>
+        <var-decl name='m_traverse' type-id='type-id-51' visibility='default' filepath='./Include/moduleobject.h' line='82' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='704'>
+        <var-decl name='m_clear' type-id='type-id-52' visibility='default' filepath='./Include/moduleobject.h' line='83' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='768'>
+        <var-decl name='m_free' type-id='type-id-65' visibility='default' filepath='./Include/moduleobject.h' line='84' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='PyModuleDef_Base' size-in-bits='320' is-struct='yes' visibility='default' filepath='./Include/moduleobject.h' line='44' column='1' id='type-id-461'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='ob_base' type-id='type-id-69' visibility='default' filepath='./Include/moduleobject.h' line='45' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='m_init' type-id='type-id-462' visibility='default' filepath='./Include/moduleobject.h' line='46' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='m_index' type-id='type-id-31' visibility='default' filepath='./Include/moduleobject.h' line='47' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='m_copy' type-id='type-id-16' visibility='default' filepath='./Include/moduleobject.h' line='48' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-463' size-in-bits='64' id='type-id-462'/>
+    <typedef-decl name='PyModuleDef_Base' type-id='type-id-461' filepath='./Include/moduleobject.h' line='49' column='1' id='type-id-459'/>
+    <class-decl name='PyModuleDef_Slot' size-in-bits='128' is-struct='yes' visibility='default' filepath='./Include/moduleobject.h' line='61' column='1' id='type-id-464'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='slot' type-id='type-id-9' visibility='default' filepath='./Include/moduleobject.h' line='62' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='value' type-id='type-id-21' visibility='default' filepath='./Include/moduleobject.h' line='63' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-464' size-in-bits='64' id='type-id-460'/>
+    <typedef-decl name='PyModuleDef' type-id='type-id-458' filepath='./Include/moduleobject.h' line='85' column='1' id='type-id-465'/>
+    <pointer-type-def type-id='type-id-465' size-in-bits='64' id='type-id-466'/>
+    <function-decl name='PyModule_GetDef' mangled-name='PyModule_GetDef' filepath='Objects/moduleobject.c' line='545' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyModule_GetDef'>
+      <parameter type-id='type-id-16' name='m' filepath='Objects/moduleobject.c' line='545' column='1'/>
+      <return type-id='type-id-466'/>
+    </function-decl>
+    <function-decl name='PyModule_GetFilename' mangled-name='PyModule_GetFilename' filepath='Objects/moduleobject.c' line='532' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyModule_GetFilename'>
+      <parameter type-id='type-id-16' name='m' filepath='Objects/moduleobject.c' line='532' column='1'/>
+      <return type-id='type-id-3'/>
+    </function-decl>
+    <function-decl name='PyModule_GetName' mangled-name='PyModule_GetName' filepath='Objects/moduleobject.c' line='498' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyModule_GetName'>
+      <parameter type-id='type-id-16' name='m' filepath='Objects/moduleobject.c' line='498' column='1'/>
+      <return type-id='type-id-3'/>
+    </function-decl>
+    <function-decl name='PyModule_GetDict' mangled-name='PyModule_GetDict' filepath='Objects/moduleobject.c' line='465' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyModule_GetDict'>
+      <parameter type-id='type-id-16' name='mp' filepath='Objects/dictobject.c' line='2872' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyModule_SetDocString' mangled-name='PyModule_SetDocString' filepath='Objects/moduleobject.c' line='451' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyModule_SetDocString'>
+      <parameter type-id='type-id-16' name='m' filepath='Objects/moduleobject.c' line='451' column='1'/>
+      <parameter type-id='type-id-3' name='doc' filepath='Objects/moduleobject.c' line='451' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyModule_AddFunctions' mangled-name='PyModule_AddFunctions' filepath='Objects/moduleobject.c' line='437' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyModule_AddFunctions'>
+      <parameter type-id='type-id-16' name='m' filepath='Objects/moduleobject.c' line='437' column='1'/>
+      <parameter type-id='type-id-435' name='functions' filepath='Objects/moduleobject.c' line='437' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyModule_ExecDef' mangled-name='PyModule_ExecDef' filepath='Objects/moduleobject.c' line='372' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyModule_ExecDef'>
+      <parameter type-id='type-id-16' name='module' filepath='Objects/moduleobject.c' line='372' column='1'/>
+      <parameter type-id='type-id-466' name='def' filepath='Objects/moduleobject.c' line='372' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyModule_FromDefAndSpec2' mangled-name='PyModule_FromDefAndSpec2' filepath='Objects/moduleobject.c' line='248' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyModule_FromDefAndSpec2'>
+      <parameter type-id='type-id-466' name='def' filepath='Objects/moduleobject.c' line='248' column='1'/>
+      <parameter type-id='type-id-16' name='spec' filepath='Objects/moduleobject.c' line='248' column='1'/>
+      <parameter type-id='type-id-9' name='module_api_version' filepath='Objects/moduleobject.c' line='248' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyModule_CreateInitialized' mangled-name='_PyModule_CreateInitialized' filepath='Objects/moduleobject.c' line='185' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyModule_CreateInitialized'>
+      <parameter type-id='type-id-466' name='module' filepath='Objects/moduleobject.c' line='185' column='1'/>
+      <parameter type-id='type-id-9' name='module_api_version' filepath='Objects/moduleobject.c' line='185' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyModule_Create2' mangled-name='PyModule_Create2' filepath='Objects/moduleobject.c' line='174' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyModule_Create2'>
+      <parameter type-id='type-id-466' name='module' filepath='Objects/moduleobject.c' line='174' column='1'/>
+      <parameter type-id='type-id-9' name='module_api_version' filepath='Objects/moduleobject.c' line='174' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyModule_New' mangled-name='PyModule_New' filepath='Objects/moduleobject.c' line='114' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyModule_New'>
+      <parameter type-id='type-id-3' name='utf8path' filepath='Objects/fileobject.c' line='562' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyModule_NewObject' mangled-name='PyModule_NewObject' filepath='Objects/moduleobject.c' line='92' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyModule_NewObject'>
+      <parameter type-id='type-id-16' name='name' filepath='Objects/moduleobject.c' line='92' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyModuleDef_Init' mangled-name='PyModuleDef_Init' filepath='Objects/moduleobject.c' line='47' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyModuleDef_Init'>
+      <parameter type-id='type-id-466' name='def' filepath='Objects/moduleobject.c' line='47' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyModule_GetNameObject' mangled-name='PyModule_GetNameObject' filepath='Objects/moduleobject.c' line='475' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyModule_GetNameObject'>
+      <parameter type-id='type-id-16' name='m' filepath='Objects/moduleobject.c' line='475' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyModule_GetFilenameObject' mangled-name='PyModule_GetFilenameObject' filepath='Objects/moduleobject.c' line='508' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyModule_GetFilenameObject'>
+      <parameter type-id='type-id-16' name='m' filepath='Objects/moduleobject.c' line='508' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyDict_ContainsId' mangled-name='_PyDict_ContainsId' filepath='./Include/cpython/dictobject.h' line='50' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyDict_DelItemId' mangled-name='_PyDict_DelItemId' filepath='./Include/cpython/dictobject.h' line='69' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PySys_FormatStderr' mangled-name='PySys_FormatStderr' filepath='./Include/sysmodule.h' line='22' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='strrchr' mangled-name='strrchr' filepath='/usr/include/string.h' line='253' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyImport_IsInitialized' mangled-name='_PyImport_IsInitialized' filepath='./Include/cpython/import.h' line='7' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-type size-in-bits='64' id='type-id-463'>
+      <return type-id='type-id-16'/>
+    </function-type>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/namespaceobject.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='_PyNamespace_Type' type-id='type-id-149' mangled-name='_PyNamespace_Type' visibility='default' filepath='./Include/namespaceobject.h' line='11' column='1' elf-symbol-id='_PyNamespace_Type'/>
+    <function-decl name='_PyNamespace_New' mangled-name='_PyNamespace_New' filepath='Objects/namespaceobject.c' line='247' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyNamespace_New'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/cellobject.c' line='7' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyDict_Update' mangled-name='PyDict_Update' filepath='./Include/dictobject.h' line='37' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/object.c' comp-dir-path='/src' language='LANG_C99'>
+
+    <array-type-def dimensions='1' type-id='type-id-9' size-in-bits='infinite' id='type-id-467'>
+      <subrange length='infinite' id='type-id-7'/>
+
+    </array-type-def>
+    <var-decl name='_Py_SwappedOp' type-id='type-id-467' mangled-name='_Py_SwappedOp' visibility='default' filepath='./Include/cpython/object.h' line='387' column='1' elf-symbol-id='_Py_SwappedOp'/>
+    <var-decl name='_PyNone_Type' type-id='type-id-149' mangled-name='_PyNone_Type' visibility='default' filepath='./Include/cpython/object.h' line='381' column='1' elf-symbol-id='_PyNone_Type'/>
+    <var-decl name='_Py_NoneStruct' type-id='type-id-69' mangled-name='_Py_NoneStruct' visibility='default' filepath='./Include/object.h' line='605' column='1' elf-symbol-id='_Py_NoneStruct'/>
+    <var-decl name='_PyNotImplemented_Type' type-id='type-id-149' mangled-name='_PyNotImplemented_Type' visibility='default' filepath='./Include/cpython/object.h' line='382' column='1' elf-symbol-id='_PyNotImplemented_Type'/>
+    <var-decl name='_Py_NotImplementedStruct' type-id='type-id-69' mangled-name='_Py_NotImplementedStruct' visibility='default' filepath='./Include/object.h' line='619' column='1' elf-symbol-id='_Py_NotImplementedStruct'/>
+    <function-decl name='Py_IsFalse' mangled-name='Py_IsFalse' filepath='Objects/object.c' line='2337' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_IsFalse'>
+      <parameter type-id='type-id-16' name='x' filepath='Objects/object.c' line='2337' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='Py_IsTrue' mangled-name='Py_IsTrue' filepath='Objects/object.c' line='2332' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_IsTrue'>
+      <parameter type-id='type-id-16' name='x' filepath='Objects/object.c' line='2337' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='Py_IsNone' mangled-name='Py_IsNone' filepath='Objects/object.c' line='2327' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_IsNone'>
+      <parameter type-id='type-id-16' name='x' filepath='Objects/object.c' line='2337' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='Py_Is' mangled-name='Py_Is' filepath='Objects/object.c' line='2322' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_Is'>
+      <parameter type-id='type-id-16' name='x' filepath='Objects/object.c' line='2322' column='1'/>
+      <parameter type-id='type-id-16' name='y' filepath='Objects/object.c' line='2322' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='Py_XNewRef' mangled-name='Py_XNewRef' filepath='Objects/object.c' line='2310' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_XNewRef'>
+      <parameter type-id='type-id-16' name='im' filepath='Objects/classobject.c' line='390' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyObject_GET_WEAKREFS_LISTPTR' mangled-name='PyObject_GET_WEAKREFS_LISTPTR' filepath='Objects/object.c' line='2293' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_GET_WEAKREFS_LISTPTR'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/object.c' line='2293' column='1'/>
+      <return type-id='type-id-86'/>
+    </function-decl>
+    <function-decl name='_Py_Dealloc' mangled-name='_Py_Dealloc' filepath='Objects/object.c' line='2282' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_Dealloc'>
+      <parameter type-id='type-id-16' name='m' filepath='Objects/moduleobject.c' line='565' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObject_AssertFailed' mangled-name='_PyObject_AssertFailed' filepath='Objects/object.c' line='2226' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_AssertFailed'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/object.c' line='2226' column='1'/>
+      <parameter type-id='type-id-3' name='expr' filepath='Objects/object.c' line='2226' column='1'/>
+      <parameter type-id='type-id-3' name='msg' filepath='Objects/object.c' line='2226' column='1'/>
+      <parameter type-id='type-id-3' name='file' filepath='Objects/object.c' line='2227' column='1'/>
+      <parameter type-id='type-id-9' name='line' filepath='Objects/object.c' line='2227' column='1'/>
+      <parameter type-id='type-id-3' name='function' filepath='Objects/object.c' line='2227' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTrash_cond' mangled-name='_PyTrash_cond' filepath='Objects/object.c' line='2219' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTrash_cond'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/object.c' line='2219' column='1'/>
+      <parameter type-id='type-id-38' name='dealloc' filepath='Objects/object.c' line='2219' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <class-decl name='_pycontextobject' size-in-bits='384' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_context.h' line='10' column='1' id='type-id-399'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='ob_base' type-id='type-id-69' visibility='default' filepath='./Include/internal/pycore_context.h' line='11' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='ctx_prev' type-id='type-id-398' visibility='default' filepath='./Include/internal/pycore_context.h' line='12' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='ctx_vars' type-id='type-id-468' visibility='default' filepath='./Include/internal/pycore_context.h' line='13' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='ctx_weakreflist' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_context.h' line='14' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='ctx_entered' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_context.h' line='15' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='320' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-469' visibility='default' filepath='./Include/internal/pycore_hamt.h' line='21' column='1' id='type-id-470'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='ob_base' type-id='type-id-69' visibility='default' filepath='./Include/internal/pycore_hamt.h' line='22' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='h_root' type-id='type-id-471' visibility='default' filepath='./Include/internal/pycore_hamt.h' line='23' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='h_weakreflist' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_hamt.h' line='24' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='h_count' type-id='type-id-31' visibility='default' filepath='./Include/internal/pycore_hamt.h' line='25' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='128' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-472' visibility='default' filepath='./Include/internal/pycore_hamt.h' line='15' column='1' id='type-id-473'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='ob_base' type-id='type-id-69' visibility='default' filepath='./Include/internal/pycore_hamt.h' line='16' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='PyHamtNode' type-id='type-id-473' filepath='./Include/internal/pycore_hamt.h' line='17' column='1' id='type-id-472'/>
+    <pointer-type-def type-id='type-id-472' size-in-bits='64' id='type-id-471'/>
+    <typedef-decl name='PyHamtObject' type-id='type-id-470' filepath='./Include/internal/pycore_hamt.h' line='26' column='1' id='type-id-469'/>
+    <pointer-type-def type-id='type-id-469' size-in-bits='64' id='type-id-468'/>
+    <function-decl name='_PyTrash_end' mangled-name='_PyTrash_end' filepath='Objects/object.c' line='2207' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTrash_end'>
+      <parameter type-id='type-id-331' name='tstate' filepath='Objects/object.c' line='2207' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTrash_begin' mangled-name='_PyTrash_begin' filepath='Objects/object.c' line='2193' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTrash_begin'>
+      <parameter type-id='type-id-331' name='tstate' filepath='Objects/object.c' line='2193' column='1'/>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/object.c' line='2193' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyTrash_thread_destroy_chain' mangled-name='_PyTrash_thread_destroy_chain' filepath='Objects/object.c' line='2155' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTrash_thread_destroy_chain'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTrash_destroy_chain' mangled-name='_PyTrash_destroy_chain' filepath='Objects/object.c' line='2128' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTrash_destroy_chain'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTrash_thread_deposit_object' mangled-name='_PyTrash_thread_deposit_object' filepath='Objects/object.c' line='2114' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTrash_thread_deposit_object'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/object.c' line='2114' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTrash_deposit_object' mangled-name='_PyTrash_deposit_object' filepath='Objects/object.c' line='2100' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTrash_deposit_object'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/object.c' line='2100' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='Py_ReprLeave' mangled-name='Py_ReprLeave' filepath='Objects/object.c' line='2062' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_ReprLeave'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/object.c' line='2062' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='Py_ReprEnter' mangled-name='Py_ReprEnter' filepath='Objects/object.c' line='2028' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_ReprEnter'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/object.c' line='2028' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyObject_DebugTypeStats' mangled-name='_PyObject_DebugTypeStats' filepath='Objects/object.c' line='2006' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_DebugTypeStats'>
+      <parameter type-id='type-id-188' name='out' filepath='Objects/object.c' line='2006' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_NewReference' mangled-name='_Py_NewReference' filepath='Objects/object.c' line='1891' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_NewReference'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/object.c' line='1891' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_Dir' mangled-name='PyObject_Dir' filepath='Objects/object.c' line='1547' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_Dir'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/object.c' line='1547' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyCallable_Check' mangled-name='PyCallable_Check' filepath='Objects/object.c' line='1475' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCallable_Check'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='2310' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyObject_Not' mangled-name='PyObject_Not' filepath='Objects/object.c' line='1463' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_Not'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/object.c' line='1463' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyObject_GenericSetDict' mangled-name='PyObject_GenericSetDict' filepath='Objects/object.c' line='1407' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_GenericSetDict'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/object.c' line='1407' column='1'/>
+      <parameter type-id='type-id-16' name='value' filepath='Objects/object.c' line='1407' column='1'/>
+      <parameter type-id='type-id-21' name='context' filepath='Objects/object.c' line='1407' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyObject_GenericSetAttr' mangled-name='PyObject_GenericSetAttr' filepath='Objects/object.c' line='1401' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_GenericSetAttr'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/object.c' line='1401' column='1'/>
+      <parameter type-id='type-id-16' name='name' filepath='Objects/object.c' line='1401' column='1'/>
+      <parameter type-id='type-id-16' name='value' filepath='Objects/object.c' line='1401' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyObject_GenericSetAttrWithDict' mangled-name='_PyObject_GenericSetAttrWithDict' filepath='Objects/object.c' line='1326' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_GenericSetAttrWithDict'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/object.c' line='1326' column='1'/>
+      <parameter type-id='type-id-16' name='name' filepath='Objects/object.c' line='1326' column='1'/>
+      <parameter type-id='type-id-16' name='value' filepath='Objects/object.c' line='1327' column='1'/>
+      <parameter type-id='type-id-16' name='dict' filepath='Objects/object.c' line='1327' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyObject_GenericGetAttr' mangled-name='PyObject_GenericGetAttr' filepath='Objects/object.c' line='1320' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_GenericGetAttr'>
+      <parameter type-id='type-id-16' name='code' filepath='Objects/funcobject.c' line='96' column='1'/>
+      <parameter type-id='type-id-16' name='globals' filepath='Objects/funcobject.c' line='96' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyObject_GenericGetAttrWithDict' mangled-name='_PyObject_GenericGetAttrWithDict' filepath='Objects/object.c' line='1207' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_GenericGetAttrWithDict'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/object.c' line='1207' column='1'/>
+      <parameter type-id='type-id-16' name='name' filepath='Objects/object.c' line='1207' column='1'/>
+      <parameter type-id='type-id-16' name='dict' filepath='Objects/object.c' line='1208' column='1'/>
+      <parameter type-id='type-id-9' name='suppress' filepath='Objects/object.c' line='1208' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyObject_GetMethod' mangled-name='_PyObject_GetMethod' filepath='Objects/object.c' line='1125' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_GetMethod'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/object.c' line='1125' column='1'/>
+      <parameter type-id='type-id-16' name='name' filepath='Objects/object.c' line='1125' column='1'/>
+      <parameter type-id='type-id-86' name='method' filepath='Objects/object.c' line='1125' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyObject_NextNotImplemented' mangled-name='_PyObject_NextNotImplemented' filepath='Objects/object.c' line='1105' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_NextNotImplemented'>
+      <parameter type-id='type-id-16' name='im' filepath='Objects/classobject.c' line='25' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyObject_GetDictPtr' mangled-name='_PyObject_GetDictPtr' filepath='Objects/object.c' line='1070' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_GetDictPtr'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/object.c' line='1070' column='1'/>
+      <return type-id='type-id-86'/>
+    </function-decl>
+    <function-decl name='PyObject_SetAttr' mangled-name='PyObject_SetAttr' filepath='Objects/object.c' line='1019' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_SetAttr'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/object.c' line='1019' column='1'/>
+      <parameter type-id='type-id-16' name='name' filepath='Objects/object.c' line='1019' column='1'/>
+      <parameter type-id='type-id-16' name='value' filepath='Objects/object.c' line='1019' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyObject_HasAttr' mangled-name='PyObject_HasAttr' filepath='Objects/object.c' line='1004' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_HasAttr'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/object.c' line='1004' column='1'/>
+      <parameter type-id='type-id-16' name='name' filepath='Objects/object.c' line='1004' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyObject_LookupAttrId' mangled-name='_PyObject_LookupAttrId' filepath='Objects/object.c' line='993' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_LookupAttrId'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/object.c' line='993' column='1'/>
+      <parameter type-id='type-id-453' name='name' filepath='Objects/object.c' line='993' column='1'/>
+      <parameter type-id='type-id-86' name='result' filepath='Objects/object.c' line='993' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyObject_LookupAttr' mangled-name='_PyObject_LookupAttr' filepath='Objects/object.c' line='944' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_LookupAttr'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/object.c' line='944' column='1'/>
+      <parameter type-id='type-id-16' name='name' filepath='Objects/object.c' line='944' column='1'/>
+      <parameter type-id='type-id-86' name='result' filepath='Objects/object.c' line='944' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyObject_GetAttr' mangled-name='PyObject_GetAttr' filepath='Objects/object.c' line='910' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_GetAttr'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/object.c' line='910' column='1'/>
+      <parameter type-id='type-id-16' name='name' filepath='Objects/object.c' line='910' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyObject_SetAttrId' mangled-name='_PyObject_SetAttrId' filepath='Objects/object.c' line='877' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_SetAttrId'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/object.c' line='877' column='1'/>
+      <parameter type-id='type-id-453' name='name' filepath='Objects/object.c' line='877' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/object.c' line='877' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyObject_GetAttrId' mangled-name='_PyObject_GetAttrId' filepath='Objects/object.c' line='866' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_GetAttrId'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/object.c' line='866' column='1'/>
+      <parameter type-id='type-id-453' name='name' filepath='Objects/object.c' line='866' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyObject_IsAbstract' mangled-name='_PyObject_IsAbstract' filepath='Objects/object.c' line='849' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_IsAbstract'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/object.c' line='849' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyObject_SetAttrString' mangled-name='PyObject_SetAttrString' filepath='Objects/object.c' line='833' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_SetAttrString'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/object.c' line='833' column='1'/>
+      <parameter type-id='type-id-3' name='name' filepath='Objects/object.c' line='833' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/object.c' line='833' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyObject_HasAttrString' mangled-name='PyObject_HasAttrString' filepath='Objects/object.c' line='821' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_HasAttrString'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='2385' column='1'/>
+      <parameter type-id='type-id-3' name='key' filepath='Objects/abstract.c' line='2385' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyObject_Hash' mangled-name='PyObject_Hash' filepath='Objects/object.c' line='785' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_Hash'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/object.c' line='785' column='1'/>
+      <return type-id='type-id-117'/>
+    </function-decl>
+    <function-decl name='PyObject_HashNotImplemented' mangled-name='PyObject_HashNotImplemented' filepath='Objects/object.c' line='777' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_HashNotImplemented'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/object.c' line='777' column='1'/>
+      <return type-id='type-id-117'/>
+    </function-decl>
+    <function-decl name='PyObject_RichCompareBool' mangled-name='PyObject_RichCompareBool' filepath='Objects/object.c' line='751' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_RichCompareBool'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/object.c' line='751' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/object.c' line='751' column='1'/>
+      <parameter type-id='type-id-9' name='op' filepath='Objects/object.c' line='751' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyObject_RichCompare' mangled-name='PyObject_RichCompare' filepath='Objects/object.c' line='729' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_RichCompare'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/object.c' line='729' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/object.c' line='729' column='1'/>
+      <parameter type-id='type-id-9' name='op' filepath='Objects/object.c' line='729' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyObject_FunctionStr' mangled-name='_PyObject_FunctionStr' filepath='Objects/object.c' line='597' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_FunctionStr'>
+      <parameter type-id='type-id-16' name='x' filepath='Objects/object.c' line='597' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyObject_Bytes' mangled-name='PyObject_Bytes' filepath='Objects/object.c' line='549' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_Bytes'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/object.c' line='549' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyObject_ASCII' mangled-name='PyObject_ASCII' filepath='Objects/object.c' line='522' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_ASCII'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='2827' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyObject_IsFreed' mangled-name='_PyObject_IsFreed' filepath='Objects/object.c' line='347' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_IsFreed'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/object.c' line='347' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_Py_BreakPoint' mangled-name='_Py_BreakPoint' filepath='Objects/object.c' line='335' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_BreakPoint'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_Print' mangled-name='PyObject_Print' filepath='Objects/object.c' line='264' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_Print'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/object.c' line='264' column='1'/>
+      <parameter type-id='type-id-188' name='fp' filepath='Objects/object.c' line='264' column='1'/>
+      <parameter type-id='type-id-9' name='flags' filepath='Objects/object.c' line='264' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyObject_CallFinalizerFromDealloc' mangled-name='PyObject_CallFinalizerFromDealloc' filepath='Objects/object.c' line='222' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_CallFinalizerFromDealloc'>
+      <parameter type-id='type-id-16' name='self' filepath='Objects/object.c' line='222' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyObject_CallFinalizer' mangled-name='PyObject_CallFinalizer' filepath='Objects/object.c' line='205' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_CallFinalizer'>
+      <parameter type-id='type-id-16' name='self' filepath='Objects/object.c' line='205' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <pointer-type-def type-id='type-id-37' size-in-bits='64' id='type-id-474'/>
+    <function-decl name='_PyObject_NewVar' mangled-name='_PyObject_NewVar' filepath='Objects/object.c' line='192' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_NewVar'>
+      <parameter type-id='type-id-32' name='tp' filepath='Objects/object.c' line='192' column='1'/>
+      <parameter type-id='type-id-31' name='nitems' filepath='Objects/object.c' line='192' column='1'/>
+      <return type-id='type-id-474'/>
+    </function-decl>
+    <function-decl name='_PyObject_New' mangled-name='_PyObject_New' filepath='Objects/object.c' line='181' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_New'>
+      <parameter type-id='type-id-32' name='tp' filepath='Objects/object.c' line='181' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyObject_InitVar' mangled-name='PyObject_InitVar' filepath='Objects/object.c' line='170' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_InitVar'>
+      <parameter type-id='type-id-474' name='op' filepath='Objects/object.c' line='170' column='1'/>
+      <parameter type-id='type-id-32' name='tp' filepath='Objects/object.c' line='170' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/object.c' line='170' column='1'/>
+      <return type-id='type-id-474'/>
+    </function-decl>
+    <function-decl name='PyObject_Init' mangled-name='PyObject_Init' filepath='Objects/object.c' line='159' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_Init'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/object.c' line='159' column='1'/>
+      <parameter type-id='type-id-32' name='tp' filepath='Objects/object.c' line='159' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_Py_DecRef' mangled-name='_Py_DecRef' filepath='Objects/object.c' line='153' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_DecRef'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/object.c' line='153' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_IncRef' mangled-name='_Py_IncRef' filepath='Objects/object.c' line='147' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_IncRef'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/object.c' line='153' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='Py_DecRef' mangled-name='Py_DecRef' filepath='Objects/object.c' line='141' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_DecRef'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/object.c' line='153' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='Py_IncRef' mangled-name='Py_IncRef' filepath='Objects/object.c' line='135' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_IncRef'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/object.c' line='153' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObject_CheckConsistency' mangled-name='_PyObject_CheckConsistency' filepath='Objects/object.c' line='37' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_CheckConsistency'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/object.c' line='37' column='1'/>
+      <parameter type-id='type-id-9' name='check_content' filepath='Objects/object.c' line='37' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyObject_SelfIter' mangled-name='PyObject_SelfIter' filepath='Objects/object.c' line='1093' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_SelfIter'>
+      <parameter type-id='type-id-16' name='im' filepath='Objects/classobject.c' line='390' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyObject_IsTrue' mangled-name='PyObject_IsTrue' filepath='Objects/object.c' line='1435' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_IsTrue'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='830' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyObject_Repr' mangled-name='PyObject_Repr' filepath='Objects/object.c' line='409' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_Repr'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/object.c' line='409' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyObject_Str' mangled-name='PyObject_Str' filepath='Objects/object.c' line='462' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_Str'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/object.c' line='462' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyObject_Dump' mangled-name='_PyObject_Dump' filepath='Objects/object.c' line='368' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_Dump'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/object.c' line='368' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_GetAttrString' mangled-name='PyObject_GetAttrString' filepath='Objects/object.c' line='806' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_GetAttrString'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/object.c' line='806' column='1'/>
+      <parameter type-id='type-id-3' name='name' filepath='Objects/object.c' line='806' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyMem_DumpTraceback' mangled-name='_PyMem_DumpTraceback' filepath='Objects/object.c' line='28' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyThreadState_GetDict' mangled-name='PyThreadState_GetDict' filepath='./Include/pystate.h' line='84' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyDict_DebugMallocStats' mangled-name='_PyDict_DebugMallocStats' filepath='./Include/cpython/dictobject.h' line='70' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyFloat_DebugMallocStats' mangled-name='_PyFloat_DebugMallocStats' filepath='./Include/floatobject.h' line='103' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyFrame_DebugMallocStats' mangled-name='_PyFrame_DebugMallocStats' filepath='./Include/cpython/frameobject.h' line='92' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyList_DebugMallocStats' mangled-name='_PyList_DebugMallocStats' filepath='./Include/cpython/listobject.h' line='25' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTuple_DebugMallocStats' mangled-name='_PyTuple_DebugMallocStats' filepath='./Include/cpython/tupleobject.h' line='28' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTraceMalloc_NewReference' mangled-name='_PyTraceMalloc_NewReference' filepath='./Include/internal/pycore_object.h' line='22' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTypes_InitSlotDefs' mangled-name='_PyTypes_InitSlotDefs' filepath='./Include/internal/pycore_pylifecycle.h' line='76' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyList_Sort' mangled-name='PyList_Sort' filepath='./Include/listobject.h' line='39' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyEval_GetLocals' mangled-name='PyEval_GetLocals' filepath='./Include/ceval.h' line='33' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyDict_DelItem' mangled-name='PyDict_DelItem' filepath='./Include/dictobject.h' line='25' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObjectDict_SetItem' mangled-name='_PyObjectDict_SetItem' filepath='./Include/cpython/dictobject.h' line='72' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyDescr_IsData' mangled-name='PyDescr_IsData' filepath='./Include/descrobject.h' line='96' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyBytes_FromObject' mangled-name='PyBytes_FromObject' filepath='./Include/bytesobject.h' line='36' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_AsASCIIString' mangled-name='_PyUnicode_AsASCIIString' filepath='./Include/cpython/unicodeobject.h' line='891' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_DecodeASCII' mangled-name='PyUnicode_DecodeASCII' filepath='./Include/unicodeobject.h' line='650' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='fwrite' mangled-name='fwrite' filepath='/usr/include/stdio.h' line='652' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='ferror' mangled-name='ferror' filepath='/usr/include/stdio.h' line='761' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyType_CheckConsistency' mangled-name='_PyType_CheckConsistency' filepath='./Include/internal/pycore_object.h' line='15' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyDict_CheckConsistency' mangled-name='_PyDict_CheckConsistency' filepath='./Include/internal/pycore_object.h' line='16' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_CheckConsistency' mangled-name='_PyUnicode_CheckConsistency' filepath='./Include/cpython/unicodeobject.h' line='246' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyGILState_Ensure' mangled-name='PyGILState_Ensure' filepath='./Include/pystate.h' line='120' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyGILState_Release' mangled-name='PyGILState_Release' filepath='./Include/pystate.h' line='130' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/obmalloc.c' comp-dir-path='/src' language='LANG_C99'>
+    <class-decl name='_PyTraceMalloc_Config' size-in-bits='96' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_pymem.h' line='72' column='1' id='type-id-475'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='initialized' type-id='type-id-476' visibility='default' filepath='./Include/internal/pycore_pymem.h' line='79' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='32'>
+        <var-decl name='tracing' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_pymem.h' line='83' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='max_nframe' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_pymem.h' line='87' column='1'/>
+      </data-member>
+    </class-decl>
+    <enum-decl name='__anonymous_enum__' is-anonymous='yes' filepath='./Include/internal/pycore_pymem.h' line='75' column='1' id='type-id-476'>
+      <underlying-type type-id='type-id-83'/>
+      <enumerator name='TRACEMALLOC_NOT_INITIALIZED' value='0'/>
+      <enumerator name='TRACEMALLOC_INITIALIZED' value='1'/>
+      <enumerator name='TRACEMALLOC_FINALIZED' value='2'/>
+    </enum-decl>
+    <var-decl name='_Py_tracemalloc_config' type-id='type-id-475' mangled-name='_Py_tracemalloc_config' visibility='default' filepath='./Include/internal/pycore_pymem.h' line='95' column='1' elf-symbol-id='_Py_tracemalloc_config'/>
+    <function-decl name='_PyDebugAllocatorStats' mangled-name='_PyDebugAllocatorStats' filepath='Objects/obmalloc.c' line='2866' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyDebugAllocatorStats'>
+      <parameter type-id='type-id-188' name='out' filepath='Objects/obmalloc.c' line='2866' column='1'/>
+      <parameter type-id='type-id-3' name='block_name' filepath='Objects/obmalloc.c' line='2867' column='1'/>
+      <parameter type-id='type-id-9' name='num_blocks' filepath='Objects/obmalloc.c' line='2867' column='1'/>
+      <parameter type-id='type-id-157' name='sizeof_block' filepath='Objects/obmalloc.c' line='2867' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_GetAllocatedBlocks' mangled-name='_Py_GetAllocatedBlocks' filepath='Objects/obmalloc.c' line='1246' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_GetAllocatedBlocks'>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='PyObject_Free' mangled-name='PyObject_Free' filepath='Objects/obmalloc.c' line='707' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_Free'>
+      <parameter type-id='type-id-21' name='ptr' filepath='Objects/obmalloc.c' line='707' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_Realloc' mangled-name='PyObject_Realloc' filepath='Objects/obmalloc.c' line='698' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_Realloc'>
+      <parameter type-id='type-id-21' name='ptr' filepath='Objects/obmalloc.c' line='698' column='1'/>
+      <parameter type-id='type-id-157' name='new_size' filepath='Objects/obmalloc.c' line='698' column='1'/>
+      <return type-id='type-id-21'/>
+    </function-decl>
+    <function-decl name='PyObject_Calloc' mangled-name='PyObject_Calloc' filepath='Objects/obmalloc.c' line='689' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_Calloc'>
+      <parameter type-id='type-id-157' name='nelem' filepath='Objects/obmalloc.c' line='689' column='1'/>
+      <parameter type-id='type-id-157' name='elsize' filepath='Objects/obmalloc.c' line='689' column='1'/>
+      <return type-id='type-id-21'/>
+    </function-decl>
+    <function-decl name='PyObject_Malloc' mangled-name='PyObject_Malloc' filepath='Objects/obmalloc.c' line='680' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_Malloc'>
+      <parameter type-id='type-id-157' name='size' filepath='Objects/obmalloc.c' line='680' column='1'/>
+      <return type-id='type-id-21'/>
+    </function-decl>
+    <function-decl name='_PyMem_Strdup' mangled-name='_PyMem_Strdup' filepath='Objects/obmalloc.c' line='667' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyMem_Strdup'>
+      <parameter type-id='type-id-3' name='str' filepath='Objects/obmalloc.c' line='667' column='1'/>
+      <return type-id='type-id-72'/>
+    </function-decl>
+    <function-decl name='_PyMem_RawStrdup' mangled-name='_PyMem_RawStrdup' filepath='Objects/obmalloc.c' line='654' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyMem_RawStrdup'>
+      <parameter type-id='type-id-3' name='str' filepath='Objects/obmalloc.c' line='667' column='1'/>
+      <return type-id='type-id-72'/>
+    </function-decl>
+    <qualified-type-def type-id='type-id-327' const='yes' id='type-id-477'/>
+    <pointer-type-def type-id='type-id-477' size-in-bits='64' id='type-id-478'/>
+    <function-decl name='_PyMem_RawWcsdup' mangled-name='_PyMem_RawWcsdup' filepath='Objects/obmalloc.c' line='634' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyMem_RawWcsdup'>
+      <parameter type-id='type-id-478' name='str' filepath='Objects/obmalloc.c' line='634' column='1'/>
+      <return type-id='type-id-325'/>
+    </function-decl>
+    <function-decl name='PyMem_Free' mangled-name='PyMem_Free' filepath='Objects/obmalloc.c' line='627' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMem_Free'>
+      <parameter type-id='type-id-21' name='ptr' filepath='Objects/obmalloc.c' line='707' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyMem_Realloc' mangled-name='PyMem_Realloc' filepath='Objects/obmalloc.c' line='618' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMem_Realloc'>
+      <parameter type-id='type-id-21' name='ptr' filepath='Objects/obmalloc.c' line='698' column='1'/>
+      <parameter type-id='type-id-157' name='new_size' filepath='Objects/obmalloc.c' line='698' column='1'/>
+      <return type-id='type-id-21'/>
+    </function-decl>
+    <function-decl name='PyMem_Calloc' mangled-name='PyMem_Calloc' filepath='Objects/obmalloc.c' line='609' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMem_Calloc'>
+      <parameter type-id='type-id-157' name='nelem' filepath='Objects/obmalloc.c' line='689' column='1'/>
+      <parameter type-id='type-id-157' name='elsize' filepath='Objects/obmalloc.c' line='689' column='1'/>
+      <return type-id='type-id-21'/>
+    </function-decl>
+    <function-decl name='PyMem_Malloc' mangled-name='PyMem_Malloc' filepath='Objects/obmalloc.c' line='600' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMem_Malloc'>
+      <parameter type-id='type-id-157' name='size' filepath='Objects/obmalloc.c' line='680' column='1'/>
+      <return type-id='type-id-21'/>
+    </function-decl>
+    <function-decl name='PyMem_RawFree' mangled-name='PyMem_RawFree' filepath='Objects/obmalloc.c' line='593' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMem_RawFree'>
+      <parameter type-id='type-id-21' name='ptr' filepath='Objects/obmalloc.c' line='707' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyMem_RawRealloc' mangled-name='PyMem_RawRealloc' filepath='Objects/obmalloc.c' line='585' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMem_RawRealloc'>
+      <parameter type-id='type-id-21' name='ptr' filepath='Objects/obmalloc.c' line='698' column='1'/>
+      <parameter type-id='type-id-157' name='new_size' filepath='Objects/obmalloc.c' line='698' column='1'/>
+      <return type-id='type-id-21'/>
+    </function-decl>
+    <function-decl name='PyMem_RawCalloc' mangled-name='PyMem_RawCalloc' filepath='Objects/obmalloc.c' line='576' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMem_RawCalloc'>
+      <parameter type-id='type-id-157' name='nelem' filepath='Objects/obmalloc.c' line='689' column='1'/>
+      <parameter type-id='type-id-157' name='elsize' filepath='Objects/obmalloc.c' line='689' column='1'/>
+      <return type-id='type-id-21'/>
+    </function-decl>
+    <function-decl name='PyMem_RawMalloc' mangled-name='PyMem_RawMalloc' filepath='Objects/obmalloc.c' line='562' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMem_RawMalloc'>
+      <parameter type-id='type-id-157' name='size' filepath='Objects/obmalloc.c' line='680' column='1'/>
+      <return type-id='type-id-21'/>
+    </function-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-479' visibility='default' filepath='./Include/cpython/objimpl.h' line='64' column='1' id='type-id-480'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='ctx' type-id='type-id-21' visibility='default' filepath='./Include/cpython/objimpl.h' line='66' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='alloc' type-id='type-id-481' visibility='default' filepath='./Include/cpython/objimpl.h' line='69' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='free' type-id='type-id-482' visibility='default' filepath='./Include/cpython/objimpl.h' line='72' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-483' size-in-bits='64' id='type-id-481'/>
+    <pointer-type-def type-id='type-id-484' size-in-bits='64' id='type-id-482'/>
+    <typedef-decl name='PyObjectArenaAllocator' type-id='type-id-480' filepath='./Include/cpython/objimpl.h' line='73' column='1' id='type-id-479'/>
+    <pointer-type-def type-id='type-id-479' size-in-bits='64' id='type-id-485'/>
+    <function-decl name='PyObject_SetArenaAllocator' mangled-name='PyObject_SetArenaAllocator' filepath='Objects/obmalloc.c' line='556' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_SetArenaAllocator'>
+      <parameter type-id='type-id-485' name='allocator' filepath='Objects/obmalloc.c' line='556' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_GetArenaAllocator' mangled-name='PyObject_GetArenaAllocator' filepath='Objects/obmalloc.c' line='550' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_GetArenaAllocator'>
+      <parameter type-id='type-id-485' name='allocator' filepath='Objects/obmalloc.c' line='556' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyMem_SetupDebugHooks' mangled-name='PyMem_SetupDebugHooks' filepath='Objects/obmalloc.c' line='512' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMem_SetupDebugHooks'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyMem_GetCurrentAllocatorName' mangled-name='_PyMem_GetCurrentAllocatorName' filepath='Objects/obmalloc.c' line='374' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyMem_GetCurrentAllocatorName'>
+      <return type-id='type-id-3'/>
+    </function-decl>
+    <enum-decl name='__anonymous_enum__' is-anonymous='yes' filepath='./Include/cpython/pymem.h' line='34' column='1' id='type-id-486'>
+      <underlying-type type-id='type-id-83'/>
+      <enumerator name='PYMEM_ALLOCATOR_NOT_SET' value='0'/>
+      <enumerator name='PYMEM_ALLOCATOR_DEFAULT' value='1'/>
+      <enumerator name='PYMEM_ALLOCATOR_DEBUG' value='2'/>
+      <enumerator name='PYMEM_ALLOCATOR_MALLOC' value='3'/>
+      <enumerator name='PYMEM_ALLOCATOR_MALLOC_DEBUG' value='4'/>
+      <enumerator name='PYMEM_ALLOCATOR_PYMALLOC' value='5'/>
+      <enumerator name='PYMEM_ALLOCATOR_PYMALLOC_DEBUG' value='6'/>
+    </enum-decl>
+    <typedef-decl name='PyMemAllocatorName' type-id='type-id-486' filepath='./Include/cpython/pymem.h' line='44' column='1' id='type-id-487'/>
+    <pointer-type-def type-id='type-id-487' size-in-bits='64' id='type-id-488'/>
+    <function-decl name='_PyMem_GetAllocatorName' mangled-name='_PyMem_GetAllocatorName' filepath='Objects/obmalloc.c' line='271' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyMem_GetAllocatorName'>
+      <parameter type-id='type-id-3' name='name' filepath='Objects/obmalloc.c' line='271' column='1'/>
+      <parameter type-id='type-id-488' name='allocator' filepath='Objects/obmalloc.c' line='271' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <enum-decl name='__anonymous_enum__' is-anonymous='yes' filepath='./Include/cpython/pymem.h' line='23' column='1' id='type-id-489'>
+      <underlying-type type-id='type-id-83'/>
+      <enumerator name='PYMEM_DOMAIN_RAW' value='0'/>
+      <enumerator name='PYMEM_DOMAIN_MEM' value='1'/>
+      <enumerator name='PYMEM_DOMAIN_OBJ' value='2'/>
+    </enum-decl>
+    <typedef-decl name='PyMemAllocatorDomain' type-id='type-id-489' filepath='./Include/cpython/pymem.h' line='32' column='1' id='type-id-490'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='320' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-491' visibility='default' filepath='./Include/cpython/pymem.h' line='47' column='1' id='type-id-492'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='ctx' type-id='type-id-21' visibility='default' filepath='./Include/cpython/pymem.h' line='49' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='malloc' type-id='type-id-481' visibility='default' filepath='./Include/cpython/pymem.h' line='52' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='calloc' type-id='type-id-493' visibility='default' filepath='./Include/cpython/pymem.h' line='55' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='realloc' type-id='type-id-494' visibility='default' filepath='./Include/cpython/pymem.h' line='58' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='free' type-id='type-id-495' visibility='default' filepath='./Include/cpython/pymem.h' line='61' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-496' size-in-bits='64' id='type-id-493'/>
+    <pointer-type-def type-id='type-id-497' size-in-bits='64' id='type-id-494'/>
+    <pointer-type-def type-id='type-id-498' size-in-bits='64' id='type-id-495'/>
+    <typedef-decl name='PyMemAllocatorEx' type-id='type-id-492' filepath='./Include/cpython/pymem.h' line='62' column='1' id='type-id-491'/>
+    <pointer-type-def type-id='type-id-491' size-in-bits='64' id='type-id-499'/>
+    <function-decl name='_PyMem_SetDefaultAllocator' mangled-name='_PyMem_SetDefaultAllocator' filepath='Objects/obmalloc.c' line='258' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyMem_SetDefaultAllocator'>
+      <parameter type-id='type-id-490' name='domain' filepath='Objects/obmalloc.c' line='258' column='1'/>
+      <parameter type-id='type-id-499' name='old_alloc' filepath='Objects/obmalloc.c' line='259' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyMem_GetAllocator' mangled-name='PyMem_GetAllocator' filepath='Objects/obmalloc.c' line='520' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMem_GetAllocator'>
+      <parameter type-id='type-id-490' name='domain' filepath='Objects/obmalloc.c' line='520' column='1'/>
+      <parameter type-id='type-id-499' name='allocator' filepath='Objects/obmalloc.c' line='520' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyMem_SetAllocator' mangled-name='PyMem_SetAllocator' filepath='Objects/obmalloc.c' line='538' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMem_SetAllocator'>
+      <parameter type-id='type-id-490' name='domain' filepath='Objects/obmalloc.c' line='520' column='1'/>
+      <parameter type-id='type-id-499' name='allocator' filepath='Objects/obmalloc.c' line='520' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObject_DebugMallocStats' mangled-name='_PyObject_DebugMallocStats' filepath='Objects/obmalloc.c' line='2911' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_DebugMallocStats'>
+      <parameter type-id='type-id-188' name='out' filepath='Objects/obmalloc.c' line='2911' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='fputs' mangled-name='fputs' filepath='/usr/include/stdio.h' line='626' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='fputc' mangled-name='fputc' filepath='/usr/include/stdio.h' line='521' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyGILState_Check' mangled-name='PyGILState_Check' filepath='./Include/cpython/pystate.h' line='171' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__builtin___memcpy_chk' mangled-name='__memcpy_chk' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='getenv' mangled-name='getenv' filepath='/usr/include/stdlib.h' line='634' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='wcslen' mangled-name='wcslen' filepath='/usr/include/wchar.h' line='222' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='munmap' mangled-name='munmap' filepath='/usr/include/x86_64-linux-gnu/sys/mman.h' line='76' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='mmap' mangled-name='mmap64' filepath='/usr/include/x86_64-linux-gnu/sys/mman.h' line='61' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='free' mangled-name='free' filepath='/usr/include/stdlib.h' line='565' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='realloc' mangled-name='realloc' filepath='/usr/include/stdlib.h' line='550' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='calloc' mangled-name='calloc' filepath='/usr/include/stdlib.h' line='542' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='malloc' mangled-name='malloc' filepath='/usr/include/stdlib.h' line='539' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-type size-in-bits='64' id='type-id-498'>
+      <parameter type-id='type-id-21'/>
+      <parameter type-id='type-id-21'/>
+      <return type-id='type-id-4'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-484'>
+      <parameter type-id='type-id-21'/>
+      <parameter type-id='type-id-21'/>
+      <parameter type-id='type-id-157'/>
+      <return type-id='type-id-4'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-483'>
+      <parameter type-id='type-id-21'/>
+      <parameter type-id='type-id-157'/>
+      <return type-id='type-id-21'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-496'>
+      <parameter type-id='type-id-21'/>
+      <parameter type-id='type-id-157'/>
+      <parameter type-id='type-id-157'/>
+      <return type-id='type-id-21'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-497'>
+      <parameter type-id='type-id-21'/>
+      <parameter type-id='type-id-21'/>
+      <parameter type-id='type-id-157'/>
+      <return type-id='type-id-21'/>
+    </function-type>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/picklebufobject.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PyPickleBuffer_Type' type-id='type-id-149' mangled-name='PyPickleBuffer_Type' visibility='default' filepath='./Include/cpython/picklebufobject.h' line='13' column='1' elf-symbol-id='PyPickleBuffer_Type'/>
+    <function-decl name='PyPickleBuffer_Release' mangled-name='PyPickleBuffer_Release' filepath='Objects/picklebufobject.c' line='55' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyPickleBuffer_Release'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/picklebufobject.c' line='55' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyPickleBuffer_GetBuffer' mangled-name='PyPickleBuffer_GetBuffer' filepath='Objects/picklebufobject.c' line='36' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyPickleBuffer_GetBuffer'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/picklebufobject.c' line='36' column='1'/>
+      <return type-id='type-id-198'/>
+    </function-decl>
+    <function-decl name='PyPickleBuffer_FromObject' mangled-name='PyPickleBuffer_FromObject' filepath='Objects/picklebufobject.c' line='17' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyPickleBuffer_FromObject'>
+      <parameter type-id='type-id-16' name='base' filepath='Objects/picklebufobject.c' line='17' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyMemoryView_FromObject' mangled-name='PyMemoryView_FromObject' filepath='./Include/memoryobject.h' line='23' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/rangeobject.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PyRange_Type' type-id='type-id-149' mangled-name='PyRange_Type' visibility='default' filepath='./Include/rangeobject.h' line='18' column='1' elf-symbol-id='PyRange_Type'/>
+    <var-decl name='PyRangeIter_Type' type-id='type-id-149' mangled-name='PyRangeIter_Type' visibility='default' filepath='./Include/rangeobject.h' line='19' column='1' elf-symbol-id='PyRangeIter_Type'/>
+    <var-decl name='PyLongRangeIter_Type' type-id='type-id-149' mangled-name='PyLongRangeIter_Type' visibility='default' filepath='./Include/rangeobject.h' line='20' column='1' elf-symbol-id='PyLongRangeIter_Type'/>
+    <function-decl name='PyNumber_Subtract' mangled-name='PyNumber_Subtract' filepath='./Include/abstract.h' line='427' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_Multiply' mangled-name='PyNumber_Multiply' filepath='./Include/abstract.h' line='432' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PySequence_IterSearch' mangled-name='_PySequence_IterSearch' filepath='./Include/cpython/abstract.h' line='350' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_Not' mangled-name='PyObject_Not' filepath='./Include/object.h' line='286' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_Remainder' mangled-name='PyNumber_Remainder' filepath='./Include/abstract.h' line='454' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_FloorDivide' mangled-name='PyNumber_FloorDivide' filepath='./Include/abstract.h' line='443' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PySlice_GetLongIndices' mangled-name='_PySlice_GetLongIndices' filepath='./Include/sliceobject.h' line='37' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/setobject.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PySetIter_Type' type-id='type-id-149' mangled-name='PySetIter_Type' visibility='default' filepath='./Include/setobject.h' line='78' column='1' elf-symbol-id='PySetIter_Type'/>
+    <var-decl name='PySet_Type' type-id='type-id-149' mangled-name='PySet_Type' visibility='default' filepath='./Include/setobject.h' line='76' column='1' elf-symbol-id='PySet_Type'/>
+    <var-decl name='PyFrozenSet_Type' type-id='type-id-149' mangled-name='PyFrozenSet_Type' visibility='default' filepath='./Include/setobject.h' line='77' column='1' elf-symbol-id='PyFrozenSet_Type'/>
+    <var-decl name='_PySet_Dummy' type-id='type-id-16' mangled-name='_PySet_Dummy' visibility='default' filepath='./Include/setobject.h' line='69' column='1' elf-symbol-id='_PySet_Dummy'/>
+    <function-decl name='_PySet_Update' mangled-name='_PySet_Update' filepath='Objects/setobject.c' line='2328' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PySet_Update'>
+      <parameter type-id='type-id-16' name='set' filepath='Objects/setobject.c' line='2328' column='1'/>
+      <parameter type-id='type-id-16' name='iterable' filepath='Objects/setobject.c' line='2328' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PySet_Pop' mangled-name='PySet_Pop' filepath='Objects/setobject.c' line='2318' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySet_Pop'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/listobject.c' line='2504' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PySet_NextEntry' mangled-name='_PySet_NextEntry' filepath='Objects/setobject.c' line='2302' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PySet_NextEntry'>
+      <parameter type-id='type-id-16' name='set' filepath='Objects/setobject.c' line='2302' column='1'/>
+      <parameter type-id='type-id-125' name='pos' filepath='Objects/setobject.c' line='2302' column='1'/>
+      <parameter type-id='type-id-86' name='key' filepath='Objects/setobject.c' line='2302' column='1'/>
+      <parameter type-id='type-id-457' name='hash' filepath='Objects/setobject.c' line='2302' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PySet_Add' mangled-name='PySet_Add' filepath='Objects/setobject.c' line='2291' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySet_Add'>
+      <parameter type-id='type-id-16' name='anyset' filepath='Objects/setobject.c' line='2291' column='1'/>
+      <parameter type-id='type-id-16' name='key' filepath='Objects/setobject.c' line='2291' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PySet_Discard' mangled-name='PySet_Discard' filepath='Objects/setobject.c' line='2281' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySet_Discard'>
+      <parameter type-id='type-id-16' name='set' filepath='Objects/setobject.c' line='2281' column='1'/>
+      <parameter type-id='type-id-16' name='key' filepath='Objects/setobject.c' line='2281' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PySet_Contains' mangled-name='PySet_Contains' filepath='Objects/setobject.c' line='2271' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySet_Contains'>
+      <parameter type-id='type-id-16' name='anyset' filepath='Objects/setobject.c' line='2291' column='1'/>
+      <parameter type-id='type-id-16' name='key' filepath='Objects/setobject.c' line='2291' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PySet_Clear' mangled-name='PySet_Clear' filepath='Objects/setobject.c' line='2261' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySet_Clear'>
+      <parameter type-id='type-id-16' name='set' filepath='Objects/setobject.c' line='2261' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PySet_Size' mangled-name='PySet_Size' filepath='Objects/setobject.c' line='2251' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySet_Size'>
+      <parameter type-id='type-id-16' name='anyset' filepath='Objects/setobject.c' line='2251' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='PyFrozenSet_New' mangled-name='PyFrozenSet_New' filepath='Objects/setobject.c' line='2245' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyFrozenSet_New'>
+      <parameter type-id='type-id-16' name='im' filepath='Objects/classobject.c' line='390' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PySet_New' mangled-name='PySet_New' filepath='Objects/setobject.c' line='2239' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySet_New'>
+      <parameter type-id='type-id-16' name='im' filepath='Objects/classobject.c' line='390' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyDict_Next' mangled-name='_PyDict_Next' filepath='./Include/cpython/dictobject.h' line='44' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyDict_Contains_KnownHash' mangled-name='_PyDict_Contains_KnownHash' filepath='./Include/cpython/dictobject.h' line='49' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_EQ' mangled-name='_PyUnicode_EQ' filepath='./Include/cpython/unicodeobject.h' line='1164' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/sliceobject.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PyEllipsis_Type' type-id='type-id-149' mangled-name='PyEllipsis_Type' visibility='default' filepath='./Include/sliceobject.h' line='29' column='1' elf-symbol-id='PyEllipsis_Type'/>
+    <var-decl name='_Py_EllipsisObject' type-id='type-id-69' mangled-name='_Py_EllipsisObject' visibility='default' filepath='./Include/sliceobject.h' line='9' column='1' elf-symbol-id='_Py_EllipsisObject'/>
+    <var-decl name='PySlice_Type' type-id='type-id-149' mangled-name='PySlice_Type' visibility='default' filepath='./Include/sliceobject.h' line='28' column='1' elf-symbol-id='PySlice_Type'/>
+    <function-decl name='_PySlice_GetLongIndices' mangled-name='_PySlice_GetLongIndices' filepath='Objects/sliceobject.c' line='381' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PySlice_GetLongIndices'>
+      <parameter type-id='type-id-240' name='self' filepath='Objects/sliceobject.c' line='381' column='1'/>
+      <parameter type-id='type-id-16' name='length' filepath='Objects/sliceobject.c' line='381' column='1'/>
+      <parameter type-id='type-id-86' name='start_ptr' filepath='Objects/sliceobject.c' line='382' column='1'/>
+      <parameter type-id='type-id-86' name='stop_ptr' filepath='Objects/sliceobject.c' line='382' column='1'/>
+      <parameter type-id='type-id-86' name='step_ptr' filepath='Objects/sliceobject.c' line='383' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PySlice_GetIndicesEx' mangled-name='PySlice_GetIndicesEx' filepath='Objects/sliceobject.c' line='292' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySlice_GetIndicesEx'>
+      <parameter type-id='type-id-16' name='_r' filepath='Objects/sliceobject.c' line='292' column='1'/>
+      <parameter type-id='type-id-31' name='length' filepath='Objects/sliceobject.c' line='292' column='1'/>
+      <parameter type-id='type-id-125' name='start' filepath='Objects/sliceobject.c' line='293' column='1'/>
+      <parameter type-id='type-id-125' name='stop' filepath='Objects/sliceobject.c' line='293' column='1'/>
+      <parameter type-id='type-id-125' name='step' filepath='Objects/sliceobject.c' line='293' column='1'/>
+      <parameter type-id='type-id-125' name='slicelength' filepath='Objects/sliceobject.c' line='294' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PySlice_AdjustIndices' mangled-name='PySlice_AdjustIndices' filepath='Objects/sliceobject.c' line='248' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySlice_AdjustIndices'>
+      <parameter type-id='type-id-31' name='length' filepath='Objects/sliceobject.c' line='248' column='1'/>
+      <parameter type-id='type-id-125' name='start' filepath='Objects/sliceobject.c' line='249' column='1'/>
+      <parameter type-id='type-id-125' name='stop' filepath='Objects/sliceobject.c' line='249' column='1'/>
+      <parameter type-id='type-id-31' name='step' filepath='Objects/sliceobject.c' line='249' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='PySlice_Unpack' mangled-name='PySlice_Unpack' filepath='Objects/sliceobject.c' line='203' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySlice_Unpack'>
+      <parameter type-id='type-id-16' name='_r' filepath='Objects/sliceobject.c' line='203' column='1'/>
+      <parameter type-id='type-id-125' name='start' filepath='Objects/sliceobject.c' line='204' column='1'/>
+      <parameter type-id='type-id-125' name='stop' filepath='Objects/sliceobject.c' line='204' column='1'/>
+      <parameter type-id='type-id-125' name='step' filepath='Objects/sliceobject.c' line='204' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PySlice_GetIndices' mangled-name='PySlice_GetIndices' filepath='Objects/sliceobject.c' line='171' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySlice_GetIndices'>
+      <parameter type-id='type-id-16' name='_r' filepath='Objects/sliceobject.c' line='171' column='1'/>
+      <parameter type-id='type-id-31' name='length' filepath='Objects/sliceobject.c' line='171' column='1'/>
+      <parameter type-id='type-id-125' name='start' filepath='Objects/sliceobject.c' line='172' column='1'/>
+      <parameter type-id='type-id-125' name='stop' filepath='Objects/sliceobject.c' line='172' column='1'/>
+      <parameter type-id='type-id-125' name='step' filepath='Objects/sliceobject.c' line='172' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PySlice_FromIndices' mangled-name='_PySlice_FromIndices' filepath='Objects/sliceobject.c' line='152' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PySlice_FromIndices'>
+      <parameter type-id='type-id-31' name='istart' filepath='Objects/sliceobject.c' line='152' column='1'/>
+      <parameter type-id='type-id-31' name='istop' filepath='Objects/sliceobject.c' line='152' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PySlice_New' mangled-name='PySlice_New' filepath='Objects/sliceobject.c' line='114' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySlice_New'>
+      <parameter type-id='type-id-16' name='start' filepath='Objects/sliceobject.c' line='114' column='1'/>
+      <parameter type-id='type-id-16' name='stop' filepath='Objects/sliceobject.c' line='114' column='1'/>
+      <parameter type-id='type-id-16' name='step' filepath='Objects/sliceobject.c' line='114' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/structseq.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PyStructSequence_UnnamedField' type-id='type-id-5' visibility='default' filepath='./Include/structseq.h' line='22' column='1'/>
+    <class-decl name='PyStructSequence_Desc' size-in-bits='256' is-struct='yes' visibility='default' filepath='./Include/structseq.h' line='15' column='1' id='type-id-500'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='name' type-id='type-id-3' visibility='default' filepath='./Include/structseq.h' line='16' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='doc' type-id='type-id-3' visibility='default' filepath='./Include/structseq.h' line='17' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='fields' type-id='type-id-501' visibility='default' filepath='./Include/structseq.h' line='18' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='n_in_sequence' type-id='type-id-9' visibility='default' filepath='./Include/structseq.h' line='19' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='PyStructSequence_Field' size-in-bits='128' is-struct='yes' visibility='default' filepath='./Include/structseq.h' line='10' column='1' id='type-id-502'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='name' type-id='type-id-3' visibility='default' filepath='./Include/structseq.h' line='11' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='doc' type-id='type-id-3' visibility='default' filepath='./Include/structseq.h' line='12' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-502' size-in-bits='64' id='type-id-501'/>
+    <typedef-decl name='PyStructSequence_Desc' type-id='type-id-500' filepath='./Include/structseq.h' line='20' column='1' id='type-id-503'/>
+    <pointer-type-def type-id='type-id-503' size-in-bits='64' id='type-id-504'/>
+    <function-decl name='PyStructSequence_NewType' mangled-name='PyStructSequence_NewType' filepath='Objects/structseq.c' line='535' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyStructSequence_NewType'>
+      <parameter type-id='type-id-504' name='desc' filepath='Objects/structseq.c' line='535' column='1'/>
+      <return type-id='type-id-32'/>
+    </function-decl>
+    <function-decl name='PyStructSequence_InitType' mangled-name='PyStructSequence_InitType' filepath='Objects/structseq.c' line='529' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyStructSequence_InitType'>
+      <parameter type-id='type-id-32' name='type' filepath='Objects/structseq.c' line='529' column='1'/>
+      <parameter type-id='type-id-504' name='desc' filepath='Objects/structseq.c' line='529' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyStructSequence_InitType2' mangled-name='PyStructSequence_InitType2' filepath='Objects/structseq.c' line='523' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyStructSequence_InitType2'>
+      <parameter type-id='type-id-32' name='type' filepath='Objects/structseq.c' line='523' column='1'/>
+      <parameter type-id='type-id-504' name='desc' filepath='Objects/structseq.c' line='523' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyStructSequence_InitType' mangled-name='_PyStructSequence_InitType' filepath='Objects/structseq.c' line='465' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyStructSequence_InitType'>
+      <parameter type-id='type-id-32' name='type' filepath='Objects/structseq.c' line='465' column='1'/>
+      <parameter type-id='type-id-504' name='desc' filepath='Objects/structseq.c' line='465' column='1'/>
+      <parameter type-id='type-id-19' name='tp_flags' filepath='Objects/structseq.c' line='466' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyStructSequence_GetItem' mangled-name='PyStructSequence_GetItem' filepath='Objects/structseq.c' line='86' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyStructSequence_GetItem'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/structseq.c' line='86' column='1'/>
+      <parameter type-id='type-id-31' name='i' filepath='Objects/structseq.c' line='86' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyStructSequence_SetItem' mangled-name='PyStructSequence_SetItem' filepath='Objects/structseq.c' line='80' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyStructSequence_SetItem'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/structseq.c' line='80' column='1'/>
+      <parameter type-id='type-id-31' name='i' filepath='Objects/structseq.c' line='80' column='1'/>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/structseq.c' line='80' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyStructSequence_New' mangled-name='PyStructSequence_New' filepath='Objects/structseq.c' line='55' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyStructSequence_New'>
+      <parameter type-id='type-id-32' name='type' filepath='Objects/structseq.c' line='55' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyType_FromSpecWithBases' mangled-name='PyType_FromSpecWithBases' filepath='./Include/object.h' line='232' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyDict_GetItemStringWithError' mangled-name='_PyDict_GetItemStringWithError' filepath='./Include/cpython/dictobject.h' line='34' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/tupleobject.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PyTuple_Type' type-id='type-id-149' mangled-name='PyTuple_Type' visibility='default' filepath='./Include/tupleobject.h' line='23' column='1' elf-symbol-id='PyTuple_Type'/>
+    <var-decl name='PyTupleIter_Type' type-id='type-id-149' mangled-name='PyTupleIter_Type' visibility='default' filepath='./Include/tupleobject.h' line='24' column='1' elf-symbol-id='PyTupleIter_Type'/>
+    <function-decl name='_PyTuple_Resize' mangled-name='_PyTuple_Resize' filepath='Objects/tupleobject.c' line='952' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTuple_Resize'>
+      <parameter type-id='type-id-86' name='pv' filepath='Objects/tupleobject.c' line='952' column='1'/>
+      <parameter type-id='type-id-31' name='newsize' filepath='Objects/tupleobject.c' line='952' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyTuple_GetSlice' mangled-name='PyTuple_GetSlice' filepath='Objects/tupleobject.c' line='498' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyTuple_GetSlice'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/tupleobject.c' line='498' column='1'/>
+      <parameter type-id='type-id-31' name='i' filepath='Objects/tupleobject.c' line='498' column='1'/>
+      <parameter type-id='type-id-31' name='j' filepath='Objects/tupleobject.c' line='498' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyTuple_Pack' mangled-name='PyTuple_Pack' filepath='Objects/tupleobject.c' line='236' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyTuple_Pack'>
+      <parameter type-id='type-id-31' name='n' filepath='Objects/tupleobject.c' line='236' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyTuple_MaybeUntrack' mangled-name='_PyTuple_MaybeUntrack' filepath='Objects/tupleobject.c' line='214' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTuple_MaybeUntrack'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/tupleobject.c' line='214' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyTuple_SetItem' mangled-name='PyTuple_SetItem' filepath='Objects/tupleobject.c' line='194' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyTuple_SetItem'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/tupleobject.c' line='194' column='1'/>
+      <parameter type-id='type-id-31' name='i' filepath='Objects/tupleobject.c' line='194' column='1'/>
+      <parameter type-id='type-id-16' name='newitem' filepath='Objects/tupleobject.c' line='194' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyTuple_GetItem' mangled-name='PyTuple_GetItem' filepath='Objects/tupleobject.c' line='180' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyTuple_GetItem'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/tupleobject.c' line='180' column='1'/>
+      <parameter type-id='type-id-31' name='i' filepath='Objects/tupleobject.c' line='180' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyTuple_Size' mangled-name='PyTuple_Size' filepath='Objects/tupleobject.c' line='169' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyTuple_Size'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/bytesobject.c' line='1224' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='_PyTuple_DebugMallocStats' mangled-name='_PyTuple_DebugMallocStats' filepath='Objects/tupleobject.c' line='37' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTuple_DebugMallocStats'>
+      <parameter type-id='type-id-188' name='out' filepath='Objects/tupleobject.c' line='37' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyTuple_New' mangled-name='PyTuple_New' filepath='Objects/tupleobject.c' line='149' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyTuple_New'>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/tupleobject.c' line='149' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/typeobject.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PyType_Type' type-id='type-id-149' mangled-name='PyType_Type' visibility='default' filepath='./Include/object.h' line='251' column='1' elf-symbol-id='PyType_Type'/>
+    <var-decl name='PyBaseObject_Type' type-id='type-id-149' mangled-name='PyBaseObject_Type' visibility='default' filepath='./Include/object.h' line='252' column='1' elf-symbol-id='PyBaseObject_Type'/>
+    <var-decl name='PySuper_Type' type-id='type-id-149' mangled-name='PySuper_Type' visibility='default' filepath='./Include/object.h' line='253' column='1' elf-symbol-id='PySuper_Type'/>
+    <function-decl name='_PyType_LookupId' mangled-name='_PyType_LookupId' filepath='Objects/typeobject.c' line='3853' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyType_LookupId'>
+      <parameter type-id='type-id-32' name='type' filepath='Objects/typeobject.c' line='3853' column='1'/>
+      <parameter type-id='type-id-219' name='name' filepath='Objects/typeobject.c' line='3853' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyType_Lookup' mangled-name='_PyType_Lookup' filepath='Objects/typeobject.c' line='3795' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyType_Lookup'>
+      <parameter type-id='type-id-32' name='type' filepath='Objects/typeobject.c' line='3795' column='1'/>
+      <parameter type-id='type-id-16' name='name' filepath='Objects/typeobject.c' line='3795' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <pointer-type-def type-id='type-id-458' size-in-bits='64' id='type-id-505'/>
+    <function-decl name='_PyType_GetModuleByDef' mangled-name='_PyType_GetModuleByDef' filepath='Objects/typeobject.c' line='3693' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyType_GetModuleByDef'>
+      <parameter type-id='type-id-32' name='type' filepath='Objects/typeobject.c' line='3693' column='1'/>
+      <parameter type-id='type-id-505' name='def' filepath='Objects/typeobject.c' line='3693' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyType_GetModuleState' mangled-name='PyType_GetModuleState' filepath='Objects/typeobject.c' line='3675' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyType_GetModuleState'>
+      <parameter type-id='type-id-32' name='type' filepath='Objects/typeobject.c' line='3675' column='1'/>
+      <return type-id='type-id-21'/>
+    </function-decl>
+    <function-decl name='PyType_GetSlot' mangled-name='PyType_GetSlot' filepath='Objects/typeobject.c' line='3629' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyType_GetSlot'>
+      <parameter type-id='type-id-32' name='type' filepath='Objects/typeobject.c' line='3629' column='1'/>
+      <parameter type-id='type-id-9' name='slot' filepath='Objects/typeobject.c' line='3629' column='1'/>
+      <return type-id='type-id-21'/>
+    </function-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='256' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-506' visibility='default' filepath='./Include/object.h' line='222' column='1' id='type-id-507'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='name' type-id='type-id-3' visibility='default' filepath='./Include/object.h' line='223' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='basicsize' type-id='type-id-9' visibility='default' filepath='./Include/object.h' line='224' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='96'>
+        <var-decl name='itemsize' type-id='type-id-9' visibility='default' filepath='./Include/object.h' line='225' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='flags' type-id='type-id-66' visibility='default' filepath='./Include/object.h' line='226' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='slots' type-id='type-id-508' visibility='default' filepath='./Include/object.h' line='227' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='128' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-509' visibility='default' filepath='./Include/object.h' line='217' column='1' id='type-id-510'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='slot' type-id='type-id-9' visibility='default' filepath='./Include/object.h' line='218' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='pfunc' type-id='type-id-21' visibility='default' filepath='./Include/object.h' line='219' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='PyType_Slot' type-id='type-id-510' filepath='./Include/object.h' line='220' column='1' id='type-id-509'/>
+    <pointer-type-def type-id='type-id-509' size-in-bits='64' id='type-id-508'/>
+    <typedef-decl name='PyType_Spec' type-id='type-id-507' filepath='./Include/object.h' line='228' column='1' id='type-id-506'/>
+    <pointer-type-def type-id='type-id-506' size-in-bits='64' id='type-id-511'/>
+    <function-decl name='PyType_FromSpec' mangled-name='PyType_FromSpec' filepath='Objects/typeobject.c' line='3615' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyType_FromSpec'>
+      <parameter type-id='type-id-511' name='spec' filepath='Objects/typeobject.c' line='3615' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyType_FromModuleAndSpec' mangled-name='PyType_FromModuleAndSpec' filepath='Objects/typeobject.c' line='3365' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyType_FromModuleAndSpec'>
+      <parameter type-id='type-id-16' name='module' filepath='Objects/typeobject.c' line='3365' column='1'/>
+      <parameter type-id='type-id-511' name='spec' filepath='Objects/typeobject.c' line='3365' column='1'/>
+      <parameter type-id='type-id-16' name='bases' filepath='Objects/typeobject.c' line='3365' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyType_FromSpecWithBases' mangled-name='PyType_FromSpecWithBases' filepath='Objects/typeobject.c' line='3359' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyType_FromSpecWithBases'>
+      <parameter type-id='type-id-511' name='spec' filepath='Objects/typeobject.c' line='3359' column='1'/>
+      <parameter type-id='type-id-16' name='bases' filepath='Objects/typeobject.c' line='3359' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyType_CalculateMetaclass' mangled-name='_PyType_CalculateMetaclass' filepath='Objects/typeobject.c' line='2465' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyType_CalculateMetaclass'>
+      <parameter type-id='type-id-32' name='metatype' filepath='Objects/typeobject.c' line='2465' column='1'/>
+      <parameter type-id='type-id-16' name='bases' filepath='Objects/typeobject.c' line='2465' column='1'/>
+      <return type-id='type-id-32'/>
+    </function-decl>
+    <function-decl name='PyType_GetFlags' mangled-name='PyType_GetFlags' filepath='Objects/typeobject.c' line='2458' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyType_GetFlags'>
+      <parameter type-id='type-id-32' name='type' filepath='Objects/typeobject.c' line='2458' column='1'/>
+      <return type-id='type-id-19'/>
+    </function-decl>
+    <function-decl name='_PyObject_LookupSpecial' mangled-name='_PyObject_LookupSpecial' filepath='Objects/typeobject.c' line='1559' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_LookupSpecial'>
+      <parameter type-id='type-id-16' name='self' filepath='Objects/typeobject.c' line='1559' column='1'/>
+      <parameter type-id='type-id-453' name='attrid' filepath='Objects/typeobject.c' line='1559' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyType_GenericNew' mangled-name='PyType_GenericNew' filepath='Objects/typeobject.c' line='1175' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyType_GenericNew'>
+      <parameter type-id='type-id-32' name='type' filepath='Objects/typeobject.c' line='1175' column='1'/>
+      <parameter type-id='type-id-16' name='args' filepath='Objects/typeobject.c' line='1175' column='1'/>
+      <parameter type-id='type-id-16' name='kwds' filepath='Objects/typeobject.c' line='1175' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyType_GenericAlloc' mangled-name='PyType_GenericAlloc' filepath='Objects/typeobject.c' line='1142' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyType_GenericAlloc'>
+      <parameter type-id='type-id-32' name='type' filepath='Objects/typeobject.c' line='1142' column='1'/>
+      <parameter type-id='type-id-31' name='nitems' filepath='Objects/typeobject.c' line='1142' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyType_Name' mangled-name='_PyType_Name' filepath='Objects/typeobject.c' line='480' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyType_Name'>
+      <parameter type-id='type-id-32' name='type' filepath='Objects/typeobject.c' line='480' column='1'/>
+      <return type-id='type-id-3'/>
+    </function-decl>
+    <function-decl name='PyType_ClearCache' mangled-name='PyType_ClearCache' filepath='Objects/typeobject.c' line='293' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyType_ClearCache'>
+      <return type-id='type-id-66'/>
+    </function-decl>
+    <function-decl name='_PyType_CheckConsistency' mangled-name='_PyType_CheckConsistency' filepath='Objects/typeobject.c' line='143' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyType_CheckConsistency'>
+      <parameter type-id='type-id-32' name='type' filepath='Objects/typeobject.c' line='143' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyType_GetDocFromInternalDoc' mangled-name='_PyType_GetDocFromInternalDoc' filepath='Objects/typeobject.c' line='184' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyType_GetDocFromInternalDoc'>
+      <parameter type-id='type-id-3' name='name' filepath='Objects/typeobject.c' line='184' column='1'/>
+      <parameter type-id='type-id-3' name='internal_doc' filepath='Objects/typeobject.c' line='184' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyType_GetTextSignatureFromInternalDoc' mangled-name='_PyType_GetTextSignatureFromInternalDoc' filepath='Objects/typeobject.c' line='196' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyType_GetTextSignatureFromInternalDoc'>
+      <parameter type-id='type-id-3' name='name' filepath='Objects/typeobject.c' line='196' column='1'/>
+      <parameter type-id='type-id-3' name='internal_doc' filepath='Objects/typeobject.c' line='196' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyType_Modified' mangled-name='PyType_Modified' filepath='Objects/typeobject.c' line='311' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyType_Modified'>
+      <parameter type-id='type-id-32' name='type' filepath='Objects/typeobject.c' line='311' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyType_IsSubtype' mangled-name='PyType_IsSubtype' filepath='Objects/typeobject.c' line='1521' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyType_IsSubtype'>
+      <parameter type-id='type-id-32' name='a' filepath='Objects/typeobject.c' line='1521' column='1'/>
+      <parameter type-id='type-id-32' name='b' filepath='Objects/typeobject.c' line='1521' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyType_GetModule' mangled-name='PyType_GetModule' filepath='Objects/typeobject.c' line='3651' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyType_GetModule'>
+      <parameter type-id='type-id-32' name='type' filepath='Objects/typeobject.c' line='3651' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyType_Ready' mangled-name='PyType_Ready' filepath='Objects/typeobject.c' line='6349' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyType_Ready'>
+      <parameter type-id='type-id-32' name='type' filepath='Objects/typeobject.c' line='6349' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyThreadState_GetFrame' mangled-name='PyThreadState_GetFrame' filepath='./Include/pystate.h' line='90' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyFrame_GetCode' mangled-name='PyFrame_GetCode' filepath='./Include/pyframe.h' line='17' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyArg_ParseTuple' mangled-name='PyArg_ParseTuple' filepath='./Include/modsupport.h' line='40' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObject_Call_Prepend' mangled-name='_PyObject_Call_Prepend' filepath='./Include/internal/pycore_call.h' line='11' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObject_Call' mangled-name='_PyObject_Call' filepath='./Include/internal/pycore_call.h' line='25' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_HashNotImplemented' mangled-name='PyObject_HashNotImplemented' filepath='./Include/object.h' line='284' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyDictKeys_DecRef' mangled-name='_PyDictKeys_DecRef' filepath='Objects/typeobject.c' line='4024' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObject_GenericSetAttrWithDict' mangled-name='_PyObject_GenericSetAttrWithDict' filepath='./Include/cpython/object.h' line='342' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyDict_DelItemString' mangled-name='PyDict_DelItemString' filepath='./Include/dictobject.h' line='59' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyDict_NewKeysForClass' mangled-name='_PyDict_NewKeysForClass' filepath='./Include/cpython/dictobject.h' line='43' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_IsIdentifier' mangled-name='PyUnicode_IsIdentifier' filepath='./Include/unicodeobject.h' line='1040' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_Mangle' mangled-name='_Py_Mangle' filepath='./Include/internal/pycore_compile.h' line='26' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyEval_GetGlobals' mangled-name='PyEval_GetGlobals' filepath='./Include/ceval.h' line='32' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyStaticMethod_New' mangled-name='PyStaticMethod_New' filepath='./Include/funcobject.h' line='104' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_GenericGetDict' mangled-name='PyObject_GenericGetDict' filepath='./Include/dictobject.h' line='61' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyWeakref_ClearRef' mangled-name='_PyWeakref_ClearRef' filepath='./Include/weakrefobject.h' line='67' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObject_GC_Malloc' mangled-name='_PyObject_GC_Malloc' filepath='./Include/cpython/objimpl.h' line='93' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObject_IsFreed' mangled-name='_PyObject_IsFreed' filepath='./Include/cpython/object.h' line='313' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyImport_GetModule' mangled-name='PyImport_GetModule' filepath='./Include/import.h' line='36' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyImport_Import' mangled-name='PyImport_Import' filepath='./Include/import.h' line='73' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObject_LookupAttr' mangled-name='_PyObject_LookupAttr' filepath='./Include/cpython/object.h' line='327' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyDict_KeysSize' mangled-name='_PyDict_KeysSize' filepath='./Include/cpython/dictobject.h' line='54' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObject_RealIsInstance' mangled-name='_PyObject_RealIsInstance' filepath='./Include/cpython/abstract.h' line='355' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyClassMethod_New' mangled-name='PyClassMethod_New' filepath='./Include/funcobject.h' line='103' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyWeakref_NewRef' mangled-name='PyWeakref_NewRef' filepath='./Include/weakrefobject.h' line='58' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyDescr_NewWrapper' mangled-name='PyDescr_NewWrapper' filepath='./Include/descrobject.h' line='94' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyDescr_NewClassMethod' mangled-name='PyDescr_NewClassMethod' filepath='./Include/descrobject.h' line='87' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyDict_SetDefault' mangled-name='PyDict_SetDefault' filepath='./Include/cpython/dictobject.h' line='35' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyDescr_NewMethod' mangled-name='PyDescr_NewMethod' filepath='./Include/descrobject.h' line='86' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyDescr_NewMember' mangled-name='PyDescr_NewMember' filepath='./Include/descrobject.h' line='89' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyDescr_NewGetSet' mangled-name='PyDescr_NewGetSet' filepath='./Include/descrobject.h' line='91' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/unicodeobject.c' comp-dir-path='/src' language='LANG_C99'>
+
+    <array-type-def dimensions='1' type-id='type-id-439' size-in-bits='infinite' id='type-id-512'>
+      <subrange length='infinite' id='type-id-7'/>
+
+    </array-type-def>
+    <qualified-type-def type-id='type-id-512' const='yes' id='type-id-513'/>
+    <var-decl name='_Py_ascii_whitespace' type-id='type-id-513' mangled-name='_Py_ascii_whitespace' visibility='default' filepath='./Include/cpython/unicodeobject.h' line='1048' column='1' elf-symbol-id='_Py_ascii_whitespace'/>
+    <var-decl name='PyUnicode_Type' type-id='type-id-149' mangled-name='PyUnicode_Type' visibility='default' filepath='./Include/unicodeobject.h' line='111' column='1' elf-symbol-id='PyUnicode_Type'/>
+    <var-decl name='PyUnicodeIter_Type' type-id='type-id-149' mangled-name='PyUnicodeIter_Type' visibility='default' filepath='./Include/unicodeobject.h' line='112' column='1' elf-symbol-id='PyUnicodeIter_Type'/>
+    <function-decl name='PyInit__string' mangled-name='PyInit__string' filepath='Objects/unicodeobject.c' line='16359' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInit__string'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_InternFromString' mangled-name='PyUnicode_InternFromString' filepath='Objects/unicodeobject.c' line='15890' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_InternFromString'>
+      <parameter type-id='type-id-3' name='cp' filepath='Objects/unicodeobject.c' line='15890' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_InternImmortal' mangled-name='PyUnicode_InternImmortal' filepath='Objects/unicodeobject.c' line='15871' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_InternImmortal'>
+      <parameter type-id='type-id-86' name='p' filepath='Objects/unicodeobject.c' line='15871' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_InternInPlace' mangled-name='PyUnicode_InternInPlace' filepath='Objects/unicodeobject.c' line='15814' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_InternInPlace'>
+      <parameter type-id='type-id-86' name='p' filepath='Objects/unicodeobject.c' line='15814' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_Format' mangled-name='PyUnicode_Format' filepath='Objects/unicodeobject.c' line='15495' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_Format'>
+      <parameter type-id='type-id-16' name='format' filepath='Objects/unicodeobject.c' line='15495' column='1'/>
+      <parameter type-id='type-id-16' name='args' filepath='Objects/unicodeobject.c' line='15495' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_FormatLong' mangled-name='_PyUnicode_FormatLong' filepath='Objects/unicodeobject.c' line='14733' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_FormatLong'>
+      <parameter type-id='type-id-16' name='val' filepath='Objects/unicodeobject.c' line='14733' column='1'/>
+      <parameter type-id='type-id-9' name='alt' filepath='Objects/unicodeobject.c' line='14733' column='1'/>
+      <parameter type-id='type-id-9' name='prec' filepath='Objects/unicodeobject.c' line='14733' column='1'/>
+      <parameter type-id='type-id-9' name='type' filepath='Objects/unicodeobject.c' line='14733' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyUnicodeWriter_Dealloc' mangled-name='_PyUnicodeWriter_Dealloc' filepath='Objects/unicodeobject.c' line='14370' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicodeWriter_Dealloc'>
+      <parameter type-id='type-id-451' name='writer' filepath='Objects/unicodeobject.c' line='14370' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicodeWriter_WriteLatin1String' mangled-name='_PyUnicodeWriter_WriteLatin1String' filepath='Objects/unicodeobject.c' line='14324' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicodeWriter_WriteLatin1String'>
+      <parameter type-id='type-id-451' name='writer' filepath='Objects/unicodeobject.c' line='14324' column='1'/>
+      <parameter type-id='type-id-3' name='str' filepath='Objects/unicodeobject.c' line='14325' column='1'/>
+      <parameter type-id='type-id-31' name='len' filepath='Objects/unicodeobject.c' line='14325' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyUnicodeWriter_WriteASCIIString' mangled-name='_PyUnicodeWriter_WriteASCIIString' filepath='Objects/unicodeobject.c' line='14264' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicodeWriter_WriteASCIIString'>
+      <parameter type-id='type-id-451' name='writer' filepath='Objects/unicodeobject.c' line='14264' column='1'/>
+      <parameter type-id='type-id-3' name='ascii' filepath='Objects/unicodeobject.c' line='14265' column='1'/>
+      <parameter type-id='type-id-31' name='len' filepath='Objects/unicodeobject.c' line='14265' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyUnicodeWriter_WriteStr' mangled-name='_PyUnicodeWriter_WriteStr' filepath='Objects/unicodeobject.c' line='14198' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicodeWriter_WriteStr'>
+      <parameter type-id='type-id-451' name='writer' filepath='Objects/unicodeobject.c' line='14198' column='1'/>
+      <parameter type-id='type-id-16' name='str' filepath='Objects/unicodeobject.c' line='14198' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyUnicodeWriter_WriteChar' mangled-name='_PyUnicodeWriter_WriteChar' filepath='Objects/unicodeobject.c' line='14192' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicodeWriter_WriteChar'>
+      <parameter type-id='type-id-451' name='writer' filepath='Objects/unicodeobject.c' line='14192' column='1'/>
+      <parameter type-id='type-id-450' name='ch' filepath='Objects/unicodeobject.c' line='14192' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyUnicodeWriter_PrepareKindInternal' mangled-name='_PyUnicodeWriter_PrepareKindInternal' filepath='Objects/unicodeobject.c' line='14160' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicodeWriter_PrepareKindInternal'>
+      <parameter type-id='type-id-451' name='writer' filepath='Objects/unicodeobject.c' line='14160' column='1'/>
+      <parameter type-id='type-id-449' name='kind' filepath='Objects/unicodeobject.c' line='14161' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyUnicodeWriter_PrepareInternal' mangled-name='_PyUnicodeWriter_PrepareInternal' filepath='Objects/unicodeobject.c' line='14083' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicodeWriter_PrepareInternal'>
+      <parameter type-id='type-id-451' name='writer' filepath='Objects/unicodeobject.c' line='14083' column='1'/>
+      <parameter type-id='type-id-31' name='length' filepath='Objects/unicodeobject.c' line='14084' column='1'/>
+      <parameter type-id='type-id-450' name='maxchar' filepath='Objects/unicodeobject.c' line='14084' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyUnicodeWriter_Init' mangled-name='_PyUnicodeWriter_Init' filepath='Objects/unicodeobject.c' line='14059' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicodeWriter_Init'>
+      <parameter type-id='type-id-451' name='writer' filepath='Objects/unicodeobject.c' line='14059' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_RSplit' mangled-name='PyUnicode_RSplit' filepath='Objects/unicodeobject.c' line='13634' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_RSplit'>
+      <parameter type-id='type-id-16' name='s' filepath='Objects/unicodeobject.c' line='13634' column='1'/>
+      <parameter type-id='type-id-16' name='sep' filepath='Objects/unicodeobject.c' line='13634' column='1'/>
+      <parameter type-id='type-id-31' name='maxsplit' filepath='Objects/unicodeobject.c' line='13634' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_Split' mangled-name='PyUnicode_Split' filepath='Objects/unicodeobject.c' line='13450' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_Split'>
+      <parameter type-id='type-id-16' name='s' filepath='Objects/unicodeobject.c' line='13634' column='1'/>
+      <parameter type-id='type-id-16' name='sep' filepath='Objects/unicodeobject.c' line='13634' column='1'/>
+      <parameter type-id='type-id-31' name='maxsplit' filepath='Objects/unicodeobject.c' line='13634' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_Replace' mangled-name='PyUnicode_Replace' filepath='Objects/unicodeobject.c' line='13098' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_Replace'>
+      <parameter type-id='type-id-16' name='str' filepath='Objects/unicodeobject.c' line='13098' column='1'/>
+      <parameter type-id='type-id-16' name='substr' filepath='Objects/unicodeobject.c' line='13099' column='1'/>
+      <parameter type-id='type-id-16' name='replstr' filepath='Objects/unicodeobject.c' line='13100' column='1'/>
+      <parameter type-id='type-id-31' name='maxcount' filepath='Objects/unicodeobject.c' line='13101' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_Substring' mangled-name='PyUnicode_Substring' filepath='Objects/unicodeobject.c' line='12856' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_Substring'>
+      <parameter type-id='type-id-16' name='self' filepath='Objects/unicodeobject.c' line='12856' column='1'/>
+      <parameter type-id='type-id-31' name='start' filepath='Objects/unicodeobject.c' line='12856' column='1'/>
+      <parameter type-id='type-id-31' name='end' filepath='Objects/unicodeobject.c' line='12856' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_XStrip' mangled-name='_PyUnicode_XStrip' filepath='Objects/unicodeobject.c' line='12806' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_XStrip'>
+      <parameter type-id='type-id-16' name='self' filepath='Objects/unicodeobject.c' line='12806' column='1'/>
+      <parameter type-id='type-id-9' name='striptype' filepath='Objects/unicodeobject.c' line='12806' column='1'/>
+      <parameter type-id='type-id-16' name='sepobj' filepath='Objects/unicodeobject.c' line='12806' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_IsIdentifier' mangled-name='PyUnicode_IsIdentifier' filepath='Objects/unicodeobject.c' line='12620' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_IsIdentifier'>
+      <parameter type-id='type-id-16' name='self' filepath='Objects/unicodeobject.c' line='12620' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_ScanIdentifier' mangled-name='_PyUnicode_ScanIdentifier' filepath='Objects/unicodeobject.c' line='12583' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_ScanIdentifier'>
+      <parameter type-id='type-id-16' name='self' filepath='Objects/unicodeobject.c' line='12583' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='PyUnicode_AppendAndDel' mangled-name='PyUnicode_AppendAndDel' filepath='Objects/unicodeobject.c' line='11855' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_AppendAndDel'>
+      <parameter type-id='type-id-86' name='pv' filepath='Objects/bytesobject.c' line='2988' column='1'/>
+      <parameter type-id='type-id-16' name='w' filepath='Objects/bytesobject.c' line='2988' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_Append' mangled-name='PyUnicode_Append' filepath='Objects/unicodeobject.c' line='11772' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_Append'>
+      <parameter type-id='type-id-86' name='p_left' filepath='Objects/unicodeobject.c' line='11772' column='1'/>
+      <parameter type-id='type-id-16' name='right' filepath='Objects/unicodeobject.c' line='11772' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_Concat' mangled-name='PyUnicode_Concat' filepath='Objects/unicodeobject.c' line='11721' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_Concat'>
+      <parameter type-id='type-id-16' name='left' filepath='Objects/unicodeobject.c' line='11721' column='1'/>
+      <parameter type-id='type-id-16' name='right' filepath='Objects/unicodeobject.c' line='11721' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_EQ' mangled-name='_PyUnicode_EQ' filepath='Objects/unicodeobject.c' line='11652' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_EQ'>
+      <parameter type-id='type-id-16' name='self' filepath='Objects/exceptions.c' line='330' column='1'/>
+      <parameter type-id='type-id-16' name='tb' filepath='Objects/exceptions.c' line='330' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_EqualToASCIIId' mangled-name='_PyUnicode_EqualToASCIIId' filepath='Objects/unicodeobject.c' line='11569' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_EqualToASCIIId'>
+      <parameter type-id='type-id-16' name='left' filepath='Objects/unicodeobject.c' line='11569' column='1'/>
+      <parameter type-id='type-id-453' name='right' filepath='Objects/unicodeobject.c' line='11569' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyUnicode_CompareWithASCIIString' mangled-name='PyUnicode_CompareWithASCIIString' filepath='Objects/unicodeobject.c' line='11467' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_CompareWithASCIIString'>
+      <parameter type-id='type-id-16' name='uni' filepath='Objects/unicodeobject.c' line='11467' column='1'/>
+      <parameter type-id='type-id-3' name='str' filepath='Objects/unicodeobject.c' line='11467' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyUnicode_Compare' mangled-name='PyUnicode_Compare' filepath='Objects/unicodeobject.c' line='11446' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_Compare'>
+      <parameter type-id='type-id-16' name='left' filepath='Objects/unicodeobject.c' line='11446' column='1'/>
+      <parameter type-id='type-id-16' name='right' filepath='Objects/unicodeobject.c' line='11446' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyUnicode_Splitlines' mangled-name='PyUnicode_Splitlines' filepath='Objects/unicodeobject.c' line='10635' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_Splitlines'>
+      <parameter type-id='type-id-16' name='string' filepath='Objects/unicodeobject.c' line='10635' column='1'/>
+      <parameter type-id='type-id-9' name='keepends' filepath='Objects/unicodeobject.c' line='10635' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_Fill' mangled-name='PyUnicode_Fill' filepath='Objects/unicodeobject.c' line='10559' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_Fill'>
+      <parameter type-id='type-id-16' name='unicode' filepath='Objects/unicodeobject.c' line='10559' column='1'/>
+      <parameter type-id='type-id-31' name='start' filepath='Objects/unicodeobject.c' line='10559' column='1'/>
+      <parameter type-id='type-id-31' name='length' filepath='Objects/unicodeobject.c' line='10559' column='1'/>
+      <parameter type-id='type-id-450' name='fill_char' filepath='Objects/unicodeobject.c' line='10560' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_FastFill' mangled-name='_PyUnicode_FastFill' filepath='Objects/unicodeobject.c' line='10545' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_FastFill'>
+      <parameter type-id='type-id-16' name='unicode' filepath='Objects/unicodeobject.c' line='10545' column='1'/>
+      <parameter type-id='type-id-31' name='start' filepath='Objects/unicodeobject.c' line='10545' column='1'/>
+      <parameter type-id='type-id-31' name='length' filepath='Objects/unicodeobject.c' line='10545' column='1'/>
+      <parameter type-id='type-id-450' name='fill_char' filepath='Objects/unicodeobject.c' line='10546' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_JoinArray' mangled-name='_PyUnicode_JoinArray' filepath='Objects/unicodeobject.c' line='10373' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_JoinArray'>
+      <parameter type-id='type-id-16' name='separator' filepath='Objects/unicodeobject.c' line='10373' column='1'/>
+      <parameter type-id='type-id-156' name='items' filepath='Objects/unicodeobject.c' line='10373' column='1'/>
+      <parameter type-id='type-id-31' name='seqlen' filepath='Objects/unicodeobject.c' line='10373' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_Join' mangled-name='PyUnicode_Join' filepath='Objects/unicodeobject.c' line='10349' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_Join'>
+      <parameter type-id='type-id-16' name='separator' filepath='Objects/unicodeobject.c' line='10349' column='1'/>
+      <parameter type-id='type-id-16' name='seq' filepath='Objects/unicodeobject.c' line='10349' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_Tailmatch' mangled-name='PyUnicode_Tailmatch' filepath='Objects/unicodeobject.c' line='10102' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_Tailmatch'>
+      <parameter type-id='type-id-16' name='str' filepath='Objects/unicodeobject.c' line='10102' column='1'/>
+      <parameter type-id='type-id-16' name='substr' filepath='Objects/unicodeobject.c' line='10103' column='1'/>
+      <parameter type-id='type-id-31' name='start' filepath='Objects/unicodeobject.c' line='10104' column='1'/>
+      <parameter type-id='type-id-31' name='end' filepath='Objects/unicodeobject.c' line='10105' column='1'/>
+      <parameter type-id='type-id-9' name='direction' filepath='Objects/unicodeobject.c' line='10106' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='PyUnicode_FindChar' mangled-name='PyUnicode_FindChar' filepath='Objects/unicodeobject.c' line='10013' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_FindChar'>
+      <parameter type-id='type-id-16' name='str' filepath='Objects/unicodeobject.c' line='10013' column='1'/>
+      <parameter type-id='type-id-450' name='ch' filepath='Objects/unicodeobject.c' line='10013' column='1'/>
+      <parameter type-id='type-id-31' name='start' filepath='Objects/unicodeobject.c' line='10014' column='1'/>
+      <parameter type-id='type-id-31' name='end' filepath='Objects/unicodeobject.c' line='10014' column='1'/>
+      <parameter type-id='type-id-9' name='direction' filepath='Objects/unicodeobject.c' line='10015' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='PyUnicode_Find' mangled-name='PyUnicode_Find' filepath='Objects/unicodeobject.c' line='10000' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_Find'>
+      <parameter type-id='type-id-16' name='str' filepath='Objects/unicodeobject.c' line='10102' column='1'/>
+      <parameter type-id='type-id-16' name='substr' filepath='Objects/unicodeobject.c' line='10103' column='1'/>
+      <parameter type-id='type-id-31' name='start' filepath='Objects/unicodeobject.c' line='10104' column='1'/>
+      <parameter type-id='type-id-31' name='end' filepath='Objects/unicodeobject.c' line='10105' column='1'/>
+      <parameter type-id='type-id-9' name='direction' filepath='Objects/unicodeobject.c' line='10106' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='PyUnicode_Count' mangled-name='PyUnicode_Count' filepath='Objects/unicodeobject.c' line='9926' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_Count'>
+      <parameter type-id='type-id-16' name='str' filepath='Objects/unicodeobject.c' line='9926' column='1'/>
+      <parameter type-id='type-id-16' name='substr' filepath='Objects/unicodeobject.c' line='9927' column='1'/>
+      <parameter type-id='type-id-31' name='start' filepath='Objects/unicodeobject.c' line='9928' column='1'/>
+      <parameter type-id='type-id-31' name='end' filepath='Objects/unicodeobject.c' line='9929' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <pointer-type-def type-id='type-id-450' size-in-bits='64' id='type-id-514'/>
+    <function-decl name='_PyUnicode_InsertThousandsGrouping' mangled-name='_PyUnicode_InsertThousandsGrouping' filepath='Objects/unicodeobject.c' line='9806' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_InsertThousandsGrouping'>
+      <parameter type-id='type-id-451' name='writer' filepath='Objects/unicodeobject.c' line='9807' column='1'/>
+      <parameter type-id='type-id-31' name='n_buffer' filepath='Objects/unicodeobject.c' line='9808' column='1'/>
+      <parameter type-id='type-id-16' name='digits' filepath='Objects/unicodeobject.c' line='9809' column='1'/>
+      <parameter type-id='type-id-31' name='d_pos' filepath='Objects/unicodeobject.c' line='9810' column='1'/>
+      <parameter type-id='type-id-31' name='n_digits' filepath='Objects/unicodeobject.c' line='9811' column='1'/>
+      <parameter type-id='type-id-31' name='min_width' filepath='Objects/unicodeobject.c' line='9812' column='1'/>
+      <parameter type-id='type-id-3' name='grouping' filepath='Objects/unicodeobject.c' line='9813' column='1'/>
+      <parameter type-id='type-id-16' name='thousands_sep' filepath='Objects/unicodeobject.c' line='9814' column='1'/>
+      <parameter type-id='type-id-514' name='maxchar' filepath='Objects/unicodeobject.c' line='9815' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <pointer-type-def type-id='type-id-436' size-in-bits='64' id='type-id-515'/>
+    <function-decl name='PyUnicode_EncodeDecimal' mangled-name='PyUnicode_EncodeDecimal' filepath='Objects/unicodeobject.c' line='9617' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_EncodeDecimal'>
+      <parameter type-id='type-id-515' name='s' filepath='Objects/unicodeobject.c' line='9617' column='1'/>
+      <parameter type-id='type-id-31' name='length' filepath='Objects/unicodeobject.c' line='9618' column='1'/>
+      <parameter type-id='type-id-72' name='output' filepath='Objects/unicodeobject.c' line='9619' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='9620' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyUnicode_TransformDecimalToASCII' mangled-name='PyUnicode_TransformDecimalToASCII' filepath='Objects/unicodeobject.c' line='9576' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_TransformDecimalToASCII'>
+      <parameter type-id='type-id-515' name='s' filepath='Objects/unicodeobject.c' line='9576' column='1'/>
+      <parameter type-id='type-id-31' name='length' filepath='Objects/unicodeobject.c' line='9577' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_TransformDecimalAndSpaceToASCII' mangled-name='_PyUnicode_TransformDecimalAndSpaceToASCII' filepath='Objects/unicodeobject.c' line='9527' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_TransformDecimalAndSpaceToASCII'>
+      <parameter type-id='type-id-16' name='unicode' filepath='Objects/unicodeobject.c' line='9527' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_Translate' mangled-name='PyUnicode_Translate' filepath='Objects/unicodeobject.c' line='9517' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_Translate'>
+      <parameter type-id='type-id-16' name='str' filepath='Objects/unicodeobject.c' line='9517' column='1'/>
+      <parameter type-id='type-id-16' name='mapping' filepath='Objects/unicodeobject.c' line='9518' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='9519' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_TranslateCharmap' mangled-name='PyUnicode_TranslateCharmap' filepath='Objects/unicodeobject.c' line='9502' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_TranslateCharmap'>
+      <parameter type-id='type-id-438' name='p' filepath='Objects/unicodeobject.c' line='9502' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='9503' column='1'/>
+      <parameter type-id='type-id-16' name='mapping' filepath='Objects/unicodeobject.c' line='9504' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='9505' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_AsCharmapString' mangled-name='PyUnicode_AsCharmapString' filepath='Objects/unicodeobject.c' line='9077' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_AsCharmapString'>
+      <parameter type-id='type-id-16' name='unicode' filepath='Objects/unicodeobject.c' line='9077' column='1'/>
+      <parameter type-id='type-id-16' name='mapping' filepath='Objects/unicodeobject.c' line='9078' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_EncodeCharmap' mangled-name='PyUnicode_EncodeCharmap' filepath='Objects/unicodeobject.c' line='9062' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_EncodeCharmap'>
+      <parameter type-id='type-id-438' name='p' filepath='Objects/unicodeobject.c' line='9502' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='9503' column='1'/>
+      <parameter type-id='type-id-16' name='mapping' filepath='Objects/unicodeobject.c' line='9504' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='9505' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_EncodeCharmap' mangled-name='_PyUnicode_EncodeCharmap' filepath='Objects/unicodeobject.c' line='8990' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_EncodeCharmap'>
+      <parameter type-id='type-id-16' name='unicode' filepath='Objects/unicodeobject.c' line='8990' column='1'/>
+      <parameter type-id='type-id-16' name='mapping' filepath='Objects/unicodeobject.c' line='8991' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='8992' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_BuildEncodingMap' mangled-name='PyUnicode_BuildEncodingMap' filepath='Objects/unicodeobject.c' line='8577' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_BuildEncodingMap'>
+      <parameter type-id='type-id-16' name='string' filepath='Objects/unicodeobject.c' line='8577' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_DecodeCharmap' mangled-name='PyUnicode_DecodeCharmap' filepath='Objects/unicodeobject.c' line='8476' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_DecodeCharmap'>
+      <parameter type-id='type-id-3' name='s' filepath='Objects/unicodeobject.c' line='8476' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='8477' column='1'/>
+      <parameter type-id='type-id-16' name='mapping' filepath='Objects/unicodeobject.c' line='8478' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='8479' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_AsASCIIString' mangled-name='PyUnicode_AsASCIIString' filepath='Objects/unicodeobject.c' line='7511' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_AsASCIIString'>
+      <parameter type-id='type-id-16' name='im' filepath='Objects/classobject.c' line='25' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_EncodeASCII' mangled-name='PyUnicode_EncodeASCII' filepath='Objects/unicodeobject.c' line='7480' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_EncodeASCII'>
+      <parameter type-id='type-id-438' name='p' filepath='Objects/unicodeobject.c' line='7480' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='7481' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='7482' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_DecodeASCII' mangled-name='PyUnicode_DecodeASCII' filepath='Objects/unicodeobject.c' line='7380' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_DecodeASCII'>
+      <parameter type-id='type-id-3' name='s' filepath='Objects/unicodeobject.c' line='7380' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='7381' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='7382' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_AsLatin1String' mangled-name='PyUnicode_AsLatin1String' filepath='Objects/unicodeobject.c' line='7372' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_AsLatin1String'>
+      <parameter type-id='type-id-16' name='im' filepath='Objects/classobject.c' line='25' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_EncodeLatin1' mangled-name='PyUnicode_EncodeLatin1' filepath='Objects/unicodeobject.c' line='7339' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_EncodeLatin1'>
+      <parameter type-id='type-id-438' name='p' filepath='Objects/unicodeobject.c' line='7480' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='7481' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='7482' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_DecodeLatin1' mangled-name='PyUnicode_DecodeLatin1' filepath='Objects/unicodeobject.c' line='7056' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_DecodeLatin1'>
+      <parameter type-id='type-id-3' name='s' filepath='Objects/unicodeobject.c' line='7056' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='7057' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='7058' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_EncodeRawUnicodeEscape' mangled-name='PyUnicode_EncodeRawUnicodeEscape' filepath='Objects/unicodeobject.c' line='7041' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_EncodeRawUnicodeEscape'>
+      <parameter type-id='type-id-438' name='s' filepath='Objects/unicodeobject.c' line='7041' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='7042' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_AsRawUnicodeEscapeString' mangled-name='PyUnicode_AsRawUnicodeEscapeString' filepath='Objects/unicodeobject.c' line='6962' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_AsRawUnicodeEscapeString'>
+      <parameter type-id='type-id-16' name='unicode' filepath='Objects/unicodeobject.c' line='6962' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_DecodeRawUnicodeEscape' mangled-name='PyUnicode_DecodeRawUnicodeEscape' filepath='Objects/unicodeobject.c' line='6953' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_DecodeRawUnicodeEscape'>
+      <parameter type-id='type-id-3' name='s' filepath='Objects/unicodeobject.c' line='7056' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='7057' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='7058' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_DecodeRawUnicodeEscapeStateful' mangled-name='_PyUnicode_DecodeRawUnicodeEscapeStateful' filepath='Objects/unicodeobject.c' line='6817' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_DecodeRawUnicodeEscapeStateful'>
+      <parameter type-id='type-id-3' name='s' filepath='Objects/unicodeobject.c' line='6817' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='6818' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='6819' column='1'/>
+      <parameter type-id='type-id-125' name='consumed' filepath='Objects/unicodeobject.c' line='6820' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_EncodeUnicodeEscape' mangled-name='PyUnicode_EncodeUnicodeEscape' filepath='Objects/unicodeobject.c' line='6800' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_EncodeUnicodeEscape'>
+      <parameter type-id='type-id-438' name='s' filepath='Objects/unicodeobject.c' line='7041' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='7042' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_AsUnicodeEscapeString' mangled-name='PyUnicode_AsUnicodeEscapeString' filepath='Objects/unicodeobject.c' line='6682' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_AsUnicodeEscapeString'>
+      <parameter type-id='type-id-16' name='unicode' filepath='Objects/unicodeobject.c' line='6962' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_DecodeUnicodeEscape' mangled-name='PyUnicode_DecodeUnicodeEscape' filepath='Objects/unicodeobject.c' line='6672' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_DecodeUnicodeEscape'>
+      <parameter type-id='type-id-3' name='s' filepath='Objects/unicodeobject.c' line='7056' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='7057' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='7058' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_DecodeUnicodeEscapeStateful' mangled-name='_PyUnicode_DecodeUnicodeEscapeStateful' filepath='Objects/unicodeobject.c' line='6649' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_DecodeUnicodeEscapeStateful'>
+      <parameter type-id='type-id-3' name='s' filepath='Objects/unicodeobject.c' line='6649' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='6650' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='6651' column='1'/>
+      <parameter type-id='type-id-125' name='consumed' filepath='Objects/unicodeobject.c' line='6652' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_DecodeUnicodeEscapeInternal' mangled-name='_PyUnicode_DecodeUnicodeEscapeInternal' filepath='Objects/unicodeobject.c' line='6411' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_DecodeUnicodeEscapeInternal'>
+      <parameter type-id='type-id-3' name='s' filepath='Objects/unicodeobject.c' line='6411' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='6412' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='6413' column='1'/>
+      <parameter type-id='type-id-125' name='consumed' filepath='Objects/unicodeobject.c' line='6414' column='1'/>
+      <parameter type-id='type-id-196' name='first_invalid_escape' filepath='Objects/unicodeobject.c' line='6415' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_AsUTF16String' mangled-name='PyUnicode_AsUTF16String' filepath='Objects/unicodeobject.c' line='6401' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_AsUTF16String'>
+      <parameter type-id='type-id-16' name='im' filepath='Objects/classobject.c' line='25' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_EncodeUTF16' mangled-name='PyUnicode_EncodeUTF16' filepath='Objects/unicodeobject.c' line='6386' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_EncodeUTF16'>
+      <parameter type-id='type-id-438' name='s' filepath='Objects/unicodeobject.c' line='6386' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='6387' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='6388' column='1'/>
+      <parameter type-id='type-id-9' name='byteorder' filepath='Objects/unicodeobject.c' line='6389' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_EncodeUTF16' mangled-name='_PyUnicode_EncodeUTF16' filepath='Objects/unicodeobject.c' line='6220' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_EncodeUTF16'>
+      <parameter type-id='type-id-16' name='str' filepath='Objects/unicodeobject.c' line='6220' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='6221' column='1'/>
+      <parameter type-id='type-id-9' name='byteorder' filepath='Objects/unicodeobject.c' line='6222' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_DecodeUTF16Stateful' mangled-name='PyUnicode_DecodeUTF16Stateful' filepath='Objects/unicodeobject.c' line='6065' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_DecodeUTF16Stateful'>
+      <parameter type-id='type-id-3' name='s' filepath='Objects/unicodeobject.c' line='6065' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='6066' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='6067' column='1'/>
+      <parameter type-id='type-id-452' name='byteorder' filepath='Objects/unicodeobject.c' line='6068' column='1'/>
+      <parameter type-id='type-id-125' name='consumed' filepath='Objects/unicodeobject.c' line='6069' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_DecodeUTF16' mangled-name='PyUnicode_DecodeUTF16' filepath='Objects/unicodeobject.c' line='6056' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_DecodeUTF16'>
+      <parameter type-id='type-id-3' name='s' filepath='Objects/unicodeobject.c' line='6056' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='6057' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='6058' column='1'/>
+      <parameter type-id='type-id-452' name='byteorder' filepath='Objects/unicodeobject.c' line='6059' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_AsUTF32String' mangled-name='PyUnicode_AsUTF32String' filepath='Objects/unicodeobject.c' line='6048' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_AsUTF32String'>
+      <parameter type-id='type-id-16' name='im' filepath='Objects/classobject.c' line='25' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_EncodeUTF32' mangled-name='PyUnicode_EncodeUTF32' filepath='Objects/unicodeobject.c' line='6033' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_EncodeUTF32'>
+      <parameter type-id='type-id-438' name='s' filepath='Objects/unicodeobject.c' line='6386' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='6387' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='6388' column='1'/>
+      <parameter type-id='type-id-9' name='byteorder' filepath='Objects/unicodeobject.c' line='6389' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_EncodeUTF32' mangled-name='_PyUnicode_EncodeUTF32' filepath='Objects/unicodeobject.c' line='5886' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_EncodeUTF32'>
+      <parameter type-id='type-id-16' name='str' filepath='Objects/unicodeobject.c' line='5886' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='5887' column='1'/>
+      <parameter type-id='type-id-9' name='byteorder' filepath='Objects/unicodeobject.c' line='5888' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_DecodeUTF32Stateful' mangled-name='PyUnicode_DecodeUTF32Stateful' filepath='Objects/unicodeobject.c' line='5741' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_DecodeUTF32Stateful'>
+      <parameter type-id='type-id-3' name='s' filepath='Objects/unicodeobject.c' line='5741' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='5742' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='5743' column='1'/>
+      <parameter type-id='type-id-452' name='byteorder' filepath='Objects/unicodeobject.c' line='5744' column='1'/>
+      <parameter type-id='type-id-125' name='consumed' filepath='Objects/unicodeobject.c' line='5745' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_DecodeUTF32' mangled-name='PyUnicode_DecodeUTF32' filepath='Objects/unicodeobject.c' line='5732' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_DecodeUTF32'>
+      <parameter type-id='type-id-3' name='s' filepath='Objects/unicodeobject.c' line='6056' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='6057' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='6058' column='1'/>
+      <parameter type-id='type-id-452' name='byteorder' filepath='Objects/unicodeobject.c' line='6059' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_AsUTF8String' mangled-name='PyUnicode_AsUTF8String' filepath='Objects/unicodeobject.c' line='5724' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_AsUTF8String'>
+      <parameter type-id='type-id-16' name='im' filepath='Objects/classobject.c' line='25' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_EncodeUTF8' mangled-name='PyUnicode_EncodeUTF8' filepath='Objects/unicodeobject.c' line='5709' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_EncodeUTF8'>
+      <parameter type-id='type-id-438' name='p' filepath='Objects/unicodeobject.c' line='7480' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='7481' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='7482' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_AsUTF8String' mangled-name='_PyUnicode_AsUTF8String' filepath='Objects/unicodeobject.c' line='5702' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_AsUTF8String'>
+      <parameter type-id='type-id-16' name='unicode' filepath='Objects/unicodeobject.c' line='5702' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='5702' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_DecodeUTF8Stateful' mangled-name='PyUnicode_DecodeUTF8Stateful' filepath='Objects/unicodeobject.c' line='5311' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_DecodeUTF8Stateful'>
+      <parameter type-id='type-id-3' name='s' filepath='Objects/unicodeobject.c' line='5311' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='5312' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='5313' column='1'/>
+      <parameter type-id='type-id-125' name='consumed' filepath='Objects/unicodeobject.c' line='5314' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_DecodeUTF8' mangled-name='PyUnicode_DecodeUTF8' filepath='Objects/unicodeobject.c' line='5076' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_DecodeUTF8'>
+      <parameter type-id='type-id-3' name='s' filepath='Objects/unicodeobject.c' line='7056' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='7057' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='7058' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_EncodeUTF7' mangled-name='PyUnicode_EncodeUTF7' filepath='Objects/unicodeobject.c' line='5051' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_EncodeUTF7'>
+      <parameter type-id='type-id-438' name='s' filepath='Objects/unicodeobject.c' line='5051' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='5052' column='1'/>
+      <parameter type-id='type-id-9' name='base64SetO' filepath='Objects/unicodeobject.c' line='5053' column='1'/>
+      <parameter type-id='type-id-9' name='base64WhiteSpace' filepath='Objects/unicodeobject.c' line='5054' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='5055' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_EncodeUTF7' mangled-name='_PyUnicode_EncodeUTF7' filepath='Objects/unicodeobject.c' line='4950' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_EncodeUTF7'>
+      <parameter type-id='type-id-16' name='str' filepath='Objects/unicodeobject.c' line='4950' column='1'/>
+      <parameter type-id='type-id-9' name='base64SetO' filepath='Objects/unicodeobject.c' line='4951' column='1'/>
+      <parameter type-id='type-id-9' name='base64WhiteSpace' filepath='Objects/unicodeobject.c' line='4952' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='4953' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_DecodeUTF7Stateful' mangled-name='PyUnicode_DecodeUTF7Stateful' filepath='Objects/unicodeobject.c' line='4752' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_DecodeUTF7Stateful'>
+      <parameter type-id='type-id-3' name='s' filepath='Objects/unicodeobject.c' line='4752' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='4753' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='4754' column='1'/>
+      <parameter type-id='type-id-125' name='consumed' filepath='Objects/unicodeobject.c' line='4755' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_DecodeUTF7' mangled-name='PyUnicode_DecodeUTF7' filepath='Objects/unicodeobject.c' line='4737' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_DecodeUTF7'>
+      <parameter type-id='type-id-3' name='s' filepath='Objects/unicodeobject.c' line='7056' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='7057' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='7058' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_GetDefaultEncoding' mangled-name='PyUnicode_GetDefaultEncoding' filepath='Objects/unicodeobject.c' line='4388' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_GetDefaultEncoding'>
+      <return type-id='type-id-3'/>
+    </function-decl>
+    <function-decl name='PyUnicode_WriteChar' mangled-name='PyUnicode_WriteChar' filepath='Objects/unicodeobject.c' line='4365' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_WriteChar'>
+      <parameter type-id='type-id-16' name='unicode' filepath='Objects/unicodeobject.c' line='4365' column='1'/>
+      <parameter type-id='type-id-31' name='index' filepath='Objects/unicodeobject.c' line='4365' column='1'/>
+      <parameter type-id='type-id-450' name='ch' filepath='Objects/unicodeobject.c' line='4365' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyUnicode_ReadChar' mangled-name='PyUnicode_ReadChar' filepath='Objects/unicodeobject.c' line='4343' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_ReadChar'>
+      <parameter type-id='type-id-16' name='unicode' filepath='Objects/unicodeobject.c' line='4343' column='1'/>
+      <parameter type-id='type-id-31' name='index' filepath='Objects/unicodeobject.c' line='4343' column='1'/>
+      <return type-id='type-id-450'/>
+    </function-decl>
+    <function-decl name='PyUnicode_GetLength' mangled-name='PyUnicode_GetLength' filepath='Objects/unicodeobject.c' line='4331' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_GetLength'>
+      <parameter type-id='type-id-16' name='unicode' filepath='Objects/unicodeobject.c' line='4331' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='PyUnicode_GetSize' mangled-name='PyUnicode_GetSize' filepath='Objects/unicodeobject.c' line='4312' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_GetSize'>
+      <parameter type-id='type-id-16' name='unicode' filepath='Objects/unicodeobject.c' line='4312' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='PyUnicode_AsUnicode' mangled-name='PyUnicode_AsUnicode' filepath='Objects/unicodeobject.c' line='4291' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_AsUnicode'>
+      <parameter type-id='type-id-16' name='unicode' filepath='Objects/unicodeobject.c' line='4291' column='1'/>
+      <return type-id='type-id-515'/>
+    </function-decl>
+    <function-decl name='PyUnicode_AsUnicodeAndSize' mangled-name='PyUnicode_AsUnicodeAndSize' filepath='Objects/unicodeobject.c' line='4252' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_AsUnicodeAndSize'>
+      <parameter type-id='type-id-16' name='unicode' filepath='Objects/unicodeobject.c' line='4252' column='1'/>
+      <parameter type-id='type-id-125' name='size' filepath='Objects/unicodeobject.c' line='4252' column='1'/>
+      <return type-id='type-id-515'/>
+    </function-decl>
+    <function-decl name='PyUnicode_AsUTF8' mangled-name='PyUnicode_AsUTF8' filepath='Objects/unicodeobject.c' line='4246' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_AsUTF8'>
+      <parameter type-id='type-id-16' name='unicode' filepath='Objects/unicodeobject.c' line='4246' column='1'/>
+      <return type-id='type-id-3'/>
+    </function-decl>
+    <function-decl name='PyUnicode_AsUTF8AndSize' mangled-name='PyUnicode_AsUTF8AndSize' filepath='Objects/unicodeobject.c' line='4225' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_AsUTF8AndSize'>
+      <parameter type-id='type-id-16' name='unicode' filepath='Objects/unicodeobject.c' line='4225' column='1'/>
+      <parameter type-id='type-id-125' name='psize' filepath='Objects/unicodeobject.c' line='4225' column='1'/>
+      <return type-id='type-id-3'/>
+    </function-decl>
+    <function-decl name='PyUnicode_FSDecoder' mangled-name='PyUnicode_FSDecoder' filepath='Objects/unicodeobject.c' line='4152' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_FSDecoder'>
+      <parameter type-id='type-id-16' name='arg' filepath='Objects/unicodeobject.c' line='4152' column='1'/>
+      <parameter type-id='type-id-21' name='addr' filepath='Objects/unicodeobject.c' line='4152' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyUnicode_FSConverter' mangled-name='PyUnicode_FSConverter' filepath='Objects/unicodeobject.c' line='4112' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_FSConverter'>
+      <parameter type-id='type-id-16' name='arg' filepath='Objects/unicodeobject.c' line='4112' column='1'/>
+      <parameter type-id='type-id-21' name='addr' filepath='Objects/unicodeobject.c' line='4112' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyUnicode_DecodeFSDefaultAndSize' mangled-name='PyUnicode_DecodeFSDefaultAndSize' filepath='Objects/unicodeobject.c' line='4076' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_DecodeFSDefaultAndSize'>
+      <parameter type-id='type-id-3' name='s' filepath='Objects/unicodeobject.c' line='4076' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='4076' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_DecodeFSDefault' mangled-name='PyUnicode_DecodeFSDefault' filepath='Objects/unicodeobject.c' line='4070' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_DecodeFSDefault'>
+      <parameter type-id='type-id-3' name='s' filepath='Objects/unicodeobject.c' line='4070' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_DecodeLocale' mangled-name='PyUnicode_DecodeLocale' filepath='Objects/unicodeobject.c' line='4061' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_DecodeLocale'>
+      <parameter type-id='type-id-3' name='str' filepath='Objects/unicodeobject.c' line='4061' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='4061' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_DecodeLocaleAndSize' mangled-name='PyUnicode_DecodeLocaleAndSize' filepath='Objects/unicodeobject.c' line='4053' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_DecodeLocaleAndSize'>
+      <parameter type-id='type-id-3' name='str' filepath='Objects/unicodeobject.c' line='4053' column='1'/>
+      <parameter type-id='type-id-31' name='len' filepath='Objects/unicodeobject.c' line='4053' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='4054' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_AsEncodedUnicode' mangled-name='PyUnicode_AsEncodedUnicode' filepath='Objects/unicodeobject.c' line='3973' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_AsEncodedUnicode'>
+      <parameter type-id='type-id-16' name='unicode' filepath='Objects/unicodeobject.c' line='3973' column='1'/>
+      <parameter type-id='type-id-3' name='encoding' filepath='Objects/unicodeobject.c' line='3974' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='3975' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_EncodeFSDefault' mangled-name='PyUnicode_EncodeFSDefault' filepath='Objects/unicodeobject.c' line='3839' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_EncodeFSDefault'>
+      <parameter type-id='type-id-16' name='unicode' filepath='Objects/unicodeobject.c' line='3839' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_EncodeLocale' mangled-name='PyUnicode_EncodeLocale' filepath='Objects/unicodeobject.c' line='3832' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_EncodeLocale'>
+      <parameter type-id='type-id-16' name='unicode' filepath='Objects/unicodeobject.c' line='3832' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='3832' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_AsEncodedObject' mangled-name='PyUnicode_AsEncodedObject' filepath='Objects/unicodeobject.c' line='3750' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_AsEncodedObject'>
+      <parameter type-id='type-id-16' name='unicode' filepath='Objects/unicodeobject.c' line='3750' column='1'/>
+      <parameter type-id='type-id-3' name='encoding' filepath='Objects/unicodeobject.c' line='3751' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='3752' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_Encode' mangled-name='PyUnicode_Encode' filepath='Objects/unicodeobject.c' line='3734' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_Encode'>
+      <parameter type-id='type-id-438' name='s' filepath='Objects/unicodeobject.c' line='3734' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='3735' column='1'/>
+      <parameter type-id='type-id-3' name='encoding' filepath='Objects/unicodeobject.c' line='3736' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='3737' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_AsDecodedUnicode' mangled-name='PyUnicode_AsDecodedUnicode' filepath='Objects/unicodeobject.c' line='3695' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_AsDecodedUnicode'>
+      <parameter type-id='type-id-16' name='unicode' filepath='Objects/unicodeobject.c' line='3695' column='1'/>
+      <parameter type-id='type-id-3' name='encoding' filepath='Objects/unicodeobject.c' line='3696' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='3697' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_AsDecodedObject' mangled-name='PyUnicode_AsDecodedObject' filepath='Objects/unicodeobject.c' line='3673' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_AsDecodedObject'>
+      <parameter type-id='type-id-16' name='unicode' filepath='Objects/unicodeobject.c' line='3673' column='1'/>
+      <parameter type-id='type-id-3' name='encoding' filepath='Objects/unicodeobject.c' line='3674' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='3675' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_FromEncodedObject' mangled-name='PyUnicode_FromEncodedObject' filepath='Objects/unicodeobject.c' line='3481' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_FromEncodedObject'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/unicodeobject.c' line='3481' column='1'/>
+      <parameter type-id='type-id-3' name='encoding' filepath='Objects/unicodeobject.c' line='3482' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='3483' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_WideCharString_Opt_Converter' mangled-name='_PyUnicode_WideCharString_Opt_Converter' filepath='Objects/unicodeobject.c' line='3411' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_WideCharString_Opt_Converter'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/unicodeobject.c' line='3411' column='1'/>
+      <parameter type-id='type-id-21' name='ptr' filepath='Objects/unicodeobject.c' line='3411' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_WideCharString_Converter' mangled-name='_PyUnicode_WideCharString_Converter' filepath='Objects/unicodeobject.c' line='3379' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_WideCharString_Converter'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/unicodeobject.c' line='3411' column='1'/>
+      <parameter type-id='type-id-21' name='ptr' filepath='Objects/unicodeobject.c' line='3411' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyUnicode_AsWideCharString' mangled-name='PyUnicode_AsWideCharString' filepath='Objects/unicodeobject.c' line='3331' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_AsWideCharString'>
+      <parameter type-id='type-id-16' name='unicode' filepath='Objects/unicodeobject.c' line='3331' column='1'/>
+      <parameter type-id='type-id-125' name='size' filepath='Objects/unicodeobject.c' line='3332' column='1'/>
+      <return type-id='type-id-325'/>
+    </function-decl>
+    <function-decl name='PyUnicode_AsWideChar' mangled-name='PyUnicode_AsWideChar' filepath='Objects/unicodeobject.c' line='3289' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_AsWideChar'>
+      <parameter type-id='type-id-16' name='unicode' filepath='Objects/unicodeobject.c' line='3289' column='1'/>
+      <parameter type-id='type-id-325' name='w' filepath='Objects/unicodeobject.c' line='3290' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='3291' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='PyUnicode_FromFormat' mangled-name='PyUnicode_FromFormat' filepath='Objects/unicodeobject.c' line='3179' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_FromFormat'>
+      <parameter type-id='type-id-3' name='format' filepath='Objects/bytesobject.c' line='410' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_FromFormatV' mangled-name='PyUnicode_FromFormatV' filepath='Objects/unicodeobject.c' line='3122' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_FromFormatV'>
+      <parameter type-id='type-id-3' name='format' filepath='Objects/unicodeobject.c' line='3122' column='1'/>
+      <parameter type-id='type-id-217' name='vargs' filepath='Objects/unicodeobject.c' line='3122' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_AsUCS4Copy' mangled-name='PyUnicode_AsUCS4Copy' filepath='Objects/unicodeobject.c' line='2746' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_AsUCS4Copy'>
+      <parameter type-id='type-id-16' name='string' filepath='Objects/unicodeobject.c' line='2746' column='1'/>
+      <return type-id='type-id-514'/>
+    </function-decl>
+    <function-decl name='PyUnicode_AsUCS4' mangled-name='PyUnicode_AsUCS4' filepath='Objects/unicodeobject.c' line='2735' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_AsUCS4'>
+      <parameter type-id='type-id-16' name='string' filepath='Objects/unicodeobject.c' line='2735' column='1'/>
+      <parameter type-id='type-id-514' name='target' filepath='Objects/unicodeobject.c' line='2735' column='1'/>
+      <parameter type-id='type-id-31' name='targetsize' filepath='Objects/unicodeobject.c' line='2735' column='1'/>
+      <parameter type-id='type-id-9' name='copy_null' filepath='Objects/unicodeobject.c' line='2736' column='1'/>
+      <return type-id='type-id-514'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_Copy' mangled-name='_PyUnicode_Copy' filepath='Objects/unicodeobject.c' line='2612' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_Copy'>
+      <parameter type-id='type-id-16' name='x' filepath='Objects/bytesobject.c' line='2818' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_FindMaxChar' mangled-name='_PyUnicode_FindMaxChar' filepath='Objects/unicodeobject.c' line='2529' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_FindMaxChar'>
+      <parameter type-id='type-id-16' name='unicode' filepath='Objects/unicodeobject.c' line='2529' column='1'/>
+      <parameter type-id='type-id-31' name='start' filepath='Objects/unicodeobject.c' line='2529' column='1'/>
+      <parameter type-id='type-id-31' name='end' filepath='Objects/unicodeobject.c' line='2529' column='1'/>
+      <return type-id='type-id-450'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_FromId' mangled-name='_PyUnicode_FromId' filepath='Objects/unicodeobject.c' line='2319' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_FromId'>
+      <parameter type-id='type-id-453' name='id' filepath='Objects/unicodeobject.c' line='2319' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_FromString' mangled-name='PyUnicode_FromString' filepath='Objects/unicodeobject.c' line='2307' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_FromString'>
+      <parameter type-id='type-id-3' name='s' filepath='Objects/unicodeobject.c' line='4070' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_FromStringAndSize' mangled-name='PyUnicode_FromStringAndSize' filepath='Objects/unicodeobject.c' line='2284' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_FromStringAndSize'>
+      <parameter type-id='type-id-3' name='u' filepath='Objects/unicodeobject.c' line='2284' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='2284' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_FromWideChar' mangled-name='PyUnicode_FromWideChar' filepath='Objects/unicodeobject.c' line='2202' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_FromWideChar'>
+      <parameter type-id='type-id-478' name='u' filepath='Objects/unicodeobject.c' line='2202' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='2202' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_FromUnicode' mangled-name='PyUnicode_FromUnicode' filepath='Objects/unicodeobject.c' line='2180' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_FromUnicode'>
+      <parameter type-id='type-id-438' name='u' filepath='Objects/unicodeobject.c' line='2180' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='2180' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_Ready' mangled-name='_PyUnicode_Ready' filepath='Objects/unicodeobject.c' line='1802' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_Ready'>
+      <parameter type-id='type-id-16' name='unicode' filepath='Objects/unicodeobject.c' line='1802' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyUnicode_CopyCharacters' mangled-name='PyUnicode_CopyCharacters' filepath='Objects/unicodeobject.c' line='1701' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_CopyCharacters'>
+      <parameter type-id='type-id-16' name='to' filepath='Objects/unicodeobject.c' line='1701' column='1'/>
+      <parameter type-id='type-id-31' name='to_start' filepath='Objects/unicodeobject.c' line='1701' column='1'/>
+      <parameter type-id='type-id-16' name='from' filepath='Objects/unicodeobject.c' line='1702' column='1'/>
+      <parameter type-id='type-id-31' name='from_start' filepath='Objects/unicodeobject.c' line='1702' column='1'/>
+      <parameter type-id='type-id-31' name='how_many' filepath='Objects/unicodeobject.c' line='1703' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_FastCopyCharacters' mangled-name='_PyUnicode_FastCopyCharacters' filepath='Objects/unicodeobject.c' line='1693' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_FastCopyCharacters'>
+      <parameter type-id='type-id-16' name='to' filepath='Objects/unicodeobject.c' line='1694' column='1'/>
+      <parameter type-id='type-id-31' name='to_start' filepath='Objects/unicodeobject.c' line='1694' column='1'/>
+      <parameter type-id='type-id-16' name='from' filepath='Objects/unicodeobject.c' line='1695' column='1'/>
+      <parameter type-id='type-id-31' name='from_start' filepath='Objects/unicodeobject.c' line='1695' column='1'/>
+      <parameter type-id='type-id-31' name='how_many' filepath='Objects/unicodeobject.c' line='1695' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_New' mangled-name='PyUnicode_New' filepath='Objects/unicodeobject.c' line='1388' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_New'>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='1388' column='1'/>
+      <parameter type-id='type-id-450' name='maxchar' filepath='Objects/unicodeobject.c' line='1388' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_CheckConsistency' mangled-name='_PyUnicode_CheckConsistency' filepath='Objects/unicodeobject.c' line='489' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_CheckConsistency'>
+      <parameter type-id='type-id-16' name='op' filepath='Objects/unicodeobject.c' line='489' column='1'/>
+      <parameter type-id='type-id-9' name='check_content' filepath='Objects/unicodeobject.c' line='489' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_Py_GetErrorHandler' mangled-name='_Py_GetErrorHandler' filepath='Objects/unicodeobject.c' line='385' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_GetErrorHandler'>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='385' column='1'/>
+      <return type-id='type-id-366'/>
+    </function-decl>
+    <function-decl name='PyUnicode_RichCompare' mangled-name='PyUnicode_RichCompare' filepath='Objects/unicodeobject.c' line='11613' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_RichCompare'>
+      <parameter type-id='type-id-16' name='left' filepath='Objects/unicodeobject.c' line='11613' column='1'/>
+      <parameter type-id='type-id-16' name='right' filepath='Objects/unicodeobject.c' line='11613' column='1'/>
+      <parameter type-id='type-id-9' name='op' filepath='Objects/unicodeobject.c' line='11613' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_Contains' mangled-name='PyUnicode_Contains' filepath='Objects/unicodeobject.c' line='11658' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_Contains'>
+      <parameter type-id='type-id-16' name='str' filepath='Objects/unicodeobject.c' line='11658' column='1'/>
+      <parameter type-id='type-id-16' name='substr' filepath='Objects/unicodeobject.c' line='11658' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyUnicode_Resize' mangled-name='PyUnicode_Resize' filepath='Objects/unicodeobject.c' line='2061' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_Resize'>
+      <parameter type-id='type-id-86' name='p_unicode' filepath='Objects/unicodeobject.c' line='2061' column='1'/>
+      <parameter type-id='type-id-31' name='length' filepath='Objects/unicodeobject.c' line='2061' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_FromASCII' mangled-name='_PyUnicode_FromASCII' filepath='Objects/unicodeobject.c' line='2398' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_FromASCII'>
+      <parameter type-id='type-id-3' name='buffer' filepath='Objects/unicodeobject.c' line='2398' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='2398' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_FromKindAndData' mangled-name='PyUnicode_FromKindAndData' filepath='Objects/unicodeobject.c' line='2509' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_FromKindAndData'>
+      <parameter type-id='type-id-9' name='kind' filepath='Objects/unicodeobject.c' line='2509' column='1'/>
+      <parameter type-id='type-id-21' name='buffer' filepath='Objects/unicodeobject.c' line='2509' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='2509' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_FromOrdinal' mangled-name='PyUnicode_FromOrdinal' filepath='Objects/unicodeobject.c' line='3447' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_FromOrdinal'>
+      <parameter type-id='type-id-9' name='ordinal' filepath='Objects/unicodeobject.c' line='3447' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_FromObject' mangled-name='PyUnicode_FromObject' filepath='Objects/unicodeobject.c' line='3459' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_FromObject'>
+      <parameter type-id='type-id-16' name='obj' filepath='Objects/unicodeobject.c' line='3459' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_AsUnicode' mangled-name='_PyUnicode_AsUnicode' filepath='Objects/unicodeobject.c' line='4297' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_AsUnicode'>
+      <parameter type-id='type-id-16' name='unicode' filepath='Objects/unicodeobject.c' line='4297' column='1'/>
+      <return type-id='type-id-438'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_AsLatin1String' mangled-name='_PyUnicode_AsLatin1String' filepath='Objects/unicodeobject.c' line='7353' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_AsLatin1String'>
+      <parameter type-id='type-id-16' name='unicode' filepath='Objects/unicodeobject.c' line='7353' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='7353' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_AsASCIIString' mangled-name='_PyUnicode_AsASCIIString' filepath='Objects/unicodeobject.c' line='7494' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_AsASCIIString'>
+      <parameter type-id='type-id-16' name='unicode' filepath='Objects/unicodeobject.c' line='7494' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='7494' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_AsEncodedString' mangled-name='PyUnicode_AsEncodedString' filepath='Objects/unicodeobject.c' line='3873' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_AsEncodedString'>
+      <parameter type-id='type-id-16' name='unicode' filepath='Objects/unicodeobject.c' line='3873' column='1'/>
+      <parameter type-id='type-id-3' name='encoding' filepath='Objects/unicodeobject.c' line='3874' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='3875' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_EqualToASCIIString' mangled-name='_PyUnicode_EqualToASCIIString' filepath='Objects/unicodeobject.c' line='11546' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_EqualToASCIIString'>
+      <parameter type-id='type-id-16' name='unicode' filepath='Objects/unicodeobject.c' line='11546' column='1'/>
+      <parameter type-id='type-id-3' name='str' filepath='Objects/unicodeobject.c' line='11546' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyUnicode_Partition' mangled-name='PyUnicode_Partition' filepath='Objects/unicodeobject.c' line='13488' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_Partition'>
+      <parameter type-id='type-id-16' name='str_obj' filepath='Objects/unicodeobject.c' line='13488' column='1'/>
+      <parameter type-id='type-id-16' name='sep_obj' filepath='Objects/unicodeobject.c' line='13488' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_RPartition' mangled-name='PyUnicode_RPartition' filepath='Objects/unicodeobject.c' line='13540' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_RPartition'>
+      <parameter type-id='type-id-16' name='str_obj' filepath='Objects/unicodeobject.c' line='13488' column='1'/>
+      <parameter type-id='type-id-16' name='sep_obj' filepath='Objects/unicodeobject.c' line='13488' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyUnicodeWriter_WriteSubstring' mangled-name='_PyUnicodeWriter_WriteSubstring' filepath='Objects/unicodeobject.c' line='14229' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicodeWriter_WriteSubstring'>
+      <parameter type-id='type-id-451' name='writer' filepath='Objects/unicodeobject.c' line='14229' column='1'/>
+      <parameter type-id='type-id-16' name='str' filepath='Objects/unicodeobject.c' line='14229' column='1'/>
+      <parameter type-id='type-id-31' name='start' filepath='Objects/unicodeobject.c' line='14230' column='1'/>
+      <parameter type-id='type-id-31' name='end' filepath='Objects/unicodeobject.c' line='14230' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyUnicodeWriter_Finish' mangled-name='_PyUnicodeWriter_Finish' filepath='Objects/unicodeobject.c' line='14338' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicodeWriter_Finish'>
+      <parameter type-id='type-id-451' name='writer' filepath='Objects/unicodeobject.c' line='14338' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicode_Decode' mangled-name='PyUnicode_Decode' filepath='Objects/unicodeobject.c' line='3583' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyUnicode_Decode'>
+      <parameter type-id='type-id-3' name='s' filepath='Objects/unicodeobject.c' line='3583' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Objects/unicodeobject.c' line='3584' column='1'/>
+      <parameter type-id='type-id-3' name='encoding' filepath='Objects/unicodeobject.c' line='3585' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Objects/unicodeobject.c' line='3586' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyModuleDef_Init' mangled-name='PyModuleDef_Init' filepath='./Include/moduleobject.h' line='40' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyInterpreterState_GetConfig' mangled-name='_PyInterpreterState_GetConfig' filepath='./Include/cpython/pystate.h' line='211' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_SetFileSystemEncoding' mangled-name='_Py_SetFileSystemEncoding' filepath='./Include/internal/pycore_pylifecycle.h' line='37' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_DumpPathConfig' mangled-name='_Py_DumpPathConfig' filepath='./Include/internal/pycore_pathconfig.h' line='67' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyCodec_Lookup' mangled-name='_PyCodec_Lookup' filepath='./Include/codecs.h' line='57' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyMem_RawWcsdup' mangled-name='_PyMem_RawWcsdup' filepath='./Include/cpython/pymem.h' line='20' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyLong_FormatWriter' mangled-name='_PyLong_FormatWriter' filepath='./Include/longobject.h' line='178' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_ToBase' mangled-name='PyNumber_ToBase' filepath='./Include/abstract.h' line='634' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_ToDecimalDigit' mangled-name='_PyUnicode_ToDecimalDigit' filepath='./Include/cpython/unicodeobject.h' line='1125' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_IsXidStart' mangled-name='_PyUnicode_IsXidStart' filepath='./Include/cpython/unicodeobject.h' line='1069' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_IsXidContinue' mangled-name='_PyUnicode_IsXidContinue' filepath='./Include/cpython/unicodeobject.h' line='1073' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='wmemcmp' mangled-name='wmemcmp' filepath='/usr/include/wchar.h' line='258' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_IsWhitespace' mangled-name='_PyUnicode_IsWhitespace' filepath='./Include/cpython/unicodeobject.h' line='1077' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_IsLinebreak' mangled-name='_PyUnicode_IsLinebreak' filepath='./Include/cpython/unicodeobject.h' line='1081' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_IsCaseIgnorable' mangled-name='_PyUnicode_IsCaseIgnorable' filepath='./Include/cpython/unicodeobject.h' line='1117' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_IsCased' mangled-name='_PyUnicode_IsCased' filepath='./Include/cpython/unicodeobject.h' line='1121' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyCodec_StrictErrors' mangled-name='PyCodec_StrictErrors' filepath='./Include/codecs.h' line='222' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicodeTranslateError_SetStart' mangled-name='PyUnicodeTranslateError_SetStart' filepath='./Include/pyerrors.h' line='276' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicodeTranslateError_SetEnd' mangled-name='PyUnicodeTranslateError_SetEnd' filepath='./Include/pyerrors.h' line='288' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicodeTranslateError_Create' mangled-name='_PyUnicodeTranslateError_Create' filepath='./Include/cpython/pyerrors.h' line='194' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicodeTranslateError_SetReason' mangled-name='PyUnicodeTranslateError_SetReason' filepath='./Include/pyerrors.h' line='305' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyCodec_LookupError' mangled-name='PyCodec_LookupError' filepath='./Include/codecs.h' line='219' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyBytesWriter_WriteBytes' mangled-name='_PyBytesWriter_WriteBytes' filepath='./Include/cpython/bytesobject.h' line='115' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyBytesWriter_Init' mangled-name='_PyBytesWriter_Init' filepath='./Include/cpython/bytesobject.h' line='71' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyBytesWriter_Alloc' mangled-name='_PyBytesWriter_Alloc' filepath='./Include/cpython/bytesobject.h' line='85' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyBytesWriter_Finish' mangled-name='_PyBytesWriter_Finish' filepath='./Include/cpython/bytesobject.h' line='76' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyBytesWriter_Dealloc' mangled-name='_PyBytesWriter_Dealloc' filepath='./Include/cpython/bytesobject.h' line='80' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicodeEncodeError_SetStart' mangled-name='PyUnicodeEncodeError_SetStart' filepath='./Include/pyerrors.h' line='274' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicodeEncodeError_SetEnd' mangled-name='PyUnicodeEncodeError_SetEnd' filepath='./Include/pyerrors.h' line='286' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicodeEncodeError_SetReason' mangled-name='PyUnicodeEncodeError_SetReason' filepath='./Include/pyerrors.h' line='297' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyCapsule_Import' mangled-name='PyCapsule_Import' filepath='./Include/pycapsule.h' line='51' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyMem_RawMalloc' mangled-name='PyMem_RawMalloc' filepath='./Include/cpython/pymem.h' line='5' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicodeDecodeError_SetStart' mangled-name='PyUnicodeDecodeError_SetStart' filepath='./Include/pyerrors.h' line='275' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicodeDecodeError_SetEnd' mangled-name='PyUnicodeDecodeError_SetEnd' filepath='./Include/pyerrors.h' line='287' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicodeDecodeError_SetReason' mangled-name='PyUnicodeDecodeError_SetReason' filepath='./Include/pyerrors.h' line='301' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicodeDecodeError_Create' mangled-name='PyUnicodeDecodeError_Create' filepath='./Include/pyerrors.h' line='248' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicodeDecodeError_GetObject' mangled-name='PyUnicodeDecodeError_GetObject' filepath='./Include/pyerrors.h' line='263' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyOS_FSPath' mangled-name='PyOS_FSPath' filepath='./Include/osmodule.h' line='11' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_DecodeLocaleEx' mangled-name='_Py_DecodeLocaleEx' filepath='./Include/cpython/fileutils.h' line='19' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyCodec_Encode' mangled-name='PyCodec_Encode' filepath='./Include/codecs.h' line='87' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_EncodeLocaleEx' mangled-name='_Py_EncodeLocaleEx' filepath='./Include/cpython/fileutils.h' line='27' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyCodec_Decode' mangled-name='PyCodec_Decode' filepath='./Include/codecs.h' line='103' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_WriteUnraisableMsg' mangled-name='_PyErr_WriteUnraisableMsg' filepath='./Include/cpython/pyerrors.h' line='201' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_ToUpperFull' mangled-name='_PyUnicode_ToUpperFull' filepath='./Include/cpython/unicodeobject.h' line='1107' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_ToLowerFull' mangled-name='_PyUnicode_ToLowerFull' filepath='./Include/cpython/unicodeobject.h' line='1097' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_IsUppercase' mangled-name='_PyUnicode_IsUppercase' filepath='./Include/cpython/unicodeobject.h' line='1061' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_IsLowercase' mangled-name='_PyUnicode_IsLowercase' filepath='./Include/cpython/unicodeobject.h' line='1057' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_IsNumeric' mangled-name='_PyUnicode_IsNumeric' filepath='./Include/cpython/unicodeobject.h' line='1145' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_IsDigit' mangled-name='_PyUnicode_IsDigit' filepath='./Include/cpython/unicodeobject.h' line='1141' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_IsDecimalDigit' mangled-name='_PyUnicode_IsDecimalDigit' filepath='./Include/cpython/unicodeobject.h' line='1137' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_IsAlpha' mangled-name='_PyUnicode_IsAlpha' filepath='./Include/cpython/unicodeobject.h' line='1153' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_IsTitlecase' mangled-name='_PyUnicode_IsTitlecase' filepath='./Include/cpython/unicodeobject.h' line='1065' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_ToFoldedFull' mangled-name='_PyUnicode_ToFoldedFull' filepath='./Include/cpython/unicodeobject.h' line='1112' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_ToTitleFull' mangled-name='_PyUnicode_ToTitleFull' filepath='./Include/cpython/unicodeobject.h' line='1102' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='wcscmp' mangled-name='wcscmp' filepath='/usr/include/wchar.h' line='106' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyCodec_EncodeText' mangled-name='_PyCodec_EncodeText' filepath='./Include/codecs.h' line='128' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyMemoryView_FromBuffer' mangled-name='PyMemoryView_FromBuffer' filepath='./Include/memoryobject.h' line='29' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyCodec_DecodeText' mangled-name='_PyCodec_DecodeText' filepath='./Include/codecs.h' line='134' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_FormatAdvancedWriter' mangled-name='_PyUnicode_FormatAdvancedWriter' filepath='./Include/cpython/unicodeobject.h' line='720' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_Format' mangled-name='PyObject_Format' filepath='./Include/abstract.h' line='363' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/unicodectype.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='_PyUnicode_IsAlpha' mangled-name='_PyUnicode_IsAlpha' filepath='Objects/unicodectype.c' line='291' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_IsAlpha'>
+      <parameter type-id='type-id-450' name='ch' filepath='Objects/unicodectype.c' line='291' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_IsCaseIgnorable' mangled-name='_PyUnicode_IsCaseIgnorable' filepath='Objects/unicodectype.c' line='281' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_IsCaseIgnorable'>
+      <parameter type-id='type-id-450' name='ch' filepath='Objects/unicodectype.c' line='291' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_IsCased' mangled-name='_PyUnicode_IsCased' filepath='Objects/unicodectype.c' line='274' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_IsCased'>
+      <parameter type-id='type-id-450' name='ch' filepath='Objects/unicodectype.c' line='291' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_ToFoldedFull' mangled-name='_PyUnicode_ToFoldedFull' filepath='Objects/unicodectype.c' line='259' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_ToFoldedFull'>
+      <parameter type-id='type-id-450' name='ch' filepath='Objects/unicodectype.c' line='259' column='1'/>
+      <parameter type-id='type-id-514' name='res' filepath='Objects/unicodectype.c' line='259' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_ToUpperFull' mangled-name='_PyUnicode_ToUpperFull' filepath='Objects/unicodectype.c' line='243' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_ToUpperFull'>
+      <parameter type-id='type-id-450' name='ch' filepath='Objects/unicodectype.c' line='243' column='1'/>
+      <parameter type-id='type-id-514' name='res' filepath='Objects/unicodectype.c' line='243' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_ToTitleFull' mangled-name='_PyUnicode_ToTitleFull' filepath='Objects/unicodectype.c' line='227' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_ToTitleFull'>
+      <parameter type-id='type-id-450' name='ch' filepath='Objects/unicodectype.c' line='243' column='1'/>
+      <parameter type-id='type-id-514' name='res' filepath='Objects/unicodectype.c' line='243' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_ToLowerFull' mangled-name='_PyUnicode_ToLowerFull' filepath='Objects/unicodectype.c' line='211' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_ToLowerFull'>
+      <parameter type-id='type-id-450' name='ch' filepath='Objects/unicodectype.c' line='243' column='1'/>
+      <parameter type-id='type-id-514' name='res' filepath='Objects/unicodectype.c' line='243' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_ToLowercase' mangled-name='_PyUnicode_ToLowercase' filepath='Objects/unicodectype.c' line='202' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_ToLowercase'>
+      <parameter type-id='type-id-450' name='ch' filepath='Objects/unicodectype.c' line='202' column='1'/>
+      <return type-id='type-id-450'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_ToUppercase' mangled-name='_PyUnicode_ToUppercase' filepath='Objects/unicodectype.c' line='190' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_ToUppercase'>
+      <parameter type-id='type-id-450' name='ch' filepath='Objects/unicodectype.c' line='202' column='1'/>
+      <return type-id='type-id-450'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_IsUppercase' mangled-name='_PyUnicode_IsUppercase' filepath='Objects/unicodectype.c' line='180' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_IsUppercase'>
+      <parameter type-id='type-id-450' name='ch' filepath='Objects/unicodectype.c' line='291' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_IsLowercase' mangled-name='_PyUnicode_IsLowercase' filepath='Objects/unicodectype.c' line='170' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_IsLowercase'>
+      <parameter type-id='type-id-450' name='ch' filepath='Objects/unicodectype.c' line='291' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_IsPrintable' mangled-name='_PyUnicode_IsPrintable' filepath='Objects/unicodectype.c' line='160' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_IsPrintable'>
+      <parameter type-id='type-id-450' name='ch' filepath='Objects/unicodectype.c' line='291' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_IsNumeric' mangled-name='_PyUnicode_IsNumeric' filepath='Objects/unicodectype.c' line='140' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_IsNumeric'>
+      <parameter type-id='type-id-450' name='ch' filepath='Objects/unicodectype.c' line='291' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_IsDigit' mangled-name='_PyUnicode_IsDigit' filepath='Objects/unicodectype.c' line='130' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_IsDigit'>
+      <parameter type-id='type-id-450' name='ch' filepath='Objects/unicodectype.c' line='130' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_ToDigit' mangled-name='_PyUnicode_ToDigit' filepath='Objects/unicodectype.c' line='123' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_ToDigit'>
+      <parameter type-id='type-id-450' name='ch' filepath='Objects/unicodectype.c' line='291' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_IsDecimalDigit' mangled-name='_PyUnicode_IsDecimalDigit' filepath='Objects/unicodectype.c' line='113' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_IsDecimalDigit'>
+      <parameter type-id='type-id-450' name='ch' filepath='Objects/unicodectype.c' line='130' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_ToDecimalDigit' mangled-name='_PyUnicode_ToDecimalDigit' filepath='Objects/unicodectype.c' line='106' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_ToDecimalDigit'>
+      <parameter type-id='type-id-450' name='ch' filepath='Objects/unicodectype.c' line='291' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_IsXidContinue' mangled-name='_PyUnicode_IsXidContinue' filepath='Objects/unicodectype.c' line='96' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_IsXidContinue'>
+      <parameter type-id='type-id-450' name='ch' filepath='Objects/unicodectype.c' line='291' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_IsXidStart' mangled-name='_PyUnicode_IsXidStart' filepath='Objects/unicodectype.c' line='86' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_IsXidStart'>
+      <parameter type-id='type-id-450' name='ch' filepath='Objects/unicodectype.c' line='291' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_IsTitlecase' mangled-name='_PyUnicode_IsTitlecase' filepath='Objects/unicodectype.c' line='76' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_IsTitlecase'>
+      <parameter type-id='type-id-450' name='ch' filepath='Objects/unicodectype.c' line='291' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_ToTitlecase' mangled-name='_PyUnicode_ToTitlecase' filepath='Objects/unicodectype.c' line='64' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_ToTitlecase'>
+      <parameter type-id='type-id-450' name='ch' filepath='Objects/unicodectype.c' line='202' column='1'/>
+      <return type-id='type-id-450'/>
+    </function-decl>
+    <qualified-type-def type-id='type-id-450' const='yes' id='type-id-516'/>
+    <function-decl name='_PyUnicode_IsLinebreak' mangled-name='_PyUnicode_IsLinebreak' filepath='Objects/unicodetype_db.h' line='6249' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_IsLinebreak'>
+      <parameter type-id='type-id-516' name='ch' filepath='Objects/unicodetype_db.h' line='6249' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_IsWhitespace' mangled-name='_PyUnicode_IsWhitespace' filepath='Objects/unicodetype_db.h' line='6208' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_IsWhitespace'>
+      <parameter type-id='type-id-516' name='ch' filepath='Objects/unicodetype_db.h' line='6249' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/unionobject.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='_PyUnion_Type' type-id='type-id-149' visibility='default' filepath='./Include/internal/pycore_unionobject.h' line='11' column='1'/>
+    <function-decl name='_Py_make_parameters' mangled-name='_Py_make_parameters' filepath='./Include/internal/pycore_unionobject.h' line='17' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_subs_parameters' mangled-name='_Py_subs_parameters' filepath='./Include/internal/pycore_unionobject.h' line='16' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_IsSubclass' mangled-name='PyObject_IsSubclass' filepath='./Include/abstract.h' line='862' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_IsInstance' mangled-name='PyObject_IsInstance' filepath='./Include/abstract.h' line='859' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Objects/weakrefobject.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='_PyWeakref_RefType' type-id='type-id-149' mangled-name='_PyWeakref_RefType' visibility='default' filepath='./Include/weakrefobject.h' line='43' column='1' elf-symbol-id='_PyWeakref_RefType'/>
+    <var-decl name='_PyWeakref_ProxyType' type-id='type-id-149' mangled-name='_PyWeakref_ProxyType' visibility='default' filepath='./Include/weakrefobject.h' line='44' column='1' elf-symbol-id='_PyWeakref_ProxyType'/>
+    <var-decl name='_PyWeakref_CallableProxyType' type-id='type-id-149' mangled-name='_PyWeakref_CallableProxyType' visibility='default' filepath='./Include/weakrefobject.h' line='45' column='1' elf-symbol-id='_PyWeakref_CallableProxyType'/>
+    <function-decl name='PyObject_ClearWeakRefs' mangled-name='PyObject_ClearWeakRefs' filepath='Objects/weakrefobject.c' line='967' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_ClearWeakRefs'>
+      <parameter type-id='type-id-16' name='object' filepath='Objects/weakrefobject.c' line='967' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyWeakref_GetObject' mangled-name='PyWeakref_GetObject' filepath='Objects/weakrefobject.c' line='937' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyWeakref_GetObject'>
+      <parameter type-id='type-id-16' name='input' filepath='Objects/bytearrayobject.c' line='80' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyWeakref_NewProxy' mangled-name='PyWeakref_NewProxy' filepath='Objects/weakrefobject.c' line='870' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyWeakref_NewProxy'>
+      <parameter type-id='type-id-16' name='ob' filepath='Objects/weakrefobject.c' line='870' column='1'/>
+      <parameter type-id='type-id-16' name='callback' filepath='Objects/weakrefobject.c' line='870' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyWeakref_NewRef' mangled-name='PyWeakref_NewRef' filepath='Objects/weakrefobject.c' line='811' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyWeakref_NewRef'>
+      <parameter type-id='type-id-16' name='ob' filepath='Objects/weakrefobject.c' line='811' column='1'/>
+      <parameter type-id='type-id-16' name='callback' filepath='Objects/weakrefobject.c' line='811' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <class-decl name='_PyWeakReference' size-in-bits='448' is-struct='yes' visibility='default' filepath='./Include/weakrefobject.h' line='16' column='1' id='type-id-517'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='ob_base' type-id='type-id-69' visibility='default' filepath='./Include/weakrefobject.h' line='17' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='wr_object' type-id='type-id-16' visibility='default' filepath='./Include/weakrefobject.h' line='23' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='wr_callback' type-id='type-id-16' visibility='default' filepath='./Include/weakrefobject.h' line='26' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='hash' type-id='type-id-117' visibility='default' filepath='./Include/weakrefobject.h' line='31' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='wr_prev' type-id='type-id-518' visibility='default' filepath='./Include/weakrefobject.h' line='38' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='384'>
+        <var-decl name='wr_next' type-id='type-id-518' visibility='default' filepath='./Include/weakrefobject.h' line='39' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='PyWeakReference' type-id='type-id-517' filepath='./Include/weakrefobject.h' line='10' column='1' id='type-id-519'/>
+    <pointer-type-def type-id='type-id-519' size-in-bits='64' id='type-id-518'/>
+    <function-decl name='_PyWeakref_ClearRef' mangled-name='_PyWeakref_ClearRef' filepath='Objects/weakrefobject.c' line='92' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyWeakref_ClearRef'>
+      <parameter type-id='type-id-518' name='self' filepath='Objects/weakrefobject.c' line='92' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyWeakref_GetWeakrefCount' mangled-name='_PyWeakref_GetWeakrefCount' filepath='Objects/weakrefobject.c' line='11' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyWeakref_GetWeakrefCount'>
+      <parameter type-id='type-id-518' name='head' filepath='Objects/weakrefobject.c' line='11' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='PyNumber_InPlaceMatrixMultiply' mangled-name='PyNumber_InPlaceMatrixMultiply' filepath='./Include/abstract.h' line='569' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_MatrixMultiply' mangled-name='PyNumber_MatrixMultiply' filepath='./Include/abstract.h' line='436' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_InPlaceOr' mangled-name='PyNumber_InPlaceOr' filepath='./Include/abstract.h' line='628' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_InPlaceXor' mangled-name='PyNumber_InPlaceXor' filepath='./Include/abstract.h' line='622' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_InPlaceAnd' mangled-name='PyNumber_InPlaceAnd' filepath='./Include/abstract.h' line='616' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_InPlaceRshift' mangled-name='PyNumber_InPlaceRshift' filepath='./Include/abstract.h' line='610' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_InPlaceLshift' mangled-name='PyNumber_InPlaceLshift' filepath='./Include/abstract.h' line='604' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_InPlacePower' mangled-name='PyNumber_InPlacePower' filepath='./Include/abstract.h' line='597' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_InPlaceRemainder' mangled-name='PyNumber_InPlaceRemainder' filepath='./Include/abstract.h' line='590' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_InPlaceTrueDivide' mangled-name='PyNumber_InPlaceTrueDivide' filepath='./Include/abstract.h' line='583' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_InPlaceFloorDivide' mangled-name='PyNumber_InPlaceFloorDivide' filepath='./Include/abstract.h' line='576' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_InPlaceMultiply' mangled-name='PyNumber_InPlaceMultiply' filepath='./Include/abstract.h' line='565' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_InPlaceSubtract' mangled-name='PyNumber_InPlaceSubtract' filepath='./Include/abstract.h' line='559' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_InPlaceAdd' mangled-name='PyNumber_InPlaceAdd' filepath='./Include/abstract.h' line='553' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_Xor' mangled-name='PyNumber_Xor' filepath='./Include/abstract.h' line='510' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_And' mangled-name='PyNumber_And' filepath='./Include/abstract.h' line='505' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_Rshift' mangled-name='PyNumber_Rshift' filepath='./Include/abstract.h' line='499' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_Lshift' mangled-name='PyNumber_Lshift' filepath='./Include/abstract.h' line='493' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_Invert' mangled-name='PyNumber_Invert' filepath='./Include/abstract.h' line='488' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_Absolute' mangled-name='PyNumber_Absolute' filepath='./Include/abstract.h' line='483' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_Positive' mangled-name='PyNumber_Positive' filepath='./Include/abstract.h' line='478' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_Power' mangled-name='PyNumber_Power' filepath='./Include/abstract.h' line='467' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_Divmod' mangled-name='PyNumber_Divmod' filepath='./Include/abstract.h' line='461' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_TrueDivide' mangled-name='PyNumber_TrueDivide' filepath='./Include/abstract.h' line='449' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/_warnings.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='_PyWarnings_Init' mangled-name='_PyWarnings_Init' filepath='Python/_warnings.c' line='1389' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyWarnings_Init'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyErr_WarnExplicitFormat' mangled-name='PyErr_WarnExplicitFormat' filepath='Python/_warnings.c' line='1249' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_WarnExplicitFormat'>
+      <parameter type-id='type-id-16' name='category' filepath='Python/_warnings.c' line='1249' column='1'/>
+      <parameter type-id='type-id-3' name='filename_str' filepath='Python/_warnings.c' line='1250' column='1'/>
+      <parameter type-id='type-id-9' name='lineno' filepath='Python/_warnings.c' line='1250' column='1'/>
+      <parameter type-id='type-id-3' name='module_str' filepath='Python/_warnings.c' line='1251' column='1'/>
+      <parameter type-id='type-id-16' name='registry' filepath='Python/_warnings.c' line='1251' column='1'/>
+      <parameter type-id='type-id-3' name='format' filepath='Python/_warnings.c' line='1252' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyErr_WarnExplicit' mangled-name='PyErr_WarnExplicit' filepath='Python/_warnings.c' line='1221' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_WarnExplicit'>
+      <parameter type-id='type-id-16' name='category' filepath='Python/_warnings.c' line='1221' column='1'/>
+      <parameter type-id='type-id-3' name='text' filepath='Python/_warnings.c' line='1221' column='1'/>
+      <parameter type-id='type-id-3' name='filename_str' filepath='Python/_warnings.c' line='1222' column='1'/>
+      <parameter type-id='type-id-9' name='lineno' filepath='Python/_warnings.c' line='1222' column='1'/>
+      <parameter type-id='type-id-3' name='module_str' filepath='Python/_warnings.c' line='1223' column='1'/>
+      <parameter type-id='type-id-16' name='registry' filepath='Python/_warnings.c' line='1223' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyErr_WarnExplicitObject' mangled-name='PyErr_WarnExplicitObject' filepath='Python/_warnings.c' line='1205' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_WarnExplicitObject'>
+      <parameter type-id='type-id-16' name='category' filepath='Python/_warnings.c' line='1205' column='1'/>
+      <parameter type-id='type-id-16' name='message' filepath='Python/_warnings.c' line='1205' column='1'/>
+      <parameter type-id='type-id-16' name='filename' filepath='Python/_warnings.c' line='1206' column='1'/>
+      <parameter type-id='type-id-9' name='lineno' filepath='Python/_warnings.c' line='1206' column='1'/>
+      <parameter type-id='type-id-16' name='module' filepath='Python/_warnings.c' line='1207' column='1'/>
+      <parameter type-id='type-id-16' name='registry' filepath='Python/_warnings.c' line='1207' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyErr_WarnEx' mangled-name='PyErr_WarnEx' filepath='Python/_warnings.c' line='1181' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_WarnEx'>
+      <parameter type-id='type-id-16' name='category' filepath='Python/_warnings.c' line='1181' column='1'/>
+      <parameter type-id='type-id-3' name='text' filepath='Python/_warnings.c' line='1181' column='1'/>
+      <parameter type-id='type-id-31' name='stack_level' filepath='Python/_warnings.c' line='1181' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyErr_ResourceWarning' mangled-name='PyErr_ResourceWarning' filepath='Python/_warnings.c' line='1162' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_ResourceWarning'>
+      <parameter type-id='type-id-16' name='source' filepath='Python/_warnings.c' line='1162' column='1'/>
+      <parameter type-id='type-id-31' name='stack_level' filepath='Python/_warnings.c' line='1162' column='1'/>
+      <parameter type-id='type-id-3' name='format' filepath='Python/_warnings.c' line='1163' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyErr_WarnFormat' mangled-name='PyErr_WarnFormat' filepath='Python/_warnings.c' line='1128' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_WarnFormat'>
+      <parameter type-id='type-id-16' name='source' filepath='Python/_warnings.c' line='1162' column='1'/>
+      <parameter type-id='type-id-31' name='stack_level' filepath='Python/_warnings.c' line='1162' column='1'/>
+      <parameter type-id='type-id-3' name='format' filepath='Python/_warnings.c' line='1163' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyModule_AddObjectRef' mangled-name='PyModule_AddObjectRef' filepath='./Include/modsupport.h' line='142' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_Splitlines' mangled-name='PyUnicode_Splitlines' filepath='./Include/unicodeobject.h' line='862' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyList_GetItem' mangled-name='PyList_GetItem' filepath='./Include/listobject.h' line='31' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyFrame_GetBack' mangled-name='PyFrame_GetBack' filepath='./Include/cpython/frameobject.h' line='94' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_GetLength' mangled-name='PyUnicode_GetLength' filepath='./Include/unicodeobject.h' line='169' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyFile_WriteObject' mangled-name='PyFile_WriteObject' filepath='./Include/fileobject.h' line='15' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyFile_WriteString' mangled-name='PyFile_WriteString' filepath='./Include/fileobject.h' line='16' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PySys_GetObjectId' mangled-name='_PySys_GetObjectId' filepath='./Include/cpython/sysmodule.h' line='5' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_DisplaySourceLine' mangled-name='_Py_DisplaySourceLine' filepath='./Include/cpython/traceback.h' line='13' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_IsFinalizing' mangled-name='_Py_IsFinalizing' filepath='./Include/cpython/pylifecycle.h' line='53' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_Contains' mangled-name='PyUnicode_Contains' filepath='./Include/unicodeobject.h' line='1033' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/Python-ast.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='PyInit__ast' mangled-name='PyInit__ast' filepath='Python/Python-ast.c' line='11998' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInit__ast'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyObject_CallFunction' mangled-name='PyObject_CallFunction' filepath='./Include/abstract.h' line='182' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyType_FromSpec' mangled-name='PyType_FromSpec' filepath='./Include/object.h' line='230' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyType_GenericNew' mangled-name='PyType_GenericNew' filepath='./Include/object.h' line='259' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='Py_EnterRecursiveCall' mangled-name='Py_EnterRecursiveCall' filepath='./Include/ceval.h' line='67' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='Py_LeaveRecursiveCall' mangled-name='Py_LeaveRecursiveCall' filepath='./Include/ceval.h' line='68' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyModule_AddIntConstant' mangled-name='PyModule_AddIntConstant' filepath='./Include/modsupport.h' line='148' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PySequence_Index' mangled-name='PySequence_Index' filepath='./Include/abstract.h' line='762' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyType_GetSlot' mangled-name='PyType_GetSlot' filepath='./Include/object.h' line='235' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/ast.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='Py_GetRecursionLimit' mangled-name='Py_GetRecursionLimit' filepath='./Include/ceval.h' line='65' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/ast_opt.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='_PyAST_GetDocString' mangled-name='_PyAST_GetDocString' filepath='./Include/internal/pycore_ast.h' line='850' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/ast_unparse.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='PyUnicode_Find' mangled-name='PyUnicode_Find' filepath='./Include/unicodeobject.h' line='942' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_Replace' mangled-name='PyUnicode_Replace' filepath='./Include/unicodeobject.h' line='973' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/bltinmodule.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PyFilter_Type' type-id='type-id-149' mangled-name='PyFilter_Type' visibility='default' filepath='./Include/bltinmodule.h' line='7' column='1' elf-symbol-id='PyFilter_Type'/>
+    <var-decl name='PyMap_Type' type-id='type-id-149' mangled-name='PyMap_Type' visibility='default' filepath='./Include/bltinmodule.h' line='8' column='1' elf-symbol-id='PyMap_Type'/>
+    <var-decl name='PyZip_Type' type-id='type-id-149' mangled-name='PyZip_Type' visibility='default' filepath='./Include/bltinmodule.h' line='9' column='1' elf-symbol-id='PyZip_Type'/>
+    <function-decl name='_PyModule_CreateInitialized' mangled-name='_PyModule_CreateInitialized' filepath='./Include/modsupport.h' line='229' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyArg_ParseStackAndKeywords' mangled-name='_PyArg_ParseStackAndKeywords' filepath='./Include/modsupport.h' line='116' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_GetAIter' mangled-name='PyObject_GetAIter' filepath='./Include/abstract.h' line='377' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyImport_ImportModuleLevelObject' mangled-name='PyImport_ImportModuleLevelObject' filepath='./Include/import.h' line='60' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyMapping_SetItemString' mangled-name='PyMapping_SetItemString' filepath='./Include/abstract.h' line='855' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyType_CalculateMetaclass' mangled-name='_PyType_CalculateMetaclass' filepath='./Include/cpython/object.h' line='303' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyFile_GetLine' mangled-name='PyFile_GetLine' filepath='./Include/fileobject.h' line='14' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyAnextAwaitable_New' mangled-name='PyAnextAwaitable_New' filepath='Python/bltinmodule.c' line='1616' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_SourceAsString' mangled-name='_Py_SourceAsString' filepath='./Include/cpython/pythonrun.h' line='73' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyEval_MergeCompilerFlags' mangled-name='PyEval_MergeCompilerFlags' filepath='./Include/cpython/ceval.h' line='20' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyRun_StringFlags' mangled-name='PyRun_StringFlags' filepath='./Include/cpython/pythonrun.h' line='44' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyEval_GetBuiltins' mangled-name='PyEval_GetBuiltins' filepath='./Include/ceval.h' line='31' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyEval_EvalCode' mangled-name='PyEval_EvalCode' filepath='./Include/eval.h' line='10' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyArena_New' mangled-name='_PyArena_New' filepath='./Include/internal/pycore_pyarena.h' line='38' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyAST_obj2mod' mangled-name='PyAST_obj2mod' filepath='./Include/internal/pycore_ast.h' line='839' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_Validate' mangled-name='_PyAST_Validate' filepath='./Include/internal/pycore_ast.h' line='842' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyArena_Free' mangled-name='_PyArena_Free' filepath='./Include/internal/pycore_pyarena.h' line='39' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_Compile' mangled-name='_PyAST_Compile' filepath='./Include/internal/pycore_compile.h' line='15' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyAST_Check' mangled-name='PyAST_Check' filepath='./Include/internal/pycore_ast.h' line='840' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='Py_CompileStringObject' mangled-name='Py_CompileStringObject' filepath='./Include/cpython/pythonrun.h' line='63' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_FSDecoder' mangled-name='PyUnicode_FSDecoder' filepath='./Include/unicodeobject.h' line='773' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_FromOrdinal' mangled-name='PyUnicode_FromOrdinal' filepath='./Include/unicodeobject.h' line='332' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyCallIter_New' mangled-name='PyCallIter_New' filepath='./Include/iterobject.h' line='21' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PySys_GetObject' mangled-name='PySys_GetObject' filepath='./Include/sysmodule.h' line='10' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/ceval.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='Py_EnterRecursiveCall' mangled-name='Py_EnterRecursiveCall' filepath='Python/ceval.c' line='6505' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_EnterRecursiveCall'>
+      <parameter type-id='type-id-3' name='where' filepath='Python/ceval.c' line='6505' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyEval_RequestCodeExtraIndex' mangled-name='_PyEval_RequestCodeExtraIndex' filepath='Python/ceval.c' line='6427' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyEval_RequestCodeExtraIndex'>
+      <parameter type-id='type-id-65' name='free' filepath='Python/ceval.c' line='6427' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='_PyEval_SliceIndexNotNone' mangled-name='_PyEval_SliceIndexNotNone' filepath='Python/ceval.c' line='5964' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyEval_SliceIndexNotNone'>
+      <parameter type-id='type-id-16' name='v' filepath='Python/ceval.c' line='5964' column='1'/>
+      <parameter type-id='type-id-125' name='pi' filepath='Python/ceval.c' line='5964' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyEval_SliceIndex' mangled-name='_PyEval_SliceIndex' filepath='Python/ceval.c' line='5942' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyEval_SliceIndex'>
+      <parameter type-id='type-id-16' name='v' filepath='Python/ceval.c' line='5942' column='1'/>
+      <parameter type-id='type-id-125' name='pi' filepath='Python/ceval.c' line='5942' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyEval_GetFuncDesc' mangled-name='PyEval_GetFuncDesc' filepath='Python/ceval.c' line='5782' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyEval_GetFuncDesc'>
+      <parameter type-id='type-id-16' name='func' filepath='Python/ceval.c' line='5782' column='1'/>
+      <return type-id='type-id-3'/>
+    </function-decl>
+    <function-decl name='PyEval_GetFuncName' mangled-name='PyEval_GetFuncName' filepath='Python/ceval.c' line='5769' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyEval_GetFuncName'>
+      <parameter type-id='type-id-16' name='func' filepath='Python/ceval.c' line='5769' column='1'/>
+      <return type-id='type-id-3'/>
+    </function-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='64' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-520' visibility='default' filepath='./Include/cpython/compile.h' line='24' column='1' id='type-id-521'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='cf_flags' type-id='type-id-9' visibility='default' filepath='./Include/cpython/compile.h' line='25' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='32'>
+        <var-decl name='cf_feature_version' type-id='type-id-9' visibility='default' filepath='./Include/cpython/compile.h' line='26' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='PyCompilerFlags' type-id='type-id-521' filepath='./Include/cpython/compile.h' line='27' column='1' id='type-id-520'/>
+    <pointer-type-def type-id='type-id-520' size-in-bits='64' id='type-id-522'/>
+    <function-decl name='PyEval_MergeCompilerFlags' mangled-name='PyEval_MergeCompilerFlags' filepath='Python/ceval.c' line='5744' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyEval_MergeCompilerFlags'>
+      <parameter type-id='type-id-522' name='cf' filepath='Python/ceval.c' line='5744' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyEval_GetGlobals' mangled-name='PyEval_GetGlobals' filepath='Python/ceval.c' line='5731' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyEval_GetGlobals'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyEval_GetLocals' mangled-name='PyEval_GetLocals' filepath='Python/ceval.c' line='5713' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyEval_GetLocals'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyEval_GetBuiltinId' mangled-name='_PyEval_GetBuiltinId' filepath='Python/ceval.c' line='5699' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyEval_GetBuiltinId'>
+      <parameter type-id='type-id-453' name='name' filepath='Python/ceval.c' line='5699' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyEval_GetBuiltins' mangled-name='PyEval_GetBuiltins' filepath='Python/ceval.c' line='5691' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyEval_GetBuiltins'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <class-decl name='_frame' size-in-bits='2880' is-struct='yes' visibility='default' filepath='./Include/cpython/frameobject.h' line='28' column='1' id='type-id-523'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='ob_base' type-id='type-id-37' visibility='default' filepath='./Include/cpython/frameobject.h' line='29' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='f_back' type-id='type-id-333' visibility='default' filepath='./Include/cpython/frameobject.h' line='30' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='f_code' type-id='type-id-418' visibility='default' filepath='./Include/cpython/frameobject.h' line='31' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='f_builtins' type-id='type-id-16' visibility='default' filepath='./Include/cpython/frameobject.h' line='32' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='384'>
+        <var-decl name='f_globals' type-id='type-id-16' visibility='default' filepath='./Include/cpython/frameobject.h' line='33' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='448'>
+        <var-decl name='f_locals' type-id='type-id-16' visibility='default' filepath='./Include/cpython/frameobject.h' line='34' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='512'>
+        <var-decl name='f_valuestack' type-id='type-id-86' visibility='default' filepath='./Include/cpython/frameobject.h' line='35' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='576'>
+        <var-decl name='f_trace' type-id='type-id-16' visibility='default' filepath='./Include/cpython/frameobject.h' line='36' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='640'>
+        <var-decl name='f_stackdepth' type-id='type-id-9' visibility='default' filepath='./Include/cpython/frameobject.h' line='37' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='672'>
+        <var-decl name='f_trace_lines' type-id='type-id-1' visibility='default' filepath='./Include/cpython/frameobject.h' line='38' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='680'>
+        <var-decl name='f_trace_opcodes' type-id='type-id-1' visibility='default' filepath='./Include/cpython/frameobject.h' line='39' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='704'>
+        <var-decl name='f_gen' type-id='type-id-16' visibility='default' filepath='./Include/cpython/frameobject.h' line='42' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='768'>
+        <var-decl name='f_lasti' type-id='type-id-9' visibility='default' filepath='./Include/cpython/frameobject.h' line='44' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='800'>
+        <var-decl name='f_lineno' type-id='type-id-9' visibility='default' filepath='./Include/cpython/frameobject.h' line='45' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='832'>
+        <var-decl name='f_iblock' type-id='type-id-9' visibility='default' filepath='./Include/cpython/frameobject.h' line='46' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='864'>
+        <var-decl name='f_state' type-id='type-id-335' visibility='default' filepath='./Include/cpython/frameobject.h' line='47' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='896'>
+        <var-decl name='f_blockstack' type-id='type-id-336' visibility='default' filepath='./Include/cpython/frameobject.h' line='48' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2816'>
+        <var-decl name='f_localsplus' type-id='type-id-337' visibility='default' filepath='./Include/cpython/frameobject.h' line='49' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='PyFrameObject' type-id='type-id-523' filepath='./Include/pyframe.h' line='12' column='1' id='type-id-524'/>
+    <pointer-type-def type-id='type-id-524' size-in-bits='64' id='type-id-525'/>
+    <function-decl name='PyEval_GetFrame' mangled-name='PyEval_GetFrame' filepath='Python/ceval.c' line='5674' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyEval_GetFrame'>
+      <return type-id='type-id-525'/>
+    </function-decl>
+    <function-decl name='_PyEval_GetAsyncGenFinalizer' mangled-name='_PyEval_GetAsyncGenFinalizer' filepath='Python/ceval.c' line='5667' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyEval_GetAsyncGenFinalizer'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyEval_SetAsyncGenFinalizer' mangled-name='_PyEval_SetAsyncGenFinalizer' filepath='Python/ceval.c' line='5653' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyEval_SetAsyncGenFinalizer'>
+      <parameter type-id='type-id-16' name='finalizer' filepath='Python/ceval.c' line='5653' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyEval_GetAsyncGenFirstiter' mangled-name='_PyEval_GetAsyncGenFirstiter' filepath='Python/ceval.c' line='5646' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyEval_GetAsyncGenFirstiter'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyEval_SetAsyncGenFirstiter' mangled-name='_PyEval_SetAsyncGenFirstiter' filepath='Python/ceval.c' line='5632' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyEval_SetAsyncGenFirstiter'>
+      <parameter type-id='type-id-16' name='finalizer' filepath='Python/ceval.c' line='5653' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyEval_GetCoroutineOriginTrackingDepth' mangled-name='_PyEval_GetCoroutineOriginTrackingDepth' filepath='Python/ceval.c' line='5625' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyEval_GetCoroutineOriginTrackingDepth'>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <class-decl name='_ts' size-in-bits='2240' is-struct='yes' visibility='default' filepath='./Include/cpython/pystate.h' line='60' column='1' id='type-id-526'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='prev' type-id='type-id-11' visibility='default' filepath='./Include/cpython/pystate.h' line='63' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='next' type-id='type-id-11' visibility='default' filepath='./Include/cpython/pystate.h' line='64' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='interp' type-id='type-id-222' visibility='default' filepath='./Include/cpython/pystate.h' line='65' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='frame' type-id='type-id-525' visibility='default' filepath='./Include/cpython/pystate.h' line='68' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='recursion_depth' type-id='type-id-9' visibility='default' filepath='./Include/cpython/pystate.h' line='69' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='288'>
+        <var-decl name='recursion_headroom' type-id='type-id-9' visibility='default' filepath='./Include/cpython/pystate.h' line='70' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='stackcheck_counter' type-id='type-id-9' visibility='default' filepath='./Include/cpython/pystate.h' line='71' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='352'>
+        <var-decl name='tracing' type-id='type-id-9' visibility='default' filepath='./Include/cpython/pystate.h' line='76' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='384'>
+        <var-decl name='cframe' type-id='type-id-14' visibility='default' filepath='./Include/cpython/pystate.h' line='80' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='448'>
+        <var-decl name='c_profilefunc' type-id='type-id-15' visibility='default' filepath='./Include/cpython/pystate.h' line='82' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='512'>
+        <var-decl name='c_tracefunc' type-id='type-id-15' visibility='default' filepath='./Include/cpython/pystate.h' line='83' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='576'>
+        <var-decl name='c_profileobj' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='84' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='640'>
+        <var-decl name='c_traceobj' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='85' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='704'>
+        <var-decl name='curexc_type' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='88' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='768'>
+        <var-decl name='curexc_value' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='89' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='832'>
+        <var-decl name='curexc_traceback' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='90' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='896'>
+        <var-decl name='exc_state' type-id='type-id-17' visibility='default' filepath='./Include/cpython/pystate.h' line='95' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1152'>
+        <var-decl name='exc_info' type-id='type-id-18' visibility='default' filepath='./Include/cpython/pystate.h' line='99' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1216'>
+        <var-decl name='dict' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='101' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1280'>
+        <var-decl name='gilstate_counter' type-id='type-id-9' visibility='default' filepath='./Include/cpython/pystate.h' line='103' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1344'>
+        <var-decl name='async_exc' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='105' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1408'>
+        <var-decl name='thread_id' type-id='type-id-19' visibility='default' filepath='./Include/cpython/pystate.h' line='106' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1472'>
+        <var-decl name='trash_delete_nesting' type-id='type-id-9' visibility='default' filepath='./Include/cpython/pystate.h' line='108' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1536'>
+        <var-decl name='trash_delete_later' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='109' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1600'>
+        <var-decl name='on_delete' type-id='type-id-20' visibility='default' filepath='./Include/cpython/pystate.h' line='134' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1664'>
+        <var-decl name='on_delete_data' type-id='type-id-21' visibility='default' filepath='./Include/cpython/pystate.h' line='135' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1728'>
+        <var-decl name='coroutine_origin_tracking_depth' type-id='type-id-9' visibility='default' filepath='./Include/cpython/pystate.h' line='137' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1792'>
+        <var-decl name='async_gen_firstiter' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='139' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1856'>
+        <var-decl name='async_gen_finalizer' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='140' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1920'>
+        <var-decl name='context' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='142' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1984'>
+        <var-decl name='context_ver' type-id='type-id-22' visibility='default' filepath='./Include/cpython/pystate.h' line='143' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2048'>
+        <var-decl name='id' type-id='type-id-22' visibility='default' filepath='./Include/cpython/pystate.h' line='146' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2112'>
+        <var-decl name='root_cframe' type-id='type-id-23' visibility='default' filepath='./Include/cpython/pystate.h' line='148' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='_is' size-in-bits='908160' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_interp.h' line='220' column='1' id='type-id-527'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='next' type-id='type-id-225' visibility='default' filepath='./Include/internal/pycore_interp.h' line='222' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='tstate_head' type-id='type-id-11' visibility='default' filepath='./Include/internal/pycore_interp.h' line='223' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='runtime' type-id='type-id-528' visibility='default' filepath='./Include/internal/pycore_interp.h' line='228' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='id' type-id='type-id-227' visibility='default' filepath='./Include/internal/pycore_interp.h' line='230' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='id_refcount' type-id='type-id-227' visibility='default' filepath='./Include/internal/pycore_interp.h' line='231' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='requires_idref' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_interp.h' line='232' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='384'>
+        <var-decl name='id_mutex' type-id='type-id-228' visibility='default' filepath='./Include/internal/pycore_interp.h' line='233' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='448'>
+        <var-decl name='finalizing' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_interp.h' line='235' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='512'>
+        <var-decl name='ceval' type-id='type-id-229' visibility='default' filepath='./Include/internal/pycore_interp.h' line='237' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='4928'>
+        <var-decl name='gc' type-id='type-id-230' visibility='default' filepath='./Include/internal/pycore_interp.h' line='238' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='6848'>
+        <var-decl name='modules' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='241' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='6912'>
+        <var-decl name='modules_by_index' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='242' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='6976'>
+        <var-decl name='sysdict' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='244' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7040'>
+        <var-decl name='builtins' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='246' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7104'>
+        <var-decl name='importlib' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='248' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7168'>
+        <var-decl name='num_threads' type-id='type-id-33' visibility='default' filepath='./Include/internal/pycore_interp.h' line='251' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7232'>
+        <var-decl name='pythread_stacksize' type-id='type-id-157' visibility='default' filepath='./Include/internal/pycore_interp.h' line='256' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7296'>
+        <var-decl name='codec_search_path' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='258' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7360'>
+        <var-decl name='codec_search_cache' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='259' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7424'>
+        <var-decl name='codec_error_registry' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='260' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7488'>
+        <var-decl name='codecs_initialized' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_interp.h' line='261' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7552'>
+        <var-decl name='config' type-id='type-id-231' visibility='default' filepath='./Include/internal/pycore_interp.h' line='263' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10688'>
+        <var-decl name='dlopenflags' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_interp.h' line='265' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10752'>
+        <var-decl name='dict' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='268' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10816'>
+        <var-decl name='builtins_copy' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='270' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10880'>
+        <var-decl name='import_func' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='271' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10944'>
+        <var-decl name='eval_frame' type-id='type-id-232' visibility='default' filepath='./Include/internal/pycore_interp.h' line='273' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='11008'>
+        <var-decl name='co_extra_user_count' type-id='type-id-31' visibility='default' filepath='./Include/internal/pycore_interp.h' line='275' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='11072'>
+        <var-decl name='co_extra_freefuncs' type-id='type-id-233' visibility='default' filepath='./Include/internal/pycore_interp.h' line='276' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='27392'>
+        <var-decl name='before_forkers' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='279' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='27456'>
+        <var-decl name='after_forkers_parent' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='280' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='27520'>
+        <var-decl name='after_forkers_child' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='281' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='27584'>
+        <var-decl name='tstate_next_unique_id' type-id='type-id-22' visibility='default' filepath='./Include/internal/pycore_interp.h' line='284' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='27648'>
+        <var-decl name='warnings' type-id='type-id-234' visibility='default' filepath='./Include/internal/pycore_interp.h' line='286' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='27904'>
+        <var-decl name='atexit' type-id='type-id-235' visibility='default' filepath='./Include/internal/pycore_interp.h' line='287' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='28032'>
+        <var-decl name='audit_hooks' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='289' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='28096'>
+        <var-decl name='small_ints' type-id='type-id-236' visibility='default' filepath='./Include/internal/pycore_interp.h' line='296' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='44864'>
+        <var-decl name='bytes' type-id='type-id-237' visibility='default' filepath='./Include/internal/pycore_interp.h' line='297' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='61312'>
+        <var-decl name='unicode' type-id='type-id-238' visibility='default' filepath='./Include/internal/pycore_interp.h' line='298' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='78208'>
+        <var-decl name='float_state' type-id='type-id-239' visibility='default' filepath='./Include/internal/pycore_interp.h' line='299' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='78336'>
+        <var-decl name='slice_cache' type-id='type-id-240' visibility='default' filepath='./Include/internal/pycore_interp.h' line='302' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='78400'>
+        <var-decl name='tuple' type-id='type-id-241' visibility='default' filepath='./Include/internal/pycore_interp.h' line='304' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='80320'>
+        <var-decl name='list' type-id='type-id-242' visibility='default' filepath='./Include/internal/pycore_interp.h' line='305' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='85504'>
+        <var-decl name='dict_state' type-id='type-id-243' visibility='default' filepath='./Include/internal/pycore_interp.h' line='306' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='95872'>
+        <var-decl name='frame' type-id='type-id-529' visibility='default' filepath='./Include/internal/pycore_interp.h' line='307' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='96000'>
+        <var-decl name='async_gen' type-id='type-id-245' visibility='default' filepath='./Include/internal/pycore_interp.h' line='308' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='106368'>
+        <var-decl name='context' type-id='type-id-246' visibility='default' filepath='./Include/internal/pycore_interp.h' line='309' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='106496'>
+        <var-decl name='exc_state' type-id='type-id-247' visibility='default' filepath='./Include/internal/pycore_interp.h' line='310' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='106688'>
+        <var-decl name='ast' type-id='type-id-248' visibility='default' filepath='./Include/internal/pycore_interp.h' line='312' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='121728'>
+        <var-decl name='type_cache' type-id='type-id-249' visibility='default' filepath='./Include/internal/pycore_interp.h' line='313' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='pyruntimestate' size-in-bits='5376' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='61' column='1' id='type-id-530'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='preinitializing' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='63' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='32'>
+        <var-decl name='preinitialized' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='66' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='core_initialized' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='69' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='96'>
+        <var-decl name='initialized' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='72' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='_finalizing' type-id='type-id-251' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='79' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='interpreters' type-id='type-id-252' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='94' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='448'>
+        <var-decl name='xidregistry' type-id='type-id-253' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='99' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='576'>
+        <var-decl name='main_thread' type-id='type-id-19' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='101' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='640'>
+        <var-decl name='exitfuncs' type-id='type-id-254' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='104' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2688'>
+        <var-decl name='nexitfuncs' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='105' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2752'>
+        <var-decl name='ceval' type-id='type-id-255' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='107' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='4480'>
+        <var-decl name='gilstate' type-id='type-id-256' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='108' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='4736'>
+        <var-decl name='preconfig' type-id='type-id-257' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='110' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='5056'>
+        <var-decl name='open_code_hook' type-id='type-id-258' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='114' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='5120'>
+        <var-decl name='open_code_userdata' type-id='type-id-21' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='115' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='5184'>
+        <var-decl name='audit_hook_head' type-id='type-id-531' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='116' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='5248'>
+        <var-decl name='unicode_ids' type-id='type-id-260' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='118' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-309' size-in-bits='64' id='type-id-531'/>
+    <pointer-type-def type-id='type-id-530' size-in-bits='64' id='type-id-528'/>
+    <class-decl name='_Py_frame_state' size-in-bits='128' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_interp.h' line='138' column='1' id='type-id-529'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='free_list' type-id='type-id-525' visibility='default' filepath='./Include/internal/pycore_interp.h' line='139' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='numfree' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_interp.h' line='141' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='PyThreadState' type-id='type-id-526' filepath='./Include/pystate.h' line='20' column='1' id='type-id-532'/>
+    <pointer-type-def type-id='type-id-532' size-in-bits='64' id='type-id-533'/>
+    <function-decl name='_PyEval_SetCoroutineOriginTrackingDepth' mangled-name='_PyEval_SetCoroutineOriginTrackingDepth' filepath='Python/ceval.c' line='5618' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyEval_SetCoroutineOriginTrackingDepth'>
+      <parameter type-id='type-id-533' name='tstate' filepath='Python/ceval.c' line='5618' column='1'/>
+      <parameter type-id='type-id-9' name='new_depth' filepath='Python/ceval.c' line='5618' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyEval_SetTrace' mangled-name='PyEval_SetTrace' filepath='Python/ceval.c' line='5607' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyEval_SetTrace'>
+      <parameter type-id='type-id-15' name='func' filepath='Python/ceval.c' line='5607' column='1'/>
+      <parameter type-id='type-id-16' name='arg' filepath='Python/ceval.c' line='5607' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyEval_SetTrace' mangled-name='_PyEval_SetTrace' filepath='Python/ceval.c' line='5574' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyEval_SetTrace'>
+      <parameter type-id='type-id-533' name='tstate' filepath='Python/ceval.c' line='5574' column='1'/>
+      <parameter type-id='type-id-15' name='func' filepath='Python/ceval.c' line='5574' column='1'/>
+      <parameter type-id='type-id-16' name='arg' filepath='Python/ceval.c' line='5574' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyEval_SetProfile' mangled-name='PyEval_SetProfile' filepath='Python/ceval.c' line='5564' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyEval_SetProfile'>
+      <parameter type-id='type-id-15' name='func' filepath='Python/ceval.c' line='5607' column='1'/>
+      <parameter type-id='type-id-16' name='arg' filepath='Python/ceval.c' line='5607' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyEval_SetProfile' mangled-name='_PyEval_SetProfile' filepath='Python/ceval.c' line='5533' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyEval_SetProfile'>
+      <parameter type-id='type-id-533' name='tstate' filepath='Python/ceval.c' line='5574' column='1'/>
+      <parameter type-id='type-id-15' name='func' filepath='Python/ceval.c' line='5574' column='1'/>
+      <parameter type-id='type-id-16' name='arg' filepath='Python/ceval.c' line='5574' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyEval_CallTracing' mangled-name='_PyEval_CallTracing' filepath='Python/ceval.c' line='5488' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyEval_CallTracing'>
+      <parameter type-id='type-id-16' name='func' filepath='Python/ceval.c' line='5488' column='1'/>
+      <parameter type-id='type-id-16' name='args' filepath='Python/ceval.c' line='5488' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyEval_EvalFrameDefault' mangled-name='_PyEval_EvalFrameDefault' filepath='Python/ceval.c' line='1577' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyEval_EvalFrameDefault'>
+      <parameter type-id='type-id-533' name='tstate' filepath='Python/ceval.c' line='1577' column='1'/>
+      <parameter type-id='type-id-525' name='f' filepath='Python/ceval.c' line='1577' column='1'/>
+      <parameter type-id='type-id-9' name='throwflag' filepath='Python/ceval.c' line='1577' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyEval_EvalFrameEx' mangled-name='PyEval_EvalFrameEx' filepath='Python/ceval.c' line='1149' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyEval_EvalFrameEx'>
+      <parameter type-id='type-id-525' name='f' filepath='Python/ceval.c' line='1149' column='1'/>
+      <parameter type-id='type-id-9' name='throwflag' filepath='Python/ceval.c' line='1149' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyEval_EvalFrame' mangled-name='PyEval_EvalFrame' filepath='Python/ceval.c' line='1141' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyEval_EvalFrame'>
+      <parameter type-id='type-id-525' name='f' filepath='Python/ceval.c' line='1141' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyEval_EvalCode' mangled-name='PyEval_EvalCode' filepath='Python/ceval.c' line='1114' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyEval_EvalCode'>
+      <parameter type-id='type-id-16' name='co' filepath='Python/ceval.c' line='1114' column='1'/>
+      <parameter type-id='type-id-16' name='globals' filepath='Python/ceval.c' line='1114' column='1'/>
+      <parameter type-id='type-id-16' name='locals' filepath='Python/ceval.c' line='1114' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='Py_SetRecursionLimit' mangled-name='Py_SetRecursionLimit' filepath='Python/ceval.c' line='848' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_SetRecursionLimit'>
+      <parameter type-id='type-id-9' name='new_limit' filepath='Python/ceval.c' line='848' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='Py_GetRecursionLimit' mangled-name='Py_GetRecursionLimit' filepath='Python/ceval.c' line='841' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_GetRecursionLimit'>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='Py_MakePendingCalls' mangled-name='Py_MakePendingCalls' filepath='Python/ceval.c' line='774' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_MakePendingCalls'>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='Py_AddPendingCall' mangled-name='Py_AddPendingCall' filepath='Python/ceval.c' line='653' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_AddPendingCall'>
+      <parameter type-id='type-id-313' name='func' filepath='Python/ceval.c' line='653' column='1'/>
+      <parameter type-id='type-id-21' name='arg' filepath='Python/ceval.c' line='653' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyEval_AddPendingCall' mangled-name='_PyEval_AddPendingCall' filepath='Python/ceval.c' line='634' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyEval_AddPendingCall'>
+      <parameter type-id='type-id-222' name='interp' filepath='Python/ceval.c' line='634' column='1'/>
+      <parameter type-id='type-id-313' name='func' filepath='Python/ceval.c' line='635' column='1'/>
+      <parameter type-id='type-id-21' name='arg' filepath='Python/ceval.c' line='635' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyEval_SignalReceived' mangled-name='_PyEval_SignalReceived' filepath='Python/ceval.c' line='577' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyEval_SignalReceived'>
+      <parameter type-id='type-id-222' name='interp' filepath='Python/ceval.c' line='577' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyEval_RestoreThread' mangled-name='PyEval_RestoreThread' filepath='Python/ceval.c' line='543' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyEval_RestoreThread'>
+      <parameter type-id='type-id-533' name='tstate' filepath='Python/ceval.c' line='543' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyEval_SaveThread' mangled-name='PyEval_SaveThread' filepath='Python/ceval.c' line='520' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyEval_SaveThread'>
+      <return type-id='type-id-533'/>
+    </function-decl>
+    <function-decl name='_PyEval_SignalAsyncExc' mangled-name='_PyEval_SignalAsyncExc' filepath='Python/ceval.c' line='514' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyEval_SignalAsyncExc'>
+      <parameter type-id='type-id-222' name='interp' filepath='Python/ceval.c' line='514' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyEval_ReleaseThread' mangled-name='PyEval_ReleaseThread' filepath='Python/ceval.c' line='464' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyEval_ReleaseThread'>
+      <parameter type-id='type-id-533' name='tstate' filepath='Python/ceval.c' line='464' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyEval_AcquireThread' mangled-name='PyEval_AcquireThread' filepath='Python/ceval.c' line='447' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyEval_AcquireThread'>
+      <parameter type-id='type-id-533' name='tstate' filepath='Python/ceval.c' line='447' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyEval_ReleaseLock' mangled-name='PyEval_ReleaseLock' filepath='Python/ceval.c' line='426' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyEval_ReleaseLock'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyEval_AcquireLock' mangled-name='PyEval_AcquireLock' filepath='Python/ceval.c' line='416' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyEval_AcquireLock'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyEval_InitThreads' mangled-name='PyEval_InitThreads' filepath='Python/ceval.c' line='362' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyEval_InitThreads'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyEval_ThreadsInitialized' mangled-name='PyEval_ThreadsInitialized' filepath='Python/ceval.c' line='299' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyEval_ThreadsInitialized'>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_Py_FatalError_TstateNULL' mangled-name='_Py_FatalError_TstateNULL' filepath='Python/ceval.c' line='269' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_FatalError_TstateNULL'>
+      <parameter type-id='type-id-3' name='func' filepath='Python/ceval.c' line='269' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyEval_GetSwitchInterval' mangled-name='_PyEval_GetSwitchInterval' filepath='Python/ceval_gil.h' line='340' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyEval_GetSwitchInterval'>
+      <return type-id='type-id-19'/>
+    </function-decl>
+    <function-decl name='_PyEval_SetSwitchInterval' mangled-name='_PyEval_SetSwitchInterval' filepath='Python/ceval_gil.h' line='329' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyEval_SetSwitchInterval'>
+      <parameter type-id='type-id-19' name='microseconds' filepath='Python/ceval_gil.h' line='329' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_CheckRecursiveCall' mangled-name='_Py_CheckRecursiveCall' filepath='Python/ceval.c' line='860' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_CheckRecursiveCall'>
+      <parameter type-id='type-id-533' name='tstate' filepath='Python/ceval.c' line='860' column='1'/>
+      <parameter type-id='type-id-3' name='where' filepath='Python/ceval.c' line='860' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyUnicode_Append' mangled-name='PyUnicode_Append' filepath='./Include/unicodeobject.h' line='827' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyCode_CheckLineNumber' mangled-name='_PyCode_CheckLineNumber' filepath='./Include/cpython/code.h' line='154' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyFrame_FastToLocalsWithError' mangled-name='PyFrame_FastToLocalsWithError' filepath='./Include/cpython/frameobject.h' line='89' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_SetObject' mangled-name='_PyErr_SetObject' filepath='./Include/internal/pycore_pyerrors.h' line='48' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PySys_Audit' mangled-name='_PySys_Audit' filepath='./Include/internal/pycore_sysmodule.h' line='11' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_NormalizeException' mangled-name='_PyErr_NormalizeException' filepath='./Include/internal/pycore_pyerrors.h' line='73' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyCell_New' mangled-name='PyCell_New' filepath='./Include/cellobject.h' line='18' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyFrame_New_NoTrack' mangled-name='_PyFrame_New_NoTrack' filepath='./Include/cpython/frameobject.h' line='75' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_Concat' mangled-name='PyUnicode_Concat' filepath='./Include/unicodeobject.h' line='819' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_Format' mangled-name='PyUnicode_Format' filepath='./Include/unicodeobject.h' line='1022' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyException_SetCause' mangled-name='PyException_SetCause' filepath='./Include/pyerrors.h' line='44' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_GetTopmostException' mangled-name='_PyErr_GetTopmostException' filepath='./Include/cpython/pyerrors.h' line='87' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyGen_yf' mangled-name='_PyGen_yf' filepath='./Include/genobject.h' line='45' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyIter_Send' mangled-name='PyIter_Send' filepath='./Include/abstract.h' line='408' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAsyncGenValueWrapperNew' mangled-name='_PyAsyncGenValueWrapperNew' filepath='./Include/genobject.h' line='90' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyFrame_BlockPop' mangled-name='PyFrame_BlockPop' filepath='./Include/cpython/frameobject.h' line='83' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyDict_LoadGlobal' mangled-name='_PyDict_LoadGlobal' filepath='./Include/cpython/dictobject.h' line='73' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_JoinArray' mangled-name='_PyUnicode_JoinArray' filepath='./Include/cpython/unicodeobject.h' line='1001' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyDict_MergeEx' mangled-name='_PyDict_MergeEx' filepath='./Include/cpython/dictobject.h' line='66' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyDict_GetItemHint' mangled-name='_PyDict_GetItemHint' filepath='./Include/cpython/dictobject.h' line='74' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyFrame_LocalsToFast' mangled-name='PyFrame_LocalsToFast' filepath='./Include/cpython/frameobject.h' line='87' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyModuleSpec_IsInitializing' mangled-name='_PyModuleSpec_IsInitializing' filepath='./Include/moduleobject.h' line='33' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_SetImportError' mangled-name='PyErr_SetImportError' filepath='./Include/pyerrors.h' line='206' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyModule_GetFilenameObject' mangled-name='PyModule_GetFilenameObject' filepath='./Include/moduleobject.h' line='29' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PySet_Contains' mangled-name='PySet_Contains' filepath='./Include/setobject.h' line='85' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyFrame_BlockSetup' mangled-name='PyFrame_BlockSetup' filepath='./Include/cpython/frameobject.h' line='82' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObject_FastCallDictTstate' mangled-name='_PyObject_FastCallDictTstate' filepath='./Include/internal/pycore_call.h' line='18' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyFunction_NewWithQualName' mangled-name='PyFunction_NewWithQualName' filepath='./Include/funcobject.h' line='58' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PySlice_New' mangled-name='PySlice_New' filepath='./Include/sliceobject.h' line='33' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyException_SetTraceback' mangled-name='PyException_SetTraceback' filepath='./Include/pyerrors.h' line='39' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyThread_get_thread_ident' mangled-name='PyThread_get_thread_ident' filepath='./Include/pythread.h' line='26' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_CheckSignalsTstate' mangled-name='_PyErr_CheckSignalsTstate' filepath='./Include/internal/pycore_pyerrors.h' line='85' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_SetNone' mangled-name='_PyErr_SetNone' filepath='./Include/internal/pycore_pyerrors.h' line='58' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyThreadState_Swap' mangled-name='_PyThreadState_Swap' filepath='./Include/internal/pycore_pystate.h' line='129' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyCode_InitOpcache' mangled-name='_PyCode_InitOpcache' filepath='./Include/internal/pycore_code.h' line='28' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyTraceBack_Here' mangled-name='PyTraceBack_Here' filepath='./Include/traceback.h' line='9' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyAsyncGen_New' mangled-name='PyAsyncGen_New' filepath='./Include/genobject.h' line='85' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyGen_NewWithQualName' mangled-name='PyGen_NewWithQualName' filepath='./Include/genobject.h' line='41' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyCoro_New' mangled-name='PyCoro_New' filepath='./Include/genobject.h' line='59' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyThread_free_lock' mangled-name='PyThread_free_lock' filepath='./Include/pythread.h' line='34' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_Print' mangled-name='_PyErr_Print' filepath='./Include/internal/pycore_pylifecycle.h' line='130' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyGILState_GetThisThreadState' mangled-name='PyGILState_GetThisThreadState' filepath='./Include/pystate.h' line='138' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyThread_at_fork_reinit' mangled-name='_PyThread_at_fork_reinit' filepath='./Include/pythread.h' line='44' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyThreadState_DeleteExcept' mangled-name='_PyThreadState_DeleteExcept' filepath='./Include/internal/pycore_pystate.h' line='125' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='pthread_cond_destroy' mangled-name='pthread_cond_destroy' filepath='/usr/include/pthread.h' line='970' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='pthread_mutex_destroy' mangled-name='pthread_mutex_destroy' filepath='/usr/include/pthread.h' line='730' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyThread_init_thread' mangled-name='PyThread_init_thread' filepath='./Include/pythread.h' line='23' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyThread_cond_after' mangled-name='_PyThread_cond_after' filepath='Python/condvar.h' line='53' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='pthread_cond_timedwait' mangled-name='pthread_cond_timedwait' filepath='/usr/include/pthread.h' line='997' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='pthread_mutex_unlock' mangled-name='pthread_mutex_unlock' filepath='/usr/include/pthread.h' line='756' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='pthread_mutex_lock' mangled-name='pthread_mutex_lock' filepath='/usr/include/pthread.h' line='738' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='pthread_cond_signal' mangled-name='pthread_cond_signal' filepath='/usr/include/pthread.h' line='974' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyThread_exit_thread' mangled-name='PyThread_exit_thread' filepath='./Include/pythread.h' line='25' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='pthread_cond_wait' mangled-name='pthread_cond_wait' filepath='/usr/include/pthread.h' line='986' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='pthread_mutex_init' mangled-name='pthread_mutex_init' filepath='/usr/include/pthread.h' line='725' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyThread_cond_init' mangled-name='_PyThread_cond_init' filepath='Python/condvar.h' line='52' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/codecs.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='Py_hexdigits' type-id='type-id-3' mangled-name='Py_hexdigits' visibility='default' filepath='./Include/codecs.h' line='242' column='1' elf-symbol-id='Py_hexdigits'/>
+    <function-decl name='PyCodec_NameReplaceErrors' mangled-name='PyCodec_NameReplaceErrors' filepath='Python/codecs.c' line='959' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCodec_NameReplaceErrors'>
+      <parameter type-id='type-id-16' name='exc' filepath='Python/codecs.c' line='959' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyCodec_BackslashReplaceErrors' mangled-name='PyCodec_BackslashReplaceErrors' filepath='Python/codecs.c' line='850' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCodec_BackslashReplaceErrors'>
+      <parameter type-id='type-id-16' name='exc' filepath='Python/codecs.c' line='850' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyCodec_XMLCharRefReplaceErrors' mangled-name='PyCodec_XMLCharRefReplaceErrors' filepath='Python/codecs.c' line='752' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCodec_XMLCharRefReplaceErrors'>
+      <parameter type-id='type-id-16' name='exc' filepath='Python/codecs.c' line='959' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyCodec_ReplaceErrors' mangled-name='PyCodec_ReplaceErrors' filepath='Python/codecs.c' line='699' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCodec_ReplaceErrors'>
+      <parameter type-id='type-id-16' name='exc' filepath='Python/codecs.c' line='699' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyCodec_IgnoreErrors' mangled-name='PyCodec_IgnoreErrors' filepath='Python/codecs.c' line='675' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCodec_IgnoreErrors'>
+      <parameter type-id='type-id-16' name='exc' filepath='Python/codecs.c' line='675' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyCodec_LookupError' mangled-name='PyCodec_LookupError' filepath='Python/codecs.c' line='638' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCodec_LookupError'>
+      <parameter type-id='type-id-3' name='name' filepath='Python/codecs.c' line='638' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyCodec_DecodeText' mangled-name='_PyCodec_DecodeText' filepath='Python/codecs.c' line='603' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyCodec_DecodeText'>
+      <parameter type-id='type-id-16' name='object' filepath='Python/codecs.c' line='603' column='1'/>
+      <parameter type-id='type-id-3' name='encoding' filepath='Python/codecs.c' line='604' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Python/codecs.c' line='605' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyCodec_EncodeText' mangled-name='_PyCodec_EncodeText' filepath='Python/codecs.c' line='590' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyCodec_EncodeText'>
+      <parameter type-id='type-id-16' name='object' filepath='Python/codecs.c' line='603' column='1'/>
+      <parameter type-id='type-id-3' name='encoding' filepath='Python/codecs.c' line='604' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Python/codecs.c' line='605' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyCodec_LookupTextEncoding' mangled-name='_PyCodec_LookupTextEncoding' filepath='Python/codecs.c' line='521' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyCodec_LookupTextEncoding'>
+      <parameter type-id='type-id-3' name='encoding' filepath='Python/codecs.c' line='521' column='1'/>
+      <parameter type-id='type-id-3' name='alternate_command' filepath='Python/codecs.c' line='522' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyCodec_Decode' mangled-name='PyCodec_Decode' filepath='Python/codecs.c' line='507' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCodec_Decode'>
+      <parameter type-id='type-id-16' name='object' filepath='Python/codecs.c' line='507' column='1'/>
+      <parameter type-id='type-id-3' name='encoding' filepath='Python/codecs.c' line='508' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Python/codecs.c' line='509' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyCodec_Encode' mangled-name='PyCodec_Encode' filepath='Python/codecs.c' line='494' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCodec_Encode'>
+      <parameter type-id='type-id-16' name='object' filepath='Python/codecs.c' line='507' column='1'/>
+      <parameter type-id='type-id-3' name='encoding' filepath='Python/codecs.c' line='508' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Python/codecs.c' line='509' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyCodec_StreamWriter' mangled-name='PyCodec_StreamWriter' filepath='Python/codecs.c' line='379' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCodec_StreamWriter'>
+      <parameter type-id='type-id-3' name='encoding' filepath='Python/codecs.c' line='379' column='1'/>
+      <parameter type-id='type-id-16' name='stream' filepath='Python/codecs.c' line='380' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Python/codecs.c' line='381' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyCodec_StreamReader' mangled-name='PyCodec_StreamReader' filepath='Python/codecs.c' line='372' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCodec_StreamReader'>
+      <parameter type-id='type-id-3' name='encoding' filepath='Python/codecs.c' line='379' column='1'/>
+      <parameter type-id='type-id-16' name='stream' filepath='Python/codecs.c' line='380' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Python/codecs.c' line='381' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyCodec_IncrementalDecoder' mangled-name='PyCodec_IncrementalDecoder' filepath='Python/codecs.c' line='366' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCodec_IncrementalDecoder'>
+      <parameter type-id='type-id-3' name='encoding' filepath='Python/codecs.c' line='366' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Python/codecs.c' line='367' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyCodec_IncrementalEncoder' mangled-name='PyCodec_IncrementalEncoder' filepath='Python/codecs.c' line='360' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCodec_IncrementalEncoder'>
+      <parameter type-id='type-id-3' name='encoding' filepath='Python/codecs.c' line='366' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Python/codecs.c' line='367' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyCodec_Decoder' mangled-name='PyCodec_Decoder' filepath='Python/codecs.c' line='355' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCodec_Decoder'>
+      <parameter type-id='type-id-3' name='encoding' filepath='Python/codecs.c' line='355' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyCodec_Encoder' mangled-name='PyCodec_Encoder' filepath='Python/codecs.c' line='350' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCodec_Encoder'>
+      <parameter type-id='type-id-3' name='encoding' filepath='Python/codecs.c' line='355' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyCodecInfo_GetIncrementalEncoder' mangled-name='_PyCodecInfo_GetIncrementalEncoder' filepath='Python/codecs.c' line='336' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyCodecInfo_GetIncrementalEncoder'>
+      <parameter type-id='type-id-16' name='codec_info' filepath='Python/codecs.c' line='336' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Python/codecs.c' line='337' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyCodecInfo_GetIncrementalDecoder' mangled-name='_PyCodecInfo_GetIncrementalDecoder' filepath='Python/codecs.c' line='329' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyCodecInfo_GetIncrementalDecoder'>
+      <parameter type-id='type-id-16' name='codec_info' filepath='Python/codecs.c' line='336' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='Python/codecs.c' line='337' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyCodec_KnownEncoding' mangled-name='PyCodec_KnownEncoding' filepath='Python/codecs.c' line='213' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCodec_KnownEncoding'>
+      <parameter type-id='type-id-3' name='encoding' filepath='Python/codecs.c' line='213' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyCodec_Lookup' mangled-name='_PyCodec_Lookup' filepath='Python/codecs.c' line='126' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyCodec_Lookup'>
+      <parameter type-id='type-id-3' name='encoding' filepath='Python/codecs.c' line='126' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyCodec_Unregister' mangled-name='PyCodec_Unregister' filepath='Python/codecs.c' line='54' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCodec_Unregister'>
+      <parameter type-id='type-id-16' name='search_function' filepath='Python/codecs.c' line='54' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyCodec_Register' mangled-name='PyCodec_Register' filepath='Python/codecs.c' line='34' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCodec_Register'>
+      <parameter type-id='type-id-16' name='search_function' filepath='Python/codecs.c' line='34' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyCodec_RegisterError' mangled-name='PyCodec_RegisterError' filepath='Python/codecs.c' line='622' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCodec_RegisterError'>
+      <parameter type-id='type-id-3' name='name' filepath='Python/codecs.c' line='622' column='1'/>
+      <parameter type-id='type-id-16' name='error' filepath='Python/codecs.c' line='622' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyCodec_StrictErrors' mangled-name='PyCodec_StrictErrors' filepath='Python/codecs.c' line='665' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCodec_StrictErrors'>
+      <parameter type-id='type-id-16' name='mp' filepath='Objects/dictobject.c' line='2872' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyUnicodeEncodeError_GetStart' mangled-name='PyUnicodeEncodeError_GetStart' filepath='./Include/pyerrors.h' line='268' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicodeEncodeError_GetEnd' mangled-name='PyUnicodeEncodeError_GetEnd' filepath='./Include/pyerrors.h' line='280' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicodeEncodeError_GetObject' mangled-name='PyUnicodeEncodeError_GetObject' filepath='./Include/pyerrors.h' line='262' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicodeDecodeError_GetStart' mangled-name='PyUnicodeDecodeError_GetStart' filepath='./Include/pyerrors.h' line='269' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicodeDecodeError_GetEnd' mangled-name='PyUnicodeDecodeError_GetEnd' filepath='./Include/pyerrors.h' line='281' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_FromKindAndData' mangled-name='PyUnicode_FromKindAndData' filepath='./Include/cpython/unicodeobject.h' line='558' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicodeEncodeError_GetEncoding' mangled-name='PyUnicodeEncodeError_GetEncoding' filepath='./Include/pyerrors.h' line='258' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicodeDecodeError_GetEncoding' mangled-name='PyUnicodeDecodeError_GetEncoding' filepath='./Include/pyerrors.h' line='259' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicodeTranslateError_GetStart' mangled-name='PyUnicodeTranslateError_GetStart' filepath='./Include/pyerrors.h' line='270' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicodeTranslateError_GetEnd' mangled-name='PyUnicodeTranslateError_GetEnd' filepath='./Include/pyerrors.h' line='282' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicodeTranslateError_GetObject' mangled-name='PyUnicodeTranslateError_GetObject' filepath='./Include/pyerrors.h' line='264' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_TrySetFromCause' mangled-name='_PyErr_TrySetFromCause' filepath='./Include/cpython/pyerrors.h' line='136' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_normalize_encoding' mangled-name='_Py_normalize_encoding' filepath='Python/codecs.c' line='78' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyList_Size' mangled-name='PyList_Size' filepath='./Include/listobject.h' line='29' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyInterpreterState_Get' mangled-name='PyInterpreterState_Get' filepath='./Include/pystate.h' line='36' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/compile.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='PyCode_Optimize' mangled-name='PyCode_Optimize' filepath='Python/compile.c' line='7883' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCode_Optimize'>
+      <parameter type-id='type-id-16' name='code' filepath='Python/compile.c' line='7883' column='1'/>
+      <parameter type-id='type-id-16' name='_unused_consts' filepath='Python/compile.c' line='7883' column='1'/>
+      <parameter type-id='type-id-16' name='_unused_names' filepath='Python/compile.c' line='7884' column='1'/>
+      <parameter type-id='type-id-16' name='_unused_lnotab_obj' filepath='Python/compile.c' line='7884' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyCompile_OpcodeStackEffect' mangled-name='PyCompile_OpcodeStackEffect' filepath='Python/compile.c' line='1228' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCompile_OpcodeStackEffect'>
+      <parameter type-id='type-id-9' name='opcode' filepath='Python/compile.c' line='1228' column='1'/>
+      <parameter type-id='type-id-9' name='oparg' filepath='Python/compile.c' line='1228' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyCompile_OpcodeStackEffectWithJump' mangled-name='PyCompile_OpcodeStackEffectWithJump' filepath='Python/compile.c' line='1222' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyCompile_OpcodeStackEffectWithJump'>
+      <parameter type-id='type-id-9' name='opcode' filepath='Python/compile.c' line='1222' column='1'/>
+      <parameter type-id='type-id-9' name='oparg' filepath='Python/compile.c' line='1222' column='1'/>
+      <parameter type-id='type-id-9' name='jump' filepath='Python/compile.c' line='1222' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <class-decl name='_mod' size-in-bits='192' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='153' column='1' id='type-id-534'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='kind' type-id='type-id-535' visibility='default' filepath='./Include/internal/pycore_ast.h' line='154' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='v' type-id='type-id-536' visibility='default' filepath='./Include/internal/pycore_ast.h' line='174' column='1'/>
+      </data-member>
+    </class-decl>
+    <enum-decl name='_mod_kind' filepath='./Include/internal/pycore_ast.h' line='151' column='1' id='type-id-535'>
+      <underlying-type type-id='type-id-83'/>
+      <enumerator name='Module_kind' value='1'/>
+      <enumerator name='Interactive_kind' value='2'/>
+      <enumerator name='Expression_kind' value='3'/>
+      <enumerator name='FunctionType_kind' value='4'/>
+    </enum-decl>
+    <union-decl name='__anonymous_union__' size-in-bits='128' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='155' column='1' id='type-id-536'>
+      <data-member access='private'>
+        <var-decl name='Module' type-id='type-id-537' visibility='default' filepath='./Include/internal/pycore_ast.h' line='159' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='Interactive' type-id='type-id-538' visibility='default' filepath='./Include/internal/pycore_ast.h' line='163' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='Expression' type-id='type-id-539' visibility='default' filepath='./Include/internal/pycore_ast.h' line='167' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='FunctionType' type-id='type-id-540' visibility='default' filepath='./Include/internal/pycore_ast.h' line='172' column='1'/>
+      </data-member>
+    </union-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='128' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='156' column='1' id='type-id-537'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='body' type-id='type-id-541' visibility='default' filepath='./Include/internal/pycore_ast.h' line='157' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='type_ignores' type-id='type-id-542' visibility='default' filepath='./Include/internal/pycore_ast.h' line='158' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-543' visibility='default' filepath='./Include/internal/pycore_ast.h' line='62' column='1' id='type-id-544'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='size' type-id='type-id-31' visibility='default' filepath='./Include/internal/pycore_ast.h' line='63' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='elements' type-id='type-id-195' visibility='default' filepath='./Include/internal/pycore_ast.h' line='63' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='typed_elements' type-id='type-id-545' visibility='default' filepath='./Include/internal/pycore_ast.h' line='64' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='_stmt' size-in-bits='576' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='185' column='1' id='type-id-546'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='kind' type-id='type-id-547' visibility='default' filepath='./Include/internal/pycore_ast.h' line='186' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='v' type-id='type-id-548' visibility='default' filepath='./Include/internal/pycore_ast.h' line='325' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='448'>
+        <var-decl name='lineno' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_ast.h' line='326' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='480'>
+        <var-decl name='col_offset' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_ast.h' line='327' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='512'>
+        <var-decl name='end_lineno' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_ast.h' line='328' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='544'>
+        <var-decl name='end_col_offset' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_ast.h' line='329' column='1'/>
+      </data-member>
+    </class-decl>
+    <enum-decl name='_stmt_kind' filepath='./Include/internal/pycore_ast.h' line='177' column='1' id='type-id-547'>
+      <underlying-type type-id='type-id-83'/>
+      <enumerator name='FunctionDef_kind' value='1'/>
+      <enumerator name='AsyncFunctionDef_kind' value='2'/>
+      <enumerator name='ClassDef_kind' value='3'/>
+      <enumerator name='Return_kind' value='4'/>
+      <enumerator name='Delete_kind' value='5'/>
+      <enumerator name='Assign_kind' value='6'/>
+      <enumerator name='AugAssign_kind' value='7'/>
+      <enumerator name='AnnAssign_kind' value='8'/>
+      <enumerator name='For_kind' value='9'/>
+      <enumerator name='AsyncFor_kind' value='10'/>
+      <enumerator name='While_kind' value='11'/>
+      <enumerator name='If_kind' value='12'/>
+      <enumerator name='With_kind' value='13'/>
+      <enumerator name='AsyncWith_kind' value='14'/>
+      <enumerator name='Match_kind' value='15'/>
+      <enumerator name='Raise_kind' value='16'/>
+      <enumerator name='Try_kind' value='17'/>
+      <enumerator name='Assert_kind' value='18'/>
+      <enumerator name='Import_kind' value='19'/>
+      <enumerator name='ImportFrom_kind' value='20'/>
+      <enumerator name='Global_kind' value='21'/>
+      <enumerator name='Nonlocal_kind' value='22'/>
+      <enumerator name='Expr_kind' value='23'/>
+      <enumerator name='Pass_kind' value='24'/>
+      <enumerator name='Break_kind' value='25'/>
+      <enumerator name='Continue_kind' value='26'/>
+    </enum-decl>
+    <union-decl name='__anonymous_union__' size-in-bits='384' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='187' column='1' id='type-id-548'>
+      <data-member access='private'>
+        <var-decl name='FunctionDef' type-id='type-id-549' visibility='default' filepath='./Include/internal/pycore_ast.h' line='195' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='AsyncFunctionDef' type-id='type-id-549' visibility='default' filepath='./Include/internal/pycore_ast.h' line='204' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='ClassDef' type-id='type-id-550' visibility='default' filepath='./Include/internal/pycore_ast.h' line='212' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='Return' type-id='type-id-551' visibility='default' filepath='./Include/internal/pycore_ast.h' line='216' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='Delete' type-id='type-id-552' visibility='default' filepath='./Include/internal/pycore_ast.h' line='220' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='Assign' type-id='type-id-553' visibility='default' filepath='./Include/internal/pycore_ast.h' line='226' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='AugAssign' type-id='type-id-554' visibility='default' filepath='./Include/internal/pycore_ast.h' line='232' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='AnnAssign' type-id='type-id-555' visibility='default' filepath='./Include/internal/pycore_ast.h' line='239' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='For' type-id='type-id-556' visibility='default' filepath='./Include/internal/pycore_ast.h' line='247' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='AsyncFor' type-id='type-id-556' visibility='default' filepath='./Include/internal/pycore_ast.h' line='255' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='While' type-id='type-id-557' visibility='default' filepath='./Include/internal/pycore_ast.h' line='261' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='If' type-id='type-id-557' visibility='default' filepath='./Include/internal/pycore_ast.h' line='267' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='With' type-id='type-id-558' visibility='default' filepath='./Include/internal/pycore_ast.h' line='273' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='AsyncWith' type-id='type-id-558' visibility='default' filepath='./Include/internal/pycore_ast.h' line='279' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='Match' type-id='type-id-559' visibility='default' filepath='./Include/internal/pycore_ast.h' line='284' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='Raise' type-id='type-id-560' visibility='default' filepath='./Include/internal/pycore_ast.h' line='289' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='Try' type-id='type-id-561' visibility='default' filepath='./Include/internal/pycore_ast.h' line='296' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='Assert' type-id='type-id-562' visibility='default' filepath='./Include/internal/pycore_ast.h' line='301' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='Import' type-id='type-id-563' visibility='default' filepath='./Include/internal/pycore_ast.h' line='305' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='ImportFrom' type-id='type-id-564' visibility='default' filepath='./Include/internal/pycore_ast.h' line='311' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='Global' type-id='type-id-565' visibility='default' filepath='./Include/internal/pycore_ast.h' line='315' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='Nonlocal' type-id='type-id-565' visibility='default' filepath='./Include/internal/pycore_ast.h' line='319' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='Expr' type-id='type-id-551' visibility='default' filepath='./Include/internal/pycore_ast.h' line='323' column='1'/>
+      </data-member>
+    </union-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='384' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='188' column='1' id='type-id-549'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='name' type-id='type-id-566' visibility='default' filepath='./Include/internal/pycore_ast.h' line='189' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='args' type-id='type-id-567' visibility='default' filepath='./Include/internal/pycore_ast.h' line='190' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='body' type-id='type-id-541' visibility='default' filepath='./Include/internal/pycore_ast.h' line='191' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='decorator_list' type-id='type-id-568' visibility='default' filepath='./Include/internal/pycore_ast.h' line='192' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='returns' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='193' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='type_comment' type-id='type-id-570' visibility='default' filepath='./Include/internal/pycore_ast.h' line='194' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='identifier' type-id='type-id-16' filepath='./Include/internal/pycore_asdl.h' line='13' column='1' id='type-id-566'/>
+    <class-decl name='_arguments' size-in-bits='448' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='513' column='1' id='type-id-571'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='posonlyargs' type-id='type-id-572' visibility='default' filepath='./Include/internal/pycore_ast.h' line='514' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='args' type-id='type-id-572' visibility='default' filepath='./Include/internal/pycore_ast.h' line='515' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='vararg' type-id='type-id-573' visibility='default' filepath='./Include/internal/pycore_ast.h' line='516' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='kwonlyargs' type-id='type-id-572' visibility='default' filepath='./Include/internal/pycore_ast.h' line='517' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='kw_defaults' type-id='type-id-568' visibility='default' filepath='./Include/internal/pycore_ast.h' line='518' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='kwarg' type-id='type-id-573' visibility='default' filepath='./Include/internal/pycore_ast.h' line='519' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='384'>
+        <var-decl name='defaults' type-id='type-id-568' visibility='default' filepath='./Include/internal/pycore_ast.h' line='520' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-574' visibility='default' filepath='./Include/internal/pycore_ast.h' line='99' column='1' id='type-id-575'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='size' type-id='type-id-31' visibility='default' filepath='./Include/internal/pycore_ast.h' line='100' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='elements' type-id='type-id-195' visibility='default' filepath='./Include/internal/pycore_ast.h' line='100' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='typed_elements' type-id='type-id-576' visibility='default' filepath='./Include/internal/pycore_ast.h' line='101' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='_arg' size-in-bits='320' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='523' column='1' id='type-id-577'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='arg' type-id='type-id-566' visibility='default' filepath='./Include/internal/pycore_ast.h' line='524' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='annotation' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='525' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='type_comment' type-id='type-id-570' visibility='default' filepath='./Include/internal/pycore_ast.h' line='526' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='lineno' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_ast.h' line='527' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='224'>
+        <var-decl name='col_offset' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_ast.h' line='528' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='end_lineno' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_ast.h' line='529' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='288'>
+        <var-decl name='end_col_offset' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_ast.h' line='530' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='_expr' size-in-bits='384' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='340' column='1' id='type-id-578'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='kind' type-id='type-id-579' visibility='default' filepath='./Include/internal/pycore_ast.h' line='341' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='v' type-id='type-id-580' visibility='default' filepath='./Include/internal/pycore_ast.h' line='482' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='lineno' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_ast.h' line='483' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='288'>
+        <var-decl name='col_offset' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_ast.h' line='484' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='end_lineno' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_ast.h' line='485' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='352'>
+        <var-decl name='end_col_offset' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_ast.h' line='486' column='1'/>
+      </data-member>
+    </class-decl>
+    <enum-decl name='_expr_kind' filepath='./Include/internal/pycore_ast.h' line='332' column='1' id='type-id-579'>
+      <underlying-type type-id='type-id-83'/>
+      <enumerator name='BoolOp_kind' value='1'/>
+      <enumerator name='NamedExpr_kind' value='2'/>
+      <enumerator name='BinOp_kind' value='3'/>
+      <enumerator name='UnaryOp_kind' value='4'/>
+      <enumerator name='Lambda_kind' value='5'/>
+      <enumerator name='IfExp_kind' value='6'/>
+      <enumerator name='Dict_kind' value='7'/>
+      <enumerator name='Set_kind' value='8'/>
+      <enumerator name='ListComp_kind' value='9'/>
+      <enumerator name='SetComp_kind' value='10'/>
+      <enumerator name='DictComp_kind' value='11'/>
+      <enumerator name='GeneratorExp_kind' value='12'/>
+      <enumerator name='Await_kind' value='13'/>
+      <enumerator name='Yield_kind' value='14'/>
+      <enumerator name='YieldFrom_kind' value='15'/>
+      <enumerator name='Compare_kind' value='16'/>
+      <enumerator name='Call_kind' value='17'/>
+      <enumerator name='FormattedValue_kind' value='18'/>
+      <enumerator name='JoinedStr_kind' value='19'/>
+      <enumerator name='Constant_kind' value='20'/>
+      <enumerator name='Attribute_kind' value='21'/>
+      <enumerator name='Subscript_kind' value='22'/>
+      <enumerator name='Starred_kind' value='23'/>
+      <enumerator name='Name_kind' value='24'/>
+      <enumerator name='List_kind' value='25'/>
+      <enumerator name='Tuple_kind' value='26'/>
+      <enumerator name='Slice_kind' value='27'/>
+    </enum-decl>
+    <union-decl name='__anonymous_union__' size-in-bits='192' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='342' column='1' id='type-id-580'>
+      <data-member access='private'>
+        <var-decl name='BoolOp' type-id='type-id-581' visibility='default' filepath='./Include/internal/pycore_ast.h' line='346' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='NamedExpr' type-id='type-id-582' visibility='default' filepath='./Include/internal/pycore_ast.h' line='351' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='BinOp' type-id='type-id-583' visibility='default' filepath='./Include/internal/pycore_ast.h' line='357' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='UnaryOp' type-id='type-id-584' visibility='default' filepath='./Include/internal/pycore_ast.h' line='362' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='Lambda' type-id='type-id-585' visibility='default' filepath='./Include/internal/pycore_ast.h' line='367' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='IfExp' type-id='type-id-586' visibility='default' filepath='./Include/internal/pycore_ast.h' line='373' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='Dict' type-id='type-id-587' visibility='default' filepath='./Include/internal/pycore_ast.h' line='378' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='Set' type-id='type-id-588' visibility='default' filepath='./Include/internal/pycore_ast.h' line='382' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='ListComp' type-id='type-id-589' visibility='default' filepath='./Include/internal/pycore_ast.h' line='387' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='SetComp' type-id='type-id-589' visibility='default' filepath='./Include/internal/pycore_ast.h' line='392' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='DictComp' type-id='type-id-590' visibility='default' filepath='./Include/internal/pycore_ast.h' line='398' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='GeneratorExp' type-id='type-id-589' visibility='default' filepath='./Include/internal/pycore_ast.h' line='403' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='Await' type-id='type-id-551' visibility='default' filepath='./Include/internal/pycore_ast.h' line='407' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='Yield' type-id='type-id-551' visibility='default' filepath='./Include/internal/pycore_ast.h' line='411' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='YieldFrom' type-id='type-id-551' visibility='default' filepath='./Include/internal/pycore_ast.h' line='415' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='Compare' type-id='type-id-591' visibility='default' filepath='./Include/internal/pycore_ast.h' line='421' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='Call' type-id='type-id-592' visibility='default' filepath='./Include/internal/pycore_ast.h' line='427' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='FormattedValue' type-id='type-id-593' visibility='default' filepath='./Include/internal/pycore_ast.h' line='433' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='JoinedStr' type-id='type-id-594' visibility='default' filepath='./Include/internal/pycore_ast.h' line='437' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='Constant' type-id='type-id-595' visibility='default' filepath='./Include/internal/pycore_ast.h' line='442' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='Attribute' type-id='type-id-596' visibility='default' filepath='./Include/internal/pycore_ast.h' line='448' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='Subscript' type-id='type-id-597' visibility='default' filepath='./Include/internal/pycore_ast.h' line='454' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='Starred' type-id='type-id-598' visibility='default' filepath='./Include/internal/pycore_ast.h' line='459' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='Name' type-id='type-id-599' visibility='default' filepath='./Include/internal/pycore_ast.h' line='464' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='List' type-id='type-id-600' visibility='default' filepath='./Include/internal/pycore_ast.h' line='469' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='Tuple' type-id='type-id-600' visibility='default' filepath='./Include/internal/pycore_ast.h' line='474' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='Slice' type-id='type-id-601' visibility='default' filepath='./Include/internal/pycore_ast.h' line='480' column='1'/>
+      </data-member>
+    </union-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='128' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='343' column='1' id='type-id-581'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='op' type-id='type-id-602' visibility='default' filepath='./Include/internal/pycore_ast.h' line='344' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='values' type-id='type-id-568' visibility='default' filepath='./Include/internal/pycore_ast.h' line='345' column='1'/>
+      </data-member>
+    </class-decl>
+    <enum-decl name='_boolop' filepath='./Include/internal/pycore_ast.h' line='23' column='1' id='type-id-603'>
+      <underlying-type type-id='type-id-83'/>
+      <enumerator name='And' value='1'/>
+      <enumerator name='Or' value='2'/>
+    </enum-decl>
+    <typedef-decl name='boolop_ty' type-id='type-id-603' filepath='./Include/internal/pycore_ast.h' line='23' column='1' id='type-id-602'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-604' visibility='default' filepath='./Include/internal/pycore_ast.h' line='69' column='1' id='type-id-605'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='size' type-id='type-id-31' visibility='default' filepath='./Include/internal/pycore_ast.h' line='70' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='elements' type-id='type-id-195' visibility='default' filepath='./Include/internal/pycore_ast.h' line='70' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='typed_elements' type-id='type-id-606' visibility='default' filepath='./Include/internal/pycore_ast.h' line='71' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-578' size-in-bits='64' id='type-id-607'/>
+    <typedef-decl name='expr_ty' type-id='type-id-607' filepath='./Include/internal/pycore_ast.h' line='19' column='1' id='type-id-569'/>
+
+    <array-type-def dimensions='1' type-id='type-id-569' size-in-bits='64' id='type-id-606'>
+      <subrange length='1' type-id='type-id-19' id='type-id-182'/>
+
+    </array-type-def>
+    <typedef-decl name='asdl_expr_seq' type-id='type-id-605' filepath='./Include/internal/pycore_ast.h' line='72' column='1' id='type-id-604'/>
+    <pointer-type-def type-id='type-id-604' size-in-bits='64' id='type-id-568'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='128' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='348' column='1' id='type-id-582'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='target' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='349' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='value' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='350' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='353' column='1' id='type-id-583'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='left' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='354' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='op' type-id='type-id-608' visibility='default' filepath='./Include/internal/pycore_ast.h' line='355' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='right' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='356' column='1'/>
+      </data-member>
+    </class-decl>
+    <enum-decl name='_operator' filepath='./Include/internal/pycore_ast.h' line='25' column='1' id='type-id-609'>
+      <underlying-type type-id='type-id-83'/>
+      <enumerator name='Add' value='1'/>
+      <enumerator name='Sub' value='2'/>
+      <enumerator name='Mult' value='3'/>
+      <enumerator name='MatMult' value='4'/>
+      <enumerator name='Div' value='5'/>
+      <enumerator name='Mod' value='6'/>
+      <enumerator name='Pow' value='7'/>
+      <enumerator name='LShift' value='8'/>
+      <enumerator name='RShift' value='9'/>
+      <enumerator name='BitOr' value='10'/>
+      <enumerator name='BitXor' value='11'/>
+      <enumerator name='BitAnd' value='12'/>
+      <enumerator name='FloorDiv' value='13'/>
+    </enum-decl>
+    <typedef-decl name='operator_ty' type-id='type-id-609' filepath='./Include/internal/pycore_ast.h' line='27' column='1' id='type-id-608'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='128' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='359' column='1' id='type-id-584'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='op' type-id='type-id-610' visibility='default' filepath='./Include/internal/pycore_ast.h' line='360' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='operand' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='361' column='1'/>
+      </data-member>
+    </class-decl>
+    <enum-decl name='_unaryop' filepath='./Include/internal/pycore_ast.h' line='29' column='1' id='type-id-611'>
+      <underlying-type type-id='type-id-83'/>
+      <enumerator name='Invert' value='1'/>
+      <enumerator name='Not' value='2'/>
+      <enumerator name='UAdd' value='3'/>
+      <enumerator name='USub' value='4'/>
+    </enum-decl>
+    <typedef-decl name='unaryop_ty' type-id='type-id-611' filepath='./Include/internal/pycore_ast.h' line='29' column='1' id='type-id-610'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='128' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='364' column='1' id='type-id-585'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='args' type-id='type-id-567' visibility='default' filepath='./Include/internal/pycore_ast.h' line='365' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='body' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='366' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-571' size-in-bits='64' id='type-id-612'/>
+    <typedef-decl name='arguments_ty' type-id='type-id-612' filepath='./Include/internal/pycore_ast.h' line='38' column='1' id='type-id-567'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='369' column='1' id='type-id-586'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='test' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='370' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='body' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='371' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='orelse' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='372' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='128' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='375' column='1' id='type-id-587'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='keys' type-id='type-id-568' visibility='default' filepath='./Include/internal/pycore_ast.h' line='376' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='values' type-id='type-id-568' visibility='default' filepath='./Include/internal/pycore_ast.h' line='377' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='64' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='380' column='1' id='type-id-588'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='elts' type-id='type-id-568' visibility='default' filepath='./Include/internal/pycore_ast.h' line='381' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='128' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='384' column='1' id='type-id-589'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='elt' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='385' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='generators' type-id='type-id-613' visibility='default' filepath='./Include/internal/pycore_ast.h' line='386' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-614' visibility='default' filepath='./Include/internal/pycore_ast.h' line='76' column='1' id='type-id-615'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='size' type-id='type-id-31' visibility='default' filepath='./Include/internal/pycore_ast.h' line='77' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='elements' type-id='type-id-195' visibility='default' filepath='./Include/internal/pycore_ast.h' line='77' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='typed_elements' type-id='type-id-616' visibility='default' filepath='./Include/internal/pycore_ast.h' line='78' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='_comprehension' size-in-bits='256' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='489' column='1' id='type-id-617'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='target' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='490' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='iter' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='491' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='ifs' type-id='type-id-568' visibility='default' filepath='./Include/internal/pycore_ast.h' line='492' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='is_async' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_ast.h' line='493' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-617' size-in-bits='64' id='type-id-618'/>
+    <typedef-decl name='comprehension_ty' type-id='type-id-618' filepath='./Include/internal/pycore_ast.h' line='34' column='1' id='type-id-619'/>
+
+    <array-type-def dimensions='1' type-id='type-id-619' size-in-bits='64' id='type-id-616'>
+      <subrange length='1' type-id='type-id-19' id='type-id-182'/>
+
+    </array-type-def>
+    <typedef-decl name='asdl_comprehension_seq' type-id='type-id-615' filepath='./Include/internal/pycore_ast.h' line='79' column='1' id='type-id-614'/>
+    <pointer-type-def type-id='type-id-614' size-in-bits='64' id='type-id-613'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='394' column='1' id='type-id-590'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='key' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='395' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='value' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='396' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='generators' type-id='type-id-613' visibility='default' filepath='./Include/internal/pycore_ast.h' line='397' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='64' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='405' column='1' id='type-id-551'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='value' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='406' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='417' column='1' id='type-id-591'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='left' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='418' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='ops' type-id='type-id-620' visibility='default' filepath='./Include/internal/pycore_ast.h' line='419' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='comparators' type-id='type-id-568' visibility='default' filepath='./Include/internal/pycore_ast.h' line='420' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-621' visibility='default' filepath='./Include/internal/pycore_asdl.h' line='42' column='1' id='type-id-622'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='size' type-id='type-id-31' visibility='default' filepath='./Include/internal/pycore_asdl.h' line='43' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='elements' type-id='type-id-195' visibility='default' filepath='./Include/internal/pycore_asdl.h' line='43' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='typed_elements' type-id='type-id-623' visibility='default' filepath='./Include/internal/pycore_asdl.h' line='44' column='1'/>
+      </data-member>
+    </class-decl>
+
+    <array-type-def dimensions='1' type-id='type-id-9' size-in-bits='32' id='type-id-623'>
+      <subrange length='1' type-id='type-id-19' id='type-id-182'/>
+
+    </array-type-def>
+    <typedef-decl name='asdl_int_seq' type-id='type-id-622' filepath='./Include/internal/pycore_asdl.h' line='45' column='1' id='type-id-621'/>
+    <pointer-type-def type-id='type-id-621' size-in-bits='64' id='type-id-620'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='423' column='1' id='type-id-592'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='func' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='424' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='args' type-id='type-id-568' visibility='default' filepath='./Include/internal/pycore_ast.h' line='425' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='keywords' type-id='type-id-624' visibility='default' filepath='./Include/internal/pycore_ast.h' line='426' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-625' visibility='default' filepath='./Include/internal/pycore_ast.h' line='106' column='1' id='type-id-626'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='size' type-id='type-id-31' visibility='default' filepath='./Include/internal/pycore_ast.h' line='107' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='elements' type-id='type-id-195' visibility='default' filepath='./Include/internal/pycore_ast.h' line='107' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='typed_elements' type-id='type-id-627' visibility='default' filepath='./Include/internal/pycore_ast.h' line='108' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='_keyword' size-in-bits='256' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='533' column='1' id='type-id-628'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='arg' type-id='type-id-566' visibility='default' filepath='./Include/internal/pycore_ast.h' line='534' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='value' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='535' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='lineno' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_ast.h' line='536' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='160'>
+        <var-decl name='col_offset' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_ast.h' line='537' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='end_lineno' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_ast.h' line='538' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='224'>
+        <var-decl name='end_col_offset' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_ast.h' line='539' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-628' size-in-bits='64' id='type-id-629'/>
+    <typedef-decl name='keyword_ty' type-id='type-id-629' filepath='./Include/internal/pycore_ast.h' line='42' column='1' id='type-id-630'/>
+
+    <array-type-def dimensions='1' type-id='type-id-630' size-in-bits='64' id='type-id-627'>
+      <subrange length='1' type-id='type-id-19' id='type-id-182'/>
+
+    </array-type-def>
+    <typedef-decl name='asdl_keyword_seq' type-id='type-id-626' filepath='./Include/internal/pycore_ast.h' line='109' column='1' id='type-id-625'/>
+    <pointer-type-def type-id='type-id-625' size-in-bits='64' id='type-id-624'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='429' column='1' id='type-id-593'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='value' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='430' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='conversion' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_ast.h' line='431' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='format_spec' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='432' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='64' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='435' column='1' id='type-id-594'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='values' type-id='type-id-568' visibility='default' filepath='./Include/internal/pycore_ast.h' line='436' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='128' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='439' column='1' id='type-id-595'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='value' type-id='type-id-631' visibility='default' filepath='./Include/internal/pycore_ast.h' line='440' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='kind' type-id='type-id-570' visibility='default' filepath='./Include/internal/pycore_ast.h' line='441' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='constant' type-id='type-id-16' filepath='./Include/internal/pycore_asdl.h' line='16' column='1' id='type-id-631'/>
+    <typedef-decl name='string' type-id='type-id-16' filepath='./Include/internal/pycore_asdl.h' line='14' column='1' id='type-id-570'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='444' column='1' id='type-id-596'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='value' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='445' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='attr' type-id='type-id-566' visibility='default' filepath='./Include/internal/pycore_ast.h' line='446' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='ctx' type-id='type-id-632' visibility='default' filepath='./Include/internal/pycore_ast.h' line='447' column='1'/>
+      </data-member>
+    </class-decl>
+    <enum-decl name='_expr_context' filepath='./Include/internal/pycore_ast.h' line='21' column='1' id='type-id-633'>
+      <underlying-type type-id='type-id-83'/>
+      <enumerator name='Load' value='1'/>
+      <enumerator name='Store' value='2'/>
+      <enumerator name='Del' value='3'/>
+    </enum-decl>
+    <typedef-decl name='expr_context_ty' type-id='type-id-633' filepath='./Include/internal/pycore_ast.h' line='21' column='1' id='type-id-632'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='450' column='1' id='type-id-597'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='value' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='451' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='slice' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='452' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='ctx' type-id='type-id-632' visibility='default' filepath='./Include/internal/pycore_ast.h' line='453' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='128' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='456' column='1' id='type-id-598'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='value' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='457' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='ctx' type-id='type-id-632' visibility='default' filepath='./Include/internal/pycore_ast.h' line='458' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='128' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='461' column='1' id='type-id-599'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='id' type-id='type-id-566' visibility='default' filepath='./Include/internal/pycore_ast.h' line='462' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='ctx' type-id='type-id-632' visibility='default' filepath='./Include/internal/pycore_ast.h' line='463' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='128' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='466' column='1' id='type-id-600'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='elts' type-id='type-id-568' visibility='default' filepath='./Include/internal/pycore_ast.h' line='467' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='ctx' type-id='type-id-632' visibility='default' filepath='./Include/internal/pycore_ast.h' line='468' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='476' column='1' id='type-id-601'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='lower' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='477' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='upper' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='478' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='step' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='479' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-577' size-in-bits='64' id='type-id-634'/>
+    <typedef-decl name='arg_ty' type-id='type-id-634' filepath='./Include/internal/pycore_ast.h' line='40' column='1' id='type-id-573'/>
+
+    <array-type-def dimensions='1' type-id='type-id-573' size-in-bits='64' id='type-id-576'>
+      <subrange length='1' type-id='type-id-19' id='type-id-182'/>
+
+    </array-type-def>
+    <typedef-decl name='asdl_arg_seq' type-id='type-id-575' filepath='./Include/internal/pycore_ast.h' line='102' column='1' id='type-id-574'/>
+    <pointer-type-def type-id='type-id-574' size-in-bits='64' id='type-id-572'/>
+    <typedef-decl name='asdl_stmt_seq' type-id='type-id-544' filepath='./Include/internal/pycore_ast.h' line='65' column='1' id='type-id-543'/>
+    <pointer-type-def type-id='type-id-543' size-in-bits='64' id='type-id-541'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='320' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='206' column='1' id='type-id-550'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='name' type-id='type-id-566' visibility='default' filepath='./Include/internal/pycore_ast.h' line='207' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='bases' type-id='type-id-568' visibility='default' filepath='./Include/internal/pycore_ast.h' line='208' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='keywords' type-id='type-id-624' visibility='default' filepath='./Include/internal/pycore_ast.h' line='209' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='body' type-id='type-id-541' visibility='default' filepath='./Include/internal/pycore_ast.h' line='210' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='decorator_list' type-id='type-id-568' visibility='default' filepath='./Include/internal/pycore_ast.h' line='211' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='64' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='218' column='1' id='type-id-552'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='targets' type-id='type-id-568' visibility='default' filepath='./Include/internal/pycore_ast.h' line='219' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='222' column='1' id='type-id-553'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='targets' type-id='type-id-568' visibility='default' filepath='./Include/internal/pycore_ast.h' line='223' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='value' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='224' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='type_comment' type-id='type-id-570' visibility='default' filepath='./Include/internal/pycore_ast.h' line='225' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='228' column='1' id='type-id-554'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='target' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='229' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='op' type-id='type-id-608' visibility='default' filepath='./Include/internal/pycore_ast.h' line='230' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='value' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='231' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='256' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='234' column='1' id='type-id-555'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='target' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='235' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='annotation' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='236' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='value' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='237' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='simple' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_ast.h' line='238' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='320' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='241' column='1' id='type-id-556'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='target' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='242' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='iter' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='243' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='body' type-id='type-id-541' visibility='default' filepath='./Include/internal/pycore_ast.h' line='244' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='orelse' type-id='type-id-541' visibility='default' filepath='./Include/internal/pycore_ast.h' line='245' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='type_comment' type-id='type-id-570' visibility='default' filepath='./Include/internal/pycore_ast.h' line='246' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='257' column='1' id='type-id-557'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='test' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='258' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='body' type-id='type-id-541' visibility='default' filepath='./Include/internal/pycore_ast.h' line='259' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='orelse' type-id='type-id-541' visibility='default' filepath='./Include/internal/pycore_ast.h' line='260' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='269' column='1' id='type-id-558'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='items' type-id='type-id-635' visibility='default' filepath='./Include/internal/pycore_ast.h' line='270' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='body' type-id='type-id-541' visibility='default' filepath='./Include/internal/pycore_ast.h' line='271' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='type_comment' type-id='type-id-570' visibility='default' filepath='./Include/internal/pycore_ast.h' line='272' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-636' visibility='default' filepath='./Include/internal/pycore_ast.h' line='120' column='1' id='type-id-637'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='size' type-id='type-id-31' visibility='default' filepath='./Include/internal/pycore_ast.h' line='121' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='elements' type-id='type-id-195' visibility='default' filepath='./Include/internal/pycore_ast.h' line='121' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='typed_elements' type-id='type-id-638' visibility='default' filepath='./Include/internal/pycore_ast.h' line='122' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='_withitem' size-in-bits='128' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='551' column='1' id='type-id-639'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='context_expr' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='552' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='optional_vars' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='553' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-639' size-in-bits='64' id='type-id-640'/>
+    <typedef-decl name='withitem_ty' type-id='type-id-640' filepath='./Include/internal/pycore_ast.h' line='46' column='1' id='type-id-641'/>
+
+    <array-type-def dimensions='1' type-id='type-id-641' size-in-bits='64' id='type-id-638'>
+      <subrange length='1' type-id='type-id-19' id='type-id-182'/>
+
+    </array-type-def>
+    <typedef-decl name='asdl_withitem_seq' type-id='type-id-637' filepath='./Include/internal/pycore_ast.h' line='123' column='1' id='type-id-636'/>
+    <pointer-type-def type-id='type-id-636' size-in-bits='64' id='type-id-635'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='128' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='281' column='1' id='type-id-559'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='subject' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='282' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='cases' type-id='type-id-642' visibility='default' filepath='./Include/internal/pycore_ast.h' line='283' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-643' visibility='default' filepath='./Include/internal/pycore_ast.h' line='127' column='1' id='type-id-644'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='size' type-id='type-id-31' visibility='default' filepath='./Include/internal/pycore_ast.h' line='128' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='elements' type-id='type-id-195' visibility='default' filepath='./Include/internal/pycore_ast.h' line='128' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='typed_elements' type-id='type-id-645' visibility='default' filepath='./Include/internal/pycore_ast.h' line='129' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='_match_case' size-in-bits='192' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='556' column='1' id='type-id-646'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='pattern' type-id='type-id-647' visibility='default' filepath='./Include/internal/pycore_ast.h' line='557' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='guard' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='558' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='body' type-id='type-id-541' visibility='default' filepath='./Include/internal/pycore_ast.h' line='559' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='_pattern' size-in-bits='448' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='566' column='1' id='type-id-648'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='kind' type-id='type-id-649' visibility='default' filepath='./Include/internal/pycore_ast.h' line='567' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='v' type-id='type-id-650' visibility='default' filepath='./Include/internal/pycore_ast.h' line='607' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='lineno' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_ast.h' line='608' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='352'>
+        <var-decl name='col_offset' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_ast.h' line='609' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='384'>
+        <var-decl name='end_lineno' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_ast.h' line='610' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='416'>
+        <var-decl name='end_col_offset' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_ast.h' line='611' column='1'/>
+      </data-member>
+    </class-decl>
+    <enum-decl name='_pattern_kind' filepath='./Include/internal/pycore_ast.h' line='562' column='1' id='type-id-649'>
+      <underlying-type type-id='type-id-83'/>
+      <enumerator name='MatchValue_kind' value='1'/>
+      <enumerator name='MatchSingleton_kind' value='2'/>
+      <enumerator name='MatchSequence_kind' value='3'/>
+      <enumerator name='MatchMapping_kind' value='4'/>
+      <enumerator name='MatchClass_kind' value='5'/>
+      <enumerator name='MatchStar_kind' value='6'/>
+      <enumerator name='MatchAs_kind' value='7'/>
+      <enumerator name='MatchOr_kind' value='8'/>
+    </enum-decl>
+    <union-decl name='__anonymous_union__' size-in-bits='256' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='568' column='1' id='type-id-650'>
+      <data-member access='private'>
+        <var-decl name='MatchValue' type-id='type-id-551' visibility='default' filepath='./Include/internal/pycore_ast.h' line='571' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='MatchSingleton' type-id='type-id-651' visibility='default' filepath='./Include/internal/pycore_ast.h' line='575' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='MatchSequence' type-id='type-id-652' visibility='default' filepath='./Include/internal/pycore_ast.h' line='579' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='MatchMapping' type-id='type-id-653' visibility='default' filepath='./Include/internal/pycore_ast.h' line='585' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='MatchClass' type-id='type-id-654' visibility='default' filepath='./Include/internal/pycore_ast.h' line='592' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='MatchStar' type-id='type-id-655' visibility='default' filepath='./Include/internal/pycore_ast.h' line='596' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='MatchAs' type-id='type-id-656' visibility='default' filepath='./Include/internal/pycore_ast.h' line='601' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='MatchOr' type-id='type-id-652' visibility='default' filepath='./Include/internal/pycore_ast.h' line='605' column='1'/>
+      </data-member>
+    </union-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='64' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='573' column='1' id='type-id-651'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='value' type-id='type-id-631' visibility='default' filepath='./Include/internal/pycore_ast.h' line='574' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='64' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='577' column='1' id='type-id-652'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='patterns' type-id='type-id-657' visibility='default' filepath='./Include/internal/pycore_ast.h' line='578' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-658' visibility='default' filepath='./Include/internal/pycore_ast.h' line='135' column='1' id='type-id-659'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='size' type-id='type-id-31' visibility='default' filepath='./Include/internal/pycore_ast.h' line='136' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='elements' type-id='type-id-195' visibility='default' filepath='./Include/internal/pycore_ast.h' line='136' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='typed_elements' type-id='type-id-660' visibility='default' filepath='./Include/internal/pycore_ast.h' line='137' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-648' size-in-bits='64' id='type-id-661'/>
+    <typedef-decl name='pattern_ty' type-id='type-id-661' filepath='./Include/internal/pycore_ast.h' line='50' column='1' id='type-id-647'/>
+
+    <array-type-def dimensions='1' type-id='type-id-647' size-in-bits='64' id='type-id-660'>
+      <subrange length='1' type-id='type-id-19' id='type-id-182'/>
+
+    </array-type-def>
+    <typedef-decl name='asdl_pattern_seq' type-id='type-id-659' filepath='./Include/internal/pycore_ast.h' line='138' column='1' id='type-id-658'/>
+    <pointer-type-def type-id='type-id-658' size-in-bits='64' id='type-id-657'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='581' column='1' id='type-id-653'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='keys' type-id='type-id-568' visibility='default' filepath='./Include/internal/pycore_ast.h' line='582' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='patterns' type-id='type-id-657' visibility='default' filepath='./Include/internal/pycore_ast.h' line='583' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='rest' type-id='type-id-566' visibility='default' filepath='./Include/internal/pycore_ast.h' line='584' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='256' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='587' column='1' id='type-id-654'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='cls' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='588' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='patterns' type-id='type-id-657' visibility='default' filepath='./Include/internal/pycore_ast.h' line='589' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='kwd_attrs' type-id='type-id-662' visibility='default' filepath='./Include/internal/pycore_ast.h' line='590' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='kwd_patterns' type-id='type-id-657' visibility='default' filepath='./Include/internal/pycore_ast.h' line='591' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-663' visibility='default' filepath='./Include/internal/pycore_asdl.h' line='37' column='1' id='type-id-664'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='size' type-id='type-id-31' visibility='default' filepath='./Include/internal/pycore_asdl.h' line='38' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='elements' type-id='type-id-195' visibility='default' filepath='./Include/internal/pycore_asdl.h' line='38' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='typed_elements' type-id='type-id-337' visibility='default' filepath='./Include/internal/pycore_asdl.h' line='39' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='asdl_identifier_seq' type-id='type-id-664' filepath='./Include/internal/pycore_asdl.h' line='40' column='1' id='type-id-663'/>
+    <pointer-type-def type-id='type-id-663' size-in-bits='64' id='type-id-662'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='64' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='594' column='1' id='type-id-655'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='name' type-id='type-id-566' visibility='default' filepath='./Include/internal/pycore_ast.h' line='595' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='128' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='598' column='1' id='type-id-656'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='pattern' type-id='type-id-647' visibility='default' filepath='./Include/internal/pycore_ast.h' line='599' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='name' type-id='type-id-566' visibility='default' filepath='./Include/internal/pycore_ast.h' line='600' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-646' size-in-bits='64' id='type-id-665'/>
+    <typedef-decl name='match_case_ty' type-id='type-id-665' filepath='./Include/internal/pycore_ast.h' line='48' column='1' id='type-id-666'/>
+
+    <array-type-def dimensions='1' type-id='type-id-666' size-in-bits='64' id='type-id-645'>
+      <subrange length='1' type-id='type-id-19' id='type-id-182'/>
+
+    </array-type-def>
+    <typedef-decl name='asdl_match_case_seq' type-id='type-id-644' filepath='./Include/internal/pycore_ast.h' line='130' column='1' id='type-id-643'/>
+    <pointer-type-def type-id='type-id-643' size-in-bits='64' id='type-id-642'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='128' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='286' column='1' id='type-id-560'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='exc' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='287' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='cause' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='288' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='256' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='291' column='1' id='type-id-561'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='body' type-id='type-id-541' visibility='default' filepath='./Include/internal/pycore_ast.h' line='292' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='handlers' type-id='type-id-667' visibility='default' filepath='./Include/internal/pycore_ast.h' line='293' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='orelse' type-id='type-id-541' visibility='default' filepath='./Include/internal/pycore_ast.h' line='294' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='finalbody' type-id='type-id-541' visibility='default' filepath='./Include/internal/pycore_ast.h' line='295' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-668' visibility='default' filepath='./Include/internal/pycore_ast.h' line='84' column='1' id='type-id-669'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='size' type-id='type-id-31' visibility='default' filepath='./Include/internal/pycore_ast.h' line='85' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='elements' type-id='type-id-195' visibility='default' filepath='./Include/internal/pycore_ast.h' line='85' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='typed_elements' type-id='type-id-670' visibility='default' filepath='./Include/internal/pycore_ast.h' line='86' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='_excepthandler' size-in-bits='384' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='497' column='1' id='type-id-671'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='kind' type-id='type-id-672' visibility='default' filepath='./Include/internal/pycore_ast.h' line='498' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='v' type-id='type-id-673' visibility='default' filepath='./Include/internal/pycore_ast.h' line='506' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='lineno' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_ast.h' line='507' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='288'>
+        <var-decl name='col_offset' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_ast.h' line='508' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='end_lineno' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_ast.h' line='509' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='352'>
+        <var-decl name='end_col_offset' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_ast.h' line='510' column='1'/>
+      </data-member>
+    </class-decl>
+    <enum-decl name='_excepthandler_kind' filepath='./Include/internal/pycore_ast.h' line='496' column='1' id='type-id-672'>
+      <underlying-type type-id='type-id-83'/>
+      <enumerator name='ExceptHandler_kind' value='1'/>
+    </enum-decl>
+    <union-decl name='__anonymous_union__' size-in-bits='192' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='499' column='1' id='type-id-673'>
+      <data-member access='private'>
+        <var-decl name='ExceptHandler' type-id='type-id-674' visibility='default' filepath='./Include/internal/pycore_ast.h' line='504' column='1'/>
+      </data-member>
+    </union-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='500' column='1' id='type-id-674'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='type' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='501' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='name' type-id='type-id-566' visibility='default' filepath='./Include/internal/pycore_ast.h' line='502' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='body' type-id='type-id-541' visibility='default' filepath='./Include/internal/pycore_ast.h' line='503' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-671' size-in-bits='64' id='type-id-675'/>
+    <typedef-decl name='excepthandler_ty' type-id='type-id-675' filepath='./Include/internal/pycore_ast.h' line='36' column='1' id='type-id-676'/>
+
+    <array-type-def dimensions='1' type-id='type-id-676' size-in-bits='64' id='type-id-670'>
+      <subrange length='1' type-id='type-id-19' id='type-id-182'/>
+
+    </array-type-def>
+    <typedef-decl name='asdl_excepthandler_seq' type-id='type-id-669' filepath='./Include/internal/pycore_ast.h' line='87' column='1' id='type-id-668'/>
+    <pointer-type-def type-id='type-id-668' size-in-bits='64' id='type-id-667'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='128' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='298' column='1' id='type-id-562'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='test' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='299' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='msg' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='300' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='64' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='303' column='1' id='type-id-563'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='names' type-id='type-id-677' visibility='default' filepath='./Include/internal/pycore_ast.h' line='304' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-678' visibility='default' filepath='./Include/internal/pycore_ast.h' line='113' column='1' id='type-id-679'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='size' type-id='type-id-31' visibility='default' filepath='./Include/internal/pycore_ast.h' line='114' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='elements' type-id='type-id-195' visibility='default' filepath='./Include/internal/pycore_ast.h' line='114' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='typed_elements' type-id='type-id-680' visibility='default' filepath='./Include/internal/pycore_ast.h' line='115' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='_alias' size-in-bits='256' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='542' column='1' id='type-id-681'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='name' type-id='type-id-566' visibility='default' filepath='./Include/internal/pycore_ast.h' line='543' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='asname' type-id='type-id-566' visibility='default' filepath='./Include/internal/pycore_ast.h' line='544' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='lineno' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_ast.h' line='545' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='160'>
+        <var-decl name='col_offset' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_ast.h' line='546' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='end_lineno' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_ast.h' line='547' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='224'>
+        <var-decl name='end_col_offset' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_ast.h' line='548' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-681' size-in-bits='64' id='type-id-682'/>
+    <typedef-decl name='alias_ty' type-id='type-id-682' filepath='./Include/internal/pycore_ast.h' line='44' column='1' id='type-id-683'/>
+
+    <array-type-def dimensions='1' type-id='type-id-683' size-in-bits='64' id='type-id-680'>
+      <subrange length='1' type-id='type-id-19' id='type-id-182'/>
+
+    </array-type-def>
+    <typedef-decl name='asdl_alias_seq' type-id='type-id-679' filepath='./Include/internal/pycore_ast.h' line='116' column='1' id='type-id-678'/>
+    <pointer-type-def type-id='type-id-678' size-in-bits='64' id='type-id-677'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='307' column='1' id='type-id-564'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='module' type-id='type-id-566' visibility='default' filepath='./Include/internal/pycore_ast.h' line='308' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='names' type-id='type-id-677' visibility='default' filepath='./Include/internal/pycore_ast.h' line='309' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='level' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_ast.h' line='310' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='64' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='313' column='1' id='type-id-565'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='names' type-id='type-id-662' visibility='default' filepath='./Include/internal/pycore_ast.h' line='314' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-546' size-in-bits='64' id='type-id-684'/>
+    <typedef-decl name='stmt_ty' type-id='type-id-684' filepath='./Include/internal/pycore_ast.h' line='17' column='1' id='type-id-685'/>
+
+    <array-type-def dimensions='1' type-id='type-id-685' size-in-bits='64' id='type-id-545'>
+      <subrange length='1' type-id='type-id-19' id='type-id-182'/>
+
+    </array-type-def>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-686' visibility='default' filepath='./Include/internal/pycore_ast.h' line='142' column='1' id='type-id-687'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='size' type-id='type-id-31' visibility='default' filepath='./Include/internal/pycore_ast.h' line='143' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='elements' type-id='type-id-195' visibility='default' filepath='./Include/internal/pycore_ast.h' line='143' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='typed_elements' type-id='type-id-688' visibility='default' filepath='./Include/internal/pycore_ast.h' line='144' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='_type_ignore' size-in-bits='192' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='615' column='1' id='type-id-689'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='kind' type-id='type-id-690' visibility='default' filepath='./Include/internal/pycore_ast.h' line='616' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='v' type-id='type-id-691' visibility='default' filepath='./Include/internal/pycore_ast.h' line='623' column='1'/>
+      </data-member>
+    </class-decl>
+    <enum-decl name='_type_ignore_kind' filepath='./Include/internal/pycore_ast.h' line='614' column='1' id='type-id-690'>
+      <underlying-type type-id='type-id-83'/>
+      <enumerator name='TypeIgnore_kind' value='1'/>
+    </enum-decl>
+    <union-decl name='__anonymous_union__' size-in-bits='128' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='617' column='1' id='type-id-691'>
+      <data-member access='private'>
+        <var-decl name='TypeIgnore' type-id='type-id-692' visibility='default' filepath='./Include/internal/pycore_ast.h' line='621' column='1'/>
+      </data-member>
+    </union-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='128' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='618' column='1' id='type-id-692'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='lineno' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_ast.h' line='619' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='tag' type-id='type-id-570' visibility='default' filepath='./Include/internal/pycore_ast.h' line='620' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-689' size-in-bits='64' id='type-id-693'/>
+    <typedef-decl name='type_ignore_ty' type-id='type-id-693' filepath='./Include/internal/pycore_ast.h' line='52' column='1' id='type-id-694'/>
+
+    <array-type-def dimensions='1' type-id='type-id-694' size-in-bits='64' id='type-id-688'>
+      <subrange length='1' type-id='type-id-19' id='type-id-182'/>
+
+    </array-type-def>
+    <typedef-decl name='asdl_type_ignore_seq' type-id='type-id-687' filepath='./Include/internal/pycore_ast.h' line='145' column='1' id='type-id-686'/>
+    <pointer-type-def type-id='type-id-686' size-in-bits='64' id='type-id-542'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='64' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='161' column='1' id='type-id-538'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='body' type-id='type-id-541' visibility='default' filepath='./Include/internal/pycore_ast.h' line='162' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='64' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='165' column='1' id='type-id-539'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='body' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='166' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='128' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/internal/pycore_ast.h' line='169' column='1' id='type-id-540'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='argtypes' type-id='type-id-568' visibility='default' filepath='./Include/internal/pycore_ast.h' line='170' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='returns' type-id='type-id-569' visibility='default' filepath='./Include/internal/pycore_ast.h' line='171' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-534' size-in-bits='64' id='type-id-695'/>
+    <typedef-decl name='mod_ty' type-id='type-id-695' filepath='./Include/internal/pycore_ast.h' line='15' column='1' id='type-id-696'/>
+    <class-decl name='_arena' size-in-bits='192' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-697'/>
+    <typedef-decl name='PyArena' type-id='type-id-697' filepath='./Include/internal/pycore_pyarena.h' line='14' column='1' id='type-id-698'/>
+    <pointer-type-def type-id='type-id-698' size-in-bits='64' id='type-id-699'/>
+    <function-decl name='_PyAST_Compile' mangled-name='_PyAST_Compile' filepath='Python/compile.c' line='403' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyAST_Compile'>
+      <parameter type-id='type-id-696' name='mod' filepath='Python/compile.c' line='403' column='1'/>
+      <parameter type-id='type-id-16' name='filename' filepath='Python/compile.c' line='403' column='1'/>
+      <parameter type-id='type-id-522' name='flags' filepath='Python/compile.c' line='403' column='1'/>
+      <parameter type-id='type-id-9' name='optimize' filepath='Python/compile.c' line='404' column='1'/>
+      <parameter type-id='type-id-699' name='arena' filepath='Python/compile.c' line='404' column='1'/>
+      <return type-id='type-id-334'/>
+    </function-decl>
+    <function-decl name='PyList_GetSlice' mangled-name='PyList_GetSlice' filepath='./Include/listobject.h' line='36' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_ProgramTextObject' mangled-name='PyErr_ProgramTextObject' filepath='./Include/cpython/pyerrors.h' line='160' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_FindChar' mangled-name='PyUnicode_FindChar' filepath='./Include/unicodeobject.h' line='952' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_CopyCharacters' mangled-name='PyUnicode_CopyCharacters' filepath='./Include/cpython/unicodeobject.h' line='499' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_ExprAsUnicode' mangled-name='_PyAST_ExprAsUnicode' filepath='./Include/internal/pycore_ast.h' line='845' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyST_GetScope' mangled-name='_PyST_GetScope' filepath='./Include/internal/pycore_symtable.h' line='82' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyCapsule_GetPointer' mangled-name='PyCapsule_GetPointer' filepath='./Include/pycapsule.h' line='33' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PySequence_DelItem' mangled-name='PySequence_DelItem' filepath='./Include/abstract.h' line='684' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyCapsule_New' mangled-name='PyCapsule_New' filepath='./Include/pycapsule.h' line='28' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PySymtable_Lookup' mangled-name='PySymtable_Lookup' filepath='./Include/internal/pycore_symtable.h' line='88' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PySymtable_Free' mangled-name='_PySymtable_Free' filepath='./Include/internal/pycore_symtable.h' line='90' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyFuture_FromAST' mangled-name='_PyFuture_FromAST' filepath='./Include/internal/pycore_compile.h' line='21' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_Optimize' mangled-name='_PyAST_Optimize' filepath='./Include/internal/pycore_compile.h' line='36' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PySymtable_Build' mangled-name='_PySymtable_Build' filepath='./Include/internal/pycore_symtable.h' line='84' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyCode_ConstantKey' mangled-name='_PyCode_ConstantKey' filepath='./Include/cpython/code.h' line='163' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyCode_NewWithPosOnlyArgs' mangled-name='PyCode_NewWithPosOnlyArgs' filepath='./Include/cpython/code.h' line='122' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/context.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PyContext_Type' type-id='type-id-149' mangled-name='PyContext_Type' visibility='default' filepath='./Include/context.h' line='10' column='1' elf-symbol-id='PyContext_Type'/>
+    <var-decl name='PyContextVar_Type' type-id='type-id-149' mangled-name='PyContextVar_Type' visibility='default' filepath='./Include/context.h' line='13' column='1' elf-symbol-id='PyContextVar_Type'/>
+    <var-decl name='PyContextToken_Type' type-id='type-id-149' mangled-name='PyContextToken_Type' visibility='default' filepath='./Include/context.h' line='16' column='1' elf-symbol-id='PyContextToken_Type'/>
+    <function-decl name='PyContextVar_Reset' mangled-name='PyContextVar_Reset' filepath='Python/context.c' line='295' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyContextVar_Reset'>
+      <parameter type-id='type-id-16' name='ovar' filepath='Python/context.c' line='295' column='1'/>
+      <parameter type-id='type-id-16' name='otok' filepath='Python/context.c' line='295' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyContextVar_Get' mangled-name='PyContextVar_Get' filepath='Python/context.c' line='196' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyContextVar_Get'>
+      <parameter type-id='type-id-16' name='ovar' filepath='Python/context.c' line='196' column='1'/>
+      <parameter type-id='type-id-16' name='def' filepath='Python/context.c' line='196' column='1'/>
+      <parameter type-id='type-id-86' name='val' filepath='Python/context.c' line='196' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyContextVar_New' mangled-name='PyContextVar_New' filepath='Python/context.c' line='183' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyContextVar_New'>
+      <parameter type-id='type-id-3' name='name' filepath='Python/context.c' line='183' column='1'/>
+      <parameter type-id='type-id-16' name='def' filepath='Python/context.c' line='183' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyContext_Exit' mangled-name='PyContext_Exit' filepath='Python/context.c' line='174' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyContext_Exit'>
+      <parameter type-id='type-id-16' name='octx' filepath='Python/context.c' line='174' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyContext_Enter' mangled-name='PyContext_Enter' filepath='Python/context.c' line='136' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyContext_Enter'>
+      <parameter type-id='type-id-16' name='octx' filepath='Python/context.c' line='174' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyContext_CopyCurrent' mangled-name='PyContext_CopyCurrent' filepath='Python/context.c' line='101' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyContext_CopyCurrent'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyContext_Copy' mangled-name='PyContext_Copy' filepath='Python/context.c' line='92' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyContext_Copy'>
+      <parameter type-id='type-id-16' name='iter' filepath='Objects/abstract.c' line='2871' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyContext_New' mangled-name='PyContext_New' filepath='Python/context.c' line='85' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyContext_New'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyContext_NewHamtForTests' mangled-name='_PyContext_NewHamtForTests' filepath='Python/context.c' line='78' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyContext_NewHamtForTests'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyContextVar_Set' mangled-name='PyContextVar_Set' filepath='Python/context.c' line='259' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyContextVar_Set'>
+      <parameter type-id='type-id-16' name='ovar' filepath='Python/context.c' line='259' column='1'/>
+      <parameter type-id='type-id-16' name='val' filepath='Python/context.c' line='259' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyHamt_Init' mangled-name='_PyHamt_Init' filepath='./Include/internal/pycore_hamt.h' line='113' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyHamt_Fini' mangled-name='_PyHamt_Fini' filepath='./Include/internal/pycore_hamt.h' line='114' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyHamt_Assoc' mangled-name='_PyHamt_Assoc' filepath='./Include/internal/pycore_hamt.h' line='78' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyHamt_Find' mangled-name='_PyHamt_Find' filepath='./Include/internal/pycore_hamt.h' line='90' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyHamt_Len' mangled-name='_PyHamt_Len' filepath='./Include/internal/pycore_hamt.h' line='102' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyHamt_NewIterKeys' mangled-name='_PyHamt_NewIterKeys' filepath='./Include/internal/pycore_hamt.h' line='105' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyHamt_Without' mangled-name='_PyHamt_Without' filepath='./Include/internal/pycore_hamt.h' line='81' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyHamt_New' mangled-name='_PyHamt_New' filepath='./Include/internal/pycore_hamt.h' line='74' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyHamt_NewIterValues' mangled-name='_PyHamt_NewIterValues' filepath='./Include/internal/pycore_hamt.h' line='108' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyHamt_NewIterItems' mangled-name='_PyHamt_NewIterItems' filepath='./Include/internal/pycore_hamt.h' line='111' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyHamt_Eq' mangled-name='_PyHamt_Eq' filepath='./Include/internal/pycore_hamt.h' line='99' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyDict_Size' mangled-name='PyDict_Size' filepath='./Include/dictobject.h' line='32' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/errors.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='PyErr_ProgramTextObject' mangled-name='PyErr_ProgramTextObject' filepath='Python/errors.c' line='1801' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_ProgramTextObject'>
+      <parameter type-id='type-id-16' name='filename' filepath='Python/errors.c' line='1801' column='1'/>
+      <parameter type-id='type-id-9' name='lineno' filepath='Python/errors.c' line='1801' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyErr_ProgramDecodedTextObject' mangled-name='_PyErr_ProgramDecodedTextObject' filepath='Python/errors.c' line='1785' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyErr_ProgramDecodedTextObject'>
+      <parameter type-id='type-id-16' name='filename' filepath='Python/errors.c' line='1785' column='1'/>
+      <parameter type-id='type-id-9' name='lineno' filepath='Python/errors.c' line='1785' column='1'/>
+      <parameter type-id='type-id-3' name='encoding' filepath='Python/errors.c' line='1785' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyErr_ProgramText' mangled-name='PyErr_ProgramText' filepath='Python/errors.c' line='1768' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_ProgramText'>
+      <parameter type-id='type-id-3' name='filename' filepath='Python/errors.c' line='1768' column='1'/>
+      <parameter type-id='type-id-9' name='lineno' filepath='Python/errors.c' line='1768' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyErr_SyntaxLocationEx' mangled-name='PyErr_SyntaxLocationEx' filepath='Python/errors.c' line='1703' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_SyntaxLocationEx'>
+      <parameter type-id='type-id-3' name='filename' filepath='Python/errors.c' line='1703' column='1'/>
+      <parameter type-id='type-id-9' name='lineno' filepath='Python/errors.c' line='1703' column='1'/>
+      <parameter type-id='type-id-9' name='col_offset' filepath='Python/errors.c' line='1703' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_RangedSyntaxLocationObject' mangled-name='PyErr_RangedSyntaxLocationObject' filepath='Python/errors.c' line='1697' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_RangedSyntaxLocationObject'>
+      <parameter type-id='type-id-16' name='filename' filepath='Python/errors.c' line='1697' column='1'/>
+      <parameter type-id='type-id-9' name='lineno' filepath='Python/errors.c' line='1697' column='1'/>
+      <parameter type-id='type-id-9' name='col_offset' filepath='Python/errors.c' line='1697' column='1'/>
+      <parameter type-id='type-id-9' name='end_lineno' filepath='Python/errors.c' line='1698' column='1'/>
+      <parameter type-id='type-id-9' name='end_col_offset' filepath='Python/errors.c' line='1698' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_SyntaxLocationObject' mangled-name='PyErr_SyntaxLocationObject' filepath='Python/errors.c' line='1692' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_SyntaxLocationObject'>
+      <parameter type-id='type-id-16' name='filename' filepath='Python/errors.c' line='1692' column='1'/>
+      <parameter type-id='type-id-9' name='lineno' filepath='Python/errors.c' line='1692' column='1'/>
+      <parameter type-id='type-id-9' name='col_offset' filepath='Python/errors.c' line='1692' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_SyntaxLocation' mangled-name='PyErr_SyntaxLocation' filepath='Python/errors.c' line='1564' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_SyntaxLocation'>
+      <parameter type-id='type-id-3' name='filename' filepath='Python/errors.c' line='1564' column='1'/>
+      <parameter type-id='type-id-9' name='lineno' filepath='Python/errors.c' line='1564' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_WriteUnraisable' mangled-name='PyErr_WriteUnraisable' filepath='Python/errors.c' line='1557' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_WriteUnraisable'>
+      <parameter type-id='type-id-16' name='obj' filepath='Python/errors.c' line='1557' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_WriteUnraisableMsg' mangled-name='_PyErr_WriteUnraisableMsg' filepath='Python/errors.c' line='1454' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyErr_WriteUnraisableMsg'>
+      <parameter type-id='type-id-3' name='err_msg_str' filepath='Python/errors.c' line='1454' column='1'/>
+      <parameter type-id='type-id-16' name='obj' filepath='Python/errors.c' line='1454' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_NewExceptionWithDoc' mangled-name='PyErr_NewExceptionWithDoc' filepath='Python/errors.c' line='1165' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_NewExceptionWithDoc'>
+      <parameter type-id='type-id-3' name='name' filepath='Python/errors.c' line='1165' column='1'/>
+      <parameter type-id='type-id-3' name='doc' filepath='Python/errors.c' line='1165' column='1'/>
+      <parameter type-id='type-id-16' name='base' filepath='Python/errors.c' line='1166' column='1'/>
+      <parameter type-id='type-id-16' name='dict' filepath='Python/errors.c' line='1166' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyErr_NewException' mangled-name='PyErr_NewException' filepath='Python/errors.c' line='1108' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_NewException'>
+      <parameter type-id='type-id-3' name='name' filepath='Python/errors.c' line='1108' column='1'/>
+      <parameter type-id='type-id-16' name='base' filepath='Python/errors.c' line='1108' column='1'/>
+      <parameter type-id='type-id-16' name='dict' filepath='Python/errors.c' line='1108' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyErr_Format' mangled-name='PyErr_Format' filepath='Python/errors.c' line='1092' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_Format'>
+      <parameter type-id='type-id-16' name='exception' filepath='Python/errors.c' line='1092' column='1'/>
+      <parameter type-id='type-id-3' name='format' filepath='Python/errors.c' line='1092' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <class-decl name='_ts' size-in-bits='2240' is-struct='yes' visibility='default' filepath='./Include/cpython/pystate.h' line='60' column='1' id='type-id-700'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='prev' type-id='type-id-11' visibility='default' filepath='./Include/cpython/pystate.h' line='63' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='next' type-id='type-id-11' visibility='default' filepath='./Include/cpython/pystate.h' line='64' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='interp' type-id='type-id-222' visibility='default' filepath='./Include/cpython/pystate.h' line='65' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='frame' type-id='type-id-13' visibility='default' filepath='./Include/cpython/pystate.h' line='68' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='recursion_depth' type-id='type-id-9' visibility='default' filepath='./Include/cpython/pystate.h' line='69' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='288'>
+        <var-decl name='recursion_headroom' type-id='type-id-9' visibility='default' filepath='./Include/cpython/pystate.h' line='70' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='stackcheck_counter' type-id='type-id-9' visibility='default' filepath='./Include/cpython/pystate.h' line='71' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='352'>
+        <var-decl name='tracing' type-id='type-id-9' visibility='default' filepath='./Include/cpython/pystate.h' line='76' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='384'>
+        <var-decl name='cframe' type-id='type-id-14' visibility='default' filepath='./Include/cpython/pystate.h' line='80' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='448'>
+        <var-decl name='c_profilefunc' type-id='type-id-15' visibility='default' filepath='./Include/cpython/pystate.h' line='82' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='512'>
+        <var-decl name='c_tracefunc' type-id='type-id-15' visibility='default' filepath='./Include/cpython/pystate.h' line='83' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='576'>
+        <var-decl name='c_profileobj' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='84' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='640'>
+        <var-decl name='c_traceobj' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='85' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='704'>
+        <var-decl name='curexc_type' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='88' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='768'>
+        <var-decl name='curexc_value' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='89' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='832'>
+        <var-decl name='curexc_traceback' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='90' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='896'>
+        <var-decl name='exc_state' type-id='type-id-17' visibility='default' filepath='./Include/cpython/pystate.h' line='95' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1152'>
+        <var-decl name='exc_info' type-id='type-id-18' visibility='default' filepath='./Include/cpython/pystate.h' line='99' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1216'>
+        <var-decl name='dict' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='101' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1280'>
+        <var-decl name='gilstate_counter' type-id='type-id-9' visibility='default' filepath='./Include/cpython/pystate.h' line='103' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1344'>
+        <var-decl name='async_exc' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='105' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1408'>
+        <var-decl name='thread_id' type-id='type-id-19' visibility='default' filepath='./Include/cpython/pystate.h' line='106' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1472'>
+        <var-decl name='trash_delete_nesting' type-id='type-id-9' visibility='default' filepath='./Include/cpython/pystate.h' line='108' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1536'>
+        <var-decl name='trash_delete_later' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='109' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1600'>
+        <var-decl name='on_delete' type-id='type-id-20' visibility='default' filepath='./Include/cpython/pystate.h' line='134' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1664'>
+        <var-decl name='on_delete_data' type-id='type-id-21' visibility='default' filepath='./Include/cpython/pystate.h' line='135' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1728'>
+        <var-decl name='coroutine_origin_tracking_depth' type-id='type-id-9' visibility='default' filepath='./Include/cpython/pystate.h' line='137' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1792'>
+        <var-decl name='async_gen_firstiter' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='139' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1856'>
+        <var-decl name='async_gen_finalizer' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='140' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1920'>
+        <var-decl name='context' type-id='type-id-16' visibility='default' filepath='./Include/cpython/pystate.h' line='142' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='1984'>
+        <var-decl name='context_ver' type-id='type-id-22' visibility='default' filepath='./Include/cpython/pystate.h' line='143' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2048'>
+        <var-decl name='id' type-id='type-id-22' visibility='default' filepath='./Include/cpython/pystate.h' line='146' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='2112'>
+        <var-decl name='root_cframe' type-id='type-id-23' visibility='default' filepath='./Include/cpython/pystate.h' line='148' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='_is' size-in-bits='908160' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_interp.h' line='220' column='1' id='type-id-701'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='next' type-id='type-id-225' visibility='default' filepath='./Include/internal/pycore_interp.h' line='222' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='tstate_head' type-id='type-id-11' visibility='default' filepath='./Include/internal/pycore_interp.h' line='223' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='runtime' type-id='type-id-226' visibility='default' filepath='./Include/internal/pycore_interp.h' line='228' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='id' type-id='type-id-227' visibility='default' filepath='./Include/internal/pycore_interp.h' line='230' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='id_refcount' type-id='type-id-227' visibility='default' filepath='./Include/internal/pycore_interp.h' line='231' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='requires_idref' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_interp.h' line='232' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='384'>
+        <var-decl name='id_mutex' type-id='type-id-228' visibility='default' filepath='./Include/internal/pycore_interp.h' line='233' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='448'>
+        <var-decl name='finalizing' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_interp.h' line='235' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='512'>
+        <var-decl name='ceval' type-id='type-id-229' visibility='default' filepath='./Include/internal/pycore_interp.h' line='237' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='4928'>
+        <var-decl name='gc' type-id='type-id-230' visibility='default' filepath='./Include/internal/pycore_interp.h' line='238' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='6848'>
+        <var-decl name='modules' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='241' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='6912'>
+        <var-decl name='modules_by_index' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='242' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='6976'>
+        <var-decl name='sysdict' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='244' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7040'>
+        <var-decl name='builtins' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='246' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7104'>
+        <var-decl name='importlib' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='248' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7168'>
+        <var-decl name='num_threads' type-id='type-id-33' visibility='default' filepath='./Include/internal/pycore_interp.h' line='251' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7232'>
+        <var-decl name='pythread_stacksize' type-id='type-id-157' visibility='default' filepath='./Include/internal/pycore_interp.h' line='256' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7296'>
+        <var-decl name='codec_search_path' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='258' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7360'>
+        <var-decl name='codec_search_cache' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='259' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7424'>
+        <var-decl name='codec_error_registry' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='260' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7488'>
+        <var-decl name='codecs_initialized' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_interp.h' line='261' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='7552'>
+        <var-decl name='config' type-id='type-id-231' visibility='default' filepath='./Include/internal/pycore_interp.h' line='263' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10688'>
+        <var-decl name='dlopenflags' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_interp.h' line='265' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10752'>
+        <var-decl name='dict' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='268' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10816'>
+        <var-decl name='builtins_copy' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='270' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10880'>
+        <var-decl name='import_func' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='271' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='10944'>
+        <var-decl name='eval_frame' type-id='type-id-232' visibility='default' filepath='./Include/internal/pycore_interp.h' line='273' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='11008'>
+        <var-decl name='co_extra_user_count' type-id='type-id-31' visibility='default' filepath='./Include/internal/pycore_interp.h' line='275' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='11072'>
+        <var-decl name='co_extra_freefuncs' type-id='type-id-233' visibility='default' filepath='./Include/internal/pycore_interp.h' line='276' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='27392'>
+        <var-decl name='before_forkers' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='279' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='27456'>
+        <var-decl name='after_forkers_parent' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='280' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='27520'>
+        <var-decl name='after_forkers_child' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='281' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='27584'>
+        <var-decl name='tstate_next_unique_id' type-id='type-id-22' visibility='default' filepath='./Include/internal/pycore_interp.h' line='284' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='27648'>
+        <var-decl name='warnings' type-id='type-id-234' visibility='default' filepath='./Include/internal/pycore_interp.h' line='286' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='27904'>
+        <var-decl name='atexit' type-id='type-id-235' visibility='default' filepath='./Include/internal/pycore_interp.h' line='287' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='28032'>
+        <var-decl name='audit_hooks' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_interp.h' line='289' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='28096'>
+        <var-decl name='small_ints' type-id='type-id-236' visibility='default' filepath='./Include/internal/pycore_interp.h' line='296' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='44864'>
+        <var-decl name='bytes' type-id='type-id-237' visibility='default' filepath='./Include/internal/pycore_interp.h' line='297' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='61312'>
+        <var-decl name='unicode' type-id='type-id-238' visibility='default' filepath='./Include/internal/pycore_interp.h' line='298' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='78208'>
+        <var-decl name='float_state' type-id='type-id-239' visibility='default' filepath='./Include/internal/pycore_interp.h' line='299' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='78336'>
+        <var-decl name='slice_cache' type-id='type-id-240' visibility='default' filepath='./Include/internal/pycore_interp.h' line='302' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='78400'>
+        <var-decl name='tuple' type-id='type-id-241' visibility='default' filepath='./Include/internal/pycore_interp.h' line='304' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='80320'>
+        <var-decl name='list' type-id='type-id-242' visibility='default' filepath='./Include/internal/pycore_interp.h' line='305' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='85504'>
+        <var-decl name='dict_state' type-id='type-id-243' visibility='default' filepath='./Include/internal/pycore_interp.h' line='306' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='95872'>
+        <var-decl name='frame' type-id='type-id-444' visibility='default' filepath='./Include/internal/pycore_interp.h' line='307' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='96000'>
+        <var-decl name='async_gen' type-id='type-id-245' visibility='default' filepath='./Include/internal/pycore_interp.h' line='308' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='106368'>
+        <var-decl name='context' type-id='type-id-246' visibility='default' filepath='./Include/internal/pycore_interp.h' line='309' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='106496'>
+        <var-decl name='exc_state' type-id='type-id-247' visibility='default' filepath='./Include/internal/pycore_interp.h' line='310' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='106688'>
+        <var-decl name='ast' type-id='type-id-248' visibility='default' filepath='./Include/internal/pycore_interp.h' line='312' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='121728'>
+        <var-decl name='type_cache' type-id='type-id-249' visibility='default' filepath='./Include/internal/pycore_interp.h' line='313' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='PyThreadState' type-id='type-id-700' filepath='./Include/pystate.h' line='20' column='1' id='type-id-702'/>
+    <pointer-type-def type-id='type-id-702' size-in-bits='64' id='type-id-703'/>
+    <function-decl name='_PyErr_Format' mangled-name='_PyErr_Format' filepath='Python/errors.c' line='1076' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyErr_Format'>
+      <parameter type-id='type-id-703' name='tstate' filepath='Python/errors.c' line='1076' column='1'/>
+      <parameter type-id='type-id-16' name='exception' filepath='Python/errors.c' line='1076' column='1'/>
+      <parameter type-id='type-id-3' name='format' filepath='Python/errors.c' line='1077' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyErr_FormatV' mangled-name='PyErr_FormatV' filepath='Python/errors.c' line='1068' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_FormatV'>
+      <parameter type-id='type-id-16' name='exception' filepath='Python/errors.c' line='1068' column='1'/>
+      <parameter type-id='type-id-3' name='format' filepath='Python/errors.c' line='1068' column='1'/>
+      <parameter type-id='type-id-217' name='vargs' filepath='Python/errors.c' line='1068' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyErr_BadInternalCall' mangled-name='PyErr_BadInternalCall' filepath='Python/errors.c' line='1039' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_BadInternalCall'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_BadInternalCall' mangled-name='_PyErr_BadInternalCall' filepath='Python/errors.c' line='1027' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyErr_BadInternalCall'>
+      <parameter type-id='type-id-3' name='filename' filepath='Python/errors.c' line='1027' column='1'/>
+      <parameter type-id='type-id-9' name='lineno' filepath='Python/errors.c' line='1027' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_SetImportError' mangled-name='PyErr_SetImportError' filepath='Python/errors.c' line='1021' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_SetImportError'>
+      <parameter type-id='type-id-16' name='msg' filepath='Python/errors.c' line='1021' column='1'/>
+      <parameter type-id='type-id-16' name='name' filepath='Python/errors.c' line='1021' column='1'/>
+      <parameter type-id='type-id-16' name='path' filepath='Python/errors.c' line='1021' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyErr_SetImportErrorSubclass' mangled-name='PyErr_SetImportErrorSubclass' filepath='Python/errors.c' line='968' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_SetImportErrorSubclass'>
+      <parameter type-id='type-id-16' name='exception' filepath='Python/errors.c' line='968' column='1'/>
+      <parameter type-id='type-id-16' name='msg' filepath='Python/errors.c' line='968' column='1'/>
+      <parameter type-id='type-id-16' name='name' filepath='Python/errors.c' line='969' column='1'/>
+      <parameter type-id='type-id-16' name='path' filepath='Python/errors.c' line='969' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyErr_SetFromErrno' mangled-name='PyErr_SetFromErrno' filepath='Python/errors.c' line='818' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_SetFromErrno'>
+      <parameter type-id='type-id-16' name='im' filepath='Objects/classobject.c' line='25' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyErr_SetFromErrnoWithFilename' mangled-name='PyErr_SetFromErrnoWithFilename' filepath='Python/errors.c' line='798' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_SetFromErrnoWithFilename'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/dictobject.c' line='3582' column='1'/>
+      <parameter type-id='type-id-3' name='key' filepath='Objects/dictobject.c' line='3582' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyErr_SetFromErrnoWithFilenameObjects' mangled-name='PyErr_SetFromErrnoWithFilenameObjects' filepath='Python/errors.c' line='699' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_SetFromErrnoWithFilenameObjects'>
+      <parameter type-id='type-id-16' name='exc' filepath='Python/errors.c' line='699' column='1'/>
+      <parameter type-id='type-id-16' name='filenameObject' filepath='Python/errors.c' line='699' column='1'/>
+      <parameter type-id='type-id-16' name='filenameObject2' filepath='Python/errors.c' line='699' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyErr_SetFromErrnoWithFilenameObject' mangled-name='PyErr_SetFromErrnoWithFilenameObject' filepath='Python/errors.c' line='693' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_SetFromErrnoWithFilenameObject'>
+      <parameter type-id='type-id-16' name='code' filepath='Objects/funcobject.c' line='96' column='1'/>
+      <parameter type-id='type-id-16' name='globals' filepath='Objects/funcobject.c' line='96' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyErr_NoMemory' mangled-name='PyErr_NoMemory' filepath='Python/errors.c' line='686' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_NoMemory'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyErr_BadArgument' mangled-name='PyErr_BadArgument' filepath='Python/errors.c' line='664' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_BadArgument'>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyErr_FormatFromCause' mangled-name='_PyErr_FormatFromCause' filepath='Python/errors.c' line='647' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyErr_FormatFromCause'>
+      <parameter type-id='type-id-16' name='exception' filepath='Python/errors.c' line='647' column='1'/>
+      <parameter type-id='type-id-3' name='format' filepath='Python/errors.c' line='647' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyErr_FormatFromCauseTstate' mangled-name='_PyErr_FormatFromCauseTstate' filepath='Python/errors.c' line='632' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyErr_FormatFromCauseTstate'>
+      <parameter type-id='type-id-703' name='tstate' filepath='Python/errors.c' line='632' column='1'/>
+      <parameter type-id='type-id-16' name='exception' filepath='Python/errors.c' line='632' column='1'/>
+      <parameter type-id='type-id-3' name='format' filepath='Python/errors.c' line='633' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyErr_ChainStackItem' mangled-name='_PyErr_ChainStackItem' filepath='Python/errors.c' line='556' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyErr_ChainStackItem'>
+      <parameter type-id='type-id-18' name='exc_info' filepath='Python/errors.c' line='556' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_ChainExceptions' mangled-name='_PyErr_ChainExceptions' filepath='Python/errors.c' line='514' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyErr_ChainExceptions'>
+      <parameter type-id='type-id-16' name='exc' filepath='Python/errors.c' line='514' column='1'/>
+      <parameter type-id='type-id-16' name='val' filepath='Python/errors.c' line='514' column='1'/>
+      <parameter type-id='type-id-16' name='tb' filepath='Python/errors.c' line='514' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_SetExcInfo' mangled-name='PyErr_SetExcInfo' filepath='Python/errors.c' line='490' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_SetExcInfo'>
+      <parameter type-id='type-id-16' name='p_type' filepath='Python/errors.c' line='490' column='1'/>
+      <parameter type-id='type-id-16' name='p_value' filepath='Python/errors.c' line='490' column='1'/>
+      <parameter type-id='type-id-16' name='p_traceback' filepath='Python/errors.c' line='490' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_GetExcInfo' mangled-name='PyErr_GetExcInfo' filepath='Python/errors.c' line='483' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_GetExcInfo'>
+      <parameter type-id='type-id-86' name='p_type' filepath='Python/errors.c' line='483' column='1'/>
+      <parameter type-id='type-id-86' name='p_value' filepath='Python/errors.c' line='483' column='1'/>
+      <parameter type-id='type-id-86' name='p_traceback' filepath='Python/errors.c' line='483' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_GetExcInfo' mangled-name='_PyErr_GetExcInfo' filepath='Python/errors.c' line='468' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyErr_GetExcInfo'>
+      <parameter type-id='type-id-703' name='tstate' filepath='Python/errors.c' line='468' column='1'/>
+      <parameter type-id='type-id-86' name='p_type' filepath='Python/errors.c' line='469' column='1'/>
+      <parameter type-id='type-id-86' name='p_value' filepath='Python/errors.c' line='469' column='1'/>
+      <parameter type-id='type-id-86' name='p_traceback' filepath='Python/errors.c' line='469' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_Clear' mangled-name='_PyErr_Clear' filepath='Python/errors.c' line='453' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyErr_Clear'>
+      <parameter type-id='type-id-703' name='tstate' filepath='Python/errors.c' line='453' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_Fetch' mangled-name='PyErr_Fetch' filepath='Python/errors.c' line='445' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_Fetch'>
+      <parameter type-id='type-id-86' name='p_type' filepath='Python/errors.c' line='483' column='1'/>
+      <parameter type-id='type-id-86' name='p_value' filepath='Python/errors.c' line='483' column='1'/>
+      <parameter type-id='type-id-86' name='p_traceback' filepath='Python/errors.c' line='483' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_Fetch' mangled-name='_PyErr_Fetch' filepath='Python/errors.c' line='431' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyErr_Fetch'>
+      <parameter type-id='type-id-703' name='tstate' filepath='Python/errors.c' line='431' column='1'/>
+      <parameter type-id='type-id-86' name='p_type' filepath='Python/errors.c' line='431' column='1'/>
+      <parameter type-id='type-id-86' name='p_value' filepath='Python/errors.c' line='431' column='1'/>
+      <parameter type-id='type-id-86' name='p_traceback' filepath='Python/errors.c' line='432' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_NormalizeException' mangled-name='PyErr_NormalizeException' filepath='Python/errors.c' line='423' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_NormalizeException'>
+      <parameter type-id='type-id-86' name='p_type' filepath='Python/errors.c' line='483' column='1'/>
+      <parameter type-id='type-id-86' name='p_value' filepath='Python/errors.c' line='483' column='1'/>
+      <parameter type-id='type-id-86' name='p_traceback' filepath='Python/errors.c' line='483' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_NormalizeException' mangled-name='_PyErr_NormalizeException' filepath='Python/errors.c' line='316' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyErr_NormalizeException'>
+      <parameter type-id='type-id-703' name='tstate' filepath='Python/errors.c' line='316' column='1'/>
+      <parameter type-id='type-id-86' name='exc' filepath='Python/errors.c' line='316' column='1'/>
+      <parameter type-id='type-id-86' name='val' filepath='Python/errors.c' line='317' column='1'/>
+      <parameter type-id='type-id-86' name='tb' filepath='Python/errors.c' line='317' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_ExceptionMatches' mangled-name='PyErr_ExceptionMatches' filepath='Python/errors.c' line='298' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_ExceptionMatches'>
+      <parameter type-id='type-id-16' name='exc' filepath='Python/errors.c' line='298' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyErr_ExceptionMatches' mangled-name='_PyErr_ExceptionMatches' filepath='Python/errors.c' line='291' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyErr_ExceptionMatches'>
+      <parameter type-id='type-id-703' name='tstate' filepath='Python/errors.c' line='291' column='1'/>
+      <parameter type-id='type-id-16' name='exc' filepath='Python/errors.c' line='291' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyErr_Occurred' mangled-name='PyErr_Occurred' filepath='Python/errors.c' line='248' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_Occurred'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyErr_SetString' mangled-name='PyErr_SetString' filepath='Python/errors.c' line='240' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_SetString'>
+      <parameter type-id='type-id-16' name='exception' filepath='Python/errors.c' line='240' column='1'/>
+      <parameter type-id='type-id-3' name='string' filepath='Python/errors.c' line='240' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_SetString' mangled-name='_PyErr_SetString' filepath='Python/errors.c' line='231' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyErr_SetString'>
+      <parameter type-id='type-id-703' name='tstate' filepath='Python/errors.c' line='231' column='1'/>
+      <parameter type-id='type-id-16' name='exception' filepath='Python/errors.c' line='231' column='1'/>
+      <parameter type-id='type-id-3' name='string' filepath='Python/errors.c' line='232' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_SetNone' mangled-name='PyErr_SetNone' filepath='Python/errors.c' line='223' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_SetNone'>
+      <parameter type-id='type-id-16' name='exception' filepath='Python/errors.c' line='223' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_SetNone' mangled-name='_PyErr_SetNone' filepath='Python/errors.c' line='216' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyErr_SetNone'>
+      <parameter type-id='type-id-703' name='tstate' filepath='Python/errors.c' line='216' column='1'/>
+      <parameter type-id='type-id-16' name='exception' filepath='Python/errors.c' line='216' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_SetKeyError' mangled-name='_PyErr_SetKeyError' filepath='Python/errors.c' line='203' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyErr_SetKeyError'>
+      <parameter type-id='type-id-16' name='arg' filepath='Python/errors.c' line='203' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_SetObject' mangled-name='PyErr_SetObject' filepath='Python/errors.c' line='193' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_SetObject'>
+      <parameter type-id='type-id-16' name='exception' filepath='Python/errors.c' line='193' column='1'/>
+      <parameter type-id='type-id-16' name='value' filepath='Python/errors.c' line='193' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_GetTopmostException' mangled-name='_PyErr_GetTopmostException' filepath='Python/errors.c' line='77' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyErr_GetTopmostException'>
+      <parameter type-id='type-id-703' name='tstate' filepath='Python/errors.c' line='77' column='1'/>
+      <return type-id='type-id-18'/>
+    </function-decl>
+    <function-decl name='PyErr_Restore' mangled-name='PyErr_Restore' filepath='Python/errors.c' line='69' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_Restore'>
+      <parameter type-id='type-id-16' name='type' filepath='Python/errors.c' line='69' column='1'/>
+      <parameter type-id='type-id-16' name='value' filepath='Python/errors.c' line='69' column='1'/>
+      <parameter type-id='type-id-16' name='traceback' filepath='Python/errors.c' line='69' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_Restore' mangled-name='_PyErr_Restore' filepath='Python/errors.c' line='41' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyErr_Restore'>
+      <parameter type-id='type-id-703' name='tstate' filepath='Python/errors.c' line='41' column='1'/>
+      <parameter type-id='type-id-16' name='type' filepath='Python/errors.c' line='41' column='1'/>
+      <parameter type-id='type-id-16' name='value' filepath='Python/errors.c' line='41' column='1'/>
+      <parameter type-id='type-id-16' name='traceback' filepath='Python/errors.c' line='42' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_GivenExceptionMatches' mangled-name='PyErr_GivenExceptionMatches' filepath='Python/errors.c' line='259' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_GivenExceptionMatches'>
+      <parameter type-id='type-id-16' name='self' filepath='Objects/exceptions.c' line='330' column='1'/>
+      <parameter type-id='type-id-16' name='tb' filepath='Objects/exceptions.c' line='330' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyErr_SetObject' mangled-name='_PyErr_SetObject' filepath='Python/errors.c' line='115' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyErr_SetObject'>
+      <parameter type-id='type-id-703' name='tstate' filepath='Python/errors.c' line='115' column='1'/>
+      <parameter type-id='type-id-16' name='exception' filepath='Python/errors.c' line='115' column='1'/>
+      <parameter type-id='type-id-16' name='value' filepath='Python/errors.c' line='115' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_NoMemory' mangled-name='_PyErr_NoMemory' filepath='Python/errors.c' line='673' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyErr_NoMemory'>
+      <parameter type-id='type-id-703' name='tstate' filepath='Python/errors.c' line='673' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_Py_fopen_obj' mangled-name='_Py_fopen_obj' filepath='./Include/cpython/fileutils.h' line='101' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTraceBack_FromFrame' mangled-name='_PyTraceBack_FromFrame' filepath='./Include/internal/pycore_traceback.h' line='86' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_FatalError_TstateNULL' mangled-name='_Py_FatalError_TstateNULL' filepath='./Include/internal/pycore_pystate.h' line='89' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyTraceBack_Print' mangled-name='PyTraceBack_Print' filepath='./Include/traceback.h' line='10' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyType_GetQualName' mangled-name='_PyType_GetQualName' filepath='./Include/internal/pycore_object.h' line='33' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='strerror' mangled-name='strerror' filepath='/usr/include/string.h' line='397' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_DecodeLocale' mangled-name='PyUnicode_DecodeLocale' filepath='./Include/unicodeobject.h' line='748' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyException_SetContext' mangled-name='PyException_SetContext' filepath='./Include/pyerrors.h' line='48' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyException_GetContext' mangled-name='PyException_GetContext' filepath='./Include/pyerrors.h' line='47' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/frozenmain.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='Py_FrozenMain' mangled-name='Py_FrozenMain' filepath='Python/frozenmain.c' line='17' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_FrozenMain'>
+      <parameter type-id='type-id-9' name='argc' filepath='Python/frozenmain.c' line='17' column='1'/>
+      <parameter type-id='type-id-215' name='argv' filepath='Python/frozenmain.c' line='17' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyRuntime_Initialize' mangled-name='_PyRuntime_Initialize' filepath='./Include/internal/pycore_runtime.h' line='139' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyStatus_Exception' mangled-name='PyStatus_Exception' filepath='./Include/cpython/initconfig.h' line='27' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyConfig_InitPythonConfig' mangled-name='PyConfig_InitPythonConfig' filepath='./Include/cpython/initconfig.h' line='214' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='setlocale' mangled-name='setlocale' filepath='/usr/include/locale.h' line='122' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyMem_RawStrdup' mangled-name='_PyMem_RawStrdup' filepath='./Include/cpython/pymem.h' line='14' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='Py_DecodeLocale' mangled-name='Py_DecodeLocale' filepath='./Include/fileutils.h' line='8' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='setbuf' mangled-name='setbuf' filepath='/usr/include/stdio.h' line='304' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='Py_SetProgramName' mangled-name='Py_SetProgramName' filepath='./Include/pylifecycle.h' line='37' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='Py_InitializeFromConfig' mangled-name='Py_InitializeFromConfig' filepath='./Include/cpython/pylifecycle.h' line='33' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyConfig_Clear' mangled-name='PyConfig_Clear' filepath='./Include/cpython/initconfig.h' line='216' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PySys_SetArgv' mangled-name='PySys_SetArgv' filepath='./Include/sysmodule.h' line='13' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyImport_ImportFrozenModule' mangled-name='PyImport_ImportFrozenModule' filepath='./Include/import.h' line='80' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='Py_FinalizeEx' mangled-name='Py_FinalizeEx' filepath='./Include/pylifecycle.h' line='16' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='Py_GetCopyright' mangled-name='Py_GetCopyright' filepath='./Include/pylifecycle.h' line='56' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='Py_GetVersion' mangled-name='Py_GetVersion' filepath='./Include/pylifecycle.h' line='54' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyRun_AnyFileExFlags' mangled-name='PyRun_AnyFileExFlags' filepath='./Include/cpython/pythonrun.h' line='11' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='Py_ExitStatusException' mangled-name='Py_ExitStatusException' filepath='./Include/cpython/pylifecycle.h' line='40' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/future.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='PyErr_SyntaxLocationObject' mangled-name='PyErr_SyntaxLocationObject' filepath='./Include/cpython/pyerrors.h' line='148' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/getargs.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='_PyArg_NoKwnames' mangled-name='_PyArg_NoKwnames' filepath='Python/getargs.c' line='2761' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyArg_NoKwnames'>
+      <parameter type-id='type-id-3' name='funcname' filepath='Python/getargs.c' line='2761' column='1'/>
+      <parameter type-id='type-id-16' name='kwnames' filepath='Python/getargs.c' line='2761' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyArg_NoPositional' mangled-name='_PyArg_NoPositional' filepath='Python/getargs.c' line='2744' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyArg_NoPositional'>
+      <parameter type-id='type-id-3' name='funcname' filepath='Python/getargs.c' line='2744' column='1'/>
+      <parameter type-id='type-id-16' name='args' filepath='Python/getargs.c' line='2744' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyArg_NoKeywords' mangled-name='_PyArg_NoKeywords' filepath='Python/getargs.c' line='2725' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyArg_NoKeywords'>
+      <parameter type-id='type-id-3' name='funcname' filepath='Python/getargs.c' line='2744' column='1'/>
+      <parameter type-id='type-id-16' name='args' filepath='Python/getargs.c' line='2744' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyArg_UnpackStack' mangled-name='_PyArg_UnpackStack' filepath='Python/getargs.c' line='2698' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyArg_UnpackStack'>
+      <parameter type-id='type-id-156' name='args' filepath='Python/getargs.c' line='2698' column='1'/>
+      <parameter type-id='type-id-31' name='nargs' filepath='Python/getargs.c' line='2698' column='1'/>
+      <parameter type-id='type-id-3' name='name' filepath='Python/getargs.c' line='2698' column='1'/>
+      <parameter type-id='type-id-31' name='min' filepath='Python/getargs.c' line='2699' column='1'/>
+      <parameter type-id='type-id-31' name='max' filepath='Python/getargs.c' line='2699' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyArg_UnpackTuple' mangled-name='PyArg_UnpackTuple' filepath='Python/getargs.c' line='2672' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyArg_UnpackTuple'>
+      <parameter type-id='type-id-16' name='args' filepath='Python/getargs.c' line='2672' column='1'/>
+      <parameter type-id='type-id-3' name='name' filepath='Python/getargs.c' line='2672' column='1'/>
+      <parameter type-id='type-id-31' name='min' filepath='Python/getargs.c' line='2672' column='1'/>
+      <parameter type-id='type-id-31' name='max' filepath='Python/getargs.c' line='2672' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <class-decl name='_PyArg_Parser' size-in-bits='512' is-struct='yes' visibility='default' filepath='./Include/modsupport.h' line='92' column='1' id='type-id-704'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='format' type-id='type-id-3' visibility='default' filepath='./Include/modsupport.h' line='93' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='keywords' type-id='type-id-705' visibility='default' filepath='./Include/modsupport.h' line='94' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='fname' type-id='type-id-3' visibility='default' filepath='./Include/modsupport.h' line='95' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='custom_msg' type-id='type-id-3' visibility='default' filepath='./Include/modsupport.h' line='96' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='pos' type-id='type-id-9' visibility='default' filepath='./Include/modsupport.h' line='97' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='288'>
+        <var-decl name='min' type-id='type-id-9' visibility='default' filepath='./Include/modsupport.h' line='98' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='max' type-id='type-id-9' visibility='default' filepath='./Include/modsupport.h' line='99' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='384'>
+        <var-decl name='kwtuple' type-id='type-id-16' visibility='default' filepath='./Include/modsupport.h' line='100' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='448'>
+        <var-decl name='next' type-id='type-id-706' visibility='default' filepath='./Include/modsupport.h' line='101' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-5' size-in-bits='64' id='type-id-705'/>
+    <pointer-type-def type-id='type-id-704' size-in-bits='64' id='type-id-706'/>
+    <function-decl name='_PyArg_UnpackKeywords' mangled-name='_PyArg_UnpackKeywords' filepath='Python/getargs.c' line='2268' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyArg_UnpackKeywords'>
+      <parameter type-id='type-id-156' name='args' filepath='Python/getargs.c' line='2268' column='1'/>
+      <parameter type-id='type-id-31' name='nargs' filepath='Python/getargs.c' line='2268' column='1'/>
+      <parameter type-id='type-id-16' name='kwargs' filepath='Python/getargs.c' line='2269' column='1'/>
+      <parameter type-id='type-id-16' name='kwnames' filepath='Python/getargs.c' line='2269' column='1'/>
+      <parameter type-id='type-id-706' name='parser' filepath='Python/getargs.c' line='2270' column='1'/>
+      <parameter type-id='type-id-9' name='minpos' filepath='Python/getargs.c' line='2271' column='1'/>
+      <parameter type-id='type-id-9' name='maxpos' filepath='Python/getargs.c' line='2271' column='1'/>
+      <parameter type-id='type-id-9' name='minkw' filepath='Python/getargs.c' line='2271' column='1'/>
+      <parameter type-id='type-id-86' name='buf' filepath='Python/getargs.c' line='2272' column='1'/>
+      <return type-id='type-id-156'/>
+    </function-decl>
+    <function-decl name='PyArg_ValidateKeywordArguments' mangled-name='PyArg_ValidateKeywordArguments' filepath='Python/getargs.c' line='1557' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyArg_ValidateKeywordArguments'>
+      <parameter type-id='type-id-16' name='kwargs' filepath='Python/getargs.c' line='1557' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyArg_VaParseTupleAndKeywordsFast_SizeT' mangled-name='_PyArg_VaParseTupleAndKeywordsFast_SizeT' filepath='Python/getargs.c' line='1543' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyArg_VaParseTupleAndKeywordsFast_SizeT'>
+      <parameter type-id='type-id-16' name='args' filepath='Python/getargs.c' line='1543' column='1'/>
+      <parameter type-id='type-id-16' name='keywords' filepath='Python/getargs.c' line='1543' column='1'/>
+      <parameter type-id='type-id-706' name='parser' filepath='Python/getargs.c' line='1544' column='1'/>
+      <parameter type-id='type-id-217' name='va' filepath='Python/getargs.c' line='1544' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyArg_VaParseTupleAndKeywordsFast' mangled-name='_PyArg_VaParseTupleAndKeywordsFast' filepath='Python/getargs.c' line='1529' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyArg_VaParseTupleAndKeywordsFast'>
+      <parameter type-id='type-id-16' name='args' filepath='Python/getargs.c' line='1543' column='1'/>
+      <parameter type-id='type-id-16' name='keywords' filepath='Python/getargs.c' line='1543' column='1'/>
+      <parameter type-id='type-id-706' name='parser' filepath='Python/getargs.c' line='1544' column='1'/>
+      <parameter type-id='type-id-217' name='va' filepath='Python/getargs.c' line='1544' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyArg_ParseStackAndKeywords_SizeT' mangled-name='_PyArg_ParseStackAndKeywords_SizeT' filepath='Python/getargs.c' line='1515' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyArg_ParseStackAndKeywords_SizeT'>
+      <parameter type-id='type-id-156' name='args' filepath='Python/getargs.c' line='1515' column='1'/>
+      <parameter type-id='type-id-31' name='nargs' filepath='Python/getargs.c' line='1515' column='1'/>
+      <parameter type-id='type-id-16' name='kwnames' filepath='Python/getargs.c' line='1515' column='1'/>
+      <parameter type-id='type-id-706' name='parser' filepath='Python/getargs.c' line='1516' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyArg_ParseStackAndKeywords' mangled-name='_PyArg_ParseStackAndKeywords' filepath='Python/getargs.c' line='1502' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyArg_ParseStackAndKeywords'>
+      <parameter type-id='type-id-156' name='args' filepath='Python/getargs.c' line='1515' column='1'/>
+      <parameter type-id='type-id-31' name='nargs' filepath='Python/getargs.c' line='1515' column='1'/>
+      <parameter type-id='type-id-16' name='kwnames' filepath='Python/getargs.c' line='1515' column='1'/>
+      <parameter type-id='type-id-706' name='parser' filepath='Python/getargs.c' line='1516' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyArg_ParseTupleAndKeywordsFast_SizeT' mangled-name='_PyArg_ParseTupleAndKeywordsFast_SizeT' filepath='Python/getargs.c' line='1489' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyArg_ParseTupleAndKeywordsFast_SizeT'>
+      <parameter type-id='type-id-16' name='args' filepath='Python/getargs.c' line='1489' column='1'/>
+      <parameter type-id='type-id-16' name='keywords' filepath='Python/getargs.c' line='1489' column='1'/>
+      <parameter type-id='type-id-706' name='parser' filepath='Python/getargs.c' line='1490' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyArg_ParseTupleAndKeywordsFast' mangled-name='_PyArg_ParseTupleAndKeywordsFast' filepath='Python/getargs.c' line='1476' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyArg_ParseTupleAndKeywordsFast'>
+      <parameter type-id='type-id-16' name='args' filepath='Python/getargs.c' line='1489' column='1'/>
+      <parameter type-id='type-id-16' name='keywords' filepath='Python/getargs.c' line='1489' column='1'/>
+      <parameter type-id='type-id-706' name='parser' filepath='Python/getargs.c' line='1490' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyArg_VaParseTupleAndKeywords_SizeT' mangled-name='_PyArg_VaParseTupleAndKeywords_SizeT' filepath='Python/getargs.c' line='1450' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyArg_VaParseTupleAndKeywords_SizeT'>
+      <parameter type-id='type-id-16' name='args' filepath='Python/getargs.c' line='1450' column='1'/>
+      <parameter type-id='type-id-16' name='keywords' filepath='Python/getargs.c' line='1451' column='1'/>
+      <parameter type-id='type-id-3' name='format' filepath='Python/getargs.c' line='1452' column='1'/>
+      <parameter type-id='type-id-215' name='kwlist' filepath='Python/getargs.c' line='1453' column='1'/>
+      <parameter type-id='type-id-217' name='va' filepath='Python/getargs.c' line='1453' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyArg_VaParseTupleAndKeywords' mangled-name='PyArg_VaParseTupleAndKeywords' filepath='Python/getargs.c' line='1425' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyArg_VaParseTupleAndKeywords'>
+      <parameter type-id='type-id-16' name='args' filepath='Python/getargs.c' line='1450' column='1'/>
+      <parameter type-id='type-id-16' name='keywords' filepath='Python/getargs.c' line='1451' column='1'/>
+      <parameter type-id='type-id-3' name='format' filepath='Python/getargs.c' line='1452' column='1'/>
+      <parameter type-id='type-id-215' name='kwlist' filepath='Python/getargs.c' line='1453' column='1'/>
+      <parameter type-id='type-id-217' name='va' filepath='Python/getargs.c' line='1453' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyArg_ParseTupleAndKeywords_SizeT' mangled-name='_PyArg_ParseTupleAndKeywords_SizeT' filepath='Python/getargs.c' line='1399' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyArg_ParseTupleAndKeywords_SizeT'>
+      <parameter type-id='type-id-16' name='args' filepath='Python/getargs.c' line='1399' column='1'/>
+      <parameter type-id='type-id-16' name='keywords' filepath='Python/getargs.c' line='1400' column='1'/>
+      <parameter type-id='type-id-3' name='format' filepath='Python/getargs.c' line='1401' column='1'/>
+      <parameter type-id='type-id-215' name='kwlist' filepath='Python/getargs.c' line='1402' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyArg_ParseTupleAndKeywords' mangled-name='PyArg_ParseTupleAndKeywords' filepath='Python/getargs.c' line='1375' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyArg_ParseTupleAndKeywords'>
+      <parameter type-id='type-id-16' name='args' filepath='Python/getargs.c' line='1399' column='1'/>
+      <parameter type-id='type-id-16' name='keywords' filepath='Python/getargs.c' line='1400' column='1'/>
+      <parameter type-id='type-id-3' name='format' filepath='Python/getargs.c' line='1401' column='1'/>
+      <parameter type-id='type-id-215' name='kwlist' filepath='Python/getargs.c' line='1402' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyArg_BadArgument' mangled-name='_PyArg_BadArgument' filepath='Python/getargs.c' line='617' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyArg_BadArgument'>
+      <parameter type-id='type-id-3' name='fname' filepath='Python/getargs.c' line='617' column='1'/>
+      <parameter type-id='type-id-3' name='displayname' filepath='Python/getargs.c' line='617' column='1'/>
+      <parameter type-id='type-id-3' name='expected' filepath='Python/getargs.c' line='618' column='1'/>
+      <parameter type-id='type-id-16' name='arg' filepath='Python/getargs.c' line='618' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyArg_VaParse_SizeT' mangled-name='_PyArg_VaParse_SizeT' filepath='Python/getargs.c' line='186' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyArg_VaParse_SizeT'>
+      <parameter type-id='type-id-16' name='args' filepath='Python/getargs.c' line='186' column='1'/>
+      <parameter type-id='type-id-3' name='format' filepath='Python/getargs.c' line='186' column='1'/>
+      <parameter type-id='type-id-217' name='va' filepath='Python/getargs.c' line='186' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyArg_VaParse' mangled-name='PyArg_VaParse' filepath='Python/getargs.c' line='173' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyArg_VaParse'>
+      <parameter type-id='type-id-16' name='args' filepath='Python/getargs.c' line='186' column='1'/>
+      <parameter type-id='type-id-3' name='format' filepath='Python/getargs.c' line='186' column='1'/>
+      <parameter type-id='type-id-217' name='va' filepath='Python/getargs.c' line='186' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyArg_ParseStack_SizeT' mangled-name='_PyArg_ParseStack_SizeT' filepath='Python/getargs.c' line='160' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyArg_ParseStack_SizeT'>
+      <parameter type-id='type-id-156' name='args' filepath='Python/getargs.c' line='160' column='1'/>
+      <parameter type-id='type-id-31' name='nargs' filepath='Python/getargs.c' line='160' column='1'/>
+      <parameter type-id='type-id-3' name='format' filepath='Python/getargs.c' line='160' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyArg_ParseStack' mangled-name='_PyArg_ParseStack' filepath='Python/getargs.c' line='148' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyArg_ParseStack'>
+      <parameter type-id='type-id-156' name='args' filepath='Python/getargs.c' line='160' column='1'/>
+      <parameter type-id='type-id-31' name='nargs' filepath='Python/getargs.c' line='160' column='1'/>
+      <parameter type-id='type-id-3' name='format' filepath='Python/getargs.c' line='160' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyArg_ParseTuple_SizeT' mangled-name='_PyArg_ParseTuple_SizeT' filepath='Python/getargs.c' line='135' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyArg_ParseTuple_SizeT'>
+      <parameter type-id='type-id-16' name='args' filepath='Python/getargs.c' line='135' column='1'/>
+      <parameter type-id='type-id-3' name='format' filepath='Python/getargs.c' line='135' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyArg_ParseTuple' mangled-name='PyArg_ParseTuple' filepath='Python/getargs.c' line='123' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyArg_ParseTuple'>
+      <parameter type-id='type-id-16' name='args' filepath='Python/getargs.c' line='135' column='1'/>
+      <parameter type-id='type-id-3' name='format' filepath='Python/getargs.c' line='135' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyArg_Parse_SizeT' mangled-name='_PyArg_Parse_SizeT' filepath='Python/getargs.c' line='110' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyArg_Parse_SizeT'>
+      <parameter type-id='type-id-16' name='args' filepath='Python/getargs.c' line='135' column='1'/>
+      <parameter type-id='type-id-3' name='format' filepath='Python/getargs.c' line='135' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyArg_Parse' mangled-name='PyArg_Parse' filepath='Python/getargs.c' line='98' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyArg_Parse'>
+      <parameter type-id='type-id-16' name='args' filepath='Python/getargs.c' line='135' column='1'/>
+      <parameter type-id='type-id-3' name='format' filepath='Python/getargs.c' line='135' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyArg_CheckPositional' mangled-name='_PyArg_CheckPositional' filepath='Python/getargs.c' line='2610' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyArg_CheckPositional'>
+      <parameter type-id='type-id-3' name='name' filepath='Python/getargs.c' line='2610' column='1'/>
+      <parameter type-id='type-id-31' name='nargs' filepath='Python/getargs.c' line='2610' column='1'/>
+      <parameter type-id='type-id-31' name='min' filepath='Python/getargs.c' line='2611' column='1'/>
+      <parameter type-id='type-id-31' name='max' filepath='Python/getargs.c' line='2611' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyDict_HasOnlyStringKeys' mangled-name='_PyDict_HasOnlyStringKeys' filepath='./Include/cpython/dictobject.h' line='53' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyByteArray_Size' mangled-name='PyByteArray_Size' filepath='./Include/bytearrayobject.h' line='33' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_AsUnicodeAndSize' mangled-name='PyUnicode_AsUnicodeAndSize' filepath='./Include/cpython/unicodeobject.h' line='595' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyLong_AsUnsignedLongMask' mangled-name='PyLong_AsUnsignedLongMask' filepath='./Include/longobject.h' line='28' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyLong_AsUnsignedLongLongMask' mangled-name='PyLong_AsUnsignedLongLongMask' filepath='./Include/longobject.h' line='100' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/getcompiler.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='Py_GetCompiler' mangled-name='Py_GetCompiler' filepath='Python/getcompiler.c' line='24' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_GetCompiler'>
+      <return type-id='type-id-3'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/getcopyright.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='Py_GetCopyright' mangled-name='Py_GetCopyright' filepath='Python/getcopyright.c' line='20' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_GetCopyright'>
+      <return type-id='type-id-3'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='./Python/getplatform.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='Py_GetPlatform' mangled-name='Py_GetPlatform' filepath='./Python/getplatform.c' line='9' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_GetPlatform'>
+      <return type-id='type-id-3'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/getversion.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='Py_GetVersion' mangled-name='Py_GetVersion' filepath='Python/getversion.c' line='9' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_GetVersion'>
+      <return type-id='type-id-3'/>
+    </function-decl>
+    <function-decl name='Py_GetCompiler' mangled-name='Py_GetCompiler' filepath='./Include/pylifecycle.h' line='57' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='Py_GetBuildInfo' mangled-name='Py_GetBuildInfo' filepath='./Include/pylifecycle.h' line='58' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/hamt.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='_PyHamtItems_Type' type-id='type-id-149' mangled-name='_PyHamtItems_Type' visibility='default' filepath='./Include/internal/pycore_hamt.h' line='70' column='1' elf-symbol-id='_PyHamtItems_Type'/>
+    <var-decl name='_PyHamtKeys_Type' type-id='type-id-149' mangled-name='_PyHamtKeys_Type' visibility='default' filepath='./Include/internal/pycore_hamt.h' line='68' column='1' elf-symbol-id='_PyHamtKeys_Type'/>
+    <var-decl name='_PyHamtValues_Type' type-id='type-id-149' mangled-name='_PyHamtValues_Type' visibility='default' filepath='./Include/internal/pycore_hamt.h' line='69' column='1' elf-symbol-id='_PyHamtValues_Type'/>
+    <var-decl name='_PyHamt_Type' type-id='type-id-149' mangled-name='_PyHamt_Type' visibility='default' filepath='./Include/internal/pycore_hamt.h' line='64' column='1' elf-symbol-id='_PyHamt_Type'/>
+    <var-decl name='_PyHamt_ArrayNode_Type' type-id='type-id-149' mangled-name='_PyHamt_ArrayNode_Type' visibility='default' filepath='./Include/internal/pycore_hamt.h' line='65' column='1' elf-symbol-id='_PyHamt_ArrayNode_Type'/>
+    <var-decl name='_PyHamt_BitmapNode_Type' type-id='type-id-149' mangled-name='_PyHamt_BitmapNode_Type' visibility='default' filepath='./Include/internal/pycore_hamt.h' line='66' column='1' elf-symbol-id='_PyHamt_BitmapNode_Type'/>
+    <var-decl name='_PyHamt_CollisionNode_Type' type-id='type-id-149' mangled-name='_PyHamt_CollisionNode_Type' visibility='default' filepath='./Include/internal/pycore_hamt.h' line='67' column='1' elf-symbol-id='_PyHamt_CollisionNode_Type'/>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/hashtable.c' comp-dir-path='/src' language='LANG_C99'>
+    <class-decl name='_Py_hashtable_t' size-in-bits='640' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_hashtable.h' line='60' column='1' id='type-id-707'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='nentries' type-id='type-id-157' visibility='default' filepath='./Include/internal/pycore_hashtable.h' line='61' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='nbuckets' type-id='type-id-157' visibility='default' filepath='./Include/internal/pycore_hashtable.h' line='62' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='buckets' type-id='type-id-708' visibility='default' filepath='./Include/internal/pycore_hashtable.h' line='63' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='get_entry_func' type-id='type-id-709' visibility='default' filepath='./Include/internal/pycore_hashtable.h' line='65' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='hash_func' type-id='type-id-710' visibility='default' filepath='./Include/internal/pycore_hashtable.h' line='66' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='compare_func' type-id='type-id-711' visibility='default' filepath='./Include/internal/pycore_hashtable.h' line='67' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='384'>
+        <var-decl name='key_destroy_func' type-id='type-id-712' visibility='default' filepath='./Include/internal/pycore_hashtable.h' line='68' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='448'>
+        <var-decl name='value_destroy_func' type-id='type-id-712' visibility='default' filepath='./Include/internal/pycore_hashtable.h' line='69' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='512'>
+        <var-decl name='alloc' type-id='type-id-713' visibility='default' filepath='./Include/internal/pycore_hashtable.h' line='70' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='64' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-714' visibility='default' filepath='./Include/internal/pycore_hashtable.h' line='17' column='1' id='type-id-715'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='head' type-id='type-id-716' visibility='default' filepath='./Include/internal/pycore_hashtable.h' line='18' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='_Py_slist_item_s' size-in-bits='64' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_hashtable.h' line='13' column='1' id='type-id-717'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='next' type-id='type-id-718' visibility='default' filepath='./Include/internal/pycore_hashtable.h' line='14' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-717' size-in-bits='64' id='type-id-718'/>
+    <typedef-decl name='_Py_slist_item_t' type-id='type-id-717' filepath='./Include/internal/pycore_hashtable.h' line='15' column='1' id='type-id-719'/>
+    <pointer-type-def type-id='type-id-719' size-in-bits='64' id='type-id-716'/>
+    <typedef-decl name='_Py_slist_t' type-id='type-id-715' filepath='./Include/internal/pycore_hashtable.h' line='19' column='1' id='type-id-714'/>
+    <pointer-type-def type-id='type-id-714' size-in-bits='64' id='type-id-708'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='256' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-720' visibility='default' filepath='./Include/internal/pycore_hashtable.h' line='28' column='1' id='type-id-721'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='_Py_slist_item' type-id='type-id-719' visibility='default' filepath='./Include/internal/pycore_hashtable.h' line='30' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='key_hash' type-id='type-id-722' visibility='default' filepath='./Include/internal/pycore_hashtable.h' line='32' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='key' type-id='type-id-21' visibility='default' filepath='./Include/internal/pycore_hashtable.h' line='33' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='value' type-id='type-id-21' visibility='default' filepath='./Include/internal/pycore_hashtable.h' line='34' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='Py_uhash_t' type-id='type-id-157' filepath='./Include/pyport.h' line='119' column='1' id='type-id-722'/>
+    <typedef-decl name='_Py_hashtable_entry_t' type-id='type-id-721' filepath='./Include/internal/pycore_hashtable.h' line='35' column='1' id='type-id-720'/>
+    <pointer-type-def type-id='type-id-720' size-in-bits='64' id='type-id-723'/>
+    <typedef-decl name='_Py_hashtable_t' type-id='type-id-707' filepath='./Include/internal/pycore_hashtable.h' line='42' column='1' id='type-id-724'/>
+    <pointer-type-def type-id='type-id-724' size-in-bits='64' id='type-id-725'/>
+    <pointer-type-def type-id='type-id-726' size-in-bits='64' id='type-id-727'/>
+    <typedef-decl name='_Py_hashtable_get_entry_func' type-id='type-id-727' filepath='./Include/internal/pycore_hashtable.h' line='47' column='1' id='type-id-709'/>
+    <pointer-type-def type-id='type-id-728' size-in-bits='64' id='type-id-729'/>
+    <typedef-decl name='_Py_hashtable_hash_func' type-id='type-id-729' filepath='./Include/internal/pycore_hashtable.h' line='44' column='1' id='type-id-710'/>
+    <pointer-type-def type-id='type-id-730' size-in-bits='64' id='type-id-731'/>
+    <typedef-decl name='_Py_hashtable_compare_func' type-id='type-id-731' filepath='./Include/internal/pycore_hashtable.h' line='45' column='1' id='type-id-711'/>
+    <typedef-decl name='_Py_hashtable_destroy_func' type-id='type-id-20' filepath='./Include/internal/pycore_hashtable.h' line='46' column='1' id='type-id-712'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='128' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-713' visibility='default' filepath='./Include/internal/pycore_hashtable.h' line='50' column='1' id='type-id-732'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='malloc' type-id='type-id-733' visibility='default' filepath='./Include/internal/pycore_hashtable.h' line='52' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='free' type-id='type-id-20' visibility='default' filepath='./Include/internal/pycore_hashtable.h' line='55' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-734' size-in-bits='64' id='type-id-733'/>
+    <typedef-decl name='_Py_hashtable_allocator_t' type-id='type-id-732' filepath='./Include/internal/pycore_hashtable.h' line='56' column='1' id='type-id-713'/>
+    <function-decl name='_Py_hashtable_destroy' mangled-name='_Py_hashtable_destroy' filepath='Python/hashtable.c' line='404' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_hashtable_destroy'>
+      <parameter type-id='type-id-725' name='ht' filepath='Python/hashtable.c' line='404' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_hashtable_clear' mangled-name='_Py_hashtable_clear' filepath='Python/hashtable.c' line='385' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_hashtable_clear'>
+      <parameter type-id='type-id-725' name='ht' filepath='Python/hashtable.c' line='404' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_hashtable_new' mangled-name='_Py_hashtable_new' filepath='Python/hashtable.c' line='363' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_hashtable_new'>
+      <parameter type-id='type-id-710' name='hash_func' filepath='Python/hashtable.c' line='363' column='1'/>
+      <parameter type-id='type-id-711' name='compare_func' filepath='Python/hashtable.c' line='364' column='1'/>
+      <return type-id='type-id-725'/>
+    </function-decl>
+    <pointer-type-def type-id='type-id-713' size-in-bits='64' id='type-id-735'/>
+    <function-decl name='_Py_hashtable_new_full' mangled-name='_Py_hashtable_new_full' filepath='Python/hashtable.c' line='316' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_hashtable_new_full'>
+      <parameter type-id='type-id-710' name='hash_func' filepath='Python/hashtable.c' line='316' column='1'/>
+      <parameter type-id='type-id-711' name='compare_func' filepath='Python/hashtable.c' line='317' column='1'/>
+      <parameter type-id='type-id-712' name='key_destroy_func' filepath='Python/hashtable.c' line='318' column='1'/>
+      <parameter type-id='type-id-712' name='value_destroy_func' filepath='Python/hashtable.c' line='319' column='1'/>
+      <parameter type-id='type-id-735' name='allocator' filepath='Python/hashtable.c' line='320' column='1'/>
+      <return type-id='type-id-725'/>
+    </function-decl>
+    <pointer-type-def type-id='type-id-736' size-in-bits='64' id='type-id-737'/>
+    <typedef-decl name='_Py_hashtable_foreach_func' type-id='type-id-737' filepath='./Include/internal/pycore_hashtable.h' line='96' column='1' id='type-id-738'/>
+    <function-decl name='_Py_hashtable_foreach' mangled-name='_Py_hashtable_foreach' filepath='Python/hashtable.c' line='261' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_hashtable_foreach'>
+      <parameter type-id='type-id-725' name='ht' filepath='Python/hashtable.c' line='261' column='1'/>
+      <parameter type-id='type-id-738' name='func' filepath='Python/hashtable.c' line='262' column='1'/>
+      <parameter type-id='type-id-21' name='user_data' filepath='Python/hashtable.c' line='263' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_Py_hashtable_get' mangled-name='_Py_hashtable_get' filepath='Python/hashtable.c' line='248' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_hashtable_get'>
+      <parameter type-id='type-id-725' name='ht' filepath='Python/hashtable.c' line='248' column='1'/>
+      <parameter type-id='type-id-21' name='key' filepath='Python/hashtable.c' line='248' column='1'/>
+      <return type-id='type-id-21'/>
+    </function-decl>
+    <function-decl name='_Py_hashtable_set' mangled-name='_Py_hashtable_set' filepath='Python/hashtable.c' line='209' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_hashtable_set'>
+      <parameter type-id='type-id-725' name='ht' filepath='Python/hashtable.c' line='209' column='1'/>
+      <parameter type-id='type-id-21' name='key' filepath='Python/hashtable.c' line='209' column='1'/>
+      <parameter type-id='type-id-21' name='value' filepath='Python/hashtable.c' line='209' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_Py_hashtable_steal' mangled-name='_Py_hashtable_steal' filepath='Python/hashtable.c' line='174' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_hashtable_steal'>
+      <parameter type-id='type-id-725' name='ht' filepath='Python/hashtable.c' line='174' column='1'/>
+      <parameter type-id='type-id-21' name='key' filepath='Python/hashtable.c' line='174' column='1'/>
+      <return type-id='type-id-21'/>
+    </function-decl>
+    <qualified-type-def type-id='type-id-724' const='yes' id='type-id-739'/>
+    <pointer-type-def type-id='type-id-739' size-in-bits='64' id='type-id-740'/>
+    <function-decl name='_Py_hashtable_size' mangled-name='_Py_hashtable_size' filepath='Python/hashtable.c' line='120' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_hashtable_size'>
+      <parameter type-id='type-id-740' name='ht' filepath='Python/hashtable.c' line='120' column='1'/>
+      <return type-id='type-id-157'/>
+    </function-decl>
+    <function-decl name='_Py_hashtable_compare_direct' mangled-name='_Py_hashtable_compare_direct' filepath='Python/hashtable.c' line='99' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_hashtable_compare_direct'>
+      <parameter type-id='type-id-21' name='key1' filepath='Python/hashtable.c' line='99' column='1'/>
+      <parameter type-id='type-id-21' name='key2' filepath='Python/hashtable.c' line='99' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_Py_hashtable_hash_ptr' mangled-name='_Py_hashtable_hash_ptr' filepath='Python/hashtable.c' line='92' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_hashtable_hash_ptr'>
+      <parameter type-id='type-id-21' name='key' filepath='Python/hashtable.c' line='92' column='1'/>
+      <return type-id='type-id-722'/>
+    </function-decl>
+    <function-decl name='_Py_HashPointerRaw' mangled-name='_Py_HashPointerRaw' filepath='./Include/pyhash.h' line='13' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-type size-in-bits='64' id='type-id-726'>
+      <parameter type-id='type-id-725'/>
+      <parameter type-id='type-id-21'/>
+      <return type-id='type-id-723'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-736'>
+      <parameter type-id='type-id-725'/>
+      <parameter type-id='type-id-21'/>
+      <parameter type-id='type-id-21'/>
+      <parameter type-id='type-id-21'/>
+      <return type-id='type-id-9'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-730'>
+      <parameter type-id='type-id-21'/>
+      <parameter type-id='type-id-21'/>
+      <return type-id='type-id-9'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-728'>
+      <parameter type-id='type-id-21'/>
+      <return type-id='type-id-722'/>
+    </function-type>
+    <function-type size-in-bits='64' id='type-id-734'>
+      <parameter type-id='type-id-157'/>
+      <return type-id='type-id-21'/>
+    </function-type>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/import.c' comp-dir-path='/src' language='LANG_C99'>
+    <class-decl name='_inittab' size-in-bits='128' is-struct='yes' visibility='default' filepath='./Include/cpython/import.h' line='27' column='1' id='type-id-741'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='name' type-id='type-id-3' visibility='default' filepath='./Include/cpython/import.h' line='28' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='initfunc' type-id='type-id-462' visibility='default' filepath='./Include/cpython/import.h' line='29' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-741' size-in-bits='64' id='type-id-742'/>
+    <var-decl name='PyImport_Inittab' type-id='type-id-742' mangled-name='PyImport_Inittab' visibility='default' filepath='./Include/cpython/import.h' line='31' column='1' elf-symbol-id='PyImport_Inittab'/>
+    <function-decl name='PyImport_AppendInittab' mangled-name='PyImport_AppendInittab' filepath='Python/import.c' line='2285' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyImport_AppendInittab'>
+      <parameter type-id='type-id-3' name='name' filepath='Python/import.c' line='2285' column='1'/>
+      <parameter type-id='type-id-462' name='initfunc' filepath='Python/import.c' line='2285' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyImport_ExtendInittab' mangled-name='PyImport_ExtendInittab' filepath='Python/import.c' line='2239' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyImport_ExtendInittab'>
+      <parameter type-id='type-id-742' name='newtab' filepath='Python/import.c' line='2239' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyInit__imp' mangled-name='PyInit__imp' filepath='Python/import.c' line='2178' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInit__imp'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyImport_Import' mangled-name='PyImport_Import' filepath='Python/import.c' line='1765' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyImport_Import'>
+      <parameter type-id='type-id-16' name='module_name' filepath='Python/import.c' line='1765' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyImport_ReloadModule' mangled-name='PyImport_ReloadModule' filepath='Python/import.c' line='1732' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyImport_ReloadModule'>
+      <parameter type-id='type-id-16' name='m' filepath='Python/import.c' line='1732' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyImport_ImportModuleLevel' mangled-name='PyImport_ImportModuleLevel' filepath='Python/import.c' line='1714' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyImport_ImportModuleLevel'>
+      <parameter type-id='type-id-3' name='name' filepath='Python/import.c' line='1714' column='1'/>
+      <parameter type-id='type-id-16' name='globals' filepath='Python/import.c' line='1714' column='1'/>
+      <parameter type-id='type-id-16' name='locals' filepath='Python/import.c' line='1714' column='1'/>
+      <parameter type-id='type-id-16' name='fromlist' filepath='Python/import.c' line='1715' column='1'/>
+      <parameter type-id='type-id-9' name='level' filepath='Python/import.c' line='1715' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyImport_ImportModuleLevelObject' mangled-name='PyImport_ImportModuleLevelObject' filepath='Python/import.c' line='1562' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyImport_ImportModuleLevelObject'>
+      <parameter type-id='type-id-16' name='name' filepath='Python/import.c' line='1562' column='1'/>
+      <parameter type-id='type-id-16' name='globals' filepath='Python/import.c' line='1562' column='1'/>
+      <parameter type-id='type-id-16' name='locals' filepath='Python/import.c' line='1563' column='1'/>
+      <parameter type-id='type-id-16' name='fromlist' filepath='Python/import.c' line='1563' column='1'/>
+      <parameter type-id='type-id-9' name='level' filepath='Python/import.c' line='1564' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyImport_GetModule' mangled-name='PyImport_GetModule' filepath='Python/import.c' line='1545' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyImport_GetModule'>
+      <parameter type-id='type-id-16' name='v' filepath='Objects/abstract.c' line='2129' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyImport_ImportModuleNoBlock' mangled-name='PyImport_ImportModuleNoBlock' filepath='Python/import.c' line='1250' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyImport_ImportModuleNoBlock'>
+      <parameter type-id='type-id-3' name='name' filepath='Python/import.c' line='1250' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyImport_ImportModule' mangled-name='PyImport_ImportModule' filepath='Python/import.c' line='1226' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyImport_ImportModule'>
+      <parameter type-id='type-id-3' name='utf8path' filepath='Objects/fileobject.c' line='562' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyImport_ImportFrozenModule' mangled-name='PyImport_ImportFrozenModule' filepath='Python/import.c' line='1209' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyImport_ImportFrozenModule'>
+      <parameter type-id='type-id-3' name='name' filepath='Python/import.c' line='1209' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyImport_ImportFrozenModuleObject' mangled-name='PyImport_ImportFrozenModuleObject' filepath='Python/import.c' line='1140' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyImport_ImportFrozenModuleObject'>
+      <parameter type-id='type-id-16' name='name' filepath='Python/import.c' line='1140' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyImport_GetImporter' mangled-name='PyImport_GetImporter' filepath='Python/import.c' line='985' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyImport_GetImporter'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='2827' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyImport_ExecCodeModuleObject' mangled-name='PyImport_ExecCodeModuleObject' filepath='Python/import.c' line='811' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyImport_ExecCodeModuleObject'>
+      <parameter type-id='type-id-16' name='name' filepath='Python/import.c' line='811' column='1'/>
+      <parameter type-id='type-id-16' name='co' filepath='Python/import.c' line='811' column='1'/>
+      <parameter type-id='type-id-16' name='pathname' filepath='Python/import.c' line='811' column='1'/>
+      <parameter type-id='type-id-16' name='cpathname' filepath='Python/import.c' line='812' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyImport_ExecCodeModuleWithPathnames' mangled-name='PyImport_ExecCodeModuleWithPathnames' filepath='Python/import.c' line='706' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyImport_ExecCodeModuleWithPathnames'>
+      <parameter type-id='type-id-3' name='name' filepath='Python/import.c' line='706' column='1'/>
+      <parameter type-id='type-id-16' name='co' filepath='Python/import.c' line='706' column='1'/>
+      <parameter type-id='type-id-3' name='pathname' filepath='Python/import.c' line='707' column='1'/>
+      <parameter type-id='type-id-3' name='cpathname' filepath='Python/import.c' line='708' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyImport_ExecCodeModuleEx' mangled-name='PyImport_ExecCodeModuleEx' filepath='Python/import.c' line='699' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyImport_ExecCodeModuleEx'>
+      <parameter type-id='type-id-3' name='name' filepath='Python/import.c' line='699' column='1'/>
+      <parameter type-id='type-id-16' name='co' filepath='Python/import.c' line='699' column='1'/>
+      <parameter type-id='type-id-3' name='pathname' filepath='Python/import.c' line='699' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyImport_ExecCodeModule' mangled-name='PyImport_ExecCodeModule' filepath='Python/import.c' line='692' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyImport_ExecCodeModule'>
+      <parameter type-id='type-id-3' name='name' filepath='Python/import.c' line='692' column='1'/>
+      <parameter type-id='type-id-16' name='co' filepath='Python/import.c' line='692' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyImport_AddModule' mangled-name='PyImport_AddModule' filepath='Python/import.c' line='643' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyImport_AddModule'>
+      <parameter type-id='type-id-3' name='utf8path' filepath='Objects/fileobject.c' line='562' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyImport_AddModuleObject' mangled-name='PyImport_AddModuleObject' filepath='Python/import.c' line='625' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyImport_AddModuleObject'>
+      <parameter type-id='type-id-16' name='name' filepath='Python/import.c' line='625' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyImport_FindExtensionObject' mangled-name='_PyImport_FindExtensionObject' filepath='Python/import.c' line='562' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyImport_FindExtensionObject'>
+      <parameter type-id='type-id-16' name='name' filepath='Python/import.c' line='562' column='1'/>
+      <parameter type-id='type-id-16' name='filename' filepath='Python/import.c' line='562' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyImport_FixupBuiltin' mangled-name='_PyImport_FixupBuiltin' filepath='Python/import.c' line='486' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyImport_FixupBuiltin'>
+      <parameter type-id='type-id-16' name='mod' filepath='Python/import.c' line='486' column='1'/>
+      <parameter type-id='type-id-3' name='name' filepath='Python/import.c' line='486' column='1'/>
+      <parameter type-id='type-id-16' name='modules' filepath='Python/import.c' line='486' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyImport_FixupExtensionObject' mangled-name='_PyImport_FixupExtensionObject' filepath='Python/import.c' line='421' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyImport_FixupExtensionObject'>
+      <parameter type-id='type-id-16' name='mod' filepath='Python/import.c' line='421' column='1'/>
+      <parameter type-id='type-id-16' name='name' filepath='Python/import.c' line='421' column='1'/>
+      <parameter type-id='type-id-16' name='filename' filepath='Python/import.c' line='422' column='1'/>
+      <parameter type-id='type-id-16' name='modules' filepath='Python/import.c' line='422' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyImport_GetMagicTag' mangled-name='PyImport_GetMagicTag' filepath='Python/import.c' line='398' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyImport_GetMagicTag'>
+      <return type-id='type-id-3'/>
+    </function-decl>
+    <function-decl name='PyImport_GetMagicNumber' mangled-name='PyImport_GetMagicNumber' filepath='Python/import.c' line='376' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyImport_GetMagicNumber'>
+      <return type-id='type-id-33'/>
+    </function-decl>
+    <function-decl name='_PyImport_SetModuleString' mangled-name='_PyImport_SetModuleString' filepath='Python/import.c' line='311' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyImport_SetModuleString'>
+      <parameter type-id='type-id-3' name='name' filepath='Python/import.c' line='311' column='1'/>
+      <parameter type-id='type-id-16' name='m' filepath='Python/import.c' line='311' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyImport_SetModule' mangled-name='_PyImport_SetModule' filepath='Python/import.c' line='303' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyImport_SetModule'>
+      <parameter type-id='type-id-16' name='name' filepath='Python/import.c' line='303' column='1'/>
+      <parameter type-id='type-id-16' name='m' filepath='Python/import.c' line='303' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyImport_GetModuleId' mangled-name='_PyImport_GetModuleId' filepath='Python/import.c' line='293' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyImport_GetModuleId'>
+      <parameter type-id='type-id-219' name='nameid' filepath='Python/import.c' line='293' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyImport_IsInitialized' mangled-name='_PyImport_IsInitialized' filepath='Python/import.c' line='285' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyImport_IsInitialized'>
+      <parameter type-id='type-id-222' name='interp' filepath='Python/import.c' line='285' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyImport_GetModuleDict' mangled-name='PyImport_GetModuleDict' filepath='Python/import.c' line='271' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyImport_GetModuleDict'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyImport_ReleaseLock' mangled-name='_PyImport_ReleaseLock' filepath='Python/import.c' line='145' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyImport_ReleaseLock'>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyImport_AcquireLock' mangled-name='_PyImport_AcquireLock' filepath='Python/import.c' line='118' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyImport_AcquireLock'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyMem_SetDefaultAllocator' mangled-name='_PyMem_SetDefaultAllocator' filepath='./Include/internal/pycore_pymem.h' line='17' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyMem_SetAllocator' mangled-name='PyMem_SetAllocator' filepath='./Include/cpython/pymem.h' line='79' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyModule_GetDef' mangled-name='PyModule_GetDef' filepath='./Include/moduleobject.h' line='35' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyModule_GetState' mangled-name='PyModule_GetState' filepath='./Include/moduleobject.h' line='36' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyModule_ExecDef' mangled-name='PyModule_ExecDef' filepath='./Include/modsupport.h' line='161' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyNamespace_New' mangled-name='_PyNamespace_New' filepath='./Include/namespaceobject.h' line='13' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_FromWideChar' mangled-name='PyUnicode_FromWideChar' filepath='./Include/unicodeobject.h' line='285' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTime_GetPerfCounter' mangled-name='_PyTime_GetPerfCounter' filepath='./Include/cpython/pytime.h' line='230' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTime_AsMicroseconds' mangled-name='_PyTime_AsMicroseconds' filepath='./Include/cpython/pytime.h' line='111' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyMarshal_ReadObjectFromString' mangled-name='PyMarshal_ReadObjectFromString' filepath='./Include/marshal.h' line='22' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyDict_Pop' mangled-name='_PyDict_Pop' filepath='./Include/cpython/dictobject.h' line='56' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyWeakref_GetObject' mangled-name='PyWeakref_GetObject' filepath='./Include/weakrefobject.h' line='62' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyModule_NewObject' mangled-name='PyModule_NewObject' filepath='./Include/moduleobject.h' line='16' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyState_AddModule' mangled-name='_PyState_AddModule' filepath='./Include/internal/pycore_pystate.h' line='142' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyList_Insert' mangled-name='PyList_Insert' filepath='./Include/listobject.h' line='33' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_KeyedHash' mangled-name='_Py_KeyedHash' filepath='./Include/internal/pycore_pyhash.h' line='8' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyImport_LoadDynamicModuleWithSpec' mangled-name='_PyImport_LoadDynamicModuleWithSpec' filepath='Python/importdl.h' line='11' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyModule_FromDefAndSpec2' mangled-name='PyModule_FromDefAndSpec2' filepath='./Include/modsupport.h' line='243' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='./Python/importdl.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='_PyObject_CallMethodId' mangled-name='_PyObject_CallMethodId' filepath='./Include/cpython/abstract.h' line='210' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_EncodeFSDefault' mangled-name='PyUnicode_EncodeFSDefault' filepath='./Include/unicodeobject.h' line='807' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyImport_FindSharedFuncptr' mangled-name='_PyImport_FindSharedFuncptr' filepath='./Python/importdl.c' line='21' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyImport_GetModuleDict' mangled-name='PyImport_GetModuleDict' filepath='./Include/import.h' line='34' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyImport_FixupExtensionObject' mangled-name='_PyImport_FixupExtensionObject' filepath='./Include/cpython/import.h' line='24' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='./Python/initconfig.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='Py_UTF8Mode' type-id='type-id-9' mangled-name='Py_UTF8Mode' visibility='default' filepath='./Include/fileobject.h' line='29' column='1' elf-symbol-id='Py_UTF8Mode'/>
+    <var-decl name='Py_DebugFlag' type-id='type-id-9' mangled-name='Py_DebugFlag' visibility='default' filepath='./Include/cpython/pydebug.h' line='8' column='1' elf-symbol-id='Py_DebugFlag'/>
+    <var-decl name='Py_VerboseFlag' type-id='type-id-9' mangled-name='Py_VerboseFlag' visibility='default' filepath='./Include/cpython/pydebug.h' line='9' column='1' elf-symbol-id='Py_VerboseFlag'/>
+    <var-decl name='Py_QuietFlag' type-id='type-id-9' mangled-name='Py_QuietFlag' visibility='default' filepath='./Include/cpython/pydebug.h' line='10' column='1' elf-symbol-id='Py_QuietFlag'/>
+    <var-decl name='Py_InteractiveFlag' type-id='type-id-9' mangled-name='Py_InteractiveFlag' visibility='default' filepath='./Include/cpython/pydebug.h' line='11' column='1' elf-symbol-id='Py_InteractiveFlag'/>
+    <var-decl name='Py_InspectFlag' type-id='type-id-9' mangled-name='Py_InspectFlag' visibility='default' filepath='./Include/cpython/pydebug.h' line='12' column='1' elf-symbol-id='Py_InspectFlag'/>
+    <var-decl name='Py_OptimizeFlag' type-id='type-id-9' mangled-name='Py_OptimizeFlag' visibility='default' filepath='./Include/cpython/pydebug.h' line='13' column='1' elf-symbol-id='Py_OptimizeFlag'/>
+    <var-decl name='Py_NoSiteFlag' type-id='type-id-9' mangled-name='Py_NoSiteFlag' visibility='default' filepath='./Include/cpython/pydebug.h' line='14' column='1' elf-symbol-id='Py_NoSiteFlag'/>
+    <var-decl name='Py_BytesWarningFlag' type-id='type-id-9' mangled-name='Py_BytesWarningFlag' visibility='default' filepath='./Include/cpython/pydebug.h' line='15' column='1' elf-symbol-id='Py_BytesWarningFlag'/>
+    <var-decl name='Py_FrozenFlag' type-id='type-id-9' mangled-name='Py_FrozenFlag' visibility='default' filepath='./Include/cpython/pydebug.h' line='16' column='1' elf-symbol-id='Py_FrozenFlag'/>
+    <var-decl name='Py_IgnoreEnvironmentFlag' type-id='type-id-9' mangled-name='Py_IgnoreEnvironmentFlag' visibility='default' filepath='./Include/cpython/pydebug.h' line='17' column='1' elf-symbol-id='Py_IgnoreEnvironmentFlag'/>
+    <var-decl name='Py_DontWriteBytecodeFlag' type-id='type-id-9' mangled-name='Py_DontWriteBytecodeFlag' visibility='default' filepath='./Include/cpython/pydebug.h' line='18' column='1' elf-symbol-id='Py_DontWriteBytecodeFlag'/>
+    <var-decl name='Py_NoUserSiteDirectory' type-id='type-id-9' mangled-name='Py_NoUserSiteDirectory' visibility='default' filepath='./Include/cpython/pydebug.h' line='19' column='1' elf-symbol-id='Py_NoUserSiteDirectory'/>
+    <var-decl name='Py_UnbufferedStdioFlag' type-id='type-id-9' mangled-name='Py_UnbufferedStdioFlag' visibility='default' filepath='./Include/cpython/pydebug.h' line='20' column='1' elf-symbol-id='Py_UnbufferedStdioFlag'/>
+    <var-decl name='Py_HashRandomizationFlag' type-id='type-id-9' mangled-name='Py_HashRandomizationFlag' visibility='default' filepath='./Include/cpython/pydebug.h' line='21' column='1' elf-symbol-id='Py_HashRandomizationFlag'/>
+    <var-decl name='Py_IsolatedFlag' type-id='type-id-9' mangled-name='Py_IsolatedFlag' visibility='default' filepath='./Include/cpython/pydebug.h' line='22' column='1' elf-symbol-id='Py_IsolatedFlag'/>
+    <function-decl name='_Py_GetConfigsAsDict' mangled-name='_Py_GetConfigsAsDict' filepath='./Python/initconfig.c' line='2898' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_GetConfigsAsDict'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='256' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-743' visibility='default' filepath='./Include/cpython/initconfig.h' line='10' column='1' id='type-id-744'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='_type' type-id='type-id-745' visibility='default' filepath='./Include/cpython/initconfig.h' line='15' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='func' type-id='type-id-3' visibility='default' filepath='./Include/cpython/initconfig.h' line='16' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='err_msg' type-id='type-id-3' visibility='default' filepath='./Include/cpython/initconfig.h' line='17' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='exitcode' type-id='type-id-9' visibility='default' filepath='./Include/cpython/initconfig.h' line='18' column='1'/>
+      </data-member>
+    </class-decl>
+    <enum-decl name='__anonymous_enum__' is-anonymous='yes' filepath='./Include/cpython/initconfig.h' line='11' column='1' id='type-id-745'>
+      <underlying-type type-id='type-id-83'/>
+      <enumerator name='_PyStatus_TYPE_OK' value='0'/>
+      <enumerator name='_PyStatus_TYPE_ERROR' value='1'/>
+      <enumerator name='_PyStatus_TYPE_EXIT' value='2'/>
+    </enum-decl>
+    <typedef-decl name='PyStatus' type-id='type-id-744' filepath='./Include/cpython/initconfig.h' line='19' column='1' id='type-id-743'/>
+    <pointer-type-def type-id='type-id-231' size-in-bits='64' id='type-id-746'/>
+    <function-decl name='PyConfig_Read' mangled-name='PyConfig_Read' filepath='./Python/initconfig.c' line='2891' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyConfig_Read'>
+      <parameter type-id='type-id-746' name='config' filepath='./Python/initconfig.c' line='2891' column='1'/>
+      <return type-id='type-id-743'/>
+    </function-decl>
+    <pointer-type-def type-id='type-id-326' size-in-bits='64' id='type-id-747'/>
+    <function-decl name='PyConfig_SetWideStringList' mangled-name='PyConfig_SetWideStringList' filepath='./Python/initconfig.c' line='2808' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyConfig_SetWideStringList'>
+      <parameter type-id='type-id-746' name='config' filepath='./Python/initconfig.c' line='2808' column='1'/>
+      <parameter type-id='type-id-747' name='list' filepath='./Python/initconfig.c' line='2808' column='1'/>
+      <parameter type-id='type-id-31' name='length' filepath='./Python/initconfig.c' line='2809' column='1'/>
+      <parameter type-id='type-id-329' name='items' filepath='./Python/initconfig.c' line='2809' column='1'/>
+      <return type-id='type-id-743'/>
+    </function-decl>
+    <qualified-type-def type-id='type-id-325' const='yes' id='type-id-748'/>
+    <pointer-type-def type-id='type-id-748' size-in-bits='64' id='type-id-749'/>
+    <function-decl name='PyConfig_SetArgv' mangled-name='PyConfig_SetArgv' filepath='./Python/initconfig.c' line='2796' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyConfig_SetArgv'>
+      <parameter type-id='type-id-746' name='config' filepath='./Python/initconfig.c' line='2796' column='1'/>
+      <parameter type-id='type-id-31' name='argc' filepath='./Python/initconfig.c' line='2796' column='1'/>
+      <parameter type-id='type-id-749' name='argv' filepath='./Python/initconfig.c' line='2796' column='1'/>
+      <return type-id='type-id-743'/>
+    </function-decl>
+    <function-decl name='PyConfig_SetBytesArgv' mangled-name='PyConfig_SetBytesArgv' filepath='./Python/initconfig.c' line='2784' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyConfig_SetBytesArgv'>
+      <parameter type-id='type-id-746' name='config' filepath='./Python/initconfig.c' line='2784' column='1'/>
+      <parameter type-id='type-id-31' name='argc' filepath='./Python/initconfig.c' line='2784' column='1'/>
+      <parameter type-id='type-id-192' name='argv' filepath='./Python/initconfig.c' line='2784' column='1'/>
+      <return type-id='type-id-743'/>
+    </function-decl>
+    <function-decl name='_PyConfig_FromDict' mangled-name='_PyConfig_FromDict' filepath='./Python/initconfig.c' line='1211' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyConfig_FromDict'>
+      <parameter type-id='type-id-746' name='config' filepath='./Python/initconfig.c' line='1211' column='1'/>
+      <parameter type-id='type-id-16' name='dict' filepath='./Python/initconfig.c' line='1211' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <qualified-type-def type-id='type-id-231' const='yes' id='type-id-750'/>
+    <pointer-type-def type-id='type-id-750' size-in-bits='64' id='type-id-751'/>
+    <function-decl name='_PyConfig_AsDict' mangled-name='_PyConfig_AsDict' filepath='./Python/initconfig.c' line='949' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyConfig_AsDict'>
+      <parameter type-id='type-id-751' name='config' filepath='./Python/initconfig.c' line='949' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyConfig_SetBytesString' mangled-name='PyConfig_SetBytesString' filepath='./Python/initconfig.c' line='847' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyConfig_SetBytesString'>
+      <parameter type-id='type-id-746' name='config' filepath='./Python/initconfig.c' line='847' column='1'/>
+      <parameter type-id='type-id-329' name='config_str' filepath='./Python/initconfig.c' line='847' column='1'/>
+      <parameter type-id='type-id-3' name='str' filepath='./Python/initconfig.c' line='848' column='1'/>
+      <return type-id='type-id-743'/>
+    </function-decl>
+    <function-decl name='PyConfig_InitIsolatedConfig' mangled-name='PyConfig_InitIsolatedConfig' filepath='./Python/initconfig.c' line='763' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyConfig_InitIsolatedConfig'>
+      <parameter type-id='type-id-746' name='config' filepath='./Python/initconfig.c' line='763' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyConfig_InitPythonConfig' mangled-name='PyConfig_InitPythonConfig' filepath='./Python/initconfig.c' line='752' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyConfig_InitPythonConfig'>
+      <parameter type-id='type-id-746' name='config' filepath='./Python/initconfig.c' line='763' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyConfig_InitCompatConfig' mangled-name='_PyConfig_InitCompatConfig' filepath='./Python/initconfig.c' line='688' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyConfig_InitCompatConfig'>
+      <parameter type-id='type-id-746' name='config' filepath='./Python/initconfig.c' line='763' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyConfig_Clear' mangled-name='PyConfig_Clear' filepath='./Python/initconfig.c' line='646' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyConfig_Clear'>
+      <parameter type-id='type-id-746' name='config' filepath='./Python/initconfig.c' line='646' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <pointer-type-def type-id='type-id-329' size-in-bits='64' id='type-id-752'/>
+    <function-decl name='Py_GetArgcArgv' mangled-name='Py_GetArgcArgv' filepath='./Python/initconfig.c' line='569' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_GetArgcArgv'>
+      <parameter type-id='type-id-452' name='argc' filepath='./Python/initconfig.c' line='569' column='1'/>
+      <parameter type-id='type-id-752' name='argv' filepath='./Python/initconfig.c' line='569' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_ClearArgcArgv' mangled-name='_Py_ClearArgcArgv' filepath='./Python/initconfig.c' line='540' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_ClearArgcArgv'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_ClearStandardStreamEncoding' mangled-name='_Py_ClearStandardStreamEncoding' filepath='./Python/initconfig.c' line='513' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_ClearStandardStreamEncoding'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='Py_SetStandardStreamEncoding' mangled-name='Py_SetStandardStreamEncoding' filepath='./Python/initconfig.c' line='458' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_SetStandardStreamEncoding'>
+      <parameter type-id='type-id-3' name='encoding' filepath='./Python/initconfig.c' line='458' column='1'/>
+      <parameter type-id='type-id-3' name='errors' filepath='./Python/initconfig.c' line='458' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <qualified-type-def type-id='type-id-326' const='yes' id='type-id-753'/>
+    <pointer-type-def type-id='type-id-753' size-in-bits='64' id='type-id-754'/>
+    <function-decl name='_PyWideStringList_AsList' mangled-name='_PyWideStringList_AsList' filepath='./Python/initconfig.c' line='427' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyWideStringList_AsList'>
+      <parameter type-id='type-id-754' name='list' filepath='./Python/initconfig.c' line='427' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyWideStringList_Extend' mangled-name='_PyWideStringList_Extend' filepath='./Python/initconfig.c' line='402' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyWideStringList_Extend'>
+      <parameter type-id='type-id-747' name='list' filepath='./Python/initconfig.c' line='402' column='1'/>
+      <parameter type-id='type-id-754' name='list2' filepath='./Python/initconfig.c' line='402' column='1'/>
+      <return type-id='type-id-743'/>
+    </function-decl>
+    <function-decl name='PyWideStringList_Append' mangled-name='PyWideStringList_Append' filepath='./Python/initconfig.c' line='395' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyWideStringList_Append'>
+      <parameter type-id='type-id-747' name='list' filepath='./Python/initconfig.c' line='395' column='1'/>
+      <parameter type-id='type-id-478' name='item' filepath='./Python/initconfig.c' line='395' column='1'/>
+      <return type-id='type-id-743'/>
+    </function-decl>
+    <function-decl name='PyWideStringList_Insert' mangled-name='PyWideStringList_Insert' filepath='./Python/initconfig.c' line='354' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyWideStringList_Insert'>
+      <parameter type-id='type-id-747' name='list' filepath='./Python/initconfig.c' line='354' column='1'/>
+      <parameter type-id='type-id-31' name='index' filepath='./Python/initconfig.c' line='355' column='1'/>
+      <parameter type-id='type-id-478' name='item' filepath='./Python/initconfig.c' line='355' column='1'/>
+      <return type-id='type-id-743'/>
+    </function-decl>
+    <function-decl name='_PyWideStringList_Copy' mangled-name='_PyWideStringList_Copy' filepath='./Python/initconfig.c' line='319' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyWideStringList_Copy'>
+      <parameter type-id='type-id-747' name='list' filepath='./Python/initconfig.c' line='319' column='1'/>
+      <parameter type-id='type-id-754' name='list2' filepath='./Python/initconfig.c' line='319' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyWideStringList_Clear' mangled-name='_PyWideStringList_Clear' filepath='./Python/initconfig.c' line='306' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyWideStringList_Clear'>
+      <parameter type-id='type-id-747' name='list' filepath='./Python/initconfig.c' line='306' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyStatus_Exception' mangled-name='PyStatus_Exception' filepath='./Python/initconfig.c' line='266' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyStatus_Exception'>
+      <parameter type-id='type-id-743' name='status' filepath='./Python/initconfig.c' line='266' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyStatus_IsExit' mangled-name='PyStatus_IsExit' filepath='./Python/initconfig.c' line='263' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyStatus_IsExit'>
+      <parameter type-id='type-id-743' name='status' filepath='./Python/initconfig.c' line='266' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyStatus_IsError' mangled-name='PyStatus_IsError' filepath='./Python/initconfig.c' line='260' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyStatus_IsError'>
+      <parameter type-id='type-id-743' name='status' filepath='./Python/initconfig.c' line='266' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyStatus_Exit' mangled-name='PyStatus_Exit' filepath='./Python/initconfig.c' line='256' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyStatus_Exit'>
+      <parameter type-id='type-id-9' name='exitcode' filepath='./Python/initconfig.c' line='256' column='1'/>
+      <return type-id='type-id-743'/>
+    </function-decl>
+    <function-decl name='PyStatus_NoMemory' mangled-name='PyStatus_NoMemory' filepath='./Python/initconfig.c' line='253' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyStatus_NoMemory'>
+      <return type-id='type-id-743'/>
+    </function-decl>
+    <function-decl name='PyStatus_Error' mangled-name='PyStatus_Error' filepath='./Python/initconfig.c' line='246' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyStatus_Error'>
+      <parameter type-id='type-id-3' name='err_msg' filepath='./Python/initconfig.c' line='246' column='1'/>
+      <return type-id='type-id-743'/>
+    </function-decl>
+    <function-decl name='PyStatus_Ok' mangled-name='PyStatus_Ok' filepath='./Python/initconfig.c' line='243' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyStatus_Ok'>
+      <return type-id='type-id-743'/>
+    </function-decl>
+    <function-decl name='PyConfig_SetString' mangled-name='PyConfig_SetString' filepath='./Python/initconfig.c' line='785' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyConfig_SetString'>
+      <parameter type-id='type-id-746' name='config' filepath='./Python/initconfig.c' line='785' column='1'/>
+      <parameter type-id='type-id-329' name='config_str' filepath='./Python/initconfig.c' line='785' column='1'/>
+      <parameter type-id='type-id-478' name='str' filepath='./Python/initconfig.c' line='785' column='1'/>
+      <return type-id='type-id-743'/>
+    </function-decl>
+    <function-decl name='_PyPreConfig_AsDict' mangled-name='_PyPreConfig_AsDict' filepath='./Include/internal/pycore_initconfig.h' line='134' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPathConfig_AsDict' mangled-name='_PyPathConfig_AsDict' filepath='./Include/internal/pycore_pathconfig.h' line='68' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPreConfig_InitFromPreConfig' mangled-name='_PyPreConfig_InitFromPreConfig' filepath='./Include/internal/pycore_initconfig.h' line='131' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPreConfig_GetConfig' mangled-name='_PyPreConfig_GetConfig' filepath='./Include/internal/pycore_initconfig.h' line='135' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPreCmdline_Read' mangled-name='_PyPreCmdline_Read' filepath='./Include/internal/pycore_initconfig.h' line='121' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPreCmdline_SetConfig' mangled-name='_PyPreCmdline_SetConfig' filepath='./Include/internal/pycore_initconfig.h' line='118' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_PreInitializeFromConfig' mangled-name='_Py_PreInitializeFromConfig' filepath='./Include/internal/pycore_pylifecycle.h' line='121' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPreCmdline_Clear' mangled-name='_PyPreCmdline_Clear' filepath='./Include/internal/pycore_initconfig.h' line='115' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PySys_ReadPreinitXOptions' mangled-name='_PySys_ReadPreinitXOptions' filepath='./Include/internal/pycore_pylifecycle.h' line='66' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyArgv_AsWstrList' mangled-name='_PyArgv_AsWstrList' filepath='./Include/internal/pycore_initconfig.h' line='73' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyOS_GetOpt' mangled-name='_PyOS_GetOpt' filepath='./Include/internal/pycore_getopt.h' line='20' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__printf_chk' mangled-name='__printf_chk' filepath='/usr/include/x86_64-linux-gnu/bits/stdio2.h' line='90' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyOS_ResetGetOpt' mangled-name='_PyOS_ResetGetOpt' filepath='./Include/internal/pycore_getopt.h' line='12' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_isabs' mangled-name='_Py_isabs' filepath='./Include/cpython/fileutils.h' line='139' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_abspath' mangled-name='_Py_abspath' filepath='./Include/cpython/fileutils.h' line='142' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='wcstok' mangled-name='wcstok' filepath='/usr/include/wchar.h' line='217' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PySys_ReadPreinitWarnOptions' mangled-name='_PySys_ReadPreinitWarnOptions' filepath='./Include/internal/pycore_pylifecycle.h' line='65' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='setvbuf' mangled-name='setvbuf' filepath='/usr/include/stdio.h' line='308' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_GetEnv' mangled-name='_Py_GetEnv' filepath='./Include/internal/pycore_initconfig.h' line='85' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='strtoul' mangled-name='strtoul' filepath='/usr/include/stdlib.h' line='180' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_get_env_flag' mangled-name='_Py_get_env_flag' filepath='./Include/internal/pycore_initconfig.h' line='88' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_get_xoption' mangled-name='_Py_get_xoption' filepath='./Include/internal/pycore_initconfig.h' line='82' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='wcstol' mangled-name='wcstol' filepath='/usr/include/wchar.h' line='428' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='wcschr' mangled-name='wcschr' filepath='/usr/include/wchar.h' line='164' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_str_to_int' mangled-name='_Py_str_to_int' filepath='./Include/internal/pycore_initconfig.h' line='79' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_IsLocaleCoercionTarget' mangled-name='_Py_IsLocaleCoercionTarget' filepath='./Include/internal/pycore_pylifecycle.h' line='48' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_GetLocaleEncoding' mangled-name='_Py_GetLocaleEncoding' filepath='./Include/internal/pycore_fileutils.h' line='53' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_GetForceASCII' mangled-name='_Py_GetForceASCII' filepath='./Include/internal/pycore_fileutils.h' line='36' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyConfig_InitPathConfig' mangled-name='_PyConfig_InitPathConfig' filepath='./Include/internal/pycore_initconfig.h' line='155' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_AsWideCharString' mangled-name='PyUnicode_AsWideCharString' filepath='./Include/unicodeobject.h' line='316' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/marshal.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='PyMarshal_Init' mangled-name='PyMarshal_Init' filepath='Python/marshal.c' line='1821' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMarshal_Init'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyMarshal_WriteObjectToString' mangled-name='PyMarshal_WriteObjectToString' filepath='Python/marshal.c' line='1570' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMarshal_WriteObjectToString'>
+      <parameter type-id='type-id-16' name='x' filepath='Python/marshal.c' line='1570' column='1'/>
+      <parameter type-id='type-id-9' name='version' filepath='Python/marshal.c' line='1570' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyMarshal_ReadObjectFromString' mangled-name='PyMarshal_ReadObjectFromString' filepath='Python/marshal.c' line='1549' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMarshal_ReadObjectFromString'>
+      <parameter type-id='type-id-3' name='str' filepath='Python/marshal.c' line='1549' column='1'/>
+      <parameter type-id='type-id-31' name='len' filepath='Python/marshal.c' line='1549' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyMarshal_ReadObjectFromFile' mangled-name='PyMarshal_ReadObjectFromFile' filepath='Python/marshal.c' line='1529' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMarshal_ReadObjectFromFile'>
+      <parameter type-id='type-id-188' name='fp' filepath='Python/marshal.c' line='1529' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyMarshal_ReadLastObjectFromFile' mangled-name='PyMarshal_ReadLastObjectFromFile' filepath='Python/marshal.c' line='1504' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMarshal_ReadLastObjectFromFile'>
+      <parameter type-id='type-id-188' name='fp' filepath='Python/marshal.c' line='1504' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyMarshal_ReadLongFromFile' mangled-name='PyMarshal_ReadLongFromFile' filepath='Python/marshal.c' line='1468' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMarshal_ReadLongFromFile'>
+      <parameter type-id='type-id-188' name='fp' filepath='Python/marshal.c' line='1468' column='1'/>
+      <return type-id='type-id-33'/>
+    </function-decl>
+    <function-decl name='PyMarshal_ReadShortFromFile' mangled-name='PyMarshal_ReadShortFromFile' filepath='Python/marshal.c' line='1452' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMarshal_ReadShortFromFile'>
+      <parameter type-id='type-id-188' name='fp' filepath='Python/marshal.c' line='1452' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyMarshal_WriteObjectToFile' mangled-name='PyMarshal_WriteObjectToFile' filepath='Python/marshal.c' line='595' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMarshal_WriteObjectToFile'>
+      <parameter type-id='type-id-16' name='x' filepath='Python/marshal.c' line='595' column='1'/>
+      <parameter type-id='type-id-188' name='fp' filepath='Python/marshal.c' line='595' column='1'/>
+      <parameter type-id='type-id-9' name='version' filepath='Python/marshal.c' line='595' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyMarshal_WriteLongToFile' mangled-name='PyMarshal_WriteLongToFile' filepath='Python/marshal.c' line='580' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMarshal_WriteLongToFile'>
+      <parameter type-id='type-id-33' name='x' filepath='Python/marshal.c' line='580' column='1'/>
+      <parameter type-id='type-id-188' name='fp' filepath='Python/marshal.c' line='580' column='1'/>
+      <parameter type-id='type-id-9' name='version' filepath='Python/marshal.c' line='580' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_hashtable_new_full' mangled-name='_Py_hashtable_new_full' filepath='./Include/internal/pycore_hashtable.h' line='85' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_hashtable_set' mangled-name='_Py_hashtable_set' filepath='./Include/internal/pycore_hashtable.h' line='112' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_hashtable_destroy' mangled-name='_Py_hashtable_destroy' filepath='./Include/internal/pycore_hashtable.h' line='92' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__fread_alias' mangled-name='fread' filepath='/usr/include/x86_64-linux-gnu/bits/stdio2.h' line='271' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_fstat_noraise' mangled-name='_Py_fstat_noraise' filepath='./Include/cpython/fileutils.h' line='81' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyFloat_Unpack8' mangled-name='_PyFloat_Unpack8' filepath='./Include/floatobject.h' line='101' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyLong_FromByteArray' mangled-name='_PyLong_FromByteArray' filepath='./Include/longobject.h' line='147' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyLong_New' mangled-name='_PyLong_New' filepath='./Include/longintrepr.h' line='90' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyFloat_Pack8' mangled-name='_PyFloat_Pack8' filepath='./Include/floatobject.h' line='89' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyComplex_RealAsDouble' mangled-name='PyComplex_RealAsDouble' filepath='./Include/complexobject.h' line='49' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyComplex_ImagAsDouble' mangled-name='PyComplex_ImagAsDouble' filepath='./Include/complexobject.h' line='50' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/modsupport.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='_Py_PackageContext' type-id='type-id-3' mangled-name='_Py_PackageContext' visibility='default' filepath='./Include/modsupport.h' line='257' column='1' elf-symbol-id='_Py_PackageContext'/>
+    <function-decl name='PyModule_AddType' mangled-name='PyModule_AddType' filepath='Python/modsupport.c' line='704' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyModule_AddType'>
+      <parameter type-id='type-id-16' name='module' filepath='Python/modsupport.c' line='704' column='1'/>
+      <parameter type-id='type-id-32' name='type' filepath='Python/modsupport.c' line='704' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyModule_AddStringConstant' mangled-name='PyModule_AddStringConstant' filepath='Python/modsupport.c' line='692' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyModule_AddStringConstant'>
+      <parameter type-id='type-id-16' name='m' filepath='Python/modsupport.c' line='692' column='1'/>
+      <parameter type-id='type-id-3' name='name' filepath='Python/modsupport.c' line='692' column='1'/>
+      <parameter type-id='type-id-3' name='value' filepath='Python/modsupport.c' line='692' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyModule_AddIntConstant' mangled-name='PyModule_AddIntConstant' filepath='Python/modsupport.c' line='680' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyModule_AddIntConstant'>
+      <parameter type-id='type-id-16' name='m' filepath='Python/modsupport.c' line='680' column='1'/>
+      <parameter type-id='type-id-3' name='name' filepath='Python/modsupport.c' line='680' column='1'/>
+      <parameter type-id='type-id-33' name='value' filepath='Python/modsupport.c' line='680' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyModule_AddObject' mangled-name='PyModule_AddObject' filepath='Python/modsupport.c' line='670' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyModule_AddObject'>
+      <parameter type-id='type-id-16' name='mod' filepath='Python/modsupport.c' line='670' column='1'/>
+      <parameter type-id='type-id-3' name='name' filepath='Python/modsupport.c' line='670' column='1'/>
+      <parameter type-id='type-id-16' name='value' filepath='Python/modsupport.c' line='670' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_Py_VaBuildStack_SizeT' mangled-name='_Py_VaBuildStack_SizeT' filepath='Python/modsupport.c' line='581' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_VaBuildStack_SizeT'>
+      <parameter type-id='type-id-86' name='small_stack' filepath='Python/modsupport.c' line='581' column='1'/>
+      <parameter type-id='type-id-31' name='small_stack_len' filepath='Python/modsupport.c' line='581' column='1'/>
+      <parameter type-id='type-id-3' name='format' filepath='Python/modsupport.c' line='582' column='1'/>
+      <parameter type-id='type-id-217' name='va' filepath='Python/modsupport.c' line='582' column='1'/>
+      <parameter type-id='type-id-125' name='p_nargs' filepath='Python/modsupport.c' line='582' column='1'/>
+      <return type-id='type-id-86'/>
+    </function-decl>
+    <function-decl name='_Py_VaBuildStack' mangled-name='_Py_VaBuildStack' filepath='Python/modsupport.c' line='574' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_VaBuildStack'>
+      <parameter type-id='type-id-86' name='small_stack' filepath='Python/modsupport.c' line='581' column='1'/>
+      <parameter type-id='type-id-31' name='small_stack_len' filepath='Python/modsupport.c' line='581' column='1'/>
+      <parameter type-id='type-id-3' name='format' filepath='Python/modsupport.c' line='582' column='1'/>
+      <parameter type-id='type-id-217' name='va' filepath='Python/modsupport.c' line='582' column='1'/>
+      <parameter type-id='type-id-125' name='p_nargs' filepath='Python/modsupport.c' line='582' column='1'/>
+      <return type-id='type-id-86'/>
+    </function-decl>
+    <function-decl name='_Py_VaBuildValue_SizeT' mangled-name='_Py_VaBuildValue_SizeT' filepath='Python/modsupport.c' line='545' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_VaBuildValue_SizeT'>
+      <parameter type-id='type-id-3' name='format' filepath='Python/modsupport.c' line='545' column='1'/>
+      <parameter type-id='type-id-217' name='va' filepath='Python/modsupport.c' line='545' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='Py_VaBuildValue' mangled-name='Py_VaBuildValue' filepath='Python/modsupport.c' line='539' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_VaBuildValue'>
+      <parameter type-id='type-id-3' name='format' filepath='Python/modsupport.c' line='545' column='1'/>
+      <parameter type-id='type-id-217' name='va' filepath='Python/modsupport.c' line='545' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_Py_BuildValue_SizeT' mangled-name='_Py_BuildValue_SizeT' filepath='Python/modsupport.c' line='528' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_BuildValue_SizeT'>
+      <parameter type-id='type-id-3' name='format' filepath='Objects/bytesobject.c' line='410' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='Py_BuildValue' mangled-name='Py_BuildValue' filepath='Python/modsupport.c' line='517' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_BuildValue'>
+      <parameter type-id='type-id-3' name='format' filepath='Objects/bytesobject.c' line='410' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_Py_convert_optional_to_ssize_t' mangled-name='_Py_convert_optional_to_ssize_t' filepath='Python/modsupport.c' line='18' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_convert_optional_to_ssize_t'>
+      <parameter type-id='type-id-16' name='obj' filepath='Python/modsupport.c' line='18' column='1'/>
+      <parameter type-id='type-id-21' name='result' filepath='Python/modsupport.c' line='18' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyModule_AddObjectRef' mangled-name='PyModule_AddObjectRef' filepath='Python/modsupport.c' line='637' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyModule_AddObjectRef'>
+      <parameter type-id='type-id-16' name='mod' filepath='Python/modsupport.c' line='637' column='1'/>
+      <parameter type-id='type-id-3' name='name' filepath='Python/modsupport.c' line='637' column='1'/>
+      <parameter type-id='type-id-16' name='value' filepath='Python/modsupport.c' line='637' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyModule_GetName' mangled-name='PyModule_GetName' filepath='./Include/moduleobject.h' line='27' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/mysnprintf.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='PyOS_vsnprintf' mangled-name='PyOS_vsnprintf' filepath='Python/mysnprintf.c' line='52' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyOS_vsnprintf'>
+      <parameter type-id='type-id-72' name='str' filepath='Python/mysnprintf.c' line='52' column='1'/>
+      <parameter type-id='type-id-157' name='size' filepath='Python/mysnprintf.c' line='52' column='1'/>
+      <parameter type-id='type-id-3' name='format' filepath='Python/mysnprintf.c' line='52' column='1'/>
+      <parameter type-id='type-id-217' name='va' filepath='Python/mysnprintf.c' line='52' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyOS_snprintf' mangled-name='PyOS_snprintf' filepath='Python/mysnprintf.c' line='40' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyOS_snprintf'>
+      <parameter type-id='type-id-72' name='str' filepath='Python/mysnprintf.c' line='40' column='1'/>
+      <parameter type-id='type-id-157' name='size' filepath='Python/mysnprintf.c' line='40' column='1'/>
+      <parameter type-id='type-id-3' name='format' filepath='Python/mysnprintf.c' line='40' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='__builtin___vsnprintf_chk' mangled-name='__vsnprintf_chk' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/mystrtoul.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='PyOS_strtol' mangled-name='PyOS_strtol' filepath='Python/mystrtoul.c' line='263' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyOS_strtol'>
+      <parameter type-id='type-id-3' name='str' filepath='Python/mystrtoul.c' line='263' column='1'/>
+      <parameter type-id='type-id-215' name='ptr' filepath='Python/mystrtoul.c' line='263' column='1'/>
+      <parameter type-id='type-id-9' name='base' filepath='Python/mystrtoul.c' line='263' column='1'/>
+      <return type-id='type-id-33'/>
+    </function-decl>
+    <function-decl name='PyOS_strtoul' mangled-name='PyOS_strtoul' filepath='Python/mystrtoul.c' line='95' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyOS_strtoul'>
+      <parameter type-id='type-id-3' name='str' filepath='Python/mystrtoul.c' line='95' column='1'/>
+      <parameter type-id='type-id-215' name='ptr' filepath='Python/mystrtoul.c' line='95' column='1'/>
+      <parameter type-id='type-id-9' name='base' filepath='Python/mystrtoul.c' line='95' column='1'/>
+      <return type-id='type-id-19'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/pathconfig.c' comp-dir-path='/src' language='LANG_C99'>
+    <class-decl name='_PyPathConfig' size-in-bits='384' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_pathconfig.h' line='11' column='1' id='type-id-755'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='program_full_path' type-id='type-id-325' visibility='default' filepath='./Include/internal/pycore_pathconfig.h' line='13' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='prefix' type-id='type-id-325' visibility='default' filepath='./Include/internal/pycore_pathconfig.h' line='14' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='exec_prefix' type-id='type-id-325' visibility='default' filepath='./Include/internal/pycore_pathconfig.h' line='15' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='module_search_path' type-id='type-id-325' visibility='default' filepath='./Include/internal/pycore_pathconfig.h' line='17' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='program_name' type-id='type-id-325' visibility='default' filepath='./Include/internal/pycore_pathconfig.h' line='19' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='home' type-id='type-id-325' visibility='default' filepath='./Include/internal/pycore_pathconfig.h' line='21' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='_PyPathConfig' type-id='type-id-755' filepath='./Include/internal/pycore_pathconfig.h' line='31' column='1' id='type-id-756'/>
+    <var-decl name='_Py_path_config' type-id='type-id-756' mangled-name='_Py_path_config' visibility='default' filepath='./Include/internal/pycore_pathconfig.h' line='44' column='1' elf-symbol-id='_Py_path_config'/>
+    <function-decl name='Py_GetProgramName' mangled-name='Py_GetProgramName' filepath='Python/pathconfig.c' line='604' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_GetProgramName'>
+      <return type-id='type-id-325'/>
+    </function-decl>
+    <function-decl name='Py_GetPythonHome' mangled-name='Py_GetPythonHome' filepath='Python/pathconfig.c' line='597' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_GetPythonHome'>
+      <return type-id='type-id-325'/>
+    </function-decl>
+    <function-decl name='Py_GetProgramFullPath' mangled-name='Py_GetProgramFullPath' filepath='Python/pathconfig.c' line='590' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_GetProgramFullPath'>
+      <return type-id='type-id-325'/>
+    </function-decl>
+    <function-decl name='Py_GetExecPrefix' mangled-name='Py_GetExecPrefix' filepath='Python/pathconfig.c' line='583' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_GetExecPrefix'>
+      <return type-id='type-id-325'/>
+    </function-decl>
+    <function-decl name='Py_GetPrefix' mangled-name='Py_GetPrefix' filepath='Python/pathconfig.c' line='576' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_GetPrefix'>
+      <return type-id='type-id-325'/>
+    </function-decl>
+    <function-decl name='Py_GetPath' mangled-name='Py_GetPath' filepath='Python/pathconfig.c' line='569' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_GetPath'>
+      <return type-id='type-id-325'/>
+    </function-decl>
+    <function-decl name='_Py_SetProgramFullPath' mangled-name='_Py_SetProgramFullPath' filepath='Python/pathconfig.c' line='548' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_SetProgramFullPath'>
+      <parameter type-id='type-id-478' name='program_full_path' filepath='Python/pathconfig.c' line='548' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='Py_SetProgramName' mangled-name='Py_SetProgramName' filepath='Python/pathconfig.c' line='528' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_SetProgramName'>
+      <parameter type-id='type-id-478' name='program_full_path' filepath='Python/pathconfig.c' line='548' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='Py_SetPythonHome' mangled-name='Py_SetPythonHome' filepath='Python/pathconfig.c' line='507' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_SetPythonHome'>
+      <parameter type-id='type-id-478' name='program_full_path' filepath='Python/pathconfig.c' line='548' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='Py_SetPath' mangled-name='Py_SetPath' filepath='Python/pathconfig.c' line='477' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_SetPath'>
+      <parameter type-id='type-id-478' name='path' filepath='Python/pathconfig.c' line='477' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_DecodeUTF8_surrogateescape' mangled-name='_Py_DecodeUTF8_surrogateescape' filepath='./Include/internal/pycore_fileutils.h' line='31' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__wcsncpy_alias' mangled-name='wcsncpy' filepath='/usr/include/x86_64-linux-gnu/bits/wchar2.h' line='179' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='wcsrchr' mangled-name='wcsrchr' filepath='/usr/include/wchar.h' line='174' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_wgetcwd' mangled-name='_Py_wgetcwd' filepath='./Include/cpython/fileutils.h' line='144' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_wreadlink' mangled-name='_Py_wreadlink' filepath='./Include/cpython/fileutils.h' line='121' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_wrealpath' mangled-name='_Py_wrealpath' filepath='./Include/cpython/fileutils.h' line='130' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPathConfig_Calculate' mangled-name='_PyPathConfig_Calculate' filepath='./Include/internal/pycore_pathconfig.h' line='51' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyWideStringList_Append' mangled-name='PyWideStringList_Append' filepath='./Include/cpython/initconfig.h' line='38' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyWideStringList_Clear' mangled-name='_PyWideStringList_Clear' filepath='./Include/internal/pycore_initconfig.h' line='56' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/preconfig.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='Py_FileSystemDefaultEncoding' type-id='type-id-3' mangled-name='Py_FileSystemDefaultEncoding' visibility='default' filepath='./Include/fileobject.h' line='22' column='1' elf-symbol-id='Py_FileSystemDefaultEncoding'/>
+    <var-decl name='Py_HasFileSystemDefaultEncoding' type-id='type-id-9' mangled-name='Py_HasFileSystemDefaultEncoding' visibility='default' filepath='./Include/fileobject.h' line='26' column='1' elf-symbol-id='Py_HasFileSystemDefaultEncoding'/>
+    <var-decl name='Py_FileSystemDefaultEncodeErrors' type-id='type-id-3' mangled-name='Py_FileSystemDefaultEncodeErrors' visibility='default' filepath='./Include/fileobject.h' line='24' column='1' elf-symbol-id='Py_FileSystemDefaultEncodeErrors'/>
+    <function-decl name='_Py_get_xoption' mangled-name='_Py_get_xoption' filepath='Python/preconfig.c' line='583' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_get_xoption'>
+      <parameter type-id='type-id-754' name='xoptions' filepath='Python/preconfig.c' line='583' column='1'/>
+      <parameter type-id='type-id-478' name='name' filepath='Python/preconfig.c' line='583' column='1'/>
+      <return type-id='type-id-478'/>
+    </function-decl>
+    <function-decl name='_Py_get_env_flag' mangled-name='_Py_get_env_flag' filepath='Python/preconfig.c' line='565' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_get_env_flag'>
+      <parameter type-id='type-id-9' name='use_environment' filepath='Python/preconfig.c' line='565' column='1'/>
+      <parameter type-id='type-id-452' name='flag' filepath='Python/preconfig.c' line='565' column='1'/>
+      <parameter type-id='type-id-3' name='name' filepath='Python/preconfig.c' line='565' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_str_to_int' mangled-name='_Py_str_to_int' filepath='Python/preconfig.c' line='547' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_str_to_int'>
+      <parameter type-id='type-id-3' name='str' filepath='Python/preconfig.c' line='547' column='1'/>
+      <parameter type-id='type-id-452' name='result' filepath='Python/preconfig.c' line='547' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_Py_GetEnv' mangled-name='_Py_GetEnv' filepath='Python/preconfig.c' line='528' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_GetEnv'>
+      <parameter type-id='type-id-9' name='use_environment' filepath='Python/preconfig.c' line='528' column='1'/>
+      <parameter type-id='type-id-3' name='name' filepath='Python/preconfig.c' line='528' column='1'/>
+      <return type-id='type-id-3'/>
+    </function-decl>
+    <pointer-type-def type-id='type-id-257' size-in-bits='64' id='type-id-757'/>
+    <function-decl name='PyPreConfig_InitIsolatedConfig' mangled-name='PyPreConfig_InitIsolatedConfig' filepath='Python/preconfig.c' line='340' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyPreConfig_InitIsolatedConfig'>
+      <parameter type-id='type-id-757' name='config' filepath='Python/preconfig.c' line='340' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyPreConfig_InitPythonConfig' mangled-name='PyPreConfig_InitPythonConfig' filepath='Python/preconfig.c' line='319' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyPreConfig_InitPythonConfig'>
+      <parameter type-id='type-id-757' name='config' filepath='Python/preconfig.c' line='340' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPreConfig_InitCompatConfig' mangled-name='_PyPreConfig_InitCompatConfig' filepath='Python/preconfig.c' line='281' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyPreConfig_InitCompatConfig'>
+      <parameter type-id='type-id-757' name='config' filepath='Python/preconfig.c' line='281' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <class-decl name='_PyArgv' size-in-bits='256' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_initconfig.h' line='66' column='1' id='type-id-758'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='argc' type-id='type-id-31' visibility='default' filepath='./Include/internal/pycore_initconfig.h' line='67' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='use_bytes_argv' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_initconfig.h' line='68' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='bytes_argv' type-id='type-id-192' visibility='default' filepath='./Include/internal/pycore_initconfig.h' line='69' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='wchar_argv' type-id='type-id-749' visibility='default' filepath='./Include/internal/pycore_initconfig.h' line='70' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='_PyArgv' type-id='type-id-758' filepath='./Include/internal/pycore_initconfig.h' line='71' column='1' id='type-id-759'/>
+    <qualified-type-def type-id='type-id-759' const='yes' id='type-id-760'/>
+    <pointer-type-def type-id='type-id-760' size-in-bits='64' id='type-id-761'/>
+    <function-decl name='_PyArgv_AsWstrList' mangled-name='_PyArgv_AsWstrList' filepath='Python/preconfig.c' line='75' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyArgv_AsWstrList'>
+      <parameter type-id='type-id-761' name='args' filepath='Python/preconfig.c' line='75' column='1'/>
+      <parameter type-id='type-id-747' name='list' filepath='Python/preconfig.c' line='75' column='1'/>
+      <return type-id='type-id-743'/>
+    </function-decl>
+    <function-decl name='_Py_SetLocaleFromEnv' mangled-name='_Py_SetLocaleFromEnv' filepath='./Include/cpython/pylifecycle.h' line='62' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyMem_SetupAllocators' mangled-name='_PyMem_SetupAllocators' filepath='./Include/internal/pycore_pymem.h' line='70' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_CoerceLegacyLocale' mangled-name='_Py_CoerceLegacyLocale' filepath='./Include/cpython/pylifecycle.h' line='60' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_LegacyLocaleDetected' mangled-name='_Py_LegacyLocaleDetected' filepath='./Include/cpython/pylifecycle.h' line='61' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyMem_GetAllocatorName' mangled-name='_PyMem_GetAllocatorName' filepath='./Include/internal/pycore_pymem.h' line='63' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='wcsncmp' mangled-name='wcsncmp' filepath='/usr/include/wchar.h' line='109' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyWideStringList_Extend' mangled-name='_PyWideStringList_Extend' filepath='./Include/internal/pycore_initconfig.h' line='59' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyWideStringList_Copy' mangled-name='_PyWideStringList_Copy' filepath='./Include/internal/pycore_initconfig.h' line='57' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/pyarena.c' comp-dir-path='/src' language='LANG_C99'>
+    <class-decl name='_arena' size-in-bits='192' is-struct='yes' visibility='default' filepath='Python/pyarena.c' line='46' column='1' id='type-id-697'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='a_head' type-id='type-id-762' visibility='default' filepath='Python/pyarena.c' line='51' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='a_cur' type-id='type-id-762' visibility='default' filepath='Python/pyarena.c' line='58' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='a_objects' type-id='type-id-16' visibility='default' filepath='Python/pyarena.c' line='64' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='_block' size-in-bits='256' is-struct='yes' visibility='default' filepath='Python/pyarena.c' line='17' column='1' id='type-id-763'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='ab_size' type-id='type-id-157' visibility='default' filepath='Python/pyarena.c' line='22' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='ab_offset' type-id='type-id-157' visibility='default' filepath='Python/pyarena.c' line='27' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='ab_next' type-id='type-id-764' visibility='default' filepath='Python/pyarena.c' line='33' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='ab_mem' type-id='type-id-21' visibility='default' filepath='Python/pyarena.c' line='38' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-763' size-in-bits='64' id='type-id-764'/>
+    <typedef-decl name='block' type-id='type-id-763' filepath='Python/pyarena.c' line='39' column='1' id='type-id-765'/>
+    <pointer-type-def type-id='type-id-765' size-in-bits='64' id='type-id-762'/>
+    <function-decl name='_PyArena_AddPyObject' mangled-name='_PyArena_AddPyObject' filepath='Python/pyarena.c' line='204' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyArena_AddPyObject'>
+      <parameter type-id='type-id-699' name='arena' filepath='Python/pyarena.c' line='204' column='1'/>
+      <parameter type-id='type-id-16' name='obj' filepath='Python/pyarena.c' line='204' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyArena_Malloc' mangled-name='_PyArena_Malloc' filepath='Python/pyarena.c' line='181' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyArena_Malloc'>
+      <parameter type-id='type-id-699' name='arena' filepath='Python/pyarena.c' line='181' column='1'/>
+      <parameter type-id='type-id-157' name='size' filepath='Python/pyarena.c' line='181' column='1'/>
+      <return type-id='type-id-21'/>
+    </function-decl>
+    <function-decl name='_PyArena_Free' mangled-name='_PyArena_Free' filepath='Python/pyarena.c' line='158' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyArena_Free'>
+      <parameter type-id='type-id-699' name='arena' filepath='Python/pyarena.c' line='158' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyArena_New' mangled-name='_PyArena_New' filepath='Python/pyarena.c' line='129' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyArena_New'>
+      <return type-id='type-id-699'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/pyctype.c' comp-dir-path='/src' language='LANG_C99'>
+    <qualified-type-def type-id='type-id-66' const='yes' id='type-id-766'/>
+
+    <array-type-def dimensions='1' type-id='type-id-766' size-in-bits='8192' id='type-id-767'>
+      <subrange length='256' type-id='type-id-19' id='type-id-362'/>
+
+    </array-type-def>
+    <qualified-type-def type-id='type-id-767' const='yes' id='type-id-768'/>
+    <var-decl name='_Py_ctype_table' type-id='type-id-768' mangled-name='_Py_ctype_table' visibility='default' filepath='./Include/cpython/pyctype.h' line='16' column='1' elf-symbol-id='_Py_ctype_table'/>
+
+    <array-type-def dimensions='1' type-id='type-id-439' size-in-bits='2048' id='type-id-769'>
+      <subrange length='256' type-id='type-id-19' id='type-id-362'/>
+
+    </array-type-def>
+    <qualified-type-def type-id='type-id-769' const='yes' id='type-id-770'/>
+    <var-decl name='_Py_ctype_tolower' type-id='type-id-770' mangled-name='_Py_ctype_tolower' visibility='default' filepath='./Include/cpython/pyctype.h' line='29' column='1' elf-symbol-id='_Py_ctype_tolower'/>
+    <var-decl name='_Py_ctype_toupper' type-id='type-id-770' mangled-name='_Py_ctype_toupper' visibility='default' filepath='./Include/cpython/pyctype.h' line='30' column='1' elf-symbol-id='_Py_ctype_toupper'/>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/pyhash.c' comp-dir-path='/src' language='LANG_C99'>
+    <union-decl name='__anonymous_union__' size-in-bits='192' is-anonymous='yes' visibility='default' filepath='./Include/pyhash.h' line='55' column='1' id='type-id-771'>
+      <data-member access='private'>
+        <var-decl name='uc' type-id='type-id-772' visibility='default' filepath='./Include/pyhash.h' line='57' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='fnv' type-id='type-id-773' visibility='default' filepath='./Include/pyhash.h' line='62' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='siphash' type-id='type-id-774' visibility='default' filepath='./Include/pyhash.h' line='67' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='djbx33a' type-id='type-id-775' visibility='default' filepath='./Include/pyhash.h' line='72' column='1'/>
+      </data-member>
+      <data-member access='private'>
+        <var-decl name='expat' type-id='type-id-776' visibility='default' filepath='./Include/pyhash.h' line='76' column='1'/>
+      </data-member>
+    </union-decl>
+
+    <array-type-def dimensions='1' type-id='type-id-341' size-in-bits='192' id='type-id-772'>
+      <subrange length='24' type-id='type-id-19' id='type-id-777'/>
+
+    </array-type-def>
+    <class-decl name='__anonymous_struct__' size-in-bits='128' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/pyhash.h' line='59' column='1' id='type-id-773'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='prefix' type-id='type-id-117' visibility='default' filepath='./Include/pyhash.h' line='60' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='suffix' type-id='type-id-117' visibility='default' filepath='./Include/pyhash.h' line='61' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='128' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/pyhash.h' line='64' column='1' id='type-id-774'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='k0' type-id='type-id-22' visibility='default' filepath='./Include/pyhash.h' line='65' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='k1' type-id='type-id-22' visibility='default' filepath='./Include/pyhash.h' line='66' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/pyhash.h' line='69' column='1' id='type-id-775'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='padding' type-id='type-id-778' visibility='default' filepath='./Include/pyhash.h' line='70' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='suffix' type-id='type-id-117' visibility='default' filepath='./Include/pyhash.h' line='71' column='1'/>
+      </data-member>
+    </class-decl>
+
+    <array-type-def dimensions='1' type-id='type-id-341' size-in-bits='128' id='type-id-778'>
+      <subrange length='16' type-id='type-id-19' id='type-id-779'/>
+
+    </array-type-def>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' visibility='default' filepath='./Include/pyhash.h' line='73' column='1' id='type-id-776'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='padding' type-id='type-id-778' visibility='default' filepath='./Include/pyhash.h' line='74' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='hashsalt' type-id='type-id-117' visibility='default' filepath='./Include/pyhash.h' line='75' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='_Py_HashSecret_t' type-id='type-id-771' filepath='./Include/pyhash.h' line='77' column='1' id='type-id-780'/>
+    <var-decl name='_Py_HashSecret' type-id='type-id-780' mangled-name='_Py_HashSecret' visibility='default' filepath='./Include/pyhash.h' line='78' column='1' elf-symbol-id='_Py_HashSecret'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-781' visibility='default' filepath='./Include/pyhash.h' line='86' column='1' id='type-id-782'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='hash' type-id='type-id-783' visibility='default' filepath='./Include/pyhash.h' line='87' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='name' type-id='type-id-3' visibility='default' filepath='./Include/pyhash.h' line='88' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='hash_bits' type-id='type-id-784' visibility='default' filepath='./Include/pyhash.h' line='89' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='160'>
+        <var-decl name='seed_bits' type-id='type-id-784' visibility='default' filepath='./Include/pyhash.h' line='90' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-785' size-in-bits='64' id='type-id-786'/>
+    <qualified-type-def type-id='type-id-786' const='yes' id='type-id-783'/>
+    <qualified-type-def type-id='type-id-9' const='yes' id='type-id-784'/>
+    <typedef-decl name='PyHash_FuncDef' type-id='type-id-782' filepath='./Include/pyhash.h' line='91' column='1' id='type-id-781'/>
+    <pointer-type-def type-id='type-id-781' size-in-bits='64' id='type-id-787'/>
+    <function-decl name='PyHash_GetFuncDef' mangled-name='PyHash_GetFuncDef' filepath='Python/pyhash.c' line='221' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyHash_GetFuncDef'>
+      <return type-id='type-id-787'/>
+    </function-decl>
+    <function-decl name='_Py_HashBytes' mangled-name='_Py_HashBytes' filepath='Python/pyhash.c' line='158' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_HashBytes'>
+      <parameter type-id='type-id-21' name='src' filepath='Python/pyhash.c' line='158' column='1'/>
+      <parameter type-id='type-id-31' name='len' filepath='Python/pyhash.c' line='158' column='1'/>
+      <return type-id='type-id-117'/>
+    </function-decl>
+    <function-decl name='_Py_HashPointer' mangled-name='_Py_HashPointer' filepath='Python/pyhash.c' line='148' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_HashPointer'>
+      <parameter type-id='type-id-21' name='p' filepath='Python/pyhash.c' line='148' column='1'/>
+      <return type-id='type-id-117'/>
+    </function-decl>
+    <function-decl name='_Py_HashPointerRaw' mangled-name='_Py_HashPointerRaw' filepath='Python/pyhash.c' line='138' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_HashPointerRaw'>
+      <parameter type-id='type-id-21' name='p' filepath='Python/pyhash.c' line='138' column='1'/>
+      <return type-id='type-id-117'/>
+    </function-decl>
+    <function-decl name='_Py_HashDouble' mangled-name='_Py_HashDouble' filepath='Python/pyhash.c' line='92' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_HashDouble'>
+      <parameter type-id='type-id-16' name='inst' filepath='Python/pyhash.c' line='92' column='1'/>
+      <parameter type-id='type-id-371' name='v' filepath='Python/pyhash.c' line='92' column='1'/>
+      <return type-id='type-id-117'/>
+    </function-decl>
+    <function-type size-in-bits='64' id='type-id-785'>
+      <parameter type-id='type-id-21'/>
+      <parameter type-id='type-id-31'/>
+      <return type-id='type-id-117'/>
+    </function-type>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/pylifecycle.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='_Py_UnhandledKeyboardInterrupt' type-id='type-id-9' mangled-name='_Py_UnhandledKeyboardInterrupt' visibility='default' filepath='./Include/internal/pycore_pylifecycle.h' line='35' column='1' elf-symbol-id='_Py_UnhandledKeyboardInterrupt'/>
+    <typedef-decl name='_PyRuntimeState' type-id='type-id-530' filepath='./Include/internal/pycore_runtime.h' line='121' column='1' id='type-id-788'/>
+    <var-decl name='_PyRuntime' type-id='type-id-788' mangled-name='_PyRuntime' visibility='default' filepath='./Include/internal/pycore_runtime.h' line='128' column='1' elf-symbol-id='_PyRuntime'/>
+    <pointer-type-def type-id='type-id-789' size-in-bits='64' id='type-id-790'/>
+    <typedef-decl name='PyOS_sighandler_t' type-id='type-id-790' filepath='./Include/pylifecycle.h' line='61' column='1' id='type-id-791'/>
+    <function-decl name='PyOS_setsig' mangled-name='PyOS_setsig' filepath='Python/pylifecycle.c' line='2942' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyOS_setsig'>
+      <parameter type-id='type-id-9' name='sig' filepath='Python/pylifecycle.c' line='2942' column='1'/>
+      <parameter type-id='type-id-791' name='handler' filepath='Python/pylifecycle.c' line='2942' column='1'/>
+      <return type-id='type-id-791'/>
+    </function-decl>
+    <function-decl name='PyOS_getsig' mangled-name='PyOS_getsig' filepath='Python/pylifecycle.c' line='2903' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyOS_getsig'>
+      <parameter type-id='type-id-9' name='sig' filepath='Python/pylifecycle.c' line='2903' column='1'/>
+      <return type-id='type-id-791'/>
+    </function-decl>
+    <function-decl name='_Py_FdIsInteractive' mangled-name='_Py_FdIsInteractive' filepath='Python/pylifecycle.c' line='2886' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_FdIsInteractive'>
+      <parameter type-id='type-id-188' name='fp' filepath='Python/pylifecycle.c' line='2886' column='1'/>
+      <parameter type-id='type-id-16' name='filename' filepath='Python/pylifecycle.c' line='2886' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='Py_FdIsInteractive' mangled-name='Py_FdIsInteractive' filepath='Python/pylifecycle.c' line='2873' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_FdIsInteractive'>
+      <parameter type-id='type-id-188' name='fp' filepath='Python/pylifecycle.c' line='2873' column='1'/>
+      <parameter type-id='type-id-3' name='filename' filepath='Python/pylifecycle.c' line='2873' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='Py_Exit' mangled-name='Py_Exit' filepath='Python/pylifecycle.c' line='2856' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_Exit'>
+      <parameter type-id='type-id-9' name='sts' filepath='Python/pylifecycle.c' line='2856' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='Py_AtExit' mangled-name='Py_AtExit' filepath='Python/pylifecycle.c' line='2831' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_AtExit'>
+      <parameter type-id='type-id-275' name='func' filepath='Python/pylifecycle.c' line='2831' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='Py_ExitStatusException' mangled-name='Py_ExitStatusException' filepath='Python/pylifecycle.c' line='2789' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_ExitStatusException'>
+      <parameter type-id='type-id-743' name='status' filepath='Python/pylifecycle.c' line='2789' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_FatalErrorFunc' mangled-name='_Py_FatalErrorFunc' filepath='Python/pylifecycle.c' line='2748' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_FatalErrorFunc'>
+      <parameter type-id='type-id-3' name='func' filepath='Python/pylifecycle.c' line='2748' column='1'/>
+      <parameter type-id='type-id-3' name='msg' filepath='Python/pylifecycle.c' line='2748' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='Py_FatalError' mangled-name='Py_FatalError' filepath='Python/pylifecycle.c' line='2741' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_FatalError'>
+      <parameter type-id='type-id-3' name='msg' filepath='Python/pylifecycle.c' line='2741' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_DumpExtensionModules' mangled-name='_Py_DumpExtensionModules' filepath='Python/pylifecycle.c' line='2568' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_DumpExtensionModules'>
+      <parameter type-id='type-id-9' name='fd' filepath='Python/pylifecycle.c' line='2568' column='1'/>
+      <parameter type-id='type-id-222' name='interp' filepath='Python/pylifecycle.c' line='2568' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='Py_EndInterpreter' mangled-name='Py_EndInterpreter' filepath='Python/pylifecycle.c' line='2004' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_EndInterpreter'>
+      <parameter type-id='type-id-331' name='tstate' filepath='Python/pylifecycle.c' line='2004' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='Py_NewInterpreter' mangled-name='Py_NewInterpreter' filepath='Python/pylifecycle.c' line='1986' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_NewInterpreter'>
+      <return type-id='type-id-331'/>
+    </function-decl>
+    <function-decl name='_Py_NewInterpreter' mangled-name='_Py_NewInterpreter' filepath='Python/pylifecycle.c' line='1974' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_NewInterpreter'>
+      <parameter type-id='type-id-9' name='isolated_subinterpreter' filepath='Python/pylifecycle.c' line='1974' column='1'/>
+      <return type-id='type-id-331'/>
+    </function-decl>
+    <function-decl name='Py_Finalize' mangled-name='Py_Finalize' filepath='Python/pylifecycle.c' line='1868' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_Finalize'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_InitializeMain' mangled-name='_Py_InitializeMain' filepath='Python/pylifecycle.c' line='1271' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_InitializeMain'>
+      <return type-id='type-id-743'/>
+    </function-decl>
+    <function-decl name='Py_Initialize' mangled-name='Py_Initialize' filepath='Python/pylifecycle.c' line='1264' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_Initialize'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='Py_InitializeEx' mangled-name='Py_InitializeEx' filepath='Python/pylifecycle.c' line='1237' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_InitializeEx'>
+      <parameter type-id='type-id-9' name='install_sigs' filepath='Python/pylifecycle.c' line='1237' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <qualified-type-def type-id='type-id-257' const='yes' id='type-id-792'/>
+    <pointer-type-def type-id='type-id-792' size-in-bits='64' id='type-id-793'/>
+    <function-decl name='Py_PreInitialize' mangled-name='Py_PreInitialize' filepath='Python/pylifecycle.c' line='941' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_PreInitialize'>
+      <parameter type-id='type-id-793' name='src_config' filepath='Python/pylifecycle.c' line='941' column='1'/>
+      <return type-id='type-id-743'/>
+    </function-decl>
+    <function-decl name='Py_PreInitializeFromArgs' mangled-name='Py_PreInitializeFromArgs' filepath='Python/pylifecycle.c' line='933' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_PreInitializeFromArgs'>
+      <parameter type-id='type-id-793' name='src_config' filepath='Python/pylifecycle.c' line='933' column='1'/>
+      <parameter type-id='type-id-31' name='argc' filepath='Python/pylifecycle.c' line='933' column='1'/>
+      <parameter type-id='type-id-329' name='argv' filepath='Python/pylifecycle.c' line='933' column='1'/>
+      <return type-id='type-id-743'/>
+    </function-decl>
+    <function-decl name='Py_PreInitializeFromBytesArgs' mangled-name='Py_PreInitializeFromBytesArgs' filepath='Python/pylifecycle.c' line='925' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_PreInitializeFromBytesArgs'>
+      <parameter type-id='type-id-793' name='src_config' filepath='Python/pylifecycle.c' line='925' column='1'/>
+      <parameter type-id='type-id-31' name='argc' filepath='Python/pylifecycle.c' line='925' column='1'/>
+      <parameter type-id='type-id-215' name='argv' filepath='Python/pylifecycle.c' line='925' column='1'/>
+      <return type-id='type-id-743'/>
+    </function-decl>
+    <function-decl name='_PyInterpreterState_SetConfig' mangled-name='_PyInterpreterState_SetConfig' filepath='Python/pylifecycle.c' line='473' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyInterpreterState_SetConfig'>
+      <parameter type-id='type-id-751' name='src_config' filepath='Python/pylifecycle.c' line='473' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_Py_SetLocaleFromEnv' mangled-name='_Py_SetLocaleFromEnv' filepath='Python/pylifecycle.c' line='385' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_SetLocaleFromEnv'>
+      <parameter type-id='type-id-9' name='category' filepath='Python/pylifecycle.c' line='385' column='1'/>
+      <return type-id='type-id-72'/>
+    </function-decl>
+    <function-decl name='_Py_CoerceLegacyLocale' mangled-name='_Py_CoerceLegacyLocale' filepath='Python/pylifecycle.c' line='335' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_CoerceLegacyLocale'>
+      <parameter type-id='type-id-9' name='warn' filepath='Python/pylifecycle.c' line='335' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_Py_IsLocaleCoercionTarget' mangled-name='_Py_IsLocaleCoercionTarget' filepath='Python/pylifecycle.c' line='293' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_IsLocaleCoercionTarget'>
+      <parameter type-id='type-id-3' name='ctype_loc' filepath='Python/pylifecycle.c' line='293' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_Py_LegacyLocaleDetected' mangled-name='_Py_LegacyLocaleDetected' filepath='Python/pylifecycle.c' line='238' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_LegacyLocaleDetected'>
+      <parameter type-id='type-id-9' name='warn' filepath='Python/pylifecycle.c' line='238' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='Py_IsInitialized' mangled-name='Py_IsInitialized' filepath='Python/pylifecycle.c' line='138' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_IsInitialized'>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_Py_IsCoreInitialized' mangled-name='_Py_IsCoreInitialized' filepath='Python/pylifecycle.c' line='132' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_IsCoreInitialized'>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_Py_IsFinalizing' mangled-name='_Py_IsFinalizing' filepath='Python/pylifecycle.c' line='116' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_IsFinalizing'>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyRuntime_Finalize' mangled-name='_PyRuntime_Finalize' filepath='Python/pylifecycle.c' line='109' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyRuntime_Finalize'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyRuntime_Initialize' mangled-name='_PyRuntime_Initialize' filepath='Python/pylifecycle.c' line='92' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyRuntime_Initialize'>
+      <return type-id='type-id-743'/>
+    </function-decl>
+    <function-decl name='_Py_PreInitializeFromPyArgv' mangled-name='_Py_PreInitializeFromPyArgv' filepath='Python/pylifecycle.c' line='878' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_PreInitializeFromPyArgv'>
+      <parameter type-id='type-id-793' name='src_config' filepath='Python/pylifecycle.c' line='878' column='1'/>
+      <parameter type-id='type-id-761' name='args' filepath='Python/pylifecycle.c' line='878' column='1'/>
+      <return type-id='type-id-743'/>
+    </function-decl>
+    <function-decl name='_Py_PreInitializeFromConfig' mangled-name='_Py_PreInitializeFromConfig' filepath='Python/pylifecycle.c' line='948' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_PreInitializeFromConfig'>
+      <parameter type-id='type-id-751' name='config' filepath='Python/pylifecycle.c' line='948' column='1'/>
+      <parameter type-id='type-id-761' name='args' filepath='Python/pylifecycle.c' line='949' column='1'/>
+      <return type-id='type-id-743'/>
+    </function-decl>
+    <function-decl name='Py_InitializeFromConfig' mangled-name='Py_InitializeFromConfig' filepath='Python/pylifecycle.c' line='1204' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_InitializeFromConfig'>
+      <parameter type-id='type-id-751' name='config' filepath='Python/pylifecycle.c' line='1204' column='1'/>
+      <return type-id='type-id-743'/>
+    </function-decl>
+    <function-decl name='Py_FinalizeEx' mangled-name='Py_FinalizeEx' filepath='Python/pylifecycle.c' line='1703' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_FinalizeEx'>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='sigemptyset' mangled-name='sigemptyset' filepath='/usr/include/signal.h' line='196' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='sigaction' mangled-name='sigaction' filepath='/usr/include/signal.h' line='240' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='exit' mangled-name='exit' filepath='/usr/include/stdlib.h' line='617' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__vfprintf_chk' mangled-name='__vfprintf_chk' filepath='/usr/include/x86_64-linux-gnu/bits/stdio2.h' line='91' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='abort' mangled-name='abort' filepath='/usr/include/stdlib.h' line='591' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_write_noraise' mangled-name='_Py_write_noraise' filepath='./Include/cpython/fileutils.h' line='115' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_DumpHexadecimal' mangled-name='_Py_DumpHexadecimal' filepath='./Include/internal/pycore_traceback.h' line='81' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_Display' mangled-name='PyErr_Display' filepath='./Include/pythonrun.h' line='14' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_DumpTracebackThreads' mangled-name='_Py_DumpTracebackThreads' filepath='./Include/internal/pycore_traceback.h' line='58' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyFaulthandler_Fini' mangled-name='_PyFaulthandler_Fini' filepath='./Include/internal/pycore_pylifecycle.h' line='105' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyModule_IsExtension' mangled-name='_PyModule_IsExtension' filepath='./Include/moduleobject.h' line='90' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_DumpASCII' mangled-name='_Py_DumpASCII' filepath='./Include/internal/pycore_traceback.h' line='70' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_DumpDecimal' mangled-name='_Py_DumpDecimal' filepath='./Include/internal/pycore_traceback.h' line='75' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyInterpreterState_Delete' mangled-name='PyInterpreterState_Delete' filepath='./Include/pystate.h' line='26' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyGILState_Fini' mangled-name='_PyGILState_Fini' filepath='./Include/internal/pycore_pylifecycle.h' line='114' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAtExit_Call' mangled-name='_PyAtExit_Call' filepath='./Include/internal/pycore_pylifecycle.h' line='136' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyEval_FiniGIL' mangled-name='_PyEval_FiniGIL' filepath='./Include/internal/pycore_ceval.h' line='61' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyGILState_SetTstate' mangled-name='_PyGILState_SetTstate' filepath='./Include/internal/pycore_pylifecycle.h' line='113' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyEval_InitGIL' mangled-name='_PyEval_InitGIL' filepath='./Include/internal/pycore_ceval.h' line='60' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyInterpreterState_Main' mangled-name='PyInterpreterState_Main' filepath='./Include/cpython/pystate.h' line='194' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyInterpreterState_New' mangled-name='PyInterpreterState_New' filepath='./Include/pystate.h' line='24' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyThreadState_New' mangled-name='PyThreadState_New' filepath='./Include/pystate.h' line='58' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyThreadState_Swap' mangled-name='PyThreadState_Swap' filepath='./Include/pystate.h' line='83' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyConfig_Copy' mangled-name='_PyConfig_Copy' filepath='./Include/internal/pycore_initconfig.h' line='152' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_PrintEx' mangled-name='PyErr_PrintEx' filepath='./Include/pythonrun.h' line='13' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyThreadState_Clear' mangled-name='PyThreadState_Clear' filepath='./Include/pystate.h' line='59' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyThreadState_Delete' mangled-name='PyThreadState_Delete' filepath='./Include/pystate.h' line='60' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyExc_Fini' mangled-name='_PyExc_Fini' filepath='./Include/internal/pycore_pylifecycle.h' line='96' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyFrame_Fini' mangled-name='_PyFrame_Fini' filepath='./Include/internal/pycore_pylifecycle.h' line='84' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAsyncGen_Fini' mangled-name='_PyAsyncGen_Fini' filepath='./Include/internal/pycore_pylifecycle.h' line='91' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyContext_Fini' mangled-name='_PyContext_Fini' filepath='./Include/internal/pycore_context.h' line='40' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyType_Fini' mangled-name='_PyType_Fini' filepath='./Include/internal/pycore_pylifecycle.h' line='100' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_ClearInterned' mangled-name='_PyUnicode_ClearInterned' filepath='./Include/internal/pycore_pylifecycle.h' line='103' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyDict_Fini' mangled-name='_PyDict_Fini' filepath='./Include/internal/pycore_pylifecycle.h' line='85' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyList_Fini' mangled-name='_PyList_Fini' filepath='./Include/internal/pycore_pylifecycle.h' line='87' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTuple_Fini' mangled-name='_PyTuple_Fini' filepath='./Include/internal/pycore_pylifecycle.h' line='86' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PySlice_Fini' mangled-name='_PySlice_Fini' filepath='./Include/internal/pycore_pylifecycle.h' line='90' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyBytes_Fini' mangled-name='_PyBytes_Fini' filepath='./Include/internal/pycore_pylifecycle.h' line='88' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_Fini' mangled-name='_PyUnicode_Fini' filepath='./Include/internal/pycore_pylifecycle.h' line='102' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyFloat_Fini' mangled-name='_PyFloat_Fini' filepath='./Include/internal/pycore_pylifecycle.h' line='89' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyLong_Fini' mangled-name='_PyLong_Fini' filepath='./Include/internal/pycore_pylifecycle.h' line='104' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyInterpreterState_Clear' mangled-name='_PyInterpreterState_Clear' filepath='./Include/internal/pycore_interp.h' line='317' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PySys_ClearAuditHooks' mangled-name='_PySys_ClearAuditHooks' filepath='./Include/internal/pycore_sysmodule.h' line='19' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_HashRandomization_Fini' mangled-name='_Py_HashRandomization_Fini' filepath='./Include/internal/pycore_pylifecycle.h' line='101' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyArg_Fini' mangled-name='_PyArg_Fini' filepath='./Include/modsupport.h' line='136' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_ClearFileSystemEncoding' mangled-name='_Py_ClearFileSystemEncoding' filepath='./Include/internal/pycore_pylifecycle.h' line='40' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyModule_ClearDict' mangled-name='_PyModule_ClearDict' filepath='./Include/moduleobject.h' line='32' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyModule_Clear' mangled-name='_PyModule_Clear' filepath='./Include/moduleobject.h' line='31' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyInterpreterState_ClearModules' mangled-name='_PyInterpreterState_ClearModules' filepath='./Include/internal/pycore_interp.h' line='316' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyGC_CollectNoFail' mangled-name='_PyGC_CollectNoFail' filepath='./Include/internal/pycore_gc.h' line='166' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyGC_DumpShutdownStats' mangled-name='_PyGC_DumpShutdownStats' filepath='./Include/internal/pycore_pylifecycle.h' line='116' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyConfig_Write' mangled-name='_PyConfig_Write' filepath='./Include/internal/pycore_initconfig.h' line='159' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyConfig_WritePathConfig' mangled-name='_PyConfig_WritePathConfig' filepath='./Include/internal/pycore_pathconfig.h' line='66' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_SetFromPyStatus' mangled-name='_PyErr_SetFromPyStatus' filepath='./Include/internal/pycore_initconfig.h' line='47' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PySys_UpdateConfig' mangled-name='_PySys_UpdateConfig' filepath='./Include/internal/pycore_pylifecycle.h' line='67' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyConfig_InitCompatConfig' mangled-name='_PyConfig_InitCompatConfig' filepath='./Include/internal/pycore_initconfig.h' line='151' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyImportZip_Init' mangled-name='_PyImportZip_Init' filepath='./Include/internal/pycore_pylifecycle.h' line='77' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PySys_SetObject' mangled-name='PySys_SetObject' filepath='./Include/sysmodule.h' line='11' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PySys_SetObjectId' mangled-name='_PySys_SetObjectId' filepath='./Include/cpython/sysmodule.h' line='6' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyImport_AddModule' mangled-name='PyImport_AddModule' filepath='./Include/import.h' line='43' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_InitEncodings' mangled-name='_PyUnicode_InitEncodings' filepath='./Include/internal/pycore_pylifecycle.h' line='41' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyThread_debug_deprecation' mangled-name='_PyThread_debug_deprecation' filepath='Python/pylifecycle.c' line='1060' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyFaulthandler_Init' mangled-name='_PyFaulthandler_Init' filepath='./Include/internal/pycore_pylifecycle.h' line='59' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PySignal_Init' mangled-name='_PySignal_Init' filepath='./Include/internal/pycore_pylifecycle.h' line='93' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTraceMalloc_Init' mangled-name='_PyTraceMalloc_Init' filepath='./Include/internal/pycore_pylifecycle.h' line='60' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyLong_Init' mangled-name='_PyLong_Init' filepath='./Include/internal/pycore_pylifecycle.h' line='56' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyBytes_Init' mangled-name='_PyBytes_Init' filepath='./Include/internal/pycore_pylifecycle.h' line='54' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_Init' mangled-name='_PyUnicode_Init' filepath='./Include/internal/pycore_pylifecycle.h' line='52' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTuple_Init' mangled-name='_PyTuple_Init' filepath='./Include/internal/pycore_pylifecycle.h' line='58' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyFloat_Init' mangled-name='_PyFloat_Init' filepath='./Include/internal/pycore_pylifecycle.h' line='71' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyExc_Init' mangled-name='_PyExc_Init' filepath='./Include/internal/pycore_pylifecycle.h' line='68' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_InitTypes' mangled-name='_PyErr_InitTypes' filepath='./Include/internal/pycore_pylifecycle.h' line='69' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyContext_Init' mangled-name='_PyContext_Init' filepath='./Include/internal/pycore_context.h' line='39' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyStructSequence_Init' mangled-name='_PyStructSequence_Init' filepath='./Include/internal/pycore_pylifecycle.h' line='55' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTypes_Init' mangled-name='_PyTypes_Init' filepath='./Include/internal/pycore_pylifecycle.h' line='75' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyLong_InitTypes' mangled-name='_PyLong_InitTypes' filepath='./Include/internal/pycore_pylifecycle.h' line='57' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_InitTypes' mangled-name='_PyUnicode_InitTypes' filepath='./Include/internal/pycore_pylifecycle.h' line='53' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyFloat_InitTypes' mangled-name='_PyFloat_InitTypes' filepath='./Include/internal/pycore_pylifecycle.h' line='72' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyBuiltin_Init' mangled-name='_PyBuiltin_Init' filepath='./Include/internal/pycore_pylifecycle.h' line='61' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyImport_FixupBuiltin' mangled-name='_PyImport_FixupBuiltin' filepath='./Include/cpython/import.h' line='19' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyBuiltins_AddExceptions' mangled-name='_PyBuiltins_AddExceptions' filepath='./Include/internal/pycore_pylifecycle.h' line='70' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyImport_BootstrapImp' mangled-name='_PyImport_BootstrapImp' filepath='./Include/internal/pycore_import.h' line='11' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyImport_SetModuleString' mangled-name='_PyImport_SetModuleString' filepath='./Include/cpython/import.h' line='11' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyGC_Init' mangled-name='_PyGC_Init' filepath='./Include/internal/pycore_pylifecycle.h' line='78' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyWarnings_InitState' mangled-name='_PyWarnings_InitState' filepath='./Include/internal/pycore_warnings.h' line='20' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAtExit_Init' mangled-name='_PyAtExit_Init' filepath='./Include/internal/pycore_pylifecycle.h' line='79' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PySys_Create' mangled-name='_PySys_Create' filepath='./Include/internal/pycore_pylifecycle.h' line='62' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyConfig_Read' mangled-name='PyConfig_Read' filepath='./Include/cpython/initconfig.h' line='225' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_ResetForceASCII' mangled-name='_Py_ResetForceASCII' filepath='./Include/internal/pycore_fileutils.h' line='43' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_ResetForceASCII'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='setenv' mangled-name='setenv' filepath='/usr/include/stdlib.h' line='653' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='nl_langinfo' mangled-name='nl_langinfo' filepath='/usr/include/langinfo.h' line='661' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyRuntimeState_Fini' mangled-name='_PyRuntimeState_Fini' filepath='./Include/internal/pycore_runtime.h' line='131' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyImport_GetModuleId' mangled-name='_PyImport_GetModuleId' filepath='./Include/cpython/import.h' line='9' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='dup' mangled-name='dup' filepath='/usr/include/unistd.h' line='531' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='close' mangled-name='close' filepath='/usr/include/unistd.h' line='353' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyRuntimeState_Init' mangled-name='_PyRuntimeState_Init' filepath='./Include/internal/pycore_runtime.h' line='130' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPreConfig_Read' mangled-name='_PyPreConfig_Read' filepath='./Include/internal/pycore_initconfig.h' line='137' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPreConfig_Write' mangled-name='_PyPreConfig_Write' filepath='./Include/internal/pycore_initconfig.h' line='139' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPreConfig_InitFromConfig' mangled-name='_PyPreConfig_InitFromConfig' filepath='./Include/internal/pycore_initconfig.h' line='128' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_HashRandomization_Init' mangled-name='_Py_HashRandomization_Init' filepath='./Include/internal/pycore_pylifecycle.h' line='73' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyInterpreterState_Enable' mangled-name='_PyInterpreterState_Enable' filepath='./Include/internal/pycore_pystate.h' line='133' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyGILState_Init' mangled-name='_PyGILState_Init' filepath='./Include/internal/pycore_pylifecycle.h' line='112' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyConfig_Read' mangled-name='_PyConfig_Read' filepath='./Include/internal/pycore_initconfig.h' line='158' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_FinishPendingCalls' mangled-name='_Py_FinishPendingCalls' filepath='./Include/internal/pycore_ceval.h' line='17' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PySignal_Fini' mangled-name='_PySignal_Fini' filepath='./Include/internal/pycore_pylifecycle.h' line='94' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyGC_Collect' mangled-name='PyGC_Collect' filepath='./Include/objimpl.h' line='154' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyEval_Fini' mangled-name='_PyEval_Fini' filepath='./Include/internal/pycore_ceval.h' line='34' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTraceMalloc_Fini' mangled-name='_PyTraceMalloc_Fini' filepath='./Include/internal/pycore_pylifecycle.h' line='107' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyImport_Fini' mangled-name='_PyImport_Fini' filepath='./Include/internal/pycore_pylifecycle.h' line='97' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyHash_Fini' mangled-name='_PyHash_Fini' filepath='./Include/internal/pycore_pylifecycle.h' line='106' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObject_DebugMallocStats' mangled-name='_PyObject_DebugMallocStats' filepath='./Include/cpython/objimpl.h' line='60' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-type size-in-bits='64' id='type-id-789'>
+      <parameter type-id='type-id-9'/>
+      <return type-id='type-id-4'/>
+    </function-type>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/pymath.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='_Py_set_387controlword' mangled-name='_Py_set_387controlword' filepath='Python/pymath.c' line='29' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_set_387controlword'>
+      <parameter type-id='type-id-173' name='cw' filepath='Python/pymath.c' line='29' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_get_387controlword' mangled-name='_Py_get_387controlword' filepath='Python/pymath.c' line='23' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_get_387controlword'>
+      <return type-id='type-id-173'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/pystate.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='_Py_GetConfig' mangled-name='_Py_GetConfig' filepath='Python/pystate.c' line='1968' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_GetConfig'>
+      <return type-id='type-id-751'/>
+    </function-decl>
+    <function-decl name='_PyInterpreterState_GetConfigCopy' mangled-name='_PyInterpreterState_GetConfigCopy' filepath='Python/pystate.c' line='1954' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyInterpreterState_GetConfigCopy'>
+      <parameter type-id='type-id-746' name='config' filepath='Python/pystate.c' line='1954' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyInterpreterState_GetConfig' mangled-name='_PyInterpreterState_GetConfig' filepath='Python/pystate.c' line='1947' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyInterpreterState_GetConfig'>
+      <parameter type-id='type-id-222' name='interp' filepath='Python/pystate.c' line='1947' column='1'/>
+      <return type-id='type-id-751'/>
+    </function-decl>
+    <function-decl name='_PyInterpreterState_SetEvalFrameFunc' mangled-name='_PyInterpreterState_SetEvalFrameFunc' filepath='Python/pystate.c' line='1939' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyInterpreterState_SetEvalFrameFunc'>
+      <parameter type-id='type-id-222' name='interp' filepath='Python/pystate.c' line='1939' column='1'/>
+      <parameter type-id='type-id-232' name='eval_frame' filepath='Python/pystate.c' line='1940' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyInterpreterState_GetEvalFrameFunc' mangled-name='_PyInterpreterState_GetEvalFrameFunc' filepath='Python/pystate.c' line='1932' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyInterpreterState_GetEvalFrameFunc'>
+      <parameter type-id='type-id-222' name='interp' filepath='Python/pystate.c' line='1932' column='1'/>
+      <return type-id='type-id-232'/>
+    </function-decl>
+    <function-decl name='_PyCrossInterpreterData_Lookup' mangled-name='_PyCrossInterpreterData_Lookup' filepath='Python/pystate.c' line='1782' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyCrossInterpreterData_Lookup'>
+      <parameter type-id='type-id-16' name='obj' filepath='Python/pystate.c' line='1782' column='1'/>
+      <return type-id='type-id-267'/>
+    </function-decl>
+    <function-decl name='_PyCrossInterpreterData_RegisterClass' mangled-name='_PyCrossInterpreterData_RegisterClass' filepath='Python/pystate.c' line='1752' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyCrossInterpreterData_RegisterClass'>
+      <parameter type-id='type-id-32' name='cls' filepath='Python/pystate.c' line='1752' column='1'/>
+      <parameter type-id='type-id-267' name='getdata' filepath='Python/pystate.c' line='1753' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <typedef-decl name='_PyCrossInterpreterData' type-id='type-id-268' filepath='./Include/cpython/pystate.h' line='292' column='1' id='type-id-794'/>
+    <pointer-type-def type-id='type-id-794' size-in-bits='64' id='type-id-795'/>
+    <function-decl name='_PyCrossInterpreterData_NewObject' mangled-name='_PyCrossInterpreterData_NewObject' filepath='Python/pystate.c' line='1722' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyCrossInterpreterData_NewObject'>
+      <parameter type-id='type-id-795' name='data' filepath='Python/pystate.c' line='1722' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyCrossInterpreterData_Release' mangled-name='_PyCrossInterpreterData_Release' filepath='Python/pystate.c' line='1699' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyCrossInterpreterData_Release'>
+      <parameter type-id='type-id-795' name='data' filepath='Python/pystate.c' line='1699' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObject_GetCrossInterpreterData' mangled-name='_PyObject_GetCrossInterpreterData' filepath='Python/pystate.c' line='1630' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_GetCrossInterpreterData'>
+      <parameter type-id='type-id-16' name='obj' filepath='Python/pystate.c' line='1630' column='1'/>
+      <parameter type-id='type-id-795' name='data' filepath='Python/pystate.c' line='1630' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyObject_CheckCrossInterpreterData' mangled-name='_PyObject_CheckCrossInterpreterData' filepath='Python/pystate.c' line='1598' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_CheckCrossInterpreterData'>
+      <parameter type-id='type-id-16' name='o' filepath='Objects/abstract.c' line='830' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <enum-decl name='__anonymous_enum__' is-anonymous='yes' filepath='./Include/pystate.h' line='95' column='1' id='type-id-796'>
+      <underlying-type type-id='type-id-83'/>
+      <enumerator name='PyGILState_LOCKED' value='0'/>
+      <enumerator name='PyGILState_UNLOCKED' value='1'/>
+    </enum-decl>
+    <typedef-decl name='PyGILState_STATE' type-id='type-id-796' filepath='./Include/pystate.h' line='96' column='1' id='type-id-797'/>
+    <function-decl name='PyGILState_Release' mangled-name='PyGILState_Release' filepath='Python/pystate.c' line='1533' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyGILState_Release'>
+      <parameter type-id='type-id-797' name='oldstate' filepath='Python/pystate.c' line='1533' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyGILState_Ensure' mangled-name='PyGILState_Ensure' filepath='Python/pystate.c' line='1483' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyGILState_Ensure'>
+      <return type-id='type-id-797'/>
+    </function-decl>
+    <function-decl name='PyGILState_Check' mangled-name='PyGILState_Check' filepath='Python/pystate.c' line='1463' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyGILState_Check'>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyGILState_GetThisThreadState' mangled-name='PyGILState_GetThisThreadState' filepath='Python/pystate.c' line='1457' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyGILState_GetThisThreadState'>
+      <return type-id='type-id-331'/>
+    </function-decl>
+    <function-decl name='_PyGILState_GetInterpreterStateUnsafe' mangled-name='_PyGILState_GetInterpreterStateUnsafe' filepath='Python/pystate.c' line='1370' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyGILState_GetInterpreterStateUnsafe'>
+      <return type-id='type-id-222'/>
+    </function-decl>
+    <function-decl name='_PyThread_CurrentExceptions' mangled-name='_PyThread_CurrentExceptions' filepath='Python/pystate.c' line='1248' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyThread_CurrentExceptions'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyThread_CurrentFrames' mangled-name='_PyThread_CurrentFrames' filepath='Python/pystate.c' line='1198' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyThread_CurrentFrames'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyThreadState_Next' mangled-name='PyThreadState_Next' filepath='Python/pystate.c' line='1188' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThreadState_Next'>
+      <parameter type-id='type-id-331' name='tstate' filepath='Python/pystate.c' line='1188' column='1'/>
+      <return type-id='type-id-331'/>
+    </function-decl>
+    <function-decl name='PyInterpreterState_ThreadHead' mangled-name='PyInterpreterState_ThreadHead' filepath='Python/pystate.c' line='1183' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInterpreterState_ThreadHead'>
+      <parameter type-id='type-id-222' name='interp' filepath='Python/pystate.c' line='1183' column='1'/>
+      <return type-id='type-id-331'/>
+    </function-decl>
+    <function-decl name='PyInterpreterState_Next' mangled-name='PyInterpreterState_Next' filepath='Python/pystate.c' line='1178' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInterpreterState_Next'>
+      <parameter type-id='type-id-222' name='interp' filepath='Python/pystate.c' line='1178' column='1'/>
+      <return type-id='type-id-222'/>
+    </function-decl>
+    <function-decl name='PyInterpreterState_Main' mangled-name='PyInterpreterState_Main' filepath='Python/pystate.c' line='1172' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInterpreterState_Main'>
+      <return type-id='type-id-222'/>
+    </function-decl>
+    <function-decl name='PyInterpreterState_Head' mangled-name='PyInterpreterState_Head' filepath='Python/pystate.c' line='1166' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInterpreterState_Head'>
+      <return type-id='type-id-222'/>
+    </function-decl>
+    <function-decl name='PyThreadState_SetAsyncExc' mangled-name='PyThreadState_SetAsyncExc' filepath='Python/pystate.c' line='1124' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThreadState_SetAsyncExc'>
+      <parameter type-id='type-id-19' name='id' filepath='Python/pystate.c' line='1124' column='1'/>
+      <parameter type-id='type-id-16' name='exc' filepath='Python/pystate.c' line='1124' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyThreadState_GetID' mangled-name='PyThreadState_GetID' filepath='Python/pystate.c' line='1108' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThreadState_GetID'>
+      <parameter type-id='type-id-331' name='tstate' filepath='Python/pystate.c' line='1108' column='1'/>
+      <return type-id='type-id-22'/>
+    </function-decl>
+    <function-decl name='PyThreadState_GetFrame' mangled-name='PyThreadState_GetFrame' filepath='Python/pystate.c' line='1098' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThreadState_GetFrame'>
+      <parameter type-id='type-id-331' name='tstate' filepath='Python/pystate.c' line='1098' column='1'/>
+      <return type-id='type-id-13'/>
+    </function-decl>
+    <function-decl name='PyThreadState_GetInterpreter' mangled-name='PyThreadState_GetInterpreter' filepath='Python/pystate.c' line='1090' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThreadState_GetInterpreter'>
+      <parameter type-id='type-id-331' name='tstate' filepath='Python/pystate.c' line='1090' column='1'/>
+      <return type-id='type-id-222'/>
+    </function-decl>
+    <function-decl name='PyThreadState_GetDict' mangled-name='PyThreadState_GetDict' filepath='Python/pystate.c' line='1079' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThreadState_GetDict'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyThreadState_GetDict' mangled-name='_PyThreadState_GetDict' filepath='Python/pystate.c' line='1065' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyThreadState_GetDict'>
+      <parameter type-id='type-id-331' name='tstate' filepath='Python/pystate.c' line='1065' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyThreadState_Swap' mangled-name='PyThreadState_Swap' filepath='Python/pystate.c' line='1053' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThreadState_Swap'>
+      <parameter type-id='type-id-331' name='newts' filepath='Python/pystate.c' line='1053' column='1'/>
+      <return type-id='type-id-331'/>
+    </function-decl>
+    <pointer-type-def type-id='type-id-256' size-in-bits='64' id='type-id-798'/>
+    <function-decl name='_PyThreadState_Swap' mangled-name='_PyThreadState_Swap' filepath='Python/pystate.c' line='1021' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyThreadState_Swap'>
+      <parameter type-id='type-id-798' name='gilstate' filepath='Python/pystate.c' line='1021' column='1'/>
+      <parameter type-id='type-id-331' name='newts' filepath='Python/pystate.c' line='1021' column='1'/>
+      <return type-id='type-id-331'/>
+    </function-decl>
+    <function-decl name='PyThreadState_Get' mangled-name='PyThreadState_Get' filepath='Python/pystate.c' line='1012' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThreadState_Get'>
+      <return type-id='type-id-331'/>
+    </function-decl>
+    <function-decl name='_PyThreadState_UncheckedGet' mangled-name='_PyThreadState_UncheckedGet' filepath='Python/pystate.c' line='1005' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyThreadState_UncheckedGet'>
+      <return type-id='type-id-331'/>
+    </function-decl>
+    <typedef-decl name='_PyRuntimeState' type-id='type-id-250' filepath='./Include/internal/pycore_runtime.h' line='121' column='1' id='type-id-799'/>
+    <pointer-type-def type-id='type-id-799' size-in-bits='64' id='type-id-800'/>
+    <function-decl name='_PyThreadState_DeleteExcept' mangled-name='_PyThreadState_DeleteExcept' filepath='Python/pystate.c' line='962' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyThreadState_DeleteExcept'>
+      <parameter type-id='type-id-800' name='runtime' filepath='Python/pystate.c' line='962' column='1'/>
+      <parameter type-id='type-id-331' name='tstate' filepath='Python/pystate.c' line='962' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyThreadState_DeleteCurrent' mangled-name='PyThreadState_DeleteCurrent' filepath='Python/pystate.c' line='946' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThreadState_DeleteCurrent'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyThreadState_DeleteCurrent' mangled-name='_PyThreadState_DeleteCurrent' filepath='Python/pystate.c' line='935' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyThreadState_DeleteCurrent'>
+      <parameter type-id='type-id-331' name='tstate' filepath='Python/pystate.c' line='935' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyThreadState_Delete' mangled-name='PyThreadState_Delete' filepath='Python/pystate.c' line='928' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThreadState_Delete'>
+      <parameter type-id='type-id-331' name='tstate' filepath='Python/pystate.c' line='928' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyThreadState_Clear' mangled-name='PyThreadState_Clear' filepath='Python/pystate.c' line='830' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThreadState_Clear'>
+      <parameter type-id='type-id-331' name='tstate' filepath='Python/pystate.c' line='830' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyState_RemoveModule' mangled-name='PyState_RemoveModule' filepath='Python/pystate.c' line='773' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyState_RemoveModule'>
+      <parameter type-id='type-id-505' name='def' filepath='Python/pystate.c' line='773' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyState_AddModule' mangled-name='PyState_AddModule' filepath='Python/pystate.c' line='752' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyState_AddModule'>
+      <parameter type-id='type-id-16' name='module' filepath='Python/pystate.c' line='752' column='1'/>
+      <parameter type-id='type-id-505' name='def' filepath='Python/pystate.c' line='752' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyState_FindModule' mangled-name='PyState_FindModule' filepath='Python/pystate.c' line='700' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyState_FindModule'>
+      <parameter type-id='type-id-505' name='module' filepath='Python/pystate.c' line='700' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyThreadState_Init' mangled-name='_PyThreadState_Init' filepath='Python/pystate.c' line='694' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyThreadState_Init'>
+      <parameter type-id='type-id-331' name='tstate' filepath='Python/pystate.c' line='928' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyThreadState_Prealloc' mangled-name='_PyThreadState_Prealloc' filepath='Python/pystate.c' line='688' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyThreadState_Prealloc'>
+      <parameter type-id='type-id-222' name='interp' filepath='Python/pystate.c' line='688' column='1'/>
+      <return type-id='type-id-331'/>
+    </function-decl>
+    <function-decl name='PyThreadState_New' mangled-name='PyThreadState_New' filepath='Python/pystate.c' line='682' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThreadState_New'>
+      <parameter type-id='type-id-222' name='interp' filepath='Python/pystate.c' line='688' column='1'/>
+      <return type-id='type-id-331'/>
+    </function-decl>
+    <function-decl name='PyInterpreterState_GetDict' mangled-name='PyInterpreterState_GetDict' filepath='Python/pystate.c' line='601' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInterpreterState_GetDict'>
+      <parameter type-id='type-id-222' name='interp' filepath='Python/pystate.c' line='601' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyInterpreterState_GetMainModule' mangled-name='_PyInterpreterState_GetMainModule' filepath='Python/pystate.c' line='591' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyInterpreterState_GetMainModule'>
+      <parameter type-id='type-id-222' name='interp' filepath='Python/pystate.c' line='601' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyInterpreterState_RequireIDRef' mangled-name='_PyInterpreterState_RequireIDRef' filepath='Python/pystate.c' line='585' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyInterpreterState_RequireIDRef'>
+      <parameter type-id='type-id-222' name='interp' filepath='Python/pystate.c' line='585' column='1'/>
+      <parameter type-id='type-id-9' name='required' filepath='Python/pystate.c' line='585' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyInterpreterState_RequiresIDRef' mangled-name='_PyInterpreterState_RequiresIDRef' filepath='Python/pystate.c' line='579' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyInterpreterState_RequiresIDRef'>
+      <parameter type-id='type-id-222' name='interp' filepath='Python/import.c' line='285' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyInterpreterState_IDDecref' mangled-name='_PyInterpreterState_IDDecref' filepath='Python/pystate.c' line='557' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyInterpreterState_IDDecref'>
+      <parameter type-id='type-id-222' name='interp' filepath='Python/pystate.c' line='557' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyInterpreterState_IDIncref' mangled-name='_PyInterpreterState_IDIncref' filepath='Python/pystate.c' line='543' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyInterpreterState_IDIncref'>
+      <parameter type-id='type-id-222' name='interp' filepath='Python/pystate.c' line='543' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyInterpreterState_LookUpID' mangled-name='_PyInterpreterState_LookUpID' filepath='Python/pystate.c' line='508' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyInterpreterState_LookUpID'>
+      <parameter type-id='type-id-227' name='requested_id' filepath='Python/pystate.c' line='508' column='1'/>
+      <return type-id='type-id-222'/>
+    </function-decl>
+    <function-decl name='PyInterpreterState_Delete' mangled-name='PyInterpreterState_Delete' filepath='Python/pystate.c' line='378' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInterpreterState_Delete'>
+      <parameter type-id='type-id-222' name='interp' filepath='Python/pystate.c' line='378' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyInterpreterState_Clear' mangled-name='PyInterpreterState_Clear' filepath='Python/pystate.c' line='347' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInterpreterState_Clear'>
+      <parameter type-id='type-id-222' name='interp' filepath='Python/pystate.c' line='347' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyInterpreterState_New' mangled-name='PyInterpreterState_New' filepath='Python/pystate.c' line='207' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInterpreterState_New'>
+      <return type-id='type-id-222'/>
+    </function-decl>
+    <function-decl name='_PyInterpreterState_Enable' mangled-name='_PyInterpreterState_Enable' filepath='Python/pystate.c' line='181' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyInterpreterState_Enable'>
+      <parameter type-id='type-id-800' name='runtime' filepath='Python/pystate.c' line='181' column='1'/>
+      <return type-id='type-id-743'/>
+    </function-decl>
+    <function-decl name='_PyRuntimeState_Fini' mangled-name='_PyRuntimeState_Fini' filepath='Python/pystate.c' line='116' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyRuntimeState_Fini'>
+      <parameter type-id='type-id-800' name='runtime' filepath='Python/pystate.c' line='116' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyRuntimeState_Init' mangled-name='_PyRuntimeState_Init' filepath='Python/pystate.c' line='102' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyRuntimeState_Init'>
+      <parameter type-id='type-id-800' name='runtime' filepath='Python/pystate.c' line='102' column='1'/>
+      <return type-id='type-id-743'/>
+    </function-decl>
+    <function-decl name='PyInterpreterState_Get' mangled-name='PyInterpreterState_Get' filepath='Python/pystate.c' line='467' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInterpreterState_Get'>
+      <return type-id='type-id-222'/>
+    </function-decl>
+    <function-decl name='PyInterpreterState_GetID' mangled-name='PyInterpreterState_GetID' filepath='Python/pystate.c' line='480' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInterpreterState_GetID'>
+      <parameter type-id='type-id-222' name='interp' filepath='Python/pystate.c' line='480' column='1'/>
+      <return type-id='type-id-227'/>
+    </function-decl>
+    <function-decl name='_PyInterpreterState_IDInitref' mangled-name='_PyInterpreterState_IDInitref' filepath='Python/pystate.c' line='526' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyInterpreterState_IDInitref'>
+      <parameter type-id='type-id-222' name='interp' filepath='Python/pystate.c' line='526' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyState_AddModule' mangled-name='_PyState_AddModule' filepath='Python/pystate.c' line='719' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyState_AddModule'>
+      <parameter type-id='type-id-331' name='tstate' filepath='Python/pystate.c' line='719' column='1'/>
+      <parameter type-id='type-id-16' name='module' filepath='Python/pystate.c' line='719' column='1'/>
+      <parameter type-id='type-id-505' name='def' filepath='Python/pystate.c' line='719' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyThread_tss_get' mangled-name='PyThread_tss_get' filepath='./Include/pythread.h' line='162' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyThread_tss_is_created' mangled-name='PyThread_tss_is_created' filepath='./Include/pythread.h' line='158' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyThread_tss_delete' mangled-name='PyThread_tss_delete' filepath='./Include/pythread.h' line='160' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyThread_tss_create' mangled-name='PyThread_tss_create' filepath='./Include/pythread.h' line='159' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyThread_tss_set' mangled-name='PyThread_tss_set' filepath='./Include/pythread.h' line='161' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyEval_SignalAsyncExc' mangled-name='_PyEval_SignalAsyncExc' filepath='./Include/internal/pycore_ceval.h' line='26' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyEval_ReleaseLock' mangled-name='_PyEval_ReleaseLock' filepath='./Include/internal/pycore_ceval.h' line='63' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyList_SetItem' mangled-name='PyList_SetItem' filepath='./Include/listobject.h' line='32' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyMapping_GetItemString' mangled-name='PyMapping_GetItemString' filepath='./Include/abstract.h' line='848' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='Py_EndInterpreter' mangled-name='Py_EndInterpreter' filepath='./Include/pylifecycle.h' line='22' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyEval_FiniState' mangled-name='_PyEval_FiniState' filepath='./Include/internal/pycore_ceval.h' line='20' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAST_Fini' mangled-name='_PyAST_Fini' filepath='./Include/internal/pycore_pylifecycle.h' line='109' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyWarnings_Fini' mangled-name='_PyWarnings_Fini' filepath='./Include/internal/pycore_pylifecycle.h' line='108' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAtExit_Fini' mangled-name='_PyAtExit_Fini' filepath='./Include/internal/pycore_pylifecycle.h' line='110' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyGC_Fini' mangled-name='_PyGC_Fini' filepath='./Include/internal/pycore_pylifecycle.h' line='99' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyMem_RawCalloc' mangled-name='PyMem_RawCalloc' filepath='./Include/cpython/pymem.h' line='6' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyEval_InitState' mangled-name='_PyEval_InitState' filepath='./Include/internal/pycore_ceval.h' line='19' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyGC_InitState' mangled-name='_PyGC_InitState' filepath='./Include/internal/pycore_gc.h' line='164' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyType_InitCache' mangled-name='_PyType_InitCache' filepath='./Include/internal/pycore_object.h' line='30' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyEval_InitRuntimeState' mangled-name='_PyEval_InitRuntimeState' filepath='./Include/internal/pycore_ceval.h' line='18' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyPreConfig_InitPythonConfig' mangled-name='PyPreConfig_InitPythonConfig' filepath='./Include/cpython/initconfig.h' line='127' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/pythonrun.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='PyRun_InteractiveLoop' mangled-name='PyRun_InteractiveLoop' filepath='Python/pythonrun.c' line='1582' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyRun_InteractiveLoop'>
+      <parameter type-id='type-id-188' name='f' filepath='Python/pythonrun.c' line='1582' column='1'/>
+      <parameter type-id='type-id-3' name='p' filepath='Python/pythonrun.c' line='1582' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyRun_InteractiveOne' mangled-name='PyRun_InteractiveOne' filepath='Python/pythonrun.c' line='1575' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyRun_InteractiveOne'>
+      <parameter type-id='type-id-188' name='f' filepath='Python/pythonrun.c' line='1582' column='1'/>
+      <parameter type-id='type-id-3' name='p' filepath='Python/pythonrun.c' line='1582' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='Py_CompileStringFlags' mangled-name='Py_CompileStringFlags' filepath='Python/pythonrun.c' line='1567' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_CompileStringFlags'>
+      <parameter type-id='type-id-3' name='str' filepath='Python/pythonrun.c' line='1567' column='1'/>
+      <parameter type-id='type-id-3' name='p' filepath='Python/pythonrun.c' line='1567' column='1'/>
+      <parameter type-id='type-id-9' name='s' filepath='Python/pythonrun.c' line='1567' column='1'/>
+      <parameter type-id='type-id-522' name='flags' filepath='Python/pythonrun.c' line='1568' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='Py_CompileString' mangled-name='Py_CompileString' filepath='Python/pythonrun.c' line='1560' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_CompileString'>
+      <parameter type-id='type-id-3' name='str' filepath='Python/pythonrun.c' line='1560' column='1'/>
+      <parameter type-id='type-id-3' name='p' filepath='Python/pythonrun.c' line='1560' column='1'/>
+      <parameter type-id='type-id-9' name='s' filepath='Python/pythonrun.c' line='1560' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyRun_SimpleString' mangled-name='PyRun_SimpleString' filepath='Python/pythonrun.c' line='1553' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyRun_SimpleString'>
+      <parameter type-id='type-id-3' name='s' filepath='Python/pythonrun.c' line='1553' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyRun_String' mangled-name='PyRun_String' filepath='Python/pythonrun.c' line='1546' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyRun_String'>
+      <parameter type-id='type-id-3' name='str' filepath='Python/pythonrun.c' line='1546' column='1'/>
+      <parameter type-id='type-id-9' name='s' filepath='Python/pythonrun.c' line='1546' column='1'/>
+      <parameter type-id='type-id-16' name='g' filepath='Python/pythonrun.c' line='1546' column='1'/>
+      <parameter type-id='type-id-16' name='l' filepath='Python/pythonrun.c' line='1546' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyRun_SimpleFileEx' mangled-name='PyRun_SimpleFileEx' filepath='Python/pythonrun.c' line='1538' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyRun_SimpleFileEx'>
+      <parameter type-id='type-id-188' name='f' filepath='Python/pythonrun.c' line='1538' column='1'/>
+      <parameter type-id='type-id-3' name='p' filepath='Python/pythonrun.c' line='1538' column='1'/>
+      <parameter type-id='type-id-9' name='c' filepath='Python/pythonrun.c' line='1538' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyRun_SimpleFile' mangled-name='PyRun_SimpleFile' filepath='Python/pythonrun.c' line='1531' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyRun_SimpleFile'>
+      <parameter type-id='type-id-188' name='f' filepath='Python/pythonrun.c' line='1582' column='1'/>
+      <parameter type-id='type-id-3' name='p' filepath='Python/pythonrun.c' line='1582' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyRun_FileFlags' mangled-name='PyRun_FileFlags' filepath='Python/pythonrun.c' line='1523' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyRun_FileFlags'>
+      <parameter type-id='type-id-188' name='fp' filepath='Python/pythonrun.c' line='1523' column='1'/>
+      <parameter type-id='type-id-3' name='p' filepath='Python/pythonrun.c' line='1523' column='1'/>
+      <parameter type-id='type-id-9' name='s' filepath='Python/pythonrun.c' line='1523' column='1'/>
+      <parameter type-id='type-id-16' name='g' filepath='Python/pythonrun.c' line='1523' column='1'/>
+      <parameter type-id='type-id-16' name='l' filepath='Python/pythonrun.c' line='1523' column='1'/>
+      <parameter type-id='type-id-522' name='flags' filepath='Python/pythonrun.c' line='1524' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyRun_FileEx' mangled-name='PyRun_FileEx' filepath='Python/pythonrun.c' line='1516' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyRun_FileEx'>
+      <parameter type-id='type-id-188' name='fp' filepath='Python/pythonrun.c' line='1516' column='1'/>
+      <parameter type-id='type-id-3' name='p' filepath='Python/pythonrun.c' line='1516' column='1'/>
+      <parameter type-id='type-id-9' name='s' filepath='Python/pythonrun.c' line='1516' column='1'/>
+      <parameter type-id='type-id-16' name='g' filepath='Python/pythonrun.c' line='1516' column='1'/>
+      <parameter type-id='type-id-16' name='l' filepath='Python/pythonrun.c' line='1516' column='1'/>
+      <parameter type-id='type-id-9' name='c' filepath='Python/pythonrun.c' line='1516' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyRun_File' mangled-name='PyRun_File' filepath='Python/pythonrun.c' line='1509' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyRun_File'>
+      <parameter type-id='type-id-188' name='fp' filepath='Python/pythonrun.c' line='1509' column='1'/>
+      <parameter type-id='type-id-3' name='p' filepath='Python/pythonrun.c' line='1509' column='1'/>
+      <parameter type-id='type-id-9' name='s' filepath='Python/pythonrun.c' line='1509' column='1'/>
+      <parameter type-id='type-id-16' name='g' filepath='Python/pythonrun.c' line='1509' column='1'/>
+      <parameter type-id='type-id-16' name='l' filepath='Python/pythonrun.c' line='1509' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyRun_AnyFileFlags' mangled-name='PyRun_AnyFileFlags' filepath='Python/pythonrun.c' line='1502' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyRun_AnyFileFlags'>
+      <parameter type-id='type-id-188' name='fp' filepath='Python/pythonrun.c' line='1502' column='1'/>
+      <parameter type-id='type-id-3' name='name' filepath='Python/pythonrun.c' line='1502' column='1'/>
+      <parameter type-id='type-id-522' name='flags' filepath='Python/pythonrun.c' line='1502' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyRun_AnyFileEx' mangled-name='PyRun_AnyFileEx' filepath='Python/pythonrun.c' line='1495' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyRun_AnyFileEx'>
+      <parameter type-id='type-id-188' name='f' filepath='Python/pythonrun.c' line='1538' column='1'/>
+      <parameter type-id='type-id-3' name='p' filepath='Python/pythonrun.c' line='1538' column='1'/>
+      <parameter type-id='type-id-9' name='c' filepath='Python/pythonrun.c' line='1538' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyRun_AnyFile' mangled-name='PyRun_AnyFile' filepath='Python/pythonrun.c' line='1488' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyRun_AnyFile'>
+      <parameter type-id='type-id-188' name='f' filepath='Python/pythonrun.c' line='1582' column='1'/>
+      <parameter type-id='type-id-3' name='p' filepath='Python/pythonrun.c' line='1582' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_Py_SourceAsString' mangled-name='_Py_SourceAsString' filepath='Python/pythonrun.c' line='1399' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_SourceAsString'>
+      <parameter type-id='type-id-16' name='cmd' filepath='Python/pythonrun.c' line='1399' column='1'/>
+      <parameter type-id='type-id-3' name='funcname' filepath='Python/pythonrun.c' line='1399' column='1'/>
+      <parameter type-id='type-id-3' name='what' filepath='Python/pythonrun.c' line='1399' column='1'/>
+      <parameter type-id='type-id-522' name='cf' filepath='Python/pythonrun.c' line='1399' column='1'/>
+      <parameter type-id='type-id-86' name='cmd_copy' filepath='Python/pythonrun.c' line='1399' column='1'/>
+      <return type-id='type-id-3'/>
+    </function-decl>
+    <function-decl name='Py_CompileStringExFlags' mangled-name='Py_CompileStringExFlags' filepath='Python/pythonrun.c' line='1386' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_CompileStringExFlags'>
+      <parameter type-id='type-id-3' name='str' filepath='Python/pythonrun.c' line='1386' column='1'/>
+      <parameter type-id='type-id-3' name='filename_str' filepath='Python/pythonrun.c' line='1386' column='1'/>
+      <parameter type-id='type-id-9' name='start' filepath='Python/pythonrun.c' line='1386' column='1'/>
+      <parameter type-id='type-id-522' name='flags' filepath='Python/pythonrun.c' line='1387' column='1'/>
+      <parameter type-id='type-id-9' name='optimize' filepath='Python/pythonrun.c' line='1387' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='Py_CompileStringObject' mangled-name='Py_CompileStringObject' filepath='Python/pythonrun.c' line='1361' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_CompileStringObject'>
+      <parameter type-id='type-id-3' name='str' filepath='Python/pythonrun.c' line='1361' column='1'/>
+      <parameter type-id='type-id-16' name='filename' filepath='Python/pythonrun.c' line='1361' column='1'/>
+      <parameter type-id='type-id-9' name='start' filepath='Python/pythonrun.c' line='1361' column='1'/>
+      <parameter type-id='type-id-522' name='flags' filepath='Python/pythonrun.c' line='1362' column='1'/>
+      <parameter type-id='type-id-9' name='optimize' filepath='Python/pythonrun.c' line='1362' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyRun_FileExFlags' mangled-name='PyRun_FileExFlags' filepath='Python/pythonrun.c' line='1220' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyRun_FileExFlags'>
+      <parameter type-id='type-id-188' name='fp' filepath='Python/pythonrun.c' line='1220' column='1'/>
+      <parameter type-id='type-id-3' name='filename' filepath='Python/pythonrun.c' line='1220' column='1'/>
+      <parameter type-id='type-id-9' name='start' filepath='Python/pythonrun.c' line='1220' column='1'/>
+      <parameter type-id='type-id-16' name='globals' filepath='Python/pythonrun.c' line='1220' column='1'/>
+      <parameter type-id='type-id-16' name='locals' filepath='Python/pythonrun.c' line='1221' column='1'/>
+      <parameter type-id='type-id-9' name='closeit' filepath='Python/pythonrun.c' line='1221' column='1'/>
+      <parameter type-id='type-id-522' name='flags' filepath='Python/pythonrun.c' line='1221' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyRun_StringFlags' mangled-name='PyRun_StringFlags' filepath='Python/pythonrun.c' line='1164' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyRun_StringFlags'>
+      <parameter type-id='type-id-3' name='str' filepath='Python/pythonrun.c' line='1164' column='1'/>
+      <parameter type-id='type-id-9' name='start' filepath='Python/pythonrun.c' line='1164' column='1'/>
+      <parameter type-id='type-id-16' name='globals' filepath='Python/pythonrun.c' line='1164' column='1'/>
+      <parameter type-id='type-id-16' name='locals' filepath='Python/pythonrun.c' line='1165' column='1'/>
+      <parameter type-id='type-id-522' name='flags' filepath='Python/pythonrun.c' line='1165' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyErr_Display' mangled-name='_PyErr_Display' filepath='Python/pythonrun.c' line='1109' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyErr_Display'>
+      <parameter type-id='type-id-16' name='file' filepath='Python/pythonrun.c' line='1109' column='1'/>
+      <parameter type-id='type-id-16' name='exception' filepath='Python/pythonrun.c' line='1109' column='1'/>
+      <parameter type-id='type-id-16' name='value' filepath='Python/pythonrun.c' line='1109' column='1'/>
+      <parameter type-id='type-id-16' name='tb' filepath='Python/pythonrun.c' line='1109' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_PrintEx' mangled-name='PyErr_PrintEx' filepath='Python/pythonrun.c' line='877' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_PrintEx'>
+      <parameter type-id='type-id-9' name='set_sys_last_vars' filepath='Python/pythonrun.c' line='877' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_Print' mangled-name='_PyErr_Print' filepath='Python/pythonrun.c' line='871' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyErr_Print'>
+      <parameter type-id='type-id-331' name='tstate' filepath='Python/pythonrun.c' line='871' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyRun_SimpleStringFlags' mangled-name='PyRun_SimpleStringFlags' filepath='Python/pythonrun.c' line='496' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyRun_SimpleStringFlags'>
+      <parameter type-id='type-id-3' name='command' filepath='Python/pythonrun.c' line='496' column='1'/>
+      <parameter type-id='type-id-522' name='flags' filepath='Python/pythonrun.c' line='496' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyRun_SimpleFileExFlags' mangled-name='PyRun_SimpleFileExFlags' filepath='Python/pythonrun.c' line='482' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyRun_SimpleFileExFlags'>
+      <parameter type-id='type-id-188' name='fp' filepath='Python/pythonrun.c' line='482' column='1'/>
+      <parameter type-id='type-id-3' name='filename' filepath='Python/pythonrun.c' line='482' column='1'/>
+      <parameter type-id='type-id-9' name='closeit' filepath='Python/pythonrun.c' line='482' column='1'/>
+      <parameter type-id='type-id-522' name='flags' filepath='Python/pythonrun.c' line='483' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyRun_SimpleFileObject' mangled-name='_PyRun_SimpleFileObject' filepath='Python/pythonrun.c' line='399' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyRun_SimpleFileObject'>
+      <parameter type-id='type-id-188' name='fp' filepath='Python/pythonrun.c' line='399' column='1'/>
+      <parameter type-id='type-id-16' name='filename' filepath='Python/pythonrun.c' line='399' column='1'/>
+      <parameter type-id='type-id-9' name='closeit' filepath='Python/pythonrun.c' line='399' column='1'/>
+      <parameter type-id='type-id-522' name='flags' filepath='Python/pythonrun.c' line='400' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyRun_InteractiveOneFlags' mangled-name='PyRun_InteractiveOneFlags' filepath='Python/pythonrun.c' line='301' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyRun_InteractiveOneFlags'>
+      <parameter type-id='type-id-188' name='fp' filepath='Python/pythonrun.c' line='301' column='1'/>
+      <parameter type-id='type-id-3' name='filename_str' filepath='Python/pythonrun.c' line='301' column='1'/>
+      <parameter type-id='type-id-522' name='flags' filepath='Python/pythonrun.c' line='301' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyRun_InteractiveOneObject' mangled-name='PyRun_InteractiveOneObject' filepath='Python/pythonrun.c' line='288' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyRun_InteractiveOneObject'>
+      <parameter type-id='type-id-188' name='fp' filepath='Python/pythonrun.c' line='288' column='1'/>
+      <parameter type-id='type-id-16' name='filename' filepath='Python/pythonrun.c' line='288' column='1'/>
+      <parameter type-id='type-id-522' name='flags' filepath='Python/pythonrun.c' line='288' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyRun_InteractiveLoopFlags' mangled-name='PyRun_InteractiveLoopFlags' filepath='Python/pythonrun.c' line='178' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyRun_InteractiveLoopFlags'>
+      <parameter type-id='type-id-188' name='fp' filepath='Python/pythonrun.c' line='301' column='1'/>
+      <parameter type-id='type-id-3' name='filename_str' filepath='Python/pythonrun.c' line='301' column='1'/>
+      <parameter type-id='type-id-522' name='flags' filepath='Python/pythonrun.c' line='301' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyRun_InteractiveLoopObject' mangled-name='_PyRun_InteractiveLoopObject' filepath='Python/pythonrun.c' line='123' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyRun_InteractiveLoopObject'>
+      <parameter type-id='type-id-188' name='fp' filepath='Python/pythonrun.c' line='123' column='1'/>
+      <parameter type-id='type-id-16' name='filename' filepath='Python/pythonrun.c' line='123' column='1'/>
+      <parameter type-id='type-id-522' name='flags' filepath='Python/pythonrun.c' line='123' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyRun_AnyFileExFlags' mangled-name='PyRun_AnyFileExFlags' filepath='Python/pythonrun.c' line='102' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyRun_AnyFileExFlags'>
+      <parameter type-id='type-id-188' name='fp' filepath='Python/pythonrun.c' line='102' column='1'/>
+      <parameter type-id='type-id-3' name='filename' filepath='Python/pythonrun.c' line='102' column='1'/>
+      <parameter type-id='type-id-9' name='closeit' filepath='Python/pythonrun.c' line='102' column='1'/>
+      <parameter type-id='type-id-522' name='flags' filepath='Python/pythonrun.c' line='103' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyRun_AnyFileObject' mangled-name='_PyRun_AnyFileObject' filepath='Python/pythonrun.c' line='69' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyRun_AnyFileObject'>
+      <parameter type-id='type-id-188' name='fp' filepath='Python/pythonrun.c' line='69' column='1'/>
+      <parameter type-id='type-id-16' name='filename' filepath='Python/pythonrun.c' line='69' column='1'/>
+      <parameter type-id='type-id-9' name='closeit' filepath='Python/pythonrun.c' line='69' column='1'/>
+      <parameter type-id='type-id-522' name='flags' filepath='Python/pythonrun.c' line='70' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_Py_HandleSystemExit' mangled-name='_Py_HandleSystemExit' filepath='Python/pythonrun.c' line='700' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_HandleSystemExit'>
+      <parameter type-id='type-id-452' name='exitcode_p' filepath='Python/pythonrun.c' line='700' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyErr_Display' mangled-name='PyErr_Display' filepath='Python/pythonrun.c' line='1147' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_Display'>
+      <parameter type-id='type-id-16' name='exception' filepath='Python/pythonrun.c' line='1147' column='1'/>
+      <parameter type-id='type-id-16' name='value' filepath='Python/pythonrun.c' line='1147' column='1'/>
+      <parameter type-id='type-id-16' name='tb' filepath='Python/pythonrun.c' line='1147' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyAST_mod2obj' mangled-name='PyAST_mod2obj' filepath='./Include/internal/pycore_ast.h' line='838' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyParser_ASTFromString' mangled-name='_PyParser_ASTFromString' filepath='./Include/internal/pycore_parser.h' line='11' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyParser_ASTFromFile' mangled-name='_PyParser_ASTFromFile' filepath='./Include/internal/pycore_parser.h' line='17' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyException_GetCause' mangled-name='PyException_GetCause' filepath='./Include/pyerrors.h' line='43' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_Offer_Suggestions' mangled-name='_Py_Offer_Suggestions' filepath='./Include/internal/pycore_pyerrors.h' line='89' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='Py_Exit' mangled-name='Py_Exit' filepath='./Include/pylifecycle.h' line='30' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyMarshal_ReadLongFromFile' mangled-name='PyMarshal_ReadLongFromFile' filepath='./Include/marshal.h' line='17' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyImport_GetMagicNumber' mangled-name='PyImport_GetMagicNumber' filepath='Python/pythonrun.c' line='1325' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyMarshal_ReadLastObjectFromFile' mangled-name='PyMarshal_ReadLastObjectFromFile' filepath='./Include/marshal.h' line='20' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_Tailmatch' mangled-name='PyUnicode_Tailmatch' filepath='./Include/unicodeobject.h' line='930' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='rewind' mangled-name='rewind' filepath='/usr/include/stdio.h' line='694' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyImport_AddModuleObject' mangled-name='PyImport_AddModuleObject' filepath='./Include/import.h' line='39' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_FdIsInteractive' mangled-name='_Py_FdIsInteractive' filepath='./Include/cpython/pylifecycle.h' line='46' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_Print' mangled-name='PyObject_Print' filepath='./Include/cpython/object.h' line='310' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObject_Dump' mangled-name='_PyObject_Dump' filepath='./Include/cpython/object.h' line='312' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/pytime.c' comp-dir-path='/src' language='LANG_C99'>
+    <typedef-decl name='__time_t' type-id='type-id-33' filepath='/usr/include/x86_64-linux-gnu/bits/types.h' line='160' column='1' id='type-id-801'/>
+    <typedef-decl name='time_t' type-id='type-id-801' filepath='/usr/include/x86_64-linux-gnu/bits/types/time_t.h' line='7' column='1' id='type-id-802'/>
+    <class-decl name='tm' size-in-bits='448' is-struct='yes' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_tm.h' line='7' column='1' id='type-id-803'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='tm_sec' type-id='type-id-9' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_tm.h' line='9' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='32'>
+        <var-decl name='tm_min' type-id='type-id-9' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_tm.h' line='10' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='tm_hour' type-id='type-id-9' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_tm.h' line='11' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='96'>
+        <var-decl name='tm_mday' type-id='type-id-9' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_tm.h' line='12' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='tm_mon' type-id='type-id-9' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_tm.h' line='13' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='160'>
+        <var-decl name='tm_year' type-id='type-id-9' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_tm.h' line='14' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='tm_wday' type-id='type-id-9' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_tm.h' line='15' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='224'>
+        <var-decl name='tm_yday' type-id='type-id-9' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_tm.h' line='16' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='tm_isdst' type-id='type-id-9' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_tm.h' line='17' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='tm_gmtoff' type-id='type-id-33' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_tm.h' line='20' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='384'>
+        <var-decl name='tm_zone' type-id='type-id-3' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_tm.h' line='21' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-803' size-in-bits='64' id='type-id-804'/>
+    <function-decl name='_PyTime_gmtime' mangled-name='_PyTime_gmtime' filepath='Python/pytime.c' line='1125' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTime_gmtime'>
+      <parameter type-id='type-id-802' name='t' filepath='Python/pytime.c' line='1125' column='1'/>
+      <parameter type-id='type-id-804' name='tm' filepath='Python/pytime.c' line='1125' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyTime_localtime' mangled-name='_PyTime_localtime' filepath='Python/pytime.c' line='1087' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTime_localtime'>
+      <parameter type-id='type-id-802' name='t' filepath='Python/pytime.c' line='1125' column='1'/>
+      <parameter type-id='type-id-804' name='tm' filepath='Python/pytime.c' line='1125' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <typedef-decl name='_PyTime_t' type-id='type-id-227' filepath='./Include/cpython/pytime.h' line='16' column='1' id='type-id-805'/>
+    <pointer-type-def type-id='type-id-805' size-in-bits='64' id='type-id-806'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='192' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-807' visibility='default' filepath='./Include/cpython/pytime.h' line='165' column='1' id='type-id-808'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='implementation' type-id='type-id-3' visibility='default' filepath='./Include/cpython/pytime.h' line='166' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='monotonic' type-id='type-id-9' visibility='default' filepath='./Include/cpython/pytime.h' line='167' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='96'>
+        <var-decl name='adjustable' type-id='type-id-9' visibility='default' filepath='./Include/cpython/pytime.h' line='168' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='resolution' type-id='type-id-371' visibility='default' filepath='./Include/cpython/pytime.h' line='169' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='_Py_clock_info_t' type-id='type-id-808' filepath='./Include/cpython/pytime.h' line='170' column='1' id='type-id-807'/>
+    <pointer-type-def type-id='type-id-807' size-in-bits='64' id='type-id-809'/>
+    <function-decl name='_PyTime_GetPerfCounterWithInfo' mangled-name='_PyTime_GetPerfCounterWithInfo' filepath='Python/pytime.c' line='1057' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTime_GetPerfCounterWithInfo'>
+      <parameter type-id='type-id-806' name='t' filepath='Python/pytime.c' line='1057' column='1'/>
+      <parameter type-id='type-id-809' name='info' filepath='Python/pytime.c' line='1057' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyTime_GetMonotonicClockWithInfo' mangled-name='_PyTime_GetMonotonicClockWithInfo' filepath='Python/pytime.c' line='966' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTime_GetMonotonicClockWithInfo'>
+      <parameter type-id='type-id-806' name='tp' filepath='Python/pytime.c' line='966' column='1'/>
+      <parameter type-id='type-id-809' name='info' filepath='Python/pytime.c' line='966' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyTime_GetSystemClockWithInfo' mangled-name='_PyTime_GetSystemClockWithInfo' filepath='Python/pytime.c' line='781' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTime_GetSystemClockWithInfo'>
+      <parameter type-id='type-id-806' name='tp' filepath='Python/pytime.c' line='966' column='1'/>
+      <parameter type-id='type-id-809' name='info' filepath='Python/pytime.c' line='966' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyTime_GetSystemClock' mangled-name='_PyTime_GetSystemClock' filepath='Python/pytime.c' line='769' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTime_GetSystemClock'>
+      <return type-id='type-id-805'/>
+    </function-decl>
+    <class-decl name='timespec' size-in-bits='128' is-struct='yes' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_timespec.h' line='10' column='1' id='type-id-810'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='tv_sec' type-id='type-id-801' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_timespec.h' line='12' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='tv_nsec' type-id='type-id-811' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_timespec.h' line='16' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='__syscall_slong_t' type-id='type-id-33' filepath='/usr/include/x86_64-linux-gnu/bits/types.h' line='196' column='1' id='type-id-811'/>
+    <pointer-type-def type-id='type-id-810' size-in-bits='64' id='type-id-812'/>
+    <function-decl name='_PyTime_AsTimespec' mangled-name='_PyTime_AsTimespec' filepath='Python/pytime.c' line='636' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTime_AsTimespec'>
+      <parameter type-id='type-id-805' name='t' filepath='Python/pytime.c' line='636' column='1'/>
+      <parameter type-id='type-id-812' name='ts' filepath='Python/pytime.c' line='636' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <pointer-type-def type-id='type-id-802' size-in-bits='64' id='type-id-813'/>
+    <enum-decl name='__anonymous_enum__' is-anonymous='yes' filepath='./Include/cpython/pytime.h' line='20' column='1' id='type-id-814'>
+      <underlying-type type-id='type-id-83'/>
+      <enumerator name='_PyTime_ROUND_FLOOR' value='0'/>
+      <enumerator name='_PyTime_ROUND_CEILING' value='1'/>
+      <enumerator name='_PyTime_ROUND_HALF_EVEN' value='2'/>
+      <enumerator name='_PyTime_ROUND_UP' value='3'/>
+      <enumerator name='_PyTime_ROUND_TIMEOUT' value='3'/>
+    </enum-decl>
+    <typedef-decl name='_PyTime_round_t' type-id='type-id-814' filepath='./Include/cpython/pytime.h' line='40' column='1' id='type-id-815'/>
+    <function-decl name='_PyTime_AsTimevalTime_t' mangled-name='_PyTime_AsTimevalTime_t' filepath='Python/pytime.c' line='616' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTime_AsTimevalTime_t'>
+      <parameter type-id='type-id-805' name='t' filepath='Python/pytime.c' line='616' column='1'/>
+      <parameter type-id='type-id-813' name='p_secs' filepath='Python/pytime.c' line='616' column='1'/>
+      <parameter type-id='type-id-452' name='us' filepath='Python/pytime.c' line='616' column='1'/>
+      <parameter type-id='type-id-815' name='round' filepath='Python/pytime.c' line='617' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <class-decl name='timeval' size-in-bits='128' is-struct='yes' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_timeval.h' line='8' column='1' id='type-id-816'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='tv_sec' type-id='type-id-801' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_timeval.h' line='10' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='tv_usec' type-id='type-id-817' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/types/struct_timeval.h' line='11' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='__suseconds_t' type-id='type-id-33' filepath='/usr/include/x86_64-linux-gnu/bits/types.h' line='162' column='1' id='type-id-817'/>
+    <pointer-type-def type-id='type-id-816' size-in-bits='64' id='type-id-818'/>
+    <function-decl name='_PyTime_AsTimeval_noraise' mangled-name='_PyTime_AsTimeval_noraise' filepath='Python/pytime.c' line='610' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTime_AsTimeval_noraise'>
+      <parameter type-id='type-id-805' name='t' filepath='Python/pytime.c' line='610' column='1'/>
+      <parameter type-id='type-id-818' name='tv' filepath='Python/pytime.c' line='610' column='1'/>
+      <parameter type-id='type-id-815' name='round' filepath='Python/pytime.c' line='610' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyTime_AsTimeval' mangled-name='_PyTime_AsTimeval' filepath='Python/pytime.c' line='604' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTime_AsTimeval'>
+      <parameter type-id='type-id-805' name='t' filepath='Python/pytime.c' line='610' column='1'/>
+      <parameter type-id='type-id-818' name='tv' filepath='Python/pytime.c' line='610' column='1'/>
+      <parameter type-id='type-id-815' name='round' filepath='Python/pytime.c' line='610' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyTime_AsMicroseconds' mangled-name='_PyTime_AsMicroseconds' filepath='Python/pytime.c' line='533' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTime_AsMicroseconds'>
+      <parameter type-id='type-id-805' name='t' filepath='Python/pytime.c' line='533' column='1'/>
+      <parameter type-id='type-id-815' name='round' filepath='Python/pytime.c' line='533' column='1'/>
+      <return type-id='type-id-805'/>
+    </function-decl>
+    <function-decl name='_PyTime_AsMilliseconds' mangled-name='_PyTime_AsMilliseconds' filepath='Python/pytime.c' line='527' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTime_AsMilliseconds'>
+      <parameter type-id='type-id-805' name='t' filepath='Python/pytime.c' line='533' column='1'/>
+      <parameter type-id='type-id-815' name='round' filepath='Python/pytime.c' line='533' column='1'/>
+      <return type-id='type-id-805'/>
+    </function-decl>
+    <function-decl name='_PyTime_AsSecondsDouble' mangled-name='_PyTime_AsSecondsDouble' filepath='Python/pytime.c' line='453' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTime_AsSecondsDouble'>
+      <parameter type-id='type-id-805' name='t' filepath='Python/pytime.c' line='453' column='1'/>
+      <return type-id='type-id-371'/>
+    </function-decl>
+    <function-decl name='_PyTime_FromMillisecondsObject' mangled-name='_PyTime_FromMillisecondsObject' filepath='Python/pytime.c' line='447' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTime_FromMillisecondsObject'>
+      <parameter type-id='type-id-806' name='t' filepath='Python/pytime.c' line='447' column='1'/>
+      <parameter type-id='type-id-16' name='obj' filepath='Python/pytime.c' line='447' column='1'/>
+      <parameter type-id='type-id-815' name='round' filepath='Python/pytime.c' line='447' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyTime_FromSecondsObject' mangled-name='_PyTime_FromSecondsObject' filepath='Python/pytime.c' line='441' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTime_FromSecondsObject'>
+      <parameter type-id='type-id-806' name='t' filepath='Python/pytime.c' line='447' column='1'/>
+      <parameter type-id='type-id-16' name='obj' filepath='Python/pytime.c' line='447' column='1'/>
+      <parameter type-id='type-id-815' name='round' filepath='Python/pytime.c' line='447' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyTime_FromTimeval' mangled-name='_PyTime_FromTimeval' filepath='Python/pytime.c' line='380' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTime_FromTimeval'>
+      <parameter type-id='type-id-806' name='tp' filepath='Python/pytime.c' line='380' column='1'/>
+      <parameter type-id='type-id-818' name='tv' filepath='Python/pytime.c' line='380' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyTime_FromTimespec' mangled-name='_PyTime_FromTimespec' filepath='Python/pytime.c' line='334' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTime_FromTimespec'>
+      <parameter type-id='type-id-806' name='tp' filepath='Python/pytime.c' line='334' column='1'/>
+      <parameter type-id='type-id-812' name='ts' filepath='Python/pytime.c' line='334' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyTime_FromNanosecondsObject' mangled-name='_PyTime_FromNanosecondsObject' filepath='Python/pytime.c' line='268' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTime_FromNanosecondsObject'>
+      <parameter type-id='type-id-806' name='tp' filepath='Python/pytime.c' line='268' column='1'/>
+      <parameter type-id='type-id-16' name='obj' filepath='Python/pytime.c' line='268' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyTime_FromNanoseconds' mangled-name='_PyTime_FromNanoseconds' filepath='Python/pytime.c' line='261' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTime_FromNanoseconds'>
+      <parameter type-id='type-id-805' name='ns' filepath='Python/pytime.c' line='261' column='1'/>
+      <return type-id='type-id-805'/>
+    </function-decl>
+    <function-decl name='_PyTime_FromSeconds' mangled-name='_PyTime_FromSeconds' filepath='Python/pytime.c' line='244' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTime_FromSeconds'>
+      <parameter type-id='type-id-9' name='seconds' filepath='Python/pytime.c' line='244' column='1'/>
+      <return type-id='type-id-805'/>
+    </function-decl>
+    <pointer-type-def type-id='type-id-33' size-in-bits='64' id='type-id-819'/>
+    <function-decl name='_PyTime_ObjectToTimeval' mangled-name='_PyTime_ObjectToTimeval' filepath='Python/pytime.c' line='237' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTime_ObjectToTimeval'>
+      <parameter type-id='type-id-16' name='obj' filepath='Python/pytime.c' line='237' column='1'/>
+      <parameter type-id='type-id-813' name='sec' filepath='Python/pytime.c' line='237' column='1'/>
+      <parameter type-id='type-id-819' name='usec' filepath='Python/pytime.c' line='237' column='1'/>
+      <parameter type-id='type-id-815' name='round' filepath='Python/pytime.c' line='238' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyTime_ObjectToTimespec' mangled-name='_PyTime_ObjectToTimespec' filepath='Python/pytime.c' line='230' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTime_ObjectToTimespec'>
+      <parameter type-id='type-id-16' name='obj' filepath='Python/pytime.c' line='237' column='1'/>
+      <parameter type-id='type-id-813' name='sec' filepath='Python/pytime.c' line='237' column='1'/>
+      <parameter type-id='type-id-819' name='usec' filepath='Python/pytime.c' line='237' column='1'/>
+      <parameter type-id='type-id-815' name='round' filepath='Python/pytime.c' line='238' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyTime_ObjectToTime_t' mangled-name='_PyTime_ObjectToTime_t' filepath='Python/pytime.c' line='197' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTime_ObjectToTime_t'>
+      <parameter type-id='type-id-16' name='obj' filepath='Python/pytime.c' line='197' column='1'/>
+      <parameter type-id='type-id-813' name='sec' filepath='Python/pytime.c' line='197' column='1'/>
+      <parameter type-id='type-id-815' name='round' filepath='Python/pytime.c' line='197' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyTime_MulDiv' mangled-name='_PyTime_MulDiv' filepath='Python/pytime.c' line='53' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTime_MulDiv'>
+      <parameter type-id='type-id-805' name='ticks' filepath='Python/pytime.c' line='53' column='1'/>
+      <parameter type-id='type-id-805' name='mul' filepath='Python/pytime.c' line='53' column='1'/>
+      <parameter type-id='type-id-805' name='div' filepath='Python/pytime.c' line='53' column='1'/>
+      <return type-id='type-id-805'/>
+    </function-decl>
+    <function-decl name='_PyLong_AsTime_t' mangled-name='_PyLong_AsTime_t' filepath='Python/pytime.c' line='71' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyLong_AsTime_t'>
+      <parameter type-id='type-id-16' name='obj' filepath='Python/pytime.c' line='71' column='1'/>
+      <return type-id='type-id-802'/>
+    </function-decl>
+    <function-decl name='_PyLong_FromTime_t' mangled-name='_PyLong_FromTime_t' filepath='Python/pytime.c' line='91' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyLong_FromTime_t'>
+      <parameter type-id='type-id-802' name='t' filepath='Python/pytime.c' line='91' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyTime_GetMonotonicClock' mangled-name='_PyTime_GetMonotonicClock' filepath='Python/pytime.c' line='954' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTime_GetMonotonicClock'>
+      <return type-id='type-id-805'/>
+    </function-decl>
+    <function-decl name='gmtime_r' mangled-name='gmtime_r' filepath='/usr/include/time.h' line='128' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='localtime_r' mangled-name='localtime_r' filepath='/usr/include/time.h' line='133' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='clock_getres' mangled-name='clock_getres' filepath='/usr/include/time.h' line='210' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='clock_gettime' mangled-name='clock_gettime' filepath='/usr/include/time.h' line='213' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/bootstrap_hash.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='_PyOS_URandomNonblock' mangled-name='_PyOS_URandomNonblock' filepath='Python/bootstrap_hash.c' line='566' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyOS_URandomNonblock'>
+      <parameter type-id='type-id-21' name='buffer' filepath='Python/bootstrap_hash.c' line='566' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Python/bootstrap_hash.c' line='566' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyOS_URandom' mangled-name='_PyOS_URandom' filepath='Python/bootstrap_hash.c' line='552' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyOS_URandom'>
+      <parameter type-id='type-id-21' name='buffer' filepath='Python/bootstrap_hash.c' line='566' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Python/bootstrap_hash.c' line='566' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_Py_open' mangled-name='_Py_open' filepath='./Include/cpython/fileutils.h' line='89' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_read' mangled-name='_Py_read' filepath='./Include/cpython/fileutils.h' line='105' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_fstat' mangled-name='_Py_fstat' filepath='./Include/cpython/fileutils.h' line='77' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__read_alias' mangled-name='read' filepath='/usr/include/x86_64-linux-gnu/bits/unistd.h' line='25' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_open_noraise' mangled-name='_Py_open_noraise' filepath='./Include/cpython/fileutils.h' line='93' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='getrandom' mangled-name='getrandom' filepath='/usr/include/x86_64-linux-gnu/sys/random.h' line='33' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/structmember.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='PyMember_SetOne' mangled-name='PyMember_SetOne' filepath='Python/structmember.c' line='105' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMember_SetOne'>
+      <parameter type-id='type-id-72' name='addr' filepath='Python/structmember.c' line='105' column='1'/>
+      <parameter type-id='type-id-433' name='l' filepath='Python/structmember.c' line='105' column='1'/>
+      <parameter type-id='type-id-16' name='v' filepath='Python/structmember.c' line='105' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyMember_GetOne' mangled-name='PyMember_GetOne' filepath='Python/structmember.c' line='8' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyMember_GetOne'>
+      <parameter type-id='type-id-3' name='obj_addr' filepath='Python/structmember.c' line='8' column='1'/>
+      <parameter type-id='type-id-433' name='l' filepath='Python/structmember.c' line='8' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/symtable.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PySTEntry_Type' type-id='type-id-149' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='78' column='1'/>
+    <class-decl name='_symtable_entry' size-in-bits='960' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='44' column='1' id='type-id-820'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='ob_base' type-id='type-id-69' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='45' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='ste_id' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='46' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='ste_symbols' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='47' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='ste_name' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='48' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='ste_varnames' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='49' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='384'>
+        <var-decl name='ste_children' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='50' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='448'>
+        <var-decl name='ste_directives' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='51' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='512'>
+        <var-decl name='ste_type' type-id='type-id-821' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='52' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='544'>
+        <var-decl name='ste_nested' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='53' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='31'>
+        <var-decl name='ste_free' type-id='type-id-66' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='54' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='30'>
+        <var-decl name='ste_child_free' type-id='type-id-66' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='55' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='29'>
+        <var-decl name='ste_generator' type-id='type-id-66' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='57' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='28'>
+        <var-decl name='ste_coroutine' type-id='type-id-66' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='58' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='608'>
+        <var-decl name='ste_comprehension' type-id='type-id-822' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='59' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='31'>
+        <var-decl name='ste_varargs' type-id='type-id-66' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='60' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='30'>
+        <var-decl name='ste_varkeywords' type-id='type-id-66' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='61' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='29'>
+        <var-decl name='ste_returns_value' type-id='type-id-66' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='62' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='28'>
+        <var-decl name='ste_needs_class_closure' type-id='type-id-66' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='64' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='27'>
+        <var-decl name='ste_comp_iter_target' type-id='type-id-66' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='67' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='672'>
+        <var-decl name='ste_comp_iter_expr' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='68' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='704'>
+        <var-decl name='ste_lineno' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='69' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='736'>
+        <var-decl name='ste_col_offset' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='70' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='768'>
+        <var-decl name='ste_end_lineno' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='71' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='800'>
+        <var-decl name='ste_end_col_offset' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='72' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='832'>
+        <var-decl name='ste_opt_lineno' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='73' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='864'>
+        <var-decl name='ste_opt_col_offset' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='74' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='896'>
+        <var-decl name='ste_table' type-id='type-id-823' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='75' column='1'/>
+      </data-member>
+    </class-decl>
+    <enum-decl name='_block_type' filepath='./Include/internal/pycore_symtable.h' line='13' column='1' id='type-id-824'>
+      <underlying-type type-id='type-id-83'/>
+      <enumerator name='FunctionBlock' value='0'/>
+      <enumerator name='ClassBlock' value='1'/>
+      <enumerator name='ModuleBlock' value='2'/>
+      <enumerator name='AnnotationBlock' value='3'/>
+    </enum-decl>
+    <typedef-decl name='_Py_block_ty' type-id='type-id-824' filepath='./Include/internal/pycore_symtable.h' line='14' column='1' id='type-id-821'/>
+    <enum-decl name='_comprehension_type' filepath='./Include/internal/pycore_symtable.h' line='16' column='1' id='type-id-825'>
+      <underlying-type type-id='type-id-83'/>
+      <enumerator name='NoComprehension' value='0'/>
+      <enumerator name='ListComprehension' value='1'/>
+      <enumerator name='DictComprehension' value='2'/>
+      <enumerator name='SetComprehension' value='3'/>
+      <enumerator name='GeneratorExpression' value='4'/>
+    </enum-decl>
+    <typedef-decl name='_Py_comprehension_ty' type-id='type-id-825' filepath='./Include/internal/pycore_symtable.h' line='21' column='1' id='type-id-822'/>
+    <class-decl name='symtable' size-in-bits='640' is-struct='yes' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='25' column='1' id='type-id-826'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='st_filename' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='26' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='st_cur' type-id='type-id-827' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='28' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='st_top' type-id='type-id-827' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='29' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='st_blocks' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='30' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='st_stack' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='32' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='st_global' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='33' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='384'>
+        <var-decl name='st_nblocks' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='34' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='448'>
+        <var-decl name='st_private' type-id='type-id-16' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='37' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='512'>
+        <var-decl name='st_future' type-id='type-id-828' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='38' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='576'>
+        <var-decl name='recursion_depth' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='40' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='608'>
+        <var-decl name='recursion_limit' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_symtable.h' line='41' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-820' size-in-bits='64' id='type-id-827'/>
+    <class-decl name='__anonymous_struct__' size-in-bits='64' is-struct='yes' is-anonymous='yes' naming-typedef-id='type-id-829' visibility='default' filepath='./Include/cpython/compile.h' line='34' column='1' id='type-id-830'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='ff_features' type-id='type-id-9' visibility='default' filepath='./Include/cpython/compile.h' line='35' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='32'>
+        <var-decl name='ff_lineno' type-id='type-id-9' visibility='default' filepath='./Include/cpython/compile.h' line='36' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='PyFutureFeatures' type-id='type-id-830' filepath='./Include/cpython/compile.h' line='37' column='1' id='type-id-829'/>
+    <pointer-type-def type-id='type-id-829' size-in-bits='64' id='type-id-828'/>
+    <pointer-type-def type-id='type-id-826' size-in-bits='64' id='type-id-823'/>
+    <typedef-decl name='PySTEntryObject' type-id='type-id-820' filepath='./Include/internal/pycore_symtable.h' line='76' column='1' id='type-id-831'/>
+    <pointer-type-def type-id='type-id-831' size-in-bits='64' id='type-id-832'/>
+    <function-decl name='PySymtable_Lookup' mangled-name='PySymtable_Lookup' filepath='Python/symtable.c' line='380' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySymtable_Lookup'>
+      <parameter type-id='type-id-823' name='st' filepath='Python/symtable.c' line='380' column='1'/>
+      <parameter type-id='type-id-21' name='key' filepath='Python/symtable.c' line='380' column='1'/>
+      <return type-id='type-id-832'/>
+    </function-decl>
+    <function-decl name='PyErr_RangedSyntaxLocationObject' mangled-name='PyErr_RangedSyntaxLocationObject' filepath='./Include/cpython/pyerrors.h' line='153' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PySet_Discard' mangled-name='PySet_Discard' filepath='./Include/setobject.h' line='86' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='./Python/sysmodule.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='PySys_FormatStderr' mangled-name='PySys_FormatStderr' filepath='./Python/sysmodule.c' line='3345' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySys_FormatStderr'>
+      <parameter type-id='type-id-3' name='format' filepath='./Python/sysmodule.c' line='3345' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PySys_FormatStdout' mangled-name='PySys_FormatStdout' filepath='./Python/sysmodule.c' line='3335' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySys_FormatStdout'>
+      <parameter type-id='type-id-3' name='format' filepath='./Python/sysmodule.c' line='3345' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PySys_WriteStderr' mangled-name='PySys_WriteStderr' filepath='./Python/sysmodule.c' line='3302' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySys_WriteStderr'>
+      <parameter type-id='type-id-3' name='format' filepath='./Python/sysmodule.c' line='3345' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PySys_WriteStdout' mangled-name='PySys_WriteStdout' filepath='./Python/sysmodule.c' line='3292' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySys_WriteStdout'>
+      <parameter type-id='type-id-3' name='format' filepath='./Python/sysmodule.c' line='3345' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PySys_SetArgv' mangled-name='PySys_SetArgv' filepath='./Python/sysmodule.c' line='3199' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySys_SetArgv'>
+      <parameter type-id='type-id-9' name='argc' filepath='./Python/sysmodule.c' line='3199' column='1'/>
+      <parameter type-id='type-id-329' name='argv' filepath='./Python/sysmodule.c' line='3199' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PySys_SetArgvEx' mangled-name='PySys_SetArgvEx' filepath='./Python/sysmodule.c' line='3155' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySys_SetArgvEx'>
+      <parameter type-id='type-id-9' name='argc' filepath='./Python/sysmodule.c' line='3155' column='1'/>
+      <parameter type-id='type-id-329' name='argv' filepath='./Python/sysmodule.c' line='3155' column='1'/>
+      <parameter type-id='type-id-9' name='updatepath' filepath='./Python/sysmodule.c' line='3155' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PySys_SetPath' mangled-name='PySys_SetPath' filepath='./Python/sysmodule.c' line='3123' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySys_SetPath'>
+      <parameter type-id='type-id-478' name='path' filepath='./Python/sysmodule.c' line='3123' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PySys_GetXOptions' mangled-name='PySys_GetXOptions' filepath='./Python/sysmodule.c' line='2389' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySys_GetXOptions'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PySys_AddXOption' mangled-name='PySys_AddXOption' filepath='./Python/sysmodule.c' line='2375' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySys_AddXOption'>
+      <parameter type-id='type-id-478' name='s' filepath='./Python/sysmodule.c' line='2375' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PySys_HasWarnOptions' mangled-name='PySys_HasWarnOptions' filepath='./Python/sysmodule.c' line='2301' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySys_HasWarnOptions'>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PySys_AddWarnOption' mangled-name='PySys_AddWarnOption' filepath='./Python/sysmodule.c' line='2285' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySys_AddWarnOption'>
+      <parameter type-id='type-id-478' name='s' filepath='./Python/sysmodule.c' line='2285' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PySys_AddWarnOptionUnicode' mangled-name='PySys_AddWarnOptionUnicode' filepath='./Python/sysmodule.c' line='2273' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySys_AddWarnOptionUnicode'>
+      <parameter type-id='type-id-16' name='option' filepath='./Python/sysmodule.c' line='2273' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PySys_ResetWarnOptions' mangled-name='PySys_ResetWarnOptions' filepath='./Python/sysmodule.c' line='2245' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySys_ResetWarnOptions'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PySys_GetSizeOf' mangled-name='_PySys_GetSizeOf' filepath='./Python/sysmodule.c' line='1656' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PySys_GetSizeOf'>
+      <parameter type-id='type-id-16' name='o' filepath='./Python/sysmodule.c' line='1656' column='1'/>
+      <return type-id='type-id-157'/>
+    </function-decl>
+    <function-decl name='PySys_AddAuditHook' mangled-name='PySys_AddAuditHook' filepath='./Python/sysmodule.c' line='382' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySys_AddAuditHook'>
+      <parameter type-id='type-id-306' name='hook' filepath='./Python/sysmodule.c' line='382' column='1'/>
+      <parameter type-id='type-id-21' name='userData' filepath='./Python/sysmodule.c' line='382' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PySys_Audit' mangled-name='PySys_Audit' filepath='./Python/sysmodule.c' line='328' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySys_Audit'>
+      <parameter type-id='type-id-3' name='event' filepath='./Python/sysmodule.c' line='328' column='1'/>
+      <parameter type-id='type-id-3' name='argFormat' filepath='./Python/sysmodule.c' line='328' column='1'/>
+      <parameter is-variadic='yes'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PySys_SetObject' mangled-name='PySys_SetObject' filepath='./Python/sysmodule.c' line='157' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySys_SetObject'>
+      <parameter type-id='type-id-3' name='name' filepath='./Python/sysmodule.c' line='157' column='1'/>
+      <parameter type-id='type-id-16' name='v' filepath='./Python/sysmodule.c' line='157' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PySys_SetObjectId' mangled-name='_PySys_SetObjectId' filepath='./Python/sysmodule.c' line='140' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PySys_SetObjectId'>
+      <parameter type-id='type-id-453' name='key' filepath='./Python/sysmodule.c' line='140' column='1'/>
+      <parameter type-id='type-id-16' name='v' filepath='./Python/sysmodule.c' line='140' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PySys_GetObject' mangled-name='PySys_GetObject' filepath='./Python/sysmodule.c' line='100' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PySys_GetObject'>
+      <parameter type-id='type-id-3' name='name' filepath='./Python/sysmodule.c' line='100' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PySys_GetObjectId' mangled-name='_PySys_GetObjectId' filepath='./Python/sysmodule.c' line='83' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PySys_GetObjectId'>
+      <parameter type-id='type-id-453' name='key' filepath='./Python/sysmodule.c' line='83' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyOS_vsnprintf' mangled-name='PyOS_vsnprintf' filepath='./Include/pyerrors.h' line='312' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPathConfig_ComputeSysPath0' mangled-name='_PyPathConfig_ComputeSysPath0' filepath='./Include/internal/pycore_pathconfig.h' line='54' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyFile_NewStdPrinter' mangled-name='PyFile_NewStdPrinter' filepath='./Include/cpython/fileobject.h' line='9' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_gitversion' mangled-name='_Py_gitversion' filepath='./Include/cpython/pylifecycle.h' line='51' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_gitidentifier' mangled-name='_Py_gitidentifier' filepath='./Include/cpython/pylifecycle.h' line='50' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='Py_GetPlatform' mangled-name='Py_GetPlatform' filepath='./Include/pylifecycle.h' line='55' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyFloat_GetInfo' mangled-name='PyFloat_GetInfo' filepath='./Include/floatobject.h' line='39' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyLong_GetInfo' mangled-name='PyLong_GetInfo' filepath='./Include/longobject.h' line='32' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyHash_GetFuncDef' mangled-name='PyHash_GetFuncDef' filepath='./Include/pyhash.h' line='93' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyThread_GetInfo' mangled-name='PyThread_GetInfo' filepath='./Include/pythread.h' line='97' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyStructSequence_InitType' mangled-name='_PyStructSequence_InitType' filepath='./Include/internal/pycore_structseq.h' line='12' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyWideStringList_AsList' mangled-name='_PyWideStringList_AsList' filepath='./Include/internal/pycore_initconfig.h' line='61' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyEval_SetAsyncGenFinalizer' mangled-name='_PyEval_SetAsyncGenFinalizer' filepath='./Include/cpython/ceval.h' line='12' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyEval_SetAsyncGenFirstiter' mangled-name='_PyEval_SetAsyncGenFirstiter' filepath='./Include/cpython/ceval.h' line='10' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyEval_SetProfile' mangled-name='_PyEval_SetProfile' filepath='./Include/cpython/ceval.h' line='6' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyEval_SetTrace' mangled-name='_PyEval_SetTrace' filepath='./Include/cpython/ceval.h' line='8' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyErr_WriteUnraisableDefaultHook' mangled-name='_PyErr_WriteUnraisableDefaultHook' filepath='./Include/internal/pycore_pylifecycle.h' line='128' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_VaBuildValue_SizeT' mangled-name='_Py_VaBuildValue_SizeT' filepath='./Include/modsupport.h' line='27' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyEval_DeactivateOpCache' mangled-name='_PyEval_DeactivateOpCache' filepath='./Include/internal/pycore_ceval.h' line='65' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyType_ClearCache' mangled-name='PyType_ClearCache' filepath='./Include/object.h' line='261' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObject_DebugTypeStats' mangled-name='_PyObject_DebugTypeStats' filepath='./Include/cpython/object.h' line='393' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyEval_CallTracing' mangled-name='_PyEval_CallTracing' filepath='./Include/eval.h' line='21' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyThread_CurrentExceptions' mangled-name='_PyThread_CurrentExceptions' filepath='./Include/cpython/pystate.h' line='190' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyThread_CurrentFrames' mangled-name='_PyThread_CurrentFrames' filepath='./Include/cpython/pystate.h' line='185' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_GetAllocatedBlocks' mangled-name='_Py_GetAllocatedBlocks' filepath='./Include/cpython/objimpl.h' line='56' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyEval_GetAsyncGenFirstiter' mangled-name='_PyEval_GetAsyncGenFirstiter' filepath='./Include/cpython/ceval.h' line='11' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyEval_GetAsyncGenFinalizer' mangled-name='_PyEval_GetAsyncGenFinalizer' filepath='./Include/cpython/ceval.h' line='13' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyEval_GetCoroutineOriginTrackingDepth' mangled-name='_PyEval_GetCoroutineOriginTrackingDepth' filepath='./Include/cpython/ceval.h' line='9' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyEval_SetCoroutineOriginTrackingDepth' mangled-name='_PyEval_SetCoroutineOriginTrackingDepth' filepath='./Include/internal/pycore_ceval.h' line='30' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='Py_SetRecursionLimit' mangled-name='Py_SetRecursionLimit' filepath='./Include/ceval.h' line='64' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyEval_GetSwitchInterval' mangled-name='_PyEval_GetSwitchInterval' filepath='./Include/cpython/ceval.h' line='25' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyEval_SetSwitchInterval' mangled-name='_PyEval_SetSwitchInterval' filepath='./Include/cpython/ceval.h' line='24' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/thread.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='PyThread_GetInfo' mangled-name='PyThread_GetInfo' filepath='Python/thread.c' line='186' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThread_GetInfo'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <pointer-type-def type-id='type-id-301' size-in-bits='64' id='type-id-833'/>
+    <function-decl name='PyThread_tss_is_created' mangled-name='PyThread_tss_is_created' filepath='Python/thread.c' line='157' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThread_tss_is_created'>
+      <parameter type-id='type-id-833' name='key' filepath='Python/thread.c' line='157' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyThread_tss_free' mangled-name='PyThread_tss_free' filepath='Python/thread.c' line='148' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThread_tss_free'>
+      <parameter type-id='type-id-833' name='key' filepath='Python/thread.c' line='148' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyThread_tss_alloc' mangled-name='PyThread_tss_alloc' filepath='Python/thread.c' line='137' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThread_tss_alloc'>
+      <return type-id='type-id-833'/>
+    </function-decl>
+    <function-decl name='PyThread_set_stacksize' mangled-name='PyThread_set_stacksize' filepath='Python/thread.c' line='121' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThread_set_stacksize'>
+      <parameter type-id='type-id-157' name='size' filepath='Python/thread.c' line='121' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyThread_get_stacksize' mangled-name='PyThread_get_stacksize' filepath='Python/thread.c' line='110' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThread_get_stacksize'>
+      <return type-id='type-id-157'/>
+    </function-decl>
+    <function-decl name='PyThread_tss_get' mangled-name='PyThread_tss_get' filepath='Python/thread_pthread.h' line='925' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThread_tss_get'>
+      <parameter type-id='type-id-833' name='key' filepath='Python/thread_pthread.h' line='925' column='1'/>
+      <return type-id='type-id-21'/>
+    </function-decl>
+    <function-decl name='PyThread_tss_set' mangled-name='PyThread_tss_set' filepath='Python/thread_pthread.h' line='917' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThread_tss_set'>
+      <parameter type-id='type-id-833' name='key' filepath='Python/thread_pthread.h' line='917' column='1'/>
+      <parameter type-id='type-id-21' name='value' filepath='Python/thread_pthread.h' line='917' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyThread_tss_create' mangled-name='PyThread_tss_create' filepath='Python/thread_pthread.h' line='886' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThread_tss_create'>
+      <parameter type-id='type-id-833' name='key' filepath='Python/thread_pthread.h' line='886' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyThread_ReInitTLS' mangled-name='PyThread_ReInitTLS' filepath='Python/thread_pthread.h' line='875' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThread_ReInitTLS'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyThread_get_key_value' mangled-name='PyThread_get_key_value' filepath='Python/thread_pthread.h' line='864' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThread_get_key_value'>
+      <parameter type-id='type-id-9' name='key' filepath='Python/thread_pthread.h' line='864' column='1'/>
+      <return type-id='type-id-21'/>
+    </function-decl>
+    <function-decl name='PyThread_set_key_value' mangled-name='PyThread_set_key_value' filepath='Python/thread_pthread.h' line='853' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThread_set_key_value'>
+      <parameter type-id='type-id-9' name='key' filepath='Python/thread_pthread.h' line='853' column='1'/>
+      <parameter type-id='type-id-21' name='value' filepath='Python/thread_pthread.h' line='853' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyThread_delete_key_value' mangled-name='PyThread_delete_key_value' filepath='Python/thread_pthread.h' line='845' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThread_delete_key_value'>
+      <parameter type-id='type-id-9' name='key' filepath='Python/thread_pthread.h' line='845' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyThread_delete_key' mangled-name='PyThread_delete_key' filepath='Python/thread_pthread.h' line='837' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThread_delete_key'>
+      <parameter type-id='type-id-9' name='key' filepath='Python/thread_pthread.h' line='845' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyThread_create_key' mangled-name='PyThread_create_key' filepath='Python/thread_pthread.h' line='817' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThread_create_key'>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyThread_acquire_lock' mangled-name='PyThread_acquire_lock' filepath='Python/thread_pthread.h' line='750' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThread_acquire_lock'>
+      <parameter type-id='type-id-228' name='lock' filepath='Python/thread_pthread.h' line='750' column='1'/>
+      <parameter type-id='type-id-9' name='waitflag' filepath='Python/thread_pthread.h' line='750' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <pointer-type-def type-id='type-id-228' size-in-bits='64' id='type-id-834'/>
+    <function-decl name='_PyThread_at_fork_reinit' mangled-name='_PyThread_at_fork_reinit' filepath='Python/thread_pthread.h' line='730' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyThread_at_fork_reinit'>
+      <parameter type-id='type-id-834' name='lock' filepath='Python/thread_pthread.h' line='730' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyThread_release_lock' mangled-name='PyThread_release_lock' filepath='Python/thread_pthread.h' line='556' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThread_release_lock'>
+      <parameter type-id='type-id-228' name='lock' filepath='Python/thread_pthread.h' line='556' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <enum-decl name='PyLockStatus' filepath='./Include/pythread.h' line='13' column='1' id='type-id-835'>
+      <underlying-type type-id='type-id-83'/>
+      <enumerator name='PY_LOCK_FAILURE' value='0'/>
+      <enumerator name='PY_LOCK_ACQUIRED' value='1'/>
+      <enumerator name='PY_LOCK_INTR' value='2'/>
+    </enum-decl>
+    <typedef-decl name='PyLockStatus' type-id='type-id-835' filepath='./Include/pythread.h' line='17' column='1' id='type-id-836'/>
+    <function-decl name='PyThread_acquire_lock_timed' mangled-name='PyThread_acquire_lock_timed' filepath='Python/thread_pthread.h' line='439' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThread_acquire_lock_timed'>
+      <parameter type-id='type-id-228' name='lock' filepath='Python/thread_pthread.h' line='439' column='1'/>
+      <parameter type-id='type-id-286' name='microseconds' filepath='Python/thread_pthread.h' line='439' column='1'/>
+      <parameter type-id='type-id-9' name='intr_flag' filepath='Python/thread_pthread.h' line='440' column='1'/>
+      <return type-id='type-id-836'/>
+    </function-decl>
+    <function-decl name='PyThread_free_lock' mangled-name='PyThread_free_lock' filepath='Python/thread_pthread.h' line='409' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThread_free_lock'>
+      <parameter type-id='type-id-228' name='lock' filepath='Python/thread_pthread.h' line='409' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyThread_allocate_lock' mangled-name='PyThread_allocate_lock' filepath='Python/thread_pthread.h' line='383' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThread_allocate_lock'>
+      <return type-id='type-id-228'/>
+    </function-decl>
+    <function-decl name='PyThread_get_thread_native_id' mangled-name='PyThread_get_thread_native_id' filepath='Python/thread_pthread.h' line='340' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThread_get_thread_native_id'>
+      <return type-id='type-id-19'/>
+    </function-decl>
+    <function-decl name='PyThread_get_thread_ident' mangled-name='PyThread_get_thread_ident' filepath='Python/thread_pthread.h' line='329' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThread_get_thread_ident'>
+      <return type-id='type-id-19'/>
+    </function-decl>
+    <function-decl name='PyThread_start_new_thread' mangled-name='PyThread_start_new_thread' filepath='Python/thread_pthread.h' line='253' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThread_start_new_thread'>
+      <parameter type-id='type-id-20' name='func' filepath='Python/thread_pthread.h' line='253' column='1'/>
+      <parameter type-id='type-id-21' name='arg' filepath='Python/thread_pthread.h' line='253' column='1'/>
+      <return type-id='type-id-19'/>
+    </function-decl>
+    <function-decl name='PyThread_tss_delete' mangled-name='PyThread_tss_delete' filepath='Python/thread_pthread.h' line='903' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyThread_tss_delete'>
+      <parameter type-id='type-id-833' name='key' filepath='Python/thread_pthread.h' line='903' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__confstr_alias' mangled-name='confstr' filepath='/usr/include/x86_64-linux-gnu/bits/unistd.h' line='231' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_DecodeFSDefaultAndSize' mangled-name='PyUnicode_DecodeFSDefaultAndSize' filepath='./Include/unicodeobject.h' line='795' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='pthread_attr_init' mangled-name='pthread_attr_init' filepath='/usr/include/pthread.h' line='263' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='pthread_attr_setstacksize' mangled-name='pthread_attr_setstacksize' filepath='/usr/include/pthread.h' line='351' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='pthread_attr_destroy' mangled-name='pthread_attr_destroy' filepath='/usr/include/pthread.h' line='266' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='pthread_getspecific' mangled-name='pthread_getspecific' filepath='/usr/include/pthread.h' line='1131' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='pthread_setspecific' mangled-name='pthread_setspecific' filepath='/usr/include/pthread.h' line='1134' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='pthread_key_create' mangled-name='pthread_key_create' filepath='/usr/include/pthread.h' line='1123' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='pthread_key_delete' mangled-name='pthread_key_delete' filepath='/usr/include/pthread.h' line='1128' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='sem_post' mangled-name='sem_post' filepath='/usr/include/semaphore.h' line='78' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='perror' mangled-name='perror' filepath='/usr/include/stdio.h' line='775' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='sem_wait' mangled-name='sem_wait' filepath='/usr/include/semaphore.h' line='55' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='sem_trywait' mangled-name='sem_trywait' filepath='/usr/include/semaphore.h' line='75' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='sem_clockwait' mangled-name='sem_clockwait' filepath='/usr/include/semaphore.h' line='68' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='sem_destroy' mangled-name='sem_destroy' filepath='/usr/include/semaphore.h' line='39' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='sem_init' mangled-name='sem_init' filepath='/usr/include/semaphore.h' line='35' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='pthread_exit' mangled-name='pthread_exit' filepath='/usr/include/pthread.h' line='207' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='syscall' mangled-name='syscall' filepath='/usr/include/unistd.h' line='1056' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='pthread_self' mangled-name='pthread_self' filepath='/usr/include/pthread.h' line='251' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='pthread_attr_setscope' mangled-name='pthread_attr_setscope' filepath='/usr/include/pthread.h' line='327' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='pthread_create' mangled-name='pthread_create' filepath='/usr/include/pthread.h' line='198' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='pthread_detach' mangled-name='pthread_detach' filepath='/usr/include/pthread.h' line='247' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='gettimeofday' mangled-name='gettimeofday' filepath='/usr/include/x86_64-linux-gnu/sys/time.h' line='66' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='pthread_cond_init' mangled-name='pthread_cond_init' filepath='/usr/include/pthread.h' line='965' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='pthread_condattr_init' mangled-name='pthread_condattr_init' filepath='/usr/include/pthread.h' line='1020' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='pthread_condattr_setclock' mangled-name='pthread_condattr_setclock' filepath='/usr/include/pthread.h' line='1045' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/traceback.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PyTraceBack_Type' type-id='type-id-149' mangled-name='PyTraceBack_Type' visibility='default' filepath='./Include/traceback.h' line='13' column='1' elf-symbol-id='PyTraceBack_Type'/>
+    <function-decl name='PyTraceBack_Print' mangled-name='PyTraceBack_Print' filepath='Python/traceback.c' line='597' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyTraceBack_Print'>
+      <parameter type-id='type-id-16' name='v' filepath='Python/traceback.c' line='597' column='1'/>
+      <parameter type-id='type-id-16' name='f' filepath='Python/traceback.c' line='597' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyTraceback_Add' mangled-name='_PyTraceback_Add' filepath='Python/traceback.c' line='258' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTraceback_Add'>
+      <parameter type-id='type-id-3' name='funcname' filepath='Python/traceback.c' line='258' column='1'/>
+      <parameter type-id='type-id-3' name='filename' filepath='Python/traceback.c' line='258' column='1'/>
+      <parameter type-id='type-id-9' name='lineno' filepath='Python/traceback.c' line='258' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyTraceBack_Here' mangled-name='PyTraceBack_Here' filepath='Python/traceback.c' line='243' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyTraceBack_Here'>
+      <parameter type-id='type-id-223' name='frame' filepath='Python/traceback.c' line='243' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_Py_DisplaySourceLine' mangled-name='_Py_DisplaySourceLine' filepath='Python/traceback.c' line='373' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_DisplaySourceLine'>
+      <parameter type-id='type-id-16' name='f' filepath='Python/traceback.c' line='373' column='1'/>
+      <parameter type-id='type-id-16' name='filename' filepath='Python/traceback.c' line='373' column='1'/>
+      <parameter type-id='type-id-9' name='lineno' filepath='Python/traceback.c' line='373' column='1'/>
+      <parameter type-id='type-id-9' name='indent' filepath='Python/traceback.c' line='373' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyInterpreterState_ThreadHead' mangled-name='PyInterpreterState_ThreadHead' filepath='./Include/cpython/pystate.h' line='197' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyThreadState_Next' mangled-name='PyThreadState_Next' filepath='./Include/cpython/pystate.h' line='198' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyGILState_GetInterpreterStateUnsafe' mangled-name='_PyGILState_GetInterpreterStateUnsafe' filepath='./Include/cpython/pystate.h' line='180' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyCode_NewEmpty' mangled-name='PyCode_NewEmpty' filepath='./Include/cpython/code.h' line='130' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyFrame_New' mangled-name='PyFrame_New' filepath='./Include/cpython/frameobject.h' line='70' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__builtin___strcpy_chk' mangled-name='__strcpy_chk' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_AsFileDescriptor' mangled-name='PyObject_AsFileDescriptor' filepath='./Include/fileobject.h' line='17' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyTokenizer_FindEncodingFilename' mangled-name='PyTokenizer_FindEncodingFilename' filepath='Python/traceback.c' line='23' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/getopt.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='_PyOS_opterr' type-id='type-id-9' visibility='default' filepath='./Include/internal/pycore_getopt.h' line='8' column='1'/>
+    <var-decl name='_PyOS_optind' type-id='type-id-31' visibility='default' filepath='./Include/internal/pycore_getopt.h' line='9' column='1'/>
+    <var-decl name='_PyOS_optarg' type-id='type-id-478' visibility='default' filepath='./Include/internal/pycore_getopt.h' line='10' column='1'/>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/pystrcmp.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='PyOS_mystricmp' mangled-name='PyOS_mystricmp' filepath='Python/pystrcmp.c' line='22' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyOS_mystricmp'>
+      <parameter type-id='type-id-3' name='s1' filepath='Python/pystrcmp.c' line='22' column='1'/>
+      <parameter type-id='type-id-3' name='s2' filepath='Python/pystrcmp.c' line='22' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyOS_mystrnicmp' mangled-name='PyOS_mystrnicmp' filepath='Python/pystrcmp.c' line='7' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyOS_mystrnicmp'>
+      <parameter type-id='type-id-3' name='s1' filepath='Python/pystrcmp.c' line='7' column='1'/>
+      <parameter type-id='type-id-3' name='s2' filepath='Python/pystrcmp.c' line='7' column='1'/>
+      <parameter type-id='type-id-31' name='size' filepath='Python/pystrcmp.c' line='7' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/pystrtod.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='PyOS_double_to_string' mangled-name='PyOS_double_to_string' filepath='Python/pystrtod.c' line='1243' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyOS_double_to_string'>
+      <parameter type-id='type-id-371' name='val' filepath='Python/pystrtod.c' line='1243' column='1'/>
+      <parameter type-id='type-id-1' name='format_code' filepath='Python/pystrtod.c' line='1244' column='1'/>
+      <parameter type-id='type-id-9' name='precision' filepath='Python/pystrtod.c' line='1245' column='1'/>
+      <parameter type-id='type-id-9' name='flags' filepath='Python/pystrtod.c' line='1246' column='1'/>
+      <parameter type-id='type-id-452' name='type' filepath='Python/pystrtod.c' line='1247' column='1'/>
+      <return type-id='type-id-72'/>
+    </function-decl>
+    <pointer-type-def type-id='type-id-837' size-in-bits='64' id='type-id-838'/>
+    <function-decl name='_Py_string_to_number_with_underscores' mangled-name='_Py_string_to_number_with_underscores' filepath='Python/pystrtod.c' line='384' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_string_to_number_with_underscores'>
+      <parameter type-id='type-id-3' name='s' filepath='Python/pystrtod.c' line='385' column='1'/>
+      <parameter type-id='type-id-31' name='orig_len' filepath='Python/pystrtod.c' line='385' column='1'/>
+      <parameter type-id='type-id-3' name='what' filepath='Python/pystrtod.c' line='385' column='1'/>
+      <parameter type-id='type-id-16' name='obj' filepath='Python/pystrtod.c' line='385' column='1'/>
+      <parameter type-id='type-id-21' name='arg' filepath='Python/pystrtod.c' line='385' column='1'/>
+      <parameter type-id='type-id-838' name='innerfunc' filepath='Python/pystrtod.c' line='386' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyOS_string_to_double' mangled-name='PyOS_string_to_double' filepath='Python/pystrtod.c' line='338' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyOS_string_to_double'>
+      <parameter type-id='type-id-3' name='s' filepath='Python/pystrtod.c' line='338' column='1'/>
+      <parameter type-id='type-id-215' name='endptr' filepath='Python/pystrtod.c' line='339' column='1'/>
+      <parameter type-id='type-id-16' name='overflow_exception' filepath='Python/pystrtod.c' line='340' column='1'/>
+      <return type-id='type-id-371'/>
+    </function-decl>
+    <function-decl name='_Py_parse_inf_or_nan' mangled-name='_Py_parse_inf_or_nan' filepath='Python/pystrtod.c' line='29' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_parse_inf_or_nan'>
+      <parameter type-id='type-id-3' name='p' filepath='Python/pystrtod.c' line='29' column='1'/>
+      <parameter type-id='type-id-215' name='endptr' filepath='Python/pystrtod.c' line='29' column='1'/>
+      <return type-id='type-id-371'/>
+    </function-decl>
+    <function-type size-in-bits='64' id='type-id-837'>
+      <parameter type-id='type-id-3'/>
+      <parameter type-id='type-id-31'/>
+      <parameter type-id='type-id-21'/>
+      <return type-id='type-id-16'/>
+    </function-type>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/pystrhex.c' comp-dir-path='/src' language='LANG_C99'>
+    <qualified-type-def type-id='type-id-69' const='yes' id='type-id-839'/>
+    <pointer-type-def type-id='type-id-839' size-in-bits='64' id='type-id-840'/>
+    <function-decl name='_Py_strhex_bytes_with_sep' mangled-name='_Py_strhex_bytes_with_sep' filepath='Python/pystrhex.c' line='169' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_strhex_bytes_with_sep'>
+      <parameter type-id='type-id-3' name='argbuf' filepath='Python/pystrhex.c' line='169' column='1'/>
+      <parameter type-id='type-id-193' name='arglen' filepath='Python/pystrhex.c' line='169' column='1'/>
+      <parameter type-id='type-id-840' name='sep' filepath='Python/pystrhex.c' line='169' column='1'/>
+      <parameter type-id='type-id-784' name='bytes_per_group' filepath='Python/pystrhex.c' line='169' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_Py_strhex_with_sep' mangled-name='_Py_strhex_with_sep' filepath='Python/pystrhex.c' line='162' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_strhex_with_sep'>
+      <parameter type-id='type-id-3' name='argbuf' filepath='Python/pystrhex.c' line='169' column='1'/>
+      <parameter type-id='type-id-193' name='arglen' filepath='Python/pystrhex.c' line='169' column='1'/>
+      <parameter type-id='type-id-840' name='sep' filepath='Python/pystrhex.c' line='169' column='1'/>
+      <parameter type-id='type-id-784' name='bytes_per_group' filepath='Python/pystrhex.c' line='169' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_Py_strhex_bytes' mangled-name='_Py_strhex_bytes' filepath='Python/pystrhex.c' line='155' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_strhex_bytes'>
+      <parameter type-id='type-id-3' name='argbuf' filepath='Python/pystrhex.c' line='155' column='1'/>
+      <parameter type-id='type-id-193' name='arglen' filepath='Python/pystrhex.c' line='155' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_Py_strhex' mangled-name='_Py_strhex' filepath='Python/pystrhex.c' line='148' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_strhex'>
+      <parameter type-id='type-id-3' name='argbuf' filepath='Python/pystrhex.c' line='155' column='1'/>
+      <parameter type-id='type-id-193' name='arglen' filepath='Python/pystrhex.c' line='155' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/dtoa.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='_Py_dg_dtoa' mangled-name='_Py_dg_dtoa' filepath='Python/dtoa.c' line='2247' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_dg_dtoa'>
+      <parameter type-id='type-id-371' name='dd' filepath='Python/dtoa.c' line='2247' column='1'/>
+      <parameter type-id='type-id-9' name='mode' filepath='Python/dtoa.c' line='2247' column='1'/>
+      <parameter type-id='type-id-9' name='ndigits' filepath='Python/dtoa.c' line='2247' column='1'/>
+      <parameter type-id='type-id-452' name='decpt' filepath='Python/dtoa.c' line='2248' column='1'/>
+      <parameter type-id='type-id-452' name='sign' filepath='Python/dtoa.c' line='2248' column='1'/>
+      <parameter type-id='type-id-215' name='rve' filepath='Python/dtoa.c' line='2248' column='1'/>
+      <return type-id='type-id-72'/>
+    </function-decl>
+    <function-decl name='_Py_dg_freedtoa' mangled-name='_Py_dg_freedtoa' filepath='Python/dtoa.c' line='2201' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_dg_freedtoa'>
+      <parameter type-id='type-id-72' name='s' filepath='Python/dtoa.c' line='2201' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_dg_strtod' mangled-name='_Py_dg_strtod' filepath='Python/dtoa.c' line='1438' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_dg_strtod'>
+      <parameter type-id='type-id-3' name='s00' filepath='Python/dtoa.c' line='1438' column='1'/>
+      <parameter type-id='type-id-215' name='se' filepath='Python/dtoa.c' line='1438' column='1'/>
+      <return type-id='type-id-371'/>
+    </function-decl>
+    <function-decl name='_Py_dg_infinity' mangled-name='_Py_dg_infinity' filepath='Python/dtoa.c' line='1429' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_dg_infinity'>
+      <parameter type-id='type-id-9' name='sign' filepath='Python/dtoa.c' line='1429' column='1'/>
+      <return type-id='type-id-371'/>
+    </function-decl>
+    <function-decl name='_Py_dg_stdnan' mangled-name='_Py_dg_stdnan' filepath='Python/dtoa.c' line='1415' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_dg_stdnan'>
+      <parameter type-id='type-id-9' name='sign' filepath='Python/dtoa.c' line='1429' column='1'/>
+      <return type-id='type-id-371'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/formatter_unicode.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='_PyComplex_FormatAdvancedWriter' mangled-name='_PyComplex_FormatAdvancedWriter' filepath='Python/formatter_unicode.c' line='1565' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyComplex_FormatAdvancedWriter'>
+      <parameter type-id='type-id-451' name='writer' filepath='Python/formatter_unicode.c' line='1565' column='1'/>
+      <parameter type-id='type-id-16' name='obj' filepath='Python/formatter_unicode.c' line='1566' column='1'/>
+      <parameter type-id='type-id-16' name='format_spec' filepath='Python/formatter_unicode.c' line='1567' column='1'/>
+      <parameter type-id='type-id-31' name='start' filepath='Python/formatter_unicode.c' line='1568' column='1'/>
+      <parameter type-id='type-id-31' name='end' filepath='Python/formatter_unicode.c' line='1568' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyFloat_FormatAdvancedWriter' mangled-name='_PyFloat_FormatAdvancedWriter' filepath='Python/formatter_unicode.c' line='1526' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyFloat_FormatAdvancedWriter'>
+      <parameter type-id='type-id-451' name='writer' filepath='Python/formatter_unicode.c' line='1565' column='1'/>
+      <parameter type-id='type-id-16' name='obj' filepath='Python/formatter_unicode.c' line='1566' column='1'/>
+      <parameter type-id='type-id-16' name='format_spec' filepath='Python/formatter_unicode.c' line='1567' column='1'/>
+      <parameter type-id='type-id-31' name='start' filepath='Python/formatter_unicode.c' line='1568' column='1'/>
+      <parameter type-id='type-id-31' name='end' filepath='Python/formatter_unicode.c' line='1568' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyLong_FormatAdvancedWriter' mangled-name='_PyLong_FormatAdvancedWriter' filepath='Python/formatter_unicode.c' line='1464' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyLong_FormatAdvancedWriter'>
+      <parameter type-id='type-id-451' name='writer' filepath='Python/formatter_unicode.c' line='1464' column='1'/>
+      <parameter type-id='type-id-16' name='obj' filepath='Python/formatter_unicode.c' line='1465' column='1'/>
+      <parameter type-id='type-id-16' name='format_spec' filepath='Python/formatter_unicode.c' line='1466' column='1'/>
+      <parameter type-id='type-id-31' name='start' filepath='Python/formatter_unicode.c' line='1467' column='1'/>
+      <parameter type-id='type-id-31' name='end' filepath='Python/formatter_unicode.c' line='1467' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_FormatAdvancedWriter' mangled-name='_PyUnicode_FormatAdvancedWriter' filepath='Python/formatter_unicode.c' line='1428' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyUnicode_FormatAdvancedWriter'>
+      <parameter type-id='type-id-451' name='writer' filepath='Python/formatter_unicode.c' line='1565' column='1'/>
+      <parameter type-id='type-id-16' name='obj' filepath='Python/formatter_unicode.c' line='1566' column='1'/>
+      <parameter type-id='type-id-16' name='format_spec' filepath='Python/formatter_unicode.c' line='1567' column='1'/>
+      <parameter type-id='type-id-31' name='start' filepath='Python/formatter_unicode.c' line='1568' column='1'/>
+      <parameter type-id='type-id-31' name='end' filepath='Python/formatter_unicode.c' line='1568' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_FastFill' mangled-name='_PyUnicode_FastFill' filepath='./Include/cpython/unicodeobject.h' line='535' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_FindMaxChar' mangled-name='_PyUnicode_FindMaxChar' filepath='./Include/cpython/unicodeobject.h' line='571' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_FastCopyCharacters' mangled-name='_PyUnicode_FastCopyCharacters' filepath='./Include/cpython/unicodeobject.h' line='510' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='localeconv' mangled-name='localeconv' filepath='/usr/include/locale.h' line='125' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_GetLocaleconvNumeric' mangled-name='_Py_GetLocaleconvNumeric' filepath='./Include/internal/pycore_fileutils.h' line='46' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyMem_Strdup' mangled-name='_PyMem_Strdup' filepath='./Include/cpython/pymem.h' line='17' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_InsertThousandsGrouping' mangled-name='_PyUnicode_InsertThousandsGrouping' filepath='./Include/cpython/unicodeobject.h' line='1033' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/fileutils.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='_Py_closerange' mangled-name='_Py_closerange' filepath='Python/fileutils.c' line='2393' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_closerange'>
+      <parameter type-id='type-id-9' name='first' filepath='Python/fileutils.c' line='2393' column='1'/>
+      <parameter type-id='type-id-9' name='last' filepath='Python/fileutils.c' line='2393' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <class-decl name='lconv' size-in-bits='768' is-struct='yes' visibility='default' filepath='/usr/include/locale.h' line='51' column='1' id='type-id-841'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='decimal_point' type-id='type-id-72' visibility='default' filepath='/usr/include/locale.h' line='55' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='thousands_sep' type-id='type-id-72' visibility='default' filepath='/usr/include/locale.h' line='56' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='grouping' type-id='type-id-72' visibility='default' filepath='/usr/include/locale.h' line='62' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='int_curr_symbol' type-id='type-id-72' visibility='default' filepath='/usr/include/locale.h' line='68' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='currency_symbol' type-id='type-id-72' visibility='default' filepath='/usr/include/locale.h' line='69' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='mon_decimal_point' type-id='type-id-72' visibility='default' filepath='/usr/include/locale.h' line='70' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='384'>
+        <var-decl name='mon_thousands_sep' type-id='type-id-72' visibility='default' filepath='/usr/include/locale.h' line='71' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='448'>
+        <var-decl name='mon_grouping' type-id='type-id-72' visibility='default' filepath='/usr/include/locale.h' line='72' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='512'>
+        <var-decl name='positive_sign' type-id='type-id-72' visibility='default' filepath='/usr/include/locale.h' line='73' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='576'>
+        <var-decl name='negative_sign' type-id='type-id-72' visibility='default' filepath='/usr/include/locale.h' line='74' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='640'>
+        <var-decl name='int_frac_digits' type-id='type-id-1' visibility='default' filepath='/usr/include/locale.h' line='75' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='648'>
+        <var-decl name='frac_digits' type-id='type-id-1' visibility='default' filepath='/usr/include/locale.h' line='76' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='656'>
+        <var-decl name='p_cs_precedes' type-id='type-id-1' visibility='default' filepath='/usr/include/locale.h' line='78' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='664'>
+        <var-decl name='p_sep_by_space' type-id='type-id-1' visibility='default' filepath='/usr/include/locale.h' line='80' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='672'>
+        <var-decl name='n_cs_precedes' type-id='type-id-1' visibility='default' filepath='/usr/include/locale.h' line='82' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='680'>
+        <var-decl name='n_sep_by_space' type-id='type-id-1' visibility='default' filepath='/usr/include/locale.h' line='84' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='688'>
+        <var-decl name='p_sign_posn' type-id='type-id-1' visibility='default' filepath='/usr/include/locale.h' line='91' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='696'>
+        <var-decl name='n_sign_posn' type-id='type-id-1' visibility='default' filepath='/usr/include/locale.h' line='92' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='704'>
+        <var-decl name='int_p_cs_precedes' type-id='type-id-1' visibility='default' filepath='/usr/include/locale.h' line='95' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='712'>
+        <var-decl name='int_p_sep_by_space' type-id='type-id-1' visibility='default' filepath='/usr/include/locale.h' line='97' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='720'>
+        <var-decl name='int_n_cs_precedes' type-id='type-id-1' visibility='default' filepath='/usr/include/locale.h' line='99' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='728'>
+        <var-decl name='int_n_sep_by_space' type-id='type-id-1' visibility='default' filepath='/usr/include/locale.h' line='101' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='736'>
+        <var-decl name='int_p_sign_posn' type-id='type-id-1' visibility='default' filepath='/usr/include/locale.h' line='108' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='744'>
+        <var-decl name='int_n_sign_posn' type-id='type-id-1' visibility='default' filepath='/usr/include/locale.h' line='109' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-841' size-in-bits='64' id='type-id-842'/>
+    <function-decl name='_Py_GetLocaleconvNumeric' mangled-name='_Py_GetLocaleconvNumeric' filepath='Python/fileutils.c' line='2277' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_GetLocaleconvNumeric'>
+      <parameter type-id='type-id-842' name='lc' filepath='Python/fileutils.c' line='2277' column='1'/>
+      <parameter type-id='type-id-86' name='decimal_point' filepath='Python/fileutils.c' line='2278' column='1'/>
+      <parameter type-id='type-id-86' name='thousands_sep' filepath='Python/fileutils.c' line='2278' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_Py_set_blocking' mangled-name='_Py_set_blocking' filepath='Python/fileutils.c' line='2200' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_set_blocking'>
+      <parameter type-id='type-id-9' name='fd' filepath='Python/fileutils.c' line='2200' column='1'/>
+      <parameter type-id='type-id-9' name='blocking' filepath='Python/fileutils.c' line='2200' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_Py_get_blocking' mangled-name='_Py_get_blocking' filepath='Python/fileutils.c' line='2179' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_get_blocking'>
+      <parameter type-id='type-id-9' name='fd' filepath='Python/fileutils.c' line='2179' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_Py_dup' mangled-name='_Py_dup' filepath='Python/fileutils.c' line='2113' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_dup'>
+      <parameter type-id='type-id-9' name='fd' filepath='Python/fileutils.c' line='2113' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_Py_wgetcwd' mangled-name='_Py_wgetcwd' filepath='Python/fileutils.c' line='2081' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_wgetcwd'>
+      <parameter type-id='type-id-325' name='buf' filepath='Python/fileutils.c' line='2081' column='1'/>
+      <parameter type-id='type-id-157' name='buflen' filepath='Python/fileutils.c' line='2081' column='1'/>
+      <return type-id='type-id-325'/>
+    </function-decl>
+    <function-decl name='_Py_abspath' mangled-name='_Py_abspath' filepath='Python/fileutils.c' line='1994' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_abspath'>
+      <parameter type-id='type-id-478' name='path' filepath='Python/fileutils.c' line='1994' column='1'/>
+      <parameter type-id='type-id-329' name='abspath_p' filepath='Python/fileutils.c' line='1994' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_Py_isabs' mangled-name='_Py_isabs' filepath='Python/fileutils.c' line='1981' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_isabs'>
+      <parameter type-id='type-id-478' name='path' filepath='Python/fileutils.c' line='1981' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_Py_wrealpath' mangled-name='_Py_wrealpath' filepath='Python/fileutils.c' line='1943' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_wrealpath'>
+      <parameter type-id='type-id-478' name='path' filepath='Python/fileutils.c' line='1943' column='1'/>
+      <parameter type-id='type-id-325' name='resolved_path' filepath='Python/fileutils.c' line='1944' column='1'/>
+      <parameter type-id='type-id-157' name='resolved_path_len' filepath='Python/fileutils.c' line='1944' column='1'/>
+      <return type-id='type-id-325'/>
+    </function-decl>
+    <function-decl name='_Py_wreadlink' mangled-name='_Py_wreadlink' filepath='Python/fileutils.c' line='1894' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_wreadlink'>
+      <parameter type-id='type-id-478' name='path' filepath='Python/fileutils.c' line='1894' column='1'/>
+      <parameter type-id='type-id-325' name='buf' filepath='Python/fileutils.c' line='1894' column='1'/>
+      <parameter type-id='type-id-157' name='buflen' filepath='Python/fileutils.c' line='1894' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_Py_write_noraise' mangled-name='_Py_write_noraise' filepath='Python/fileutils.c' line='1881' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_write_noraise'>
+      <parameter type-id='type-id-9' name='fd' filepath='Python/fileutils.c' line='1881' column='1'/>
+      <parameter type-id='type-id-21' name='buf' filepath='Python/fileutils.c' line='1881' column='1'/>
+      <parameter type-id='type-id-157' name='count' filepath='Python/fileutils.c' line='1881' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='_Py_write' mangled-name='_Py_write' filepath='Python/fileutils.c' line='1861' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_write'>
+      <parameter type-id='type-id-9' name='fd' filepath='Python/fileutils.c' line='1861' column='1'/>
+      <parameter type-id='type-id-21' name='buf' filepath='Python/fileutils.c' line='1861' column='1'/>
+      <parameter type-id='type-id-157' name='count' filepath='Python/fileutils.c' line='1861' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='_Py_read' mangled-name='_Py_read' filepath='Python/fileutils.c' line='1722' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_read'>
+      <parameter type-id='type-id-9' name='fd' filepath='Python/fileutils.c' line='1722' column='1'/>
+      <parameter type-id='type-id-21' name='buf' filepath='Python/fileutils.c' line='1722' column='1'/>
+      <parameter type-id='type-id-157' name='count' filepath='Python/fileutils.c' line='1722' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='_Py_fopen_obj' mangled-name='_Py_fopen_obj' filepath='Python/fileutils.c' line='1623' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_fopen_obj'>
+      <parameter type-id='type-id-16' name='path' filepath='Python/fileutils.c' line='1623' column='1'/>
+      <parameter type-id='type-id-3' name='mode' filepath='Python/fileutils.c' line='1623' column='1'/>
+      <return type-id='type-id-188'/>
+    </function-decl>
+    <function-decl name='_Py_wfopen' mangled-name='_Py_wfopen' filepath='Python/fileutils.c' line='1575' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_wfopen'>
+      <parameter type-id='type-id-478' name='path' filepath='Python/fileutils.c' line='1575' column='1'/>
+      <parameter type-id='type-id-478' name='mode' filepath='Python/fileutils.c' line='1575' column='1'/>
+      <return type-id='type-id-188'/>
+    </function-decl>
+    <function-decl name='_Py_open_noraise' mangled-name='_Py_open_noraise' filepath='Python/fileutils.c' line='1563' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_open_noraise'>
+      <parameter type-id='type-id-3' name='pathname' filepath='Python/fileutils.c' line='1563' column='1'/>
+      <parameter type-id='type-id-9' name='flags' filepath='Python/fileutils.c' line='1563' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_Py_open' mangled-name='_Py_open' filepath='Python/fileutils.c' line='1549' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_open'>
+      <parameter type-id='type-id-3' name='pathname' filepath='Python/fileutils.c' line='1563' column='1'/>
+      <parameter type-id='type-id-9' name='flags' filepath='Python/fileutils.c' line='1563' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_Py_set_inheritable_async_safe' mangled-name='_Py_set_inheritable_async_safe' filepath='Python/fileutils.c' line='1472' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_set_inheritable_async_safe'>
+      <parameter type-id='type-id-9' name='fd' filepath='Python/fileutils.c' line='1472' column='1'/>
+      <parameter type-id='type-id-9' name='inheritable' filepath='Python/fileutils.c' line='1472' column='1'/>
+      <parameter type-id='type-id-452' name='atomic_flag_works' filepath='Python/fileutils.c' line='1472' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_Py_set_inheritable' mangled-name='_Py_set_inheritable' filepath='Python/fileutils.c' line='1463' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_set_inheritable'>
+      <parameter type-id='type-id-9' name='fd' filepath='Python/fileutils.c' line='1472' column='1'/>
+      <parameter type-id='type-id-9' name='inheritable' filepath='Python/fileutils.c' line='1472' column='1'/>
+      <parameter type-id='type-id-452' name='atomic_flag_works' filepath='Python/fileutils.c' line='1472' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_Py_get_inheritable' mangled-name='_Py_get_inheritable' filepath='Python/fileutils.c' line='1297' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_get_inheritable'>
+      <parameter type-id='type-id-9' name='fd' filepath='Python/fileutils.c' line='1297' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <class-decl name='stat' size-in-bits='1152' is-struct='yes' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/stat.h' line='46' column='1' id='type-id-843'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='st_dev' type-id='type-id-844' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/stat.h' line='48' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='st_ino' type-id='type-id-845' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/stat.h' line='53' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='st_nlink' type-id='type-id-846' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/stat.h' line='61' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='192'>
+        <var-decl name='st_mode' type-id='type-id-847' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/stat.h' line='62' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='224'>
+        <var-decl name='st_uid' type-id='type-id-848' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/stat.h' line='64' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='256'>
+        <var-decl name='st_gid' type-id='type-id-849' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/stat.h' line='65' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='288'>
+        <var-decl name='__pad0' type-id='type-id-9' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/stat.h' line='67' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='320'>
+        <var-decl name='st_rdev' type-id='type-id-844' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/stat.h' line='69' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='384'>
+        <var-decl name='st_size' type-id='type-id-172' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/stat.h' line='74' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='448'>
+        <var-decl name='st_blksize' type-id='type-id-850' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/stat.h' line='78' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='512'>
+        <var-decl name='st_blocks' type-id='type-id-851' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/stat.h' line='80' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='576'>
+        <var-decl name='st_atim' type-id='type-id-810' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/stat.h' line='91' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='704'>
+        <var-decl name='st_mtim' type-id='type-id-810' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/stat.h' line='92' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='832'>
+        <var-decl name='st_ctim' type-id='type-id-810' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/stat.h' line='93' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='960'>
+        <var-decl name='__glibc_reserved' type-id='type-id-852' visibility='default' filepath='/usr/include/x86_64-linux-gnu/bits/stat.h' line='106' column='1'/>
+      </data-member>
+    </class-decl>
+    <typedef-decl name='__dev_t' type-id='type-id-19' filepath='/usr/include/x86_64-linux-gnu/bits/types.h' line='145' column='1' id='type-id-844'/>
+    <typedef-decl name='__ino_t' type-id='type-id-19' filepath='/usr/include/x86_64-linux-gnu/bits/types.h' line='148' column='1' id='type-id-845'/>
+    <typedef-decl name='__nlink_t' type-id='type-id-19' filepath='/usr/include/x86_64-linux-gnu/bits/types.h' line='151' column='1' id='type-id-846'/>
+    <typedef-decl name='__mode_t' type-id='type-id-66' filepath='/usr/include/x86_64-linux-gnu/bits/types.h' line='150' column='1' id='type-id-847'/>
+    <typedef-decl name='__uid_t' type-id='type-id-66' filepath='/usr/include/x86_64-linux-gnu/bits/types.h' line='146' column='1' id='type-id-848'/>
+    <typedef-decl name='__gid_t' type-id='type-id-66' filepath='/usr/include/x86_64-linux-gnu/bits/types.h' line='147' column='1' id='type-id-849'/>
+    <typedef-decl name='__blksize_t' type-id='type-id-33' filepath='/usr/include/x86_64-linux-gnu/bits/types.h' line='174' column='1' id='type-id-850'/>
+    <typedef-decl name='__blkcnt_t' type-id='type-id-33' filepath='/usr/include/x86_64-linux-gnu/bits/types.h' line='179' column='1' id='type-id-851'/>
+
+    <array-type-def dimensions='1' type-id='type-id-811' size-in-bits='192' id='type-id-852'>
+      <subrange length='3' type-id='type-id-19' id='type-id-322'/>
+
+    </array-type-def>
+    <pointer-type-def type-id='type-id-843' size-in-bits='64' id='type-id-853'/>
+    <function-decl name='_Py_stat' mangled-name='_Py_stat' filepath='Python/fileutils.c' line='1215' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_stat'>
+      <parameter type-id='type-id-16' name='path' filepath='Python/fileutils.c' line='1215' column='1'/>
+      <parameter type-id='type-id-853' name='statbuf' filepath='Python/fileutils.c' line='1215' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_Py_fstat' mangled-name='_Py_fstat' filepath='Python/fileutils.c' line='1187' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_fstat'>
+      <parameter type-id='type-id-9' name='fd' filepath='Python/fileutils.c' line='1187' column='1'/>
+      <parameter type-id='type-id-853' name='status' filepath='Python/fileutils.c' line='1187' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_Py_fstat_noraise' mangled-name='_Py_fstat_noraise' filepath='Python/fileutils.c' line='1120' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_fstat_noraise'>
+      <parameter type-id='type-id-9' name='fd' filepath='Python/fileutils.c' line='1120' column='1'/>
+      <parameter type-id='type-id-853' name='status' filepath='Python/fileutils.c' line='1120' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_Py_GetLocaleEncodingObject' mangled-name='_Py_GetLocaleEncodingObject' filepath='Python/fileutils.c' line='924' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_GetLocaleEncodingObject'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <pointer-type-def type-id='type-id-157' size-in-bits='64' id='type-id-854'/>
+    <function-decl name='_Py_EncodeLocaleEx' mangled-name='_Py_EncodeLocaleEx' filepath='Python/fileutils.c' line='863' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_EncodeLocaleEx'>
+      <parameter type-id='type-id-478' name='text' filepath='Python/fileutils.c' line='863' column='1'/>
+      <parameter type-id='type-id-215' name='str' filepath='Python/fileutils.c' line='863' column='1'/>
+      <parameter type-id='type-id-854' name='error_pos' filepath='Python/fileutils.c' line='864' column='1'/>
+      <parameter type-id='type-id-196' name='reason' filepath='Python/fileutils.c' line='864' column='1'/>
+      <parameter type-id='type-id-9' name='current_locale' filepath='Python/fileutils.c' line='865' column='1'/>
+      <parameter type-id='type-id-366' name='errors' filepath='Python/fileutils.c' line='865' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_Py_EncodeLocaleRaw' mangled-name='_Py_EncodeLocaleRaw' filepath='Python/fileutils.c' line='856' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_EncodeLocaleRaw'>
+      <parameter type-id='type-id-478' name='text' filepath='Python/fileutils.c' line='856' column='1'/>
+      <parameter type-id='type-id-854' name='error_pos' filepath='Python/fileutils.c' line='856' column='1'/>
+      <return type-id='type-id-72'/>
+    </function-decl>
+    <function-decl name='Py_EncodeLocale' mangled-name='Py_EncodeLocale' filepath='Python/fileutils.c' line='847' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_EncodeLocale'>
+      <parameter type-id='type-id-478' name='text' filepath='Python/fileutils.c' line='856' column='1'/>
+      <parameter type-id='type-id-854' name='error_pos' filepath='Python/fileutils.c' line='856' column='1'/>
+      <return type-id='type-id-72'/>
+    </function-decl>
+    <function-decl name='Py_DecodeLocale' mangled-name='Py_DecodeLocale' filepath='Python/fileutils.c' line='645' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_DecodeLocale'>
+      <parameter type-id='type-id-3' name='arg' filepath='Python/fileutils.c' line='645' column='1'/>
+      <parameter type-id='type-id-854' name='wlen' filepath='Python/fileutils.c' line='645' column='1'/>
+      <return type-id='type-id-325'/>
+    </function-decl>
+    <function-decl name='_Py_DecodeLocaleEx' mangled-name='_Py_DecodeLocaleEx' filepath='Python/fileutils.c' line='583' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_DecodeLocaleEx'>
+      <parameter type-id='type-id-3' name='arg' filepath='Python/fileutils.c' line='583' column='1'/>
+      <parameter type-id='type-id-329' name='wstr' filepath='Python/fileutils.c' line='583' column='1'/>
+      <parameter type-id='type-id-854' name='wlen' filepath='Python/fileutils.c' line='583' column='1'/>
+      <parameter type-id='type-id-196' name='reason' filepath='Python/fileutils.c' line='584' column='1'/>
+      <parameter type-id='type-id-9' name='current_locale' filepath='Python/fileutils.c' line='585' column='1'/>
+      <parameter type-id='type-id-366' name='errors' filepath='Python/fileutils.c' line='585' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_Py_GetForceASCII' mangled-name='_Py_GetForceASCII' filepath='Python/fileutils.c' line='292' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_GetForceASCII'>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_Py_device_encoding' mangled-name='_Py_device_encoding' filepath='Python/fileutils.c' line='67' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_device_encoding'>
+      <parameter type-id='type-id-9' name='fd' filepath='Python/fileutils.c' line='67' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_Py_GetLocaleEncoding' mangled-name='_Py_GetLocaleEncoding' filepath='Python/fileutils.c' line='884' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_GetLocaleEncoding'>
+      <return type-id='type-id-325'/>
+    </function-decl>
+    <function-decl name='ioctl' mangled-name='ioctl' filepath='/usr/include/x86_64-linux-gnu/sys/ioctl.h' line='41' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='fcntl' mangled-name='fcntl64' filepath='/usr/include/fcntl.h' line='151' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__getcwd_alias' mangled-name='getcwd' filepath='/usr/include/x86_64-linux-gnu/bits/unistd.h' line='191' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__realpath_chk' mangled-name='__realpath_chk' filepath='/usr/include/x86_64-linux-gnu/bits/stdlib.h' line='23' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__readlink_alias' mangled-name='readlink' filepath='/usr/include/x86_64-linux-gnu/bits/unistd.h' line='127' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='write' mangled-name='write' filepath='/usr/include/unistd.h' line='366' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='fopen' mangled-name='fopen64' filepath='/usr/include/stdio.h' line='257' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_FSConverter' mangled-name='PyUnicode_FSConverter' filepath='./Include/unicodeobject.h' line='768' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_SetFromErrnoWithFilenameObject' mangled-name='PyErr_SetFromErrnoWithFilenameObject' filepath='./Include/pyerrors.h' line='158' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__wcstombs_alias' mangled-name='wcstombs' filepath='/usr/include/x86_64-linux-gnu/bits/stdlib.h' line='133' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__open_2' mangled-name='__open64_2' filepath='/usr/include/x86_64-linux-gnu/bits/fcntl2.h' line='30' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_SetFromErrnoWithFilenameObjects' mangled-name='PyErr_SetFromErrnoWithFilenameObjects' filepath='./Include/pyerrors.h' line='161' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__xstat' mangled-name='__xstat64' filepath='/usr/include/x86_64-linux-gnu/sys/stat.h' line='409' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__fxstat' mangled-name='__fxstat64' filepath='/usr/include/x86_64-linux-gnu/sys/stat.h' line='406' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_EncodeUTF8Ex' mangled-name='_Py_EncodeUTF8Ex' filepath='./Include/internal/pycore_fileutils.h' line='23' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_DecodeUTF8Ex' mangled-name='_Py_DecodeUTF8Ex' filepath='./Include/internal/pycore_fileutils.h' line='15' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='mbrtowc' mangled-name='mbrtowc' filepath='/usr/include/wchar.h' line='296' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__mbstowcs_alias' mangled-name='mbstowcs' filepath='/usr/include/x86_64-linux-gnu/bits/stdlib.h' line='101' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/suggestions.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='_Py_UTF8_Edit_Cost' mangled-name='_Py_UTF8_Edit_Cost' filepath='Python/suggestions.c' line='272' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_UTF8_Edit_Cost'>
+      <parameter type-id='type-id-16' name='a' filepath='Python/suggestions.c' line='272' column='1'/>
+      <parameter type-id='type-id-16' name='b' filepath='Python/suggestions.c' line='272' column='1'/>
+      <parameter type-id='type-id-31' name='max_cost' filepath='Python/suggestions.c' line='272' column='1'/>
+      <return type-id='type-id-31'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='./Python/dynload_shlib.c' comp-dir-path='/src' language='LANG_C99'>
+
+    <array-type-def dimensions='1' type-id='type-id-3' size-in-bits='infinite' id='type-id-855'>
+      <subrange length='infinite' id='type-id-7'/>
+
+    </array-type-def>
+    <var-decl name='_PyImport_DynLoadFiletab' type-id='type-id-855' visibility='default' filepath='./Python/importdl.h' line='9' column='1'/>
+    <function-decl name='dlsym' mangled-name='dlsym' filepath='/usr/include/dlfcn.h' line='64' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='dlerror' mangled-name='dlerror' filepath='/usr/include/dlfcn.h' line='82' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='dlopen' mangled-name='dlopen' filepath='/usr/include/dlfcn.h' line='56' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='./Modules/getpath.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='_Py_wfopen' mangled-name='_Py_wfopen' filepath='./Include/cpython/fileutils.h' line='97' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_FindEnvConfigValue' mangled-name='_Py_FindEnvConfigValue' filepath='./Include/internal/pycore_pathconfig.h' line='57' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_EncodeLocaleRaw' mangled-name='_Py_EncodeLocaleRaw' filepath='./Include/cpython/fileutils.h' line='35' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__wcscpy_alias' mangled-name='wcscpy' filepath='/usr/include/x86_64-linux-gnu/bits/wchar2.h' line='147' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__wcscat_alias' mangled-name='wcscat' filepath='/usr/include/x86_64-linux-gnu/bits/wchar2.h' line='241' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__wcsncat_alias' mangled-name='wcsncat' filepath='/usr/include/x86_64-linux-gnu/bits/wchar2.h' line='257' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Modules/main.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='Py_BytesMain' mangled-name='Py_BytesMain' filepath='Modules/main.c' line='713' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_BytesMain'>
+      <parameter type-id='type-id-9' name='argc' filepath='Modules/main.c' line='713' column='1'/>
+      <parameter type-id='type-id-215' name='argv' filepath='Modules/main.c' line='713' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='Py_Main' mangled-name='Py_Main' filepath='Modules/main.c' line='701' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_Main'>
+      <parameter type-id='type-id-9' name='argc' filepath='Modules/main.c' line='701' column='1'/>
+      <parameter type-id='type-id-329' name='argv' filepath='Modules/main.c' line='701' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='Py_RunMain' mangled-name='Py_RunMain' filepath='Modules/main.c' line='662' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='Py_RunMain'>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyImport_Fini2' mangled-name='_PyImport_Fini2' filepath='./Include/internal/pycore_pylifecycle.h' line='98' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyPathConfig_ClearGlobal' mangled-name='_PyPathConfig_ClearGlobal' filepath='./Include/internal/pycore_pathconfig.h' line='49' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_HandleSystemExit' mangled-name='_Py_HandleSystemExit' filepath='./Include/internal/pycore_pylifecycle.h' line='126' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyImport_GetImporter' mangled-name='PyImport_GetImporter' filepath='./Include/import.h' line='72' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyRun_SimpleStringFlags' mangled-name='PyRun_SimpleStringFlags' filepath='./Include/cpython/pythonrun.h' line='5' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyRun_SimpleFileObject' mangled-name='_PyRun_SimpleFileObject' filepath='./Include/cpython/pythonrun.h' line='6' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='Py_MakePendingCalls' mangled-name='Py_MakePendingCalls' filepath='./Include/ceval.h' line='37' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyRun_AnyFileObject' mangled-name='_PyRun_AnyFileObject' filepath='./Include/cpython/pythonrun.h' line='16' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyOS_setsig' mangled-name='PyOS_setsig' filepath='./Include/pylifecycle.h' line='63' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='getpid' mangled-name='getpid' filepath='/usr/include/unistd.h' line='628' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='kill' mangled-name='kill' filepath='/usr/include/signal.h' line='112' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_PreInitializeFromPyArgv' mangled-name='_Py_PreInitializeFromPyArgv' filepath='./Include/internal/pycore_pylifecycle.h' line='118' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyConfig_SetArgv' mangled-name='PyConfig_SetArgv' filepath='./Include/cpython/initconfig.h' line='230' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyConfig_SetBytesArgv' mangled-name='PyConfig_SetBytesArgv' filepath='./Include/cpython/initconfig.h' line='226' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Modules/gcmodule.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='PyObject_GC_IsFinalized' mangled-name='PyObject_GC_IsFinalized' filepath='Modules/gcmodule.c' line='2358' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_GC_IsFinalized'>
+      <parameter type-id='type-id-16' name='s' filepath='Objects/abstract.c' line='1721' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyObject_GC_IsTracked' mangled-name='PyObject_GC_IsTracked' filepath='Modules/gcmodule.c' line='2349' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_GC_IsTracked'>
+      <parameter type-id='type-id-16' name='s' filepath='Objects/abstract.c' line='1721' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyObject_GC_Del' mangled-name='PyObject_GC_Del' filepath='Modules/gcmodule.c' line='2335' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_GC_Del'>
+      <parameter type-id='type-id-21' name='op' filepath='Modules/gcmodule.c' line='2335' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObject_GC_Resize' mangled-name='_PyObject_GC_Resize' filepath='Modules/gcmodule.c' line='2317' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_GC_Resize'>
+      <parameter type-id='type-id-474' name='op' filepath='Modules/gcmodule.c' line='2317' column='1'/>
+      <parameter type-id='type-id-31' name='nitems' filepath='Modules/gcmodule.c' line='2317' column='1'/>
+      <return type-id='type-id-474'/>
+    </function-decl>
+    <function-decl name='_PyObject_GC_NewVar' mangled-name='_PyObject_GC_NewVar' filepath='Modules/gcmodule.c' line='2298' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_GC_NewVar'>
+      <parameter type-id='type-id-32' name='tp' filepath='Objects/object.c' line='192' column='1'/>
+      <parameter type-id='type-id-31' name='nitems' filepath='Objects/object.c' line='192' column='1'/>
+      <return type-id='type-id-474'/>
+    </function-decl>
+    <function-decl name='_PyObject_GC_New' mangled-name='_PyObject_GC_New' filepath='Modules/gcmodule.c' line='2287' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_GC_New'>
+      <parameter type-id='type-id-32' name='tp' filepath='Modules/gcmodule.c' line='2287' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyObject_GC_Calloc' mangled-name='_PyObject_GC_Calloc' filepath='Modules/gcmodule.c' line='2281' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_GC_Calloc'>
+      <parameter type-id='type-id-157' name='basicsize' filepath='Modules/gcmodule.c' line='2281' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyObject_GC_Malloc' mangled-name='_PyObject_GC_Malloc' filepath='Modules/gcmodule.c' line='2275' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyObject_GC_Malloc'>
+      <parameter type-id='type-id-157' name='basicsize' filepath='Modules/gcmodule.c' line='2281' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyObject_IS_GC' mangled-name='PyObject_IS_GC' filepath='Modules/gcmodule.c' line='2230' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_IS_GC'>
+      <parameter type-id='type-id-16' name='s' filepath='Objects/abstract.c' line='1721' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyObject_GC_UnTrack' mangled-name='PyObject_GC_UnTrack' filepath='Modules/gcmodule.c' line='2218' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_GC_UnTrack'>
+      <parameter type-id='type-id-21' name='op_raw' filepath='Modules/gcmodule.c' line='2218' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_GC_Track' mangled-name='PyObject_GC_Track' filepath='Modules/gcmodule.c' line='2199' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyObject_GC_Track'>
+      <parameter type-id='type-id-21' name='op_raw' filepath='Modules/gcmodule.c' line='2199' column='1'/>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyGC_Collect' mangled-name='PyGC_Collect' filepath='Modules/gcmodule.c' line='2081' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyGC_Collect'>
+      <return type-id='type-id-31'/>
+    </function-decl>
+    <function-decl name='PyGC_IsEnabled' mangled-name='PyGC_IsEnabled' filepath='Modules/gcmodule.c' line='2073' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyGC_IsEnabled'>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyGC_Disable' mangled-name='PyGC_Disable' filepath='Modules/gcmodule.c' line='2064' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyGC_Disable'>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyGC_Enable' mangled-name='PyGC_Enable' filepath='Modules/gcmodule.c' line='2055' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyGC_Enable'>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyInit_gc' mangled-name='PyInit_gc' filepath='Modules/gcmodule.c' line='2048' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInit_gc'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyErr_WarnExplicitFormat' mangled-name='PyErr_WarnExplicitFormat' filepath='./Include/warnings.h' line='48' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_convert_optional_to_ssize_t' mangled-name='_Py_convert_optional_to_ssize_t' filepath='./Include/cpython/abstract.h' line='370' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTime_GetMonotonicClock' mangled-name='_PyTime_GetMonotonicClock' filepath='./Include/cpython/pytime.h' line='199' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTime_AsSecondsDouble' mangled-name='_PyTime_AsSecondsDouble' filepath='./Include/cpython/pytime.h' line='104' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTuple_MaybeUntrack' mangled-name='_PyTuple_MaybeUntrack' filepath='./Include/cpython/tupleobject.h' line='14' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyFrame_ClearFreeList' mangled-name='_PyFrame_ClearFreeList' filepath='./Include/internal/pycore_gc.h' line='170' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTuple_ClearFreeList' mangled-name='_PyTuple_ClearFreeList' filepath='./Include/internal/pycore_gc.h' line='171' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyFloat_ClearFreeList' mangled-name='_PyFloat_ClearFreeList' filepath='./Include/internal/pycore_gc.h' line='172' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyList_ClearFreeList' mangled-name='_PyList_ClearFreeList' filepath='./Include/internal/pycore_gc.h' line='173' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyDict_ClearFreeList' mangled-name='_PyDict_ClearFreeList' filepath='./Include/internal/pycore_gc.h' line='174' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAsyncGen_ClearFreeLists' mangled-name='_PyAsyncGen_ClearFreeLists' filepath='./Include/internal/pycore_gc.h' line='175' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyContext_ClearFreeList' mangled-name='_PyContext_ClearFreeList' filepath='./Include/internal/pycore_gc.h' line='176' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyDict_MaybeUntrack' mangled-name='_PyDict_MaybeUntrack' filepath='./Include/cpython/dictobject.h' line='52' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='./Modules/posixmodule.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='PyInit_posix' mangled-name='PyInit_posix' filepath='./Modules/posixmodule.c' line='15825' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInit_posix'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_Py_Sigset_Converter' mangled-name='_Py_Sigset_Converter' filepath='./Modules/posixmodule.c' line='1501' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_Sigset_Converter'>
+      <parameter type-id='type-id-16' name='obj' filepath='./Modules/posixmodule.c' line='1501' column='1'/>
+      <parameter type-id='type-id-21' name='addr' filepath='./Modules/posixmodule.c' line='1501' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <typedef-decl name='gid_t' type-id='type-id-849' filepath='/usr/include/x86_64-linux-gnu/sys/types.h' line='64' column='1' id='type-id-856'/>
+    <pointer-type-def type-id='type-id-856' size-in-bits='64' id='type-id-857'/>
+    <function-decl name='_Py_Gid_Converter' mangled-name='_Py_Gid_Converter' filepath='./Modules/posixmodule.c' line='789' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_Gid_Converter'>
+      <parameter type-id='type-id-16' name='obj' filepath='./Modules/posixmodule.c' line='789' column='1'/>
+      <parameter type-id='type-id-857' name='p' filepath='./Modules/posixmodule.c' line='789' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <typedef-decl name='uid_t' type-id='type-id-848' filepath='/usr/include/x86_64-linux-gnu/sys/types.h' line='79' column='1' id='type-id-858'/>
+    <pointer-type-def type-id='type-id-858' size-in-bits='64' id='type-id-859'/>
+    <function-decl name='_Py_Uid_Converter' mangled-name='_Py_Uid_Converter' filepath='./Modules/posixmodule.c' line='683' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_Uid_Converter'>
+      <parameter type-id='type-id-16' name='obj' filepath='./Modules/posixmodule.c' line='683' column='1'/>
+      <parameter type-id='type-id-859' name='p' filepath='./Modules/posixmodule.c' line='683' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyOS_AfterFork' mangled-name='PyOS_AfterFork' filepath='./Modules/posixmodule.c' line='649' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyOS_AfterFork'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyOS_AfterFork_Child' mangled-name='PyOS_AfterFork_Child' filepath='./Modules/posixmodule.c' line='589' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyOS_AfterFork_Child'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyOS_BeforeFork' mangled-name='PyOS_BeforeFork' filepath='./Modules/posixmodule.c' line='572' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyOS_BeforeFork'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyOS_AfterFork_Parent' mangled-name='PyOS_AfterFork_Parent' filepath='./Modules/posixmodule.c' line='580' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyOS_AfterFork_Parent'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyLong_FromUid' mangled-name='_PyLong_FromUid' filepath='./Modules/posixmodule.c' line='667' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyLong_FromUid'>
+      <parameter type-id='type-id-858' name='uid' filepath='./Modules/posixmodule.c' line='667' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyLong_FromGid' mangled-name='_PyLong_FromGid' filepath='./Modules/posixmodule.c' line='675' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyLong_FromGid'>
+      <parameter type-id='type-id-856' name='gid' filepath='./Modules/posixmodule.c' line='675' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyOS_FSPath' mangled-name='PyOS_FSPath' filepath='./Modules/posixmodule.c' line='14361' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyOS_FSPath'>
+      <parameter type-id='type-id-16' name='path' filepath='./Modules/posixmodule.c' line='14361' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='qsort' mangled-name='qsort' filepath='/usr/include/stdlib.h' line='830' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyModule_AddObject' mangled-name='PyModule_AddObject' filepath='./Include/modsupport.h' line='146' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyStructSequence_NewType' mangled-name='PyStructSequence_NewType' filepath='./Include/structseq.h' line='30' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='sysconf' mangled-name='sysconf' filepath='/usr/include/unistd.h' line='619' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyType_FromModuleAndSpec' mangled-name='PyType_FromModuleAndSpec' filepath='./Include/object.h' line='238' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='closedir' mangled-name='closedir' filepath='/usr/include/dirent.h' line='149' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='rewinddir' mangled-name='rewinddir' filepath='/usr/include/dirent.h' line='209' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_ResourceWarning' mangled-name='PyErr_ResourceWarning' filepath='./Include/warnings.h' line='23' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='opendir' mangled-name='opendir' filepath='/usr/include/dirent.h' line='134' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='fdopendir' mangled-name='fdopendir' filepath='/usr/include/dirent.h' line='141' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyArg_ParseStackAndKeywords_SizeT' mangled-name='_PyArg_ParseStackAndKeywords_SizeT' filepath='./Include/modsupport.h' line='116' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyType_GetModule' mangled-name='PyType_GetModule' filepath='./Include/object.h' line='239' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_get_blocking' mangled-name='_Py_get_blocking' filepath='./Include/cpython/fileutils.h' line='161' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_set_inheritable' mangled-name='_Py_set_inheritable' filepath='./Include/cpython/fileutils.h' line='152' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_get_inheritable' mangled-name='_Py_get_inheritable' filepath='./Include/cpython/fileutils.h' line='150' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='eventfd_write' mangled-name='eventfd_write' filepath='/usr/include/x86_64-linux-gnu/sys/eventfd.h' line='40' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyLong_FileDescriptor_Converter' mangled-name='_PyLong_FileDescriptor_Converter' filepath='./Include/cpython/fileobject.h' line='18' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyLong_UnsignedLongLong_Converter' mangled-name='_PyLong_UnsignedLongLong_Converter' filepath='./Include/longobject.h' line='72' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='eventfd_read' mangled-name='eventfd_read' filepath='/usr/include/x86_64-linux-gnu/sys/eventfd.h' line='37' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='eventfd' mangled-name='eventfd' filepath='/usr/include/x86_64-linux-gnu/sys/eventfd.h' line='34' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyLong_UnsignedInt_Converter' mangled-name='_PyLong_UnsignedInt_Converter' filepath='./Include/longobject.h' line='70' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='memfd_create' mangled-name='memfd_create' filepath='/usr/include/x86_64-linux-gnu/bits/mman-shared.h' line='50' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyOS_URandom' mangled-name='_PyOS_URandom' filepath='./Include/cpython/pylifecycle.h' line='56' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='listxattr' mangled-name='listxattr' filepath='/usr/include/x86_64-linux-gnu/sys/xattr.h' line='76' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='flistxattr' mangled-name='flistxattr' filepath='/usr/include/x86_64-linux-gnu/sys/xattr.h' line='87' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='llistxattr' mangled-name='llistxattr' filepath='/usr/include/x86_64-linux-gnu/sys/xattr.h' line='82' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='removexattr' mangled-name='removexattr' filepath='/usr/include/x86_64-linux-gnu/sys/xattr.h' line='92' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='fremovexattr' mangled-name='fremovexattr' filepath='/usr/include/x86_64-linux-gnu/sys/xattr.h' line='101' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='lremovexattr' mangled-name='lremovexattr' filepath='/usr/include/x86_64-linux-gnu/sys/xattr.h' line='97' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='setxattr' mangled-name='setxattr' filepath='/usr/include/x86_64-linux-gnu/sys/xattr.h' line='41' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='fsetxattr' mangled-name='fsetxattr' filepath='/usr/include/x86_64-linux-gnu/sys/xattr.h' line='54' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='lsetxattr' mangled-name='lsetxattr' filepath='/usr/include/x86_64-linux-gnu/sys/xattr.h' line='48' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='getxattr' mangled-name='getxattr' filepath='/usr/include/x86_64-linux-gnu/sys/xattr.h' line='59' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='fgetxattr' mangled-name='fgetxattr' filepath='/usr/include/x86_64-linux-gnu/sys/xattr.h' line='70' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='lgetxattr' mangled-name='lgetxattr' filepath='/usr/include/x86_64-linux-gnu/sys/xattr.h' line='65' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='getresgid' mangled-name='getresgid' filepath='/usr/include/unistd.h' line='738' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='getresuid' mangled-name='getresuid' filepath='/usr/include/unistd.h' line='733' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='setresgid' mangled-name='setresgid' filepath='/usr/include/unistd.h' line='748' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='setresuid' mangled-name='setresuid' filepath='/usr/include/unistd.h' line='743' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_device_encoding' mangled-name='_Py_device_encoding' filepath='./Include/cpython/fileutils.h' line='39' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='getloadavg' mangled-name='getloadavg' filepath='/usr/include/stdlib.h' line='1003' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='fpathconf' mangled-name='fpathconf' filepath='/usr/include/unistd.h' line='616' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='pathconf' mangled-name='pathconf' filepath='/usr/include/unistd.h' line='612' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='fstatvfs' mangled-name='fstatvfs64' filepath='/usr/include/x86_64-linux-gnu/sys/statvfs.h' line='77' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='statvfs' mangled-name='statvfs64' filepath='/usr/include/x86_64-linux-gnu/sys/statvfs.h' line='56' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='unsetenv' mangled-name='unsetenv' filepath='/usr/include/stdlib.h' line='657' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='posix_fadvise' mangled-name='posix_fadvise64' filepath='/usr/include/fcntl.h' line='264' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='posix_fallocate' mangled-name='posix_fallocate64' filepath='/usr/include/fcntl.h' line='285' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='truncate' mangled-name='truncate64' filepath='/usr/include/unistd.h' line='995' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyIndex_Check' mangled-name='PyIndex_Check' filepath='./Include/abstract.h' line='520' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__xmknodat' mangled-name='__xmknodat' filepath='/usr/include/x86_64-linux-gnu/sys/stat.h' line='441' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__xmknod' mangled-name='__xmknod' filepath='/usr/include/x86_64-linux-gnu/sys/stat.h' line='438' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='mkfifoat' mangled-name='mkfifoat' filepath='/usr/include/x86_64-linux-gnu/sys/stat.h' line='353' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='mkfifo' mangled-name='mkfifo' filepath='/usr/include/x86_64-linux-gnu/sys/stat.h' line='346' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='splice' mangled-name='splice' filepath='/usr/include/x86_64-linux-gnu/bits/fcntl-linux.h' line='420' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='copy_file_range' mangled-name='copy_file_range' filepath='/usr/include/unistd.h' line='1107' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='pwritev2' mangled-name='pwritev64v2' filepath='/usr/include/x86_64-linux-gnu/sys/uio.h' line='136' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='pwrite' mangled-name='pwrite64' filepath='/usr/include/unistd.h' line='391' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='writev' mangled-name='writev' filepath='/usr/include/x86_64-linux-gnu/sys/uio.h' line='52' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='pipe2' mangled-name='pipe2' filepath='/usr/include/unistd.h' line='422' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='pipe' mangled-name='pipe' filepath='/usr/include/unistd.h' line='417' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='sendfile' mangled-name='sendfile64' filepath='/usr/include/x86_64-linux-gnu/sys/sendfile.h' line='37' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='preadv2' mangled-name='preadv64v2' filepath='/usr/include/x86_64-linux-gnu/sys/uio.h' line='140' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__pread64_alias' mangled-name='pread64' filepath='/usr/include/x86_64-linux-gnu/bits/unistd.h' line='55' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='readv' mangled-name='readv' filepath='/usr/include/x86_64-linux-gnu/sys/uio.h' line='41' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='lockf' mangled-name='lockf64' filepath='/usr/include/unistd.h' line='1082' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='dup2' mangled-name='dup2' filepath='/usr/include/unistd.h' line='534' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='dup3' mangled-name='dup3' filepath='/usr/include/unistd.h' line='539' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_closerange' mangled-name='_Py_closerange' filepath='./Include/internal/pycore_fileutils.h' line='51' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__openat_alias' mangled-name='openat64' filepath='/usr/include/x86_64-linux-gnu/bits/fcntl2.h' line='107' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__open_alias' mangled-name='open64' filepath='/usr/include/x86_64-linux-gnu/bits/fcntl2.h' line='32' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='tcsetpgrp' mangled-name='tcsetpgrp' filepath='/usr/include/unistd.h' line='841' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyArg_ParseStack_SizeT' mangled-name='_PyArg_ParseStack_SizeT' filepath='./Include/modsupport.h' line='111' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='tcgetpgrp' mangled-name='tcgetpgrp' filepath='/usr/include/unistd.h' line='838' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='setpgid' mangled-name='setpgid' filepath='/usr/include/unistd.h' line='646' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='setsid' mangled-name='setsid' filepath='/usr/include/unistd.h' line='667' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='getsid' mangled-name='getsid' filepath='/usr/include/unistd.h' line='671' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyArg_Parse_SizeT' mangled-name='_PyArg_Parse_SizeT' filepath='./Include/modsupport.h' line='39' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='times' mangled-name='times' filepath='/usr/include/x86_64-linux-gnu/sys/times.h' line='46' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='symlinkat' mangled-name='symlinkat' filepath='/usr/include/unistd.h' line='815' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='symlink' mangled-name='symlink' filepath='/usr/include/unistd.h' line='802' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='wait' mangled-name='wait' filepath='/usr/include/x86_64-linux-gnu/sys/wait.h' line='77' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='waitpid' mangled-name='waitpid' filepath='/usr/include/x86_64-linux-gnu/sys/wait.h' line='100' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='waitid' mangled-name='waitid' filepath='/usr/include/x86_64-linux-gnu/sys/wait.h' line='121' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='wait4' mangled-name='wait4' filepath='/usr/include/x86_64-linux-gnu/sys/wait.h' line='142' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='wait3' mangled-name='wait3' filepath='/usr/include/x86_64-linux-gnu/sys/wait.h' line='136' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='setgid' mangled-name='setgid' filepath='/usr/include/unistd.h' line='717' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='setregid' mangled-name='setregid' filepath='/usr/include/unistd.h' line='722' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='setreuid' mangled-name='setreuid' filepath='/usr/include/unistd.h' line='705' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='setegid' mangled-name='setegid' filepath='/usr/include/unistd.h' line='727' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='seteuid' mangled-name='seteuid' filepath='/usr/include/unistd.h' line='710' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='setuid' mangled-name='setuid' filepath='/usr/include/unistd.h' line='700' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='killpg' mangled-name='killpg' filepath='/usr/include/signal.h' line='119' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='getuid' mangled-name='getuid' filepath='/usr/include/unistd.h' line='675' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='getlogin' mangled-name='getlogin' filepath='/usr/include/unistd.h' line='848' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='getppid' mangled-name='getppid' filepath='/usr/include/unistd.h' line='631' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='setpgrp' mangled-name='setpgrp' filepath='/usr/include/unistd.h' line='660' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='getpgrp' mangled-name='getpgrp' filepath='/usr/include/unistd.h' line='634' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='getpgid' mangled-name='getpgid' filepath='/usr/include/unistd.h' line='639' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='initgroups' mangled-name='initgroups' filepath='/usr/include/grp.h' line='197' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='getgrouplist' mangled-name='getgrouplist' filepath='/usr/include/grp.h' line='186' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='getgid' mangled-name='getgid' filepath='/usr/include/unistd.h' line='681' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='geteuid' mangled-name='geteuid' filepath='/usr/include/unistd.h' line='678' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='getegid' mangled-name='getegid' filepath='/usr/include/unistd.h' line='684' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='forkpty' mangled-name='forkpty' filepath='/usr/include/pty.h' line='42' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='openpty' mangled-name='openpty' filepath='/usr/include/pty.h' line='36' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__sched_cpualloc' mangled-name='__sched_cpualloc' filepath='/usr/include/x86_64-linux-gnu/bits/cpu-set.h' line='119' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='sched_getaffinity' mangled-name='sched_getaffinity' filepath='/usr/include/sched.h' line='125' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__sched_cpufree' mangled-name='__sched_cpufree' filepath='/usr/include/x86_64-linux-gnu/bits/cpu-set.h' line='120' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__sched_cpucount' mangled-name='__sched_cpucount' filepath='/usr/include/x86_64-linux-gnu/bits/cpu-set.h' line='117' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='sched_setaffinity' mangled-name='sched_setaffinity' filepath='/usr/include/sched.h' line='121' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='sched_yield' mangled-name='sched_yield' filepath='/usr/include/sched.h' line='68' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='sched_rr_get_interval' mangled-name='sched_rr_get_interval' filepath='/usr/include/sched.h' line='77' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='sched_setparam' mangled-name='sched_setparam' filepath='/usr/include/sched.h' line='54' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='sched_getparam' mangled-name='sched_getparam' filepath='/usr/include/sched.h' line='58' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='sched_setscheduler' mangled-name='sched_setscheduler' filepath='/usr/include/sched.h' line='61' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='sched_getscheduler' mangled-name='sched_getscheduler' filepath='/usr/include/sched.h' line='65' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='sched_get_priority_min' mangled-name='sched_get_priority_min' filepath='/usr/include/sched.h' line='74' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='sched_get_priority_max' mangled-name='sched_get_priority_max' filepath='/usr/include/sched.h' line='71' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='fork' mangled-name='fork' filepath='/usr/include/unistd.h' line='756' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='fexecve' mangled-name='fexecve' filepath='/usr/include/unistd.h' line='557' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='execve' mangled-name='execve' filepath='/usr/include/unistd.h' line='551' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='execv' mangled-name='execv' filepath='/usr/include/unistd.h' line='563' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_exit' mangled-name='_exit' filepath='/usr/include/unistd.h' line='603' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTime_ObjectToTimespec' mangled-name='_PyTime_ObjectToTimespec' filepath='./Include/cpython/pytime.h' line='69' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='futimens' mangled-name='futimens' filepath='/usr/include/x86_64-linux-gnu/sys/stat.h' line='368' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='utimensat' mangled-name='utimensat' filepath='/usr/include/x86_64-linux-gnu/sys/stat.h' line='360' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='umask' mangled-name='umask' filepath='/usr/include/x86_64-linux-gnu/sys/stat.h' line='308' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='system' mangled-name='system' filepath='/usr/include/stdlib.h' line='784' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='unlinkat' mangled-name='unlinkat' filepath='/usr/include/unistd.h' line='829' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='rmdir' mangled-name='rmdir' filepath='/usr/include/unistd.h' line='834' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='setpriority' mangled-name='setpriority' filepath='/usr/include/x86_64-linux-gnu/sys/resource.h' line='97' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='getpriority' mangled-name='getpriority' filepath='/usr/include/x86_64-linux-gnu/sys/resource.h' line='93' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='nice' mangled-name='nice' filepath='/usr/include/unistd.h' line='598' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='mkdirat' mangled-name='mkdirat' filepath='/usr/include/x86_64-linux-gnu/sys/stat.h' line='324' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='mkdir' mangled-name='mkdir' filepath='/usr/include/x86_64-linux-gnu/sys/stat.h' line='317' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='readdir' mangled-name='readdir64' filepath='/usr/include/dirent.h' line='165' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='linkat' mangled-name='linkat' filepath='/usr/include/unistd.h' line='795' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='link' mangled-name='link' filepath='/usr/include/unistd.h' line='789' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='lchown' mangled-name='lchown' filepath='/usr/include/unistd.h' line='483' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='fchown' mangled-name='fchown' filepath='/usr/include/unistd.h' line='478' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='chown' mangled-name='chown' filepath='/usr/include/unistd.h' line='473' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='fchownat' mangled-name='fchownat' filepath='/usr/include/unistd.h' line='491' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='fdatasync' mangled-name='fdatasync' filepath='/usr/include/unistd.h' line='1115' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='sync' mangled-name='sync' filepath='/usr/include/unistd.h' line='970' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='fsync' mangled-name='fsync' filepath='/usr/include/unistd.h' line='954' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='chroot' mangled-name='chroot' filepath='/usr/include/unistd.h' line='942' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='fchmod' mangled-name='fchmod' filepath='/usr/include/x86_64-linux-gnu/sys/stat.h' line='293' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='chmod' mangled-name='chmod' filepath='/usr/include/x86_64-linux-gnu/sys/stat.h' line='280' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='fchmodat' mangled-name='fchmodat' filepath='/usr/include/x86_64-linux-gnu/sys/stat.h' line='299' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='fchdir' mangled-name='fchdir' filepath='/usr/include/unistd.h' line='501' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='chdir' mangled-name='chdir' filepath='/usr/include/unistd.h' line='497' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='ctermid' mangled-name='ctermid' filepath='/usr/include/stdio.h' line='812' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__ttyname_r_alias' mangled-name='ttyname_r' filepath='/usr/include/x86_64-linux-gnu/bits/unistd.h' line='281' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='faccessat' mangled-name='faccessat' filepath='/usr/include/unistd.h' line='304' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='access' mangled-name='access' filepath='/usr/include/unistd.h' line='287' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='setgroups' mangled-name='setgroups' filepath='/usr/include/grp.h' line='176' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyMapping_Size' mangled-name='PyMapping_Size' filepath='./Include/abstract.h' line='789' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyMapping_Values' mangled-name='PyMapping_Values' filepath='./Include/abstract.h' line='838' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyBytes_FromFormat' mangled-name='PyBytes_FromFormat' filepath='./Include/bytesobject.h' line='39' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyLong_AsTime_t' mangled-name='_PyLong_AsTime_t' filepath='./Include/cpython/pytime.h' line='48' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='uname' mangled-name='uname' filepath='/usr/include/x86_64-linux-gnu/sys/utsname.h' line='81' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='rename' mangled-name='rename' filepath='/usr/include/stdio.h' line='148' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='renameat' mangled-name='renameat' filepath='/usr/include/stdio.h' line='152' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyLong_FromTime_t' mangled-name='_PyLong_FromTime_t' filepath='./Include/cpython/pytime.h' line='44' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='sigaddset' mangled-name='sigaddset' filepath='/usr/include/signal.h' line='202' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyGILState_Reinit' mangled-name='_PyGILState_Reinit' filepath='./Include/internal/pycore_pystate.h' line='137' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyEval_ReInitThreads' mangled-name='_PyEval_ReInitThreads' filepath='./Include/internal/pycore_ceval.h' line='28' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyImport_ReInitLock' mangled-name='_PyImport_ReInitLock' filepath='./Include/internal/pycore_import.h' line='9' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PySignal_AfterFork' mangled-name='_PySignal_AfterFork' filepath='./Include/internal/pycore_pystate.h' line='138' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyRuntimeState_ReInitThreads' mangled-name='_PyRuntimeState_ReInitThreads' filepath='./Include/internal/pycore_runtime.h' line='134' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyInterpreterState_DeleteExceptMain' mangled-name='_PyInterpreterState_DeleteExceptMain' filepath='./Include/internal/pycore_pystate.h' line='136' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__readlinkat_alias' mangled-name='readlinkat' filepath='/usr/include/x86_64-linux-gnu/bits/unistd.h' line='159' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_set_blocking' mangled-name='_Py_set_blocking' filepath='./Include/cpython/fileutils.h' line='163' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='ftruncate' mangled-name='ftruncate64' filepath='/usr/include/unistd.h' line='1017' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='unlink' mangled-name='unlink' filepath='/usr/include/unistd.h' line='825' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyImport_ReleaseLock' mangled-name='_PyImport_ReleaseLock' filepath='./Include/cpython/import.h' line='14' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__fxstatat' mangled-name='__fxstatat64' filepath='/usr/include/x86_64-linux-gnu/sys/stat.h' line='415' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__lxstat' mangled-name='__lxstat64' filepath='/usr/include/x86_64-linux-gnu/sys/stat.h' line='412' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__getgroups_alias' mangled-name='getgroups' filepath='/usr/include/x86_64-linux-gnu/bits/unistd.h' line='256' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='posix_spawn_file_actions_addclose' mangled-name='posix_spawn_file_actions_addclose' filepath='/usr/include/spawn.h' line='191' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='posix_spawn_file_actions_adddup2' mangled-name='posix_spawn_file_actions_adddup2' filepath='/usr/include/spawn.h' line='197' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='posix_spawn_file_actions_addopen' mangled-name='posix_spawn_file_actions_addopen' filepath='/usr/include/spawn.h' line='182' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='posix_spawn_file_actions_init' mangled-name='posix_spawn_file_actions_init' filepath='/usr/include/spawn.h' line='171' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='posix_spawnattr_setpgroup' mangled-name='posix_spawnattr_setpgroup' filepath='/usr/include/spawn.h' line='141' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='posix_spawnattr_setsigmask' mangled-name='posix_spawnattr_setsigmask' filepath='/usr/include/spawn.h' line='120' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='posix_spawnattr_setsigdefault' mangled-name='posix_spawnattr_setsigdefault' filepath='/usr/include/spawn.h' line='108' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='posix_spawnattr_setschedpolicy' mangled-name='posix_spawnattr_setschedpolicy' filepath='/usr/include/spawn.h' line='152' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='posix_spawnattr_setschedparam' mangled-name='posix_spawnattr_setschedparam' filepath='/usr/include/spawn.h' line='164' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='posix_spawnattr_init' mangled-name='posix_spawnattr_init' filepath='/usr/include/spawn.h' line='93' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='posix_spawnattr_destroy' mangled-name='posix_spawnattr_destroy' filepath='/usr/include/spawn.h' line='97' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='posix_spawnattr_setflags' mangled-name='posix_spawnattr_setflags' filepath='/usr/include/spawn.h' line='131' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='posix_spawn_file_actions_destroy' mangled-name='posix_spawn_file_actions_destroy' filepath='/usr/include/spawn.h' line='176' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='posix_spawnp' mangled-name='posix_spawnp' filepath='/usr/include/spawn.h' line='85' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='posix_spawn' mangled-name='posix_spawn' filepath='/usr/include/spawn.h' line='72' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='./Modules/errnomodule.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='PyInit_errno' mangled-name='PyInit_errno' filepath='./Modules/errnomodule.c' line='957' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInit_errno'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='./Modules/pwdmodule.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='PyInit_pwd' mangled-name='PyInit_pwd' filepath='./Modules/pwdmodule.c' line='370' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInit_pwd'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyModule_AddType' mangled-name='PyModule_AddType' filepath='./Include/modsupport.h' line='152' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='getpwuid_r' mangled-name='getpwuid_r' filepath='/usr/include/pwd.h' line='145' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyLong_FromUid' mangled-name='_PyLong_FromUid' filepath='./Modules/posixmodule.h' line='15' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_Uid_Converter' mangled-name='_Py_Uid_Converter' filepath='./Modules/posixmodule.h' line='17' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyLong_FromGid' mangled-name='_PyLong_FromGid' filepath='./Modules/posixmodule.h' line='16' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='endpwent' mangled-name='endpwent' filepath='/usr/include/pwd.h' line='78' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='setpwent' mangled-name='setpwent' filepath='/usr/include/pwd.h' line='72' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='getpwent' mangled-name='getpwent' filepath='/usr/include/pwd.h' line='84' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='getpwnam_r' mangled-name='getpwnam_r' filepath='/usr/include/pwd.h' line='151' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='./Modules/_sre.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='PyInit__sre' mangled-name='PyInit__sre' filepath='./Modules/_sre.c' line='2962' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInit__sre'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyModule_AddStringConstant' mangled-name='PyModule_AddStringConstant' filepath='./Include/modsupport.h' line='149' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_ToLowercase' mangled-name='_PyUnicode_ToLowercase' filepath='./Include/cpython/unicodeobject.h' line='1085' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_ToUppercase' mangled-name='_PyUnicode_ToUppercase' filepath='./Include/cpython/unicodeobject.h' line='1089' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyBytes_Join' mangled-name='_PyBytes_Join' filepath='./Include/cpython/bytesobject.h' line='38' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__ctype_toupper_loc' mangled-name='__ctype_toupper_loc' filepath='/usr/include/ctype.h' line='83' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_CallObject' mangled-name='PyObject_CallObject' filepath='./Include/abstract.h' line='169' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='./Modules/_codecsmodule.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='PyInit__codecs' mangled-name='PyInit__codecs' filepath='./Modules/_codecsmodule.c' line='1067' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInit__codecs'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyCodec_Unregister' mangled-name='PyCodec_Unregister' filepath='./Include/codecs.h' line='34' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyCodec_Register' mangled-name='PyCodec_Register' filepath='./Include/codecs.h' line='26' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyCodec_RegisterError' mangled-name='PyCodec_RegisterError' filepath='./Include/codecs.h' line='214' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_EncodeCharmap' mangled-name='_PyUnicode_EncodeCharmap' filepath='./Include/cpython/unicodeobject.h' line='910' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_AsLatin1String' mangled-name='_PyUnicode_AsLatin1String' filepath='./Include/cpython/unicodeobject.h' line='879' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_AsRawUnicodeEscapeString' mangled-name='PyUnicode_AsRawUnicodeEscapeString' filepath='./Include/unicodeobject.h' line='626' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_AsUnicodeEscapeString' mangled-name='PyUnicode_AsUnicodeEscapeString' filepath='./Include/unicodeobject.h' line='614' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_EncodeUTF32' mangled-name='_PyUnicode_EncodeUTF32' filepath='./Include/cpython/unicodeobject.h' line='795' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_EncodeUTF16' mangled-name='_PyUnicode_EncodeUTF16' filepath='./Include/cpython/unicodeobject.h' line='829' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_EncodeUTF7' mangled-name='_PyUnicode_EncodeUTF7' filepath='./Include/cpython/unicodeobject.h' line='767' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_DecodeCharmap' mangled-name='PyUnicode_DecodeCharmap' filepath='./Include/unicodeobject.h' line='677' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_DecodeRawUnicodeEscapeStateful' mangled-name='_PyUnicode_DecodeRawUnicodeEscapeStateful' filepath='./Include/cpython/unicodeobject.h' line='870' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyUnicode_DecodeUnicodeEscapeStateful' mangled-name='_PyUnicode_DecodeUnicodeEscapeStateful' filepath='./Include/cpython/unicodeobject.h' line='838' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_DecodeUTF32Stateful' mangled-name='PyUnicode_DecodeUTF32Stateful' filepath='./Include/unicodeobject.h' line='522' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_DecodeUTF16Stateful' mangled-name='PyUnicode_DecodeUTF16Stateful' filepath='./Include/unicodeobject.h' line='589' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_DecodeUTF7Stateful' mangled-name='PyUnicode_DecodeUTF7Stateful' filepath='./Include/unicodeobject.h' line='445' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyBytes_DecodeEscape' mangled-name='PyBytes_DecodeEscape' filepath='./Include/bytesobject.h' line='46' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_BuildEncodingMap' mangled-name='PyUnicode_BuildEncodingMap' filepath='./Include/unicodeobject.h' line='433' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='./Modules/_weakref.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='PyInit__weakref' mangled-name='PyInit__weakref' filepath='./Modules/_weakref.c' line='188' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInit__weakref'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyWeakref_NewProxy' mangled-name='PyWeakref_NewProxy' filepath='./Include/weakrefobject.h' line='60' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyWeakref_GetWeakrefCount' mangled-name='_PyWeakref_GetWeakrefCount' filepath='./Include/weakrefobject.h' line='65' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyDict_DelItemIf' mangled-name='_PyDict_DelItemIf' filepath='./Include/cpython/dictobject.h' line='41' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='./Modules/_functoolsmodule.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='PyInit__functools' mangled-name='PyInit__functools' filepath='./Modules/_functoolsmodule.c' line='1534' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInit__functools'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyType_GetModuleByDef' mangled-name='_PyType_GetModuleByDef' filepath='./Include/cpython/object.h' line='307' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyDict_Pop_KnownHash' mangled-name='_PyDict_Pop_KnownHash' filepath='./Include/cpython/dictobject.h' line='57' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PySequence_Concat' mangled-name='PySequence_Concat' filepath='./Include/abstract.h' line='657' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyDict_Merge' mangled-name='PyDict_Merge' filepath='./Include/dictobject.h' line='44' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='./Modules/_operator.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='PyInit__operator' mangled-name='PyInit__operator' filepath='./Modules/_operator.c' line='1805' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInit__operator'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyType_GetModuleState' mangled-name='PyType_GetModuleState' filepath='./Include/object.h' line='240' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PySequence_Count' mangled-name='PySequence_Count' filepath='./Include/abstract.h' line='738' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PySequence_InPlaceConcat' mangled-name='PySequence_InPlaceConcat' filepath='./Include/abstract.h' line='771' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='./Modules/_collectionsmodule.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='PyInit__collections' mangled-name='PyInit__collections' filepath='./Modules/_collectionsmodule.c' line='2638' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInit__collections'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PySequence_GetSlice' mangled-name='PySequence_GetSlice' filepath='./Include/abstract.h' line='673' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyArg_ParseStack' mangled-name='_PyArg_ParseStack' filepath='./Include/modsupport.h' line='111' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyType_LookupId' mangled-name='_PyType_LookupId' filepath='./Include/cpython/object.h' line='301' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='./Modules/_abc.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='PyInit__abc' mangled-name='PyInit__abc' filepath='./Modules/_abc.c' line='971' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInit__abc'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PySet_Clear' mangled-name='PySet_Clear' filepath='./Include/setobject.h' line='84' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PySet_Size' mangled-name='PySet_Size' filepath='./Include/setobject.h' line='88' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyMapping_Items' mangled-name='PyMapping_Items' filepath='./Include/abstract.h' line='843' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='./Modules/itertoolsmodule.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='PyInit_itertools' mangled-name='PyInit_itertools' filepath='./Modules/itertoolsmodule.c' line='4904' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInit_itertools'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='./Modules/atexitmodule.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='PyInit_atexit' mangled-name='PyInit_atexit' filepath='./Modules/atexitmodule.c' line='287' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInit_atexit'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='./Modules/signalmodule.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='_PyOS_IsMainThread' mangled-name='_PyOS_IsMainThread' filepath='./Modules/signalmodule.c' line='2034' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyOS_IsMainThread'>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyOS_InterruptOccurred' mangled-name='PyOS_InterruptOccurred' filepath='./Modules/signalmodule.c' line='2001' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyOS_InterruptOccurred'>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_Py_RestoreSignals' mangled-name='_Py_RestoreSignals' filepath='./Modules/signalmodule.c' line='1921' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_Py_RestoreSignals'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_SetInterrupt' mangled-name='PyErr_SetInterrupt' filepath='./Modules/signalmodule.c' line='1883' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_SetInterrupt'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_SetInterruptEx' mangled-name='PyErr_SetInterruptEx' filepath='./Modules/signalmodule.c' line='1868' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_SetInterruptEx'>
+      <parameter type-id='type-id-9' name='signum' filepath='./Modules/signalmodule.c' line='1868' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyErr_CheckSignals' mangled-name='_PyErr_CheckSignals' filepath='./Modules/signalmodule.c' line='1856' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyErr_CheckSignals'>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyErr_CheckSignals' mangled-name='PyErr_CheckSignals' filepath='./Modules/signalmodule.c' line='1761' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyErr_CheckSignals'>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyInit__signal' mangled-name='PyInit__signal' filepath='./Modules/signalmodule.c' line='1721' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInit__signal'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyErr_CheckSignalsTstate' mangled-name='_PyErr_CheckSignalsTstate' filepath='./Modules/signalmodule.c' line='1774' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyErr_CheckSignalsTstate'>
+      <parameter type-id='type-id-703' name='tstate' filepath='./Modules/signalmodule.c' line='1774' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyOS_InterruptOccurred' mangled-name='_PyOS_InterruptOccurred' filepath='./Modules/signalmodule.c' line='1983' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyOS_InterruptOccurred'>
+      <parameter type-id='type-id-703' name='tstate' filepath='./Modules/signalmodule.c' line='1983' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='_PyEval_AddPendingCall' mangled-name='_PyEval_AddPendingCall' filepath='./Include/internal/pycore_ceval.h' line='22' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyEval_SignalReceived' mangled-name='_PyEval_SignalReceived' filepath='./Include/internal/pycore_ceval.h' line='21' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__libc_current_sigrtmin' mangled-name='__libc_current_sigrtmin' filepath='/usr/include/signal.h' line='366' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='__libc_current_sigrtmax' mangled-name='__libc_current_sigrtmax' filepath='/usr/include/signal.h' line='368' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyOS_getsig' mangled-name='PyOS_getsig' filepath='./Include/pylifecycle.h' line='62' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_NewException' mangled-name='PyErr_NewException' filepath='./Include/pyerrors.h' line='218' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='sigismember' mangled-name='sigismember' filepath='/usr/include/signal.h' line='208' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='pthread_kill' mangled-name='pthread_kill' filepath='/usr/include/x86_64-linux-gnu/bits/sigthread.h' line='36' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='sigtimedwait' mangled-name='sigtimedwait' filepath='/usr/include/signal.h' line='269' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTime_FromSecondsObject' mangled-name='_PyTime_FromSecondsObject' filepath='./Include/cpython/pytime.h' line='93' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTime_AsTimespec' mangled-name='_PyTime_AsTimespec' filepath='./Include/cpython/pytime.h' line='155' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_Sigset_Converter' mangled-name='_Py_Sigset_Converter' filepath='./Modules/posixmodule.h' line='26' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='sigwaitinfo' mangled-name='sigwaitinfo' filepath='/usr/include/signal.h' line='261' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='sigfillset' mangled-name='sigfillset' filepath='/usr/include/signal.h' line='199' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='sigwait' mangled-name='sigwait' filepath='/usr/include/signal.h' line='252' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='sigpending' mangled-name='sigpending' filepath='/usr/include/signal.h' line='244' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='pthread_sigmask' mangled-name='pthread_sigmask' filepath='/usr/include/x86_64-linux-gnu/bits/sigthread.h' line='31' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='getitimer' mangled-name='getitimer' filepath='/usr/include/x86_64-linux-gnu/sys/time.h' line='123' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTime_AsTimeval' mangled-name='_PyTime_AsTimeval' filepath='./Include/cpython/pytime.h' line='126' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='setitimer' mangled-name='setitimer' filepath='/usr/include/x86_64-linux-gnu/sys/time.h' line='129' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='strsignal' mangled-name='strsignal' filepath='/usr/include/string.h' line='447' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='strstr' mangled-name='strstr' filepath='/usr/include/string.h' line='330' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='raise' mangled-name='raise' filepath='/usr/include/signal.h' line='123' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='pause' mangled-name='pause' filepath='/usr/include/unistd.h' line='469' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='alarm' mangled-name='alarm' filepath='/usr/include/unistd.h' line='432' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='./Modules/_stat.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='PyInit__stat' mangled-name='PyInit__stat' filepath='./Modules/_stat.c' line='630' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInit__stat'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='./Modules/timemodule.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='PyInit_time' mangled-name='PyInit_time' filepath='./Modules/timemodule.c' line='2042' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInit_time'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='time' mangled-name='time' filepath='/usr/include/time.h' line='75' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTime_localtime' mangled-name='_PyTime_localtime' filepath='./Include/cpython/pytime.h' line='216' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTime_FromTimespec' mangled-name='_PyTime_FromTimespec' filepath='./Include/cpython/pytime.h' line='150' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTime_GetSystemClockWithInfo' mangled-name='_PyTime_GetSystemClockWithInfo' filepath='./Include/cpython/pytime.h' line='185' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTime_GetMonotonicClockWithInfo' mangled-name='_PyTime_GetMonotonicClockWithInfo' filepath='./Include/cpython/pytime.h' line='209' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTime_GetPerfCounterWithInfo' mangled-name='_PyTime_GetPerfCounterWithInfo' filepath='./Include/cpython/pytime.h' line='238' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTime_AsNanosecondsObject' mangled-name='_PyTime_AsNanosecondsObject' filepath='./Include/cpython/pytime.h' line='116' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTime_ObjectToTime_t' mangled-name='_PyTime_ObjectToTime_t' filepath='./Include/cpython/pytime.h' line='52' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='wcsftime' mangled-name='wcsftime' filepath='/usr/include/wchar.h' line='834' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTime_gmtime' mangled-name='_PyTime_gmtime' filepath='./Include/cpython/pytime.h' line='220' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='pthread_getcpuclockid' mangled-name='pthread_getcpuclockid' filepath='/usr/include/pthread.h' line='1140' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTime_FromTimeval' mangled-name='_PyTime_FromTimeval' filepath='./Include/cpython/pytime.h' line='120' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='clock' mangled-name='clock' filepath='/usr/include/time.h' line='72' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTime_MulDiv' mangled-name='_PyTime_MulDiv' filepath='./Include/cpython/pytime.h' line='160' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='getrusage' mangled-name='getrusage' filepath='/usr/include/x86_64-linux-gnu/sys/resource.h' line='87' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='tzset' mangled-name='tzset' filepath='/usr/include/time.h' line='170' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='select' mangled-name='select' filepath='/usr/include/x86_64-linux-gnu/sys/select.h' line='101' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='clock_settime' mangled-name='clock_settime' filepath='/usr/include/time.h' line='216' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTime_FromNanosecondsObject' mangled-name='_PyTime_FromNanosecondsObject' filepath='./Include/cpython/pytime.h' line='88' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='mktime' mangled-name='mktime' filepath='/usr/include/time.h' line='82' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='./Modules/_threadmodule.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='PyInit__thread' mangled-name='PyInit__thread' filepath='./Modules/_threadmodule.c' line='1709' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInit__thread'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_PyErr_Display' mangled-name='_PyErr_Display' filepath='./Include/internal/pycore_pylifecycle.h' line='131' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyThread_get_thread_native_id' mangled-name='PyThread_get_thread_native_id' filepath='./Include/pythread.h' line='30' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyThreadState_Prealloc' mangled-name='_PyThreadState_Prealloc' filepath='./Include/cpython/pystate.h' line='157' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyThread_start_new_thread' mangled-name='PyThread_start_new_thread' filepath='./Include/pythread.h' line='24' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyThreadState_Init' mangled-name='_PyThreadState_Init' filepath='./Include/internal/pycore_pystate.h' line='123' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyEval_AcquireThread' mangled-name='PyEval_AcquireThread' filepath='./Include/ceval.h' line='129' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyThreadState_DeleteCurrent' mangled-name='_PyThreadState_DeleteCurrent' filepath='./Include/internal/pycore_pylifecycle.h' line='134' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyObject_GenericGetAttrWithDict' mangled-name='_PyObject_GenericGetAttrWithDict' filepath='./Include/cpython/object.h' line='340' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyTime_FromSeconds' mangled-name='_PyTime_FromSeconds' filepath='./Include/cpython/pytime.h' line='77' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyThread_acquire_lock_timed' mangled-name='PyThread_acquire_lock_timed' filepath='./Include/pythread.h' line='87' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyThread_get_stacksize' mangled-name='PyThread_get_stacksize' filepath='./Include/pythread.h' line='93' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyThread_set_stacksize' mangled-name='PyThread_set_stacksize' filepath='./Include/pythread.h' line='94' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyErr_SetInterruptEx' mangled-name='PyErr_SetInterruptEx' filepath='./Include/pyerrors.h' line='229' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='./Modules/_localemodule.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='PyInit__locale' mangled-name='PyInit__locale' filepath='./Modules/_localemodule.c' line='913' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInit__locale'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_Py_GetLocaleEncodingObject' mangled-name='_Py_GetLocaleEncodingObject' filepath='./Include/internal/pycore_fileutils.h' line='54' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='bind_textdomain_codeset' mangled-name='bind_textdomain_codeset' filepath='/usr/include/libintl.h' line='91' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='bindtextdomain' mangled-name='bindtextdomain' filepath='/usr/include/libintl.h' line='86' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='dcgettext' mangled-name='dcgettext' filepath='/usr/include/libintl.h' line='51' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='wcscoll' mangled-name='wcscoll' filepath='/usr/include/wchar.h' line='131' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='textdomain' mangled-name='textdomain' filepath='/usr/include/libintl.h' line='82' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='wcsxfrm' mangled-name='wcsxfrm' filepath='/usr/include/wchar.h' line='135' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='./Modules/_io/_iomodule.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='_PyIO_str_close' type-id='type-id-16' visibility='default' filepath='./Modules/_io/_iomodule.h' line='158' column='1'/>
+    <var-decl name='_PyIO_str_closed' type-id='type-id-16' visibility='default' filepath='./Modules/_io/_iomodule.h' line='159' column='1'/>
+    <var-decl name='_PyIO_str_decode' type-id='type-id-16' visibility='default' filepath='./Modules/_io/_iomodule.h' line='160' column='1'/>
+    <var-decl name='_PyIO_str_encode' type-id='type-id-16' visibility='default' filepath='./Modules/_io/_iomodule.h' line='161' column='1'/>
+    <var-decl name='_PyIO_str_fileno' type-id='type-id-16' visibility='default' filepath='./Modules/_io/_iomodule.h' line='162' column='1'/>
+    <var-decl name='_PyIO_str_flush' type-id='type-id-16' visibility='default' filepath='./Modules/_io/_iomodule.h' line='163' column='1'/>
+    <var-decl name='_PyIO_str_getstate' type-id='type-id-16' visibility='default' filepath='./Modules/_io/_iomodule.h' line='164' column='1'/>
+    <var-decl name='_PyIO_str_isatty' type-id='type-id-16' visibility='default' filepath='./Modules/_io/_iomodule.h' line='165' column='1'/>
+    <var-decl name='_PyIO_str_newlines' type-id='type-id-16' visibility='default' filepath='./Modules/_io/_iomodule.h' line='166' column='1'/>
+    <var-decl name='_PyIO_str_nl' type-id='type-id-16' visibility='default' filepath='./Modules/_io/_iomodule.h' line='167' column='1'/>
+    <var-decl name='_PyIO_str_peek' type-id='type-id-16' visibility='default' filepath='./Modules/_io/_iomodule.h' line='168' column='1'/>
+    <var-decl name='_PyIO_str_read' type-id='type-id-16' visibility='default' filepath='./Modules/_io/_iomodule.h' line='169' column='1'/>
+    <var-decl name='_PyIO_str_read1' type-id='type-id-16' visibility='default' filepath='./Modules/_io/_iomodule.h' line='170' column='1'/>
+    <var-decl name='_PyIO_str_readable' type-id='type-id-16' visibility='default' filepath='./Modules/_io/_iomodule.h' line='171' column='1'/>
+    <var-decl name='_PyIO_str_readall' type-id='type-id-16' visibility='default' filepath='./Modules/_io/_iomodule.h' line='172' column='1'/>
+    <var-decl name='_PyIO_str_readinto' type-id='type-id-16' visibility='default' filepath='./Modules/_io/_iomodule.h' line='173' column='1'/>
+    <var-decl name='_PyIO_str_readline' type-id='type-id-16' visibility='default' filepath='./Modules/_io/_iomodule.h' line='174' column='1'/>
+    <var-decl name='_PyIO_str_reset' type-id='type-id-16' visibility='default' filepath='./Modules/_io/_iomodule.h' line='175' column='1'/>
+    <var-decl name='_PyIO_str_seek' type-id='type-id-16' visibility='default' filepath='./Modules/_io/_iomodule.h' line='176' column='1'/>
+    <var-decl name='_PyIO_str_seekable' type-id='type-id-16' visibility='default' filepath='./Modules/_io/_iomodule.h' line='177' column='1'/>
+    <var-decl name='_PyIO_str_setstate' type-id='type-id-16' visibility='default' filepath='./Modules/_io/_iomodule.h' line='178' column='1'/>
+    <var-decl name='_PyIO_str_tell' type-id='type-id-16' visibility='default' filepath='./Modules/_io/_iomodule.h' line='179' column='1'/>
+    <var-decl name='_PyIO_str_truncate' type-id='type-id-16' visibility='default' filepath='./Modules/_io/_iomodule.h' line='180' column='1'/>
+    <var-decl name='_PyIO_str_writable' type-id='type-id-16' visibility='default' filepath='./Modules/_io/_iomodule.h' line='181' column='1'/>
+    <var-decl name='_PyIO_str_write' type-id='type-id-16' visibility='default' filepath='./Modules/_io/_iomodule.h' line='182' column='1'/>
+    <var-decl name='_PyIO_empty_str' type-id='type-id-16' visibility='default' filepath='./Modules/_io/_iomodule.h' line='184' column='1'/>
+    <var-decl name='_PyIO_empty_bytes' type-id='type-id-16' visibility='default' filepath='./Modules/_io/_iomodule.h' line='185' column='1'/>
+    <var-decl name='_PyIO_Module' type-id='type-id-465' visibility='default' filepath='./Modules/_io/_iomodule.h' line='140' column='1'/>
+    <function-decl name='PyInit__io' mangled-name='PyInit__io' filepath='./Modules/_io/_iomodule.c' line='691' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInit__io'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyModule_Create2' mangled-name='PyModule_Create2' filepath='./Include/modsupport.h' line='226' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyFile_OpenCodeObject' mangled-name='PyFile_OpenCodeObject' filepath='./Include/cpython/fileobject.h' line='15' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyState_FindModule' mangled-name='PyState_FindModule' filepath='./Include/pystate.h' line='56' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='./Modules/_io/iobase.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PyIOBase_Type' type-id='type-id-149' visibility='default' filepath='./Modules/_io/_iomodule.h' line='8' column='1'/>
+    <var-decl name='PyRawIOBase_Type' type-id='type-id-149' visibility='default' filepath='./Modules/_io/_iomodule.h' line='9' column='1'/>
+    <function-decl name='_PyIO_trap_eintr' mangled-name='_PyIO_trap_eintr' filepath='./Modules/_io/_iomodule.h' line='76' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_CallMethodObjArgs' mangled-name='PyObject_CallMethodObjArgs' filepath='./Include/abstract.h' line='226' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyByteArray_AsString' mangled-name='PyByteArray_AsString' filepath='./Include/bytearrayobject.h' line='34' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyIO_get_module_state' mangled-name='_PyIO_get_module_state' filepath='./Modules/_io/_iomodule.h' line='152' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyObject_CallFinalizer' mangled-name='PyObject_CallFinalizer' filepath='./Include/cpython/object.h' line='334' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='./Modules/_io/fileio.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PyFileIO_Type' type-id='type-id-149' visibility='default' filepath='./Modules/_io/_iomodule.h' line='14' column='1'/>
+    <function-decl name='_PyIOBase_finalize' mangled-name='_PyIOBase_finalize' filepath='./Modules/_io/_iomodule.h' line='45' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='./Modules/_io/bytesio.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PyBytesIO_Type' type-id='type-id-149' visibility='default' filepath='./Modules/_io/_iomodule.h' line='15' column='1'/>
+    <var-decl name='_PyBytesIOBuffer_Type' type-id='type-id-149' mangled-name='_PyBytesIOBuffer_Type' visibility='default' filepath='./Modules/_io/_iomodule.h' line='187' column='1' elf-symbol-id='_PyBytesIOBuffer_Type'/>
+    <function-decl name='_PySys_GetSizeOf' mangled-name='_PySys_GetSizeOf' filepath='./Include/cpython/sysmodule.h' line='8' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='./Modules/_io/bufferedio.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PyBufferedIOBase_Type' type-id='type-id-149' visibility='default' filepath='./Modules/_io/_iomodule.h' line='10' column='1'/>
+    <var-decl name='PyBufferedReader_Type' type-id='type-id-149' visibility='default' filepath='./Modules/_io/_iomodule.h' line='17' column='1'/>
+    <var-decl name='PyBufferedWriter_Type' type-id='type-id-149' visibility='default' filepath='./Modules/_io/_iomodule.h' line='18' column='1'/>
+    <var-decl name='PyBufferedRWPair_Type' type-id='type-id-149' visibility='default' filepath='./Modules/_io/_iomodule.h' line='19' column='1'/>
+    <var-decl name='PyBufferedRandom_Type' type-id='type-id-149' visibility='default' filepath='./Modules/_io/_iomodule.h' line='20' column='1'/>
+    <function-decl name='_PyIOBase_check_seekable' mangled-name='_PyIOBase_check_seekable' filepath='./Modules/_io/_iomodule.h' line='38' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyIOBase_check_readable' mangled-name='_PyIOBase_check_readable' filepath='./Modules/_io/_iomodule.h' line='36' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyIOBase_check_writable' mangled-name='_PyIOBase_check_writable' filepath='./Modules/_io/_iomodule.h' line='37' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyFileIO_closed' mangled-name='_PyFileIO_closed' filepath='./Modules/_io/_iomodule.h' line='49' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyNumber_AsOff_t' mangled-name='PyNumber_AsOff_t' filepath='./Modules/_io/_iomodule.h' line='134' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyBytes_Concat' mangled-name='PyBytes_Concat' filepath='./Include/bytesobject.h' line='44' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='./Modules/_io/textio.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PyTextIOBase_Type' type-id='type-id-149' visibility='default' filepath='./Modules/_io/_iomodule.h' line='11' column='1'/>
+    <var-decl name='PyIncrementalNewlineDecoder_Type' type-id='type-id-149' visibility='default' filepath='./Modules/_io/_iomodule.h' line='22' column='1'/>
+    <var-decl name='PyTextIOWrapper_Type' type-id='type-id-149' visibility='default' filepath='./Modules/_io/_iomodule.h' line='21' column='1'/>
+    <function-decl name='_PyIOBase_check_closed' mangled-name='_PyIOBase_check_closed' filepath='./Modules/_io/_iomodule.h' line='39' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyLong_AsByteArray' mangled-name='_PyLong_AsByteArray' filepath='./Include/longobject.h' line='170' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyCodec_LookupTextEncoding' mangled-name='_PyCodec_LookupTextEncoding' filepath='./Include/codecs.h' line='123' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyCodecInfo_GetIncrementalEncoder' mangled-name='_PyCodecInfo_GetIncrementalEncoder' filepath='./Include/codecs.h' line='148' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyCodecInfo_GetIncrementalDecoder' mangled-name='_PyCodecInfo_GetIncrementalDecoder' filepath='./Include/codecs.h' line='143' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='./Modules/_io/stringio.c' comp-dir-path='/src' language='LANG_C99'>
+    <var-decl name='PyStringIO_Type' type-id='type-id-149' visibility='default' filepath='./Modules/_io/_iomodule.h' line='16' column='1'/>
+    <function-decl name='_PyAccu_Destroy' mangled-name='_PyAccu_Destroy' filepath='./Include/internal/pycore_accu.h' line='33' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAccu_Init' mangled-name='_PyAccu_Init' filepath='./Include/internal/pycore_accu.h' line='29' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyIO_find_line_ending' mangled-name='_PyIO_find_line_ending' filepath='./Modules/_io/_iomodule.h' line='68' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAccu_Finish' mangled-name='_PyAccu_Finish' filepath='./Include/internal/pycore_accu.h' line='32' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyAccu_Accumulate' mangled-name='_PyAccu_Accumulate' filepath='./Include/internal/pycore_accu.h' line='30' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_PyIncrementalNewlineDecoder_decode' mangled-name='_PyIncrementalNewlineDecoder_decode' filepath='./Modules/_io/_iomodule.h' line='52' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_AsUCS4' mangled-name='PyUnicode_AsUCS4' filepath='./Include/unicodeobject.h' line='154' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyUnicode_AsUCS4Copy' mangled-name='PyUnicode_AsUCS4Copy' filepath='./Include/unicodeobject.h' line='163' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='./Modules/faulthandler.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='PyInit_faulthandler' mangled-name='PyInit_faulthandler' filepath='./Modules/faulthandler.c' line='1323' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInit_faulthandler'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='sigaltstack' mangled-name='sigaltstack' filepath='/usr/include/signal.h' line='321' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='getrlimit' mangled-name='getrlimit64' filepath='/usr/include/x86_64-linux-gnu/sys/resource.h' line='54' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='setrlimit' mangled-name='setrlimit64' filepath='/usr/include/x86_64-linux-gnu/sys/resource.h' line='73' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyThreadState_GetInterpreter' mangled-name='PyThreadState_GetInterpreter' filepath='./Include/pystate.h' line='89' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_DumpTraceback' mangled-name='_Py_DumpTraceback' filepath='./Include/internal/pycore_traceback.h' line='31' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_DumpExtensionModules' mangled-name='_Py_DumpExtensionModules' filepath='./Include/internal/pycore_pyerrors.h' line='87' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='./Modules/_tracemalloc.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='_PyTraceMalloc_GetTraceback' mangled-name='_PyTraceMalloc_GetTraceback' filepath='./Modules/_tracemalloc.c' line='1812' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_PyTraceMalloc_GetTraceback'>
+      <parameter type-id='type-id-66' name='domain' filepath='./Modules/_tracemalloc.c' line='1812' column='1'/>
+      <parameter type-id='type-id-321' name='ptr' filepath='./Modules/_tracemalloc.c' line='1812' column='1'/>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='PyTraceMalloc_Untrack' mangled-name='PyTraceMalloc_Untrack' filepath='./Modules/_tracemalloc.c' line='1753' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyTraceMalloc_Untrack'>
+      <parameter type-id='type-id-66' name='domain' filepath='./Modules/_tracemalloc.c' line='1753' column='1'/>
+      <parameter type-id='type-id-321' name='ptr' filepath='./Modules/_tracemalloc.c' line='1753' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyTraceMalloc_Track' mangled-name='PyTraceMalloc_Track' filepath='./Modules/_tracemalloc.c' line='1730' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyTraceMalloc_Track'>
+      <parameter type-id='type-id-66' name='domain' filepath='./Modules/_tracemalloc.c' line='1730' column='1'/>
+      <parameter type-id='type-id-321' name='ptr' filepath='./Modules/_tracemalloc.c' line='1730' column='1'/>
+      <parameter type-id='type-id-157' name='size' filepath='./Modules/_tracemalloc.c' line='1731' column='1'/>
+      <return type-id='type-id-9'/>
+    </function-decl>
+    <function-decl name='PyInit__tracemalloc' mangled-name='PyInit__tracemalloc' filepath='./Modules/_tracemalloc.c' line='1695' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInit__tracemalloc'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_Py_hashtable_get' mangled-name='_Py_hashtable_get' filepath='./Include/internal/pycore_hashtable.h' line='132' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_hashtable_steal' mangled-name='_Py_hashtable_steal' filepath='./Include/internal/pycore_hashtable.h' line='140' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_hashtable_size' mangled-name='_Py_hashtable_size' filepath='./Include/internal/pycore_hashtable.h' line='108' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_hashtable_foreach' mangled-name='_Py_hashtable_foreach' filepath='./Include/internal/pycore_hashtable.h' line='103' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='_Py_hashtable_clear' mangled-name='_Py_hashtable_clear' filepath='./Include/internal/pycore_hashtable.h' line='94' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+    <function-decl name='PyMem_GetAllocator' mangled-name='PyMem_GetAllocator' filepath='./Include/cpython/pymem.h' line='65' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='./Modules/symtablemodule.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='PyInit__symtable' mangled-name='PyInit__symtable' filepath='./Modules/symtablemodule.c' line='123' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInit__symtable'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+    <function-decl name='_Py_SymtableStringObjectFlags' mangled-name='_Py_SymtableStringObjectFlags' filepath='./Include/internal/pycore_symtable.h' line='124' column='1' visibility='default' binding='global' size-in-bits='64'>
+      <return type-id='type-id-4'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='./Modules/xxsubtype.c' comp-dir-path='/src' language='LANG_C99'>
+    <function-decl name='PyInit_xxsubtype' mangled-name='PyInit_xxsubtype' filepath='./Modules/xxsubtype.c' line='311' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='PyInit_xxsubtype'>
+      <return type-id='type-id-16'/>
+    </function-decl>
+  </abi-instr>
+  <abi-instr version='1.0' address-size='64' path='Python/frozen.c' comp-dir-path='/src' language='LANG_C99'>
+    <class-decl name='_frozen' size-in-bits='192' is-struct='yes' visibility='default' filepath='./Include/cpython/import.h' line='34' column='1' id='type-id-860'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='name' type-id='type-id-3' visibility='default' filepath='./Include/cpython/import.h' line='35' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='64'>
+        <var-decl name='code' type-id='type-id-440' visibility='default' filepath='./Include/cpython/import.h' line='36' column='1'/>
+      </data-member>
+      <data-member access='public' layout-offset-in-bits='128'>
+        <var-decl name='size' type-id='type-id-9' visibility='default' filepath='./Include/cpython/import.h' line='37' column='1'/>
+      </data-member>
+    </class-decl>
+    <qualified-type-def type-id='type-id-860' const='yes' id='type-id-861'/>
+    <pointer-type-def type-id='type-id-861' size-in-bits='64' id='type-id-862'/>
+    <var-decl name='PyImport_FrozenModules' type-id='type-id-862' mangled-name='PyImport_FrozenModules' visibility='default' filepath='./Include/cpython/import.h' line='43' column='1' elf-symbol-id='PyImport_FrozenModules'/>
+  </abi-instr>
+</abi-corpus>
diff --git a/Doc/data/refcounts.dat b/Doc/data/refcounts.dat
index aac1351..89b64e6 100644
--- a/Doc/data/refcounts.dat
+++ b/Doc/data/refcounts.dat
@@ -1073,9 +1073,17 @@
 PyIter_Check:int:::
 PyIter_Check:PyObject*:o:0:
 
+PyAIter_Check:int:::
+PyAIter_Check:PyObject*:o:0:
+
 PyIter_Next:PyObject*::+1:
 PyIter_Next:PyObject*:o:0:
 
+PyIter_Send:int:::
+PyIter_Send:PyObject*:iter:0:
+PyIter_Send:PyObject*:arg:0:
+PyIter_Send:PyObject**:presult:+1:
+
 PyList_Append:int:::
 PyList_Append:PyObject*:list:0:
 PyList_Append:PyObject*:item:+1:
@@ -1205,11 +1213,6 @@
 PyLong_FromString:char**:pend::
 PyLong_FromString:int:base::
 
-PyLong_FromUnicode:PyObject*::+1:
-PyLong_FromUnicode:Py_UNICODE*:u::
-PyLong_FromUnicode:Py_ssize_t:length::
-PyLong_FromUnicode:int:base::
-
 PyLong_FromUnicodeObject:PyObject*::+1:
 PyLong_FromUnicodeObject:PyObject*:u:0:
 PyLong_FromUnicodeObject:int:base::
@@ -1697,6 +1700,9 @@
 PyObject_GetIter:PyObject*::+1:
 PyObject_GetIter:PyObject*:o:0:
 
+PyObject_GetAIter:PyObject*::+1:
+PyObject_GetAIter:PyObject*:o:0:
+
 PyObject_HasAttr:int:::
 PyObject_HasAttr:PyObject*:o:0:
 PyObject_HasAttr:PyObject*:attr_name:0:
@@ -1803,32 +1809,6 @@
 PyObject_TypeCheck:PyObject*:o:0:
 PyObject_TypeCheck:PyTypeObject*:type:0:
 
-PyParser_SimpleParseFile:struct _node*:::
-PyParser_SimpleParseFile:FILE*:fp::
-PyParser_SimpleParseFile:const char*:filename::
-PyParser_SimpleParseFile:int:start::
-
-PyParser_SimpleParseFileFlags:struct _node*:::
-PyParser_SimpleParseFileFlags:FILE*:fp::
-PyParser_SimpleParseFileFlags:const char*:filename::
-PyParser_SimpleParseFileFlags:int:start::
-PyParser_SimpleParseFileFlags:int:flags::
-
-PyParser_SimpleParseString:struct _node*:::
-PyParser_SimpleParseString:const char*:str::
-PyParser_SimpleParseString:int:start::
-
-PyParser_SimpleParseStringFlags:struct _node*:::
-PyParser_SimpleParseStringFlags:const char*:str::
-PyParser_SimpleParseStringFlags:int:start::
-PyParser_SimpleParseStringFlags:int:flags::
-
-PyParser_SimpleParseStringFlagsFilename:struct _node*:::
-PyParser_SimpleParseStringFlagsFilename:const char*:str::
-PyParser_SimpleParseStringFlagsFilename:const char*:filename::
-PyParser_SimpleParseStringFlagsFilename:int:start::
-PyParser_SimpleParseStringFlagsFilename:int:flags::
-
 PyRun_AnyFile:int:::
 PyRun_AnyFile:FILE*:fp::
 PyRun_AnyFile:const char*:filename::
@@ -2447,9 +2427,6 @@
 PyUnicode_AsUnicodeAndSize:PyObject*:unicode:0:
 PyUnicode_AsUnicodeAndSize:Py_ssize_t*:size::
 
-PyUnicode_AsUnicodeCopy:Py_UNICODE*:::
-PyUnicode_AsUnicodeCopy:PyObject*:unicode:0:
-
 PyUnicode_GetSize:Py_ssize_t:::
 PyUnicode_GetSize:PyObject*:unicode:0:
 
@@ -3028,6 +3005,9 @@
 Py_INCREF:void:::
 Py_INCREF:PyObject*:o:+1:
 
+Py_NewRef:void:::
+Py_NewRef:PyObject*:o:+1:
+
 Py_Initialize:void:::
 
 Py_IsInitialized:int:::
@@ -3049,6 +3029,9 @@
 Py_XINCREF:void:::
 Py_XINCREF:PyObject*:o:+1:if o is not NULL
 
+Py_XNewRef:void:::
+Py_XNewRef:PyObject*:o:+1:if o is not NULL
+
 _PyImport_Fini:void:::
 
 _PyObject_New:PyObject*::+1:
diff --git a/Doc/data/stable_abi.dat b/Doc/data/stable_abi.dat
new file mode 100644
index 0000000..ea102b9
--- /dev/null
+++ b/Doc/data/stable_abi.dat
@@ -0,0 +1,863 @@
+role,name,added,ifdef_note
+function,PyAIter_Check,3.10,
+function,PyArg_Parse,3.2,
+function,PyArg_ParseTuple,3.2,
+function,PyArg_ParseTupleAndKeywords,3.2,
+function,PyArg_UnpackTuple,3.2,
+function,PyArg_VaParse,3.2,
+function,PyArg_VaParseTupleAndKeywords,3.2,
+function,PyArg_ValidateKeywordArguments,3.2,
+var,PyBaseObject_Type,3.2,
+function,PyBool_FromLong,3.2,
+var,PyBool_Type,3.2,
+var,PyByteArrayIter_Type,3.2,
+function,PyByteArray_AsString,3.2,
+function,PyByteArray_Concat,3.2,
+function,PyByteArray_FromObject,3.2,
+function,PyByteArray_FromStringAndSize,3.2,
+function,PyByteArray_Resize,3.2,
+function,PyByteArray_Size,3.2,
+var,PyByteArray_Type,3.2,
+var,PyBytesIter_Type,3.2,
+function,PyBytes_AsString,3.2,
+function,PyBytes_AsStringAndSize,3.2,
+function,PyBytes_Concat,3.2,
+function,PyBytes_ConcatAndDel,3.2,
+function,PyBytes_DecodeEscape,3.2,
+function,PyBytes_FromFormat,3.2,
+function,PyBytes_FromFormatV,3.2,
+function,PyBytes_FromObject,3.2,
+function,PyBytes_FromString,3.2,
+function,PyBytes_FromStringAndSize,3.2,
+function,PyBytes_Repr,3.2,
+function,PyBytes_Size,3.2,
+var,PyBytes_Type,3.2,
+type,PyCFunction,3.2,
+type,PyCFunctionWithKeywords,3.2,
+function,PyCFunction_Call,3.2,
+function,PyCFunction_GetFlags,3.2,
+function,PyCFunction_GetFunction,3.2,
+function,PyCFunction_GetSelf,3.2,
+function,PyCFunction_New,3.4,
+function,PyCFunction_NewEx,3.2,
+var,PyCFunction_Type,3.2,
+function,PyCMethod_New,3.9,
+function,PyCallIter_New,3.2,
+var,PyCallIter_Type,3.2,
+function,PyCallable_Check,3.2,
+type,PyCapsule_Destructor,3.2,
+function,PyCapsule_GetContext,3.2,
+function,PyCapsule_GetDestructor,3.2,
+function,PyCapsule_GetName,3.2,
+function,PyCapsule_GetPointer,3.2,
+function,PyCapsule_Import,3.2,
+function,PyCapsule_IsValid,3.2,
+function,PyCapsule_New,3.2,
+function,PyCapsule_SetContext,3.2,
+function,PyCapsule_SetDestructor,3.2,
+function,PyCapsule_SetName,3.2,
+function,PyCapsule_SetPointer,3.2,
+var,PyCapsule_Type,3.2,
+var,PyClassMethodDescr_Type,3.2,
+function,PyCodec_BackslashReplaceErrors,3.2,
+function,PyCodec_Decode,3.2,
+function,PyCodec_Decoder,3.2,
+function,PyCodec_Encode,3.2,
+function,PyCodec_Encoder,3.2,
+function,PyCodec_IgnoreErrors,3.2,
+function,PyCodec_IncrementalDecoder,3.2,
+function,PyCodec_IncrementalEncoder,3.2,
+function,PyCodec_KnownEncoding,3.2,
+function,PyCodec_LookupError,3.2,
+function,PyCodec_NameReplaceErrors,3.7,
+function,PyCodec_Register,3.2,
+function,PyCodec_RegisterError,3.2,
+function,PyCodec_ReplaceErrors,3.2,
+function,PyCodec_StreamReader,3.2,
+function,PyCodec_StreamWriter,3.2,
+function,PyCodec_StrictErrors,3.2,
+function,PyCodec_Unregister,3.10,
+function,PyCodec_XMLCharRefReplaceErrors,3.2,
+function,PyComplex_FromDoubles,3.2,
+function,PyComplex_ImagAsDouble,3.2,
+function,PyComplex_RealAsDouble,3.2,
+var,PyComplex_Type,3.2,
+function,PyDescr_NewClassMethod,3.2,
+function,PyDescr_NewGetSet,3.2,
+function,PyDescr_NewMember,3.2,
+function,PyDescr_NewMethod,3.2,
+var,PyDictItems_Type,3.2,
+var,PyDictIterItem_Type,3.2,
+var,PyDictIterKey_Type,3.2,
+var,PyDictIterValue_Type,3.2,
+var,PyDictKeys_Type,3.2,
+function,PyDictProxy_New,3.2,
+var,PyDictProxy_Type,3.2,
+var,PyDictRevIterItem_Type,3.8,
+var,PyDictRevIterKey_Type,3.8,
+var,PyDictRevIterValue_Type,3.8,
+var,PyDictValues_Type,3.2,
+function,PyDict_Clear,3.2,
+function,PyDict_Contains,3.2,
+function,PyDict_Copy,3.2,
+function,PyDict_DelItem,3.2,
+function,PyDict_DelItemString,3.2,
+function,PyDict_GetItem,3.2,
+function,PyDict_GetItemString,3.2,
+function,PyDict_GetItemWithError,3.2,
+function,PyDict_Items,3.2,
+function,PyDict_Keys,3.2,
+function,PyDict_Merge,3.2,
+function,PyDict_MergeFromSeq2,3.2,
+function,PyDict_New,3.2,
+function,PyDict_Next,3.2,
+function,PyDict_SetItem,3.2,
+function,PyDict_SetItemString,3.2,
+function,PyDict_Size,3.2,
+var,PyDict_Type,3.2,
+function,PyDict_Update,3.2,
+function,PyDict_Values,3.2,
+var,PyEllipsis_Type,3.2,
+var,PyEnum_Type,3.2,
+function,PyErr_BadArgument,3.2,
+function,PyErr_BadInternalCall,3.2,
+function,PyErr_CheckSignals,3.2,
+function,PyErr_Clear,3.2,
+function,PyErr_Display,3.2,
+function,PyErr_ExceptionMatches,3.2,
+function,PyErr_Fetch,3.2,
+function,PyErr_Format,3.2,
+function,PyErr_FormatV,3.5,
+function,PyErr_GetExcInfo,3.7,
+function,PyErr_GivenExceptionMatches,3.2,
+function,PyErr_NewException,3.2,
+function,PyErr_NewExceptionWithDoc,3.2,
+function,PyErr_NoMemory,3.2,
+function,PyErr_NormalizeException,3.2,
+function,PyErr_Occurred,3.2,
+function,PyErr_Print,3.2,
+function,PyErr_PrintEx,3.2,
+function,PyErr_ProgramText,3.2,
+function,PyErr_ResourceWarning,3.6,
+function,PyErr_Restore,3.2,
+function,PyErr_SetExcFromWindowsErr,3.7,on Windows
+function,PyErr_SetExcFromWindowsErrWithFilename,3.7,on Windows
+function,PyErr_SetExcFromWindowsErrWithFilenameObject,3.7,on Windows
+function,PyErr_SetExcFromWindowsErrWithFilenameObjects,3.7,on Windows
+function,PyErr_SetExcInfo,3.7,
+function,PyErr_SetFromErrno,3.2,
+function,PyErr_SetFromErrnoWithFilename,3.2,
+function,PyErr_SetFromErrnoWithFilenameObject,3.2,
+function,PyErr_SetFromErrnoWithFilenameObjects,3.7,
+function,PyErr_SetFromWindowsErr,3.7,on Windows
+function,PyErr_SetFromWindowsErrWithFilename,3.7,on Windows
+function,PyErr_SetImportError,3.7,
+function,PyErr_SetImportErrorSubclass,3.6,
+function,PyErr_SetInterrupt,3.2,
+function,PyErr_SetInterruptEx,3.10,
+function,PyErr_SetNone,3.2,
+function,PyErr_SetObject,3.2,
+function,PyErr_SetString,3.2,
+function,PyErr_SyntaxLocation,3.2,
+function,PyErr_SyntaxLocationEx,3.7,
+function,PyErr_WarnEx,3.2,
+function,PyErr_WarnExplicit,3.2,
+function,PyErr_WarnFormat,3.2,
+function,PyErr_WriteUnraisable,3.2,
+function,PyEval_AcquireLock,3.2,
+function,PyEval_AcquireThread,3.2,
+function,PyEval_CallFunction,3.2,
+function,PyEval_CallMethod,3.2,
+function,PyEval_CallObjectWithKeywords,3.2,
+function,PyEval_EvalCode,3.2,
+function,PyEval_EvalCodeEx,3.2,
+function,PyEval_EvalFrame,3.2,
+function,PyEval_EvalFrameEx,3.2,
+function,PyEval_GetBuiltins,3.2,
+function,PyEval_GetFrame,3.2,
+function,PyEval_GetFuncDesc,3.2,
+function,PyEval_GetFuncName,3.2,
+function,PyEval_GetGlobals,3.2,
+function,PyEval_GetLocals,3.2,
+function,PyEval_InitThreads,3.2,
+function,PyEval_ReleaseLock,3.2,
+function,PyEval_ReleaseThread,3.2,
+function,PyEval_RestoreThread,3.2,
+function,PyEval_SaveThread,3.2,
+function,PyEval_ThreadsInitialized,3.2,
+var,PyExc_ArithmeticError,3.2,
+var,PyExc_AssertionError,3.2,
+var,PyExc_AttributeError,3.2,
+var,PyExc_BaseException,3.2,
+var,PyExc_BlockingIOError,3.7,
+var,PyExc_BrokenPipeError,3.7,
+var,PyExc_BufferError,3.2,
+var,PyExc_BytesWarning,3.2,
+var,PyExc_ChildProcessError,3.7,
+var,PyExc_ConnectionAbortedError,3.7,
+var,PyExc_ConnectionError,3.7,
+var,PyExc_ConnectionRefusedError,3.7,
+var,PyExc_ConnectionResetError,3.7,
+var,PyExc_DeprecationWarning,3.2,
+var,PyExc_EOFError,3.2,
+var,PyExc_EncodingWarning,3.10,
+var,PyExc_EnvironmentError,3.2,
+var,PyExc_Exception,3.2,
+var,PyExc_FileExistsError,3.7,
+var,PyExc_FileNotFoundError,3.7,
+var,PyExc_FloatingPointError,3.2,
+var,PyExc_FutureWarning,3.2,
+var,PyExc_GeneratorExit,3.2,
+var,PyExc_IOError,3.2,
+var,PyExc_ImportError,3.2,
+var,PyExc_ImportWarning,3.2,
+var,PyExc_IndentationError,3.2,
+var,PyExc_IndexError,3.2,
+var,PyExc_InterruptedError,3.7,
+var,PyExc_IsADirectoryError,3.7,
+var,PyExc_KeyError,3.2,
+var,PyExc_KeyboardInterrupt,3.2,
+var,PyExc_LookupError,3.2,
+var,PyExc_MemoryError,3.2,
+var,PyExc_ModuleNotFoundError,3.6,
+var,PyExc_NameError,3.2,
+var,PyExc_NotADirectoryError,3.7,
+var,PyExc_NotImplementedError,3.2,
+var,PyExc_OSError,3.2,
+var,PyExc_OverflowError,3.2,
+var,PyExc_PendingDeprecationWarning,3.2,
+var,PyExc_PermissionError,3.7,
+var,PyExc_ProcessLookupError,3.7,
+var,PyExc_RecursionError,3.7,
+var,PyExc_ReferenceError,3.2,
+var,PyExc_ResourceWarning,3.7,
+var,PyExc_RuntimeError,3.2,
+var,PyExc_RuntimeWarning,3.2,
+var,PyExc_StopAsyncIteration,3.7,
+var,PyExc_StopIteration,3.2,
+var,PyExc_SyntaxError,3.2,
+var,PyExc_SyntaxWarning,3.2,
+var,PyExc_SystemError,3.2,
+var,PyExc_SystemExit,3.2,
+var,PyExc_TabError,3.2,
+var,PyExc_TimeoutError,3.7,
+var,PyExc_TypeError,3.2,
+var,PyExc_UnboundLocalError,3.2,
+var,PyExc_UnicodeDecodeError,3.2,
+var,PyExc_UnicodeEncodeError,3.2,
+var,PyExc_UnicodeError,3.2,
+var,PyExc_UnicodeTranslateError,3.2,
+var,PyExc_UnicodeWarning,3.2,
+var,PyExc_UserWarning,3.2,
+var,PyExc_ValueError,3.2,
+var,PyExc_Warning,3.2,
+var,PyExc_WindowsError,3.7,on Windows
+var,PyExc_ZeroDivisionError,3.2,
+function,PyExceptionClass_Name,3.8,
+function,PyException_GetCause,3.2,
+function,PyException_GetContext,3.2,
+function,PyException_GetTraceback,3.2,
+function,PyException_SetCause,3.2,
+function,PyException_SetContext,3.2,
+function,PyException_SetTraceback,3.2,
+function,PyFile_FromFd,3.2,
+function,PyFile_GetLine,3.2,
+function,PyFile_WriteObject,3.2,
+function,PyFile_WriteString,3.2,
+var,PyFilter_Type,3.2,
+function,PyFloat_AsDouble,3.2,
+function,PyFloat_FromDouble,3.2,
+function,PyFloat_FromString,3.2,
+function,PyFloat_GetInfo,3.2,
+function,PyFloat_GetMax,3.2,
+function,PyFloat_GetMin,3.2,
+var,PyFloat_Type,3.2,
+type,PyFrameObject,3.2,
+function,PyFrame_GetCode,3.10,
+function,PyFrame_GetLineNumber,3.10,
+function,PyFrozenSet_New,3.2,
+var,PyFrozenSet_Type,3.2,
+function,PyGC_Collect,3.2,
+function,PyGC_Disable,3.10,
+function,PyGC_Enable,3.10,
+function,PyGC_IsEnabled,3.10,
+function,PyGILState_Ensure,3.2,
+function,PyGILState_GetThisThreadState,3.2,
+function,PyGILState_Release,3.2,
+type,PyGILState_STATE,3.2,
+type,PyGetSetDef,3.2,
+var,PyGetSetDescr_Type,3.2,
+function,PyImport_AddModule,3.2,
+function,PyImport_AddModuleObject,3.7,
+function,PyImport_AppendInittab,3.2,
+function,PyImport_ExecCodeModule,3.2,
+function,PyImport_ExecCodeModuleEx,3.2,
+function,PyImport_ExecCodeModuleObject,3.7,
+function,PyImport_ExecCodeModuleWithPathnames,3.2,
+function,PyImport_GetImporter,3.2,
+function,PyImport_GetMagicNumber,3.2,
+function,PyImport_GetMagicTag,3.2,
+function,PyImport_GetModule,3.8,
+function,PyImport_GetModuleDict,3.2,
+function,PyImport_Import,3.2,
+function,PyImport_ImportFrozenModule,3.2,
+function,PyImport_ImportFrozenModuleObject,3.7,
+function,PyImport_ImportModule,3.2,
+function,PyImport_ImportModuleLevel,3.2,
+function,PyImport_ImportModuleLevelObject,3.7,
+function,PyImport_ImportModuleNoBlock,3.2,
+function,PyImport_ReloadModule,3.2,
+function,PyIndex_Check,3.8,
+type,PyInterpreterState,3.2,
+function,PyInterpreterState_Clear,3.2,
+function,PyInterpreterState_Delete,3.2,
+function,PyInterpreterState_Get,3.9,
+function,PyInterpreterState_GetDict,3.8,
+function,PyInterpreterState_GetID,3.7,
+function,PyInterpreterState_New,3.2,
+function,PyIter_Check,3.8,
+function,PyIter_Next,3.2,
+function,PyIter_Send,3.10,
+var,PyListIter_Type,3.2,
+var,PyListRevIter_Type,3.2,
+function,PyList_Append,3.2,
+function,PyList_AsTuple,3.2,
+function,PyList_GetItem,3.2,
+function,PyList_GetSlice,3.2,
+function,PyList_Insert,3.2,
+function,PyList_New,3.2,
+function,PyList_Reverse,3.2,
+function,PyList_SetItem,3.2,
+function,PyList_SetSlice,3.2,
+function,PyList_Size,3.2,
+function,PyList_Sort,3.2,
+var,PyList_Type,3.2,
+type,PyLongObject,3.2,
+var,PyLongRangeIter_Type,3.2,
+function,PyLong_AsDouble,3.2,
+function,PyLong_AsLong,3.2,
+function,PyLong_AsLongAndOverflow,3.2,
+function,PyLong_AsLongLong,3.2,
+function,PyLong_AsLongLongAndOverflow,3.2,
+function,PyLong_AsSize_t,3.2,
+function,PyLong_AsSsize_t,3.2,
+function,PyLong_AsUnsignedLong,3.2,
+function,PyLong_AsUnsignedLongLong,3.2,
+function,PyLong_AsUnsignedLongLongMask,3.2,
+function,PyLong_AsUnsignedLongMask,3.2,
+function,PyLong_AsVoidPtr,3.2,
+function,PyLong_FromDouble,3.2,
+function,PyLong_FromLong,3.2,
+function,PyLong_FromLongLong,3.2,
+function,PyLong_FromSize_t,3.2,
+function,PyLong_FromSsize_t,3.2,
+function,PyLong_FromString,3.2,
+function,PyLong_FromUnsignedLong,3.2,
+function,PyLong_FromUnsignedLongLong,3.2,
+function,PyLong_FromVoidPtr,3.2,
+function,PyLong_GetInfo,3.2,
+var,PyLong_Type,3.2,
+var,PyMap_Type,3.2,
+function,PyMapping_Check,3.2,
+function,PyMapping_GetItemString,3.2,
+function,PyMapping_HasKey,3.2,
+function,PyMapping_HasKeyString,3.2,
+function,PyMapping_Items,3.2,
+function,PyMapping_Keys,3.2,
+function,PyMapping_Length,3.2,
+function,PyMapping_SetItemString,3.2,
+function,PyMapping_Size,3.2,
+function,PyMapping_Values,3.2,
+function,PyMem_Calloc,3.7,
+function,PyMem_Free,3.2,
+function,PyMem_Malloc,3.2,
+function,PyMem_Realloc,3.2,
+type,PyMemberDef,3.2,
+var,PyMemberDescr_Type,3.2,
+function,PyMemoryView_FromMemory,3.7,
+function,PyMemoryView_FromObject,3.2,
+function,PyMemoryView_GetContiguous,3.2,
+var,PyMemoryView_Type,3.2,
+type,PyMethodDef,3.2,
+var,PyMethodDescr_Type,3.2,
+type,PyModuleDef,3.2,
+type,PyModuleDef_Base,3.2,
+function,PyModuleDef_Init,3.5,
+var,PyModuleDef_Type,3.5,
+function,PyModule_AddFunctions,3.7,
+function,PyModule_AddIntConstant,3.2,
+function,PyModule_AddObject,3.2,
+function,PyModule_AddObjectRef,3.10,
+function,PyModule_AddStringConstant,3.2,
+function,PyModule_AddType,3.10,
+function,PyModule_Create2,3.2,
+function,PyModule_ExecDef,3.7,
+function,PyModule_FromDefAndSpec2,3.7,
+function,PyModule_GetDef,3.2,
+function,PyModule_GetDict,3.2,
+function,PyModule_GetFilename,3.2,
+function,PyModule_GetFilenameObject,3.2,
+function,PyModule_GetName,3.2,
+function,PyModule_GetNameObject,3.7,
+function,PyModule_GetState,3.2,
+function,PyModule_New,3.2,
+function,PyModule_NewObject,3.7,
+function,PyModule_SetDocString,3.7,
+var,PyModule_Type,3.2,
+function,PyNumber_Absolute,3.2,
+function,PyNumber_Add,3.2,
+function,PyNumber_And,3.2,
+function,PyNumber_AsSsize_t,3.2,
+function,PyNumber_Check,3.2,
+function,PyNumber_Divmod,3.2,
+function,PyNumber_Float,3.2,
+function,PyNumber_FloorDivide,3.2,
+function,PyNumber_InPlaceAdd,3.2,
+function,PyNumber_InPlaceAnd,3.2,
+function,PyNumber_InPlaceFloorDivide,3.2,
+function,PyNumber_InPlaceLshift,3.2,
+function,PyNumber_InPlaceMatrixMultiply,3.7,
+function,PyNumber_InPlaceMultiply,3.2,
+function,PyNumber_InPlaceOr,3.2,
+function,PyNumber_InPlacePower,3.2,
+function,PyNumber_InPlaceRemainder,3.2,
+function,PyNumber_InPlaceRshift,3.2,
+function,PyNumber_InPlaceSubtract,3.2,
+function,PyNumber_InPlaceTrueDivide,3.2,
+function,PyNumber_InPlaceXor,3.2,
+function,PyNumber_Index,3.2,
+function,PyNumber_Invert,3.2,
+function,PyNumber_Long,3.2,
+function,PyNumber_Lshift,3.2,
+function,PyNumber_MatrixMultiply,3.7,
+function,PyNumber_Multiply,3.2,
+function,PyNumber_Negative,3.2,
+function,PyNumber_Or,3.2,
+function,PyNumber_Positive,3.2,
+function,PyNumber_Power,3.2,
+function,PyNumber_Remainder,3.2,
+function,PyNumber_Rshift,3.2,
+function,PyNumber_Subtract,3.2,
+function,PyNumber_ToBase,3.2,
+function,PyNumber_TrueDivide,3.2,
+function,PyNumber_Xor,3.2,
+function,PyOS_AfterFork,3.2,on platforms with fork()
+function,PyOS_AfterFork_Child,3.7,on platforms with fork()
+function,PyOS_AfterFork_Parent,3.7,on platforms with fork()
+function,PyOS_BeforeFork,3.7,on platforms with fork()
+function,PyOS_CheckStack,3.7,on platforms with USE_STACKCHECK
+function,PyOS_FSPath,3.6,
+var,PyOS_InputHook,3.2,
+function,PyOS_InterruptOccurred,3.2,
+function,PyOS_double_to_string,3.2,
+function,PyOS_getsig,3.2,
+function,PyOS_mystricmp,3.2,
+function,PyOS_mystrnicmp,3.2,
+function,PyOS_setsig,3.2,
+type,PyOS_sighandler_t,3.2,
+function,PyOS_snprintf,3.2,
+function,PyOS_string_to_double,3.2,
+function,PyOS_strtol,3.2,
+function,PyOS_strtoul,3.2,
+function,PyOS_vsnprintf,3.2,
+type,PyObject,3.2,
+function,PyObject_ASCII,3.2,
+function,PyObject_AsCharBuffer,3.2,
+function,PyObject_AsFileDescriptor,3.2,
+function,PyObject_AsReadBuffer,3.2,
+function,PyObject_AsWriteBuffer,3.2,
+function,PyObject_Bytes,3.2,
+function,PyObject_Call,3.2,
+function,PyObject_CallFunction,3.2,
+function,PyObject_CallFunctionObjArgs,3.2,
+function,PyObject_CallMethod,3.2,
+function,PyObject_CallMethodObjArgs,3.2,
+function,PyObject_CallNoArgs,3.10,
+function,PyObject_CallObject,3.2,
+function,PyObject_Calloc,3.7,
+function,PyObject_CheckReadBuffer,3.2,
+function,PyObject_ClearWeakRefs,3.2,
+function,PyObject_DelItem,3.2,
+function,PyObject_DelItemString,3.2,
+function,PyObject_Dir,3.2,
+function,PyObject_Format,3.2,
+function,PyObject_Free,3.2,
+function,PyObject_GC_Del,3.2,
+function,PyObject_GC_IsFinalized,3.9,
+function,PyObject_GC_IsTracked,3.9,
+function,PyObject_GC_Track,3.2,
+function,PyObject_GC_UnTrack,3.2,
+function,PyObject_GenericGetAttr,3.2,
+function,PyObject_GenericGetDict,3.10,
+function,PyObject_GenericSetAttr,3.2,
+function,PyObject_GenericSetDict,3.7,
+function,PyObject_GetAIter,3.10,
+function,PyObject_GetAttr,3.2,
+function,PyObject_GetAttrString,3.2,
+function,PyObject_GetItem,3.2,
+function,PyObject_GetIter,3.2,
+function,PyObject_HasAttr,3.2,
+function,PyObject_HasAttrString,3.2,
+function,PyObject_Hash,3.2,
+function,PyObject_HashNotImplemented,3.2,
+function,PyObject_Init,3.2,
+function,PyObject_InitVar,3.2,
+function,PyObject_IsInstance,3.2,
+function,PyObject_IsSubclass,3.2,
+function,PyObject_IsTrue,3.2,
+function,PyObject_Length,3.2,
+function,PyObject_Malloc,3.2,
+function,PyObject_Not,3.2,
+function,PyObject_Realloc,3.2,
+function,PyObject_Repr,3.2,
+function,PyObject_RichCompare,3.2,
+function,PyObject_RichCompareBool,3.2,
+function,PyObject_SelfIter,3.2,
+function,PyObject_SetAttr,3.2,
+function,PyObject_SetAttrString,3.2,
+function,PyObject_SetItem,3.2,
+function,PyObject_Size,3.2,
+function,PyObject_Str,3.2,
+function,PyObject_Type,3.2,
+var,PyProperty_Type,3.2,
+var,PyRangeIter_Type,3.2,
+var,PyRange_Type,3.2,
+var,PyReversed_Type,3.2,
+function,PySeqIter_New,3.2,
+var,PySeqIter_Type,3.2,
+function,PySequence_Check,3.2,
+function,PySequence_Concat,3.2,
+function,PySequence_Contains,3.2,
+function,PySequence_Count,3.2,
+function,PySequence_DelItem,3.2,
+function,PySequence_DelSlice,3.2,
+function,PySequence_Fast,3.2,
+function,PySequence_GetItem,3.2,
+function,PySequence_GetSlice,3.2,
+function,PySequence_In,3.2,
+function,PySequence_InPlaceConcat,3.2,
+function,PySequence_InPlaceRepeat,3.2,
+function,PySequence_Index,3.2,
+function,PySequence_Length,3.2,
+function,PySequence_List,3.2,
+function,PySequence_Repeat,3.2,
+function,PySequence_SetItem,3.2,
+function,PySequence_SetSlice,3.2,
+function,PySequence_Size,3.2,
+function,PySequence_Tuple,3.2,
+var,PySetIter_Type,3.2,
+function,PySet_Add,3.2,
+function,PySet_Clear,3.2,
+function,PySet_Contains,3.2,
+function,PySet_Discard,3.2,
+function,PySet_New,3.2,
+function,PySet_Pop,3.2,
+function,PySet_Size,3.2,
+var,PySet_Type,3.2,
+function,PySlice_AdjustIndices,3.7,
+function,PySlice_GetIndices,3.2,
+function,PySlice_GetIndicesEx,3.2,
+function,PySlice_New,3.2,
+var,PySlice_Type,3.2,
+function,PySlice_Unpack,3.7,
+function,PyState_AddModule,3.3,
+function,PyState_FindModule,3.2,
+function,PyState_RemoveModule,3.3,
+type,PyStructSequence_Desc,3.2,
+type,PyStructSequence_Field,3.2,
+function,PyStructSequence_GetItem,3.2,
+function,PyStructSequence_New,3.2,
+function,PyStructSequence_NewType,3.2,
+function,PyStructSequence_SetItem,3.2,
+var,PySuper_Type,3.2,
+function,PySys_AddWarnOption,3.2,
+function,PySys_AddWarnOptionUnicode,3.2,
+function,PySys_AddXOption,3.7,
+function,PySys_FormatStderr,3.2,
+function,PySys_FormatStdout,3.2,
+function,PySys_GetObject,3.2,
+function,PySys_GetXOptions,3.7,
+function,PySys_HasWarnOptions,3.2,
+function,PySys_ResetWarnOptions,3.2,
+function,PySys_SetArgv,3.2,
+function,PySys_SetArgvEx,3.2,
+function,PySys_SetObject,3.2,
+function,PySys_SetPath,3.2,
+function,PySys_WriteStderr,3.2,
+function,PySys_WriteStdout,3.2,
+type,PyThreadState,3.2,
+function,PyThreadState_Clear,3.2,
+function,PyThreadState_Delete,3.2,
+function,PyThreadState_Get,3.2,
+function,PyThreadState_GetDict,3.2,
+function,PyThreadState_GetFrame,3.10,
+function,PyThreadState_GetID,3.10,
+function,PyThreadState_GetInterpreter,3.10,
+function,PyThreadState_New,3.2,
+function,PyThreadState_SetAsyncExc,3.2,
+function,PyThreadState_Swap,3.2,
+function,PyThread_GetInfo,3.3,
+function,PyThread_ReInitTLS,3.2,
+function,PyThread_acquire_lock,3.2,
+function,PyThread_acquire_lock_timed,3.2,
+function,PyThread_allocate_lock,3.2,
+function,PyThread_create_key,3.2,
+function,PyThread_delete_key,3.2,
+function,PyThread_delete_key_value,3.2,
+function,PyThread_exit_thread,3.2,
+function,PyThread_free_lock,3.2,
+function,PyThread_get_key_value,3.2,
+function,PyThread_get_stacksize,3.2,
+function,PyThread_get_thread_ident,3.2,
+function,PyThread_get_thread_native_id,3.2,
+function,PyThread_init_thread,3.2,
+function,PyThread_release_lock,3.2,
+function,PyThread_set_key_value,3.2,
+function,PyThread_set_stacksize,3.2,
+function,PyThread_start_new_thread,3.2,
+function,PyThread_tss_alloc,3.7,
+function,PyThread_tss_create,3.7,
+function,PyThread_tss_delete,3.7,
+function,PyThread_tss_free,3.7,
+function,PyThread_tss_get,3.7,
+function,PyThread_tss_is_created,3.7,
+function,PyThread_tss_set,3.7,
+function,PyTraceBack_Here,3.2,
+function,PyTraceBack_Print,3.2,
+var,PyTraceBack_Type,3.2,
+var,PyTupleIter_Type,3.2,
+function,PyTuple_GetItem,3.2,
+function,PyTuple_GetSlice,3.2,
+function,PyTuple_New,3.2,
+function,PyTuple_Pack,3.2,
+function,PyTuple_SetItem,3.2,
+function,PyTuple_Size,3.2,
+var,PyTuple_Type,3.2,
+type,PyTypeObject,3.2,
+function,PyType_ClearCache,3.2,
+function,PyType_FromModuleAndSpec,3.10,
+function,PyType_FromSpec,3.2,
+function,PyType_FromSpecWithBases,3.3,
+function,PyType_GenericAlloc,3.2,
+function,PyType_GenericNew,3.2,
+function,PyType_GetFlags,3.2,
+function,PyType_GetModule,3.10,
+function,PyType_GetModuleState,3.10,
+function,PyType_GetSlot,3.4,
+function,PyType_IsSubtype,3.2,
+function,PyType_Modified,3.2,
+function,PyType_Ready,3.2,
+type,PyType_Slot,3.2,
+type,PyType_Spec,3.2,
+var,PyType_Type,3.2,
+function,PyUnicodeDecodeError_Create,3.2,
+function,PyUnicodeDecodeError_GetEncoding,3.2,
+function,PyUnicodeDecodeError_GetEnd,3.2,
+function,PyUnicodeDecodeError_GetObject,3.2,
+function,PyUnicodeDecodeError_GetReason,3.2,
+function,PyUnicodeDecodeError_GetStart,3.2,
+function,PyUnicodeDecodeError_SetEnd,3.2,
+function,PyUnicodeDecodeError_SetReason,3.2,
+function,PyUnicodeDecodeError_SetStart,3.2,
+function,PyUnicodeEncodeError_GetEncoding,3.2,
+function,PyUnicodeEncodeError_GetEnd,3.2,
+function,PyUnicodeEncodeError_GetObject,3.2,
+function,PyUnicodeEncodeError_GetReason,3.2,
+function,PyUnicodeEncodeError_GetStart,3.2,
+function,PyUnicodeEncodeError_SetEnd,3.2,
+function,PyUnicodeEncodeError_SetReason,3.2,
+function,PyUnicodeEncodeError_SetStart,3.2,
+var,PyUnicodeIter_Type,3.2,
+function,PyUnicodeTranslateError_GetEnd,3.2,
+function,PyUnicodeTranslateError_GetObject,3.2,
+function,PyUnicodeTranslateError_GetReason,3.2,
+function,PyUnicodeTranslateError_GetStart,3.2,
+function,PyUnicodeTranslateError_SetEnd,3.2,
+function,PyUnicodeTranslateError_SetReason,3.2,
+function,PyUnicodeTranslateError_SetStart,3.2,
+function,PyUnicode_Append,3.2,
+function,PyUnicode_AppendAndDel,3.2,
+function,PyUnicode_AsASCIIString,3.2,
+function,PyUnicode_AsCharmapString,3.2,
+function,PyUnicode_AsDecodedObject,3.2,
+function,PyUnicode_AsDecodedUnicode,3.2,
+function,PyUnicode_AsEncodedObject,3.2,
+function,PyUnicode_AsEncodedString,3.2,
+function,PyUnicode_AsEncodedUnicode,3.2,
+function,PyUnicode_AsLatin1String,3.2,
+function,PyUnicode_AsMBCSString,3.7,on Windows
+function,PyUnicode_AsRawUnicodeEscapeString,3.2,
+function,PyUnicode_AsUCS4,3.7,
+function,PyUnicode_AsUCS4Copy,3.7,
+function,PyUnicode_AsUTF16String,3.2,
+function,PyUnicode_AsUTF32String,3.2,
+function,PyUnicode_AsUTF8AndSize,3.10,
+function,PyUnicode_AsUTF8String,3.2,
+function,PyUnicode_AsUnicodeEscapeString,3.2,
+function,PyUnicode_AsWideChar,3.2,
+function,PyUnicode_AsWideCharString,3.7,
+function,PyUnicode_BuildEncodingMap,3.2,
+function,PyUnicode_Compare,3.2,
+function,PyUnicode_CompareWithASCIIString,3.2,
+function,PyUnicode_Concat,3.2,
+function,PyUnicode_Contains,3.2,
+function,PyUnicode_Count,3.2,
+function,PyUnicode_Decode,3.2,
+function,PyUnicode_DecodeASCII,3.2,
+function,PyUnicode_DecodeCharmap,3.2,
+function,PyUnicode_DecodeCodePageStateful,3.7,on Windows
+function,PyUnicode_DecodeFSDefault,3.2,
+function,PyUnicode_DecodeFSDefaultAndSize,3.2,
+function,PyUnicode_DecodeLatin1,3.2,
+function,PyUnicode_DecodeLocale,3.7,
+function,PyUnicode_DecodeLocaleAndSize,3.7,
+function,PyUnicode_DecodeMBCS,3.7,on Windows
+function,PyUnicode_DecodeMBCSStateful,3.7,on Windows
+function,PyUnicode_DecodeRawUnicodeEscape,3.2,
+function,PyUnicode_DecodeUTF16,3.2,
+function,PyUnicode_DecodeUTF16Stateful,3.2,
+function,PyUnicode_DecodeUTF32,3.2,
+function,PyUnicode_DecodeUTF32Stateful,3.2,
+function,PyUnicode_DecodeUTF7,3.2,
+function,PyUnicode_DecodeUTF7Stateful,3.2,
+function,PyUnicode_DecodeUTF8,3.2,
+function,PyUnicode_DecodeUTF8Stateful,3.2,
+function,PyUnicode_DecodeUnicodeEscape,3.2,
+function,PyUnicode_EncodeCodePage,3.7,on Windows
+function,PyUnicode_EncodeFSDefault,3.2,
+function,PyUnicode_EncodeLocale,3.7,
+function,PyUnicode_FSConverter,3.2,
+function,PyUnicode_FSDecoder,3.2,
+function,PyUnicode_Find,3.2,
+function,PyUnicode_FindChar,3.7,
+function,PyUnicode_Format,3.2,
+function,PyUnicode_FromEncodedObject,3.2,
+function,PyUnicode_FromFormat,3.2,
+function,PyUnicode_FromFormatV,3.2,
+function,PyUnicode_FromObject,3.2,
+function,PyUnicode_FromOrdinal,3.2,
+function,PyUnicode_FromString,3.2,
+function,PyUnicode_FromStringAndSize,3.2,
+function,PyUnicode_FromWideChar,3.2,
+function,PyUnicode_GetDefaultEncoding,3.2,
+function,PyUnicode_GetLength,3.7,
+function,PyUnicode_GetSize,3.2,
+function,PyUnicode_InternFromString,3.2,
+function,PyUnicode_InternImmortal,3.2,
+function,PyUnicode_InternInPlace,3.2,
+function,PyUnicode_IsIdentifier,3.2,
+function,PyUnicode_Join,3.2,
+function,PyUnicode_Partition,3.2,
+function,PyUnicode_RPartition,3.2,
+function,PyUnicode_RSplit,3.2,
+function,PyUnicode_ReadChar,3.7,
+function,PyUnicode_Replace,3.2,
+function,PyUnicode_Resize,3.2,
+function,PyUnicode_RichCompare,3.2,
+function,PyUnicode_Split,3.2,
+function,PyUnicode_Splitlines,3.2,
+function,PyUnicode_Substring,3.7,
+function,PyUnicode_Tailmatch,3.2,
+function,PyUnicode_Translate,3.2,
+var,PyUnicode_Type,3.2,
+function,PyUnicode_WriteChar,3.7,
+type,PyVarObject,3.2,
+type,PyWeakReference,3.2,
+function,PyWeakref_GetObject,3.2,
+function,PyWeakref_NewProxy,3.2,
+function,PyWeakref_NewRef,3.2,
+var,PyWrapperDescr_Type,3.2,
+function,PyWrapper_New,3.2,
+var,PyZip_Type,3.2,
+function,Py_AddPendingCall,3.2,
+function,Py_AtExit,3.2,
+macro,Py_BEGIN_ALLOW_THREADS,3.2,
+macro,Py_BLOCK_THREADS,3.2,
+function,Py_BuildValue,3.2,
+function,Py_BytesMain,3.8,
+function,Py_CompileString,3.2,
+function,Py_DecRef,3.2,
+function,Py_DecodeLocale,3.7,
+macro,Py_END_ALLOW_THREADS,3.2,
+function,Py_EncodeLocale,3.7,
+function,Py_EndInterpreter,3.2,
+function,Py_EnterRecursiveCall,3.9,
+function,Py_Exit,3.2,
+function,Py_FatalError,3.2,
+var,Py_FileSystemDefaultEncodeErrors,3.10,
+var,Py_FileSystemDefaultEncoding,3.2,
+function,Py_Finalize,3.2,
+function,Py_FinalizeEx,3.6,
+function,Py_GenericAlias,3.9,
+var,Py_GenericAliasType,3.9,
+function,Py_GetBuildInfo,3.2,
+function,Py_GetCompiler,3.2,
+function,Py_GetCopyright,3.2,
+function,Py_GetExecPrefix,3.2,
+function,Py_GetPath,3.2,
+function,Py_GetPlatform,3.2,
+function,Py_GetPrefix,3.2,
+function,Py_GetProgramFullPath,3.2,
+function,Py_GetProgramName,3.2,
+function,Py_GetPythonHome,3.2,
+function,Py_GetRecursionLimit,3.2,
+function,Py_GetVersion,3.2,
+var,Py_HasFileSystemDefaultEncoding,3.2,
+function,Py_IncRef,3.2,
+function,Py_Initialize,3.2,
+function,Py_InitializeEx,3.2,
+function,Py_Is,3.10,
+function,Py_IsFalse,3.10,
+function,Py_IsInitialized,3.2,
+function,Py_IsNone,3.10,
+function,Py_IsTrue,3.10,
+function,Py_LeaveRecursiveCall,3.9,
+function,Py_Main,3.2,
+function,Py_MakePendingCalls,3.2,
+function,Py_NewInterpreter,3.2,
+function,Py_NewRef,3.10,
+function,Py_ReprEnter,3.2,
+function,Py_ReprLeave,3.2,
+function,Py_SetPath,3.7,
+function,Py_SetProgramName,3.2,
+function,Py_SetPythonHome,3.2,
+function,Py_SetRecursionLimit,3.2,
+type,Py_UCS4,3.2,
+macro,Py_UNBLOCK_THREADS,3.2,
+var,Py_UTF8Mode,3.8,
+function,Py_VaBuildValue,3.2,
+function,Py_XNewRef,3.10,
+type,Py_intptr_t,3.2,
+type,Py_ssize_t,3.2,
+type,Py_uintptr_t,3.2,
+type,allocfunc,3.2,
+type,binaryfunc,3.2,
+type,descrgetfunc,3.2,
+type,descrsetfunc,3.2,
+type,destructor,3.2,
+type,getattrfunc,3.2,
+type,getattrofunc,3.2,
+type,getiterfunc,3.2,
+type,getter,3.2,
+type,hashfunc,3.2,
+type,initproc,3.2,
+type,inquiry,3.2,
+type,iternextfunc,3.2,
+type,lenfunc,3.2,
+type,newfunc,3.2,
+type,objobjargproc,3.2,
+type,objobjproc,3.2,
+type,reprfunc,3.2,
+type,richcmpfunc,3.2,
+type,setattrfunc,3.2,
+type,setattrofunc,3.2,
+type,setter,3.2,
+type,ssizeargfunc,3.2,
+type,ssizeobjargproc,3.2,
+type,ssizessizeargfunc,3.2,
+type,ssizessizeobjargproc,3.2,
+type,symtable,3.2,
+type,ternaryfunc,3.2,
+type,traverseproc,3.2,
+type,unaryfunc,3.2,
+type,visitproc,3.2,
diff --git a/Doc/distributing/index.rst b/Doc/distributing/index.rst
index 0237994..136cf4e 100644
--- a/Doc/distributing/index.rst
+++ b/Doc/distributing/index.rst
@@ -31,7 +31,7 @@
 Key terms
 =========
 
-* the `Python Packaging Index <https://pypi.org>`__ is a public
+* the `Python Package Index <https://pypi.org>`__ is a public
   repository of open source licensed packages made available for use by
   other Python users
 * the `Python Packaging Authority
@@ -101,7 +101,7 @@
 
 .. note::
 
-   For POSIX users (including Mac OS X and Linux users), these instructions
+   For POSIX users (including macOS and Linux users), these instructions
    assume the use of a :term:`virtual environment`.
 
    For Windows users, these instructions assume that the option to
@@ -127,15 +127,15 @@
 
 * `Project structure`_
 * `Building and packaging the project`_
-* `Uploading the project to the Python Packaging Index`_
+* `Uploading the project to the Python Package Index`_
 * `The .pypirc file`_
 
 .. _Project structure: \
-    https://packaging.python.org/tutorials/distributing-packages/
+    https://packaging.python.org/tutorials/packaging-projects/#packaging-python-projects
 .. _Building and packaging the project: \
-   https://packaging.python.org/tutorials/distributing-packages/#packaging-your-project
-.. _Uploading the project to the Python Packaging Index: \
-   https://packaging.python.org/tutorials/distributing-packages/#uploading-your-project-to-pypi
+   https://packaging.python.org/tutorials/packaging-projects/#creating-the-package-files
+.. _Uploading the project to the Python Package Index: \
+   https://packaging.python.org/tutorials/packaging-projects/#uploading-the-distribution-archives
 .. _The .pypirc file: \
    https://packaging.python.org/specifications/pypirc/
 
@@ -150,7 +150,7 @@
 
 This isn't an easy topic, but here are a few tips:
 
-* check the Python Packaging Index to see if the name is already in use
+* check the Python Package Index to see if the name is already in use
 * check popular hosting sites like GitHub, Bitbucket, etc to see if there
   is already a project with that name
 * check what comes up in a web search for the name you're considering
diff --git a/Doc/distutils/apiref.rst b/Doc/distutils/apiref.rst
index b14197c..3291303 100644
--- a/Doc/distutils/apiref.rst
+++ b/Doc/distutils/apiref.rst
@@ -373,7 +373,7 @@
    compiler object under Unix---if you supply a value for *compiler*, *plat* is
    ignored.
 
-   .. % Is the posix/nt only thing still true? Mac OS X seems to work, and
+   .. % Is the posix/nt only thing still true? macOS seems to work, and
    .. % returns a UnixCCompiler instance. How to document this... hmm.
 
 
@@ -1119,11 +1119,11 @@
 
    For non-POSIX platforms, currently just returns ``sys.platform``.
 
-   For Mac OS X systems the OS version reflects the minimal version on which
+   For macOS systems the OS version reflects the minimal version on which
    binaries will run (that is, the value of ``MACOSX_DEPLOYMENT_TARGET``
    during the build of Python), not the OS version of the current system.
 
-   For universal binary builds on Mac OS X the architecture value reflects
+   For universal binary builds on macOS the architecture value reflects
    the universal binary status instead of the architecture of the current
    processor. For 32-bit universal binaries the architecture is ``fat``,
    for 64-bit universal binaries the architecture is ``fat64``, and
@@ -1132,7 +1132,7 @@
    a 3-way universal build (ppc, i386, x86_64) and ``intel`` is used for
    a universal build with the i386 and x86_64 architectures
 
-   Examples of returned values on Mac OS X:
+   Examples of returned values on macOS:
 
    * ``macosx-10.3-ppc``
 
@@ -1452,6 +1452,8 @@
 
 .. module:: distutils.sysconfig
    :synopsis: Low-level access to configuration information of the Python interpreter.
+.. deprecated:: 3.10
+   :mod:`distutils.sysconfig` has been merged into :mod:`sysconfig`.
 .. moduleauthor:: Fred L. Drake, Jr. <fdrake@acm.org>
 .. moduleauthor:: Greg Ward <gward@python.net>
 .. sectionauthor:: Fred L. Drake, Jr. <fdrake@acm.org>
@@ -1510,6 +1512,9 @@
    meaning for other platforms will vary.  The file is a platform-specific text
    file, if it exists. This function is only useful on POSIX platforms.
 
+The following functions are deprecated together with this module and they
+have no direct replacement.
+
 
 .. function:: get_python_inc([plat_specific[, prefix]])
 
@@ -1862,11 +1867,6 @@
 
    .. _Windows Installer: https://msdn.microsoft.com/en-us/library/cc185688(VS.85).aspx
 
-   In most cases, the ``bdist_msi`` installer is a better choice than the
-   ``bdist_wininst`` installer, because it provides better support for
-   Win64 platforms, allows administrators to perform non-interactive
-   installations, and allows installation through group policies.
-
 
 :mod:`distutils.command.bdist_rpm` --- Build a binary distribution as a Redhat RPM and SRPM
 ===========================================================================================
@@ -1878,19 +1878,6 @@
 .. % todo
 
 
-:mod:`distutils.command.bdist_wininst` --- Build a Windows installer
-====================================================================
-
-.. module:: distutils.command.bdist_wininst
-   :synopsis: Build a Windows installer
-
-.. deprecated:: 3.8
-   Use bdist_wheel (wheel packages) instead.
-
-
-.. % todo
-
-
 :mod:`distutils.command.sdist` --- Build a source distribution
 ==============================================================
 
diff --git a/Doc/distutils/builtdist.rst b/Doc/distutils/builtdist.rst
index e032c03..c4409ac 100644
--- a/Doc/distutils/builtdist.rst
+++ b/Doc/distutils/builtdist.rst
@@ -96,9 +96,6 @@
 +-------------+------------------------------+---------+
 | ``sdux``    | HP-UX :program:`swinstall`   |         |
 +-------------+------------------------------+---------+
-| ``wininst`` | self-extracting ZIP file for | \(4)    |
-|             | Windows                      |         |
-+-------------+------------------------------+---------+
 | ``msi``     | Microsoft Installer.         |         |
 +-------------+------------------------------+---------+
 
@@ -141,15 +138,10 @@
 +--------------------------+-------------------------------------+
 | :command:`bdist_rpm`     | rpm, srpm                           |
 +--------------------------+-------------------------------------+
-| :command:`bdist_wininst` | wininst                             |
-+--------------------------+-------------------------------------+
 | :command:`bdist_msi`     | msi                                 |
 +--------------------------+-------------------------------------+
 
 .. note::
-   bdist_wininst is deprecated since Python 3.8.
-
-.. note::
    bdist_msi is deprecated since Python 3.9.
 
 The following sections give details on the individual :command:`bdist_\*`
@@ -190,8 +182,7 @@
 easily specify multiple formats in one run.  If you need to do both, you can
 explicitly specify multiple :command:`bdist_\*` commands and their options::
 
-   python setup.py bdist_rpm --packager="John Doe <jdoe@example.org>" \
-                   bdist_wininst --target-version="2.0"
+   python setup.py bdist_rpm --packager="John Doe <jdoe@example.org>"
 
 Creating RPM packages is driven by a :file:`.spec` file, much as using the
 Distutils is driven by the setup script.  To make your life easier, the
@@ -299,61 +290,6 @@
 .. % to the \file{.spec} file.)
 
 
-.. _creating-wininst:
-
-Creating Windows Installers
-===========================
-
-.. warning::
-   bdist_wininst is deprecated since Python 3.8.
-
-.. warning::
-   bdist_msi is deprecated since Python 3.9.
-
-Executable installers are the natural format for binary distributions on
-Windows.  They display a nice graphical user interface, display some information
-about the module distribution to be installed taken from the metadata in the
-setup script, let the user select a few options, and start or cancel the
-installation.
-
-Since the metadata is taken from the setup script, creating Windows installers
-is usually as easy as running::
-
-   python setup.py bdist_wininst
-
-or the :command:`bdist` command with the :option:`!--formats` option::
-
-   python setup.py bdist --formats=wininst
-
-If you have a pure module distribution (only containing pure Python modules and
-packages), the resulting installer will be version independent and have a name
-like :file:`foo-1.0.win32.exe`. Note that creating ``wininst`` binary
-distributions in only supported on Windows systems.
-
-If you have a non-pure distribution, the extensions can only be created on a
-Windows platform, and will be Python version dependent. The installer filename
-will reflect this and now has the form :file:`foo-1.0.win32-py2.0.exe`.  You
-have to create a separate installer for every Python version you want to
-support.
-
-The installer will try to compile pure modules into :term:`bytecode` after installation
-on the target system in normal and optimizing mode.  If you don't want this to
-happen for some reason, you can run the :command:`bdist_wininst` command with
-the :option:`!--no-target-compile` and/or the :option:`!--no-target-optimize`
-option.
-
-By default the installer will display the cool "Python Powered" logo when it is
-run, but you can also supply your own 152x261 bitmap which must be a Windows
-:file:`.bmp` file with the :option:`!--bitmap` option.
-
-The installer will also display a large title on the desktop background window
-when it is run, which is constructed from the name of your distribution and the
-version number.  This can be changed to another text by using the
-:option:`!--title` option.
-
-The installer file will be written to the "distribution directory" --- normally
-:file:`dist/`, but customizable with the :option:`!--dist-dir` option.
-
 .. _cross-compile-windows:
 
 Cross-compiling on Windows
@@ -370,10 +306,7 @@
 
    python setup.py build --plat-name=win-amd64
 
-to build a 64bit version of your extension.  The Windows Installers also
-support this option, so the command::
-
-   python setup.py build --plat-name=win-amd64 bdist_wininst
+to build a 64bit version of your extension.
 
 would create a 64bit installation executable on your 32bit version of Windows.
 
@@ -462,18 +395,3 @@
    and *iconindex* is the index of the icon in the file *iconpath*.  Again, for
    details consult the Microsoft documentation for the :class:`IShellLink`
    interface.
-
-
-Vista User Access Control (UAC)
-===============================
-
-Starting with Python 2.6, bdist_wininst supports a :option:`!--user-access-control`
-option.  The default is 'none' (meaning no UAC handling is done), and other
-valid values are 'auto' (meaning prompt for UAC elevation if Python was
-installed for all users) and 'force' (meaning always prompt for elevation).
-
-.. note::
-   bdist_wininst is deprecated since Python 3.8.
-
-.. note::
-   bdist_msi is deprecated since Python 3.9.
diff --git a/Doc/distutils/commandref.rst b/Doc/distutils/commandref.rst
index 0f6fe2a..3e247e6 100644
--- a/Doc/distutils/commandref.rst
+++ b/Doc/distutils/commandref.rst
@@ -101,6 +101,5 @@
 .. % \subsection{\protect\command{bdist}}
 .. % \subsection{\protect\command{bdist\_dumb}}
 .. % \subsection{\protect\command{bdist\_rpm}}
-.. % \subsection{\protect\command{bdist\_wininst}}
 
 
diff --git a/Doc/distutils/index.rst b/Doc/distutils/index.rst
index 1f72a25..2ccddc3 100644
--- a/Doc/distutils/index.rst
+++ b/Doc/distutils/index.rst
@@ -12,6 +12,13 @@
    :ref:`distributing-index`
       The up to date module distribution documentations
 
+.. note::
+
+   The entire ``distutils`` package has been deprecated and will be
+   removed in Python 3.12. This documentation is retained as a
+   reference only, and will be removed with the package. See the
+   :ref:`What's New <distutils-deprecated>` entry for more information.
+
 .. include:: ./_setuptools_disclaimer.rst
 
 .. note::
diff --git a/Doc/distutils/introduction.rst b/Doc/distutils/introduction.rst
index 1f8a560..87ed178 100644
--- a/Doc/distutils/introduction.rst
+++ b/Doc/distutils/introduction.rst
@@ -112,17 +112,6 @@
 :command:`install` is more often for installers (although most developers will
 want to install their own code occasionally).
 
-If you want to make things really easy for your users, you can create one or
-more built distributions for them.  For instance, if you are running on a
-Windows machine, and want to make things easy for other Windows users, you can
-create an executable installer (the most appropriate type of built distribution
-for this platform) with the :command:`bdist_wininst` command.  For example::
-
-   python setup.py bdist_wininst
-
-will create an executable installer, :file:`foo-1.0.win32.exe`, in the current
-directory.
-
 Other useful built distribution formats are RPM, implemented by the
 :command:`bdist_rpm` command, Solaris :program:`pkgtool`
 (:command:`bdist_pkgtool`), and HP-UX :program:`swinstall`
diff --git a/Doc/distutils/sourcedist.rst b/Doc/distutils/sourcedist.rst
index 0600663..7b1e22f 100644
--- a/Doc/distutils/sourcedist.rst
+++ b/Doc/distutils/sourcedist.rst
@@ -23,25 +23,25 @@
 
 to create a gzipped tarball and a zip file.  The available formats are:
 
-+-----------+-------------------------+---------+
-| Format    | Description             | Notes   |
-+===========+=========================+=========+
-| ``zip``   | zip file (:file:`.zip`) | (1),(3) |
-+-----------+-------------------------+---------+
-| ``gztar`` | gzip'ed tar file        | \(2)    |
-|           | (:file:`.tar.gz`)       |         |
-+-----------+-------------------------+---------+
-| ``bztar`` | bzip2'ed tar file       |         |
-|           | (:file:`.tar.bz2`)      |         |
-+-----------+-------------------------+---------+
-| ``xztar`` | xz'ed tar file          |         |
-|           | (:file:`.tar.xz`)       |         |
-+-----------+-------------------------+---------+
-| ``ztar``  | compressed tar file     | \(4)    |
-|           | (:file:`.tar.Z`)        |         |
-+-----------+-------------------------+---------+
-| ``tar``   | tar file (:file:`.tar`) |         |
-+-----------+-------------------------+---------+
++-----------+-------------------------+-------------+
+| Format    | Description             | Notes       |
++===========+=========================+=============+
+| ``zip``   | zip file (:file:`.zip`) | (1),(3)     |
++-----------+-------------------------+-------------+
+| ``gztar`` | gzip'ed tar file        | \(2)        |
+|           | (:file:`.tar.gz`)       |             |
++-----------+-------------------------+-------------+
+| ``bztar`` | bzip2'ed tar file       | \(5)        |
+|           | (:file:`.tar.bz2`)      |             |
++-----------+-------------------------+-------------+
+| ``xztar`` | xz'ed tar file          | \(5)        |
+|           | (:file:`.tar.xz`)       |             |
++-----------+-------------------------+-------------+
+| ``ztar``  | compressed tar file     | (4),(5)     |
+|           | (:file:`.tar.Z`)        |             |
++-----------+-------------------------+-------------+
+| ``tar``   | tar file (:file:`.tar`) | \(5)        |
++-----------+-------------------------+-------------+
 
 .. versionchanged:: 3.5
    Added support for the ``xztar`` format.
@@ -61,6 +61,9 @@
 (4)
    requires the :program:`compress` program. Notice that this format is now
    pending for deprecation and will be removed in the future versions of Python.
+(5)
+  deprecated by `PEP 527 <https://www.python.org/dev/peps/pep-0527/>`_;
+  `PyPI <https://pypi.org>`_ only accepts ``.zip`` and ``.tar.gz`` files.
 
 When using any ``tar`` format (``gztar``, ``bztar``, ``xztar``, ``ztar`` or
 ``tar``), under Unix you can specify the ``owner`` and ``group`` names
diff --git a/Doc/extending/building.rst b/Doc/extending/building.rst
index 753b551..69dffbd 100644
--- a/Doc/extending/building.rst
+++ b/Doc/extending/building.rst
@@ -162,6 +162,5 @@
 create binary distributions. Depending on the platform, one of the following
 commands can be used to do so. ::
 
-   python setup.py bdist_wininst
    python setup.py bdist_rpm
    python setup.py bdist_dumb
diff --git a/Doc/extending/extending.rst b/Doc/extending/extending.rst
index 25dc293..2e3362b 100644
--- a/Doc/extending/extending.rst
+++ b/Doc/extending/extending.rst
@@ -127,13 +127,11 @@
 
 An important convention throughout the Python interpreter is the following: when
 a function fails, it should set an exception condition and return an error value
-(usually a ``NULL`` pointer).  Exceptions are stored in a static global variable
-inside the interpreter; if this variable is ``NULL`` no exception has occurred.  A
-second global variable stores the "associated value" of the exception (the
-second argument to :keyword:`raise`).  A third variable contains the stack
-traceback in case the error originated in Python code.  These three variables
-are the C equivalents of the result in Python of :meth:`sys.exc_info` (see the
-section on module :mod:`sys` in the Python Library Reference).  It is important
+(usually ``-1`` or a ``NULL`` pointer).  Exception information is stored in
+three members of the interpreter's thread state.  These are ``NULL`` if
+there is no exception.  Otherwise they are the C equivalents of the members
+of the Python tuple returned by :meth:`sys.exc_info`.  These are the
+exception type, exception instance, and a traceback object.  It is important
 to know about them to understand how errors are passed around.
 
 The Python API defines a number of functions to set various types of exceptions.
@@ -410,7 +408,7 @@
        /* Optionally import the module; alternatively,
           import can be deferred until the embedded script
           imports it. */
-       pmodule = PyImport_ImportModule("spam");
+       PyObject *pmodule = PyImport_ImportModule("spam");
        if (!pmodule) {
            PyErr_Print();
            fprintf(stderr, "Error: could not import module 'spam'\n");
@@ -911,12 +909,7 @@
 The cycle detector is able to detect garbage cycles and can reclaim them.
 The :mod:`gc` module exposes a way to run the detector (the
 :func:`~gc.collect` function), as well as configuration
-interfaces and the ability to disable the detector at runtime.  The cycle
-detector is considered an optional component; though it is included by default,
-it can be disabled at build time using the :option:`!--without-cycle-gc` option
-to the :program:`configure` script on Unix platforms (including Mac OS X).  If
-the cycle detector is disabled in this way, the :mod:`gc` module will not be
-available.
+interfaces and the ability to disable the detector at runtime.
 
 
 .. _refcountsinpython:
diff --git a/Doc/extending/newtypes.rst b/Doc/extending/newtypes.rst
index d902370..f75bee9 100644
--- a/Doc/extending/newtypes.rst
+++ b/Doc/extending/newtypes.rst
@@ -12,7 +12,7 @@
 implement and what they do.
 
 Here is the definition of :c:type:`PyTypeObject`, with some fields only used in
-debug builds omitted:
+:ref:`debug builds <debug-build>` omitted:
 
 .. literalinclude:: ../includes/typestruct.h
 
@@ -73,7 +73,19 @@
    newdatatype_dealloc(newdatatypeobject *obj)
    {
        free(obj->obj_UnderlyingDatatypePtr);
-       Py_TYPE(obj)->tp_free(obj);
+       Py_TYPE(obj)->tp_free((PyObject *)obj);
+   }
+
+If your type supports garbage collection, the destructor should call
+:c:func:`PyObject_GC_UnTrack` before clearing any member fields::
+
+   static void
+   newdatatype_dealloc(newdatatypeobject *obj)
+   {
+       PyObject_GC_UnTrack(obj);
+       Py_CLEAR(obj->other_obj);
+       ...
+       Py_TYPE(obj)->tp_free((PyObject *)obj);
    }
 
 .. index::
@@ -287,18 +299,23 @@
 +===========================+==============================================+
 | :const:`READONLY`         | Never writable.                              |
 +---------------------------+----------------------------------------------+
-| :const:`READ_RESTRICTED`  | Not readable in restricted mode.             |
+| :const:`PY_AUDIT_READ`    | Emit an ``object.__getattr__``               |
+|                           | :ref:`audit events <audit-events>` before    |
+|                           | reading.                                     |
 +---------------------------+----------------------------------------------+
-| :const:`WRITE_RESTRICTED` | Not writable in restricted mode.             |
-+---------------------------+----------------------------------------------+
-| :const:`RESTRICTED`       | Not readable or writable in restricted mode. |
-+---------------------------+----------------------------------------------+
+
+.. versionchanged:: 3.10
+   :const:`RESTRICTED`, :const:`READ_RESTRICTED` and :const:`WRITE_RESTRICTED`
+   are deprecated. However, :const:`READ_RESTRICTED` is an alias for
+   :const:`PY_AUDIT_READ`, so fields that specify either :const:`RESTRICTED`
+   or :const:`READ_RESTRICTED` will also raise an audit event.
 
 .. index::
    single: READONLY
    single: READ_RESTRICTED
    single: WRITE_RESTRICTED
    single: RESTRICTED
+   single: PY_AUDIT_READ
 
 An interesting advantage of using the :c:member:`~PyTypeObject.tp_members` table to build
 descriptors that are used at runtime is that any attribute defined this way can
@@ -376,7 +393,7 @@
 :c:func:`PyObject_RichCompareBool`.
 
 This function is called with two Python objects and the operator as arguments,
-where the operator is one of ``Py_EQ``, ``Py_NE``, ``Py_LE``, ``Py_GT``,
+where the operator is one of ``Py_EQ``, ``Py_NE``, ``Py_LE``, ``Py_GE``,
 ``Py_LT`` or ``Py_GT``.  It should compare the two objects with respect to the
 specified operator and return ``Py_True`` or ``Py_False`` if the comparison is
 successful, ``Py_NotImplemented`` to indicate that comparison is not
diff --git a/Doc/extending/newtypes_tutorial.rst b/Doc/extending/newtypes_tutorial.rst
index 4da77e7..530e2c4 100644
--- a/Doc/extending/newtypes_tutorial.rst
+++ b/Doc/extending/newtypes_tutorial.rst
@@ -69,7 +69,8 @@
 of type :c:type:`PyObject`, containing a pointer to a type object and a
 reference count (these can be accessed using the macros :c:macro:`Py_REFCNT`
 and :c:macro:`Py_TYPE` respectively).  The reason for the macro is to
-abstract away the layout and to enable additional fields in debug builds.
+abstract away the layout and to enable additional fields in :ref:`debug builds
+<debug-build>`.
 
 .. note::
    There is no semicolon above after the :c:macro:`PyObject_HEAD` macro.
diff --git a/Doc/faq/design.rst b/Doc/faq/design.rst
index 8cf271c..ff83a1b 100644
--- a/Doc/faq/design.rst
+++ b/Doc/faq/design.rst
@@ -259,20 +259,16 @@
 -----------------------------------------------------
 
 You can do this easily enough with a sequence of ``if... elif... elif... else``.
-There have been some proposals for switch statement syntax, but there is no
-consensus (yet) on whether and how to do range tests.  See :pep:`275` for
-complete details and the current status.
+For literal values, or constants within a namespace, you can also use a
+``match ... case`` statement.
 
 For cases where you need to choose from a very large number of possibilities,
 you can create a dictionary mapping case values to functions to call.  For
 example::
 
-   def function_1(...):
-       ...
-
    functions = {'a': function_1,
                 'b': function_2,
-                'c': self.method_1, ...}
+                'c': self.method_1}
 
    func = functions[value]
    func()
@@ -280,14 +276,14 @@
 For calling methods on objects, you can simplify yet further by using the
 :func:`getattr` built-in to retrieve methods with a particular name::
 
-   def visit_a(self, ...):
-       ...
-   ...
+   class MyVisitor:
+       def visit_a(self):
+           ...
 
-   def dispatch(self, value):
-       method_name = 'visit_' + str(value)
-       method = getattr(self, method_name)
-       method()
+       def dispatch(self, value):
+           method_name = 'visit_' + str(value)
+           method = getattr(self, method_name)
+           method()
 
 It's suggested that you use a prefix for the method names, such as ``visit_`` in
 this example.  Without such a prefix, if values are coming from an untrusted
@@ -601,7 +597,15 @@
 Why is there no goto?
 ---------------------
 
-You can use exceptions to provide a "structured goto" that even works across
+In the 1970s people realized that unrestricted goto could lead
+to messy "spaghetti" code that was hard to understand and revise.
+In a high-level language, it is also unneeded as long as there
+are ways to branch (in Python, with ``if`` statements and ``or``,
+``and``, and ``if-else`` expressions) and loop (with ``while``
+and ``for`` statements, possibly containing ``continue`` and ``break``).
+
+One can also use exceptions to provide a "structured goto"
+that works even across
 function calls.  Many feel that exceptions can conveniently emulate all
 reasonable uses of the "go" or "goto" constructs of C, Fortran, and other
 languages.  For example::
@@ -701,6 +705,15 @@
 to perform the resolution once.
 
 
+Why don't generators support the with statement?
+------------------------------------------------
+
+For technical reasons, a generator used directly as a context manager
+would not work correctly.  When, as is most common, a generator is used as
+an iterator run to completion, no closing is needed.  When it is, wrap
+it as "contextlib.closing(generator)" in the 'with' statement.
+
+
 Why are colons required for the if/while/def/class statements?
 --------------------------------------------------------------
 
diff --git a/Doc/faq/extending.rst b/Doc/faq/extending.rst
index aecb56e..1d2aca6 100644
--- a/Doc/faq/extending.rst
+++ b/Doc/faq/extending.rst
@@ -254,7 +254,6 @@
 
 For Debian, run ``apt-get install python-dev``.
 
-
 How do I tell "incomplete input" from "invalid input"?
 ------------------------------------------------------
 
@@ -273,161 +272,6 @@
 custom input function. See ``Modules/readline.c`` and ``Parser/myreadline.c``
 for more hints.
 
-However sometimes you have to run the embedded Python interpreter in the same
-thread as your rest application and you can't allow the
-:c:func:`PyRun_InteractiveLoop` to stop while waiting for user input.  The one
-solution then is to call :c:func:`PyParser_ParseString` and test for ``e.error``
-equal to ``E_EOF``, which means the input is incomplete.  Here's a sample code
-fragment, untested, inspired by code from Alex Farber::
-
-   #define PY_SSIZE_T_CLEAN
-   #include <Python.h>
-   #include <node.h>
-   #include <errcode.h>
-   #include <grammar.h>
-   #include <parsetok.h>
-   #include <compile.h>
-
-   int testcomplete(char *code)
-     /* code should end in \n */
-     /* return -1 for error, 0 for incomplete, 1 for complete */
-   {
-     node *n;
-     perrdetail e;
-
-     n = PyParser_ParseString(code, &_PyParser_Grammar,
-                              Py_file_input, &e);
-     if (n == NULL) {
-       if (e.error == E_EOF)
-         return 0;
-       return -1;
-     }
-
-     PyNode_Free(n);
-     return 1;
-   }
-
-Another solution is trying to compile the received string with
-:c:func:`Py_CompileString`. If it compiles without errors, try to execute the
-returned code object by calling :c:func:`PyEval_EvalCode`. Otherwise save the
-input for later. If the compilation fails, find out if it's an error or just
-more input is required - by extracting the message string from the exception
-tuple and comparing it to the string "unexpected EOF while parsing".  Here is a
-complete example using the GNU readline library (you may want to ignore
-**SIGINT** while calling readline())::
-
-   #include <stdio.h>
-   #include <readline.h>
-
-   #define PY_SSIZE_T_CLEAN
-   #include <Python.h>
-   #include <object.h>
-   #include <compile.h>
-   #include <eval.h>
-
-   int main (int argc, char* argv[])
-   {
-     int i, j, done = 0;                          /* lengths of line, code */
-     char ps1[] = ">>> ";
-     char ps2[] = "... ";
-     char *prompt = ps1;
-     char *msg, *line, *code = NULL;
-     PyObject *src, *glb, *loc;
-     PyObject *exc, *val, *trb, *obj, *dum;
-
-     Py_Initialize ();
-     loc = PyDict_New ();
-     glb = PyDict_New ();
-     PyDict_SetItemString (glb, "__builtins__", PyEval_GetBuiltins ());
-
-     while (!done)
-     {
-       line = readline (prompt);
-
-       if (NULL == line)                          /* Ctrl-D pressed */
-       {
-         done = 1;
-       }
-       else
-       {
-         i = strlen (line);
-
-         if (i > 0)
-           add_history (line);                    /* save non-empty lines */
-
-         if (NULL == code)                        /* nothing in code yet */
-           j = 0;
-         else
-           j = strlen (code);
-
-         code = realloc (code, i + j + 2);
-         if (NULL == code)                        /* out of memory */
-           exit (1);
-
-         if (0 == j)                              /* code was empty, so */
-           code[0] = '\0';                        /* keep strncat happy */
-
-         strncat (code, line, i);                 /* append line to code */
-         code[i + j] = '\n';                      /* append '\n' to code */
-         code[i + j + 1] = '\0';
-
-         src = Py_CompileString (code, "<stdin>", Py_single_input);
-
-         if (NULL != src)                         /* compiled just fine - */
-         {
-           if (ps1  == prompt ||                  /* ">>> " or */
-               '\n' == code[i + j - 1])           /* "... " and double '\n' */
-           {                                               /* so execute it */
-             dum = PyEval_EvalCode (src, glb, loc);
-             Py_XDECREF (dum);
-             Py_XDECREF (src);
-             free (code);
-             code = NULL;
-             if (PyErr_Occurred ())
-               PyErr_Print ();
-             prompt = ps1;
-           }
-         }                                        /* syntax error or E_EOF? */
-         else if (PyErr_ExceptionMatches (PyExc_SyntaxError))
-         {
-           PyErr_Fetch (&exc, &val, &trb);        /* clears exception! */
-
-           if (PyArg_ParseTuple (val, "sO", &msg, &obj) &&
-               !strcmp (msg, "unexpected EOF while parsing")) /* E_EOF */
-           {
-             Py_XDECREF (exc);
-             Py_XDECREF (val);
-             Py_XDECREF (trb);
-             prompt = ps2;
-           }
-           else                                   /* some other syntax error */
-           {
-             PyErr_Restore (exc, val, trb);
-             PyErr_Print ();
-             free (code);
-             code = NULL;
-             prompt = ps1;
-           }
-         }
-         else                                     /* some non-syntax error */
-         {
-           PyErr_Print ();
-           free (code);
-           code = NULL;
-           prompt = ps1;
-         }
-
-         free (line);
-       }
-     }
-
-     Py_XDECREF(glb);
-     Py_XDECREF(loc);
-     Py_Finalize();
-     exit(0);
-   }
-
-
 How do I find undefined g++ symbols __builtin_new or __pure_virtual?
 --------------------------------------------------------------------
 
diff --git a/Doc/faq/general.rst b/Doc/faq/general.rst
index cf70f16..7723114 100644
--- a/Doc/faq/general.rst
+++ b/Doc/faq/general.rst
@@ -113,7 +113,7 @@
 
 The language comes with a large standard library that covers areas such as
 string processing (regular expressions, Unicode, calculating differences between
-files), Internet protocols (HTTP, FTP, SMTP, XML-RPC, POP, IMAP, CGI
+files), internet protocols (HTTP, FTP, SMTP, XML-RPC, POP, IMAP, CGI
 programming), software engineering (unit testing, logging, profiling, parsing
 Python code), and operating system interfaces (system calls, filesystems, TCP/IP
 sockets).  Look at the table of contents for :ref:`library-index` to get an idea
diff --git a/Doc/faq/gui.rst b/Doc/faq/gui.rst
index 781da46..86c56d9 100644
--- a/Doc/faq/gui.rst
+++ b/Doc/faq/gui.rst
@@ -14,17 +14,8 @@
 General GUI Questions
 =====================
 
-What platform-independent GUI toolkits exist for Python?
-========================================================
-
-Depending on what platform(s) you are aiming at, there are several.  Some
-of them haven't been ported to Python 3 yet.  At least `Tkinter`_ and `Qt`_
-are known to be Python 3-compatible.
-
-.. XXX check links
-
-Tkinter
--------
+What GUI toolkits exist for Python?
+===================================
 
 Standard builds of Python include an object-oriented interface to the Tcl/Tk
 widget set, called :ref:`tkinter <Tkinter>`.  This is probably the easiest to
@@ -32,85 +23,14 @@
 `binary distributions <https://www.python.org/downloads/>`_ of Python) and use.
 For more info about Tk, including pointers to the source, see the
 `Tcl/Tk home page <https://www.tcl.tk>`_.  Tcl/Tk is fully portable to the
-Mac OS X, Windows, and Unix platforms.
+macOS, Windows, and Unix platforms.
 
-wxWidgets
----------
-
-wxWidgets (https://www.wxwidgets.org) is a free, portable GUI class
-library written in C++ that provides a native look and feel on a
-number of platforms, with Windows, Mac OS X, GTK, X11, all listed as
-current stable targets.  Language bindings are available for a number
-of languages including Python, Perl, Ruby, etc.
-
-`wxPython <https://www.wxpython.org>`_ is the Python binding for
-wxwidgets.  While it often lags slightly behind the official wxWidgets
-releases, it also offers a number of features via pure Python
-extensions that are not available in other language bindings.  There
-is an active wxPython user and developer community.
-
-Both wxWidgets and wxPython are free, open source, software with
-permissive licences that allow their use in commercial products as
-well as in freeware or shareware.
-
-
-Qt
----
-
-There are bindings available for the Qt toolkit (using either `PyQt
-<https://riverbankcomputing.com/software/pyqt/intro>`_ or `PySide
-<https://wiki.qt.io/PySide>`_) and for KDE (`PyKDE4 <https://techbase.kde.org/Languages/Python/Using_PyKDE_4>`__).
-PyQt is currently more mature than PySide, but you must buy a PyQt license from
-`Riverbank Computing <https://www.riverbankcomputing.com/commercial/license-faq>`_
-if you want to write proprietary applications.  PySide is free for all applications.
-
-Qt 4.5 upwards is licensed under the LGPL license; also, commercial licenses
-are available from `The Qt Company <https://www.qt.io/licensing/>`_.
-
-Gtk+
-----
-
-The `GObject introspection bindings <https://wiki.gnome.org/Projects/PyGObject>`_
-for Python allow you to write GTK+ 3 applications.  There is also a
-`Python GTK+ 3 Tutorial <https://python-gtk-3-tutorial.readthedocs.io>`_.
-
-The older PyGtk bindings for the `Gtk+ 2 toolkit <https://www.gtk.org>`_ have
-been implemented by James Henstridge; see <http://www.pygtk.org>.
-
-Kivy
-----
-
-`Kivy <https://kivy.org/>`_ is a cross-platform GUI library supporting both
-desktop operating systems (Windows, macOS, Linux) and mobile devices (Android,
-iOS).  It is written in Python and Cython, and can use a range of windowing
-backends.
-
-Kivy is free and open source software distributed under the MIT license.
-
-FLTK
-----
-
-Python bindings for `the FLTK toolkit <http://www.fltk.org>`_, a simple yet
-powerful and mature cross-platform windowing system, are available from `the
-PyFLTK project <http://pyfltk.sourceforge.net>`_.
-
-OpenGL
-------
-
-For OpenGL bindings, see `PyOpenGL <http://pyopengl.sourceforge.net>`_.
-
-
-What platform-specific GUI toolkits exist for Python?
-========================================================
-
-By installing the `PyObjc Objective-C bridge
-<https://pypi.org/project/pyobjc/>`_, Python programs can use Mac OS X's
-Cocoa libraries.
-
-:ref:`Pythonwin <windows-faq>` by Mark Hammond includes an interface to the
-Microsoft Foundation Classes and a Python programming environment
-that's written mostly in Python using the MFC classes.
-
+Depending on what platform(s) you are aiming at, there are also several
+alternatives. A `list of cross-platform
+<https://wiki.python.org/moin/GuiProgramming#Cross-Platform_Frameworks>`_ and
+`platform-specific
+<https://wiki.python.org/moin/GuiProgramming#Platform-specific_Frameworks>`_ GUI
+frameworks can be found on the python wiki.
 
 Tkinter questions
 =================
diff --git a/Doc/faq/installed.rst b/Doc/faq/installed.rst
index 4229653..16c9a74 100644
--- a/Doc/faq/installed.rst
+++ b/Doc/faq/installed.rst
@@ -29,7 +29,7 @@
 * Some Windows machines also have Python installed.  At this writing we're aware
   of computers from Hewlett-Packard and Compaq that include Python.  Apparently
   some of HP/Compaq's administrative tools are written in Python.
-* Many Unix-compatible operating systems, such as Mac OS X and some Linux
+* Many Unix-compatible operating systems, such as macOS and some Linux
   distributions, have Python installed by default; it's included in the base
   installation.
 
diff --git a/Doc/faq/library.rst b/Doc/faq/library.rst
index 97058b5..faca834 100644
--- a/Doc/faq/library.rst
+++ b/Doc/faq/library.rst
@@ -20,7 +20,7 @@
 
 For third-party packages, search the `Python Package Index
 <https://pypi.org>`_ or try `Google <https://www.google.com>`_ or
-another Web search engine.  Searching for "Python" plus a keyword or two for
+another web search engine.  Searching for "Python" plus a keyword or two for
 your topic of interest will usually find something helpful.
 
 
@@ -243,9 +243,6 @@
 The :mod:`threading` module builds convenient abstractions on top of the
 low-level primitives provided by the :mod:`_thread` module.
 
-Aahz has a set of slides from his threading tutorial that are helpful; see
-http://www.pythoncraft.com/OSCON2001/.
-
 
 None of my threads seem to run: why?
 ------------------------------------
@@ -319,11 +316,11 @@
            try:
                arg = q.get(block=False)
            except queue.Empty:
-               print('Worker', threading.currentThread(), end=' ')
+               print('Worker', threading.current_thread(), end=' ')
                print('queue empty')
                break
            else:
-               print('Worker', threading.currentThread(), end=' ')
+               print('Worker', threading.current_thread(), end=' ')
                print('running with argument', arg)
                time.sleep(0.5)
 
@@ -617,9 +614,9 @@
 How do I access the serial (RS232) port?
 ----------------------------------------
 
-For Win32, POSIX (Linux, BSD, etc.), Jython:
+For Win32, OSX, Linux, BSD, Jython, IronPython:
 
-   http://pyserial.sourceforge.net
+   https://pypi.org/project/pyserial/
 
 For Unix, see a Usenet post by Mitch Chapman:
 
diff --git a/Doc/faq/programming.rst b/Doc/faq/programming.rst
index 8df62c5..a1adf85 100644
--- a/Doc/faq/programming.rst
+++ b/Doc/faq/programming.rst
@@ -29,26 +29,26 @@
 graphical debugger.
 
 PythonWin is a Python IDE that includes a GUI debugger based on pdb.  The
-Pythonwin debugger colors breakpoints and has quite a few cool features such as
-debugging non-Pythonwin programs.  Pythonwin is available as part of the `Python
-for Windows Extensions <https://sourceforge.net/projects/pywin32/>`__ project and
-as a part of the ActivePython distribution (see
-https://www.activestate.com/activepython\ ).
+PythonWin debugger colors breakpoints and has quite a few cool features such as
+debugging non-PythonWin programs.  PythonWin is available as part of
+`pywin32 <https://github.com/mhammond/pywin32>`_ project and
+as a part of the
+`ActivePython <https://www.activestate.com/products/python/>`_ distribution.
 
 `Eric <http://eric-ide.python-projects.org/>`_ is an IDE built on PyQt
 and the Scintilla editing component.
 
-Pydb is a version of the standard Python debugger pdb, modified for use with DDD
-(Data Display Debugger), a popular graphical debugger front end.  Pydb can be
-found at http://bashdb.sourceforge.net/pydb/ and DDD can be found at
-https://www.gnu.org/software/ddd.
+`trepan3k <https://github.com/rocky/python3-trepan/>`_ is a gdb-like debugger.
+
+`Visual Studio Code <https://code.visualstudio.com/>`_ is an IDE with debugging
+tools that integrates with version-control software.
 
 There are a number of commercial Python IDEs that include graphical debuggers.
 They include:
 
-* Wing IDE (https://wingware.com/)
-* Komodo IDE (https://komodoide.com/)
-* PyCharm (https://www.jetbrains.com/pycharm/)
+* `Wing IDE <https://wingware.com/>`_
+* `Komodo IDE <https://www.activestate.com/products/komodo-ide/>`_
+* `PyCharm <https://www.jetbrains.com/pycharm/>`_
 
 
 Are there tools to help find bugs or perform static analysis?
@@ -66,6 +66,8 @@
 source code.
 
 
+.. _faq-create-standalone-binary:
+
 How can I create a stand-alone binary from a Python script?
 -----------------------------------------------------------
 
@@ -89,13 +91,15 @@
 then compiles the generated C code and links it with the rest of the Python
 interpreter to form a self-contained binary which acts exactly like your script.
 
-Obviously, freeze requires a C compiler.  There are several other utilities
-which don't. One is Thomas Heller's py2exe (Windows only) at
+The following packages can help with the creation of console and GUI
+executables:
 
-    http://www.py2exe.org/
-
-Another tool is Anthony Tuininga's `cx_Freeze <https://anthony-tuininga.github.io/cx_Freeze/>`_.
-
+* `Nuitka <https://nuitka.net/>`_ (Cross-platform)
+* `PyInstaller <http://www.pyinstaller.org/>`_ (Cross-platform)
+* `PyOxidizer <https://pyoxidizer.readthedocs.io/en/stable/>`_ (Cross-platform)
+* `cx_Freeze <https://marcelotduarte.github.io/cx_Freeze/>`_ (Cross-platform)
+* `py2app <https://github.com/ronaldoussoren/py2app>`_ (macOS only)
+* `py2exe <http://www.py2exe.org/>`_ (Windows only)
 
 Are there coding standards or a style guide for Python programs?
 ----------------------------------------------------------------
@@ -832,6 +836,27 @@
 bite.
 
 
+How do I get int literal attribute instead of SyntaxError?
+----------------------------------------------------------
+
+Trying to lookup an ``int`` literal attribute in the normal manner gives
+a syntax error because the period is seen as a decimal point::
+
+   >>> 1.__class__
+     File "<stdin>", line 1
+     1.__class__
+      ^
+   SyntaxError: invalid decimal literal
+
+The solution is to separate the literal from the period
+with either a space or parentheses.
+
+   >>> 1 .__class__
+   <class 'int'>
+   >>> (1).__class__
+   <class 'int'>
+
+
 How do I convert a string to a number?
 --------------------------------------
 
@@ -1180,7 +1205,7 @@
 
 The ``array`` module also provides methods for creating arrays of fixed types
 with compact representations, but they are slower to index than lists.  Also
-note that the Numeric extensions and others define array-like structures with
+note that NumPy and other third party packages define array-like structures with
 various characteristics as well.
 
 To get Lisp-style linked lists, you can emulate cons cells using tuples::
@@ -1420,6 +1445,41 @@
 check whether an object is one of Python's built-in types, e.g.
 ``isinstance(obj, str)`` or ``isinstance(obj, (int, float, complex))``.
 
+Note that :func:`isinstance` also checks for virtual inheritance from an
+:term:`abstract base class`.  So, the test will return ``True`` for a
+registered class even if hasn't directly or indirectly inherited from it.  To
+test for "true inheritance", scan the :term:`MRO` of the class:
+
+.. testcode::
+
+    from collections.abc import Mapping
+
+    class P:
+         pass
+
+    class C(P):
+        pass
+
+    Mapping.register(P)
+
+.. doctest::
+
+    >>> c = C()
+    >>> isinstance(c, C)        # direct
+    True
+    >>> isinstance(c, P)        # indirect
+    True
+    >>> isinstance(c, Mapping)  # virtual
+    True
+
+    # Actual inheritance chain
+    >>> type(c).__mro__
+    (<class 'C'>, <class 'P'>, <class 'object'>)
+
+    # Test for "true inheritance"
+    >>> Mapping in type(c).__mro__
+    False
+
 Note that most programs do not use :func:`isinstance` on user-defined classes
 very often.  If you are developing the classes yourself, a more proper
 object-oriented style is to define methods on the classes that encapsulate a
@@ -1494,20 +1554,19 @@
 local state for self without causing an infinite recursion.
 
 
-How do I call a method defined in a base class from a derived class that overrides it?
---------------------------------------------------------------------------------------
+How do I call a method defined in a base class from a derived class that extends it?
+------------------------------------------------------------------------------------
 
 Use the built-in :func:`super` function::
 
    class Derived(Base):
        def meth(self):
-           super(Derived, self).meth()
+           super().meth()  # calls Base.meth
 
-For version prior to 3.0, you may be using classic classes: For a class
-definition such as ``class Derived(Base): ...`` you can call method ``meth()``
-defined in ``Base`` (or one of ``Base``'s base classes) as ``Base.meth(self,
-arguments...)``.  Here, ``Base.meth`` is an unbound method, so you need to
-provide the ``self`` argument.
+In the example, :func:`super` will automatically determine the instance from
+which it was called (the ``self`` value), look up the :term:`method resolution
+order` (MRO) with ``type(self).__mro__``, and return the next in line after
+``Derived`` in the MRO: ``Base``.
 
 
 How can I organize my code to make it easier to change the base class?
@@ -1702,6 +1761,221 @@
 13891296
 
 
+When can I rely on identity tests with the *is* operator?
+---------------------------------------------------------
+
+The ``is`` operator tests for object identity.  The test ``a is b`` is
+equivalent to ``id(a) == id(b)``.
+
+The most important property of an identity test is that an object is always
+identical to itself, ``a is a`` always returns ``True``.  Identity tests are
+usually faster than equality tests.  And unlike equality tests, identity tests
+are guaranteed to return a boolean ``True`` or ``False``.
+
+However, identity tests can *only* be substituted for equality tests when
+object identity is assured.  Generally, there are three circumstances where
+identity is guaranteed:
+
+1) Assignments create new names but do not change object identity.  After the
+assignment ``new = old``, it is guaranteed that ``new is old``.
+
+2) Putting an object in a container that stores object references does not
+change object identity.  After the list assignment ``s[0] = x``, it is
+guaranteed that ``s[0] is x``.
+
+3) If an object is a singleton, it means that only one instance of that object
+can exist.  After the assignments ``a = None`` and ``b = None``, it is
+guaranteed that ``a is b`` because ``None`` is a singleton.
+
+In most other circumstances, identity tests are inadvisable and equality tests
+are preferred.  In particular, identity tests should not be used to check
+constants such as :class:`int` and :class:`str` which aren't guaranteed to be
+singletons::
+
+    >>> a = 1000
+    >>> b = 500
+    >>> c = b + 500
+    >>> a is c
+    False
+
+    >>> a = 'Python'
+    >>> b = 'Py'
+    >>> c = b + 'thon'
+    >>> a is c
+    False
+
+Likewise, new instances of mutable containers are never identical::
+
+    >>> a = []
+    >>> b = []
+    >>> a is b
+    False
+
+In the standard library code, you will see several common patterns for
+correctly using identity tests:
+
+1) As recommended by :pep:`8`, an identity test is the preferred way to check
+for ``None``.  This reads like plain English in code and avoids confusion with
+other objects that may have boolean values that evaluate to false.
+
+2) Detecting optional arguments can be tricky when ``None`` is a valid input
+value.  In those situations, you can create a singleton sentinel object
+guaranteed to be distinct from other objects.  For example, here is how
+to implement a method that behaves like :meth:`dict.pop`::
+
+   _sentinel = object()
+
+   def pop(self, key, default=_sentinel):
+       if key in self:
+           value = self[key]
+           del self[key]
+           return value
+       if default is _sentinel:
+           raise KeyError(key)
+       return default
+
+3) Container implementations sometimes need to augment equality tests with
+identity tests.  This prevents the code from being confused by objects such as
+``float('NaN')`` that are not equal to themselves.
+
+For example, here is the implementation of
+:meth:`collections.abc.Sequence.__contains__`::
+
+    def __contains__(self, value):
+        for v in self:
+            if v is value or v == value:
+                return True
+        return False
+
+
+How can a subclass control what data is stored in an immutable instance?
+------------------------------------------------------------------------
+
+When subclassing an immutable type, override the :meth:`__new__` method
+instead of the :meth:`__init__` method.  The latter only runs *after* an
+instance is created, which is too late to alter data in an immutable
+instance.
+
+All of these immutable classes have a different signature than their
+parent class:
+
+.. testcode::
+
+    from datetime import date
+
+    class FirstOfMonthDate(date):
+        "Always choose the first day of the month"
+        def __new__(cls, year, month, day):
+            return super().__new__(cls, year, month, 1)
+
+    class NamedInt(int):
+        "Allow text names for some numbers"
+        xlat = {'zero': 0, 'one': 1, 'ten': 10}
+        def __new__(cls, value):
+            value = cls.xlat.get(value, value)
+            return super().__new__(cls, value)
+
+    class TitleStr(str):
+        "Convert str to name suitable for a URL path"
+        def __new__(cls, s):
+            s = s.lower().replace(' ', '-')
+            s = ''.join([c for c in s if c.isalnum() or c == '-'])
+            return super().__new__(cls, s)
+
+The classes can be used like this:
+
+.. doctest::
+
+    >>> FirstOfMonthDate(2012, 2, 14)
+    FirstOfMonthDate(2012, 2, 1)
+    >>> NamedInt('ten')
+    10
+    >>> NamedInt(20)
+    20
+    >>> TitleStr('Blog: Why Python Rocks')
+    'blog-why-python-rocks'
+
+
+How do I cache method calls?
+----------------------------
+
+The two principal tools for caching methods are
+:func:`functools.cached_property` and :func:`functools.lru_cache`.  The
+former stores results at the instance level and the latter at the class
+level.
+
+The *cached_property* approach only works with methods that do not take
+any arguments.  It does not create a reference to the instance.  The
+cached method result will be kept only as long as the instance is alive.
+
+The advantage is that when an instance is no longer used, the cached
+method result will be released right away.  The disadvantage is that if
+instances accumulate, so too will the accumulated method results.  They
+can grow without bound.
+
+The *lru_cache* approach works with methods that have hashable
+arguments.  It creates a reference to the instance unless special
+efforts are made to pass in weak references.
+
+The advantage of the least recently used algorithm is that the cache is
+bounded by the specified *maxsize*.  The disadvantage is that instances
+are kept alive until they age out of the cache or until the cache is
+cleared.
+
+This example shows the various techniques::
+
+    class Weather:
+        "Lookup weather information on a government website"
+
+        def __init__(self, station_id):
+            self._station_id = station_id
+            # The _station_id is private and immutable
+
+        def current_temperature(self):
+            "Latest hourly observation"
+            # Do not cache this because old results
+            # can be out of date.
+
+        @cached_property
+        def location(self):
+            "Return the longitude/latitude coordinates of the station"
+            # Result only depends on the station_id
+
+        @lru_cache(maxsize=20)
+        def historic_rainfall(self, date, units='mm'):
+            "Rainfall on a given date"
+            # Depends on the station_id, date, and units.
+
+The above example assumes that the *station_id* never changes.  If the
+relevant instance attributes are mutable, the *cached_property* approach
+can't be made to work because it cannot detect changes to the
+attributes.
+
+The *lru_cache* approach can be made to work, but the class needs to define the
+*__eq__* and *__hash__* methods so the cache can detect relevant attribute
+updates::
+
+    class Weather:
+        "Example with a mutable station identifier"
+
+        def __init__(self, station_id):
+            self.station_id = station_id
+
+        def change_station(self, station_id):
+            self.station_id = station_id
+
+        def __eq__(self, other):
+            return self.station_id == other.station_id
+
+        def __hash__(self):
+            return hash(self.station_id)
+
+        @lru_cache(maxsize=20)
+        def historic_rainfall(self, date, units='cm'):
+            'Rainfall on a given date'
+            # Depends on the station_id, date, and units.
+
+
 Modules
 =======
 
@@ -1777,26 +2051,26 @@
 
 Suppose you have the following modules:
 
-foo.py::
+:file:`foo.py`::
 
    from bar import bar_var
    foo_var = 1
 
-bar.py::
+:file:`bar.py`::
 
    from foo import foo_var
    bar_var = 2
 
 The problem is that the interpreter will perform the following steps:
 
-* main imports foo
-* Empty globals for foo are created
-* foo is compiled and starts executing
-* foo imports bar
-* Empty globals for bar are created
-* bar is compiled and starts executing
-* bar imports foo (which is a no-op since there already is a module named foo)
-* bar.foo_var = foo.foo_var
+* main imports ``foo``
+* Empty globals for ``foo`` are created
+* ``foo`` is compiled and starts executing
+* ``foo`` imports ``bar``
+* Empty globals for ``bar`` are created
+* ``bar`` is compiled and starts executing
+* ``bar`` imports ``foo`` (which is a no-op since there already is a module named ``foo``)
+* The import mechanism tries to read ``foo_var`` from ``foo`` globals, to set ``bar.foo_var = foo.foo_var``
 
 The last step fails, because Python isn't done with interpreting ``foo`` yet and
 the global symbol dictionary for ``foo`` is still empty.
@@ -1818,7 +2092,7 @@
 * ``import`` statements
 * active code (including globals that are initialized from imported values).
 
-van Rossum doesn't like this approach much because the imports appear in a
+Van Rossum doesn't like this approach much because the imports appear in a
 strange place, but it does work.
 
 Matthias Urlichs recommends restructuring your code so that the recursive import
diff --git a/Doc/faq/windows.rst b/Doc/faq/windows.rst
index c8e9c5f..0153a4f 100644
--- a/Doc/faq/windows.rst
+++ b/Doc/faq/windows.rst
@@ -140,11 +140,8 @@
 How do I make an executable from a Python script?
 -------------------------------------------------
 
-See `cx_Freeze <https://cx-freeze.readthedocs.io/en/latest/>`_ for a distutils extension
-that allows you to create console and GUI executables from Python code.
-`py2exe <http://www.py2exe.org/>`_, the most popular extension for building
-Python 2.x-based executables, does not yet support Python 3 but a version that
-does is in development.
+See :ref:`faq-create-standalone-binary` for a list of tools that can be used to
+make executables.
 
 
 Is a ``*.pyd`` file the same as a DLL?
diff --git a/Doc/glossary.rst b/Doc/glossary.rst
index 4fd01e0..ddf085b 100644
--- a/Doc/glossary.rst
+++ b/Doc/glossary.rst
@@ -57,6 +57,8 @@
 
       See :term:`variable annotation`, :term:`function annotation`, :pep:`484`
       and :pep:`526`, which describe this functionality.
+      Also see :ref:`annotations-howto`
+      for best practices on working with annotations.
 
    argument
       A value passed to a :term:`function` (or :term:`method`) when calling the
@@ -158,6 +160,18 @@
       See also :term:`text file` for a file object able to read and write
       :class:`str` objects.
 
+   borrowed reference
+      In Python's C API, a borrowed reference is a reference to an object.
+      It does not modify the object reference count. It becomes a dangling
+      pointer if the object is destroyed. For example, a garbage collection can
+      remove the last :term:`strong reference` to the object and so destroy it.
+
+      Calling :c:func:`Py_INCREF` on the :term:`borrowed reference` is
+      recommended to convert it to a :term:`strong reference` in-place, except
+      when the object cannot be destroyed before the last usage of the borrowed
+      reference. The :c:func:`Py_NewRef` function can be used to create a new
+      :term:`strong reference`.
+
    bytes-like object
       An object that supports the :ref:`bufferobjects` and can
       export a C-:term:`contiguous` buffer. This includes all :class:`bytes`,
@@ -278,12 +292,12 @@
       The decorator syntax is merely syntactic sugar, the following two
       function definitions are semantically equivalent::
 
-         def f(...):
+         def f(arg):
              ...
          f = staticmethod(f)
 
          @staticmethod
-         def f(...):
+         def f(arg):
              ...
 
       The same concept exists for classes, but is less commonly used there.  See
@@ -386,6 +400,25 @@
    file-like object
       A synonym for :term:`file object`.
 
+   filesystem encoding and error handler
+      Encoding and error handler used by Python to decode bytes from the
+      operating system and encode Unicode to the operating system.
+
+      The filesystem encoding must guarantee to successfully decode all bytes
+      below 128. If the file system encoding fails to provide this guarantee,
+      API functions can raise :exc:`UnicodeError`.
+
+      The :func:`sys.getfilesystemencoding` and
+      :func:`sys.getfilesystemencodeerrors` functions can be used to get the
+      filesystem encoding and error handler.
+
+      The :term:`filesystem encoding and error handler` are configured at
+      Python startup by the :c:func:`PyConfig_Read` function: see
+      :c:member:`~PyConfig.filesystem_encoding` and
+      :c:member:`~PyConfig.filesystem_errors` members of :c:type:`PyConfig`.
+
+      See also the :term:`locale encoding`.
+
    finder
       An object that tries to find the :term:`loader` for a module that is
       being imported.
@@ -424,14 +457,17 @@
 
       See :term:`variable annotation` and :pep:`484`,
       which describe this functionality.
+      Also see :ref:`annotations-howto`
+      for best practices on working with annotations.
 
    __future__
-      A pseudo-module which programmers can use to enable new language features
-      which are not compatible with the current interpreter.
-
-      By importing the :mod:`__future__` module and evaluating its variables,
-      you can see when a new feature was first added to the language and when it
-      becomes the default::
+      A :ref:`future statement <future>`, ``from __future__ import <feature>``,
+      directs the compiler to compile the current module using syntax or
+      semantics that will become standard in a future release of Python.
+      The :mod:`__future__` module documents the possible values of
+      *feature*.  By importing this module and evaluating its variables,
+      you can see when a new feature was first added to the language and
+      when it will (or did) become the default::
 
          >>> import __future__
          >>> __future__.division
@@ -484,12 +520,13 @@
       :func:`functools.singledispatch` decorator, and :pep:`443`.
 
    generic type
-      A :term:`type` that can be parameterized; typically a container like
-      :class:`list`. Used for :term:`type hints <type hint>` and
+      A :term:`type` that can be parameterized; typically a
+      :ref:`container class<sequence-types>` such as :class:`list` or
+      :class:`dict`. Used for :term:`type hints <type hint>` and
       :term:`annotations <annotation>`.
 
-      See :pep:`483` for more details, and :mod:`typing` or
-      :ref:`generic alias type <types-genericalias>` for its uses.
+      For more details, see :ref:`generic alias types<types-genericalias>`,
+      :pep:`483`, :pep:`484`, :pep:`585`, and the :mod:`typing` module.
 
    GIL
       See :term:`global interpreter lock`.
@@ -632,6 +669,11 @@
 
       More information can be found in :ref:`typeiter`.
 
+      .. impl-detail::
+
+         CPython does not consistently apply the requirement that an iterator
+         define :meth:`__iter__`.
+
    key function
       A key function or collation function is a callable that returns a value
       used for sorting or ordering.  For example, :func:`locale.strxfrm` is
@@ -673,6 +715,18 @@
       thread removes *key* from *mapping* after the test, but before the lookup.
       This issue can be solved with locks or by using the EAFP approach.
 
+   locale encoding
+      On Unix, it is the encoding of the LC_CTYPE locale. It can be set with
+      ``locale.setlocale(locale.LC_CTYPE, new_locale)``.
+
+      On Windows, it is the ANSI code page (ex: ``cp1252``).
+
+      ``locale.getpreferredencoding(False)`` can be used to get the locale
+      encoding.
+
+      Python uses the :term:`filesystem encoding and error handler` to convert
+      between Unicode filenames and bytes filenames.
+
    list
       A built-in Python :term:`sequence`.  Despite its name it is more akin
       to an array in other languages than to a linked list since access to
@@ -1069,6 +1123,18 @@
       an :term:`expression` or one of several constructs with a keyword, such
       as :keyword:`if`, :keyword:`while` or :keyword:`for`.
 
+   strong reference
+      In Python's C API, a strong reference is a reference to an object
+      which increments the object's reference count when it is created and
+      decrements the object's reference count when it is deleted.
+
+      The :c:func:`Py_NewRef` function can be used to create a strong reference
+      to an object. Usually, the :c:func:`Py_DECREF` function must be called on
+      the strong reference before exiting the scope of the strong reference, to
+      avoid leaking one reference.
+
+      See also :term:`borrowed reference`.
+
    text encoding
       A codec which encodes Unicode strings to bytes.
 
@@ -1156,6 +1222,8 @@
 
       See :term:`function annotation`, :pep:`484`
       and :pep:`526`, which describe this functionality.
+      Also see :ref:`annotations-howto`
+      for best practices on working with annotations.
 
    virtual environment
       A cooperatively isolated runtime environment that allows Python users
diff --git a/Doc/howto/annotations.rst b/Doc/howto/annotations.rst
new file mode 100644
index 0000000..2bc2f2d
--- /dev/null
+++ b/Doc/howto/annotations.rst
@@ -0,0 +1,226 @@
+.. _annotations-howto:
+
+**************************
+Annotations Best Practices
+**************************
+
+:author: Larry Hastings
+
+.. topic:: Abstract
+
+  This document is designed to encapsulate the best practices
+  for working with annotations dicts.  If you write Python code
+  that examines ``__annotations__`` on Python objects, we
+  encourage you to follow the guidelines described below.
+
+  The document is organized into four sections:
+  best practices for accessing the annotations of an object
+  in Python versions 3.10 and newer,
+  best practices for accessing the annotations of an object
+  in Python versions 3.9 and older,
+  other best practices
+  for ``__annotations__`` that apply to any Python version,
+  and
+  quirks of ``__annotations__``.
+
+  Note that this document is specifically about working with
+  ``__annotations__``, not uses *for* annotations.
+  If you're looking for information on how to use "type hints"
+  in your code, please see the :mod:`typing` module.
+
+
+Accessing The Annotations Dict Of An Object In Python 3.10 And Newer
+====================================================================
+
+  Python 3.10 adds a new function to the standard library:
+  :func:`inspect.get_annotations`.  In Python versions 3.10
+  and newer, calling this function is the best practice for
+  accessing the annotations dict of any object that supports
+  annotations.  This function can also "un-stringize"
+  stringized annotations for you.
+
+  If for some reason :func:`inspect.get_annotations` isn't
+  viable for your use case, you may access the
+  ``__annotations__`` data member manually.  Best practice
+  for this changed in Python 3.10 as well: as of Python 3.10,
+  ``o.__annotations__`` is guaranteed to *always* work
+  on Python functions, classes, and modules.  If you're
+  certain the object you're examining is one of these three
+  *specific* objects, you may simply use ``o.__annotations__``
+  to get at the object's annotations dict.
+
+  However, other types of callables--for example,
+  callables created by :func:`functools.partial`--may
+  not have an ``__annotations__`` attribute defined.  When
+  accessing the ``__annotations__`` of a possibly unknown
+  object,  best practice in Python versions 3.10 and
+  newer is to call :func:`getattr` with three arguments,
+  for example ``getattr(o, '__annotations__', None)``.
+
+
+Accessing The Annotations Dict Of An Object In Python 3.9 And Older
+===================================================================
+
+  In Python 3.9 and older, accessing the annotations dict
+  of an object is much more complicated than in newer versions.
+  The problem is a design flaw in these older versions of Python,
+  specifically to do with class annotations.
+
+  Best practice for accessing the annotations dict of other
+  objects--functions, other callables, and modules--is the same
+  as best practice for 3.10, assuming you aren't calling
+  :func:`inspect.get_annotations`: you should use three-argument
+  :func:`getattr` to access the object's ``__annotations__``
+  attribute.
+
+  Unfortunately, this isn't best practice for classes.  The problem
+  is that, since ``__annotations__`` is optional on classes, and
+  because classes can inherit attributes from their base classes,
+  accessing the ``__annotations__`` attribute of a class may
+  inadvertently return the annotations dict of a *base class.*
+  As an example::
+
+      class Base:
+          a: int = 3
+          b: str = 'abc'
+
+      class Derived(Base):
+          pass
+
+      print(Derived.__annotations__)
+
+  This will print the annotations dict from ``Base``, not
+  ``Derived``.
+
+  Your code will have to have a separate code path if the object
+  you're examining is a class (``isinstance(o, type)``).
+  In that case, best practice relies on an implementation detail
+  of Python 3.9 and before: if a class has annotations defined,
+  they are stored in the class's ``__dict__`` dictionary.  Since
+  the class may or may not have annotations defined, best practice
+  is to call the ``get`` method on the class dict.
+
+  To put it all together, here is some sample code that safely
+  accesses the ``__annotations__`` attribute on an arbitrary
+  object in Python 3.9 and before::
+
+      if isinstance(o, type):
+          ann = o.__dict__.get('__annotations__', None)
+      else:
+          ann = getattr(o, '__annotations__', None)
+
+  After running this code, ``ann`` should be either a
+  dictionary or ``None``.  You're encouraged to double-check
+  the type of ``ann`` using :func:`isinstance` before further
+  examination.
+
+  Note that some exotic or malformed type objects may not have
+  a ``__dict__`` attribute, so for extra safety you may also wish
+  to use :func:`getattr` to access ``__dict__``.
+
+
+Manually Un-Stringizing Stringized Annotations
+==============================================
+
+  In situations where some annotations may be "stringized",
+  and you wish to evaluate those strings to produce the
+  Python values they represent, it really is best to
+  call :func:`inspect.get_annotations` to do this work
+  for you.
+
+  If you're using Python 3.9 or older, or if for some reason
+  you can't use :func:`inspect.get_annotations`, you'll need
+  to duplicate its logic.  You're encouraged to examine the
+  implementation of :func:`inspect.get_annotations` in the
+  current Python version and follow a similar approach.
+
+  In a nutshell, if you wish to evaluate a stringized annotation
+  on an arbitrary object ``o``:
+
+  * If ``o`` is a module, use ``o.__dict__`` as the
+    ``globals`` when calling :func:`eval`.
+  * If ``o`` is a class, use ``sys.modules[o.__module__].__dict__``
+    as the ``globals``, and ``dict(vars(o))`` as the ``locals``,
+    when calling :func:`eval`.
+  * If ``o`` is a wrapped callable using :func:`functools.update_wrapper`,
+    :func:`functools.wraps`, or :func:`functools.partial`, iteratively
+    unwrap it by accessing either ``o.__wrapped__`` or ``o.func`` as
+    appropriate, until you have found the root unwrapped function.
+  * If ``o`` is a callable (but not a class), use
+    ``o.__globals__`` as the globals when calling :func:`eval`.
+
+  However, not all string values used as annotations can
+  be successfully turned into Python values by :func:`eval`.
+  String values could theoretically contain any valid string,
+  and in practice there are valid use cases for type hints that
+  require annotating with string values that specifically
+  *can't* be evaluated.  For example:
+
+  * :pep:`604` union types using ``|``, before support for this
+    was added to Python 3.10.
+  * Definitions that aren't needed at runtime, only imported
+    when :const:`typing.TYPE_CHECKING` is true.
+
+  If :func:`eval` attempts to evaluate such values, it will
+  fail and raise an exception.  So, when designing a library
+  API that works with annotations, it's recommended to only
+  attempt to evaluate string values when explicitly requested
+  to by the caller.
+
+
+Best Practices For ``__annotations__`` In Any Python Version
+============================================================
+
+  * You should avoid assigning to the ``__annotations__`` member
+    of objects directly.  Let Python manage setting ``__annotations__``.
+
+  * If you do assign directly to the ``__annotations__`` member
+    of an object, you should always set it to a ``dict`` object.
+
+  * If you directly access the ``__annotations__`` member
+    of an object, you should ensure that it's a
+    dictionary before attempting to examine its contents.
+
+  * You should avoid modifying ``__annotations__`` dicts.
+
+  * You should avoid deleting the ``__annotations__`` attribute
+    of an object.
+
+
+``__annotations__`` Quirks
+==========================
+
+  In all versions of Python 3, function
+  objects lazy-create an annotations dict if no annotations
+  are defined on that object.  You can delete the ``__annotations__``
+  attribute using ``del fn.__annotations__``, but if you then
+  access ``fn.__annotations__`` the object will create a new empty dict
+  that it will store and return as its annotations.  Deleting the
+  annotations on a function before it has lazily created its annotations
+  dict will throw an ``AttributeError``; using ``del fn.__annotations__``
+  twice in a row is guaranteed to always throw an ``AttributeError``.
+
+  Everything in the above paragraph also applies to class and module
+  objects in Python 3.10 and newer.
+
+  In all versions of Python 3, you can set ``__annotations__``
+  on a function object to ``None``.  However, subsequently
+  accessing the annotations on that object using ``fn.__annotations__``
+  will lazy-create an empty dictionary as per the first paragraph of
+  this section.  This is *not* true of modules and classes, in any Python
+  version; those objects permit setting ``__annotations__`` to any
+  Python value, and will retain whatever value is set.
+
+  If Python stringizes your annotations for you
+  (using ``from __future__ import annotations``), and you
+  specify a string as an annotation, the string will
+  itself be quoted.  In effect the annotation is quoted
+  *twice.*  For example::
+
+       from __future__ import annotations
+       def foo(a: "str"): pass
+
+       print(foo.__annotations__)
+
+  This prints ``{'a': "'str'"}``.  This shouldn't really be considered
+  a "quirk"; it's mentioned here simply because it might be surprising.
diff --git a/Doc/howto/argparse.rst b/Doc/howto/argparse.rst
index e78a022..a97d10c 100644
--- a/Doc/howto/argparse.rst
+++ b/Doc/howto/argparse.rst
@@ -83,7 +83,7 @@
    $ python3 prog.py --help
    usage: prog.py [-h]
 
-   optional arguments:
+   options:
      -h, --help  show this help message and exit
    $ python3 prog.py --verbose
    usage: prog.py [-h]
@@ -130,7 +130,7 @@
    positional arguments:
      echo
 
-   optional arguments:
+   options:
      -h, --help  show this help message and exit
    $ python3 prog.py foo
    foo
@@ -172,7 +172,7 @@
    positional arguments:
      echo        echo the string you use here
 
-   optional arguments:
+   options:
      -h, --help  show this help message and exit
 
 Now, how about doing something even more useful::
@@ -241,7 +241,7 @@
    $ python3 prog.py --help
    usage: prog.py [-h] [--verbosity VERBOSITY]
 
-   optional arguments:
+   options:
      -h, --help            show this help message and exit
      --verbosity VERBOSITY
                            increase output verbosity
@@ -289,7 +289,7 @@
    $ python3 prog.py --help
    usage: prog.py [-h] [--verbose]
 
-   optional arguments:
+   options:
      -h, --help  show this help message and exit
      --verbose   increase output verbosity
 
@@ -332,7 +332,7 @@
    $ python3 prog.py --help
    usage: prog.py [-h] [-v]
 
-   optional arguments:
+   options:
      -h, --help     show this help message and exit
      -v, --verbose  increase output verbosity
 
@@ -353,7 +353,7 @@
    args = parser.parse_args()
    answer = args.square**2
    if args.verbose:
-       print("the square of {} equals {}".format(args.square, answer))
+       print(f"the square of {args.square} equals {answer}")
    else:
        print(answer)
 
@@ -387,9 +387,9 @@
    args = parser.parse_args()
    answer = args.square**2
    if args.verbosity == 2:
-       print("the square of {} equals {}".format(args.square, answer))
+       print(f"the square of {args.square} equals {answer}")
    elif args.verbosity == 1:
-       print("{}^2 == {}".format(args.square, answer))
+       print(f"{args.square}^2 == {answer}")
    else:
        print(answer)
 
@@ -421,9 +421,9 @@
    args = parser.parse_args()
    answer = args.square**2
    if args.verbosity == 2:
-       print("the square of {} equals {}".format(args.square, answer))
+       print(f"the square of {args.square} equals {answer}")
    elif args.verbosity == 1:
-       print("{}^2 == {}".format(args.square, answer))
+       print(f"{args.square}^2 == {answer}")
    else:
        print(answer)
 
@@ -440,7 +440,7 @@
    positional arguments:
      square                display a square of a given number
 
-   optional arguments:
+   options:
      -h, --help            show this help message and exit
      -v {0,1,2}, --verbosity {0,1,2}
                            increase output verbosity
@@ -461,14 +461,15 @@
    args = parser.parse_args()
    answer = args.square**2
    if args.verbosity == 2:
-       print("the square of {} equals {}".format(args.square, answer))
+       print(f"the square of {args.square} equals {answer}")
    elif args.verbosity == 1:
-       print("{}^2 == {}".format(args.square, answer))
+       print(f"{args.square}^2 == {answer}")
    else:
        print(answer)
 
 We have introduced another action, "count",
-to count the number of occurrences of a specific optional arguments:
+to count the number of occurrences of specific options.
+
 
 .. code-block:: shell-session
 
@@ -489,7 +490,7 @@
    positional arguments:
      square           display a square of a given number
 
-   optional arguments:
+   options:
      -h, --help       show this help message and exit
      -v, --verbosity  increase output verbosity
    $ python3 prog.py 4 -vvv
@@ -529,9 +530,9 @@
 
    # bugfix: replace == with >=
    if args.verbosity >= 2:
-       print("the square of {} equals {}".format(args.square, answer))
+       print(f"the square of {args.square} equals {answer}")
    elif args.verbosity >= 1:
-       print("{}^2 == {}".format(args.square, answer))
+       print(f"{args.square}^2 == {answer}")
    else:
        print(answer)
 
@@ -566,9 +567,9 @@
    args = parser.parse_args()
    answer = args.square**2
    if args.verbosity >= 2:
-       print("the square of {} equals {}".format(args.square, answer))
+       print(f"the square of {args.square} equals {answer}")
    elif args.verbosity >= 1:
-       print("{}^2 == {}".format(args.square, answer))
+       print(f"{args.square}^2 == {answer}")
    else:
        print(answer)
 
@@ -606,9 +607,9 @@
    args = parser.parse_args()
    answer = args.x**args.y
    if args.verbosity >= 2:
-       print("{} to the power {} equals {}".format(args.x, args.y, answer))
+       print(f"{args.x} to the power {args.y} equals {answer}")
    elif args.verbosity >= 1:
-       print("{}^{} == {}".format(args.x, args.y, answer))
+       print(f"{args.x}^{args.y} == {answer}")
    else:
        print(answer)
 
@@ -626,7 +627,7 @@
      x                the base
      y                the exponent
 
-   optional arguments:
+   options:
      -h, --help       show this help message and exit
      -v, --verbosity
    $ python3 prog.py 4 2 -v
@@ -645,9 +646,9 @@
    args = parser.parse_args()
    answer = args.x**args.y
    if args.verbosity >= 2:
-       print("Running '{}'".format(__file__))
+       print(f"Running '{__file__}'")
    if args.verbosity >= 1:
-       print("{}^{} == ".format(args.x, args.y), end="")
+       print(f"{args.x}^{args.y} == ", end="")
    print(answer)
 
 Output:
@@ -688,9 +689,9 @@
    if args.quiet:
        print(answer)
    elif args.verbose:
-       print("{} to the power {} equals {}".format(args.x, args.y, answer))
+       print(f"{args.x} to the power {args.y} equals {answer}")
    else:
-       print("{}^{} == {}".format(args.x, args.y, answer))
+       print(f"{args.x}^{args.y} == {answer}")
 
 Our program is now simpler, and we've lost some functionality for the sake of
 demonstration. Anyways, here's the output:
@@ -750,7 +751,7 @@
      x              the base
      y              the exponent
 
-   optional arguments:
+   options:
      -h, --help     show this help message and exit
      -v, --verbose
      -q, --quiet
diff --git a/Doc/howto/clinic.rst b/Doc/howto/clinic.rst
index 5004182..3a3653a 100644
--- a/Doc/howto/clinic.rst
+++ b/Doc/howto/clinic.rst
@@ -1206,6 +1206,68 @@
     [clinic start generated code]*/
 
 
+Using a "defining class" converter
+----------------------------------
+
+Argument Clinic facilitates gaining access to the defining class of a method.
+This is useful for :ref:`heap type <heap-types>` methods that need to fetch
+module level state.  Use :c:func:`PyType_FromModuleAndSpec` to associate a new
+heap type with a module.  You can now use :c:func:`PyType_GetModuleState` on
+the defining class to fetch the module state, for example from a module method.
+
+Example from ``Modules/zlibmodule.c``.  First, ``defining_class`` is added to
+the clinic input::
+
+    /*[clinic input]
+    zlib.Compress.compress
+
+      cls: defining_class
+      data: Py_buffer
+        Binary data to be compressed.
+      /
+
+
+After running the Argument Clinic tool, the following function signature is
+generated::
+
+    /*[clinic start generated code]*/
+    static PyObject *
+    zlib_Compress_compress_impl(compobject *self, PyTypeObject *cls,
+                                Py_buffer *data)
+    /*[clinic end generated code: output=6731b3f0ff357ca6 input=04d00f65ab01d260]*/
+
+
+The following code can now use ``PyType_GetModuleState(cls)`` to fetch the
+module state::
+
+    zlibstate *state = PyType_GetModuleState(cls);
+
+
+Each method may only have one argument using this converter, and it must appear
+after ``self``, or, if ``self`` is not used, as the first argument.  The argument
+will be of type ``PyTypeObject *``.  The argument will not appear in the
+``__text_signature__``.
+
+The ``defining_class`` converter is not compatible with ``__init__`` and ``__new__``
+methods, which cannot use the ``METH_METHOD`` convention.
+
+It is not possible to use ``defining_class`` with slot methods.  In order to
+fetch the module state from such methods, use ``_PyType_GetModuleByDef`` to
+look up the module and then :c:func:`PyModule_GetState` to fetch the module
+state.  Example from the ``setattro`` slot method in
+``Modules/_threadmodule.c``::
+
+    static int
+    local_setattro(localobject *self, PyObject *name, PyObject *v)
+    {
+        PyObject *module = _PyType_GetModuleByDef(Py_TYPE(self), &thread_module);
+        thread_module_state *state = get_thread_state(module);
+        ...
+    }
+
+
+See also :pep:`573`.
+
 
 Writing a custom converter
 --------------------------
diff --git a/Doc/howto/descriptor.rst b/Doc/howto/descriptor.rst
index ab5a573..f2e2f7e 100644
--- a/Doc/howto/descriptor.rst
+++ b/Doc/howto/descriptor.rst
@@ -42,8 +42,8 @@
 Simple example: A descriptor that returns a constant
 ----------------------------------------------------
 
-The :class:`Ten` class is a descriptor that always returns the constant ``10``
-from its :meth:`__get__` method:
+The :class:`Ten` class is a descriptor whose :meth:`__get__` method always
+returns the constant ``10``:
 
 .. testcode::
 
@@ -70,10 +70,10 @@
     >>> a.y                         # Descriptor lookup
     10
 
-In the ``a.x`` attribute lookup, the dot operator finds the key ``x`` and the
-value ``5`` in the class dictionary.  In the ``a.y`` lookup, the dot operator
-finds a descriptor instance, recognized by its ``__get__`` method, and calls
-that method which returns ``10``.
+In the ``a.x`` attribute lookup, the dot operator finds ``'x': 5``
+in the class dictionary.  In the ``a.y`` lookup, the dot operator
+finds a descriptor instance, recognized by its ``__get__`` method.
+Calling that method returns ``10``.
 
 Note that the value ``10`` is not stored in either the class dictionary or the
 instance dictionary.  Instead, the value ``10`` is computed on demand.
@@ -115,9 +115,9 @@
     20
     >>> g.size                              # The games directory has three files
     3
-    >>> open('games/newfile').close()       # Add a fourth file to the directory
+    >>> os.remove('games/chess')            # Delete a game
     >>> g.size                              # File count is automatically updated
-    4
+    2
 
 Besides showing how descriptors can run computations, this example also
 reveals the purpose of the parameters to :meth:`__get__`.  The *self*
@@ -281,7 +281,9 @@
     INFO:root:Updating 'name' to 'Catherine C'
     INFO:root:Updating 'age' to 20
 
-The two *Person* instances contain only the private names::
+The two *Person* instances contain only the private names:
+
+.. doctest::
 
     >>> vars(pete)
     {'_name': 'Peter P', '_age': 10}
@@ -300,7 +302,7 @@
 created or the name of class variable it was assigned to.  (This method, if
 present, is called even if the class is not a descriptor.)
 
-Descriptors get invoked by the dot "operator" during attribute lookup.  If a
+Descriptors get invoked by the dot operator during attribute lookup.  If a
 descriptor is accessed indirectly with ``vars(some_class)[descriptor_name]``,
 the descriptor instance is returned without invoking it.
 
@@ -497,7 +499,7 @@
 
 In general, a descriptor is an attribute value that has one of the methods in
 the descriptor protocol.  Those methods are :meth:`__get__`, :meth:`__set__`,
-and :meth:`__delete__`.  If any of those methods are defined for an the
+and :meth:`__delete__`.  If any of those methods are defined for an
 attribute, it is said to be a :term:`descriptor`.
 
 The default behavior for attribute access is to get, set, or delete the
@@ -694,10 +696,14 @@
     >>> b.g == b['g'] == ('getattr_hook', b, 'g')
     True
 
+Note, there is no :meth:`__getattr__` hook in the :meth:`__getattribute__`
+code.  That is why calling :meth:`__getattribute__` directly or with
+``super().__getattribute__`` will bypass :meth:`__getattr__` entirely.
 
-Interestingly, attribute lookup doesn't call :meth:`object.__getattribute__`
-directly.  Instead, both the dot operator and the :func:`getattr` function
-perform attribute lookup by way of a helper function:
+Instead, it is the dot operator and the :func:`getattr` function that are
+responsible for invoking :meth:`__getattr__` whenever :meth:`__getattribute__`
+raises an :exc:`AttributeError`.  Their logic is encapsulated in a helper
+function:
 
 .. testcode::
 
@@ -710,11 +716,37 @@
                 raise
         return type(obj).__getattr__(obj, name)             # __getattr__
 
-So if :meth:`__getattr__` exists, it is called whenever :meth:`__getattribute__`
-raises :exc:`AttributeError` (either directly or in one of the descriptor calls).
+.. doctest::
+    :hide:
 
-Also, if a user calls :meth:`object.__getattribute__` directly, the
-:meth:`__getattr__` hook is bypassed entirely.
+
+    >>> class ClassWithGetAttr:
+    ...     x = 123
+    ...     def __getattr__(self, attr):
+    ...         return attr.upper()
+    ...
+    >>> cw = ClassWithGetAttr()
+    >>> cw.y = 456
+    >>> getattr_hook(cw, 'x')
+    123
+    >>> getattr_hook(cw, 'y')
+    456
+    >>> getattr_hook(cw, 'z')
+    'Z'
+
+    >>> class ClassWithoutGetAttr:
+    ...     x = 123
+    ...
+    >>> cwo = ClassWithoutGetAttr()
+    >>> cwo.y = 456
+    >>> getattr_hook(cwo, 'x')
+    123
+    >>> getattr_hook(cwo, 'y')
+    456
+    >>> getattr_hook(cwo, 'z')
+    Traceback (most recent call last):
+        ...
+    AttributeError: 'ClassWithoutGetAttr' object has no attribute 'z'
 
 
 Invocation from a class
@@ -919,6 +951,20 @@
         def delx(self): del self.__x
         x = property(getx, setx, delx, "I'm the 'x' property.")
 
+.. doctest::
+    :hide:
+
+    >>> C.x.__doc__
+    "I'm the 'x' property."
+    >>> c.x = 2.71828
+    >>> c.x
+    2.71828
+    >>> del c.x
+    >>> c.x
+    Traceback (most recent call last):
+      ...
+    AttributeError: 'C' object has no attribute '_C__x'
+
 To see how :func:`property` is implemented in terms of the descriptor protocol,
 here is a pure Python equivalent:
 
@@ -934,32 +980,42 @@
             if doc is None and fget is not None:
                 doc = fget.__doc__
             self.__doc__ = doc
+            self._name = ''
+
+        def __set_name__(self, owner, name):
+            self._name = name
 
         def __get__(self, obj, objtype=None):
             if obj is None:
                 return self
             if self.fget is None:
-                raise AttributeError("unreadable attribute")
+                raise AttributeError(f'unreadable attribute {self._name}')
             return self.fget(obj)
 
         def __set__(self, obj, value):
             if self.fset is None:
-                raise AttributeError("can't set attribute")
+                raise AttributeError(f"can't set attribute {self._name}")
             self.fset(obj, value)
 
         def __delete__(self, obj):
             if self.fdel is None:
-                raise AttributeError("can't delete attribute")
+                raise AttributeError(f"can't delete attribute {self._name}")
             self.fdel(obj)
 
         def getter(self, fget):
-            return type(self)(fget, self.fset, self.fdel, self.__doc__)
+            prop = type(self)(fget, self.fset, self.fdel, self.__doc__)
+            prop._name = self._name
+            return prop
 
         def setter(self, fset):
-            return type(self)(self.fget, fset, self.fdel, self.__doc__)
+            prop = type(self)(self.fget, fset, self.fdel, self.__doc__)
+            prop._name = self._name
+            return prop
 
         def deleter(self, fdel):
-            return type(self)(self.fget, self.fset, fdel, self.__doc__)
+            prop = type(self)(self.fget, self.fset, fdel, self.__doc__)
+            prop._name = self._name
+            return prop
 
 .. testcode::
     :hide:
@@ -1054,7 +1110,7 @@
 .. testcode::
 
     class MethodType:
-        "Emulate Py_MethodType in Objects/classobject.c"
+        "Emulate PyMethod_Type in Objects/classobject.c"
 
         def __init__(self, func, obj):
             self.__func__ = func
@@ -1129,8 +1185,8 @@
 *cls* comes from in class methods, this is it!
 
 
-Static methods
---------------
+Kinds of methods
+----------------
 
 Non-data descriptors provide a simple mechanism for variations on the usual
 patterns of binding functions into methods.
@@ -1153,6 +1209,10 @@
       | classmethod     | f(type(obj), \*args) | f(cls, \*args)   |
       +-----------------+----------------------+------------------+
 
+
+Static methods
+--------------
+
 Static methods return the underlying function without changes.  Calling either
 ``c.f`` or ``C.f`` is the equivalent of a direct lookup into
 ``object.__getattribute__(c, "f")`` or ``object.__getattribute__(C, "f")``. As a
@@ -1179,19 +1239,19 @@
     class E:
         @staticmethod
         def f(x):
-            print(x)
+            return x * 10
 
 .. doctest::
 
     >>> E.f(3)
-    3
+    30
     >>> E().f(3)
-    3
+    30
 
 Using the non-data descriptor protocol, a pure Python version of
 :func:`staticmethod` would look like this:
 
-.. doctest::
+.. testcode::
 
     class StaticMethod:
         "Emulate PyStaticMethod_Type() in Objects/funcobject.c"
@@ -1202,6 +1262,29 @@
         def __get__(self, obj, objtype=None):
             return self.f
 
+        def __call__(self, *args, **kwds):
+            return self.f(*args, **kwds)
+
+.. testcode::
+    :hide:
+
+    class E_sim:
+        @StaticMethod
+        def f(x):
+            return x * 10
+
+    wrapped_ord = StaticMethod(ord)
+
+.. doctest::
+    :hide:
+
+    >>> E_sim.f(3)
+    30
+    >>> E_sim().f(3)
+    30
+    >>> wrapped_ord('A')
+    65
+
 
 Class methods
 -------------
@@ -1265,8 +1348,8 @@
         def __get__(self, obj, cls=None):
             if cls is None:
                 cls = type(obj)
-            if hasattr(obj, '__get__'):
-                return self.f.__get__(cls)
+            if hasattr(type(self.f), '__get__'):
+                return self.f.__get__(cls, cls)
             return MethodType(self.f, cls)
 
 .. testcode::
@@ -1278,6 +1361,12 @@
         def cm(cls, x, y):
             return (cls, x, y)
 
+        @ClassMethod
+        @property
+        def __doc__(cls):
+            return f'A doc for {cls.__name__!r}'
+
+
 .. doctest::
     :hide:
 
@@ -1289,9 +1378,15 @@
     >>> t.cm(11, 22)
     (<class 'T'>, 11, 22)
 
-The code path for ``hasattr(obj, '__get__')`` was added in Python 3.9 and
-makes it possible for :func:`classmethod` to support chained decorators.
-For example, a classmethod and property could be chained together:
+    # Check the alternate path for chained descriptors
+    >>> T.__doc__
+    "A doc for 'T'"
+
+
+The code path for ``hasattr(type(self.f), '__get__')`` was added in
+Python 3.9 and makes it possible for :func:`classmethod` to support
+chained decorators.  For example, a classmethod and property could be
+chained together:
 
 .. testcode::
 
@@ -1370,7 +1465,10 @@
 design pattern <https://en.wikipedia.org/wiki/Flyweight_pattern>`_ likely only
 matters when a large number of instances are going to be created.
 
-4. Blocks tools like :func:`functools.cached_property` which require an
+4. Improves speed.  Reading instance variables is 35% faster with
+``__slots__`` (as measured with Python 3.10 on an Apple M1 processor).
+
+5. Blocks tools like :func:`functools.cached_property` which require an
 instance dictionary to function correctly:
 
 .. testcode::
@@ -1444,7 +1542,7 @@
         'Simulate how the type metaclass adds member objects for slots'
 
         def __new__(mcls, clsname, bases, mapping):
-            'Emuluate type_new() in Objects/typeobject.c'
+            'Emulate type_new() in Objects/typeobject.c'
             # type_new() calls PyTypeReady() which calls add_methods()
             slot_names = mapping.get('slot_names', [])
             for offset, name in enumerate(slot_names):
diff --git a/Doc/howto/functional.rst b/Doc/howto/functional.rst
index 74e8614..c7f8bc8 100644
--- a/Doc/howto/functional.rst
+++ b/Doc/howto/functional.rst
@@ -65,11 +65,10 @@
 
 Some languages are very strict about purity and don't even have assignment
 statements such as ``a=3`` or ``c = a + b``, but it's difficult to avoid all
-side effects.  Printing to the screen or writing to a disk file are side
-effects, for example.  For example, in Python a call to the :func:`print` or
-:func:`time.sleep` function both return no useful value; they're only called for
-their side effects of sending some text to the screen or pausing execution for a
-second.
+side effects, such as printing to the screen or writing to a disk file. Another
+example is a call to the :func:`print` or :func:`time.sleep` function, neither
+of which returns a useful value. Both are called only for their side effects
+of sending some text to the screen or pausing execution for a second.
 
 Python programs written in functional style usually won't go to the extreme of
 avoiding all I/O or all assignments; instead, they'll provide a
diff --git a/Doc/howto/index.rst b/Doc/howto/index.rst
index 593341c..01a78a5 100644
--- a/Doc/howto/index.rst
+++ b/Doc/howto/index.rst
@@ -29,4 +29,5 @@
    ipaddress.rst
    clinic.rst
    instrumentation.rst
+   annotations.rst
 
diff --git a/Doc/howto/instrumentation.rst b/Doc/howto/instrumentation.rst
index f0081e4..4a59ae8 100644
--- a/Doc/howto/instrumentation.rst
+++ b/Doc/howto/instrumentation.rst
@@ -46,7 +46,8 @@
    $ sudo apt-get install systemtap-sdt-dev
 
 
-CPython must then be configured ``--with-dtrace``:
+CPython must then be :option:`configured with the --with-dtrace option
+<--with-dtrace>`:
 
 .. code-block:: none
 
@@ -77,7 +78,8 @@
    $ readelf -S ./python | grep .note.stapsdt
    [30] .note.stapsdt        NOTE         0000000000000000 00308d78
 
-If you've built Python as a shared library (with --enable-shared), you
+If you've built Python as a shared library
+(with the :option:`--enable-shared` configure option), you
 need to look instead within the shared library.  For example::
 
    $ readelf -S libpython3.3dm.so.1.0 | grep .note.stapsdt
@@ -252,7 +254,7 @@
 
 and the remainder indicates the call/return hierarchy as the script executes.
 
-For a `--enable-shared` build of CPython, the markers are contained within the
+For a :option:`--enable-shared` build of CPython, the markers are contained within the
 libpython shared library, and the probe's dotted path needs to reflect this. For
 example, this line from the above example:
 
@@ -266,7 +268,7 @@
 
    probe process("python").library("libpython3.6dm.so.1.0").mark("function__entry") {
 
-(assuming a debug build of CPython 3.6)
+(assuming a :ref:`debug build <debug-build>` of CPython 3.6)
 
 
 Available static markers
diff --git a/Doc/howto/ipaddress.rst b/Doc/howto/ipaddress.rst
index 452e367..e852db9 100644
--- a/Doc/howto/ipaddress.rst
+++ b/Doc/howto/ipaddress.rst
@@ -32,7 +32,7 @@
 ---------------------
 
 For readers that aren't particularly familiar with IP addressing, it's
-important to know that the Internet Protocol is currently in the process
+important to know that the Internet Protocol (IP) is currently in the process
 of moving from version 4 of the protocol to version 6. This transition is
 occurring largely because version 4 of the protocol doesn't provide enough
 addresses to handle the needs of the whole world, especially given the
diff --git a/Doc/howto/logging-cookbook.rst b/Doc/howto/logging-cookbook.rst
index de0f834..f82150a 100644
--- a/Doc/howto/logging-cookbook.rst
+++ b/Doc/howto/logging-cookbook.rst
@@ -332,7 +332,7 @@
 .. currentmodule:: logging.handlers
 
 Sometimes you have to get your logging handlers to do their work without
-blocking the thread you're logging from. This is common in Web applications,
+blocking the thread you're logging from. This is common in web applications,
 though of course it also occurs in other scenarios.
 
 A common culprit which demonstrates sluggish behaviour is the
@@ -541,6 +541,17 @@
 serialization.
 
 
+Running a logging socket listener in production
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+To run a logging listener in production, you may need to use a process-management tool
+such as `Supervisor <http://supervisord.org/>`_. `Here
+<https://gist.github.com/vsajip/4b227eeec43817465ca835ca66f75e2b>`_ is a Gist which
+provides the bare-bones files to run the above functionality using Supervisor: you
+will need to change the `/path/to/` parts in the Gist to reflect the actual paths you
+want to use.
+
+
 .. _context-info:
 
 Adding contextual information to your logging output
@@ -982,6 +993,17 @@
         for i in range(10):
             executor.submit(worker_process, queue, worker_configurer)
 
+Deploying Web applications using Gunicorn and uWSGI
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+When deploying Web applications using `Gunicorn <https://gunicorn.org/>`_ or `uWSGI
+<https://uwsgi-docs.readthedocs.io/en/latest/>`_ (or similar), multiple worker
+processes are created to handle client requests. In such environments, avoid creating
+file-based handlers directly in your web application. Instead, use a
+:class:`SocketHandler` to log from the web application to a listener in a separate
+process. This can be set up using a process management tool such as Supervisor - see
+`Running a logging socket listener in production`_ for more details.
+
 
 Using file rotation
 -------------------
@@ -1188,7 +1210,7 @@
 
     class StyleAdapter(logging.LoggerAdapter):
         def __init__(self, logger, extra=None):
-            super(StyleAdapter, self).__init__(logger, extra or {})
+            super().__init__(logger, extra or {})
 
         def log(self, level, msg, /, *args, **kwargs):
             if self.isEnabledFor(level):
@@ -1783,7 +1805,7 @@
                 return tuple(o)
             elif isinstance(o, unicode):
                 return o.encode('unicode_escape').decode('ascii')
-            return super(Encoder, self).default(o)
+            return super().default(o)
 
     class StructuredMessage:
         def __init__(self, message, /, **kwargs):
@@ -2175,11 +2197,11 @@
             """
             Format an exception so that it prints on a single line.
             """
-            result = super(OneLineExceptionFormatter, self).formatException(exc_info)
+            result = super().formatException(exc_info)
             return repr(result)  # or format into one line however you want to
 
         def format(self, record):
-            s = super(OneLineExceptionFormatter, self).format(record)
+            s = super().format(record)
             if record.exc_text:
                 s = s.replace('\n', '') + '|'
             return s
@@ -2813,7 +2835,7 @@
     #
     class QtHandler(logging.Handler):
         def __init__(self, slotfunc, *args, **kwargs):
-            super(QtHandler, self).__init__(*args, **kwargs)
+            super().__init__(*args, **kwargs)
             self.signaller = Signaller()
             self.signaller.signal.connect(slotfunc)
 
@@ -2883,7 +2905,7 @@
         }
 
         def __init__(self, app):
-            super(Window, self).__init__()
+            super().__init__()
             self.app = app
             self.textedit = te = QtWidgets.QPlainTextEdit(self)
             # Set whatever the default monospace font is for the platform
@@ -2979,3 +3001,82 @@
 
     if __name__=='__main__':
         main()
+
+
+.. patterns-to-avoid:
+
+Patterns to avoid
+-----------------
+
+Although the preceding sections have described ways of doing things you might
+need to do or deal with, it is worth mentioning some usage patterns which are
+*unhelpful*, and which should therefore be avoided in most cases. The following
+sections are in no particular order.
+
+
+Opening the same log file multiple times
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+On Windows, you will generally not be able to open the same file multiple times
+as this will lead to a "file is in use by another process" error. However, on
+POSIX platforms you'll not get any errors if you open the same file multiple
+times. This could be done accidentally, for example by:
+
+* Adding a file handler more than once which references the same file (e.g. by
+  a copy/paste/forget-to-change error).
+
+* Opening two files that look different, as they have different names, but are
+  the same because one is a symbolic link to the other.
+
+* Forking a process, following which both parent and child have a reference to
+  the same file. This might be through use of the :mod:`multiprocessing` module,
+  for example.
+
+Opening a file multiple times might *appear* to work most of the time, but can
+lead to a number of problems in practice:
+
+* Logging output can be garbled because multiple threads or processes try to
+  write to the same file. Although logging guards against concurrent use of the
+  same handler instance by multiple threads, there is no such protection if
+  concurrent writes are attempted by two different threads using two different
+  handler instances which happen to point to the same file.
+
+* An attempt to delete a file (e.g. during file rotation) silently fails,
+  because there is another reference pointing to it. This can lead to confusion
+  and wasted debugging time - log entries end up in unexpected places, or are
+  lost altogether.
+
+Use the techniques outlined in :ref:`multiple-processes` to circumvent such
+issues.
+
+Using loggers as attributes in a class or passing them as parameters
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+While there might be unusual cases where you'll need to do this, in general
+there is no point because loggers are singletons. Code can always access a
+given logger instance by name using ``logging.getLogger(name)``, so passing
+instances around and holding them as instance attributes is pointless. Note
+that in other languages such as Java and C#, loggers are often static class
+attributes. However, this pattern doesn't make sense in Python, where the
+module (and not the class) is the unit of software decomposition.
+
+
+Adding handlers other than :class:`NullHandler` to a logger in a library
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Configuring logging by adding handlers, formatters and filters is the
+responsibility of the application developer, not the library developer. If you
+are maintaining a library, ensure that you don't add handlers to any of your
+loggers other than a :class:`~logging.NullHandler` instance.
+
+
+Creating a lot of loggers
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Loggers are singletons that are never freed during a script execution, and so
+creating lots of loggers will use up memory which can't then be freed. Rather
+than create a logger per e.g. file processed or network connection made, use
+the :ref:`existing mechanisms <context-info>` for passing contextual
+information into your logs and restrict the loggers created to those describing
+areas within your application (generally modules, but occasionally slightly
+more fine-grained than that).
diff --git a/Doc/howto/logging.rst b/Doc/howto/logging.rst
index 6316e08..fcc6bec 100644
--- a/Doc/howto/logging.rst
+++ b/Doc/howto/logging.rst
@@ -684,7 +684,6 @@
 
     [formatter_simpleFormatter]
     format=%(asctime)s - %(name)s - %(levelname)s - %(message)s
-    datefmt=
 
 The output is nearly identical to that of the non-config-file-based example:
 
@@ -1078,20 +1077,22 @@
 list of things you can do to avoid processing during logging which you don't
 need:
 
-+-----------------------------------------------+----------------------------------------+
-| What you don't want to collect                | How to avoid collecting it             |
-+===============================================+========================================+
-| Information about where calls were made from. | Set ``logging._srcfile`` to ``None``.  |
-|                                               | This avoids calling                    |
-|                                               | :func:`sys._getframe`, which may help  |
-|                                               | to speed up your code in environments  |
-|                                               | like PyPy (which can't speed up code   |
-|                                               | that uses :func:`sys._getframe`).      |
-+-----------------------------------------------+----------------------------------------+
-| Threading information.                        | Set ``logging.logThreads`` to ``0``.   |
-+-----------------------------------------------+----------------------------------------+
-| Process information.                          | Set ``logging.logProcesses`` to ``0``. |
-+-----------------------------------------------+----------------------------------------+
++-----------------------------------------------------+---------------------------------------------------+
+| What you don't want to collect                      | How to avoid collecting it                        |
++=====================================================+===================================================+
+| Information about where calls were made from.       | Set ``logging._srcfile`` to ``None``.             |
+|                                                     | This avoids calling :func:`sys._getframe`, which  |
+|                                                     | may help to speed up your code in environments    |
+|                                                     | like PyPy (which can't speed up code that uses    |
+|                                                     | :func:`sys._getframe`).                           |
++-----------------------------------------------------+---------------------------------------------------+
+| Threading information.                              | Set ``logging.logThreads`` to ``False``.          |
++-----------------------------------------------------+---------------------------------------------------+
+| Current process ID (:func:`os.getpid`)              | Set ``logging.logProcesses`` to ``False``.        |
++-----------------------------------------------------+---------------------------------------------------+
+| Current process name when using ``multiprocessing`` | Set ``logging.logMultiprocessing`` to ``False``.  |
+| to manage multiple processes.                       |                                                   |
++-----------------------------------------------------+---------------------------------------------------+
 
 Also note that the core logging module only includes the basic handlers. If
 you don't import :mod:`logging.handlers` and :mod:`logging.config`, they won't
diff --git a/Doc/howto/logging_flow.png b/Doc/howto/logging_flow.png
index fac4acd..d65e597 100644
--- a/Doc/howto/logging_flow.png
+++ b/Doc/howto/logging_flow.png
Binary files differ
diff --git a/Doc/howto/pyporting.rst b/Doc/howto/pyporting.rst
index 1543823..abcc342 100644
--- a/Doc/howto/pyporting.rst
+++ b/Doc/howto/pyporting.rst
@@ -20,8 +20,8 @@
    came into existence, you can read Nick Coghlan's `Python 3 Q & A`_ or
    Brett Cannon's `Why Python 3 exists`_.
 
-   For help with porting, you can email the python-porting_ mailing list with
-   questions.
+
+   For help with porting, you can view the archived python-porting_ mailing list.
 
 The Short Explanation
 =====================
@@ -446,7 +446,7 @@
 
 .. _pytype: https://github.com/google/pytype
 .. _python-future: http://python-future.org/
-.. _python-porting: https://mail.python.org/mailman/listinfo/python-porting
+.. _python-porting: https://mail.python.org/pipermail/python-porting/
 .. _six: https://pypi.org/project/six
 .. _tox: https://pypi.org/project/tox
 .. _trove classifier: https://pypi.org/classifiers
diff --git a/Doc/howto/sockets.rst b/Doc/howto/sockets.rst
index d6ed128..e58f78a 100644
--- a/Doc/howto/sockets.rst
+++ b/Doc/howto/sockets.rst
@@ -45,7 +45,7 @@
 cross-platform communication, sockets are about the only game in town.
 
 They were invented in Berkeley as part of the BSD flavor of Unix. They spread
-like wildfire with the Internet. With good reason --- the combination of sockets
+like wildfire with the internet. With good reason --- the combination of sockets
 with INET makes talking to arbitrary machines around the world unbelievably easy
 (at least compared to other schemes).
 
diff --git a/Doc/howto/sorting.rst b/Doc/howto/sorting.rst
index a8efe65..37328c8 100644
--- a/Doc/howto/sorting.rst
+++ b/Doc/howto/sorting.rst
@@ -18,7 +18,9 @@
 ==============
 
 A simple ascending sort is very easy: just call the :func:`sorted` function. It
-returns a new sorted list::
+returns a new sorted list:
+
+.. doctest::
 
     >>> sorted([5, 2, 3, 1, 4])
     [1, 2, 3, 4, 5]
@@ -28,6 +30,8 @@
 than :func:`sorted` - but if you don't need the original list, it's slightly
 more efficient.
 
+.. doctest::
+
     >>> a = [5, 2, 3, 1, 4]
     >>> a.sort()
     >>> a
@@ -36,6 +40,8 @@
 Another difference is that the :meth:`list.sort` method is only defined for
 lists. In contrast, the :func:`sorted` function accepts any iterable.
 
+.. doctest::
+
     >>> sorted({1: 'D', 2: 'B', 3: 'B', 4: 'E', 5: 'A'})
     [1, 2, 3, 4, 5]
 
@@ -48,6 +54,8 @@
 
 For example, here's a case-insensitive string comparison:
 
+.. doctest::
+
     >>> sorted("This is a test string from Andrew".split(), key=str.lower)
     ['a', 'Andrew', 'from', 'is', 'string', 'test', 'This']
 
@@ -59,6 +67,8 @@
 A common pattern is to sort complex objects using some of the object's indices
 as keys. For example:
 
+.. doctest::
+
     >>> student_tuples = [
     ...     ('john', 'A', 15),
     ...     ('jane', 'B', 12),
@@ -69,6 +79,8 @@
 
 The same technique works for objects with named attributes. For example:
 
+.. doctest::
+
     >>> class Student:
     ...     def __init__(self, name, grade, age):
     ...         self.name = name
@@ -95,6 +107,8 @@
 
 Using those functions, the above examples become simpler and faster:
 
+.. doctest::
+
     >>> from operator import itemgetter, attrgetter
 
     >>> sorted(student_tuples, key=itemgetter(2))
@@ -106,6 +120,8 @@
 The operator module functions allow multiple levels of sorting. For example, to
 sort by *grade* then by *age*:
 
+.. doctest::
+
     >>> sorted(student_tuples, key=itemgetter(1,2))
     [('john', 'A', 15), ('dave', 'B', 10), ('jane', 'B', 12)]
 
@@ -119,6 +135,8 @@
 boolean value. This is used to flag descending sorts. For example, to get the
 student data in reverse *age* order:
 
+.. doctest::
+
     >>> sorted(student_tuples, key=itemgetter(2), reverse=True)
     [('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]
 
@@ -132,6 +150,8 @@
 <https://en.wikipedia.org/wiki/Sorting_algorithm#Stability>`_\. That means that
 when multiple records have the same key, their original order is preserved.
 
+.. doctest::
+
     >>> data = [('red', 1), ('blue', 1), ('red', 2), ('blue', 2)]
     >>> sorted(data, key=itemgetter(0))
     [('blue', 1), ('blue', 2), ('red', 1), ('red', 2)]
@@ -143,6 +163,8 @@
 steps. For example, to sort the student data by descending *grade* and then
 ascending *age*, do the *age* sort first and then sort again using *grade*:
 
+.. doctest::
+
     >>> s = sorted(student_objects, key=attrgetter('age'))     # sort on secondary key
     >>> sorted(s, key=attrgetter('grade'), reverse=True)       # now sort on primary key, descending
     [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]
@@ -150,6 +172,8 @@
 This can be abstracted out into a wrapper function that can take a list and
 tuples of field and order to sort them on multiple passes.
 
+.. doctest::
+
     >>> def multisort(xs, specs):
     ...     for key, reverse in reversed(specs):
     ...         xs.sort(key=attrgetter(key), reverse=reverse)
@@ -220,6 +244,8 @@
 return a negative value for less-than, return zero if they are equal, or return
 a positive value for greater-than. For example, we can do:
 
+.. doctest::
+
     >>> def numeric_compare(x, y):
     ...     return x - y
     >>> sorted([5, 2, 4, 1, 3], cmp=numeric_compare) # doctest: +SKIP
@@ -227,6 +253,8 @@
 
 Or you can reverse the order of comparison with:
 
+.. doctest::
+
     >>> def reverse_numeric(x, y):
     ...     return y - x
     >>> sorted([5, 2, 4, 1, 3], cmp=reverse_numeric) # doctest: +SKIP
@@ -234,7 +262,9 @@
 
 When porting code from Python 2.x to 3.x, the situation can arise when you have
 the user supplying a comparison function and you need to convert that to a key
-function. The following wrapper makes that easy to do::
+function. The following wrapper makes that easy to do:
+
+.. testcode::
 
     def cmp_to_key(mycmp):
         'Convert a cmp= function into a key= function'
@@ -255,6 +285,12 @@
                 return mycmp(self.obj, other.obj) != 0
         return K
 
+.. doctest::
+    :hide:
+
+    >>> sorted([5, 2, 4, 1, 3], key=cmp_to_key(reverse_numeric))
+    [5, 4, 3, 2, 1]
+
 To convert to a key function, just wrap the old comparison function:
 
 .. testsetup::
@@ -280,6 +316,8 @@
   simulated without the parameter by using the builtin :func:`reversed` function
   twice:
 
+  .. doctest::
+
     >>> data = [('red', 1), ('blue', 1), ('red', 2), ('blue', 2)]
     >>> standard_way = sorted(data, key=itemgetter(0), reverse=True)
     >>> double_reversed = list(reversed(sorted(reversed(data), key=itemgetter(0))))
@@ -289,7 +327,9 @@
 
 * The sort routines are guaranteed to use :meth:`__lt__` when making comparisons
   between two objects. So, it is easy to add a standard sort order to a class by
-  defining an :meth:`__lt__` method::
+  defining an :meth:`__lt__` method:
+
+  .. doctest::
 
     >>> Student.__lt__ = lambda self, other: self.age < other.age
     >>> sorted(student_objects)
@@ -300,6 +340,8 @@
   are stored in a dictionary, they can be used to sort a separate list of student
   names:
 
+  .. doctest::
+
     >>> students = ['dave', 'john', 'jane']
     >>> newgrades = {'john': 'F', 'jane':'A', 'dave': 'C'}
     >>> sorted(students, key=newgrades.__getitem__)
diff --git a/Doc/howto/unicode.rst b/Doc/howto/unicode.rst
index e948c1e..535b21b 100644
--- a/Doc/howto/unicode.rst
+++ b/Doc/howto/unicode.rst
@@ -609,9 +609,9 @@
 varies depending on the system.  Today Python is converging on using
 UTF-8: Python on MacOS has used UTF-8 for several versions, and Python
 3.6 switched to using UTF-8 on Windows as well.  On Unix systems,
-there will only be a filesystem encoding if you've set the ``LANG`` or
-``LC_CTYPE`` environment variables; if you haven't, the default
-encoding is again UTF-8.
+there will only be a :term:`filesystem encoding <filesystem encoding and error
+handler>`. if you've set the ``LANG`` or ``LC_CTYPE`` environment variables; if
+you haven't, the default encoding is again UTF-8.
 
 The :func:`sys.getfilesystemencoding` function returns the encoding to use on
 your current system, in case you want to do the encoding manually, but there's
@@ -633,8 +633,8 @@
 Unicode string as the path, filenames will be decoded using the filesystem's
 encoding and a list of Unicode strings will be returned, while passing a byte
 path will return the filenames as bytes.  For example,
-assuming the default filesystem encoding is UTF-8, running the following
-program::
+assuming the default :term:`filesystem encoding <filesystem encoding and error
+handler>` is UTF-8, running the following program::
 
    fn = 'filename\u4500abc'
    f = open(fn, 'w')
diff --git a/Doc/howto/urllib2.rst b/Doc/howto/urllib2.rst
index 046a88a..12d5257 100644
--- a/Doc/howto/urllib2.rst
+++ b/Doc/howto/urllib2.rst
@@ -97,7 +97,7 @@
 
 In the case of HTTP, there are two extra things that Request objects allow you
 to do: First, you can pass data to be sent to the server.  Second, you can pass
-extra information ("metadata") *about* the data or the about request itself, to
+extra information ("metadata") *about* the data or about the request itself, to
 the server - this information is sent as HTTP "headers".  Let's look at each of
 these in turn.
 
diff --git a/Doc/includes/sqlite3/countcursors.py b/Doc/includes/sqlite3/countcursors.py
deleted file mode 100644
index 112f477..0000000
--- a/Doc/includes/sqlite3/countcursors.py
+++ /dev/null
@@ -1,17 +0,0 @@
-import sqlite3
-
-class CountCursorsConnection(sqlite3.Connection):
-    def __init__(self, *args, **kwargs):
-        sqlite3.Connection.__init__(self, *args, **kwargs)
-        self.numcursors = 0
-
-    def cursor(self, *args, **kwargs):
-        self.numcursors += 1
-        return sqlite3.Connection.cursor(self, *args, **kwargs)
-
-con = sqlite3.connect(":memory:", factory=CountCursorsConnection)
-cur1 = con.cursor()
-cur2 = con.cursor()
-print(con.numcursors)
-
-con.close()
diff --git a/Doc/includes/sqlite3/createdb.py b/Doc/includes/sqlite3/createdb.py
deleted file mode 100644
index ee2950b..0000000
--- a/Doc/includes/sqlite3/createdb.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# Not referenced from the documentation, but builds the database file the other
-# code snippets expect.
-
-import sqlite3
-import os
-
-DB_FILE = "mydb"
-
-if os.path.exists(DB_FILE):
-    os.remove(DB_FILE)
-
-con = sqlite3.connect(DB_FILE)
-cur = con.cursor()
-cur.execute("""
-        create table people
-        (
-          name_last      varchar(20),
-          age            integer
-        )
-        """)
-
-cur.execute("insert into people (name_last, age) values ('Yeltsin',   72)")
-cur.execute("insert into people (name_last, age) values ('Putin',     51)")
-
-con.commit()
-
-cur.close()
-con.close()
diff --git a/Doc/includes/sqlite3/ctx_manager.py b/Doc/includes/sqlite3/ctx_manager.py
index 6db77d4..2e1175e 100644
--- a/Doc/includes/sqlite3/ctx_manager.py
+++ b/Doc/includes/sqlite3/ctx_manager.py
@@ -1,19 +1,19 @@
 import sqlite3
 
 con = sqlite3.connect(":memory:")
-con.execute("create table person (id integer primary key, firstname varchar unique)")
+con.execute("create table lang (id integer primary key, name varchar unique)")
 
 # Successful, con.commit() is called automatically afterwards
 with con:
-    con.execute("insert into person(firstname) values (?)", ("Joe",))
+    con.execute("insert into lang(name) values (?)", ("Python",))
 
 # con.rollback() is called after the with block finishes with an exception, the
 # exception is still raised and must be caught
 try:
     with con:
-        con.execute("insert into person(firstname) values (?)", ("Joe",))
+        con.execute("insert into lang(name) values (?)", ("Python",))
 except sqlite3.IntegrityError:
-    print("couldn't add Joe twice")
+    print("couldn't add Python twice")
 
 # Connection object used as context manager only commits or rollbacks transactions,
 # so the connection object should be closed manually
diff --git a/Doc/includes/sqlite3/execsql_fetchonerow.py b/Doc/includes/sqlite3/execsql_fetchonerow.py
deleted file mode 100644
index 115bcb5..0000000
--- a/Doc/includes/sqlite3/execsql_fetchonerow.py
+++ /dev/null
@@ -1,19 +0,0 @@
-import sqlite3
-
-con = sqlite3.connect("mydb")
-
-cur = con.cursor()
-SELECT = "select name_last, age from people order by age, name_last"
-
-# 1. Iterate over the rows available from the cursor, unpacking the
-# resulting sequences to yield their elements (name_last, age):
-cur.execute(SELECT)
-for (name_last, age) in cur:
-    print('%s is %d years old.' % (name_last, age))
-
-# 2. Equivalently:
-cur.execute(SELECT)
-for row in cur:
-    print('%s is %d years old.' % (row[0], row[1]))
-
-con.close()
diff --git a/Doc/includes/sqlite3/execsql_printall_1.py b/Doc/includes/sqlite3/execsql_printall_1.py
deleted file mode 100644
index 19306e6..0000000
--- a/Doc/includes/sqlite3/execsql_printall_1.py
+++ /dev/null
@@ -1,15 +0,0 @@
-import sqlite3
-
-# Create a connection to the database file "mydb":
-con = sqlite3.connect("mydb")
-
-# Get a Cursor object that operates in the context of Connection con:
-cur = con.cursor()
-
-# Execute the SELECT statement:
-cur.execute("select * from people order by age")
-
-# Retrieve all rows as a sequence and print that sequence:
-print(cur.fetchall())
-
-con.close()
diff --git a/Doc/includes/sqlite3/execute_1.py b/Doc/includes/sqlite3/execute_1.py
index 3466b12..ee0000e 100644
--- a/Doc/includes/sqlite3/execute_1.py
+++ b/Doc/includes/sqlite3/execute_1.py
@@ -2,17 +2,21 @@
 
 con = sqlite3.connect(":memory:")
 cur = con.cursor()
-cur.execute("create table people (name_last, age)")
-
-who = "Yeltsin"
-age = 72
+cur.execute("create table lang (name, first_appeared)")
 
 # This is the qmark style:
-cur.execute("insert into people values (?, ?)", (who, age))
+cur.execute("insert into lang values (?, ?)", ("C", 1972))
+
+# The qmark style used with executemany():
+lang_list = [
+    ("Fortran", 1957),
+    ("Python", 1991),
+    ("Go", 2009),
+]
+cur.executemany("insert into lang values (?, ?)", lang_list)
 
 # And this is the named style:
-cur.execute("select * from people where name_last=:who and age=:age", {"who": who, "age": age})
-
-print(cur.fetchone())
+cur.execute("select * from lang where first_appeared=:year", {"year": 1972})
+print(cur.fetchall())
 
 con.close()
diff --git a/Doc/includes/sqlite3/insert_more_people.py b/Doc/includes/sqlite3/insert_more_people.py
deleted file mode 100644
index 10cf937..0000000
--- a/Doc/includes/sqlite3/insert_more_people.py
+++ /dev/null
@@ -1,18 +0,0 @@
-import sqlite3
-
-con = sqlite3.connect("mydb")
-
-cur = con.cursor()
-
-newPeople = (
-    ('Lebed'       , 53),
-    ('Zhirinovsky' , 57),
-  )
-
-for person in newPeople:
-    cur.execute("insert into people (name_last, age) values (?, ?)", person)
-
-# The changes will not be saved unless the transaction is committed explicitly:
-con.commit()
-
-con.close()
diff --git a/Doc/includes/sqlite3/parse_colnames.py b/Doc/includes/sqlite3/parse_colnames.py
deleted file mode 100644
index 5f01dbf..0000000
--- a/Doc/includes/sqlite3/parse_colnames.py
+++ /dev/null
@@ -1,10 +0,0 @@
-import sqlite3
-import datetime
-
-con = sqlite3.connect(":memory:", detect_types=sqlite3.PARSE_COLNAMES)
-cur = con.cursor()
-cur.execute('select ? as "x [timestamp]"', (datetime.datetime.now(),))
-dt = cur.fetchone()[0]
-print(dt, type(dt))
-
-con.close()
diff --git a/Doc/includes/sqlite3/shared_cache.py b/Doc/includes/sqlite3/shared_cache.py
deleted file mode 100644
index 30e71c9..0000000
--- a/Doc/includes/sqlite3/shared_cache.py
+++ /dev/null
@@ -1,6 +0,0 @@
-import sqlite3
-
-# The shared cache is only available in SQLite versions 3.3.3 or later
-# See the SQLite documentation for details.
-
-sqlite3.enable_shared_cache(True)
diff --git a/Doc/includes/sqlite3/shortcut_methods.py b/Doc/includes/sqlite3/shortcut_methods.py
index 98a3941..48ea6fa 100644
--- a/Doc/includes/sqlite3/shortcut_methods.py
+++ b/Doc/includes/sqlite3/shortcut_methods.py
@@ -1,23 +1,23 @@
 import sqlite3
 
-persons = [
-    ("Hugo", "Boss"),
-    ("Calvin", "Klein")
-    ]
+langs = [
+    ("C++", 1985),
+    ("Objective-C", 1984),
+]
 
 con = sqlite3.connect(":memory:")
 
 # Create the table
-con.execute("create table person(firstname, lastname)")
+con.execute("create table lang(name, first_appeared)")
 
 # Fill the table
-con.executemany("insert into person(firstname, lastname) values (?, ?)", persons)
+con.executemany("insert into lang(name, first_appeared) values (?, ?)", langs)
 
 # Print the table contents
-for row in con.execute("select firstname, lastname from person"):
+for row in con.execute("select name, first_appeared from lang"):
     print(row)
 
-print("I just deleted", con.execute("delete from person").rowcount, "rows")
+print("I just deleted", con.execute("delete from lang").rowcount, "rows")
 
 # close is not a shortcut method and it's not called automatically,
 # so the connection object should be closed manually
diff --git a/Doc/includes/sqlite3/simple_tableprinter.py b/Doc/includes/sqlite3/simple_tableprinter.py
deleted file mode 100644
index 148a170..0000000
--- a/Doc/includes/sqlite3/simple_tableprinter.py
+++ /dev/null
@@ -1,28 +0,0 @@
-import sqlite3
-
-FIELD_MAX_WIDTH = 20
-TABLE_NAME = 'people'
-SELECT = 'select * from %s order by age, name_last' % TABLE_NAME
-
-con = sqlite3.connect("mydb")
-
-cur = con.cursor()
-cur.execute(SELECT)
-
-# Print a header.
-for fieldDesc in cur.description:
-    print(fieldDesc[0].ljust(FIELD_MAX_WIDTH), end=' ')
-print() # Finish the header with a newline.
-print('-' * 78)
-
-# For each row, print the value of each field left-justified within
-# the maximum possible width of that field.
-fieldIndices = range(len(cur.description))
-for row in cur:
-    for fieldIndex in fieldIndices:
-        fieldValue = str(row[fieldIndex])
-        print(fieldValue.ljust(FIELD_MAX_WIDTH), end=' ')
-
-    print() # Finish the row with a newline.
-
-con.close()
diff --git a/Doc/includes/sqlite3/text_factory.py b/Doc/includes/sqlite3/text_factory.py
index a857a15..c0d87cd 100644
--- a/Doc/includes/sqlite3/text_factory.py
+++ b/Doc/includes/sqlite3/text_factory.py
@@ -3,9 +3,9 @@
 con = sqlite3.connect(":memory:")
 cur = con.cursor()
 
-AUSTRIA = "\xd6sterreich"
+AUSTRIA = "Österreich"
 
-# by default, rows are returned as Unicode
+# by default, rows are returned as str
 cur.execute("select ?", (AUSTRIA,))
 row = cur.fetchone()
 assert row[0] == AUSTRIA
diff --git a/Doc/includes/typestruct.h b/Doc/includes/typestruct.h
index 9ada03c..02f8ccf 100644
--- a/Doc/includes/typestruct.h
+++ b/Doc/includes/typestruct.h
@@ -35,12 +35,14 @@
 
     const char *tp_doc; /* Documentation string */
 
+    /* Assigned meaning in release 2.0 */
     /* call function for all accessible objects */
     traverseproc tp_traverse;
 
     /* delete references to contained objects */
     inquiry tp_clear;
 
+    /* Assigned meaning in release 2.1 */
     /* rich comparisons */
     richcmpfunc tp_richcompare;
 
@@ -55,6 +57,7 @@
     struct PyMethodDef *tp_methods;
     struct PyMemberDef *tp_members;
     struct PyGetSetDef *tp_getset;
+    // Strong reference on a heap type, borrowed reference on a static type
     struct _typeobject *tp_base;
     PyObject *tp_dict;
     descrgetfunc tp_descr_get;
@@ -76,5 +79,5 @@
     unsigned int tp_version_tag;
 
     destructor tp_finalize;
-
+    vectorcallfunc tp_vectorcall;
 } PyTypeObject;
diff --git a/Doc/install/index.rst b/Doc/install/index.rst
index e6d5a3e..7f7be11 100644
--- a/Doc/install/index.rst
+++ b/Doc/install/index.rst
@@ -10,6 +10,13 @@
 
 .. TODO: Fill in XXX comments
 
+.. note::
+
+   The entire ``distutils`` package has been deprecated and will be
+   removed in Python 3.12. This documentation is retained as a
+   reference only, and will be removed with the package. See the
+   :ref:`What's New <distutils-deprecated>` entry for more information.
+
 .. seealso::
 
    :ref:`installing-index`
@@ -199,7 +206,7 @@
 If you don't choose an installation directory---i.e., if you just run ``setup.py
 install``\ ---then the :command:`install` command installs to the standard
 location for third-party Python modules.  This location varies by platform and
-by how you built/installed Python itself.  On Unix (and Mac OS X, which is also
+by how you built/installed Python itself.  On Unix (and macOS, which is also
 Unix-based), it also depends on whether the module distribution being installed
 is pure Python or contains extensions ("non-pure"):
 
@@ -229,7 +236,7 @@
 
 :file:`{prefix}` and :file:`{exec-prefix}` stand for the directories that Python
 is installed to, and where it finds its libraries at run-time.  They are always
-the same under Windows, and very often the same under Unix and Mac OS X.  You
+the same under Windows, and very often the same under Unix and macOS.  You
 can find out what your Python installation uses for :file:`{prefix}` and
 :file:`{exec-prefix}` by running Python in interactive mode and typing a few
 simple commands. Under Unix, just type ``python`` at the shell prompt.  Under
@@ -305,7 +312,7 @@
 Files will be installed into subdirectories of :data:`site.USER_BASE` (written
 as :file:`{userbase}` hereafter).  This scheme installs pure Python modules and
 extension modules in the same location (also known as :data:`site.USER_SITE`).
-Here are the values for UNIX, including Mac OS X:
+Here are the values for UNIX, including macOS:
 
 =============== ===========================================================
 Type of file    Installation directory
@@ -728,7 +735,7 @@
 ----------------------------------
 
 The names and locations of the configuration files vary slightly across
-platforms.  On Unix and Mac OS X, the three configuration files (in the order
+platforms.  On Unix and macOS, the three configuration files (in the order
 they are processed) are:
 
 +--------------+----------------------------------------------------------+-------+
@@ -946,7 +953,7 @@
 This subsection describes the necessary steps to use Distutils with the Borland
 C++ compiler version 5.5.  First you have to know that Borland's object file
 format (OMF) is different from the format used by the Python version you can
-download from the Python or ActiveState Web site.  (Python is built with
+download from the Python or ActiveState web site.  (Python is built with
 Microsoft Visual C++, which uses COFF as the object file format.) For this
 reason you have to convert Python's library :file:`python25.lib` into the
 Borland format.  You can do this as follows:
@@ -1064,8 +1071,7 @@
 .. [#] This also means you could replace all existing COFF-libraries with OMF-libraries
    of the same name.
 
-.. [#] Check https://www.sourceware.org/cygwin/ and http://www.mingw.org/ for more
-   information
+.. [#] Check https://www.sourceware.org/cygwin/ for more information
 
 .. [#] Then you have no POSIX emulation available, but you also don't need
    :file:`cygwin1.dll`.
diff --git a/Doc/installing/index.rst b/Doc/installing/index.rst
index 31e9b0b..4bacc7b 100644
--- a/Doc/installing/index.rst
+++ b/Doc/installing/index.rst
@@ -44,7 +44,7 @@
   ``venv``. It allows virtual environments to be used on versions of
   Python prior to 3.4, which either don't provide ``venv`` at all, or
   aren't able to automatically install ``pip`` into created environments.
-* The `Python Packaging Index <https://pypi.org>`__ is a public
+* The `Python Package Index <https://pypi.org>`__ is a public
   repository of open source licensed packages made available for use by
   other Python users.
 * the `Python Packaging Authority
@@ -78,13 +78,13 @@
 line.
 
 The following command will install the latest version of a module and its
-dependencies from the Python Packaging Index::
+dependencies from the Python Package Index::
 
     python -m pip install SomePackage
 
 .. note::
 
-   For POSIX users (including Mac OS X and Linux users), the examples in
+   For POSIX users (including macOS and Linux users), the examples in
    this guide assume the use of a :term:`virtual environment`.
 
    For Windows users, the examples in this guide assume that the option to
@@ -163,7 +163,7 @@
 ... work with multiple versions of Python installed in parallel?
 ----------------------------------------------------------------
 
-On Linux, Mac OS X, and other POSIX systems, use the versioned Python commands
+On Linux, macOS, and other POSIX systems, use the versioned Python commands
 in combination with the ``-m`` switch to run the appropriate copy of
 ``pip``::
 
@@ -225,8 +225,8 @@
 the installation process.
 
 With the introduction of support for the binary ``wheel`` format, and the
-ability to publish wheels for at least Windows and Mac OS X through the
-Python Packaging Index, this problem is expected to diminish over time,
+ability to publish wheels for at least Windows and macOS through the
+Python Package Index, this problem is expected to diminish over time,
 as users are more regularly able to install pre-built extensions rather
 than needing to build them themselves.
 
diff --git a/Doc/library/2to3.rst b/Doc/library/2to3.rst
index 1d7bd26..5e1b010 100644
--- a/Doc/library/2to3.rst
+++ b/Doc/library/2to3.rst
@@ -333,7 +333,8 @@
 
 .. 2to3fixer:: nonzero
 
-   Renames :meth:`__nonzero__` to :meth:`~object.__bool__`.
+   Renames definitions of methods called :meth:`__nonzero__`
+   to :meth:`~object.__bool__`.
 
 .. 2to3fixer:: numliterals
 
@@ -464,12 +465,15 @@
 
 --------------
 
-.. deprecated:: 3.10
-   Python 3.9 will switch to a PEG parser (see :pep:`617`), and Python 3.10 may
-   include new language syntax that is not parsable by lib2to3's LL(1) parser.
-   The ``lib2to3`` module may be removed from the standard library in a future
-   Python version. Consider third-party alternatives such as `LibCST`_ or
-   `parso`_.
+.. deprecated-removed:: 3.11 3.13
+   Python 3.9 switched to a PEG parser (see :pep:`617`) while lib2to3 is
+   using a less flexible LL(1) parser.  Python 3.10 includes new language
+   syntax that is not parsable by lib2to3's LL(1) parser (see :pep:`634`).
+   The ``lib2to3`` module was marked pending for deprecation in Python 3.9
+   (raising :exc:`PendingDeprecationWarning` on import) and fully deprecated
+   in Python 3.11 (raising :exc:`DeprecationWarning`).
+   It will be removed from the standard library in Python 3.13.
+   Consider third-party alternatives such as `LibCST`_ or `parso`_.
 
 .. note::
 
diff --git a/Doc/library/__future__.rst b/Doc/library/__future__.rst
index 4139994..24bbd90 100644
--- a/Doc/library/__future__.rst
+++ b/Doc/library/__future__.rst
@@ -90,7 +90,7 @@
 | generator_stop   | 3.5.0b1     | 3.7          | :pep:`479`:                                 |
 |                  |             |              | *StopIteration handling inside generators*  |
 +------------------+-------------+--------------+---------------------------------------------+
-| annotations      | 3.7.0b1     | 3.10         | :pep:`563`:                                 |
+| annotations      | 3.7.0b1     | 3.11         | :pep:`563`:                                 |
 |                  |             |              | *Postponed evaluation of annotations*       |
 +------------------+-------------+--------------+---------------------------------------------+
 
diff --git a/Doc/library/__main__.rst b/Doc/library/__main__.rst
index a64faf1..d0a65e7 100644
--- a/Doc/library/__main__.rst
+++ b/Doc/library/__main__.rst
@@ -1,25 +1,368 @@
-
-:mod:`__main__` --- Top-level script environment
-================================================
+:mod:`__main__` --- Top-level code environment
+==============================================
 
 .. module:: __main__
-   :synopsis: The environment where the top-level script is run.
+   :synopsis: The environment where top-level code is run. Covers command-line
+              interfaces, import-time behavior, and ``__name__ == '__main__'``.
 
 --------------
 
-``'__main__'`` is the name of the scope in which top-level code executes.
-A module's __name__ is set equal to ``'__main__'`` when read from
-standard input, a script, or from an interactive prompt.
+In Python, the special name ``__main__`` is used for two important constructs:
 
-A module can discover whether or not it is running in the main scope by
-checking its own ``__name__``, which allows a common idiom for conditionally
-executing code in a module when it is run as a script or with ``python
--m`` but not when it is imported::
+1. the name of the top-level environment of the program, which can be
+   checked using the ``__name__ == '__main__'`` expression; and
+2. the ``__main__.py`` file in Python packages.
 
-   if __name__ == "__main__":
-       # execute only if run as a script
-       main()
+Both of these mechanisms are related to Python modules; how users interact with
+them and how they interact with each other.  They are explained in detail
+below.  If you're new to Python modules, see the tutorial section
+:ref:`tut-modules` for an introduction.
 
-For a package, the same effect can be achieved by including a
-``__main__.py`` module, the contents of which will be executed when the
-module is run with ``-m``.
+
+.. _name_equals_main:
+
+``__name__ == '__main__'``
+---------------------------
+
+When a Python module or package is imported, ``__name__`` is set to the
+module's name.  Usually, this is the name of the Python file itself without the
+``.py`` extension::
+
+    >>> import configparser
+    >>> configparser.__name__
+    'configparser'
+
+If the file is part of a package, ``__name__`` will also include the parent
+package's path::
+
+    >>> from concurrent.futures import process
+    >>> process.__name__
+    'concurrent.futures.process'
+
+However, if the module is executed in the top-level code environment,
+its ``__name__`` is set to the string ``'__main__'``.
+
+What is the "top-level code environment"?
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+``__main__`` is the name of the environment where top-level code is run.
+"Top-level code" is the first user-specified Python module that starts running.
+It's "top-level" because it imports all other modules that the program needs.
+Sometimes "top-level code" is called an *entry point* to the application.
+
+The top-level code environment can be:
+
+* the scope of an interactive prompt::
+
+    >>> __name__
+    '__main__'
+
+* the Python module passed to the Python interpreter as a file argument:
+
+    .. code-block:: shell-session
+
+       $ python3 helloworld.py
+       Hello, world!
+
+* the Python module or package passed to the Python interpreter with the
+  :option:`-m` argument:
+
+    .. code-block:: shell-session
+
+       $ python3 -m tarfile
+       usage: tarfile.py [-h] [-v] (...)
+
+* Python code read by the Python interpreter from standard input:
+
+    .. code-block:: shell-session
+
+       $ echo "import this" | python3
+       The Zen of Python, by Tim Peters
+
+       Beautiful is better than ugly.
+       Explicit is better than implicit.
+       ...
+
+* Python code passed to the Python interpreter with the :option:`-c` argument:
+
+    .. code-block:: shell-session
+
+       $ python3 -c "import this"
+       The Zen of Python, by Tim Peters
+
+       Beautiful is better than ugly.
+       Explicit is better than implicit.
+       ...
+
+In each of these situations, the top-level module's ``__name__`` is set to
+``'__main__'``.
+
+As a result, a module can discover whether or not it is running in the
+top-level environment by checking its own ``__name__``, which allows a common
+idiom for conditionally executing code when the module is not initialized from
+an import statement::
+
+    if __name__ == '__main__':
+        # Execute when the module is not initialized from an import statement.
+        ...
+
+.. seealso::
+
+   For a more detailed look at how ``__name__`` is set in all situations, see
+   the tutorial section :ref:`tut-modules`.
+
+
+Idiomatic Usage
+^^^^^^^^^^^^^^^
+
+Some modules contain code that is intended for script use only, like parsing
+command-line arguments or fetching data from standard input.  If a module
+like this was imported from a different module, for example to unit test
+it, the script code would unintentionally execute as well.
+
+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___ ==
+'__main__'`` can improve code clarity and correctness. Most often, a function
+named ``main`` encapsulates the program's primary behavior::
+
+    # echo.py
+
+    import shlex
+    import sys
+
+    def echo(phrase: str) -> None:
+       """A dummy wrapper around print."""
+       # for demonstration purposes, you can imagine that there is some
+       # valuable and reusable logic inside this function
+       print(phrase)
+
+    def main() -> int:
+        """Echo the input arguments to standard output"""
+        phrase = shlex.join(sys.argv)
+        echo(phrase)
+        return 0
+
+    if __name__ == '__main__':
+        sys.exit(main())  # next section explains the use of sys.exit
+
+Note that if the module didn't encapsulate code inside the ``main`` function
+but instead put it directly within the ``if __name__ == '__main__'`` block,
+the ``phrase`` variable would be global to the entire module.  This is
+error-prone as other functions within the module could be unintentionally using
+the global variable instead of a local name.  A ``main`` function solves this
+problem.
+
+Using a ``main`` function has the added benefit of the ``echo`` function itself
+being isolated and importable elsewhere. When ``echo.py`` is imported, the
+``echo`` and ``main`` functions will be defined, but neither of them will be
+called, because ``__name__ != '__main__'``.
+
+
+Packaging Considerations
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+``main`` functions are often used to create command-line tools by specifying
+them as entry points for console scripts.  When this is done,
+`pip <https://pip.pypa.io/>`_ inserts the function call into a template script,
+where the return value of ``main`` is passed into :func:`sys.exit`.
+For example::
+
+    sys.exit(main())
+
+Since the call to ``main`` is wrapped in :func:`sys.exit`, the expectation is
+that your function will return some value acceptable as an input to
+:func:`sys.exit`; typically, an integer or ``None`` (which is implicitly
+returned if your function does not have a return statement).
+
+By proactively following this convention ourselves, our module will have the
+same behavior when run directly (i.e. ``python3 echo.py``) as it will have if
+we later package it as a console script entry-point in a pip-installable
+package.
+
+In particular, be careful about returning strings from your ``main`` function.
+:func:`sys.exit` will interpret a string argument as a failure message, so
+your program will have an exit code of ``1``, indicating failure, and the
+string will be written to :data:`sys.stderr`.  The ``echo.py`` example from
+earlier exemplifies using the ``sys.exit(main())`` convention.
+
+.. seealso::
+
+   `Python Packaging User Guide <https://packaging.python.org/>`_
+   contains a collection of tutorials and references on how to distribute and
+   install Python packages with modern tools.
+
+
+``__main__.py`` in Python Packages
+----------------------------------
+
+If you are not familiar with Python packages, see section :ref:`tut-packages`
+of the tutorial.  Most commonly, the ``__main__.py`` file is used to provide
+a command-line interface for a package. Consider the following hypothetical
+package, "bandclass":
+
+.. code-block:: text
+
+   bandclass
+     ├── __init__.py
+     ├── __main__.py
+     └── student.py
+
+``__main__.py`` will be executed when the package itself is invoked
+directly from the command line using the :option:`-m` flag. For example:
+
+.. code-block:: shell-session
+
+   $ python3 -m bandclass
+
+This command will cause ``__main__.py`` to run. How you utilize this mechanism
+will depend on the nature of the package you are writing, but in this
+hypothetical case, it might make sense to allow the teacher to search for
+students::
+
+    # bandclass/__main__.py
+
+    import sys
+    from .student import search_students
+
+    student_name = sys.argv[2] if len(sys.argv) >= 2 else ''
+    print(f'Found student: {search_students(student_name)}')
+
+Note that ``from .student import search_students`` is an example of a relative
+import.  This import style can be used when referencing modules within a
+package.  For more details, see :ref:`intra-package-references` in the
+:ref:`tut-modules` section of the tutorial.
+
+Idiomatic Usage
+^^^^^^^^^^^^^^^
+
+The contents of ``__main__.py`` typically isn't fenced with
+``if __name__ == '__main__'`` blocks.  Instead, those files are kept short,
+functions to execute from other modules.  Those other modules can then be
+easily unit-tested and are properly reusable.
+
+If used, an ``if __name__ == '__main__'`` block will still work as expected
+for a ``__main__.py`` file within a package, because its ``__name__``
+attribute will include the package's path if imported::
+
+    >>> import asyncio.__main__
+    >>> asyncio.__main__.__name__
+    'asyncio.__main__'
+
+This won't work for ``__main__.py`` files in the root directory of a .zip file
+though.  Hence, for consistency, minimal ``__main__.py`` like the :mod:`venv`
+one mentioned below are preferred.
+
+.. seealso::
+
+   See :mod:`venv` for an example of a package with a minimal ``__main__.py``
+   in the standard library. It doesn't contain a ``if __name__ == '__main__'``
+   block. You can invoke it with ``python3 -m venv [directory]``.
+
+   See :mod:`runpy` for more details on the :option:`-m` flag to the
+   interpreter executable.
+
+   See :mod:`zipapp` for how to run applications packaged as *.zip* files. In
+   this case Python looks for a ``__main__.py`` file in the root directory of
+   the archive.
+
+
+
+``import __main__``
+-------------------
+
+Regardless of which module a Python program was started with, other modules
+running within that same program can import the top-level environment's scope
+(:term:`namespace`) by importing the ``__main__`` module.  This doesn't import
+a ``__main__.py`` file but rather whichever module that received the special
+name ``'__main__'``.
+
+Here is an example module that consumes the ``__main__`` namespace::
+
+    # namely.py
+
+    import __main__
+
+    def did_user_define_their_name():
+        return 'my_name' in dir(__main__)
+
+    def print_user_name():
+        if not did_user_define_their_name():
+            raise ValueError('Define the variable `my_name`!')
+
+        if '__file__' in dir(__main__):
+            print(__main__.my_name, "found in file", __main__.__file__)
+        else:
+            print(__main__.my_name)
+
+Example usage of this module could be as follows::
+
+    # start.py
+
+    import sys
+
+    from namely import print_user_name
+
+    # my_name = "Dinsdale"
+
+    def main():
+        try:
+            print_user_name()
+        except ValueError as ve:
+            return str(ve)
+
+    if __name__ == "__main__":
+        sys.exit(main())
+
+Now, if we started our program, the result would look like this:
+
+.. code-block:: shell-session
+
+   $ python3 start.py
+   Define the variable `my_name`!
+
+The exit code of the program would be 1, indicating an error. Uncommenting the
+line with ``my_name = "Dinsdale"`` fixes the program and now it exits with
+status code 0, indicating success:
+
+.. code-block:: shell-session
+
+   $ python3 start.py
+   Dinsdale found in file /path/to/start.py
+
+Note that importing ``__main__`` doesn't cause any issues with unintentionally
+running top-level code meant for script use which is put in the
+``if __name__ == "__main__"`` block of the ``start`` module. Why does this work?
+
+Python inserts an empty ``__main__`` module in :attr:`sys.modules` at
+interpreter startup, and populates it by running top-level code. In our example
+this is the ``start`` module which runs line by line and imports ``namely``.
+In turn, ``namely`` imports ``__main__`` (which is really ``start``). That's an
+import cycle! Fortunately, since the partially populated ``__main__``
+module is present in :attr:`sys.modules`, Python passes that to ``namely``.
+See :ref:`Special considerations for __main__ <import-dunder-main>` in the
+import system's reference for details on how this works.
+
+The Python REPL is another example of a "top-level environment", so anything
+defined in the REPL becomes part of the ``__main__`` scope::
+
+    >>> import namely
+    >>> namely.did_user_define_their_name()
+    False
+    >>> namely.print_user_name()
+    Traceback (most recent call last):
+    ...
+    ValueError: Define the variable `my_name`!
+    >>> my_name = 'Jabberwocky'
+    >>> namely.did_user_define_their_name()
+    True
+    >>> namely.print_user_name()
+    Jabberwocky
+
+Note that in this case the ``__main__`` scope doesn't contain a ``__file__``
+attribute as it's interactive.
+
+The ``__main__`` scope is used in the implementation of :mod:`pdb` and
+:mod:`rlcompleter`.
diff --git a/Doc/library/_thread.rst b/Doc/library/_thread.rst
index bd653ab..1e6452b 100644
--- a/Doc/library/_thread.rst
+++ b/Doc/library/_thread.rst
@@ -61,15 +61,27 @@
       :func:`sys.unraisablehook` is now used to handle unhandled exceptions.
 
 
-.. function:: interrupt_main()
+.. function:: interrupt_main(signum=signal.SIGINT, /)
 
-   Simulate the effect of a :data:`signal.SIGINT` signal arriving in the main
-   thread. A thread can use this function to interrupt the main thread.
+   Simulate the effect of a signal arriving in the main thread.
+   A thread can use this function to interrupt the main thread, though
+   there is no guarantee that the interruption will happen immediately.
 
-   If :data:`signal.SIGINT` isn't handled by Python (it was set to
+   If given, *signum* is the number of the signal to simulate.
+   If *signum* is not given, :data:`signal.SIGINT` is simulated.
+
+   If the given signal isn't handled by Python (it was set to
    :data:`signal.SIG_DFL` or :data:`signal.SIG_IGN`), this function does
    nothing.
 
+   .. versionchanged:: 3.10
+      The *signum* argument is added to customize the signal number.
+
+   .. note::
+      This does not emit the corresponding signal but schedules a call to
+      the associated handler (if it exists).
+      If you want to truly emit the signal, use :func:`signal.raise_signal`.
+
 
 .. function:: exit()
 
diff --git a/Doc/library/abc.rst b/Doc/library/abc.rst
index 424ae54..3b74622 100644
--- a/Doc/library/abc.rst
+++ b/Doc/library/abc.rst
@@ -174,10 +174,11 @@
    to declare abstract methods for properties and descriptors.
 
    Dynamically adding abstract methods to a class, or attempting to modify the
-   abstraction status of a method or class once it is created, are not
-   supported.  The :func:`abstractmethod` only affects subclasses derived using
-   regular inheritance; "virtual subclasses" registered with the ABC's
-   :meth:`register` method are not affected.
+   abstraction status of a method or class once it is created, are only
+   supported using the :func:`update_abstractmethods` function.  The
+   :func:`abstractmethod` only affects subclasses derived using regular
+   inheritance; "virtual subclasses" registered with the ABC's :meth:`register`
+   method are not affected.
 
    When :func:`abstractmethod` is applied in combination with other method
    descriptors, it should be applied as the innermost decorator, as shown in
@@ -185,15 +186,15 @@
 
       class C(ABC):
           @abstractmethod
-          def my_abstract_method(self, ...):
+          def my_abstract_method(self, arg1):
               ...
           @classmethod
           @abstractmethod
-          def my_abstract_classmethod(cls, ...):
+          def my_abstract_classmethod(cls, arg2):
               ...
           @staticmethod
           @abstractmethod
-          def my_abstract_staticmethod(...):
+          def my_abstract_staticmethod(arg3):
               ...
 
           @property
@@ -235,7 +236,6 @@
       super-call in a framework that uses cooperative
       multiple-inheritance.
 
-
 The :mod:`abc` module also supports the following legacy decorators:
 
 .. decorator:: abstractclassmethod
@@ -255,7 +255,7 @@
       class C(ABC):
           @classmethod
           @abstractmethod
-          def my_abstract_classmethod(cls, ...):
+          def my_abstract_classmethod(cls, arg):
               ...
 
 
@@ -276,7 +276,7 @@
       class C(ABC):
           @staticmethod
           @abstractmethod
-          def my_abstract_staticmethod(...):
+          def my_abstract_staticmethod(arg):
               ...
 
 
@@ -335,6 +335,23 @@
 
    .. versionadded:: 3.4
 
+.. function:: update_abstractmethods(cls)
+
+   A function to recalculate an abstract class's abstraction status. This
+   function should be called if a class's abstract methods have been
+   implemented or changed after it was created. Usually, this function should
+   be called from within a class decorator.
+
+   Returns *cls*, to allow usage as a class decorator.
+
+   If *cls* is not an instance of :class:`ABCMeta`, does nothing.
+
+   .. note::
+
+      This function assumes that *cls*'s superclasses are already updated.
+      It does not update any subclasses.
+
+   .. versionadded:: 3.10
 
 .. rubric:: Footnotes
 
diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst
index 02cd70f..d853d2a 100644
--- a/Doc/library/argparse.rst
+++ b/Doc/library/argparse.rst
@@ -57,7 +57,7 @@
    positional arguments:
     N           an integer for the accumulator
 
-   optional arguments:
+   options:
     -h, --help  show this help message and exit
     --sum       sum the integers (default: find the max)
 
@@ -148,7 +148,8 @@
    as keyword arguments. Each parameter has its own more detailed description
    below, but in short they are:
 
-   * prog_ - The name of the program (default: ``sys.argv[0]``)
+   * prog_ - The name of the program (default:
+     ``os.path.basename(sys.argv[0])``)
 
    * usage_ - The string describing the program usage (default: generated from
      arguments added to parser)
@@ -217,14 +218,14 @@
    $ python myprogram.py --help
    usage: myprogram.py [-h] [--foo FOO]
 
-   optional arguments:
+   options:
     -h, --help  show this help message and exit
     --foo FOO   foo help
    $ cd ..
    $ python subdir/myprogram.py --help
    usage: myprogram.py [-h] [--foo FOO]
 
-   optional arguments:
+   options:
     -h, --help  show this help message and exit
     --foo FOO   foo help
 
@@ -235,7 +236,7 @@
    >>> parser.print_help()
    usage: myprogram [-h]
 
-   optional arguments:
+   options:
     -h, --help  show this help message and exit
 
 Note that the program name, whether determined from ``sys.argv[0]`` or from the
@@ -249,7 +250,7 @@
    >>> parser.print_help()
    usage: myprogram [-h] [--foo FOO]
 
-   optional arguments:
+   options:
     -h, --help  show this help message and exit
     --foo FOO   foo of the myprogram program
 
@@ -269,7 +270,7 @@
    positional arguments:
     bar          bar help
 
-   optional arguments:
+   options:
     -h, --help   show this help message and exit
     --foo [FOO]  foo help
 
@@ -284,7 +285,7 @@
    positional arguments:
     bar          bar help
 
-   optional arguments:
+   options:
     -h, --help   show this help message and exit
     --foo [FOO]  foo help
 
@@ -307,7 +308,7 @@
 
    A foo that bars
 
-   optional arguments:
+   options:
     -h, --help  show this help message and exit
 
 By default, the description will be line-wrapped so that it fits within the
@@ -329,7 +330,7 @@
 
    A foo that bars
 
-   optional arguments:
+   options:
     -h, --help  show this help message and exit
 
    And that's how you'd foo a bar
@@ -403,7 +404,7 @@
 
    this description was indented weird but that is okay
 
-   optional arguments:
+   options:
     -h, --help  show this help message and exit
 
    likewise for this epilog whose whitespace will be cleaned up and whose words
@@ -432,7 +433,7 @@
       exactly the way
       I want it
 
-   optional arguments:
+   options:
     -h, --help  show this help message and exit
 
 :class:`RawTextHelpFormatter` maintains whitespace for all sorts of help text,
@@ -454,7 +455,7 @@
    positional arguments:
     bar         BAR! (default: [1, 2, 3])
 
-   optional arguments:
+   options:
     -h, --help  show this help message and exit
     --foo FOO   FOO! (default: 42)
 
@@ -473,7 +474,7 @@
    positional arguments:
      float
 
-   optional arguments:
+   options:
      -h, --help  show this help message and exit
      --foo int
 
@@ -592,7 +593,7 @@
    >>> parser.print_help()
    usage: PROG [-h] [-f FOO] [--foo FOO]
 
-   optional arguments:
+   options:
     -h, --help  show this help message and exit
     -f FOO      old foo help
     --foo FOO   new foo help
@@ -623,7 +624,7 @@
    $ python myprogram.py --help
    usage: myprogram.py [-h] [--foo FOO]
 
-   optional arguments:
+   options:
     -h, --help  show this help message and exit
     --foo FOO   foo help
 
@@ -636,7 +637,7 @@
    >>> parser.print_help()
    usage: PROG [--foo FOO]
 
-   optional arguments:
+   options:
     --foo FOO  foo help
 
 The help option is typically ``-h/--help``. The exception to this is
@@ -649,7 +650,7 @@
    >>> parser.print_help()
    usage: PROG [+h]
 
-   optional arguments:
+   options:
      +h, ++help  show this help message and exit
 
 
@@ -659,7 +660,7 @@
 Normally, when you pass an invalid argument list to the :meth:`~ArgumentParser.parse_args`
 method of an :class:`ArgumentParser`, it will exit with error info.
 
-If the user would like catch errors manually, the feature can be enable by setting
+If the user would like to catch errors manually, the feature can be enabled by setting
 ``exit_on_error`` to ``False``::
 
    >>> parser = argparse.ArgumentParser(exit_on_error=False)
@@ -853,6 +854,8 @@
     >>> parser.parse_args(['--no-foo'])
     Namespace(foo=False)
 
+.. versionadded:: 3.9
+
 The recommended way to create a custom action is to extend :class:`Action`,
 overriding the ``__call__`` method and optionally the ``__init__`` and
 ``format_usage`` methods.
@@ -863,7 +866,7 @@
    ...     def __init__(self, option_strings, dest, nargs=None, **kwargs):
    ...         if nargs is not None:
    ...             raise ValueError("nargs not allowed")
-   ...         super(FooAction, self).__init__(option_strings, dest, **kwargs)
+   ...         super().__init__(option_strings, dest, **kwargs)
    ...     def __call__(self, parser, namespace, values, option_string=None):
    ...         print('%r %r %r' % (namespace, values, option_string))
    ...         setattr(namespace, self.dest, values)
@@ -1050,63 +1053,70 @@
 type
 ^^^^
 
-By default, :class:`ArgumentParser` objects read command-line arguments in as simple
+By default, the parser reads command-line arguments in as simple
 strings. However, quite often the command-line string should instead be
-interpreted as another type, like a :class:`float` or :class:`int`.  The
-``type`` keyword argument of :meth:`~ArgumentParser.add_argument` allows any
-necessary type-checking and type conversions to be performed.  Common built-in
-types and functions can be used directly as the value of the ``type`` argument::
+interpreted as another type, such as a :class:`float` or :class:`int`.  The
+``type`` keyword for :meth:`~ArgumentParser.add_argument` allows any
+necessary type-checking and type conversions to be performed.
 
-   >>> parser = argparse.ArgumentParser()
-   >>> parser.add_argument('foo', type=int)
-   >>> parser.add_argument('bar', type=open)
-   >>> parser.parse_args('2 temp.txt'.split())
-   Namespace(bar=<_io.TextIOWrapper name='temp.txt' encoding='UTF-8'>, foo=2)
+If the type_ keyword is used with the default_ keyword, the type converter
+is only applied if the default is a string.
 
-See the section on the default_ keyword argument for information on when the
-``type`` argument is applied to default arguments.
+The argument to ``type`` can be any callable that accepts a single string.
+If the function raises :exc:`ArgumentTypeError`, :exc:`TypeError`, or
+:exc:`ValueError`, the exception is caught and a nicely formatted error
+message is displayed.  No other exception types are handled.
 
-To ease the use of various types of files, the argparse module provides the
-factory FileType which takes the ``mode=``, ``bufsize=``, ``encoding=`` and
-``errors=`` arguments of the :func:`open` function.  For example,
-``FileType('w')`` can be used to create a writable file::
+Common built-in types and functions can be used as type converters:
 
-   >>> parser = argparse.ArgumentParser()
-   >>> parser.add_argument('bar', type=argparse.FileType('w'))
-   >>> parser.parse_args(['out.txt'])
-   Namespace(bar=<_io.TextIOWrapper name='out.txt' encoding='UTF-8'>)
+.. testcode::
 
-``type=`` can take any callable that takes a single string argument and returns
-the converted value::
+   import argparse
+   import pathlib
 
-   >>> def perfect_square(string):
-   ...     value = int(string)
-   ...     sqrt = math.sqrt(value)
-   ...     if sqrt != int(sqrt):
-   ...         msg = "%r is not a perfect square" % string
-   ...         raise argparse.ArgumentTypeError(msg)
-   ...     return value
+   parser = argparse.ArgumentParser()
+   parser.add_argument('count', type=int)
+   parser.add_argument('distance', type=float)
+   parser.add_argument('street', type=ascii)
+   parser.add_argument('code_point', type=ord)
+   parser.add_argument('source_file', type=open)
+   parser.add_argument('dest_file', type=argparse.FileType('w', encoding='latin-1'))
+   parser.add_argument('datapath', type=pathlib.Path)
+
+User defined functions can be used as well:
+
+.. doctest::
+
+   >>> def hyphenated(string):
+   ...     return '-'.join([word[:4] for word in string.casefold().split()])
    ...
-   >>> parser = argparse.ArgumentParser(prog='PROG')
-   >>> parser.add_argument('foo', type=perfect_square)
-   >>> parser.parse_args(['9'])
-   Namespace(foo=9)
-   >>> parser.parse_args(['7'])
-   usage: PROG [-h] foo
-   PROG: error: argument foo: '7' is not a perfect square
+   >>> parser = argparse.ArgumentParser()
+   >>> _ = parser.add_argument('short_title', type=hyphenated)
+   >>> parser.parse_args(['"The Tale of Two Cities"'])
+   Namespace(short_title='"the-tale-of-two-citi')
 
-The choices_ keyword argument may be more convenient for type checkers that
-simply check against a range of values::
+The :func:`bool` function is not recommended as a type converter.  All it does
+is convert empty strings to ``False`` and non-empty strings to ``True``.
+This is usually not what is desired.
 
-   >>> parser = argparse.ArgumentParser(prog='PROG')
-   >>> parser.add_argument('foo', type=int, choices=range(5, 10))
-   >>> parser.parse_args(['7'])
-   Namespace(foo=7)
-   >>> parser.parse_args(['11'])
-   usage: PROG [-h] {5,6,7,8,9}
-   PROG: error: argument foo: invalid choice: 11 (choose from 5, 6, 7, 8, 9)
+In general, the ``type`` keyword is a convenience that should only be used for
+simple conversions that can only raise one of the three supported exceptions.
+Anything with more interesting error-handling or resource management should be
+done downstream after the arguments are parsed.
 
-See the choices_ section for more details.
+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.
+
+Even :class:`~argparse.FileType` has its limitations for use with the ``type``
+keyword.  If one argument uses *FileType* and then a subsequent argument fails,
+an error is reported but the file is not automatically closed.  In this case, it
+would be better to wait until after the parser has run and then use the
+:keyword:`with`-statement to manage the files.
+
+For type checkers that simply check against a fixed set of values, consider
+using the choices_ keyword instead.
 
 
 choices
@@ -1145,6 +1155,11 @@
 Use of :class:`enum.Enum` is not recommended because it is difficult to
 control its appearance in usage, help, and error messages.
 
+Formatted choices overrides the default *metavar* which is normally derived
+from *dest*.  This is usually what you want because the user never sees the
+*dest* parameter.  If this display isn't desirable (perhaps because there are
+many choices), just specify an explicit metavar_.
+
 
 required
 ^^^^^^^^
@@ -1191,7 +1206,7 @@
    positional arguments:
     bar     one of the bars to be frobbled
 
-   optional arguments:
+   options:
     -h, --help  show this help message and exit
     --foo   foo the bars before frobbling
 
@@ -1209,7 +1224,7 @@
    positional arguments:
     bar     the bar to frobble (default: 42)
 
-   optional arguments:
+   options:
     -h, --help  show this help message and exit
 
 As the help string supports %-formatting, if you want a literal ``%`` to appear
@@ -1223,7 +1238,7 @@
    >>> parser.print_help()
    usage: frobble [-h]
 
-   optional arguments:
+   options:
      -h, --help  show this help message and exit
 
 
@@ -1250,7 +1265,7 @@
    positional arguments:
     bar
 
-   optional arguments:
+   options:
     -h, --help  show this help message and exit
     --foo FOO
 
@@ -1267,7 +1282,7 @@
    positional arguments:
     XXX
 
-   optional arguments:
+   options:
     -h, --help  show this help message and exit
     --foo YYY
 
@@ -1285,7 +1300,7 @@
    >>> parser.print_help()
    usage: PROG [-h] [-x X X] [--foo bar baz]
 
-   optional arguments:
+   options:
     -h, --help     show this help message and exit
     -x X X
     --foo bar baz
@@ -1689,7 +1704,7 @@
          a     a help
          b     b help
 
-     optional arguments:
+     options:
        -h, --help  show this help message and exit
        --foo   foo help
 
@@ -1699,13 +1714,13 @@
      positional arguments:
        bar     bar help
 
-     optional arguments:
+     options:
        -h, --help  show this help message and exit
 
      >>> parser.parse_args(['b', '--help'])
      usage: PROG b [-h] [--baz {X,Y,Z}]
 
-     optional arguments:
+     options:
        -h, --help     show this help message and exit
        --baz {X,Y,Z}  baz help
 
@@ -1722,7 +1737,7 @@
      >>> parser.parse_args(['-h'])
      usage:  [-h] {foo,bar} ...
 
-     optional arguments:
+     options:
        -h, --help  show this help message and exit
 
      subcommands:
diff --git a/Doc/library/array.rst b/Doc/library/array.rst
index 7802073..c7f137d 100644
--- a/Doc/library/array.rst
+++ b/Doc/library/array.rst
@@ -160,8 +160,7 @@
    Read *n* items (as machine values) from the :term:`file object` *f* and append
    them to the end of the array.  If less than *n* items are available,
    :exc:`EOFError` is raised, but the items that were available are still
-   inserted into the array. *f* must be a real built-in file object; something
-   else with a :meth:`read` method won't do.
+   inserted into the array.
 
 
 .. method:: array.fromlist(list)
@@ -178,11 +177,15 @@
    array of some other type.
 
 
-.. method:: array.index(x)
+.. method:: array.index(x[, start[, stop]])
 
    Return the smallest *i* such that *i* is the index of the first occurrence of
-   *x* in the array.
+   *x* in the array.  The optional arguments *start* and *stop* can be
+   specified to search for *x* within a subsection of the array.  Raise
+   :exc:`ValueError` if *x* is not found.
 
+   .. versionchanged:: 3.10
+      Added optional *start* and *stop* parameters.
 
 .. method:: array.insert(i, x)
 
@@ -257,7 +260,6 @@
       Packing and unpacking of External Data Representation (XDR) data as used in some
       remote procedure call systems.
 
-   `The Numerical Python Documentation <https://docs.scipy.org/doc/>`_
-      The Numeric Python extension (NumPy) defines another array type; see
-      http://www.numpy.org/ for further information about Numerical Python.
+   `NumPy <https://numpy.org/>`_
+      The NumPy package defines another array type.
 
diff --git a/Doc/library/ast.rst b/Doc/library/ast.rst
index 95cb017..e29b5e8 100644
--- a/Doc/library/ast.rst
+++ b/Doc/library/ast.rst
@@ -80,12 +80,13 @@
                   end_col_offset
 
       Instances of :class:`ast.expr` and :class:`ast.stmt` subclasses have
-      :attr:`lineno`, :attr:`col_offset`, :attr:`lineno`, and :attr:`col_offset`
-      attributes.  The :attr:`lineno` and :attr:`end_lineno` are the first and
-      last line numbers of source text span (1-indexed so the first line is line 1)
-      and the :attr:`col_offset` and :attr:`end_col_offset` are the corresponding
-      UTF-8 byte offsets of the first and last tokens that generated the node.
-      The UTF-8 offset is recorded because the parser uses UTF-8 internally.
+      :attr:`lineno`, :attr:`col_offset`, :attr:`end_lineno`, and
+      :attr:`end_col_offset` attributes.  The :attr:`lineno` and :attr:`end_lineno`
+      are the first and last line numbers of source text span (1-indexed so the
+      first line is line 1) and the :attr:`col_offset` and :attr:`end_col_offset`
+      are the corresponding UTF-8 byte offsets of the first and last tokens that
+      generated the node. The UTF-8 offset is recorded because the parser uses
+      UTF-8 internally.
 
       Note that the end positions are not required by the compiler and are
       therefore optional. The end offset is *after* the last symbol, for example
@@ -139,6 +140,11 @@
    In the meantime, instantiating them will return an instance of
    a different class.
 
+.. note::
+    The descriptions of the specific node classes displayed here
+    were initially adapted from the fantastic `Green Tree
+    Snakes <https://greentreesnakes.readthedocs.io/en/latest/>`__ project and
+    all its contributors.
 
 Literals
 ^^^^^^^^
@@ -832,7 +838,7 @@
    context), ``op`` is :class:`Add`, and ``value`` is a :class:`Constant` with
    value for 1.
 
-   The ``target`` attribute connot be of class :class:`Tuple` or :class:`List`,
+   The ``target`` attribute cannot be of class :class:`Tuple` or :class:`List`,
    unlike the targets of :class:`Assign`.
 
    .. doctest::
@@ -1239,6 +1245,374 @@
             type_ignores=[])
 
 
+Pattern matching
+^^^^^^^^^^^^^^^^
+
+
+.. class:: Match(subject, cases)
+
+   A ``match`` statement. ``subject`` holds the subject of the match (the object
+   that is being matched against the cases) and ``cases`` contains an iterable of
+   :class:`match_case` nodes with the different cases.
+
+.. class:: match_case(pattern, guard, body)
+
+   A single case pattern in a ``match`` statement. ``pattern`` contains the
+   match pattern that the subject will be matched against. Note that the
+   :class:`AST` nodes produced for patterns differ from those produced for
+   expressions, even when they share the same syntax.
+
+   The ``guard`` attribute contains an expression that will be evaluated if
+   the pattern matches the subject.
+
+   ``body`` contains a list of nodes to execute if the pattern matches and
+   the result of evaluating the guard expression is true.
+
+   .. doctest::
+
+        >>> print(ast.dump(ast.parse("""
+        ... match x:
+        ...     case [x] if x>0:
+        ...         ...
+        ...     case tuple():
+        ...         ...
+        ... """), indent=4))
+        Module(
+            body=[
+                Match(
+                    subject=Name(id='x', ctx=Load()),
+                    cases=[
+                        match_case(
+                            pattern=MatchSequence(
+                                patterns=[
+                                    MatchAs(name='x')]),
+                            guard=Compare(
+                                left=Name(id='x', ctx=Load()),
+                                ops=[
+                                    Gt()],
+                                comparators=[
+                                    Constant(value=0)]),
+                            body=[
+                                Expr(
+                                    value=Constant(value=Ellipsis))]),
+                        match_case(
+                            pattern=MatchClass(
+                                cls=Name(id='tuple', ctx=Load()),
+                                patterns=[],
+                                kwd_attrs=[],
+                                kwd_patterns=[]),
+                            body=[
+                                Expr(
+                                    value=Constant(value=Ellipsis))])])],
+            type_ignores=[])
+
+.. class:: MatchValue(value)
+
+   A match literal or value pattern that compares by equality. ``value`` is
+   an expression node. Permitted value nodes are restricted as described in
+   the match statement documentation. This pattern succeeds if the match
+   subject is equal to the evaluated value.
+
+   .. doctest::
+
+        >>> print(ast.dump(ast.parse("""
+        ... match x:
+        ...     case "Relevant":
+        ...         ...
+        ... """), indent=4))
+        Module(
+            body=[
+                Match(
+                    subject=Name(id='x', ctx=Load()),
+                    cases=[
+                        match_case(
+                            pattern=MatchValue(
+                                value=Constant(value='Relevant')),
+                            body=[
+                                Expr(
+                                    value=Constant(value=Ellipsis))])])],
+            type_ignores=[])
+
+.. class:: MatchSingleton(value)
+
+   A match literal pattern that compares by identity. ``value`` is the
+   singleton to be compared against: ``None``, ``True``, or ``False``. This
+   pattern succeeds if the match subject is the given constant.
+
+   .. doctest::
+
+        >>> print(ast.dump(ast.parse("""
+        ... match x:
+        ...     case None:
+        ...         ...
+        ... """), indent=4))
+        Module(
+            body=[
+                Match(
+                    subject=Name(id='x', ctx=Load()),
+                    cases=[
+                        match_case(
+                            pattern=MatchSingleton(value=None),
+                            body=[
+                                Expr(
+                                    value=Constant(value=Ellipsis))])])],
+            type_ignores=[])
+
+.. class:: MatchSequence(patterns)
+
+   A match sequence pattern. ``patterns`` contains the patterns to be matched
+   against the subject elements if the subject is a sequence. Matches a variable
+   length sequence if one of the subpatterns is a ``MatchStar`` node, otherwise
+   matches a fixed length sequence.
+
+   .. doctest::
+
+        >>> print(ast.dump(ast.parse("""
+        ... match x:
+        ...     case [1, 2]:
+        ...         ...
+        ... """), indent=4))
+        Module(
+            body=[
+                Match(
+                    subject=Name(id='x', ctx=Load()),
+                    cases=[
+                        match_case(
+                            pattern=MatchSequence(
+                                patterns=[
+                                    MatchValue(
+                                        value=Constant(value=1)),
+                                    MatchValue(
+                                        value=Constant(value=2))]),
+                            body=[
+                                Expr(
+                                    value=Constant(value=Ellipsis))])])],
+            type_ignores=[])
+
+.. class:: MatchStar(name)
+
+   Matches the rest of the sequence in a variable length match sequence pattern.
+   If ``name`` is not ``None``, a list containing the remaining sequence
+   elements is bound to that name if the overall sequence pattern is successful.
+
+   .. doctest::
+
+        >>> print(ast.dump(ast.parse("""
+        ... match x:
+        ...     case [1, 2, *rest]:
+        ...         ...
+        ...     case [*_]:
+        ...         ...
+        ... """), indent=4))
+        Module(
+            body=[
+                Match(
+                    subject=Name(id='x', ctx=Load()),
+                    cases=[
+                        match_case(
+                            pattern=MatchSequence(
+                                patterns=[
+                                    MatchValue(
+                                        value=Constant(value=1)),
+                                    MatchValue(
+                                        value=Constant(value=2)),
+                                    MatchStar(name='rest')]),
+                            body=[
+                                Expr(
+                                    value=Constant(value=Ellipsis))]),
+                        match_case(
+                            pattern=MatchSequence(
+                                patterns=[
+                                    MatchStar()]),
+                            body=[
+                                Expr(
+                                    value=Constant(value=Ellipsis))])])],
+            type_ignores=[])
+
+.. class:: MatchMapping(keys, patterns, rest)
+
+   A match mapping pattern. ``keys`` is a sequence of expression nodes.
+   ``patterns`` is a corresponding sequence of pattern nodes. ``rest`` is an
+   optional name that can be specified to capture the remaining mapping elements.
+   Permitted key expressions are restricted as described in the match statement
+   documentation.
+
+   This pattern succeeds if the subject is a mapping, all evaluated key
+   expressions are present in the mapping, and the value corresponding to each
+   key matches the corresponding subpattern. If ``rest`` is not ``None``, a dict
+   containing the remaining mapping elements is bound to that name if the overall
+   mapping pattern is successful.
+
+   .. doctest::
+
+        >>> print(ast.dump(ast.parse("""
+        ... match x:
+        ...     case {1: _, 2: _}:
+        ...         ...
+        ...     case {**rest}:
+        ...         ...
+        ... """), indent=4))
+        Module(
+            body=[
+                Match(
+                    subject=Name(id='x', ctx=Load()),
+                    cases=[
+                        match_case(
+                            pattern=MatchMapping(
+                                keys=[
+                                    Constant(value=1),
+                                    Constant(value=2)],
+                                patterns=[
+                                    MatchAs(),
+                                    MatchAs()]),
+                            body=[
+                                Expr(
+                                    value=Constant(value=Ellipsis))]),
+                        match_case(
+                            pattern=MatchMapping(keys=[], patterns=[], rest='rest'),
+                            body=[
+                                Expr(
+                                    value=Constant(value=Ellipsis))])])],
+            type_ignores=[])
+
+.. class:: MatchClass(cls, patterns, kwd_attrs, kwd_patterns)
+
+   A match class pattern. ``cls`` is an expression giving the nominal class to
+   be matched. ``patterns`` is a sequence of pattern nodes to be matched against
+   the class defined sequence of pattern matching attributes. ``kwd_attrs`` is a
+   sequence of additional attributes to be matched (specified as keyword arguments
+   in the class pattern), ``kwd_patterns`` are the corresponding patterns
+   (specified as keyword values in the class pattern).
+
+   This pattern succeeds if the subject is an instance of the nominated class,
+   all positional patterns match the corresponding class-defined attributes, and
+   any specified keyword attributes match their corresponding pattern.
+
+   Note: classes may define a property that returns self in order to match a
+   pattern node against the instance being matched. Several builtin types are
+   also matched that way, as described in the match statement documentation.
+
+   .. doctest::
+
+        >>> print(ast.dump(ast.parse("""
+        ... match x:
+        ...     case Point2D(0, 0):
+        ...         ...
+        ...     case Point3D(x=0, y=0, z=0):
+        ...         ...
+        ... """), indent=4))
+        Module(
+            body=[
+                Match(
+                    subject=Name(id='x', ctx=Load()),
+                    cases=[
+                        match_case(
+                            pattern=MatchClass(
+                                cls=Name(id='Point2D', ctx=Load()),
+                                patterns=[
+                                    MatchValue(
+                                        value=Constant(value=0)),
+                                    MatchValue(
+                                        value=Constant(value=0))],
+                                kwd_attrs=[],
+                                kwd_patterns=[]),
+                            body=[
+                                Expr(
+                                    value=Constant(value=Ellipsis))]),
+                        match_case(
+                            pattern=MatchClass(
+                                cls=Name(id='Point3D', ctx=Load()),
+                                patterns=[],
+                                kwd_attrs=[
+                                    'x',
+                                    'y',
+                                    'z'],
+                                kwd_patterns=[
+                                    MatchValue(
+                                        value=Constant(value=0)),
+                                    MatchValue(
+                                        value=Constant(value=0)),
+                                    MatchValue(
+                                        value=Constant(value=0))]),
+                            body=[
+                                Expr(
+                                    value=Constant(value=Ellipsis))])])],
+            type_ignores=[])
+
+.. class:: MatchAs(pattern, name)
+
+   A match "as-pattern", capture pattern or wildcard pattern. ``pattern``
+   contains the match pattern that the subject will be matched against.
+   If the pattern is ``None``, the node represents a capture pattern (i.e a
+   bare name) and will always succeed.
+
+   The ``name`` attribute contains the name that will be bound if the pattern
+   is successful. If ``name`` is ``None``, ``pattern`` must also be ``None``
+   and the node represents the wildcard pattern.
+
+   .. doctest::
+
+        >>> print(ast.dump(ast.parse("""
+        ... match x:
+        ...     case [x] as y:
+        ...         ...
+        ...     case _:
+        ...         ...
+        ... """), indent=4))
+        Module(
+            body=[
+                Match(
+                    subject=Name(id='x', ctx=Load()),
+                    cases=[
+                        match_case(
+                            pattern=MatchAs(
+                                pattern=MatchSequence(
+                                    patterns=[
+                                        MatchAs(name='x')]),
+                                name='y'),
+                            body=[
+                                Expr(
+                                    value=Constant(value=Ellipsis))]),
+                        match_case(
+                            pattern=MatchAs(),
+                            body=[
+                                Expr(
+                                    value=Constant(value=Ellipsis))])])],
+            type_ignores=[])
+
+.. class:: MatchOr(patterns)
+
+   A match "or-pattern". An or-pattern matches each of its subpatterns in turn
+   to the subject, until one succeeds. The or-pattern is then deemed to
+   succeed. If none of the subpatterns succeed the or-pattern fails. The
+   ``patterns`` attribute contains a list of match pattern nodes that will be
+   matched against the subject.
+
+   .. doctest::
+
+        >>> print(ast.dump(ast.parse("""
+        ... match x:
+        ...     case [x] | (y):
+        ...         ...
+        ... """), indent=4))
+        Module(
+            body=[
+                Match(
+                    subject=Name(id='x', ctx=Load()),
+                    cases=[
+                        match_case(
+                            pattern=MatchOr(
+                                patterns=[
+                                    MatchSequence(
+                                        patterns=[
+                                            MatchAs(name='x')]),
+                                    MatchAs(name='y')]),
+                            body=[
+                                Expr(
+                                    value=Constant(value=Ellipsis))])])],
+            type_ignores=[])
+
+
 Function and class definitions
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
@@ -1247,7 +1621,7 @@
    A function definition.
 
    * ``name`` is a raw string of the function name.
-   * ``args`` is a :class:`arguments` node.
+   * ``args`` is an :class:`arguments` node.
    * ``body`` is the list of nodes inside the function.
    * ``decorator_list`` is the list of decorators to be applied, stored outermost
      first (i.e. the first in the list will be applied last).
@@ -1421,7 +1795,7 @@
    * ``bases`` is a list of nodes for explicitly specified base classes.
    * ``keywords`` is a list of :class:`keyword` nodes, principally for 'metaclass'.
      Other keywords will be passed to the metaclass, as per `PEP-3115
-     <http://www.python.org/dev/peps/pep-3115/>`_.
+     <https://www.python.org/dev/peps/pep-3115/>`_.
    * ``starargs`` and ``kwargs`` are each a single node, as in a function call.
      starargs will be expanded to join the list of base classes, and kwargs will
      be passed to the metaclass.
@@ -1543,6 +1917,19 @@
    ``await`` as variable names.  The lowest supported version is
    ``(3, 4)``; the highest is ``sys.version_info[0:2]``.
 
+   If source contains a null character ('\0'), :exc:`ValueError` is raised.
+
+    .. warning::
+      Note that successfully parsing source code into an AST object doesn't
+      guarantee that the source code provided is valid Python code that can
+      be executed as the compilation step can raise further :exc:`SyntaxError`
+      exceptions. For instance, the source ``return 42`` generates a valid
+      AST node for a return statement, but it cannot be compiled alone (it needs
+      to be inside a function node).
+
+      In particular, :func:`ast.parse` won't do any scoping checks, which the
+      compilation step does.
+
    .. warning::
       It is possible to crash the Python interpreter with a
       sufficiently large/complex string due to stack depth limitations
@@ -1575,7 +1962,7 @@
    Safely evaluate an expression node or a string containing a Python literal or
    container display.  The string or node provided may only consist of the
    following Python literal structures: strings, bytes, numbers, tuples, lists,
-   dicts, sets, booleans, and ``None``.
+   dicts, sets, booleans, ``None`` and ``Ellipsis``.
 
    This can be used for safely evaluating strings containing Python values from
    untrusted sources without the need to parse the values oneself.  It is not
@@ -1587,12 +1974,19 @@
       sufficiently large/complex string due to stack depth limitations
       in Python's AST compiler.
 
+      It can raise :exc:`ValueError`, :exc:`TypeError`, :exc:`SyntaxError`,
+      :exc:`MemoryError` and :exc:`RecursionError` depending on the malformed
+      input.
+
    .. versionchanged:: 3.2
       Now allows bytes and set literals.
 
    .. versionchanged:: 3.9
       Now supports creating empty sets with ``'set()'``.
 
+   .. versionchanged:: 3.10
+      For string inputs, leading spaces and tabs are now stripped.
+
 
 .. function:: get_docstring(node, clean=True)
 
@@ -1855,4 +2249,4 @@
     `Parso <https://parso.readthedocs.io>`_ is a Python parser that supports
     error recovery and round-trip parsing for different Python versions (in
     multiple Python versions). Parso is also able to list multiple syntax errors
-    in your python file.
\ No newline at end of file
+    in your python file.
diff --git a/Doc/library/asyncio-api-index.rst b/Doc/library/asyncio-api-index.rst
index 047e5bb..f558724 100644
--- a/Doc/library/asyncio-api-index.rst
+++ b/Doc/library/asyncio-api-index.rst
@@ -49,7 +49,7 @@
       - Task object.
 
     * - :func:`to_thread`
-      - Asychronously run a function in a separate OS thread.
+      - Asynchronously run a function in a separate OS thread.
 
     * - :func:`run_coroutine_threadsafe`
       - Schedule a coroutine from another OS thread.
diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst
index b1e7318..300092d 100644
--- a/Doc/library/asyncio-eventloop.rst
+++ b/Doc/library/asyncio-eventloop.rst
@@ -53,13 +53,18 @@
    Consider also using the :func:`asyncio.run` function instead of using
    lower level functions to manually create and close an event loop.
 
+   .. deprecated:: 3.10
+      Deprecation warning is emitted if there is no running event loop.
+      In future Python releases, this function will be an alias of
+      :func:`get_running_loop`.
+
 .. function:: set_event_loop(loop)
 
    Set *loop* as a current event loop for the current OS thread.
 
 .. function:: new_event_loop()
 
-   Create a new event loop object.
+   Create and return a new event loop object.
 
 Note that the behaviour of :func:`get_event_loop`, :func:`set_event_loop`,
 and :func:`new_event_loop` functions can be altered by
@@ -211,6 +216,10 @@
    A thread-safe variant of :meth:`call_soon`.  Must be used to
    schedule callbacks *from another thread*.
 
+   Raises :exc:`RuntimeError` if called on a loop that's been closed.
+   This can happen on a secondary thread when the main application is
+   shutting down.
+
    See the :ref:`concurrency and multithreading <asyncio-multithreading>`
    section of the documentation.
 
@@ -321,7 +330,7 @@
 
    .. versionadded:: 3.5.2
 
-.. method:: loop.create_task(coro, \*, name=None)
+.. method:: loop.create_task(coro, *, name=None)
 
    Schedule the execution of a :ref:`coroutine`.
    Return a :class:`Task` object.
@@ -334,7 +343,7 @@
    the name of the task using :meth:`Task.set_name`.
 
    .. versionchanged:: 3.8
-      Added the ``name`` parameter.
+      Added the *name* parameter.
 
 .. method:: loop.set_task_factory(factory)
 
@@ -356,7 +365,7 @@
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 .. coroutinemethod:: loop.create_connection(protocol_factory, \
-                          host=None, port=None, \*, ssl=None, \
+                          host=None, port=None, *, ssl=None, \
                           family=0, proto=0, flags=0, sock=None, \
                           local_addr=None, server_hostname=None, \
                           ssl_handshake_timeout=None, \
@@ -440,14 +449,27 @@
      and *local_addr* should be specified.
 
    * *local_addr*, if given, is a ``(local_host, local_port)`` tuple used
-     to bind the socket to locally.  The *local_host* and *local_port*
+     to bind the socket locally.  The *local_host* and *local_port*
      are looked up using ``getaddrinfo()``, similarly to *host* and *port*.
 
    * *ssl_handshake_timeout* is (for a TLS connection) the time in seconds
      to wait for the TLS handshake to complete before aborting the connection.
      ``60.0`` seconds if ``None`` (default).
 
-   .. versionadded:: 3.8
+   .. versionchanged:: 3.5
+
+      Added support for SSL/TLS in :class:`ProactorEventLoop`.
+
+   .. versionchanged:: 3.6
+
+      The socket option :py:data:`~socket.TCP_NODELAY` is set by default
+      for all TCP connections.
+
+   .. versionchanged:: 3.7
+
+      Added the *ssl_handshake_timeout* parameter.
+
+   .. versionchanged:: 3.8
 
       Added the *happy_eyeballs_delay* and *interleave* parameters.
 
@@ -462,19 +484,6 @@
 
       For more information: https://tools.ietf.org/html/rfc6555
 
-   .. versionadded:: 3.7
-
-      The *ssl_handshake_timeout* parameter.
-
-   .. versionchanged:: 3.6
-
-      The socket option :py:data:`~socket.TCP_NODELAY` is set by default
-      for all TCP connections.
-
-   .. versionchanged:: 3.5
-
-      Added support for SSL/TLS in :class:`ProactorEventLoop`.
-
    .. seealso::
 
       The :func:`open_connection` function is a high-level alternative
@@ -482,7 +491,7 @@
       that can be used directly in async/await code.
 
 .. coroutinemethod:: loop.create_datagram_endpoint(protocol_factory, \
-                        local_addr=None, remote_addr=None, \*, \
+                        local_addr=None, remote_addr=None, *, \
                         family=0, proto=0, flags=0, \
                         reuse_address=None, reuse_port=None, \
                         allow_broadcast=None, sock=None)
@@ -518,7 +527,7 @@
    Other arguments:
 
    * *local_addr*, if given, is a ``(local_host, local_port)`` tuple used
-     to bind the socket to locally.  The *local_host* and *local_port*
+     to bind the socket locally.  The *local_host* and *local_port*
      are looked up using :meth:`getaddrinfo`.
 
    * *remote_addr*, if given, is a ``(remote_host, remote_port)`` tuple used
@@ -559,7 +568,7 @@
       Added support for Windows.
 
 .. coroutinemethod:: loop.create_unix_connection(protocol_factory, \
-                        path=None, \*, ssl=None, sock=None, \
+                        path=None, *, ssl=None, sock=None, \
                         server_hostname=None, ssl_handshake_timeout=None)
 
    Create a Unix connection.
@@ -579,12 +588,8 @@
 
    .. availability:: Unix.
 
-   .. versionadded:: 3.7
-
-      The *ssl_handshake_timeout* parameter.
-
    .. versionchanged:: 3.7
-
+      Added the *ssl_handshake_timeout* parameter.
       The *path* parameter can now be a :term:`path-like object`.
 
 
@@ -592,7 +597,7 @@
 ^^^^^^^^^^^^^^^^^^^^^^^^
 
 .. coroutinemethod:: loop.create_server(protocol_factory, \
-                        host=None, port=None, \*, \
+                        host=None, port=None, *, \
                         family=socket.AF_UNSPEC, \
                         flags=socket.AI_PASSIVE, \
                         sock=None, backlog=100, ssl=None, \
@@ -622,6 +627,11 @@
        assumed and a list of multiple sockets will be returned (most likely
        one for IPv4 and another one for IPv6).
 
+   * The *port* parameter can be set to specify which port the server should
+     listen on. If ``0`` or ``None`` (the default), a random unused port will
+     be selected (note that if *host* resolves to multiple network interfaces,
+     a different random port will be selected for each interface).
+
    * *family* can be set to either :data:`socket.AF_INET` or
      :data:`~socket.AF_INET6` to force the socket to use IPv4 or IPv6.
      If not set, the *family* will be determined from host name
@@ -658,15 +668,6 @@
      :meth:`Server.serve_forever` to make the server to start accepting
      connections.
 
-   .. versionadded:: 3.7
-
-      Added *ssl_handshake_timeout* and *start_serving* parameters.
-
-   .. versionchanged:: 3.6
-
-      The socket option :py:data:`~socket.TCP_NODELAY` is set by default
-      for all TCP connections.
-
    .. versionchanged:: 3.5
 
       Added support for SSL/TLS in :class:`ProactorEventLoop`.
@@ -675,6 +676,12 @@
 
       The *host* parameter can be a sequence of strings.
 
+   .. versionchanged:: 3.6
+
+      Added *ssl_handshake_timeout* and *start_serving* parameters.
+      The socket option :py:data:`~socket.TCP_NODELAY` is set by default
+      for all TCP connections.
+
    .. seealso::
 
       The :func:`start_server` function is a higher-level alternative API
@@ -683,7 +690,7 @@
 
 
 .. coroutinemethod:: loop.create_unix_server(protocol_factory, path=None, \
-                          \*, sock=None, backlog=100, ssl=None, \
+                          *, sock=None, backlog=100, ssl=None, \
                           ssl_handshake_timeout=None, start_serving=True)
 
    Similar to :meth:`loop.create_server` but works with the
@@ -699,16 +706,13 @@
 
    .. availability:: Unix.
 
-   .. versionadded:: 3.7
-
-      The *ssl_handshake_timeout* and *start_serving* parameters.
-
    .. versionchanged:: 3.7
 
+      Added the *ssl_handshake_timeout* and *start_serving* parameters.
       The *path* parameter can now be a :class:`~pathlib.Path` object.
 
 .. coroutinemethod:: loop.connect_accepted_socket(protocol_factory, \
-                        sock, \*, ssl=None, ssl_handshake_timeout=None)
+                        sock, *, ssl=None, ssl_handshake_timeout=None)
 
    Wrap an already accepted connection into a transport/protocol pair.
 
@@ -732,12 +736,12 @@
 
    Returns a ``(transport, protocol)`` pair.
 
-   .. versionadded:: 3.7
-
-      The *ssl_handshake_timeout* parameter.
-
    .. versionadded:: 3.5.3
 
+   .. versionchanged:: 3.7
+
+      Added the *ssl_handshake_timeout* parameter.
+
 
 Transferring files
 ^^^^^^^^^^^^^^^^^^
@@ -773,7 +777,7 @@
 ^^^^^^^^^^^
 
 .. coroutinemethod:: loop.start_tls(transport, protocol, \
-                        sslcontext, \*, server_side=False, \
+                        sslcontext, *, server_side=False, \
                         server_hostname=None, ssl_handshake_timeout=None)
 
    Upgrade an existing transport-based connection to TLS.
@@ -806,7 +810,7 @@
 Watching file descriptors
 ^^^^^^^^^^^^^^^^^^^^^^^^^
 
-.. method:: loop.add_reader(fd, callback, \*args)
+.. method:: loop.add_reader(fd, callback, *args)
 
    Start monitoring the *fd* file descriptor for read availability and
    invoke *callback* with the specified arguments once *fd* is available for
@@ -816,7 +820,7 @@
 
    Stop monitoring the *fd* file descriptor for read availability.
 
-.. method:: loop.add_writer(fd, callback, \*args)
+.. method:: loop.add_writer(fd, callback, *args)
 
    Start monitoring the *fd* file descriptor for write availability and
    invoke *callback* with the specified arguments once *fd* is available for
@@ -930,7 +934,7 @@
       :meth:`loop.create_server` and :func:`start_server`.
 
 .. coroutinemethod:: loop.sock_sendfile(sock, file, offset=0, count=None, \
-                                        \*, fallback=True)
+                                        *, fallback=True)
 
    Send a file using high-performance :mod:`os.sendfile` if possible.
    Return the total number of bytes sent.
@@ -964,7 +968,7 @@
 DNS
 ^^^
 
-.. coroutinemethod:: loop.getaddrinfo(host, port, \*, family=0, \
+.. coroutinemethod:: loop.getaddrinfo(host, port, *, family=0, \
                         type=0, proto=0, flags=0)
 
    Asynchronous version of :meth:`socket.getaddrinfo`.
@@ -1029,7 +1033,7 @@
 Unix signals
 ^^^^^^^^^^^^
 
-.. method:: loop.add_signal_handler(signum, callback, \*args)
+.. method:: loop.add_signal_handler(signum, callback, *args)
 
    Set *callback* as the handler for the *signum* signal.
 
@@ -1064,7 +1068,7 @@
 Executing code in thread or process pools
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-.. awaitablemethod:: loop.run_in_executor(executor, func, \*args)
+.. awaitablemethod:: loop.run_in_executor(executor, func, *args)
 
    Arrange for *func* to be called in the specified executor.
 
@@ -1184,10 +1188,13 @@
    * 'message': Error message;
    * 'exception' (optional): Exception object;
    * 'future' (optional): :class:`asyncio.Future` instance;
+   * 'task' (optional): :class:`asyncio.Task` instance;
    * 'handle' (optional): :class:`asyncio.Handle` instance;
    * 'protocol' (optional): :ref:`Protocol <asyncio-protocol>` instance;
    * 'transport' (optional): :ref:`Transport <asyncio-transport>` instance;
-   * 'socket' (optional): :class:`socket.socket` instance.
+   * 'socket' (optional): :class:`socket.socket` instance;
+   * 'asyncgen' (optional): Asynchronous generator that caused
+                            the exception.
 
    .. note::
 
@@ -1230,13 +1237,14 @@
 
 .. note::
 
-   The default asyncio event loop on **Windows** does not support
-   subprocesses. See :ref:`Subprocess Support on Windows
-   <asyncio-windows-subprocess>` for details.
+   On Windows, the default event loop :class:`ProactorEventLoop` supports
+   subprocesses, whereas :class:`SelectorEventLoop` does not. See
+   :ref:`Subprocess Support on Windows <asyncio-windows-subprocess>` for
+   details.
 
-.. coroutinemethod:: loop.subprocess_exec(protocol_factory, \*args, \
+.. coroutinemethod:: loop.subprocess_exec(protocol_factory, *args, \
                       stdin=subprocess.PIPE, stdout=subprocess.PIPE, \
-                      stderr=subprocess.PIPE, \*\*kwargs)
+                      stderr=subprocess.PIPE, **kwargs)
 
    Create a subprocess from one or more string arguments specified by
    *args*.
@@ -1316,9 +1324,9 @@
    conforms to the :class:`asyncio.SubprocessTransport` base class and
    *protocol* is an object instantiated by the *protocol_factory*.
 
-.. coroutinemethod:: loop.subprocess_shell(protocol_factory, cmd, \*, \
+.. coroutinemethod:: loop.subprocess_shell(protocol_factory, cmd, *, \
                         stdin=subprocess.PIPE, stdout=subprocess.PIPE, \
-                        stderr=subprocess.PIPE, \*\*kwargs)
+                        stderr=subprocess.PIPE, **kwargs)
 
    Create a subprocess from *cmd*, which can be a :class:`str` or a
    :class:`bytes` string encoded to the
diff --git a/Doc/library/asyncio-future.rst b/Doc/library/asyncio-future.rst
index e1ac18e..7426e82 100644
--- a/Doc/library/asyncio-future.rst
+++ b/Doc/library/asyncio-future.rst
@@ -31,7 +31,7 @@
    .. versionadded:: 3.5
 
 
-.. function:: ensure_future(obj, \*, loop=None)
+.. function:: ensure_future(obj, *, loop=None)
 
    Return:
 
@@ -54,20 +54,31 @@
       See also the :func:`create_task` function which is the
       preferred way for creating new Tasks.
 
+      Save a reference to the result of this function, to avoid
+      a task disappearing mid execution.
+
    .. versionchanged:: 3.5.1
       The function accepts any :term:`awaitable` object.
 
+   .. deprecated:: 3.10
+      Deprecation warning is emitted if *obj* is not a Future-like object
+      and *loop* is not specified and there is no running event loop.
 
-.. function:: wrap_future(future, \*, loop=None)
+
+.. function:: wrap_future(future, *, loop=None)
 
    Wrap a :class:`concurrent.futures.Future` object in a
    :class:`asyncio.Future` object.
 
+   .. deprecated:: 3.10
+      Deprecation warning is emitted if *future* is not a Future-like object
+      and *loop* is not specified and there is no running event loop.
+
 
 Future Object
 =============
 
-.. class:: Future(\*, loop=None)
+.. class:: Future(*, loop=None)
 
    A Future represents an eventual result of an asynchronous
    operation.  Not thread-safe.
@@ -90,6 +101,10 @@
    .. versionchanged:: 3.7
       Added support for the :mod:`contextvars` module.
 
+   .. deprecated:: 3.10
+      Deprecation warning is emitted if *loop* is not specified
+      and there is no running event loop.
+
    .. method:: result()
 
       Return the result of the Future.
@@ -179,7 +194,7 @@
       schedule the callbacks, and return ``True``.
 
       .. versionchanged:: 3.9
-         Added the ``msg`` parameter.
+         Added the *msg* parameter.
 
    .. method:: exception()
 
diff --git a/Doc/library/asyncio-policy.rst b/Doc/library/asyncio-policy.rst
index 5e69525..ef6a058 100644
--- a/Doc/library/asyncio-policy.rst
+++ b/Doc/library/asyncio-policy.rst
@@ -159,7 +159,7 @@
 
 .. class:: AbstractChildWatcher
 
-   .. method:: add_child_handler(pid, callback, \*args)
+   .. method:: add_child_handler(pid, callback, *args)
 
       Register a new child handler.
 
diff --git a/Doc/library/asyncio-protocol.rst b/Doc/library/asyncio-protocol.rst
index 9dbd3ab..8b67f4b 100644
--- a/Doc/library/asyncio-protocol.rst
+++ b/Doc/library/asyncio-protocol.rst
@@ -683,7 +683,7 @@
 Subprocess Protocols
 --------------------
 
-Datagram Protocol instances should be constructed by protocol
+Subprocess Protocol instances should be constructed by protocol
 factories passed to the :meth:`loop.subprocess_exec` and
 :meth:`loop.subprocess_shell` methods.
 
diff --git a/Doc/library/asyncio-queue.rst b/Doc/library/asyncio-queue.rst
index 524560b..d86fbc2 100644
--- a/Doc/library/asyncio-queue.rst
+++ b/Doc/library/asyncio-queue.rst
@@ -23,7 +23,7 @@
 Queue
 =====
 
-.. class:: Queue(maxsize=0, \*, loop=None)
+.. class:: Queue(maxsize=0)
 
    A first in, first out (FIFO) queue.
 
@@ -36,8 +36,8 @@
    the queue is always known and can be returned by calling the
    :meth:`qsize` method.
 
-   .. deprecated-removed:: 3.8 3.10
-      The *loop* parameter.
+   .. versionchanged:: 3.10
+      Removed the *loop* parameter.
 
 
    This class is :ref:`not thread safe <asyncio-multithreading>`.
diff --git a/Doc/library/asyncio-stream.rst b/Doc/library/asyncio-stream.rst
index b76ed37..3558277 100644
--- a/Doc/library/asyncio-stream.rst
+++ b/Doc/library/asyncio-stream.rst
@@ -48,10 +48,11 @@
 and work with streams:
 
 
-.. coroutinefunction:: open_connection(host=None, port=None, \*, \
-                          loop=None, limit=None, ssl=None, family=0, \
-                          proto=0, flags=0, sock=None, local_addr=None, \
-                          server_hostname=None, ssl_handshake_timeout=None)
+.. coroutinefunction:: open_connection(host=None, port=None, *, \
+                          limit=None, ssl=None, family=0, proto=0, \
+                          flags=0, sock=None, local_addr=None, \
+                          server_hostname=None, ssl_handshake_timeout=None, \
+                          happy_eyeballs_delay=None, interleave=None)
 
    Establish a network connection and return a pair of
    ``(reader, writer)`` objects.
@@ -59,9 +60,6 @@
    The returned *reader* and *writer* objects are instances of
    :class:`StreamReader` and :class:`StreamWriter` classes.
 
-   The *loop* argument is optional and can always be determined
-   automatically when this function is awaited from a coroutine.
-
    *limit* determines the buffer size limit used by the
    returned :class:`StreamReader` instance.  By default the *limit*
    is set to 64 KiB.
@@ -69,12 +67,18 @@
    The rest of the arguments are passed directly to
    :meth:`loop.create_connection`.
 
-   .. versionadded:: 3.7
+   .. versionchanged:: 3.7
+      Added the *ssl_handshake_timeout* parameter.
 
-      The *ssl_handshake_timeout* parameter.
+   .. versionadded:: 3.8
+      Added *happy_eyeballs_delay* and *interleave* parameters.
+
+   .. versionchanged:: 3.10
+      Removed the *loop* parameter.
+
 
 .. coroutinefunction:: start_server(client_connected_cb, host=None, \
-                          port=None, \*, loop=None, limit=None, \
+                          port=None, *, limit=None, \
                           family=socket.AF_UNSPEC, \
                           flags=socket.AI_PASSIVE, sock=None, \
                           backlog=100, ssl=None, reuse_address=None, \
@@ -92,9 +96,6 @@
    :ref:`coroutine function <coroutine>`; if it is a coroutine function,
    it will be automatically scheduled as a :class:`Task`.
 
-   The *loop* argument is optional and can always be determined
-   automatically when this method is awaited from a coroutine.
-
    *limit* determines the buffer size limit used by the
    returned :class:`StreamReader` instance.  By default the *limit*
    is set to 64 KiB.
@@ -102,16 +103,18 @@
    The rest of the arguments are passed directly to
    :meth:`loop.create_server`.
 
-   .. versionadded:: 3.7
+   .. versionchanged:: 3.7
+      Added the *ssl_handshake_timeout* and *start_serving* parameters.
 
-      The *ssl_handshake_timeout* and *start_serving* parameters.
+   .. versionchanged:: 3.10
+      Removed the *loop* parameter.
 
 
 .. rubric:: Unix Sockets
 
-.. coroutinefunction:: open_unix_connection(path=None, \*, loop=None, \
-                        limit=None, ssl=None, sock=None, \
-                        server_hostname=None, ssl_handshake_timeout=None)
+.. coroutinefunction:: open_unix_connection(path=None, *, limit=None, \
+                        ssl=None, sock=None, server_hostname=None, \
+                        ssl_handshake_timeout=None)
 
    Establish a Unix socket connection and return a pair of
    ``(reader, writer)``.
@@ -122,19 +125,17 @@
 
    .. availability:: Unix.
 
-   .. versionadded:: 3.7
-
-      The *ssl_handshake_timeout* parameter.
-
    .. versionchanged:: 3.7
-
+      Added the *ssl_handshake_timeout* parameter.
       The *path* parameter can now be a :term:`path-like object`
 
+   .. versionchanged:: 3.10
+      Removed the *loop* parameter.
+
 
 .. coroutinefunction:: start_unix_server(client_connected_cb, path=None, \
-                          \*, loop=None, limit=None, sock=None, \
-                          backlog=100, ssl=None, ssl_handshake_timeout=None, \
-                          start_serving=True)
+                          *, limit=None, sock=None, backlog=100, ssl=None, \
+                          ssl_handshake_timeout=None, start_serving=True)
 
    Start a Unix socket server.
 
@@ -144,14 +145,13 @@
 
    .. availability:: Unix.
 
-   .. versionadded:: 3.7
-
-      The *ssl_handshake_timeout* and *start_serving* parameters.
-
    .. versionchanged:: 3.7
-
+      Added the *ssl_handshake_timeout* and *start_serving* parameters.
       The *path* parameter can now be a :term:`path-like object`.
 
+   .. versionchanged:: 3.10
+      Removed the *loop* parameter.
+
 
 StreamReader
 ============
@@ -373,8 +373,8 @@
         server = await asyncio.start_server(
             handle_echo, '127.0.0.1', 8888)
 
-        addr = server.sockets[0].getsockname()
-        print(f'Serving on {addr}')
+        addrs = ', '.join(str(sock.getsockname()) for sock in server.sockets)
+        print(f'Serving on {addrs}')
 
         async with server:
             await server.serve_forever()
diff --git a/Doc/library/asyncio-subprocess.rst b/Doc/library/asyncio-subprocess.rst
index b033034..748b704 100644
--- a/Doc/library/asyncio-subprocess.rst
+++ b/Doc/library/asyncio-subprocess.rst
@@ -61,9 +61,8 @@
 Creating Subprocesses
 =====================
 
-.. coroutinefunction:: create_subprocess_exec(program, \*args, stdin=None, \
-                          stdout=None, stderr=None, loop=None, \
-                          limit=None, \*\*kwds)
+.. coroutinefunction:: create_subprocess_exec(program, *args, stdin=None, \
+                          stdout=None, stderr=None, limit=None, **kwds)
 
    Create a subprocess.
 
@@ -76,13 +75,12 @@
    See the documentation of :meth:`loop.subprocess_exec` for other
    parameters.
 
-   .. deprecated-removed:: 3.8 3.10
+   .. versionchanged:: 3.10
+      Removed the *loop* parameter.
 
-      The *loop* parameter.
 
 .. coroutinefunction:: create_subprocess_shell(cmd, stdin=None, \
-                          stdout=None, stderr=None, loop=None, \
-                          limit=None, \*\*kwds)
+                          stdout=None, stderr=None, limit=None, **kwds)
 
    Run the *cmd* shell command.
 
@@ -104,9 +102,8 @@
       escape whitespace and special shell characters in strings that are going
       to be used to construct shell commands.
 
-   .. deprecated-removed:: 3.8 3.10
-
-      The *loop* parameter.
+   .. versionchanged:: 3.10
+      Removed the *loop* parameter.
 
 .. note::
 
@@ -251,7 +248,7 @@
 
    .. method:: kill()
 
-      Kill the child.
+      Kill the child process.
 
       On POSIX systems this method sends :py:data:`SIGKILL` to the child
       process.
diff --git a/Doc/library/asyncio-sync.rst b/Doc/library/asyncio-sync.rst
index 84a52cb..f4063db 100644
--- a/Doc/library/asyncio-sync.rst
+++ b/Doc/library/asyncio-sync.rst
@@ -36,7 +36,7 @@
 Lock
 ====
 
-.. class:: Lock(\*, loop=None)
+.. class:: Lock()
 
    Implements a mutex lock for asyncio tasks.  Not thread-safe.
 
@@ -63,8 +63,8 @@
        finally:
            lock.release()
 
-   .. deprecated-removed:: 3.8 3.10
-      The *loop* parameter.
+   .. versionchanged:: 3.10
+      Removed the *loop* parameter.
 
    .. coroutinemethod:: acquire()
 
@@ -96,7 +96,7 @@
 Event
 =====
 
-.. class:: Event(\*, loop=None)
+.. class:: Event()
 
    An event object.  Not thread-safe.
 
@@ -104,13 +104,12 @@
    that some event has happened.
 
    An Event object manages an internal flag that can be set to *true*
-   with the :meth:`set` method and reset to *false* with the
-   :meth:`clear` method.  The :meth:`wait` method blocks until the
+   with the :meth:`~Event.set` method and reset to *false* with the
+   :meth:`clear` method.  The :meth:`~Event.wait` method blocks until the
    flag is set to *true*.  The flag is set to *false* initially.
 
-
-   .. deprecated-removed:: 3.8 3.10
-      The *loop* parameter.
+   .. versionchanged:: 3.10
+      Removed the *loop* parameter.
 
    .. _asyncio_example_sync_event:
 
@@ -142,7 +141,7 @@
       Wait until the event is set.
 
       If the event is set, return ``True`` immediately.
-      Otherwise block until another task calls :meth:`set`.
+      Otherwise block until another task calls :meth:`~Event.set`.
 
    .. method:: set()
 
@@ -155,8 +154,8 @@
 
       Clear (unset) the event.
 
-      Tasks awaiting on :meth:`wait` will now block until the
-      :meth:`set` method is called again.
+      Tasks awaiting on :meth:`~Event.wait` will now block until the
+      :meth:`~Event.set` method is called again.
 
    .. method:: is_set()
 
@@ -166,7 +165,7 @@
 Condition
 =========
 
-.. class:: Condition(lock=None, \*, loop=None)
+.. class:: Condition(lock=None)
 
    A Condition object.  Not thread-safe.
 
@@ -184,9 +183,8 @@
    ``None``.  In the latter case a new Lock object is created
    automatically.
 
-
-   .. deprecated-removed:: 3.8 3.10
-      The *loop* parameter.
+   .. versionchanged:: 3.10
+      Removed the *loop* parameter.
 
    The preferred way to use a Condition is an :keyword:`async with`
    statement::
@@ -270,7 +268,7 @@
 Semaphore
 =========
 
-.. class:: Semaphore(value=1, \*, loop=None)
+.. class:: Semaphore(value=1)
 
    A Semaphore object.  Not thread-safe.
 
@@ -284,9 +282,8 @@
    internal counter (``1`` by default). If the given value is
    less than ``0`` a :exc:`ValueError` is raised.
 
-
-   .. deprecated-removed:: 3.8 3.10
-      The *loop* parameter.
+   .. versionchanged:: 3.10
+      Removed the *loop* parameter.
 
    The preferred way to use a Semaphore is an :keyword:`async with`
    statement::
@@ -332,7 +329,7 @@
 BoundedSemaphore
 ================
 
-.. class:: BoundedSemaphore(value=1, \*, loop=None)
+.. class:: BoundedSemaphore(value=1)
 
    A bounded semaphore object.  Not thread-safe.
 
@@ -340,9 +337,8 @@
    a :exc:`ValueError` in :meth:`~Semaphore.release` if it
    increases the internal counter above the initial *value*.
 
-
-   .. deprecated-removed:: 3.8 3.10
-      The *loop* parameter.
+   .. versionchanged:: 3.10
+      Removed the *loop* parameter.
 
 ---------
 
diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst
index c638f12..efd4d1b 100644
--- a/Doc/library/asyncio-task.rst
+++ b/Doc/library/asyncio-task.rst
@@ -210,7 +210,7 @@
 Running an asyncio Program
 ==========================
 
-.. function:: run(coro, \*, debug=False)
+.. function:: run(coro, *, debug=False)
 
     Execute the :term:`coroutine` *coro* and return the result.
 
@@ -247,7 +247,7 @@
 Creating Tasks
 ==============
 
-.. function:: create_task(coro, \*, name=None)
+.. function:: create_task(coro, *, name=None)
 
    Wrap the *coro* :ref:`coroutine <coroutine>` into a :class:`Task`
    and schedule its execution.  Return the Task object.
@@ -274,16 +274,21 @@
        task = asyncio.ensure_future(coro())
        ...
 
+   .. important::
+
+      Save a reference to the result of this function, to avoid
+      a task disappearing mid execution.
+
    .. versionadded:: 3.7
 
    .. versionchanged:: 3.8
-      Added the ``name`` parameter.
+      Added the *name* parameter.
 
 
 Sleeping
 ========
 
-.. coroutinefunction:: sleep(delay, result=None, \*, loop=None)
+.. coroutinefunction:: sleep(delay, result=None)
 
    Block for *delay* seconds.
 
@@ -293,8 +298,15 @@
    ``sleep()`` always suspends the current task, allowing other tasks
    to run.
 
+   Setting the delay to 0 provides an optimized path to allow other
+   tasks to run. This can be used by long-running functions to avoid
+   blocking the event loop for the full duration of the function call.
+
    .. deprecated-removed:: 3.8 3.10
-      The *loop* parameter.
+      The ``loop`` parameter.  This function has been implicitly getting the
+      current running loop since 3.7.  See
+      :ref:`What's New in 3.10's Removed section <whatsnew310-removed>`
+      for more information.
 
    .. _asyncio_example_sleep:
 
@@ -316,10 +328,14 @@
     asyncio.run(display_date())
 
 
+   .. versionchanged:: 3.10
+      Removed the *loop* parameter.
+
+
 Running Tasks Concurrently
 ==========================
 
-.. awaitablefunction:: gather(\*aws, loop=None, return_exceptions=False)
+.. awaitablefunction:: gather(*aws, return_exceptions=False)
 
    Run :ref:`awaitable objects <asyncio-awaitables>` in the *aws*
    sequence *concurrently*.
@@ -348,8 +364,8 @@
    cancellation of one submitted Task/Future to cause other
    Tasks/Futures to be cancelled.
 
-   .. deprecated-removed:: 3.8 3.10
-      The *loop* parameter.
+   .. versionchanged:: 3.10
+      Removed the *loop* parameter.
 
    .. _asyncio_example_gather:
 
@@ -360,32 +376,35 @@
       async def factorial(name, number):
           f = 1
           for i in range(2, number + 1):
-              print(f"Task {name}: Compute factorial({i})...")
+              print(f"Task {name}: Compute factorial({number}), currently i={i}...")
               await asyncio.sleep(1)
               f *= i
           print(f"Task {name}: factorial({number}) = {f}")
+          return f
 
       async def main():
           # Schedule three calls *concurrently*:
-          await asyncio.gather(
+          L = await asyncio.gather(
               factorial("A", 2),
               factorial("B", 3),
               factorial("C", 4),
           )
+          print(L)
 
       asyncio.run(main())
 
       # Expected output:
       #
-      #     Task A: Compute factorial(2)...
-      #     Task B: Compute factorial(2)...
-      #     Task C: Compute factorial(2)...
+      #     Task A: Compute factorial(2), currently i=2...
+      #     Task B: Compute factorial(3), currently i=2...
+      #     Task C: Compute factorial(4), currently i=2...
       #     Task A: factorial(2) = 2
-      #     Task B: Compute factorial(3)...
-      #     Task C: Compute factorial(3)...
+      #     Task B: Compute factorial(3), currently i=3...
+      #     Task C: Compute factorial(4), currently i=3...
       #     Task B: factorial(3) = 6
-      #     Task C: Compute factorial(4)...
+      #     Task C: Compute factorial(4), currently i=4...
       #     Task C: factorial(4) = 24
+      #     [2, 6, 24]
 
    .. note::
       If *return_exceptions* is False, cancelling gather() after it
@@ -399,11 +418,19 @@
       If the *gather* itself is cancelled, the cancellation is
       propagated regardless of *return_exceptions*.
 
+   .. versionchanged:: 3.10
+      Removed the *loop* parameter.
+
+   .. deprecated:: 3.10
+      Deprecation warning is emitted if no positional arguments are provided
+      or not all positional arguments are Future-like objects
+      and there is no running event loop.
+
 
 Shielding From Cancellation
 ===========================
 
-.. awaitablefunction:: shield(aw, \*, loop=None)
+.. awaitablefunction:: shield(aw)
 
    Protect an :ref:`awaitable object <asyncio-awaitables>`
    from being :meth:`cancelled <Task.cancel>`.
@@ -436,14 +463,18 @@
        except CancelledError:
            res = None
 
-   .. deprecated-removed:: 3.8 3.10
-      The *loop* parameter.
+   .. versionchanged:: 3.10
+      Removed the *loop* parameter.
+
+   .. deprecated:: 3.10
+      Deprecation warning is emitted if *aw* is not Future-like object
+      and there is no running event loop.
 
 
 Timeouts
 ========
 
-.. coroutinefunction:: wait_for(aw, timeout, \*, loop=None)
+.. coroutinefunction:: wait_for(aw, timeout)
 
    Wait for the *aw* :ref:`awaitable <asyncio-awaitables>`
    to complete with a timeout.
@@ -466,8 +497,8 @@
 
    If the wait is cancelled, the future *aw* is also cancelled.
 
-   .. deprecated-removed:: 3.8 3.10
-      The *loop* parameter.
+   .. versionchanged:: 3.10
+      Removed the *loop* parameter.
 
    .. _asyncio_example_waitfor:
 
@@ -496,12 +527,14 @@
       for *aw* to be cancelled.  Previously, it raised
       :exc:`asyncio.TimeoutError` immediately.
 
+   .. versionchanged:: 3.10
+      Removed the *loop* parameter.
+
 
 Waiting Primitives
 ==================
 
-.. coroutinefunction:: wait(aws, \*, loop=None, timeout=None,\
-                            return_when=ALL_COMPLETED)
+.. coroutinefunction:: wait(aws, *, timeout=None, return_when=ALL_COMPLETED)
 
    Run :ref:`awaitable objects <asyncio-awaitables>` in the *aws*
    iterable concurrently and block until the condition specified
@@ -553,9 +586,8 @@
       ``wait()`` directly is deprecated as it leads to
       :ref:`confusing behavior <asyncio_example_wait_coroutine>`.
 
-   .. deprecated-removed:: 3.8 3.10
-
-      The *loop* parameter.
+   .. versionchanged:: 3.10
+      Removed the *loop* parameter.
 
    .. _asyncio_example_wait_coroutine:
    .. note::
@@ -589,8 +621,11 @@
       Passing coroutine objects to ``wait()`` directly is
       deprecated.
 
+   .. versionchanged:: 3.10
+      Removed the *loop* parameter.
 
-.. function:: as_completed(aws, \*, loop=None, timeout=None)
+
+.. function:: as_completed(aws, *, timeout=None)
 
    Run :ref:`awaitable objects <asyncio-awaitables>` in the *aws*
    iterable concurrently.  Return an iterator of coroutines.
@@ -600,8 +635,8 @@
    Raises :exc:`asyncio.TimeoutError` if the timeout occurs before
    all Futures are done.
 
-   .. deprecated-removed:: 3.8 3.10
-      The *loop* parameter.
+   .. versionchanged:: 3.10
+      Removed the *loop* parameter.
 
    Example::
 
@@ -609,11 +644,18 @@
            earliest_result = await coro
            # ...
 
+   .. versionchanged:: 3.10
+      Removed the *loop* parameter.
+
+   .. deprecated:: 3.10
+      Deprecation warning is emitted if not all awaitable objects in the *aws*
+      iterable are Future-like objects and there is no running event loop.
+
 
 Running in Threads
 ==================
 
-.. coroutinefunction:: to_thread(func, /, \*args, \*\*kwargs)
+.. coroutinefunction:: to_thread(func, /, *args, **kwargs)
 
    Asynchronously run function *func* in a separate thread.
 
@@ -697,7 +739,7 @@
 
      try:
          result = future.result(timeout)
-     except asyncio.TimeoutError:
+     except concurrent.futures.TimeoutError:
          print('The coroutine took too long, cancelling the task...')
          future.cancel()
      except Exception as exc:
@@ -743,7 +785,7 @@
 Task Object
 ===========
 
-.. class:: Task(coro, \*, loop=None, name=None)
+.. class:: Task(coro, *, loop=None, name=None)
 
    A :class:`Future-like <Future>` object that runs a Python
    :ref:`coroutine <coroutine>`.  Not thread-safe.
@@ -786,10 +828,11 @@
       Added support for the :mod:`contextvars` module.
 
    .. versionchanged:: 3.8
-      Added the ``name`` parameter.
+      Added the *name* parameter.
 
-   .. deprecated-removed:: 3.8 3.10
-      The *loop* parameter.
+   .. deprecated:: 3.10
+      Deprecation warning is emitted if *loop* is not specified
+      and there is no running event loop.
 
    .. method:: cancel(msg=None)
 
@@ -807,7 +850,7 @@
       discouraged.
 
       .. versionchanged:: 3.9
-         Added the ``msg`` parameter.
+         Added the *msg* parameter.
 
       .. _asyncio_example_task_cancel:
 
@@ -909,7 +952,7 @@
       See the documentation of :meth:`Future.remove_done_callback`
       for more details.
 
-   .. method:: get_stack(\*, limit=None)
+   .. method:: get_stack(*, limit=None)
 
       Return the list of stack frames for this Task.
 
@@ -930,7 +973,7 @@
       stack are returned, but the oldest frames of a traceback are
       returned.  (This matches the behavior of the traceback module.)
 
-   .. method:: print_stack(\*, limit=None, file=None)
+   .. method:: print_stack(*, limit=None, file=None)
 
       Print the stack or traceback for this Task.
 
@@ -979,7 +1022,7 @@
 .. note::
 
    Support for generator-based coroutines is **deprecated** and
-   is scheduled for removal in Python 3.10.
+   is removed in Python 3.11.
 
 Generator-based coroutines predate async/await syntax.  They are
 Python generators that use ``yield from`` expressions to await
@@ -1007,7 +1050,7 @@
     This decorator should not be used for :keyword:`async def`
     coroutines.
 
-    .. deprecated-removed:: 3.8 3.10
+    .. deprecated-removed:: 3.8 3.11
 
        Use :keyword:`async def` instead.
 
diff --git a/Doc/library/atexit.rst b/Doc/library/atexit.rst
index c2c058e..f7f0381 100644
--- a/Doc/library/atexit.rst
+++ b/Doc/library/atexit.rst
@@ -39,7 +39,7 @@
 
    If an exception is raised during execution of the exit handlers, a traceback is
    printed (unless :exc:`SystemExit` is raised) and the exception information is
-   saved.  After all exit handlers have had a chance to run the last exception to
+   saved.  After all exit handlers have had a chance to run, the last exception to
    be raised is re-raised.
 
    This function returns *func*, which makes it possible to use it as a
@@ -48,11 +48,12 @@
 
 .. function:: unregister(func)
 
-   Remove *func* from the list of functions to be run at interpreter
-   shutdown.  After calling :func:`unregister`, *func* is guaranteed not to be
-   called when the interpreter shuts down, even if it was registered more than
-   once.  :func:`unregister` silently does nothing if *func* was not previously
-   registered.
+   Remove *func* from the list of functions to be run at interpreter shutdown.
+   :func:`unregister` silently does nothing if *func* was not previously
+   registered.  If *func* has been registered more than once, every occurrence
+   of that function in the :mod:`atexit` call stack will be removed.  Equality
+   comparisons (``==``) are used internally during unregistration, so function
+   references do not need to have matching identities.
 
 
 .. seealso::
@@ -73,7 +74,7 @@
 making an explicit call into this module at termination. ::
 
    try:
-       with open("counterfile") as infile:
+       with open('counterfile') as infile:
            _count = int(infile.read())
    except FileNotFoundError:
        _count = 0
@@ -83,21 +84,22 @@
        _count = _count + n
 
    def savecounter():
-       with open("counterfile", "w") as outfile:
-           outfile.write("%d" % _count)
+       with open('counterfile', 'w') as outfile:
+           outfile.write('%d' % _count)
 
    import atexit
+
    atexit.register(savecounter)
 
 Positional and keyword arguments may also be passed to :func:`register` to be
 passed along to the registered function when it is called::
 
    def goodbye(name, adjective):
-       print('Goodbye, %s, it was %s to meet you.' % (name, adjective))
+       print('Goodbye %s, it was %s to meet you.' % (name, adjective))
 
    import atexit
-   atexit.register(goodbye, 'Donny', 'nice')
 
+   atexit.register(goodbye, 'Donny', 'nice')
    # or:
    atexit.register(goodbye, adjective='nice', name='Donny')
 
@@ -107,6 +109,6 @@
 
    @atexit.register
    def goodbye():
-       print("You are now leaving the Python sector.")
+       print('You are now leaving the Python sector.')
 
 This only works with functions that can be called without arguments.
diff --git a/Doc/library/audit_events.rst b/Doc/library/audit_events.rst
index 367d56e..8227a79 100644
--- a/Doc/library/audit_events.rst
+++ b/Doc/library/audit_events.rst
@@ -7,7 +7,7 @@
 
 This table contains all events raised by :func:`sys.audit` or
 :c:func:`PySys_Audit` calls throughout the CPython runtime and the
-standard library.  These calls were added in 3.8.0 or later.
+standard library.  These calls were added in 3.8.0 or later (see :pep:`578`).
 
 See :func:`sys.addaudithook` and :c:func:`PySys_AddAuditHook` for
 information on handling these events.
diff --git a/Doc/library/base64.rst b/Doc/library/base64.rst
index 1ff22a0..35fb7b6 100644
--- a/Doc/library/base64.rst
+++ b/Doc/library/base64.rst
@@ -2,7 +2,7 @@
 ===============================================================
 
 .. module:: base64
-   :synopsis: RFC 3548: Base16, Base32, Base64 Data Encodings;
+   :synopsis: RFC 4648: Base16, Base32, Base64 Data Encodings;
               Base85 and Ascii85
 
 **Source code:** :source:`Lib/base64.py`
@@ -16,10 +16,10 @@
 This module provides functions for encoding binary data to printable
 ASCII characters and decoding such encodings back to binary data.
 It provides encoding and decoding functions for the encodings specified in
-:rfc:`3548`, which defines the Base16, Base32, and Base64 algorithms,
+:rfc:`4648`, which defines the Base16, Base32, and Base64 algorithms,
 and for the de-facto standard Ascii85 and Base85 encodings.
 
-The :rfc:`3548` encodings are suitable for encoding binary data so that it can
+The :rfc:`4648` encodings are suitable for encoding binary data so that it can be
 safely sent by email, used as parts of URLs, or included as part of an HTTP
 POST request.  The encoding algorithm is not the same as the
 :program:`uuencode` program.
@@ -28,7 +28,7 @@
 supports encoding :term:`bytes-like objects <bytes-like object>` to ASCII
 :class:`bytes`, and decoding :term:`bytes-like objects <bytes-like object>` or
 strings containing ASCII to :class:`bytes`.  Both base-64 alphabets
-defined in :rfc:`3548` (normal, and URL- and filesystem-safe) are supported.
+defined in :rfc:`4648` (normal, and URL- and filesystem-safe) are supported.
 
 The legacy interface does not support decoding from strings, but it does
 provide functions for encoding and decoding to and from :term:`file objects
@@ -124,7 +124,7 @@
    whether a lowercase alphabet is acceptable as input.  For security purposes,
    the default is ``False``.
 
-   :rfc:`3548` allows for optional mapping of the digit 0 (zero) to the letter O
+   :rfc:`4648` allows for optional mapping of the digit 0 (zero) to the letter O
    (oh), and for optional mapping of the digit 1 (one) to either the letter I (eye)
    or letter L (el).  The optional argument *map01* when not ``None``, specifies
    which letter the digit 1 should be mapped to (when *map01* is not ``None``, the
@@ -136,6 +136,27 @@
    input.
 
 
+.. function:: b32hexencode(s)
+
+   Similar to :func:`b32encode` but uses the Extended Hex Alphabet, as defined in
+   :rfc:`4648`.
+
+   .. versionadded:: 3.10
+
+
+.. function:: b32hexdecode(s, casefold=False)
+
+   Similar to :func:`b32decode` but uses the Extended Hex Alphabet, as defined in
+   :rfc:`4648`.
+
+   This version does not allow the digit 0 (zero) to the letter O (oh) and digit
+   1 (one) to either the letter I (eye) or letter L (el) mappings, all these
+   characters are included in the Extended Hex Alphabet and are not
+   interchangeable.
+
+   .. versionadded:: 3.10
+
+
 .. function:: b16encode(s)
 
    Encode the :term:`bytes-like object` *s* using Base16 and return the
@@ -266,6 +287,13 @@
    >>> data
    b'data to be encoded'
 
+.. _base64-security:
+
+Security Considerations
+-----------------------
+
+A new security considerations section was added to :rfc:`4648` (section 12); it's
+recommended to review the security section for any code deployed to production.
 
 .. seealso::
 
diff --git a/Doc/library/bisect.rst b/Doc/library/bisect.rst
index 6bf7814..edcd4ae 100644
--- a/Doc/library/bisect.rst
+++ b/Doc/library/bisect.rst
@@ -21,7 +21,7 @@
 The following functions are provided:
 
 
-.. function:: bisect_left(a, x, lo=0, hi=len(a))
+.. function:: bisect_left(a, x, lo=0, hi=len(a), *, key=None)
 
    Locate the insertion point for *x* in *a* to maintain sorted order.
    The parameters *lo* and *hi* may be used to specify a subset of the list
@@ -31,39 +31,106 @@
    parameter to ``list.insert()`` assuming that *a* is already sorted.
 
    The returned insertion point *i* partitions the array *a* into two halves so
-   that ``all(val < x for val in a[lo:i])`` for the left side and
-   ``all(val >= x for val in a[i:hi])`` for the right side.
+   that ``all(val < x for val in a[lo : i])`` for the left side and
+   ``all(val >= x for val in a[i : hi])`` for the right side.
 
-.. function:: bisect_right(a, x, lo=0, hi=len(a))
-              bisect(a, x, lo=0, hi=len(a))
+   *key* specifies a :term:`key function` of one argument that is used to
+   extract a comparison key from each input element.  The default value is
+   ``None`` (compare the elements directly).
+
+   .. versionchanged:: 3.10
+      Added the *key* parameter.
+
+
+.. function:: bisect_right(a, x, lo=0, hi=len(a), *, key=None)
+              bisect(a, x, lo=0, hi=len(a), *, key=None)
 
    Similar to :func:`bisect_left`, but returns an insertion point which comes
    after (to the right of) any existing entries of *x* in *a*.
 
    The returned insertion point *i* partitions the array *a* into two halves so
-   that ``all(val <= x for val in a[lo:i])`` for the left side and
-   ``all(val > x for val in a[i:hi])`` for the right side.
+   that ``all(val <= x for val in a[lo : i])`` for the left side and
+   ``all(val > x for val in a[i : hi])`` for the right side.
 
-.. function:: insort_left(a, x, lo=0, hi=len(a))
+   *key* specifies a :term:`key function` of one argument that is used to
+   extract a comparison key from each input element.  The default value is
+   ``None`` (compare the elements directly).
 
-   Insert *x* in *a* in sorted order.  This is equivalent to
-   ``a.insert(bisect.bisect_left(a, x, lo, hi), x)`` assuming that *a* is
-   already sorted.  Keep in mind that the O(log n) search is dominated by
-   the slow O(n) insertion step.
+   .. versionchanged:: 3.10
+      Added the *key* parameter.
 
-.. function:: insort_right(a, x, lo=0, hi=len(a))
-              insort(a, x, lo=0, hi=len(a))
+
+.. function:: insort_left(a, x, lo=0, hi=len(a), *, key=None)
+
+   Insert *x* in *a* in sorted order.
+
+   *key* specifies a :term:`key function` of one argument that is used to
+   extract a comparison key from each input element.  The default value is
+   ``None`` (compare the elements directly).
+
+   This function first runs :func:`bisect_left` to locate an insertion point.
+   Next, it runs the :meth:`insert` method on *a* to insert *x* at the
+   appropriate position to maintain sort order.
+
+   Keep in mind that the ``O(log n)`` search is dominated by the slow O(n)
+   insertion step.
+
+   .. versionchanged:: 3.10
+      Added the *key* parameter.
+
+
+.. function:: insort_right(a, x, lo=0, hi=len(a), *, key=None)
+              insort(a, x, lo=0, hi=len(a), *, key=None)
 
    Similar to :func:`insort_left`, but inserting *x* in *a* after any existing
    entries of *x*.
 
+   *key* specifies a :term:`key function` of one argument that is used to
+   extract a comparison key from each input element.  The default value is
+   ``None`` (compare the elements directly).
+
+   This function first runs :func:`bisect_right` to locate an insertion point.
+   Next, it runs the :meth:`insert` method on *a* to insert *x* at the
+   appropriate position to maintain sort order.
+
+   Keep in mind that the ``O(log n)`` search is dominated by the slow O(n)
+   insertion step.
+
+   .. versionchanged:: 3.10
+      Added the *key* parameter.
+
+
+Performance Notes
+-----------------
+
+When writing time sensitive code using *bisect()* and *insort()*, keep these
+thoughts in mind:
+
+* Bisection is effective for searching ranges of values.
+  For locating specific values, dictionaries are more performant.
+
+* The *insort()* functions are ``O(n)`` because the logarithmic search step
+  is dominated by the linear time insertion step.
+
+* The search functions are stateless and discard key function results after
+  they are used.  Consequently, if the search functions are used in a loop,
+  the key function may be called again and again on the same array elements.
+  If the key function isn't fast, consider wrapping it with
+  :func:`functools.cache` to avoid duplicate computations.  Alternatively,
+  consider searching an array of precomputed keys to locate the insertion
+  point (as shown in the examples section below).
+
 .. seealso::
 
-   `SortedCollection recipe
-   <https://code.activestate.com/recipes/577197-sortedcollection/>`_ that uses
-   bisect to build a full-featured collection class with straight-forward search
-   methods and support for a key-function.  The keys are precomputed to save
-   unnecessary calls to the key function during searches.
+   * `Sorted Collections
+     <http://www.grantjenks.com/docs/sortedcollections/>`_ is a high performance
+     module that uses *bisect* to managed sorted collections of data.
+
+   * The `SortedCollection recipe
+     <https://code.activestate.com/recipes/577197-sortedcollection/>`_ uses
+     bisect to build a full-featured collection class with straight-forward search
+     methods and support for a key-function.  The keys are precomputed to save
+     unnecessary calls to the key function during searches.
 
 
 Searching Sorted Lists
@@ -110,8 +177,8 @@
         raise ValueError
 
 
-Other Examples
---------------
+Examples
+--------
 
 .. _bisect-example:
 
@@ -127,17 +194,12 @@
    >>> [grade(score) for score in [33, 99, 77, 70, 89, 90, 100]]
    ['F', 'A', 'C', 'C', 'B', 'A', 'A']
 
-Unlike the :func:`sorted` function, it does not make sense for the :func:`bisect`
-functions to have *key* or *reversed* arguments because that would lead to an
-inefficient design (successive calls to bisect functions would not "remember"
-all of the previous key lookups).
-
-Instead, it is better to search a list of precomputed keys to find the index
-of the record in question::
+One technique to avoid repeated calls to a key function is to search a list of
+precomputed keys to find the index of a record::
 
     >>> data = [('red', 5), ('blue', 1), ('yellow', 8), ('black', 0)]
-    >>> data.sort(key=lambda r: r[1])
-    >>> keys = [r[1] for r in data]         # precomputed list of keys
+    >>> data.sort(key=lambda r: r[1])       # Or use operator.itemgetter(1).
+    >>> keys = [r[1] for r in data]         # Precompute a list of keys.
     >>> data[bisect_left(keys, 0)]
     ('black', 0)
     >>> data[bisect_left(keys, 1)]
diff --git a/Doc/library/bz2.rst b/Doc/library/bz2.rst
index 637baf4..999892e 100644
--- a/Doc/library/bz2.rst
+++ b/Doc/library/bz2.rst
@@ -25,8 +25,6 @@
 * The :func:`compress` and :func:`decompress` functions for one-shot
   (de)compression.
 
-All of the classes in this module may safely be accessed from multiple threads.
-
 
 (De)compression of files
 ------------------------
@@ -140,6 +138,11 @@
 
       The *compresslevel* parameter became keyword-only.
 
+   .. versionchanged:: 3.10
+      This class is thread unsafe in the face of multiple simultaneous
+      readers or writers, just like its equivalent classes in :mod:`gzip` and
+      :mod:`lzma` have always been.
+
 
 Incremental (de)compression
 ---------------------------
@@ -322,3 +325,8 @@
     ...     content = f.read()
     >>> content == data  # Check equality to original object after round-trip
     True
+
+.. testcleanup::
+
+   import os
+   os.remove("myfile.bz2")
diff --git a/Doc/library/calendar.rst b/Doc/library/calendar.rst
index c3c04db..f641760 100644
--- a/Doc/library/calendar.rst
+++ b/Doc/library/calendar.rst
@@ -31,7 +31,7 @@
 .. class:: Calendar(firstweekday=0)
 
    Creates a :class:`Calendar` object. *firstweekday* is an integer specifying the
-   first day of the week. ``0`` is Monday (the default), ``6`` is Sunday.
+   first day of the week. :const:`MONDAY` is ``0`` (the default), :const:`SUNDAY` is ``6``.
 
    A :class:`Calendar` object provides several methods that can be used for
    preparing the calendar data for formatting. This class doesn't do any formatting
@@ -409,6 +409,15 @@
    locale.  This follows normal convention of January being month number 1, so it
    has a length of 13 and  ``month_abbr[0]`` is the empty string.
 
+.. data:: MONDAY
+          TUESDAY
+          WEDNESDAY
+          THURSDAY
+          FRIDAY
+          SATURDAY
+          SUNDAY
+
+   Aliases for day numbers, where ``MONDAY`` is ``0`` and ``SUNDAY`` is ``6``.
 
 .. seealso::
 
diff --git a/Doc/library/cgi.rst b/Doc/library/cgi.rst
index 4048592..c151f04 100644
--- a/Doc/library/cgi.rst
+++ b/Doc/library/cgi.rst
@@ -73,7 +73,7 @@
    cgitb.enable()
 
 This activates a special exception handler that will display detailed reports in
-the Web browser if any errors occur.  If you'd rather not show the guts of your
+the web browser if any errors occur.  If you'd rather not show the guts of your
 program to users of your script, you can have the reports saved to files
 instead, with code like this::
 
@@ -89,7 +89,7 @@
 contains non-ASCII characters, use the *encoding* keyword parameter set to the
 value of the encoding defined for the document. It is usually contained in the
 META tag in the HEAD section of the HTML document or by the
-:mailheader:`Content-Type` header).  This reads the form contents from the
+:mailheader:`Content-Type` header.  This reads the form contents from the
 standard input or the environment (depending on the value of various
 environment variables set according to the CGI standard).  Since it may consume
 standard input, it should be instantiated only once.
@@ -277,14 +277,14 @@
 algorithms implemented in this module in other circumstances.
 
 
-.. function:: parse(fp=None, environ=os.environ, keep_blank_values=False, strict_parsing=False)
+.. function:: parse(fp=None, environ=os.environ, keep_blank_values=False, strict_parsing=False, separator="&")
 
    Parse a query in the environment or from a file (the file defaults to
-   ``sys.stdin``).  The *keep_blank_values* and *strict_parsing* parameters are
+   ``sys.stdin``).  The *keep_blank_values*, *strict_parsing* and *separator* parameters are
    passed to :func:`urllib.parse.parse_qs` unchanged.
 
 
-.. function:: parse_multipart(fp, pdict, encoding="utf-8", errors="replace")
+.. function:: parse_multipart(fp, pdict, encoding="utf-8", errors="replace", separator="&")
 
    Parse input of type :mimetype:`multipart/form-data` (for  file uploads).
    Arguments are *fp* for the input file, *pdict* for a dictionary containing
@@ -303,6 +303,9 @@
       Added the *encoding* and *errors* parameters.  For non-file fields, the
       value is now a list of strings, not bytes.
 
+   .. versionchanged:: 3.10
+      Added the *separator* parameter.
+
 
 .. function:: parse_header(string)
 
@@ -313,7 +316,7 @@
 .. function:: test()
 
    Robust test CGI script, usable as main program. Writes minimal HTTP headers and
-   formats all information provided to the script in HTML form.
+   formats all information provided to the script in HTML format.
 
 
 .. function:: print_environ()
@@ -343,11 +346,11 @@
 
 .. index:: pair: CGI; security
 
-There's one important rule: if you invoke an external program (via the
-:func:`os.system` or :func:`os.popen` functions. or others with similar
+There's one important rule: if you invoke an external program (via
+:func:`os.system`, :func:`os.popen` or other functions with similar
 functionality), make very sure you don't pass arbitrary strings received from
 the client to the shell.  This is a well-known security hole whereby clever
-hackers anywhere on the Web can exploit a gullible CGI script to invoke
+hackers anywhere on the web can exploit a gullible CGI script to invoke
 arbitrary shell commands.  Even parts of the URL or field names cannot be
 trusted, since the request doesn't have to come from your form!
 
@@ -421,7 +424,7 @@
 you wonder whether you have understood the installation procedure correctly, try
 installing a copy of this module file (:file:`cgi.py`) as a CGI script.  When
 invoked as a script, the file will dump its environment and the contents of the
-form in HTML form. Give it the right mode etc, and send it a request.  If it's
+form in HTML format. Give it the right mode etc., and send it a request.  If it's
 installed in the standard :file:`cgi-bin` directory, it should be possible to
 send it a request by entering a URL into your browser of the form:
 
@@ -454,7 +457,7 @@
 discarded altogether.
 
 Fortunately, once you have managed to get your script to execute *some* code,
-you can easily send tracebacks to the Web browser using the :mod:`cgitb` module.
+you can easily send tracebacks to the web browser using the :mod:`cgitb` module.
 If you haven't done so already, just add the lines::
 
    import cgitb
diff --git a/Doc/library/codecs.rst b/Doc/library/codecs.rst
index f071057..1a1ce92 100644
--- a/Doc/library/codecs.rst
+++ b/Doc/library/codecs.rst
@@ -159,15 +159,22 @@
 .. function:: register(search_function)
 
    Register a codec search function. Search functions are expected to take one
-   argument, being the encoding name in all lower case letters, and return a
-   :class:`CodecInfo` object. In case a search function cannot find
-   a given encoding, it should return ``None``.
+   argument, being the encoding name in all lower case letters with hyphens
+   and spaces converted to underscores, and return a :class:`CodecInfo` object.
+   In case a search function cannot find a given encoding, it should return
+   ``None``.
 
-   .. note::
+   .. versionchanged:: 3.9
+      Hyphens and spaces are converted to underscore.
 
-      Search function registration is not currently reversible,
-      which may cause problems in some cases, such as unit testing or
-      module reloading.
+
+.. function:: unregister(search_function)
+
+   Unregister a codec search function and clear the registry's cache.
+   If the search function is not registered, do nothing.
+
+   .. versionadded:: 3.10
+
 
 While the builtin :func:`open` and the associated :mod:`io` module are the
 recommended approach for working with encoded text files, this module
@@ -687,14 +694,15 @@
 
    .. method:: writelines(list)
 
-      Writes the concatenated list of strings to the stream (possibly by reusing
-      the :meth:`write` method). The standard bytes-to-bytes codecs
+      Writes the concatenated iterable of strings to the stream (possibly by reusing
+      the :meth:`write` method). Infinite or
+      very large iterables are not supported. The standard bytes-to-bytes codecs
       do not support this method.
 
 
    .. method:: reset()
 
-      Flushes and resets the codec buffers used for keeping state.
+      Resets the codec buffers used for keeping internal state.
 
       Calling this method should ensure that the data on the output is put into
       a clean state that allows appending of new fresh data without having to
@@ -789,7 +797,7 @@
 
    .. method:: reset()
 
-      Resets the codec buffers used for keeping state.
+      Resets the codec buffers used for keeping internal state.
 
       Note that no stream repositioning should take place. This method is
       primarily intended to be able to recover from decoding errors.
@@ -916,7 +924,7 @@
 once the byte sequence has been decoded into a string; as a ``ZERO WIDTH
 NO-BREAK SPACE`` it's a normal character that will be decoded like any other.
 
-There's another encoding that is able to encoding the full range of Unicode
+There's another encoding that is able to encode the full range of Unicode
 characters: UTF-8. UTF-8 is an 8-bit encoding, which means there are no issues
 with byte order in UTF-8. Each byte in a UTF-8 byte sequence consists of two
 parts: marker bits (the most significant bits) and payload bits. The marker bits
@@ -1414,6 +1422,9 @@
 Internationalized Domain Names (IDN)). It builds upon the ``punycode`` encoding
 and :mod:`stringprep`.
 
+If you need the IDNA 2008 standard from :rfc:`5891` and :rfc:`5895`, use the
+third-party `idna module <https://pypi.org/project/idna/>_`.
+
 These RFCs together define a protocol to support non-ASCII characters in domain
 names. A domain name containing non-ASCII characters (such as
 ``www.Alliancefrançaise.nu``) is converted into an ASCII-compatible encoding
diff --git a/Doc/library/collections.abc.rst b/Doc/library/collections.abc.rst
index 2345e78..2c941b4 100644
--- a/Doc/library/collections.abc.rst
+++ b/Doc/library/collections.abc.rst
@@ -14,7 +14,7 @@
 
 .. testsetup:: *
 
-   from collections import *
+   from collections.abc import *
    import itertools
    __name__ = '<doctest>'
 
@@ -24,6 +24,89 @@
 can be used to test whether a class provides a particular interface; for
 example, whether it is hashable or whether it is a mapping.
 
+An :func:`issubclass` or :func:`isinstance` test for an interface works in one
+of three ways.
+
+1) A newly written class can inherit directly from one of the
+abstract base classes.  The class must supply the required abstract
+methods.  The remaining mixin methods come from inheritance and can be
+overridden if desired.  Other methods may be added as needed:
+
+.. testcode::
+
+    class C(Sequence):                      # Direct inheritance
+        def __init__(self): ...             # Extra method not required by the ABC
+        def __getitem__(self, index):  ...  # Required abstract method
+        def __len__(self):  ...             # Required abstract method
+        def count(self, value): ...         # Optionally override a mixin method
+
+.. doctest::
+
+   >>> issubclass(C, Sequence)
+   True
+   >>> isinstance(C(), Sequence)
+   True
+
+2) Existing classes and built-in classes can be registered as "virtual
+subclasses" of the ABCs.  Those classes should define the full API
+including all of the abstract methods and all of the mixin methods.
+This lets users rely on :func:`issubclass` or :func:`isinstance` tests
+to determine whether the full interface is supported.  The exception to
+this rule is for methods that are automatically inferred from the rest
+of the API:
+
+.. testcode::
+
+    class D:                                 # No inheritance
+        def __init__(self): ...              # Extra method not required by the ABC
+        def __getitem__(self, index):  ...   # Abstract method
+        def __len__(self):  ...              # Abstract method
+        def count(self, value): ...          # Mixin method
+        def index(self, value): ...          # Mixin method
+
+    Sequence.register(D)                     # Register instead of inherit
+
+.. doctest::
+
+   >>> issubclass(D, Sequence)
+   True
+   >>> isinstance(D(), Sequence)
+   True
+
+In this example, class :class:`D` does not need to define
+``__contains__``, ``__iter__``, and ``__reversed__`` because the
+:ref:`in-operator <comparisons>`, the :term:`iteration <iterable>`
+logic, and the :func:`reversed` function automatically fall back to
+using ``__getitem__`` and ``__len__``.
+
+3) Some simple interfaces are directly recognizable by the presence of
+the required methods (unless those methods have been set to
+:const:`None`):
+
+.. testcode::
+
+    class E:
+        def __iter__(self): ...
+        def __next__(next): ...
+
+.. doctest::
+
+   >>> issubclass(E, Iterable)
+   True
+   >>> isinstance(E(), Iterable)
+   True
+
+Complex interfaces do not support this last technique because an
+interface is more than just the presence of method names.  Interfaces
+specify semantics and relationships between methods that cannot be
+inferred solely from the presence of specific method names.  For
+example, knowing that a class supplies ``__getitem__``, ``__len__``, and
+``__iter__`` is insufficient for distinguishing a :class:`Sequence` from
+a :class:`Mapping`.
+
+.. versionadded:: 3.9
+   These abstract classes now support ``[]``. See :ref:`types-genericalias`
+   and :pep:`585`.
 
 .. _collections-abstract-base-classes:
 
@@ -34,67 +117,86 @@
 
 .. tabularcolumns:: |l|L|L|L|
 
-========================== ====================== ======================= ====================================================
-ABC                        Inherits from          Abstract Methods        Mixin Methods
-========================== ====================== ======================= ====================================================
-:class:`Container`                                ``__contains__``
-:class:`Hashable`                                 ``__hash__``
-:class:`Iterable`                                 ``__iter__``
-:class:`Iterator`          :class:`Iterable`      ``__next__``            ``__iter__``
-:class:`Reversible`        :class:`Iterable`      ``__reversed__``
-:class:`Generator`         :class:`Iterator`      ``send``, ``throw``     ``close``, ``__iter__``, ``__next__``
-:class:`Sized`                                    ``__len__``
-:class:`Callable`                                 ``__call__``
-:class:`Collection`        :class:`Sized`,        ``__contains__``,
-                           :class:`Iterable`,     ``__iter__``,
-                           :class:`Container`     ``__len__``
+============================== ====================== ======================= ====================================================
+ABC                            Inherits from          Abstract Methods        Mixin Methods
+============================== ====================== ======================= ====================================================
+:class:`Container` [1]_                               ``__contains__``
+:class:`Hashable` [1]_                                ``__hash__``
+:class:`Iterable` [1]_ [2]_                           ``__iter__``
+:class:`Iterator` [1]_         :class:`Iterable`      ``__next__``            ``__iter__``
+:class:`Reversible` [1]_       :class:`Iterable`      ``__reversed__``
+:class:`Generator`  [1]_       :class:`Iterator`      ``send``, ``throw``     ``close``, ``__iter__``, ``__next__``
+:class:`Sized`  [1]_                                  ``__len__``
+:class:`Callable`  [1]_                               ``__call__``
+:class:`Collection`  [1]_      :class:`Sized`,        ``__contains__``,
+                               :class:`Iterable`,     ``__iter__``,
+                               :class:`Container`     ``__len__``
 
-:class:`Sequence`          :class:`Reversible`,   ``__getitem__``,        ``__contains__``, ``__iter__``, ``__reversed__``,
-                           :class:`Collection`    ``__len__``             ``index``, and ``count``
+:class:`Sequence`              :class:`Reversible`,   ``__getitem__``,        ``__contains__``, ``__iter__``, ``__reversed__``,
+                               :class:`Collection`    ``__len__``             ``index``, and ``count``
 
-:class:`MutableSequence`   :class:`Sequence`      ``__getitem__``,        Inherited :class:`Sequence` methods and
-                                                  ``__setitem__``,        ``append``, ``reverse``, ``extend``, ``pop``,
-                                                  ``__delitem__``,        ``remove``, and ``__iadd__``
-                                                  ``__len__``,
-                                                  ``insert``
+:class:`MutableSequence`       :class:`Sequence`      ``__getitem__``,        Inherited :class:`Sequence` methods and
+                                                      ``__setitem__``,        ``append``, ``reverse``, ``extend``, ``pop``,
+                                                      ``__delitem__``,        ``remove``, and ``__iadd__``
+                                                      ``__len__``,
+                                                      ``insert``
 
-:class:`ByteString`        :class:`Sequence`      ``__getitem__``,        Inherited :class:`Sequence` methods
-                                                  ``__len__``
+:class:`ByteString`            :class:`Sequence`      ``__getitem__``,        Inherited :class:`Sequence` methods
+                                                      ``__len__``
 
-:class:`Set`               :class:`Collection`    ``__contains__``,       ``__le__``, ``__lt__``, ``__eq__``, ``__ne__``,
-                                                  ``__iter__``,           ``__gt__``, ``__ge__``, ``__and__``, ``__or__``,
-                                                  ``__len__``             ``__sub__``, ``__xor__``, and ``isdisjoint``
+:class:`Set`                   :class:`Collection`    ``__contains__``,       ``__le__``, ``__lt__``, ``__eq__``, ``__ne__``,
+                                                      ``__iter__``,           ``__gt__``, ``__ge__``, ``__and__``, ``__or__``,
+                                                      ``__len__``             ``__sub__``, ``__xor__``, and ``isdisjoint``
 
-:class:`MutableSet`        :class:`Set`           ``__contains__``,       Inherited :class:`Set` methods and
-                                                  ``__iter__``,           ``clear``, ``pop``, ``remove``, ``__ior__``,
-                                                  ``__len__``,            ``__iand__``, ``__ixor__``, and ``__isub__``
-                                                  ``add``,
-                                                  ``discard``
+:class:`MutableSet`            :class:`Set`           ``__contains__``,       Inherited :class:`Set` methods and
+                                                      ``__iter__``,           ``clear``, ``pop``, ``remove``, ``__ior__``,
+                                                      ``__len__``,            ``__iand__``, ``__ixor__``, and ``__isub__``
+                                                      ``add``,
+                                                      ``discard``
 
-:class:`Mapping`           :class:`Collection`    ``__getitem__``,        ``__contains__``, ``keys``, ``items``, ``values``,
-                                                  ``__iter__``,           ``get``, ``__eq__``, and ``__ne__``
-                                                  ``__len__``
+:class:`Mapping`               :class:`Collection`    ``__getitem__``,        ``__contains__``, ``keys``, ``items``, ``values``,
+                                                      ``__iter__``,           ``get``, ``__eq__``, and ``__ne__``
+                                                      ``__len__``
 
-:class:`MutableMapping`    :class:`Mapping`       ``__getitem__``,        Inherited :class:`Mapping` methods and
-                                                  ``__setitem__``,        ``pop``, ``popitem``, ``clear``, ``update``,
-                                                  ``__delitem__``,        and ``setdefault``
-                                                  ``__iter__``,
-                                                  ``__len__``
+:class:`MutableMapping`        :class:`Mapping`       ``__getitem__``,        Inherited :class:`Mapping` methods and
+                                                      ``__setitem__``,        ``pop``, ``popitem``, ``clear``, ``update``,
+                                                      ``__delitem__``,        and ``setdefault``
+                                                      ``__iter__``,
+                                                      ``__len__``
 
 
-:class:`MappingView`       :class:`Sized`                                 ``__len__``
-:class:`ItemsView`         :class:`MappingView`,                          ``__contains__``,
-                           :class:`Set`                                   ``__iter__``
-:class:`KeysView`          :class:`MappingView`,                          ``__contains__``,
-                           :class:`Set`                                   ``__iter__``
-:class:`ValuesView`        :class:`MappingView`,                          ``__contains__``, ``__iter__``
-                           :class:`Collection`
-:class:`Awaitable`                                ``__await__``
-:class:`Coroutine`         :class:`Awaitable`     ``send``, ``throw``     ``close``
-:class:`AsyncIterable`                            ``__aiter__``
-:class:`AsyncIterator`     :class:`AsyncIterable` ``__anext__``           ``__aiter__``
-:class:`AsyncGenerator`    :class:`AsyncIterator` ``asend``, ``athrow``   ``aclose``, ``__aiter__``, ``__anext__``
-========================== ====================== ======================= ====================================================
+:class:`MappingView`           :class:`Sized`                                 ``__len__``
+:class:`ItemsView`             :class:`MappingView`,                          ``__contains__``,
+                               :class:`Set`                                   ``__iter__``
+:class:`KeysView`              :class:`MappingView`,                          ``__contains__``,
+                               :class:`Set`                                   ``__iter__``
+:class:`ValuesView`            :class:`MappingView`,                          ``__contains__``, ``__iter__``
+                               :class:`Collection`
+:class:`Awaitable` [1]_                               ``__await__``
+:class:`Coroutine` [1]_        :class:`Awaitable`     ``send``, ``throw``     ``close``
+:class:`AsyncIterable` [1]_                           ``__aiter__``
+:class:`AsyncIterator` [1]_    :class:`AsyncIterable` ``__anext__``           ``__aiter__``
+:class:`AsyncGenerator` [1]_   :class:`AsyncIterator` ``asend``, ``athrow``   ``aclose``, ``__aiter__``, ``__anext__``
+============================== ====================== ======================= ====================================================
+
+
+.. rubric:: Footnotes
+
+.. [1] These ABCs override :meth:`object.__subclasshook__` to support
+   testing an interface by verifying the required methods are present
+   and have not been set to :const:`None`.  This only works for simple
+   interfaces.  More complex interfaces require registration or direct
+   subclassing.
+
+.. [2] Checking ``isinstance(obj, Iterable)`` detects classes that are
+   registered as :class:`Iterable` or that have an :meth:`__iter__`
+   method, but it does not detect classes that iterate with the
+   :meth:`__getitem__` method.  The only reliable way to determine
+   whether an object is :term:`iterable` is to call ``iter(obj)``.
+
+
+Collections Abstract Base Classes -- Detailed Descriptions
+----------------------------------------------------------
 
 
 .. class:: Container
@@ -244,8 +346,10 @@
 
    .. versionadded:: 3.6
 
+Examples and Recipes
+--------------------
 
-These ABCs allow us to ask classes or instances if they provide
+ABCs allow us to ask classes or instances if they provide
 particular functionality, for example::
 
     size = None
diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst
index 2ffdb49..67b64dd 100644
--- a/Doc/library/collections.rst
+++ b/Doc/library/collections.rst
@@ -33,11 +33,6 @@
 :class:`UserString`     wrapper around string objects for easier string subclassing
 =====================   ====================================================================
 
-.. deprecated-removed:: 3.3 3.10
-    Moved :ref:`collections-abstract-base-classes` to the :mod:`collections.abc` module.
-    For backwards compatibility, they continue to be visible in this module through
-    Python 3.9.
-
 
 :class:`ChainMap` objects
 -------------------------
@@ -77,19 +72,23 @@
         be modified to change which mappings are searched.  The list should
         always contain at least one mapping.
 
-    .. method:: new_child(m=None)
+    .. method:: new_child(m=None, **kwargs)
 
         Returns a new :class:`ChainMap` containing a new map followed by
         all of the maps in the current instance.  If ``m`` is specified,
         it becomes the new map at the front of the list of mappings; if not
         specified, an empty dict is used, so that a call to ``d.new_child()``
-        is equivalent to: ``ChainMap({}, *d.maps)``.  This method is used for
-        creating subcontexts that can be updated without altering values in any
-        of the parent mappings.
+        is equivalent to: ``ChainMap({}, *d.maps)``. If any keyword arguments
+        are specified, they update passed map or new empty dict. This method
+        is used for creating subcontexts that can be updated without altering
+        values in any of the parent mappings.
 
         .. versionchanged:: 3.4
            The optional ``m`` parameter was added.
 
+        .. versionchanged:: 3.10
+           Keyword arguments support was added.
+
     .. attribute:: parents
 
         Property returning a new :class:`ChainMap` containing all of the maps in
@@ -128,7 +127,7 @@
       writing to any mapping in the chain.
 
     * Django's `Context class
-      <https://github.com/django/django/blob/master/django/template/context.py>`_
+      <https://github.com/django/django/blob/main/django/template/context.py>`_
       for templating is a read-only chain of mappings.  It also features
       pushing and popping of contexts similar to the
       :meth:`~collections.ChainMap.new_child` method and the
@@ -272,12 +271,12 @@
     .. versionadded:: 3.1
 
     .. versionchanged:: 3.7 As a :class:`dict` subclass, :class:`Counter`
-       Inherited the capability to remember insertion order.  Math operations
+       inherited the capability to remember insertion order.  Math operations
        on *Counter* objects also preserve order.  Results are ordered
        according to when an element is first encountered in the left operand
        and then by the order encountered in the right operand.
 
-    Counter objects support three methods beyond those available for all
+    Counter objects support additional methods beyond those available for all
     dictionaries:
 
     .. method:: elements()
@@ -314,6 +313,16 @@
 
         .. versionadded:: 3.2
 
+    .. method:: total()
+
+        Compute the sum of the counts.
+
+            >>> c = Counter(a=10, b=5, c=0)
+            >>> c.total()
+            15
+
+        .. versionadded:: 3.10
+
     The usual dictionary methods are available for :class:`Counter` objects
     except for two which work differently for counters.
 
@@ -328,9 +337,22 @@
         instead of replacing them.  Also, the *iterable* is expected to be a
         sequence of elements, not a sequence of ``(key, value)`` pairs.
 
+Counters support rich comparison operators for equality, subset, and
+superset relationships: ``==``, ``!=``, ``<``, ``<=``, ``>``, ``>=``.
+All of those tests treat missing elements as having zero counts so that
+``Counter(a=1) == Counter(a=1, b=0)`` returns true.
+
+.. versionadded:: 3.10
+   Rich comparison operations were added.
+
+.. versionchanged:: 3.10
+   In equality tests, missing elements are treated as having zero counts.
+   Formerly, ``Counter(a=3)`` and ``Counter(a=3, b=0)`` were considered
+   distinct.
+
 Common patterns for working with :class:`Counter` objects::
 
-    sum(c.values())                 # total of all counts
+    c.total()                       # total of all counts
     c.clear()                       # reset all counts
     list(c)                         # list unique elements
     set(c)                          # convert to a set
@@ -344,19 +366,26 @@
 objects to produce multisets (counters that have counts greater than zero).
 Addition and subtraction combine counters by adding or subtracting the counts
 of corresponding elements.  Intersection and union return the minimum and
-maximum of corresponding counts.  Each operation can accept inputs with signed
+maximum of corresponding counts.  Equality and inclusion compare
+corresponding counts.  Each operation can accept inputs with signed
 counts, but the output will exclude results with counts of zero or less.
 
+.. doctest::
+
     >>> c = Counter(a=3, b=1)
     >>> d = Counter(a=1, b=2)
     >>> c + d                       # add two counters together:  c[x] + d[x]
     Counter({'a': 4, 'b': 3})
     >>> c - d                       # subtract (keeping only positive counts)
     Counter({'a': 2})
-    >>> c & d                       # intersection:  min(c[x], d[x]) # doctest: +SKIP
+    >>> c & d                       # intersection:  min(c[x], d[x])
     Counter({'a': 1, 'b': 1})
     >>> c | d                       # union:  max(c[x], d[x])
     Counter({'a': 3, 'b': 2})
+    >>> c == d                      # equality:  c[x] == d[x]
+    False
+    >>> c <= d                      # inclusion:  c[x] <= d[x]
+    False
 
 Unary addition and subtraction are shortcuts for adding an empty counter
 or subtracting from an empty counter.
@@ -685,9 +714,9 @@
 :class:`defaultdict` objects
 ----------------------------
 
-.. class:: defaultdict([default_factory[, ...]])
+.. class:: defaultdict(default_factory=None, /, [...])
 
-    Returns a new dictionary-like object.  :class:`defaultdict` is a subclass of the
+    Return a new dictionary-like object.  :class:`defaultdict` is a subclass of the
     built-in :class:`dict` class.  It overrides one method and adds one writable
     instance variable.  The remaining functionality is the same as for the
     :class:`dict` class and is not documented here.
@@ -1063,18 +1092,35 @@
   Space efficiency, iteration speed, and the performance of update
   operations were secondary.
 
-* Algorithmically, :class:`OrderedDict` can handle frequent reordering
-  operations better than :class:`dict`.  This makes it suitable for tracking
-  recent accesses (for example in an `LRU cache
-  <https://medium.com/@krishankantsinghal/my-first-blog-on-medium-583159139237>`_).
+* The :class:`OrderedDict` algorithm can handle frequent reordering operations
+  better than :class:`dict`.  As shown in the recipes below, this makes it
+  suitable for implementing various kinds of LRU caches.
 
 * The equality operation for :class:`OrderedDict` checks for matching order.
 
+  A regular :class:`dict` can emulate the order sensitive equality test with
+  ``p == q and all(k1 == k2 for k1, k2 in zip(p, q))``.
+
 * The :meth:`popitem` method of :class:`OrderedDict` has a different
   signature.  It accepts an optional argument to specify which item is popped.
 
-* :class:`OrderedDict` has a :meth:`move_to_end` method to
-  efficiently reposition an element to an endpoint.
+  A regular :class:`dict` can emulate OrderedDict's ``od.popitem(last=True)``
+  with ``d.popitem()`` which is guaranteed to pop the rightmost (last) item.
+
+  A regular :class:`dict` can emulate OrderedDict's ``od.popitem(last=False)``
+  with ``(k := next(iter(d)), d.pop(k))`` which will return and remove the
+  leftmost (first) item if it exists.
+
+* :class:`OrderedDict` has a :meth:`move_to_end` method to efficiently
+  reposition an element to an endpoint.
+
+  A regular :class:`dict` can emulate OrderedDict's ``od.move_to_end(k,
+  last=True)`` with ``d[k] = d.pop(k)`` which will move the key and its
+  associated value to the rightmost (last) position.
+
+  A regular :class:`dict` does not have an efficient equivalent for
+  OrderedDict's ``od.move_to_end(k, last=False)`` which moves the key
+  and its associated value to the leftmost (first) position.
 
 * Until Python 3.8, :class:`dict` lacked a :meth:`__reversed__` method.
 
@@ -1098,14 +1144,16 @@
         Move an existing *key* to either end of an ordered dictionary.  The item
         is moved to the right end if *last* is true (the default) or to the
         beginning if *last* is false.  Raises :exc:`KeyError` if the *key* does
-        not exist::
+        not exist:
+
+        .. doctest::
 
             >>> d = OrderedDict.fromkeys('abcde')
             >>> d.move_to_end('b')
-            >>> ''.join(d.keys())
+            >>> ''.join(d)
             'acdeb'
             >>> d.move_to_end('b', last=False)
-            >>> ''.join(d.keys())
+            >>> ''.join(d)
             'bacde'
 
         .. versionadded:: 3.2
@@ -1149,28 +1197,101 @@
             self.move_to_end(key)
 
 An :class:`OrderedDict` would also be useful for implementing
-variants of :func:`functools.lru_cache`::
+variants of :func:`functools.lru_cache`:
 
-    class LRU(OrderedDict):
-        'Limit size, evicting the least recently looked-up key when full'
+.. testcode::
 
-        def __init__(self, maxsize=128, /, *args, **kwds):
+    from time import time
+
+    class TimeBoundedLRU:
+        "LRU Cache that invalidates and refreshes old entries."
+
+        def __init__(self, func, maxsize=128, maxage=30):
+            self.cache = OrderedDict()      # { args : (timestamp, result)}
+            self.func = func
             self.maxsize = maxsize
-            super().__init__(*args, **kwds)
+            self.maxage = maxage
 
-        def __getitem__(self, key):
-            value = super().__getitem__(key)
-            self.move_to_end(key)
-            return value
+        def __call__(self, *args):
+            if args in self.cache:
+                self.cache.move_to_end(args)
+                timestamp, result = self.cache[args]
+                if time() - timestamp <= self.maxage:
+                    return result
+            result = self.func(*args)
+            self.cache[args] = time(), result
+            if len(self.cache) > self.maxsize:
+                self.cache.popitem(0)
+            return result
 
-        def __setitem__(self, key, value):
-            if key in self:
-                self.move_to_end(key)
-            super().__setitem__(key, value)
-            if len(self) > self.maxsize:
-                oldest = next(iter(self))
-                del self[oldest]
 
+.. testcode::
+
+    class MultiHitLRUCache:
+        """ LRU cache that defers caching a result until
+            it has been requested multiple times.
+
+            To avoid flushing the LRU cache with one-time requests,
+            we don't cache until a request has been made more than once.
+
+        """
+
+        def __init__(self, func, maxsize=128, maxrequests=4096, cache_after=1):
+            self.requests = OrderedDict()   # { uncached_key : request_count }
+            self.cache = OrderedDict()      # { cached_key : function_result }
+            self.func = func
+            self.maxrequests = maxrequests  # max number of uncached requests
+            self.maxsize = maxsize          # max number of stored return values
+            self.cache_after = cache_after
+
+        def __call__(self, *args):
+            if args in self.cache:
+                self.cache.move_to_end(args)
+                return self.cache[args]
+            result = self.func(*args)
+            self.requests[args] = self.requests.get(args, 0) + 1
+            if self.requests[args] <= self.cache_after:
+                self.requests.move_to_end(args)
+                if len(self.requests) > self.maxrequests:
+                    self.requests.popitem(0)
+            else:
+                self.requests.pop(args, None)
+                self.cache[args] = result
+                if len(self.cache) > self.maxsize:
+                    self.cache.popitem(0)
+            return result
+
+.. doctest::
+    :hide:
+
+    >>> def square(x):
+    ...     return x * x
+    ...
+    >>> f = MultiHitLRUCache(square, maxsize=4, maxrequests=6)
+    >>> list(map(f, range(10)))  # First requests, don't cache
+    [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
+    >>> f(4)  # Cache the second request
+    16
+    >>> f(6)  # Cache the second request
+    36
+    >>> f(2)  # The first request aged out, so don't cache
+    4
+    >>> f(6)  # Cache hit
+    36
+    >>> f(4)  # Cache hit and move to front
+    16
+    >>> list(f.cache.values())
+    [36, 16]
+    >>> set(f.requests).isdisjoint(f.cache)
+    True
+    >>> list(map(f, [9, 8, 7]))   # Cache these second requests
+    [81, 64, 49]
+    >>> list(map(f, [7, 9]))  # Cache hits
+    [49, 81]
+    >>> list(f.cache.values())
+    [16, 64, 49, 81]
+    >>> set(f.requests).isdisjoint(f.cache)
+    True
 
 :class:`UserDict` objects
 -------------------------
@@ -1187,7 +1308,7 @@
     regular dictionary, which is accessible via the :attr:`data` attribute of
     :class:`UserDict` instances.  If *initialdata* is provided, :attr:`data` is
     initialized with its contents; note that a reference to *initialdata* will not
-    be kept, allowing it be used for other purposes.
+    be kept, allowing it to be used for other purposes.
 
     In addition to supporting the methods and operations of mappings,
     :class:`UserDict` instances provide the following attribute:
diff --git a/Doc/library/compileall.rst b/Doc/library/compileall.rst
index 9b914b1..de34664 100644
--- a/Doc/library/compileall.rst
+++ b/Doc/library/compileall.rst
@@ -148,7 +148,7 @@
 Public functions
 ----------------
 
-.. function:: compile_dir(dir, maxlevels=sys.getrecursionlimit(), ddir=None, force=False, rx=None, quiet=0, legacy=False, optimize=-1, workers=1, invalidation_mode=None, \*, stripdir=None, prependdir=None, limit_sl_dest=None, hardlink_dupes=False)
+.. function:: compile_dir(dir, maxlevels=sys.getrecursionlimit(), ddir=None, force=False, rx=None, quiet=0, legacy=False, optimize=-1, workers=1, invalidation_mode=None, *, stripdir=None, prependdir=None, limit_sl_dest=None, hardlink_dupes=False)
 
    Recursively descend the directory tree named by *dir*, compiling all :file:`.py`
    files along the way. Return a true value if all the files compiled successfully,
@@ -166,9 +166,10 @@
    If *force* is true, modules are re-compiled even if the timestamps are up to
    date.
 
-   If *rx* is given, its search method is called on the complete path to each
+   If *rx* is given, its ``search`` method is called on the complete path to each
    file considered for compilation, and if it returns a true value, the file
-   is skipped.
+   is skipped. This can be used to exclude files matching a regular expression,
+   given as a :ref:`re.Pattern <re-objects>` object.
 
    If *quiet* is ``False`` or ``0`` (the default), the filenames and other
    information are printed to standard out. Set to ``1``, only errors are
@@ -231,7 +232,7 @@
       Added *stripdir*, *prependdir*, *limit_sl_dest* and *hardlink_dupes* arguments.
       Default value of *maxlevels* was changed from ``10`` to ``sys.getrecursionlimit()``
 
-.. function:: compile_file(fullname, ddir=None, force=False, rx=None, quiet=0, legacy=False, optimize=-1, invalidation_mode=None, \*, stripdir=None, prependdir=None, limit_sl_dest=None, hardlink_dupes=False)
+.. function:: compile_file(fullname, ddir=None, force=False, rx=None, quiet=0, legacy=False, optimize=-1, invalidation_mode=None, *, stripdir=None, prependdir=None, limit_sl_dest=None, hardlink_dupes=False)
 
    Compile the file with path *fullname*. Return a true value if the file
    compiled successfully, and a false value otherwise.
@@ -242,9 +243,10 @@
    cases where the source file does not exist at the time the byte-code file is
    executed.
 
-   If *rx* is given, its search method is passed the full path name to the
+   If *rx* is given, its ``search`` method is passed the full path name to the
    file being compiled, and if it returns a true value, the file is not
-   compiled and ``True`` is returned.
+   compiled and ``True`` is returned. This can be used to exclude files matching
+   a regular expression, given as a :ref:`re.Pattern <re-objects>` object.
 
    If *quiet* is ``False`` or ``0`` (the default), the filenames and other
    information are printed to standard out. Set to ``1``, only errors are
diff --git a/Doc/library/concurrency.rst b/Doc/library/concurrency.rst
index b150990..5be1a11 100644
--- a/Doc/library/concurrency.rst
+++ b/Doc/library/concurrency.rst
@@ -21,6 +21,7 @@
    subprocess.rst
    sched.rst
    queue.rst
+   contextvars.rst
 
 
 The following are support modules for some of the above services:
diff --git a/Doc/library/concurrent.futures.rst b/Doc/library/concurrent.futures.rst
index 61d6c11..70a17a2 100644
--- a/Doc/library/concurrent.futures.rst
+++ b/Doc/library/concurrent.futures.rst
@@ -30,7 +30,7 @@
 
     .. method:: submit(fn, /, *args, **kwargs)
 
-       Schedules the callable, *fn*, to be executed as ``fn(*args **kwargs)``
+       Schedules the callable, *fn*, to be executed as ``fn(*args, **kwargs)``
        and returns a :class:`Future` object representing the execution of the
        callable. ::
 
@@ -67,7 +67,7 @@
        .. versionchanged:: 3.5
           Added the *chunksize* argument.
 
-    .. method:: shutdown(wait=True, \*, cancel_futures=False)
+    .. method:: shutdown(wait=True, *, cancel_futures=False)
 
        Signal the executor that it should free any resources that it is using
        when the currently pending futures are done executing.  Calls to
@@ -350,7 +350,7 @@
        If the future is cancelled before completing then :exc:`.CancelledError`
        will be raised.
 
-       If the call raised, this method will raise the same exception.
+       If the call raised an exception, this method will raise the same exception.
 
     .. method:: exception(timeout=None)
 
@@ -435,7 +435,8 @@
 .. function:: wait(fs, timeout=None, return_when=ALL_COMPLETED)
 
    Wait for the :class:`Future` instances (possibly created by different
-   :class:`Executor` instances) given by *fs* to complete.  Returns a named
+   :class:`Executor` instances) given by *fs* to complete. Duplicate futures
+   given to *fs* are removed and will be returned only once. Returns a named
    2-tuple of sets.  The first set, named ``done``, contains the futures that
    completed (finished or cancelled futures) before the wait completed.  The
    second set, named ``not_done``, contains the futures that did not complete
diff --git a/Doc/library/configparser.rst b/Doc/library/configparser.rst
index 2e22a54..323dd2a 100644
--- a/Doc/library/configparser.rst
+++ b/Doc/library/configparser.rst
@@ -46,6 +46,11 @@
 
    import configparser
 
+.. testcleanup::
+
+   import os
+   os.remove("example.ini")
+
 
 Quick Start
 -----------
@@ -135,6 +140,30 @@
 sections [1]_.  Note also that keys in sections are
 case-insensitive and stored in lowercase [1]_.
 
+It is possible to read several configurations into a single
+:class:`ConfigParser`, where the most recently added configuration has the
+highest priority. Any conflicting keys are taken from the more recent
+configuration while the previously existing keys are retained.
+
+.. doctest::
+
+   >>> another_config = configparser.ConfigParser()
+   >>> another_config.read('example.ini')
+   ['example.ini']
+   >>> another_config['topsecret.server.com']['Port']
+   '50022'
+   >>> another_config.read_string("[topsecret.server.com]\nPort=48484")
+   >>> another_config['topsecret.server.com']['Port']
+   '48484'
+   >>> another_config.read_dict({"topsecret.server.com": {"Port": 21212}})
+   >>> another_config['topsecret.server.com']['Port']
+   '21212'
+   >>> another_config['topsecret.server.com']['ForwardX11']
+   'no'
+
+This behaviour is equivalent to a :meth:`ConfigParser.read` call with several
+files passed to the *filenames* parameter.
+
 
 Supported Datatypes
 -------------------
@@ -232,11 +261,15 @@
 followed by key/value entries separated by a specific string (``=`` or ``:`` by
 default [1]_).  By default, section names are case sensitive but keys are not
 [1]_.  Leading and trailing whitespace is removed from keys and values.
-Values can be omitted, in which case the key/value delimiter may also be left
+Values can be omitted if the parser is configured to allow it [1]_,
+in which case the key/value delimiter may also be left
 out.  Values can also span multiple lines, as long as they are indented deeper
 than the first line of the value.  Depending on the parser's mode, blank lines
 may be treated as parts of multiline values or ignored.
 
+By default,  a valid section name can be any string that does not contain '\\n' or ']'.
+To change this, see :attr:`ConfigParser.SECTCRE`.
+
 Configuration files may include comments, prefixed by specific
 characters (``#`` and ``;`` by default [1]_).  Comments may appear on
 their own on an otherwise empty line, possibly indented. [1]_
@@ -1129,6 +1162,13 @@
       *space_around_delimiters* is true, delimiters between
       keys and values are surrounded by spaces.
 
+   .. note::
+
+      Comments in the original configuration file are not preserved when
+      writing the configuration back.
+      What is considered a comment, depends on the given values for
+      *comment_prefix* and *inline_comment_prefix*.
+
 
    .. method:: remove_option(section, option)
 
diff --git a/Doc/library/constants.rst b/Doc/library/constants.rst
index f17e1a3..38dd552 100644
--- a/Doc/library/constants.rst
+++ b/Doc/library/constants.rst
@@ -19,19 +19,21 @@
 
 .. data:: None
 
-   The sole value of the type ``NoneType``.  ``None`` is frequently used to
-   represent the absence of a value, as when default arguments are not passed to a
-   function. Assignments to ``None`` are illegal and raise a :exc:`SyntaxError`.
+   An object frequently used to represent the absence of a value, as when
+   default arguments are not passed to a function. Assignments to ``None``
+   are illegal and raise a :exc:`SyntaxError`.
+   ``None`` is the sole instance of the :data:`NoneType` type.
 
 
 .. data:: NotImplemented
 
-   Special value which should be returned by the binary special methods
+   A special value which should be returned by the binary special methods
    (e.g. :meth:`__eq__`, :meth:`__lt__`, :meth:`__add__`, :meth:`__rsub__`,
    etc.) to indicate that the operation is not implemented with respect to
    the other type; may be returned by the in-place binary special methods
    (e.g. :meth:`__imul__`, :meth:`__iand__`, etc.) for the same purpose.
    It should not be evaluated in a boolean context.
+   ``NotImplemented`` is the sole instance of the :data:`types.NotImplementedType` type.
 
    .. note::
 
@@ -59,8 +61,9 @@
 .. index:: single: ...; ellipsis literal
 .. data:: Ellipsis
 
-   The same as the ellipsis literal "``...``".  Special value used mostly in conjunction
+   The same as the ellipsis literal "``...``". Special value used mostly in conjunction
    with extended slicing syntax for user-defined container data types.
+   ``Ellipsis`` is the sole instance of the :data:`types.EllipsisType` type.
 
 
 .. data:: __debug__
diff --git a/Doc/library/contextlib.rst b/Doc/library/contextlib.rst
index 0aa4ad7..b6ec6b8 100644
--- a/Doc/library/contextlib.rst
+++ b/Doc/library/contextlib.rst
@@ -126,6 +126,33 @@
 
    .. versionadded:: 3.7
 
+   Context managers defined with :func:`asynccontextmanager` can be used
+   either as decorators or with :keyword:`async with` statements::
+
+     import time
+     from contextlib import asynccontextmanager
+
+     @asynccontextmanager
+     async def timeit():
+         now = time.monotonic()
+         try:
+             yield
+         finally:
+             print(f'it took {time.monotonic() - now}s to run')
+
+      @timeit()
+      async def main():
+          # ... async code ...
+
+   When used as a decorator, a new generator instance is implicitly created on
+   each function call. This allows the otherwise "one-shot" context managers
+   created by :func:`asynccontextmanager` to meet the requirement that context
+   managers support multiple invocations in order to be used as decorators.
+
+  .. versionchanged:: 3.10
+     Async context managers created with :func:`asynccontextmanager` can
+     be used as decorators.
+
 
 .. function:: closing(thing)
 
@@ -146,7 +173,7 @@
       from contextlib import closing
       from urllib.request import urlopen
 
-      with closing(urlopen('http://www.python.org')) as page:
+      with closing(urlopen('https://www.python.org')) as page:
           for line in page:
               print(line)
 
@@ -154,6 +181,39 @@
    ``page.close()`` will be called when the :keyword:`with` block is exited.
 
 
+.. class:: aclosing(thing)
+
+   Return an async context manager that calls the ``aclose()`` method of *thing*
+   upon completion of the block.  This is basically equivalent to::
+
+      from contextlib import asynccontextmanager
+
+      @asynccontextmanager
+      async def aclosing(thing):
+          try:
+              yield thing
+          finally:
+              await thing.aclose()
+
+   Significantly, ``aclosing()`` supports deterministic cleanup of async
+   generators when they happen to exit early by :keyword:`break` or an
+   exception.  For example::
+
+      from contextlib import aclosing
+
+      async with aclosing(my_generator()) as values:
+          async for value in values:
+              if value == 42:
+                  break
+
+   This pattern ensures that the generator's async exit code is executed in
+   the same context as its iterations (so that exceptions and context
+   variables work as expected, and the exit code isn't run after the
+   lifetime of some task it depends on).
+
+   .. versionadded:: 3.10
+
+
 .. _simplifying-support-for-single-optional-context-managers:
 
 .. function:: nullcontext(enter_result=None)
@@ -185,14 +245,33 @@
           with cm as file:
               # Perform processing on the file
 
+   It can also be used as a stand-in for
+   :ref:`asynchronous context managers <async-context-managers>`::
+
+       async def send_http(session=None):
+          if not session:
+              # If no http session, create it with aiohttp
+              cm = aiohttp.ClientSession()
+          else:
+              # Caller is responsible for closing the session
+              cm = nullcontext(session)
+
+          async with cm as session:
+              # Send http requests with session
+
    .. versionadded:: 3.7
 
+   .. versionchanged:: 3.10
+      :term:`asynchronous context manager` support was added.
+
+
 
 .. function:: suppress(*exceptions)
 
    Return a context manager that suppresses any of the specified exceptions
-   if they occur in the body of a with statement and then resumes execution
-   with the first statement following the end of the with statement.
+   if they occur in the body of a :keyword:`!with` statement and then
+   resumes execution with the first statement following the end of the
+   :keyword:`!with` statement.
 
    As with any other mechanism that completely suppresses exceptions, this
    context manager should be used only to cover very specific errors where
@@ -236,10 +315,11 @@
 
    For example, the output of :func:`help` normally is sent to *sys.stdout*.
    You can capture that output in a string by redirecting the output to an
-   :class:`io.StringIO` object::
+   :class:`io.StringIO` object. The replacement stream is returned from the
+   ``__enter__`` method and so is available as the target of the
+   :keyword:`with` statement::
 
-        f = io.StringIO()
-        with redirect_stdout(f):
+        with redirect_stdout(io.StringIO()) as f:
             help(pow)
         s = f.getvalue()
 
@@ -351,6 +431,45 @@
    .. versionadded:: 3.2
 
 
+.. class:: AsyncContextDecorator
+
+   Similar to :class:`ContextDecorator` but only for asynchronous functions.
+
+   Example of ``AsyncContextDecorator``::
+
+      from asyncio import run
+      from contextlib import AsyncContextDecorator
+
+      class mycontext(AsyncContextDecorator):
+          async def __aenter__(self):
+              print('Starting')
+              return self
+
+          async def __aexit__(self, *exc):
+              print('Finishing')
+              return False
+
+      >>> @mycontext()
+      ... async def function():
+      ...     print('The bit in the middle')
+      ...
+      >>> run(function())
+      Starting
+      The bit in the middle
+      Finishing
+
+      >>> async def function():
+      ...    async with mycontext():
+      ...         print('The bit in the middle')
+      ...
+      >>> run(function())
+      Starting
+      The bit in the middle
+      Finishing
+
+   .. versionadded:: 3.10
+
+
 .. class:: ExitStack()
 
    A context manager that is designed to make it easy to programmatically
@@ -463,7 +582,7 @@
    The :meth:`close` method is not implemented, :meth:`aclose` must be used
    instead.
 
-   .. method:: enter_async_context(cm)
+   .. coroutinemethod:: enter_async_context(cm)
 
       Similar to :meth:`enter_context` but expects an asynchronous context
       manager.
@@ -477,7 +596,7 @@
 
       Similar to :meth:`callback` but expects a coroutine function.
 
-   .. method:: aclose()
+   .. coroutinemethod:: aclose()
 
       Similar to :meth:`close` but properly handles awaitables.
 
@@ -638,7 +757,7 @@
 
    class Callback(ExitStack):
        def __init__(self, callback, /, *args, **kwds):
-           super(Callback, self).__init__()
+           super().__init__()
            self.callback(callback, *args, **kwds)
 
        def cancel(self):
diff --git a/Doc/library/contextvars.rst b/Doc/library/contextvars.rst
index 8805661..be1dd0c 100644
--- a/Doc/library/contextvars.rst
+++ b/Doc/library/contextvars.rst
@@ -26,7 +26,7 @@
 Context Variables
 -----------------
 
-.. class:: ContextVar(name, [\*, default])
+.. class:: ContextVar(name, [*, default])
 
    This class is used to declare a new Context Variable, e.g.::
 
@@ -94,7 +94,7 @@
           # var.get() would raise a LookupError.
 
 
-.. class:: contextvars.Token
+.. class:: Token
 
    *Token* objects are returned by the :meth:`ContextVar.set` method.
    They can be passed to the :meth:`ContextVar.reset` method to revert
@@ -146,7 +146,7 @@
 
    Context implements the :class:`collections.abc.Mapping` interface.
 
-   .. method:: run(callable, \*args, \*\*kwargs)
+   .. method:: run(callable, *args, **kwargs)
 
       Execute ``callable(*args, **kwargs)`` code in the context object
       the *run* method is called on.  Return the result of the execution
diff --git a/Doc/library/copy.rst b/Doc/library/copy.rst
index a8e8bfb..a8bc2fa 100644
--- a/Doc/library/copy.rst
+++ b/Doc/library/copy.rst
@@ -27,7 +27,7 @@
    Return a deep copy of *x*.
 
 
-.. exception:: error
+.. exception:: Error
 
    Raised for module specific errors.
 
@@ -60,7 +60,7 @@
   components copied.
 
 This module does not copy types like module, method, stack trace, stack frame,
-file, socket, window, array, or any similar types.  It does "copy" functions and
+file, socket, window, or any similar types.  It does "copy" functions and
 classes (shallow and deeply), by returning the original object unchanged; this
 is compatible with the way these are treated by the :mod:`pickle` module.
 
@@ -86,6 +86,7 @@
 argument, the ``memo`` dictionary.  If the :meth:`__deepcopy__` implementation needs
 to make a deep copy of a component, it should call the :func:`deepcopy` function
 with the component as first argument and the memo dictionary as second argument.
+The memo dictionary should be treated as an opaque object.
 
 
 .. seealso::
diff --git a/Doc/library/copyreg.rst b/Doc/library/copyreg.rst
index 4392021..dc35965 100644
--- a/Doc/library/copyreg.rst
+++ b/Doc/library/copyreg.rst
@@ -33,8 +33,8 @@
 
    The optional *constructor* parameter, if provided, is a callable object which
    can be used to reconstruct the object when called with the tuple of arguments
-   returned by *function* at pickling time.  :exc:`TypeError` will be raised if
-   *object* is a class or *constructor* is not callable.
+   returned by *function* at pickling time.  A :exc:`TypeError` is raised if the
+   *constructor* is not callable.
 
    See the :mod:`pickle` module for more details on the interface
    expected of *function* and *constructor*.  Note that the
diff --git a/Doc/library/csv.rst b/Doc/library/csv.rst
index 7a72c26..899ce02 100644
--- a/Doc/library/csv.rst
+++ b/Doc/library/csv.rst
@@ -94,8 +94,8 @@
    :class:`Dialect` class or one of the strings returned by the
    :func:`list_dialects` function.  The other optional *fmtparams* keyword arguments
    can be given to override individual formatting parameters in the current
-   dialect.  For full details about the dialect and formatting parameters, see
-   section :ref:`csv-fmt-params`. To make it
+   dialect.  For full details about dialects and formatting parameters, see
+   the :ref:`csv-fmt-params` section. To make it
    as easy as possible to interface with modules which implement the DB API, the
    value :const:`None` is written as the empty string.  While this isn't a
    reversible transformation, it makes it easier to dump SQL NULL data values to
@@ -117,7 +117,7 @@
    Associate *dialect* with *name*.  *name* must be a string. The
    dialect can be specified either by passing a sub-class of :class:`Dialect`, or
    by *fmtparams* keyword arguments, or both, with keyword arguments overriding
-   parameters of the dialect. For full details about the dialect and formatting
+   parameters of the dialect. For full details about dialects and formatting
    parameters, see section :ref:`csv-fmt-params`.
 
 
@@ -225,9 +225,21 @@
 
 .. class:: Dialect
 
-   The :class:`Dialect` class is a container class relied on primarily for its
-   attributes, which are used to define the parameters for a specific
-   :class:`reader` or :class:`writer` instance.
+   The :class:`Dialect` class is a container class whose attributes contain
+   information for how to handle doublequotes, whitespace, delimiters, etc.
+   Due to the lack of a strict CSV specification, different applications
+   produce subtly different CSV data.  :class:`Dialect` instances define how
+   :class:`reader` and :class:`writer` instances behave.
+
+   All available :class:`Dialect` names are returned by :func:`list_dialects`,
+   and they can be registered with specific :class:`reader` and :class:`writer`
+   classes through their initializer (``__init__``) functions like this::
+
+       import csv
+
+       with open('students.csv', 'w', newline='') as csvfile:
+           writer = csv.writer(csvfile, dialect='unix')
+                                        ^^^^^^^^^^^^^^
 
 
 .. class:: excel()
@@ -269,6 +281,20 @@
 
       Analyze the sample text (presumed to be in CSV format) and return
       :const:`True` if the first row appears to be a series of column headers.
+      Inspecting each column, one of two key criteria will be considered to
+      estimate if the sample contains a header:
+
+        - the second through n-th rows contain numeric values
+        - the second through n-th rows contain strings where at least one value's
+          length differs from that of the putative header of that column.
+
+      Twenty rows after the first row are sampled; if more than half of columns +
+      rows meet the criteria, :const:`True` is returned.
+
+   .. note::
+
+      This method is a rough heuristic and may produce both false positives and
+      negatives.
 
 An example for :class:`Sniffer` use::
 
@@ -405,8 +431,8 @@
 
    Return the next row of the reader's iterable object as a list (if the object
    was returned from :func:`reader`) or a dict (if it is a :class:`DictReader`
-   instance), parsed according to the current dialect.  Usually you should call
-   this as ``next(reader)``.
+   instance), parsed according to the current :class:`Dialect`.  Usually you
+   should call this as ``next(reader)``.
 
 
 Reader objects have the following public attributes:
@@ -446,9 +472,9 @@
 
 .. method:: csvwriter.writerow(row)
 
-   Write the *row* parameter to the writer's file object, formatted according to
-   the current dialect. Return the return value of the call to the *write* method
-   of the underlying file object.
+   Write the *row* parameter to the writer's file object, formatted according
+   to the current :class:`Dialect`. Return the return value of the call to the
+   *write* method of the underlying file object.
 
    .. versionchanged:: 3.5
       Added support of arbitrary iterables.
diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst
index bf32d3e..c10e54f 100644
--- a/Doc/library/ctypes.rst
+++ b/Doc/library/ctypes.rst
@@ -20,7 +20,7 @@
 
 Note: The code samples in this tutorial use :mod:`doctest` to make sure that
 they actually work.  Since some code samples behave differently under Linux,
-Windows, or Mac OS X, they contain doctest directives in comments.
+Windows, or macOS, they contain doctest directives in comments.
 
 Note: Some code samples reference the ctypes :class:`c_int` type.  On platforms
 where ``sizeof(long) == sizeof(int)`` it is an alias to :class:`c_long`.
@@ -80,7 +80,7 @@
    <CDLL 'libc.so.6', handle ... at ...>
    >>>
 
-.. XXX Add section for Mac OS X.
+.. XXX Add section for macOS.
 
 
 .. _ctypes-accessing-functions-from-loaded-dlls:
@@ -919,9 +919,9 @@
 other, and finally follow the pointer chain a few times::
 
    >>> c1 = cell()
-   >>> c1.name = "foo"
+   >>> c1.name = b"foo"
    >>> c2 = cell()
-   >>> c2.name = "bar"
+   >>> c2.name = b"bar"
    >>> c1.next = pointer(c2)
    >>> c2.next = pointer(c1)
    >>> p = c1
@@ -1288,7 +1288,7 @@
    'libbz2.so.1.0'
    >>>
 
-On OS X, :func:`find_library` tries several predefined naming schemes and paths
+On macOS, :func:`find_library` tries several predefined naming schemes and paths
 to locate the library, and returns a full pathname if successful::
 
    >>> from ctypes.util import find_library
@@ -1320,7 +1320,7 @@
 way is to instantiate one of the following classes:
 
 
-.. class:: CDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False, winmode=0)
+.. class:: CDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False, winmode=None)
 
    Instances of this class represent loaded shared libraries. Functions in these
    libraries use the standard C calling convention, and are assumed to return
@@ -1342,7 +1342,7 @@
     -- A tool to find DLL dependents.
 
 
-.. class:: OleDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False, winmode=0)
+.. class:: OleDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False, winmode=None)
 
    Windows only: Instances of this class represent loaded shared libraries,
    functions in these libraries use the ``stdcall`` calling convention, and are
@@ -1355,7 +1355,7 @@
       :exc:`WindowsError` used to be raised.
 
 
-.. class:: WinDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False, winmode=0)
+.. class:: WinDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False, winmode=None)
 
    Windows only: Instances of this class represent loaded shared libraries,
    functions in these libraries use the ``stdcall`` calling convention, and are
@@ -2508,7 +2508,7 @@
 Arrays and pointers
 ^^^^^^^^^^^^^^^^^^^
 
-.. class:: Array(\*args)
+.. class:: Array(*args)
 
    Abstract base class for arrays.
 
diff --git a/Doc/library/curses.rst b/Doc/library/curses.rst
index 7a13295..efbece4 100644
--- a/Doc/library/curses.rst
+++ b/Doc/library/curses.rst
@@ -112,14 +112,15 @@
 .. function:: color_content(color_number)
 
    Return the intensity of the red, green, and blue (RGB) components in the color
-   *color_number*, which must be between ``0`` and :const:`COLORS`.  Return a 3-tuple,
+   *color_number*, which must be between ``0`` and ``COLORS - 1``.  Return a 3-tuple,
    containing the R,G,B values for the given color, which will be between
    ``0`` (no component) and ``1000`` (maximum amount of component).
 
 
-.. function:: color_pair(color_number)
+.. function:: color_pair(pair_number)
 
-   Return the attribute value for displaying text in the specified color.  This
+   Return the attribute value for displaying text in the specified color pair.
+   Only the first 256 color pairs are supported. This
    attribute value can be combined with :const:`A_STANDOUT`, :const:`A_REVERSE`,
    and the other :const:`A_\*` attributes.  :func:`pair_number` is the counterpart
    to this function.
@@ -219,11 +220,15 @@
    multiple devices, and *x*, *y*, *z* are the event's coordinates.  (*z* is
    currently unused.)  *bstate* is an integer value whose bits will be set to
    indicate the type of event, and will be the bitwise OR of one or more of the
-   following constants, where *n* is the button number from 1 to 4:
+   following constants, where *n* is the button number from 1 to 5:
    :const:`BUTTONn_PRESSED`, :const:`BUTTONn_RELEASED`, :const:`BUTTONn_CLICKED`,
    :const:`BUTTONn_DOUBLE_CLICKED`, :const:`BUTTONn_TRIPLE_CLICKED`,
    :const:`BUTTON_SHIFT`, :const:`BUTTON_CTRL`, :const:`BUTTON_ALT`.
 
+   .. versionchanged:: 3.10
+      The ``BUTTON5_*`` constants are now exposed if they are provided by the
+      underlying curses library.
+
 
 .. function:: getsyx()
 
@@ -242,6 +247,15 @@
 
    Return ``True`` if the terminal can display colors; otherwise, return ``False``.
 
+.. function:: has_extended_color_support()
+
+   Return ``True`` if the module supports extended colors; otherwise, return
+   ``False``. Extended color support allows more than 256 color pairs for
+   terminals that support more than 16 colors (e.g. xterm-256color).
+
+   Extended color support requires ncurses version 6.1 or later.
+
+   .. versionadded:: 3.10
 
 .. function:: has_ic()
 
@@ -278,7 +292,7 @@
    Change the definition of a color, taking the number of the color to be changed
    followed by three RGB values (for the amounts of red, green, and blue
    components).  The value of *color_number* must be between ``0`` and
-   :const:`COLORS`.  Each of *r*, *g*, *b*, must be a value between ``0`` and
+   `COLORS - 1`.  Each of *r*, *g*, *b*, must be a value between ``0`` and
    ``1000``.  When :func:`init_color` is used, all occurrences of that color on the
    screen immediately change to the new definition.  This function is a no-op on
    most terminals; it is active only if :func:`can_change_color` returns ``True``.
@@ -291,7 +305,8 @@
    color number.  The value of *pair_number* must be between ``1`` and
    ``COLOR_PAIRS - 1`` (the ``0`` color pair is wired to white on black and cannot
    be changed).  The value of *fg* and *bg* arguments must be between ``0`` and
-   :const:`COLORS`.  If the color-pair was previously initialized, the screen is
+   ``COLORS - 1``, or, after calling :func:`use_default_colors`, ``-1``.
+   If the color-pair was previously initialized, the screen is
    refreshed and all occurrences of that color-pair are changed to the new
    definition.
 
@@ -441,7 +456,7 @@
 .. function:: pair_content(pair_number)
 
    Return a tuple ``(fg, bg)`` containing the colors for the requested color pair.
-   The value of *pair_number* must be between ``1`` and ``COLOR_PAIRS - 1``.
+   The value of *pair_number* must be between ``0`` and ``COLOR_PAIRS - 1``.
 
 
 .. function:: pair_number(attr)
@@ -900,6 +915,9 @@
    determining what subset of the screen windows enclose the location of a mouse
    event.
 
+   .. versionchanged:: 3.10
+      Previously it returned ``1`` or ``0`` instead of ``True`` or ``False``.
+
 
 .. attribute:: window.encoding
 
diff --git a/Doc/library/dataclasses.rst b/Doc/library/dataclasses.rst
index e706f7f..1fe5bda 100644
--- a/Doc/library/dataclasses.rst
+++ b/Doc/library/dataclasses.rst
@@ -17,7 +17,7 @@
 in :pep:`557`.
 
 The member variables to use in these generated methods are defined
-using :pep:`526` type annotations.  For example this code::
+using :pep:`526` type annotations.  For example, this code::
 
   from dataclasses import dataclass
 
@@ -31,9 +31,9 @@
       def total_cost(self) -> float:
           return self.unit_price * self.quantity_on_hand
 
-Will add, among other things, a :meth:`__init__` that looks like::
+will add, among other things, a :meth:`__init__` that looks like::
 
-  def __init__(self, name: str, unit_price: float, quantity_on_hand: int=0):
+  def __init__(self, name: str, unit_price: float, quantity_on_hand: int = 0):
       self.name = name
       self.unit_price = unit_price
       self.quantity_on_hand = quantity_on_hand
@@ -43,16 +43,16 @@
 
 .. versionadded:: 3.7
 
-Module-level decorators, classes, and functions
------------------------------------------------
+Module contents
+---------------
 
-.. decorator:: dataclass(*, init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False)
+.. decorator:: dataclass(*, init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False, match_args=True, kw_only=False, slots=False)
 
    This function is a :term:`decorator` that is used to add generated
    :term:`special method`\s to classes, as described below.
 
    The :func:`dataclass` decorator examines the class to find
-   ``field``\s.  A ``field`` is defined as class variable that has a
+   ``field``\s.  A ``field`` is defined as a class variable that has a
    :term:`type annotation <variable annotation>`.  With two
    exceptions described below, nothing in :func:`dataclass`
    examines the type specified in the variable annotation.
@@ -62,8 +62,8 @@
 
    The :func:`dataclass` decorator will add various "dunder" methods to
    the class, described below.  If any of the added methods already
-   exist on the class, the behavior depends on the parameter, as documented
-   below. The decorator returns the same class that is called on; no new
+   exist in the class, the behavior depends on the parameter, as documented
+   below. The decorator returns the same class that it is called on; no new
    class is created.
 
    If :func:`dataclass` is used just as a simple decorator with no parameters,
@@ -79,7 +79,7 @@
      class C:
          ...
 
-     @dataclass(init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False)
+     @dataclass(init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False, match_args=True, kw_only=False, slots=False)
      class C:
         ...
 
@@ -136,7 +136,7 @@
      attribute ``__hash__ = None`` has a specific meaning to Python, as
      described in the :meth:`__hash__` documentation.
 
-     If :meth:`__hash__` is not explicit defined, or if it is set to ``None``,
+     If :meth:`__hash__` is not explicitly defined, or if it is set to ``None``,
      then :func:`dataclass` *may* add an implicit :meth:`__hash__` method.
      Although not recommended, you can force :func:`dataclass` to create a
      :meth:`__hash__` method with ``unsafe_hash=True``. This might be the case
@@ -161,6 +161,33 @@
      :meth:`__setattr__` or :meth:`__delattr__` is defined in the class, then
      :exc:`TypeError` is raised.  See the discussion below.
 
+   - ``match_args``: If true (the default is ``True``), the
+     ``__match_args__`` tuple will be created from the list of
+     parameters to the generated :meth:`__init__` method (even if
+     :meth:`__init__` is not generated, see above).  If false, or if
+     ``__match_args__`` is already defined in the class, then
+     ``__match_args__`` will not be generated.
+
+    .. versionadded:: 3.10
+
+   - ``kw_only``: If true (the default value is ``False``), then all
+     fields will be marked as keyword-only.  If a field is marked as
+     keyword-only, then the only affect is that the :meth:`__init__`
+     parameter generated from a keyword-only field must be specified
+     with a keyword when :meth:`__init__` is called.  There is no
+     effect on any other aspect of dataclasses.  See the
+     :term:`parameter` glossary entry for details.  Also see the
+     :const:`KW_ONLY` section.
+
+    .. versionadded:: 3.10
+
+   - ``slots``: If true (the default is ``False``), :attr:`__slots__` attribute
+     will be generated and new class will be returned instead of the original one.
+     If :attr:`__slots__` is already defined in the class, then :exc:`TypeError`
+     is raised.
+
+    .. versionadded:: 3.10
+
    ``field``\s may optionally specify a default value, using normal
    Python syntax::
 
@@ -175,10 +202,10 @@
      def __init__(self, a: int, b: int = 0):
 
    :exc:`TypeError` will be raised if a field without a default value
-   follows a field with a default value.  This is true either when this
+   follows a field with a default value.  This is true whether this
    occurs in a single class, or as a result of class inheritance.
 
-.. function:: field(*, default=MISSING, default_factory=MISSING, repr=True, hash=None, init=True, compare=True, metadata=None)
+.. function:: field(*, default=MISSING, default_factory=MISSING, init=True, repr=True, hash=None, compare=True, metadata=None, kw_only=MISSING)
 
    For common and simple use cases, no other functionality is
    required.  There are, however, some dataclass features that
@@ -193,11 +220,10 @@
      c = C()
      c.mylist += [1, 2, 3]
 
-   As shown above, the ``MISSING`` value is a sentinel object used to
-   detect if the ``default`` and ``default_factory`` parameters are
-   provided.  This sentinel is used because ``None`` is a valid value
-   for ``default``.  No code should directly use the ``MISSING``
-   value.
+   As shown above, the :const:`MISSING` value is a sentinel object used to
+   detect if some parameters are provided by the user. This sentinel is
+   used because ``None`` is a valid value for some parameters with
+   a distinct meaning.  No code should directly use the :const:`MISSING` value.
 
    The parameters to :func:`field` are:
 
@@ -217,10 +243,6 @@
    - ``repr``: If true (the default), this field is included in the
      string returned by the generated :meth:`__repr__` method.
 
-   - ``compare``: If true (the default), this field is included in the
-     generated equality and comparison methods (:meth:`__eq__`,
-     :meth:`__gt__`, et al.).
-
    - ``hash``: This can be a bool or ``None``.  If true, this field is
      included in the generated :meth:`__hash__` method.  If ``None`` (the
      default), use the value of ``compare``: this would normally be
@@ -234,6 +256,10 @@
      fields that contribute to the type's hash value.  Even if a field
      is excluded from the hash, it will still be used for comparisons.
 
+   - ``compare``: If true (the default), this field is included in the
+     generated equality and comparison methods (:meth:`__eq__`,
+     :meth:`__gt__`, et al.).
+
    - ``metadata``: This can be a mapping or None. None is treated as
      an empty dict.  This value is wrapped in
      :func:`~types.MappingProxyType` to make it read-only, and exposed
@@ -242,6 +268,12 @@
      Multiple third-parties can each have their own key, to use as a
      namespace in the metadata.
 
+   - ``kw_only``: If true, this field will be marked as keyword-only.
+     This is used when the generated :meth:`__init__` method's
+     parameters are computed.
+
+    .. versionadded:: 3.10
+
    If the default value of a field is specified by a call to
    :func:`field()`, then the class attribute for this field will be
    replaced by the specified ``default`` value.  If no ``default`` is
@@ -274,8 +306,8 @@
      - ``type``: The type of the field.
 
      - ``default``, ``default_factory``, ``init``, ``repr``, ``hash``,
-       ``compare``, and ``metadata`` have the identical meaning and
-       values as they do in the :func:`field` declaration.
+       ``compare``, ``metadata``, and ``kw_only`` have the identical
+       meaning and values as they do in the :func:`field` function.
 
    Other attributes may exist, but they are private and must not be
    inspected or relied on.
@@ -287,12 +319,15 @@
    Raises :exc:`TypeError` if not passed a dataclass or instance of one.
    Does not return pseudo-fields which are ``ClassVar`` or ``InitVar``.
 
-.. function:: asdict(instance, *, dict_factory=dict)
+.. function:: asdict(obj, *, dict_factory=dict)
 
-   Converts the dataclass ``instance`` to a dict (by using the
+   Converts the dataclass ``obj`` to a dict (by using the
    factory function ``dict_factory``).  Each dataclass is converted
    to a dict of its fields, as ``name: value`` pairs.  dataclasses, dicts,
-   lists, and tuples are recursed into.  For example::
+   lists, and tuples are recursed into.  Other objects are copied with
+   :func:`copy.deepcopy`.
+
+   Example of using :func:`asdict` on nested dataclasses::
 
      @dataclass
      class Point:
@@ -309,23 +344,34 @@
      c = C([Point(0, 0), Point(10, 4)])
      assert asdict(c) == {'mylist': [{'x': 0, 'y': 0}, {'x': 10, 'y': 4}]}
 
-   Raises :exc:`TypeError` if ``instance`` is not a dataclass instance.
+   To create a shallow copy, the following workaround may be used::
 
-.. function:: astuple(instance, *, tuple_factory=tuple)
+     dict((field.name, getattr(obj, field.name)) for field in fields(obj))
 
-   Converts the dataclass ``instance`` to a tuple (by using the
+   :func:`asdict` raises :exc:`TypeError` if ``obj`` is not a dataclass
+   instance.
+
+.. function:: astuple(obj, *, tuple_factory=tuple)
+
+   Converts the dataclass ``obj`` to a tuple (by using the
    factory function ``tuple_factory``).  Each dataclass is converted
    to a tuple of its field values.  dataclasses, dicts, lists, and
-   tuples are recursed into.
+   tuples are recursed into. Other objects are copied with
+   :func:`copy.deepcopy`.
 
    Continuing from the previous example::
 
      assert astuple(p) == (10, 20)
      assert astuple(c) == ([(0, 0), (10, 4)],)
 
-   Raises :exc:`TypeError` if ``instance`` is not a dataclass instance.
+   To create a shallow copy, the following workaround may be used::
 
-.. function:: make_dataclass(cls_name, fields, *, bases=(), namespace=None, init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False)
+     tuple(getattr(obj, field.name) for field in dataclasses.fields(obj))
+
+   :func:`astuple` raises :exc:`TypeError` if ``obj`` is not a dataclass
+   instance.
+
+.. function:: make_dataclass(cls_name, fields, *, bases=(), namespace=None, init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False, match_args=True, kw_only=False, slots=False)
 
    Creates a new dataclass with name ``cls_name``, fields as defined
    in ``fields``, base classes as given in ``bases``, and initialized
@@ -333,8 +379,9 @@
    iterable whose elements are each either ``name``, ``(name, type)``,
    or ``(name, type, Field)``.  If just ``name`` is supplied,
    ``typing.Any`` is used for ``type``.  The values of ``init``,
-   ``repr``, ``eq``, ``order``, ``unsafe_hash``, and ``frozen`` have
-   the same meaning as they do in :func:`dataclass`.
+   ``repr``, ``eq``, ``order``, ``unsafe_hash``, ``frozen``,
+   ``match_args``, ``kw_only``, and  ``slots`` have the same meaning as
+   they do in :func:`dataclass`.
 
    This function is not strictly required, because any Python
    mechanism for creating a new class with ``__annotations__`` can
@@ -359,10 +406,10 @@
          def add_one(self):
              return self.x + 1
 
-.. function:: replace(instance, /, **changes)
+.. function:: replace(obj, /, **changes)
 
-   Creates a new object of the same type of ``instance``, replacing
-   fields with values from ``changes``.  If ``instance`` is not a Data
+   Creates a new object of the same type as ``obj``, replacing
+   fields with values from ``changes``.  If ``obj`` is not a Data
    Class, raises :exc:`TypeError`.  If values in ``changes`` do not
    specify fields, raises :exc:`TypeError`.
 
@@ -387,7 +434,7 @@
    ``replace()`` (or similarly named) method which handles instance
    copying.
 
-.. function:: is_dataclass(class_or_instance)
+.. function:: is_dataclass(obj)
 
    Return ``True`` if its parameter is a dataclass or an instance of one,
    otherwise return ``False``.
@@ -399,6 +446,43 @@
      def is_dataclass_instance(obj):
          return is_dataclass(obj) and not isinstance(obj, type)
 
+.. data:: MISSING
+
+   A sentinel value signifying a missing default or default_factory.
+
+.. data:: KW_ONLY
+
+   A sentinel value used as a type annotation.  Any fields after a
+   pseudo-field with the type of :const:`KW_ONLY` are marked as
+   keyword-only fields.  Note that a pseudo-field of type
+   :const:`KW_ONLY` is otherwise completely ignored.  This includes the
+   name of such a field.  By convention, a name of ``_`` is used for a
+   :const:`KW_ONLY` field.  Keyword-only fields signify
+   :meth:`__init__` parameters that must be specified as keywords when
+   the class is instantiated.
+
+   In this example, the fields ``y`` and ``z`` will be marked as keyword-only fields::
+
+    @dataclass
+    class Point:
+      x: float
+      _: KW_ONLY
+      y: float
+      z: float
+
+    p = Point(0, y=1.5, z=2.0)
+
+   In a single dataclass, it is an error to specify more than one
+   field whose type is :const:`KW_ONLY`.
+
+   .. versionadded:: 3.10
+
+.. exception:: FrozenInstanceError
+
+   Raised when an implicitly defined :meth:`__setattr__` or
+   :meth:`__delattr__` is called on a dataclass which was defined with
+   ``frozen=True``. It is a subclass of :exc:`AttributeError`.
+
 Post-init processing
 --------------------
 
@@ -422,6 +506,27 @@
         def __post_init__(self):
             self.c = self.a + self.b
 
+The :meth:`__init__` method generated by :func:`dataclass` does not call base
+class :meth:`__init__` methods. If the base class has an :meth:`__init__` method
+that has to be called, it is common to call this method in a
+:meth:`__post_init__` method::
+
+    @dataclass
+    class Rectangle:
+        height: float
+        width: float
+
+    @dataclass
+    class Square(Rectangle):
+        side: float
+
+        def __post_init__(self):
+            super().__init__(self.side, self.side)
+
+Note, however, that in general the dataclass-generated :meth:`__init__` methods
+don't need to be called, since the derived dataclass will take care of
+initializing all fields of any base class that is a dataclass itself.
+
 See the section below on init-only variables for ways to pass
 parameters to :meth:`__post_init__`.  Also see the warning about how
 :func:`replace` handles ``init=False`` fields.
@@ -511,6 +616,42 @@
 
   def __init__(self, x: int = 15, y: int = 0, z: int = 10):
 
+Re-ordering of keyword-only parameters in :meth:`__init__`
+----------------------------------------------------------
+
+After the parameters needed for :meth:`__init__` are computed, any
+keyword-only parameters are moved to come after all regular
+(non-keyword-only) parameters.  This is a requirement of how
+keyword-only parameters are implemented in Python: they must come
+after non-keyword-only parameters.
+
+In this example, ``Base.y``, ``Base.w``, and ``D.t`` are keyword-only
+fields, and ``Base.x`` and ``D.z`` are regular fields::
+
+  @dataclass
+  class Base:
+      x: Any = 15.0
+      _: KW_ONLY
+      y: int = 0
+      w: int = 1
+
+  @dataclass
+  class D(Base):
+      z: int = 10
+      t: int = field(kw_only=True, default=0)
+
+The generated :meth:`__init__` method for ``D`` will look like::
+
+  def __init__(self, x: Any = 15.0, z: int = 10, *, y: int = 0, w: int = 1, t: int = 0):
+
+Note that the parameters have been re-ordered from how they appear in
+the list of fields: parameters derived from regular fields are
+followed by parameters derived from keyword-only fields.
+
+The relative ordering of keyword-only parameters is maintained in the
+re-ordered :meth:`__init__` parameter list.
+
+
 Default factory functions
 -------------------------
 
@@ -567,14 +708,15 @@
      assert D().x is D().x
 
    This has the same issue as the original example using class ``C``.
-   That is, two instances of class ``D`` that do not specify a value for
-   ``x`` when creating a class instance will share the same copy of
-   ``x``.  Because dataclasses just use normal Python class creation
-   they also share this behavior.  There is no general way for Data
-   Classes to detect this condition.  Instead, dataclasses will raise a
-   :exc:`TypeError` if it detects a default parameter of type ``list``,
-   ``dict``, or ``set``.  This is a partial solution, but it does protect
-   against many common errors.
+   That is, two instances of class ``D`` that do not specify a value
+   for ``x`` when creating a class instance will share the same copy
+   of ``x``.  Because dataclasses just use normal Python class
+   creation they also share this behavior.  There is no general way
+   for Data Classes to detect this condition.  Instead, the
+   :func:`dataclass` decorator will raise a :exc:`TypeError` if it
+   detects a default parameter of type ``list``, ``dict``, or ``set``.
+   This is a partial solution, but it does protect against many common
+   errors.
 
    Using default factory functions is a way to create new instances of
    mutable types as default values for fields::
@@ -584,12 +726,3 @@
          x: list = field(default_factory=list)
 
      assert D().x is not D().x
-
-Exceptions
-----------
-
-.. exception:: FrozenInstanceError
-
-   Raised when an implicitly defined :meth:`__setattr__` or
-   :meth:`__delattr__` is called on a dataclass which was defined with
-   ``frozen=True``.
diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst
index 508bc88..f447b7b 100644
--- a/Doc/library/datetime.rst
+++ b/Doc/library/datetime.rst
@@ -27,6 +27,9 @@
    Module :mod:`time`
       Time access and conversions.
 
+   Module :mod:`zoneinfo`
+      Concrete time zones representing the IANA time zone database.
+
    Package `dateutil <https://dateutil.readthedocs.io/en/stable/>`_
       Third-party library with expanded time zone and parsing support.
 
@@ -1219,7 +1222,7 @@
 
 .. method:: datetime.replace(year=self.year, month=self.month, day=self.day, \
    hour=self.hour, minute=self.minute, second=self.second, microsecond=self.microsecond, \
-   tzinfo=self.tzinfo, * fold=0)
+   tzinfo=self.tzinfo, *, fold=0)
 
    Return a datetime with the same attributes, except for those attributes given
    new values by whichever keyword arguments are specified. Note that
@@ -1783,7 +1786,7 @@
 Instance methods:
 
 .. method:: time.replace(hour=self.hour, minute=self.minute, second=self.second, \
-   microsecond=self.microsecond, tzinfo=self.tzinfo, * fold=0)
+   microsecond=self.microsecond, tzinfo=self.tzinfo, *, fold=0)
 
    Return a :class:`.time` with the same value, except for those attributes given
    new values by whichever keyword arguments are specified. Note that
@@ -2174,14 +2177,13 @@
 
 .. seealso::
 
-   `dateutil.tz <https://dateutil.readthedocs.io/en/stable/tz.html>`_
+    :mod:`zoneinfo`
       The :mod:`datetime` module has a basic :class:`timezone` class (for
       handling arbitrary fixed offsets from UTC) and its :attr:`timezone.utc`
       attribute (a UTC timezone instance).
 
-      *dateutil.tz* library brings the *IANA timezone database*
-      (also known as the Olson database) to Python, and its usage is
-      recommended.
+      ``zoneinfo`` brings the *IANA timezone database* (also known as the Olson
+      database) to Python, and its usage is recommended.
 
    `IANA timezone database <https://www.iana.org/time-zones>`_
       The Time Zone Database (often called tz, tzdata or zoneinfo) contains code
@@ -2357,8 +2359,8 @@
 |           | decimal number.                |                        | \(9)  |
 +-----------+--------------------------------+------------------------+-------+
 | ``%f``    | Microsecond as a decimal       | 000000, 000001, ...,   | \(5)  |
-|           | number, zero-padded on the     | 999999                 |       |
-|           | left.                          |                        |       |
+|           | number, zero-padded to 6       | 999999                 |       |
+|           | digits.                        |                        |       |
 +-----------+--------------------------------+------------------------+-------+
 | ``%z``    | UTC offset in the form         | (empty), +0000,        | \(6)  |
 |           | ``±HHMM[SS[.ffffff]]`` (empty  | -0400, +1030,          |       |
@@ -2373,7 +2375,7 @@
 +-----------+--------------------------------+------------------------+-------+
 | ``%U``    | Week number of the year        | 00, 01, ..., 53        | \(7), |
 |           | (Sunday as the first day of    |                        | \(9)  |
-|           | the week) as a zero padded     |                        |       |
+|           | the week) as a zero-padded     |                        |       |
 |           | decimal number. All days in a  |                        |       |
 |           | new year preceding the first   |                        |       |
 |           | Sunday are considered to be in |                        |       |
@@ -2381,10 +2383,10 @@
 +-----------+--------------------------------+------------------------+-------+
 | ``%W``    | Week number of the year        | 00, 01, ..., 53        | \(7), |
 |           | (Monday as the first day of    |                        | \(9)  |
-|           | the week) as a decimal number. |                        |       |
-|           | All days in a new year         |                        |       |
-|           | preceding the first Monday     |                        |       |
-|           | are considered to be in        |                        |       |
+|           | the week) as a zero-padded     |                        |       |
+|           | decimal number. All days in a  |                        |       |
+|           | new year preceding the first   |                        |       |
+|           | Monday are considered to be in |                        |       |
 |           | week 0.                        |                        |       |
 +-----------+--------------------------------+------------------------+-------+
 | ``%c``    | Locale's appropriate date and  || Tue Aug 16 21:30:00   | \(1)  |
@@ -2431,7 +2433,8 @@
 The full set of format codes supported varies across platforms, because Python
 calls the platform C library's :func:`strftime` function, and platform
 variations are common. To see the full set of format codes supported on your
-platform, consult the :manpage:`strftime(3)` documentation.
+platform, consult the :manpage:`strftime(3)` documentation. There are also
+differences between platforms in handling of unsupported format specifiers.
 
 .. versionadded:: 3.6
    ``%G``, ``%u`` and ``%V`` were added.
diff --git a/Doc/library/dbm.rst b/Doc/library/dbm.rst
index 57ae547..ff01ae9 100644
--- a/Doc/library/dbm.rst
+++ b/Doc/library/dbm.rst
@@ -216,7 +216,7 @@
       contains them all::
 
          k = db.firstkey()
-         while k != None:
+         while k is not None:
              print(k)
              k = db.nextkey(k)
 
diff --git a/Doc/library/decimal.rst b/Doc/library/decimal.rst
index e194649..e759c5c 100644
--- a/Doc/library/decimal.rst
+++ b/Doc/library/decimal.rst
@@ -1484,7 +1484,8 @@
 
 .. data:: HAVE_CONTEXTVAR
 
-   The default value is ``True``. If Python is compiled ``--without-decimal-contextvar``,
+   The default value is ``True``. If Python is :option:`configured using
+   the --without-decimal-contextvar option <--without-decimal-contextvar>`,
    the C version uses a thread-local rather than a coroutine-local context and the value
    is ``False``.  This is slightly faster in some nested context scenarios.
 
diff --git a/Doc/library/devmode.rst b/Doc/library/devmode.rst
index d5a40cd..44e7d4f 100644
--- a/Doc/library/devmode.rst
+++ b/Doc/library/devmode.rst
@@ -13,6 +13,8 @@
 It can be enabled using the :option:`-X dev <-X>` command line option or by
 setting the :envvar:`PYTHONDEVMODE` environment variable to ``1``.
 
+See also :ref:`Python debug build <debug-build>`.
+
 Effects of the Python Development Mode
 ======================================
 
@@ -93,6 +95,9 @@
 option from removing :keyword:`assert` statements nor from setting
 :const:`__debug__` to ``False``.
 
+The Python Development Mode can only be enabled at the Python startup. Its
+value can be read from :data:`sys.flags.dev_mode <sys.flags>`.
+
 .. versionchanged:: 3.8
    The :class:`io.IOBase` destructor now logs ``close()`` exceptions.
 
diff --git a/Doc/library/dialog.rst b/Doc/library/dialog.rst
index dc82a97..53f98c1 100644
--- a/Doc/library/dialog.rst
+++ b/Doc/library/dialog.rst
@@ -198,7 +198,7 @@
    A subclass of FileDialog that creates a dialog window for selecting a
    destination file.
 
-    .. method:: ok_command()
+   .. method:: ok_command()
 
       Test whether or not the selection points to a valid file that is not a
       directory. Confirmation is required if an already existing file is
diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst
index c1e72d1..74820f9 100644
--- a/Doc/library/dis.rst
+++ b/Doc/library/dis.rst
@@ -346,7 +346,7 @@
 
 .. opcode:: ROT_FOUR
 
-   Lifts second, third and forth stack items one position up, moves top down
+   Lifts second, third and fourth stack items one position up, moves top down
    to position four.
 
    .. versionadded:: 3.8
@@ -708,7 +708,8 @@
 
 .. opcode:: RERAISE
 
-    Re-raises the exception currently on top of the stack.
+    Re-raises the exception currently on top of the stack. If oparg is non-zero,
+    restores ``f_lasti`` of the current frame to its value when the exception was raised.
 
     .. versionadded:: 3.9
 
@@ -741,7 +742,7 @@
 
    This opcode performs several operations before a with block starts.  First,
    it loads :meth:`~object.__exit__` from the context manager and pushes it onto
-   the stack for later use by :opcode:`WITH_CLEANUP_START`.  Then,
+   the stack for later use by :opcode:`WITH_EXCEPT_START`.  Then,
    :meth:`~object.__enter__` is called, and a finally block pointing to *delta*
    is pushed.  Finally, the result of calling the ``__enter__()`` method is pushed onto
    the stack.  The next opcode will either ignore it (:opcode:`POP_TOP`), or
@@ -751,6 +752,52 @@
    .. versionadded:: 3.2
 
 
+.. opcode:: COPY_DICT_WITHOUT_KEYS
+
+   TOS is a tuple of mapping keys, and TOS1 is the match subject.  Replace TOS
+   with a :class:`dict` formed from the items of TOS1, but without any of the
+   keys in TOS.
+
+   .. versionadded:: 3.10
+
+
+.. opcode:: GET_LEN
+
+   Push ``len(TOS)`` onto the stack.
+
+   .. versionadded:: 3.10
+
+
+.. opcode:: MATCH_MAPPING
+
+   If TOS is an instance of :class:`collections.abc.Mapping` (or, more technically: if
+   it has the :const:`Py_TPFLAGS_MAPPING` flag set in its
+   :c:member:`~PyTypeObject.tp_flags`), push ``True`` onto the stack.  Otherwise, push
+   ``False``.
+
+   .. versionadded:: 3.10
+
+
+.. opcode:: MATCH_SEQUENCE
+
+   If TOS is an instance of :class:`collections.abc.Sequence` and is *not* an instance
+   of :class:`str`/:class:`bytes`/:class:`bytearray` (or, more technically: if it has
+   the :const:`Py_TPFLAGS_SEQUENCE` flag set in its :c:member:`~PyTypeObject.tp_flags`),
+   push ``True`` onto the stack.  Otherwise, push ``False``.
+
+   .. versionadded:: 3.10
+
+
+.. opcode:: MATCH_KEYS
+
+   TOS is a tuple of mapping keys, and TOS1 is the match subject.  If TOS1
+   contains all of the keys in TOS, push a :class:`tuple` containing the
+   corresponding values, followed by ``True``. Otherwise, push ``None``,
+   followed by ``False``.
+
+   .. versionadded:: 3.10
+
+
 All of the following opcodes use their arguments.
 
 .. opcode:: STORE_NAME (namei)
@@ -1144,11 +1191,13 @@
    * ``0x01`` a tuple of default values for positional-only and
      positional-or-keyword parameters in positional order
    * ``0x02`` a dictionary of keyword-only parameters' default values
-   * ``0x04`` an annotation dictionary
+   * ``0x04`` a tuple of strings containing parameters' annotations
    * ``0x08`` a tuple containing cells for free variables, making a closure
    * the code associated with the function (at TOS1)
    * the :term:`qualified name` of the function (at TOS)
 
+   .. versionchanged:: 3.10
+      Flag value ``0x04`` is a tuple of strings instead of dictionary
 
 .. opcode:: BUILD_SLICE (argc)
 
@@ -1189,6 +1238,35 @@
    .. versionadded:: 3.6
 
 
+.. opcode:: MATCH_CLASS (count)
+
+   TOS is a tuple of keyword attribute names, TOS1 is the class being matched
+   against, and TOS2 is the match subject.  *count* is the number of positional
+   sub-patterns.
+
+   Pop TOS.  If TOS2 is an instance of TOS1 and has the positional and keyword
+   attributes required by *count* and TOS, set TOS to ``True`` and TOS1 to a
+   tuple of extracted attributes.  Otherwise, set TOS to ``False``.
+
+   .. versionadded:: 3.10
+
+.. opcode:: GEN_START (kind)
+
+    Pops TOS. The ``kind`` operand corresponds to the type of generator or
+    coroutine. The legal kinds are 0 for generator, 1 for coroutine,
+    and 2 for async generator.
+
+   .. versionadded:: 3.10
+
+
+.. opcode:: ROT_N (count)
+
+   Lift the top *count* stack items one position up, and move TOS down to
+   position *count*.
+
+   .. versionadded:: 3.10
+
+
 .. opcode:: HAVE_ARGUMENT
 
    This is not really an opcode.  It identifies the dividing line between
diff --git a/Doc/library/distutils.rst b/Doc/library/distutils.rst
index 62abc85..31c4ae5 100644
--- a/Doc/library/distutils.rst
+++ b/Doc/library/distutils.rst
@@ -9,6 +9,11 @@
 
 --------------
 
+:mod:`distutils` is deprecated with removal planned for Python 3.12.
+See the :ref:`What's New <distutils-deprecated>` entry for more information.
+
+--------------
+
 The :mod:`distutils` package provides support for building and installing
 additional modules into a Python installation.  The new modules may be either
 100%-pure Python, or may be extension modules written in C, or may be
diff --git a/Doc/library/email.compat32-message.rst b/Doc/library/email.compat32-message.rst
index 745b3a6..c68e773 100644
--- a/Doc/library/email.compat32-message.rst
+++ b/Doc/library/email.compat32-message.rst
@@ -23,7 +23,7 @@
 you should be using the :class:`~email.message.EmailMessage` class instead.
 
 An email message consists of *headers* and a *payload*.  Headers must be
-:rfc:`5233` style names and values, where the field name and value are
+:rfc:`5322` style names and values, where the field name and value are
 separated by a colon.  The colon is not part of either the field name or the
 field value.  The payload may be a simple text message, or a binary object, or
 a structured sequence of sub-messages each with their own set of headers and
diff --git a/Doc/library/email.contentmanager.rst b/Doc/library/email.contentmanager.rst
index e09c7c0..918fc55 100644
--- a/Doc/library/email.contentmanager.rst
+++ b/Doc/library/email.contentmanager.rst
@@ -116,7 +116,7 @@
       decoding the payload to unicode.  The default error handler is
       ``replace``.
 
-   .. method:: set_content(msg, <'str'>, subtype="plain", charset='utf-8' \
+   .. method:: set_content(msg, <'str'>, subtype="plain", charset='utf-8', \
                            cte=None, \
                            disposition=None, filename=None, cid=None, \
                            params=None, headers=None)
diff --git a/Doc/library/email.errors.rst b/Doc/library/email.errors.rst
index f4b9f52..7a77640 100644
--- a/Doc/library/email.errors.rst
+++ b/Doc/library/email.errors.rst
@@ -112,3 +112,6 @@
 * :class:`InvalidBase64LengthDefect` -- When decoding a block of base64 encoded
   bytes, the number of non-padding base64 characters was invalid (1 more than
   a multiple of 4).  The encoded block was kept as-is.
+
+* :class:`InvalidDateDefect` -- When decoding an invalid or unparsable date field.
+  The original value is kept as-is.
\ No newline at end of file
diff --git a/Doc/library/email.headerregistry.rst b/Doc/library/email.headerregistry.rst
index 9376da2..3e1d97a 100644
--- a/Doc/library/email.headerregistry.rst
+++ b/Doc/library/email.headerregistry.rst
@@ -289,7 +289,7 @@
     A :class:`ParameterizedMIMEHeader` class that handles the
     :mailheader:`Content-Disposition` header.
 
-    .. attribute:: content-disposition
+    .. attribute:: content_disposition
 
        ``inline`` and ``attachment`` are the only valid values in common use.
 
diff --git a/Doc/library/email.policy.rst b/Doc/library/email.policy.rst
index 8e70762..bf53b95 100644
--- a/Doc/library/email.policy.rst
+++ b/Doc/library/email.policy.rst
@@ -210,7 +210,7 @@
       :meth:`register_defect` method.
 
 
-   .. attribute:: mangle_from\_
+   .. attribute:: mangle_from_
 
       If :const:`True`, lines starting with *"From "* in the body are
       escaped by putting a ``>`` in front of them. This parameter is used when
diff --git a/Doc/library/email.rst b/Doc/library/email.rst
index fae99cf..5eebcd9 100644
--- a/Doc/library/email.rst
+++ b/Doc/library/email.rst
@@ -16,7 +16,7 @@
 specifically *not* designed to do any sending of email messages to SMTP
 (:rfc:`2821`), NNTP, or other servers; those are functions of modules such as
 :mod:`smtplib` and :mod:`nntplib`.  The :mod:`email` package attempts to be as
-RFC-compliant as possible, supporting :rfc:`5233` and :rfc:`6532`, as well as
+RFC-compliant as possible, supporting :rfc:`5322` and :rfc:`6532`, as well as
 such MIME-related RFCs as :rfc:`2045`, :rfc:`2046`, :rfc:`2047`, :rfc:`2183`,
 and :rfc:`2231`.
 
diff --git a/Doc/library/email.utils.rst b/Doc/library/email.utils.rst
index 4d0e920..0e266b6 100644
--- a/Doc/library/email.utils.rst
+++ b/Doc/library/email.utils.rst
@@ -124,8 +124,10 @@
 .. function:: parsedate_to_datetime(date)
 
    The inverse of :func:`format_datetime`.  Performs the same function as
-   :func:`parsedate`, but on success returns a :mod:`~datetime.datetime`.  If
-   the input date has a timezone of ``-0000``, the ``datetime`` will be a naive
+   :func:`parsedate`, but on success returns a :mod:`~datetime.datetime`;
+   otherwise ``ValueError`` is raised if *date* contains an invalid value such
+   as an hour greater than 23 or a timezone offset not between -24 and 24 hours.
+   If the input date has a timezone of ``-0000``, the ``datetime`` will be a naive
    ``datetime``, and if the date is conforming to the RFCs it will represent a
    time in UTC but with no indication of the actual source timezone of the
    message the date comes from.  If the input date has any other valid timezone
diff --git a/Doc/library/ensurepip.rst b/Doc/library/ensurepip.rst
index a522125..fa1b42c 100644
--- a/Doc/library/ensurepip.rst
+++ b/Doc/library/ensurepip.rst
@@ -48,7 +48,7 @@
 
 This invocation will install ``pip`` if it is not already installed,
 but otherwise does nothing. To ensure the installed version of ``pip``
-is at least as recent as the one bundled with ``ensurepip``, pass the
+is at least as recent as the one available in ``ensurepip``, pass the
 ``--upgrade`` option::
 
     python -m ensurepip --upgrade
@@ -86,7 +86,7 @@
 
 .. function:: version()
 
-   Returns a string specifying the bundled version of pip that will be
+   Returns a string specifying the available version of pip that will be
    installed when bootstrapping an environment.
 
 .. function:: bootstrap(root=None, upgrade=False, user=False, \
@@ -100,7 +100,7 @@
    for the current environment.
 
    *upgrade* indicates whether or not to upgrade an existing installation
-   of an earlier version of ``pip`` to the bundled version.
+   of an earlier version of ``pip`` to the available version.
 
    *user* indicates whether to use the user scheme rather than installing
    globally.
diff --git a/Doc/library/enum.rst b/Doc/library/enum.rst
index a3c5165..7d166bf 100644
--- a/Doc/library/enum.rst
+++ b/Doc/library/enum.rst
@@ -56,7 +56,7 @@
     the bitwise operations without losing their :class:`Flag` membership.
 
 .. function:: unique
-   :noindex:
+    :noindex:
 
     Enum class decorator that ensures only one name is bound to any one value.
 
@@ -276,7 +276,7 @@
 
 .. note::
 
-    The goal of the default :meth:`_generate_next_value_` methods is to provide
+    The goal of the default :meth:`_generate_next_value_` method is to provide
     the next :class:`int` in sequence with the last :class:`int` provided, but
     the way it does this is an implementation detail and may change.
 
@@ -416,7 +416,7 @@
     ...
     Traceback (most recent call last):
     ...
-    TypeError: Cannot extend enumerations
+    TypeError: MoreColor: cannot extend enumeration 'Color'
 
 But this is allowed::
 
@@ -908,7 +908,7 @@
     ...     BLEACHED_CORAL = () # New color, no Pantone code yet!
     ...
     >>> Swatch.SEA_GREEN
-    <Swatch.SEA_GREEN: 2>
+    <Swatch.SEA_GREEN>
     >>> Swatch.SEA_GREEN.pantone
     '1246'
     >>> Swatch.BLEACHED_CORAL.pantone
@@ -1121,6 +1121,15 @@
     In Python 2 code the :attr:`_order_` attribute is necessary as definition
     order is lost before it can be recorded.
 
+
+_Private__names
+"""""""""""""""
+
+:ref:`Private names <private-name-mangling>` will be normal attributes in Python
+3.11 instead of either an error or a member (depending on if the name ends with
+an underscore). Using these names in 3.10 will issue a :exc:`DeprecationWarning`.
+
+
 ``Enum`` member type
 """"""""""""""""""""
 
@@ -1141,6 +1150,10 @@
     >>> FieldTypes.size.value
     2
 
+.. note::
+
+   This behavior is deprecated and will be removed in 3.11.
+
 .. versionchanged:: 3.5
 
 
@@ -1169,7 +1182,7 @@
     >>> dir(Planet)
     ['EARTH', 'JUPITER', 'MARS', 'MERCURY', 'NEPTUNE', 'SATURN', 'URANUS', 'VENUS', '__class__', '__doc__', '__members__', '__module__']
     >>> dir(Planet.EARTH)
-    ['__class__', '__doc__', '__module__', 'name', 'surface_gravity', 'value']
+    ['__class__', '__doc__', '__module__', 'mass', 'name', 'radius', 'surface_gravity', 'value']
 
 
 Combining members of ``Flag``
@@ -1191,3 +1204,9 @@
     >>> Color(7)      # not named combination
     <Color.CYAN|MAGENTA|BLUE|YELLOW|GREEN|RED: 7>
 
+.. note::
+
+   In 3.11 unnamed combinations of flags will only produce the canonical flag
+   members (aka single-value flags).  So ``Color(7)`` will produce something
+   like ``<Color.BLUE|GREEN|RED: 7>``.
+
diff --git a/Doc/library/exceptions.rst b/Doc/library/exceptions.rst
index df2cda9..2f97bb8 100644
--- a/Doc/library/exceptions.rst
+++ b/Doc/library/exceptions.rst
@@ -34,20 +34,23 @@
 information on defining exceptions is available in the Python Tutorial under
 :ref:`tut-userexceptions`.
 
-When raising (or re-raising) an exception in an :keyword:`except` or
-:keyword:`finally` clause
-:attr:`__context__` is automatically set to the last exception caught; if the
-new exception is not handled the traceback that is eventually displayed will
-include the originating exception(s) and the final exception.
 
-When raising a new exception (rather than using a bare ``raise`` to re-raise
-the exception currently being handled), the implicit exception context can be
-supplemented with an explicit cause by using :keyword:`from` with
+Exception context
+-----------------
+
+When raising a new exception while another exception
+is already being handled, the new exception's
+:attr:`__context__` attribute is automatically set to the handled
+exception.  An exception may be handled when an :keyword:`except` or
+:keyword:`finally` clause, or a :keyword:`with` statement, is used.
+
+This implicit exception context can be
+supplemented with an explicit cause by using :keyword:`!from` with
 :keyword:`raise`::
 
    raise new_exc from original_exc
 
-The expression following :keyword:`from` must be an exception or ``None``. It
+The expression following :keyword:`from<raise>` must be an exception or ``None``. It
 will be set as :attr:`__cause__` on the raised exception. Setting
 :attr:`__cause__` also implicitly sets the :attr:`__suppress_context__`
 attribute to ``True``, so that using ``raise new_exc from None``
@@ -67,6 +70,25 @@
 exception that was raised.
 
 
+Inheriting from built-in exceptions
+-----------------------------------
+
+User code can create subclasses that inherit from an exception type.
+It's recommended to only subclass one exception type at a time to avoid
+any possible conflicts between how the bases handle the ``args``
+attribute, as well as due to possible memory layout incompatibilities.
+
+.. impl-detail::
+
+   Most built-in exceptions are implemented in C for efficiency, see:
+   :source:`Objects/exceptions.c`.  Some have custom memory layouts
+   which makes it impossible to create a subclass that inherits from
+   multiple exception types. The memory layout of a type is an implementation
+   detail and might change between Python versions, leading to new
+   conflicts in the future.  Therefore, it's recommended to avoid
+   subclassing multiple exception types altogether.
+
+
 Base classes
 ------------
 
@@ -90,8 +112,13 @@
    .. method:: with_traceback(tb)
 
       This method sets *tb* as the new traceback for the exception and returns
-      the exception object.  It is usually used in exception handling code like
-      this::
+      the exception object.  It was more commonly used before the exception
+      chaining features of :pep:`3134` became available.  The following example
+      shows how we can convert an instance of ``SomeException`` into an
+      instance of ``OtherException`` while preserving the traceback.  Once
+      raised, the current frame is pushed onto the traceback of the
+      ``OtherException``, as would have happened to the traceback of the
+      original ``SomeException`` had we allowed it to propagate to the caller. ::
 
          try:
              ...
@@ -144,6 +171,13 @@
    assignment fails.  (When an object does not support attribute references or
    attribute assignments at all, :exc:`TypeError` is raised.)
 
+   The :attr:`name` and :attr:`obj` attributes can be set using keyword-only
+   arguments to the constructor. When set they represent the name of the attribute
+   that was attempted to be accessed and the object that was accessed for said
+   attribute, respectively.
+
+   .. versionchanged:: 3.10
+      Added the :attr:`name` and :attr:`obj` attributes.
 
 .. exception:: EOFError
 
@@ -230,6 +264,13 @@
    unqualified names.  The associated value is an error message that includes the
    name that could not be found.
 
+   The :attr:`name` attribute can be set using a keyword-only argument to the
+   constructor. When set it represent the name of the variable that was attempted
+   to be accessed.
+
+   .. versionchanged:: 3.10
+      Added the :attr:`name` attribute.
+
 
 .. exception:: NotImplementedError
 
@@ -313,8 +354,8 @@
    .. versionchanged:: 3.4
       The :attr:`filename` attribute is now the original file name passed to
       the function, instead of the name encoded to or decoded from the
-      filesystem encoding.  Also, the *filename2* constructor argument and
-      attribute was added.
+      :term:`filesystem encoding and error handler`. Also, the *filename2*
+      constructor argument and attribute was added.
 
 
 .. exception:: OverflowError
@@ -390,17 +431,52 @@
 
    .. versionadded:: 3.5
 
-.. exception:: SyntaxError
+.. exception:: SyntaxError(message, details)
 
    Raised when the parser encounters a syntax error.  This may occur in an
-   :keyword:`import` statement, in a call to the built-in functions :func:`exec`
+   :keyword:`import` statement, in a call to the built-in functions
+   :func:`compile`, :func:`exec`,
    or :func:`eval`, or when reading the initial script or standard input
    (also interactively).
 
-   Instances of this class have attributes :attr:`filename`, :attr:`lineno`,
-   :attr:`offset` and :attr:`text` for easier access to the details.  :func:`str`
-   of the exception instance returns only the message.
+   The :func:`str` of the exception instance returns only the error message.
+   Details is a tuple whose members are also available as separate attributes.
 
+   .. attribute:: filename
+
+      The name of the file the syntax error occurred in.
+
+   .. attribute:: lineno
+
+      Which line number in the file the error occurred in. This is
+      1-indexed: the first line in the file has a ``lineno`` of 1.
+
+   .. attribute:: offset
+
+      The column in the line where the error occurred. This is
+      1-indexed: the first character in the line has an ``offset`` of 1.
+
+   .. attribute:: text
+
+      The source code text involved in the error.
+
+   .. attribute:: end_lineno
+
+      Which line number in the file the error occurred ends in. This is
+      1-indexed: the first line in the file has a ``lineno`` of 1.
+
+   .. attribute:: end_offset
+
+      The column in the end line where the error occurred finishes. This is
+      1-indexed: the first character in the line has an ``offset`` of 1.
+
+   For errors in f-string fields, the message is prefixed by "f-string: "
+   and the offsets are offsets in a text constructed from the replacement
+   expression.  For example, compiling f'Bad {a b} field' results in this
+   args attribute: ('f-string: ...', ('', 1, 2, '(a b)\n', 1, 5)).
+
+   .. versionchanged:: 3.10
+      Added the :attr:`end_lineno` and :attr:`end_offset` attributes.
 
 .. exception:: IndentationError
 
@@ -636,8 +712,10 @@
 
 .. exception:: NotADirectoryError
 
-   Raised when a directory operation (such as :func:`os.listdir`) is requested
-   on something which is not a directory.
+   Raised when a directory operation (such as :func:`os.listdir`) is requested on
+   something which is not a directory.  On most POSIX platforms, it may also be
+   raised if an operation attempts to open or traverse a non-directory file as if
+   it were a directory.
    Corresponds to :c:data:`errno` ``ENOTDIR``.
 
 .. exception:: PermissionError
@@ -692,6 +770,8 @@
    (:pep:`565`). Enabling the :ref:`Python Development Mode <devmode>` shows
    this warning.
 
+   The deprecation policy is described in :pep:`387`.
+
 
 .. exception:: PendingDeprecationWarning
 
@@ -706,6 +786,8 @@
    Ignored by the default warning filters. Enabling the :ref:`Python
    Development Mode <devmode>` shows this warning.
 
+   The deprecation policy is described in :pep:`387`.
+
 
 .. exception:: SyntaxWarning
 
@@ -736,6 +818,15 @@
    Base class for warnings related to Unicode.
 
 
+.. exception:: EncodingWarning
+
+   Base class for warnings related to encodings.
+
+   See :ref:`io-encoding-warning` for details.
+
+   .. versionadded:: 3.10
+
+
 .. exception:: BytesWarning
 
    Base class for warnings related to :class:`bytes` and :class:`bytearray`.
diff --git a/Doc/library/faulthandler.rst b/Doc/library/faulthandler.rst
index 59274c1..be09123 100644
--- a/Doc/library/faulthandler.rst
+++ b/Doc/library/faulthandler.rst
@@ -76,6 +76,10 @@
    .. versionchanged:: 3.6
       On Windows, a handler for Windows exception is also installed.
 
+   .. versionchanged:: 3.10
+      The dump now mentions if a garbage collector collection is running
+      if *all_threads* is true.
+
 .. function:: disable()
 
    Disable the fault handler: uninstall the signal handlers installed by
diff --git a/Doc/library/fcntl.rst b/Doc/library/fcntl.rst
index 07a15d2..9d80211 100644
--- a/Doc/library/fcntl.rst
+++ b/Doc/library/fcntl.rst
@@ -39,6 +39,11 @@
    On Linux(>=3.15), the fcntl module exposes the ``F_OFD_GETLK``, ``F_OFD_SETLK``
    and ``F_OFD_SETLKW`` constants, which working with open file description locks.
 
+.. versionchanged:: 3.10
+   On Linux >= 2.6.11, the fcntl module exposes the ``F_GETPIPE_SZ`` and
+   ``F_SETPIPE_SZ`` constants, which allow to check and modify a pipe's size
+   respectively.
+
 The module defines the following functions:
 
 
diff --git a/Doc/library/filecmp.rst b/Doc/library/filecmp.rst
index 31b9b4a..83e9e14 100644
--- a/Doc/library/filecmp.rst
+++ b/Doc/library/filecmp.rst
@@ -22,8 +22,11 @@
    Compare the files named *f1* and *f2*, returning ``True`` if they seem equal,
    ``False`` otherwise.
 
-   If *shallow* is true, files with identical :func:`os.stat` signatures are
-   taken to be equal.  Otherwise, the contents of the files are compared.
+   If *shallow* is true and the :func:`os.stat` signatures (file type, size, and
+   modification time) of both files are identical, the files are taken to be
+   equal.
+
+   Otherwise, the files are treated as different if their sizes or contents differ.
 
    Note that no external programs are called from this function, giving it
    portability and efficiency.
@@ -173,7 +176,13 @@
    .. attribute:: subdirs
 
       A dictionary mapping names in :attr:`common_dirs` to :class:`dircmp`
-      objects.
+      instances (or MyDirCmp instances if this instance is of type MyDirCmp, a
+      subclass of :class:`dircmp`).
+
+      .. versionchanged:: 3.10
+         Previously entries were always :class:`dircmp` instances. Now entries
+         are the same type as *self*, if *self* is a subclass of
+         :class:`dircmp`.
 
 .. attribute:: DEFAULT_IGNORES
 
diff --git a/Doc/library/fileinput.rst b/Doc/library/fileinput.rst
index cc4039a..19cf7c6 100644
--- a/Doc/library/fileinput.rst
+++ b/Doc/library/fileinput.rst
@@ -18,7 +18,7 @@
 The typical use is::
 
    import fileinput
-   for line in fileinput.input():
+   for line in fileinput.input(encoding="utf-8"):
        process(line)
 
 This iterates over the lines of all files listed in ``sys.argv[1:]``, defaulting
@@ -49,13 +49,14 @@
 You can control how files are opened by providing an opening hook via the
 *openhook* parameter to :func:`fileinput.input` or :class:`FileInput()`. The
 hook must be a function that takes two arguments, *filename* and *mode*, and
-returns an accordingly opened file-like object. Two useful hooks are already
-provided by this module.
+returns an accordingly opened file-like object. If *encoding* and/or *errors*
+are specified, they will be passed to the hook as additional keyword arguments.
+This module provides a :func:`hook_compressed` to support compressed files.
 
 The following function is the primary interface of this module:
 
 
-.. function:: input(files=None, inplace=False, backup='', *, mode='r', openhook=None)
+.. function:: input(files=None, inplace=False, backup='', *, mode='r', openhook=None, encoding=None, errors=None)
 
    Create an instance of the :class:`FileInput` class.  The instance will be used
    as global state for the functions of this module, and is also returned to use
@@ -66,7 +67,7 @@
    :keyword:`with` statement.  In this example, *input* is closed after the
    :keyword:`!with` statement is exited, even if an exception occurs::
 
-      with fileinput.input(files=('spam.txt', 'eggs.txt')) as f:
+      with fileinput.input(files=('spam.txt', 'eggs.txt'), encoding="utf-8") as f:
           for line in f:
               process(line)
 
@@ -76,6 +77,9 @@
    .. versionchanged:: 3.8
       The keyword parameters *mode* and *openhook* are now keyword-only.
 
+   .. versionchanged:: 3.10
+      The keyword-only parameter *encoding* and *errors* are added.
+
 
 The following functions use the global state created by :func:`fileinput.input`;
 if there is no active state, :exc:`RuntimeError` is raised.
@@ -137,7 +141,7 @@
 available for subclassing as well:
 
 
-.. class:: FileInput(files=None, inplace=False, backup='', *, mode='r', openhook=None)
+.. class:: FileInput(files=None, inplace=False, backup='', *, mode='r', openhook=None, encoding=None, errors=None)
 
    Class :class:`FileInput` is the implementation; its methods :meth:`filename`,
    :meth:`fileno`, :meth:`lineno`, :meth:`filelineno`, :meth:`isfirstline`,
@@ -155,6 +159,8 @@
    *filename* and *mode*, and returns an accordingly opened file-like object. You
    cannot use *inplace* and *openhook* together.
 
+   You can specify *encoding* and *errors* that is passed to :func:`open` or *openhook*.
+
    A :class:`FileInput` instance can be used as a context manager in the
    :keyword:`with` statement.  In this example, *input* is closed after the
    :keyword:`!with` statement is exited, even if an exception occurs::
@@ -162,7 +168,6 @@
       with FileInput(files=('spam.txt', 'eggs.txt')) as input:
           process(input)
 
-
    .. versionchanged:: 3.2
       Can be used as a context manager.
 
@@ -175,6 +180,8 @@
    .. versionchanged:: 3.8
       The keyword parameter *mode* and *openhook* are now keyword-only.
 
+   .. versionchanged:: 3.10
+      The keyword-only parameter *encoding* and *errors* are added.
 
 
 **Optional in-place filtering:** if the keyword argument ``inplace=True`` is
@@ -191,14 +198,20 @@
 
 The two following opening hooks are provided by this module:
 
-.. function:: hook_compressed(filename, mode)
+.. function:: hook_compressed(filename, mode, *, encoding=None, errors=None)
 
    Transparently opens files compressed with gzip and bzip2 (recognized by the
    extensions ``'.gz'`` and ``'.bz2'``) using the :mod:`gzip` and :mod:`bz2`
    modules.  If the filename extension is not ``'.gz'`` or ``'.bz2'``, the file is
    opened normally (ie, using :func:`open` without any decompression).
 
-   Usage example:  ``fi = fileinput.FileInput(openhook=fileinput.hook_compressed)``
+   The *encoding* and *errors* values are passed to :class:`io.TextIOWrapper`
+   for compressed files and open for normal files.
+
+   Usage example:  ``fi = fileinput.FileInput(openhook=fileinput.hook_compressed, encoding="utf-8")``
+
+   .. versionchanged:: 3.10
+      The keyword-only parameter *encoding* and *errors* are added.
 
 
 .. function:: hook_encoded(encoding, errors=None)
@@ -212,3 +225,7 @@
 
    .. versionchanged:: 3.6
       Added the optional *errors* parameter.
+
+   .. deprecated:: 3.10
+      This function is deprecated since :func:`input` and :class:`FileInput`
+      now have *encoding* and *errors* parameters.
diff --git a/Doc/library/fnmatch.rst b/Doc/library/fnmatch.rst
index ce07d32..925f08e 100644
--- a/Doc/library/fnmatch.rst
+++ b/Doc/library/fnmatch.rst
@@ -75,7 +75,7 @@
 
 .. function:: filter(names, pattern)
 
-   Return the subset of the list of *names* that match *pattern*. It is the same as
+   Construct a list from those elements of the iterable *names* that match *pattern*. It is the same as
    ``[n for n in names if fnmatch(n, pattern)]``, but implemented more efficiently.
 
 
diff --git a/Doc/library/formatter.rst b/Doc/library/formatter.rst
deleted file mode 100644
index 6c10ac6..0000000
--- a/Doc/library/formatter.rst
+++ /dev/null
@@ -1,351 +0,0 @@
-:mod:`formatter` --- Generic output formatting
-==============================================
-
-.. module:: formatter
-   :synopsis: Generic output formatter and device interface.
-   :deprecated:
-
-.. deprecated:: 3.4
-   Due to lack of usage, the formatter module has been deprecated.
-
---------------
-
-This module supports two interface definitions, each with multiple
-implementations: The *formatter* interface, and the *writer* interface which is
-required by the formatter interface.
-
-Formatter objects transform an abstract flow of formatting events into specific
-output events on writer objects.  Formatters manage several stack structures to
-allow various properties of a writer object to be changed and restored; writers
-need not be able to handle relative changes nor any sort of "change back"
-operation.  Specific writer properties which may be controlled via formatter
-objects are horizontal alignment, font, and left margin indentations.  A
-mechanism is provided which supports providing arbitrary, non-exclusive style
-settings to a writer as well.  Additional interfaces facilitate formatting
-events which are not reversible, such as paragraph separation.
-
-Writer objects encapsulate device interfaces.  Abstract devices, such as file
-formats, are supported as well as physical devices.  The provided
-implementations all work with abstract devices.  The interface makes available
-mechanisms for setting the properties which formatter objects manage and
-inserting data into the output.
-
-
-.. _formatter-interface:
-
-The Formatter Interface
------------------------
-
-Interfaces to create formatters are dependent on the specific formatter class
-being instantiated.  The interfaces described below are the required interfaces
-which all formatters must support once initialized.
-
-One data element is defined at the module level:
-
-
-.. data:: AS_IS
-
-   Value which can be used in the font specification passed to the ``push_font()``
-   method described below, or as the new value to any other ``push_property()``
-   method.  Pushing the ``AS_IS`` value allows the corresponding ``pop_property()``
-   method to be called without having to track whether the property was changed.
-
-The following attributes are defined for formatter instance objects:
-
-
-.. attribute:: formatter.writer
-
-   The writer instance with which the formatter interacts.
-
-
-.. method:: formatter.end_paragraph(blanklines)
-
-   Close any open paragraphs and insert at least *blanklines* before the next
-   paragraph.
-
-
-.. method:: formatter.add_line_break()
-
-   Add a hard line break if one does not already exist.  This does not break the
-   logical paragraph.
-
-
-.. method:: formatter.add_hor_rule(*args, **kw)
-
-   Insert a horizontal rule in the output.  A hard break is inserted if there is
-   data in the current paragraph, but the logical paragraph is not broken.  The
-   arguments and keywords are passed on to the writer's :meth:`send_line_break`
-   method.
-
-
-.. method:: formatter.add_flowing_data(data)
-
-   Provide data which should be formatted with collapsed whitespace. Whitespace
-   from preceding and successive calls to :meth:`add_flowing_data` is considered as
-   well when the whitespace collapse is performed.  The data which is passed to
-   this method is expected to be word-wrapped by the output device.  Note that any
-   word-wrapping still must be performed by the writer object due to the need to
-   rely on device and font information.
-
-
-.. method:: formatter.add_literal_data(data)
-
-   Provide data which should be passed to the writer unchanged. Whitespace,
-   including newline and tab characters, are considered legal in the value of
-   *data*.
-
-
-.. method:: formatter.add_label_data(format, counter)
-
-   Insert a label which should be placed to the left of the current left margin.
-   This should be used for constructing bulleted or numbered lists.  If the
-   *format* value is a string, it is interpreted as a format specification for
-   *counter*, which should be an integer. The result of this formatting becomes the
-   value of the label; if *format* is not a string it is used as the label value
-   directly. The label value is passed as the only argument to the writer's
-   :meth:`send_label_data` method.  Interpretation of non-string label values is
-   dependent on the associated writer.
-
-   Format specifications are strings which, in combination with a counter value,
-   are used to compute label values.  Each character in the format string is copied
-   to the label value, with some characters recognized to indicate a transform on
-   the counter value.  Specifically, the character ``'1'`` represents the counter
-   value formatter as an Arabic number, the characters ``'A'`` and ``'a'``
-   represent alphabetic representations of the counter value in upper and lower
-   case, respectively, and ``'I'`` and ``'i'`` represent the counter value in Roman
-   numerals, in upper and lower case.  Note that the alphabetic and roman
-   transforms require that the counter value be greater than zero.
-
-
-.. method:: formatter.flush_softspace()
-
-   Send any pending whitespace buffered from a previous call to
-   :meth:`add_flowing_data` to the associated writer object.  This should be called
-   before any direct manipulation of the writer object.
-
-
-.. method:: formatter.push_alignment(align)
-
-   Push a new alignment setting onto the alignment stack.  This may be
-   :const:`AS_IS` if no change is desired.  If the alignment value is changed from
-   the previous setting, the writer's :meth:`new_alignment` method is called with
-   the *align* value.
-
-
-.. method:: formatter.pop_alignment()
-
-   Restore the previous alignment.
-
-
-.. method:: formatter.push_font((size, italic, bold, teletype))
-
-   Change some or all font properties of the writer object.  Properties which are
-   not set to :const:`AS_IS` are set to the values passed in while others are
-   maintained at their current settings.  The writer's :meth:`new_font` method is
-   called with the fully resolved font specification.
-
-
-.. method:: formatter.pop_font()
-
-   Restore the previous font.
-
-
-.. method:: formatter.push_margin(margin)
-
-   Increase the number of left margin indentations by one, associating the logical
-   tag *margin* with the new indentation.  The initial margin level is ``0``.
-   Changed values of the logical tag must be true values; false values other than
-   :const:`AS_IS` are not sufficient to change the margin.
-
-
-.. method:: formatter.pop_margin()
-
-   Restore the previous margin.
-
-
-.. method:: formatter.push_style(*styles)
-
-   Push any number of arbitrary style specifications.  All styles are pushed onto
-   the styles stack in order.  A tuple representing the entire stack, including
-   :const:`AS_IS` values, is passed to the writer's :meth:`new_styles` method.
-
-
-.. method:: formatter.pop_style(n=1)
-
-   Pop the last *n* style specifications passed to :meth:`push_style`.  A tuple
-   representing the revised stack, including :const:`AS_IS` values, is passed to
-   the writer's :meth:`new_styles` method.
-
-
-.. method:: formatter.set_spacing(spacing)
-
-   Set the spacing style for the writer.
-
-
-.. method:: formatter.assert_line_data(flag=1)
-
-   Inform the formatter that data has been added to the current paragraph
-   out-of-band.  This should be used when the writer has been manipulated
-   directly.  The optional *flag* argument can be set to false if the writer
-   manipulations produced a hard line break at the end of the output.
-
-
-.. _formatter-impls:
-
-Formatter Implementations
--------------------------
-
-Two implementations of formatter objects are provided by this module. Most
-applications may use one of these classes without modification or subclassing.
-
-
-.. class:: NullFormatter(writer=None)
-
-   A formatter which does nothing.  If *writer* is omitted, a :class:`NullWriter`
-   instance is created.  No methods of the writer are called by
-   :class:`NullFormatter` instances.  Implementations should inherit from this
-   class if implementing a writer interface but don't need to inherit any
-   implementation.
-
-
-.. class:: AbstractFormatter(writer)
-
-   The standard formatter.  This implementation has demonstrated wide applicability
-   to many writers, and may be used directly in most circumstances.  It has been
-   used to implement a full-featured World Wide Web browser.
-
-
-.. _writer-interface:
-
-The Writer Interface
---------------------
-
-Interfaces to create writers are dependent on the specific writer class being
-instantiated.  The interfaces described below are the required interfaces which
-all writers must support once initialized. Note that while most applications can
-use the :class:`AbstractFormatter` class as a formatter, the writer must
-typically be provided by the application.
-
-
-.. method:: writer.flush()
-
-   Flush any buffered output or device control events.
-
-
-.. method:: writer.new_alignment(align)
-
-   Set the alignment style.  The *align* value can be any object, but by convention
-   is a string or ``None``, where ``None`` indicates that the writer's "preferred"
-   alignment should be used. Conventional *align* values are ``'left'``,
-   ``'center'``, ``'right'``, and ``'justify'``.
-
-
-.. method:: writer.new_font(font)
-
-   Set the font style.  The value of *font* will be ``None``, indicating that the
-   device's default font should be used, or a tuple of the form ``(size,
-   italic, bold, teletype)``.  Size will be a string indicating the size of
-   font that should be used; specific strings and their interpretation must be
-   defined by the application.  The *italic*, *bold*, and *teletype* values are
-   Boolean values specifying which of those font attributes should be used.
-
-
-.. method:: writer.new_margin(margin, level)
-
-   Set the margin level to the integer *level* and the logical tag to *margin*.
-   Interpretation of the logical tag is at the writer's discretion; the only
-   restriction on the value of the logical tag is that it not be a false value for
-   non-zero values of *level*.
-
-
-.. method:: writer.new_spacing(spacing)
-
-   Set the spacing style to *spacing*.
-
-
-.. method:: writer.new_styles(styles)
-
-   Set additional styles.  The *styles* value is a tuple of arbitrary values; the
-   value :const:`AS_IS` should be ignored.  The *styles* tuple may be interpreted
-   either as a set or as a stack depending on the requirements of the application
-   and writer implementation.
-
-
-.. method:: writer.send_line_break()
-
-   Break the current line.
-
-
-.. method:: writer.send_paragraph(blankline)
-
-   Produce a paragraph separation of at least *blankline* blank lines, or the
-   equivalent.  The *blankline* value will be an integer.  Note that the
-   implementation will receive a call to :meth:`send_line_break` before this call
-   if a line break is needed;  this method should not include ending the last line
-   of the paragraph. It is only responsible for vertical spacing between
-   paragraphs.
-
-
-.. method:: writer.send_hor_rule(*args, **kw)
-
-   Display a horizontal rule on the output device.  The arguments to this method
-   are entirely application- and writer-specific, and should be interpreted with
-   care.  The method implementation may assume that a line break has already been
-   issued via :meth:`send_line_break`.
-
-
-.. method:: writer.send_flowing_data(data)
-
-   Output character data which may be word-wrapped and re-flowed as needed.  Within
-   any sequence of calls to this method, the writer may assume that spans of
-   multiple whitespace characters have been collapsed to single space characters.
-
-
-.. method:: writer.send_literal_data(data)
-
-   Output character data which has already been formatted for display.  Generally,
-   this should be interpreted to mean that line breaks indicated by newline
-   characters should be preserved and no new line breaks should be introduced.  The
-   data may contain embedded newline and tab characters, unlike data provided to
-   the :meth:`send_formatted_data` interface.
-
-
-.. method:: writer.send_label_data(data)
-
-   Set *data* to the left of the current left margin, if possible. The value of
-   *data* is not restricted; treatment of non-string values is entirely
-   application- and writer-dependent.  This method will only be called at the
-   beginning of a line.
-
-
-.. _writer-impls:
-
-Writer Implementations
-----------------------
-
-Three implementations of the writer object interface are provided as examples by
-this module.  Most applications will need to derive new writer classes from the
-:class:`NullWriter` class.
-
-
-.. class:: NullWriter()
-
-   A writer which only provides the interface definition; no actions are taken on
-   any methods.  This should be the base class for all writers which do not need to
-   inherit any implementation methods.
-
-
-.. class:: AbstractWriter()
-
-   A writer which can be used in debugging formatters, but not much else.  Each
-   method simply announces itself by printing its name and arguments on standard
-   output.
-
-
-.. class:: DumbWriter(file=None, maxcol=72)
-
-   Simple writer class which writes output on the :term:`file object` passed
-   in as *file* or, if *file* is omitted, on standard output.  The output is
-   simply word-wrapped to the number of columns specified by *maxcol*.  This
-   class is suitable for reflowing a sequence of paragraphs.
-
diff --git a/Doc/library/ftplib.rst b/Doc/library/ftplib.rst
index f4d4cdf..2f94ac4 100644
--- a/Doc/library/ftplib.rst
+++ b/Doc/library/ftplib.rst
@@ -17,7 +17,7 @@
 this to write Python programs that perform a variety of automated FTP jobs, such
 as mirroring other FTP servers.  It is also used by the module
 :mod:`urllib.request` to handle URLs that use FTP.  For more information on FTP
-(File Transfer Protocol), see Internet :rfc:`959`.
+(File Transfer Protocol), see internet :rfc:`959`.
 
 The default encoding is UTF-8, following :rfc:`2640`.
 
@@ -28,6 +28,7 @@
    >>> ftp.login()                     # user anonymous, passwd anonymous@
    '230 Login successful.'
    >>> ftp.cwd('debian')               # change into "debian" directory
+   '250 Directory successfully changed.'
    >>> ftp.retrlines('LIST')           # list directory contents
    -rw-rw-r--    1 1176     1176         1063 Jun 15 10:18 README
    ...
@@ -39,6 +40,7 @@
    >>>     ftp.retrbinary('RETR README', fp.write)
    '226 Transfer complete.'
    >>> ftp.quit()
+   '221 Goodbye.'
 
 
 The module defines the following items:
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index 9c12b6c..9523136 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -7,24 +7,38 @@
 The Python interpreter has a number of functions and types built into it that
 are always available.  They are listed here in alphabetical order.
 
-===================  =================  ==================  ==================  ====================
-..                   ..                 Built-in Functions  ..                  ..
-===================  =================  ==================  ==================  ====================
-:func:`abs`          :func:`delattr`    :func:`hash`        |func-memoryview|_  |func-set|_
-:func:`all`          |func-dict|_       :func:`help`        :func:`min`         :func:`setattr`
-:func:`any`          :func:`dir`        :func:`hex`         :func:`next`        :func:`slice`
-:func:`ascii`        :func:`divmod`     :func:`id`          :func:`object`      :func:`sorted`
-:func:`bin`          :func:`enumerate`  :func:`input`       :func:`oct`         :func:`staticmethod`
-:func:`bool`         :func:`eval`       :func:`int`         :func:`open`        |func-str|_
-:func:`breakpoint`   :func:`exec`       :func:`isinstance`  :func:`ord`         :func:`sum`
-|func-bytearray|_    :func:`filter`     :func:`issubclass`  :func:`pow`         :func:`super`
-|func-bytes|_        :func:`float`      :func:`iter`        :func:`print`       |func-tuple|_
-:func:`callable`     :func:`format`     :func:`len`         :func:`property`    :func:`type`
-:func:`chr`          |func-frozenset|_  |func-list|_        |func-range|_       :func:`vars`
-:func:`classmethod`  :func:`getattr`    :func:`locals`      :func:`repr`        :func:`zip`
-:func:`compile`      :func:`globals`    :func:`map`         :func:`reversed`    :func:`__import__`
-:func:`complex`      :func:`hasattr`    :func:`max`         :func:`round`
-===================  =================  ==================  ==================  ====================
++---------------------------------------------------------------------------------------------------+
+|                                        Built-in Functions                                         |
++=========================+=======================+=======================+=========================+
+| |  **A**                | |  **E**              | |  **L**              | |  **R**                |
+| |  :func:`abs`          | |  :func:`enumerate`  | |  :func:`len`        | |  |func-range|_        |
+| |  :func:`aiter`        | |  :func:`eval`       | |  |func-list|_       | |  :func:`repr`         |
+| |  :func:`all`          | |  :func:`exec`       | |  :func:`locals`     | |  :func:`reversed`     |
+| |  :func:`any`          | |                     | |                     | |  :func:`round`        |
+| |  :func:`anext`        | |  **F**              | |  **M**              | |                       |
+| |  :func:`ascii`        | |  :func:`filter`     | |  :func:`map`        | |  **S**                |
+| |                       | |  :func:`float`      | |  :func:`max`        | |  |func-set|_          |
+| |  **B**                | |  :func:`format`     | |  |func-memoryview|_ | |  :func:`setattr`      |
+| |  :func:`bin`          | |  |func-frozenset|_  | |  :func:`min`        | |  :func:`slice`        |
+| |  :func:`bool`         | |                     | |                     | |  :func:`sorted`       |
+| |  :func:`breakpoint`   | |  **G**              | |  **N**              | |  :func:`staticmethod` |
+| |  |func-bytearray|_    | |  :func:`getattr`    | |  :func:`next`       | |  |func-str|_          |
+| |  |func-bytes|_        | |  :func:`globals`    | |                     | |  :func:`sum`          |
+| |                       | |                     | |  **O**              | |  :func:`super`        |
+| |  **C**                | |  **H**              | |  :func:`object`     | |                       |
+| |  :func:`callable`     | |  :func:`hasattr`    | |  :func:`oct`        | |  **T**                |
+| |  :func:`chr`          | |  :func:`hash`       | |  :func:`open`       | |  |func-tuple|_        |
+| |  :func:`classmethod`  | |  :func:`help`       | |  :func:`ord`        | |  :func:`type`         |
+| |  :func:`compile`      | |  :func:`hex`        | |                     | |                       |
+| |  :func:`complex`      | |                     | |  **P**              | |  **V**                |
+| |                       | |  **I**              | |  :func:`pow`        | |  :func:`vars`         |
+| |  **D**                | |  :func:`id`         | |  :func:`print`      | |                       |
+| |  :func:`delattr`      | |  :func:`input`      | |  :func:`property`   | |  **Z**                |
+| |  |func-dict|_         | |  :func:`int`        | |                     | |  :func:`zip`          |
+| |  :func:`dir`          | |  :func:`isinstance` | |                     | |                       |
+| |  :func:`divmod`       | |  :func:`issubclass` | |                     | |  **_**                |
+| |                       | |  :func:`iter`       | |                     | |  :func:`__import__`   |
++-------------------------+-----------------------+-----------------------+-------------------------+
 
 .. using :func:`dict` would create a link to another page, so local targets are
    used, with replacement texts to make the output in the table consistent
@@ -47,6 +61,15 @@
    If the argument is a complex number, its magnitude is returned.
 
 
+.. function:: aiter(async_iterable)
+
+   Return an :term:`asynchronous iterator` for an :term:`asynchronous iterable`.
+   Equivalent to calling ``x.__aiter__()``.
+
+   Note: Unlike :func:`iter`, :func:`aiter` has no 2-argument variant.
+
+   .. versionadded:: 3.10
+
 .. function:: all(iterable)
 
    Return ``True`` if all elements of the *iterable* are true (or if the iterable
@@ -59,6 +82,21 @@
           return True
 
 
+.. awaitablefunction:: anext(async_iterator[, default])
+
+   When awaited, return the next item from the given :term:`asynchronous
+   iterator`, or *default* if given and the iterator is exhausted.
+
+   This is the async variant of the :func:`next` builtin, and behaves
+   similarly.
+
+   This calls the :meth:`~object.__anext__` method of *async_iterator*,
+   returning an :term:`awaitable`. Awaiting this returns the next value of the
+   iterator. If *default* is given, it is returned if the iterator is exhausted,
+   otherwise :exc:`StopAsyncIteration` is raised.
+
+   .. versionadded:: 3.10
+
 .. function:: any(iterable)
 
    Return ``True`` if any element of the *iterable* is true.  If the iterable
@@ -75,7 +113,7 @@
 
    As :func:`repr`, return a string containing a printable representation of an
    object, but escape the non-ASCII characters in the string returned by
-   :func:`repr` using ``\x``, ``\u`` or ``\U`` escapes.  This generates a string
+   :func:`repr` using ``\x``, ``\u``, or ``\U`` escapes.  This generates a string
    similar to that returned by :func:`repr` in Python 2.
 
 
@@ -91,7 +129,7 @@
       >>> bin(-10)
       '-0b1010'
 
-   If prefix "0b" is desired or not, you can use either of the following ways.
+   If the prefix "0b" is desired or not, you can use either of the following ways.
 
       >>> format(14, '#b'), format(14, 'b')
       ('0b1110', '1110')
@@ -105,7 +143,7 @@
 
    Return a Boolean value, i.e. one of ``True`` or ``False``.  *x* is converted
    using the standard :ref:`truth testing procedure <truth>`.  If *x* is false
-   or omitted, this returns ``False``; otherwise it returns ``True``.  The
+   or omitted, this returns ``False``; otherwise, it returns ``True``.  The
    :class:`bool` class is a subclass of :class:`int` (see :ref:`typesnumeric`).
    It cannot be subclassed further.  Its only instances are ``False`` and
    ``True`` (see :ref:`bltin-boolean-values`).
@@ -165,7 +203,7 @@
 .. class:: bytes([source[, encoding[, errors]]])
    :noindex:
 
-   Return a new "bytes" object, which is an immutable sequence of integers in
+   Return a new "bytes" object which is an immutable sequence of integers in
    the range ``0 <= x < 256``.  :class:`bytes` is an immutable version of
    :class:`bytearray` -- it has the same non-mutating methods and the same
    indexing and slicing behavior.
@@ -204,13 +242,13 @@
 
    Transform a method into a class method.
 
-   A class method receives the class as implicit first argument, just like an
+   A class method receives the class as an implicit first argument, just like an
    instance method receives the instance. To declare a class method, use this
    idiom::
 
       class C:
           @classmethod
-          def f(cls, arg1, arg2, ...): ...
+          def f(cls, arg1, arg2): ...
 
    The ``@classmethod`` form is a function :term:`decorator` -- see
    :ref:`function` for details.
@@ -228,6 +266,11 @@
       Class methods can now wrap other :term:`descriptors <descriptor>` such as
       :func:`property`.
 
+   .. versionchanged:: 3.10
+      Class methods now inherit the method attributes (``__module__``,
+      ``__name__``, ``__qualname__``, ``__doc__`` and ``__annotations__``) and
+      have a new ``__wrapped__`` attribute.
+
 .. function:: compile(source, filename, mode, flags=0, dont_inherit=False, optimize=-1)
 
    Compile the *source* into a code or AST object.  Code objects can be executed
@@ -296,7 +339,7 @@
       object due to stack depth limitations in Python's AST compiler.
 
    .. versionchanged:: 3.2
-      Allowed use of Windows and Mac newlines.  Also input in ``'exec'`` mode
+      Allowed use of Windows and Mac newlines.  Also, input in ``'exec'`` mode
       does not have to end in a newline anymore.  Added the *optimize* parameter.
 
    .. versionchanged:: 3.5
@@ -374,7 +417,7 @@
 
    If the object does not provide :meth:`__dir__`, the function tries its best to
    gather information from the object's :attr:`~object.__dict__` attribute, if defined, and
-   from its type object.  The resulting list is not necessarily complete, and may
+   from its type object.  The resulting list is not necessarily complete and may
    be inaccurate when the object has a custom :func:`__getattr__`.
 
    The default :func:`dir` mechanism behaves differently with different types of
@@ -420,7 +463,7 @@
 
 .. function:: divmod(a, b)
 
-   Take two (non complex) numbers as arguments and return a pair of numbers
+   Take two (non-complex) numbers as arguments and return a pair of numbers
    consisting of their quotient and remainder when using integer division.  With
    mixed operand types, the rules for binary arithmetic operators apply.  For
    integers, the result is the same as ``(a // b, a % b)``. For floating point
@@ -464,14 +507,15 @@
    dictionaries as global and local namespace.  If the *globals* dictionary is
    present and does not contain a value for the key ``__builtins__``, a
    reference to the dictionary of the built-in module :mod:`builtins` is
-   inserted under that key before *expression* is parsed.  This means that
-   *expression* normally has full access to the standard :mod:`builtins`
-   module and restricted environments are propagated.  If the *locals*
-   dictionary is omitted it defaults to the *globals* dictionary.  If both
-   dictionaries are omitted, the expression is executed with the *globals* and
-   *locals* in the environment where :func:`eval` is called.  Note, *eval()*
-   does not have access to the :term:`nested scopes <nested scope>` (non-locals) in the
-   enclosing environment.
+   inserted under that key before *expression* is parsed.  That way you can
+   control what builtins are available to the executed code by inserting your
+   own ``__builtins__`` dictionary into *globals* before passing it to
+   :func:`eval`.  If the *locals* dictionary is omitted it defaults to the
+   *globals* dictionary.  If both dictionaries are omitted, the expression is
+   executed with the *globals* and *locals* in the environment where
+   :func:`eval` is called.  Note, *eval()* does not have access to the
+   :term:`nested scopes <nested scope>` (non-locals) in the enclosing
+   environment.
 
    The return value is the result of
    the evaluated expression. Syntax errors are reported as exceptions.  Example:
@@ -481,15 +525,18 @@
       2
 
    This function can also be used to execute arbitrary code objects (such as
-   those created by :func:`compile`).  In this case pass a code object instead
+   those created by :func:`compile`).  In this case, pass a code object instead
    of a string.  If the code object has been compiled with ``'exec'`` as the
    *mode* argument, :func:`eval`\'s return value will be ``None``.
 
    Hints: dynamic execution of statements is supported by the :func:`exec`
    function.  The :func:`globals` and :func:`locals` functions
-   returns the current global and local dictionary, respectively, which may be
+   return the current global and local dictionary, respectively, which may be
    useful to pass around for use by :func:`eval` or :func:`exec`.
 
+   If the given source is a string, then leading and trailing spaces and tabs
+   are stripped.
+
    See :func:`ast.literal_eval` for a function that can safely evaluate strings
    with expressions containing only literals.
 
@@ -507,8 +554,9 @@
    a suite of Python statements which is then executed (unless a syntax error
    occurs). [#]_ If it is a code object, it is simply executed.  In all cases,
    the code that's executed is expected to be valid as file input (see the
-   section "File input" in the Reference Manual). Be aware that the
-   :keyword:`return` and :keyword:`yield` statements may not be used outside of
+   section :ref:`file-input` in the Reference Manual). Be aware that the
+   :keyword:`nonlocal`, :keyword:`yield`,  and :keyword:`return`
+   statements may not be used outside of
    function definitions even within the context of code passed to the
    :func:`exec` function. The return value is ``None``.
 
@@ -518,7 +566,7 @@
    will be used for both the global and the local variables.  If *globals* and
    *locals* are given, they are used for the global and local variables,
    respectively.  If provided, *locals* can be any mapping object.  Remember
-   that at module level, globals and locals are the same dictionary. If exec
+   that at the module level, globals and locals are the same dictionary. If exec
    gets two separate objects as *globals* and *locals*, the code will be
    executed as if it were embedded in a class definition.
 
@@ -576,7 +624,7 @@
    preceded by a sign, and optionally embedded in whitespace.  The optional
    sign may be ``'+'`` or ``'-'``; a ``'+'`` sign has no effect on the value
    produced.  The argument may also be a string representing a NaN
-   (not-a-number), or a positive or negative infinity.  More precisely, the
+   (not-a-number), or positive or negative infinity.  More precisely, the
    input must conform to the following grammar after leading and trailing
    whitespace characters are removed:
 
@@ -589,7 +637,7 @@
 
    Here ``floatnumber`` is the form of a Python floating-point literal,
    described in :ref:`floating`.  Case is not significant, so, for example,
-   "inf", "Inf", "INFINITY" and "iNfINity" are all acceptable spellings for
+   "inf", "Inf", "INFINITY", and "iNfINity" are all acceptable spellings for
    positive infinity.
 
    Otherwise, if the argument is an integer or a floating point number, a
@@ -636,7 +684,7 @@
 
    Convert a *value* to a "formatted" representation, as controlled by
    *format_spec*.  The interpretation of *format_spec* will depend on the type
-   of the *value* argument, however there is a standard formatting syntax that
+   of the *value* argument; however, there is a standard formatting syntax that
    is used by most built-in types: :ref:`formatspec`.
 
    The default *format_spec* is an empty string which usually gives the same
@@ -675,12 +723,19 @@
    ``x.foobar``.  If the named attribute does not exist, *default* is returned if
    provided, otherwise :exc:`AttributeError` is raised.
 
+   .. note::
+
+      Since :ref:`private name mangling <private-name-mangling>` happens at
+      compilation time, one must manually mangle a private attribute's
+      (attributes with two leading underscores) name in order to retrieve it with
+      :func:`getattr`.
+
 
 .. function:: globals()
 
-   Return a dictionary representing the current global symbol table. This is always
-   the dictionary of the current module (inside a function or method, this is the
-   module where it is defined, not the module from which it is called).
+   Return the dictionary implementing the current module namespace. For code within
+   functions, this is set when the function is defined and remains the same
+   regardless of where the function is called.
 
 
 .. function:: hasattr(object, name)
@@ -713,7 +768,7 @@
    topic, and a help page is printed on the console.  If the argument is any other
    kind of object, a help page on the object is generated.
 
-   Note that if a slash(/) appears in the parameter list of a function, when
+   Note that if a slash(/) appears in the parameter list of a function when
    invoking :func:`help`, it means that the parameters prior to the slash are
    positional-only. For more info, see
    :ref:`the FAQ entry on positional-only parameters <faq-positional-only-arguments>`.
@@ -840,22 +895,30 @@
 .. function:: isinstance(object, classinfo)
 
    Return ``True`` if the *object* argument is an instance of the *classinfo*
-   argument, or of a (direct, indirect or :term:`virtual <abstract base
+   argument, or of a (direct, indirect, or :term:`virtual <abstract base
    class>`) subclass thereof.  If *object* is not
    an object of the given type, the function always returns ``False``.
    If *classinfo* is a tuple of type objects (or recursively, other such
-   tuples), return ``True`` if *object* is an instance of any of the types.
+   tuples) or a :ref:`types-union` of multiple types, return ``True`` if
+   *object* is an instance of any of the types.
    If *classinfo* is not a type or tuple of types and such tuples,
    a :exc:`TypeError` exception is raised.
 
+   .. versionchanged:: 3.10
+      *classinfo* can be a :ref:`types-union`.
+
 
 .. function:: issubclass(class, classinfo)
 
-   Return ``True`` if *class* is a subclass (direct, indirect or :term:`virtual
+   Return ``True`` if *class* is a subclass (direct, indirect, or :term:`virtual
    <abstract base class>`) of *classinfo*.  A
    class is considered a subclass of itself. *classinfo* may be a tuple of class
-   objects, in which case every entry in *classinfo* will be checked. In any other
-   case, a :exc:`TypeError` exception is raised.
+   objects or a :ref:`types-union`, in which case return ``True`` if *class* is a
+   subclass of any entry in *classinfo*.  In any other case, a :exc:`TypeError`
+   exception is raised.
+
+   .. versionchanged:: 3.10
+      *classinfo* can be a :ref:`types-union`.
 
 
 .. function:: iter(object[, sentinel])
@@ -863,8 +926,8 @@
    Return an :term:`iterator` object.  The first argument is interpreted very
    differently depending on the presence of the second argument. Without a
    second argument, *object* must be a collection object which supports the
-   iteration protocol (the :meth:`__iter__` method), or it must support the
-   sequence protocol (the :meth:`__getitem__` method with integer arguments
+   :term:`iterable` protocol (the :meth:`__iter__` method), or it must support
+   the sequence protocol (the :meth:`__getitem__` method with integer arguments
    starting at ``0``).  If it does not support either of those protocols,
    :exc:`TypeError` is raised. If the second argument, *sentinel*, is given,
    then *object* must be a callable object.  The iterator created in this case
@@ -956,7 +1019,7 @@
 
 
 .. _func-memoryview:
-.. class:: memoryview(obj)
+.. class:: memoryview(object)
    :noindex:
 
    Return a "memory view" object created from the given argument.  See
@@ -994,7 +1057,7 @@
 
 .. function:: next(iterator[, default])
 
-   Retrieve the next item from the *iterator* by calling its
+   Retrieve the next item from the :term:`iterator` by calling its
    :meth:`~iterator.__next__` method.  If *default* is given, it is returned
    if the iterator is exhausted, otherwise :exc:`StopIteration` is raised.
 
@@ -1002,7 +1065,7 @@
 .. class:: object()
 
    Return a new featureless object.  :class:`object` is a base for all classes.
-   It has the methods that are common to all instances of Python classes.  This
+   It has methods that are common to all instances of Python classes.  This
    function does not accept any arguments.
 
    .. note::
@@ -1023,7 +1086,7 @@
       >>> oct(-56)
       '-0o70'
 
-  If you want to convert an integer number to octal string either with prefix
+  If you want to convert an integer number to an octal string either with the prefix
   "0o" or not, you can use either of the following ways.
 
       >>> '%#o' % 10, '%o' % 10
@@ -1047,16 +1110,16 @@
    *file* is a :term:`path-like object` giving the pathname (absolute or
    relative to the current working directory) of the file to be opened or an
    integer file descriptor of the file to be wrapped.  (If a file descriptor is
-   given, it is closed when the returned I/O object is closed, unless *closefd*
+   given, it is closed when the returned I/O object is closed unless *closefd*
    is set to ``False``.)
 
    *mode* is an optional string that specifies the mode in which the file is
    opened.  It defaults to ``'r'`` which means open for reading in text mode.
    Other common values are ``'w'`` for writing (truncating the file if it
-   already exists), ``'x'`` for exclusive creation and ``'a'`` for appending
+   already exists), ``'x'`` for exclusive creation, and ``'a'`` for appending
    (which on *some* Unix systems, means that *all* writes append to the end of
    the file regardless of the current seek position).  In text mode, if
-   *encoding* is not specified the encoding used is platform dependent:
+   *encoding* is not specified the encoding used is platform-dependent:
    ``locale.getpreferredencoding(False)`` is called to get the current locale
    encoding. (For reading and writing raw bytes use binary mode and leave
    *encoding* unspecified.)  The available modes are:
@@ -1072,13 +1135,13 @@
    ``'r'``   open for reading (default)
    ``'w'``   open for writing, truncating the file first
    ``'x'``   open for exclusive creation, failing if the file already exists
-   ``'a'``   open for writing, appending to the end of the file if it exists
+   ``'a'``   open for writing, appending to the end of file if it exists
    ``'b'``   binary mode
    ``'t'``   text mode (default)
    ``'+'``   open for updating (reading and writing)
    ========= ===============================================================
 
-   The default mode is ``'r'`` (open for reading text, synonym of ``'rt'``).
+   The default mode is ``'r'`` (open for reading text, a synonym of ``'rt'``).
    Modes ``'w+'`` and ``'w+b'`` open and truncate the file.  Modes ``'r+'``
    and ``'r+b'`` open the file with no truncation.
 
@@ -1092,7 +1155,7 @@
 
    There is an additional mode character permitted, ``'U'``, which no longer
    has any effect, and is considered deprecated. It previously enabled
-   :term:`universal newlines` in text mode, which became the default behaviour
+   :term:`universal newlines` in text mode, which became the default behavior
    in Python 3.0. Refer to the documentation of the
    :ref:`newline <open-newline-parameter>` parameter for further details.
 
@@ -1142,9 +1205,9 @@
    * ``'replace'`` causes a replacement marker (such as ``'?'``) to be inserted
      where there is malformed data.
 
-   * ``'surrogateescape'`` will represent any incorrect bytes as code
-     points in the Unicode Private Use Area ranging from U+DC80 to
-     U+DCFF.  These private code points will then be turned back into
+   * ``'surrogateescape'`` will represent any incorrect bytes as low
+     surrogate code units ranging from U+DC80 to U+DCFF.
+     These surrogate code units will then be turned back into
      the same bytes when the ``surrogateescape`` error handler is used
      when writing data.  This is useful for processing files in an
      unknown encoding.
@@ -1184,8 +1247,8 @@
 
    If *closefd* is ``False`` and a file descriptor rather than a filename was
    given, the underlying file descriptor will be kept open when the file is
-   closed.  If a filename is given *closefd* must be ``True`` (the default)
-   otherwise an error will be raised.
+   closed.  If a filename is given *closefd* must be ``True`` (the default);
+   otherwise, an error will be raised.
 
    A custom opener can be used by passing a callable as *opener*. The underlying
    file descriptor for the file object is then obtained by calling *opener* with
@@ -1229,7 +1292,7 @@
       single: text mode
       module: sys
 
-   See also the file handling modules, such as, :mod:`fileinput`, :mod:`io`
+   See also the file handling modules, such as :mod:`fileinput`, :mod:`io`
    (where :func:`open` is declared), :mod:`os`, :mod:`os.path`, :mod:`tempfile`,
    and :mod:`shutil`.
 
@@ -1290,8 +1353,11 @@
    coercion rules for binary arithmetic operators apply.  For :class:`int`
    operands, the result has the same type as the operands (after coercion)
    unless the second argument is negative; in that case, all arguments are
-   converted to float and a float result is delivered.  For example, ``10**2``
-   returns ``100``, but ``10**-2`` returns ``0.01``.
+   converted to float and a float result is delivered.  For example, ``pow(10, 2)``
+   returns ``100``, but ``pow(10, -2)`` returns ``0.01``.  For a negative base of
+   type :class:`int` or :class:`float` and a non-integral exponent, a complex
+   result is delivered.  For example, ``pow(-9, 0.5)`` returns a value close
+   to ``3j``.
 
    For :class:`int` operands *base* and *exp*, if *mod* is present, *mod* must
    also be of integer type and *mod* must be nonzero. If *mod* is present and
@@ -1319,7 +1385,7 @@
 .. function:: print(*objects, sep=' ', end='\\n', file=sys.stdout, flush=False)
 
    Print *objects* to the text stream *file*, separated by *sep* and followed
-   by *end*.  *sep*, *end*, *file* and *flush*, if present, must be given as keyword
+   by *end*.  *sep*, *end*, *file*, and *flush*, if present, must be given as keyword
    arguments.
 
    All non-keyword arguments are converted to strings like :func:`str` does and
@@ -1333,7 +1399,7 @@
    arguments are converted to text strings, :func:`print` cannot be used with
    binary mode file objects.  For these, use ``file.write(...)`` instead.
 
-   Whether output is buffered is usually determined by *file*, but if the
+   Whether the output is buffered is usually determined by *file*, but if the
    *flush* keyword argument is true, the stream is forcibly flushed.
 
    .. versionchanged:: 3.3
@@ -1366,7 +1432,7 @@
           x = property(getx, setx, delx, "I'm the 'x' property.")
 
    If *c* is an instance of *C*, ``c.x`` will invoke the getter,
-   ``c.x = value`` will invoke the setter and ``del c.x`` the deleter.
+   ``c.x = value`` will invoke the setter, and ``del c.x`` the deleter.
 
    If given, *doc* will be the docstring of the property attribute. Otherwise, the
    property will copy *fget*'s docstring (if it exists).  This makes it possible to
@@ -1431,7 +1497,7 @@
 
    Return a string containing a printable representation of an object.  For many
    types, this function makes an attempt to return a string that would yield an
-   object with the same value when passed to :func:`eval`, otherwise the
+   object with the same value when passed to :func:`eval`; otherwise, the
    representation is a string enclosed in angle brackets that contains the name
    of the type of the object together with additional information often
    including the name and address of the object.  A class can control what this
@@ -1459,7 +1525,7 @@
    ``2``).  Any integer value is valid for *ndigits* (positive, zero, or
    negative).  The return value is an integer if *ndigits* is omitted or
    ``None``.
-   Otherwise the return value has the same type as *number*.
+   Otherwise, the return value has the same type as *number*.
 
    For a general Python object ``number``, ``round`` delegates to
    ``number.__round__``.
@@ -1489,29 +1555,34 @@
 .. function:: setattr(object, name, value)
 
    This is the counterpart of :func:`getattr`.  The arguments are an object, a
-   string and an arbitrary value.  The string may name an existing attribute or a
+   string, and an arbitrary value.  The string may name an existing attribute or a
    new attribute.  The function assigns the value to the attribute, provided the
    object allows it.  For example, ``setattr(x, 'foobar', 123)`` is equivalent to
    ``x.foobar = 123``.
 
+   .. note::
+
+      Since :ref:`private name mangling <private-name-mangling>` happens at
+      compilation time, one must manually mangle a private attribute's
+      (attributes with two leading underscores) name in order to set it with
+      :func:`setattr`.
+
 
 .. class:: slice(stop)
            slice(start, stop[, step])
 
-   .. index:: single: Numerical Python
-
    Return a :term:`slice` object representing the set of indices specified by
    ``range(start, stop, step)``.  The *start* and *step* arguments default to
    ``None``.  Slice objects have read-only data attributes :attr:`~slice.start`,
-   :attr:`~slice.stop` and :attr:`~slice.step` which merely return the argument
+   :attr:`~slice.stop`, and :attr:`~slice.step` which merely return the argument
    values (or their default).  They have no other explicit functionality;
-   however they are used by Numerical Python and other third party extensions.
+   however, they are used by NumPy and other third-party packages.
    Slice objects are also generated when extended indexing syntax is used.  For
    example: ``a[start:stop:step]`` or ``a[start:stop, i]``.  See
    :func:`itertools.islice` for an alternate version that returns an iterator.
 
 
-.. function:: sorted(iterable, *, key=None, reverse=False)
+.. function:: sorted(iterable, /, *, key=None, reverse=False)
 
    Return a new sorted list from the items in *iterable*.
 
@@ -1532,6 +1603,15 @@
    compare equal --- this is helpful for sorting in multiple passes (for
    example, sort by department, then by salary grade).
 
+   The sort algorithm uses only ``<`` comparisons between items.  While
+   defining an :meth:`~object.__lt__` method will suffice for sorting,
+   :PEP:`8` recommends that all six :ref:`rich comparisons
+   <comparisons>` be implemented.  This will help avoid bugs when using
+   the same data with other ordering tools such as :func:`max` that rely
+   on a different underlying method.  Implementing all six comparisons
+   also helps avoid confusion for mixed type comparisons which can call
+   reflected the :meth:`~object.__gt__` method.
+
    For sorting examples and a brief sorting tutorial, see :ref:`sortinghowto`.
 
 .. decorator:: staticmethod
@@ -1548,10 +1628,11 @@
    The ``@staticmethod`` form is a function :term:`decorator` -- see
    :ref:`function` for details.
 
-   A static method can be called either on the class (such as ``C.f()``) or on an instance (such
-   as ``C().f()``).
+   A static method can be called either on the class (such as ``C.f()``) or on
+   an instance (such as ``C().f()``). Moreover, they can be called as regular
+   functions (such as ``f()``).
 
-   Static methods in Python are similar to those found in Java or C++. Also see
+   Static methods in Python are similar to those found in Java or C++. Also, see
    :func:`classmethod` for a variant that is useful for creating alternate class
    constructors.
 
@@ -1561,11 +1642,20 @@
    body and you want to avoid the automatic transformation to instance
    method.  For these cases, use this idiom::
 
+      def regular_function():
+          ...
+
       class C:
-          builtin_open = staticmethod(open)
+          method = staticmethod(regular_function)
 
    For more information on static methods, see :ref:`types`.
 
+   .. versionchanged:: 3.10
+      Static methods now inherit the method attributes (``__module__``,
+      ``__name__``, ``__qualname__``, ``__doc__`` and ``__annotations__``),
+      have a new ``__wrapped__`` attribute, and are now callable as regular
+      functions.
+
 
 .. index::
    single: string; str() (built-in function)
@@ -1596,7 +1686,7 @@
    .. versionchanged:: 3.8
       The *start* parameter can be specified as a keyword argument.
 
-.. function:: super([type[, object-or-type]])
+.. class:: super([type[, object-or-type]])
 
    Return a proxy object that delegates method calls to a parent or sibling
    class of *type*.  This is useful for accessing inherited methods that have
@@ -1630,7 +1720,7 @@
    not found in statically compiled languages or languages that only support
    single inheritance.  This makes it possible to implement "diamond diagrams"
    where multiple base classes implement the same method.  Good design dictates
-   that this method have the same calling signature in every case (because the
+   that such implementations have the same calling signature in every case (because the
    order of calls is determined at runtime, because that order adapts
    to changes in the class hierarchy, and because that order can include
    sibling classes that are unknown prior to runtime).
@@ -1674,7 +1764,7 @@
 
 
 .. class:: type(object)
-           type(name, bases, dict)
+           type(name, bases, dict, **kwds)
 
    .. index:: object: type
 
@@ -1687,21 +1777,29 @@
 
 
    With three arguments, return a new type object.  This is essentially a
-   dynamic form of the :keyword:`class` statement. The *name* string is the
-   class name and becomes the :attr:`~definition.__name__` attribute; the *bases*
-   tuple itemizes the base classes and becomes the :attr:`~class.__bases__`
-   attribute; and the *dict* dictionary is the namespace containing definitions
-   for class body and is copied to a standard dictionary to become the
-   :attr:`~object.__dict__` attribute.  For example, the following two
-   statements create identical :class:`type` objects:
+   dynamic form of the :keyword:`class` statement. The *name* string is
+   the class name and becomes the :attr:`~definition.__name__` attribute.
+   The *bases* tuple contains the base classes and becomes the
+   :attr:`~class.__bases__` attribute; if empty, :class:`object`, the
+   ultimate base of all classes, is added.  The *dict* dictionary contains
+   attribute and method definitions for the class body; it may be copied
+   or wrapped before becoming the :attr:`~object.__dict__` attribute.
+   The following two statements create identical :class:`type` objects:
 
       >>> class X:
       ...     a = 1
       ...
-      >>> X = type('X', (object,), dict(a=1))
+      >>> X = type('X', (), dict(a=1))
 
    See also :ref:`bltin-type-objects`.
 
+   Keyword arguments provided to the three argument form are passed to the
+   appropriate metaclass machinery (usually :meth:`~object.__init_subclass__`)
+   in the same way that keywords in a class
+   definition (besides *metaclass*) would.
+
+   See also :ref:`class-customization`.
+
    .. versionchanged:: 3.6
       Subclasses of :class:`type` which don't override ``type.__new__`` may no
       longer use the one-argument form to get the type of an object.
@@ -1724,50 +1822,90 @@
    it doesn't have a :attr:`~object.__dict__` attribute (for example, if
    its class defines the :attr:`~object.__slots__` attribute).
 
-.. function:: zip(*iterables)
+.. function:: zip(*iterables, strict=False)
 
-   Make an iterator that aggregates elements from each of the iterables.
+   Iterate over several iterables in parallel, producing tuples with an item
+   from each one.
 
-   Returns an iterator of tuples, where the *i*-th tuple contains
-   the *i*-th element from each of the argument sequences or iterables.  The
-   iterator stops when the shortest input iterable is exhausted. With a single
-   iterable argument, it returns an iterator of 1-tuples.  With no arguments,
-   it returns an empty iterator.  Equivalent to::
+   Example::
 
-        def zip(*iterables):
-            # zip('ABCD', 'xy') --> Ax By
-            sentinel = object()
-            iterators = [iter(it) for it in iterables]
-            while iterators:
-                result = []
-                for it in iterators:
-                    elem = next(it, sentinel)
-                    if elem is sentinel:
-                        return
-                    result.append(elem)
-                yield tuple(result)
+      >>> for item in zip([1, 2, 3], ['sugar', 'spice', 'everything nice']):
+      ...     print(item)
+      ...
+      (1, 'sugar')
+      (2, 'spice')
+      (3, 'everything nice')
 
-   The left-to-right evaluation order of the iterables is guaranteed. This
-   makes possible an idiom for clustering a data series into n-length groups
-   using ``zip(*[iter(s)]*n)``.  This repeats the *same* iterator ``n`` times
-   so that each output tuple has the result of ``n`` calls to the iterator.
-   This has the effect of dividing the input into n-length chunks.
+   More formally: :func:`zip` returns an iterator of tuples, where the *i*-th
+   tuple contains the *i*-th element from each of the argument iterables.
 
-   :func:`zip` should only be used with unequal length inputs when you don't
-   care about trailing, unmatched values from the longer iterables.  If those
-   values are important, use :func:`itertools.zip_longest` instead.
+   Another way to think of :func:`zip` is that it turns rows into columns, and
+   columns into rows.  This is similar to `transposing a matrix
+   <https://en.wikipedia.org/wiki/Transpose>`_.
 
-   :func:`zip` in conjunction with the ``*`` operator can be used to unzip a
-   list::
+   :func:`zip` is lazy: The elements won't be processed until the iterable is
+   iterated on, e.g. by a :keyword:`!for` loop or by wrapping in a
+   :class:`list`.
 
-      >>> x = [1, 2, 3]
-      >>> y = [4, 5, 6]
-      >>> zipped = zip(x, y)
-      >>> list(zipped)
-      [(1, 4), (2, 5), (3, 6)]
-      >>> x2, y2 = zip(*zip(x, y))
-      >>> x == list(x2) and y == list(y2)
-      True
+   One thing to consider is that the iterables passed to :func:`zip` could have
+   different lengths; sometimes by design, and sometimes because of a bug in
+   the code that prepared these iterables.  Python offers three different
+   approaches to dealing with this issue:
+
+   * By default, :func:`zip` stops when the shortest iterable is exhausted.
+     It will ignore the remaining items in the longer iterables, cutting off
+     the result to the length of the shortest iterable::
+
+        >>> list(zip(range(3), ['fee', 'fi', 'fo', 'fum']))
+        [(0, 'fee'), (1, 'fi'), (2, 'fo')]
+
+   * :func:`zip` is often used in cases where the iterables are assumed to be
+     of equal length.  In such cases, it's recommended to use the ``strict=True``
+     option. Its output is the same as regular :func:`zip`::
+
+        >>> list(zip(('a', 'b', 'c'), (1, 2, 3), strict=True))
+        [('a', 1), ('b', 2), ('c', 3)]
+
+     Unlike the default behavior, it checks that the lengths of iterables are
+     identical, raising a :exc:`ValueError` if they aren't:
+
+        >>> list(zip(range(3), ['fee', 'fi', 'fo', 'fum'], strict=True))
+        Traceback (most recent call last):
+          ...
+        ValueError: zip() argument 2 is longer than argument 1
+
+     Without the ``strict=True`` argument, any bug that results in iterables of
+     different lengths will be silenced, possibly manifesting as a hard-to-find
+     bug in another part of the program.
+
+   * Shorter iterables can be padded with a constant value to make all the
+     iterables have the same length.  This is done by
+     :func:`itertools.zip_longest`.
+
+   Edge cases: With a single iterable argument, :func:`zip` returns an
+   iterator of 1-tuples.  With no arguments, it returns an empty iterator.
+
+   Tips and tricks:
+
+   * The left-to-right evaluation order of the iterables is guaranteed. This
+     makes possible an idiom for clustering a data series into n-length groups
+     using ``zip(*[iter(s)]*n, strict=True)``.  This repeats the *same* iterator
+     ``n`` times so that each output tuple has the result of ``n`` calls to the
+     iterator. This has the effect of dividing the input into n-length chunks.
+
+   * :func:`zip` in conjunction with the ``*`` operator can be used to unzip a
+     list::
+
+        >>> x = [1, 2, 3]
+        >>> y = [4, 5, 6]
+        >>> list(zip(x, y))
+        [(1, 4), (2, 5), (3, 6)]
+        >>> x2, y2 = zip(*zip(x, y))
+        >>> x == list(x2) and y == list(y2)
+        True
+
+   .. versionchanged:: 3.10
+      Added the ``strict`` argument.
 
 
 .. function:: __import__(name, globals=None, locals=None, fromlist=(), level=0)
@@ -1794,7 +1932,7 @@
    and *locals* to determine how to interpret the name in a package context.
    The *fromlist* gives the names of objects or submodules that should be
    imported from the module given by *name*.  The standard implementation does
-   not use its *locals* argument at all, and uses its *globals* only to
+   not use its *locals* argument at all and uses its *globals* only to
    determine the package context of the :keyword:`import` statement.
 
    *level* specifies whether to use absolute or relative imports. ``0`` (the
diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst
index 4869b67..c78818b 100644
--- a/Doc/library/functools.rst
+++ b/Doc/library/functools.rst
@@ -62,16 +62,26 @@
    Example::
 
        class DataSet:
+
            def __init__(self, sequence_of_numbers):
-               self._data = sequence_of_numbers
+               self._data = tuple(sequence_of_numbers)
 
            @cached_property
            def stdev(self):
                return statistics.stdev(self._data)
 
-           @cached_property
-           def variance(self):
-               return statistics.variance(self._data)
+   The mechanics of :func:`cached_property` are somewhat different from
+   :func:`property`.  A regular property blocks attribute writes unless a
+   setter is defined. In contrast, a *cached_property* allows writes.
+
+   The *cached_property* decorator only runs on lookups and only when an
+   attribute of the same name doesn't exist.  When it does run, the
+   *cached_property* writes to the attribute with the same name. Subsequent
+   attribute reads and writes take precedence over the *cached_property*
+   method and it works like a normal attribute.
+
+   The cached value can be cleared by deleting the attribute.  This
+   allows the *cached_property* method to run again.
 
    Note, this decorator interferes with the operation of :pep:`412`
    key-sharing dictionaries.  This means that instance dictionaries
@@ -144,15 +154,22 @@
 
        @lru_cache
        def count_vowels(sentence):
-           sentence = sentence.casefold()
-           return sum(sentence.count(vowel) for vowel in 'aeiou')
+           return sum(sentence.count(vowel) for vowel in 'AEIOUaeiou')
 
    If *maxsize* is set to ``None``, the LRU feature is disabled and the cache can
    grow without bound.
 
    If *typed* is set to true, function arguments of different types will be
-   cached separately.  For example, ``f(3)`` and ``f(3.0)`` will be treated
-   as distinct calls with distinct results.
+   cached separately.  If *typed* is false, the implementation will usually
+   regard them as equivalent calls and only cache a single result. (Some
+   types such as *str* and *int* may be cached separately even when *typed*
+   is false.)
+
+   Note, type specificity applies only to the function's immediate arguments
+   rather than their contents.  The scalar arguments, ``Decimal(42)`` and
+   ``Fraction(42)`` are be treated as distinct calls with distinct results.
+   In contrast, the tuple arguments ``('answer', Decimal(42))`` and
+   ``('answer', Fraction(42))`` are treated as equivalent.
 
    The wrapped function is instrumented with a :func:`cache_parameters`
    function that returns a new :class:`dict` showing the values for *maxsize*
@@ -162,8 +179,7 @@
    To help measure the effectiveness of the cache and tune the *maxsize*
    parameter, the wrapped function is instrumented with a :func:`cache_info`
    function that returns a :term:`named tuple` showing *hits*, *misses*,
-   *maxsize* and *currsize*.  In a multi-threaded environment, the hits
-   and misses are approximate.
+   *maxsize* and *currsize*.
 
    The decorator also provides a :func:`cache_clear` function for clearing or
    invalidating the cache.
@@ -172,6 +188,9 @@
    :attr:`__wrapped__` attribute.  This is useful for introspection, for
    bypassing the cache, or for rewrapping the function with a different cache.
 
+   The cache keeps references to the arguments and return values until they age
+   out of the cache or until the cache is cleared.
+
    An `LRU (least recently used) cache
    <https://en.wikipedia.org/wiki/Cache_replacement_policies#Least_recently_used_(LRU)>`_
    works best when the most recent calls are the best predictors of upcoming
@@ -189,7 +208,7 @@
         @lru_cache(maxsize=32)
         def get_pep(num):
             'Retrieve text of a Python Enhancement Proposal'
-            resource = 'http://www.python.org/dev/peps/pep-%04d/' % num
+            resource = 'https://www.python.org/dev/peps/pep-%04d/' % num
             try:
                 with urllib.request.urlopen(resource) as s:
                     return s.read()
@@ -269,6 +288,13 @@
       application, implementing all six rich comparison methods instead is
       likely to provide an easy speed boost.
 
+   .. note::
+
+      This decorator makes no attempt to override methods that have been
+      declared in the class *or its superclasses*. Meaning that if a
+      superclass defines a comparison operator, *total_ordering* will not
+      implement it again, even if the original method is abstract.
+
    .. versionadded:: 3.2
 
    .. versionchanged:: 3.4
@@ -382,8 +408,8 @@
    dispatch>` :term:`generic function`.
 
    To define a generic function, decorate it with the ``@singledispatch``
-   decorator. Note that the dispatch happens on the type of the first argument,
-   create your function accordingly::
+   decorator. When defining a function using ``@singledispatch``, note that the
+   dispatch happens on the type of the first argument::
 
      >>> from functools import singledispatch
      >>> @singledispatch
@@ -393,9 +419,9 @@
      ...     print(arg)
 
    To add overloaded implementations to the function, use the :func:`register`
-   attribute of the generic function.  It is a decorator.  For functions
-   annotated with types, the decorator will infer the type of the first
-   argument automatically::
+   attribute of the generic function, which can be used as a decorator.  For
+   functions annotated with types, the decorator will infer the type of the
+   first argument automatically::
 
      >>> @fun.register
      ... def _(arg: int, verbose=False):
@@ -421,17 +447,17 @@
      ...
 
 
-   To enable registering lambdas and pre-existing functions, the
-   :func:`register` attribute can be used in a functional form::
+   To enable registering :term:`lambdas<lambda>` and pre-existing functions,
+   the :func:`register` attribute can also be used in a functional form::
 
      >>> def nothing(arg, verbose=False):
      ...     print("Nothing.")
      ...
      >>> fun.register(type(None), nothing)
 
-   The :func:`register` attribute returns the undecorated function which
-   enables decorator stacking, pickling, as well as creating unit tests for
-   each variant independently::
+   The :func:`register` attribute returns the undecorated function. This
+   enables decorator stacking, :mod:`pickling<pickle>`, and the creation
+   of unit tests for each variant independently::
 
      >>> @fun.register(float)
      ... @fun.register(Decimal)
@@ -466,11 +492,12 @@
    Where there is no registered implementation for a specific type, its
    method resolution order is used to find a more generic implementation.
    The original function decorated with ``@singledispatch`` is registered
-   for the base ``object`` type, which means it is used if no better
+   for the base :class:`object` type, which means it is used if no better
    implementation is found.
 
-   If an implementation registered to :term:`abstract base class`, virtual
-   subclasses will be dispatched to that implementation::
+   If an implementation is registered to an :term:`abstract base class`,
+   virtual subclasses of the base class will be dispatched to that
+   implementation::
 
      >>> from collections.abc import Mapping
      >>> @fun.register
@@ -483,7 +510,7 @@
      >>> fun({"a": "b"})
      a => b
 
-   To check which implementation will the generic function choose for
+   To check which implementation the generic function will choose for
    a given type, use the ``dispatch()`` attribute::
 
      >>> fun.dispatch(float)
@@ -506,7 +533,7 @@
    .. versionadded:: 3.4
 
    .. versionchanged:: 3.7
-      The :func:`register` attribute supports using type annotations.
+      The :func:`register` attribute now supports using type annotations.
 
 
 .. class:: singledispatchmethod(func)
@@ -515,8 +542,9 @@
    dispatch>` :term:`generic function`.
 
    To define a generic method, decorate it with the ``@singledispatchmethod``
-   decorator. Note that the dispatch happens on the type of the first non-self
-   or non-cls argument, create your function accordingly::
+   decorator. When defining a function using ``@singledispatchmethod``, note
+   that the dispatch happens on the type of the first non-*self* or non-*cls*
+   argument::
 
     class Negator:
         @singledispatchmethod
@@ -532,9 +560,10 @@
             return not arg
 
    ``@singledispatchmethod`` supports nesting with other decorators such as
-   ``@classmethod``. Note that to allow for ``dispatcher.register``,
-   ``singledispatchmethod`` must be the *outer most* decorator. Here is the
-   ``Negator`` class with the ``neg`` methods being class bound::
+   :func:`@classmethod<classmethod>`. Note that to allow for
+   ``dispatcher.register``, ``singledispatchmethod`` must be the *outer most*
+   decorator. Here is the ``Negator`` class with the ``neg`` methods bound to
+   the class, rather than an instance of the class::
 
     class Negator:
         @singledispatchmethod
@@ -552,8 +581,9 @@
         def _(cls, arg: bool):
             return not arg
 
-   The same pattern can be used for other similar decorators: ``staticmethod``,
-   ``abstractmethod``, and others.
+   The same pattern can be used for other similar decorators:
+   :func:`@staticmethod<staticmethod>`,
+   :func:`@abstractmethod<abc.abstractmethod>`, and others.
 
    .. versionadded:: 3.8
 
diff --git a/Doc/library/gc.rst b/Doc/library/gc.rst
index 2d85cd3..69a1a83 100644
--- a/Doc/library/gc.rst
+++ b/Doc/library/gc.rst
@@ -72,6 +72,8 @@
    .. versionchanged:: 3.8
       New *generation* parameter.
 
+   .. audit-event:: gc.get_objects generation gc.get_objects
+
 .. function:: get_stats()
 
    Return a list of three per-generation dictionaries containing collection
@@ -135,10 +137,13 @@
    resulting referrers.  To get only currently live objects, call :func:`collect`
    before calling :func:`get_referrers`.
 
-   Care must be taken when using objects returned by :func:`get_referrers` because
-   some of them could still be under construction and hence in a temporarily
-   invalid state. Avoid using :func:`get_referrers` for any purpose other than
-   debugging.
+   .. warning::
+      Care must be taken when using objects returned by :func:`get_referrers` because
+      some of them could still be under construction and hence in a temporarily
+      invalid state. Avoid using :func:`get_referrers` for any purpose other than
+      debugging.
+
+   .. audit-event:: gc.get_referrers objs gc.get_referrers
 
 
 .. function:: get_referents(*objs)
@@ -151,6 +156,7 @@
    be involved in a cycle.  So, for example, if an integer is directly reachable
    from an argument, that integer object may or may not appear in the result list.
 
+   .. audit-event:: gc.get_referents objs gc.get_referents
 
 .. function:: is_tracked(obj)
 
diff --git a/Doc/library/glob.rst b/Doc/library/glob.rst
index 3c468eb..215f60d 100644
--- a/Doc/library/glob.rst
+++ b/Doc/library/glob.rst
@@ -36,7 +36,7 @@
    The :mod:`pathlib` module offers high-level path objects.
 
 
-.. function:: glob(pathname, *, recursive=False)
+.. function:: glob(pathname, *, root_dir=None, dir_fd=None, recursive=False)
 
    Return a possibly-empty list of path names that match *pathname*, which must be
    a string containing a path specification. *pathname* can be either absolute
@@ -47,6 +47,15 @@
    conditions is removed or added during the call of this function, whether
    a path name for that file be included is unspecified.
 
+   If *root_dir* is not ``None``, it should be a :term:`path-like object`
+   specifying the root directory for searching.  It has the same effect on
+   :func:`glob` as changing the current directory before calling it.  If
+   *pathname* is relative, the result will contain paths relative to
+   *root_dir*.
+
+   This function can support :ref:`paths relative to directory descriptors
+   <dir_fd>` with the *dir_fd* parameter.
+
    .. index::
       single: **; in glob-style wildcards
 
@@ -56,6 +65,7 @@
    match.
 
    .. audit-event:: glob.glob pathname,recursive glob.glob
+   .. audit-event:: glob.glob/2 pathname,recursive,root_dir,dir_fd glob.glob
 
    .. note::
       Using the "``**``" pattern in large directory trees may consume
@@ -64,13 +74,23 @@
    .. versionchanged:: 3.5
       Support for recursive globs using "``**``".
 
+   .. versionchanged:: 3.10
+      Added the *root_dir* and *dir_fd* parameters.
 
-.. function:: iglob(pathname, *, recursive=False)
+
+.. function:: iglob(pathname, *, root_dir=None, dir_fd=None, recursive=False)
 
    Return an :term:`iterator` which yields the same values as :func:`glob`
    without actually storing them all simultaneously.
 
    .. audit-event:: glob.glob pathname,recursive glob.iglob
+   .. audit-event:: glob.glob/2 pathname,recursive,root_dir,dir_fd glob.iglob
+
+   .. versionchanged:: 3.5
+      Support for recursive globs using "``**``".
+
+   .. versionchanged:: 3.10
+      Added the *root_dir* and *dir_fd* parameters.
 
 
 .. function:: escape(pathname)
@@ -116,4 +136,3 @@
 
    Module :mod:`fnmatch`
       Shell-style filename (not path) expansion
-
diff --git a/Doc/library/graphlib.rst b/Doc/library/graphlib.rst
index 0faca21..2bc80da 100644
--- a/Doc/library/graphlib.rst
+++ b/Doc/library/graphlib.rst
@@ -154,9 +154,10 @@
 
    .. method:: static_order()
 
-      Returns an iterable of nodes in a topological order. Using this method
-      does not require to call :meth:`TopologicalSorter.prepare` or
-      :meth:`TopologicalSorter.done`. This method is equivalent to::
+      Returns an iterator object which will iterate over nodes in a topological
+      order. When using this method, :meth:`~TopologicalSorter.prepare` and
+      :meth:`~TopologicalSorter.done` should not be called. This method is
+      equivalent to::
 
           def static_order(self):
               self.prepare()
@@ -206,4 +207,4 @@
    The detected cycle can be accessed via the second element in the :attr:`~CycleError.args`
    attribute of the exception instance and consists in a list of nodes, such that each node is,
    in the graph, an immediate predecessor of the next node in the list. In the reported list,
-   the first and the last node will be the same, to make it clear that it is cyclic.
\ No newline at end of file
+   the first and the last node will be the same, to make it clear that it is cyclic.
diff --git a/Doc/library/hashlib-blake2-tree.png b/Doc/library/hashlib-blake2-tree.png
index 73e8494..faef21b 100644
--- a/Doc/library/hashlib-blake2-tree.png
+++ b/Doc/library/hashlib-blake2-tree.png
Binary files differ
diff --git a/Doc/library/hashlib.rst b/Doc/library/hashlib.rst
index d644974..aa24131 100644
--- a/Doc/library/hashlib.rst
+++ b/Doc/library/hashlib.rst
@@ -23,7 +23,7 @@
 This module implements a common interface to many different secure hash and
 message digest algorithms.  Included are the FIPS secure hash algorithms SHA1,
 SHA224, SHA256, SHA384, and SHA512 (defined in FIPS 180-2) as well as RSA's MD5
-algorithm (defined in Internet :rfc:`1321`).  The terms "secure hash" and
+algorithm (defined in internet :rfc:`1321`).  The terms "secure hash" and
 "message digest" are interchangeable.  Older algorithms were called message
 digests.  The modern term is secure hash.
 
@@ -80,6 +80,8 @@
 .. versionadded:: 3.6
    :func:`blake2b` and :func:`blake2s` were added.
 
+.. _hashlib-usedforsecurity:
+
 .. versionchanged:: 3.9
    All hashlib constructors take a keyword-only argument *usedforsecurity*
    with default value ``True``. A false value allows the use of insecure and
@@ -118,10 +120,10 @@
 
 Using :func:`new` with an algorithm provided by OpenSSL:
 
-   >>> h = hashlib.new('ripemd160')
+   >>> h = hashlib.new('sha256')
    >>> h.update(b"Nobody inspects the spammish repetition")
    >>> h.hexdigest()
-   'cc4a5ce1b3df48aec5d22d1f16b894a0b894eccc'
+   '031edd7d41651593c5fe5c006fa5752b37fddff7bc4e843aa6af0c950f4b9406'
 
 Hashlib provides the following constant attributes:
 
@@ -247,16 +249,19 @@
    a proper source, e.g. :func:`os.urandom`.
 
    The number of *iterations* should be chosen based on the hash algorithm and
-   computing power. As of 2013, at least 100,000 iterations of SHA-256 are
-   suggested.
+   computing power. As of 2022, hundreds of thousands of iterations of SHA-256
+   are suggested. For rationale as to why and how to choose what is best for
+   your application, read *Appendix A.2.2* of NIST-SP-800-132_. The answers
+   on the `stackexchange pbkdf2 iterations question`_ explain in detail.
 
    *dklen* is the length of the derived key. If *dklen* is ``None`` then the
    digest size of the hash algorithm *hash_name* is used, e.g. 64 for SHA-512.
 
-   >>> import hashlib
-   >>> dk = hashlib.pbkdf2_hmac('sha256', b'password', b'salt', 100000)
+   >>> from hashlib import pbkdf2_hmac
+   >>> our_app_iters = 500_000  # Application specific, read above.
+   >>> dk = pbkdf2_hmac('sha256', b'password', b'bad salt'*2, our_app_iters)
    >>> dk.hex()
-   '0394a2ede332c9a13eb82e9b24631604c31df978b4e2f0fbd2c549944f9d79a5'
+   '15530bba69924174860db778f2c6f8104d3aaf9d26241840c8c4a641c8d000a9'
 
    .. versionadded:: 3.4
 
@@ -266,6 +271,12 @@
       Python implementation uses an inline version of :mod:`hmac`. It is about
       three times slower and doesn't release the GIL.
 
+   .. deprecated:: 3.10
+
+      Slow Python implementation of *pbkdf2_hmac* is deprecated. In the
+      future the function will only be available when Python is compiled
+      with OpenSSL.
+
 .. function:: scrypt(password, *, salt, n, r, p, maxmem=0, dklen=64)
 
    The function provides scrypt password-based key derivation function as
@@ -280,8 +291,6 @@
    factor and *maxmem* limits memory (OpenSSL 1.1.0 defaults to 32 MiB).
    *dklen* is the length of the derived key.
 
-   .. availability:: OpenSSL 1.1+.
-
    .. versionadded:: 3.6
 
 
@@ -370,10 +379,10 @@
 * *depth*: maximal depth of tree (1 to 255, 255 if unlimited, 1 in
   sequential mode).
 
-* *leaf_size*: maximal byte length of leaf (0 to 2**32-1, 0 if unlimited or in
+* *leaf_size*: maximal byte length of leaf (0 to ``2**32-1``, 0 if unlimited or in
   sequential mode).
 
-* *node_offset*: node offset (0 to 2**64-1 for BLAKE2b, 0 to 2**48-1 for
+* *node_offset*: node offset (0 to ``2**64-1`` for BLAKE2b, 0 to ``2**48-1`` for
   BLAKE2s, 0 for the first, leftmost, leaf, or in sequential mode).
 
 * *node_depth*: node depth (0 to 255, 0 for leaves, or in sequential mode).
@@ -494,7 +503,7 @@
 
 Keyed hashing can be used for authentication as a faster and simpler
 replacement for `Hash-based message authentication code
-<https://en.wikipedia.org/wiki/Hash-based_message_authentication_code>`_ (HMAC).
+<https://en.wikipedia.org/wiki/HMAC>`_ (HMAC).
 BLAKE2 can be securely used in prefix-MAC mode thanks to the
 indifferentiability property inherited from BLAKE.
 
@@ -725,7 +734,8 @@
 .. _SHA-3: https://en.wikipedia.org/wiki/NIST_hash_function_competition
 .. _ChaCha: https://cr.yp.to/chacha.html
 .. _pyblake2: https://pythonhosted.org/pyblake2/
-
+.. _NIST-SP-800-132: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf
+.. _stackexchange pbkdf2 iterations question: https://security.stackexchange.com/questions/3959/recommended-of-iterations-when-using-pbkdf2-sha256/
 
 
 .. seealso::
@@ -746,5 +756,8 @@
       Wikipedia article with information on which algorithms have known issues and
       what that means regarding their use.
 
-   https://www.ietf.org/rfc/rfc2898.txt
-      PKCS #5: Password-Based Cryptography Specification Version 2.0
+   https://www.ietf.org/rfc/rfc8018.txt
+      PKCS #5: Password-Based Cryptography Specification Version 2.1
+
+   https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf
+      NIST Recommendation for Password-Based Key Derivation.
diff --git a/Doc/library/hmac.rst b/Doc/library/hmac.rst
index 897edc2..6f1b59b 100644
--- a/Doc/library/hmac.rst
+++ b/Doc/library/hmac.rst
@@ -138,7 +138,7 @@
 
    .. versionadded:: 3.3
 
-   .. versionchanged:: 3.9
+   .. versionchanged:: 3.10
 
       The function uses OpenSSL's ``CRYPTO_memcmp()`` internally when
       available.
diff --git a/Doc/library/html.entities.rst b/Doc/library/html.entities.rst
index 067e1b1..7d836fe 100644
--- a/Doc/library/html.entities.rst
+++ b/Doc/library/html.entities.rst
@@ -44,4 +44,4 @@
 
 .. rubric:: Footnotes
 
-.. [#] See https://www.w3.org/TR/html5/syntax.html#named-character-references
+.. [#] See https://html.spec.whatwg.org/multipage/syntax.html#named-character-references
diff --git a/Doc/library/html.parser.rst b/Doc/library/html.parser.rst
index ac844a6..03aff25 100644
--- a/Doc/library/html.parser.rst
+++ b/Doc/library/html.parser.rst
@@ -126,7 +126,7 @@
 
 .. method:: HTMLParser.handle_starttag(tag, attrs)
 
-   This method is called to handle the start of a tag (e.g. ``<div id="main">``).
+   This method is called to handle the start tag of an element (e.g. ``<div id="main">``).
 
    The *tag* argument is the name of the tag converted to lower case. The *attrs*
    argument is a list of ``(name, value)`` pairs containing the attributes found
diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst
index 35997db..e605f7b 100644
--- a/Doc/library/http.client.rst
+++ b/Doc/library/http.client.rst
@@ -99,6 +99,11 @@
       :attr:`ssl.SSLContext.post_handshake_auth` for the default *context* or
       when *cert_file* is passed with a custom *context*.
 
+   .. versionchanged:: 3.10
+      This class now sends an ALPN extension with protocol indicator
+      ``http/1.1`` when no *context* is given. Custom *context* should set
+      ALPN protocols with :meth:`~ssl.SSLContext.set_alpn_protocol`.
+
    .. deprecated:: 3.6
 
        *key_file* and *cert_file* are deprecated in favor of *context*.
@@ -363,6 +368,8 @@
    this is called automatically when making a request if the client does not
    already have a connection.
 
+   .. audit-event:: http.client.connect self,host,port http.client.HTTPConnection.connect
+
 
 .. method:: HTTPConnection.close()
 
@@ -432,6 +439,8 @@
    :meth:`endheaders` method has been called and before :meth:`getresponse` is
    called.
 
+   .. audit-event:: http.client.send self,data http.client.HTTPConnection.send
+
 
 .. _httpresponse-objects:
 
diff --git a/Doc/library/http.cookiejar.rst b/Doc/library/http.cookiejar.rst
index 9ac5d52..3d59665 100644
--- a/Doc/library/http.cookiejar.rst
+++ b/Doc/library/http.cookiejar.rst
@@ -20,7 +20,7 @@
 :rfc:`2965` are handled.  RFC 2965 handling is switched off by default.
 :rfc:`2109` cookies are parsed as Netscape cookies and subsequently treated
 either as Netscape or RFC 2965 cookies according to the 'policy' in effect.
-Note that the great majority of cookies on the Internet are Netscape cookies.
+Note that the great majority of cookies on the internet are Netscape cookies.
 :mod:`http.cookiejar` attempts to follow the de-facto Netscape cookie protocol (which
 differs substantially from that set out in the original Netscape specification),
 including taking note of the ``max-age`` and ``port`` cookie-attributes
@@ -122,7 +122,7 @@
       :mod:`http.cookiejar` and :mod:`http.cookies` modules do not depend on each
       other.
 
-   https://curl.haxx.se/rfc/cookie_spec.html
+   https://curl.se/rfc/cookie_spec.html
       The specification of the original Netscape cookie protocol.  Though this is
       still the dominant protocol, the 'Netscape cookie protocol' implemented by all
       the major browsers (and :mod:`http.cookiejar`) only bears a passing resemblance to
@@ -462,16 +462,16 @@
 tighten up the rather loose Netscape protocol rules a little bit (at the cost of
 blocking some benign cookies).
 
-A domain blacklist and whitelist is provided (both off by default). Only domains
-not in the blacklist and present in the whitelist (if the whitelist is active)
+A domain blocklist and allowlist is provided (both off by default). Only domains
+not in the blocklist and present in the allowlist (if the allowlist is active)
 participate in cookie setting and returning.  Use the *blocked_domains*
 constructor argument, and :meth:`blocked_domains` and
 :meth:`set_blocked_domains` methods (and the corresponding argument and methods
-for *allowed_domains*).  If you set a whitelist, you can turn it off again by
+for *allowed_domains*).  If you set an allowlist, you can turn it off again by
 setting it to :const:`None`.
 
 Domains in block or allow lists that do not start with a dot must equal the
-cookie domain to be matched.  For example, ``"example.com"`` matches a blacklist
+cookie domain to be matched.  For example, ``"example.com"`` matches a blocklist
 entry of ``"example.com"``, but ``"www.example.com"`` does not.  Domains that do
 start with a dot are matched by more specific domains too. For example, both
 ``"www.example.com"`` and ``"www.coyote.example.com"`` match ``".example.com"``
@@ -494,7 +494,7 @@
 
 .. method:: DefaultCookiePolicy.is_blocked(domain)
 
-   Return whether *domain* is on the blacklist for setting or receiving cookies.
+   Return whether *domain* is on the blocklist for setting or receiving cookies.
 
 
 .. method:: DefaultCookiePolicy.allowed_domains()
@@ -509,7 +509,7 @@
 
 .. method:: DefaultCookiePolicy.is_not_allowed(domain)
 
-   Return whether *domain* is not on the whitelist for setting or receiving
+   Return whether *domain* is not on the allowlist for setting or receiving
    cookies.
 
 :class:`DefaultCookiePolicy` instances have the following attributes, which are
diff --git a/Doc/library/http.rst b/Doc/library/http.rst
index 14ee733..2466c84 100644
--- a/Doc/library/http.rst
+++ b/Doc/library/http.rst
@@ -45,7 +45,7 @@
       >>> HTTPStatus.OK.description
       'Request fulfilled, document follows'
       >>> list(HTTPStatus)
-      [<HTTPStatus.CONTINUE: 100>, <HTTPStatus.SWITCHING_PROTOCOLS: 101>, ...]
+      [<HTTPStatus.CONTINUE: 100>, <HTTPStatus.SWITCHING_PROTOCOLS:101>, ...]
 
 .. _http-status-codes:
 
diff --git a/Doc/library/http.server.rst b/Doc/library/http.server.rst
index 478a5b3..0de0283 100644
--- a/Doc/library/http.server.rst
+++ b/Doc/library/http.server.rst
@@ -14,7 +14,7 @@
 
 --------------
 
-This module defines classes for implementing HTTP servers (Web servers).
+This module defines classes for implementing HTTP servers.
 
 
 .. warning::
@@ -98,7 +98,9 @@
 
    .. attribute:: path
 
-      Contains the request path.
+      Contains the request path. If query component of the URL is present,
+      then ``path`` includes the query. Using the terminology of :rfc:`3986`,
+      ``path`` here includes ``hier-part`` and the ``query``.
 
    .. attribute:: request_version
 
@@ -195,7 +197,7 @@
       request header it responds back with a ``100 Continue`` followed by ``200
       OK`` headers.
       This method can be overridden to raise an error if the server does not
-      want the client to continue.  For e.g. server can chose to send ``417
+      want the client to continue.  For e.g. server can choose to send ``417
       Expectation Failed`` as a response header and ``return False``.
 
       .. versionadded:: 3.2
@@ -318,9 +320,16 @@
 
 .. class:: SimpleHTTPRequestHandler(request, client_address, server, directory=None)
 
-   This class serves files from the current directory and below, directly
+   This class serves files from the directory *directory* and below,
+   or the current directory if *directory* is not provided, directly
    mapping the directory structure to HTTP requests.
 
+   .. versionadded:: 3.7
+      The *directory* parameter.
+
+   .. versionchanged:: 3.9
+      The *directory* parameter accepts a :term:`path-like object`.
+
    A lot of the work, such as parsing the request, is done by the base class
    :class:`BaseHTTPRequestHandler`.  This class implements the :func:`do_GET`
    and :func:`do_HEAD` functions.
@@ -343,13 +352,6 @@
          This dictionary is no longer filled with the default system mappings,
          but only contains overrides.
 
-   .. attribute:: directory
-
-      If not specified, the directory to serve is the current working directory.
-
-      .. versionchanged:: 3.9
-         Accepts a :term:`path-like object`.
-
    The :class:`SimpleHTTPRequestHandler` class defines the following methods:
 
    .. method:: do_HEAD()
@@ -410,17 +412,22 @@
 .. _http-server-cli:
 
 :mod:`http.server` can also be invoked directly using the :option:`-m`
-switch of the interpreter with a ``port number`` argument.  Similar to
+switch of the interpreter.  Similar to
 the previous example, this serves files relative to the current directory::
 
-        python -m http.server 8000
+        python -m http.server
 
-By default, server binds itself to all interfaces.  The option ``-b/--bind``
+The server listens to port 8000 by default. The default can be overridden
+by passing the desired port number as an argument::
+
+        python -m http.server 9000
+
+By default, the server binds itself to all interfaces.  The option ``-b/--bind``
 specifies a specific address to which it should bind. Both IPv4 and IPv6
 addresses are supported. For example, the following command causes the server
 to bind to localhost only::
 
-        python -m http.server 8000 --bind 127.0.0.1
+        python -m http.server --bind 127.0.0.1
 
 .. versionadded:: 3.4
     ``--bind`` argument was introduced.
@@ -428,14 +435,14 @@
 .. versionadded:: 3.8
     ``--bind`` argument enhanced to support IPv6
 
-By default, server uses the current directory. The option ``-d/--directory``
+By default, the server uses the current directory. The option ``-d/--directory``
 specifies a directory to which it should serve the files. For example,
 the following command uses a specific directory::
 
         python -m http.server --directory /tmp/
 
 .. versionadded:: 3.7
-    ``--directory`` specify alternate directory
+    ``--directory`` argument was introduced.
 
 .. class:: CGIHTTPRequestHandler(request, client_address, server)
 
@@ -480,4 +487,4 @@
 :class:`CGIHTTPRequestHandler` can be enabled in the command line by passing
 the ``--cgi`` option::
 
-        python -m http.server --cgi 8000
+        python -m http.server --cgi
diff --git a/Doc/library/idle.rst b/Doc/library/idle.rst
index a59a5d3..d602104 100644
--- a/Doc/library/idle.rst
+++ b/Doc/library/idle.rst
@@ -96,11 +96,13 @@
 Print Window
    Print the current window to the default printer.
 
-Close
-   Close the current window (ask to save if unsaved).
+Close Window
+   Close the current window (if an unsaved editor, ask to save; if an unsaved
+   Shell, ask to quit execution).  Calling ``exit()`` or ``close()`` in the Shell
+   window also closes Shell.  If this is the only window, also exit IDLE.
 
-Exit
-   Close all windows and quit IDLE (ask to save unsaved windows).
+Exit IDLE
+   Close all windows and quit IDLE (ask to save unsaved edit windows).
 
 Edit menu (Shell and Editor)
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -250,7 +252,7 @@
   Scroll the shell window to the last Shell restart.
 
 Restart Shell
-  Restart the shell to clean the environment.
+  Restart the shell to clean the environment and reset display and exception handling.
 
 Previous History
   Cycle through earlier commands in history which match the current entry.
@@ -518,7 +520,7 @@
 after adding imports at the top of a file.  This also increases
 possible attribute completions.
 
-Completion boxes intially exclude names beginning with '_' or, for
+Completion boxes initially exclude names beginning with '_' or, for
 modules, not included in '__all__'.  The hidden names can be accessed
 by typing '_' after '.', either before or after the box is opened.
 
@@ -613,6 +615,12 @@
 ``def``, strings, and comments. For any text window, these are the cursor (when
 present), found text (when possible), and selected text.
 
+IDLE also highlights the :ref:`soft keywords <soft-keywords>` :keyword:`match`,
+:keyword:`case <match>`, and :keyword:`_ <wildcard-patterns>` in
+pattern-matching statements. However, this highlighting is not perfect and
+will be incorrect in some rare cases, including some ``_``-s in ``case``
+patterns.
+
 Text coloring is done in the background, so uncolorized text is occasionally
 visible.  To change the color scheme, use the Configure IDLE dialog
 Highlighting tab.  The marking of debugger breakpoint lines in the editor and
@@ -670,8 +678,16 @@
 code execution process.  A connection must be established whenever the Shell
 starts or restarts.  (The latter is indicated by a divider line that says
 'RESTART'). If the user process fails to connect to the GUI process, it
-displays a ``Tk`` error box with a 'cannot connect' message that directs the
-user here.  It then exits.
+usually displays a ``Tk`` error box with a 'cannot connect' message
+that directs the user here.  It then exits.
+
+One specific connection failure on Unix systems results from
+misconfigured masquerading rules somewhere in a system's network setup.
+When IDLE is started from a terminal, one will see a message starting
+with ``** Invalid host:``.
+The valid value is ``127.0.0.1 (idlelib.rpc.LOCALHOST)``.
+One can diagnose with ``tcpconnect -irv 127.0.0.1 6543`` in one
+terminal window and ``tcplisten <same args>`` in another.
 
 A common cause of failure is a user-written file with the same name as a
 standard library module, such as *random.py* and *tkinter.py*. When such a
@@ -709,6 +725,13 @@
 starting it from a console or terminal (``python -m idlelib``) and see if
 this results in an error message.
 
+On Unix-based systems with tcl/tk older than ``8.6.11`` (see
+``About IDLE``) certain characters of certain fonts can cause
+a tk failure with a message to the terminal.  This can happen either
+if one starts IDLE to edit a file with such a character or later
+when entering such a character.  If one cannot upgrade tcl/tk,
+then re-configure IDLE to use a font that works better.
+
 Running user code
 ^^^^^^^^^^^^^^^^^
 
@@ -717,7 +740,7 @@
 directly with Python in a text-mode system console or terminal window.
 However, the different interface and operation occasionally affect
 visible results.  For instance, ``sys.modules`` starts with more entries,
-and ``threading.activeCount()`` returns 2 instead of 1.
+and ``threading.active_count()`` returns 2 instead of 1.
 
 By default, IDLE runs user code in a separate OS process rather than in
 the user interface process that runs the shell and editor.  In the execution
@@ -726,28 +749,38 @@
 The original values stored in ``sys.__stdin__``, ``sys.__stdout__``, and
 ``sys.__stderr__`` are not touched, but may be ``None``.
 
-When Shell has the focus, it controls the keyboard and screen.  This is
-normally transparent, but functions that directly access the keyboard
-and screen will not work.  These include system-specific functions that
-determine whether a key has been pressed and if so, which.
+Sending print output from one process to a text widget in another is
+slower than printing to a system terminal in the same process.
+This has the most effect when printing multiple arguments, as the string
+for each argument, each separator, the newline are sent separately.
+For development, this is usually not a problem, but if one wants to
+print faster in IDLE, format and join together everything one wants
+displayed together and then print a single string.  Both format strings
+and :meth:`str.join` can help combine fields and lines.
 
 IDLE's standard stream replacements are not inherited by subprocesses
-created in the execution process, whether directly by user code or by modules
-such as multiprocessing.  If such subprocess use ``input`` from sys.stdin
-or ``print`` or ``write`` to sys.stdout or sys.stderr,
+created in the execution process, whether directly by user code or by
+modules such as multiprocessing.  If such subprocess use ``input`` from
+sys.stdin or ``print`` or ``write`` to sys.stdout or sys.stderr,
 IDLE should be started in a command line window.  The secondary subprocess
 will then be attached to that window for input and output.
 
-The IDLE code running in the execution process adds frames to the call stack
-that would not be there otherwise.  IDLE wraps ``sys.getrecursionlimit`` and
-``sys.setrecursionlimit`` to reduce the effect of the additional stack frames.
-
 If ``sys`` is reset by user code, such as with ``importlib.reload(sys)``,
 IDLE's changes are lost and input from the keyboard and output to the screen
 will not work correctly.
 
-When user code raises SystemExit either directly or by calling sys.exit, IDLE
-returns to a Shell prompt instead of exiting.
+When Shell has the focus, it controls the keyboard and screen.  This is
+normally transparent, but functions that directly access the keyboard
+and screen will not work.  These include system-specific functions that
+determine whether a key has been pressed and if so, which.
+
+The IDLE code running in the execution process adds frames to the call stack
+that would not be there otherwise.  IDLE wraps ``sys.getrecursionlimit`` and
+``sys.setrecursionlimit`` to reduce the effect of the additional stack
+frames.
+
+When user code raises SystemExit either directly or by calling sys.exit,
+IDLE returns to a Shell prompt instead of exiting.
 
 User output in Shell
 ^^^^^^^^^^^^^^^^^^^^
@@ -838,7 +871,7 @@
 
 By default, IDLE executes user code in a separate subprocess via a socket,
 which uses the internal loopback interface.  This connection is not
-externally visible and no data is sent to or received from the Internet.
+externally visible and no data is sent to or received from the internet.
 If firewall software complains anyway, you can ignore it.
 
 If the attempt to make the socket connection fails, Idle will notify you.
diff --git a/Doc/library/imghdr.rst b/Doc/library/imghdr.rst
index 800e919..3d7f6de 100644
--- a/Doc/library/imghdr.rst
+++ b/Doc/library/imghdr.rst
@@ -14,11 +14,11 @@
 The :mod:`imghdr` module defines the following function:
 
 
-.. function:: what(filename, h=None)
+.. function:: what(file, h=None)
 
-   Tests the image data contained in the file named by *filename*, and returns a
-   string describing the image type.  If optional *h* is provided, the *filename*
-   is ignored and *h* is assumed to contain the byte stream to test.
+   Tests the image data contained in the file named by *file*, and returns a
+   string describing the image type.  If optional *h* is provided, the *file*
+   argument is ignored and *h* is assumed to contain the byte stream to test.
 
    .. versionchanged:: 3.6
       Accepts a :term:`path-like object`.
diff --git a/Doc/library/importlib.metadata.rst b/Doc/library/importlib.metadata.rst
index 21da143..a6caa99 100644
--- a/Doc/library/importlib.metadata.rst
+++ b/Doc/library/importlib.metadata.rst
@@ -4,9 +4,14 @@
  Using :mod:`!importlib.metadata`
 =================================
 
-.. note::
-   This functionality is provisional and may deviate from the usual
-   version semantics of the standard library.
+.. module:: importlib.metadata
+   :synopsis: The implementation of the importlib metadata.
+
+.. versionadded:: 3.8
+.. versionchanged:: 3.10
+   ``importlib.metadata`` is no longer provisional.
+
+**Source code:** :source:`Lib/importlib/metadata/__init__.py`
 
 ``importlib.metadata`` is a library that provides for access to installed
 package metadata.  Built in part on Python's import system, this library
@@ -74,18 +79,48 @@
 Entry points
 ------------
 
-The ``entry_points()`` function returns a dictionary of all entry points,
-keyed by group.  Entry points are represented by ``EntryPoint`` instances;
+The ``entry_points()`` function returns a collection of entry points.
+Entry points are represented by ``EntryPoint`` instances;
 each ``EntryPoint`` has a ``.name``, ``.group``, and ``.value`` attributes and
 a ``.load()`` method to resolve the value.  There are also ``.module``,
 ``.attr``, and ``.extras`` attributes for getting the components of the
-``.value`` attribute::
+``.value`` attribute.
+
+Query all entry points::
 
     >>> eps = entry_points()  # doctest: +SKIP
-    >>> list(eps)  # doctest: +SKIP
+
+The ``entry_points()`` function returns an ``EntryPoints`` object,
+a sequence of all ``EntryPoint`` objects with ``names`` and ``groups``
+attributes for convenience::
+
+    >>> sorted(eps.groups)  # doctest: +SKIP
     ['console_scripts', 'distutils.commands', 'distutils.setup_keywords', 'egg_info.writers', 'setuptools.installation']
-    >>> scripts = eps['console_scripts']  # doctest: +SKIP
-    >>> wheel = [ep for ep in scripts if ep.name == 'wheel'][0]  # doctest: +SKIP
+
+``EntryPoints`` has a ``select`` method to select entry points
+matching specific properties. Select entry points in the
+``console_scripts`` group::
+
+    >>> scripts = eps.select(group='console_scripts')  # doctest: +SKIP
+
+Equivalently, since ``entry_points`` passes keyword arguments
+through to select::
+
+    >>> scripts = entry_points(group='console_scripts')  # doctest: +SKIP
+
+Pick out a specific script named "wheel" (found in the wheel project)::
+
+    >>> 'wheel' in scripts.names  # doctest: +SKIP
+    True
+    >>> wheel = scripts['wheel']  # doctest: +SKIP
+
+Equivalently, query for that entry point during selection::
+
+    >>> (wheel,) = entry_points(group='console_scripts', name='wheel')  # doctest: +SKIP
+    >>> (wheel,) = entry_points().select(group='console_scripts', name='wheel')  # doctest: +SKIP
+
+Inspect the resolved entry point::
+
     >>> wheel  # doctest: +SKIP
     EntryPoint(name='wheel', value='wheel.cli:main', group='console_scripts')
     >>> wheel.module  # doctest: +SKIP
@@ -104,6 +139,17 @@
 <https://setuptools.readthedocs.io/en/latest/setuptools.html#dynamic-discovery-of-services-and-plugins>`_
 for more information on entry points, their definition, and usage.
 
+*Compatibility Note*
+
+The "selectable" entry points were introduced in ``importlib_metadata``
+3.6 and Python 3.10. Prior to those changes, ``entry_points`` accepted
+no parameters and always returned a dictionary of entry points, keyed
+by group. For compatibility, if no parameters are passed to entry_points,
+a ``SelectableGroups`` object is returned, implementing that dict
+interface. In the future, calling ``entry_points`` with no parameters
+will return an ``EntryPoints`` object. Users should rely on the selection
+interface to retrieve entry points by group.
+
 
 .. _metadata:
 
@@ -115,12 +161,26 @@
 
     >>> wheel_metadata = metadata('wheel')  # doctest: +SKIP
 
-The keys of the returned data structure [#f1]_ name the metadata keywords, and
-their values are returned unparsed from the distribution metadata::
+The keys of the returned data structure, a ``PackageMetadata``,
+name the metadata keywords, and
+the values are returned unparsed from the distribution metadata::
 
     >>> wheel_metadata['Requires-Python']  # doctest: +SKIP
     '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'
 
+``PackageMetadata`` also presents a ``json`` attribute that returns
+all the metadata in a JSON-compatible form per :PEP:`566`::
+
+    >>> wheel_metadata.json['requires_python']
+    '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'
+
+.. versionchanged:: 3.10
+   The ``Description`` is now included in the metadata when presented
+   through the payload. Line continuation characters have been removed.
+
+.. versionadded:: 3.10
+   The ``json`` attribute was added.
+
 
 .. _version:
 
@@ -142,7 +202,7 @@
 You can also get the full set of files contained within a distribution.  The
 ``files()`` function takes a distribution package name and returns all of the
 files installed by this distribution.  Each file object returned is a
-``PackagePath``, a :class:`pathlib.Path` derived object with additional ``dist``,
+``PackagePath``, a :class:`pathlib.PurePath` derived object with additional ``dist``,
 ``size``, and ``hash`` properties as indicated by the metadata.  For example::
 
     >>> util = [p for p in files('wheel') if 'util.py' in str(p)][0]  # doctest: +SKIP
@@ -166,6 +226,12 @@
             return s.encode('utf-8')
         return s
 
+You can also use the ``locate`` method to get a the absolute path to the
+file::
+
+    >>> util.locate()  # doctest: +SKIP
+    PosixPath('/home/gustav/example/lib/site-packages/wheel/util.py')
+
 In the case where the metadata file listing files
 (RECORD or SOURCES.txt) is missing, ``files()`` will
 return ``None``. The caller may wish to wrap calls to
@@ -186,6 +252,20 @@
     ["pytest (>=3.0.0) ; extra == 'test'", "pytest-cov ; extra == 'test'"]
 
 
+Package distributions
+---------------------
+
+A convenience method to resolve the distribution or
+distributions (in the case of a namespace package) for top-level
+Python packages or modules::
+
+    >>> packages_distributions()
+    {'importlib_metadata': ['importlib-metadata'], 'yaml': ['PyYAML'], 'jaraco': ['jaraco.classes', 'jaraco.functools'], ...}
+
+.. versionadded:: 3.10
+
+.. _distributions:
+
 Distributions
 =============
 
@@ -206,9 +286,9 @@
 There are all kinds of additional metadata available on the ``Distribution``
 instance::
 
-    >>> d.metadata['Requires-Python']  # doctest: +SKIP
+    >>> dist.metadata['Requires-Python']  # doctest: +SKIP
     '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'
-    >>> d.metadata['License']  # doctest: +SKIP
+    >>> dist.metadata['License']  # doctest: +SKIP
     'MIT'
 
 The full set of available metadata is not described here.  See :pep:`566`
@@ -256,12 +336,3 @@
 .. _`entry point API`: https://setuptools.readthedocs.io/en/latest/pkg_resources.html#entry-points
 .. _`metadata API`: https://setuptools.readthedocs.io/en/latest/pkg_resources.html#metadata-api
 .. _`importlib_resources`: https://importlib-resources.readthedocs.io/en/latest/index.html
-
-
-.. rubric:: Footnotes
-
-.. [#f1] Technically, the returned distribution metadata object is an
-         :class:`email.message.EmailMessage`
-         instance, but this is an implementation detail, and not part of the
-         stable API.  You should only use dictionary-like methods and syntax
-         to access the metadata contents.
diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst
index 9027ba5..3576941 100644
--- a/Doc/library/importlib.rst
+++ b/Doc/library/importlib.rst
@@ -208,7 +208,7 @@
    .. versionadded:: 3.4
    .. versionchanged:: 3.7
        :exc:`ModuleNotFoundError` is raised when the module being reloaded lacks
-       a :class:`ModuleSpec`.
+       a :class:`~importlib.machinery.ModuleSpec`.
 
 
 :mod:`importlib.abc` -- Abstract base classes related to import
@@ -257,6 +257,10 @@
          Returns ``None`` when called instead of raising
          :exc:`NotImplementedError`.
 
+      .. deprecated:: 3.10
+         Implement :meth:`MetaPathFinder.find_spec` or
+         :meth:`PathEntryFinder.find_spec` instead.
+
 
 .. class:: MetaPathFinder
 
@@ -265,6 +269,9 @@
 
    .. versionadded:: 3.3
 
+   .. versionchanged:: 3.10
+      No longer a subclass of :class:`Finder`.
+
    .. method:: find_spec(fullname, path, target=None)
 
       An abstract method for finding a :term:`spec <module spec>` for
@@ -313,11 +320,13 @@
    An abstract base class representing a :term:`path entry finder`.  Though
    it bears some similarities to :class:`MetaPathFinder`, ``PathEntryFinder``
    is meant for use only within the path-based import subsystem provided
-   by :class:`PathFinder`. This ABC is a subclass of :class:`Finder` for
-   compatibility reasons only.
+   by :class:`importlib.machinery.PathFinder`.
 
    .. versionadded:: 3.3
 
+   .. versionchanged:: 3.10
+      No longer a subclass of :class:`Finder`.
+
    .. method:: find_spec(fullname, target=None)
 
       An abstract method for finding a :term:`spec <module spec>` for
@@ -363,7 +372,8 @@
    .. method:: invalidate_caches()
 
       An optional method which, when called, should invalidate any internal
-      cache used by the finder. Used by :meth:`PathFinder.invalidate_caches`
+      cache used by the finder. Used by
+      :meth:`importlib.machinery.PathFinder.invalidate_caches`
       when invalidating the caches of all cached finders.
 
 
@@ -481,7 +491,7 @@
 
 .. class:: ResourceReader
 
-    *Superseded by TraversableReader*
+    *Superseded by TraversableResources*
 
     An :term:`abstract base class` to provide the ability to read
     *resources*.
@@ -612,7 +622,7 @@
 
     .. method:: is_package(fullname)
 
-        An abstract method to return a true value if the module is a package, a
+        An optional method to return a true value if the module is a package, a
         false value otherwise. :exc:`ImportError` is raised if the
         :term:`loader` cannot find the module.
 
@@ -805,8 +815,48 @@
 
     .. versionadded:: 3.9
 
+    .. abstractmethod:: name()
 
-.. class:: TraversableReader
+       The base name of this object without any parent references.
+
+    .. abstractmethod:: iterdir()
+
+       Yield Traversable objects in self.
+
+    .. abstractmethod:: is_dir()
+
+       Return True if self is a directory.
+
+    .. abstractmethod:: is_file()
+
+       Return True if self is a file.
+
+    .. abstractmethod:: joinpath(child)
+
+       Return Traversable child in self.
+
+    .. abstractmethod:: __truediv__(child)
+
+       Return Traversable child in self.
+
+    .. abstractmethod:: open(mode='r', *args, **kwargs)
+
+       *mode* may be 'r' or 'rb' to open as text or binary. Return a handle
+       suitable for reading (same as :attr:`pathlib.Path.open`).
+
+       When opening as text, accepts encoding parameters such as those
+       accepted by :attr:`io.TextIOWrapper`.
+
+    .. method:: read_bytes()
+
+       Read contents of self as bytes.
+
+    .. method:: read_text(encoding=None)
+
+       Read contents of self as text.
+
+
+.. class:: TraversableResources
 
     An abstract base class for resource readers capable of serving
     the ``files`` interface. Subclasses ResourceReader and provides
@@ -814,6 +864,9 @@
     methods. Therefore, any loader supplying TraversableReader
     also supplies ResourceReader.
 
+    Loaders that wish to support resource reading are expected to
+    implement this interface.
+
     .. versionadded:: 3.9
 
 
@@ -888,6 +941,22 @@
 
     .. versionadded:: 3.9
 
+.. function:: as_file(traversable)
+
+    Given a :class:`importlib.resources.abc.Traversable` object representing
+    a file, typically from :func:`importlib.resources.files`, return
+    a context manager for use in a :keyword:`with` statement.
+    The context manager provides a :class:`pathlib.Path` object.
+
+    Exiting the context manager cleans up any temporary file created when the
+    resource was extracted from e.g. a zip file.
+
+    Use ``as_file`` when the Traversable methods
+    (``read_text``, etc) are insufficient and an actual file on
+    the file system is required.
+
+    .. versionadded:: 3.9
+
 .. function:: open_binary(package, resource)
 
     Open for binary reading the *resource* within *package*.
@@ -1135,7 +1204,7 @@
       directory for ``''`` (i.e. the empty string).
 
 
-.. class:: FileFinder(path, \*loader_details)
+.. class:: FileFinder(path, *loader_details)
 
    A concrete implementation of :class:`importlib.abc.PathEntryFinder` which
    caches results from the file system.
@@ -1174,11 +1243,14 @@
 
       Attempt to find the loader to handle *fullname* within :attr:`path`.
 
+      .. deprecated:: 3.10
+         Use :meth:`find_spec` instead.
+
    .. method:: invalidate_caches()
 
       Clear out the internal cache.
 
-   .. classmethod:: path_hook(\*loader_details)
+   .. classmethod:: path_hook(*loader_details)
 
       A class method which returns a closure for use on :attr:`sys.path_hooks`.
       An instance of :class:`FileFinder` is returned by the closure using the
@@ -1473,7 +1545,7 @@
 
    If  **name** has no leading dots, then **name** is simply returned. This
    allows for usage such as
-   ``importlib.util.resolve_name('sys', __package__)`` without doing a
+   ``importlib.util.resolve_name('sys', __spec__.parent)`` without doing a
    check to see if the **package** argument is needed.
 
    :exc:`ImportError` is raised if **name** is a relative module name but
@@ -1588,9 +1660,9 @@
 
 .. function:: spec_from_loader(name, loader, *, origin=None, is_package=None)
 
-   A factory function for creating a :class:`ModuleSpec` instance based
-   on a loader.  The parameters have the same meaning as they do for
-   ModuleSpec.  The function uses available :term:`loader` APIs, such as
+   A factory function for creating a :class:`~importlib.machinery.ModuleSpec`
+   instance based on a loader.  The parameters have the same meaning as they do
+   for ModuleSpec.  The function uses available :term:`loader` APIs, such as
    :meth:`InspectLoader.is_package`, to fill in any missing
    information on the spec.
 
@@ -1598,9 +1670,9 @@
 
 .. function:: spec_from_file_location(name, location, *, loader=None, submodule_search_locations=None)
 
-   A factory function for creating a :class:`ModuleSpec` instance based
-   on the path to a file.  Missing information will be filled in on the
-   spec by making use of loader APIs and by the implication that the
+   A factory function for creating a :class:`~importlib.machinery.ModuleSpec`
+   instance based on the path to a file.  Missing information will be filled in
+   on the spec by making use of loader APIs and by the implication that the
    module will be file-based.
 
    .. versionadded:: 3.4
@@ -1718,6 +1790,29 @@
   spec.loader.exec_module(module)
 
 
+Implementing lazy imports
+'''''''''''''''''''''''''
+
+The example below shows how to implement lazy imports::
+
+    >>> import importlib.util
+    >>> import sys
+    >>> def lazy_import(name):
+    ...     spec = importlib.util.find_spec(name)
+    ...     loader = importlib.util.LazyLoader(spec.loader)
+    ...     spec.loader = loader
+    ...     module = importlib.util.module_from_spec(spec)
+    ...     sys.modules[name] = module
+    ...     loader.exec_module(module)
+    ...     return module
+    ...
+    >>> lazy_typing = lazy_import("typing")
+    >>> #lazy_typing is a real module object,
+    >>> #but it is not loaded in memory yet.
+    >>> lazy_typing.TYPE_CHECKING
+    False
+
+
 
 Setting up an importer
 ''''''''''''''''''''''
diff --git a/Doc/library/index.rst b/Doc/library/index.rst
index bebf7429..db8f0d9 100644
--- a/Doc/library/index.rst
+++ b/Doc/library/index.rst
@@ -56,7 +56,6 @@
    crypto.rst
    allos.rst
    concurrency.rst
-   contextvars.rst
    ipc.rst
    netdata.rst
    markup.rst
@@ -72,8 +71,8 @@
    custominterp.rst
    modules.rst
    language.rst
-   misc.rst
    windows.rst
    unix.rst
    superseded.rst
    undoc.rst
+   security_warnings.rst
diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst
index d00a30f..d7ef2ad 100644
--- a/Doc/library/inspect.rst
+++ b/Doc/library/inspect.rst
@@ -95,6 +95,8 @@
 |           | __globals__       | global namespace in which |
 |           |                   | this function was defined |
 +-----------+-------------------+---------------------------+
+|           | __builtins__      | builtins namespace        |
++-----------+-------------------+---------------------------+
 |           | __annotations__   | mapping of parameters     |
 |           |                   | names to annotations;     |
 |           |                   | ``"return"`` key is       |
@@ -185,8 +187,9 @@
 |           | co_name           | name with which this code |
 |           |                   | object was defined        |
 +-----------+-------------------+---------------------------+
-|           | co_names          | tuple of names of local   |
-|           |                   | variables                 |
+|           | co_names          | tuple of names other      |
+|           |                   | than arguments and        |
+|           |                   | function locals           |
 +-----------+-------------------+---------------------------+
 |           | co_nlocals        | number of local variables |
 +-----------+-------------------+---------------------------+
@@ -251,6 +254,10 @@
 
    Add ``cr_origin`` attribute to coroutines.
 
+.. versionchanged:: 3.10
+
+   Add ``__builtins__`` attribute to functions.
+
 .. function:: getmembers(object[, predicate])
 
    Return all the members of an object in a list of ``(name, value)``
@@ -556,7 +563,7 @@
 return annotation.  To retrieve a Signature object, use the :func:`signature`
 function.
 
-.. function:: signature(callable, \*, follow_wrapped=True)
+.. function:: signature(callable, *, follow_wrapped=True, globals=None, locals=None, eval_str=False)
 
    Return a :class:`Signature` object for the given ``callable``::
 
@@ -578,8 +585,20 @@
    Accepts a wide range of Python callables, from plain functions and classes to
    :func:`functools.partial` objects.
 
+   For objects defined in modules using stringized annotations
+   (``from __future__ import annotations``), :func:`signature` will
+   attempt to automatically un-stringize the annotations using
+   :func:`inspect.get_annotations()`.  The
+   ``global``, ``locals``, and ``eval_str`` parameters are passed
+   into :func:`inspect.get_annotations()` when resolving the
+   annotations; see the documentation for :func:`inspect.get_annotations()`
+   for instructions on how to use these parameters.
+
    Raises :exc:`ValueError` if no signature can be provided, and
-   :exc:`TypeError` if that type of object is not supported.
+   :exc:`TypeError` if that type of object is not supported.  Also,
+   if the annotations are stringized, and ``eval_str`` is not false,
+   the ``eval()`` call(s) to un-stringize the annotations could
+   potentially raise any kind of exception.
 
    A slash(/) in the signature of a function denotes that the parameters prior
    to it are positional-only. For more info, see
@@ -590,6 +609,9 @@
       ``callable`` specifically (``callable.__wrapped__`` will not be used to
       unwrap decorated callables.)
 
+   .. versionadded:: 3.10
+      ``globals``, ``locals``, and ``eval_str`` parameters.
+
    .. note::
 
       Some callables may not be introspectable in certain implementations of
@@ -597,7 +619,7 @@
       C provide no metadata about their arguments.
 
 
-.. class:: Signature(parameters=None, \*, return_annotation=Signature.empty)
+.. class:: Signature(parameters=None, *, return_annotation=Signature.empty)
 
    A Signature object represents the call signature of a function and its return
    annotation.  For each parameter accepted by the function it stores a
@@ -668,11 +690,12 @@
          >>> str(new_sig)
          "(a, b) -> 'new return anno'"
 
-   .. classmethod:: Signature.from_callable(obj, \*, follow_wrapped=True)
+   .. classmethod:: Signature.from_callable(obj, *, follow_wrapped=True, globalns=None, localns=None)
 
        Return a :class:`Signature` (or its subclass) object for a given callable
        ``obj``.  Pass ``follow_wrapped=False`` to get a signature of ``obj``
-       without unwrapping its ``__wrapped__`` chain.
+       without unwrapping its ``__wrapped__`` chain. ``globalns`` and
+       ``localns`` will be used as the namespaces when resolving annotations.
 
        This method simplifies subclassing of :class:`Signature`::
 
@@ -683,8 +706,11 @@
 
        .. versionadded:: 3.5
 
+       .. versionadded:: 3.10
+          ``globalns`` and ``localns`` parameters.
 
-.. class:: Parameter(name, kind, \*, default=Parameter.empty, annotation=Parameter.empty)
+
+.. class:: Parameter(name, kind, *, default=Parameter.empty, annotation=Parameter.empty)
 
    Parameter objects are *immutable*.  Instead of modifying a Parameter object,
    you can use :meth:`Parameter.replace` to create a modified copy.
@@ -809,10 +835,10 @@
          >>> str(param.replace(default=Parameter.empty, annotation='spam'))
          "foo:'spam'"
 
-    .. versionchanged:: 3.4
-        In Python 3.3 Parameter objects were allowed to have ``name`` set
-        to ``None`` if their ``kind`` was set to ``POSITIONAL_ONLY``.
-        This is no longer permitted.
+   .. versionchanged:: 3.4
+      In Python 3.3 Parameter objects were allowed to have ``name`` set
+      to ``None`` if their ``kind`` was set to ``POSITIONAL_ONLY``.
+      This is no longer permitted.
 
 .. class:: BoundArguments
 
@@ -1093,6 +1119,62 @@
    .. versionadded:: 3.4
 
 
+.. function:: get_annotations(obj, *, globals=None, locals=None, eval_str=False)
+
+   Compute the annotations dict for an object.
+
+   ``obj`` may be a callable, class, or module.
+   Passing in an object of any other type raises :exc:`TypeError`.
+
+   Returns a dict.  ``get_annotations()`` returns a new dict every time
+   it's called; calling it twice on the same object will return two
+   different but equivalent dicts.
+
+   This function handles several details for you:
+
+   * If ``eval_str`` is true, values of type ``str`` will
+     be un-stringized using :func:`eval()`.  This is intended
+     for use with stringized annotations
+     (``from __future__ import annotations``).
+   * If ``obj`` doesn't have an annotations dict, returns an
+     empty dict.  (Functions and methods always have an
+     annotations dict; classes, modules, and other types of
+     callables may not.)
+   * Ignores inherited annotations on classes.  If a class
+     doesn't have its own annotations dict, returns an empty dict.
+   * All accesses to object members and dict values are done
+     using ``getattr()`` and ``dict.get()`` for safety.
+   * Always, always, always returns a freshly-created dict.
+
+   ``eval_str`` controls whether or not values of type ``str`` are replaced
+   with the result of calling :func:`eval()` on those values:
+
+   * If eval_str is true, :func:`eval()` is called on values of type ``str``.
+     (Note that ``get_annotations`` doesn't catch exceptions; if :func:`eval()`
+     raises an exception, it will unwind the stack past the ``get_annotations``
+     call.)
+   * If eval_str is false (the default), values of type ``str`` are unchanged.
+
+   ``globals`` and ``locals`` are passed in to :func:`eval()`; see the documentation
+   for :func:`eval()` for more information.  If ``globals`` or ``locals``
+   is ``None``, this function may replace that value with a context-specific
+   default, contingent on ``type(obj)``:
+
+   * If ``obj`` is a module, ``globals`` defaults to ``obj.__dict__``.
+   * If ``obj`` is a class, ``globals`` defaults to
+     ``sys.modules[obj.__module__].__dict__`` and ``locals`` defaults
+     to the ``obj`` class namespace.
+   * If ``obj`` is a callable, ``globals`` defaults to ``obj.__globals__``,
+     although if ``obj`` is a wrapped function (using
+     ``functools.update_wrapper()``) it is first unwrapped.
+
+   Calling ``get_annotations`` is best practice for accessing the
+   annotations dict of any object.  See :ref:`annotations-howto` for
+   more information on annotations best practices.
+
+   .. versionadded:: 3.10
+
+
 .. _inspect-stack:
 
 The interpreter stack
diff --git a/Doc/library/internet.rst b/Doc/library/internet.rst
index b8950bb..e745dd1 100644
--- a/Doc/library/internet.rst
+++ b/Doc/library/internet.rst
@@ -11,7 +11,7 @@
 
 .. index:: module: socket
 
-The modules described in this chapter implement Internet protocols and  support
+The modules described in this chapter implement internet protocols and  support
 for related technology.  They are all implemented in Python. Most of these
 modules require the presence of the system-dependent module :mod:`socket`, which
 is currently supported on most popular platforms.  Here is an overview:
diff --git a/Doc/library/intro.rst b/Doc/library/intro.rst
index 8567e4d..5bb33b9 100644
--- a/Doc/library/intro.rst
+++ b/Doc/library/intro.rst
@@ -58,5 +58,5 @@
   operating system.
 
 * If not separately noted, all functions that claim "Availability: Unix" are
-  supported on Mac OS X, which builds on a Unix core.
+  supported on macOS, which builds on a Unix core.
 
diff --git a/Doc/library/io.rst b/Doc/library/io.rst
index aecbec5..d512334 100644
--- a/Doc/library/io.rst
+++ b/Doc/library/io.rst
@@ -106,6 +106,56 @@
 The raw stream API is described in detail in the docs of :class:`RawIOBase`.
 
 
+.. _io-text-encoding:
+
+Text Encoding
+-------------
+
+The default encoding of :class:`TextIOWrapper` and :func:`open` is
+locale-specific (:func:`locale.getpreferredencoding(False) <locale.getpreferredencoding>`).
+
+However, many developers forget to specify the encoding when opening text files
+encoded in UTF-8 (e.g. JSON, TOML, Markdown, etc...) since most Unix
+platforms use UTF-8 locale by default. This causes bugs because the locale
+encoding is not UTF-8 for most Windows users. For example::
+
+   # May not work on Windows when non-ASCII characters in the file.
+   with open("README.md") as f:
+       long_description = f.read()
+
+Additionally, while there is no concrete plan as of yet, Python may change
+the default text file encoding to UTF-8 in the future.
+
+Accordingly, it is highly recommended that you specify the encoding
+explicitly when opening text files. If you want to use UTF-8, pass
+``encoding="utf-8"``. To use the current locale encoding,
+``encoding="locale"`` is supported in Python 3.10.
+
+When you need to run existing code on Windows that attempts to open
+UTF-8 files using the default locale encoding, you can enable the UTF-8
+mode. See :ref:`UTF-8 mode on Windows <win-utf8-mode>`.
+
+.. _io-encoding-warning:
+
+Opt-in EncodingWarning
+^^^^^^^^^^^^^^^^^^^^^^
+
+.. versionadded:: 3.10
+   See :pep:`597` for more details.
+
+To find where the default locale encoding is used, you can enable
+the ``-X warn_default_encoding`` command line option or set the
+:envvar:`PYTHONWARNDEFAULTENCODING` environment variable, which will
+emit an :exc:`EncodingWarning` when the default encoding is used.
+
+If you are providing an API that uses :func:`open` or
+:class:`TextIOWrapper` and passes ``encoding=None`` as a parameter, you
+can use :func:`text_encoding` so that callers of the API will emit an
+:exc:`EncodingWarning` if they don't pass an ``encoding``. However,
+please consider using UTF-8 by default (i.e. ``encoding="utf-8"``) for
+new APIs.
+
+
 High-level Module Interface
 ---------------------------
 
@@ -143,6 +193,32 @@
    .. versionadded:: 3.8
 
 
+.. function:: text_encoding(encoding, stacklevel=2)
+
+   This is a helper function for callables that use :func:`open` or
+   :class:`TextIOWrapper` and have an ``encoding=None`` parameter.
+
+   This function returns *encoding* if it is not ``None`` and ``"locale"`` if
+   *encoding* is ``None``.
+
+   This function emits an :class:`EncodingWarning` if
+   :data:`sys.flags.warn_default_encoding <sys.flags>` is true and *encoding*
+   is None. *stacklevel* specifies where the warning is emitted.
+   For example::
+
+      def read_text(path, encoding=None):
+          encoding = io.text_encoding(encoding)  # stacklevel=2
+          with open(path, encoding) as f:
+              return f.read()
+
+   In this example, an :class:`EncodingWarning` is emitted for the caller of
+   ``read_text()``.
+
+   See :ref:`io-text-encoding` for more information.
+
+   .. versionadded:: 3.10
+
+
 .. exception:: BlockingIOError
 
    This is a compatibility alias for the builtin :exc:`BlockingIOError`
@@ -155,16 +231,6 @@
    when an unsupported operation is called on a stream.
 
 
-In-memory streams
-^^^^^^^^^^^^^^^^^
-
-It is also possible to use a :class:`str` or :term:`bytes-like object` as a
-file for both reading and writing.  For strings :class:`StringIO` can be used
-like a file opened in text mode.  :class:`BytesIO` can be used like a file
-opened in binary mode.  Both provide full read-write capabilities with random
-access.
-
-
 .. seealso::
 
    :mod:`sys`
@@ -240,8 +306,7 @@
 
 .. class:: IOBase
 
-   The abstract base class for all I/O classes, acting on streams of bytes.
-   There is no public constructor.
+   The abstract base class for all I/O classes.
 
    This class provides empty abstract implementations for many methods
    that derived classes can override selectively; the default
@@ -325,6 +390,9 @@
       to control the number of lines read: no more lines will be read if the
       total size (in bytes/characters) of all lines so far exceeds *hint*.
 
+      *hint* values of ``0`` or less, as well as ``None``, are treated as no
+      hint.
+
       Note that it's already possible to iterate on file objects using ``for
       line in file: ...`` without calling ``file.readlines()``.
 
@@ -392,8 +460,7 @@
 
 .. class:: RawIOBase
 
-   Base class for raw binary streams.  It inherits :class:`IOBase`.  There is no
-   public constructor.
+   Base class for raw binary streams.  It inherits :class:`IOBase`.
 
    Raw binary streams typically provide low-level access to an underlying OS
    device or API, and do not try to encapsulate it in high-level primitives
@@ -446,7 +513,7 @@
 .. class:: BufferedIOBase
 
    Base class for binary streams that support some kind of buffering.
-   It inherits :class:`IOBase`. There is no public constructor.
+   It inherits :class:`IOBase`.
 
    The main difference with :class:`RawIOBase` is that methods :meth:`read`,
    :meth:`readinto` and :meth:`write` will try (respectively) to read as much
@@ -783,8 +850,7 @@
 .. class:: TextIOBase
 
    Base class for text streams.  This class provides a character and line based
-   interface to stream I/O.  It inherits :class:`IOBase`.  There is no public
-   constructor.
+   interface to stream I/O.  It inherits :class:`IOBase`.
 
    :class:`TextIOBase` provides or overrides these data attributes and
    methods in addition to those from :class:`IOBase`:
@@ -879,6 +945,8 @@
    *encoding* gives the name of the encoding that the stream will be decoded or
    encoded with.  It defaults to
    :func:`locale.getpreferredencoding(False) <locale.getpreferredencoding>`.
+   ``encoding="locale"`` can be used to specify the current locale's encoding
+   explicitly. See :ref:`io-text-encoding` for more information.
 
    *errors* is an optional string that specifies how encoding and decoding
    errors are to be handled.  Pass ``'strict'`` to raise a :exc:`ValueError`
@@ -930,6 +998,9 @@
       locale encoding using :func:`locale.setlocale`, use the current locale
       encoding instead of the user preferred encoding.
 
+   .. versionchanged:: 3.10
+      The *encoding* argument now supports the ``"locale"`` dummy encoding name.
+
    :class:`TextIOWrapper` provides these data attributes and methods in
    addition to those from :class:`TextIOBase` and :class:`IOBase`:
 
diff --git a/Doc/library/ipaddress.rst b/Doc/library/ipaddress.rst
index d6d1f1e..9c2dff5 100644
--- a/Doc/library/ipaddress.rst
+++ b/Doc/library/ipaddress.rst
@@ -41,7 +41,7 @@
 
    Return an :class:`IPv4Address` or :class:`IPv6Address` object depending on
    the IP address passed as argument.  Either IPv4 or IPv6 addresses may be
-   supplied; integers less than 2**32 will be considered to be IPv4 by default.
+   supplied; integers less than ``2**32`` will be considered to be IPv4 by default.
    A :exc:`ValueError` is raised if *address* does not represent a valid IPv4
    or IPv6 address.
 
@@ -56,7 +56,7 @@
    Return an :class:`IPv4Network` or :class:`IPv6Network` object depending on
    the IP address passed as argument.  *address* is a string or integer
    representing the IP network.  Either IPv4 or IPv6 networks may be supplied;
-   integers less than 2**32 will be considered to be IPv4 by default.  *strict*
+   integers less than ``2**32`` will be considered to be IPv4 by default.  *strict*
    is passed to :class:`IPv4Network` or :class:`IPv6Network` constructor.  A
    :exc:`ValueError` is raised if *address* does not represent a valid IPv4 or
    IPv6 address, or if the network has host bits set.
@@ -70,7 +70,7 @@
    Return an :class:`IPv4Interface` or :class:`IPv6Interface` object depending
    on the IP address passed as argument.  *address* is a string or integer
    representing the IP address.  Either IPv4 or IPv6 addresses may be supplied;
-   integers less than 2**32 will be considered to be IPv4 by default.  A
+   integers less than ``2**32`` will be considered to be IPv4 by default.  A
    :exc:`ValueError` is raised if *address* does not represent a valid IPv4 or
    IPv6 address.
 
@@ -104,8 +104,7 @@
    1. A string in decimal-dot notation, consisting of four decimal integers in
       the inclusive range 0--255, separated by dots (e.g. ``192.168.0.1``). Each
       integer represents an octet (byte) in the address. Leading zeroes are
-      tolerated only for values less than 8 (as there is no ambiguity
-      between the decimal and octal interpretations of such strings).
+      not tolerated to prevent confusion with octal notation.
    2. An integer that fits into 32 bits.
    3. An integer packed into a :class:`bytes` object of length 4 (most
       significant octet first).
@@ -117,6 +116,27 @@
    >>> ipaddress.IPv4Address(b'\xC0\xA8\x00\x01')
    IPv4Address('192.168.0.1')
 
+   .. versionchanged:: 3.8
+
+      Leading zeros are tolerated, even in ambiguous cases that look like
+      octal notation.
+
+   .. versionchanged:: 3.10
+
+      Leading zeros are no longer tolerated and are treated as an error.
+      IPv4 address strings are now parsed as strict as glibc
+      :func:`~socket.inet_pton`.
+
+   .. versionchanged:: 3.9.5
+
+      The above change was also included in Python 3.9 starting with
+      version 3.9.5.
+
+   .. versionchanged:: 3.8.12
+
+      The above change was also included in Python 3.8 starting with
+      version 3.8.12.
+
    .. attribute:: version
 
       The appropriate version number: ``4`` for IPv4, ``6`` for IPv6.
@@ -662,7 +682,7 @@
 
       Note that currently expanded netmasks are not supported.  That means
       ``2001:db00::0/24`` is a valid argument while ``2001:db00::0/ffff:ff00::``
-      not.
+      is not.
 
    2. An integer that fits into 128 bits.  This is equivalent to a
       single-address network, with the network address being *address* and
diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst
index 3de66c9..6e1ba3c 100644
--- a/Doc/library/itertools.rst
+++ b/Doc/library/itertools.rst
@@ -55,6 +55,7 @@
 :func:`filterfalse`             pred, seq                       elements of seq where pred(elem) is false           ``filterfalse(lambda x: x%2, range(10)) --> 0 2 4 6 8``
 :func:`groupby`                 iterable[, key]                 sub-iterators grouped by value of key(v)
 :func:`islice`                  seq, [start,] stop [, step]     elements from seq[start:stop:step]                  ``islice('ABCDEFG', 2, None) --> C D E F G``
+:func:`pairwise`                iterable                        (p[0], p[1]), (p[1], p[2])                          ``pairwise('ABCDEFG') --> AB BC CD DE EF FG``
 :func:`starmap`                 func, seq                       func(\*seq[0]), func(\*seq[1]), ...                 ``starmap(pow, [(2,5), (3,2), (10,3)]) --> 32 9 1000``
 :func:`takewhile`               pred, seq                       seq[0], seq[1], until pred fails                    ``takewhile(lambda x: x<5, [1,4,6,4,1]) --> 1 4``
 :func:`tee`                     it, n                           it1, it2, ... itn  splits one iterator into n
@@ -475,6 +476,24 @@
    If *start* is ``None``, then iteration starts at zero. If *step* is ``None``,
    then the step defaults to one.
 
+.. function:: pairwise(iterable)
+
+   Return successive overlapping pairs taken from the input *iterable*.
+
+   The number of 2-tuples in the output iterator will be one fewer than the
+   number of inputs.  It will be empty if the input iterable has fewer than
+   two values.
+
+   Roughly equivalent to::
+
+        def pairwise(iterable):
+            # pairwise('ABCDEFG') --> AB BC CD DE EF FG
+            a, b = tee(iterable)
+            next(b, None)
+            return zip(a, b)
+
+   .. versionadded:: 3.10
+
 
 .. function:: permutations(iterable, r=None)
 
@@ -565,7 +584,7 @@
 
    Before :func:`product` runs, it completely consumes the input iterables,
    keeping pools of values in memory to generate the products.  Accordingly,
-   it only useful with finite inputs.
+   it is only useful with finite inputs.
 
 .. function:: repeat(object[, times])
 
@@ -769,6 +788,18 @@
    def dotproduct(vec1, vec2):
        return sum(map(operator.mul, vec1, vec2))
 
+   def convolve(signal, kernel):
+       # See:  https://betterexplained.com/articles/intuitive-convolution/
+       # convolve(data, [0.25, 0.25, 0.25, 0.25]) --> Moving average (blur)
+       # convolve(data, [1, -1]) --> 1st finite difference (1st derivative)
+       # convolve(data, [1, -2, 1]) --> 2nd finite difference (2nd derivative)
+       kernel = tuple(kernel)[::-1]
+       n = len(kernel)
+       window = collections.deque([0], maxlen=n) * n
+       for x in chain(signal, repeat(0, n-1)):
+           window.append(x)
+           yield sum(map(operator.mul, kernel, window))
+
    def flatten(list_of_lists):
        "Flatten one level of nesting"
        return chain.from_iterable(list_of_lists)
@@ -782,17 +813,36 @@
            return starmap(func, repeat(args))
        return starmap(func, repeat(args, times))
 
-   def pairwise(iterable):
-       "s -> (s0,s1), (s1,s2), (s2, s3), ..."
-       a, b = tee(iterable)
-       next(b, None)
-       return zip(a, b)
-
-   def grouper(iterable, n, fillvalue=None):
-       "Collect data into fixed-length chunks or blocks"
-       # grouper('ABCDEFG', 3, 'x') --> ABC DEF Gxx"
+   def grouper(iterable, n, *, incomplete='fill', fillvalue=None):
+       "Collect data into non-overlapping fixed-length chunks or blocks"
+       # grouper('ABCDEFG', 3, fillvalue='x') --> ABC DEF Gxx
+       # grouper('ABCDEFG', 3, incomplete='strict') --> ABC DEF ValueError
+       # grouper('ABCDEFG', 3, incomplete='ignore') --> ABC DEF
        args = [iter(iterable)] * n
-       return zip_longest(*args, fillvalue=fillvalue)
+       if incomplete == 'fill':
+           return zip_longest(*args, fillvalue=fillvalue)
+       if incomplete == 'strict':
+           return zip(*args, strict=True)
+       if incomplete == 'ignore':
+           return zip(*args)
+       else:
+           raise ValueError('Expected fill, strict, or ignore')
+
+   def triplewise(iterable):
+       "Return overlapping triplets from an iterable"
+       # triplewise('ABCDEFG') -> ABC BCD CDE DEF EFG
+       for (a, _), (b, c) in pairwise(pairwise(iterable)):
+           yield a, b, c
+
+   def sliding_window(iterable, n):
+       # sliding_window('ABCDEFG', 4) -> ABCD BCDE CDEF DEFG
+       it = iter(iterable)
+       window = collections.deque(islice(it, n), maxlen=n)
+       if len(window) == n:
+           yield tuple(window)
+       for x in it:
+           window.append(x)
+           yield tuple(window)
 
    def roundrobin(*iterables):
        "roundrobin('ABC', 'D', 'EF') --> A D E B F C"
@@ -814,6 +864,41 @@
        t1, t2 = tee(iterable)
        return filterfalse(pred, t1), filter(pred, t2)
 
+   def before_and_after(predicate, it):
+       """ Variant of takewhile() that allows complete
+           access to the remainder of the iterator.
+
+           >>> it = iter('ABCdEfGhI')
+           >>> all_upper, remainder = before_and_after(str.isupper, it)
+           >>> ''.join(all_upper)
+           'ABC'
+           >>> ''.join(remainder)     # takewhile() would lose the 'd'
+           'dEfGhI'
+
+           Note that the first iterator must be fully
+           consumed before the second iterator can
+           generate valid results.
+       """
+       it = iter(it)
+       transition = []
+       def true_iterator():
+           for elem in it:
+               if predicate(elem):
+                   yield elem
+               else:
+                   transition.append(elem)
+                   return
+       def remainder_iterator():
+           yield from transition
+           yield from it
+       return true_iterator(), remainder_iterator()
+
+   def subslices(seq):
+       "Return all contiguous non-empty subslices of a sequence"
+       # subslices('ABCD') --> A AB ABC ABCD B BC BCD C CD D
+       slices = starmap(slice, combinations(range(len(seq) + 1), 2))
+       return map(operator.getitem, repeat(seq), slices)
+
    def powerset(iterable):
        "powerset([1,2,3]) --> () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)"
        s = list(iterable)
@@ -925,4 +1010,3 @@
                c, n = c*(n-r)//n, n-1
            result.append(pool[-1-n])
        return tuple(result)
-
diff --git a/Doc/library/json.rst b/Doc/library/json.rst
index e1a246a..1810e04 100644
--- a/Doc/library/json.rst
+++ b/Doc/library/json.rst
@@ -11,9 +11,9 @@
 
 --------------
 
-`JSON (JavaScript Object Notation) <http://json.org>`_, specified by
+`JSON (JavaScript Object Notation) <https://json.org>`_, specified by
 :rfc:`7159` (which obsoletes :rfc:`4627`) and by
-`ECMA-404 <http://www.ecma-international.org/publications/standards/Ecma-404.htm>`_,
+`ECMA-404 <https://www.ecma-international.org/publications-and-standards/standards/ecma-404/>`_,
 is a lightweight data interchange format inspired by
 `JavaScript <https://en.wikipedia.org/wiki/JavaScript>`_ object literal syntax
 (although it is not a strict subset of JavaScript [#rfc-errata]_ ).
@@ -159,7 +159,7 @@
 
    If *check_circular* is false (default: ``True``), then the circular
    reference check for container types will be skipped and a circular reference
-   will result in an :exc:`OverflowError` (or worse).
+   will result in an :exc:`RecursionError` (or worse).
 
    If *allow_nan* is false (default: ``True``), then it will be a
    :exc:`ValueError` to serialize out of range :class:`float` values (``nan``,
@@ -333,7 +333,7 @@
    *object_hook*, if specified, will be called with the result of every JSON
    object decoded and its return value will be used in place of the given
    :class:`dict`.  This can be used to provide custom deserializations (e.g. to
-   support JSON-RPC class hinting).
+   support `JSON-RPC <http://www.jsonrpc.org>`_ class hinting).
 
    *object_pairs_hook*, if specified will be called with the result of every
    JSON object decoded with an ordered list of pairs.  The return value of
@@ -422,10 +422,9 @@
    for ``o`` if possible, otherwise it should call the superclass implementation
    (to raise :exc:`TypeError`).
 
-   If *skipkeys* is false (the default), then it is a :exc:`TypeError` to
-   attempt encoding of keys that are not :class:`str`, :class:`int`,
-   :class:`float` or ``None``.  If *skipkeys* is true, such items are simply
-   skipped.
+   If *skipkeys* is false (the default), a :exc:`TypeError` will be raised when
+   trying to encode keys that are not :class:`str`, :class:`int`, :class:`float`
+   or ``None``.  If *skipkeys* is true, such items are simply skipped.
 
    If *ensure_ascii* is true (the default), the output is guaranteed to
    have all incoming non-ASCII characters escaped.  If *ensure_ascii* is
@@ -433,7 +432,7 @@
 
    If *check_circular* is true (the default), then lists, dicts, and custom
    encoded objects will be checked for circular references during encoding to
-   prevent an infinite recursion (which would cause an :exc:`OverflowError`).
+   prevent an infinite recursion (which would cause an :exc:`RecursionError`).
    Otherwise, no such check takes place.
 
    If *allow_nan* is true (the default), then ``NaN``, ``Infinity``, and
@@ -479,8 +478,8 @@
       object for *o*, or calls the base implementation (to raise a
       :exc:`TypeError`).
 
-      For example, to support arbitrary iterators, you could implement default
-      like this::
+      For example, to support arbitrary iterators, you could implement
+      :meth:`default` like this::
 
          def default(self, o):
             try:
@@ -545,7 +544,7 @@
 ----------------------------------------
 
 The JSON format is specified by :rfc:`7159` and by
-`ECMA-404 <http://www.ecma-international.org/publications/standards/Ecma-404.htm>`_.
+`ECMA-404 <https://www.ecma-international.org/publications-and-standards/standards/ecma-404/>`_.
 This section details this module's level of compliance with the RFC.
 For simplicity, :class:`JSONEncoder` and :class:`JSONDecoder` subclasses, and
 parameters other than those explicitly mentioned, are not considered.
diff --git a/Doc/library/keyword.rst b/Doc/library/keyword.rst
index 5cae79f..c3b4699 100644
--- a/Doc/library/keyword.rst
+++ b/Doc/library/keyword.rst
@@ -9,7 +9,7 @@
 --------------
 
 This module allows a Python program to determine if a string is a
-:ref:`keyword <keywords>`.
+:ref:`keyword <keywords>` or :ref:`soft keyword <soft-keywords>`.
 
 
 .. function:: iskeyword(s)
@@ -26,14 +26,14 @@
 
 .. function:: issoftkeyword(s)
 
-   Return ``True`` if *s* is a Python soft :ref:`keyword <keywords>`.
+   Return ``True`` if *s* is a Python :ref:`soft keyword <soft-keywords>`.
 
    .. versionadded:: 3.9
 
 
 .. data:: softkwlist
 
-   Sequence containing all the soft :ref:`keywords <keywords>` defined for the
+   Sequence containing all the :ref:`soft keywords <soft-keywords>` defined for the
    interpreter.  If any soft keywords are defined to only be active when particular
    :mod:`__future__` statements are in effect, these will be included as well.
 
diff --git a/Doc/library/language.rst b/Doc/library/language.rst
index 1eac32e..510f064 100644
--- a/Doc/library/language.rst
+++ b/Doc/library/language.rst
@@ -13,10 +13,8 @@
 
 .. toctree::
 
-   parser.rst
    ast.rst
    symtable.rst
-   symbol.rst
    token.rst
    keyword.rst
    tokenize.rst
diff --git a/Doc/library/locale.rst b/Doc/library/locale.rst
index bf57a08..60d0c59 100644
--- a/Doc/library/locale.rst
+++ b/Doc/library/locale.rst
@@ -315,21 +315,25 @@
 
 .. function:: getpreferredencoding(do_setlocale=True)
 
-   Return the encoding used for text data, according to user preferences.  User
-   preferences are expressed differently on different systems, and might not be
-   available programmatically on some systems, so this function only returns a
-   guess.
+   Return the :term:`locale encoding` used for text data, according to user
+   preferences.  User preferences are expressed differently on different
+   systems, and might not be available programmatically on some systems, so
+   this function only returns a guess.
 
-   On some systems, it is necessary to invoke :func:`setlocale` to obtain the user
-   preferences, so this function is not thread-safe. If invoking setlocale is not
-   necessary or desired, *do_setlocale* should be set to ``False``.
+   On some systems, it is necessary to invoke :func:`setlocale` to obtain the
+   user preferences, so this function is not thread-safe. If invoking setlocale
+   is not necessary or desired, *do_setlocale* should be set to ``False``.
 
-   On Android or in the UTF-8 mode (:option:`-X` ``utf8`` option), always
-   return ``'UTF-8'``, the locale and the *do_setlocale* argument are ignored.
+   On Android or if the :ref:`Python UTF-8 Mode <utf8-mode>` is enabled, always
+   return ``'UTF-8'``, the :term:`locale encoding` and the *do_setlocale*
+   argument are ignored.
+
+   The :ref:`Python preinitialization <c-preinit>` configures the LC_CTYPE
+   locale. See also the :term:`filesystem encoding and error handler`.
 
    .. versionchanged:: 3.7
-      The function now always returns ``UTF-8`` on Android or if the UTF-8 mode
-      is enabled.
+      The function now always returns ``UTF-8`` on Android or if the
+      :ref:`Python UTF-8 Mode <utf8-mode>` is enabled.
 
 
 .. function:: normalize(localename)
@@ -423,6 +427,14 @@
     .. versionadded:: 3.5
 
 
+.. function:: localize(string, grouping=False, monetary=False)
+
+    Converts a normalized number string into a formatted string following the
+    :const:`LC_NUMERIC` settings.
+
+    .. versionadded:: 3.10
+
+
 .. function:: atof(string)
 
    Converts a string to a floating point number, following the :const:`LC_NUMERIC`
@@ -508,7 +520,7 @@
 --------------------------------------------
 
 The C standard defines the locale as a program-wide property that may be
-relatively expensive to change.  On top of that, some implementation are broken
+relatively expensive to change.  On top of that, some implementations are broken
 in such a way that frequent locale changes may cause core dumps.  This makes the
 locale somewhat painful to use correctly.
 
diff --git a/Doc/library/logging.config.rst b/Doc/library/logging.config.rst
index 683d6ed..a1b8dc7 100644
--- a/Doc/library/logging.config.rst
+++ b/Doc/library/logging.config.rst
@@ -35,49 +35,49 @@
 
 .. function:: dictConfig(config)
 
-    Takes the logging configuration from a dictionary.  The contents of
-    this dictionary are described in :ref:`logging-config-dictschema`
-    below.
+   Takes the logging configuration from a dictionary.  The contents of
+   this dictionary are described in :ref:`logging-config-dictschema`
+   below.
 
-    If an error is encountered during configuration, this function will
-    raise a :exc:`ValueError`, :exc:`TypeError`, :exc:`AttributeError`
-    or :exc:`ImportError` with a suitably descriptive message.  The
-    following is a (possibly incomplete) list of conditions which will
-    raise an error:
+   If an error is encountered during configuration, this function will
+   raise a :exc:`ValueError`, :exc:`TypeError`, :exc:`AttributeError`
+   or :exc:`ImportError` with a suitably descriptive message.  The
+   following is a (possibly incomplete) list of conditions which will
+   raise an error:
 
-    * A ``level`` which is not a string or which is a string not
-      corresponding to an actual logging level.
-    * A ``propagate`` value which is not a boolean.
-    * An id which does not have a corresponding destination.
-    * A non-existent handler id found during an incremental call.
-    * An invalid logger name.
-    * Inability to resolve to an internal or external object.
+   * A ``level`` which is not a string or which is a string not
+     corresponding to an actual logging level.
+   * A ``propagate`` value which is not a boolean.
+   * An id which does not have a corresponding destination.
+   * A non-existent handler id found during an incremental call.
+   * An invalid logger name.
+   * Inability to resolve to an internal or external object.
 
-    Parsing is performed by the :class:`DictConfigurator` class, whose
-    constructor is passed the dictionary used for configuration, and
-    has a :meth:`configure` method.  The :mod:`logging.config` module
-    has a callable attribute :attr:`dictConfigClass`
-    which is initially set to :class:`DictConfigurator`.
-    You can replace the value of :attr:`dictConfigClass` with a
-    suitable implementation of your own.
+   Parsing is performed by the :class:`DictConfigurator` class, whose
+   constructor is passed the dictionary used for configuration, and
+   has a :meth:`configure` method.  The :mod:`logging.config` module
+   has a callable attribute :attr:`dictConfigClass`
+   which is initially set to :class:`DictConfigurator`.
+   You can replace the value of :attr:`dictConfigClass` with a
+   suitable implementation of your own.
 
-    :func:`dictConfig` calls :attr:`dictConfigClass` passing
-    the specified dictionary, and then calls the :meth:`configure` method on
-    the returned object to put the configuration into effect::
+   :func:`dictConfig` calls :attr:`dictConfigClass` passing
+   the specified dictionary, and then calls the :meth:`configure` method on
+   the returned object to put the configuration into effect::
 
-          def dictConfig(config):
-              dictConfigClass(config).configure()
+         def dictConfig(config):
+             dictConfigClass(config).configure()
 
-    For example, a subclass of :class:`DictConfigurator` could call
-    ``DictConfigurator.__init__()`` in its own :meth:`__init__()`, then
-    set up custom prefixes which would be usable in the subsequent
-    :meth:`configure` call. :attr:`dictConfigClass` would be bound to
-    this new subclass, and then :func:`dictConfig` could be called exactly as
-    in the default, uncustomized state.
+   For example, a subclass of :class:`DictConfigurator` could call
+   ``DictConfigurator.__init__()`` in its own :meth:`__init__()`, then
+   set up custom prefixes which would be usable in the subsequent
+   :meth:`configure` call. :attr:`dictConfigClass` would be bound to
+   this new subclass, and then :func:`dictConfig` could be called exactly as
+   in the default, uncustomized state.
 
    .. versionadded:: 3.2
 
-.. function:: fileConfig(fname, defaults=None, disable_existing_loggers=True)
+.. function:: fileConfig(fname, defaults=None, disable_existing_loggers=True, encoding=None)
 
    Reads the logging configuration from a :mod:`configparser`\-format file. The
    format of the file should be as described in
@@ -111,6 +111,8 @@
                                     they or their ancestors are explicitly named
                                     in the logging configuration.
 
+    :param encoding: The encoding used to open file when *fname* is filename.
+
    .. versionchanged:: 3.4
       An instance of a subclass of :class:`~configparser.RawConfigParser` is
       now accepted as a value for ``fname``. This facilitates:
@@ -121,6 +123,9 @@
         application (e.g. based on command-line parameters or other aspects
         of the runtime environment) before being passed to ``fileConfig``.
 
+    .. versionadded:: 3.10
+       The *encoding* parameter is added.
+
 .. function:: listen(port=DEFAULT_LOGGING_CONFIG_PORT, verify=None)
 
    Starts up a socket server on the specified port, and listens for new
@@ -147,6 +152,8 @@
    send it to the socket as a sequence of bytes preceded by a four-byte length
    string packed in binary using ``struct.pack('>L', n)``.
 
+   .. _logging-eval-security:
+
    .. note::
 
       Because portions of the configuration are passed through
@@ -161,7 +168,7 @@
       :func:`listen` socket and sending a configuration which runs whatever
       code the attacker wants to have executed in the victim's process. This is
       especially easy to do if the default port is used, but not hard even if a
-      different port is used). To avoid the risk of this happening, use the
+      different port is used. To avoid the risk of this happening, use the
       ``verify`` argument to :func:`listen` to prevent unrecognised
       configurations from being applied.
 
@@ -184,6 +191,20 @@
    :func:`listen`.
 
 
+Security considerations
+^^^^^^^^^^^^^^^^^^^^^^^
+
+The logging configuration functionality tries to offer convenience, and in part this
+is done by offering the ability to convert text in configuration files into Python
+objects used in logging configuration - for example, as described in
+:ref:`logging-config-dict-userdef`. However, these same mechanisms (importing
+callables from user-defined modules and calling them with parameters from the
+configuration) could be used to invoke any code you like, and for this reason you
+should treat configuration files from untrusted sources with *extreme caution* and
+satisfy yourself that nothing bad can happen if you load them, before actually loading
+them.
+
+
 .. _logging-config-dictschema:
 
 Configuration dictionary schema
@@ -218,18 +239,29 @@
 :ref:`logging-config-dict-userdef` below is used to create an instance;
 otherwise, the context is used to determine what to instantiate.
 
+.. _logging-config-dictschema-formatters:
+
 * *formatters* - the corresponding value will be a dict in which each
   key is a formatter id and each value is a dict describing how to
   configure the corresponding :class:`~logging.Formatter` instance.
 
-  The configuring dict is searched for keys ``format`` and ``datefmt``
-  (with defaults of ``None``) and these are used to construct a
-  :class:`~logging.Formatter` instance.
+  The configuring dict is searched for the following optional keys
+  which correspond to the arguments passed to create a
+  :class:`~logging.Formatter` object:
 
-  .. versionchanged:: 3.8
-     a ``validate`` key (with default of ``True``) can be added into
-     the ``formatters`` section of the configuring dict, this is to
-     validate the format.
+   * ``format``
+   * ``datefmt``
+   * ``style``
+   * ``validate`` (since version >=3.8)
+
+  An optional ``class`` key indicates the name of the formatter's
+  class (as a dotted module and class name).  The instantiation
+  arguments are as for :class:`~logging.Formatter`, thus this key is
+  most useful for instantiating a customised subclass of
+  :class:`~logging.Formatter`.  For example, the alternative class
+  might present exception tracebacks in an expanded or condensed
+  format.  If your formatter requires different or extra configuration
+  keys, you should use :ref:`logging-config-dict-userdef`.
 
 * *filters* - the corresponding value will be a dict in which each key
   is a filter id and each value is a dict describing how to configure
@@ -577,7 +609,7 @@
 the dict with key ``handlers``, the string ``'cfg://handlers.email``
 would resolve to the dict with key ``email`` in the ``handlers`` dict,
 and so on.  The string ``'cfg://handlers.email.toaddrs[1]`` would
-resolve to ``'dev_team.domain.tld'`` and the string
+resolve to ``'dev_team@domain.tld'`` and the string
 ``'cfg://handlers.email.toaddrs[0]'`` would resolve to the value
 ``'support_team@domain.tld'``. The ``subject`` value could be accessed
 using either ``'cfg://handlers.email.subject'`` or, equivalently,
@@ -791,20 +823,13 @@
    [formatter_form01]
    format=F1 %(asctime)s %(levelname)s %(message)s
    datefmt=
+   style='%'
+   validate=True
    class=logging.Formatter
 
-The ``format`` entry is the overall format string, and the ``datefmt`` entry is
-the :func:`strftime`\ -compatible date/time format string.  If empty, the
-package substitutes something which is almost equivalent to specifying the date
-format string ``'%Y-%m-%d %H:%M:%S'``.  This format also specifies milliseconds,
-which are appended to the result of using the above format string, with a comma
-separator.  An example time in this format is ``2003-01-23 00:29:50,411``.
-
-The ``class`` entry is optional.  It indicates the name of the formatter's class
-(as a dotted module and class name.)  This option is useful for instantiating a
-:class:`~logging.Formatter` subclass.  Subclasses of
-:class:`~logging.Formatter` can present exception tracebacks in an expanded or
-condensed format.
+The arguments for the formatter configuration are the same as the keys
+in the dictionary schema :ref:`formatters section
+<logging-config-dictschema-formatters>`.
 
 .. note::
 
diff --git a/Doc/library/logging.handlers.rst b/Doc/library/logging.handlers.rst
index 059ab3d..a5b181e 100644
--- a/Doc/library/logging.handlers.rst
+++ b/Doc/library/logging.handlers.rst
@@ -117,6 +117,9 @@
 
       Outputs the record to the file.
 
+      Note that if the file was closed due to logging shutdown at exit and the file
+      mode is 'w', the record will not be emitted (see :issue:`42378`).
+
 
 .. _null-handler:
 
@@ -231,6 +234,19 @@
          return the same output every time for a given input, otherwise the
          rollover behaviour may not work as expected.
 
+         It's also worth noting that care should be taken when using a namer to
+         preserve certain attributes in the filename which are used during rotation.
+         For example, :class:`RotatingFileHandler` expects to have a set of log files
+         whose names contain successive integers, so that rotation works as expected,
+         and :class:`TimedRotatingFileHandler` deletes old log files (based on the
+         ``backupCount`` parameter passed to the handler's initializer) by determining
+         the oldest files to delete. For this to happen, the filenames should be
+         sortable using the date/time portion of the filename, and a namer needs to
+         respect this. (If a namer is wanted that doesn't respect this scheme, it will
+         need to be used in a subclass of :class:`TimedRotatingFileHandler` which
+         overrides the :meth:`~TimedRotatingFileHandler.getFilesToDelete` method to
+         fit in with the custom naming scheme.)
+
       .. versionadded:: 3.3
 
 
@@ -440,6 +456,10 @@
 
       Outputs the record to the file, catering for rollover as described above.
 
+   .. method:: getFilesToDelete()
+
+      Returns a list of filenames which should be deleted as part of rollover. These
+      are the absolute paths of the oldest backup log files written by the handler.
 
 .. _socket-handler:
 
@@ -927,7 +947,7 @@
 ^^^^^^^^^^^
 
 The :class:`HTTPHandler` class, located in the :mod:`logging.handlers` module,
-supports sending logging messages to a Web server, using either ``GET`` or
+supports sending logging messages to a web server, using either ``GET`` or
 ``POST`` semantics.
 
 
@@ -957,17 +977,17 @@
 
    .. method:: emit(record)
 
-      Sends the record to the Web server as a URL-encoded dictionary. The
+      Sends the record to the web server as a URL-encoded dictionary. The
       :meth:`mapLogRecord` method is used to convert the record to the
       dictionary to be sent.
 
-   .. note:: Since preparing a record for sending it to a Web server is not
+   .. note:: Since preparing a record for sending it to a web server is not
       the same as a generic formatting operation, using
       :meth:`~logging.Handler.setFormatter` to specify a
       :class:`~logging.Formatter` for a :class:`HTTPHandler` has no effect.
       Instead of calling :meth:`~logging.Handler.format`, this handler calls
       :meth:`mapLogRecord` and then :func:`urllib.parse.urlencode` to encode the
-      dictionary in a form suitable for sending to a Web server.
+      dictionary in a form suitable for sending to a web server.
 
 
 .. _queue-handler:
@@ -984,7 +1004,7 @@
 
 Along with the :class:`QueueListener` class, :class:`QueueHandler` can be used
 to let handlers do their work on a separate thread from the one which does the
-logging. This is important in Web applications and also other service
+logging. This is important in web applications and also other service
 applications where threads servicing clients need to respond as quickly as
 possible, while any potentially slow operations (such as sending an email via
 :class:`SMTPHandler`) are done on a separate thread.
@@ -1046,7 +1066,7 @@
 
 Along with the :class:`QueueHandler` class, :class:`QueueListener` can be used
 to let handlers do their work on a separate thread from the one which does the
-logging. This is important in Web applications and also other service
+logging. This is important in web applications and also other service
 applications where threads servicing clients need to respond as quickly as
 possible, while any potentially slow operations (such as sending an email via
 :class:`SMTPHandler`) are done on a separate thread.
diff --git a/Doc/library/logging.rst b/Doc/library/logging.rst
index 7267f81..74b1f69 100644
--- a/Doc/library/logging.rst
+++ b/Doc/library/logging.rst
@@ -80,6 +80,15 @@
       If this evaluates to false, logging messages are not passed to the handlers
       of ancestor loggers.
 
+      Spelling it out with an example: If the propagate attribute of the logger named
+      ``A.B.C`` evaluates to true, any event logged to ``A.B.C`` via a method call such as
+      ``logging.getLogger('A.B.C').error(...)`` will [subject to passing that logger's
+      level and filter settings] be passed in turn to any handlers attached to loggers
+      named ``A.B``, ``A`` and the root logger, after first being passed to any handlers
+      attached to ``A.B.C``. If any logger in the chain ``A.B.C``, ``A.B``, ``A`` has its
+      ``propagate`` attribute set to false, then that is the last logger whose handlers
+      are offered the event to handle, and propagation stops at that point.
+
       The constructor sets this attribute to ``True``.
 
       .. note:: If you attach a handler to a logger *and* one or more of its
@@ -203,7 +212,7 @@
       attributes can then be used as you like. For example, they could be
       incorporated into logged messages. For example::
 
-         FORMAT = '%(asctime)-15s %(clientip)s %(user)-8s %(message)s'
+         FORMAT = '%(asctime)s %(clientip)-15s %(user)-8s %(message)s'
          logging.basicConfig(format=FORMAT)
          d = {'clientip': '192.168.0.1', 'user': 'fbloggs'}
          logger = logging.getLogger('tcpserver')
@@ -529,7 +538,7 @@
 :ref:`logrecord-attributes`.
 
 
-.. class:: Formatter(fmt=None, datefmt=None, style='%', validate=True)
+.. class:: Formatter(fmt=None, datefmt=None, style='%', validate=True, *, defaults=None)
 
    Returns a new instance of the :class:`Formatter` class.  The instance is
    initialized with a format string for the message as a whole, as well as a
@@ -545,6 +554,10 @@
    :ref:`formatting-styles` for more information on using {- and $-formatting
    for log messages.
 
+   The *defaults* parameter can be a dictionary with default values to use in
+   custom fields. For example:
+   ``logging.Formatter('%(ip)s %(message)s', defaults={"ip": None})``
+
    .. versionchanged:: 3.2
       The *style* parameter was added.
 
@@ -553,6 +566,9 @@
       will raise a ``ValueError``.
       For example: ``logging.Formatter('%(asctime)s - %(message)s', style='{')``.
 
+   .. versionchanged:: 3.10
+      The *defaults* parameter was added.
+
    .. method:: format(record)
 
       The record's attribute dictionary is used as the operand to a string
@@ -567,9 +583,9 @@
       pickled and sent across the wire, but you should be careful if you have
       more than one :class:`Formatter` subclass which customizes the formatting
       of exception information. In this case, you will have to clear the cached
-      value after a formatter has done its formatting, so that the next
-      formatter to handle the event doesn't use the cached value but
-      recalculates it afresh.
+      value (by setting the *exc_text* attribute to ``None``) after a formatter
+      has done its formatting, so that the next formatter to handle the event
+      doesn't use the cached value, but recalculates it afresh.
 
       If stack information is available, it's appended after the exception
       information, using :meth:`formatStack` to transform it if necessary.
@@ -893,6 +909,10 @@
    :meth:`~Logger.setLevel` and :meth:`~Logger.hasHandlers` methods were added
    to :class:`LoggerAdapter`.  These methods delegate to the underlying logger.
 
+.. versionchanged:: 3.6
+   Attribute :attr:`manager` and method :meth:`_log` were added, which
+   delegate to the underlying logger and allow adapters to be nested.
+
 
 Thread Safety
 -------------
@@ -989,7 +1009,7 @@
    be used as you like. For example, they could be incorporated into logged
    messages. For example::
 
-      FORMAT = '%(asctime)-15s %(clientip)s %(user)-8s %(message)s'
+      FORMAT = '%(asctime)s %(clientip)-15s %(user)-8s %(message)s'
       logging.basicConfig(format=FORMAT)
       d = {'clientip': '192.168.0.1', 'user': 'fbloggs'}
       logging.warning('Protocol problem: %s', 'connection reset', extra=d)
@@ -1089,8 +1109,8 @@
    suitable value.
 
    .. versionchanged:: 3.7
-      The *level* parameter was defaulted to level ``CRITICAL``. See Issue
-      #28524 for more information about this change.
+      The *level* parameter was defaulted to level ``CRITICAL``. See
+      :issue:`28524` for more information about this change.
 
 .. function:: addLevelName(level, levelName)
 
@@ -1106,18 +1126,27 @@
 
 .. function:: getLevelName(level)
 
-   Returns the textual representation of logging level *level*. If the level is one
-   of the predefined levels :const:`CRITICAL`, :const:`ERROR`, :const:`WARNING`,
-   :const:`INFO` or :const:`DEBUG` then you get the corresponding string. If you
-   have associated levels with names using :func:`addLevelName` then the name you
-   have associated with *level* is returned. If a numeric value corresponding to one
-   of the defined levels is passed in, the corresponding string representation is
-   returned. Otherwise, the string 'Level %s' % level is returned.
+   Returns the textual or numeric representation of logging level *level*.
+
+   If *level* is one of the predefined levels :const:`CRITICAL`, :const:`ERROR`,
+   :const:`WARNING`, :const:`INFO` or :const:`DEBUG` then you get the
+   corresponding string. If you have associated levels with names using
+   :func:`addLevelName` then the name you have associated with *level* is
+   returned. If a numeric value corresponding to one of the defined levels is
+   passed in, the corresponding string representation is returned.
+
+   The *level* parameter also accepts a string representation of the level such
+   as 'INFO'. In such cases, this functions returns the corresponding numeric
+   value of the level.
+
+   If no matching numeric or string value is passed in, the string
+   'Level %s' % level is returned.
 
    .. note:: Levels are internally integers (as they need to be compared in the
       logging logic). This function is used to convert between an integer level
       and the level name displayed in the formatted log output by means of the
-      ``%(levelname)s`` format specifier (see :ref:`logrecord-attributes`).
+      ``%(levelname)s`` format specifier (see :ref:`logrecord-attributes`), and
+      vice versa.
 
    .. versionchanged:: 3.4
       In Python versions earlier than 3.4, this function could also be passed a
@@ -1158,16 +1187,18 @@
    +--------------+---------------------------------------------+
    | Format       | Description                                 |
    +==============+=============================================+
-   | *filename*   | Specifies that a FileHandler be created,    |
-   |              | using the specified filename, rather than a |
-   |              | StreamHandler.                              |
+   | *filename*   | Specifies that a :class:`FileHandler` be    |
+   |              | created, using the specified filename,      |
+   |              | rather than a :class:`StreamHandler`.       |
    +--------------+---------------------------------------------+
    | *filemode*   | If *filename* is specified, open the file   |
    |              | in this :ref:`mode <filemodes>`. Defaults   |
    |              | to ``'a'``.                                 |
    +--------------+---------------------------------------------+
    | *format*     | Use the specified format string for the     |
-   |              | handler.                                    |
+   |              | handler. Defaults to attributes             |
+   |              | ``levelname``, ``name`` and ``message``     |
+   |              | separated by colons.                        |
    +--------------+---------------------------------------------+
    | *datefmt*    | Use the specified date/time format, as      |
    |              | accepted by :func:`time.strftime`.          |
@@ -1184,9 +1215,10 @@
    |              | :ref:`level <levels>`.                      |
    +--------------+---------------------------------------------+
    | *stream*     | Use the specified stream to initialize the  |
-   |              | StreamHandler. Note that this argument is   |
-   |              | incompatible with *filename* - if both      |
-   |              | are present, a ``ValueError`` is raised.    |
+   |              | :class:`StreamHandler`. Note that this      |
+   |              | argument is incompatible with *filename* -  |
+   |              | if both are present, a ``ValueError`` is    |
+   |              | raised.                                     |
    +--------------+---------------------------------------------+
    | *handlers*   | If specified, this should be an iterable of |
    |              | already created handlers to add to the root |
@@ -1205,18 +1237,18 @@
    +--------------+---------------------------------------------+
    | *encoding*   | If this keyword argument is specified along |
    |              | with *filename*, its value is used when the |
-   |              | FileHandler is created, and thus used when  |
-   |              | opening the output file.                    |
+   |              | :class:`FileHandler` is created, and thus   |
+   |              | used when opening the output file.          |
    +--------------+---------------------------------------------+
    | *errors*     | If this keyword argument is specified along |
    |              | with *filename*, its value is used when the |
-   |              | FileHandler is created, and thus used when  |
-   |              | opening the output file. If not specified,  |
-   |              | the value 'backslashreplace' is used. Note  |
-   |              | that if ``None`` is specified, it will be   |
-   |              | passed as such to func:`open`, which means  |
-   |              | that it will be treated the same as passing |
-   |              | 'errors'.                                   |
+   |              | :class:`FileHandler` is created, and thus   |
+   |              | used when opening the output file. If not   |
+   |              | specified, the value 'backslashreplace' is  |
+   |              | used. Note that if ``None`` is specified,   |
+   |              | it will be passed as such to :func:`open`,  |
+   |              | which means that it will be treated the     |
+   |              | same as passing 'errors'.                   |
    +--------------+---------------------------------------------+
 
    .. versionchanged:: 3.2
@@ -1333,7 +1365,7 @@
       The proposal which described this feature for inclusion in the Python standard
       library.
 
-   `Original Python logging package <https://www.red-dove.com/python_logging.html>`_
+   `Original Python logging package <https://old.red-dove.com/python_logging.html>`_
       This is the original source for the :mod:`logging` package.  The version of the
       package available from this site is suitable for use with Python 1.5.2, 2.1.x
       and 2.2.x, which do not include the :mod:`logging` package in the standard
diff --git a/Doc/library/lzma.rst b/Doc/library/lzma.rst
index 4bfff9c..2109264 100644
--- a/Doc/library/lzma.rst
+++ b/Doc/library/lzma.rst
@@ -19,8 +19,8 @@
 :program:`xz` utility, as well as raw compressed streams.
 
 The interface provided by this module is very similar to that of the :mod:`bz2`
-module. However, note that :class:`LZMAFile` is *not* thread-safe, unlike
-:class:`bz2.BZ2File`, so if you need to use a single :class:`LZMAFile` instance
+module. Note that :class:`LZMAFile` and :class:`bz2.BZ2File` are *not*
+thread-safe, so if you need to use a single :class:`LZMAFile` instance
 from multiple threads, it is necessary to protect it with a lock.
 
 
@@ -33,7 +33,7 @@
 Reading and writing compressed files
 ------------------------------------
 
-.. function:: open(filename, mode="rb", \*, format=None, check=-1, preset=None, filters=None, encoding=None, errors=None, newline=None)
+.. function:: open(filename, mode="rb", *, format=None, check=-1, preset=None, filters=None, encoding=None, errors=None, newline=None)
 
    Open an LZMA-compressed file in binary or text mode, returning a :term:`file
    object`.
@@ -69,7 +69,7 @@
       Accepts a :term:`path-like object`.
 
 
-.. class:: LZMAFile(filename=None, mode="r", \*, format=None, check=-1, preset=None, filters=None)
+.. class:: LZMAFile(filename=None, mode="r", *, format=None, check=-1, preset=None, filters=None)
 
    Open an LZMA-compressed file in binary mode.
 
diff --git a/Doc/library/mailcap.rst b/Doc/library/mailcap.rst
index bf9639b..7749b7d 100644
--- a/Doc/library/mailcap.rst
+++ b/Doc/library/mailcap.rst
@@ -9,16 +9,16 @@
 --------------
 
 Mailcap files are used to configure how MIME-aware applications such as mail
-readers and Web browsers react to files with different MIME types. (The name
+readers and web browsers react to files with different MIME types. (The name
 "mailcap" is derived from the phrase "mail capability".)  For example, a mailcap
 file might contain a line like ``video/mpeg; xmpeg %s``.  Then, if the user
-encounters an email message or Web document with the MIME type
+encounters an email message or web document with the MIME type
 :mimetype:`video/mpeg`, ``%s`` will be replaced by a filename (usually one
 belonging to a temporary file) and the :program:`xmpeg` program can be
 automatically started to view the file.
 
 The mailcap format is documented in :rfc:`1524`, "A User Agent Configuration
-Mechanism For Multimedia Mail Format Information", but is not an Internet
+Mechanism For Multimedia Mail Format Information", but is not an internet
 standard.  However, mailcap files are supported on most Unix systems.
 
 
diff --git a/Doc/library/marshal.rst b/Doc/library/marshal.rst
index d65afc2..24f9dc1 100644
--- a/Doc/library/marshal.rst
+++ b/Doc/library/marshal.rst
@@ -66,6 +66,8 @@
    The *version* argument indicates the data format that ``dump`` should use
    (see below).
 
+   .. audit-event:: marshal.dumps value,version marshal.dump
+
 
 .. function:: load(file)
 
@@ -74,11 +76,18 @@
    format), raise :exc:`EOFError`, :exc:`ValueError` or :exc:`TypeError`.  The
    file must be a readable :term:`binary file`.
 
+   .. audit-event:: marshal.load "" marshal.load
+
    .. note::
 
       If an object containing an unsupported type was marshalled with :func:`dump`,
       :func:`load` will substitute ``None`` for the unmarshallable type.
 
+   .. versionchanged:: 3.10
+
+      This call used to raise a ``code.__new__`` audit event for each code object. Now
+      it raises a single ``marshal.load`` event for the entire load operation.
+
 
 .. function:: dumps(value[, version])
 
@@ -89,6 +98,8 @@
    The *version* argument indicates the data format that ``dumps`` should use
    (see below).
 
+   .. audit-event:: marshal.dumps value,version marshal.dump
+
 
 .. function:: loads(bytes)
 
@@ -96,6 +107,13 @@
    :exc:`EOFError`, :exc:`ValueError` or :exc:`TypeError`.  Extra bytes in the
    input are ignored.
 
+   .. audit-event:: marshal.loads bytes marshal.load
+
+   .. versionchanged:: 3.10
+
+      This call used to raise a ``code.__new__`` audit event for each code object. Now
+      it raises a single ``marshal.loads`` event for the entire load operation.
+
 
 In addition, the following constants are defined:
 
diff --git a/Doc/library/math.rst b/Doc/library/math.rst
index b20e557..145bac4 100644
--- a/Doc/library/math.rst
+++ b/Doc/library/math.rst
@@ -481,6 +481,11 @@
       Added support for n-dimensional points. Formerly, only the two
       dimensional case was supported.
 
+   .. versionchanged:: 3.10
+      Improved the algorithm's accuracy so that the maximum error is
+      under 1 ulp (unit in the last place).  More typically, the result
+      is almost always correctly rounded to within 1/2 ulp.
+
 
 .. function:: sin(x)
 
diff --git a/Doc/library/misc.rst b/Doc/library/misc.rst
deleted file mode 100644
index 0943235..0000000
--- a/Doc/library/misc.rst
+++ /dev/null
@@ -1,13 +0,0 @@
-.. _misc:
-
-**********************
-Miscellaneous Services
-**********************
-
-The modules described in this chapter provide miscellaneous services that are
-available in all Python versions.  Here's an overview:
-
-
-.. toctree::
-
-   formatter.rst
diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst
index 1f3fbc3..da17475 100644
--- a/Doc/library/mmap.rst
+++ b/Doc/library/mmap.rst
@@ -81,7 +81,9 @@
    private copy-on-write mapping, so changes to the contents of the mmap
    object will be private to this process, and :const:`MAP_SHARED` creates a
    mapping that's shared with all other processes mapping the same areas of
-   the file.  The default value is :const:`MAP_SHARED`.
+   the file.  The default value is :const:`MAP_SHARED`. Some systems have
+   additional possible flags with the full list specified in
+   :ref:`MAP_* constants <map-constants>`.
 
    *prot*, if specified, gives the desired memory protection; the two most
    useful values are :const:`PROT_READ` and :const:`PROT_WRITE`, to specify
@@ -100,7 +102,7 @@
 
    To ensure validity of the created memory mapping the file specified
    by the descriptor *fileno* is internally automatically synchronized
-   with physical backing store on Mac OS X and OpenVMS.
+   with physical backing store on macOS and OpenVMS.
 
    This example shows a simple way of using :class:`~mmap.mmap`::
 
@@ -335,6 +337,8 @@
           MADV_NOCORE
           MADV_CORE
           MADV_PROTECT
+          MADV_FREE_REUSABLE
+          MADV_FREE_REUSE
 
    These options can be passed to :meth:`mmap.madvise`.  Not every option will
    be present on every system.
@@ -342,3 +346,21 @@
    Availability: Systems with the madvise() system call.
 
    .. versionadded:: 3.8
+
+.. _map-constants:
+
+MAP_* Constants
++++++++++++++++
+
+.. data:: MAP_SHARED
+          MAP_PRIVATE
+          MAP_DENYWRITE
+          MAP_EXECUTABLE
+          MAP_ANON
+          MAP_ANONYMOUS
+          MAP_POPULATE
+
+    These are the various flags that can be passed to :meth:`mmap.mmap`. Note that some options might not be present on some systems.
+
+    .. versionchanged:: 3.10
+       Added MAP_POPULATE constant.
diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst
index ab84d39..096e649 100644
--- a/Doc/library/multiprocessing.rst
+++ b/Doc/library/multiprocessing.rst
@@ -569,8 +569,15 @@
    .. attribute:: exitcode
 
       The child's exit code.  This will be ``None`` if the process has not yet
-      terminated.  A negative value *-N* indicates that the child was terminated
-      by signal *N*.
+      terminated.
+
+      If the child's :meth:`run` method returned normally, the exit code
+      will be 0.  If it terminated via :func:`sys.exit` with an integer
+      argument *N*, the exit code will be *N*.
+
+      If the child terminated due to an exception not caught within
+      :meth:`run`, the exit code will be 1.  If it was terminated by
+      signal *N*, the exit code will be the negative value *-N*.
 
    .. attribute:: authkey
 
@@ -783,7 +790,7 @@
       multithreading/multiprocessing semantics, this number is not reliable.
 
       Note that this may raise :exc:`NotImplementedError` on Unix platforms like
-      Mac OS X where ``sem_getvalue()`` is not implemented.
+      macOS where ``sem_getvalue()`` is not implemented.
 
    .. method:: empty()
 
@@ -861,7 +868,7 @@
 
       A better name for this method might be
       ``allow_exit_without_flush()``.  It is likely to cause enqueued
-      data to lost, and you almost certainly will not need to use it.
+      data to be lost, and you almost certainly will not need to use it.
       It is really only there if you need the current process to exit
       immediately without waiting to flush enqueued data to the
       underlying pipe, and you don't care about lost data.
@@ -951,7 +958,8 @@
    use.  The number of usable CPUs can be obtained with
    ``len(os.sched_getaffinity(0))``
 
-   May raise :exc:`NotImplementedError`.
+   When the number of CPUs cannot be determined a :exc:`NotImplementedError`
+   is raised.
 
    .. seealso::
       :func:`os.cpu_count`
@@ -1029,13 +1037,19 @@
 
    The return value can be ``'fork'``, ``'spawn'``, ``'forkserver'``
    or ``None``.  ``'fork'`` is the default on Unix, while ``'spawn'`` is
-   the default on Windows.
+   the default on Windows and macOS.
+
+.. versionchanged:: 3.8
+
+   On macOS, the *spawn* start method is now the default.  The *fork* start
+   method should be considered unsafe as it can lead to crashes of the
+   subprocess. See :issue:`33725`.
 
    .. versionadded:: 3.4
 
-.. function:: set_executable()
+.. function:: set_executable(executable)
 
-   Sets the path of the Python interpreter to use when starting a child process.
+   Set the path of the Python interpreter to use when starting a child process.
    (By default :data:`sys.executable` is used).  Embedders will probably need to
    do some thing like ::
 
@@ -1187,6 +1201,7 @@
     >>> arr2
     array('i', [0, 1, 2, 3, 4, 0, 0, 0, 0, 0])
 
+.. _multiprocessing-recv-pickle-security:
 
 .. warning::
 
@@ -1233,7 +1248,7 @@
    first argument is named *block*, as is consistent with :meth:`Lock.acquire`.
 
    .. note::
-      On Mac OS X, this is indistinguishable from :class:`Semaphore` because
+      On macOS, this is indistinguishable from :class:`Semaphore` because
       ``sem_getvalue()`` is not implemented on that platform.
 
 .. class:: Condition([lock])
@@ -1372,7 +1387,7 @@
 
 .. note::
 
-   On Mac OS X, ``sem_timedwait`` is unsupported, so calling ``acquire()`` with
+   On macOS, ``sem_timedwait`` is unsupported, so calling ``acquire()`` with
    a timeout will emulate that function's behavior using a sleeping loop.
 
 .. note::
@@ -1926,7 +1941,7 @@
     >>> class Worker(Process):
     ...     def __init__(self, q):
     ...         self.q = q
-    ...         super(Worker, self).__init__()
+    ...         super().__init__()
     ...     def run(self):
     ...         self.q.put('local hello')
     ...
@@ -2145,7 +2160,7 @@
       or by calling :meth:`close` and :meth:`terminate` manually. Failure to do this
       can lead to the process hanging on finalization.
 
-      Note that is **not correct** to rely on the garbage colletor to destroy the pool
+      Note that it is **not correct** to rely on the garbage collector to destroy the pool
       as CPython does not assure that the finalizer of the pool will be called
       (see :meth:`object.__del__` for more information).
 
@@ -2242,8 +2257,9 @@
 
    .. method:: starmap(func, iterable[, chunksize])
 
-      Like :meth:`map` except that the elements of the *iterable* are expected
-      to be iterables that are unpacked as arguments.
+      Like :meth:`~multiprocessing.pool.Pool.map` except that the
+      elements of the *iterable* are expected to be iterables that are
+      unpacked as arguments.
 
       Hence an *iterable* of ``[(1,2), (3, 4)]`` results in ``[func(1,2),
       func(3,4)]``.
@@ -2627,12 +2643,13 @@
    inherited.
 
 .. currentmodule:: multiprocessing
-.. function:: log_to_stderr()
+.. function:: log_to_stderr(level=None)
 
    This function performs a call to :func:`get_logger` but in addition to
    returning the logger created by get_logger, it adds a handler which sends
    output to :data:`sys.stderr` using format
    ``'[%(levelname)s/%(processName)s] %(message)s'``.
+   You can modify ``levelname`` of the logger by passing a ``level`` argument.
 
 Below is an example session with logging turned on::
 
@@ -2661,6 +2678,46 @@
 :mod:`multiprocessing.dummy` replicates the API of :mod:`multiprocessing` but is
 no more than a wrapper around the :mod:`threading` module.
 
+.. currentmodule:: multiprocessing.pool
+
+In particular, the ``Pool`` function provided by :mod:`multiprocessing.dummy`
+returns an instance of :class:`ThreadPool`, which is a subclass of
+:class:`Pool` that supports all the same method calls but uses a pool of
+worker threads rather than worker processes.
+
+
+.. class:: ThreadPool([processes[, initializer[, initargs]]])
+
+   A thread pool object which controls a pool of worker threads to which jobs
+   can be submitted.  :class:`ThreadPool` instances are fully interface
+   compatible with :class:`Pool` instances, and their resources must also be
+   properly managed, either by using the pool as a context manager or by
+   calling :meth:`~multiprocessing.pool.Pool.close` and
+   :meth:`~multiprocessing.pool.Pool.terminate` manually.
+
+   *processes* is the number of worker threads to use.  If *processes* is
+   ``None`` then the number returned by :func:`os.cpu_count` is used.
+
+   If *initializer* is not ``None`` then each worker process will call
+   ``initializer(*initargs)`` when it starts.
+
+   Unlike :class:`Pool`, *maxtasksperchild* and *context* cannot be provided.
+
+    .. note::
+
+        A :class:`ThreadPool` shares the same interface as :class:`Pool`, which
+        is designed around a pool of processes and predates the introduction of
+        the :class:`concurrent.futures` module.  As such, it inherits some
+        operations that don't make sense for a pool backed by threads, and it
+        has its own type for representing the status of asynchronous jobs,
+        :class:`AsyncResult`, that is not understood by any other libraries.
+
+        Users should generally prefer to use
+        :class:`concurrent.futures.ThreadPoolExecutor`, which has a simpler
+        interface that was designed around threads from the start, and which
+        returns :class:`concurrent.futures.Future` instances that are
+        compatible with many other libraries, including :mod:`asyncio`.
+
 
 .. _multiprocessing-programming:
 
diff --git a/Doc/library/multiprocessing.shared_memory.rst b/Doc/library/multiprocessing.shared_memory.rst
index cba576a..2ba42b7 100644
--- a/Doc/library/multiprocessing.shared_memory.rst
+++ b/Doc/library/multiprocessing.shared_memory.rst
@@ -342,3 +342,30 @@
    >>> c.shm.close()
    >>> c.shm.unlink()
 
+The following examples demonstrates that ``ShareableList``
+(and underlying ``SharedMemory``) objects
+can be pickled and unpickled if needed.
+Note, that it will still be the same shared object.
+This happens, because the deserialized object has
+the same unique name and is just attached to an existing
+object with the same name (if the object is still alive):
+
+   >>> import pickle
+   >>> from multiprocessing import shared_memory
+   >>> sl = shared_memory.ShareableList(range(10))
+   >>> list(sl)
+   [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
+
+   >>> deserialized_sl = pickle.loads(pickle.dumps(sl))
+   >>> list(deserialized_sl)
+   [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
+
+   >>> sl[0] = -1
+   >>> deserialized_sl[1] = -2
+   >>> list(sl)
+   [-1, -2, 2, 3, 4, 5, 6, 7, 8, 9]
+   >>> list(deserialized_sl)
+   [-1, -2, 2, 3, 4, 5, 6, 7, 8, 9]
+
+   >>> sl.shm.close()
+   >>> sl.shm.unlink()
diff --git a/Doc/library/netdata.rst b/Doc/library/netdata.rst
index 4915016..e76280f 100644
--- a/Doc/library/netdata.rst
+++ b/Doc/library/netdata.rst
@@ -6,7 +6,7 @@
 **********************
 
 This chapter describes modules which support handling data formats commonly used
-on the Internet.
+on the internet.
 
 
 .. toctree::
diff --git a/Doc/library/netrc.rst b/Doc/library/netrc.rst
index 3d29ac4..4bf7de6 100644
--- a/Doc/library/netrc.rst
+++ b/Doc/library/netrc.rst
@@ -38,6 +38,10 @@
       :func:`os.path.expanduser` is used to find the location of the
       :file:`.netrc` file when *file* is not passed as argument.
 
+   .. versionchanged:: 3.10
+      :class:`netrc` try UTF-8 encoding before using locale specific
+      encoding.
+
 
 .. exception:: NetrcParseError
 
diff --git a/Doc/library/numbers.rst b/Doc/library/numbers.rst
index 1b59495..b77845e 100644
--- a/Doc/library/numbers.rst
+++ b/Doc/library/numbers.rst
@@ -10,7 +10,7 @@
 
 The :mod:`numbers` module (:pep:`3141`) defines a hierarchy of numeric
 :term:`abstract base classes <abstract base class>` which progressively define
-more operations.  None of the types defined in this module can be instantiated.
+more operations.  None of the types defined in this module are intended to be instantiated.
 
 
 .. class:: Number
@@ -27,8 +27,8 @@
    Subclasses of this type describe complex numbers and include the operations
    that work on the built-in :class:`complex` type. These are: conversions to
    :class:`complex` and :class:`bool`, :attr:`.real`, :attr:`.imag`, ``+``,
-   ``-``, ``*``, ``/``, :func:`abs`, :meth:`conjugate`, ``==``, and ``!=``. All
-   except ``-`` and ``!=`` are abstract.
+   ``-``, ``*``, ``/``, ``**``, :func:`abs`, :meth:`conjugate`, ``==``, and
+   ``!=``. All except ``-`` and ``!=`` are abstract.
 
    .. attribute:: real
 
@@ -76,8 +76,9 @@
 
    Subtypes :class:`Rational` and adds a conversion to :class:`int`.  Provides
    defaults for :func:`float`, :attr:`~Rational.numerator`, and
-   :attr:`~Rational.denominator`.  Adds abstract methods for ``**`` and
-   bit-string operations: ``<<``, ``>>``, ``&``, ``^``, ``|``, ``~``.
+   :attr:`~Rational.denominator`.  Adds abstract methods for :func:`pow` with
+   modulus and bit-string operations: ``<<``, ``>>``, ``&``, ``^``, ``|``,
+   ``~``.
 
 
 Notes for type implementors
diff --git a/Doc/library/operator.rst b/Doc/library/operator.rst
index fa02bde..0cdba68 100644
--- a/Doc/library/operator.rst
+++ b/Doc/library/operator.rst
@@ -112,6 +112,10 @@
 
    Return *a* converted to an integer.  Equivalent to ``a.__index__()``.
 
+   .. versionchanged:: 3.10
+      The result always has exact type :class:`int`.  Previously, the result
+      could have been an instance of a subclass of ``int``.
+
 
 .. function:: inv(obj)
               invert(obj)
@@ -315,15 +319,12 @@
    method.  Dictionaries accept any hashable value.  Lists, tuples, and
    strings accept an index or a slice:
 
-      >>> itemgetter('name')({'name': 'tu', 'age': 18})
-      'tu'
       >>> itemgetter(1)('ABCDEFG')
       'B'
-      >>> itemgetter(1,3,5)('ABCDEFG')
+      >>> itemgetter(1, 3, 5)('ABCDEFG')
       ('B', 'D', 'F')
-      >>> itemgetter(slice(2,None))('ABCDEFG')
+      >>> itemgetter(slice(2, None))('ABCDEFG')
       'CDEFG'
-
       >>> soldier = dict(rank='captain', name='dotterbart')
       >>> itemgetter('rank')(soldier)
       'captain'
diff --git a/Doc/library/os.path.rst b/Doc/library/os.path.rst
index a5abacf..6b15a11 100644
--- a/Doc/library/os.path.rst
+++ b/Doc/library/os.path.rst
@@ -175,8 +175,8 @@
 
    On Windows, :envvar:`USERPROFILE` will be used if set, otherwise a combination
    of :envvar:`HOMEPATH` and :envvar:`HOMEDRIVE` will be used.  An initial
-   ``~user`` is handled by stripping the last directory component from the created
-   user path derived above.
+   ``~user`` is handled by checking that the last directory component of the current
+   user's home directory matches :envvar:`USERNAME`, and replacing it if so.
 
    If the expansion fails or if the path does not begin with a tilde, the path is
    returned unchanged.
@@ -306,11 +306,10 @@
 
    Join one or more path components intelligently.  The return value is the
    concatenation of *path* and any members of *\*paths* with exactly one
-   directory separator (``os.sep``) following each non-empty part except the
-   last, meaning that the result will only end in a separator if the last
-   part is empty.  If a component is an absolute path, all previous
-   components are thrown away and joining continues from the absolute path
-   component.
+   directory separator following each non-empty part except the last, meaning
+   that the result will only end in a separator if the last part is empty.  If
+   a component is an absolute path, all previous components are thrown away
+   and joining continues from the absolute path component.
 
    On Windows, the drive letter is not reset when an absolute path component
    (e.g., ``r'\foo'``) is encountered.  If a component contains a drive
@@ -341,19 +340,36 @@
    that contains symbolic links.  On Windows, it converts forward slashes to
    backward slashes. To normalize case, use :func:`normcase`.
 
+  .. note::
+      On POSIX systems, in accordance with `IEEE Std 1003.1 2013 Edition; 4.13
+      Pathname Resolution <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13>`_,
+      if a pathname begins with exactly two slashes, the first component
+      following the leading characters may be interpreted in an implementation-defined
+      manner, although more than two leading characters shall be treated as a
+      single character.
+
    .. versionchanged:: 3.6
       Accepts a :term:`path-like object`.
 
 
-.. function:: realpath(path)
+.. function:: realpath(path, *, strict=False)
 
    Return the canonical path of the specified filename, eliminating any symbolic
    links encountered in the path (if they are supported by the operating
    system).
 
+   If a path doesn't exist or a symlink loop is encountered, and *strict* is
+   ``True``, :exc:`OSError` is raised. If *strict* is ``False``, the path is
+   resolved as far as possible and any remainder is appended without checking
+   whether it exists.
+
    .. note::
-      When symbolic link cycles occur, the returned path will be one member of
-      the cycle, but no guarantee is made about which member that will be.
+      This function emulates the operating system's procedure for making a path
+      canonical, which differs slightly between Windows and UNIX with respect
+      to how links and subsequent path components interact.
+
+      Operating system APIs make paths canonical as needed, so it's not
+      normally necessary to call this function.
 
    .. versionchanged:: 3.6
       Accepts a :term:`path-like object`.
@@ -361,13 +377,17 @@
    .. versionchanged:: 3.8
       Symbolic links and junctions are now resolved on Windows.
 
+   .. versionchanged:: 3.10
+      The *strict* parameter was added.
+
 
 .. function:: relpath(path, start=os.curdir)
 
    Return a relative filepath to *path* either from the current directory or
    from an optional *start* directory.  This is a path computation:  the
    filesystem is not accessed to confirm the existence or nature of *path* or
-   *start*.
+   *start*.  On Windows, :exc:`ValueError` is raised when *path* and *start*
+   are on different drives.
 
    *start* defaults to :attr:`os.curdir`.
 
@@ -450,12 +470,16 @@
    On Windows, splits a pathname into drive/UNC sharepoint and relative path.
 
    If the path contains a drive letter, drive will contain everything
-   up to and including the colon.
-   e.g. ``splitdrive("c:/dir")`` returns ``("c:", "/dir")``
+   up to and including the colon::
+
+      >>> splitdrive("c:/dir")
+      ("c:", "/dir")
 
    If the path contains a UNC path, drive will contain the host name
-   and share, up to but not including the fourth separator.
-   e.g. ``splitdrive("//host/computer/dir")`` returns ``("//host/computer", "/dir")``
+   and share, up to but not including the fourth separator::
+
+      >>> splitdrive("//host/computer/dir")
+      ("//host/computer", "/dir")
 
    .. versionchanged:: 3.6
       Accepts a :term:`path-like object`.
@@ -464,9 +488,29 @@
 .. function:: splitext(path)
 
    Split the pathname *path* into a pair ``(root, ext)``  such that ``root + ext ==
-   path``, and *ext* is empty or begins with a period and contains at most one
-   period. Leading periods on the basename are  ignored; ``splitext('.cshrc')``
-   returns  ``('.cshrc', '')``.
+   path``, and the extension, *ext*, is empty or begins with a period and contains at
+   most one period.
+
+   If the path contains no extension, *ext* will be ``''``::
+
+      >>> splitext('bar')
+      ('bar', '')
+
+   If the path contains an extension, then *ext* will be set to this extension,
+   including the leading period. Note that previous periods will be ignored::
+
+      >>> splitext('foo.bar.exe')
+      ('foo.bar', '.exe')
+      >>> splitext('/foo/bar.exe')
+      ('/foo/bar', '.exe')
+
+   Leading periods of the last component of the path are considered to
+   be part of the root::
+
+      >>> splitext('.cshrc')
+      ('.cshrc', '')
+      >>> splitext('/foo/....jpg')
+      ('/foo/....jpg', '')
 
    .. versionchanged:: 3.6
       Accepts a :term:`path-like object`.
diff --git a/Doc/library/os.rst b/Doc/library/os.rst
index 6e287ab..2a1ea05 100644
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -32,7 +32,7 @@
   objects, and result in an object of the same type, if a path or file name is
   returned.
 
-* On VxWorks, os.fork, os.execv and os.spawn*p* are not supported.
+* On VxWorks, os.popen, os.fork, os.execv and os.spawn*p* are not supported.
 
 .. note::
 
@@ -68,8 +68,13 @@
 In Python, file names, command line arguments, and environment variables are
 represented using the string type. On some systems, decoding these strings to
 and from bytes is necessary before passing them to the operating system. Python
-uses the file system encoding to perform this conversion (see
-:func:`sys.getfilesystemencoding`).
+uses the :term:`filesystem encoding and error handler` to perform this
+conversion (see :func:`sys.getfilesystemencoding`).
+
+The :term:`filesystem encoding and error handler` are configured at Python
+startup by the :c:func:`PyConfig_Read` function: see
+:c:member:`~PyConfig.filesystem_encoding` and
+:c:member:`~PyConfig.filesystem_errors` members of :c:type:`PyConfig`.
 
 .. versionchanged:: 3.1
    On some systems, conversion using the file system encoding may fail. In this
@@ -79,9 +84,72 @@
    original byte on encoding.
 
 
-The file system encoding must guarantee to successfully decode all bytes
-below 128. If the file system encoding fails to provide this guarantee, API
-functions may raise UnicodeErrors.
+The :term:`file system encoding <filesystem encoding and error handler>` must
+guarantee to successfully decode all bytes below 128. If the file system
+encoding fails to provide this guarantee, API functions can raise
+:exc:`UnicodeError`.
+
+See also the :term:`locale encoding`.
+
+
+.. _utf8-mode:
+
+Python UTF-8 Mode
+-----------------
+
+.. versionadded:: 3.7
+   See :pep:`540` for more details.
+
+The Python UTF-8 Mode ignores the :term:`locale encoding` and forces the usage
+of the UTF-8 encoding:
+
+* Use UTF-8 as the :term:`filesystem encoding <filesystem encoding and error
+  handler>`.
+* :func:`sys.getfilesystemencoding()` returns ``'UTF-8'``.
+* :func:`locale.getpreferredencoding()` returns ``'UTF-8'`` (the *do_setlocale*
+  argument has no effect).
+* :data:`sys.stdin`, :data:`sys.stdout`, and :data:`sys.stderr` all use
+  UTF-8 as their text encoding, with the ``surrogateescape``
+  :ref:`error handler <error-handlers>` being enabled for :data:`sys.stdin`
+  and :data:`sys.stdout` (:data:`sys.stderr` continues to use
+  ``backslashreplace`` as it does in the default locale-aware mode)
+* On Unix, :func:`os.device_encoding` returns ``'UTF-8'``. rather than the
+  device encoding.
+
+Note that the standard stream settings in UTF-8 mode can be overridden by
+:envvar:`PYTHONIOENCODING` (just as they can be in the default locale-aware
+mode).
+
+As a consequence of the changes in those lower level APIs, other higher
+level APIs also exhibit different default behaviours:
+
+* Command line arguments, environment variables and filenames are decoded
+  to text using the UTF-8 encoding.
+* :func:`os.fsdecode()` and :func:`os.fsencode()` use the UTF-8 encoding.
+* :func:`open()`, :func:`io.open()`, and :func:`codecs.open()` use the UTF-8
+  encoding by default. However, they still use the strict error handler by
+  default so that attempting to open a binary file in text mode is likely
+  to raise an exception rather than producing nonsense data.
+
+The :ref:`Python UTF-8 Mode <utf8-mode>` is enabled if the LC_CTYPE locale is
+``C`` or ``POSIX`` at Python startup (see the :c:func:`PyConfig_Read`
+function).
+
+It can be enabled or disabled using the :option:`-X utf8 <-X>` command line
+option and the :envvar:`PYTHONUTF8` environment variable.
+
+If the :envvar:`PYTHONUTF8` environment variable is not set at all, then the
+interpreter defaults to using the current locale settings, *unless* the current
+locale is identified as a legacy ASCII-based locale (as described for
+:envvar:`PYTHONCOERCECLOCALE`), and locale coercion is either disabled or
+fails. In such legacy locales, the interpreter will default to enabling UTF-8
+mode unless explicitly instructed not to do so.
+
+The Python UTF-8 Mode can only be enabled at the Python startup. Its value
+can be read from :data:`sys.flags.utf8_mode <sys.flags>`.
+
+See also the :ref:`UTF-8 mode on Windows <win-utf8-mode>`
+and the :term:`filesystem encoding and error handler`.
 
 
 .. _os-procinfo:
@@ -102,9 +170,10 @@
 
 .. data:: environ
 
-   A :term:`mapping` object representing the string environment. For example,
-   ``environ['HOME']`` is the pathname of your home directory (on some platforms),
-   and is equivalent to ``getenv("HOME")`` in C.
+   A :term:`mapping` object where keys and values are strings that represent
+   the process environment.  For example, ``environ['HOME']`` is the pathname
+   of your home directory (on some platforms), and is equivalent to
+   ``getenv("HOME")`` in C.
 
    This mapping is captured the first time the :mod:`os` module is imported,
    typically during Python startup as part of processing :file:`site.py`.  Changes
@@ -126,7 +195,7 @@
 
    .. note::
 
-      On some platforms, including FreeBSD and Mac OS X, setting ``environ`` may
+      On some platforms, including FreeBSD and macOS, setting ``environ`` may
       cause memory leaks.  Refer to the system documentation for
       :c:func:`putenv`.
 
@@ -141,10 +210,10 @@
 
 .. data:: environb
 
-   Bytes version of :data:`environ`: a :term:`mapping` object representing the
-   environment as byte strings. :data:`environ` and :data:`environb` are
-   synchronized (modify :data:`environb` updates :data:`environ`, and vice
-   versa).
+   Bytes version of :data:`environ`: a :term:`mapping` object where both keys
+   and values are :class:`bytes` objects representing the process environment.
+   :data:`environ` and :data:`environb` are synchronized (modifying
+   :data:`environb` updates :data:`environ`, and vice versa).
 
    :data:`environb` is only available if :data:`supports_bytes_environ` is
    ``True``.
@@ -165,9 +234,9 @@
 
 .. function:: fsencode(filename)
 
-   Encode :term:`path-like <path-like object>` *filename* to the filesystem
-   encoding with ``'surrogateescape'`` error handler, or ``'strict'`` on
-   Windows; return :class:`bytes` unchanged.
+   Encode :term:`path-like <path-like object>` *filename* to the
+   :term:`filesystem encoding and error handler`; return :class:`bytes`
+   unchanged.
 
    :func:`fsdecode` is the reverse function.
 
@@ -181,8 +250,8 @@
 .. function:: fsdecode(filename)
 
    Decode the :term:`path-like <path-like object>` *filename* from the
-   filesystem encoding with ``'surrogateescape'`` error handler, or ``'strict'``
-   on Windows; return :class:`str` unchanged.
+   :term:`filesystem encoding and error handler`; return :class:`str`
+   unchanged.
 
    :func:`fsencode` is the reverse function.
 
@@ -301,7 +370,7 @@
 
    .. note::
 
-      On Mac OS X, :func:`getgroups` behavior differs somewhat from
+      On macOS, :func:`getgroups` behavior differs somewhat from
       other Unix platforms. If the Python interpreter was built with a
       deployment target of :const:`10.5` or earlier, :func:`getgroups` returns
       the list of effective group ids associated with the current user process;
@@ -448,7 +517,7 @@
 
    .. note::
 
-      On some platforms, including FreeBSD and Mac OS X, setting ``environ`` may
+      On some platforms, including FreeBSD and macOS, setting ``environ`` may
       cause memory leaks. Refer to the system documentation for :c:func:`putenv`.
 
    .. audit-event:: os.putenv key,value os.putenv
@@ -486,7 +555,7 @@
 
    .. availability:: Unix.
 
-   .. note:: On Mac OS X, the length of *groups* may not exceed the
+   .. note:: On macOS, the length of *groups* may not exceed the
       system-defined maximum number of effective group ids, typically 16.
       See the documentation for :func:`getgroups` for cases where it may not
       return the same group list set by calling setgroups().
@@ -742,6 +811,12 @@
    Return a string describing the encoding of the device associated with *fd*
    if it is connected to a terminal; else return :const:`None`.
 
+   On Unix, if the :ref:`Python UTF-8 Mode <utf8-mode>` is enabled, return
+   ``'UTF-8'`` rather than the device encoding.
+
+   .. versionchanged:: 3.10
+      On Unix, the function now implements the Python UTF-8 Mode.
+
 
 .. function:: dup(fd)
 
@@ -1016,6 +1091,16 @@
 
    The above constants are only available on Windows.
 
+.. data:: O_EVTONLY
+          O_FSYNC
+          O_SYMLINK
+          O_NOFOLLOW_ANY
+
+   The above constants are only available on macOS.
+
+   .. versionchanged:: 3.10
+      Add :data:`O_EVTONLY`, :data:`O_FSYNC`, :data:`O_SYMLINK`
+      and :data:`O_NOFOLLOW_ANY` constants.
 
 .. data:: O_ASYNC
           O_DIRECT
@@ -1211,6 +1296,7 @@
 
    - :data:`RWF_DSYNC`
    - :data:`RWF_SYNC`
+   - :data:`RWF_APPEND`
 
    Return the total number of bytes actually written.
 
@@ -1228,8 +1314,8 @@
 
 .. data:: RWF_DSYNC
 
-   Provide a per-write equivalent of the :data:`O_DSYNC` ``open(2)`` flag. This
-   flag effect applies only to the data range written by the system call.
+   Provide a per-write equivalent of the :data:`O_DSYNC` :func:`os.open` flag.
+   This flag effect applies only to the data range written by the system call.
 
    .. availability:: Linux 4.7 and newer.
 
@@ -1238,14 +1324,28 @@
 
 .. data:: RWF_SYNC
 
-   Provide a per-write equivalent of the :data:`O_SYNC` ``open(2)`` flag. This
-   flag effect applies only to the data range written by the system call.
+   Provide a per-write equivalent of the :data:`O_SYNC` :func:`os.open` flag.
+   This flag effect applies only to the data range written by the system call.
 
    .. availability:: Linux 4.7 and newer.
 
    .. versionadded:: 3.7
 
 
+.. data:: RWF_APPEND
+
+   Provide a per-write equivalent of the :data:`O_APPEND` :func:`os.open`
+   flag. This flag is meaningful only for :func:`os.pwritev`, and its
+   effect applies only to the data range written by the system call. The
+   *offset* argument does not affect the write operation; the data is always
+   appended to the end of the file. However, if the *offset* argument is
+   ``-1``, the current file *offset* is updated.
+
+   .. availability:: Linux 4.16 and newer.
+
+   .. versionadded:: 3.10
+
+
 .. function:: read(fd, n)
 
    Read at most *n* bytes from file descriptor *fd*.
@@ -1280,11 +1380,11 @@
    On Linux, if *offset* is given as ``None``, the bytes are read from the
    current position of *in_fd* and the position of *in_fd* is updated.
 
-   The second case may be used on Mac OS X and FreeBSD where *headers* and
+   The second case may be used on macOS and FreeBSD where *headers* and
    *trailers* are arbitrary sequences of buffers that are written before and
    after the data from *in_fd* is written. It returns the same as the first case.
 
-   On Mac OS X and FreeBSD, a value of ``0`` for *count* specifies to send until
+   On macOS and FreeBSD, a value of ``0`` for *count* specifies to send until
    the end of *in_fd* is reached.
 
    All platforms support sockets as *out_fd* file descriptor, and some platforms
@@ -1330,6 +1430,39 @@
    .. versionadded:: 3.3
 
 
+.. function:: splice(src, dst, count, offset_src=None, offset_dst=None)
+
+   Transfer *count* bytes from file descriptor *src*, starting from offset
+   *offset_src*, to file descriptor *dst*, starting from offset *offset_dst*.
+   At least one of the file descriptors must refer to a pipe. If *offset_src*
+   is None, then *src* is read from the current position; respectively for
+   *offset_dst*. The offset associated to the file descriptor that refers to a
+   pipe must be ``None``. The files pointed by *src* and *dst* must reside in
+   the same filesystem, otherwise an :exc:`OSError` is raised with
+   :attr:`~OSError.errno` set to :data:`errno.EXDEV`.
+
+   This copy is done without the additional cost of transferring data
+   from the kernel to user space and then back into the kernel. Additionally,
+   some filesystems could implement extra optimizations. The copy is done as if
+   both files are opened as binary.
+
+   Upon successful completion, returns the number of bytes spliced to or from
+   the pipe. A return value of 0 means end of input. If *src* refers to a
+   pipe, then this means that there was no data to transfer, and it would not
+   make sense to block because there are no writers connected to the write end
+   of the pipe.
+
+   .. availability:: Linux kernel >= 2.6.17 and glibc >= 2.5
+
+   .. versionadded:: 3.10
+
+
+.. data:: SPLICE_F_MOVE
+          SPLICE_F_NONBLOCK
+          SPLICE_F_MORE
+
+   .. versionadded:: 3.10
+
 .. function:: readv(fd, buffers)
 
    Read from a file descriptor *fd* into a number of mutable :term:`bytes-like
@@ -1869,7 +2002,7 @@
       Accepts a :term:`path-like object`.
 
 
-.. function:: lstat(path, \*, dir_fd=None)
+.. function:: lstat(path, *, dir_fd=None)
 
    Perform the equivalent of an :c:func:`lstat` system call on the given path.
    Similar to :func:`~os.stat`, but does not follow symbolic links. Return a
@@ -1895,7 +2028,7 @@
       Added the *dir_fd* parameter.
 
    .. versionchanged:: 3.6
-      Accepts a :term:`path-like object` for *src* and *dst*.
+      Accepts a :term:`path-like object`.
 
    .. versionchanged:: 3.8
       On Windows, now opens reparse points that represent another path
@@ -1908,7 +2041,8 @@
 
    Create a directory named *path* with numeric mode *mode*.
 
-   If the directory already exists, :exc:`FileExistsError` is raised.
+   If the directory already exists, :exc:`FileExistsError` is raised. If a parent
+   directory in the path does not exist, :exc:`FileNotFoundError` is raised.
 
    .. _mkdir_modebits:
 
@@ -2115,6 +2249,7 @@
 
    Remove (delete) the file *path*.  If *path* is a directory, an
    :exc:`IsADirectoryError` is raised.  Use :func:`rmdir` to remove directories.
+   If the file does not exist, a :exc:`FileNotFoundError` is raised.
 
    This function can support :ref:`paths relative to directory descriptors
    <dir_fd>`.
@@ -2376,7 +2511,7 @@
       On the first, uncached call, a system call is required on Windows but
       not on Unix.
 
-   .. method:: is_dir(\*, follow_symlinks=True)
+   .. method:: is_dir(*, follow_symlinks=True)
 
       Return ``True`` if this entry is a directory or a symbolic link pointing
       to a directory; return ``False`` if the entry is or points to any other
@@ -2400,7 +2535,7 @@
       This method can raise :exc:`OSError`, such as :exc:`PermissionError`,
       but :exc:`FileNotFoundError` is caught and not raised.
 
-   .. method:: is_file(\*, follow_symlinks=True)
+   .. method:: is_file(*, follow_symlinks=True)
 
       Return ``True`` if this entry is a file or a symbolic link pointing to a
       file; return ``False`` if the entry is or points to a directory or other
@@ -2430,7 +2565,7 @@
       This method can raise :exc:`OSError`, such as :exc:`PermissionError`,
       but :exc:`FileNotFoundError` is caught and not raised.
 
-   .. method:: stat(\*, follow_symlinks=True)
+   .. method:: stat(*, follow_symlinks=True)
 
       Return a :class:`stat_result` object for this entry. This method
       follows symbolic links by default; to stat a symbolic link add the
@@ -2462,7 +2597,7 @@
       for :class:`bytes` paths on Windows.
 
 
-.. function:: stat(path, \*, dir_fd=None, follow_symlinks=True)
+.. function:: stat(path, *, dir_fd=None, follow_symlinks=True)
 
    Get the status of a file or a file descriptor. Perform the equivalent of a
    :c:func:`stat` system call on the given path. *path* may be specified as
@@ -2656,7 +2791,7 @@
       String that uniquely identifies the type of the filesystem that
       contains the file.
 
-   On Mac OS systems, the following attributes may also be available:
+   On macOS systems, the following attributes may also be available:
 
    .. attribute:: st_rsize
 
@@ -3187,6 +3322,102 @@
    .. versionadded:: 3.8
 
 
+.. function:: eventfd(initval[, flags=os.EFD_CLOEXEC])
+
+   Create and return an event file descriptor. The file descriptors supports
+   raw :func:`read` and :func:`write` with a buffer size of 8,
+   :func:`~select.select`, :func:`~select.poll` and similar. See man page
+   :manpage:`eventfd(2)` for more information.  By default, the
+   new file descriptor is :ref:`non-inheritable <fd_inheritance>`.
+
+   *initval* is the initial value of the event counter. The initial value
+   must be an 32 bit unsigned integer. Please note that the initial value is
+   limited to a 32 bit unsigned int although the event counter is an unsigned
+   64 bit integer with a maximum value of 2\ :sup:`64`\ -\ 2.
+
+   *flags* can be constructed from :const:`EFD_CLOEXEC`,
+   :const:`EFD_NONBLOCK`, and :const:`EFD_SEMAPHORE`.
+
+   If :const:`EFD_SEMAPHORE` is specified and the event counter is non-zero,
+   :func:`eventfd_read` returns 1 and decrements the counter by one.
+
+   If :const:`EFD_SEMAPHORE` is not specified and the event counter is
+   non-zero, :func:`eventfd_read` returns the current event counter value and
+   resets the counter to zero.
+
+   If the event counter is zero and :const:`EFD_NONBLOCK` is not
+   specified, :func:`eventfd_read` blocks.
+
+   :func:`eventfd_write` increments the event counter. Write blocks if the
+   write operation would increment the counter to a value larger than
+   2\ :sup:`64`\ -\ 2.
+
+   Example::
+
+       import os
+
+       # semaphore with start value '1'
+       fd = os.eventfd(1, os.EFD_SEMAPHORE | os.EFC_CLOEXEC)
+       try:
+           # acquire semaphore
+           v = os.eventfd_read(fd)
+           try:
+               do_work()
+           finally:
+               # release semaphore
+               os.eventfd_write(fd, v)
+       finally:
+           os.close(fd)
+
+   .. availability:: Linux 2.6.27 or newer with glibc 2.8 or newer.
+
+   .. versionadded:: 3.10
+
+.. function:: eventfd_read(fd)
+
+   Read value from an :func:`eventfd` file descriptor and return a 64 bit
+   unsigned int. The function does not verify that *fd* is an :func:`eventfd`.
+
+   .. availability:: See :func:`eventfd`
+
+   .. versionadded:: 3.10
+
+.. function:: eventfd_write(fd, value)
+
+   Add value to an :func:`eventfd` file descriptor. *value* must be a 64 bit
+   unsigned int. The function does not verify that *fd* is an :func:`eventfd`.
+
+   .. availability:: See :func:`eventfd`
+
+   .. versionadded:: 3.10
+
+.. data:: EFD_CLOEXEC
+
+   Set close-on-exec flag for new :func:`eventfd` file descriptor.
+
+   .. availability:: See :func:`eventfd`
+
+   .. versionadded:: 3.10
+
+.. data:: EFD_NONBLOCK
+
+   Set :const:`O_NONBLOCK` status flag for new :func:`eventfd` file
+   descriptor.
+
+   .. availability:: See :func:`eventfd`
+
+   .. versionadded:: 3.10
+
+.. data:: EFD_SEMAPHORE
+
+   Provide semaphore-like semantics for reads from a :func:`eventfd` file
+   descriptor. On read the internal counter is decremented by one.
+
+   .. availability:: Linux 2.6.30 or newer with glibc 2.8 or newer.
+
+   .. versionadded:: 3.10
+
+
 Linux extended attributes
 ~~~~~~~~~~~~~~~~~~~~~~~~~
 
@@ -3231,7 +3462,7 @@
    Removes the extended filesystem attribute *attribute* from *path*.
    *attribute* should be bytes or str (directly or indirectly through the
    :class:`PathLike` interface). If it is a string, it is encoded
-   with the filesystem encoding.
+   with the :term:`filesystem encoding and error handler`.
 
    This function can support :ref:`specifying a file descriptor <path_fd>` and
    :ref:`not following symlinks <follow_symlinks>`.
@@ -3247,11 +3478,11 @@
    Set the extended filesystem attribute *attribute* on *path* to *value*.
    *attribute* must be a bytes or str with no embedded NULs (directly or
    indirectly through the :class:`PathLike` interface). If it is a str,
-   it is encoded with the filesystem encoding.  *flags* may be
+   it is encoded with the :term:`filesystem encoding and error handler`.  *flags* may be
    :data:`XATTR_REPLACE` or :data:`XATTR_CREATE`. If :data:`XATTR_REPLACE` is
-   given and the attribute does not exist, ``EEXISTS`` will be raised.
+   given and the attribute does not exist, ``ENODATA`` will be raised.
    If :data:`XATTR_CREATE` is given and the attribute already exists, the
-   attribute will not be created and ``ENODATA`` will be raised.
+   attribute will not be created and ``EEXISTS`` will be raised.
 
    This function can support :ref:`specifying a file descriptor <path_fd>` and
    :ref:`not following symlinks <follow_symlinks>`.
@@ -3927,7 +4158,7 @@
    .. availability:: Windows.
 
 
-.. function:: startfile(path[, operation])
+.. function:: startfile(path, [operation], [arguments], [cwd], [show_cmd])
 
    Start a file with its associated application.
 
@@ -3941,13 +4172,25 @@
    ``'print'`` and  ``'edit'`` (to be used on files) as well as ``'explore'`` and
    ``'find'`` (to be used on directories).
 
+   When launching an application, specify *arguments* to be passed as a single
+   string. This argument may have no effect when using this function to launch a
+   document.
+
+   The default working directory is inherited, but may be overridden by the *cwd*
+   argument. This should be an absolute path. A relative *path* will be resolved
+   against this argument.
+
+   Use *show_cmd* to override the default window style. Whether this has any
+   effect will depend on the application being launched. Values are integers as
+   supported by the Win32 :c:func:`ShellExecute` function.
+
    :func:`startfile` returns as soon as the associated application is launched.
    There is no option to wait for the application to close, and no way to retrieve
    the application's exit status.  The *path* parameter is relative to the current
-   directory.  If you want to use an absolute path, make sure the first character
-   is not a slash (``'/'``); the underlying Win32 :c:func:`ShellExecute` function
-   doesn't work if it is.  Use the :func:`os.path.normpath` function to ensure that
-   the path is properly encoded for Win32.
+   directory or *cwd*.  If you want to use an absolute path, make sure the first
+   character is not a slash (``'/'``)  Use :mod:`pathlib` or the
+   :func:`os.path.normpath` function to ensure that paths are properly encoded for
+   Win32.
 
    To reduce interpreter startup overhead, the Win32 :c:func:`ShellExecute`
    function is not resolved until this function is first called.  If the function
@@ -3955,8 +4198,14 @@
 
    .. audit-event:: os.startfile path,operation os.startfile
 
+   .. audit-event:: os.startfile/2 path,operation,arguments,cwd,show_cmd os.startfile
+
    .. availability:: Windows.
 
+   .. versionchanged:: 3.10
+      Added the *arguments*, *cwd* and *show_cmd* arguments, and the
+      ``os.startfile/2`` audit event.
+
 
 .. function:: system(command)
 
@@ -3964,12 +4213,12 @@
    the Standard C function :c:func:`system`, and has the same limitations.
    Changes to :data:`sys.stdin`, etc. are not reflected in the environment of
    the executed command. If *command* generates any output, it will be sent to
-   the interpreter standard output stream.
+   the interpreter standard output stream. The C standard does not
+   specify the meaning of the return value of the C function, so the return
+   value of the Python function is system-dependent.
 
    On Unix, the return value is the exit status of the process encoded in the
-   format specified for :func:`wait`.  Note that POSIX does not specify the
-   meaning of the return value of the C :c:func:`system` function, so the return
-   value of the Python function is system-dependent.
+   format specified for :func:`wait`.
 
    On Windows, the return value is that returned by the system shell after
    running *command*.  The shell is given by the Windows environment variable
@@ -3996,20 +4245,20 @@
    Returns the current global process times.
    The return value is an object with five attributes:
 
-   * :attr:`user` - user time
-   * :attr:`system` - system time
-   * :attr:`children_user` - user time of all child processes
-   * :attr:`children_system` - system time of all child processes
-   * :attr:`elapsed` - elapsed real time since a fixed point in the past
+   * :attr:`!user` - user time
+   * :attr:`!system` - system time
+   * :attr:`!children_user` - user time of all child processes
+   * :attr:`!children_system` - system time of all child processes
+   * :attr:`!elapsed` - elapsed real time since a fixed point in the past
 
    For backwards compatibility, this object also behaves like a five-tuple
-   containing :attr:`user`, :attr:`system`, :attr:`children_user`,
-   :attr:`children_system`, and :attr:`elapsed` in that order.
+   containing :attr:`!user`, :attr:`!system`, :attr:`!children_user`,
+   :attr:`!children_system`, and :attr:`!elapsed` in that order.
 
    See the Unix manual page
    :manpage:`times(2)` and :manpage:`times(3)` manual page on Unix or `the GetProcessTimes MSDN
    <https://docs.microsoft.com/windows/win32/api/processthreadsapi/nf-processthreadsapi-getprocesstimes>`_
-   on Windows. On Windows, only :attr:`user` and :attr:`system` are known; the other attributes are zero.
+   on Windows. On Windows, only :attr:`!user` and :attr:`!system` are known; the other attributes are zero.
 
    .. availability:: Unix, Windows.
 
@@ -4388,7 +4637,7 @@
 
 .. function:: sched_setparam(pid, param)
 
-   Set a scheduling parameters for the process with PID *pid*. A *pid* of 0 means
+   Set the scheduling parameters for the process with PID *pid*. A *pid* of 0 means
    the calling process. *param* is a :class:`sched_param` instance.
 
 
@@ -4621,7 +4870,7 @@
 
 .. function:: urandom(size)
 
-   Return a string of *size* random bytes suitable for cryptographic use.
+   Return a bytestring of *size* random bytes suitable for cryptographic use.
 
    This function returns random bytes from an OS-specific randomness source.  The
    returned data should be unpredictable enough for cryptographic applications,
diff --git a/Doc/library/othergui.rst b/Doc/library/othergui.rst
deleted file mode 100644
index 48c1f27..0000000
--- a/Doc/library/othergui.rst
+++ /dev/null
@@ -1,57 +0,0 @@
-.. _other-gui-packages:
-
-Other Graphical User Interface Packages
-=======================================
-
-Major cross-platform (Windows, Mac OS X, Unix-like) GUI toolkits are
-available for Python:
-
-.. seealso::
-
-   `PyGObject <https://wiki.gnome.org/Projects/PyGObject>`_
-      PyGObject provides introspection bindings for C libraries using
-      `GObject <https://developer.gnome.org/gobject/stable/>`_.  One of
-      these libraries is the `GTK+ 3 <https://www.gtk.org/>`_ widget set.
-      GTK+ comes with many more widgets than Tkinter provides.  An online
-      `Python GTK+ 3 Tutorial <https://python-gtk-3-tutorial.readthedocs.io/>`_
-      is available.
-
-   `PyGTK <http://www.pygtk.org/>`_
-      PyGTK provides bindings for an older version
-      of the library, GTK+ 2.  It provides an object oriented interface that
-      is slightly higher level than the C one.  There are also bindings to
-      `GNOME <https://www.gnome.org/>`_.  An online `tutorial
-      <http://www.pygtk.org/pygtk2tutorial/index.html>`_ is available.
-
-   `PyQt <https://riverbankcomputing.com/software/pyqt/intro>`_
-      PyQt is a :program:`sip`\ -wrapped binding to the Qt toolkit.  Qt is an
-      extensive C++ GUI application development framework that is
-      available for Unix, Windows and Mac OS X. :program:`sip` is a tool
-      for generating bindings for C++ libraries as Python classes, and
-      is specifically designed for Python.
-
-   `PySide2 <https://doc.qt.io/qtforpython/>`_
-      Also known as the Qt for Python project, PySide2 is a newer binding to the
-      Qt toolkit. It is provided by The Qt Company and aims to provide a
-      complete port of PySide to Qt 5. Compared to PyQt, its licensing scheme is
-      friendlier to non-open source applications.
-
-   `wxPython <https://www.wxpython.org>`_
-      wxPython is a cross-platform GUI toolkit for Python that is built around
-      the popular `wxWidgets <https://www.wxwidgets.org/>`_ (formerly wxWindows)
-      C++ toolkit.  It provides a native look and feel for applications on
-      Windows, Mac OS X, and Unix systems by using each platform's native
-      widgets where ever possible, (GTK+ on Unix-like systems).  In addition to
-      an extensive set of widgets, wxPython provides classes for online
-      documentation and context sensitive help, printing, HTML viewing,
-      low-level device context drawing, drag and drop, system clipboard access,
-      an XML-based resource format and more, including an ever growing library
-      of user-contributed modules.
-
-PyGTK, PyQt, PySide2, and wxPython, all have a modern look and feel and more
-widgets than Tkinter. In addition, there are many other GUI toolkits for
-Python, both cross-platform, and platform-specific. See the `GUI Programming
-<https://wiki.python.org/moin/GuiProgramming>`_ page in the Python Wiki for a
-much more complete list, and also for links to documents where the
-different GUI toolkits are compared.
-
diff --git a/Doc/library/parser.rst b/Doc/library/parser.rst
deleted file mode 100644
index 79fc10d..0000000
--- a/Doc/library/parser.rst
+++ /dev/null
@@ -1,357 +0,0 @@
-:mod:`parser` --- Access Python parse trees
-===========================================
-
-.. module:: parser
-   :synopsis: Access parse trees for Python source code.
-
-.. moduleauthor:: Fred L. Drake, Jr. <fdrake@acm.org>
-.. sectionauthor:: Fred L. Drake, Jr. <fdrake@acm.org>
-
-.. Copyright 1995 Virginia Polytechnic Institute and State University and Fred
-   L. Drake, Jr.  This copyright notice must be distributed on all copies, but
-   this document otherwise may be distributed as part of the Python
-   distribution.  No fee may be charged for this document in any representation,
-   either on paper or electronically.  This restriction does not affect other
-   elements in a distributed package in any way.
-
-.. index:: single: parsing; Python source code
-
---------------
-
-The :mod:`parser` module provides an interface to Python's internal parser and
-byte-code compiler.  The primary purpose for this interface is to allow Python
-code to edit the parse tree of a Python expression and create executable code
-from this.  This is better than trying to parse and modify an arbitrary Python
-code fragment as a string because parsing is performed in a manner identical to
-the code forming the application.  It is also faster.
-
-.. warning::
-
-   The parser module is deprecated and will be removed in future versions of
-   Python. For the majority of use cases you can leverage the Abstract Syntax
-   Tree (AST) generation and compilation stage, using the :mod:`ast` module.
-
-There are a few things to note about this module which are important to making
-use of the data structures created.  This is not a tutorial on editing the parse
-trees for Python code, but some examples of using the :mod:`parser` module are
-presented.
-
-Most importantly, a good understanding of the Python grammar processed by the
-internal parser is required.  For full information on the language syntax, refer
-to :ref:`reference-index`.  The parser
-itself is created from a grammar specification defined in the file
-:file:`Grammar/Grammar` in the standard Python distribution.  The parse trees
-stored in the ST objects created by this module are the actual output from the
-internal parser when created by the :func:`expr` or :func:`suite` functions,
-described below.  The ST objects created by :func:`sequence2st` faithfully
-simulate those structures.  Be aware that the values of the sequences which are
-considered "correct" will vary from one version of Python to another as the
-formal grammar for the language is revised.  However, transporting code from one
-Python version to another as source text will always allow correct parse trees
-to be created in the target version, with the only restriction being that
-migrating to an older version of the interpreter will not support more recent
-language constructs.  The parse trees are not typically compatible from one
-version to another, though source code has usually been forward-compatible within
-a major release series.
-
-Each element of the sequences returned by :func:`st2list` or :func:`st2tuple`
-has a simple form.  Sequences representing non-terminal elements in the grammar
-always have a length greater than one.  The first element is an integer which
-identifies a production in the grammar.  These integers are given symbolic names
-in the C header file :file:`Include/graminit.h` and the Python module
-:mod:`symbol`.  Each additional element of the sequence represents a component
-of the production as recognized in the input string: these are always sequences
-which have the same form as the parent.  An important aspect of this structure
-which should be noted is that keywords used to identify the parent node type,
-such as the keyword :keyword:`if` in an :const:`if_stmt`, are included in the
-node tree without any special treatment.  For example, the :keyword:`!if` keyword
-is represented by the tuple ``(1, 'if')``, where ``1`` is the numeric value
-associated with all :const:`NAME` tokens, including variable and function names
-defined by the user.  In an alternate form returned when line number information
-is requested, the same token might be represented as ``(1, 'if', 12)``, where
-the ``12`` represents the line number at which the terminal symbol was found.
-
-Terminal elements are represented in much the same way, but without any child
-elements and the addition of the source text which was identified.  The example
-of the :keyword:`if` keyword above is representative.  The various types of
-terminal symbols are defined in the C header file :file:`Include/token.h` and
-the Python module :mod:`token`.
-
-The ST objects are not required to support the functionality of this module,
-but are provided for three purposes: to allow an application to amortize the
-cost of processing complex parse trees, to provide a parse tree representation
-which conserves memory space when compared to the Python list or tuple
-representation, and to ease the creation of additional modules in C which
-manipulate parse trees.  A simple "wrapper" class may be created in Python to
-hide the use of ST objects.
-
-The :mod:`parser` module defines functions for a few distinct purposes.  The
-most important purposes are to create ST objects and to convert ST objects to
-other representations such as parse trees and compiled code objects, but there
-are also functions which serve to query the type of parse tree represented by an
-ST object.
-
-
-.. seealso::
-
-   Module :mod:`symbol`
-      Useful constants representing internal nodes of the parse tree.
-
-   Module :mod:`token`
-      Useful constants representing leaf nodes of the parse tree and functions for
-      testing node values.
-
-
-.. _creating-sts:
-
-Creating ST Objects
--------------------
-
-ST objects may be created from source code or from a parse tree. When creating
-an ST object from source, different functions are used to create the ``'eval'``
-and ``'exec'`` forms.
-
-
-.. function:: expr(source)
-
-   The :func:`expr` function parses the parameter *source* as if it were an input
-   to ``compile(source, 'file.py', 'eval')``.  If the parse succeeds, an ST object
-   is created to hold the internal parse tree representation, otherwise an
-   appropriate exception is raised.
-
-
-.. function:: suite(source)
-
-   The :func:`suite` function parses the parameter *source* as if it were an input
-   to ``compile(source, 'file.py', 'exec')``.  If the parse succeeds, an ST object
-   is created to hold the internal parse tree representation, otherwise an
-   appropriate exception is raised.
-
-
-.. function:: sequence2st(sequence)
-
-   This function accepts a parse tree represented as a sequence and builds an
-   internal representation if possible.  If it can validate that the tree conforms
-   to the Python grammar and all nodes are valid node types in the host version of
-   Python, an ST object is created from the internal representation and returned
-   to the called.  If there is a problem creating the internal representation, or
-   if the tree cannot be validated, a :exc:`ParserError` exception is raised.  An
-   ST object created this way should not be assumed to compile correctly; normal
-   exceptions raised by compilation may still be initiated when the ST object is
-   passed to :func:`compilest`.  This may indicate problems not related to syntax
-   (such as a :exc:`MemoryError` exception), but may also be due to constructs such
-   as the result of parsing ``del f(0)``, which escapes the Python parser but is
-   checked by the bytecode compiler.
-
-   Sequences representing terminal tokens may be represented as either two-element
-   lists of the form ``(1, 'name')`` or as three-element lists of the form ``(1,
-   'name', 56)``.  If the third element is present, it is assumed to be a valid
-   line number.  The line number may be specified for any subset of the terminal
-   symbols in the input tree.
-
-
-.. function:: tuple2st(sequence)
-
-   This is the same function as :func:`sequence2st`.  This entry point is
-   maintained for backward compatibility.
-
-
-.. _converting-sts:
-
-Converting ST Objects
----------------------
-
-ST objects, regardless of the input used to create them, may be converted to
-parse trees represented as list- or tuple- trees, or may be compiled into
-executable code objects.  Parse trees may be extracted with or without line
-numbering information.
-
-
-.. function:: st2list(st, line_info=False, col_info=False)
-
-   This function accepts an ST object from the caller in *st* and returns a
-   Python list representing the equivalent parse tree.  The resulting list
-   representation can be used for inspection or the creation of a new parse tree in
-   list form.  This function does not fail so long as memory is available to build
-   the list representation.  If the parse tree will only be used for inspection,
-   :func:`st2tuple` should be used instead to reduce memory consumption and
-   fragmentation.  When the list representation is required, this function is
-   significantly faster than retrieving a tuple representation and converting that
-   to nested lists.
-
-   If *line_info* is true, line number information will be included for all
-   terminal tokens as a third element of the list representing the token.  Note
-   that the line number provided specifies the line on which the token *ends*.
-   This information is omitted if the flag is false or omitted.
-
-
-.. function:: st2tuple(st, line_info=False, col_info=False)
-
-   This function accepts an ST object from the caller in *st* and returns a
-   Python tuple representing the equivalent parse tree.  Other than returning a
-   tuple instead of a list, this function is identical to :func:`st2list`.
-
-   If *line_info* is true, line number information will be included for all
-   terminal tokens as a third element of the list representing the token.  This
-   information is omitted if the flag is false or omitted.
-
-
-.. function:: compilest(st, filename='<syntax-tree>')
-
-   .. index::
-      builtin: exec
-      builtin: eval
-
-   The Python byte compiler can be invoked on an ST object to produce code objects
-   which can be used as part of a call to the built-in :func:`exec` or :func:`eval`
-   functions. This function provides the interface to the compiler, passing the
-   internal parse tree from *st* to the parser, using the source file name
-   specified by the *filename* parameter. The default value supplied for *filename*
-   indicates that the source was an ST object.
-
-   Compiling an ST object may result in exceptions related to compilation; an
-   example would be a :exc:`SyntaxError` caused by the parse tree for ``del f(0)``:
-   this statement is considered legal within the formal grammar for Python but is
-   not a legal language construct.  The :exc:`SyntaxError` raised for this
-   condition is actually generated by the Python byte-compiler normally, which is
-   why it can be raised at this point by the :mod:`parser` module.  Most causes of
-   compilation failure can be diagnosed programmatically by inspection of the parse
-   tree.
-
-
-.. _querying-sts:
-
-Queries on ST Objects
----------------------
-
-Two functions are provided which allow an application to determine if an ST was
-created as an expression or a suite.  Neither of these functions can be used to
-determine if an ST was created from source code via :func:`expr` or
-:func:`suite` or from a parse tree via :func:`sequence2st`.
-
-
-.. function:: isexpr(st)
-
-   .. index:: builtin: compile
-
-   When *st* represents an ``'eval'`` form, this function returns ``True``, otherwise
-   it returns ``False``.  This is useful, since code objects normally cannot be queried
-   for this information using existing built-in functions.  Note that the code
-   objects created by :func:`compilest` cannot be queried like this either, and
-   are identical to those created by the built-in :func:`compile` function.
-
-
-.. function:: issuite(st)
-
-   This function mirrors :func:`isexpr` in that it reports whether an ST object
-   represents an ``'exec'`` form, commonly known as a "suite."  It is not safe to
-   assume that this function is equivalent to ``not isexpr(st)``, as additional
-   syntactic fragments may be supported in the future.
-
-
-.. _st-errors:
-
-Exceptions and Error Handling
------------------------------
-
-The parser module defines a single exception, but may also pass other built-in
-exceptions from other portions of the Python runtime environment.  See each
-function for information about the exceptions it can raise.
-
-
-.. exception:: ParserError
-
-   Exception raised when a failure occurs within the parser module.  This is
-   generally produced for validation failures rather than the built-in
-   :exc:`SyntaxError` raised during normal parsing. The exception argument is
-   either a string describing the reason of the failure or a tuple containing a
-   sequence causing the failure from a parse tree passed to :func:`sequence2st`
-   and an explanatory string.  Calls to :func:`sequence2st` need to be able to
-   handle either type of exception, while calls to other functions in the module
-   will only need to be aware of the simple string values.
-
-Note that the functions :func:`compilest`, :func:`expr`, and :func:`suite` may
-raise exceptions which are normally raised by the parsing and compilation
-process.  These include the built in exceptions :exc:`MemoryError`,
-:exc:`OverflowError`, :exc:`SyntaxError`, and :exc:`SystemError`.  In these
-cases, these exceptions carry all the meaning normally associated with them.
-Refer to the descriptions of each function for detailed information.
-
-
-.. _st-objects:
-
-ST Objects
-----------
-
-Ordered and equality comparisons are supported between ST objects. Pickling of
-ST objects (using the :mod:`pickle` module) is also supported.
-
-
-.. data:: STType
-
-   The type of the objects returned by :func:`expr`, :func:`suite` and
-   :func:`sequence2st`.
-
-ST objects have the following methods:
-
-
-.. method:: ST.compile(filename='<syntax-tree>')
-
-   Same as ``compilest(st, filename)``.
-
-
-.. method:: ST.isexpr()
-
-   Same as ``isexpr(st)``.
-
-
-.. method:: ST.issuite()
-
-   Same as ``issuite(st)``.
-
-
-.. method:: ST.tolist(line_info=False, col_info=False)
-
-   Same as ``st2list(st, line_info, col_info)``.
-
-
-.. method:: ST.totuple(line_info=False, col_info=False)
-
-   Same as ``st2tuple(st, line_info, col_info)``.
-
-
-Example: Emulation of :func:`compile`
--------------------------------------
-
-While many useful operations may take place between parsing and bytecode
-generation, the simplest operation is to do nothing.  For this purpose, using
-the :mod:`parser` module to produce an intermediate data structure is equivalent
-to the code ::
-
-   >>> code = compile('a + 5', 'file.py', 'eval')
-   >>> a = 5
-   >>> eval(code)
-   10
-
-The equivalent operation using the :mod:`parser` module is somewhat longer, and
-allows the intermediate internal parse tree to be retained as an ST object::
-
-   >>> import parser
-   >>> st = parser.expr('a + 5')
-   >>> code = st.compile('file.py')
-   >>> a = 5
-   >>> eval(code)
-   10
-
-An application which needs both ST and code objects can package this code into
-readily available functions::
-
-   import parser
-
-   def load_suite(source_string):
-       st = parser.suite(source_string)
-       return st, st.compile()
-
-   def load_expression(source_string):
-       st = parser.expr(source_string)
-       return st, st.compile()
diff --git a/Doc/library/pathlib-inheritance.svg b/Doc/library/pathlib-inheritance.svg
index 49057f6..01f8684 100644
--- a/Doc/library/pathlib-inheritance.svg
+++ b/Doc/library/pathlib-inheritance.svg
@@ -1 +1 @@
-<svg version="1.1" viewBox="0.0 0.0 539.005249343832 319.40944881889766" fill="none" stroke="none" stroke-linecap="square" stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg"><clipPath id="p.0"><path d="m0 0l539.00525 0l0 319.40945l-539.00525 0l0 -319.40945z" clip-rule="nonzero"/></clipPath><g clip-path="url(#p.0)"><path fill="#000000" fill-opacity="0.0" d="m0 0l539.00525 0l0 319.40945l-539.00525 0z" fill-rule="evenodd"/><path fill="#ffffff" d="m203.43307 37.929134l113.98425 0l0 61.165356l-113.98425 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m203.43307 37.929134l113.98425 0l0 61.165356l-113.98425 0z" fill-rule="evenodd"/><path fill="#000000" d="m225.89395 71.12181l0 1.640625l1.625 0q0.578125 0 0.8125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-3.46875 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l0.25 0l0 -6.265625l-0.25 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.234375 0.828125 -0.234375l3.6875 0.015625q1.625 0 2.5625 0.890625q0.953125 0.875 0.953125 2.15625q0 0.703125 -0.3125 1.328125q-0.25 0.46875 -0.8125 0.921875q-0.5625 0.453125 -1.15625 0.6875q-0.59375 0.234375 -1.5625 0.234375l-1.515625 0zm0 -1.609375l1.484375 0q1.046875 0 1.65625 -0.46875q0.625 -0.46875 0.625 -1.140625q0 -0.5625 -0.5 -0.984375q-0.5 -0.421875 -1.421875 -0.421875l-1.84375 0l0 3.015625zm13.9296875 -2.234375l0 5.484375q0.515625 0 0.75 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.25 0.21875 -0.828125 0.21875l-1.515625 0l0 -0.375q-0.6875 0.3125 -1.3125 0.46875q-0.625 0.171875 -1.1875 0.171875q-0.796875 0 -1.375 -0.328125q-0.578125 -0.34375 -0.90625 -0.9375q-0.25 -0.421875 -0.25 -1.046875l0 -3.453125l-0.265625 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l1.875 0l0 4.765625q0 0.5 0.234375 0.75q0.25 0.234375 0.765625 0.234375q0.484375 0 1.03125 -0.1875q0.5625 -0.203125 1.390625 -0.703125l0 -3.265625l-0.578125 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l2.171875 0zm5.8671875 0l0 1.0q1.015625 -0.734375 1.59375 -0.96875q0.578125 -0.25 1.09375 -0.25q0.78125 0 1.515625 0.578125q0.5 0.390625 0.5 0.796875q0 0.34375 -0.25 0.59375q-0.234375 0.234375 -0.5625 0.234375q-0.296875 0 -0.625 -0.296875q-0.328125 -0.296875 -0.59375 -0.296875q-0.328125 0 -1.0 0.421875q-0.671875 0.421875 -1.671875 1.265625l0 2.40625l2.28125 0q0.578125 0 0.828125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.25 0.21875 -0.828125 0.21875l-4.828125 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l0.953125 0l0 -3.890625l-0.578125 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l2.171875 0zm13.9609375 4.359375l-6.578125 0q0.25 0.625 0.890625 1.015625q0.640625 0.375 1.71875 0.375q0.890625 0 2.375 -0.390625q0.609375 -0.15625 0.84375 -0.15625q0.3125 0 0.53125 0.234375q0.21875 0.21875 0.21875 0.5625q0 0.3125 -0.234375 0.53125q-0.3125 0.296875 -1.53125 0.5625q-1.203125 0.265625 -2.3125 0.265625q-1.921875 0 -3.078125 -1.09375q-1.15625 -1.09375 -1.15625 -2.671875q0 -1.6875 1.25 -2.75q1.25 -1.0625 2.875 -1.0625q0.96875 0 1.78125 0.34375q0.828125 0.34375 1.21875 0.75q0.5625 0.578125 0.9375 1.421875q0.25 0.59375 0.25 1.375l0 0.6875zm-1.78125 -1.609375q-0.359375 -0.6875 -0.953125 -1.015625q-0.59375 -0.34375 -1.421875 -0.34375q-0.8125 0 -1.40625 0.34375q-0.59375 0.328125 -0.96875 1.015625l4.75 0zm6.4296875 1.09375l0 1.640625l1.625 0q0.578125 0 0.8125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-3.46875 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l0.25 0l0 -6.265625l-0.25 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.234375 0.828125 -0.234375l3.6875 0.015625q1.625 0 2.5625 0.890625q0.953125 0.875 0.953125 2.15625q0 0.703125 -0.3125 1.328125q-0.25 0.46875 -0.8125 0.921875q-0.5625 0.453125 -1.15625 0.6875q-0.59375 0.234375 -1.5625 0.234375l-1.515625 0zm0 -1.609375l1.484375 0q1.046875 0 1.65625 -0.46875q0.625 -0.46875 0.625 -1.140625q0 -0.5625 -0.5 -0.984375q-0.5 -0.421875 -1.421875 -0.421875l-1.84375 0l0 3.015625zm11.9765625 4.859375l0 -0.375q-0.609375 0.3125 -1.34375 0.46875q-0.71875 0.171875 -1.3125 0.171875q-1.28125 0 -2.09375 -0.6875q-0.796875 -0.6875 -0.796875 -1.515625q0 -1.0 1.015625 -1.859375q1.03125 -0.875 2.84375 -0.875q0.734375 0 1.6875 0.15625l0 -0.375q0 -0.359375 -0.3125 -0.578125q-0.3125 -0.234375 -1.171875 -0.234375q-0.71875 0 -1.84375 0.28125q-0.421875 0.09375 -0.65625 0.09375q-0.328125 0 -0.546875 -0.21875q-0.21875 -0.234375 -0.21875 -0.59375q0 -0.203125 0.078125 -0.34375q0.078125 -0.15625 0.21875 -0.25q0.140625 -0.09375 0.578125 -0.21875q0.59375 -0.15625 1.203125 -0.25q0.625 -0.109375 1.125 -0.109375q1.5 0 2.3125 0.65625q0.828125 0.640625 0.828125 1.75l0 3.296875l0.28125 0q0.578125 0 0.8125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.875 0zm0 -2.875q-0.96875 -0.1875 -1.78125 -0.1875q-0.96875 0 -1.671875 0.484375q-0.4375 0.296875 -0.4375 0.609375q0 0.234375 0.203125 0.375q0.390625 0.25 1.078125 0.25q0.578125 0 1.296875 -0.21875q0.734375 -0.234375 1.3125 -0.625l0 -0.6875zm7.7578125 -2.625l0 3.21875q0 0.515625 0.21875 0.671875q0.328125 0.265625 1.171875 0.265625q1.21875 0 2.265625 -0.53125q0.390625 -0.203125 0.625 -0.203125q0.3125 0 0.53125 0.234375q0.234375 0.234375 0.234375 0.578125q0 0.3125 -0.25 0.53125q-0.375 0.375 -1.515625 0.6875q-1.125 0.3125 -1.890625 0.3125q-1.5 0 -2.25 -0.640625q-0.734375 -0.65625 -0.734375 -1.59375l0 -3.53125l-0.578125 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l0.578125 0l0 -1.453125q0 -0.578125 0.21875 -0.8125q0.21875 -0.25 0.578125 -0.25q0.359375 0 0.578125 0.25q0.21875 0.234375 0.21875 0.8125l0 1.453125l2.96875 0q0.578125 0 0.8125 0.21875q0.25 0.21875 0.25 0.578125q0 0.359375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-2.96875 0zm8.3515625 -4.640625l0 3.421875q0.5 -0.296875 1.0 -0.4375q0.515625 -0.15625 1.046875 -0.15625q0.828125 0 1.46875 0.28125q0.65625 0.28125 1.078125 0.890625q0.421875 0.609375 0.421875 1.53125l0 3.0q0.609375 0 0.796875 0.125q0.375 0.234375 0.375 0.6875q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.828125 0q-0.5625 0 -0.8125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.4375 0.375 -0.671875q0.203125 -0.125 0.796875 -0.125l0 -2.890625q0 -0.625 -0.28125 -0.875q-0.359375 -0.328125 -1.078125 -0.328125q-0.53125 0 -0.953125 0.203125q-0.40625 0.203125 -1.09375 0.890625l0 3.0q0.609375 0 0.796875 0.125q0.375 0.234375 0.375 0.6875q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.828125 0q-0.578125 0 -0.828125 -0.21875q-0.234375 -0.234375 -0.234375 -0.59375q0 -0.4375 0.375 -0.671875q0.1875 -0.125 0.796875 -0.125l0 -6.921875l-0.265625 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l1.875 0z" fill-rule="nonzero"/><path fill="#ffffff" d="m26.64567 99.10499l158.20471 0l0 61.16535l-158.20471 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m26.64567 99.10499l158.20471 0l0 61.16535l-158.20471 0z" fill-rule="evenodd"/><path fill="#000000" d="m47.212875 132.29767l0 1.640625l1.625 0q0.578125 0 0.8125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-3.46875 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l0.25 0l0 -6.2656326l-0.25 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.234375 0.828125 -0.234375l3.6875 0.015625q1.625 0 2.5625 0.890625q0.953125 0.875 0.953125 2.1562576q0 0.703125 -0.3125 1.328125q-0.25 0.46875 -0.8125 0.921875q-0.5625 0.453125 -1.15625 0.6875q-0.59375 0.234375 -1.5625 0.234375l-1.515625 0zm0 -1.609375l1.484375 0q1.046875 0 1.65625 -0.46875q0.625 -0.46875 0.625 -1.140625q0 -0.5625 -0.5 -0.984375q-0.5 -0.42188263 -1.421875 -0.42188263l-1.84375 0l0 3.0156326zm13.9296875 -2.234375l0 5.484375q0.515625 0 0.75 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.25 0.21875 -0.828125 0.21875l-1.515625 0l0 -0.375q-0.6875 0.3125 -1.3125 0.46875q-0.625 0.171875 -1.1875 0.171875q-0.796875 0 -1.375 -0.328125q-0.578125 -0.34375 -0.90625 -0.9375q-0.25 -0.421875 -0.25 -1.046875l0 -3.453125l-0.265625 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l1.875 0l0 4.765625q0 0.5 0.234375 0.75q0.25 0.234375 0.765625 0.234375q0.484375 0 1.03125 -0.1875q0.5625 -0.203125 1.390625 -0.703125l0 -3.265625l-0.578125 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l2.171875 0zm5.8671875 0l0 1.0q1.015625 -0.734375 1.59375 -0.96875q0.578125 -0.25 1.09375 -0.25q0.78125 0 1.515625 0.578125q0.5 0.390625 0.5 0.796875q0 0.34375 -0.25 0.59375q-0.234375 0.234375 -0.5625 0.234375q-0.296875 0 -0.625 -0.296875q-0.328125 -0.296875 -0.59375 -0.296875q-0.328125 0 -1.0 0.421875q-0.671875 0.421875 -1.671875 1.265625l0 2.40625l2.28125 0q0.578125 0 0.828125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.25 0.21875 -0.828125 0.21875l-4.828125 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l0.953125 0l0 -3.890625l-0.578125 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l2.171875 0zm13.9609375 4.359375l-6.578125 0q0.25 0.625 0.890625 1.015625q0.640625 0.375 1.71875 0.375q0.890625 0 2.375 -0.390625q0.609375 -0.15625 0.84375 -0.15625q0.3125 0 0.53125 0.234375q0.21875 0.21875 0.21875 0.5625q0 0.3125 -0.234375 0.53125q-0.3125 0.296875 -1.53125 0.5625q-1.203125 0.265625 -2.3125 0.265625q-1.921875 0 -3.078125 -1.09375q-1.15625 -1.09375 -1.15625 -2.671875q0 -1.6875 1.25 -2.75q1.25 -1.0625 2.875 -1.0625q0.96875 0 1.78125 0.34375q0.828125 0.34375 1.21875 0.75q0.5625 0.578125 0.9375 1.421875q0.25 0.59375 0.25 1.375l0 0.6875zm-1.78125 -1.609375q-0.359375 -0.6875 -0.953125 -1.015625q-0.59375 -0.34375 -1.421875 -0.34375q-0.8125 0 -1.40625 0.34375q-0.59375 0.328125 -0.96875 1.015625l4.75 0zm6.4296875 1.09375l0 1.640625l1.625 0q0.578125 0 0.8125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-3.46875 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l0.25 0l0 -6.2656326l-0.25 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.234375 0.828125 -0.234375l3.6875 0.015625q1.625 0 2.5625 0.890625q0.953125 0.875 0.953125 2.1562576q0 0.703125 -0.3125 1.328125q-0.25 0.46875 -0.8125 0.921875q-0.5625 0.453125 -1.15625 0.6875q-0.59375 0.234375 -1.5625 0.234375l-1.515625 0zm0 -1.609375l1.484375 0q1.046875 0 1.65625 -0.46875q0.625 -0.46875 0.625 -1.140625q0 -0.5625 -0.5 -0.984375q-0.5 -0.42188263 -1.421875 -0.42188263l-1.84375 0l0 3.0156326zm14.6953125 1.4375q0 0.921875 -0.515625 1.796875q-0.515625 0.859375 -1.53125 1.375q-1.0 0.515625 -2.109375 0.515625q-1.09375 0 -2.09375 -0.5q-1.0 -0.515625 -1.53125 -1.375q-0.515625 -0.875 -0.515625 -1.828125q0 -0.953125 0.53125 -1.875q0.53125 -0.9375 1.53125 -1.46875q1.0 -0.53125 2.078125 -0.53125q1.09375 0 2.109375 0.546875q1.015625 0.546875 1.53125 1.46875q0.515625 0.90625 0.515625 1.875zm-1.609375 0.015625q0 -0.78125 -0.546875 -1.421875q-0.765625 -0.875 -2.0 -0.875q-1.078125 0 -1.8125 0.703125q-0.71875 0.6875 -0.71875 1.59375q0 0.75 0.734375 1.40625q0.734375 0.65625 1.796875 0.65625q1.078125 0 1.8125 -0.65625q0.734375 -0.65625 0.734375 -1.40625zm8.7734375 -1.8125q-0.390625 -0.25 -0.828125 -0.359375q-0.421875 -0.125 -0.890625 -0.125q-0.921875 0 -1.46875 0.296875q-0.25 0.140625 -0.25 0.296875q0 0.171875 0.328125 0.34375q0.25 0.125 1.125 0.25q1.59375 0.21875 2.21875 0.4375q0.8125 0.28125 1.25 0.859375q0.453125 0.5625 0.453125 1.203125q0 0.859375 -0.75 1.4375q-1.09375 0.84375 -2.828125 0.84375q-0.6875 0 -1.28125 -0.125q-0.59375 -0.125 -1.078125 -0.359375q-0.125 0.09375 -0.265625 0.15625q-0.125 0.046875 -0.265625 0.046875q-0.375 0 -0.59375 -0.234375q-0.21875 -0.25 -0.21875 -0.828125l0 -0.546875q0 -0.578125 0.21875 -0.8125q0.21875 -0.25 0.578125 -0.25q0.296875 0 0.484375 0.15625q0.203125 0.15625 0.3125 0.546875q0.359375 0.3125 0.875 0.484375q0.515625 0.15625 1.1875 0.15625q1.109375 0 1.71875 -0.34375q0.28125 -0.171875 0.28125 -0.359375q0 -0.3125 -0.40625 -0.515625q-0.421875 -0.203125 -1.71875 -0.34375q-1.921875 -0.203125 -2.578125 -0.78125q-0.640625 -0.578125 -0.640625 -1.40625q0 -0.859375 0.71875 -1.4375q0.984375 -0.78125 2.578125 -0.78125q0.5625 0 1.0625 0.109375q0.515625 0.109375 0.984375 0.328125q0.15625 -0.109375 0.28125 -0.15625q0.125 -0.0625 0.234375 -0.0625q0.328125 0 0.546875 0.25q0.21875 0.234375 0.21875 0.8125l0 0.390625q0 0.53125 -0.125 0.71875q-0.25 0.359375 -0.671875 0.359375q-0.296875 0 -0.515625 -0.171875q-0.21875 -0.1875 -0.28125 -0.484375zm8.4453125 -4.9218826l0 1.703125l-1.90625 0l0 -1.703125l1.90625 0zm0.21875 3.0468826l0 5.484375l1.921875 0q0.578125 0 0.828125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.25 0.21875 -0.828125 0.21875l-5.4375 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l1.921875 0l0 -3.890625l-1.296875 0q-0.5625 0 -0.8125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.234375 -0.578125q0.25 -0.21875 0.828125 -0.21875l2.890625 0zm10.0078125 3.40625l2.4375 2.078125q0.4375 0.03125 0.65625 0.25q0.21875 0.21875 0.21875 0.5625q0 0.34375 -0.25 0.578125q-0.25 0.21875 -0.828125 0.21875l-1.8125 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.28125 0.171875 -0.5q0.1875 -0.21875 0.484375 -0.296875l-1.1875 -1.03125l-1.21875 1.03125q0.359375 0.09375 0.515625 0.296875q0.171875 0.1875 0.171875 0.5q0 0.359375 -0.25 0.59375q-0.234375 0.21875 -0.8125 0.21875l-1.8125 0q-0.578125 0 -0.828125 -0.21875q-0.234375 -0.234375 -0.234375 -0.59375q0 -0.328125 0.21875 -0.546875q0.21875 -0.21875 0.65625 -0.25l2.375 -2.09375l-2.109375 -1.796875q-0.40625 -0.03125 -0.625 -0.25q-0.21875 -0.21875 -0.21875 -0.546875q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l1.5 0q0.578125 0 0.8125 0.21875q0.25 0.21875 0.25 0.5625q0 0.46875 -0.4375 0.75l0.96875 0.8125l0.953125 -0.828125q-0.421875 -0.296875 -0.421875 -0.703125q0 -0.375 0.234375 -0.59375q0.25 -0.21875 0.828125 -0.21875l1.484375 0q0.578125 0 0.828125 0.21875q0.25 0.21875 0.25 0.578125q0 0.328125 -0.21875 0.546875q-0.21875 0.21875 -0.640625 0.25l-2.109375 1.8125zm7.4765625 0.4375l0 1.640625l1.625 0q0.578125 0 0.8125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-3.46875 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l0.25 0l0 -6.2656326l-0.25 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.234375 0.828125 -0.234375l3.6875 0.015625q1.625 0 2.5625 0.890625q0.953125 0.875 0.953125 2.1562576q0 0.703125 -0.3125 1.328125q-0.25 0.46875 -0.8125 0.921875q-0.5625 0.453125 -1.15625 0.6875q-0.59375 0.234375 -1.5625 0.234375l-1.515625 0zm0 -1.609375l1.484375 0q1.046875 0 1.65625 -0.46875q0.625 -0.46875 0.625 -1.140625q0 -0.5625 -0.5 -0.984375q-0.5 -0.42188263 -1.421875 -0.42188263l-1.84375 0l0 3.0156326zm11.9765625 4.859375l0 -0.375q-0.609375 0.3125 -1.34375 0.46875q-0.71875 0.171875 -1.3125 0.171875q-1.28125 0 -2.09375 -0.6875q-0.796875 -0.6875 -0.796875 -1.515625q0 -1.0 1.015625 -1.859375q1.03125 -0.875 2.84375 -0.875q0.734375 0 1.6875 0.15625l0 -0.375q0 -0.359375 -0.3125 -0.578125q-0.3125 -0.234375 -1.171875 -0.234375q-0.71875 0 -1.84375 0.28125q-0.421875 0.09375 -0.65625 0.09375q-0.328125 0 -0.546875 -0.21875q-0.21875 -0.234375 -0.21875 -0.59375q0 -0.203125 0.078125 -0.34375q0.078125 -0.15625 0.21875 -0.25q0.140625 -0.09375 0.578125 -0.21875q0.59375 -0.15625 1.203125 -0.25q0.625 -0.109375 1.125 -0.109375q1.5 0 2.3125 0.65625q0.828125 0.640625 0.828125 1.75l0 3.296875l0.28125 0q0.578125 0 0.8125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.875 0zm0 -2.875q-0.96875 -0.1875 -1.78125 -0.1875q-0.96875 0 -1.671875 0.484375q-0.4375 0.296875 -0.4375 0.609375q0 0.234375 0.203125 0.375q0.390625 0.25 1.078125 0.25q0.578125 0 1.296875 -0.21875q0.734375 -0.234375 1.3125 -0.625l0 -0.6875zm7.7578125 -2.625l0 3.21875q0 0.515625 0.21875 0.671875q0.328125 0.265625 1.171875 0.265625q1.21875 0 2.265625 -0.53125q0.390625 -0.203125 0.625 -0.203125q0.3125 0 0.53125 0.234375q0.234375 0.234375 0.234375 0.578125q0 0.3125 -0.25 0.53125q-0.375 0.375 -1.515625 0.6875q-1.125 0.3125 -1.890625 0.3125q-1.5 0 -2.25 -0.640625q-0.734375 -0.65625 -0.734375 -1.59375l0 -3.53125l-0.578125 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l0.578125 0l0 -1.4531326q0 -0.578125 0.21875 -0.8125q0.21875 -0.25 0.578125 -0.25q0.359375 0 0.578125 0.25q0.21875 0.234375 0.21875 0.8125l0 1.4531326l2.96875 0q0.578125 0 0.8125 0.21875q0.25 0.21875 0.25 0.578125q0 0.359375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-2.96875 0zm8.3515625 -4.6406326l0 3.4218826q0.5 -0.296875 1.0 -0.4375q0.515625 -0.15625 1.046875 -0.15625q0.828125 0 1.46875 0.28125q0.65625 0.28125 1.078125 0.890625q0.421875 0.609375 0.421875 1.53125l0 3.0q0.609375 0 0.796875 0.125q0.375 0.234375 0.375 0.6875q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.828125 0q-0.5625 0 -0.8125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.4375 0.375 -0.671875q0.203125 -0.125 0.796875 -0.125l0 -2.890625q0 -0.625 -0.28125 -0.875q-0.359375 -0.328125 -1.078125 -0.328125q-0.53125 0 -0.953125 0.203125q-0.40625 0.203125 -1.09375 0.890625l0 3.0q0.609375 0 0.796875 0.125q0.375 0.234375 0.375 0.6875q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.828125 0q-0.578125 0 -0.828125 -0.21875q-0.234375 -0.234375 -0.234375 -0.59375q0 -0.4375 0.375 -0.671875q0.1875 -0.125 0.796875 -0.125l0 -6.9218826l-0.265625 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l1.875 0z" fill-rule="nonzero"/><path fill="#ffffff" d="m336.0 99.10499l174.04724 0l0 61.16535l-174.04724 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m336.0 99.10499l174.04724 0l0 61.16535l-174.04724 0z" fill-rule="evenodd"/><path fill="#000000" d="m354.8869 132.29767l0 1.640625l1.625 0q0.578125 0 0.8125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-3.46875 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l0.25 0l0 -6.2656326l-0.25 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.234375 0.828125 -0.234375l3.6875 0.015625q1.625 0 2.5625 0.890625q0.953125 0.875 0.953125 2.1562576q0 0.703125 -0.3125 1.328125q-0.25 0.46875 -0.8125 0.921875q-0.5625 0.453125 -1.15625 0.6875q-0.59375 0.234375 -1.5625 0.234375l-1.515625 0zm0 -1.609375l1.484375 0q1.046875 0 1.65625 -0.46875q0.625 -0.46875 0.625 -1.140625q0 -0.5625 -0.5 -0.984375q-0.5 -0.42188263 -1.421875 -0.42188263l-1.84375 0l0 3.0156326zm13.9296875 -2.234375l0 5.484375q0.515625 0 0.75 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.25 0.21875 -0.828125 0.21875l-1.515625 0l0 -0.375q-0.6875 0.3125 -1.3125 0.46875q-0.625 0.171875 -1.1875 0.171875q-0.796875 0 -1.375 -0.328125q-0.578125 -0.34375 -0.90625 -0.9375q-0.25 -0.421875 -0.25 -1.046875l0 -3.453125l-0.265625 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l1.875 0l0 4.765625q0 0.5 0.234375 0.75q0.25 0.234375 0.765625 0.234375q0.484375 0 1.03125 -0.1875q0.5625 -0.203125 1.390625 -0.703125l0 -3.265625l-0.578125 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l2.171875 0zm5.8671875 0l0 1.0q1.015625 -0.734375 1.59375 -0.96875q0.578125 -0.25 1.09375 -0.25q0.78125 0 1.515625 0.578125q0.5 0.390625 0.5 0.796875q0 0.34375 -0.25 0.59375q-0.234375 0.234375 -0.5625 0.234375q-0.296875 0 -0.625 -0.296875q-0.328125 -0.296875 -0.59375 -0.296875q-0.328125 0 -1.0 0.421875q-0.671875 0.421875 -1.671875 1.265625l0 2.40625l2.28125 0q0.578125 0 0.828125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.25 0.21875 -0.828125 0.21875l-4.828125 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l0.953125 0l0 -3.890625l-0.578125 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l2.171875 0zm13.9609375 4.359375l-6.578125 0q0.25 0.625 0.890625 1.015625q0.640625 0.375 1.71875 0.375q0.890625 0 2.375 -0.390625q0.609375 -0.15625 0.84375 -0.15625q0.3125 0 0.53125 0.234375q0.21875 0.21875 0.21875 0.5625q0 0.3125 -0.234375 0.53125q-0.3125 0.296875 -1.53125 0.5625q-1.203125 0.265625 -2.3125 0.265625q-1.921875 0 -3.078125 -1.09375q-1.15625 -1.09375 -1.15625 -2.671875q0 -1.6875 1.25 -2.75q1.25 -1.0625 2.875 -1.0625q0.96875 0 1.78125 0.34375q0.828125 0.34375 1.21875 0.75q0.5625 0.578125 0.9375 1.421875q0.25 0.59375 0.25 1.375l0 0.6875zm-1.78125 -1.609375q-0.359375 -0.6875 -0.953125 -1.015625q-0.59375 -0.34375 -1.421875 -0.34375q-0.8125 0 -1.40625 0.34375q-0.59375 0.328125 -0.96875 1.015625l4.75 0zm7.3671875 -0.203125l-1.484375 4.546875l-1.796875 0l-0.953125 -7.8750076q-0.375 -0.046875 -0.5625 -0.25q-0.1875 -0.203125 -0.1875 -0.53125q0 -0.375 0.25 -0.59375q0.25 -0.234375 0.828125 -0.234375l2.125 0.015625q0.578125 0 0.828125 0.21875q0.25 0.21875 0.25 0.578125q0 0.359375 -0.25 0.578125q-0.25 0.21875 -0.828125 0.21875l-0.828125 0l0.53125 4.4843826l1.25 -3.734375l1.671875 0l1.25 3.734375l0.53125 -4.4843826l-0.84375 0q-0.578125 0 -0.828125 -0.21875q-0.234375 -0.21875 -0.234375 -0.578125q0 -0.359375 0.234375 -0.578125q0.25 -0.234375 0.828125 -0.234375l2.125 0.015625q0.578125 0 0.828125 0.21875q0.25 0.21875 0.25 0.578125q0 0.296875 -0.203125 0.515625q-0.1875 0.21875 -0.5625 0.28125l-0.921875 7.8750076l-1.765625 0l-1.53125 -4.546875zm10.1640625 -5.5937576l0 1.703125l-1.90625 0l0 -1.703125l1.90625 0zm0.21875 3.0468826l0 5.484375l1.921875 0q0.578125 0 0.828125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.25 0.21875 -0.828125 0.21875l-5.4375 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l1.921875 0l0 -3.890625l-1.296875 0q-0.5625 0 -0.8125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.234375 -0.578125q0.25 -0.21875 0.828125 -0.21875l2.890625 0zm7.1953125 0l0 0.53125q0.4375 -0.375 0.953125 -0.5625q0.53125 -0.1875 1.15625 -0.1875q1.421875 0 2.25 0.890625q0.65625 0.703125 0.65625 1.84375l0 2.96875q0.5 0 0.734375 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.453125 0q-0.578125 0 -0.828125 -0.21875q-0.234375 -0.234375 -0.234375 -0.59375q0 -0.34375 0.234375 -0.5625q0.25 -0.234375 0.75 -0.234375l0 -3.015625q0 -0.53125 -0.28125 -0.765625q-0.359375 -0.3125 -1.09375 -0.3125q-0.5625 0 -0.984375 0.21875q-0.40625 0.203125 -1.046875 0.90625l0 2.96875q0.609375 0 0.796875 0.125q0.375 0.234375 0.375 0.6875q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.828125 0q-0.578125 0 -0.828125 -0.21875q-0.234375 -0.234375 -0.234375 -0.59375q0 -0.4375 0.375 -0.671875q0.1875 -0.125 0.796875 -0.125l0 -3.890625q-0.5 0 -0.75 -0.21875q-0.234375 -0.234375 -0.234375 -0.578125q0 -0.359375 0.234375 -0.578125q0.25 -0.21875 0.828125 -0.21875l1.53125 0zm14.8984375 -3.0468826l0 8.531258l0.265625 0q0.578125 0 0.828125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.25 0.21875 -0.828125 0.21875l-1.875 0l0 -0.390625q-0.546875 0.3125 -1.140625 0.484375q-0.59375 0.171875 -1.234375 0.171875q-1.8125 0 -2.921875 -1.046875q-1.09375 -1.046875 -1.09375 -2.609375q0 -1.625 1.15625 -2.765625q1.15625 -1.15625 2.828125 -1.15625q0.625 0 1.21875 0.203125q0.609375 0.1875 1.1875 0.5625l0 -1.9843826l-0.265625 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.234375 0.828125 -0.234375l1.875 0zm-1.609375 6.7968826q0 -0.984375 -0.703125 -1.671875q-0.6875 -0.6875 -1.6875 -0.6875q-1.0 0 -1.703125 0.6875q-0.6875 0.6875 -0.6875 1.65625q0 0.875 0.625 1.453125q0.625 0.5625 1.765625 0.5625q1.125 0 1.75 -0.5625q0.640625 -0.578125 0.640625 -1.4375zm11.6953125 -0.078125q0 0.921875 -0.515625 1.796875q-0.515625 0.859375 -1.53125 1.375q-1.0 0.515625 -2.109375 0.515625q-1.09375 0 -2.09375 -0.5q-1.0 -0.515625 -1.53125 -1.375q-0.515625 -0.875 -0.515625 -1.828125q0 -0.953125 0.53125 -1.875q0.53125 -0.9375 1.53125 -1.46875q1.0 -0.53125 2.078125 -0.53125q1.09375 0 2.109375 0.546875q1.015625 0.546875 1.53125 1.46875q0.515625 0.90625 0.515625 1.875zm-1.609375 0.015625q0 -0.78125 -0.546875 -1.421875q-0.765625 -0.875 -2.0 -0.875q-1.078125 0 -1.8125 0.703125q-0.71875 0.6875 -0.71875 1.59375q0 0.75 0.734375 1.40625q0.734375 0.65625 1.796875 0.65625q1.078125 0 1.8125 -0.65625q0.734375 -0.65625 0.734375 -1.40625zm7.0546875 0.453125l-1.109375 2.953125l-1.5 0l-1.34375 -5.5q-0.4375 -0.015625 -0.671875 -0.234375q-0.21875 -0.234375 -0.21875 -0.5625q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l1.484375 0q0.578125 0 0.828125 0.21875q0.25 0.21875 0.25 0.578125q0 0.359375 -0.28125 0.609375q-0.21875 0.1875 -0.828125 0.1875l0.609375 2.546875l0.984375 -2.609375l1.421875 0l1.0 2.609375l0.625 -2.546875q-0.59375 0 -0.78125 -0.109375q-0.375 -0.25 -0.375 -0.6875q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l1.5 0q0.578125 0 0.828125 0.21875q0.25 0.21875 0.25 0.578125q0 0.328125 -0.21875 0.546875q-0.21875 0.21875 -0.640625 0.25l-1.3125 5.5l-1.484375 0l-1.171875 -2.953125zm11.3203125 -2.265625q-0.390625 -0.25 -0.828125 -0.359375q-0.421875 -0.125 -0.890625 -0.125q-0.921875 0 -1.46875 0.296875q-0.25 0.140625 -0.25 0.296875q0 0.171875 0.328125 0.34375q0.25 0.125 1.125 0.25q1.59375 0.21875 2.21875 0.4375q0.8125 0.28125 1.25 0.859375q0.453125 0.5625 0.453125 1.203125q0 0.859375 -0.75 1.4375q-1.09375 0.84375 -2.828125 0.84375q-0.6875 0 -1.28125 -0.125q-0.59375 -0.125 -1.078125 -0.359375q-0.125 0.09375 -0.265625 0.15625q-0.125 0.046875 -0.265625 0.046875q-0.375 0 -0.59375 -0.234375q-0.21875 -0.25 -0.21875 -0.828125l0 -0.546875q0 -0.578125 0.21875 -0.8125q0.21875 -0.25 0.578125 -0.25q0.296875 0 0.484375 0.15625q0.203125 0.15625 0.3125 0.546875q0.359375 0.3125 0.875 0.484375q0.515625 0.15625 1.1875 0.15625q1.109375 0 1.71875 -0.34375q0.28125 -0.171875 0.28125 -0.359375q0 -0.3125 -0.40625 -0.515625q-0.421875 -0.203125 -1.71875 -0.34375q-1.921875 -0.203125 -2.578125 -0.78125q-0.640625 -0.578125 -0.640625 -1.40625q0 -0.859375 0.71875 -1.4375q0.984375 -0.78125 2.578125 -0.78125q0.5625 0 1.0625 0.109375q0.515625 0.109375 0.984375 0.328125q0.15625 -0.109375 0.28125 -0.15625q0.125 -0.0625 0.234375 -0.0625q0.328125 0 0.546875 0.25q0.21875 0.234375 0.21875 0.8125l0 0.390625q0 0.53125 -0.125 0.71875q-0.25 0.359375 -0.671875 0.359375q-0.296875 0 -0.515625 -0.171875q-0.21875 -0.1875 -0.28125 -0.484375zm6.9453125 1.96875l0 1.640625l1.625 0q0.578125 0 0.8125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-3.46875 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l0.25 0l0 -6.2656326l-0.25 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.234375 0.828125 -0.234375l3.6875 0.015625q1.625 0 2.5625 0.890625q0.953125 0.875 0.953125 2.1562576q0 0.703125 -0.3125 1.328125q-0.25 0.46875 -0.8125 0.921875q-0.5625 0.453125 -1.15625 0.6875q-0.59375 0.234375 -1.5625 0.234375l-1.515625 0zm0 -1.609375l1.484375 0q1.046875 0 1.65625 -0.46875q0.625 -0.46875 0.625 -1.140625q0 -0.5625 -0.5 -0.984375q-0.5 -0.42188263 -1.421875 -0.42188263l-1.84375 0l0 3.0156326zm11.9765625 4.859375l0 -0.375q-0.609375 0.3125 -1.34375 0.46875q-0.71875 0.171875 -1.3125 0.171875q-1.28125 0 -2.09375 -0.6875q-0.796875 -0.6875 -0.796875 -1.515625q0 -1.0 1.015625 -1.859375q1.03125 -0.875 2.84375 -0.875q0.734375 0 1.6875 0.15625l0 -0.375q0 -0.359375 -0.3125 -0.578125q-0.3125 -0.234375 -1.171875 -0.234375q-0.71875 0 -1.84375 0.28125q-0.421875 0.09375 -0.65625 0.09375q-0.328125 0 -0.546875 -0.21875q-0.21875 -0.234375 -0.21875 -0.59375q0 -0.203125 0.078125 -0.34375q0.078125 -0.15625 0.21875 -0.25q0.140625 -0.09375 0.578125 -0.21875q0.59375 -0.15625 1.203125 -0.25q0.625 -0.109375 1.125 -0.109375q1.5 0 2.3125 0.65625q0.828125 0.640625 0.828125 1.75l0 3.296875l0.28125 0q0.578125 0 0.8125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.875 0zm0 -2.875q-0.96875 -0.1875 -1.78125 -0.1875q-0.96875 0 -1.671875 0.484375q-0.4375 0.296875 -0.4375 0.609375q0 0.234375 0.203125 0.375q0.390625 0.25 1.078125 0.25q0.578125 0 1.296875 -0.21875q0.734375 -0.234375 1.3125 -0.625l0 -0.6875zm7.7578125 -2.625l0 3.21875q0 0.515625 0.21875 0.671875q0.328125 0.265625 1.171875 0.265625q1.21875 0 2.265625 -0.53125q0.390625 -0.203125 0.625 -0.203125q0.3125 0 0.53125 0.234375q0.234375 0.234375 0.234375 0.578125q0 0.3125 -0.25 0.53125q-0.375 0.375 -1.515625 0.6875q-1.125 0.3125 -1.890625 0.3125q-1.5 0 -2.25 -0.640625q-0.734375 -0.65625 -0.734375 -1.59375l0 -3.53125l-0.578125 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l0.578125 0l0 -1.4531326q0 -0.578125 0.21875 -0.8125q0.21875 -0.25 0.578125 -0.25q0.359375 0 0.578125 0.25q0.21875 0.234375 0.21875 0.8125l0 1.4531326l2.96875 0q0.578125 0 0.8125 0.21875q0.25 0.21875 0.25 0.578125q0 0.359375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-2.96875 0zm8.3515625 -4.6406326l0 3.4218826q0.5 -0.296875 1.0 -0.4375q0.515625 -0.15625 1.046875 -0.15625q0.828125 0 1.46875 0.28125q0.65625 0.28125 1.078125 0.890625q0.421875 0.609375 0.421875 1.53125l0 3.0q0.609375 0 0.796875 0.125q0.375 0.234375 0.375 0.6875q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.828125 0q-0.5625 0 -0.8125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.4375 0.375 -0.671875q0.203125 -0.125 0.796875 -0.125l0 -2.890625q0 -0.625 -0.28125 -0.875q-0.359375 -0.328125 -1.078125 -0.328125q-0.53125 0 -0.953125 0.203125q-0.40625 0.203125 -1.09375 0.890625l0 3.0q0.609375 0 0.796875 0.125q0.375 0.234375 0.375 0.6875q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.828125 0q-0.578125 0 -0.828125 -0.21875q-0.234375 -0.234375 -0.234375 -0.59375q0 -0.4375 0.375 -0.671875q0.1875 -0.125 0.796875 -0.125l0 -6.9218826l-0.265625 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l1.875 0z" fill-rule="nonzero"/><path fill="#ffffff" d="m203.43307 160.27034l113.98425 0l0 61.16536l-113.98425 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m203.43307 160.27034l113.98425 0l0 61.16536l-113.98425 0z" fill-rule="evenodd"/><path fill="#000000" d="m245.09708 193.46301l0 1.640625l1.625 0q0.578125 0 0.8125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-3.46875 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l0.25 0l0 -6.265625l-0.25 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.234375 0.828125 -0.234375l3.6875 0.015625q1.625 0 2.5625 0.890625q0.953125 0.875 0.953125 2.15625q0 0.703125 -0.3125 1.328125q-0.25 0.46875 -0.8125 0.921875q-0.5625 0.453125 -1.15625 0.6875q-0.59375 0.234375 -1.5625 0.234375l-1.515625 0zm0 -1.609375l1.484375 0q1.046875 0 1.65625 -0.46875q0.625 -0.46875 0.625 -1.140625q0 -0.5625 -0.5 -0.984375q-0.5 -0.421875 -1.421875 -0.421875l-1.84375 0l0 3.015625zm11.9765625 4.859375l0 -0.375q-0.609375 0.3125 -1.34375 0.46875q-0.71875 0.171875 -1.3125 0.171875q-1.28125 0 -2.09375 -0.6875q-0.796875 -0.6875 -0.796875 -1.515625q0 -1.0 1.015625 -1.859375q1.03125 -0.875 2.84375 -0.875q0.734375 0 1.6875 0.15625l0 -0.375q0 -0.359375 -0.3125 -0.578125q-0.3125 -0.234375 -1.171875 -0.234375q-0.71875 0 -1.84375 0.28125q-0.421875 0.09375 -0.65625 0.09375q-0.328125 0 -0.546875 -0.21875q-0.21875 -0.234375 -0.21875 -0.59375q0 -0.203125 0.078125 -0.34375q0.078125 -0.15625 0.21875 -0.25q0.140625 -0.09375 0.578125 -0.21875q0.59375 -0.15625 1.203125 -0.25q0.625 -0.109375 1.125 -0.109375q1.5 0 2.3125 0.65625q0.828125 0.640625 0.828125 1.75l0 3.296875l0.28125 0q0.578125 0 0.8125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.875 0zm0 -2.875q-0.96875 -0.1875 -1.78125 -0.1875q-0.96875 0 -1.671875 0.484375q-0.4375 0.296875 -0.4375 0.609375q0 0.234375 0.203125 0.375q0.390625 0.25 1.078125 0.25q0.578125 0 1.296875 -0.21875q0.734375 -0.234375 1.3125 -0.625l0 -0.6875zm7.7578125 -2.625l0 3.21875q0 0.515625 0.21875 0.671875q0.328125 0.265625 1.171875 0.265625q1.21875 0 2.265625 -0.53125q0.390625 -0.203125 0.625 -0.203125q0.3125 0 0.53125 0.234375q0.234375 0.234375 0.234375 0.578125q0 0.3125 -0.25 0.53125q-0.375 0.375 -1.515625 0.6875q-1.125 0.3125 -1.890625 0.3125q-1.5 0 -2.25 -0.640625q-0.734375 -0.65625 -0.734375 -1.59375l0 -3.53125l-0.578125 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l0.578125 0l0 -1.453125q0 -0.578125 0.21875 -0.8125q0.21875 -0.25 0.578125 -0.25q0.359375 0 0.578125 0.25q0.21875 0.234375 0.21875 0.8125l0 1.453125l2.96875 0q0.578125 0 0.8125 0.21875q0.25 0.21875 0.25 0.578125q0 0.359375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-2.96875 0zm8.3515625 -4.640625l0 3.421875q0.5 -0.296875 1.0 -0.4375q0.515625 -0.15625 1.046875 -0.15625q0.828125 0 1.46875 0.28125q0.65625 0.28125 1.078125 0.890625q0.421875 0.609375 0.421875 1.53125l0 3.0q0.609375 0 0.796875 0.125q0.375 0.234375 0.375 0.6875q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.828125 0q-0.5625 0 -0.8125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.4375 0.375 -0.671875q0.203125 -0.125 0.796875 -0.125l0 -2.890625q0 -0.625 -0.28125 -0.875q-0.359375 -0.328125 -1.078125 -0.328125q-0.53125 0 -0.953125 0.203125q-0.40625 0.203125 -1.09375 0.890625l0 3.0q0.609375 0 0.796875 0.125q0.375 0.234375 0.375 0.6875q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.828125 0q-0.578125 0 -0.828125 -0.21875q-0.234375 -0.234375 -0.234375 -0.59375q0 -0.4375 0.375 -0.671875q0.1875 -0.125 0.796875 -0.125l0 -6.921875l-0.265625 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l1.875 0z" fill-rule="nonzero"/><path fill="#ffffff" d="m26.64567 221.4357l158.20471 0l0 61.165344l-158.20471 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m26.64567 221.4357l158.20471 0l0 61.165344l-158.20471 0z" fill-rule="evenodd"/><path fill="#000000" d="m66.416 254.62837l0 1.6406097l1.625 0q0.578125 0 0.8125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-3.46875 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l0.25 0l0 -6.2656097l-0.25 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.234375 0.828125 -0.234375l3.6875 0.015625q1.625 0 2.5625 0.890625q0.953125 0.875 0.953125 2.15625q0 0.703125 -0.3125 1.328125q-0.25 0.46875 -0.8125 0.921875q-0.5625 0.453125 -1.15625 0.6875q-0.59375 0.234375 -1.5625 0.234375l-1.515625 0zm0 -1.609375l1.484375 0q1.046875 0 1.65625 -0.46875q0.625 -0.46875 0.625 -1.140625q0 -0.5625 -0.5 -0.984375q-0.5 -0.421875 -1.421875 -0.421875l-1.84375 0l0 3.015625zm14.6953125 1.4375q0 0.921875 -0.515625 1.7968597q-0.515625 0.859375 -1.53125 1.375q-1.0 0.515625 -2.109375 0.515625q-1.09375 0 -2.09375 -0.5q-1.0 -0.515625 -1.53125 -1.375q-0.515625 -0.87498474 -0.515625 -1.8281097q0 -0.953125 0.53125 -1.875q0.53125 -0.9375 1.53125 -1.46875q1.0 -0.53125 2.078125 -0.53125q1.09375 0 2.109375 0.546875q1.015625 0.546875 1.53125 1.46875q0.515625 0.90625 0.515625 1.875zm-1.609375 0.015625q0 -0.78125 -0.546875 -1.421875q-0.765625 -0.875 -2.0 -0.875q-1.078125 0 -1.8125 0.703125q-0.71875 0.6875 -0.71875 1.59375q0 0.75 0.734375 1.40625q0.734375 0.65623474 1.796875 0.65623474q1.078125 0 1.8125 -0.65623474q0.734375 -0.65625 0.734375 -1.40625zm8.7734375 -1.8125q-0.390625 -0.25 -0.828125 -0.359375q-0.421875 -0.125 -0.890625 -0.125q-0.921875 0 -1.46875 0.296875q-0.25 0.140625 -0.25 0.296875q0 0.171875 0.328125 0.34375q0.25 0.125 1.125 0.25q1.59375 0.21875 2.21875 0.4375q0.8125 0.28125 1.25 0.859375q0.453125 0.5625 0.453125 1.203125q0 0.85935974 -0.75 1.4374847q-1.09375 0.84375 -2.828125 0.84375q-0.6875 0 -1.28125 -0.125q-0.59375 -0.125 -1.078125 -0.359375q-0.125 0.09375 -0.265625 0.15625q-0.125 0.046875 -0.265625 0.046875q-0.375 0 -0.59375 -0.234375q-0.21875 -0.25 -0.21875 -0.828125l0 -0.546875q0 -0.57810974 0.21875 -0.81248474q0.21875 -0.25 0.578125 -0.25q0.296875 0 0.484375 0.15625q0.203125 0.15625 0.3125 0.546875q0.359375 0.31248474 0.875 0.48435974q0.515625 0.15625 1.1875 0.15625q1.109375 0 1.71875 -0.34375q0.28125 -0.171875 0.28125 -0.35935974q0 -0.3125 -0.40625 -0.515625q-0.421875 -0.203125 -1.71875 -0.34375q-1.921875 -0.203125 -2.578125 -0.78125q-0.640625 -0.578125 -0.640625 -1.40625q0 -0.859375 0.71875 -1.4375q0.984375 -0.78125 2.578125 -0.78125q0.5625 0 1.0625 0.109375q0.515625 0.109375 0.984375 0.328125q0.15625 -0.109375 0.28125 -0.15625q0.125 -0.0625 0.234375 -0.0625q0.328125 0 0.546875 0.25q0.21875 0.234375 0.21875 0.8125l0 0.390625q0 0.53125 -0.125 0.71875q-0.25 0.359375 -0.671875 0.359375q-0.296875 0 -0.515625 -0.171875q-0.21875 -0.1875 -0.28125 -0.484375zm8.4453125 -4.921875l0 1.703125l-1.90625 0l0 -1.703125l1.90625 0zm0.21875 3.046875l0 5.4843597l1.921875 0q0.578125 0 0.828125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.25 0.21875 -0.828125 0.21875l-5.4375 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l1.921875 0l0 -3.8906097l-1.296875 0q-0.5625 0 -0.8125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.234375 -0.578125q0.25 -0.21875 0.828125 -0.21875l2.890625 0zm10.0078125 3.40625l2.4375 2.0781097q0.4375 0.03125 0.65625 0.25q0.21875 0.21875 0.21875 0.5625q0 0.34375 -0.25 0.578125q-0.25 0.21875 -0.828125 0.21875l-1.8125 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.28125 0.171875 -0.5q0.1875 -0.21875 0.484375 -0.296875l-1.1875 -1.0312347l-1.21875 1.0312347q0.359375 0.09375 0.515625 0.296875q0.171875 0.1875 0.171875 0.5q0 0.359375 -0.25 0.59375q-0.234375 0.21875 -0.8125 0.21875l-1.8125 0q-0.578125 0 -0.828125 -0.21875q-0.234375 -0.234375 -0.234375 -0.59375q0 -0.328125 0.21875 -0.546875q0.21875 -0.21875 0.65625 -0.25l2.375 -2.0937347l-2.109375 -1.796875q-0.40625 -0.03125 -0.625 -0.25q-0.21875 -0.21875 -0.21875 -0.546875q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l1.5 0q0.578125 0 0.8125 0.21875q0.25 0.21875 0.25 0.5625q0 0.46875 -0.4375 0.75l0.96875 0.8125l0.953125 -0.828125q-0.421875 -0.296875 -0.421875 -0.703125q0 -0.375 0.234375 -0.59375q0.25 -0.21875 0.828125 -0.21875l1.484375 0q0.578125 0 0.828125 0.21875q0.25 0.21875 0.25 0.578125q0 0.328125 -0.21875 0.546875q-0.21875 0.21875 -0.640625 0.25l-2.109375 1.8125zm7.4765625 0.4375l0 1.6406097l1.625 0q0.578125 0 0.8125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-3.46875 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l0.25 0l0 -6.2656097l-0.25 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.234375 0.828125 -0.234375l3.6875 0.015625q1.625 0 2.5625 0.890625q0.953125 0.875 0.953125 2.15625q0 0.703125 -0.3125 1.328125q-0.25 0.46875 -0.8125 0.921875q-0.5625 0.453125 -1.15625 0.6875q-0.59375 0.234375 -1.5625 0.234375l-1.515625 0zm0 -1.609375l1.484375 0q1.046875 0 1.65625 -0.46875q0.625 -0.46875 0.625 -1.140625q0 -0.5625 -0.5 -0.984375q-0.5 -0.421875 -1.421875 -0.421875l-1.84375 0l0 3.015625zm11.9765625 4.8593597l0 -0.375q-0.609375 0.3125 -1.34375 0.46875q-0.71875 0.171875 -1.3125 0.171875q-1.28125 0 -2.09375 -0.6875q-0.796875 -0.6875 -0.796875 -1.5156097q0 -1.0 1.015625 -1.859375q1.03125 -0.875 2.84375 -0.875q0.734375 0 1.6875 0.15625l0 -0.375q0 -0.359375 -0.3125 -0.578125q-0.3125 -0.234375 -1.171875 -0.234375q-0.71875 0 -1.84375 0.28125q-0.421875 0.09375 -0.65625 0.09375q-0.328125 0 -0.546875 -0.21875q-0.21875 -0.234375 -0.21875 -0.59375q0 -0.203125 0.078125 -0.34375q0.078125 -0.15625 0.21875 -0.25q0.140625 -0.09375 0.578125 -0.21875q0.59375 -0.15625 1.203125 -0.25q0.625 -0.109375 1.125 -0.109375q1.5 0 2.3125 0.65625q0.828125 0.640625 0.828125 1.75l0 3.2968597l0.28125 0q0.578125 0 0.8125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.875 0zm0 -2.8749847q-0.96875 -0.1875 -1.78125 -0.1875q-0.96875 0 -1.671875 0.484375q-0.4375 0.296875 -0.4375 0.609375q0 0.23435974 0.203125 0.37498474q0.390625 0.25 1.078125 0.25q0.578125 0 1.296875 -0.21875q0.734375 -0.234375 1.3125 -0.62498474l0 -0.6875zm7.7578125 -2.625l0 3.21875q0 0.51560974 0.21875 0.67185974q0.328125 0.265625 1.171875 0.265625q1.21875 0 2.265625 -0.53125q0.390625 -0.20310974 0.625 -0.20310974q0.3125 0 0.53125 0.23435974q0.234375 0.234375 0.234375 0.578125q0 0.3125 -0.25 0.53125q-0.375 0.375 -1.515625 0.6875q-1.125 0.3125 -1.890625 0.3125q-1.5 0 -2.25 -0.640625q-0.734375 -0.65625 -0.734375 -1.5937347l0 -3.53125l-0.578125 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l0.578125 0l0 -1.453125q0 -0.578125 0.21875 -0.8125q0.21875 -0.25 0.578125 -0.25q0.359375 0 0.578125 0.25q0.21875 0.234375 0.21875 0.8125l0 1.453125l2.96875 0q0.578125 0 0.8125 0.21875q0.25 0.21875 0.25 0.578125q0 0.359375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-2.96875 0zm8.3515625 -4.640625l0 3.421875q0.5 -0.296875 1.0 -0.4375q0.515625 -0.15625 1.046875 -0.15625q0.828125 0 1.46875 0.28125q0.65625 0.28125 1.078125 0.890625q0.421875 0.609375 0.421875 1.53125l0 2.9999847q0.609375 0 0.796875 0.125q0.375 0.234375 0.375 0.6875q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.828125 0q-0.5625 0 -0.8125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.4375 0.375 -0.671875q0.203125 -0.125 0.796875 -0.125l0 -2.8906097q0 -0.625 -0.28125 -0.875q-0.359375 -0.328125 -1.078125 -0.328125q-0.53125 0 -0.953125 0.203125q-0.40625 0.203125 -1.09375 0.890625l0 2.9999847q0.609375 0 0.796875 0.125q0.375 0.234375 0.375 0.6875q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.828125 0q-0.578125 0 -0.828125 -0.21875q-0.234375 -0.234375 -0.234375 -0.59375q0 -0.4375 0.375 -0.671875q0.1875 -0.125 0.796875 -0.125l0 -6.9218597l-0.265625 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l1.875 0z" fill-rule="nonzero"/><path fill="#ffffff" d="m336.0 221.4357l174.04724 0l0 61.165344l-174.04724 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m336.0 221.4357l174.04724 0l0 61.165344l-174.04724 0z" fill-rule="evenodd"/><path fill="#000000" d="m375.02753 253.3315l-1.484375 4.5468597l-1.796875 0l-0.953125 -7.8749847q-0.375 -0.046875 -0.5625 -0.25q-0.1875 -0.203125 -0.1875 -0.53125q0 -0.375 0.25 -0.59375q0.25 -0.234375 0.828125 -0.234375l2.125 0.015625q0.578125 0 0.828125 0.21875q0.25 0.21875 0.25 0.578125q0 0.359375 -0.25 0.578125q-0.25 0.21875 -0.828125 0.21875l-0.828125 0l0.53125 4.484375l1.25 -3.734375l1.671875 0l1.25 3.734375l0.53125 -4.484375l-0.84375 0q-0.578125 0 -0.828125 -0.21875q-0.234375 -0.21875 -0.234375 -0.578125q0 -0.359375 0.234375 -0.578125q0.25 -0.234375 0.828125 -0.234375l2.125 0.015625q0.578125 0 0.828125 0.21875q0.25 0.21875 0.25 0.578125q0 0.296875 -0.203125 0.515625q-0.1875 0.21875 -0.5625 0.28125l-0.921875 7.8749847l-1.765625 0l-1.53125 -4.5468597zm10.1640625 -5.59375l0 1.703125l-1.90625 0l0 -1.703125l1.90625 0zm0.21875 3.046875l0 5.4843597l1.921875 0q0.578125 0 0.828125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.25 0.21875 -0.828125 0.21875l-5.4375 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l1.921875 0l0 -3.8906097l-1.296875 0q-0.5625 0 -0.8125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.234375 -0.578125q0.25 -0.21875 0.828125 -0.21875l2.890625 0zm7.1953125 0l0 0.53125q0.4375 -0.375 0.953125 -0.5625q0.53125 -0.1875 1.15625 -0.1875q1.421875 0 2.25 0.890625q0.65625 0.703125 0.65625 1.84375l0 2.9687347q0.5 0 0.734375 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.453125 0q-0.578125 0 -0.828125 -0.21875q-0.234375 -0.234375 -0.234375 -0.59375q0 -0.34375 0.234375 -0.5625q0.25 -0.234375 0.75 -0.234375l0 -3.0156097q0 -0.53125 -0.28125 -0.765625q-0.359375 -0.3125 -1.09375 -0.3125q-0.5625 0 -0.984375 0.21875q-0.40625 0.203125 -1.046875 0.90625l0 2.9687347q0.609375 0 0.796875 0.125q0.375 0.234375 0.375 0.6875q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.828125 0q-0.578125 0 -0.828125 -0.21875q-0.234375 -0.234375 -0.234375 -0.59375q0 -0.4375 0.375 -0.671875q0.1875 -0.125 0.796875 -0.125l0 -3.8906097q-0.5 0 -0.75 -0.21875q-0.234375 -0.234375 -0.234375 -0.578125q0 -0.359375 0.234375 -0.578125q0.25 -0.21875 0.828125 -0.21875l1.53125 0zm14.8984375 -3.046875l0 8.531235l0.265625 0q0.578125 0 0.828125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.25 0.21875 -0.828125 0.21875l-1.875 0l0 -0.390625q-0.546875 0.3125 -1.140625 0.484375q-0.59375 0.171875 -1.234375 0.171875q-1.8125 0 -2.921875 -1.046875q-1.09375 -1.046875 -1.09375 -2.6093597q0 -1.625 1.15625 -2.765625q1.15625 -1.15625 2.828125 -1.15625q0.625 0 1.21875 0.203125q0.609375 0.1875 1.1875 0.5625l0 -1.984375l-0.265625 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.234375 0.828125 -0.234375l1.875 0zm-1.609375 6.796875q0 -0.984375 -0.703125 -1.671875q-0.6875 -0.6875 -1.6875 -0.6875q-1.0 0 -1.703125 0.6875q-0.6875 0.6875 -0.6875 1.65625q0 0.875 0.625 1.453125q0.625 0.56248474 1.765625 0.56248474q1.125 0 1.75 -0.56248474q0.640625 -0.578125 0.640625 -1.4375zm11.6953125 -0.078125q0 0.921875 -0.515625 1.7968597q-0.515625 0.859375 -1.53125 1.375q-1.0 0.515625 -2.109375 0.515625q-1.09375 0 -2.09375 -0.5q-1.0 -0.515625 -1.53125 -1.375q-0.515625 -0.87498474 -0.515625 -1.8281097q0 -0.953125 0.53125 -1.875q0.53125 -0.9375 1.53125 -1.46875q1.0 -0.53125 2.078125 -0.53125q1.09375 0 2.109375 0.546875q1.015625 0.546875 1.53125 1.46875q0.515625 0.90625 0.515625 1.875zm-1.609375 0.015625q0 -0.78125 -0.546875 -1.421875q-0.765625 -0.875 -2.0 -0.875q-1.078125 0 -1.8125 0.703125q-0.71875 0.6875 -0.71875 1.59375q0 0.75 0.734375 1.40625q0.734375 0.65623474 1.796875 0.65623474q1.078125 0 1.8125 -0.65623474q0.734375 -0.65625 0.734375 -1.40625zm7.0546875 0.453125l-1.109375 2.9531097l-1.5 0l-1.34375 -5.4999847q-0.4375 -0.015625 -0.671875 -0.234375q-0.21875 -0.234375 -0.21875 -0.5625q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l1.484375 0q0.578125 0 0.828125 0.21875q0.25 0.21875 0.25 0.578125q0 0.359375 -0.28125 0.609375q-0.21875 0.1875 -0.828125 0.1875l0.609375 2.546875l0.984375 -2.609375l1.421875 0l1.0 2.609375l0.625 -2.546875q-0.59375 0 -0.78125 -0.109375q-0.375 -0.25 -0.375 -0.6875q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l1.5 0q0.578125 0 0.828125 0.21875q0.25 0.21875 0.25 0.578125q0 0.328125 -0.21875 0.546875q-0.21875 0.21875 -0.640625 0.25l-1.3125 5.4999847l-1.484375 0l-1.171875 -2.9531097zm11.3203125 -2.265625q-0.390625 -0.25 -0.828125 -0.359375q-0.421875 -0.125 -0.890625 -0.125q-0.921875 0 -1.46875 0.296875q-0.25 0.140625 -0.25 0.296875q0 0.171875 0.328125 0.34375q0.25 0.125 1.125 0.25q1.59375 0.21875 2.21875 0.4375q0.8125 0.28125 1.25 0.859375q0.453125 0.5625 0.453125 1.203125q0 0.85935974 -0.75 1.4374847q-1.09375 0.84375 -2.828125 0.84375q-0.6875 0 -1.28125 -0.125q-0.59375 -0.125 -1.078125 -0.359375q-0.125 0.09375 -0.265625 0.15625q-0.125 0.046875 -0.265625 0.046875q-0.375 0 -0.59375 -0.234375q-0.21875 -0.25 -0.21875 -0.828125l0 -0.546875q0 -0.57810974 0.21875 -0.81248474q0.21875 -0.25 0.578125 -0.25q0.296875 0 0.484375 0.15625q0.203125 0.15625 0.3125 0.546875q0.359375 0.31248474 0.875 0.48435974q0.515625 0.15625 1.1875 0.15625q1.109375 0 1.71875 -0.34375q0.28125 -0.171875 0.28125 -0.35935974q0 -0.3125 -0.40625 -0.515625q-0.421875 -0.203125 -1.71875 -0.34375q-1.921875 -0.203125 -2.578125 -0.78125q-0.640625 -0.578125 -0.640625 -1.40625q0 -0.859375 0.71875 -1.4375q0.984375 -0.78125 2.578125 -0.78125q0.5625 0 1.0625 0.109375q0.515625 0.109375 0.984375 0.328125q0.15625 -0.109375 0.28125 -0.15625q0.125 -0.0625 0.234375 -0.0625q0.328125 0 0.546875 0.25q0.21875 0.234375 0.21875 0.8125l0 0.390625q0 0.53125 -0.125 0.71875q-0.25 0.359375 -0.671875 0.359375q-0.296875 0 -0.515625 -0.171875q-0.21875 -0.1875 -0.28125 -0.484375zm6.9453125 1.96875l0 1.6406097l1.625 0q0.578125 0 0.8125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-3.46875 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l0.25 0l0 -6.2656097l-0.25 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.234375 0.828125 -0.234375l3.6875 0.015625q1.625 0 2.5625 0.890625q0.953125 0.875 0.953125 2.15625q0 0.703125 -0.3125 1.328125q-0.25 0.46875 -0.8125 0.921875q-0.5625 0.453125 -1.15625 0.6875q-0.59375 0.234375 -1.5625 0.234375l-1.515625 0zm0 -1.609375l1.484375 0q1.046875 0 1.65625 -0.46875q0.625 -0.46875 0.625 -1.140625q0 -0.5625 -0.5 -0.984375q-0.5 -0.421875 -1.421875 -0.421875l-1.84375 0l0 3.015625zm11.9765625 4.8593597l0 -0.375q-0.609375 0.3125 -1.34375 0.46875q-0.71875 0.171875 -1.3125 0.171875q-1.28125 0 -2.09375 -0.6875q-0.796875 -0.6875 -0.796875 -1.5156097q0 -1.0 1.015625 -1.859375q1.03125 -0.875 2.84375 -0.875q0.734375 0 1.6875 0.15625l0 -0.375q0 -0.359375 -0.3125 -0.578125q-0.3125 -0.234375 -1.171875 -0.234375q-0.71875 0 -1.84375 0.28125q-0.421875 0.09375 -0.65625 0.09375q-0.328125 0 -0.546875 -0.21875q-0.21875 -0.234375 -0.21875 -0.59375q0 -0.203125 0.078125 -0.34375q0.078125 -0.15625 0.21875 -0.25q0.140625 -0.09375 0.578125 -0.21875q0.59375 -0.15625 1.203125 -0.25q0.625 -0.109375 1.125 -0.109375q1.5 0 2.3125 0.65625q0.828125 0.640625 0.828125 1.75l0 3.2968597l0.28125 0q0.578125 0 0.8125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.875 0zm0 -2.8749847q-0.96875 -0.1875 -1.78125 -0.1875q-0.96875 0 -1.671875 0.484375q-0.4375 0.296875 -0.4375 0.609375q0 0.23435974 0.203125 0.37498474q0.390625 0.25 1.078125 0.25q0.578125 0 1.296875 -0.21875q0.734375 -0.234375 1.3125 -0.62498474l0 -0.6875zm7.7578125 -2.625l0 3.21875q0 0.51560974 0.21875 0.67185974q0.328125 0.265625 1.171875 0.265625q1.21875 0 2.265625 -0.53125q0.390625 -0.20310974 0.625 -0.20310974q0.3125 0 0.53125 0.23435974q0.234375 0.234375 0.234375 0.578125q0 0.3125 -0.25 0.53125q-0.375 0.375 -1.515625 0.6875q-1.125 0.3125 -1.890625 0.3125q-1.5 0 -2.25 -0.640625q-0.734375 -0.65625 -0.734375 -1.5937347l0 -3.53125l-0.578125 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l0.578125 0l0 -1.453125q0 -0.578125 0.21875 -0.8125q0.21875 -0.25 0.578125 -0.25q0.359375 0 0.578125 0.25q0.21875 0.234375 0.21875 0.8125l0 1.453125l2.96875 0q0.578125 0 0.8125 0.21875q0.25 0.21875 0.25 0.578125q0 0.359375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-2.96875 0zm8.3515625 -4.640625l0 3.421875q0.5 -0.296875 1.0 -0.4375q0.515625 -0.15625 1.046875 -0.15625q0.828125 0 1.46875 0.28125q0.65625 0.28125 1.078125 0.890625q0.421875 0.609375 0.421875 1.53125l0 2.9999847q0.609375 0 0.796875 0.125q0.375 0.234375 0.375 0.6875q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.828125 0q-0.5625 0 -0.8125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.4375 0.375 -0.671875q0.203125 -0.125 0.796875 -0.125l0 -2.8906097q0 -0.625 -0.28125 -0.875q-0.359375 -0.328125 -1.078125 -0.328125q-0.53125 0 -0.953125 0.203125q-0.40625 0.203125 -1.09375 0.890625l0 2.9999847q0.609375 0 0.796875 0.125q0.375 0.234375 0.375 0.6875q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.828125 0q-0.578125 0 -0.828125 -0.21875q-0.234375 -0.234375 -0.234375 -0.59375q0 -0.4375 0.375 -0.671875q0.1875 -0.125 0.796875 -0.125l0 -6.9218597l-0.265625 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l1.875 0z" fill-rule="nonzero"/><path fill="#000000" fill-opacity="0.0" d="m105.74803 99.10499l97.70079 -30.58268" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m105.74803 99.10499l91.97476 -28.79029" fill-rule="evenodd"/><path fill="#000000" stroke="#000000" stroke-width="1.0" stroke-linecap="butt" d="m198.21622 71.891l3.8374481 -2.9319763l-4.824295 -0.22064209z" fill-rule="evenodd"/><path fill="#000000" fill-opacity="0.0" d="m423.02362 99.10499l-105.60629 -30.58268" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m423.02362 99.10499l-99.84308 -28.913704" fill-rule="evenodd"/><path fill="#000000" stroke="#000000" stroke-width="1.0" stroke-linecap="butt" d="m323.63998 68.60474l-4.818451 0.32421875l3.8995361 2.848877z" fill-rule="evenodd"/><path fill="#000000" fill-opacity="0.0" d="m105.74803 221.4357l0 -61.16536" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m105.74803 221.4357l0 -55.16536" fill-rule="evenodd"/><path fill="#000000" stroke="#000000" stroke-width="1.0" stroke-linecap="butt" d="m107.399765 166.27034l-1.6517334 -4.538101l-1.6517334 4.538101z" fill-rule="evenodd"/><path fill="#000000" fill-opacity="0.0" d="m423.02362 221.4357l0 -61.16536" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m423.02362 221.4357l0 -55.16536" fill-rule="evenodd"/><path fill="#000000" stroke="#000000" stroke-width="1.0" stroke-linecap="butt" d="m424.67535 166.27034l-1.6517334 -4.538101l-1.6517334 4.538101z" fill-rule="evenodd"/><path fill="#000000" fill-opacity="0.0" d="m260.4252 160.27034l0 -61.16535" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m260.4252 160.27034l0 -55.16535" fill-rule="evenodd"/><path fill="#000000" stroke="#000000" stroke-width="1.0" stroke-linecap="butt" d="m262.07693 105.10499l-1.6517334 -4.538101l-1.6517334 4.538101z" fill-rule="evenodd"/><path fill="#000000" fill-opacity="0.0" d="m105.74803 221.4357l97.70079 -30.582687" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m105.74803 221.4357l91.97476 -28.790298" fill-rule="evenodd"/><path fill="#000000" stroke="#000000" stroke-width="1.0" stroke-linecap="butt" d="m198.21622 194.22171l3.8374481 -2.9319763l-4.824295 -0.22064209z" fill-rule="evenodd"/><path fill="#000000" fill-opacity="0.0" d="m423.02362 221.4357l-105.60629 -30.582687" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m423.02362 221.4357l-99.84308 -28.913696" fill-rule="evenodd"/><path fill="#000000" stroke="#000000" stroke-width="1.0" stroke-linecap="butt" d="m323.63998 190.93544l-4.818451 0.32421875l3.8995361 2.848877z" fill-rule="evenodd"/></g></svg>
\ No newline at end of file
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" stroke="none" stroke-linecap="square" stroke-miterlimit="10" version="1.1" viewBox="0 0 539.005 319.409"><clipPath id="p.0"><path d="m0 0l539.00525 0l0 319.40945l-539.00525 0l0 -319.40945z" clip-rule="nonzero"/></clipPath><g clip-path="url(#p.0)"><path fill="#000" fill-opacity="0" fill-rule="evenodd" d="m0 0l539.00525 0l0 319.40945l-539.00525 0z"/><path fill="#fff" fill-rule="evenodd" d="m203.43307 37.929134l113.98425 0l0 61.165356l-113.98425 0z"/><path fill-rule="evenodd" stroke="#000" stroke-linecap="butt" stroke-linejoin="round" stroke-width="1" d="m203.43307 37.929134l113.98425 0l0 61.165356l-113.98425 0z"/><path fill="#000" fill-rule="nonzero" d="m225.89395 71.12181l0 1.640625l1.625 0q0.578125 0 0.8125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-3.46875 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l0.25 0l0 -6.265625l-0.25 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.234375 0.828125 -0.234375l3.6875 0.015625q1.625 0 2.5625 0.890625q0.953125 0.875 0.953125 2.15625q0 0.703125 -0.3125 1.328125q-0.25 0.46875 -0.8125 0.921875q-0.5625 0.453125 -1.15625 0.6875q-0.59375 0.234375 -1.5625 0.234375l-1.515625 0zm0 -1.609375l1.484375 0q1.046875 0 1.65625 -0.46875q0.625 -0.46875 0.625 -1.140625q0 -0.5625 -0.5 -0.984375q-0.5 -0.421875 -1.421875 -0.421875l-1.84375 0l0 3.015625zm13.9296875 -2.234375l0 5.484375q0.515625 0 0.75 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.25 0.21875 -0.828125 0.21875l-1.515625 0l0 -0.375q-0.6875 0.3125 -1.3125 0.46875q-0.625 0.171875 -1.1875 0.171875q-0.796875 0 -1.375 -0.328125q-0.578125 -0.34375 -0.90625 -0.9375q-0.25 -0.421875 -0.25 -1.046875l0 -3.453125l-0.265625 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l1.875 0l0 4.765625q0 0.5 0.234375 0.75q0.25 0.234375 0.765625 0.234375q0.484375 0 1.03125 -0.1875q0.5625 -0.203125 1.390625 -0.703125l0 -3.265625l-0.578125 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l2.171875 0zm5.8671875 0l0 1.0q1.015625 -0.734375 1.59375 -0.96875q0.578125 -0.25 1.09375 -0.25q0.78125 0 1.515625 0.578125q0.5 0.390625 0.5 0.796875q0 0.34375 -0.25 0.59375q-0.234375 0.234375 -0.5625 0.234375q-0.296875 0 -0.625 -0.296875q-0.328125 -0.296875 -0.59375 -0.296875q-0.328125 0 -1.0 0.421875q-0.671875 0.421875 -1.671875 1.265625l0 2.40625l2.28125 0q0.578125 0 0.828125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.25 0.21875 -0.828125 0.21875l-4.828125 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l0.953125 0l0 -3.890625l-0.578125 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l2.171875 0zm13.9609375 4.359375l-6.578125 0q0.25 0.625 0.890625 1.015625q0.640625 0.375 1.71875 0.375q0.890625 0 2.375 -0.390625q0.609375 -0.15625 0.84375 -0.15625q0.3125 0 0.53125 0.234375q0.21875 0.21875 0.21875 0.5625q0 0.3125 -0.234375 0.53125q-0.3125 0.296875 -1.53125 0.5625q-1.203125 0.265625 -2.3125 0.265625q-1.921875 0 -3.078125 -1.09375q-1.15625 -1.09375 -1.15625 -2.671875q0 -1.6875 1.25 -2.75q1.25 -1.0625 2.875 -1.0625q0.96875 0 1.78125 0.34375q0.828125 0.34375 1.21875 0.75q0.5625 0.578125 0.9375 1.421875q0.25 0.59375 0.25 1.375l0 0.6875zm-1.78125 -1.609375q-0.359375 -0.6875 -0.953125 -1.015625q-0.59375 -0.34375 -1.421875 -0.34375q-0.8125 0 -1.40625 0.34375q-0.59375 0.328125 -0.96875 1.015625l4.75 0zm6.4296875 1.09375l0 1.640625l1.625 0q0.578125 0 0.8125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-3.46875 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l0.25 0l0 -6.265625l-0.25 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.234375 0.828125 -0.234375l3.6875 0.015625q1.625 0 2.5625 0.890625q0.953125 0.875 0.953125 2.15625q0 0.703125 -0.3125 1.328125q-0.25 0.46875 -0.8125 0.921875q-0.5625 0.453125 -1.15625 0.6875q-0.59375 0.234375 -1.5625 0.234375l-1.515625 0zm0 -1.609375l1.484375 0q1.046875 0 1.65625 -0.46875q0.625 -0.46875 0.625 -1.140625q0 -0.5625 -0.5 -0.984375q-0.5 -0.421875 -1.421875 -0.421875l-1.84375 0l0 3.015625zm11.9765625 4.859375l0 -0.375q-0.609375 0.3125 -1.34375 0.46875q-0.71875 0.171875 -1.3125 0.171875q-1.28125 0 -2.09375 -0.6875q-0.796875 -0.6875 -0.796875 -1.515625q0 -1.0 1.015625 -1.859375q1.03125 -0.875 2.84375 -0.875q0.734375 0 1.6875 0.15625l0 -0.375q0 -0.359375 -0.3125 -0.578125q-0.3125 -0.234375 -1.171875 -0.234375q-0.71875 0 -1.84375 0.28125q-0.421875 0.09375 -0.65625 0.09375q-0.328125 0 -0.546875 -0.21875q-0.21875 -0.234375 -0.21875 -0.59375q0 -0.203125 0.078125 -0.34375q0.078125 -0.15625 0.21875 -0.25q0.140625 -0.09375 0.578125 -0.21875q0.59375 -0.15625 1.203125 -0.25q0.625 -0.109375 1.125 -0.109375q1.5 0 2.3125 0.65625q0.828125 0.640625 0.828125 1.75l0 3.296875l0.28125 0q0.578125 0 0.8125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.875 0zm0 -2.875q-0.96875 -0.1875 -1.78125 -0.1875q-0.96875 0 -1.671875 0.484375q-0.4375 0.296875 -0.4375 0.609375q0 0.234375 0.203125 0.375q0.390625 0.25 1.078125 0.25q0.578125 0 1.296875 -0.21875q0.734375 -0.234375 1.3125 -0.625l0 -0.6875zm7.7578125 -2.625l0 3.21875q0 0.515625 0.21875 0.671875q0.328125 0.265625 1.171875 0.265625q1.21875 0 2.265625 -0.53125q0.390625 -0.203125 0.625 -0.203125q0.3125 0 0.53125 0.234375q0.234375 0.234375 0.234375 0.578125q0 0.3125 -0.25 0.53125q-0.375 0.375 -1.515625 0.6875q-1.125 0.3125 -1.890625 0.3125q-1.5 0 -2.25 -0.640625q-0.734375 -0.65625 -0.734375 -1.59375l0 -3.53125l-0.578125 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l0.578125 0l0 -1.453125q0 -0.578125 0.21875 -0.8125q0.21875 -0.25 0.578125 -0.25q0.359375 0 0.578125 0.25q0.21875 0.234375 0.21875 0.8125l0 1.453125l2.96875 0q0.578125 0 0.8125 0.21875q0.25 0.21875 0.25 0.578125q0 0.359375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-2.96875 0zm8.3515625 -4.640625l0 3.421875q0.5 -0.296875 1.0 -0.4375q0.515625 -0.15625 1.046875 -0.15625q0.828125 0 1.46875 0.28125q0.65625 0.28125 1.078125 0.890625q0.421875 0.609375 0.421875 1.53125l0 3.0q0.609375 0 0.796875 0.125q0.375 0.234375 0.375 0.6875q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.828125 0q-0.5625 0 -0.8125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.4375 0.375 -0.671875q0.203125 -0.125 0.796875 -0.125l0 -2.890625q0 -0.625 -0.28125 -0.875q-0.359375 -0.328125 -1.078125 -0.328125q-0.53125 0 -0.953125 0.203125q-0.40625 0.203125 -1.09375 0.890625l0 3.0q0.609375 0 0.796875 0.125q0.375 0.234375 0.375 0.6875q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.828125 0q-0.578125 0 -0.828125 -0.21875q-0.234375 -0.234375 -0.234375 -0.59375q0 -0.4375 0.375 -0.671875q0.1875 -0.125 0.796875 -0.125l0 -6.921875l-0.265625 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l1.875 0z"/><path fill="#fff" fill-rule="evenodd" d="m26.64567 99.10499l158.20471 0l0 61.16535l-158.20471 0z"/><path fill-rule="evenodd" stroke="#000" stroke-linecap="butt" stroke-linejoin="round" stroke-width="1" d="m26.64567 99.10499l158.20471 0l0 61.16535l-158.20471 0z"/><path fill="#000" fill-rule="nonzero" d="m47.212875 132.29767l0 1.640625l1.625 0q0.578125 0 0.8125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-3.46875 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l0.25 0l0 -6.2656326l-0.25 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.234375 0.828125 -0.234375l3.6875 0.015625q1.625 0 2.5625 0.890625q0.953125 0.875 0.953125 2.1562576q0 0.703125 -0.3125 1.328125q-0.25 0.46875 -0.8125 0.921875q-0.5625 0.453125 -1.15625 0.6875q-0.59375 0.234375 -1.5625 0.234375l-1.515625 0zm0 -1.609375l1.484375 0q1.046875 0 1.65625 -0.46875q0.625 -0.46875 0.625 -1.140625q0 -0.5625 -0.5 -0.984375q-0.5 -0.42188263 -1.421875 -0.42188263l-1.84375 0l0 3.0156326zm13.9296875 -2.234375l0 5.484375q0.515625 0 0.75 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.25 0.21875 -0.828125 0.21875l-1.515625 0l0 -0.375q-0.6875 0.3125 -1.3125 0.46875q-0.625 0.171875 -1.1875 0.171875q-0.796875 0 -1.375 -0.328125q-0.578125 -0.34375 -0.90625 -0.9375q-0.25 -0.421875 -0.25 -1.046875l0 -3.453125l-0.265625 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l1.875 0l0 4.765625q0 0.5 0.234375 0.75q0.25 0.234375 0.765625 0.234375q0.484375 0 1.03125 -0.1875q0.5625 -0.203125 1.390625 -0.703125l0 -3.265625l-0.578125 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l2.171875 0zm5.8671875 0l0 1.0q1.015625 -0.734375 1.59375 -0.96875q0.578125 -0.25 1.09375 -0.25q0.78125 0 1.515625 0.578125q0.5 0.390625 0.5 0.796875q0 0.34375 -0.25 0.59375q-0.234375 0.234375 -0.5625 0.234375q-0.296875 0 -0.625 -0.296875q-0.328125 -0.296875 -0.59375 -0.296875q-0.328125 0 -1.0 0.421875q-0.671875 0.421875 -1.671875 1.265625l0 2.40625l2.28125 0q0.578125 0 0.828125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.25 0.21875 -0.828125 0.21875l-4.828125 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l0.953125 0l0 -3.890625l-0.578125 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l2.171875 0zm13.9609375 4.359375l-6.578125 0q0.25 0.625 0.890625 1.015625q0.640625 0.375 1.71875 0.375q0.890625 0 2.375 -0.390625q0.609375 -0.15625 0.84375 -0.15625q0.3125 0 0.53125 0.234375q0.21875 0.21875 0.21875 0.5625q0 0.3125 -0.234375 0.53125q-0.3125 0.296875 -1.53125 0.5625q-1.203125 0.265625 -2.3125 0.265625q-1.921875 0 -3.078125 -1.09375q-1.15625 -1.09375 -1.15625 -2.671875q0 -1.6875 1.25 -2.75q1.25 -1.0625 2.875 -1.0625q0.96875 0 1.78125 0.34375q0.828125 0.34375 1.21875 0.75q0.5625 0.578125 0.9375 1.421875q0.25 0.59375 0.25 1.375l0 0.6875zm-1.78125 -1.609375q-0.359375 -0.6875 -0.953125 -1.015625q-0.59375 -0.34375 -1.421875 -0.34375q-0.8125 0 -1.40625 0.34375q-0.59375 0.328125 -0.96875 1.015625l4.75 0zm6.4296875 1.09375l0 1.640625l1.625 0q0.578125 0 0.8125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-3.46875 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l0.25 0l0 -6.2656326l-0.25 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.234375 0.828125 -0.234375l3.6875 0.015625q1.625 0 2.5625 0.890625q0.953125 0.875 0.953125 2.1562576q0 0.703125 -0.3125 1.328125q-0.25 0.46875 -0.8125 0.921875q-0.5625 0.453125 -1.15625 0.6875q-0.59375 0.234375 -1.5625 0.234375l-1.515625 0zm0 -1.609375l1.484375 0q1.046875 0 1.65625 -0.46875q0.625 -0.46875 0.625 -1.140625q0 -0.5625 -0.5 -0.984375q-0.5 -0.42188263 -1.421875 -0.42188263l-1.84375 0l0 3.0156326zm14.6953125 1.4375q0 0.921875 -0.515625 1.796875q-0.515625 0.859375 -1.53125 1.375q-1.0 0.515625 -2.109375 0.515625q-1.09375 0 -2.09375 -0.5q-1.0 -0.515625 -1.53125 -1.375q-0.515625 -0.875 -0.515625 -1.828125q0 -0.953125 0.53125 -1.875q0.53125 -0.9375 1.53125 -1.46875q1.0 -0.53125 2.078125 -0.53125q1.09375 0 2.109375 0.546875q1.015625 0.546875 1.53125 1.46875q0.515625 0.90625 0.515625 1.875zm-1.609375 0.015625q0 -0.78125 -0.546875 -1.421875q-0.765625 -0.875 -2.0 -0.875q-1.078125 0 -1.8125 0.703125q-0.71875 0.6875 -0.71875 1.59375q0 0.75 0.734375 1.40625q0.734375 0.65625 1.796875 0.65625q1.078125 0 1.8125 -0.65625q0.734375 -0.65625 0.734375 -1.40625zm8.7734375 -1.8125q-0.390625 -0.25 -0.828125 -0.359375q-0.421875 -0.125 -0.890625 -0.125q-0.921875 0 -1.46875 0.296875q-0.25 0.140625 -0.25 0.296875q0 0.171875 0.328125 0.34375q0.25 0.125 1.125 0.25q1.59375 0.21875 2.21875 0.4375q0.8125 0.28125 1.25 0.859375q0.453125 0.5625 0.453125 1.203125q0 0.859375 -0.75 1.4375q-1.09375 0.84375 -2.828125 0.84375q-0.6875 0 -1.28125 -0.125q-0.59375 -0.125 -1.078125 -0.359375q-0.125 0.09375 -0.265625 0.15625q-0.125 0.046875 -0.265625 0.046875q-0.375 0 -0.59375 -0.234375q-0.21875 -0.25 -0.21875 -0.828125l0 -0.546875q0 -0.578125 0.21875 -0.8125q0.21875 -0.25 0.578125 -0.25q0.296875 0 0.484375 0.15625q0.203125 0.15625 0.3125 0.546875q0.359375 0.3125 0.875 0.484375q0.515625 0.15625 1.1875 0.15625q1.109375 0 1.71875 -0.34375q0.28125 -0.171875 0.28125 -0.359375q0 -0.3125 -0.40625 -0.515625q-0.421875 -0.203125 -1.71875 -0.34375q-1.921875 -0.203125 -2.578125 -0.78125q-0.640625 -0.578125 -0.640625 -1.40625q0 -0.859375 0.71875 -1.4375q0.984375 -0.78125 2.578125 -0.78125q0.5625 0 1.0625 0.109375q0.515625 0.109375 0.984375 0.328125q0.15625 -0.109375 0.28125 -0.15625q0.125 -0.0625 0.234375 -0.0625q0.328125 0 0.546875 0.25q0.21875 0.234375 0.21875 0.8125l0 0.390625q0 0.53125 -0.125 0.71875q-0.25 0.359375 -0.671875 0.359375q-0.296875 0 -0.515625 -0.171875q-0.21875 -0.1875 -0.28125 -0.484375zm8.4453125 -4.9218826l0 1.703125l-1.90625 0l0 -1.703125l1.90625 0zm0.21875 3.0468826l0 5.484375l1.921875 0q0.578125 0 0.828125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.25 0.21875 -0.828125 0.21875l-5.4375 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l1.921875 0l0 -3.890625l-1.296875 0q-0.5625 0 -0.8125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.234375 -0.578125q0.25 -0.21875 0.828125 -0.21875l2.890625 0zm10.0078125 3.40625l2.4375 2.078125q0.4375 0.03125 0.65625 0.25q0.21875 0.21875 0.21875 0.5625q0 0.34375 -0.25 0.578125q-0.25 0.21875 -0.828125 0.21875l-1.8125 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.28125 0.171875 -0.5q0.1875 -0.21875 0.484375 -0.296875l-1.1875 -1.03125l-1.21875 1.03125q0.359375 0.09375 0.515625 0.296875q0.171875 0.1875 0.171875 0.5q0 0.359375 -0.25 0.59375q-0.234375 0.21875 -0.8125 0.21875l-1.8125 0q-0.578125 0 -0.828125 -0.21875q-0.234375 -0.234375 -0.234375 -0.59375q0 -0.328125 0.21875 -0.546875q0.21875 -0.21875 0.65625 -0.25l2.375 -2.09375l-2.109375 -1.796875q-0.40625 -0.03125 -0.625 -0.25q-0.21875 -0.21875 -0.21875 -0.546875q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l1.5 0q0.578125 0 0.8125 0.21875q0.25 0.21875 0.25 0.5625q0 0.46875 -0.4375 0.75l0.96875 0.8125l0.953125 -0.828125q-0.421875 -0.296875 -0.421875 -0.703125q0 -0.375 0.234375 -0.59375q0.25 -0.21875 0.828125 -0.21875l1.484375 0q0.578125 0 0.828125 0.21875q0.25 0.21875 0.25 0.578125q0 0.328125 -0.21875 0.546875q-0.21875 0.21875 -0.640625 0.25l-2.109375 1.8125zm7.4765625 0.4375l0 1.640625l1.625 0q0.578125 0 0.8125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-3.46875 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l0.25 0l0 -6.2656326l-0.25 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.234375 0.828125 -0.234375l3.6875 0.015625q1.625 0 2.5625 0.890625q0.953125 0.875 0.953125 2.1562576q0 0.703125 -0.3125 1.328125q-0.25 0.46875 -0.8125 0.921875q-0.5625 0.453125 -1.15625 0.6875q-0.59375 0.234375 -1.5625 0.234375l-1.515625 0zm0 -1.609375l1.484375 0q1.046875 0 1.65625 -0.46875q0.625 -0.46875 0.625 -1.140625q0 -0.5625 -0.5 -0.984375q-0.5 -0.42188263 -1.421875 -0.42188263l-1.84375 0l0 3.0156326zm11.9765625 4.859375l0 -0.375q-0.609375 0.3125 -1.34375 0.46875q-0.71875 0.171875 -1.3125 0.171875q-1.28125 0 -2.09375 -0.6875q-0.796875 -0.6875 -0.796875 -1.515625q0 -1.0 1.015625 -1.859375q1.03125 -0.875 2.84375 -0.875q0.734375 0 1.6875 0.15625l0 -0.375q0 -0.359375 -0.3125 -0.578125q-0.3125 -0.234375 -1.171875 -0.234375q-0.71875 0 -1.84375 0.28125q-0.421875 0.09375 -0.65625 0.09375q-0.328125 0 -0.546875 -0.21875q-0.21875 -0.234375 -0.21875 -0.59375q0 -0.203125 0.078125 -0.34375q0.078125 -0.15625 0.21875 -0.25q0.140625 -0.09375 0.578125 -0.21875q0.59375 -0.15625 1.203125 -0.25q0.625 -0.109375 1.125 -0.109375q1.5 0 2.3125 0.65625q0.828125 0.640625 0.828125 1.75l0 3.296875l0.28125 0q0.578125 0 0.8125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.875 0zm0 -2.875q-0.96875 -0.1875 -1.78125 -0.1875q-0.96875 0 -1.671875 0.484375q-0.4375 0.296875 -0.4375 0.609375q0 0.234375 0.203125 0.375q0.390625 0.25 1.078125 0.25q0.578125 0 1.296875 -0.21875q0.734375 -0.234375 1.3125 -0.625l0 -0.6875zm7.7578125 -2.625l0 3.21875q0 0.515625 0.21875 0.671875q0.328125 0.265625 1.171875 0.265625q1.21875 0 2.265625 -0.53125q0.390625 -0.203125 0.625 -0.203125q0.3125 0 0.53125 0.234375q0.234375 0.234375 0.234375 0.578125q0 0.3125 -0.25 0.53125q-0.375 0.375 -1.515625 0.6875q-1.125 0.3125 -1.890625 0.3125q-1.5 0 -2.25 -0.640625q-0.734375 -0.65625 -0.734375 -1.59375l0 -3.53125l-0.578125 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l0.578125 0l0 -1.4531326q0 -0.578125 0.21875 -0.8125q0.21875 -0.25 0.578125 -0.25q0.359375 0 0.578125 0.25q0.21875 0.234375 0.21875 0.8125l0 1.4531326l2.96875 0q0.578125 0 0.8125 0.21875q0.25 0.21875 0.25 0.578125q0 0.359375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-2.96875 0zm8.3515625 -4.6406326l0 3.4218826q0.5 -0.296875 1.0 -0.4375q0.515625 -0.15625 1.046875 -0.15625q0.828125 0 1.46875 0.28125q0.65625 0.28125 1.078125 0.890625q0.421875 0.609375 0.421875 1.53125l0 3.0q0.609375 0 0.796875 0.125q0.375 0.234375 0.375 0.6875q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.828125 0q-0.5625 0 -0.8125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.4375 0.375 -0.671875q0.203125 -0.125 0.796875 -0.125l0 -2.890625q0 -0.625 -0.28125 -0.875q-0.359375 -0.328125 -1.078125 -0.328125q-0.53125 0 -0.953125 0.203125q-0.40625 0.203125 -1.09375 0.890625l0 3.0q0.609375 0 0.796875 0.125q0.375 0.234375 0.375 0.6875q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.828125 0q-0.578125 0 -0.828125 -0.21875q-0.234375 -0.234375 -0.234375 -0.59375q0 -0.4375 0.375 -0.671875q0.1875 -0.125 0.796875 -0.125l0 -6.9218826l-0.265625 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l1.875 0z"/><path fill="#fff" fill-rule="evenodd" d="m336.0 99.10499l174.04724 0l0 61.16535l-174.04724 0z"/><path fill-rule="evenodd" stroke="#000" stroke-linecap="butt" stroke-linejoin="round" stroke-width="1" d="m336.0 99.10499l174.04724 0l0 61.16535l-174.04724 0z"/><path fill="#000" fill-rule="nonzero" d="m354.8869 132.29767l0 1.640625l1.625 0q0.578125 0 0.8125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-3.46875 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l0.25 0l0 -6.2656326l-0.25 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.234375 0.828125 -0.234375l3.6875 0.015625q1.625 0 2.5625 0.890625q0.953125 0.875 0.953125 2.1562576q0 0.703125 -0.3125 1.328125q-0.25 0.46875 -0.8125 0.921875q-0.5625 0.453125 -1.15625 0.6875q-0.59375 0.234375 -1.5625 0.234375l-1.515625 0zm0 -1.609375l1.484375 0q1.046875 0 1.65625 -0.46875q0.625 -0.46875 0.625 -1.140625q0 -0.5625 -0.5 -0.984375q-0.5 -0.42188263 -1.421875 -0.42188263l-1.84375 0l0 3.0156326zm13.9296875 -2.234375l0 5.484375q0.515625 0 0.75 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.25 0.21875 -0.828125 0.21875l-1.515625 0l0 -0.375q-0.6875 0.3125 -1.3125 0.46875q-0.625 0.171875 -1.1875 0.171875q-0.796875 0 -1.375 -0.328125q-0.578125 -0.34375 -0.90625 -0.9375q-0.25 -0.421875 -0.25 -1.046875l0 -3.453125l-0.265625 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l1.875 0l0 4.765625q0 0.5 0.234375 0.75q0.25 0.234375 0.765625 0.234375q0.484375 0 1.03125 -0.1875q0.5625 -0.203125 1.390625 -0.703125l0 -3.265625l-0.578125 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l2.171875 0zm5.8671875 0l0 1.0q1.015625 -0.734375 1.59375 -0.96875q0.578125 -0.25 1.09375 -0.25q0.78125 0 1.515625 0.578125q0.5 0.390625 0.5 0.796875q0 0.34375 -0.25 0.59375q-0.234375 0.234375 -0.5625 0.234375q-0.296875 0 -0.625 -0.296875q-0.328125 -0.296875 -0.59375 -0.296875q-0.328125 0 -1.0 0.421875q-0.671875 0.421875 -1.671875 1.265625l0 2.40625l2.28125 0q0.578125 0 0.828125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.25 0.21875 -0.828125 0.21875l-4.828125 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l0.953125 0l0 -3.890625l-0.578125 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l2.171875 0zm13.9609375 4.359375l-6.578125 0q0.25 0.625 0.890625 1.015625q0.640625 0.375 1.71875 0.375q0.890625 0 2.375 -0.390625q0.609375 -0.15625 0.84375 -0.15625q0.3125 0 0.53125 0.234375q0.21875 0.21875 0.21875 0.5625q0 0.3125 -0.234375 0.53125q-0.3125 0.296875 -1.53125 0.5625q-1.203125 0.265625 -2.3125 0.265625q-1.921875 0 -3.078125 -1.09375q-1.15625 -1.09375 -1.15625 -2.671875q0 -1.6875 1.25 -2.75q1.25 -1.0625 2.875 -1.0625q0.96875 0 1.78125 0.34375q0.828125 0.34375 1.21875 0.75q0.5625 0.578125 0.9375 1.421875q0.25 0.59375 0.25 1.375l0 0.6875zm-1.78125 -1.609375q-0.359375 -0.6875 -0.953125 -1.015625q-0.59375 -0.34375 -1.421875 -0.34375q-0.8125 0 -1.40625 0.34375q-0.59375 0.328125 -0.96875 1.015625l4.75 0zm7.3671875 -0.203125l-1.484375 4.546875l-1.796875 0l-0.953125 -7.8750076q-0.375 -0.046875 -0.5625 -0.25q-0.1875 -0.203125 -0.1875 -0.53125q0 -0.375 0.25 -0.59375q0.25 -0.234375 0.828125 -0.234375l2.125 0.015625q0.578125 0 0.828125 0.21875q0.25 0.21875 0.25 0.578125q0 0.359375 -0.25 0.578125q-0.25 0.21875 -0.828125 0.21875l-0.828125 0l0.53125 4.4843826l1.25 -3.734375l1.671875 0l1.25 3.734375l0.53125 -4.4843826l-0.84375 0q-0.578125 0 -0.828125 -0.21875q-0.234375 -0.21875 -0.234375 -0.578125q0 -0.359375 0.234375 -0.578125q0.25 -0.234375 0.828125 -0.234375l2.125 0.015625q0.578125 0 0.828125 0.21875q0.25 0.21875 0.25 0.578125q0 0.296875 -0.203125 0.515625q-0.1875 0.21875 -0.5625 0.28125l-0.921875 7.8750076l-1.765625 0l-1.53125 -4.546875zm10.1640625 -5.5937576l0 1.703125l-1.90625 0l0 -1.703125l1.90625 0zm0.21875 3.0468826l0 5.484375l1.921875 0q0.578125 0 0.828125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.25 0.21875 -0.828125 0.21875l-5.4375 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l1.921875 0l0 -3.890625l-1.296875 0q-0.5625 0 -0.8125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.234375 -0.578125q0.25 -0.21875 0.828125 -0.21875l2.890625 0zm7.1953125 0l0 0.53125q0.4375 -0.375 0.953125 -0.5625q0.53125 -0.1875 1.15625 -0.1875q1.421875 0 2.25 0.890625q0.65625 0.703125 0.65625 1.84375l0 2.96875q0.5 0 0.734375 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.453125 0q-0.578125 0 -0.828125 -0.21875q-0.234375 -0.234375 -0.234375 -0.59375q0 -0.34375 0.234375 -0.5625q0.25 -0.234375 0.75 -0.234375l0 -3.015625q0 -0.53125 -0.28125 -0.765625q-0.359375 -0.3125 -1.09375 -0.3125q-0.5625 0 -0.984375 0.21875q-0.40625 0.203125 -1.046875 0.90625l0 2.96875q0.609375 0 0.796875 0.125q0.375 0.234375 0.375 0.6875q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.828125 0q-0.578125 0 -0.828125 -0.21875q-0.234375 -0.234375 -0.234375 -0.59375q0 -0.4375 0.375 -0.671875q0.1875 -0.125 0.796875 -0.125l0 -3.890625q-0.5 0 -0.75 -0.21875q-0.234375 -0.234375 -0.234375 -0.578125q0 -0.359375 0.234375 -0.578125q0.25 -0.21875 0.828125 -0.21875l1.53125 0zm14.8984375 -3.0468826l0 8.531258l0.265625 0q0.578125 0 0.828125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.25 0.21875 -0.828125 0.21875l-1.875 0l0 -0.390625q-0.546875 0.3125 -1.140625 0.484375q-0.59375 0.171875 -1.234375 0.171875q-1.8125 0 -2.921875 -1.046875q-1.09375 -1.046875 -1.09375 -2.609375q0 -1.625 1.15625 -2.765625q1.15625 -1.15625 2.828125 -1.15625q0.625 0 1.21875 0.203125q0.609375 0.1875 1.1875 0.5625l0 -1.9843826l-0.265625 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.234375 0.828125 -0.234375l1.875 0zm-1.609375 6.7968826q0 -0.984375 -0.703125 -1.671875q-0.6875 -0.6875 -1.6875 -0.6875q-1.0 0 -1.703125 0.6875q-0.6875 0.6875 -0.6875 1.65625q0 0.875 0.625 1.453125q0.625 0.5625 1.765625 0.5625q1.125 0 1.75 -0.5625q0.640625 -0.578125 0.640625 -1.4375zm11.6953125 -0.078125q0 0.921875 -0.515625 1.796875q-0.515625 0.859375 -1.53125 1.375q-1.0 0.515625 -2.109375 0.515625q-1.09375 0 -2.09375 -0.5q-1.0 -0.515625 -1.53125 -1.375q-0.515625 -0.875 -0.515625 -1.828125q0 -0.953125 0.53125 -1.875q0.53125 -0.9375 1.53125 -1.46875q1.0 -0.53125 2.078125 -0.53125q1.09375 0 2.109375 0.546875q1.015625 0.546875 1.53125 1.46875q0.515625 0.90625 0.515625 1.875zm-1.609375 0.015625q0 -0.78125 -0.546875 -1.421875q-0.765625 -0.875 -2.0 -0.875q-1.078125 0 -1.8125 0.703125q-0.71875 0.6875 -0.71875 1.59375q0 0.75 0.734375 1.40625q0.734375 0.65625 1.796875 0.65625q1.078125 0 1.8125 -0.65625q0.734375 -0.65625 0.734375 -1.40625zm7.0546875 0.453125l-1.109375 2.953125l-1.5 0l-1.34375 -5.5q-0.4375 -0.015625 -0.671875 -0.234375q-0.21875 -0.234375 -0.21875 -0.5625q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l1.484375 0q0.578125 0 0.828125 0.21875q0.25 0.21875 0.25 0.578125q0 0.359375 -0.28125 0.609375q-0.21875 0.1875 -0.828125 0.1875l0.609375 2.546875l0.984375 -2.609375l1.421875 0l1.0 2.609375l0.625 -2.546875q-0.59375 0 -0.78125 -0.109375q-0.375 -0.25 -0.375 -0.6875q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l1.5 0q0.578125 0 0.828125 0.21875q0.25 0.21875 0.25 0.578125q0 0.328125 -0.21875 0.546875q-0.21875 0.21875 -0.640625 0.25l-1.3125 5.5l-1.484375 0l-1.171875 -2.953125zm11.3203125 -2.265625q-0.390625 -0.25 -0.828125 -0.359375q-0.421875 -0.125 -0.890625 -0.125q-0.921875 0 -1.46875 0.296875q-0.25 0.140625 -0.25 0.296875q0 0.171875 0.328125 0.34375q0.25 0.125 1.125 0.25q1.59375 0.21875 2.21875 0.4375q0.8125 0.28125 1.25 0.859375q0.453125 0.5625 0.453125 1.203125q0 0.859375 -0.75 1.4375q-1.09375 0.84375 -2.828125 0.84375q-0.6875 0 -1.28125 -0.125q-0.59375 -0.125 -1.078125 -0.359375q-0.125 0.09375 -0.265625 0.15625q-0.125 0.046875 -0.265625 0.046875q-0.375 0 -0.59375 -0.234375q-0.21875 -0.25 -0.21875 -0.828125l0 -0.546875q0 -0.578125 0.21875 -0.8125q0.21875 -0.25 0.578125 -0.25q0.296875 0 0.484375 0.15625q0.203125 0.15625 0.3125 0.546875q0.359375 0.3125 0.875 0.484375q0.515625 0.15625 1.1875 0.15625q1.109375 0 1.71875 -0.34375q0.28125 -0.171875 0.28125 -0.359375q0 -0.3125 -0.40625 -0.515625q-0.421875 -0.203125 -1.71875 -0.34375q-1.921875 -0.203125 -2.578125 -0.78125q-0.640625 -0.578125 -0.640625 -1.40625q0 -0.859375 0.71875 -1.4375q0.984375 -0.78125 2.578125 -0.78125q0.5625 0 1.0625 0.109375q0.515625 0.109375 0.984375 0.328125q0.15625 -0.109375 0.28125 -0.15625q0.125 -0.0625 0.234375 -0.0625q0.328125 0 0.546875 0.25q0.21875 0.234375 0.21875 0.8125l0 0.390625q0 0.53125 -0.125 0.71875q-0.25 0.359375 -0.671875 0.359375q-0.296875 0 -0.515625 -0.171875q-0.21875 -0.1875 -0.28125 -0.484375zm6.9453125 1.96875l0 1.640625l1.625 0q0.578125 0 0.8125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-3.46875 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l0.25 0l0 -6.2656326l-0.25 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.234375 0.828125 -0.234375l3.6875 0.015625q1.625 0 2.5625 0.890625q0.953125 0.875 0.953125 2.1562576q0 0.703125 -0.3125 1.328125q-0.25 0.46875 -0.8125 0.921875q-0.5625 0.453125 -1.15625 0.6875q-0.59375 0.234375 -1.5625 0.234375l-1.515625 0zm0 -1.609375l1.484375 0q1.046875 0 1.65625 -0.46875q0.625 -0.46875 0.625 -1.140625q0 -0.5625 -0.5 -0.984375q-0.5 -0.42188263 -1.421875 -0.42188263l-1.84375 0l0 3.0156326zm11.9765625 4.859375l0 -0.375q-0.609375 0.3125 -1.34375 0.46875q-0.71875 0.171875 -1.3125 0.171875q-1.28125 0 -2.09375 -0.6875q-0.796875 -0.6875 -0.796875 -1.515625q0 -1.0 1.015625 -1.859375q1.03125 -0.875 2.84375 -0.875q0.734375 0 1.6875 0.15625l0 -0.375q0 -0.359375 -0.3125 -0.578125q-0.3125 -0.234375 -1.171875 -0.234375q-0.71875 0 -1.84375 0.28125q-0.421875 0.09375 -0.65625 0.09375q-0.328125 0 -0.546875 -0.21875q-0.21875 -0.234375 -0.21875 -0.59375q0 -0.203125 0.078125 -0.34375q0.078125 -0.15625 0.21875 -0.25q0.140625 -0.09375 0.578125 -0.21875q0.59375 -0.15625 1.203125 -0.25q0.625 -0.109375 1.125 -0.109375q1.5 0 2.3125 0.65625q0.828125 0.640625 0.828125 1.75l0 3.296875l0.28125 0q0.578125 0 0.8125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.875 0zm0 -2.875q-0.96875 -0.1875 -1.78125 -0.1875q-0.96875 0 -1.671875 0.484375q-0.4375 0.296875 -0.4375 0.609375q0 0.234375 0.203125 0.375q0.390625 0.25 1.078125 0.25q0.578125 0 1.296875 -0.21875q0.734375 -0.234375 1.3125 -0.625l0 -0.6875zm7.7578125 -2.625l0 3.21875q0 0.515625 0.21875 0.671875q0.328125 0.265625 1.171875 0.265625q1.21875 0 2.265625 -0.53125q0.390625 -0.203125 0.625 -0.203125q0.3125 0 0.53125 0.234375q0.234375 0.234375 0.234375 0.578125q0 0.3125 -0.25 0.53125q-0.375 0.375 -1.515625 0.6875q-1.125 0.3125 -1.890625 0.3125q-1.5 0 -2.25 -0.640625q-0.734375 -0.65625 -0.734375 -1.59375l0 -3.53125l-0.578125 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l0.578125 0l0 -1.4531326q0 -0.578125 0.21875 -0.8125q0.21875 -0.25 0.578125 -0.25q0.359375 0 0.578125 0.25q0.21875 0.234375 0.21875 0.8125l0 1.4531326l2.96875 0q0.578125 0 0.8125 0.21875q0.25 0.21875 0.25 0.578125q0 0.359375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-2.96875 0zm8.3515625 -4.6406326l0 3.4218826q0.5 -0.296875 1.0 -0.4375q0.515625 -0.15625 1.046875 -0.15625q0.828125 0 1.46875 0.28125q0.65625 0.28125 1.078125 0.890625q0.421875 0.609375 0.421875 1.53125l0 3.0q0.609375 0 0.796875 0.125q0.375 0.234375 0.375 0.6875q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.828125 0q-0.5625 0 -0.8125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.4375 0.375 -0.671875q0.203125 -0.125 0.796875 -0.125l0 -2.890625q0 -0.625 -0.28125 -0.875q-0.359375 -0.328125 -1.078125 -0.328125q-0.53125 0 -0.953125 0.203125q-0.40625 0.203125 -1.09375 0.890625l0 3.0q0.609375 0 0.796875 0.125q0.375 0.234375 0.375 0.6875q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.828125 0q-0.578125 0 -0.828125 -0.21875q-0.234375 -0.234375 -0.234375 -0.59375q0 -0.4375 0.375 -0.671875q0.1875 -0.125 0.796875 -0.125l0 -6.9218826l-0.265625 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l1.875 0z"/><path fill="#fff" fill-rule="evenodd" d="m203.43307 160.27034l113.98425 0l0 61.16536l-113.98425 0z"/><path fill-rule="evenodd" stroke="#000" stroke-linecap="butt" stroke-linejoin="round" stroke-width="1" d="m203.43307 160.27034l113.98425 0l0 61.16536l-113.98425 0z"/><path fill="#000" fill-rule="nonzero" d="m245.09708 193.46301l0 1.640625l1.625 0q0.578125 0 0.8125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-3.46875 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l0.25 0l0 -6.265625l-0.25 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.234375 0.828125 -0.234375l3.6875 0.015625q1.625 0 2.5625 0.890625q0.953125 0.875 0.953125 2.15625q0 0.703125 -0.3125 1.328125q-0.25 0.46875 -0.8125 0.921875q-0.5625 0.453125 -1.15625 0.6875q-0.59375 0.234375 -1.5625 0.234375l-1.515625 0zm0 -1.609375l1.484375 0q1.046875 0 1.65625 -0.46875q0.625 -0.46875 0.625 -1.140625q0 -0.5625 -0.5 -0.984375q-0.5 -0.421875 -1.421875 -0.421875l-1.84375 0l0 3.015625zm11.9765625 4.859375l0 -0.375q-0.609375 0.3125 -1.34375 0.46875q-0.71875 0.171875 -1.3125 0.171875q-1.28125 0 -2.09375 -0.6875q-0.796875 -0.6875 -0.796875 -1.515625q0 -1.0 1.015625 -1.859375q1.03125 -0.875 2.84375 -0.875q0.734375 0 1.6875 0.15625l0 -0.375q0 -0.359375 -0.3125 -0.578125q-0.3125 -0.234375 -1.171875 -0.234375q-0.71875 0 -1.84375 0.28125q-0.421875 0.09375 -0.65625 0.09375q-0.328125 0 -0.546875 -0.21875q-0.21875 -0.234375 -0.21875 -0.59375q0 -0.203125 0.078125 -0.34375q0.078125 -0.15625 0.21875 -0.25q0.140625 -0.09375 0.578125 -0.21875q0.59375 -0.15625 1.203125 -0.25q0.625 -0.109375 1.125 -0.109375q1.5 0 2.3125 0.65625q0.828125 0.640625 0.828125 1.75l0 3.296875l0.28125 0q0.578125 0 0.8125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.875 0zm0 -2.875q-0.96875 -0.1875 -1.78125 -0.1875q-0.96875 0 -1.671875 0.484375q-0.4375 0.296875 -0.4375 0.609375q0 0.234375 0.203125 0.375q0.390625 0.25 1.078125 0.25q0.578125 0 1.296875 -0.21875q0.734375 -0.234375 1.3125 -0.625l0 -0.6875zm7.7578125 -2.625l0 3.21875q0 0.515625 0.21875 0.671875q0.328125 0.265625 1.171875 0.265625q1.21875 0 2.265625 -0.53125q0.390625 -0.203125 0.625 -0.203125q0.3125 0 0.53125 0.234375q0.234375 0.234375 0.234375 0.578125q0 0.3125 -0.25 0.53125q-0.375 0.375 -1.515625 0.6875q-1.125 0.3125 -1.890625 0.3125q-1.5 0 -2.25 -0.640625q-0.734375 -0.65625 -0.734375 -1.59375l0 -3.53125l-0.578125 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l0.578125 0l0 -1.453125q0 -0.578125 0.21875 -0.8125q0.21875 -0.25 0.578125 -0.25q0.359375 0 0.578125 0.25q0.21875 0.234375 0.21875 0.8125l0 1.453125l2.96875 0q0.578125 0 0.8125 0.21875q0.25 0.21875 0.25 0.578125q0 0.359375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-2.96875 0zm8.3515625 -4.640625l0 3.421875q0.5 -0.296875 1.0 -0.4375q0.515625 -0.15625 1.046875 -0.15625q0.828125 0 1.46875 0.28125q0.65625 0.28125 1.078125 0.890625q0.421875 0.609375 0.421875 1.53125l0 3.0q0.609375 0 0.796875 0.125q0.375 0.234375 0.375 0.6875q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.828125 0q-0.5625 0 -0.8125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.4375 0.375 -0.671875q0.203125 -0.125 0.796875 -0.125l0 -2.890625q0 -0.625 -0.28125 -0.875q-0.359375 -0.328125 -1.078125 -0.328125q-0.53125 0 -0.953125 0.203125q-0.40625 0.203125 -1.09375 0.890625l0 3.0q0.609375 0 0.796875 0.125q0.375 0.234375 0.375 0.6875q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.828125 0q-0.578125 0 -0.828125 -0.21875q-0.234375 -0.234375 -0.234375 -0.59375q0 -0.4375 0.375 -0.671875q0.1875 -0.125 0.796875 -0.125l0 -6.921875l-0.265625 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l1.875 0z"/><path fill="#fff" fill-rule="evenodd" d="m26.64567 221.4357l158.20471 0l0 61.165344l-158.20471 0z"/><path fill-rule="evenodd" stroke="#000" stroke-linecap="butt" stroke-linejoin="round" stroke-width="1" d="m26.64567 221.4357l158.20471 0l0 61.165344l-158.20471 0z"/><path fill="#000" fill-rule="nonzero" d="m66.416 254.62837l0 1.6406097l1.625 0q0.578125 0 0.8125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-3.46875 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l0.25 0l0 -6.2656097l-0.25 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.234375 0.828125 -0.234375l3.6875 0.015625q1.625 0 2.5625 0.890625q0.953125 0.875 0.953125 2.15625q0 0.703125 -0.3125 1.328125q-0.25 0.46875 -0.8125 0.921875q-0.5625 0.453125 -1.15625 0.6875q-0.59375 0.234375 -1.5625 0.234375l-1.515625 0zm0 -1.609375l1.484375 0q1.046875 0 1.65625 -0.46875q0.625 -0.46875 0.625 -1.140625q0 -0.5625 -0.5 -0.984375q-0.5 -0.421875 -1.421875 -0.421875l-1.84375 0l0 3.015625zm14.6953125 1.4375q0 0.921875 -0.515625 1.7968597q-0.515625 0.859375 -1.53125 1.375q-1.0 0.515625 -2.109375 0.515625q-1.09375 0 -2.09375 -0.5q-1.0 -0.515625 -1.53125 -1.375q-0.515625 -0.87498474 -0.515625 -1.8281097q0 -0.953125 0.53125 -1.875q0.53125 -0.9375 1.53125 -1.46875q1.0 -0.53125 2.078125 -0.53125q1.09375 0 2.109375 0.546875q1.015625 0.546875 1.53125 1.46875q0.515625 0.90625 0.515625 1.875zm-1.609375 0.015625q0 -0.78125 -0.546875 -1.421875q-0.765625 -0.875 -2.0 -0.875q-1.078125 0 -1.8125 0.703125q-0.71875 0.6875 -0.71875 1.59375q0 0.75 0.734375 1.40625q0.734375 0.65623474 1.796875 0.65623474q1.078125 0 1.8125 -0.65623474q0.734375 -0.65625 0.734375 -1.40625zm8.7734375 -1.8125q-0.390625 -0.25 -0.828125 -0.359375q-0.421875 -0.125 -0.890625 -0.125q-0.921875 0 -1.46875 0.296875q-0.25 0.140625 -0.25 0.296875q0 0.171875 0.328125 0.34375q0.25 0.125 1.125 0.25q1.59375 0.21875 2.21875 0.4375q0.8125 0.28125 1.25 0.859375q0.453125 0.5625 0.453125 1.203125q0 0.85935974 -0.75 1.4374847q-1.09375 0.84375 -2.828125 0.84375q-0.6875 0 -1.28125 -0.125q-0.59375 -0.125 -1.078125 -0.359375q-0.125 0.09375 -0.265625 0.15625q-0.125 0.046875 -0.265625 0.046875q-0.375 0 -0.59375 -0.234375q-0.21875 -0.25 -0.21875 -0.828125l0 -0.546875q0 -0.57810974 0.21875 -0.81248474q0.21875 -0.25 0.578125 -0.25q0.296875 0 0.484375 0.15625q0.203125 0.15625 0.3125 0.546875q0.359375 0.31248474 0.875 0.48435974q0.515625 0.15625 1.1875 0.15625q1.109375 0 1.71875 -0.34375q0.28125 -0.171875 0.28125 -0.35935974q0 -0.3125 -0.40625 -0.515625q-0.421875 -0.203125 -1.71875 -0.34375q-1.921875 -0.203125 -2.578125 -0.78125q-0.640625 -0.578125 -0.640625 -1.40625q0 -0.859375 0.71875 -1.4375q0.984375 -0.78125 2.578125 -0.78125q0.5625 0 1.0625 0.109375q0.515625 0.109375 0.984375 0.328125q0.15625 -0.109375 0.28125 -0.15625q0.125 -0.0625 0.234375 -0.0625q0.328125 0 0.546875 0.25q0.21875 0.234375 0.21875 0.8125l0 0.390625q0 0.53125 -0.125 0.71875q-0.25 0.359375 -0.671875 0.359375q-0.296875 0 -0.515625 -0.171875q-0.21875 -0.1875 -0.28125 -0.484375zm8.4453125 -4.921875l0 1.703125l-1.90625 0l0 -1.703125l1.90625 0zm0.21875 3.046875l0 5.4843597l1.921875 0q0.578125 0 0.828125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.25 0.21875 -0.828125 0.21875l-5.4375 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l1.921875 0l0 -3.8906097l-1.296875 0q-0.5625 0 -0.8125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.234375 -0.578125q0.25 -0.21875 0.828125 -0.21875l2.890625 0zm10.0078125 3.40625l2.4375 2.0781097q0.4375 0.03125 0.65625 0.25q0.21875 0.21875 0.21875 0.5625q0 0.34375 -0.25 0.578125q-0.25 0.21875 -0.828125 0.21875l-1.8125 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.28125 0.171875 -0.5q0.1875 -0.21875 0.484375 -0.296875l-1.1875 -1.0312347l-1.21875 1.0312347q0.359375 0.09375 0.515625 0.296875q0.171875 0.1875 0.171875 0.5q0 0.359375 -0.25 0.59375q-0.234375 0.21875 -0.8125 0.21875l-1.8125 0q-0.578125 0 -0.828125 -0.21875q-0.234375 -0.234375 -0.234375 -0.59375q0 -0.328125 0.21875 -0.546875q0.21875 -0.21875 0.65625 -0.25l2.375 -2.0937347l-2.109375 -1.796875q-0.40625 -0.03125 -0.625 -0.25q-0.21875 -0.21875 -0.21875 -0.546875q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l1.5 0q0.578125 0 0.8125 0.21875q0.25 0.21875 0.25 0.5625q0 0.46875 -0.4375 0.75l0.96875 0.8125l0.953125 -0.828125q-0.421875 -0.296875 -0.421875 -0.703125q0 -0.375 0.234375 -0.59375q0.25 -0.21875 0.828125 -0.21875l1.484375 0q0.578125 0 0.828125 0.21875q0.25 0.21875 0.25 0.578125q0 0.328125 -0.21875 0.546875q-0.21875 0.21875 -0.640625 0.25l-2.109375 1.8125zm7.4765625 0.4375l0 1.6406097l1.625 0q0.578125 0 0.8125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-3.46875 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l0.25 0l0 -6.2656097l-0.25 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.234375 0.828125 -0.234375l3.6875 0.015625q1.625 0 2.5625 0.890625q0.953125 0.875 0.953125 2.15625q0 0.703125 -0.3125 1.328125q-0.25 0.46875 -0.8125 0.921875q-0.5625 0.453125 -1.15625 0.6875q-0.59375 0.234375 -1.5625 0.234375l-1.515625 0zm0 -1.609375l1.484375 0q1.046875 0 1.65625 -0.46875q0.625 -0.46875 0.625 -1.140625q0 -0.5625 -0.5 -0.984375q-0.5 -0.421875 -1.421875 -0.421875l-1.84375 0l0 3.015625zm11.9765625 4.8593597l0 -0.375q-0.609375 0.3125 -1.34375 0.46875q-0.71875 0.171875 -1.3125 0.171875q-1.28125 0 -2.09375 -0.6875q-0.796875 -0.6875 -0.796875 -1.5156097q0 -1.0 1.015625 -1.859375q1.03125 -0.875 2.84375 -0.875q0.734375 0 1.6875 0.15625l0 -0.375q0 -0.359375 -0.3125 -0.578125q-0.3125 -0.234375 -1.171875 -0.234375q-0.71875 0 -1.84375 0.28125q-0.421875 0.09375 -0.65625 0.09375q-0.328125 0 -0.546875 -0.21875q-0.21875 -0.234375 -0.21875 -0.59375q0 -0.203125 0.078125 -0.34375q0.078125 -0.15625 0.21875 -0.25q0.140625 -0.09375 0.578125 -0.21875q0.59375 -0.15625 1.203125 -0.25q0.625 -0.109375 1.125 -0.109375q1.5 0 2.3125 0.65625q0.828125 0.640625 0.828125 1.75l0 3.2968597l0.28125 0q0.578125 0 0.8125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.875 0zm0 -2.8749847q-0.96875 -0.1875 -1.78125 -0.1875q-0.96875 0 -1.671875 0.484375q-0.4375 0.296875 -0.4375 0.609375q0 0.23435974 0.203125 0.37498474q0.390625 0.25 1.078125 0.25q0.578125 0 1.296875 -0.21875q0.734375 -0.234375 1.3125 -0.62498474l0 -0.6875zm7.7578125 -2.625l0 3.21875q0 0.51560974 0.21875 0.67185974q0.328125 0.265625 1.171875 0.265625q1.21875 0 2.265625 -0.53125q0.390625 -0.20310974 0.625 -0.20310974q0.3125 0 0.53125 0.23435974q0.234375 0.234375 0.234375 0.578125q0 0.3125 -0.25 0.53125q-0.375 0.375 -1.515625 0.6875q-1.125 0.3125 -1.890625 0.3125q-1.5 0 -2.25 -0.640625q-0.734375 -0.65625 -0.734375 -1.5937347l0 -3.53125l-0.578125 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l0.578125 0l0 -1.453125q0 -0.578125 0.21875 -0.8125q0.21875 -0.25 0.578125 -0.25q0.359375 0 0.578125 0.25q0.21875 0.234375 0.21875 0.8125l0 1.453125l2.96875 0q0.578125 0 0.8125 0.21875q0.25 0.21875 0.25 0.578125q0 0.359375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-2.96875 0zm8.3515625 -4.640625l0 3.421875q0.5 -0.296875 1.0 -0.4375q0.515625 -0.15625 1.046875 -0.15625q0.828125 0 1.46875 0.28125q0.65625 0.28125 1.078125 0.890625q0.421875 0.609375 0.421875 1.53125l0 2.9999847q0.609375 0 0.796875 0.125q0.375 0.234375 0.375 0.6875q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.828125 0q-0.5625 0 -0.8125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.4375 0.375 -0.671875q0.203125 -0.125 0.796875 -0.125l0 -2.8906097q0 -0.625 -0.28125 -0.875q-0.359375 -0.328125 -1.078125 -0.328125q-0.53125 0 -0.953125 0.203125q-0.40625 0.203125 -1.09375 0.890625l0 2.9999847q0.609375 0 0.796875 0.125q0.375 0.234375 0.375 0.6875q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.828125 0q-0.578125 0 -0.828125 -0.21875q-0.234375 -0.234375 -0.234375 -0.59375q0 -0.4375 0.375 -0.671875q0.1875 -0.125 0.796875 -0.125l0 -6.9218597l-0.265625 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l1.875 0z"/><path fill="#fff" fill-rule="evenodd" d="m336.0 221.4357l174.04724 0l0 61.165344l-174.04724 0z"/><path fill-rule="evenodd" stroke="#000" stroke-linecap="butt" stroke-linejoin="round" stroke-width="1" d="m336.0 221.4357l174.04724 0l0 61.165344l-174.04724 0z"/><path fill="#000" fill-rule="nonzero" d="m375.02753 253.3315l-1.484375 4.5468597l-1.796875 0l-0.953125 -7.8749847q-0.375 -0.046875 -0.5625 -0.25q-0.1875 -0.203125 -0.1875 -0.53125q0 -0.375 0.25 -0.59375q0.25 -0.234375 0.828125 -0.234375l2.125 0.015625q0.578125 0 0.828125 0.21875q0.25 0.21875 0.25 0.578125q0 0.359375 -0.25 0.578125q-0.25 0.21875 -0.828125 0.21875l-0.828125 0l0.53125 4.484375l1.25 -3.734375l1.671875 0l1.25 3.734375l0.53125 -4.484375l-0.84375 0q-0.578125 0 -0.828125 -0.21875q-0.234375 -0.21875 -0.234375 -0.578125q0 -0.359375 0.234375 -0.578125q0.25 -0.234375 0.828125 -0.234375l2.125 0.015625q0.578125 0 0.828125 0.21875q0.25 0.21875 0.25 0.578125q0 0.296875 -0.203125 0.515625q-0.1875 0.21875 -0.5625 0.28125l-0.921875 7.8749847l-1.765625 0l-1.53125 -4.5468597zm10.1640625 -5.59375l0 1.703125l-1.90625 0l0 -1.703125l1.90625 0zm0.21875 3.046875l0 5.4843597l1.921875 0q0.578125 0 0.828125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.25 0.21875 -0.828125 0.21875l-5.4375 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l1.921875 0l0 -3.8906097l-1.296875 0q-0.5625 0 -0.8125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.234375 -0.578125q0.25 -0.21875 0.828125 -0.21875l2.890625 0zm7.1953125 0l0 0.53125q0.4375 -0.375 0.953125 -0.5625q0.53125 -0.1875 1.15625 -0.1875q1.421875 0 2.25 0.890625q0.65625 0.703125 0.65625 1.84375l0 2.9687347q0.5 0 0.734375 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.453125 0q-0.578125 0 -0.828125 -0.21875q-0.234375 -0.234375 -0.234375 -0.59375q0 -0.34375 0.234375 -0.5625q0.25 -0.234375 0.75 -0.234375l0 -3.0156097q0 -0.53125 -0.28125 -0.765625q-0.359375 -0.3125 -1.09375 -0.3125q-0.5625 0 -0.984375 0.21875q-0.40625 0.203125 -1.046875 0.90625l0 2.9687347q0.609375 0 0.796875 0.125q0.375 0.234375 0.375 0.6875q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.828125 0q-0.578125 0 -0.828125 -0.21875q-0.234375 -0.234375 -0.234375 -0.59375q0 -0.4375 0.375 -0.671875q0.1875 -0.125 0.796875 -0.125l0 -3.8906097q-0.5 0 -0.75 -0.21875q-0.234375 -0.234375 -0.234375 -0.578125q0 -0.359375 0.234375 -0.578125q0.25 -0.21875 0.828125 -0.21875l1.53125 0zm14.8984375 -3.046875l0 8.531235l0.265625 0q0.578125 0 0.828125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.25 0.21875 -0.828125 0.21875l-1.875 0l0 -0.390625q-0.546875 0.3125 -1.140625 0.484375q-0.59375 0.171875 -1.234375 0.171875q-1.8125 0 -2.921875 -1.046875q-1.09375 -1.046875 -1.09375 -2.6093597q0 -1.625 1.15625 -2.765625q1.15625 -1.15625 2.828125 -1.15625q0.625 0 1.21875 0.203125q0.609375 0.1875 1.1875 0.5625l0 -1.984375l-0.265625 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.234375 0.828125 -0.234375l1.875 0zm-1.609375 6.796875q0 -0.984375 -0.703125 -1.671875q-0.6875 -0.6875 -1.6875 -0.6875q-1.0 0 -1.703125 0.6875q-0.6875 0.6875 -0.6875 1.65625q0 0.875 0.625 1.453125q0.625 0.56248474 1.765625 0.56248474q1.125 0 1.75 -0.56248474q0.640625 -0.578125 0.640625 -1.4375zm11.6953125 -0.078125q0 0.921875 -0.515625 1.7968597q-0.515625 0.859375 -1.53125 1.375q-1.0 0.515625 -2.109375 0.515625q-1.09375 0 -2.09375 -0.5q-1.0 -0.515625 -1.53125 -1.375q-0.515625 -0.87498474 -0.515625 -1.8281097q0 -0.953125 0.53125 -1.875q0.53125 -0.9375 1.53125 -1.46875q1.0 -0.53125 2.078125 -0.53125q1.09375 0 2.109375 0.546875q1.015625 0.546875 1.53125 1.46875q0.515625 0.90625 0.515625 1.875zm-1.609375 0.015625q0 -0.78125 -0.546875 -1.421875q-0.765625 -0.875 -2.0 -0.875q-1.078125 0 -1.8125 0.703125q-0.71875 0.6875 -0.71875 1.59375q0 0.75 0.734375 1.40625q0.734375 0.65623474 1.796875 0.65623474q1.078125 0 1.8125 -0.65623474q0.734375 -0.65625 0.734375 -1.40625zm7.0546875 0.453125l-1.109375 2.9531097l-1.5 0l-1.34375 -5.4999847q-0.4375 -0.015625 -0.671875 -0.234375q-0.21875 -0.234375 -0.21875 -0.5625q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l1.484375 0q0.578125 0 0.828125 0.21875q0.25 0.21875 0.25 0.578125q0 0.359375 -0.28125 0.609375q-0.21875 0.1875 -0.828125 0.1875l0.609375 2.546875l0.984375 -2.609375l1.421875 0l1.0 2.609375l0.625 -2.546875q-0.59375 0 -0.78125 -0.109375q-0.375 -0.25 -0.375 -0.6875q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l1.5 0q0.578125 0 0.828125 0.21875q0.25 0.21875 0.25 0.578125q0 0.328125 -0.21875 0.546875q-0.21875 0.21875 -0.640625 0.25l-1.3125 5.4999847l-1.484375 0l-1.171875 -2.9531097zm11.3203125 -2.265625q-0.390625 -0.25 -0.828125 -0.359375q-0.421875 -0.125 -0.890625 -0.125q-0.921875 0 -1.46875 0.296875q-0.25 0.140625 -0.25 0.296875q0 0.171875 0.328125 0.34375q0.25 0.125 1.125 0.25q1.59375 0.21875 2.21875 0.4375q0.8125 0.28125 1.25 0.859375q0.453125 0.5625 0.453125 1.203125q0 0.85935974 -0.75 1.4374847q-1.09375 0.84375 -2.828125 0.84375q-0.6875 0 -1.28125 -0.125q-0.59375 -0.125 -1.078125 -0.359375q-0.125 0.09375 -0.265625 0.15625q-0.125 0.046875 -0.265625 0.046875q-0.375 0 -0.59375 -0.234375q-0.21875 -0.25 -0.21875 -0.828125l0 -0.546875q0 -0.57810974 0.21875 -0.81248474q0.21875 -0.25 0.578125 -0.25q0.296875 0 0.484375 0.15625q0.203125 0.15625 0.3125 0.546875q0.359375 0.31248474 0.875 0.48435974q0.515625 0.15625 1.1875 0.15625q1.109375 0 1.71875 -0.34375q0.28125 -0.171875 0.28125 -0.35935974q0 -0.3125 -0.40625 -0.515625q-0.421875 -0.203125 -1.71875 -0.34375q-1.921875 -0.203125 -2.578125 -0.78125q-0.640625 -0.578125 -0.640625 -1.40625q0 -0.859375 0.71875 -1.4375q0.984375 -0.78125 2.578125 -0.78125q0.5625 0 1.0625 0.109375q0.515625 0.109375 0.984375 0.328125q0.15625 -0.109375 0.28125 -0.15625q0.125 -0.0625 0.234375 -0.0625q0.328125 0 0.546875 0.25q0.21875 0.234375 0.21875 0.8125l0 0.390625q0 0.53125 -0.125 0.71875q-0.25 0.359375 -0.671875 0.359375q-0.296875 0 -0.515625 -0.171875q-0.21875 -0.1875 -0.28125 -0.484375zm6.9453125 1.96875l0 1.6406097l1.625 0q0.578125 0 0.8125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-3.46875 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l0.25 0l0 -6.2656097l-0.25 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.234375 0.828125 -0.234375l3.6875 0.015625q1.625 0 2.5625 0.890625q0.953125 0.875 0.953125 2.15625q0 0.703125 -0.3125 1.328125q-0.25 0.46875 -0.8125 0.921875q-0.5625 0.453125 -1.15625 0.6875q-0.59375 0.234375 -1.5625 0.234375l-1.515625 0zm0 -1.609375l1.484375 0q1.046875 0 1.65625 -0.46875q0.625 -0.46875 0.625 -1.140625q0 -0.5625 -0.5 -0.984375q-0.5 -0.421875 -1.421875 -0.421875l-1.84375 0l0 3.015625zm11.9765625 4.8593597l0 -0.375q-0.609375 0.3125 -1.34375 0.46875q-0.71875 0.171875 -1.3125 0.171875q-1.28125 0 -2.09375 -0.6875q-0.796875 -0.6875 -0.796875 -1.5156097q0 -1.0 1.015625 -1.859375q1.03125 -0.875 2.84375 -0.875q0.734375 0 1.6875 0.15625l0 -0.375q0 -0.359375 -0.3125 -0.578125q-0.3125 -0.234375 -1.171875 -0.234375q-0.71875 0 -1.84375 0.28125q-0.421875 0.09375 -0.65625 0.09375q-0.328125 0 -0.546875 -0.21875q-0.21875 -0.234375 -0.21875 -0.59375q0 -0.203125 0.078125 -0.34375q0.078125 -0.15625 0.21875 -0.25q0.140625 -0.09375 0.578125 -0.21875q0.59375 -0.15625 1.203125 -0.25q0.625 -0.109375 1.125 -0.109375q1.5 0 2.3125 0.65625q0.828125 0.640625 0.828125 1.75l0 3.2968597l0.28125 0q0.578125 0 0.8125 0.234375q0.25 0.21875 0.25 0.578125q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.875 0zm0 -2.8749847q-0.96875 -0.1875 -1.78125 -0.1875q-0.96875 0 -1.671875 0.484375q-0.4375 0.296875 -0.4375 0.609375q0 0.23435974 0.203125 0.37498474q0.390625 0.25 1.078125 0.25q0.578125 0 1.296875 -0.21875q0.734375 -0.234375 1.3125 -0.62498474l0 -0.6875zm7.7578125 -2.625l0 3.21875q0 0.51560974 0.21875 0.67185974q0.328125 0.265625 1.171875 0.265625q1.21875 0 2.265625 -0.53125q0.390625 -0.20310974 0.625 -0.20310974q0.3125 0 0.53125 0.23435974q0.234375 0.234375 0.234375 0.578125q0 0.3125 -0.25 0.53125q-0.375 0.375 -1.515625 0.6875q-1.125 0.3125 -1.890625 0.3125q-1.5 0 -2.25 -0.640625q-0.734375 -0.65625 -0.734375 -1.5937347l0 -3.53125l-0.578125 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.21875 -0.25 -0.578125q0 -0.359375 0.25 -0.578125q0.25 -0.21875 0.828125 -0.21875l0.578125 0l0 -1.453125q0 -0.578125 0.21875 -0.8125q0.21875 -0.25 0.578125 -0.25q0.359375 0 0.578125 0.25q0.21875 0.234375 0.21875 0.8125l0 1.453125l2.96875 0q0.578125 0 0.8125 0.21875q0.25 0.21875 0.25 0.578125q0 0.359375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-2.96875 0zm8.3515625 -4.640625l0 3.421875q0.5 -0.296875 1.0 -0.4375q0.515625 -0.15625 1.046875 -0.15625q0.828125 0 1.46875 0.28125q0.65625 0.28125 1.078125 0.890625q0.421875 0.609375 0.421875 1.53125l0 2.9999847q0.609375 0 0.796875 0.125q0.375 0.234375 0.375 0.6875q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.828125 0q-0.5625 0 -0.8125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.4375 0.375 -0.671875q0.203125 -0.125 0.796875 -0.125l0 -2.8906097q0 -0.625 -0.28125 -0.875q-0.359375 -0.328125 -1.078125 -0.328125q-0.53125 0 -0.953125 0.203125q-0.40625 0.203125 -1.09375 0.890625l0 2.9999847q0.609375 0 0.796875 0.125q0.375 0.234375 0.375 0.6875q0 0.34375 -0.25 0.578125q-0.234375 0.21875 -0.8125 0.21875l-1.828125 0q-0.578125 0 -0.828125 -0.21875q-0.234375 -0.234375 -0.234375 -0.59375q0 -0.4375 0.375 -0.671875q0.1875 -0.125 0.796875 -0.125l0 -6.9218597l-0.265625 0q-0.578125 0 -0.828125 -0.21875q-0.25 -0.234375 -0.25 -0.59375q0 -0.34375 0.25 -0.5625q0.25 -0.234375 0.828125 -0.234375l1.875 0z"/><path fill="#000" fill-opacity="0" fill-rule="evenodd" d="m105.74803 99.10499l97.70079 -30.58268"/><path fill-rule="evenodd" stroke="#000" stroke-linecap="butt" stroke-linejoin="round" stroke-width="1" d="m105.74803 99.10499l91.97476 -28.79029"/><path fill="#000" fill-rule="evenodd" stroke="#000" stroke-linecap="butt" stroke-width="1" d="m198.21622 71.891l3.8374481 -2.9319763l-4.824295 -0.22064209z"/><path fill="#000" fill-opacity="0" fill-rule="evenodd" d="m423.02362 99.10499l-105.60629 -30.58268"/><path fill-rule="evenodd" stroke="#000" stroke-linecap="butt" stroke-linejoin="round" stroke-width="1" d="m423.02362 99.10499l-99.84308 -28.913704"/><path fill="#000" fill-rule="evenodd" stroke="#000" stroke-linecap="butt" stroke-width="1" d="m323.63998 68.60474l-4.818451 0.32421875l3.8995361 2.848877z"/><path fill="#000" fill-opacity="0" fill-rule="evenodd" d="m105.74803 221.4357l0 -61.16536"/><path fill-rule="evenodd" stroke="#000" stroke-linecap="butt" stroke-linejoin="round" stroke-width="1" d="m105.74803 221.4357l0 -55.16536"/><path fill="#000" fill-rule="evenodd" stroke="#000" stroke-linecap="butt" stroke-width="1" d="m107.399765 166.27034l-1.6517334 -4.538101l-1.6517334 4.538101z"/><path fill="#000" fill-opacity="0" fill-rule="evenodd" d="m423.02362 221.4357l0 -61.16536"/><path fill-rule="evenodd" stroke="#000" stroke-linecap="butt" stroke-linejoin="round" stroke-width="1" d="m423.02362 221.4357l0 -55.16536"/><path fill="#000" fill-rule="evenodd" stroke="#000" stroke-linecap="butt" stroke-width="1" d="m424.67535 166.27034l-1.6517334 -4.538101l-1.6517334 4.538101z"/><path fill="#000" fill-opacity="0" fill-rule="evenodd" d="m260.4252 160.27034l0 -61.16535"/><path fill-rule="evenodd" stroke="#000" stroke-linecap="butt" stroke-linejoin="round" stroke-width="1" d="m260.4252 160.27034l0 -55.16535"/><path fill="#000" fill-rule="evenodd" stroke="#000" stroke-linecap="butt" stroke-width="1" d="m262.07693 105.10499l-1.6517334 -4.538101l-1.6517334 4.538101z"/><path fill="#000" fill-opacity="0" fill-rule="evenodd" d="m105.74803 221.4357l97.70079 -30.582687"/><path fill-rule="evenodd" stroke="#000" stroke-linecap="butt" stroke-linejoin="round" stroke-width="1" d="m105.74803 221.4357l91.97476 -28.790298"/><path fill="#000" fill-rule="evenodd" stroke="#000" stroke-linecap="butt" stroke-width="1" d="m198.21622 194.22171l3.8374481 -2.9319763l-4.824295 -0.22064209z"/><path fill="#000" fill-opacity="0" fill-rule="evenodd" d="m423.02362 221.4357l-105.60629 -30.582687"/><path fill-rule="evenodd" stroke="#000" stroke-linecap="butt" stroke-linejoin="round" stroke-width="1" d="m423.02362 221.4357l-99.84308 -28.913696"/><path fill="#000" fill-rule="evenodd" stroke="#000" stroke-linecap="butt" stroke-width="1" d="m323.63998 190.93544l-4.818451 0.32421875l3.8995361 2.848877z"/></g></svg>
\ No newline at end of file
diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst
index 9526a03..b6507eb 100644
--- a/Doc/library/pathlib.rst
+++ b/Doc/library/pathlib.rst
@@ -336,6 +336,8 @@
       >>> p.parents[2]
       PureWindowsPath('c:/')
 
+   .. versionchanged:: 3.10
+      The parents sequence now supports :term:`slices <slice>` and negative index values.
 
 .. data:: PurePath.parent
 
@@ -703,7 +705,10 @@
 .. classmethod:: Path.home()
 
    Return a new path object representing the user's home directory (as
-   returned by :func:`os.path.expanduser` with ``~`` construct)::
+   returned by :func:`os.path.expanduser` with ``~`` construct). If the home
+   directory can't be resolved, :exc:`RuntimeError` is raised.
+
+   ::
 
       >>> Path.home()
       PosixPath('/home/antoine')
@@ -711,11 +716,14 @@
    .. versionadded:: 3.5
 
 
-.. method:: Path.stat()
+.. method:: Path.stat(*, follow_symlinks=True)
 
    Return a :class:`os.stat_result` object containing information about this path, like :func:`os.stat`.
    The result is looked up at each call to this method.
 
+   This method normally follows symlinks; to stat a symlink add the argument
+   ``follow_symlinks=False``, or use :meth:`~Path.lstat`.
+
    ::
 
       >>> p = Path('setup.py')
@@ -724,10 +732,18 @@
       >>> p.stat().st_mtime
       1327883547.852554
 
+   .. versionchanged:: 3.10
+      The *follow_symlinks* parameter was added.
 
-.. method:: Path.chmod(mode)
+.. method:: Path.chmod(mode, *, follow_symlinks=True)
 
-   Change the file mode and permissions, like :func:`os.chmod`::
+   Change the file mode and permissions, like :func:`os.chmod`.
+
+   This method normally follows symlinks. Some Unix flavours support changing
+   permissions on the symlink itself; on these platforms you may add the
+   argument ``follow_symlinks=False``, or use :meth:`~Path.lchmod`.
+
+   ::
 
       >>> p = Path('setup.py')
       >>> p.stat().st_mode
@@ -736,6 +752,8 @@
       >>> p.stat().st_mode
       33060
 
+   .. versionchanged:: 3.10
+      The *follow_symlinks* parameter was added.
 
 .. method:: Path.exists()
 
@@ -758,7 +776,10 @@
 .. method:: Path.expanduser()
 
    Return a new path with expanded ``~`` and ``~user`` constructs,
-   as returned by :meth:`os.path.expanduser`::
+   as returned by :meth:`os.path.expanduser`. If a home directory can't be
+   resolved, :exc:`RuntimeError` is raised.
+
+   ::
 
       >>> p = PosixPath('~/films/Monty Python')
       >>> p.expanduser()
@@ -777,8 +798,9 @@
       >>> sorted(Path('.').glob('*/*.py'))
       [PosixPath('docs/conf.py')]
 
-   The "``**``" pattern means "this directory and all subdirectories,
-   recursively".  In other words, it enables recursive globbing::
+   Patterns are the same as for :mod:`fnmatch`, with the addition of "``**``"
+   which means "this directory and all subdirectories, recursively".  In other
+   words, it enables recursive globbing::
 
       >>> sorted(Path('.').glob('**/*.py'))
       [PosixPath('build/lib/pathlib.py'),
@@ -1118,6 +1140,35 @@
       The order of arguments (link, target) is the reverse
       of :func:`os.symlink`'s.
 
+.. method:: Path.hardlink_to(target)
+
+   Make this path a hard link to the same file as *target*.
+
+   .. note::
+      The order of arguments (link, target) is the reverse
+      of :func:`os.link`'s.
+
+   .. versionadded:: 3.10
+
+.. method:: Path.link_to(target)
+
+   Make *target* a hard link to this path.
+
+   .. warning::
+
+      This function does not make this path a hard link to *target*, despite
+      the implication of the function and argument names. The argument order
+      (target, link) is the reverse of :func:`Path.symlink_to` and
+      :func:`Path.hardlink_to`, but matches that of :func:`os.link`.
+
+   .. versionadded:: 3.8
+
+   .. deprecated:: 3.10
+
+      This method is deprecated in favor of :meth:`Path.hardlink_to`, as the
+      argument order of :meth:`Path.link_to`  does not match that of
+      :meth:`Path.symlink_to`.
+
 
 .. method:: Path.touch(mode=0o666, exist_ok=True)
 
@@ -1143,13 +1194,6 @@
       The *missing_ok* parameter was added.
 
 
-.. method:: Path.link_to(target)
-
-   Create a hard link pointing to a path named *target*.
-
-   .. versionadded:: 3.8
-
-
 .. method:: Path.write_bytes(data)
 
    Open the file pointed to in bytes mode, write *data* to it, and close the
@@ -1166,7 +1210,7 @@
    .. versionadded:: 3.5
 
 
-.. method:: Path.write_text(data, encoding=None, errors=None)
+.. method:: Path.write_text(data, encoding=None, errors=None, newline=None)
 
    Open the file pointed to in text mode, write *data* to it, and close the
    file::
@@ -1182,6 +1226,9 @@
 
    .. versionadded:: 3.5
 
+   .. versionchanged:: 3.10
+      The *newline* parameter was added.
+
 Correspondence to tools in the :mod:`os` module
 -----------------------------------------------
 
@@ -1190,14 +1237,15 @@
 
 .. note::
 
-   Although :func:`os.path.relpath` and :meth:`PurePath.relative_to` have some
-   overlapping use-cases, their semantics differ enough to warrant not
-   considering them equivalent.
+   Not all pairs of functions/methods below are equivalent. Some of them,
+   despite having some overlapping use-cases, have different semantics. They
+   include :func:`os.path.abspath` and :meth:`Path.resolve`,
+   :func:`os.path.relpath` and :meth:`PurePath.relative_to`.
 
 ====================================   ==============================
-os and os.path                         pathlib
+:mod:`os` and :mod:`os.path`           :mod:`pathlib`
 ====================================   ==============================
-:func:`os.path.abspath`                :meth:`Path.resolve`
+:func:`os.path.abspath`                :meth:`Path.resolve` [#]_
 :func:`os.chmod`                       :meth:`Path.chmod`
 :func:`os.mkdir`                       :meth:`Path.mkdir`
 :func:`os.makedirs`                    :meth:`Path.mkdir`
@@ -1213,9 +1261,10 @@
 :func:`os.path.isdir`                  :meth:`Path.is_dir`
 :func:`os.path.isfile`                 :meth:`Path.is_file`
 :func:`os.path.islink`                 :meth:`Path.is_symlink`
-:func:`os.link`                        :meth:`Path.link_to`
+:func:`os.link`                        :meth:`Path.hardlink_to`
 :func:`os.symlink`                     :meth:`Path.symlink_to`
 :func:`os.readlink`                    :meth:`Path.readlink`
+:func:`os.path.relpath`                :meth:`Path.relative_to` [#]_
 :func:`os.stat`                        :meth:`Path.stat`,
                                        :meth:`Path.owner`,
                                        :meth:`Path.group`
@@ -1226,3 +1275,8 @@
 :func:`os.path.samefile`               :meth:`Path.samefile`
 :func:`os.path.splitext`               :data:`PurePath.suffix`
 ====================================   ==============================
+
+.. rubric:: Footnotes
+
+.. [#] :func:`os.path.abspath` does not resolve symbolic links while :meth:`Path.resolve` does.
+.. [#] :meth:`Path.relative_to` requires ``self`` to be the subpath of the argument, but :func:`os.path.relpath` does not.
diff --git a/Doc/library/pdb.rst b/Doc/library/pdb.rst
index ed1e971..13e1a19 100644
--- a/Doc/library/pdb.rst
+++ b/Doc/library/pdb.rst
@@ -67,14 +67,13 @@
    before the first line of the module.
 
 
-The typical usage to break into the debugger from a running program is to
-insert ::
+The typical usage to break into the debugger is to insert::
 
    import pdb; pdb.set_trace()
 
-at the location you want to break into the debugger.  You can then step through
-the code following this statement, and continue running without the debugger
-using the :pdbcmd:`continue` command.
+at the location you want to break into the debugger, and then run the program.
+You can then step through the code following this statement, and continue
+running without the debugger using the :pdbcmd:`continue` command.
 
 .. versionadded:: 3.7
    The built-in :func:`breakpoint()`, when called with defaults, can be used
diff --git a/Doc/library/pickle.rst b/Doc/library/pickle.rst
index b7c3452..be48561 100644
--- a/Doc/library/pickle.rst
+++ b/Doc/library/pickle.rst
@@ -213,7 +213,7 @@
 The :mod:`pickle` module provides the following functions to make the pickling
 process more convenient:
 
-.. function:: dump(obj, file, protocol=None, \*, fix_imports=True, buffer_callback=None)
+.. function:: dump(obj, file, protocol=None, *, fix_imports=True, buffer_callback=None)
 
    Write the pickled representation of the object *obj* to the open
    :term:`file object` *file*.  This is equivalent to
@@ -225,7 +225,7 @@
    .. versionchanged:: 3.8
       The *buffer_callback* argument was added.
 
-.. function:: dumps(obj, protocol=None, \*, fix_imports=True, buffer_callback=None)
+.. function:: dumps(obj, protocol=None, *, fix_imports=True, buffer_callback=None)
 
    Return the pickled representation of the object *obj* as a :class:`bytes` object,
    instead of writing it to a file.
@@ -236,7 +236,7 @@
    .. versionchanged:: 3.8
       The *buffer_callback* argument was added.
 
-.. function:: load(file, \*, fix_imports=True, encoding="ASCII", errors="strict", buffers=None)
+.. function:: load(file, *, fix_imports=True, encoding="ASCII", errors="strict", buffers=None)
 
    Read the pickled representation of an object from the open :term:`file object`
    *file* and return the reconstituted object hierarchy specified therein.
@@ -252,7 +252,7 @@
    .. versionchanged:: 3.8
       The *buffers* argument was added.
 
-.. function:: loads(data, /, \*, fix_imports=True, encoding="ASCII", errors="strict", buffers=None)
+.. function:: loads(data, /, *, fix_imports=True, encoding="ASCII", errors="strict", buffers=None)
 
    Return the reconstituted object hierarchy of the pickled representation
    *data* of an object. *data* must be a :term:`bytes-like object`.
@@ -296,7 +296,7 @@
 The :mod:`pickle` module exports three classes, :class:`Pickler`,
 :class:`Unpickler` and :class:`PickleBuffer`:
 
-.. class:: Pickler(file, protocol=None, \*, fix_imports=True, buffer_callback=None)
+.. class:: Pickler(file, protocol=None, *, fix_imports=True, buffer_callback=None)
 
    This takes a binary file for writing a pickle data stream.
 
@@ -391,7 +391,7 @@
       Use :func:`pickletools.optimize` if you need more compact pickles.
 
 
-.. class:: Unpickler(file, \*, fix_imports=True, encoding="ASCII", errors="strict", buffers=None)
+.. class:: Unpickler(file, *, fix_imports=True, encoding="ASCII", errors="strict", buffers=None)
 
    This takes a binary file for reading a pickle data stream.
 
diff --git a/Doc/library/pipes.rst b/Doc/library/pipes.rst
index 0a22da1..57e27a6 100644
--- a/Doc/library/pipes.rst
+++ b/Doc/library/pipes.rst
@@ -17,6 +17,8 @@
 Because the module uses :program:`/bin/sh` command lines, a POSIX or compatible
 shell for :func:`os.system` and :func:`os.popen` is required.
 
+.. availability:: Unix. Not available on VxWorks.
+
 The :mod:`pipes` module defines the following class:
 
 
diff --git a/Doc/library/platform.rst b/Doc/library/platform.rst
index b293adf..a0eece6 100644
--- a/Doc/library/platform.rst
+++ b/Doc/library/platform.rst
@@ -42,7 +42,7 @@
 
    .. note::
 
-      On Mac OS X (and perhaps other platforms), executable files may be
+      On macOS (and perhaps other platforms), executable files may be
       universal files containing multiple architectures.
 
       To get at the "64-bitness" of the current interpreter, it is more
@@ -225,13 +225,13 @@
    .. versionadded:: 3.8
 
 
-Mac OS Platform
----------------
+macOS Platform
+--------------
 
 
 .. function:: mac_ver(release='', versioninfo=('','',''), machine='')
 
-   Get Mac OS version information and return it as tuple ``(release, versioninfo,
+   Get macOS version information and return it as tuple ``(release, versioninfo,
    machine)`` with *versioninfo* being a tuple ``(version, dev_stage,
    non_release_version)``.
 
@@ -253,3 +253,41 @@
    using :program:`gcc`.
 
    The file is read and scanned in chunks of *chunksize* bytes.
+
+
+Linux Platforms
+---------------
+
+.. function:: freedesktop_os_release()
+
+   Get operating system identification from ``os-release`` file and return
+   it as a dict. The ``os-release`` file is a `freedesktop.org standard
+   <https://www.freedesktop.org/software/systemd/man/os-release.html>`_ and
+   is available in most Linux distributions. A noticeable exception is
+   Android and Android-based distributions.
+
+   Raises :exc:`OSError` or subclass when neither ``/etc/os-release`` nor
+   ``/usr/lib/os-release`` can be read.
+
+   On success, the function returns a dictionary where keys and values are
+   strings. Values have their special characters like ``"`` and ``$``
+   unquoted. The fields ``NAME``, ``ID``, and ``PRETTY_NAME`` are always
+   defined according to the standard. All other fields are optional. Vendors
+   may include additional fields.
+
+   Note that fields like ``NAME``, ``VERSION``, and ``VARIANT`` are strings
+   suitable for presentation to users. Programs should use fields like
+   ``ID``, ``ID_LIKE``, ``VERSION_ID``, or ``VARIANT_ID`` to identify
+   Linux distributions.
+
+   Example::
+
+      def get_like_distro():
+          info = platform.freedesktop_os_release()
+          ids = [info["ID"]]
+          if "ID_LIKE" in info:
+              # ids are space separated and ordered by precedence
+              ids.extend(info["ID_LIKE"].split())
+          return ids
+
+   .. versionadded:: 3.10
diff --git a/Doc/library/plistlib.rst b/Doc/library/plistlib.rst
index 6def72b..5ded966 100644
--- a/Doc/library/plistlib.rst
+++ b/Doc/library/plistlib.rst
@@ -52,7 +52,7 @@
 
 This module defines the following functions:
 
-.. function:: load(fp, \*, fmt=None, dict_type=dict)
+.. function:: load(fp, *, fmt=None, dict_type=dict)
 
    Read a plist file. *fp* should be a readable and binary file object.
    Return the unpacked root object (which usually is a
@@ -80,7 +80,7 @@
    .. versionadded:: 3.4
 
 
-.. function:: loads(data, \*, fmt=None, dict_type=dict)
+.. function:: loads(data, *, fmt=None, dict_type=dict)
 
    Load a plist from a bytes object. See :func:`load` for an explanation of
    the keyword arguments.
@@ -88,7 +88,7 @@
    .. versionadded:: 3.4
 
 
-.. function:: dump(value, fp, \*, fmt=FMT_XML, sort_keys=True, skipkeys=False)
+.. function:: dump(value, fp, *, fmt=FMT_XML, sort_keys=True, skipkeys=False)
 
    Write *value* to a plist file. *Fp* should be a writable, binary
    file object.
@@ -116,7 +116,7 @@
    .. versionadded:: 3.4
 
 
-.. function:: dumps(value, \*, fmt=FMT_XML, sort_keys=True, skipkeys=False)
+.. function:: dumps(value, *, fmt=FMT_XML, sort_keys=True, skipkeys=False)
 
    Return *value* as a plist-formatted bytes object. See
    the documentation for :func:`dump` for an explanation of the keyword
@@ -133,7 +133,7 @@
    encoded data, which contains UID (see PList manual).
 
    It has one attribute, :attr:`data`, which can be used to retrieve the int value
-   of the UID.  :attr:`data` must be in the range `0 <= data < 2**64`.
+   of the UID.  :attr:`data` must be in the range ``0 <= data < 2**64``.
 
    .. versionadded:: 3.8
 
diff --git a/Doc/library/posix.rst b/Doc/library/posix.rst
index 2105af9..ad417a1 100644
--- a/Doc/library/posix.rst
+++ b/Doc/library/posix.rst
@@ -37,7 +37,7 @@
 
 .. sectionauthor:: Steve Clift <clift@mail.anacapa.net>
 
-Several operating systems (including AIX, HP-UX, Irix and Solaris) provide
+Several operating systems (including AIX, HP-UX and Solaris) provide
 support for files that are larger than 2 GiB from a C programming model where
 :c:type:`int` and :c:type:`long` are 32-bit values. This is typically accomplished
 by defining the relevant size and offset types as 64-bit values. Such files are
@@ -47,8 +47,8 @@
 larger than a :c:type:`long` and the :c:type:`long long` is at least as large
 as an :c:type:`off_t`.
 It may be necessary to configure and compile Python with certain compiler flags
-to enable this mode. For example, it is enabled by default with recent versions
-of Irix, but with Solaris 2.6 and 2.7 you need to do something like::
+to enable this mode. For example, with Solaris 2.6 and 2.7 you need to do
+something like::
 
    CFLAGS="`getconf LFS_CFLAGS`" OPT="-g -O2 $CFLAGS" \
            ./configure
diff --git a/Doc/library/pprint.rst b/Doc/library/pprint.rst
index 16256c5..8f37450 100644
--- a/Doc/library/pprint.rst
+++ b/Doc/library/pprint.rst
@@ -28,6 +28,9 @@
 .. versionchanged:: 3.9
    Added support for pretty-printing :class:`types.SimpleNamespace`.
 
+.. versionchanged:: 3.10
+   Added support for pretty-printing :class:`dataclasses.dataclass`.
+
 The :mod:`pprint` module defines one class:
 
 .. First the implementation class:
@@ -36,26 +39,41 @@
 .. index:: single: ...; placeholder
 
 .. class:: PrettyPrinter(indent=1, width=80, depth=None, stream=None, *, \
-                         compact=False, sort_dicts=True)
+                         compact=False, sort_dicts=True, underscore_numbers=False)
 
    Construct a :class:`PrettyPrinter` instance.  This constructor understands
-   several keyword parameters.  An output stream may be set using the *stream*
-   keyword; the only method used on the stream object is the file protocol's
-   :meth:`write` method.  If not specified, the :class:`PrettyPrinter` adopts
-   ``sys.stdout``.  The
-   amount of indentation added for each recursive level is specified by *indent*;
-   the default is one.  Other values can cause output to look a little odd, but can
-   make nesting easier to spot.  The number of levels which may be printed is
-   controlled by *depth*; if the data structure being printed is too deep, the next
-   contained level is replaced by ``...``.  By default, there is no constraint on
-   the depth of the objects being formatted.  The desired output width is
-   constrained using the *width* parameter; the default is 80 characters.  If a
-   structure cannot be formatted within the constrained width, a best effort will
-   be made.  If *compact* is false (the default) each item of a long sequence
-   will be formatted on a separate line.  If *compact* is true, as many items
-   as will fit within the *width* will be formatted on each output line. If
-   *sort_dicts* is true (the default), dictionaries will be formatted with their
-   keys sorted, otherwise they will display in insertion order.
+   several keyword parameters.
+
+   *stream* (default ``sys.stdout``) is a :term:`file-like object` to
+   which the output will be written by calling its :meth:`write` method.
+
+   Other values configure the manner in which nesting of complex data
+   structures is displayed.
+
+   *indent* (default 1) specifies the amount of indentation added for
+   each nesting level.
+
+   *depth* controls the number of nesting levels which may be printed; if
+   the data structure being printed is too deep, the next contained level
+   is replaced by ``...``.  By default, there is no constraint on the
+   depth of the objects being formatted.
+
+   *width* (default 80) specifies the desired maximum number of characters per
+   line in the output. If a structure cannot be formatted within the width
+   constraint, a best effort will be made.
+
+   *compact* impacts the way that long sequences (lists, tuples, sets, etc)
+   are formatted. If *compact* is false (the default) then each item of a
+   sequence will be formatted on a separate line.  If *compact* is true, as
+   many items as will fit within the *width* will be formatted on each output
+   line.
+
+   If *sort_dicts* is true (the default), dictionaries will be formatted with
+   their keys sorted, otherwise they will display in insertion order.
+
+   If *underscore_numbers* is true, integers will be formatted with the
+   ``_`` character for a thousands separator, otherwise underscores are not
+   displayed (the default).
 
    .. versionchanged:: 3.4
       Added the *compact* parameter.
@@ -63,6 +81,8 @@
    .. versionchanged:: 3.8
       Added the *sort_dicts* parameter.
 
+   .. versionchanged:: 3.10
+      Added the *underscore_numbers* parameter.
 
       >>> import pprint
       >>> stuff = ['spam', 'eggs', 'lumberjack', 'knights', 'ni']
@@ -91,10 +111,10 @@
 The :mod:`pprint` module also provides several shortcut functions:
 
 .. function:: pformat(object, indent=1, width=80, depth=None, *, \
-                      compact=False, sort_dicts=True)
+                      compact=False, sort_dicts=True, underscore_numbers=False)
 
    Return the formatted representation of *object* as a string.  *indent*,
-   *width*, *depth*, *compact* and *sort_dicts* will be passed to the
+   *width*, *depth*, *compact*, *sort_dicts* and *underscore_numbers* will be passed to the
    :class:`PrettyPrinter` constructor as formatting parameters.
 
    .. versionchanged:: 3.4
@@ -103,6 +123,9 @@
    .. versionchanged:: 3.8
       Added the *sort_dicts* parameter.
 
+   .. versionchanged:: 3.10
+      Added the *underscore_numbers* parameter.
+
 
 .. function:: pp(object, *args, sort_dicts=False, **kwargs)
 
@@ -116,13 +139,13 @@
 
 
 .. function:: pprint(object, stream=None, indent=1, width=80, depth=None, *, \
-                     compact=False, sort_dicts=True)
+                     compact=False, sort_dicts=True, underscore_numbers=False)
 
    Prints the formatted representation of *object* on *stream*, followed by a
    newline.  If *stream* is ``None``, ``sys.stdout`` is used.  This may be used
    in the interactive interpreter instead of the :func:`print` function for
    inspecting values (you can even reassign ``print = pprint.pprint`` for use
-   within a scope).  *indent*, *width*, *depth*, *compact* and *sort_dicts* will
+   within a scope).  *indent*, *width*, *depth*, *compact*, *sort_dicts* and *underscore_numbers* will
    be passed to the :class:`PrettyPrinter` constructor as formatting parameters.
 
    .. versionchanged:: 3.4
@@ -131,6 +154,9 @@
    .. versionchanged:: 3.8
       Added the *sort_dicts* parameter.
 
+   .. versionchanged:: 3.10
+      Added the *underscore_numbers* parameter.
+
       >>> import pprint
       >>> stuff = ['spam', 'eggs', 'lumberjack', 'knights', 'ni']
       >>> stuff.insert(0, stuff)
diff --git a/Doc/library/profile.rst b/Doc/library/profile.rst
index 34525a9..cf324a5 100644
--- a/Doc/library/profile.rst
+++ b/Doc/library/profile.rst
@@ -525,16 +525,16 @@
       ordering are identical to the :meth:`~pstats.Stats.print_callers` method.
 
 
-    .. method:: get_stats_profile()
+   .. method:: get_stats_profile()
 
       This method returns an instance of StatsProfile, which contains a mapping
       of function names to instances of FunctionProfile. Each FunctionProfile
       instance holds information related to the function's profile such as how
       long the function took to run, how many times it was called, etc...
 
-       .. versionadded:: 3.9
-          Added the following dataclasses: StatsProfile, FunctionProfile.
-          Added the following function: get_stats_profile.
+      .. versionadded:: 3.9
+         Added the following dataclasses: StatsProfile, FunctionProfile.
+         Added the following function: get_stats_profile.
 
 .. _deterministic-profiling:
 
@@ -622,7 +622,7 @@
 The method executes the number of Python calls given by the argument, directly
 and again under the profiler, measuring the time for both. It then computes the
 hidden overhead per profiler event, and returns that as a float.  For example,
-on a 1.8Ghz Intel Core i5 running Mac OS X, and using Python's time.process_time() as
+on a 1.8Ghz Intel Core i5 running macOS, and using Python's time.process_time() as
 the timer, the magical number is about 4.04e-6.
 
 The object of this exercise is to get a fairly consistent result. If your
diff --git a/Doc/library/pty.rst b/Doc/library/pty.rst
index 73d4f10..7f4da41 100644
--- a/Doc/library/pty.rst
+++ b/Doc/library/pty.rst
@@ -2,8 +2,8 @@
 ========================================
 
 .. module:: pty
-   :platform: Linux
-   :synopsis: Pseudo-Terminal Handling for Linux.
+   :platform: Unix
+   :synopsis: Pseudo-Terminal Handling for Unix.
 
 .. moduleauthor:: Steen Lumholt
 .. sectionauthor:: Moshe Zadka <moshez@zadka.site.co.il>
@@ -16,9 +16,9 @@
 concept: starting another process and being able to write to and read from its
 controlling terminal programmatically.
 
-Because pseudo-terminal handling is highly platform dependent, there is code to
-do it only for Linux. (The Linux code is supposed to work on other platforms,
-but hasn't been tested yet.)
+Pseudo-terminal handling is highly platform dependent. This code is mainly
+tested on Linux, FreeBSD, and macOS (it is supposed to work on other POSIX
+platforms but it's not been thoroughly tested).
 
 The :mod:`pty` module defines the following functions:
 
@@ -47,10 +47,14 @@
    spawned behind the pty will eventually terminate, and when it does *spawn*
    will return.
 
+   A loop copies STDIN of the current process to the child and data received
+   from the child to STDOUT of the current process. It is not signaled to the
+   child if STDIN of the current process closes down.
+
    The functions *master_read* and *stdin_read* are passed a file descriptor
    which they should read from, and they should always return a byte string. In
    order to force spawn to return before the child process exits an
-   :exc:`OSError` should be thrown.
+   empty byte array should be returned to signal end of file.
 
    The default implementation for both functions will read and return up to 1024
    bytes each time the function is called. The *master_read* callback is passed
@@ -65,10 +69,6 @@
    process will quit without any input, *spawn* will then loop forever. If
    *master_read* signals EOF the same behavior results (on linux at least).
 
-   If both callbacks signal EOF then *spawn* will probably never return, unless
-   *select* throws an error on your platform when passed three empty lists. This
-   is a bug, documented in `issue 26228 <https://bugs.python.org/issue26228>`_.
-
    Return the exit status value from :func:`os.waitpid` on the child process.
 
    :func:`waitstatus_to_exitcode` can be used to convert the exit status into
diff --git a/Doc/library/py_compile.rst b/Doc/library/py_compile.rst
index cac6dcb..4fba4cb 100644
--- a/Doc/library/py_compile.rst
+++ b/Doc/library/py_compile.rst
@@ -125,21 +125,33 @@
       system external to Python like a build system.
 
 
-.. function:: main(args=None)
+Command-Line Interface
+----------------------
 
-   Compile several source files.  The files named in *args* (or on the command
-   line, if *args* is ``None``) are compiled and the resulting byte-code is
-   cached in the normal manner.  This function does not search a directory
-   structure to locate source files; it only compiles files named explicitly.
-   If ``'-'`` is the only parameter in args, the list of files is taken from
-   standard input.
+This module can be invoked as a script to compile several source
+files.  The files named in *filenames* are compiled and the resulting
+bytecode is cached in the normal manner.  This program does not search
+a directory structure to locate source files; it only compiles files
+named explicitly. The exit status is nonzero if one of the files could
+not be compiled.
 
-   .. versionchanged:: 3.2
-      Added support for ``'-'``.
+.. program:: python -m py_compile
 
-When this module is run as a script, the :func:`main` is used to compile all the
-files named on the command line.  The exit status is nonzero if one of the files
-could not be compiled.
+.. cmdoption:: <file> ... <fileN>
+               -
+
+   Positional arguments are files to compile.  If ``-`` is the only
+   parameter, the list of files is taken from standard input.
+
+.. cmdoption:: -q, --quiet
+
+   Suppress errors output.
+
+.. versionchanged:: 3.2
+   Added support for ``-``.
+
+.. versionchanged:: 3.10
+   Added support for :option:`-q`.
 
 
 .. seealso::
diff --git a/Doc/library/pyclbr.rst b/Doc/library/pyclbr.rst
index 36e83e8..1c40ba4 100644
--- a/Doc/library/pyclbr.rst
+++ b/Doc/library/pyclbr.rst
@@ -97,6 +97,13 @@
    .. versionadded:: 3.7
 
 
+.. attribute:: Function.is_async
+
+   ``True`` for functions that are defined with the ``async`` prefix, ``False`` otherwise.
+
+   .. versionadded:: 3.10
+
+
 .. _pyclbr-class-objects:
 
 Class Objects
diff --git a/Doc/library/pydoc.rst b/Doc/library/pydoc.rst
index f956b9d..94daf4a 100644
--- a/Doc/library/pydoc.rst
+++ b/Doc/library/pydoc.rst
@@ -18,7 +18,7 @@
 
 The :mod:`pydoc` module automatically generates documentation from Python
 modules.  The documentation can be presented as pages of text on the console,
-served to a Web browser, or saved to HTML files.
+served to a web browser, or saved to HTML files.
 
 For modules, classes, functions and methods, the displayed documentation is
 derived from the docstring (i.e. the :attr:`__doc__` attribute) of the object,
@@ -65,9 +65,9 @@
 module is the first line of its documentation string.
 
 You can also use :program:`pydoc` to start an HTTP server on the local machine
-that will serve documentation to visiting Web browsers.  :program:`pydoc -p 1234`
+that will serve documentation to visiting web browsers.  :program:`pydoc -p 1234`
 will start a HTTP server on port 1234, allowing you to browse the
-documentation at ``http://localhost:1234/`` in your preferred Web browser.
+documentation at ``http://localhost:1234/`` in your preferred web browser.
 Specifying ``0`` as the port number will select an arbitrary unused port.
 
 :program:`pydoc -n <hostname>` will start the server listening at the given
diff --git a/Doc/library/pyexpat.rst b/Doc/library/pyexpat.rst
index e43b9ae..034e579 100644
--- a/Doc/library/pyexpat.rst
+++ b/Doc/library/pyexpat.rst
@@ -665,14 +665,14 @@
 
 .. data:: codes
 
-   A dictionary mapping numeric error codes to their string descriptions.
+   A dictionary mapping string descriptions to their error codes.
 
    .. versionadded:: 3.2
 
 
 .. data:: messages
 
-   A dictionary mapping string descriptions to their error codes.
+   A dictionary mapping numeric error codes to their string descriptions.
 
    .. versionadded:: 3.2
 
diff --git a/Doc/library/queue.rst b/Doc/library/queue.rst
index 0ec5900..cbf27d2 100644
--- a/Doc/library/queue.rst
+++ b/Doc/library/queue.rst
@@ -201,15 +201,14 @@
             print(f'Finished {item}')
             q.task_done()
 
-    # turn-on the worker thread
+    # Turn-on the worker thread.
     threading.Thread(target=worker, daemon=True).start()
 
-    # send thirty task requests to the worker
+    # Send thirty task requests to the worker.
     for item in range(30):
         q.put(item)
-    print('All task requests sent\n', end='')
 
-    # block until all tasks are done
+    # Block until all tasks are done.
     q.join()
     print('All work completed')
 
diff --git a/Doc/library/random.rst b/Doc/library/random.rst
index 8154dfc..b9c33af 100644
--- a/Doc/library/random.rst
+++ b/Doc/library/random.rst
@@ -135,6 +135,16 @@
       values.  Formerly it used a style like ``int(random()*n)`` which could produce
       slightly uneven distributions.
 
+   .. deprecated:: 3.10
+      The automatic conversion of non-integer types to equivalent integers is
+      deprecated.  Currently ``randrange(10.0)`` is losslessly converted to
+      ``randrange(10)``.  In the future, this will raise a :exc:`TypeError`.
+
+   .. deprecated:: 3.10
+      The exception raised for non-integral values such as ``randrange(10.5)``
+      or ``randrange('10')`` will be changed from :exc:`ValueError` to
+      :exc:`TypeError`.
+
 .. function:: randint(a, b)
 
    Return a random integer *N* such that ``a <= N <= b``.  Alias for
@@ -142,10 +152,11 @@
 
 .. function:: getrandbits(k)
 
-   Returns a Python integer with *k* random bits. This method is supplied with
-   the MersenneTwister generator and some other generators may also provide it
-   as an optional part of the API. When available, :meth:`getrandbits` enables
-   :meth:`randrange` to handle arbitrarily large ranges.
+   Returns a non-negative Python integer with *k* random bits. This method
+   is supplied with the MersenneTwister generator and some other generators
+   may also provide it as an optional part of the API. When available,
+   :meth:`getrandbits` enables :meth:`randrange` to handle arbitrarily large
+   ranges.
 
    .. versionchanged:: 3.9
       This method now accepts zero for *k*.
@@ -180,8 +191,8 @@
 
    The *weights* or *cum_weights* can use any numeric type that interoperates
    with the :class:`float` values returned by :func:`random` (that includes
-   integers, floats, and fractions but excludes decimals).  Behavior is
-   undefined if any weight is negative.  A :exc:`ValueError` is raised if all
+   integers, floats, and fractions but excludes decimals).  Weights are assumed
+   to be non-negative and finite.  A :exc:`ValueError` is raised if all
    weights are zero.
 
    For a given seed, the :func:`choices` function with equal weighting
@@ -315,9 +326,9 @@
 
 .. function:: gauss(mu, sigma)
 
-   Gaussian distribution.  *mu* is the mean, and *sigma* is the standard
-   deviation.  This is slightly faster than the :func:`normalvariate` function
-   defined below.
+   Normal distribution, also called the Gaussian distribution.  *mu* is the mean,
+   and *sigma* is the standard deviation.  This is slightly faster than
+   the :func:`normalvariate` function defined below.
 
    Multithreading note:  When two threads call this function
    simultaneously, it is possible that they will receive the
@@ -408,7 +419,7 @@
    >>> random()                             # Random float:  0.0 <= x < 1.0
    0.37444887175646646
 
-   >>> uniform(2.5, 10.0)                   # Random float:  2.5 <= x < 10.0
+   >>> uniform(2.5, 10.0)                   # Random float:  2.5 <= x <= 10.0
    3.1800146073117523
 
    >>> expovariate(1 / 5)                   # Interval between arrivals averaging 5 seconds
@@ -501,9 +512,9 @@
 
 Simulation of arrival times and service deliveries for a multiserver queue::
 
-    from heapq import heappush, heappop
+    from heapq import heapify, heapreplace
     from random import expovariate, gauss
-    from statistics import mean, median, stdev
+    from statistics import mean, quantiles
 
     average_arrival_interval = 5.6
     average_service_time = 15.0
@@ -513,17 +524,18 @@
     waits = []
     arrival_time = 0.0
     servers = [0.0] * num_servers  # time when each server becomes available
-    for i in range(100_000):
+    heapify(servers)
+    for i in range(1_000_000):
         arrival_time += expovariate(1.0 / average_arrival_interval)
-        next_server_available = heappop(servers)
+        next_server_available = servers[0]
         wait = max(0.0, next_server_available - arrival_time)
         waits.append(wait)
-        service_duration = gauss(average_service_time, stdev_service_time)
+        service_duration = max(0.0, gauss(average_service_time, stdev_service_time))
         service_completed = arrival_time + wait + service_duration
-        heappush(servers, service_completed)
+        heapreplace(servers, service_completed)
 
-    print(f'Mean wait: {mean(waits):.1f}.  Stdev wait: {stdev(waits):.1f}.')
-    print(f'Median wait: {median(waits):.1f}.  Max wait: {max(waits):.1f}.')
+    print(f'Mean wait: {mean(waits):.1f}   Max wait: {max(waits):.1f}')
+    print('Quartiles:', [round(q, 1) for q in quantiles(waits)])
 
 .. seealso::
 
diff --git a/Doc/library/re.rst b/Doc/library/re.rst
index 9abbd8b..b12ce4b 100644
--- a/Doc/library/re.rst
+++ b/Doc/library/re.rst
@@ -824,10 +824,20 @@
 .. function:: findall(pattern, string, flags=0)
 
    Return all non-overlapping matches of *pattern* in *string*, as a list of
-   strings.  The *string* is scanned left-to-right, and matches are returned in
-   the order found.  If one or more groups are present in the pattern, return a
-   list of groups; this will be a list of tuples if the pattern has more than
-   one group.  Empty matches are included in the result.
+   strings or tuples.  The *string* is scanned left-to-right, and matches
+   are returned in the order found.  Empty matches are included in the result.
+
+   The result depends on the number of capturing groups in the pattern.
+   If there are no groups, return a list of strings matching the whole
+   pattern.  If there is exactly one group, return a list of strings
+   matching that group.  If multiple groups are present, return a list
+   of tuples of strings matching the groups.  Non-capturing groups do not
+   affect the form of the result.
+
+      >>> re.findall(r'\bf[a-z]*', 'which foot or hand fell fastest')
+      ['foot', 'fell', 'fastest']
+      >>> re.findall(r'(\w+)=(\d+)', 'set width=20 and height=10')
+      [('width', '20'), ('height', '10')]
 
    .. versionchanged:: 3.7
       Non-empty matches can now start just after a previous empty match.
@@ -931,8 +941,8 @@
    This is useful if you want to match an arbitrary literal string that may
    have regular expression metacharacters in it.  For example::
 
-      >>> print(re.escape('http://www.python.org'))
-      http://www\.python\.org
+      >>> print(re.escape('https://www.python.org'))
+      https://www\.python\.org
 
       >>> legal_chars = string.ascii_lowercase + string.digits + "!#$%&'*+-.^_`|~:"
       >>> print('[%s]+' % re.escape(legal_chars))
@@ -1562,7 +1572,7 @@
 the following manner::
 
    >>> text = "He was carefully disguised but captured quickly by police."
-   >>> re.findall(r"\w+ly", text)
+   >>> re.findall(r"\w+ly\b", text)
    ['carefully', 'quickly']
 
 
@@ -1576,7 +1586,7 @@
 some text, they would use :func:`finditer` in the following manner::
 
    >>> text = "He was carefully disguised but captured quickly by police."
-   >>> for m in re.finditer(r"\w+ly", text):
+   >>> for m in re.finditer(r"\w+ly\b", text):
    ...     print('%02d-%02d: %s' % (m.start(), m.end(), m.group(0)))
    07-16: carefully
    40-47: quickly
diff --git a/Doc/library/readline.rst b/Doc/library/readline.rst
index eae0a6d..4d485d2 100644
--- a/Doc/library/readline.rst
+++ b/Doc/library/readline.rst
@@ -258,7 +258,9 @@
    Get the beginning or ending index of the completion scope.
    These indexes are the *start* and *end* arguments passed to the
    :c:data:`rl_attempted_completion_function` callback of the
-   underlying library.
+   underlying library.  The values may be different in the same
+   input editing scenario based on the underlying C readline implementation.
+   Ex: libedit is known to behave differently than libreadline.
 
 
 .. function:: set_completer_delims(string)
diff --git a/Doc/library/resource.rst b/Doc/library/resource.rst
index e4eac43..67e9b44 100644
--- a/Doc/library/resource.rst
+++ b/Doc/library/resource.rst
@@ -241,7 +241,9 @@
    The maximum size (in bytes) of the swap space that may be reserved or
    used by all of this user id's processes.
    This limit is enforced only if bit 1 of the vm.overcommit sysctl is set.
-   Please see :manpage:`tuning(7)` for a complete description of this sysctl.
+   Please see
+   `tuning(7) <https://www.freebsd.org/cgi/man.cgi?query=tuning&sektion=7>`__
+   for a complete description of this sysctl.
 
    .. availability:: FreeBSD 9 or later.
 
@@ -255,6 +257,14 @@
 
    .. versionadded:: 3.4
 
+.. data:: RLIMIT_KQUEUES
+
+   The maximum number of kqueues this user id is allowed to create.
+
+   .. availability:: FreeBSD 11 or later.
+
+   .. versionadded:: 3.10
+
 Resource Usage
 --------------
 
diff --git a/Doc/library/security_warnings.rst b/Doc/library/security_warnings.rst
new file mode 100644
index 0000000..26b015c
--- /dev/null
+++ b/Doc/library/security_warnings.rst
@@ -0,0 +1,34 @@
+.. _security-warnings:
+
+.. index:: single: security considerations
+
+Security Considerations
+=======================
+
+The following modules have specific security considerations:
+
+* :mod:`base64`: :ref:`base64 security considerations <base64-security>` in
+  :rfc:`4648`
+* :mod:`cgi`: :ref:`CGI security considerations <cgi-security>`
+* :mod:`hashlib`: :ref:`all constructors take a "usedforsecurity" keyword-only
+  argument disabling known insecure and blocked algorithms
+  <hashlib-usedforsecurity>`
+* :mod:`http.server` is not suitable for production use, only implementing
+  basic security checks
+* :mod:`logging`: :ref:`Logging configuration uses eval()
+  <logging-eval-security>`
+* :mod:`multiprocessing`: :ref:`Connection.recv() uses pickle
+  <multiprocessing-recv-pickle-security>`
+* :mod:`pickle`: :ref:`Restricting globals in pickle <pickle-restrict>`
+* :mod:`random` shouldn't be used for security purposes, use :mod:`secrets`
+  instead
+* :mod:`shelve`: :ref:`shelve is based on pickle and thus unsuitable for
+  dealing with untrusted sources <shelve-security>`
+* :mod:`ssl`: :ref:`SSL/TLS security considerations <ssl-security>`
+* :mod:`subprocess`: :ref:`Subprocess security considerations
+  <subprocess-security>`
+* :mod:`tempfile`: :ref:`mktemp is deprecated due to vulnerability to race
+  conditions <tempfile-mktemp-deprecated>`
+* :mod:`xml`: :ref:`XML vulnerabilities <xml-vulnerabilities>`
+* :mod:`zipfile`: :ref:`maliciously prepared .zip files can cause disk volume
+  exhaustion <zipfile-resources-limitations>`
diff --git a/Doc/library/select.rst b/Doc/library/select.rst
index a354187..46b5ff8 100644
--- a/Doc/library/select.rst
+++ b/Doc/library/select.rst
@@ -534,7 +534,7 @@
    | :const:`KQ_FILTER_PROC`   | Watch for events on a process id            |
    +---------------------------+---------------------------------------------+
    | :const:`KQ_FILTER_NETDEV` | Watch for events on a network device        |
-   |                           | [not available on Mac OS X]                 |
+   |                           | [not available on macOS]                    |
    +---------------------------+---------------------------------------------+
    | :const:`KQ_FILTER_SIGNAL` | Returns whenever the watched signal is      |
    |                           | delivered to the process                    |
@@ -626,7 +626,7 @@
    | :const:`KQ_NOTE_TRACKERR`  | unable to attach to a child                |
    +----------------------------+--------------------------------------------+
 
-   :const:`KQ_FILTER_NETDEV` filter flags (not available on Mac OS X):
+   :const:`KQ_FILTER_NETDEV` filter flags (not available on macOS):
 
    +----------------------------+--------------------------------------------+
    | Constant                   | Meaning                                    |
diff --git a/Doc/library/shelve.rst b/Doc/library/shelve.rst
index f08c581..684f239 100644
--- a/Doc/library/shelve.rst
+++ b/Doc/library/shelve.rst
@@ -25,8 +25,9 @@
    database file is opened for reading and writing.  The optional *flag* parameter
    has the same interpretation as the *flag* parameter of :func:`dbm.open`.
 
-   By default, version 3 pickles are used to serialize values.  The version of the
-   pickle protocol can be specified with the *protocol* parameter.
+   By default, pickles created with :data:`pickle.DEFAULT_PROTOCOL` are used
+   to serialize values.  The version of the pickle protocol can be specified
+   with the *protocol* parameter.
 
    Because of Python semantics, a shelf cannot know when a mutable
    persistent-dictionary entry is modified.  By default modified objects are
@@ -40,6 +41,10 @@
    determine which accessed entries are mutable, nor which ones were actually
    mutated).
 
+   .. versionchanged:: 3.10
+      :data:`pickle.DEFAULT_PROTOCOL` is now used as the default pickle
+      protocol.
+
    .. note::
 
       Do not rely on the shelf being closed automatically; always call
@@ -49,13 +54,16 @@
           with shelve.open('spam') as db:
               db['eggs'] = 'eggs'
 
+.. _shelve-security:
+
 .. warning::
 
    Because the :mod:`shelve` module is backed by :mod:`pickle`, it is insecure
    to load a shelf from an untrusted source.  Like with pickle, loading a shelf
    can execute arbitrary code.
 
-Shelf objects support all methods supported by dictionaries.  This eases the
+Shelf objects support most of methods and operations supported by dictionaries
+(except copying, constructors and operators ``|`` and ``|=``).  This eases the
 transition from dictionary based scripts to those requiring persistent storage.
 
 Two additional methods are supported:
@@ -108,9 +116,10 @@
    A subclass of :class:`collections.abc.MutableMapping` which stores pickled
    values in the *dict* object.
 
-   By default, version 3 pickles are used to serialize values.  The version of the
-   pickle protocol can be specified with the *protocol* parameter. See the
-   :mod:`pickle` documentation for a discussion of the pickle protocols.
+   By default, pickles created with :data:`pickle.DEFAULT_PROTOCOL` are used
+   to serialize values.  The version of the pickle protocol can be specified
+   with the *protocol* parameter.  See the :mod:`pickle` documentation for a
+   discussion of the pickle protocols.
 
    If the *writeback* parameter is ``True``, the object will hold a cache of all
    entries accessed and write them back to the *dict* at sync and close times.
@@ -130,6 +139,10 @@
    .. versionchanged:: 3.4
       Added context manager support.
 
+   .. versionchanged:: 3.10
+      :data:`pickle.DEFAULT_PROTOCOL` is now used as the default pickle
+      protocol.
+
 
 .. class:: BsdDbShelf(dict, protocol=None, writeback=False, keyencoding='utf-8')
 
diff --git a/Doc/library/shlex.rst b/Doc/library/shlex.rst
index 7f7f0c7..aab6a54 100644
--- a/Doc/library/shlex.rst
+++ b/Doc/library/shlex.rst
@@ -61,6 +61,20 @@
    string that can safely be used as one token in a shell command line, for
    cases where you cannot use a list.
 
+   .. _shlex-quote-warning:
+
+   .. warning::
+
+      The ``shlex`` module is **only designed for Unix shells**.
+
+      The :func:`quote` function is not guaranteed to be correct on non-POSIX
+      compliant shells or shells from other operating systems such as Windows.
+      Executing commands quoted by this module on such shells can open up the
+      possibility of a command injection vulnerability.
+
+      Consider using functions that pass command arguments with lists such as
+      :func:`subprocess.run` with ``shell=False``.
+
    This idiom would be unsafe:
 
       >>> filename = 'somefile; rm -rf ~'
diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst
index 3f51227..11c6707 100644
--- a/Doc/library/shutil.rst
+++ b/Doc/library/shutil.rst
@@ -218,7 +218,7 @@
       copy the file more efficiently. See
       :ref:`shutil-platform-dependent-efficient-copy-operations` section.
 
-.. function:: ignore_patterns(\*patterns)
+.. function:: ignore_patterns(*patterns)
 
    This factory function creates a function that can be used as a callable for
    :func:`copytree`\'s *ignore* argument, ignoring files and directories that
@@ -443,8 +443,9 @@
 Platform-dependent efficient copy operations
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-Starting from Python 3.8 all functions involving a file copy (:func:`copyfile`,
-:func:`copy`, :func:`copy2`, :func:`copytree`, and :func:`move`) may use
+Starting from Python 3.8, all functions involving a file copy
+(:func:`copyfile`, :func:`~shutil.copy`, :func:`copy2`,
+:func:`copytree`, and :func:`move`) may use
 platform-specific "fast-copy" syscalls in order to copy the file more
 efficiently (see :issue:`33671`).
 "fast-copy" means that the copying operation occurs within the kernel, avoiding
@@ -594,6 +595,10 @@
 
    .. audit-event:: shutil.make_archive base_name,format,root_dir,base_dir shutil.make_archive
 
+   .. note::
+
+      This function is not thread-safe.
+
    .. versionchanged:: 3.8
       The modern pax (POSIX.1-2001) format is now used instead of
       the legacy GNU format for archives created with ``format="tar"``.
diff --git a/Doc/library/signal.rst b/Doc/library/signal.rst
index e1daeff..84a569d 100644
--- a/Doc/library/signal.rst
+++ b/Doc/library/signal.rst
@@ -416,7 +416,7 @@
 
    :data:`SIGKILL` and :data:`SIGSTOP` cannot be blocked.
 
-   .. availability:: Unix.  See the man page :manpage:`sigprocmask(3)` and
+   .. availability:: Unix.  See the man page :manpage:`sigprocmask(2)` and
       :manpage:`pthread_sigmask(3)` for further information.
 
    See also :func:`pause`, :func:`sigpending` and :func:`sigwait`.
diff --git a/Doc/library/site.rst b/Doc/library/site.rst
index 2e3646f..e2ad3c4 100644
--- a/Doc/library/site.rst
+++ b/Doc/library/site.rst
@@ -32,7 +32,7 @@
 For the head part, it uses ``sys.prefix`` and ``sys.exec_prefix``; empty heads
 are skipped.  For the tail part, it uses the empty string and then
 :file:`lib/site-packages` (on Windows) or
-:file:`lib/python{X.Y}/site-packages` (on Unix and Macintosh).  For each
+:file:`lib/python{X.Y}/site-packages` (on Unix and macOS).  For each
 of the distinct head-tail combinations, it sees if it refers to an existing
 directory, and if so, adds it to ``sys.path`` and also inspects the newly
 added path for configuration files.
@@ -176,8 +176,8 @@
 
    Path to the user site-packages for the running Python.  Can be ``None`` if
    :func:`getusersitepackages` hasn't been called yet.  Default value is
-   :file:`~/.local/lib/python{X.Y}/site-packages` for UNIX and non-framework Mac
-   OS X builds, :file:`~/Library/Python/{X.Y}/lib/python/site-packages` for Mac
+   :file:`~/.local/lib/python{X.Y}/site-packages` for UNIX and non-framework
+   macOS builds, :file:`~/Library/Python/{X.Y}/lib/python/site-packages` for macOS
    framework builds, and :file:`{%APPDATA%}\\Python\\Python{XY}\\site-packages`
    on Windows.  This directory is a site directory, which means that
    :file:`.pth` files in it will be processed.
@@ -187,8 +187,8 @@
 
    Path to the base directory for the user site-packages.  Can be ``None`` if
    :func:`getuserbase` hasn't been called yet.  Default value is
-   :file:`~/.local` for UNIX and Mac OS X non-framework builds,
-   :file:`~/Library/Python/{X.Y}` for Mac framework builds, and
+   :file:`~/.local` for UNIX and macOS non-framework builds,
+   :file:`~/Library/Python/{X.Y}` for macOS framework builds, and
    :file:`{%APPDATA%}\\Python` for Windows.  This value is used by Distutils to
    compute the installation directories for scripts, data files, Python modules,
    etc. for the :ref:`user installation scheme <inst-alt-install-user>`.
diff --git a/Doc/library/smtpd.rst b/Doc/library/smtpd.rst
index d84e74a..803430f 100644
--- a/Doc/library/smtpd.rst
+++ b/Doc/library/smtpd.rst
@@ -13,11 +13,10 @@
 
 This module offers several classes to implement SMTP (email) servers.
 
-.. seealso::
-
-    The `aiosmtpd <http://aiosmtpd.readthedocs.io/>`_ package is a recommended
-    replacement for this module.  It is based on :mod:`asyncio` and provides a
-    more straightforward API.  :mod:`smtpd` should be considered deprecated.
+.. deprecated:: 3.6
+   The `aiosmtpd <https://aiosmtpd.readthedocs.io/>`_ package is a recommended
+   replacement for this module.  It is based on :mod:`asyncio` and provides a
+   more straightforward API.
 
 Several server implementations are present; one is a generic
 do-nothing implementation, which can be overridden, while the other two offer
diff --git a/Doc/library/smtplib.rst b/Doc/library/smtplib.rst
index c1a20fe..aaab6b1 100644
--- a/Doc/library/smtplib.rst
+++ b/Doc/library/smtplib.rst
@@ -15,7 +15,7 @@
 --------------
 
 The :mod:`smtplib` module defines an SMTP client session object that can be used
-to send mail to any Internet machine with an SMTP or ESMTP listener daemon.  For
+to send mail to any internet machine with an SMTP or ESMTP listener daemon.  For
 details of SMTP and ESMTP operation, consult :rfc:`821` (Simple Mail Transfer
 Protocol) and :rfc:`1869` (SMTP Service Extensions).
 
@@ -32,7 +32,7 @@
    than a success code, an :exc:`SMTPConnectError` is raised. The optional
    *timeout* parameter specifies a timeout in seconds for blocking operations
    like the connection attempt (if not specified, the global default timeout
-   setting will be used).  If the timeout expires, :exc:`socket.timeout` is
+   setting will be used).  If the timeout expires, :exc:`TimeoutError` is
    raised.  The optional source_address parameter allows binding
    to some specific source address in a machine with multiple network
    interfaces, and/or to some specific source TCP port. It takes a 2-tuple
@@ -279,9 +279,10 @@
    response for ESMTP option and store them for use by :meth:`has_extn`.
    Also sets several informational attributes: the message returned by
    the server is stored as the :attr:`ehlo_resp` attribute, :attr:`does_esmtp`
-   is set to true or false depending on whether the server supports ESMTP, and
-   :attr:`esmtp_features` will be a dictionary containing the names of the
-   SMTP service extensions this server supports, and their parameters (if any).
+   is set to ``True`` or ``False`` depending on whether the server supports
+   ESMTP, and :attr:`esmtp_features` will be a dictionary containing the names
+   of the SMTP service extensions this server supports, and their parameters
+   (if any).
 
    Unless you wish to use :meth:`has_extn` before sending mail, it should not be
    necessary to call this method explicitly.  It will be implicitly called by
diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst
index faf8a76..7ce8e5b 100755
--- a/Doc/library/socket.rst
+++ b/Doc/library/socket.rst
@@ -56,17 +56,17 @@
   bytes-like object can be used for either type of address when
   passing it as an argument.
 
-   .. versionchanged:: 3.3
-      Previously, :const:`AF_UNIX` socket paths were assumed to use UTF-8
-      encoding.
+  .. versionchanged:: 3.3
+     Previously, :const:`AF_UNIX` socket paths were assumed to use UTF-8
+     encoding.
 
-   .. versionchanged:: 3.5
-      Writable :term:`bytes-like object` is now accepted.
+  .. versionchanged:: 3.5
+     Writable :term:`bytes-like object` is now accepted.
 
 .. _host_port:
 
 - A pair ``(host, port)`` is used for the :const:`AF_INET` address family,
-  where *host* is a string representing either a hostname in Internet domain
+  where *host* is a string representing either a hostname in internet domain
   notation like ``'daring.cwi.nl'`` or an IPv4 address like ``'100.50.200.5'``,
   and *port* is an integer.
 
@@ -197,11 +197,15 @@
   - *addr* - Optional bytes-like object specifying the hardware physical
     address, whose interpretation depends on the device.
 
+   .. availability:: Linux >= 2.2.
+
 - :const:`AF_QIPCRTR` is a Linux-only socket based interface for communicating
   with services running on co-processors in Qualcomm platforms. The address
   family is represented as a ``(node, port)`` tuple where the *node* and *port*
   are non-negative integers.
 
+   .. availability:: Linux >= 4.7.
+
   .. versionadded:: 3.8
 
 - :const:`IPPROTO_UDPLITE` is a variant of UDP which allows you to specify
@@ -283,6 +287,8 @@
 
 .. exception:: timeout
 
+   A deprecated alias of :exc:`TimeoutError`.
+
    A subclass of :exc:`OSError`, this exception is raised when a timeout
    occurs on a socket which has had timeouts enabled via a prior call to
    :meth:`~socket.settimeout` (or implicitly through
@@ -292,6 +298,9 @@
    .. versionchanged:: 3.3
       This class was made a subclass of :exc:`OSError`.
 
+   .. versionchanged:: 3.10
+      This class was made an alias of :exc:`TimeoutError`.
+
 
 Constants
 ^^^^^^^^^
@@ -374,6 +383,11 @@
       On Windows, ``TCP_KEEPIDLE``, ``TCP_KEEPINTVL`` appear if run-time Windows
       supports.
 
+   .. versionchanged:: 3.10
+      ``IP_RECVTOS`` was added.
+       Added ``TCP_KEEPALIVE``. On MacOS this constant can be used in the same
+       way that ``TCP_KEEPIDLE`` is used on Linux.
+
 .. data:: AF_CAN
           PF_CAN
           SOL_CAN_*
@@ -506,7 +520,7 @@
 
 .. data:: AF_LINK
 
-  .. availability:: BSD, OSX.
+  .. availability:: BSD, macOS.
 
   .. versionadded:: 3.4
 
@@ -548,7 +562,7 @@
 The following functions all create :ref:`socket objects <socket-objects>`.
 
 
-.. function:: socket(family=AF_INET, type=SOCK_STREAM, proto=0, fileno=None)
+.. class:: socket(family=AF_INET, type=SOCK_STREAM, proto=0, fileno=None)
 
    Create a new socket using the given address family, socket type and protocol
    number.  The address family should be :const:`AF_INET` (the default),
@@ -605,6 +619,9 @@
    .. versionchanged:: 3.9
        The CAN_J1939 protocol was added.
 
+   .. versionchanged:: 3.10
+       The IPPROTO_MPTCP protocol was added.
+
 .. function:: socketpair([family[, type[, proto]]])
 
    Build a pair of connected socket objects using the given address family, socket
@@ -627,7 +644,7 @@
 
 .. function:: create_connection(address[, timeout[, source_address]])
 
-   Connect to a TCP service listening on the Internet *address* (a 2-tuple
+   Connect to a TCP service listening on the internet *address* (a 2-tuple
    ``(host, port)``), and return the socket object.  This is a higher-level
    function than :meth:`socket.connect`: if *host* is a non-numeric hostname,
    it will try to resolve it for both :data:`AF_INET` and :data:`AF_INET6`,
@@ -777,9 +794,9 @@
    system if IPv6 isn't enabled)::
 
       >>> socket.getaddrinfo("example.org", 80, proto=socket.IPPROTO_TCP)
-      [(<AddressFamily.AF_INET6: 10>, <SocketType.SOCK_STREAM: 1>,
+      [(<AddressFamily.AF_INET6: 10>, <AddressFamily.SOCK_STREAM: 1>,
        6, '', ('2606:2800:220:1:248:1893:25c8:1946', 80, 0, 0)),
-       (<AddressFamily.AF_INET: 2>, <SocketType.SOCK_STREAM: 1>,
+       (<AddressFamily.AF_INET: 2>, <AddressFamily.SOCK_STREAM: 1>,
        6, '', ('93.184.216.34', 80))]
 
    .. versionchanged:: 3.2
@@ -795,8 +812,9 @@
    it is interpreted as the local host.  To find the fully qualified name, the
    hostname returned by :func:`gethostbyaddr` is checked, followed by aliases for the
    host, if available.  The first name which includes a period is selected.  In
-   case no fully qualified domain name is available, the hostname as returned by
-   :func:`gethostname` is returned.
+   case no fully qualified domain name is available and *name* was provided,
+   it is returned unchanged.  If *name* was empty or equal to ``'0.0.0.0'``,
+   the hostname from :func:`gethostname` is returned.
 
 
 .. function:: gethostbyname(hostname)
@@ -813,8 +831,8 @@
 .. function:: gethostbyname_ex(hostname)
 
    Translate a host name to IPv4 address format, extended interface. Return a
-   triple ``(hostname, aliaslist, ipaddrlist)`` where *hostname* is the primary
-   host name responding to the given *ip_address*, *aliaslist* is a (possibly
+   triple ``(hostname, aliaslist, ipaddrlist)`` where *hostname* is the host's
+   primary host name, *aliaslist* is a (possibly
    empty) list of alternative host names for the same address, and *ipaddrlist* is
    a list of IPv4 addresses for the same interface on the same host (often but not
    always a single address). :func:`gethostbyname_ex` does not support IPv6 name
@@ -864,7 +882,7 @@
 
 .. function:: getprotobyname(protocolname)
 
-   Translate an Internet protocol name (for example, ``'icmp'``) to a constant
+   Translate an internet protocol name (for example, ``'icmp'``) to a constant
    suitable for passing as the (optional) third argument to the :func:`.socket`
    function.  This is usually only needed for sockets opened in "raw" mode
    (:const:`SOCK_RAW`); for the normal socket modes, the correct protocol is chosen
@@ -873,7 +891,7 @@
 
 .. function:: getservbyname(servicename[, protocolname])
 
-   Translate an Internet service name and protocol name to a port number for that
+   Translate an internet service name and protocol name to a port number for that
    service.  The optional protocol name, if given, should be ``'tcp'`` or
    ``'udp'``, otherwise any protocol will match.
 
@@ -882,7 +900,7 @@
 
 .. function:: getservbyport(port[, protocolname])
 
-   Translate an Internet port number and protocol name to a service name for that
+   Translate an internet port number and protocol name to a service name for that
    service.  The optional protocol name, if given, should be ``'tcp'`` or
    ``'udp'``, otherwise any protocol will match.
 
@@ -902,11 +920,9 @@
    where the host byte order is the same as network byte order, this is a no-op;
    otherwise, it performs a 2-byte swap operation.
 
-   .. deprecated:: 3.7
-      In case *x* does not fit in 16-bit unsigned integer, but does fit in a
-      positive C int, it is silently truncated to 16-bit unsigned integer.
-      This silent truncation feature is deprecated, and will raise an
-      exception in future versions of Python.
+   .. versionchanged:: 3.10
+      Raises :exc:`OverflowError` if *x* does not fit in a 16-bit unsigned
+      integer.
 
 
 .. function:: htonl(x)
@@ -922,11 +938,9 @@
    where the host byte order is the same as network byte order, this is a no-op;
    otherwise, it performs a 2-byte swap operation.
 
-   .. deprecated:: 3.7
-      In case *x* does not fit in 16-bit unsigned integer, but does fit in a
-      positive C int, it is silently truncated to 16-bit unsigned integer.
-      This silent truncation feature is deprecated, and will raise an
-      exception in future versions of Python.
+   .. versionchanged:: 3.10
+      Raises :exc:`OverflowError` if *x* does not fit in a 16-bit unsigned
+      integer.
 
 
 .. function:: inet_aton(ip_string)
@@ -1139,6 +1153,32 @@
       "Interface name" is a name as documented in :func:`if_nameindex`.
 
 
+.. function:: send_fds(sock, buffers, fds[, flags[, address]])
+
+   Send the list of file descriptors *fds* over an :const:`AF_UNIX` socket *sock*.
+   The *fds* parameter is a sequence of file descriptors.
+   Consult :meth:`sendmsg` for the documentation of these parameters.
+
+   .. availability:: Unix supporting :meth:`~socket.sendmsg` and :const:`SCM_RIGHTS` mechanism.
+
+   .. versionadded:: 3.9
+
+
+.. function:: recv_fds(sock, bufsize, maxfds[, flags])
+
+   Receive up to *maxfds* file descriptors from an :const:`AF_UNIX` socket *sock*.
+   Return ``(msg, list(fds), flags, addr)``.
+   Consult :meth:`recvmsg` for the documentation of these parameters.
+
+   .. availability:: Unix supporting :meth:`~socket.recvmsg` and :const:`SCM_RIGHTS` mechanism.
+
+   .. versionadded:: 3.9
+
+   .. note::
+
+      Any truncated integers at the end of the list of file descriptors.
+
+
 .. _socket-objects:
 
 Socket Objects
@@ -1208,7 +1248,7 @@
    address family --- see above.)
 
    If the connection is interrupted by a signal, the method waits until the
-   connection completes, or raise a :exc:`socket.timeout` on timeout, if the
+   connection completes, or raise a :exc:`TimeoutError` on timeout, if the
    signal handler doesn't raise an exception and the socket is blocking or has
    a timeout. For non-blocking sockets, the method raises an
    :exc:`InterruptedError` exception if the connection is interrupted by a
@@ -1633,29 +1673,6 @@
 
    .. versionadded:: 3.6
 
-.. method:: socket.send_fds(sock, buffers, fds[, flags[, address]])
-
-   Send the list of file descriptors *fds* over an :const:`AF_UNIX` socket.
-   The *fds* parameter is a sequence of file descriptors.
-   Consult :meth:`sendmsg` for the documentation of these parameters.
-
-   .. availability:: Unix supporting :meth:`~socket.sendmsg` and :const:`SCM_RIGHTS` mechanism.
-
-   .. versionadded:: 3.9
-
-.. method:: socket.recv_fds(sock, bufsize, maxfds[, flags])
-
-   Receive up to *maxfds* file descriptors. Return ``(msg, list(fds), flags, addr)``. Consult
-   :meth:`recvmsg` for the documentation of these parameters.
-
-   .. availability:: Unix supporting :meth:`~socket.recvmsg` and :const:`SCM_RIGHTS` mechanism.
-
-   .. versionadded:: 3.9
-
-   .. note::
-
-      Any truncated integers at the end of the list of file descriptors.
-
 .. method:: socket.sendfile(file, offset=0, count=None)
 
    Send a file until EOF is reached by using high-performance
diff --git a/Doc/library/socketserver.rst b/Doc/library/socketserver.rst
index 232c061..b65a3e8 100644
--- a/Doc/library/socketserver.rst
+++ b/Doc/library/socketserver.rst
@@ -15,7 +15,7 @@
 
 .. class:: TCPServer(server_address, RequestHandlerClass, bind_and_activate=True)
 
-   This uses the Internet TCP protocol, which provides for
+   This uses the internet TCP protocol, which provides for
    continuous streams of data between the client and server.
    If *bind_and_activate* is true, the constructor automatically attempts to
    invoke :meth:`~BaseServer.server_bind` and
@@ -263,7 +263,7 @@
       The address on which the server is listening.  The format of addresses varies
       depending on the protocol family;
       see the documentation for the :mod:`socket` module
-      for details.  For Internet protocols, this is a tuple containing a string giving
+      for details.  For internet protocols, this is a tuple containing a string giving
       the address, and an integer port number: ``('127.0.0.1', 80)``, for example.
 
 
diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst
index ccb8227..e7c191b 100644
--- a/Doc/library/sqlite3.rst
+++ b/Doc/library/sqlite3.rst
@@ -17,78 +17,54 @@
 application using SQLite and then port the code to a larger database such as
 PostgreSQL or Oracle.
 
-The sqlite3 module was written by Gerhard Häring.  It provides a SQL interface
-compliant with the DB-API 2.0 specification described by :pep:`249`.
+The sqlite3 module was written by Gerhard Häring.  It provides an SQL interface
+compliant with the DB-API 2.0 specification described by :pep:`249`, and
+requires SQLite 3.7.15 or newer.
 
-To use the module, you must first create a :class:`Connection` object that
+To use the module, start by creating a :class:`Connection` object that
 represents the database.  Here the data will be stored in the
 :file:`example.db` file::
 
    import sqlite3
-   conn = sqlite3.connect('example.db')
+   con = sqlite3.connect('example.db')
 
-You can also supply the special name ``:memory:`` to create a database in RAM.
+The special path name ``:memory:`` can be provided to create a temporary
+database in RAM.
 
-Once you have a :class:`Connection`, you can create a :class:`Cursor`  object
+Once a :class:`Connection` has been established, create a :class:`Cursor` object
 and call its :meth:`~Cursor.execute` method to perform SQL commands::
 
-   c = conn.cursor()
+   cur = con.cursor()
 
    # Create table
-   c.execute('''CREATE TABLE stocks
-                (date text, trans text, symbol text, qty real, price real)''')
+   cur.execute('''CREATE TABLE stocks
+                  (date text, trans text, symbol text, qty real, price real)''')
 
    # Insert a row of data
-   c.execute("INSERT INTO stocks VALUES ('2006-01-05','BUY','RHAT',100,35.14)")
+   cur.execute("INSERT INTO stocks VALUES ('2006-01-05','BUY','RHAT',100,35.14)")
 
    # Save (commit) the changes
-   conn.commit()
+   con.commit()
 
    # We can also close the connection if we are done with it.
    # Just be sure any changes have been committed or they will be lost.
-   conn.close()
+   con.close()
 
-The data you've saved is persistent and is available in subsequent sessions::
+The saved data is persistent: it can be reloaded in a subsequent session even
+after restarting the Python interpreter::
 
    import sqlite3
-   conn = sqlite3.connect('example.db')
-   c = conn.cursor()
+   con = sqlite3.connect('example.db')
+   cur = con.cursor()
 
-Usually your SQL operations will need to use values from Python variables.  You
-shouldn't assemble your query using Python's string operations because doing so
-is insecure; it makes your program vulnerable to an SQL injection attack
-(see https://xkcd.com/327/ for humorous example of what can go wrong).
-
-Instead, use the DB-API's parameter substitution.  Put ``?`` as a placeholder
-wherever you want to use a value, and then provide a tuple of values as the
-second argument to the cursor's :meth:`~Cursor.execute` method.  (Other database
-modules may use a different placeholder, such as ``%s`` or ``:1``.) For
-example::
-
-   # Never do this -- insecure!
-   symbol = 'RHAT'
-   c.execute("SELECT * FROM stocks WHERE symbol = '%s'" % symbol)
-
-   # Do this instead
-   t = ('RHAT',)
-   c.execute('SELECT * FROM stocks WHERE symbol=?', t)
-   print(c.fetchone())
-
-   # Larger example that inserts many records at a time
-   purchases = [('2006-03-28', 'BUY', 'IBM', 1000, 45.00),
-                ('2006-04-05', 'BUY', 'MSFT', 1000, 72.00),
-                ('2006-04-06', 'SELL', 'IBM', 500, 53.00),
-               ]
-   c.executemany('INSERT INTO stocks VALUES (?,?,?,?,?)', purchases)
-
-To retrieve data after executing a SELECT statement, you can either treat the
-cursor as an :term:`iterator`, call the cursor's :meth:`~Cursor.fetchone` method to
-retrieve a single matching row, or call :meth:`~Cursor.fetchall` to get a list of the
-matching rows.
+To retrieve data after executing a SELECT statement, either treat the cursor as
+an :term:`iterator`, call the cursor's :meth:`~Cursor.fetchone` method to
+retrieve a single matching row, or call :meth:`~Cursor.fetchall` to get a list
+of the matching rows.
 
 This example uses the iterator form::
 
-   >>> for row in c.execute('SELECT * FROM stocks ORDER BY price'):
+   >>> for row in cur.execute('SELECT * FROM stocks ORDER BY price'):
            print(row)
 
    ('2006-01-05', 'BUY', 'RHAT', 100, 35.14)
@@ -97,11 +73,34 @@
    ('2006-04-05', 'BUY', 'MSFT', 1000, 72.0)
 
 
-.. seealso::
+.. _sqlite3-placeholders:
 
-   https://github.com/ghaering/pysqlite
-      The pysqlite web page -- sqlite3 is developed externally under the name
-      "pysqlite".
+SQL operations usually need to use values from Python variables. However,
+beware of using Python's string operations to assemble queries, as they
+are vulnerable to SQL injection attacks (see the `xkcd webcomic
+<https://xkcd.com/327/>`_ for a humorous example of what can go wrong)::
+
+   # Never do this -- insecure!
+   symbol = 'RHAT'
+   cur.execute("SELECT * FROM stocks WHERE symbol = '%s'" % symbol)
+
+Instead, use the DB-API's parameter substitution. To insert a variable into a
+query string, use a placeholder in the string, and substitute the actual values
+into the query by providing them as a :class:`tuple` of values to the second
+argument of the cursor's :meth:`~Cursor.execute` method. An SQL statement may
+use one of two kinds of placeholders: question marks (qmark style) or named
+placeholders (named style). For the qmark style, ``parameters`` must be a
+:term:`sequence <sequence>`. For the named style, it can be either a
+:term:`sequence <sequence>` or :class:`dict` instance. The length of the
+:term:`sequence <sequence>` must match the number of placeholders, or a
+:exc:`ProgrammingError` is raised. If a :class:`dict` is given, it must contain
+keys for all named parameters. Any extra items are ignored. Here's an example of
+both styles:
+
+.. literalinclude:: ../includes/sqlite3/execute_1.py
+
+
+.. seealso::
 
    https://www.sqlite.org
       The SQLite web page; the documentation describes the syntax and the
@@ -120,6 +119,24 @@
 ------------------------------
 
 
+.. data:: apilevel
+
+   String constant stating the supported DB-API level. Required by the DB-API.
+   Hard-coded to ``"2.0"``.
+
+.. data:: paramstyle
+
+   String constant stating the type of parameter marker formatting expected by
+   the :mod:`sqlite3` module. Required by the DB-API. Hard-coded to
+   ``"qmark"``.
+
+   .. note::
+
+      The :mod:`sqlite3` module supports both ``qmark`` and ``numeric`` DB-API
+      parameter styles, because that is what the underlying SQLite library
+      supports. However, the DB-API does not allow multiple values for
+      the ``paramstyle`` attribute.
+
 .. data:: version
 
    The version number of this module, as a string. This is not the version of
@@ -142,6 +159,26 @@
    The version number of the run-time SQLite library, as a tuple of integers.
 
 
+.. data:: threadsafety
+
+   Integer constant required by the DB-API, stating the level of thread safety
+   the :mod:`sqlite3` module supports. Currently hard-coded to ``1``, meaning
+   *"Threads may share the module, but not connections."* However, this may not
+   always be true. You can check the underlying SQLite library's compile-time
+   threaded mode using the following query::
+
+     import sqlite3
+     con = sqlite3.connect(":memory:")
+     con.execute("""
+         select * from pragma_compile_options
+         where compile_options like 'THREADSAFE=%'
+     """).fetchall()
+
+   Note that the `SQLITE_THREADSAFE levels
+   <https://sqlite.org/compile.html#threadsafe>`_ do not match the DB-API 2.0
+   ``threadsafety`` levels.
+
+
 .. data:: PARSE_DECLTYPES
 
    This constant is meant to be used with the *detect_types* parameter of the
@@ -168,7 +205,7 @@
    does not include the type, i. e. if you use something like
    ``'as "Expiration date [datetime]"'`` in your SQL, then we will parse out
    everything until the first ``'['`` for the column name and strip
-   the preceeding space: the column name would simply be "Expiration date".
+   the preceding space: the column name would simply be "Expiration date".
 
 
 .. function:: connect(database[, timeout, detect_types, isolation_level, check_same_thread, factory, cached_statements, uri])
@@ -197,7 +234,9 @@
 
    *detect_types* defaults to 0 (i. e. off, no type detection), you can set it to
    any combination of :const:`PARSE_DECLTYPES` and :const:`PARSE_COLNAMES` to turn
-   type detection on.
+   type detection on. Due to SQLite behaviour, types can't be detected for generated
+   fields (for example ``max(data)``), even when *detect_types* parameter is set. In
+   such case, the returned type is :class:`str`.
 
    By default, *check_same_thread* is :const:`True` and only the creating thread may
    use the connection. If set :const:`False`, the returned connection may be shared
@@ -216,16 +255,31 @@
    for the connection, you can set the *cached_statements* parameter. The currently
    implemented default is to cache 100 statements.
 
-   If *uri* is true, *database* is interpreted as a URI. This allows you
-   to specify options. For example, to open a database in read-only mode
-   you can use::
+   If *uri* is :const:`True`, *database* is interpreted as a
+   :abbr:`URI (Uniform Resource Identifier)` with a file path and an optional
+   query string.  The scheme part *must* be ``"file:"``.  The path can be a
+   relative or absolute file path.  The query string allows us to pass
+   parameters to SQLite. Some useful URI tricks include::
 
-       db = sqlite3.connect('file:path/to/database?mode=ro', uri=True)
+       # Open a database in read-only mode.
+       con = sqlite3.connect("file:template.db?mode=ro", uri=True)
 
-   More information about this feature, including a list of recognized options, can
-   be found in the `SQLite URI documentation <https://www.sqlite.org/uri.html>`_.
+       # Don't implicitly create a new database file if it does not already exist.
+       # Will raise sqlite3.OperationalError if unable to open a database file.
+       con = sqlite3.connect("file:nosuchdb.db?mode=rw", uri=True)
+
+       # Create a shared named in-memory database.
+       con1 = sqlite3.connect("file:mem1?mode=memory&cache=shared", uri=True)
+       con2 = sqlite3.connect("file:mem1?mode=memory&cache=shared", uri=True)
+       con1.executescript("create table t(t); insert into t values(28);")
+       rows = con2.execute("select * from t").fetchall()
+
+   More information about this feature, including a list of recognized
+   parameters, can be found in the
+   `SQLite URI documentation <https://www.sqlite.org/uri.html>`_.
 
    .. audit-event:: sqlite3.connect database sqlite3.connect
+   .. audit-event:: sqlite3.connect/handle connection_handle sqlite3.connect
 
    .. versionchanged:: 3.4
       Added the *uri* parameter.
@@ -233,6 +287,9 @@
    .. versionchanged:: 3.7
       *database* can now also be a :term:`path-like object`, not only a string.
 
+   .. versionchanged:: 3.10
+      Added the ``sqlite3.connect/handle`` auditing event.
+
 
 .. function:: register_converter(typename, callable)
 
@@ -280,7 +337,7 @@
 
 .. class:: Connection
 
-   A SQLite database connection has the following attributes and methods:
+   An SQLite database connection has the following attributes and methods:
 
    .. attribute:: isolation_level
 
@@ -448,14 +505,22 @@
       Registers *trace_callback* to be called for each SQL statement that is
       actually executed by the SQLite backend.
 
-      The only argument passed to the callback is the statement (as string) that
-      is being executed. The return value of the callback is ignored. Note that
-      the backend does not only run statements passed to the :meth:`Cursor.execute`
-      methods.  Other sources include the transaction management of the Python
-      module and the execution of triggers defined in the current database.
+      The only argument passed to the callback is the statement (as
+      :class:`str`) that is being executed. The return value of the callback is
+      ignored. Note that the backend does not only run statements passed to the
+      :meth:`Cursor.execute` methods.  Other sources include the
+      :ref:`transaction management <sqlite3-controlling-transactions>` of the
+      sqlite3 module and the execution of triggers defined in the current
+      database.
 
       Passing :const:`None` as *trace_callback* will disable the trace callback.
 
+      .. note::
+         Exceptions raised in the trace callback are not propagated. As a
+         development and debugging aid, use
+         :meth:`~sqlite3.enable_callback_tracebacks` to enable printing
+         tracebacks from exceptions raised in the trace callback.
+
       .. versionadded:: 3.3
 
 
@@ -468,20 +533,30 @@
 
       Loadable extensions are disabled by default. See [#f1]_.
 
+      .. audit-event:: sqlite3.enable_load_extension connection,enabled sqlite3.enable_load_extension
+
       .. versionadded:: 3.2
 
+      .. versionchanged:: 3.10
+         Added the ``sqlite3.enable_load_extension`` auditing event.
+
       .. literalinclude:: ../includes/sqlite3/load_extension.py
 
    .. method:: load_extension(path)
 
-      This routine loads a SQLite extension from a shared library.  You have to
+      This routine loads an SQLite extension from a shared library.  You have to
       enable extension loading with :meth:`enable_load_extension` before you can
       use this routine.
 
       Loadable extensions are disabled by default. See [#f1]_.
 
+      .. audit-event:: sqlite3.load_extension connection,path sqlite3.load_extension
+
       .. versionadded:: 3.2
 
+      .. versionchanged:: 3.10
+         Added the ``sqlite3.load_extension`` auditing event.
+
    .. attribute:: row_factory
 
       You can change this attribute to a callable that accepts the cursor and the
@@ -507,8 +582,8 @@
 
       Using this attribute you can control what objects are returned for the ``TEXT``
       data type. By default, this attribute is set to :class:`str` and the
-      :mod:`sqlite3` module will return Unicode objects for ``TEXT``. If you want to
-      return bytestrings instead, you can set it to :class:`bytes`.
+      :mod:`sqlite3` module will return :class:`str` objects for ``TEXT``.
+      If you want to return :class:`bytes` instead, you can set it to :class:`bytes`.
 
       You can also set it to any other callable that accepts a single bytestring
       parameter and returns the resulting object.
@@ -543,9 +618,9 @@
          con.close()
 
 
-   .. method:: backup(target, *, pages=0, progress=None, name="main", sleep=0.250)
+   .. method:: backup(target, *, pages=-1, progress=None, name="main", sleep=0.250)
 
-      This method makes a backup of a SQLite database even while it's being accessed
+      This method makes a backup of an SQLite database even while it's being accessed
       by other clients, or concurrently by the same connection.  The copy will be
       written into the mandatory argument *target*, that must be another
       :class:`Connection` instance.
@@ -591,8 +666,6 @@
          dest = sqlite3.connect(':memory:')
          source.backup(dest)
 
-      Availability: SQLite 3.6.11 or higher
-
       .. versionadded:: 3.7
 
 
@@ -610,14 +683,8 @@
 
    .. method:: execute(sql[, parameters])
 
-      Executes an SQL statement. The SQL statement may be parameterized (i. e.
-      placeholders instead of SQL literals). The :mod:`sqlite3` module supports two
-      kinds of placeholders: question marks (qmark style) and named placeholders
-      (named style).
-
-      Here's an example of both styles:
-
-      .. literalinclude:: ../includes/sqlite3/execute_1.py
+      Executes an SQL statement. Values may be bound to the statement using
+      :ref:`placeholders <sqlite3-placeholders>`.
 
       :meth:`execute` will only execute a single SQL statement. If you try to execute
       more than one statement with it, it will raise a :exc:`.Warning`. Use
@@ -627,9 +694,10 @@
 
    .. method:: executemany(sql, seq_of_parameters)
 
-      Executes an SQL command against all parameter sequences or mappings found in
-      the sequence *seq_of_parameters*.  The :mod:`sqlite3` module also allows
-      using an :term:`iterator` yielding parameters instead of a sequence.
+      Executes a :ref:`parameterized <sqlite3-placeholders>` SQL command
+      against all parameter sequences or mappings found in the sequence
+      *seq_of_parameters*. The :mod:`sqlite3` module also allows using an
+      :term:`iterator` yielding parameters instead of a sequence.
 
       .. literalinclude:: ../includes/sqlite3/executemany_1.py
 
@@ -642,7 +710,8 @@
 
       This is a nonstandard convenience method for executing multiple SQL statements
       at once. It issues a ``COMMIT`` statement first, then executes the SQL script it
-      gets as a parameter.
+      gets as a parameter.  This method disregards :attr:`isolation_level`; any
+      transaction control must be added to *sql_script*.
 
       *sql_script* can be an instance of :class:`str`.
 
@@ -686,6 +755,14 @@
       The cursor will be unusable from this point forward; a :exc:`ProgrammingError`
       exception will be raised if any operation is attempted with the cursor.
 
+   .. method:: setinputsizes(sizes)
+
+      Required by the DB-API. Does nothing in :mod:`sqlite3`.
+
+   .. method:: setoutputsize(size [, column])
+
+      Required by the DB-API. Does nothing in :mod:`sqlite3`.
+
    .. attribute:: rowcount
 
       Although the :class:`Cursor` class of the :mod:`sqlite3` module implements this
@@ -701,19 +778,17 @@
       statements because we cannot determine the number of rows a query produced
       until all rows were fetched.
 
-      With SQLite versions before 3.6.5, :attr:`rowcount` is set to 0 if
-      you make a ``DELETE FROM table`` without any condition.
-
    .. attribute:: lastrowid
 
-      This read-only attribute provides the rowid of the last modified row. It is
-      only set if you issued an ``INSERT`` or a ``REPLACE`` statement using the
-      :meth:`execute` method.  For operations other than ``INSERT`` or
-      ``REPLACE`` or when :meth:`executemany` is called, :attr:`lastrowid` is
-      set to :const:`None`.
+      This read-only attribute provides the row id of the last inserted row. It
+      is only updated after successful ``INSERT`` or ``REPLACE`` statements
+      using the :meth:`execute` method.  For other statements, after
+      :meth:`executemany` or :meth:`executescript`, or if the insertion failed,
+      the value of ``lastrowid`` is left unchanged.  The initial value of
+      ``lastrowid`` is :const:`None`.
 
-      If the ``INSERT`` or ``REPLACE`` statement failed to insert the previous
-      successful rowid is returned.
+      .. note::
+         Inserts into ``WITHOUT ROWID`` tables are not recorded.
 
       .. versionchanged:: 3.6
          Added support for the ``REPLACE`` statement.
@@ -770,23 +845,23 @@
 
 Let's assume we initialize a table as in the example given above::
 
-   conn = sqlite3.connect(":memory:")
-   c = conn.cursor()
-   c.execute('''create table stocks
+   con = sqlite3.connect(":memory:")
+   cur = con.cursor()
+   cur.execute('''create table stocks
    (date text, trans text, symbol text,
     qty real, price real)''')
-   c.execute("""insert into stocks
-             values ('2006-01-05','BUY','RHAT',100,35.14)""")
-   conn.commit()
-   c.close()
+   cur.execute("""insert into stocks
+               values ('2006-01-05','BUY','RHAT',100,35.14)""")
+   con.commit()
+   cur.close()
 
 Now we plug :class:`Row` in::
 
-   >>> conn.row_factory = sqlite3.Row
-   >>> c = conn.cursor()
-   >>> c.execute('select * from stocks')
+   >>> con.row_factory = sqlite3.Row
+   >>> cur = con.cursor()
+   >>> cur.execute('select * from stocks')
    <sqlite3.Cursor object at 0x7f4e7dd8fa80>
-   >>> r = c.fetchone()
+   >>> r = cur.fetchone()
    >>> type(r)
    <class 'sqlite3.Row'>
    >>> tuple(r)
@@ -900,7 +975,7 @@
 +-------------+----------------------------------------------+
 
 The type system of the :mod:`sqlite3` module is extensible in two ways: you can
-store additional Python types in a SQLite database via object adaptation, and
+store additional Python types in an SQLite database via object adaptation, and
 you can let the :mod:`sqlite3` module convert SQLite types to different Python
 types via converters.
 
@@ -1014,6 +1089,12 @@
 numbers, its value will be truncated to microsecond precision by the
 timestamp converter.
 
+.. note::
+
+   The default "timestamp" converter ignores UTC offsets in the database and
+   always returns a naive :class:`datetime.datetime` object. To preserve UTC
+   offsets in timestamps, either leave converters disabled, or register an
+   offset-aware converter with :func:`register_converter`.
 
 .. _sqlite3-controlling-transactions:
 
@@ -1045,6 +1126,9 @@
 control the transaction state by explicitly issuing ``BEGIN``, ``ROLLBACK``,
 ``SAVEPOINT``, and ``RELEASE`` statements in your code.
 
+Note that :meth:`~Cursor.executescript` disregards
+:attr:`isolation_level`; any transaction control must be added explicitly.
+
 .. versionchanged:: 3.6
    :mod:`sqlite3` used to implicitly commit an open transaction before DDL
    statements.  This is no longer the case.
@@ -1091,23 +1175,10 @@
 .. literalinclude:: ../includes/sqlite3/ctx_manager.py
 
 
-Common issues
--------------
-
-Multithreading
-^^^^^^^^^^^^^^
-
-Older SQLite versions had issues with sharing connections between threads.
-That's why the Python module disallows sharing connections and cursors between
-threads. If you still try to do so, you will get an exception at runtime.
-
-The only exception is calling the :meth:`~Connection.interrupt` method, which
-only makes sense to call from a different thread.
-
 .. rubric:: Footnotes
 
 .. [#f1] The sqlite3 module is not built with loadable extension support by
-   default, because some platforms (notably Mac OS X) have SQLite
+   default, because some platforms (notably macOS) have SQLite
    libraries which are compiled without this feature. To get loadable
-   extension support, you must pass --enable-loadable-sqlite-extensions to
-   configure.
+   extension support, you must pass the
+   :option:`--enable-loadable-sqlite-extensions` option to configure.
diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst
index 852091c..3531cc3 100644
--- a/Doc/library/ssl.rst
+++ b/Doc/library/ssl.rst
@@ -18,15 +18,15 @@
 This module provides access to Transport Layer Security (often known as "Secure
 Sockets Layer") encryption and peer authentication facilities for network
 sockets, both client-side and server-side.  This module uses the OpenSSL
-library. It is available on all modern Unix systems, Windows, Mac OS X, and
+library. It is available on all modern Unix systems, Windows, macOS, and
 probably additional platforms, as long as OpenSSL is installed on that platform.
 
 .. note::
 
    Some behavior may be platform dependent, since calls are made to the
    operating system socket APIs.  The installed version of OpenSSL may also
-   cause variations in behavior. For example, TLSv1.1 and TLSv1.2 come with
-   openssl version 1.0.1.
+   cause variations in behavior. For example, TLSv1.3 with OpenSSL version
+   1.1.1.
 
 .. warning::
    Don't use this module without reading the :ref:`ssl-security`.  Doing so
@@ -58,6 +58,13 @@
    In the future the ssl module will require at least OpenSSL 1.0.2 or
    1.1.0.
 
+.. versionchanged:: 3.10
+
+   :pep:`644` has been implemented. The ssl module requires OpenSSL 1.1.1
+   or newer.
+
+   Use of deprecated constants and functions result in deprecation warnings.
+
 
 Functions, Constants, and Exceptions
 ------------------------------------
@@ -131,8 +138,9 @@
    :const:`None`, this function can choose to trust the system's default
    CA certificates instead.
 
-   The settings are: :data:`PROTOCOL_TLS`, :data:`OP_NO_SSLv2`, and
-   :data:`OP_NO_SSLv3` with high encryption cipher suites without RC4 and
+   The settings are: :data:`PROTOCOL_TLS_CLIENT` or
+   :data:`PROTOCOL_TLS_SERVER`, :data:`OP_NO_SSLv2`, and :data:`OP_NO_SSLv3`
+   with high encryption cipher suites without RC4 and
    without unauthenticated cipher suites. Passing :data:`~Purpose.SERVER_AUTH`
    as *purpose* sets :data:`~SSLContext.verify_mode` to :data:`CERT_REQUIRED`
    and either loads CA certificates (when at least one of *cafile*, *capath* or
@@ -180,6 +188,12 @@
 
       Support for key logging to :envvar:`SSLKEYLOGFILE` was added.
 
+   .. versionchanged:: 3.10
+
+      The context now uses :data:`PROTOCOL_TLS_CLIENT` or
+      :data:`PROTOCOL_TLS_SERVER` protocol instead of generic
+      :data:`PROTOCOL_TLS`.
+
 
 Exceptions
 ^^^^^^^^^^
@@ -325,19 +339,6 @@
    :func:`ssl.RAND_egd` and :func:`ssl.RAND_add` to increase the randomness of
    the pseudo-random number generator.
 
-.. function:: RAND_egd(path)
-
-   If you are running an entropy-gathering daemon (EGD) somewhere, and *path*
-   is the pathname of a socket connection open to it, this will read 256 bytes
-   of randomness from the socket, and add it to the SSL pseudo-random number
-   generator to increase the security of generated secret keys.  This is
-   typically only necessary on systems without better sources of randomness.
-
-   See http://egd.sourceforge.net/ or http://prngd.sourceforge.net/ for sources
-   of entropy-gathering daemons.
-
-   .. availability:: not available with LibreSSL and OpenSSL > 1.1.0.
-
 .. function:: RAND_add(bytes, entropy)
 
    Mix the given *bytes* into the SSL pseudo-random number generator.  The
@@ -425,7 +426,8 @@
       previously. Return an integer (no fractions of a second in the
       input format)
 
-.. function:: get_server_certificate(addr, ssl_version=PROTOCOL_TLS, ca_certs=None)
+.. function:: get_server_certificate(addr, ssl_version=PROTOCOL_TLS_CLIENT, \
+                                     ca_certs=None[, timeout])
 
    Given the address ``addr`` of an SSL-protected server, as a (*hostname*,
    *port-number*) pair, fetches the server's certificate, and returns it as a
@@ -435,7 +437,8 @@
    same format as used for the same parameter in
    :meth:`SSLContext.wrap_socket`.  The call will attempt to validate the
    server certificate against that set of root certificates, and will fail
-   if the validation attempt fails.
+   if the validation attempt fails.  A timeout can be specified with the
+   ``timeout`` parameter.
 
    .. versionchanged:: 3.3
       This function is now IPv6-compatible.
@@ -444,6 +447,9 @@
       The default *ssl_version* is changed from :data:`PROTOCOL_SSLv3` to
       :data:`PROTOCOL_TLS` for maximum compatibility with modern servers.
 
+   .. versionchanged:: 3.10
+      The *timeout* parameter was added.
+
 .. function:: DER_cert_to_PEM_cert(DER_cert_bytes)
 
    Given a certificate as a DER-encoded blob of bytes, returns a PEM-encoded
@@ -634,6 +640,13 @@
 
    .. versionadded:: 3.4
 
+.. data:: VERIFY_ALLOW_PROXY_CERTS
+
+   Possible value for :attr:`SSLContext.verify_flags` to enables proxy
+   certificate verification.
+
+   .. versionadded:: 3.10
+
 .. data:: VERIFY_X509_TRUSTED_FIRST
 
    Possible value for :attr:`SSLContext.verify_flags`. It instructs OpenSSL to
@@ -642,6 +655,17 @@
 
    .. versionadded:: 3.4.4
 
+.. data:: VERIFY_X509_PARTIAL_CHAIN
+
+   Possible value for :attr:`SSLContext.verify_flags`. It instructs OpenSSL to
+   accept intermediate CAs in the trust store to be treated as trust-anchors,
+   in the same way as the self-signed root CA certificates. This makes it
+   possible to trust certificates issued by an intermediate CA without having
+   to trust its ancestor root CA.
+
+   .. versionadded:: 3.10
+
+
 .. class:: VerifyFlags
 
    :class:`enum.IntFlag` collection of VERIFY_* constants.
@@ -655,19 +679,25 @@
 
    .. versionadded:: 3.6
 
+   .. deprecated:: 3.10
+
+      TLS clients and servers require different default settings for secure
+      communication. The generic TLS protocol constant is deprecated in
+      favor of :data:`PROTOCOL_TLS_CLIENT` and :data:`PROTOCOL_TLS_SERVER`.
+
 .. data:: PROTOCOL_TLS_CLIENT
 
-   Auto-negotiate the highest protocol version like :data:`PROTOCOL_TLS`,
-   but only support client-side :class:`SSLSocket` connections. The protocol
-   enables :data:`CERT_REQUIRED` and :attr:`~SSLContext.check_hostname` by
-   default.
+   Auto-negotiate the highest protocol version that both the client and
+   server support, and configure the context client-side connections. The
+   protocol enables :data:`CERT_REQUIRED` and
+   :attr:`~SSLContext.check_hostname` by default.
 
    .. versionadded:: 3.6
 
 .. data:: PROTOCOL_TLS_SERVER
 
-   Auto-negotiate the highest protocol version like :data:`PROTOCOL_TLS`,
-   but only support server-side :class:`SSLSocket` connections.
+   Auto-negotiate the highest protocol version that both the client and
+   server support, and configure the context server-side connections.
 
    .. versionadded:: 3.6
 
@@ -708,7 +738,10 @@
    .. deprecated:: 3.6
 
       OpenSSL has deprecated all version specific protocols. Use the default
-      protocol :data:`PROTOCOL_TLS` with flags like :data:`OP_NO_SSLv3` instead.
+      protocol :data:`PROTOCOL_TLS_SERVER` or :data:`PROTOCOL_TLS_CLIENT`
+      with :attr:`SSLContext.minimum_version` and
+      :attr:`SSLContext.maximum_version` instead.
+
 
 .. data:: PROTOCOL_TLSv1
 
@@ -716,8 +749,7 @@
 
    .. deprecated:: 3.6
 
-      OpenSSL has deprecated all version specific protocols. Use the default
-      protocol :data:`PROTOCOL_TLS` with flags like :data:`OP_NO_SSLv3` instead.
+      OpenSSL has deprecated all version specific protocols.
 
 .. data:: PROTOCOL_TLSv1_1
 
@@ -728,21 +760,18 @@
 
    .. deprecated:: 3.6
 
-      OpenSSL has deprecated all version specific protocols. Use the default
-      protocol :data:`PROTOCOL_TLS` with flags like :data:`OP_NO_SSLv3` instead.
+      OpenSSL has deprecated all version specific protocols.
 
 .. data:: PROTOCOL_TLSv1_2
 
-   Selects TLS version 1.2 as the channel encryption protocol. This is the
-   most modern version, and probably the best choice for maximum protection,
-   if both sides can speak it.  Available only with openssl version 1.0.1+.
+   Selects TLS version 1.2 as the channel encryption protocol.
+   Available only with openssl version 1.0.1+.
 
    .. versionadded:: 3.4
 
    .. deprecated:: 3.6
 
-      OpenSSL has deprecated all version specific protocols. Use the default
-      protocol :data:`PROTOCOL_TLS` with flags like :data:`OP_NO_SSLv3` instead.
+      OpenSSL has deprecated all version specific protocols.
 
 .. data:: OP_ALL
 
@@ -764,7 +793,6 @@
 
       SSLv2 is deprecated
 
-
 .. data:: OP_NO_SSLv3
 
    Prevents an SSLv3 connection.  This option is only applicable in
@@ -872,8 +900,6 @@
    Disable compression on the SSL channel.  This is useful if the application
    protocol supports its own compression scheme.
 
-   This option is only available with OpenSSL 1.0.0 and later.
-
    .. versionadded:: 3.3
 
 .. class:: Options
@@ -886,6 +912,14 @@
 
    .. versionadded:: 3.6
 
+.. data:: OP_IGNORE_UNEXPECTED_EOF
+
+   Ignore unexpected shutdown of TLS connections.
+
+   This option is only available with OpenSSL 3.0.0 and later.
+
+   .. versionadded:: 3.10
+
 .. data:: HAS_ALPN
 
    Whether the OpenSSL library has built-in support for the *Application-Layer
@@ -1022,7 +1056,7 @@
 
    Option for :func:`create_default_context` and
    :meth:`SSLContext.load_default_certs`.  This value indicates that the
-   context may be used to authenticate Web servers (therefore, it will
+   context may be used to authenticate web servers (therefore, it will
    be used to create client-side sockets).
 
    .. versionadded:: 3.4
@@ -1031,7 +1065,7 @@
 
    Option for :func:`create_default_context` and
    :meth:`SSLContext.load_default_certs`.  This value indicates that the
-   context may be used to authenticate Web clients (therefore, it will
+   context may be used to authenticate web clients (therefore, it will
    be used to create server-side sockets).
 
    .. versionadded:: 3.4
@@ -1064,6 +1098,11 @@
 
    SSL 3.0 to TLS 1.3.
 
+   .. deprecated:: 3.10
+
+      All :class:`TLSVersion` members except :attr:`TLSVersion.TLSv1_2` and
+      :attr:`TLSVersion.TLSv1_3` are deprecated.
+
 
 SSL Sockets
 -----------
@@ -1118,6 +1157,11 @@
       to create instances directly. This was never documented or officially
       supported.
 
+   .. versionchanged:: 3.10
+      Python now uses ``SSL_read_ex`` and ``SSL_write_ex`` internally. The
+      functions support reading and writing of data larger than 2 GB. Writing
+      zero-length data no longer fails with a protocol violation error.
+
 SSL sockets also have the following additional methods and attributes:
 
 .. method:: SSLSocket.read(len=1024, buffer=None)
@@ -1318,6 +1362,10 @@
 
    .. versionadded:: 3.3
 
+   .. deprecated:: 3.10
+
+      NPN has been superseded by ALPN
+
 .. method:: SSLSocket.unwrap()
 
    Performs the SSL shutdown handshake, which removes the TLS layer from the
@@ -1414,7 +1462,7 @@
 It also manages a cache of SSL sessions for server-side sockets, in order
 to speed up repeated connections from the same clients.
 
-.. class:: SSLContext(protocol=PROTOCOL_TLS)
+.. class:: SSLContext(protocol=None)
 
    Create a new SSL context.  You may pass *protocol* which must be one
    of the ``PROTOCOL_*`` constants defined in this module.  The parameter
@@ -1463,6 +1511,20 @@
       ciphers, no ``NULL`` ciphers and no ``MD5`` ciphers (except for
       :data:`PROTOCOL_SSLv2`).
 
+   .. deprecated:: 3.10
+
+      :class:`SSLContext` without protocol argument is deprecated. The
+      context class will either require :data:`PROTOCOL_TLS_CLIENT` or
+      :data:`PROTOCOL_TLS_SERVER` protocol in the future.
+
+   .. versionchanged:: 3.10
+
+      The default cipher suites now include only secure AES and ChaCha20
+      ciphers with forward secrecy and security level 2. RSA and DH keys with
+      less than 2048 bits and ECC keys with less than 224 bits are prohibited.
+      :data:`PROTOCOL_TLS`, :data:`PROTOCOL_TLS_CLIENT`, and
+      :data:`PROTOCOL_TLS_SERVER` use TLS 1.2 as minimum TLS version.
+
 
 :class:`SSLContext` objects have the following methods and attributes:
 
@@ -1514,7 +1576,7 @@
 
    Load a set of default "certification authority" (CA) certificates from
    default locations. On Windows it loads CA certs from the ``CA`` and
-   ``ROOT`` system stores. On other systems it calls
+   ``ROOT`` system stores. On all systems it calls
    :meth:`SSLContext.set_default_verify_paths`. In the future the method may
    load CA certificates from other locations, too.
 
@@ -1578,25 +1640,7 @@
 
        >>> ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
        >>> ctx.set_ciphers('ECDHE+AESGCM:!ECDSA')
-       >>> ctx.get_ciphers()  # OpenSSL 1.0.x
-       [{'alg_bits': 256,
-         'description': 'ECDHE-RSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH     Au=RSA  '
-                        'Enc=AESGCM(256) Mac=AEAD',
-         'id': 50380848,
-         'name': 'ECDHE-RSA-AES256-GCM-SHA384',
-         'protocol': 'TLSv1/SSLv3',
-         'strength_bits': 256},
-        {'alg_bits': 128,
-         'description': 'ECDHE-RSA-AES128-GCM-SHA256 TLSv1.2 Kx=ECDH     Au=RSA  '
-                        'Enc=AESGCM(128) Mac=AEAD',
-         'id': 50380847,
-         'name': 'ECDHE-RSA-AES128-GCM-SHA256',
-         'protocol': 'TLSv1/SSLv3',
-         'strength_bits': 128}]
-
-   On OpenSSL 1.1 and newer the cipher dict contains additional fields::
-
-       >>> ctx.get_ciphers()  # OpenSSL 1.1+
+       >>> ctx.get_ciphers()
        [{'aead': True,
          'alg_bits': 256,
          'auth': 'auth-rsa',
@@ -1622,8 +1666,6 @@
          'strength_bits': 128,
          'symmetric': 'aes-128-gcm'}]
 
-   .. availability:: OpenSSL 1.0.2+.
-
    .. versionadded:: 3.6
 
 .. method:: SSLContext.set_default_verify_paths()
@@ -1648,8 +1690,8 @@
       when connected, the :meth:`SSLSocket.cipher` method of SSL sockets will
       give the currently selected cipher.
 
-      OpenSSL 1.1.1 has TLS 1.3 cipher suites enabled by default. The suites
-      cannot be disabled with :meth:`~SSLContext.set_ciphers`.
+      TLS 1.3 cipher suites cannot be disabled with
+      :meth:`~SSLContext.set_ciphers`.
 
 .. method:: SSLContext.set_alpn_protocols(protocols)
 
@@ -1663,10 +1705,6 @@
    This method will raise :exc:`NotImplementedError` if :data:`HAS_ALPN` is
    ``False``.
 
-   OpenSSL 1.1.0 to 1.1.0e will abort the handshake and raise :exc:`SSLError`
-   when both sides support ALPN but cannot agree on a protocol. 1.1.0f+
-   behaves like 1.0.2, :meth:`SSLSocket.selected_alpn_protocol` returns None.
-
    .. versionadded:: 3.5
 
 .. method:: SSLContext.set_npn_protocols(protocols)
@@ -1684,6 +1722,10 @@
 
    .. versionadded:: 3.3
 
+   .. deprecated:: 3.10
+
+      NPN has been superseded by ALPN
+
 .. attribute:: SSLContext.sni_callback
 
    Register a callback function that will be called after the TLS Client Hello
@@ -1711,10 +1753,10 @@
    Due to the early negotiation phase of the TLS connection, only limited
    methods and attributes are usable like
    :meth:`SSLSocket.selected_alpn_protocol` and :attr:`SSLSocket.context`.
-   :meth:`SSLSocket.getpeercert`, :meth:`SSLSocket.getpeercert`,
-   :meth:`SSLSocket.cipher` and :meth:`SSLSocket.compress` methods require that
+   The :meth:`SSLSocket.getpeercert`,
+   :meth:`SSLSocket.cipher` and :meth:`SSLSocket.compression` methods require that
    the TLS connection has progressed beyond the TLS Client Hello and therefore
-   will not contain return meaningful values nor can they be called safely.
+   will not return meaningful values nor can they be called safely.
 
    The *sni_callback* function must return ``None`` to allow the
    TLS negotiation to continue.  If a TLS failure is required, a constant
@@ -1868,7 +1910,7 @@
 .. method:: SSLContext.session_stats()
 
    Get statistics about the SSL sessions created or managed by this context.
-   A dictionary is returned which maps the names of each `piece of information <https://www.openssl.org/docs/man1.1.0/ssl/SSL_CTX_sess_number.html>`_ to their
+   A dictionary is returned which maps the names of each `piece of information <https://www.openssl.org/docs/man1.1.1/ssl/SSL_CTX_sess_number.html>`_ to their
    numeric values.  For example, here is the total number of hits and misses
    in the session cache since the context was created::
 
@@ -1878,7 +1920,7 @@
 
 .. attribute:: SSLContext.check_hostname
 
-   Whether to match the peer cert's hostname with :func:`match_hostname` in
+   Whether to match the peer cert's hostname in
    :meth:`SSLSocket.do_handshake`. The context's
    :attr:`~SSLContext.verify_mode` must be set to :data:`CERT_OPTIONAL` or
    :data:`CERT_REQUIRED`, and you must pass *server_hostname* to
@@ -1911,10 +1953,6 @@
       :attr:`~SSLContext.verify_mode` is :data:`CERT_NONE`. Previously
       the same operation would have failed with a :exc:`ValueError`.
 
-   .. note::
-
-     This features requires OpenSSL 0.9.8f or newer.
-
 .. attribute:: SSLContext.keylog_filename
 
    Write TLS keys to a keylog file, whenever key material is generated or
@@ -1925,10 +1963,6 @@
 
    .. versionadded:: 3.8
 
-   .. note::
-
-     This features requires OpenSSL 1.1.1 or newer.
-
 .. attribute:: SSLContext.maximum_version
 
    A :class:`TLSVersion` enum member representing the highest supported
@@ -1945,11 +1979,6 @@
    :attr:`~SSLContext.maximum_version` set to :attr:`TLSVersion.TLSv1_2`
    will not be able to establish a TLS 1.2 connection.
 
-   .. note::
-
-     This attribute is not available unless the ssl module is compiled
-     with OpenSSL 1.1.0g or newer.
-
    .. versionadded:: 3.7
 
 .. attribute:: SSLContext.minimum_version
@@ -1957,24 +1986,14 @@
    Like :attr:`SSLContext.maximum_version` except it is the lowest
    supported version or :attr:`TLSVersion.MINIMUM_SUPPORTED`.
 
-   .. note::
-
-     This attribute is not available unless the ssl module is compiled
-     with OpenSSL 1.1.0g or newer.
-
    .. versionadded:: 3.7
 
 .. attribute:: SSLContext.num_tickets
 
    Control the number of TLS 1.3 session tickets of a
-   :attr:`TLS_PROTOCOL_SERVER` context. The setting has no impact on TLS
+   :attr:`PROTOCOL_TLS_SERVER` context. The setting has no impact on TLS
    1.0 to 1.2 connections.
 
-   .. note::
-
-     This attribute is not available unless the ssl module is compiled
-     with OpenSSL 1.1.1 or newer.
-
    .. versionadded:: 3.8
 
 .. attribute:: SSLContext.options
@@ -1983,17 +2002,18 @@
    The default value is :data:`OP_ALL`, but you can specify other options
    such as :data:`OP_NO_SSLv2` by ORing them together.
 
-   .. note::
-      With versions of OpenSSL older than 0.9.8m, it is only possible
-      to set options, not to clear them.  Attempting to clear an option
-      (by resetting the corresponding bits) will raise a :exc:`ValueError`.
-
    .. versionchanged:: 3.6
       :attr:`SSLContext.options` returns :class:`Options` flags:
 
          >>> ssl.create_default_context().options  # doctest: +SKIP
          <Options.OP_ALL|OP_NO_SSLv3|OP_NO_SSLv2|OP_NO_COMPRESSION: 2197947391>
 
+   .. deprecated:: 3.7
+
+      All ``OP_NO_SSL*`` and ``OP_NO_TLS*`` options have been deprecated since
+      Python 3.7. Use :attr:`SSLContext.minimum_version` and
+      :attr:`SSLContext.maximum_version` instead.
+
 .. attribute:: SSLContext.post_handshake_auth
 
    Enable TLS 1.3 post-handshake client authentication. Post-handshake auth
@@ -2010,10 +2030,6 @@
    :meth:`SSLSocket.verify_client_post_handshake` is called and some I/O is
    performed.
 
-   .. note::
-      Only available with OpenSSL 1.1.1 and TLS 1.3 enabled. Without TLS 1.3
-      support, the property value is None and can't be modified
-
    .. versionadded:: 3.8
 
 .. attribute:: SSLContext.protocol
@@ -2027,17 +2043,26 @@
    subject common name in the absence of a subject alternative name
    extension (default: true).
 
-   .. note::
-      Only writeable with OpenSSL 1.1.0 or higher.
-
    .. versionadded:: 3.7
 
+   .. versionchanged:: 3.10
+
+      The flag had no effect with OpenSSL before version 1.1.1k. Python 3.8.9,
+      3.9.3, and 3.10 include workarounds for previous versions.
+
+.. attribute:: SSLContext.security_level
+
+   An integer representing the `security level
+   <https://www.openssl.org/docs/manmaster/man3/SSL_CTX_get_security_level.html>`_
+   for the context. This attribute is read-only.
+
+   .. versionadded:: 3.10
+
 .. attribute:: SSLContext.verify_flags
 
    The flags for certificate verification operations. You can set flags like
    :data:`VERIFY_CRL_CHECK_LEAF` by ORing them together. By default OpenSSL
    does neither require nor verify certificate revocation lists (CRLs).
-   Available only with openssl version 0.9.8+.
 
    .. versionadded:: 3.4
 
@@ -2661,8 +2686,8 @@
 ::
 
    >>> client_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
-   >>> client_context.options |= ssl.OP_NO_TLSv1
-   >>> client_context.options |= ssl.OP_NO_TLSv1_1
+   >>> client_context.minimum_version = ssl.TLSVersion.TLSv1_3
+   >>> client_context.maximum_version = ssl.TLSVersion.TLSv1_3
 
 
 The SSL context created above will only allow TLSv1.2 and later (if
@@ -2703,9 +2728,8 @@
 
 .. versionadded:: 3.7
 
-Python has provisional and experimental support for TLS 1.3 with OpenSSL
-1.1.1.  The new protocol behaves slightly differently than previous version
-of TLS/SSL.  Some new TLS 1.3 features are not yet available.
+The TLS 1.3 protocol behaves slightly differently than previous version
+of TLS/SSL. Some new TLS 1.3 features are not yet available.
 
 - TLS 1.3 uses a disjunct set of cipher suites. All AES-GCM and
   ChaCha20 cipher suites are enabled by default.  The method
@@ -2722,23 +2746,6 @@
   signature algorithm configuration, and rekeying are not supported yet.
 
 
-.. _ssl-libressl:
-
-LibreSSL support
-----------------
-
-LibreSSL is a fork of OpenSSL 1.0.1. The ssl module has limited support for
-LibreSSL. Some features are not available when the ssl module is compiled
-with LibreSSL.
-
-* LibreSSL >= 2.6.1 no longer supports NPN. The methods
-  :meth:`SSLContext.set_npn_protocols` and
-  :meth:`SSLSocket.selected_npn_protocol` are not available.
-* :meth:`SSLContext.set_default_verify_paths` ignores the env vars
-  :envvar:`SSL_CERT_FILE` and :envvar:`SSL_CERT_PATH` although
-  :func:`get_default_verify_paths` still reports them.
-
-
 .. seealso::
 
    Class :class:`socket.socket`
diff --git a/Doc/library/stat.rst b/Doc/library/stat.rst
index f48a0a9..98219ea 100644
--- a/Doc/library/stat.rst
+++ b/Doc/library/stat.rst
@@ -372,11 +372,11 @@
 
 .. data:: UF_COMPRESSED
 
-   The file is stored compressed (Mac OS X 10.6+).
+   The file is stored compressed (macOS 10.6+).
 
 .. data:: UF_HIDDEN
 
-   The file should not be displayed in a GUI (Mac OS X 10.5+).
+   The file should not be displayed in a GUI (macOS 10.5+).
 
 .. data:: SF_ARCHIVED
 
@@ -398,7 +398,7 @@
 
    The file is a snapshot file.
 
-See the \*BSD or Mac OS systems man page :manpage:`chflags(2)` for more information.
+See the \*BSD or macOS systems man page :manpage:`chflags(2)` for more information.
 
 On Windows, the following file attribute constants are available for use when
 testing bits in the ``st_file_attributes`` member returned by :func:`os.stat`.
diff --git a/Doc/library/statistics.rst b/Doc/library/statistics.rst
index 38a499a..fd48619 100644
--- a/Doc/library/statistics.rst
+++ b/Doc/library/statistics.rst
@@ -51,7 +51,7 @@
 :func:`median_high`      High median of data.
 :func:`median_grouped`   Median, or 50th percentile, of grouped data.
 :func:`mode`             Single mode (most common value) of discrete or nominal data.
-:func:`multimode`        List of modes (most common values) of discrete or nomimal data.
+:func:`multimode`        List of modes (most common values) of discrete or nominal data.
 :func:`quantiles`        Divide data into intervals with equal probability.
 =======================  ===============================================================
 
@@ -68,6 +68,17 @@
 :func:`variance`         Sample variance of data.
 =======================  =============================================
 
+Statistics for relations between two inputs
+-------------------------------------------
+
+These functions calculate statistics regarding relations between two inputs.
+
+=========================  =====================================================
+:func:`covariance`         Sample covariance for two variables.
+:func:`correlation`        Pearson's correlation coefficient for two variables.
+:func:`linear_regression`  Slope and intercept for simple linear regression.
+=========================  =====================================================
+
 
 Function details
 ----------------
@@ -105,10 +116,11 @@
 
    .. note::
 
-      The mean is strongly affected by outliers and is not a robust estimator
-      for central location: the mean is not necessarily a typical example of
-      the data points.  For more robust measures of central location, see
-      :func:`median` and :func:`mode`.
+      The mean is strongly affected by `outliers
+      <https://en.wikipedia.org/wiki/Outlier>`_ and is not necessarily a
+      typical example of the data points. For a more robust, although less
+      efficient, measure of `central tendency
+      <https://en.wikipedia.org/wiki/Central_tendency>`_, see :func:`median`.
 
       The sample mean gives an unbiased estimate of the true population mean,
       so that when taken on average over all the possible samples,
@@ -156,20 +168,20 @@
    .. versionadded:: 3.8
 
 
-.. function:: harmonic_mean(data)
+.. function:: harmonic_mean(data, weights=None)
 
    Return the harmonic mean of *data*, a sequence or iterable of
-   real-valued numbers.
+   real-valued numbers.  If *weights* is omitted or *None*, then
+   equal weighting is assumed.
 
-   The harmonic mean, sometimes called the subcontrary mean, is the
-   reciprocal of the arithmetic :func:`mean` of the reciprocals of the
-   data. For example, the harmonic mean of three values *a*, *b* and *c*
-   will be equivalent to ``3/(1/a + 1/b + 1/c)``.  If one of the values
-   is zero, the result will be zero.
+   The harmonic mean is the reciprocal of the arithmetic :func:`mean` of the
+   reciprocals of the data. For example, the harmonic mean of three values *a*,
+   *b* and *c* will be equivalent to ``3/(1/a + 1/b + 1/c)``.  If one of the
+   values is zero, the result will be zero.
 
    The harmonic mean is a type of average, a measure of the central
    location of the data.  It is often appropriate when averaging
-   rates or ratios, for example speeds.
+   ratios or rates, for example speeds.
 
    Suppose a car travels 10 km at 40 km/hr, then another 10 km at 60 km/hr.
    What is the average speed?
@@ -179,17 +191,17 @@
       >>> harmonic_mean([40, 60])
       48.0
 
-   Suppose an investor purchases an equal value of shares in each of
-   three companies, with P/E (price/earning) ratios of 2.5, 3 and 10.
-   What is the average P/E ratio for the investor's portfolio?
+   Suppose a car travels 40 km/hr for 5 km, and when traffic clears,
+   speeds-up to 60 km/hr for the remaining 30 km of the journey. What
+   is the average speed?
 
    .. doctest::
 
-      >>> harmonic_mean([2.5, 3, 10])  # For an equal investment portfolio.
-      3.6
+      >>> harmonic_mean([40, 60], weights=[5, 30])
+      56.0
 
-   :exc:`StatisticsError` is raised if *data* is empty, or any element
-   is less than zero.
+   :exc:`StatisticsError` is raised if *data* is empty, any element
+   is less than zero, or if the weighted sum isn't positive.
 
    The current algorithm has an early-out when it encounters a zero
    in the input.  This means that the subsequent inputs are not tested
@@ -197,6 +209,8 @@
 
    .. versionadded:: 3.6
 
+   .. versionchanged:: 3.10
+      Added support for *weights*.
 
 .. function:: median(data)
 
@@ -564,6 +578,91 @@
 
    .. versionadded:: 3.8
 
+.. function:: covariance(x, y, /)
+
+   Return the sample covariance of two inputs *x* and *y*. Covariance
+   is a measure of the joint variability of two inputs.
+
+   Both inputs must be of the same length (no less than two), otherwise
+   :exc:`StatisticsError` is raised.
+
+   Examples:
+
+   .. doctest::
+
+      >>> x = [1, 2, 3, 4, 5, 6, 7, 8, 9]
+      >>> y = [1, 2, 3, 1, 2, 3, 1, 2, 3]
+      >>> covariance(x, y)
+      0.75
+      >>> z = [9, 8, 7, 6, 5, 4, 3, 2, 1]
+      >>> covariance(x, z)
+      -7.5
+      >>> covariance(z, x)
+      -7.5
+
+   .. versionadded:: 3.10
+
+.. function:: correlation(x, y, /)
+
+   Return the `Pearson's correlation coefficient
+   <https://en.wikipedia.org/wiki/Pearson_correlation_coefficient>`_
+   for two inputs. Pearson's correlation coefficient *r* takes values
+   between -1 and +1. It measures the strength and direction of the linear
+   relationship, where +1 means very strong, positive linear relationship,
+   -1 very strong, negative linear relationship, and 0 no linear relationship.
+
+   Both inputs must be of the same length (no less than two), and need
+   not to be constant, otherwise :exc:`StatisticsError` is raised.
+
+   Examples:
+
+   .. doctest::
+
+      >>> x = [1, 2, 3, 4, 5, 6, 7, 8, 9]
+      >>> y = [9, 8, 7, 6, 5, 4, 3, 2, 1]
+      >>> correlation(x, x)
+      1.0
+      >>> correlation(x, y)
+      -1.0
+
+   .. versionadded:: 3.10
+
+.. function:: linear_regression(x, y, /)
+
+   Return the slope and intercept of `simple linear regression
+   <https://en.wikipedia.org/wiki/Simple_linear_regression>`_
+   parameters estimated using ordinary least squares. Simple linear
+   regression describes the relationship between an independent variable *x* and
+   a dependent variable *y* in terms of this linear function:
+
+      *y = slope \* x + intercept + noise*
+
+   where ``slope`` and ``intercept`` are the regression parameters that are
+   estimated, and ``noise`` represents the
+   variability of the data that was not explained by the linear regression
+   (it is equal to the difference between predicted and actual values
+   of the dependent variable).
+
+   Both inputs must be of the same length (no less than two), and
+   the independent variable *x* cannot be constant;
+   otherwise a :exc:`StatisticsError` is raised.
+
+   For example, we can use the `release dates of the Monty
+   Python films <https://en.wikipedia.org/wiki/Monty_Python#Films>`_
+   to predict the cumulative number of Monty Python films
+   that would have been produced by 2019
+   assuming that they had kept the pace.
+
+   .. doctest::
+
+      >>> year = [1971, 1975, 1979, 1982, 1983]
+      >>> films_total = [1, 2, 3, 4, 5]
+      >>> slope, intercept = linear_regression(year, films_total)
+      >>> round(slope * 2019 + intercept)
+      16
+
+   .. versionadded:: 3.10
+
 
 Exceptions
 ----------
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index a48cfa1..b330335 100644
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -178,13 +178,14 @@
    single: __ge__() (instance method)
 
 Non-identical instances of a class normally compare as non-equal unless the
-class defines the :meth:`__eq__` method.
+class defines the :meth:`~object.__eq__` method.
 
 Instances of a class cannot be ordered with respect to other instances of the
 same class, or other types of object, unless the class defines enough of the
-methods :meth:`__lt__`, :meth:`__le__`, :meth:`__gt__`, and :meth:`__ge__` (in
-general, :meth:`__lt__` and :meth:`__eq__` are sufficient, if you want the
-conventional meanings of the comparison operators).
+methods :meth:`~object.__lt__`, :meth:`~object.__le__`, :meth:`~object.__gt__`, and
+:meth:`~object.__ge__` (in general, :meth:`~object.__lt__` and
+:meth:`~object.__eq__` are sufficient, if you want the conventional meanings of the
+comparison operators).
 
 The behavior of the :keyword:`is` and :keyword:`is not` operators cannot be
 customized; also they can be applied to any two objects and never raise an
@@ -478,7 +479,28 @@
 
     .. versionadded:: 3.1
 
-.. method:: int.to_bytes(length, byteorder, \*, signed=False)
+.. method:: int.bit_count()
+
+    Return the number of ones in the binary representation of the absolute
+    value of the integer. This is also known as the population count.
+    Example::
+
+        >>> n = 19
+        >>> bin(n)
+        '0b10011'
+        >>> n.bit_count()
+        3
+        >>> (-n).bit_count()
+        3
+
+    Equivalent to::
+
+        def bit_count(self):
+            return bin(self).count("1")
+
+    .. versionadded:: 3.10
+
+.. method:: int.to_bytes(length, byteorder, *, signed=False)
 
     Return an array of bytes representing an integer.
 
@@ -510,7 +532,7 @@
 
     .. versionadded:: 3.2
 
-.. classmethod:: int.from_bytes(bytes, byteorder, \*, signed=False)
+.. classmethod:: int.from_bytes(bytes, byteorder, *, signed=False)
 
     Return the integer represented by the given array of bytes.
 
@@ -639,7 +661,7 @@
 ------------------------
 
 For numbers ``x`` and ``y``, possibly of different types, it's a requirement
-that ``hash(x) == hash(y)`` whenever ``x == y`` (see the :meth:`__hash__`
+that ``hash(x) == hash(y)`` whenever ``x == y`` (see the :meth:`~object.__hash__`
 method documentation for more details).  For ease of implementation and
 efficiency across a variety of numeric types (including :class:`int`,
 :class:`float`, :class:`decimal.Decimal` and :class:`fractions.Fraction`)
@@ -671,10 +693,9 @@
   as ``-hash(-x)``.  If the resulting hash is ``-1``, replace it with
   ``-2``.
 
-- The particular values ``sys.hash_info.inf``, ``-sys.hash_info.inf``
-  and ``sys.hash_info.nan`` are used as hash values for positive
-  infinity, negative infinity, or nans (respectively).  (All hashable
-  nans have the same hash value.)
+- The particular values ``sys.hash_info.inf`` and ``-sys.hash_info.inf``
+  are used as hash values for positive
+  infinity or negative infinity (respectively).
 
 - For a :class:`complex` number ``z``, the hash values of the real
   and imaginary parts are combined by computing ``hash(z.real) +
@@ -719,7 +740,7 @@
        """Compute the hash of a float x."""
 
        if math.isnan(x):
-           return sys.hash_info.nan
+           return object.__hash__(x)
        elif math.isinf(x):
            return sys.hash_info.inf if x > 0 else -sys.hash_info.inf
        else:
@@ -752,21 +773,21 @@
 support iteration.  Sequences, described below in more detail, always support
 the iteration methods.
 
-One method needs to be defined for container objects to provide iteration
+One method needs to be defined for container objects to provide :term:`iterable`
 support:
 
 .. XXX duplicated in reference/datamodel!
 
 .. method:: container.__iter__()
 
-   Return an iterator object.  The object is required to support the iterator
-   protocol described below.  If a container supports different types of
-   iteration, additional methods can be provided to specifically request
+   Return an :term:`iterator` object.  The object is required to support the
+   iterator protocol described below.  If a container supports different types
+   of iteration, additional methods can be provided to specifically request
    iterators for those iteration types.  (An example of an object supporting
    multiple forms of iteration would be a tree structure which supports both
    breadth-first and depth-first traversal.)  This method corresponds to the
-   :c:member:`~PyTypeObject.tp_iter` slot of the type structure for Python objects in the Python/C
-   API.
+   :c:member:`~PyTypeObject.tp_iter` slot of the type structure for Python
+   objects in the Python/C API.
 
 The iterator objects themselves are required to support the following two
 methods, which together form the :dfn:`iterator protocol`:
@@ -774,18 +795,19 @@
 
 .. method:: iterator.__iter__()
 
-   Return the iterator object itself.  This is required to allow both containers
-   and iterators to be used with the :keyword:`for` and :keyword:`in` statements.
-   This method corresponds to the :c:member:`~PyTypeObject.tp_iter` slot of the type structure for
-   Python objects in the Python/C API.
+   Return the :term:`iterator` object itself.  This is required to allow both
+   containers and iterators to be used with the :keyword:`for` and
+   :keyword:`in` statements.  This method corresponds to the
+   :c:member:`~PyTypeObject.tp_iter` slot of the type structure for Python
+   objects in the Python/C API.
 
 
 .. method:: iterator.__next__()
 
-   Return the next item from the container.  If there are no further items, raise
-   the :exc:`StopIteration` exception.  This method corresponds to the
-   :c:member:`~PyTypeObject.tp_iternext` slot of the type structure for Python objects in the
-   Python/C API.
+   Return the next item from the :term:`iterator`.  If there are no further
+   items, raise the :exc:`StopIteration` exception.  This method corresponds to
+   the :c:member:`~PyTypeObject.tp_iternext` slot of the type structure for
+   Python objects in the Python/C API.
 
 Python defines several iterator objects to support iteration over general and
 specific sequence types, dictionaries, and other more specialized forms.  The
@@ -899,6 +921,16 @@
 two sequences must be of the same type and have the same length.  (For full
 details see :ref:`comparisons` in the language reference.)
 
+.. index::
+   single: loop; over mutable sequence
+   single: mutable sequence; loop over
+
+Forward and reversed iterators over mutable sequences access values using an
+index.  That index will continue to march forward (or backward) even if the
+underlying sequence is mutated.  The iterator terminates only when an
+:exc:`IndexError` or a :exc:`StopIteration` is encountered (or when the index
+drops below zero).
+
 Notes:
 
 (1)
@@ -1092,7 +1124,7 @@
 |                              | index given by *i*             |                     |
 |                              | (same as ``s[i:i] = [x]``)     |                     |
 +------------------------------+--------------------------------+---------------------+
-| ``s.pop([i])``               | retrieves the item at *i* and  | \(2)                |
+| ``s.pop()`` or ``s.pop(i)``  | retrieves the item at *i* and  | \(2)                |
 |                              | also removes it from *s*       |                     |
 +------------------------------+--------------------------------+---------------------+
 | ``s.remove(x)``              | remove the first item from *s* | \(3)                |
@@ -1275,7 +1307,7 @@
            range(start, stop[, step])
 
    The arguments to the range constructor must be integers (either built-in
-   :class:`int` or any object that implements the ``__index__`` special
+   :class:`int` or any object that implements the :meth:`~object.__index__` special
    method).  If the *step* argument is omitted, it defaults to ``1``.
    If the *start* argument is omitted, it defaults to ``0``.
    If *step* is zero, :exc:`ValueError` is raised.
@@ -1403,7 +1435,7 @@
 written in a variety of ways:
 
 * Single quotes: ``'allows embedded "double" quotes'``
-* Double quotes: ``"allows embedded 'single' quotes"``.
+* Double quotes: ``"allows embedded 'single' quotes"``
 * Triple quoted: ``'''Three single quotes'''``, ``"""Three double quotes"""``
 
 Triple quoted strings may span multiple lines - all associated whitespace will
@@ -1560,13 +1592,15 @@
 
    By default, the *errors* argument is not checked for best performances, but
    only used at the first encoding error. Enable the :ref:`Python Development
-   Mode <devmode>`, or use a debug build to check *errors*.
+   Mode <devmode>`, or use a :ref:`debug build <debug-build>` to check
+   *errors*.
 
    .. versionchanged:: 3.1
       Support for keyword arguments added.
 
    .. versionchanged:: 3.9
-      The *errors* is now checked in development mode and in debug mode.
+      The *errors* is now checked in development mode and
+      in :ref:`debug mode <debug-build>`.
 
 
 .. method:: str.endswith(suffix[, start[, end]])
@@ -1727,9 +1761,9 @@
       >>> from keyword import iskeyword
 
       >>> 'hello'.isidentifier(), iskeyword('hello')
-      True, False
+      (True, False)
       >>> 'def'.isidentifier(), iskeyword('def')
-      True, True
+      (True, True)
 
 
 .. method:: str.islower()
@@ -1996,7 +2030,7 @@
 .. index::
    single: universal newlines; str.splitlines method
 
-.. method:: str.splitlines([keepends])
+.. method:: str.splitlines(keepends=False)
 
    Return a list of the lines in the string, breaking at line boundaries.  Line
    breaks are not included in the resulting list unless *keepends* is given and
@@ -2409,7 +2443,7 @@
    literals, except that a ``b`` prefix is added:
 
    * Single quotes: ``b'still allows embedded "double" quotes'``
-   * Double quotes: ``b"still allows embedded 'single' quotes"``.
+   * Double quotes: ``b"still allows embedded 'single' quotes"``
    * Triple quoted: ``b'''3 single quotes'''``, ``b"""3 double quotes"""``
 
    Only ASCII characters are permitted in bytes literals (regardless of the
@@ -2689,7 +2723,7 @@
 
    By default, the *errors* argument is not checked for best performances, but
    only used at the first decoding error. Enable the :ref:`Python Development
-   Mode <devmode>`, or use a debug build to check *errors*.
+   Mode <devmode>`, or use a :ref:`debug build <debug-build>` to check *errors*.
 
    .. note::
 
@@ -2701,7 +2735,8 @@
       Added support for keyword arguments.
 
    .. versionchanged:: 3.9
-      The *errors* is now checked in development mode and in debug mode.
+      The *errors* is now checked in development mode and
+      in :ref:`debug mode <debug-build>`.
 
 
 .. method:: bytes.endswith(suffix[, start[, end]])
@@ -3609,17 +3644,16 @@
 of an object that supports the :ref:`buffer protocol <bufferobjects>` without
 copying.
 
-.. class:: memoryview(obj)
+.. class:: memoryview(object)
 
-   Create a :class:`memoryview` that references *obj*.  *obj* must support the
-   buffer protocol.  Built-in objects that support the buffer protocol include
-   :class:`bytes` and :class:`bytearray`.
+   Create a :class:`memoryview` that references *object*.  *object* must
+   support the buffer protocol.  Built-in objects that support the buffer
+   protocol include :class:`bytes` and :class:`bytearray`.
 
    A :class:`memoryview` has the notion of an *element*, which is the
-   atomic memory unit handled by the originating object *obj*.  For many
-   simple types such as :class:`bytes` and :class:`bytearray`, an element
-   is a single byte, but other types such as :class:`array.array` may have
-   bigger elements.
+   atomic memory unit handled by the originating *object*.  For many simple
+   types such as :class:`bytes` and :class:`bytearray`, an element is a single
+   byte, but other types such as :class:`array.array` may have bigger elements.
 
    ``len(view)`` is equal to the length of :class:`~memoryview.tolist`.
    If ``view.ndim = 0``, the length is 1. If ``view.ndim = 1``, the length
@@ -4191,7 +4225,7 @@
 
 
    Note, the non-operator versions of :meth:`union`, :meth:`intersection`,
-   :meth:`difference`, and :meth:`symmetric_difference`, :meth:`issubset`, and
+   :meth:`difference`, :meth:`symmetric_difference`, :meth:`issubset`, and
    :meth:`issuperset` methods will accept any iterable as an argument.  In
    contrast, their operator based counterparts require their arguments to be
    sets.  This precludes error-prone constructions like ``set('abc') & 'cbs'``
@@ -4310,9 +4344,9 @@
 pairs within braces, for example: ``{'jack': 4098, 'sjoerd': 4127}`` or ``{4098:
 'jack', 4127: 'sjoerd'}``, or by the :class:`dict` constructor.
 
-.. class:: dict(**kwarg)
-           dict(mapping, **kwarg)
-           dict(iterable, **kwarg)
+.. class:: dict(**kwargs)
+           dict(mapping, **kwargs)
+           dict(iterable, **kwargs)
 
    Return a new dictionary initialized from an optional positional argument
    and a possibly empty set of keyword arguments.
@@ -4616,6 +4650,12 @@
    .. versionchanged:: 3.8
       Dictionary views are now reversible.
 
+.. describe:: dictview.mapping
+
+   Return a :class:`types.MappingProxyType` that wraps the original
+   dictionary to which the view refers.
+
+   .. versionadded:: 3.10
 
 Keys views are set-like since their entries are unique and hashable.  If all
 values are hashable, so that ``(key, value)`` pairs are unique and hashable,
@@ -4655,6 +4695,12 @@
    >>> keys ^ {'sausage', 'juice'}
    {'juice', 'sausage', 'bacon', 'spam'}
 
+   >>> # get back a read-only proxy for the original dictionary
+   >>> values.mapping
+   mappingproxy({'eggs': 2, 'sausage': 1, 'bacon': 1, 'spam': 500})
+   >>> values.mapping['spam']
+   500
+
 
 .. _typecontextmanager:
 
@@ -4720,9 +4766,9 @@
 Python's :term:`generator`\s and the :class:`contextlib.contextmanager` decorator
 provide a convenient way to implement these protocols.  If a generator function is
 decorated with the :class:`contextlib.contextmanager` decorator, it will return a
-context manager implementing the necessary :meth:`__enter__` and
-:meth:`__exit__` methods, rather than the iterator produced by an undecorated
-generator function.
+context manager implementing the necessary :meth:`~contextmanager.__enter__` and
+:meth:`~contextmanager.__exit__` methods, rather than the iterator produced by an
+undecorated generator function.
 
 Note that there is no specific slot for any of these methods in the type
 structure for Python objects in the Python/C API. Extension types wanting to
@@ -4731,42 +4777,73 @@
 single class dictionary lookup is negligible.
 
 
+Type Annotation Types --- :ref:`Generic Alias <types-genericalias>`, :ref:`Union <types-union>`
+===============================================================================================
+
+.. index::
+   single: annotation; type annotation; type hint
+
+The core built-in types for :term:`type annotations <annotation>` are
+:ref:`Generic Alias <types-genericalias>` and :ref:`Union <types-union>`.
+
+
 .. _types-genericalias:
 
 Generic Alias Type
-==================
+------------------
 
 .. index::
    object: GenericAlias
    pair: Generic; Alias
 
-``GenericAlias`` objects are created by subscripting a class (usually a
-container), such as ``list[int]``.  They are intended primarily for
+``GenericAlias`` objects are generally created by
+:ref:`subscripting <subscriptions>` a class. They are most often used with
+:ref:`container classes <sequence-types>`, such as :class:`list` or
+:class:`dict`. For example, ``list[int]`` is a ``GenericAlias`` object created
+by subscripting the ``list`` class with the argument :class:`int`.
+``GenericAlias`` objects are intended primarily for use with
 :term:`type annotations <annotation>`.
 
-Usually, the :ref:`subscription <subscriptions>` of container objects calls the
-method :meth:`__getitem__` of the object.  However, the subscription of some
-containers' classes may call the classmethod :meth:`__class_getitem__` of the
-class instead. The classmethod :meth:`__class_getitem__` should return a
-``GenericAlias`` object.
-
 .. note::
-   If the :meth:`__getitem__` of the class' metaclass is present, it will take
-   precedence over the :meth:`__class_getitem__` defined in the class (see
-   :pep:`560` for more details).
 
-The ``GenericAlias`` object acts as a proxy for :term:`generic types
-<generic type>`, implementing *parameterized generics* - a specific instance
-of a generic which provides the types for container elements.
+   It is generally only possible to subscript a class if the class implements
+   the special method :meth:`~object.__class_getitem__`.
 
-The user-exposed type for the ``GenericAlias`` object can be accessed from
-:class:`types.GenericAlias` and used for :func:`isinstance` checks.  It can
-also be used to create ``GenericAlias`` objects directly.
+A ``GenericAlias`` object acts as a proxy for a :term:`generic type`,
+implementing *parameterized generics*.
+
+For a container class, the
+argument(s) supplied to a :ref:`subscription <subscriptions>` of the class may
+indicate the type(s) of the elements an object contains. For example,
+``set[bytes]`` can be used in type annotations to signify a :class:`set` in
+which all the elements are of type :class:`bytes`.
+
+For a class which defines :meth:`~object.__class_getitem__` but is not a
+container, the argument(s) supplied to a subscription of the class will often
+indicate the return type(s) of one or more methods defined on an object. For
+example, :mod:`regular expressions <re>` can be used on both the :class:`str` data
+type and the :class:`bytes` data type:
+
+* If ``x = re.search('foo', 'foo')``, ``x`` will be a
+  :ref:`re.Match <match-objects>` object where the return values of
+  ``x.group(0)`` and ``x[0]`` will both be of type :class:`str`. We can
+  represent this kind of object in type annotations with the ``GenericAlias``
+  ``re.Match[str]``.
+
+* If ``y = re.search(b'bar', b'bar')``, (note the ``b`` for :class:`bytes`),
+  ``y`` will also be an instance of ``re.Match``, but the return
+  values of ``y.group(0)`` and ``y[0]`` will both be of type
+  :class:`bytes`. In type annotations, we would represent this
+  variety of :ref:`re.Match <match-objects>` objects with ``re.Match[bytes]``.
+
+``GenericAlias`` objects are instances of the class
+:class:`types.GenericAlias`, which can also be used to create ``GenericAlias``
+objects directly.
 
 .. describe:: T[X, Y, ...]
 
-   Creates a ``GenericAlias`` representing a type ``T`` containing elements
-   of types *X*, *Y*, and more depending on the ``T`` used.
+   Creates a ``GenericAlias`` representing a type ``T`` parameterized by types
+   *X*, *Y*, and more depending on the ``T`` used.
    For example, a function expecting a :class:`list` containing
    :class:`float` elements::
 
@@ -4791,7 +4868,7 @@
 
 The Python runtime does not enforce :term:`type annotations <annotation>`.
 This extends to generic types and their type parameters. When creating
-an object from a ``GenericAlias``, container elements are not checked
+a container object from a ``GenericAlias``, the elements in the container are not checked
 against their type. For example, the following code is discouraged, but will
 run without errors::
 
@@ -4818,8 +4895,8 @@
    >>> str(list[int])
    'list[int]'
 
-The :meth:`__getitem__` method of generics will raise an exception to disallow
-mistakes like ``dict[str][str]``::
+The :meth:`~object.__getitem__` method of generic containers will raise an
+exception to disallow mistakes like ``dict[str][str]``::
 
    >>> dict[str][str]
    Traceback (most recent call last):
@@ -4828,7 +4905,7 @@
 
 However, such expressions are valid when :ref:`type variables <generics>` are
 used.  The index must have as many elements as there are type variable items
-in the ``GenericAlias`` object's :attr:`__args__ <genericalias.__args__>`. ::
+in the ``GenericAlias`` object's :attr:`~genericalias.__args__`. ::
 
    >>> from typing import TypeVar
    >>> Y = TypeVar('Y')
@@ -4836,10 +4913,11 @@
    dict[str, int]
 
 
-Standard Generic Collections
-----------------------------
+Standard Generic Classes
+^^^^^^^^^^^^^^^^^^^^^^^^
 
-These standard library collections support parameterized generics.
+The following standard library classes support parameterized generics. This
+list is non-exhaustive.
 
 * :class:`tuple`
 * :class:`list`
@@ -4877,12 +4955,29 @@
 * :class:`collections.abc.ValuesView`
 * :class:`contextlib.AbstractContextManager`
 * :class:`contextlib.AbstractAsyncContextManager`
+* :class:`dataclasses.Field`
+* :class:`functools.cached_property`
+* :class:`functools.partialmethod`
+* :class:`os.PathLike`
+* :class:`queue.LifoQueue`
+* :class:`queue.Queue`
+* :class:`queue.PriorityQueue`
+* :class:`queue.SimpleQueue`
 * :ref:`re.Pattern <re-objects>`
 * :ref:`re.Match <match-objects>`
+* :class:`shelve.BsdDbShelf`
+* :class:`shelve.DbfilenameShelf`
+* :class:`shelve.Shelf`
+* :class:`types.MappingProxyType`
+* :class:`weakref.WeakKeyDictionary`
+* :class:`weakref.WeakMethod`
+* :class:`weakref.WeakSet`
+* :class:`weakref.WeakValueDictionary`
 
 
-Special Attributes of Generic Alias
------------------------------------
+
+Special Attributes of ``GenericAlias`` objects
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 All parameterized generics implement special read-only attributes.
 
@@ -4897,8 +4992,8 @@
 .. attribute:: genericalias.__args__
 
    This attribute is a :class:`tuple` (possibly of length 1) of generic
-   types passed to the original :meth:`__class_getitem__`
-   of the generic container::
+   types passed to the original :meth:`~object.__class_getitem__` of the
+   generic class::
 
       >>> dict[str, list[int]].__args__
       (<class 'str'>, list[int])
@@ -4916,15 +5011,129 @@
       (~T,)
 
 
+   .. note::
+      A ``GenericAlias`` object with :class:`typing.ParamSpec` parameters may not
+      have correct ``__parameters__`` after substitution because
+      :class:`typing.ParamSpec` is intended primarily for static type checking.
+
 .. seealso::
 
-   * :pep:`585` -- "Type Hinting Generics In Standard Collections"
-   * :meth:`__class_getitem__` -- Used to implement parameterized generics.
-   * :ref:`generics` -- Generics in the :mod:`typing` module.
+   :pep:`484` - Type Hints
+      Introducing Python's framework for type annotations.
+
+   :pep:`585` - Type Hinting Generics In Standard Collections
+      Introducing the ability to natively parameterize standard-library
+      classes, provided they implement the special class method
+      :meth:`~object.__class_getitem__`.
+
+   :ref:`Generics`, :ref:`user-defined generics <user-defined-generics>` and :class:`typing.Generic`
+      Documentation on how to implement generic classes that can be
+      parameterized at runtime and understood by static type-checkers.
 
 .. versionadded:: 3.9
 
 
+.. _types-union:
+
+Union Type
+----------
+
+.. index::
+   object: Union
+   pair: union; type
+
+A union object holds the value of the ``|`` (bitwise or) operation on
+multiple :ref:`type objects <bltin-type-objects>`.  These types are intended
+primarily for :term:`type annotations <annotation>`. The union type expression
+enables cleaner type hinting syntax compared to :data:`typing.Union`.
+
+.. describe:: X | Y | ...
+
+   Defines a union object which holds types *X*, *Y*, and so forth. ``X | Y``
+   means either X or Y.  It is equivalent to ``typing.Union[X, Y]``.
+   For example, the following function expects an argument of type
+   :class:`int` or :class:`float`::
+
+      def square(number: int | float) -> int | float:
+          return number ** 2
+
+.. describe:: union_object == other
+
+   Union objects can be tested for equality with other union objects.  Details:
+
+   * Unions of unions are flattened::
+
+       (int | str) | float == int | str | float
+
+   * Redundant types are removed::
+
+       int | str | int == int | str
+
+   * When comparing unions, the order is ignored::
+
+      int | str == str | int
+
+   * It is compatible with :data:`typing.Union`::
+
+      int | str == typing.Union[int, str]
+
+   * Optional types can be spelled as a union with ``None``::
+
+      str | None == typing.Optional[str]
+
+.. describe:: isinstance(obj, union_object)
+.. describe:: issubclass(obj, union_object)
+
+   Calls to :func:`isinstance` and :func:`issubclass` are also supported with a
+   union object::
+
+      >>> isinstance("", int | str)
+      True
+
+   However, union objects containing :ref:`parameterized generics
+   <types-genericalias>` cannot be used::
+
+      >>> isinstance(1, int | list[int])
+      Traceback (most recent call last):
+        File "<stdin>", line 1, in <module>
+      TypeError: isinstance() argument 2 cannot contain a parameterized generic
+
+The user-exposed type for the union object can be accessed from
+:data:`types.UnionType` and used for :func:`isinstance` checks.  An object cannot be
+instantiated from the type::
+
+   >>> import types
+   >>> isinstance(int | str, types.UnionType)
+   True
+   >>> types.UnionType()
+   Traceback (most recent call last):
+     File "<stdin>", line 1, in <module>
+   TypeError: cannot create 'types.UnionType' instances
+
+.. note::
+   The :meth:`__or__` method for type objects was added to support the syntax
+   ``X | Y``.  If a metaclass implements :meth:`__or__`, the Union may
+   override it::
+
+      >>> class M(type):
+      ...     def __or__(self, other):
+      ...         return "Hello"
+      ...
+      >>> class C(metaclass=M):
+      ...     pass
+      ...
+      >>> C | int
+      'Hello'
+      >>> int | C
+      int | __main__.C
+
+.. seealso::
+
+   :pep:`604` -- PEP proposing the ``X | Y`` syntax and the Union type.
+
+.. versionadded:: 3.10
+
+
 .. _typesother:
 
 Other Built-in Types
@@ -5044,6 +5253,9 @@
 and can be extracted from function objects through their :attr:`__code__`
 attribute. See also the :mod:`code` module.
 
+Accessing ``__code__`` raises an :ref:`auditing event <auditing>`
+``object.__getattr__`` with arguments ``obj`` and ``"__code__"``.
+
 .. index::
    builtin: exec
    builtin: eval
@@ -5196,8 +5408,8 @@
 .. method:: class.__subclasses__
 
    Each class keeps a list of weak references to its immediate subclasses.  This
-   method returns a list of all those references still alive.
-   Example::
+   method returns a list of all those references still alive.  The list is in
+   definition order.  Example::
 
       >>> int.__subclasses__()
       [<class 'bool'>]
diff --git a/Doc/library/string.rst b/Doc/library/string.rst
index 5542e9b..b710864 100644
--- a/Doc/library/string.rst
+++ b/Doc/library/string.rst
@@ -188,8 +188,8 @@
 The :meth:`str.format` method and the :class:`Formatter` class share the same
 syntax for format strings (although in the case of :class:`Formatter`,
 subclasses can define their own format string syntax).  The syntax is
-related to that of :ref:`formatted string literals <f-strings>`, but
-there are differences.
+related to that of :ref:`formatted string literals <f-strings>`, but it is
+less sophisticated and, in particular, does not support arbitrary expressions.
 
 .. index::
    single: {} (curly brackets); in string formatting
@@ -347,8 +347,8 @@
    | ``'='`` | Forces the padding to be placed after the sign (if any)  |
    |         | but before the digits.  This is used for printing fields |
    |         | in the form '+000000120'. This alignment option is only  |
-   |         | valid for numeric types.  It becomes the default when '0'|
-   |         | immediately precedes the field width.                    |
+   |         | valid for numeric types.  It becomes the default for     |
+   |         | numbers when '0' immediately precedes the field width.   |
    +---------+----------------------------------------------------------+
    | ``'^'`` | Forces the field to be centered within the available     |
    |         | space.                                                   |
@@ -386,8 +386,8 @@
 conversion.  The alternate form is defined differently for different
 types.  This option is only valid for integer, float and complex
 types. For integers, when binary, octal, or hexadecimal output
-is used, this option adds the prefix respective ``'0b'``, ``'0o'``, or
-``'0x'`` to the output value. For float and complex the
+is used, this option adds the respective prefix ``'0b'``, ``'0o'``,
+``'0x'``, or ``'0X'`` to the output value. For float and complex the
 alternate form causes the result of the conversion to always contain a
 decimal-point character, even if no digits follow it. Normally, a
 decimal-point character appears in the result of these conversions
@@ -424,12 +424,17 @@
 sign-aware zero-padding for numeric types.  This is equivalent to a *fill*
 character of ``'0'`` with an *alignment* type of ``'='``.
 
-The *precision* is a decimal number indicating how many digits should be
-displayed after the decimal point for a floating point value formatted with
-``'f'`` and ``'F'``, or before and after the decimal point for a floating point
-value formatted with ``'g'`` or ``'G'``.  For non-number types the field
+.. versionchanged:: 3.10
+   Preceding the *width* field by ``'0'`` no longer affects the default
+   alignment for strings.
+
+The *precision* is a decimal integer indicating how many digits should be
+displayed after the decimal point for presentation types
+``'f'`` and ``'F'``, or before and after the decimal point for presentation
+types ``'g'`` or ``'G'``.  For string presentation types the field
 indicates the maximum field size - in other words, how many characters will be
-used from the field content. The *precision* is not allowed for integer values.
+used from the field content.  The *precision* is not allowed for integer
+presentation types.
 
 Finally, the *type* determines how the data should be presented.
 
@@ -463,6 +468,8 @@
    +---------+----------------------------------------------------------+
    | ``'X'`` | Hex format. Outputs the number in base 16, using         |
    |         | upper-case letters for the digits above 9.               |
+   |         | In case ``'#'`` is specified, the prefix ``'0x'`` will   |
+   |         | be upper-cased to ``'0X'`` as well.                      |
    +---------+----------------------------------------------------------+
    | ``'n'`` | Number. This is the same as ``'d'``, except that it uses |
    |         | the current locale setting to insert the appropriate     |
@@ -514,6 +521,8 @@
    |         | this rounds the number to ``p`` significant digits and   |
    |         | then formats the result in either fixed-point format     |
    |         | or in scientific notation, depending on its magnitude.   |
+   |         | A precision of ``0`` is treated as equivalent to a       |
+   |         | precision of ``1``.                                      |
    |         |                                                          |
    |         | The precise rules are as follows: suppose that the       |
    |         | result formatted with presentation type ``'e'`` and      |
@@ -528,16 +537,19 @@
    |         | removed if there are no remaining digits following it,   |
    |         | unless the ``'#'`` option is used.                       |
    |         |                                                          |
+   |         | With no precision given, uses a precision of ``6``       |
+   |         | significant digits for :class:`float`. For               |
+   |         | :class:`~decimal.Decimal`, the coefficient of the result |
+   |         | is formed from the coefficient digits of the value;      |
+   |         | scientific notation is used for values smaller than      |
+   |         | ``1e-6`` in absolute value and values where the place    |
+   |         | value of the least significant digit is larger than 1,   |
+   |         | and fixed-point notation is used otherwise.              |
+   |         |                                                          |
    |         | Positive and negative infinity, positive and negative    |
    |         | zero, and nans, are formatted as ``inf``, ``-inf``,      |
    |         | ``0``, ``-0`` and ``nan`` respectively, regardless of    |
    |         | the precision.                                           |
-   |         |                                                          |
-   |         | A precision of ``0`` is treated as equivalent to a       |
-   |         | precision of ``1``. With no precision given, uses a      |
-   |         | precision of ``6`` significant digits for                |
-   |         | :class:`float`, and shows all coefficient digits         |
-   |         | for :class:`~decimal.Decimal`.                           |
    +---------+----------------------------------------------------------+
    | ``'G'`` | General format. Same as ``'g'`` except switches to       |
    |         | ``'E'`` if the number gets too large. The                |
@@ -550,12 +562,18 @@
    | ``'%'`` | Percentage. Multiplies the number by 100 and displays    |
    |         | in fixed (``'f'``) format, followed by a percent sign.   |
    +---------+----------------------------------------------------------+
-   | None    | Similar to ``'g'``, except that fixed-point notation,    |
-   |         | when used, has at least one digit past the decimal point.|
-   |         | The default precision is as high as needed to represent  |
-   |         | the particular value. The overall effect is to match the |
-   |         | output of :func:`str` as altered by the other format     |
-   |         | modifiers.                                               |
+   | None    | For :class:`float` this is the same as ``'g'``, except   |
+   |         | that when fixed-point notation is used to format the     |
+   |         | result, it always includes at least one digit past the   |
+   |         | decimal point. The precision used is as large as needed  |
+   |         | to represent the given value faithfully.                 |
+   |         |                                                          |
+   |         | For :class:`~decimal.Decimal`, this is the same as       |
+   |         | either ``'g'`` or ``'G'`` depending on the value of      |
+   |         | ``context.capitals`` for the current decimal context.    |
+   |         |                                                          |
+   |         | The overall effect is to match the output of :func:`str` |
+   |         | as altered by the other format modifiers.                |
    +---------+----------------------------------------------------------+
 
 
diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst
index e37cc98..ab9f1d8 100644
--- a/Doc/library/subprocess.rst
+++ b/Doc/library/subprocess.rst
@@ -264,13 +264,14 @@
    *stdin*, *stdout* and *stderr* specify the executed program's standard input,
    standard output and standard error file handles, respectively.  Valid values
    are :data:`PIPE`, :data:`DEVNULL`, an existing file descriptor (a positive
-   integer), an existing file object, and ``None``.  :data:`PIPE` indicates
-   that a new pipe to the child should be created.  :data:`DEVNULL` indicates
-   that the special file :data:`os.devnull` will be used.  With the default
-   settings of ``None``, no redirection will occur; the child's file handles
-   will be inherited from the parent.  Additionally, *stderr* can be
-   :data:`STDOUT`, which indicates that the stderr data from the child
-   process should be captured into the same file handle as for *stdout*.
+   integer), an existing file object with a valid file descriptor, and ``None``.
+   :data:`PIPE` indicates that a new pipe to the child should be created.
+   :data:`DEVNULL` indicates that the special file :data:`os.devnull` will
+   be used.  With the default settings of ``None``, no redirection will occur;
+   the child's file handles will be inherited from the parent.
+   Additionally, *stderr* can be :data:`STDOUT`, which indicates that the
+   stderr data from the child process should be captured into the same file
+   handle as for *stdout*.
 
    .. index::
       single: universal newlines; subprocess module
@@ -339,12 +340,12 @@
                  stderr=None, preexec_fn=None, close_fds=True, shell=False, \
                  cwd=None, env=None, universal_newlines=None, \
                  startupinfo=None, creationflags=0, restore_signals=True, \
-                 start_new_session=False, pass_fds=(), \*, group=None, \
+                 start_new_session=False, pass_fds=(), *, group=None, \
                  extra_groups=None, user=None, umask=-1, \
-                 encoding=None, errors=None, text=None)
+                 encoding=None, errors=None, text=None, pipesize=-1)
 
    Execute a child program in a new process.  On POSIX, the class uses
-   :meth:`os.execvp`-like behavior to execute the child program.  On Windows,
+   :meth:`os.execvpe`-like behavior to execute the child program.  On Windows,
    the class uses the Windows ``CreateProcess()`` function.  The arguments to
    :class:`Popen` are as follows.
 
@@ -356,6 +357,25 @@
    arguments for additional differences from the default behavior.  Unless
    otherwise stated, it is recommended to pass *args* as a sequence.
 
+   .. warning::
+
+      For maximum reliability, use a fully-qualified path for the executable.
+      To search for an unqualified name on :envvar:`PATH`, use
+      :meth:`shutil.which`. On all platforms, passing :data:`sys.executable`
+      is the recommended way to launch the current Python interpreter again,
+      and use the ``-m`` command-line format to launch an installed module.
+
+      Resolving the path of *executable* (or the first item of *args*) is
+      platform dependent. For POSIX, see :meth:`os.execvpe`, and note that
+      when resolving or searching for the executable path, *cwd* overrides the
+      current working directory and *env* can override the ``PATH``
+      environment variable. For Windows, see the documentation of the
+      ``lpApplicationName`` and ``lpCommandLine`` parameters of WinAPI
+      ``CreateProcess``, and note that when resolving or searching for the
+      executable path with ``shell=False``, *cwd* does not override the
+      current working directory and *env* cannot override the ``PATH``
+      environment variable. Using a full path avoids all of these variations.
+
    An example of passing some arguments to an external program
    as a sequence is::
 
@@ -463,13 +483,14 @@
    *stdin*, *stdout* and *stderr* specify the executed program's standard input,
    standard output and standard error file handles, respectively.  Valid values
    are :data:`PIPE`, :data:`DEVNULL`, an existing file descriptor (a positive
-   integer), an existing :term:`file object`, and ``None``.  :data:`PIPE`
-   indicates that a new pipe to the child should be created.  :data:`DEVNULL`
-   indicates that the special file :data:`os.devnull` will be used. With the
-   default settings of ``None``, no redirection will occur; the child's file
-   handles will be inherited from the parent.  Additionally, *stderr* can be
-   :data:`STDOUT`, which indicates that the stderr data from the applications
-   should be captured into the same file handle as for stdout.
+   integer), an existing :term:`file object` with a valid file descriptor,
+   and ``None``.  :data:`PIPE` indicates that a new pipe to the child should
+   be created.  :data:`DEVNULL` indicates that the special file
+   :data:`os.devnull` will be used. With the default settings of ``None``,
+   no redirection will occur; the child's file handles will be inherited from
+   the parent.  Additionally, *stderr* can be :data:`STDOUT`, which indicates
+   that the stderr data from the applications should be captured into the same
+   file handle as for stdout.
 
    If *preexec_fn* is set to a callable object, this object will be called in the
    child process just before the child is executed.
@@ -524,7 +545,7 @@
 
    If *cwd* is not ``None``, the function changes the working directory to
    *cwd* before executing the child.  *cwd* can be a string, bytes or
-   :term:`path-like <path-like object>` object.  In particular, the function
+   :term:`path-like <path-like object>` object.  On POSIX, the function
    looks for *executable* (or for the first item in *args*) relative to *cwd*
    if the executable path is a relative path.
 
@@ -625,6 +646,14 @@
       * :data:`CREATE_DEFAULT_ERROR_MODE`
       * :data:`CREATE_BREAKAWAY_FROM_JOB`
 
+   *pipesize* can be used to change the size of the pipe when
+   :data:`PIPE` is used for *stdin*, *stdout* or *stderr*. The size of the pipe
+   is only changed on platforms that support this (only Linux at this time of
+   writing). Other platforms will ignore this parameter.
+
+   .. versionadded:: 3.10
+      The ``pipesize`` parameter was added.
+
    Popen objects are supported as context managers via the :keyword:`with` statement:
    on exit, standard file descriptors are closed, and the process is waited for.
    ::
@@ -662,7 +691,10 @@
 
 The most common exception raised is :exc:`OSError`.  This occurs, for example,
 when trying to execute a non-existent file.  Applications should prepare for
-:exc:`OSError` exceptions.
+:exc:`OSError` exceptions. Note that, when ``shell=True``, :exc:`OSError`
+will be raised by the child only if the selected shell itself was not found.
+To determine if the shell failed to find the requested application, it is
+necessary to check the return code or output from the subprocess.
 
 A :exc:`ValueError` will be raised if :class:`Popen` is called with invalid
 arguments.
@@ -680,6 +712,7 @@
    .. versionadded:: 3.3
       The :exc:`SubprocessError` base class was added.
 
+.. _subprocess-security:
 
 Security Considerations
 -----------------------
@@ -691,11 +724,8 @@
 responsibility to ensure that all whitespace and metacharacters are
 quoted appropriately to avoid
 `shell injection <https://en.wikipedia.org/wiki/Shell_injection#Shell_injection>`_
-vulnerabilities.
-
-When using ``shell=True``, the :func:`shlex.quote` function can be
-used to properly escape whitespace and shell metacharacters in strings
-that are going to be used to construct shell commands.
+vulnerabilities. On :ref:`some platforms <shlex-quote-warning>`, it is possible
+to use :func:`shlex.quote` for this escaping.
 
 
 Popen Objects
@@ -1121,6 +1151,8 @@
    code was zero then return, otherwise raise :exc:`CalledProcessError`. The
    :exc:`CalledProcessError` object will have the return code in the
    :attr:`~CalledProcessError.returncode` attribute.
+   If :func:`check_call` was unable to start the process it will propagate the exception
+   that was raised.
 
    Code needing to capture stdout or stderr should use :func:`run` instead::
 
@@ -1163,8 +1195,9 @@
    The arguments shown above are merely some common ones.
    The full function signature is largely the same as that of :func:`run` -
    most arguments are passed directly through to that interface.
-   However, explicitly passing ``input=None`` to inherit the parent's
-   standard input file handle is not supported.
+   One API deviation from :func:`run` behavior exists: passing ``input=None``
+   will behave the same as ``input=b''`` (or ``input=''``, depending on other
+   arguments) rather than using the parent's standard input file handle.
 
    By default, this function will return the data as encoded bytes. The actual
    encoding of the output data may depend on the command being invoked, so the
@@ -1257,7 +1290,7 @@
 
 becomes::
 
-   output=check_output("dmesg | grep hda", shell=True)
+   output = check_output("dmesg | grep hda", shell=True)
 
 
 Replacing :func:`os.system`
@@ -1267,11 +1300,17 @@
 
    sts = os.system("mycmd" + " myarg")
    # becomes
-   sts = call("mycmd" + " myarg", shell=True)
+   retcode = call("mycmd" + " myarg", shell=True)
 
 Notes:
 
 * Calling the program through the shell is usually not required.
+* The :func:`call` return value is encoded differently to that of
+  :func:`os.system`.
+
+* The :func:`os.system` function ignores SIGINT and SIGQUIT signals while
+  the command is running, but the caller must do this separately when
+  using the :mod:`subprocess` module.
 
 A more realistic example would look like this::
 
diff --git a/Doc/library/symbol.rst b/Doc/library/symbol.rst
deleted file mode 100644
index d56600a..0000000
--- a/Doc/library/symbol.rst
+++ /dev/null
@@ -1,32 +0,0 @@
-:mod:`symbol` --- Constants used with Python parse trees
-========================================================
-
-.. module:: symbol
-   :synopsis: Constants representing internal nodes of the parse tree.
-
-.. sectionauthor:: Fred L. Drake, Jr. <fdrake@acm.org>
-
-**Source code:** :source:`Lib/symbol.py`
-
---------------
-
-This module provides constants which represent the numeric values of internal
-nodes of the parse tree.  Unlike most Python constants, these use lower-case
-names.  Refer to the file :file:`Grammar/Grammar` in the Python distribution for
-the definitions of the names in the context of the language grammar.  The
-specific numeric values which the names map to may change between Python
-versions.
-
-.. warning::
-
-   The symbol module is deprecated and will be removed in future versions of
-   Python.
-
-This module also provides one additional data object:
-
-
-.. data:: sym_name
-
-   Dictionary mapping the numeric values of the constants defined in this module
-   back to name strings, allowing more human-readable representation of parse trees
-   to be generated.
diff --git a/Doc/library/symtable.rst b/Doc/library/symtable.rst
index 3efdecb..e364232 100644
--- a/Doc/library/symtable.rst
+++ b/Doc/library/symtable.rst
@@ -156,6 +156,12 @@
 
       Return ``True`` if the symbol is local to its block.
 
+   .. method:: is_annotated()
+
+      Return ``True`` if the symbol is annotated.
+
+      .. versionadded:: 3.6
+
    .. method:: is_free()
 
       Return ``True`` if the symbol is referenced in its block, but not assigned
diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst
index 3df529f..b59fa2c 100644
--- a/Doc/library/sys.rst
+++ b/Doc/library/sys.rst
@@ -26,12 +26,12 @@
 .. function:: addaudithook(hook)
 
    Append the callable *hook* to the list of active auditing hooks for the
-   current interpreter.
+   current (sub)interpreter.
 
    When an auditing event is raised through the :func:`sys.audit` function, each
    hook will be called in the order it was added with the event name and the
    tuple of arguments. Native hooks added by :c:func:`PySys_AddAuditHook` are
-   called first, followed by hooks added in the current interpreter.  Hooks
+   called first, followed by hooks added in the current (sub)interpreter.  Hooks
    can then log the event, raise an exception to abort the operation,
    or terminate the process entirely.
 
@@ -72,6 +72,8 @@
    To loop over the standard input, or the list of files given on the
    command line, see the :mod:`fileinput` module.
 
+   See also :data:`sys.orig_argv`.
+
    .. note::
       On Unix, command line arguments are passed by bytes from OS.  Python decodes
       them with filesystem encoding and "surrogateescape" error handler.
@@ -151,10 +153,12 @@
 
 .. data:: builtin_module_names
 
-   A tuple of strings giving the names of all modules that are compiled into this
+   A tuple of strings containing the names of all modules that are compiled into this
    Python interpreter.  (This information is not available in any other way ---
    ``modules.keys()`` only lists the imported modules.)
 
+   See also the :attr:`sys.stdlib_module_names` list.
+
 
 .. function:: call_tracing(func, args)
 
@@ -194,6 +198,18 @@
 
    .. audit-event:: sys._current_frames "" sys._current_frames
 
+.. function:: _current_exceptions()
+
+   Return a dictionary mapping each thread's identifier to the topmost exception
+   currently active in that thread at the time the function is called.
+   If a thread is not currently handling an exception, it is not included in
+   the result dictionary.
+
+   This is most useful for statistical profiling.
+
+   This function should be used for internal and specialized purposes only.
+
+   .. audit-event:: sys._current_exceptions "" sys._current_exceptions
 
 .. function:: breakpointhook()
 
@@ -234,7 +250,8 @@
    Print low-level information to stderr about the state of CPython's memory
    allocator.
 
-   If Python is configured --with-pydebug, it also performs some expensive
+   If Python is `built in debug mode <debug-build>` (:option:`configure
+   --with-pydebug option <--with-pydebug>`), it also performs some expensive
    internal consistency checks.
 
    .. versionadded:: 3.3
@@ -412,10 +429,7 @@
 
 .. function:: exit([arg])
 
-   Exit from Python.  This is implemented by raising the :exc:`SystemExit`
-   exception, so cleanup actions specified by finally clauses of :keyword:`try`
-   statements are honored, and it is possible to intercept the exit attempt at
-   an outer level.
+   Raise a :exc:`SystemExit` exception, signaling an intention to exit the interpreter.
 
    The optional argument *arg* can be an integer giving the exit status
    (defaulting to zero), or another type of object.  If it is an integer, zero
@@ -432,7 +446,8 @@
 
    Since :func:`exit` ultimately "only" raises an exception, it will only exit
    the process when called from the main thread, and the exception is not
-   intercepted.
+   intercepted. Cleanup actions specified by finally clauses of :keyword:`try` statements
+   are honored, and it is possible to intercept the exit attempt at an outer level.
 
    .. versionchanged:: 3.6
       If an error occurs in the cleanup after the Python interpreter
@@ -613,30 +628,24 @@
 
 .. function:: getfilesystemencoding()
 
-   Return the name of the encoding used to convert between Unicode
-   filenames and bytes filenames. For best compatibility, str should be
-   used for filenames in all cases, although representing filenames as bytes
-   is also supported. Functions accepting or returning filenames should support
-   either str or bytes and internally convert to the system's preferred
-   representation.
+   Get the :term:`filesystem encoding <filesystem encoding and error handler>`:
+   the encoding used with the :term:`filesystem error handler <filesystem
+   encoding and error handler>` to convert between Unicode filenames and bytes
+   filenames. The filesystem error handler is returned from
+   :func:`getfilesystemencoding`.
 
-   This encoding is always ASCII-compatible.
+   For best compatibility, str should be used for filenames in all cases,
+   although representing filenames as bytes is also supported. Functions
+   accepting or returning filenames should support either str or bytes and
+   internally convert to the system's preferred representation.
 
    :func:`os.fsencode` and :func:`os.fsdecode` should be used to ensure that
    the correct encoding and errors mode are used.
 
-   * In the UTF-8 mode, the encoding is ``utf-8`` on any platform.
-
-   * On macOS, the encoding is ``'utf-8'``.
-
-   * On Unix, the encoding is the locale encoding.
-
-   * On Windows, the encoding may be ``'utf-8'`` or ``'mbcs'``, depending
-     on user configuration.
-
-   * On Android, the encoding is ``'utf-8'``.
-
-   * On VxWorks, the encoding is ``'utf-8'``.
+   The :term:`filesystem encoding and error handler` are configured at Python
+   startup by the :c:func:`PyConfig_Read` function: see
+   :c:member:`~PyConfig.filesystem_encoding` and
+   :c:member:`~PyConfig.filesystem_errors` members of :c:type:`PyConfig`.
 
    .. versionchanged:: 3.2
       :func:`getfilesystemencoding` result cannot be ``None`` anymore.
@@ -646,18 +655,26 @@
       and :func:`_enablelegacywindowsfsencoding` for more information.
 
    .. versionchanged:: 3.7
-      Return 'utf-8' in the UTF-8 mode.
+      Return ``'utf-8'`` if the :ref:`Python UTF-8 Mode <utf8-mode>` is
+      enabled.
 
 
 .. function:: getfilesystemencodeerrors()
 
-   Return the name of the error mode used to convert between Unicode filenames
-   and bytes filenames. The encoding name is returned from
+   Get the :term:`filesystem error handler <filesystem encoding and error
+   handler>`: the error handler used with the :term:`filesystem encoding
+   <filesystem encoding and error handler>` to convert between Unicode
+   filenames and bytes filenames. The filesystem encoding is returned from
    :func:`getfilesystemencoding`.
 
    :func:`os.fsencode` and :func:`os.fsdecode` should be used to ensure that
    the correct encoding and errors mode are used.
 
+   The :term:`filesystem encoding and error handler` are configured at Python
+   startup by the :c:func:`PyConfig_Read` function: see
+   :c:member:`~PyConfig.filesystem_encoding` and
+   :c:member:`~PyConfig.filesystem_errors` members of :c:type:`PyConfig`.
+
    .. versionadded:: 3.6
 
 .. function:: getrefcount(object)
@@ -777,11 +794,16 @@
    Microsoft documentation on :c:func:`OSVERSIONINFOEX` for more information
    about these fields.
 
-   *platform_version* returns the accurate major version, minor version and
+   *platform_version* returns the major version, minor version and
    build number of the current operating system, rather than the version that
    is being emulated for the process. It is intended for use in logging rather
    than for feature detection.
 
+   .. note::
+      *platform_version* derives the version from kernel32.dll which can be of a different
+      version than the OS version. Please use :mod:`platform` module for achieving accurate
+      OS version.
+
    .. availability:: Windows.
 
    .. versionchanged:: 3.2
@@ -836,7 +858,7 @@
    +---------------------+--------------------------------------------------+
    | :const:`inf`        | hash value returned for a positive infinity      |
    +---------------------+--------------------------------------------------+
-   | :const:`nan`        | hash value returned for a nan                    |
+   | :const:`nan`        | (this attribute is no longer used)               |
    +---------------------+--------------------------------------------------+
    | :const:`imag`       | multiplier used for the imaginary part of a      |
    |                     | complex number                                   |
@@ -1049,7 +1071,21 @@
    This is a dictionary that maps module names to modules which have already been
    loaded.  This can be manipulated to force reloading of modules and other tricks.
    However, replacing the dictionary will not necessarily work as expected and
-   deleting essential items from the dictionary may cause Python to fail.
+   deleting essential items from the dictionary may cause Python to fail.  If
+   you want to iterate over this global dictionary always use
+   ``sys.modules.copy()`` or ``tuple(sys.modules)`` to avoid exceptions as its
+   size may change during iteration as a side effect of code or activity in
+   other threads.
+
+
+.. data:: orig_argv
+
+   The list of the original command line arguments passed to the Python
+   executable.
+
+   See also :data:`sys.argv`.
+
+   .. versionadded:: 3.10
 
 
 .. data:: path
@@ -1178,13 +1214,10 @@
 .. data:: prefix
 
    A string giving the site-specific directory prefix where the platform
-   independent Python files are installed; by default, this is the string
+   independent Python files are installed; on Unix, the default is
    ``'/usr/local'``.  This can be set at build time with the ``--prefix``
-   argument to the :program:`configure` script.  The main collection of Python
-   library modules is installed in the directory :file:`{prefix}/lib/python{X.Y}`
-   while the platform independent header files (all except :file:`pyconfig.h`) are
-   stored in :file:`{prefix}/include/python{X.Y}`, where *X.Y* is the version
-   number of Python, for example ``3.2``.
+   argument to the :program:`configure` script.  See
+   :ref:`installation_paths` for derived paths.
 
    .. note:: If a :ref:`virtual environment <venv-def>` is in effect, this
       value will be changed in ``site.py`` to point to the virtual
@@ -1439,12 +1472,16 @@
 
 .. function:: _enablelegacywindowsfsencoding()
 
-   Changes the default filesystem encoding and errors mode to 'mbcs' and
-   'replace' respectively, for consistency with versions of Python prior to 3.6.
+   Changes the :term:`filesystem encoding and error handler` to 'mbcs' and
+   'replace' respectively, for consistency with versions of Python prior to
+   3.6.
 
    This is equivalent to defining the :envvar:`PYTHONLEGACYWINDOWSFSENCODING`
    environment variable before launching Python.
 
+   See also :func:`sys.getfilesystemencoding` and
+   :func:`sys.getfilesystemencodeerrors`.
+
    .. availability:: Windows.
 
    .. versionadded:: 3.6
@@ -1467,9 +1504,8 @@
    returned by the :func:`open` function.  Their parameters are chosen as
    follows:
 
-   * The character encoding is platform-dependent.  Non-Windows
-     platforms use the locale encoding (see
-     :meth:`locale.getpreferredencoding()`).
+   * The encoding and error handling are is initialized from
+     :c:member:`PyConfig.stdio_encoding` and :c:member:`PyConfig.stdio_errors`.
 
      On Windows, UTF-8 is used for the console device.  Non-character
      devices such as disk files and pipes use the system locale
@@ -1477,7 +1513,7 @@
      devices such as NUL (i.e. where ``isatty()`` returns ``True``) use the
      value of the console input and output codepages at startup,
      respectively for stdin and stdout/stderr. This defaults to the
-     system locale encoding if the process is not initially attached
+     system :term:`locale encoding` if the process is not initially attached
      to a console.
 
      The special behaviour of the console can be overridden
@@ -1535,6 +1571,25 @@
        to a console and Python apps started with :program:`pythonw`.
 
 
+.. data:: stdlib_module_names
+
+   A frozenset of strings containing the names of standard library modules.
+
+   It is the same on all platforms. Modules which are not available on
+   some platforms and modules disabled at Python build are also listed.
+   All module kinds are listed: pure Python, built-in, frozen and extension
+   modules. Test modules are excluded.
+
+   For packages, only the main package is listed: sub-packages and sub-modules
+   are not listed. For example, the ``email`` package is listed, but the
+   ``email.mime`` sub-package and the ``email.message`` sub-module are not
+   listed.
+
+   See also the :attr:`sys.builtin_module_names` list.
+
+   .. versionadded:: 3.10
+
+
 .. data:: thread_info
 
    A :term:`named tuple` holding information about the thread
diff --git a/Doc/library/sysconfig.rst b/Doc/library/sysconfig.rst
index 78a1dfc..7ef3b24 100644
--- a/Doc/library/sysconfig.rst
+++ b/Doc/library/sysconfig.rst
@@ -32,7 +32,7 @@
 
 Notice that on Windows, it's a much smaller set.
 
-.. function:: get_config_vars(\*args)
+.. function:: get_config_vars(*args)
 
    With no arguments, return a dictionary of all configuration variables
    relevant for the current platform.
@@ -60,6 +60,7 @@
    >>> sysconfig.get_config_vars('AR', 'CXX')
    ['ar', 'g++']
 
+.. _installation_paths:
 
 Installation paths
 ------------------
@@ -72,9 +73,9 @@
 Distutils-based system will follow the same scheme to copy its file in the right
 places.
 
-Python currently supports seven schemes:
+Python currently supports six schemes:
 
-- *posix_prefix*: scheme for POSIX platforms like Linux or Mac OS X.  This is
+- *posix_prefix*: scheme for POSIX platforms like Linux or macOS.  This is
   the default scheme used when Python or a component is installed.
 - *posix_home*: scheme for POSIX platforms used when a *home* option is used
   upon installation.  This scheme is used when a component is installed through
@@ -84,6 +85,7 @@
   located under the user home directory.
 - *nt*: scheme for NT platforms like Windows.
 - *nt_user*: scheme for NT platforms, when the *user* option is used.
+- *osx_framework_user*: scheme for macOS, when the *user* option is used.
 
 Each scheme is itself composed of a series of paths and each path has a unique
 identifier.  Python currently uses eight paths:
@@ -107,6 +109,43 @@
    :mod:`sysconfig`.
 
 
+.. function:: get_default_scheme()
+
+   Return the default scheme name for the current platform.
+
+   .. versionchanged:: 3.10
+      This function was previously named ``_get_default_scheme()`` and
+      considered an implementation detail.
+
+
+.. function:: get_preferred_scheme(key)
+
+   Return a preferred scheme name for an installation layout specified by *key*.
+
+   *key* must be either ``"prefix"``, ``"home"``, or ``"user"``.
+
+   The return value is a scheme name listed in :func:`get_scheme_names`. It
+   can be passed to :mod:`sysconfig` functions that take a *scheme* argument,
+   such as :func:`get_paths`.
+
+   .. versionadded:: 3.10
+
+
+.. function:: _get_preferred_schemes()
+
+   Return a dict containing preferred scheme names on the current platform.
+   Python implementers and redistributors may add their preferred schemes to
+   the ``_INSTALL_SCHEMES`` module-level global value, and modify this function
+   to return those scheme names, to e.g. provide different schemes for system
+   and language package managers to use, so packages installed by either do not
+   mix with those by the other.
+
+   End users should not use this function, but :func:`get_default_scheme` and
+   :func:`get_preferred_scheme()` instead.
+
+   .. versionadded:: 3.10
+
+
 .. function:: get_path_names()
 
    Return a tuple containing all path names currently supported in
@@ -138,7 +177,7 @@
    If *expand* is set to ``False``, the path will not be expanded using the
    variables.
 
-   If *name* is not found, return ``None``.
+   If *name* is not found, raise a :exc:`KeyError`.
 
 
 .. function:: get_paths([scheme, [vars, [expand]]])
@@ -188,7 +227,7 @@
    - win-amd64 (64bit Windows on AMD64, aka x86_64, Intel64, and EM64T)
    - win32 (all others - specifically, sys.platform is returned)
 
-   Mac OS X can return:
+   macOS can return:
 
    - macosx-10.6-ppc
    - macosx-10.4-ppc64
@@ -224,6 +263,7 @@
 
    Return the path of :file:`Makefile`.
 
+
 Using :mod:`sysconfig` as a script
 ----------------------------------
 
diff --git a/Doc/library/tarfile.rst b/Doc/library/tarfile.rst
index 7a114fd..6afb839 100644
--- a/Doc/library/tarfile.rst
+++ b/Doc/library/tarfile.rst
@@ -37,7 +37,7 @@
    Added support for :mod:`lzma` compression.
 
 
-.. function:: open(name=None, mode='r', fileobj=None, bufsize=10240, \*\*kwargs)
+.. function:: open(name=None, mode='r', fileobj=None, bufsize=10240, **kwargs)
 
    Return a :class:`TarFile` object for the pathname *name*. For detailed
    information on :class:`TarFile` objects and the keyword arguments that are
@@ -102,6 +102,9 @@
    ``'x:bz2'``, :func:`tarfile.open` accepts the keyword argument
    *compresslevel* (default ``9``) to specify the compression level of the file.
 
+   For modes ``'w:xz'`` and ``'x:xz'``, :func:`tarfile.open` accepts the
+   keyword argument *preset* to specify the compression level of the file.
+
    For special purposes, there is a second format for *mode*:
    ``'filemode|[compression]'``.  :func:`tarfile.open` will return a :class:`TarFile`
    object that processes its data as a stream of blocks.  No random seeking will
diff --git a/Doc/library/tempfile.rst b/Doc/library/tempfile.rst
index f9421da..6b23a1b 100644
--- a/Doc/library/tempfile.rst
+++ b/Doc/library/tempfile.rst
@@ -62,6 +62,9 @@
    The :py:data:`os.O_TMPFILE` flag is used if it is available and works
    (Linux-specific, requires Linux kernel 3.11 or later).
 
+   On platforms that are neither Posix nor Cygwin, TemporaryFile is an alias
+   for NamedTemporaryFile.
+
    .. audit-event:: tempfile.mkstemp fullpath tempfile.TemporaryFile
 
    .. versionchanged:: 3.5
@@ -118,12 +121,12 @@
       Added *errors* parameter.
 
 
-.. function:: TemporaryDirectory(suffix=None, prefix=None, dir=None)
+.. function:: TemporaryDirectory(suffix=None, prefix=None, dir=None, ignore_cleanup_errors=False)
 
    This function securely creates a temporary directory using the same rules as :func:`mkdtemp`.
    The resulting object can be used as a context manager (see
    :ref:`tempfile-examples`).  On completion of the context or destruction
-   of the temporary directory object the newly created temporary directory
+   of the temporary directory object, the newly created temporary directory
    and all its contents are removed from the filesystem.
 
    The directory name can be retrieved from the :attr:`name` attribute of the
@@ -132,12 +135,21 @@
    the :keyword:`with` statement, if there is one.
 
    The directory can be explicitly cleaned up by calling the
-   :func:`cleanup` method.
+   :func:`cleanup` method. If *ignore_cleanup_errors* is true, any unhandled
+   exceptions during explicit or implicit cleanup (such as a
+   :exc:`PermissionError` removing open files on Windows) will be ignored,
+   and the remaining removable items deleted on a "best-effort" basis.
+   Otherwise, errors will be raised in whatever context cleanup occurs
+   (the :func:`cleanup` call, exiting the context manager, when the object
+   is garbage-collected or during interpreter shutdown).
 
    .. audit-event:: tempfile.mkdtemp fullpath tempfile.TemporaryDirectory
 
    .. versionadded:: 3.2
 
+   .. versionchanged:: 3.10
+      Added *ignore_cleanup_errors* parameter.
+
 
 .. function:: mkstemp(suffix=None, prefix=None, dir=None, text=False)
 
@@ -248,6 +260,11 @@
    The result of this search is cached, see the description of
    :data:`tempdir` below.
 
+   .. versionchanged:: 3.10
+
+      Always returns a str.  Previously it would return any :data:`tempdir`
+      value regardless of type so long as it was not ``None``.
+
 .. function:: gettempdirb()
 
    Same as :func:`gettempdir` but the return value is in bytes.
@@ -269,18 +286,30 @@
 used for temporary files returned by :func:`gettempdir`.  It can be
 set directly to override the selection process, but this is discouraged.
 All functions in this module take a *dir* argument which can be used
-to specify the directory and this is the recommended approach.
+to specify the directory. This is the recommended approach that does
+not surprise other unsuspecting code by changing global API behavior.
 
 .. data:: tempdir
 
    When set to a value other than ``None``, this variable defines the
    default value for the *dir* argument to the functions defined in this
-   module.
+   module, including its type, bytes or str.  It cannot be a
+   :term:`path-like object`.
 
    If ``tempdir`` is ``None`` (the default) at any call to any of the above
    functions except :func:`gettempprefix` it is initialized following the
    algorithm described in :func:`gettempdir`.
 
+   .. note::
+
+      Beware that if you set ``tempdir`` to a bytes value, there is a
+      nasty side effect: The global default return type of
+      :func:`mkstemp` and :func:`mkdtemp` changes to bytes when no
+      explicit ``prefix``, ``suffix``, or ``dir`` arguments of type
+      str are supplied. Please do not write code expecting or
+      depending on this. This awkward behavior is maintained for
+      compatibility with the historical implementation.
+
 .. _tempfile-examples:
 
 Examples
@@ -315,6 +344,7 @@
     >>>
     # directory and contents have been removed
 
+.. _tempfile-mktemp-deprecated:
 
 Deprecated functions and variables
 ----------------------------------
diff --git a/Doc/library/test.rst b/Doc/library/test.rst
index e24f69c..a8dc354 100644
--- a/Doc/library/test.rst
+++ b/Doc/library/test.rst
@@ -247,46 +247,6 @@
    Path for shell if not on Windows; otherwise ``None``.
 
 
-.. data:: FS_NONASCII
-
-   A non-ASCII character encodable by :func:`os.fsencode`.
-
-
-.. data:: TESTFN
-
-   Set to a name that is safe to use as the name of a temporary file.  Any
-   temporary file that is created should be closed and unlinked (removed).
-
-
-.. data:: TESTFN_UNICODE
-
-    Set to a non-ASCII name for a temporary file.
-
-
-.. data:: TESTFN_ENCODING
-
-   Set to :func:`sys.getfilesystemencoding`.
-
-
-.. data:: TESTFN_UNENCODABLE
-
-   Set to a filename (str type) that should not be able to be encoded by file
-   system encoding in strict mode.  It may be ``None`` if it's not possible to
-   generate such a filename.
-
-
-.. data:: TESTFN_UNDECODABLE
-
-   Set to a filename (bytes type) that should not be able to be decoded by
-   file system encoding in strict mode.  It may be ``None`` if it's not
-   possible to generate such a filename.
-
-
-.. data:: TESTFN_NONASCII
-
-   Set to a filename containing the :data:`FS_NONASCII` character.
-
-
 .. data:: LOOPBACK_TIMEOUT
 
    Timeout in seconds for tests using a network server listening on the network
@@ -307,10 +267,10 @@
 
 .. data:: INTERNET_TIMEOUT
 
-   Timeout in seconds for network requests going to the Internet.
+   Timeout in seconds for network requests going to the internet.
 
    The timeout is short enough to prevent a test to wait for too long if the
-   Internet request is blocked for whatever reason.
+   internet request is blocked for whatever reason.
 
    Usually, a timeout using :data:`INTERNET_TIMEOUT` should not mark a test as
    failed, but skip the test instead: see
@@ -348,11 +308,6 @@
    :data:`SHORT_TIMEOUT`.
 
 
-.. data:: SAVEDCWD
-
-   Set to :func:`os.getcwd`.
-
-
 .. data:: PGO
 
    Set when tests can be skipped when they are not useful for PGO.
@@ -443,44 +398,6 @@
 
 The :mod:`test.support` module defines the following functions:
 
-.. function:: forget(module_name)
-
-   Remove the module named *module_name* from ``sys.modules`` and delete any
-   byte-compiled files of the module.
-
-
-.. function:: unload(name)
-
-   Delete *name* from ``sys.modules``.
-
-
-.. function:: unlink(filename)
-
-   Call :func:`os.unlink` on *filename*.  On Windows platforms, this is
-   wrapped with a wait loop that checks for the existence fo the file.
-
-
-.. function:: rmdir(filename)
-
-   Call :func:`os.rmdir` on *filename*.  On Windows platforms, this is
-   wrapped with a wait loop that checks for the existence of the file.
-
-
-.. function:: rmtree(path)
-
-   Call :func:`shutil.rmtree` on *path* or call :func:`os.lstat` and
-   :func:`os.rmdir` to remove a path and its contents.  On Windows platforms,
-   this is wrapped with a wait loop that checks for the existence of the files.
-
-
-.. function:: make_legacy_pyc(source)
-
-   Move a :pep:`3147`/:pep:`488` pyc file to its legacy pyc location and return the file
-   system path to the legacy pyc file.  The *source* value is the file system
-   path to the source file.  It does not need to exist, however the PEP
-   3147/488 pyc file must exist.
-
-
 .. function:: is_resource_enabled(resource)
 
    Return ``True`` if *resource* is enabled and available. The list of
@@ -526,16 +443,6 @@
    rather than looking directly in the path directories.
 
 
-.. function:: create_empty_file(filename)
-
-   Create an empty file with *filename*.  If it already exists, truncate it.
-
-
-.. function:: fd_count()
-
-   Count the number of open file descriptors.
-
-
 .. function:: match_test(test)
 
    Match *test* to patterns set in :func:`set_match_tests`.
@@ -546,7 +453,7 @@
    Define match test with regular expression *patterns*.
 
 
-.. function:: run_unittest(\*classes)
+.. function:: run_unittest(*classes)
 
    Execute :class:`unittest.TestCase` subclasses passed to the function. The
    function scans the classes for methods starting with the prefix ``test_``
@@ -590,79 +497,6 @@
       check_impl_detail(cpython=False)  # Everywhere except CPython.
 
 
-.. function:: check_warnings(\*filters, quiet=True)
-
-   A convenience wrapper for :func:`warnings.catch_warnings()` that makes it
-   easier to test that a warning was correctly raised.  It is approximately
-   equivalent to calling ``warnings.catch_warnings(record=True)`` with
-   :meth:`warnings.simplefilter` set to ``always`` and with the option to
-   automatically validate the results that are recorded.
-
-   ``check_warnings`` accepts 2-tuples of the form ``("message regexp",
-   WarningCategory)`` as positional arguments. If one or more *filters* are
-   provided, or if the optional keyword argument *quiet* is ``False``,
-   it checks to make sure the warnings are as expected:  each specified filter
-   must match at least one of the warnings raised by the enclosed code or the
-   test fails, and if any warnings are raised that do not match any of the
-   specified filters the test fails.  To disable the first of these checks,
-   set *quiet* to ``True``.
-
-   If no arguments are specified, it defaults to::
-
-      check_warnings(("", Warning), quiet=True)
-
-   In this case all warnings are caught and no errors are raised.
-
-   On entry to the context manager, a :class:`WarningRecorder` instance is
-   returned. The underlying warnings list from
-   :func:`~warnings.catch_warnings` is available via the recorder object's
-   :attr:`warnings` attribute.  As a convenience, the attributes of the object
-   representing the most recent warning can also be accessed directly through
-   the recorder object (see example below).  If no warning has been raised,
-   then any of the attributes that would otherwise be expected on an object
-   representing a warning will return ``None``.
-
-   The recorder object also has a :meth:`reset` method, which clears the
-   warnings list.
-
-   The context manager is designed to be used like this::
-
-      with check_warnings(("assertion is always true", SyntaxWarning),
-                          ("", UserWarning)):
-          exec('assert(False, "Hey!")')
-          warnings.warn(UserWarning("Hide me!"))
-
-   In this case if either warning was not raised, or some other warning was
-   raised, :func:`check_warnings` would raise an error.
-
-   When a test needs to look more deeply into the warnings, rather than
-   just checking whether or not they occurred, code like this can be used::
-
-      with check_warnings(quiet=True) as w:
-          warnings.warn("foo")
-          assert str(w.args[0]) == "foo"
-          warnings.warn("bar")
-          assert str(w.args[0]) == "bar"
-          assert str(w.warnings[0].args[0]) == "foo"
-          assert str(w.warnings[1].args[0]) == "bar"
-          w.reset()
-          assert len(w.warnings) == 0
-
-
-   Here all warnings will be caught, and the test code tests the captured
-   warnings directly.
-
-   .. versionchanged:: 3.2
-      New optional arguments *filters* and *quiet*.
-
-
-.. function:: check_no_resource_warning(testcase)
-
-   Context manager to check that no :exc:`ResourceWarning` was raised.  You
-   must remove the object which may emit :exc:`ResourceWarning` before the
-   end of the context manager.
-
-
 .. function:: set_memlimit(limit)
 
    Set the values for :data:`max_memuse` and :data:`real_max_memuse` for big
@@ -718,47 +552,6 @@
       self.assertEqual(captured, "hello")
 
 
-.. function:: temp_dir(path=None, quiet=False)
-
-   A context manager that creates a temporary directory at *path* and
-   yields the directory.
-
-   If *path* is ``None``, the temporary directory is created using
-   :func:`tempfile.mkdtemp`.  If *quiet* is ``False``, the context manager
-   raises an exception on error.  Otherwise, if *path* is specified and
-   cannot be created, only a warning is issued.
-
-
-.. function:: change_cwd(path, quiet=False)
-
-   A context manager that temporarily changes the current working
-   directory to *path* and yields the directory.
-
-   If *quiet* is ``False``, the context manager raises an exception
-   on error.  Otherwise, it issues only a warning and keeps the current
-   working directory the same.
-
-
-.. function:: temp_cwd(name='tempcwd', quiet=False)
-
-   A context manager that temporarily creates a new directory and
-   changes the current working directory (CWD).
-
-   The context manager creates a temporary directory in the current
-   directory with name *name* before temporarily changing the current
-   working directory.  If *name* is ``None``, the temporary directory is
-   created using :func:`tempfile.mkdtemp`.
-
-   If *quiet* is ``False`` and it is not possible to create or change
-   the CWD, an error is raised.  Otherwise, only a warning is raised
-   and the original CWD is used.
-
-
-.. function:: temp_umask(umask)
-
-   A context manager that temporarily sets the process umask.
-
-
 .. function:: disable_faulthandler()
 
    A context manager that replaces ``sys.stderr`` with ``sys.__stderr__``.
@@ -838,18 +631,6 @@
    .. versionadded:: 3.9
 
 
-.. function:: wait_threads_exit(timeout=60.0)
-
-   Context manager to wait until all threads created in the ``with`` statement
-   exit.
-
-
-.. function:: start_threads(threads, unlock=None)
-
-   Context manager to start *threads*.  It attempts to join the threads upon
-   exit.
-
-
 .. function:: calcobjsize(fmt)
 
    Return :func:`struct.calcsize` for ``nP{fmt}0n`` or, if ``gettotalrefcount``
@@ -868,28 +649,6 @@
    header size equals *size*.
 
 
-.. function:: can_symlink()
-
-   Return ``True`` if the OS supports symbolic links, ``False``
-   otherwise.
-
-
-.. function:: can_xattr()
-
-   Return ``True`` if the OS supports xattr, ``False``
-   otherwise.
-
-
-.. decorator:: skip_unless_symlink
-
-   A decorator for running tests that require support for symbolic links.
-
-
-.. decorator:: skip_unless_xattr
-
-   A decorator for running tests that require support for xattr.
-
-
 .. decorator:: anticipate_failure(condition)
 
    A decorator to conditionally mark tests with
@@ -925,8 +684,8 @@
 
 .. decorator:: requires_mac_version(*min_version)
 
-   Decorator for the minimum version when running test on Mac OS X.  If the
-   MAC OS X version is less than the minimum, raise :exc:`unittest.SkipTest`.
+   Decorator for the minimum version when running test on macOS.  If the
+   macOS version is less than the minimum, raise :exc:`unittest.SkipTest`.
 
 
 .. decorator:: requires_IEEE_754
@@ -988,11 +747,6 @@
    the trace function.
 
 
-.. decorator:: reap_threads(func)
-
-   Decorator to ensure the threads are cleaned up even if the test fails.
-
-
 .. decorator:: bigmemtest(size, memuse, dry_run=True)
 
    Decorator for bigmem tests.
@@ -1014,12 +768,6 @@
    wrap.
 
 
-.. function:: make_bad_fd()
-
-   Create an invalid file descriptor by opening and closing a temporary file,
-   and returning its descriptor.
-
-
 .. function:: check_syntax_error(testcase, statement, errtext='', *, lineno=None, offset=None)
 
    Test for syntax errors in *statement* by attempting to compile *statement*.
@@ -1030,103 +778,11 @@
    the offset of the exception.
 
 
-.. function:: check_syntax_warning(testcase, statement, errtext='', *, lineno=1, offset=None)
-
-   Test for syntax warning in *statement* by attempting to compile *statement*.
-   Test also that the :exc:`SyntaxWarning` is emitted only once, and that it
-   will be converted to a :exc:`SyntaxError` when turned into error.
-   *testcase* is the :mod:`unittest` instance for the test.  *errtext* is the
-   regular expression which should match the string representation of the
-   emitted :exc:`SyntaxWarning` and raised :exc:`SyntaxError`.  If *lineno*
-   is not ``None``, compares to the line of the warning and exception.
-   If *offset* is not ``None``, compares to the offset of the exception.
-
-   .. versionadded:: 3.8
-
-
 .. function:: open_urlresource(url, *args, **kw)
 
    Open *url*.  If open fails, raises :exc:`TestFailed`.
 
 
-.. function:: import_module(name, deprecated=False, *, required_on())
-
-   This function imports and returns the named module. Unlike a normal
-   import, this function raises :exc:`unittest.SkipTest` if the module
-   cannot be imported.
-
-   Module and package deprecation messages are suppressed during this import
-   if *deprecated* is ``True``.  If a module is required on a platform but
-   optional for others, set *required_on* to an iterable of platform prefixes
-   which will be compared against :data:`sys.platform`.
-
-   .. versionadded:: 3.1
-
-
-.. function:: import_fresh_module(name, fresh=(), blocked=(), deprecated=False)
-
-   This function imports and returns a fresh copy of the named Python module
-   by removing the named module from ``sys.modules`` before doing the import.
-   Note that unlike :func:`reload`, the original module is not affected by
-   this operation.
-
-   *fresh* is an iterable of additional module names that are also removed
-   from the ``sys.modules`` cache before doing the import.
-
-   *blocked* is an iterable of module names that are replaced with ``None``
-   in the module cache during the import to ensure that attempts to import
-   them raise :exc:`ImportError`.
-
-   The named module and any modules named in the *fresh* and *blocked*
-   parameters are saved before starting the import and then reinserted into
-   ``sys.modules`` when the fresh import is complete.
-
-   Module and package deprecation messages are suppressed during this import
-   if *deprecated* is ``True``.
-
-   This function will raise :exc:`ImportError` if the named module cannot be
-   imported.
-
-   Example use::
-
-      # Get copies of the warnings module for testing without affecting the
-      # version being used by the rest of the test suite. One copy uses the
-      # C implementation, the other is forced to use the pure Python fallback
-      # implementation
-      py_warnings = import_fresh_module('warnings', blocked=['_warnings'])
-      c_warnings = import_fresh_module('warnings', fresh=['_warnings'])
-
-   .. versionadded:: 3.1
-
-
-.. function:: modules_setup()
-
-   Return a copy of :data:`sys.modules`.
-
-
-.. function:: modules_cleanup(oldmodules)
-
-   Remove modules except for *oldmodules* and ``encodings`` in order to
-   preserve internal cache.
-
-
-.. function:: threading_setup()
-
-   Return current thread count and copy of dangling threads.
-
-
-.. function:: threading_cleanup(*original_values)
-
-   Cleanup up threads not specified in *original_values*.  Designed to emit
-   a warning if a test leaves running threads in the background.
-
-
-.. function:: join_thread(thread, timeout=30.0)
-
-   Join a *thread* within *timeout*.  Raise an :exc:`AssertionError` if thread
-   is still alive after *timeout* seconds.
-
-
 .. function:: reap_children()
 
    Use this at the end of ``test_main`` whenever sub-processes are started.
@@ -1140,39 +796,6 @@
    is raised.
 
 
-.. function:: catch_threading_exception()
-
-   Context manager catching :class:`threading.Thread` exception using
-   :func:`threading.excepthook`.
-
-   Attributes set when an exception is catched:
-
-   * ``exc_type``
-   * ``exc_value``
-   * ``exc_traceback``
-   * ``thread``
-
-   See :func:`threading.excepthook` documentation.
-
-   These attributes are deleted at the context manager exit.
-
-   Usage::
-
-       with support.catch_threading_exception() as cm:
-           # code spawning a thread which raises an exception
-           ...
-
-           # check the thread exception, use cm attributes:
-           # exc_type, exc_value, exc_traceback, thread
-           ...
-
-       # exc_type, exc_value, exc_traceback, thread attributes of cm no longer
-       # exists at this point
-       # (to avoid reference cycles)
-
-   .. versionadded:: 3.8
-
-
 .. function:: catch_unraisable_exception()
 
    Context manager catching unraisable exception using
@@ -1216,11 +839,6 @@
           return load_package_tests(os.path.dirname(__file__), *args)
 
 
-.. function:: fs_is_case_insensitive(directory)
-
-   Return ``True`` if the file system for *directory* is case-insensitive.
-
-
 .. function:: detect_api_mismatch(ref_api, other_api, *, ignore=())
 
    Returns the set of attributes, functions or methods of *ref_api* not
@@ -1260,7 +878,7 @@
    missing.
 
 
-.. function:: check__all__(test_case, module, name_of_module=None, extra=(), blacklist=())
+.. function:: check__all__(test_case, module, name_of_module=None, extra=(), not_exported=())
 
    Assert that the ``__all__`` variable of *module* contains all public names.
 
@@ -1277,8 +895,8 @@
    detected as "public", like objects without a proper ``__module__``
    attribute. If provided, it will be added to the automatically detected ones.
 
-   The *blacklist* argument can be a set of names that must not be treated as part of
-   the public API even though their names indicate otherwise.
+   The *not_exported* argument can be a set of names that must not be treated
+   as part of the public API even though their names indicate otherwise.
 
    Example use::
 
@@ -1294,46 +912,31 @@
       class OtherTestCase(unittest.TestCase):
           def test__all__(self):
               extra = {'BAR_CONST', 'FOO_CONST'}
-              blacklist = {'baz'}  # Undocumented name.
+              not_exported = {'baz'}  # Undocumented name.
               # bar imports part of its API from _bar.
               support.check__all__(self, bar, ('bar', '_bar'),
-                                   extra=extra, blacklist=blacklist)
+                                   extra=extra, not_exported=not_exported)
 
    .. versionadded:: 3.6
 
+.. function:: skip_if_broken_multiprocessing_synchronize()
+
+   Skip tests if the :mod:`multiprocessing.synchronize` module is missing, if
+   there is no available semaphore implementation, or if creating a lock raises
+   an :exc:`OSError`.
+
+   .. versionadded:: 3.10
+
+
+.. function:: check_disallow_instantiation(test_case, tp, *args, **kwds)
+
+   Assert that type *tp* cannot be instantiated using *args* and *kwds*.
+
+   .. versionadded:: 3.10
+
 
 The :mod:`test.support` module defines the following classes:
 
-.. class:: TransientResource(exc, **kwargs)
-
-   Instances are a context manager that raises :exc:`ResourceDenied` if the
-   specified exception type is raised.  Any keyword arguments are treated as
-   attribute/value pairs to be compared against any exception raised within the
-   :keyword:`with` statement.  Only if all pairs match properly against
-   attributes on the exception is :exc:`ResourceDenied` raised.
-
-
-.. class:: EnvironmentVarGuard()
-
-   Class used to temporarily set or unset environment variables.  Instances can
-   be used as a context manager and have a complete dictionary interface for
-   querying/modifying the underlying ``os.environ``. After exit from the
-   context manager all changes to environment variables done through this
-   instance will be rolled back.
-
-   .. versionchanged:: 3.1
-      Added dictionary interface.
-
-.. method:: EnvironmentVarGuard.set(envvar, value)
-
-   Temporarily set the environment variable ``envvar`` to the value of
-   ``value``.
-
-
-.. method:: EnvironmentVarGuard.unset(envvar)
-
-   Temporarily unset the environment variable ``envvar``.
-
 
 .. class:: SuppressCrashReport()
 
@@ -1350,29 +953,6 @@
    On both platforms, the old value is restored by :meth:`__exit__`.
 
 
-.. class:: CleanImport(*module_names)
-
-   A context manager to force import to return a new module reference.  This
-   is useful for testing module-level behaviors, such as the emission of a
-   DeprecationWarning on import.  Example usage::
-
-      with CleanImport('foo'):
-          importlib.import_module('foo')  # New reference.
-
-
-.. class:: DirsOnSysPath(*paths)
-
-   A context manager to temporarily add directories to sys.path.
-
-   This makes a copy of :data:`sys.path`, appends any directories given
-   as positional arguments, then reverts :data:`sys.path` to the copied
-   settings when the context ends.
-
-   Note that *all* :data:`sys.path` modifications in the body of the
-   context manager, including replacement of the object,
-   will be reverted at the end of the block.
-
-
 .. class:: SaveSignals()
 
    Class to save and restore signal handlers registered by the Python signal
@@ -1391,12 +971,6 @@
       Try to match a single stored value (*dv*) with a supplied value (*v*).
 
 
-.. class:: WarningsRecorder()
-
-   Class used to record warnings for unit tests. See documentation of
-   :func:`check_warnings` above for more details.
-
-
 .. class:: BasicTestRunner()
 
    .. method:: run(test)
@@ -1404,13 +978,6 @@
       Run *test* and return the result.
 
 
-.. class:: FakePath(path)
-
-   Simple :term:`path-like object`.  It implements the :meth:`__fspath__`
-   method which just returns the *path* argument.  If *path* is an exception,
-   it will be raised in :meth:`!__fspath__`.
-
-
 :mod:`test.support.socket_helper` --- Utilities for socket tests
 ================================================================
 
@@ -1630,3 +1197,483 @@
 .. method:: BytecodeTestCase.assertNotInBytecode(x, opname, argval=_UNSPECIFIED)
 
    Throws :exc:`AssertionError` if *opname* is found.
+
+
+:mod:`test.support.threading_helper` --- Utilities for threading tests
+======================================================================
+
+.. module:: test.support.threading_helper
+   :synopsis: Support for threading tests.
+
+The :mod:`test.support.threading_helper` module provides support for threading tests.
+
+.. versionadded:: 3.10
+
+
+.. function:: join_thread(thread, timeout=None)
+
+   Join a *thread* within *timeout*.  Raise an :exc:`AssertionError` if thread
+   is still alive after *timeout* seconds.
+
+
+.. decorator:: reap_threads(func)
+
+   Decorator to ensure the threads are cleaned up even if the test fails.
+
+
+.. function:: start_threads(threads, unlock=None)
+
+   Context manager to start *threads*.  It attempts to join the threads upon
+   exit.
+
+
+.. function:: threading_cleanup(*original_values)
+
+   Cleanup up threads not specified in *original_values*.  Designed to emit
+   a warning if a test leaves running threads in the background.
+
+
+.. function:: threading_setup()
+
+   Return current thread count and copy of dangling threads.
+
+
+.. function:: wait_threads_exit(timeout=None)
+
+   Context manager to wait until all threads created in the ``with`` statement
+   exit.
+
+
+.. function:: catch_threading_exception()
+
+   Context manager catching :class:`threading.Thread` exception using
+   :func:`threading.excepthook`.
+
+   Attributes set when an exception is caught:
+
+   * ``exc_type``
+   * ``exc_value``
+   * ``exc_traceback``
+   * ``thread``
+
+   See :func:`threading.excepthook` documentation.
+
+   These attributes are deleted at the context manager exit.
+
+   Usage::
+
+       with threading_helper.catch_threading_exception() as cm:
+           # code spawning a thread which raises an exception
+           ...
+
+           # check the thread exception, use cm attributes:
+           # exc_type, exc_value, exc_traceback, thread
+           ...
+
+       # exc_type, exc_value, exc_traceback, thread attributes of cm no longer
+       # exists at this point
+       # (to avoid reference cycles)
+
+   .. versionadded:: 3.8
+
+
+:mod:`test.support.os_helper` --- Utilities for os tests
+========================================================================
+
+.. module:: test.support.os_helper
+   :synopsis: Support for os tests.
+
+The :mod:`test.support.os_helper` module provides support for os tests.
+
+.. versionadded:: 3.10
+
+
+.. data:: FS_NONASCII
+
+   A non-ASCII character encodable by :func:`os.fsencode`.
+
+
+.. data:: SAVEDCWD
+
+   Set to :func:`os.getcwd`.
+
+
+.. data:: TESTFN
+
+   Set to a name that is safe to use as the name of a temporary file.  Any
+   temporary file that is created should be closed and unlinked (removed).
+
+
+.. data:: TESTFN_NONASCII
+
+   Set to a filename containing the :data:`FS_NONASCII` character.
+
+
+.. data:: TESTFN_UNENCODABLE
+
+   Set to a filename (str type) that should not be able to be encoded by file
+   system encoding in strict mode.  It may be ``None`` if it's not possible to
+   generate such a filename.
+
+
+.. data:: TESTFN_UNDECODABLE
+
+   Set to a filename (bytes type) that should not be able to be decoded by
+   file system encoding in strict mode.  It may be ``None`` if it's not
+   possible to generate such a filename.
+
+
+.. data:: TESTFN_UNICODE
+
+    Set to a non-ASCII name for a temporary file.
+
+
+.. class:: EnvironmentVarGuard()
+
+   Class used to temporarily set or unset environment variables.  Instances can
+   be used as a context manager and have a complete dictionary interface for
+   querying/modifying the underlying ``os.environ``. After exit from the
+   context manager all changes to environment variables done through this
+   instance will be rolled back.
+
+   .. versionchanged:: 3.1
+      Added dictionary interface.
+
+
+.. class:: FakePath(path)
+
+   Simple :term:`path-like object`.  It implements the :meth:`__fspath__`
+   method which just returns the *path* argument.  If *path* is an exception,
+   it will be raised in :meth:`!__fspath__`.
+
+
+.. method:: EnvironmentVarGuard.set(envvar, value)
+
+   Temporarily set the environment variable ``envvar`` to the value of
+   ``value``.
+
+
+.. method:: EnvironmentVarGuard.unset(envvar)
+
+   Temporarily unset the environment variable ``envvar``.
+
+
+.. function:: can_symlink()
+
+   Return ``True`` if the OS supports symbolic links, ``False``
+   otherwise.
+
+
+.. function:: can_xattr()
+
+   Return ``True`` if the OS supports xattr, ``False``
+   otherwise.
+
+
+.. function:: change_cwd(path, quiet=False)
+
+   A context manager that temporarily changes the current working
+   directory to *path* and yields the directory.
+
+   If *quiet* is ``False``, the context manager raises an exception
+   on error.  Otherwise, it issues only a warning and keeps the current
+   working directory the same.
+
+
+.. function:: create_empty_file(filename)
+
+   Create an empty file with *filename*.  If it already exists, truncate it.
+
+
+.. function:: fd_count()
+
+   Count the number of open file descriptors.
+
+
+.. function:: fs_is_case_insensitive(directory)
+
+   Return ``True`` if the file system for *directory* is case-insensitive.
+
+
+.. function:: make_bad_fd()
+
+   Create an invalid file descriptor by opening and closing a temporary file,
+   and returning its descriptor.
+
+
+.. function:: rmdir(filename)
+
+   Call :func:`os.rmdir` on *filename*.  On Windows platforms, this is
+   wrapped with a wait loop that checks for the existence of the file.
+
+
+.. function:: rmtree(path)
+
+   Call :func:`shutil.rmtree` on *path* or call :func:`os.lstat` and
+   :func:`os.rmdir` to remove a path and its contents.  On Windows platforms,
+   this is wrapped with a wait loop that checks for the existence of the files.
+
+
+.. decorator:: skip_unless_symlink
+
+   A decorator for running tests that require support for symbolic links.
+
+
+.. decorator:: skip_unless_xattr
+
+   A decorator for running tests that require support for xattr.
+
+
+.. function:: temp_cwd(name='tempcwd', quiet=False)
+
+   A context manager that temporarily creates a new directory and
+   changes the current working directory (CWD).
+
+   The context manager creates a temporary directory in the current
+   directory with name *name* before temporarily changing the current
+   working directory.  If *name* is ``None``, the temporary directory is
+   created using :func:`tempfile.mkdtemp`.
+
+   If *quiet* is ``False`` and it is not possible to create or change
+   the CWD, an error is raised.  Otherwise, only a warning is raised
+   and the original CWD is used.
+
+
+.. function:: temp_dir(path=None, quiet=False)
+
+   A context manager that creates a temporary directory at *path* and
+   yields the directory.
+
+   If *path* is ``None``, the temporary directory is created using
+   :func:`tempfile.mkdtemp`.  If *quiet* is ``False``, the context manager
+   raises an exception on error.  Otherwise, if *path* is specified and
+   cannot be created, only a warning is issued.
+
+
+.. function:: temp_umask(umask)
+
+   A context manager that temporarily sets the process umask.
+
+
+.. function:: unlink(filename)
+
+   Call :func:`os.unlink` on *filename*.  On Windows platforms, this is
+   wrapped with a wait loop that checks for the existence of the file.
+
+
+:mod:`test.support.import_helper` --- Utilities for import tests
+================================================================
+
+.. module:: test.support.import_helper
+   :synopsis: Support for import tests.
+
+The :mod:`test.support.import_helper` module provides support for import tests.
+
+.. versionadded:: 3.10
+
+
+.. function:: forget(module_name)
+
+   Remove the module named *module_name* from ``sys.modules`` and delete any
+   byte-compiled files of the module.
+
+
+.. function:: import_fresh_module(name, fresh=(), blocked=(), deprecated=False)
+
+   This function imports and returns a fresh copy of the named Python module
+   by removing the named module from ``sys.modules`` before doing the import.
+   Note that unlike :func:`reload`, the original module is not affected by
+   this operation.
+
+   *fresh* is an iterable of additional module names that are also removed
+   from the ``sys.modules`` cache before doing the import.
+
+   *blocked* is an iterable of module names that are replaced with ``None``
+   in the module cache during the import to ensure that attempts to import
+   them raise :exc:`ImportError`.
+
+   The named module and any modules named in the *fresh* and *blocked*
+   parameters are saved before starting the import and then reinserted into
+   ``sys.modules`` when the fresh import is complete.
+
+   Module and package deprecation messages are suppressed during this import
+   if *deprecated* is ``True``.
+
+   This function will raise :exc:`ImportError` if the named module cannot be
+   imported.
+
+   Example use::
+
+      # Get copies of the warnings module for testing without affecting the
+      # version being used by the rest of the test suite. One copy uses the
+      # C implementation, the other is forced to use the pure Python fallback
+      # implementation
+      py_warnings = import_fresh_module('warnings', blocked=['_warnings'])
+      c_warnings = import_fresh_module('warnings', fresh=['_warnings'])
+
+   .. versionadded:: 3.1
+
+
+.. function:: import_module(name, deprecated=False, *, required_on())
+
+   This function imports and returns the named module. Unlike a normal
+   import, this function raises :exc:`unittest.SkipTest` if the module
+   cannot be imported.
+
+   Module and package deprecation messages are suppressed during this import
+   if *deprecated* is ``True``.  If a module is required on a platform but
+   optional for others, set *required_on* to an iterable of platform prefixes
+   which will be compared against :data:`sys.platform`.
+
+   .. versionadded:: 3.1
+
+
+.. function:: modules_setup()
+
+   Return a copy of :data:`sys.modules`.
+
+
+.. function:: modules_cleanup(oldmodules)
+
+   Remove modules except for *oldmodules* and ``encodings`` in order to
+   preserve internal cache.
+
+
+.. function:: unload(name)
+
+   Delete *name* from ``sys.modules``.
+
+
+.. function:: make_legacy_pyc(source)
+
+   Move a :pep:`3147`/:pep:`488` pyc file to its legacy pyc location and return the file
+   system path to the legacy pyc file.  The *source* value is the file system
+   path to the source file.  It does not need to exist, however the PEP
+   3147/488 pyc file must exist.
+
+
+.. class:: CleanImport(*module_names)
+
+   A context manager to force import to return a new module reference.  This
+   is useful for testing module-level behaviors, such as the emission of a
+   DeprecationWarning on import.  Example usage::
+
+      with CleanImport('foo'):
+          importlib.import_module('foo')  # New reference.
+
+
+.. class:: DirsOnSysPath(*paths)
+
+   A context manager to temporarily add directories to sys.path.
+
+   This makes a copy of :data:`sys.path`, appends any directories given
+   as positional arguments, then reverts :data:`sys.path` to the copied
+   settings when the context ends.
+
+   Note that *all* :data:`sys.path` modifications in the body of the
+   context manager, including replacement of the object,
+   will be reverted at the end of the block.
+
+
+:mod:`test.support.warnings_helper` --- Utilities for warnings tests
+====================================================================
+
+.. module:: test.support.warnings_helper
+   :synopsis: Support for warnings tests.
+
+The :mod:`test.support.warnings_helper` module provides support for warnings tests.
+
+.. versionadded:: 3.10
+
+
+.. function:: check_no_resource_warning(testcase)
+
+   Context manager to check that no :exc:`ResourceWarning` was raised.  You
+   must remove the object which may emit :exc:`ResourceWarning` before the
+   end of the context manager.
+
+
+.. function:: check_syntax_warning(testcase, statement, errtext='', *, lineno=1, offset=None)
+
+   Test for syntax warning in *statement* by attempting to compile *statement*.
+   Test also that the :exc:`SyntaxWarning` is emitted only once, and that it
+   will be converted to a :exc:`SyntaxError` when turned into error.
+   *testcase* is the :mod:`unittest` instance for the test.  *errtext* is the
+   regular expression which should match the string representation of the
+   emitted :exc:`SyntaxWarning` and raised :exc:`SyntaxError`.  If *lineno*
+   is not ``None``, compares to the line of the warning and exception.
+   If *offset* is not ``None``, compares to the offset of the exception.
+
+   .. versionadded:: 3.8
+
+
+.. function:: check_warnings(*filters, quiet=True)
+
+   A convenience wrapper for :func:`warnings.catch_warnings()` that makes it
+   easier to test that a warning was correctly raised.  It is approximately
+   equivalent to calling ``warnings.catch_warnings(record=True)`` with
+   :meth:`warnings.simplefilter` set to ``always`` and with the option to
+   automatically validate the results that are recorded.
+
+   ``check_warnings`` accepts 2-tuples of the form ``("message regexp",
+   WarningCategory)`` as positional arguments. If one or more *filters* are
+   provided, or if the optional keyword argument *quiet* is ``False``,
+   it checks to make sure the warnings are as expected:  each specified filter
+   must match at least one of the warnings raised by the enclosed code or the
+   test fails, and if any warnings are raised that do not match any of the
+   specified filters the test fails.  To disable the first of these checks,
+   set *quiet* to ``True``.
+
+   If no arguments are specified, it defaults to::
+
+      check_warnings(("", Warning), quiet=True)
+
+   In this case all warnings are caught and no errors are raised.
+
+   On entry to the context manager, a :class:`WarningRecorder` instance is
+   returned. The underlying warnings list from
+   :func:`~warnings.catch_warnings` is available via the recorder object's
+   :attr:`warnings` attribute.  As a convenience, the attributes of the object
+   representing the most recent warning can also be accessed directly through
+   the recorder object (see example below).  If no warning has been raised,
+   then any of the attributes that would otherwise be expected on an object
+   representing a warning will return ``None``.
+
+   The recorder object also has a :meth:`reset` method, which clears the
+   warnings list.
+
+   The context manager is designed to be used like this::
+
+      with check_warnings(("assertion is always true", SyntaxWarning),
+                          ("", UserWarning)):
+          exec('assert(False, "Hey!")')
+          warnings.warn(UserWarning("Hide me!"))
+
+   In this case if either warning was not raised, or some other warning was
+   raised, :func:`check_warnings` would raise an error.
+
+   When a test needs to look more deeply into the warnings, rather than
+   just checking whether or not they occurred, code like this can be used::
+
+      with check_warnings(quiet=True) as w:
+          warnings.warn("foo")
+          assert str(w.args[0]) == "foo"
+          warnings.warn("bar")
+          assert str(w.args[0]) == "bar"
+          assert str(w.warnings[0].args[0]) == "foo"
+          assert str(w.warnings[1].args[0]) == "bar"
+          w.reset()
+          assert len(w.warnings) == 0
+
+
+   Here all warnings will be caught, and the test code tests the captured
+   warnings directly.
+
+   .. versionchanged:: 3.2
+      New optional arguments *filters* and *quiet*.
+
+
+.. class:: WarningsRecorder()
+
+   Class used to record warnings for unit tests. See documentation of
+   :func:`check_warnings` above for more details.
diff --git a/Doc/library/textwrap.rst b/Doc/library/textwrap.rst
index 1683710..7780e24 100644
--- a/Doc/library/textwrap.rst
+++ b/Doc/library/textwrap.rst
@@ -17,20 +17,29 @@
 functions should be good enough; otherwise, you should use an instance of
 :class:`TextWrapper` for efficiency.
 
-.. function:: wrap(text, width=70, **kwargs)
+.. function:: wrap(text, width=70, *, initial_indent="", \
+                   subsequent_indent="", expand_tabs=True, \
+                   replace_whitespace=True, fix_sentence_endings=False, \
+                   break_long_words=True, drop_whitespace=True, \
+                   break_on_hyphens=True, tabsize=8, max_lines=None)
 
    Wraps the single paragraph in *text* (a string) so every line is at most
    *width* characters long.  Returns a list of output lines, without final
    newlines.
 
    Optional keyword arguments correspond to the instance attributes of
-   :class:`TextWrapper`, documented below.  *width* defaults to ``70``.
+   :class:`TextWrapper`, documented below.
 
    See the :meth:`TextWrapper.wrap` method for additional details on how
    :func:`wrap` behaves.
 
 
-.. function:: fill(text, width=70, **kwargs)
+.. function:: fill(text, width=70, *, initial_indent="", \
+                   subsequent_indent="", expand_tabs=True, \
+                   replace_whitespace=True, fix_sentence_endings=False, \
+                   break_long_words=True, drop_whitespace=True, \
+                   break_on_hyphens=True, tabsize=8, \
+                   max_lines=None)
 
    Wraps the single paragraph in *text*, and returns a single string containing the
    wrapped paragraph.  :func:`fill` is shorthand for  ::
@@ -41,7 +50,9 @@
    :func:`wrap`.
 
 
-.. function:: shorten(text, width, **kwargs)
+.. function:: shorten(text, width, *, fix_sentence_endings=False, \
+                      break_long_words=True, break_on_hyphens=True, \
+                      placeholder=' [...]')
 
    Collapse and truncate the given *text* to fit in the given *width*.
 
@@ -65,7 +76,6 @@
 
    .. versionadded:: 3.4
 
-
 .. function:: dedent(text)
 
    Remove any common leading whitespace from every line in *text*.
diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst
index f4de3c4..14434fb 100644
--- a/Doc/library/threading.rst
+++ b/Doc/library/threading.rst
@@ -16,9 +16,22 @@
 
 .. note::
 
-   While they are not listed below, the ``camelCase`` names used for some
-   methods and functions in this module in the Python 2.x series are still
-   supported by this module.
+   In the Python 2.x series, this module contained ``camelCase`` names
+   for some methods and functions. These are deprecated as of Python 3.10,
+   but they are still supported for compatibility with Python 2.5 and lower.
+
+
+.. impl-detail::
+
+   In CPython, due to the :term:`Global Interpreter Lock
+   <global interpreter lock>`, only one thread
+   can execute Python code at once (even though certain performance-oriented
+   libraries might overcome this limitation).
+   If you want your application to make better use of the computational
+   resources of multi-core machines, you are advised to use
+   :mod:`multiprocessing` or :class:`concurrent.futures.ProcessPoolExecutor`.
+   However, threading is still an appropriate model if you want to run
+   multiple I/O-bound tasks simultaneously.
 
 
 This module defines the following functions:
@@ -29,6 +42,8 @@
    Return the number of :class:`Thread` objects currently alive.  The returned
    count is equal to the length of the list returned by :func:`.enumerate`.
 
+   The function ``activeCount`` is a deprecated alias for this function.
+
 
 .. function:: current_thread()
 
@@ -37,6 +52,8 @@
    :mod:`threading` module, a dummy thread object with limited functionality is
    returned.
 
+   The function ``currentThread`` is a deprecated alias for this function.
+
 
 .. function:: excepthook(args, /)
 
@@ -71,6 +88,13 @@
 
    .. versionadded:: 3.8
 
+.. data:: __excepthook__
+
+   Holds the original value of :func:`threading.excepthook`. It is saved so that the
+   original value can be restored in case they happen to get replaced with
+   broken or alternative objects.
+
+   .. versionadded:: 3.10
 
 .. function:: get_ident()
 
@@ -97,10 +121,11 @@
 
 .. function:: enumerate()
 
-   Return a list of all :class:`Thread` objects currently alive.  The list
-   includes daemonic threads, dummy thread objects created by
-   :func:`current_thread`, and the main thread.  It excludes terminated threads
-   and threads that have not yet been started.
+   Return a list of all :class:`Thread` objects currently active.  The list
+   includes daemonic threads and dummy thread objects created by
+   :func:`current_thread`.  It excludes terminated threads and threads
+   that have not yet been started.  However, the main thread is always part
+   of the result, even when terminated.
 
 
 .. function:: main_thread()
@@ -121,6 +146,17 @@
    :meth:`~Thread.run` method is called.
 
 
+.. function:: gettrace()
+
+   .. index::
+      single: trace function
+      single: debugger
+
+   Get the trace function as set by :func:`settrace`.
+
+   .. versionadded:: 3.10
+
+
 .. function:: setprofile(func)
 
    .. index:: single: profile function
@@ -130,6 +166,15 @@
    :meth:`~Thread.run` method is called.
 
 
+.. function:: getprofile()
+
+   .. index:: single: profile function
+
+   Get the profiler function as set by :func:`setprofile`.
+
+   .. versionadded:: 3.10
+
+
 .. function:: stack_size([size])
 
    Return the thread stack size used when creating new threads.  The optional
@@ -264,8 +309,10 @@
    *target* is the callable object to be invoked by the :meth:`run` method.
    Defaults to ``None``, meaning nothing is called.
 
-   *name* is the thread name.  By default, a unique name is constructed of the
-   form "Thread-*N*" where *N* is a small decimal number.
+   *name* is the thread name. By default, a unique name is constructed
+   of the form "Thread-*N*" where *N* is a small decimal number,
+   or "Thread-*N* (target)" where "target" is ``target.__name__`` if the
+   *target* argument is specified.
 
    *args* is the argument tuple for the target invocation.  Defaults to ``()``.
 
@@ -280,6 +327,9 @@
    base class constructor (``Thread.__init__()``) before doing anything else to
    the thread.
 
+   .. versionchanged:: 3.10
+      Use the *target* name if *name* argument is omitted.
+
    .. versionchanged:: 3.3
       Added the *daemon* argument.
 
@@ -336,9 +386,11 @@
    .. method:: getName()
                setName()
 
-      Old getter/setter API for :attr:`~Thread.name`; use it directly as a
+      Deprecated getter/setter API for :attr:`~Thread.name`; use it directly as a
       property instead.
 
+      .. deprecated:: 3.10
+
    .. attribute:: ident
 
       The 'thread identifier' of this thread or ``None`` if the thread has not
@@ -349,13 +401,12 @@
 
    .. attribute:: native_id
 
-      The native integral thread ID of this thread.
+      The Thread ID (``TID``) of this thread, as assigned by the OS (kernel).
       This is a non-negative integer, or ``None`` if the thread has not
       been started. See the :func:`get_native_id` function.
-      This represents the Thread ID (``TID``) as assigned to the
-      thread by the OS (kernel).  Its value may be used to uniquely identify
-      this particular thread system-wide (until the thread terminates,
-      after which the value may be recycled by the OS).
+      This value may be used to uniquely identify this particular thread
+      system-wide (until the thread terminates, after which the value
+      may be recycled by the OS).
 
       .. note::
 
@@ -377,8 +428,8 @@
 
    .. attribute:: daemon
 
-      A boolean value indicating whether this thread is a daemon thread (True)
-      or not (False).  This must be set before :meth:`~Thread.start` is called,
+      A boolean value indicating whether this thread is a daemon thread (``True``)
+      or not (``False``).  This must be set before :meth:`~Thread.start` is called,
       otherwise :exc:`RuntimeError` is raised.  Its initial value is inherited
       from the creating thread; the main thread is not a daemon thread and
       therefore all threads created in the main thread default to
@@ -389,21 +440,10 @@
    .. method:: isDaemon()
                setDaemon()
 
-      Old getter/setter API for :attr:`~Thread.daemon`; use it directly as a
+      Deprecated getter/setter API for :attr:`~Thread.daemon`; use it directly as a
       property instead.
 
-
-.. impl-detail::
-
-   In CPython, due to the :term:`Global Interpreter Lock
-   <global interpreter lock>`, only one thread
-   can execute Python code at once (even though certain performance-oriented
-   libraries might overcome this limitation).
-   If you want your application to make better use of the computational
-   resources of multi-core machines, you are advised to use
-   :mod:`multiprocessing` or :class:`concurrent.futures.ProcessPoolExecutor`.
-   However, threading is still an appropriate model if you want to run
-   multiple I/O-bound tasks simultaneously.
+      .. deprecated:: 3.10
 
 
 .. _lock-objects:
@@ -463,7 +503,7 @@
       value, block for at most the number of seconds specified by *timeout*
       and as long as the lock cannot be acquired.  A *timeout* argument of ``-1``
       specifies an unbounded wait.  It is forbidden to specify a *timeout*
-      when *blocking* is false.
+      when *blocking* is ``False``.
 
       The return value is ``True`` if the lock is acquired successfully,
       ``False`` if not (for example if the *timeout* expired).
@@ -491,7 +531,7 @@
 
    .. method:: locked()
 
-      Return true if the lock is acquired.
+      Return ``True`` if the lock is acquired.
 
 
 
@@ -540,17 +580,17 @@
       is unlocked, only one at a time will be able to grab ownership of the lock.
       There is no return value in this case.
 
-      When invoked with the *blocking* argument set to true, do the same thing as when
+      When invoked with the *blocking* argument set to ``True``, do the same thing as when
       called without arguments, and return ``True``.
 
-      When invoked with the *blocking* argument set to false, do not block.  If a call
+      When invoked with the *blocking* argument set to ``False``, do not block.  If a call
       without an argument would block, return ``False`` immediately; otherwise, do the
       same thing as when called without arguments, and return ``True``.
 
       When invoked with the floating-point *timeout* argument set to a positive
       value, block for at most the number of seconds specified by *timeout*
       and as long as the lock cannot be acquired.  Return ``True`` if the lock has
-      been acquired, false if the timeout has elapsed.
+      been acquired, ``False`` if the timeout has elapsed.
 
       .. versionchanged:: 3.2
          The *timeout* parameter is new.
@@ -740,6 +780,8 @@
       calling thread has not acquired the lock when this method is called, a
       :exc:`RuntimeError` is raised.
 
+      The method ``notifyAll`` is a deprecated alias for this method.
+
 
 .. _semaphore-objects:
 
@@ -789,7 +831,7 @@
         thread will be awoken by each call to :meth:`~Semaphore.release`.  The
         order in which threads are awoken should not be relied on.
 
-      When invoked with *blocking* set to false, do not block.  If a call
+      When invoked with *blocking* set to ``False``, do not block.  If a call
       without an argument would block, return ``False`` immediately; otherwise, do
       the same thing as when called without arguments, and return ``True``.
 
@@ -877,6 +919,8 @@
 
       Return ``True`` if and only if the internal flag is true.
 
+      The method ``isSet`` is a deprecated alias for this method.
+
    .. method:: set()
 
       Set the internal flag to true. All threads waiting for it to become true
diff --git a/Doc/library/time.rst b/Doc/library/time.rst
index cff6320..ed1f71d 100644
--- a/Doc/library/time.rst
+++ b/Doc/library/time.rst
@@ -166,6 +166,9 @@
    Return the time of the specified clock *clk_id*.  Refer to
    :ref:`time-clock-id-constants` for a list of accepted values for *clk_id*.
 
+   Use :func:`clock_gettime_ns` to avoid the precision loss caused by the
+   :class:`float` type.
+
    .. availability:: Unix.
 
    .. versionadded:: 3.3
@@ -185,6 +188,9 @@
    Set the time of the specified clock *clk_id*.  Currently,
    :data:`CLOCK_REALTIME` is the only accepted value for *clk_id*.
 
+   Use :func:`clock_settime_ns` to avoid the precision loss caused by the
+   :class:`float` type.
+
    .. availability:: Unix.
 
    .. versionadded:: 3.3
@@ -253,6 +259,12 @@
    :const:`None`, the current time as returned by :func:`.time` is used.  The dst
    flag is set to ``1`` when DST applies to the given time.
 
+   :func:`localtime` may raise :exc:`OverflowError`, if the timestamp is
+   outside the range of values supported by the platform C :c:func:`localtime`
+   or :c:func:`gmtime` functions, and :exc:`OSError` on :c:func:`localtime` or
+   :c:func:`gmtime` failure. It's common for this to be restricted to years
+   between 1970 and 2038.
+
 
 .. function:: mktime(t)
 
@@ -271,12 +283,19 @@
    Return the value (in fractional seconds) of a monotonic clock, i.e. a clock
    that cannot go backwards.  The clock is not affected by system clock updates.
    The reference point of the returned value is undefined, so that only the
-   difference between the results of consecutive calls is valid.
+   difference between the results of two calls is valid.
+
+   Use :func:`monotonic_ns` to avoid the precision loss caused by the
+   :class:`float` type.
 
    .. versionadded:: 3.3
+
    .. versionchanged:: 3.5
       The function is now always available and always system-wide.
 
+   .. versionchanged:: 3.10
+      On macOS, the function is now system-wide.
+
 
 .. function:: monotonic_ns() -> int
 
@@ -293,10 +312,16 @@
    clock with the highest available resolution to measure a short duration.  It
    does include time elapsed during sleep and is system-wide.  The reference
    point of the returned value is undefined, so that only the difference between
-   the results of consecutive calls is valid.
+   the results of two calls is valid.
+
+   Use :func:`perf_counter_ns` to avoid the precision loss caused by the
+   :class:`float` type.
 
    .. versionadded:: 3.3
 
+   .. versionchanged:: 3.10
+      On Windows, the function is now system-wide.
+
 .. function:: perf_counter_ns() -> int
 
    Similar to :func:`perf_counter`, but return time as nanoseconds.
@@ -315,7 +340,10 @@
    CPU time of the current process.  It does not include time elapsed during
    sleep.  It is process-wide by definition.  The reference point of the
    returned value is undefined, so that only the difference between the results
-   of consecutive calls is valid.
+   of two calls is valid.
+
+   Use :func:`process_time_ns` to avoid the precision loss caused by the
+   :class:`float` type.
 
    .. versionadded:: 3.3
 
@@ -434,10 +462,10 @@
    |           | negative time difference from UTC/GMT of the   |       |
    |           | form +HHMM or -HHMM, where H represents decimal|       |
    |           | hour digits and M represents decimal minute    |       |
-   |           | digits [-23:59, +23:59].                       |       |
+   |           | digits [-23:59, +23:59]. [1]_                  |       |
    +-----------+------------------------------------------------+-------+
    | ``%Z``    | Time zone name (no characters if no time zone  |       |
-   |           | exists).                                       |       |
+   |           | exists). Deprecated. [1]_                      |       |
    +-----------+------------------------------------------------+-------+
    | ``%%``    | A literal ``'%'`` character.                   |       |
    +-----------+------------------------------------------------+-------+
@@ -458,7 +486,7 @@
       calculations when the day of the week and the year are specified.
 
    Here is an example, a format for dates compatible with that specified  in the
-   :rfc:`2822` Internet email standard.  [#]_ ::
+   :rfc:`2822` Internet email standard.  [1]_ ::
 
       >>> from time import gmtime, strftime
       >>> strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime())
@@ -581,6 +609,17 @@
    :class:`struct_time` object is returned, from which the components
    of the calendar date may be accessed as attributes.
 
+   Use :func:`time_ns` to avoid the precision loss caused by the :class:`float`
+   type.
+
+
+.. function:: time_ns() -> int
+
+   Similar to :func:`~time.time` but returns time as an integer number of nanoseconds
+   since the epoch_.
+
+   .. versionadded:: 3.7
+
 
 .. function:: thread_time() -> float
 
@@ -593,7 +632,10 @@
    CPU time of the current thread.  It does not include time elapsed during
    sleep.  It is thread-specific by definition.  The reference point of the
    returned value is undefined, so that only the difference between the results
-   of consecutive calls in the same thread is valid.
+   of two calls in the same thread is valid.
+
+   Use :func:`thread_time_ns` to avoid the precision loss caused by the
+   :class:`float` type.
 
    .. availability::  Windows, Linux, Unix systems supporting
       ``CLOCK_THREAD_CPUTIME_ID``.
@@ -608,13 +650,6 @@
    .. versionadded:: 3.7
 
 
-.. function:: time_ns() -> int
-
-   Similar to :func:`~time.time` but returns time as an integer number of nanoseconds
-   since the epoch_.
-
-   .. versionadded:: 3.7
-
 .. function:: tzset()
 
    Reset the time conversion rules used by the library routines. The environment
@@ -879,10 +914,9 @@
 
 .. rubric:: Footnotes
 
-.. [#] The use of ``%Z`` is now deprecated, but the ``%z`` escape that expands to the
-   preferred  hour/minute offset is not supported by all ANSI C libraries. Also, a
+.. [1] The use of ``%Z`` is now deprecated, but the ``%z`` escape that expands to the
+   preferred hour/minute offset is not supported by all ANSI C libraries. Also, a
    strict reading of the original 1982 :rfc:`822` standard calls for a two-digit
-   year (%y rather than %Y), but practice moved to 4-digit years long before the
+   year (``%y`` rather than ``%Y``), but practice moved to 4-digit years long before the
    year 2000.  After that, :rfc:`822` became obsolete and the 4-digit year has
    been first recommended by :rfc:`1123` and then mandated by :rfc:`2822`.
-
diff --git a/Doc/library/timeit.rst b/Doc/library/timeit.rst
index 668fcb8..ca21fe6 100644
--- a/Doc/library/timeit.rst
+++ b/Doc/library/timeit.rst
@@ -15,8 +15,8 @@
 This module provides a simple way to time small bits of Python code. It has both
 a :ref:`timeit-command-line-interface` as well as a :ref:`callable <python-interface>`
 one.  It avoids a number of common traps for measuring execution times.
-See also Tim Peters' introduction to the "Algorithms" chapter in the *Python
-Cookbook*, published by O'Reilly.
+See also Tim Peters' introduction to the "Algorithms" chapter in the second
+edition of *Python Cookbook*, published by O'Reilly.
 
 
 Basic Examples
@@ -282,6 +282,13 @@
    $ python -m timeit -s 'text = "sample string"; char = "g"'  'text.find(char)'
    1000000 loops, best of 5: 0.342 usec per loop
 
+In the output, there are three fields. The loop count, which tells you how many
+times the statement body was run per timing loop repetition. The repetition
+count ('best of 5') which tells you how many times the timing loop was
+repeated, and finally the time the statement body took on average within the
+best repetition of the timing loop. That is, the time the fastest repetition
+took divided by the loop count.
+
 ::
 
    >>> import timeit
diff --git a/Doc/library/tk.rst b/Doc/library/tk.rst
index c6c73f0..0cb8fda 100644
--- a/Doc/library/tk.rst
+++ b/Doc/library/tk.rst
@@ -19,16 +19,15 @@
 use :mod:`tkinter`, you don't need to write Tcl code, but you will need to
 consult the Tk documentation, and occasionally the Tcl documentation.
 :mod:`tkinter` is a set of wrappers that implement the Tk widgets as Python
-classes.  In addition, the internal module :mod:`_tkinter` provides a threadsafe
-mechanism which allows Python and Tcl to interact.
+classes.
 
 :mod:`tkinter`'s chief virtues are that it is fast, and that it usually comes
 bundled with Python. Although its standard documentation is weak, good
 material is available, which includes: references, tutorials, a book and
 others. :mod:`tkinter` is also famous for having an outdated look and feel,
 which has been vastly improved in Tk 8.5. Nevertheless, there are many other
-GUI libraries that you could be interested in. For more information about
-alternatives, see the :ref:`other-gui-packages` section.
+GUI libraries that you could be interested in. The Python wiki lists several
+alternative `GUI frameworks and tools <https://wiki.python.org/moin/GuiProgramming>`_.
 
 .. toctree::
 
@@ -42,7 +41,6 @@
    tkinter.ttk.rst
    tkinter.tix.rst
    idle.rst
-   othergui.rst
 
 .. Other sections I have in mind are
    Tkinter internals
diff --git a/Doc/library/tk_msg.png b/Doc/library/tk_msg.png
index c122d8f..6495e63 100644
--- a/Doc/library/tk_msg.png
+++ b/Doc/library/tk_msg.png
Binary files differ
diff --git a/Doc/library/tkinter.font.rst b/Doc/library/tkinter.font.rst
index b0f4505..c7c2b7b 100644
--- a/Doc/library/tkinter.font.rst
+++ b/Doc/library/tkinter.font.rst
@@ -91,6 +91,9 @@
 
    Return the names of defined fonts.
 
-.. function:: nametofont(name)
+.. function:: nametofont(name, root=None)
 
-   Return a :class:`Font` representation of a tk named font.
\ No newline at end of file
+   Return a :class:`Font` representation of a tk named font.
+
+   .. versionchanged:: 3.10
+      The *root* parameter was added.
diff --git a/Doc/library/tkinter.rst b/Doc/library/tkinter.rst
index 7739f2f..65395d8 100644
--- a/Doc/library/tkinter.rst
+++ b/Doc/library/tkinter.rst
@@ -11,80 +11,117 @@
 --------------
 
 The :mod:`tkinter` package ("Tk interface") is the standard Python interface to
-the Tk GUI toolkit.  Both Tk and :mod:`tkinter` are available on most Unix
-platforms, as well as on Windows systems.  (Tk itself is not part of Python; it
-is maintained at ActiveState.)
+the Tcl/Tk GUI toolkit.  Both Tk and :mod:`tkinter` are available on most Unix
+platforms, including macOS, as well as on Windows systems.
 
 Running ``python -m tkinter`` from the command line should open a window
 demonstrating a simple Tk interface, letting you know that :mod:`tkinter` is
 properly installed on your system, and also showing what version of Tcl/Tk is
 installed, so you can read the Tcl/Tk documentation specific to that version.
 
+Tkinter supports a range of Tcl/Tk versions, built either with or
+without thread support. The official Python binary release bundles Tcl/Tk 8.6
+threaded. See the source code for the :mod:`_tkinter` module
+for more information about supported versions.
+
+Tkinter is not a thin wrapper, but adds a fair amount of its own logic to
+make the experience more pythonic. This documentation will concentrate on these
+additions and changes, and refer to the official Tcl/Tk documentation for
+details that are unchanged.
+
+.. note::
+
+   Tcl/Tk 8.5 (2007) introduced a modern set of themed user interface components
+   along with a new API to use them. Both old and new APIs are still available.
+   Most documentation you will find online still uses the old API and
+   can be woefully outdated.
+
 .. seealso::
 
-   Tkinter documentation:
+   * `TkDocs <http://tkdocs.com/>`_
+      Extensive tutorial on creating user interfaces with Tkinter.  Explains key concepts,
+      and illustrates recommended approaches using the modern API.
 
-   `Python Tkinter Resources <https://wiki.python.org/moin/TkInter>`_
-      The Python Tkinter Topic Guide provides a great deal of information on using Tk
-      from Python and links to other sources of information on Tk.
+   * `Tkinter 8.5 reference: a GUI for Python <https://www.tkdocs.com/shipman/>`_
+      Reference documentation for Tkinter 8.5 detailing available classes, methods, and options.
 
-   `TKDocs <http://www.tkdocs.com/>`_
-      Extensive tutorial plus friendlier widget pages for some of the widgets.
+   Tcl/Tk Resources:
 
-   `Tkinter 8.5 reference: a GUI for Python <https://www.tkdocs.com/shipman/>`_
-      On-line reference material.
+   * `Tk commands <https://www.tcl.tk/man/tcl8.6/TkCmd/contents.htm>`_
+      Comprehensive reference to each of the underlying Tcl/Tk commands used by Tkinter.
 
-   `Tkinter docs from effbot <http://effbot.org/tkinterbook/>`_
-      Online reference for tkinter supported by effbot.org.
+   * `Tcl/Tk Home Page <https://www.tcl.tk>`_
+      Additional documentation, and links to Tcl/Tk core development.
 
-   `Programming Python <http://learning-python.com/about-pp4e.html>`_
-      Book by Mark Lutz, has excellent coverage of Tkinter.
+   Books:
 
-   `Modern Tkinter for Busy Python Developers <https://www.amazon.com/Modern-Tkinter-Python-Developers-ebook/dp/B0071QDNLO/>`_
-      Book by Mark Roseman about building attractive and modern graphical user interfaces with Python and Tkinter.
+   * `Modern Tkinter for Busy Python Developers <https://tkdocs.com/book.html>`_
+      By Mark Roseman. (ISBN 978-1999149567)
 
-   `Python and Tkinter Programming <https://www.manning.com/books/python-and-tkinter-programming>`_
-      Book by John Grayson (ISBN 1-884777-81-3).
+   * `Python and Tkinter Programming <https://www.packtpub.com/product/python-gui-programming-with-tkinter/9781788835886>`_
+      By Alan Moore. (ISBN 978-1788835886)
 
-   Tcl/Tk documentation:
+   * `Programming Python <http://learning-python.com/about-pp4e.html>`_
+      By Mark Lutz; has excellent coverage of Tkinter. (ISBN 978-0596158101)
 
-   `Tk commands <https://www.tcl.tk/man/tcl8.6/TkCmd/contents.htm>`_
-      Most commands are available as :mod:`tkinter` or :mod:`tkinter.ttk` classes.
-      Change '8.6' to match the version of your Tcl/Tk installation.
+   * `Tcl and the Tk Toolkit (2nd edition)  <https://www.amazon.com/exec/obidos/ASIN/032133633X>`_
+      By John Ousterhout, inventor of Tcl/Tk, and Ken Jones; does not cover Tkinter. (ISBN 978-0321336330)
 
-   `Tcl/Tk recent man pages <https://www.tcl.tk/doc/>`_
-      Recent Tcl/Tk manuals on www.tcl.tk.
 
-   `ActiveState Tcl Home Page <https://tcl.tk>`_
-      The Tk/Tcl development is largely taking place at ActiveState.
+Architecture
+------------
 
-   `Tcl and the Tk Toolkit <https://www.amazon.com/exec/obidos/ASIN/020163337X>`_
-      Book by John Ousterhout, the inventor of Tcl.
+Tcl/Tk is not a single library but rather consists of a few distinct
+modules, each with separate functionality and its own official
+documentation. Python's binary releases also ship an add-on module
+together with it.
 
-   `Practical Programming in Tcl and Tk <http://www.beedub.com/book/>`_
-      Brent Welch's encyclopedic book.
+Tcl
+   Tcl is a dynamic interpreted programming language, just like Python. Though
+   it can be used on its own as a general-purpose programming language, it is
+   most commonly embedded into C applications as a scripting engine or an
+   interface to the Tk toolkit. The Tcl library has a C interface to
+   create and manage one or more instances of a Tcl interpreter, run Tcl
+   commands and scripts in those instances, and add custom commands
+   implemented in either Tcl or C. Each interpreter has an event queue,
+   and there are facilities to send events to it and process them.
+   Unlike Python, Tcl's execution model is designed around cooperative
+   multitasking, and Tkinter bridges this difference
+   (see `Threading model`_ for details).
+
+Tk
+   Tk is a `Tcl package <http://wiki.tcl.tk/37432>`_ implemented in C
+   that adds custom commands to create and manipulate GUI widgets. Each
+   :class:`Tk` object embeds its own Tcl interpreter instance with Tk loaded into
+   it. Tk's widgets are very customizable, though at the cost of a dated appearance.
+   Tk uses Tcl's event queue to generate and process GUI events.
+
+Ttk
+   Themed Tk (Ttk) is a newer family of Tk widgets that provide a much better
+   appearance on different platforms than many of the classic Tk widgets.
+   Ttk is distributed as part of Tk, starting with Tk version 8.5. Python
+   bindings are provided in a separate module, :mod:`tkinter.ttk`.
+
+Internally, Tk and Ttk use facilities of the underlying operating system,
+i.e., Xlib on Unix/X11, Cocoa on macOS, GDI on Windows.
+
+When your Python application uses a class in Tkinter, e.g., to create a widget,
+the :mod:`tkinter` module first assembles a Tcl/Tk command string. It passes that
+Tcl command string to an internal :mod:`_tkinter` binary module, which then
+calls the Tcl interpreter to evaluate it. The Tcl interpreter will then call into the
+Tk and/or Ttk packages, which will in turn make calls to Xlib, Cocoa, or GDI.
 
 
 Tkinter Modules
 ---------------
 
-Most of the time, :mod:`tkinter` is all you really need, but a number of
-additional modules are available as well.  The Tk interface is located in a
-binary module named :mod:`_tkinter`. This module contains the low-level
-interface to Tk, and should never be used directly by application programmers.
-It is usually a shared library (or DLL), but might in some cases be statically
-linked with the Python interpreter.
+Support for Tkinter is spread across several modules. Most applications will need the
+main :mod:`tkinter` module, as well as the :mod:`tkinter.ttk` module, which provides
+the modern themed widget set and API::
 
-In addition to the Tk interface module, :mod:`tkinter` includes a number of
-Python modules, :mod:`tkinter.constants` being one of the most important.
-Importing :mod:`tkinter` will automatically import :mod:`tkinter.constants`,
-so, usually, to use Tkinter all you need is a simple import statement::
-
-   import tkinter
-
-Or, more often::
 
    from tkinter import *
+   from tkinter import ttk
 
 
 .. class:: Tk(screenName=None, baseName=None, className='Tk', useTk=1)
@@ -107,7 +144,10 @@
    subsystem initialized) by calling its :meth:`loadtk` method.
 
 
-Other modules that provide Tk support include:
+The modules that provide Tk support include:
+
+:mod:`tkinter`
+   Main Tkinter module.
 
 :mod:`tkinter.colorchooser`
    Dialog to let the user choose a color.
@@ -130,9 +170,35 @@
 :mod:`tkinter.simpledialog`
    Basic dialogs and convenience functions.
 
+:mod:`tkinter.ttk`
+   Themed widget set introduced in Tk 8.5, providing modern alternatives
+   for many of the classic widgets in the main :mod:`tkinter` module.
+
+Additional modules:
+
+:mod:`_tkinter`
+   A binary module that contains the low-level interface to Tcl/Tk.
+   It is automatically imported by the main :mod:`tkinter` module,
+   and should never be used directly by application programmers.
+   It is usually a shared library (or DLL), but might in some cases be
+   statically linked with the Python interpreter.
+
+:mod:`idlelib`
+   Python's Integrated Development and Learning Environment (IDLE). Based
+   on :mod:`tkinter`.
+
+:mod:`tkinter.constants`
+   Symbolic constants that can be used in place of strings when passing
+   various parameters to Tkinter calls. Automatically imported by the
+   main :mod:`tkinter` module.
+
 :mod:`tkinter.dnd`
-   Drag-and-drop support for :mod:`tkinter`. This is experimental and should
-   become deprecated when it is replaced  with the Tk DND.
+   (experimental) Drag-and-drop support for :mod:`tkinter`. This will
+   become deprecated when it is replaced with the Tk DND.
+
+:mod:`tkinter.tix`
+   (deprecated) An older third-party Tcl/Tk package that adds several new
+   widgets. Better alternatives for most can be found in :mod:`tkinter.ttk`.
 
 :mod:`turtle`
    Turtle graphics in a Tk window.
@@ -141,243 +207,294 @@
 Tkinter Life Preserver
 ----------------------
 
-.. sectionauthor:: Matt Conway
-
-
 This section is not designed to be an exhaustive tutorial on either Tk or
-Tkinter.  Rather, it is intended as a stop gap, providing some introductory
-orientation on the system.
+Tkinter.  For that, refer to one of the external resources noted earlier.
+Instead, this section provides a very quick orientation to what a Tkinter
+application looks like, identifies foundational Tk concepts, and
+explains how the Tkinter wrapper is structured.
 
-Credits:
-
-* Tk was written by John Ousterhout while at Berkeley.
-
-* Tkinter was written by Steen Lumholt and Guido van Rossum.
-
-* This Life Preserver was written by Matt Conway at the University of Virginia.
-
-* The HTML rendering, and some liberal editing, was produced from a FrameMaker
-  version by Ken Manheimer.
-
-* Fredrik Lundh elaborated and revised the class interface descriptions, to get
-  them current with Tk 4.2.
-
-* Mike Clarkson converted the documentation to LaTeX, and compiled the  User
-  Interface chapter of the reference manual.
+The remainder of this section will help you to identify the classes,
+methods, and options you'll need in your Tkinter application, and where to
+find more detailed documentation on them, including in the official Tcl/Tk
+reference manual.
 
 
-How To Use This Section
-^^^^^^^^^^^^^^^^^^^^^^^
+A Hello World Program
+^^^^^^^^^^^^^^^^^^^^^
 
-This section is designed in two parts: the first half (roughly) covers
-background material, while the second half can be taken to the keyboard as a
-handy reference.
-
-When trying to answer questions of the form "how do I do blah", it is often best
-to find out how to do "blah" in straight Tk, and then convert this back into the
-corresponding :mod:`tkinter` call. Python programmers can often guess at the
-correct Python command by looking at the Tk documentation. This means that in
-order to use Tkinter, you will have to know a little bit about Tk. This document
-can't fulfill that role, so the best we can do is point you to the best
-documentation that exists. Here are some hints:
-
-* The authors strongly suggest getting a copy of the Tk man pages.
-  Specifically, the man pages in the ``manN`` directory are most useful.
-  The ``man3`` man pages describe the C interface to the Tk library and thus
-  are not especially helpful for script writers.
-
-* Addison-Wesley publishes a book called Tcl and the Tk Toolkit by John
-  Ousterhout (ISBN 0-201-63337-X) which is a good introduction to Tcl and Tk for
-  the novice.  The book is not exhaustive, and for many details it defers to the
-  man pages.
-
-* :file:`tkinter/__init__.py` is a last resort for most, but can be a good
-  place to go when nothing else makes sense.
-
-
-A Simple Hello World Program
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+We'll start by walking through a "Hello World" application in Tkinter. This
+isn't the smallest one we could write, but has enough to illustrate some
+key concepts you'll need to know.
 
 ::
 
-    import tkinter as tk
-
-    class Application(tk.Frame):
-        def __init__(self, master=None):
-            super().__init__(master)
-            self.master = master
-            self.pack()
-            self.create_widgets()
-
-        def create_widgets(self):
-            self.hi_there = tk.Button(self)
-            self.hi_there["text"] = "Hello World\n(click me)"
-            self.hi_there["command"] = self.say_hi
-            self.hi_there.pack(side="top")
-
-            self.quit = tk.Button(self, text="QUIT", fg="red",
-                                  command=self.master.destroy)
-            self.quit.pack(side="bottom")
-
-        def say_hi(self):
-            print("hi there, everyone!")
-
-    root = tk.Tk()
-    app = Application(master=root)
-    app.mainloop()
+    from tkinter import *
+    from tkinter import ttk
+    root = Tk()
+    frm = ttk.Frame(root, padding=10)
+    frm.grid()
+    ttk.Label(frm, text="Hello World!").grid(column=0, row=0)
+    ttk.Button(frm, text="Quit", command=root.destroy).grid(column=1, row=0)
+    root.mainloop()
 
 
-A (Very) Quick Look at Tcl/Tk
------------------------------
+After the imports, the next line creates an instance of the :class:`Tk` class,
+which initializes Tk and creates its associated Tcl interpreter. It also
+creates a toplevel window, known as the root window, which serves as the main
+window of the application.
 
-The class hierarchy looks complicated, but in actual practice, application
-programmers almost always refer to the classes at the very bottom of the
-hierarchy.
+The following line creates a frame widget, which in this case will contain
+a label and a button we'll create next. The frame is fit inside the root
+window.
 
-Notes:
+The next line creates a label widget holding a static text string. The
+:meth:`grid` method is used to specify the relative layout (position) of the
+label within its containing frame widget, similar to how tables in HTML work.
 
-* These classes are provided for the purposes of organizing certain functions
-  under one namespace. They aren't meant to be instantiated independently.
+A button widget is then created, and placed to the right of the label. When
+pressed, it will call the :meth:`destroy` method of the root window.
 
-* The :class:`Tk` class is meant to be instantiated only once in an application.
-  Application programmers need not instantiate one explicitly, the system creates
-  one whenever any of the other classes are instantiated.
-
-* The :class:`Widget` class is not meant to be instantiated, it is meant only
-  for subclassing to make "real" widgets (in C++, this is called an 'abstract
-  class').
-
-To make use of this reference material, there will be times when you will need
-to know how to read short passages of Tk and how to identify the various parts
-of a Tk command.   (See section :ref:`tkinter-basic-mapping` for the
-:mod:`tkinter` equivalents of what's below.)
-
-Tk scripts are Tcl programs.  Like all Tcl programs, Tk scripts are just lists
-of tokens separated by spaces.  A Tk widget is just its *class*, the *options*
-that help configure it, and the *actions* that make it do useful things.
-
-To make a widget in Tk, the command is always of the form::
-
-   classCommand newPathname options
-
-*classCommand*
-   denotes which kind of widget to make (a button, a label, a menu...)
-
-.. index:: single: . (dot); in Tkinter
-
-*newPathname*
-   is the new name for this widget.  All names in Tk must be unique.  To help
-   enforce this, widgets in Tk are named with *pathnames*, just like files in a
-   file system.  The top level widget, the *root*, is called ``.`` (period) and
-   children are delimited by more periods.  For example,
-   ``.myApp.controlPanel.okButton`` might be the name of a widget.
-
-*options*
-   configure the widget's appearance and in some cases, its behavior.  The options
-   come in the form of a list of flags and values. Flags are preceded by a '-',
-   like Unix shell command flags, and values are put in quotes if they are more
-   than one word.
-
-For example::
-
-   button   .fred   -fg red -text "hi there"
-      ^       ^     \______________________/
-      |       |                |
-    class    new            options
-   command  widget  (-opt val -opt val ...)
-
-Once created, the pathname to the widget becomes a new command.  This new
-*widget command* is the programmer's handle for getting the new widget to
-perform some *action*.  In C, you'd express this as someAction(fred,
-someOptions), in C++, you would express this as fred.someAction(someOptions),
-and in Tk, you say::
-
-   .fred someAction someOptions
-
-Note that the object name, ``.fred``, starts with a dot.
-
-As you'd expect, the legal values for *someAction* will depend on the widget's
-class: ``.fred disable`` works if fred is a button (fred gets greyed out), but
-does not work if fred is a label (disabling of labels is not supported in Tk).
-
-The legal values of *someOptions* is action dependent.  Some actions, like
-``disable``, require no arguments, others, like a text-entry box's ``delete``
-command, would need arguments to specify what range of text to delete.
+Finally, the :meth:`mainloop` method puts everything on the display, and
+responds to user input until the program terminates.
 
 
-.. _tkinter-basic-mapping:
 
-Mapping Basic Tk into Tkinter
------------------------------
+Important Tk Concepts
+^^^^^^^^^^^^^^^^^^^^^
 
-Class commands in Tk correspond to class constructors in Tkinter. ::
+Even this simple program illustrates the following key Tk concepts:
 
-   button .fred                =====>  fred = Button()
+widgets
+  A Tkinter user interface is made up of individual *widgets*. Each widget is
+  represented as a Python object, instantiated from classes like
+  :class:`ttk.Frame`, :class:`ttk.Label`, and :class:`ttk.Button`.
 
-The master of an object is implicit in the new name given to it at creation
-time.  In Tkinter, masters are specified explicitly. ::
+widget hierarchy
+  Widgets are arranged in a *hierarchy*. The label and button were contained
+  within a frame, which in turn was contained within the root window. When
+  creating each *child* widget, its *parent* widget is passed as the first
+  argument to the widget constructor.
 
-   button .panel.fred          =====>  fred = Button(panel)
+configuration options
+  Widgets have *configuration options*, which modify their appearance and
+  behavior, such as the text to display in a label or button. Different
+  classes of widgets will have different sets of options.
 
-The configuration options in Tk are given in lists of hyphened tags followed by
-values.  In Tkinter, options are specified as keyword-arguments in the instance
-constructor, and keyword-args for configure calls or as instance indices, in
-dictionary style, for established instances.  See section
-:ref:`tkinter-setting-options` on setting options. ::
+geometry management
+  Widgets aren't automatically added to the user interface when they are
+  created. A *geometry manager* like ``grid`` controls where in the
+  user interface they are placed.
 
-   button .fred -fg red        =====>  fred = Button(panel, fg="red")
-   .fred configure -fg red     =====>  fred["fg"] = red
-                               OR ==>  fred.config(fg="red")
-
-In Tk, to perform an action on a widget, use the widget name as a command, and
-follow it with an action name, possibly with arguments (options).  In Tkinter,
-you call methods on the class instance to invoke actions on the widget.  The
-actions (methods) that a given widget can perform are listed in
-:file:`tkinter/__init__.py`. ::
-
-   .fred invoke                =====>  fred.invoke()
-
-To give a widget to the packer (geometry manager), you call pack with optional
-arguments.  In Tkinter, the Pack class holds all this functionality, and the
-various forms of the pack command are implemented as methods.  All widgets in
-:mod:`tkinter` are subclassed from the Packer, and so inherit all the packing
-methods. See the :mod:`tkinter.tix` module documentation for additional
-information on the Form geometry manager. ::
-
-   pack .fred -side left       =====>  fred.pack(side="left")
+event loop
+  Tkinter reacts to user input, changes from your program, and even refreshes
+  the display only when actively running an *event loop*. If your program
+  isn't running the event loop, your user interface won't update.
 
 
-How Tk and Tkinter are Related
-------------------------------
+Understanding How Tkinter Wraps Tcl/Tk
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-From the top down:
+When your application uses Tkinter's classes and methods, internally Tkinter
+is assembling strings representing Tcl/Tk commands, and executing those
+commands in the Tcl interpreter attached to your applicaton's :class:`Tk`
+instance.
 
-Your App Here (Python)
-   A Python application makes a :mod:`tkinter` call.
+Whether it's trying to navigate reference documentation, trying to find
+the right method or option, adapting some existing code, or debugging your
+Tkinter application, there are times that it will be useful to understand
+what those underlying Tcl/Tk commands look like.
 
-tkinter (Python Package)
-   This call (say, for example, creating a button widget), is implemented in
-   the :mod:`tkinter` package, which is written in Python.  This Python
-   function will parse the commands and the arguments and convert them into a
-   form that makes them look as if they had come from a Tk script instead of
-   a Python script.
+To illustrate, here is the Tcl/Tk equivalent of the main part of the Tkinter
+script above.
 
-_tkinter (C)
-   These commands and their arguments will be passed to a C function in the
-   :mod:`_tkinter` - note the underscore - extension module.
+::
 
-Tk Widgets (C and Tcl)
-   This C function is able to make calls into other C modules, including the C
-   functions that make up the Tk library.  Tk is implemented in C and some Tcl.
-   The Tcl part of the Tk widgets is used to bind certain default behaviors to
-   widgets, and is executed once at the point where the Python :mod:`tkinter`
-   package is imported. (The user never sees this stage).
+    ttk::frame .frm -padding 10
+    grid .frm
+    grid [ttk::label .frm.lbl -text "Hello World!"] -column 0 -row 0
+    grid [ttk::button .frm.btn -text "Quit" -command "destroy ."] -column 1 -row 0
 
-Tk (C)
-   The Tk part of the Tk Widgets implement the final mapping to ...
 
-Xlib (C)
-   the Xlib library to draw graphics on the screen.
+Tcl's syntax is similar to many shell languages, where the first word is the
+command to be executed, with arguments to that command following it, separated
+by spaces. Without getting into too many details, notice the following:
+
+* The commands used to create widgets (like ``ttk::frame``) correspond to
+  widget classes in Tkinter.
+
+* Tcl widget options (like ``-text``) correspond to keyword arguments in
+  Tkinter.
+
+* Widgets are referred to by a *pathname* in Tcl (like ``.frm.btn``),
+  whereas Tkinter doesn't use names but object references.
+
+* A widget's place in the widget hierarchy is encoded in its (hierarchical)
+  pathname, which uses a ``.`` (dot) as a path separator. The pathname for
+  the root window is just ``.`` (dot). In Tkinter, the hierarchy is defined
+  not by pathname but by specifying the parent widget when creating each
+  child widget.
+
+* Operations which are implemented as separate *commands* in Tcl (like
+  ``grid`` or ``destroy``) are represented as *methods* on Tkinter widget
+  objects. As you'll see shortly, at other times Tcl uses what appear to be
+  method calls on widget objects, which more closely mirror what would is
+  used in Tkinter.
+
+
+How do I...? What option does...?
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+If you're not sure how to do something in Tkinter, and you can't immediately
+find it in the tutorial or reference documentation you're using, there are a
+few strategies that can be helpful.
+
+First, remember that the details of how individual widgets work may vary
+across different versions of both Tkinter and Tcl/Tk. If you're searching
+documentation, make sure it corresponds to the Python and Tcl/Tk versions
+installed on your system.
+
+When searching for how to use an API, it helps to know the exact name of the
+class, option, or method that you're using. Introspection, either in an
+interactive Python shell or with :func:`print`, can help you identify what
+you need.
+
+To find out what configuration options are available on any widget, call its
+:meth:`configure` method, which returns a dictionary containing a variety of
+information about each object, including its default and current values. Use
+:meth:`keys` to get just the names of each option.
+
+::
+
+    btn = ttk.Button(frm, ...)
+    print(btn.configure().keys())
+
+As most widgets have many configuration options in common, it can be useful
+to find out which are specific to a particular widget class. Comparing the
+list of options to that of a simpler widget, like a frame, is one way to
+do that.
+
+::
+
+    print(set(btn.configure().keys()) - set(frm.configure().keys()))
+
+Similarly, you can find the available methods for a widget object using the
+standard :func:`dir` function. If you try it, you'll see there are over 200
+common widget methods, so again identifying those specific to a widget class
+is helpful.
+
+::
+
+    print(dir(btn))
+    print(set(dir(btn)) - set(dir(frm)))
+
+
+Navigating the Tcl/Tk Reference Manual
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+As noted, the official `Tk commands <https://www.tcl.tk/man/tcl8.6/TkCmd/contents.htm>`_
+reference manual (man pages) is often the most accurate description of what
+specific operations on widgets do. Even when you know the name of the option
+or method that you need, you may still have a few places to look.
+
+While all operations in Tkinter are implemented as method calls on widget
+objects, you've seen that many Tcl/Tk operations appear as commands that
+take a widget pathname as its first parameter, followed by optional
+parameters, e.g.
+
+::
+
+    destroy .
+    grid .frm.btn -column 0 -row 0
+
+Others, however, look more like methods called on a widget object (in fact,
+when you create a widget in Tcl/Tk, it creates a Tcl command with the name
+of the widget pathname, with the first parameter to that command being the
+name of a method to call).
+
+::
+
+    .frm.btn invoke
+    .frm.lbl configure -text "Goodbye"
+
+
+In the official Tcl/Tk reference documentation, you'll find most operations
+that look like method calls on the man page for a specific widget (e.g.,
+you'll find the :meth:`invoke` method on the
+`ttk::button <https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_button.htm>`_
+man page), while functions that take a widget as a parameter often have
+their own man page (e.g.,
+`grid <https://www.tcl.tk/man/tcl8.6/TkCmd/grid.htm>`_).
+
+You'll find many common options and methods in the
+`options <https://www.tcl.tk/man/tcl8.6/TkCmd/options.htm>`_ or
+`ttk::widget <https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_widget.htm>`_ man
+pages, while others are found in the man page for a specific widget class.
+
+You'll also find that many Tkinter methods have compound names, e.g.,
+:func:`winfo_x`, :func:`winfo_height`, :func:`winfo_viewable`. You'd find
+documentation for all of these in the
+`winfo <https://www.tcl.tk/man/tcl8.6/TkCmd/winfo.htm>`_ man page.
+
+.. note::
+   Somewhat confusingly, there are also methods on all Tkinter widgets
+   that don't actually operate on the widget, but operate at a global
+   scope, independent of any widget. Examples are methods for accessing
+   the clipboard or the system bell. (They happen to be implemented as
+   methods in the base :class:`Widget` class that all Tkinter widgets
+   inherit from).
+
+
+Threading model
+---------------
+
+Python and Tcl/Tk have very different threading models, which :mod:`tkinter`
+tries to bridge. If you use threads, you may need to be aware of this.
+
+A Python interpreter may have many threads associated with it. In Tcl, multiple
+threads can be created, but each thread has a separate Tcl interpreter instance
+associated with it. Threads can also create more than one interpreter instance,
+though each interpreter instance can be used only by the one thread that created it.
+
+Each :class:`Tk` object created by :mod:`tkinter` contains a Tcl interpreter.
+It also keeps track of which thread created that interpreter. Calls to
+:mod:`tkinter` can be made from any Python thread. Internally, if a call comes
+from a thread other than the one that created the :class:`Tk` object, an event
+is posted to the interpreter's event queue, and when executed, the result is
+returned to the calling Python thread.
+
+Tcl/Tk applications are normally event-driven, meaning that after initialization,
+the interpreter runs an event loop (i.e. :func:`Tk.mainloop`) and responds to events.
+Because it is single-threaded, event handlers must respond quickly, otherwise they
+will block other events from being processed. To avoid this, any long-running
+computations should not run in an event handler, but are either broken into smaller
+pieces using timers, or run in another thread. This is different from many GUI
+toolkits where the GUI runs in a completely separate thread from all application
+code including event handlers.
+
+If the Tcl interpreter is not running the event loop and processing events, any
+:mod:`tkinter` calls made from threads other than the one running the Tcl
+interpreter will fail.
+
+A number of special cases exist:
+
+  * Tcl/Tk libraries can be built so they are not thread-aware. In this case,
+    :mod:`tkinter` calls the library from the originating Python thread, even
+    if this is different than the thread that created the Tcl interpreter. A global
+    lock ensures only one call occurs at a time.
+
+  * While :mod:`tkinter` allows you to create more than one instance of a :class:`Tk`
+    object (with its own interpreter), all interpreters that are part of the same
+    thread share a common event queue, which gets ugly fast. In practice, don't create
+    more than one instance of :class:`Tk` at a time. Otherwise, it's best to create
+    them in separate threads and ensure you're running a thread-aware Tcl/Tk build.
+
+  * Blocking event handlers are not the only way to prevent the Tcl interpreter from
+    reentering the event loop. It is even possible to run multiple nested event loops
+    or abandon the event loop entirely. If you're doing anything tricky when it comes
+    to events or threads, be aware of these possibilities.
+
+  * There are a few select :mod:`tkinter` functions that presently work only when
+    called from the thread that created the Tcl interpreter.
 
 
 Handy Reference
@@ -639,8 +756,8 @@
 
 color
    Colors can be given as the names of X colors in the rgb.txt file, or as strings
-   representing RGB values in 4 bit: ``"#RGB"``, 8 bit: ``"#RRGGBB"``, 12 bit"
-   ``"#RRRGGGBBB"``, or 16 bit ``"#RRRRGGGGBBBB"`` ranges, where R,G,B here
+   representing RGB values in 4 bit: ``"#RGB"``, 8 bit: ``"#RRGGBB"``, 12 bit:
+   ``"#RRRGGGBBB"``, or 16 bit: ``"#RRRRGGGGBBBB"`` ranges, where R,G,B here
    represent any legal hex digit.  See page 160 of Ousterhout's book for details.
 
 cursor
diff --git a/Doc/library/tkinter.ttk.rst b/Doc/library/tkinter.ttk.rst
index 6967d75..2db4c0f 100644
--- a/Doc/library/tkinter.ttk.rst
+++ b/Doc/library/tkinter.ttk.rst
@@ -759,7 +759,7 @@
 Platform-specific notes
 ^^^^^^^^^^^^^^^^^^^^^^^
 
-* On MacOS X, toplevel windows automatically include a built-in size grip
+* On macOS, toplevel windows automatically include a built-in size grip
   by default. Adding a :class:`Sizegrip` is harmless, since the built-in
   grip will just mask the widget.
 
diff --git a/Doc/library/token-list.inc b/Doc/library/token-list.inc
index 877d39a..1a99f05 100644
--- a/Doc/library/token-list.inc
+++ b/Doc/library/token-list.inc
@@ -211,6 +211,8 @@
 
 .. data:: TYPE_COMMENT
 
+.. data:: SOFT_KEYWORD
+
 .. data:: ERRORTOKEN
 
 .. data:: N_TOKENS
diff --git a/Doc/library/token.rst b/Doc/library/token.rst
index 7f598cd..a1aceba 100644
--- a/Doc/library/token.rst
+++ b/Doc/library/token.rst
@@ -11,7 +11,7 @@
 --------------
 
 This module provides constants which represent the numeric values of leaf nodes
-of the parse tree (terminal tokens).  Refer to the file :file:`Grammar/Grammar`
+of the parse tree (terminal tokens).  Refer to the file :file:`Grammar/Tokens`
 in the Python distribution for the definitions of the names in the context of
 the language grammar.  The specific numeric values which the names map to may
 change between Python versions.
diff --git a/Doc/library/trace.rst b/Doc/library/trace.rst
index c2732d9..40cf198 100644
--- a/Doc/library/trace.rst
+++ b/Doc/library/trace.rst
@@ -153,47 +153,47 @@
    count information.  *timing* enables a timestamp relative to when tracing was
    started to be displayed.
 
-    .. method:: run(cmd)
+   .. method:: run(cmd)
 
-       Execute the command and gather statistics from the execution with
-       the current tracing parameters.  *cmd* must be a string or code object,
-       suitable for passing into :func:`exec`.
+      Execute the command and gather statistics from the execution with
+      the current tracing parameters.  *cmd* must be a string or code object,
+      suitable for passing into :func:`exec`.
 
-    .. method:: runctx(cmd, globals=None, locals=None)
+   .. method:: runctx(cmd, globals=None, locals=None)
 
-       Execute the command and gather statistics from the execution with the
-       current tracing parameters, in the defined global and local
-       environments.  If not defined, *globals* and *locals* default to empty
-       dictionaries.
+      Execute the command and gather statistics from the execution with the
+      current tracing parameters, in the defined global and local
+      environments.  If not defined, *globals* and *locals* default to empty
+      dictionaries.
 
-    .. method:: runfunc(func, /, *args, **kwds)
+   .. method:: runfunc(func, /, *args, **kwds)
 
-       Call *func* with the given arguments under control of the :class:`Trace`
-       object with the current tracing parameters.
+      Call *func* with the given arguments under control of the :class:`Trace`
+      object with the current tracing parameters.
 
-    .. method:: results()
+   .. method:: results()
 
-       Return a :class:`CoverageResults` object that contains the cumulative
-       results of all previous calls to ``run``, ``runctx`` and ``runfunc``
-       for the given :class:`Trace` instance.  Does not reset the accumulated
-       trace results.
+      Return a :class:`CoverageResults` object that contains the cumulative
+      results of all previous calls to ``run``, ``runctx`` and ``runfunc``
+      for the given :class:`Trace` instance.  Does not reset the accumulated
+      trace results.
 
 .. class:: CoverageResults
 
    A container for coverage results, created by :meth:`Trace.results`.  Should
    not be created directly by the user.
 
-    .. method:: update(other)
+   .. method:: update(other)
 
-       Merge in data from another :class:`CoverageResults` object.
+      Merge in data from another :class:`CoverageResults` object.
 
-    .. method:: write_results(show_missing=True, summary=False, coverdir=None)
+   .. method:: write_results(show_missing=True, summary=False, coverdir=None)
 
-       Write coverage results.  Set *show_missing* to show lines that had no
-       hits.  Set *summary* to include in the output the coverage summary per
-       module.  *coverdir* specifies the directory into which the coverage
-       result files will be output.  If ``None``, the results for each source
-       file are placed in its directory.
+      Write coverage results.  Set *show_missing* to show lines that had no
+      hits.  Set *summary* to include in the output the coverage summary per
+      module.  *coverdir* specifies the directory into which the coverage
+      result files will be output.  If ``None``, the results for each source
+      file are placed in its directory.
 
 A simple example demonstrating the use of the programmatic interface::
 
diff --git a/Doc/library/traceback.rst b/Doc/library/traceback.rst
index 462a6a5..e938dd5 100644
--- a/Doc/library/traceback.rst
+++ b/Doc/library/traceback.rst
@@ -36,7 +36,8 @@
        Added negative *limit* support.
 
 
-.. function:: print_exception(etype, value, tb, limit=None, file=None, chain=True)
+.. function:: print_exception(exc, /[, value, tb], limit=None, \
+                              file=None, chain=True)
 
    Print exception information and stack trace entries from traceback object
    *tb* to *file*. This differs from :func:`print_tb` in the following
@@ -45,7 +46,7 @@
    * if *tb* is not ``None``, it prints a header ``Traceback (most recent
      call last):``
 
-   * it prints the exception *etype* and *value* after the stack trace
+   * it prints the exception type and *value* after the stack trace
 
    .. index:: single: ^ (caret); marker
 
@@ -53,6 +54,10 @@
      format, it prints the line where the syntax error occurred with a caret
      indicating the approximate position of the error.
 
+   Since Python 3.10, instead of passing *value* and *tb*, an exception object
+   can be passed as the first argument. If *value* and *tb* are provided, the
+   first argument is ignored in order to provide backwards compatibility.
+
    The optional *limit* argument has the same meaning as for :func:`print_tb`.
    If *chain* is true (the default), then chained exceptions (the
    :attr:`__cause__` or :attr:`__context__` attributes of the exception) will be
@@ -62,6 +67,10 @@
    .. versionchanged:: 3.5
       The *etype* argument is ignored and inferred from the type of *value*.
 
+   .. versionchanged:: 3.10
+      The *etype* parameter has been renamed to *exc* and is now
+      positional-only.
+
 
 .. function:: print_exc(limit=None, file=None, chain=True)
 
@@ -121,18 +130,26 @@
    text line is not ``None``.
 
 
-.. function:: format_exception_only(etype, value)
+.. function:: format_exception_only(exc, /[, value])
 
-   Format the exception part of a traceback.  The arguments are the exception
-   type and value such as given by ``sys.last_type`` and ``sys.last_value``.
-   The return value is a list of strings, each ending in a newline.  Normally,
-   the list contains a single string; however, for :exc:`SyntaxError`
-   exceptions, it contains several lines that (when printed) display detailed
-   information about where the syntax error occurred.  The message indicating
-   which exception occurred is the always last string in the list.
+   Format the exception part of a traceback using an exception value such as
+   given by ``sys.last_value``.  The return value is a list of strings, each
+   ending in a newline.  Normally, the list contains a single string; however,
+   for :exc:`SyntaxError` exceptions, it contains several lines that (when
+   printed) display detailed information about where the syntax error occurred.
+   The message indicating which exception occurred is the always last string in
+   the list.
+
+   Since Python 3.10, instead of passing *value*, an exception object
+   can be passed as the first argument.  If *value* is provided, the first
+   argument is ignored in order to provide backwards compatibility.
+
+   .. versionchanged:: 3.10
+      The *etype* parameter has been renamed to *exc* and is now
+      positional-only.
 
 
-.. function:: format_exception(etype, value, tb, limit=None, chain=True)
+.. function:: format_exception(exc, /[, value, tb], limit=None, chain=True)
 
    Format a stack trace and the exception information.  The arguments  have the
    same meaning as the corresponding arguments to :func:`print_exception`.  The
@@ -143,6 +160,10 @@
    .. versionchanged:: 3.5
       The *etype* argument is ignored and inferred from the type of *value*.
 
+   .. versionchanged:: 3.10
+      This function's behavior and signature were modified to match
+      :func:`print_exception`.
+
 
 .. function:: format_exc(limit=None, chain=True)
 
@@ -191,11 +212,16 @@
 :class:`TracebackException` objects are created from actual exceptions to
 capture data for later printing in a lightweight fashion.
 
-.. class:: TracebackException(exc_type, exc_value, exc_traceback, *, limit=None, lookup_lines=True, capture_locals=False)
+.. class:: TracebackException(exc_type, exc_value, exc_traceback, *, limit=None, lookup_lines=True, capture_locals=False, compact=False)
 
    Capture an exception for later rendering. *limit*, *lookup_lines* and
    *capture_locals* are as for the :class:`StackSummary` class.
 
+   If *compact* is true, only data that is required by :class:`TracebackException`'s
+   ``format`` method is saved in the class attributes. In particular, the
+   ``__context__`` field is calculated only if ``__cause__`` is ``None`` and
+   ``__suppress_context__`` is false.
+
    Note that when locals are captured, they are also shown in the traceback.
 
    .. attribute:: __cause__
@@ -273,6 +299,9 @@
       The message indicating which exception occurred is always the last
       string in the output.
 
+   .. versionchanged:: 3.10
+      Added the *compact* parameter.
+
 
 :class:`StackSummary` Objects
 -----------------------------
diff --git a/Doc/library/tracemalloc.rst b/Doc/library/tracemalloc.rst
index 20f668c..68432ae 100644
--- a/Doc/library/tracemalloc.rst
+++ b/Doc/library/tracemalloc.rst
@@ -740,12 +740,12 @@
 
    .. method:: format(limit=None, most_recent_first=False)
 
-      Format the traceback as a list of lines with newlines. Use the
-      :mod:`linecache` module to retrieve lines from the source code.
-      If *limit* is set, format the *limit* most recent frames if *limit*
-      is positive. Otherwise, format the ``abs(limit)`` oldest frames.
-      If *most_recent_first* is ``True``, the order of the formatted frames
-      is reversed, returning the most recent frame first instead of last.
+      Format the traceback as a list of lines. Use the :mod:`linecache` module to
+      retrieve lines from the source code. If *limit* is set, format the *limit*
+      most recent frames if *limit* is positive. Otherwise, format the
+      ``abs(limit)`` oldest frames. If *most_recent_first* is ``True``, the order
+      of the formatted frames is reversed, returning the most recent frame first
+      instead of last.
 
       Similar to the :func:`traceback.format_tb` function, except that
       :meth:`.format` does not include newlines.
diff --git a/Doc/library/turtle.rst b/Doc/library/turtle.rst
index d348753..228cf1e 100644
--- a/Doc/library/turtle.rst
+++ b/Doc/library/turtle.rst
@@ -193,8 +193,8 @@
 Window control
    | :func:`bgcolor`
    | :func:`bgpic`
-   | :func:`clear` | :func:`clearscreen`
-   | :func:`reset` | :func:`resetscreen`
+   | :func:`clearscreen`
+   | :func:`resetscreen`
    | :func:`screensize`
    | :func:`setworldcoordinates`
 
@@ -662,7 +662,7 @@
 
    Return the angle between the line from turtle position to position specified
    by (x,y), the vector or the other turtle.  This depends on the turtle's start
-   orientation which depends on the mode - "standard"/"world" or "logo").
+   orientation which depends on the mode - "standard"/"world" or "logo".
 
    .. doctest::
       :skipif: _tkinter is None
@@ -913,8 +913,8 @@
       Set pencolor to the RGB color represented by *r*, *g*, and *b*.  Each of
       *r*, *g*, and *b* must be in the range 0..colormode.
 
-    If turtleshape is a polygon, the outline of that polygon is drawn with the
-    newly set pencolor.
+   If turtleshape is a polygon, the outline of that polygon is drawn with the
+   newly set pencolor.
 
    .. doctest::
       :skipif: _tkinter is None
@@ -962,8 +962,8 @@
       Set fillcolor to the RGB color represented by *r*, *g*, and *b*.  Each of
       *r*, *g*, and *b* must be in the range 0..colormode.
 
-    If turtleshape is a polygon, the interior of that polygon is drawn
-    with the newly set fillcolor.
+   If turtleshape is a polygon, the interior of that polygon is drawn
+   with the newly set fillcolor.
 
    .. doctest::
       :skipif: _tkinter is None
@@ -1001,8 +1001,8 @@
       Equivalent to ``pencolor(colorstring1)`` and ``fillcolor(colorstring2)``
       and analogously if the other input format is used.
 
-    If turtleshape is a polygon, outline and interior of that polygon is drawn
-    with the newly set colors.
+   If turtleshape is a polygon, outline and interior of that polygon is drawn
+   with the newly set colors.
 
    .. doctest::
       :skipif: _tkinter is None
@@ -1069,7 +1069,6 @@
 ~~~~~~~~~~~~~~~~~~~~
 
 .. function:: reset()
-   :noindex:
 
    Delete the turtle's drawings from the screen, re-center the turtle and set
    variables to the default values.
@@ -1091,7 +1090,6 @@
 
 
 .. function:: clear()
-   :noindex:
 
    Delete the turtle's drawings from the screen.  Do not move turtle.  State and
    position of the turtle as well as drawings of other turtles are not affected.
@@ -1105,7 +1103,7 @@
    :param font: a triple (fontname, fontsize, fonttype)
 
    Write text - the string representation of *arg* - at the current turtle
-   position according to *align* ("left", "center" or right") and with the given
+   position according to *align* ("left", "center" or "right") and with the given
    font.  If *move* is true, the pen is moved to the bottom-right corner of the
    text.  By default, *move* is ``False``.
 
@@ -1192,7 +1190,7 @@
      :func:`shapesize`.
    - "noresize": no adaption of the turtle's appearance takes place.
 
-   resizemode("user") is called by :func:`shapesize` when used with arguments.
+   ``resizemode("user")`` is called by :func:`shapesize` when used with arguments.
 
    .. doctest::
       :skipif: _tkinter is None
@@ -1330,7 +1328,7 @@
    matrix as a tuple of 4 elements.
    Otherwise set the given elements and transform the turtleshape
    according to the matrix consisting of first row t11, t12 and
-   second row t21, 22. The determinant t11 * t22 - t12 * t21 must not be
+   second row t21, t22. The determinant t11 * t22 - t12 * t21 must not be
    zero, otherwise an error is raised.
    Modify stretchfactor, shearfactor and tiltangle according to the
    given matrix.
@@ -1513,7 +1511,7 @@
 
    :param size: an integer or ``None``
 
-   Set or disable undobuffer.  If *size* is an integer an empty undobuffer of
+   Set or disable undobuffer.  If *size* is an integer, an empty undobuffer of
    given size is installed.  *size* gives the maximum number of turtle actions
    that can be undone by the :func:`undo` method/function.  If *size* is
    ``None``, the undobuffer is disabled.
@@ -1627,11 +1625,7 @@
 
 
 .. function:: clear()
-              clearscreen()
-
-   Delete all drawings and all turtles from the TurtleScreen.  Reset the now
-   empty TurtleScreen to its initial state: white background, no background
-   image, no event bindings and tracing on.
+   :noindex:
 
    .. note::
       This TurtleScreen method is available as a global function only under the
@@ -1639,10 +1633,15 @@
       derived from the Turtle method ``clear``.
 
 
-.. function:: reset()
-              resetscreen()
+.. function:: clearscreen()
 
-   Reset all Turtles on the Screen to their initial state.
+   Delete all drawings and all turtles from the TurtleScreen.  Reset the now
+   empty TurtleScreen to its initial state: white background, no background
+   image, no event bindings and tracing on.
+
+
+.. function:: reset()
+   :noindex:
 
    .. note::
       This TurtleScreen method is available as a global function only under the
@@ -1650,6 +1649,11 @@
       derived from the Turtle method ``reset``.
 
 
+.. function:: resetscreen()
+
+   Reset all Turtles on the Screen to their initial state.
+
+
 .. function:: screensize(canvwidth=None, canvheight=None, bg=None)
 
    :param canvwidth: positive integer, new width of canvas in pixels
@@ -1821,7 +1825,7 @@
    existing bindings are removed.
 
    Example for a TurtleScreen instance named ``screen`` and a Turtle instance
-   named turtle:
+   named ``turtle``:
 
    .. doctest::
       :skipif: _tkinter is None
@@ -2048,7 +2052,7 @@
 
 .. function:: exitonclick()
 
-   Bind bye() method to mouse clicks on the Screen.
+   Bind ``bye()`` method to mouse clicks on the Screen.
 
 
    If the value "using_IDLE" in the configuration dictionary is ``False``
diff --git a/Doc/library/types.rst b/Doc/library/types.rst
index 0fe3822..5cd42f1 100644
--- a/Doc/library/types.rst
+++ b/Doc/library/types.rst
@@ -34,7 +34,7 @@
    freshly created class namespace. It should accept the class namespace
    as its sole argument and update the namespace directly with the class
    contents. If no callback is provided, it has the same effect as passing
-   in ``lambda ns: ns``.
+   in ``lambda ns: None``.
 
    .. versionadded:: 3.3
 
@@ -103,6 +103,13 @@
 
 Standard names are defined for the following types:
 
+.. data:: NoneType
+
+   The type of :data:`None`.
+
+   .. versionadded:: 3.10
+
+
 .. data:: FunctionType
           LambdaType
 
@@ -192,6 +199,13 @@
    .. versionadded:: 3.7
 
 
+.. data:: NotImplementedType
+
+   The type of :data:`NotImplemented`.
+
+   .. versionadded:: 3.10
+
+
 .. data:: MethodDescriptorType
 
    The type of methods of some built-in data types such as :meth:`str.join`.
@@ -209,7 +223,7 @@
 
 .. class:: ModuleType(name, doc=None)
 
-   The type of :term:`modules <module>`. Constructor takes the name of the
+   The type of :term:`modules <module>`. The constructor takes the name of the
    module to be created and optionally its :term:`docstring`.
 
    .. note::
@@ -224,12 +238,23 @@
 
       The :term:`loader` which loaded the module. Defaults to ``None``.
 
+      This attribute is to match :attr:`importlib.machinery.ModuleSpec.loader`
+      as stored in the attr:`__spec__` object.
+
+      .. note::
+         A future version of Python may stop setting this attribute by default.
+         To guard against this potential change, preferably read from the
+         :attr:`__spec__` attribute instead or use
+         ``getattr(module, "__loader__", None)`` if you explicitly need to use
+         this attribute.
+
       .. versionchanged:: 3.4
          Defaults to ``None``. Previously the attribute was optional.
 
    .. attribute:: __name__
 
-      The name of the module.
+      The name of the module. Expected to match
+      :attr:`importlib.machinery.ModuleSpec.name`.
 
    .. attribute:: __package__
 
@@ -238,9 +263,32 @@
       to ``''``, else it should be set to the name of the package (which can be
       :attr:`__name__` if the module is a package itself). Defaults to ``None``.
 
+      This attribute is to match :attr:`importlib.machinery.ModuleSpec.parent`
+      as stored in the attr:`__spec__` object.
+
+      .. note::
+         A future version of Python may stop setting this attribute by default.
+         To guard against this potential change, preferably read from the
+         :attr:`__spec__` attribute instead or use
+         ``getattr(module, "__package__", None)`` if you explicitly need to use
+         this attribute.
+
       .. versionchanged:: 3.4
          Defaults to ``None``. Previously the attribute was optional.
 
+   .. attribute:: __spec__
+
+      A record of the module's import-system-related state. Expected to be an
+      instance of :class:`importlib.machinery.ModuleSpec`.
+
+      .. versionadded:: 3.4
+
+
+.. data:: EllipsisType
+
+   The type of :data:`Ellipsis`.
+
+   .. versionadded:: 3.10
 
 .. class:: GenericAlias(t_origin, t_args)
 
@@ -260,6 +308,15 @@
 
    .. versionadded:: 3.9
 
+   .. versionchanged:: 3.9.2
+      This type can now be subclassed.
+
+
+.. class:: UnionType
+
+   The type of :ref:`union type expressions<types-union>`.
+
+   .. versionadded:: 3.10
 
 .. class:: TracebackType(tb_next, tb_frame, tb_lasti, tb_lineno)
 
diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst
index af2cafb..6fa3eee 100644
--- a/Doc/library/typing.rst
+++ b/Doc/library/typing.rst
@@ -17,12 +17,10 @@
 
 --------------
 
-This module provides runtime support for type hints as specified by
-:pep:`484`, :pep:`526`, :pep:`544`, :pep:`586`, :pep:`589`, and :pep:`591`.
-The most fundamental support consists of the types :data:`Any`, :data:`Union`,
-:data:`Tuple`, :data:`Callable`, :class:`TypeVar`, and
-:class:`Generic`.  For full specification please see :pep:`484`.  For
-a simplified introduction to type hints see :pep:`483`.
+This module provides runtime support for type hints. The most fundamental
+support consists of the types :data:`Any`, :data:`Union`, :data:`Callable`,
+:class:`TypeVar`, and :class:`Generic`. For a full specification, please see
+:pep:`484`. For a simplified introduction to type hints, see :pep:`483`.
 
 
 The function below takes and returns a string and is annotated as follows::
@@ -34,6 +32,49 @@
 :class:`str` and the return type :class:`str`. Subtypes are accepted as
 arguments.
 
+New features are frequently added to the ``typing`` module.
+The `typing_extensions <https://pypi.org/project/typing-extensions/>`_ package
+provides backports of these new features to older versions of Python.
+
+.. _relevant-peps:
+
+Relevant PEPs
+=============
+
+Since the initial introduction of type hints in :pep:`484` and :pep:`483`, a
+number of PEPs have modified and enhanced Python's framework for type
+annotations. These include:
+
+* :pep:`526`: Syntax for Variable Annotations
+     *Introducing* syntax for annotating variables outside of function
+     definitions, and :data:`ClassVar`
+* :pep:`544`: Protocols: Structural subtyping (static duck typing)
+     *Introducing* :class:`Protocol` and the
+     :func:`@runtime_checkable<runtime_checkable>` decorator
+* :pep:`585`: Type Hinting Generics In Standard Collections
+     *Introducing* :class:`types.GenericAlias` and the ability to use standard
+     library classes as :ref:`generic types<types-genericalias>`
+* :pep:`586`: Literal Types
+     *Introducing* :data:`Literal`
+* :pep:`589`: TypedDict: Type Hints for Dictionaries with a Fixed Set of Keys
+     *Introducing* :class:`TypedDict`
+* :pep:`591`: Adding a final qualifier to typing
+     *Introducing* :data:`Final` and the :func:`@final<final>` decorator
+* :pep:`593`: Flexible function and variable annotations
+     *Introducing* :data:`Annotated`
+* :pep:`604`: Allow writing union types as ``X | Y``
+     *Introducing* :data:`types.UnionType` and the ability to use
+     the binary-or operator ``|`` to signify a
+     :ref:`union of types<types-union>`
+* :pep:`612`: Parameter Specification Variables
+     *Introducing* :class:`ParamSpec` and :data:`Concatenate`
+* :pep:`613`: Explicit Type Aliases
+     *Introducing* :data:`TypeAlias`
+* :pep:`647`: User-Defined Type Guards
+     *Introducing* :data:`TypeGuard`
+
+.. _type-aliases:
+
 Type aliases
 ============
 
@@ -74,7 +115,7 @@
 NewType
 =======
 
-Use the :func:`NewType` helper function to create distinct types::
+Use the :class:`NewType` helper class to create distinct types::
 
    from typing import NewType
 
@@ -103,15 +144,14 @@
 
 Note that these checks are enforced only by the static type checker. At runtime,
 the statement ``Derived = NewType('Derived', Base)`` will make ``Derived`` a
-function that immediately returns whatever parameter you pass it. That means
+class that immediately returns whatever parameter you pass it. That means
 the expression ``Derived(some_value)`` does not create a new class or introduce
-any overhead beyond that of a regular function call.
+much overhead beyond that of a regular function call.
 
 More precisely, the expression ``some_value is Derived(some_value)`` is always
 true at runtime.
 
-This also means that it is not possible to create a subtype of ``Derived``
-since it is an identity function at runtime, not an actual type::
+It is invalid to create a subtype of ``Derived``::
 
    from typing import NewType
 
@@ -120,7 +160,7 @@
    # Fails at runtime and does not typecheck
    class AdminUserId(UserId): pass
 
-However, it is possible to create a :func:`NewType` based on a 'derived' ``NewType``::
+However, it is possible to create a :class:`NewType` based on a 'derived' ``NewType``::
 
    from typing import NewType
 
@@ -148,6 +188,12 @@
 
 .. versionadded:: 3.5.2
 
+.. versionchanged:: 3.10
+   ``NewType`` is now a class rather than a function.  There is some additional
+   runtime cost when calling ``NewType`` over a regular function.  However, this
+   cost will be reduced in 3.11.0.
+
+
 Callable
 ========
 
@@ -169,6 +215,22 @@
 the call signature by substituting a literal ellipsis
 for the list of arguments in the type hint: ``Callable[..., ReturnType]``.
 
+Callables which take other callables as arguments may indicate that their
+parameter types are dependent on each other using :class:`ParamSpec`.
+Additionally, if that callable adds or removes arguments from other
+callables, the :data:`Concatenate` operator may be used.  They
+take the form ``Callable[ParamSpecVariable, ReturnType]`` and
+``Callable[Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable], ReturnType]``
+respectively.
+
+.. versionchanged:: 3.10
+   ``Callable`` now supports :class:`ParamSpec` and :data:`Concatenate`.
+   See :pep:`612` for more information.
+
+.. seealso::
+   The documentation for :class:`ParamSpec` and :class:`Concatenate` provide
+   examples of usage in ``Callable``.
+
 .. _generics:
 
 Generics
@@ -198,6 +260,7 @@
    def first(l: Sequence[T]) -> T:   # Generic function
        return l[0]
 
+.. _user-defined-generics:
 
 User-defined generic types
 ==========================
@@ -232,8 +295,8 @@
 single type parameter ``T`` . This also makes ``T`` valid as a type within the
 class body.
 
-The :class:`Generic` base class defines :meth:`__class_getitem__` so that
-``LoggedVar[t]`` is valid as a type::
+The :class:`Generic` base class defines :meth:`~object.__class_getitem__` so
+that ``LoggedVar[t]`` is valid as a type::
 
    from collections.abc import Iterable
 
@@ -297,11 +360,11 @@
 User defined generic type aliases are also supported. Examples::
 
    from collections.abc import Iterable
-   from typing import TypeVar, Union
+   from typing import TypeVar
    S = TypeVar('S')
-   Response = Union[Iterable[S], int]
+   Response = Iterable[S] | int
 
-   # Return type here is same as Union[Iterable[str], int]
+   # Return type here is same as Iterable[str] | int
    def response(query: str) -> Response[str]:
        ...
 
@@ -314,6 +377,43 @@
 .. versionchanged:: 3.7
     :class:`Generic` no longer has a custom metaclass.
 
+User-defined generics for parameter expressions are also supported via parameter
+specification variables in the form ``Generic[P]``.  The behavior is consistent
+with type variables' described above as parameter specification variables are
+treated by the typing module as a specialized type variable.  The one exception
+to this is that a list of types can be used to substitute a :class:`ParamSpec`::
+
+   >>> from typing import Generic, ParamSpec, TypeVar
+
+   >>> T = TypeVar('T')
+   >>> P = ParamSpec('P')
+
+   >>> class Z(Generic[T, P]): ...
+   ...
+   >>> Z[int, [dict, float]]
+   __main__.Z[int, (<class 'dict'>, <class 'float'>)]
+
+
+Furthermore, a generic with only one parameter specification variable will accept
+parameter lists in the forms ``X[[Type1, Type2, ...]]`` and also
+``X[Type1, Type2, ...]`` for aesthetic reasons.  Internally, the latter is converted
+to the former and are thus equivalent::
+
+   >>> class X(Generic[P]): ...
+   ...
+   >>> X[int, str]
+   __main__.X[(<class 'int'>, <class 'str'>)]
+   >>> X[[int, str]]
+   __main__.X[(<class 'int'>, <class 'str'>)]
+
+Do note that generics with :class:`ParamSpec` may not have correct
+``__parameters__`` after substitution in some cases because they
+are intended primarily for static type checking.
+
+.. versionchanged:: 3.10
+   :class:`Generic` can now be parameterized over parameter expressions.
+   See :class:`ParamSpec` and :pep:`612` for more details.
+
 A user-defined generic class can have ABCs as base classes without a metaclass
 conflict. Generic metaclasses are not supported. The outcome of parameterizing
 generics is cached, and most types in the typing module are hashable and
@@ -332,12 +432,12 @@
 
    from typing import Any
 
-   a = None    # type: Any
-   a = []      # OK
-   a = 2       # OK
+   a: Any = None
+   a = []          # OK
+   a = 2           # OK
 
-   s = ''      # type: str
-   s = a       # OK
+   s: str = ''
+   s = a           # OK
 
    def foo(item: Any) -> int:
        # Typechecks; 'item' could be any type,
@@ -489,6 +589,19 @@
    .. versionadded:: 3.5.4
    .. versionadded:: 3.6.2
 
+.. data:: TypeAlias
+
+   Special annotation for explicitly declaring a :ref:`type alias <type-aliases>`.
+   For example::
+
+    from typing import TypeAlias
+
+    Factors: TypeAlias = list[int]
+
+   See :pep:`613` for more details about explicit type aliases.
+
+   .. versionadded:: 3.10
+
 Special forms
 """""""""""""
 
@@ -514,9 +627,9 @@
 
 .. data:: Union
 
-   Union type; ``Union[X, Y]`` means either X or Y.
+   Union type; ``Union[X, Y]`` is equivalent to ``X | Y`` and means either X or Y.
 
-   To define a union, use e.g. ``Union[int, str]``.  Details:
+   To define a union, use e.g. ``Union[int, str]`` or the shorthand ``int | str``. Using that shorthand is recommended. Details:
 
    * The arguments must be types and there must be at least one.
 
@@ -530,26 +643,28 @@
 
    * Redundant arguments are skipped, e.g.::
 
-       Union[int, str, int] == Union[int, str]
+       Union[int, str, int] == Union[int, str] == int | str
 
    * When comparing unions, the argument order is ignored, e.g.::
 
        Union[int, str] == Union[str, int]
 
-   * You cannot subclass or instantiate a union.
+   * You cannot subclass or instantiate a ``Union``.
 
    * You cannot write ``Union[X][Y]``.
 
-   * You can use ``Optional[X]`` as a shorthand for ``Union[X, None]``.
-
    .. versionchanged:: 3.7
       Don't remove explicit subclasses from unions at runtime.
 
+   .. versionchanged:: 3.10
+      Unions can now be written as ``X | Y``. See
+      :ref:`union type expressions<types-union>`.
+
 .. data:: Optional
 
    Optional type.
 
-   ``Optional[X]`` is equivalent to ``Union[X, None]``.
+   ``Optional[X]`` is equivalent to ``X | None`` (or ``Union[X, None]``).
 
    Note that this is not the same concept as an optional argument,
    which is one that has a default.  An optional argument with a
@@ -566,6 +681,10 @@
       def foo(arg: Optional[int] = None) -> None:
           ...
 
+   .. versionchanged:: 3.10
+      Optional can now be written as ``X | None``. See
+      :ref:`union type expressions<types-union>`.
+
 .. data:: Callable
 
    Callable type; ``Callable[[int], str]`` is a function of (int) -> str.
@@ -583,10 +702,80 @@
    ``Callable[..., Any]``, and in turn to
    :class:`collections.abc.Callable`.
 
+   Callables which take other callables as arguments may indicate that their
+   parameter types are dependent on each other using :class:`ParamSpec`.
+   Additionally, if that callable adds or removes arguments from other
+   callables, the :data:`Concatenate` operator may be used.  They
+   take the form ``Callable[ParamSpecVariable, ReturnType]`` and
+   ``Callable[Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable], ReturnType]``
+   respectively.
+
    .. deprecated:: 3.9
       :class:`collections.abc.Callable` now supports ``[]``. See :pep:`585` and
       :ref:`types-genericalias`.
 
+   .. versionchanged:: 3.10
+      ``Callable`` now supports :class:`ParamSpec` and :data:`Concatenate`.
+      See :pep:`612` for more information.
+
+   .. seealso::
+      The documentation for :class:`ParamSpec` and :class:`Concatenate` provide
+      examples of usage with ``Callable``.
+
+.. data:: Concatenate
+
+   Used with :data:`Callable` and :class:`ParamSpec` to type annotate a higher
+   order callable which adds, removes, or transforms parameters of another
+   callable.  Usage is in the form
+   ``Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable]``. ``Concatenate``
+   is currently only valid when used as the first argument to a :data:`Callable`.
+   The last parameter to ``Concatenate`` must be a :class:`ParamSpec`.
+
+   For example, to annotate a decorator ``with_lock`` which provides a
+   :class:`threading.Lock` to the decorated function,  ``Concatenate`` can be
+   used to indicate that ``with_lock`` expects a callable which takes in a
+   ``Lock`` as the first argument, and returns a callable with a different type
+   signature.  In this case, the :class:`ParamSpec` indicates that the returned
+   callable's parameter types are dependent on the parameter types of the
+   callable being passed in::
+
+      from collections.abc import Callable
+      from threading import Lock
+      from typing import Concatenate, ParamSpec, TypeVar
+
+      P = ParamSpec('P')
+      R = TypeVar('R')
+
+      # Use this lock to ensure that only one thread is executing a function
+      # at any time.
+      my_lock = Lock()
+
+      def with_lock(f: Callable[Concatenate[Lock, P], R]) -> Callable[P, R]:
+          '''A type-safe decorator which provides a lock.'''
+          global my_lock
+          def inner(*args: P.args, **kwargs: P.kwargs) -> R:
+              # Provide the lock as the first argument.
+              return f(my_lock, *args, **kwargs)
+          return inner
+
+      @with_lock
+      def sum_threadsafe(lock: Lock, numbers: list[float]) -> float:
+          '''Add a list of numbers together in a thread-safe manner.'''
+          with lock:
+              return sum(numbers)
+
+      # We don't need to pass in the lock ourselves thanks to the decorator.
+      sum_threadsafe([1.1, 2.2, 3.3])
+
+.. versionadded:: 3.10
+
+.. seealso::
+
+   * :pep:`612` -- Parameter Specification Variables (the PEP which introduced
+     ``ParamSpec`` and ``Concatenate``).
+   * :class:`ParamSpec` and :class:`Callable`.
+
+
 .. class:: Type(Generic[CT_co])
 
    A variable annotated with ``C`` may accept a value of type ``C``. In
@@ -622,7 +811,7 @@
    :ref:`type variables <generics>`, and unions of any of these types.
    For example::
 
-      def new_non_team_user(user_class: Type[Union[BasicUser, ProUser]]): ...
+      def new_non_team_user(user_class: Type[BasicUser | ProUser]): ...
 
    ``Type[Any]`` is equivalent to ``Type`` which in turn is equivalent
    to ``type``, which is the root of Python's metaclass hierarchy.
@@ -656,10 +845,10 @@
    .. versionadded:: 3.8
 
    .. versionchanged:: 3.9.1
-      ``Literal`` now de-duplicates parameters.  Equality comparison of
+      ``Literal`` now de-duplicates parameters.  Equality comparisons of
       ``Literal`` objects are no longer order dependent. ``Literal`` objects
       will now raise a :exc:`TypeError` exception during equality comparisons
-      if one of their parameters are not :term:`immutable`.
+      if one of their parameters are not :term:`hashable`.
 
 .. data:: ClassVar
 
@@ -790,6 +979,75 @@
 
    .. versionadded:: 3.9
 
+
+.. data:: TypeGuard
+
+   Special typing form used to annotate the return type of a user-defined
+   type guard function.  ``TypeGuard`` only accepts a single type argument.
+   At runtime, functions marked this way should return a boolean.
+
+   ``TypeGuard`` aims to benefit *type narrowing* -- a technique used by static
+   type checkers to determine a more precise type of an expression within a
+   program's code flow.  Usually type narrowing is done by analyzing
+   conditional code flow and applying the narrowing to a block of code.  The
+   conditional expression here is sometimes referred to as a "type guard"::
+
+      def is_str(val: str | float):
+          # "isinstance" type guard
+          if isinstance(val, str):
+              # Type of ``val`` is narrowed to ``str``
+              ...
+          else:
+              # Else, type of ``val`` is narrowed to ``float``.
+              ...
+
+   Sometimes it would be convenient to use a user-defined boolean function
+   as a type guard.  Such a function should use ``TypeGuard[...]`` as its
+   return type to alert static type checkers to this intention.
+
+   Using  ``-> TypeGuard`` tells the static type checker that for a given
+   function:
+
+   1. The return value is a boolean.
+   2. If the return value is ``True``, the type of its argument
+      is the type inside ``TypeGuard``.
+
+      For example::
+
+         def is_str_list(val: List[object]) -> TypeGuard[List[str]]:
+             '''Determines whether all objects in the list are strings'''
+             return all(isinstance(x, str) for x in val)
+
+         def func1(val: List[object]):
+             if is_str_list(val):
+                 # Type of ``val`` is narrowed to ``List[str]``.
+                 print(" ".join(val))
+             else:
+                 # Type of ``val`` remains as ``List[object]``.
+                 print("Not a list of strings!")
+
+   If ``is_str_list`` is a class or instance method, then the type in
+   ``TypeGuard`` maps to the type of the second parameter after ``cls`` or
+   ``self``.
+
+   In short, the form ``def foo(arg: TypeA) -> TypeGuard[TypeB]: ...``,
+   means that if ``foo(arg)`` returns ``True``, then ``arg`` narrows from
+   ``TypeA`` to ``TypeB``.
+
+   .. note::
+
+      ``TypeB`` need not be a narrower form of ``TypeA`` -- it can even be a
+      wider form. The main reason is to allow for things like
+      narrowing ``List[object]`` to ``List[str]`` even though the latter
+      is not a subtype of the former, since ``List`` is invariant.
+      The responsibility of writing type-safe type guards is left to the user.
+
+   ``TypeGuard`` also works with type variables.  For more information, see
+   :pep:`647` (User-Defined Type Guards).
+
+   .. versionadded:: 3.10
+
+
 Building generic types
 """"""""""""""""""""""
 
@@ -857,6 +1115,104 @@
     for the type variable must be a subclass of the boundary type,
     see :pep:`484`.
 
+.. class:: ParamSpec(name, *, bound=None, covariant=False, contravariant=False)
+
+   Parameter specification variable.  A specialized version of
+   :class:`type variables <TypeVar>`.
+
+   Usage::
+
+      P = ParamSpec('P')
+
+   Parameter specification variables exist primarily for the benefit of static
+   type checkers.  They are used to forward the parameter types of one
+   callable to another callable -- a pattern commonly found in higher order
+   functions and decorators.  They are only valid when used in ``Concatenate``,
+   or as the first argument to ``Callable``, or as parameters for user-defined
+   Generics.  See :class:`Generic` for more information on generic types.
+
+   For example, to add basic logging to a function, one can create a decorator
+   ``add_logging`` to log function calls.  The parameter specification variable
+   tells the type checker that the callable passed into the decorator and the
+   new callable returned by it have inter-dependent type parameters::
+
+      from collections.abc import Callable
+      from typing import TypeVar, ParamSpec
+      import logging
+
+      T = TypeVar('T')
+      P = ParamSpec('P')
+
+      def add_logging(f: Callable[P, T]) -> Callable[P, T]:
+          '''A type-safe decorator to add logging to a function.'''
+          def inner(*args: P.args, **kwargs: P.kwargs) -> T:
+              logging.info(f'{f.__name__} was called')
+              return f(*args, **kwargs)
+          return inner
+
+      @add_logging
+      def add_two(x: float, y: float) -> float:
+          '''Add two numbers together.'''
+          return x + y
+
+   Without ``ParamSpec``, the simplest way to annotate this previously was to
+   use a :class:`TypeVar` with bound ``Callable[..., Any]``.  However this
+   causes two problems:
+
+      1. The type checker can't type check the ``inner`` function because
+         ``*args`` and ``**kwargs`` have to be typed :data:`Any`.
+      2. :func:`~cast` may be required in the body of the ``add_logging``
+         decorator when returning the ``inner`` function, or the static type
+         checker must be told to ignore the ``return inner``.
+
+   .. attribute:: args
+   .. attribute:: kwargs
+
+      Since ``ParamSpec`` captures both positional and keyword parameters,
+      ``P.args`` and ``P.kwargs`` can be used to split a ``ParamSpec`` into its
+      components.  ``P.args`` represents the tuple of positional parameters in a
+      given call and should only be used to annotate ``*args``.  ``P.kwargs``
+      represents the mapping of keyword parameters to their values in a given call,
+      and should be only be used to annotate ``**kwargs``.  Both
+      attributes require the annotated parameter to be in scope. At runtime,
+      ``P.args`` and ``P.kwargs`` are instances respectively of
+      :class:`ParamSpecArgs` and :class:`ParamSpecKwargs`.
+
+   Parameter specification variables created with ``covariant=True`` or
+   ``contravariant=True`` can be used to declare covariant or contravariant
+   generic types.  The ``bound`` argument is also accepted, similar to
+   :class:`TypeVar`.  However the actual semantics of these keywords are yet to
+   be decided.
+
+   .. versionadded:: 3.10
+
+   .. note::
+      Only parameter specification variables defined in global scope can
+      be pickled.
+
+   .. seealso::
+      * :pep:`612` -- Parameter Specification Variables (the PEP which introduced
+        ``ParamSpec`` and ``Concatenate``).
+      * :class:`Callable` and :class:`Concatenate`.
+
+.. data:: ParamSpecArgs
+.. data:: ParamSpecKwargs
+
+   Arguments and keyword arguments attributes of a :class:`ParamSpec`. The
+   ``P.args`` attribute of a ``ParamSpec`` is an instance of ``ParamSpecArgs``,
+   and ``P.kwargs`` is an instance of ``ParamSpecKwargs``. They are intended
+   for runtime introspection and have no special meaning to static type checkers.
+
+   Calling :func:`get_origin` on either of these objects will return the
+   original ``ParamSpec``::
+
+      P = ParamSpec("P")
+      get_origin(P.args)  # returns P
+      get_origin(P.kwargs)  # returns P
+
+   .. versionadded:: 3.10
+
+
 .. data:: AnyStr
 
    ``AnyStr`` is a type variable defined as
@@ -922,11 +1278,13 @@
 
    .. note::
 
-        :func:`runtime_checkable` will check only the presence of the required methods,
-        not their type signatures! For example, :class:`builtins.complex <complex>`
-        implements :func:`__float__`, therefore it passes an :func:`issubclass` check
-        against :class:`SupportsFloat`. However, the ``complex.__float__`` method
-        exists only to raise a :class:`TypeError` with a more informative message.
+        :func:`runtime_checkable` will check only the presence of the required
+        methods, not their type signatures. For example, :class:`ssl.SSLObject`
+        is a class, therefore it passes an :func:`issubclass`
+        check against :data:`Callable`.  However, the
+        :meth:`ssl.SSLObject.__init__` method exists only to raise a
+        :exc:`TypeError` with a more informative message, therefore making
+        it impossible to call (instantiate) :class:`ssl.SSLObject`.
 
    .. versionadded:: 3.8
 
@@ -994,17 +1352,21 @@
       Removed the ``_field_types`` attribute in favor of the more
       standard ``__annotations__`` attribute which has the same information.
 
-.. function:: NewType(name, tp)
+.. class:: NewType(name, tp)
 
-   A helper function to indicate a distinct type to a typechecker,
-   see :ref:`distinct`. At runtime it returns a function that returns
-   its argument. Usage::
+   A helper class to indicate a distinct type to a typechecker,
+   see :ref:`distinct`. At runtime it returns an object that returns
+   its argument when called.
+   Usage::
 
       UserId = NewType('UserId', int)
       first_user = UserId(1)
 
    .. versionadded:: 3.5.2
 
+   .. versionchanged:: 3.10
+      ``NewType`` is now a class rather than a function.
+
 .. class:: TypedDict(dict)
 
    Special construct to add type hints to a dictionary.
@@ -1026,26 +1388,113 @@
 
       assert Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first')
 
-   The type info for introspection can be accessed via ``Point2D.__annotations__``
-   and ``Point2D.__total__``.  To allow using this feature with older versions
-   of Python that do not support :pep:`526`, ``TypedDict`` supports two additional
-   equivalent syntactic forms::
+   To allow using this feature with older versions of Python that do not
+   support :pep:`526`, ``TypedDict`` supports two additional equivalent
+   syntactic forms::
 
       Point2D = TypedDict('Point2D', x=int, y=int, label=str)
       Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})
 
-   By default, all keys must be present in a TypedDict. It is possible
-   to override this by specifying totality.
+   The functional syntax should also be used when any of the keys are not valid
+   :ref:`identifiers`, for example because they are keywords or contain hyphens.
+   Example::
+
+      # raises SyntaxError
+      class Point2D(TypedDict):
+          in: int  # 'in' is a keyword
+          x-y: int  # name with hyphens
+
+      # OK, functional syntax
+      Point2D = TypedDict('Point2D', {'in': int, 'x-y': int})
+
+   By default, all keys must be present in a ``TypedDict``. It is possible to
+   override this by specifying totality.
    Usage::
 
-      class point2D(TypedDict, total=False):
+      class Point2D(TypedDict, total=False):
           x: int
           y: int
 
-   This means that a point2D TypedDict can have any of the keys omitted. A type
-   checker is only expected to support a literal False or True as the value of
-   the total argument. True is the default, and makes all items defined in the
-   class body be required.
+   This means that a ``Point2D`` ``TypedDict`` can have any of the keys
+   omitted. A type checker is only expected to support a literal ``False`` or
+   ``True`` as the value of the ``total`` argument. ``True`` is the default,
+   and makes all items defined in the class body required.
+
+   It is possible for a ``TypedDict`` type to inherit from one or more other ``TypedDict`` types
+   using the class-based syntax.
+   Usage::
+
+      class Point3D(Point2D):
+          z: int
+
+   ``Point3D`` has three items: ``x``, ``y`` and ``z``. It is equivalent to this
+   definition::
+
+      class Point3D(TypedDict):
+          x: int
+          y: int
+          z: int
+
+   A ``TypedDict`` cannot inherit from a non-TypedDict class,
+   notably including :class:`Generic`. For example::
+
+      class X(TypedDict):
+          x: int
+
+      class Y(TypedDict):
+          y: int
+
+      class Z(object): pass  # A non-TypedDict class
+
+      class XY(X, Y): pass  # OK
+
+      class XZ(X, Z): pass  # raises TypeError
+
+      T = TypeVar('T')
+      class XT(X, Generic[T]): pass  # raises TypeError
+
+   A ``TypedDict`` can be introspected via annotations dicts
+   (see :ref:`annotations-howto` for more information on annotations best practices),
+   :attr:`__total__`, :attr:`__required_keys__`, and :attr:`__optional_keys__`.
+
+   .. attribute:: __total__
+
+      ``Point2D.__total__`` gives the value of the ``total`` argument.
+      Example::
+
+         >>> from typing import TypedDict
+         >>> class Point2D(TypedDict): pass
+         >>> Point2D.__total__
+         True
+         >>> class Point2D(TypedDict, total=False): pass
+         >>> Point2D.__total__
+         False
+         >>> class Point3D(Point2D): pass
+         >>> Point3D.__total__
+         True
+
+   .. attribute:: __required_keys__
+   .. attribute:: __optional_keys__
+
+      ``Point2D.__required_keys__`` and ``Point2D.__optional_keys__`` return
+      :class:`frozenset` objects containing required and non-required keys, respectively.
+      Currently the only way to declare both required and non-required keys in the
+      same ``TypedDict`` is mixed inheritance, declaring a ``TypedDict`` with one value
+      for the ``total`` argument and then inheriting it from another ``TypedDict`` with
+      a different value for ``total``.
+      Usage::
+
+         >>> class Point2D(TypedDict, total=False):
+         ...     x: int
+         ...     y: int
+         ...
+         >>> class Point3D(Point2D):
+         ...     z: int
+         ...
+         >>> Point3D.__required_keys__ == frozenset({'z'})
+         True
+         >>> Point3D.__optional_keys__ == frozenset({'x', 'y'})
+         True
 
    See :pep:`589` for more examples and detailed rules of using ``TypedDict``.
 
@@ -1179,7 +1628,11 @@
    Generic type ``IO[AnyStr]`` and its subclasses ``TextIO(IO[str])``
    and ``BinaryIO(IO[bytes])``
    represent the types of I/O streams such as returned by
-   :func:`open`. These types are also in the ``typing.io`` namespace.
+   :func:`open`.
+
+   .. deprecated-removed:: 3.8 3.12
+      The ``typing.io`` namespace is deprecated and will be removed.
+      These types should be directly imported from ``typing`` instead.
 
 .. class:: Pattern
            Match
@@ -1189,7 +1642,11 @@
    :func:`re.match`.  These types (and the corresponding functions)
    are generic in ``AnyStr`` and can be made specific by writing
    ``Pattern[str]``, ``Pattern[bytes]``, ``Match[str]``, or
-   ``Match[bytes]``. These types are also in the ``typing.re`` namespace.
+   ``Match[bytes]``.
+
+   .. deprecated-removed:: 3.8 3.12
+      The ``typing.re`` namespace is deprecated and will be removed.
+      These types should be directly imported from ``typing`` instead.
 
    .. deprecated:: 3.9
       Classes ``Pattern`` and ``Match`` from :mod:`re` now support ``[]``.
@@ -1411,11 +1868,10 @@
    correspond to those of :class:`Generator`, for example::
 
       from collections.abc import Coroutine
-      c = None # type: Coroutine[list[str], str, int]
-      ...
-      x = c.send('hi') # type: list[str]
+      c: Coroutine[list[str], str, int]  # Some coroutine defined elsewhere
+      x = c.send('hi')                   # Inferred type of 'x' is list[str]
       async def bar() -> None:
-          x = await c # type: int
+          y = await c                    # Inferred type of 'y' is int
 
    .. versionadded:: 3.5.3
 
@@ -1682,6 +2138,13 @@
            'name': Annotated[str, 'some marker']
        }
 
+   .. note::
+
+      :func:`get_type_hints` does not work with imported
+      :ref:`type aliases <type-aliases>` that include forward references.
+      Enabling postponed evaluation of annotations (:pep:`563`) may remove
+      the need for most forward references.
+
    .. versionchanged:: 3.9
       Added ``include_extras`` parameter as part of :pep:`593`.
 
@@ -1693,7 +2156,7 @@
    For a typing object of the form ``X[Y, Z, ...]`` these functions return
    ``X`` and ``(Y, Z, ...)``. If ``X`` is a generic alias for a builtin or
    :mod:`collections` class, it gets normalized to the original class.
-   If ``X`` is a :class:`Union` or :class:`Literal` contained in another
+   If ``X`` is a union or :class:`Literal` contained in another
    generic type, the order of ``(Y, Z, ...)`` may be different from the order
    of the original arguments ``[Y, Z, ...]`` due to type caching.
    For unsupported objects return ``None`` and ``()`` correspondingly.
@@ -1707,13 +2170,35 @@
 
    .. versionadded:: 3.8
 
+.. function:: is_typeddict(tp)
+
+   Check if a type is a :class:`TypedDict`.
+
+   For example::
+
+      class Film(TypedDict):
+          title: str
+          year: int
+
+      is_typeddict(Film)  # => True
+      is_typeddict(list | str)  # => False
+
+   .. versionadded:: 3.10
+
 .. class:: ForwardRef
 
    A class used for internal typing representation of string forward references.
-   For example, ``list["SomeClass"]`` is implicitly transformed into
-   ``list[ForwardRef("SomeClass")]``.  This class should not be instantiated by
+   For example, ``List["SomeClass"]`` is implicitly transformed into
+   ``List[ForwardRef("SomeClass")]``.  This class should not be instantiated by
    a user, but may be used by introspection tools.
 
+   .. note::
+      :pep:`585` generic types such as ``list["SomeClass"]`` will not be
+      implicitly transformed into ``list[ForwardRef("SomeClass")]`` and thus
+      will not automatically resolve to ``list[SomeClass]``.
+
+   .. versionadded:: 3.7.4
+
 Constant
 --------
 
@@ -1742,4 +2227,3 @@
       (see :pep:`563`).
 
    .. versionadded:: 3.5.2
-
diff --git a/Doc/library/unittest.mock-examples.rst b/Doc/library/unittest.mock-examples.rst
index e650bb1..24a18c6 100644
--- a/Doc/library/unittest.mock-examples.rst
+++ b/Doc/library/unittest.mock-examples.rst
@@ -893,7 +893,7 @@
     ...     def __call__(self, /, *args, **kwargs):
     ...         args = deepcopy(args)
     ...         kwargs = deepcopy(kwargs)
-    ...         return super(CopyingMock, self).__call__(*args, **kwargs)
+    ...         return super().__call__(*args, **kwargs)
     ...
     >>> c = CopyingMock(return_value=None)
     >>> arg = set()
diff --git a/Doc/library/unittest.mock.rst b/Doc/library/unittest.mock.rst
index c5360f9..4d74f9c 100644
--- a/Doc/library/unittest.mock.rst
+++ b/Doc/library/unittest.mock.rst
@@ -30,7 +30,7 @@
 some examples of how to use :class:`Mock`, :class:`MagicMock` and
 :func:`patch`.
 
-Mock is very easy to use and is designed for use with :mod:`unittest`. Mock
+Mock is designed for use with :mod:`unittest` and
 is based on the 'action -> assertion' pattern instead of 'record -> replay'
 used by many mocking frameworks.
 
@@ -262,9 +262,10 @@
       this is a new Mock (created on first access). See the
       :attr:`return_value` attribute.
 
-    * *unsafe*: By default if any attribute starts with *assert* or
-      *assret* will raise an :exc:`AttributeError`. Passing ``unsafe=True``
-      will allow access to these attributes.
+    * *unsafe*: By default, accessing any attribute with name starting with
+      *assert*, *assret*, *asert*, *aseert* or *assrt* will raise an
+      :exc:`AttributeError`. Passing ``unsafe=True`` will allow access to
+      these attributes.
 
       .. versionadded:: 3.5
 
@@ -327,8 +328,8 @@
 
     .. method:: assert_called_once_with(*args, **kwargs)
 
-       Assert that the mock was called exactly once and that that call was
-       with the specified arguments.
+       Assert that the mock was called exactly once and that call was with the
+       specified arguments.
 
             >>> mock = Mock(return_value=None)
             >>> mock('foo', bar='baz')
@@ -1515,7 +1516,7 @@
     >>> test()
     Traceback (most recent call last):
       ...
-    AttributeError: <module 'sys' (built-in)> does not have the attribute 'non_existing'
+    AttributeError: <module 'sys' (built-in)> does not have the attribute 'non_existing_attribute'
 
 but adding ``create=True`` in the call to :func:`patch` will make the previous example
 work as expected::
@@ -2207,7 +2208,7 @@
     >>> real.method.return_value = sentinel.some_object
     >>> result = real.method()
     >>> assert result is sentinel.some_object
-    >>> sentinel.some_object
+    >>> result
     sentinel.some_object
 
 
diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst
index 9fc6620..ae0c7d5 100644
--- a/Doc/library/unittest.rst
+++ b/Doc/library/unittest.rst
@@ -223,7 +223,7 @@
 
    Only run test methods and classes that match the pattern or substring.
    This option may be used multiple times, in which case all test cases that
-   match of the given patterns are included.
+   match any of the given patterns are included.
 
    Patterns that contain a wildcard character (``*``) are matched against the
    test name using :meth:`fnmatch.fnmatchcase`; otherwise simple case-sensitive
@@ -330,7 +330,10 @@
 the `load_tests protocol`_.
 
 .. versionchanged:: 3.4
-   Test discovery supports :term:`namespace packages <namespace package>`.
+   Test discovery supports :term:`namespace packages <namespace package>`
+   for the start directory. Note that you need to specify the top level
+   directory too (e.g.
+   ``python -m unittest discover -s root/namespace -t root``).
 
 
 .. _organizing-tests:
@@ -594,8 +597,9 @@
 .. decorator:: expectedFailure
 
    Mark the test as an expected failure or error.  If the test fails or errors
-   it will be considered a success.  If the test passes, it will be considered
-   a failure.
+   in the test function itself (rather than in one of the :dfn:`test fixture`
+   methods) then it will be considered a success.  If the test passes, it will
+   be considered a failure.
 
 .. exception:: SkipTest(reason)
 
@@ -950,6 +954,9 @@
    | :meth:`assertLogs(logger, level)                        | The ``with`` block logs on *logger*  | 3.4        |
    | <TestCase.assertLogs>`                                  | with minimum *level*                 |            |
    +---------------------------------------------------------+--------------------------------------+------------+
+   | :meth:`assertNoLogs(logger, level)                      | The ``with`` block does not log on   | 3.10       |
+   | <TestCase.assertNoLogs>`                                |  *logger* with minimum *level*       |            |
+   +---------------------------------------------------------+--------------------------------------+------------+
 
    .. method:: assertRaises(exception, callable, *args, **kwds)
                assertRaises(exception, *, msg=None)
@@ -1122,6 +1129,24 @@
 
       .. versionadded:: 3.4
 
+   .. method:: assertNoLogs(logger=None, level=None)
+
+      A context manager to test that no messages are logged on
+      the *logger* or one of its children, with at least the given
+      *level*.
+
+      If given, *logger* should be a :class:`logging.Logger` object or a
+      :class:`str` giving the name of a logger.  The default is the root
+      logger, which will catch all messages.
+
+      If given, *level* should be either a numeric logging level or
+      its string equivalent (for example either ``"ERROR"`` or
+      :attr:`logging.ERROR`).  The default is :attr:`logging.INFO`.
+
+      Unlike :meth:`assertLogs`, nothing will be returned by the context
+      manager.
+
+      .. versionadded:: 3.10
 
    There are also other methods used to perform more specific checks, such as:
 
@@ -1477,11 +1502,11 @@
       after :meth:`setUpClass` if :meth:`setUpClass` raises an exception.
 
       It is responsible for calling all the cleanup functions added by
-      :meth:`addCleanupClass`. If you need cleanup functions to be called
+      :meth:`addClassCleanup`. If you need cleanup functions to be called
       *prior* to :meth:`tearDownClass` then you can call
-      :meth:`doCleanupsClass` yourself.
+      :meth:`doClassCleanups` yourself.
 
-      :meth:`doCleanupsClass` pops methods off the stack of cleanup
+      :meth:`doClassCleanups` pops methods off the stack of cleanup
       functions one at a time, so it can be called at any time.
 
       .. versionadded:: 3.8
@@ -1849,11 +1874,15 @@
 
       .. versionchanged:: 3.4
          Modules that raise :exc:`SkipTest` on import are recorded as skips,
-           not errors.
-         Discovery works for :term:`namespace packages <namespace package>`.
-         Paths are sorted before being imported so that execution order is
-           the same even if the underlying file system's ordering is not
-           dependent on file name.
+         not errors.
+
+      .. versionchanged:: 3.4
+         *start_dir* can be a :term:`namespace packages <namespace package>`.
+
+      .. versionchanged:: 3.4
+         Paths are sorted before being imported so that execution order is the
+         same even if the underlying file system's ordering is not dependent
+         on file name.
 
       .. versionchanged:: 3.5
          Found packages are now checked for ``load_tests`` regardless of
diff --git a/Doc/library/urllib.parse.rst b/Doc/library/urllib.parse.rst
index 536cf95..1478b34 100644
--- a/Doc/library/urllib.parse.rst
+++ b/Doc/library/urllib.parse.rst
@@ -20,7 +20,7 @@
 combine the components back into a URL string, and to convert a "relative URL"
 to an absolute URL given a "base URL."
 
-The module has been designed to match the Internet RFC on Relative Uniform
+The module has been designed to match the internet RFC on Relative Uniform
 Resource Locators. It supports the following URL schemes: ``file``, ``ftp``,
 ``gopher``, ``hdl``, ``http``, ``https``, ``imap``, ``mailto``, ``mms``,
 ``news``, ``nntp``, ``prospero``, ``rsync``, ``rtsp``, ``rtspu``, ``sftp``,
@@ -48,17 +48,29 @@
    result, except for a leading slash in the *path* component, which is retained if
    present.  For example:
 
+   .. doctest::
+      :options: +NORMALIZE_WHITESPACE
+
       >>> from urllib.parse import urlparse
-      >>> o = urlparse('http://www.cwi.nl:80/%7Eguido/Python.html')
-      >>> o   # doctest: +NORMALIZE_WHITESPACE
-      ParseResult(scheme='http', netloc='www.cwi.nl:80', path='/%7Eguido/Python.html',
-                  params='', query='', fragment='')
+      >>> urlparse("scheme://netloc/path;parameters?query#fragment")
+      ParseResult(scheme='scheme', netloc='netloc', path='/path;parameters', params='',
+                  query='query', fragment='fragment')
+      >>> o = urlparse("http://docs.python.org:80/3/library/urllib.parse.html?"
+      ...              "highlight=params#url-parsing")
+      >>> o
+      ParseResult(scheme='http', netloc='docs.python.org:80',
+                  path='/3/library/urllib.parse.html', params='',
+                  query='highlight=params', fragment='url-parsing')
       >>> o.scheme
       'http'
+      >>> o.netloc
+      'docs.python.org:80'
+      >>> o.hostname
+      'docs.python.org'
       >>> o.port
       80
-      >>> o.geturl()
-      'http://www.cwi.nl:80/%7Eguido/Python.html'
+      >>> o._replace(fragment="").geturl()
+      'http://docs.python.org:80/3/library/urllib.parse.html?highlight=params'
 
    Following the syntax specifications in :rfc:`1808`, urlparse recognizes
    a netloc only if it is properly introduced by '//'.  Otherwise the
@@ -92,31 +104,30 @@
    The return value is a :term:`named tuple`, which means that its items can
    be accessed by index or as named attributes, which are:
 
-   +------------------+-------+--------------------------+----------------------+
-   | Attribute        | Index | Value                    | Value if not present |
-   +==================+=======+==========================+======================+
-   | :attr:`scheme`   | 0     | URL scheme specifier     | *scheme* parameter   |
-   +------------------+-------+--------------------------+----------------------+
-   | :attr:`netloc`   | 1     | Network location part    | empty string         |
-   +------------------+-------+--------------------------+----------------------+
-   | :attr:`path`     | 2     | Hierarchical path        | empty string         |
-   +------------------+-------+--------------------------+----------------------+
-   | :attr:`params`   | 3     | Parameters for last path | empty string         |
-   |                  |       | element                  |                      |
-   +------------------+-------+--------------------------+----------------------+
-   | :attr:`query`    | 4     | Query component          | empty string         |
-   +------------------+-------+--------------------------+----------------------+
-   | :attr:`fragment` | 5     | Fragment identifier      | empty string         |
-   +------------------+-------+--------------------------+----------------------+
-   | :attr:`username` |       | User name                | :const:`None`        |
-   +------------------+-------+--------------------------+----------------------+
-   | :attr:`password` |       | Password                 | :const:`None`        |
-   +------------------+-------+--------------------------+----------------------+
-   | :attr:`hostname` |       | Host name (lower case)   | :const:`None`        |
-   +------------------+-------+--------------------------+----------------------+
-   | :attr:`port`     |       | Port number as integer,  | :const:`None`        |
-   |                  |       | if present               |                      |
-   +------------------+-------+--------------------------+----------------------+
+   +------------------+-------+-------------------------+------------------------+
+   | Attribute        | Index | Value                   | Value if not present   |
+   +==================+=======+=========================+========================+
+   | :attr:`scheme`   | 0     | URL scheme specifier    | *scheme* parameter     |
+   +------------------+-------+-------------------------+------------------------+
+   | :attr:`netloc`   | 1     | Network location part   | empty string           |
+   +------------------+-------+-------------------------+------------------------+
+   | :attr:`path`     | 2     | Hierarchical path       | empty string           |
+   +------------------+-------+-------------------------+------------------------+
+   | :attr:`params`   | 3     | No longer used          | always an empty string |
+   +------------------+-------+-------------------------+------------------------+
+   | :attr:`query`    | 4     | Query component         | empty string           |
+   +------------------+-------+-------------------------+------------------------+
+   | :attr:`fragment` | 5     | Fragment identifier     | empty string           |
+   +------------------+-------+-------------------------+------------------------+
+   | :attr:`username` |       | User name               | :const:`None`          |
+   +------------------+-------+-------------------------+------------------------+
+   | :attr:`password` |       | Password                | :const:`None`          |
+   +------------------+-------+-------------------------+------------------------+
+   | :attr:`hostname` |       | Host name (lower case)  | :const:`None`          |
+   +------------------+-------+-------------------------+------------------------+
+   | :attr:`port`     |       | Port number as integer, | :const:`None`          |
+   |                  |       | if present              |                        |
+   +------------------+-------+-------------------------+------------------------+
 
    Reading the :attr:`port` attribute will raise a :exc:`ValueError` if
    an invalid port is specified in the URL.  See section
@@ -153,7 +164,7 @@
 
    .. versionchanged:: 3.3
       The fragment is now parsed for all URL schemes (unless *allow_fragment* is
-      false), in accordance with :rfc:`3986`.  Previously, a whitelist of
+      false), in accordance with :rfc:`3986`.  Previously, an allowlist of
       schemes that support fragments existed.
 
    .. versionchanged:: 3.6
@@ -165,7 +176,7 @@
       now raise :exc:`ValueError`.
 
 
-.. function:: parse_qs(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace', max_num_fields=None)
+.. function:: parse_qs(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace', max_num_fields=None, separator='&')
 
    Parse a query string given as a string argument (data of type
    :mimetype:`application/x-www-form-urlencoded`).  Data are returned as a
@@ -190,6 +201,9 @@
    read. If set, then throws a :exc:`ValueError` if there are more than
    *max_num_fields* fields read.
 
+   The optional argument *separator* is the symbol to use for separating the
+   query arguments. It defaults to ``&``.
+
    Use the :func:`urllib.parse.urlencode` function (with the ``doseq``
    parameter set to ``True``) to convert such dictionaries into query
    strings.
@@ -201,8 +215,14 @@
    .. versionchanged:: 3.8
       Added *max_num_fields* parameter.
 
+   .. versionchanged:: 3.10
+      Added *separator* parameter with the default value of ``&``. Python
+      versions earlier than Python 3.10 allowed using both ``;`` and ``&`` as
+      query parameter separator. This has been changed to allow only a single
+      separator key, with ``&`` as the default separator.
 
-.. function:: parse_qsl(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace', max_num_fields=None)
+
+.. function:: parse_qsl(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace', max_num_fields=None, separator='&')
 
    Parse a query string given as a string argument (data of type
    :mimetype:`application/x-www-form-urlencoded`).  Data are returned as a list of
@@ -226,6 +246,9 @@
    read. If set, then throws a :exc:`ValueError` if there are more than
    *max_num_fields* fields read.
 
+   The optional argument *separator* is the symbol to use for separating the
+   query arguments. It defaults to ``&``.
+
    Use the :func:`urllib.parse.urlencode` function to convert such lists of pairs into
    query strings.
 
@@ -235,6 +258,12 @@
    .. versionchanged:: 3.8
       Added *max_num_fields* parameter.
 
+   .. versionchanged:: 3.10
+      Added *separator* parameter with the default value of ``&``. Python
+      versions earlier than Python 3.10 allowed using both ``;`` and ``&`` as
+      query parameter separator. This has been changed to allow only a single
+      separator key, with ``&`` as the default separator.
+
 
 .. function:: urlunparse(parts)
 
@@ -294,6 +323,9 @@
    ``#``, ``@``, or ``:`` will raise a :exc:`ValueError`. If the URL is
    decomposed before parsing, no error will be raised.
 
+   Following the `WHATWG spec`_ that updates RFC 3986, ASCII newline
+   ``\n``, ``\r`` and tab ``\t`` characters are stripped from the URL.
+
    .. versionchanged:: 3.6
       Out-of-range port numbers now raise :exc:`ValueError`, instead of
       returning :const:`None`.
@@ -302,6 +334,10 @@
       Characters that affect netloc parsing under NFKC normalization will
       now raise :exc:`ValueError`.
 
+   .. versionchanged:: 3.10
+      ASCII newline and tab characters are stripped from the URL.
+
+.. _WHATWG spec: https://url.spec.whatwg.org/#concept-basic-url-parser
 
 .. function:: urlunsplit(parts)
 
@@ -656,6 +692,10 @@
 
 .. seealso::
 
+   `WHATWG`_ -  URL Living standard
+      Working Group for the URL Standard that defines URLs, domains, IP addresses, the
+      application/x-www-form-urlencoded format, and their API.
+
    :rfc:`3986` - Uniform Resource Identifiers
       This is the current standard (STD66). Any changes to urllib.parse module
       should conform to this. Certain deviations could be observed, which are
@@ -679,3 +719,5 @@
 
    :rfc:`1738` - Uniform Resource Locators (URL)
       This specifies the formal syntax and semantics of absolute URLs.
+
+.. _WHATWG: https://url.spec.whatwg.org/
diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst
index 785ecf8..659a363 100644
--- a/Doc/library/urllib.request.rst
+++ b/Doc/library/urllib.request.rst
@@ -109,6 +109,11 @@
    .. versionchanged:: 3.4.3
       *context* was added.
 
+   .. versionchanged:: 3.10
+      HTTPS connection now send an ALPN extension with protocol indicator
+      ``http/1.1`` when no *context* is given. Custom *context* should set
+      ALPN protocols with :meth:`~ssl.SSLContext.set_alpn_protocol`.
+
    .. deprecated:: 3.6
 
        *cafile*, *capath* and *cadefault* are deprecated in favor of *context*.
@@ -164,8 +169,8 @@
    This helper function returns a dictionary of scheme to proxy server URL
    mappings. It scans the environment for variables named ``<scheme>_proxy``,
    in a case insensitive approach, for all operating systems first, and when it
-   cannot find it, looks for proxy information from Mac OSX System
-   Configuration for Mac OS X and Windows Systems Registry for Windows.
+   cannot find it, looks for proxy information from System
+   Configuration for macOS and Windows Systems Registry for Windows.
    If both lowercase and uppercase environment variables exist (and disagree),
    lowercase is preferred.
 
@@ -298,8 +303,8 @@
    the list of proxies from the environment variables
    ``<protocol>_proxy``.  If no proxy environment variables are set, then
    in a Windows environment proxy settings are obtained from the registry's
-   Internet Settings section, and in a Mac OS X environment proxy information
-   is retrieved from the OS X System Configuration Framework.
+   Internet Settings section, and in a macOS environment proxy information
+   is retrieved from the System Configuration Framework.
 
    To disable autodetected proxy pass an empty dictionary.
 
@@ -650,7 +655,7 @@
    optional *timeout* parameter specifies a timeout in seconds for blocking
    operations like the connection attempt (if not specified, the global default
    timeout setting will be used). The timeout feature actually works only for
-   HTTP, HTTPS and FTP connections).
+   HTTP, HTTPS and FTP connections.
 
 
 .. method:: OpenerDirector.error(proto, *args)
@@ -1235,7 +1240,7 @@
 
     import urllib.request
     DATA = b'some data'
-    req = urllib.request.Request(url='http://localhost:8080', data=DATA,method='PUT')
+    req = urllib.request.Request(url='http://localhost:8080', data=DATA, method='PUT')
     with urllib.request.urlopen(req) as f:
         pass
     print(f.status)
@@ -1538,7 +1543,7 @@
 
 * The :func:`urlopen` and :func:`urlretrieve` functions can cause arbitrarily
   long delays while waiting for a network connection to be set up.  This means
-  that it is difficult to build an interactive Web client using these functions
+  that it is difficult to build an interactive web client using these functions
   without using threads.
 
   .. index::
diff --git a/Doc/library/urllib.robotparser.rst b/Doc/library/urllib.robotparser.rst
index 544f502..f063e46 100644
--- a/Doc/library/urllib.robotparser.rst
+++ b/Doc/library/urllib.robotparser.rst
@@ -19,7 +19,7 @@
 
 This module provides a single class, :class:`RobotFileParser`, which answers
 questions about whether or not a particular user agent can fetch a URL on the
-Web site that published the :file:`robots.txt` file.  For more details on the
+web site that published the :file:`robots.txt` file.  For more details on the
 structure of :file:`robots.txt` files, see http://www.robotstxt.org/orig.html.
 
 
diff --git a/Doc/library/uuid.rst b/Doc/library/uuid.rst
index 415e25b..ddfbbda 100644
--- a/Doc/library/uuid.rst
+++ b/Doc/library/uuid.rst
@@ -118,7 +118,7 @@
 
 .. attribute:: UUID.hex
 
-   The UUID as a 32-character hexadecimal string.
+   The UUID as a 32-character lowercase hexadecimal string.
 
 
 .. attribute:: UUID.int
diff --git a/Doc/library/venv.rst b/Doc/library/venv.rst
index 8abadc4..127a871 100644
--- a/Doc/library/venv.rst
+++ b/Doc/library/venv.rst
@@ -249,7 +249,8 @@
 There is also a module-level convenience function:
 
 .. function:: create(env_dir, system_site_packages=False, clear=False, \
-                     symlinks=False, with_pip=False, prompt=None)
+                     symlinks=False, with_pip=False, prompt=None, \
+                     upgrade_deps=False)
 
     Create an :class:`EnvBuilder` with the given keyword arguments, and call its
     :meth:`~EnvBuilder.create` method with the *env_dir* argument.
@@ -262,6 +263,9 @@
     .. versionchanged:: 3.6
        Added the ``prompt`` parameter
 
+    .. versionchanged:: 3.9
+       Added the ``upgrade_deps`` parameter
+
 An example of extending ``EnvBuilder``
 --------------------------------------
 
@@ -400,7 +404,7 @@
             :param context: The information for the virtual environment
                             creation request being processed.
             """
-            url = 'https://raw.github.com/pypa/pip/master/contrib/get-pip.py'
+            url = 'https://bootstrap.pypa.io/get-pip.py'
             self.install_script(context, 'pip', url)
 
     def main(args=None):
@@ -421,7 +425,7 @@
                                                          'more target '
                                                          'directories.')
             parser.add_argument('dirs', metavar='ENV_DIR', nargs='+',
-                                help='A directory in which to create the
+                                help='A directory in which to create the '
                                      'virtual environment.')
             parser.add_argument('--no-setuptools', default=False,
                                 action='store_true', dest='nodist',
diff --git a/Doc/library/warnings.rst b/Doc/library/warnings.rst
index a481a35..289b282 100644
--- a/Doc/library/warnings.rst
+++ b/Doc/library/warnings.rst
@@ -105,7 +105,7 @@
 |                                  | :class:`bytes` and :class:`bytearray`.        |
 +----------------------------------+-----------------------------------------------+
 | :exc:`ResourceWarning`           | Base category for warnings related to         |
-|                                  | resource usage.                               |
+|                                  | resource usage (ignored by default).          |
 +----------------------------------+-----------------------------------------------+
 
 .. versionchanged:: 3.7
@@ -229,7 +229,7 @@
     ignore::ImportWarning
     ignore::ResourceWarning
 
-In debug builds, the list of default warning filters is empty.
+In a :ref:`debug build <debug-build>`, the list of default warning filters is empty.
 
 .. versionchanged:: 3.2
    :exc:`DeprecationWarning` is now ignored by default in addition to
@@ -491,7 +491,7 @@
 Available Context Managers
 --------------------------
 
-.. class:: catch_warnings(\*, record=False, module=None)
+.. class:: catch_warnings(*, record=False, module=None)
 
     A context manager that copies and, upon exit, restores the warnings filter
     and the :func:`showwarning` function.
diff --git a/Doc/library/weakref.rst b/Doc/library/weakref.rst
index d3c3a07..4b0945c 100644
--- a/Doc/library/weakref.rst
+++ b/Doc/library/weakref.rst
@@ -88,6 +88,10 @@
 Extension types can easily be made to support weak references; see
 :ref:`weakref-support`.
 
+When ``__slots__`` are defined for a given type, weak reference support is
+disabled unless a ``'__weakref__'`` string is also present in the sequence of
+strings in the ``__slots__`` declaration.
+See :ref:`__slots__ documentation <slots>` for details.
 
 .. class:: ref(object[, callback])
 
@@ -382,7 +386,7 @@
 
    class ExtendedRef(weakref.ref):
        def __init__(self, ob, callback=None, /, **annotations):
-           super(ExtendedRef, self).__init__(ob, callback)
+           super().__init__(ob, callback)
            self.__counter = 0
            for k, v in annotations.items():
                setattr(self, k, v)
@@ -391,7 +395,7 @@
            """Return a pair containing the referent and the number of
            times the reference has been called.
            """
-           ob = super(ExtendedRef, self).__call__()
+           ob = super().__call__()
            if ob is not None:
                self.__counter += 1
                ob = (ob, self.__counter)
diff --git a/Doc/library/webbrowser.rst b/Doc/library/webbrowser.rst
index b7bfb65..c099088 100644
--- a/Doc/library/webbrowser.rst
+++ b/Doc/library/webbrowser.rst
@@ -1,8 +1,8 @@
-:mod:`webbrowser` --- Convenient Web-browser controller
+:mod:`webbrowser` --- Convenient web-browser controller
 =======================================================
 
 .. module:: webbrowser
-   :synopsis: Easy-to-use controller for Web browsers.
+   :synopsis: Easy-to-use controller for web browsers.
 
 .. moduleauthor:: Fred L. Drake, Jr. <fdrake@acm.org>
 .. sectionauthor:: Fred L. Drake, Jr. <fdrake@acm.org>
@@ -12,7 +12,7 @@
 --------------
 
 The :mod:`webbrowser` module provides a high-level interface to allow displaying
-Web-based documents to users. Under most circumstances, simply calling the
+web-based documents to users. Under most circumstances, simply calling the
 :func:`.open` function from this module will do the right thing.
 
 Under Unix, graphical browsers are preferred under X11, but text-mode browsers
@@ -39,7 +39,7 @@
 ``-t`` opens the URL in a new browser page ("tab"). The options are,
 naturally, mutually exclusive.  Usage example::
 
-   python -m webbrowser -t "http://www.python.org"
+   python -m webbrowser -t "https://www.python.org"
 
 The following exception is defined:
 
@@ -143,9 +143,9 @@
 +------------------------+-----------------------------------------+-------+
 | ``'windows-default'``  | :class:`WindowsDefault`                 | \(2)  |
 +------------------------+-----------------------------------------+-------+
-| ``'macosx'``           | :class:`MacOSX('default')`              | \(3)  |
+| ``'macosx'``           | :class:`MacOSXOSAScript('default')`     | \(3)  |
 +------------------------+-----------------------------------------+-------+
-| ``'safari'``           | :class:`MacOSX('safari')`               | \(3)  |
+| ``'safari'``           | :class:`MacOSXOSAScript('safari')`      | \(3)  |
 +------------------------+-----------------------------------------+-------+
 | ``'google-chrome'``    | :class:`Chrome('google-chrome')`        |       |
 +------------------------+-----------------------------------------+-------+
@@ -169,14 +169,14 @@
    Only on Windows platforms.
 
 (3)
-   Only on Mac OS X platform.
+   Only on macOS platform.
 
 .. versionadded:: 3.3
    Support for Chrome/Chromium has been added.
 
 Here are some simple examples::
 
-   url = 'http://docs.python.org/'
+   url = 'https://docs.python.org/'
 
    # Open URL in a new tab, if a browser window is already open.
    webbrowser.open_new_tab(url)
diff --git a/Doc/library/winreg.rst b/Doc/library/winreg.rst
index dccb7db..487856a 100644
--- a/Doc/library/winreg.rst
+++ b/Doc/library/winreg.rst
@@ -791,7 +791,7 @@
 
 
 .. method:: PyHKEY.__enter__()
-            PyHKEY.__exit__(\*exc_info)
+            PyHKEY.__exit__(*exc_info)
 
    The HKEY object implements :meth:`~object.__enter__` and
    :meth:`~object.__exit__` and thus supports the context protocol for the
diff --git a/Doc/library/xml.dom.minidom.rst b/Doc/library/xml.dom.minidom.rst
index bf72c46..20984b9 100644
--- a/Doc/library/xml.dom.minidom.rst
+++ b/Doc/library/xml.dom.minidom.rst
@@ -145,7 +145,7 @@
    For the :class:`Document` node, an additional keyword argument *encoding* can
    be used to specify the encoding field of the XML header.
 
-   Silimarly, explicitly stating the *standalone* argument causes the
+   Similarly, explicitly stating the *standalone* argument causes the
    standalone document declarations to be added to the prologue of the XML
    document.
    If the value is set to `True`, `standalone="yes"` is added,
@@ -156,6 +156,9 @@
       The :meth:`writexml` method now preserves the attribute order specified
       by the user.
 
+   .. versionchanged:: 3.9
+      The *standalone* parameter was added.
+
 .. method:: Node.toxml(encoding=None, standalone=None)
 
    Return a string or byte string containing the XML represented by
@@ -174,6 +177,9 @@
       The :meth:`toxml` method now preserves the attribute order specified
       by the user.
 
+   .. versionchanged:: 3.9
+      The *standalone* parameter was added.
+
 .. method:: Node.toprettyxml(indent="\\t", newl="\\n", encoding=None, \
                              standalone=None)
 
@@ -190,6 +196,8 @@
       The :meth:`toprettyxml` method now preserves the attribute order specified
       by the user.
 
+   .. versionchanged:: 3.9
+      The *standalone* parameter was added.
 
 .. _dom-example:
 
diff --git a/Doc/library/xml.dom.rst b/Doc/library/xml.dom.rst
index 98454e1..b387240 100644
--- a/Doc/library/xml.dom.rst
+++ b/Doc/library/xml.dom.rst
@@ -73,7 +73,7 @@
    `Document Object Model (DOM) Level 1 Specification <https://www.w3.org/TR/REC-DOM-Level-1/>`_
       The W3C recommendation for the DOM supported by :mod:`xml.dom.minidom`.
 
-   `Python Language Mapping Specification <http://www.omg.org/cgi-bin/doc?formal/02-11-05.pdf>`_
+   `Python Language Mapping Specification <https://www.omg.org/spec/PYTH/1.2/PDF>`_
       This specifies the mapping from OMG IDL to Python.
 
 
diff --git a/Doc/library/xml.etree.elementtree.rst b/Doc/library/xml.etree.elementtree.rst
index f4bccf6..87f4ee3 100644
--- a/Doc/library/xml.etree.elementtree.rst
+++ b/Doc/library/xml.etree.elementtree.rst
@@ -455,6 +455,12 @@
 |                       | has the given value.  The value cannot contain       |
 |                       | quotes.                                              |
 +-----------------------+------------------------------------------------------+
+| ``[@attrib!='value']``| Selects all elements for which the given attribute   |
+|                       | does not have the given value. The value cannot      |
+|                       | contain quotes.                                      |
+|                       |                                                      |
+|                       | .. versionadded:: 3.10                               |
++-----------------------+------------------------------------------------------+
 | ``[tag]``             | Selects all elements that have a child named         |
 |                       | ``tag``.  Only immediate children are supported.     |
 +-----------------------+------------------------------------------------------+
@@ -463,10 +469,22 @@
 |                       |                                                      |
 |                       | .. versionadded:: 3.7                                |
 +-----------------------+------------------------------------------------------+
+| ``[.!='text']``       | Selects all elements whose complete text content,    |
+|                       | including descendants, does not equal the given      |
+|                       | ``text``.                                            |
+|                       |                                                      |
+|                       | .. versionadded:: 3.10                               |
++-----------------------+------------------------------------------------------+
 | ``[tag='text']``      | Selects all elements that have a child named         |
 |                       | ``tag`` whose complete text content, including       |
 |                       | descendants, equals the given ``text``.              |
 +-----------------------+------------------------------------------------------+
+| ``[tag!='text']``     | Selects all elements that have a child named         |
+|                       | ``tag`` whose complete text content, including       |
+|                       | descendants, does not equal the given ``text``.      |
+|                       |                                                      |
+|                       | .. versionadded:: 3.10                               |
++-----------------------+------------------------------------------------------+
 | ``[position]``        | Selects all elements that are located at the given   |
 |                       | position.  The position can be either an integer     |
 |                       | (1 is the first position), the expression ``last()`` |
diff --git a/Doc/library/xml.rst b/Doc/library/xml.rst
index 1981cab..e3b3516 100644
--- a/Doc/library/xml.rst
+++ b/Doc/library/xml.rst
@@ -60,22 +60,26 @@
 The following table gives an overview of the known attacks and whether
 the various modules are vulnerable to them.
 
-=========================  ==============   ===============   ==============   ==============   ==============
-kind                       sax              etree             minidom          pulldom          xmlrpc
-=========================  ==============   ===============   ==============   ==============   ==============
-billion laughs             **Vulnerable**   **Vulnerable**    **Vulnerable**   **Vulnerable**   **Vulnerable**
-quadratic blowup           **Vulnerable**   **Vulnerable**    **Vulnerable**   **Vulnerable**   **Vulnerable**
-external entity expansion  Safe (4)         Safe    (1)       Safe    (2)      Safe (4)         Safe    (3)
-`DTD`_ retrieval           Safe (4)         Safe              Safe             Safe (4)         Safe
-decompression bomb         Safe             Safe              Safe             Safe             **Vulnerable**
-=========================  ==============   ===============   ==============   ==============   ==============
+=========================  ==================  ==================  ==================  ==================  ==================
+kind                       sax                 etree               minidom             pulldom             xmlrpc
+=========================  ==================  ==================  ==================  ==================  ==================
+billion laughs             **Vulnerable** (1)  **Vulnerable** (1)  **Vulnerable** (1)  **Vulnerable** (1)  **Vulnerable** (1)
+quadratic blowup           **Vulnerable** (1)  **Vulnerable** (1)  **Vulnerable** (1)  **Vulnerable** (1)  **Vulnerable** (1)
+external entity expansion  Safe (5)            Safe (2)            Safe (3)            Safe (5)            Safe (4)
+`DTD`_ retrieval           Safe (5)            Safe                Safe                Safe (5)            Safe
+decompression bomb         Safe                Safe                Safe                Safe                **Vulnerable**
+=========================  ==================  ==================  ==================  ==================  ==================
 
-1. :mod:`xml.etree.ElementTree` doesn't expand external entities and raises a
+1. Expat 2.4.1 and newer is not vulnerable to the "billion laughs" and
+   "quadratic blowup" vulnerabilities. Items still listed as vulnerable due to
+   potential reliance on system-provided libraries. Check
+   :data:`pyexpat.EXPAT_VERSION`.
+2. :mod:`xml.etree.ElementTree` doesn't expand external entities and raises a
    :exc:`ParserError` when an entity occurs.
-2. :mod:`xml.dom.minidom` doesn't expand external entities and simply returns
+3. :mod:`xml.dom.minidom` doesn't expand external entities and simply returns
    the unexpanded entity verbatim.
-3. :mod:`xmlrpclib` doesn't expand external entities and omits them.
-4. Since Python 3.7.1, external general entities are no longer processed by
+4. :mod:`xmlrpclib` doesn't expand external entities and omits them.
+5. Since Python 3.7.1, external general entities are no longer processed by
    default.
 
 
diff --git a/Doc/library/xml.sax.handler.rst b/Doc/library/xml.sax.handler.rst
index ae0877c..59d0d1b 100644
--- a/Doc/library/xml.sax.handler.rst
+++ b/Doc/library/xml.sax.handler.rst
@@ -11,12 +11,12 @@
 
 --------------
 
-The SAX API defines four kinds of handlers: content handlers, DTD handlers,
-error handlers, and entity resolvers. Applications normally only need to
-implement those interfaces whose events they are interested in; they can
-implement the interfaces in a single object or in multiple objects. Handler
-implementations should inherit from the base classes provided in the module
-:mod:`xml.sax.handler`, so that all methods get default implementations.
+The SAX API defines five kinds of handlers: content handlers, DTD handlers,
+error handlers, entity resolvers and lexical handlers. Applications normally
+only need to implement those interfaces whose events they are interested in;
+they can implement the interfaces in a single object or in multiple objects.
+Handler implementations should inherit from the base classes provided in the
+module :mod:`xml.sax.handler`, so that all methods get default implementations.
 
 
 .. class:: ContentHandler
@@ -47,6 +47,12 @@
    application.  The methods of this object control whether errors are immediately
    converted to exceptions or are handled in some other way.
 
+
+.. class:: LexicalHandler
+
+   Interface used by the parser to represent low frequency events which may not
+   be of interest to many applications.
+
 In addition to these classes, :mod:`xml.sax.handler` provides symbolic constants
 for the feature and property names.
 
@@ -114,7 +120,7 @@
 .. data:: property_lexical_handler
 
    | value: ``"http://xml.org/sax/properties/lexical-handler"``
-   | data type: xml.sax.sax2lib.LexicalHandler (not supported in Python 2)
+   | data type: xml.sax.handler.LexicalHandler (not supported in Python 2)
    | description: An optional extension handler for lexical events like
      comments.
    | access: read/write
@@ -413,3 +419,45 @@
    information will continue to be passed to the application. Raising an exception
    in this method will cause parsing to end.
 
+
+.. _lexical-handler-objects:
+
+LexicalHandler Objects
+----------------------
+Optional SAX2 handler for lexical events.
+
+This handler is used to obtain lexical information about an XML
+document. Lexical information includes information describing the
+document encoding used and XML comments embedded in the document, as
+well as section boundaries for the DTD and for any CDATA sections.
+The lexical handlers are used in the same manner as content handlers.
+
+Set the LexicalHandler of an XMLReader by using the setProperty method
+with the property identifier
+``'http://xml.org/sax/properties/lexical-handler'``.
+
+
+.. method:: LexicalHandler.comment(content)
+
+   Reports a comment anywhere in the document (including the DTD and
+   outside the document element).
+
+.. method:: LexicalHandler.startDTD(name, public_id, system_id)
+
+   Reports the start of the DTD declarations if the document has an
+   associated DTD.
+
+.. method:: LexicalHandler.endDTD()
+
+   Reports the end of DTD declaration.
+
+.. method:: LexicalHandler.startCDATA()
+
+   Reports the start of a CDATA marked section.
+
+   The contents of the CDATA marked section will be reported through
+   the characters handler.
+
+.. method:: LexicalHandler.endCDATA()
+
+   Reports the end of a CDATA marked section.
diff --git a/Doc/library/xmlrpc.client.rst b/Doc/library/xmlrpc.client.rst
index 3240381..51279b3 100644
--- a/Doc/library/xmlrpc.client.rst
+++ b/Doc/library/xmlrpc.client.rst
@@ -378,7 +378,7 @@
 
    .. attribute:: faultCode
 
-      A string indicating the fault type.
+      An int indicating the fault type.
 
 
    .. attribute:: faultString
diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst
index 7126d8b..43520b6 100644
--- a/Doc/library/zipfile.rst
+++ b/Doc/library/zipfile.rst
@@ -78,7 +78,6 @@
    of the last modification to the file; the fields are described in section
    :ref:`zipinfo-objects`.
 
-
 .. function:: is_zipfile(filename)
 
    Returns ``True`` if *filename* is a valid ZIP file based on its magic number,
@@ -406,6 +405,11 @@
       If ``arcname`` (or ``filename``, if ``arcname`` is  not given) contains a null
       byte, the name of the file in the archive will be truncated at the null byte.
 
+   .. note::
+
+      A leading slash in the filename may lead to the archive being impossible to
+      open in some zip programs on Windows systems.
+
    .. versionchanged:: 3.6
       Calling :meth:`write` on a ZipFile created with mode ``'r'`` or
       a closed ZipFile will raise a :exc:`ValueError`.  Previously,
@@ -483,7 +487,7 @@
 Path objects expose the following features of :mod:`pathlib.Path`
 objects:
 
-Path objects are traversable using the ``/`` operator.
+Path objects are traversable using the ``/`` operator or ``joinpath``.
 
 .. attribute:: Path.name
 
@@ -532,6 +536,19 @@
 
    Read the current file as bytes.
 
+.. method:: Path.joinpath(*other)
+
+   Return a new Path object with each of the *other* arguments
+   joined. The following are equivalent::
+
+   >>> Path(...).joinpath('child').joinpath('grandchild')
+   >>> Path(...).joinpath('child', 'grandchild')
+   >>> Path(...) / 'child' / 'grandchild'
+
+   .. versionchanged:: 3.10
+      Prior to 3.10, ``joinpath`` was undocumented and accepted
+      exactly one parameter.
+
 
 .. _pyzipfile-objects:
 
@@ -844,6 +861,8 @@
 Such as allowable characters in the directory entries, length of the file name,
 length of the pathname, size of a single file, and number of files, etc.
 
+.. _zipfile-resources-limitations:
+
 Resources limitations
 ~~~~~~~~~~~~~~~~~~~~~
 
diff --git a/Doc/library/zipimport.rst b/Doc/library/zipimport.rst
index 8ac3fb1..fe1adca 100644
--- a/Doc/library/zipimport.rst
+++ b/Doc/library/zipimport.rst
@@ -23,8 +23,8 @@
 subdirectory.  For example, the path :file:`example.zip/lib/` would only
 import from the :file:`lib/` subdirectory within the archive.
 
-Any files may be present in the ZIP archive, but only files :file:`.py` and
-:file:`.pyc` are available for import.  ZIP import of dynamic modules
+Any files may be present in the ZIP archive, but importers are only invoked for
+:file:`.py` and :file:`.pyc` files.  ZIP import of dynamic modules
 (:file:`.pyd`, :file:`.so`) is disallowed. Note that if an archive only contains
 :file:`.py` files, Python will not attempt to modify the archive by adding the
 corresponding :file:`.pyc` file, meaning that if a ZIP archive
@@ -44,8 +44,9 @@
       follows the specification in :pep:`273`, but uses an implementation written by Just
       van Rossum that uses the import hooks described in :pep:`302`.
 
-   :pep:`302` - New Import Hooks
-      The PEP to add the import hooks that help this module work.
+   :mod:`importlib` - The implementation of the import machinery
+      Package providing the relevant protocols for all importers to
+      implement.
 
 
 This module defines an exception:
@@ -73,7 +74,31 @@
    :exc:`ZipImportError` is raised if *archivepath* doesn't point to a valid ZIP
    archive.
 
-   .. method:: find_module(fullname[, path])
+   .. method:: create_module(spec)
+
+      Implementation of :meth:`importlib.abc.Loader.create_module` that returns
+      :const:`None` to explicitly request the default semantics.
+
+      .. versionadded:: 3.10
+
+
+   .. method:: exec_module(module)
+
+      Implementation of :meth:`importlib.abc.Loader.exec_module`.
+
+      .. versionadded:: 3.10
+
+
+   .. method:: find_loader(fullname, path=None)
+
+      An implementation of :meth:`importlib.abc.PathEntryFinder.find_loader`.
+
+      .. deprecated:: 3.10
+
+         Use :meth:`find_spec` instead.
+
+
+   .. method:: find_module(fullname, path=None)
 
       Search for a module specified by *fullname*. *fullname* must be the fully
       qualified (dotted) module name. It returns the zipimporter instance itself
@@ -81,11 +106,22 @@
       *path* argument is ignored---it's there for compatibility with the
       importer protocol.
 
+      .. deprecated:: 3.10
+
+         Use :meth:`find_spec` instead.
+
+
+   .. method:: find_spec(fullname, target=None)
+
+      An implementation of :meth:`importlib.abc.PathEntryFinder.find_spec`.
+
+      .. versionadded:: 3.10
+
 
    .. method:: get_code(fullname)
 
       Return the code object for the specified module. Raise
-      :exc:`ZipImportError` if the module couldn't be found.
+      :exc:`ZipImportError` if the module couldn't be imported.
 
 
    .. method:: get_data(pathname)
@@ -101,7 +137,7 @@
 
       Return the value ``__file__`` would be set to if the specified module
       was imported. Raise :exc:`ZipImportError` if the module couldn't be
-      found.
+      imported.
 
       .. versionadded:: 3.1
 
@@ -123,8 +159,20 @@
    .. method:: load_module(fullname)
 
       Load the module specified by *fullname*. *fullname* must be the fully
-      qualified (dotted) module name. It returns the imported module, or raises
-      :exc:`ZipImportError` if it wasn't found.
+      qualified (dotted) module name. Returns the imported module on success,
+      raises :exc:`ZipImportError` on failure.
+
+      .. deprecated:: 3.10
+
+         Use :meth:`exec_module` instead.
+
+
+   .. method:: invalidate_caches()
+
+      Clear out the internal cache of information about files found within
+      the ZIP archive.
+
+      .. versionadded:: 3.10
 
 
    .. attribute:: archive
diff --git a/Doc/library/zoneinfo.rst b/Doc/library/zoneinfo.rst
index 3a4c12a..1b2ba2a 100644
--- a/Doc/library/zoneinfo.rst
+++ b/Doc/library/zoneinfo.rst
@@ -124,8 +124,9 @@
 locations for time zone data). On POSIX systems, downstream distributors and
 those building Python from source who know where their system
 time zone data is deployed may change the default time zone path by specifying
-the compile-time option ``TZPATH`` (or, more likely, the ``configure`` flag
-``--with-tzpath``), which should be a string delimited by :data:`os.pathsep`.
+the compile-time option ``TZPATH`` (or, more likely, the :option:`configure
+flag --with-tzpath <--with-tzpath>`), which should be a string delimited by
+:data:`os.pathsep`.
 
 On all platforms, the configured value is available as the ``TZPATH`` key in
 :func:`sysconfig.get_config_var`.
diff --git a/Doc/license.rst b/Doc/license.rst
index 4030825..e0ca5f2 100644
--- a/Doc/license.rst
+++ b/Doc/license.rst
@@ -100,7 +100,7 @@
       analyze, test, perform and/or display publicly, prepare derivative works,
       distribute, and otherwise use Python |release| alone or in any derivative
       version, provided, however, that PSF's License Agreement and PSF's notice of
-      copyright, i.e., "Copyright © 2001-2020 Python Software Foundation; All Rights
+      copyright, i.e., "Copyright © 2001-2022 Python Software Foundation; All Rights
       Reserved" are retained in Python |release| alone or in any derivative version
       prepared by Licensee.
 
@@ -203,9 +203,9 @@
       Licensee may substitute the following text (omitting the quotes): "Python 1.6.1
       is made available subject to the terms and conditions in CNRI's License
       Agreement.  This Agreement together with Python 1.6.1 may be located on the
-      Internet using the following unique, persistent identifier (known as a handle):
+      internet using the following unique, persistent identifier (known as a handle):
       1895.22/1013.  This Agreement may also be obtained from a proxy server on the
-      Internet using the following URL: http://hdl.handle.net/1895.22/1013."
+      internet using the following URL: http://hdl.handle.net/1895.22/1013."
 
    3. In the event Licensee prepares a derivative work that is based on or
       incorporates Python 1.6.1 or any part thereof, and wants to make the derivative
@@ -655,7 +655,7 @@
 
 The modules :mod:`hashlib`, :mod:`posix`, :mod:`ssl`, :mod:`crypt` use
 the OpenSSL library for added performance if made available by the
-operating system. Additionally, the Windows and Mac OS X installers for
+operating system. Additionally, the Windows and macOS installers for
 Python may include a copy of the OpenSSL libraries, so we include a copy
 of the OpenSSL license here::
 
@@ -955,7 +955,7 @@
 The C14N 2.0 test suite in the :mod:`test` package
 (``Lib/test/xmltestdata/c14n-20/``) was retrieved from the W3C website at
 https://www.w3.org/TR/xml-c14n2-testcases/ and is distributed under the
-3-clause BSD license:
+3-clause BSD license::
 
    Copyright (c) 2013 W3C(R) (MIT, ERCIM, Keio, Beihang),
    All Rights Reserved.
diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst
index b4e06e5..7f37bb4 100644
--- a/Doc/reference/compound_stmts.rst
+++ b/Doc/reference/compound_stmts.rst
@@ -51,6 +51,7 @@
                 : | `for_stmt`
                 : | `try_stmt`
                 : | `with_stmt`
+                : | `match_stmt`
                 : | `funcdef`
                 : | `classdef`
                 : | `async_with_stmt`
@@ -195,27 +196,6 @@
 emulate the effect of Pascal's ``for i := a to b do``; e.g., ``list(range(3))``
 returns the list ``[0, 1, 2]``.
 
-.. note::
-
-   .. index::
-      single: loop; over mutable sequence
-      single: mutable sequence; loop over
-
-   There is a subtlety when the sequence is being modified by the loop (this can
-   only occur for mutable sequences, e.g. lists).  An internal counter is used
-   to keep track of which item is used next, and this is incremented on each
-   iteration.  When this counter has reached the length of the sequence the loop
-   terminates.  This means that if the suite deletes the current (or a previous)
-   item from the sequence, the next item will be skipped (since it gets the
-   index of the current item which has already been treated).  Likewise, if the
-   suite inserts an item in the sequence before the current item, the current
-   item will be treated again the next time through the loop. This can lead to
-   nasty bugs that can be avoided by making a temporary copy using a slice of
-   the whole sequence, e.g., ::
-
-      for x in a[:]:
-          if x < 0: a.remove(x)
-
 
 .. _try:
 .. _except:
@@ -254,7 +234,8 @@
 expression, that expression is evaluated, and the clause matches the exception
 if the resulting object is "compatible" with the exception.  An object is
 compatible with an exception if it is the class or a base class of the exception
-object or a tuple containing an item compatible with the exception.
+object, or a tuple containing an item that is the class or a base class of
+the exception object.
 
 If no except clause matches the exception, the search for an exception handler
 continues in the surrounding code and on the invocation stack.  [#]_
@@ -301,9 +282,27 @@
 stored in the :mod:`sys` module and can be accessed via :func:`sys.exc_info`.
 :func:`sys.exc_info` returns a 3-tuple consisting of the exception class, the
 exception instance and a traceback object (see section :ref:`types`) identifying
-the point in the program where the exception occurred.  :func:`sys.exc_info`
-values are restored to their previous values (before the call) when returning
-from a function that handled an exception.
+the point in the program where the exception occurred.  The details about the
+exception accessed via :func:`sys.exc_info` are restored to their previous values
+when leaving an exception handler::
+
+   >>> print(sys.exc_info())
+   (None, None, None)
+   >>> try:
+   ...     raise TypeError
+   ... except:
+   ...     print(sys.exc_info())
+   ...     try:
+   ...          raise ValueError
+   ...     except:
+   ...         print(sys.exc_info())
+   ...     print(sys.exc_info())
+   ...
+   (<class 'TypeError'>, TypeError(), <traceback object at 0x10efad080>)
+   (<class 'ValueError'>, ValueError(), <traceback object at 0x10efad040>)
+   (<class 'TypeError'>, TypeError(), <traceback object at 0x10efad080>)
+   >>> print(sys.exc_info())
+   (None, None, None)
 
 .. index::
    keyword: else
@@ -392,13 +391,14 @@
 usage patterns to be encapsulated for convenient reuse.
 
 .. productionlist:: python-grammar
-   with_stmt: "with" `with_item` ("," `with_item`)* ":" `suite`
+   with_stmt: "with" ( "(" `with_stmt_contents` ","? ")" | `with_stmt_contents` ) ":" `suite`
+   with_stmt_contents: `with_item` ("," `with_item`)*
    with_item: `expression` ["as" `target`]
 
 The execution of the :keyword:`with` statement with one "item" proceeds as follows:
 
-#. The context expression (the expression given in the :token:`with_item`) is
-   evaluated to obtain a context manager.
+#. The context expression (the expression given in the
+   :token:`~python-grammar:with_item`) is evaluated to obtain a context manager.
 
 #. The context manager's :meth:`__enter__` is loaded for later use.
 
@@ -469,15 +469,626 @@
        with B() as b:
            SUITE
 
+You can also write multi-item context managers in multiple lines if
+the items are surrounded by parentheses. For example::
+
+   with (
+       A() as a,
+       B() as b,
+   ):
+       SUITE
+
 .. versionchanged:: 3.1
    Support for multiple context expressions.
 
+.. versionchanged:: 3.10
+   Support for using grouping parentheses to break the statement in multiple lines.
+
 .. seealso::
 
    :pep:`343` - The "with" statement
       The specification, background, and examples for the Python :keyword:`with`
       statement.
 
+.. _match:
+
+The :keyword:`!match` statement
+===============================
+
+.. index::
+   ! statement: match
+   ! keyword: case
+   ! single: pattern matching
+   keyword: if
+   keyword: as
+   pair: match; case
+   single: : (colon); compound statement
+
+.. versionadded:: 3.10
+
+The match statement is used for pattern matching.  Syntax:
+
+.. productionlist:: python-grammar
+   match_stmt: 'match' `subject_expr` ":" NEWLINE INDENT `case_block`+ DEDENT
+   subject_expr: `star_named_expression` "," `star_named_expressions`?
+               : | `named_expression`
+   case_block: 'case' `patterns` [`guard`] ":" `block`
+
+.. note::
+   This section uses single quotes to denote
+   :ref:`soft keywords <soft-keywords>`.
+
+Pattern matching takes a pattern as input (following ``case``) and a subject
+value (following ``match``).  The pattern (which may contain subpatterns) is
+matched against the subject value.  The outcomes are:
+
+* A match success or failure (also termed a pattern success or failure).
+
+* Possible binding of matched values to a name.  The prerequisites for this are
+  further discussed below.
+
+The ``match`` and ``case`` keywords are :ref:`soft keywords <soft-keywords>`.
+
+.. seealso::
+
+   * :pep:`634` -- Structural Pattern Matching: Specification
+   * :pep:`636` -- Structural Pattern Matching: Tutorial
+
+
+Overview
+--------
+
+Here's an overview of the logical flow of a match statement:
+
+
+#. The subject expression ``subject_expr`` is evaluated and a resulting subject
+   value obtained. If the subject expression contains a comma, a tuple is
+   constructed using :ref:`the standard rules <typesseq-tuple>`.
+
+#. Each pattern in a ``case_block`` is attempted to match with the subject value. The
+   specific rules for success or failure are described below. The match attempt can also
+   bind some or all of the standalone names within the pattern. The precise
+   pattern binding rules vary per pattern type and are
+   specified below.  **Name bindings made during a successful pattern match
+   outlive the executed block and can be used after the match statement**.
+
+      .. note::
+
+         During failed pattern matches, some subpatterns may succeed.  Do not
+         rely on bindings being made for a failed match.  Conversely, do not
+         rely on variables remaining unchanged after a failed match.  The exact
+         behavior is dependent on implementation and may vary.  This is an
+         intentional decision made to allow different implementations to add
+         optimizations.
+
+#. If the pattern succeeds, the corresponding guard (if present) is evaluated. In
+   this case all name bindings are guaranteed to have happened.
+
+   * If the guard evaluates as true or is missing, the ``block`` inside
+     ``case_block`` is executed.
+
+   * Otherwise, the next ``case_block`` is attempted as described above.
+
+   * If there are no further case blocks, the match statement is completed.
+
+.. note::
+
+   Users should generally never rely on a pattern being evaluated.  Depending on
+   implementation, the interpreter may cache values or use other optimizations
+   which skip repeated evaluations.
+
+A sample match statement::
+
+   >>> flag = False
+   >>> match (100, 200):
+   ...    case (100, 300):  # Mismatch: 200 != 300
+   ...        print('Case 1')
+   ...    case (100, 200) if flag:  # Successful match, but guard fails
+   ...        print('Case 2')
+   ...    case (100, y):  # Matches and binds y to 200
+   ...        print(f'Case 3, y: {y}')
+   ...    case _:  # Pattern not attempted
+   ...        print('Case 4, I match anything!')
+   ...
+   Case 3, y: 200
+
+
+In this case, ``if flag`` is a guard.  Read more about that in the next section.
+
+Guards
+------
+
+.. index:: ! guard
+
+.. productionlist:: python-grammar
+   guard: "if" `named_expression`
+
+A ``guard`` (which is part of the ``case``) must succeed for code inside
+the ``case`` block to execute.  It takes the form: :keyword:`if` followed by an
+expression.
+
+
+The logical flow of a ``case`` block with a ``guard`` follows:
+
+#. Check that the pattern in the ``case`` block succeeded.  If the pattern
+   failed, the ``guard`` is not evaluated and the next ``case`` block is
+   checked.
+
+#. If the pattern succeeded, evaluate the ``guard``.
+
+   * If the ``guard`` condition evaluates as true, the case block is
+     selected.
+
+   * If the ``guard`` condition evaluates as false, the case block is not
+     selected.
+
+   * If the ``guard`` raises an exception during evaluation, the exception
+     bubbles up.
+
+Guards are allowed to have side effects as they are expressions.  Guard
+evaluation must proceed from the first to the last case block, one at a time,
+skipping case blocks whose pattern(s) don't all succeed. (I.e.,
+guard evaluation must happen in order.) Guard evaluation must stop once a case
+block is selected.
+
+
+.. _irrefutable_case:
+
+Irrefutable Case Blocks
+-----------------------
+
+.. index:: irrefutable case block, case block
+
+An irrefutable case block is a match-all case block.  A match statement may have
+at most one irrefutable case block, and it must be last.
+
+A case block is considered irrefutable if it has no guard and its pattern is
+irrefutable.  A pattern is considered irrefutable if we can prove from its
+syntax alone that it will always succeed.  Only the following patterns are
+irrefutable:
+
+* :ref:`as-patterns` whose left-hand side is irrefutable
+
+* :ref:`or-patterns` containing at least one irrefutable pattern
+
+* :ref:`capture-patterns`
+
+* :ref:`wildcard-patterns`
+
+* parenthesized irrefutable patterns
+
+
+Patterns
+--------
+
+.. index::
+   single: ! patterns
+   single: AS pattern, OR pattern, capture pattern, wildcard pattern
+
+.. note::
+   This section uses grammar notations beyond standard EBNF:
+
+   * the notation ``SEP.RULE+`` is shorthand for ``RULE (SEP RULE)*``
+
+   * the notation ``!RULE`` is shorthand for a negative lookahead assertion
+
+
+The top-level syntax for ``patterns`` is:
+
+.. productionlist:: python-grammar
+   patterns: `open_sequence_pattern` | `pattern`
+   pattern: `as_pattern` | `or_pattern`
+   closed_pattern: | `literal_pattern`
+                 : | `capture_pattern`
+                 : | `wildcard_pattern`
+                 : | `value_pattern`
+                 : | `group_pattern`
+                 : | `sequence_pattern`
+                 : | `mapping_pattern`
+                 : | `class_pattern`
+
+The descriptions below will include a description "in simple terms" of what a pattern
+does for illustration purposes (credits to Raymond Hettinger for a document that
+inspired most of the descriptions). Note that these descriptions are purely for
+illustration purposes and **may not** reflect
+the underlying implementation.  Furthermore, they do not cover all valid forms.
+
+
+.. _or-patterns:
+
+OR Patterns
+^^^^^^^^^^^
+
+An OR pattern is two or more patterns separated by vertical
+bars ``|``.  Syntax:
+
+.. productionlist:: python-grammar
+   or_pattern: "|".`closed_pattern`+
+
+Only the final subpattern may be :ref:`irrefutable <irrefutable_case>`, and each
+subpattern must bind the same set of names to avoid ambiguity.
+
+An OR pattern matches each of its subpatterns in turn to the subject value,
+until one succeeds.  The OR pattern is then considered successful.  Otherwise,
+if none of the subpatterns succeed, the OR pattern fails.
+
+In simple terms, ``P1 | P2 | ...`` will try to match ``P1``, if it fails it will try to
+match ``P2``, succeeding immediately if any succeeds, failing otherwise.
+
+.. _as-patterns:
+
+AS Patterns
+^^^^^^^^^^^
+
+An AS pattern matches an OR pattern on the left of the :keyword:`as`
+keyword against a subject.  Syntax:
+
+.. productionlist:: python-grammar
+   as_pattern: `or_pattern` "as" `capture_pattern`
+
+If the OR pattern fails, the AS pattern fails.  Otherwise, the AS pattern binds
+the subject to the name on the right of the as keyword and succeeds.
+``capture_pattern`` cannot be a a ``_``.
+
+In simple terms ``P as NAME`` will match with ``P``, and on success it will
+set ``NAME = <subject>``.
+
+
+.. _literal-patterns:
+
+Literal Patterns
+^^^^^^^^^^^^^^^^
+
+A literal pattern corresponds to most
+:ref:`literals <literals>` in Python.  Syntax:
+
+.. productionlist:: python-grammar
+   literal_pattern: `signed_number`
+                  : | `signed_number` "+" NUMBER
+                  : | `signed_number` "-" NUMBER
+                  : | `strings`
+                  : | "None"
+                  : | "True"
+                  : | "False"
+                  : | `signed_number`: NUMBER | "-" NUMBER
+
+The rule ``strings`` and the token ``NUMBER`` are defined in the
+:doc:`standard Python grammar <./grammar>`.  Triple-quoted strings are
+supported.  Raw strings and byte strings are supported.  :ref:`f-strings` are
+not supported.
+
+The forms ``signed_number '+' NUMBER`` and ``signed_number '-' NUMBER`` are
+for expressing :ref:`complex numbers <imaginary>`; they require a real number
+on the left and an imaginary number on the right. E.g. ``3 + 4j``.
+
+In simple terms, ``LITERAL`` will succeed only if ``<subject> == LITERAL``. For
+the singletons ``None``, ``True`` and ``False``, the :keyword:`is` operator is used.
+
+.. _capture-patterns:
+
+Capture Patterns
+^^^^^^^^^^^^^^^^
+
+A capture pattern binds the subject value to a name.
+Syntax:
+
+.. productionlist:: python-grammar
+   capture_pattern: !'_' NAME
+
+A single underscore ``_`` is not a capture pattern (this is what ``!'_'``
+expresses). It is instead treated as a
+:token:`~python-grammar:wildcard_pattern`.
+
+In a given pattern, a given name can only be bound once.  E.g.
+``case x, x: ...`` is invalid while ``case [x] | x: ...`` is allowed.
+
+Capture patterns always succeed.  The binding follows scoping rules
+established by the assignment expression operator in :pep:`572`; the
+name becomes a local variable in the closest containing function scope unless
+there's an applicable :keyword:`global` or :keyword:`nonlocal` statement.
+
+In simple terms ``NAME`` will always succeed and it will set ``NAME = <subject>``.
+
+.. _wildcard-patterns:
+
+Wildcard Patterns
+^^^^^^^^^^^^^^^^^
+
+A wildcard pattern always succeeds (matches anything)
+and binds no name.  Syntax:
+
+.. productionlist:: python-grammar
+   wildcard_pattern: '_'
+
+``_`` is a :ref:`soft keyword <soft-keywords>` within any pattern,
+but only within patterns.  It is an identifier, as usual, even within
+``match`` subject expressions, ``guard``\ s, and ``case`` blocks.
+
+In simple terms, ``_`` will always succeed.
+
+.. _value-patterns:
+
+Value Patterns
+^^^^^^^^^^^^^^
+
+A value pattern represents a named value in Python.
+Syntax:
+
+.. productionlist:: python-grammar
+   value_pattern: `attr`
+   attr: `name_or_attr` "." NAME
+   name_or_attr: `attr` | NAME
+
+The dotted name in the pattern is looked up using standard Python
+:ref:`name resolution rules <resolve_names>`.  The pattern succeeds if the
+value found compares equal to the subject value (using the ``==`` equality
+operator).
+
+In simple terms ``NAME1.NAME2`` will succeed only if ``<subject> == NAME1.NAME2``
+
+.. note::
+
+  If the same value occurs multiple times in the same match statement, the
+  interpreter may cache the first value found and reuse it rather than repeat
+  the same lookup.  This cache is strictly tied to a given execution of a
+  given match statement.
+
+.. _group-patterns:
+
+Group Patterns
+^^^^^^^^^^^^^^
+
+A group pattern allows users to add parentheses around patterns to
+emphasize the intended grouping.  Otherwise, it has no additional syntax.
+Syntax:
+
+.. productionlist:: python-grammar
+   group_pattern: "(" `pattern` ")"
+
+In simple terms ``(P)`` has the same effect as ``P``.
+
+.. _sequence-patterns:
+
+Sequence Patterns
+^^^^^^^^^^^^^^^^^
+
+A sequence pattern contains several subpatterns to be matched against sequence elements.
+The syntax is similar to the unpacking of a list or tuple.
+
+.. productionlist:: python-grammar
+  sequence_pattern: "[" [`maybe_sequence_pattern`] "]"
+                  : | "(" [`open_sequence_pattern`] ")"
+  open_sequence_pattern: `maybe_star_pattern` "," [`maybe_sequence_pattern`]
+  maybe_sequence_pattern: ",".`maybe_star_pattern`+ ","?
+  maybe_star_pattern: `star_pattern` | `pattern`
+  star_pattern: "*" (`capture_pattern` | `wildcard_pattern`)
+
+There is no difference if parentheses  or square brackets
+are used for sequence patterns (i.e. ``(...)`` vs ``[...]`` ).
+
+.. note::
+   A single pattern enclosed in parentheses without a trailing comma
+   (e.g. ``(3 | 4)``) is a :ref:`group pattern <group-patterns>`.
+   While a single pattern enclosed in square brackets (e.g. ``[3 | 4]``) is
+   still a sequence pattern.
+
+At most one star subpattern may be in a sequence pattern.  The star subpattern
+may occur in any position. If no star subpattern is present, the sequence
+pattern is a fixed-length sequence pattern; otherwise it is a variable-length
+sequence pattern.
+
+The following is the logical flow for matching a sequence pattern against a
+subject value:
+
+#. If the subject value is not a sequence [#]_, the sequence pattern
+   fails.
+
+#. If the subject value is an instance of ``str``, ``bytes`` or ``bytearray``
+   the sequence pattern fails.
+
+#. The subsequent steps depend on whether the sequence pattern is fixed or
+   variable-length.
+
+   If the sequence pattern is fixed-length:
+
+   #. If the length of the subject sequence is not equal to the number of
+      subpatterns, the sequence pattern fails
+
+   #. Subpatterns in the sequence pattern are matched to their corresponding
+      items in the subject sequence from left to right.  Matching stops as soon
+      as a subpattern fails.  If all subpatterns succeed in matching their
+      corresponding item, the sequence pattern succeeds.
+
+   Otherwise, if the sequence pattern is variable-length:
+
+   #. If the length of the subject sequence is less than the number of non-star
+      subpatterns, the sequence pattern fails.
+
+   #. The leading non-star subpatterns are matched to their corresponding items
+      as for fixed-length sequences.
+
+   #. If the previous step succeeds, the star subpattern matches a list formed
+      of the remaining subject items, excluding the remaining items
+      corresponding to non-star subpatterns following the star subpattern.
+
+   #. Remaining non-star subpatterns are matched to their corresponding subject
+      items, as for a fixed-length sequence.
+
+   .. note:: The length of the subject sequence is obtained via
+      :func:`len` (i.e. via the :meth:`__len__` protocol).  This length may be
+      cached by the interpreter in a similar manner as
+      :ref:`value patterns <value-patterns>`.
+
+
+In simple terms ``[P1, P2, P3,`` ... ``, P<N>]`` matches only if all the following
+happens:
+
+* check ``<subject>`` is a sequence
+* ``len(subject) == <N>``
+* ``P1`` matches ``<subject>[0]`` (note that this match can also bind names)
+* ``P2`` matches ``<subject>[1]`` (note that this match can also bind names)
+* ... and so on for the corresponding pattern/element.
+
+.. _mapping-patterns:
+
+Mapping Patterns
+^^^^^^^^^^^^^^^^
+
+A mapping pattern contains one or more key-value patterns.  The syntax is
+similar to the construction of a dictionary.
+Syntax:
+
+.. productionlist:: python-grammar
+   mapping_pattern: "{" [`items_pattern`] "}"
+   items_pattern: ",".`key_value_pattern`+ ","?
+   key_value_pattern: (`literal_pattern` | `value_pattern`) ":" `pattern`
+                    : | `double_star_pattern`
+   double_star_pattern: "**" `capture_pattern`
+
+At most one double star pattern may be in a mapping pattern.  The double star
+pattern must be the last subpattern in the mapping pattern.
+
+Duplicate keys in mapping patterns are disallowed. Duplicate literal keys will
+raise a :exc:`SyntaxError`. Two keys that otherwise have the same value will
+raise a :exc:`ValueError` at runtime.
+
+The following is the logical flow for matching a mapping pattern against a
+subject value:
+
+#. If the subject value is not a mapping [#]_,the mapping pattern fails.
+
+#. If every key given in the mapping pattern is present in the subject mapping,
+   and the pattern for each key matches the corresponding item of the subject
+   mapping, the mapping pattern succeeds.
+
+#. If duplicate keys are detected in the mapping pattern, the pattern is
+   considered invalid. A :exc:`SyntaxError` is raised for duplicate literal
+   values; or a :exc:`ValueError` for named keys of the same value.
+
+.. note:: Key-value pairs are matched using the two-argument form of the mapping
+   subject's ``get()`` method.  Matched key-value pairs must already be present
+   in the mapping, and not created on-the-fly via :meth:`__missing__` or
+   :meth:`__getitem__`.
+
+In simple terms ``{KEY1: P1, KEY2: P2, ... }`` matches only if all the following
+happens:
+
+* check ``<subject>`` is a mapping
+* ``KEY1 in <subject>``
+* ``P1`` matches ``<subject>[KEY1]``
+* ... and so on for the corresponding KEY/pattern pair.
+
+
+.. _class-patterns:
+
+Class Patterns
+^^^^^^^^^^^^^^
+
+A class pattern represents a class and its positional and keyword arguments
+(if any).  Syntax:
+
+.. productionlist:: python-grammar
+  class_pattern: `name_or_attr` "(" [`pattern_arguments` ","?] ")"
+  pattern_arguments: `positional_patterns` ["," `keyword_patterns`]
+                   : | `keyword_patterns`
+  positional_patterns: ",".`pattern`+
+  keyword_patterns: ",".`keyword_pattern`+
+  keyword_pattern: NAME "=" `pattern`
+
+The same keyword should not be repeated in class patterns.
+
+The following is the logical flow for matching a class pattern against a
+subject value:
+
+#. If ``name_or_attr`` is not an instance of the builtin :class:`type` , raise
+   :exc:`TypeError`.
+
+#. If the subject value is not an instance of ``name_or_attr`` (tested via
+   :func:`isinstance`), the class pattern fails.
+
+#. If no pattern arguments are present, the pattern succeeds.  Otherwise,
+   the subsequent steps depend on whether keyword or positional argument patterns
+   are present.
+
+   For a number of built-in types (specified below), a single positional
+   subpattern is accepted which will match the entire subject; for these types
+   keyword patterns also work as for other types.
+
+   If only keyword patterns are present, they are processed as follows,
+   one by one:
+
+   I. The keyword is looked up as an attribute on the subject.
+
+      * If this raises an exception other than :exc:`AttributeError`, the
+        exception bubbles up.
+
+      * If this raises :exc:`AttributeError`, the class pattern has failed.
+
+      * Else, the subpattern associated with the keyword pattern is matched
+        against the subject's attribute value.  If this fails, the class
+        pattern fails; if this succeeds, the match proceeds to the next keyword.
+
+
+   II. If all keyword patterns succeed, the class pattern succeeds.
+
+   If any positional patterns are present, they are converted to keyword
+   patterns using the :data:`~object.__match_args__` attribute on the class
+   ``name_or_attr`` before matching:
+
+   I. The equivalent of ``getattr(cls, "__match_args__", ())`` is called.
+
+      * If this raises an exception, the exception bubbles up.
+
+      * If the returned value is not a tuple, the conversion fails and
+        :exc:`TypeError` is raised.
+
+      * If there are more positional patterns than ``len(cls.__match_args__)``,
+        :exc:`TypeError` is raised.
+
+      * Otherwise, positional pattern ``i`` is converted to a keyword pattern
+        using ``__match_args__[i]`` as the keyword.  ``__match_args__[i]`` must
+        be a string; if not :exc:`TypeError` is raised.
+
+      * If there are duplicate keywords, :exc:`TypeError` is raised.
+
+      .. seealso:: :ref:`class-pattern-matching`
+
+   II. Once all positional patterns have been converted to keyword patterns,
+       the match proceeds as if there were only keyword patterns.
+
+   For the following built-in types the handling of positional subpatterns is
+   different:
+
+   * :class:`bool`
+   * :class:`bytearray`
+   * :class:`bytes`
+   * :class:`dict`
+   * :class:`float`
+   * :class:`frozenset`
+   * :class:`int`
+   * :class:`list`
+   * :class:`set`
+   * :class:`str`
+   * :class:`tuple`
+
+   These classes accept a single positional argument, and the pattern there is matched
+   against the whole object rather than an attribute. For example ``int(0|1)`` matches
+   the value ``0``, but not the values ``0.0`` or ``False``.
+
+In simple terms ``CLS(P1, attr=P2)`` matches only if the following happens:
+
+* ``isinstance(<subject>, CLS)``
+* convert ``P1`` to a keyword pattern using ``CLS.__match_args__``
+* For each keyword argument ``attr=P2``:
+   * ``hasattr(<subject>, "attr")``
+   * ``P2`` matches ``<subject>.attr``
+* ... and so on for the corresponding keyword argument/pattern pair.
+
+.. seealso::
+
+   * :pep:`634` -- Structural Pattern Matching: Specification
+   * :pep:`636` -- Structural Pattern Matching: Tutorial
+
 
 .. index::
    single: parameter; function definition
@@ -509,7 +1120,6 @@
           : ["->" `expression`] ":" `suite`
    decorators: `decorator`+
    decorator: "@" `assignment_expression` NEWLINE
-   dotted_name: `identifier` ("." `identifier`)*
    parameter_list: `defparameter` ("," `defparameter`)* "," "/" ["," [`parameter_list_no_posonly`]]
                  :   | `parameter_list_no_posonly`
    parameter_list_no_posonly: `defparameter` ("," `defparameter`)* ["," [`parameter_list_starargs`]]
@@ -552,9 +1162,9 @@
 except that the original function is not temporarily bound to the name ``func``.
 
 .. versionchanged:: 3.9
-   Functions may be decorated with any valid :token:`assignment_expression`.
-   Previously, the grammar was much more restrictive; see :pep:`614` for
-   details.
+   Functions may be decorated with any valid
+   :token:`~python-grammar:assignment_expression`. Previously, the grammar was
+   much more restrictive; see :pep:`614` for details.
 
 .. index::
    triple: default; parameter; value
@@ -572,9 +1182,9 @@
 **Default parameter values are evaluated from left to right when the function
 definition is executed.** This means that the expression is evaluated once, when
 the function is defined, and that the same "pre-computed" value is used for each
-call.  This is especially important to understand when a default parameter is a
+call.  This is especially important to understand when a default parameter value is a
 mutable object, such as a list or a dictionary: if the function modifies the
-object (e.g. by appending an item to a list), the default value is in effect
+object (e.g. by appending an item to a list), the default parameter value is in effect
 modified.  This is generally not what was intended.  A way around this is to use
 ``None`` as the default, and explicitly test for it in the body of the function,
 e.g.::
@@ -586,19 +1196,25 @@
        return penguin
 
 .. index::
+   single: / (slash); function definition
    single: * (asterisk); function definition
    single: **; function definition
 
 Function call semantics are described in more detail in section :ref:`calls`. A
 function call always assigns values to all parameters mentioned in the parameter
-list, either from position arguments, from keyword arguments, or from default
+list, either from positional arguments, from keyword arguments, or from default
 values.  If the form "``*identifier``" is present, it is initialized to a tuple
 receiving any excess positional parameters, defaulting to the empty tuple.
 If the form "``**identifier``" is present, it is initialized to a new
 ordered mapping receiving any excess keyword arguments, defaulting to a
 new empty mapping of the same type.  Parameters after "``*``" or
 "``*identifier``" are keyword-only parameters and may only be passed
-used keyword arguments.
+by keyword arguments.  Parameters before "``/``" are positional-only parameters
+and may only be passed by positional arguments.
+
+.. versionchanged:: 3.8
+   The ``/`` function parameter syntax may be used to indicate positional-only
+   parameters. See :pep:`570` for details.
 
 .. index::
    pair: function; annotations
@@ -724,9 +1340,9 @@
 decorators.  The result is then bound to the class name.
 
 .. versionchanged:: 3.9
-   Classes may be decorated with any valid :token:`assignment_expression`.
-   Previously, the grammar was much more restrictive; see :pep:`614` for
-   details.
+   Classes may be decorated with any valid
+   :token:`~python-grammar:assignment_expression`. Previously, the grammar was
+   much more restrictive; see :pep:`614` for details.
 
 **Programmer's note:** Variables defined in the class definition are class
 attributes; they are shared by instances.  Instance attributes can be set in a
@@ -772,10 +1388,8 @@
    keyword: await
 
 Execution of Python coroutines can be suspended and resumed at many points
-(see :term:`coroutine`).  Inside the body of a coroutine function, ``await`` and
-``async`` identifiers become reserved keywords; :keyword:`await` expressions,
-:keyword:`async for` and :keyword:`async with` can only be used in
-coroutine function bodies.
+(see :term:`coroutine`). :keyword:`await` expressions, :keyword:`async for` and
+:keyword:`async with` can only be used in the body of a coroutine function.
 
 Functions defined with ``async def`` syntax are always coroutine functions,
 even if they do not contain ``await`` or ``async`` keywords.
@@ -789,6 +1403,9 @@
         do_stuff()
         await some_coroutine()
 
+.. versionchanged:: 3.7
+   ``await`` and ``async`` are now keywords; previously they were only
+   treated as such inside the body of a coroutine function.
 
 .. index:: statement: async for
 .. _`async for`:
@@ -799,12 +1416,12 @@
 .. productionlist:: python-grammar
    async_for_stmt: "async" `for_stmt`
 
-An :term:`asynchronous iterable` is able to call asynchronous code in its
-*iter* implementation, and :term:`asynchronous iterator` can call asynchronous
-code in its *next* method.
+An :term:`asynchronous iterable` provides an ``__aiter__`` method that directly
+returns an :term:`asynchronous iterator`, which can call asynchronous code in
+its ``__anext__`` method.
 
 The ``async for`` statement allows convenient iteration over asynchronous
-iterators.
+iterables.
 
 The following code::
 
@@ -889,6 +1506,35 @@
    there is a :keyword:`finally` clause which happens to raise another
    exception. That new exception causes the old one to be lost.
 
+.. [#] In pattern matching, a sequence is defined as one of the following:
+
+      * a class that inherits from :class:`collections.abc.Sequence`
+      * a Python class that has been registered as :class:`collections.abc.Sequence`
+      * a builtin class that has its (CPython) :data:`Py_TPFLAGS_SEQUENCE` bit set
+      * a class that inherits from any of the above
+
+   The following standard library classes are sequences:
+
+      * :class:`array.array`
+      * :class:`collections.deque`
+      * :class:`list`
+      * :class:`memoryview`
+      * :class:`range`
+      * :class:`tuple`
+
+   .. note:: Subject values of type ``str``, ``bytes``, and ``bytearray``
+      do not match sequence patterns.
+
+.. [#] In pattern matching, a mapping is defined as one of the following:
+
+      * a class that inherits from :class:`collections.abc.Mapping`
+      * a Python class that has been registered as :class:`collections.abc.Mapping`
+      * a builtin class that has its (CPython) :data:`Py_TPFLAGS_MAPPING` bit set
+      * a class that inherits from any of the above
+
+   The standard library classes :class:`dict` and :class:`types.MappingProxyType`
+   are mappings.
+
 .. [#] A string literal appearing as the first statement in the function body is
    transformed into the function's ``__doc__`` attribute and therefore the
    function's :term:`docstring`.
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
index 8906387..55ac99c 100644
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -188,7 +188,7 @@
    representation in computers.
 
    The string representations of the numeric classes, computed by
-   :meth:`__repr__` and :meth:`__str__`, have the following
+   :meth:`~object.__repr__` and :meth:`~object.__str__`, have the following
    properties:
 
    * They are valid numeric literals which, when passed to their
@@ -217,7 +217,6 @@
       There are two types of integers:
 
       Integers (:class:`int`)
-
          These represent numbers in an unlimited range, subject to available (virtual)
          memory only.  For the purpose of shift and mask operations, a binary
          representation is assumed, and negative numbers are represented in a variant of
@@ -554,7 +553,10 @@
       |                         | the dict are the parameter    |           |
       |                         | names, and ``'return'`` for   |           |
       |                         | the return annotation, if     |           |
-      |                         | provided.                     |           |
+      |                         | provided.  For more           |           |
+      |                         | information on working with   |           |
+      |                         | this attribute, see           |           |
+      |                         | :ref:`annotations-howto`.     |           |
       +-------------------------+-------------------------------+-----------+
       | :attr:`__kwdefaults__`  | A dict containing defaults    | Writable  |
       |                         | for keyword-only parameters.  |           |
@@ -646,13 +648,13 @@
 
       A function or method which uses the :keyword:`yield` statement (see section
       :ref:`yield`) is called a :dfn:`generator function`.  Such a function, when
-      called, always returns an iterator object which can be used to execute the
-      body of the function:  calling the iterator's :meth:`iterator.__next__`
-      method will cause the function to execute until it provides a value
-      using the :keyword:`!yield` statement.  When the function executes a
-      :keyword:`return` statement or falls off the end, a :exc:`StopIteration`
-      exception is raised and the iterator will have reached the end of the set of
-      values to be returned.
+      called, always returns an :term:`iterator` object which can be used to
+      execute the body of the function:  calling the iterator's
+      :meth:`iterator.__next__` method will cause the function to execute until
+      it provides a value using the :keyword:`!yield` statement.  When the
+      function executes a :keyword:`return` statement or falls off the end, a
+      :exc:`StopIteration` exception is raised and the iterator will have
+      reached the end of the set of values to be returned.
 
    Coroutine functions
       .. index::
@@ -672,10 +674,11 @@
       A function or method which is defined using :keyword:`async def` and
       which uses the :keyword:`yield` statement is called a
       :dfn:`asynchronous generator function`.  Such a function, when called,
-      returns an asynchronous iterator object which can be used in an
+      returns an :term:`asynchronous iterator` object which can be used in an
       :keyword:`async for` statement to execute the body of the function.
 
-      Calling the asynchronous iterator's :meth:`aiterator.__anext__` method
+      Calling the asynchronous iterator's
+      :meth:`aiterator.__anext__ <object.__anext__>` method
       will return an :term:`awaitable` which when awaited
       will execute until it provides a value using the :keyword:`yield`
       expression.  When the function executes an empty :keyword:`return`
@@ -713,13 +716,13 @@
    Classes
       Classes are callable.  These objects normally act as factories for new
       instances of themselves, but variations are possible for class types that
-      override :meth:`__new__`.  The arguments of the call are passed to
-      :meth:`__new__` and, in the typical case, to :meth:`__init__` to
+      override :meth:`~object.__new__`.  The arguments of the call are passed to
+      :meth:`__new__` and, in the typical case, to :meth:`~object.__init__` to
       initialize the new instance.
 
    Class Instances
       Instances of arbitrary classes can be made callable by defining a
-      :meth:`__call__` method in their class.
+      :meth:`~object.__call__` method in their class.
 
 
 Modules
@@ -749,16 +752,29 @@
       single: __annotations__ (module attribute)
       pair: module; namespace
 
-   Predefined (writable) attributes: :attr:`__name__` is the module's name;
-   :attr:`__doc__` is the module's documentation string, or ``None`` if
-   unavailable; :attr:`__annotations__` (optional) is a dictionary containing
-   :term:`variable annotations <variable annotation>` collected during module
-   body execution; :attr:`__file__` is the pathname of the file from which the
-   module was loaded, if it was loaded from a file. The :attr:`__file__`
-   attribute may be missing for certain types of modules, such as C modules
-   that are statically linked into the interpreter; for extension modules
-   loaded dynamically from a shared library, it is the pathname of the shared
-   library file.
+   Predefined (writable) attributes:
+
+      :attr:`__name__`
+         The module's name.
+
+      :attr:`__doc__`
+         The module's documentation string, or ``None`` if
+         unavailable.
+
+      :attr:`__file__`
+         The pathname of the file from which the
+         module was loaded, if it was loaded from a file.
+         The :attr:`__file__`
+         attribute may be missing for certain types of modules, such as C modules
+         that are statically linked into the interpreter.  For extension modules
+         loaded dynamically from a shared library, it's the pathname of the shared
+         library file.
+
+      :attr:`__annotations__`
+         A dictionary containing
+         :term:`variable annotations <variable annotation>` collected during
+         module body execution.  For best practices on working
+         with :attr:`__annotations__`, please see :ref:`annotations-howto`.
 
    .. index:: single: __dict__ (module attribute)
 
@@ -822,14 +838,30 @@
       single: __doc__ (class attribute)
       single: __annotations__ (class attribute)
 
-   Special attributes: :attr:`~definition.__name__` is the class name; :attr:`__module__` is
-   the module name in which the class was defined; :attr:`~object.__dict__` is the
-   dictionary containing the class's namespace; :attr:`~class.__bases__` is a
-   tuple containing the base classes, in the order of their occurrence in the
-   base class list; :attr:`__doc__` is the class's documentation string,
-   or ``None`` if undefined; :attr:`__annotations__` (optional) is a dictionary
-   containing :term:`variable annotations <variable annotation>` collected during
-   class body execution.
+   Special attributes:
+
+      :attr:`~definition.__name__`
+         The class name.
+
+      :attr:`__module__`
+         The name of the module in which the class was defined.
+
+      :attr:`~object.__dict__`
+         The dictionary containing the class's namespace.
+
+      :attr:`~class.__bases__`
+         A tuple containing the base classes, in the order of
+         their occurrence in the base class list.
+
+      :attr:`__doc__`
+         The class's documentation string, or ``None`` if undefined.
+
+      :attr:`__annotations__`
+         A dictionary containing
+         :term:`variable annotations <variable annotation>`
+         collected during class body execution.  For best practices on
+         working with :attr:`__annotations__`, please see
+         :ref:`annotations-howto`.
 
 Class instances
    .. index::
@@ -849,14 +881,14 @@
    section :ref:`descriptors` for another way in which attributes of a class
    retrieved via its instances may differ from the objects actually stored in
    the class's :attr:`~object.__dict__`.  If no class attribute is found, and the
-   object's class has a :meth:`__getattr__` method, that is called to satisfy
+   object's class has a :meth:`~object.__getattr__` method, that is called to satisfy
    the lookup.
 
    .. index:: triple: class instance; attribute; assignment
 
    Attribute assignments and deletions update the instance's dictionary, never a
-   class's dictionary.  If the class has a :meth:`__setattr__` or
-   :meth:`__delattr__` method, this is called instead of updating the instance
+   class's dictionary.  If the class has a :meth:`~object.__setattr__` or
+   :meth:`~object.__delattr__` method, this is called instead of updating the instance
    dictionary directly.
 
    .. index::
@@ -1006,6 +1038,9 @@
       :attr:`f_lasti` gives the precise instruction (this is an index into the
       bytecode string of the code object).
 
+      Accessing ``f_code`` raises an :ref:`auditing event <auditing>`
+      ``object.__getattr__`` with arguments ``obj`` and ``"f_code"``.
+
       .. index::
          single: f_trace (frame attribute)
          single: f_trace_lines (frame attribute)
@@ -1090,6 +1125,9 @@
       :keyword:`try` statement with no matching except clause or with a
       finally clause.
 
+      Accessing ``tb_frame`` raises an :ref:`auditing event <auditing>`
+      ``object.__getattr__`` with arguments ``obj`` and ``"tb_frame"``.
+
       .. index::
          single: tb_next (traceback attribute)
 
@@ -1104,7 +1142,8 @@
    Slice objects
       .. index:: builtin: slice
 
-      Slice objects are used to represent slices for :meth:`__getitem__`
+      Slice objects are used to represent slices for
+      :meth:`~object.__getitem__`
       methods.  They are also created by the built-in :func:`slice` function.
 
       .. index::
@@ -1133,9 +1172,8 @@
       around any other object, usually a user-defined method object. When a static
       method object is retrieved from a class or a class instance, the object actually
       returned is the wrapped object, which is not subject to any further
-      transformation. Static method objects are not themselves callable, although the
-      objects they wrap usually are. Static method objects are created by the built-in
-      :func:`staticmethod` constructor.
+      transformation. Static method objects are also callable. Static method
+      objects are created by the built-in :func:`staticmethod` constructor.
 
    Class method objects
       A class method object, like a static method object, is a wrapper around another
@@ -1158,7 +1196,8 @@
 (such as arithmetic operations or subscripting and slicing) by defining methods
 with special names. This is Python's approach to :dfn:`operator overloading`,
 allowing classes to define their own behavior with respect to language
-operators.  For instance, if a class defines a method named :meth:`__getitem__`,
+operators.  For instance, if a class defines a method named
+:meth:`~object.__getitem__`,
 and ``x`` is an instance of this class, then ``x[i]`` is roughly equivalent
 to ``type(x).__getitem__(x, i)``.  Except where mentioned, attempts to execute an
 operation raise an exception when no appropriate method is defined (typically
@@ -1166,9 +1205,9 @@
 
 Setting a special method to ``None`` indicates that the corresponding
 operation is not available.  For example, if a class sets
-:meth:`__iter__` to ``None``, the class is not iterable, so calling
+:meth:`~object.__iter__` to ``None``, the class is not iterable, so calling
 :func:`iter` on its instances will raise a :exc:`TypeError` (without
-falling back to :meth:`__getitem__`). [#]_
+falling back to :meth:`~object.__getitem__`). [#]_
 
 When implementing a class that emulates any built-in type, it is important that
 the emulation only be implemented to the degree that it makes sense for the
@@ -1200,7 +1239,7 @@
    as necessary before returning it.
 
    If :meth:`__new__` is invoked during object construction and it returns an
-   instance or subclass of *cls*, then the new instance’s :meth:`__init__` method
+   instance of *cls*, then the new instance’s :meth:`__init__` method
    will be invoked like ``__init__(self[, ...])``, where *self* is the new instance
    and the remaining arguments are the same as were passed to the object constructor.
 
@@ -1487,7 +1526,7 @@
 
       This is intended to provide protection against a denial-of-service caused
       by carefully-chosen inputs that exploit the worst case performance of a
-      dict insertion, O(n^2) complexity.  See
+      dict insertion, O(n\ :sup:`2`) complexity.  See
       http://www.ocert.org/advisories/ocert-2011-003.html for details.
 
       Changing hash values affects the iteration order of sets.
@@ -1703,28 +1742,6 @@
    Called to delete the attribute on an instance *instance* of the owner class.
 
 
-.. method:: object.__set_name__(self, owner, name)
-
-   Called at the time the owning class *owner* is created. The
-   descriptor has been assigned to *name*.
-
-   .. note::
-
-      :meth:`__set_name__` is only called implicitly as part of the
-      :class:`type` constructor, so it will need to be called explicitly with
-      the appropriate parameters when a descriptor is added to a class after
-      initial creation::
-
-         class A:
-            pass
-         descr = custom_descriptor()
-         A.attr = descr
-         descr.__set_name__(A, 'attr')
-
-      See :ref:`class-object-creation` for more details.
-
-   .. versionadded:: 3.6
-
 The attribute :attr:`__objclass__` is interpreted by the :mod:`inspect` module
 as specifying the class where this object was defined (setting this
 appropriately can assist in runtime introspection of dynamic class attributes).
@@ -1740,7 +1757,8 @@
 
 In general, a descriptor is an object attribute with "binding behavior", one
 whose attribute access has been overridden by methods in the descriptor
-protocol:  :meth:`__get__`, :meth:`__set__`, and :meth:`__delete__`. If any of
+protocol:  :meth:`~object.__get__`, :meth:`~object.__set__`, and
+:meth:`~object.__delete__`. If any of
 those methods are defined for an object, it is said to be a descriptor.
 
 The default behavior for attribute access is to get, set, or delete the
@@ -1771,12 +1789,13 @@
 Super Binding
    If ``a`` is an instance of :class:`super`, then the binding ``super(B, obj).m()``
    searches ``obj.__class__.__mro__`` for the base class ``A``
-   immediately preceding ``B`` and then invokes the descriptor with the call:
+   immediately following ``B`` and then invokes the descriptor with the call:
    ``A.__dict__['m'].__get__(obj, obj.__class__)``.
 
-For instance bindings, the precedence of descriptor invocation depends on the
+For instance bindings, the precedence of descriptor invocation depends on
 which descriptor methods are defined.  A descriptor can define any combination
-of :meth:`__get__`, :meth:`__set__` and :meth:`__delete__`.  If it does not
+of :meth:`~object.__get__`, :meth:`~object.__set__` and
+:meth:`~object.__delete__`.  If it does not
 define :meth:`__get__`, then accessing the attribute will return the descriptor
 object itself unless there is a value in the object's instance dictionary.  If
 the descriptor defines :meth:`__set__` and/or :meth:`__delete__`, it is a data
@@ -1787,7 +1806,8 @@
 instance dictionary.  In contrast, non-data descriptors can be overridden by
 instances.
 
-Python methods (including :func:`staticmethod` and :func:`classmethod`) are
+Python methods (including those decorated with
+:func:`@staticmethod <staticmethod>` and :func:`@classmethod <classmethod>`) are
 implemented as non-data descriptors.  Accordingly, instances can redefine and
 override methods.  This allows individual instances to acquire behaviors that
 differ from other instances of the same class.
@@ -1802,46 +1822,50 @@
 ^^^^^^^^^
 
 *__slots__* allow us to explicitly declare data members (like
-properties) and deny the creation of *__dict__* and *__weakref__*
+properties) and deny the creation of :attr:`~object.__dict__` and *__weakref__*
 (unless explicitly declared in *__slots__* or available in a parent.)
 
-The space saved over using *__dict__* can be significant.
+The space saved over using :attr:`~object.__dict__` can be significant.
 Attribute lookup speed can be significantly improved as well.
 
 .. data:: object.__slots__
 
    This class variable can be assigned a string, iterable, or sequence of
    strings with variable names used by instances.  *__slots__* reserves space
-   for the declared variables and prevents the automatic creation of *__dict__*
+   for the declared variables and prevents the automatic creation of
+   :attr:`~object.__dict__`
    and *__weakref__* for each instance.
 
 
 Notes on using *__slots__*
 """"""""""""""""""""""""""
 
-* When inheriting from a class without *__slots__*, the *__dict__* and
+* When inheriting from a class without *__slots__*, the
+  :attr:`~object.__dict__` and
   *__weakref__* attribute of the instances will always be accessible.
 
-* Without a *__dict__* variable, instances cannot be assigned new variables not
+* Without a :attr:`~object.__dict__` variable, instances cannot be assigned new
+  variables not
   listed in the *__slots__* definition.  Attempts to assign to an unlisted
   variable name raises :exc:`AttributeError`. If dynamic assignment of new
   variables is desired, then add ``'__dict__'`` to the sequence of strings in
   the *__slots__* declaration.
 
 * Without a *__weakref__* variable for each instance, classes defining
-  *__slots__* do not support weak references to its instances. If weak reference
+  *__slots__* do not support :mod:`weak references <weakref>` to its instances.
+  If weak reference
   support is needed, then add ``'__weakref__'`` to the sequence of strings in the
   *__slots__* declaration.
 
-* *__slots__* are implemented at the class level by creating descriptors
-  (:ref:`descriptors`) for each variable name.  As a result, class attributes
+* *__slots__* are implemented at the class level by creating :ref:`descriptors <descriptors>`
+  for each variable name.  As a result, class attributes
   cannot be used to set default values for instance variables defined by
   *__slots__*; otherwise, the class attribute would overwrite the descriptor
   assignment.
 
 * The action of a *__slots__* declaration is not limited to the class
   where it is defined.  *__slots__* declared in parents are available in
-  child classes. However, child subclasses will get a *__dict__*  and
+  child classes. However, child subclasses will get a :attr:`~object.__dict__` and
   *__weakref__* unless they also define *__slots__* (which should only
   contain names of any *additional* slots).
 
@@ -1853,18 +1877,24 @@
 * Nonempty *__slots__* does not work for classes derived from "variable-length"
   built-in types such as :class:`int`, :class:`bytes` and :class:`tuple`.
 
-* Any non-string iterable may be assigned to *__slots__*. Mappings may also be
-  used; however, in the future, special meaning may be assigned to the values
-  corresponding to each key.
+* Any non-string :term:`iterable` may be assigned to *__slots__*.
 
-* *__class__* assignment works only if both classes have the same *__slots__*.
+* If a :class:`dictionary <dict>` is used to assign *__slots__*, the dictionary
+  keys will be used as the slot names. The values of the dictionary can be used
+  to provide per-attribute docstrings that will be recognised by
+  :func:`inspect.getdoc` and displayed in the output of :func:`help`.
 
-* Multiple inheritance with multiple slotted parent classes can be used,
+* :attr:`~instance.__class__` assignment works only if both classes have the
+  same *__slots__*.
+
+* :ref:`Multiple inheritance <tut-multiple>` with multiple slotted parent
+  classes can be used,
   but only one parent is allowed to have attributes created by slots
   (the other bases must have empty slot layouts) - violations raise
   :exc:`TypeError`.
 
-* If an iterator is used for *__slots__* then a descriptor is created for each
+* If an :term:`iterator` is used for *__slots__* then a :term:`descriptor` is
+  created for each
   of the iterator's values. However, the *__slots__* attribute will be an empty
   iterator.
 
@@ -1873,8 +1903,8 @@
 Customizing class creation
 --------------------------
 
-Whenever a class inherits from another class, *__init_subclass__* is
-called on that class. This way, it is possible to write classes which
+Whenever a class inherits from another class, :meth:`~object.__init_subclass__` is
+called on the parent class. This way, it is possible to write classes which
 change the behavior of subclasses. This is closely related to class
 decorators, but where class decorators only affect the specific class they're
 applied to, ``__init_subclass__`` solely applies to future subclasses of the
@@ -1913,6 +1943,33 @@
    .. versionadded:: 3.6
 
 
+When a class is created, :meth:`type.__new__` scans the class variables
+and makes callbacks to those with a :meth:`~object.__set_name__` hook.
+
+.. method:: object.__set_name__(self, owner, name)
+
+   Automatically called at the time the owning class *owner* is
+   created. The object has been assigned to *name* in that class::
+
+       class A:
+           x = C()  # Automatically calls: x.__set_name__(A, 'x')
+
+   If the class variable is assigned after the class is created,
+   :meth:`__set_name__` will not be called automatically.
+   If needed, :meth:`__set_name__` can be called directly::
+
+       class A:
+          pass
+
+       c = C()
+       A.x = c                  # The hook is not called
+       c.__set_name__(A, 'x')   # Manually invoke the hook
+
+   See :ref:`class-object-creation` for more details.
+
+   .. versionadded:: 3.6
+
+
 .. _metaclasses:
 
 Metaclasses
@@ -1999,7 +2056,8 @@
 is prepared. If the metaclass has a ``__prepare__`` attribute, it is called
 as ``namespace = metaclass.__prepare__(name, bases, **kwds)`` (where the
 additional keyword arguments, if any, come from the class definition). The
-``__prepare__`` method should be implemented as a :func:`classmethod`. The
+``__prepare__`` method should be implemented as a
+:func:`classmethod <classmethod>`. The
 namespace returned by ``__prepare__`` is passed in to ``__new__``, but when
 the final class object is created the namespace is copied into a new ``dict``.
 
@@ -2062,15 +2120,15 @@
    Failing to do so will result in a :exc:`RuntimeError` in Python 3.8.
 
 When using the default metaclass :class:`type`, or any metaclass that ultimately
-calls ``type.__new__``, the following additional customisation steps are
+calls ``type.__new__``, the following additional customization steps are
 invoked after creating the class object:
 
-* first, ``type.__new__`` collects all of the descriptors in the class
-  namespace that define a :meth:`~object.__set_name__` method;
-* second, all of these ``__set_name__`` methods are called with the class
-  being defined and the assigned name of that particular descriptor;
-* finally, the :meth:`~object.__init_subclass__` hook is called on the
-  immediate parent of the new class in its method resolution order.
+1) The ``type.__new__`` method collects all of the attributes in the class
+   namespace that define a :meth:`~object.__set_name__` method;
+2) Those ``__set_name__`` methods are called with the class
+   being defined and the assigned name of that particular attribute;
+3) The :meth:`~object.__init_subclass__` hook is called on the
+   immediate parent of the new class in its method resolution order.
 
 After the class object is created, it is passed to the class decorators
 included in the class definition (if any) and the resulting object is bound
@@ -2139,22 +2197,142 @@
 Emulating generic types
 -----------------------
 
-One can implement the generic class syntax as specified by :pep:`484`
-(for example ``List[int]``) by defining a special method:
+When using :term:`type annotations<annotation>`, it is often useful to
+*parameterize* a :term:`generic type` using Python's square-brackets notation.
+For example, the annotation ``list[int]`` might be used to signify a
+:class:`list` in which all the elements are of type :class:`int`.
+
+.. seealso::
+
+   :pep:`484` - Type Hints
+      Introducing Python's framework for type annotations
+
+   :ref:`Generic Alias Types<types-genericalias>`
+      Documentation for objects representing parameterized generic classes
+
+   :ref:`Generics`, :ref:`user-defined generics<user-defined-generics>` and :class:`typing.Generic`
+      Documentation on how to implement generic classes that can be
+      parameterized at runtime and understood by static type-checkers.
+
+A class can *generally* only be parameterized if it defines the special
+class method ``__class_getitem__()``.
 
 .. classmethod:: object.__class_getitem__(cls, key)
 
    Return an object representing the specialization of a generic class
    by type arguments found in *key*.
 
-This method is looked up on the class object itself, and when defined in
-the class body, this method is implicitly a class method.  Note, this
-mechanism is primarily reserved for use with static type hints, other usage
-is discouraged.
+   When defined on a class, ``__class_getitem__()`` is automatically a class
+   method. As such, there is no need for it to be decorated with
+   :func:`@classmethod<classmethod>` when it is defined.
+
+
+The purpose of *__class_getitem__*
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The purpose of :meth:`~object.__class_getitem__` is to allow runtime
+parameterization of standard-library generic classes in order to more easily
+apply :term:`type hints<type hint>` to these classes.
+
+To implement custom generic classes that can be parameterized at runtime and
+understood by static type-checkers, users should either inherit from a standard
+library class that already implements :meth:`~object.__class_getitem__`, or
+inherit from :class:`typing.Generic`, which has its own implementation of
+``__class_getitem__()``.
+
+Custom implementations of :meth:`~object.__class_getitem__` on classes defined
+outside of the standard library may not be understood by third-party
+type-checkers such as mypy. Using ``__class_getitem__()`` on any class for
+purposes other than type hinting is discouraged.
+
+
+.. _classgetitem-versus-getitem:
+
+
+*__class_getitem__* versus *__getitem__*
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Usually, the :ref:`subscription<subscriptions>` of an object using square
+brackets will call the :meth:`~object.__getitem__` instance method defined on
+the object's class. However, if the object being subscribed is itself a class,
+the class method :meth:`~object.__class_getitem__` may be called instead.
+``__class_getitem__()`` should return a :ref:`GenericAlias<types-genericalias>`
+object if it is properly defined.
+
+Presented with the :term:`expression` ``obj[x]``, the Python interpreter
+follows something like the following process to decide whether
+:meth:`~object.__getitem__` or :meth:`~object.__class_getitem__` should be
+called::
+
+   from inspect import isclass
+
+   def subscribe(obj, x):
+       """Return the result of the expression `obj[x]`"""
+
+       class_of_obj = type(obj)
+
+       # If the class of obj defines __getitem__,
+       # call class_of_obj.__getitem__(obj, x)
+       if hasattr(class_of_obj, '__getitem__'):
+           return class_of_obj.__getitem__(obj, x)
+
+       # Else, if obj is a class and defines __class_getitem__,
+       # call obj.__class_getitem__(x)
+       elif isclass(obj) and hasattr(obj, '__class_getitem__'):
+           return obj.__class_getitem__(x)
+
+       # Else, raise an exception
+       else:
+           raise TypeError(
+               f"'{class_of_obj.__name__}' object is not subscriptable"
+           )
+
+In Python, all classes are themselves instances of other classes. The class of
+a class is known as that class's :term:`metaclass`, and most classes have the
+:class:`type` class as their metaclass. :class:`type` does not define
+:meth:`~object.__getitem__`, meaning that expressions such as ``list[int]``,
+``dict[str, float]`` and ``tuple[str, bytes]`` all result in
+:meth:`~object.__class_getitem__` being called::
+
+   >>> # list has class "type" as its metaclass, like most classes:
+   >>> type(list)
+   <class 'type'>
+   >>> type(dict) == type(list) == type(tuple) == type(str) == type(bytes)
+   True
+   >>> # "list[int]" calls "list.__class_getitem__(int)"
+   >>> list[int]
+   list[int]
+   >>> # list.__class_getitem__ returns a GenericAlias object:
+   >>> type(list[int])
+   <class 'types.GenericAlias'>
+
+However, if a class has a custom metaclass that defines
+:meth:`~object.__getitem__`, subscribing the class may result in different
+behaviour. An example of this can be found in the :mod:`enum` module::
+
+   >>> from enum import Enum
+   >>> class Menu(Enum):
+   ...     """A breakfast menu"""
+   ...     SPAM = 'spam'
+   ...     BACON = 'bacon'
+   ...
+   >>> # Enum classes have a custom metaclass:
+   >>> type(Menu)
+   <class 'enum.EnumMeta'>
+   >>> # EnumMeta defines __getitem__,
+   >>> # so __class_getitem__ is not called,
+   >>> # and the result is not a GenericAlias object:
+   >>> Menu['SPAM']
+   <Menu.SPAM: 'spam'>
+   >>> type(Menu['SPAM'])
+   <enum 'Menu'>
+
 
 .. seealso::
-
-   :pep:`560` - Core support for typing module and generic types
+   :pep:`560` - Core Support for typing module and generic types
+      Introducing :meth:`~object.__class_getitem__`, and outlining when a
+      :ref:`subscription<subscriptions>` results in ``__class_getitem__()``
+      being called instead of :meth:`~object.__getitem__`
 
 
 .. _callable-types:
@@ -2177,31 +2355,36 @@
 -------------------------
 
 The following methods can be defined to implement container objects.  Containers
-usually are sequences (such as lists or tuples) or mappings (like dictionaries),
+usually are :term:`sequences <sequence>` (such as :class:`lists <list>` or
+:class:`tuples <tuple>`) or :term:`mappings <mapping>` (like
+:class:`dictionaries <dict>`),
 but can represent other containers as well.  The first set of methods is used
 either to emulate a sequence or to emulate a mapping; the difference is that for
 a sequence, the allowable keys should be the integers *k* for which ``0 <= k <
-N`` where *N* is the length of the sequence, or slice objects, which define a
+N`` where *N* is the length of the sequence, or :class:`slice` objects, which define a
 range of items.  It is also recommended that mappings provide the methods
 :meth:`keys`, :meth:`values`, :meth:`items`, :meth:`get`, :meth:`clear`,
 :meth:`setdefault`, :meth:`pop`, :meth:`popitem`, :meth:`!copy`, and
-:meth:`update` behaving similar to those for Python's standard dictionary
+:meth:`update` behaving similar to those for Python's standard :class:`dictionary <dict>`
 objects.  The :mod:`collections.abc` module provides a
 :class:`~collections.abc.MutableMapping`
-abstract base class to help create those methods from a base set of
-:meth:`__getitem__`, :meth:`__setitem__`, :meth:`__delitem__`, and :meth:`keys`.
+:term:`abstract base class` to help create those methods from a base set of
+:meth:`~object.__getitem__`, :meth:`~object.__setitem__`, :meth:`~object.__delitem__`, and :meth:`keys`.
 Mutable sequences should provide methods :meth:`append`, :meth:`count`,
 :meth:`index`, :meth:`extend`, :meth:`insert`, :meth:`pop`, :meth:`remove`,
-:meth:`reverse` and :meth:`sort`, like Python standard list objects.  Finally,
+:meth:`reverse` and :meth:`sort`, like Python standard :class:`list`
+objects. Finally,
 sequence types should implement addition (meaning concatenation) and
-multiplication (meaning repetition) by defining the methods :meth:`__add__`,
-:meth:`__radd__`, :meth:`__iadd__`, :meth:`__mul__`, :meth:`__rmul__` and
-:meth:`__imul__` described below; they should not define other numerical
+multiplication (meaning repetition) by defining the methods
+:meth:`~object.__add__`, :meth:`~object.__radd__`, :meth:`~object.__iadd__`,
+:meth:`~object.__mul__`, :meth:`~object.__rmul__` and :meth:`~object.__imul__`
+described below; they should not define other numerical
 operators.  It is recommended that both mappings and sequences implement the
-:meth:`__contains__` method to allow efficient use of the ``in`` operator; for
+:meth:`~object.__contains__` method to allow efficient use of the ``in``
+operator; for
 mappings, ``in`` should search the mapping's keys; for sequences, it should
 search through the values.  It is further recommended that both mappings and
-sequences implement the :meth:`__iter__` method to allow efficient iteration
+sequences implement the :meth:`~object.__iter__` method to allow efficient iteration
 through the container; for mappings, :meth:`__iter__` should iterate
 through the object's keys; for sequences, it should iterate through the values.
 
@@ -2254,19 +2437,27 @@
 
 .. method:: object.__getitem__(self, key)
 
-   Called to implement evaluation of ``self[key]``. For sequence types, the
-   accepted keys should be integers and slice objects.  Note that the special
-   interpretation of negative indexes (if the class wishes to emulate a sequence
-   type) is up to the :meth:`__getitem__` method. If *key* is of an inappropriate
-   type, :exc:`TypeError` may be raised; if of a value outside the set of indexes
-   for the sequence (after any special interpretation of negative values),
-   :exc:`IndexError` should be raised. For mapping types, if *key* is missing (not
-   in the container), :exc:`KeyError` should be raised.
+   Called to implement evaluation of ``self[key]``. For :term:`sequence` types,
+   the accepted keys should be integers and slice objects.  Note that the
+   special interpretation of negative indexes (if the class wishes to emulate a
+   :term:`sequence` type) is up to the :meth:`__getitem__` method. If *key* is
+   of an inappropriate type, :exc:`TypeError` may be raised; if of a value
+   outside the set of indexes for the sequence (after any special
+   interpretation of negative values), :exc:`IndexError` should be raised. For
+   :term:`mapping` types, if *key* is missing (not in the container),
+   :exc:`KeyError` should be raised.
 
    .. note::
 
-      :keyword:`for` loops expect that an :exc:`IndexError` will be raised for illegal
-      indexes to allow proper detection of the end of the sequence.
+      :keyword:`for` loops expect that an :exc:`IndexError` will be raised for
+      illegal indexes to allow proper detection of the end of the sequence.
+
+   .. note::
+
+      When :ref:`subscripting<subscriptions>` a *class*, the special
+      class method :meth:`~object.__class_getitem__` may be called instead of
+      ``__getitem__()``. See :ref:`classgetitem-versus-getitem` for more
+      details.
 
 
 .. method:: object.__setitem__(self, key, value)
@@ -2295,12 +2486,10 @@
 
 .. method:: object.__iter__(self)
 
-   This method is called when an iterator is required for a container. This method
-   should return a new iterator object that can iterate over all the objects in the
-   container.  For mappings, it should iterate over the keys of the container.
-
-   Iterator objects also need to implement this method; they are required to return
-   themselves.  For more information on iterator objects, see :ref:`typeiter`.
+   This method is called when an :term:`iterator` is required for a container.
+   This method should return a new iterator object that can iterate over all the
+   objects in the container.  For mappings, it should iterate over the keys of
+   the container.
 
 
 .. method:: object.__reversed__(self)
@@ -2448,13 +2637,6 @@
    :ref:`faq-augmented-assignment-tuple-error`), but this behavior is in fact
    part of the data model.
 
-   .. note::
-
-      Due to a bug in the dispatching mechanism for ``**=``, a class that
-      defines :meth:`__ipow__` but returns ``NotImplemented`` would fail to
-      fall back to ``x.__pow__(y)`` and ``y.__rpow__(x)``. This bug is fixed
-      in Python 3.10.
-
 
 .. method:: object.__neg__(self)
             object.__pos__(self)
@@ -2507,8 +2689,8 @@
    return the value of the object truncated to an :class:`~numbers.Integral`
    (typically an :class:`int`).
 
-   If :meth:`__int__` is not defined then the built-in function :func:`int`
-   falls back to :meth:`__trunc__`.
+   The built-in function :func:`int` falls back to :meth:`__trunc__` if neither
+   :meth:`__int__` nor :meth:`__index__` is defined.
 
 
 .. _context-managers:
@@ -2561,6 +2743,38 @@
       statement.
 
 
+.. _class-pattern-matching:
+
+Customizing positional arguments in class pattern matching
+----------------------------------------------------------
+
+When using a class name in a pattern, positional arguments in the pattern are not
+allowed by default, i.e. ``case MyClass(x, y)`` is typically invalid without special
+support in ``MyClass``. To be able to use that kind of patterns, the class needs to
+define a *__match_args__* attribute.
+
+.. data:: object.__match_args__
+
+   This class variable can be assigned a tuple of strings. When this class is
+   used in a class pattern with positional arguments, each positional argument will
+   be converted into a keyword argument, using the corresponding value in
+   *__match_args__* as the keyword. The absence of this attribute is equivalent to
+   setting it to ``()``.
+
+For example, if ``MyClass.__match_args__`` is ``("left", "center", "right")`` that means
+that ``case MyClass(x, y)`` is equivalent to ``case MyClass(left=x, center=y)``. Note
+that the number of arguments in the pattern must be smaller than or equal to the number
+of elements in *__match_args__*; if it is larger, the pattern match attempt will raise
+a :exc:`TypeError`.
+
+.. versionadded:: 3.10
+
+.. seealso::
+
+   :pep:`634` - Structural Pattern Matching
+      The specification for the Python ``match`` statement.
+
+
 .. _special-lookup:
 
 Special method lookup
@@ -2582,7 +2796,8 @@
    TypeError: object of type 'C' has no len()
 
 The rationale behind this behaviour lies with a number of special methods such
-as :meth:`__hash__` and :meth:`__repr__` that are implemented by all objects,
+as :meth:`~object.__hash__` and :meth:`~object.__repr__` that are implemented
+by all objects,
 including type objects. If the implicit lookup of these methods used the
 conventional lookup process, they would fail when invoked on the type object
 itself::
@@ -2605,7 +2820,7 @@
 
 In addition to bypassing any instance attributes in the interest of
 correctness, implicit special method lookup generally also bypasses the
-:meth:`__getattribute__` method even of the object's metaclass::
+:meth:`~object.__getattribute__` method even of the object's metaclass::
 
    >>> class Meta(type):
    ...     def __getattribute__(*args):
@@ -2629,7 +2844,7 @@
    >>> len(c)                      # Implicit lookup
    10
 
-Bypassing the :meth:`__getattribute__` machinery in this fashion
+Bypassing the :meth:`~object.__getattribute__` machinery in this fashion
 provides significant scope for speed optimisations within the
 interpreter, at the cost of some flexibility in the handling of
 special methods (the special method *must* be set on the class
@@ -2646,7 +2861,7 @@
 Awaitable Objects
 -----------------
 
-An :term:`awaitable` object generally implements an :meth:`__await__` method.
+An :term:`awaitable` object generally implements an :meth:`~object.__await__` method.
 :term:`Coroutine objects <coroutine>` returned from :keyword:`async def` functions
 are awaitable.
 
@@ -2654,7 +2869,7 @@
 
    The :term:`generator iterator` objects returned from generators
    decorated with :func:`types.coroutine` or :func:`asyncio.coroutine`
-   are also awaitable, but they do not implement :meth:`__await__`.
+   are also awaitable, but they do not implement :meth:`~object.__await__`.
 
 .. method:: object.__await__(self)
 
@@ -2673,7 +2888,7 @@
 -----------------
 
 :term:`Coroutine objects <coroutine>` are :term:`awaitable` objects.
-A coroutine's execution can be controlled by calling :meth:`__await__` and
+A coroutine's execution can be controlled by calling :meth:`~object.__await__` and
 iterating over the result.  When the coroutine has finished executing and
 returns, the iterator raises :exc:`StopIteration`, and the exception's
 :attr:`~StopIteration.value` attribute holds the return value.  If the
@@ -2692,7 +2907,7 @@
 
    Starts or resumes execution of the coroutine.  If *value* is ``None``,
    this is equivalent to advancing the iterator returned by
-   :meth:`__await__`.  If *value* is not ``None``, this method delegates
+   :meth:`~object.__await__`.  If *value* is not ``None``, this method delegates
    to the :meth:`~generator.send` method of the iterator that caused
    the coroutine to suspend.  The result (return value,
    :exc:`StopIteration`, or other exception) is the same as when
@@ -2705,7 +2920,7 @@
    the coroutine to suspend, if it has such a method.  Otherwise,
    the exception is raised at the suspension point.  The result
    (return value, :exc:`StopIteration`, or other exception) is the same as
-   when iterating over the :meth:`__await__` return value, described
+   when iterating over the :meth:`~object.__await__` return value, described
    above.  If the exception is not caught in the coroutine, it propagates
    back to the caller.
 
@@ -2759,11 +2974,11 @@
 .. versionadded:: 3.5
 
 .. versionchanged:: 3.7
-   Prior to Python 3.7, ``__aiter__`` could return an *awaitable*
+   Prior to Python 3.7, :meth:`~object.__aiter__` could return an *awaitable*
    that would resolve to an
    :term:`asynchronous iterator <asynchronous iterator>`.
 
-   Starting with Python 3.7, ``__aiter__`` must return an
+   Starting with Python 3.7, :meth:`~object.__aiter__` must return an
    asynchronous iterator object.  Returning anything else
    will result in a :exc:`TypeError` error.
 
@@ -2806,8 +3021,9 @@
    controlled conditions. It generally isn't a good idea though, since it can
    lead to some very strange behaviour if it is handled incorrectly.
 
-.. [#] The :meth:`__hash__`, :meth:`__iter__`, :meth:`__reversed__`, and
-   :meth:`__contains__` methods have special handling for this; others
+.. [#] The :meth:`~object.__hash__`, :meth:`~object.__iter__`,
+   :meth:`~object.__reversed__`, and :meth:`~object.__contains__` methods have
+   special handling for this; others
    will still raise a :exc:`TypeError`, but may do so by relying on
    the behavior that ``None`` is not callable.
 
@@ -2818,5 +3034,6 @@
    *blocking* such fallback.
 
 .. [#] For operands of the same type, it is assumed that if the non-reflected
-   method -- such as :meth:`__add__` -- fails then the overall operation is not
+   method -- such as :meth:`~object.__add__` -- fails then the overall
+   operation is not
    supported, which is why the reflected method is not called.
diff --git a/Doc/reference/executionmodel.rst b/Doc/reference/executionmodel.rst
index 55ac01b..e652915 100644
--- a/Doc/reference/executionmodel.rst
+++ b/Doc/reference/executionmodel.rst
@@ -56,15 +56,25 @@
 
 .. index:: single: from; import statement
 
-The following constructs bind names: formal parameters to functions,
-:keyword:`import` statements, class and function definitions (these bind the
-class or function name in the defining block), and targets that are identifiers
-if occurring in an assignment, :keyword:`for` loop header, or after
-:keyword:`!as` in a :keyword:`with` statement or :keyword:`except` clause.
-The :keyword:`!import` statement
-of the form ``from ... import *`` binds all names defined in the imported
-module, except those beginning with an underscore.  This form may only be used
-at the module level.
+The following constructs bind names:
+
+* formal parameters to functions,
+* class definitions,
+* function definitions,
+* assignment expressions,
+* :ref:`targets <assignment>` that are identifiers if occurring in
+  an assignment:
+
+  + :keyword:`for` loop header,
+  + after :keyword:`!as` in a :keyword:`with` statement, :keyword:`except`
+    clause or in the as-pattern in structural pattern matching,
+  + in a capture pattern in structural pattern matching
+
+* :keyword:`import` statements.
+
+The :keyword:`!import` statement of the form ``from ... import *`` binds all
+names defined in the imported module, except those beginning with an underscore.
+This form may only be used at the module level.
 
 A target occurring in a :keyword:`del` statement is also considered bound for
 this purpose (though the actual semantics are to unbind the name).
@@ -119,14 +129,14 @@
 occur anywhere within a code block.  The local variables of a code block can be
 determined by scanning the entire text of the block for name binding operations.
 
-If the :keyword:`global` statement occurs within a block, all uses of the name
-specified in the statement refer to the binding of that name in the top-level
+If the :keyword:`global` statement occurs within a block, all uses of the names
+specified in the statement refer to the bindings of those names in the top-level
 namespace.  Names are resolved in the top-level namespace by searching the
 global namespace, i.e. the namespace of the module containing the code block,
 and the builtins namespace, the namespace of the module :mod:`builtins`.  The
-global namespace is searched first.  If the name is not found there, the
+global namespace is searched first.  If the names are not found there, the
 builtins namespace is searched.  The :keyword:`!global` statement must precede
-all uses of the name.
+all uses of the listed names.
 
 The :keyword:`global` statement has the same scope as a name binding operation
 in the same block.  If the nearest enclosing scope for a free variable contains
diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst
index 512aa5a..9f136c9 100644
--- a/Doc/reference/expressions.rst
+++ b/Doc/reference/expressions.rst
@@ -77,6 +77,8 @@
 When a name is not bound, an attempt to evaluate it raises a :exc:`NameError`
 exception.
 
+.. _private-name-mangling:
+
 .. index::
    pair: name; mangling
    pair: private; names
@@ -183,7 +185,7 @@
    comprehension: `assignment_expression` `comp_for`
    comp_for: ["async"] "for" `target_list` "in" `or_test` [`comp_iter`]
    comp_iter: `comp_for` | `comp_if`
-   comp_if: "if" `expression_nocond` [`comp_iter`]
+   comp_if: "if" `or_test` [`comp_iter`]
 
 The comprehension consists of a single expression followed by at least one
 :keyword:`!for` clause and zero or more :keyword:`!for` or :keyword:`!if` clauses.
@@ -420,9 +422,9 @@
 The yield expression is used when defining a :term:`generator` function
 or an :term:`asynchronous generator` function and
 thus can only be used in the body of a function definition.  Using a yield
-expression in a function's body causes that function to be a generator,
+expression in a function's body causes that function to be a generator function,
 and using it in an :keyword:`async def` function's body causes that
-coroutine function to be an asynchronous generator. For example::
+coroutine function to be an asynchronous generator function. For example::
 
     def gen():  # defines a generator function
         yield 123
@@ -443,21 +445,20 @@
 :ref:`asynchronous-generator-functions`.
 
 When a generator function is called, it returns an iterator known as a
-generator.  That generator then controls the execution of the generator function.
-The execution starts when one of the generator's methods is called.  At that
-time, the execution proceeds to the first yield expression, where it is
-suspended again, returning the value of :token:`expression_list` to the generator's
-caller.  By suspended, we mean that all local state is retained, including the
-current bindings of local variables, the instruction pointer, the internal
-evaluation stack, and the state of any exception handling.  When the execution
-is resumed by calling one of the
-generator's methods, the function can proceed exactly as if the yield expression
-were just another external call.  The value of the yield expression after
-resuming depends on the method which resumed the execution.  If
-:meth:`~generator.__next__` is used (typically via either a :keyword:`for` or
-the :func:`next` builtin) then the result is :const:`None`.  Otherwise, if
-:meth:`~generator.send` is used, then the result will be the value passed in to
-that method.
+generator.  That generator then controls the execution of the generator
+function.  The execution starts when one of the generator's methods is called.
+At that time, the execution proceeds to the first yield expression, where it is
+suspended again, returning the value of :token:`~python-grammar:expression_list`
+to the generator's caller.  By suspended, we mean that all local state is
+retained, including the current bindings of local variables, the instruction
+pointer, the internal evaluation stack, and the state of any exception handling.
+When the execution is resumed by calling one of the generator's methods, the
+function can proceed exactly as if the yield expression were just another
+external call.  The value of the yield expression after resuming depends on the
+method which resumed the execution.  If :meth:`~generator.__next__` is used
+(typically via either a :keyword:`for` or the :func:`next` builtin) then the
+result is :const:`None`.  Otherwise, if :meth:`~generator.send` is used, then
+the result will be the value passed in to that method.
 
 .. index:: single: coroutine
 
@@ -476,8 +477,8 @@
 .. index::
    single: from; yield from expression
 
-When ``yield from <expr>`` is used, it treats the supplied expression as
-a subiterator. All values produced by that subiterator are passed directly
+When ``yield from <expr>`` is used, the supplied expression must be an
+iterable. The values produced by iterating that iterable are passed directly
 to the caller of the current generator's methods. Any values passed in with
 :meth:`~generator.send` and any exceptions passed in with
 :meth:`~generator.throw` are passed to the underlying iterator if it has the
@@ -507,8 +508,8 @@
       usable as simple coroutines.
 
    :pep:`380` - Syntax for Delegating to a Subgenerator
-      The proposal to introduce the :token:`yield_from` syntax, making delegation
-      to subgenerators easy.
+      The proposal to introduce the :token:`~python-grammar:yield_from` syntax,
+      making delegation to subgenerators easy.
 
    :pep:`525` - Asynchronous Generators
       The proposal that expanded on :pep:`492` by adding generator capabilities to
@@ -536,9 +537,9 @@
    :meth:`~generator.__next__` method, the current yield expression always
    evaluates to :const:`None`.  The execution then continues to the next yield
    expression, where the generator is suspended again, and the value of the
-   :token:`expression_list` is returned to :meth:`__next__`'s caller.  If the
-   generator exits without yielding another value, a :exc:`StopIteration`
-   exception is raised.
+   :token:`~python-grammar:expression_list` is returned to :meth:`__next__`'s
+   caller.  If the generator exits without yielding another value, a
+   :exc:`StopIteration` exception is raised.
 
    This method is normally called implicitly, e.g. by a :keyword:`for` loop, or
    by the built-in :func:`next` function.
@@ -627,21 +628,30 @@
 :keyword:`async for` statement in a coroutine function analogously to
 how a generator object would be used in a :keyword:`for` statement.
 
-Calling one of the asynchronous generator's methods returns an
-:term:`awaitable` object, and the execution starts when this object
-is awaited on. At that time, the execution proceeds to the first yield
-expression, where it is suspended again, returning the value of
-:token:`expression_list` to the awaiting coroutine. As with a generator,
-suspension means that all local state is retained, including the
-current bindings of local variables, the instruction pointer, the internal
-evaluation stack, and the state of any exception handling.  When the execution
-is resumed by awaiting on the next object returned by the asynchronous
-generator's methods, the function can proceed exactly as if the yield
-expression were just another external call. The value of the yield expression
-after resuming depends on the method which resumed the execution.  If
+Calling one of the asynchronous generator's methods returns an :term:`awaitable`
+object, and the execution starts when this object is awaited on. At that time,
+the execution proceeds to the first yield expression, where it is suspended
+again, returning the value of :token:`~python-grammar:expression_list` to the
+awaiting coroutine. As with a generator, suspension means that all local state
+is retained, including the current bindings of local variables, the instruction
+pointer, the internal evaluation stack, and the state of any exception handling.
+When the execution is resumed by awaiting on the next object returned by the
+asynchronous generator's methods, the function can proceed exactly as if the
+yield expression were just another external call. The value of the yield
+expression after resuming depends on the method which resumed the execution.  If
 :meth:`~agen.__anext__` is used then the result is :const:`None`. Otherwise, if
-:meth:`~agen.asend` is used, then the result will be the value passed in to
-that method.
+:meth:`~agen.asend` is used, then the result will be the value passed in to that
+method.
+
+If an asynchronous generator happens to exit early by :keyword:`break`, the caller
+task being cancelled, or other exceptions, the generator's async cleanup code
+will run and possibly raise exceptions or access context variables in an
+unexpected context--perhaps after the lifetime of tasks it depends, or
+during the event loop shutdown when the async-generator garbage collection hook
+is called.
+To prevent this, the caller must explicitly close the async generator by calling
+:meth:`~agen.aclose` method to finalize the generator and ultimately detach it
+from the event loop.
 
 In an asynchronous generator function, yield expressions are allowed anywhere
 in a :keyword:`try` construct. However, if an asynchronous generator is not
@@ -654,9 +664,9 @@
 coroutine object, thus allowing any pending :keyword:`!finally` clauses
 to execute.
 
-To take care of finalization, an event loop should define
-a *finalizer* function which takes an asynchronous generator-iterator
-and presumably calls :meth:`~agen.aclose` and executes the coroutine.
+To take care of finalization upon event loop termination, an event loop should
+define a *finalizer* function which takes an asynchronous generator-iterator and
+presumably calls :meth:`~agen.aclose` and executes the coroutine.
 This  *finalizer* may be registered by calling :func:`sys.set_asyncgen_hooks`.
 When first iterated over, an asynchronous generator-iterator will store the
 registered *finalizer* to be called upon finalization. For a reference example
@@ -683,10 +693,10 @@
    Returns an awaitable which when run starts to execute the asynchronous
    generator or resumes it at the last executed yield expression.  When an
    asynchronous generator function is resumed with an :meth:`~agen.__anext__`
-   method, the current yield expression always evaluates to :const:`None` in
-   the returned awaitable, which when run will continue to the next yield
-   expression. The value of the :token:`expression_list` of the yield
-   expression is the value of the :exc:`StopIteration` exception raised by
+   method, the current yield expression always evaluates to :const:`None` in the
+   returned awaitable, which when run will continue to the next yield
+   expression. The value of the :token:`~python-grammar:expression_list` of the
+   yield expression is the value of the :exc:`StopIteration` exception raised by
    the completing coroutine.  If the asynchronous generator exits without
    yielding another value, the awaitable instead raises a
    :exc:`StopAsyncIteration` exception, signalling that the asynchronous
@@ -800,30 +810,44 @@
    object: dictionary
    pair: sequence; item
 
-Subscription of a sequence (string, tuple or list) or mapping (dictionary)
-object usually selects an item from the collection:
+The subscription of an instance of a :ref:`container class <sequence-types>`
+will generally select an element from the container. The subscription of a
+:term:`generic class <generic type>` will generally return a
+:ref:`GenericAlias <types-genericalias>` object.
 
 .. productionlist:: python-grammar
    subscription: `primary` "[" `expression_list` "]"
 
-The primary must evaluate to an object that supports subscription (lists or
-dictionaries for example).  User-defined objects can support subscription by
-defining a :meth:`__getitem__` method.
+When an object is subscripted, the interpreter will evaluate the primary and
+the expression list.
 
-For built-in objects, there are two types of objects that support subscription:
+The primary must evaluate to an object that supports subscription. An object
+may support subscription through defining one or both of
+:meth:`~object.__getitem__` and :meth:`~object.__class_getitem__`. When the
+primary is subscripted, the evaluated result of the expression list will be
+passed to one of these methods. For more details on when ``__class_getitem__``
+is called instead of ``__getitem__``, see :ref:`classgetitem-versus-getitem`.
 
-If the primary is a mapping, the expression list must evaluate to an object
-whose value is one of the keys of the mapping, and the subscription selects the
-value in the mapping that corresponds to that key.  (The expression list is a
-tuple except if it has exactly one item.)
+If the expression list contains at least one comma, it will evaluate to a
+:class:`tuple` containing the items of the expression list. Otherwise, the
+expression list will evaluate to the value of the list's sole member.
 
-If the primary is a sequence, the expression list must evaluate to an integer
-or a slice (as discussed in the following section).
+For built-in objects, there are two types of objects that support subscription
+via :meth:`~object.__getitem__`:
+
+1. Mappings. If the primary is a :term:`mapping`, the expression list must
+   evaluate to an object whose value is one of the keys of the mapping, and the
+   subscription selects the value in the mapping that corresponds to that key.
+   An example of a builtin mapping class is the :class:`dict` class.
+2. Sequences. If the primary is a :term:`sequence`, the expression list must
+   evaluate to an :class:`int` or a :class:`slice` (as discussed in the
+   following section). Examples of builtin sequence classes include the
+   :class:`str`, :class:`list` and :class:`tuple` classes.
 
 The formal syntax makes no special provision for negative indices in
-sequences; however, built-in sequences all provide a :meth:`__getitem__`
+:term:`sequences <sequence>`. However, built-in sequences all provide a :meth:`~object.__getitem__`
 method that interprets negative indices by adding the length of the sequence
-to the index (so that ``x[-1]`` selects the last item of ``x``).  The
+to the index so that, for example, ``x[-1]`` selects the last item of ``x``. The
 resulting value must be a nonnegative integer less than the number of items in
 the sequence, and the subscription selects the item whose index is that value
 (counting from zero). Since the support for negative indices and slicing
@@ -834,14 +858,10 @@
    single: character
    pair: string; item
 
-A string's items are characters.  A character is not a separate data type but a
+A :class:`string <str>` is a special kind of sequence whose items are
+*characters*. A character is not a separate data type but a
 string of exactly one character.
 
-Subscription of certain :term:`classes <class>` or :term:`types <type>`
-creates a :ref:`generic alias <types-genericalias>`.
-In this case, user-defined classes can support subscription by providing a
-:meth:`__class_getitem__` classmethod.
-
 
 .. _slicings:
 
@@ -1136,6 +1156,7 @@
 Raising a negative number to a fractional power results in a :class:`complex`
 number. (In earlier versions it raised a :exc:`ValueError`.)
 
+This operation can be customized using the special :meth:`__pow__` method.
 
 .. _unary:
 
@@ -1157,14 +1178,16 @@
    single: operator; - (minus)
    single: - (minus); unary operator
 
-The unary ``-`` (minus) operator yields the negation of its numeric argument.
+The unary ``-`` (minus) operator yields the negation of its numeric argument; the
+operation can be overridden with the :meth:`__neg__` special method.
 
 .. index::
    single: plus
    single: operator; + (plus)
    single: + (plus); unary operator
 
-The unary ``+`` (plus) operator yields its numeric argument unchanged.
+The unary ``+`` (plus) operator yields its numeric argument unchanged; the
+operation can be overridden with the :meth:`__pos__` special method.
 
 .. index::
    single: inversion
@@ -1172,7 +1195,10 @@
 
 The unary ``~`` (invert) operator yields the bitwise inversion of its integer
 argument.  The bitwise inversion of ``x`` is defined as ``-(x+1)``.  It only
-applies to integral numbers.
+applies to integral numbers or to custom objects that override the
+:meth:`__invert__` special method.
+
+
 
 .. index:: exception: TypeError
 
@@ -1208,6 +1234,9 @@
 common type and then multiplied together.  In the latter case, sequence
 repetition is performed; a negative repetition factor yields an empty sequence.
 
+This operation can be customized using the special :meth:`__mul__` and
+:meth:`__rmul__` methods.
+
 .. index::
    single: matrix multiplication
    operator: @ (at)
@@ -1230,6 +1259,9 @@
 applied to the result.  Division by zero raises the :exc:`ZeroDivisionError`
 exception.
 
+This operation can be customized using the special :meth:`__truediv__` and
+:meth:`__floordiv__` methods.
+
 .. index::
    single: modulo
    operator: % (percent)
@@ -1253,6 +1285,8 @@
 known as interpolation).  The syntax for string formatting is described in the
 Python Library Reference, section :ref:`old-string-formatting`.
 
+The *modulo* operation can be customized using the special :meth:`__mod__` method.
+
 The floor division operator, the modulo operator, and the :func:`divmod`
 function are not defined for complex numbers.  Instead, convert to a floating
 point number using the :func:`abs` function if appropriate.
@@ -1267,6 +1301,9 @@
 former case, the numbers are converted to a common type and then added together.
 In the latter case, the sequences are concatenated.
 
+This operation can be customized using the special :meth:`__add__` and
+:meth:`__radd__` methods.
+
 .. index::
    single: subtraction
    single: operator; - (minus)
@@ -1275,6 +1312,8 @@
 The ``-`` (subtraction) operator yields the difference of its arguments.  The
 numeric arguments are first converted to a common type.
 
+This operation can be customized using the special :meth:`__sub__` method.
+
 
 .. _shifting:
 
@@ -1294,6 +1333,9 @@
 These operators accept integers as arguments.  They shift the first argument to
 the left or right by the number of bits given by the second argument.
 
+This operation can be customized using the special :meth:`__lshift__` and
+:meth:`__rshift__` methods.
+
 .. index:: exception: ValueError
 
 A right shift by *n* bits is defined as floor division by ``pow(2,n)``.  A left
@@ -1319,7 +1361,8 @@
    operator: & (ampersand)
 
 The ``&`` operator yields the bitwise AND of its arguments, which must be
-integers.
+integers or one of them must be a custom object overriding :meth:`__and__` or
+:meth:`__rand__` special methods.
 
 .. index::
    pair: bitwise; xor
@@ -1327,7 +1370,8 @@
    operator: ^ (caret)
 
 The ``^`` operator yields the bitwise XOR (exclusive OR) of its arguments, which
-must be integers.
+must be integers or one of them must be a custom object overriding :meth:`__xor__` or
+:meth:`__rxor__` special methods.
 
 .. index::
    pair: bitwise; or
@@ -1335,7 +1379,8 @@
    operator: | (vertical bar)
 
 The ``|`` operator yields the bitwise (inclusive) OR of its arguments, which
-must be integers.
+must be integers or one of them must be a custom object overriding :meth:`__or__` or
+:meth:`__ror__` special methods.
 
 
 .. _comparisons:
@@ -1363,7 +1408,9 @@
    comp_operator: "<" | ">" | "==" | ">=" | "<=" | "!="
                 : | "is" ["not"] | ["not"] "in"
 
-Comparisons yield boolean values: ``True`` or ``False``.
+Comparisons yield boolean values: ``True`` or ``False``. Custom
+:dfn:`rich comparison methods` may return non-boolean values. In this case
+Python will call :func:`bool` on such value in boolean contexts.
 
 .. index:: pair: chaining; comparisons
 
@@ -1660,8 +1707,9 @@
    assignment_expression: [`identifier` ":="] `expression`
 
 An assignment expression (sometimes also called a "named expression" or
-"walrus") assigns an :token:`expression` to an :token:`identifier`, while also
-returning the value of the :token:`expression`.
+"walrus") assigns an :token:`~python-grammar:expression` to an
+:token:`~python-grammar:identifier`, while also returning the value of the
+:token:`~python-grammar:expression`.
 
 One common use case is when handling matched regular expressions:
 
@@ -1695,7 +1743,6 @@
 .. productionlist:: python-grammar
    conditional_expression: `or_test` ["if" `or_test` "else" `expression`]
    expression: `conditional_expression` | `lambda_expr`
-   expression_nocond: `or_test` | `lambda_expr_nocond`
 
 Conditional expressions (sometimes called a "ternary operator") have the lowest
 priority of all Python operations.
@@ -1721,7 +1768,6 @@
 
 .. productionlist:: python-grammar
    lambda_expr: "lambda" [`parameter_list`] ":" `expression`
-   lambda_expr_nocond: "lambda" [`parameter_list`] ":" `expression_nocond`
 
 Lambda expressions (sometimes called lambda forms) are used to create anonymous
 functions. The expression ``lambda parameters: expression`` yields a function
@@ -1809,8 +1855,8 @@
 .. index::
    pair: operator; precedence
 
-The following table summarizes the operator precedence in Python, from lowest
-precedence (least binding) to highest precedence (most binding).  Operators in
+The following table summarizes the operator precedence in Python, from highest
+precedence (most binding) to lowest precedence (least binding).  Operators in
 the same box have the same precedence.  Unless the syntax is explicitly given,
 operators are binary.  Operators in the same box group left to right (except for
 exponentiation, which groups from right to left).
@@ -1823,51 +1869,51 @@
 +-----------------------------------------------+-------------------------------------+
 | Operator                                      | Description                         |
 +===============================================+=====================================+
-| ``:=``                                        | Assignment expression               |
-+-----------------------------------------------+-------------------------------------+
-| :keyword:`lambda`                             | Lambda expression                   |
-+-----------------------------------------------+-------------------------------------+
-| :keyword:`if <if_expr>` -- :keyword:`!else`   | Conditional expression              |
-+-----------------------------------------------+-------------------------------------+
-| :keyword:`or`                                 | Boolean OR                          |
-+-----------------------------------------------+-------------------------------------+
-| :keyword:`and`                                | Boolean AND                         |
-+-----------------------------------------------+-------------------------------------+
-| :keyword:`not` ``x``                          | Boolean NOT                         |
-+-----------------------------------------------+-------------------------------------+
-| :keyword:`in`, :keyword:`not in`,             | Comparisons, including membership   |
-| :keyword:`is`, :keyword:`is not`, ``<``,      | tests and identity tests            |
-| ``<=``, ``>``, ``>=``, ``!=``, ``==``         |                                     |
-+-----------------------------------------------+-------------------------------------+
-| ``|``                                         | Bitwise OR                          |
-+-----------------------------------------------+-------------------------------------+
-| ``^``                                         | Bitwise XOR                         |
-+-----------------------------------------------+-------------------------------------+
-| ``&``                                         | Bitwise AND                         |
-+-----------------------------------------------+-------------------------------------+
-| ``<<``, ``>>``                                | Shifts                              |
-+-----------------------------------------------+-------------------------------------+
-| ``+``, ``-``                                  | Addition and subtraction            |
-+-----------------------------------------------+-------------------------------------+
-| ``*``, ``@``, ``/``, ``//``, ``%``            | Multiplication, matrix              |
-|                                               | multiplication, division, floor     |
-|                                               | division, remainder [#]_            |
-+-----------------------------------------------+-------------------------------------+
-| ``+x``, ``-x``, ``~x``                        | Positive, negative, bitwise NOT     |
-+-----------------------------------------------+-------------------------------------+
-| ``**``                                        | Exponentiation [#]_                 |
-+-----------------------------------------------+-------------------------------------+
-| :keyword:`await` ``x``                        | Await expression                    |
-+-----------------------------------------------+-------------------------------------+
-| ``x[index]``, ``x[index:index]``,             | Subscription, slicing,              |
-| ``x(arguments...)``, ``x.attribute``          | call, attribute reference           |
-+-----------------------------------------------+-------------------------------------+
 | ``(expressions...)``,                         | Binding or parenthesized            |
 |                                               | expression,                         |
 | ``[expressions...]``,                         | list display,                       |
 | ``{key: value...}``,                          | dictionary display,                 |
 | ``{expressions...}``                          | set display                         |
 +-----------------------------------------------+-------------------------------------+
+| ``x[index]``, ``x[index:index]``,             | Subscription, slicing,              |
+| ``x(arguments...)``, ``x.attribute``          | call, attribute reference           |
++-----------------------------------------------+-------------------------------------+
+| :keyword:`await` ``x``                        | Await expression                    |
++-----------------------------------------------+-------------------------------------+
+| ``**``                                        | Exponentiation [#]_                 |
++-----------------------------------------------+-------------------------------------+
+| ``+x``, ``-x``, ``~x``                        | Positive, negative, bitwise NOT     |
++-----------------------------------------------+-------------------------------------+
+| ``*``, ``@``, ``/``, ``//``, ``%``            | Multiplication, matrix              |
+|                                               | multiplication, division, floor     |
+|                                               | division, remainder [#]_            |
++-----------------------------------------------+-------------------------------------+
+| ``+``, ``-``                                  | Addition and subtraction            |
++-----------------------------------------------+-------------------------------------+
+| ``<<``, ``>>``                                | Shifts                              |
++-----------------------------------------------+-------------------------------------+
+| ``&``                                         | Bitwise AND                         |
++-----------------------------------------------+-------------------------------------+
+| ``^``                                         | Bitwise XOR                         |
++-----------------------------------------------+-------------------------------------+
+| ``|``                                         | Bitwise OR                          |
++-----------------------------------------------+-------------------------------------+
+| :keyword:`in`, :keyword:`not in`,             | Comparisons, including membership   |
+| :keyword:`is`, :keyword:`is not`, ``<``,      | tests and identity tests            |
+| ``<=``, ``>``, ``>=``, ``!=``, ``==``         |                                     |
++-----------------------------------------------+-------------------------------------+
+| :keyword:`not` ``x``                          | Boolean NOT                         |
++-----------------------------------------------+-------------------------------------+
+| :keyword:`and`                                | Boolean AND                         |
++-----------------------------------------------+-------------------------------------+
+| :keyword:`or`                                 | Boolean OR                          |
++-----------------------------------------------+-------------------------------------+
+| :keyword:`if <if_expr>` -- :keyword:`!else`   | Conditional expression              |
++-----------------------------------------------+-------------------------------------+
+| :keyword:`lambda`                             | Lambda expression                   |
++-----------------------------------------------+-------------------------------------+
+| ``:=``                                        | Assignment expression               |
++-----------------------------------------------+-------------------------------------+
 
 
 .. rubric:: Footnotes
@@ -1910,8 +1956,8 @@
    the :keyword:`is` operator, like those involving comparisons between instance
    methods, or constants.  Check their documentation for more info.
 
-.. [#] The ``%`` operator is also used for string formatting; the same
-   precedence applies.
-
 .. [#] The power operator ``**`` binds less tightly than an arithmetic or
    bitwise unary operator on its right, that is, ``2**-1`` is ``0.5``.
+
+.. [#] The ``%`` operator is also used for string formatting; the same
+   precedence applies.
diff --git a/Doc/reference/grammar.rst b/Doc/reference/grammar.rst
index acf8376..59b4500 100644
--- a/Doc/reference/grammar.rst
+++ b/Doc/reference/grammar.rst
@@ -13,7 +13,8 @@
 group indicates a positive lookahead (i.e., is required to match but
 not consumed), while ``!`` indicates a negative lookahead (i.e., is
 required _not_ to match).  We use the ``|`` separator to mean PEG's
-"ordered choice" (written as ``/`` in traditional PEG grammars).
+"ordered choice" (written as ``/`` in traditional PEG grammars). See
+:pep:`617` for more details on the grammar's syntax.
 
 .. literalinclude:: ../../Grammar/python.gram
   :language: peg
diff --git a/Doc/reference/import.rst b/Doc/reference/import.rst
index c595242..c01535d 100644
--- a/Doc/reference/import.rst
+++ b/Doc/reference/import.rst
@@ -84,9 +84,9 @@
 
 All modules have a name.  Subpackage names are separated from their parent
 package name by a dot, akin to Python's standard attribute access syntax.  Thus
-you might have a module called :mod:`sys` and a package called :mod:`email`,
-which in turn has a subpackage called :mod:`email.mime` and a module within
-that subpackage called :mod:`email.mime.text`.
+you might have a package called :mod:`email`, which in turn has a subpackage
+called :mod:`email.mime` and a module within that subpackage called
+:mod:`email.mime.text`.
 
 
 Regular packages
@@ -329,6 +329,10 @@
    import machinery will try it only if the finder does not implement
    ``find_spec()``.
 
+.. versionchanged:: 3.10
+   Use of :meth:`~importlib.abc.MetaPathFinder.find_module` by the import system
+   now raises :exc:`ImportWarning`.
+
 
 Loading
 =======
@@ -470,6 +474,9 @@
    An :exc:`ImportError` is raised when ``exec_module()`` is defined but
    ``create_module()`` is not.
 
+.. versionchanged:: 3.10
+   Use of ``load_module()`` will raise :exc:`ImportWarning`.
+
 Submodules
 ----------
 
@@ -675,6 +682,13 @@
    :meth:`~importlib.abc.Loader.module_repr` method, if defined, before
    trying either approach described above.  However, the method is deprecated.
 
+.. versionchanged:: 3.10
+
+   Calling :meth:`~importlib.abc.Loader.module_repr` now occurs after trying to
+   use a module's ``__spec__`` attribute but before falling back on
+   ``__file__``. Use of :meth:`~importlib.abc.Loader.module_repr` is slated to
+   stop in Python 3.12.
+
 .. _pyc-invalidation:
 
 Cached bytecode invalidation
@@ -889,6 +903,11 @@
    exist on a path entry finder, the import system will always call
    ``find_loader()`` in preference to ``find_module()``.
 
+.. versionchanged:: 3.10
+    Calls to :meth:`~importlib.abc.PathEntryFinder.find_module` and
+    :meth:`~importlib.abc.PathEntryFinder.find_loader` by the import
+    system will raise :exc:`ImportWarning`.
+
 
 Replacing the standard import system
 ====================================
@@ -951,6 +970,8 @@
 not a valid expression.
 
 
+.. _import-dunder-main:
+
 Special considerations for __main__
 ===================================
 
diff --git a/Doc/reference/lexical_analysis.rst b/Doc/reference/lexical_analysis.rst
index 77e0578..21ad373 100644
--- a/Doc/reference/lexical_analysis.rst
+++ b/Doc/reference/lexical_analysis.rst
@@ -351,6 +351,27 @@
    assert     del        global     not        with
    async      elif       if         or         yield
 
+
+.. _soft-keywords:
+
+Soft Keywords
+-------------
+
+.. index:: soft keyword, keyword
+
+.. versionadded:: 3.10
+
+Some identifiers are only reserved under specific contexts. These are known as
+*soft keywords*.  The identifiers ``match``, ``case`` and ``_`` can
+syntactically act as keywords in contexts related to the pattern matching
+statement, but this distinction is done at the parser level, not when
+tokenizing.
+
+As soft keywords, their use with pattern matching is possible while still
+preserving compatibility with existing code that uses ``match``, ``case`` and ``_`` as
+identifier names.
+
+
 .. index::
    single: _, identifiers
    single: __, identifiers
@@ -364,10 +385,20 @@
 characters:
 
 ``_*``
-   Not imported by ``from module import *``.  The special identifier ``_`` is used
-   in the interactive interpreter to store the result of the last evaluation; it is
-   stored in the :mod:`builtins` module.  When not in interactive mode, ``_``
-   has no special meaning and is not defined. See section :ref:`import`.
+   Not imported by ``from module import *``.
+
+``_``
+   In a ``case`` pattern within a :keyword:`match` statement, ``_`` is a
+   :ref:`soft keyword <soft-keywords>` that denotes a
+   :ref:`wildcard <wildcard-patterns>`.
+
+   Separately, the interactive interpreter makes the result of the last evaluation
+   available in the variable ``_``.
+   (It is stored in the :mod:`builtins` module, alongside built-in
+   functions like ``print``.)
+
+   Elsewhere, ``_`` is a regular identifier. It is often used to name
+   "special" items, but it is not special to Python itself.
 
    .. note::
 
@@ -375,6 +406,8 @@
       refer to the documentation for the :mod:`gettext` module for more
       information on this convention.
 
+      It is also commonly used for unused variables.
+
 ``__*__``
    System-defined names, informally known as "dunder" names. These names are
    defined by the interpreter and its implementation (including the standard library).
@@ -436,10 +469,10 @@
    bytesescapeseq: "\" <any ASCII character>
 
 One syntactic restriction not indicated by these productions is that whitespace
-is not allowed between the :token:`stringprefix` or :token:`bytesprefix` and the
-rest of the literal. The source character set is defined by the encoding
-declaration; it is UTF-8 if no encoding declaration is given in the source file;
-see section :ref:`encodings`.
+is not allowed between the :token:`~python-grammar:stringprefix` or
+:token:`~python-grammar:bytesprefix` and the rest of the literal. The source
+character set is defined by the encoding declaration; it is UTF-8 if no encoding
+declaration is given in the source file; see section :ref:`encodings`.
 
 .. index:: triple-quoted string, Unicode Consortium, raw string
    single: """; string literal
diff --git a/Doc/reference/simple_stmts.rst b/Doc/reference/simple_stmts.rst
index f8ab2e9..92dfcb0 100644
--- a/Doc/reference/simple_stmts.rst
+++ b/Doc/reference/simple_stmts.rst
@@ -563,10 +563,10 @@
 .. productionlist:: python-grammar
    raise_stmt: "raise" [`expression` ["from" `expression`]]
 
-If no expressions are present, :keyword:`raise` re-raises the last exception
-that was active in the current scope.  If no exception is active in the current
-scope, a :exc:`RuntimeError` exception is raised indicating that this is an
-error.
+If no expressions are present, :keyword:`raise` re-raises the
+exception that is currently being handled, which is also known as the *active exception*.
+If there isn't currently an active exception, a :exc:`RuntimeError` exception is raised
+indicating that this is an error.
 
 Otherwise, :keyword:`raise` evaluates the first expression as the exception
 object.  It must be either a subclass or an instance of :class:`BaseException`.
@@ -581,8 +581,8 @@
 A traceback object is normally created automatically when an exception is raised
 and attached to it as the :attr:`__traceback__` attribute, which is writable.
 You can create an exception and set your own traceback in one step using the
-:meth:`with_traceback` exception method (which returns the same exception
-instance, with its traceback set to its argument), like so::
+:meth:`~BaseException.with_traceback` exception method (which returns the
+same exception instance, with its traceback set to its argument), like so::
 
    raise Exception("foo occurred").with_traceback(tracebackobj)
 
@@ -591,10 +591,13 @@
            __context__ (exception attribute)
 
 The ``from`` clause is used for exception chaining: if given, the second
-*expression* must be another exception class or instance, which will then be
-attached to the raised exception as the :attr:`__cause__` attribute (which is
-writable).  If the raised exception is not handled, both exceptions will be
-printed::
+*expression* must be another exception class or instance. If the second
+expression is an exception instance, it will be attached to the raised
+exception as the :attr:`__cause__` attribute (which is writable). If the
+expression is an exception class, the class will be instantiated and the
+resulting exception instance will be attached to the raised exception as the
+:attr:`__cause__` attribute. If the raised exception is not handled, both
+exceptions will be printed::
 
    >>> try:
    ...     print(1 / 0)
@@ -611,8 +614,10 @@
      File "<stdin>", line 4, in <module>
    RuntimeError: Something bad happened
 
-A similar mechanism works implicitly if an exception is raised inside an
-exception handler or a :keyword:`finally` clause: the previous exception is then
+A similar mechanism works implicitly if a new exception is raised when
+an exception is already being handled.  An exception may be handled
+when an :keyword:`except` or :keyword:`finally` clause, or a
+:keyword:`with` statement, is used.  The previous exception is then
 attached as the new exception's :attr:`__context__` attribute::
 
    >>> try:
@@ -731,7 +736,7 @@
               : ("," `identifier` ["as" `identifier`])*
               : | "from" `relative_module` "import" "(" `identifier` ["as" `identifier`]
               : ("," `identifier` ["as" `identifier`])* [","] ")"
-              : | "from" `module` "import" "*"
+              : | "from" `relative_module` "import" "*"
    module: (`identifier` ".")* `identifier`
    relative_module: "."* `module` | "."+
 
@@ -950,7 +955,7 @@
 block textually preceding that :keyword:`!global` statement.
 
 Names listed in a :keyword:`global` statement must not be defined as formal
-parameters or in a :keyword:`for` loop control target, :keyword:`class`
+parameters, or as targets in :keyword:`with` statements or :keyword:`except` clauses, or in a :keyword:`for` target list, :keyword:`class`
 definition, function definition, :keyword:`import` statement, or variable
 annotation.
 
diff --git a/Doc/requirements.txt b/Doc/requirements.txt
index 47b78ee..95d320f 100644
--- a/Doc/requirements.txt
+++ b/Doc/requirements.txt
@@ -3,10 +3,14 @@
 # Sphinx version is pinned so that new versions that introduce new warnings
 # won't suddenly cause build failures. Updating the version is fine as long
 # as no warnings are raised by doing so.
-sphinx==2.4.4
+sphinx==3.2.1
+# Docutils version is pinned to a version compatible with Sphinx
+# version 3.2.1. It can be removed after bumping Sphinx version to at
+# least 3.5.4.
+docutils==0.17.1
 
 blurb
 
 # The theme used by the documentation is stored separately, so we need
 # to install that as well.
-python-docs-theme
+python-docs-theme>=2022.1
diff --git a/Doc/tools/extensions/c_annotations.py b/Doc/tools/extensions/c_annotations.py
index 76c9d92..489f066 100644
--- a/Doc/tools/extensions/c_annotations.py
+++ b/Doc/tools/extensions/c_annotations.py
@@ -10,8 +10,10 @@
 
     * stable API annotations
 
-    Usage: Set the `refcount_file` config value to the path to the reference
+    Usage:
+    * Set the `refcount_file` config value to the path to the reference
     count data file.
+    * Set the `stable_abi_file` config value to the path to stable ABI list.
 
     :copyright: Copyright 2007-2014 by Georg Brandl.
     :license: Python license.
@@ -20,11 +22,23 @@
 from os import path
 from docutils import nodes
 from docutils.parsers.rst import directives
+from docutils.parsers.rst import Directive
+from docutils.statemachine import StringList
+import csv
 
 from sphinx import addnodes
 from sphinx.domains.c import CObject
 
 
+REST_ROLE_MAP = {
+    'function': 'func',
+    'var': 'data',
+    'type': 'type',
+    'macro': 'macro',
+    'type': 'type',
+}
+
+
 class RCEntry:
     def __init__(self, name):
         self.name = name
@@ -33,12 +47,10 @@
         self.result_refs = None
 
 
-class Annotations(dict):
-    @classmethod
-    def fromfile(cls, filename):
-        d = cls()
-        fp = open(filename, 'r')
-        try:
+class Annotations:
+    def __init__(self, refcount_filename, stable_abi_file):
+        self.refcount_data = {}
+        with open(refcount_filename, 'r') as fp:
             for line in fp:
                 line = line.strip()
                 if line[:1] in ("", "#"):
@@ -50,9 +62,9 @@
                 function, type, arg, refcount, comment = parts
                 # Get the entry, creating it if needed:
                 try:
-                    entry = d[function]
+                    entry = self.refcount_data[function]
                 except KeyError:
-                    entry = d[function] = RCEntry(function)
+                    entry = self.refcount_data[function] = RCEntry(function)
                 if not refcount or refcount == "null":
                     refcount = None
                 else:
@@ -64,27 +76,58 @@
                 else:
                     entry.result_type = type
                     entry.result_refs = refcount
-        finally:
-            fp.close()
-        return d
+
+        self.stable_abi_data = {}
+        with open(stable_abi_file, 'r') as fp:
+            for record in csv.DictReader(fp):
+                role = record['role']
+                name = record['name']
+                self.stable_abi_data[name] = record
 
     def add_annotations(self, app, doctree):
         for node in doctree.traverse(addnodes.desc_content):
             par = node.parent
             if par['domain'] != 'c':
                 continue
-            if par['stableabi']:
-                node.insert(0, nodes.emphasis(' Part of the stable ABI.',
-                                              ' Part of the stable ABI.',
-                                              classes=['stableabi']))
-            if par['objtype'] != 'function':
-                continue
             if not par[0].has_key('ids') or not par[0]['ids']:
                 continue
             name = par[0]['ids'][0]
             if name.startswith("c."):
                 name = name[2:]
-            entry = self.get(name)
+
+            objtype = par['objtype']
+
+            # Stable ABI annotation. These have two forms:
+            #   Part of the [Stable ABI](link).
+            #   Part of the [Stable ABI](link) since version X.Y.
+            record = self.stable_abi_data.get(name)
+            if record:
+                if record['role'] != objtype:
+                    raise ValueError(
+                        f"Object type mismatch in limited API annotation "
+                        f"for {name}: {record['role']!r} != {objtype!r}")
+                stable_added = record['added']
+                message = ' Part of the '
+                emph_node = nodes.emphasis(message, message,
+                                           classes=['stableabi'])
+                ref_node = addnodes.pending_xref(
+                    'Stable ABI', refdomain="std", reftarget='stable',
+                    reftype='ref', refexplicit="False")
+                ref_node += nodes.Text('Stable ABI')
+                emph_node += ref_node
+                if record['ifdef_note']:
+                    emph_node += nodes.Text(' ' + record['ifdef_note'])
+                if stable_added == '3.2':
+                    # Stable ABI was introduced in 3.2.
+                    emph_node += nodes.Text('.')
+                else:
+                    emph_node += nodes.Text(f' since version {stable_added}.')
+                node.insert(0, emph_node)
+
+            # Return value annotation
+            if objtype != 'function':
+                continue
+            entry = self.refcount_data.get(name)
             if not entry:
                 continue
             elif not entry.result_type.endswith("Object*"):
@@ -99,13 +142,36 @@
 
 
 def init_annotations(app):
-    refcounts = Annotations.fromfile(
-        path.join(app.srcdir, app.config.refcount_file))
-    app.connect('doctree-read', refcounts.add_annotations)
+    annotations = Annotations(
+        path.join(app.srcdir, app.config.refcount_file),
+        path.join(app.srcdir, app.config.stable_abi_file),
+    )
+    app.connect('doctree-read', annotations.add_annotations)
+
+    class LimitedAPIList(Directive):
+
+        has_content = False
+        required_arguments = 0
+        optional_arguments = 0
+        final_argument_whitespace = True
+
+        def run(self):
+            content = []
+            for record in annotations.stable_abi_data.values():
+                role = REST_ROLE_MAP[record['role']]
+                name = record['name']
+                content.append(f'* :c:{role}:`{name}`')
+
+            pnode = nodes.paragraph()
+            self.state.nested_parse(StringList(content), 0, pnode)
+            return [pnode]
+
+    app.add_directive('limited-api-list', LimitedAPIList)
 
 
 def setup(app):
     app.add_config_value('refcount_file', '', True)
+    app.add_config_value('stable_abi_file', '', True)
     app.connect('builder-inited', init_annotations)
 
     # monkey-patch C object...
diff --git a/Doc/tools/extensions/escape4chm.py b/Doc/tools/extensions/escape4chm.py
index e999971..8997097 100644
--- a/Doc/tools/extensions/escape4chm.py
+++ b/Doc/tools/extensions/escape4chm.py
@@ -5,6 +5,7 @@
 https://bugs.python.org/issue32174
 """
 
+import pathlib
 import re
 from html.entities import codepoint2name
 
@@ -39,12 +40,12 @@
         return
 
     getLogger(__name__).info('fixing HTML escapes in keywords file...')
-    outdir = app.builder.outdir
+    outdir = pathlib.Path(app.builder.outdir)
     outname = app.builder.config.htmlhelp_basename
-    with app.builder.open_file(outdir, outname + '.hhk', 'r') as f:
+    with open(outdir / (outname + '.hhk'), 'rb') as f:
         index = f.read()
-    with app.builder.open_file(outdir, outname + '.hhk', 'w') as f:
-        f.write(index.replace('&#x27;', '&#39;'))
+    with open(outdir / (outname + '.hhk'), 'wb') as f:
+        f.write(index.replace(b'&#x27;', b'&#39;'))
 
 def setup(app):
     # `html-page-context` event emitted when the HTML builder has
diff --git a/Doc/tools/extensions/glossary_search.py b/Doc/tools/extensions/glossary_search.py
new file mode 100644
index 0000000..59a6862
--- /dev/null
+++ b/Doc/tools/extensions/glossary_search.py
@@ -0,0 +1,63 @@
+# -*- coding: utf-8 -*-
+"""
+    glossary_search.py
+    ~~~~~~~~~~~~~~~~
+
+    Feature search results for glossary items prominently.
+
+    :license: Python license.
+"""
+import json
+import os.path
+from docutils.nodes import definition_list_item
+from sphinx.addnodes import glossary
+from sphinx.util import logging
+
+
+logger = logging.getLogger(__name__)
+STATIC_DIR = '_static'
+JSON = 'glossary.json'
+
+
+def process_glossary_nodes(app, doctree, fromdocname):
+    if app.builder.format != 'html':
+        return
+
+    terms = {}
+
+    for node in doctree.traverse(glossary):
+        for glossary_item in node.traverse(definition_list_item):
+            term = glossary_item[0].astext().lower()
+            definition = glossary_item[1]
+
+            rendered = app.builder.render_partial(definition)
+            terms[term] = {
+                'title': glossary_item[0].astext(),
+                'body': rendered['html_body']
+            }
+
+    if hasattr(app.env, 'glossary_terms'):
+        app.env.glossary_terms.update(terms)
+    else:
+        app.env.glossary_terms = terms
+
+def on_build_finish(app, exc):
+    if not hasattr(app.env, 'glossary_terms'):
+        return
+    if not app.env.glossary_terms:
+        return
+
+    logger.info(f'Writing {JSON}', color='green')
+
+    dest_dir = os.path.join(app.outdir, STATIC_DIR)
+    os.makedirs(dest_dir, exist_ok=True)
+
+    with open(os.path.join(dest_dir, JSON), 'w') as f:
+        json.dump(app.env.glossary_terms, f)
+
+
+def setup(app):
+    app.connect('doctree-resolved', process_glossary_nodes)
+    app.connect('build-finished', on_build_finish)
+
+    return {'version': '0.1', 'parallel_read_safe': True}
diff --git a/Doc/tools/extensions/peg_highlight.py b/Doc/tools/extensions/peg_highlight.py
index 8bc2467..27f54cd 100644
--- a/Doc/tools/extensions/peg_highlight.py
+++ b/Doc/tools/extensions/peg_highlight.py
@@ -27,6 +27,12 @@
     tokens = {
         "ws": [(r"\n", Text), (r"\s+", Text), (r"#.*$", Comment.Singleline),],
         "lookaheads": [
+            # Forced tokens
+            (r"(&&)(?=\w+\s?)", bygroups(None)),
+            (r"(&&)(?='.+'\s?)", bygroups(None)),
+            (r'(&&)(?=".+"\s?)', bygroups(None)),
+            (r"(&&)(?=\(.+\)\s?)", bygroups(None)),
+
             (r"(?<=\|\s)(&\w+\s?)", bygroups(None)),
             (r"(?<=\|\s)(&'.+'\s?)", bygroups(None)),
             (r'(?<=\|\s)(&".+"\s?)', bygroups(None)),
@@ -36,17 +42,22 @@
             (r"(@\w+ '''(.|\n)+?''')", bygroups(None)),
             (r"^(@.*)$", bygroups(None)),
         ],
-        "actions": [(r"{(.|\n)+?}", bygroups(None)),],
+        "actions": [
+            (r"{(.|\n)+?}", bygroups(None)),
+        ],
         "strings": [
             (r"'\w+?'", Keyword),
             (r'"\w+?"', Keyword),
             (r"'\W+?'", Text),
             (r'"\W+?"', Text),
         ],
-        "variables": [(_name + _text_ws + "(=)", bygroups(None, None, None),),],
+        "variables": [
+            (_name + _text_ws + "(=)", bygroups(None, None, None),),
+            (_name + _text_ws + r"(\[[\w\d_\*]+?\])" + _text_ws + "(=)", bygroups(None, None, None, None, None),),
+        ],
         "invalids": [
-            (r"^(\s+\|\s+invalid_\w+\s*\n)", bygroups(None)),
-            (r"^(\s+\|\s+incorrect_\w+\s*\n)", bygroups(None)),
+            (r"^(\s+\|\s+.*invalid_\w+.*\n)", bygroups(None)),
+            (r"^(\s+\|\s+.*incorrect_\w+.*\n)", bygroups(None)),
             (r"^(#.*invalid syntax.*(?:.|\n)*)", bygroups(None),),
         ],
         "root": [
diff --git a/Doc/tools/extensions/pyspecific.py b/Doc/tools/extensions/pyspecific.py
index 2fad9ec..92fc5e7 100644
--- a/Doc/tools/extensions/pyspecific.py
+++ b/Doc/tools/extensions/pyspecific.py
@@ -44,7 +44,7 @@
 
 
 ISSUE_URI = 'https://bugs.python.org/issue%s'
-SOURCE_URI = 'https://github.com/python/cpython/tree/3.9/%s'
+SOURCE_URI = 'https://github.com/python/cpython/tree/3.10/%s'
 
 # monkey-patch reST parser to disable alphabetic and roman enumerated lists
 from docutils.parsers.rst.states import Body
@@ -130,6 +130,39 @@
 
 # Support for documenting audit event
 
+def audit_events_purge(app, env, docname):
+    """This is to remove from env.all_audit_events old traces of removed
+    documents.
+    """
+    if not hasattr(env, 'all_audit_events'):
+        return
+    fresh_all_audit_events = {}
+    for name, event in env.all_audit_events.items():
+        event["source"] = [(d, t) for d, t in event["source"] if d != docname]
+        if event["source"]:
+            # Only keep audit_events that have at least one source.
+            fresh_all_audit_events[name] = event
+    env.all_audit_events = fresh_all_audit_events
+
+
+def audit_events_merge(app, env, docnames, other):
+    """In Sphinx parallel builds, this merges env.all_audit_events from
+    subprocesses.
+
+    all_audit_events is a dict of names, with values like:
+    {'source': [(docname, target), ...], 'args': args}
+    """
+    if not hasattr(other, 'all_audit_events'):
+        return
+    if not hasattr(env, 'all_audit_events'):
+        env.all_audit_events = {}
+    for name, value in other.all_audit_events.items():
+        if name in env.all_audit_events:
+            env.all_audit_events[name]["source"].extend(value["source"])
+        else:
+            env.all_audit_events[name] = value
+
+
 class AuditEvent(Directive):
 
     has_content = True
@@ -191,6 +224,7 @@
         info['source'].append((env.docname, target))
 
         pnode = nodes.paragraph(text, classes=["audit-hook"], ids=ids)
+        pnode.line = self.lineno
         if self.content:
             self.state.nested_parse(self.content, self.content_offset, pnode)
         else:
@@ -361,7 +395,12 @@
                                    translatable=False)
             node.append(para)
         env = self.state.document.settings.env
-        env.get_domain('changeset').note_changeset(node)
+        # deprecated pre-Sphinx-2 method
+        if hasattr(env, 'note_versionchange'):
+            env.note_versionchange('deprecated', version[0], node, self.lineno)
+        # new method
+        else:
+            env.get_domain('changeset').note_changeset(node)
         return [node] + messages
 
 
@@ -595,4 +634,6 @@
     app.add_directive_to_domain('py', 'abstractmethod', PyAbstractMethod)
     app.add_directive('miscnews', MiscNews)
     app.connect('doctree-resolved', process_audit_events)
+    app.connect('env-merge-info', audit_events_merge)
+    app.connect('env-purge-doc', audit_events_purge)
     return {'version': '1.0', 'parallel_read_safe': True}
diff --git a/Doc/tools/rstlint.py b/Doc/tools/rstlint.py
index a3024d6..3092a3b 100755
--- a/Doc/tools/rstlint.py
+++ b/Doc/tools/rstlint.py
@@ -13,6 +13,7 @@
 import re
 import sys
 import getopt
+from string import ascii_letters
 from os.path import join, splitext, abspath, exists
 from collections import defaultdict
 
@@ -128,6 +129,81 @@
             yield lno+1, 'possibly leaked markup: %r' % line
 
 
+def hide_literal_blocks(lines):
+    """Tool to remove literal blocks from given lines.
+
+    It yields empty lines in place of blocks, so line numbers are
+    still meaningful.
+    """
+    in_block = False
+    for line in lines:
+        if line.endswith("::\n"):
+            in_block = True
+        elif in_block:
+            if line == "\n" or line.startswith(" "):
+                line = "\n"
+            else:
+                in_block = False
+        yield line
+
+
+def type_of_explicit_markup(line):
+    if re.match(fr'\.\. {all_directives}::', line):
+        return 'directive'
+    if re.match(r'\.\. \[[0-9]+\] ', line):
+        return 'footnote'
+    if re.match(r'\.\. \[[^\]]+\] ', line):
+        return 'citation'
+    if re.match(r'\.\. _.*[^_]: ', line):
+        return 'target'
+    if re.match(r'\.\. \|[^\|]*\| ', line):
+        return 'substitution_definition'
+    return 'comment'
+
+
+def hide_comments(lines):
+    """Tool to remove comments from given lines.
+
+    It yields empty lines in place of comments, so line numbers are
+    still meaningful.
+    """
+    in_multiline_comment = False
+    for line in lines:
+        if line == "..\n":
+            in_multiline_comment = True
+        elif in_multiline_comment:
+            if line == "\n" or line.startswith(" "):
+                line = "\n"
+            else:
+                in_multiline_comment = False
+        if line.startswith(".. ") and type_of_explicit_markup(line) == 'comment':
+            line = "\n"
+        yield line
+
+
+
+@checker(".rst", severity=2)
+def check_missing_surrogate_space_on_plural(fn, lines):
+    r"""Check for missing 'backslash-space' between a code sample a letter.
+
+    Good: ``Point``\ s
+    Bad: ``Point``s
+    """
+    in_code_sample = False
+    check_next_one = False
+    for lno, line in enumerate(hide_comments(hide_literal_blocks(lines))):
+        tokens = line.split("``")
+        for token_no, token in enumerate(tokens):
+            if check_next_one:
+                if token[0] in ascii_letters:
+                    yield lno + 1, f"Missing backslash-space between code sample and {token!r}."
+                check_next_one = False
+            if token_no == len(tokens) - 1:
+                continue
+            if in_code_sample:
+                check_next_one = True
+            in_code_sample = not in_code_sample
+
 def main(argv):
     usage = '''\
 Usage: %s [-v] [-f] [-s sev] [-i path]* [path]
diff --git a/Doc/tools/static/switchers.js b/Doc/tools/static/switchers.js
deleted file mode 100644
index 1a1c7d0..0000000
--- a/Doc/tools/static/switchers.js
+++ /dev/null
@@ -1,156 +0,0 @@
-(function() {
-  'use strict';
-
-  // Parses versions in URL segments like:
-  // "3", "dev", "release/2.7" or "3.6rc2"
-  var version_regexs = [
-    '(?:\\d)',
-    '(?:\\d\\.\\d[\\w\\d\\.]*)',
-    '(?:dev)',
-    '(?:release/\\d.\\d[\\x\\d\\.]*)'];
-
-  var all_versions = {
-    '3.10': 'dev (3.10)',
-    '3.9': 'pre (3.9)',
-    '3.8': '3.8',
-    '3.7': '3.7',
-    '3.6': '3.6',
-    '2.7': '2.7',
-  };
-
-  var all_languages = {
-      'en': 'English',
-      'fr': 'French',
-      'ja': 'Japanese',
-      'ko': 'Korean',
-      'pt-br': 'Brazilian Portuguese',
-      'zh-cn': 'Simplified Chinese',
-  };
-
-  function build_version_select(current_version, current_release) {
-    var buf = ['<select>'];
-
-    $.each(all_versions, function(version, title) {
-      buf.push('<option value="' + version + '"');
-      if (version == current_version)
-        buf.push(' selected="selected">' + current_release + '</option>');
-      else
-        buf.push('>' + title + '</option>');
-    });
-
-    buf.push('</select>');
-    return buf.join('');
-  }
-
-  function build_language_select(current_language) {
-    var buf = ['<select>'];
-
-    $.each(all_languages, function(language, title) {
-      if (language == current_language)
-        buf.push('<option value="' + language + '" selected="selected">' +
-                 all_languages[current_language] + '</option>');
-      else
-        buf.push('<option value="' + language + '">' + title + '</option>');
-    });
-    if (!(current_language in all_languages)) {
-        // In case we're browsing a language that is not yet in all_languages.
-        buf.push('<option value="' + current_language + '" selected="selected">' +
-                 current_language + '</option>');
-        all_languages[current_language] = current_language;
-    }
-    buf.push('</select>');
-    return buf.join('');
-  }
-
-  function navigate_to_first_existing(urls) {
-    // Navigate to the first existing URL in urls.
-    var url = urls.shift();
-    if (urls.length == 0) {
-      window.location.href = url;
-      return;
-    }
-    $.ajax({
-      url: url,
-      success: function() {
-        window.location.href = url;
-      },
-      error: function() {
-        navigate_to_first_existing(urls);
-      }
-    });
-  }
-
-  function on_version_switch() {
-    var selected_version = $(this).children('option:selected').attr('value') + '/';
-    var url = window.location.href;
-    var current_language = language_segment_from_url(url);
-    var current_version = version_segment_in_url(url);
-    var new_url = url.replace('.org/' + current_language + current_version,
-                              '.org/' + current_language + selected_version);
-    if (new_url != url) {
-      navigate_to_first_existing([
-        new_url,
-        url.replace('.org/' + current_language + current_version,
-                    '.org/' + selected_version),
-        'https://docs.python.org/' + current_language + selected_version,
-        'https://docs.python.org/' + selected_version,
-        'https://docs.python.org/'
-      ]);
-    }
-  }
-
-  function on_language_switch() {
-    var selected_language = $(this).children('option:selected').attr('value') + '/';
-    var url = window.location.href;
-    var current_language = language_segment_from_url(url);
-    var current_version = version_segment_in_url(url);
-    if (selected_language == 'en/') // Special 'default' case for english.
-      selected_language = '';
-    var new_url = url.replace('.org/' + current_language + current_version,
-                              '.org/' + selected_language + current_version);
-    if (new_url != url) {
-      navigate_to_first_existing([
-        new_url,
-        'https://docs.python.org/'
-      ]);
-    }
-  }
-
-  // Returns the path segment of the language as a string, like 'fr/'
-  // or '' if not found.
-  function language_segment_from_url(url) {
-    var language_regexp = '\.org/([a-z]{2}(?:-[a-z]{2})?/)';
-    var match = url.match(language_regexp);
-    if (match !== null)
-        return match[1];
-    return '';
-  }
-
-  // Returns the path segment of the version as a string, like '3.6/'
-  // or '' if not found.
-  function version_segment_in_url(url) {
-    var language_segment = '(?:[a-z]{2}(?:-[a-z]{2})?/)';
-    var version_segment = '(?:(?:' + version_regexs.join('|') + ')/)';
-    var version_regexp = '\\.org/' + language_segment + '?(' + version_segment + ')';
-    var match = url.match(version_regexp);
-    if (match !== null)
-      return match[1];
-    return ''
-  }
-
-  $(document).ready(function() {
-    var release = DOCUMENTATION_OPTIONS.VERSION;
-    var language_segment = language_segment_from_url(window.location.href);
-    var current_language = language_segment.replace(/\/+$/g, '') || 'en';
-    var version = release.substr(0, 3);
-    var version_select = build_version_select(version, release);
-
-    $('.version_switcher_placeholder').html(version_select);
-    $('.version_switcher_placeholder select').bind('change', on_version_switch);
-
-    var language_select = build_language_select(current_language);
-
-    $('.language_switcher_placeholder').html(language_select);
-    $('.language_switcher_placeholder select').bind('change', on_language_switch);
-  });
-})();
diff --git a/Doc/tools/susp-ignored.csv b/Doc/tools/susp-ignored.csv
index c9777c6..9f4a44f 100644
--- a/Doc/tools/susp-ignored.csv
+++ b/Doc/tools/susp-ignored.csv
@@ -110,11 +110,10 @@
 howto/regex,,::,
 howto/regex,,:foo,(?:foo)
 howto/urllib2,,:password,"""joe:password@example.com"""
+library/__main__,,`,
 library/ast,,:upper,lower:upper
 library/ast,,:step,lower:upper:step
 library/audioop,,:ipos,"# factor = audioop.findfactor(in_test[ipos*2:ipos*2+len(out_test)],"
-library/bisect,32,:hi,all(val >= x for val in a[i:hi])
-library/bisect,42,:hi,all(val > x for val in a[i:hi])
 library/configparser,,:home,my_dir: ${Common:home_dir}/twosheds
 library/configparser,,:option,${section:option}
 library/configparser,,:path,python_dir: ${Frameworks:path}/Python/Versions/${Frameworks:Python}
@@ -151,8 +150,8 @@
 library/ipaddress,,::,>>> ipaddress.IPv6Address('2001:db8::1000')
 library/ipaddress,,:db8,'2001:db8::1000'
 library/ipaddress,,::,'2001:db8::1000'
-library/ipaddress,231,:db8,">>> f'{ipaddress.IPv6Address(""2001:db8::1000""):s}'"
-library/ipaddress,231,::,">>> f'{ipaddress.IPv6Address(""2001:db8::1000""):s}'"
+library/ipaddress,,:db8,">>> f'{ipaddress.IPv6Address(""2001:db8::1000""):s}'"
+library/ipaddress,,::,">>> f'{ipaddress.IPv6Address(""2001:db8::1000""):s}'"
 library/ipaddress,,::,IPv6Address('ff02::5678%1')
 library/ipaddress,,::,fe80::1234
 library/ipaddress,,:db8,">>> ipaddress.ip_address(""2001:db8::1"").reverse_pointer"
@@ -170,6 +169,7 @@
 library/ipaddress,,:db00,2001:db00::0/ffff:ff00::
 library/ipaddress,,::,2001:db00::0/ffff:ff00::
 library/itertools,,:step,elements from seq[start:stop:step]
+library/itertools,,::,kernel = tuple(kernel)[::-1]
 library/itertools,,:stop,elements from seq[start:stop:step]
 library/logging.handlers,,:port,host:port
 library/mmap,,:i2,obj[i1:i2]
@@ -210,10 +210,12 @@
 library/socket,,::,'5aef:2b::8'
 library/socket,,:can,"return (can_id, can_dlc, data[:can_dlc])"
 library/socket,,:len,fds.frombytes(cmsg_data[:len(cmsg_data) - (len(cmsg_data) % fds.itemsize)])
-library/sqlite3,,:age,"cur.execute(""select * from people where name_last=:who and age=:age"", {""who"": who, ""age"": age})"
+library/sqlite3,,:year,"cur.execute(""select * from lang where first_appeared=:year"", {""year"": 1972})"
 library/sqlite3,,:memory,
-library/sqlite3,,:who,"cur.execute(""select * from people where name_last=:who and age=:age"", {""who"": who, ""age"": age})"
-library/sqlite3,,:path,"db = sqlite3.connect('file:path/to/database?mode=ro', uri=True)"
+library/sqlite3,,:template,"con = sqlite3.connect(""file:template.db?mode=ro"", uri=True)"
+library/sqlite3,,:nosuchdb,"con = sqlite3.connect(""file:nosuchdb.db?mode=rw"", uri=True)"
+library/sqlite3,,:mem1,"con1 = sqlite3.connect(""file:mem1?mode=memory&cache=shared"", uri=True)"
+library/sqlite3,,:mem1,"con2 = sqlite3.connect(""file:mem1?mode=memory&cache=shared"", uri=True)"
 library/ssl,,:My,"Organizational Unit Name (eg, section) []:My Group"
 library/ssl,,:My,"Organization Name (eg, company) [Internet Widgits Pty Ltd]:My Organization, Inc."
 library/ssl,,:myserver,"Common Name (eg, YOUR name) []:myserver.mygroup.myorganization.com"
@@ -235,6 +237,12 @@
 library/tarfile,,:xz,'w:xz'
 library/time,,:mm,
 library/time,,:ss,
+library/tkinter,,::,ttk::frame .frm -padding 10
+library/tkinter,,::,"grid [ttk::label .frm.lbl -text ""Hello World!""] -column 0 -row 0"
+library/tkinter,,::,"grid [ttk::button .frm.btn -text ""Quit"" -command ""destroy .""] -column 1 -row 0"
+library/tkinter,,::,ttk::frame
+library/tkinter,,::,ttk::button
+library/tkinter,,::,ttk::widget
 library/tracemalloc,,:limit,"for index, stat in enumerate(top_stats[:limit], 1):"
 library/turtle,,::,Example::
 library/unittest,,:foo,"self.assertEqual(cm.output, ['INFO:foo:first message',"
@@ -266,6 +274,7 @@
 reference/expressions,,:index,x[index:index]
 reference/lexical_analysis,,`,$       ?       `
 reference/lexical_analysis,,:fileencoding,# vim:fileencoding=<encoding-name>
+reference/datamodel,,`,    """Return the result of the expression `obj[x]`"""
 tutorial/datastructures,,:value,It is also possible to delete a key:value
 tutorial/datastructures,,:value,key:value pairs within the braces adds initial key:value pairs
 tutorial/stdlib2,,:config,"logging.warning('Warning:config file %s not found', 'server.conf')"
@@ -280,7 +289,11 @@
 tutorial/stdlib2,,:start,filename = data[start:start+filenamesize]
 tutorial/stdlib2,,:Warning,WARNING:root:Warning:config file server.conf not found
 using/cmdline,,:errorhandler,:errorhandler
-using/cmdline,,:line,file:line: category: message
+using/cmdline,,:message,action:message:category:module:lineno
+using/cmdline,,:category,action:message:category:module:lineno
+using/cmdline,,:module,action:message:category:module:lineno
+using/cmdline,,:lineno,action:message:category:module:lineno
+using/cmdline,,::,-W ignore::DeprecationWarning
 using/unix,,:Packaging,https://en.opensuse.org/Portal:Packaging
 whatsnew/2.0,,:len,
 whatsnew/2.3,,::,
@@ -366,3 +379,8 @@
 library/importlib.metadata,,:main,"EntryPoint(name='wheel', value='wheel.cli:main', group='console_scripts')"
 library/importlib.metadata,,`,loading the metadata for packages for the indicated ``context``.
 library/re,,`,"`"
+using/configure,84,:db2,=db1:db2:...
+library/typing,,`,# Type of ``val`` is narrowed to ``str``
+library/typing,,`,"# Else, type of ``val`` is narrowed to ``float``."
+library/typing,,`,# Type of ``val`` is narrowed to ``List[str]``.
+library/typing,,`,# Type of ``val`` remains as ``List[object]``.
diff --git a/Doc/tools/templates/customsourcelink.html b/Doc/tools/templates/customsourcelink.html
index fca44e9..21af621 100644
--- a/Doc/tools/templates/customsourcelink.html
+++ b/Doc/tools/templates/customsourcelink.html
@@ -4,7 +4,7 @@
     <ul class="this-page-menu">
       <li><a href="{{ pathto('bugs') }}">{% trans %}Report a Bug{% endtrans %}</a></li>
       <li>
-        <a href="https://github.com/python/cpython/blob/master/Doc/{{ sourcename|replace('.rst.txt', '.rst') }}"
+        <a href="https://github.com/python/cpython/blob/{{ version }}/Doc/{{ sourcename|replace('.rst.txt', '.rst') }}"
             rel="nofollow">{{ _('Show Source') }}
         </a>
       </li>
diff --git a/Doc/tools/templates/dummy.html b/Doc/tools/templates/dummy.html
index 68ae3ad..3438b44 100644
--- a/Doc/tools/templates/dummy.html
+++ b/Doc/tools/templates/dummy.html
@@ -6,3 +6,12 @@
 {% trans %}CPython implementation detail:{% endtrans %}
 {% trans %}Deprecated since version {deprecated}, will be removed in version {removed}{% endtrans %}
 {% trans %}Deprecated since version {deprecated}, removed in version {removed}{% endtrans %}
+
+
+In docsbuild-scripts, when rewriting indexsidebar.html with actual versions:
+
+{% trans %}in development{% endtrans %}
+{% trans %}pre-release{% endtrans %}
+{% trans %}stable{% endtrans %}
+{% trans %}security-fixes{% endtrans %}
+{% trans %}EOL{% endtrans %}
diff --git a/Doc/tools/templates/indexcontent.html b/Doc/tools/templates/indexcontent.html
index 152162a..a96746b 100644
--- a/Doc/tools/templates/indexcontent.html
+++ b/Doc/tools/templates/indexcontent.html
@@ -5,7 +5,7 @@
 {% block body %}
   <h1>{{ docstitle|e }}</h1>
   <p>
-  {% trans %}Welcome! This is the documentation for Python {{ release }}.{% endtrans %}
+  {% trans %}Welcome! This is the official documentation for Python {{ release }}.{% endtrans %}
   </p>
   <p><strong>{% trans %}Parts of the documentation:{% endtrans %}</strong></p>
   <table class="contentstable" align="center"><tr>
diff --git a/Doc/tools/templates/indexsidebar.html b/Doc/tools/templates/indexsidebar.html
index 1c1cb54..f7bf6d8 100644
--- a/Doc/tools/templates/indexsidebar.html
+++ b/Doc/tools/templates/indexsidebar.html
@@ -2,12 +2,8 @@
 <p><a href="{{ pathto('download') }}">{% trans %}Download these documents{% endtrans %}</a></p>
 <h3>{% trans %}Docs by version{% endtrans %}</h3>
 <ul>
-  <li><a href="https://docs.python.org/3.10/">{% trans %}Python 3.10 (in development){% endtrans %}</a></li>
-  <li><a href="https://docs.python.org/3.9/">{% trans %}Python 3.9 (pre-release){% endtrans %}</a></li>
-  <li><a href="https://docs.python.org/3.8/">{% trans %}Python 3.8 (stable){% endtrans %}</a></li>
-  <li><a href="https://docs.python.org/3.7/">{% trans %}Python 3.7 (stable){% endtrans %}</a></li>
-  <li><a href="https://docs.python.org/3.6/">{% trans %}Python 3.6 (security-fixes){% endtrans %}</a></li>
-  <li><a href="https://docs.python.org/2.7/">{% trans %}Python 2.7 (EOL){% endtrans %}</a></li>
+  <li><a href="https://docs.python.org/">{% trans %}Stable{% endtrans %}</a></li>
+  <li><a href="https://docs.python.org/dev/">{% trans %}In development{% endtrans %}</a></li>
   <li><a href="https://www.python.org/doc/versions/">{% trans %}All versions{% endtrans %}</a></li>
 </ul>
 
diff --git a/Doc/tools/templates/layout.html b/Doc/tools/templates/layout.html
index 17592d7..98ccf42 100644
--- a/Doc/tools/templates/layout.html
+++ b/Doc/tools/templates/layout.html
@@ -12,22 +12,14 @@
 
 {% block rootrellink %}
 {{ super() }}
-    <li>
-      {%- if switchers is defined %}
-      <span class="language_switcher_placeholder">{{ language or 'en' }}</span>
-      <span class="version_switcher_placeholder">{{ release }}</span>
-      <a href="{{ pathto('index') }}">{% trans %}Documentation {% endtrans %}</a>{{ reldelim1 }}
-      {%- else %}
+    <li id="cpython-language-and-version">
       <a href="{{ pathto('index') }}">{{ shorttitle }}</a>{{ reldelim1 }}
-      {%- endif %}
     </li>
 {% endblock %}
 
 {% block extrahead %}
     <link rel="canonical" href="https://docs.python.org/3/{{pagename}}.html" />
     {% if builder != "htmlhelp" %}
-      {% if switchers is defined and not embedded %}
-      <script type="text/javascript" src="{{ pathto('_static/switchers.js', 1) }}"></script>{% endif %}
       {% if pagename == 'whatsnew/changelog' and not embedded %}
       <script type="text/javascript" src="{{ pathto('_static/changelog_search.js', 1) }}"></script>{% endif %}
     {% endif %}
diff --git a/Doc/tools/templates/search.html b/Doc/tools/templates/search.html
new file mode 100644
index 0000000..cf20c2e
--- /dev/null
+++ b/Doc/tools/templates/search.html
@@ -0,0 +1,48 @@
+{% extends "!search.html" %}
+{% block extrahead %}
+    {{ super() }}
+    <script type="text/javascript">
+        var GLOSSARY_PAGE = 'glossary.html';
+
+        jQuery(function() {
+            $.getJSON("_static/glossary.json", function(glossary) {
+                var RESULT_TEMPLATE = '<div style="display: none" class="admonition seealso" id="glossary-result">' + 
+                                      '  <p class="topic-title">' +
+                                      '    <a class="glossary-title" href="#"></a>' +
+                                      '  </p>' +
+                                      '  <div class="glossary-body"></div>' +
+                                      '</div>';
+                $("#search-results").prepend(RESULT_TEMPLATE);
+
+                var params = $.getQueryParameters();
+                if (params.q) {
+                    var search_param = params.q[0].toLowerCase();
+                    var glossary_item = glossary[search_param];
+                    if (glossary_item) {
+                        var resultDiv = $("#glossary-result");
+                        
+                        // set up the title text with a link to the glossary page
+                        resultDiv.find(".glossary-title").text('Glossary: ' + glossary_item.title);
+                        var link_target = search_param.replace(/ /g, '-');
+                        resultDiv.find(".glossary-title").attr(
+                            'href', GLOSSARY_PAGE + '#term-' + link_target
+                        );
+
+                        // rewrite any anchor links (to other glossary terms)
+                        // to have a full reference to the glossary page
+                        var body = $(glossary_item.body).children();
+                        body.find("a[href^='#']").each(function() {
+                            var current_url = $(this).attr('href');
+                            $(this).attr('href', GLOSSARY_PAGE + current_url);
+                        });
+                        resultDiv.find(".glossary-body").html(body);
+
+                        resultDiv.show();
+                    } else {
+                        $("#glossary-result").hide('');
+                    }
+                }
+            });
+        });
+    </script>
+{% endblock %}
\ No newline at end of file
diff --git a/Doc/tutorial/appetite.rst b/Doc/tutorial/appetite.rst
index 26e5168..3fa6809 100644
--- a/Doc/tutorial/appetite.rst
+++ b/Doc/tutorial/appetite.rst
@@ -23,7 +23,7 @@
 tasks, but shell scripts are best at moving around files and changing text data,
 not well-suited for GUI applications or games. You could write a C/C++/Java
 program, but it can take a lot of development time to get even a first-draft
-program.  Python is simpler to use, available on Windows, Mac OS X, and Unix
+program.  Python is simpler to use, available on Windows, macOS, and Unix
 operating systems, and will help you get the job done more quickly.
 
 Python is simple to use, but it is a real programming language, offering much
diff --git a/Doc/tutorial/classes.rst b/Doc/tutorial/classes.rst
index 0d780e3..f44cb0b 100644
--- a/Doc/tutorial/classes.rst
+++ b/Doc/tutorial/classes.rst
@@ -797,7 +797,7 @@
    >>> s = 'abc'
    >>> it = iter(s)
    >>> it
-   <iterator object at 0x00A1DB50>
+   <str_iterator object at 0x10c90e650>
    >>> next(it)
    'a'
    >>> next(it)
diff --git a/Doc/tutorial/controlflow.rst b/Doc/tutorial/controlflow.rst
index 3af288a..f6e013b 100644
--- a/Doc/tutorial/controlflow.rst
+++ b/Doc/tutorial/controlflow.rst
@@ -36,6 +36,9 @@
 :keyword:`!elif` ... sequence is a substitute for the ``switch`` or
 ``case`` statements found in other languages.
 
+If you're comparing the same value to several constants, or checking for specific types or
+attributes, you may also find the :keyword:`!match` statement useful. For more
+details see :ref:`tut-match`.
 
 .. _tut-for:
 
@@ -70,6 +73,9 @@
 be tricky to get right.  Instead, it is usually more straight-forward to loop
 over a copy of the collection or to create a new collection::
 
+    # Create a sample collection
+    users = {'Hans': 'active', 'Éléonore': 'inactive', '景太郎': 'active'}
+
     # Strategy:  Iterate over a copy
     for user, status in users.copy().items():
         if status == 'inactive':
@@ -104,14 +110,14 @@
 is possible to let the range start at another number, or to specify a different
 increment (even negative; sometimes this is called the 'step')::
 
-    range(5, 10)
-       5, 6, 7, 8, 9
+    >>> list(range(5, 10))
+    [5, 6, 7, 8, 9]
 
-    range(0, 10, 3)
-       0, 3, 6, 9
+    >>> list(range(0, 10, 3))
+    [0, 3, 6, 9]
 
-    range(-10, -100, -30)
-      -10, -40, -70
+    >>> list(range(-10, -100, -30))
+    [-10, -40, -70]
 
 To iterate over the indices of a sequence, you can combine :func:`range` and
 :func:`len` as follows::
@@ -131,7 +137,7 @@
 
 A strange thing happens if you just print a range::
 
-   >>> print(range(10))
+   >>> range(10)
    range(0, 10)
 
 In many ways the object returned by :func:`range` behaves as if it is a list,
@@ -149,13 +155,7 @@
     6
 
 Later we will see more functions that return iterables and take iterables as
-arguments.  Lastly, maybe you are curious about how to get a list from a range.
-Here is the solution::
-
-   >>> list(range(4))
-   [0, 1, 2, 3]
-
-In chapter :ref:`tut-structures`, we will discuss in more detail about
+arguments.  In chapter :ref:`tut-structures`, we will discuss in more detail about
 :func:`list`.
 
 .. _tut-break:
@@ -208,6 +208,7 @@
     ...         print("Found an even number", num)
     ...         continue
     ...     print("Found an odd number", num)
+    ...
     Found an even number 2
     Found an odd number 3
     Found an even number 4
@@ -243,6 +244,174 @@
    ...     pass   # Remember to implement this!
    ...
 
+
+.. _tut-match:
+
+:keyword:`!match` Statements
+============================
+
+A :keyword:`match` statement takes an expression and compares its value to successive
+patterns given as one or more case blocks.  This is superficially
+similar to a switch statement in C, Java or JavaScript (and many
+other languages), but it can also extract components (sequence elements or
+object attributes) from the value into variables.
+
+The simplest form compares a subject value against one or more literals::
+
+    def http_error(status):
+        match status:
+            case 400:
+                return "Bad request"
+            case 404:
+                return "Not found"
+            case 418:
+                return "I'm a teapot"
+            case _:
+                return "Something's wrong with the internet"
+
+Note the last block: the "variable name" ``_`` acts as a *wildcard* and
+never fails to match. If no case matches, none of the branches is executed.
+
+You can combine several literals in a single pattern using ``|`` ("or")::
+
+            case 401 | 403 | 404:
+                return "Not allowed"
+
+Patterns can look like unpacking assignments, and can be used to bind
+variables::
+
+    # point is an (x, y) tuple
+    match point:
+        case (0, 0):
+            print("Origin")
+        case (0, y):
+            print(f"Y={y}")
+        case (x, 0):
+            print(f"X={x}")
+        case (x, y):
+            print(f"X={x}, Y={y}")
+        case _:
+            raise ValueError("Not a point")
+
+Study that one carefully!  The first pattern has two literals, and can
+be thought of as an extension of the literal pattern shown above.  But
+the next two patterns combine a literal and a variable, and the
+variable *binds* a value from the subject (``point``).  The fourth
+pattern captures two values, which makes it conceptually similar to
+the unpacking assignment ``(x, y) = point``.
+
+If you are using classes to structure your data
+you can use the class name followed by an argument list resembling a
+constructor, but with the ability to capture attributes into variables::
+
+    class Point:
+        x: int
+        y: int
+
+    def where_is(point):
+        match point:
+            case Point(x=0, y=0):
+                print("Origin")
+            case Point(x=0, y=y):
+                print(f"Y={y}")
+            case Point(x=x, y=0):
+                print(f"X={x}")
+            case Point():
+                print("Somewhere else")
+            case _:
+                print("Not a point")
+
+You can use positional parameters with some builtin classes that provide an
+ordering for their attributes (e.g. dataclasses). You can also define a specific
+position for attributes in patterns by setting the ``__match_args__`` special
+attribute in your classes. If it's set to ("x", "y"), the following patterns are all
+equivalent (and all bind the ``y`` attribute to the ``var`` variable)::
+
+    Point(1, var)
+    Point(1, y=var)
+    Point(x=1, y=var)
+    Point(y=var, x=1)
+
+A recommended way to read patterns is to look at them as an extended form of what you
+would put on the left of an assignment, to understand which variables would be set to
+what.
+Only the standalone names (like ``var`` above) are assigned to by a match statement.
+Dotted names (like ``foo.bar``), attribute names (the ``x=`` and ``y=`` above) or class names
+(recognized by the "(...)" next to them like ``Point`` above) are never assigned to.
+
+Patterns can be arbitrarily nested.  For example, if we have a short
+list of points, we could match it like this::
+
+    match points:
+        case []:
+            print("No points")
+        case [Point(0, 0)]:
+            print("The origin")
+        case [Point(x, y)]:
+            print(f"Single point {x}, {y}")
+        case [Point(0, y1), Point(0, y2)]:
+            print(f"Two on the Y axis at {y1}, {y2}")
+        case _:
+            print("Something else")
+
+We can add an ``if`` clause to a pattern, known as a "guard".  If the
+guard is false, ``match`` goes on to try the next case block.  Note
+that value capture happens before the guard is evaluated::
+
+    match point:
+        case Point(x, y) if x == y:
+            print(f"Y=X at {x}")
+        case Point(x, y):
+            print(f"Not on the diagonal")
+
+Several other key features of this statement:
+
+- Like unpacking assignments, tuple and list patterns have exactly the
+  same meaning and actually match arbitrary sequences.  An important
+  exception is that they don't match iterators or strings.
+
+- Sequence patterns support extended unpacking: ``[x, y, *rest]`` and ``(x, y,
+  *rest)`` work similar to unpacking assignments.  The
+  name after ``*`` may also be ``_``, so ``(x, y, *_)`` matches a sequence
+  of at least two items without binding the remaining items.
+
+- Mapping patterns: ``{"bandwidth": b, "latency": l}`` captures the
+  ``"bandwidth"`` and ``"latency"`` values from a dictionary.  Unlike sequence
+  patterns, extra keys are ignored.  An unpacking like ``**rest`` is also
+  supported.  (But ``**_`` would be redundant, so it is not allowed.)
+
+- Subpatterns may be captured using the ``as`` keyword::
+
+      case (Point(x1, y1), Point(x2, y2) as p2): ...
+
+  will capture the second element of the input as ``p2`` (as long as the input is
+  a sequence of two points)
+
+- Most literals are compared by equality, however the singletons ``True``,
+  ``False`` and ``None`` are compared by identity.
+
+- Patterns may use named constants.  These must be dotted names
+  to prevent them from being interpreted as capture variable::
+
+      from enum import Enum
+      class Color(Enum):
+          RED = 'red'
+          GREEN = 'green'
+          BLUE = 'blue'
+
+      color = Color(input("Enter your choice of 'red', 'blue' or 'green': "))
+
+      match color:
+          case Color.RED:
+              print("I see red!")
+          case Color.GREEN:
+              print("Grass is green")
+          case Color.BLUE:
+              print("I'm feeling the blues :(")
+
+For a more detailed explanation and additional examples, you can look into
+:pep:`636` which is written in a tutorial format.
+
 .. _tut-functions:
 
 Defining Functions
@@ -294,7 +463,8 @@
 The actual parameters (arguments) to a function call are introduced in the local
 symbol table of the called function when it is called; thus, arguments are
 passed using *call by value* (where the *value* is always an object *reference*,
-not the value of the object). [#]_ When a function calls another function, a new
+not the value of the object). [#]_ When a function calls another function,
+or calls itself recursively, a new
 local symbol table is created for that call.
 
 A function definition associates the function name with the function object in
@@ -483,7 +653,7 @@
    >>> function(0, a=0)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
-   TypeError: function() got multiple values for keyword argument 'a'
+   TypeError: function() got multiple values for argument 'a'
 
 When a final formal parameter of the form ``**name`` is present, it receives a
 dictionary (see :ref:`typesmapping`) containing all keyword arguments except for
@@ -619,7 +789,7 @@
    >>> pos_only_arg(arg=1)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
-   TypeError: pos_only_arg() got an unexpected keyword argument 'arg'
+   TypeError: pos_only_arg() got some positional-only arguments passed as keyword arguments: 'arg'
 
 The third function ``kwd_only_args`` only allows keyword arguments as indicated
 by a ``*`` in the function definition::
@@ -649,7 +819,7 @@
    >>> combined_example(pos_only=1, standard=2, kwd_only=3)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
-   TypeError: combined_example() got an unexpected keyword argument 'pos_only'
+   TypeError: combined_example() got some positional-only arguments passed as keyword arguments: 'pos_only'
 
 
 Finally, consider this function definition which has a potential collision between the positional argument ``name``  and ``**kwds`` which has ``name`` as a key::
@@ -714,7 +884,7 @@
        file.write(separator.join(args))
 
 
-Normally, these ``variadic`` arguments will be last in the list of formal
+Normally, these *variadic* arguments will be last in the list of formal
 parameters, because they scoop up all remaining input arguments that are
 passed to the function. Any formal parameters which occur after the ``*args``
 parameter are 'keyword-only' arguments, meaning that they can only be used as
@@ -865,7 +1035,7 @@
 by an expression evaluating to the value of the annotation.  Return annotations are
 defined by a literal ``->``, followed by an expression, between the parameter
 list and the colon denoting the end of the :keyword:`def` statement.  The
-following example has a positional argument, a keyword argument, and the return
+following example has a required argument, an optional argument, and the return
 value annotated::
 
    >>> def f(ham: str, eggs: str = 'eggs') -> str:
diff --git a/Doc/tutorial/datastructures.rst b/Doc/tutorial/datastructures.rst
index 5c6b65f..927a672 100644
--- a/Doc/tutorial/datastructures.rst
+++ b/Doc/tutorial/datastructures.rst
@@ -659,11 +659,12 @@
 The conditions used in ``while`` and ``if`` statements can contain any
 operators, not just comparisons.
 
-The comparison operators ``in`` and ``not in`` check whether a value occurs
-(does not occur) in a sequence.  The operators ``is`` and ``is not`` compare
-whether two objects are really the same object; this only matters for mutable
-objects like lists.  All comparison operators have the same priority, which is
-lower than that of all numerical operators.
+
+The comparison operators ``in`` and ``not in`` are membership tests that
+determine whether a value is in (or not in) a container.  The operators ``is``
+and ``is not`` compare whether two objects are really the same object.  All
+comparison operators have the same priority, which is lower than that of all
+numerical operators.
 
 Comparisons can be chained.  For example, ``a < b == c`` tests whether ``a`` is
 less than ``b`` and moreover ``b`` equals ``c``.
diff --git a/Doc/tutorial/errors.rst b/Doc/tutorial/errors.rst
index efe44da..3f09db2 100644
--- a/Doc/tutorial/errors.rst
+++ b/Doc/tutorial/errors.rst
@@ -53,7 +53,7 @@
    >>> '2' + 2
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
-   TypeError: Can't convert 'int' object to str implicitly
+   TypeError: can only concatenate str (not "int") to str
 
 The last line of the error message indicates what happened. Exceptions come in
 different types, and the type is printed as part of the message: the types in
@@ -101,29 +101,29 @@
 * If no exception occurs, the *except clause* is skipped and execution of the
   :keyword:`try` statement is finished.
 
-* If an exception occurs during execution of the try clause, the rest of the
-  clause is skipped.  Then if its type matches the exception named after the
-  :keyword:`except` keyword, the except clause is executed, and then execution
-  continues after the :keyword:`try` statement.
+* If an exception occurs during execution of the :keyword:`try` clause, the rest of the
+  clause is skipped.  Then, if its type matches the exception named after the
+  :keyword:`except` keyword, the *except clause* is executed, and then execution
+  continues after the try/except block.
 
-* If an exception occurs which does not match the exception named in the except
-  clause, it is passed on to outer :keyword:`try` statements; if no handler is
+* If an exception occurs which does not match the exception named in the *except
+  clause*, it is passed on to outer :keyword:`try` statements; if no handler is
   found, it is an *unhandled exception* and execution stops with a message as
   shown above.
 
-A :keyword:`try` statement may have more than one except clause, to specify
+A :keyword:`try` statement may have more than one *except clause*, to specify
 handlers for different exceptions.  At most one handler will be executed.
-Handlers only handle exceptions that occur in the corresponding try clause, not
-in other handlers of the same :keyword:`!try` statement.  An except clause may
-name multiple exceptions as a parenthesized tuple, for example::
+Handlers only handle exceptions that occur in the corresponding *try clause*,
+not in other handlers of the same :keyword:`!try` statement.  An *except clause*
+may name multiple exceptions as a parenthesized tuple, for example::
 
    ... except (RuntimeError, TypeError, NameError):
    ...     pass
 
 A class in an :keyword:`except` clause is compatible with an exception if it is
 the same class or a base class thereof (but not the other way around --- an
-except clause listing a derived class is not compatible with a base class).  For
-example, the following code will print B, C, D in that order::
+*except clause* listing a derived class is not compatible with a base class).
+For example, the following code will print B, C, D in that order::
 
    class B(Exception):
        pass
@@ -144,13 +144,13 @@
        except B:
            print("B")
 
-Note that if the except clauses were reversed (with ``except B`` first), it
-would have printed B, B, B --- the first matching except clause is triggered.
+Note that if the *except clauses* were reversed (with ``except B`` first), it
+would have printed B, B, B --- the first matching *except clause* is triggered.
 
-The last except clause may omit the exception name(s), to serve as a wildcard.
-Use this with extreme caution, since it is easy to mask a real programming error
-in this way!  It can also be used to print an error message and then re-raise
-the exception (allowing a caller to handle the exception as well)::
+All exceptions inherit from :exc:`BaseException`, and so it can be used to serve
+as a wildcard. Use this with extreme caution, since it is easy to mask a real
+programming error in this way!  It can also be used to print an error message and
+then re-raise the exception (allowing a caller to handle the exception as well)::
 
    import sys
 
@@ -162,14 +162,17 @@
        print("OS error: {0}".format(err))
    except ValueError:
        print("Could not convert data to an integer.")
-   except:
-       print("Unexpected error:", sys.exc_info()[0])
+   except BaseException as err:
+       print(f"Unexpected {err=}, {type(err)=}")
        raise
 
+Alternatively the last except clause may omit the exception name(s), however the exception
+value must then be retrieved from ``sys.exc_info()[1]``.
+
 The :keyword:`try` ... :keyword:`except` statement has an optional *else
-clause*, which, when present, must follow all except clauses.  It is useful for
-code that must be executed if the try clause does not raise an exception.  For
-example::
+clause*, which, when present, must follow all *except clauses*.  It is useful
+for code that must be executed if the *try clause* does not raise an exception.
+For example::
 
    for arg in sys.argv[1:]:
        try:
@@ -189,7 +192,7 @@
 exception's *argument*. The presence and type of the argument depend on the
 exception type.
 
-The except clause may specify a variable after the exception name.  The
+The *except clause* may specify a variable after the exception name.  The
 variable is bound to an exception instance with the arguments stored in
 ``instance.args``.  For convenience, the exception instance defines
 :meth:`__str__` so the arguments can be printed directly without having to
@@ -217,8 +220,8 @@
 the message for unhandled exceptions.
 
 Exception handlers don't just handle exceptions if they occur immediately in the
-try clause, but also if they occur inside functions that are called (even
-indirectly) in the try clause. For example::
+*try clause*, but also if they occur inside functions that are called (even
+indirectly) in the *try clause*. For example::
 
    >>> def this_fails():
    ...     x = 1/0
@@ -272,7 +275,7 @@
 Exception Chaining
 ==================
 
-The :keyword:`raise` statement allows an optional :keyword:`from` which enables
+The :keyword:`raise` statement allows an optional :keyword:`from<raise>` which enables
 chaining exceptions. For example::
 
     # exc must be exception instance or None.
@@ -281,17 +284,17 @@
 This can be useful when you are transforming exceptions. For example::
 
     >>> def func():
-    ...     raise IOError
+    ...     raise ConnectionError
     ...
     >>> try:
     ...     func()
-    ... except IOError as exc:
+    ... except ConnectionError as exc:
     ...     raise RuntimeError('Failed to open database') from exc
     ...
     Traceback (most recent call last):
       File "<stdin>", line 2, in <module>
       File "<stdin>", line 2, in func
-    OSError
+    ConnectionError
     <BLANKLINE>
     The above exception was the direct cause of the following exception:
     <BLANKLINE>
@@ -300,12 +303,12 @@
     RuntimeError: Failed to open database
 
 Exception chaining happens automatically when an exception is raised inside an
-:keyword:`except` or :keyword:`finally` section. Exception chaining can be
+:keyword:`except` or :keyword:`finally` section. This can be
 disabled by using ``from None`` idiom:
 
     >>> try:
     ...     open('database.sqlite')
-    ... except IOError:
+    ... except OSError:
     ...     raise RuntimeError from None
     ...
     Traceback (most recent call last):
@@ -326,41 +329,7 @@
 
 Exception classes can be defined which do anything any other class can do, but
 are usually kept simple, often only offering a number of attributes that allow
-information about the error to be extracted by handlers for the exception.  When
-creating a module that can raise several distinct errors, a common practice is
-to create a base class for exceptions defined by that module, and subclass that
-to create specific exception classes for different error conditions::
-
-   class Error(Exception):
-       """Base class for exceptions in this module."""
-       pass
-
-   class InputError(Error):
-       """Exception raised for errors in the input.
-
-       Attributes:
-           expression -- input expression in which the error occurred
-           message -- explanation of the error
-       """
-
-       def __init__(self, expression, message):
-           self.expression = expression
-           self.message = message
-
-   class TransitionError(Error):
-       """Raised when an operation attempts a state transition that's not
-       allowed.
-
-       Attributes:
-           previous -- state at beginning of transition
-           next -- attempted new state
-           message -- explanation of why the specific transition is not allowed
-       """
-
-       def __init__(self, previous, next, message):
-           self.previous = previous
-           self.next = next
-           self.message = message
+information about the error to be extracted by handlers for the exception.
 
 Most exceptions are defined with names that end in "Error", similar to the
 naming of the standard exceptions.
@@ -405,6 +374,10 @@
   or :keyword:`!else` clause. Again, the exception is re-raised after
   the :keyword:`!finally` clause has been executed.
 
+* If the :keyword:`!finally` clause executes a :keyword:`break`,
+  :keyword:`continue` or :keyword:`return` statement, exceptions are not
+  re-raised.
+
 * If the :keyword:`!try` statement reaches a :keyword:`break`,
   :keyword:`continue` or :keyword:`return` statement, the
   :keyword:`!finally` clause will execute just prior to the
@@ -489,5 +462,3 @@
 After the statement is executed, the file *f* is always closed, even if a
 problem was encountered while processing the lines. Objects which, like files,
 provide predefined clean-up actions will indicate this in their documentation.
-
-
diff --git a/Doc/tutorial/floatingpoint.rst b/Doc/tutorial/floatingpoint.rst
index 0c0eb52..7212b40 100644
--- a/Doc/tutorial/floatingpoint.rst
+++ b/Doc/tutorial/floatingpoint.rst
@@ -133,7 +133,7 @@
 
 Binary floating-point arithmetic holds many surprises like this.  The problem
 with "0.1" is explained in precise detail below, in the "Representation Error"
-section.  See `The Perils of Floating Point <http://www.lahey.com/float.htm>`_
+section.  See `The Perils of Floating Point <https://www.lahey.com/float.htm>`_
 for a more complete account of other common surprises.
 
 As that says near the end, "there are no easy answers."  Still, don't be unduly
@@ -158,7 +158,7 @@
 1/3 can be represented exactly).
 
 If you are a heavy user of floating point operations you should take a look
-at the Numerical Python package and many other packages for mathematical and
+at the NumPy package and many other packages for mathematical and
 statistical operations supplied by the SciPy project. See <https://scipy.org>.
 
 Python provides tools that may help on those rare occasions when you really
diff --git a/Doc/tutorial/index.rst b/Doc/tutorial/index.rst
index 8ee011e..96791f8 100644
--- a/Doc/tutorial/index.rst
+++ b/Doc/tutorial/index.rst
@@ -11,7 +11,7 @@
 and rapid application development in many areas on most platforms.
 
 The Python interpreter and the extensive standard library are freely available
-in source or binary form for all major platforms from the Python Web site,
+in source or binary form for all major platforms from the Python web site,
 https://www.python.org/, and may be freely distributed. The same site also
 contains distributions of and pointers to many free third party Python modules,
 programs and tools, and additional documentation.
diff --git a/Doc/tutorial/inputoutput.rst b/Doc/tutorial/inputoutput.rst
index 4e27cff..7f83c4d 100644
--- a/Doc/tutorial/inputoutput.rst
+++ b/Doc/tutorial/inputoutput.rst
@@ -480,7 +480,8 @@
 simple line of code::
 
    >>> import json
-   >>> json.dumps([1, 'simple', 'list'])
+   >>> x = [1, 'simple', 'list']
+   >>> json.dumps(x)
    '[1, "simple", "list"]'
 
 Another variant of the :func:`~json.dumps` function, called :func:`~json.dump`,
diff --git a/Doc/tutorial/interpreter.rst b/Doc/tutorial/interpreter.rst
index b78d296..d2733a9 100644
--- a/Doc/tutorial/interpreter.rst
+++ b/Doc/tutorial/interpreter.rst
@@ -10,13 +10,13 @@
 Invoking the Interpreter
 ========================
 
-The Python interpreter is usually installed as :file:`/usr/local/bin/python3.9`
+The Python interpreter is usually installed as :file:`/usr/local/bin/python3.10`
 on those machines where it is available; putting :file:`/usr/local/bin` in your
 Unix shell's search path makes it possible to start it by typing the command:
 
 .. code-block:: text
 
-   python3.9
+   python3.10
 
 to the shell. [#]_ Since the choice of the directory where the interpreter lives
 is an installation option, other places are possible; check with your local
@@ -24,7 +24,7 @@
 popular alternative location.)
 
 On Windows machines where you have installed Python from the :ref:`Microsoft Store
-<windows-store>`, the :file:`python3.9` command will be available. If you have
+<windows-store>`, the :file:`python3.10` command will be available. If you have
 the :ref:`py.exe launcher <launcher>` installed, you can use the :file:`py`
 command. See :ref:`setting-envvars` for other ways to launch Python.
 
@@ -97,8 +97,8 @@
 
 .. code-block:: shell-session
 
-   $ python3.9
-   Python 3.9 (default, June 4 2019, 09:25:04)
+   $ python3.10
+   Python 3.10 (default, June 4 2019, 09:25:04)
    [GCC 4.8.2] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>>
diff --git a/Doc/tutorial/introduction.rst b/Doc/tutorial/introduction.rst
index 2a16661..33678f5 100644
--- a/Doc/tutorial/introduction.rst
+++ b/Doc/tutorial/introduction.rst
@@ -11,6 +11,13 @@
 line by itself in an example means you must type a blank line; this is used to
 end a multi-line command.
 
+.. only:: html
+
+   You can toggle the display of prompts and output by clicking on ``>>>``
+   in the upper-right corner of an example box.  If you hide the prompts
+   and output for an example, then you can easily copy and paste the input
+   lines into your interpreter.
+
 .. index:: single: # (hash); comment
 
 Many of the examples in this manual, even those entered at the interactive
@@ -73,7 +80,7 @@
    5
    >>> 17 % 3  # the % operator returns the remainder of the division
    2
-   >>> 5 * 3 + 2  # result * divisor + remainder
+   >>> 5 * 3 + 2  # floored quotient * divisor + remainder
    17
 
 With Python, it is possible to use the ``**`` operator to calculate powers [#]_::
@@ -269,14 +276,6 @@
    >>> word[2:5]  # characters from position 2 (included) to 5 (excluded)
    'tho'
 
-Note how the start is always included, and the end always excluded.  This
-makes sure that ``s[:i] + s[i:]`` is always equal to ``s``::
-
-   >>> word[:2] + word[2:]
-   'Python'
-   >>> word[:4] + word[4:]
-   'Python'
-
 Slice indices have useful defaults; an omitted first index defaults to zero, an
 omitted second index defaults to the size of the string being sliced. ::
 
@@ -287,6 +286,14 @@
    >>> word[-2:]  # characters from the second-last (included) to the end
    'on'
 
+Note how the start is always included, and the end always excluded.  This
+makes sure that ``s[:i] + s[i:]`` is always equal to ``s``::
+
+   >>> word[:2] + word[2:]
+   'Python'
+   >>> word[:4] + word[4:]
+   'Python'
+
 One way to remember how slices work is to think of the indices as pointing
 *between* characters, with the left edge of the first character numbered 0.
 Then the right edge of the last character of a string of *n* characters has
diff --git a/Doc/tutorial/modules.rst b/Doc/tutorial/modules.rst
index af595e5..f1d4957 100644
--- a/Doc/tutorial/modules.rst
+++ b/Doc/tutorial/modules.rst
@@ -191,7 +191,8 @@
   file is specified).
 * :envvar:`PYTHONPATH` (a list of directory names, with the same syntax as the
   shell variable :envvar:`PATH`).
-* The installation-dependent default.
+* The installation-dependent default (by convention including a
+  ``site-packages`` directory, handled by the :mod:`site` module).
 
 .. note::
    On file systems which support symlinks, the directory containing the input
@@ -533,6 +534,8 @@
 packages.
 
 
+.. _intra-package-references:
+
 Intra-package References
 ------------------------
 
diff --git a/Doc/tutorial/stdlib.rst b/Doc/tutorial/stdlib.rst
index a52653b..ac16160 100644
--- a/Doc/tutorial/stdlib.rst
+++ b/Doc/tutorial/stdlib.rst
@@ -15,7 +15,7 @@
 
    >>> import os
    >>> os.getcwd()      # Return the current working directory
-   'C:\\Python39'
+   'C:\\Python310'
    >>> os.chdir('/server/accesslogs')   # Change current working directory
    >>> os.system('mkdir today')   # Run the command mkdir in the system shell
    0
@@ -178,13 +178,13 @@
 from URLs and :mod:`smtplib` for sending mail::
 
    >>> from urllib.request import urlopen
-   >>> with urlopen('http://tycho.usno.navy.mil/cgi-bin/timer.pl') as response:
+   >>> with urlopen('http://worldtimeapi.org/api/timezone/etc/UTC.txt') as response:
    ...     for line in response:
-   ...         line = line.decode('utf-8')  # Decoding the binary data to text.
-   ...         if 'EST' in line or 'EDT' in line:  # look for Eastern Time
-   ...             print(line)
-
-   <BR>Nov. 25, 09:43:32 PM EST
+   ...         line = line.decode()             # Convert bytes to a str
+   ...         if line.startswith('datetime'):
+   ...             print(line.rstrip())         # Remove trailing newline
+   ...
+   datetime: 2022-01-01T01:36:47.689215+00:00
 
    >>> import smtplib
    >>> server = smtplib.SMTP('localhost')
diff --git a/Doc/tutorial/stdlib2.rst b/Doc/tutorial/stdlib2.rst
index 2994828..298034d 100644
--- a/Doc/tutorial/stdlib2.rst
+++ b/Doc/tutorial/stdlib2.rst
@@ -278,7 +278,7 @@
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
        d['primary']                # entry was automatically removed
-     File "C:/python39/lib/weakref.py", line 46, in __getitem__
+     File "C:/python310/lib/weakref.py", line 46, in __getitem__
        o = self.data[key]()
    KeyError: 'primary'
 
diff --git a/Doc/tutorial/venv.rst b/Doc/tutorial/venv.rst
index f422146..221c11c 100644
--- a/Doc/tutorial/venv.rst
+++ b/Doc/tutorial/venv.rst
@@ -48,7 +48,7 @@
 
 This will create the ``tutorial-env`` directory if it doesn't exist,
 and also create directories inside it containing a copy of the Python
-interpreter, the standard library, and various supporting files.
+interpreter and various supporting files.
 
 A common directory location for a virtual environment is ``.venv``.
 This name keeps the directory typically hidden in your shell and thus
@@ -95,20 +95,9 @@
 You can install, upgrade, and remove packages using a program called
 :program:`pip`.  By default ``pip`` will install packages from the Python
 Package Index, <https://pypi.org>.  You can browse the Python
-Package Index by going to it in your web browser, or you can use ``pip``'s
-limited search feature:
+Package Index by going to it in your web browser.
 
-.. code-block:: bash
-
-  (tutorial-env) $ pip search astronomy
-  skyfield               - Elegant astronomy for Python
-  gary                   - Galactic astronomy and gravitational dynamics.
-  novas                  - The United States Naval Observatory NOVAS astronomy library
-  astroobs               - Provides astronomy ephemeris to plan telescope observations
-  PyAstronomy            - A collection of astronomy related tools for Python.
-  ...
-
-``pip`` has a number of subcommands: "search", "install", "uninstall",
+``pip`` has a number of subcommands: "install", "uninstall",
 "freeze", etc.  (Consult the :ref:`installing-index` guide for
 complete documentation for ``pip``.)
 
diff --git a/Doc/tutorial/whatnow.rst b/Doc/tutorial/whatnow.rst
index 3208201..18805da 100644
--- a/Doc/tutorial/whatnow.rst
+++ b/Doc/tutorial/whatnow.rst
@@ -30,8 +30,8 @@
 
 More Python resources:
 
-* https://www.python.org:  The major Python Web site.  It contains code,
-  documentation, and pointers to Python-related pages around the Web.  This Web
+* https://www.python.org:  The major Python web site.  It contains code,
+  documentation, and pointers to Python-related pages around the web.  This web
   site is mirrored in various places around the world, such as Europe, Japan, and
   Australia; a mirror may be faster than the main site, depending on your
   geographical location.
diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst
index 95342f3..c4f65eb 100644
--- a/Doc/using/cmdline.rst
+++ b/Doc/using/cmdline.rst
@@ -322,7 +322,7 @@
 
    Hash randomization is intended to provide protection against a
    denial-of-service caused by carefully-chosen inputs that exploit the worst
-   case performance of a dict construction, O(n^2) complexity.  See
+   case performance of a dict construction, O(n\ :sup:`2`) complexity.  See
    http://www.ocert.org/advisories/ocert-2011-003.html for details.
 
    :envvar:`PYTHONHASHSEED` allows you to set a fixed value for the hash
@@ -369,31 +369,19 @@
    (filename or built-in module) from which it is loaded.  When given twice
    (:option:`!-vv`), print a message for each file that is checked for when
    searching for a module.  Also provides information on module cleanup at exit.
+
+   .. versionchanged:: 3.10
+      The :mod:`site` module reports the site-specific paths
+      and :file:`.pth` files being processed.
+
    See also :envvar:`PYTHONVERBOSE`.
 
 
 .. _using-on-warnings:
 .. cmdoption:: -W arg
 
-   Warning control.  Python's warning machinery by default prints warning
-   messages to :data:`sys.stderr`.  A typical warning message has the following
-   form:
-
-   .. code-block:: none
-
-       file:line: category: message
-
-   By default, each warning is printed once for each source line where it
-   occurs.  This option controls how often warnings are printed.
-
-   Multiple :option:`-W` options may be given; when a warning matches more than
-   one option, the action for the last matching option is performed.  Invalid
-   :option:`-W` options are ignored (though, a warning message is printed about
-   invalid options when the first warning is issued).
-
-   Warnings can also be controlled using the :envvar:`PYTHONWARNINGS`
-   environment variable and from within a Python program using the
-   :mod:`warnings` module.
+   Warning control. Python's warning machinery by default prints warning
+   messages to :data:`sys.stderr`.
 
    The simplest settings apply a particular action unconditionally to all
    warnings emitted by a process (even those that are otherwise ignored by
@@ -406,14 +394,48 @@
        -Wonce     # Warn once per Python process
        -Wignore   # Never warn
 
-   The action names can be abbreviated as desired (e.g. ``-Wi``, ``-Wd``,
-   ``-Wa``, ``-We``) and the interpreter will resolve them to the appropriate
-   action name.
+   The action names can be abbreviated as desired and the interpreter will
+   resolve them to the appropriate action name. For example, ``-Wi`` is the
+   same as ``-Wignore``.
+
+   The full form of argument is::
+
+       action:message:category:module:lineno
+
+   Empty fields match all values; trailing empty fields may be omitted. For
+   example ``-W ignore::DeprecationWarning`` ignores all DeprecationWarning
+   warnings.
+
+   The *action* field is as explained above but only applies to warnings that
+   match the remaining fields.
+
+   The *message* field must match the whole warning message; this match is
+   case-insensitive.
+
+   The *category* field matches the warning category
+   (ex: ``DeprecationWarning``). This must be a class name; the match test
+   whether the actual warning category of the message is a subclass of the
+   specified warning category.
+
+   The *module* field matches the (fully-qualified) module name; this match is
+   case-sensitive.
+
+   The *lineno* field matches the line number, where zero matches all line
+   numbers and is thus equivalent to an omitted line number.
+
+   Multiple :option:`-W` options can be given; when a warning matches more than
+   one option, the action for the last matching option is performed. Invalid
+   :option:`-W` options are ignored (though, a warning message is printed about
+   invalid options when the first warning is issued).
+
+   Warnings can also be controlled using the :envvar:`PYTHONWARNINGS`
+   environment variable and from within a Python program using the
+   :mod:`warnings` module. For example, the :func:`warnings.filterwarnings`
+   function can be used to use a regular expression on the warning message.
 
    See :ref:`warning-filter` and :ref:`describing-warning-filters` for more
    details.
 
-
 .. cmdoption:: -x
 
    Skip the first line of the source, allowing use of non-Unix forms of
@@ -426,11 +448,10 @@
    defines the following possible values:
 
    * ``-X faulthandler`` to enable :mod:`faulthandler`;
-   * ``-X oldparser``: enable the traditional LL(1) parser.  See also
-     :envvar:`PYTHONOLDPARSER` and :pep:`617`.
    * ``-X showrefcount`` to output the total reference count and number of used
      memory blocks when the program finishes or after each statement in the
-     interactive interpreter. This only works on debug builds.
+     interactive interpreter. This only works on :ref:`debug builds
+     <debug-build>`.
    * ``-X tracemalloc`` to start tracing Python memory allocations using the
      :mod:`tracemalloc` module. By default, only the most recent frame is
      stored in a traceback of a trace. Use ``-X tracemalloc=NFRAME`` to start
@@ -444,13 +465,15 @@
    * ``-X dev``: enable :ref:`Python Development Mode <devmode>`, introducing
      additional runtime checks that are too expensive to be enabled by
      default.
-   * ``-X utf8`` enables UTF-8 mode for operating system interfaces, overriding
-     the default locale-aware mode. ``-X utf8=0`` explicitly disables UTF-8
-     mode (even when it would otherwise activate automatically).
-     See :envvar:`PYTHONUTF8` for more details.
+   * ``-X utf8`` enables the :ref:`Python UTF-8 Mode <utf8-mode>`.
+     ``-X utf8=0`` explicitly disables :ref:`Python UTF-8 Mode <utf8-mode>`
+     (even when it would otherwise activate automatically).
    * ``-X pycache_prefix=PATH`` enables writing ``.pyc`` files to a parallel
      tree rooted at the given directory instead of to the code tree. See also
      :envvar:`PYTHONPYCACHEPREFIX`.
+   * ``-X warn_default_encoding`` issues a :class:`EncodingWarning` when the
+     locale-specific default encoding is used for opening files.
+     See also :envvar:`PYTHONWARNDEFAULTENCODING`.
 
    It also allows passing arbitrary values and retrieving them through the
    :data:`sys._xoptions` dictionary.
@@ -480,6 +503,9 @@
 
       The ``-X showalloccount`` option has been removed.
 
+   .. versionadded:: 3.10
+      The ``-X warn_default_encoding`` option.
+
    .. deprecated-removed:: 3.9 3.10
       The ``-X oldparser`` option.
 
@@ -587,15 +613,6 @@
    :option:`-d` multiple times.
 
 
-.. envvar:: PYTHONOLDPARSER
-
-   If this is set to a non-empty string, enable the traditional LL(1) parser.
-
-   See also the :option:`-X` ``oldparser`` option and :pep:`617`.
-
-   .. deprecated-removed:: 3.9 3.10
-
-
 .. envvar:: PYTHONINSPECT
 
    If this is set to a non-empty string it is equivalent to specifying the
@@ -621,7 +638,7 @@
 .. envvar:: PYTHONCASEOK
 
    If this is set, Python ignores case in :keyword:`import` statements.  This
-   only works on Windows and OS X.
+   only works on Windows and macOS.
 
 
 .. envvar:: PYTHONDONTWRITEBYTECODE
@@ -704,7 +721,7 @@
 
    If this environment variable is set, ``sys.argv[0]`` will be set to its
    value instead of the value got through the C runtime.  Only works on
-   Mac OS X.
+   macOS.
 
 .. envvar:: PYTHONWARNINGS
 
@@ -782,17 +799,13 @@
      :c:data:`PYMEM_DOMAIN_MEM` and :c:data:`PYMEM_DOMAIN_OBJ` domains and use
      the :c:func:`malloc` function for the :c:data:`PYMEM_DOMAIN_RAW` domain.
 
-   Install debug hooks:
+   Install :ref:`debug hooks <pymem-debug-hooks>`:
 
    * ``debug``: install debug hooks on top of the :ref:`default memory
      allocators <default-memory-allocators>`.
    * ``malloc_debug``: same as ``malloc`` but also install debug hooks.
    * ``pymalloc_debug``: same as ``pymalloc`` but also install debug hooks.
 
-   See the :ref:`default memory allocators <default-memory-allocators>` and the
-   :c:func:`PyMem_SetupDebugHooks` function (install debug hooks on Python
-   memory allocators).
-
    .. versionchanged:: 3.7
       Added the ``"default"`` allocator.
 
@@ -816,9 +829,10 @@
 
 .. envvar:: PYTHONLEGACYWINDOWSFSENCODING
 
-   If set to a non-empty string, the default filesystem encoding and errors mode
-   will revert to their pre-3.6 values of 'mbcs' and 'replace', respectively.
-   Otherwise, the new defaults 'utf-8' and 'surrogatepass' are used.
+   If set to a non-empty string, the default :term:`filesystem encoding and
+   error handler` mode will revert to their pre-3.6 values of 'mbcs' and
+   'replace', respectively.  Otherwise, the new defaults 'utf-8' and
+   'surrogatepass' are used.
 
    This may also be enabled at runtime with
    :func:`sys._enablelegacywindowsfsencoding()`.
@@ -904,66 +918,35 @@
 
 .. envvar:: PYTHONUTF8
 
-   If set to ``1``, enables the interpreter's UTF-8 mode, where ``UTF-8`` is
-   used as the text encoding for system interfaces, regardless of the
-   current locale setting.
+   If set to ``1``, enable the :ref:`Python UTF-8 Mode <utf8-mode>`.
 
-   This means that:
-
-    * :func:`sys.getfilesystemencoding()` returns ``'UTF-8'`` (the locale
-      encoding is ignored).
-    * :func:`locale.getpreferredencoding()` returns ``'UTF-8'`` (the locale
-      encoding is ignored, and the function's ``do_setlocale`` parameter has no
-      effect).
-    * :data:`sys.stdin`, :data:`sys.stdout`, and :data:`sys.stderr` all use
-      UTF-8 as their text encoding, with the ``surrogateescape``
-      :ref:`error handler <error-handlers>` being enabled for :data:`sys.stdin`
-      and :data:`sys.stdout` (:data:`sys.stderr` continues to use
-      ``backslashreplace`` as it does in the default locale-aware mode)
-
-   As a consequence of the changes in those lower level APIs, other higher
-   level APIs also exhibit different default behaviours:
-
-    * Command line arguments, environment variables and filenames are decoded
-      to text using the UTF-8 encoding.
-    * :func:`os.fsdecode()` and :func:`os.fsencode()` use the UTF-8 encoding.
-    * :func:`open()`, :func:`io.open()`, and :func:`codecs.open()` use the UTF-8
-      encoding by default. However, they still use the strict error handler by
-      default so that attempting to open a binary file in text mode is likely
-      to raise an exception rather than producing nonsense data.
-
-   Note that the standard stream settings in UTF-8 mode can be overridden by
-   :envvar:`PYTHONIOENCODING` (just as they can be in the default locale-aware
-   mode).
-
-   If set to ``0``, the interpreter runs in its default locale-aware mode.
+   If set to ``0``, disable the :ref:`Python UTF-8 Mode <utf8-mode>`.
 
    Setting any other non-empty string causes an error during interpreter
    initialisation.
 
-   If this environment variable is not set at all, then the interpreter defaults
-   to using the current locale settings, *unless* the current locale is
-   identified as a legacy ASCII-based locale
-   (as described for :envvar:`PYTHONCOERCECLOCALE`), and locale coercion is
-   either disabled or fails. In such legacy locales, the interpreter will
-   default to enabling UTF-8 mode unless explicitly instructed not to do so.
-
-   Also available as the :option:`-X` ``utf8`` option.
-
    .. versionadded:: 3.7
-      See :pep:`540` for more details.
+
+.. envvar:: PYTHONWARNDEFAULTENCODING
+
+   If this environment variable is set to a non-empty string, issue a
+   :class:`EncodingWarning` when the locale-specific default encoding is used.
+
+   See :ref:`io-encoding-warning` for details.
+
+   .. versionadded:: 3.10
 
 
 Debug-mode variables
 ~~~~~~~~~~~~~~~~~~~~
 
-Setting these variables only has an effect in a debug build of Python.
-
 .. envvar:: PYTHONTHREADDEBUG
 
-   If set, Python will print threading debug info.
+   If set, Python will print threading debug info into stdout.
 
-   Need Python configured with the ``--with-pydebug`` build option.
+   Need a :ref:`debug build of Python <debug-build>`.
+
+   .. deprecated-removed:: 3.10 3.12
 
 
 .. envvar:: PYTHONDUMPREFS
@@ -971,4 +954,4 @@
    If set, Python will dump objects and reference counts still alive after
    shutting down the interpreter.
 
-   Need Python configured with the ``--with-trace-refs`` build option.
+   Need Python configured with the :option:`--with-trace-refs` build option.
diff --git a/Doc/using/configure.rst b/Doc/using/configure.rst
new file mode 100644
index 0000000..14ffdd7
--- /dev/null
+++ b/Doc/using/configure.rst
@@ -0,0 +1,816 @@
+****************
+Configure Python
+****************
+
+.. _configure-options:
+
+Configure Options
+=================
+
+List all ``./configure`` script options using::
+
+    ./configure --help
+
+See also the :file:`Misc/SpecialBuilds.txt` in the Python source distribution.
+
+General Options
+---------------
+
+.. cmdoption:: --enable-loadable-sqlite-extensions
+
+   Support loadable extensions in the :mod:`_sqlite` extension module (default
+   is no).
+
+   See the :meth:`sqlite3.Connection.enable_load_extension` method of the
+   :mod:`sqlite3` module.
+
+   .. versionadded:: 3.6
+
+.. cmdoption:: --disable-ipv6
+
+   Disable IPv6 support (enabled by default if supported), see the
+   :mod:`socket` module.
+
+.. cmdoption:: --enable-big-digits=[15|30]
+
+   Define the size in bits of Python :class:`int` digits: 15 or 30 bits.
+
+   By default, the number of bits is selected depending on ``sizeof(void*)``:
+   30 bits if ``void*`` size is 64-bit or larger, 15 bits otherwise.
+
+   Define the ``PYLONG_BITS_IN_DIGIT`` to ``15`` or ``30``.
+
+   See :data:`sys.int_info.bits_per_digit <sys.int_info>`.
+
+.. cmdoption:: --with-cxx-main
+.. cmdoption:: --with-cxx-main=COMPILER
+
+   Compile the Python ``main()`` function and link Python executable with C++
+   compiler: ``$CXX``, or *COMPILER* if specified.
+
+.. cmdoption:: --with-suffix=SUFFIX
+
+   Set the Python executable suffix to *SUFFIX*.
+
+   The default suffix is ``.exe`` on Windows and macOS (``python.exe``
+   executable), and an empty string on other platforms (``python`` executable).
+
+.. cmdoption:: --with-tzpath=<list of absolute paths separated by pathsep>
+
+   Select the default time zone search path for :data:`zoneinfo.TZPATH`.
+   See the :ref:`Compile-time configuration
+   <zoneinfo_data_compile_time_config>` of the :mod:`zoneinfo` module.
+
+   Default: ``/usr/share/zoneinfo:/usr/lib/zoneinfo:/usr/share/lib/zoneinfo:/etc/zoneinfo``.
+
+   See :data:`os.pathsep` path separator.
+
+   .. versionadded:: 3.9
+
+.. cmdoption:: --without-decimal-contextvar
+
+   Build the ``_decimal`` extension module using a thread-local context rather
+   than a coroutine-local context (default), see the :mod:`decimal` module.
+
+   See :data:`decimal.HAVE_CONTEXTVAR` and the :mod:`contextvars` module.
+
+   .. versionadded:: 3.9
+
+.. cmdoption:: --with-dbmliborder=db1:db2:...
+
+   Override order to check db backends for the :mod:`dbm` module
+
+   A valid value is a colon (``:``) separated string with the backend names:
+
+   * ``ndbm``;
+   * ``gdbm``;
+   * ``bdb``.
+
+.. cmdoption:: --without-c-locale-coercion
+
+   Disable C locale coercion to a UTF-8 based locale (enabled by default).
+
+   Don't define the ``PY_COERCE_C_LOCALE`` macro.
+
+   See :envvar:`PYTHONCOERCECLOCALE` and the :pep:`538`.
+
+.. cmdoption:: --with-platlibdir=DIRNAME
+
+   Python library directory name (default is ``lib``).
+
+   Fedora and SuSE use ``lib64`` on 64-bit platforms.
+
+   See :data:`sys.platlibdir`.
+
+   .. versionadded:: 3.9
+
+.. cmdoption:: --with-wheel-pkg-dir=PATH
+
+   Directory of wheel packages used by the :mod:`ensurepip` module
+   (none by default).
+
+   Some Linux distribution packaging policies recommend against bundling
+   dependencies. For example, Fedora installs wheel packages in the
+   ``/usr/share/python-wheels/`` directory and don't install the
+   :mod:`ensurepip._bundled` package.
+
+   .. versionadded:: 3.10
+
+
+Install Options
+---------------
+
+.. cmdoption:: --disable-test-modules
+
+   Don't build nor install test modules, like the :mod:`test` package or the
+   :mod:`_testcapi` extension module (built and installed by default).
+
+   .. versionadded:: 3.10
+
+.. cmdoption:: --with-ensurepip=[upgrade|install|no]
+
+   Select the :mod:`ensurepip` command run on Python installation:
+
+   * ``upgrade`` (default): run ``python -m ensurepip --altinstall --upgrade``
+     command.
+   * ``install``: run ``python -m ensurepip --altinstall`` command;
+   * ``no``: don't run ensurepip;
+
+   .. versionadded:: 3.6
+
+
+Performance options
+-------------------
+
+Configuring Python using ``--enable-optimizations --with-lto`` (PGO + LTO) is
+recommended for best performance.
+
+.. cmdoption:: --enable-optimizations
+
+   Enable Profile Guided Optimization (PGO) using :envvar:`PROFILE_TASK`
+   (disabled by default).
+
+   The C compiler Clang requires ``llvm-profdata`` program for PGO. On
+   macOS, GCC also requires it: GCC is just an alias to Clang on macOS.
+
+   Disable also semantic interposition in libpython if ``--enable-shared`` and
+   GCC is used: add ``-fno-semantic-interposition`` to the compiler and linker
+   flags.
+
+   .. versionadded:: 3.6
+
+   .. versionchanged:: 3.10
+      Use ``-fno-semantic-interposition`` on GCC.
+
+.. envvar:: PROFILE_TASK
+
+   Environment variable used in the Makefile: Python command line arguments for
+   the PGO generation task.
+
+   Default: ``-m test --pgo --timeout=$(TESTTIMEOUT)``.
+
+   .. versionadded:: 3.8
+
+.. cmdoption:: --with-lto
+
+   Enable Link Time Optimization (LTO) in any build (disabled by default).
+
+   The C compiler Clang requires ``llvm-ar`` for LTO (``ar`` on macOS), as well
+   as an LTO-aware linker (``ld.gold`` or ``lld``).
+
+   .. versionadded:: 3.6
+
+.. cmdoption:: --with-computed-gotos
+
+   Enable computed gotos in evaluation loop (enabled by default on supported
+   compilers).
+
+.. cmdoption:: --without-pymalloc
+
+   Disable the specialized Python memory allocator :ref:`pymalloc <pymalloc>`
+   (enabled by default).
+
+   See also :envvar:`PYTHONMALLOC` environment variable.
+
+.. cmdoption:: --without-doc-strings
+
+   Disable static documentation strings to reduce the memory footprint (enabled
+   by default). Documentation strings defined in Python are not affected.
+
+   Don't define the ``WITH_DOC_STRINGS`` macro.
+
+   See the ``PyDoc_STRVAR()`` macro.
+
+.. cmdoption:: --enable-profiling
+
+   Enable C-level code profiling with ``gprof`` (disabled by default).
+
+
+.. _debug-build:
+
+Python Debug Build
+------------------
+
+A debug build is Python built with the :option:`--with-pydebug` configure
+option.
+
+Effects of a debug build:
+
+* Display all warnings by default: the list of default warning filters is empty
+  in the :mod:`warnings` module.
+* Add ``d`` to :data:`sys.abiflags`.
+* Add :func:`sys.gettotalrefcount` function.
+* Add :option:`-X showrefcount <-X>` command line option.
+* Add :envvar:`PYTHONTHREADDEBUG` environment variable.
+* Add support for the ``__ltrace__`` variable: enable low-level tracing in the
+  bytecode evaluation loop if the variable is defined.
+* Install :ref:`debug hooks on memory allocators <default-memory-allocators>`
+  to detect buffer overflow and other memory errors.
+* Define ``Py_DEBUG`` and ``Py_REF_DEBUG`` macros.
+* Add runtime checks: code surroundeded by ``#ifdef Py_DEBUG`` and ``#endif``.
+  Enable ``assert(...)`` and ``_PyObject_ASSERT(...)`` assertions: don't set
+  the ``NDEBUG`` macro (see also the :option:`--with-assertions` configure
+  option). Main runtime checks:
+
+  * Add sanity checks on the function arguments.
+  * Unicode and int objects are created with their memory filled with a pattern
+    to detect usage of uninitialized objects.
+  * Ensure that functions which can clear or replace the current exception are
+    not called with an exception raised.
+  * The garbage collector (:func:`gc.collect` function) runs some basic checks
+    on objects consistency.
+  * The :c:macro:`Py_SAFE_DOWNCAST()` macro checks for integer underflow and
+    overflow when downcasting from wide types to narrow types.
+
+See also the :ref:`Python Development Mode <devmode>` and the
+:option:`--with-trace-refs` configure option.
+
+.. versionchanged:: 3.8
+   Release builds and debug builds are now ABI compatible: defining the
+   ``Py_DEBUG`` macro no longer implies the ``Py_TRACE_REFS`` macro (see the
+   :option:`--with-trace-refs` option), which introduces the only ABI
+   incompatibility.
+
+
+Debug options
+-------------
+
+.. cmdoption:: --with-pydebug
+
+   :ref:`Build Python in debug mode <debug-build>`: define the ``Py_DEBUG``
+   macro (disabled by default).
+
+.. cmdoption:: --with-trace-refs
+
+   Enable tracing references for debugging purpose (disabled by default).
+
+   Effects:
+
+   * Define the ``Py_TRACE_REFS`` macro.
+   * Add :func:`sys.getobjects` function.
+   * Add :envvar:`PYTHONDUMPREFS` environment variable.
+
+   This build is not ABI compatible with release build (default build) or debug
+   build (``Py_DEBUG`` and ``Py_REF_DEBUG`` macros).
+
+   .. versionadded:: 3.8
+
+.. cmdoption:: --with-assertions
+
+   Build with C assertions enabled (default is no): ``assert(...);`` and
+   ``_PyObject_ASSERT(...);``.
+
+   If set, the ``NDEBUG`` macro is not defined in the :envvar:`OPT` compiler
+   variable.
+
+   See also the :option:`--with-pydebug` option (:ref:`debug build
+   <debug-build>`) which also enables assertions.
+
+   .. versionadded:: 3.6
+
+.. cmdoption:: --with-valgrind
+
+   Enable Valgrind support (default is no).
+
+.. cmdoption:: --with-dtrace
+
+   Enable DTrace support (default is no).
+
+   See :ref:`Instrumenting CPython with DTrace and SystemTap
+   <instrumentation>`.
+
+   .. versionadded:: 3.6
+
+.. cmdoption:: --with-address-sanitizer
+
+   Enable AddressSanitizer memory error detector, ``asan`` (default is no).
+
+   .. versionadded:: 3.6
+
+.. cmdoption:: --with-memory-sanitizer
+
+   Enable MemorySanitizer allocation error detector, ``msan`` (default is no).
+
+   .. versionadded:: 3.6
+
+.. cmdoption:: --with-undefined-behavior-sanitizer
+
+   Enable UndefinedBehaviorSanitizer undefined behaviour detector, ``ubsan``
+   (default is no).
+
+   .. versionadded:: 3.6
+
+
+Linker options
+--------------
+
+.. cmdoption:: --enable-shared
+
+   Enable building a shared Python library: ``libpython`` (default is no).
+
+.. cmdoption:: --without-static-libpython
+
+   Do not build ``libpythonMAJOR.MINOR.a`` and do not install ``python.o``
+   (built and enabled by default).
+
+   .. versionadded:: 3.10
+
+
+Libraries options
+-----------------
+
+.. cmdoption:: --with-libs='lib1 ...'
+
+   Link against additional libraries (default is no).
+
+.. cmdoption:: --with-system-expat
+
+   Build the :mod:`pyexpat` module using an installed ``expat`` library
+   (default is no).
+
+.. cmdoption:: --with-system-ffi
+
+   Build the :mod:`_ctypes` extension module using an installed ``ffi``
+   library, see the :mod:`ctypes` module (default is system-dependent).
+
+.. cmdoption:: --with-system-libmpdec
+
+   Build the ``_decimal`` extension module using an installed ``mpdec``
+   library, see the :mod:`decimal` module (default is no).
+
+   .. versionadded:: 3.3
+
+.. cmdoption:: --with-readline=editline
+
+   Use ``editline`` library for backend of the :mod:`readline` module.
+
+   Define the ``WITH_EDITLINE`` macro.
+
+   .. versionadded:: 3.10
+
+.. cmdoption:: --without-readline
+
+   Don't build the :mod:`readline` module (built by default).
+
+   Don't define the ``HAVE_LIBREADLINE`` macro.
+
+   .. versionadded:: 3.10
+
+.. cmdoption:: --with-tcltk-includes='-I...'
+
+   Override search for Tcl and Tk include files.
+
+.. cmdoption:: --with-tcltk-libs='-L...'
+
+   Override search for Tcl and Tk libraries.
+
+.. cmdoption:: --with-libm=STRING
+
+   Override ``libm`` math library to *STRING* (default is system-dependent).
+
+.. cmdoption:: --with-libc=STRING
+
+   Override ``libc`` C library to *STRING* (default is system-dependent).
+
+.. cmdoption:: --with-openssl=DIR
+
+   Root of the OpenSSL directory.
+
+   .. versionadded:: 3.7
+
+.. cmdoption:: --with-openssl-rpath=[no|auto|DIR]
+
+   Set runtime library directory (rpath) for OpenSSL libraries:
+
+   * ``no`` (default): don't set rpath;
+   * ``auto``: auto-detect rpath from :option:`--with-openssl` and
+     ``pkg-config``;
+   * *DIR*: set an explicit rpath.
+
+   .. versionadded:: 3.10
+
+
+Security Options
+----------------
+
+.. cmdoption:: --with-hash-algorithm=[fnv|siphash24]
+
+   Select hash algorithm for use in ``Python/pyhash.c``:
+
+   * ``siphash24`` (default).
+   * ``fnv``;
+
+   .. versionadded:: 3.4
+
+.. cmdoption:: --with-builtin-hashlib-hashes=md5,sha1,sha256,sha512,sha3,blake2
+
+   Built-in hash modules:
+
+   * ``md5``;
+   * ``sha1``;
+   * ``sha256``;
+   * ``sha512``;
+   * ``sha3`` (with shake);
+   * ``blake2``.
+
+   .. versionadded:: 3.9
+
+.. cmdoption:: --with-ssl-default-suites=[python|openssl|STRING]
+
+   Override the OpenSSL default cipher suites string:
+
+   * ``python`` (default): use Python's preferred selection;
+   * ``openssl``: leave OpenSSL's defaults untouched;
+   * *STRING*: use a custom string
+
+   See the :mod:`ssl` module.
+
+   .. versionadded:: 3.7
+
+   .. versionchanged:: 3.10
+
+      The settings ``python`` and *STRING* also set TLS 1.2 as minimum
+      protocol version.
+
+macOS Options
+-------------
+
+See ``Mac/README.rst``.
+
+.. cmdoption:: --enable-universalsdk
+.. cmdoption:: --enable-universalsdk=SDKDIR
+
+   Create a universal binary build. *SDKDIR* specifies which macOS SDK should
+   be used to perform the build (default is no).
+
+.. cmdoption:: --enable-framework
+.. cmdoption:: --enable-framework=INSTALLDIR
+
+   Create a Python.framework rather than a traditional Unix install. Optional
+   *INSTALLDIR* specifies the installation path (default is no).
+
+.. cmdoption:: --with-universal-archs=ARCH
+
+   Specify the kind of universal binary that should be created. This option is
+   only valid when :option:`--enable-universalsdk` is set.
+
+   Options:
+
+   * ``universal2``;
+   * ``32-bit``;
+   * ``64-bit``;
+   * ``3-way``;
+   * ``intel``;
+   * ``intel-32``;
+   * ``intel-64``;
+   * ``all``.
+
+.. cmdoption:: --with-framework-name=FRAMEWORK
+
+   Specify the name for the python framework on macOS only valid when
+   :option:`--enable-framework` is set (default: ``Python``).
+
+
+Python Build System
+===================
+
+Main files of the build system
+------------------------------
+
+* :file:`configure.ac` => :file:`configure`;
+* :file:`Makefile.pre.in` => :file:`Makefile` (created by :file:`configure`);
+* :file:`pyconfig.h` (created by :file:`configure`);
+* :file:`Modules/Setup`: C extensions built by the Makefile using
+  :file:`Module/makesetup` shell script;
+* :file:`setup.py`: C extensions built using the :mod:`distutils` module.
+
+Main build steps
+----------------
+
+* C files (``.c``) are built as object files (``.o``).
+* A static ``libpython`` library (``.a``) is created from objects files.
+* ``python.o`` and the static ``libpython`` library are linked into the
+  final ``python`` program.
+* C extensions are built by the Makefile (see :file:`Modules/Setup`)
+  and ``python setup.py build``.
+
+Main Makefile targets
+---------------------
+
+* ``make``: Build Python with the standard library.
+* ``make platform:``: build the ``python`` program, but don't build the
+  standard library extension modules.
+* ``make profile-opt``: build Python using Profile Guided Optimization (PGO).
+  You can use the configure :option:`--enable-optimizations` option to make
+  this the default target of the ``make`` command (``make all`` or just
+  ``make``).
+* ``make buildbottest``: Build Python and run the Python test suite, the same
+  way than buildbots test Python. Set ``TESTTIMEOUT`` variable (in seconds)
+  to change the test timeout (1200 by default: 20 minutes).
+* ``make install``: Build and install Python.
+* ``make regen-all``: Regenerate (almost) all generated files;
+  ``make regen-stdlib-module-names`` and ``autoconf`` must be run separately
+  for the remaining generated files.
+* ``make clean``: Remove built files.
+* ``make distclean``: Same than ``make clean``, but remove also files created
+  by the configure script.
+
+C extensions
+------------
+
+Some C extensions are built as built-in modules, like the ``sys`` module.
+They are built with the ``Py_BUILD_CORE_BUILTIN`` macro defined.
+Built-in modules have no ``__file__`` attribute::
+
+    >>> import sys
+    >>> sys
+    <module 'sys' (built-in)>
+    >>> sys.__file__
+    Traceback (most recent call last):
+      File "<stdin>", line 1, in <module>
+    AttributeError: module 'sys' has no attribute '__file__'
+
+Other C extensins are built as dynamic libraries, like the ``_asyncio`` module.
+They are built with the ``Py_BUILD_CORE_MODULE`` macro defined.
+Example on Linux x86-64::
+
+    >>> import _asyncio
+    >>> _asyncio
+    <module '_asyncio' from '/usr/lib64/python3.9/lib-dynload/_asyncio.cpython-39-x86_64-linux-gnu.so'>
+    >>> _asyncio.__file__
+    '/usr/lib64/python3.9/lib-dynload/_asyncio.cpython-39-x86_64-linux-gnu.so'
+
+:file:`Modules/Setup` is used to generate Makefile targets to build C extensions.
+At the beginning of the files, C extensions are built as built-in modules.
+Extensions defined after the ``*shared*`` marker are built as dynamic libraries.
+
+The :file:`setup.py` script only builds C extensions as shared libraries using
+the :mod:`distutils` module.
+
+The :c:macro:`PyAPI_FUNC()`, :c:macro:`PyAPI_API()` and
+:c:macro:`PyMODINIT_FUNC()` macros of :file:`Include/pyport.h` are defined
+differently depending if the ``Py_BUILD_CORE_MODULE`` macro is defined:
+
+* Use ``Py_EXPORTED_SYMBOL`` if the ``Py_BUILD_CORE_MODULE`` is defined
+* Use ``Py_IMPORTED_SYMBOL`` otherwise.
+
+If the ``Py_BUILD_CORE_BUILTIN`` macro is used by mistake on a C extension
+built as a shared library, its ``PyInit_xxx()`` function is not exported,
+causing an :exc:`ImportError` on import.
+
+
+Compiler and linker flags
+=========================
+
+Options set by the ``./configure`` script and environment variables and used by
+``Makefile``.
+
+Preprocessor flags
+------------------
+
+.. envvar:: CONFIGURE_CPPFLAGS
+
+   Value of :envvar:`CPPFLAGS` variable passed to the ``./configure`` script.
+
+   .. versionadded:: 3.6
+
+.. envvar:: CPPFLAGS
+
+   (Objective) C/C++ preprocessor flags, e.g. ``-I<include dir>`` if you have
+   headers in a nonstandard directory ``<include dir>``.
+
+   Both :envvar:`CPPFLAGS` and :envvar:`LDFLAGS` need to contain the shell's
+   value for setup.py to be able to build extension modules using the
+   directories specified in the environment variables.
+
+.. envvar:: BASECPPFLAGS
+
+   .. versionadded:: 3.4
+
+.. envvar:: PY_CPPFLAGS
+
+   Extra preprocessor flags added for building the interpreter object files.
+
+   Default: ``$(BASECPPFLAGS) -I. -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) $(CPPFLAGS)``.
+
+   .. versionadded:: 3.2
+
+Compiler flags
+--------------
+
+.. envvar:: CC
+
+   C compiler command.
+
+   Example: ``gcc -pthread``.
+
+.. envvar:: MAINCC
+
+   C compiler command used to build the ``main()`` function of programs like
+   ``python``.
+
+   Variable set by the :option:`--with-cxx-main` option of the configure
+   script.
+
+   Default: ``$(CC)``.
+
+.. envvar:: CXX
+
+   C++ compiler command.
+
+   Used if the :option:`--with-cxx-main` option is used.
+
+   Example: ``g++ -pthread``.
+
+.. envvar:: CFLAGS
+
+   C compiler flags.
+
+.. envvar:: CFLAGS_NODIST
+
+   :envvar:`CFLAGS_NODIST` is used for building the interpreter and stdlib C
+   extensions.  Use it when a compiler flag should *not* be part of the
+   distutils :envvar:`CFLAGS` once Python is installed (:issue:`21121`).
+
+   .. versionadded:: 3.5
+
+.. envvar:: EXTRA_CFLAGS
+
+   Extra C compiler flags.
+
+.. envvar:: CONFIGURE_CFLAGS
+
+   Value of :envvar:`CFLAGS` variable passed to the ``./configure``
+   script.
+
+   .. versionadded:: 3.2
+
+.. envvar:: CONFIGURE_CFLAGS_NODIST
+
+   Value of :envvar:`CFLAGS_NODIST` variable passed to the ``./configure``
+   script.
+
+   .. versionadded:: 3.5
+
+.. envvar:: BASECFLAGS
+
+   Base compiler flags.
+
+.. envvar:: OPT
+
+   Optimization flags.
+
+.. envvar:: CFLAGS_ALIASING
+
+   Strict or non-strict aliasing flags used to compile ``Python/dtoa.c``.
+
+   .. versionadded:: 3.7
+
+.. envvar:: CCSHARED
+
+   Compiler flags used to build a shared library.
+
+   For example, ``-fPIC`` is used on Linux and on BSD.
+
+.. envvar:: CFLAGSFORSHARED
+
+   Extra C flags added for building the interpreter object files.
+
+   Default: ``$(CCSHARED)`` when :option:`--enable-shared` is used, or an empty
+   string otherwise.
+
+.. envvar:: PY_CFLAGS
+
+   Default: ``$(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS) $(EXTRA_CFLAGS)``.
+
+.. envvar:: PY_CFLAGS_NODIST
+
+   Default: ``$(CONFIGURE_CFLAGS_NODIST) $(CFLAGS_NODIST) -I$(srcdir)/Include/internal``.
+
+   .. versionadded:: 3.5
+
+.. envvar:: PY_STDMODULE_CFLAGS
+
+   C flags used for building the interpreter object files.
+
+   Default: ``$(PY_CFLAGS) $(PY_CFLAGS_NODIST) $(PY_CPPFLAGS) $(CFLAGSFORSHARED)``.
+
+   .. versionadded:: 3.7
+
+.. envvar:: PY_CORE_CFLAGS
+
+   Default: ``$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE``.
+
+   .. versionadded:: 3.2
+
+.. envvar:: PY_BUILTIN_MODULE_CFLAGS
+
+   Compiler flags to build a standard library extension module as a built-in
+   module, like the :mod:`posix` module.
+
+   Default: ``$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN``.
+
+   .. versionadded:: 3.8
+
+.. envvar:: PURIFY
+
+   Purify command. Purify is a memory debugger program.
+
+   Default: empty string (not used).
+
+
+Linker flags
+------------
+
+.. envvar:: LINKCC
+
+   Linker command used to build programs like ``python`` and ``_testembed``.
+
+   Default: ``$(PURIFY) $(MAINCC)``.
+
+.. envvar:: CONFIGURE_LDFLAGS
+
+   Value of :envvar:`LDFLAGS` variable passed to the ``./configure`` script.
+
+   Avoid assigning :envvar:`CFLAGS`, :envvar:`LDFLAGS`, etc. so users can use
+   them on the command line to append to these values without stomping the
+   pre-set values.
+
+   .. versionadded:: 3.2
+
+.. envvar:: LDFLAGS_NODIST
+
+   :envvar:`LDFLAGS_NODIST` is used in the same manner as
+   :envvar:`CFLAGS_NODIST`.  Use it when a linker flag should *not* be part of
+   the distutils :envvar:`LDFLAGS` once Python is installed (:issue:`35257`).
+
+.. envvar:: CONFIGURE_LDFLAGS_NODIST
+
+   Value of :envvar:`LDFLAGS_NODIST` variable passed to the ``./configure``
+   script.
+
+   .. versionadded:: 3.8
+
+.. envvar:: LDFLAGS
+
+   Linker flags, e.g. ``-L<lib dir>`` if you have libraries in a nonstandard
+   directory ``<lib dir>``.
+
+   Both :envvar:`CPPFLAGS` and :envvar:`LDFLAGS` need to contain the shell's
+   value for setup.py to be able to build extension modules using the
+   directories specified in the environment variables.
+
+.. envvar:: LIBS
+
+   Linker flags to pass libraries to the linker when linking the Python
+   executable.
+
+   Example: ``-lrt``.
+
+.. envvar:: LDSHARED
+
+   Command to build a shared library.
+
+   Default: ``@LDSHARED@ $(PY_LDFLAGS)``.
+
+.. envvar:: BLDSHARED
+
+   Command to build ``libpython`` shared library.
+
+   Default: ``@BLDSHARED@ $(PY_CORE_LDFLAGS)``.
+
+.. envvar:: PY_LDFLAGS
+
+   Default: ``$(CONFIGURE_LDFLAGS) $(LDFLAGS)``.
+
+.. envvar:: PY_LDFLAGS_NODIST
+
+   Default: ``$(CONFIGURE_LDFLAGS_NODIST) $(LDFLAGS_NODIST)``.
+
+   .. versionadded:: 3.8
+
+.. envvar:: PY_CORE_LDFLAGS
+
+   Linker flags used for building the interpreter object files.
+
+   .. versionadded:: 3.8
diff --git a/Doc/using/index.rst b/Doc/using/index.rst
index 4a45121..e1a3111 100644
--- a/Doc/using/index.rst
+++ b/Doc/using/index.rst
@@ -15,6 +15,7 @@
 
    cmdline.rst
    unix.rst
+   configure.rst
    windows.rst
    mac.rst
    editors.rst
diff --git a/Doc/using/mac.rst b/Doc/using/mac.rst
index ead71e1..2f132a9 100644
--- a/Doc/using/mac.rst
+++ b/Doc/using/mac.rst
@@ -1,14 +1,14 @@
 
 .. _using-on-mac:
 
-***************************
-Using Python on a Macintosh
-***************************
+*********************
+Using Python on a Mac
+*********************
 
 :Author: Bob Savage <bobsavage@mac.com>
 
 
-Python on a Macintosh running Mac OS X is in principle very similar to Python on
+Python on a Mac running macOS is in principle very similar to Python on
 any other Unix platform, but there are a number of additional features such as
 the IDE and the Package Manager that are worth pointing out.
 
@@ -17,7 +17,7 @@
 Getting and Installing MacPython
 ================================
 
-Mac OS X 10.8 comes with Python 2.7 pre-installed by Apple.  If you wish, you
+macOS since version 10.8 comes with Python 2.7 pre-installed by Apple.  If you wish, you
 are invited to install the most recent version of Python 3 from the Python
 website (https://www.python.org).  A current "universal binary" build of Python,
 which runs natively on the Mac's new Intel and legacy PPC CPU's, is available
@@ -54,12 +54,12 @@
 How to run a Python script
 --------------------------
 
-Your best way to get started with Python on Mac OS X is through the IDLE
+Your best way to get started with Python on macOS is through the IDLE
 integrated development environment, see section :ref:`ide` and use the Help menu
 when the IDE is running.
 
 If you want to run Python scripts from the Terminal window command line or from
-the Finder you first need an editor to create your script. Mac OS X comes with a
+the Finder you first need an editor to create your script. macOS comes with a
 number of standard Unix command line editors, :program:`vim` and
 :program:`emacs` among them. If you want a more Mac-like editor,
 :program:`BBEdit` or :program:`TextWrangler` from Bare Bones Software (see
@@ -87,7 +87,7 @@
 Running scripts with a GUI
 --------------------------
 
-With older versions of Python, there is one Mac OS X quirk that you need to be
+With older versions of Python, there is one macOS quirk that you need to be
 aware of: programs that talk to the Aqua window manager (in other words,
 anything that has a GUI) need to be run in a special way. Use :program:`pythonw`
 instead of :program:`python` to start such scripts.
@@ -98,7 +98,7 @@
 Configuration
 -------------
 
-Python on OS X honors all standard Unix environment variables such as
+Python on macOS honors all standard Unix environment variables such as
 :envvar:`PYTHONPATH`, but setting these variables for programs started from the
 Finder is non-standard as the Finder does not read your :file:`.profile` or
 :file:`.cshrc` at startup. You need to create a file
@@ -148,10 +148,10 @@
 https://www.activestate.com; it can also be built from source.
 
 *wxPython* is another popular cross-platform GUI toolkit that runs natively on
-Mac OS X. Packages and documentation are available from https://www.wxpython.org.
+macOS. Packages and documentation are available from https://www.wxpython.org.
 
-*PyQt* is another popular cross-platform GUI toolkit that runs natively on Mac
-OS X. More information can be found at
+*PyQt* is another popular cross-platform GUI toolkit that runs natively on
+macOS. More information can be found at
 https://riverbankcomputing.com/software/pyqt/intro.
 
 
diff --git a/Doc/using/unix.rst b/Doc/using/unix.rst
index c0a5643..0a18344 100644
--- a/Doc/using/unix.rst
+++ b/Doc/using/unix.rst
@@ -78,9 +78,9 @@
    make
    make install
 
-Configuration options and caveats for specific Unix platforms are extensively
-documented in the :source:`README.rst` file in the root of the Python source
-tree.
+:ref:`Configuration options <configure-options>` and caveats for specific Unix
+platforms are extensively documented in the :source:`README.rst` file in the
+root of the Python source tree.
 
 .. warning::
 
@@ -134,3 +134,56 @@
 ``/usr/bin/python3`` as the interpreter path.
 
 To use shell commands in your Python scripts, look at the :mod:`subprocess` module.
+
+.. _unix_custom_openssl:
+
+Custom OpenSSL
+==============
+
+1. To use your vendor's OpenSSL configuration and system trust store, locate
+   the directory with ``openssl.cnf`` file or symlink in ``/etc``. On most
+   distribution the file is either in ``/etc/ssl`` or ``/etc/pki/tls``. The
+   directory should also contain a ``cert.pem`` file and/or a ``certs``
+   directory.
+
+   .. code-block:: shell-session
+
+      $ find /etc/ -name openssl.cnf -printf "%h\n"
+      /etc/ssl
+
+2. Download, build, and install OpenSSL. Make sure you use ``install_sw`` and
+   not ``install``. The ``install_sw`` target does not override
+   ``openssl.cnf``.
+
+   .. code-block:: shell-session
+
+      $ curl -O https://www.openssl.org/source/openssl-VERSION.tar.gz
+         $ tar xzf openssl-VERSION
+         $ pushd openssl-VERSION
+         $ ./config \
+              --prefix=/usr/local/custom-openssl \
+              --libdir=lib \
+              --openssldir=/etc/ssl
+         $ make -j1 depend
+         $ make -j8
+         $ make install_sw
+         $ popd
+
+3. Build Python with custom OpenSSL
+   (see the configure `--with-openssl` and `--with-openssl-rpath` options)
+
+   .. code-block:: shell-session
+
+      $ pushd python-3.x.x
+      $ ./configure -C \
+          --with-openssl=/usr/local/custom-openssl \
+          --with-openssl-rpath=auto \
+          --prefix=/usr/local/python-3.x.x
+      $ make -j8
+      $ make altinstall
+
+.. note::
+
+   Patch releases of OpenSSL have a backwards compatible ABI. You don't need
+   to recompile Python to update OpenSSL. It's sufficient to replace the
+   custom OpenSSL installation with a newer version.
diff --git a/Doc/using/venv-create.inc b/Doc/using/venv-create.inc
index 5e724cd..ddb36f9 100644
--- a/Doc/using/venv-create.inc
+++ b/Doc/using/venv-create.inc
@@ -126,6 +126,10 @@
 |             | PowerShell      | PS C:\\> <venv>\\Scripts\\Activate.ps1  |
 +-------------+-----------------+-----------------------------------------+
 
+When a virtual environment is active, the :envvar:`VIRTUAL_ENV` environment
+variable is set to the path of the virtual environment. This can be used to
+check if one is running inside a virtual environment.
+
 You don't specifically *need* to activate an environment; activation just
 prepends the virtual environment's binary directory to your path, so that
 "python" invokes the virtual environment's Python interpreter and you can run
diff --git a/Doc/using/win_installer.png b/Doc/using/win_installer.png
index 9c18ff1..03bf2d7 100644
--- a/Doc/using/win_installer.png
+++ b/Doc/using/win_installer.png
Binary files differ
diff --git a/Doc/using/windows.rst b/Doc/using/windows.rst
index d0c342e..cad7f69 100644
--- a/Doc/using/windows.rst
+++ b/Doc/using/windows.rst
@@ -129,8 +129,8 @@
 To completely hide the installer UI and install Python silently, pass the
 ``/quiet`` option. To skip past the user interaction but still display
 progress and errors, pass the ``/passive`` option. The ``/uninstall``
-option may be passed to immediately begin removing Python - no prompt will be
-displayed.
+option may be passed to immediately begin removing Python - no confirmation
+prompt will be displayed.
 
 All other options are passed as ``name=value``, where the value is usually
 ``0`` to disable a feature, ``1`` to enable a feature, or a path. The full list
@@ -339,6 +339,11 @@
 Instead, it will write to a private copy. If your scripts must modify the
 shared locations, you will need to install the full installer.
 
+For more detail on the technical basis for these limitations, please consult
+Microsoft's documentation on packaged full-trust apps, currently available at
+`docs.microsoft.com/en-us/windows/msix/desktop/desktop-to-uwp-behind-the-scenes
+<https://docs.microsoft.com/en-us/windows/msix/desktop/desktop-to-uwp-behind-the-scenes>`_
+
 
 .. _windows-nuget:
 
@@ -614,21 +619,14 @@
 This may cause issues because UTF-8 is widely used on the internet
 and most Unix systems, including WSL (Windows Subsystem for Linux).
 
-You can use UTF-8 mode to change the default text encoding to UTF-8.
-You can enable UTF-8 mode via the ``-X utf8`` command line option, or
-the ``PYTHONUTF8=1`` environment variable.  See :envvar:`PYTHONUTF8` for
-enabling UTF-8 mode, and :ref:`setting-envvars` for how to modify
-environment variables.
+You can use the :ref:`Python UTF-8 Mode <utf8-mode>` to change the default text
+encoding to UTF-8. You can enable the :ref:`Python UTF-8 Mode <utf8-mode>` via
+the ``-X utf8`` command line option, or the ``PYTHONUTF8=1`` environment
+variable.  See :envvar:`PYTHONUTF8` for enabling UTF-8 mode, and
+:ref:`setting-envvars` for how to modify environment variables.
 
-When UTF-8 mode is enabled:
-
-* :func:`locale.getpreferredencoding` returns ``'UTF-8'`` instead of
-  the system encoding.  This function is used for the default text
-  encoding in many places, including :func:`open`, :class:`Popen`,
-  :meth:`Path.read_text`, etc.
-* :data:`sys.stdin`, :data:`sys.stdout`, and :data:`sys.stderr`
-  all use UTF-8 as their text encoding.
-* You can still use the system encoding via the "mbcs" codec.
+When the :ref:`Python UTF-8 Mode <utf8-mode>` is enabled, you can still use the
+system encoding (the ANSI Code Page) via the "mbcs" codec.
 
 Note that adding ``PYTHONUTF8=1`` to the default environment variables
 will affect all Python 3.7+ applications on your system.
@@ -641,7 +639,8 @@
    on Windows for:
 
    * Console I/O including standard I/O (see :pep:`528` for details).
-   * The filesystem encoding (see :pep:`529` for details).
+   * The :term:`filesystem encoding <filesystem encoding and error handler>`
+     (see :pep:`529` for details).
 
 
 .. _launcher:
@@ -1107,7 +1106,7 @@
 cx_Freeze
 ---------
 
-`cx_Freeze <https://anthony-tuininga.github.io/cx_Freeze/>`_ is a :mod:`distutils`
+`cx_Freeze <https://cx-freeze.readthedocs.io/en/latest/>`_ is a :mod:`distutils`
 extension (see :ref:`extending-distutils`) which wraps Python scripts into
 executable Windows programs (:file:`{*}.exe` files).  When you have done this,
 you can distribute your application without requiring your users to install
@@ -1150,8 +1149,6 @@
       MinGW gcc under Windows" or "Installing Python extension with distutils
       and without Microsoft Visual C++" by Sébastien Sauvage, 2003
 
-   `MingW -- Python extensions <http://www.mingw.org/wiki/FAQ#toc14>`_
-
 
 Other Platforms
 ===============
diff --git a/Doc/whatsnew/2.0.rst b/Doc/whatsnew/2.0.rst
index ace396b..0e1cf1f 100644
--- a/Doc/whatsnew/2.0.rst
+++ b/Doc/whatsnew/2.0.rst
@@ -108,7 +108,7 @@
 Discussions of new features can often explode into lengthy mailing list threads,
 making the discussion hard to follow, and no one can read every posting to
 python-dev.  Therefore, a relatively formal process has been set up to write
-Python Enhancement Proposals (PEPs), modelled on the Internet RFC process.  PEPs
+Python Enhancement Proposals (PEPs), modelled on the internet RFC process.  PEPs
 are draft documents that describe a proposed new feature, and are continually
 revised until the community reaches a consensus, either accepting or rejecting
 the proposal.  Quoting from the introduction to :pep:`1`, "PEP Purpose and
@@ -768,7 +768,7 @@
 it easy to have the Python interpreter use a custom allocator instead of C's
 standard :func:`malloc`.  For documentation, read the comments in
 :file:`Include/pymem.h` and :file:`Include/objimpl.h`.  For the lengthy
-discussions during which the interface was hammered out, see the Web archives of
+discussions during which the interface was hammered out, see the web archives of
 the 'patches' and 'python-dev' lists at python.org.
 
 Recent versions of the GUSI development environment for MacOS support POSIX
@@ -791,7 +791,7 @@
 limiting the size of source files.  In particular, this affected the maximum
 size of literal lists and dictionaries in Python source; occasionally people who
 are generating Python code would run into this limit.  A patch by Charles G.
-Waldman raises the limit from ``2^16`` to ``2^{32}``.
+Waldman raises the limit from ``2**16`` to ``2**32``.
 
 Three new convenience functions intended for adding constants to a module's
 dictionary at module initialization time were added: :func:`PyModule_AddObject`,
@@ -1002,7 +1002,7 @@
 ---------------------
 
 The XML Special Interest Group has been working on XML-related Python code for a
-while.  Its code distribution, called PyXML, is available from the SIG's Web
+while.  Its code distribution, called PyXML, is available from the SIG's web
 pages at https://www.python.org/community/sigs/current/xml-sig. The PyXML distribution also used
 the package name ``xml``.  If you've written programs that used PyXML, you're
 probably wondering about its compatibility with the 2.0 :mod:`xml` package.
@@ -1109,7 +1109,7 @@
   Prescod.)
 
 * :mod:`robotparser`: Parse a :file:`robots.txt` file, which is used for writing
-  Web spiders that politely avoid certain areas of a Web site.  The parser accepts
+  web spiders that politely avoid certain areas of a web site.  The parser accepts
   the contents of a :file:`robots.txt` file, builds a set of rules from it, and
   can then answer questions about the fetchability of a given URL.  (Contributed
   by Skip Montanaro.)
diff --git a/Doc/whatsnew/2.1.rst b/Doc/whatsnew/2.1.rst
index 8b1eac9..b690f90 100644
--- a/Doc/whatsnew/2.1.rst
+++ b/Doc/whatsnew/2.1.rst
@@ -425,7 +425,7 @@
 In Python 2.1, functions can now have arbitrary information attached to them.
 People were often using docstrings to hold information about functions and
 methods, because the ``__doc__`` attribute was the only way of attaching any
-information to a function.  For example, in the Zope Web application server,
+information to a function.  For example, in the Zope web application server,
 functions are marked as safe for public access by having a docstring, and in
 John Aycock's SPARK parsing framework, docstrings hold parts of the BNF grammar
 to be parsed.  This overloading is unfortunate, since docstrings are really
diff --git a/Doc/whatsnew/2.2.rst b/Doc/whatsnew/2.2.rst
index b4cd434..9355c1b 100644
--- a/Doc/whatsnew/2.2.rst
+++ b/Doc/whatsnew/2.2.rst
@@ -49,7 +49,7 @@
 complicated section of this article, I'll provide an overview of the changes and
 offer some comments.
 
-A long time ago I wrote a Web page listing flaws in Python's design.  One of the
+A long time ago I wrote a web page listing flaws in Python's design.  One of the
 most significant flaws was that it's impossible to subclass Python types
 implemented in C.  In particular, it's not possible to subclass built-in types,
 so you can't just subclass, say, lists in order to add a single useful method to
diff --git a/Doc/whatsnew/2.3.rst b/Doc/whatsnew/2.3.rst
index dac0e63..cf55520 100644
--- a/Doc/whatsnew/2.3.rst
+++ b/Doc/whatsnew/2.3.rst
@@ -1650,7 +1650,7 @@
 
 * The new :mod:`DocXMLRPCServer` module allows writing self-documenting XML-RPC
   servers. Run it in demo mode (as a program) to see it in action.   Pointing the
-  Web browser to the RPC server produces pydoc-style documentation; pointing
+  web browser to the RPC server produces pydoc-style documentation; pointing
   xmlrpclib to the server allows invoking the actual methods. (Contributed by
   Brian Quinlan.)
 
diff --git a/Doc/whatsnew/2.7.rst b/Doc/whatsnew/2.7.rst
index d19c8e0..abb6522 100644
--- a/Doc/whatsnew/2.7.rst
+++ b/Doc/whatsnew/2.7.rst
@@ -953,12 +953,12 @@
   considered and traversed by the collector.
   (Contributed by Antoine Pitrou; :issue:`4688`.)
 
-* Long integers are now stored internally either in base 2**15 or in base
-  2**30, the base being determined at build time.  Previously, they
-  were always stored in base 2**15.  Using base 2**30 gives
+* Long integers are now stored internally either in base ``2**15`` or in base
+  ``2**30``, the base being determined at build time.  Previously, they
+  were always stored in base ``2**15``.  Using base ``2**30`` gives
   significant performance improvements on 64-bit machines, but
   benchmark results on 32-bit machines have been mixed.  Therefore,
-  the default is to use base 2**30 on 64-bit machines and base 2**15
+  the default is to use base ``2**30`` on 64-bit machines and base ``2**15``
   on 32-bit machines; on Unix, there's a new configure option
   :option:`!--enable-big-digits` that can be used to override this default.
 
diff --git a/Doc/whatsnew/3.1.rst b/Doc/whatsnew/3.1.rst
index 919fbee..f1e6d0c 100644
--- a/Doc/whatsnew/3.1.rst
+++ b/Doc/whatsnew/3.1.rst
@@ -474,12 +474,12 @@
 
 Changes to Python's build process and to the C API include:
 
-* Integers are now stored internally either in base 2**15 or in base
-  2**30, the base being determined at build time.  Previously, they
-  were always stored in base 2**15.  Using base 2**30 gives
+* Integers are now stored internally either in base ``2**15`` or in base
+  ``2**30``, the base being determined at build time.  Previously, they
+  were always stored in base ``2**15``.  Using base ``2**30`` gives
   significant performance improvements on 64-bit machines, but
   benchmark results on 32-bit machines have been mixed.  Therefore,
-  the default is to use base 2**30 on 64-bit machines and base 2**15
+  the default is to use base ``2**30`` on 64-bit machines and base ``2**15``
   on 32-bit machines; on Unix, there's a new configure option
   ``--enable-big-digits`` that can be used to override this default.
 
diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst
new file mode 100644
index 0000000..5788e32
--- /dev/null
+++ b/Doc/whatsnew/3.10.rst
@@ -0,0 +1,2315 @@
+****************************
+  What's New In Python 3.10
+****************************
+
+:Release: |release|
+:Date: |today|
+:Editor: Pablo Galindo Salgado
+
+.. Rules for maintenance:
+
+   * Anyone can add text to this document.  Do not spend very much time
+   on the wording of your changes, because your text will probably
+   get rewritten to some degree.
+
+   * The maintainer will go through Misc/NEWS periodically and add
+   changes; it's therefore more important to add your changes to
+   Misc/NEWS than to this file.
+
+   * This is not a complete list of every single change; completeness
+   is the purpose of Misc/NEWS.  Some changes I consider too small
+   or esoteric to include.  If such a change is added to the text,
+   I'll just remove it.  (This is another reason you shouldn't spend
+   too much time on writing your addition.)
+
+   * If you want to draw your new text to the attention of the
+   maintainer, add 'XXX' to the beginning of the paragraph or
+   section.
+
+   * It's OK to just add a fragmentary note about a change.  For
+   example: "XXX Describe the transmogrify() function added to the
+   socket module."  The maintainer will research the change and
+   write the necessary text.
+
+   * You can comment out your additions if you like, but it's not
+   necessary (especially when a final release is some months away).
+
+   * Credit the author of a patch or bugfix.   Just the name is
+   sufficient; the e-mail address isn't necessary.
+
+   * It's helpful to add the bug/patch number as a comment:
+
+   XXX Describe the transmogrify() function added to the socket
+   module.
+   (Contributed by P.Y. Developer in :issue:`12345`.)
+
+   This saves the maintainer the effort of going through the git log
+   when researching a change.
+
+This article explains the new features in Python 3.10, compared to 3.9.
+
+For full details, see the :ref:`changelog <changelog>`.
+
+Summary -- Release highlights
+=============================
+
+.. This section singles out the most important changes in Python 3.10.
+   Brevity is key.
+
+
+.. PEP-sized items next.
+
+New syntax features:
+
+* :pep:`634`, Structural Pattern Matching: Specification
+* :pep:`635`, Structural Pattern Matching: Motivation and Rationale
+* :pep:`636`, Structural Pattern Matching: Tutorial
+* :issue:`12782`, Parenthesized context managers are now officially allowed.
+
+New features in the standard library:
+
+* :pep:`618`, Add Optional Length-Checking To zip.
+
+Interpreter improvements:
+
+* :pep:`626`, Precise line numbers for debugging and other tools.
+
+New typing features:
+
+* :pep:`604`, Allow writing union types as X | Y
+* :pep:`613`, Explicit Type Aliases
+* :pep:`612`, Parameter Specification Variables
+
+Important deprecations, removals or restrictions:
+
+* :pep:`644`, Require OpenSSL 1.1.1 or newer
+* :pep:`632`, Deprecate distutils module.
+* :pep:`623`, Deprecate and prepare for the removal of the wstr member in PyUnicodeObject.
+* :pep:`624`, Remove Py_UNICODE encoder APIs
+* :pep:`597`, Add optional EncodingWarning
+
+
+New Features
+============
+
+.. _whatsnew310-pep563:
+
+Parenthesized context managers
+------------------------------
+
+Using enclosing parentheses for continuation across multiple lines
+in context managers is now supported. This allows formatting a long
+collection of context managers in multiple lines in a similar way
+as it was previously possible with import statements. For instance,
+all these examples are now valid:
+
+.. code-block:: python
+
+    with (CtxManager() as example):
+        ...
+
+    with (
+        CtxManager1(),
+        CtxManager2()
+    ):
+        ...
+
+    with (CtxManager1() as example,
+          CtxManager2()):
+        ...
+
+    with (CtxManager1(),
+          CtxManager2() as example):
+        ...
+
+    with (
+        CtxManager1() as example1,
+        CtxManager2() as example2
+    ):
+        ...
+
+it is also possible to use a trailing comma at the end of the
+enclosed group:
+
+.. code-block:: python
+
+    with (
+        CtxManager1() as example1,
+        CtxManager2() as example2,
+        CtxManager3() as example3,
+    ):
+        ...
+
+This new syntax uses the non LL(1) capacities of the new parser.
+Check :pep:`617` for more details.
+
+(Contributed by Guido van Rossum, Pablo Galindo and Lysandros Nikolaou
+in :issue:`12782` and :issue:`40334`.)
+
+
+Better error messages
+---------------------
+
+SyntaxErrors
+~~~~~~~~~~~~
+
+When parsing code that contains unclosed parentheses or brackets the interpreter
+now includes the location of the unclosed bracket of parentheses instead of displaying
+*SyntaxError: unexpected EOF while parsing* or pointing to some incorrect location.
+For instance, consider the following code (notice the unclosed '{'):
+
+.. code-block:: python
+
+    expected = {9: 1, 18: 2, 19: 2, 27: 3, 28: 3, 29: 3, 36: 4, 37: 4,
+                38: 4, 39: 4, 45: 5, 46: 5, 47: 5, 48: 5, 49: 5, 54: 6,
+    some_other_code = foo()
+
+Previous versions of the interpreter reported confusing places as the location of
+the syntax error:
+
+.. code-block:: python
+
+   File "example.py", line 3
+       some_other_code = foo()
+                       ^
+   SyntaxError: invalid syntax
+
+but in Python 3.10 a more informative error is emitted:
+
+.. code-block:: python
+
+    File "example.py", line 1
+        expected = {9: 1, 18: 2, 19: 2, 27: 3, 28: 3, 29: 3, 36: 4, 37: 4,
+                   ^
+    SyntaxError: '{' was never closed
+
+
+In a similar way, errors involving unclosed string literals (single and triple
+quoted) now point to the start of the string instead of reporting EOF/EOL.
+
+These improvements are inspired by previous work in the PyPy interpreter.
+
+(Contributed by Pablo Galindo in :issue:`42864` and Batuhan Taskaya in
+:issue:`40176`.)
+
+:exc:`SyntaxError` exceptions raised by the interpreter will now highlight the
+full error range of the expression that constitutes the syntax error itself,
+instead of just where the problem is detected. In this way, instead of displaying
+(before Python 3.10):
+
+.. code-block:: python
+
+    >>> foo(x, z for z in range(10), t, w)
+      File "<stdin>", line 1
+        foo(x, z for z in range(10), t, w)
+               ^
+    SyntaxError: Generator expression must be parenthesized
+
+now Python 3.10 will display the exception as:
+
+.. code-block:: python
+
+    >>> foo(x, z for z in range(10), t, w)
+      File "<stdin>", line 1
+        foo(x, z for z in range(10), t, w)
+               ^^^^^^^^^^^^^^^^^^^^
+    SyntaxError: Generator expression must be parenthesized
+
+This improvement was contributed by Pablo Galindo in :issue:`43914`.
+
+A considerable amount of new specialized messages for :exc:`SyntaxError` exceptions
+have been incorporated. Some of the most notable ones are as follows:
+
+* Missing ``:`` before blocks:
+
+    .. code-block:: python
+
+        >>> if rocket.position > event_horizon
+          File "<stdin>", line 1
+            if rocket.position > event_horizon
+                                              ^
+        SyntaxError: expected ':'
+
+    (Contributed by Pablo Galindo in :issue:`42997`)
+
+* Unparenthesised tuples in comprehensions targets:
+
+    .. code-block:: python
+
+        >>> {x,y for x,y in zip('abcd', '1234')}
+          File "<stdin>", line 1
+            {x,y for x,y in zip('abcd', '1234')}
+             ^
+        SyntaxError: did you forget parentheses around the comprehension target?
+
+    (Contributed by Pablo Galindo in :issue:`43017`)
+
+* Missing commas in collection literals and between expressions:
+
+    .. code-block:: python
+
+        >>> items = {
+        ... x: 1,
+        ... y: 2
+        ... z: 3,
+          File "<stdin>", line 3
+            y: 2
+               ^
+        SyntaxError: invalid syntax. Perhaps you forgot a comma?
+
+    (Contributed by Pablo Galindo in :issue:`43822`)
+
+* Multiple Exception types without parentheses:
+
+    .. code-block:: python
+
+        >>> try:
+        ...     build_dyson_sphere()
+        ... except NotEnoughScienceError, NotEnoughResourcesError:
+          File "<stdin>", line 3
+            except NotEnoughScienceError, NotEnoughResourcesError:
+                   ^
+        SyntaxError: multiple exception types must be parenthesized
+
+    (Contributed by Pablo Galindo in :issue:`43149`)
+
+* Missing ``:`` and values in dictionary literals:
+
+    .. code-block:: python
+
+        >>> values = {
+        ... x: 1,
+        ... y: 2,
+        ... z:
+        ... }
+          File "<stdin>", line 4
+            z:
+             ^
+        SyntaxError: expression expected after dictionary key and ':'
+
+        >>> values = {x:1, y:2, z w:3}
+          File "<stdin>", line 1
+            values = {x:1, y:2, z w:3}
+                                ^
+        SyntaxError: ':' expected after dictionary key
+
+    (Contributed by Pablo Galindo in :issue:`43823`)
+
+* ``try`` blocks without ``except`` or ``finally`` blocks:
+
+    .. code-block:: python
+
+        >>> try:
+        ...     x = 2
+        ... something = 3
+          File "<stdin>", line 3
+            something  = 3
+            ^^^^^^^^^
+        SyntaxError: expected 'except' or 'finally' block
+
+    (Contributed by Pablo Galindo in :issue:`44305`)
+
+* Usage of ``=`` instead of ``==`` in comparisons:
+
+    .. code-block:: python
+
+        >>> if rocket.position = event_horizon:
+          File "<stdin>", line 1
+            if rocket.position = event_horizon:
+                               ^
+        SyntaxError: cannot assign to attribute here. Maybe you meant '==' instead of '='?
+
+    (Contributed by Pablo Galindo in :issue:`43797`)
+
+* Usage of ``*`` in f-strings:
+
+    .. code-block:: python
+
+        >>> f"Black holes {*all_black_holes} and revelations"
+          File "<stdin>", line 1
+            (*all_black_holes)
+             ^
+        SyntaxError: f-string: cannot use starred expression here
+
+    (Contributed by Pablo Galindo in :issue:`41064`)
+
+IndentationErrors
+~~~~~~~~~~~~~~~~~
+
+Many :exc:`IndentationError` exceptions now have more context regarding what kind of block
+was expecting an indentation, including the location of the statement:
+
+.. code-block:: python
+
+    >>> def foo():
+    ...    if lel:
+    ...    x = 2
+      File "<stdin>", line 3
+        x = 2
+        ^
+    IndentationError: expected an indented block after 'if' statement in line 2
+
+
+AttributeErrors
+~~~~~~~~~~~~~~~
+
+When printing :exc:`AttributeError`, :c:func:`PyErr_Display` will offer
+suggestions of similar attribute names in the object that the exception was
+raised from:
+
+.. code-block:: python
+
+    >>> collections.namedtoplo
+    Traceback (most recent call last):
+      File "<stdin>", line 1, in <module>
+    AttributeError: module 'collections' has no attribute 'namedtoplo'. Did you mean: namedtuple?
+
+(Contributed by Pablo Galindo in :issue:`38530`.)
+
+   .. warning::
+      Notice this won't work if :c:func:`PyErr_Display` is not called to display the error
+      which can happen if some other custom error display function is used. This is a common
+      scenario in some REPLs like IPython.
+
+NameErrors
+~~~~~~~~~~
+
+When printing :exc:`NameError` raised by the interpreter, :c:func:`PyErr_Display`
+will offer suggestions of similar variable names in the function that the exception
+was raised from:
+
+.. code-block:: python
+
+    >>> schwarzschild_black_hole = None
+    >>> schwarschild_black_hole
+    Traceback (most recent call last):
+      File "<stdin>", line 1, in <module>
+    NameError: name 'schwarschild_black_hole' is not defined. Did you mean: schwarzschild_black_hole?
+
+(Contributed by Pablo Galindo in :issue:`38530`.)
+
+   .. warning::
+      Notice this won't work if :c:func:`PyErr_Display` is not called to display the error,
+      which can happen if some other custom error display function is used. This is a common
+      scenario in some REPLs like IPython.
+
+
+PEP 626: Precise line numbers for debugging and other tools
+-----------------------------------------------------------
+
+PEP 626 brings more precise and reliable line numbers for debugging, profiling and coverage tools.
+Tracing events, with the correct line number, are generated for all lines of code executed and only for lines of code that are executed.
+
+The ``f_lineno`` attribute of frame objects will always contain the expected line number.
+
+The ``co_lnotab`` attribute of code objects is deprecated and will be removed in 3.12.
+Code that needs to convert from offset to line number should use the new ``co_lines()`` method instead.
+
+PEP 634: Structural Pattern Matching
+------------------------------------
+
+Structural pattern matching has been added in the form of a *match statement*
+and *case statements* of patterns with associated actions. Patterns
+consist of sequences, mappings, primitive data types as well as class instances.
+Pattern matching enables programs to extract information from complex data types,
+branch on the structure of data, and apply specific actions based on different
+forms of data.
+
+Syntax and operations
+~~~~~~~~~~~~~~~~~~~~~
+
+The generic syntax of pattern matching is::
+
+      match subject:
+          case <pattern_1>:
+              <action_1>
+          case <pattern_2>:
+              <action_2>
+          case <pattern_3>:
+              <action_3>
+          case _:
+              <action_wildcard>
+
+A match statement takes an expression and compares its value to successive
+patterns given as one or more case blocks.  Specifically, pattern matching
+operates by:
+
+    1. using data with type and shape (the ``subject``)
+    2. evaluating the ``subject`` in the ``match`` statement
+    3. comparing the subject with each pattern in a ``case`` statement
+       from top to bottom until a match is confirmed.
+    4. executing the action associated with the pattern of the confirmed
+       match
+    5. If an exact match is not confirmed, the last case, a wildcard ``_``,
+       if provided, will be used as the matching case. If an exact match is
+       not confirmed and a wildcard case does not exist, the entire match
+       block is a no-op.
+
+Declarative approach
+~~~~~~~~~~~~~~~~~~~~
+
+Readers may be aware of pattern matching through the simple example of matching
+a subject (data object) to a literal (pattern) with the switch statement found
+in C, Java or JavaScript (and many other languages). Often the switch statement
+is used for comparison of an object/expression with case statements containing
+literals.
+
+More powerful examples of pattern matching can be found in languages such as
+Scala and Elixir. With structural pattern matching, the approach is "declarative" and
+explicitly states the conditions (the patterns) for data to match.
+
+While an "imperative" series of instructions using nested "if" statements
+could be used to accomplish something similar to structural pattern matching,
+it is less clear than the "declarative" approach. Instead the "declarative"
+approach states the conditions to meet for a match and is more readable through
+its explicit patterns. While structural pattern matching can be used in its
+simplest form comparing a variable to a literal in a case statement, its
+true value for Python lies in its handling of the subject's type and shape.
+
+Simple pattern: match to a literal
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Let's look at this example as pattern matching in its simplest form: a value,
+the subject, being matched to several literals, the patterns. In the example
+below, ``status`` is the subject of the match statement. The patterns are
+each of the case statements, where literals represent request status codes.
+The associated action to the case is executed after a match::
+
+    def http_error(status):
+        match status:
+            case 400:
+                return "Bad request"
+            case 404:
+                return "Not found"
+            case 418:
+                return "I'm a teapot"
+            case _:
+                return "Something's wrong with the internet"
+
+If the above function is passed a ``status`` of 418, "I'm a teapot" is returned.
+If the above function is passed a ``status`` of 500, the case statement with
+``_`` will match as a wildcard, and "Something's wrong with the internet" is
+returned.
+Note the last block: the variable name, ``_``, acts as a *wildcard* and insures
+the subject will always match. The use of ``_`` is optional.
+
+You can combine several literals in a single pattern using ``|`` ("or")::
+
+            case 401 | 403 | 404:
+                return "Not allowed"
+
+Behavior without the wildcard
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+If we modify the above example by removing the last case block, the example
+becomes::
+
+    def http_error(status):
+        match status:
+            case 400:
+                return "Bad request"
+            case 404:
+                return "Not found"
+            case 418:
+                return "I'm a teapot"
+
+Without the use of ``_`` in a case statement, a match may not exist. If no
+match exists, the behavior is a no-op. For example, if ``status`` of 500 is
+passed, a no-op occurs.
+
+Patterns with a literal and variable
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Patterns can look like unpacking assignments, and a pattern may be used to bind
+variables. In this example, a data point can be unpacked to its x-coordinate
+and y-coordinate::
+
+    # point is an (x, y) tuple
+    match point:
+        case (0, 0):
+            print("Origin")
+        case (0, y):
+            print(f"Y={y}")
+        case (x, 0):
+            print(f"X={x}")
+        case (x, y):
+            print(f"X={x}, Y={y}")
+        case _:
+            raise ValueError("Not a point")
+
+The first pattern has two literals, ``(0, 0)``, and may be thought of as an
+extension of the literal pattern shown above. The next two patterns combine a
+literal and a variable, and the variable *binds* a value from the subject
+(``point``).  The fourth pattern captures two values, which makes it
+conceptually similar to the unpacking assignment ``(x, y) = point``.
+
+Patterns and classes
+~~~~~~~~~~~~~~~~~~~~
+
+If you are using classes to structure your data, you can use as a pattern
+the class name followed by an argument list resembling a constructor. This
+pattern has the ability to capture class attributes into variables::
+
+    class Point:
+        x: int
+        y: int
+
+    def location(point):
+        match point:
+            case Point(x=0, y=0):
+                print("Origin is the point's location.")
+            case Point(x=0, y=y):
+                print(f"Y={y} and the point is on the y-axis.")
+            case Point(x=x, y=0):
+                print(f"X={x} and the point is on the x-axis.")
+            case Point():
+                print("The point is located somewhere else on the plane.")
+            case _:
+                print("Not a point")
+
+Patterns with positional parameters
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+You can use positional parameters with some builtin classes that provide an
+ordering for their attributes (e.g. dataclasses). You can also define a specific
+position for attributes in patterns by setting the ``__match_args__`` special
+attribute in your classes. If it's set to ("x", "y"), the following patterns
+are all equivalent (and all bind the ``y`` attribute to the ``var`` variable)::
+
+    Point(1, var)
+    Point(1, y=var)
+    Point(x=1, y=var)
+    Point(y=var, x=1)
+
+Nested patterns
+~~~~~~~~~~~~~~~
+
+Patterns can be arbitrarily nested.  For example, if our data is a short
+list of points, it could be matched like this::
+
+    match points:
+        case []:
+            print("No points in the list.")
+        case [Point(0, 0)]:
+            print("The origin is the only point in the list.")
+        case [Point(x, y)]:
+            print(f"A single point {x}, {y} is in the list.")
+        case [Point(0, y1), Point(0, y2)]:
+            print(f"Two points on the Y axis at {y1}, {y2} are in the list.")
+        case _:
+            print("Something else is found in the list.")
+
+Complex patterns and the wildcard
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+To this point, the examples have used ``_`` alone in the last case statement.
+A wildcard can be used in more complex patterns, such as ``('error', code, _)``.
+For example::
+
+   match test_variable:
+       case ('warning', code, 40):
+           print("A warning has been received.")
+       case ('error', code, _):
+           print(f"An error {code} occurred.")
+
+In the above case, ``test_variable`` will match for ('error', code, 100) and
+('error', code, 800).
+
+Guard
+~~~~~
+
+We can add an ``if`` clause to a pattern, known as a "guard".  If the
+guard is false, ``match`` goes on to try the next case block.  Note
+that value capture happens before the guard is evaluated::
+
+    match point:
+        case Point(x, y) if x == y:
+            print(f"The point is located on the diagonal Y=X at {x}.")
+        case Point(x, y):
+            print(f"Point is not on the diagonal.")
+
+Other Key Features
+~~~~~~~~~~~~~~~~~~
+
+Several other key features:
+
+- Like unpacking assignments, tuple and list patterns have exactly the
+  same meaning and actually match arbitrary sequences. Technically,
+  the subject must be a sequence.
+  Therefore, an important exception is that patterns don't match iterators.
+  Also, to prevent a common mistake, sequence patterns don't match strings.
+
+- Sequence patterns support wildcards: ``[x, y, *rest]`` and ``(x, y,
+  *rest)`` work similar to wildcards in unpacking assignments.  The
+  name after ``*`` may also be ``_``, so ``(x, y, *_)`` matches a sequence
+  of at least two items without binding the remaining items.
+
+- Mapping patterns: ``{"bandwidth": b, "latency": l}`` captures the
+  ``"bandwidth"`` and ``"latency"`` values from a dict.  Unlike sequence
+  patterns, extra keys are ignored.  A wildcard ``**rest`` is also
+  supported.  (But ``**_`` would be redundant, so is not allowed.)
+
+- Subpatterns may be captured using the ``as`` keyword::
+
+      case (Point(x1, y1), Point(x2, y2) as p2): ...
+
+  This binds x1, y1, x2, y2 like you would expect without the ``as`` clause,
+  and p2 to the entire second item of the subject.
+
+- Most literals are compared by equality. However, the singletons ``True``,
+  ``False`` and ``None`` are compared by identity.
+
+- Named constants may be used in patterns.  These named constants must be
+  dotted names to prevent the constant from being interpreted as a capture
+  variable::
+
+      from enum import Enum
+      class Color(Enum):
+          RED = 0
+          GREEN = 1
+          BLUE = 2
+
+      match color:
+          case Color.RED:
+              print("I see red!")
+          case Color.GREEN:
+              print("Grass is green")
+          case Color.BLUE:
+              print("I'm feeling the blues :(")
+
+For the full specification see :pep:`634`.  Motivation and rationale
+are in :pep:`635`, and a longer tutorial is in :pep:`636`.
+
+
+.. _whatsnew310-pep597:
+
+Optional ``EncodingWarning`` and ``encoding="locale"`` option
+-------------------------------------------------------------
+
+The default encoding of :class:`TextIOWrapper` and :func:`open` is
+platform and locale dependent. Since UTF-8 is used on most Unix
+platforms, omitting ``encoding`` option when opening UTF-8 files
+(e.g. JSON, YAML, TOML, Markdown) is a very common bug. For example::
+
+   # BUG: "rb" mode or encoding="utf-8" should be used.
+   with open("data.json") as f:
+       data = json.load(f)
+
+To find this type of bug, an optional ``EncodingWarning`` is added.
+It is emitted when :data:`sys.flags.warn_default_encoding <sys.flags>`
+is true and locale-specific default encoding is used.
+
+``-X warn_default_encoding`` option and :envvar:`PYTHONWARNDEFAULTENCODING`
+are added to enable the warning.
+
+See :ref:`io-text-encoding` for more information.
+
+.. _new-feat-related-type-hints:
+
+New Features Related to Type Hints
+==================================
+
+This section covers major changes affecting :pep:`484` type hints and
+the :mod:`typing` module.
+
+
+PEP 604: New Type Union Operator
+--------------------------------
+
+A new type union operator was introduced which enables the syntax ``X | Y``.
+This provides a cleaner way of expressing 'either type X or type Y' instead of
+using :data:`typing.Union`, especially in type hints.
+
+In previous versions of Python, to apply a type hint for functions accepting
+arguments of multiple types, :data:`typing.Union` was used::
+
+   def square(number: Union[int, float]) -> Union[int, float]:
+       return number ** 2
+
+
+Type hints can now be written in a more succinct manner::
+
+   def square(number: int | float) -> int | float:
+       return number ** 2
+
+
+This new syntax is also accepted as the second argument to :func:`isinstance`
+and :func:`issubclass`::
+
+   >>> isinstance(1, int | str)
+   True
+
+See :ref:`types-union` and :pep:`604` for more details.
+
+(Contributed by Maggie Moss and Philippe Prados in :issue:`41428`,
+with additions by Yurii Karabas and Serhiy Storchaka in :issue:`44490`.)
+
+
+PEP 612: Parameter Specification Variables
+------------------------------------------
+
+Two new options to improve the information provided to static type checkers for
+:pep:`484`\ 's ``Callable`` have been added to the :mod:`typing` module.
+
+The first is the parameter specification variable.  They are used to forward the
+parameter types of one callable to another callable -- a pattern commonly
+found in higher order functions and decorators.  Examples of usage can be found
+in :class:`typing.ParamSpec`. Previously, there was no easy way to type annotate
+dependency of parameter types in such a precise manner.
+
+The second option is the new ``Concatenate`` operator. It's used in conjunction
+with parameter specification variables to type annotate a higher order callable
+which adds or removes parameters of another callable.  Examples of usage can
+be found in :class:`typing.Concatenate`.
+
+See :class:`typing.Callable`, :class:`typing.ParamSpec`,
+:class:`typing.Concatenate`, :class:`typing.ParamSpecArgs`,
+:class:`typing.ParamSpecKwargs`, and :pep:`612` for more details.
+
+(Contributed by Ken Jin in :issue:`41559`, with minor enhancements by Jelle
+Zijlstra in :issue:`43783`.  PEP written by Mark Mendoza.)
+
+
+PEP 613: TypeAlias
+------------------
+
+:pep:`484` introduced the concept of type aliases, only requiring them to be
+top-level unannotated assignments. This simplicity sometimes made it difficult
+for type checkers to distinguish between type aliases and ordinary assignments,
+especially when forward references or invalid types were involved. Compare::
+
+   StrCache = 'Cache[str]'  # a type alias
+   LOG_PREFIX = 'LOG[DEBUG]'  # a module constant
+
+Now the :mod:`typing` module has a special value :data:`TypeAlias`
+which lets you declare type aliases more explicitly::
+
+   StrCache: TypeAlias = 'Cache[str]'  # a type alias
+   LOG_PREFIX = 'LOG[DEBUG]'  # a module constant
+
+See :pep:`613` for more details.
+
+(Contributed by Mikhail Golubev in :issue:`41923`.)
+
+PEP 647: User-Defined Type Guards
+---------------------------------
+
+:data:`TypeGuard` has been added to the :mod:`typing` module to annotate
+type guard functions and improve information provided to static type checkers
+during type narrowing.  For more information, please see :data:`TypeGuard`\ 's
+documentation, and :pep:`647`.
+
+(Contributed by Ken Jin and Guido van Rossum in :issue:`43766`.
+PEP written by Eric Traut.)
+
+Other Language Changes
+======================
+
+* The :class:`int` type has a new method :meth:`int.bit_count`, returning the
+  number of ones in the binary expansion of a given integer, also known
+  as the population count. (Contributed by Niklas Fiekas in :issue:`29882`.)
+
+* The views returned by :meth:`dict.keys`, :meth:`dict.values` and
+  :meth:`dict.items` now all have a ``mapping`` attribute that gives a
+  :class:`types.MappingProxyType` object wrapping the original
+  dictionary. (Contributed by Dennis Sweeney in :issue:`40890`.)
+
+* :pep:`618`: The :func:`zip` function now has an optional ``strict`` flag, used
+  to require that all the iterables have an equal length.
+
+* Builtin and extension functions that take integer arguments no longer accept
+  :class:`~decimal.Decimal`\ s, :class:`~fractions.Fraction`\ s and other
+  objects that can be converted to integers only with a loss (e.g. that have
+  the :meth:`~object.__int__` method but do not have the
+  :meth:`~object.__index__` method).
+  (Contributed by Serhiy Storchaka in :issue:`37999`.)
+
+* If :func:`object.__ipow__` returns :const:`NotImplemented`, the operator will
+  correctly fall back to :func:`object.__pow__` and :func:`object.__rpow__` as expected.
+  (Contributed by Alex Shkop in :issue:`38302`.)
+
+* Assignment expressions can now be used unparenthesized within set literals
+  and set comprehensions, as well as in sequence indexes (but not slices).
+
+* Functions have a new ``__builtins__`` attribute which is used to look for
+  builtin symbols when a function is executed, instead of looking into
+  ``__globals__['__builtins__']``. The attribute is initialized from
+  ``__globals__["__builtins__"]`` if it exists, else from the current builtins.
+  (Contributed by Mark Shannon in :issue:`42990`.)
+
+* Two new builtin functions -- :func:`aiter` and :func:`anext` have been added
+  to provide asynchronous counterparts to :func:`iter` and :func:`next`,
+  respectively.
+  (Contributed by Joshua Bronson, Daniel Pope, and Justin Wang in :issue:`31861`.)
+
+* Static methods (:func:`@staticmethod <staticmethod>`) and class methods
+  (:func:`@classmethod <classmethod>`) now inherit the method attributes
+  (``__module__``, ``__name__``, ``__qualname__``, ``__doc__``,
+  ``__annotations__``) and have a new ``__wrapped__`` attribute.
+  Moreover, static methods are now callable as regular functions.
+  (Contributed by Victor Stinner in :issue:`43682`.)
+
+* Annotations for complex targets (everything beside ``simple name`` targets
+  defined by :pep:`526`) no longer cause any runtime effects with ``from __future__ import annotations``.
+  (Contributed by Batuhan Taskaya in :issue:`42737`.)
+
+* Class and module objects now lazy-create empty annotations dicts on demand.
+  The annotations dicts are stored in the object’s ``__dict__`` for
+  backwards compatibility.  This improves the best practices for working
+  with ``__annotations__``; for more information, please see
+  :ref:`annotations-howto`.
+  (Contributed by Larry Hastings in :issue:`43901`.)
+
+* Annotations consist of ``yield``, ``yield from``, ``await`` or named expressions
+  are now forbidden under ``from __future__ import annotations`` due to their side
+  effects.
+  (Contributed by Batuhan Taskaya in :issue:`42725`.)
+
+* Usage of unbound variables, ``super()`` and other expressions that might
+  alter the processing of symbol table as annotations are now rendered
+  effectless under ``from __future__ import annotations``.
+  (Contributed by Batuhan Taskaya in :issue:`42725`.)
+
+* Hashes of NaN values of both :class:`float` type and
+  :class:`decimal.Decimal` type now depend on object identity. Formerly, they
+  always hashed to ``0`` even though NaN values are not equal to one another.
+  This caused potentially quadratic runtime behavior due to excessive hash
+  collisions when creating dictionaries and sets containing multiple NaNs.
+  (Contributed by Raymond Hettinger in :issue:`43475`.)
+
+* A :exc:`SyntaxError` (instead of a :exc:`NameError`) will be raised when deleting
+  the :const:`__debug__` constant.  (Contributed by Dong-hee Na in :issue:`45000`.)
+
+* :exc:`SyntaxError` exceptions now have ``end_lineno`` and
+  ``end_offset`` attributes.  They will be ``None`` if not determined.
+  (Contributed by Pablo Galindo in :issue:`43914`.)
+
+New Modules
+===========
+
+* None yet.
+
+
+Improved Modules
+================
+
+asyncio
+-------
+
+Add missing :meth:`~asyncio.events.AbstractEventLoop.connect_accepted_socket`
+method.
+(Contributed by Alex Grönholm in :issue:`41332`.)
+
+argparse
+--------
+
+Misleading phrase "optional arguments" was replaced with "options" in argparse help. Some tests might require adaptation if they rely on exact output match.
+(Contributed by Raymond Hettinger in :issue:`9694`.)
+
+array
+-----
+
+The :meth:`~array.array.index` method of :class:`array.array` now has
+optional *start* and *stop* parameters.
+(Contributed by Anders Lorentsen and Zackery Spytz in :issue:`31956`.)
+
+asynchat, asyncore, smtpd
+-------------------------
+These modules have been marked as deprecated in their module documentation
+since Python 3.6.  An import-time :class:`DeprecationWarning` has now been
+added to all three of these modules.
+
+base64
+------
+
+Add :func:`base64.b32hexencode` and :func:`base64.b32hexdecode` to support the
+Base32 Encoding with Extended Hex Alphabet.
+
+bdb
+---
+
+Add :meth:`~bdb.Breakpoint.clearBreakpoints` to reset all set breakpoints.
+(Contributed by Irit Katriel in :issue:`24160`.)
+
+bisect
+------
+
+Added the possibility of providing a *key* function to the APIs in the :mod:`bisect`
+module. (Contributed by Raymond Hettinger in :issue:`4356`.)
+
+codecs
+------
+
+Add a :func:`codecs.unregister` function to unregister a codec search function.
+(Contributed by Hai Shi in :issue:`41842`.)
+
+collections.abc
+---------------
+
+The ``__args__`` of the :ref:`parameterized generic <types-genericalias>` for
+:class:`collections.abc.Callable` are now consistent with :data:`typing.Callable`.
+:class:`collections.abc.Callable` generic now flattens type parameters, similar
+to what :data:`typing.Callable` currently does.  This means that
+``collections.abc.Callable[[int, str], str]`` will have ``__args__`` of
+``(int, str, str)``; previously this was ``([int, str], str)``.  To allow this
+change, :class:`types.GenericAlias` can now be subclassed, and a subclass will
+be returned when subscripting the :class:`collections.abc.Callable` type.  Note
+that a :exc:`TypeError` may be raised for invalid forms of parameterizing
+:class:`collections.abc.Callable` which may have passed silently in Python 3.9.
+(Contributed by Ken Jin in :issue:`42195`.)
+
+contextlib
+----------
+
+Add a :func:`contextlib.aclosing` context manager to safely close async generators
+and objects representing asynchronously released resources.
+(Contributed by Joongi Kim and John Belmonte in :issue:`41229`.)
+
+Add asynchronous context manager support to :func:`contextlib.nullcontext`.
+(Contributed by Tom Gringauz in :issue:`41543`.)
+
+Add :class:`AsyncContextDecorator`, for supporting usage of async context managers
+as decorators.
+
+curses
+------
+
+The extended color functions added in ncurses 6.1 will be used transparently
+by :func:`curses.color_content`, :func:`curses.init_color`,
+:func:`curses.init_pair`, and :func:`curses.pair_content`. A new function,
+:func:`curses.has_extended_color_support`, indicates whether extended color
+support is provided by the underlying ncurses library.
+(Contributed by Jeffrey Kintscher and Hans Petter Jansson in :issue:`36982`.)
+
+The ``BUTTON5_*`` constants are now exposed in the :mod:`curses` module if
+they are provided by the underlying curses library.
+(Contributed by Zackery Spytz in :issue:`39273`.)
+
+dataclasses
+-----------
+
+__slots__
+~~~~~~~~~
+
+Added ``slots`` parameter in :func:`dataclasses.dataclass` decorator.
+(Contributed by Yurii Karabas in :issue:`42269`)
+
+Keyword-only fields
+~~~~~~~~~~~~~~~~~~~
+
+dataclasses now supports fields that are keyword-only in the
+generated __init__ method.  There are a number of ways of specifying
+keyword-only fields.
+
+You can say that every field is keyword-only:
+
+.. code-block:: python
+
+    from dataclasses import dataclass
+
+    @dataclass(kw_only=True)
+    class Birthday:
+        name: str
+        birthday: datetime.date
+
+Both ``name`` and ``birthday`` are keyword-only parameters to the
+generated __init__ method.
+
+You can specify keyword-only on a per-field basis:
+
+.. code-block:: python
+
+    from dataclasses import dataclass
+
+    @dataclass
+    class Birthday:
+        name: str
+        birthday: datetime.date = field(kw_only=True)
+
+Here only ``birthday`` is keyword-only.  If you set ``kw_only`` on
+individual fields, be aware that there are rules about re-ordering
+fields due to keyword-only fields needing to follow non-keyword-only
+fields.  See the full dataclasses documentation for details.
+
+You can also specify that all fields following a KW_ONLY marker are
+keyword-only.  This will probably be the most common usage:
+
+.. code-block:: python
+
+    from dataclasses import dataclass, KW_ONLY
+
+    @dataclass
+    class Point:
+        x: float
+        y: float
+        _: KW_ONLY
+        z: float = 0.0
+        t: float = 0.0
+
+Here, ``z`` and ``t`` are keyword-only parameters, while ``x`` and
+``y`` are not.
+(Contributed by Eric V. Smith in :issue:`43532`)
+
+.. _distutils-deprecated:
+
+distutils
+---------
+
+The entire ``distutils`` package is deprecated, to be removed in Python
+3.12. Its functionality for specifying package builds has already been
+completely replaced by third-party packages ``setuptools`` and
+``packaging``, and most other commonly used APIs are available elsewhere
+in the standard library (such as :mod:`platform`, :mod:`shutil`,
+:mod:`subprocess` or :mod:`sysconfig`). There are no plans to migrate
+any other functionality from ``distutils``, and applications that are
+using other functions should plan to make private copies of the code.
+Refer to :pep:`632` for discussion.
+
+The ``bdist_wininst`` command deprecated in Python 3.8 has been removed.
+The ``bdist_wheel`` command is now recommended to distribute binary packages
+on Windows.
+(Contributed by Victor Stinner in :issue:`42802`.)
+
+doctest
+-------
+
+When a module does not define ``__loader__``, fall back to ``__spec__.loader``.
+(Contributed by Brett Cannon in :issue:`42133`.)
+
+encodings
+---------
+
+:func:`encodings.normalize_encoding` now ignores non-ASCII characters.
+(Contributed by Hai Shi in :issue:`39337`.)
+
+fileinput
+---------
+
+Add *encoding* and *errors* parameters in :func:`fileinput.input` and
+:class:`fileinput.FileInput`.
+(Contributed by Inada Naoki in :issue:`43712`.)
+
+:func:`fileinput.hook_compressed` now returns :class:`TextIOWrapper` object
+when *mode* is "r" and file is compressed, like uncompressed files.
+(Contributed by Inada Naoki in :issue:`5758`.)
+
+faulthandler
+------------
+
+The :mod:`faulthandler` module now detects if a fatal error occurs during a
+garbage collector collection.
+(Contributed by Victor Stinner in :issue:`44466`.)
+
+gc
+--
+
+Add audit hooks for :func:`gc.get_objects`, :func:`gc.get_referrers` and
+:func:`gc.get_referents`. (Contributed by Pablo Galindo in :issue:`43439`.)
+
+glob
+----
+
+Add the *root_dir* and *dir_fd* parameters in :func:`~glob.glob` and
+:func:`~glob.iglob` which allow to specify the root directory for searching.
+(Contributed by Serhiy Storchaka in :issue:`38144`.)
+
+hashlib
+-------
+
+The hashlib module requires OpenSSL 1.1.1 or newer.
+(Contributed by Christian Heimes in :pep:`644` and :issue:`43669`.)
+
+The hashlib module has preliminary support for OpenSSL 3.0.0.
+(Contributed by Christian Heimes in :issue:`38820` and other issues.)
+
+The pure-Python fallback of :func:`~hashlib.pbkdf2_hmac` is deprecated. In
+the future PBKDF2-HMAC will only be available when Python has been built with
+OpenSSL support.
+(Contributed by Christian Heimes in :issue:`43880`.)
+
+hmac
+----
+
+The hmac module now uses OpenSSL's HMAC implementation internally.
+(Contributed by Christian Heimes in :issue:`40645`.)
+
+IDLE and idlelib
+----------------
+
+Make IDLE invoke :func:`sys.excepthook` (when started without '-n').
+User hooks were previously ignored.  (Contributed by Ken Hilton in
+:issue:`43008`.)
+
+Rearrange the settings dialog.  Split the General tab into Windows
+and Shell/Ed tabs.  Move help sources, which extend the Help menu, to the
+Extensions tab.  Make space for new options and shorten the dialog. The
+latter makes the dialog better fit small screens.  (Contributed by Terry Jan
+Reedy in :issue:`40468`.)  Move the indent space setting from the Font tab to
+the new Windows tab.  (Contributed by Mark Roseman and Terry Jan Reedy in
+:issue:`33962`.)
+
+The changes above were backported to a 3.9 maintenance release.
+
+Add a Shell sidebar.  Move the primary prompt ('>>>') to the sidebar.
+Add secondary prompts ('...') to the sidebar.  Left click and optional
+drag selects one or more lines of text, as with the editor
+line number sidebar.  Right click after selecting text lines displays
+a context menu with 'copy with prompts'.  This zips together prompts
+from the sidebar with lines from the selected text.  This option also
+appears on the context menu for the text.  (Contributed by Tal Einat
+in :issue:`37903`.)
+
+Use spaces instead of tabs to indent interactive code.  This makes
+interactive code entries 'look right'.  Making this feasible was a
+major motivation for adding the shell sidebar.  (Contributed by
+Terry Jan Reedy in :issue:`37892`.)
+
+Highlight the new :ref:`soft keywords <soft-keywords>` :keyword:`match`,
+:keyword:`case <match>`, and :keyword:`_ <wildcard-patterns>` in
+pattern-matching statements. However, this highlighting is not perfect
+and will be incorrect in some rare cases, including some ``_``-s in
+``case`` patterns.  (Contributed by Tal Einat in :issue:`44010`.)
+
+New in 3.10 maintenance releases.
+
+Apply syntax highlighting to `.pyi` files. (Contributed by Alex
+Waygood and Terry Jan Reedy in :issue:`45447`.)
+
+importlib.metadata
+------------------
+
+Feature parity with ``importlib_metadata`` 4.6
+(`history <https://importlib-metadata.readthedocs.io/en/latest/history.html>`_).
+
+:ref:`importlib.metadata entry points <entry-points>`
+now provide a nicer experience
+for selecting entry points by group and name through a new
+:class:`importlib.metadata.EntryPoints` class. See the Compatibility
+Note in the docs for more info on the deprecation and usage.
+
+Added :func:`importlib.metadata.packages_distributions` for resolving
+top-level Python modules and packages to their
+:class:`importlib.metadata.Distribution`.
+
+inspect
+-------
+
+When a module does not define ``__loader__``, fall back to ``__spec__.loader``.
+(Contributed by Brett Cannon in :issue:`42133`.)
+
+Add :func:`inspect.get_annotations`, which safely computes the annotations
+defined on an object. It works around the quirks of accessing the annotations
+on various types of objects, and makes very few assumptions about the object
+it examines. :func:`inspect.get_annotations` can also correctly un-stringize
+stringized annotations.  :func:`inspect.get_annotations` is now considered
+best practice for accessing the annotations dict defined on any Python object;
+for more information on best practices for working with annotations, please see
+:ref:`annotations-howto`.
+Relatedly, :func:`inspect.signature`,
+:func:`inspect.Signature.from_callable`, and :func:`inspect.Signature.from_function`
+now call :func:`inspect.get_annotations` to retrieve annotations. This means
+:func:`inspect.signature` and :func:`inspect.Signature.from_callable` can
+also now un-stringize stringized annotations.
+(Contributed by Larry Hastings in :issue:`43817`.)
+
+linecache
+---------
+
+When a module does not define ``__loader__``, fall back to ``__spec__.loader``.
+(Contributed by Brett Cannon in :issue:`42133`.)
+
+os
+--
+
+Add :func:`os.cpu_count()` support for VxWorks RTOS.
+(Contributed by Peixing Xin in :issue:`41440`.)
+
+Add a new function :func:`os.eventfd` and related helpers to wrap the
+``eventfd2`` syscall on Linux.
+(Contributed by Christian Heimes in :issue:`41001`.)
+
+Add :func:`os.splice()` that allows to move data between two file
+descriptors without copying between kernel address space and user
+address space, where one of the file descriptors must refer to a
+pipe. (Contributed by Pablo Galindo in :issue:`41625`.)
+
+Add :data:`~os.O_EVTONLY`, :data:`~os.O_FSYNC`, :data:`~os.O_SYMLINK`
+and :data:`~os.O_NOFOLLOW_ANY` for macOS.
+(Contributed by Dong-hee Na in :issue:`43106`.)
+
+os.path
+-------
+
+:func:`os.path.realpath` now accepts a *strict* keyword-only argument. When set
+to ``True``, :exc:`OSError` is raised if a path doesn't exist or a symlink loop
+is encountered.
+(Contributed by Barney Gale in :issue:`43757`.)
+
+pathlib
+-------
+
+Add slice support to :attr:`PurePath.parents <pathlib.PurePath.parents>`.
+(Contributed by Joshua Cannon in :issue:`35498`)
+
+Add negative indexing support to :attr:`PurePath.parents
+<pathlib.PurePath.parents>`.
+(Contributed by Yaroslav Pankovych in :issue:`21041`)
+
+Add :meth:`Path.hardlink_to <pathlib.Path.hardlink_to>` method that
+supersedes :meth:`~pathlib.Path.link_to`. The new method has the same argument
+order as :meth:`~pathlib.Path.symlink_to`.
+(Contributed by Barney Gale in :issue:`39950`.)
+
+:meth:`pathlib.Path.stat` and :meth:`~pathlib.Path.chmod` now accept a
+*follow_symlinks* keyword-only argument for consistency with corresponding
+functions in the :mod:`os` module.
+(Contributed by Barney Gale in :issue:`39906`.)
+
+platform
+--------
+
+Add :func:`platform.freedesktop_os_release()` to retrieve operation system
+identification from `freedesktop.org os-release
+<https://www.freedesktop.org/software/systemd/man/os-release.html>`_ standard file.
+(Contributed by Christian Heimes in :issue:`28468`)
+
+pprint
+------
+
+:func:`pprint.pprint` now accepts a new ``underscore_numbers`` keyword argument.
+(Contributed by sblondon in :issue:`42914`.)
+
+:mod:`pprint` can now pretty-print :class:`dataclasses.dataclass` instances.
+(Contributed by Lewis Gaul in :issue:`43080`.)
+
+py_compile
+----------
+
+Add ``--quiet`` option to command-line interface of :mod:`py_compile`.
+(Contributed by Gregory Schevchenko in :issue:`38731`.)
+
+pyclbr
+------
+
+Add an ``end_lineno`` attribute to the ``Function`` and ``Class``
+objects in the tree returned by :func:`pyclbr.readline` and
+:func:`pyclbr.readline_ex`.  It matches the existing (start) ``lineno``.
+(Contributed by Aviral Srivastava in :issue:`38307`.)
+
+shelve
+------
+
+The :mod:`shelve` module now uses :data:`pickle.DEFAULT_PROTOCOL` by default
+instead of :mod:`pickle` protocol ``3`` when creating shelves.
+(Contributed by Zackery Spytz in :issue:`34204`.)
+
+statistics
+----------
+
+Add :func:`~statistics.covariance`, Pearson's
+:func:`~statistics.correlation`, and simple
+:func:`~statistics.linear_regression` functions.
+(Contributed by Tymoteusz Wołodźko in :issue:`38490`.)
+
+site
+----
+
+When a module does not define ``__loader__``, fall back to ``__spec__.loader``.
+(Contributed by Brett Cannon in :issue:`42133`.)
+
+socket
+------
+
+The exception :exc:`socket.timeout` is now an alias of :exc:`TimeoutError`.
+(Contributed by Christian Heimes in :issue:`42413`.)
+
+Add option to create MPTCP sockets with ``IPPROTO_MPTCP``
+(Contributed by Rui Cunha in :issue:`43571`.)
+
+Add ``IP_RECVTOS`` option to receive the type of service (ToS) or DSCP/ECN fields
+(Contributed by Georg Sauthoff in :issue:`44077`.)
+
+ssl
+---
+
+The ssl module requires OpenSSL 1.1.1 or newer.
+(Contributed by Christian Heimes in :pep:`644` and :issue:`43669`.)
+
+The ssl module has preliminary support for OpenSSL 3.0.0 and new option
+:data:`~ssl.OP_IGNORE_UNEXPECTED_EOF`.
+(Contributed by Christian Heimes in :issue:`38820`, :issue:`43794`,
+:issue:`43788`, :issue:`43791`, :issue:`43799`, :issue:`43920`,
+:issue:`43789`, and :issue:`43811`.)
+
+Deprecated function and use of deprecated constants now result in
+a :exc:`DeprecationWarning`. :attr:`ssl.SSLContext.options` has
+:data:`~ssl.OP_NO_SSLv2` and :data:`~ssl.OP_NO_SSLv3` set by default and
+therefore cannot warn about setting the flag again. The
+:ref:`deprecation section <whatsnew310-deprecated>` has a list of deprecated
+features.
+(Contributed by Christian Heimes in :issue:`43880`.)
+
+The ssl module now has more secure default settings. Ciphers without forward
+secrecy or SHA-1 MAC are disabled by default. Security level 2 prohibits
+weak RSA, DH, and ECC keys with less than 112 bits of security.
+:class:`~ssl.SSLContext` defaults to minimum protocol version TLS 1.2.
+Settings are based on Hynek Schlawack's research.
+(Contributed by Christian Heimes in :issue:`43998`.)
+
+The deprecated protocols SSL 3.0, TLS 1.0, and TLS 1.1 are no longer
+officially supported. Python does not block them actively. However
+OpenSSL build options, distro configurations, vendor patches, and cipher
+suites may prevent a successful handshake.
+
+Add a *timeout* parameter to the :func:`ssl.get_server_certificate` function.
+(Contributed by Zackery Spytz in :issue:`31870`.)
+
+The ssl module uses heap-types and multi-phase initialization.
+(Contributed by Christian Heimes in :issue:`42333`.)
+
+A new verify flag :data:`~ssl.VERIFY_X509_PARTIAL_CHAIN` has been added.
+(Contributed by l0x in :issue:`40849`.)
+
+sqlite3
+-------
+
+Add audit events for :func:`~sqlite3.connect/handle`,
+:meth:`~sqlite3.Connection.enable_load_extension`, and
+:meth:`~sqlite3.Connection.load_extension`.
+(Contributed by Erlend E. Aasland in :issue:`43762`.)
+
+sys
+---
+
+Add :data:`sys.orig_argv` attribute: the list of the original command line
+arguments passed to the Python executable.
+(Contributed by Victor Stinner in :issue:`23427`.)
+
+Add :data:`sys.stdlib_module_names`, containing the list of the standard library
+module names.
+(Contributed by Victor Stinner in :issue:`42955`.)
+
+_thread
+-------
+
+:func:`_thread.interrupt_main` now takes an optional signal number to
+simulate (the default is still :data:`signal.SIGINT`).
+(Contributed by Antoine Pitrou in :issue:`43356`.)
+
+threading
+---------
+
+Add :func:`threading.gettrace` and :func:`threading.getprofile` to
+retrieve the functions set by :func:`threading.settrace` and
+:func:`threading.setprofile` respectively.
+(Contributed by Mario Corchero in :issue:`42251`.)
+
+Add :data:`threading.__excepthook__` to allow retrieving the original value
+of :func:`threading.excepthook` in case it is set to a broken or a different
+value.
+(Contributed by Mario Corchero in :issue:`42308`.)
+
+traceback
+---------
+
+The :func:`~traceback.format_exception`,
+:func:`~traceback.format_exception_only`, and
+:func:`~traceback.print_exception` functions can now take an exception object
+as a positional-only argument.
+(Contributed by Zackery Spytz and Matthias Bussonnier in :issue:`26389`.)
+
+types
+-----
+
+Reintroduce the :data:`types.EllipsisType`, :data:`types.NoneType`
+and :data:`types.NotImplementedType` classes, providing a new set
+of types readily interpretable by type checkers.
+(Contributed by Bas van Beek in :issue:`41810`.)
+
+typing
+------
+
+For major changes, see :ref:`new-feat-related-type-hints`.
+
+The behavior of :class:`typing.Literal` was changed to conform with :pep:`586`
+and to match the behavior of static type checkers specified in the PEP.
+
+1. ``Literal`` now de-duplicates parameters.
+2. Equality comparisons between ``Literal`` objects are now order independent.
+3. ``Literal`` comparisons now respect types.  For example,
+   ``Literal[0] == Literal[False]`` previously evaluated to ``True``.  It is
+   now ``False``.  To support this change, the internally used type cache now
+   supports differentiating types.
+4. ``Literal`` objects will now raise a :exc:`TypeError` exception during
+   equality comparisons if any of their parameters are not :term:`hashable`.
+   Note that declaring ``Literal`` with unhashable parameters will not throw
+   an error::
+
+      >>> from typing import Literal
+      >>> Literal[{0}]
+      >>> Literal[{0}] == Literal[{False}]
+      Traceback (most recent call last):
+        File "<stdin>", line 1, in <module>
+      TypeError: unhashable type: 'set'
+
+(Contributed by Yurii Karabas in :issue:`42345`.)
+
+Add new function :func:`typing.is_typeddict` to introspect if an annotation
+is a :class:`typing.TypedDict`.
+(Contributed by Patrick Reader in :issue:`41792`)
+
+Subclasses of ``typing.Protocol`` which only have data variables declared
+will now raise a ``TypeError`` when checked with ``isinstance`` unless they
+are decorated with :func:`runtime_checkable`.  Previously, these checks
+passed silently.  Users should decorate their
+subclasses with the :func:`runtime_checkable` decorator
+if they want runtime protocols.
+(Contributed by Yurii Karabas in :issue:`38908`)
+
+Importing from the ``typing.io`` and ``typing.re`` submodules will now emit
+:exc:`DeprecationWarning`.  These submodules have been deprecated since
+Python 3.8 and will be removed in a future version of Python.  Anything
+belonging to those submodules should be imported directly from
+:mod:`typing` instead.
+(Contributed by Sebastian Rittau in :issue:`38291`)
+
+unittest
+--------
+
+Add new method :meth:`~unittest.TestCase.assertNoLogs` to complement the
+existing :meth:`~unittest.TestCase.assertLogs`. (Contributed by Kit Yan Choi
+in :issue:`39385`.)
+
+urllib.parse
+------------
+
+Python versions earlier than Python 3.10 allowed using both ``;`` and ``&`` as
+query parameter separators in :func:`urllib.parse.parse_qs` and
+:func:`urllib.parse.parse_qsl`.  Due to security concerns, and to conform with
+newer W3C recommendations, this has been changed to allow only a single
+separator key, with ``&`` as the default.  This change also affects
+:func:`cgi.parse` and :func:`cgi.parse_multipart` as they use the affected
+functions internally.  For more details, please see their respective
+documentation.
+(Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)
+
+The presence of newline or tab characters in parts of a URL allows for some
+forms of attacks. Following the WHATWG specification that updates :rfc:`3986`,
+ASCII newline ``\n``, ``\r`` and tab ``\t`` characters are stripped from the
+URL by the parser in :mod:`urllib.parse` preventing such attacks. The removal
+characters are controlled by a new module level variable
+``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :issue:`43882`)
+
+xml
+---
+
+Add a :class:`~xml.sax.handler.LexicalHandler` class to the
+:mod:`xml.sax.handler` module.
+(Contributed by Jonathan Gossage and Zackery Spytz in :issue:`35018`.)
+
+zipimport
+---------
+Add methods related to :pep:`451`: :meth:`~zipimport.zipimporter.find_spec`,
+:meth:`zipimport.zipimporter.create_module`, and
+:meth:`zipimport.zipimporter.exec_module`.
+(Contributed by Brett Cannon in :issue:`42131`.)
+
+Add :meth:`~zipimport.zipimporter.invalidate_caches` method.
+(Contributed by Desmond Cheong in :issue:`14678`.)
+
+
+Optimizations
+=============
+
+* Constructors :func:`str`, :func:`bytes` and :func:`bytearray` are now faster
+  (around 30--40% for small objects).
+  (Contributed by Serhiy Storchaka in :issue:`41334`.)
+
+* The :mod:`runpy` module now imports fewer modules.
+  The ``python3 -m module-name`` command startup time is 1.4x faster in
+  average. On Linux, ``python3 -I -m module-name`` imports 69 modules on Python
+  3.9, whereas it only imports 51 modules (-18) on Python 3.10.
+  (Contributed by Victor Stinner in :issue:`41006` and :issue:`41718`.)
+
+* The ``LOAD_ATTR`` instruction now uses new "per opcode cache" mechanism.  It
+  is about 36% faster now for regular attributes and 44% faster for slots.
+  (Contributed by Pablo Galindo and Yury Selivanov in :issue:`42093` and Guido
+  van Rossum in :issue:`42927`, based on ideas implemented originally in PyPy
+  and MicroPython.)
+
+* When building Python with :option:`--enable-optimizations` now
+  ``-fno-semantic-interposition`` is added to both the compile and link line.
+  This speeds builds of the Python interpreter created with :option:`--enable-shared`
+  with ``gcc`` by up to 30%. See `this article
+  <https://developers.redhat.com/blog/2020/06/25/red-hat-enterprise-linux-8-2-brings-faster-python-3-8-run-speeds/>`_
+  for more details. (Contributed by Victor Stinner and Pablo Galindo in
+  :issue:`38980`.)
+
+* Use a new output buffer management code for :mod:`bz2` / :mod:`lzma` /
+  :mod:`zlib` modules, and add ``.readall()`` function to
+  ``_compression.DecompressReader`` class. bz2 decompression is now 1.09x ~ 1.17x
+  faster, lzma decompression 1.20x ~ 1.32x faster, ``GzipFile.read(-1)`` 1.11x
+  ~ 1.18x faster. (Contributed by Ma Lin, reviewed by Gregory P. Smith, in :issue:`41486`)
+
+* When using stringized annotations, annotations dicts for functions are no longer
+  created when the function is created.  Instead, they are stored as a tuple of
+  strings, and the function object lazily converts this into the annotations dict
+  on demand.  This optimization cuts the CPU time needed to define an annotated
+  function by half.
+  (Contributed by Yurii Karabas and Inada Naoki in :issue:`42202`)
+
+* Substring search functions such as ``str1 in str2`` and ``str2.find(str1)``
+  now sometimes use Crochemore & Perrin's "Two-Way" string searching
+  algorithm to avoid quadratic behavior on long strings.  (Contributed
+  by Dennis Sweeney in :issue:`41972`)
+
+* Add micro-optimizations to ``_PyType_Lookup()`` to improve type attribute cache lookup
+  performance in the common case of cache hits. This makes the interpreter 1.04 times faster
+  on average. (Contributed by Dino Viehland in :issue:`43452`)
+
+* The following built-in functions now support the faster :pep:`590` vectorcall calling convention:
+  :func:`map`, :func:`filter`, :func:`reversed`, :func:`bool` and :func:`float`.
+  (Contributed by Dong-hee Na and Jeroen Demeyer in :issue:`43575`, :issue:`43287`, :issue:`41922`, :issue:`41873` and :issue:`41870`)
+
+* :class:`BZ2File` performance is improved by removing internal ``RLock``.
+  This makes :class:`BZ2File` thread unsafe in the face of multiple simultaneous
+  readers or writers, just like its equivalent classes in :mod:`gzip` and
+  :mod:`lzma` have always been.  (Contributed by Inada Naoki in :issue:`43785`).
+
+.. _whatsnew310-deprecated:
+
+Deprecated
+==========
+
+* Currently Python accepts numeric literals immediately followed by keywords,
+  for example ``0in x``, ``1or x``, ``0if 1else 2``.  It allows confusing
+  and ambiguous expressions like ``[0x1for x in y]`` (which can be
+  interpreted as ``[0x1 for x in y]`` or ``[0x1f or x in y]``).  Starting in
+  this release, a deprecation warning is raised if the numeric literal is
+  immediately followed by one of keywords :keyword:`and`, :keyword:`else`,
+  :keyword:`for`, :keyword:`if`, :keyword:`in`, :keyword:`is` and :keyword:`or`.
+  In future releases it will be changed to syntax warning, and finally to
+  syntax error.
+  (Contributed by Serhiy Storchaka in :issue:`43833`).
+
+* Starting in this release, there will be a concerted effort to begin
+  cleaning up old import semantics that were kept for Python 2.7
+  compatibility. Specifically,
+  :meth:`~importlib.abc.PathEntryFinder.find_loader`/:meth:`~importlib.abc.Finder.find_module`
+  (superseded by :meth:`~importlib.abc.Finder.find_spec`),
+  :meth:`~importlib.abc.Loader.load_module`
+  (superseded by :meth:`~importlib.abc.Loader.exec_module`),
+  :meth:`~importlib.abc.Loader.module_repr` (which the import system
+  takes care of for you), the ``__package__`` attribute
+  (superseded by ``__spec__.parent``), the ``__loader__`` attribute
+  (superseded by ``__spec__.loader``), and the ``__cached__`` attribute
+  (superseded by ``__spec__.cached``) will slowly be removed (as well
+  as other classes and methods in :mod:`importlib`).
+  :exc:`ImportWarning` and/or :exc:`DeprecationWarning` will be raised
+  as appropriate to help identify code which needs updating during
+  this transition.
+
+* The entire ``distutils`` namespace is deprecated, to be removed in
+  Python 3.12. Refer to the :ref:`module changes <distutils-deprecated>`
+  section for more information.
+
+* Non-integer arguments to :func:`random.randrange` are deprecated.
+  The :exc:`ValueError` is deprecated in favor of a :exc:`TypeError`.
+  (Contributed by Serhiy Storchaka and Raymond Hettinger in :issue:`37319`.)
+
+* The various ``load_module()`` methods of :mod:`importlib` have been
+  documented as deprecated since Python 3.6, but will now also trigger
+  a :exc:`DeprecationWarning`. Use
+  :meth:`~importlib.abc.Loader.exec_module` instead.
+  (Contributed by Brett Cannon in :issue:`26131`.)
+
+* :meth:`zimport.zipimporter.load_module` has been deprecated in
+  preference for :meth:`~zipimport.zipimporter.exec_module`.
+  (Contributed by Brett Cannon in :issue:`26131`.)
+
+* The use of :meth:`~importlib.abc.Loader.load_module` by the import
+  system now triggers an :exc:`ImportWarning` as
+  :meth:`~importlib.abc.Loader.exec_module` is preferred.
+  (Contributed by Brett Cannon in :issue:`26131`.)
+
+* The use of :meth:`importlib.abc.MetaPathFinder.find_module` and
+  :meth:`importlib.abc.PathEntryFinder.find_module` by the import system now
+  trigger an :exc:`ImportWarning` as
+  :meth:`importlib.abc.MetaPathFinder.find_spec` and
+  :meth:`importlib.abc.PathEntryFinder.find_spec`
+  are preferred, respectively. You can use
+  :func:`importlib.util.spec_from_loader` to help in porting.
+  (Contributed by Brett Cannon in :issue:`42134`.)
+
+* The use of :meth:`importlib.abc.PathEntryFinder.find_loader` by the import
+  system now triggers an :exc:`ImportWarning` as
+  :meth:`importlib.abc.PathEntryFinder.find_spec` is preferred. You can use
+  :func:`importlib.util.spec_from_loader` to help in porting.
+  (Contributed by Brett Cannon in :issue:`43672`.)
+
+* The various implementations of
+  :meth:`importlib.abc.MetaPathFinder.find_module` (
+  :meth:`importlib.machinery.BuiltinImporter.find_module`,
+  :meth:`importlib.machinery.FrozenImporter.find_module`,
+  :meth:`importlib.machinery.WindowsRegistryFinder.find_module`,
+  :meth:`importlib.machinery.PathFinder.find_module`,
+  :meth:`importlib.abc.MetaPathFinder.find_module` ),
+  :meth:`importlib.abc.PathEntryFinder.find_module` (
+  :meth:`importlib.machinery.FileFinder.find_module` ), and
+  :meth:`importlib.abc.PathEntryFinder.find_loader` (
+  :meth:`importlib.machinery.FileFinder.find_loader` )
+  now raise :exc:`DeprecationWarning` and are slated for removal in
+  Python 3.12 (previously they were documented as deprecated in Python 3.4).
+  (Contributed by Brett Cannon in :issue:`42135`.)
+
+* :class:`importlib.abc.Finder` is deprecated (including its sole method,
+  :meth:`~importlib.abc.Finder.find_module`). Both
+  :class:`importlib.abc.MetaPathFinder` and :class:`importlib.abc.PathEntryFinder`
+  no longer inherit from the class. Users should inherit from one of these two
+  classes as appropriate instead.
+  (Contributed by Brett Cannon in :issue:`42135`.)
+
+* The deprecations of :mod:`imp`, :func:`importlib.find_loader`,
+  :func:`importlib.util.set_package_wrapper`,
+  :func:`importlib.util.set_loader_wrapper`,
+  :func:`importlib.util.module_for_loader`,
+  :class:`pkgutil.ImpImporter`, and
+  :class:`pkgutil.ImpLoader` have all been updated to list Python 3.12 as the
+  slated version of removal (they began raising :exc:`DeprecationWarning` in
+  previous versions of Python).
+  (Contributed by Brett Cannon in :issue:`43720`.)
+
+* The import system now uses the ``__spec__`` attribute on modules before
+  falling back on :meth:`~importlib.abc.Loader.module_repr` for a module's
+  ``__repr__()`` method. Removal of the use of ``module_repr()`` is scheduled
+  for Python 3.12.
+  (Contributed by Brett Cannon in :issue:`42137`.)
+
+* :meth:`importlib.abc.Loader.module_repr`,
+  :meth:`importlib.machinery.FrozenLoader.module_repr`, and
+  :meth:`importlib.machinery.BuiltinLoader.module_repr` are deprecated and
+  slated for removal in Python 3.12.
+  (Contributed by Brett Cannon in :issue:`42136`.)
+
+* ``sqlite3.OptimizedUnicode`` has been undocumented and obsolete since Python
+  3.3, when it was made an alias to :class:`str`.  It is now deprecated,
+  scheduled for removal in Python 3.12.
+  (Contributed by Erlend E. Aasland in :issue:`42264`.)
+
+* :func:`asyncio.get_event_loop` now emits a deprecation warning if there is
+  no running event loop. In the future it will be an alias of
+  :func:`~asyncio.get_running_loop`.
+  :mod:`asyncio` functions which implicitly create :class:`~asyncio.Future`
+  or :class:`~asyncio.Task` objects now emit
+  a deprecation warning if there is no running event loop and no explicit
+  *loop* argument is passed: :func:`~asyncio.ensure_future`,
+  :func:`~asyncio.wrap_future`, :func:`~asyncio.gather`,
+  :func:`~asyncio.shield`, :func:`~asyncio.as_completed` and constructors of
+  :class:`~asyncio.Future`, :class:`~asyncio.Task`,
+  :class:`~asyncio.StreamReader`, :class:`~asyncio.StreamReaderProtocol`.
+  (Contributed by Serhiy Storchaka in :issue:`39529`.)
+
+* The undocumented built-in function ``sqlite3.enable_shared_cache`` is now
+  deprecated, scheduled for removal in Python 3.12.  Its use is strongly
+  discouraged by the SQLite3 documentation.  See `the SQLite3 docs
+  <https://sqlite.org/c3ref/enable_shared_cache.html>`_ for more details.
+  If a shared cache must be used, open the database in URI mode using the
+  ``cache=shared`` query parameter.
+  (Contributed by Erlend E. Aasland in :issue:`24464`.)
+
+* The following ``threading`` methods are now deprecated:
+
+  * ``threading.currentThread`` => :func:`threading.current_thread`
+
+  * ``threading.activeCount`` => :func:`threading.active_count`
+
+  * ``threading.Condition.notifyAll`` =>
+    :meth:`threading.Condition.notify_all`
+
+  * ``threading.Event.isSet`` => :meth:`threading.Event.is_set`
+
+  * ``threading.Thread.setName`` => :attr:`threading.Thread.name`
+
+  * ``threading.thread.getName`` => :attr:`threading.Thread.name`
+
+  * ``threading.Thread.isDaemon`` => :attr:`threading.Thread.daemon`
+
+  * ``threading.Thread.setDaemon`` => :attr:`threading.Thread.daemon`
+
+  (Contributed by Jelle Zijlstra in :issue:`21574`.)
+
+* :meth:`pathlib.Path.link_to` is deprecated and slated for removal in
+  Python 3.12. Use :meth:`pathlib.Path.hardlink_to` instead.
+  (Contributed by Barney Gale in :issue:`39950`.)
+
+* ``cgi.log()`` is deprecated and slated for removal in Python 3.12.
+  (Contributed by Inada Naoki in :issue:`41139`.)
+
+* The following :mod:`ssl` features have been deprecated since Python 3.6,
+  Python 3.7, or OpenSSL 1.1.0 and will be removed in 3.11:
+
+  * :data:`~ssl.OP_NO_SSLv2`, :data:`~ssl.OP_NO_SSLv3`, :data:`~ssl.OP_NO_TLSv1`,
+    :data:`~ssl.OP_NO_TLSv1_1`, :data:`~ssl.OP_NO_TLSv1_2`, and
+    :data:`~ssl.OP_NO_TLSv1_3` are replaced by
+    :attr:`sslSSLContext.minimum_version` and
+    :attr:`sslSSLContext.maximum_version`.
+
+  * :data:`~ssl.PROTOCOL_SSLv2`, :data:`~ssl.PROTOCOL_SSLv3`,
+    :data:`~ssl.PROTOCOL_SSLv23`, :data:`~ssl.PROTOCOL_TLSv1`,
+    :data:`~ssl.PROTOCOL_TLSv1_1`, :data:`~ssl.PROTOCOL_TLSv1_2`, and
+    :data:`~ssl.PROTOCOL_TLS` are deprecated in favor of
+    :data:`~ssl.PROTOCOL_TLS_CLIENT` and :data:`~ssl.PROTOCOL_TLS_SERVER`
+
+  * :func:`~ssl.wrap_socket` is replaced by :meth:`ssl.SSLContext.wrap_socket`
+
+  * :func:`~ssl.match_hostname`
+
+  * :func:`~ssl.RAND_pseudo_bytes`, :func:`~ssl.RAND_egd`
+
+  * NPN features like :meth:`ssl.SSLSocket.selected_npn_protocol` and
+    :meth:`ssl.SSLContext.set_npn_protocols` are replaced by ALPN.
+
+* The threading debug (:envvar:`PYTHONTHREADDEBUG` environment variable) is
+  deprecated in Python 3.10 and will be removed in Python 3.12. This feature
+  requires a :ref:`debug build of Python <debug-build>`.
+  (Contributed by Victor Stinner in :issue:`44584`.)
+
+* Importing from the ``typing.io`` and ``typing.re`` submodules will now emit
+  :exc:`DeprecationWarning`.  These submodules will be removed in a future version
+  of Python.  Anything belonging to these submodules should be imported directly
+  from :mod:`typing` instead.
+  (Contributed by Sebastian Rittau in :issue:`38291`)
+
+.. _whatsnew310-removed:
+
+Removed
+=======
+
+* Removed special methods ``__int__``, ``__float__``, ``__floordiv__``,
+  ``__mod__``, ``__divmod__``, ``__rfloordiv__``, ``__rmod__`` and
+  ``__rdivmod__`` of the :class:`complex` class.  They always raised
+  a :exc:`TypeError`.
+  (Contributed by Serhiy Storchaka in :issue:`41974`.)
+
+* The ``ParserBase.error()`` method from the private and undocumented ``_markupbase``
+  module has been removed.  :class:`html.parser.HTMLParser` is the only subclass of
+  ``ParserBase`` and its ``error()`` implementation was already removed in
+  Python 3.5.
+  (Contributed by Berker Peksag in :issue:`31844`.)
+
+* Removed the ``unicodedata.ucnhash_CAPI`` attribute which was an internal
+  PyCapsule object. The related private ``_PyUnicode_Name_CAPI`` structure was
+  moved to the internal C API.
+  (Contributed by Victor Stinner in :issue:`42157`.)
+
+* Removed the ``parser`` module, which was deprecated in 3.9 due to the
+  switch to the new PEG parser, as well as all the C source and header files
+  that were only being used by the old parser, including ``node.h``, ``parser.h``,
+  ``graminit.h`` and ``grammar.h``.
+
+* Removed the Public C API functions ``PyParser_SimpleParseStringFlags``,
+  ``PyParser_SimpleParseStringFlagsFilename``,
+  ``PyParser_SimpleParseFileFlags`` and ``PyNode_Compile``
+  that were deprecated in 3.9 due to the switch to the new PEG parser.
+
+* Removed the ``formatter`` module, which was deprecated in Python 3.4.
+  It is somewhat obsolete, little used, and not tested. It was originally
+  scheduled to be removed in Python 3.6, but such removals were delayed until
+  after Python 2.7 EOL. Existing users should copy whatever classes they use
+  into their code.
+  (Contributed by Dong-hee Na and Terry J. Reedy in :issue:`42299`.)
+
+* Removed the :c:func:`PyModule_GetWarningsModule` function that was useless
+  now due to the _warnings module was converted to a builtin module in 2.6.
+  (Contributed by Hai Shi in :issue:`42599`.)
+
+* Remove deprecated aliases to :ref:`collections-abstract-base-classes` from
+  the :mod:`collections` module.
+  (Contributed by Victor Stinner in :issue:`37324`.)
+
+* The ``loop`` parameter has been removed from most of :mod:`asyncio`\ 's
+  :doc:`high-level API <../library/asyncio-api-index>` following deprecation
+  in Python 3.8.  The motivation behind this change is multifold:
+
+  1. This simplifies the high-level API.
+  2. The functions in the high-level API have been implicitly getting the
+     current thread's running event loop since Python 3.7.  There isn't a need to
+     pass the event loop to the API in most normal use cases.
+  3. Event loop passing is error-prone especially when dealing with loops
+     running in different threads.
+
+  Note that the low-level API will still accept ``loop``.
+  See :ref:`changes-python-api` for examples of how to replace existing code.
+
+  (Contributed by Yurii Karabas, Andrew Svetlov, Yury Selivanov and Kyle Stanley
+  in :issue:`42392`.)
+
+
+Porting to Python 3.10
+======================
+
+This section lists previously described changes and other bugfixes
+that may require changes to your code.
+
+
+Changes in the Python syntax
+----------------------------
+
+* Deprecation warning is now emitted when compiling previously valid syntax
+  if the numeric literal is immediately followed by a keyword (like in ``0in x``).
+  In future releases it will be changed to syntax warning, and finally to a
+  syntax error.  To get rid of the warning and make the code compatible with
+  future releases just add a space between the numeric literal and the
+  following keyword.
+  (Contributed by Serhiy Storchaka in :issue:`43833`).
+
+.. _changes-python-api:
+
+Changes in the Python API
+-------------------------
+
+* The *etype* parameters of the :func:`~traceback.format_exception`,
+  :func:`~traceback.format_exception_only`, and
+  :func:`~traceback.print_exception` functions in the :mod:`traceback` module
+  have been renamed to *exc*.
+  (Contributed by Zackery Spytz and Matthias Bussonnier in :issue:`26389`.)
+
+* :mod:`atexit`: At Python exit, if a callback registered with
+  :func:`atexit.register` fails, its exception is now logged. Previously, only
+  some exceptions were logged, and the last exception was always silently
+  ignored.
+  (Contributed by Victor Stinner in :issue:`42639`.)
+
+* :class:`collections.abc.Callable` generic now flattens type parameters, similar
+  to what :data:`typing.Callable` currently does.  This means that
+  ``collections.abc.Callable[[int, str], str]`` will have ``__args__`` of
+  ``(int, str, str)``; previously this was ``([int, str], str)``.  Code which
+  accesses the arguments via :func:`typing.get_args` or ``__args__`` need to account
+  for this change.  Furthermore, :exc:`TypeError` may be raised for invalid forms
+  of parameterizing :class:`collections.abc.Callable` which may have passed
+  silently in Python 3.9.
+  (Contributed by Ken Jin in :issue:`42195`.)
+
+* :meth:`socket.htons` and :meth:`socket.ntohs` now raise :exc:`OverflowError`
+  instead of :exc:`DeprecationWarning` if the given parameter will not fit in
+  a 16-bit unsigned integer.
+  (Contributed by Erlend E. Aasland in :issue:`42393`.)
+
+* The ``loop`` parameter has been removed from most of :mod:`asyncio`\ 's
+  :doc:`high-level API <../library/asyncio-api-index>` following deprecation
+  in Python 3.8.
+
+  A coroutine that currently looks like this::
+
+     async def foo(loop):
+         await asyncio.sleep(1, loop=loop)
+
+  Should be replaced with this::
+
+     async def foo():
+         await asyncio.sleep(1)
+
+  If ``foo()`` was specifically designed *not* to run in the current thread's
+  running event loop (e.g. running in another thread's event loop), consider
+  using :func:`asyncio.run_coroutine_threadsafe` instead.
+
+  (Contributed by Yurii Karabas, Andrew Svetlov, Yury Selivanov and Kyle Stanley
+  in :issue:`42392`.)
+
+* The :data:`types.FunctionType` constructor now inherits the current builtins
+  if the *globals* dictionary has no ``"__builtins__"`` key, rather than using
+  ``{"None": None}`` as builtins: same behavior as :func:`eval` and
+  :func:`exec` functions.  Defining a function with ``def function(...): ...``
+  in Python is not affected, globals cannot be overridden with this syntax: it
+  also inherits the current builtins.
+  (Contributed by Victor Stinner in :issue:`42990`.)
+
+Changes in the C API
+--------------------
+
+* The C API functions ``PyParser_SimpleParseStringFlags``,
+  ``PyParser_SimpleParseStringFlagsFilename``,
+  ``PyParser_SimpleParseFileFlags``, ``PyNode_Compile`` and the type
+  used by these functions, ``struct _node``, were removed due to the switch
+  to the new PEG parser.
+
+  Source should be now be compiled directly to a code object using, for
+  example, :c:func:`Py_CompileString`. The resulting code object can then be
+  evaluated using, for example, :c:func:`PyEval_EvalCode`.
+
+  Specifically:
+
+  * A call to ``PyParser_SimpleParseStringFlags`` followed by
+    ``PyNode_Compile`` can be replaced by calling :c:func:`Py_CompileString`.
+
+  * There is no direct replacement for ``PyParser_SimpleParseFileFlags``.
+    To compile code from a ``FILE *`` argument, you will need to read
+    the file in C and pass the resulting buffer to :c:func:`Py_CompileString`.
+
+  * To compile a file given a ``char *`` filename, explicitly open the file, read
+    it and compile the result. One way to do this is using the :py:mod:`io`
+    module with :c:func:`PyImport_ImportModule`, :c:func:`PyObject_CallMethod`,
+    :c:func:`PyBytes_AsString` and :c:func:`Py_CompileString`,
+    as sketched below. (Declarations and error handling are omitted.) ::
+
+       io_module = Import_ImportModule("io");
+       fileobject = PyObject_CallMethod(io_module, "open", "ss", filename, "rb");
+       source_bytes_object = PyObject_CallMethod(fileobject, "read", "");
+       result = PyObject_CallMethod(fileobject, "close", "");
+       source_buf = PyBytes_AsString(source_bytes_object);
+       code = Py_CompileString(source_buf, filename, Py_file_input);
+
+  * For ``FrameObject`` objects, the ``f_lasti`` member now represents a wordcode
+    offset instead of a simple offset into the bytecode string. This means that this
+    number needs to be multiplied by 2 to be used with APIs that expect a byte offset
+    instead (like :c:func:`PyCode_Addr2Line` for example). Notice as well that the
+    ``f_lasti`` member of ``FrameObject`` objects is not considered stable: please
+    use :c:func:`PyFrame_GetLineNumber` instead.
+
+CPython bytecode changes
+========================
+
+* The ``MAKE_FUNCTION`` instruction now accepts either a dict or a tuple of
+  strings as the function's annotations.
+  (Contributed by Yurii Karabas and Inada Naoki in :issue:`42202`)
+
+Build Changes
+=============
+
+* :pep:`644`: Python now requires OpenSSL 1.1.1 or newer. OpenSSL 1.0.2 is no
+  longer supported.
+  (Contributed by Christian Heimes in :issue:`43669`.)
+
+* The C99 functions :c:func:`snprintf` and :c:func:`vsnprintf` are now required
+  to build Python.
+  (Contributed by Victor Stinner in :issue:`36020`.)
+
+* :mod:`sqlite3` requires SQLite 3.7.15 or higher. (Contributed by Sergey Fedoseev
+  and Erlend E. Aasland in :issue:`40744` and :issue:`40810`.)
+
+* The :mod:`atexit` module must now always be built as a built-in module.
+  (Contributed by Victor Stinner in :issue:`42639`.)
+
+* Add :option:`--disable-test-modules` option to the ``configure`` script:
+  don't build nor install test modules.
+  (Contributed by Xavier de Gaye, Thomas Petazzoni and Peixing Xin in :issue:`27640`.)
+
+* Add :option:`--with-wheel-pkg-dir=PATH option <--with-wheel-pkg-dir>`
+  to the ``./configure`` script. If
+  specified, the :mod:`ensurepip` module looks for ``setuptools`` and ``pip``
+  wheel packages in this directory: if both are present, these wheel packages
+  are used instead of ensurepip bundled wheel packages.
+
+  Some Linux distribution packaging policies recommend against bundling
+  dependencies. For example, Fedora installs wheel packages in the
+  ``/usr/share/python-wheels/`` directory and don't install the
+  ``ensurepip._bundled`` package.
+
+  (Contributed by Victor Stinner in :issue:`42856`.)
+
+* Add a new :option:`configure --without-static-libpython option
+  <--without-static-libpython>` to not build the ``libpythonMAJOR.MINOR.a``
+  static library and not install the ``python.o`` object file.
+
+  (Contributed by Victor Stinner in :issue:`43103`.)
+
+* The ``configure`` script now uses the ``pkg-config`` utility, if available,
+  to detect the location of Tcl/Tk headers and libraries.  As before, those
+  locations can be explicitly specified with the :option:`--with-tcltk-includes`
+  and :option:`--with-tcltk-libs` configuration options.
+  (Contributed by Manolis Stamatogiannakis in :issue:`42603`.)
+
+* Add :option:`--with-openssl-rpath` option to ``configure`` script. The option
+  simplifies building Python with a custom OpenSSL installation, e.g.
+  ``./configure --with-openssl=/path/to/openssl --with-openssl-rpath=auto``.
+  (Contributed by Christian Heimes in :issue:`43466`.)
+
+
+C API Changes
+=============
+
+PEP 652: Maintaining the Stable ABI
+-----------------------------------
+
+The Stable ABI (Application Binary Interface) for extension modules or
+embedding Python is now explicitly defined.
+:ref:`stable` describes C API and ABI stability guarantees along with best
+practices for using the Stable ABI.
+
+(Contributed by Petr Viktorin in :pep:`652` and :issue:`43795`.)
+
+New Features
+------------
+
+* The result of :c:func:`PyNumber_Index` now always has exact type :class:`int`.
+  Previously, the result could have been an instance of a subclass of ``int``.
+  (Contributed by Serhiy Storchaka in :issue:`40792`.)
+
+* Add a new :c:member:`~PyConfig.orig_argv` member to the :c:type:`PyConfig`
+  structure: the list of the original command line arguments passed to the
+  Python executable.
+  (Contributed by Victor Stinner in :issue:`23427`.)
+
+* The :c:func:`PyDateTime_DATE_GET_TZINFO` and
+  :c:func:`PyDateTime_TIME_GET_TZINFO` macros have been added for accessing
+  the ``tzinfo`` attributes of :class:`datetime.datetime` and
+  :class:`datetime.time` objects.
+  (Contributed by Zackery Spytz in :issue:`30155`.)
+
+* Add a :c:func:`PyCodec_Unregister` function to unregister a codec
+  search function.
+  (Contributed by Hai Shi in :issue:`41842`.)
+
+* The :c:func:`PyIter_Send` function was added to allow
+  sending value into iterator without raising ``StopIteration`` exception.
+  (Contributed by Vladimir Matveev in :issue:`41756`.)
+
+* Add :c:func:`PyUnicode_AsUTF8AndSize` to the limited C API.
+  (Contributed by Alex Gaynor in :issue:`41784`.)
+
+* Add :c:func:`PyModule_AddObjectRef` function: similar to
+  :c:func:`PyModule_AddObject` but don't steal a reference to the value on
+  success.
+  (Contributed by Victor Stinner in :issue:`1635741`.)
+
+* Add :c:func:`Py_NewRef` and :c:func:`Py_XNewRef` functions to increment the
+  reference count of an object and return the object.
+  (Contributed by Victor Stinner in :issue:`42262`.)
+
+* The :c:func:`PyType_FromSpecWithBases` and :c:func:`PyType_FromModuleAndSpec`
+  functions now accept a single class as the *bases* argument.
+  (Contributed by Serhiy Storchaka in :issue:`42423`.)
+
+* The :c:func:`PyType_FromModuleAndSpec` function now accepts NULL ``tp_doc``
+  slot.
+  (Contributed by Hai Shi in :issue:`41832`.)
+
+* The :c:func:`PyType_GetSlot` function can accept
+  :ref:`static types <static-types>`.
+  (Contributed by Hai Shi and Petr Viktorin in :issue:`41073`.)
+
+* Add a new :c:func:`PySet_CheckExact` function to the C-API to check if an
+  object is an instance of :class:`set` but not an instance of a subtype.
+  (Contributed by Pablo Galindo in :issue:`43277`.)
+
+* Add :c:func:`PyErr_SetInterruptEx` which allows passing a signal number
+  to simulate.
+  (Contributed by Antoine Pitrou in :issue:`43356`.)
+
+* The limited C API is now supported if :ref:`Python is built in debug mode
+  <debug-build>` (if the ``Py_DEBUG`` macro is defined). In the limited C API,
+  the :c:func:`Py_INCREF` and :c:func:`Py_DECREF` functions are now implemented
+  as opaque function
+  calls, rather than accessing directly the :c:member:`PyObject.ob_refcnt`
+  member, if Python is built in debug mode and the ``Py_LIMITED_API`` macro
+  targets Python 3.10 or newer. It became possible to support the limited C API
+  in debug mode because the :c:type:`PyObject` structure is the same in release
+  and debug mode since Python 3.8 (see :issue:`36465`).
+
+  The limited C API is still not supported in the :option:`--with-trace-refs`
+  special build (``Py_TRACE_REFS`` macro).
+  (Contributed by Victor Stinner in :issue:`43688`.)
+
+* Add the :c:func:`Py_Is(x, y) <Py_Is>` function to test if the *x* object is
+  the *y* object, the same as ``x is y`` in Python. Add also the
+  :c:func:`Py_IsNone`, :c:func:`Py_IsTrue`, :c:func:`Py_IsFalse` functions to
+  test if an object is, respectively, the ``None`` singleton, the ``True``
+  singleton or the ``False`` singleton.
+  (Contributed by Victor Stinner in :issue:`43753`.)
+
+* Add new functions to control the garbage collector from C code:
+  :c:func:`PyGC_Enable()`,
+  :c:func:`PyGC_Disable()`,
+  :c:func:`PyGC_IsEnabled()`.
+  These functions allow to activate, deactivate and query the state of the garbage collector from C code without
+  having to import the :mod:`gc` module.
+
+* Add a new :c:data:`Py_TPFLAGS_DISALLOW_INSTANTIATION` type flag to disallow
+  creating type instances.
+  (Contributed by Victor Stinner in :issue:`43916`.)
+
+* Add a new :c:data:`Py_TPFLAGS_IMMUTABLETYPE` type flag for creating immutable
+  type objects: type attributes cannot be set nor deleted.
+  (Contributed by Victor Stinner and Erlend E. Aasland in :issue:`43908`.)
+
+Porting to Python 3.10
+----------------------
+
+* The ``PY_SSIZE_T_CLEAN`` macro must now be defined to use
+  :c:func:`PyArg_ParseTuple` and :c:func:`Py_BuildValue` formats which use
+  ``#``: ``es#``, ``et#``, ``s#``, ``u#``, ``y#``, ``z#``, ``U#`` and ``Z#``.
+  See :ref:`Parsing arguments and building values
+  <arg-parsing>` and the :pep:`353`.
+  (Contributed by Victor Stinner in :issue:`40943`.)
+
+* Since :c:func:`Py_REFCNT()` is changed to the inline static function,
+  ``Py_REFCNT(obj) = new_refcnt`` must be replaced with ``Py_SET_REFCNT(obj, new_refcnt)``:
+  see :c:func:`Py_SET_REFCNT()` (available since Python 3.9). For backward
+  compatibility, this macro can be used::
+
+      #if PY_VERSION_HEX < 0x030900A4
+      #  define Py_SET_REFCNT(obj, refcnt) ((Py_REFCNT(obj) = (refcnt)), (void)0)
+      #endif
+
+  (Contributed by Victor Stinner in :issue:`39573`.)
+
+* Calling :c:func:`PyDict_GetItem` without :term:`GIL` held had been allowed
+  for historical reason. It is no longer allowed.
+  (Contributed by Victor Stinner in :issue:`40839`.)
+
+* ``PyUnicode_FromUnicode(NULL, size)`` and ``PyUnicode_FromStringAndSize(NULL, size)``
+  raise ``DeprecationWarning`` now.  Use :c:func:`PyUnicode_New` to allocate
+  Unicode object without initial data.
+  (Contributed by Inada Naoki in :issue:`36346`.)
+
+* The private ``_PyUnicode_Name_CAPI`` structure of the PyCapsule API
+  ``unicodedata.ucnhash_CAPI`` has been moved to the internal C API.
+  (Contributed by Victor Stinner in :issue:`42157`.)
+
+* :c:func:`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`,
+  :c:func:`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome` and
+  :c:func:`Py_GetProgramName` functions now return ``NULL`` if called before
+  :c:func:`Py_Initialize` (before Python is initialized). Use the new
+  :ref:`Python Initialization Configuration API <init-config>` to get the
+  :ref:`Python Path Configuration.  <init-path-config>`.
+  (Contributed by Victor Stinner in :issue:`42260`.)
+
+* :c:func:`PyList_SET_ITEM`, :c:func:`PyTuple_SET_ITEM` and
+  :c:func:`PyCell_SET` macros can no longer be used as l-value or r-value.
+  For example, ``x = PyList_SET_ITEM(a, b, c)`` and
+  ``PyList_SET_ITEM(a, b, c) = x`` now fail with a compiler error. It prevents
+  bugs like ``if (PyList_SET_ITEM (a, b, c) < 0) ...`` test.
+  (Contributed by Zackery Spytz and Victor Stinner in :issue:`30459`.)
+
+* The non-limited API files ``odictobject.h``, ``parser_interface.h``,
+  ``picklebufobject.h``, ``pyarena.h``, ``pyctype.h``, ``pydebug.h``,
+  ``pyfpe.h``, and ``pytime.h`` have been moved to the ``Include/cpython``
+  directory. These files must not be included directly, as they are already
+  included in ``Python.h``: :ref:`Include Files <api-includes>`. If they have
+  been included directly, consider including ``Python.h`` instead.
+  (Contributed by Nicholas Sim in :issue:`35134`)
+
+* Use the :c:data:`Py_TPFLAGS_IMMUTABLETYPE` type flag to create immutable type
+  objects. Do not rely on :c:data:`Py_TPFLAGS_HEAPTYPE` to decide if a type
+  object is mutable or not; check if :c:data:`Py_TPFLAGS_IMMUTABLETYPE` is set
+  instead.
+  (Contributed by Victor Stinner and Erlend E. Aasland in :issue:`43908`.)
+
+* The undocumented function ``Py_FrozenMain`` has been removed from the
+  limited API. The function is mainly useful for custom builds of Python.
+  (Contributed by Petr Viktorin in :issue:`26241`)
+
+Deprecated
+----------
+
+* The ``PyUnicode_InternImmortal()`` function is now deprecated
+  and will be removed in Python 3.12: use :c:func:`PyUnicode_InternInPlace`
+  instead.
+  (Contributed by Victor Stinner in :issue:`41692`.)
+
+Removed
+-------
+
+* Removed ``Py_UNICODE_str*`` functions manipulating ``Py_UNICODE*`` strings.
+  (Contributed by Inada Naoki in :issue:`41123`.)
+
+   * ``Py_UNICODE_strlen``: use :c:func:`PyUnicode_GetLength` or
+     :c:macro:`PyUnicode_GET_LENGTH`
+   * ``Py_UNICODE_strcat``: use :c:func:`PyUnicode_CopyCharacters` or
+     :c:func:`PyUnicode_FromFormat`
+   * ``Py_UNICODE_strcpy``, ``Py_UNICODE_strncpy``: use
+     :c:func:`PyUnicode_CopyCharacters` or :c:func:`PyUnicode_Substring`
+   * ``Py_UNICODE_strcmp``: use :c:func:`PyUnicode_Compare`
+   * ``Py_UNICODE_strncmp``: use :c:func:`PyUnicode_Tailmatch`
+   * ``Py_UNICODE_strchr``, ``Py_UNICODE_strrchr``: use
+     :c:func:`PyUnicode_FindChar`
+
+* Removed ``PyUnicode_GetMax()``. Please migrate to new (:pep:`393`) APIs.
+  (Contributed by Inada Naoki in :issue:`41103`.)
+
+* Removed ``PyLong_FromUnicode()``. Please migrate to :c:func:`PyLong_FromUnicodeObject`.
+  (Contributed by Inada Naoki in :issue:`41103`.)
+
+* Removed ``PyUnicode_AsUnicodeCopy()``. Please use :c:func:`PyUnicode_AsUCS4Copy` or
+  :c:func:`PyUnicode_AsWideCharString`
+  (Contributed by Inada Naoki in :issue:`41103`.)
+
+* Removed ``_Py_CheckRecursionLimit`` variable: it has been replaced by
+  ``ceval.recursion_limit`` of the :c:type:`PyInterpreterState` structure.
+  (Contributed by Victor Stinner in :issue:`41834`.)
+
+* Removed undocumented macros ``Py_ALLOW_RECURSION`` and
+  ``Py_END_ALLOW_RECURSION`` and the ``recursion_critical`` field of the
+  :c:type:`PyInterpreterState` structure.
+  (Contributed by Serhiy Storchaka in :issue:`41936`.)
+
+* Removed the undocumented ``PyOS_InitInterrupts()`` function. Initializing
+  Python already implicitly installs signal handlers: see
+  :c:member:`PyConfig.install_signal_handlers`.
+  (Contributed by Victor Stinner in :issue:`41713`.)
+
+* Remove the ``PyAST_Validate()`` function. It is no longer possible to build a
+  AST object (``mod_ty`` type) with the public C API. The function was already
+  excluded from the limited C API (:pep:`384`).
+  (Contributed by Victor Stinner in :issue:`43244`.)
+
+* Remove the ``symtable.h`` header file and the undocumented functions:
+
+  * ``PyST_GetScope()``
+  * ``PySymtable_Build()``
+  * ``PySymtable_BuildObject()``
+  * ``PySymtable_Free()``
+  * ``Py_SymtableString()``
+  * ``Py_SymtableStringObject()``
+
+  The ``Py_SymtableString()`` function was part the stable ABI by mistake but
+  it could not be used, because the ``symtable.h`` header file was excluded
+  from the limited C API.
+
+  Use Python :mod:`symtable` module instead.
+  (Contributed by Victor Stinner in :issue:`43244`.)
+
+* Remove :c:func:`PyOS_ReadlineFunctionPointer` from the limited C API headers
+  and from ``python3.dll``, the library that provides the stable ABI on
+  Windows. Since the function takes a ``FILE*`` argument, its ABI stability
+  cannot be guaranteed.
+  (Contributed by Petr Viktorin in :issue:`43868`.)
+
+* Remove ``ast.h``, ``asdl.h``, and ``Python-ast.h`` header files.
+  These functions were undocumented and excluded from the limited C API.
+  Most names defined by these header files were not prefixed by ``Py`` and so
+  could create names conflicts. For example, ``Python-ast.h`` defined a
+  ``Yield`` macro which was conflict with the ``Yield`` name used by the
+  Windows ``<winbase.h>`` header. Use the Python :mod:`ast` module instead.
+  (Contributed by Victor Stinner in :issue:`43244`.)
+
+* Remove the compiler and parser functions using ``struct _mod`` type, because
+  the public AST C API was removed:
+
+  * ``PyAST_Compile()``
+  * ``PyAST_CompileEx()``
+  * ``PyAST_CompileObject()``
+  * ``PyFuture_FromAST()``
+  * ``PyFuture_FromASTObject()``
+  * ``PyParser_ASTFromFile()``
+  * ``PyParser_ASTFromFileObject()``
+  * ``PyParser_ASTFromFilename()``
+  * ``PyParser_ASTFromString()``
+  * ``PyParser_ASTFromStringObject()``
+
+  These functions were undocumented and excluded from the limited C API.
+  (Contributed by Victor Stinner in :issue:`43244`.)
+
+* Remove the ``pyarena.h`` header file with functions:
+
+  * ``PyArena_New()``
+  * ``PyArena_Free()``
+  * ``PyArena_Malloc()``
+  * ``PyArena_AddPyObject()``
+
+  These functions were undocumented, excluded from the limited C API, and were
+  only used internally by the compiler.
+  (Contributed by Victor Stinner in :issue:`43244`.)
+
+* The ``PyThreadState.use_tracing`` member has been removed to optimize Python.
+  (Contributed by Mark Shannon in :issue:`43760`.)
diff --git a/Doc/whatsnew/3.2.rst b/Doc/whatsnew/3.2.rst
index 06bee99..840cb06 100644
--- a/Doc/whatsnew/3.2.rst
+++ b/Doc/whatsnew/3.2.rst
@@ -1921,7 +1921,7 @@
 pydoc
 -----
 
-The :mod:`pydoc` module now provides a much-improved Web server interface, as
+The :mod:`pydoc` module now provides a much-improved web server interface, as
 well as a new command-line option ``-b`` to automatically open a browser window
 to display that server:
 
diff --git a/Doc/whatsnew/3.4.rst b/Doc/whatsnew/3.4.rst
index 99d0408..0405f2b 100644
--- a/Doc/whatsnew/3.4.rst
+++ b/Doc/whatsnew/3.4.rst
@@ -490,7 +490,7 @@
 :mod:`ensurepip` includes a bundled copy of ``pip``, up-to-date as of the first
 release candidate of the release of CPython with which it ships (this applies
 to both maintenance releases and feature releases).  ``ensurepip`` does not
-access the internet.  If the installation has Internet access, after
+access the internet.  If the installation has internet access, after
 ``ensurepip`` is run the bundled ``pip`` can be used to upgrade ``pip`` to a
 more recent release than the bundled one.  (Note that such an upgraded version
 of ``pip`` is considered to be a separately installed package and will not be
diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst
index 85a6657..d7884ea 100644
--- a/Doc/whatsnew/3.6.rst
+++ b/Doc/whatsnew/3.6.rst
@@ -722,8 +722,8 @@
 * line of code executed.
 
 This can be used to instrument running interpreters in production,
-without the need to recompile specific debug builds or providing
-application-specific profiling/debugging code.
+without the need to recompile specific :ref:`debug builds <debug-build>` or
+providing application-specific profiling/debugging code.
 
 More details in :ref:`instrumentation`.
 
@@ -2443,3 +2443,16 @@
 details, see the documentation for ``loop.create_datagram_endpoint()``.
 (Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in
 :issue:`37228`.)
+
+Notable changes in Python 3.6.13
+================================
+
+Earlier Python versions allowed using both ``;`` and ``&`` as
+query parameter separators in :func:`urllib.parse.parse_qs` and
+:func:`urllib.parse.parse_qsl`.  Due to security concerns, and to conform with
+newer W3C recommendations, this has been changed to allow only a single
+separator key, with ``&`` as the default.  This change also affects
+:func:`cgi.parse` and :func:`cgi.parse_multipart` as they use the affected
+functions internally. For more details, please see their respective
+documentation.
+(Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)
diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst
index 25b1e1e..dcbd092 100644
--- a/Doc/whatsnew/3.7.rst
+++ b/Doc/whatsnew/3.7.rst
@@ -232,7 +232,8 @@
 -----------------------------------
 
 The new :option:`-X` ``utf8`` command line option and :envvar:`PYTHONUTF8`
-environment variable can be used to enable the CPython *UTF-8 mode*.
+environment variable can be used to enable the :ref:`Python UTF-8 Mode
+<utf8-mode>`.
 
 When in UTF-8 mode, CPython ignores the locale settings, and uses the
 UTF-8 encoding by default.  The error handlers for :data:`sys.stdin` and
@@ -537,7 +538,7 @@
 * The new :option:`-X` ``importtime`` option or the
   :envvar:`PYTHONPROFILEIMPORTTIME` environment variable can be used to show
   the timing of each module import.
-  (Contributed by Victor Stinner in :issue:`31415`.)
+  (Contributed by Inada Naoki in :issue:`31415`.)
 
 
 New Modules
@@ -1587,8 +1588,8 @@
        for the new ``-X dev`` mode)
      * any implicit filters defined directly by the warnings machinery
 
-* in CPython debug builds, all warnings are now displayed by default (the
-  implicit filter list is empty)
+* in :ref:`CPython debug builds <debug-build>`, all warnings are now displayed
+  by default (the implicit filter list is empty)
 
 (Contributed by Nick Coghlan and Victor Stinner in :issue:`20361`,
 :issue:`32043`, and :issue:`32230`.)
@@ -2556,3 +2557,16 @@
 details, see the documentation for ``loop.create_datagram_endpoint()``.
 (Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in
 :issue:`37228`.)
+
+Notable changes in Python 3.7.10
+================================
+
+Earlier Python versions allowed using both ``;`` and ``&`` as
+query parameter separators in :func:`urllib.parse.parse_qs` and
+:func:`urllib.parse.parse_qsl`.  Due to security concerns, and to conform with
+newer W3C recommendations, this has been changed to allow only a single
+separator key, with ``&`` as the default.  This change also affects
+:func:`cgi.parse` and :func:`cgi.parse_multipart` as they use the affected
+functions internally. For more details, please see their respective
+documentation.
+(Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)
diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst
index 0b4820f..7c293a5 100644
--- a/Doc/whatsnew/3.8.rst
+++ b/Doc/whatsnew/3.8.rst
@@ -211,12 +211,12 @@
 Unix, when Python is built in debug mode, it is now possible to load C
 extensions built in release mode and C extensions built using the stable ABI.
 
-Release builds and debug builds are now ABI compatible: defining the
+Release builds and :ref:`debug builds <debug-build>` are now ABI compatible: defining the
 ``Py_DEBUG`` macro no longer implies the ``Py_TRACE_REFS`` macro, which
 introduces the only ABI incompatibility. The ``Py_TRACE_REFS`` macro, which
 adds the :func:`sys.getobjects` function and the :envvar:`PYTHONDUMPREFS`
-environment variable, can be set using the new ``./configure --with-trace-refs``
-build option.
+environment variable, can be set using the new :option:`./configure
+--with-trace-refs <--with-trace-refs>` build option.
 (Contributed by Victor Stinner in :issue:`36465`.)
 
 On Unix, C extensions are no longer linked to libpython except on Android
@@ -352,7 +352,8 @@
 :ref:`vectorcall` is added to the Python/C API.
 It is meant to formalize existing optimizations which were already done
 for various classes.
-Any static type implementing a callable can use this protocol.
+Any :ref:`static type <static-types>` implementing a callable can use this
+protocol.
 
 This is currently provisional.
 The aim is to make it fully public in Python 3.9.
@@ -904,7 +905,7 @@
 io
 --
 
-In development mode (:option:`-X` ``env``) and in debug build, the
+In development mode (:option:`-X` ``env``) and in :ref:`debug build <debug-build>`, the
 :class:`io.IOBase` finalizer now logs the exception if the ``close()`` method
 fails. The exception is ignored silently by default in release build.
 (Contributed by Victor Stinner in :issue:`18748`.)
@@ -2040,7 +2041,7 @@
   This makes types created through :c:func:`PyType_FromSpec` behave like
   other classes in managed code.
 
-  Statically allocated types are not affected.
+  :ref:`Statically allocated types <static-types>` are not affected.
 
   For the vast majority of cases, there should be no side effect.
   However, types that manually increase the reference count after allocating
@@ -2234,3 +2235,29 @@
 details, see the documentation for ``loop.create_datagram_endpoint()``.
 (Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in
 :issue:`37228`.)
+
+Notable changes in Python 3.8.8
+===============================
+
+Earlier Python versions allowed using both ``;`` and ``&`` as
+query parameter separators in :func:`urllib.parse.parse_qs` and
+:func:`urllib.parse.parse_qsl`.  Due to security concerns, and to conform with
+newer W3C recommendations, this has been changed to allow only a single
+separator key, with ``&`` as the default.  This change also affects
+:func:`cgi.parse` and :func:`cgi.parse_multipart` as they use the affected
+functions internally. For more details, please see their respective
+documentation.
+(Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)
+
+Notable changes in Python 3.8.12
+================================
+
+Starting with Python 3.8.12 the :mod:`ipaddress` module no longer accepts
+any leading zeros in IPv4 address strings. Leading zeros are ambiguous and
+interpreted as octal notation by some libraries. For example the legacy
+function :func:`socket.inet_aton` treats leading zeros as octal notation.
+glibc implementation of modern :func:`~socket.inet_pton` does not accept
+any leading zeros.
+
+(Originally contributed by Christian Heimes in :issue:`36384`, and backported
+to 3.8 by Achraf Merzouki.)
diff --git a/Doc/whatsnew/3.9.rst b/Doc/whatsnew/3.9.rst
index f8f421b..e2455bc 100644
--- a/Doc/whatsnew/3.9.rst
+++ b/Doc/whatsnew/3.9.rst
@@ -231,7 +231,7 @@
   absolute path for :mod:`__main__` module frames in this case.
   (Contributed by Victor Stinner in :issue:`20443`.)
 
-* In the :ref:`Python Development Mode <devmode>` and in debug build, the
+* In the :ref:`Python Development Mode <devmode>` and in :ref:`debug build <debug-build>`, the
   *encoding* and *errors* arguments are now checked for string encoding and
   decoding operations. Examples: :func:`open`, :meth:`str.encode` and
   :meth:`bytes.decode`.
@@ -267,6 +267,10 @@
   :func:`~operator.countOf` of the :mod:`operator` module.
   (Contributed by Serhiy Storchaka in :issue:`40824`.)
 
+* Unparenthesized lambda expressions can no longer be the expression part in an
+  ``if`` clause in comprehensions and generator expressions. See :issue:`41848`
+  and :issue:`43755` for details.
+
 
 New Modules
 ===========
@@ -480,8 +484,25 @@
 Added keywords to module name completion list.  (Contributed by Terry J.
 Reedy in :issue:`37765`.)
 
+New in 3.9 maintenance releases
+
+Make IDLE invoke :func:`sys.excepthook` (when started without '-n').
+User hooks were previously ignored.  (Contributed by Ken Hilton in
+:issue:`43008`.)
+
 The changes above have been backported to 3.8 maintenance releases.
 
+Rearrange the settings dialog.  Split the General tab into Windows
+and Shell/Ed tabs.  Move help sources, which extend the Help menu, to the
+Extensions tab.  Make space for new options and shorten the dialog. The
+latter makes the dialog better fit small screens.  (Contributed by Terry Jan
+Reedy in :issue:`40468`.)  Move the indent space setting from the Font tab to
+the new Windows tab.  (Contributed by Mark Roseman and Terry Jan Reedy in
+:issue:`33962`.)
+
+Apply syntax highlighting to `.pyi` files. (Contributed by Alex
+Waygood and Terry Jan Reedy in :issue:`45447`.)
+
 imaplib
 -------
 
@@ -533,6 +554,10 @@
 If present, scope zone ID is available through the :attr:`~ipaddress.IPv6Address.scope_id` attribute.
 (Contributed by Oleksandr Pavliuk in :issue:`34788`.)
 
+Starting with Python 3.9.5 the :mod:`ipaddress` module no longer
+accepts any leading zeros in IPv4 address strings.
+(Contributed by Christian Heimes in :issue:`36384`).
+
 math
 ----
 
@@ -654,7 +679,7 @@
 platforms that support it.  (Contributed by Karl Ding in :issue:`40291`.)
 
 The socket module now has the :func:`socket.send_fds` and
-:func:`socket.recv.fds` methods. (Contributed by Joannah Nanjekye, Shinya
+:func:`socket.recv_fds` functions. (Contributed by Joannah Nanjekye, Shinya
 Okano and Victor Stinner in :issue:`28724`.)
 
 
@@ -1110,11 +1135,25 @@
   compatible classes that don't inherit from those mentioned types.
   (Contributed by Roger Aiudi in :issue:`34775`).
 
+* Starting with Python 3.9.5 the :mod:`ipaddress` module no longer
+  accepts any leading zeros in IPv4 address strings. Leading zeros are
+  ambiguous and interpreted as octal notation by some libraries. For example
+  the legacy function :func:`socket.inet_aton` treats leading zeros as octal
+  notatation. glibc implementation of modern :func:`~socket.inet_pton` does
+  not accept any leading zeros.
+  (Contributed by Christian Heimes in :issue:`36384`).
+
+* :func:`codecs.lookup` now normalizes the encoding name the same way as
+  :func:`encodings.normalize_encoding`, except that :func:`codecs.lookup` also
+  converts the name to lower case. For example, ``"latex+latin1"`` encoding
+  name is now normalized to ``"latex_latin1"``.
+  (Contributed by Jordon Xu in :issue:`37751`.)
+
 
 Changes in the C API
 --------------------
 
-* Instances of heap-allocated types (such as those created with
+* Instances of :ref:`heap-allocated types <heap-types>` (such as those created with
   :c:func:`PyType_FromSpec` and similar APIs) hold a reference to their type
   object since Python 3.8. As indicated in the "Changes in the C API" of Python
   3.8, for the vast majority of cases, there should be no side effect but for
@@ -1137,7 +1176,8 @@
 
   If your traverse function delegates to ``tp_traverse`` of its base class
   (or another type), ensure that ``Py_TYPE(self)`` is visited only once.
-  Note that only heap types are expected to visit the type in ``tp_traverse``.
+  Note that only :ref:`heap type <heap-types>` are expected to visit the type
+  in ``tp_traverse``.
 
     For example, if your ``tp_traverse`` function includes:
 
@@ -1150,7 +1190,7 @@
     .. code-block:: c
 
         #if PY_VERSION_HEX >= 0x03090000
-            // This was not needed before Python 3.9 (Python issue 35810 and 40217)
+            // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
             if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
                 // a heap type's tp_traverse already visited Py_TYPE(self)
             } else {
@@ -1207,9 +1247,9 @@
   non-system Tcl and Tk frameworks if they are installed in
   ``/Library/Frameworks``, as had been the case on older releases
   of macOS. If a macOS SDK is explicitly configured, by using
-  ``--enable-universalsdk=`` or ``-isysroot``, only the SDK itself is
+  :option:`--enable-universalsdk` or ``-isysroot``, only the SDK itself is
   searched. The default behavior can still be overridden with
-  ``--with-tcltk-includes`` and ``--with-tcltk-libs``.
+  :option:`--with-tcltk-includes` and :option:`--with-tcltk-libs`.
   (Contributed by Ned Deily in :issue:`34956`.)
 
 * Python can now be built for Windows 10 ARM64.
@@ -1355,10 +1395,6 @@
     becomes an alias to the :c:func:`PyObject_NewVar` macro. They no longer
     access directly the :c:member:`PyTypeObject.tp_basicsize` member.
 
-  * :c:func:`PyType_HasFeature` now always calls :c:func:`PyType_GetFlags`.
-    Previously, it accessed directly the :c:member:`PyTypeObject.tp_flags`
-    member when the limited C API was not used.
-
   * :c:func:`PyObject_GET_WEAKREFS_LISTPTR` macro was converted to a function:
     the macro accessed directly the :c:member:`PyTypeObject.tp_weaklistoffset`
     member.
@@ -1471,7 +1507,7 @@
    now ``False``.  To support this change, the internally used type cache now
    supports differentiating types.
 4. ``Literal`` objects will now raise a :exc:`TypeError` exception during
-   equality comparisons if one of their parameters are not :term:`immutable`.
+   equality comparisons if any of their parameters are not :term:`hashable`.
    Note that declaring ``Literal`` with mutable parameters will not throw
    an error::
 
@@ -1497,3 +1533,35 @@
 version in use at runtime ("weaklinking").
 
 (Contributed by Ronald Oussoren and Lawrence D'Anna in :issue:`41100`.)
+
+Notable changes in Python 3.9.2
+===============================
+
+collections.abc
+---------------
+
+:class:`collections.abc.Callable` generic now flattens type parameters, similar
+to what :data:`typing.Callable` currently does.  This means that
+``collections.abc.Callable[[int, str], str]`` will have ``__args__`` of
+``(int, str, str)``; previously this was ``([int, str], str)``.  To allow this
+change, :class:`types.GenericAlias` can now be subclassed, and a subclass will
+be returned when subscripting the :class:`collections.abc.Callable` type.
+Code which accesses the arguments via :func:`typing.get_args` or ``__args__``
+need to account for this change.  A :exc:`DeprecationWarning` may be emitted for
+invalid forms of parameterizing :class:`collections.abc.Callable` which may have
+passed silently in Python 3.9.1.  This :exc:`DeprecationWarning` will
+become a :exc:`TypeError` in Python 3.10.
+(Contributed by Ken Jin in :issue:`42195`.)
+
+urllib.parse
+------------
+
+Earlier Python versions allowed using both ``;`` and ``&`` as
+query parameter separators in :func:`urllib.parse.parse_qs` and
+:func:`urllib.parse.parse_qsl`.  Due to security concerns, and to conform with
+newer W3C recommendations, this has been changed to allow only a single
+separator key, with ``&`` as the default.  This change also affects
+:func:`cgi.parse` and :func:`cgi.parse_multipart` as they use the affected
+functions internally. For more details, please see their respective
+documentation.
+(Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)
diff --git a/Doc/whatsnew/index.rst b/Doc/whatsnew/index.rst
index 954e38b..a1ff8ec 100644
--- a/Doc/whatsnew/index.rst
+++ b/Doc/whatsnew/index.rst
@@ -11,6 +11,7 @@
 .. toctree::
    :maxdepth: 2
 
+   3.10.rst
    3.9.rst
    3.8.rst
    3.7.rst
diff --git a/Grammar/Grammar b/Grammar/Grammar
deleted file mode 100644
index 170518a..0000000
--- a/Grammar/Grammar
+++ /dev/null
@@ -1,207 +0,0 @@
-# Grammar for Python
-
-# NOTE WELL: You should also follow all the steps listed at
-# https://devguide.python.org/grammar/
-
-# Start symbols for the grammar:
-#       single_input is a single interactive statement;
-#       file_input is a module or sequence of commands read from an input file;
-#       eval_input is the input for the eval() functions.
-#       func_type_input is a PEP 484 Python 2 function type comment
-# NB: compound_stmt in single_input is followed by extra NEWLINE!
-# NB: due to the way TYPE_COMMENT is tokenized it will always be followed by a NEWLINE
-single_input: NEWLINE | simple_stmt | compound_stmt NEWLINE
-file_input: (NEWLINE | stmt)* ENDMARKER
-eval_input: testlist NEWLINE* ENDMARKER
-
-decorator: '@' namedexpr_test NEWLINE
-decorators: decorator+
-decorated: decorators (classdef | funcdef | async_funcdef)
-
-async_funcdef: ASYNC funcdef
-funcdef: 'def' NAME parameters ['->' test] ':' [TYPE_COMMENT] func_body_suite
-
-parameters: '(' [typedargslist] ')'
-
-# The following definition for typedarglist is equivalent to this set of rules:
-#
-#     arguments = argument (',' [TYPE_COMMENT] argument)*
-#     argument = tfpdef ['=' test]
-#     kwargs = '**' tfpdef [','] [TYPE_COMMENT]
-#     args = '*' [tfpdef]
-#     kwonly_kwargs = (',' [TYPE_COMMENT] argument)* (TYPE_COMMENT | [',' [TYPE_COMMENT] [kwargs]])
-#     args_kwonly_kwargs = args kwonly_kwargs | kwargs
-#     poskeyword_args_kwonly_kwargs = arguments ( TYPE_COMMENT | [',' [TYPE_COMMENT] [args_kwonly_kwargs]])
-#     typedargslist_no_posonly  = poskeyword_args_kwonly_kwargs | args_kwonly_kwargs
-#     typedarglist = (arguments ',' [TYPE_COMMENT] '/' [',' [[TYPE_COMMENT] typedargslist_no_posonly]])|(typedargslist_no_posonly)"
-#
-# It needs to be fully expanded to allow our LL(1) parser to work on it.
-
-typedargslist: (
-  (tfpdef ['=' test] (',' [TYPE_COMMENT] tfpdef ['=' test])* ',' [TYPE_COMMENT] '/' [',' [ [TYPE_COMMENT] tfpdef ['=' test] (
-        ',' [TYPE_COMMENT] tfpdef ['=' test])* (TYPE_COMMENT | [',' [TYPE_COMMENT] [
-        '*' [tfpdef] (',' [TYPE_COMMENT] tfpdef ['=' test])* (TYPE_COMMENT | [',' [TYPE_COMMENT] ['**' tfpdef [','] [TYPE_COMMENT]]])
-      | '**' tfpdef [','] [TYPE_COMMENT]]])
-  | '*' [tfpdef] (',' [TYPE_COMMENT] tfpdef ['=' test])* (TYPE_COMMENT | [',' [TYPE_COMMENT] ['**' tfpdef [','] [TYPE_COMMENT]]])
-  | '**' tfpdef [','] [TYPE_COMMENT]]] )
-|  (tfpdef ['=' test] (',' [TYPE_COMMENT] tfpdef ['=' test])* (TYPE_COMMENT | [',' [TYPE_COMMENT] [
-   '*' [tfpdef] (',' [TYPE_COMMENT] tfpdef ['=' test])* (TYPE_COMMENT | [',' [TYPE_COMMENT] ['**' tfpdef [','] [TYPE_COMMENT]]])
-  | '**' tfpdef [','] [TYPE_COMMENT]]])
-  | '*' [tfpdef] (',' [TYPE_COMMENT] tfpdef ['=' test])* (TYPE_COMMENT | [',' [TYPE_COMMENT] ['**' tfpdef [','] [TYPE_COMMENT]]])
-  | '**' tfpdef [','] [TYPE_COMMENT])
-)
-tfpdef: NAME [':' test]
-
-# The following definition for varargslist is equivalent to this set of rules:
-#
-#     arguments = argument (',' argument )*
-#     argument = vfpdef ['=' test]
-#     kwargs = '**' vfpdef [',']
-#     args = '*' [vfpdef]
-#     kwonly_kwargs = (',' argument )* [',' [kwargs]]
-#     args_kwonly_kwargs = args kwonly_kwargs | kwargs
-#     poskeyword_args_kwonly_kwargs = arguments [',' [args_kwonly_kwargs]]
-#     vararglist_no_posonly = poskeyword_args_kwonly_kwargs | args_kwonly_kwargs
-#     varargslist = arguments ',' '/' [','[(vararglist_no_posonly)]] | (vararglist_no_posonly)
-#
-# It needs to be fully expanded to allow our LL(1) parser to work on it.
-
-varargslist: vfpdef ['=' test ](',' vfpdef ['=' test])* ',' '/' [',' [ (vfpdef ['=' test] (',' vfpdef ['=' test])* [',' [
-        '*' [vfpdef] (',' vfpdef ['=' test])* [',' ['**' vfpdef [',']]]
-      | '**' vfpdef [',']]]
-  | '*' [vfpdef] (',' vfpdef ['=' test])* [',' ['**' vfpdef [',']]]
-  | '**' vfpdef [',']) ]] | (vfpdef ['=' test] (',' vfpdef ['=' test])* [',' [
-        '*' [vfpdef] (',' vfpdef ['=' test])* [',' ['**' vfpdef [',']]]
-      | '**' vfpdef [',']]]
-  | '*' [vfpdef] (',' vfpdef ['=' test])* [',' ['**' vfpdef [',']]]
-  | '**' vfpdef [',']
-)
-vfpdef: NAME
-
-stmt: simple_stmt | compound_stmt
-simple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE
-small_stmt: (expr_stmt | del_stmt | pass_stmt | flow_stmt |
-             import_stmt | global_stmt | nonlocal_stmt | assert_stmt)
-expr_stmt: testlist_star_expr (annassign | augassign (yield_expr|testlist) |
-                     [('=' (yield_expr|testlist_star_expr))+ [TYPE_COMMENT]] )
-annassign: ':' test ['=' (yield_expr|testlist_star_expr)]
-testlist_star_expr: (test|star_expr) (',' (test|star_expr))* [',']
-augassign: ('+=' | '-=' | '*=' | '@=' | '/=' | '%=' | '&=' | '|=' | '^=' |
-            '<<=' | '>>=' | '**=' | '//=')
-# For normal and annotated assignments, additional restrictions enforced by the interpreter
-del_stmt: 'del' exprlist
-pass_stmt: 'pass'
-flow_stmt: break_stmt | continue_stmt | return_stmt | raise_stmt | yield_stmt
-break_stmt: 'break'
-continue_stmt: 'continue'
-return_stmt: 'return' [testlist_star_expr]
-yield_stmt: yield_expr
-raise_stmt: 'raise' [test ['from' test]]
-import_stmt: import_name | import_from
-import_name: 'import' dotted_as_names
-# note below: the ('.' | '...') is necessary because '...' is tokenized as ELLIPSIS
-import_from: ('from' (('.' | '...')* dotted_name | ('.' | '...')+)
-              'import' ('*' | '(' import_as_names ')' | import_as_names))
-import_as_name: NAME ['as' NAME]
-dotted_as_name: dotted_name ['as' NAME]
-import_as_names: import_as_name (',' import_as_name)* [',']
-dotted_as_names: dotted_as_name (',' dotted_as_name)*
-dotted_name: NAME ('.' NAME)*
-global_stmt: 'global' NAME (',' NAME)*
-nonlocal_stmt: 'nonlocal' NAME (',' NAME)*
-assert_stmt: 'assert' test [',' test]
-
-compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | funcdef | classdef | decorated | async_stmt
-async_stmt: ASYNC (funcdef | with_stmt | for_stmt)
-if_stmt: 'if' namedexpr_test ':' suite ('elif' namedexpr_test ':' suite)* ['else' ':' suite]
-while_stmt: 'while' namedexpr_test ':' suite ['else' ':' suite]
-for_stmt: 'for' exprlist 'in' testlist ':' [TYPE_COMMENT] suite ['else' ':' suite]
-try_stmt: ('try' ':' suite
-           ((except_clause ':' suite)+
-            ['else' ':' suite]
-            ['finally' ':' suite] |
-           'finally' ':' suite))
-with_stmt: 'with' with_item (',' with_item)*  ':' [TYPE_COMMENT] suite
-with_item: test ['as' expr]
-# NB compile.c makes sure that the default except clause is last
-except_clause: 'except' [test ['as' NAME]]
-suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT
-
-namedexpr_test: test [':=' test]
-test: or_test ['if' or_test 'else' test] | lambdef
-test_nocond: or_test | lambdef_nocond
-lambdef: 'lambda' [varargslist] ':' test
-lambdef_nocond: 'lambda' [varargslist] ':' test_nocond
-or_test: and_test ('or' and_test)*
-and_test: not_test ('and' not_test)*
-not_test: 'not' not_test | comparison
-comparison: expr (comp_op expr)*
-# <> isn't actually a valid comparison operator in Python. It's here for the
-# sake of a __future__ import described in PEP 401 (which really works :-)
-comp_op: '<'|'>'|'=='|'>='|'<='|'<>'|'!='|'in'|'not' 'in'|'is'|'is' 'not'
-star_expr: '*' expr
-expr: xor_expr ('|' xor_expr)*
-xor_expr: and_expr ('^' and_expr)*
-and_expr: shift_expr ('&' shift_expr)*
-shift_expr: arith_expr (('<<'|'>>') arith_expr)*
-arith_expr: term (('+'|'-') term)*
-term: factor (('*'|'@'|'/'|'%'|'//') factor)*
-factor: ('+'|'-'|'~') factor | power
-power: atom_expr ['**' factor]
-atom_expr: [AWAIT] atom trailer*
-atom: ('(' [yield_expr|testlist_comp] ')' |
-       '[' [testlist_comp] ']' |
-       '{' [dictorsetmaker] '}' |
-       NAME | NUMBER | STRING+ | '...' | 'None' | 'True' | 'False')
-testlist_comp: (namedexpr_test|star_expr) ( comp_for | (',' (namedexpr_test|star_expr))* [','] )
-trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME
-subscriptlist: subscript (',' subscript)* [',']
-subscript: test | [test] ':' [test] [sliceop]
-sliceop: ':' [test]
-exprlist: (expr|star_expr) (',' (expr|star_expr))* [',']
-testlist: test (',' test)* [',']
-dictorsetmaker: ( ((test ':' test | '**' expr)
-                   (comp_for | (',' (test ':' test | '**' expr))* [','])) |
-                  ((test | star_expr)
-                   (comp_for | (',' (test | star_expr))* [','])) )
-
-classdef: 'class' NAME ['(' [arglist] ')'] ':' suite
-
-arglist: argument (',' argument)*  [',']
-
-# The reason that keywords are test nodes instead of NAME is that using NAME
-# results in an ambiguity. ast.c makes sure it's a NAME.
-# "test '=' test" is really "keyword '=' test", but we have no such token.
-# These need to be in a single rule to avoid grammar that is ambiguous
-# to our LL(1) parser. Even though 'test' includes '*expr' in star_expr,
-# we explicitly match '*' here, too, to give it proper precedence.
-# Illegal combinations and orderings are blocked in ast.c:
-# multiple (test comp_for) arguments are blocked; keyword unpackings
-# that precede iterable unpackings are blocked; etc.
-argument: ( test [comp_for] |
-            test ':=' test |
-            test '=' test |
-            '**' test |
-            '*' test )
-
-comp_iter: comp_for | comp_if
-sync_comp_for: 'for' exprlist 'in' or_test [comp_iter]
-comp_for: [ASYNC] sync_comp_for
-comp_if: 'if' test_nocond [comp_iter]
-
-# not used in grammar, but may appear in "node" passed from Parser to Compiler
-encoding_decl: NAME
-
-yield_expr: 'yield' [yield_arg]
-yield_arg: 'from' test | testlist_star_expr
-
-# the TYPE_COMMENT in suites is only parsed for funcdefs,
-# but can't go elsewhere due to ambiguity
-func_body_suite: simple_stmt | NEWLINE [TYPE_COMMENT NEWLINE] INDENT stmt+ DEDENT
-
-func_type_input: func_type NEWLINE* ENDMARKER
-func_type: '(' [typelist] ')' '->' test
-# typelist is a modified typedargslist (see above)
-typelist: (test (',' test)* [','
-       ['*' [test] (',' test)* [',' '**' test] | '**' test]]
-     |  '*' [test] (',' test)* [',' '**' test] | '**' test)
diff --git a/Grammar/Tokens b/Grammar/Tokens
index 9de2da5..1f3e3b0 100644
--- a/Grammar/Tokens
+++ b/Grammar/Tokens
@@ -59,6 +59,7 @@
 ASYNC
 TYPE_IGNORE
 TYPE_COMMENT
+SOFT_KEYWORD
 ERRORTOKEN
 
 # These aren't used by the C tokenizer but are needed for tokenize.py
diff --git a/Grammar/python.gram b/Grammar/python.gram
index ce78397..99e0135 100644
--- a/Grammar/python.gram
+++ b/Grammar/python.gram
@@ -7,6 +7,7 @@
     // Initialize keywords
     p->keywords = reserved_keywords;
     p->n_keyword_lists = n_keyword_lists;
+    p->soft_keywords = soft_keywords;
 
     // Run parser
     void *result = NULL;
@@ -28,47 +29,53 @@
 // The end
 '''
 file[mod_ty]: a=[statements] ENDMARKER { _PyPegen_make_module(p, a) }
-interactive[mod_ty]: a=statement_newline { Interactive(a, p->arena) }
-eval[mod_ty]: a=expressions NEWLINE* ENDMARKER { Expression(a, p->arena) }
-func_type[mod_ty]: '(' a=[type_expressions] ')' '->' b=expression NEWLINE* ENDMARKER { FunctionType(a, b, p->arena) }
+interactive[mod_ty]: a=statement_newline { _PyAST_Interactive(a, p->arena) }
+eval[mod_ty]: a=expressions NEWLINE* ENDMARKER { _PyAST_Expression(a, p->arena) }
+func_type[mod_ty]: '(' a=[type_expressions] ')' '->' b=expression NEWLINE* ENDMARKER { _PyAST_FunctionType(a, b, p->arena) }
 fstring[expr_ty]: star_expressions
 
 # type_expressions allow */** but ignore them
-type_expressions[asdl_seq*]:
+type_expressions[asdl_expr_seq*]:
     | a=','.expression+ ',' '*' b=expression ',' '**' c=expression {
-        _PyPegen_seq_append_to_end(p, CHECK(_PyPegen_seq_append_to_end(p, a, b)), c) }
-    | a=','.expression+ ',' '*' b=expression { _PyPegen_seq_append_to_end(p, a, b) }
-    | a=','.expression+ ',' '**' b=expression { _PyPegen_seq_append_to_end(p, a, b) }
+        (asdl_expr_seq*)_PyPegen_seq_append_to_end(
+            p,
+            CHECK(asdl_seq*, _PyPegen_seq_append_to_end(p, a, b)),
+            c) }
+    | a=','.expression+ ',' '*' b=expression { (asdl_expr_seq*)_PyPegen_seq_append_to_end(p, a, b) }
+    | a=','.expression+ ',' '**' b=expression { (asdl_expr_seq*)_PyPegen_seq_append_to_end(p, a, b) }
     | '*' a=expression ',' '**' b=expression {
-        _PyPegen_seq_append_to_end(p, CHECK(_PyPegen_singleton_seq(p, a)), b) }
-    | '*' a=expression { _PyPegen_singleton_seq(p, a) }
-    | '**' a=expression { _PyPegen_singleton_seq(p, a) }
-    | ','.expression+
+        (asdl_expr_seq*)_PyPegen_seq_append_to_end(
+            p,
+            CHECK(asdl_seq*, _PyPegen_singleton_seq(p, a)),
+            b) }
+    | '*' a=expression { (asdl_expr_seq*)_PyPegen_singleton_seq(p, a) }
+    | '**' a=expression { (asdl_expr_seq*)_PyPegen_singleton_seq(p, a) }
+    | a[asdl_expr_seq*]=','.expression+ {a}
 
-statements[asdl_seq*]: a=statement+ { _PyPegen_seq_flatten(p, a) }
-statement[asdl_seq*]: a=compound_stmt { _PyPegen_singleton_seq(p, a) } | simple_stmt
-statement_newline[asdl_seq*]:
-    | a=compound_stmt NEWLINE { _PyPegen_singleton_seq(p, a) }
-    | simple_stmt
-    | NEWLINE { _PyPegen_singleton_seq(p, CHECK(_Py_Pass(EXTRA))) }
+statements[asdl_stmt_seq*]: a=statement+ { (asdl_stmt_seq*)_PyPegen_seq_flatten(p, a) }
+statement[asdl_stmt_seq*]: a=compound_stmt { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, a) } | a[asdl_stmt_seq*]=simple_stmts { a }
+statement_newline[asdl_stmt_seq*]:
+    | a=compound_stmt NEWLINE { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, a) }
+    | simple_stmts
+    | NEWLINE { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, CHECK(stmt_ty, _PyAST_Pass(EXTRA))) }
     | ENDMARKER { _PyPegen_interactive_exit(p) }
-simple_stmt[asdl_seq*]:
-    | a=small_stmt !';' NEWLINE { _PyPegen_singleton_seq(p, a) } # Not needed, there for speedup
-    | a=';'.small_stmt+ [';'] NEWLINE { a }
+simple_stmts[asdl_stmt_seq*]:
+    | a=simple_stmt !';' NEWLINE { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, a) } # Not needed, there for speedup
+    | a[asdl_stmt_seq*]=';'.simple_stmt+ [';'] NEWLINE { a }
 # NOTE: assignment MUST precede expression, else parsing a simple assignment
 # will throw a SyntaxError.
-small_stmt[stmt_ty] (memo):
+simple_stmt[stmt_ty] (memo):
     | assignment
-    | e=star_expressions { _Py_Expr(e, EXTRA) }
+    | e=star_expressions { _PyAST_Expr(e, EXTRA) }
     | &'return' return_stmt
     | &('import' | 'from') import_stmt
     | &'raise' raise_stmt
-    | 'pass' { _Py_Pass(EXTRA) }
+    | 'pass' { _PyAST_Pass(EXTRA) }
     | &'del' del_stmt
     | &'yield' yield_stmt
     | &'assert' assert_stmt
-    | 'break' { _Py_Break(EXTRA) }
-    | 'continue' { _Py_Continue(EXTRA) }
+    | 'break' { _PyAST_Break(EXTRA) }
+    | 'continue' { _PyAST_Continue(EXTRA) }
     | &'global' global_stmt
     | &'nonlocal' nonlocal_stmt
 compound_stmt[stmt_ty]:
@@ -79,29 +86,31 @@
     | &('for' | ASYNC) for_stmt
     | &'try' try_stmt
     | &'while' while_stmt
+    | match_stmt
 
 # NOTE: annotated_rhs may start with 'yield'; yield_expr must start with 'yield'
 assignment[stmt_ty]:
     | a=NAME ':' b=expression c=['=' d=annotated_rhs { d }] {
         CHECK_VERSION(
+            stmt_ty,
             6,
             "Variable annotation syntax is",
-            _Py_AnnAssign(CHECK(_PyPegen_set_expr_context(p, a, Store)), b, c, 1, EXTRA)
+            _PyAST_AnnAssign(CHECK(expr_ty, _PyPegen_set_expr_context(p, a, Store)), b, c, 1, EXTRA)
         ) }
     | a=('(' b=single_target ')' { b }
          | single_subscript_attribute_target) ':' b=expression c=['=' d=annotated_rhs { d }] {
-        CHECK_VERSION(6, "Variable annotations syntax is", _Py_AnnAssign(a, b, c, 0, EXTRA)) }
-    | a=(z=star_targets '=' { z })+ b=(yield_expr | star_expressions) !'=' tc=[TYPE_COMMENT] {
-         _Py_Assign(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA) }
+        CHECK_VERSION(stmt_ty, 6, "Variable annotations syntax is", _PyAST_AnnAssign(a, b, c, 0, EXTRA)) }
+    | a[asdl_expr_seq*]=(z=star_targets '=' { z })+ b=(yield_expr | star_expressions) !'=' tc=[TYPE_COMMENT] {
+         _PyAST_Assign(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA) }
     | a=single_target b=augassign ~ c=(yield_expr | star_expressions) {
-         _Py_AugAssign(a, b->kind, c, EXTRA) }
+         _PyAST_AugAssign(a, b->kind, c, EXTRA) }
     | invalid_assignment
 
 augassign[AugOperator*]:
     | '+=' { _PyPegen_augoperator(p, Add) }
     | '-=' { _PyPegen_augoperator(p, Sub) }
     | '*=' { _PyPegen_augoperator(p, Mult) }
-    | '@=' { CHECK_VERSION(5, "The '@' operator is", _PyPegen_augoperator(p, MatMult)) }
+    | '@=' { CHECK_VERSION(AugOperator*, 5, "The '@' operator is", _PyPegen_augoperator(p, MatMult)) }
     | '/=' { _PyPegen_augoperator(p, Div) }
     | '%=' { _PyPegen_augoperator(p, Mod) }
     | '&=' { _PyPegen_augoperator(p, BitAnd) }
@@ -112,111 +121,297 @@
     | '**=' { _PyPegen_augoperator(p, Pow) }
     | '//=' { _PyPegen_augoperator(p, FloorDiv) }
 
-global_stmt[stmt_ty]: 'global' a=','.NAME+ {
-    _Py_Global(CHECK(_PyPegen_map_names_to_ids(p, a)), EXTRA) }
-nonlocal_stmt[stmt_ty]: 'nonlocal' a=','.NAME+ {
-    _Py_Nonlocal(CHECK(_PyPegen_map_names_to_ids(p, a)), EXTRA) }
+global_stmt[stmt_ty]: 'global' a[asdl_expr_seq*]=','.NAME+ {
+    _PyAST_Global(CHECK(asdl_identifier_seq*, _PyPegen_map_names_to_ids(p, a)), EXTRA) }
+nonlocal_stmt[stmt_ty]: 'nonlocal' a[asdl_expr_seq*]=','.NAME+ {
+    _PyAST_Nonlocal(CHECK(asdl_identifier_seq*, _PyPegen_map_names_to_ids(p, a)), EXTRA) }
 
-yield_stmt[stmt_ty]: y=yield_expr { _Py_Expr(y, EXTRA) }
+yield_stmt[stmt_ty]: y=yield_expr { _PyAST_Expr(y, EXTRA) }
 
-assert_stmt[stmt_ty]: 'assert' a=expression b=[',' z=expression { z }] { _Py_Assert(a, b, EXTRA) }
+assert_stmt[stmt_ty]: 'assert' a=expression b=[',' z=expression { z }] { _PyAST_Assert(a, b, EXTRA) }
 
 del_stmt[stmt_ty]:
-    | 'del' a=del_targets &(';' | NEWLINE) { _Py_Delete(a, EXTRA) }
+    | 'del' a=del_targets &(';' | NEWLINE) { _PyAST_Delete(a, EXTRA) }
     | invalid_del_stmt
 
 import_stmt[stmt_ty]: import_name | import_from
-import_name[stmt_ty]: 'import' a=dotted_as_names { _Py_Import(a, EXTRA) }
+import_name[stmt_ty]: 'import' a=dotted_as_names { _PyAST_Import(a, EXTRA) }
 # note below: the ('.' | '...') is necessary because '...' is tokenized as ELLIPSIS
 import_from[stmt_ty]:
     | 'from' a=('.' | '...')* b=dotted_name 'import' c=import_from_targets {
-        _Py_ImportFrom(b->v.Name.id, c, _PyPegen_seq_count_dots(a), EXTRA) }
+        _PyAST_ImportFrom(b->v.Name.id, c, _PyPegen_seq_count_dots(a), EXTRA) }
     | 'from' a=('.' | '...')+ 'import' b=import_from_targets {
-        _Py_ImportFrom(NULL, b, _PyPegen_seq_count_dots(a), EXTRA) }
-import_from_targets[asdl_seq*]:
+        _PyAST_ImportFrom(NULL, b, _PyPegen_seq_count_dots(a), EXTRA) }
+import_from_targets[asdl_alias_seq*]:
     | '(' a=import_from_as_names [','] ')' { a }
     | import_from_as_names !','
-    | '*' { _PyPegen_singleton_seq(p, CHECK(_PyPegen_alias_for_star(p))) }
+    | '*' { (asdl_alias_seq*)_PyPegen_singleton_seq(p, CHECK(alias_ty, _PyPegen_alias_for_star(p, EXTRA))) }
     | invalid_import_from_targets
-import_from_as_names[asdl_seq*]:
-    | a=','.import_from_as_name+ { a }
+import_from_as_names[asdl_alias_seq*]:
+    | a[asdl_alias_seq*]=','.import_from_as_name+ { a }
 import_from_as_name[alias_ty]:
-    | a=NAME b=['as' z=NAME { z }] { _Py_alias(a->v.Name.id,
+    | a=NAME b=['as' z=NAME { z }] { _PyAST_alias(a->v.Name.id,
                                                (b) ? ((expr_ty) b)->v.Name.id : NULL,
-                                               p->arena) }
-dotted_as_names[asdl_seq*]:
-    | a=','.dotted_as_name+ { a }
+                                               EXTRA) }
+dotted_as_names[asdl_alias_seq*]:
+    | a[asdl_alias_seq*]=','.dotted_as_name+ { a }
 dotted_as_name[alias_ty]:
-    | a=dotted_name b=['as' z=NAME { z }] { _Py_alias(a->v.Name.id,
+    | a=dotted_name b=['as' z=NAME { z }] { _PyAST_alias(a->v.Name.id,
                                                       (b) ? ((expr_ty) b)->v.Name.id : NULL,
-                                                      p->arena) }
+                                                      EXTRA) }
 dotted_name[expr_ty]:
     | a=dotted_name '.' b=NAME { _PyPegen_join_names_with_dot(p, a, b) }
     | NAME
 
 if_stmt[stmt_ty]:
-    | 'if' a=named_expression ':' b=block c=elif_stmt { _Py_If(a, b, CHECK(_PyPegen_singleton_seq(p, c)), EXTRA) }
-    | 'if' a=named_expression ':' b=block c=[else_block] { _Py_If(a, b, c, EXTRA) }
+    | invalid_if_stmt
+    | 'if' a=named_expression ':' b=block c=elif_stmt {
+        _PyAST_If(a, b, CHECK(asdl_stmt_seq*, _PyPegen_singleton_seq(p, c)), EXTRA) }
+    | 'if' a=named_expression ':' b=block c=[else_block] { _PyAST_If(a, b, c, EXTRA) }
 elif_stmt[stmt_ty]:
-    | 'elif' a=named_expression ':' b=block c=elif_stmt { _Py_If(a, b, CHECK(_PyPegen_singleton_seq(p, c)), EXTRA) }
-    | 'elif' a=named_expression ':' b=block c=[else_block] { _Py_If(a, b, c, EXTRA) }
-else_block[asdl_seq*]: 'else' ':' b=block { b }
+    | invalid_elif_stmt
+    | 'elif' a=named_expression ':' b=block c=elif_stmt {
+        _PyAST_If(a, b, CHECK(asdl_stmt_seq*, _PyPegen_singleton_seq(p, c)), EXTRA) }
+    | 'elif' a=named_expression ':' b=block c=[else_block] { _PyAST_If(a, b, c, EXTRA) }
+else_block[asdl_stmt_seq*]:
+    | invalid_else_stmt
+    | 'else' &&':' b=block { b }
 
 while_stmt[stmt_ty]:
-    | 'while' a=named_expression ':' b=block c=[else_block] { _Py_While(a, b, c, EXTRA) }
+    | invalid_while_stmt
+    | 'while' a=named_expression ':' b=block c=[else_block] { _PyAST_While(a, b, c, EXTRA) }
 
 for_stmt[stmt_ty]:
-    | 'for' t=star_targets 'in' ~ ex=star_expressions ':' tc=[TYPE_COMMENT] b=block el=[else_block] {
-        _Py_For(t, ex, b, el, NEW_TYPE_COMMENT(p, tc), EXTRA) }
-    | ASYNC 'for' t=star_targets 'in' ~ ex=star_expressions ':' tc=[TYPE_COMMENT] b=block el=[else_block] {
-        CHECK_VERSION(5, "Async for loops are", _Py_AsyncFor(t, ex, b, el, NEW_TYPE_COMMENT(p, tc), EXTRA)) }
+    | invalid_for_stmt
+    | 'for' t=star_targets 'in' ~ ex=star_expressions &&':' tc=[TYPE_COMMENT] b=block el=[else_block] {
+        _PyAST_For(t, ex, b, el, NEW_TYPE_COMMENT(p, tc), EXTRA) }
+    | ASYNC 'for' t=star_targets 'in' ~ ex=star_expressions &&':' tc=[TYPE_COMMENT] b=block el=[else_block] {
+        CHECK_VERSION(stmt_ty, 5, "Async for loops are", _PyAST_AsyncFor(t, ex, b, el, NEW_TYPE_COMMENT(p, tc), EXTRA)) }
     | invalid_for_target
 
 with_stmt[stmt_ty]:
-    | 'with' '(' a=','.with_item+ ','? ')' ':' b=block {
-        _Py_With(a, b, NULL, EXTRA) }
-    | 'with' a=','.with_item+ ':' tc=[TYPE_COMMENT] b=block {
-        _Py_With(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA) }
-    | ASYNC 'with' '(' a=','.with_item+ ','? ')' ':' b=block {
-       CHECK_VERSION(5, "Async with statements are", _Py_AsyncWith(a, b, NULL, EXTRA)) }
-    | ASYNC 'with' a=','.with_item+ ':' tc=[TYPE_COMMENT] b=block {
-       CHECK_VERSION(5, "Async with statements are", _Py_AsyncWith(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA)) }
+    | invalid_with_stmt_indent
+    | 'with' '(' a[asdl_withitem_seq*]=','.with_item+ ','? ')' ':' b=block {
+        _PyAST_With(a, b, NULL, EXTRA) }
+    | 'with' a[asdl_withitem_seq*]=','.with_item+ ':' tc=[TYPE_COMMENT] b=block {
+        _PyAST_With(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA) }
+    | ASYNC 'with' '(' a[asdl_withitem_seq*]=','.with_item+ ','? ')' ':' b=block {
+       CHECK_VERSION(stmt_ty, 5, "Async with statements are", _PyAST_AsyncWith(a, b, NULL, EXTRA)) }
+    | ASYNC 'with' a[asdl_withitem_seq*]=','.with_item+ ':' tc=[TYPE_COMMENT] b=block {
+       CHECK_VERSION(stmt_ty, 5, "Async with statements are", _PyAST_AsyncWith(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA)) }
+    | invalid_with_stmt
+
 with_item[withitem_ty]:
-    | e=expression 'as' t=star_target &(',' | ')' | ':') { _Py_withitem(e, t, p->arena) }
+    | e=expression 'as' t=star_target &(',' | ')' | ':') { _PyAST_withitem(e, t, p->arena) }
     | invalid_with_item
-    | e=expression { _Py_withitem(e, NULL, p->arena) }
+    | e=expression { _PyAST_withitem(e, NULL, p->arena) }
 
 try_stmt[stmt_ty]:
-    | 'try' ':' b=block f=finally_block { _Py_Try(b, NULL, NULL, f, EXTRA) }
-    | 'try' ':' b=block ex=except_block+ el=[else_block] f=[finally_block] { _Py_Try(b, ex, el, f, EXTRA) }
+    | invalid_try_stmt
+    | 'try' &&':' b=block f=finally_block { _PyAST_Try(b, NULL, NULL, f, EXTRA) }
+    | 'try' &&':' b=block ex[asdl_excepthandler_seq*]=except_block+ el=[else_block] f=[finally_block] { _PyAST_Try(b, ex, el, f, EXTRA) }
 except_block[excepthandler_ty]:
+    | invalid_except_stmt_indent
     | 'except' e=expression t=['as' z=NAME { z }] ':' b=block {
-        _Py_ExceptHandler(e, (t) ? ((expr_ty) t)->v.Name.id : NULL, b, EXTRA) }
-    | 'except' ':' b=block { _Py_ExceptHandler(NULL, NULL, b, EXTRA) }
-finally_block[asdl_seq*]: 'finally' ':' a=block { a }
+        _PyAST_ExceptHandler(e, (t) ? ((expr_ty) t)->v.Name.id : NULL, b, EXTRA) }
+    | 'except' ':' b=block { _PyAST_ExceptHandler(NULL, NULL, b, EXTRA) }
+    | invalid_except_stmt
+finally_block[asdl_stmt_seq*]:
+    | invalid_finally_stmt
+    | 'finally' &&':' a=block { a }
+
+match_stmt[stmt_ty]:
+    | "match" subject=subject_expr ':' NEWLINE INDENT cases[asdl_match_case_seq*]=case_block+ DEDENT {
+        CHECK_VERSION(stmt_ty, 10, "Pattern matching is", _PyAST_Match(subject, cases, EXTRA)) }
+    | invalid_match_stmt
+subject_expr[expr_ty]:
+    | value=star_named_expression ',' values=star_named_expressions? {
+        _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, value, values)), Load, EXTRA) }
+    | named_expression
+case_block[match_case_ty]:
+    | invalid_case_block
+    | "case" pattern=patterns guard=guard? ':' body=block {
+        _PyAST_match_case(pattern, guard, body, p->arena) }
+guard[expr_ty]: 'if' guard=named_expression { guard }
+
+patterns[pattern_ty]:
+    | patterns[asdl_pattern_seq*]=open_sequence_pattern {
+        _PyAST_MatchSequence(patterns, EXTRA) }
+    | pattern
+pattern[pattern_ty]:
+    | as_pattern
+    | or_pattern
+as_pattern[pattern_ty]:
+    | pattern=or_pattern 'as' target=pattern_capture_target {
+        _PyAST_MatchAs(pattern, target->v.Name.id, EXTRA) }
+    | invalid_as_pattern
+or_pattern[pattern_ty]:
+    | patterns[asdl_pattern_seq*]='|'.closed_pattern+ {
+        asdl_seq_LEN(patterns) == 1 ? asdl_seq_GET(patterns, 0) : _PyAST_MatchOr(patterns, EXTRA) }
+closed_pattern[pattern_ty]:
+    | literal_pattern
+    | capture_pattern
+    | wildcard_pattern
+    | value_pattern
+    | group_pattern
+    | sequence_pattern
+    | mapping_pattern
+    | class_pattern
+
+# Literal patterns are used for equality and identity constraints
+literal_pattern[pattern_ty]:
+    | value=signed_number !('+' | '-') { _PyAST_MatchValue(value, EXTRA) }
+    | value=complex_number { _PyAST_MatchValue(value, EXTRA) }
+    | value=strings { _PyAST_MatchValue(value, EXTRA) }
+    | 'None' { _PyAST_MatchSingleton(Py_None, EXTRA) }
+    | 'True' { _PyAST_MatchSingleton(Py_True, EXTRA) }
+    | 'False' { _PyAST_MatchSingleton(Py_False, EXTRA) }
+
+# Literal expressions are used to restrict permitted mapping pattern keys
+literal_expr[expr_ty]:
+    | signed_number !('+' | '-')
+    | complex_number
+    | strings
+    | 'None' { _PyAST_Constant(Py_None, NULL, EXTRA) }
+    | 'True' { _PyAST_Constant(Py_True, NULL, EXTRA) }
+    | 'False' { _PyAST_Constant(Py_False, NULL, EXTRA) }
+
+complex_number[expr_ty]:
+    | real=signed_real_number '+' imag=imaginary_number {
+        _PyAST_BinOp(real, Add, imag, EXTRA) }
+    | real=signed_real_number '-' imag=imaginary_number  {
+        _PyAST_BinOp(real, Sub, imag, EXTRA) }
+
+signed_number[expr_ty]:
+    | NUMBER
+    | '-' number=NUMBER { _PyAST_UnaryOp(USub, number, EXTRA) }
+
+signed_real_number[expr_ty]:
+    | real_number
+    | '-' real=real_number { _PyAST_UnaryOp(USub, real, EXTRA) }
+
+real_number[expr_ty]:
+    | real=NUMBER { _PyPegen_ensure_real(p, real) }
+
+imaginary_number[expr_ty]:
+    | imag=NUMBER { _PyPegen_ensure_imaginary(p, imag) }
+
+capture_pattern[pattern_ty]:
+    | target=pattern_capture_target { _PyAST_MatchAs(NULL, target->v.Name.id, EXTRA) }
+
+pattern_capture_target[expr_ty]:
+    | !"_" name=NAME !('.' | '(' | '=') {
+        _PyPegen_set_expr_context(p, name, Store) }
+
+wildcard_pattern[pattern_ty]:
+    | "_" { _PyAST_MatchAs(NULL, NULL, EXTRA) }
+
+value_pattern[pattern_ty]:
+    | attr=attr !('.' | '(' | '=') { _PyAST_MatchValue(attr, EXTRA) }
+attr[expr_ty]:
+    | value=name_or_attr '.' attr=NAME {
+        _PyAST_Attribute(value, attr->v.Name.id, Load, EXTRA) }
+name_or_attr[expr_ty]:
+    | attr
+    | NAME
+
+group_pattern[pattern_ty]:
+    | '(' pattern=pattern ')' { pattern }
+
+sequence_pattern[pattern_ty]:
+    | '[' patterns=maybe_sequence_pattern? ']' { _PyAST_MatchSequence(patterns, EXTRA) }
+    | '(' patterns=open_sequence_pattern? ')' { _PyAST_MatchSequence(patterns, EXTRA) }
+open_sequence_pattern[asdl_seq*]:
+    | pattern=maybe_star_pattern ',' patterns=maybe_sequence_pattern? {
+        _PyPegen_seq_insert_in_front(p, pattern, patterns) }
+maybe_sequence_pattern[asdl_seq*]:
+    | patterns=','.maybe_star_pattern+ ','? { patterns }
+maybe_star_pattern[pattern_ty]:
+    | star_pattern
+    | pattern
+star_pattern[pattern_ty]:
+    | '*' target=pattern_capture_target {
+        _PyAST_MatchStar(target->v.Name.id, EXTRA) }
+    | '*' wildcard_pattern {
+        _PyAST_MatchStar(NULL, EXTRA) }
+
+mapping_pattern[pattern_ty]:
+    | '{' '}' {
+        _PyAST_MatchMapping(NULL, NULL, NULL, EXTRA) }
+    | '{' rest=double_star_pattern ','? '}' {
+        _PyAST_MatchMapping(NULL, NULL, rest->v.Name.id, EXTRA) }
+    | '{' items=items_pattern ',' rest=double_star_pattern ','? '}' {
+        _PyAST_MatchMapping(
+            CHECK(asdl_expr_seq*, _PyPegen_get_pattern_keys(p, items)),
+            CHECK(asdl_pattern_seq*, _PyPegen_get_patterns(p, items)),
+            rest->v.Name.id,
+            EXTRA) }
+    | '{' items=items_pattern ','? '}' {
+        _PyAST_MatchMapping(
+            CHECK(asdl_expr_seq*, _PyPegen_get_pattern_keys(p, items)),
+            CHECK(asdl_pattern_seq*, _PyPegen_get_patterns(p, items)),
+            NULL,
+            EXTRA) }
+items_pattern[asdl_seq*]:
+    | ','.key_value_pattern+
+key_value_pattern[KeyPatternPair*]:
+    | key=(literal_expr | attr) ':' pattern=pattern {
+        _PyPegen_key_pattern_pair(p, key, pattern) }
+double_star_pattern[expr_ty]:
+    | '**' target=pattern_capture_target { target }
+
+class_pattern[pattern_ty]:
+    | cls=name_or_attr '(' ')' {
+        _PyAST_MatchClass(cls, NULL, NULL, NULL, EXTRA) }
+    | cls=name_or_attr '(' patterns=positional_patterns ','? ')' {
+        _PyAST_MatchClass(cls, patterns, NULL, NULL, EXTRA) }
+    | cls=name_or_attr '(' keywords=keyword_patterns ','? ')' {
+        _PyAST_MatchClass(
+            cls, NULL,
+            CHECK(asdl_identifier_seq*, _PyPegen_map_names_to_ids(p,
+                CHECK(asdl_expr_seq*, _PyPegen_get_pattern_keys(p, keywords)))),
+            CHECK(asdl_pattern_seq*, _PyPegen_get_patterns(p, keywords)),
+            EXTRA) }
+    | cls=name_or_attr '(' patterns=positional_patterns ',' keywords=keyword_patterns ','? ')' {
+        _PyAST_MatchClass(
+            cls,
+            patterns,
+            CHECK(asdl_identifier_seq*, _PyPegen_map_names_to_ids(p,
+                CHECK(asdl_expr_seq*, _PyPegen_get_pattern_keys(p, keywords)))),
+            CHECK(asdl_pattern_seq*, _PyPegen_get_patterns(p, keywords)),
+            EXTRA) }
+    | invalid_class_pattern
+positional_patterns[asdl_pattern_seq*]:
+    | args[asdl_pattern_seq*]=','.pattern+ { args }
+keyword_patterns[asdl_seq*]:
+    | ','.keyword_pattern+
+keyword_pattern[KeyPatternPair*]:
+    | arg=NAME '=' value=pattern { _PyPegen_key_pattern_pair(p, arg, value) }
 
 return_stmt[stmt_ty]:
-    | 'return' a=[star_expressions] { _Py_Return(a, EXTRA) }
+    | 'return' a=[star_expressions] { _PyAST_Return(a, EXTRA) }
 
 raise_stmt[stmt_ty]:
-    | 'raise' a=expression b=['from' z=expression { z }] { _Py_Raise(a, b, EXTRA) }
-    | 'raise' { _Py_Raise(NULL, NULL, EXTRA) }
+    | 'raise' a=expression b=['from' z=expression { z }] { _PyAST_Raise(a, b, EXTRA) }
+    | 'raise' { _PyAST_Raise(NULL, NULL, EXTRA) }
 
 function_def[stmt_ty]:
     | d=decorators f=function_def_raw { _PyPegen_function_def_decorators(p, d, f) }
     | function_def_raw
 
 function_def_raw[stmt_ty]:
-    | 'def' n=NAME '(' params=[params] ')' a=['->' z=expression { z }] ':' tc=[func_type_comment] b=block {
-        _Py_FunctionDef(n->v.Name.id,
-                        (params) ? params : CHECK(_PyPegen_empty_arguments(p)),
+    | invalid_def_raw
+    | 'def' n=NAME '(' params=[params] ')' a=['->' z=expression { z }] &&':' tc=[func_type_comment] b=block {
+        _PyAST_FunctionDef(n->v.Name.id,
+                        (params) ? params : CHECK(arguments_ty, _PyPegen_empty_arguments(p)),
                         b, NULL, a, NEW_TYPE_COMMENT(p, tc), EXTRA) }
-    | ASYNC 'def' n=NAME '(' params=[params] ')' a=['->' z=expression { z }] ':' tc=[func_type_comment] b=block {
+    | ASYNC 'def' n=NAME '(' params=[params] ')' a=['->' z=expression { z }] &&':' tc=[func_type_comment] b=block {
         CHECK_VERSION(
+            stmt_ty,
             5,
             "Async functions are",
-            _Py_AsyncFunctionDef(n->v.Name.id,
-                            (params) ? params : CHECK(_PyPegen_empty_arguments(p)),
+            _PyAST_AsyncFunctionDef(n->v.Name.id,
+                            (params) ? params : CHECK(arguments_ty, _PyPegen_empty_arguments(p)),
                             b, NULL, a, NEW_TYPE_COMMENT(p, tc), EXTRA)
         ) }
 func_type_comment[Token*]:
@@ -229,11 +424,11 @@
     | parameters
 
 parameters[arguments_ty]:
-    | a=slash_no_default b=param_no_default* c=param_with_default* d=[star_etc] {
+    | a=slash_no_default b[asdl_arg_seq*]=param_no_default* c=param_with_default* d=[star_etc] {
         _PyPegen_make_arguments(p, a, NULL, b, c, d) }
     | a=slash_with_default b=param_with_default* c=[star_etc] {
         _PyPegen_make_arguments(p, NULL, a, NULL, b, c) }
-    | a=param_no_default+ b=param_with_default* c=[star_etc] {
+    | a[asdl_arg_seq*]=param_no_default+ b=param_with_default* c=[star_etc] {
         _PyPegen_make_arguments(p, NULL, NULL, a, b, c) }
     | a=param_with_default+ b=[star_etc] { _PyPegen_make_arguments(p, NULL, NULL, NULL, a, b)}
     | a=star_etc { _PyPegen_make_arguments(p, NULL, NULL, NULL, NULL, a) }
@@ -241,12 +436,12 @@
 # Some duplication here because we can't write (',' | &')'),
 # which is because we don't support empty alternatives (yet).
 #
-slash_no_default[asdl_seq*]:
-    | a=param_no_default+ '/' ',' { a }
-    | a=param_no_default+ '/' &')' { a }
+slash_no_default[asdl_arg_seq*]:
+    | a[asdl_arg_seq*]=param_no_default+ '/' ',' { a }
+    | a[asdl_arg_seq*]=param_no_default+ '/' &')' { a }
 slash_with_default[SlashWithDefault*]:
-    | a=param_no_default* b=param_with_default+ '/' ',' { _PyPegen_slash_with_default(p, a, b) }
-    | a=param_no_default* b=param_with_default+ '/' &')' { _PyPegen_slash_with_default(p, a, b) }
+    | a=param_no_default* b=param_with_default+ '/' ',' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }
+    | a=param_no_default* b=param_with_default+ '/' &')' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }
 
 star_etc[StarEtc*]:
     | '*' a=param_no_default b=param_maybe_default* c=[kwds] {
@@ -279,60 +474,69 @@
 param_maybe_default[NameDefaultPair*]:
     | a=param c=default? ',' tc=TYPE_COMMENT? { _PyPegen_name_default_pair(p, a, c, tc) }
     | a=param c=default? tc=TYPE_COMMENT? &')' { _PyPegen_name_default_pair(p, a, c, tc) }
-param[arg_ty]: a=NAME b=annotation? { _Py_arg(a->v.Name.id, b, NULL, EXTRA) }
+param[arg_ty]: a=NAME b=annotation? { _PyAST_arg(a->v.Name.id, b, NULL, EXTRA) }
 
 annotation[expr_ty]: ':' a=expression { a }
 default[expr_ty]: '=' a=expression { a }
 
-decorators[asdl_seq*]: a=('@' f=named_expression NEWLINE { f })+ { a }
+decorators[asdl_expr_seq*]: a[asdl_expr_seq*]=('@' f=named_expression NEWLINE { f })+ { a }
 
 class_def[stmt_ty]:
     | a=decorators b=class_def_raw { _PyPegen_class_def_decorators(p, a, b) }
     | class_def_raw
 class_def_raw[stmt_ty]:
-    | 'class' a=NAME b=['(' z=[arguments] ')' { z }] ':' c=block {
-        _Py_ClassDef(a->v.Name.id,
+    | invalid_class_def_raw
+    | 'class' a=NAME b=['(' z=[arguments] ')' { z }] &&':' c=block {
+        _PyAST_ClassDef(a->v.Name.id,
                      (b) ? ((expr_ty) b)->v.Call.args : NULL,
                      (b) ? ((expr_ty) b)->v.Call.keywords : NULL,
                      c, NULL, EXTRA) }
 
-block[asdl_seq*] (memo):
+block[asdl_stmt_seq*] (memo):
     | NEWLINE INDENT a=statements DEDENT { a }
-    | simple_stmt
+    | simple_stmts
     | invalid_block
 
 star_expressions[expr_ty]:
     | a=star_expression b=(',' c=star_expression { c })+ [','] {
-        _Py_Tuple(CHECK(_PyPegen_seq_insert_in_front(p, a, b)), Load, EXTRA) }
-    | a=star_expression ',' { _Py_Tuple(CHECK(_PyPegen_singleton_seq(p, a)), Load, EXTRA) }
+        _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, a, b)), Load, EXTRA) }
+    | a=star_expression ',' { _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_singleton_seq(p, a)), Load, EXTRA) }
     | star_expression
 star_expression[expr_ty] (memo):
-    | '*' a=bitwise_or { _Py_Starred(a, Load, EXTRA) }
+    | '*' a=bitwise_or { _PyAST_Starred(a, Load, EXTRA) }
     | expression
 
-star_named_expressions[asdl_seq*]: a=','.star_named_expression+ [','] { a }
+star_named_expressions[asdl_expr_seq*]: a[asdl_expr_seq*]=','.star_named_expression+ [','] { a }
 star_named_expression[expr_ty]:
-    | '*' a=bitwise_or { _Py_Starred(a, Load, EXTRA) }
+    | '*' a=bitwise_or { _PyAST_Starred(a, Load, EXTRA) }
     | named_expression
+
+
+assignment_expression[expr_ty]:
+    | a=NAME ':=' ~ b=expression { _PyAST_NamedExpr(CHECK(expr_ty, _PyPegen_set_expr_context(p, a, Store)), b, EXTRA) }
+
 named_expression[expr_ty]:
-    | a=NAME ':=' ~ b=expression { _Py_NamedExpr(CHECK(_PyPegen_set_expr_context(p, a, Store)), b, EXTRA) }
-    | expression !':='
+    | assignment_expression
     | invalid_named_expression
+    | expression !':='
 
 annotated_rhs[expr_ty]: yield_expr | star_expressions
 
 expressions[expr_ty]:
     | a=expression b=(',' c=expression { c })+ [','] {
-        _Py_Tuple(CHECK(_PyPegen_seq_insert_in_front(p, a, b)), Load, EXTRA) }
-    | a=expression ',' { _Py_Tuple(CHECK(_PyPegen_singleton_seq(p, a)), Load, EXTRA) }
+        _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, a, b)), Load, EXTRA) }
+    | a=expression ',' { _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_singleton_seq(p, a)), Load, EXTRA) }
     | expression
 expression[expr_ty] (memo):
-    | a=disjunction 'if' b=disjunction 'else' c=expression { _Py_IfExp(b, a, c, EXTRA) }
+    | invalid_expression
+    | invalid_legacy_expression
+    | a=disjunction 'if' b=disjunction 'else' c=expression { _PyAST_IfExp(b, a, c, EXTRA) }
     | disjunction
     | lambdef
 
 lambdef[expr_ty]:
-    | 'lambda' a=[lambda_params] ':' b=expression { _Py_Lambda((a) ? a : CHECK(_PyPegen_empty_arguments(p)), b, EXTRA) }
+    | 'lambda' a=[lambda_params] ':' b=expression {
+        _PyAST_Lambda((a) ? a : CHECK(arguments_ty, _PyPegen_empty_arguments(p)), b, EXTRA) }
 
 lambda_params[arguments_ty]:
     | invalid_lambda_parameters
@@ -343,21 +547,21 @@
 # a colon, not a close parenthesis.  (For more, see parameters above.)
 #
 lambda_parameters[arguments_ty]:
-    | a=lambda_slash_no_default b=lambda_param_no_default* c=lambda_param_with_default* d=[lambda_star_etc] {
+    | a=lambda_slash_no_default b[asdl_arg_seq*]=lambda_param_no_default* c=lambda_param_with_default* d=[lambda_star_etc] {
         _PyPegen_make_arguments(p, a, NULL, b, c, d) }
     | a=lambda_slash_with_default b=lambda_param_with_default* c=[lambda_star_etc] {
         _PyPegen_make_arguments(p, NULL, a, NULL, b, c) }
-    | a=lambda_param_no_default+ b=lambda_param_with_default* c=[lambda_star_etc] {
+    | a[asdl_arg_seq*]=lambda_param_no_default+ b=lambda_param_with_default* c=[lambda_star_etc] {
         _PyPegen_make_arguments(p, NULL, NULL, a, b, c) }
     | a=lambda_param_with_default+ b=[lambda_star_etc] { _PyPegen_make_arguments(p, NULL, NULL, NULL, a, b)}
     | a=lambda_star_etc { _PyPegen_make_arguments(p, NULL, NULL, NULL, NULL, a) }
 
-lambda_slash_no_default[asdl_seq*]:
-    | a=lambda_param_no_default+ '/' ',' { a }
-    | a=lambda_param_no_default+ '/' &':' { a }
+lambda_slash_no_default[asdl_arg_seq*]:
+    | a[asdl_arg_seq*]=lambda_param_no_default+ '/' ',' { a }
+    | a[asdl_arg_seq*]=lambda_param_no_default+ '/' &':' { a }
 lambda_slash_with_default[SlashWithDefault*]:
-    | a=lambda_param_no_default* b=lambda_param_with_default+ '/' ',' { _PyPegen_slash_with_default(p, a, b) }
-    | a=lambda_param_no_default* b=lambda_param_with_default+ '/' &':' { _PyPegen_slash_with_default(p, a, b) }
+    | a=lambda_param_no_default* b=lambda_param_with_default+ '/' ',' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }
+    | a=lambda_param_no_default* b=lambda_param_with_default+ '/' &':' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }
 
 lambda_star_etc[StarEtc*]:
     | '*' a=lambda_param_no_default b=lambda_param_maybe_default* c=[lambda_kwds] {
@@ -378,26 +582,30 @@
 lambda_param_maybe_default[NameDefaultPair*]:
     | a=lambda_param c=default? ',' { _PyPegen_name_default_pair(p, a, c, NULL) }
     | a=lambda_param c=default? &':' { _PyPegen_name_default_pair(p, a, c, NULL) }
-lambda_param[arg_ty]: a=NAME { _Py_arg(a->v.Name.id, NULL, NULL, EXTRA) }
+lambda_param[arg_ty]: a=NAME { _PyAST_arg(a->v.Name.id, NULL, NULL, EXTRA) }
 
 disjunction[expr_ty] (memo):
-    | a=conjunction b=('or' c=conjunction { c })+ { _Py_BoolOp(
+    | a=conjunction b=('or' c=conjunction { c })+ { _PyAST_BoolOp(
         Or,
-        CHECK(_PyPegen_seq_insert_in_front(p, a, b)),
+        CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, a, b)),
         EXTRA) }
     | conjunction
 conjunction[expr_ty] (memo):
-    | a=inversion b=('and' c=inversion { c })+ { _Py_BoolOp(
+    | a=inversion b=('and' c=inversion { c })+ { _PyAST_BoolOp(
         And,
-        CHECK(_PyPegen_seq_insert_in_front(p, a, b)),
+        CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, a, b)),
         EXTRA) }
     | inversion
 inversion[expr_ty] (memo):
-    | 'not' a=inversion { _Py_UnaryOp(Not, a, EXTRA) }
+    | 'not' a=inversion { _PyAST_UnaryOp(Not, a, EXTRA) }
     | comparison
 comparison[expr_ty]:
     | a=bitwise_or b=compare_op_bitwise_or_pair+ {
-        _Py_Compare(a, CHECK(_PyPegen_get_cmpops(p, b)), CHECK(_PyPegen_get_exprs(p, b)), EXTRA) }
+        _PyAST_Compare(
+            a,
+            CHECK(asdl_int_seq*, _PyPegen_get_cmpops(p, b)),
+            CHECK(asdl_expr_seq*, _PyPegen_get_exprs(p, b)),
+            EXTRA) }
     | bitwise_or
 compare_op_bitwise_or_pair[CmpopExprPair*]:
     | eq_bitwise_or
@@ -423,218 +631,249 @@
 is_bitwise_or[CmpopExprPair*]: 'is' a=bitwise_or { _PyPegen_cmpop_expr_pair(p, Is, a) }
 
 bitwise_or[expr_ty]:
-    | a=bitwise_or '|' b=bitwise_xor { _Py_BinOp(a, BitOr, b, EXTRA) }
+    | a=bitwise_or '|' b=bitwise_xor { _PyAST_BinOp(a, BitOr, b, EXTRA) }
     | bitwise_xor
 bitwise_xor[expr_ty]:
-    | a=bitwise_xor '^' b=bitwise_and { _Py_BinOp(a, BitXor, b, EXTRA) }
+    | a=bitwise_xor '^' b=bitwise_and { _PyAST_BinOp(a, BitXor, b, EXTRA) }
     | bitwise_and
 bitwise_and[expr_ty]:
-    | a=bitwise_and '&' b=shift_expr { _Py_BinOp(a, BitAnd, b, EXTRA) }
+    | a=bitwise_and '&' b=shift_expr { _PyAST_BinOp(a, BitAnd, b, EXTRA) }
     | shift_expr
 shift_expr[expr_ty]:
-    | a=shift_expr '<<' b=sum { _Py_BinOp(a, LShift, b, EXTRA) }
-    | a=shift_expr '>>' b=sum { _Py_BinOp(a, RShift, b, EXTRA) }
+    | a=shift_expr '<<' b=sum { _PyAST_BinOp(a, LShift, b, EXTRA) }
+    | a=shift_expr '>>' b=sum { _PyAST_BinOp(a, RShift, b, EXTRA) }
     | sum
 
 sum[expr_ty]:
-    | a=sum '+' b=term { _Py_BinOp(a, Add, b, EXTRA) }
-    | a=sum '-' b=term { _Py_BinOp(a, Sub, b, EXTRA) }
+    | a=sum '+' b=term { _PyAST_BinOp(a, Add, b, EXTRA) }
+    | a=sum '-' b=term { _PyAST_BinOp(a, Sub, b, EXTRA) }
     | term
 term[expr_ty]:
-    | a=term '*' b=factor { _Py_BinOp(a, Mult, b, EXTRA) }
-    | a=term '/' b=factor { _Py_BinOp(a, Div, b, EXTRA) }
-    | a=term '//' b=factor { _Py_BinOp(a, FloorDiv, b, EXTRA) }
-    | a=term '%' b=factor { _Py_BinOp(a, Mod, b, EXTRA) }
-    | a=term '@' b=factor { CHECK_VERSION(5, "The '@' operator is", _Py_BinOp(a, MatMult, b, EXTRA)) }
+    | a=term '*' b=factor { _PyAST_BinOp(a, Mult, b, EXTRA) }
+    | a=term '/' b=factor { _PyAST_BinOp(a, Div, b, EXTRA) }
+    | a=term '//' b=factor { _PyAST_BinOp(a, FloorDiv, b, EXTRA) }
+    | a=term '%' b=factor { _PyAST_BinOp(a, Mod, b, EXTRA) }
+    | a=term '@' b=factor { CHECK_VERSION(expr_ty, 5, "The '@' operator is", _PyAST_BinOp(a, MatMult, b, EXTRA)) }
     | factor
 factor[expr_ty] (memo):
-    | '+' a=factor { _Py_UnaryOp(UAdd, a, EXTRA) }
-    | '-' a=factor { _Py_UnaryOp(USub, a, EXTRA) }
-    | '~' a=factor { _Py_UnaryOp(Invert, a, EXTRA) }
+    | '+' a=factor { _PyAST_UnaryOp(UAdd, a, EXTRA) }
+    | '-' a=factor { _PyAST_UnaryOp(USub, a, EXTRA) }
+    | '~' a=factor { _PyAST_UnaryOp(Invert, a, EXTRA) }
     | power
 power[expr_ty]:
-    | a=await_primary '**' b=factor { _Py_BinOp(a, Pow, b, EXTRA) }
+    | a=await_primary '**' b=factor { _PyAST_BinOp(a, Pow, b, EXTRA) }
     | await_primary
 await_primary[expr_ty] (memo):
-    | AWAIT a=primary { CHECK_VERSION(5, "Await expressions are", _Py_Await(a, EXTRA)) }
+    | AWAIT a=primary { CHECK_VERSION(expr_ty, 5, "Await expressions are", _PyAST_Await(a, EXTRA)) }
     | primary
 primary[expr_ty]:
-    | invalid_primary  # must be before 'primay genexp' because of invalid_genexp
-    | a=primary '.' b=NAME { _Py_Attribute(a, b->v.Name.id, Load, EXTRA) }
-    | a=primary b=genexp { _Py_Call(a, CHECK(_PyPegen_singleton_seq(p, b)), NULL, EXTRA) }
+    | a=primary '.' b=NAME { _PyAST_Attribute(a, b->v.Name.id, Load, EXTRA) }
+    | a=primary b=genexp { _PyAST_Call(a, CHECK(asdl_expr_seq*, (asdl_expr_seq*)_PyPegen_singleton_seq(p, b)), NULL, EXTRA) }
     | a=primary '(' b=[arguments] ')' {
-        _Py_Call(a,
+        _PyAST_Call(a,
                  (b) ? ((expr_ty) b)->v.Call.args : NULL,
                  (b) ? ((expr_ty) b)->v.Call.keywords : NULL,
                  EXTRA) }
-    | a=primary '[' b=slices ']' { _Py_Subscript(a, b, Load, EXTRA) }
+    | a=primary '[' b=slices ']' { _PyAST_Subscript(a, b, Load, EXTRA) }
     | atom
 
 slices[expr_ty]:
     | a=slice !',' { a }
-    | a=','.slice+ [','] { _Py_Tuple(a, Load, EXTRA) }
+    | a[asdl_expr_seq*]=','.slice+ [','] { _PyAST_Tuple(a, Load, EXTRA) }
 slice[expr_ty]:
-    | a=[expression] ':' b=[expression] c=[':' d=[expression] { d }] { _Py_Slice(a, b, c, EXTRA) }
-    | a=expression { a }
+    | a=[expression] ':' b=[expression] c=[':' d=[expression] { d }] { _PyAST_Slice(a, b, c, EXTRA) }
+    | a=named_expression { a }
 atom[expr_ty]:
     | NAME
-    | 'True' { _Py_Constant(Py_True, NULL, EXTRA) }
-    | 'False' { _Py_Constant(Py_False, NULL, EXTRA) }
-    | 'None' { _Py_Constant(Py_None, NULL, EXTRA) }
-    | '__peg_parser__' { RAISE_SYNTAX_ERROR("You found it!") }
+    | 'True' { _PyAST_Constant(Py_True, NULL, EXTRA) }
+    | 'False' { _PyAST_Constant(Py_False, NULL, EXTRA) }
+    | 'None' { _PyAST_Constant(Py_None, NULL, EXTRA) }
     | &STRING strings
     | NUMBER
     | &'(' (tuple | group | genexp)
     | &'[' (list | listcomp)
     | &'{' (dict | set | dictcomp | setcomp)
-    | '...' { _Py_Constant(Py_Ellipsis, NULL, EXTRA) }
+    | '...' { _PyAST_Constant(Py_Ellipsis, NULL, EXTRA) }
 
 strings[expr_ty] (memo): a=STRING+ { _PyPegen_concatenate_strings(p, a) }
 list[expr_ty]:
-    | '[' a=[star_named_expressions] ']' { _Py_List(a, Load, EXTRA) }
+    | '[' a=[star_named_expressions] ']' { _PyAST_List(a, Load, EXTRA) }
 listcomp[expr_ty]:
-    | '[' a=named_expression ~ b=for_if_clauses ']' { _Py_ListComp(a, b, EXTRA) }
+    | '[' a=named_expression b=for_if_clauses ']' { _PyAST_ListComp(a, b, EXTRA) }
     | invalid_comprehension
 tuple[expr_ty]:
     | '(' a=[y=star_named_expression ',' z=[star_named_expressions] { _PyPegen_seq_insert_in_front(p, y, z) } ] ')' {
-        _Py_Tuple(a, Load, EXTRA) }
+        _PyAST_Tuple(a, Load, EXTRA) }
 group[expr_ty]:
     | '(' a=(yield_expr | named_expression) ')' { a }
     | invalid_group
 genexp[expr_ty]:
-    | '(' a=named_expression ~ b=for_if_clauses ')' { _Py_GeneratorExp(a, b, EXTRA) }
+    | '(' a=( assignment_expression | expression !':=') b=for_if_clauses ')' { _PyAST_GeneratorExp(a, b, EXTRA) }
     | invalid_comprehension
-set[expr_ty]: '{' a=star_named_expressions '}' { _Py_Set(a, EXTRA) }
+set[expr_ty]: '{' a=star_named_expressions '}' { _PyAST_Set(a, EXTRA) }
 setcomp[expr_ty]:
-    | '{' a=named_expression ~ b=for_if_clauses '}' { _Py_SetComp(a, b, EXTRA) }
+    | '{' a=named_expression b=for_if_clauses '}' { _PyAST_SetComp(a, b, EXTRA) }
     | invalid_comprehension
 dict[expr_ty]:
     | '{' a=[double_starred_kvpairs] '}' {
-        _Py_Dict(CHECK(_PyPegen_get_keys(p, a)), CHECK(_PyPegen_get_values(p, a)), EXTRA) }
+        _PyAST_Dict(
+            CHECK(asdl_expr_seq*, _PyPegen_get_keys(p, a)),
+            CHECK(asdl_expr_seq*, _PyPegen_get_values(p, a)),
+            EXTRA) }
+    | '{' invalid_double_starred_kvpairs '}'
+
 dictcomp[expr_ty]:
-    | '{' a=kvpair b=for_if_clauses '}' { _Py_DictComp(a->key, a->value, b, EXTRA) }
+    | '{' a=kvpair b=for_if_clauses '}' { _PyAST_DictComp(a->key, a->value, b, EXTRA) }
     | invalid_dict_comprehension
 double_starred_kvpairs[asdl_seq*]: a=','.double_starred_kvpair+ [','] { a }
 double_starred_kvpair[KeyValuePair*]:
     | '**' a=bitwise_or { _PyPegen_key_value_pair(p, NULL, a) }
     | kvpair
 kvpair[KeyValuePair*]: a=expression ':' b=expression { _PyPegen_key_value_pair(p, a, b) }
-for_if_clauses[asdl_seq*]:
-    | for_if_clause+
+for_if_clauses[asdl_comprehension_seq*]:
+    | a[asdl_comprehension_seq*]=for_if_clause+ { a }
 for_if_clause[comprehension_ty]:
-    | ASYNC 'for' a=star_targets 'in' ~ b=disjunction c=('if' z=disjunction { z })* {
-        CHECK_VERSION(6, "Async comprehensions are", _Py_comprehension(a, b, c, 1, p->arena)) }
-    | 'for' a=star_targets 'in' ~ b=disjunction c=('if' z=disjunction { z })* {
-        _Py_comprehension(a, b, c, 0, p->arena) }
+    | ASYNC 'for' a=star_targets 'in' ~ b=disjunction c[asdl_expr_seq*]=('if' z=disjunction { z })* {
+        CHECK_VERSION(comprehension_ty, 6, "Async comprehensions are", _PyAST_comprehension(a, b, c, 1, p->arena)) }
+    | 'for' a=star_targets 'in' ~ b=disjunction c[asdl_expr_seq*]=('if' z=disjunction { z })* {
+        _PyAST_comprehension(a, b, c, 0, p->arena) }
     | invalid_for_target
 
 yield_expr[expr_ty]:
-    | 'yield' 'from' a=expression { _Py_YieldFrom(a, EXTRA) }
-    | 'yield' a=[star_expressions] { _Py_Yield(a, EXTRA) }
+    | 'yield' 'from' a=expression { _PyAST_YieldFrom(a, EXTRA) }
+    | 'yield' a=[star_expressions] { _PyAST_Yield(a, EXTRA) }
 
 arguments[expr_ty] (memo):
     | a=args [','] &')' { a }
     | invalid_arguments
 args[expr_ty]:
-    | a=','.(starred_expression | named_expression !'=')+ b=[',' k=kwargs {k}] { _PyPegen_collect_call_seqs(p, a, b, EXTRA) }
-    | a=kwargs { _Py_Call(_PyPegen_dummy_name(p),
-                          CHECK_NULL_ALLOWED(_PyPegen_seq_extract_starred_exprs(p, a)),
-                          CHECK_NULL_ALLOWED(_PyPegen_seq_delete_starred_exprs(p, a)),
+    | a[asdl_expr_seq*]=','.(starred_expression | ( assignment_expression | expression !':=') !'=')+ b=[',' k=kwargs {k}] {
+        _PyPegen_collect_call_seqs(p, a, b, EXTRA) }
+    | a=kwargs { _PyAST_Call(_PyPegen_dummy_name(p),
+                          CHECK_NULL_ALLOWED(asdl_expr_seq*, _PyPegen_seq_extract_starred_exprs(p, a)),
+                          CHECK_NULL_ALLOWED(asdl_keyword_seq*, _PyPegen_seq_delete_starred_exprs(p, a)),
                           EXTRA) }
+
 kwargs[asdl_seq*]:
     | a=','.kwarg_or_starred+ ',' b=','.kwarg_or_double_starred+ { _PyPegen_join_sequences(p, a, b) }
     | ','.kwarg_or_starred+
     | ','.kwarg_or_double_starred+
 starred_expression[expr_ty]:
-    | '*' a=expression { _Py_Starred(a, Load, EXTRA) }
+    | '*' a=expression { _PyAST_Starred(a, Load, EXTRA) }
 kwarg_or_starred[KeywordOrStarred*]:
+    | invalid_kwarg
     | a=NAME '=' b=expression {
-        _PyPegen_keyword_or_starred(p, CHECK(_Py_keyword(a->v.Name.id, b, EXTRA)), 1) }
+        _PyPegen_keyword_or_starred(p, CHECK(keyword_ty, _PyAST_keyword(a->v.Name.id, b, EXTRA)), 1) }
     | a=starred_expression { _PyPegen_keyword_or_starred(p, a, 0) }
-    | invalid_kwarg
 kwarg_or_double_starred[KeywordOrStarred*]:
-    | a=NAME '=' b=expression {
-        _PyPegen_keyword_or_starred(p, CHECK(_Py_keyword(a->v.Name.id, b, EXTRA)), 1) }
-    | '**' a=expression { _PyPegen_keyword_or_starred(p, CHECK(_Py_keyword(NULL, a, EXTRA)), 1) }
     | invalid_kwarg
+    | a=NAME '=' b=expression {
+        _PyPegen_keyword_or_starred(p, CHECK(keyword_ty, _PyAST_keyword(a->v.Name.id, b, EXTRA)), 1) }
+    | '**' a=expression { _PyPegen_keyword_or_starred(p, CHECK(keyword_ty, _PyAST_keyword(NULL, a, EXTRA)), 1) }
 
 # NOTE: star_targets may contain *bitwise_or, targets may not.
 star_targets[expr_ty]:
     | a=star_target !',' { a }
     | a=star_target b=(',' c=star_target { c })* [','] {
-        _Py_Tuple(CHECK(_PyPegen_seq_insert_in_front(p, a, b)), Store, EXTRA) }
-star_targets_seq[asdl_seq*]: a=','.star_target+ [','] { a }
+        _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, a, b)), Store, EXTRA) }
+star_targets_list_seq[asdl_expr_seq*]: a[asdl_expr_seq*]=','.star_target+ [','] { a }
+star_targets_tuple_seq[asdl_expr_seq*]:
+    | a=star_target b=(',' c=star_target { c })+ [','] { (asdl_expr_seq*) _PyPegen_seq_insert_in_front(p, a, b) }
+    | a=star_target ',' { (asdl_expr_seq*) _PyPegen_singleton_seq(p, a) }
 star_target[expr_ty] (memo):
     | '*' a=(!'*' star_target) {
-        _Py_Starred(CHECK(_PyPegen_set_expr_context(p, a, Store)), Store, EXTRA) }
-    | a=t_primary '.' b=NAME !t_lookahead { _Py_Attribute(a, b->v.Name.id, Store, EXTRA) }
-    | a=t_primary '[' b=slices ']' !t_lookahead { _Py_Subscript(a, b, Store, EXTRA) }
+        _PyAST_Starred(CHECK(expr_ty, _PyPegen_set_expr_context(p, a, Store)), Store, EXTRA) }
+    | target_with_star_atom
+target_with_star_atom[expr_ty] (memo):
+    | a=t_primary '.' b=NAME !t_lookahead { _PyAST_Attribute(a, b->v.Name.id, Store, EXTRA) }
+    | a=t_primary '[' b=slices ']' !t_lookahead { _PyAST_Subscript(a, b, Store, EXTRA) }
     | star_atom
 star_atom[expr_ty]:
     | a=NAME { _PyPegen_set_expr_context(p, a, Store) }
-    | '(' a=star_target ')' { _PyPegen_set_expr_context(p, a, Store) }
-    | '(' a=[star_targets_seq] ')' { _Py_Tuple(a, Store, EXTRA) }
-    | '[' a=[star_targets_seq] ']' { _Py_List(a, Store, EXTRA) }
+    | '(' a=target_with_star_atom ')' { _PyPegen_set_expr_context(p, a, Store) }
+    | '(' a=[star_targets_tuple_seq] ')' { _PyAST_Tuple(a, Store, EXTRA) }
+    | '[' a=[star_targets_list_seq] ']' { _PyAST_List(a, Store, EXTRA) }
 
 single_target[expr_ty]:
     | single_subscript_attribute_target
     | a=NAME { _PyPegen_set_expr_context(p, a, Store) }
     | '(' a=single_target ')' { a }
 single_subscript_attribute_target[expr_ty]:
-    | a=t_primary '.' b=NAME !t_lookahead { _Py_Attribute(a, b->v.Name.id, Store, EXTRA) }
-    | a=t_primary '[' b=slices ']' !t_lookahead { _Py_Subscript(a, b, Store, EXTRA) }
+    | a=t_primary '.' b=NAME !t_lookahead { _PyAST_Attribute(a, b->v.Name.id, Store, EXTRA) }
+    | a=t_primary '[' b=slices ']' !t_lookahead { _PyAST_Subscript(a, b, Store, EXTRA) }
 
-del_targets[asdl_seq*]: a=','.del_target+ [','] { a }
+del_targets[asdl_expr_seq*]: a[asdl_expr_seq*]=','.del_target+ [','] { a }
 del_target[expr_ty] (memo):
-    | a=t_primary '.' b=NAME !t_lookahead { _Py_Attribute(a, b->v.Name.id, Del, EXTRA) }
-    | a=t_primary '[' b=slices ']' !t_lookahead { _Py_Subscript(a, b, Del, EXTRA) }
+    | a=t_primary '.' b=NAME !t_lookahead { _PyAST_Attribute(a, b->v.Name.id, Del, EXTRA) }
+    | a=t_primary '[' b=slices ']' !t_lookahead { _PyAST_Subscript(a, b, Del, EXTRA) }
     | del_t_atom
 del_t_atom[expr_ty]:
     | a=NAME { _PyPegen_set_expr_context(p, a, Del) }
     | '(' a=del_target ')' { _PyPegen_set_expr_context(p, a, Del) }
-    | '(' a=[del_targets] ')' { _Py_Tuple(a, Del, EXTRA) }
-    | '[' a=[del_targets] ']' { _Py_List(a, Del, EXTRA) }
+    | '(' a=[del_targets] ')' { _PyAST_Tuple(a, Del, EXTRA) }
+    | '[' a=[del_targets] ']' { _PyAST_List(a, Del, EXTRA) }
 
-targets[asdl_seq*]: a=','.target+ [','] { a }
-target[expr_ty] (memo):
-    | a=t_primary '.' b=NAME !t_lookahead { _Py_Attribute(a, b->v.Name.id, Store, EXTRA) }
-    | a=t_primary '[' b=slices ']' !t_lookahead { _Py_Subscript(a, b, Store, EXTRA) }
-    | t_atom
 t_primary[expr_ty]:
-    | a=t_primary '.' b=NAME &t_lookahead { _Py_Attribute(a, b->v.Name.id, Load, EXTRA) }
-    | a=t_primary '[' b=slices ']' &t_lookahead { _Py_Subscript(a, b, Load, EXTRA) }
-    | a=t_primary b=genexp &t_lookahead { _Py_Call(a, CHECK(_PyPegen_singleton_seq(p, b)), NULL, EXTRA) }
+    | a=t_primary '.' b=NAME &t_lookahead { _PyAST_Attribute(a, b->v.Name.id, Load, EXTRA) }
+    | a=t_primary '[' b=slices ']' &t_lookahead { _PyAST_Subscript(a, b, Load, EXTRA) }
+    | a=t_primary b=genexp &t_lookahead {
+        _PyAST_Call(a, CHECK(asdl_expr_seq*, (asdl_expr_seq*)_PyPegen_singleton_seq(p, b)), NULL, EXTRA) }
     | a=t_primary '(' b=[arguments] ')' &t_lookahead {
-        _Py_Call(a,
+        _PyAST_Call(a,
                  (b) ? ((expr_ty) b)->v.Call.args : NULL,
                  (b) ? ((expr_ty) b)->v.Call.keywords : NULL,
                  EXTRA) }
     | a=atom &t_lookahead { a }
 t_lookahead: '(' | '[' | '.'
-t_atom[expr_ty]:
-    | a=NAME { _PyPegen_set_expr_context(p, a, Store) }
-    | '(' a=target ')' { _PyPegen_set_expr_context(p, a, Store) }
-    | '(' b=[targets] ')' { _Py_Tuple(b, Store, EXTRA) }
-    | '[' b=[targets] ']' { _Py_List(b, Store, EXTRA) }
-
 
 # From here on, there are rules for invalid syntax with specialised error messages
 invalid_arguments:
-    | args ',' '*' { RAISE_SYNTAX_ERROR("iterable argument unpacking follows keyword argument unpacking") }
-    | a=expression for_if_clauses ',' [args | expression for_if_clauses] {
-        RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "Generator expression must be parenthesized") }
-    | a=args for_if_clauses { _PyPegen_nonparen_genexp_in_call(p, a) }
-    | args ',' a=expression for_if_clauses {
-        RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "Generator expression must be parenthesized") }
+    | a=args ',' '*' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "iterable argument unpacking follows keyword argument unpacking") }
+    | a=expression b=for_if_clauses ',' [args | expression for_if_clauses] {
+        RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, PyPegen_last_item(b, comprehension_ty)->target, "Generator expression must be parenthesized") }
+    | a=NAME b='=' expression for_if_clauses {
+        RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "invalid syntax. Maybe you meant '==' or ':=' instead of '='?")}
+    | a=args b=for_if_clauses { _PyPegen_nonparen_genexp_in_call(p, a, b) }
+    | args ',' a=expression b=for_if_clauses {
+        RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, asdl_seq_GET(b, b->size-1)->target, "Generator expression must be parenthesized") }
     | a=args ',' args { _PyPegen_arguments_parsing_error(p, a) }
 invalid_kwarg:
-    | a=expression '=' {
-        RAISE_SYNTAX_ERROR_KNOWN_LOCATION(
-            a, "expression cannot contain assignment, perhaps you meant \"==\"?") }
-invalid_named_expression:
+    | a[Token*]=('True'|'False'|'None') b='=' {
+        RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "cannot assign to %s", PyBytes_AS_STRING(a->bytes)) }
+    | a=NAME b='=' expression for_if_clauses {
+        RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "invalid syntax. Maybe you meant '==' or ':=' instead of '='?")}
+    | !(NAME '=') a=expression b='=' {
+        RAISE_SYNTAX_ERROR_KNOWN_RANGE(
+            a, b, "expression cannot contain assignment, perhaps you meant \"==\"?") }
+
+# IMPORTANT: Note that the "_without_invalid" suffix causes the rule to not call invalid rules under it
+expression_without_invalid[expr_ty]:
+    | a=disjunction 'if' b=disjunction 'else' c=expression { _PyAST_IfExp(b, a, c, EXTRA) }
+    | disjunction
+    | lambdef
+invalid_legacy_expression:
+    | a=NAME !'(' b=star_expressions {
+        _PyPegen_check_legacy_stmt(p, a) ? RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b,
+            "Missing parentheses in call to '%U'. Did you mean %U(...)?", a->v.Name.id, a->v.Name.id) : NULL}
+
+invalid_expression:
+    # !(NAME STRING) is not matched so we don't show this error with some invalid string prefixes like: kf"dsfsdf"
+    # Soft keywords need to also be ignored because they can be parsed as NAME NAME
+   | !(NAME STRING | SOFT_KEYWORD) a=disjunction b=expression_without_invalid {
+        _PyPegen_check_legacy_stmt(p, a) ? NULL : p->tokens[p->mark-1]->level == 0 ? NULL :
+        RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "invalid syntax. Perhaps you forgot a comma?") }
+   | a=disjunction 'if' b=disjunction !('else'|':') { RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "expected 'else' after 'if' expression") }
+
+invalid_named_expression(memo):
     | a=expression ':=' expression {
         RAISE_SYNTAX_ERROR_KNOWN_LOCATION(
             a, "cannot use assignment expressions with %s", _PyPegen_get_expr_name(a)) }
+    | a=NAME '=' b=bitwise_or !('='|':=') {
+        RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "invalid syntax. Maybe you meant '==' or ':=' instead of '='?") }
+    | !(list|tuple|genexp|'True'|'None'|'False') a=bitwise_or b='=' bitwise_or !('='|':=') {
+        RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "cannot assign to %s here. Maybe you meant '==' instead of '='?",
+                                          _PyPegen_get_expr_name(a)) }
+
 invalid_assignment:
     | a=invalid_ann_assign_target ':' expression {
         RAISE_SYNTAX_ERROR_KNOWN_LOCATION(
@@ -650,7 +889,7 @@
         RAISE_SYNTAX_ERROR_INVALID_TARGET(STAR_TARGETS, a) }
     | (star_targets '=')* a=yield_expr '=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "assignment to yield expression not possible") }
     | a=star_expressions augassign (yield_expr | star_expressions) {
-        RAISE_SYNTAX_ERROR_KNOWN_LOCATION( 
+        RAISE_SYNTAX_ERROR_KNOWN_LOCATION(
             a,
             "'%s' is an illegal expression for augmented assignment",
             _PyPegen_get_expr_name(a)
@@ -664,22 +903,31 @@
         RAISE_SYNTAX_ERROR_INVALID_TARGET(DEL_TARGETS, a) }
 invalid_block:
     | NEWLINE !INDENT { RAISE_INDENTATION_ERROR("expected an indented block") }
-invalid_primary:
-    | primary a='{' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "invalid syntax") }
 invalid_comprehension:
     | ('[' | '(' | '{') a=starred_expression for_if_clauses {
         RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "iterable unpacking cannot be used in comprehension") }
+    | ('[' | '{') a=star_named_expression ',' b=star_named_expressions for_if_clauses {
+        RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, PyPegen_last_item(b, expr_ty),
+        "did you forget parentheses around the comprehension target?") }
+    | ('[' | '{') a=star_named_expression b=',' for_if_clauses {
+        RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "did you forget parentheses around the comprehension target?") }
 invalid_dict_comprehension:
     | '{' a='**' bitwise_or for_if_clauses '}' {
         RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "dict unpacking cannot be used in dict comprehension") }
 invalid_parameters:
-    | param_no_default* (slash_with_default | param_with_default+) param_no_default {
-        RAISE_SYNTAX_ERROR("non-default argument follows default argument") }
+    | param_no_default* invalid_parameters_helper a=param_no_default {
+        RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "non-default argument follows default argument") }
+invalid_parameters_helper: # This is only there to avoid type errors
+    | a=slash_with_default { _PyPegen_singleton_seq(p, a) }
+    | param_with_default+
 invalid_lambda_parameters:
-    | lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default {
-        RAISE_SYNTAX_ERROR("non-default argument follows default argument") }
+    | lambda_param_no_default* invalid_lambda_parameters_helper a=lambda_param_no_default {
+        RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "non-default argument follows default argument") }
+invalid_lambda_parameters_helper:
+    | a=lambda_slash_with_default { _PyPegen_singleton_seq(p, a) }
+    | lambda_param_with_default+
 invalid_star_etc:
-    | '*' (')' | ',' (')' | '**')) { RAISE_SYNTAX_ERROR("named arguments must follow bare *") }
+    | a='*' (')' | ',' (')' | '**')) { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "named arguments must follow bare *") }
     | '*' ',' TYPE_COMMENT { RAISE_SYNTAX_ERROR("bare * has associated type comment") }
 invalid_lambda_star_etc:
     | '*' (':' | ',' (':' | '**')) { RAISE_SYNTAX_ERROR("named arguments must follow bare *") }
@@ -687,7 +935,7 @@
     | TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT {
         RAISE_SYNTAX_ERROR("Cannot have two type comments on def") }
 invalid_with_item:
-    | expression 'as' a=expression {
+    | expression 'as' a=expression &(',' | ')' | ':') {
         RAISE_SYNTAX_ERROR_INVALID_TARGET(STAR_TARGETS, a) }
 
 invalid_for_target:
@@ -696,7 +944,87 @@
 
 invalid_group:
     | '(' a=starred_expression ')' {
-        RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "can't use starred expression here") }
+        RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "cannot use starred expression here") }
+    | '(' a='**' expression ')' {
+        RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "cannot use double starred expression here") }
 invalid_import_from_targets:
-    | import_from_as_names ',' {
+    | import_from_as_names ',' NEWLINE {
         RAISE_SYNTAX_ERROR("trailing comma not allowed without surrounding parentheses") }
+
+invalid_with_stmt:
+    | [ASYNC] 'with' ','.(expression ['as' star_target])+ &&':'
+    | [ASYNC] 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' &&':'
+invalid_with_stmt_indent:
+    | [ASYNC] a='with' ','.(expression ['as' star_target])+ ':' NEWLINE !INDENT {
+        RAISE_INDENTATION_ERROR("expected an indented block after 'with' statement on line %d", a->lineno) }
+    | [ASYNC] a='with' '(' ','.(expressions ['as' star_target])+ ','? ')' ':' NEWLINE !INDENT {
+        RAISE_INDENTATION_ERROR("expected an indented block after 'with' statement on line %d", a->lineno) }
+
+invalid_try_stmt:
+    | a='try' ':' NEWLINE !INDENT {
+        RAISE_INDENTATION_ERROR("expected an indented block after 'try' statement on line %d", a->lineno) }
+    | 'try' ':' block !('except' | 'finally') { RAISE_SYNTAX_ERROR("expected 'except' or 'finally' block") }
+invalid_except_stmt:
+    | 'except' a=expression ',' expressions ['as' NAME ] ':' {
+        RAISE_SYNTAX_ERROR_STARTING_FROM(a, "multiple exception types must be parenthesized") }
+    | a='except' expression ['as' NAME ] NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }
+    | a='except' NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }
+invalid_finally_stmt:
+    | a='finally' ':' NEWLINE !INDENT {
+        RAISE_INDENTATION_ERROR("expected an indented block after 'finally' statement on line %d", a->lineno) }
+invalid_except_stmt_indent:
+    | a='except' expression ['as' NAME ] ':' NEWLINE !INDENT {
+        RAISE_INDENTATION_ERROR("expected an indented block after 'except' statement on line %d", a->lineno) }
+    | a='except' ':' NEWLINE !INDENT { RAISE_SYNTAX_ERROR("expected an indented block after except statement on line %d", a->lineno) }
+invalid_match_stmt:
+    | "match" subject_expr !':' { CHECK_VERSION(void*, 10, "Pattern matching is", RAISE_SYNTAX_ERROR("expected ':'") ) }
+    | a="match" subject=subject_expr ':' NEWLINE !INDENT {
+        RAISE_INDENTATION_ERROR("expected an indented block after 'match' statement on line %d", a->lineno) }
+invalid_case_block:
+    | "case" patterns guard? !':' { RAISE_SYNTAX_ERROR("expected ':'") }
+    | a="case" patterns guard? ':' NEWLINE !INDENT {
+        RAISE_INDENTATION_ERROR("expected an indented block after 'case' statement on line %d", a->lineno) }
+invalid_as_pattern:
+    | or_pattern 'as' a="_" { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "cannot use '_' as a target") }
+    | or_pattern 'as' !NAME a=expression { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "invalid pattern target") }
+invalid_class_pattern:
+    | name_or_attr '(' a=invalid_class_argument_pattern  { RAISE_SYNTAX_ERROR_KNOWN_RANGE(
+        PyPegen_first_item(a, pattern_ty),
+        PyPegen_last_item(a, pattern_ty),
+        "positional patterns follow keyword patterns") }
+invalid_class_argument_pattern[asdl_pattern_seq*]:
+    | [positional_patterns ','] keyword_patterns ',' a=positional_patterns { a }
+invalid_if_stmt:
+    | 'if' named_expression NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }
+    | a='if' a=named_expression ':' NEWLINE !INDENT {
+        RAISE_INDENTATION_ERROR("expected an indented block after 'if' statement on line %d", a->lineno) }
+invalid_elif_stmt:
+    | 'elif' named_expression NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }
+    | a='elif' named_expression ':' NEWLINE !INDENT {
+        RAISE_INDENTATION_ERROR("expected an indented block after 'elif' statement on line %d", a->lineno) }
+invalid_else_stmt:
+    | a='else' ':' NEWLINE !INDENT {
+        RAISE_INDENTATION_ERROR("expected an indented block after 'else' statement on line %d", a->lineno) }
+invalid_while_stmt:
+    | 'while' named_expression NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }
+    | a='while' named_expression ':' NEWLINE !INDENT {
+        RAISE_INDENTATION_ERROR("expected an indented block after 'while' statement on line %d", a->lineno) }
+invalid_for_stmt:
+    | [ASYNC] a='for' star_targets 'in' star_expressions ':' NEWLINE !INDENT {
+        RAISE_INDENTATION_ERROR("expected an indented block after 'for' statement on line %d", a->lineno) }
+invalid_def_raw:
+    | [ASYNC] a='def' NAME '(' [params] ')' ['->' expression] ':' NEWLINE !INDENT {
+        RAISE_INDENTATION_ERROR("expected an indented block after function definition on line %d", a->lineno) }
+invalid_class_def_raw:
+    | a='class' NAME ['('[arguments] ')'] ':' NEWLINE !INDENT {
+        RAISE_INDENTATION_ERROR("expected an indented block after class definition on line %d", a->lineno) }
+
+invalid_double_starred_kvpairs:
+    | ','.double_starred_kvpair+ ',' invalid_kvpair
+    | expression ':' a='*' bitwise_or { RAISE_SYNTAX_ERROR_STARTING_FROM(a, "cannot use a starred expression in a dictionary value") }
+    | expression a=':' &('}'|',') { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "expression expected after dictionary key and ':'") }
+invalid_kvpair:
+    | a=expression !(':') {
+        RAISE_ERROR_KNOWN_LOCATION(p, PyExc_SyntaxError, a->lineno, a->end_col_offset - 1, a->end_lineno, -1, "':' expected after dictionary key") }
+    | expression ':' a='*' bitwise_or { RAISE_SYNTAX_ERROR_STARTING_FROM(a, "cannot use a starred expression in a dictionary value") }
+    | expression a=':' {RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "expression expected after dictionary key and ':'") }
diff --git a/Include/Python-ast.h b/Include/Python-ast.h
deleted file mode 100644
index e7afa1e..0000000
--- a/Include/Python-ast.h
+++ /dev/null
@@ -1,697 +0,0 @@
-/* File automatically generated by Parser/asdl_c.py. */
-
-#ifndef Py_PYTHON_AST_H
-#define Py_PYTHON_AST_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef Py_LIMITED_API
-#include "asdl.h"
-
-#undef Yield   /* undefine macro conflicting with <winbase.h> */
-
-typedef struct _mod *mod_ty;
-
-typedef struct _stmt *stmt_ty;
-
-typedef struct _expr *expr_ty;
-
-typedef enum _expr_context { Load=1, Store=2, Del=3 } expr_context_ty;
-
-typedef enum _boolop { And=1, Or=2 } boolop_ty;
-
-typedef enum _operator { Add=1, Sub=2, Mult=3, MatMult=4, Div=5, Mod=6, Pow=7,
-                         LShift=8, RShift=9, BitOr=10, BitXor=11, BitAnd=12,
-                         FloorDiv=13 } operator_ty;
-
-typedef enum _unaryop { Invert=1, Not=2, UAdd=3, USub=4 } unaryop_ty;
-
-typedef enum _cmpop { Eq=1, NotEq=2, Lt=3, LtE=4, Gt=5, GtE=6, Is=7, IsNot=8,
-                      In=9, NotIn=10 } cmpop_ty;
-
-typedef struct _comprehension *comprehension_ty;
-
-typedef struct _excepthandler *excepthandler_ty;
-
-typedef struct _arguments *arguments_ty;
-
-typedef struct _arg *arg_ty;
-
-typedef struct _keyword *keyword_ty;
-
-typedef struct _alias *alias_ty;
-
-typedef struct _withitem *withitem_ty;
-
-typedef struct _type_ignore *type_ignore_ty;
-
-
-enum _mod_kind {Module_kind=1, Interactive_kind=2, Expression_kind=3,
-                 FunctionType_kind=4};
-struct _mod {
-    enum _mod_kind kind;
-    union {
-        struct {
-            asdl_seq *body;
-            asdl_seq *type_ignores;
-        } Module;
-
-        struct {
-            asdl_seq *body;
-        } Interactive;
-
-        struct {
-            expr_ty body;
-        } Expression;
-
-        struct {
-            asdl_seq *argtypes;
-            expr_ty returns;
-        } FunctionType;
-
-    } v;
-};
-
-enum _stmt_kind {FunctionDef_kind=1, AsyncFunctionDef_kind=2, ClassDef_kind=3,
-                  Return_kind=4, Delete_kind=5, Assign_kind=6,
-                  AugAssign_kind=7, AnnAssign_kind=8, For_kind=9,
-                  AsyncFor_kind=10, While_kind=11, If_kind=12, With_kind=13,
-                  AsyncWith_kind=14, Raise_kind=15, Try_kind=16,
-                  Assert_kind=17, Import_kind=18, ImportFrom_kind=19,
-                  Global_kind=20, Nonlocal_kind=21, Expr_kind=22, Pass_kind=23,
-                  Break_kind=24, Continue_kind=25};
-struct _stmt {
-    enum _stmt_kind kind;
-    union {
-        struct {
-            identifier name;
-            arguments_ty args;
-            asdl_seq *body;
-            asdl_seq *decorator_list;
-            expr_ty returns;
-            string type_comment;
-        } FunctionDef;
-
-        struct {
-            identifier name;
-            arguments_ty args;
-            asdl_seq *body;
-            asdl_seq *decorator_list;
-            expr_ty returns;
-            string type_comment;
-        } AsyncFunctionDef;
-
-        struct {
-            identifier name;
-            asdl_seq *bases;
-            asdl_seq *keywords;
-            asdl_seq *body;
-            asdl_seq *decorator_list;
-        } ClassDef;
-
-        struct {
-            expr_ty value;
-        } Return;
-
-        struct {
-            asdl_seq *targets;
-        } Delete;
-
-        struct {
-            asdl_seq *targets;
-            expr_ty value;
-            string type_comment;
-        } Assign;
-
-        struct {
-            expr_ty target;
-            operator_ty op;
-            expr_ty value;
-        } AugAssign;
-
-        struct {
-            expr_ty target;
-            expr_ty annotation;
-            expr_ty value;
-            int simple;
-        } AnnAssign;
-
-        struct {
-            expr_ty target;
-            expr_ty iter;
-            asdl_seq *body;
-            asdl_seq *orelse;
-            string type_comment;
-        } For;
-
-        struct {
-            expr_ty target;
-            expr_ty iter;
-            asdl_seq *body;
-            asdl_seq *orelse;
-            string type_comment;
-        } AsyncFor;
-
-        struct {
-            expr_ty test;
-            asdl_seq *body;
-            asdl_seq *orelse;
-        } While;
-
-        struct {
-            expr_ty test;
-            asdl_seq *body;
-            asdl_seq *orelse;
-        } If;
-
-        struct {
-            asdl_seq *items;
-            asdl_seq *body;
-            string type_comment;
-        } With;
-
-        struct {
-            asdl_seq *items;
-            asdl_seq *body;
-            string type_comment;
-        } AsyncWith;
-
-        struct {
-            expr_ty exc;
-            expr_ty cause;
-        } Raise;
-
-        struct {
-            asdl_seq *body;
-            asdl_seq *handlers;
-            asdl_seq *orelse;
-            asdl_seq *finalbody;
-        } Try;
-
-        struct {
-            expr_ty test;
-            expr_ty msg;
-        } Assert;
-
-        struct {
-            asdl_seq *names;
-        } Import;
-
-        struct {
-            identifier module;
-            asdl_seq *names;
-            int level;
-        } ImportFrom;
-
-        struct {
-            asdl_seq *names;
-        } Global;
-
-        struct {
-            asdl_seq *names;
-        } Nonlocal;
-
-        struct {
-            expr_ty value;
-        } Expr;
-
-    } v;
-    int lineno;
-    int col_offset;
-    int end_lineno;
-    int end_col_offset;
-};
-
-enum _expr_kind {BoolOp_kind=1, NamedExpr_kind=2, BinOp_kind=3, UnaryOp_kind=4,
-                  Lambda_kind=5, IfExp_kind=6, Dict_kind=7, Set_kind=8,
-                  ListComp_kind=9, SetComp_kind=10, DictComp_kind=11,
-                  GeneratorExp_kind=12, Await_kind=13, Yield_kind=14,
-                  YieldFrom_kind=15, Compare_kind=16, Call_kind=17,
-                  FormattedValue_kind=18, JoinedStr_kind=19, Constant_kind=20,
-                  Attribute_kind=21, Subscript_kind=22, Starred_kind=23,
-                  Name_kind=24, List_kind=25, Tuple_kind=26, Slice_kind=27};
-struct _expr {
-    enum _expr_kind kind;
-    union {
-        struct {
-            boolop_ty op;
-            asdl_seq *values;
-        } BoolOp;
-
-        struct {
-            expr_ty target;
-            expr_ty value;
-        } NamedExpr;
-
-        struct {
-            expr_ty left;
-            operator_ty op;
-            expr_ty right;
-        } BinOp;
-
-        struct {
-            unaryop_ty op;
-            expr_ty operand;
-        } UnaryOp;
-
-        struct {
-            arguments_ty args;
-            expr_ty body;
-        } Lambda;
-
-        struct {
-            expr_ty test;
-            expr_ty body;
-            expr_ty orelse;
-        } IfExp;
-
-        struct {
-            asdl_seq *keys;
-            asdl_seq *values;
-        } Dict;
-
-        struct {
-            asdl_seq *elts;
-        } Set;
-
-        struct {
-            expr_ty elt;
-            asdl_seq *generators;
-        } ListComp;
-
-        struct {
-            expr_ty elt;
-            asdl_seq *generators;
-        } SetComp;
-
-        struct {
-            expr_ty key;
-            expr_ty value;
-            asdl_seq *generators;
-        } DictComp;
-
-        struct {
-            expr_ty elt;
-            asdl_seq *generators;
-        } GeneratorExp;
-
-        struct {
-            expr_ty value;
-        } Await;
-
-        struct {
-            expr_ty value;
-        } Yield;
-
-        struct {
-            expr_ty value;
-        } YieldFrom;
-
-        struct {
-            expr_ty left;
-            asdl_int_seq *ops;
-            asdl_seq *comparators;
-        } Compare;
-
-        struct {
-            expr_ty func;
-            asdl_seq *args;
-            asdl_seq *keywords;
-        } Call;
-
-        struct {
-            expr_ty value;
-            int conversion;
-            expr_ty format_spec;
-        } FormattedValue;
-
-        struct {
-            asdl_seq *values;
-        } JoinedStr;
-
-        struct {
-            constant value;
-            string kind;
-        } Constant;
-
-        struct {
-            expr_ty value;
-            identifier attr;
-            expr_context_ty ctx;
-        } Attribute;
-
-        struct {
-            expr_ty value;
-            expr_ty slice;
-            expr_context_ty ctx;
-        } Subscript;
-
-        struct {
-            expr_ty value;
-            expr_context_ty ctx;
-        } Starred;
-
-        struct {
-            identifier id;
-            expr_context_ty ctx;
-        } Name;
-
-        struct {
-            asdl_seq *elts;
-            expr_context_ty ctx;
-        } List;
-
-        struct {
-            asdl_seq *elts;
-            expr_context_ty ctx;
-        } Tuple;
-
-        struct {
-            expr_ty lower;
-            expr_ty upper;
-            expr_ty step;
-        } Slice;
-
-    } v;
-    int lineno;
-    int col_offset;
-    int end_lineno;
-    int end_col_offset;
-};
-
-struct _comprehension {
-    expr_ty target;
-    expr_ty iter;
-    asdl_seq *ifs;
-    int is_async;
-};
-
-enum _excepthandler_kind {ExceptHandler_kind=1};
-struct _excepthandler {
-    enum _excepthandler_kind kind;
-    union {
-        struct {
-            expr_ty type;
-            identifier name;
-            asdl_seq *body;
-        } ExceptHandler;
-
-    } v;
-    int lineno;
-    int col_offset;
-    int end_lineno;
-    int end_col_offset;
-};
-
-struct _arguments {
-    asdl_seq *posonlyargs;
-    asdl_seq *args;
-    arg_ty vararg;
-    asdl_seq *kwonlyargs;
-    asdl_seq *kw_defaults;
-    arg_ty kwarg;
-    asdl_seq *defaults;
-};
-
-struct _arg {
-    identifier arg;
-    expr_ty annotation;
-    string type_comment;
-    int lineno;
-    int col_offset;
-    int end_lineno;
-    int end_col_offset;
-};
-
-struct _keyword {
-    identifier arg;
-    expr_ty value;
-    int lineno;
-    int col_offset;
-    int end_lineno;
-    int end_col_offset;
-};
-
-struct _alias {
-    identifier name;
-    identifier asname;
-};
-
-struct _withitem {
-    expr_ty context_expr;
-    expr_ty optional_vars;
-};
-
-enum _type_ignore_kind {TypeIgnore_kind=1};
-struct _type_ignore {
-    enum _type_ignore_kind kind;
-    union {
-        struct {
-            int lineno;
-            string tag;
-        } TypeIgnore;
-
-    } v;
-};
-
-
-// Note: these macros affect function definitions, not only call sites.
-#define Module(a0, a1, a2) _Py_Module(a0, a1, a2)
-mod_ty _Py_Module(asdl_seq * body, asdl_seq * type_ignores, PyArena *arena);
-#define Interactive(a0, a1) _Py_Interactive(a0, a1)
-mod_ty _Py_Interactive(asdl_seq * body, PyArena *arena);
-#define Expression(a0, a1) _Py_Expression(a0, a1)
-mod_ty _Py_Expression(expr_ty body, PyArena *arena);
-#define FunctionType(a0, a1, a2) _Py_FunctionType(a0, a1, a2)
-mod_ty _Py_FunctionType(asdl_seq * argtypes, expr_ty returns, PyArena *arena);
-#define FunctionDef(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) _Py_FunctionDef(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
-stmt_ty _Py_FunctionDef(identifier name, arguments_ty args, asdl_seq * body,
-                        asdl_seq * decorator_list, expr_ty returns, string
-                        type_comment, int lineno, int col_offset, int
-                        end_lineno, int end_col_offset, PyArena *arena);
-#define AsyncFunctionDef(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) _Py_AsyncFunctionDef(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
-stmt_ty _Py_AsyncFunctionDef(identifier name, arguments_ty args, asdl_seq *
-                             body, asdl_seq * decorator_list, expr_ty returns,
-                             string type_comment, int lineno, int col_offset,
-                             int end_lineno, int end_col_offset, PyArena
-                             *arena);
-#define ClassDef(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) _Py_ClassDef(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)
-stmt_ty _Py_ClassDef(identifier name, asdl_seq * bases, asdl_seq * keywords,
-                     asdl_seq * body, asdl_seq * decorator_list, int lineno,
-                     int col_offset, int end_lineno, int end_col_offset,
-                     PyArena *arena);
-#define Return(a0, a1, a2, a3, a4, a5) _Py_Return(a0, a1, a2, a3, a4, a5)
-stmt_ty _Py_Return(expr_ty value, int lineno, int col_offset, int end_lineno,
-                   int end_col_offset, PyArena *arena);
-#define Delete(a0, a1, a2, a3, a4, a5) _Py_Delete(a0, a1, a2, a3, a4, a5)
-stmt_ty _Py_Delete(asdl_seq * targets, int lineno, int col_offset, int
-                   end_lineno, int end_col_offset, PyArena *arena);
-#define Assign(a0, a1, a2, a3, a4, a5, a6, a7) _Py_Assign(a0, a1, a2, a3, a4, a5, a6, a7)
-stmt_ty _Py_Assign(asdl_seq * targets, expr_ty value, string type_comment, int
-                   lineno, int col_offset, int end_lineno, int end_col_offset,
-                   PyArena *arena);
-#define AugAssign(a0, a1, a2, a3, a4, a5, a6, a7) _Py_AugAssign(a0, a1, a2, a3, a4, a5, a6, a7)
-stmt_ty _Py_AugAssign(expr_ty target, operator_ty op, expr_ty value, int
-                      lineno, int col_offset, int end_lineno, int
-                      end_col_offset, PyArena *arena);
-#define AnnAssign(a0, a1, a2, a3, a4, a5, a6, a7, a8) _Py_AnnAssign(a0, a1, a2, a3, a4, a5, a6, a7, a8)
-stmt_ty _Py_AnnAssign(expr_ty target, expr_ty annotation, expr_ty value, int
-                      simple, int lineno, int col_offset, int end_lineno, int
-                      end_col_offset, PyArena *arena);
-#define For(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) _Py_For(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)
-stmt_ty _Py_For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq *
-                orelse, string type_comment, int lineno, int col_offset, int
-                end_lineno, int end_col_offset, PyArena *arena);
-#define AsyncFor(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) _Py_AsyncFor(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)
-stmt_ty _Py_AsyncFor(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq *
-                     orelse, string type_comment, int lineno, int col_offset,
-                     int end_lineno, int end_col_offset, PyArena *arena);
-#define While(a0, a1, a2, a3, a4, a5, a6, a7) _Py_While(a0, a1, a2, a3, a4, a5, a6, a7)
-stmt_ty _Py_While(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno,
-                  int col_offset, int end_lineno, int end_col_offset, PyArena
-                  *arena);
-#define If(a0, a1, a2, a3, a4, a5, a6, a7) _Py_If(a0, a1, a2, a3, a4, a5, a6, a7)
-stmt_ty _Py_If(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno,
-               int col_offset, int end_lineno, int end_col_offset, PyArena
-               *arena);
-#define With(a0, a1, a2, a3, a4, a5, a6, a7) _Py_With(a0, a1, a2, a3, a4, a5, a6, a7)
-stmt_ty _Py_With(asdl_seq * items, asdl_seq * body, string type_comment, int
-                 lineno, int col_offset, int end_lineno, int end_col_offset,
-                 PyArena *arena);
-#define AsyncWith(a0, a1, a2, a3, a4, a5, a6, a7) _Py_AsyncWith(a0, a1, a2, a3, a4, a5, a6, a7)
-stmt_ty _Py_AsyncWith(asdl_seq * items, asdl_seq * body, string type_comment,
-                      int lineno, int col_offset, int end_lineno, int
-                      end_col_offset, PyArena *arena);
-#define Raise(a0, a1, a2, a3, a4, a5, a6) _Py_Raise(a0, a1, a2, a3, a4, a5, a6)
-stmt_ty _Py_Raise(expr_ty exc, expr_ty cause, int lineno, int col_offset, int
-                  end_lineno, int end_col_offset, PyArena *arena);
-#define Try(a0, a1, a2, a3, a4, a5, a6, a7, a8) _Py_Try(a0, a1, a2, a3, a4, a5, a6, a7, a8)
-stmt_ty _Py_Try(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse,
-                asdl_seq * finalbody, int lineno, int col_offset, int
-                end_lineno, int end_col_offset, PyArena *arena);
-#define Assert(a0, a1, a2, a3, a4, a5, a6) _Py_Assert(a0, a1, a2, a3, a4, a5, a6)
-stmt_ty _Py_Assert(expr_ty test, expr_ty msg, int lineno, int col_offset, int
-                   end_lineno, int end_col_offset, PyArena *arena);
-#define Import(a0, a1, a2, a3, a4, a5) _Py_Import(a0, a1, a2, a3, a4, a5)
-stmt_ty _Py_Import(asdl_seq * names, int lineno, int col_offset, int
-                   end_lineno, int end_col_offset, PyArena *arena);
-#define ImportFrom(a0, a1, a2, a3, a4, a5, a6, a7) _Py_ImportFrom(a0, a1, a2, a3, a4, a5, a6, a7)
-stmt_ty _Py_ImportFrom(identifier module, asdl_seq * names, int level, int
-                       lineno, int col_offset, int end_lineno, int
-                       end_col_offset, PyArena *arena);
-#define Global(a0, a1, a2, a3, a4, a5) _Py_Global(a0, a1, a2, a3, a4, a5)
-stmt_ty _Py_Global(asdl_seq * names, int lineno, int col_offset, int
-                   end_lineno, int end_col_offset, PyArena *arena);
-#define Nonlocal(a0, a1, a2, a3, a4, a5) _Py_Nonlocal(a0, a1, a2, a3, a4, a5)
-stmt_ty _Py_Nonlocal(asdl_seq * names, int lineno, int col_offset, int
-                     end_lineno, int end_col_offset, PyArena *arena);
-#define Expr(a0, a1, a2, a3, a4, a5) _Py_Expr(a0, a1, a2, a3, a4, a5)
-stmt_ty _Py_Expr(expr_ty value, int lineno, int col_offset, int end_lineno, int
-                 end_col_offset, PyArena *arena);
-#define Pass(a0, a1, a2, a3, a4) _Py_Pass(a0, a1, a2, a3, a4)
-stmt_ty _Py_Pass(int lineno, int col_offset, int end_lineno, int
-                 end_col_offset, PyArena *arena);
-#define Break(a0, a1, a2, a3, a4) _Py_Break(a0, a1, a2, a3, a4)
-stmt_ty _Py_Break(int lineno, int col_offset, int end_lineno, int
-                  end_col_offset, PyArena *arena);
-#define Continue(a0, a1, a2, a3, a4) _Py_Continue(a0, a1, a2, a3, a4)
-stmt_ty _Py_Continue(int lineno, int col_offset, int end_lineno, int
-                     end_col_offset, PyArena *arena);
-#define BoolOp(a0, a1, a2, a3, a4, a5, a6) _Py_BoolOp(a0, a1, a2, a3, a4, a5, a6)
-expr_ty _Py_BoolOp(boolop_ty op, asdl_seq * values, int lineno, int col_offset,
-                   int end_lineno, int end_col_offset, PyArena *arena);
-#define NamedExpr(a0, a1, a2, a3, a4, a5, a6) _Py_NamedExpr(a0, a1, a2, a3, a4, a5, a6)
-expr_ty _Py_NamedExpr(expr_ty target, expr_ty value, int lineno, int
-                      col_offset, int end_lineno, int end_col_offset, PyArena
-                      *arena);
-#define BinOp(a0, a1, a2, a3, a4, a5, a6, a7) _Py_BinOp(a0, a1, a2, a3, a4, a5, a6, a7)
-expr_ty _Py_BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno, int
-                  col_offset, int end_lineno, int end_col_offset, PyArena
-                  *arena);
-#define UnaryOp(a0, a1, a2, a3, a4, a5, a6) _Py_UnaryOp(a0, a1, a2, a3, a4, a5, a6)
-expr_ty _Py_UnaryOp(unaryop_ty op, expr_ty operand, int lineno, int col_offset,
-                    int end_lineno, int end_col_offset, PyArena *arena);
-#define Lambda(a0, a1, a2, a3, a4, a5, a6) _Py_Lambda(a0, a1, a2, a3, a4, a5, a6)
-expr_ty _Py_Lambda(arguments_ty args, expr_ty body, int lineno, int col_offset,
-                   int end_lineno, int end_col_offset, PyArena *arena);
-#define IfExp(a0, a1, a2, a3, a4, a5, a6, a7) _Py_IfExp(a0, a1, a2, a3, a4, a5, a6, a7)
-expr_ty _Py_IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int
-                  col_offset, int end_lineno, int end_col_offset, PyArena
-                  *arena);
-#define Dict(a0, a1, a2, a3, a4, a5, a6) _Py_Dict(a0, a1, a2, a3, a4, a5, a6)
-expr_ty _Py_Dict(asdl_seq * keys, asdl_seq * values, int lineno, int
-                 col_offset, int end_lineno, int end_col_offset, PyArena
-                 *arena);
-#define Set(a0, a1, a2, a3, a4, a5) _Py_Set(a0, a1, a2, a3, a4, a5)
-expr_ty _Py_Set(asdl_seq * elts, int lineno, int col_offset, int end_lineno,
-                int end_col_offset, PyArena *arena);
-#define ListComp(a0, a1, a2, a3, a4, a5, a6) _Py_ListComp(a0, a1, a2, a3, a4, a5, a6)
-expr_ty _Py_ListComp(expr_ty elt, asdl_seq * generators, int lineno, int
-                     col_offset, int end_lineno, int end_col_offset, PyArena
-                     *arena);
-#define SetComp(a0, a1, a2, a3, a4, a5, a6) _Py_SetComp(a0, a1, a2, a3, a4, a5, a6)
-expr_ty _Py_SetComp(expr_ty elt, asdl_seq * generators, int lineno, int
-                    col_offset, int end_lineno, int end_col_offset, PyArena
-                    *arena);
-#define DictComp(a0, a1, a2, a3, a4, a5, a6, a7) _Py_DictComp(a0, a1, a2, a3, a4, a5, a6, a7)
-expr_ty _Py_DictComp(expr_ty key, expr_ty value, asdl_seq * generators, int
-                     lineno, int col_offset, int end_lineno, int
-                     end_col_offset, PyArena *arena);
-#define GeneratorExp(a0, a1, a2, a3, a4, a5, a6) _Py_GeneratorExp(a0, a1, a2, a3, a4, a5, a6)
-expr_ty _Py_GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int
-                         col_offset, int end_lineno, int end_col_offset,
-                         PyArena *arena);
-#define Await(a0, a1, a2, a3, a4, a5) _Py_Await(a0, a1, a2, a3, a4, a5)
-expr_ty _Py_Await(expr_ty value, int lineno, int col_offset, int end_lineno,
-                  int end_col_offset, PyArena *arena);
-#define Yield(a0, a1, a2, a3, a4, a5) _Py_Yield(a0, a1, a2, a3, a4, a5)
-expr_ty _Py_Yield(expr_ty value, int lineno, int col_offset, int end_lineno,
-                  int end_col_offset, PyArena *arena);
-#define YieldFrom(a0, a1, a2, a3, a4, a5) _Py_YieldFrom(a0, a1, a2, a3, a4, a5)
-expr_ty _Py_YieldFrom(expr_ty value, int lineno, int col_offset, int
-                      end_lineno, int end_col_offset, PyArena *arena);
-#define Compare(a0, a1, a2, a3, a4, a5, a6, a7) _Py_Compare(a0, a1, a2, a3, a4, a5, a6, a7)
-expr_ty _Py_Compare(expr_ty left, asdl_int_seq * ops, asdl_seq * comparators,
-                    int lineno, int col_offset, int end_lineno, int
-                    end_col_offset, PyArena *arena);
-#define Call(a0, a1, a2, a3, a4, a5, a6, a7) _Py_Call(a0, a1, a2, a3, a4, a5, a6, a7)
-expr_ty _Py_Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, int
-                 lineno, int col_offset, int end_lineno, int end_col_offset,
-                 PyArena *arena);
-#define FormattedValue(a0, a1, a2, a3, a4, a5, a6, a7) _Py_FormattedValue(a0, a1, a2, a3, a4, a5, a6, a7)
-expr_ty _Py_FormattedValue(expr_ty value, int conversion, expr_ty format_spec,
-                           int lineno, int col_offset, int end_lineno, int
-                           end_col_offset, PyArena *arena);
-#define JoinedStr(a0, a1, a2, a3, a4, a5) _Py_JoinedStr(a0, a1, a2, a3, a4, a5)
-expr_ty _Py_JoinedStr(asdl_seq * values, int lineno, int col_offset, int
-                      end_lineno, int end_col_offset, PyArena *arena);
-#define Constant(a0, a1, a2, a3, a4, a5, a6) _Py_Constant(a0, a1, a2, a3, a4, a5, a6)
-expr_ty _Py_Constant(constant value, string kind, int lineno, int col_offset,
-                     int end_lineno, int end_col_offset, PyArena *arena);
-#define Attribute(a0, a1, a2, a3, a4, a5, a6, a7) _Py_Attribute(a0, a1, a2, a3, a4, a5, a6, a7)
-expr_ty _Py_Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int
-                      lineno, int col_offset, int end_lineno, int
-                      end_col_offset, PyArena *arena);
-#define Subscript(a0, a1, a2, a3, a4, a5, a6, a7) _Py_Subscript(a0, a1, a2, a3, a4, a5, a6, a7)
-expr_ty _Py_Subscript(expr_ty value, expr_ty slice, expr_context_ty ctx, int
-                      lineno, int col_offset, int end_lineno, int
-                      end_col_offset, PyArena *arena);
-#define Starred(a0, a1, a2, a3, a4, a5, a6) _Py_Starred(a0, a1, a2, a3, a4, a5, a6)
-expr_ty _Py_Starred(expr_ty value, expr_context_ty ctx, int lineno, int
-                    col_offset, int end_lineno, int end_col_offset, PyArena
-                    *arena);
-#define Name(a0, a1, a2, a3, a4, a5, a6) _Py_Name(a0, a1, a2, a3, a4, a5, a6)
-expr_ty _Py_Name(identifier id, expr_context_ty ctx, int lineno, int
-                 col_offset, int end_lineno, int end_col_offset, PyArena
-                 *arena);
-#define List(a0, a1, a2, a3, a4, a5, a6) _Py_List(a0, a1, a2, a3, a4, a5, a6)
-expr_ty _Py_List(asdl_seq * elts, expr_context_ty ctx, int lineno, int
-                 col_offset, int end_lineno, int end_col_offset, PyArena
-                 *arena);
-#define Tuple(a0, a1, a2, a3, a4, a5, a6) _Py_Tuple(a0, a1, a2, a3, a4, a5, a6)
-expr_ty _Py_Tuple(asdl_seq * elts, expr_context_ty ctx, int lineno, int
-                  col_offset, int end_lineno, int end_col_offset, PyArena
-                  *arena);
-#define Slice(a0, a1, a2, a3, a4, a5, a6, a7) _Py_Slice(a0, a1, a2, a3, a4, a5, a6, a7)
-expr_ty _Py_Slice(expr_ty lower, expr_ty upper, expr_ty step, int lineno, int
-                  col_offset, int end_lineno, int end_col_offset, PyArena
-                  *arena);
-#define comprehension(a0, a1, a2, a3, a4) _Py_comprehension(a0, a1, a2, a3, a4)
-comprehension_ty _Py_comprehension(expr_ty target, expr_ty iter, asdl_seq *
-                                   ifs, int is_async, PyArena *arena);
-#define ExceptHandler(a0, a1, a2, a3, a4, a5, a6, a7) _Py_ExceptHandler(a0, a1, a2, a3, a4, a5, a6, a7)
-excepthandler_ty _Py_ExceptHandler(expr_ty type, identifier name, asdl_seq *
-                                   body, int lineno, int col_offset, int
-                                   end_lineno, int end_col_offset, PyArena
-                                   *arena);
-#define arguments(a0, a1, a2, a3, a4, a5, a6, a7) _Py_arguments(a0, a1, a2, a3, a4, a5, a6, a7)
-arguments_ty _Py_arguments(asdl_seq * posonlyargs, asdl_seq * args, arg_ty
-                           vararg, asdl_seq * kwonlyargs, asdl_seq *
-                           kw_defaults, arg_ty kwarg, asdl_seq * defaults,
-                           PyArena *arena);
-#define arg(a0, a1, a2, a3, a4, a5, a6, a7) _Py_arg(a0, a1, a2, a3, a4, a5, a6, a7)
-arg_ty _Py_arg(identifier arg, expr_ty annotation, string type_comment, int
-               lineno, int col_offset, int end_lineno, int end_col_offset,
-               PyArena *arena);
-#define keyword(a0, a1, a2, a3, a4, a5, a6) _Py_keyword(a0, a1, a2, a3, a4, a5, a6)
-keyword_ty _Py_keyword(identifier arg, expr_ty value, int lineno, int
-                       col_offset, int end_lineno, int end_col_offset, PyArena
-                       *arena);
-#define alias(a0, a1, a2) _Py_alias(a0, a1, a2)
-alias_ty _Py_alias(identifier name, identifier asname, PyArena *arena);
-#define withitem(a0, a1, a2) _Py_withitem(a0, a1, a2)
-withitem_ty _Py_withitem(expr_ty context_expr, expr_ty optional_vars, PyArena
-                         *arena);
-#define TypeIgnore(a0, a1, a2) _Py_TypeIgnore(a0, a1, a2)
-type_ignore_ty _Py_TypeIgnore(int lineno, string tag, PyArena *arena);
-
-PyObject* PyAST_mod2obj(mod_ty t);
-mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode);
-int PyAST_Check(PyObject* obj);
-#endif /* !Py_LIMITED_API */
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* !Py_PYTHON_AST_H */
diff --git a/Include/Python.h b/Include/Python.h
index dcd0a57..d3186c3 100644
--- a/Include/Python.h
+++ b/Include/Python.h
@@ -35,19 +35,6 @@
 #ifndef MS_WINDOWS
 #include <unistd.h>
 #endif
-#ifdef HAVE_CRYPT_H
-#if defined(HAVE_CRYPT_R) && !defined(_GNU_SOURCE)
-/* Required for glibc to expose the crypt_r() function prototype. */
-#  define _GNU_SOURCE
-#  define _Py_GNU_SOURCE_FOR_CRYPT
-#endif
-#include <crypt.h>
-#ifdef _Py_GNU_SOURCE_FOR_CRYPT
-/* Don't leak the _GNU_SOURCE define to other headers. */
-#  undef _GNU_SOURCE
-#  undef _Py_GNU_SOURCE_FOR_CRYPT
-#endif
-#endif
 
 /* For size_t? */
 #ifdef HAVE_STDDEF_H
@@ -63,26 +50,25 @@
 #include "pyport.h"
 #include "pymacro.h"
 
-/* A convenient way for code to know if clang's memory sanitizer is enabled. */
+/* A convenient way for code to know if sanitizers are enabled. */
 #if defined(__has_feature)
 #  if __has_feature(memory_sanitizer)
 #    if !defined(_Py_MEMORY_SANITIZER)
 #      define _Py_MEMORY_SANITIZER
 #    endif
 #  endif
+#  if __has_feature(address_sanitizer)
+#    if !defined(_Py_ADDRESS_SANITIZER)
+#      define _Py_ADDRESS_SANITIZER
+#    endif
+#  endif
+#elif defined(__GNUC__)
+#  if defined(__SANITIZE_ADDRESS__)
+#    define _Py_ADDRESS_SANITIZER
+#  endif
 #endif
 
-/* Debug-mode build with pymalloc implies PYMALLOC_DEBUG.
- *  PYMALLOC_DEBUG is in error if pymalloc is not in use.
- */
-#if defined(Py_DEBUG) && defined(WITH_PYMALLOC) && !defined(PYMALLOC_DEBUG)
-#define PYMALLOC_DEBUG
-#endif
-#if defined(PYMALLOC_DEBUG) && !defined(WITH_PYMALLOC)
-#error "PYMALLOC_DEBUG requires WITH_PYMALLOC"
-#endif
 #include "pymath.h"
-#include "pytime.h"
 #include "pymem.h"
 
 #include "object.h"
@@ -90,7 +76,7 @@
 #include "typeslots.h"
 #include "pyhash.h"
 
-#include "pydebug.h"
+#include "cpython/pydebug.h"
 
 #include "bytearrayobject.h"
 #include "bytesobject.h"
@@ -105,7 +91,7 @@
 #include "tupleobject.h"
 #include "listobject.h"
 #include "dictobject.h"
-#include "odictobject.h"
+#include "cpython/odictobject.h"
 #include "enumobject.h"
 #include "setobject.h"
 #include "methodobject.h"
@@ -120,6 +106,7 @@
 #include "sliceobject.h"
 #include "cellobject.h"
 #include "iterobject.h"
+#include "cpython/initconfig.h"
 #include "genobject.h"
 #include "descrobject.h"
 #include "genericaliasobject.h"
@@ -127,17 +114,15 @@
 #include "weakrefobject.h"
 #include "structseq.h"
 #include "namespaceobject.h"
-#include "picklebufobject.h"
+#include "cpython/picklebufobject.h"
+#include "cpython/pytime.h"
 
 #include "codecs.h"
 #include "pyerrors.h"
-
-#include "cpython/initconfig.h"
 #include "pythread.h"
 #include "pystate.h"
 #include "context.h"
 
-#include "pyarena.h"
 #include "modsupport.h"
 #include "compile.h"
 #include "pythonrun.h"
@@ -153,11 +138,11 @@
 
 #include "eval.h"
 
-#include "pyctype.h"
+#include "cpython/pyctype.h"
 #include "pystrtod.h"
 #include "pystrcmp.h"
 #include "fileutils.h"
-#include "pyfpe.h"
+#include "cpython/pyfpe.h"
 #include "tracemalloc.h"
 
 #endif /* !Py_PYTHON_H */
diff --git a/Include/README.rst b/Include/README.rst
new file mode 100644
index 0000000..f52e690
--- /dev/null
+++ b/Include/README.rst
@@ -0,0 +1,12 @@
+The Python C API
+================
+
+The C API is divided into three sections:
+
+1. ``Include/``: Limited API
+2. ``Include/cpython/``: CPython implementation details
+3. ``Include/internal/``: The internal API
+
+Information on changing the C API is available `in the developer guide`_
+
+.. _in the developer guide: https://devguide.python.org/c-api/
diff --git a/Include/abstract.h b/Include/abstract.h
index bb51c66..9eaab6b 100644
--- a/Include/abstract.h
+++ b/Include/abstract.h
@@ -318,7 +318,7 @@
 
 /* Takes an arbitrary object which must support the (character, single segment)
    buffer interface and returns a pointer to a read-only memory location
-   useable as character based input for subsequent processing.
+   usable as character based input for subsequent processing.
 
    Return 0 on success.  buffer and buffer_len are only set in case no error
    occurs. Otherwise, -1 is returned and an exception set. */
@@ -371,11 +371,21 @@
    returns itself. */
 PyAPI_FUNC(PyObject *) PyObject_GetIter(PyObject *);
 
-/* Returns 1 if the object 'obj' provides iterator protocols, and 0 otherwise.
+/* Takes an AsyncIterable object and returns an AsyncIterator for it.
+   This is typically a new iterator but if the argument is an AsyncIterator,
+   this returns itself. */
+PyAPI_FUNC(PyObject *) PyObject_GetAIter(PyObject *);
+
+/* Returns non-zero if the object 'obj' provides iterator protocols, and 0 otherwise.
 
    This function always succeeds. */
 PyAPI_FUNC(int) PyIter_Check(PyObject *);
 
+/* Returns non-zero if the object 'obj' provides AsyncIterator protocols, and 0 otherwise.
+
+   This function always succeeds. */
+PyAPI_FUNC(int) PyAIter_Check(PyObject *);
+
 /* Takes an iterator object and calls its tp_iternext slot,
    returning the next value.
 
@@ -385,6 +395,19 @@
    NULL with an exception means an error occurred. */
 PyAPI_FUNC(PyObject *) PyIter_Next(PyObject *);
 
+#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030A0000
+
+/* Takes generator, coroutine or iterator object and sends the value into it.
+   Returns:
+   - PYGEN_RETURN (0) if generator has returned.
+     'result' parameter is filled with return value
+   - PYGEN_ERROR (-1) if exception was raised.
+     'result' parameter is NULL
+   - PYGEN_NEXT (1) if generator has yielded.
+     'result' parameter is filled with yielded value. */
+PyAPI_FUNC(PySendResult) PyIter_Send(PyObject *, PyObject *, PyObject **);
+#endif
+
 
 /* === Number Protocol ================================================== */
 
diff --git a/Include/asdl.h b/Include/asdl.h
deleted file mode 100644
index e962560..0000000
--- a/Include/asdl.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef Py_LIMITED_API
-#ifndef Py_ASDL_H
-#define Py_ASDL_H
-
-typedef PyObject * identifier;
-typedef PyObject * string;
-typedef PyObject * object;
-typedef PyObject * constant;
-
-/* It would be nice if the code generated by asdl_c.py was completely
-   independent of Python, but it is a goal the requires too much work
-   at this stage.  So, for example, I'll represent identifiers as
-   interned Python strings.
-*/
-
-/* XXX A sequence should be typed so that its use can be typechecked. */
-
-typedef struct {
-    Py_ssize_t size;
-    void *elements[1];
-} asdl_seq;
-
-typedef struct {
-    Py_ssize_t size;
-    int elements[1];
-} asdl_int_seq;
-
-asdl_seq *_Py_asdl_seq_new(Py_ssize_t size, PyArena *arena);
-asdl_int_seq *_Py_asdl_int_seq_new(Py_ssize_t size, PyArena *arena);
-
-#define asdl_seq_GET(S, I) (S)->elements[(I)]
-#define asdl_seq_LEN(S) ((S) == NULL ? 0 : (S)->size)
-#ifdef Py_DEBUG
-#define asdl_seq_SET(S, I, V) \
-    do { \
-        Py_ssize_t _asdl_i = (I); \
-        assert((S) != NULL); \
-        assert(0 <= _asdl_i && _asdl_i < (S)->size); \
-        (S)->elements[_asdl_i] = (V); \
-    } while (0)
-#else
-#define asdl_seq_SET(S, I, V) (S)->elements[I] = (V)
-#endif
-
-#endif /* !Py_ASDL_H */
-#endif /* Py_LIMITED_API */
diff --git a/Include/ast.h b/Include/ast.h
deleted file mode 100644
index a8c52af..0000000
--- a/Include/ast.h
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef Py_LIMITED_API
-#ifndef Py_AST_H
-#define Py_AST_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "Python-ast.h"   /* mod_ty */
-#include "node.h"         /* node */
-
-PyAPI_FUNC(int) PyAST_Validate(mod_ty);
-PyAPI_FUNC(mod_ty) PyAST_FromNode(
-    const node *n,
-    PyCompilerFlags *flags,
-    const char *filename,       /* decoded from the filesystem encoding */
-    PyArena *arena);
-PyAPI_FUNC(mod_ty) PyAST_FromNodeObject(
-    const node *n,
-    PyCompilerFlags *flags,
-    PyObject *filename,
-    PyArena *arena);
-
-/* _PyAST_ExprAsUnicode is defined in ast_unparse.c */
-PyAPI_FUNC(PyObject *) _PyAST_ExprAsUnicode(expr_ty);
-
-/* Return the borrowed reference to the first literal string in the
-   sequence of statements or NULL if it doesn't start from a literal string.
-   Doesn't set exception. */
-PyAPI_FUNC(PyObject *) _PyAST_GetDocString(asdl_seq *);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* !Py_AST_H */
-#endif /* !Py_LIMITED_API */
diff --git a/Include/bitset.h b/Include/bitset.h
deleted file mode 100644
index 6a2ac97..0000000
--- a/Include/bitset.h
+++ /dev/null
@@ -1,23 +0,0 @@
-
-#ifndef Py_BITSET_H
-#define Py_BITSET_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Bitset interface */
-
-#define BYTE            char
-typedef BYTE *bitset;
-
-#define testbit(ss, ibit) (((ss)[BIT2BYTE(ibit)] & BIT2MASK(ibit)) != 0)
-
-#define BITSPERBYTE     (8*sizeof(BYTE))
-#define BIT2BYTE(ibit)  ((ibit) / BITSPERBYTE)
-#define BIT2SHIFT(ibit) ((ibit) % BITSPERBYTE)
-#define BIT2MASK(ibit)  (1 << BIT2SHIFT(ibit))
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* !Py_BITSET_H */
diff --git a/Include/boolobject.h b/Include/boolobject.h
index bb8044a..cda6f89 100644
--- a/Include/boolobject.h
+++ b/Include/boolobject.h
@@ -15,15 +15,24 @@
 Don't forget to apply Py_INCREF() when returning either!!! */
 
 /* Don't use these directly */
-PyAPI_DATA(struct _longobject) _Py_FalseStruct, _Py_TrueStruct;
+PyAPI_DATA(struct _longobject) _Py_FalseStruct;
+PyAPI_DATA(struct _longobject) _Py_TrueStruct;
 
 /* Use these macros */
 #define Py_False ((PyObject *) &_Py_FalseStruct)
 #define Py_True ((PyObject *) &_Py_TrueStruct)
 
+// Test if an object is the True singleton, the same as "x is True" in Python.
+PyAPI_FUNC(int) Py_IsTrue(PyObject *x);
+#define Py_IsTrue(x) Py_Is((x), Py_True)
+
+// Test if an object is the False singleton, the same as "x is False" in Python.
+PyAPI_FUNC(int) Py_IsFalse(PyObject *x);
+#define Py_IsFalse(x) Py_Is((x), Py_False)
+
 /* Macros for returning Py_True or Py_False, respectively */
-#define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True
-#define Py_RETURN_FALSE return Py_INCREF(Py_False), Py_False
+#define Py_RETURN_TRUE return Py_NewRef(Py_True)
+#define Py_RETURN_FALSE return Py_NewRef(Py_False)
 
 /* Function to return a bool from a C long */
 PyAPI_FUNC(PyObject *) PyBool_FromLong(long);
diff --git a/Include/bytesobject.h b/Include/bytesobject.h
index 5062d8d..39c241a 100644
--- a/Include/bytesobject.h
+++ b/Include/bytesobject.h
@@ -1,5 +1,5 @@
 
-/* Bytes (String) object interface */
+/* Bytes object interface */
 
 #ifndef Py_BYTESOBJECT_H
 #define Py_BYTESOBJECT_H
@@ -10,23 +10,20 @@
 #include <stdarg.h>
 
 /*
-Type PyBytesObject represents a character string.  An extra zero byte is
+Type PyBytesObject represents a byte string.  An extra zero byte is
 reserved at the end to ensure it is zero-terminated, but a size is
 present so strings with null bytes in them can be represented.  This
 is an immutable object type.
 
-There are functions to create new string objects, to test
-an object for string-ness, and to get the
-string value.  The latter function returns a null pointer
+There are functions to create new bytes objects, to test
+an object for bytes-ness, and to get the
+byte string value.  The latter function returns a null pointer
 if the object is not of the proper type.
 There is a variant that takes an explicit size as well as a
 variant that assumes a zero-terminated string.  Note that none of the
-functions should be applied to nil objects.
+functions should be applied to NULL pointer.
 */
 
-/* Caching the hash (ob_shash) saves recalculation of a string's hash value.
-   This significantly speeds up dict lookups. */
-
 PyAPI_DATA(PyTypeObject) PyBytes_Type;
 PyAPI_DATA(PyTypeObject) PyBytesIter_Type;
 
@@ -50,26 +47,16 @@
                                             const char *, Py_ssize_t,
                                             const char *);
 
-/* Provides access to the internal data buffer and size of a string
-   object or the default encoded version of a Unicode object. Passing
-   NULL as *len parameter will force the string buffer to be
-   0-terminated (passing a string with embedded NULL characters will
+/* Provides access to the internal data buffer and size of a bytes object.
+   Passing NULL as len parameter will force the string buffer to be
+   0-terminated (passing a string with embedded NUL characters will
    cause an exception).  */
 PyAPI_FUNC(int) PyBytes_AsStringAndSize(
-    PyObject *obj,      /* string or Unicode object */
+    PyObject *obj,      /* bytes object */
     char **s,           /* pointer to buffer variable */
-    Py_ssize_t *len     /* pointer to length variable or NULL
-                           (only possible for 0-terminated
-                           strings) */
+    Py_ssize_t *len     /* pointer to length variable or NULL */
     );
 
-/* Flags used by string formatting */
-#define F_LJUST (1<<0)
-#define F_SIGN  (1<<1)
-#define F_BLANK (1<<2)
-#define F_ALT   (1<<3)
-#define F_ZERO  (1<<4)
-
 #ifndef Py_LIMITED_API
 #  define Py_CPYTHON_BYTESOBJECT_H
 #  include  "cpython/bytesobject.h"
diff --git a/Include/cellobject.h b/Include/cellobject.h
index f12aa90..81bc784 100644
--- a/Include/cellobject.h
+++ b/Include/cellobject.h
@@ -20,7 +20,7 @@
 PyAPI_FUNC(int) PyCell_Set(PyObject *, PyObject *);
 
 #define PyCell_GET(op) (((PyCellObject *)(op))->ob_ref)
-#define PyCell_SET(op, v) (((PyCellObject *)(op))->ob_ref = v)
+#define PyCell_SET(op, v) ((void)(((PyCellObject *)(op))->ob_ref = v))
 
 #ifdef __cplusplus
 }
diff --git a/Include/ceval.h b/Include/ceval.h
index 0f372e2..0f68766 100644
--- a/Include/ceval.h
+++ b/Include/ceval.h
@@ -67,14 +67,6 @@
 PyAPI_FUNC(int) Py_EnterRecursiveCall(const char *where);
 PyAPI_FUNC(void) Py_LeaveRecursiveCall(void);
 
-#define Py_ALLOW_RECURSION \
-  do { unsigned char _old = PyThreadState_GET()->recursion_critical;\
-    PyThreadState_GET()->recursion_critical = 1;
-
-#define Py_END_ALLOW_RECURSION \
-    PyThreadState_GET()->recursion_critical = _old; \
-  } while(0);
-
 PyAPI_FUNC(const char *) PyEval_GetFuncName(PyObject *);
 PyAPI_FUNC(const char *) PyEval_GetFuncDesc(PyObject *);
 
diff --git a/Include/codecs.h b/Include/codecs.h
index 3ad0f2b..37ecfb4 100644
--- a/Include/codecs.h
+++ b/Include/codecs.h
@@ -27,6 +27,14 @@
        PyObject *search_function
        );
 
+/* Unregister a codec search function and clear the registry's cache.
+   If the search function is not registered, do nothing.
+   Return 0 on success. Raise an exception and return -1 on error. */
+
+PyAPI_FUNC(int) PyCodec_Unregister(
+       PyObject *search_function
+       );
+
 /* Codec registry lookup API.
 
    Looks up the given encoding and returns a CodecInfo object with
diff --git a/Include/compile.h b/Include/compile.h
index 98adee3..3c5acd7 100644
--- a/Include/compile.h
+++ b/Include/compile.h
@@ -1,109 +1,9 @@
 #ifndef Py_COMPILE_H
 #define Py_COMPILE_H
-
-#ifndef Py_LIMITED_API
-
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-/* Public interface */
-struct _node; /* Declare the existence of this type */
-#ifndef Py_BUILD_CORE
-Py_DEPRECATED(3.9)
-#endif
-PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, const char *);
-/* XXX (ncoghlan): Unprefixed type name in a public API! */
-
-#define PyCF_MASK (CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | \
-                   CO_FUTURE_WITH_STATEMENT | CO_FUTURE_PRINT_FUNCTION | \
-                   CO_FUTURE_UNICODE_LITERALS | CO_FUTURE_BARRY_AS_BDFL | \
-                   CO_FUTURE_GENERATOR_STOP | CO_FUTURE_ANNOTATIONS)
-#define PyCF_MASK_OBSOLETE (CO_NESTED)
-
-/* bpo-39562: CO_FUTURE_ and PyCF_ constants must be kept unique.
-   PyCF_ constants can use bits from 0x0100 to 0x10000.
-   CO_FUTURE_ constants use bits starting at 0x20000. */
-#define PyCF_SOURCE_IS_UTF8  0x0100
-#define PyCF_DONT_IMPLY_DEDENT 0x0200
-#define PyCF_ONLY_AST 0x0400
-#define PyCF_IGNORE_COOKIE 0x0800
-#define PyCF_TYPE_COMMENTS 0x1000
-#define PyCF_ALLOW_TOP_LEVEL_AWAIT 0x2000
-#define PyCF_COMPILE_MASK (PyCF_ONLY_AST | PyCF_ALLOW_TOP_LEVEL_AWAIT | \
-                           PyCF_TYPE_COMMENTS | PyCF_DONT_IMPLY_DEDENT)
-
-#ifndef Py_LIMITED_API
-typedef struct {
-    int cf_flags;  /* bitmask of CO_xxx flags relevant to future */
-    int cf_feature_version;  /* minor Python version (PyCF_ONLY_AST) */
-} PyCompilerFlags;
-
-#define _PyCompilerFlags_INIT \
-    (PyCompilerFlags){.cf_flags = 0, .cf_feature_version = PY_MINOR_VERSION}
-#endif
-
-/* Future feature support */
-
-typedef struct {
-    int ff_features;      /* flags set by future statements */
-    int ff_lineno;        /* line number of last future statement */
-} PyFutureFeatures;
-
-#define FUTURE_NESTED_SCOPES "nested_scopes"
-#define FUTURE_GENERATORS "generators"
-#define FUTURE_DIVISION "division"
-#define FUTURE_ABSOLUTE_IMPORT "absolute_import"
-#define FUTURE_WITH_STATEMENT "with_statement"
-#define FUTURE_PRINT_FUNCTION "print_function"
-#define FUTURE_UNICODE_LITERALS "unicode_literals"
-#define FUTURE_BARRY_AS_BDFL "barry_as_FLUFL"
-#define FUTURE_GENERATOR_STOP "generator_stop"
-#define FUTURE_ANNOTATIONS "annotations"
-
-struct _mod; /* Declare the existence of this type */
-#define PyAST_Compile(mod, s, f, ar) PyAST_CompileEx(mod, s, f, -1, ar)
-PyAPI_FUNC(PyCodeObject *) PyAST_CompileEx(
-    struct _mod *mod,
-    const char *filename,       /* decoded from the filesystem encoding */
-    PyCompilerFlags *flags,
-    int optimize,
-    PyArena *arena);
-PyAPI_FUNC(PyCodeObject *) PyAST_CompileObject(
-    struct _mod *mod,
-    PyObject *filename,
-    PyCompilerFlags *flags,
-    int optimize,
-    PyArena *arena);
-PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromAST(
-    struct _mod * mod,
-    const char *filename        /* decoded from the filesystem encoding */
-    );
-PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromASTObject(
-    struct _mod * mod,
-    PyObject *filename
-    );
-
-/* _Py_Mangle is defined in compile.c */
-PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name);
-
-#define PY_INVALID_STACK_EFFECT INT_MAX
-PyAPI_FUNC(int) PyCompile_OpcodeStackEffect(int opcode, int oparg);
-PyAPI_FUNC(int) PyCompile_OpcodeStackEffectWithJump(int opcode, int oparg, int jump);
-
-typedef struct {
-    int optimize;
-    int ff_features;
-} _PyASTOptimizeState;
-
-PyAPI_FUNC(int) _PyAST_Optimize(struct _mod *, PyArena *arena, _PyASTOptimizeState *state);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !Py_LIMITED_API */
-
 /* These definitions must match corresponding definitions in graminit.h. */
 #define Py_single_input 256
 #define Py_file_input 257
@@ -113,4 +13,13 @@
 /* This doesn't need to match anything */
 #define Py_fstring_input 800
 
+#ifndef Py_LIMITED_API
+#  define Py_CPYTHON_COMPILE_H
+#  include "cpython/compile.h"
+#  undef Py_CPYTHON_COMPILE_H
+#endif
+
+#ifdef __cplusplus
+}
+#endif
 #endif /* !Py_COMPILE_H */
diff --git a/Include/cpython/abstract.h b/Include/cpython/abstract.h
index 7bc8083..db85021 100644
--- a/Include/cpython/abstract.h
+++ b/Include/cpython/abstract.h
@@ -2,10 +2,6 @@
 #  error "this header file must not be included directly"
 #endif
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /* === Object Protocol ================================================== */
 
 #ifdef PY_SSIZE_T_CLEAN
@@ -67,7 +63,7 @@
 {
     PyTypeObject *tp;
     Py_ssize_t offset;
-    vectorcallfunc *ptr;
+    vectorcallfunc ptr;
 
     assert(callable != NULL);
     tp = Py_TYPE(callable);
@@ -77,8 +73,8 @@
     assert(PyCallable_Check(callable));
     offset = tp->tp_vectorcall_offset;
     assert(offset > 0);
-    ptr = (vectorcallfunc *)(((char *)callable) + offset);
-    return *ptr;
+    memcpy(&ptr, (char *) callable + offset, sizeof(ptr));
+    return ptr;
 }
 
 /* Call the callable object 'callable' with the "vectorcall" calling
@@ -123,7 +119,7 @@
 PyObject_Vectorcall(PyObject *callable, PyObject *const *args,
                      size_t nargsf, PyObject *kwnames)
 {
-    PyThreadState *tstate = PyThreadState_GET();
+    PyThreadState *tstate = PyThreadState_Get();
     return _PyObject_VectorcallTstate(tstate, callable,
                                       args, nargsf, kwnames);
 }
@@ -159,7 +155,7 @@
 static inline PyObject *
 _PyObject_FastCall(PyObject *func, PyObject *const *args, Py_ssize_t nargs)
 {
-    PyThreadState *tstate = PyThreadState_GET();
+    PyThreadState *tstate = PyThreadState_Get();
     return _PyObject_FastCallTstate(tstate, func, args, nargs);
 }
 
@@ -168,7 +164,7 @@
    PyObject_CallNoArgs(). */
 static inline PyObject *
 _PyObject_CallNoArg(PyObject *func) {
-    PyThreadState *tstate = PyThreadState_GET();
+    PyThreadState *tstate = PyThreadState_Get();
     return _PyObject_VectorcallTstate(tstate, func, NULL, 0, NULL);
 }
 
@@ -183,7 +179,7 @@
     assert(arg != NULL);
     args = _args + 1;  // For PY_VECTORCALL_ARGUMENTS_OFFSET
     args[0] = arg;
-    tstate = PyThreadState_GET();
+    tstate = PyThreadState_Get();
     nargsf = 1 | PY_VECTORCALL_ARGUMENTS_OFFSET;
     return _PyObject_VectorcallTstate(tstate, func, args, nargsf, NULL);
 }
@@ -329,12 +325,6 @@
 /* Releases a Py_buffer obtained from getbuffer ParseTuple's "s*". */
 PyAPI_FUNC(void) PyBuffer_Release(Py_buffer *view);
 
-/* ==== Iterators ================================================ */
-
-#define PyIter_Check(obj) \
-    (Py_TYPE(obj)->tp_iternext != NULL && \
-     Py_TYPE(obj)->tp_iternext != &_PyObject_NextNotImplemented)
-
 /* === Sequence protocol ================================================ */
 
 /* Assume tp_as_sequence and sq_item exist and that 'i' does not
@@ -379,6 +369,5 @@
 /* Convert Python int to Py_ssize_t. Do nothing if the argument is None. */
 PyAPI_FUNC(int) _Py_convert_optional_to_ssize_t(PyObject *, void *);
 
-#ifdef __cplusplus
-}
-#endif
+/* Same as PyNumber_Index but can return an instance of a subclass of int. */
+PyAPI_FUNC(PyObject *) _PyNumber_Index(PyObject *o);
diff --git a/Include/cpython/bytesobject.h b/Include/cpython/bytesobject.h
index f284c58..6b3f552 100644
--- a/Include/cpython/bytesobject.h
+++ b/Include/cpython/bytesobject.h
@@ -10,7 +10,7 @@
     /* Invariants:
      *     ob_sval contains space for 'ob_size+1' elements.
      *     ob_sval[ob_size] == 0.
-     *     ob_shash is the hash of the string or -1 if not computed yet.
+     *     ob_shash is the hash of the byte string or -1 if not computed yet.
      */
 } PyBytesObject;
 
diff --git a/Include/cpython/ceval.h b/Include/cpython/ceval.h
index e1922a6..0633892 100644
--- a/Include/cpython/ceval.h
+++ b/Include/cpython/ceval.h
@@ -2,10 +2,6 @@
 #  error "this header file must not be included directly"
 #endif
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 PyAPI_FUNC(void) PyEval_SetProfile(Py_tracefunc, PyObject *);
 PyAPI_DATA(int) _PyEval_SetProfile(PyThreadState *tstate, Py_tracefunc func, PyObject *arg);
 PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *);
@@ -32,7 +28,3 @@
 
 PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject *, Py_ssize_t *);
 PyAPI_FUNC(int) _PyEval_SliceIndexNotNone(PyObject *, Py_ssize_t *);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/Include/cpython/code.h b/Include/cpython/code.h
index cda28ac..fa64085 100644
--- a/Include/cpython/code.h
+++ b/Include/cpython/code.h
@@ -38,7 +38,7 @@
     Py_ssize_t *co_cell2arg;    /* Maps cell vars which are arguments. */
     PyObject *co_filename;      /* unicode (where it was loaded from) */
     PyObject *co_name;          /* unicode (name, for reference) */
-    PyObject *co_lnotab;        /* string (encoding addr<->lineno mapping) See
+    PyObject *co_linetable;     /* string (encoding addr<->lineno mapping) See
                                    Objects/lnotab_notes.txt for details. */
     void *co_zombieframe;       /* for optimization only (see frameobject.c) */
     PyObject *co_weakreflist;   /* to support weakrefs to code objects */
@@ -135,16 +135,23 @@
 PyAPI_FUNC(int) PyCode_Addr2Line(PyCodeObject *, int);
 
 /* for internal use only */
-typedef struct _addr_pair {
-        int ap_lower;
-        int ap_upper;
-} PyAddrPair;
+struct _opaque {
+    int computed_line;
+    const char *lo_next;
+    const char *limit;
+};
+
+typedef struct _line_offsets {
+    int ar_start;
+    int ar_end;
+    int ar_line;
+    struct _opaque opaque;
+} PyCodeAddressRange;
 
 /* Update *bounds to describe the first and one-past-the-last instructions in the
    same line as lasti.  Return the number of that line.
 */
-PyAPI_FUNC(int) _PyCode_CheckLineNumber(PyCodeObject* co,
-                                        int lasti, PyAddrPair *bounds);
+PyAPI_FUNC(int) _PyCode_CheckLineNumber(int lasti, PyCodeAddressRange *bounds);
 
 /* Create a comparable key used to compare constants taking in account the
  * object type. It is used to make sure types are not coerced (e.g., float and
@@ -163,3 +170,15 @@
                                  void **extra);
 PyAPI_FUNC(int) _PyCode_SetExtra(PyObject *code, Py_ssize_t index,
                                  void *extra);
+
+/** API for initializing the line number table. */
+int _PyCode_InitAddressRange(PyCodeObject* co, PyCodeAddressRange *bounds);
+
+/** Out of process API for initializing the line number table. */
+void PyLineTable_InitAddressRange(const char *linetable, Py_ssize_t length, int firstlineno, PyCodeAddressRange *range);
+
+/** API for traversing the line number table. */
+int PyLineTable_NextAddressRange(PyCodeAddressRange *range);
+int PyLineTable_PreviousAddressRange(PyCodeAddressRange *range);
+
+
diff --git a/Include/cpython/compile.h b/Include/cpython/compile.h
new file mode 100644
index 0000000..518a376
--- /dev/null
+++ b/Include/cpython/compile.h
@@ -0,0 +1,54 @@
+#ifndef Py_CPYTHON_COMPILE_H
+#  error "this header file must not be included directly"
+#endif
+
+/* Public interface */
+#define PyCF_MASK (CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | \
+                   CO_FUTURE_WITH_STATEMENT | CO_FUTURE_PRINT_FUNCTION | \
+                   CO_FUTURE_UNICODE_LITERALS | CO_FUTURE_BARRY_AS_BDFL | \
+                   CO_FUTURE_GENERATOR_STOP | CO_FUTURE_ANNOTATIONS)
+#define PyCF_MASK_OBSOLETE (CO_NESTED)
+
+/* bpo-39562: CO_FUTURE_ and PyCF_ constants must be kept unique.
+   PyCF_ constants can use bits from 0x0100 to 0x10000.
+   CO_FUTURE_ constants use bits starting at 0x20000. */
+#define PyCF_SOURCE_IS_UTF8  0x0100
+#define PyCF_DONT_IMPLY_DEDENT 0x0200
+#define PyCF_ONLY_AST 0x0400
+#define PyCF_IGNORE_COOKIE 0x0800
+#define PyCF_TYPE_COMMENTS 0x1000
+#define PyCF_ALLOW_TOP_LEVEL_AWAIT 0x2000
+#define PyCF_ALLOW_INCOMPLETE_INPUT 0x4000
+#define PyCF_COMPILE_MASK (PyCF_ONLY_AST | PyCF_ALLOW_TOP_LEVEL_AWAIT | \
+                           PyCF_TYPE_COMMENTS | PyCF_DONT_IMPLY_DEDENT | \
+                           PyCF_ALLOW_INCOMPLETE_INPUT)
+
+typedef struct {
+    int cf_flags;  /* bitmask of CO_xxx flags relevant to future */
+    int cf_feature_version;  /* minor Python version (PyCF_ONLY_AST) */
+} PyCompilerFlags;
+
+#define _PyCompilerFlags_INIT \
+    (PyCompilerFlags){.cf_flags = 0, .cf_feature_version = PY_MINOR_VERSION}
+
+/* Future feature support */
+
+typedef struct {
+    int ff_features;      /* flags set by future statements */
+    int ff_lineno;        /* line number of last future statement */
+} PyFutureFeatures;
+
+#define FUTURE_NESTED_SCOPES "nested_scopes"
+#define FUTURE_GENERATORS "generators"
+#define FUTURE_DIVISION "division"
+#define FUTURE_ABSOLUTE_IMPORT "absolute_import"
+#define FUTURE_WITH_STATEMENT "with_statement"
+#define FUTURE_PRINT_FUNCTION "print_function"
+#define FUTURE_UNICODE_LITERALS "unicode_literals"
+#define FUTURE_BARRY_AS_BDFL "barry_as_FLUFL"
+#define FUTURE_GENERATOR_STOP "generator_stop"
+#define FUTURE_ANNOTATIONS "annotations"
+
+#define PY_INVALID_STACK_EFFECT INT_MAX
+PyAPI_FUNC(int) PyCompile_OpcodeStackEffect(int opcode, int oparg);
+PyAPI_FUNC(int) PyCompile_OpcodeStackEffectWithJump(int opcode, int oparg, int jump);
diff --git a/Include/cpython/dictobject.h b/Include/cpython/dictobject.h
index e33a0d1..641d7bd 100644
--- a/Include/cpython/dictobject.h
+++ b/Include/cpython/dictobject.h
@@ -2,10 +2,6 @@
 #  error "this header file must not be included directly"
 #endif
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 typedef struct _dictkeysobject PyDictKeysObject;
 
 /* The ma_values pointer is NULL for a combined table
@@ -26,7 +22,7 @@
     /* If ma_values is NULL, the table is "combined": keys and values
        are stored in ma_keys.
 
-       If ma_values is not NULL, the table is splitted:
+       If ma_values is not NULL, the table is split:
        keys are stored in ma_keys and values are stored in ma_values */
     PyObject **ma_values;
 } PyDictObject;
@@ -45,13 +41,13 @@
 PyAPI_FUNC(int) _PyDict_DelItemIf(PyObject *mp, PyObject *key,
                                   int (*predicate)(PyObject *value));
 PyDictKeysObject *_PyDict_NewKeysForClass(void);
-PyAPI_FUNC(PyObject *) PyObject_GenericGetDict(PyObject *, void *);
 PyAPI_FUNC(int) _PyDict_Next(
     PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, Py_hash_t *hash);
 
 /* Get the number of items of a dictionary. */
 #define PyDict_GET_SIZE(mp)  (assert(PyDict_Check(mp)),((PyDictObject *)mp)->ma_used)
-PyAPI_FUNC(int) _PyDict_Contains(PyObject *mp, PyObject *key, Py_hash_t hash);
+PyAPI_FUNC(int) _PyDict_Contains_KnownHash(PyObject *, PyObject *, Py_hash_t);
+PyAPI_FUNC(int) _PyDict_ContainsId(PyObject *, struct _Py_Identifier *);
 PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused);
 PyAPI_FUNC(void) _PyDict_MaybeUntrack(PyObject *mp);
 PyAPI_FUNC(int) _PyDict_HasOnlyStringKeys(PyObject *mp);
@@ -68,7 +64,6 @@
    argument is raised.
 */
 PyAPI_FUNC(int) _PyDict_MergeEx(PyObject *mp, PyObject *other, int override);
-PyAPI_FUNC(PyObject *) _PyDict_GetItemId(PyObject *dp, struct _Py_Identifier *key);
 PyAPI_FUNC(int) _PyDict_SetItemId(PyObject *dp, struct _Py_Identifier *key, PyObject *item);
 
 PyAPI_FUNC(int) _PyDict_DelItemId(PyObject *mp, struct _Py_Identifier *key);
@@ -76,6 +71,7 @@
 
 int _PyObjectDict_SetItem(PyTypeObject *tp, PyObject **dictptr, PyObject *name, PyObject *value);
 PyObject *_PyDict_LoadGlobal(PyDictObject *, PyDictObject *, PyObject *);
+Py_ssize_t _PyDict_GetItemHint(PyDictObject *, PyObject *, Py_ssize_t, PyObject **);
 
 /* _PyDictView */
 
@@ -86,7 +82,3 @@
 
 PyAPI_FUNC(PyObject *) _PyDictView_New(PyObject *, PyTypeObject *);
 PyAPI_FUNC(PyObject *) _PyDictView_Intersect(PyObject* self, PyObject *other);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/Include/cpython/fileobject.h b/Include/cpython/fileobject.h
index 3005ce1..cff2243 100644
--- a/Include/cpython/fileobject.h
+++ b/Include/cpython/fileobject.h
@@ -2,10 +2,6 @@
 #  error "this header file must not be included directly"
 #endif
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 PyAPI_FUNC(char *) Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *);
 
 /* The std printer acts as a preliminary sys.stderr until the new io
@@ -19,6 +15,4 @@
 PyAPI_FUNC(PyObject *) PyFile_OpenCodeObject(PyObject *path);
 PyAPI_FUNC(int) PyFile_SetOpenCodeHook(Py_OpenCodeHookFunction hook, void *userData);
 
-#ifdef __cplusplus
-}
-#endif
+PyAPI_FUNC(int) _PyLong_FileDescriptor_Converter(PyObject *, void *);
diff --git a/Include/cpython/fileutils.h b/Include/cpython/fileutils.h
index e79d03e..ccf37e9 100644
--- a/Include/cpython/fileutils.h
+++ b/Include/cpython/fileutils.h
@@ -32,6 +32,9 @@
     int current_locale,
     _Py_error_handler errors);
 
+PyAPI_FUNC(char*) _Py_EncodeLocaleRaw(
+    const wchar_t *text,
+    size_t *error_pos);
 
 PyAPI_FUNC(PyObject *) _Py_device_encoding(int);
 
@@ -95,10 +98,6 @@
     const wchar_t *path,
     const wchar_t *mode);
 
-PyAPI_FUNC(FILE*) _Py_fopen(
-    const char *pathname,
-    const char *mode);
-
 PyAPI_FUNC(FILE*) _Py_fopen_obj(
     PyObject *path,
     const char *mode);
@@ -162,4 +161,12 @@
 PyAPI_FUNC(int) _Py_get_blocking(int fd);
 
 PyAPI_FUNC(int) _Py_set_blocking(int fd, int blocking);
-#endif   /* !MS_WINDOWS */
+#else   /* MS_WINDOWS */
+PyAPI_FUNC(void*) _Py_get_osfhandle_noraise(int fd);
+
+PyAPI_FUNC(void*) _Py_get_osfhandle(int fd);
+
+PyAPI_FUNC(int) _Py_open_osfhandle_noraise(void *handle, int flags);
+
+PyAPI_FUNC(int) _Py_open_osfhandle(void *handle, int flags);
+#endif  /* MS_WINDOWS */
diff --git a/Include/cpython/frameobject.h b/Include/cpython/frameobject.h
index 36a51ba..5122ec4 100644
--- a/Include/cpython/frameobject.h
+++ b/Include/cpython/frameobject.h
@@ -4,9 +4,20 @@
 #  error "this header file must not be included directly"
 #endif
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+/* These values are chosen so that the inline functions below all
+ * compare f_state to zero.
+ */
+enum _framestate {
+    FRAME_CREATED = -2,
+    FRAME_SUSPENDED = -1,
+    FRAME_EXECUTING = 0,
+    FRAME_RETURNED = 1,
+    FRAME_UNWINDING = 2,
+    FRAME_RAISED = 3,
+    FRAME_CLEARED = 4
+};
+
+typedef signed char PyFrameState;
 
 typedef struct {
     int b_type;                 /* what kind of block this is */
@@ -22,11 +33,8 @@
     PyObject *f_globals;        /* global symbol table (PyDictObject) */
     PyObject *f_locals;         /* local symbol table (any mapping) */
     PyObject **f_valuestack;    /* points after the last local */
-    /* Next free slot in f_valuestack.  Frame creation sets to f_valuestack.
-       Frame evaluation usually NULLs it, but a frame that yields sets it
-       to the current stack top. */
-    PyObject **f_stacktop;
     PyObject *f_trace;          /* Trace function */
+    int f_stackdepth;           /* Depth of value stack */
     char f_trace_lines;         /* Emit per-line trace events? */
     char f_trace_opcodes;       /* Emit per-opcode trace events? */
 
@@ -34,18 +42,24 @@
     PyObject *f_gen;
 
     int f_lasti;                /* Last instruction if called */
-    /* Call PyFrame_GetLineNumber() instead of reading this field
-       directly.  As of 2.3 f_lineno is only valid when tracing is
-       active (i.e. when f_trace is set).  At other times we use
-       PyCode_Addr2Line to calculate the line from the current
-       bytecode index. */
-    int f_lineno;               /* Current line number */
+    int f_lineno;               /* Current line number. Only valid if non-zero */
     int f_iblock;               /* index in f_blockstack */
-    char f_executing;           /* whether the frame is still executing */
+    PyFrameState f_state;       /* What state the frame is in */
     PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */
     PyObject *f_localsplus[1];  /* locals+stack, dynamically sized */
 };
 
+static inline int _PyFrame_IsRunnable(struct _frame *f) {
+    return f->f_state < FRAME_EXECUTING;
+}
+
+static inline int _PyFrame_IsExecuting(struct _frame *f) {
+    return f->f_state == FRAME_EXECUTING;
+}
+
+static inline int _PyFrameHasCompleted(struct _frame *f) {
+    return f->f_state > FRAME_EXECUTING;
+}
 
 /* Standard object interface */
 
@@ -57,8 +71,8 @@
                                         PyObject *, PyObject *);
 
 /* only internal use */
-PyFrameObject* _PyFrame_New_NoTrack(PyThreadState *, PyCodeObject *,
-                                    PyObject *, PyObject *);
+PyFrameObject*
+_PyFrame_New_NoTrack(PyThreadState *, PyFrameConstructor *, PyObject *);
 
 
 /* The rest of the interface is specific for frame objects */
@@ -78,7 +92,3 @@
 PyAPI_FUNC(void) _PyFrame_DebugMallocStats(FILE *out);
 
 PyAPI_FUNC(PyFrameObject *) PyFrame_GetBack(PyFrameObject *frame);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/Include/cpython/import.h b/Include/cpython/import.h
index c1b4712..dd5bbdb 100644
--- a/Include/cpython/import.h
+++ b/Include/cpython/import.h
@@ -2,10 +2,6 @@
 #  error "this header file must not be included directly"
 #endif
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 PyMODINIT_FUNC PyInit__imp(void);
 
 PyAPI_FUNC(int) _PyImport_IsInitialized(PyInterpreterState *);
@@ -17,7 +13,8 @@
 PyAPI_FUNC(void) _PyImport_AcquireLock(void);
 PyAPI_FUNC(int) _PyImport_ReleaseLock(void);
 
-PyAPI_FUNC(PyObject *) _PyImport_FindExtensionObject(PyObject *, PyObject *);
+/* Obsolete since 3.5, will be removed in 3.11. */
+Py_DEPRECATED(3.10) PyAPI_FUNC(PyObject *) _PyImport_FindExtensionObject(PyObject *, PyObject *);
 
 PyAPI_FUNC(int) _PyImport_FixupBuiltin(
     PyObject *mod,
@@ -44,7 +41,3 @@
    collection of frozen modules: */
 
 PyAPI_DATA(const struct _frozen *) PyImport_FrozenModules;
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/Include/cpython/initconfig.h b/Include/cpython/initconfig.h
index 0a256d4..583165b 100644
--- a/Include/cpython/initconfig.h
+++ b/Include/cpython/initconfig.h
@@ -44,7 +44,7 @@
 
 /* --- PyPreConfig ----------------------------------------------- */
 
-typedef struct {
+typedef struct PyPreConfig {
     int _config_init;     /* _PyConfigInitEnum value */
 
     /* Parse Py_PreInitializeFromBytesArgs() arguments?
@@ -130,298 +130,85 @@
 
 /* --- PyConfig ---------------------------------------------- */
 
-typedef struct {
+/* This structure is best documented in the Doc/c-api/init_config.rst file. */
+typedef struct PyConfig {
     int _config_init;     /* _PyConfigInitEnum value */
 
-    int isolated;         /* Isolated mode? see PyPreConfig.isolated */
-    int use_environment;  /* Use environment variables? see PyPreConfig.use_environment */
-    int dev_mode;         /* Python Development Mode? See PyPreConfig.dev_mode */
-
-    /* Install signal handlers? Yes by default. */
+    int isolated;
+    int use_environment;
+    int dev_mode;
     int install_signal_handlers;
-
-    int use_hash_seed;      /* PYTHONHASHSEED=x */
+    int use_hash_seed;
     unsigned long hash_seed;
-
-    /* Enable faulthandler?
-       Set to 1 by -X faulthandler and PYTHONFAULTHANDLER. -1 means unset. */
     int faulthandler;
-
-    /* Enable PEG parser?
-       1 by default, set to 0 by -X oldparser and PYTHONOLDPARSER */
-    int _use_peg_parser;
-
-    /* Enable tracemalloc?
-       Set by -X tracemalloc=N and PYTHONTRACEMALLOC. -1 means unset */
     int tracemalloc;
-
-    int import_time;        /* PYTHONPROFILEIMPORTTIME, -X importtime */
-    int show_ref_count;     /* -X showrefcount */
-    int dump_refs;          /* PYTHONDUMPREFS */
-    int malloc_stats;       /* PYTHONMALLOCSTATS */
-
-    /* Python filesystem encoding and error handler:
-       sys.getfilesystemencoding() and sys.getfilesystemencodeerrors().
-
-       Default encoding and error handler:
-
-       * if Py_SetStandardStreamEncoding() has been called: they have the
-         highest priority;
-       * PYTHONIOENCODING environment variable;
-       * The UTF-8 Mode uses UTF-8/surrogateescape;
-       * If Python forces the usage of the ASCII encoding (ex: C locale
-         or POSIX locale on FreeBSD or HP-UX), use ASCII/surrogateescape;
-       * locale encoding: ANSI code page on Windows, UTF-8 on Android and
-         VxWorks, LC_CTYPE locale encoding on other platforms;
-       * On Windows, "surrogateescape" error handler;
-       * "surrogateescape" error handler if the LC_CTYPE locale is "C" or "POSIX";
-       * "surrogateescape" error handler if the LC_CTYPE locale has been coerced
-         (PEP 538);
-       * "strict" error handler.
-
-       Supported error handlers: "strict", "surrogateescape" and
-       "surrogatepass". The surrogatepass error handler is only supported
-       if Py_DecodeLocale() and Py_EncodeLocale() use directly the UTF-8 codec;
-       it's only used on Windows.
-
-       initfsencoding() updates the encoding to the Python codec name.
-       For example, "ANSI_X3.4-1968" is replaced with "ascii".
-
-       On Windows, sys._enablelegacywindowsfsencoding() sets the
-       encoding/errors to mbcs/replace at runtime.
-
-
-       See Py_FileSystemDefaultEncoding and Py_FileSystemDefaultEncodeErrors.
-       */
+    int import_time;
+    int show_ref_count;
+    int dump_refs;
+    int malloc_stats;
     wchar_t *filesystem_encoding;
     wchar_t *filesystem_errors;
-
-    wchar_t *pycache_prefix;  /* PYTHONPYCACHEPREFIX, -X pycache_prefix=PATH */
-    int parse_argv;           /* Parse argv command line arguments? */
-
-    /* Command line arguments (sys.argv).
-
-       Set parse_argv to 1 to parse argv as Python command line arguments
-       and then strip Python arguments from argv.
-
-       If argv is empty, an empty string is added to ensure that sys.argv
-       always exists and is never empty. */
+    wchar_t *pycache_prefix;
+    int parse_argv;
+    PyWideStringList orig_argv;
     PyWideStringList argv;
-
-    /* Program name:
-
-       - If Py_SetProgramName() was called, use its value.
-       - On macOS, use PYTHONEXECUTABLE environment variable if set.
-       - If WITH_NEXT_FRAMEWORK macro is defined, use __PYVENV_LAUNCHER__
-         environment variable is set.
-       - Use argv[0] if available and non-empty.
-       - Use "python" on Windows, or "python3 on other platforms. */
-    wchar_t *program_name;
-
-    PyWideStringList xoptions;     /* Command line -X options */
-
-    /* Warnings options: lowest to highest priority. warnings.filters
-       is built in the reverse order (highest to lowest priority). */
+    PyWideStringList xoptions;
     PyWideStringList warnoptions;
-
-    /* If equal to zero, disable the import of the module site and the
-       site-dependent manipulations of sys.path that it entails. Also disable
-       these manipulations if site is explicitly imported later (call
-       site.main() if you want them to be triggered).
-
-       Set to 0 by the -S command line option. If set to -1 (default), it is
-       set to !Py_NoSiteFlag. */
     int site_import;
-
-    /* Bytes warnings:
-
-       * If equal to 1, issue a warning when comparing bytes or bytearray with
-         str or bytes with int.
-       * If equal or greater to 2, issue an error.
-
-       Incremented by the -b command line option. If set to -1 (default), inherit
-       Py_BytesWarningFlag value. */
     int bytes_warning;
-
-    /* If greater than 0, enable inspect: when a script is passed as first
-       argument or the -c option is used, enter interactive mode after
-       executing the script or the command, even when sys.stdin does not appear
-       to be a terminal.
-
-       Incremented by the -i command line option. Set to 1 if the PYTHONINSPECT
-       environment variable is non-empty. If set to -1 (default), inherit
-       Py_InspectFlag value. */
+    int warn_default_encoding;
     int inspect;
-
-    /* If greater than 0: enable the interactive mode (REPL).
-
-       Incremented by the -i command line option. If set to -1 (default),
-       inherit Py_InteractiveFlag value. */
     int interactive;
-
-    /* Optimization level.
-
-       Incremented by the -O command line option. Set by the PYTHONOPTIMIZE
-       environment variable. If set to -1 (default), inherit Py_OptimizeFlag
-       value. */
     int optimization_level;
-
-    /* If greater than 0, enable the debug mode: turn on parser debugging
-       output (for expert only, depending on compilation options).
-
-       Incremented by the -d command line option. Set by the PYTHONDEBUG
-       environment variable. If set to -1 (default), inherit Py_DebugFlag
-       value. */
     int parser_debug;
-
-    /* If equal to 0, Python won't try to write ``.pyc`` files on the
-       import of source modules.
-
-       Set to 0 by the -B command line option and the PYTHONDONTWRITEBYTECODE
-       environment variable. If set to -1 (default), it is set to
-       !Py_DontWriteBytecodeFlag. */
     int write_bytecode;
-
-    /* If greater than 0, enable the verbose mode: print a message each time a
-       module is initialized, showing the place (filename or built-in module)
-       from which it is loaded.
-
-       If greater or equal to 2, print a message for each file that is checked
-       for when searching for a module. Also provides information on module
-       cleanup at exit.
-
-       Incremented by the -v option. Set by the PYTHONVERBOSE environment
-       variable. If set to -1 (default), inherit Py_VerboseFlag value. */
     int verbose;
-
-    /* If greater than 0, enable the quiet mode: Don't display the copyright
-       and version messages even in interactive mode.
-
-       Incremented by the -q option. If set to -1 (default), inherit
-       Py_QuietFlag value. */
     int quiet;
-
-   /* If greater than 0, don't add the user site-packages directory to
-      sys.path.
-
-      Set to 0 by the -s and -I command line options , and the PYTHONNOUSERSITE
-      environment variable. If set to -1 (default), it is set to
-      !Py_NoUserSiteDirectory. */
     int user_site_directory;
-
-    /* If non-zero, configure C standard steams (stdio, stdout,
-       stderr):
-
-       - Set O_BINARY mode on Windows.
-       - If buffered_stdio is equal to zero, make streams unbuffered.
-         Otherwise, enable streams buffering if interactive is non-zero. */
     int configure_c_stdio;
-
-    /* If equal to 0, enable unbuffered mode: force the stdout and stderr
-       streams to be unbuffered.
-
-       Set to 0 by the -u option. Set by the PYTHONUNBUFFERED environment
-       variable.
-       If set to -1 (default), it is set to !Py_UnbufferedStdioFlag. */
     int buffered_stdio;
-
-    /* Encoding of sys.stdin, sys.stdout and sys.stderr.
-       Value set from PYTHONIOENCODING environment variable and
-       Py_SetStandardStreamEncoding() function.
-       See also 'stdio_errors' attribute. */
     wchar_t *stdio_encoding;
-
-    /* Error handler of sys.stdin and sys.stdout.
-       Value set from PYTHONIOENCODING environment variable and
-       Py_SetStandardStreamEncoding() function.
-       See also 'stdio_encoding' attribute. */
     wchar_t *stdio_errors;
-
 #ifdef MS_WINDOWS
-    /* If greater than zero, use io.FileIO instead of WindowsConsoleIO for sys
-       standard streams.
-
-       Set to 1 if the PYTHONLEGACYWINDOWSSTDIO environment variable is set to
-       a non-empty string. If set to -1 (default), inherit
-       Py_LegacyWindowsStdioFlag value.
-
-       See PEP 528 for more details. */
     int legacy_windows_stdio;
 #endif
-
-    /* Value of the --check-hash-based-pycs command line option:
-
-       - "default" means the 'check_source' flag in hash-based pycs
-         determines invalidation
-       - "always" causes the interpreter to hash the source file for
-         invalidation regardless of value of 'check_source' bit
-       - "never" causes the interpreter to always assume hash-based pycs are
-         valid
-
-       The default value is "default".
-
-       See PEP 552 "Deterministic pycs" for more details. */
     wchar_t *check_hash_pycs_mode;
 
     /* --- Path configuration inputs ------------ */
-
-    /* If greater than 0, suppress _PyPathConfig_Calculate() warnings on Unix.
-       The parameter has no effect on Windows.
-
-       If set to -1 (default), inherit !Py_FrozenFlag value. */
     int pathconfig_warnings;
-
-    wchar_t *pythonpath_env; /* PYTHONPATH environment variable */
-    wchar_t *home;          /* PYTHONHOME environment variable,
-                               see also Py_SetPythonHome(). */
+    wchar_t *program_name;
+    wchar_t *pythonpath_env;
+    wchar_t *home;
+    wchar_t *platlibdir;
 
     /* --- Path configuration outputs ----------- */
-
-    int module_search_paths_set;  /* If non-zero, use module_search_paths */
-    PyWideStringList module_search_paths;  /* sys.path paths. Computed if
-                                       module_search_paths_set is equal
-                                       to zero. */
-
-    wchar_t *executable;        /* sys.executable */
-    wchar_t *base_executable;   /* sys._base_executable */
-    wchar_t *prefix;            /* sys.prefix */
-    wchar_t *base_prefix;       /* sys.base_prefix */
-    wchar_t *exec_prefix;       /* sys.exec_prefix */
-    wchar_t *base_exec_prefix;  /* sys.base_exec_prefix */
-    wchar_t *platlibdir;        /* sys.platlibdir */
+    int module_search_paths_set;
+    PyWideStringList module_search_paths;
+    wchar_t *executable;
+    wchar_t *base_executable;
+    wchar_t *prefix;
+    wchar_t *base_prefix;
+    wchar_t *exec_prefix;
+    wchar_t *base_exec_prefix;
 
     /* --- Parameter only used by Py_Main() ---------- */
-
-    /* Skip the first line of the source ('run_filename' parameter), allowing use of non-Unix forms of
-       "#!cmd".  This is intended for a DOS specific hack only.
-
-       Set by the -x command line option. */
     int skip_source_first_line;
-
-    wchar_t *run_command;   /* -c command line argument */
-    wchar_t *run_module;    /* -m command line argument */
-    wchar_t *run_filename;  /* Trailing command line argument without -c or -m */
+    wchar_t *run_command;
+    wchar_t *run_module;
+    wchar_t *run_filename;
 
     /* --- Private fields ---------------------------- */
 
-    /* Install importlib? If set to 0, importlib is not initialized at all.
-       Needed by freeze_importlib. */
+    // Install importlib? If equals to 0, importlib is not initialized at all.
+    // Needed by freeze_importlib.
     int _install_importlib;
 
-    /* If equal to 0, stop Python initialization before the "main" phase */
+    // If equal to 0, stop Python initialization before the "main" phase.
     int _init_main;
 
-    /* If non-zero, disallow threads, subprocesses, and fork.
-       Default: 0. */
+    // If non-zero, disallow threads, subprocesses, and fork.
+    // Default: 0.
     int _isolated_interpreter;
-
-    /* Original command line arguments. If _orig_argv is empty and _argv is
-       not equal to [''], PyConfig_Read() copies the configuration 'argv' list
-       into '_orig_argv' list before modifying 'argv' list (if parse_argv
-       is non-zero).
-
-       _PyConfig_Write() initializes Py_GetArgcArgv() to this list. */
-    PyWideStringList _orig_argv;
 } PyConfig;
 
 PyAPI_FUNC(void) PyConfig_InitPythonConfig(PyConfig *config);
@@ -452,7 +239,7 @@
 
 /* Get the original command line arguments, before Python modified them.
 
-   See also PyConfig._orig_argv. */
+   See also PyConfig.orig_argv. */
 PyAPI_FUNC(void) Py_GetArgcArgv(int *argc, wchar_t ***argv);
 
 #ifdef __cplusplus
diff --git a/Include/cpython/interpreteridobject.h b/Include/cpython/interpreteridobject.h
index 67ec587..5076584 100644
--- a/Include/cpython/interpreteridobject.h
+++ b/Include/cpython/interpreteridobject.h
@@ -2,10 +2,6 @@
 #  error "this header file must not be included directly"
 #endif
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /* Interpreter ID Object */
 
 PyAPI_DATA(PyTypeObject) _PyInterpreterID_Type;
@@ -13,7 +9,3 @@
 PyAPI_FUNC(PyObject *) _PyInterpreterID_New(int64_t);
 PyAPI_FUNC(PyObject *) _PyInterpreterState_GetIDObject(PyInterpreterState *);
 PyAPI_FUNC(PyInterpreterState *) _PyInterpreterID_LookUp(PyObject *);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/Include/cpython/listobject.h b/Include/cpython/listobject.h
index 74fe330..e323915 100644
--- a/Include/cpython/listobject.h
+++ b/Include/cpython/listobject.h
@@ -2,10 +2,6 @@
 #  error "this header file must not be included directly"
 #endif
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 typedef struct {
     PyObject_VAR_HEAD
     /* Vector of pointers to list elements.  list[0] is ob_item[0], etc. */
@@ -30,14 +26,9 @@
 
 /* Macro, trading safety for speed */
 
-/* Cast argument to PyTupleObject* type. */
+/* Cast argument to PyListObject* type. */
 #define _PyList_CAST(op) (assert(PyList_Check(op)), (PyListObject *)(op))
 
 #define PyList_GET_ITEM(op, i) (_PyList_CAST(op)->ob_item[i])
-#define PyList_SET_ITEM(op, i, v) (_PyList_CAST(op)->ob_item[i] = (v))
+#define PyList_SET_ITEM(op, i, v) ((void)(_PyList_CAST(op)->ob_item[i] = (v)))
 #define PyList_GET_SIZE(op)    Py_SIZE(_PyList_CAST(op))
-#define _PyList_ITEMS(op)      (_PyList_CAST(op)->ob_item)
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/Include/cpython/object.h b/Include/cpython/object.h
index 444f832..84c60e5 100644
--- a/Include/cpython/object.h
+++ b/Include/cpython/object.h
@@ -2,10 +2,6 @@
 #  error "this header file must not be included directly"
 #endif
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 PyAPI_FUNC(void) _Py_NewReference(PyObject *op);
 
 #ifdef Py_TRACE_REFS
@@ -13,10 +9,6 @@
 PyAPI_FUNC(void) _Py_ForgetReference(PyObject *);
 #endif
 
-/* Update the Python traceback of an object. This function must be called
-   when a memory block is reused from a free list. */
-PyAPI_FUNC(int) _PyTraceMalloc_NewReference(PyObject *op);
-
 #ifdef Py_REF_DEBUG
 PyAPI_FUNC(Py_ssize_t) _Py_GetRefTotal(void);
 #endif
@@ -43,12 +35,13 @@
    _PyObject_{Get,Set,Has}AttrId are __getattr__ versions using _Py_Identifier*.
 */
 typedef struct _Py_Identifier {
-    struct _Py_Identifier *next;
     const char* string;
-    PyObject *object;
+    // Index in PyInterpreterState.unicode.ids.array. It is process-wide
+    // unique and must be initialized to -1.
+    Py_ssize_t index;
 } _Py_Identifier;
 
-#define _Py_static_string_init(value) { .next = NULL, .string = value, .object = NULL }
+#define _Py_static_string_init(value) { .string = value, .index = -1 }
 #define _Py_static_string(varname, value)  static _Py_Identifier varname = _Py_static_string_init(value)
 #define _Py_IDENTIFIER(varname) _Py_static_string(PyId_##varname, #varname)
 
@@ -175,10 +168,13 @@
     objobjargproc mp_ass_subscript;
 } PyMappingMethods;
 
+typedef PySendResult (*sendfunc)(PyObject *iter, PyObject *value, PyObject **result);
+
 typedef struct {
     unaryfunc am_await;
     unaryfunc am_aiter;
     unaryfunc am_anext;
+    sendfunc am_send;
 } PyAsyncMethods;
 
 typedef struct {
@@ -190,6 +186,8 @@
  * backwards-compatibility */
 typedef Py_ssize_t printfunc;
 
+// If this structure is modified, Doc/includes/typestruct.h should be updated
+// as well.
 struct _typeobject {
     PyObject_VAR_HEAD
     const char *tp_name; /* For printing, in format "<module>.<name>" */
@@ -249,6 +247,7 @@
     struct PyMethodDef *tp_methods;
     struct PyMemberDef *tp_members;
     struct PyGetSetDef *tp_getset;
+    // Strong reference on a heap type, borrowed reference on a static type
     struct _typeobject *tp_base;
     PyObject *tp_dict;
     descrgetfunc tp_descr_get;
@@ -304,6 +303,8 @@
 PyAPI_FUNC(PyTypeObject *) _PyType_CalculateMetaclass(PyTypeObject *, PyObject *);
 PyAPI_FUNC(PyObject *) _PyType_GetDocFromInternalDoc(const char *, const char *);
 PyAPI_FUNC(PyObject *) _PyType_GetTextSignatureFromInternalDoc(const char *, const char *);
+struct PyModuleDef;
+PyAPI_FUNC(PyObject *) _PyType_GetModuleByDef(PyTypeObject *, struct PyModuleDef *);
 
 struct _Py_Identifier;
 PyAPI_FUNC(int) PyObject_Print(PyObject *, FILE *, int);
@@ -314,7 +315,6 @@
 PyAPI_FUNC(int) _PyObject_IsAbstract(PyObject *);
 PyAPI_FUNC(PyObject *) _PyObject_GetAttrId(PyObject *, struct _Py_Identifier *);
 PyAPI_FUNC(int) _PyObject_SetAttrId(PyObject *, struct _Py_Identifier *, PyObject *);
-PyAPI_FUNC(int) _PyObject_HasAttrId(PyObject *, struct _Py_Identifier *);
 /* Replacements of PyObject_GetAttr() and _PyObject_GetAttrId() which
    don't raise AttributeError.
 
@@ -519,6 +519,8 @@
 /* Python 3.9 private API, invoked by the macros below. */
 PyAPI_FUNC(int) _PyTrash_begin(struct _ts *tstate, PyObject *op);
 PyAPI_FUNC(void) _PyTrash_end(struct _ts *tstate);
+/* Python 3.10 private API, invoked by the Py_TRASHCAN_BEGIN(). */
+PyAPI_FUNC(int) _PyTrash_cond(PyObject *op, destructor dealloc);
 
 #define PyTrash_UNWIND_LEVEL 50
 
@@ -528,7 +530,7 @@
         /* If "cond" is false, then _tstate remains NULL and the deallocator \
          * is run normally without involving the trashcan */ \
         if (cond) { \
-            _tstate = PyThreadState_GET(); \
+            _tstate = PyThreadState_Get(); \
             if (_PyTrash_begin(_tstate, _PyObject_CAST(op))) { \
                 break; \
             } \
@@ -542,13 +544,9 @@
 
 #define Py_TRASHCAN_BEGIN(op, dealloc) \
     Py_TRASHCAN_BEGIN_CONDITION(op, \
-        Py_TYPE(op)->tp_dealloc == (destructor)(dealloc))
+        _PyTrash_cond(_PyObject_CAST(op), (destructor)dealloc))
 
 /* For backwards compatibility, these macros enable the trashcan
  * unconditionally */
 #define Py_TRASHCAN_SAFE_BEGIN(op) Py_TRASHCAN_BEGIN_CONDITION(op, 1)
 #define Py_TRASHCAN_SAFE_END(op) Py_TRASHCAN_END
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/Include/cpython/objimpl.h b/Include/cpython/objimpl.h
index b835936..d83700e 100644
--- a/Include/cpython/objimpl.h
+++ b/Include/cpython/objimpl.h
@@ -2,10 +2,6 @@
 #  error "this header file must not be included directly"
 #endif
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #define _PyObject_SIZE(typeobj) ( (typeobj)->tp_basicsize )
 
 /* _PyObject_VAR_SIZE returns the number of bytes (as size_t) allocated for a
@@ -41,8 +37,9 @@
        PyObject *op;
 
        op = (PyObject *) Your_Allocator(_PyObject_SIZE(YourTypeStruct));
-       if (op == NULL)
-       return PyErr_NoMemory();
+       if (op == NULL) {
+           return PyErr_NoMemory();
+       }
 
        PyObject_Init(op, &YourTypeStruct);
 
@@ -55,40 +52,6 @@
    the 1st step is performed automatically for you, so in a C++ class
    constructor you would start directly with PyObject_Init/InitVar. */
 
-
-/* Inline functions trading binary compatibility for speed:
-   PyObject_INIT() is the fast version of PyObject_Init(), and
-   PyObject_INIT_VAR() is the fast version of PyObject_InitVar().
-
-   These inline functions must not be called with op=NULL. */
-static inline PyObject*
-_PyObject_INIT(PyObject *op, PyTypeObject *typeobj)
-{
-    assert(op != NULL);
-    Py_SET_TYPE(op, typeobj);
-    if (PyType_GetFlags(typeobj) & Py_TPFLAGS_HEAPTYPE) {
-        Py_INCREF(typeobj);
-    }
-    _Py_NewReference(op);
-    return op;
-}
-
-#define PyObject_INIT(op, typeobj) \
-    _PyObject_INIT(_PyObject_CAST(op), (typeobj))
-
-static inline PyVarObject*
-_PyObject_INIT_VAR(PyVarObject *op, PyTypeObject *typeobj, Py_ssize_t size)
-{
-    assert(op != NULL);
-    Py_SET_SIZE(op, size);
-    PyObject_INIT((PyObject *)op, typeobj);
-    return op;
-}
-
-#define PyObject_INIT_VAR(op, typeobj, size) \
-    _PyObject_INIT_VAR(_PyVarObject_CAST(op), (typeobj), (size))
-
-
 /* This function returns the number of allocated memory blocks, regardless of size */
 PyAPI_FUNC(Py_ssize_t) _Py_GetAllocatedBlocks(void);
 
@@ -116,10 +79,6 @@
 PyAPI_FUNC(void) PyObject_SetArenaAllocator(PyObjectArenaAllocator *allocator);
 
 
-PyAPI_FUNC(Py_ssize_t) _PyGC_CollectNoFail(void);
-PyAPI_FUNC(Py_ssize_t) _PyGC_CollectIfEnabled(void);
-
-
 /* Test if an object implements the garbage collector protocol */
 PyAPI_FUNC(int) PyObject_IS_GC(PyObject *obj);
 
@@ -139,7 +98,3 @@
 #define PyType_SUPPORTS_WEAKREFS(t) ((t)->tp_weaklistoffset > 0)
 
 PyAPI_FUNC(PyObject **) PyObject_GET_WEAKREFS_LISTPTR(PyObject *op);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/Include/odictobject.h b/Include/cpython/odictobject.h
similarity index 100%
rename from Include/odictobject.h
rename to Include/cpython/odictobject.h
diff --git a/Include/picklebufobject.h b/Include/cpython/picklebufobject.h
similarity index 100%
rename from Include/picklebufobject.h
rename to Include/cpython/picklebufobject.h
diff --git a/Include/pyctype.h b/Include/cpython/pyctype.h
similarity index 94%
rename from Include/pyctype.h
rename to Include/cpython/pyctype.h
index 6bce63e..729d932 100644
--- a/Include/pyctype.h
+++ b/Include/cpython/pyctype.h
@@ -1,6 +1,9 @@
 #ifndef Py_LIMITED_API
 #ifndef PYCTYPE_H
 #define PYCTYPE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 #define PY_CTF_LOWER  0x01
 #define PY_CTF_UPPER  0x02
@@ -29,5 +32,8 @@
 #define Py_TOLOWER(c) (_Py_ctype_tolower[Py_CHARMASK(c)])
 #define Py_TOUPPER(c) (_Py_ctype_toupper[Py_CHARMASK(c)])
 
+#ifdef __cplusplus
+}
+#endif
 #endif /* !PYCTYPE_H */
 #endif /* !Py_LIMITED_API */
diff --git a/Include/pydebug.h b/Include/cpython/pydebug.h
similarity index 100%
rename from Include/pydebug.h
rename to Include/cpython/pydebug.h
diff --git a/Include/cpython/pyerrors.h b/Include/cpython/pyerrors.h
index 9c87b53..3f95245 100644
--- a/Include/cpython/pyerrors.h
+++ b/Include/cpython/pyerrors.h
@@ -2,10 +2,6 @@
 #  error "this header file must not be included directly"
 #endif
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /* Error objects */
 
 /* PyException_HEAD defines the initial segment of every exception class. */
@@ -24,6 +20,8 @@
     PyObject *filename;
     PyObject *lineno;
     PyObject *offset;
+    PyObject *end_lineno;
+    PyObject *end_offset;
     PyObject *text;
     PyObject *print_file_and_line;
 } PySyntaxErrorObject;
@@ -66,6 +64,17 @@
     PyObject *value;
 } PyStopIterationObject;
 
+typedef struct {
+    PyException_HEAD
+    PyObject *name;
+} PyNameErrorObject;
+
+typedef struct {
+    PyException_HEAD
+    PyObject *obj;
+    PyObject *name;
+} PyAttributeErrorObject;
+
 /* Compatibility typedefs */
 typedef PyOSErrorObject PyEnvironmentErrorObject;
 #ifdef MS_WINDOWS
@@ -82,10 +91,6 @@
 
 PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *);
 
-/* */
-
-#define PyExceptionClass_Name(x)  (((PyTypeObject*)(x))->tp_name)
-
 /* Convenience functions */
 
 #ifdef MS_WINDOWS
@@ -145,6 +150,13 @@
     int lineno,
     int col_offset);
 
+PyAPI_FUNC(void) PyErr_RangedSyntaxLocationObject(
+    PyObject *filename,
+    int lineno,
+    int col_offset,
+    int end_lineno,
+    int end_col_offset);
+
 PyAPI_FUNC(PyObject *) PyErr_ProgramTextObject(
     PyObject *filename,
     int lineno);
@@ -173,6 +185,12 @@
     Py_ssize_t end,
     const char *reason          /* UTF-8 encoded string */
     );
+
+PyAPI_FUNC(PyObject *) _PyErr_ProgramDecodedTextObject(
+    PyObject *filename,
+    int lineno,
+    const char* encoding);
+
 PyAPI_FUNC(PyObject *) _PyUnicodeTranslateError_Create(
     PyObject *object,
     Py_ssize_t start,
@@ -194,7 +212,3 @@
     ...);
 
 #define Py_FatalError(message) _Py_FatalErrorFunc(__func__, message)
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/Include/pyfpe.h b/Include/cpython/pyfpe.h
similarity index 100%
rename from Include/pyfpe.h
rename to Include/cpython/pyfpe.h
diff --git a/Include/cpython/pylifecycle.h b/Include/cpython/pylifecycle.h
index eb523b8..5faeb35 100644
--- a/Include/cpython/pylifecycle.h
+++ b/Include/cpython/pylifecycle.h
@@ -2,9 +2,9 @@
 #  error "this header file must not be included directly"
 #endif
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+/* Py_FrozenMain is kept out of the Limited API until documented and present
+   in all builds of Python */
+PyAPI_FUNC(int) Py_FrozenMain(int argc, char **argv);
 
 /* Only used by applications that embed the interpreter and need to
  * override the standard encoding determination mechanism
@@ -39,15 +39,11 @@
 
 PyAPI_FUNC(void) _Py_NO_RETURN Py_ExitStatusException(PyStatus err);
 
-/* Py_PyAtExit is for the atexit module, Py_AtExit is for low-level
- * exit functions.
- */
-PyAPI_FUNC(void) _Py_PyAtExit(void (*func)(PyObject *), PyObject *);
-
 /* Restore signals that the interpreter has called SIG_IGN on to SIG_DFL. */
 PyAPI_FUNC(void) _Py_RestoreSignals(void);
 
 PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *);
+PyAPI_FUNC(int) _Py_FdIsInteractive(FILE *fp, PyObject *filename);
 
 PyAPI_FUNC(void) _Py_SetProgramFullPath(const wchar_t *);
 
@@ -66,7 +62,3 @@
 PyAPI_FUNC(char *) _Py_SetLocaleFromEnv(int category);
 
 PyAPI_FUNC(PyThreadState *) _Py_NewInterpreter(int isolated_subinterpreter);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/Include/cpython/pymem.h b/Include/cpython/pymem.h
index 79f063b..d1054d7 100644
--- a/Include/cpython/pymem.h
+++ b/Include/cpython/pymem.h
@@ -2,10 +2,6 @@
 #  error "this header file must not be included directly"
 #endif
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 PyAPI_FUNC(void *) PyMem_RawMalloc(size_t size);
 PyAPI_FUNC(void *) PyMem_RawCalloc(size_t nelem, size_t elsize);
 PyAPI_FUNC(void *) PyMem_RawRealloc(void *ptr, size_t new_size);
@@ -14,8 +10,6 @@
 /* Try to get the allocators name set by _PyMem_SetupAllocators(). */
 PyAPI_FUNC(const char*) _PyMem_GetCurrentAllocatorName(void);
 
-PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize);
-
 /* strdup() using PyMem_RawMalloc() */
 PyAPI_FUNC(char *) _PyMem_RawStrdup(const char *str);
 
@@ -102,7 +96,3 @@
 
    The function does nothing if Python is not compiled is debug mode. */
 PyAPI_FUNC(void) PyMem_SetupDebugHooks(void);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/Include/cpython/pystate.h b/Include/cpython/pystate.h
index f292da1..7c995b9 100644
--- a/Include/cpython/pystate.h
+++ b/Include/cpython/pystate.h
@@ -2,12 +2,6 @@
 #  error "this header file must not be included directly"
 #endif
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "cpython/initconfig.h"
-
 PyAPI_FUNC(int) _PyInterpreterState_RequiresIDRef(PyInterpreterState *);
 PyAPI_FUNC(void) _PyInterpreterState_RequireIDRef(PyInterpreterState *, int);
 
@@ -33,6 +27,21 @@
 #define PyTrace_OPCODE 7
 
 
+typedef struct _cframe {
+    /* This struct will be threaded through the C stack
+     * allowing fast access to per-thread state that needs
+     * to be accessed quickly by the interpreter, but can
+     * be modified outside of the interpreter.
+     *
+     * WARNING: This makes data on the C stack accessible from
+     * heap objects. Care must be taken to maintain stack
+     * discipline and make sure that instances of this struct cannot
+     * accessed outside of their lifetime.
+     */
+    int use_tracing;
+    struct _cframe *previous;
+} CFrame;
+
 typedef struct _err_stackitem {
     /* This struct represents an entry on the exception stack, which is a
      * per-coroutine state. (Coroutine in the computer science sense,
@@ -58,17 +67,17 @@
     /* Borrowed reference to the current frame (it can be NULL) */
     PyFrameObject *frame;
     int recursion_depth;
-    char overflowed; /* The stack has overflowed. Allow 50 more calls
-                        to handle the runtime error. */
-    char recursion_critical; /* The current calls must not cause
-                                a stack overflow. */
+    int recursion_headroom; /* Allow 50 more calls to handle any errors. */
     int stackcheck_counter;
 
     /* 'tracing' keeps track of the execution depth when tracing/profiling.
        This is to prevent the actual trace/profile code from being recorded in
        the trace/profile. */
     int tracing;
-    int use_tracing;
+
+    /* Pointer to current CFrame in the C stack frame of the currently,
+     * or most recently, executing _PyEval_EvalFrameDefault. */
+    CFrame *cframe;
 
     Py_tracefunc c_profilefunc;
     Py_tracefunc c_tracefunc;
@@ -136,6 +145,8 @@
     /* Unique thread state id. */
     uint64_t id;
 
+    CFrame root_cframe;
+
     /* XXX signal handlers should also be here */
 
 };
@@ -173,6 +184,11 @@
 */
 PyAPI_FUNC(PyObject *) _PyThread_CurrentFrames(void);
 
+/* The implementation of sys._current_exceptions()  Returns a dict mapping
+   thread id to that thread's current exception.
+*/
+PyAPI_FUNC(PyObject *) _PyThread_CurrentExceptions(void);
+
 /* Routines for advanced debuggers, requested by David Beazley.
    Don't use unless you know what you are doing! */
 PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Main(void);
@@ -194,7 +210,37 @@
 
 PyAPI_FUNC(const PyConfig*) _PyInterpreterState_GetConfig(PyInterpreterState *interp);
 
-// Get the configuration of the currrent interpreter.
+/* Get a copy of the current interpreter configuration.
+
+   Return 0 on success. Raise an exception and return -1 on error.
+
+   The caller must initialize 'config', using PyConfig_InitPythonConfig()
+   for example.
+
+   Python must be preinitialized to call this method.
+   The caller must hold the GIL. */
+PyAPI_FUNC(int) _PyInterpreterState_GetConfigCopy(
+    struct PyConfig *config);
+
+/* Set the configuration of the current interpreter.
+
+   This function should be called during or just after the Python
+   initialization.
+
+   Update the sys module with the new configuration. If the sys module was
+   modified directly after the Python initialization, these changes are lost.
+
+   Some configuration like faulthandler or warnoptions can be updated in the
+   configuration, but don't reconfigure Python (don't enable/disable
+   faulthandler and don't reconfigure warnings filters).
+
+   Return 0 on success. Raise an exception and return -1 on error.
+
+   The configuration should come from _PyInterpreterState_GetConfigCopy(). */
+PyAPI_FUNC(int) _PyInterpreterState_SetConfig(
+    const struct PyConfig *config);
+
+// Get the configuration of the current interpreter.
 // The caller must hold the GIL.
 PyAPI_FUNC(const PyConfig*) _Py_GetConfig(void);
 
@@ -257,7 +303,3 @@
 
 PyAPI_FUNC(int) _PyCrossInterpreterData_RegisterClass(PyTypeObject *, crossinterpdatafunc);
 PyAPI_FUNC(crossinterpdatafunc) _PyCrossInterpreterData_Lookup(PyObject *);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/Include/cpython/pythonrun.h b/Include/cpython/pythonrun.h
new file mode 100644
index 0000000..2e72d08
--- /dev/null
+++ b/Include/cpython/pythonrun.h
@@ -0,0 +1,121 @@
+#ifndef Py_CPYTHON_PYTHONRUN_H
+#  error "this header file must not be included directly"
+#endif
+
+PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *);
+PyAPI_FUNC(int) _PyRun_SimpleFileObject(
+    FILE *fp,
+    PyObject *filename,
+    int closeit,
+    PyCompilerFlags *flags);
+PyAPI_FUNC(int) PyRun_AnyFileExFlags(
+    FILE *fp,
+    const char *filename,       /* decoded from the filesystem encoding */
+    int closeit,
+    PyCompilerFlags *flags);
+PyAPI_FUNC(int) _PyRun_AnyFileObject(
+    FILE *fp,
+    PyObject *filename,
+    int closeit,
+    PyCompilerFlags *flags);
+PyAPI_FUNC(int) PyRun_SimpleFileExFlags(
+    FILE *fp,
+    const char *filename,       /* decoded from the filesystem encoding */
+    int closeit,
+    PyCompilerFlags *flags);
+PyAPI_FUNC(int) PyRun_InteractiveOneFlags(
+    FILE *fp,
+    const char *filename,       /* decoded from the filesystem encoding */
+    PyCompilerFlags *flags);
+PyAPI_FUNC(int) PyRun_InteractiveOneObject(
+    FILE *fp,
+    PyObject *filename,
+    PyCompilerFlags *flags);
+PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(
+    FILE *fp,
+    const char *filename,       /* decoded from the filesystem encoding */
+    PyCompilerFlags *flags);
+PyAPI_FUNC(int) _PyRun_InteractiveLoopObject(
+    FILE *fp,
+    PyObject *filename,
+    PyCompilerFlags *flags);
+
+
+PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *,
+                                         PyObject *, PyCompilerFlags *);
+
+PyAPI_FUNC(PyObject *) PyRun_FileExFlags(
+    FILE *fp,
+    const char *filename,       /* decoded from the filesystem encoding */
+    int start,
+    PyObject *globals,
+    PyObject *locals,
+    int closeit,
+    PyCompilerFlags *flags);
+
+
+PyAPI_FUNC(PyObject *) Py_CompileStringExFlags(
+    const char *str,
+    const char *filename,       /* decoded from the filesystem encoding */
+    int start,
+    PyCompilerFlags *flags,
+    int optimize);
+PyAPI_FUNC(PyObject *) Py_CompileStringObject(
+    const char *str,
+    PyObject *filename, int start,
+    PyCompilerFlags *flags,
+    int optimize);
+
+#define Py_CompileString(str, p, s) Py_CompileStringExFlags(str, p, s, NULL, -1)
+#define Py_CompileStringFlags(str, p, s, f) Py_CompileStringExFlags(str, p, s, f, -1)
+
+
+PyAPI_FUNC(const char *) _Py_SourceAsString(
+    PyObject *cmd,
+    const char *funcname,
+    const char *what,
+    PyCompilerFlags *cf,
+    PyObject **cmd_copy);
+
+
+/* A function flavor is also exported by libpython. It is required when
+    libpython is accessed directly rather than using header files which defines
+    macros below. On Windows, for example, PyAPI_FUNC() uses dllexport to
+    export functions in pythonXX.dll. */
+PyAPI_FUNC(PyObject *) PyRun_String(const char *str, int s, PyObject *g, PyObject *l);
+PyAPI_FUNC(int) PyRun_AnyFile(FILE *fp, const char *name);
+PyAPI_FUNC(int) PyRun_AnyFileEx(FILE *fp, const char *name, int closeit);
+PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *);
+PyAPI_FUNC(int) PyRun_SimpleString(const char *s);
+PyAPI_FUNC(int) PyRun_SimpleFile(FILE *f, const char *p);
+PyAPI_FUNC(int) PyRun_SimpleFileEx(FILE *f, const char *p, int c);
+PyAPI_FUNC(int) PyRun_InteractiveOne(FILE *f, const char *p);
+PyAPI_FUNC(int) PyRun_InteractiveLoop(FILE *f, const char *p);
+PyAPI_FUNC(PyObject *) PyRun_File(FILE *fp, const char *p, int s, PyObject *g, PyObject *l);
+PyAPI_FUNC(PyObject *) PyRun_FileEx(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, int c);
+PyAPI_FUNC(PyObject *) PyRun_FileFlags(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, PyCompilerFlags *flags);
+
+/* Use macros for a bunch of old variants */
+#define PyRun_String(str, s, g, l) PyRun_StringFlags(str, s, g, l, NULL)
+#define PyRun_AnyFile(fp, name) PyRun_AnyFileExFlags(fp, name, 0, NULL)
+#define PyRun_AnyFileEx(fp, name, closeit) \
+    PyRun_AnyFileExFlags(fp, name, closeit, NULL)
+#define PyRun_AnyFileFlags(fp, name, flags) \
+    PyRun_AnyFileExFlags(fp, name, 0, flags)
+#define PyRun_SimpleString(s) PyRun_SimpleStringFlags(s, NULL)
+#define PyRun_SimpleFile(f, p) PyRun_SimpleFileExFlags(f, p, 0, NULL)
+#define PyRun_SimpleFileEx(f, p, c) PyRun_SimpleFileExFlags(f, p, c, NULL)
+#define PyRun_InteractiveOne(f, p) PyRun_InteractiveOneFlags(f, p, NULL)
+#define PyRun_InteractiveLoop(f, p) PyRun_InteractiveLoopFlags(f, p, NULL)
+#define PyRun_File(fp, p, s, g, l) \
+    PyRun_FileExFlags(fp, p, s, g, l, 0, NULL)
+#define PyRun_FileEx(fp, p, s, g, l, c) \
+    PyRun_FileExFlags(fp, p, s, g, l, c, NULL)
+#define PyRun_FileFlags(fp, p, s, g, l, flags) \
+    PyRun_FileExFlags(fp, p, s, g, l, 0, flags)
+
+
+/* Stuff with no proper home (yet) */
+PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, const char *);
+PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState;
+PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, const char *);
diff --git a/Include/pytime.h b/Include/cpython/pytime.h
similarity index 89%
rename from Include/pytime.h
rename to Include/cpython/pytime.h
index bdda1da..754c7f4 100644
--- a/Include/pytime.h
+++ b/Include/cpython/pytime.h
@@ -2,9 +2,6 @@
 #ifndef Py_PYTIME_H
 #define Py_PYTIME_H
 
-#include "pyconfig.h" /* include for defines */
-#include "object.h"
-
 /**************************************************************************
 Symbols and macros to supply platform-independent interfaces to time related
 functions and constants
@@ -91,13 +88,13 @@
 PyAPI_FUNC(int) _PyTime_FromNanosecondsObject(_PyTime_t *t,
     PyObject *obj);
 
-/* Convert a number of seconds (Python float or int) to a timetamp.
+/* Convert a number of seconds (Python float or int) to a timestamp.
    Raise an exception and return -1 on error, return 0 on success. */
 PyAPI_FUNC(int) _PyTime_FromSecondsObject(_PyTime_t *t,
     PyObject *obj,
     _PyTime_round_t round);
 
-/* Convert a number of milliseconds (Python float or int, 10^-3) to a timetamp.
+/* Convert a number of milliseconds (Python float or int, 10^-3) to a timestamp.
    Raise an exception and return -1 on error, return 0 on success. */
 PyAPI_FUNC(int) _PyTime_FromMillisecondsObject(_PyTime_t *t,
     PyObject *obj,
@@ -164,22 +161,6 @@
     _PyTime_t mul,
     _PyTime_t div);
 
-/* Get the current time from the system clock.
-
-   The function cannot fail. _PyTime_Init() ensures that the system clock
-   works. */
-PyAPI_FUNC(_PyTime_t) _PyTime_GetSystemClock(void);
-
-/* Get the time of a monotonic clock, i.e. a clock that cannot go backwards.
-   The clock is not affected by system clock updates. The reference point of
-   the returned value is undefined, so that only the difference between the
-   results of consecutive calls is valid.
-
-   The function cannot fail. _PyTime_Init() ensures that a monotonic clock
-   is available and works. */
-PyAPI_FUNC(_PyTime_t) _PyTime_GetMonotonicClock(void);
-
-
 /* Structure used by time.get_clock_info() */
 typedef struct {
     const char *implementation;
@@ -189,8 +170,17 @@
 } _Py_clock_info_t;
 
 /* Get the current time from the system clock.
- * Fill clock information if info is not NULL.
- * Raise an exception and return -1 on error, return 0 on success.
+
+   If the internal clock fails, silently ignore the error and return 0.
+   On integer overflow, silently ignore the overflow and truncated the clock to
+   _PyTime_MIN or _PyTime_MAX.
+
+   Use _PyTime_GetSystemClockWithInfo() to check for failure. */
+PyAPI_FUNC(_PyTime_t) _PyTime_GetSystemClock(void);
+
+/* Get the current time from the system clock.
+ * On success, set *t and *info (if not NULL), and return 0.
+ * On error, raise an exception and return -1.
  */
 PyAPI_FUNC(int) _PyTime_GetSystemClockWithInfo(
     _PyTime_t *t,
@@ -201,6 +191,18 @@
    the returned value is undefined, so that only the difference between the
    results of consecutive calls is valid.
 
+   If the internal clock fails, silently ignore the error and return 0.
+   On integer overflow, silently ignore the overflow and truncated the clock to
+   _PyTime_MIN or _PyTime_MAX.
+
+   Use _PyTime_GetMonotonicClockWithInfo() to check for failure. */
+PyAPI_FUNC(_PyTime_t) _PyTime_GetMonotonicClock(void);
+
+/* Get the time of a monotonic clock, i.e. a clock that cannot go backwards.
+   The clock is not affected by system clock updates. The reference point of
+   the returned value is undefined, so that only the difference between the
+   results of consecutive calls is valid.
+
    Fill info (if set) with information of the function used to get the time.
 
    Return 0 on success, raise an exception and return -1 on error. */
@@ -209,10 +211,6 @@
     _Py_clock_info_t *info);
 
 
-/* Initialize time.
-   Return 0 on success, raise an exception and return -1 on error. */
-PyAPI_FUNC(int) _PyTime_Init(void);
-
 /* Converts a timestamp to the Gregorian time, using the local time zone.
    Return 0 on success, raise an exception and return -1 on error. */
 PyAPI_FUNC(int) _PyTime_localtime(time_t t, struct tm *tm);
@@ -224,8 +222,11 @@
 /* Get the performance counter: clock with the highest available resolution to
    measure a short duration.
 
-   The function cannot fail. _PyTime_Init() ensures that the system clock
-   works. */
+   If the internal clock fails, silently ignore the error and return 0.
+   On integer overflow, silently ignore the overflow and truncated the clock to
+   _PyTime_MIN or _PyTime_MAX.
+
+   Use _PyTime_GetPerfCounterWithInfo() to check for failure. */
 PyAPI_FUNC(_PyTime_t) _PyTime_GetPerfCounter(void);
 
 /* Get the performance counter: clock with the highest available resolution to
diff --git a/Include/cpython/sysmodule.h b/Include/cpython/sysmodule.h
index 1802b5b..fc4c899 100644
--- a/Include/cpython/sysmodule.h
+++ b/Include/cpython/sysmodule.h
@@ -2,10 +2,6 @@
 #  error "this header file must not be included directly"
 #endif
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 PyAPI_FUNC(PyObject *) _PySys_GetObjectId(_Py_Identifier *key);
 PyAPI_FUNC(int) _PySys_SetObjectId(_Py_Identifier *key, PyObject *);
 
@@ -18,7 +14,3 @@
     const char *argFormat,
     ...);
 PyAPI_FUNC(int) PySys_AddAuditHook(Py_AuditHookFunction, void*);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/Include/cpython/traceback.h b/Include/cpython/traceback.h
index 837470c..aac5b42 100644
--- a/Include/cpython/traceback.h
+++ b/Include/cpython/traceback.h
@@ -2,10 +2,6 @@
 #  error "this header file must not be included directly"
 #endif
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 typedef struct _traceback {
     PyObject_HEAD
     struct _traceback *tb_next;
@@ -16,7 +12,3 @@
 
 PyAPI_FUNC(int) _Py_DisplaySourceLine(PyObject *, PyObject *, int, int);
 PyAPI_FUNC(void) _PyTraceback_Add(const char *, const char *, int);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/Include/cpython/tupleobject.h b/Include/cpython/tupleobject.h
index 1565f2a..7cada88 100644
--- a/Include/cpython/tupleobject.h
+++ b/Include/cpython/tupleobject.h
@@ -2,10 +2,6 @@
 #  error "this header file must not be included directly"
 #endif
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 typedef struct {
     PyObject_VAR_HEAD
     /* ob_item contains space for 'ob_size' elements.
@@ -27,10 +23,6 @@
 #define PyTuple_GET_ITEM(op, i) (_PyTuple_CAST(op)->ob_item[i])
 
 /* Macro, *only* to be used to fill in brand new tuples */
-#define PyTuple_SET_ITEM(op, i, v) (_PyTuple_CAST(op)->ob_item[i] = v)
+#define PyTuple_SET_ITEM(op, i, v) ((void)(_PyTuple_CAST(op)->ob_item[i] = v))
 
 PyAPI_FUNC(void) _PyTuple_DebugMallocStats(FILE *out);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/Include/cpython/unicodeobject.h b/Include/cpython/unicodeobject.h
index 1fc732a..0761f01 100644
--- a/Include/cpython/unicodeobject.h
+++ b/Include/cpython/unicodeobject.h
@@ -2,10 +2,6 @@
 #  error "this header file must not be included directly"
 #endif
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /* Py_UNICODE was the native Unicode storage format (code unit) used by
    Python and represents a single Unicode element in the Unicode type.
    With PEP 393, Py_UNICODE is deprecated and replaced with a
@@ -15,6 +11,10 @@
 
 /* --- Internal Unicode Operations ---------------------------------------- */
 
+#ifndef USE_UNICODE_WCHAR_CACHE
+#  define USE_UNICODE_WCHAR_CACHE 1
+#endif /* USE_UNICODE_WCHAR_CACHE */
+
 /* Since splitting on whitespace is an important use case, and
    whitespace in most situations is solely ASCII whitespace, we
    optimize for the common case by using a quick look-up table
@@ -22,7 +22,7 @@
 
  */
 #define Py_UNICODE_ISSPACE(ch) \
-    ((ch) < 128U ? _Py_ascii_whitespace[(ch)] : _PyUnicode_IsWhitespace(ch))
+    ((Py_UCS4)(ch) < 128U ? _Py_ascii_whitespace[(ch)] : _PyUnicode_IsWhitespace(ch))
 
 #define Py_UNICODE_ISLOWER(ch) _PyUnicode_IsLowercase(ch)
 #define Py_UNICODE_ISUPPER(ch) _PyUnicode_IsUppercase(ch)
@@ -416,7 +416,7 @@
 
 
 /* Fast check to determine whether an object is ready. Equivalent to
-   PyUnicode_IS_COMPACT(op) || ((PyUnicodeObject*)(op))->data.any) */
+   PyUnicode_IS_COMPACT(op) || ((PyUnicodeObject*)(op))->data.any */
 
 #define PyUnicode_IS_READY(op) (((PyASCIIObject*)op)->state.ready)
 
@@ -583,7 +583,7 @@
 
 /* Similar to PyUnicode_AsUnicode(), but raises a ValueError if the string
    contains null characters. */
-Py_DEPRECATED(3.3) PyAPI_FUNC(const Py_UNICODE *) _PyUnicode_AsUnicode(
+PyAPI_FUNC(const Py_UNICODE *) _PyUnicode_AsUnicode(
     PyObject *unicode           /* Unicode object */
     );
 
@@ -597,9 +597,6 @@
     Py_ssize_t *size            /* location where to save the length */
     );
 
-/* Get the maximum ordinal for a Unicode character. */
-Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE) PyUnicode_GetMax(void);
-
 
 /* --- _PyUnicodeWriter API ----------------------------------------------- */
 
@@ -730,26 +727,6 @@
 /* --- Manage the default encoding ---------------------------------------- */
 
 /* Returns a pointer to the default encoding (UTF-8) of the
-   Unicode object unicode and the size of the encoded representation
-   in bytes stored in *size.
-
-   In case of an error, no *size is set.
-
-   This function caches the UTF-8 encoded string in the unicodeobject
-   and subsequent calls will return the same string.  The memory is released
-   when the unicodeobject is deallocated.
-
-   _PyUnicode_AsStringAndSize is a #define for PyUnicode_AsUTF8AndSize to
-   support the previous internal function with the same behaviour.
-*/
-
-PyAPI_FUNC(const char *) PyUnicode_AsUTF8AndSize(
-    PyObject *unicode,
-    Py_ssize_t *size);
-
-#define _PyUnicode_AsStringAndSize PyUnicode_AsUTF8AndSize
-
-/* Returns a pointer to the default encoding (UTF-8) of the
    Unicode object unicode.
 
    Like PyUnicode_AsUTF8AndSize(), this also caches the UTF-8 representation
@@ -760,13 +737,6 @@
 
    Use of this API is DEPRECATED since no size information can be
    extracted from the returned data.
-
-   *** This API is for interpreter INTERNAL USE ONLY and will likely
-   *** be removed or changed for Python 3.1.
-
-   *** If you need to access the Unicode object as UTF-8 bytes string,
-   *** please use PyUnicode_AsUTF8String() instead.
-
 */
 
 PyAPI_FUNC(const char *) PyUnicode_AsUTF8(PyObject *unicode);
@@ -864,12 +834,21 @@
 
 /* --- Unicode-Escape Codecs ---------------------------------------------- */
 
-/* Helper for PyUnicode_DecodeUnicodeEscape that detects invalid escape
-   chars. */
-PyAPI_FUNC(PyObject*) _PyUnicode_DecodeUnicodeEscape(
+/* Variant of PyUnicode_DecodeUnicodeEscape that supports partial decoding. */
+PyAPI_FUNC(PyObject*) _PyUnicode_DecodeUnicodeEscapeStateful(
         const char *string,     /* Unicode-Escape encoded string */
         Py_ssize_t length,      /* size of string */
         const char *errors,     /* error handling */
+        Py_ssize_t *consumed    /* bytes consumed */
+);
+
+/* Helper for PyUnicode_DecodeUnicodeEscape that detects invalid escape
+   chars. */
+PyAPI_FUNC(PyObject*) _PyUnicode_DecodeUnicodeEscapeInternal(
+        const char *string,     /* Unicode-Escape encoded string */
+        Py_ssize_t length,      /* size of string */
+        const char *errors,     /* error handling */
+        Py_ssize_t *consumed,   /* bytes consumed */
         const char **first_invalid_escape  /* on return, points to first
                                               invalid escaped char in
                                               string. */
@@ -887,6 +866,14 @@
     Py_ssize_t length           /* Number of Py_UNICODE chars to encode */
     );
 
+/* Variant of PyUnicode_DecodeRawUnicodeEscape that supports partial decoding. */
+PyAPI_FUNC(PyObject*) _PyUnicode_DecodeRawUnicodeEscapeStateful(
+        const char *string,     /* Unicode-Escape encoded string */
+        Py_ssize_t length,      /* size of string */
+        const char *errors,     /* error handling */
+        Py_ssize_t *consumed    /* bytes consumed */
+);
+
 /* --- Latin-1 Codecs ----------------------------------------------------- */
 
 PyAPI_FUNC(PyObject*) _PyUnicode_AsLatin1String(
@@ -1167,53 +1154,8 @@
     Py_UCS4 ch       /* Unicode character */
     );
 
-Py_DEPRECATED(3.3) PyAPI_FUNC(size_t) Py_UNICODE_strlen(
-    const Py_UNICODE *u
-    );
-
-Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strcpy(
-    Py_UNICODE *s1,
-    const Py_UNICODE *s2);
-
-Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strcat(
-    Py_UNICODE *s1, const Py_UNICODE *s2);
-
-Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strncpy(
-    Py_UNICODE *s1,
-    const Py_UNICODE *s2,
-    size_t n);
-
-Py_DEPRECATED(3.3) PyAPI_FUNC(int) Py_UNICODE_strcmp(
-    const Py_UNICODE *s1,
-    const Py_UNICODE *s2
-    );
-
-Py_DEPRECATED(3.3) PyAPI_FUNC(int) Py_UNICODE_strncmp(
-    const Py_UNICODE *s1,
-    const Py_UNICODE *s2,
-    size_t n
-    );
-
-Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strchr(
-    const Py_UNICODE *s,
-    Py_UNICODE c
-    );
-
-Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strrchr(
-    const Py_UNICODE *s,
-    Py_UNICODE c
-    );
-
 PyAPI_FUNC(PyObject*) _PyUnicode_FormatLong(PyObject *, int, int, int);
 
-/* Create a copy of a unicode string ending with a nul character. Return NULL
-   and raise a MemoryError exception on memory allocation failure, otherwise
-   return a new allocated buffer (use PyMem_Free() to free the buffer). */
-
-Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE*) PyUnicode_AsUnicodeCopy(
-    PyObject *unicode
-    );
-
 /* Return an interned Unicode object for an Identifier; may fail if there is no memory.*/
 PyAPI_FUNC(PyObject*) _PyUnicode_FromId(_Py_Identifier*);
 
@@ -1221,8 +1163,7 @@
    and where the hash values are equal (i.e. a very probable match) */
 PyAPI_FUNC(int) _PyUnicode_EQ(PyObject *, PyObject *);
 
-PyAPI_FUNC(Py_ssize_t) _PyUnicode_ScanIdentifier(PyObject *);
+PyAPI_FUNC(int) _PyUnicode_WideCharString_Converter(PyObject *, void *);
+PyAPI_FUNC(int) _PyUnicode_WideCharString_Opt_Converter(PyObject *, void *);
 
-#ifdef __cplusplus
-}
-#endif
+PyAPI_FUNC(Py_ssize_t) _PyUnicode_ScanIdentifier(PyObject *);
diff --git a/Include/datetime.h b/Include/datetime.h
index 5d9f255..bb56520 100644
--- a/Include/datetime.h
+++ b/Include/datetime.h
@@ -115,6 +115,10 @@
 
 
 /* Apply for date and datetime instances. */
+
+// o is a pointer to a time or a datetime object.
+#define _PyDateTime_HAS_TZINFO(o)  (((_PyDateTime_BaseTZInfo *)(o))->hastzinfo)
+
 #define PyDateTime_GET_YEAR(o)     ((((PyDateTime_Date*)o)->data[0] << 8) | \
                      ((PyDateTime_Date*)o)->data[1])
 #define PyDateTime_GET_MONTH(o)    (((PyDateTime_Date*)o)->data[2])
@@ -128,6 +132,8 @@
      (((PyDateTime_DateTime*)o)->data[8] << 8)  |       \
       ((PyDateTime_DateTime*)o)->data[9])
 #define PyDateTime_DATE_GET_FOLD(o)        (((PyDateTime_DateTime*)o)->fold)
+#define PyDateTime_DATE_GET_TZINFO(o)      (_PyDateTime_HAS_TZINFO(o) ? \
+    ((PyDateTime_DateTime *)(o))->tzinfo : Py_None)
 
 /* Apply for time instances. */
 #define PyDateTime_TIME_GET_HOUR(o)        (((PyDateTime_Time*)o)->data[0])
@@ -138,6 +144,8 @@
      (((PyDateTime_Time*)o)->data[4] << 8)  |           \
       ((PyDateTime_Time*)o)->data[5])
 #define PyDateTime_TIME_GET_FOLD(o)        (((PyDateTime_Time*)o)->fold)
+#define PyDateTime_TIME_GET_TZINFO(o)      (_PyDateTime_HAS_TZINFO(o) ? \
+    ((PyDateTime_Time *)(o))->tzinfo : Py_None)
 
 /* Apply for time delta instances */
 #define PyDateTime_DELTA_GET_DAYS(o)         (((PyDateTime_Delta*)o)->days)
diff --git a/Include/descrobject.h b/Include/descrobject.h
index ead269d..703bc8f 100644
--- a/Include/descrobject.h
+++ b/Include/descrobject.h
@@ -93,7 +93,7 @@
 #ifndef Py_LIMITED_API
 PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *,
                                                 struct wrapperbase *, void *);
-#define PyDescr_IsData(d) (Py_TYPE(d)->tp_descr_set != NULL)
+PyAPI_FUNC(int) PyDescr_IsData(PyObject *);
 #endif
 
 PyAPI_FUNC(PyObject *) PyDictProxy_New(PyObject *);
diff --git a/Include/dictobject.h b/Include/dictobject.h
index c88b0aa..da5a36b 100644
--- a/Include/dictobject.h
+++ b/Include/dictobject.h
@@ -57,6 +57,9 @@
 PyAPI_FUNC(PyObject *) PyDict_GetItemString(PyObject *dp, const char *key);
 PyAPI_FUNC(int) PyDict_SetItemString(PyObject *dp, const char *key, PyObject *item);
 PyAPI_FUNC(int) PyDict_DelItemString(PyObject *dp, const char *key);
+#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030A0000
+PyAPI_FUNC(PyObject *) PyObject_GenericGetDict(PyObject *, void *);
+#endif
 
 /* Dictionary (keys, values, items) views */
 
diff --git a/Include/errcode.h b/Include/errcode.h
index 790518b..54ae929 100644
--- a/Include/errcode.h
+++ b/Include/errcode.h
@@ -30,6 +30,7 @@
 #define E_EOLS          24      /* EOL in single-quoted string */
 #define E_LINECONT      25      /* Unexpected characters after a line continuation */
 #define E_BADSINGLE     27      /* Ill-formed single statement input */
+#define E_INTERACT_STOP 28      /* Interactive mode stopped tokenization */
 
 #ifdef __cplusplus
 }
diff --git a/Include/eval.h b/Include/eval.h
index 2c1c2d0..eda28df 100644
--- a/Include/eval.h
+++ b/Include/eval.h
@@ -18,16 +18,6 @@
                                          PyObject *kwdefs, PyObject *closure);
 
 #ifndef Py_LIMITED_API
-PyAPI_FUNC(PyObject *) _PyEval_EvalCodeWithName(
-    PyObject *co,
-    PyObject *globals, PyObject *locals,
-    PyObject *const *args, Py_ssize_t argcount,
-    PyObject *const *kwnames, PyObject *const *kwargs,
-    Py_ssize_t kwcount, int kwstep,
-    PyObject *const *defs, Py_ssize_t defcount,
-    PyObject *kwdefs, PyObject *closure,
-    PyObject *name, PyObject *qualname);
-
 PyAPI_FUNC(PyObject *) _PyEval_CallTracing(PyObject *func, PyObject *args);
 #endif
 
diff --git a/Include/fileutils.h b/Include/fileutils.h
index 12bd071..16f3b63 100644
--- a/Include/fileutils.h
+++ b/Include/fileutils.h
@@ -12,10 +12,6 @@
 PyAPI_FUNC(char*) Py_EncodeLocale(
     const wchar_t *text,
     size_t *error_pos);
-
-PyAPI_FUNC(char*) _Py_EncodeLocaleRaw(
-    const wchar_t *text,
-    size_t *error_pos);
 #endif
 
 #ifndef Py_LIMITED_API
diff --git a/Include/funcobject.h b/Include/funcobject.h
index c5cc9d2..d7acd18 100644
--- a/Include/funcobject.h
+++ b/Include/funcobject.h
@@ -7,6 +7,21 @@
 extern "C" {
 #endif
 
+
+#define COMMON_FIELDS(PREFIX) \
+    PyObject *PREFIX ## globals; \
+    PyObject *PREFIX ## builtins; \
+    PyObject *PREFIX ## name; \
+    PyObject *PREFIX ## qualname; \
+    PyObject *PREFIX ## code;        /* A code object, the __code__ attribute */ \
+    PyObject *PREFIX ## defaults;    /* NULL or a tuple */ \
+    PyObject *PREFIX ## kwdefaults;  /* NULL or a dict */ \
+    PyObject *PREFIX ## closure;     /* NULL or a tuple of cell objects */
+
+typedef struct {
+    COMMON_FIELDS(fc_)
+} PyFrameConstructor;
+
 /* Function objects and code objects should not be confused with each other:
  *
  * Function objects are created by the execution of the 'def' statement.
@@ -20,18 +35,12 @@
 
 typedef struct {
     PyObject_HEAD
-    PyObject *func_code;        /* A code object, the __code__ attribute */
-    PyObject *func_globals;     /* A dictionary (other mappings won't do) */
-    PyObject *func_defaults;    /* NULL or a tuple */
-    PyObject *func_kwdefaults;  /* NULL or a dict */
-    PyObject *func_closure;     /* NULL or a tuple of cell objects */
+    COMMON_FIELDS(func_)
     PyObject *func_doc;         /* The __doc__ attribute, can be anything */
-    PyObject *func_name;        /* The __name__ attribute, a string object */
     PyObject *func_dict;        /* The __dict__ attribute, a dict or NULL */
     PyObject *func_weakreflist; /* List of weak references */
     PyObject *func_module;      /* The __module__ attribute, can be anything */
     PyObject *func_annotations; /* Annotations, a dict or NULL */
-    PyObject *func_qualname;    /* The qualified name */
     vectorcallfunc vectorcall;
 
     /* Invariant:
@@ -84,6 +93,9 @@
 #define PyFunction_GET_ANNOTATIONS(func) \
         (((PyFunctionObject *)func) -> func_annotations)
 
+#define PyFunction_AS_FRAME_CONSTRUCTOR(func) \
+        ((PyFrameConstructor *)&((PyFunctionObject *)(func))->func_globals)
+
 /* The classmethod and staticmethod types lives here, too */
 PyAPI_DATA(PyTypeObject) PyClassMethod_Type;
 PyAPI_DATA(PyTypeObject) PyStaticMethod_Type;
diff --git a/Include/genobject.h b/Include/genobject.h
index 8ffd156..e965334 100644
--- a/Include/genobject.h
+++ b/Include/genobject.h
@@ -9,6 +9,7 @@
 #endif
 
 #include "pystate.h"   /* _PyErr_StackItem */
+#include "abstract.h" /* PySendResult */
 
 /* _PyGenObject_HEAD defines the initial segment of generator
    and coroutine objects. */
@@ -16,8 +17,6 @@
     PyObject_HEAD                                                           \
     /* Note: gi_frame can be NULL if the generator is "finished" */         \
     PyFrameObject *prefix##_frame;                                          \
-    /* True if generator is being executed. */                              \
-    char prefix##_running;                                                  \
     /* The code object backing the generator */                             \
     PyObject *prefix##_code;                                                \
     /* List of weak reference. */                                           \
@@ -43,7 +42,6 @@
     PyObject *name, PyObject *qualname);
 PyAPI_FUNC(int) _PyGen_SetStopIterationValue(PyObject *);
 PyAPI_FUNC(int) _PyGen_FetchStopIterationValue(PyObject **);
-PyAPI_FUNC(PyObject *) _PyGen_Send(PyGenObject *, PyObject *);
 PyObject *_PyGen_yf(PyGenObject *);
 PyAPI_FUNC(void) _PyGen_Finalize(PyObject *self);
 
diff --git a/Include/graminit.h b/Include/graminit.h
deleted file mode 100644
index d1027b7..0000000
--- a/Include/graminit.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* Generated by Parser/pgen */
-
-#define single_input 256
-#define file_input 257
-#define eval_input 258
-#define decorator 259
-#define decorators 260
-#define decorated 261
-#define async_funcdef 262
-#define funcdef 263
-#define parameters 264
-#define typedargslist 265
-#define tfpdef 266
-#define varargslist 267
-#define vfpdef 268
-#define stmt 269
-#define simple_stmt 270
-#define small_stmt 271
-#define expr_stmt 272
-#define annassign 273
-#define testlist_star_expr 274
-#define augassign 275
-#define del_stmt 276
-#define pass_stmt 277
-#define flow_stmt 278
-#define break_stmt 279
-#define continue_stmt 280
-#define return_stmt 281
-#define yield_stmt 282
-#define raise_stmt 283
-#define import_stmt 284
-#define import_name 285
-#define import_from 286
-#define import_as_name 287
-#define dotted_as_name 288
-#define import_as_names 289
-#define dotted_as_names 290
-#define dotted_name 291
-#define global_stmt 292
-#define nonlocal_stmt 293
-#define assert_stmt 294
-#define compound_stmt 295
-#define async_stmt 296
-#define if_stmt 297
-#define while_stmt 298
-#define for_stmt 299
-#define try_stmt 300
-#define with_stmt 301
-#define with_item 302
-#define except_clause 303
-#define suite 304
-#define namedexpr_test 305
-#define test 306
-#define test_nocond 307
-#define lambdef 308
-#define lambdef_nocond 309
-#define or_test 310
-#define and_test 311
-#define not_test 312
-#define comparison 313
-#define comp_op 314
-#define star_expr 315
-#define expr 316
-#define xor_expr 317
-#define and_expr 318
-#define shift_expr 319
-#define arith_expr 320
-#define term 321
-#define factor 322
-#define power 323
-#define atom_expr 324
-#define atom 325
-#define testlist_comp 326
-#define trailer 327
-#define subscriptlist 328
-#define subscript 329
-#define sliceop 330
-#define exprlist 331
-#define testlist 332
-#define dictorsetmaker 333
-#define classdef 334
-#define arglist 335
-#define argument 336
-#define comp_iter 337
-#define sync_comp_for 338
-#define comp_for 339
-#define comp_if 340
-#define encoding_decl 341
-#define yield_expr 342
-#define yield_arg 343
-#define func_body_suite 344
-#define func_type_input 345
-#define func_type 346
-#define typelist 347
diff --git a/Include/grammar.h b/Include/grammar.h
deleted file mode 100644
index 4b66b1e..0000000
--- a/Include/grammar.h
+++ /dev/null
@@ -1,77 +0,0 @@
-
-/* Grammar interface */
-
-#ifndef Py_GRAMMAR_H
-#define Py_GRAMMAR_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "bitset.h" /* Sigh... */
-
-/* A label of an arc */
-
-typedef struct {
-    int          lb_type;
-    const char  *lb_str;
-} label;
-
-#define EMPTY 0         /* Label number 0 is by definition the empty label */
-
-/* A list of labels */
-
-typedef struct {
-    int          ll_nlabels;
-    const label *ll_label;
-} labellist;
-
-/* An arc from one state to another */
-
-typedef struct {
-    short       a_lbl;          /* Label of this arc */
-    short       a_arrow;        /* State where this arc goes to */
-} arc;
-
-/* A state in a DFA */
-
-typedef struct {
-    int          s_narcs;
-    const arc   *s_arc;         /* Array of arcs */
-
-    /* Optional accelerators */
-    int          s_lower;       /* Lowest label index */
-    int          s_upper;       /* Highest label index */
-    int         *s_accel;       /* Accelerator */
-    int          s_accept;      /* Nonzero for accepting state */
-} state;
-
-/* A DFA */
-
-typedef struct {
-    int          d_type;        /* Non-terminal this represents */
-    char        *d_name;        /* For printing */
-    int          d_nstates;
-    state       *d_state;       /* Array of states */
-    bitset       d_first;
-} dfa;
-
-/* A grammar */
-
-typedef struct {
-    int          g_ndfas;
-    const dfa   *g_dfa;         /* Array of DFAs */
-    const labellist g_ll;
-    int          g_start;       /* Start symbol of the grammar */
-    int          g_accel;       /* Set if accelerators present */
-} grammar;
-
-/* FUNCTIONS */
-const dfa *PyGrammar_FindDFA(grammar *g, int type);
-const char *PyGrammar_LabelRepr(label *lb);
-void PyGrammar_AddAccelerators(grammar *g);
-void PyGrammar_RemoveAccelerators(grammar *);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* !Py_GRAMMAR_H */
diff --git a/Include/internal/pegen_interface.h b/Include/internal/pegen_interface.h
deleted file mode 100644
index ee4c77e..0000000
--- a/Include/internal/pegen_interface.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef Py_PEGENINTERFACE
-#define Py_PEGENINTERFACE
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef Py_BUILD_CORE
-#  error "this header requires Py_BUILD_CORE define"
-#endif
-
-#include "Python.h"
-#include "Python-ast.h"
-
-PyAPI_FUNC(mod_ty) PyPegen_ASTFromString(
-    const char *str,
-    const char *filename,
-    int mode,
-    PyCompilerFlags *flags,
-    PyArena *arena);
-PyAPI_FUNC(mod_ty) PyPegen_ASTFromStringObject(
-    const char *str,
-    PyObject* filename,
-    int mode,
-    PyCompilerFlags *flags,
-    PyArena *arena);
-PyAPI_FUNC(mod_ty) PyPegen_ASTFromFileObject(
-    FILE *fp,
-    PyObject *filename_ob,
-    int mode,
-    const char *enc,
-    const char *ps1,
-    const char *ps2,
-    PyCompilerFlags *flags,
-    int *errcode,
-    PyArena *arena);
-PyAPI_FUNC(mod_ty) PyPegen_ASTFromFilename(
-    const char *filename,
-    int mode,
-    PyCompilerFlags *flags,
-    PyArena *arena);
-
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* !Py_PEGENINTERFACE*/
diff --git a/Include/internal/pycore_asdl.h b/Include/internal/pycore_asdl.h
new file mode 100644
index 0000000..c0b07c3
--- /dev/null
+++ b/Include/internal/pycore_asdl.h
@@ -0,0 +1,112 @@
+#ifndef Py_INTERNAL_ASDL_H
+#define Py_INTERNAL_ASDL_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef Py_BUILD_CORE
+#  error "this header requires Py_BUILD_CORE define"
+#endif
+
+#include "pycore_pyarena.h"       // _PyArena_Malloc()
+
+typedef PyObject * identifier;
+typedef PyObject * string;
+typedef PyObject * object;
+typedef PyObject * constant;
+
+/* It would be nice if the code generated by asdl_c.py was completely
+   independent of Python, but it is a goal the requires too much work
+   at this stage.  So, for example, I'll represent identifiers as
+   interned Python strings.
+*/
+
+#define _ASDL_SEQ_HEAD \
+    Py_ssize_t size;   \
+    void **elements;
+
+typedef struct {
+    _ASDL_SEQ_HEAD
+} asdl_seq;
+
+typedef struct {
+    _ASDL_SEQ_HEAD
+    void *typed_elements[1];
+} asdl_generic_seq;
+
+typedef struct {
+    _ASDL_SEQ_HEAD
+    PyObject *typed_elements[1];
+} asdl_identifier_seq;
+
+typedef struct {
+    _ASDL_SEQ_HEAD
+    int typed_elements[1];
+} asdl_int_seq;
+
+asdl_generic_seq *_Py_asdl_generic_seq_new(Py_ssize_t size, PyArena *arena);
+asdl_identifier_seq *_Py_asdl_identifier_seq_new(Py_ssize_t size, PyArena *arena);
+asdl_int_seq *_Py_asdl_int_seq_new(Py_ssize_t size, PyArena *arena);
+
+
+#define GENERATE_ASDL_SEQ_CONSTRUCTOR(NAME, TYPE) \
+asdl_ ## NAME ## _seq *_Py_asdl_ ## NAME ## _seq_new(Py_ssize_t size, PyArena *arena) \
+{ \
+    asdl_ ## NAME ## _seq *seq = NULL; \
+    size_t n; \
+    /* check size is sane */ \
+    if (size < 0 || \
+        (size && (((size_t)size - 1) > (SIZE_MAX / sizeof(void *))))) { \
+        PyErr_NoMemory(); \
+        return NULL; \
+    } \
+    n = (size ? (sizeof(TYPE *) * (size - 1)) : 0); \
+    /* check if size can be added safely */ \
+    if (n > SIZE_MAX - sizeof(asdl_ ## NAME ## _seq)) { \
+        PyErr_NoMemory(); \
+        return NULL; \
+    } \
+    n += sizeof(asdl_ ## NAME ## _seq); \
+    seq = (asdl_ ## NAME ## _seq *)_PyArena_Malloc(arena, n); \
+    if (!seq) { \
+        PyErr_NoMemory(); \
+        return NULL; \
+    } \
+    memset(seq, 0, n); \
+    seq->size = size; \
+    seq->elements = (void**)seq->typed_elements; \
+    return seq; \
+}
+
+#define asdl_seq_GET_UNTYPED(S, I) (S)->elements[(I)]
+#define asdl_seq_GET(S, I) (S)->typed_elements[(I)]
+#define asdl_seq_LEN(S) ((S) == NULL ? 0 : (S)->size)
+
+#ifdef Py_DEBUG
+#  define asdl_seq_SET(S, I, V) \
+    do { \
+        Py_ssize_t _asdl_i = (I); \
+        assert((S) != NULL); \
+        assert(0 <= _asdl_i && _asdl_i < (S)->size); \
+        (S)->typed_elements[_asdl_i] = (V); \
+    } while (0)
+#else
+#  define asdl_seq_SET(S, I, V) (S)->typed_elements[I] = (V)
+#endif
+
+#ifdef Py_DEBUG
+#  define asdl_seq_SET_UNTYPED(S, I, V) \
+    do { \
+        Py_ssize_t _asdl_i = (I); \
+        assert((S) != NULL); \
+        assert(0 <= _asdl_i && _asdl_i < (S)->size); \
+        (S)->elements[_asdl_i] = (V); \
+    } while (0)
+#else
+#  define asdl_seq_SET_UNTYPED(S, I, V) (S)->elements[I] = (V)
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !Py_INTERNAL_ASDL_H */
diff --git a/Include/internal/pycore_ast.h b/Include/internal/pycore_ast.h
new file mode 100644
index 0000000..ebb6a90
--- /dev/null
+++ b/Include/internal/pycore_ast.h
@@ -0,0 +1,855 @@
+// File automatically generated by Parser/asdl_c.py.
+
+#ifndef Py_INTERNAL_AST_H
+#define Py_INTERNAL_AST_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef Py_BUILD_CORE
+#  error "this header requires Py_BUILD_CORE define"
+#endif
+
+#include "pycore_asdl.h"
+
+typedef struct _mod *mod_ty;
+
+typedef struct _stmt *stmt_ty;
+
+typedef struct _expr *expr_ty;
+
+typedef enum _expr_context { Load=1, Store=2, Del=3 } expr_context_ty;
+
+typedef enum _boolop { And=1, Or=2 } boolop_ty;
+
+typedef enum _operator { Add=1, Sub=2, Mult=3, MatMult=4, Div=5, Mod=6, Pow=7,
+                         LShift=8, RShift=9, BitOr=10, BitXor=11, BitAnd=12,
+                         FloorDiv=13 } operator_ty;
+
+typedef enum _unaryop { Invert=1, Not=2, UAdd=3, USub=4 } unaryop_ty;
+
+typedef enum _cmpop { Eq=1, NotEq=2, Lt=3, LtE=4, Gt=5, GtE=6, Is=7, IsNot=8,
+                      In=9, NotIn=10 } cmpop_ty;
+
+typedef struct _comprehension *comprehension_ty;
+
+typedef struct _excepthandler *excepthandler_ty;
+
+typedef struct _arguments *arguments_ty;
+
+typedef struct _arg *arg_ty;
+
+typedef struct _keyword *keyword_ty;
+
+typedef struct _alias *alias_ty;
+
+typedef struct _withitem *withitem_ty;
+
+typedef struct _match_case *match_case_ty;
+
+typedef struct _pattern *pattern_ty;
+
+typedef struct _type_ignore *type_ignore_ty;
+
+
+typedef struct {
+    _ASDL_SEQ_HEAD
+    mod_ty typed_elements[1];
+} asdl_mod_seq;
+
+asdl_mod_seq *_Py_asdl_mod_seq_new(Py_ssize_t size, PyArena *arena);
+
+typedef struct {
+    _ASDL_SEQ_HEAD
+    stmt_ty typed_elements[1];
+} asdl_stmt_seq;
+
+asdl_stmt_seq *_Py_asdl_stmt_seq_new(Py_ssize_t size, PyArena *arena);
+
+typedef struct {
+    _ASDL_SEQ_HEAD
+    expr_ty typed_elements[1];
+} asdl_expr_seq;
+
+asdl_expr_seq *_Py_asdl_expr_seq_new(Py_ssize_t size, PyArena *arena);
+
+typedef struct {
+    _ASDL_SEQ_HEAD
+    comprehension_ty typed_elements[1];
+} asdl_comprehension_seq;
+
+asdl_comprehension_seq *_Py_asdl_comprehension_seq_new(Py_ssize_t size, PyArena
+                                                       *arena);
+
+typedef struct {
+    _ASDL_SEQ_HEAD
+    excepthandler_ty typed_elements[1];
+} asdl_excepthandler_seq;
+
+asdl_excepthandler_seq *_Py_asdl_excepthandler_seq_new(Py_ssize_t size, PyArena
+                                                       *arena);
+
+typedef struct {
+    _ASDL_SEQ_HEAD
+    arguments_ty typed_elements[1];
+} asdl_arguments_seq;
+
+asdl_arguments_seq *_Py_asdl_arguments_seq_new(Py_ssize_t size, PyArena *arena);
+
+typedef struct {
+    _ASDL_SEQ_HEAD
+    arg_ty typed_elements[1];
+} asdl_arg_seq;
+
+asdl_arg_seq *_Py_asdl_arg_seq_new(Py_ssize_t size, PyArena *arena);
+
+typedef struct {
+    _ASDL_SEQ_HEAD
+    keyword_ty typed_elements[1];
+} asdl_keyword_seq;
+
+asdl_keyword_seq *_Py_asdl_keyword_seq_new(Py_ssize_t size, PyArena *arena);
+
+typedef struct {
+    _ASDL_SEQ_HEAD
+    alias_ty typed_elements[1];
+} asdl_alias_seq;
+
+asdl_alias_seq *_Py_asdl_alias_seq_new(Py_ssize_t size, PyArena *arena);
+
+typedef struct {
+    _ASDL_SEQ_HEAD
+    withitem_ty typed_elements[1];
+} asdl_withitem_seq;
+
+asdl_withitem_seq *_Py_asdl_withitem_seq_new(Py_ssize_t size, PyArena *arena);
+
+typedef struct {
+    _ASDL_SEQ_HEAD
+    match_case_ty typed_elements[1];
+} asdl_match_case_seq;
+
+asdl_match_case_seq *_Py_asdl_match_case_seq_new(Py_ssize_t size, PyArena
+                                                 *arena);
+
+typedef struct {
+    _ASDL_SEQ_HEAD
+    pattern_ty typed_elements[1];
+} asdl_pattern_seq;
+
+asdl_pattern_seq *_Py_asdl_pattern_seq_new(Py_ssize_t size, PyArena *arena);
+
+typedef struct {
+    _ASDL_SEQ_HEAD
+    type_ignore_ty typed_elements[1];
+} asdl_type_ignore_seq;
+
+asdl_type_ignore_seq *_Py_asdl_type_ignore_seq_new(Py_ssize_t size, PyArena
+                                                   *arena);
+
+
+enum _mod_kind {Module_kind=1, Interactive_kind=2, Expression_kind=3,
+                 FunctionType_kind=4};
+struct _mod {
+    enum _mod_kind kind;
+    union {
+        struct {
+            asdl_stmt_seq *body;
+            asdl_type_ignore_seq *type_ignores;
+        } Module;
+
+        struct {
+            asdl_stmt_seq *body;
+        } Interactive;
+
+        struct {
+            expr_ty body;
+        } Expression;
+
+        struct {
+            asdl_expr_seq *argtypes;
+            expr_ty returns;
+        } FunctionType;
+
+    } v;
+};
+
+enum _stmt_kind {FunctionDef_kind=1, AsyncFunctionDef_kind=2, ClassDef_kind=3,
+                  Return_kind=4, Delete_kind=5, Assign_kind=6,
+                  AugAssign_kind=7, AnnAssign_kind=8, For_kind=9,
+                  AsyncFor_kind=10, While_kind=11, If_kind=12, With_kind=13,
+                  AsyncWith_kind=14, Match_kind=15, Raise_kind=16, Try_kind=17,
+                  Assert_kind=18, Import_kind=19, ImportFrom_kind=20,
+                  Global_kind=21, Nonlocal_kind=22, Expr_kind=23, Pass_kind=24,
+                  Break_kind=25, Continue_kind=26};
+struct _stmt {
+    enum _stmt_kind kind;
+    union {
+        struct {
+            identifier name;
+            arguments_ty args;
+            asdl_stmt_seq *body;
+            asdl_expr_seq *decorator_list;
+            expr_ty returns;
+            string type_comment;
+        } FunctionDef;
+
+        struct {
+            identifier name;
+            arguments_ty args;
+            asdl_stmt_seq *body;
+            asdl_expr_seq *decorator_list;
+            expr_ty returns;
+            string type_comment;
+        } AsyncFunctionDef;
+
+        struct {
+            identifier name;
+            asdl_expr_seq *bases;
+            asdl_keyword_seq *keywords;
+            asdl_stmt_seq *body;
+            asdl_expr_seq *decorator_list;
+        } ClassDef;
+
+        struct {
+            expr_ty value;
+        } Return;
+
+        struct {
+            asdl_expr_seq *targets;
+        } Delete;
+
+        struct {
+            asdl_expr_seq *targets;
+            expr_ty value;
+            string type_comment;
+        } Assign;
+
+        struct {
+            expr_ty target;
+            operator_ty op;
+            expr_ty value;
+        } AugAssign;
+
+        struct {
+            expr_ty target;
+            expr_ty annotation;
+            expr_ty value;
+            int simple;
+        } AnnAssign;
+
+        struct {
+            expr_ty target;
+            expr_ty iter;
+            asdl_stmt_seq *body;
+            asdl_stmt_seq *orelse;
+            string type_comment;
+        } For;
+
+        struct {
+            expr_ty target;
+            expr_ty iter;
+            asdl_stmt_seq *body;
+            asdl_stmt_seq *orelse;
+            string type_comment;
+        } AsyncFor;
+
+        struct {
+            expr_ty test;
+            asdl_stmt_seq *body;
+            asdl_stmt_seq *orelse;
+        } While;
+
+        struct {
+            expr_ty test;
+            asdl_stmt_seq *body;
+            asdl_stmt_seq *orelse;
+        } If;
+
+        struct {
+            asdl_withitem_seq *items;
+            asdl_stmt_seq *body;
+            string type_comment;
+        } With;
+
+        struct {
+            asdl_withitem_seq *items;
+            asdl_stmt_seq *body;
+            string type_comment;
+        } AsyncWith;
+
+        struct {
+            expr_ty subject;
+            asdl_match_case_seq *cases;
+        } Match;
+
+        struct {
+            expr_ty exc;
+            expr_ty cause;
+        } Raise;
+
+        struct {
+            asdl_stmt_seq *body;
+            asdl_excepthandler_seq *handlers;
+            asdl_stmt_seq *orelse;
+            asdl_stmt_seq *finalbody;
+        } Try;
+
+        struct {
+            expr_ty test;
+            expr_ty msg;
+        } Assert;
+
+        struct {
+            asdl_alias_seq *names;
+        } Import;
+
+        struct {
+            identifier module;
+            asdl_alias_seq *names;
+            int level;
+        } ImportFrom;
+
+        struct {
+            asdl_identifier_seq *names;
+        } Global;
+
+        struct {
+            asdl_identifier_seq *names;
+        } Nonlocal;
+
+        struct {
+            expr_ty value;
+        } Expr;
+
+    } v;
+    int lineno;
+    int col_offset;
+    int end_lineno;
+    int end_col_offset;
+};
+
+enum _expr_kind {BoolOp_kind=1, NamedExpr_kind=2, BinOp_kind=3, UnaryOp_kind=4,
+                  Lambda_kind=5, IfExp_kind=6, Dict_kind=7, Set_kind=8,
+                  ListComp_kind=9, SetComp_kind=10, DictComp_kind=11,
+                  GeneratorExp_kind=12, Await_kind=13, Yield_kind=14,
+                  YieldFrom_kind=15, Compare_kind=16, Call_kind=17,
+                  FormattedValue_kind=18, JoinedStr_kind=19, Constant_kind=20,
+                  Attribute_kind=21, Subscript_kind=22, Starred_kind=23,
+                  Name_kind=24, List_kind=25, Tuple_kind=26, Slice_kind=27};
+struct _expr {
+    enum _expr_kind kind;
+    union {
+        struct {
+            boolop_ty op;
+            asdl_expr_seq *values;
+        } BoolOp;
+
+        struct {
+            expr_ty target;
+            expr_ty value;
+        } NamedExpr;
+
+        struct {
+            expr_ty left;
+            operator_ty op;
+            expr_ty right;
+        } BinOp;
+
+        struct {
+            unaryop_ty op;
+            expr_ty operand;
+        } UnaryOp;
+
+        struct {
+            arguments_ty args;
+            expr_ty body;
+        } Lambda;
+
+        struct {
+            expr_ty test;
+            expr_ty body;
+            expr_ty orelse;
+        } IfExp;
+
+        struct {
+            asdl_expr_seq *keys;
+            asdl_expr_seq *values;
+        } Dict;
+
+        struct {
+            asdl_expr_seq *elts;
+        } Set;
+
+        struct {
+            expr_ty elt;
+            asdl_comprehension_seq *generators;
+        } ListComp;
+
+        struct {
+            expr_ty elt;
+            asdl_comprehension_seq *generators;
+        } SetComp;
+
+        struct {
+            expr_ty key;
+            expr_ty value;
+            asdl_comprehension_seq *generators;
+        } DictComp;
+
+        struct {
+            expr_ty elt;
+            asdl_comprehension_seq *generators;
+        } GeneratorExp;
+
+        struct {
+            expr_ty value;
+        } Await;
+
+        struct {
+            expr_ty value;
+        } Yield;
+
+        struct {
+            expr_ty value;
+        } YieldFrom;
+
+        struct {
+            expr_ty left;
+            asdl_int_seq *ops;
+            asdl_expr_seq *comparators;
+        } Compare;
+
+        struct {
+            expr_ty func;
+            asdl_expr_seq *args;
+            asdl_keyword_seq *keywords;
+        } Call;
+
+        struct {
+            expr_ty value;
+            int conversion;
+            expr_ty format_spec;
+        } FormattedValue;
+
+        struct {
+            asdl_expr_seq *values;
+        } JoinedStr;
+
+        struct {
+            constant value;
+            string kind;
+        } Constant;
+
+        struct {
+            expr_ty value;
+            identifier attr;
+            expr_context_ty ctx;
+        } Attribute;
+
+        struct {
+            expr_ty value;
+            expr_ty slice;
+            expr_context_ty ctx;
+        } Subscript;
+
+        struct {
+            expr_ty value;
+            expr_context_ty ctx;
+        } Starred;
+
+        struct {
+            identifier id;
+            expr_context_ty ctx;
+        } Name;
+
+        struct {
+            asdl_expr_seq *elts;
+            expr_context_ty ctx;
+        } List;
+
+        struct {
+            asdl_expr_seq *elts;
+            expr_context_ty ctx;
+        } Tuple;
+
+        struct {
+            expr_ty lower;
+            expr_ty upper;
+            expr_ty step;
+        } Slice;
+
+    } v;
+    int lineno;
+    int col_offset;
+    int end_lineno;
+    int end_col_offset;
+};
+
+struct _comprehension {
+    expr_ty target;
+    expr_ty iter;
+    asdl_expr_seq *ifs;
+    int is_async;
+};
+
+enum _excepthandler_kind {ExceptHandler_kind=1};
+struct _excepthandler {
+    enum _excepthandler_kind kind;
+    union {
+        struct {
+            expr_ty type;
+            identifier name;
+            asdl_stmt_seq *body;
+        } ExceptHandler;
+
+    } v;
+    int lineno;
+    int col_offset;
+    int end_lineno;
+    int end_col_offset;
+};
+
+struct _arguments {
+    asdl_arg_seq *posonlyargs;
+    asdl_arg_seq *args;
+    arg_ty vararg;
+    asdl_arg_seq *kwonlyargs;
+    asdl_expr_seq *kw_defaults;
+    arg_ty kwarg;
+    asdl_expr_seq *defaults;
+};
+
+struct _arg {
+    identifier arg;
+    expr_ty annotation;
+    string type_comment;
+    int lineno;
+    int col_offset;
+    int end_lineno;
+    int end_col_offset;
+};
+
+struct _keyword {
+    identifier arg;
+    expr_ty value;
+    int lineno;
+    int col_offset;
+    int end_lineno;
+    int end_col_offset;
+};
+
+struct _alias {
+    identifier name;
+    identifier asname;
+    int lineno;
+    int col_offset;
+    int end_lineno;
+    int end_col_offset;
+};
+
+struct _withitem {
+    expr_ty context_expr;
+    expr_ty optional_vars;
+};
+
+struct _match_case {
+    pattern_ty pattern;
+    expr_ty guard;
+    asdl_stmt_seq *body;
+};
+
+enum _pattern_kind {MatchValue_kind=1, MatchSingleton_kind=2,
+                     MatchSequence_kind=3, MatchMapping_kind=4,
+                     MatchClass_kind=5, MatchStar_kind=6, MatchAs_kind=7,
+                     MatchOr_kind=8};
+struct _pattern {
+    enum _pattern_kind kind;
+    union {
+        struct {
+            expr_ty value;
+        } MatchValue;
+
+        struct {
+            constant value;
+        } MatchSingleton;
+
+        struct {
+            asdl_pattern_seq *patterns;
+        } MatchSequence;
+
+        struct {
+            asdl_expr_seq *keys;
+            asdl_pattern_seq *patterns;
+            identifier rest;
+        } MatchMapping;
+
+        struct {
+            expr_ty cls;
+            asdl_pattern_seq *patterns;
+            asdl_identifier_seq *kwd_attrs;
+            asdl_pattern_seq *kwd_patterns;
+        } MatchClass;
+
+        struct {
+            identifier name;
+        } MatchStar;
+
+        struct {
+            pattern_ty pattern;
+            identifier name;
+        } MatchAs;
+
+        struct {
+            asdl_pattern_seq *patterns;
+        } MatchOr;
+
+    } v;
+    int lineno;
+    int col_offset;
+    int end_lineno;
+    int end_col_offset;
+};
+
+enum _type_ignore_kind {TypeIgnore_kind=1};
+struct _type_ignore {
+    enum _type_ignore_kind kind;
+    union {
+        struct {
+            int lineno;
+            string tag;
+        } TypeIgnore;
+
+    } v;
+};
+
+
+// Note: these macros affect function definitions, not only call sites.
+mod_ty _PyAST_Module(asdl_stmt_seq * body, asdl_type_ignore_seq * type_ignores,
+                     PyArena *arena);
+mod_ty _PyAST_Interactive(asdl_stmt_seq * body, PyArena *arena);
+mod_ty _PyAST_Expression(expr_ty body, PyArena *arena);
+mod_ty _PyAST_FunctionType(asdl_expr_seq * argtypes, expr_ty returns, PyArena
+                           *arena);
+stmt_ty _PyAST_FunctionDef(identifier name, arguments_ty args, asdl_stmt_seq *
+                           body, asdl_expr_seq * decorator_list, expr_ty
+                           returns, string type_comment, int lineno, int
+                           col_offset, int end_lineno, int end_col_offset,
+                           PyArena *arena);
+stmt_ty _PyAST_AsyncFunctionDef(identifier name, arguments_ty args,
+                                asdl_stmt_seq * body, asdl_expr_seq *
+                                decorator_list, expr_ty returns, string
+                                type_comment, int lineno, int col_offset, int
+                                end_lineno, int end_col_offset, PyArena *arena);
+stmt_ty _PyAST_ClassDef(identifier name, asdl_expr_seq * bases,
+                        asdl_keyword_seq * keywords, asdl_stmt_seq * body,
+                        asdl_expr_seq * decorator_list, int lineno, int
+                        col_offset, int end_lineno, int end_col_offset, PyArena
+                        *arena);
+stmt_ty _PyAST_Return(expr_ty value, int lineno, int col_offset, int
+                      end_lineno, int end_col_offset, PyArena *arena);
+stmt_ty _PyAST_Delete(asdl_expr_seq * targets, int lineno, int col_offset, int
+                      end_lineno, int end_col_offset, PyArena *arena);
+stmt_ty _PyAST_Assign(asdl_expr_seq * targets, expr_ty value, string
+                      type_comment, int lineno, int col_offset, int end_lineno,
+                      int end_col_offset, PyArena *arena);
+stmt_ty _PyAST_AugAssign(expr_ty target, operator_ty op, expr_ty value, int
+                         lineno, int col_offset, int end_lineno, int
+                         end_col_offset, PyArena *arena);
+stmt_ty _PyAST_AnnAssign(expr_ty target, expr_ty annotation, expr_ty value, int
+                         simple, int lineno, int col_offset, int end_lineno,
+                         int end_col_offset, PyArena *arena);
+stmt_ty _PyAST_For(expr_ty target, expr_ty iter, asdl_stmt_seq * body,
+                   asdl_stmt_seq * orelse, string type_comment, int lineno, int
+                   col_offset, int end_lineno, int end_col_offset, PyArena
+                   *arena);
+stmt_ty _PyAST_AsyncFor(expr_ty target, expr_ty iter, asdl_stmt_seq * body,
+                        asdl_stmt_seq * orelse, string type_comment, int
+                        lineno, int col_offset, int end_lineno, int
+                        end_col_offset, PyArena *arena);
+stmt_ty _PyAST_While(expr_ty test, asdl_stmt_seq * body, asdl_stmt_seq *
+                     orelse, int lineno, int col_offset, int end_lineno, int
+                     end_col_offset, PyArena *arena);
+stmt_ty _PyAST_If(expr_ty test, asdl_stmt_seq * body, asdl_stmt_seq * orelse,
+                  int lineno, int col_offset, int end_lineno, int
+                  end_col_offset, PyArena *arena);
+stmt_ty _PyAST_With(asdl_withitem_seq * items, asdl_stmt_seq * body, string
+                    type_comment, int lineno, int col_offset, int end_lineno,
+                    int end_col_offset, PyArena *arena);
+stmt_ty _PyAST_AsyncWith(asdl_withitem_seq * items, asdl_stmt_seq * body,
+                         string type_comment, int lineno, int col_offset, int
+                         end_lineno, int end_col_offset, PyArena *arena);
+stmt_ty _PyAST_Match(expr_ty subject, asdl_match_case_seq * cases, int lineno,
+                     int col_offset, int end_lineno, int end_col_offset,
+                     PyArena *arena);
+stmt_ty _PyAST_Raise(expr_ty exc, expr_ty cause, int lineno, int col_offset,
+                     int end_lineno, int end_col_offset, PyArena *arena);
+stmt_ty _PyAST_Try(asdl_stmt_seq * body, asdl_excepthandler_seq * handlers,
+                   asdl_stmt_seq * orelse, asdl_stmt_seq * finalbody, int
+                   lineno, int col_offset, int end_lineno, int end_col_offset,
+                   PyArena *arena);
+stmt_ty _PyAST_Assert(expr_ty test, expr_ty msg, int lineno, int col_offset,
+                      int end_lineno, int end_col_offset, PyArena *arena);
+stmt_ty _PyAST_Import(asdl_alias_seq * names, int lineno, int col_offset, int
+                      end_lineno, int end_col_offset, PyArena *arena);
+stmt_ty _PyAST_ImportFrom(identifier module, asdl_alias_seq * names, int level,
+                          int lineno, int col_offset, int end_lineno, int
+                          end_col_offset, PyArena *arena);
+stmt_ty _PyAST_Global(asdl_identifier_seq * names, int lineno, int col_offset,
+                      int end_lineno, int end_col_offset, PyArena *arena);
+stmt_ty _PyAST_Nonlocal(asdl_identifier_seq * names, int lineno, int
+                        col_offset, int end_lineno, int end_col_offset, PyArena
+                        *arena);
+stmt_ty _PyAST_Expr(expr_ty value, int lineno, int col_offset, int end_lineno,
+                    int end_col_offset, PyArena *arena);
+stmt_ty _PyAST_Pass(int lineno, int col_offset, int end_lineno, int
+                    end_col_offset, PyArena *arena);
+stmt_ty _PyAST_Break(int lineno, int col_offset, int end_lineno, int
+                     end_col_offset, PyArena *arena);
+stmt_ty _PyAST_Continue(int lineno, int col_offset, int end_lineno, int
+                        end_col_offset, PyArena *arena);
+expr_ty _PyAST_BoolOp(boolop_ty op, asdl_expr_seq * values, int lineno, int
+                      col_offset, int end_lineno, int end_col_offset, PyArena
+                      *arena);
+expr_ty _PyAST_NamedExpr(expr_ty target, expr_ty value, int lineno, int
+                         col_offset, int end_lineno, int end_col_offset,
+                         PyArena *arena);
+expr_ty _PyAST_BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno,
+                     int col_offset, int end_lineno, int end_col_offset,
+                     PyArena *arena);
+expr_ty _PyAST_UnaryOp(unaryop_ty op, expr_ty operand, int lineno, int
+                       col_offset, int end_lineno, int end_col_offset, PyArena
+                       *arena);
+expr_ty _PyAST_Lambda(arguments_ty args, expr_ty body, int lineno, int
+                      col_offset, int end_lineno, int end_col_offset, PyArena
+                      *arena);
+expr_ty _PyAST_IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno,
+                     int col_offset, int end_lineno, int end_col_offset,
+                     PyArena *arena);
+expr_ty _PyAST_Dict(asdl_expr_seq * keys, asdl_expr_seq * values, int lineno,
+                    int col_offset, int end_lineno, int end_col_offset, PyArena
+                    *arena);
+expr_ty _PyAST_Set(asdl_expr_seq * elts, int lineno, int col_offset, int
+                   end_lineno, int end_col_offset, PyArena *arena);
+expr_ty _PyAST_ListComp(expr_ty elt, asdl_comprehension_seq * generators, int
+                        lineno, int col_offset, int end_lineno, int
+                        end_col_offset, PyArena *arena);
+expr_ty _PyAST_SetComp(expr_ty elt, asdl_comprehension_seq * generators, int
+                       lineno, int col_offset, int end_lineno, int
+                       end_col_offset, PyArena *arena);
+expr_ty _PyAST_DictComp(expr_ty key, expr_ty value, asdl_comprehension_seq *
+                        generators, int lineno, int col_offset, int end_lineno,
+                        int end_col_offset, PyArena *arena);
+expr_ty _PyAST_GeneratorExp(expr_ty elt, asdl_comprehension_seq * generators,
+                            int lineno, int col_offset, int end_lineno, int
+                            end_col_offset, PyArena *arena);
+expr_ty _PyAST_Await(expr_ty value, int lineno, int col_offset, int end_lineno,
+                     int end_col_offset, PyArena *arena);
+expr_ty _PyAST_Yield(expr_ty value, int lineno, int col_offset, int end_lineno,
+                     int end_col_offset, PyArena *arena);
+expr_ty _PyAST_YieldFrom(expr_ty value, int lineno, int col_offset, int
+                         end_lineno, int end_col_offset, PyArena *arena);
+expr_ty _PyAST_Compare(expr_ty left, asdl_int_seq * ops, asdl_expr_seq *
+                       comparators, int lineno, int col_offset, int end_lineno,
+                       int end_col_offset, PyArena *arena);
+expr_ty _PyAST_Call(expr_ty func, asdl_expr_seq * args, asdl_keyword_seq *
+                    keywords, int lineno, int col_offset, int end_lineno, int
+                    end_col_offset, PyArena *arena);
+expr_ty _PyAST_FormattedValue(expr_ty value, int conversion, expr_ty
+                              format_spec, int lineno, int col_offset, int
+                              end_lineno, int end_col_offset, PyArena *arena);
+expr_ty _PyAST_JoinedStr(asdl_expr_seq * values, int lineno, int col_offset,
+                         int end_lineno, int end_col_offset, PyArena *arena);
+expr_ty _PyAST_Constant(constant value, string kind, int lineno, int
+                        col_offset, int end_lineno, int end_col_offset, PyArena
+                        *arena);
+expr_ty _PyAST_Attribute(expr_ty value, identifier attr, expr_context_ty ctx,
+                         int lineno, int col_offset, int end_lineno, int
+                         end_col_offset, PyArena *arena);
+expr_ty _PyAST_Subscript(expr_ty value, expr_ty slice, expr_context_ty ctx, int
+                         lineno, int col_offset, int end_lineno, int
+                         end_col_offset, PyArena *arena);
+expr_ty _PyAST_Starred(expr_ty value, expr_context_ty ctx, int lineno, int
+                       col_offset, int end_lineno, int end_col_offset, PyArena
+                       *arena);
+expr_ty _PyAST_Name(identifier id, expr_context_ty ctx, int lineno, int
+                    col_offset, int end_lineno, int end_col_offset, PyArena
+                    *arena);
+expr_ty _PyAST_List(asdl_expr_seq * elts, expr_context_ty ctx, int lineno, int
+                    col_offset, int end_lineno, int end_col_offset, PyArena
+                    *arena);
+expr_ty _PyAST_Tuple(asdl_expr_seq * elts, expr_context_ty ctx, int lineno, int
+                     col_offset, int end_lineno, int end_col_offset, PyArena
+                     *arena);
+expr_ty _PyAST_Slice(expr_ty lower, expr_ty upper, expr_ty step, int lineno,
+                     int col_offset, int end_lineno, int end_col_offset,
+                     PyArena *arena);
+comprehension_ty _PyAST_comprehension(expr_ty target, expr_ty iter,
+                                      asdl_expr_seq * ifs, int is_async,
+                                      PyArena *arena);
+excepthandler_ty _PyAST_ExceptHandler(expr_ty type, identifier name,
+                                      asdl_stmt_seq * body, int lineno, int
+                                      col_offset, int end_lineno, int
+                                      end_col_offset, PyArena *arena);
+arguments_ty _PyAST_arguments(asdl_arg_seq * posonlyargs, asdl_arg_seq * args,
+                              arg_ty vararg, asdl_arg_seq * kwonlyargs,
+                              asdl_expr_seq * kw_defaults, arg_ty kwarg,
+                              asdl_expr_seq * defaults, PyArena *arena);
+arg_ty _PyAST_arg(identifier arg, expr_ty annotation, string type_comment, int
+                  lineno, int col_offset, int end_lineno, int end_col_offset,
+                  PyArena *arena);
+keyword_ty _PyAST_keyword(identifier arg, expr_ty value, int lineno, int
+                          col_offset, int end_lineno, int end_col_offset,
+                          PyArena *arena);
+alias_ty _PyAST_alias(identifier name, identifier asname, int lineno, int
+                      col_offset, int end_lineno, int end_col_offset, PyArena
+                      *arena);
+withitem_ty _PyAST_withitem(expr_ty context_expr, expr_ty optional_vars,
+                            PyArena *arena);
+match_case_ty _PyAST_match_case(pattern_ty pattern, expr_ty guard,
+                                asdl_stmt_seq * body, PyArena *arena);
+pattern_ty _PyAST_MatchValue(expr_ty value, int lineno, int col_offset, int
+                             end_lineno, int end_col_offset, PyArena *arena);
+pattern_ty _PyAST_MatchSingleton(constant value, int lineno, int col_offset,
+                                 int end_lineno, int end_col_offset, PyArena
+                                 *arena);
+pattern_ty _PyAST_MatchSequence(asdl_pattern_seq * patterns, int lineno, int
+                                col_offset, int end_lineno, int end_col_offset,
+                                PyArena *arena);
+pattern_ty _PyAST_MatchMapping(asdl_expr_seq * keys, asdl_pattern_seq *
+                               patterns, identifier rest, int lineno, int
+                               col_offset, int end_lineno, int end_col_offset,
+                               PyArena *arena);
+pattern_ty _PyAST_MatchClass(expr_ty cls, asdl_pattern_seq * patterns,
+                             asdl_identifier_seq * kwd_attrs, asdl_pattern_seq
+                             * kwd_patterns, int lineno, int col_offset, int
+                             end_lineno, int end_col_offset, PyArena *arena);
+pattern_ty _PyAST_MatchStar(identifier name, int lineno, int col_offset, int
+                            end_lineno, int end_col_offset, PyArena *arena);
+pattern_ty _PyAST_MatchAs(pattern_ty pattern, identifier name, int lineno, int
+                          col_offset, int end_lineno, int end_col_offset,
+                          PyArena *arena);
+pattern_ty _PyAST_MatchOr(asdl_pattern_seq * patterns, int lineno, int
+                          col_offset, int end_lineno, int end_col_offset,
+                          PyArena *arena);
+type_ignore_ty _PyAST_TypeIgnore(int lineno, string tag, PyArena *arena);
+
+
+PyObject* PyAST_mod2obj(mod_ty t);
+mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode);
+int PyAST_Check(PyObject* obj);
+
+extern int _PyAST_Validate(mod_ty);
+
+/* _PyAST_ExprAsUnicode is defined in ast_unparse.c */
+extern PyObject* _PyAST_ExprAsUnicode(expr_ty);
+
+/* Return the borrowed reference to the first literal string in the
+   sequence of statements or NULL if it doesn't start from a literal string.
+   Doesn't set exception. */
+extern PyObject* _PyAST_GetDocString(asdl_stmt_seq *);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !Py_INTERNAL_AST_H */
diff --git a/Include/internal/pycore_ast_state.h b/Include/internal/pycore_ast_state.h
new file mode 100644
index 0000000..882cd09
--- /dev/null
+++ b/Include/internal/pycore_ast_state.h
@@ -0,0 +1,255 @@
+// File automatically generated by Parser/asdl_c.py.
+
+#ifndef Py_INTERNAL_AST_STATE_H
+#define Py_INTERNAL_AST_STATE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef Py_BUILD_CORE
+#  error "this header requires Py_BUILD_CORE define"
+#endif
+
+struct ast_state {
+    int initialized;
+    PyObject *AST_type;
+    PyObject *Add_singleton;
+    PyObject *Add_type;
+    PyObject *And_singleton;
+    PyObject *And_type;
+    PyObject *AnnAssign_type;
+    PyObject *Assert_type;
+    PyObject *Assign_type;
+    PyObject *AsyncFor_type;
+    PyObject *AsyncFunctionDef_type;
+    PyObject *AsyncWith_type;
+    PyObject *Attribute_type;
+    PyObject *AugAssign_type;
+    PyObject *Await_type;
+    PyObject *BinOp_type;
+    PyObject *BitAnd_singleton;
+    PyObject *BitAnd_type;
+    PyObject *BitOr_singleton;
+    PyObject *BitOr_type;
+    PyObject *BitXor_singleton;
+    PyObject *BitXor_type;
+    PyObject *BoolOp_type;
+    PyObject *Break_type;
+    PyObject *Call_type;
+    PyObject *ClassDef_type;
+    PyObject *Compare_type;
+    PyObject *Constant_type;
+    PyObject *Continue_type;
+    PyObject *Del_singleton;
+    PyObject *Del_type;
+    PyObject *Delete_type;
+    PyObject *DictComp_type;
+    PyObject *Dict_type;
+    PyObject *Div_singleton;
+    PyObject *Div_type;
+    PyObject *Eq_singleton;
+    PyObject *Eq_type;
+    PyObject *ExceptHandler_type;
+    PyObject *Expr_type;
+    PyObject *Expression_type;
+    PyObject *FloorDiv_singleton;
+    PyObject *FloorDiv_type;
+    PyObject *For_type;
+    PyObject *FormattedValue_type;
+    PyObject *FunctionDef_type;
+    PyObject *FunctionType_type;
+    PyObject *GeneratorExp_type;
+    PyObject *Global_type;
+    PyObject *GtE_singleton;
+    PyObject *GtE_type;
+    PyObject *Gt_singleton;
+    PyObject *Gt_type;
+    PyObject *IfExp_type;
+    PyObject *If_type;
+    PyObject *ImportFrom_type;
+    PyObject *Import_type;
+    PyObject *In_singleton;
+    PyObject *In_type;
+    PyObject *Interactive_type;
+    PyObject *Invert_singleton;
+    PyObject *Invert_type;
+    PyObject *IsNot_singleton;
+    PyObject *IsNot_type;
+    PyObject *Is_singleton;
+    PyObject *Is_type;
+    PyObject *JoinedStr_type;
+    PyObject *LShift_singleton;
+    PyObject *LShift_type;
+    PyObject *Lambda_type;
+    PyObject *ListComp_type;
+    PyObject *List_type;
+    PyObject *Load_singleton;
+    PyObject *Load_type;
+    PyObject *LtE_singleton;
+    PyObject *LtE_type;
+    PyObject *Lt_singleton;
+    PyObject *Lt_type;
+    PyObject *MatMult_singleton;
+    PyObject *MatMult_type;
+    PyObject *MatchAs_type;
+    PyObject *MatchClass_type;
+    PyObject *MatchMapping_type;
+    PyObject *MatchOr_type;
+    PyObject *MatchSequence_type;
+    PyObject *MatchSingleton_type;
+    PyObject *MatchStar_type;
+    PyObject *MatchValue_type;
+    PyObject *Match_type;
+    PyObject *Mod_singleton;
+    PyObject *Mod_type;
+    PyObject *Module_type;
+    PyObject *Mult_singleton;
+    PyObject *Mult_type;
+    PyObject *Name_type;
+    PyObject *NamedExpr_type;
+    PyObject *Nonlocal_type;
+    PyObject *NotEq_singleton;
+    PyObject *NotEq_type;
+    PyObject *NotIn_singleton;
+    PyObject *NotIn_type;
+    PyObject *Not_singleton;
+    PyObject *Not_type;
+    PyObject *Or_singleton;
+    PyObject *Or_type;
+    PyObject *Pass_type;
+    PyObject *Pow_singleton;
+    PyObject *Pow_type;
+    PyObject *RShift_singleton;
+    PyObject *RShift_type;
+    PyObject *Raise_type;
+    PyObject *Return_type;
+    PyObject *SetComp_type;
+    PyObject *Set_type;
+    PyObject *Slice_type;
+    PyObject *Starred_type;
+    PyObject *Store_singleton;
+    PyObject *Store_type;
+    PyObject *Sub_singleton;
+    PyObject *Sub_type;
+    PyObject *Subscript_type;
+    PyObject *Try_type;
+    PyObject *Tuple_type;
+    PyObject *TypeIgnore_type;
+    PyObject *UAdd_singleton;
+    PyObject *UAdd_type;
+    PyObject *USub_singleton;
+    PyObject *USub_type;
+    PyObject *UnaryOp_type;
+    PyObject *While_type;
+    PyObject *With_type;
+    PyObject *YieldFrom_type;
+    PyObject *Yield_type;
+    PyObject *__dict__;
+    PyObject *__doc__;
+    PyObject *__match_args__;
+    PyObject *__module__;
+    PyObject *_attributes;
+    PyObject *_fields;
+    PyObject *alias_type;
+    PyObject *annotation;
+    PyObject *arg;
+    PyObject *arg_type;
+    PyObject *args;
+    PyObject *argtypes;
+    PyObject *arguments_type;
+    PyObject *asname;
+    PyObject *ast;
+    PyObject *attr;
+    PyObject *bases;
+    PyObject *body;
+    PyObject *boolop_type;
+    PyObject *cases;
+    PyObject *cause;
+    PyObject *cls;
+    PyObject *cmpop_type;
+    PyObject *col_offset;
+    PyObject *comparators;
+    PyObject *comprehension_type;
+    PyObject *context_expr;
+    PyObject *conversion;
+    PyObject *ctx;
+    PyObject *decorator_list;
+    PyObject *defaults;
+    PyObject *elt;
+    PyObject *elts;
+    PyObject *end_col_offset;
+    PyObject *end_lineno;
+    PyObject *exc;
+    PyObject *excepthandler_type;
+    PyObject *expr_context_type;
+    PyObject *expr_type;
+    PyObject *finalbody;
+    PyObject *format_spec;
+    PyObject *func;
+    PyObject *generators;
+    PyObject *guard;
+    PyObject *handlers;
+    PyObject *id;
+    PyObject *ifs;
+    PyObject *is_async;
+    PyObject *items;
+    PyObject *iter;
+    PyObject *key;
+    PyObject *keys;
+    PyObject *keyword_type;
+    PyObject *keywords;
+    PyObject *kind;
+    PyObject *kw_defaults;
+    PyObject *kwarg;
+    PyObject *kwd_attrs;
+    PyObject *kwd_patterns;
+    PyObject *kwonlyargs;
+    PyObject *left;
+    PyObject *level;
+    PyObject *lineno;
+    PyObject *lower;
+    PyObject *match_case_type;
+    PyObject *mod_type;
+    PyObject *module;
+    PyObject *msg;
+    PyObject *name;
+    PyObject *names;
+    PyObject *op;
+    PyObject *operand;
+    PyObject *operator_type;
+    PyObject *ops;
+    PyObject *optional_vars;
+    PyObject *orelse;
+    PyObject *pattern;
+    PyObject *pattern_type;
+    PyObject *patterns;
+    PyObject *posonlyargs;
+    PyObject *rest;
+    PyObject *returns;
+    PyObject *right;
+    PyObject *simple;
+    PyObject *slice;
+    PyObject *step;
+    PyObject *stmt_type;
+    PyObject *subject;
+    PyObject *tag;
+    PyObject *target;
+    PyObject *targets;
+    PyObject *test;
+    PyObject *type;
+    PyObject *type_comment;
+    PyObject *type_ignore_type;
+    PyObject *type_ignores;
+    PyObject *unaryop_type;
+    PyObject *upper;
+    PyObject *value;
+    PyObject *values;
+    PyObject *vararg;
+    PyObject *withitem_type;
+};
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !Py_INTERNAL_AST_STATE_H */
+
diff --git a/Include/internal/pycore_atomic.h b/Include/internal/pycore_atomic.h
index 1d5c562..3d42e54 100644
--- a/Include/internal/pycore_atomic.h
+++ b/Include/internal/pycore_atomic.h
@@ -11,8 +11,8 @@
 #include "dynamic_annotations.h"   /* _Py_ANNOTATE_MEMORY_ORDER */
 #include "pyconfig.h"
 
-#if defined(HAVE_STD_ATOMIC)
-#include <stdatomic.h>
+#ifdef HAVE_STD_ATOMIC
+#  include <stdatomic.h>
 #endif
 
 
@@ -62,7 +62,7 @@
 #define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \
     atomic_load_explicit(&((ATOMIC_VAL)->_value), ORDER)
 
-/* Use builtin atomic operations in GCC >= 4.7 */
+// Use builtin atomic operations in GCC >= 4.7 and clang
 #elif defined(HAVE_BUILTIN_ATOMIC)
 
 typedef enum _Py_memory_order {
diff --git a/Include/internal/pycore_atomic_funcs.h b/Include/internal/pycore_atomic_funcs.h
new file mode 100644
index 0000000..a708789
--- /dev/null
+++ b/Include/internal/pycore_atomic_funcs.h
@@ -0,0 +1,94 @@
+/* Atomic functions: similar to pycore_atomic.h, but don't need
+   to declare variables as atomic.
+
+   Py_ssize_t type:
+
+   * value = _Py_atomic_size_get(&var)
+   * _Py_atomic_size_set(&var, value)
+
+   Use sequentially-consistent ordering (__ATOMIC_SEQ_CST memory order):
+   enforce total ordering with all other atomic functions.
+*/
+#ifndef Py_ATOMIC_FUNC_H
+#define Py_ATOMIC_FUNC_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef Py_BUILD_CORE
+#  error "this header requires Py_BUILD_CORE define"
+#endif
+
+#if defined(_MSC_VER)
+#  include <intrin.h>             // _InterlockedExchange()
+#endif
+
+
+// Use builtin atomic operations in GCC >= 4.7 and clang
+#ifdef HAVE_BUILTIN_ATOMIC
+
+static inline Py_ssize_t _Py_atomic_size_get(Py_ssize_t *var)
+{
+    return __atomic_load_n(var, __ATOMIC_SEQ_CST);
+}
+
+static inline void _Py_atomic_size_set(Py_ssize_t *var, Py_ssize_t value)
+{
+    __atomic_store_n(var, value, __ATOMIC_SEQ_CST);
+}
+
+#elif defined(_MSC_VER)
+
+static inline Py_ssize_t _Py_atomic_size_get(Py_ssize_t *var)
+{
+#if SIZEOF_VOID_P == 8
+    Py_BUILD_ASSERT(sizeof(__int64) == sizeof(*var));
+    volatile __int64 *volatile_var = (volatile __int64 *)var;
+    __int64 old;
+    do {
+        old = *volatile_var;
+    } while(_InterlockedCompareExchange64(volatile_var, old, old) != old);
+#else
+    Py_BUILD_ASSERT(sizeof(long) == sizeof(*var));
+    volatile long *volatile_var = (volatile long *)var;
+    long old;
+    do {
+        old = *volatile_var;
+    } while(_InterlockedCompareExchange(volatile_var, old, old) != old);
+#endif
+    return old;
+}
+
+static inline void _Py_atomic_size_set(Py_ssize_t *var, Py_ssize_t value)
+{
+#if SIZEOF_VOID_P == 8
+    Py_BUILD_ASSERT(sizeof(__int64) == sizeof(*var));
+    volatile __int64 *volatile_var = (volatile __int64 *)var;
+    _InterlockedExchange64(volatile_var, value);
+#else
+    Py_BUILD_ASSERT(sizeof(long) == sizeof(*var));
+    volatile long *volatile_var = (volatile long *)var;
+    _InterlockedExchange(volatile_var, value);
+#endif
+}
+
+#else
+// Fallback implementation using volatile
+
+static inline Py_ssize_t _Py_atomic_size_get(Py_ssize_t *var)
+{
+    volatile Py_ssize_t *volatile_var = (volatile Py_ssize_t *)var;
+    return *volatile_var;
+}
+
+static inline void _Py_atomic_size_set(Py_ssize_t *var, Py_ssize_t value)
+{
+    volatile Py_ssize_t *volatile_var = (volatile Py_ssize_t *)var;
+    *volatile_var = value;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif  /* Py_ATOMIC_FUNC_H */
diff --git a/Include/internal/pycore_bitutils.h b/Include/internal/pycore_bitutils.h
new file mode 100644
index 0000000..e4aa7a3
--- /dev/null
+++ b/Include/internal/pycore_bitutils.h
@@ -0,0 +1,176 @@
+/* Bit and bytes utilities.
+
+   Bytes swap functions, reverse order of bytes:
+
+   - _Py_bswap16(uint16_t)
+   - _Py_bswap32(uint32_t)
+   - _Py_bswap64(uint64_t)
+*/
+
+#ifndef Py_INTERNAL_BITUTILS_H
+#define Py_INTERNAL_BITUTILS_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef Py_BUILD_CORE
+#  error "this header requires Py_BUILD_CORE define"
+#endif
+
+#if defined(__GNUC__) \
+      && ((__GNUC__ >= 5) || (__GNUC__ == 4) && (__GNUC_MINOR__ >= 8))
+   /* __builtin_bswap16() is available since GCC 4.8,
+      __builtin_bswap32() is available since GCC 4.3,
+      __builtin_bswap64() is available since GCC 4.3. */
+#  define _PY_HAVE_BUILTIN_BSWAP
+#endif
+
+#ifdef _MSC_VER
+   /* Get _byteswap_ushort(), _byteswap_ulong(), _byteswap_uint64() */
+#  include <intrin.h>
+#endif
+
+static inline uint16_t
+_Py_bswap16(uint16_t word)
+{
+#if defined(_PY_HAVE_BUILTIN_BSWAP) || _Py__has_builtin(__builtin_bswap16)
+    return __builtin_bswap16(word);
+#elif defined(_MSC_VER)
+    Py_BUILD_ASSERT(sizeof(word) == sizeof(unsigned short));
+    return _byteswap_ushort(word);
+#else
+    // Portable implementation which doesn't rely on circular bit shift
+    return ( ((word & UINT16_C(0x00FF)) << 8)
+           | ((word & UINT16_C(0xFF00)) >> 8));
+#endif
+}
+
+static inline uint32_t
+_Py_bswap32(uint32_t word)
+{
+#if defined(_PY_HAVE_BUILTIN_BSWAP) || _Py__has_builtin(__builtin_bswap32)
+    return __builtin_bswap32(word);
+#elif defined(_MSC_VER)
+    Py_BUILD_ASSERT(sizeof(word) == sizeof(unsigned long));
+    return _byteswap_ulong(word);
+#else
+    // Portable implementation which doesn't rely on circular bit shift
+    return ( ((word & UINT32_C(0x000000FF)) << 24)
+           | ((word & UINT32_C(0x0000FF00)) <<  8)
+           | ((word & UINT32_C(0x00FF0000)) >>  8)
+           | ((word & UINT32_C(0xFF000000)) >> 24));
+#endif
+}
+
+static inline uint64_t
+_Py_bswap64(uint64_t word)
+{
+#if defined(_PY_HAVE_BUILTIN_BSWAP) || _Py__has_builtin(__builtin_bswap64)
+    return __builtin_bswap64(word);
+#elif defined(_MSC_VER)
+    return _byteswap_uint64(word);
+#else
+    // Portable implementation which doesn't rely on circular bit shift
+    return ( ((word & UINT64_C(0x00000000000000FF)) << 56)
+           | ((word & UINT64_C(0x000000000000FF00)) << 40)
+           | ((word & UINT64_C(0x0000000000FF0000)) << 24)
+           | ((word & UINT64_C(0x00000000FF000000)) <<  8)
+           | ((word & UINT64_C(0x000000FF00000000)) >>  8)
+           | ((word & UINT64_C(0x0000FF0000000000)) >> 24)
+           | ((word & UINT64_C(0x00FF000000000000)) >> 40)
+           | ((word & UINT64_C(0xFF00000000000000)) >> 56));
+#endif
+}
+
+
+// Population count: count the number of 1's in 'x'
+// (number of bits set to 1), also known as the hamming weight.
+//
+// Implementation note. CPUID is not used, to test if x86 POPCNT instruction
+// can be used, to keep the implementation simple. For example, Visual Studio
+// __popcnt() is not used this reason. The clang and GCC builtin function can
+// use the x86 POPCNT instruction if the target architecture has SSE4a or
+// newer.
+static inline int
+_Py_popcount32(uint32_t x)
+{
+#if (defined(__clang__) || defined(__GNUC__))
+
+#if SIZEOF_INT >= 4
+    Py_BUILD_ASSERT(sizeof(x) <= sizeof(unsigned int));
+    return __builtin_popcount(x);
+#else
+    // The C standard guarantees that unsigned long will always be big enough
+    // to hold a uint32_t value without losing information.
+    Py_BUILD_ASSERT(sizeof(x) <= sizeof(unsigned long));
+    return __builtin_popcountl(x);
+#endif
+
+#else
+    // 32-bit SWAR (SIMD Within A Register) popcount
+
+    // Binary: 0 1 0 1 ...
+    const uint32_t M1 = 0x55555555;
+    // Binary: 00 11 00 11. ..
+    const uint32_t M2 = 0x33333333;
+    // Binary: 0000 1111 0000 1111 ...
+    const uint32_t M4 = 0x0F0F0F0F;
+    // 256**4 + 256**3 + 256**2 + 256**1
+    const uint32_t SUM = 0x01010101;
+
+    // Put count of each 2 bits into those 2 bits
+    x = x - ((x >> 1) & M1);
+    // Put count of each 4 bits into those 4 bits
+    x = (x & M2) + ((x >> 2) & M2);
+    // Put count of each 8 bits into those 8 bits
+    x = (x + (x >> 4)) & M4;
+    // Sum of the 4 byte counts
+    return (uint32_t)((uint64_t)x * (uint64_t)SUM) >> 24;
+#endif
+}
+
+
+// Return the index of the most significant 1 bit in 'x'. This is the smallest
+// integer k such that x < 2**k. Equivalent to floor(log2(x)) + 1 for x != 0.
+static inline int
+_Py_bit_length(unsigned long x)
+{
+#if (defined(__clang__) || defined(__GNUC__))
+    if (x != 0) {
+        // __builtin_clzl() is available since GCC 3.4.
+        // Undefined behavior for x == 0.
+        return (int)sizeof(unsigned long) * 8 - __builtin_clzl(x);
+    }
+    else {
+        return 0;
+    }
+#elif defined(_MSC_VER)
+    // _BitScanReverse() is documented to search 32 bits.
+    Py_BUILD_ASSERT(sizeof(unsigned long) <= 4);
+    unsigned long msb;
+    if (_BitScanReverse(&msb, x)) {
+        return (int)msb + 1;
+    }
+    else {
+        return 0;
+    }
+#else
+    const int BIT_LENGTH_TABLE[32] = {
+        0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
+        5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
+    };
+    int msb = 0;
+    while (x >= 32) {
+        msb += 6;
+        x >>= 6;
+    }
+    msb += BIT_LENGTH_TABLE[x];
+    return msb;
+#endif
+}
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !Py_INTERNAL_BITUTILS_H */
diff --git a/Include/internal/pycore_blocks_output_buffer.h b/Include/internal/pycore_blocks_output_buffer.h
new file mode 100644
index 0000000..28cf6fb
--- /dev/null
+++ b/Include/internal/pycore_blocks_output_buffer.h
@@ -0,0 +1,317 @@
+/*
+   _BlocksOutputBuffer is used to maintain an output buffer
+   that has unpredictable size. Suitable for compression/decompression
+   API (bz2/lzma/zlib) that has stream->next_out and stream->avail_out:
+
+        stream->next_out:  point to the next output position.
+        stream->avail_out: the number of available bytes left in the buffer.
+
+   It maintains a list of bytes object, so there is no overhead of resizing
+   the buffer.
+
+   Usage:
+
+   1, Initialize the struct instance like this:
+        _BlocksOutputBuffer buffer = {.list = NULL};
+      Set .list to NULL for _BlocksOutputBuffer_OnError()
+
+   2, Initialize the buffer use one of these functions:
+        _BlocksOutputBuffer_InitAndGrow()
+        _BlocksOutputBuffer_InitWithSize()
+
+   3, If (avail_out == 0), grow the buffer:
+        _BlocksOutputBuffer_Grow()
+
+   4, Get the current outputted data size:
+        _BlocksOutputBuffer_GetDataSize()
+
+   5, Finish the buffer, and return a bytes object:
+        _BlocksOutputBuffer_Finish()
+
+   6, Clean up the buffer when an error occurred:
+        _BlocksOutputBuffer_OnError()
+*/
+
+#ifndef Py_INTERNAL_BLOCKS_OUTPUT_BUFFER_H
+#define Py_INTERNAL_BLOCKS_OUTPUT_BUFFER_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "Python.h"
+
+typedef struct {
+    // List of bytes objects
+    PyObject *list;
+    // Number of whole allocated size
+    Py_ssize_t allocated;
+    // Max length of the buffer, negative number means unlimited length.
+    Py_ssize_t max_length;
+} _BlocksOutputBuffer;
+
+static const char unable_allocate_msg[] = "Unable to allocate output buffer.";
+
+/* In 32-bit build, the max block size should <= INT32_MAX. */
+#define OUTPUT_BUFFER_MAX_BLOCK_SIZE (256*1024*1024)
+
+/* Block size sequence */
+#define KB (1024)
+#define MB (1024*1024)
+static const Py_ssize_t BUFFER_BLOCK_SIZE[] =
+    { 32*KB, 64*KB, 256*KB, 1*MB, 4*MB, 8*MB, 16*MB, 16*MB,
+      32*MB, 32*MB, 32*MB, 32*MB, 64*MB, 64*MB, 128*MB, 128*MB,
+      OUTPUT_BUFFER_MAX_BLOCK_SIZE };
+#undef KB
+#undef MB
+
+/* According to the block sizes defined by BUFFER_BLOCK_SIZE, the whole
+   allocated size growth step is:
+    1   32 KB       +32 KB
+    2   96 KB       +64 KB
+    3   352 KB      +256 KB
+    4   1.34 MB     +1 MB
+    5   5.34 MB     +4 MB
+    6   13.34 MB    +8 MB
+    7   29.34 MB    +16 MB
+    8   45.34 MB    +16 MB
+    9   77.34 MB    +32 MB
+    10  109.34 MB   +32 MB
+    11  141.34 MB   +32 MB
+    12  173.34 MB   +32 MB
+    13  237.34 MB   +64 MB
+    14  301.34 MB   +64 MB
+    15  429.34 MB   +128 MB
+    16  557.34 MB   +128 MB
+    17  813.34 MB   +256 MB
+    18  1069.34 MB  +256 MB
+    19  1325.34 MB  +256 MB
+    20  1581.34 MB  +256 MB
+    21  1837.34 MB  +256 MB
+    22  2093.34 MB  +256 MB
+    ...
+*/
+
+/* Initialize the buffer, and grow the buffer.
+
+   max_length: Max length of the buffer, -1 for unlimited length.
+
+   On success, return allocated size (>=0)
+   On failure, return -1
+*/
+static inline Py_ssize_t
+_BlocksOutputBuffer_InitAndGrow(_BlocksOutputBuffer *buffer,
+                                const Py_ssize_t max_length,
+                                void **next_out)
+{
+    PyObject *b;
+    Py_ssize_t block_size;
+
+    // ensure .list was set to NULL
+    assert(buffer->list == NULL);
+
+    // get block size
+    if (0 <= max_length && max_length < BUFFER_BLOCK_SIZE[0]) {
+        block_size = max_length;
+    } else {
+        block_size = BUFFER_BLOCK_SIZE[0];
+    }
+
+    // the first block
+    b = PyBytes_FromStringAndSize(NULL, block_size);
+    if (b == NULL) {
+        return -1;
+    }
+
+    // create the list
+    buffer->list = PyList_New(1);
+    if (buffer->list == NULL) {
+        Py_DECREF(b);
+        return -1;
+    }
+    PyList_SET_ITEM(buffer->list, 0, b);
+
+    // set variables
+    buffer->allocated = block_size;
+    buffer->max_length = max_length;
+
+    *next_out = PyBytes_AS_STRING(b);
+    return block_size;
+}
+
+/* Initialize the buffer, with an initial size.
+
+   Check block size limit in the outer wrapper function. For example, some libs
+   accept UINT32_MAX as the maximum block size, then init_size should <= it.
+
+   On success, return allocated size (>=0)
+   On failure, return -1
+*/
+static inline Py_ssize_t
+_BlocksOutputBuffer_InitWithSize(_BlocksOutputBuffer *buffer,
+                                 const Py_ssize_t init_size,
+                                 void **next_out)
+{
+    PyObject *b;
+
+    // ensure .list was set to NULL
+    assert(buffer->list == NULL);
+
+    // the first block
+    b = PyBytes_FromStringAndSize(NULL, init_size);
+    if (b == NULL) {
+        PyErr_SetString(PyExc_MemoryError, unable_allocate_msg);
+        return -1;
+    }
+
+    // create the list
+    buffer->list = PyList_New(1);
+    if (buffer->list == NULL) {
+        Py_DECREF(b);
+        return -1;
+    }
+    PyList_SET_ITEM(buffer->list, 0, b);
+
+    // set variables
+    buffer->allocated = init_size;
+    buffer->max_length = -1;
+
+    *next_out = PyBytes_AS_STRING(b);
+    return init_size;
+}
+
+/* Grow the buffer. The avail_out must be 0, please check it before calling.
+
+   On success, return allocated size (>=0)
+   On failure, return -1
+*/
+static inline Py_ssize_t
+_BlocksOutputBuffer_Grow(_BlocksOutputBuffer *buffer,
+                         void **next_out,
+                         const Py_ssize_t avail_out)
+{
+    PyObject *b;
+    const Py_ssize_t list_len = Py_SIZE(buffer->list);
+    Py_ssize_t block_size;
+
+    // ensure no gaps in the data
+    if (avail_out != 0) {
+        PyErr_SetString(PyExc_SystemError,
+                        "avail_out is non-zero in _BlocksOutputBuffer_Grow().");
+        return -1;
+    }
+
+    // get block size
+    if (list_len < (Py_ssize_t) Py_ARRAY_LENGTH(BUFFER_BLOCK_SIZE)) {
+        block_size = BUFFER_BLOCK_SIZE[list_len];
+    } else {
+        block_size = BUFFER_BLOCK_SIZE[Py_ARRAY_LENGTH(BUFFER_BLOCK_SIZE) - 1];
+    }
+
+    // check max_length
+    if (buffer->max_length >= 0) {
+        // if (rest == 0), should not grow the buffer.
+        Py_ssize_t rest = buffer->max_length - buffer->allocated;
+        assert(rest > 0);
+
+        // block_size of the last block
+        if (block_size > rest) {
+            block_size = rest;
+        }
+    }
+
+    // check buffer->allocated overflow
+    if (block_size > PY_SSIZE_T_MAX - buffer->allocated) {
+        PyErr_SetString(PyExc_MemoryError, unable_allocate_msg);
+        return -1;
+    }
+
+    // create the block
+    b = PyBytes_FromStringAndSize(NULL, block_size);
+    if (b == NULL) {
+        PyErr_SetString(PyExc_MemoryError, unable_allocate_msg);
+        return -1;
+    }
+    if (PyList_Append(buffer->list, b) < 0) {
+        Py_DECREF(b);
+        return -1;
+    }
+    Py_DECREF(b);
+
+    // set variables
+    buffer->allocated += block_size;
+
+    *next_out = PyBytes_AS_STRING(b);
+    return block_size;
+}
+
+/* Return the current outputted data size. */
+static inline Py_ssize_t
+_BlocksOutputBuffer_GetDataSize(_BlocksOutputBuffer *buffer,
+                                const Py_ssize_t avail_out)
+{
+    return buffer->allocated - avail_out;
+}
+
+/* Finish the buffer.
+
+   Return a bytes object on success
+   Return NULL on failure
+*/
+static inline PyObject *
+_BlocksOutputBuffer_Finish(_BlocksOutputBuffer *buffer,
+                           const Py_ssize_t avail_out)
+{
+    PyObject *result, *block;
+    const Py_ssize_t list_len = Py_SIZE(buffer->list);
+
+    // fast path for single block
+    if ((list_len == 1 && avail_out == 0) ||
+        (list_len == 2 && Py_SIZE(PyList_GET_ITEM(buffer->list, 1)) == avail_out))
+    {
+        block = PyList_GET_ITEM(buffer->list, 0);
+        Py_INCREF(block);
+
+        Py_CLEAR(buffer->list);
+        return block;
+    }
+
+    // final bytes object
+    result = PyBytes_FromStringAndSize(NULL, buffer->allocated - avail_out);
+    if (result == NULL) {
+        PyErr_SetString(PyExc_MemoryError, unable_allocate_msg);
+        return NULL;
+    }
+
+    // memory copy
+    if (list_len > 0) {
+        char *posi = PyBytes_AS_STRING(result);
+
+        // blocks except the last one
+        Py_ssize_t i = 0;
+        for (; i < list_len-1; i++) {
+            block = PyList_GET_ITEM(buffer->list, i);
+            memcpy(posi, PyBytes_AS_STRING(block), Py_SIZE(block));
+            posi += Py_SIZE(block);
+        }
+        // the last block
+        block = PyList_GET_ITEM(buffer->list, i);
+        memcpy(posi, PyBytes_AS_STRING(block), Py_SIZE(block) - avail_out);
+    } else {
+        assert(Py_SIZE(result) == 0);
+    }
+
+    Py_CLEAR(buffer->list);
+    return result;
+}
+
+/* Clean up the buffer when an error occurred. */
+static inline void
+_BlocksOutputBuffer_OnError(_BlocksOutputBuffer *buffer)
+{
+    Py_CLEAR(buffer->list);
+}
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* Py_INTERNAL_BLOCKS_OUTPUT_BUFFER_H */
\ No newline at end of file
diff --git a/Include/internal/pycore_byteswap.h b/Include/internal/pycore_byteswap.h
deleted file mode 100644
index 2b20fc6..0000000
--- a/Include/internal/pycore_byteswap.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* Bytes swap functions, reverse order of bytes:
-
-   - _Py_bswap16(uint16_t)
-   - _Py_bswap32(uint32_t)
-   - _Py_bswap64(uint64_t)
-*/
-
-#ifndef Py_INTERNAL_BSWAP_H
-#define Py_INTERNAL_BSWAP_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef Py_BUILD_CORE
-#  error "this header requires Py_BUILD_CORE define"
-#endif
-
-#if defined(__GNUC__) \
-      && ((__GNUC__ >= 5) || (__GNUC__ == 4) && (__GNUC_MINOR__ >= 8))
-   /* __builtin_bswap16() is available since GCC 4.8,
-      __builtin_bswap32() is available since GCC 4.3,
-      __builtin_bswap64() is available since GCC 4.3. */
-#  define _PY_HAVE_BUILTIN_BSWAP
-#endif
-
-#ifdef _MSC_VER
-   /* Get _byteswap_ushort(), _byteswap_ulong(), _byteswap_uint64() */
-#  include <intrin.h>
-#endif
-
-static inline uint16_t
-_Py_bswap16(uint16_t word)
-{
-#if defined(_PY_HAVE_BUILTIN_BSWAP) || _Py__has_builtin(__builtin_bswap16)
-    return __builtin_bswap16(word);
-#elif defined(_MSC_VER)
-    Py_BUILD_ASSERT(sizeof(word) == sizeof(unsigned short));
-    return _byteswap_ushort(word);
-#else
-    // Portable implementation which doesn't rely on circular bit shift
-    return ( ((word & UINT16_C(0x00FF)) << 8)
-           | ((word & UINT16_C(0xFF00)) >> 8));
-#endif
-}
-
-static inline uint32_t
-_Py_bswap32(uint32_t word)
-{
-#if defined(_PY_HAVE_BUILTIN_BSWAP) || _Py__has_builtin(__builtin_bswap32)
-    return __builtin_bswap32(word);
-#elif defined(_MSC_VER)
-    Py_BUILD_ASSERT(sizeof(word) == sizeof(unsigned long));
-    return _byteswap_ulong(word);
-#else
-    // Portable implementation which doesn't rely on circular bit shift
-    return ( ((word & UINT32_C(0x000000FF)) << 24)
-           | ((word & UINT32_C(0x0000FF00)) <<  8)
-           | ((word & UINT32_C(0x00FF0000)) >>  8)
-           | ((word & UINT32_C(0xFF000000)) >> 24));
-#endif
-}
-
-static inline uint64_t
-_Py_bswap64(uint64_t word)
-{
-#if defined(_PY_HAVE_BUILTIN_BSWAP) || _Py__has_builtin(__builtin_bswap64)
-    return __builtin_bswap64(word);
-#elif defined(_MSC_VER)
-    return _byteswap_uint64(word);
-#else
-    // Portable implementation which doesn't rely on circular bit shift
-    return ( ((word & UINT64_C(0x00000000000000FF)) << 56)
-           | ((word & UINT64_C(0x000000000000FF00)) << 40)
-           | ((word & UINT64_C(0x0000000000FF0000)) << 24)
-           | ((word & UINT64_C(0x00000000FF000000)) <<  8)
-           | ((word & UINT64_C(0x000000FF00000000)) >>  8)
-           | ((word & UINT64_C(0x0000FF0000000000)) >> 24)
-           | ((word & UINT64_C(0x00FF000000000000)) >> 40)
-           | ((word & UINT64_C(0xFF00000000000000)) >> 56));
-#endif
-}
-
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* !Py_INTERNAL_BSWAP_H */
-
diff --git a/Include/internal/pycore_ceval.h b/Include/internal/pycore_ceval.h
index 18c8f02..f573c3e 100644
--- a/Include/internal/pycore_ceval.h
+++ b/Include/internal/pycore_ceval.h
@@ -23,44 +23,50 @@
     PyInterpreterState *interp,
     int (*func)(void *),
     void *arg);
-PyAPI_FUNC(void) _PyEval_SignalAsyncExc(PyThreadState *tstate);
+PyAPI_FUNC(void) _PyEval_SignalAsyncExc(PyInterpreterState *interp);
 #ifdef HAVE_FORK
-extern void _PyEval_ReInitThreads(struct pyruntimestate *runtime);
+extern PyStatus _PyEval_ReInitThreads(PyThreadState *tstate);
 #endif
 PyAPI_FUNC(void) _PyEval_SetCoroutineOriginTrackingDepth(
     PyThreadState *tstate,
     int new_depth);
 
-/* Private function */
 void _PyEval_Fini(void);
 
+
+extern PyObject* _PyEval_GetBuiltins(PyThreadState *tstate);
+extern PyObject *_PyEval_BuiltinsFromGlobals(
+    PyThreadState *tstate,
+    PyObject *globals);
+
+
 static inline PyObject*
 _PyEval_EvalFrame(PyThreadState *tstate, PyFrameObject *f, int throwflag)
 {
     return tstate->interp->eval_frame(tstate, f, throwflag);
 }
 
-extern PyObject *_PyEval_EvalCode(
-    PyThreadState *tstate,
-    PyObject *_co, PyObject *globals, PyObject *locals,
-    PyObject *const *args, Py_ssize_t argcount,
-    PyObject *const *kwnames, PyObject *const *kwargs,
-    Py_ssize_t kwcount, int kwstep,
-    PyObject *const *defs, Py_ssize_t defcount,
-    PyObject *kwdefs, PyObject *closure,
-    PyObject *name, PyObject *qualname);
+extern PyObject *
+_PyEval_Vector(PyThreadState *tstate,
+            PyFrameConstructor *desc, PyObject *locals,
+            PyObject* const* args, size_t argcount,
+            PyObject *kwnames);
 
+#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+extern int _PyEval_ThreadsInitialized(PyInterpreterState *interp);
+#else
 extern int _PyEval_ThreadsInitialized(struct pyruntimestate *runtime);
+#endif
 extern PyStatus _PyEval_InitGIL(PyThreadState *tstate);
-extern void _PyEval_FiniGIL(PyThreadState *tstate);
+extern void _PyEval_FiniGIL(PyInterpreterState *interp);
 
 extern void _PyEval_ReleaseLock(PyThreadState *tstate);
 
+extern void _PyEval_DeactivateOpCache(void);
+
 
 /* --- _Py_EnterRecursiveCall() ----------------------------------------- */
 
-PyAPI_DATA(int) _Py_CheckRecursionLimit;
-
 #ifdef USE_STACKCHECK
 /* With USE_STACKCHECK macro defined, trigger stack checks in
    _Py_CheckRecursiveCall() on every 64th call to Py_EnterRecursiveCall. */
@@ -90,24 +96,8 @@
 
 #define Py_EnterRecursiveCall(where) _Py_EnterRecursiveCall_inline(where)
 
-/* Compute the "lower-water mark" for a recursion limit. When
- * Py_LeaveRecursiveCall() is called with a recursion depth below this mark,
- * the overflowed flag is reset to 0. */
-static inline int _Py_RecursionLimitLowerWaterMark(int limit) {
-    if (limit > 200) {
-        return (limit - 50);
-    }
-    else {
-        return (3 * (limit >> 2));
-    }
-}
-
 static inline void _Py_LeaveRecursiveCall(PyThreadState *tstate)  {
     tstate->recursion_depth--;
-    int limit = tstate->interp->ceval.recursion_limit;
-    if (tstate->recursion_depth < _Py_RecursionLimitLowerWaterMark(limit)) {
-        tstate->overflowed = 0;
-    }
 }
 
 static inline void _Py_LeaveRecursiveCall_inline(void)  {
diff --git a/Include/internal/pycore_code.h b/Include/internal/pycore_code.h
index 88956f1..8ff1863 100644
--- a/Include/internal/pycore_code.h
+++ b/Include/internal/pycore_code.h
@@ -3,16 +3,23 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
- 
+
 typedef struct {
     PyObject *ptr;  /* Cached pointer (borrowed reference) */
     uint64_t globals_ver;  /* ma_version of global dict */
     uint64_t builtins_ver; /* ma_version of builtin dict */
 } _PyOpcache_LoadGlobal;
 
+typedef struct {
+    PyTypeObject *type;
+    Py_ssize_t hint;
+    unsigned int tp_version_tag;
+} _PyOpCodeOpt_LoadAttr;
+
 struct _PyOpcache {
     union {
         _PyOpcache_LoadGlobal lg;
+        _PyOpCodeOpt_LoadAttr la;
     } u;
     char optimized;
 };
diff --git a/Include/internal/pycore_compile.h b/Include/internal/pycore_compile.h
new file mode 100644
index 0000000..06a6082
--- /dev/null
+++ b/Include/internal/pycore_compile.h
@@ -0,0 +1,44 @@
+#ifndef Py_INTERNAL_COMPILE_H
+#define Py_INTERNAL_COMPILE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef Py_BUILD_CORE
+#  error "this header requires Py_BUILD_CORE define"
+#endif
+
+struct _arena;   // Type defined in pycore_pyarena.h
+struct _mod;     // Type defined in pycore_ast.h
+
+// Export the symbol for test_peg_generator (built as a library)
+PyAPI_FUNC(PyCodeObject*) _PyAST_Compile(
+    struct _mod *mod,
+    PyObject *filename,
+    PyCompilerFlags *flags,
+    int optimize,
+    struct _arena *arena);
+extern PyFutureFeatures* _PyFuture_FromAST(
+    struct _mod * mod,
+    PyObject *filename
+    );
+
+extern PyObject* _Py_Mangle(PyObject *p, PyObject *name);
+
+typedef struct {
+    int optimize;
+    int ff_features;
+
+    int recursion_depth;            /* current recursion depth */
+    int recursion_limit;            /* recursion limit */
+} _PyASTOptimizeState;
+
+extern int _PyAST_Optimize(
+    struct _mod *,
+    struct _arena *arena,
+    _PyASTOptimizeState *state);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !Py_INTERNAL_COMPILE_H */
diff --git a/Include/internal/pycore_context.h b/Include/internal/pycore_context.h
index f665ad5..a482dd4 100644
--- a/Include/internal/pycore_context.h
+++ b/Include/internal/pycore_context.h
@@ -37,6 +37,6 @@
 
 
 int _PyContext_Init(void);
-void _PyContext_Fini(void);
+void _PyContext_Fini(PyInterpreterState *interp);
 
 #endif /* !Py_INTERNAL_CONTEXT_H */
diff --git a/Include/internal/pycore_fileutils.h b/Include/internal/pycore_fileutils.h
index bbee586..c1c9244 100644
--- a/Include/internal/pycore_fileutils.h
+++ b/Include/internal/pycore_fileutils.h
@@ -48,6 +48,23 @@
     PyObject **decimal_point,
     PyObject **thousands_sep);
 
+PyAPI_FUNC(void) _Py_closerange(int first, int last);
+
+PyAPI_FUNC(wchar_t*) _Py_GetLocaleEncoding(void);
+PyAPI_FUNC(PyObject*) _Py_GetLocaleEncodingObject(void);
+
+#ifdef HAVE_NON_UNICODE_WCHAR_T_REPRESENTATION
+extern int _Py_LocaleUsesNonUnicodeWchar(void);
+
+extern wchar_t* _Py_DecodeNonUnicodeWchar(
+    const wchar_t* native,
+    Py_ssize_t size);
+
+extern int _Py_EncodeNonUnicodeWchar_InPlace(
+    wchar_t* unicode,
+    Py_ssize_t size);
+#endif
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/Include/internal/pycore_format.h b/Include/internal/pycore_format.h
new file mode 100644
index 0000000..1b8d575
--- /dev/null
+++ b/Include/internal/pycore_format.h
@@ -0,0 +1,27 @@
+#ifndef Py_INTERNAL_FORMAT_H
+#define Py_INTERNAL_FORMAT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef Py_BUILD_CORE
+#  error "this header requires Py_BUILD_CORE define"
+#endif
+
+/* Format codes
+ * F_LJUST      '-'
+ * F_SIGN       '+'
+ * F_BLANK      ' '
+ * F_ALT        '#'
+ * F_ZERO       '0'
+ */
+#define F_LJUST (1<<0)
+#define F_SIGN  (1<<1)
+#define F_BLANK (1<<2)
+#define F_ALT   (1<<3)
+#define F_ZERO  (1<<4)
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !Py_INTERNAL_FORMAT_H */
diff --git a/Include/internal/pycore_gc.h b/Include/internal/pycore_gc.h
index 0511eea..9db4a47 100644
--- a/Include/internal/pycore_gc.h
+++ b/Include/internal/pycore_gc.h
@@ -161,17 +161,19 @@
     Py_ssize_t long_lived_pending;
 };
 
-PyAPI_FUNC(void) _PyGC_InitState(struct _gc_runtime_state *);
+extern void _PyGC_InitState(struct _gc_runtime_state *);
+
+extern Py_ssize_t _PyGC_CollectNoFail(PyThreadState *tstate);
 
 
 // Functions to clear types free lists
-extern void _PyFrame_ClearFreeList(void);
-extern void _PyTuple_ClearFreeList(void);
-extern void _PyFloat_ClearFreeList(void);
-extern void _PyList_ClearFreeList(void);
-extern void _PyDict_ClearFreeList(void);
-extern void _PyAsyncGen_ClearFreeLists(void);
-extern void _PyContext_ClearFreeList(void);
+extern void _PyFrame_ClearFreeList(PyInterpreterState *interp);
+extern void _PyTuple_ClearFreeList(PyInterpreterState *interp);
+extern void _PyFloat_ClearFreeList(PyInterpreterState *interp);
+extern void _PyList_ClearFreeList(PyInterpreterState *interp);
+extern void _PyDict_ClearFreeList(PyInterpreterState *interp);
+extern void _PyAsyncGen_ClearFreeLists(PyInterpreterState *interp);
+extern void _PyContext_ClearFreeList(PyInterpreterState *interp);
 
 #ifdef __cplusplus
 }
diff --git a/Include/internal/pycore_import.h b/Include/internal/pycore_import.h
index b011ea4..e21ed0a 100644
--- a/Include/internal/pycore_import.h
+++ b/Include/internal/pycore_import.h
@@ -5,15 +5,10 @@
 extern "C" {
 #endif
 
-PyAPI_FUNC(PyObject *) _PyImport_FindBuiltin(
-    PyThreadState *tstate,
-    const char *name             /* UTF-8 encoded string */
-    );
-
 #ifdef HAVE_FORK
-extern void _PyImport_ReInitLock(void);
+extern PyStatus _PyImport_ReInitLock(void);
 #endif
-extern void _PyImport_Cleanup(PyThreadState *tstate);
+extern PyObject* _PyImport_BootstrapImp(PyThreadState *tstate);
 
 #ifdef __cplusplus
 }
diff --git a/Include/internal/pycore_initconfig.h b/Include/internal/pycore_initconfig.h
index 457a005..4b009e8 100644
--- a/Include/internal/pycore_initconfig.h
+++ b/Include/internal/pycore_initconfig.h
@@ -44,6 +44,8 @@
 #define _PyStatus_UPDATE_FUNC(err) \
     do { err.func = _PyStatus_GET_FUNC(); } while (0)
 
+PyObject* _PyErr_SetFromPyStatus(PyStatus status);
+
 /* --- PyWideStringList ------------------------------------------------ */
 
 #define _PyWideStringList_INIT (PyWideStringList){.length = 0, .items = NULL}
@@ -100,6 +102,7 @@
     int isolated;             /* -I option */
     int use_environment;      /* -E option */
     int dev_mode;             /* -X dev and PYTHONDEVMODE */
+    int warn_default_encoding;     /* -X warn_default_encoding and PYTHONWARNDEFAULTENCODING */
 } _PyPreCmdline;
 
 #define _PyPreCmdline_INIT \
@@ -149,13 +152,19 @@
 extern PyStatus _PyConfig_Copy(
     PyConfig *config,
     const PyConfig *config2);
-extern PyStatus _PyConfig_InitPathConfig(PyConfig *config);
+extern PyStatus _PyConfig_InitPathConfig(
+    PyConfig *config,
+    int compute_path_config);
+extern PyStatus _PyConfig_Read(PyConfig *config, int compute_path_config);
 extern PyStatus _PyConfig_Write(const PyConfig *config,
     struct pyruntimestate *runtime);
 extern PyStatus _PyConfig_SetPyArgv(
     PyConfig *config,
     const _PyArgv *args);
 
+PyAPI_FUNC(PyObject*) _PyConfig_AsDict(const PyConfig *config);
+PyAPI_FUNC(int) _PyConfig_FromDict(PyConfig *config, PyObject *dict);
+
 
 /* --- Function used for testing ---------------------------------- */
 
diff --git a/Include/internal/pycore_interp.h b/Include/internal/pycore_interp.h
index 551ad83..4307b61 100644
--- a/Include/internal/pycore_interp.h
+++ b/Include/internal/pycore_interp.h
@@ -8,12 +8,11 @@
 #  error "this header requires Py_BUILD_CORE define"
 #endif
 
-#include "pycore_atomic.h"    /* _Py_atomic_address */
-#include "pycore_gil.h"       /* struct _gil_runtime_state  */
-#include "pycore_gc.h"        /* struct _gc_runtime_state */
-#include "pycore_warnings.h"  /* struct _warnings_runtime_state */
-
-/* ceval state */
+#include "pycore_atomic.h"        // _Py_atomic_address
+#include "pycore_ast_state.h"     // struct ast_state
+#include "pycore_gil.h"           // struct _gil_runtime_state
+#include "pycore_gc.h"            // struct _gc_runtime_state
+#include "pycore_warnings.h"      // struct _warnings_runtime_state
 
 struct _pending_calls {
     PyThread_type_lock lock;
@@ -34,18 +33,15 @@
 
 struct _ceval_state {
     int recursion_limit;
-    /* Records whether tracing is on for any thread.  Counts the number
-       of threads for which tstate->c_tracefunc is non-NULL, so if the
-       value is 0, we know we don't have to check this thread's
-       c_tracefunc.  This speeds up the if statement in
-       _PyEval_EvalFrameDefault() after fast_next_opcode. */
-    int tracing_possible;
     /* This single variable consolidates all requests to break out of
        the fast path in the eval loop. */
     _Py_atomic_int eval_breaker;
     /* Request for dropping the GIL */
     _Py_atomic_int gil_drop_request;
     struct _pending_calls pending;
+#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+    struct _gil_runtime_state gil;
+#endif
 };
 
 /* fs_codec.encoding is initialized to NULL.
@@ -57,8 +53,150 @@
     _Py_error_handler error_handler;
 };
 
+struct _Py_bytes_state {
+    PyObject *empty_string;
+    PyBytesObject *characters[256];
+};
+
+struct _Py_unicode_ids {
+    Py_ssize_t size;
+    PyObject **array;
+};
+
 struct _Py_unicode_state {
+    // The empty Unicode object is a singleton to improve performance.
+    PyObject *empty_string;
+    /* Single character Unicode strings in the Latin-1 range are being
+       shared as well. */
+    PyObject *latin1[256];
     struct _Py_unicode_fs_codec fs_codec;
+
+    // Unused member kept for ABI backward compatibility with Python 3.10.0:
+    // see bpo-46006.
+    PyObject *unused_interned;
+
+    // Unicode identifiers (_Py_Identifier): see _PyUnicode_FromId()
+    struct _Py_unicode_ids ids;
+};
+
+struct _Py_float_state {
+    /* Special free list
+       free_list is a singly-linked list of available PyFloatObjects,
+       linked via abuse of their ob_type members. */
+    int numfree;
+    PyFloatObject *free_list;
+};
+
+/* Speed optimization to avoid frequent malloc/free of small tuples */
+#ifndef PyTuple_MAXSAVESIZE
+   // Largest tuple to save on free list
+#  define PyTuple_MAXSAVESIZE 20
+#endif
+#ifndef PyTuple_MAXFREELIST
+   // Maximum number of tuples of each size to save
+#  define PyTuple_MAXFREELIST 2000
+#endif
+
+struct _Py_tuple_state {
+#if PyTuple_MAXSAVESIZE > 0
+    /* Entries 1 up to PyTuple_MAXSAVESIZE are free lists,
+       entry 0 is the empty tuple () of which at most one instance
+       will be allocated. */
+    PyTupleObject *free_list[PyTuple_MAXSAVESIZE];
+    int numfree[PyTuple_MAXSAVESIZE];
+#endif
+};
+
+/* Empty list reuse scheme to save calls to malloc and free */
+#ifndef PyList_MAXFREELIST
+#  define PyList_MAXFREELIST 80
+#endif
+
+struct _Py_list_state {
+    PyListObject *free_list[PyList_MAXFREELIST];
+    int numfree;
+};
+
+#ifndef PyDict_MAXFREELIST
+#  define PyDict_MAXFREELIST 80
+#endif
+
+struct _Py_dict_state {
+    /* Dictionary reuse scheme to save calls to malloc and free */
+    PyDictObject *free_list[PyDict_MAXFREELIST];
+    int numfree;
+    PyDictKeysObject *keys_free_list[PyDict_MAXFREELIST];
+    int keys_numfree;
+};
+
+struct _Py_frame_state {
+    PyFrameObject *free_list;
+    /* number of frames currently in free_list */
+    int numfree;
+};
+
+#ifndef _PyAsyncGen_MAXFREELIST
+#  define _PyAsyncGen_MAXFREELIST 80
+#endif
+
+struct _Py_async_gen_state {
+    /* Freelists boost performance 6-10%; they also reduce memory
+       fragmentation, as _PyAsyncGenWrappedValue and PyAsyncGenASend
+       are short-living objects that are instantiated for every
+       __anext__() call. */
+    struct _PyAsyncGenWrappedValue* value_freelist[_PyAsyncGen_MAXFREELIST];
+    int value_numfree;
+
+    struct PyAsyncGenASend* asend_freelist[_PyAsyncGen_MAXFREELIST];
+    int asend_numfree;
+};
+
+struct _Py_context_state {
+    // List of free PyContext objects
+    PyContext *freelist;
+    int numfree;
+};
+
+struct _Py_exc_state {
+    // The dict mapping from errno codes to OSError subclasses
+    PyObject *errnomap;
+    PyBaseExceptionObject *memerrors_freelist;
+    int memerrors_numfree;
+};
+
+
+// atexit state
+typedef struct {
+    PyObject *func;
+    PyObject *args;
+    PyObject *kwargs;
+} atexit_callback;
+
+struct atexit_state {
+    atexit_callback **callbacks;
+    int ncallbacks;
+    int callback_len;
+};
+
+
+// Type attribute lookup cache: speed up attribute and method lookups,
+// see _PyType_Lookup().
+struct type_cache_entry {
+    unsigned int version;  // initialized from type->tp_version_tag
+    PyObject *name;        // reference to exactly a str or None
+    PyObject *value;       // borrowed reference or NULL
+};
+
+#define MCACHE_SIZE_EXP 12
+#define MCACHE_STATS 0
+
+struct type_cache {
+    struct type_cache_entry hashtable[1 << MCACHE_SIZE_EXP];
+#if MCACHE_STATS
+    size_t hits;
+    size_t misses;
+    size_t collisions;
+#endif
 };
 
 
@@ -67,6 +205,11 @@
 #define _PY_NSMALLPOSINTS           257
 #define _PY_NSMALLNEGINTS           5
 
+// _PyLong_GetZero() and _PyLong_GetOne() must always be available
+#if _PY_NSMALLPOSINTS < 2
+#  error "_PY_NSMALLPOSINTS must be greater than 1"
+#endif
+
 // The PyInterpreterState typedef is in Include/pystate.h.
 struct _is {
 
@@ -88,10 +231,14 @@
     struct _ceval_state ceval;
     struct _gc_runtime_state gc;
 
+    // sys.modules dictionary
     PyObject *modules;
     PyObject *modules_by_index;
+    // Dictionary of the sys module
     PyObject *sysdict;
+    // Dictionary of the builtins module
     PyObject *builtins;
+    // importlib module
     PyObject *importlib;
 
     /* Used in Modules/_threadmodule.c. */
@@ -107,8 +254,6 @@
     PyObject *codec_error_registry;
     int codecs_initialized;
 
-    struct _Py_unicode_state unicode;
-
     PyConfig config;
 #ifdef HAVE_DLOPEN
     int dlopenflags;
@@ -118,7 +263,7 @@
 
     PyObject *builtins_copy;
     PyObject *import_func;
-    /* Initialized to PyEval_EvalFrameDefault(). */
+    // Initialized to _PyEval_EvalFrameDefault().
     _PyFrameEvalFunction eval_frame;
 
     Py_ssize_t co_extra_user_count;
@@ -129,40 +274,41 @@
     PyObject *after_forkers_parent;
     PyObject *after_forkers_child;
 #endif
-    /* AtExit module */
-    void (*pyexitfunc)(PyObject *);
-    PyObject *pyexitmodule;
 
     uint64_t tstate_next_unique_id;
 
     struct _warnings_runtime_state warnings;
+    struct atexit_state atexit;
 
     PyObject *audit_hooks;
 
-    struct {
-        struct {
-            int level;
-            int atbol;
-        } listnode;
-    } parser;
-
-#if _PY_NSMALLNEGINTS + _PY_NSMALLPOSINTS > 0
     /* Small integers are preallocated in this array so that they
        can be shared.
        The integers that are preallocated are those in the range
        -_PY_NSMALLNEGINTS (inclusive) to _PY_NSMALLPOSINTS (not inclusive).
     */
     PyLongObject* small_ints[_PY_NSMALLNEGINTS + _PY_NSMALLPOSINTS];
-#endif
+    struct _Py_bytes_state bytes;
+    struct _Py_unicode_state unicode;
+    struct _Py_float_state float_state;
+    /* Using a cache is very effective since typically only a single slice is
+       created and then deleted again. */
+    PySliceObject *slice_cache;
+
+    struct _Py_tuple_state tuple;
+    struct _Py_list_state list;
+    struct _Py_dict_state dict_state;
+    struct _Py_frame_state frame;
+    struct _Py_async_gen_state async_gen;
+    struct _Py_context_state context;
+    struct _Py_exc_state exc_state;
+
+    struct ast_state ast;
+    struct type_cache type_cache;
 };
 
-/* Used by _PyImport_Cleanup() */
 extern void _PyInterpreterState_ClearModules(PyInterpreterState *interp);
-
-extern PyStatus _PyInterpreterState_SetConfig(
-    PyInterpreterState *interp,
-    const PyConfig *config);
-
+extern void _PyInterpreterState_Clear(PyThreadState *tstate);
 
 
 /* cross-interpreter data registry */
@@ -182,11 +328,10 @@
 PyAPI_FUNC(struct _is*) _PyInterpreterState_LookUpID(int64_t);
 
 PyAPI_FUNC(int) _PyInterpreterState_IDInitref(struct _is *);
-PyAPI_FUNC(void) _PyInterpreterState_IDIncref(struct _is *);
+PyAPI_FUNC(int) _PyInterpreterState_IDIncref(struct _is *);
 PyAPI_FUNC(void) _PyInterpreterState_IDDecref(struct _is *);
 
 #ifdef __cplusplus
 }
 #endif
 #endif /* !Py_INTERNAL_INTERP_H */
-
diff --git a/Include/internal/pycore_list.h b/Include/internal/pycore_list.h
new file mode 100644
index 0000000..f18fb05
--- /dev/null
+++ b/Include/internal/pycore_list.h
@@ -0,0 +1,20 @@
+#ifndef Py_INTERNAL_LIST_H
+#define Py_INTERNAL_LIST_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef Py_BUILD_CORE
+#  error "this header requires Py_BUILD_CORE define"
+#endif
+
+#include "listobject.h"           // _PyList_CAST()
+
+
+#define _PyList_ITEMS(op) (_PyList_CAST(op)->ob_item)
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif   /* !Py_INTERNAL_LIST_H */
diff --git a/Include/internal/pycore_long.h b/Include/internal/pycore_long.h
new file mode 100644
index 0000000..2bea3a5
--- /dev/null
+++ b/Include/internal/pycore_long.h
@@ -0,0 +1,40 @@
+#ifndef Py_INTERNAL_LONG_H
+#define Py_INTERNAL_LONG_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef Py_BUILD_CORE
+#  error "this header requires Py_BUILD_CORE define"
+#endif
+
+#include "pycore_interp.h"        // PyInterpreterState.small_ints
+#include "pycore_pystate.h"       // _PyThreadState_GET()
+
+// Don't call this function but _PyLong_GetZero() and _PyLong_GetOne()
+static inline PyObject* __PyLong_GetSmallInt_internal(int value)
+{
+    PyInterpreterState *interp = _PyInterpreterState_GET();
+    assert(-_PY_NSMALLNEGINTS <= value && value < _PY_NSMALLPOSINTS);
+    size_t index = _PY_NSMALLNEGINTS + value;
+    PyObject *obj = (PyObject*)interp->small_ints[index];
+    // _PyLong_GetZero(), _PyLong_GetOne() and get_small_int() must not be
+    // called before _PyLong_Init() nor after _PyLong_Fini().
+    assert(obj != NULL);
+    return obj;
+}
+
+// Return a borrowed reference to the zero singleton.
+// The function cannot return NULL.
+static inline PyObject* _PyLong_GetZero(void)
+{ return __PyLong_GetSmallInt_internal(0); }
+
+// Return a borrowed reference to the one singleton.
+// The function cannot return NULL.
+static inline PyObject* _PyLong_GetOne(void)
+{ return __PyLong_GetSmallInt_internal(1); }
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !Py_INTERNAL_LONG_H */
diff --git a/Include/internal/pycore_moduleobject.h b/Include/internal/pycore_moduleobject.h
new file mode 100644
index 0000000..e9978ab
--- /dev/null
+++ b/Include/internal/pycore_moduleobject.h
@@ -0,0 +1,42 @@
+#ifndef Py_INTERNAL_MODULEOBJECT_H
+#define Py_INTERNAL_MODULEOBJECT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef Py_BUILD_CORE
+#  error "this header requires Py_BUILD_CORE define"
+#endif
+
+typedef struct {
+    PyObject_HEAD
+    PyObject *md_dict;
+    struct PyModuleDef *md_def;
+    void *md_state;
+    PyObject *md_weaklist;
+    // for logging purposes after md_dict is cleared
+    PyObject *md_name;
+} PyModuleObject;
+
+static inline PyModuleDef* _PyModule_GetDef(PyObject *mod) {
+    assert(PyModule_Check(mod));
+    return ((PyModuleObject *)mod)->md_def;
+}
+
+static inline void* _PyModule_GetState(PyObject* mod) {
+    assert(PyModule_Check(mod));
+    return ((PyModuleObject *)mod)->md_state;
+}
+
+static inline PyObject* _PyModule_GetDict(PyObject *mod) {
+    assert(PyModule_Check(mod));
+    PyObject *dict = ((PyModuleObject *)mod) -> md_dict;
+    // _PyModule_GetDict(mod) must not be used after calling module_clear(mod)
+    assert(dict != NULL);
+    return dict;
+}
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !Py_INTERNAL_MODULEOBJECT_H */
diff --git a/Include/internal/pycore_object.h b/Include/internal/pycore_object.h
index 32e86d0..90d9813 100644
--- a/Include/internal/pycore_object.h
+++ b/Include/internal/pycore_object.h
@@ -8,15 +8,59 @@
 #  error "this header requires Py_BUILD_CORE define"
 #endif
 
-#include "pycore_gc.h"         // _PyObject_GC_IS_TRACKED()
-#include "pycore_interp.h"     // PyInterpreterState.gc
-#include "pycore_pystate.h"    // _PyThreadState_GET()
+#include "pycore_gc.h"            // _PyObject_GC_IS_TRACKED()
+#include "pycore_interp.h"        // PyInterpreterState.gc
+#include "pycore_pystate.h"       // _PyInterpreterState_GET()
 
 PyAPI_FUNC(int) _PyType_CheckConsistency(PyTypeObject *type);
 PyAPI_FUNC(int) _PyDict_CheckConsistency(PyObject *mp, int check_content);
 
+/* Update the Python traceback of an object. This function must be called
+   when a memory block is reused from a free list.
+
+   Internal function called by _Py_NewReference(). */
+extern int _PyTraceMalloc_NewReference(PyObject *op);
+
+// Fast inlined version of PyType_HasFeature()
+static inline int
+_PyType_HasFeature(PyTypeObject *type, unsigned long feature) {
+    return ((type->tp_flags & feature) != 0);
+}
+
+extern void _PyType_InitCache(PyInterpreterState *interp);
+
+/* Only private in Python 3.10 and 3.9.8+; public in 3.11 */
+extern PyObject *_PyType_GetQualName(PyTypeObject *type);
+
+/* Inline functions trading binary compatibility for speed:
+   _PyObject_Init() is the fast version of PyObject_Init(), and
+   _PyObject_InitVar() is the fast version of PyObject_InitVar().
+
+   These inline functions must not be called with op=NULL. */
+static inline void
+_PyObject_Init(PyObject *op, PyTypeObject *typeobj)
+{
+    assert(op != NULL);
+    Py_SET_TYPE(op, typeobj);
+    if (_PyType_HasFeature(typeobj, Py_TPFLAGS_HEAPTYPE)) {
+        Py_INCREF(typeobj);
+    }
+    _Py_NewReference(op);
+}
+
+static inline void
+_PyObject_InitVar(PyVarObject *op, PyTypeObject *typeobj, Py_ssize_t size)
+{
+    assert(op != NULL);
+    Py_SET_SIZE(op, size);
+    _PyObject_Init((PyObject *)op, typeobj);
+}
+
+
 /* Tell the GC to track this object.
  *
+ * The object must not be tracked by the GC.
+ *
  * NB: While the object is tracked by the collector, it must be safe to call the
  * ob_traverse method.
  *
@@ -24,23 +68,27 @@
  * because it's not object header.  So we don't use _PyGCHead_PREV() and
  * _PyGCHead_SET_PREV() for it to avoid unnecessary bitwise operations.
  *
- * The PyObject_GC_Track() function is the public version of this macro.
+ * See also the public PyObject_GC_Track() function.
  */
-static inline void _PyObject_GC_TRACK_impl(const char *filename, int lineno,
-                                           PyObject *op)
+static inline void _PyObject_GC_TRACK(
+// The preprocessor removes _PyObject_ASSERT_FROM() calls if NDEBUG is defined
+#ifndef NDEBUG
+    const char *filename, int lineno,
+#endif
+    PyObject *op)
 {
     _PyObject_ASSERT_FROM(op, !_PyObject_GC_IS_TRACKED(op),
                           "object already tracked by the garbage collector",
-                          filename, lineno, "_PyObject_GC_TRACK");
+                          filename, lineno, __func__);
 
     PyGC_Head *gc = _Py_AS_GC(op);
     _PyObject_ASSERT_FROM(op,
                           (gc->_gc_prev & _PyGC_PREV_MASK_COLLECTING) == 0,
                           "object is in generation which is garbage collected",
-                          filename, lineno, "_PyObject_GC_TRACK");
+                          filename, lineno, __func__);
 
-    PyThreadState *tstate = _PyThreadState_GET();
-    PyGC_Head *generation0 = tstate->interp->gc.generation0;
+    PyInterpreterState *interp = _PyInterpreterState_GET();
+    PyGC_Head *generation0 = interp->gc.generation0;
     PyGC_Head *last = (PyGC_Head*)(generation0->_gc_prev);
     _PyGCHead_SET_NEXT(last, gc);
     _PyGCHead_SET_PREV(gc, last);
@@ -48,9 +96,6 @@
     generation0->_gc_prev = (uintptr_t)gc;
 }
 
-#define _PyObject_GC_TRACK(op) \
-    _PyObject_GC_TRACK_impl(__FILE__, __LINE__, _PyObject_CAST(op))
-
 /* Tell the GC to stop tracking this object.
  *
  * Internal note: This may be called while GC. So _PyGC_PREV_MASK_COLLECTING
@@ -58,14 +103,19 @@
  *
  * The object must be tracked by the GC.
  *
- * The PyObject_GC_UnTrack() function is the public version of this macro.
+ * See also the public PyObject_GC_UnTrack() which accept an object which is
+ * not tracked.
  */
-static inline void _PyObject_GC_UNTRACK_impl(const char *filename, int lineno,
-                                             PyObject *op)
+static inline void _PyObject_GC_UNTRACK(
+// The preprocessor removes _PyObject_ASSERT_FROM() calls if NDEBUG is defined
+#ifndef NDEBUG
+    const char *filename, int lineno,
+#endif
+    PyObject *op)
 {
     _PyObject_ASSERT_FROM(op, _PyObject_GC_IS_TRACKED(op),
                           "object not tracked by the garbage collector",
-                          filename, lineno, "_PyObject_GC_UNTRACK");
+                          filename, lineno, __func__);
 
     PyGC_Head *gc = _Py_AS_GC(op);
     PyGC_Head *prev = _PyGCHead_PREV(gc);
@@ -76,8 +126,20 @@
     gc->_gc_prev &= _PyGC_PREV_MASK_FINALIZED;
 }
 
-#define _PyObject_GC_UNTRACK(op) \
-    _PyObject_GC_UNTRACK_impl(__FILE__, __LINE__, _PyObject_CAST(op))
+// Macros to accept any type for the parameter, and to automatically pass
+// the filename and the filename (if NDEBUG is not defined) where the macro
+// is called.
+#ifdef NDEBUG
+#  define _PyObject_GC_TRACK(op) \
+        _PyObject_GC_TRACK(_PyObject_CAST(op))
+#  define _PyObject_GC_UNTRACK(op) \
+        _PyObject_GC_UNTRACK(_PyObject_CAST(op))
+#else
+#  define _PyObject_GC_TRACK(op) \
+        _PyObject_GC_TRACK(__FILE__, __LINE__, _PyObject_CAST(op))
+#  define _PyObject_GC_UNTRACK(op) \
+        _PyObject_GC_UNTRACK(__FILE__, __LINE__, _PyObject_CAST(op))
+#endif
 
 #ifdef Py_REF_DEBUG
 extern void _PyDebug_PrintTotalRefs(void);
@@ -96,12 +158,6 @@
     return (PyObject **)((char *)op + offset);
 }
 
-// Fast inlined version of PyType_HasFeature()
-static inline int
-_PyType_HasFeature(PyTypeObject *type, unsigned long feature) {
-    return ((type->tp_flags & feature) != 0);
-}
-
 // Fast inlined version of PyObject_IS_GC()
 static inline int
 _PyObject_IS_GC(PyObject *obj)
@@ -114,6 +170,16 @@
 // Fast inlined version of PyType_IS_GC()
 #define _PyType_IS_GC(t) _PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC)
 
+// Usage: assert(_Py_CheckSlotResult(obj, "__getitem__", result != NULL));
+extern int _Py_CheckSlotResult(
+    PyObject *obj,
+    const char *slot_name,
+    int success);
+
+// PyType_Ready() must be called if _PyType_IsReady() is false.
+// See also the Py_TPFLAGS_READY flag.
+#define _PyType_IsReady(type) ((type)->tp_dict != NULL)
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/Include/internal/pycore_parser.h b/Include/internal/pycore_parser.h
new file mode 100644
index 0000000..e2de24e
--- /dev/null
+++ b/Include/internal/pycore_parser.h
@@ -0,0 +1,31 @@
+#ifndef Py_INTERNAL_PARSER_H
+#define Py_INTERNAL_PARSER_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef Py_BUILD_CORE
+#  error "this header requires Py_BUILD_CORE define"
+#endif
+
+extern struct _mod* _PyParser_ASTFromString(
+    const char *str,
+    PyObject* filename,
+    int mode,
+    PyCompilerFlags *flags,
+    PyArena *arena);
+extern struct _mod* _PyParser_ASTFromFile(
+    FILE *fp,
+    PyObject *filename_ob,
+    const char *enc,
+    int mode,
+    const char *ps1,
+    const char *ps2,
+    PyCompilerFlags *flags,
+    int *errcode,
+    PyArena *arena);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !Py_INTERNAL_PARSER_H */
diff --git a/Include/internal/pycore_pathconfig.h b/Include/internal/pycore_pathconfig.h
index 42d61b1..15447f5 100644
--- a/Include/internal/pycore_pathconfig.h
+++ b/Include/internal/pycore_pathconfig.h
@@ -65,6 +65,7 @@
 
 extern PyStatus _PyConfig_WritePathConfig(const PyConfig *config);
 extern void _Py_DumpPathConfig(PyThreadState *tstate);
+extern PyObject* _PyPathConfig_AsDict(void);
 
 #ifdef __cplusplus
 }
diff --git a/Include/internal/pycore_pyarena.h b/Include/internal/pycore_pyarena.h
new file mode 100644
index 0000000..d78972a
--- /dev/null
+++ b/Include/internal/pycore_pyarena.h
@@ -0,0 +1,64 @@
+/* An arena-like memory interface for the compiler.
+ */
+
+#ifndef Py_INTERNAL_PYARENA_H
+#define Py_INTERNAL_PYARENA_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef Py_BUILD_CORE
+#  error "this header requires Py_BUILD_CORE define"
+#endif
+
+typedef struct _arena PyArena;
+
+/* _PyArena_New() and _PyArena_Free() create a new arena and free it,
+   respectively.  Once an arena has been created, it can be used
+   to allocate memory via _PyArena_Malloc().  Pointers to PyObject can
+   also be registered with the arena via _PyArena_AddPyObject(), and the
+   arena will ensure that the PyObjects stay alive at least until
+   _PyArena_Free() is called.  When an arena is freed, all the memory it
+   allocated is freed, the arena releases internal references to registered
+   PyObject*, and none of its pointers are valid.
+   XXX (tim) What does "none of its pointers are valid" mean?  Does it
+   XXX mean that pointers previously obtained via _PyArena_Malloc() are
+   XXX no longer valid?  (That's clearly true, but not sure that's what
+   XXX the text is trying to say.)
+
+   _PyArena_New() returns an arena pointer.  On error, it
+   returns a negative number and sets an exception.
+   XXX (tim):  Not true.  On error, _PyArena_New() actually returns NULL,
+   XXX and looks like it may or may not set an exception (e.g., if the
+   XXX internal PyList_New(0) returns NULL, _PyArena_New() passes that on
+   XXX and an exception is set; OTOH, if the internal
+   XXX block_new(DEFAULT_BLOCK_SIZE) returns NULL, that's passed on but
+   XXX an exception is not set in that case).
+*/
+PyAPI_FUNC(PyArena*) _PyArena_New(void);
+PyAPI_FUNC(void) _PyArena_Free(PyArena *);
+
+/* Mostly like malloc(), return the address of a block of memory spanning
+ * `size` bytes, or return NULL (without setting an exception) if enough
+ * new memory can't be obtained.  Unlike malloc(0), _PyArena_Malloc() with
+ * size=0 does not guarantee to return a unique pointer (the pointer
+ * returned may equal one or more other pointers obtained from
+ * _PyArena_Malloc()).
+ * Note that pointers obtained via _PyArena_Malloc() must never be passed to
+ * the system free() or realloc(), or to any of Python's similar memory-
+ * management functions.  _PyArena_Malloc()-obtained pointers remain valid
+ * until _PyArena_Free(ar) is called, at which point all pointers obtained
+ * from the arena `ar` become invalid simultaneously.
+ */
+PyAPI_FUNC(void*) _PyArena_Malloc(PyArena *, size_t size);
+
+/* This routine isn't a proper arena allocation routine.  It takes
+ * a PyObject* and records it so that it can be DECREFed when the
+ * arena is freed.
+ */
+PyAPI_FUNC(int) _PyArena_AddPyObject(PyArena *, PyObject *);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !Py_INTERNAL_PYARENA_H */
diff --git a/Include/internal/pycore_pyerrors.h b/Include/internal/pycore_pyerrors.h
index 2cf1160..a5e97fe 100644
--- a/Include/internal/pycore_pyerrors.h
+++ b/Include/internal/pycore_pyerrors.h
@@ -84,6 +84,12 @@
 
 PyAPI_FUNC(int) _PyErr_CheckSignalsTstate(PyThreadState *tstate);
 
+PyAPI_FUNC(void) _Py_DumpExtensionModules(int fd, PyInterpreterState *interp);
+
+extern PyObject* _Py_Offer_Suggestions(PyObject* exception);
+PyAPI_FUNC(Py_ssize_t) _Py_UTF8_Edit_Cost(PyObject *str_a, PyObject *str_b,
+                                          Py_ssize_t max_cost);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/Include/internal/pycore_pylifecycle.h b/Include/internal/pycore_pylifecycle.h
index 50ab645..524be9d 100644
--- a/Include/internal/pycore_pylifecycle.h
+++ b/Include/internal/pycore_pylifecycle.h
@@ -8,6 +8,24 @@
 #  error "this header requires Py_BUILD_CORE define"
 #endif
 
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif
+
+#include "pycore_runtime.h"       // _PyRuntimeState
+
+#ifndef NSIG
+# if defined(_NSIG)
+#  define NSIG _NSIG            /* For BSD/SysV */
+# elif defined(_SIGMAX)
+#  define NSIG (_SIGMAX + 1)    /* For QNX */
+# elif defined(SIGMAX)
+#  define NSIG (SIGMAX + 1)     /* For djgpp */
+# else
+#  define NSIG 64               /* Use a reasonable default value */
+# endif
+#endif
+
 /* Forward declarations */
 struct _PyArgv;
 struct pyruntimestate;
@@ -31,64 +49,71 @@
 
 /* Various one-time initializers */
 
-extern PyStatus _PyUnicode_Init(void);
+extern PyStatus _PyUnicode_Init(PyInterpreterState *interp);
+extern PyStatus _PyUnicode_InitTypes(void);
+extern PyStatus _PyBytes_Init(PyInterpreterState *interp);
 extern int _PyStructSequence_Init(void);
-extern int _PyLong_Init(PyThreadState *tstate);
+extern int _PyLong_Init(PyInterpreterState *interp);
+extern int _PyLong_InitTypes(void);
+extern PyStatus _PyTuple_Init(PyInterpreterState *interp);
 extern PyStatus _PyFaulthandler_Init(int enable);
 extern int _PyTraceMalloc_Init(int enable);
-extern PyObject * _PyBuiltin_Init(PyThreadState *tstate);
+extern PyObject * _PyBuiltin_Init(PyInterpreterState *interp);
 extern PyStatus _PySys_Create(
     PyThreadState *tstate,
     PyObject **sysmod_p);
 extern PyStatus _PySys_ReadPreinitWarnOptions(PyWideStringList *options);
 extern PyStatus _PySys_ReadPreinitXOptions(PyConfig *config);
-extern int _PySys_InitMain(PyThreadState *tstate);
-extern PyStatus _PyExc_Init(void);
-extern PyStatus _PyErr_Init(void);
+extern int _PySys_UpdateConfig(PyThreadState *tstate);
+extern PyStatus _PyExc_Init(PyInterpreterState *interp);
+extern PyStatus _PyErr_InitTypes(void);
 extern PyStatus _PyBuiltins_AddExceptions(PyObject * bltinmod);
-extern PyStatus _PyImportHooks_Init(PyThreadState *tstate);
-extern int _PyFloat_Init(void);
+extern void _PyFloat_Init(void);
+extern int _PyFloat_InitTypes(void);
 extern PyStatus _Py_HashRandomization_Init(const PyConfig *);
 
 extern PyStatus _PyTypes_Init(void);
 extern PyStatus _PyTypes_InitSlotDefs(void);
 extern PyStatus _PyImportZip_Init(PyThreadState *tstate);
-extern PyStatus _PyGC_Init(PyThreadState *tstate);
+extern PyStatus _PyGC_Init(PyInterpreterState *interp);
+extern PyStatus _PyAtExit_Init(PyInterpreterState *interp);
 
 
 /* Various internal finalizers */
 
-extern void _PyFrame_Fini(void);
-extern void _PyDict_Fini(void);
-extern void _PyTuple_Fini(void);
-extern void _PyList_Fini(void);
-extern void _PySet_Fini(void);
-extern void _PyBytes_Fini(void);
-extern void _PyFloat_Fini(void);
-extern void _PySlice_Fini(void);
-extern void _PyAsyncGen_Fini(void);
+extern void _PyFrame_Fini(PyInterpreterState *interp);
+extern void _PyDict_Fini(PyInterpreterState *interp);
+extern void _PyTuple_Fini(PyInterpreterState *interp);
+extern void _PyList_Fini(PyInterpreterState *interp);
+extern void _PyBytes_Fini(PyInterpreterState *interp);
+extern void _PyFloat_Fini(PyInterpreterState *interp);
+extern void _PySlice_Fini(PyInterpreterState *interp);
+extern void _PyAsyncGen_Fini(PyInterpreterState *interp);
 
 extern int _PySignal_Init(int install_signal_handlers);
-extern void PyOS_FiniInterrupts(void);
+extern void _PySignal_Fini(void);
 
-extern void _PyExc_Fini(void);
+extern void _PyExc_Fini(PyInterpreterState *interp);
 extern void _PyImport_Fini(void);
 extern void _PyImport_Fini2(void);
-extern void _PyGC_Fini(PyThreadState *tstate);
-extern void _PyType_Fini(void);
+extern void _PyGC_Fini(PyInterpreterState *interp);
+extern void _PyType_Fini(PyInterpreterState *interp);
 extern void _Py_HashRandomization_Fini(void);
-extern void _PyUnicode_Fini(PyThreadState *tstate);
-extern void _PyLong_Fini(PyThreadState *tstate);
+extern void _PyUnicode_Fini(PyInterpreterState *interp);
+extern void _PyUnicode_ClearInterned(PyInterpreterState *interp);
+extern void _PyLong_Fini(PyInterpreterState *interp);
 extern void _PyFaulthandler_Fini(void);
 extern void _PyHash_Fini(void);
 extern void _PyTraceMalloc_Fini(void);
 extern void _PyWarnings_Fini(PyInterpreterState *interp);
-extern void _PyAST_Fini(void);
+extern void _PyAST_Fini(PyInterpreterState *interp);
+extern void _PyAtExit_Fini(PyInterpreterState *interp);
 
-extern PyStatus _PyGILState_Init(PyThreadState *tstate);
-extern void _PyGILState_Fini(PyThreadState *tstate);
+extern PyStatus _PyGILState_Init(_PyRuntimeState *runtime);
+extern PyStatus _PyGILState_SetTstate(PyThreadState *tstate);
+extern void _PyGILState_Fini(PyInterpreterState *interp);
 
-PyAPI_FUNC(void) _PyGC_DumpShutdownStats(PyThreadState *tstate);
+PyAPI_FUNC(void) _PyGC_DumpShutdownStats(PyInterpreterState *interp);
 
 PyAPI_FUNC(PyStatus) _Py_PreInitializeFromPyArgv(
     const PyPreConfig *src_config,
@@ -108,6 +133,8 @@
 
 PyAPI_FUNC(void) _PyThreadState_DeleteCurrent(PyThreadState *tstate);
 
+extern void _PyAtExit_Call(PyInterpreterState *interp);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/Include/internal/pycore_pymem.h b/Include/internal/pycore_pymem.h
index 3d925e2..49af171 100644
--- a/Include/internal/pycore_pymem.h
+++ b/Include/internal/pycore_pymem.h
@@ -42,7 +42,7 @@
    fills newly allocated memory with CLEANBYTE (0xCD) and newly freed memory
    with DEADBYTE (0xDD). Detect also "untouchable bytes" marked
    with FORBIDDENBYTE (0xFD). */
-static inline int _PyMem_IsPtrFreed(void *ptr)
+static inline int _PyMem_IsPtrFreed(const void *ptr)
 {
     uintptr_t value = (uintptr_t)ptr;
 #if SIZEOF_VOID_P == 8
@@ -69,9 +69,6 @@
    PYMEM_ALLOCATOR_NOT_SET does nothing. */
 PyAPI_FUNC(int) _PyMem_SetupAllocators(PyMemAllocatorName allocator);
 
-/* bpo-35053: Expose _Py_tracemalloc_config for _Py_NewReference()
-   which access directly _Py_tracemalloc_config.tracing for best
-   performances. */
 struct _PyTraceMalloc_Config {
     /* Module initialized?
        Variable protected by the GIL */
diff --git a/Include/internal/pycore_pystate.h b/Include/internal/pycore_pystate.h
index 835d6e0..4b894f3 100644
--- a/Include/internal/pycore_pystate.h
+++ b/Include/internal/pycore_pystate.h
@@ -22,11 +22,11 @@
 
 
 static inline int
-_Py_IsMainInterpreter(PyThreadState* tstate)
+_Py_IsMainInterpreter(PyInterpreterState *interp)
 {
     /* Use directly _PyRuntime rather than tstate->interp->runtime, since
        this function is used in performance critical code path (ceval) */
-    return (tstate->interp == _PyRuntime.interpreters.main);
+    return (interp == _PyRuntime.interpreters.main);
 }
 
 
@@ -49,10 +49,18 @@
 /* Variable and macro for in-line access to current thread
    and interpreter state */
 
+#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+PyAPI_FUNC(PyThreadState*) _PyThreadState_GetTSS(void);
+#endif
+
 static inline PyThreadState*
 _PyRuntimeState_GetThreadState(_PyRuntimeState *runtime)
 {
+#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+    return _PyThreadState_GetTSS();
+#else
     return (PyThreadState*)_Py_atomic_load_relaxed(&runtime->gilstate.tstate_current);
+#endif
 }
 
 /* Get the current Python thread state.
@@ -67,7 +75,11 @@
 static inline PyThreadState*
 _PyThreadState_GET(void)
 {
+#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+    return _PyThreadState_GetTSS();
+#else
     return _PyRuntimeState_GetThreadState(&_PyRuntime);
+#endif
 }
 
 /* Redefine PyThreadState_GET() as an alias to _PyThreadState_GET() */
@@ -119,9 +131,12 @@
     PyThreadState *newts);
 
 PyAPI_FUNC(PyStatus) _PyInterpreterState_Enable(_PyRuntimeState *runtime);
-PyAPI_FUNC(void) _PyInterpreterState_DeleteExceptMain(_PyRuntimeState *runtime);
 
-PyAPI_FUNC(void) _PyGILState_Reinit(_PyRuntimeState *runtime);
+#ifdef HAVE_FORK
+extern PyStatus _PyInterpreterState_DeleteExceptMain(_PyRuntimeState *runtime);
+extern PyStatus _PyGILState_Reinit(_PyRuntimeState *runtime);
+extern void _PySignal_AfterFork(void);
+#endif
 
 
 PyAPI_FUNC(int) _PyState_AddModule(
diff --git a/Include/internal/pycore_runtime.h b/Include/internal/pycore_runtime.h
index 34eb492..bcd710c 100644
--- a/Include/internal/pycore_runtime.h
+++ b/Include/internal/pycore_runtime.h
@@ -19,7 +19,9 @@
        the main thread of the main interpreter can handle signals: see
        _Py_ThreadCanHandleSignals(). */
     _Py_atomic_int signals_pending;
+#ifndef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
     struct _gil_runtime_state gil;
+#endif
 };
 
 /* GIL state */
@@ -47,6 +49,13 @@
     void *userData;
 } _Py_AuditHookEntry;
 
+struct _Py_unicode_runtime_ids {
+    PyThread_type_lock lock;
+    // next_index value must be preserved when Py_Initialize()/Py_Finalize()
+    // is called multiple times: see _PyUnicode_FromId() implementation.
+    Py_ssize_t next_index;
+};
+
 /* Full Python runtime state */
 
 typedef struct pyruntimestate {
@@ -100,10 +109,14 @@
 
     PyPreConfig preconfig;
 
+    // Audit values must be preserved when Py_Initialize()/Py_Finalize()
+    // is called multiple times.
     Py_OpenCodeHookFunction open_code_hook;
     void *open_code_userdata;
     _Py_AuditHookEntry *audit_hook_head;
 
+    struct _Py_unicode_runtime_ids unicode_ids;
+
     // XXX Consolidate globals found via the check-c-globals script.
 } _PyRuntimeState;
 
@@ -118,7 +131,7 @@
 PyAPI_FUNC(void) _PyRuntimeState_Fini(_PyRuntimeState *runtime);
 
 #ifdef HAVE_FORK
-PyAPI_FUNC(void) _PyRuntimeState_ReInitThreads(_PyRuntimeState *runtime);
+extern PyStatus _PyRuntimeState_ReInitThreads(_PyRuntimeState *runtime);
 #endif
 
 /* Initialize _PyRuntimeState.
diff --git a/Include/internal/pycore_structseq.h b/Include/internal/pycore_structseq.h
new file mode 100644
index 0000000..84c8d47
--- /dev/null
+++ b/Include/internal/pycore_structseq.h
@@ -0,0 +1,21 @@
+#ifndef Py_INTERNAL_STRUCTSEQ_H
+#define Py_INTERNAL_STRUCTSEQ_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef Py_BUILD_CORE
+#  error "this header requires Py_BUILD_CORE define"
+#endif
+
+
+PyAPI_FUNC(int) _PyStructSequence_InitType(
+    PyTypeObject *type,
+    PyStructSequence_Desc *desc,
+    unsigned long tp_flags);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !Py_INTERNAL_STRUCTSEQ_H */
diff --git a/Include/symtable.h b/Include/internal/pycore_symtable.h
similarity index 80%
rename from Include/symtable.h
rename to Include/internal/pycore_symtable.h
index abd19a7..a2e520b 100644
--- a/Include/symtable.h
+++ b/Include/internal/pycore_symtable.h
@@ -1,19 +1,25 @@
-#ifndef Py_LIMITED_API
-#ifndef Py_SYMTABLE_H
-#define Py_SYMTABLE_H
+#ifndef Py_INTERNAL_SYMTABLE_H
+#define Py_INTERNAL_SYMTABLE_H
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#include "Python-ast.h"   /* mod_ty */
+#ifndef Py_BUILD_CORE
+#  error "this header requires Py_BUILD_CORE define"
+#endif
 
-/* XXX(ncoghlan): This is a weird mix of public names and interpreter internal
- *                names.
- */
+struct _mod;   // Type defined in pycore_ast.h
 
-typedef enum _block_type { FunctionBlock, ClassBlock, ModuleBlock }
+typedef enum _block_type { FunctionBlock, ClassBlock, ModuleBlock, AnnotationBlock }
     _Py_block_ty;
 
+typedef enum _comprehension_type {
+    NoComprehension = 0,
+    ListComprehension = 1,
+    DictComprehension = 2,
+    SetComprehension = 3,
+    GeneratorExpression = 4 } _Py_comprehension_ty;
+
 struct _symtable_entry;
 
 struct symtable {
@@ -43,14 +49,14 @@
     PyObject *ste_varnames;  /* list of function parameters */
     PyObject *ste_children;  /* list of child blocks */
     PyObject *ste_directives;/* locations of global and nonlocal statements */
-    _Py_block_ty ste_type;   /* module, class, or function */
+    _Py_block_ty ste_type;   /* module, class or function */
     int ste_nested;      /* true if block is nested */
     unsigned ste_free : 1;        /* true if block has free variables */
     unsigned ste_child_free : 1;  /* true if a child block has free vars,
                                      including free refs to globals */
     unsigned ste_generator : 1;   /* true if namespace is a generator */
     unsigned ste_coroutine : 1;   /* true if namespace is a coroutine */
-    unsigned ste_comprehension : 1; /* true if namespace is a list comprehension */
+    _Py_comprehension_ty ste_comprehension;  /* Kind of comprehension (if any) */
     unsigned ste_varargs : 1;     /* true if block has varargs */
     unsigned ste_varkeywords : 1; /* true if block has varkeywords */
     unsigned ste_returns_value : 1;  /* true if namespace uses return with
@@ -62,28 +68,26 @@
     int ste_comp_iter_expr; /* non-zero if visiting a comprehension range expression */
     int ste_lineno;          /* first line of block */
     int ste_col_offset;      /* offset of first line of block */
+    int ste_end_lineno;      /* end line of block */
+    int ste_end_col_offset;  /* end offset of first line of block */
     int ste_opt_lineno;      /* lineno of last exec or import * */
     int ste_opt_col_offset;  /* offset of last exec or import * */
     struct symtable *ste_table;
 } PySTEntryObject;
 
-PyAPI_DATA(PyTypeObject) PySTEntry_Type;
+extern PyTypeObject PySTEntry_Type;
 
 #define PySTEntry_Check(op) Py_IS_TYPE(op, &PySTEntry_Type)
 
-PyAPI_FUNC(int) PyST_GetScope(PySTEntryObject *, PyObject *);
+extern int _PyST_GetScope(PySTEntryObject *, PyObject *);
 
-PyAPI_FUNC(struct symtable *) PySymtable_Build(
-    mod_ty mod,
-    const char *filename,       /* decoded from the filesystem encoding */
-    PyFutureFeatures *future);
-PyAPI_FUNC(struct symtable *) PySymtable_BuildObject(
-    mod_ty mod,
+extern struct symtable* _PySymtable_Build(
+    struct _mod *mod,
     PyObject *filename,
     PyFutureFeatures *future);
 PyAPI_FUNC(PySTEntryObject *) PySymtable_Lookup(struct symtable *, void *);
 
-PyAPI_FUNC(void) PySymtable_Free(struct symtable *);
+extern void _PySymtable_Free(struct symtable *);
 
 /* Flags for def-use information */
 
@@ -116,8 +120,14 @@
 #define GENERATOR 1
 #define GENERATOR_EXPRESSION 2
 
+// Used by symtablemodule.c
+extern struct symtable* _Py_SymtableStringObjectFlags(
+    const char *str,
+    PyObject *filename,
+    int start,
+    PyCompilerFlags *flags);
+
 #ifdef __cplusplus
 }
 #endif
-#endif /* !Py_SYMTABLE_H */
-#endif /* !Py_LIMITED_API */
+#endif /* !Py_INTERNAL_SYMTABLE_H */
diff --git a/Include/internal/pycore_traceback.h b/Include/internal/pycore_traceback.h
index 1f09241..c01a476 100644
--- a/Include/internal/pycore_traceback.h
+++ b/Include/internal/pycore_traceback.h
@@ -51,7 +51,7 @@
    _PyGILState_GetInterpreterStateUnsafe() in last resort.
 
    It is better to pass NULL to interp and current_tstate, the function tries
-   different options to retrieve these informations.
+   different options to retrieve this information.
 
    This function is signal safe. */
 
@@ -74,17 +74,13 @@
    This function is signal safe. */
 PyAPI_FUNC(void) _Py_DumpDecimal(
     int fd,
-    unsigned long value);
+    size_t value);
 
-/* Format an integer as hexadecimal into the file descriptor fd with at least
-   width digits.
-
-   The maximum width is sizeof(unsigned long)*2 digits.
-
-   This function is signal safe. */
+/* Format an integer as hexadecimal with width digits into fd file descriptor.
+   The function is signal safe. */
 PyAPI_FUNC(void) _Py_DumpHexadecimal(
     int fd,
-    unsigned long value,
+    uintptr_t value,
     Py_ssize_t width);
 
 PyAPI_FUNC(PyObject*) _PyTraceBack_FromFrame(
diff --git a/Include/internal/pycore_tupleobject.h b/Include/internal/pycore_tuple.h
similarity index 74%
rename from Include/internal/pycore_tupleobject.h
rename to Include/internal/pycore_tuple.h
index f95f16c..5353e18 100644
--- a/Include/internal/pycore_tupleobject.h
+++ b/Include/internal/pycore_tuple.h
@@ -1,5 +1,5 @@
-#ifndef Py_INTERNAL_TUPLEOBJECT_H
-#define Py_INTERNAL_TUPLEOBJECT_H
+#ifndef Py_INTERNAL_TUPLE_H
+#define Py_INTERNAL_TUPLE_H
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -11,9 +11,10 @@
 #include "tupleobject.h"   /* _PyTuple_CAST() */
 
 #define _PyTuple_ITEMS(op) (_PyTuple_CAST(op)->ob_item)
+
 PyAPI_FUNC(PyObject *) _PyTuple_FromArray(PyObject *const *, Py_ssize_t);
 
 #ifdef __cplusplus
 }
 #endif
-#endif   /* !Py_INTERNAL_TUPLEOBJECT_H */
+#endif   /* !Py_INTERNAL_TUPLE_H */
diff --git a/Include/internal/pycore_ucnhash.h b/Include/internal/pycore_ucnhash.h
new file mode 100644
index 0000000..187dd68
--- /dev/null
+++ b/Include/internal/pycore_ucnhash.h
@@ -0,0 +1,34 @@
+/* Unicode name database interface */
+#ifndef Py_INTERNAL_UCNHASH_H
+#define Py_INTERNAL_UCNHASH_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef Py_BUILD_CORE
+#  error "this header requires Py_BUILD_CORE define"
+#endif
+
+/* revised ucnhash CAPI interface (exported through a "wrapper") */
+
+#define PyUnicodeData_CAPSULE_NAME "unicodedata._ucnhash_CAPI"
+
+typedef struct {
+
+    /* Get name for a given character code.
+       Returns non-zero if success, zero if not.
+       Does not set Python exceptions. */
+    int (*getname)(Py_UCS4 code, char* buffer, int buflen,
+                   int with_alias_and_seq);
+
+    /* Get character code for a given name.
+       Same error handling as for getname(). */
+    int (*getcode)(const char* name, int namelen, Py_UCS4* code,
+                   int with_named_seq);
+
+} _PyUnicode_Name_CAPI;
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !Py_INTERNAL_UCNHASH_H */
diff --git a/Include/internal/pycore_unionobject.h b/Include/internal/pycore_unionobject.h
new file mode 100644
index 0000000..9962f57
--- /dev/null
+++ b/Include/internal/pycore_unionobject.h
@@ -0,0 +1,22 @@
+#ifndef Py_INTERNAL_UNIONOBJECT_H
+#define Py_INTERNAL_UNIONOBJECT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef Py_BUILD_CORE
+#  error "this header requires Py_BUILD_CORE define"
+#endif
+
+extern PyTypeObject _PyUnion_Type;
+#define _PyUnion_Check(op) Py_IS_TYPE(op, &_PyUnion_Type)
+extern PyObject *_Py_union_type_or(PyObject *, PyObject *);
+
+#define _PyGenericAlias_Check(op) PyObject_TypeCheck(op, &Py_GenericAliasType)
+extern PyObject *_Py_subs_parameters(PyObject *, PyObject *, PyObject *, PyObject *);
+extern PyObject *_Py_make_parameters(PyObject *);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !Py_INTERNAL_UNIONOBJECT_H */
diff --git a/Include/internal/pycore_warnings.h b/Include/internal/pycore_warnings.h
index cafe305..f728ec3 100644
--- a/Include/internal/pycore_warnings.h
+++ b/Include/internal/pycore_warnings.h
@@ -17,7 +17,7 @@
     long filters_version;
 };
 
-extern PyStatus _PyWarnings_InitState(PyThreadState *tstate);
+extern int _PyWarnings_InitState(PyInterpreterState *interp);
 
 #ifdef __cplusplus
 }
diff --git a/Include/intrcheck.h b/Include/intrcheck.h
index e5bf5a8..b8cc656 100644
--- a/Include/intrcheck.h
+++ b/Include/intrcheck.h
@@ -1,4 +1,3 @@
-
 #ifndef Py_INTRCHECK_H
 #define Py_INTRCHECK_H
 #ifdef __cplusplus
@@ -6,7 +5,6 @@
 #endif
 
 PyAPI_FUNC(int) PyOS_InterruptOccurred(void);
-PyAPI_FUNC(void) PyOS_InitInterrupts(void);
 #ifdef HAVE_FORK
 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000
 PyAPI_FUNC(void) PyOS_BeforeFork(void);
@@ -19,7 +17,6 @@
 
 #ifndef Py_LIMITED_API
 PyAPI_FUNC(int) _PyOS_IsMainThread(void);
-PyAPI_FUNC(void) _PySignal_AfterFork(void);
 
 #ifdef MS_WINDOWS
 /* windows.h is not included by Python.h so use void* instead of HANDLE */
diff --git a/Include/iterobject.h b/Include/iterobject.h
index 51139bf..6454611 100644
--- a/Include/iterobject.h
+++ b/Include/iterobject.h
@@ -7,6 +7,9 @@
 
 PyAPI_DATA(PyTypeObject) PySeqIter_Type;
 PyAPI_DATA(PyTypeObject) PyCallIter_Type;
+#ifdef Py_BUILD_CORE
+extern PyTypeObject _PyAnextAwaitable_Type;
+#endif
 
 #define PySeqIter_Check(op) Py_IS_TYPE(op, &PySeqIter_Type)
 
diff --git a/Include/longobject.h b/Include/longobject.h
index 1b28809..e2301d7 100644
--- a/Include/longobject.h
+++ b/Include/longobject.h
@@ -102,8 +102,6 @@
 
 PyAPI_FUNC(PyObject *) PyLong_FromString(const char *, char **, int);
 #ifndef Py_LIMITED_API
-Py_DEPRECATED(3.3)
-PyAPI_FUNC(PyObject *) PyLong_FromUnicode(Py_UNICODE*, Py_ssize_t, int);
 PyAPI_FUNC(PyObject *) PyLong_FromUnicodeObject(PyObject *u, int base);
 PyAPI_FUNC(PyObject *) _PyLong_FromBytes(const char *, Py_ssize_t, int);
 #endif
@@ -173,23 +171,6 @@
     unsigned char* bytes, size_t n,
     int little_endian, int is_signed);
 
-/* _PyLong_FromNbInt: Convert the given object to a PyLongObject
-   using the nb_int slot, if available.  Raise TypeError if either the
-   nb_int slot is not available or the result of the call to nb_int
-   returns something not of type int.
-*/
-PyAPI_FUNC(PyObject *) _PyLong_FromNbInt(PyObject *);
-
-/* Convert the given object to a PyLongObject using the nb_index or
-   nb_int slots, if available (the latter is deprecated).
-   Raise TypeError if either nb_index and nb_int slots are not
-   available or the result of the call to nb_index or nb_int
-   returns something not of type int.
-   Should be replaced with PyNumber_Index after the end of the
-   deprecation period.
-*/
-PyAPI_FUNC(PyObject *) _PyLong_FromNbIndexOrNbInt(PyObject *);
-
 /* _PyLong_Format: Convert the long to a string object with given base,
    appending a base prefix of 0[box] if base is 2, 8 or 16. */
 PyAPI_FUNC(PyObject *) _PyLong_Format(PyObject *obj, int base);
@@ -229,9 +210,6 @@
 #endif /* !Py_LIMITED_API */
 
 #ifndef Py_LIMITED_API
-PyAPI_DATA(PyObject *) _PyLong_Zero;
-PyAPI_DATA(PyObject *) _PyLong_One;
-
 PyAPI_FUNC(PyObject *) _PyLong_Rshift(PyObject *, size_t);
 PyAPI_FUNC(PyObject *) _PyLong_Lshift(PyObject *, size_t);
 #endif
diff --git a/Include/methodobject.h b/Include/methodobject.h
index 12e049b..9ffe8e1 100644
--- a/Include/methodobject.h
+++ b/Include/methodobject.h
@@ -41,7 +41,13 @@
 };
 typedef struct PyMethodDef PyMethodDef;
 
+/* PyCFunction_New is declared as a function for stable ABI (declaration is
+ * needed for e.g. GCC with -fvisibility=hidden), but redefined as a macro
+ * that calls PyCFunction_NewEx. */
+PyAPI_FUNC(PyObject *) PyCFunction_New(PyMethodDef *, PyObject *);
 #define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL)
+
+/* PyCFunction_NewEx is similar: on 3.9+, this calls PyCMethod_New. */
 PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,
                                          PyObject *);
 
@@ -73,15 +79,15 @@
 
 #define METH_COEXIST   0x0040
 
-#ifndef Py_LIMITED_API
-#define METH_FASTCALL  0x0080
+#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030a0000
+#  define METH_FASTCALL  0x0080
 #endif
 
 /* This bit is preserved for Stackless Python */
 #ifdef STACKLESS
-#define METH_STACKLESS 0x0100
+#  define METH_STACKLESS 0x0100
 #else
-#define METH_STACKLESS 0x0000
+#  define METH_STACKLESS 0x0000
 #endif
 
 /* METH_METHOD means the function stores an
diff --git a/Include/modsupport.h b/Include/modsupport.h
index 4c4aab6..f009d58 100644
--- a/Include/modsupport.h
+++ b/Include/modsupport.h
@@ -136,7 +136,15 @@
 void _PyArg_Fini(void);
 #endif   /* Py_LIMITED_API */
 
-PyAPI_FUNC(int) PyModule_AddObject(PyObject *, const char *, PyObject *);
+// Add an attribute with name 'name' and value 'obj' to the module 'mod.
+// On success, return 0 on success.
+// On error, raise an exception and return -1.
+PyAPI_FUNC(int) PyModule_AddObjectRef(PyObject *mod, const char *name, PyObject *value);
+
+// Similar to PyModule_AddObjectRef() but steal a reference to 'obj'
+// (Py_DECREF(obj)) on success (if it returns 0).
+PyAPI_FUNC(int) PyModule_AddObject(PyObject *mod, const char *, PyObject *value);
+
 PyAPI_FUNC(int) PyModule_AddIntConstant(PyObject *, const char *, long);
 PyAPI_FUNC(int) PyModule_AddStringConstant(PyObject *, const char *, const char *);
 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03090000
diff --git a/Include/moduleobject.h b/Include/moduleobject.h
index cf9ad40..49b116c 100644
--- a/Include/moduleobject.h
+++ b/Include/moduleobject.h
@@ -84,6 +84,12 @@
   freefunc m_free;
 } PyModuleDef;
 
+
+// Internal C API
+#ifdef Py_BUILD_CORE
+extern int _PyModule_IsExtension(PyObject *obj);
+#endif
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/Include/node.h b/Include/node.h
deleted file mode 100644
index ca24f28..0000000
--- a/Include/node.h
+++ /dev/null
@@ -1,47 +0,0 @@
-
-/* Parse tree node interface */
-
-#ifndef Py_NODE_H
-#define Py_NODE_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct _node {
-    short               n_type;
-    char                *n_str;
-    int                 n_lineno;
-    int                 n_col_offset;
-    int                 n_nchildren;
-    struct _node        *n_child;
-    int                 n_end_lineno;
-    int                 n_end_col_offset;
-} node;
-
-PyAPI_FUNC(node *) PyNode_New(int type);
-PyAPI_FUNC(int) PyNode_AddChild(node *n, int type,
-                                char *str, int lineno, int col_offset,
-                                int end_lineno, int end_col_offset);
-PyAPI_FUNC(void) PyNode_Free(node *n);
-#ifndef Py_LIMITED_API
-PyAPI_FUNC(Py_ssize_t) _PyNode_SizeOf(node *n);
-#endif
-
-/* Node access functions */
-#define NCH(n)          ((n)->n_nchildren)
-
-#define CHILD(n, i)     (&(n)->n_child[i])
-#define TYPE(n)         ((n)->n_type)
-#define STR(n)          ((n)->n_str)
-#define LINENO(n)       ((n)->n_lineno)
-
-/* Assert that the type of a node is what we expect */
-#define REQ(n, type) assert(TYPE(n) == (type))
-
-PyAPI_FUNC(void) PyNode_ListTree(node *);
-void _PyNode_FinalizeEndPos(node *n);  // helper also used in parsetok.c
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* !Py_NODE_H */
diff --git a/Include/object.h b/Include/object.h
index 9c1a7f4..61e638c 100644
--- a/Include/object.h
+++ b/Include/object.h
@@ -54,11 +54,11 @@
 
 /* Py_DEBUG implies Py_REF_DEBUG. */
 #if defined(Py_DEBUG) && !defined(Py_REF_DEBUG)
-#define Py_REF_DEBUG
+#  define Py_REF_DEBUG
 #endif
 
-#if defined(Py_LIMITED_API) && defined(Py_REF_DEBUG)
-#error Py_LIMITED_API is incompatible with Py_DEBUG, Py_TRACE_REFS, and Py_REF_DEBUG
+#if defined(Py_LIMITED_API) && defined(Py_TRACE_REFS)
+#  error Py_LIMITED_API is incompatible with Py_TRACE_REFS
 #endif
 
 /* PyTypeObject structure is defined in cpython/object.h.
@@ -74,8 +74,8 @@
 #define _PyObject_EXTRA_INIT 0, 0,
 
 #else
-#define _PyObject_HEAD_EXTRA
-#define _PyObject_EXTRA_INIT
+#  define _PyObject_HEAD_EXTRA
+#  define _PyObject_EXTRA_INIT
 #endif
 
 /* PyObject_HEAD defines the initial segment of every PyObject. */
@@ -119,26 +119,47 @@
 
 /* Cast argument to PyVarObject* type. */
 #define _PyVarObject_CAST(op) ((PyVarObject*)(op))
+#define _PyVarObject_CAST_CONST(op) ((const PyVarObject*)(op))
 
-#define Py_REFCNT(ob)           (_PyObject_CAST(ob)->ob_refcnt)
+
+// Test if the 'x' object is the 'y' object, the same as "x is y" in Python.
+PyAPI_FUNC(int) Py_Is(PyObject *x, PyObject *y);
+#define Py_Is(x, y) ((x) == (y))
+
+
+static inline Py_ssize_t _Py_REFCNT(const PyObject *ob) {
+    return ob->ob_refcnt;
+}
+#define Py_REFCNT(ob) _Py_REFCNT(_PyObject_CAST_CONST(ob))
+
+
+// bpo-39573: The Py_SET_TYPE() function must be used to set an object type.
 #define Py_TYPE(ob)             (_PyObject_CAST(ob)->ob_type)
+
+// bpo-39573: The Py_SET_SIZE() function must be used to set an object size.
 #define Py_SIZE(ob)             (_PyVarObject_CAST(ob)->ob_size)
 
+
 static inline int _Py_IS_TYPE(const PyObject *ob, const PyTypeObject *type) {
+    // bpo-44378: Don't use Py_TYPE() since Py_TYPE() requires a non-const
+    // object.
     return ob->ob_type == type;
 }
 #define Py_IS_TYPE(ob, type) _Py_IS_TYPE(_PyObject_CAST_CONST(ob), type)
 
+
 static inline void _Py_SET_REFCNT(PyObject *ob, Py_ssize_t refcnt) {
     ob->ob_refcnt = refcnt;
 }
 #define Py_SET_REFCNT(ob, refcnt) _Py_SET_REFCNT(_PyObject_CAST(ob), refcnt)
 
+
 static inline void _Py_SET_TYPE(PyObject *ob, PyTypeObject *type) {
     ob->ob_type = type;
 }
 #define Py_SET_TYPE(ob, type) _Py_SET_TYPE(_PyObject_CAST(ob), type)
 
+
 static inline void _Py_SET_SIZE(PyVarObject *ob, Py_ssize_t size) {
     ob->ob_size = size;
 }
@@ -221,8 +242,11 @@
 
 /* Generic type check */
 PyAPI_FUNC(int) PyType_IsSubtype(PyTypeObject *, PyTypeObject *);
-#define PyObject_TypeCheck(ob, tp) \
-    (Py_IS_TYPE(ob, tp) || PyType_IsSubtype(Py_TYPE(ob), (tp)))
+
+static inline int _PyObject_TypeCheck(PyObject *ob, PyTypeObject *type) {
+    return Py_IS_TYPE(ob, type) || PyType_IsSubtype(Py_TYPE(ob), type);
+}
+#define PyObject_TypeCheck(ob, type) _PyObject_TypeCheck(_PyObject_CAST(ob), type)
 
 PyAPI_DATA(PyTypeObject) PyType_Type; /* built-in 'type' */
 PyAPI_DATA(PyTypeObject) PyBaseObject_Type; /* built-in 'object' */
@@ -298,6 +322,20 @@
 given type object has a specified feature.
 */
 
+#ifndef Py_LIMITED_API
+/* Set if instances of the type object are treated as sequences for pattern matching */
+#define Py_TPFLAGS_SEQUENCE (1 << 5)
+/* Set if instances of the type object are treated as mappings for pattern matching */
+#define Py_TPFLAGS_MAPPING (1 << 6)
+#endif
+
+/* Disallow creating instances of the type: set tp_new to NULL and don't create
+ * the "__new__" key in the type dictionary. */
+#define Py_TPFLAGS_DISALLOW_INSTANTIATION (1UL << 7)
+
+/* Set if the type object is immutable: type attributes cannot be set nor deleted */
+#define Py_TPFLAGS_IMMUTABLETYPE (1UL << 8)
+
 /* Set if the type object is dynamically allocated */
 #define Py_TPFLAGS_HEAPTYPE (1UL << 9)
 
@@ -330,13 +368,17 @@
 /* Objects behave like an unbound method */
 #define Py_TPFLAGS_METHOD_DESCRIPTOR (1UL << 17)
 
-/* Objects support type attribute cache */
-#define Py_TPFLAGS_HAVE_VERSION_TAG   (1UL << 18)
+/* Object has up-to-date type attribute cache */
 #define Py_TPFLAGS_VALID_VERSION_TAG  (1UL << 19)
 
 /* Type is abstract and cannot be instantiated */
 #define Py_TPFLAGS_IS_ABSTRACT (1UL << 20)
 
+// This undocumented flag gives certain built-ins their unique pattern-matching
+// behavior, which allows a single positional subpattern to match against the
+// subject itself (rather than a mapped attribute on it):
+#define _Py_TPFLAGS_MATCH_SELF (1UL << 22)
+
 /* These flags are used to determine if a type is a subclass. */
 #define Py_TPFLAGS_LONG_SUBCLASS        (1UL << 24)
 #define Py_TPFLAGS_LIST_SUBCLASS        (1UL << 25)
@@ -349,19 +391,23 @@
 
 #define Py_TPFLAGS_DEFAULT  ( \
                  Py_TPFLAGS_HAVE_STACKLESS_EXTENSION | \
-                 Py_TPFLAGS_HAVE_VERSION_TAG | \
                 0)
 
-/* NOTE: The following flags reuse lower bits (removed as part of the
+/* NOTE: Some of the following flags reuse lower bits (removed as part of the
  * Python 3.0 transition). */
 
-/* The following flag is kept for compatibility. Starting with 3.8,
- * binary compatibility of C extensions across feature releases of
- * Python is not supported anymore, except when using the stable ABI.
+/* The following flags are kept for compatibility; in previous
+ * versions they indicated presence of newer tp_* fields on the
+ * type struct.
+ * Starting with 3.8, binary compatibility of C extensions across
+ * feature releases of Python is not supported anymore (except when
+ * using the stable ABI, in which all classes are created dynamically,
+ * using the interpreter's memory layout.)
+ * Note that older extensions using the stable ABI set these flags,
+ * so the bits must not be repurposed.
  */
-
-/* Type structure has tp_finalize member (3.4) */
 #define Py_TPFLAGS_HAVE_FINALIZE (1UL << 0)
+#define Py_TPFLAGS_HAVE_VERSION_TAG   (1UL << 18)
 
 
 /*
@@ -400,22 +446,46 @@
 
 PyAPI_FUNC(void) _Py_Dealloc(PyObject *);
 
+/*
+These are provided as conveniences to Python runtime embedders, so that
+they can have object code that is not dependent on Python compilation flags.
+*/
+PyAPI_FUNC(void) Py_IncRef(PyObject *);
+PyAPI_FUNC(void) Py_DecRef(PyObject *);
+
+// Similar to Py_IncRef() and Py_DecRef() but the argument must be non-NULL.
+// Private functions used by Py_INCREF() and Py_DECREF().
+PyAPI_FUNC(void) _Py_IncRef(PyObject *);
+PyAPI_FUNC(void) _Py_DecRef(PyObject *);
+
 static inline void _Py_INCREF(PyObject *op)
 {
+#if defined(Py_REF_DEBUG) && defined(Py_LIMITED_API) && Py_LIMITED_API+0 >= 0x030A0000
+    // Stable ABI for Python 3.10 built in debug mode.
+    _Py_IncRef(op);
+#else
+    // Non-limited C API and limited C API for Python 3.9 and older access
+    // directly PyObject.ob_refcnt.
 #ifdef Py_REF_DEBUG
     _Py_RefTotal++;
 #endif
     op->ob_refcnt++;
+#endif
 }
-
 #define Py_INCREF(op) _Py_INCREF(_PyObject_CAST(op))
 
 static inline void _Py_DECREF(
-#ifdef Py_REF_DEBUG
+#if defined(Py_REF_DEBUG) && !(defined(Py_LIMITED_API) && Py_LIMITED_API+0 >= 0x030A0000)
     const char *filename, int lineno,
 #endif
     PyObject *op)
 {
+#if defined(Py_REF_DEBUG) && defined(Py_LIMITED_API) && Py_LIMITED_API+0 >= 0x030A0000
+    // Stable ABI for Python 3.10 built in debug mode.
+    _Py_DecRef(op);
+#else
+    // Non-limited C API and limited C API for Python 3.9 and older access
+    // directly PyObject.ob_refcnt.
 #ifdef Py_REF_DEBUG
     _Py_RefTotal--;
 #endif
@@ -429,9 +499,9 @@
     else {
         _Py_Dealloc(op);
     }
+#endif
 }
-
-#ifdef Py_REF_DEBUG
+#if defined(Py_REF_DEBUG) && !(defined(Py_LIMITED_API) && Py_LIMITED_API+0 >= 0x030A0000)
 #  define Py_DECREF(op) _Py_DECREF(__FILE__, __LINE__, _PyObject_CAST(op))
 #else
 #  define Py_DECREF(op) _Py_DECREF(_PyObject_CAST(op))
@@ -500,12 +570,31 @@
 
 #define Py_XDECREF(op) _Py_XDECREF(_PyObject_CAST(op))
 
-/*
-These are provided as conveniences to Python runtime embedders, so that
-they can have object code that is not dependent on Python compilation flags.
-*/
-PyAPI_FUNC(void) Py_IncRef(PyObject *);
-PyAPI_FUNC(void) Py_DecRef(PyObject *);
+// Create a new strong reference to an object:
+// increment the reference count of the object and return the object.
+PyAPI_FUNC(PyObject*) Py_NewRef(PyObject *obj);
+
+// Similar to Py_NewRef(), but the object can be NULL.
+PyAPI_FUNC(PyObject*) Py_XNewRef(PyObject *obj);
+
+static inline PyObject* _Py_NewRef(PyObject *obj)
+{
+    Py_INCREF(obj);
+    return obj;
+}
+
+static inline PyObject* _Py_XNewRef(PyObject *obj)
+{
+    Py_XINCREF(obj);
+    return obj;
+}
+
+// Py_NewRef() and Py_XNewRef() are exported as functions for the stable ABI.
+// Names overridden with macros by static inline functions for best
+// performances.
+#define Py_NewRef(obj) _Py_NewRef(_PyObject_CAST(obj))
+#define Py_XNewRef(obj) _Py_XNewRef(_PyObject_CAST(obj))
+
 
 /*
 _Py_NoneStruct is an object of undefined type which can be used in contexts
@@ -516,8 +605,12 @@
 PyAPI_DATA(PyObject) _Py_NoneStruct; /* Don't use this directly */
 #define Py_None (&_Py_NoneStruct)
 
+// Test if an object is the None singleton, the same as "x is None" in Python.
+PyAPI_FUNC(int) Py_IsNone(PyObject *x);
+#define Py_IsNone(x) Py_Is((x), Py_None)
+
 /* Macro for returning Py_None from a function */
-#define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
+#define Py_RETURN_NONE return Py_NewRef(Py_None)
 
 /*
 Py_NotImplemented is a singleton used to signal that an operation is
@@ -527,8 +620,7 @@
 #define Py_NotImplemented (&_Py_NotImplementedStruct)
 
 /* Macro for returning Py_NotImplemented from a function */
-#define Py_RETURN_NOTIMPLEMENTED \
-    return Py_INCREF(Py_NotImplemented), Py_NotImplemented
+#define Py_RETURN_NOTIMPLEMENTED return Py_NewRef(Py_NotImplemented)
 
 /* Rich comparison opcodes */
 #define Py_LT 0
@@ -538,6 +630,15 @@
 #define Py_GT 4
 #define Py_GE 5
 
+#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030A0000
+/* Result of calling PyIter_Send */
+typedef enum {
+    PYGEN_RETURN = 0,
+    PYGEN_ERROR = -1,
+    PYGEN_NEXT = 1,
+} PySendResult;
+#endif
+
 /*
  * Macro for implementing rich comparisons
  *
diff --git a/Include/objimpl.h b/Include/objimpl.h
index 030d7ee..450befa 100644
--- a/Include/objimpl.h
+++ b/Include/objimpl.h
@@ -38,7 +38,7 @@
    object with room for n items.  In addition to the refcount and type pointer
    fields, this also fills in the ob_size field.
 
- - PyObject_Del(op) releases the memory allocated for an object.  It does not
+ - PyObject_Free(op) releases the memory allocated for an object.  It does not
    run a destructor -- it only frees the memory.  PyObject_Free is identical.
 
  - PyObject_Init(op, typeobj) and PyObject_InitVar(op, typeobj, n) don't
@@ -48,8 +48,8 @@
 
 Note that objects created with PyObject_{New, NewVar} are allocated using the
 specialized Python allocator (implemented in obmalloc.c), if WITH_PYMALLOC is
-enabled.  In addition, a special debugging allocator is used if PYMALLOC_DEBUG
-is also #defined.
+enabled.  In addition, a special debugging allocator is used if Py_DEBUG
+macro is also defined.
 
 In case a specific form of memory management is needed (for example, if you
 must use the platform malloc heap(s), or shared memory, or C++ local storage or
@@ -102,7 +102,9 @@
 PyAPI_FUNC(void) PyObject_Free(void *ptr);
 
 
-/* Macros */
+// Deprecated aliases only kept for backward compatibility.
+// PyObject_Del and PyObject_DEL are defined with no parameter to be able to
+// use them as function pointers (ex: tp_free = PyObject_Del).
 #define PyObject_MALLOC         PyObject_Malloc
 #define PyObject_REALLOC        PyObject_Realloc
 #define PyObject_FREE           PyObject_Free
@@ -118,7 +120,14 @@
 /* Functions */
 PyAPI_FUNC(PyObject *) PyObject_Init(PyObject *, PyTypeObject *);
 PyAPI_FUNC(PyVarObject *) PyObject_InitVar(PyVarObject *,
-                                                 PyTypeObject *, Py_ssize_t);
+                                           PyTypeObject *, Py_ssize_t);
+
+#define PyObject_INIT(op, typeobj) \
+    PyObject_Init(_PyObject_CAST(op), (typeobj))
+#define PyObject_INIT_VAR(op, typeobj, size) \
+    PyObject_InitVar(_PyVarObject_CAST(op), (typeobj), (size))
+
+
 PyAPI_FUNC(PyObject *) _PyObject_New(PyTypeObject *);
 PyAPI_FUNC(PyVarObject *) _PyObject_NewVar(PyTypeObject *, Py_ssize_t);
 
@@ -131,31 +140,22 @@
 #define PyObject_NewVar(type, typeobj, n) \
                 ( (type *) _PyObject_NewVar((typeobj), (n)) )
 
-// Alias to PyObject_New(). In Python 3.8, PyObject_NEW() called directly
-// PyObject_MALLOC() with _PyObject_VAR_SIZE().
+// Alias to PyObject_NewVar(). In Python 3.8, PyObject_NEW_VAR() called
+// directly PyObject_MALLOC() with _PyObject_VAR_SIZE().
 #define PyObject_NEW_VAR(type, typeobj, n) PyObject_NewVar(type, typeobj, n)
 
 
-#ifdef Py_LIMITED_API
-/* Define PyObject_INIT() and PyObject_INIT_VAR() as aliases to PyObject_Init()
-   and PyObject_InitVar() in the limited C API for compatibility with the
-   CPython C API. */
-#  define PyObject_INIT(op, typeobj) \
-        PyObject_Init(_PyObject_CAST(op), (typeobj))
-#  define PyObject_INIT_VAR(op, typeobj, size) \
-        PyObject_InitVar(_PyVarObject_CAST(op), (typeobj), (size))
-#else
-/* PyObject_INIT() and PyObject_INIT_VAR() are defined in cpython/objimpl.h */
-#endif
-
-
 /*
  * Garbage Collection Support
  * ==========================
  */
 
-/* C equivalent of gc.collect() which ignores the state of gc.enabled. */
+/* C equivalent of gc.collect(). */
 PyAPI_FUNC(Py_ssize_t) PyGC_Collect(void);
+/* C API for controlling the state of the garbage collector */
+PyAPI_FUNC(int) PyGC_Enable(void);
+PyAPI_FUNC(int) PyGC_Disable(void);
+PyAPI_FUNC(int) PyGC_IsEnabled(void);
 
 /* Test if a type has a GC head */
 #define PyType_IS_GC(t) PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC)
diff --git a/Include/opcode.h b/Include/opcode.h
index 19944fa..5203975 100644
--- a/Include/opcode.h
+++ b/Include/opcode.h
@@ -30,7 +30,11 @@
 #define BINARY_TRUE_DIVIDE       27
 #define INPLACE_FLOOR_DIVIDE     28
 #define INPLACE_TRUE_DIVIDE      29
-#define RERAISE                  48
+#define GET_LEN                  30
+#define MATCH_MAPPING            31
+#define MATCH_SEQUENCE           32
+#define MATCH_KEYS               33
+#define COPY_DICT_WITHOUT_KEYS   34
 #define WITH_EXCEPT_START        49
 #define GET_AITER                50
 #define GET_ANEXT                51
@@ -77,6 +81,7 @@
 #define DELETE_ATTR              96
 #define STORE_GLOBAL             97
 #define DELETE_GLOBAL            98
+#define ROT_N                    99
 #define LOAD_CONST              100
 #define LOAD_NAME               101
 #define BUILD_TUPLE             102
@@ -96,11 +101,13 @@
 #define LOAD_GLOBAL             116
 #define IS_OP                   117
 #define CONTAINS_OP             118
+#define RERAISE                 119
 #define JUMP_IF_NOT_EXC_MATCH   121
 #define SETUP_FINALLY           122
 #define LOAD_FAST               124
 #define STORE_FAST              125
 #define DELETE_FAST             126
+#define GEN_START               129
 #define RAISE_VARARGS           130
 #define CALL_FUNCTION           131
 #define MAKE_FUNCTION           132
@@ -117,6 +124,7 @@
 #define SET_ADD                 146
 #define MAP_ADD                 147
 #define LOAD_CLASSDEREF         148
+#define MATCH_CLASS             152
 #define SETUP_ASYNC_WITH        154
 #define FORMAT_VALUE            155
 #define BUILD_CONST_KEY_MAP     156
@@ -127,6 +135,28 @@
 #define SET_UPDATE              163
 #define DICT_MERGE              164
 #define DICT_UPDATE             165
+#ifdef NEED_OPCODE_JUMP_TABLES
+static uint32_t _PyOpcode_RelativeJump[8] = {
+    0U,
+    0U,
+    536870912U,
+    67125248U,
+    67141632U,
+    0U,
+    0U,
+    0U,
+};
+static uint32_t _PyOpcode_Jump[8] = {
+    0U,
+    0U,
+    536870912U,
+    101695488U,
+    67141632U,
+    0U,
+    0U,
+    0U,
+};
+#endif /* OPCODE_TABLES */
 
 /* EXCEPT_HANDLER is a special, implicit block type which is created when
    entering an except handler. It is not an opcode but we define it here
diff --git a/Include/parsetok.h b/Include/parsetok.h
deleted file mode 100644
index 935d733..0000000
--- a/Include/parsetok.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/* Parser-tokenizer link interface */
-
-#ifndef Py_LIMITED_API
-#ifndef Py_PARSETOK_H
-#define Py_PARSETOK_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "grammar.h"      /* grammar */
-#include "node.h"         /* node */
-
-typedef struct {
-    int error;
-    PyObject *filename;
-    int lineno;
-    int offset;
-    char *text;                 /* UTF-8-encoded string */
-    int token;
-    int expected;
-} perrdetail;
-
-#if 0
-#define PyPARSE_YIELD_IS_KEYWORD        0x0001
-#endif
-
-#define PyPARSE_DONT_IMPLY_DEDENT       0x0002
-
-#if 0
-#define PyPARSE_WITH_IS_KEYWORD         0x0003
-#define PyPARSE_PRINT_IS_FUNCTION       0x0004
-#define PyPARSE_UNICODE_LITERALS        0x0008
-#endif
-
-#define PyPARSE_IGNORE_COOKIE 0x0010
-#define PyPARSE_BARRY_AS_BDFL 0x0020
-#define PyPARSE_TYPE_COMMENTS 0x0040
-#define PyPARSE_ASYNC_HACKS   0x0080
-
-PyAPI_FUNC(node *) PyParser_ParseString(const char *, grammar *, int,
-                                              perrdetail *);
-PyAPI_FUNC(node *) PyParser_ParseFile (FILE *, const char *, grammar *, int,
-                                             const char *, const char *,
-                                             perrdetail *);
-
-PyAPI_FUNC(node *) PyParser_ParseStringFlags(const char *, grammar *, int,
-                                              perrdetail *, int);
-PyAPI_FUNC(node *) PyParser_ParseFileFlags(
-    FILE *fp,
-    const char *filename,       /* decoded from the filesystem encoding */
-    const char *enc,
-    grammar *g,
-    int start,
-    const char *ps1,
-    const char *ps2,
-    perrdetail *err_ret,
-    int flags);
-PyAPI_FUNC(node *) PyParser_ParseFileFlagsEx(
-    FILE *fp,
-    const char *filename,       /* decoded from the filesystem encoding */
-    const char *enc,
-    grammar *g,
-    int start,
-    const char *ps1,
-    const char *ps2,
-    perrdetail *err_ret,
-    int *flags);
-PyAPI_FUNC(node *) PyParser_ParseFileObject(
-    FILE *fp,
-    PyObject *filename,
-    const char *enc,
-    grammar *g,
-    int start,
-    const char *ps1,
-    const char *ps2,
-    perrdetail *err_ret,
-    int *flags);
-
-PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilename(
-    const char *s,
-    const char *filename,       /* decoded from the filesystem encoding */
-    grammar *g,
-    int start,
-    perrdetail *err_ret,
-    int flags);
-PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilenameEx(
-    const char *s,
-    const char *filename,       /* decoded from the filesystem encoding */
-    grammar *g,
-    int start,
-    perrdetail *err_ret,
-    int *flags);
-PyAPI_FUNC(node *) PyParser_ParseStringObject(
-    const char *s,
-    PyObject *filename,
-    grammar *g,
-    int start,
-    perrdetail *err_ret,
-    int *flags);
-
-/* Note that the following functions are defined in pythonrun.c,
-   not in parsetok.c */
-PyAPI_FUNC(void) PyParser_SetError(perrdetail *);
-PyAPI_FUNC(void) PyParser_ClearError(perrdetail *);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* !Py_PARSETOK_H */
-#endif /* !Py_LIMITED_API */
diff --git a/Include/patchlevel.h b/Include/patchlevel.h
index 0b5d280..5bb246e 100644
--- a/Include/patchlevel.h
+++ b/Include/patchlevel.h
@@ -17,13 +17,13 @@
 /* Version parsed out into numeric values */
 /*--start constants--*/
 #define PY_MAJOR_VERSION        3
-#define PY_MINOR_VERSION        9
-#define PY_MICRO_VERSION        1
+#define PY_MINOR_VERSION        10
+#define PY_MICRO_VERSION        3
 #define PY_RELEASE_LEVEL        PY_RELEASE_LEVEL_FINAL
 #define PY_RELEASE_SERIAL       0
 
 /* Version as a string */
-#define PY_VERSION              "3.9.1"
+#define PY_VERSION              "3.10.3"
 /*--end constants--*/
 
 /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2.
diff --git a/Include/pyarena.h b/Include/pyarena.h
deleted file mode 100644
index db3ad01..0000000
--- a/Include/pyarena.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* An arena-like memory interface for the compiler.
- */
-
-#ifndef Py_LIMITED_API
-#ifndef Py_PYARENA_H
-#define Py_PYARENA_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-  typedef struct _arena PyArena;
-
-  /* PyArena_New() and PyArena_Free() create a new arena and free it,
-     respectively.  Once an arena has been created, it can be used
-     to allocate memory via PyArena_Malloc().  Pointers to PyObject can
-     also be registered with the arena via PyArena_AddPyObject(), and the
-     arena will ensure that the PyObjects stay alive at least until
-     PyArena_Free() is called.  When an arena is freed, all the memory it
-     allocated is freed, the arena releases internal references to registered
-     PyObject*, and none of its pointers are valid.
-     XXX (tim) What does "none of its pointers are valid" mean?  Does it
-     XXX mean that pointers previously obtained via PyArena_Malloc() are
-     XXX no longer valid?  (That's clearly true, but not sure that's what
-     XXX the text is trying to say.)
-
-     PyArena_New() returns an arena pointer.  On error, it
-     returns a negative number and sets an exception.
-     XXX (tim):  Not true.  On error, PyArena_New() actually returns NULL,
-     XXX and looks like it may or may not set an exception (e.g., if the
-     XXX internal PyList_New(0) returns NULL, PyArena_New() passes that on
-     XXX and an exception is set; OTOH, if the internal
-     XXX block_new(DEFAULT_BLOCK_SIZE) returns NULL, that's passed on but
-     XXX an exception is not set in that case).
-  */
-  PyAPI_FUNC(PyArena *) PyArena_New(void);
-  PyAPI_FUNC(void) PyArena_Free(PyArena *);
-
-  /* Mostly like malloc(), return the address of a block of memory spanning
-   * `size` bytes, or return NULL (without setting an exception) if enough
-   * new memory can't be obtained.  Unlike malloc(0), PyArena_Malloc() with
-   * size=0 does not guarantee to return a unique pointer (the pointer
-   * returned may equal one or more other pointers obtained from
-   * PyArena_Malloc()).
-   * Note that pointers obtained via PyArena_Malloc() must never be passed to
-   * the system free() or realloc(), or to any of Python's similar memory-
-   * management functions.  PyArena_Malloc()-obtained pointers remain valid
-   * until PyArena_Free(ar) is called, at which point all pointers obtained
-   * from the arena `ar` become invalid simultaneously.
-   */
-  PyAPI_FUNC(void *) PyArena_Malloc(PyArena *, size_t size);
-
-  /* This routine isn't a proper arena allocation routine.  It takes
-   * a PyObject* and records it so that it can be DECREFed when the
-   * arena is freed.
-   */
-  PyAPI_FUNC(int) PyArena_AddPyObject(PyArena *, PyObject *);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !Py_PYARENA_H */
-#endif /* Py_LIMITED_API */
diff --git a/Include/pyerrors.h b/Include/pyerrors.h
index 979a26b..f5d1c71 100644
--- a/Include/pyerrors.h
+++ b/Include/pyerrors.h
@@ -30,12 +30,6 @@
    macro is defined. */
 PyAPI_FUNC(void) _Py_NO_RETURN Py_FatalError(const char *message);
 
-#if defined(Py_DEBUG) || defined(Py_LIMITED_API)
-#define _PyErr_OCCURRED() PyErr_Occurred()
-#else
-#define _PyErr_OCCURRED() (PyThreadState_GET()->curexc_type)
-#endif
-
 /* Error testing and normalization */
 PyAPI_FUNC(int) PyErr_GivenExceptionMatches(PyObject *, PyObject *);
 PyAPI_FUNC(int) PyErr_ExceptionMatches(PyObject *);
@@ -152,6 +146,7 @@
 PyAPI_DATA(PyObject *) PyExc_ImportWarning;
 PyAPI_DATA(PyObject *) PyExc_UnicodeWarning;
 PyAPI_DATA(PyObject *) PyExc_BytesWarning;
+PyAPI_DATA(PyObject *) PyExc_EncodingWarning;
 PyAPI_DATA(PyObject *) PyExc_ResourceWarning;
 
 
@@ -230,6 +225,9 @@
 /* In signalmodule.c */
 PyAPI_FUNC(int) PyErr_CheckSignals(void);
 PyAPI_FUNC(void) PyErr_SetInterrupt(void);
+#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030A0000
+PyAPI_FUNC(int) PyErr_SetInterruptEx(int signum);
+#endif
 
 /* Support for adding program text to SyntaxErrors */
 PyAPI_FUNC(void) PyErr_SyntaxLocation(
diff --git a/Include/pyhash.h b/Include/pyhash.h
index 4437b87..a314ea9 100644
--- a/Include/pyhash.h
+++ b/Include/pyhash.h
@@ -7,7 +7,7 @@
 
 /* Helpers for hash functions */
 #ifndef Py_LIMITED_API
-PyAPI_FUNC(Py_hash_t) _Py_HashDouble(double);
+PyAPI_FUNC(Py_hash_t) _Py_HashDouble(PyObject *, double);
 PyAPI_FUNC(Py_hash_t) _Py_HashPointer(const void*);
 // Similar to _Py_HashPointer(), but don't replace -1 with -2
 PyAPI_FUNC(Py_hash_t) _Py_HashPointerRaw(const void*);
@@ -29,7 +29,6 @@
 
 #define _PyHASH_MODULUS (((size_t)1 << _PyHASH_BITS) - 1)
 #define _PyHASH_INF 314159
-#define _PyHASH_NAN 0
 #define _PyHASH_IMAG _PyHASH_MULTIPLIER
 
 
@@ -77,7 +76,6 @@
     } expat;
 } _Py_HashSecret_t;
 PyAPI_DATA(_Py_HashSecret_t) _Py_HashSecret;
-#endif
 
 #ifdef Py_DEBUG
 PyAPI_DATA(int) _Py_HashSecret_Initialized;
@@ -85,7 +83,6 @@
 
 
 /* hash function definition */
-#ifndef Py_LIMITED_API
 typedef struct {
     Py_hash_t (*const hash)(const void *, Py_ssize_t);
     const char *name;
diff --git a/Include/pylifecycle.h b/Include/pylifecycle.h
index c5368b3..2df7fe6 100644
--- a/Include/pylifecycle.h
+++ b/Include/pylifecycle.h
@@ -31,7 +31,6 @@
 
 /* Bootstrap __main__ (defined in Modules/main.c) */
 PyAPI_FUNC(int) Py_Main(int argc, wchar_t **argv);
-
 PyAPI_FUNC(int) Py_BytesMain(int argc, char **argv);
 
 /* In pathconfig.c */
diff --git a/Include/pymath.h b/Include/pymath.h
index 63ca972..f869724 100644
--- a/Include/pymath.h
+++ b/Include/pymath.h
@@ -227,12 +227,4 @@
  * behavior. */
 #define _Py_InIntegralTypeRange(type, v) (_Py_IntegralTypeMin(type) <= v && v <= _Py_IntegralTypeMax(type))
 
-/* Return the smallest integer k such that n < 2**k, or 0 if n == 0.
- * Equivalent to floor(log2(x))+1.  Also equivalent to: bitwidth_of_type -
- * count_leading_zero_bits(x)
- */
-#ifndef Py_LIMITED_API
-PyAPI_FUNC(unsigned int) _Py_bit_length(unsigned long d);
-#endif
-
 #endif /* Py_PYMATH_H */
diff --git a/Include/pymem.h b/Include/pymem.h
index 607feb9..66cdb0d 100644
--- a/Include/pymem.h
+++ b/Include/pymem.h
@@ -25,8 +25,8 @@
    heap used by the Python DLL; it could be a disaster if you free()'ed that
    directly in your own extension.  Using PyMem_Free instead ensures Python
    can return the memory to the proper heap.  As another example, in
-   PYMALLOC_DEBUG mode, Python wraps all calls to all PyMem_ and PyObject_
-   memory functions in special debugging wrappers that add additional
+   a debug build (Py_DEBUG macro), Python wraps all calls to all PyMem_ and
+   PyObject_ memory functions in special debugging wrappers that add additional
    debugging info to dynamic memory blocks.  The system routines have no idea
    what to do with that stuff, and the Python wrappers have no idea what to do
    with raw blocks obtained directly by the system routines then.
@@ -50,21 +50,10 @@
 */
 
 PyAPI_FUNC(void *) PyMem_Malloc(size_t size);
+PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize);
 PyAPI_FUNC(void *) PyMem_Realloc(void *ptr, size_t new_size);
 PyAPI_FUNC(void) PyMem_Free(void *ptr);
 
-/* Macros. */
-
-/* PyMem_MALLOC(0) means malloc(1). Some systems would return NULL
-   for malloc(0), which would be treated as an error. Some platforms
-   would return a pointer with no memory behind it, which would break
-   pymalloc. To solve these problems, allocate an extra byte. */
-/* Returns NULL to indicate error if a negative size or size larger than
-   Py_ssize_t can represent is supplied.  Helps prevents security holes. */
-#define PyMem_MALLOC(n)         PyMem_Malloc(n)
-#define PyMem_REALLOC(p, n)     PyMem_Realloc(p, n)
-#define PyMem_FREE(p)           PyMem_Free(p)
-
 /*
  * Type-oriented memory interface
  * ==============================
@@ -78,9 +67,6 @@
 #define PyMem_New(type, n) \
   ( ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL :      \
         ( (type *) PyMem_Malloc((n) * sizeof(type)) ) )
-#define PyMem_NEW(type, n) \
-  ( ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL :      \
-        ( (type *) PyMem_MALLOC((n) * sizeof(type)) ) )
 
 /*
  * The value of (p) is always clobbered by this macro regardless of success.
@@ -91,15 +77,18 @@
 #define PyMem_Resize(p, type, n) \
   ( (p) = ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL :        \
         (type *) PyMem_Realloc((p), (n) * sizeof(type)) )
-#define PyMem_RESIZE(p, type, n) \
-  ( (p) = ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL :        \
-        (type *) PyMem_REALLOC((p), (n) * sizeof(type)) )
 
-/* PyMem{Del,DEL} are left over from ancient days, and shouldn't be used
- * anymore.  They're just confusing aliases for PyMem_{Free,FREE} now.
- */
-#define PyMem_Del               PyMem_Free
-#define PyMem_DEL               PyMem_FREE
+
+// Deprecated aliases only kept for backward compatibility.
+// PyMem_Del and PyMem_DEL are defined with no parameter to be able to use
+// them as function pointers (ex: dealloc = PyMem_Del).
+#define PyMem_MALLOC(n)           PyMem_Malloc(n)
+#define PyMem_NEW(type, n)        PyMem_New(type, n)
+#define PyMem_REALLOC(p, n)       PyMem_Realloc(p, n)
+#define PyMem_RESIZE(p, type, n)  PyMem_Resize(p, type, n)
+#define PyMem_FREE(p)             PyMem_Free(p)
+#define PyMem_Del                 PyMem_Free
+#define PyMem_DEL                 PyMem_Free
 
 
 #ifndef Py_LIMITED_API
diff --git a/Include/pyport.h b/Include/pyport.h
index 4bd4eb4..6ab0ae4 100644
--- a/Include/pyport.h
+++ b/Include/pyport.h
@@ -101,7 +101,9 @@
  * sizeof(size_t).  C99 doesn't define such a thing directly (size_t is an
  * unsigned integral type).  See PEP 353 for details.
  */
-#ifdef HAVE_SSIZE_T
+#ifdef HAVE_PY_SSIZE_T
+
+#elif HAVE_SSIZE_T
 typedef ssize_t         Py_ssize_t;
 #elif SIZEOF_VOID_P == SIZEOF_SIZE_T
 typedef Py_intptr_t     Py_ssize_t;
@@ -131,7 +133,9 @@
 /* Smallest negative value of type Py_ssize_t. */
 #define PY_SSIZE_T_MIN (-PY_SSIZE_T_MAX-1)
 
-/* PY_FORMAT_SIZE_T is a platform-specific modifier for use in a printf
+/* Macro kept for backward compatibility: use "z" in new code.
+ *
+ * PY_FORMAT_SIZE_T is a platform-specific modifier for use in a printf
  * format to convert an argument with the width of a size_t or Py_ssize_t.
  * C99 introduced "z" for this purpose, but old MSVCs had not supported it.
  * Since MSVC supports "z" since (at least) 2015, we can just use "z"
@@ -179,8 +183,9 @@
 
 #if defined(_MSC_VER)
 #  if defined(PY_LOCAL_AGGRESSIVE)
-   /* enable more aggressive optimization for visual studio */
-#  pragma optimize("agtw", on)
+   /* enable more aggressive optimization for MSVC */
+   /* active in both release and debug builds - see bpo-43271 */
+#  pragma optimize("gt", on)
 #endif
    /* ignore warnings if the compiler decides not to inline a function */
 #  pragma warning(disable: 4710)
@@ -839,12 +844,16 @@
 #endif
 
 #if defined(__ANDROID__) || defined(__VXWORKS__)
-   /* Ignore the locale encoding: force UTF-8 */
+   // Use UTF-8 as the locale encoding, ignore the LC_CTYPE locale.
+   // See _Py_GetLocaleEncoding(), PyUnicode_DecodeLocale()
+   // and PyUnicode_EncodeLocale().
 #  define _Py_FORCE_UTF8_LOCALE
 #endif
 
 #if defined(_Py_FORCE_UTF8_LOCALE) || defined(__APPLE__)
-   /* Use UTF-8 as filesystem encoding */
+   // Use UTF-8 as the filesystem encoding.
+   // See PyUnicode_DecodeFSDefaultAndSize(), PyUnicode_EncodeFSDefault(),
+   // Py_DecodeLocale() and Py_EncodeLocale().
 #  define _Py_FORCE_UTF8_FS_ENCODING
 #endif
 
@@ -852,6 +861,7 @@
    PyAPI_FUNC(void) _Py_NO_RETURN PyThread_exit_thread(void);
 
    XLC support is intentionally omitted due to bpo-40244 */
+#ifndef _Py_NO_RETURN
 #if defined(__clang__) || \
     (defined(__GNUC__) && \
      ((__GNUC__ >= 3) || \
@@ -862,6 +872,7 @@
 #else
 #  define _Py_NO_RETURN
 #endif
+#endif
 
 
 // Preprocessor check for a builtin preprocessor function. Always return 0
diff --git a/Include/pythonrun.h b/Include/pythonrun.h
index 5752907..b0a2fc3 100644
--- a/Include/pythonrun.h
+++ b/Include/pythonrun.h
@@ -7,194 +7,15 @@
 extern "C" {
 #endif
 
-#ifndef Py_LIMITED_API
-PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *);
-PyAPI_FUNC(int) PyRun_AnyFileExFlags(
-    FILE *fp,
-    const char *filename,       /* decoded from the filesystem encoding */
-    int closeit,
-    PyCompilerFlags *flags);
-PyAPI_FUNC(int) PyRun_SimpleFileExFlags(
-    FILE *fp,
-    const char *filename,       /* decoded from the filesystem encoding */
-    int closeit,
-    PyCompilerFlags *flags);
-PyAPI_FUNC(int) PyRun_InteractiveOneFlags(
-    FILE *fp,
-    const char *filename,       /* decoded from the filesystem encoding */
-    PyCompilerFlags *flags);
-PyAPI_FUNC(int) PyRun_InteractiveOneObject(
-    FILE *fp,
-    PyObject *filename,
-    PyCompilerFlags *flags);
-PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(
-    FILE *fp,
-    const char *filename,       /* decoded from the filesystem encoding */
-    PyCompilerFlags *flags);
-
-PyAPI_FUNC(struct _mod *) PyParser_ASTFromString(
-    const char *s,
-    const char *filename,       /* decoded from the filesystem encoding */
-    int start,
-    PyCompilerFlags *flags,
-    PyArena *arena);
-PyAPI_FUNC(struct _mod *) PyParser_ASTFromStringObject(
-    const char *s,
-    PyObject *filename,
-    int start,
-    PyCompilerFlags *flags,
-    PyArena *arena);
-PyAPI_FUNC(struct _mod *) PyParser_ASTFromFile(
-    FILE *fp,
-    const char *filename,       /* decoded from the filesystem encoding */
-    const char* enc,
-    int start,
-    const char *ps1,
-    const char *ps2,
-    PyCompilerFlags *flags,
-    int *errcode,
-    PyArena *arena);
-PyAPI_FUNC(struct _mod *) PyParser_ASTFromFileObject(
-    FILE *fp,
-    PyObject *filename,
-    const char* enc,
-    int start,
-    const char *ps1,
-    const char *ps2,
-    PyCompilerFlags *flags,
-    int *errcode,
-    PyArena *arena);
-#endif
-
-#ifndef PyParser_SimpleParseString
-#define PyParser_SimpleParseString(S, B) \
-    PyParser_SimpleParseStringFlags(S, B, 0)
-#define PyParser_SimpleParseFile(FP, S, B) \
-    PyParser_SimpleParseFileFlags(FP, S, B, 0)
-#endif
-
-#ifndef Py_BUILD_CORE
-Py_DEPRECATED(3.9)
-#endif
-PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(const char *, int, int);
-#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
-#ifndef Py_BUILD_CORE
-Py_DEPRECATED(3.9)
-#endif
-PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlagsFilename(const char *,
-                                                                   const char *,
-                                                                   int, int);
-#endif
-#ifndef Py_BUILD_CORE
-Py_DEPRECATED(3.9)
-#endif
-PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, const char *, int, int);
-#ifndef Py_LIMITED_API
-PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *,
-                                         PyObject *, PyCompilerFlags *);
-
-PyAPI_FUNC(PyObject *) PyRun_FileExFlags(
-    FILE *fp,
-    const char *filename,       /* decoded from the filesystem encoding */
-    int start,
-    PyObject *globals,
-    PyObject *locals,
-    int closeit,
-    PyCompilerFlags *flags);
-#endif
-
-#ifdef Py_LIMITED_API
 PyAPI_FUNC(PyObject *) Py_CompileString(const char *, const char *, int);
-#else
-#define Py_CompileString(str, p, s) Py_CompileStringExFlags(str, p, s, NULL, -1)
-#define Py_CompileStringFlags(str, p, s, f) Py_CompileStringExFlags(str, p, s, f, -1)
-PyAPI_FUNC(PyObject *) Py_CompileStringExFlags(
-    const char *str,
-    const char *filename,       /* decoded from the filesystem encoding */
-    int start,
-    PyCompilerFlags *flags,
-    int optimize);
-PyAPI_FUNC(PyObject *) Py_CompileStringObject(
-    const char *str,
-    PyObject *filename, int start,
-    PyCompilerFlags *flags,
-    int optimize);
-#endif
-PyAPI_FUNC(struct symtable *) Py_SymtableString(
-    const char *str,
-    const char *filename,       /* decoded from the filesystem encoding */
-    int start);
-#ifndef Py_LIMITED_API
-PyAPI_FUNC(const char *) _Py_SourceAsString(
-    PyObject *cmd,
-    const char *funcname,
-    const char *what,
-    PyCompilerFlags *cf,
-    PyObject **cmd_copy);
-
-PyAPI_FUNC(struct symtable *) Py_SymtableStringObject(
-    const char *str,
-    PyObject *filename,
-    int start);
-
-PyAPI_FUNC(struct symtable *) _Py_SymtableStringObjectFlags(
-    const char *str,
-    PyObject *filename,
-    int start,
-    PyCompilerFlags *flags);
-#endif
 
 PyAPI_FUNC(void) PyErr_Print(void);
 PyAPI_FUNC(void) PyErr_PrintEx(int);
 PyAPI_FUNC(void) PyErr_Display(PyObject *, PyObject *, PyObject *);
 
-#ifndef Py_LIMITED_API
-/* A function flavor is also exported by libpython. It is required when
-    libpython is accessed directly rather than using header files which defines
-    macros below. On Windows, for example, PyAPI_FUNC() uses dllexport to
-    export functions in pythonXX.dll. */
-PyAPI_FUNC(PyObject *) PyRun_String(const char *str, int s, PyObject *g, PyObject *l);
-PyAPI_FUNC(int) PyRun_AnyFile(FILE *fp, const char *name);
-PyAPI_FUNC(int) PyRun_AnyFileEx(FILE *fp, const char *name, int closeit);
-PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *);
-PyAPI_FUNC(int) PyRun_SimpleString(const char *s);
-PyAPI_FUNC(int) PyRun_SimpleFile(FILE *f, const char *p);
-PyAPI_FUNC(int) PyRun_SimpleFileEx(FILE *f, const char *p, int c);
-PyAPI_FUNC(int) PyRun_InteractiveOne(FILE *f, const char *p);
-PyAPI_FUNC(int) PyRun_InteractiveLoop(FILE *f, const char *p);
-PyAPI_FUNC(PyObject *) PyRun_File(FILE *fp, const char *p, int s, PyObject *g, PyObject *l);
-PyAPI_FUNC(PyObject *) PyRun_FileEx(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, int c);
-PyAPI_FUNC(PyObject *) PyRun_FileFlags(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, PyCompilerFlags *flags);
-
-/* Use macros for a bunch of old variants */
-#define PyRun_String(str, s, g, l) PyRun_StringFlags(str, s, g, l, NULL)
-#define PyRun_AnyFile(fp, name) PyRun_AnyFileExFlags(fp, name, 0, NULL)
-#define PyRun_AnyFileEx(fp, name, closeit) \
-    PyRun_AnyFileExFlags(fp, name, closeit, NULL)
-#define PyRun_AnyFileFlags(fp, name, flags) \
-    PyRun_AnyFileExFlags(fp, name, 0, flags)
-#define PyRun_SimpleString(s) PyRun_SimpleStringFlags(s, NULL)
-#define PyRun_SimpleFile(f, p) PyRun_SimpleFileExFlags(f, p, 0, NULL)
-#define PyRun_SimpleFileEx(f, p, c) PyRun_SimpleFileExFlags(f, p, c, NULL)
-#define PyRun_InteractiveOne(f, p) PyRun_InteractiveOneFlags(f, p, NULL)
-#define PyRun_InteractiveLoop(f, p) PyRun_InteractiveLoopFlags(f, p, NULL)
-#define PyRun_File(fp, p, s, g, l) \
-    PyRun_FileExFlags(fp, p, s, g, l, 0, NULL)
-#define PyRun_FileEx(fp, p, s, g, l, c) \
-    PyRun_FileExFlags(fp, p, s, g, l, c, NULL)
-#define PyRun_FileFlags(fp, p, s, g, l, flags) \
-    PyRun_FileExFlags(fp, p, s, g, l, 0, flags)
-#endif
 
 /* Stuff with no proper home (yet) */
-#ifndef Py_LIMITED_API
-PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, const char *);
-#endif
 PyAPI_DATA(int) (*PyOS_InputHook)(void);
-PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, const char *);
-#ifndef Py_LIMITED_API
-PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState;
-#endif
 
 /* Stack size, in "pointers" (so we get extra safety margins
    on 64-bit platforms).  On a 32-bit platform, this translates
@@ -211,6 +32,12 @@
 PyAPI_FUNC(int) PyOS_CheckStack(void);
 #endif
 
+#ifndef Py_LIMITED_API
+#  define Py_CPYTHON_PYTHONRUN_H
+#  include  "cpython/pythonrun.h"
+#  undef Py_CPYTHON_PYTHONRUN_H
+#endif
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/Include/setobject.h b/Include/setobject.h
index 119619e..62516be 100644
--- a/Include/setobject.h
+++ b/Include/setobject.h
@@ -88,18 +88,21 @@
 PyAPI_FUNC(Py_ssize_t) PySet_Size(PyObject *anyset);
 
 #define PyFrozenSet_CheckExact(ob) Py_IS_TYPE(ob, &PyFrozenSet_Type)
+#define PyFrozenSet_Check(ob) \
+    (Py_IS_TYPE(ob, &PyFrozenSet_Type) || \
+      PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type))
+
 #define PyAnySet_CheckExact(ob) \
     (Py_IS_TYPE(ob, &PySet_Type) || Py_IS_TYPE(ob, &PyFrozenSet_Type))
 #define PyAnySet_Check(ob) \
     (Py_IS_TYPE(ob, &PySet_Type) || Py_IS_TYPE(ob, &PyFrozenSet_Type) || \
       PyType_IsSubtype(Py_TYPE(ob), &PySet_Type) || \
       PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type))
+
+#define PySet_CheckExact(op) Py_IS_TYPE(op, &PySet_Type)
 #define PySet_Check(ob) \
     (Py_IS_TYPE(ob, &PySet_Type) || \
     PyType_IsSubtype(Py_TYPE(ob), &PySet_Type))
-#define   PyFrozenSet_Check(ob) \
-    (Py_IS_TYPE(ob, &PyFrozenSet_Type) || \
-      PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type))
 
 #ifdef __cplusplus
 }
diff --git a/Include/structmember.h b/Include/structmember.h
index b54f708..93b7aff 100644
--- a/Include/structmember.h
+++ b/Include/structmember.h
@@ -62,6 +62,7 @@
 #define PY_WRITE_RESTRICTED 4
 #define RESTRICTED          (READ_RESTRICTED | PY_WRITE_RESTRICTED)
 
+#define PY_AUDIT_READ       READ_RESTRICTED
 
 /* Current API, use this */
 PyAPI_FUNC(PyObject *) PyMember_GetOne(const char *, struct PyMemberDef *);
diff --git a/Include/token.h b/Include/token.h
index 9b8a3aa..eb1b9ea 100644
--- a/Include/token.h
+++ b/Include/token.h
@@ -69,8 +69,9 @@
 #define ASYNC           56
 #define TYPE_IGNORE     57
 #define TYPE_COMMENT    58
-#define ERRORTOKEN      59
-#define N_TOKENS        63
+#define SOFT_KEYWORD    59
+#define ERRORTOKEN      60
+#define N_TOKENS        64
 #define NT_OFFSET       256
 
 /* Special definitions for cooperation with parser */
diff --git a/Include/typeslots.h b/Include/typeslots.h
index 64f6fff..5800d01 100644
--- a/Include/typeslots.h
+++ b/Include/typeslots.h
@@ -88,3 +88,7 @@
 /* New in 3.5 */
 #define Py_tp_finalize 80
 #endif
+#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030A0000
+/* New in 3.10 */
+#define Py_am_send 81
+#endif
diff --git a/Include/ucnhash.h b/Include/ucnhash.h
deleted file mode 100644
index 45362e9..0000000
--- a/Include/ucnhash.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Unicode name database interface */
-#ifndef Py_LIMITED_API
-#ifndef Py_UCNHASH_H
-#define Py_UCNHASH_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* revised ucnhash CAPI interface (exported through a "wrapper") */
-
-#define PyUnicodeData_CAPSULE_NAME "unicodedata.ucnhash_CAPI"
-
-typedef struct {
-
-    /* Size of this struct */
-    int size;
-
-    /* Get name for a given character code.  Returns non-zero if
-       success, zero if not.  Does not set Python exceptions.
-       If self is NULL, data come from the default version of the database.
-       If it is not NULL, it should be a unicodedata.ucd_X_Y_Z object */
-    int (*getname)(PyObject *self, Py_UCS4 code, char* buffer, int buflen,
-                   int with_alias_and_seq);
-
-    /* Get character code for a given name.  Same error handling
-       as for getname. */
-    int (*getcode)(PyObject *self, const char* name, int namelen, Py_UCS4* code,
-                   int with_named_seq);
-
-} _PyUnicode_Name_CAPI;
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* !Py_UCNHASH_H */
-#endif /* !Py_LIMITED_API */
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h
index 500ce24..b0ac086 100644
--- a/Include/unicodeobject.h
+++ b/Include/unicodeobject.h
@@ -261,11 +261,14 @@
     );
 
 PyAPI_FUNC(void) PyUnicode_InternInPlace(PyObject **);
-PyAPI_FUNC(void) PyUnicode_InternImmortal(PyObject **);
 PyAPI_FUNC(PyObject *) PyUnicode_InternFromString(
     const char *u              /* UTF-8 encoded string */
     );
 
+// PyUnicode_InternImmortal() is deprecated since Python 3.10
+// and will be removed in Python 3.12. Use PyUnicode_InternInPlace() instead.
+Py_DEPRECATED(3.10) PyAPI_FUNC(void) PyUnicode_InternImmortal(PyObject **);
+
 /* Use only if you know it's a string */
 #define PyUnicode_CHECK_INTERNED(op) \
     (((PyASCIIObject *)(op))->state.interned)
@@ -465,6 +468,23 @@
     PyObject *unicode           /* Unicode object */
     );
 
+/* Returns a pointer to the default encoding (UTF-8) of the
+   Unicode object unicode and the size of the encoded representation
+   in bytes stored in *size.
+
+   In case of an error, no *size is set.
+
+   This function caches the UTF-8 encoded string in the unicodeobject
+   and subsequent calls will return the same string.  The memory is released
+   when the unicodeobject is deallocated.
+*/
+
+#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030A0000
+PyAPI_FUNC(const char *) PyUnicode_AsUTF8AndSize(
+    PyObject *unicode,
+    Py_ssize_t *size);
+#endif
+
 /* --- UTF-32 Codecs ------------------------------------------------------ */
 
 /* Decodes length bytes from a UTF-32 encoded buffer string and returns
diff --git a/LICENSE b/LICENSE
index f42f8ad..02a5145 100644
--- a/LICENSE
+++ b/LICENSE
@@ -84,7 +84,7 @@
 distribute, and otherwise use Python alone or in any derivative version,
 provided, however, that PSF's License Agreement and PSF's notice of copyright,
 i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Python Software Foundation;
+2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 Python Software Foundation;
 All Rights Reserved" are retained in Python alone or in any derivative version
 prepared by Licensee.
 
@@ -191,9 +191,9 @@
 Agreement, Licensee may substitute the following text (omitting the
 quotes): "Python 1.6.1 is made available subject to the terms and
 conditions in CNRI's License Agreement.  This Agreement together with
-Python 1.6.1 may be located on the Internet using the following
+Python 1.6.1 may be located on the internet using the following
 unique, persistent identifier (known as a handle): 1895.22/1013.  This
-Agreement may also be obtained from a proxy server on the Internet
+Agreement may also be obtained from a proxy server on the internet
 using the following URL: http://hdl.handle.net/1895.22/1013".
 
 3. In the event Licensee prepares a derivative work that is based on
diff --git a/Lib/__future__.py b/Lib/__future__.py
index 0e7b555..97dc90c 100644
--- a/Lib/__future__.py
+++ b/Lib/__future__.py
@@ -42,7 +42,7 @@
 argument to the builtin function compile() to enable the feature in
 dynamically compiled code.  This flag is stored in the .compiler_flag
 attribute on _Future instances.  These values must match the appropriate
-#defines of CO_xxx flags in Include/compile.h.
+#defines of CO_xxx flags in Include/cpython/compile.h.
 
 No feature line is ever to be deleted from this file.
 """
@@ -143,5 +143,5 @@
                           CO_FUTURE_GENERATOR_STOP)
 
 annotations = _Feature((3, 7, 0, "beta", 1),
-                       (3, 10, 0, "alpha", 0),
+                       (3, 11, 0, "alpha", 0),
                        CO_FUTURE_ANNOTATIONS)
diff --git a/Lib/_bootlocale.py b/Lib/_bootlocale.py
deleted file mode 100644
index 3273a3b..0000000
--- a/Lib/_bootlocale.py
+++ /dev/null
@@ -1,46 +0,0 @@
-"""A minimal subset of the locale module used at interpreter startup
-(imported by the _io module), in order to reduce startup time.
-
-Don't import directly from third-party code; use the `locale` module instead!
-"""
-
-import sys
-import _locale
-
-if sys.platform.startswith("win"):
-    def getpreferredencoding(do_setlocale=True):
-        if sys.flags.utf8_mode:
-            return 'UTF-8'
-        return _locale._getdefaultlocale()[1]
-else:
-    try:
-        _locale.CODESET
-    except AttributeError:
-        if hasattr(sys, 'getandroidapilevel'):
-            # On Android langinfo.h and CODESET are missing, and UTF-8 is
-            # always used in mbstowcs() and wcstombs().
-            def getpreferredencoding(do_setlocale=True):
-                return 'UTF-8'
-        else:
-            def getpreferredencoding(do_setlocale=True):
-                if sys.flags.utf8_mode:
-                    return 'UTF-8'
-                # This path for legacy systems needs the more complex
-                # getdefaultlocale() function, import the full locale module.
-                import locale
-                return locale.getpreferredencoding(do_setlocale)
-    else:
-        def getpreferredencoding(do_setlocale=True):
-            assert not do_setlocale
-            if sys.flags.utf8_mode:
-                return 'UTF-8'
-            result = _locale.nl_langinfo(_locale.CODESET)
-            if not result and sys.platform == 'darwin':
-                # nl_langinfo can return an empty string
-                # when the setting has an invalid value.
-                # Default to UTF-8 in that case because
-                # UTF-8 is the default charset on OSX and
-                # returning nothing will crash the
-                # interpreter.
-                result = 'UTF-8'
-            return result
diff --git a/Lib/_collections_abc.py b/Lib/_collections_abc.py
index 36cd993..40417dc 100644
--- a/Lib/_collections_abc.py
+++ b/Lib/_collections_abc.py
@@ -10,6 +10,10 @@
 import sys
 
 GenericAlias = type(list[int])
+EllipsisType = type(...)
+def _f(): pass
+FunctionType = type(_f)
+del _f
 
 __all__ = ["Awaitable", "Coroutine",
            "AsyncIterable", "AsyncIterator", "AsyncGenerator",
@@ -409,6 +413,143 @@
         return NotImplemented
 
 
+class _CallableGenericAlias(GenericAlias):
+    """ Represent `Callable[argtypes, resulttype]`.
+
+    This sets ``__args__`` to a tuple containing the flattened ``argtypes``
+    followed by ``resulttype``.
+
+    Example: ``Callable[[int, str], float]`` sets ``__args__`` to
+    ``(int, str, float)``.
+    """
+
+    __slots__ = ()
+
+    def __new__(cls, origin, args):
+        if not (isinstance(args, tuple) and len(args) == 2):
+            raise TypeError(
+                "Callable must be used as Callable[[arg, ...], result].")
+        t_args, t_result = args
+        if isinstance(t_args, list):
+            args = (*t_args, t_result)
+        elif not _is_param_expr(t_args):
+            raise TypeError(f"Expected a list of types, an ellipsis, "
+                            f"ParamSpec, or Concatenate. Got {t_args}")
+        return super().__new__(cls, origin, args)
+
+    @property
+    def __parameters__(self):
+        params = []
+        for arg in self.__args__:
+            # Looks like a genericalias
+            if hasattr(arg, "__parameters__") and isinstance(arg.__parameters__, tuple):
+                params.extend(arg.__parameters__)
+            else:
+                if _is_typevarlike(arg):
+                    params.append(arg)
+        return tuple(dict.fromkeys(params))
+
+    def __repr__(self):
+        if len(self.__args__) == 2 and _is_param_expr(self.__args__[0]):
+            return super().__repr__()
+        return (f'collections.abc.Callable'
+                f'[[{", ".join([_type_repr(a) for a in self.__args__[:-1]])}], '
+                f'{_type_repr(self.__args__[-1])}]')
+
+    def __reduce__(self):
+        args = self.__args__
+        if not (len(args) == 2 and _is_param_expr(args[0])):
+            args = list(args[:-1]), args[-1]
+        return _CallableGenericAlias, (Callable, args)
+
+    def __getitem__(self, item):
+        # Called during TypeVar substitution, returns the custom subclass
+        # rather than the default types.GenericAlias object.  Most of the
+        # code is copied from typing's _GenericAlias and the builtin
+        # types.GenericAlias.
+
+        # A special case in PEP 612 where if X = Callable[P, int],
+        # then X[int, str] == X[[int, str]].
+        param_len = len(self.__parameters__)
+        if param_len == 0:
+            raise TypeError(f'{self} is not a generic class')
+        if not isinstance(item, tuple):
+            item = (item,)
+        if (param_len == 1 and _is_param_expr(self.__parameters__[0])
+                and item and not _is_param_expr(item[0])):
+            item = (list(item),)
+        item_len = len(item)
+        if item_len != param_len:
+            raise TypeError(f'Too {"many" if item_len > param_len else "few"}'
+                            f' arguments for {self};'
+                            f' actual {item_len}, expected {param_len}')
+        subst = dict(zip(self.__parameters__, item))
+        new_args = []
+        for arg in self.__args__:
+            if _is_typevarlike(arg):
+                if _is_param_expr(arg):
+                    arg = subst[arg]
+                    if not _is_param_expr(arg):
+                        raise TypeError(f"Expected a list of types, an ellipsis, "
+                                        f"ParamSpec, or Concatenate. Got {arg}")
+                else:
+                    arg = subst[arg]
+            # Looks like a GenericAlias
+            elif hasattr(arg, '__parameters__') and isinstance(arg.__parameters__, tuple):
+                subparams = arg.__parameters__
+                if subparams:
+                    subargs = tuple(subst[x] for x in subparams)
+                    arg = arg[subargs]
+            if isinstance(arg, tuple):
+                new_args.extend(arg)
+            else:
+                new_args.append(arg)
+
+        # args[0] occurs due to things like Z[[int, str, bool]] from PEP 612
+        if not isinstance(new_args[0], list):
+            t_result = new_args[-1]
+            t_args = new_args[:-1]
+            new_args = (t_args, t_result)
+        return _CallableGenericAlias(Callable, tuple(new_args))
+
+
+def _is_typevarlike(arg):
+    obj = type(arg)
+    # looks like a TypeVar/ParamSpec
+    return (obj.__module__ == 'typing'
+            and obj.__name__ in {'ParamSpec', 'TypeVar'})
+
+def _is_param_expr(obj):
+    """Checks if obj matches either a list of types, ``...``, ``ParamSpec`` or
+    ``_ConcatenateGenericAlias`` from typing.py
+    """
+    if obj is Ellipsis:
+        return True
+    if isinstance(obj, list):
+        return True
+    obj = type(obj)
+    names = ('ParamSpec', '_ConcatenateGenericAlias')
+    return obj.__module__ == 'typing' and any(obj.__name__ == name for name in names)
+
+def _type_repr(obj):
+    """Return the repr() of an object, special-casing types (internal helper).
+
+    Copied from :mod:`typing` since collections.abc
+    shouldn't depend on that module.
+    """
+    if isinstance(obj, GenericAlias):
+        return repr(obj)
+    if isinstance(obj, type):
+        if obj.__module__ == 'builtins':
+            return obj.__qualname__
+        return f'{obj.__module__}.{obj.__qualname__}'
+    if obj is Ellipsis:
+        return '...'
+    if isinstance(obj, FunctionType):
+        return obj.__name__
+    return repr(obj)
+
+
 class Callable(metaclass=ABCMeta):
 
     __slots__ = ()
@@ -423,14 +564,13 @@
             return _check_methods(C, "__call__")
         return NotImplemented
 
-    __class_getitem__ = classmethod(GenericAlias)
+    __class_getitem__ = classmethod(_CallableGenericAlias)
 
 
 ### SETS ###
 
 
 class Set(Collection):
-
     """A set is a finite, iterable container.
 
     This class provides concrete generic implementations of all
@@ -558,6 +698,7 @@
             hx = hash(x)
             h ^= (hx ^ (hx << 16) ^ 89869747)  * 3644798167
             h &= MASK
+        h ^= (h >> 11) ^ (h >> 25)
         h = h * 69069 + 907133923
         h &= MASK
         if h > MAX:
@@ -655,19 +796,19 @@
 
 ### MAPPINGS ###
 
-
 class Mapping(Collection):
-
-    __slots__ = ()
-
     """A Mapping is a generic container for associating key/value
     pairs.
 
     This class provides concrete generic implementations of all
     methods except for __getitem__, __iter__, and __len__.
-
     """
 
+    __slots__ = ()
+
+    # Tell ABCMeta.__new__ that this class should have TPFLAGS_MAPPING set.
+    __abc_tpflags__ = 1 << 6 # Py_TPFLAGS_MAPPING
+
     @abstractmethod
     def __getitem__(self, key):
         raise KeyError
@@ -706,7 +847,6 @@
 
     __reversed__ = None
 
-
 Mapping.register(mappingproxy)
 
 
@@ -731,7 +871,7 @@
     __slots__ = ()
 
     @classmethod
-    def _from_iterable(self, it):
+    def _from_iterable(cls, it):
         return set(it)
 
     def __contains__(self, key):
@@ -749,7 +889,7 @@
     __slots__ = ()
 
     @classmethod
-    def _from_iterable(self, it):
+    def _from_iterable(cls, it):
         return set(it)
 
     def __contains__(self, item):
@@ -789,18 +929,16 @@
 
 
 class MutableMapping(Mapping):
-
-    __slots__ = ()
-
     """A MutableMapping is a generic container for associating
     key/value pairs.
 
     This class provides concrete generic implementations of all
     methods except for __getitem__, __setitem__, __delitem__,
     __iter__, and __len__.
-
     """
 
+    __slots__ = ()
+
     @abstractmethod
     def __setitem__(self, key, value):
         raise KeyError
@@ -877,9 +1015,7 @@
 
 ### SEQUENCES ###
 
-
 class Sequence(Reversible, Collection):
-
     """All the operations on a read-only sequence.
 
     Concrete subclasses must override __new__ or __init__,
@@ -888,6 +1024,9 @@
 
     __slots__ = ()
 
+    # Tell ABCMeta.__new__ that this class should have TPFLAGS_SEQUENCE set.
+    __abc_tpflags__ = 1 << 5 # Py_TPFLAGS_SEQUENCE
+
     @abstractmethod
     def __getitem__(self, index):
         raise IndexError
@@ -939,7 +1078,6 @@
         'S.count(value) -> integer -- return number of occurrences of value'
         return sum(1 for v in self if v is value or v == value)
 
-
 Sequence.register(tuple)
 Sequence.register(str)
 Sequence.register(range)
@@ -947,7 +1085,6 @@
 
 
 class ByteString(Sequence):
-
     """This unifies bytes and bytearray.
 
     XXX Should add all their methods.
@@ -960,16 +1097,14 @@
 
 
 class MutableSequence(Sequence):
-
-    __slots__ = ()
-
     """All the operations on a read-write sequence.
 
     Concrete subclasses must provide __new__ or __init__,
     __getitem__, __setitem__, __delitem__, __len__, and insert().
-
     """
 
+    __slots__ = ()
+
     @abstractmethod
     def __setitem__(self, index, value):
         raise IndexError
diff --git a/Lib/_compression.py b/Lib/_compression.py
index b00f31b..e8b70aa 100644
--- a/Lib/_compression.py
+++ b/Lib/_compression.py
@@ -1,7 +1,7 @@
 """Internal classes used by the gzip, lzma and bz2 modules"""
 
 import io
-
+import sys
 
 BUFFER_SIZE = io.DEFAULT_BUFFER_SIZE  # Compressed data read chunk size
 
@@ -110,6 +110,16 @@
         self._pos += len(data)
         return data
 
+    def readall(self):
+        chunks = []
+        # sys.maxsize means the max length of output buffer is unlimited,
+        # so that the whole input buffer can be decompressed within one
+        # .decompress() call.
+        while data := self.read(sys.maxsize):
+            chunks.append(data)
+
+        return b"".join(chunks)
+
     # Rewind the file to the beginning of the data stream.
     def _rewind(self):
         self._fp.seek(0)
diff --git a/Lib/_markupbase.py b/Lib/_markupbase.py
index 2af5f1c..3ad7e27 100644
--- a/Lib/_markupbase.py
+++ b/Lib/_markupbase.py
@@ -29,10 +29,6 @@
             raise RuntimeError(
                 "_markupbase.ParserBase must be subclassed")
 
-    def error(self, message):
-        raise NotImplementedError(
-            "subclasses of ParserBase must override error()")
-
     def reset(self):
         self.lineno = 1
         self.offset = 0
@@ -131,12 +127,11 @@
                     # also in data attribute specifications of attlist declaration
                     # also link type declaration subsets in linktype declarations
                     # also link attribute specification lists in link declarations
-                    self.error("unsupported '[' char in %s declaration" % decltype)
+                    raise AssertionError("unsupported '[' char in %s declaration" % decltype)
                 else:
-                    self.error("unexpected '[' char in declaration")
+                    raise AssertionError("unexpected '[' char in declaration")
             else:
-                self.error(
-                    "unexpected %r char in declaration" % rawdata[j])
+                raise AssertionError("unexpected %r char in declaration" % rawdata[j])
             if j < 0:
                 return j
         return -1 # incomplete
@@ -156,7 +151,9 @@
             # look for MS Office ]> ending
             match= _msmarkedsectionclose.search(rawdata, i+3)
         else:
-            self.error('unknown status keyword %r in marked section' % rawdata[i+3:j])
+            raise AssertionError(
+                'unknown status keyword %r in marked section' % rawdata[i+3:j]
+            )
         if not match:
             return -1
         if report:
@@ -168,7 +165,7 @@
     def parse_comment(self, i, report=1):
         rawdata = self.rawdata
         if rawdata[i:i+4] != '<!--':
-            self.error('unexpected call to parse_comment()')
+            raise AssertionError('unexpected call to parse_comment()')
         match = _commentclose.search(rawdata, i+4)
         if not match:
             return -1
@@ -192,7 +189,9 @@
                     return -1
                 if s != "<!":
                     self.updatepos(declstartpos, j + 1)
-                    self.error("unexpected char in internal subset (in %r)" % s)
+                    raise AssertionError(
+                        "unexpected char in internal subset (in %r)" % s
+                    )
                 if (j + 2) == n:
                     # end of buffer; incomplete
                     return -1
@@ -209,8 +208,9 @@
                     return -1
                 if name not in {"attlist", "element", "entity", "notation"}:
                     self.updatepos(declstartpos, j + 2)
-                    self.error(
-                        "unknown declaration %r in internal subset" % name)
+                    raise AssertionError(
+                        "unknown declaration %r in internal subset" % name
+                    )
                 # handle the individual names
                 meth = getattr(self, "_parse_doctype_" + name)
                 j = meth(j, declstartpos)
@@ -234,14 +234,14 @@
                     if rawdata[j] == ">":
                         return j
                     self.updatepos(declstartpos, j)
-                    self.error("unexpected char after internal subset")
+                    raise AssertionError("unexpected char after internal subset")
                 else:
                     return -1
             elif c.isspace():
                 j = j + 1
             else:
                 self.updatepos(declstartpos, j)
-                self.error("unexpected char %r in internal subset" % c)
+                raise AssertionError("unexpected char %r in internal subset" % c)
         # end of buffer reached
         return -1
 
@@ -387,8 +387,9 @@
             return name.lower(), m.end()
         else:
             self.updatepos(declstartpos, i)
-            self.error("expected name token at %r"
-                       % rawdata[declstartpos:declstartpos+20])
+            raise AssertionError(
+                "expected name token at %r" % rawdata[declstartpos:declstartpos+20]
+            )
 
     # To be overridden -- handlers for unknown objects
     def unknown_decl(self, data):
diff --git a/Lib/_osx_support.py b/Lib/_osx_support.py
index 37975fe..aa66c8b 100644
--- a/Lib/_osx_support.py
+++ b/Lib/_osx_support.py
@@ -96,7 +96,7 @@
     if _SYSTEM_VERSION is None:
         _SYSTEM_VERSION = ''
         try:
-            f = open('/System/Library/CoreServices/SystemVersion.plist')
+            f = open('/System/Library/CoreServices/SystemVersion.plist', encoding="utf-8")
         except OSError:
             # We're on a plain darwin box, fall back to the default
             # behaviour.
@@ -156,9 +156,9 @@
 
     if _cache_default_sysroot is not None:
         return _cache_default_sysroot
-   
+
     contents = _read_output('%s -c -E -v - </dev/null' % (cc,), True)
-    in_incdirs = False   
+    in_incdirs = False
     for line in contents.splitlines():
         if line.startswith("#include <...>"):
             in_incdirs = True
@@ -428,10 +428,9 @@
             break
 
     if sysroot and not os.path.isdir(sysroot):
-        from distutils import log
-        log.warn("Compiling with an SDK that doesn't seem to exist: %s",
-                sysroot)
-        log.warn("Please check your Xcode installation")
+        sys.stderr.write(f"Compiling with an SDK that doesn't seem to exist: {sysroot}\n")
+        sys.stderr.write("Please check your Xcode installation\n")
+        sys.stderr.flush()
 
     return compiler_so
 
@@ -482,7 +481,7 @@
 
     This customization is performed when the first
     extension module build is requested
-    in distutils.sysconfig.customize_compiler).
+    in distutils.sysconfig.customize_compiler.
     """
 
     # Find a compiler to use for extension module builds
@@ -525,10 +524,10 @@
             try:
                 macrelease = tuple(int(i) for i in macrelease.split('.')[0:2])
             except ValueError:
-                macrelease = (10, 0)
+                macrelease = (10, 3)
         else:
             # assume no universal support
-            macrelease = (10, 0)
+            macrelease = (10, 3)
 
         if (macrelease >= (10, 4)) and '-arch' in cflags.strip():
             # The universal build will build fat binaries, but not on
diff --git a/Lib/_pydecimal.py b/Lib/_pydecimal.py
index ab989e5..3d6cece 100644
--- a/Lib/_pydecimal.py
+++ b/Lib/_pydecimal.py
@@ -951,7 +951,7 @@
             if self.is_snan():
                 raise TypeError('Cannot hash a signaling NaN value.')
             elif self.is_nan():
-                return _PyHASH_NAN
+                return object.__hash__(self)
             else:
                 if self._sign:
                     return -_PyHASH_INF
diff --git a/Lib/_pyio.py b/Lib/_pyio.py
index 4804ed2..fb867fb 100644
--- a/Lib/_pyio.py
+++ b/Lib/_pyio.py
@@ -40,6 +40,36 @@
 _CHECK_ERRORS = _IOBASE_EMITS_UNRAISABLE
 
 
+def text_encoding(encoding, stacklevel=2):
+    """
+    A helper function to choose the text encoding.
+
+    When encoding is not None, just return it.
+    Otherwise, return the default text encoding (i.e. "locale").
+
+    This function emits an EncodingWarning if *encoding* is None and
+    sys.flags.warn_default_encoding is true.
+
+    This can be used in APIs with an encoding=None parameter
+    that pass it to TextIOWrapper or open.
+    However, please consider using encoding="utf-8" for new APIs.
+    """
+    if encoding is None:
+        encoding = "locale"
+        if sys.flags.warn_default_encoding:
+            import warnings
+            warnings.warn("'encoding' argument not specified.",
+                          EncodingWarning, stacklevel + 1)
+    return encoding
+
+
+# Wrapper for builtins.open
+#
+# Trick so that open() won't become a bound method when stored
+# as a class variable (as dbm.dumb does).
+#
+# See init_set_builtins_open() in Python/pylifecycle.c.
+@staticmethod
 def open(file, mode="r", buffering=-1, encoding=None, errors=None,
          newline=None, closefd=True, opener=None):
 
@@ -248,6 +278,7 @@
         result = buffer
         if binary:
             return result
+        encoding = text_encoding(encoding)
         text = TextIOWrapper(buffer, encoding, errors, newline, line_buffering)
         result = text
         text.mode = mode
@@ -280,27 +311,20 @@
     open_code = _open_code_with_warning
 
 
-class DocDescriptor:
-    """Helper for builtins.open.__doc__
-    """
-    def __get__(self, obj, typ=None):
-        return (
-            "open(file, mode='r', buffering=-1, encoding=None, "
-                 "errors=None, newline=None, closefd=True)\n\n" +
-            open.__doc__)
-
-class OpenWrapper:
-    """Wrapper for builtins.open
-
-    Trick so that open won't become a bound method when stored
-    as a class variable (as dbm.dumb does).
-
-    See initstdio() in Python/pylifecycle.c.
-    """
-    __doc__ = DocDescriptor()
-
-    def __new__(cls, *args, **kwargs):
-        return open(*args, **kwargs)
+def __getattr__(name):
+    if name == "OpenWrapper":
+        # bpo-43680: Until Python 3.9, _pyio.open was not a static method and
+        # builtins.open was set to OpenWrapper to not become a bound method
+        # when set to a class variable. _io.open is a built-in function whereas
+        # _pyio.open is a Python function. In Python 3.10, _pyio.open() is now
+        # a static method, and builtins.open() is now io.open().
+        import warnings
+        warnings.warn('OpenWrapper is deprecated, use open instead',
+                      DeprecationWarning, stacklevel=2)
+        global OpenWrapper
+        OpenWrapper = open
+        return OpenWrapper
+    raise AttributeError(name)
 
 
 # In normal operation, both `UnsupportedOperation`s should be bound to the
@@ -314,8 +338,7 @@
 
 class IOBase(metaclass=abc.ABCMeta):
 
-    """The abstract base class for all I/O classes, acting on streams of
-    bytes. There is no public constructor.
+    """The abstract base class for all I/O classes.
 
     This class provides dummy implementations for many methods that
     derived classes can override selectively; the default implementations
@@ -1821,7 +1844,7 @@
     """Base class for text I/O.
 
     This class provides a character and line based interface to stream
-    I/O. There is no public constructor.
+    I/O.
     """
 
     def read(self, size=-1):
@@ -2004,19 +2027,22 @@
     def __init__(self, buffer, encoding=None, errors=None, newline=None,
                  line_buffering=False, write_through=False):
         self._check_newline(newline)
-        if encoding is None:
+        encoding = text_encoding(encoding)
+
+        if encoding == "locale":
             try:
-                encoding = os.device_encoding(buffer.fileno())
+                encoding = os.device_encoding(buffer.fileno()) or "locale"
             except (AttributeError, UnsupportedOperation):
                 pass
-            if encoding is None:
-                try:
-                    import locale
-                except ImportError:
-                    # Importing locale may fail if Python is being built
-                    encoding = "ascii"
-                else:
-                    encoding = locale.getpreferredencoding(False)
+
+        if encoding == "locale":
+            try:
+                import locale
+            except ImportError:
+                # Importing locale may fail if Python is being built
+                encoding = "utf-8"
+            else:
+                encoding = locale.getpreferredencoding(False)
 
         if not isinstance(encoding, str):
             raise ValueError("invalid encoding: %r" % encoding)
diff --git a/Lib/_sitebuiltins.py b/Lib/_sitebuiltins.py
index c29cf4b..c66269a 100644
--- a/Lib/_sitebuiltins.py
+++ b/Lib/_sitebuiltins.py
@@ -47,7 +47,7 @@
         data = None
         for filename in self.__filenames:
             try:
-                with open(filename, "r") as fp:
+                with open(filename, encoding='utf-8') as fp:
                     data = fp.read()
                 break
             except OSError:
diff --git a/Lib/_strptime.py b/Lib/_strptime.py
index 5df37f5..b97dfcc 100644
--- a/Lib/_strptime.py
+++ b/Lib/_strptime.py
@@ -201,7 +201,7 @@
             #XXX: Does 'Y' need to worry about having less or more than
             #     4 digits?
             'Y': r"(?P<Y>\d\d\d\d)",
-            'z': r"(?P<z>[+-]\d\d:?[0-5]\d(:?[0-5]\d(\.\d{1,6})?)?|Z)",
+            'z': r"(?P<z>[+-]\d\d:?[0-5]\d(:?[0-5]\d(\.\d{1,6})?)?|(?-i:Z))",
             'A': self.__seqToRE(self.locale_time.f_weekday, 'A'),
             'a': self.__seqToRE(self.locale_time.a_weekday, 'a'),
             'B': self.__seqToRE(self.locale_time.f_month[1:], 'B'),
diff --git a/Lib/_weakrefset.py b/Lib/_weakrefset.py
index b267780..2a27684 100644
--- a/Lib/_weakrefset.py
+++ b/Lib/_weakrefset.py
@@ -51,10 +51,14 @@
             self.update(data)
 
     def _commit_removals(self):
-        l = self._pending_removals
+        pop = self._pending_removals.pop
         discard = self.data.discard
-        while l:
-            discard(l.pop())
+        while True:
+            try:
+                item = pop()
+            except IndexError:
+                return
+            discard(item)
 
     def __iter__(self):
         with _IterationGuard(self):
diff --git a/Lib/abc.py b/Lib/abc.py
index 431b640..3c552ce 100644
--- a/Lib/abc.py
+++ b/Lib/abc.py
@@ -28,7 +28,14 @@
 class abstractclassmethod(classmethod):
     """A decorator indicating abstract classmethods.
 
-    Deprecated, use 'classmethod' with 'abstractmethod' instead.
+    Deprecated, use 'classmethod' with 'abstractmethod' instead:
+
+        class C(ABC):
+            @classmethod
+            @abstractmethod
+            def my_abstract_classmethod(cls, ...):
+                ...
+
     """
 
     __isabstractmethod__ = True
@@ -41,7 +48,14 @@
 class abstractstaticmethod(staticmethod):
     """A decorator indicating abstract staticmethods.
 
-    Deprecated, use 'staticmethod' with 'abstractmethod' instead.
+    Deprecated, use 'staticmethod' with 'abstractmethod' instead:
+
+        class C(ABC):
+            @staticmethod
+            @abstractmethod
+            def my_abstract_staticmethod(...):
+                ...
+
     """
 
     __isabstractmethod__ = True
@@ -54,7 +68,14 @@
 class abstractproperty(property):
     """A decorator indicating abstract properties.
 
-    Deprecated, use 'property' with 'abstractmethod' instead.
+    Deprecated, use 'property' with 'abstractmethod' instead:
+
+        class C(ABC):
+            @property
+            @abstractmethod
+            def my_abstract_property(self):
+                ...
+
     """
 
     __isabstractmethod__ = True
@@ -122,6 +143,44 @@
             _reset_caches(cls)
 
 
+def update_abstractmethods(cls):
+    """Recalculate the set of abstract methods of an abstract class.
+
+    If a class has had one of its abstract methods implemented after the
+    class was created, the method will not be considered implemented until
+    this function is called. Alternatively, if a new abstract method has been
+    added to the class, it will only be considered an abstract method of the
+    class after this function is called.
+
+    This function should be called before any use is made of the class,
+    usually in class decorators that add methods to the subject class.
+
+    Returns cls, to allow usage as a class decorator.
+
+    If cls is not an instance of ABCMeta, does nothing.
+    """
+    if not hasattr(cls, '__abstractmethods__'):
+        # We check for __abstractmethods__ here because cls might by a C
+        # implementation or a python implementation (especially during
+        # testing), and we want to handle both cases.
+        return cls
+
+    abstracts = set()
+    # Check the existing abstract methods of the parents, keep only the ones
+    # that are not implemented.
+    for scls in cls.__bases__:
+        for name in getattr(scls, '__abstractmethods__', ()):
+            value = getattr(cls, name, None)
+            if getattr(value, "__isabstractmethod__", False):
+                abstracts.add(name)
+    # Also add any other newly added abstract methods.
+    for name, value in cls.__dict__.items():
+        if getattr(value, "__isabstractmethod__", False):
+            abstracts.add(name)
+    cls.__abstractmethods__ = frozenset(abstracts)
+    return cls
+
+
 class ABC(metaclass=ABCMeta):
     """Helper class that provides a standard way to create an ABC using
     inheritance.
diff --git a/Lib/argparse.py b/Lib/argparse.py
index 2fb1da5..2c0dd85 100644
--- a/Lib/argparse.py
+++ b/Lib/argparse.py
@@ -392,6 +392,9 @@
         group_actions = set()
         inserts = {}
         for group in groups:
+            if not group._group_actions:
+                raise ValueError(f'empty group {group}')
+
             try:
                 start = actions.index(group._group_actions[0])
             except ValueError:
@@ -526,12 +529,13 @@
         parts = [action_header]
 
         # if there was help for the action, add lines of help text
-        if action.help:
+        if action.help and action.help.strip():
             help_text = self._expand_help(action)
-            help_lines = self._split_lines(help_text, help_width)
-            parts.append('%*s%s\n' % (indent_first, '', help_lines[0]))
-            for line in help_lines[1:]:
-                parts.append('%*s%s\n' % (help_position, '', line))
+            if help_text:
+                help_lines = self._split_lines(help_text, help_width)
+                parts.append('%*s%s\n' % (indent_first, '', help_lines[0]))
+                for line in help_lines[1:]:
+                    parts.append('%*s%s\n' % (help_position, '', line))
 
         # or add a newline if the description doesn't end with one
         elif not action_header.endswith('\n'):
@@ -722,11 +726,13 @@
     if argument is None:
         return None
     elif argument.option_strings:
-        return  '/'.join(argument.option_strings)
+        return '/'.join(argument.option_strings)
     elif argument.metavar not in (None, SUPPRESS):
         return argument.metavar
     elif argument.dest not in (None, SUPPRESS):
         return argument.dest
+    elif argument.choices:
+        return '{' + ','.join(argument.choices) + '}'
     else:
         return None
 
@@ -872,8 +878,8 @@
                 option_string = '--no-' + option_string[2:]
                 _option_strings.append(option_string)
 
-        if help is not None and default is not None:
-            help += f" (default: {default})"
+        if help is not None and default is not None and default is not SUPPRESS:
+            help += " (default: %(default)s)"
 
         super().__init__(
             option_strings=_option_strings,
@@ -1250,9 +1256,9 @@
         # the special argument "-" means sys.std{in,out}
         if string == '-':
             if 'r' in self._mode:
-                return _sys.stdin
-            elif 'w' in self._mode:
-                return _sys.stdout
+                return _sys.stdin.buffer if 'b' in self._mode else _sys.stdin
+            elif any(c in self._mode for c in 'wax'):
+                return _sys.stdout.buffer if 'b' in self._mode else _sys.stdout
             else:
                 msg = _('argument "-" with mode %r') % self._mode
                 raise ValueError(msg)
@@ -1666,7 +1672,8 @@
     """Object for parsing command line strings into Python objects.
 
     Keyword Arguments:
-        - prog -- The name of the program (default: sys.argv[0])
+        - prog -- The name of the program (default:
+            ``os.path.basename(sys.argv[0])``)
         - usage -- A usage message (default: auto-generated from arguments)
         - description -- A description of what the program does
         - epilog -- Text following the argument descriptions
@@ -1719,7 +1726,7 @@
 
         add_group = self.add_argument_group
         self._positionals = add_group(_('positional arguments'))
-        self._optionals = add_group(_('optional arguments'))
+        self._optionals = add_group(_('options'))
         self._subparsers = None
 
         # register types
diff --git a/Lib/ast.py b/Lib/ast.py
index ecd4895..f4d2f6e 100644
--- a/Lib/ast.py
+++ b/Lib/ast.py
@@ -59,11 +59,14 @@
     sets, booleans, and None.
     """
     if isinstance(node_or_string, str):
-        node_or_string = parse(node_or_string, mode='eval')
+        node_or_string = parse(node_or_string.lstrip(" \t"), mode='eval')
     if isinstance(node_or_string, Expression):
         node_or_string = node_or_string.body
     def _raise_malformed_node(node):
-        raise ValueError(f'malformed node or string: {node!r}')
+        msg = "malformed node or string"
+        if lno := getattr(node, 'lineno', None):
+            msg += f' on line {lno}'
+        raise ValueError(msg + f': {node!r}')
     def _convert_num(node):
         if not isinstance(node, Constant) or type(node.value) not in (int, float, complex):
             _raise_malformed_node(node)
@@ -794,6 +797,9 @@
         else:
             super().visit(node)
 
+    # Note: as visit() resets the output text, do NOT rely on
+    # NodeVisitor.generic_visit to handle any nodes (as it calls back in to
+    # the subclass visit() method, which resets self._source to an empty list)
     def visit(self, node):
         """Outputs a source code string that, if converted back to an ast
         (using ast.parse) will generate an AST equivalent to *node*"""
@@ -1196,8 +1202,13 @@
 
     def _write_constant(self, value):
         if isinstance(value, (float, complex)):
-            # Substitute overflowing decimal literal for AST infinities.
-            self.write(repr(value).replace("inf", _INFSTR))
+            # Substitute overflowing decimal literal for AST infinities,
+            # and inf - inf for NaNs.
+            self.write(
+                repr(value)
+                .replace("inf", _INFSTR)
+                .replace("nan", f"({_INFSTR}-{_INFSTR})")
+            )
         elif self._avoid_backslashes and isinstance(value, str):
             self._write_str_avoiding_backslashes(value)
         else:
@@ -1270,10 +1281,13 @@
             self.traverse(node.orelse)
 
     def visit_Set(self, node):
-        if not node.elts:
-            raise ValueError("Set node should have at least one item")
-        with self.delimit("{", "}"):
-            self.interleave(lambda: self.write(", "), self.traverse, node.elts)
+        if node.elts:
+            with self.delimit("{", "}"):
+                self.interleave(lambda: self.write(", "), self.traverse, node.elts)
+        else:
+            # `{}` would be interpreted as a dictionary literal, and
+            # `set` might be shadowed. Thus:
+            self.write('{*()}')
 
     def visit_Dict(self, node):
         def write_key_value_pair(k, v):
@@ -1440,9 +1454,9 @@
 
     def visit_Subscript(self, node):
         def is_simple_tuple(slice_value):
-            # when unparsing a non-empty tuple, the parantheses can be safely
+            # when unparsing a non-empty tuple, the parentheses can be safely
             # omitted if there aren't any elements that explicitly requires
-            # parantheses (such as starred expressions).
+            # parentheses (such as starred expressions).
             return (
                 isinstance(slice_value, Tuple)
                 and slice_value.elts
@@ -1475,6 +1489,13 @@
             self.write(":")
             self.traverse(node.step)
 
+    def visit_Match(self, node):
+        self.fill("match ")
+        self.traverse(node.subject)
+        with self.block():
+            for case in node.cases:
+                self.traverse(case)
+
     def visit_arg(self, node):
         self.write(node.arg)
         if node.annotation:
@@ -1559,6 +1580,94 @@
             self.write(" as ")
             self.traverse(node.optional_vars)
 
+    def visit_match_case(self, node):
+        self.fill("case ")
+        self.traverse(node.pattern)
+        if node.guard:
+            self.write(" if ")
+            self.traverse(node.guard)
+        with self.block():
+            self.traverse(node.body)
+
+    def visit_MatchValue(self, node):
+        self.traverse(node.value)
+
+    def visit_MatchSingleton(self, node):
+        self._write_constant(node.value)
+
+    def visit_MatchSequence(self, node):
+        with self.delimit("[", "]"):
+            self.interleave(
+                lambda: self.write(", "), self.traverse, node.patterns
+            )
+
+    def visit_MatchStar(self, node):
+        name = node.name
+        if name is None:
+            name = "_"
+        self.write(f"*{name}")
+
+    def visit_MatchMapping(self, node):
+        def write_key_pattern_pair(pair):
+            k, p = pair
+            self.traverse(k)
+            self.write(": ")
+            self.traverse(p)
+
+        with self.delimit("{", "}"):
+            keys = node.keys
+            self.interleave(
+                lambda: self.write(", "),
+                write_key_pattern_pair,
+                zip(keys, node.patterns, strict=True),
+            )
+            rest = node.rest
+            if rest is not None:
+                if keys:
+                    self.write(", ")
+                self.write(f"**{rest}")
+
+    def visit_MatchClass(self, node):
+        self.set_precedence(_Precedence.ATOM, node.cls)
+        self.traverse(node.cls)
+        with self.delimit("(", ")"):
+            patterns = node.patterns
+            self.interleave(
+                lambda: self.write(", "), self.traverse, patterns
+            )
+            attrs = node.kwd_attrs
+            if attrs:
+                def write_attr_pattern(pair):
+                    attr, pattern = pair
+                    self.write(f"{attr}=")
+                    self.traverse(pattern)
+
+                if patterns:
+                    self.write(", ")
+                self.interleave(
+                    lambda: self.write(", "),
+                    write_attr_pattern,
+                    zip(attrs, node.kwd_patterns, strict=True),
+                )
+
+    def visit_MatchAs(self, node):
+        name = node.name
+        pattern = node.pattern
+        if name is None:
+            self.write("_")
+        elif pattern is None:
+            self.write(node.name)
+        else:
+            with self.require_parens(_Precedence.TEST, node):
+                self.set_precedence(_Precedence.BOR, node.pattern)
+                self.traverse(node.pattern)
+                self.write(f" as {node.name}")
+
+    def visit_MatchOr(self, node):
+        with self.require_parens(_Precedence.BOR, node):
+            self.set_precedence(_Precedence.BOR.next(), *node.patterns)
+            self.interleave(lambda: self.write(" | "), self.traverse, node.patterns)
+
 def unparse(ast_obj):
     unparser = _Unparser()
     return unparser.visit(ast_obj)
diff --git a/Lib/asynchat.py b/Lib/asynchat.py
index f4ba361..de26ffa 100644
--- a/Lib/asynchat.py
+++ b/Lib/asynchat.py
@@ -48,6 +48,14 @@
 import asyncore
 from collections import deque
 
+from warnings import warn
+warn(
+    'The asynchat module is deprecated. '
+    'The recommended replacement is asyncio',
+    DeprecationWarning,
+    stacklevel=2)
+
+
 
 class async_chat(asyncore.dispatcher):
     """This is an abstract class.  You must derive from this class, and add
diff --git a/Lib/asyncio/__init__.py b/Lib/asyncio/__init__.py
index eb84bfb..200b14c 100644
--- a/Lib/asyncio/__init__.py
+++ b/Lib/asyncio/__init__.py
@@ -20,10 +20,6 @@
 from .threads import *
 from .transports import *
 
-# Exposed for _asynciomodule.c to implement now deprecated
-# Task.all_tasks() method.  This function will be removed in 3.9.
-from .tasks import _all_tasks_compat  # NoQA
-
 __all__ = (base_events.__all__ +
            coroutines.__all__ +
            events.__all__ +
diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py
index b2d446a..952da11 100644
--- a/Lib/asyncio/base_events.py
+++ b/Lib/asyncio/base_events.py
@@ -49,7 +49,7 @@
 from .log import logger
 
 
-__all__ = 'BaseEventLoop',
+__all__ = 'BaseEventLoop','Server',
 
 
 # Minimum number of _scheduled timer handles before cleanup of
@@ -202,6 +202,11 @@
         pass
 
 
+def _check_ssl_socket(sock):
+    if ssl is not None and isinstance(sock, ssl.SSLSocket):
+        raise TypeError("Socket cannot be of type SSLSocket")
+
+
 class _SendfileFallbackProtocol(protocols.Protocol):
     def __init__(self, transp):
         if not isinstance(transp, transports._FlowControlMixin):
@@ -350,7 +355,7 @@
         self._start_serving()
         # Skip one loop iteration so that all 'loop.add_reader'
         # go through.
-        await tasks.sleep(0, loop=self._loop)
+        await tasks.sleep(0)
 
     async def serve_forever(self):
         if self._serving_forever_fut is not None:
@@ -541,8 +546,7 @@
 
         results = await tasks.gather(
             *[ag.aclose() for ag in closing_agens],
-            return_exceptions=True,
-            loop=self)
+            return_exceptions=True)
 
         for result, agen in zip(results, closing_agens):
             if isinstance(result, Exception):
@@ -864,6 +868,7 @@
                             *, fallback=True):
         if self._debug and sock.gettimeout() != 0:
             raise ValueError("the socket must be non-blocking")
+        _check_ssl_socket(sock)
         self._check_sendfile_params(sock, file, offset, count)
         try:
             return await self._sock_sendfile_native(sock, file,
@@ -973,7 +978,7 @@
             happy_eyeballs_delay=None, interleave=None):
         """Connect to a TCP server.
 
-        Create a streaming transport connection to a given Internet host and
+        Create a streaming transport connection to a given internet host and
         port: socket family AF_INET or socket.AF_INET6 depending on host (or
         family if specified), socket type SOCK_STREAM. protocol_factory must be
         a callable returning a protocol instance.
@@ -1005,6 +1010,9 @@
             raise ValueError(
                 'ssl_handshake_timeout is only meaningful with ssl')
 
+        if sock is not None:
+            _check_ssl_socket(sock)
+
         if happy_eyeballs_delay is not None and interleave is None:
             # If using happy eyeballs, default to interleave addresses by family
             interleave = 1
@@ -1438,6 +1446,9 @@
             raise ValueError(
                 'ssl_handshake_timeout is only meaningful with ssl')
 
+        if sock is not None:
+            _check_ssl_socket(sock)
+
         if host is not None or port is not None:
             if sock is not None:
                 raise ValueError(
@@ -1457,7 +1468,7 @@
             fs = [self._create_server_getaddrinfo(host, port, family=family,
                                                   flags=flags)
                   for host in hosts]
-            infos = await tasks.gather(*fs, loop=self)
+            infos = await tasks.gather(*fs)
             infos = set(itertools.chain.from_iterable(infos))
 
             completed = False
@@ -1515,7 +1526,7 @@
             server._start_serving()
             # Skip one loop iteration so that all 'loop.add_reader'
             # go through.
-            await tasks.sleep(0, loop=self)
+            await tasks.sleep(0)
 
         if self._debug:
             logger.info("%r is serving", server)
@@ -1525,14 +1536,6 @@
             self, protocol_factory, sock,
             *, ssl=None,
             ssl_handshake_timeout=None):
-        """Handle an accepted connection.
-
-        This is used by servers that accept connections outside of
-        asyncio but that use asyncio to handle connections.
-
-        This method is a coroutine.  When completed, the coroutine
-        returns a (transport, protocol) pair.
-        """
         if sock.type != socket.SOCK_STREAM:
             raise ValueError(f'A Stream Socket was expected, got {sock!r}')
 
@@ -1540,6 +1543,9 @@
             raise ValueError(
                 'ssl_handshake_timeout is only meaningful with ssl')
 
+        if sock is not None:
+            _check_ssl_socket(sock)
+
         transport, protocol = await self._create_connection_transport(
             sock, protocol_factory, ssl, '', server_side=True,
             ssl_handshake_timeout=ssl_handshake_timeout)
diff --git a/Lib/asyncio/events.py b/Lib/asyncio/events.py
index 0dce87b..5ab1acc 100644
--- a/Lib/asyncio/events.py
+++ b/Lib/asyncio/events.py
@@ -258,13 +258,13 @@
         """Notification that a TimerHandle has been cancelled."""
         raise NotImplementedError
 
-    def call_soon(self, callback, *args):
-        return self.call_later(0, callback, *args)
+    def call_soon(self, callback, *args, context=None):
+        return self.call_later(0, callback, *args, context=context)
 
-    def call_later(self, delay, callback, *args):
+    def call_later(self, delay, callback, *args, context=None):
         raise NotImplementedError
 
-    def call_at(self, when, callback, *args):
+    def call_at(self, when, callback, *args, context=None):
         raise NotImplementedError
 
     def time(self):
@@ -280,7 +280,7 @@
 
     # Methods for interacting with threads.
 
-    def call_soon_threadsafe(self, callback, *args):
+    def call_soon_threadsafe(self, callback, *args, context=None):
         raise NotImplementedError
 
     def run_in_executor(self, executor, func, *args):
@@ -418,6 +418,20 @@
         """
         raise NotImplementedError
 
+    async def connect_accepted_socket(
+            self, protocol_factory, sock,
+            *, ssl=None,
+            ssl_handshake_timeout=None):
+        """Handle an accepted connection.
+
+        This is used by servers that accept connections outside of
+        asyncio, but use asyncio to handle connections.
+
+        This method is a coroutine.  When completed, the coroutine
+        returns a (transport, protocol) pair.
+        """
+        raise NotImplementedError
+
     async def create_datagram_endpoint(self, protocol_factory,
                                        local_addr=None, remote_addr=None, *,
                                        family=0, proto=0, flags=0,
@@ -465,7 +479,7 @@
         # The reason to accept file-like object instead of just file descriptor
         # is: we need to own pipe and close it at transport finishing
         # Can got complicated errors if pass f.fileno(),
-        # close fd in pipe transport then close f and vise versa.
+        # close fd in pipe transport then close f and vice versa.
         raise NotImplementedError
 
     async def connect_write_pipe(self, protocol_factory, pipe):
@@ -478,7 +492,7 @@
         # The reason to accept file-like object instead of just file descriptor
         # is: we need to own pipe and close it at transport finishing
         # Can got complicated errors if pass f.fileno(),
-        # close fd in pipe transport then close f and vise versa.
+        # close fd in pipe transport then close f and vice versa.
         raise NotImplementedError
 
     async def subprocess_shell(self, protocol_factory, cmd, *,
@@ -745,9 +759,16 @@
     the result of `get_event_loop_policy().get_event_loop()` call.
     """
     # NOTE: this function is implemented in C (see _asynciomodule.c)
+    return _py__get_event_loop()
+
+
+def _get_event_loop(stacklevel=3):
     current_loop = _get_running_loop()
     if current_loop is not None:
         return current_loop
+    import warnings
+    warnings.warn('There is no current event loop',
+                  DeprecationWarning, stacklevel=stacklevel)
     return get_event_loop_policy().get_event_loop()
 
 
@@ -777,6 +798,7 @@
 _py__set_running_loop = _set_running_loop
 _py_get_running_loop = get_running_loop
 _py_get_event_loop = get_event_loop
+_py__get_event_loop = _get_event_loop
 
 
 try:
@@ -784,7 +806,7 @@
     # functions in asyncio.  Pure Python implementation is
     # about 4 times slower than C-accelerated.
     from _asyncio import (_get_running_loop, _set_running_loop,
-                          get_running_loop, get_event_loop)
+                          get_running_loop, get_event_loop, _get_event_loop)
 except ImportError:
     pass
 else:
@@ -793,3 +815,4 @@
     _c__set_running_loop = _set_running_loop
     _c_get_running_loop = get_running_loop
     _c_get_event_loop = get_event_loop
+    _c__get_event_loop = _get_event_loop
diff --git a/Lib/asyncio/futures.py b/Lib/asyncio/futures.py
index bed4da5..8e8cd87 100644
--- a/Lib/asyncio/futures.py
+++ b/Lib/asyncio/futures.py
@@ -8,6 +8,7 @@
 import contextvars
 import logging
 import sys
+from types import GenericAlias
 
 from . import base_futures
 from . import events
@@ -76,7 +77,7 @@
         the default event loop.
         """
         if loop is None:
-            self._loop = events.get_event_loop()
+            self._loop = events._get_event_loop()
         else:
             self._loop = loop
         self._callbacks = []
@@ -106,8 +107,7 @@
             context['source_traceback'] = self._source_traceback
         self._loop.call_exception_handler(context)
 
-    def __class_getitem__(cls, type):
-        return cls
+    __class_getitem__ = classmethod(GenericAlias)
 
     @property
     def _log_traceback(self):
@@ -115,7 +115,7 @@
 
     @_log_traceback.setter
     def _log_traceback(self, val):
-        if bool(val):
+        if val:
             raise ValueError('_log_traceback can only be set to False')
         self.__log_traceback = False
 
@@ -408,7 +408,7 @@
     assert isinstance(future, concurrent.futures.Future), \
         f'concurrent.futures.Future is expected, got {future!r}'
     if loop is None:
-        loop = events.get_event_loop()
+        loop = events._get_event_loop()
     new_future = loop.create_future()
     _chain_future(future, new_future)
     return new_future
diff --git a/Lib/asyncio/locks.py b/Lib/asyncio/locks.py
index f1ce732..4fef64e 100644
--- a/Lib/asyncio/locks.py
+++ b/Lib/asyncio/locks.py
@@ -3,10 +3,9 @@
 __all__ = ('Lock', 'Event', 'Condition', 'Semaphore', 'BoundedSemaphore')
 
 import collections
-import warnings
 
-from . import events
 from . import exceptions
+from . import mixins
 
 
 class _ContextManagerMixin:
@@ -20,7 +19,7 @@
         self.release()
 
 
-class Lock(_ContextManagerMixin):
+class Lock(_ContextManagerMixin, mixins._LoopBoundMixin):
     """Primitive lock objects.
 
     A primitive lock is a synchronization primitive that is not owned
@@ -74,16 +73,10 @@
 
     """
 
-    def __init__(self, *, loop=None):
+    def __init__(self, *, loop=mixins._marker):
+        super().__init__(loop=loop)
         self._waiters = None
         self._locked = False
-        if loop is None:
-            self._loop = events.get_event_loop()
-        else:
-            self._loop = loop
-            warnings.warn("The loop argument is deprecated since Python 3.8, "
-                          "and scheduled for removal in Python 3.10.",
-                          DeprecationWarning, stacklevel=2)
 
     def __repr__(self):
         res = super().__repr__()
@@ -109,7 +102,7 @@
 
         if self._waiters is None:
             self._waiters = collections.deque()
-        fut = self._loop.create_future()
+        fut = self._get_loop().create_future()
         self._waiters.append(fut)
 
         # Finally block should be called before the CancelledError
@@ -161,7 +154,7 @@
             fut.set_result(True)
 
 
-class Event:
+class Event(mixins._LoopBoundMixin):
     """Asynchronous equivalent to threading.Event.
 
     Class implementing event objects. An event manages a flag that can be set
@@ -170,16 +163,10 @@
     false.
     """
 
-    def __init__(self, *, loop=None):
+    def __init__(self, *, loop=mixins._marker):
+        super().__init__(loop=loop)
         self._waiters = collections.deque()
         self._value = False
-        if loop is None:
-            self._loop = events.get_event_loop()
-        else:
-            self._loop = loop
-            warnings.warn("The loop argument is deprecated since Python 3.8, "
-                          "and scheduled for removal in Python 3.10.",
-                          DeprecationWarning, stacklevel=2)
 
     def __repr__(self):
         res = super().__repr__()
@@ -220,7 +207,7 @@
         if self._value:
             return True
 
-        fut = self._loop.create_future()
+        fut = self._get_loop().create_future()
         self._waiters.append(fut)
         try:
             await fut
@@ -229,7 +216,7 @@
             self._waiters.remove(fut)
 
 
-class Condition(_ContextManagerMixin):
+class Condition(_ContextManagerMixin, mixins._LoopBoundMixin):
     """Asynchronous equivalent to threading.Condition.
 
     This class implements condition variable objects. A condition variable
@@ -239,19 +226,10 @@
     A new Lock object is created and used as the underlying lock.
     """
 
-    def __init__(self, lock=None, *, loop=None):
-        if loop is None:
-            self._loop = events.get_event_loop()
-        else:
-            self._loop = loop
-            warnings.warn("The loop argument is deprecated since Python 3.8, "
-                          "and scheduled for removal in Python 3.10.",
-                          DeprecationWarning, stacklevel=2)
-
+    def __init__(self, lock=None, *, loop=mixins._marker):
+        super().__init__(loop=loop)
         if lock is None:
-            lock = Lock(loop=loop)
-        elif lock._loop is not self._loop:
-            raise ValueError("loop argument must agree with lock")
+            lock = Lock()
 
         self._lock = lock
         # Export the lock's locked(), acquire() and release() methods.
@@ -284,7 +262,7 @@
 
         self.release()
         try:
-            fut = self._loop.create_future()
+            fut = self._get_loop().create_future()
             self._waiters.append(fut)
             try:
                 await fut
@@ -351,7 +329,7 @@
         self.notify(len(self._waiters))
 
 
-class Semaphore(_ContextManagerMixin):
+class Semaphore(_ContextManagerMixin, mixins._LoopBoundMixin):
     """A Semaphore implementation.
 
     A semaphore manages an internal counter which is decremented by each
@@ -366,18 +344,12 @@
     ValueError is raised.
     """
 
-    def __init__(self, value=1, *, loop=None):
+    def __init__(self, value=1, *, loop=mixins._marker):
+        super().__init__(loop=loop)
         if value < 0:
             raise ValueError("Semaphore initial value must be >= 0")
         self._value = value
         self._waiters = collections.deque()
-        if loop is None:
-            self._loop = events.get_event_loop()
-        else:
-            self._loop = loop
-            warnings.warn("The loop argument is deprecated since Python 3.8, "
-                          "and scheduled for removal in Python 3.10.",
-                          DeprecationWarning, stacklevel=2)
 
     def __repr__(self):
         res = super().__repr__()
@@ -407,7 +379,7 @@
         True.
         """
         while self._value <= 0:
-            fut = self._loop.create_future()
+            fut = self._get_loop().create_future()
             self._waiters.append(fut)
             try:
                 await fut
@@ -436,12 +408,7 @@
     above the initial value.
     """
 
-    def __init__(self, value=1, *, loop=None):
-        if loop:
-            warnings.warn("The loop argument is deprecated since Python 3.8, "
-                          "and scheduled for removal in Python 3.10.",
-                          DeprecationWarning, stacklevel=2)
-
+    def __init__(self, value=1, *, loop=mixins._marker):
         self._bound_value = value
         super().__init__(value, loop=loop)
 
diff --git a/Lib/asyncio/mixins.py b/Lib/asyncio/mixins.py
new file mode 100644
index 0000000..650df05
--- /dev/null
+++ b/Lib/asyncio/mixins.py
@@ -0,0 +1,31 @@
+"""Event loop mixins."""
+
+import threading
+from . import events
+
+_global_lock = threading.Lock()
+
+# Used as a sentinel for loop parameter
+_marker = object()
+
+
+class _LoopBoundMixin:
+    _loop = None
+
+    def __init__(self, *, loop=_marker):
+        if loop is not _marker:
+            raise TypeError(
+                f'As of 3.10, the *loop* parameter was removed from '
+                f'{type(self).__name__}() since it is no longer necessary'
+            )
+
+    def _get_loop(self):
+        loop = events._get_running_loop()
+
+        if self._loop is None:
+            with _global_lock:
+                if self._loop is None:
+                    self._loop = loop
+        if loop is not self._loop:
+            raise RuntimeError(f'{self!r} is bound to a different event loop')
+        return loop
diff --git a/Lib/asyncio/proactor_events.py b/Lib/asyncio/proactor_events.py
index b4cd414..411685b 100644
--- a/Lib/asyncio/proactor_events.py
+++ b/Lib/asyncio/proactor_events.py
@@ -158,7 +158,7 @@
             # end then it may fail with ERROR_NETNAME_DELETED if we
             # just close our end.  First calling shutdown() seems to
             # cure it, but maybe using DisconnectEx() would be better.
-            if hasattr(self._sock, 'shutdown'):
+            if hasattr(self._sock, 'shutdown') and self._sock.fileno() != -1:
                 self._sock.shutdown(socket.SHUT_RDWR)
             self._sock.close()
             self._sock = None
@@ -179,11 +179,12 @@
     """Transport for read pipes."""
 
     def __init__(self, loop, sock, protocol, waiter=None,
-                 extra=None, server=None):
-        self._pending_data = None
+                 extra=None, server=None, buffer_size=65536):
+        self._pending_data_length = -1
         self._paused = True
         super().__init__(loop, sock, protocol, waiter, extra, server)
 
+        self._data = bytearray(buffer_size)
         self._loop.call_soon(self._loop_reading)
         self._paused = False
 
@@ -217,12 +218,12 @@
         if self._read_fut is None:
             self._loop.call_soon(self._loop_reading, None)
 
-        data = self._pending_data
-        self._pending_data = None
-        if data is not None:
+        length = self._pending_data_length
+        self._pending_data_length = -1
+        if length > -1:
             # Call the protocol methode after calling _loop_reading(),
             # since the protocol can decide to pause reading again.
-            self._loop.call_soon(self._data_received, data)
+            self._loop.call_soon(self._data_received, self._data[:length], length)
 
         if self._loop.get_debug():
             logger.debug("%r resumes reading", self)
@@ -243,15 +244,15 @@
         if not keep_open:
             self.close()
 
-    def _data_received(self, data):
+    def _data_received(self, data, length):
         if self._paused:
             # Don't call any protocol method while reading is paused.
             # The protocol will be called on resume_reading().
-            assert self._pending_data is None
-            self._pending_data = data
+            assert self._pending_data_length == -1
+            self._pending_data_length = length
             return
 
-        if not data:
+        if length == 0:
             self._eof_received()
             return
 
@@ -269,6 +270,7 @@
             self._protocol.data_received(data)
 
     def _loop_reading(self, fut=None):
+        length = -1
         data = None
         try:
             if fut is not None:
@@ -277,18 +279,18 @@
                 self._read_fut = None
                 if fut.done():
                     # deliver data later in "finally" clause
-                    data = fut.result()
+                    length = fut.result()
+                    if length == 0:
+                        # we got end-of-file so no need to reschedule a new read
+                        return
+
+                    data = self._data[:length]
                 else:
                     # the future will be replaced by next proactor.recv call
                     fut.cancel()
 
             if self._closing:
                 # since close() has been called we ignore any read data
-                data = None
-                return
-
-            if data == b'':
-                # we got end-of-file so no need to reschedule a new read
                 return
 
             # bpo-33694: buffer_updated() has currently no fast path because of
@@ -296,7 +298,7 @@
 
             if not self._paused:
                 # reschedule a new read
-                self._read_fut = self._loop._proactor.recv(self._sock, 32768)
+                self._read_fut = self._loop._proactor.recv_into(self._sock, self._data)
         except ConnectionAbortedError as exc:
             if not self._closing:
                 self._fatal_error(exc, 'Fatal read error on pipe transport')
@@ -314,8 +316,8 @@
             if not self._paused:
                 self._read_fut.add_done_callback(self._loop_reading)
         finally:
-            if data is not None:
-                self._data_received(data)
+            if length > -1:
+                self._data_received(data, length)
 
 
 class _ProactorBaseWritePipeTransport(_ProactorBasePipeTransport,
@@ -450,7 +452,8 @@
             self.close()
 
 
-class _ProactorDatagramTransport(_ProactorBasePipeTransport):
+class _ProactorDatagramTransport(_ProactorBasePipeTransport,
+                                 transports.DatagramTransport):
     max_size = 256 * 1024
     def __init__(self, loop, sock, protocol, address=None,
                  waiter=None, extra=None):
diff --git a/Lib/asyncio/protocols.py b/Lib/asyncio/protocols.py
index 69fa43e..09987b1 100644
--- a/Lib/asyncio/protocols.py
+++ b/Lib/asyncio/protocols.py
@@ -109,10 +109,6 @@
 class BufferedProtocol(BaseProtocol):
     """Interface for stream protocol with manual buffer control.
 
-    Important: this has been added to asyncio in Python 3.7
-    *on a provisional basis*!  Consider it as an experimental API that
-    might be changed or removed in Python 3.8.
-
     Event methods, such as `create_server` and `create_connection`,
     accept factories that return protocols that implement this interface.
 
diff --git a/Lib/asyncio/queues.py b/Lib/asyncio/queues.py
index cd3f7c6..10dd689 100644
--- a/Lib/asyncio/queues.py
+++ b/Lib/asyncio/queues.py
@@ -2,10 +2,10 @@
 
 import collections
 import heapq
-import warnings
+from types import GenericAlias
 
-from . import events
 from . import locks
+from . import mixins
 
 
 class QueueEmpty(Exception):
@@ -18,7 +18,7 @@
     pass
 
 
-class Queue:
+class Queue(mixins._LoopBoundMixin):
     """A queue, useful for coordinating producer and consumer coroutines.
 
     If maxsize is less than or equal to zero, the queue size is infinite. If it
@@ -30,14 +30,8 @@
     interrupted between calling qsize() and doing an operation on the Queue.
     """
 
-    def __init__(self, maxsize=0, *, loop=None):
-        if loop is None:
-            self._loop = events.get_event_loop()
-        else:
-            self._loop = loop
-            warnings.warn("The loop argument is deprecated since Python 3.8, "
-                          "and scheduled for removal in Python 3.10.",
-                          DeprecationWarning, stacklevel=2)
+    def __init__(self, maxsize=0, *, loop=mixins._marker):
+        super().__init__(loop=loop)
         self._maxsize = maxsize
 
         # Futures.
@@ -45,7 +39,7 @@
         # Futures.
         self._putters = collections.deque()
         self._unfinished_tasks = 0
-        self._finished = locks.Event(loop=loop)
+        self._finished = locks.Event()
         self._finished.set()
         self._init(maxsize)
 
@@ -76,8 +70,7 @@
     def __str__(self):
         return f'<{type(self).__name__} {self._format()}>'
 
-    def __class_getitem__(cls, type):
-        return cls
+    __class_getitem__ = classmethod(GenericAlias)
 
     def _format(self):
         result = f'maxsize={self._maxsize!r}'
@@ -122,7 +115,7 @@
         slot is available before adding item.
         """
         while self.full():
-            putter = self._loop.create_future()
+            putter = self._get_loop().create_future()
             self._putters.append(putter)
             try:
                 await putter
@@ -160,7 +153,7 @@
         If queue is empty, wait until an item is available.
         """
         while self.empty():
-            getter = self._loop.create_future()
+            getter = self._get_loop().create_future()
             self._getters.append(getter)
             try:
                 await getter
diff --git a/Lib/asyncio/runners.py b/Lib/asyncio/runners.py
index 268635d..9a5e9a4 100644
--- a/Lib/asyncio/runners.py
+++ b/Lib/asyncio/runners.py
@@ -60,8 +60,7 @@
     for task in to_cancel:
         task.cancel()
 
-    loop.run_until_complete(
-        tasks.gather(*to_cancel, loop=loop, return_exceptions=True))
+    loop.run_until_complete(tasks.gather(*to_cancel, return_exceptions=True))
 
     for task in to_cancel:
         if task.cancelled():
diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py
index 59cb6b1..71080b8 100644
--- a/Lib/asyncio/selector_events.py
+++ b/Lib/asyncio/selector_events.py
@@ -40,11 +40,6 @@
         return bool(key.events & event)
 
 
-def _check_ssl_socket(sock):
-    if ssl is not None and isinstance(sock, ssl.SSLSocket):
-        raise TypeError("Socket cannot be of type SSLSocket")
-
-
 class BaseSelectorEventLoop(base_events.BaseEventLoop):
     """Selector event loop.
 
@@ -357,7 +352,7 @@
         The maximum amount of data to be received at once is specified by
         nbytes.
         """
-        _check_ssl_socket(sock)
+        base_events._check_ssl_socket(sock)
         if self._debug and sock.gettimeout() != 0:
             raise ValueError("the socket must be non-blocking")
         try:
@@ -398,7 +393,7 @@
         The received data is written into *buf* (a writable buffer).
         The return value is the number of bytes written.
         """
-        _check_ssl_socket(sock)
+        base_events._check_ssl_socket(sock)
         if self._debug and sock.gettimeout() != 0:
             raise ValueError("the socket must be non-blocking")
         try:
@@ -439,7 +434,7 @@
         raised, and there is no way to determine how much data, if any, was
         successfully processed by the receiving end of the connection.
         """
-        _check_ssl_socket(sock)
+        base_events._check_ssl_socket(sock)
         if self._debug and sock.gettimeout() != 0:
             raise ValueError("the socket must be non-blocking")
         try:
@@ -488,13 +483,15 @@
 
         This method is a coroutine.
         """
-        _check_ssl_socket(sock)
+        base_events._check_ssl_socket(sock)
         if self._debug and sock.gettimeout() != 0:
             raise ValueError("the socket must be non-blocking")
 
         if not hasattr(socket, 'AF_UNIX') or sock.family != socket.AF_UNIX:
             resolved = await self._ensure_resolved(
-                address, family=sock.family, proto=sock.proto, loop=self)
+                address, family=sock.family, type=sock.type, proto=sock.proto,
+                loop=self,
+            )
             _, _, _, _, address = resolved[0]
 
         fut = self.create_future()
@@ -553,7 +550,7 @@
         object usable to send and receive data on the connection, and address
         is the address bound to the socket on the other end of the connection.
         """
-        _check_ssl_socket(sock)
+        base_events._check_ssl_socket(sock)
         if self._debug and sock.gettimeout() != 0:
             raise ValueError("the socket must be non-blocking")
         fut = self.create_future()
diff --git a/Lib/asyncio/sslproto.py b/Lib/asyncio/sslproto.py
index cad25b2..00fc16c 100644
--- a/Lib/asyncio/sslproto.py
+++ b/Lib/asyncio/sslproto.py
@@ -367,6 +367,12 @@
         """Return the current size of the write buffer."""
         return self._ssl_protocol._transport.get_write_buffer_size()
 
+    def get_write_buffer_limits(self):
+        """Get the high and low watermarks for write flow control. 
+        Return a tuple (low, high) where low and high are 
+        positive number of bytes."""
+        return self._ssl_protocol._transport.get_write_buffer_limits()
+
     @property
     def _protocol_paused(self):
         # Required for sendfile fallback pause_writing/resume_writing logic
diff --git a/Lib/asyncio/streams.py b/Lib/asyncio/streams.py
index 3c80bb8..080d8a6 100644
--- a/Lib/asyncio/streams.py
+++ b/Lib/asyncio/streams.py
@@ -23,7 +23,7 @@
 
 
 async def open_connection(host=None, port=None, *,
-                          loop=None, limit=_DEFAULT_LIMIT, **kwds):
+                          limit=_DEFAULT_LIMIT, **kwds):
     """A wrapper for create_connection() returning a (reader, writer) pair.
 
     The reader returned is a StreamReader instance; the writer is a
@@ -41,12 +41,7 @@
     StreamReaderProtocol classes, just copy the code -- there's
     really nothing special here except some convenience.)
     """
-    if loop is None:
-        loop = events.get_event_loop()
-    else:
-        warnings.warn("The loop argument is deprecated since Python 3.8, "
-                      "and scheduled for removal in Python 3.10.",
-                      DeprecationWarning, stacklevel=2)
+    loop = events.get_running_loop()
     reader = StreamReader(limit=limit, loop=loop)
     protocol = StreamReaderProtocol(reader, loop=loop)
     transport, _ = await loop.create_connection(
@@ -56,7 +51,7 @@
 
 
 async def start_server(client_connected_cb, host=None, port=None, *,
-                       loop=None, limit=_DEFAULT_LIMIT, **kwds):
+                       limit=_DEFAULT_LIMIT, **kwds):
     """Start a socket server, call back for each client connected.
 
     The first parameter, `client_connected_cb`, takes two parameters:
@@ -78,12 +73,7 @@
     The return value is the same as loop.create_server(), i.e. a
     Server object which can be used to stop the service.
     """
-    if loop is None:
-        loop = events.get_event_loop()
-    else:
-        warnings.warn("The loop argument is deprecated since Python 3.8, "
-                      "and scheduled for removal in Python 3.10.",
-                      DeprecationWarning, stacklevel=2)
+    loop = events.get_running_loop()
 
     def factory():
         reader = StreamReader(limit=limit, loop=loop)
@@ -98,14 +88,10 @@
     # UNIX Domain Sockets are supported on this platform
 
     async def open_unix_connection(path=None, *,
-                                   loop=None, limit=_DEFAULT_LIMIT, **kwds):
+                                   limit=_DEFAULT_LIMIT, **kwds):
         """Similar to `open_connection` but works with UNIX Domain Sockets."""
-        if loop is None:
-            loop = events.get_event_loop()
-        else:
-            warnings.warn("The loop argument is deprecated since Python 3.8, "
-                          "and scheduled for removal in Python 3.10.",
-                          DeprecationWarning, stacklevel=2)
+        loop = events.get_running_loop()
+
         reader = StreamReader(limit=limit, loop=loop)
         protocol = StreamReaderProtocol(reader, loop=loop)
         transport, _ = await loop.create_unix_connection(
@@ -114,14 +100,9 @@
         return reader, writer
 
     async def start_unix_server(client_connected_cb, path=None, *,
-                                loop=None, limit=_DEFAULT_LIMIT, **kwds):
+                                limit=_DEFAULT_LIMIT, **kwds):
         """Similar to `start_server` but works with UNIX Domain Sockets."""
-        if loop is None:
-            loop = events.get_event_loop()
-        else:
-            warnings.warn("The loop argument is deprecated since Python 3.8, "
-                          "and scheduled for removal in Python 3.10.",
-                          DeprecationWarning, stacklevel=2)
+        loop = events.get_running_loop()
 
         def factory():
             reader = StreamReader(limit=limit, loop=loop)
@@ -144,7 +125,7 @@
 
     def __init__(self, loop=None):
         if loop is None:
-            self._loop = events.get_event_loop()
+            self._loop = events._get_event_loop(stacklevel=4)
         else:
             self._loop = loop
         self._paused = False
@@ -302,9 +283,13 @@
     def __del__(self):
         # Prevent reports about unhandled exceptions.
         # Better than self._closed._log_traceback = False hack
-        closed = self._closed
-        if closed.done() and not closed.cancelled():
-            closed.exception()
+        try:
+            closed = self._closed
+        except AttributeError:
+            pass  # failed constructor
+        else:
+            if closed.done() and not closed.cancelled():
+                closed.exception()
 
 
 class StreamWriter:
@@ -400,7 +385,7 @@
 
         self._limit = limit
         if loop is None:
-            self._loop = events.get_event_loop()
+            self._loop = events._get_event_loop()
         else:
             self._loop = loop
         self._buffer = bytearray()
diff --git a/Lib/asyncio/subprocess.py b/Lib/asyncio/subprocess.py
index c9506b1..cd10231 100644
--- a/Lib/asyncio/subprocess.py
+++ b/Lib/asyncio/subprocess.py
@@ -1,7 +1,6 @@
 __all__ = 'create_subprocess_exec', 'create_subprocess_shell'
 
 import subprocess
-import warnings
 
 from . import events
 from . import protocols
@@ -193,24 +192,14 @@
             stderr = self._read_stream(2)
         else:
             stderr = self._noop()
-        stdin, stdout, stderr = await tasks.gather(stdin, stdout, stderr,
-                                                   loop=self._loop)
+        stdin, stdout, stderr = await tasks.gather(stdin, stdout, stderr)
         await self.wait()
         return (stdout, stderr)
 
 
 async def create_subprocess_shell(cmd, stdin=None, stdout=None, stderr=None,
-                                  loop=None, limit=streams._DEFAULT_LIMIT,
-                                  **kwds):
-    if loop is None:
-        loop = events.get_event_loop()
-    else:
-        warnings.warn("The loop argument is deprecated since Python 3.8 "
-                      "and scheduled for removal in Python 3.10.",
-                      DeprecationWarning,
-                      stacklevel=2
-        )
-
+                                  limit=streams._DEFAULT_LIMIT, **kwds):
+    loop = events.get_running_loop()
     protocol_factory = lambda: SubprocessStreamProtocol(limit=limit,
                                                         loop=loop)
     transport, protocol = await loop.subprocess_shell(
@@ -221,16 +210,9 @@
 
 
 async def create_subprocess_exec(program, *args, stdin=None, stdout=None,
-                                 stderr=None, loop=None,
-                                 limit=streams._DEFAULT_LIMIT, **kwds):
-    if loop is None:
-        loop = events.get_event_loop()
-    else:
-        warnings.warn("The loop argument is deprecated since Python 3.8 "
-                      "and scheduled for removal in Python 3.10.",
-                      DeprecationWarning,
-                      stacklevel=2
-        )
+                                 stderr=None, limit=streams._DEFAULT_LIMIT,
+                                 **kwds):
+    loop = events.get_running_loop()
     protocol_factory = lambda: SubprocessStreamProtocol(limit=limit,
                                                         loop=loop)
     transport, protocol = await loop.subprocess_exec(
diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py
index f486b67..c4bedb5 100644
--- a/Lib/asyncio/tasks.py
+++ b/Lib/asyncio/tasks.py
@@ -17,6 +17,7 @@
 import types
 import warnings
 import weakref
+from types import GenericAlias
 
 from . import base_tasks
 from . import coroutines
@@ -61,30 +62,6 @@
             if futures._get_loop(t) is loop and not t.done()}
 
 
-def _all_tasks_compat(loop=None):
-    # Different from "all_task()" by returning *all* Tasks, including
-    # the completed ones.  Used to implement deprecated "Tasks.all_task()"
-    # method.
-    if loop is None:
-        loop = events.get_event_loop()
-    # Looping over a WeakSet (_all_tasks) isn't safe as it can be updated from another
-    # thread while we do so. Therefore we cast it to list prior to filtering. The list
-    # cast itself requires iteration, so we repeat it several times ignoring
-    # RuntimeErrors (which are not very likely to occur). See issues 34970 and 36607 for
-    # details.
-    i = 0
-    while True:
-        try:
-            tasks = list(_all_tasks)
-        except RuntimeError:
-            i += 1
-            if i >= 1000:
-                raise
-        else:
-            break
-    return {t for t in tasks if futures._get_loop(t) is loop}
-
-
 def _set_task_name(task, name):
     if name is not None:
         try:
@@ -147,8 +124,7 @@
             self._loop.call_exception_handler(context)
         super().__del__()
 
-    def __class_getitem__(cls, type):
-        return cls
+    __class_getitem__ = classmethod(GenericAlias)
 
     def _repr_info(self):
         return base_tasks._task_repr_info(self)
@@ -370,7 +346,7 @@
 ALL_COMPLETED = concurrent.futures.ALL_COMPLETED
 
 
-async def wait(fs, *, loop=None, timeout=None, return_when=ALL_COMPLETED):
+async def wait(fs, *, timeout=None, return_when=ALL_COMPLETED):
     """Wait for the Futures and coroutines given by fs to complete.
 
     The fs iterable must not be empty.
@@ -393,12 +369,7 @@
     if return_when not in (FIRST_COMPLETED, FIRST_EXCEPTION, ALL_COMPLETED):
         raise ValueError(f'Invalid return_when value: {return_when}')
 
-    if loop is None:
-        loop = events.get_running_loop()
-    else:
-        warnings.warn("The loop argument is deprecated since Python 3.8, "
-                      "and scheduled for removal in Python 3.10.",
-                      DeprecationWarning, stacklevel=2)
+    loop = events.get_running_loop()
 
     fs = set(fs)
 
@@ -418,7 +389,7 @@
         waiter.set_result(None)
 
 
-async def wait_for(fut, timeout, *, loop=None):
+async def wait_for(fut, timeout):
     """Wait for the single Future or coroutine to complete, with timeout.
 
     Coroutine will be wrapped in Task.
@@ -431,12 +402,7 @@
 
     This function is a coroutine.
     """
-    if loop is None:
-        loop = events.get_running_loop()
-    else:
-        warnings.warn("The loop argument is deprecated since Python 3.8, "
-                      "and scheduled for removal in Python 3.10.",
-                      DeprecationWarning, stacklevel=2)
+    loop = events.get_running_loop()
 
     if timeout is None:
         return await fut
@@ -449,11 +415,9 @@
 
         await _cancel_and_wait(fut, loop=loop)
         try:
-            fut.result()
+            return fut.result()
         except exceptions.CancelledError as exc:
             raise exceptions.TimeoutError() from exc
-        else:
-            raise exceptions.TimeoutError()
 
     waiter = loop.create_future()
     timeout_handle = loop.call_later(timeout, _release_waiter, waiter)
@@ -471,7 +435,10 @@
                 return fut.result()
             else:
                 fut.remove_done_callback(cb)
-                fut.cancel()
+                # We must ensure that the task is not running
+                # after wait_for() returns.
+                # See https://bugs.python.org/issue32751
+                await _cancel_and_wait(fut, loop=loop)
                 raise
 
         if fut.done():
@@ -486,11 +453,9 @@
             # exception, we should re-raise it
             # See https://bugs.python.org/issue40607
             try:
-                fut.result()
+                return fut.result()
             except exceptions.CancelledError as exc:
                 raise exceptions.TimeoutError() from exc
-            else:
-                raise exceptions.TimeoutError()
     finally:
         timeout_handle.cancel()
 
@@ -556,7 +521,7 @@
 
 
 # This is *not* a @coroutine!  It is just an iterator (yielding Futures).
-def as_completed(fs, *, loop=None, timeout=None):
+def as_completed(fs, *, timeout=None):
     """Return an iterator whose values are coroutines.
 
     When waiting for the yielded coroutines you'll get the results (or
@@ -578,14 +543,9 @@
         raise TypeError(f"expect an iterable of futures, not {type(fs).__name__}")
 
     from .queues import Queue  # Import here to avoid circular import problem.
-    done = Queue(loop=loop)
+    done = Queue()
 
-    if loop is None:
-        loop = events.get_event_loop()
-    else:
-        warnings.warn("The loop argument is deprecated since Python 3.8, "
-                      "and scheduled for removal in Python 3.10.",
-                      DeprecationWarning, stacklevel=2)
+    loop = events._get_event_loop()
     todo = {ensure_future(f, loop=loop) for f in set(fs)}
     timeout_handle = None
 
@@ -630,19 +590,13 @@
     yield
 
 
-async def sleep(delay, result=None, *, loop=None):
+async def sleep(delay, result=None):
     """Coroutine that completes after a given time (in seconds)."""
     if delay <= 0:
         await __sleep0()
         return result
 
-    if loop is None:
-        loop = events.get_running_loop()
-    else:
-        warnings.warn("The loop argument is deprecated since Python 3.8, "
-                      "and scheduled for removal in Python 3.10.",
-                      DeprecationWarning, stacklevel=2)
-
+    loop = events.get_running_loop()
     future = loop.create_future()
     h = loop.call_later(delay,
                         futures._set_result_unless_cancelled,
@@ -658,23 +612,32 @@
 
     If the argument is a Future, it is returned directly.
     """
-    if coroutines.iscoroutine(coro_or_future):
-        if loop is None:
-            loop = events.get_event_loop()
-        task = loop.create_task(coro_or_future)
-        if task._source_traceback:
-            del task._source_traceback[-1]
-        return task
-    elif futures.isfuture(coro_or_future):
+    return _ensure_future(coro_or_future, loop=loop)
+
+
+def _ensure_future(coro_or_future, *, loop=None):
+    if futures.isfuture(coro_or_future):
         if loop is not None and loop is not futures._get_loop(coro_or_future):
             raise ValueError('The future belongs to a different loop than '
-                             'the one specified as the loop argument')
+                            'the one specified as the loop argument')
         return coro_or_future
-    elif inspect.isawaitable(coro_or_future):
-        return ensure_future(_wrap_awaitable(coro_or_future), loop=loop)
-    else:
-        raise TypeError('An asyncio.Future, a coroutine or an awaitable is '
-                        'required')
+    called_wrap_awaitable = False
+    if not coroutines.iscoroutine(coro_or_future):
+        if inspect.isawaitable(coro_or_future):
+            coro_or_future = _wrap_awaitable(coro_or_future)
+            called_wrap_awaitable = True
+        else:
+            raise TypeError('An asyncio.Future, a coroutine or an awaitable '
+                            'is required')
+
+    if loop is None:
+        loop = events._get_event_loop(stacklevel=4)
+    try:
+        return loop.create_task(coro_or_future)
+    except RuntimeError: 
+        if not called_wrap_awaitable:
+            coro_or_future.close()
+        raise
 
 
 @types.coroutine
@@ -697,7 +660,8 @@
     cancelled.
     """
 
-    def __init__(self, children, *, loop=None):
+    def __init__(self, children, *, loop):
+        assert loop is not None
         super().__init__(loop=loop)
         self._children = children
         self._cancel_requested = False
@@ -717,7 +681,7 @@
         return ret
 
 
-def gather(*coros_or_futures, loop=None, return_exceptions=False):
+def gather(*coros_or_futures, return_exceptions=False):
     """Return a future aggregating results from the given coroutines/futures.
 
     Coroutines will be wrapped in a future and scheduled in the event
@@ -748,12 +712,7 @@
     gather won't cancel any other awaitables.
     """
     if not coros_or_futures:
-        if loop is None:
-            loop = events.get_event_loop()
-        else:
-            warnings.warn("The loop argument is deprecated since Python 3.8, "
-                          "and scheduled for removal in Python 3.10.",
-                          DeprecationWarning, stacklevel=2)
+        loop = events._get_event_loop()
         outer = loop.create_future()
         outer.set_result([])
         return outer
@@ -762,7 +721,7 @@
         nonlocal nfinished
         nfinished += 1
 
-        if outer.done():
+        if outer is None or outer.done():
             if not fut.cancelled():
                 # Mark exception retrieved.
                 fut.exception()
@@ -817,9 +776,11 @@
     children = []
     nfuts = 0
     nfinished = 0
+    loop = None
+    outer = None  # bpo-46672
     for arg in coros_or_futures:
         if arg not in arg_to_fut:
-            fut = ensure_future(arg, loop=loop)
+            fut = _ensure_future(arg, loop=loop)
             if loop is None:
                 loop = futures._get_loop(fut)
             if fut is not arg:
@@ -843,7 +804,7 @@
     return outer
 
 
-def shield(arg, *, loop=None):
+def shield(arg):
     """Wait for a future, shielding it from cancellation.
 
     The statement
@@ -869,11 +830,7 @@
         except CancelledError:
             res = None
     """
-    if loop is not None:
-        warnings.warn("The loop argument is deprecated since Python 3.8, "
-                      "and scheduled for removal in Python 3.10.",
-                      DeprecationWarning, stacklevel=2)
-    inner = ensure_future(arg, loop=loop)
+    inner = _ensure_future(arg)
     if inner.done():
         # Shortcut.
         return inner
diff --git a/Lib/asyncio/threads.py b/Lib/asyncio/threads.py
index 34b7513..db048a8 100644
--- a/Lib/asyncio/threads.py
+++ b/Lib/asyncio/threads.py
@@ -13,7 +13,7 @@
     """Asynchronously run function *func* in a separate thread.
 
     Any *args and **kwargs supplied for this function are directly passed
-    to *func*. Also, the current :class:`contextvars.Context` is propogated,
+    to *func*. Also, the current :class:`contextvars.Context` is propagated,
     allowing context variables from the main thread to be accessed in the
     separate thread.
 
diff --git a/Lib/asyncio/transports.py b/Lib/asyncio/transports.py
index 45e155c..73b1fa2 100644
--- a/Lib/asyncio/transports.py
+++ b/Lib/asyncio/transports.py
@@ -99,6 +99,12 @@
         """Return the current size of the write buffer."""
         raise NotImplementedError
 
+    def get_write_buffer_limits(self):
+        """Get the high and low watermarks for write flow control. 
+        Return a tuple (low, high) where low and high are 
+        positive number of bytes."""
+        raise NotImplementedError
+
     def write(self, data):
         """Write some data bytes to the transport.
 
diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py
index f34a5b4..c88b818 100644
--- a/Lib/asyncio/unix_events.py
+++ b/Lib/asyncio/unix_events.py
@@ -44,6 +44,16 @@
     pass
 
 
+def waitstatus_to_exitcode(status):
+    try:
+        return os.waitstatus_to_exitcode(status)
+    except ValueError:
+        # The child exited, but we don't understand its status.
+        # This shouldn't happen, but if it does, let's just
+        # return that status; perhaps that helps debug it.
+        return status
+
+
 class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop):
     """Unix event loop.
 
@@ -323,7 +333,7 @@
             server._start_serving()
             # Skip one loop iteration so that all 'loop.add_reader'
             # go through.
-            await tasks.sleep(0, loop=self)
+            await tasks.sleep(0)
 
         return server
 
@@ -941,7 +951,7 @@
                 " will report returncode 255",
                 pid)
         else:
-            returncode = _compute_returncode(status)
+            returncode = waitstatus_to_exitcode(status)
 
         os.close(pidfd)
         callback(pid, returncode, *args)
@@ -956,20 +966,6 @@
         return True
 
 
-def _compute_returncode(status):
-    if os.WIFSIGNALED(status):
-        # The child process died because of a signal.
-        return -os.WTERMSIG(status)
-    elif os.WIFEXITED(status):
-        # The child process exited (e.g sys.exit()).
-        return os.WEXITSTATUS(status)
-    else:
-        # The child exited, but we don't understand its status.
-        # This shouldn't happen, but if it does, let's just
-        # return that status; perhaps that helps debug it.
-        return status
-
-
 class BaseChildWatcher(AbstractChildWatcher):
 
     def __init__(self):
@@ -1080,7 +1076,7 @@
                 # The child process is still alive.
                 return
 
-            returncode = _compute_returncode(status)
+            returncode = waitstatus_to_exitcode(status)
             if self._loop.get_debug():
                 logger.debug('process %s exited with returncode %s',
                              expected_pid, returncode)
@@ -1173,7 +1169,7 @@
                     # A child process is still alive.
                     return
 
-                returncode = _compute_returncode(status)
+                returncode = waitstatus_to_exitcode(status)
 
             with self._lock:
                 try:
@@ -1230,13 +1226,15 @@
 
     def close(self):
         self._callbacks.clear()
-        if self._saved_sighandler is not None:
-            handler = signal.getsignal(signal.SIGCHLD)
-            if handler != self._sig_chld:
-                logger.warning("SIGCHLD handler was changed by outside code")
-            else:
-                signal.signal(signal.SIGCHLD, self._saved_sighandler)
-            self._saved_sighandler = None
+        if self._saved_sighandler is None:
+            return
+
+        handler = signal.getsignal(signal.SIGCHLD)
+        if handler != self._sig_chld:
+            logger.warning("SIGCHLD handler was changed by outside code")
+        else:
+            signal.signal(signal.SIGCHLD, self._saved_sighandler)
+        self._saved_sighandler = None
 
     def __enter__(self):
         return self
@@ -1263,15 +1261,17 @@
         # The reason to do it here is that attach_loop() is called from
         # unix policy only for the main thread.
         # Main thread is required for subscription on SIGCHLD signal
-        if self._saved_sighandler is None:
-            self._saved_sighandler = signal.signal(signal.SIGCHLD, self._sig_chld)
-            if self._saved_sighandler is None:
-                logger.warning("Previous SIGCHLD handler was set by non-Python code, "
-                               "restore to default handler on watcher close.")
-                self._saved_sighandler = signal.SIG_DFL
+        if self._saved_sighandler is not None:
+            return
 
-            # Set SA_RESTART to limit EINTR occurrences.
-            signal.siginterrupt(signal.SIGCHLD, False)
+        self._saved_sighandler = signal.signal(signal.SIGCHLD, self._sig_chld)
+        if self._saved_sighandler is None:
+            logger.warning("Previous SIGCHLD handler was set by non-Python code, "
+                           "restore to default handler on watcher close.")
+            self._saved_sighandler = signal.SIG_DFL
+
+        # Set SA_RESTART to limit EINTR occurrences.
+        signal.siginterrupt(signal.SIGCHLD, False)
 
     def _do_waitpid_all(self):
         for pid in list(self._callbacks):
@@ -1296,7 +1296,7 @@
                 # The child process is still alive.
                 return
 
-            returncode = _compute_returncode(status)
+            returncode = waitstatus_to_exitcode(status)
             debug_log = True
         try:
             loop, callback, args = self._callbacks.pop(pid)
@@ -1379,7 +1379,7 @@
     def remove_child_handler(self, pid):
         # asyncio never calls remove_child_handler() !!!
         # The method is no-op but is implemented because
-        # abstract base classe requires it
+        # abstract base classes require it.
         return True
 
     def attach_loop(self, loop):
@@ -1399,7 +1399,7 @@
                 "Unknown child process pid %d, will report returncode 255",
                 pid)
         else:
-            returncode = _compute_returncode(status)
+            returncode = waitstatus_to_exitcode(status)
             if loop.get_debug():
                 logger.debug('process %s exited with returncode %s',
                              expected_pid, returncode)
diff --git a/Lib/asyncio/windows_events.py b/Lib/asyncio/windows_events.py
index 5e7cd79..da81ab4 100644
--- a/Lib/asyncio/windows_events.py
+++ b/Lib/asyncio/windows_events.py
@@ -1,5 +1,10 @@
 """Selector and proactor event loops for Windows."""
 
+import sys
+
+if sys.platform != 'win32':  # pragma: no cover
+    raise ImportError('win32 only')
+
 import _overlapped
 import _winapi
 import errno
diff --git a/Lib/asyncore.py b/Lib/asyncore.py
index ce16f11..b1eea4b 100644
--- a/Lib/asyncore.py
+++ b/Lib/asyncore.py
@@ -57,6 +57,13 @@
      ENOTCONN, ESHUTDOWN, EISCONN, EBADF, ECONNABORTED, EPIPE, EAGAIN, \
      errorcode
 
+warnings.warn(
+    'The asyncore module is deprecated. '
+    'The recommended replacement is asyncio',
+    DeprecationWarning,
+    stacklevel=2)
+
+
 _DISCONNECTED = frozenset({ECONNRESET, ENOTCONN, ESHUTDOWN, ECONNABORTED, EPIPE,
                            EBADF})
 
@@ -113,7 +120,7 @@
         if flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL):
             obj.handle_close()
     except OSError as e:
-        if e.args[0] not in _DISCONNECTED:
+        if e.errno not in _DISCONNECTED:
             obj.handle_error()
         else:
             obj.handle_close()
@@ -236,7 +243,7 @@
             try:
                 self.addr = sock.getpeername()
             except OSError as err:
-                if err.args[0] in (ENOTCONN, EINVAL):
+                if err.errno in (ENOTCONN, EINVAL):
                     # To handle the case where we got an unconnected
                     # socket.
                     self.connected = False
@@ -346,7 +353,7 @@
         except TypeError:
             return None
         except OSError as why:
-            if why.args[0] in (EWOULDBLOCK, ECONNABORTED, EAGAIN):
+            if why.errno in (EWOULDBLOCK, ECONNABORTED, EAGAIN):
                 return None
             else:
                 raise
@@ -358,9 +365,9 @@
             result = self.socket.send(data)
             return result
         except OSError as why:
-            if why.args[0] == EWOULDBLOCK:
+            if why.errno == EWOULDBLOCK:
                 return 0
-            elif why.args[0] in _DISCONNECTED:
+            elif why.errno in _DISCONNECTED:
                 self.handle_close()
                 return 0
             else:
@@ -378,7 +385,7 @@
                 return data
         except OSError as why:
             # winsock sometimes raises ENOTCONN
-            if why.args[0] in _DISCONNECTED:
+            if why.errno in _DISCONNECTED:
                 self.handle_close()
                 return b''
             else:
@@ -393,7 +400,7 @@
             try:
                 self.socket.close()
             except OSError as why:
-                if why.args[0] not in (ENOTCONN, EBADF):
+                if why.errno not in (ENOTCONN, EBADF):
                     raise
 
     # log and log_info may be overridden to provide more sophisticated
@@ -557,7 +564,7 @@
         try:
             x.close()
         except OSError as x:
-            if x.args[0] == EBADF:
+            if x.errno == EBADF:
                 pass
             elif not ignore_all:
                 raise
diff --git a/Lib/base64.py b/Lib/base64.py
index a28109f..e1256ad 100755
--- a/Lib/base64.py
+++ b/Lib/base64.py
@@ -16,7 +16,7 @@
     'encode', 'decode', 'encodebytes', 'decodebytes',
     # Generalized interface for other encodings
     'b64encode', 'b64decode', 'b32encode', 'b32decode',
-    'b16encode', 'b16decode',
+    'b32hexencode', 'b32hexdecode', 'b16encode', 'b16decode',
     # Base85 and Ascii85 encodings
     'b85encode', 'b85decode', 'a85encode', 'a85decode',
     # Standard Base64 encoding
@@ -135,19 +135,40 @@
 
 
 # Base32 encoding/decoding must be done in Python
-_b32alphabet = b'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'
-_b32tab2 = None
-_b32rev = None
+_B32_ENCODE_DOCSTRING = '''
+Encode the bytes-like objects using {encoding} and return a bytes object.
+'''
+_B32_DECODE_DOCSTRING = '''
+Decode the {encoding} encoded bytes-like object or ASCII string s.
 
-def b32encode(s):
-    """Encode the bytes-like object s using Base32 and return a bytes object.
-    """
+Optional casefold is a flag specifying whether a lowercase alphabet is
+acceptable as input.  For security purposes, the default is False.
+{extra_args}
+The result is returned as a bytes object.  A binascii.Error is raised if
+the input is incorrectly padded or if there are non-alphabet
+characters present in the input.
+'''
+_B32_DECODE_MAP01_DOCSTRING = '''
+RFC 3548 allows for optional mapping of the digit 0 (zero) to the
+letter O (oh), and for optional mapping of the digit 1 (one) to
+either the letter I (eye) or letter L (el).  The optional argument
+map01 when not None, specifies which letter the digit 1 should be
+mapped to (when map01 is not None, the digit 0 is always mapped to
+the letter O).  For security purposes the default is None, so that
+0 and 1 are not allowed in the input.
+'''
+_b32alphabet = b'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'
+_b32hexalphabet = b'0123456789ABCDEFGHIJKLMNOPQRSTUV'
+_b32tab2 = {}
+_b32rev = {}
+
+def _b32encode(alphabet, s):
     global _b32tab2
     # Delay the initialization of the table to not waste memory
     # if the function is never called
-    if _b32tab2 is None:
-        b32tab = [bytes((i,)) for i in _b32alphabet]
-        _b32tab2 = [a + b for a in b32tab for b in b32tab]
+    if alphabet not in _b32tab2:
+        b32tab = [bytes((i,)) for i in alphabet]
+        _b32tab2[alphabet] = [a + b for a in b32tab for b in b32tab]
         b32tab = None
 
     if not isinstance(s, bytes_types):
@@ -158,7 +179,7 @@
         s = s + b'\0' * (5 - leftover)  # Don't use += !
     encoded = bytearray()
     from_bytes = int.from_bytes
-    b32tab2 = _b32tab2
+    b32tab2 = _b32tab2[alphabet]
     for i in range(0, len(s), 5):
         c = from_bytes(s[i: i + 5], 'big')
         encoded += (b32tab2[c >> 30] +           # bits 1 - 10
@@ -177,29 +198,12 @@
         encoded[-1:] = b'='
     return bytes(encoded)
 
-def b32decode(s, casefold=False, map01=None):
-    """Decode the Base32 encoded bytes-like object or ASCII string s.
-
-    Optional casefold is a flag specifying whether a lowercase alphabet is
-    acceptable as input.  For security purposes, the default is False.
-
-    RFC 3548 allows for optional mapping of the digit 0 (zero) to the
-    letter O (oh), and for optional mapping of the digit 1 (one) to
-    either the letter I (eye) or letter L (el).  The optional argument
-    map01 when not None, specifies which letter the digit 1 should be
-    mapped to (when map01 is not None, the digit 0 is always mapped to
-    the letter O).  For security purposes the default is None, so that
-    0 and 1 are not allowed in the input.
-
-    The result is returned as a bytes object.  A binascii.Error is raised if
-    the input is incorrectly padded or if there are non-alphabet
-    characters present in the input.
-    """
+def _b32decode(alphabet, s, casefold=False, map01=None):
     global _b32rev
     # Delay the initialization of the table to not waste memory
     # if the function is never called
-    if _b32rev is None:
-        _b32rev = {v: k for k, v in enumerate(_b32alphabet)}
+    if alphabet not in _b32rev:
+        _b32rev[alphabet] = {v: k for k, v in enumerate(alphabet)}
     s = _bytes_from_decode_data(s)
     if len(s) % 8:
         raise binascii.Error('Incorrect padding')
@@ -220,7 +224,7 @@
     padchars = l - len(s)
     # Now decode the full quanta
     decoded = bytearray()
-    b32rev = _b32rev
+    b32rev = _b32rev[alphabet]
     for i in range(0, len(s), 8):
         quanta = s[i: i + 8]
         acc = 0
@@ -241,6 +245,26 @@
     return bytes(decoded)
 
 
+def b32encode(s):
+    return _b32encode(_b32alphabet, s)
+b32encode.__doc__ = _B32_ENCODE_DOCSTRING.format(encoding='base32')
+
+def b32decode(s, casefold=False, map01=None):
+    return _b32decode(_b32alphabet, s, casefold, map01)
+b32decode.__doc__ = _B32_DECODE_DOCSTRING.format(encoding='base32',
+                                        extra_args=_B32_DECODE_MAP01_DOCSTRING)
+
+def b32hexencode(s):
+    return _b32encode(_b32hexalphabet, s)
+b32hexencode.__doc__ = _B32_ENCODE_DOCSTRING.format(encoding='base32hex')
+
+def b32hexdecode(s, casefold=False):
+    # base32hex does not have the 01 mapping
+    return _b32decode(_b32hexalphabet, s, casefold)
+b32hexdecode.__doc__ = _B32_DECODE_DOCSTRING.format(encoding='base32hex',
+                                                    extra_args='')
+
+
 # RFC 3548, Base 16 Alphabet specifies uppercase, but hexlify() returns
 # lowercase.  The RFC also recommends against accepting input case
 # insensitively.
@@ -320,7 +344,7 @@
     global _a85chars, _a85chars2
     # Delay the initialization of tables to not waste memory
     # if the function is never called
-    if _a85chars is None:
+    if _a85chars2 is None:
         _a85chars = [bytes((i,)) for i in range(33, 118)]
         _a85chars2 = [(a + b) for a in _a85chars for b in _a85chars]
 
@@ -428,7 +452,7 @@
     global _b85chars, _b85chars2
     # Delay the initialization of tables to not waste memory
     # if the function is never called
-    if _b85chars is None:
+    if _b85chars2 is None:
         _b85chars = [bytes((i,)) for i in _b85alphabet]
         _b85chars2 = [(a + b) for a in _b85chars for b in _b85chars]
     return _85encode(b, _b85chars, _b85chars2, pad)
diff --git a/Lib/bdb.py b/Lib/bdb.py
index b18a061..75d6113 100644
--- a/Lib/bdb.py
+++ b/Lib/bdb.py
@@ -34,6 +34,8 @@
         self.fncache = {}
         self.frame_returning = None
 
+        self._load_breaks()
+
     def canonic(self, filename):
         """Return canonical form of filename.
 
@@ -117,7 +119,7 @@
         """Invoke user function and return trace function for call event.
 
         If the debugger stops on this function call, invoke
-        self.user_call(). Raise BbdQuit if self.quitting is set.
+        self.user_call(). Raise BdbQuit if self.quitting is set.
         Return self.trace_dispatch to continue tracing in this scope.
         """
         # XXX 'arg' is no longer used
@@ -365,6 +367,12 @@
     # Call self.get_*break*() to see the breakpoints or better
     # for bp in Breakpoint.bpbynumber: if bp: bp.bpprint().
 
+    def _add_to_breaks(self, filename, lineno):
+        """Add breakpoint to breaks, if not already there."""
+        bp_linenos = self.breaks.setdefault(filename, [])
+        if lineno not in bp_linenos:
+            bp_linenos.append(lineno)
+
     def set_break(self, filename, lineno, temporary=False, cond=None,
                   funcname=None):
         """Set a new breakpoint for filename:lineno.
@@ -377,12 +385,21 @@
         line = linecache.getline(filename, lineno)
         if not line:
             return 'Line %s:%d does not exist' % (filename, lineno)
-        list = self.breaks.setdefault(filename, [])
-        if lineno not in list:
-            list.append(lineno)
+        self._add_to_breaks(filename, lineno)
         bp = Breakpoint(filename, lineno, temporary, cond, funcname)
         return None
 
+    def _load_breaks(self):
+        """Apply all breakpoints (set in other instances) to this one.
+
+        Populates this instance's breaks list from the Breakpoint class's
+        list, which can have breakpoints set by another Bdb instance. This
+        is necessary for interactive sessions to keep the breakpoints
+        active across multiple calls to run().
+        """
+        for (filename, lineno) in Breakpoint.bplist.keys():
+            self._add_to_breaks(filename, lineno)
+
     def _prune_breaks(self, filename, lineno):
         """Prune breakpoints for filename:lineno.
 
@@ -681,6 +698,12 @@
         else:
             self.bplist[file, line] = [self]
 
+    @staticmethod
+    def clearBreakpoints():
+        Breakpoint.next = 1
+        Breakpoint.bplist = {}
+        Breakpoint.bpbynumber = [None]
+
     def deleteMe(self):
         """Delete the breakpoint from the list associated to a file:line.
 
diff --git a/Lib/bisect.py b/Lib/bisect.py
index 8f3f6a3..d37da74 100644
--- a/Lib/bisect.py
+++ b/Lib/bisect.py
@@ -1,6 +1,7 @@
 """Bisection algorithms."""
 
-def insort_right(a, x, lo=0, hi=None):
+
+def insort_right(a, x, lo=0, hi=None, *, key=None):
     """Insert item x in list a, and keep it sorted assuming a is sorted.
 
     If x is already in a, insert it to the right of the rightmost x.
@@ -8,15 +9,18 @@
     Optional args lo (default 0) and hi (default len(a)) bound the
     slice of a to be searched.
     """
-
-    lo = bisect_right(a, x, lo, hi)
+    if key is None:
+        lo = bisect_right(a, x, lo, hi)
+    else:
+        lo = bisect_right(a, key(x), lo, hi, key=key)
     a.insert(lo, x)
 
-def bisect_right(a, x, lo=0, hi=None):
+
+def bisect_right(a, x, lo=0, hi=None, *, key=None):
     """Return the index where to insert item x in list a, assuming a is sorted.
 
     The return value i is such that all e in a[:i] have e <= x, and all e in
-    a[i:] have e > x.  So if x already appears in the list, a.insert(x) will
+    a[i:] have e > x.  So if x already appears in the list, a.insert(i, x) will
     insert just after the rightmost x already there.
 
     Optional args lo (default 0) and hi (default len(a)) bound the
@@ -27,14 +31,26 @@
         raise ValueError('lo must be non-negative')
     if hi is None:
         hi = len(a)
-    while lo < hi:
-        mid = (lo+hi)//2
-        # Use __lt__ to match the logic in list.sort() and in heapq
-        if x < a[mid]: hi = mid
-        else: lo = mid+1
+    # Note, the comparison uses "<" to match the
+    # __lt__() logic in list.sort() and in heapq.
+    if key is None:
+        while lo < hi:
+            mid = (lo + hi) // 2
+            if x < a[mid]:
+                hi = mid
+            else:
+                lo = mid + 1
+    else:
+        while lo < hi:
+            mid = (lo + hi) // 2
+            if x < key(a[mid]):
+                hi = mid
+            else:
+                lo = mid + 1
     return lo
 
-def insort_left(a, x, lo=0, hi=None):
+
+def insort_left(a, x, lo=0, hi=None, *, key=None):
     """Insert item x in list a, and keep it sorted assuming a is sorted.
 
     If x is already in a, insert it to the left of the leftmost x.
@@ -43,15 +59,17 @@
     slice of a to be searched.
     """
 
-    lo = bisect_left(a, x, lo, hi)
+    if key is None:
+        lo = bisect_left(a, x, lo, hi)
+    else:
+        lo = bisect_left(a, key(x), lo, hi, key=key)
     a.insert(lo, x)
 
-
-def bisect_left(a, x, lo=0, hi=None):
+def bisect_left(a, x, lo=0, hi=None, *, key=None):
     """Return the index where to insert item x in list a, assuming a is sorted.
 
     The return value i is such that all e in a[:i] have e < x, and all e in
-    a[i:] have e >= x.  So if x already appears in the list, a.insert(x) will
+    a[i:] have e >= x.  So if x already appears in the list, a.insert(i, x) will
     insert just before the leftmost x already there.
 
     Optional args lo (default 0) and hi (default len(a)) bound the
@@ -62,13 +80,25 @@
         raise ValueError('lo must be non-negative')
     if hi is None:
         hi = len(a)
-    while lo < hi:
-        mid = (lo+hi)//2
-        # Use __lt__ to match the logic in list.sort() and in heapq
-        if a[mid] < x: lo = mid+1
-        else: hi = mid
+    # Note, the comparison uses "<" to match the
+    # __lt__() logic in list.sort() and in heapq.
+    if key is None:
+        while lo < hi:
+            mid = (lo + hi) // 2
+            if a[mid] < x:
+                lo = mid + 1
+            else:
+                hi = mid
+    else:
+        while lo < hi:
+            mid = (lo + hi) // 2
+            if key(a[mid]) < x:
+                lo = mid + 1
+            else:
+                hi = mid
     return lo
 
+
 # Overwrite above definitions with a fast C implementation
 try:
     from _bisect import *
diff --git a/Lib/bz2.py b/Lib/bz2.py
index ce07ebe..fabe4f7 100644
--- a/Lib/bz2.py
+++ b/Lib/bz2.py
@@ -13,7 +13,6 @@
 import io
 import os
 import _compression
-from threading import RLock
 
 from _bz2 import BZ2Compressor, BZ2Decompressor
 
@@ -53,9 +52,6 @@
         If mode is 'r', the input file may be the concatenation of
         multiple compressed streams.
         """
-        # This lock must be recursive, so that BufferedIOBase's
-        # writelines() does not deadlock.
-        self._lock = RLock()
         self._fp = None
         self._closefp = False
         self._mode = _MODE_CLOSED
@@ -104,24 +100,23 @@
         May be called more than once without error. Once the file is
         closed, any other operation on it will raise a ValueError.
         """
-        with self._lock:
-            if self._mode == _MODE_CLOSED:
-                return
+        if self._mode == _MODE_CLOSED:
+            return
+        try:
+            if self._mode == _MODE_READ:
+                self._buffer.close()
+            elif self._mode == _MODE_WRITE:
+                self._fp.write(self._compressor.flush())
+                self._compressor = None
+        finally:
             try:
-                if self._mode == _MODE_READ:
-                    self._buffer.close()
-                elif self._mode == _MODE_WRITE:
-                    self._fp.write(self._compressor.flush())
-                    self._compressor = None
+                if self._closefp:
+                    self._fp.close()
             finally:
-                try:
-                    if self._closefp:
-                        self._fp.close()
-                finally:
-                    self._fp = None
-                    self._closefp = False
-                    self._mode = _MODE_CLOSED
-                    self._buffer = None
+                self._fp = None
+                self._closefp = False
+                self._mode = _MODE_CLOSED
+                self._buffer = None
 
     @property
     def closed(self):
@@ -153,12 +148,11 @@
         Always returns at least one byte of data, unless at EOF.
         The exact number of bytes returned is unspecified.
         """
-        with self._lock:
-            self._check_can_read()
-            # Relies on the undocumented fact that BufferedReader.peek()
-            # always returns at least one byte (except at EOF), independent
-            # of the value of n
-            return self._buffer.peek(n)
+        self._check_can_read()
+        # Relies on the undocumented fact that BufferedReader.peek()
+        # always returns at least one byte (except at EOF), independent
+        # of the value of n
+        return self._buffer.peek(n)
 
     def read(self, size=-1):
         """Read up to size uncompressed bytes from the file.
@@ -166,9 +160,8 @@
         If size is negative or omitted, read until EOF is reached.
         Returns b'' if the file is already at EOF.
         """
-        with self._lock:
-            self._check_can_read()
-            return self._buffer.read(size)
+        self._check_can_read()
+        return self._buffer.read(size)
 
     def read1(self, size=-1):
         """Read up to size uncompressed bytes, while trying to avoid
@@ -177,20 +170,18 @@
 
         Returns b'' if the file is at EOF.
         """
-        with self._lock:
-            self._check_can_read()
-            if size < 0:
-                size = io.DEFAULT_BUFFER_SIZE
-            return self._buffer.read1(size)
+        self._check_can_read()
+        if size < 0:
+            size = io.DEFAULT_BUFFER_SIZE
+        return self._buffer.read1(size)
 
     def readinto(self, b):
         """Read bytes into b.
 
         Returns the number of bytes read (0 for EOF).
         """
-        with self._lock:
-            self._check_can_read()
-            return self._buffer.readinto(b)
+        self._check_can_read()
+        return self._buffer.readinto(b)
 
     def readline(self, size=-1):
         """Read a line of uncompressed bytes from the file.
@@ -203,9 +194,8 @@
             if not hasattr(size, "__index__"):
                 raise TypeError("Integer argument expected")
             size = size.__index__()
-        with self._lock:
-            self._check_can_read()
-            return self._buffer.readline(size)
+        self._check_can_read()
+        return self._buffer.readline(size)
 
     def readlines(self, size=-1):
         """Read a list of lines of uncompressed bytes from the file.
@@ -218,23 +208,29 @@
             if not hasattr(size, "__index__"):
                 raise TypeError("Integer argument expected")
             size = size.__index__()
-        with self._lock:
-            self._check_can_read()
-            return self._buffer.readlines(size)
+        self._check_can_read()
+        return self._buffer.readlines(size)
 
     def write(self, data):
         """Write a byte string to the file.
 
         Returns the number of uncompressed bytes written, which is
-        always len(data). Note that due to buffering, the file on disk
-        may not reflect the data written until close() is called.
+        always the length of data in bytes. Note that due to buffering,
+        the file on disk may not reflect the data written until close()
+        is called.
         """
-        with self._lock:
-            self._check_can_write()
-            compressed = self._compressor.compress(data)
-            self._fp.write(compressed)
-            self._pos += len(data)
-            return len(data)
+        self._check_can_write()
+        if isinstance(data, (bytes, bytearray)):
+            length = len(data)
+        else:
+            # accept any data that supports the buffer protocol
+            data = memoryview(data)
+            length = data.nbytes
+
+        compressed = self._compressor.compress(data)
+        self._fp.write(compressed)
+        self._pos += length
+        return length
 
     def writelines(self, seq):
         """Write a sequence of byte strings to the file.
@@ -244,8 +240,7 @@
 
         Line separators are not added between the written byte strings.
         """
-        with self._lock:
-            return _compression.BaseStream.writelines(self, seq)
+        return _compression.BaseStream.writelines(self, seq)
 
     def seek(self, offset, whence=io.SEEK_SET):
         """Change the file position.
@@ -262,17 +257,15 @@
         Note that seeking is emulated, so depending on the parameters,
         this operation may be extremely slow.
         """
-        with self._lock:
-            self._check_can_seek()
-            return self._buffer.seek(offset, whence)
+        self._check_can_seek()
+        return self._buffer.seek(offset, whence)
 
     def tell(self):
         """Return the current file position."""
-        with self._lock:
-            self._check_not_closed()
-            if self._mode == _MODE_READ:
-                return self._buffer.tell()
-            return self._pos
+        self._check_not_closed()
+        if self._mode == _MODE_READ:
+            return self._buffer.tell()
+        return self._pos
 
 
 def open(filename, mode="rb", compresslevel=9,
@@ -311,6 +304,7 @@
     binary_file = BZ2File(filename, bz_mode, compresslevel=compresslevel)
 
     if "t" in mode:
+        encoding = io.text_encoding(encoding)
         return io.TextIOWrapper(binary_file, encoding, errors, newline)
     else:
         return binary_file
diff --git a/Lib/cProfile.py b/Lib/cProfile.py
index 59b4699..22a7d0a 100755
--- a/Lib/cProfile.py
+++ b/Lib/cProfile.py
@@ -175,7 +175,12 @@
                 '__package__': None,
                 '__cached__': None,
             }
-        runctx(code, globs, None, options.outfile, options.sort)
+        try:
+            runctx(code, globs, None, options.outfile, options.sort)
+        except BrokenPipeError as exc:
+            # Prevent "Exception ignored" during interpreter shutdown.
+            sys.stdout = None
+            sys.exit(exc.errno)
     else:
         parser.print_usage()
     return parser
diff --git a/Lib/calendar.py b/Lib/calendar.py
index 7550d52..cbea9ec 100644
--- a/Lib/calendar.py
+++ b/Lib/calendar.py
@@ -15,7 +15,9 @@
            "monthcalendar", "prmonth", "month", "prcal", "calendar",
            "timegm", "month_name", "month_abbr", "day_name", "day_abbr",
            "Calendar", "TextCalendar", "HTMLCalendar", "LocaleTextCalendar",
-           "LocaleHTMLCalendar", "weekheader"]
+           "LocaleHTMLCalendar", "weekheader",
+           "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY",
+           "SATURDAY", "SUNDAY"]
 
 # Exception raised for bad input (with string parameter for details)
 error = ValueError
@@ -571,19 +573,11 @@
 
     def formatweekday(self, day, width):
         with different_locale(self.locale):
-            if width >= 9:
-                names = day_name
-            else:
-                names = day_abbr
-            name = names[day]
-            return name[:width].center(width)
+            return super().formatweekday(day, width)
 
     def formatmonthname(self, theyear, themonth, width, withyear=True):
         with different_locale(self.locale):
-            s = month_name[themonth]
-            if withyear:
-                s = "%s %r" % (s, theyear)
-            return s.center(width)
+            return super().formatmonthname(theyear, themonth, width, withyear)
 
 
 class LocaleHTMLCalendar(HTMLCalendar):
@@ -601,16 +595,11 @@
 
     def formatweekday(self, day):
         with different_locale(self.locale):
-            s = day_abbr[day]
-            return '<th class="%s">%s</th>' % (self.cssclasses[day], s)
+            return super().formatweekday(day)
 
     def formatmonthname(self, theyear, themonth, withyear=True):
         with different_locale(self.locale):
-            s = month_name[themonth]
-            if withyear:
-                s = '%s %s' % (s, theyear)
-            return '<tr><th colspan="7" class="month">%s</th></tr>' % s
-
+            return super().formatmonthname(theyear, themonth, withyear)
 
 # Support for old module level interface
 c = TextCalendar()
diff --git a/Lib/cgi.py b/Lib/cgi.py
index 77ab703..6cb8cf2 100755
--- a/Lib/cgi.py
+++ b/Lib/cgi.py
@@ -41,6 +41,7 @@
 import html
 import locale
 import tempfile
+import warnings
 
 __all__ = ["MiniFieldStorage", "FieldStorage", "parse", "parse_multipart",
            "parse_header", "test", "print_exception", "print_environ",
@@ -77,9 +78,11 @@
 
     """
     global log, logfile, logfp
+    warnings.warn("cgi.log() is deprecated as of 3.10. Use logging instead",
+                  DeprecationWarning, stacklevel=2)
     if logfile and not logfp:
         try:
-            logfp = open(logfile, "a")
+            logfp = open(logfile, "a", encoding="locale")
         except OSError:
             pass
     if not logfp:
@@ -115,7 +118,8 @@
 # 0 ==> unlimited input
 maxlen = 0
 
-def parse(fp=None, environ=os.environ, keep_blank_values=0, strict_parsing=0):
+def parse(fp=None, environ=os.environ, keep_blank_values=0,
+          strict_parsing=0, separator='&'):
     """Parse a query in the environment or from a file (default stdin)
 
         Arguments, all optional:
@@ -134,6 +138,9 @@
         strict_parsing: flag indicating what to do with parsing errors.
             If false (the default), errors are silently ignored.
             If true, errors raise a ValueError exception.
+
+        separator: str. The symbol to use for separating the query arguments.
+            Defaults to &.
     """
     if fp is None:
         fp = sys.stdin
@@ -154,7 +161,7 @@
     if environ['REQUEST_METHOD'] == 'POST':
         ctype, pdict = parse_header(environ['CONTENT_TYPE'])
         if ctype == 'multipart/form-data':
-            return parse_multipart(fp, pdict)
+            return parse_multipart(fp, pdict, separator=separator)
         elif ctype == 'application/x-www-form-urlencoded':
             clength = int(environ['CONTENT_LENGTH'])
             if maxlen and clength > maxlen:
@@ -178,10 +185,10 @@
             qs = ""
         environ['QUERY_STRING'] = qs    # XXX Shouldn't, really
     return urllib.parse.parse_qs(qs, keep_blank_values, strict_parsing,
-                                 encoding=encoding)
+                                 encoding=encoding, separator=separator)
 
 
-def parse_multipart(fp, pdict, encoding="utf-8", errors="replace"):
+def parse_multipart(fp, pdict, encoding="utf-8", errors="replace", separator='&'):
     """Parse multipart input.
 
     Arguments:
@@ -194,7 +201,7 @@
     value is a list of values for that field. For non-file fields, the value
     is a list of strings.
     """
-    # RFC 2026, Section 5.1 : The "multipart" boundary delimiters are always
+    # RFC 2046, Section 5.1 : The "multipart" boundary delimiters are always
     # represented as 7bit US-ASCII.
     boundary = pdict['boundary'].decode('ascii')
     ctype = "multipart/form-data; boundary={}".format(boundary)
@@ -205,7 +212,7 @@
     except KeyError:
         pass
     fs = FieldStorage(fp, headers=headers, encoding=encoding, errors=errors,
-        environ={'REQUEST_METHOD': 'POST'})
+        environ={'REQUEST_METHOD': 'POST'}, separator=separator)
     return {k: fs.getlist(k) for k in fs}
 
 def _parseparam(s):
@@ -315,7 +322,7 @@
     def __init__(self, fp=None, headers=None, outerboundary=b'',
                  environ=os.environ, keep_blank_values=0, strict_parsing=0,
                  limit=None, encoding='utf-8', errors='replace',
-                 max_num_fields=None):
+                 max_num_fields=None, separator='&'):
         """Constructor.  Read multipart/* until last part.
 
         Arguments, all optional:
@@ -363,6 +370,7 @@
         self.keep_blank_values = keep_blank_values
         self.strict_parsing = strict_parsing
         self.max_num_fields = max_num_fields
+        self.separator = separator
         if 'REQUEST_METHOD' in environ:
             method = environ['REQUEST_METHOD'].upper()
         self.qs_on_post = None
@@ -589,7 +597,7 @@
         query = urllib.parse.parse_qsl(
             qs, self.keep_blank_values, self.strict_parsing,
             encoding=self.encoding, errors=self.errors,
-            max_num_fields=self.max_num_fields)
+            max_num_fields=self.max_num_fields, separator=self.separator)
         self.list = [MiniFieldStorage(key, value) for key, value in query]
         self.skip_lines()
 
@@ -605,7 +613,7 @@
             query = urllib.parse.parse_qsl(
                 self.qs_on_post, self.keep_blank_values, self.strict_parsing,
                 encoding=self.encoding, errors=self.errors,
-                max_num_fields=self.max_num_fields)
+                max_num_fields=self.max_num_fields, separator=self.separator)
             self.list.extend(MiniFieldStorage(key, value) for key, value in query)
 
         klass = self.FieldStorageClass or self.__class__
@@ -649,7 +657,7 @@
                 else self.limit - self.bytes_read
             part = klass(self.fp, headers, ib, environ, keep_blank_values,
                          strict_parsing, limit,
-                         self.encoding, self.errors, max_num_fields)
+                         self.encoding, self.errors, max_num_fields, self.separator)
 
             if max_num_fields is not None:
                 max_num_fields -= 1
diff --git a/Lib/cgitb.py b/Lib/cgitb.py
index 4f81271..17ddda3 100644
--- a/Lib/cgitb.py
+++ b/Lib/cgitb.py
@@ -181,8 +181,8 @@
 
 
 <!-- The above is a description of an error in a Python program, formatted
-     for a Web browser because the 'cgitb' module was enabled.  In case you
-     are not reading this in a Web browser, here is the original traceback:
+     for a web browser because the 'cgitb' module was enabled.  In case you
+     are not reading this in a web browser, here is the original traceback:
 
 %s
 -->
diff --git a/Lib/codecs.py b/Lib/codecs.py
index 7f23e97..e6ad6e3 100644
--- a/Lib/codecs.py
+++ b/Lib/codecs.py
@@ -83,7 +83,7 @@
 class CodecInfo(tuple):
     """Codec details when looking up the codec registry"""
 
-    # Private API to allow Python 3.4 to blacklist the known non-Unicode
+    # Private API to allow Python 3.4 to denylist the known non-Unicode
     # codecs in the standard library. A more general mechanism to
     # reliably distinguish test encodings from other codecs will hopefully
     # be defined for Python 3.5
@@ -386,7 +386,7 @@
 
     def reset(self):
 
-        """ Flushes and resets the codec buffers used for keeping state.
+        """ Resets the codec buffers used for keeping internal state.
 
             Calling this method should ensure that the data on the
             output is put into a clean state, that allows appending
@@ -620,7 +620,7 @@
 
     def reset(self):
 
-        """ Resets the codec buffers used for keeping state.
+        """ Resets the codec buffers used for keeping internal state.
 
             Note that no stream repositioning should take place.
             This method is primarily intended to be able to recover
diff --git a/Lib/codeop.py b/Lib/codeop.py
index 4c10470..568e9bb 100644
--- a/Lib/codeop.py
+++ b/Lib/codeop.py
@@ -10,30 +10,6 @@
   syntax error (OverflowError and ValueError can be produced by
   malformed literals).
 
-Approach:
-
-First, check if the source consists entirely of blank lines and
-comments; if so, replace it with 'pass', because the built-in
-parser doesn't always do the right thing for these.
-
-Compile three times: as is, with \n, and with \n\n appended.  If it
-compiles as is, it's complete.  If it compiles with one \n appended,
-we expect more.  If it doesn't compile either way, we compare the
-error we get when compiling with \n or \n\n appended.  If the errors
-are the same, the code is broken.  But if the errors are different, we
-expect more.  Not intuitive; not even guaranteed to hold in future
-releases; but this matches the compiler's behavior from Python 1.4
-through 2.2, at least.
-
-Caveat:
-
-It is possible (but not likely) that the parser stops parsing with a
-successful outcome before reaching the end of the source; in this
-case, trailing symbols may be ignored instead of causing an error.
-For example, a backslash followed by two newlines may be followed by
-arbitrary garbage.  This will be fixed once the API for the parser is
-better.
-
 The two interfaces are:
 
 compile_command(source, filename, symbol):
@@ -64,24 +40,25 @@
 
 __all__ = ["compile_command", "Compile", "CommandCompiler"]
 
-PyCF_DONT_IMPLY_DEDENT = 0x200          # Matches pythonrun.h
+# The following flags match the values from Include/cpython/compile.h
+# Caveat emptor: These flags are undocumented on purpose and depending
+# on their effect outside the standard library is **unsupported**.
+PyCF_DONT_IMPLY_DEDENT = 0x200          
+PyCF_ALLOW_INCOMPLETE_INPUT = 0x4000
 
 def _maybe_compile(compiler, source, filename, symbol):
-    # Check for source consisting of only blank lines and comments
+    # Check for source consisting of only blank lines and comments.
     for line in source.split("\n"):
         line = line.strip()
         if line and line[0] != '#':
-            break               # Leave it alone
+            break               # Leave it alone.
     else:
         if symbol != "eval":
             source = "pass"     # Replace it with a 'pass' statement
 
-    err = err1 = err2 = None
-    code = code1 = code2 = None
-
     try:
-        code = compiler(source, filename, symbol)
-    except SyntaxError:
+        return compiler(source, filename, symbol)
+    except SyntaxError:  # Let other compile() errors propagate.
         pass
 
     # Catch syntax warnings after the first compile
@@ -90,25 +67,23 @@
         warnings.simplefilter("error")
 
         try:
-            code1 = compiler(source + "\n", filename, symbol)
+            compiler(source + "\n", filename, symbol)
         except SyntaxError as e:
-            err1 = e
+            if "incomplete input" in str(e):
+                return None
+            raise
 
-        try:
-            code2 = compiler(source + "\n\n", filename, symbol)
-        except SyntaxError as e:
-            err2 = e
-
-    try:
-        if code:
-            return code
-        if not code1 and repr(err1) == repr(err2):
-            raise err1
-    finally:
-        err1 = err2 = None
+def _is_syntax_error(err1, err2):
+    rep1 = repr(err1)
+    rep2 = repr(err2)
+    if "was never closed" in rep1 and "was never closed" in rep2:
+        return False
+    if rep1 == rep2:
+        return True
+    return False
 
 def _compile(source, filename, symbol):
-    return compile(source, filename, symbol, PyCF_DONT_IMPLY_DEDENT)
+    return compile(source, filename, symbol, PyCF_DONT_IMPLY_DEDENT | PyCF_ALLOW_INCOMPLETE_INPUT)
 
 def compile_command(source, filename="<input>", symbol="single"):
     r"""Compile a command and determine whether it is incomplete.
@@ -137,7 +112,7 @@
     statement, it "remembers" and compiles all subsequent program texts
     with the statement in force."""
     def __init__(self):
-        self.flags = PyCF_DONT_IMPLY_DEDENT
+        self.flags = PyCF_DONT_IMPLY_DEDENT | PyCF_ALLOW_INCOMPLETE_INPUT
 
     def __call__(self, source, filename, symbol):
         codeob = compile(source, filename, symbol, self.flags, True)
diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py
index bc69a67..818588f 100644
--- a/Lib/collections/__init__.py
+++ b/Lib/collections/__init__.py
@@ -27,7 +27,6 @@
 ]
 
 import _collections_abc
-import heapq as _heapq
 import sys as _sys
 
 from itertools import chain as _chain
@@ -52,22 +51,6 @@
     pass
 
 
-def __getattr__(name):
-    # For backwards compatibility, continue to make the collections ABCs
-    # through Python 3.6 available through the collections module.
-    # Note, no new collections ABCs were added in Python 3.7
-    if name in _collections_abc.__all__:
-        obj = getattr(_collections_abc, name)
-        import warnings
-        warnings.warn("Using or importing the ABCs from 'collections' instead "
-                      "of from 'collections.abc' is deprecated since Python 3.3, "
-                      "and in 3.10 it will stop working",
-                      DeprecationWarning, stacklevel=2)
-        globals()[name] = obj
-        return obj
-    raise AttributeError(f'module {__name__!r} has no attribute {name!r}')
-
-
 ################################################################################
 ### OrderedDict
 ################################################################################
@@ -424,7 +407,7 @@
 
     namespace = {
         '_tuple_new': tuple_new,
-        '__builtins__': None,
+        '__builtins__': {},
         '__name__': f'namedtuple_{typename}',
     }
     code = f'lambda _cls, {arg_list}: _tuple_new(_cls, ({arg_list}))'
@@ -489,6 +472,7 @@
         '__repr__': __repr__,
         '_asdict': _asdict,
         '__getnewargs__': __getnewargs__,
+        '__match_args__': field_names,
     }
     for index, name in enumerate(field_names):
         doc = _sys.intern(f'Alias for field number {index}')
@@ -597,6 +581,10 @@
         # Needed so that self[missing_item] does not raise KeyError
         return 0
 
+    def total(self):
+        'Sum of the counts'
+        return sum(self.values())
+
     def most_common(self, n=None):
         '''List the n most common elements and their counts from the most
         common to the least.  If n is None, then list all element counts.
@@ -608,7 +596,10 @@
         # Emulate Bag.sortedByCount from Smalltalk
         if n is None:
             return sorted(self.items(), key=_itemgetter(1), reverse=True)
-        return _heapq.nlargest(n, self.items(), key=_itemgetter(1))
+
+        # Lazy import to speedup Python startup time
+        import heapq
+        return heapq.nlargest(n, self.items(), key=_itemgetter(1))
 
     def elements(self):
         '''Iterator over elements repeating each as many times as its count.
@@ -719,6 +710,42 @@
         if elem in self:
             super().__delitem__(elem)
 
+    def __eq__(self, other):
+        'True if all counts agree. Missing counts are treated as zero.'
+        if not isinstance(other, Counter):
+            return NotImplemented
+        return all(self[e] == other[e] for c in (self, other) for e in c)
+
+    def __ne__(self, other):
+        'True if any counts disagree. Missing counts are treated as zero.'
+        if not isinstance(other, Counter):
+            return NotImplemented
+        return not self == other
+
+    def __le__(self, other):
+        'True if all counts in self are a subset of those in other.'
+        if not isinstance(other, Counter):
+            return NotImplemented
+        return all(self[e] <= other[e] for c in (self, other) for e in c)
+
+    def __lt__(self, other):
+        'True if all counts in self are a proper subset of those in other.'
+        if not isinstance(other, Counter):
+            return NotImplemented
+        return self <= other and self != other
+
+    def __ge__(self, other):
+        'True if all counts in self are a superset of those in other.'
+        if not isinstance(other, Counter):
+            return NotImplemented
+        return all(self[e] >= other[e] for c in (self, other) for e in c)
+
+    def __gt__(self, other):
+        'True if all counts in self are a proper superset of those in other.'
+        if not isinstance(other, Counter):
+            return NotImplemented
+        return self >= other and self != other
+
     def __repr__(self):
         if not self:
             return f'{self.__class__.__name__}()'
@@ -739,12 +766,30 @@
     # To strip negative and zero counts, add-in an empty counter:
     #       c += Counter()
     #
-    # Rich comparison operators for multiset subset and superset tests
-    # are deliberately omitted due to semantic conflicts with the
-    # existing inherited dict equality method.  Subset and superset
-    # semantics ignore zero counts and require that p≤q ∧ p≥q → p=q;
-    # however, that would not be the case for p=Counter(a=1, b=0)
-    # and q=Counter(a=1) where the dictionaries are not equal.
+    # Results are ordered according to when an element is first
+    # encountered in the left operand and then by the order
+    # encountered in the right operand.
+    #
+    # When the multiplicities are all zero or one, multiset operations
+    # are guaranteed to be equivalent to the corresponding operations
+    # for regular sets.
+    #     Given counter multisets such as:
+    #         cp = Counter(a=1, b=0, c=1)
+    #         cq = Counter(c=1, d=0, e=1)
+    #     The corresponding regular sets would be:
+    #         sp = {'a', 'c'}
+    #         sq = {'c', 'e'}
+    #     All of the following relations would hold:
+    #         set(cp + cq) == sp | sq
+    #         set(cp - cq) == sp - sq
+    #         set(cp | cq) == sp | sq
+    #         set(cp & cq) == sp & sq
+    #         (cp == cq) == (sp == sq)
+    #         (cp != cq) == (sp != sq)
+    #         (cp <= cq) == (sp <= sq)
+    #         (cp < cq) == (sp < sq)
+    #         (cp >= cq) == (sp >= sq)
+    #         (cp > cq) == (sp > sq)
 
     def __add__(self, other):
         '''Add counts from two counters.
@@ -973,12 +1018,15 @@
 
     __copy__ = copy
 
-    def new_child(self, m=None):                # like Django's Context.push()
+    def new_child(self, m=None, **kwargs):      # like Django's Context.push()
         '''New ChainMap with a new map followed by all previous maps.
         If no map is provided, an empty dict is used.
+        Keyword arguments update the map or new empty dict.
         '''
         if m is None:
-            m = {}
+            m = kwargs
+        elif kwargs:
+            m.update(kwargs)
         return self.__class__(m, *self.maps)
 
     @property
diff --git a/Lib/collections/abc.py b/Lib/collections/abc.py
index 891600d..86ca8b8 100644
--- a/Lib/collections/abc.py
+++ b/Lib/collections/abc.py
@@ -1,2 +1,3 @@
 from _collections_abc import *
 from _collections_abc import __all__
+from _collections_abc import _CallableGenericAlias
diff --git a/Lib/colorsys.py b/Lib/colorsys.py
index b93e384..0f52512 100644
--- a/Lib/colorsys.py
+++ b/Lib/colorsys.py
@@ -75,17 +75,18 @@
 def rgb_to_hls(r, g, b):
     maxc = max(r, g, b)
     minc = min(r, g, b)
-    # XXX Can optimize (maxc+minc) and (maxc-minc)
-    l = (minc+maxc)/2.0
+    sumc = (maxc+minc)
+    rangec = (maxc-minc)
+    l = sumc/2.0
     if minc == maxc:
         return 0.0, l, 0.0
     if l <= 0.5:
-        s = (maxc-minc) / (maxc+minc)
+        s = rangec / sumc
     else:
-        s = (maxc-minc) / (2.0-maxc-minc)
-    rc = (maxc-r) / (maxc-minc)
-    gc = (maxc-g) / (maxc-minc)
-    bc = (maxc-b) / (maxc-minc)
+        s = rangec / (2.0-sumc)
+    rc = (maxc-r) / rangec
+    gc = (maxc-g) / rangec
+    bc = (maxc-b) / rangec
     if r == maxc:
         h = bc-gc
     elif g == maxc:
diff --git a/Lib/compileall.py b/Lib/compileall.py
index fe7f450..3755e76 100644
--- a/Lib/compileall.py
+++ b/Lib/compileall.py
@@ -84,12 +84,14 @@
     if workers < 0:
         raise ValueError('workers must be greater or equal to 0')
     if workers != 1:
+        # Check if this is a system where ProcessPoolExecutor can function.
+        from concurrent.futures.process import _check_system_limits
         try:
-            # Only import when needed, as low resource platforms may
-            # fail to import it
-            from concurrent.futures import ProcessPoolExecutor
-        except ImportError:
+            _check_system_limits()
+        except NotImplementedError:
             workers = 1
+        else:
+            from concurrent.futures import ProcessPoolExecutor
     if maxlevels is None:
         maxlevels = sys.getrecursionlimit()
     files = _walk_dir(dir, quiet=quiet, maxlevels=maxlevels)
@@ -219,8 +221,8 @@
             if not force:
                 try:
                     mtime = int(os.stat(fullname).st_mtime)
-                    expect = struct.pack('<4sll', importlib.util.MAGIC_NUMBER,
-                                         0, mtime)
+                    expect = struct.pack('<4sLL', importlib.util.MAGIC_NUMBER,
+                                         0, mtime & 0xFFFF_FFFF)
                     for cfile in opt_cfiles.values():
                         with open(cfile, 'rb') as chandle:
                             actual = chandle.read(12)
@@ -252,9 +254,8 @@
                 else:
                     print('*** ', end='')
                 # escape non-printable characters in msg
-                msg = err.msg.encode(sys.stdout.encoding,
-                                     errors='backslashreplace')
-                msg = msg.decode(sys.stdout.encoding)
+                encoding = sys.stdout.encoding or sys.getdefaultencoding()
+                msg = err.msg.encode(encoding, errors='backslashreplace').decode(encoding)
                 print(msg)
             except (SyntaxError, UnicodeError, OSError) as e:
                 success = False
@@ -366,9 +367,9 @@
                               'environment variable is set, and '
                               '"timestamp" otherwise.'))
     parser.add_argument('-o', action='append', type=int, dest='opt_levels',
-                        help=('Optimization levels to run compilation with.'
-                              'Default is -1 which uses optimization level of'
-                              'Python interpreter itself (specified by -O).'))
+                        help=('Optimization levels to run compilation with. '
+                              'Default is -1 which uses the optimization level '
+                              'of the Python interpreter itself (see -O).'))
     parser.add_argument('-e', metavar='DIR', dest='limit_sl_dest',
                         help='Ignore symlinks pointing outsite of the DIR')
     parser.add_argument('--hardlink-dupes', action='store_true',
@@ -405,7 +406,8 @@
     # if flist is provided then load it
     if args.flist:
         try:
-            with (sys.stdin if args.flist=='-' else open(args.flist)) as f:
+            with (sys.stdin if args.flist=='-' else
+                    open(args.flist, encoding="utf-8")) as f:
                 for line in f:
                     compile_dests.append(line.strip())
         except OSError:
diff --git a/Lib/concurrent/futures/_base.py b/Lib/concurrent/futures/_base.py
index 00eb548..5c00f2e 100644
--- a/Lib/concurrent/futures/_base.py
+++ b/Lib/concurrent/futures/_base.py
@@ -284,13 +284,14 @@
         A named 2-tuple of sets. The first set, named 'done', contains the
         futures that completed (is finished or cancelled) before the wait
         completed. The second set, named 'not_done', contains uncompleted
-        futures.
+        futures. Duplicate futures given to *fs* are removed and will be 
+        returned only once.
     """
+    fs = set(fs)
     with _AcquireFutures(fs):
-        done = set(f for f in fs
-                   if f._state in [CANCELLED_AND_NOTIFIED, FINISHED])
-        not_done = set(fs) - done
-
+        done = {f for f in fs
+                   if f._state in [CANCELLED_AND_NOTIFIED, FINISHED]}
+        not_done = fs - done
         if (return_when == FIRST_COMPLETED) and done:
             return DoneAndNotDoneFutures(done, not_done)
         elif (return_when == FIRST_EXCEPTION) and done:
@@ -309,7 +310,7 @@
             f._waiters.remove(waiter)
 
     done.update(waiter.finished_futures)
-    return DoneAndNotDoneFutures(done, set(fs) - done)
+    return DoneAndNotDoneFutures(done, fs - done)
 
 class Future(object):
     """Represents the result of an asynchronous computation."""
@@ -386,7 +387,11 @@
 
     def __get_result(self):
         if self._exception:
-            raise self._exception
+            try:
+                raise self._exception
+            finally:
+                # Break a reference cycle with the exception in self._exception
+                self = None
         else:
             return self._result
 
@@ -426,20 +431,24 @@
                 timeout.
             Exception: If the call raised then that exception will be raised.
         """
-        with self._condition:
-            if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:
-                raise CancelledError()
-            elif self._state == FINISHED:
-                return self.__get_result()
+        try:
+            with self._condition:
+                if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:
+                    raise CancelledError()
+                elif self._state == FINISHED:
+                    return self.__get_result()
 
-            self._condition.wait(timeout)
+                self._condition.wait(timeout)
 
-            if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:
-                raise CancelledError()
-            elif self._state == FINISHED:
-                return self.__get_result()
-            else:
-                raise TimeoutError()
+                if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:
+                    raise CancelledError()
+                elif self._state == FINISHED:
+                    return self.__get_result()
+                else:
+                    raise TimeoutError()
+        finally:
+            # Break a reference cycle with the exception in self._exception
+            self = None
 
     def exception(self, timeout=None):
         """Return the exception raised by the call that the future represents.
diff --git a/Lib/concurrent/futures/process.py b/Lib/concurrent/futures/process.py
index 90bc98b..6ee2ce6 100644
--- a/Lib/concurrent/futures/process.py
+++ b/Lib/concurrent/futures/process.py
@@ -373,7 +373,7 @@
         assert not self.thread_wakeup._closed
         wakeup_reader = self.thread_wakeup._reader
         readers = [result_reader, wakeup_reader]
-        worker_sentinels = [p.sentinel for p in self.processes.values()]
+        worker_sentinels = [p.sentinel for p in list(self.processes.values())]
         ready = mp.connection.wait(readers + worker_sentinels)
 
         cause = None
@@ -533,6 +533,14 @@
             raise NotImplementedError(_system_limited)
     _system_limits_checked = True
     try:
+        import multiprocessing.synchronize
+    except ImportError:
+        _system_limited = (
+            "This Python build lacks multiprocessing.synchronize, usually due "
+            "to named semaphores being unavailable on this platform."
+        )
+        raise NotImplementedError(_system_limited)
+    try:
         nsems_max = os.sysconf("SC_SEM_NSEMS_MAX")
     except (AttributeError, ValueError):
         # sysconf not available or setting not available
diff --git a/Lib/concurrent/futures/thread.py b/Lib/concurrent/futures/thread.py
index b7a2cac..51c942f 100644
--- a/Lib/concurrent/futures/thread.py
+++ b/Lib/concurrent/futures/thread.py
@@ -36,6 +36,12 @@
 # See bpo-39812 for context.
 threading._register_atexit(_python_exit)
 
+# At fork, reinitialize the `_global_shutdown_lock` lock in the child process
+if hasattr(os, 'register_at_fork'):
+    os.register_at_fork(before=_global_shutdown_lock.acquire,
+                        after_in_child=_global_shutdown_lock._at_fork_reinit,
+                        after_in_parent=_global_shutdown_lock.release)
+
 
 class _WorkItem(object):
     def __init__(self, future, fn, args, kwargs):
diff --git a/Lib/configparser.py b/Lib/configparser.py
index 924cc56..3470624 100644
--- a/Lib/configparser.py
+++ b/Lib/configparser.py
@@ -316,7 +316,7 @@
     def filename(self):
         """Deprecated, use `source'."""
         warnings.warn(
-            "The 'filename' attribute will be removed in future versions.  "
+            "The 'filename' attribute will be removed in Python 3.12. "
             "Use 'source' instead.",
             DeprecationWarning, stacklevel=2
         )
@@ -326,7 +326,7 @@
     def filename(self, value):
         """Deprecated, user `source'."""
         warnings.warn(
-            "The 'filename' attribute will be removed in future versions.  "
+            "The 'filename' attribute will be removed in Python 3.12. "
             "Use 'source' instead.",
             DeprecationWarning, stacklevel=2
         )
@@ -563,7 +563,7 @@
     # Regular expressions for parsing section headers and options
     _SECT_TMPL = r"""
         \[                                 # [
-        (?P<header>[^]]+)                  # very permissive!
+        (?P<header>.+)                     # very permissive!
         \]                                 # ]
         """
     _OPT_TMPL = r"""
@@ -690,6 +690,7 @@
         """
         if isinstance(filenames, (str, bytes, os.PathLike)):
             filenames = [filenames]
+        encoding = io.text_encoding(encoding)
         read_ok = []
         for filename in filenames:
             try:
@@ -756,7 +757,7 @@
     def readfp(self, fp, filename=None):
         """Deprecated, use read_file instead."""
         warnings.warn(
-            "This method will be removed in future versions.  "
+            "This method will be removed in Python 3.12. "
             "Use 'parser.read_file()' instead.",
             DeprecationWarning, stacklevel=2
         )
@@ -907,6 +908,9 @@
 
         If `space_around_delimiters' is True (the default), delimiters
         between keys and values are surrounded by spaces.
+
+        Please note that comments in the original configuration file are not
+        preserved when writing the configuration back.
         """
         if space_around_delimiters:
             d = " {} ".format(self._delimiters[0])
@@ -1005,7 +1009,7 @@
         Configuration files may include comments, prefixed by specific
         characters (`#' and `;' by default). Comments may appear on their own
         in an otherwise empty line or may be entered in lines holding values or
-        section names.
+        section names. Please note that comments get stripped off when reading configuration files.
         """
         elements_added = set()
         cursect = None                        # None, or a dictionary
@@ -1228,7 +1232,7 @@
         super().__init__(*args, **kwargs)
         warnings.warn(
             "The SafeConfigParser class has been renamed to ConfigParser "
-            "in Python 3.2. This alias will be removed in future versions."
+            "in Python 3.2. This alias will be removed in Python 3.12."
             " Use ConfigParser directly instead.",
             DeprecationWarning, stacklevel=2
         )
diff --git a/Lib/contextlib.py b/Lib/contextlib.py
index ff92d9f..c63a849 100644
--- a/Lib/contextlib.py
+++ b/Lib/contextlib.py
@@ -9,7 +9,7 @@
 __all__ = ["asynccontextmanager", "contextmanager", "closing", "nullcontext",
            "AbstractContextManager", "AbstractAsyncContextManager",
            "AsyncExitStack", "ContextDecorator", "ExitStack",
-           "redirect_stdout", "redirect_stderr", "suppress"]
+           "redirect_stdout", "redirect_stderr", "suppress", "aclosing"]
 
 
 class AbstractContextManager(abc.ABC):
@@ -80,6 +80,22 @@
         return inner
 
 
+class AsyncContextDecorator(object):
+    "A base class or mixin that enables async context managers to work as decorators."
+
+    def _recreate_cm(self):
+        """Return a recreated instance of self.
+        """
+        return self
+
+    def __call__(self, func):
+        @wraps(func)
+        async def inner(*args, **kwds):
+            async with self._recreate_cm():
+                return await func(*args, **kwds)
+        return inner
+
+
 class _GeneratorContextManagerBase:
     """Shared functionality for @contextmanager and @asynccontextmanager."""
 
@@ -97,18 +113,20 @@
         # for the class instead.
         # See http://bugs.python.org/issue19404 for more details.
 
-
-class _GeneratorContextManager(_GeneratorContextManagerBase,
-                               AbstractContextManager,
-                               ContextDecorator):
-    """Helper for @contextmanager decorator."""
-
     def _recreate_cm(self):
-        # _GCM instances are one-shot context managers, so the
+        # _GCMB instances are one-shot context managers, so the
         # CM must be recreated each time a decorated function is
         # called
         return self.__class__(self.func, self.args, self.kwds)
 
+
+class _GeneratorContextManager(
+    _GeneratorContextManagerBase,
+    AbstractContextManager,
+    ContextDecorator,
+):
+    """Helper for @contextmanager decorator."""
+
     def __enter__(self):
         # do not keep args and kwds alive unnecessarily
         # they are only needed for recreation, which is not possible anymore
@@ -118,8 +136,8 @@
         except StopIteration:
             raise RuntimeError("generator didn't yield") from None
 
-    def __exit__(self, type, value, traceback):
-        if type is None:
+    def __exit__(self, typ, value, traceback):
+        if typ is None:
             try:
                 next(self.gen)
             except StopIteration:
@@ -130,9 +148,9 @@
             if value is None:
                 # Need to force instantiation so we can reliably
                 # tell if we get the same exception back
-                value = type()
+                value = typ()
             try:
-                self.gen.throw(type, value, traceback)
+                self.gen.throw(typ, value, traceback)
             except StopIteration as exc:
                 # Suppress StopIteration *unless* it's the same exception that
                 # was passed to throw().  This prevents a StopIteration
@@ -142,74 +160,93 @@
                 # Don't re-raise the passed in exception. (issue27122)
                 if exc is value:
                     return False
-                # Likewise, avoid suppressing if a StopIteration exception
+                # Avoid suppressing if a StopIteration exception
                 # was passed to throw() and later wrapped into a RuntimeError
-                # (see PEP 479).
-                if type is StopIteration and exc.__cause__ is value:
+                # (see PEP 479 for sync generators; async generators also
+                # have this behavior). But do this only if the exception wrapped
+                # by the RuntimeError is actually Stop(Async)Iteration (see
+                # issue29692).
+                if (
+                    isinstance(value, StopIteration)
+                    and exc.__cause__ is value
+                ):
                     return False
                 raise
-            except:
+            except BaseException as exc:
                 # only re-raise if it's *not* the exception that was
                 # passed to throw(), because __exit__() must not raise
                 # an exception unless __exit__() itself failed.  But throw()
                 # has to raise the exception to signal propagation, so this
                 # fixes the impedance mismatch between the throw() protocol
                 # and the __exit__() protocol.
-                #
-                # This cannot use 'except BaseException as exc' (as in the
-                # async implementation) to maintain compatibility with
-                # Python 2, where old-style class exceptions are not caught
-                # by 'except BaseException'.
-                if sys.exc_info()[1] is value:
-                    return False
-                raise
+                if exc is not value:
+                    raise
+                return False
             raise RuntimeError("generator didn't stop after throw()")
 
-
-class _AsyncGeneratorContextManager(_GeneratorContextManagerBase,
-                                    AbstractAsyncContextManager):
-    """Helper for @asynccontextmanager."""
+class _AsyncGeneratorContextManager(
+    _GeneratorContextManagerBase,
+    AbstractAsyncContextManager,
+    AsyncContextDecorator,
+):
+    """Helper for @asynccontextmanager decorator."""
 
     async def __aenter__(self):
+        # do not keep args and kwds alive unnecessarily
+        # they are only needed for recreation, which is not possible anymore
+        del self.args, self.kwds, self.func
         try:
-            return await self.gen.__anext__()
+            return await anext(self.gen)
         except StopAsyncIteration:
             raise RuntimeError("generator didn't yield") from None
 
     async def __aexit__(self, typ, value, traceback):
         if typ is None:
             try:
-                await self.gen.__anext__()
+                await anext(self.gen)
             except StopAsyncIteration:
-                return
+                return False
             else:
                 raise RuntimeError("generator didn't stop")
         else:
             if value is None:
+                # Need to force instantiation so we can reliably
+                # tell if we get the same exception back
                 value = typ()
-            # See _GeneratorContextManager.__exit__ for comments on subtleties
-            # in this implementation
             try:
                 await self.gen.athrow(typ, value, traceback)
-                raise RuntimeError("generator didn't stop after athrow()")
             except StopAsyncIteration as exc:
+                # Suppress StopIteration *unless* it's the same exception that
+                # was passed to throw().  This prevents a StopIteration
+                # raised inside the "with" statement from being suppressed.
                 return exc is not value
             except RuntimeError as exc:
+                # Don't re-raise the passed in exception. (issue27122)
                 if exc is value:
                     return False
-                # Avoid suppressing if a StopIteration exception
-                # was passed to throw() and later wrapped into a RuntimeError
+                # Avoid suppressing if a Stop(Async)Iteration exception
+                # was passed to athrow() and later wrapped into a RuntimeError
                 # (see PEP 479 for sync generators; async generators also
                 # have this behavior). But do this only if the exception wrapped
                 # by the RuntimeError is actully Stop(Async)Iteration (see
                 # issue29692).
-                if isinstance(value, (StopIteration, StopAsyncIteration)):
-                    if exc.__cause__ is value:
-                        return False
+                if (
+                    isinstance(value, (StopIteration, StopAsyncIteration))
+                    and exc.__cause__ is value
+                ):
+                    return False
                 raise
             except BaseException as exc:
+                # only re-raise if it's *not* the exception that was
+                # passed to throw(), because __exit__() must not raise
+                # an exception unless __exit__() itself failed.  But throw()
+                # has to raise the exception to signal propagation, so this
+                # fixes the impedance mismatch between the throw() protocol
+                # and the __exit__() protocol.
                 if exc is not value:
                     raise
+                return False
+            raise RuntimeError("generator didn't stop after athrow()")
 
 
 def contextmanager(func):
@@ -303,6 +340,32 @@
         self.thing.close()
 
 
+class aclosing(AbstractAsyncContextManager):
+    """Async context manager for safely finalizing an asynchronously cleaned-up
+    resource such as an async generator, calling its ``aclose()`` method.
+
+    Code like this:
+
+        async with aclosing(<module>.fetch(<arguments>)) as agen:
+            <block>
+
+    is equivalent to this:
+
+        agen = <module>.fetch(<arguments>)
+        try:
+            <block>
+        finally:
+            await agen.aclose()
+
+    """
+    def __init__(self, thing):
+        self.thing = thing
+    async def __aenter__(self):
+        return self.thing
+    async def __aexit__(self, *exc_info):
+        await self.thing.aclose()
+
+
 class _RedirectStream(AbstractContextManager):
 
     _stream = None
@@ -477,10 +540,10 @@
             # Context may not be correct, so find the end of the chain
             while 1:
                 exc_context = new_exc.__context__
-                if exc_context is old_exc:
+                if exc_context is None or exc_context is old_exc:
                     # Context is already set correctly (see issue 20317)
                     return
-                if exc_context is None or exc_context is frame_exc:
+                if exc_context is frame_exc:
                     break
                 new_exc = exc_context
             # Change the end of the chain to point to the exception
@@ -611,10 +674,10 @@
             # Context may not be correct, so find the end of the chain
             while 1:
                 exc_context = new_exc.__context__
-                if exc_context is old_exc:
+                if exc_context is None or exc_context is old_exc:
                     # Context is already set correctly (see issue 20317)
                     return
-                if exc_context is None or exc_context is frame_exc:
+                if exc_context is frame_exc:
                     break
                 new_exc = exc_context
             # Change the end of the chain to point to the exception
@@ -655,7 +718,7 @@
         return received_exc and suppressed_exc
 
 
-class nullcontext(AbstractContextManager):
+class nullcontext(AbstractContextManager, AbstractAsyncContextManager):
     """Context manager that does no additional processing.
 
     Used as a stand-in for a normal context manager, when a particular
@@ -674,3 +737,9 @@
 
     def __exit__(self, *excinfo):
         pass
+
+    async def __aenter__(self):
+        return self.enter_result
+
+    async def __aexit__(self, *excinfo):
+        pass
diff --git a/Lib/copy.py b/Lib/copy.py
index 41873f2..69bac98 100644
--- a/Lib/copy.py
+++ b/Lib/copy.py
@@ -39,8 +39,8 @@
     set of components copied
 
 This version does not copy types like module, class, function, method,
-nor stack trace, stack frame, nor file, socket, window, nor array, nor
-any similar types.
+nor stack trace, stack frame, nor file, socket, window, nor any
+similar types.
 
 Classes can use the same interfaces to control copying that they use
 to control pickling: they can define methods called __getinitargs__(),
@@ -192,6 +192,7 @@
 d[str] = _deepcopy_atomic
 d[types.CodeType] = _deepcopy_atomic
 d[type] = _deepcopy_atomic
+d[range] = _deepcopy_atomic
 d[types.BuiltinFunctionType] = _deepcopy_atomic
 d[types.FunctionType] = _deepcopy_atomic
 d[weakref.ref] = _deepcopy_atomic
diff --git a/Lib/copyreg.py b/Lib/copyreg.py
index 7ab8c12..356db6f 100644
--- a/Lib/copyreg.py
+++ b/Lib/copyreg.py
@@ -36,6 +36,12 @@
 
     pickle(complex, pickle_complex, complex)
 
+def pickle_union(obj):
+    import functools, operator
+    return functools.reduce, (operator.or_, obj.__args__)
+
+pickle(type(int | str), pickle_union)
+
 # Support for pickling new-style objects
 
 def _reconstructor(cls, base, state):
diff --git a/Lib/csv.py b/Lib/csv.py
index dc85077..bb3ee26 100644
--- a/Lib/csv.py
+++ b/Lib/csv.py
@@ -409,14 +409,10 @@
                 continue # skip rows that have irregular number of columns
 
             for col in list(columnTypes.keys()):
-
-                for thisType in [int, float, complex]:
-                    try:
-                        thisType(row[col])
-                        break
-                    except (ValueError, OverflowError):
-                        pass
-                else:
+                thisType = complex
+                try:
+                    thisType(row[col])
+                except (ValueError, OverflowError):
                     # fallback to length of string
                     thisType = len(row[col])
 
diff --git a/Lib/ctypes/_aix.py b/Lib/ctypes/_aix.py
index 190cac6..fc3e95c 100644
--- a/Lib/ctypes/_aix.py
+++ b/Lib/ctypes/_aix.py
@@ -163,7 +163,7 @@
             return member
     else:
         # 32-bit legacy names - both shr.o and shr4.o exist.
-        # shr.o is the preffered name so we look for shr.o first
+        # shr.o is the preferred name so we look for shr.o first
         #  i.e., shr4.o is returned only when shr.o does not exist
         for name in ['shr.o', 'shr4.o']:
             member = get_one_match(re.escape(name), members)
@@ -282,7 +282,7 @@
         if path.exists(archive):
             members = get_shared(get_ld_headers(archive))
             member = get_member(re.escape(name), members)
-            if member != None:
+            if member is not None:
                 return (base, member)
             else:
                 return (None, None)
@@ -307,7 +307,7 @@
 
     libpaths = get_libpaths()
     (base, member) = find_shared(libpaths, name)
-    if base != None:
+    if base is not None:
         return f"{base}({member})"
 
     # To get here, a member in an archive has not been found
diff --git a/Lib/ctypes/test/__init__.py b/Lib/ctypes/test/__init__.py
index 26a70b7..6e496fa 100644
--- a/Lib/ctypes/test/__init__.py
+++ b/Lib/ctypes/test/__init__.py
@@ -1,9 +1,11 @@
 import os
 import unittest
 from test import support
+from test.support import import_helper
+
 
 # skip tests if _ctypes was not built
-ctypes = support.import_module('ctypes')
+ctypes = import_helper.import_module('ctypes')
 ctypes_symbols = dir(ctypes)
 
 def need_symbol(name):
diff --git a/Lib/ctypes/test/test_bitfields.py b/Lib/ctypes/test/test_bitfields.py
index 992b8c4..66acd62 100644
--- a/Lib/ctypes/test/test_bitfields.py
+++ b/Lib/ctypes/test/test_bitfields.py
@@ -1,5 +1,6 @@
 from ctypes import *
 from ctypes.test import need_symbol
+from test import support
 import unittest
 import os
 
@@ -39,6 +40,8 @@
                 setattr(b, name, i)
                 self.assertEqual(getattr(b, name), func(byref(b), name.encode('ascii')))
 
+    # bpo-46913: _ctypes/cfield.c h_get() has an undefined behavior
+    @support.skip_if_sanitizer(ub=True)
     def test_shorts(self):
         b = BITS()
         name = "M"
diff --git a/Lib/ctypes/test/test_find.py b/Lib/ctypes/test/test_find.py
index 92ac184..1ff9d01 100644
--- a/Lib/ctypes/test/test_find.py
+++ b/Lib/ctypes/test/test_find.py
@@ -3,6 +3,7 @@
 import os.path
 import sys
 import test.support
+from test.support import os_helper
 from ctypes import *
 from ctypes.util import find_library
 
@@ -66,8 +67,8 @@
         self.gle.gleGetJoinStyle
 
     def test_shell_injection(self):
-        result = find_library('; echo Hello shell > ' + test.support.TESTFN)
-        self.assertFalse(os.path.lexists(test.support.TESTFN))
+        result = find_library('; echo Hello shell > ' + os_helper.TESTFN)
+        self.assertFalse(os.path.lexists(os_helper.TESTFN))
         self.assertIsNone(result)
 
 
@@ -89,7 +90,7 @@
             srcname = os.path.join(d, 'dummy.c')
             libname = 'py_ctypes_test_dummy'
             dstname = os.path.join(d, 'lib%s.so' % libname)
-            with open(srcname, 'w') as f:
+            with open(srcname, 'wb') as f:
                 pass
             self.assertTrue(os.path.exists(srcname))
             # compile the file to a shared library
@@ -101,7 +102,7 @@
             # LD_LIBRARY_PATH)
             self.assertIsNone(find_library(libname))
             # now add the location to LD_LIBRARY_PATH
-            with test.support.EnvironmentVarGuard() as env:
+            with os_helper.EnvironmentVarGuard() as env:
                 KEY = 'LD_LIBRARY_PATH'
                 if KEY not in env:
                     v = d
diff --git a/Lib/ctypes/test/test_functions.py b/Lib/ctypes/test/test_functions.py
index 7562892..bdb044e 100644
--- a/Lib/ctypes/test/test_functions.py
+++ b/Lib/ctypes/test/test_functions.py
@@ -35,34 +35,24 @@
         # wasn't checked, and it even crashed Python.
         # Found by Greg Chapman.
 
-        try:
+        with self.assertRaises(TypeError):
             class X(object, Array):
                 _length_ = 5
                 _type_ = "i"
-        except TypeError:
-            pass
-
 
         from _ctypes import _Pointer
-        try:
+        with self.assertRaises(TypeError):
             class X(object, _Pointer):
                 pass
-        except TypeError:
-            pass
 
         from _ctypes import _SimpleCData
-        try:
+        with self.assertRaises(TypeError):
             class X(object, _SimpleCData):
                 _type_ = "i"
-        except TypeError:
-            pass
 
-        try:
+        with self.assertRaises(TypeError):
             class X(object, Structure):
                 _fields_ = []
-        except TypeError:
-            pass
-
 
     @need_symbol('c_wchar')
     def test_wchar_parm(self):
@@ -389,7 +379,7 @@
                 (9*2, 8*3, 7*4, 6*5, 5*6, 4*7, 3*8, 2*9))
 
     def test_sf1651235(self):
-        # see http://www.python.org/sf/1651235
+        # see https://www.python.org/sf/1651235
 
         proto = CFUNCTYPE(c_int, RECT, POINT)
         def callback(*args):
diff --git a/Lib/ctypes/test/test_loading.py b/Lib/ctypes/test/test_loading.py
index ba655bc..ea89227 100644
--- a/Lib/ctypes/test/test_loading.py
+++ b/Lib/ctypes/test/test_loading.py
@@ -5,6 +5,8 @@
 import sys
 import unittest
 import test.support
+from test.support import import_helper
+from test.support import os_helper
 from ctypes.util import find_library
 
 libc_name = None
@@ -91,7 +93,7 @@
         # NOT fit into a 32-bit integer.  FreeLibrary must be able
         # to accept this address.
 
-        # These are tests for http://www.python.org/sf/1703286
+        # These are tests for https://www.python.org/sf/1703286
         handle = LoadLibrary("advapi32")
         FreeLibrary(handle)
 
@@ -117,14 +119,14 @@
     @unittest.skipUnless(os.name == "nt",
                          'test specific to Windows')
     def test_load_dll_with_flags(self):
-        _sqlite3 = test.support.import_module("_sqlite3")
+        _sqlite3 = import_helper.import_module("_sqlite3")
         src = _sqlite3.__file__
         if src.lower().endswith("_d.pyd"):
             ext = "_d.dll"
         else:
             ext = ".dll"
 
-        with test.support.temp_dir() as tmp:
+        with os_helper.temp_dir() as tmp:
             # We copy two files and load _sqlite3.dll (formerly .pyd),
             # which has a dependency on sqlite3.dll. Then we test
             # loading it in subprocesses to avoid it starting in memory
diff --git a/Lib/ctypes/test/test_numbers.py b/Lib/ctypes/test/test_numbers.py
index c6d843b..db500e8 100644
--- a/Lib/ctypes/test/test_numbers.py
+++ b/Lib/ctypes/test/test_numbers.py
@@ -134,8 +134,7 @@
         for t in signed_types + unsigned_types:
             self.assertRaises(TypeError, t, 3.14)
             self.assertRaises(TypeError, t, f)
-            with self.assertWarns(DeprecationWarning):
-                self.assertEqual(t(d).value, 2)
+            self.assertRaises(TypeError, t, d)
             self.assertEqual(t(i).value, 2)
 
     def test_sizes(self):
diff --git a/Lib/ctypes/test/test_parameters.py b/Lib/ctypes/test/test_parameters.py
index e4c25fd..38af7ac 100644
--- a/Lib/ctypes/test/test_parameters.py
+++ b/Lib/ctypes/test/test_parameters.py
@@ -201,6 +201,49 @@
         with self.assertRaises(ZeroDivisionError):
             WorseStruct().__setstate__({}, b'foo')
 
+    def test_parameter_repr(self):
+        from ctypes import (
+            c_bool,
+            c_char,
+            c_wchar,
+            c_byte,
+            c_ubyte,
+            c_short,
+            c_ushort,
+            c_int,
+            c_uint,
+            c_long,
+            c_ulong,
+            c_longlong,
+            c_ulonglong,
+            c_float,
+            c_double,
+            c_longdouble,
+            c_char_p,
+            c_wchar_p,
+            c_void_p,
+        )
+        self.assertRegex(repr(c_bool.from_param(True)), r"^<cparam '\?' at 0x[A-Fa-f0-9]+>$")
+        self.assertEqual(repr(c_char.from_param(97)), "<cparam 'c' ('a')>")
+        self.assertRegex(repr(c_wchar.from_param('a')), r"^<cparam 'u' at 0x[A-Fa-f0-9]+>$")
+        self.assertEqual(repr(c_byte.from_param(98)), "<cparam 'b' (98)>")
+        self.assertEqual(repr(c_ubyte.from_param(98)), "<cparam 'B' (98)>")
+        self.assertEqual(repr(c_short.from_param(511)), "<cparam 'h' (511)>")
+        self.assertEqual(repr(c_ushort.from_param(511)), "<cparam 'H' (511)>")
+        self.assertRegex(repr(c_int.from_param(20000)), r"^<cparam '[li]' \(20000\)>$")
+        self.assertRegex(repr(c_uint.from_param(20000)), r"^<cparam '[LI]' \(20000\)>$")
+        self.assertRegex(repr(c_long.from_param(20000)), r"^<cparam '[li]' \(20000\)>$")
+        self.assertRegex(repr(c_ulong.from_param(20000)), r"^<cparam '[LI]' \(20000\)>$")
+        self.assertRegex(repr(c_longlong.from_param(20000)), r"^<cparam '[liq]' \(20000\)>$")
+        self.assertRegex(repr(c_ulonglong.from_param(20000)), r"^<cparam '[LIQ]' \(20000\)>$")
+        self.assertEqual(repr(c_float.from_param(1.5)), "<cparam 'f' (1.5)>")
+        self.assertEqual(repr(c_double.from_param(1.5)), "<cparam 'd' (1.5)>")
+        self.assertEqual(repr(c_double.from_param(1e300)), "<cparam 'd' (1e+300)>")
+        self.assertRegex(repr(c_longdouble.from_param(1.5)), r"^<cparam ('d' \(1.5\)|'g' at 0x[A-Fa-f0-9]+)>$")
+        self.assertRegex(repr(c_char_p.from_param(b'hihi')), r"^<cparam 'z' \(0x[A-Fa-f0-9]+\)>$")
+        self.assertRegex(repr(c_wchar_p.from_param('hihi')), r"^<cparam 'Z' \(0x[A-Fa-f0-9]+\)>$")
+        self.assertRegex(repr(c_void_p.from_param(0x12)), r"^<cparam 'P' \(0x0*12\)>$")
+
 ################################################################
 
 if __name__ == '__main__':
diff --git a/Lib/ctypes/test/test_python_api.py b/Lib/ctypes/test/test_python_api.py
index 9c13746..49571f9 100644
--- a/Lib/ctypes/test/test_python_api.py
+++ b/Lib/ctypes/test/test_python_api.py
@@ -1,5 +1,5 @@
 from ctypes import *
-import unittest, sys
+import unittest
 from test import support
 
 ################################################################
@@ -10,10 +10,6 @@
 ################################################################
 
 from sys import getrefcount as grc
-if sys.version_info > (2, 4):
-    c_py_ssize_t = c_size_t
-else:
-    c_py_ssize_t = c_int
 
 class PythonAPITestCase(unittest.TestCase):
 
@@ -21,7 +17,7 @@
         PyBytes_FromStringAndSize = pythonapi.PyBytes_FromStringAndSize
 
         PyBytes_FromStringAndSize.restype = py_object
-        PyBytes_FromStringAndSize.argtypes = c_char_p, c_py_ssize_t
+        PyBytes_FromStringAndSize.argtypes = c_char_p, c_size_t
 
         self.assertEqual(PyBytes_FromStringAndSize(b"abcdefghi", 3), b"abc")
 
diff --git a/Lib/ctypes/test/test_struct_fields.py b/Lib/ctypes/test/test_struct_fields.py
index 8045cc8..ee8415f 100644
--- a/Lib/ctypes/test/test_struct_fields.py
+++ b/Lib/ctypes/test/test_struct_fields.py
@@ -46,6 +46,14 @@
         Y._fields_ = []
         self.assertRaises(AttributeError, setattr, X, "_fields_", [])
 
+    def test_5(self):
+        class X(Structure):
+            _fields_ = (("char", c_char * 5),)
+
+        x = X(b'#' * 5)
+        x.char = b'a\0b\0'
+        self.assertEqual(bytes(x), b'a\x00###')
+
     # __set__ and __get__ should raise a TypeError in case their self
     # argument is not a ctype instance.
     def test___set__(self):
diff --git a/Lib/ctypes/test/test_structures.py b/Lib/ctypes/test/test_structures.py
index 245cd94..97ad2b8 100644
--- a/Lib/ctypes/test/test_structures.py
+++ b/Lib/ctypes/test/test_structures.py
@@ -443,7 +443,7 @@
 
         s = Test(1, 2, 3)
         # Test the StructUnionType_paramfunc() code path which copies the
-        # structure: if the stucture is larger than sizeof(void*).
+        # structure: if the structure is larger than sizeof(void*).
         self.assertGreater(sizeof(s), sizeof(c_void_p))
 
         dll = CDLL(_ctypes_test.__file__)
@@ -451,7 +451,7 @@
         func.argtypes = (Test,)
         func.restype = None
         func(s)
-        # bpo-37140: Passing the structure by refrence must not call
+        # bpo-37140: Passing the structure by reference must not call
         # its finalizer!
         self.assertEqual(finalizer_calls, [])
         self.assertEqual(s.first, 1)
diff --git a/Lib/ctypes/test/test_unicode.py b/Lib/ctypes/test/test_unicode.py
index c200af7..60c7542 100644
--- a/Lib/ctypes/test/test_unicode.py
+++ b/Lib/ctypes/test/test_unicode.py
@@ -26,6 +26,14 @@
         self.assertEqual(buf[::2], 'a\xe4\xfc')
         self.assertEqual(buf[6:5:-1], "")
 
+    def test_embedded_null(self):
+        class TestStruct(ctypes.Structure):
+            _fields_ = [("unicode", ctypes.c_wchar_p)]
+        t = TestStruct()
+        # This would raise a ValueError:
+        t.unicode = "foo\0bar\0\0"
+
+
 func = ctypes.CDLL(_ctypes_test.__file__)._testfunc_p_p
 
 class StringTestCase(UnicodeTestCase):
diff --git a/Lib/ctypes/test/test_values.py b/Lib/ctypes/test/test_values.py
index 87eb919..7514fe8 100644
--- a/Lib/ctypes/test/test_values.py
+++ b/Lib/ctypes/test/test_values.py
@@ -80,9 +80,9 @@
                 continue
             items.append((entry.name.decode("ascii"), entry.size))
 
-        expected = [("__hello__", 141),
-                    ("__phello__", -141),
-                    ("__phello__.spam", 141),
+        expected = [("__hello__", 137),
+                    ("__phello__", -137),
+                    ("__phello__.spam", 137),
                     ]
         self.assertEqual(items, expected, "PyImport_FrozenModules example "
             "in Doc/library/ctypes.rst may be out of date")
diff --git a/Lib/dataclasses.py b/Lib/dataclasses.py
index 530d3e9..105a95b 100644
--- a/Lib/dataclasses.py
+++ b/Lib/dataclasses.py
@@ -6,8 +6,9 @@
 import keyword
 import builtins
 import functools
+import abc
 import _thread
-from types import GenericAlias
+from types import FunctionType, GenericAlias
 
 
 __all__ = ['dataclass',
@@ -15,6 +16,7 @@
            'Field',
            'FrozenInstanceError',
            'InitVar',
+           'KW_ONLY',
            'MISSING',
 
            # Helper functions.
@@ -151,6 +153,20 @@
 #
 # See _hash_action (below) for a coded version of this table.
 
+# __match_args__
+#
+#    +--- match_args= parameter
+#    |
+#    v    |       |       |
+#         |  no   |  yes  |  <--- class has __match_args__ in __dict__?
+# +=======+=======+=======+
+# | False |       |       |
+# +-------+-------+-------+
+# | True  | add   |       |  <- the default
+# +=======+=======+=======+
+# __match_args__ is always added unless the class already defines it. It is a
+# tuple of __init__ parameter names; non-init fields must be matched by keyword.
+
 
 # Raised when an attempt is made to modify a frozen class.
 class FrozenInstanceError(AttributeError): pass
@@ -169,6 +185,12 @@
     pass
 MISSING = _MISSING_TYPE()
 
+# A sentinel object to indicate that following fields are keyword-only by
+# default.  Use a class to give it a better repr.
+class _KW_ONLY_TYPE:
+    pass
+KW_ONLY = _KW_ONLY_TYPE()
+
 # Since most per-field metadata will be unused, create an empty
 # read-only proxy that can be shared among all fields.
 _EMPTY_METADATA = types.MappingProxyType({})
@@ -207,7 +229,7 @@
         self.type = type
 
     def __repr__(self):
-        if isinstance(self.type, type):
+        if isinstance(self.type, type) and not isinstance(self.type, GenericAlias):
             type_name = self.type.__name__
         else:
             # typing objects, e.g. List[int]
@@ -217,7 +239,6 @@
     def __class_getitem__(cls, type):
         return InitVar(type)
 
-
 # Instances of Field are only ever created from within this module,
 # and only from the field() function, although Field instances are
 # exposed externally as (conceptually) read-only objects.
@@ -238,11 +259,12 @@
                  'init',
                  'compare',
                  'metadata',
+                 'kw_only',
                  '_field_type',  # Private: not to be used by user code.
                  )
 
     def __init__(self, default, default_factory, init, repr, hash, compare,
-                 metadata):
+                 metadata, kw_only):
         self.name = None
         self.type = None
         self.default = default
@@ -254,6 +276,7 @@
         self.metadata = (_EMPTY_METADATA
                          if metadata is None else
                          types.MappingProxyType(metadata))
+        self.kw_only = kw_only
         self._field_type = None
 
     def __repr__(self):
@@ -267,6 +290,7 @@
                 f'hash={self.hash!r},'
                 f'compare={self.compare!r},'
                 f'metadata={self.metadata!r},'
+                f'kw_only={self.kw_only!r},'
                 f'_field_type={self._field_type}'
                 ')')
 
@@ -320,17 +344,19 @@
 # so that a type checker can be told (via overloads) that this is a
 # function whose type depends on its parameters.
 def field(*, default=MISSING, default_factory=MISSING, init=True, repr=True,
-          hash=None, compare=True, metadata=None):
+          hash=None, compare=True, metadata=None, kw_only=MISSING):
     """Return an object to identify dataclass fields.
 
     default is the default value of the field.  default_factory is a
     0-argument function called to initialize a field's value.  If init
-    is True, the field will be a parameter to the class's __init__()
-    function.  If repr is True, the field will be included in the
-    object's repr().  If hash is True, the field will be included in
-    the object's hash().  If compare is True, the field will be used
-    in comparison functions.  metadata, if specified, must be a
-    mapping which is stored but not otherwise examined by dataclass.
+    is true, the field will be a parameter to the class's __init__()
+    function.  If repr is true, the field will be included in the
+    object's repr().  If hash is true, the field will be included in the
+    object's hash().  If compare is true, the field will be used in
+    comparison functions.  metadata, if specified, must be a mapping
+    which is stored but not otherwise examined by dataclass.  If kw_only
+    is true, the field will become a keyword-only parameter to
+    __init__().
 
     It is an error to specify both default and default_factory.
     """
@@ -338,7 +364,16 @@
     if default is not MISSING and default_factory is not MISSING:
         raise ValueError('cannot specify both default and default_factory')
     return Field(default, default_factory, init, repr, hash, compare,
-                 metadata)
+                 metadata, kw_only)
+
+
+def _fields_in_init_order(fields):
+    # Returns the fields as __init__ will output them.  It returns 2 tuples:
+    # the first for normal args, and the second for keyword args.
+
+    return (tuple(f for f in fields if f.init and not f.kw_only),
+            tuple(f for f in fields if f.init and f.kw_only)
+            )
 
 
 def _tuple_str(obj_name, fields):
@@ -395,7 +430,6 @@
 
     local_vars = ', '.join(locals.keys())
     txt = f"def __create_fn__({local_vars}):\n{txt}\n return {name}"
-
     ns = {}
     exec(txt, globals, ns)
     return ns['__create_fn__'](**locals)
@@ -413,7 +447,7 @@
     return f'{self_name}.{name}={value}'
 
 
-def _field_init(f, frozen, globals, self_name):
+def _field_init(f, frozen, globals, self_name, slots):
     # Return the text of the line in the body of __init__ that will
     # initialize this field.
 
@@ -453,9 +487,15 @@
                 globals[default_name] = f.default
                 value = f.name
         else:
-            # This field does not need initialization.  Signify that
-            # to the caller by returning None.
-            return None
+            # If the class has slots, then initialize this field.
+            if slots and f.default is not MISSING:
+                globals[default_name] = f.default
+                value = default_name
+            else:
+                # This field does not need initialization: reading from it will
+                # just use the class attribute that contains the default.
+                # Signify that to the caller by returning None.
+                return None
 
     # Only test this now, so that we can create variables for the
     # default.  However, return None to signify that we're not going
@@ -486,7 +526,8 @@
     return f'{f.name}:_type_{f.name}{default}'
 
 
-def _init_fn(fields, frozen, has_post_init, self_name, globals):
+def _init_fn(fields, std_fields, kw_only_fields, frozen, has_post_init,
+             self_name, globals, slots):
     # fields contains both real fields and InitVar pseudo-fields.
 
     # Make sure we don't have fields without defaults following fields
@@ -494,9 +535,10 @@
     # function source code, but catching it here gives a better error
     # message, and future-proofs us in case we build up the function
     # using ast.
+
     seen_default = False
-    for f in fields:
-        # Only consider fields in the __init__ call.
+    for f in std_fields:
+        # Only consider the non-kw-only fields in the __init__ call.
         if f.init:
             if not (f.default is MISSING and f.default_factory is MISSING):
                 seen_default = True
@@ -512,7 +554,7 @@
 
     body_lines = []
     for f in fields:
-        line = _field_init(f, frozen, locals, self_name)
+        line = _field_init(f, frozen, locals, self_name, slots)
         # line is None means that this field doesn't require
         # initialization (it's a pseudo-field).  Just skip it.
         if line:
@@ -528,8 +570,15 @@
     if not body_lines:
         body_lines = ['pass']
 
+    _init_params = [_init_param(f) for f in std_fields]
+    if kw_only_fields:
+        # Add the keyword-only args.  Because the * can only be added if
+        # there's at least one keyword-only arg, there needs to be a test here
+        # (instead of just concatenting the lists together).
+        _init_params += ['*']
+        _init_params += [_init_param(f) for f in kw_only_fields]
     return _create_fn('__init__',
-                      [self_name] + [_init_param(f) for f in fields if f.init],
+                      [self_name] + _init_params,
                       body_lines,
                       locals=locals,
                       globals=globals,
@@ -608,6 +657,9 @@
     return (a_type is dataclasses.InitVar
             or type(a_type) is dataclasses.InitVar)
 
+def _is_kw_only(a_type, dataclasses):
+    return a_type is dataclasses.KW_ONLY
+
 
 def _is_type(annotation, cls, a_module, a_type, is_type_predicate):
     # Given a type annotation string, does it refer to a_type in
@@ -668,10 +720,11 @@
     return False
 
 
-def _get_field(cls, a_name, a_type):
-    # Return a Field object for this field name and type.  ClassVars
-    # and InitVars are also returned, but marked as such (see
-    # f._field_type).
+def _get_field(cls, a_name, a_type, default_kw_only):
+    # Return a Field object for this field name and type.  ClassVars and
+    # InitVars are also returned, but marked as such (see f._field_type).
+    # default_kw_only is the value of kw_only to use if there isn't a field()
+    # that defines it.
 
     # If the default value isn't derived from Field, then it's only a
     # normal default value.  Convert it to a Field().
@@ -696,7 +749,7 @@
     # In addition to checking for actual types here, also check for
     # string annotations.  get_type_hints() won't always work for us
     # (see https://github.com/python/typing/issues/508 for example),
-    # plus it's expensive and would require an eval for every stirng
+    # plus it's expensive and would require an eval for every string
     # annotation.  So, make a best effort to see if this is a ClassVar
     # or InitVar using regex's and checking that the thing referenced
     # is actually of the correct type.
@@ -742,6 +795,19 @@
         # init=<not-the-default-init-value>)?  It makes no sense for
         # ClassVar and InitVar to specify init=<anything>.
 
+    # kw_only validation and assignment.
+    if f._field_type in (_FIELD, _FIELD_INITVAR):
+        # For real and InitVar fields, if kw_only wasn't specified use the
+        # default value.
+        if f.kw_only is MISSING:
+            f.kw_only = default_kw_only
+    else:
+        # Make sure kw_only isn't set for ClassVars
+        assert f._field_type is _FIELD_CLASSVAR
+        if f.kw_only is not MISSING:
+            raise TypeError(f'field {f.name} is a ClassVar but specifies '
+                            'kw_only')
+
     # For real fields, disallow mutable defaults for known types.
     if f._field_type is _FIELD and isinstance(f.default, (list, dict, set)):
         raise ValueError(f'mutable default {type(f.default)} for field '
@@ -749,12 +815,19 @@
 
     return f
 
+def _set_qualname(cls, value):
+    # Ensure that the functions returned from _create_fn uses the proper
+    # __qualname__ (the class they belong to).
+    if isinstance(value, FunctionType):
+        value.__qualname__ = f"{cls.__qualname__}.{value.__name__}"
+    return value
 
 def _set_new_attribute(cls, name, value):
     # Never overwrites an existing attribute.  Returns True if the
     # attribute already exists.
     if name in cls.__dict__:
         return True
+    _set_qualname(cls, value)
     setattr(cls, name, value)
     return False
 
@@ -769,7 +842,7 @@
 
 def _hash_add(cls, fields, globals):
     flds = [f for f in fields if (f.compare if f.hash is None else f.hash)]
-    return _hash_fn(flds, globals)
+    return _set_qualname(cls, _hash_fn(flds, globals))
 
 def _hash_exception(cls, fields, globals):
     # Raise an exception.
@@ -806,7 +879,8 @@
 # version of this table.
 
 
-def _process_class(cls, init, repr, eq, order, unsafe_hash, frozen):
+def _process_class(cls, init, repr, eq, order, unsafe_hash, frozen,
+                   match_args, kw_only, slots):
     # Now that dicts retain insertion order, there's no reason to use
     # an ordered dict.  I am leveraging that ordering here, because
     # derived class fields overwrite base class fields, but the order
@@ -836,7 +910,7 @@
         # Only process classes that have been processed by our
         # decorator.  That is, they have a _FIELDS attribute.
         base_fields = getattr(b, _FIELDS, None)
-        if base_fields:
+        if base_fields is not None:
             has_dataclass_bases = True
             for f in base_fields.values():
                 fields[f.name] = f
@@ -860,8 +934,27 @@
     # Now find fields in our class.  While doing so, validate some
     # things, and set the default values (as class attributes) where
     # we can.
-    cls_fields = [_get_field(cls, name, type)
-                  for name, type in cls_annotations.items()]
+    cls_fields = []
+    # Get a reference to this module for the _is_kw_only() test.
+    KW_ONLY_seen = False
+    dataclasses = sys.modules[__name__]
+    for name, type in cls_annotations.items():
+        # See if this is a marker to change the value of kw_only.
+        if (_is_kw_only(type, dataclasses)
+            or (isinstance(type, str)
+                and _is_type(type, cls, dataclasses, dataclasses.KW_ONLY,
+                             _is_kw_only))):
+            # Switch the default to kw_only=True, and ignore this
+            # annotation: it's not a real field.
+            if KW_ONLY_seen:
+                raise TypeError(f'{name!r} is KW_ONLY, but KW_ONLY '
+                                'has already been specified')
+            KW_ONLY_seen = True
+            kw_only = True
+        else:
+            # Otherwise it's a field of some type.
+            cls_fields.append(_get_field(cls, name, type, kw_only))
+
     for f in cls_fields:
         fields[f.name] = f
 
@@ -916,15 +1009,22 @@
     if order and not eq:
         raise ValueError('eq must be true if order is true')
 
+    # Include InitVars and regular fields (so, not ClassVars).  This is
+    # initialized here, outside of the "if init:" test, because std_init_fields
+    # is used with match_args, below.
+    all_init_fields = [f for f in fields.values()
+                       if f._field_type in (_FIELD, _FIELD_INITVAR)]
+    (std_init_fields,
+     kw_only_init_fields) = _fields_in_init_order(all_init_fields)
+
     if init:
         # Does this class have a post-init function?
         has_post_init = hasattr(cls, _POST_INIT_NAME)
 
-        # Include InitVars and regular fields (so, not ClassVars).
-        flds = [f for f in fields.values()
-                if f._field_type in (_FIELD, _FIELD_INITVAR)]
         _set_new_attribute(cls, '__init__',
-                           _init_fn(flds,
+                           _init_fn(all_init_fields,
+                                    std_init_fields,
+                                    kw_only_init_fields,
                                     frozen,
                                     has_post_init,
                                     # The name to use for the "self"
@@ -933,6 +1033,7 @@
                                     '__dataclass_self__' if 'self' in fields
                                             else 'self',
                                     globals,
+                                    slots,
                           ))
 
     # Get the fields as a list, and include only real fields.  This is
@@ -944,7 +1045,7 @@
         _set_new_attribute(cls, '__repr__', _repr_fn(flds, globals))
 
     if eq:
-        # Create _eq__ method.  There's no need for a __ne__ method,
+        # Create __eq__ method.  There's no need for a __ne__ method,
         # since python will call __eq__ and negate it.
         flds = [f for f in field_list if f.compare]
         self_tuple = _tuple_str('self', flds)
@@ -992,11 +1093,70 @@
         cls.__doc__ = (cls.__name__ +
                        str(inspect.signature(cls)).replace(' -> None', ''))
 
+    if match_args:
+        # I could probably compute this once
+        _set_new_attribute(cls, '__match_args__',
+                           tuple(f.name for f in std_init_fields))
+
+    if slots:
+        cls = _add_slots(cls, frozen)
+
+    abc.update_abstractmethods(cls)
+
+    return cls
+
+
+# _dataclass_getstate and _dataclass_setstate are needed for pickling frozen
+# classes with slots.  These could be slighly more performant if we generated
+# the code instead of iterating over fields.  But that can be a project for
+# another day, if performance becomes an issue.
+def _dataclass_getstate(self):
+    return [getattr(self, f.name) for f in fields(self)]
+
+
+def _dataclass_setstate(self, state):
+    for field, value in zip(fields(self), state):
+        # use setattr because dataclass may be frozen
+        object.__setattr__(self, field.name, value)
+
+
+def _add_slots(cls, is_frozen):
+    # Need to create a new class, since we can't set __slots__
+    #  after a class has been created.
+
+    # Make sure __slots__ isn't already set.
+    if '__slots__' in cls.__dict__:
+        raise TypeError(f'{cls.__name__} already specifies __slots__')
+
+    # Create a new dict for our new class.
+    cls_dict = dict(cls.__dict__)
+    field_names = tuple(f.name for f in fields(cls))
+    cls_dict['__slots__'] = field_names
+    for field_name in field_names:
+        # Remove our attributes, if present. They'll still be
+        #  available in _MARKER.
+        cls_dict.pop(field_name, None)
+
+    # Remove __dict__ itself.
+    cls_dict.pop('__dict__', None)
+
+    # And finally create the class.
+    qualname = getattr(cls, '__qualname__', None)
+    cls = type(cls)(cls.__name__, cls.__bases__, cls_dict)
+    if qualname is not None:
+        cls.__qualname__ = qualname
+
+    if is_frozen:
+        # Need this for pickling frozen classes with slots.
+        cls.__getstate__ = _dataclass_getstate
+        cls.__setstate__ = _dataclass_setstate
+
     return cls
 
 
 def dataclass(cls=None, /, *, init=True, repr=True, eq=True, order=False,
-              unsafe_hash=False, frozen=False):
+              unsafe_hash=False, frozen=False, match_args=True,
+              kw_only=False, slots=False):
     """Returns the same class as was passed in, with dunder methods
     added based on the fields defined in the class.
 
@@ -1006,11 +1166,15 @@
     repr is true, a __repr__() method is added. If order is true, rich
     comparison dunder methods are added. If unsafe_hash is true, a
     __hash__() method function is added. If frozen is true, fields may
-    not be assigned to after instance creation.
+    not be assigned to after instance creation. If match_args is true,
+    the __match_args__ tuple is added. If kw_only is true, then by
+    default all fields are keyword-only. If slots is true, an
+    __slots__ attribute is added.
     """
 
     def wrap(cls):
-        return _process_class(cls, init, repr, eq, order, unsafe_hash, frozen)
+        return _process_class(cls, init, repr, eq, order, unsafe_hash,
+                              frozen, match_args, kw_only, slots)
 
     # See if we're being called as @dataclass or @dataclass().
     if cls is None:
@@ -1047,7 +1211,7 @@
 def is_dataclass(obj):
     """Returns True if obj is a dataclass or an instance of a
     dataclass."""
-    cls = obj if isinstance(obj, type) else type(obj)
+    cls = obj if isinstance(obj, type) and not isinstance(obj, GenericAlias) else type(obj)
     return hasattr(cls, _FIELDS)
 
 
@@ -1169,7 +1333,7 @@
 
 def make_dataclass(cls_name, fields, *, bases=(), namespace=None, init=True,
                    repr=True, eq=True, order=False, unsafe_hash=False,
-                   frozen=False):
+                   frozen=False, match_args=True, kw_only=False, slots=False):
     """Return a new dynamically created dataclass.
 
     The dataclass name will be 'cls_name'.  'fields' is an iterable
@@ -1195,14 +1359,12 @@
 
     if namespace is None:
         namespace = {}
-    else:
-        # Copy namespace since we're going to mutate it.
-        namespace = namespace.copy()
 
     # While we're looking through the field names, validate that they
     # are identifiers, are not keywords, and not duplicates.
     seen = set()
-    anns = {}
+    annotations = {}
+    defaults = {}
     for item in fields:
         if isinstance(item, str):
             name = item
@@ -1211,7 +1373,7 @@
             name, tp, = item
         elif len(item) == 3:
             name, tp, spec = item
-            namespace[name] = spec
+            defaults[name] = spec
         else:
             raise TypeError(f'Invalid field: {item!r}')
 
@@ -1223,14 +1385,22 @@
             raise TypeError(f'Field name duplicated: {name!r}')
 
         seen.add(name)
-        anns[name] = tp
+        annotations[name] = tp
 
-    namespace['__annotations__'] = anns
+    # Update 'ns' with the user-supplied namespace plus our calculated values.
+    def exec_body_callback(ns):
+        ns.update(namespace)
+        ns.update(defaults)
+        ns['__annotations__'] = annotations
+
     # We use `types.new_class()` instead of simply `type()` to allow dynamic creation
-    # of generic dataclassses.
-    cls = types.new_class(cls_name, bases, {}, lambda ns: ns.update(namespace))
+    # of generic dataclasses.
+    cls = types.new_class(cls_name, bases, {}, exec_body_callback)
+
+    # Apply the normal decorator.
     return dataclass(cls, init=init, repr=repr, eq=eq, order=order,
-                     unsafe_hash=unsafe_hash, frozen=frozen)
+                     unsafe_hash=unsafe_hash, frozen=frozen,
+                     match_args=match_args, kw_only=kw_only, slots=slots)
 
 
 def replace(obj, /, **changes):
@@ -1271,7 +1441,7 @@
             continue
 
         if f.name not in changes:
-            if f._field_type is _FIELD_INITVAR:
+            if f._field_type is _FIELD_INITVAR and f.default is MISSING:
                 raise ValueError(f"InitVar {f.name!r} "
                                  'must be specified with replace()')
             changes[f.name] = getattr(obj, f.name)
diff --git a/Lib/datetime.py b/Lib/datetime.py
index e508d99..6bf37cc 100644
--- a/Lib/datetime.py
+++ b/Lib/datetime.py
@@ -11,6 +11,7 @@
 import time as _time
 import math as _math
 import sys
+from operator import index as _index
 
 def _cmp(x, y):
     return 0 if x == y else 1 if x > y else -1
@@ -380,42 +381,10 @@
                          "-timedelta(hours=24) and timedelta(hours=24)" %
                          (name, offset))
 
-def _check_int_field(value):
-    if isinstance(value, int):
-        return value
-    if isinstance(value, float):
-        raise TypeError('integer argument expected, got float')
-    try:
-        value = value.__index__()
-    except AttributeError:
-        pass
-    else:
-        if not isinstance(value, int):
-            raise TypeError('__index__ returned non-int (type %s)' %
-                            type(value).__name__)
-        return value
-    orig = value
-    try:
-        value = value.__int__()
-    except AttributeError:
-        pass
-    else:
-        if not isinstance(value, int):
-            raise TypeError('__int__ returned non-int (type %s)' %
-                            type(value).__name__)
-        import warnings
-        warnings.warn("an integer is required (got type %s)"  %
-                      type(orig).__name__,
-                      DeprecationWarning,
-                      stacklevel=2)
-        return value
-    raise TypeError('an integer is required (got type %s)' %
-                    type(value).__name__)
-
 def _check_date_fields(year, month, day):
-    year = _check_int_field(year)
-    month = _check_int_field(month)
-    day = _check_int_field(day)
+    year = _index(year)
+    month = _index(month)
+    day = _index(day)
     if not MINYEAR <= year <= MAXYEAR:
         raise ValueError('year must be in %d..%d' % (MINYEAR, MAXYEAR), year)
     if not 1 <= month <= 12:
@@ -426,10 +395,10 @@
     return year, month, day
 
 def _check_time_fields(hour, minute, second, microsecond, fold):
-    hour = _check_int_field(hour)
-    minute = _check_int_field(minute)
-    second = _check_int_field(second)
-    microsecond = _check_int_field(microsecond)
+    hour = _index(hour)
+    minute = _index(minute)
+    second = _index(second)
+    microsecond = _index(microsecond)
     if not 0 <= hour <= 23:
         raise ValueError('hour must be in 0..23', hour)
     if not 0 <= minute <= 59:
@@ -2358,7 +2327,7 @@
 #    This is again a requirement for a sane tzinfo class.
 #
 # 4. (x+k).s = x.s
-#    This follows from #2, and that datimetimetz+timedelta preserves tzinfo.
+#    This follows from #2, and that datetime.timetz+timedelta preserves tzinfo.
 #
 # 5. (x+k).n = x.n + k
 #    Again follows from how arithmetic is defined.
@@ -2541,10 +2510,10 @@
     # Clean up unused names
     del (_DAYNAMES, _DAYS_BEFORE_MONTH, _DAYS_IN_MONTH, _DI100Y, _DI400Y,
          _DI4Y, _EPOCH, _MAXORDINAL, _MONTHNAMES, _build_struct_time,
-         _check_date_fields, _check_int_field, _check_time_fields,
+         _check_date_fields, _check_time_fields,
          _check_tzinfo_arg, _check_tzname, _check_utc_offset, _cmp, _cmperror,
          _date_class, _days_before_month, _days_before_year, _days_in_month,
-         _format_time, _format_offset, _is_leap, _isoweek1monday, _math,
+         _format_time, _format_offset, _index, _is_leap, _isoweek1monday, _math,
          _ord2ymd, _time, _time_class, _tzinfo_class, _wrap_strftime, _ymd2ord,
          _divide_and_round, _parse_isoformat_date, _parse_isoformat_time,
          _parse_hh_mm_ss_ff, _IsoCalendarDate)
diff --git a/Lib/difflib.py b/Lib/difflib.py
index 0dda80d..afd8a0c 100644
--- a/Lib/difflib.py
+++ b/Lib/difflib.py
@@ -62,7 +62,7 @@
     notion, pairing up elements that appear uniquely in each sequence.
     That, and the method here, appear to yield more intuitive difference
     reports than does diff.  This method appears to be the least vulnerable
-    to synching up on blocks of "junk lines", though (like blank lines in
+    to syncing up on blocks of "junk lines", though (like blank lines in
     ordinary text files, or maybe "<P>" lines in HTML files).  That may be
     because this is the only method of the 3 that has a *concept* of
     "junk" <wink>.
@@ -115,38 +115,6 @@
     case.  SequenceMatcher is quadratic time for the worst case and has
     expected-case behavior dependent in a complicated way on how many
     elements the sequences have in common; best case time is linear.
-
-    Methods:
-
-    __init__(isjunk=None, a='', b='')
-        Construct a SequenceMatcher.
-
-    set_seqs(a, b)
-        Set the two sequences to be compared.
-
-    set_seq1(a)
-        Set the first sequence to be compared.
-
-    set_seq2(b)
-        Set the second sequence to be compared.
-
-    find_longest_match(alo=0, ahi=None, blo=0, bhi=None)
-        Find longest matching block in a[alo:ahi] and b[blo:bhi].
-
-    get_matching_blocks()
-        Return list of triples describing matching subsequences.
-
-    get_opcodes()
-        Return list of 5-tuples describing how to turn a into b.
-
-    ratio()
-        Return a measure of the sequences' similarity (float in [0,1]).
-
-    quick_ratio()
-        Return an upper bound on .ratio() relatively quickly.
-
-    real_quick_ratio()
-        Return an upper bound on ratio() very quickly.
     """
 
     def __init__(self, isjunk=None, a='', b='', autojunk=True):
@@ -837,14 +805,6 @@
     +   4. Complicated is better than complex.
     ?           ++++ ^                      ^
     +   5. Flat is better than nested.
-
-    Methods:
-
-    __init__(linejunk=None, charjunk=None)
-        Construct a text differencer, with optional filters.
-
-    compare(a, b)
-        Compare two sequences of lines; generate the resulting delta.
     """
 
     def __init__(self, linejunk=None, charjunk=None):
diff --git a/Lib/dis.py b/Lib/dis.py
index e289e17..fe5d24e 100644
--- a/Lib/dis.py
+++ b/Lib/dis.py
@@ -338,8 +338,11 @@
                 argval, argrepr = _get_const_info(arg, constants)
             elif op in hasname:
                 argval, argrepr = _get_name_info(arg, names)
+            elif op in hasjabs:
+                argval = arg*2
+                argrepr = "to " + repr(argval)
             elif op in hasjrel:
-                argval = offset + 2 + arg
+                argval = offset + 2 + arg*2
                 argrepr = "to " + repr(argval)
             elif op in haslocal:
                 argval, argrepr = _get_name_info(arg, varnames)
@@ -384,7 +387,7 @@
                        constants=None, cells=None, linestarts=None,
                        *, file=None, line_offset=0):
     # Omit the line number column entirely if we have no line number info
-    show_lineno = linestarts is not None
+    show_lineno = bool(linestarts)
     if show_lineno:
         maxlineno = max(linestarts.values()) + line_offset
         if maxlineno >= 1000:
@@ -425,6 +428,7 @@
             extended_arg = (arg << 8) if op == EXTENDED_ARG else 0
         else:
             arg = None
+            extended_arg = 0
         yield (i, op, arg)
 
 def findlabels(code):
@@ -437,9 +441,9 @@
     for offset, op, arg in _unpack_opargs(code):
         if arg is not None:
             if op in hasjrel:
-                label = offset + 2 + arg
+                label = offset + 2 + arg*2
             elif op in hasjabs:
-                label = arg
+                label = arg*2
             else:
                 continue
             if label not in labels:
@@ -449,32 +453,15 @@
 def findlinestarts(code):
     """Find the offsets in a byte code which are start of lines in the source.
 
-    Generate pairs (offset, lineno) as described in Python/compile.c.
-
+    Generate pairs (offset, lineno)
     """
-    byte_increments = code.co_lnotab[0::2]
-    line_increments = code.co_lnotab[1::2]
-    bytecode_len = len(code.co_code)
+    lastline = None
+    for start, end, line in code.co_lines():
+        if line is not None and line != lastline:
+            lastline = line
+            yield start, line
+    return
 
-    lastlineno = None
-    lineno = code.co_firstlineno
-    addr = 0
-    for byte_incr, line_incr in zip(byte_increments, line_increments):
-        if byte_incr:
-            if lineno != lastlineno:
-                yield (addr, lineno)
-                lastlineno = lineno
-            addr += byte_incr
-            if addr >= bytecode_len:
-                # The rest of the lnotab byte offsets are past the end of
-                # the bytecode, so the lines were optimized away.
-                return
-        if line_incr >= 0x80:
-            # line_increments is an array of 8-bit signed integers
-            line_incr -= 0x100
-        lineno += line_incr
-    if lineno != lastlineno:
-        yield (addr, lineno)
 
 class Bytecode:
     """The bytecode operations of a piece of code
diff --git a/Lib/distutils/README b/Lib/distutils/README
index 23f4885..73bd251 100644
--- a/Lib/distutils/README
+++ b/Lib/distutils/README
@@ -2,10 +2,10 @@
 
 There's a full documentation available at:
 
-    http://docs.python.org/distutils/
+    https://docs.python.org/distutils/
 
 The Distutils-SIG web page is also a good starting point:
 
-    http://www.python.org/sigs/distutils-sig/
+    https://www.python.org/sigs/distutils-sig/
 
 $Id$
diff --git a/Lib/distutils/__init__.py b/Lib/distutils/__init__.py
index d823d04..fdad6f6 100644
--- a/Lib/distutils/__init__.py
+++ b/Lib/distutils/__init__.py
@@ -9,5 +9,12 @@
 """
 
 import sys
+import warnings
 
 __version__ = sys.version[:sys.version.index(' ')]
+
+_DEPRECATION_MESSAGE = ("The distutils package is deprecated and slated for "
+                        "removal in Python 3.12. Use setuptools or check "
+                        "PEP 632 for potential alternatives")
+warnings.warn(_DEPRECATION_MESSAGE,
+              DeprecationWarning, 2)
diff --git a/Lib/distutils/ccompiler.py b/Lib/distutils/ccompiler.py
index b5ef143..4c47f2e 100644
--- a/Lib/distutils/ccompiler.py
+++ b/Lib/distutils/ccompiler.py
@@ -392,7 +392,7 @@
         return output_dir, macros, include_dirs
 
     def _prep_compile(self, sources, output_dir, depends=None):
-        """Decide which souce files must be recompiled.
+        """Decide which source files must be recompiled.
 
         Determine the list of object files corresponding to 'sources',
         and figure out which ones really need to be recompiled.
diff --git a/Lib/distutils/command/__init__.py b/Lib/distutils/command/__init__.py
index 481eea9..fd0bfae 100644
--- a/Lib/distutils/command/__init__.py
+++ b/Lib/distutils/command/__init__.py
@@ -19,7 +19,6 @@
            'bdist',
            'bdist_dumb',
            'bdist_rpm',
-           'bdist_wininst',
            'check',
            'upload',
            # These two are reserved for future use:
diff --git a/Lib/distutils/command/bdist.py b/Lib/distutils/command/bdist.py
index 014871d..d580a80 100644
--- a/Lib/distutils/command/bdist.py
+++ b/Lib/distutils/command/bdist.py
@@ -62,7 +62,7 @@
 
     # Establish the preferred order (for the --help-formats option).
     format_commands = ['rpm', 'gztar', 'bztar', 'xztar', 'ztar', 'tar',
-                       'wininst', 'zip', 'msi']
+                       'zip', 'msi']
 
     # And the real information.
     format_command = {'rpm':   ('bdist_rpm',  "RPM distribution"),
@@ -71,8 +71,6 @@
                       'xztar': ('bdist_dumb', "xz'ed tar file"),
                       'ztar':  ('bdist_dumb', "compressed tar file"),
                       'tar':   ('bdist_dumb', "tar file"),
-                      'wininst': ('bdist_wininst',
-                                  "Windows executable installer"),
                       'zip':   ('bdist_dumb', "ZIP file"),
                       'msi':   ('bdist_msi',  "Microsoft Installer")
                       }
diff --git a/Lib/distutils/command/bdist_msi.py b/Lib/distutils/command/bdist_msi.py
index 0863a18..2ed017b 100644
--- a/Lib/distutils/command/bdist_msi.py
+++ b/Lib/distutils/command/bdist_msi.py
@@ -1,7 +1,5 @@
 # Copyright (C) 2005, 2006 Martin von Löwis
 # Licensed to PSF under a Contributor Agreement.
-# The bdist_wininst command proper
-# based on bdist_wininst
 """
 Implements the bdist_msi command.
 """
diff --git a/Lib/distutils/command/bdist_wininst.py b/Lib/distutils/command/bdist_wininst.py
deleted file mode 100644
index 0e9ddaa..0000000
--- a/Lib/distutils/command/bdist_wininst.py
+++ /dev/null
@@ -1,377 +0,0 @@
-"""distutils.command.bdist_wininst
-
-Implements the Distutils 'bdist_wininst' command: create a windows installer
-exe-program."""
-
-import os
-import sys
-import warnings
-from distutils.core import Command
-from distutils.util import get_platform
-from distutils.dir_util import remove_tree
-from distutils.errors import *
-from distutils.sysconfig import get_python_version
-from distutils import log
-
-class bdist_wininst(Command):
-
-    description = "create an executable installer for MS Windows"
-
-    user_options = [('bdist-dir=', None,
-                     "temporary directory for creating the distribution"),
-                    ('plat-name=', 'p',
-                     "platform name to embed in generated filenames "
-                     "(default: %s)" % get_platform()),
-                    ('keep-temp', 'k',
-                     "keep the pseudo-installation tree around after " +
-                     "creating the distribution archive"),
-                    ('target-version=', None,
-                     "require a specific python version" +
-                     " on the target system"),
-                    ('no-target-compile', 'c',
-                     "do not compile .py to .pyc on the target system"),
-                    ('no-target-optimize', 'o',
-                     "do not compile .py to .pyo (optimized) "
-                     "on the target system"),
-                    ('dist-dir=', 'd',
-                     "directory to put final built distributions in"),
-                    ('bitmap=', 'b',
-                     "bitmap to use for the installer instead of python-powered logo"),
-                    ('title=', 't',
-                     "title to display on the installer background instead of default"),
-                    ('skip-build', None,
-                     "skip rebuilding everything (for testing/debugging)"),
-                    ('install-script=', None,
-                     "basename of installation script to be run after "
-                     "installation or before deinstallation"),
-                    ('pre-install-script=', None,
-                     "Fully qualified filename of a script to be run before "
-                     "any files are installed.  This script need not be in the "
-                     "distribution"),
-                    ('user-access-control=', None,
-                     "specify Vista's UAC handling - 'none'/default=no "
-                     "handling, 'auto'=use UAC if target Python installed for "
-                     "all users, 'force'=always use UAC"),
-                   ]
-
-    boolean_options = ['keep-temp', 'no-target-compile', 'no-target-optimize',
-                       'skip-build']
-
-    # bpo-10945: bdist_wininst requires mbcs encoding only available on Windows
-    _unsupported = (sys.platform != "win32")
-
-    def __init__(self, *args, **kw):
-        super().__init__(*args, **kw)
-        warnings.warn("bdist_wininst command is deprecated since Python 3.8, "
-                      "use bdist_wheel (wheel packages) instead",
-                      DeprecationWarning, 2)
-
-    def initialize_options(self):
-        self.bdist_dir = None
-        self.plat_name = None
-        self.keep_temp = 0
-        self.no_target_compile = 0
-        self.no_target_optimize = 0
-        self.target_version = None
-        self.dist_dir = None
-        self.bitmap = None
-        self.title = None
-        self.skip_build = None
-        self.install_script = None
-        self.pre_install_script = None
-        self.user_access_control = None
-
-
-    def finalize_options(self):
-        self.set_undefined_options('bdist', ('skip_build', 'skip_build'))
-
-        if self.bdist_dir is None:
-            if self.skip_build and self.plat_name:
-                # If build is skipped and plat_name is overridden, bdist will
-                # not see the correct 'plat_name' - so set that up manually.
-                bdist = self.distribution.get_command_obj('bdist')
-                bdist.plat_name = self.plat_name
-                # next the command will be initialized using that name
-            bdist_base = self.get_finalized_command('bdist').bdist_base
-            self.bdist_dir = os.path.join(bdist_base, 'wininst')
-
-        if not self.target_version:
-            self.target_version = ""
-
-        if not self.skip_build and self.distribution.has_ext_modules():
-            short_version = get_python_version()
-            if self.target_version and self.target_version != short_version:
-                raise DistutilsOptionError(
-                      "target version can only be %s, or the '--skip-build'" \
-                      " option must be specified" % (short_version,))
-            self.target_version = short_version
-
-        self.set_undefined_options('bdist',
-                                   ('dist_dir', 'dist_dir'),
-                                   ('plat_name', 'plat_name'),
-                                  )
-
-        if self.install_script:
-            for script in self.distribution.scripts:
-                if self.install_script == os.path.basename(script):
-                    break
-            else:
-                raise DistutilsOptionError(
-                      "install_script '%s' not found in scripts"
-                      % self.install_script)
-
-    def run(self):
-        if (sys.platform != "win32" and
-            (self.distribution.has_ext_modules() or
-             self.distribution.has_c_libraries())):
-            raise DistutilsPlatformError \
-                  ("distribution contains extensions and/or C libraries; "
-                   "must be compiled on a Windows 32 platform")
-
-        if not self.skip_build:
-            self.run_command('build')
-
-        install = self.reinitialize_command('install', reinit_subcommands=1)
-        install.root = self.bdist_dir
-        install.skip_build = self.skip_build
-        install.warn_dir = 0
-        install.plat_name = self.plat_name
-
-        install_lib = self.reinitialize_command('install_lib')
-        # we do not want to include pyc or pyo files
-        install_lib.compile = 0
-        install_lib.optimize = 0
-
-        if self.distribution.has_ext_modules():
-            # If we are building an installer for a Python version other
-            # than the one we are currently running, then we need to ensure
-            # our build_lib reflects the other Python version rather than ours.
-            # Note that for target_version!=sys.version, we must have skipped the
-            # build step, so there is no issue with enforcing the build of this
-            # version.
-            target_version = self.target_version
-            if not target_version:
-                assert self.skip_build, "Should have already checked this"
-                target_version = '%d.%d' % sys.version_info[:2]
-            plat_specifier = ".%s-%s" % (self.plat_name, target_version)
-            build = self.get_finalized_command('build')
-            build.build_lib = os.path.join(build.build_base,
-                                           'lib' + plat_specifier)
-
-        # Use a custom scheme for the zip-file, because we have to decide
-        # at installation time which scheme to use.
-        for key in ('purelib', 'platlib', 'headers', 'scripts', 'data'):
-            value = key.upper()
-            if key == 'headers':
-                value = value + '/Include/$dist_name'
-            setattr(install,
-                    'install_' + key,
-                    value)
-
-        log.info("installing to %s", self.bdist_dir)
-        install.ensure_finalized()
-
-        # avoid warning of 'install_lib' about installing
-        # into a directory not in sys.path
-        sys.path.insert(0, os.path.join(self.bdist_dir, 'PURELIB'))
-
-        install.run()
-
-        del sys.path[0]
-
-        # And make an archive relative to the root of the
-        # pseudo-installation tree.
-        from tempfile import mktemp
-        archive_basename = mktemp()
-        fullname = self.distribution.get_fullname()
-        arcname = self.make_archive(archive_basename, "zip",
-                                    root_dir=self.bdist_dir)
-        # create an exe containing the zip-file
-        self.create_exe(arcname, fullname, self.bitmap)
-        if self.distribution.has_ext_modules():
-            pyversion = get_python_version()
-        else:
-            pyversion = 'any'
-        self.distribution.dist_files.append(('bdist_wininst', pyversion,
-                                             self.get_installer_filename(fullname)))
-        # remove the zip-file again
-        log.debug("removing temporary file '%s'", arcname)
-        os.remove(arcname)
-
-        if not self.keep_temp:
-            remove_tree(self.bdist_dir, dry_run=self.dry_run)
-
-    def get_inidata(self):
-        # Return data describing the installation.
-        lines = []
-        metadata = self.distribution.metadata
-
-        # Write the [metadata] section.
-        lines.append("[metadata]")
-
-        # 'info' will be displayed in the installer's dialog box,
-        # describing the items to be installed.
-        info = (metadata.long_description or '') + '\n'
-
-        # Escape newline characters
-        def escape(s):
-            return s.replace("\n", "\\n")
-
-        for name in ["author", "author_email", "description", "maintainer",
-                     "maintainer_email", "name", "url", "version"]:
-            data = getattr(metadata, name, "")
-            if data:
-                info = info + ("\n    %s: %s" % \
-                               (name.capitalize(), escape(data)))
-                lines.append("%s=%s" % (name, escape(data)))
-
-        # The [setup] section contains entries controlling
-        # the installer runtime.
-        lines.append("\n[Setup]")
-        if self.install_script:
-            lines.append("install_script=%s" % self.install_script)
-        lines.append("info=%s" % escape(info))
-        lines.append("target_compile=%d" % (not self.no_target_compile))
-        lines.append("target_optimize=%d" % (not self.no_target_optimize))
-        if self.target_version:
-            lines.append("target_version=%s" % self.target_version)
-        if self.user_access_control:
-            lines.append("user_access_control=%s" % self.user_access_control)
-
-        title = self.title or self.distribution.get_fullname()
-        lines.append("title=%s" % escape(title))
-        import time
-        import distutils
-        build_info = "Built %s with distutils-%s" % \
-                     (time.ctime(time.time()), distutils.__version__)
-        lines.append("build_info=%s" % build_info)
-        return "\n".join(lines)
-
-    def create_exe(self, arcname, fullname, bitmap=None):
-        import struct
-
-        self.mkpath(self.dist_dir)
-
-        cfgdata = self.get_inidata()
-
-        installer_name = self.get_installer_filename(fullname)
-        self.announce("creating %s" % installer_name)
-
-        if bitmap:
-            with open(bitmap, "rb") as f:
-                bitmapdata = f.read()
-            bitmaplen = len(bitmapdata)
-        else:
-            bitmaplen = 0
-
-        with open(installer_name, "wb") as file:
-            file.write(self.get_exe_bytes())
-            if bitmap:
-                file.write(bitmapdata)
-
-            # Convert cfgdata from unicode to ascii, mbcs encoded
-            if isinstance(cfgdata, str):
-                cfgdata = cfgdata.encode("mbcs")
-
-            # Append the pre-install script
-            cfgdata = cfgdata + b"\0"
-            if self.pre_install_script:
-                # We need to normalize newlines, so we open in text mode and
-                # convert back to bytes. "latin-1" simply avoids any possible
-                # failures.
-                with open(self.pre_install_script, "r",
-                          encoding="latin-1") as script:
-                    script_data = script.read().encode("latin-1")
-                cfgdata = cfgdata + script_data + b"\n\0"
-            else:
-                # empty pre-install script
-                cfgdata = cfgdata + b"\0"
-            file.write(cfgdata)
-
-            # The 'magic number' 0x1234567B is used to make sure that the
-            # binary layout of 'cfgdata' is what the wininst.exe binary
-            # expects.  If the layout changes, increment that number, make
-            # the corresponding changes to the wininst.exe sources, and
-            # recompile them.
-            header = struct.pack("<iii",
-                                0x1234567B,       # tag
-                                len(cfgdata),     # length
-                                bitmaplen,        # number of bytes in bitmap
-                                )
-            file.write(header)
-            with open(arcname, "rb") as f:
-                file.write(f.read())
-
-    def get_installer_filename(self, fullname):
-        # Factored out to allow overriding in subclasses
-        if self.target_version:
-            # if we create an installer for a specific python version,
-            # it's better to include this in the name
-            installer_name = os.path.join(self.dist_dir,
-                                          "%s.%s-py%s.exe" %
-                                           (fullname, self.plat_name, self.target_version))
-        else:
-            installer_name = os.path.join(self.dist_dir,
-                                          "%s.%s.exe" % (fullname, self.plat_name))
-        return installer_name
-
-    def get_exe_bytes(self):
-        # If a target-version other than the current version has been
-        # specified, then using the MSVC version from *this* build is no good.
-        # Without actually finding and executing the target version and parsing
-        # its sys.version, we just hard-code our knowledge of old versions.
-        # NOTE: Possible alternative is to allow "--target-version" to
-        # specify a Python executable rather than a simple version string.
-        # We can then execute this program to obtain any info we need, such
-        # as the real sys.version string for the build.
-        cur_version = get_python_version()
-
-        # If the target version is *later* than us, then we assume they
-        # use what we use
-        # string compares seem wrong, but are what sysconfig.py itself uses
-        if self.target_version and self.target_version < cur_version:
-            if self.target_version < "2.4":
-                bv = '6.0'
-            elif self.target_version == "2.4":
-                bv = '7.1'
-            elif self.target_version == "2.5":
-                bv = '8.0'
-            elif self.target_version <= "3.2":
-                bv = '9.0'
-            elif self.target_version <= "3.4":
-                bv = '10.0'
-            else:
-                bv = '14.0'
-        else:
-            # for current version - use authoritative check.
-            try:
-                from msvcrt import CRT_ASSEMBLY_VERSION
-            except ImportError:
-                # cross-building, so assume the latest version
-                bv = '14.0'
-            else:
-                # as far as we know, CRT is binary compatible based on
-                # the first field, so assume 'x.0' until proven otherwise
-                major = CRT_ASSEMBLY_VERSION.partition('.')[0]
-                bv = major + '.0'
-
-
-        # wininst-x.y.exe is in the same directory as this file
-        directory = os.path.dirname(__file__)
-        # we must use a wininst-x.y.exe built with the same C compiler
-        # used for python.  XXX What about mingw, borland, and so on?
-
-        # if plat_name starts with "win" but is not "win32"
-        # we want to strip "win" and leave the rest (e.g. -amd64)
-        # for all other cases, we don't want any suffix
-        if self.plat_name != 'win32' and self.plat_name[:3] == 'win':
-            sfix = self.plat_name[3:]
-        else:
-            sfix = ''
-
-        filename = os.path.join(directory, "wininst-%s%s.exe" % (bv, sfix))
-        f = open(filename, "rb")
-        try:
-            return f.read()
-        finally:
-            f.close()
diff --git a/Lib/distutils/command/check.py b/Lib/distutils/command/check.py
index ada2500..73a30f3 100644
--- a/Lib/distutils/command/check.py
+++ b/Lib/distutils/command/check.py
@@ -83,7 +83,7 @@
             name, version, URL
 
         Recommended fields:
-            (author and author_email) or (maintainer and maintainer_email))
+            (author and author_email) or (maintainer and maintainer_email)
 
         Warns if any are missing.
         """
diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py
index aaa300e..01d5331 100644
--- a/Lib/distutils/command/install.py
+++ b/Lib/distutils/command/install.py
@@ -3,7 +3,9 @@
 Implements the Distutils 'install' command."""
 
 import sys
+import sysconfig
 import os
+import re
 
 from distutils import log
 from distutils.core import Command
@@ -17,35 +19,55 @@
 
 from site import USER_BASE
 from site import USER_SITE
-HAS_USER_SITE = True
 
-WINDOWS_SCHEME = {
-    'purelib': '$base/Lib/site-packages',
-    'platlib': '$base/Lib/site-packages',
-    'headers': '$base/Include/$dist_name',
-    'scripts': '$base/Scripts',
-    'data'   : '$base',
-}
+HAS_USER_SITE = (USER_SITE is not None)
 
-INSTALL_SCHEMES = {
-    'unix_prefix': {
-        'purelib': '$base/lib/python$py_version_short/site-packages',
-        'platlib': '$platbase/$platlibdir/python$py_version_short/site-packages',
-        'headers': '$base/include/python$py_version_short$abiflags/$dist_name',
-        'scripts': '$base/bin',
-        'data'   : '$base',
-        },
-    'unix_home': {
-        'purelib': '$base/lib/python',
-        'platlib': '$base/$platlibdir/python',
-        'headers': '$base/include/python/$dist_name',
-        'scripts': '$base/bin',
-        'data'   : '$base',
-        },
-    'nt': WINDOWS_SCHEME,
-    }
+# The keys to an installation scheme; if any new types of files are to be
+# installed, be sure to add an entry to every scheme in
+# sysconfig._INSTALL_SCHEMES, and to SCHEME_KEYS here.
+SCHEME_KEYS = ('purelib', 'platlib', 'headers', 'scripts', 'data')
 
-# user site schemes
+# The following code provides backward-compatible INSTALL_SCHEMES
+# while making the sysconfig module the single point of truth.
+# This makes it easier for OS distributions where they need to
+# alter locations for packages installations in a single place.
+# Note that this module is deprecated (PEP 632); all consumers
+# of this information should switch to using sysconfig directly.
+INSTALL_SCHEMES = {"unix_prefix": {}, "unix_home": {}, "nt": {}}
+
+# Copy from sysconfig._INSTALL_SCHEMES
+for key in SCHEME_KEYS:
+    for distutils_scheme_name, sys_scheme_name in (
+            ("unix_prefix", "posix_prefix"), ("unix_home", "posix_home"),
+            ("nt", "nt")):
+        sys_key = key
+        sys_scheme = sysconfig._INSTALL_SCHEMES[sys_scheme_name]
+        if key == "headers" and key not in sys_scheme:
+            # On POSIX-y platforms, Python will:
+            # - Build from .h files in 'headers' (only there when
+            #   building CPython)
+            # - Install .h files to 'include'
+            # When 'headers' is missing, fall back to 'include'
+            sys_key = 'include'
+        INSTALL_SCHEMES[distutils_scheme_name][key] = sys_scheme[sys_key]
+
+# Transformation to different template format
+for main_key in INSTALL_SCHEMES:
+    for key, value in INSTALL_SCHEMES[main_key].items():
+        # Change all ocurences of {variable} to $variable
+        value = re.sub(r"\{(.+?)\}", r"$\g<1>", value)
+        value = value.replace("$installed_base", "$base")
+        value = value.replace("$py_version_nodot_plat", "$py_version_nodot")
+        if key == "headers":
+            value += "/$dist_name"
+        if sys.version_info >= (3, 9) and key == "platlib":
+            # platlibdir is available since 3.9: bpo-1294959
+            value = value.replace("/lib/", "/$platlibdir/")
+        INSTALL_SCHEMES[main_key][key] = value
+
+# The following part of INSTALL_SCHEMES has a different definition
+# than the one in sysconfig, but because both depend on the site module,
+# the outcomes should be the same.
 if HAS_USER_SITE:
     INSTALL_SCHEMES['nt_user'] = {
         'purelib': '$usersite',
@@ -64,11 +86,6 @@
         'data'   : '$userbase',
         }
 
-# The keys to an installation scheme; if any new types of files are to be
-# installed, be sure to add an entry to every installation scheme above,
-# and to SCHEME_KEYS here.
-SCHEME_KEYS = ('purelib', 'platlib', 'headers', 'scripts', 'data')
-
 
 class install(Command):
 
@@ -169,8 +186,9 @@
         self.install_lib = None         # set to either purelib or platlib
         self.install_scripts = None
         self.install_data = None
-        self.install_userbase = USER_BASE
-        self.install_usersite = USER_SITE
+        if HAS_USER_SITE:
+            self.install_userbase = USER_BASE
+            self.install_usersite = USER_SITE
 
         self.compile = None
         self.optimize = None
@@ -305,6 +323,9 @@
             self.config_vars['userbase'] = self.install_userbase
             self.config_vars['usersite'] = self.install_usersite
 
+        if sysconfig.is_python_build(True):
+            self.config_vars['srcdir'] = sysconfig.get_config_var('srcdir')
+
         self.expand_basedirs()
 
         self.dump_dirs("post-expand_basedirs()")
@@ -343,8 +364,9 @@
         # Convert directories from Unix /-separated syntax to the local
         # convention.
         self.convert_paths('lib', 'purelib', 'platlib',
-                           'scripts', 'data', 'headers',
-                           'userbase', 'usersite')
+                           'scripts', 'data', 'headers')
+        if HAS_USER_SITE:
+            self.convert_paths('userbase', 'usersite')
 
         # Deprecated
         # Well, we're not actually fully completely finalized yet: we still
diff --git a/Lib/distutils/command/upload.py b/Lib/distutils/command/upload.py
index 95e9fda..e0ecb65 100644
--- a/Lib/distutils/command/upload.py
+++ b/Lib/distutils/command/upload.py
@@ -9,7 +9,8 @@
 import io
 import hashlib
 from base64 import standard_b64encode
-from urllib.request import urlopen, Request, HTTPError
+from urllib.error import HTTPError
+from urllib.request import urlopen, Request
 from urllib.parse import urlparse
 from distutils.errors import DistutilsError, DistutilsOptionError
 from distutils.core import PyPIRCCommand
diff --git a/Lib/distutils/command/wininst-10.0-amd64.exe b/Lib/distutils/command/wininst-10.0-amd64.exe
deleted file mode 100644
index 6fa0dce..0000000
--- a/Lib/distutils/command/wininst-10.0-amd64.exe
+++ /dev/null
Binary files differ
diff --git a/Lib/distutils/command/wininst-10.0.exe b/Lib/distutils/command/wininst-10.0.exe
deleted file mode 100644
index afc3bc6..0000000
--- a/Lib/distutils/command/wininst-10.0.exe
+++ /dev/null
Binary files differ
diff --git a/Lib/distutils/command/wininst-14.0-amd64.exe b/Lib/distutils/command/wininst-14.0-amd64.exe
deleted file mode 100644
index 253c2e2..0000000
--- a/Lib/distutils/command/wininst-14.0-amd64.exe
+++ /dev/null
Binary files differ
diff --git a/Lib/distutils/command/wininst-14.0.exe b/Lib/distutils/command/wininst-14.0.exe
deleted file mode 100644
index 46f5f35..0000000
--- a/Lib/distutils/command/wininst-14.0.exe
+++ /dev/null
Binary files differ
diff --git a/Lib/distutils/command/wininst-6.0.exe b/Lib/distutils/command/wininst-6.0.exe
deleted file mode 100644
index f57c855..0000000
--- a/Lib/distutils/command/wininst-6.0.exe
+++ /dev/null
Binary files differ
diff --git a/Lib/distutils/command/wininst-7.1.exe b/Lib/distutils/command/wininst-7.1.exe
deleted file mode 100644
index 1433bc1..0000000
--- a/Lib/distutils/command/wininst-7.1.exe
+++ /dev/null
Binary files differ
diff --git a/Lib/distutils/command/wininst-8.0.exe b/Lib/distutils/command/wininst-8.0.exe
deleted file mode 100644
index 7403bfa..0000000
--- a/Lib/distutils/command/wininst-8.0.exe
+++ /dev/null
Binary files differ
diff --git a/Lib/distutils/command/wininst-9.0-amd64.exe b/Lib/distutils/command/wininst-9.0-amd64.exe
deleted file mode 100644
index 94fbd43..0000000
--- a/Lib/distutils/command/wininst-9.0-amd64.exe
+++ /dev/null
Binary files differ
diff --git a/Lib/distutils/command/wininst-9.0.exe b/Lib/distutils/command/wininst-9.0.exe
deleted file mode 100644
index 2ec261f..0000000
--- a/Lib/distutils/command/wininst-9.0.exe
+++ /dev/null
Binary files differ
diff --git a/Lib/distutils/extension.py b/Lib/distutils/extension.py
index c507da3..e85032e 100644
--- a/Lib/distutils/extension.py
+++ b/Lib/distutils/extension.py
@@ -4,6 +4,7 @@
 modules in setup scripts."""
 
 import os
+import re
 import warnings
 
 # This class is really only used by the "build_ext" command, so it might
@@ -161,7 +162,7 @@
             line = file.readline()
             if line is None:                # eof
                 break
-            if _variable_rx.match(line):    # VAR=VALUE, handled in first pass
+            if re.match(_variable_rx, line):    # VAR=VALUE, handled in first pass
                 continue
 
             if line[0] == line[-1] == "*":
diff --git a/Lib/distutils/msvc9compiler.py b/Lib/distutils/msvc9compiler.py
index 6934e96..a7976fb 100644
--- a/Lib/distutils/msvc9compiler.py
+++ b/Lib/distutils/msvc9compiler.py
@@ -673,7 +673,7 @@
         # If a manifest should be embedded, return a tuple of
         # (manifest_filename, resource_id).  Returns None if no manifest
         # should be embedded.  See http://bugs.python.org/issue7833 for why
-        # we want to avoid any manifest for extension modules if we can)
+        # we want to avoid any manifest for extension modules if we can.
         for arg in ld_args:
             if arg.startswith("/MANIFESTFILE:"):
                 temp_manifest = arg.split(":", 1)[1]
diff --git a/Lib/distutils/spawn.py b/Lib/distutils/spawn.py
index f50edd2..31df3f7 100644
--- a/Lib/distutils/spawn.py
+++ b/Lib/distutils/spawn.py
@@ -54,18 +54,22 @@
         global _cfg_target, _cfg_target_split
         if _cfg_target is None:
             from distutils import sysconfig
-            _cfg_target = str(sysconfig.get_config_var(
-                                  'MACOSX_DEPLOYMENT_TARGET') or '')
+            _cfg_target = sysconfig.get_config_var(
+                                  'MACOSX_DEPLOYMENT_TARGET') or ''
             if _cfg_target:
                 _cfg_target_split = [int(x) for x in _cfg_target.split('.')]
         if _cfg_target:
-            # ensure that the deployment target of build process is not less
-            # than that used when the interpreter was built. This ensures
-            # extension modules are built with correct compatibility values
+            # Ensure that the deployment target of the build process is not
+            # less than 10.3 if the interpreter was built for 10.3 or later.
+            # This ensures extension modules are built with correct
+            # compatibility values, specifically LDSHARED which can use
+            # '-undefined dynamic_lookup' which only works on >= 10.3.
             cur_target = os.environ.get('MACOSX_DEPLOYMENT_TARGET', _cfg_target)
-            if _cfg_target_split > [int(x) for x in cur_target.split('.')]:
+            cur_target_split = [int(x) for x in cur_target.split('.')]
+            if _cfg_target_split[:2] >= [10, 3] and cur_target_split[:2] < [10, 3]:
                 my_msg = ('$MACOSX_DEPLOYMENT_TARGET mismatch: '
-                          'now "%s" but "%s" during configure'
+                          'now "%s" but "%s" during configure;'
+                          'must use 10.3 or later'
                                 % (cur_target, _cfg_target))
                 raise DistutilsPlatformError(my_msg)
             env = dict(os.environ,
diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
index 37feae5..3414a76 100644
--- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py
@@ -13,56 +13,174 @@
 import os
 import re
 import sys
+import warnings
+
+from functools import partial
 
 from .errors import DistutilsPlatformError
 
-# These are needed in a couple of spots, so just compute them once.
-PREFIX = os.path.normpath(sys.prefix)
-EXEC_PREFIX = os.path.normpath(sys.exec_prefix)
-BASE_PREFIX = os.path.normpath(sys.base_prefix)
-BASE_EXEC_PREFIX = os.path.normpath(sys.base_exec_prefix)
+from sysconfig import (
+    _PREFIX as PREFIX,
+    _BASE_PREFIX as BASE_PREFIX,
+    _EXEC_PREFIX as EXEC_PREFIX,
+    _BASE_EXEC_PREFIX as BASE_EXEC_PREFIX,
+    _PROJECT_BASE as project_base,
+    _PYTHON_BUILD as python_build,
+    _init_posix as sysconfig_init_posix,
+    parse_config_h as sysconfig_parse_config_h,
 
-# Path to the base directory of the project. On Windows the binary may
-# live in project/PCbuild/win32 or project/PCbuild/amd64.
-# set for cross builds
-if "_PYTHON_PROJECT_BASE" in os.environ:
-    project_base = os.path.abspath(os.environ["_PYTHON_PROJECT_BASE"])
-else:
-    if sys.executable:
-        project_base = os.path.dirname(os.path.abspath(sys.executable))
-    else:
-        # sys.executable can be empty if argv[0] has been changed and Python is
-        # unable to retrieve the real program name
-        project_base = os.getcwd()
+    _init_non_posix,
+    _is_python_source_dir,
+    _sys_home,
+
+    _variable_rx,
+    _findvar1_rx,
+    _findvar2_rx,
+
+    expand_makefile_vars,
+    is_python_build,
+    get_config_h_filename,
+    get_config_var,
+    get_config_vars,
+    get_makefile_filename,
+    get_python_version,
+)
+
+# This is better than
+# from sysconfig import _CONFIG_VARS as _config_vars
+# because it makes sure that the global dictionary is initialized
+# which might not be true in the time of import.
+_config_vars = get_config_vars()
+
+if os.name == "nt":
+    from sysconfig import _fix_pcbuild
+
+warnings.warn(
+    'The distutils.sysconfig module is deprecated, use sysconfig instead',
+    DeprecationWarning,
+    stacklevel=2
+)
 
 
-# python_build: (Boolean) if true, we're either building Python or
-# building an extension with an un-installed Python, so we use
-# different (hard-wired) directories.
-def _is_python_source_dir(d):
-    for fn in ("Setup", "Setup.local"):
-        if os.path.isfile(os.path.join(d, "Modules", fn)):
-            return True
-    return False
+# Following functions are the same as in sysconfig but with different API
+def parse_config_h(fp, g=None):
+    return sysconfig_parse_config_h(fp, vars=g)
 
-_sys_home = getattr(sys, '_home', None)
 
-if os.name == 'nt':
-    def _fix_pcbuild(d):
-        if d and os.path.normcase(d).startswith(
-                os.path.normcase(os.path.join(PREFIX, "PCbuild"))):
-            return PREFIX
-        return d
-    project_base = _fix_pcbuild(project_base)
-    _sys_home = _fix_pcbuild(_sys_home)
+_python_build = partial(is_python_build, check_home=True)
+_init_posix = partial(sysconfig_init_posix, _config_vars)
+_init_nt = partial(_init_non_posix, _config_vars)
 
-def _python_build():
-    if _sys_home:
-        return _is_python_source_dir(_sys_home)
-    return _is_python_source_dir(project_base)
 
-python_build = _python_build()
+# Similar function is also implemented in sysconfig as _parse_makefile
+# but without the parsing capabilities of distutils.text_file.TextFile.
+def parse_makefile(fn, g=None):
+    """Parse a Makefile-style file.
+    A dictionary containing name/value pairs is returned.  If an
+    optional dictionary is passed in as the second argument, it is
+    used instead of a new dictionary.
+    """
+    from distutils.text_file import TextFile
+    fp = TextFile(fn, strip_comments=1, skip_blanks=1, join_lines=1, errors="surrogateescape")
 
+    if g is None:
+        g = {}
+    done = {}
+    notdone = {}
+
+    while True:
+        line = fp.readline()
+        if line is None: # eof
+            break
+        m = re.match(_variable_rx, line)
+        if m:
+            n, v = m.group(1, 2)
+            v = v.strip()
+            # `$$' is a literal `$' in make
+            tmpv = v.replace('$$', '')
+
+            if "$" in tmpv:
+                notdone[n] = v
+            else:
+                try:
+                    v = int(v)
+                except ValueError:
+                    # insert literal `$'
+                    done[n] = v.replace('$$', '$')
+                else:
+                    done[n] = v
+
+    # Variables with a 'PY_' prefix in the makefile. These need to
+    # be made available without that prefix through sysconfig.
+    # Special care is needed to ensure that variable expansion works, even
+    # if the expansion uses the name without a prefix.
+    renamed_variables = ('CFLAGS', 'LDFLAGS', 'CPPFLAGS')
+
+    # do variable interpolation here
+    while notdone:
+        for name in list(notdone):
+            value = notdone[name]
+            m = re.search(_findvar1_rx, value) or re.search(_findvar2_rx, value)
+            if m:
+                n = m.group(1)
+                found = True
+                if n in done:
+                    item = str(done[n])
+                elif n in notdone:
+                    # get it on a subsequent round
+                    found = False
+                elif n in os.environ:
+                    # do it like make: fall back to environment
+                    item = os.environ[n]
+
+                elif n in renamed_variables:
+                    if name.startswith('PY_') and name[3:] in renamed_variables:
+                        item = ""
+
+                    elif 'PY_' + n in notdone:
+                        found = False
+
+                    else:
+                        item = str(done['PY_' + n])
+                else:
+                    done[n] = item = ""
+                if found:
+                    after = value[m.end():]
+                    value = value[:m.start()] + item + after
+                    if "$" in after:
+                        notdone[name] = value
+                    else:
+                        try: value = int(value)
+                        except ValueError:
+                            done[name] = value.strip()
+                        else:
+                            done[name] = value
+                        del notdone[name]
+
+                        if name.startswith('PY_') \
+                            and name[3:] in renamed_variables:
+
+                            name = name[3:]
+                            if name not in done:
+                                done[name] = value
+            else:
+                # bogus variable reference; just drop it since we can't deal
+                del notdone[name]
+
+    fp.close()
+
+    # strip spurious spaces
+    for k, v in done.items():
+        if isinstance(v, str):
+            done[k] = v.strip()
+
+    # save the results in the global dictionary
+    g.update(done)
+    return g
+
+
+# Following functions are deprecated together with this module and they
+# have no direct replacement
 
 # Calculate the build qualifier flags if they are defined.  Adding the flags
 # to the include and lib directories only makes sense for an installation, not
@@ -76,12 +194,76 @@
     # this attribute, which is fine.
     pass
 
-def get_python_version():
-    """Return a string containing the major and minor Python version,
-    leaving off the patchlevel.  Sample return values could be '1.5'
-    or '2.2'.
+
+def customize_compiler(compiler):
+    """Do any platform-specific customization of a CCompiler instance.
+
+    Mainly needed on Unix, so we can plug in the information that
+    varies across Unices and is stored in Python's Makefile.
     """
-    return '%d.%d' % sys.version_info[:2]
+    if compiler.compiler_type == "unix":
+        if sys.platform == "darwin":
+            # Perform first-time customization of compiler-related
+            # config vars on OS X now that we know we need a compiler.
+            # This is primarily to support Pythons from binary
+            # installers.  The kind and paths to build tools on
+            # the user system may vary significantly from the system
+            # that Python itself was built on.  Also the user OS
+            # version and build tools may not support the same set
+            # of CPU architectures for universal builds.
+            if not _config_vars.get('CUSTOMIZED_OSX_COMPILER'):
+                import _osx_support
+                _osx_support.customize_compiler(_config_vars)
+                _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True'
+
+        (cc, cxx, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \
+            get_config_vars('CC', 'CXX', 'CFLAGS',
+                            'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')
+
+        if 'CC' in os.environ:
+            newcc = os.environ['CC']
+            if (sys.platform == 'darwin'
+                    and 'LDSHARED' not in os.environ
+                    and ldshared.startswith(cc)):
+                # On OS X, if CC is overridden, use that as the default
+                #       command for LDSHARED as well
+                ldshared = newcc + ldshared[len(cc):]
+            cc = newcc
+        if 'CXX' in os.environ:
+            cxx = os.environ['CXX']
+        if 'LDSHARED' in os.environ:
+            ldshared = os.environ['LDSHARED']
+        if 'CPP' in os.environ:
+            cpp = os.environ['CPP']
+        else:
+            cpp = cc + " -E"           # not always
+        if 'LDFLAGS' in os.environ:
+            ldshared = ldshared + ' ' + os.environ['LDFLAGS']
+        if 'CFLAGS' in os.environ:
+            cflags = cflags + ' ' + os.environ['CFLAGS']
+            ldshared = ldshared + ' ' + os.environ['CFLAGS']
+        if 'CPPFLAGS' in os.environ:
+            cpp = cpp + ' ' + os.environ['CPPFLAGS']
+            cflags = cflags + ' ' + os.environ['CPPFLAGS']
+            ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
+        if 'AR' in os.environ:
+            ar = os.environ['AR']
+        if 'ARFLAGS' in os.environ:
+            archiver = ar + ' ' + os.environ['ARFLAGS']
+        else:
+            archiver = ar + ' ' + ar_flags
+
+        cc_cmd = cc + ' ' + cflags
+        compiler.set_executables(
+            preprocessor=cpp,
+            compiler=cc_cmd,
+            compiler_so=cc_cmd + ' ' + ccshared,
+            compiler_cxx=cxx,
+            linker_so=ldshared,
+            linker_exe=cc,
+            archiver=archiver)
+
+        compiler.shared_lib_extension = shlib_suffix
 
 
 def get_python_inc(plat_specific=0, prefix=None):
@@ -167,389 +349,3 @@
         raise DistutilsPlatformError(
             "I don't know where Python installs its library "
             "on platform '%s'" % os.name)
-
-
-
-def customize_compiler(compiler):
-    """Do any platform-specific customization of a CCompiler instance.
-
-    Mainly needed on Unix, so we can plug in the information that
-    varies across Unices and is stored in Python's Makefile.
-    """
-    if compiler.compiler_type == "unix":
-        if sys.platform == "darwin":
-            # Perform first-time customization of compiler-related
-            # config vars on OS X now that we know we need a compiler.
-            # This is primarily to support Pythons from binary
-            # installers.  The kind and paths to build tools on
-            # the user system may vary significantly from the system
-            # that Python itself was built on.  Also the user OS
-            # version and build tools may not support the same set
-            # of CPU architectures for universal builds.
-            global _config_vars
-            # Use get_config_var() to ensure _config_vars is initialized.
-            if not get_config_var('CUSTOMIZED_OSX_COMPILER'):
-                import _osx_support
-                _osx_support.customize_compiler(_config_vars)
-                _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True'
-
-        (cc, cxx, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \
-            get_config_vars('CC', 'CXX', 'CFLAGS',
-                            'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')
-
-        if 'CC' in os.environ:
-            newcc = os.environ['CC']
-            if (sys.platform == 'darwin'
-                    and 'LDSHARED' not in os.environ
-                    and ldshared.startswith(cc)):
-                # On OS X, if CC is overridden, use that as the default
-                #       command for LDSHARED as well
-                ldshared = newcc + ldshared[len(cc):]
-            cc = newcc
-        if 'CXX' in os.environ:
-            cxx = os.environ['CXX']
-        if 'LDSHARED' in os.environ:
-            ldshared = os.environ['LDSHARED']
-        if 'CPP' in os.environ:
-            cpp = os.environ['CPP']
-        else:
-            cpp = cc + " -E"           # not always
-        if 'LDFLAGS' in os.environ:
-            ldshared = ldshared + ' ' + os.environ['LDFLAGS']
-        if 'CFLAGS' in os.environ:
-            cflags = cflags + ' ' + os.environ['CFLAGS']
-            ldshared = ldshared + ' ' + os.environ['CFLAGS']
-        if 'CPPFLAGS' in os.environ:
-            cpp = cpp + ' ' + os.environ['CPPFLAGS']
-            cflags = cflags + ' ' + os.environ['CPPFLAGS']
-            ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
-        if 'AR' in os.environ:
-            ar = os.environ['AR']
-        if 'ARFLAGS' in os.environ:
-            archiver = ar + ' ' + os.environ['ARFLAGS']
-        else:
-            archiver = ar + ' ' + ar_flags
-
-        cc_cmd = cc + ' ' + cflags
-        compiler.set_executables(
-            preprocessor=cpp,
-            compiler=cc_cmd,
-            compiler_so=cc_cmd + ' ' + ccshared,
-            compiler_cxx=cxx,
-            linker_so=ldshared,
-            linker_exe=cc,
-            archiver=archiver)
-
-        compiler.shared_lib_extension = shlib_suffix
-
-
-def get_config_h_filename():
-    """Return full pathname of installed pyconfig.h file."""
-    if python_build:
-        if os.name == "nt":
-            inc_dir = os.path.join(_sys_home or project_base, "PC")
-        else:
-            inc_dir = _sys_home or project_base
-    else:
-        inc_dir = get_python_inc(plat_specific=1)
-
-    return os.path.join(inc_dir, 'pyconfig.h')
-
-
-def get_makefile_filename():
-    """Return full pathname of installed Makefile from the Python build."""
-    if python_build:
-        return os.path.join(_sys_home or project_base, "Makefile")
-    lib_dir = get_python_lib(plat_specific=0, standard_lib=1)
-    config_file = 'config-{}{}'.format(get_python_version(), build_flags)
-    if hasattr(sys.implementation, '_multiarch'):
-        config_file += '-%s' % sys.implementation._multiarch
-    return os.path.join(lib_dir, config_file, 'Makefile')
-
-
-def parse_config_h(fp, g=None):
-    """Parse a config.h-style file.
-
-    A dictionary containing name/value pairs is returned.  If an
-    optional dictionary is passed in as the second argument, it is
-    used instead of a new dictionary.
-    """
-    if g is None:
-        g = {}
-    define_rx = re.compile("#define ([A-Z][A-Za-z0-9_]+) (.*)\n")
-    undef_rx = re.compile("/[*] #undef ([A-Z][A-Za-z0-9_]+) [*]/\n")
-    #
-    while True:
-        line = fp.readline()
-        if not line:
-            break
-        m = define_rx.match(line)
-        if m:
-            n, v = m.group(1, 2)
-            try: v = int(v)
-            except ValueError: pass
-            g[n] = v
-        else:
-            m = undef_rx.match(line)
-            if m:
-                g[m.group(1)] = 0
-    return g
-
-
-# Regexes needed for parsing Makefile (and similar syntaxes,
-# like old-style Setup files).
-_variable_rx = re.compile(r"([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)")
-_findvar1_rx = re.compile(r"\$\(([A-Za-z][A-Za-z0-9_]*)\)")
-_findvar2_rx = re.compile(r"\${([A-Za-z][A-Za-z0-9_]*)}")
-
-def parse_makefile(fn, g=None):
-    """Parse a Makefile-style file.
-
-    A dictionary containing name/value pairs is returned.  If an
-    optional dictionary is passed in as the second argument, it is
-    used instead of a new dictionary.
-    """
-    from distutils.text_file import TextFile
-    fp = TextFile(fn, strip_comments=1, skip_blanks=1, join_lines=1, errors="surrogateescape")
-
-    if g is None:
-        g = {}
-    done = {}
-    notdone = {}
-
-    while True:
-        line = fp.readline()
-        if line is None: # eof
-            break
-        m = _variable_rx.match(line)
-        if m:
-            n, v = m.group(1, 2)
-            v = v.strip()
-            # `$$' is a literal `$' in make
-            tmpv = v.replace('$$', '')
-
-            if "$" in tmpv:
-                notdone[n] = v
-            else:
-                try:
-                    v = int(v)
-                except ValueError:
-                    # insert literal `$'
-                    done[n] = v.replace('$$', '$')
-                else:
-                    done[n] = v
-
-    # Variables with a 'PY_' prefix in the makefile. These need to
-    # be made available without that prefix through sysconfig.
-    # Special care is needed to ensure that variable expansion works, even
-    # if the expansion uses the name without a prefix.
-    renamed_variables = ('CFLAGS', 'LDFLAGS', 'CPPFLAGS')
-
-    # do variable interpolation here
-    while notdone:
-        for name in list(notdone):
-            value = notdone[name]
-            m = _findvar1_rx.search(value) or _findvar2_rx.search(value)
-            if m:
-                n = m.group(1)
-                found = True
-                if n in done:
-                    item = str(done[n])
-                elif n in notdone:
-                    # get it on a subsequent round
-                    found = False
-                elif n in os.environ:
-                    # do it like make: fall back to environment
-                    item = os.environ[n]
-
-                elif n in renamed_variables:
-                    if name.startswith('PY_') and name[3:] in renamed_variables:
-                        item = ""
-
-                    elif 'PY_' + n in notdone:
-                        found = False
-
-                    else:
-                        item = str(done['PY_' + n])
-                else:
-                    done[n] = item = ""
-                if found:
-                    after = value[m.end():]
-                    value = value[:m.start()] + item + after
-                    if "$" in after:
-                        notdone[name] = value
-                    else:
-                        try: value = int(value)
-                        except ValueError:
-                            done[name] = value.strip()
-                        else:
-                            done[name] = value
-                        del notdone[name]
-
-                        if name.startswith('PY_') \
-                            and name[3:] in renamed_variables:
-
-                            name = name[3:]
-                            if name not in done:
-                                done[name] = value
-            else:
-                # bogus variable reference; just drop it since we can't deal
-                del notdone[name]
-
-    fp.close()
-
-    # strip spurious spaces
-    for k, v in done.items():
-        if isinstance(v, str):
-            done[k] = v.strip()
-
-    # save the results in the global dictionary
-    g.update(done)
-    return g
-
-
-def expand_makefile_vars(s, vars):
-    """Expand Makefile-style variables -- "${foo}" or "$(foo)" -- in
-    'string' according to 'vars' (a dictionary mapping variable names to
-    values).  Variables not present in 'vars' are silently expanded to the
-    empty string.  The variable values in 'vars' should not contain further
-    variable expansions; if 'vars' is the output of 'parse_makefile()',
-    you're fine.  Returns a variable-expanded version of 's'.
-    """
-
-    # This algorithm does multiple expansion, so if vars['foo'] contains
-    # "${bar}", it will expand ${foo} to ${bar}, and then expand
-    # ${bar}... and so forth.  This is fine as long as 'vars' comes from
-    # 'parse_makefile()', which takes care of such expansions eagerly,
-    # according to make's variable expansion semantics.
-
-    while True:
-        m = _findvar1_rx.search(s) or _findvar2_rx.search(s)
-        if m:
-            (beg, end) = m.span()
-            s = s[0:beg] + vars.get(m.group(1)) + s[end:]
-        else:
-            break
-    return s
-
-
-_config_vars = None
-
-def _init_posix():
-    """Initialize the module as appropriate for POSIX systems."""
-    # _sysconfigdata is generated at build time, see the sysconfig module
-    name = os.environ.get('_PYTHON_SYSCONFIGDATA_NAME',
-        '_sysconfigdata_{abi}_{platform}_{multiarch}'.format(
-        abi=sys.abiflags,
-        platform=sys.platform,
-        multiarch=getattr(sys.implementation, '_multiarch', ''),
-    ))
-    _temp = __import__(name, globals(), locals(), ['build_time_vars'], 0)
-    build_time_vars = _temp.build_time_vars
-    global _config_vars
-    _config_vars = {}
-    _config_vars.update(build_time_vars)
-
-
-def _init_nt():
-    """Initialize the module as appropriate for NT"""
-    g = {}
-    # set basic install directories
-    g['LIBDEST'] = get_python_lib(plat_specific=0, standard_lib=1)
-    g['BINLIBDEST'] = get_python_lib(plat_specific=1, standard_lib=1)
-
-    # XXX hmmm.. a normal install puts include files here
-    g['INCLUDEPY'] = get_python_inc(plat_specific=0)
-
-    g['EXT_SUFFIX'] = _imp.extension_suffixes()[0]
-    g['EXE'] = ".exe"
-    g['VERSION'] = get_python_version().replace(".", "")
-    g['BINDIR'] = os.path.dirname(os.path.abspath(sys.executable))
-
-    global _config_vars
-    _config_vars = g
-
-
-def get_config_vars(*args):
-    """With no arguments, return a dictionary of all configuration
-    variables relevant for the current platform.  Generally this includes
-    everything needed to build extensions and install both pure modules and
-    extensions.  On Unix, this means every variable defined in Python's
-    installed Makefile; on Windows it's a much smaller set.
-
-    With arguments, return a list of values that result from looking up
-    each argument in the configuration variable dictionary.
-    """
-    global _config_vars
-    if _config_vars is None:
-        func = globals().get("_init_" + os.name)
-        if func:
-            func()
-        else:
-            _config_vars = {}
-
-        # Normalized versions of prefix and exec_prefix are handy to have;
-        # in fact, these are the standard versions used most places in the
-        # Distutils.
-        _config_vars['prefix'] = PREFIX
-        _config_vars['exec_prefix'] = EXEC_PREFIX
-
-        # For backward compatibility, see issue19555
-        SO = _config_vars.get('EXT_SUFFIX')
-        if SO is not None:
-            _config_vars['SO'] = SO
-
-        # Always convert srcdir to an absolute path
-        srcdir = _config_vars.get('srcdir', project_base)
-        if os.name == 'posix':
-            if python_build:
-                # If srcdir is a relative path (typically '.' or '..')
-                # then it should be interpreted relative to the directory
-                # containing Makefile.
-                base = os.path.dirname(get_makefile_filename())
-                srcdir = os.path.join(base, srcdir)
-            else:
-                # srcdir is not meaningful since the installation is
-                # spread about the filesystem.  We choose the
-                # directory containing the Makefile since we know it
-                # exists.
-                srcdir = os.path.dirname(get_makefile_filename())
-        _config_vars['srcdir'] = os.path.abspath(os.path.normpath(srcdir))
-
-        # Convert srcdir into an absolute path if it appears necessary.
-        # Normally it is relative to the build directory.  However, during
-        # testing, for example, we might be running a non-installed python
-        # from a different directory.
-        if python_build and os.name == "posix":
-            base = project_base
-            if (not os.path.isabs(_config_vars['srcdir']) and
-                base != os.getcwd()):
-                # srcdir is relative and we are not in the same directory
-                # as the executable. Assume executable is in the build
-                # directory and make srcdir absolute.
-                srcdir = os.path.join(base, _config_vars['srcdir'])
-                _config_vars['srcdir'] = os.path.normpath(srcdir)
-
-        # OS X platforms require special customization to handle
-        # multi-architecture, multi-os-version installers
-        if sys.platform == 'darwin':
-            import _osx_support
-            _osx_support.customize_config_vars(_config_vars)
-
-    if args:
-        vals = []
-        for name in args:
-            vals.append(_config_vars.get(name))
-        return vals
-    else:
-        return _config_vars
-
-def get_config_var(name):
-    """Return the value of a single variable using the dictionary
-    returned by 'get_config_vars()'.  Equivalent to
-    get_config_vars().get(name)
-    """
-    if name == 'SO':
-        import warnings
-        warnings.warn('SO is deprecated, use EXT_SUFFIX', DeprecationWarning, 2)
-    return get_config_vars().get(name)
diff --git a/Lib/distutils/tests/__init__.py b/Lib/distutils/tests/__init__.py
index 6803721..16d011f 100644
--- a/Lib/distutils/tests/__init__.py
+++ b/Lib/distutils/tests/__init__.py
@@ -15,7 +15,8 @@
 import os
 import sys
 import unittest
-from test.support import run_unittest, save_restore_warnings_filters
+from test.support import run_unittest
+from test.support.warnings_helper import save_restore_warnings_filters
 
 
 here = os.path.dirname(__file__) or os.curdir
diff --git a/Lib/distutils/tests/support.py b/Lib/distutils/tests/support.py
index 259af88..23b907b 100644
--- a/Lib/distutils/tests/support.py
+++ b/Lib/distutils/tests/support.py
@@ -6,7 +6,7 @@
 import unittest
 import sysconfig
 from copy import deepcopy
-import test.support
+from test.support import os_helper
 
 from distutils import log
 from distutils.log import DEBUG, INFO, WARN, ERROR, FATAL
@@ -64,7 +64,7 @@
         super().tearDown()
         while self.tempdirs:
             tmpdir = self.tempdirs.pop()
-            test.support.rmtree(tmpdir)
+            os_helper.rmtree(tmpdir)
 
     def mkdtemp(self):
         """Create a temporary directory that will be cleaned up.
diff --git a/Lib/distutils/tests/test_archive_util.py b/Lib/distutils/tests/test_archive_util.py
index e9aad0e..edcec25 100644
--- a/Lib/distutils/tests/test_archive_util.py
+++ b/Lib/distutils/tests/test_archive_util.py
@@ -13,7 +13,9 @@
                                     ARCHIVE_FORMATS)
 from distutils.spawn import find_executable, spawn
 from distutils.tests import support
-from test.support import check_warnings, run_unittest, patch, change_cwd
+from test.support import run_unittest, patch
+from test.support.os_helper import change_cwd
+from test.support.warnings_helper import check_warnings
 
 try:
     import grp
diff --git a/Lib/distutils/tests/test_bdist.py b/Lib/distutils/tests/test_bdist.py
index 130d8bf..55fa393 100644
--- a/Lib/distutils/tests/test_bdist.py
+++ b/Lib/distutils/tests/test_bdist.py
@@ -2,10 +2,12 @@
 import os
 import unittest
 from test.support import run_unittest
-import warnings
 
-from distutils.command.bdist import bdist
-from distutils.tests import support
+import warnings
+with warnings.catch_warnings():
+    warnings.simplefilter('ignore', DeprecationWarning)
+    from distutils.command.bdist import bdist
+    from distutils.tests import support
 
 
 class BuildTestCase(support.TempdirManager,
@@ -22,7 +24,7 @@
 
         # what formats does bdist offer?
         formats = ['bztar', 'gztar', 'msi', 'rpm', 'tar',
-                   'wininst', 'xztar', 'zip', 'ztar']
+                   'xztar', 'zip', 'ztar']
         found = sorted(cmd.format_command)
         self.assertEqual(found, formats)
 
@@ -34,15 +36,12 @@
         cmd.ensure_finalized()
         dist.command_obj['bdist'] = cmd
 
-        names = ['bdist_dumb', 'bdist_wininst']  # bdist_rpm does not support --skip-build
+        names = ['bdist_dumb']  # bdist_rpm does not support --skip-build
         if os.name == 'nt':
             names.append('bdist_msi')
 
         for name in names:
-            with warnings.catch_warnings():
-                warnings.filterwarnings('ignore', 'bdist_wininst command is deprecated',
-                                        DeprecationWarning)
-                subcmd = cmd.get_finalized_command(name)
+            subcmd = cmd.get_finalized_command(name)
             if getattr(subcmd, '_unsupported', False):
                 # command is not supported on this build
                 continue
diff --git a/Lib/distutils/tests/test_bdist_msi.py b/Lib/distutils/tests/test_bdist_msi.py
index 418e60e..a61266a 100644
--- a/Lib/distutils/tests/test_bdist_msi.py
+++ b/Lib/distutils/tests/test_bdist_msi.py
@@ -1,7 +1,8 @@
 """Tests for distutils.command.bdist_msi."""
 import sys
 import unittest
-from test.support import run_unittest, check_warnings
+from test.support import run_unittest
+from test.support.warnings_helper import check_warnings
 from distutils.tests import support
 
 
diff --git a/Lib/distutils/tests/test_bdist_rpm.py b/Lib/distutils/tests/test_bdist_rpm.py
index 6453a02..ba4382f 100644
--- a/Lib/distutils/tests/test_bdist_rpm.py
+++ b/Lib/distutils/tests/test_bdist_rpm.py
@@ -44,7 +44,7 @@
     # spurious sdtout/stderr output under Mac OS X
     @unittest.skipUnless(sys.platform.startswith('linux'),
                          'spurious sdtout/stderr output under Mac OS X')
-    @requires_zlib
+    @requires_zlib()
     @unittest.skipIf(find_executable('rpm') is None,
                      'the rpm command is not found')
     @unittest.skipIf(find_executable('rpmbuild') is None,
@@ -87,7 +87,7 @@
     # spurious sdtout/stderr output under Mac OS X
     @unittest.skipUnless(sys.platform.startswith('linux'),
                          'spurious sdtout/stderr output under Mac OS X')
-    @requires_zlib
+    @requires_zlib()
     # http://bugs.python.org/issue1533164
     @unittest.skipIf(find_executable('rpm') is None,
                      'the rpm command is not found')
diff --git a/Lib/distutils/tests/test_bdist_wininst.py b/Lib/distutils/tests/test_bdist_wininst.py
deleted file mode 100644
index 5c3d025..0000000
--- a/Lib/distutils/tests/test_bdist_wininst.py
+++ /dev/null
@@ -1,38 +0,0 @@
-"""Tests for distutils.command.bdist_wininst."""
-import sys
-import platform
-import unittest
-from test.support import run_unittest, check_warnings
-
-from distutils.command.bdist_wininst import bdist_wininst
-from distutils.tests import support
-
-@unittest.skipIf(sys.platform == 'win32' and platform.machine() == 'ARM64',
-    'bdist_wininst is not supported in this install')
-@unittest.skipIf(getattr(bdist_wininst, '_unsupported', False),
-    'bdist_wininst is not supported in this install')
-class BuildWinInstTestCase(support.TempdirManager,
-                           support.LoggingSilencer,
-                           unittest.TestCase):
-
-    def test_get_exe_bytes(self):
-
-        # issue5731: command was broken on non-windows platforms
-        # this test makes sure it works now for every platform
-        # let's create a command
-        pkg_pth, dist = self.create_dist()
-        with check_warnings(("", DeprecationWarning)):
-            cmd = bdist_wininst(dist)
-        cmd.ensure_finalized()
-
-        # let's run the code that finds the right wininst*.exe file
-        # and make sure it finds it and returns its content
-        # no matter what platform we have
-        exe_file = cmd.get_exe_bytes()
-        self.assertGreater(len(exe_file), 10)
-
-def test_suite():
-    return unittest.makeSuite(BuildWinInstTestCase)
-
-if __name__ == '__main__':
-    run_unittest(test_suite())
diff --git a/Lib/distutils/tests/test_build_clib.py b/Lib/distutils/tests/test_build_clib.py
index abd8313..19e012a 100644
--- a/Lib/distutils/tests/test_build_clib.py
+++ b/Lib/distutils/tests/test_build_clib.py
@@ -2,6 +2,7 @@
 import unittest
 import os
 import sys
+import sysconfig
 
 from test.support import run_unittest, missing_compiler_executable
 
@@ -13,6 +14,15 @@
                         support.LoggingSilencer,
                         unittest.TestCase):
 
+    def setUp(self):
+        super().setUp()
+        self._backup_CONFIG_VARS = dict(sysconfig._CONFIG_VARS)
+
+    def tearDown(self):
+        super().tearDown()
+        sysconfig._CONFIG_VARS.clear()
+        sysconfig._CONFIG_VARS.update(self._backup_CONFIG_VARS)
+
     def test_check_library_dist(self):
         pkg_dir, dist = self.create_dist()
         cmd = build_clib(dist)
diff --git a/Lib/distutils/tests/test_build_ext.py b/Lib/distutils/tests/test_build_ext.py
index 1b034c9..8e7364d 100644
--- a/Lib/distutils/tests/test_build_ext.py
+++ b/Lib/distutils/tests/test_build_ext.py
@@ -15,6 +15,7 @@
 
 import unittest
 from test import support
+from test.support import os_helper
 from test.support.script_helper import assert_python_ok
 
 # http://bugs.python.org/issue4373
@@ -34,11 +35,12 @@
         site.USER_BASE = self.mkdtemp()
         from distutils.command import build_ext
         build_ext.USER_BASE = site.USER_BASE
+        self.old_config_vars = dict(sysconfig._config_vars)
 
         # bpo-30132: On Windows, a .pdb file may be created in the current
         # working directory. Create a temporary working directory to cleanup
         # everything at the end of the test.
-        change_cwd = support.change_cwd(self.tmp_dir)
+        change_cwd = os_helper.change_cwd(self.tmp_dir)
         change_cwd.__enter__()
         self.addCleanup(change_cwd.__exit__, None, None, None)
 
@@ -47,6 +49,8 @@
         site.USER_BASE = self.old_user_base
         from distutils.command import build_ext
         build_ext.USER_BASE = self.old_user_base
+        sysconfig._config_vars.clear()
+        sysconfig._config_vars.update(self.old_config_vars)
         super(BuildExtTestCase, self).tearDown()
 
     def build_ext(self, *args, **kwargs):
@@ -455,7 +459,7 @@
         deptarget = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
         if deptarget:
             # increment the minor version number (i.e. 10.6 -> 10.7)
-            deptarget = [int(x) for x in str(deptarget).split('.')]
+            deptarget = [int(x) for x in deptarget.split('.')]
             deptarget[-1] += 1
             deptarget = '.'.join(str(i) for i in deptarget)
             self._try_compile_deployment_target('<', deptarget)
@@ -488,7 +492,7 @@
 
         # get the deployment target that the interpreter was built with
         target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
-        target = tuple(map(int, str(target).split('.')[0:2]))
+        target = tuple(map(int, target.split('.')[0:2]))
         # format the target value as defined in the Apple
         # Availability Macros.  We can't use the macro names since
         # at least one value we test with will not exist yet.
diff --git a/Lib/distutils/tests/test_config_cmd.py b/Lib/distutils/tests/test_config_cmd.py
index 9aeab07..0127ba7 100644
--- a/Lib/distutils/tests/test_config_cmd.py
+++ b/Lib/distutils/tests/test_config_cmd.py
@@ -2,6 +2,7 @@
 import unittest
 import os
 import sys
+import sysconfig
 from test.support import run_unittest, missing_compiler_executable
 
 from distutils.command.config import dump_file, config
@@ -21,9 +22,12 @@
         self._logs = []
         self.old_log = log.info
         log.info = self._info
+        self.old_config_vars = dict(sysconfig._CONFIG_VARS)
 
     def tearDown(self):
         log.info = self.old_log
+        sysconfig._CONFIG_VARS.clear()
+        sysconfig._CONFIG_VARS.update(self.old_config_vars)
         super(ConfigTestCase, self).tearDown()
 
     def test_dump_file(self):
diff --git a/Lib/distutils/tests/test_core.py b/Lib/distutils/tests/test_core.py
index 27ce732..4e6694a 100644
--- a/Lib/distutils/tests/test_core.py
+++ b/Lib/distutils/tests/test_core.py
@@ -5,8 +5,8 @@
 import os
 import shutil
 import sys
-import test.support
 from test.support import captured_stdout, run_unittest
+from test.support import os_helper
 import unittest
 from distutils.tests import support
 from distutils import log
@@ -62,13 +62,13 @@
         super(CoreTestCase, self).tearDown()
 
     def cleanup_testfn(self):
-        path = test.support.TESTFN
+        path = os_helper.TESTFN
         if os.path.isfile(path):
             os.remove(path)
         elif os.path.isdir(path):
             shutil.rmtree(path)
 
-    def write_setup(self, text, path=test.support.TESTFN):
+    def write_setup(self, text, path=os_helper.TESTFN):
         f = open(path, "w")
         try:
             f.write(text)
@@ -105,8 +105,8 @@
         cwd = os.getcwd()
 
         # Create a directory and write the setup.py file there:
-        os.mkdir(test.support.TESTFN)
-        setup_py = os.path.join(test.support.TESTFN, "setup.py")
+        os.mkdir(os_helper.TESTFN)
+        setup_py = os.path.join(os_helper.TESTFN, "setup.py")
         distutils.core.run_setup(
             self.write_setup(setup_prints_cwd, path=setup_py))
 
diff --git a/Lib/distutils/tests/test_dist.py b/Lib/distutils/tests/test_dist.py
index 60956da..f8a9e86 100644
--- a/Lib/distutils/tests/test_dist.py
+++ b/Lib/distutils/tests/test_dist.py
@@ -12,8 +12,9 @@
 from distutils.cmd import Command
 
 from test.support import (
-     TESTFN, captured_stdout, captured_stderr, run_unittest
+     captured_stdout, captured_stderr, run_unittest
 )
+from test.support.os_helper import TESTFN
 from distutils.tests import support
 from distutils import log
 
diff --git a/Lib/distutils/tests/test_extension.py b/Lib/distutils/tests/test_extension.py
index e35f273..81fad02 100644
--- a/Lib/distutils/tests/test_extension.py
+++ b/Lib/distutils/tests/test_extension.py
@@ -3,7 +3,8 @@
 import os
 import warnings
 
-from test.support import check_warnings, run_unittest
+from test.support import run_unittest
+from test.support.warnings_helper import check_warnings
 from distutils.extension import read_setup_file, Extension
 
 class ExtensionTestCase(unittest.TestCase):
diff --git a/Lib/distutils/tests/test_file_util.py b/Lib/distutils/tests/test_file_util.py
index a4e2d02..c7783b8 100644
--- a/Lib/distutils/tests/test_file_util.py
+++ b/Lib/distutils/tests/test_file_util.py
@@ -8,7 +8,9 @@
 from distutils import log
 from distutils.tests import support
 from distutils.errors import DistutilsFileError
-from test.support import run_unittest, unlink
+from test.support import run_unittest
+from test.support.os_helper import unlink
+
 
 class FileUtilTestCase(support.TempdirManager, unittest.TestCase):
 
diff --git a/Lib/distutils/tests/test_filelist.py b/Lib/distutils/tests/test_filelist.py
index c71342d..cee97d4 100644
--- a/Lib/distutils/tests/test_filelist.py
+++ b/Lib/distutils/tests/test_filelist.py
@@ -8,7 +8,7 @@
 from distutils.filelist import glob_to_re, translate_pattern, FileList
 from distutils import filelist
 
-import test.support
+from test.support import os_helper
 from test.support import captured_stdout, run_unittest
 from distutils.tests import support
 
@@ -295,9 +295,9 @@
 
 
 class FindAllTestCase(unittest.TestCase):
-    @test.support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_missing_symlink(self):
-        with test.support.temp_cwd():
+        with os_helper.temp_cwd():
             os.symlink('foo', 'bar')
             self.assertEqual(filelist.findall(), [])
 
@@ -307,13 +307,13 @@
         '.' as the parameter, the dot should be omitted from
         the results.
         """
-        with test.support.temp_cwd():
+        with os_helper.temp_cwd():
             os.mkdir('foo')
             file1 = os.path.join('foo', 'file1.txt')
-            test.support.create_empty_file(file1)
+            os_helper.create_empty_file(file1)
             os.mkdir('bar')
             file2 = os.path.join('bar', 'file2.txt')
-            test.support.create_empty_file(file2)
+            os_helper.create_empty_file(file2)
             expected = [file2, file1]
             self.assertEqual(sorted(filelist.findall()), expected)
 
@@ -322,9 +322,9 @@
         When findall is called with another path, the full
         path name should be returned.
         """
-        with test.support.temp_dir() as temp_dir:
+        with os_helper.temp_dir() as temp_dir:
             file1 = os.path.join(temp_dir, 'file1.txt')
-            test.support.create_empty_file(file1)
+            os_helper.create_empty_file(file1)
             expected = [file1]
             self.assertEqual(filelist.findall(temp_dir), expected)
 
diff --git a/Lib/distutils/tests/test_install.py b/Lib/distutils/tests/test_install.py
index 51c80e0..0632024 100644
--- a/Lib/distutils/tests/test_install.py
+++ b/Lib/distutils/tests/test_install.py
@@ -8,7 +8,7 @@
 from test.support import captured_stdout, run_unittest
 
 from distutils import sysconfig
-from distutils.command.install import install
+from distutils.command.install import install, HAS_USER_SITE
 from distutils.command import install as install_module
 from distutils.command.build_ext import build_ext
 from distutils.command.install import INSTALL_SCHEMES
@@ -29,6 +29,15 @@
                       support.LoggingSilencer,
                       unittest.TestCase):
 
+    def setUp(self):
+        super().setUp()
+        self._backup_config_vars = dict(sysconfig._config_vars)
+
+    def tearDown(self):
+        super().tearDown()
+        sysconfig._config_vars.clear()
+        sysconfig._config_vars.update(self._backup_config_vars)
+
     def test_home_installation_scheme(self):
         # This ensure two things:
         # - that --home generates the desired set of directory names
@@ -66,6 +75,7 @@
         check_path(cmd.install_scripts, os.path.join(destination, "bin"))
         check_path(cmd.install_data, destination)
 
+    @unittest.skipUnless(HAS_USER_SITE, 'need user site')
     def test_user_site(self):
         # test install with --user
         # preparing the environment for the test
@@ -93,8 +103,9 @@
 
         self.addCleanup(cleanup)
 
-        for key in ('nt_user', 'unix_user'):
-            self.assertIn(key, INSTALL_SCHEMES)
+        if HAS_USER_SITE:
+            for key in ('nt_user', 'unix_user'):
+                self.assertIn(key, INSTALL_SCHEMES)
 
         dist = Distribution({'name': 'xx'})
         cmd = install(dist)
diff --git a/Lib/distutils/tests/test_register.py b/Lib/distutils/tests/test_register.py
index e68b0af..bba4863 100644
--- a/Lib/distutils/tests/test_register.py
+++ b/Lib/distutils/tests/test_register.py
@@ -5,7 +5,8 @@
 import urllib
 import warnings
 
-from test.support import check_warnings, run_unittest
+from test.support import run_unittest
+from test.support.warnings_helper import check_warnings
 
 from distutils.command import register as register_module
 from distutils.command.register import register
diff --git a/Lib/distutils/tests/test_sdist.py b/Lib/distutils/tests/test_sdist.py
index 23db126..752e9db 100644
--- a/Lib/distutils/tests/test_sdist.py
+++ b/Lib/distutils/tests/test_sdist.py
@@ -6,7 +6,8 @@
 import zipfile
 from os.path import join
 from textwrap import dedent
-from test.support import captured_stdout, check_warnings, run_unittest
+from test.support import captured_stdout, run_unittest
+from test.support.warnings_helper import check_warnings
 
 try:
     import zlib
diff --git a/Lib/distutils/tests/test_spawn.py b/Lib/distutils/tests/test_spawn.py
index ad50381..4ec767b 100644
--- a/Lib/distutils/tests/test_spawn.py
+++ b/Lib/distutils/tests/test_spawn.py
@@ -4,7 +4,7 @@
 import sys
 import unittest.mock
 from test.support import run_unittest, unix_shell
-from test import support as test_support
+from test.support import os_helper
 
 from distutils.spawn import find_executable
 from distutils.spawn import spawn
@@ -44,9 +44,9 @@
         spawn([exe])  # should work without any error
 
     def test_find_executable(self):
-        with test_support.temp_dir() as tmp_dir:
+        with os_helper.temp_dir() as tmp_dir:
             # use TESTFN to get a pseudo-unique filename
-            program_noeext = test_support.TESTFN
+            program_noeext = os_helper.TESTFN
             # Give the temporary program an ".exe" suffix for all.
             # It's needed on Windows and not harmful on other platforms.
             program = program_noeext + ".exe"
@@ -66,7 +66,7 @@
                 self.assertEqual(rv, filename)
 
             # test find in the current directory
-            with test_support.change_cwd(tmp_dir):
+            with os_helper.change_cwd(tmp_dir):
                 rv = find_executable(program)
                 self.assertEqual(rv, program)
 
@@ -76,7 +76,7 @@
             self.assertIsNone(rv)
 
             # PATH='': no match, except in the current directory
-            with test_support.EnvironmentVarGuard() as env:
+            with os_helper.EnvironmentVarGuard() as env:
                 env['PATH'] = ''
                 with unittest.mock.patch('distutils.spawn.os.confstr',
                                          return_value=tmp_dir, create=True), \
@@ -86,12 +86,12 @@
                     self.assertIsNone(rv)
 
                     # look in current directory
-                    with test_support.change_cwd(tmp_dir):
+                    with os_helper.change_cwd(tmp_dir):
                         rv = find_executable(program)
                         self.assertEqual(rv, program)
 
             # PATH=':': explicitly looks in the current directory
-            with test_support.EnvironmentVarGuard() as env:
+            with os_helper.EnvironmentVarGuard() as env:
                 env['PATH'] = os.pathsep
                 with unittest.mock.patch('distutils.spawn.os.confstr',
                                          return_value='', create=True), \
@@ -100,12 +100,12 @@
                     self.assertIsNone(rv)
 
                     # look in current directory
-                    with test_support.change_cwd(tmp_dir):
+                    with os_helper.change_cwd(tmp_dir):
                         rv = find_executable(program)
                         self.assertEqual(rv, program)
 
             # missing PATH: test os.confstr("CS_PATH") and os.defpath
-            with test_support.EnvironmentVarGuard() as env:
+            with os_helper.EnvironmentVarGuard() as env:
                 env.pop('PATH', None)
 
                 # without confstr
diff --git a/Lib/distutils/tests/test_sysconfig.py b/Lib/distutils/tests/test_sysconfig.py
index 236755d..59676b0 100644
--- a/Lib/distutils/tests/test_sysconfig.py
+++ b/Lib/distutils/tests/test_sysconfig.py
@@ -10,7 +10,10 @@
 from distutils import sysconfig
 from distutils.ccompiler import get_default_compiler
 from distutils.tests import support
-from test.support import TESTFN, run_unittest, check_warnings, swap_item
+from test.support import run_unittest, swap_item
+from test.support.os_helper import TESTFN
+from test.support.warnings_helper import check_warnings
+
 
 class SysconfigTestCase(support.EnvironGuard, unittest.TestCase):
     def setUp(self):
diff --git a/Lib/distutils/tests/test_unixccompiler.py b/Lib/distutils/tests/test_unixccompiler.py
index eef702c..24725ea 100644
--- a/Lib/distutils/tests/test_unixccompiler.py
+++ b/Lib/distutils/tests/test_unixccompiler.py
@@ -1,7 +1,8 @@
 """Tests for distutils.unixccompiler."""
 import sys
 import unittest
-from test.support import EnvironmentVarGuard, run_unittest
+from test.support import run_unittest
+from test.support.os_helper import EnvironmentVarGuard
 
 from distutils import sysconfig
 from distutils.unixccompiler import UnixCCompiler
@@ -11,6 +12,7 @@
     def setUp(self):
         self._backup_platform = sys.platform
         self._backup_get_config_var = sysconfig.get_config_var
+        self._backup_config_vars = dict(sysconfig._config_vars)
         class CompilerWrapper(UnixCCompiler):
             def rpath_foo(self):
                 return self.runtime_library_dir_option('/foo')
@@ -19,6 +21,8 @@
     def tearDown(self):
         sys.platform = self._backup_platform
         sysconfig.get_config_var = self._backup_get_config_var
+        sysconfig._config_vars.clear()
+        sysconfig._config_vars.update(self._backup_config_vars)
 
     @unittest.skipIf(sys.platform == 'win32', "can't test on Windows")
     def test_runtime_libdir_option(self):
diff --git a/Lib/distutils/tests/test_upload.py b/Lib/distutils/tests/test_upload.py
index bca5516..74f0bc0 100644
--- a/Lib/distutils/tests/test_upload.py
+++ b/Lib/distutils/tests/test_upload.py
@@ -2,7 +2,7 @@
 import os
 import unittest
 import unittest.mock as mock
-from urllib.request import HTTPError
+from urllib.error import HTTPError
 
 from test.support import run_unittest
 
diff --git a/Lib/distutils/tests/test_util.py b/Lib/distutils/tests/test_util.py
index bf0d433..d4a01c6 100644
--- a/Lib/distutils/tests/test_util.py
+++ b/Lib/distutils/tests/test_util.py
@@ -54,7 +54,8 @@
             os.uname = self.uname
         else:
             del os.uname
-        sysconfig._config_vars = copy(self._config_vars)
+        sysconfig._config_vars.clear()
+        sysconfig._config_vars.update(self._config_vars)
         super(UtilTestCase, self).tearDown()
 
     def _set_uname(self, uname):
diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py
index f0792de..d00c489 100644
--- a/Lib/distutils/unixccompiler.py
+++ b/Lib/distutils/unixccompiler.py
@@ -215,7 +215,8 @@
         return "-L" + dir
 
     def _is_gcc(self, compiler_name):
-        return "gcc" in compiler_name or "g++" in compiler_name
+        # clang uses same syntax for rpath as gcc
+        return any(name in compiler_name for name in ("gcc", "g++", "clang"))
 
     def runtime_library_dir_option(self, dir):
         # XXX Hackish, at the very least.  See Python bug #445902:
diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py
index 4b002ec..2ce5c5b 100644
--- a/Lib/distutils/util.py
+++ b/Lib/distutils/util.py
@@ -9,6 +9,7 @@
 import importlib.util
 import string
 import sys
+import distutils
 from distutils.errors import DistutilsPlatformError
 from distutils.dep_util import newer
 from distutils.spawn import spawn
@@ -419,8 +420,10 @@
              direct=1)
 """ % (optimize, force, prefix, base_dir, verbose))
 
+        msg = distutils._DEPRECATION_MESSAGE
         cmd = [sys.executable]
         cmd.extend(subprocess._optim_args_from_interpreter_flags())
+        cmd.append(f'-Wignore:{msg}:DeprecationWarning')
         cmd.append(script_name)
         spawn(cmd, dry_run=dry_run)
         execute(os.remove, (script_name,), "removing %s" % script_name,
diff --git a/Lib/doctest.py b/Lib/doctest.py
index baa503c..b27cbdf 100644
--- a/Lib/doctest.py
+++ b/Lib/doctest.py
@@ -102,7 +102,7 @@
 import sys
 import traceback
 import unittest
-from io import StringIO
+from io import StringIO, IncrementalNewlineDecoder
 from collections import namedtuple
 
 TestResults = namedtuple('TestResults', 'failed attempted')
@@ -212,23 +212,24 @@
         raise TypeError("Expected a module, string, or None")
 
 def _newline_convert(data):
-    # We have two cases to cover and we need to make sure we do
-    # them in the right order
-    for newline in ('\r\n', '\r'):
-        data = data.replace(newline, '\n')
-    return data
+    # The IO module provides a handy decoder for universal newline conversion
+    return IncrementalNewlineDecoder(None, True).decode(data, True)
 
 def _load_testfile(filename, package, module_relative, encoding):
     if module_relative:
         package = _normalize_module(package, 3)
         filename = _module_relative_path(package, filename)
-        if getattr(package, '__loader__', None) is not None:
-            if hasattr(package.__loader__, 'get_data'):
-                file_contents = package.__loader__.get_data(filename)
-                file_contents = file_contents.decode(encoding)
-                # get_data() opens files as 'rb', so one must do the equivalent
-                # conversion as universal newlines would do.
-                return _newline_convert(file_contents), filename
+        if (loader := getattr(package, '__loader__', None)) is None:
+            try:
+                loader = package.__spec__.loader
+            except AttributeError:
+                pass
+        if hasattr(loader, 'get_data'):
+            file_contents = loader.get_data(filename)
+            file_contents = file_contents.decode(encoding)
+            # get_data() opens files as 'rb', so one must do the equivalent
+            # conversion as universal newlines would do.
+            return _newline_convert(file_contents), filename
     with open(filename, encoding=encoding) as f:
         return f.read(), filename
 
@@ -972,6 +973,17 @@
         else:
             raise ValueError("object must be a class or function")
 
+    def _is_routine(self, obj):
+        """
+        Safely unwrap objects and determine if they are functions.
+        """
+        maybe_routine = obj
+        try:
+            maybe_routine = inspect.unwrap(maybe_routine)
+        except ValueError:
+            pass
+        return inspect.isroutine(maybe_routine)
+
     def _find(self, tests, obj, name, module, source_lines, globs, seen):
         """
         Find tests for the given object and any contained objects, and
@@ -994,9 +1006,9 @@
         if inspect.ismodule(obj) and self._recurse:
             for valname, val in obj.__dict__.items():
                 valname = '%s.%s' % (name, valname)
+
                 # Recurse to functions & classes.
-                if ((inspect.isroutine(inspect.unwrap(val))
-                     or inspect.isclass(val)) and
+                if ((self._is_routine(val) or inspect.isclass(val)) and
                     self._from_module(module, val)):
                     self._find(tests, val, valname, module, source_lines,
                                globs, seen)
@@ -1022,10 +1034,8 @@
         if inspect.isclass(obj) and self._recurse:
             for valname, val in obj.__dict__.items():
                 # Special handling for staticmethod/classmethod.
-                if isinstance(val, staticmethod):
-                    val = getattr(obj, valname)
-                if isinstance(val, classmethod):
-                    val = getattr(obj, valname).__func__
+                if isinstance(val, (staticmethod, classmethod)):
+                    val = val.__func__
 
                 # Recurse to methods, properties, and nested classes.
                 if ((inspect.isroutine(val) or inspect.isclass(val) or
diff --git a/Lib/email/_parseaddr.py b/Lib/email/_parseaddr.py
index 41ff6f8..ba5ad5a 100644
--- a/Lib/email/_parseaddr.py
+++ b/Lib/email/_parseaddr.py
@@ -65,8 +65,10 @@
 
     """
     if not data:
-        return
+        return None
     data = data.split()
+    if not data:  # This happens for whitespace-only input.
+        return None
     # The FWS after the comma after the day-of-week is optional, so search and
     # adjust for this.
     if data[0].endswith(',') or data[0].lower() in _daynames:
@@ -126,6 +128,8 @@
             tss = 0
         elif len(tm) == 3:
             [thh, tmm, tss] = tm
+        else:
+            return None
     else:
         return None
     try:
diff --git a/Lib/email/base64mime.py b/Lib/email/base64mime.py
index 17f0818..a7cc373 100644
--- a/Lib/email/base64mime.py
+++ b/Lib/email/base64mime.py
@@ -84,7 +84,7 @@
     in an email.
     """
     if not s:
-        return s
+        return ""
 
     encvec = []
     max_unencoded = maxlinelen * 3 // 4
diff --git a/Lib/email/contentmanager.py b/Lib/email/contentmanager.py
index b91fb0e..fcf278d 100644
--- a/Lib/email/contentmanager.py
+++ b/Lib/email/contentmanager.py
@@ -144,7 +144,7 @@
     linesep = policy.linesep.encode('ascii')
     def embedded_body(lines): return linesep.join(lines) + linesep
     def normal_body(lines): return b'\n'.join(lines) + b'\n'
-    if cte==None:
+    if cte is None:
         # Use heuristics to decide on the "best" encoding.
         if max((len(x) for x in lines), default=0) <= policy.max_line_length:
             try:
@@ -238,9 +238,7 @@
         data = binascii.b2a_qp(data, istext=False, header=False, quotetabs=True)
         data = data.decode('ascii')
     elif cte == '7bit':
-        # Make sure it really is only ASCII.  The early warning here seems
-        # worth the overhead...if you care write your own content manager :).
-        data.encode('ascii')
+        data = data.decode('ascii')
     elif cte in ('8bit', 'binary'):
         data = data.decode('ascii', 'surrogateescape')
     msg.set_payload(data)
diff --git a/Lib/email/errors.py b/Lib/email/errors.py
index d28a680..3ad0056 100644
--- a/Lib/email/errors.py
+++ b/Lib/email/errors.py
@@ -108,3 +108,6 @@
     """local_part contains non-ASCII characters"""
     # This defect only occurs during unicode parsing, not when
     # parsing messages decoded from binary.
+
+class InvalidDateDefect(HeaderDefect):
+    """Header has unparsable or invalid date"""
diff --git a/Lib/email/headerregistry.py b/Lib/email/headerregistry.py
index 5d84fc0..b590d69 100644
--- a/Lib/email/headerregistry.py
+++ b/Lib/email/headerregistry.py
@@ -2,10 +2,6 @@
 
 This module provides an implementation of the HeaderRegistry API.
 The implementation is designed to flexibly follow RFC5322 rules.
-
-Eventually HeaderRegistry will be a public API, but it isn't yet,
-and will probably change some before that happens.
-
 """
 from types import MappingProxyType
 
@@ -302,7 +298,14 @@
             kwds['parse_tree'] = parser.TokenList()
             return
         if isinstance(value, str):
-            value = utils.parsedate_to_datetime(value)
+            kwds['decoded'] = value
+            try:
+                value = utils.parsedate_to_datetime(value)
+            except ValueError:
+                kwds['defects'].append(errors.InvalidDateDefect('Invalid date value or format'))
+                kwds['datetime'] = None
+                kwds['parse_tree'] = parser.TokenList()
+                return
         kwds['datetime'] = value
         kwds['decoded'] = utils.format_datetime(kwds['datetime'])
         kwds['parse_tree'] = cls.value_parser(kwds['decoded'])
diff --git a/Lib/email/message.py b/Lib/email/message.py
index 3701b30..6752ce0 100644
--- a/Lib/email/message.py
+++ b/Lib/email/message.py
@@ -948,7 +948,7 @@
         if policy is None:
             from email.policy import default
             policy = default
-        Message.__init__(self, policy)
+        super().__init__(policy)
 
 
     def as_string(self, unixfrom=False, maxheaderlen=None, policy=None):
@@ -965,7 +965,7 @@
         policy = self.policy if policy is None else policy
         if maxheaderlen is None:
             maxheaderlen = policy.max_line_length
-        return super().as_string(maxheaderlen=maxheaderlen, policy=policy)
+        return super().as_string(unixfrom, maxheaderlen, policy)
 
     def __str__(self):
         return self.as_string(policy=self.policy.clone(utf8=True))
@@ -982,7 +982,7 @@
             if subtype in preferencelist:
                 yield (preferencelist.index(subtype), part)
             return
-        if maintype != 'multipart':
+        if maintype != 'multipart' or not self.is_multipart():
             return
         if subtype != 'related':
             for subpart in part.iter_parts():
@@ -1087,7 +1087,7 @@
 
         Return an empty iterator for a non-multipart.
         """
-        if self.get_content_maintype() == 'multipart':
+        if self.is_multipart():
             yield from self.get_payload()
 
     def get_content(self, *args, content_manager=None, **kw):
diff --git a/Lib/email/utils.py b/Lib/email/utils.py
index 1a7719d..cfdfeb3 100644
--- a/Lib/email/utils.py
+++ b/Lib/email/utils.py
@@ -109,7 +109,7 @@
 
 def getaddresses(fieldvalues):
     """Return a list of (REALNAME, EMAIL) for each fieldvalue."""
-    all = COMMASPACE.join(fieldvalues)
+    all = COMMASPACE.join(str(v) for v in fieldvalues)
     a = _AddressList(all)
     return a.addresslist
 
@@ -195,7 +195,10 @@
 
 
 def parsedate_to_datetime(data):
-    *dtuple, tz = _parsedate_tz(data)
+    parsed_date_tz = _parsedate_tz(data)
+    if parsed_date_tz is None:
+        raise ValueError('Invalid date value or format "%s"' % str(data))
+    *dtuple, tz = parsed_date_tz
     if tz is None:
         return datetime.datetime(*dtuple[:6])
     return datetime.datetime(*dtuple[:6],
diff --git a/Lib/encodings/__init__.py b/Lib/encodings/__init__.py
index ddd5afd..4b37d33 100644
--- a/Lib/encodings/__init__.py
+++ b/Lib/encodings/__init__.py
@@ -61,7 +61,8 @@
         if c.isalnum() or c == '.':
             if punct and chars:
                 chars.append('_')
-            chars.append(c)
+            if c.isascii():
+                chars.append(c)
             punct = False
         else:
             punct = True
diff --git a/Lib/encodings/raw_unicode_escape.py b/Lib/encodings/raw_unicode_escape.py
index 2b919b4..46c8e07 100644
--- a/Lib/encodings/raw_unicode_escape.py
+++ b/Lib/encodings/raw_unicode_escape.py
@@ -21,15 +21,16 @@
     def encode(self, input, final=False):
         return codecs.raw_unicode_escape_encode(input, self.errors)[0]
 
-class IncrementalDecoder(codecs.IncrementalDecoder):
-    def decode(self, input, final=False):
-        return codecs.raw_unicode_escape_decode(input, self.errors)[0]
+class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
+    def _buffer_decode(self, input, errors, final):
+        return codecs.raw_unicode_escape_decode(input, errors, final)
 
 class StreamWriter(Codec,codecs.StreamWriter):
     pass
 
 class StreamReader(Codec,codecs.StreamReader):
-    pass
+    def decode(self, input, errors='strict'):
+        return codecs.raw_unicode_escape_decode(input, errors, False)
 
 ### encodings module API
 
diff --git a/Lib/encodings/unicode_escape.py b/Lib/encodings/unicode_escape.py
index 817f932..9b1ce99 100644
--- a/Lib/encodings/unicode_escape.py
+++ b/Lib/encodings/unicode_escape.py
@@ -21,15 +21,16 @@
     def encode(self, input, final=False):
         return codecs.unicode_escape_encode(input, self.errors)[0]
 
-class IncrementalDecoder(codecs.IncrementalDecoder):
-    def decode(self, input, final=False):
-        return codecs.unicode_escape_decode(input, self.errors)[0]
+class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
+    def _buffer_decode(self, input, errors, final):
+        return codecs.unicode_escape_decode(input, errors, final)
 
 class StreamWriter(Codec,codecs.StreamWriter):
     pass
 
 class StreamReader(Codec,codecs.StreamReader):
-    pass
+    def decode(self, input, errors='strict'):
+        return codecs.unicode_escape_decode(input, errors, False)
 
 ### encodings module API
 
diff --git a/Lib/ensurepip/__init__.py b/Lib/ensurepip/__init__.py
index 97dfa7e..3fbe8b2 100644
--- a/Lib/ensurepip/__init__.py
+++ b/Lib/ensurepip/__init__.py
@@ -1,27 +1,82 @@
+import collections
 import os
 import os.path
-import sys
-import runpy
-import tempfile
 import subprocess
+import sys
+import sysconfig
+import tempfile
 from importlib import resources
 
-from . import _bundled
-
 
 
 __all__ = ["version", "bootstrap"]
-
-
-_SETUPTOOLS_VERSION = "49.2.1"
-
-_PIP_VERSION = "20.2.3"
-
+_PACKAGE_NAMES = ('setuptools', 'pip')
+_SETUPTOOLS_VERSION = "58.1.0"
+_PIP_VERSION = "22.0.4"
 _PROJECTS = [
     ("setuptools", _SETUPTOOLS_VERSION, "py3"),
-    ("pip", _PIP_VERSION, "py2.py3"),
+    ("pip", _PIP_VERSION, "py3"),
 ]
 
+# Packages bundled in ensurepip._bundled have wheel_name set.
+# Packages from WHEEL_PKG_DIR have wheel_path set.
+_Package = collections.namedtuple('Package',
+                                  ('version', 'wheel_name', 'wheel_path'))
+
+# Directory of system wheel packages. Some Linux distribution packaging
+# policies recommend against bundling dependencies. For example, Fedora
+# installs wheel packages in the /usr/share/python-wheels/ directory and don't
+# install the ensurepip._bundled package.
+_WHEEL_PKG_DIR = sysconfig.get_config_var('WHEEL_PKG_DIR')
+
+
+def _find_packages(path):
+    packages = {}
+    try:
+        filenames = os.listdir(path)
+    except OSError:
+        # Ignore: path doesn't exist or permission error
+        filenames = ()
+    # Make the code deterministic if a directory contains multiple wheel files
+    # of the same package, but don't attempt to implement correct version
+    # comparison since this case should not happen.
+    filenames = sorted(filenames)
+    for filename in filenames:
+        # filename is like 'pip-21.2.4-py3-none-any.whl'
+        if not filename.endswith(".whl"):
+            continue
+        for name in _PACKAGE_NAMES:
+            prefix = name + '-'
+            if filename.startswith(prefix):
+                break
+        else:
+            continue
+
+        # Extract '21.2.4' from 'pip-21.2.4-py3-none-any.whl'
+        version = filename.removeprefix(prefix).partition('-')[0]
+        wheel_path = os.path.join(path, filename)
+        packages[name] = _Package(version, None, wheel_path)
+    return packages
+
+
+def _get_packages():
+    global _PACKAGES, _WHEEL_PKG_DIR
+    if _PACKAGES is not None:
+        return _PACKAGES
+
+    packages = {}
+    for name, version, py_tag in _PROJECTS:
+        wheel_name = f"{name}-{version}-{py_tag}-none-any.whl"
+        packages[name] = _Package(version, wheel_name, None)
+    if _WHEEL_PKG_DIR:
+        dir_packages = _find_packages(_WHEEL_PKG_DIR)
+        # only used the wheel package directory if all packages are found there
+        if all(name in dir_packages for name in _PACKAGE_NAMES):
+            packages = dir_packages
+    _PACKAGES = packages
+    return packages
+_PACKAGES = None
+
 
 def _run_pip(args, additional_paths=None):
     # Run the bootstraping in a subprocess to avoid leaking any state that happens
@@ -35,14 +90,16 @@
 sys.argv[1:] = {args}
 runpy.run_module("pip", run_name="__main__", alter_sys=True)
 """
-    return subprocess.run([sys.executable, "-c", code], check=True).returncode
+    return subprocess.run([sys.executable, '-W', 'ignore::DeprecationWarning',
+                           "-c", code], check=True).returncode
 
 
 def version():
     """
     Returns a string specifying the bundled version of pip.
     """
-    return _PIP_VERSION
+    return _get_packages()['pip'].version
+
 
 def _disable_pip_configuration_settings():
     # We deliberately ignore all pip environment variables
@@ -104,16 +161,23 @@
         # Put our bundled wheels into a temporary directory and construct the
         # additional paths that need added to sys.path
         additional_paths = []
-        for project, version, py_tag in _PROJECTS:
-            wheel_name = "{}-{}-{}-none-any.whl".format(project, version, py_tag)
-            whl = resources.read_binary(
-                _bundled,
-                wheel_name,
-            )
-            with open(os.path.join(tmpdir, wheel_name), "wb") as fp:
+        for name, package in _get_packages().items():
+            if package.wheel_name:
+                # Use bundled wheel package
+                from ensurepip import _bundled
+                wheel_name = package.wheel_name
+                whl = resources.read_binary(_bundled, wheel_name)
+            else:
+                # Use the wheel package directory
+                with open(package.wheel_path, "rb") as fp:
+                    whl = fp.read()
+                wheel_name = os.path.basename(package.wheel_path)
+
+            filename = os.path.join(tmpdir, wheel_name)
+            with open(filename, "wb") as fp:
                 fp.write(whl)
 
-            additional_paths.append(os.path.join(tmpdir, wheel_name))
+            additional_paths.append(filename)
 
         # Construct the arguments to be passed to the pip command
         args = ["install", "--no-cache-dir", "--no-index", "--find-links", tmpdir]
@@ -126,7 +190,7 @@
         if verbosity:
             args += ["-" + "v" * verbosity]
 
-        return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
+        return _run_pip([*args, *_PACKAGE_NAMES], additional_paths)
 
 def _uninstall_helper(*, verbosity=0):
     """Helper to support a clean default uninstall process on Windows
@@ -139,11 +203,14 @@
     except ImportError:
         return
 
-    # If the pip version doesn't match the bundled one, leave it alone
-    if pip.__version__ != _PIP_VERSION:
-        msg = ("ensurepip will only uninstall a matching version "
-               "({!r} installed, {!r} bundled)")
-        print(msg.format(pip.__version__, _PIP_VERSION), file=sys.stderr)
+    # If the installed pip version doesn't match the available one,
+    # leave it alone
+    available_version = version()
+    if pip.__version__ != available_version:
+        print(f"ensurepip will only uninstall a matching version "
+              f"({pip.__version__!r} installed, "
+              f"{available_version!r} available)",
+              file=sys.stderr)
         return
 
     _disable_pip_configuration_settings()
@@ -153,7 +220,7 @@
     if verbosity:
         args += ["-" + "v" * verbosity]
 
-    return _run_pip(args + [p[0] for p in reversed(_PROJECTS)])
+    return _run_pip([*args, *reversed(_PACKAGE_NAMES)])
 
 
 def _main(argv=None):
diff --git a/Lib/ensurepip/_bundled/pip-20.2.3-py2.py3-none-any.whl b/Lib/ensurepip/_bundled/pip-20.2.3-py2.py3-none-any.whl
deleted file mode 100644
index 7ebdc0f..0000000
--- a/Lib/ensurepip/_bundled/pip-20.2.3-py2.py3-none-any.whl
+++ /dev/null
Binary files differ
diff --git a/Lib/ensurepip/_bundled/pip-22.0.4-py3-none-any.whl b/Lib/ensurepip/_bundled/pip-22.0.4-py3-none-any.whl
new file mode 100644
index 0000000..7ba048e
--- /dev/null
+++ b/Lib/ensurepip/_bundled/pip-22.0.4-py3-none-any.whl
Binary files differ
diff --git a/Lib/ensurepip/_bundled/setuptools-49.2.1-py3-none-any.whl b/Lib/ensurepip/_bundled/setuptools-49.2.1-py3-none-any.whl
deleted file mode 100644
index 308e2f2..0000000
--- a/Lib/ensurepip/_bundled/setuptools-49.2.1-py3-none-any.whl
+++ /dev/null
Binary files differ
diff --git a/Lib/ensurepip/_bundled/setuptools-58.1.0-py3-none-any.whl b/Lib/ensurepip/_bundled/setuptools-58.1.0-py3-none-any.whl
new file mode 100644
index 0000000..18c8c22
--- /dev/null
+++ b/Lib/ensurepip/_bundled/setuptools-58.1.0-py3-none-any.whl
Binary files differ
diff --git a/Lib/enum.py b/Lib/enum.py
index ebadd9f..f5657a6 100644
--- a/Lib/enum.py
+++ b/Lib/enum.py
@@ -10,31 +10,55 @@
 
 
 def _is_descriptor(obj):
-    """Returns True if obj is a descriptor, False otherwise."""
+    """
+    Returns True if obj is a descriptor, False otherwise.
+    """
     return (
             hasattr(obj, '__get__') or
             hasattr(obj, '__set__') or
-            hasattr(obj, '__delete__'))
-
+            hasattr(obj, '__delete__')
+            )
 
 def _is_dunder(name):
-    """Returns True if a __dunder__ name, False otherwise."""
-    return (len(name) > 4 and
+    """
+    Returns True if a __dunder__ name, False otherwise.
+    """
+    return (
+            len(name) > 4 and
             name[:2] == name[-2:] == '__' and
             name[2] != '_' and
-            name[-3] != '_')
-
+            name[-3] != '_'
+            )
 
 def _is_sunder(name):
-    """Returns True if a _sunder_ name, False otherwise."""
-    return (len(name) > 2 and
+    """
+    Returns True if a _sunder_ name, False otherwise.
+    """
+    return (
+            len(name) > 2 and
             name[0] == name[-1] == '_' and
             name[1:2] != '_' and
-            name[-2:-1] != '_')
+            name[-2:-1] != '_'
+            )
 
+def _is_private(cls_name, name):
+    # do not use `re` as `re` imports `enum`
+    pattern = '_%s__' % (cls_name, )
+    pat_len = len(pattern)
+    if (
+            len(name) > pat_len
+            and name.startswith(pattern)
+            and name[pat_len:pat_len+1] != ['_']
+            and (name[-1] != '_' or name[-2] != '_')
+        ):
+        return True
+    else:
+        return False
 
 def _make_class_unpicklable(cls):
-    """Make the given class un-picklable."""
+    """
+    Make the given class un-picklable.
+    """
     def _break_on_call_reduce(self, proto):
         raise TypeError('%r cannot be pickled' % self)
     cls.__reduce_ex__ = _break_on_call_reduce
@@ -49,11 +73,11 @@
 
 
 class _EnumDict(dict):
-    """Track enum member order and ensure member names are not reused.
+    """
+    Track enum member order and ensure member names are not reused.
 
     EnumMeta will use the names found in self._member_names as the
     enumeration member names.
-
     """
     def __init__(self):
         super().__init__()
@@ -63,14 +87,22 @@
         self._auto_called = False
 
     def __setitem__(self, key, value):
-        """Changes anything not dundered or not a descriptor.
+        """
+        Changes anything not dundered or not a descriptor.
 
         If an enum member name is used twice, an error is raised; duplicate
         values are not checked for.
 
         Single underscore (sunder) names are reserved.
-
         """
+        if _is_private(self._cls_name, key):
+            import warnings
+            warnings.warn(
+                    "private variables, such as %r, will be normal attributes in 3.11"
+                        % (key, ),
+                    DeprecationWarning,
+                    stacklevel=2,
+                    )
         if _is_sunder(key):
             if key not in (
                     '_order_', '_create_pseudo_member_',
@@ -90,7 +122,10 @@
                 self._ignore = value
                 already = set(value) & set(self._member_names)
                 if already:
-                    raise ValueError('_ignore_ cannot specify already set names: %r' % (already, ))
+                    raise ValueError(
+                            '_ignore_ cannot specify already set names: %r'
+                            % (already, )
+                            )
         elif _is_dunder(key):
             if key == '__order__':
                 key = '_order_'
@@ -105,7 +140,12 @@
                 raise TypeError('%r already defined as: %r' % (key, self[key]))
             if isinstance(value, auto):
                 if value.value == _auto_null:
-                    value.value = self._generate_next_value(key, 1, len(self._member_names), self._last_values[:])
+                    value.value = self._generate_next_value(
+                            key,
+                            1,
+                            len(self._member_names),
+                            self._last_values[:],
+                            )
                     self._auto_called = True
                 value = value.value
             self._member_names.append(key)
@@ -118,22 +158,26 @@
 # This is also why there are checks in EnumMeta like `if Enum is not None`
 Enum = None
 
-
 class EnumMeta(type):
-    """Metaclass for Enum"""
+    """
+    Metaclass for Enum
+    """
     @classmethod
-    def __prepare__(metacls, cls, bases):
+    def __prepare__(metacls, cls, bases, **kwds):
         # check that previous enum members do not exist
         metacls._check_for_existing_members(cls, bases)
         # create the namespace dict
         enum_dict = _EnumDict()
+        enum_dict._cls_name = cls
         # inherit previous flags and _generate_next_value_ function
         member_type, first_enum = metacls._get_mixins_(cls, bases)
         if first_enum is not None:
-            enum_dict['_generate_next_value_'] = getattr(first_enum, '_generate_next_value_', None)
+            enum_dict['_generate_next_value_'] = getattr(
+                    first_enum, '_generate_next_value_', None,
+                    )
         return enum_dict
 
-    def __new__(metacls, cls, bases, classdict):
+    def __new__(metacls, cls, bases, classdict, **kwds):
         # an Enum class is final once enumeration items have been defined; it
         # cannot be mixed with other types (int, float, etc.) if it has an
         # inherited __new__ unless a new __new__ is defined (or the resulting
@@ -145,8 +189,9 @@
         for key in ignore:
             classdict.pop(key, None)
         member_type, first_enum = metacls._get_mixins_(cls, bases)
-        __new__, save_new, use_args = metacls._find_new_(classdict, member_type,
-                                                        first_enum)
+        __new__, save_new, use_args = metacls._find_new_(
+                classdict, member_type, first_enum,
+                )
 
         # save enum items into separate mapping so they don't get baked into
         # the new class
@@ -167,17 +212,18 @@
         if '__doc__' not in classdict:
             classdict['__doc__'] = 'An enumeration.'
 
-        # create our new Enum type
-        enum_class = super().__new__(metacls, cls, bases, classdict)
+        enum_class = super().__new__(metacls, cls, bases, classdict, **kwds)
         enum_class._member_names_ = []               # names in definition order
         enum_class._member_map_ = {}                 # name->value map
         enum_class._member_type_ = member_type
 
         # save DynamicClassAttribute attributes from super classes so we know
         # if we can take the shortcut of storing members in the class dict
-        dynamic_attributes = {k for c in enum_class.mro()
-                              for k, v in c.__dict__.items()
-                              if isinstance(v, DynamicClassAttribute)}
+        dynamic_attributes = {
+                k for c in enum_class.mro()
+                for k, v in c.__dict__.items()
+                if isinstance(v, DynamicClassAttribute)
+                }
 
         # Reverse value->name map for hashable values.
         enum_class._value2member_map_ = {}
@@ -197,8 +243,32 @@
                 methods = ('__getnewargs_ex__', '__getnewargs__',
                         '__reduce_ex__', '__reduce__')
                 if not any(m in member_type.__dict__ for m in methods):
-                    _make_class_unpicklable(enum_class)
-
+                    if '__new__' in classdict:
+                        # too late, sabotage
+                        _make_class_unpicklable(enum_class)
+                    else:
+                        # final attempt to verify that pickling would work:
+                        # travel mro until __new__ is found, checking for
+                        # __reduce__ and friends along the way -- if any of them
+                        # are found before/when __new__ is found, pickling should
+                        # work
+                        sabotage = None
+                        for chain in bases:
+                            for base in chain.__mro__:
+                                if base is object:
+                                    continue
+                                elif any(m in base.__dict__ for m in methods):
+                                    # found one, we're good
+                                    sabotage = False
+                                    break
+                                elif '__new__' in base.__dict__:
+                                    # not good
+                                    sabotage = True
+                                    break
+                            if sabotage is not None:
+                                break
+                        if sabotage:
+                            _make_class_unpicklable(enum_class)
         # instantiate them, checking for duplicates as we go
         # we instantiate first instead of checking for duplicates first in case
         # a custom __new__ is doing something funky with the values -- such as
@@ -287,7 +357,8 @@
         return True
 
     def __call__(cls, value, names=None, *, module=None, qualname=None, type=None, start=1):
-        """Either returns an existing member, or creates a new enum class.
+        """
+        Either returns an existing member, or creates a new enum class.
 
         This method is used both when an enum class is given a value to match
         to an enumeration member (i.e. Color(3)) and for the functional API
@@ -309,40 +380,54 @@
         not correct, unpickling will fail in some circumstances.
 
         `type`, if set, will be mixed in as the first base class.
-
         """
         if names is None:  # simple value lookup
             return cls.__new__(cls, value)
         # otherwise, functional API: we're creating a new Enum type
-        return cls._create_(value, names, module=module, qualname=qualname, type=type, start=start)
+        return cls._create_(
+                value,
+                names,
+                module=module,
+                qualname=qualname,
+                type=type,
+                start=start,
+                )
 
-    def __contains__(cls, member):
-        if not isinstance(member, Enum):
+    def __contains__(cls, obj):
+        if not isinstance(obj, Enum):
+            import warnings
+            warnings.warn(
+                    "in 3.12 __contains__ will no longer raise TypeError, but will return True if\n"
+                    "obj is a member or a member's value",
+                    DeprecationWarning,
+                    stacklevel=2,
+                    )
             raise TypeError(
                 "unsupported operand type(s) for 'in': '%s' and '%s'" % (
-                    type(member).__qualname__, cls.__class__.__qualname__))
-        return isinstance(member, cls) and member._name_ in cls._member_map_
+                    type(obj).__qualname__, cls.__class__.__qualname__))
+        return isinstance(obj, cls) and obj._name_ in cls._member_map_
 
     def __delattr__(cls, attr):
         # nicer error message when someone tries to delete an attribute
         # (see issue19025).
         if attr in cls._member_map_:
-            raise AttributeError(
-                    "%s: cannot delete Enum member." % cls.__name__)
+            raise AttributeError("%s: cannot delete Enum member." % cls.__name__)
         super().__delattr__(attr)
 
     def __dir__(self):
-        return (['__class__', '__doc__', '__members__', '__module__'] +
-                self._member_names_)
+        return (
+                ['__class__', '__doc__', '__members__', '__module__']
+                + self._member_names_
+                )
 
     def __getattr__(cls, name):
-        """Return the enum member matching `name`
+        """
+        Return the enum member matching `name`
 
         We use __getattr__ instead of descriptors or inserting into the enum
         class' __dict__ in order to support `name` and `value` being both
         properties for enum members (which live in the class' __dict__) and
         enum members themselves.
-
         """
         if _is_dunder(name):
             raise AttributeError(name)
@@ -355,6 +440,9 @@
         return cls._member_map_[name]
 
     def __iter__(cls):
+        """
+        Returns members in definition order.
+        """
         return (cls._member_map_[name] for name in cls._member_names_)
 
     def __len__(cls):
@@ -362,11 +450,11 @@
 
     @property
     def __members__(cls):
-        """Returns a mapping of member name->value.
+        """
+        Returns a mapping of member name->value.
 
         This mapping lists all enum members, including aliases. Note that this
         is a read-only view of the internal mapping.
-
         """
         return MappingProxyType(cls._member_map_)
 
@@ -374,15 +462,18 @@
         return "<enum %r>" % cls.__name__
 
     def __reversed__(cls):
+        """
+        Returns members in reverse definition order.
+        """
         return (cls._member_map_[name] for name in reversed(cls._member_names_))
 
     def __setattr__(cls, name, value):
-        """Block attempts to reassign Enum members.
+        """
+        Block attempts to reassign Enum members.
 
         A simple assignment to the class namespace only changes one of the
         several possible ways to get an Enum member from the Enum class,
         resulting in an inconsistent Enumeration.
-
         """
         member_map = cls.__dict__.get('_member_map_', {})
         if name in member_map:
@@ -390,7 +481,8 @@
         super().__setattr__(name, value)
 
     def _create_(cls, class_name, names, *, module=None, qualname=None, type=None, start=1):
-        """Convenience method to create a new Enum class.
+        """
+        Convenience method to create a new Enum class.
 
         `names` can be:
 
@@ -399,7 +491,6 @@
         * An iterable of member names.  Values are incremented by 1 from `start`.
         * An iterable of (member name, value) pairs.
         * A mapping of member name -> value pairs.
-
         """
         metacls = cls.__class__
         bases = (cls, ) if type is None else (type, cls)
@@ -480,37 +571,44 @@
         for chain in bases:
             for base in chain.__mro__:
                 if issubclass(base, Enum) and base._member_names_:
-                    raise TypeError("%s: cannot extend enumeration %r" % (class_name, base.__name__))
+                    raise TypeError(
+                            "%s: cannot extend enumeration %r"
+                            % (class_name, base.__name__)
+                            )
 
     @staticmethod
     def _get_mixins_(class_name, bases):
-        """Returns the type for creating enum members, and the first inherited
+        """
+        Returns the type for creating enum members, and the first inherited
         enum class.
 
         bases: the tuple of bases that was given to __new__
-
         """
         if not bases:
             return object, Enum
 
         def _find_data_type(bases):
-            data_types = []
+            data_types = set()
             for chain in bases:
                 candidate = None
                 for base in chain.__mro__:
                     if base is object:
                         continue
+                    elif issubclass(base, Enum):
+                        if base._member_type_ is not object:
+                            data_types.add(base._member_type_)
+                            break
                     elif '__new__' in base.__dict__:
                         if issubclass(base, Enum):
                             continue
-                        data_types.append(candidate or base)
+                        data_types.add(candidate or base)
                         break
-                    elif not issubclass(base, Enum):
-                        candidate = base
+                    else:
+                        candidate = candidate or base
             if len(data_types) > 1:
                 raise TypeError('%r: too many data types: %r' % (class_name, data_types))
             elif data_types:
-                return data_types[0]
+                return data_types.pop()
             else:
                 return None
 
@@ -527,12 +625,12 @@
 
     @staticmethod
     def _find_new_(classdict, member_type, first_enum):
-        """Returns the __new__ to be used for creating the enum members.
+        """
+        Returns the __new__ to be used for creating the enum members.
 
         classdict: the class dictionary given to __new__
         member_type: the data type whose __new__ will be used by default
         first_enum: enumeration to check for an overriding __new__
-
         """
         # now find the correct __new__, checking to see of one was defined
         # by the user; also check earlier enum classes in case a __new__ was
@@ -572,10 +670,10 @@
 
 
 class Enum(metaclass=EnumMeta):
-    """Generic enumeration.
+    """
+    Generic enumeration.
 
     Derive from this class to define new enumerations.
-
     """
     def __new__(cls, value):
         # all enum instances are actually created during class construction
@@ -603,21 +701,35 @@
         except Exception as e:
             exc = e
             result = None
-        if isinstance(result, cls):
-            return result
-        else:
-            ve_exc = ValueError("%r is not a valid %s" % (value, cls.__qualname__))
-            if result is None and exc is None:
-                raise ve_exc
-            elif exc is None:
-                exc = TypeError(
-                        'error in %s._missing_: returned %r instead of None or a valid member'
-                        % (cls.__name__, result)
-                        )
-            exc.__context__ = ve_exc
-            raise exc
+        try:
+            if isinstance(result, cls):
+                return result
+            else:
+                ve_exc = ValueError("%r is not a valid %s" % (value, cls.__qualname__))
+                if result is None and exc is None:
+                    raise ve_exc
+                elif exc is None:
+                    exc = TypeError(
+                            'error in %s._missing_: returned %r instead of None or a valid member'
+                            % (cls.__name__, result)
+                            )
+                if not isinstance(exc, ValueError):
+                    exc.__context__ = ve_exc
+                raise exc
+        finally:
+            # ensure all variables that could hold an exception are destroyed
+            exc = None
+            ve_exc = None
 
     def _generate_next_value_(name, start, count, last_values):
+        """
+        Generate the next value when not given.
+
+        name: the name of the member
+        start: the initial start value or None
+        count: the number of existing members
+        last_value: the last value assigned or None
+        """
         for last_value in reversed(last_values):
             try:
                 return last_value + 1
@@ -638,21 +750,27 @@
         return "%s.%s" % (self.__class__.__name__, self._name_)
 
     def __dir__(self):
+        """
+        Returns all members and all public methods
+        """
         added_behavior = [
                 m
                 for cls in self.__class__.mro()
                 for m in cls.__dict__
                 if m[0] != '_' and m not in self._member_map_
-                ]
+                ] + [m for m in self.__dict__ if m[0] != '_']
         return (['__class__', '__doc__', '__module__'] + added_behavior)
 
     def __format__(self, format_spec):
+        """
+        Returns format using actual value type unless __str__ has been overridden.
+        """
         # mixed-in Enums should use the mixed-in type's __format__, otherwise
         # we can get strange results with the Enum name showing up instead of
         # the value
 
         # pure Enum branch, or branch with __str__ explicitly overridden
-        str_overridden = type(self).__str__ != Enum.__str__
+        str_overridden = type(self).__str__ not in (Enum.__str__, Flag.__str__)
         if self._member_type_ is object or str_overridden:
             cls = str
             val = str(self)
@@ -694,7 +812,9 @@
     return self.name
 
 class Flag(Enum):
-    """Support for flags"""
+    """
+    Support for flags
+    """
 
     def _generate_next_value_(name, start, count, last_values):
         """
@@ -717,6 +837,9 @@
 
     @classmethod
     def _missing_(cls, value):
+        """
+        Returns member (possibly creating it) if one can be found for value.
+        """
         original_value = value
         if value < 0:
             value = ~value
@@ -746,6 +869,9 @@
         return pseudo_member
 
     def __contains__(self, other):
+        """
+        Returns True if self has at least the same flags set as other.
+        """
         if not isinstance(other, self.__class__):
             raise TypeError(
                 "unsupported operand type(s) for 'in': '%s' and '%s'" % (
@@ -804,10 +930,15 @@
 
 
 class IntFlag(int, Flag):
-    """Support for integer-based Flags"""
+    """
+    Support for integer-based Flags
+    """
 
     @classmethod
     def _missing_(cls, value):
+        """
+        Returns member (possibly creating it) if one can be found for value.
+        """
         if not isinstance(value, int):
             raise ValueError("%r is not a valid %s" % (value, cls.__qualname__))
         new_member = cls._create_pseudo_member_(value)
@@ -815,6 +946,9 @@
 
     @classmethod
     def _create_pseudo_member_(cls, value):
+        """
+        Create a composite member iff value contains only members.
+        """
         pseudo_member = cls._value2member_map_.get(value, None)
         if pseudo_member is None:
             need_to_create = [value]
@@ -869,11 +1003,15 @@
 
 
 def _high_bit(value):
-    """returns index of highest bit, or -1 if value is zero or negative"""
+    """
+    returns index of highest bit, or -1 if value is zero or negative
+    """
     return value.bit_length() - 1
 
 def unique(enumeration):
-    """Class decorator for enumerations ensuring unique member values."""
+    """
+    Class decorator for enumerations ensuring unique member values.
+    """
     duplicates = []
     for name, member in enumeration.__members__.items():
         if name != member.name:
@@ -886,7 +1024,9 @@
     return enumeration
 
 def _decompose(flag, value):
-    """Extract all members from the value."""
+    """
+    Extract all members from the value.
+    """
     # _decompose is only called if the value is not named
     not_covered = value
     negative = value < 0
diff --git a/Lib/filecmp.py b/Lib/filecmp.py
index 7a4da6b..70a4b23 100644
--- a/Lib/filecmp.py
+++ b/Lib/filecmp.py
@@ -36,8 +36,9 @@
 
     f2 -- Second file name
 
-    shallow -- Just check stat signature (do not read the files).
-               defaults to True.
+    shallow -- treat files as identical if their stat signatures (type, size,
+               mtime) are identical. Otherwise, files are considered different
+               if their sizes or contents differ.  [default: True]
 
     Return value:
 
@@ -115,7 +116,9 @@
      same_files: list of identical files.
      diff_files: list of filenames which differ.
      funny_files: list of files which could not be compared.
-     subdirs: a dictionary of dircmp objects, keyed by names in common_dirs.
+     subdirs: a dictionary of dircmp instances (or MyDirCmp instances if this
+       object is of type MyDirCmp, a subclass of dircmp), keyed by names
+       in common_dirs.
      """
 
     def __init__(self, a, b, ignore=None, hide=None): # Initialize
@@ -185,14 +188,15 @@
         self.same_files, self.diff_files, self.funny_files = xx
 
     def phase4(self): # Find out differences between common subdirectories
-        # A new dircmp object is created for each common subdirectory,
+        # A new dircmp (or MyDirCmp if dircmp was subclassed) object is created
+        # for each common subdirectory,
         # these are stored in a dictionary indexed by filename.
         # The hide and ignore properties are inherited from the parent
         self.subdirs = {}
         for x in self.common_dirs:
             a_x = os.path.join(self.left, x)
             b_x = os.path.join(self.right, x)
-            self.subdirs[x]  = dircmp(a_x, b_x, self.ignore, self.hide)
+            self.subdirs[x]  = self.__class__(a_x, b_x, self.ignore, self.hide)
 
     def phase4_closure(self): # Recursively call phase4() on subdirectories
         self.phase4()
diff --git a/Lib/fileinput.py b/Lib/fileinput.py
index 0c31f93..3534718 100644
--- a/Lib/fileinput.py
+++ b/Lib/fileinput.py
@@ -3,7 +3,7 @@
 Typical use is:
 
     import fileinput
-    for line in fileinput.input():
+    for line in fileinput.input(encoding="utf-8"):
         process(line)
 
 This iterates over the lines of all files listed in sys.argv[1:],
@@ -63,15 +63,9 @@
 deleted when the output file is closed.  In-place filtering is
 disabled when standard input is read.  XXX The current implementation
 does not work for MS-DOS 8+3 filesystems.
-
-XXX Possible additions:
-
-- optional getopt argument processing
-- isatty()
-- read(), read(size), even readlines()
-
 """
 
+import io
 import sys, os
 from types import GenericAlias
 
@@ -81,7 +75,8 @@
 
 _state = None
 
-def input(files=None, inplace=False, backup="", *, mode="r", openhook=None):
+def input(files=None, inplace=False, backup="", *, mode="r", openhook=None,
+          encoding=None, errors=None):
     """Return an instance of the FileInput class, which can be iterated.
 
     The parameters are passed to the constructor of the FileInput class.
@@ -91,7 +86,8 @@
     global _state
     if _state and _state._file:
         raise RuntimeError("input() already active")
-    _state = FileInput(files, inplace, backup, mode=mode, openhook=openhook)
+    _state = FileInput(files, inplace, backup, mode=mode, openhook=openhook,
+                       encoding=encoding, errors=errors)
     return _state
 
 def close():
@@ -186,7 +182,7 @@
     """
 
     def __init__(self, files=None, inplace=False, backup="", *,
-                 mode="r", openhook=None):
+                 mode="r", openhook=None, encoding=None, errors=None):
         if isinstance(files, str):
             files = (files,)
         elif isinstance(files, os.PathLike):
@@ -209,6 +205,17 @@
         self._file = None
         self._isstdin = False
         self._backupfilename = None
+        self._encoding = encoding
+        self._errors = errors
+
+        # We can not use io.text_encoding() here because old openhook doesn't
+        # take encoding parameter.
+        if (sys.flags.warn_default_encoding and
+                "b" not in mode and encoding is None and openhook is None):
+            import warnings
+            warnings.warn("'encoding' argument not specified.",
+                          EncodingWarning, 2)
+
         # restrict mode argument to reading modes
         if mode not in ('r', 'rU', 'U', 'rb'):
             raise ValueError("FileInput opening mode must be one of "
@@ -324,6 +331,13 @@
         self._file = None
         self._isstdin = False
         self._backupfilename = 0
+
+        # EncodingWarning is emitted in __init__() already
+        if "b" not in self._mode:
+            encoding = self._encoding or "locale"
+        else:
+            encoding = None
+
         if self._filename == '-':
             self._filename = '<stdin>'
             if 'b' in self._mode:
@@ -341,18 +355,18 @@
                     pass
                 # The next few lines may raise OSError
                 os.rename(self._filename, self._backupfilename)
-                self._file = open(self._backupfilename, self._mode)
+                self._file = open(self._backupfilename, self._mode, encoding=encoding)
                 try:
                     perm = os.fstat(self._file.fileno()).st_mode
                 except OSError:
-                    self._output = open(self._filename, self._write_mode)
+                    self._output = open(self._filename, self._write_mode, encoding=encoding)
                 else:
                     mode = os.O_CREAT | os.O_WRONLY | os.O_TRUNC
                     if hasattr(os, 'O_BINARY'):
                         mode |= os.O_BINARY
 
                     fd = os.open(self._filename, mode, perm)
-                    self._output = os.fdopen(fd, self._write_mode)
+                    self._output = os.fdopen(fd, self._write_mode, encoding=encoding)
                     try:
                         os.chmod(self._filename, perm)
                     except OSError:
@@ -362,9 +376,15 @@
             else:
                 # This may raise OSError
                 if self._openhook:
-                    self._file = self._openhook(self._filename, self._mode)
+                    # Custom hooks made previous to Python 3.10 didn't have
+                    # encoding argument
+                    if self._encoding is None:
+                        self._file = self._openhook(self._filename, self._mode)
+                    else:
+                        self._file = self._openhook(
+                            self._filename, self._mode, encoding=self._encoding, errors=self._errors)
                 else:
-                    self._file = open(self._filename, self._mode)
+                    self._file = open(self._filename, self._mode, encoding=encoding, errors=self._errors)
         self._readline = self._file.readline  # hide FileInput._readline
         return self._readline()
 
@@ -395,16 +415,23 @@
     __class_getitem__ = classmethod(GenericAlias)
 
 
-def hook_compressed(filename, mode):
+def hook_compressed(filename, mode, *, encoding=None, errors=None):
+    if encoding is None:  # EncodingWarning is emitted in FileInput() already.
+        encoding = "locale"
     ext = os.path.splitext(filename)[1]
     if ext == '.gz':
         import gzip
-        return gzip.open(filename, mode)
+        stream = gzip.open(filename, mode)
     elif ext == '.bz2':
         import bz2
-        return bz2.BZ2File(filename, mode)
+        stream = bz2.BZ2File(filename, mode)
     else:
-        return open(filename, mode)
+        return open(filename, mode, encoding=encoding, errors=errors)
+
+    # gzip and bz2 are binary mode by default.
+    if "b" not in mode:
+        stream = io.TextIOWrapper(stream, encoding=encoding, errors=errors)
+    return stream
 
 
 def hook_encoded(encoding, errors=None):
diff --git a/Lib/fnmatch.py b/Lib/fnmatch.py
index 0eb1802..7c52c23 100644
--- a/Lib/fnmatch.py
+++ b/Lib/fnmatch.py
@@ -52,7 +52,7 @@
     return re.compile(res).match
 
 def filter(names, pat):
-    """Return the subset of the list NAMES that match PAT."""
+    """Construct a list from those elements of the iterable NAMES that match PAT."""
     result = []
     pat = os.path.normcase(pat)
     match = _compile_pattern(pat)
diff --git a/Lib/formatter.py b/Lib/formatter.py
deleted file mode 100644
index e2394de..0000000
--- a/Lib/formatter.py
+++ /dev/null
@@ -1,452 +0,0 @@
-"""Generic output formatting.
-
-Formatter objects transform an abstract flow of formatting events into
-specific output events on writer objects. Formatters manage several stack
-structures to allow various properties of a writer object to be changed and
-restored; writers need not be able to handle relative changes nor any sort
-of ``change back'' operation. Specific writer properties which may be
-controlled via formatter objects are horizontal alignment, font, and left
-margin indentations. A mechanism is provided which supports providing
-arbitrary, non-exclusive style settings to a writer as well. Additional
-interfaces facilitate formatting events which are not reversible, such as
-paragraph separation.
-
-Writer objects encapsulate device interfaces. Abstract devices, such as
-file formats, are supported as well as physical devices. The provided
-implementations all work with abstract devices. The interface makes
-available mechanisms for setting the properties which formatter objects
-manage and inserting data into the output.
-"""
-
-import sys
-import warnings
-warnings.warn('the formatter module is deprecated', DeprecationWarning,
-              stacklevel=2)
-
-
-AS_IS = None
-
-
-class NullFormatter:
-    """A formatter which does nothing.
-
-    If the writer parameter is omitted, a NullWriter instance is created.
-    No methods of the writer are called by NullFormatter instances.
-
-    Implementations should inherit from this class if implementing a writer
-    interface but don't need to inherit any implementation.
-
-    """
-
-    def __init__(self, writer=None):
-        if writer is None:
-            writer = NullWriter()
-        self.writer = writer
-    def end_paragraph(self, blankline): pass
-    def add_line_break(self): pass
-    def add_hor_rule(self, *args, **kw): pass
-    def add_label_data(self, format, counter, blankline=None): pass
-    def add_flowing_data(self, data): pass
-    def add_literal_data(self, data): pass
-    def flush_softspace(self): pass
-    def push_alignment(self, align): pass
-    def pop_alignment(self): pass
-    def push_font(self, x): pass
-    def pop_font(self): pass
-    def push_margin(self, margin): pass
-    def pop_margin(self): pass
-    def set_spacing(self, spacing): pass
-    def push_style(self, *styles): pass
-    def pop_style(self, n=1): pass
-    def assert_line_data(self, flag=1): pass
-
-
-class AbstractFormatter:
-    """The standard formatter.
-
-    This implementation has demonstrated wide applicability to many writers,
-    and may be used directly in most circumstances.  It has been used to
-    implement a full-featured World Wide Web browser.
-
-    """
-
-    #  Space handling policy:  blank spaces at the boundary between elements
-    #  are handled by the outermost context.  "Literal" data is not checked
-    #  to determine context, so spaces in literal data are handled directly
-    #  in all circumstances.
-
-    def __init__(self, writer):
-        self.writer = writer            # Output device
-        self.align = None               # Current alignment
-        self.align_stack = []           # Alignment stack
-        self.font_stack = []            # Font state
-        self.margin_stack = []          # Margin state
-        self.spacing = None             # Vertical spacing state
-        self.style_stack = []           # Other state, e.g. color
-        self.nospace = 1                # Should leading space be suppressed
-        self.softspace = 0              # Should a space be inserted
-        self.para_end = 1               # Just ended a paragraph
-        self.parskip = 0                # Skipped space between paragraphs?
-        self.hard_break = 1             # Have a hard break
-        self.have_label = 0
-
-    def end_paragraph(self, blankline):
-        if not self.hard_break:
-            self.writer.send_line_break()
-            self.have_label = 0
-        if self.parskip < blankline and not self.have_label:
-            self.writer.send_paragraph(blankline - self.parskip)
-            self.parskip = blankline
-            self.have_label = 0
-        self.hard_break = self.nospace = self.para_end = 1
-        self.softspace = 0
-
-    def add_line_break(self):
-        if not (self.hard_break or self.para_end):
-            self.writer.send_line_break()
-            self.have_label = self.parskip = 0
-        self.hard_break = self.nospace = 1
-        self.softspace = 0
-
-    def add_hor_rule(self, *args, **kw):
-        if not self.hard_break:
-            self.writer.send_line_break()
-        self.writer.send_hor_rule(*args, **kw)
-        self.hard_break = self.nospace = 1
-        self.have_label = self.para_end = self.softspace = self.parskip = 0
-
-    def add_label_data(self, format, counter, blankline = None):
-        if self.have_label or not self.hard_break:
-            self.writer.send_line_break()
-        if not self.para_end:
-            self.writer.send_paragraph((blankline and 1) or 0)
-        if isinstance(format, str):
-            self.writer.send_label_data(self.format_counter(format, counter))
-        else:
-            self.writer.send_label_data(format)
-        self.nospace = self.have_label = self.hard_break = self.para_end = 1
-        self.softspace = self.parskip = 0
-
-    def format_counter(self, format, counter):
-        label = ''
-        for c in format:
-            if c == '1':
-                label = label + ('%d' % counter)
-            elif c in 'aA':
-                if counter > 0:
-                    label = label + self.format_letter(c, counter)
-            elif c in 'iI':
-                if counter > 0:
-                    label = label + self.format_roman(c, counter)
-            else:
-                label = label + c
-        return label
-
-    def format_letter(self, case, counter):
-        label = ''
-        while counter > 0:
-            counter, x = divmod(counter-1, 26)
-            # This makes a strong assumption that lowercase letters
-            # and uppercase letters form two contiguous blocks, with
-            # letters in order!
-            s = chr(ord(case) + x)
-            label = s + label
-        return label
-
-    def format_roman(self, case, counter):
-        ones = ['i', 'x', 'c', 'm']
-        fives = ['v', 'l', 'd']
-        label, index = '', 0
-        # This will die of IndexError when counter is too big
-        while counter > 0:
-            counter, x = divmod(counter, 10)
-            if x == 9:
-                label = ones[index] + ones[index+1] + label
-            elif x == 4:
-                label = ones[index] + fives[index] + label
-            else:
-                if x >= 5:
-                    s = fives[index]
-                    x = x-5
-                else:
-                    s = ''
-                s = s + ones[index]*x
-                label = s + label
-            index = index + 1
-        if case == 'I':
-            return label.upper()
-        return label
-
-    def add_flowing_data(self, data):
-        if not data: return
-        prespace = data[:1].isspace()
-        postspace = data[-1:].isspace()
-        data = " ".join(data.split())
-        if self.nospace and not data:
-            return
-        elif prespace or self.softspace:
-            if not data:
-                if not self.nospace:
-                    self.softspace = 1
-                    self.parskip = 0
-                return
-            if not self.nospace:
-                data = ' ' + data
-        self.hard_break = self.nospace = self.para_end = \
-                          self.parskip = self.have_label = 0
-        self.softspace = postspace
-        self.writer.send_flowing_data(data)
-
-    def add_literal_data(self, data):
-        if not data: return
-        if self.softspace:
-            self.writer.send_flowing_data(" ")
-        self.hard_break = data[-1:] == '\n'
-        self.nospace = self.para_end = self.softspace = \
-                       self.parskip = self.have_label = 0
-        self.writer.send_literal_data(data)
-
-    def flush_softspace(self):
-        if self.softspace:
-            self.hard_break = self.para_end = self.parskip = \
-                              self.have_label = self.softspace = 0
-            self.nospace = 1
-            self.writer.send_flowing_data(' ')
-
-    def push_alignment(self, align):
-        if align and align != self.align:
-            self.writer.new_alignment(align)
-            self.align = align
-            self.align_stack.append(align)
-        else:
-            self.align_stack.append(self.align)
-
-    def pop_alignment(self):
-        if self.align_stack:
-            del self.align_stack[-1]
-        if self.align_stack:
-            self.align = align = self.align_stack[-1]
-            self.writer.new_alignment(align)
-        else:
-            self.align = None
-            self.writer.new_alignment(None)
-
-    def push_font(self, font):
-        size, i, b, tt = font
-        if self.softspace:
-            self.hard_break = self.para_end = self.softspace = 0
-            self.nospace = 1
-            self.writer.send_flowing_data(' ')
-        if self.font_stack:
-            csize, ci, cb, ctt = self.font_stack[-1]
-            if size is AS_IS: size = csize
-            if i is AS_IS: i = ci
-            if b is AS_IS: b = cb
-            if tt is AS_IS: tt = ctt
-        font = (size, i, b, tt)
-        self.font_stack.append(font)
-        self.writer.new_font(font)
-
-    def pop_font(self):
-        if self.font_stack:
-            del self.font_stack[-1]
-        if self.font_stack:
-            font = self.font_stack[-1]
-        else:
-            font = None
-        self.writer.new_font(font)
-
-    def push_margin(self, margin):
-        self.margin_stack.append(margin)
-        fstack = [m for m in self.margin_stack if m]
-        if not margin and fstack:
-            margin = fstack[-1]
-        self.writer.new_margin(margin, len(fstack))
-
-    def pop_margin(self):
-        if self.margin_stack:
-            del self.margin_stack[-1]
-        fstack = [m for m in self.margin_stack if m]
-        if fstack:
-            margin = fstack[-1]
-        else:
-            margin = None
-        self.writer.new_margin(margin, len(fstack))
-
-    def set_spacing(self, spacing):
-        self.spacing = spacing
-        self.writer.new_spacing(spacing)
-
-    def push_style(self, *styles):
-        if self.softspace:
-            self.hard_break = self.para_end = self.softspace = 0
-            self.nospace = 1
-            self.writer.send_flowing_data(' ')
-        for style in styles:
-            self.style_stack.append(style)
-        self.writer.new_styles(tuple(self.style_stack))
-
-    def pop_style(self, n=1):
-        del self.style_stack[-n:]
-        self.writer.new_styles(tuple(self.style_stack))
-
-    def assert_line_data(self, flag=1):
-        self.nospace = self.hard_break = not flag
-        self.para_end = self.parskip = self.have_label = 0
-
-
-class NullWriter:
-    """Minimal writer interface to use in testing & inheritance.
-
-    A writer which only provides the interface definition; no actions are
-    taken on any methods.  This should be the base class for all writers
-    which do not need to inherit any implementation methods.
-
-    """
-    def __init__(self): pass
-    def flush(self): pass
-    def new_alignment(self, align): pass
-    def new_font(self, font): pass
-    def new_margin(self, margin, level): pass
-    def new_spacing(self, spacing): pass
-    def new_styles(self, styles): pass
-    def send_paragraph(self, blankline): pass
-    def send_line_break(self): pass
-    def send_hor_rule(self, *args, **kw): pass
-    def send_label_data(self, data): pass
-    def send_flowing_data(self, data): pass
-    def send_literal_data(self, data): pass
-
-
-class AbstractWriter(NullWriter):
-    """A writer which can be used in debugging formatters, but not much else.
-
-    Each method simply announces itself by printing its name and
-    arguments on standard output.
-
-    """
-
-    def new_alignment(self, align):
-        print("new_alignment(%r)" % (align,))
-
-    def new_font(self, font):
-        print("new_font(%r)" % (font,))
-
-    def new_margin(self, margin, level):
-        print("new_margin(%r, %d)" % (margin, level))
-
-    def new_spacing(self, spacing):
-        print("new_spacing(%r)" % (spacing,))
-
-    def new_styles(self, styles):
-        print("new_styles(%r)" % (styles,))
-
-    def send_paragraph(self, blankline):
-        print("send_paragraph(%r)" % (blankline,))
-
-    def send_line_break(self):
-        print("send_line_break()")
-
-    def send_hor_rule(self, *args, **kw):
-        print("send_hor_rule()")
-
-    def send_label_data(self, data):
-        print("send_label_data(%r)" % (data,))
-
-    def send_flowing_data(self, data):
-        print("send_flowing_data(%r)" % (data,))
-
-    def send_literal_data(self, data):
-        print("send_literal_data(%r)" % (data,))
-
-
-class DumbWriter(NullWriter):
-    """Simple writer class which writes output on the file object passed in
-    as the file parameter or, if file is omitted, on standard output.  The
-    output is simply word-wrapped to the number of columns specified by
-    the maxcol parameter.  This class is suitable for reflowing a sequence
-    of paragraphs.
-
-    """
-
-    def __init__(self, file=None, maxcol=72):
-        self.file = file or sys.stdout
-        self.maxcol = maxcol
-        NullWriter.__init__(self)
-        self.reset()
-
-    def reset(self):
-        self.col = 0
-        self.atbreak = 0
-
-    def send_paragraph(self, blankline):
-        self.file.write('\n'*blankline)
-        self.col = 0
-        self.atbreak = 0
-
-    def send_line_break(self):
-        self.file.write('\n')
-        self.col = 0
-        self.atbreak = 0
-
-    def send_hor_rule(self, *args, **kw):
-        self.file.write('\n')
-        self.file.write('-'*self.maxcol)
-        self.file.write('\n')
-        self.col = 0
-        self.atbreak = 0
-
-    def send_literal_data(self, data):
-        self.file.write(data)
-        i = data.rfind('\n')
-        if i >= 0:
-            self.col = 0
-            data = data[i+1:]
-        data = data.expandtabs()
-        self.col = self.col + len(data)
-        self.atbreak = 0
-
-    def send_flowing_data(self, data):
-        if not data: return
-        atbreak = self.atbreak or data[0].isspace()
-        col = self.col
-        maxcol = self.maxcol
-        write = self.file.write
-        for word in data.split():
-            if atbreak:
-                if col + len(word) >= maxcol:
-                    write('\n')
-                    col = 0
-                else:
-                    write(' ')
-                    col = col + 1
-            write(word)
-            col = col + len(word)
-            atbreak = 1
-        self.col = col
-        self.atbreak = data[-1].isspace()
-
-
-def test(file = None):
-    w = DumbWriter()
-    f = AbstractFormatter(w)
-    if file is not None:
-        fp = open(file)
-    elif sys.argv[1:]:
-        fp = open(sys.argv[1])
-    else:
-        fp = sys.stdin
-    try:
-        for line in fp:
-            if line == '\n':
-                f.end_paragraph(1)
-            else:
-                f.add_flowing_data(line)
-    finally:
-        if fp is not sys.stdin:
-            fp.close()
-    f.end_paragraph(0)
-
-
-if __name__ == '__main__':
-    test()
diff --git a/Lib/fractions.py b/Lib/fractions.py
index de3e23b..96047be 100644
--- a/Lib/fractions.py
+++ b/Lib/fractions.py
@@ -380,32 +380,139 @@
 
         return forward, reverse
 
+    # Rational arithmetic algorithms: Knuth, TAOCP, Volume 2, 4.5.1.
+    #
+    # Assume input fractions a and b are normalized.
+    #
+    # 1) Consider addition/subtraction.
+    #
+    # Let g = gcd(da, db). Then
+    #
+    #              na   nb    na*db ± nb*da
+    #     a ± b == -- ± -- == ------------- ==
+    #              da   db        da*db
+    #
+    #              na*(db//g) ± nb*(da//g)    t
+    #           == ----------------------- == -
+    #                      (da*db)//g         d
+    #
+    # Now, if g > 1, we're working with smaller integers.
+    #
+    # Note, that t, (da//g) and (db//g) are pairwise coprime.
+    #
+    # Indeed, (da//g) and (db//g) share no common factors (they were
+    # removed) and da is coprime with na (since input fractions are
+    # normalized), hence (da//g) and na are coprime.  By symmetry,
+    # (db//g) and nb are coprime too.  Then,
+    #
+    #     gcd(t, da//g) == gcd(na*(db//g), da//g) == 1
+    #     gcd(t, db//g) == gcd(nb*(da//g), db//g) == 1
+    #
+    # Above allows us optimize reduction of the result to lowest
+    # terms.  Indeed,
+    #
+    #     g2 = gcd(t, d) == gcd(t, (da//g)*(db//g)*g) == gcd(t, g)
+    #
+    #                       t//g2                   t//g2
+    #     a ± b == ----------------------- == ----------------
+    #              (da//g)*(db//g)*(g//g2)    (da//g)*(db//g2)
+    #
+    # is a normalized fraction.  This is useful because the unnormalized
+    # denominator d could be much larger than g.
+    #
+    # We should special-case g == 1 (and g2 == 1), since 60.8% of
+    # randomly-chosen integers are coprime:
+    # https://en.wikipedia.org/wiki/Coprime_integers#Probability_of_coprimality
+    # Note, that g2 == 1 always for fractions, obtained from floats: here
+    # g is a power of 2 and the unnormalized numerator t is an odd integer.
+    #
+    # 2) Consider multiplication
+    #
+    # Let g1 = gcd(na, db) and g2 = gcd(nb, da), then
+    #
+    #            na*nb    na*nb    (na//g1)*(nb//g2)
+    #     a*b == ----- == ----- == -----------------
+    #            da*db    db*da    (db//g1)*(da//g2)
+    #
+    # Note, that after divisions we're multiplying smaller integers.
+    #
+    # Also, the resulting fraction is normalized, because each of
+    # two factors in the numerator is coprime to each of the two factors
+    # in the denominator.
+    #
+    # Indeed, pick (na//g1).  It's coprime with (da//g2), because input
+    # fractions are normalized.  It's also coprime with (db//g1), because
+    # common factors are removed by g1 == gcd(na, db).
+    #
+    # As for addition/subtraction, we should special-case g1 == 1
+    # and g2 == 1 for same reason.  That happens also for multiplying
+    # rationals, obtained from floats.
+
     def _add(a, b):
         """a + b"""
-        da, db = a.denominator, b.denominator
-        return Fraction(a.numerator * db + b.numerator * da,
-                        da * db)
+        na, da = a.numerator, a.denominator
+        nb, db = b.numerator, b.denominator
+        g = math.gcd(da, db)
+        if g == 1:
+            return Fraction(na * db + da * nb, da * db, _normalize=False)
+        s = da // g
+        t = na * (db // g) + nb * s
+        g2 = math.gcd(t, g)
+        if g2 == 1:
+            return Fraction(t, s * db, _normalize=False)
+        return Fraction(t // g2, s * (db // g2), _normalize=False)
 
     __add__, __radd__ = _operator_fallbacks(_add, operator.add)
 
     def _sub(a, b):
         """a - b"""
-        da, db = a.denominator, b.denominator
-        return Fraction(a.numerator * db - b.numerator * da,
-                        da * db)
+        na, da = a.numerator, a.denominator
+        nb, db = b.numerator, b.denominator
+        g = math.gcd(da, db)
+        if g == 1:
+            return Fraction(na * db - da * nb, da * db, _normalize=False)
+        s = da // g
+        t = na * (db // g) - nb * s
+        g2 = math.gcd(t, g)
+        if g2 == 1:
+            return Fraction(t, s * db, _normalize=False)
+        return Fraction(t // g2, s * (db // g2), _normalize=False)
 
     __sub__, __rsub__ = _operator_fallbacks(_sub, operator.sub)
 
     def _mul(a, b):
         """a * b"""
-        return Fraction(a.numerator * b.numerator, a.denominator * b.denominator)
+        na, da = a.numerator, a.denominator
+        nb, db = b.numerator, b.denominator
+        g1 = math.gcd(na, db)
+        if g1 > 1:
+            na //= g1
+            db //= g1
+        g2 = math.gcd(nb, da)
+        if g2 > 1:
+            nb //= g2
+            da //= g2
+        return Fraction(na * nb, db * da, _normalize=False)
 
     __mul__, __rmul__ = _operator_fallbacks(_mul, operator.mul)
 
     def _div(a, b):
         """a / b"""
-        return Fraction(a.numerator * b.denominator,
-                        a.denominator * b.numerator)
+        # Same as _mul(), with inversed b.
+        na, da = a.numerator, a.denominator
+        nb, db = b.numerator, b.denominator
+        g1 = math.gcd(na, nb)
+        if g1 > 1:
+            na //= g1
+            nb //= g1
+        g2 = math.gcd(db, da)
+        if g2 > 1:
+            da //= g2
+            db //= g2
+        n, d = na * db, nb * da
+        if d < 0:
+            n, d = -n, -d
+        return Fraction(n, d, _normalize=False)
 
     __truediv__, __rtruediv__ = _operator_fallbacks(_div, operator.truediv)
 
diff --git a/Lib/ftplib.py b/Lib/ftplib.py
index 1f760ed..7c5a507 100644
--- a/Lib/ftplib.py
+++ b/Lib/ftplib.py
@@ -102,7 +102,9 @@
     sock = None
     file = None
     welcome = None
-    passiveserver = 1
+    passiveserver = True
+    # Disables https://bugs.python.org/issue43285 security if set to True.
+    trust_server_pasv_ipv4_address = False
 
     def __init__(self, host='', user='', passwd='', acct='',
                  timeout=_GLOBAL_DEFAULT_TIMEOUT, source_address=None, *,
@@ -320,8 +322,13 @@
         return sock
 
     def makepasv(self):
+        """Internal: Does the PASV or EPSV handshake -> (address, port)"""
         if self.af == socket.AF_INET:
-            host, port = parse227(self.sendcmd('PASV'))
+            untrusted_host, port = parse227(self.sendcmd('PASV'))
+            if self.trust_server_pasv_ipv4_address:
+                host = untrusted_host
+            else:
+                host = self.sock.getpeername()[0]
         else:
             host, port = parse229(self.sendcmd('EPSV'), self.sock.getpeername())
         return host, port
diff --git a/Lib/functools.py b/Lib/functools.py
index 5cab497..305ceb4 100644
--- a/Lib/functools.py
+++ b/Lib/functools.py
@@ -88,84 +88,84 @@
 
 def _gt_from_lt(self, other, NotImplemented=NotImplemented):
     'Return a > b.  Computed by @total_ordering from (not a < b) and (a != b).'
-    op_result = self.__lt__(other)
+    op_result = type(self).__lt__(self, other)
     if op_result is NotImplemented:
         return op_result
     return not op_result and self != other
 
 def _le_from_lt(self, other, NotImplemented=NotImplemented):
     'Return a <= b.  Computed by @total_ordering from (a < b) or (a == b).'
-    op_result = self.__lt__(other)
+    op_result = type(self).__lt__(self, other)
     if op_result is NotImplemented:
         return op_result
     return op_result or self == other
 
 def _ge_from_lt(self, other, NotImplemented=NotImplemented):
     'Return a >= b.  Computed by @total_ordering from (not a < b).'
-    op_result = self.__lt__(other)
+    op_result = type(self).__lt__(self, other)
     if op_result is NotImplemented:
         return op_result
     return not op_result
 
 def _ge_from_le(self, other, NotImplemented=NotImplemented):
     'Return a >= b.  Computed by @total_ordering from (not a <= b) or (a == b).'
-    op_result = self.__le__(other)
+    op_result = type(self).__le__(self, other)
     if op_result is NotImplemented:
         return op_result
     return not op_result or self == other
 
 def _lt_from_le(self, other, NotImplemented=NotImplemented):
     'Return a < b.  Computed by @total_ordering from (a <= b) and (a != b).'
-    op_result = self.__le__(other)
+    op_result = type(self).__le__(self, other)
     if op_result is NotImplemented:
         return op_result
     return op_result and self != other
 
 def _gt_from_le(self, other, NotImplemented=NotImplemented):
     'Return a > b.  Computed by @total_ordering from (not a <= b).'
-    op_result = self.__le__(other)
+    op_result = type(self).__le__(self, other)
     if op_result is NotImplemented:
         return op_result
     return not op_result
 
 def _lt_from_gt(self, other, NotImplemented=NotImplemented):
     'Return a < b.  Computed by @total_ordering from (not a > b) and (a != b).'
-    op_result = self.__gt__(other)
+    op_result = type(self).__gt__(self, other)
     if op_result is NotImplemented:
         return op_result
     return not op_result and self != other
 
 def _ge_from_gt(self, other, NotImplemented=NotImplemented):
     'Return a >= b.  Computed by @total_ordering from (a > b) or (a == b).'
-    op_result = self.__gt__(other)
+    op_result = type(self).__gt__(self, other)
     if op_result is NotImplemented:
         return op_result
     return op_result or self == other
 
 def _le_from_gt(self, other, NotImplemented=NotImplemented):
     'Return a <= b.  Computed by @total_ordering from (not a > b).'
-    op_result = self.__gt__(other)
+    op_result = type(self).__gt__(self, other)
     if op_result is NotImplemented:
         return op_result
     return not op_result
 
 def _le_from_ge(self, other, NotImplemented=NotImplemented):
     'Return a <= b.  Computed by @total_ordering from (not a >= b) or (a == b).'
-    op_result = self.__ge__(other)
+    op_result = type(self).__ge__(self, other)
     if op_result is NotImplemented:
         return op_result
     return not op_result or self == other
 
 def _gt_from_ge(self, other, NotImplemented=NotImplemented):
     'Return a > b.  Computed by @total_ordering from (a >= b) and (a != b).'
-    op_result = self.__ge__(other)
+    op_result = type(self).__ge__(self, other)
     if op_result is NotImplemented:
         return op_result
     return op_result and self != other
 
 def _lt_from_ge(self, other, NotImplemented=NotImplemented):
     'Return a < b.  Computed by @total_ordering from (not a >= b).'
-    op_result = self.__ge__(other)
+    op_result = type(self).__ge__(self, other)
     if op_result is NotImplemented:
         return op_result
     return not op_result
@@ -236,14 +236,14 @@
 
 def reduce(function, sequence, initial=_initial_missing):
     """
-    reduce(function, sequence[, initial]) -> value
+    reduce(function, iterable[, initial]) -> value
 
-    Apply a function of two arguments cumulatively to the items of a sequence,
-    from left to right, so as to reduce the sequence to a single value.
-    For example, reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]) calculates
+    Apply a function of two arguments cumulatively to the items of a sequence
+    or iterable, from left to right, so as to reduce the iterable to a single
+    value.  For example, reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]) calculates
     ((((1+2)+3)+4)+5).  If initial is present, it is placed before the items
-    of the sequence in the calculation, and serves as a default when the
-    sequence is empty.
+    of the iterable in the calculation, and serves as a default when the
+    iterable is empty.
     """
 
     it = iter(sequence)
@@ -252,7 +252,8 @@
         try:
             value = next(it)
         except StopIteration:
-            raise TypeError("reduce() of empty sequence with no initial value") from None
+            raise TypeError(
+                "reduce() of empty iterable with no initial value") from None
     else:
         value = initial
 
@@ -491,7 +492,7 @@
     with f.cache_info().  Clear the cache and statistics with f.cache_clear().
     Access the underlying function with f.__wrapped__.
 
-    See:  http://en.wikipedia.org/wiki/Cache_replacement_policies#Least_recently_used_(LRU)
+    See:  https://en.wikipedia.org/wiki/Cache_replacement_policies#Least_recently_used_(LRU)
 
     """
 
@@ -659,7 +660,7 @@
 def _c3_merge(sequences):
     """Merges MROs in *sequences* to a single MRO using the C3 algorithm.
 
-    Adapted from http://www.python.org/download/releases/2.3/mro/.
+    Adapted from https://www.python.org/download/releases/2.3/mro/.
 
     """
     result = []
@@ -739,6 +740,7 @@
     # Remove entries which are already present in the __mro__ or unrelated.
     def is_related(typ):
         return (typ not in bases and hasattr(typ, '__mro__')
+                                 and not isinstance(typ, GenericAlias)
                                  and issubclass(cls, typ))
     types = [n for n in types if is_related(n)]
     # Remove entries which are strict bases of other entries (they will end up
@@ -836,6 +838,9 @@
             dispatch_cache[cls] = impl
         return impl
 
+    def _is_valid_dispatch_type(cls):
+        return isinstance(cls, type) and not isinstance(cls, GenericAlias)
+
     def register(cls, func=None):
         """generic_func.register(cls, func) -> func
 
@@ -843,9 +848,15 @@
 
         """
         nonlocal cache_token
-        if func is None:
-            if isinstance(cls, type):
+        if _is_valid_dispatch_type(cls):
+            if func is None:
                 return lambda f: register(cls, f)
+        else:
+            if func is not None:
+                raise TypeError(
+                    f"Invalid first argument to `register()`. "
+                    f"{cls!r} is not a class."
+                )
             ann = getattr(cls, '__annotations__', {})
             if not ann:
                 raise TypeError(
@@ -858,11 +869,12 @@
             # only import typing if annotation parsing is necessary
             from typing import get_type_hints
             argname, cls = next(iter(get_type_hints(func).items()))
-            if not isinstance(cls, type):
+            if not _is_valid_dispatch_type(cls):
                 raise TypeError(
                     f"Invalid annotation for {argname!r}. "
                     f"{cls!r} is not a class."
                 )
+
         registry[cls] = func
         if cache_token is None and hasattr(cls, '__abstractmethods__'):
             cache_token = get_cache_token()
diff --git a/Lib/getpass.py b/Lib/getpass.py
index 6911f41..6970d8a 100644
--- a/Lib/getpass.py
+++ b/Lib/getpass.py
@@ -95,7 +95,7 @@
 
 
 def win_getpass(prompt='Password: ', stream=None):
-    """Prompt for password with echo off, using Windows getch()."""
+    """Prompt for password with echo off, using Windows getwch()."""
     if sys.stdin is not sys.__stdin__:
         return fallback_getpass(prompt, stream)
 
diff --git a/Lib/glob.py b/Lib/glob.py
index 0dd2f8b..9fc08f4 100644
--- a/Lib/glob.py
+++ b/Lib/glob.py
@@ -1,13 +1,16 @@
 """Filename globbing utility."""
 
+import contextlib
 import os
 import re
 import fnmatch
+import itertools
+import stat
 import sys
 
 __all__ = ["glob", "iglob", "escape"]
 
-def glob(pathname, *, recursive=False):
+def glob(pathname, *, root_dir=None, dir_fd=None, recursive=False):
     """Return a list of paths matching a pathname pattern.
 
     The pattern may contain simple shell-style wildcards a la
@@ -18,9 +21,9 @@
     If recursive is true, the pattern '**' will match any files and
     zero or more directories and subdirectories.
     """
-    return list(iglob(pathname, recursive=recursive))
+    return list(iglob(pathname, root_dir=root_dir, dir_fd=dir_fd, recursive=recursive))
 
-def iglob(pathname, *, recursive=False):
+def iglob(pathname, *, root_dir=None, dir_fd=None, recursive=False):
     """Return an iterator which yields the paths matching a pathname pattern.
 
     The pattern may contain simple shell-style wildcards a la
@@ -32,35 +35,44 @@
     zero or more directories and subdirectories.
     """
     sys.audit("glob.glob", pathname, recursive)
-    it = _iglob(pathname, recursive, False)
-    if recursive and _isrecursive(pathname):
-        s = next(it)  # skip empty string
-        assert not s
+    sys.audit("glob.glob/2", pathname, recursive, root_dir, dir_fd)
+    if root_dir is not None:
+        root_dir = os.fspath(root_dir)
+    else:
+        root_dir = pathname[:0]
+    it = _iglob(pathname, root_dir, dir_fd, recursive, False)
+    if not pathname or recursive and _isrecursive(pathname[:2]):
+        try:
+            s = next(it)  # skip empty string
+            if s:
+                it = itertools.chain((s,), it)
+        except StopIteration:
+            pass
     return it
 
-def _iglob(pathname, recursive, dironly):
+def _iglob(pathname, root_dir, dir_fd, recursive, dironly):
     dirname, basename = os.path.split(pathname)
     if not has_magic(pathname):
         assert not dironly
         if basename:
-            if os.path.lexists(pathname):
+            if _lexists(_join(root_dir, pathname), dir_fd):
                 yield pathname
         else:
             # Patterns ending with a slash should match only directories
-            if os.path.isdir(dirname):
+            if _isdir(_join(root_dir, dirname), dir_fd):
                 yield pathname
         return
     if not dirname:
         if recursive and _isrecursive(basename):
-            yield from _glob2(dirname, basename, dironly)
+            yield from _glob2(root_dir, basename, dir_fd, dironly)
         else:
-            yield from _glob1(dirname, basename, dironly)
+            yield from _glob1(root_dir, basename, dir_fd, dironly)
         return
     # `os.path.split()` returns the argument itself as a dirname if it is a
     # drive or UNC path.  Prevent an infinite recursion if a drive or UNC path
     # contains magic characters (i.e. r'\\?\C:').
     if dirname != pathname and has_magic(dirname):
-        dirs = _iglob(dirname, recursive, True)
+        dirs = _iglob(dirname, root_dir, dir_fd, recursive, True)
     else:
         dirs = [dirname]
     if has_magic(basename):
@@ -71,76 +83,125 @@
     else:
         glob_in_dir = _glob0
     for dirname in dirs:
-        for name in glob_in_dir(dirname, basename, dironly):
+        for name in glob_in_dir(_join(root_dir, dirname), basename, dir_fd, dironly):
             yield os.path.join(dirname, name)
 
 # These 2 helper functions non-recursively glob inside a literal directory.
 # They return a list of basenames.  _glob1 accepts a pattern while _glob0
 # takes a literal basename (so it only has to check for its existence).
 
-def _glob1(dirname, pattern, dironly):
-    names = list(_iterdir(dirname, dironly))
+def _glob1(dirname, pattern, dir_fd, dironly):
+    names = _listdir(dirname, dir_fd, dironly)
     if not _ishidden(pattern):
         names = (x for x in names if not _ishidden(x))
     return fnmatch.filter(names, pattern)
 
-def _glob0(dirname, basename, dironly):
-    if not basename:
-        # `os.path.split()` returns an empty basename for paths ending with a
-        # directory separator.  'q*x/' should match only directories.
-        if os.path.isdir(dirname):
+def _glob0(dirname, basename, dir_fd, dironly):
+    if basename:
+        if _lexists(_join(dirname, basename), dir_fd):
             return [basename]
     else:
-        if os.path.lexists(os.path.join(dirname, basename)):
+        # `os.path.split()` returns an empty basename for paths ending with a
+        # directory separator.  'q*x/' should match only directories.
+        if _isdir(dirname, dir_fd):
             return [basename]
     return []
 
 # Following functions are not public but can be used by third-party code.
 
 def glob0(dirname, pattern):
-    return _glob0(dirname, pattern, False)
+    return _glob0(dirname, pattern, None, False)
 
 def glob1(dirname, pattern):
-    return _glob1(dirname, pattern, False)
+    return _glob1(dirname, pattern, None, False)
 
 # This helper function recursively yields relative pathnames inside a literal
 # directory.
 
-def _glob2(dirname, pattern, dironly):
+def _glob2(dirname, pattern, dir_fd, dironly):
     assert _isrecursive(pattern)
     yield pattern[:0]
-    yield from _rlistdir(dirname, dironly)
+    yield from _rlistdir(dirname, dir_fd, dironly)
 
 # If dironly is false, yields all file names inside a directory.
 # If dironly is true, yields only directory names.
-def _iterdir(dirname, dironly):
-    if not dirname:
-        if isinstance(dirname, bytes):
-            dirname = bytes(os.curdir, 'ASCII')
-        else:
-            dirname = os.curdir
+def _iterdir(dirname, dir_fd, dironly):
     try:
-        with os.scandir(dirname) as it:
-            for entry in it:
-                try:
-                    if not dironly or entry.is_dir():
-                        yield entry.name
-                except OSError:
-                    pass
+        fd = None
+        fsencode = None
+        if dir_fd is not None:
+            if dirname:
+                fd = arg = os.open(dirname, _dir_open_flags, dir_fd=dir_fd)
+            else:
+                arg = dir_fd
+            if isinstance(dirname, bytes):
+                fsencode = os.fsencode
+        elif dirname:
+            arg = dirname
+        elif isinstance(dirname, bytes):
+            arg = bytes(os.curdir, 'ASCII')
+        else:
+            arg = os.curdir
+        try:
+            with os.scandir(arg) as it:
+                for entry in it:
+                    try:
+                        if not dironly or entry.is_dir():
+                            if fsencode is not None:
+                                yield fsencode(entry.name)
+                            else:
+                                yield entry.name
+                    except OSError:
+                        pass
+        finally:
+            if fd is not None:
+                os.close(fd)
     except OSError:
         return
 
+def _listdir(dirname, dir_fd, dironly):
+    with contextlib.closing(_iterdir(dirname, dir_fd, dironly)) as it:
+        return list(it)
+
 # Recursively yields relative pathnames inside a literal directory.
-def _rlistdir(dirname, dironly):
-    names = list(_iterdir(dirname, dironly))
+def _rlistdir(dirname, dir_fd, dironly):
+    names = _listdir(dirname, dir_fd, dironly)
     for x in names:
         if not _ishidden(x):
             yield x
-            path = os.path.join(dirname, x) if dirname else x
-            for y in _rlistdir(path, dironly):
-                yield os.path.join(x, y)
+            path = _join(dirname, x) if dirname else x
+            for y in _rlistdir(path, dir_fd, dironly):
+                yield _join(x, y)
 
 
+def _lexists(pathname, dir_fd):
+    # Same as os.path.lexists(), but with dir_fd
+    if dir_fd is None:
+        return os.path.lexists(pathname)
+    try:
+        os.lstat(pathname, dir_fd=dir_fd)
+    except (OSError, ValueError):
+        return False
+    else:
+        return True
+
+def _isdir(pathname, dir_fd):
+    # Same as os.path.isdir(), but with dir_fd
+    if dir_fd is None:
+        return os.path.isdir(pathname)
+    try:
+        st = os.stat(pathname, dir_fd=dir_fd)
+    except (OSError, ValueError):
+        return False
+    else:
+        return stat.S_ISDIR(st.st_mode)
+
+def _join(dirname, basename):
+    # It is common if dirname or basename is empty
+    if not dirname or not basename:
+        return dirname or basename
+    return os.path.join(dirname, basename)
+
 magic_check = re.compile('([*?[])')
 magic_check_bytes = re.compile(b'([*?[])')
 
@@ -171,3 +232,6 @@
     else:
         pathname = magic_check.sub(r'[\1]', pathname)
     return drive + pathname
+
+
+_dir_open_flags = os.O_RDONLY | getattr(os, 'O_DIRECTORY', 0)
diff --git a/Lib/graphlib.py b/Lib/graphlib.py
index d0e7a48..1c5d9a4 100644
--- a/Lib/graphlib.py
+++ b/Lib/graphlib.py
@@ -17,7 +17,7 @@
         self.npredecessors = 0
 
         # List of successor nodes. The list can contain duplicated elements as
-        # long as they're all reflected in the successor's npredecessors attribute).
+        # long as they're all reflected in the successor's npredecessors attribute.
         self.successors = []
 
 
diff --git a/Lib/gzip.py b/Lib/gzip.py
index e422773..475ec32 100644
--- a/Lib/gzip.py
+++ b/Lib/gzip.py
@@ -62,6 +62,7 @@
         raise TypeError("filename must be a str or bytes object, or a file")
 
     if "t" in mode:
+        encoding = io.text_encoding(encoding)
         return io.TextIOWrapper(binary_file, encoding, errors, newline)
     else:
         return binary_file
@@ -277,7 +278,7 @@
         if self.fileobj is None:
             raise ValueError("write() on closed GzipFile object")
 
-        if isinstance(data, bytes):
+        if isinstance(data, (bytes, bytearray)):
             length = len(data)
         else:
             # accept any data that supports the buffer protocol
@@ -516,7 +517,7 @@
 
     def _read_eof(self):
         # We've read to the end of the file
-        # We check the that the computed CRC and size of the
+        # We check that the computed CRC and size of the
         # uncompressed data matches the stored values.  Note that the size
         # stored is the true file size mod 2**32.
         crc32, isize = struct.unpack("<II", self._read_exact(8))
@@ -583,8 +584,7 @@
                 g = sys.stdout.buffer
             else:
                 if arg[-3:] != ".gz":
-                    print("filename doesn't end in .gz:", repr(arg))
-                    continue
+                    sys.exit(f"filename doesn't end in .gz: {arg!r}")
                 f = open(arg, "rb")
                 g = builtins.open(arg[:-3], "wb")
         else:
@@ -596,7 +596,7 @@
                 f = builtins.open(arg, "rb")
                 g = open(arg + ".gz", "wb")
         while True:
-            chunk = f.read(1024)
+            chunk = f.read(io.DEFAULT_BUFFER_SIZE)
             if not chunk:
                 break
             g.write(chunk)
diff --git a/Lib/hashlib.py b/Lib/hashlib.py
index 58c340d..21a73f3 100644
--- a/Lib/hashlib.py
+++ b/Lib/hashlib.py
@@ -173,6 +173,7 @@
     algorithms_available = algorithms_available.union(
             _hashlib.openssl_md_meth_names)
 except ImportError:
+    _hashlib = None
     new = __py_new
     __get_hash = __get_builtin_constructor
 
@@ -180,6 +181,7 @@
     # OpenSSL's PKCS5_PBKDF2_HMAC requires OpenSSL 1.0+ with HMAC and SHA
     from _hashlib import pbkdf2_hmac
 except ImportError:
+    from warnings import warn as _warn
     _trans_5C = bytes((x ^ 0x5C) for x in range(256))
     _trans_36 = bytes((x ^ 0x36) for x in range(256))
 
@@ -190,6 +192,11 @@
         as OpenSSL's PKCS5_PBKDF2_HMAC for short passwords and much faster
         for long passwords.
         """
+        _warn(
+            "Python implementation of pbkdf2_hmac() is deprecated.",
+            category=DeprecationWarning,
+            stacklevel=2
+        )
         if not isinstance(hash_name, str):
             raise TypeError(hash_name)
 
diff --git a/Lib/hmac.py b/Lib/hmac.py
index 180bc37..8b4f920 100644
--- a/Lib/hmac.py
+++ b/Lib/hmac.py
@@ -8,11 +8,12 @@
     import _hashlib as _hashopenssl
 except ImportError:
     _hashopenssl = None
-    _openssl_md_meths = None
+    _functype = None
     from _operator import _compare_digest as compare_digest
 else:
-    _openssl_md_meths = frozenset(_hashopenssl.openssl_md_meth_names)
     compare_digest = _hashopenssl.compare_digest
+    _functype = type(_hashopenssl.openssl_sha256)  # builtin type
+
 import hashlib as _hashlib
 
 trans_5C = bytes((x ^ 0x5C) for x in range(256))
@@ -23,7 +24,6 @@
 digest_size = None
 
 
-
 class HMAC:
     """RFC 2104 HMAC class.  Also complies with RFC 4231.
 
@@ -32,7 +32,7 @@
     blocksize = 64  # 512-bit HMAC; can be changed in subclasses.
 
     __slots__ = (
-        "_digest_cons", "_inner", "_outer", "block_size", "digest_size"
+        "_hmac", "_inner", "_outer", "block_size", "digest_size"
     )
 
     def __init__(self, key, msg=None, digestmod=''):
@@ -55,15 +55,30 @@
         if not digestmod:
             raise TypeError("Missing required parameter 'digestmod'.")
 
-        if callable(digestmod):
-            self._digest_cons = digestmod
-        elif isinstance(digestmod, str):
-            self._digest_cons = lambda d=b'': _hashlib.new(digestmod, d)
+        if _hashopenssl and isinstance(digestmod, (str, _functype)):
+            try:
+                self._init_hmac(key, msg, digestmod)
+            except _hashopenssl.UnsupportedDigestmodError:
+                self._init_old(key, msg, digestmod)
         else:
-            self._digest_cons = lambda d=b'': digestmod.new(d)
+            self._init_old(key, msg, digestmod)
 
-        self._outer = self._digest_cons()
-        self._inner = self._digest_cons()
+    def _init_hmac(self, key, msg, digestmod):
+        self._hmac = _hashopenssl.hmac_new(key, msg, digestmod=digestmod)
+        self.digest_size = self._hmac.digest_size
+        self.block_size = self._hmac.block_size
+
+    def _init_old(self, key, msg, digestmod):
+        if callable(digestmod):
+            digest_cons = digestmod
+        elif isinstance(digestmod, str):
+            digest_cons = lambda d=b'': _hashlib.new(digestmod, d)
+        else:
+            digest_cons = lambda d=b'': digestmod.new(d)
+
+        self._hmac = None
+        self._outer = digest_cons()
+        self._inner = digest_cons()
         self.digest_size = self._inner.digest_size
 
         if hasattr(self._inner, 'block_size'):
@@ -79,13 +94,13 @@
                            RuntimeWarning, 2)
             blocksize = self.blocksize
 
+        if len(key) > blocksize:
+            key = digest_cons(key).digest()
+
         # self.blocksize is the default blocksize. self.block_size is
         # effective block size as well as the public API attribute.
         self.block_size = blocksize
 
-        if len(key) > blocksize:
-            key = self._digest_cons(key).digest()
-
         key = key.ljust(blocksize, b'\0')
         self._outer.update(key.translate(trans_5C))
         self._inner.update(key.translate(trans_36))
@@ -94,23 +109,15 @@
 
     @property
     def name(self):
-        return "hmac-" + self._inner.name
-
-    @property
-    def digest_cons(self):
-        return self._digest_cons
-
-    @property
-    def inner(self):
-        return self._inner
-
-    @property
-    def outer(self):
-        return self._outer
+        if self._hmac:
+            return self._hmac.name
+        else:
+            return f"hmac-{self._inner.name}"
 
     def update(self, msg):
         """Feed data from msg into this hashing object."""
-        self._inner.update(msg)
+        inst = self._hmac or self._inner
+        inst.update(msg)
 
     def copy(self):
         """Return a separate copy of this hashing object.
@@ -119,10 +126,14 @@
         """
         # Call __new__ directly to avoid the expensive __init__.
         other = self.__class__.__new__(self.__class__)
-        other._digest_cons = self._digest_cons
         other.digest_size = self.digest_size
-        other._inner = self._inner.copy()
-        other._outer = self._outer.copy()
+        if self._hmac:
+            other._hmac = self._hmac.copy()
+            other._inner = other._outer = None
+        else:
+            other._hmac = None
+            other._inner = self._inner.copy()
+            other._outer = self._outer.copy()
         return other
 
     def _current(self):
@@ -130,9 +141,12 @@
 
         To be used only internally with digest() and hexdigest().
         """
-        h = self._outer.copy()
-        h.update(self._inner.digest())
-        return h
+        if self._hmac:
+            return self._hmac
+        else:
+            h = self._outer.copy()
+            h.update(self._inner.digest())
+            return h
 
     def digest(self):
         """Return the hash value of this hashing object.
@@ -179,9 +193,11 @@
             A hashlib constructor returning a new hash object. *OR*
             A module supporting PEP 247.
     """
-    if (_hashopenssl is not None and
-            isinstance(digest, str) and digest in _openssl_md_meths):
-        return _hashopenssl.hmac_digest(key, msg, digest)
+    if _hashopenssl is not None and isinstance(digest, (str, _functype)):
+        try:
+            return _hashopenssl.hmac_digest(key, msg, digest)
+        except _hashopenssl.UnsupportedDigestmodError:
+            pass
 
     if callable(digest):
         digest_cons = digest
diff --git a/Lib/html/parser.py b/Lib/html/parser.py
index 6083077..58f6bb3 100644
--- a/Lib/html/parser.py
+++ b/Lib/html/parser.py
@@ -46,7 +46,7 @@
           |"[^"]*"                   # LIT-enclosed value
           |(?!['"])[^>\s]*           # bare value
          )
-         (?:\s*,)*                   # possibly followed by a comma
+        \s*                          # possibly followed by a space
        )?(?:\s|/(?!>))*
      )*
    )?
@@ -405,7 +405,7 @@
             tagname = namematch.group(1).lower()
             # consume and ignore other stuff between the name and the >
             # Note: this is not 100% correct, since we might have things like
-            # </tag attr=">">, but looking for > after tha name should cover
+            # </tag attr=">">, but looking for > after the name should cover
             # most of the cases and is much simpler
             gtpos = rawdata.find('>', namematch.end())
             self.handle_endtag(tagname)
diff --git a/Lib/http/__init__.py b/Lib/http/__init__.py
index 37be765..bf8d7d6 100644
--- a/Lib/http/__init__.py
+++ b/Lib/http/__init__.py
@@ -2,6 +2,7 @@
 
 __all__ = ['HTTPStatus']
 
+
 class HTTPStatus(IntEnum):
     """HTTP status codes and reason phrases
 
diff --git a/Lib/http/client.py b/Lib/http/client.py
index c2ad047..a6ab135 100644
--- a/Lib/http/client.py
+++ b/Lib/http/client.py
@@ -70,10 +70,12 @@
 
 import email.parser
 import email.message
+import errno
 import http
 import io
 import re
 import socket
+import sys
 import collections.abc
 from urllib.parse import urlsplit
 
@@ -201,15 +203,11 @@
                 lst.append(line)
         return lst
 
-def parse_headers(fp, _class=HTTPMessage):
-    """Parses only RFC2822 headers from a file pointer.
+def _read_headers(fp):
+    """Reads potential header lines into a list from a file pointer.
 
-    email Parser wants to see strings rather than bytes.
-    But a TextIOWrapper around self.rfile would buffer too many bytes
-    from the stream, bytes which we later need to read as bytes.
-    So we read the correct bytes here, as bytes, for email Parser
-    to parse.
-
+    Length of line is limited by _MAXLINE, and number of
+    headers is limited by _MAXHEADERS.
     """
     headers = []
     while True:
@@ -221,6 +219,19 @@
             raise HTTPException("got more than %d headers" % _MAXHEADERS)
         if line in (b'\r\n', b'\n', b''):
             break
+    return headers
+
+def parse_headers(fp, _class=HTTPMessage):
+    """Parses only RFC2822 headers from a file pointer.
+
+    email Parser wants to see strings rather than bytes.
+    But a TextIOWrapper around self.rfile would buffer too many bytes
+    from the stream, bytes which we later need to read as bytes.
+    So we read the correct bytes here, as bytes, for email Parser
+    to parse.
+
+    """
+    headers = _read_headers(fp)
     hstring = b''.join(headers).decode('iso-8859-1')
     return email.parser.Parser(_class=_class).parsestr(hstring)
 
@@ -308,15 +319,10 @@
             if status != CONTINUE:
                 break
             # skip the header from the 100 response
-            while True:
-                skip = self.fp.readline(_MAXLINE + 1)
-                if len(skip) > _MAXLINE:
-                    raise LineTooLong("header line")
-                skip = skip.strip()
-                if not skip:
-                    break
-                if self.debuglevel > 0:
-                    print("header:", skip)
+            skipped_headers = _read_headers(self.fp)
+            if self.debuglevel > 0:
+                print("headers:", skipped_headers)
+            del skipped_headers
 
         self.code = self.status = status
         self.reason = reason.strip()
@@ -349,9 +355,6 @@
         # NOTE: RFC 2616, S4.4, #3 says we ignore this if tr_enc is "chunked"
         self.length = None
         length = self.headers.get("content-length")
-
-         # are we using the chunked-style of transfer encoding?
-        tr_enc = self.headers.get("transfer-encoding")
         if length and not self.chunked:
             try:
                 self.length = int(length)
@@ -452,18 +455,25 @@
             self._close_conn()
             return b""
 
+        if self.chunked:
+            return self._read_chunked(amt)
+
         if amt is not None:
-            # Amount is given, implement using readinto
-            b = bytearray(amt)
-            n = self.readinto(b)
-            return memoryview(b)[:n].tobytes()
+            if self.length is not None and amt > self.length:
+                # clip the read to the "end of response"
+                amt = self.length
+            s = self.fp.read(amt)
+            if not s and amt:
+                # Ideally, we would raise IncompleteRead if the content-length
+                # wasn't satisfied, but it might break compatibility.
+                self._close_conn()
+            elif self.length is not None:
+                self.length -= len(s)
+                if not self.length:
+                    self._close_conn()
+            return s
         else:
             # Amount is not given (unbounded read) so we must check self.length
-            # and self.chunked
-
-            if self.chunked:
-                return self._readall_chunked()
-
             if self.length is None:
                 s = self.fp.read()
             else:
@@ -564,7 +574,7 @@
             self.chunk_left = chunk_left
         return chunk_left
 
-    def _readall_chunked(self):
+    def _read_chunked(self, amt=None):
         assert self.chunked != _UNKNOWN
         value = []
         try:
@@ -572,7 +582,15 @@
                 chunk_left = self._get_chunk_left()
                 if chunk_left is None:
                     break
+
+                if amt is not None and amt <= chunk_left:
+                    value.append(self._safe_read(amt))
+                    self.chunk_left = chunk_left - amt
+                    break
+
                 value.append(self._safe_read(chunk_left))
+                if amt is not None:
+                    amt -= chunk_left
                 self.chunk_left = 0
             return b''.join(value)
         except IncompleteRead:
@@ -846,7 +864,7 @@
         the endpoint passed to `set_tunnel`. This done by sending an HTTP
         CONNECT request to the proxy server when the connection is established.
 
-        This method must be called before the HTML connection has been
+        This method must be called before the HTTP connection has been
         established.
 
         The headers argument should be a mapping of extra HTTP headers to send
@@ -886,23 +904,24 @@
         self.debuglevel = level
 
     def _tunnel(self):
-        connect_str = "CONNECT %s:%d HTTP/1.0\r\n" % (self._tunnel_host,
-            self._tunnel_port)
-        connect_bytes = connect_str.encode("ascii")
-        self.send(connect_bytes)
+        connect = b"CONNECT %s:%d HTTP/1.0\r\n" % (
+            self._tunnel_host.encode("ascii"), self._tunnel_port)
+        headers = [connect]
         for header, value in self._tunnel_headers.items():
-            header_str = "%s: %s\r\n" % (header, value)
-            header_bytes = header_str.encode("latin-1")
-            self.send(header_bytes)
-        self.send(b'\r\n')
+            headers.append(f"{header}: {value}\r\n".encode("latin-1"))
+        headers.append(b"\r\n")
+        # Making a single send() call instead of one per line encourages
+        # the host OS to use a more optimal packet size instead of
+        # potentially emitting a series of small packets.
+        self.send(b"".join(headers))
+        del headers
 
         response = self.response_class(self.sock, method=self._method)
         (version, code, message) = response._read_status()
 
         if code != http.HTTPStatus.OK:
             self.close()
-            raise OSError("Tunnel connection failed: %d %s" % (code,
-                                                               message.strip()))
+            raise OSError(f"Tunnel connection failed: {code} {message.strip()}")
         while True:
             line = response.fp.readline(_MAXLINE + 1)
             if len(line) > _MAXLINE:
@@ -918,9 +937,15 @@
 
     def connect(self):
         """Connect to the host and port specified in __init__."""
+        sys.audit("http.client.connect", self, self.host, self.port)
         self.sock = self._create_connection(
             (self.host,self.port), self.timeout, self.source_address)
-        self.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
+        # Might fail in OSs that don't implement TCP_NODELAY
+        try:
+             self.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
+        except OSError as e:
+            if e.errno != errno.ENOPROTOOPT:
+                raise
 
         if self._tunnel_host:
             self._tunnel()
@@ -965,8 +990,10 @@
                     break
                 if encode:
                     datablock = datablock.encode("iso-8859-1")
+                sys.audit("http.client.send", self, datablock)
                 self.sock.sendall(datablock)
             return
+        sys.audit("http.client.send", self, data)
         try:
             self.sock.sendall(data)
         except TypeError:
@@ -1392,6 +1419,9 @@
             self.cert_file = cert_file
             if context is None:
                 context = ssl._create_default_https_context()
+                # send ALPN extension to indicate HTTP/1.1 protocol
+                if self._http_vsn == 11:
+                    context.set_alpn_protocols(['http/1.1'])
                 # enable PHA for TLS 1.3 connections if available
                 if context.post_handshake_auth is not None:
                     context.post_handshake_auth = True
diff --git a/Lib/http/cookiejar.py b/Lib/http/cookiejar.py
index 47ed5c3..eaa76c2 100644
--- a/Lib/http/cookiejar.py
+++ b/Lib/http/cookiejar.py
@@ -50,10 +50,18 @@
         logger = logging.getLogger("http.cookiejar")
     return logger.debug(*args)
 
-
+HTTPONLY_ATTR = "HTTPOnly"
+HTTPONLY_PREFIX = "#HttpOnly_"
 DEFAULT_HTTP_PORT = str(http.client.HTTP_PORT)
+NETSCAPE_MAGIC_RGX = re.compile("#( Netscape)? HTTP Cookie File")
 MISSING_FILENAME_TEXT = ("a filename was not supplied (nor was the CookieJar "
                          "instance initialised with one)")
+NETSCAPE_HEADER_TEXT =  """\
+# Netscape HTTP Cookie File
+# http://curl.haxx.se/rfc/cookie_spec.html
+# This is a generated file!  Do not edit.
+
+"""
 
 def _warn_unhandled_exception():
     # There are a few catch-all except: statements in this module, for
@@ -2004,19 +2012,11 @@
     header by default (Mozilla can cope with that).
 
     """
-    magic_re = re.compile("#( Netscape)? HTTP Cookie File")
-    header = """\
-# Netscape HTTP Cookie File
-# http://curl.haxx.se/rfc/cookie_spec.html
-# This is a generated file!  Do not edit.
-
-"""
 
     def _really_load(self, f, filename, ignore_discard, ignore_expires):
         now = time.time()
 
-        magic = f.readline()
-        if not self.magic_re.search(magic):
+        if not NETSCAPE_MAGIC_RGX.match(f.readline()):
             raise LoadError(
                 "%r does not look like a Netscape format cookies file" %
                 filename)
@@ -2024,8 +2024,17 @@
         try:
             while 1:
                 line = f.readline()
+                rest = {}
+
                 if line == "": break
 
+                # httponly is a cookie flag as defined in rfc6265
+                # when encoded in a netscape cookie file,
+                # the line is prepended with "#HttpOnly_"
+                if line.startswith(HTTPONLY_PREFIX):
+                    rest[HTTPONLY_ATTR] = ""
+                    line = line[len(HTTPONLY_PREFIX):]
+
                 # last field may be absent, so keep any trailing tab
                 if line.endswith("\n"): line = line[:-1]
 
@@ -2063,7 +2072,7 @@
                            discard,
                            None,
                            None,
-                           {})
+                           rest)
                 if not ignore_discard and c.discard:
                     continue
                 if not ignore_expires and c.is_expired(now):
@@ -2083,16 +2092,17 @@
             else: raise ValueError(MISSING_FILENAME_TEXT)
 
         with open(filename, "w") as f:
-            f.write(self.header)
+            f.write(NETSCAPE_HEADER_TEXT)
             now = time.time()
             for cookie in self:
+                domain = cookie.domain
                 if not ignore_discard and cookie.discard:
                     continue
                 if not ignore_expires and cookie.is_expired(now):
                     continue
                 if cookie.secure: secure = "TRUE"
                 else: secure = "FALSE"
-                if cookie.domain.startswith("."): initial_dot = "TRUE"
+                if domain.startswith("."): initial_dot = "TRUE"
                 else: initial_dot = "FALSE"
                 if cookie.expires is not None:
                     expires = str(cookie.expires)
@@ -2107,7 +2117,9 @@
                 else:
                     name = cookie.name
                     value = cookie.value
+                if cookie.has_nonstandard_attr(HTTPONLY_ATTR):
+                    domain = HTTPONLY_PREFIX + domain
                 f.write(
-                    "\t".join([cookie.domain, initial_dot, cookie.path,
+                    "\t".join([domain, initial_dot, cookie.path,
                                secure, expires, name, value])+
                     "\n")
diff --git a/Lib/http/server.py b/Lib/http/server.py
index def05f4..58abadf 100644
--- a/Lib/http/server.py
+++ b/Lib/http/server.py
@@ -103,8 +103,6 @@
 import sys
 import time
 import urllib.parse
-import contextlib
-from functools import partial
 
 from http import HTTPStatus
 
@@ -414,7 +412,7 @@
             method = getattr(self, mname)
             method()
             self.wfile.flush() #actually send the response if not already done.
-        except socket.timeout as e:
+        except TimeoutError as e:
             #a read or a write timed out.  Discard this connection
             self.log_error("Request timed out: %r", e)
             self.close_connection = True
@@ -689,6 +687,7 @@
                              parts[3], parts[4])
                 new_url = urllib.parse.urlunsplit(new_parts)
                 self.send_header("Location", new_url)
+                self.send_header("Content-Length", "0")
                 self.end_headers()
                 return None
             for index in "index.html", "index.htm":
@@ -1092,8 +1091,7 @@
         env['PATH_INFO'] = uqrest
         env['PATH_TRANSLATED'] = self.translate_path(uqrest)
         env['SCRIPT_NAME'] = scriptname
-        if query:
-            env['QUERY_STRING'] = query
+        env['QUERY_STRING'] = query
         env['REMOTE_ADDR'] = self.client_address[0]
         authorization = self.headers.get("authorization")
         if authorization:
@@ -1239,7 +1237,6 @@
 
     """
     ServerClass.address_family, addr = _get_best_family(bind, port)
-
     HandlerClass.protocol_version = protocol
     with ServerClass(addr, HandlerClass) as httpd:
         host, port = httpd.socket.getsockname()[:2]
@@ -1256,29 +1253,29 @@
 
 if __name__ == '__main__':
     import argparse
+    import contextlib
 
     parser = argparse.ArgumentParser()
     parser.add_argument('--cgi', action='store_true',
-                       help='Run as CGI Server')
+                        help='run as CGI server')
     parser.add_argument('--bind', '-b', metavar='ADDRESS',
-                        help='Specify alternate bind address '
-                             '[default: all interfaces]')
+                        help='specify alternate bind address '
+                             '(default: all interfaces)')
     parser.add_argument('--directory', '-d', default=os.getcwd(),
-                        help='Specify alternative directory '
-                        '[default:current directory]')
-    parser.add_argument('port', action='store',
-                        default=8000, type=int,
+                        help='specify alternate directory '
+                             '(default: current directory)')
+    parser.add_argument('port', action='store', default=8000, type=int,
                         nargs='?',
-                        help='Specify alternate port [default: 8000]')
+                        help='specify alternate port (default: 8000)')
     args = parser.parse_args()
     if args.cgi:
         handler_class = CGIHTTPRequestHandler
     else:
-        handler_class = partial(SimpleHTTPRequestHandler,
-                                directory=args.directory)
+        handler_class = SimpleHTTPRequestHandler
 
     # ensure dual-stack is not disabled; ref #38907
     class DualStackServer(ThreadingHTTPServer):
+
         def server_bind(self):
             # suppress exception when protocol is IPv4
             with contextlib.suppress(Exception):
@@ -1286,6 +1283,10 @@
                     socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 0)
             return super().server_bind()
 
+        def finish_request(self, request, client_address):
+            self.RequestHandlerClass(request, client_address, self,
+                                     directory=args.directory)
+
     test(
         HandlerClass=handler_class,
         ServerClass=DualStackServer,
diff --git a/Lib/idlelib/ChangeLog b/Lib/idlelib/ChangeLog
index d7d7e1e..c8960cf 100644
--- a/Lib/idlelib/ChangeLog
+++ b/Lib/idlelib/ChangeLog
@@ -1175,7 +1175,7 @@
 	    classes in selected module
 	    methods of selected class
 
-	Sinlge clicking in a directory, module or class item updates the next
+	Single clicking in a directory, module or class item updates the next
 	column with info about the selected item.  Double clicking in a
 	module, class or method item opens the file (and selects the clicked
 	item if it is a class or method).
diff --git a/Lib/idlelib/Icons/idle_16.gif b/Lib/idlelib/Icons/idle_16.gif
index 9f001b1..bcedcd6 100644
--- a/Lib/idlelib/Icons/idle_16.gif
+++ b/Lib/idlelib/Icons/idle_16.gif
Binary files differ
diff --git a/Lib/idlelib/Icons/idle_16.png b/Lib/idlelib/Icons/idle_16.png
index 6abde0a..77d8f71 100644
--- a/Lib/idlelib/Icons/idle_16.png
+++ b/Lib/idlelib/Icons/idle_16.png
Binary files differ
diff --git a/Lib/idlelib/Icons/idle_256.png b/Lib/idlelib/Icons/idle_256.png
index 99ffa6f..64f276b 100644
--- a/Lib/idlelib/Icons/idle_256.png
+++ b/Lib/idlelib/Icons/idle_256.png
Binary files differ
diff --git a/Lib/idlelib/Icons/idle_32.gif b/Lib/idlelib/Icons/idle_32.gif
index af5b2d5..a1b12a0 100644
--- a/Lib/idlelib/Icons/idle_32.gif
+++ b/Lib/idlelib/Icons/idle_32.gif
Binary files differ
diff --git a/Lib/idlelib/Icons/idle_32.png b/Lib/idlelib/Icons/idle_32.png
index 41b70db..2aaa558 100644
--- a/Lib/idlelib/Icons/idle_32.png
+++ b/Lib/idlelib/Icons/idle_32.png
Binary files differ
diff --git a/Lib/idlelib/Icons/idle_48.png b/Lib/idlelib/Icons/idle_48.png
index e5fa928..705eec4 100644
--- a/Lib/idlelib/Icons/idle_48.png
+++ b/Lib/idlelib/Icons/idle_48.png
Binary files differ
diff --git a/Lib/idlelib/Icons/minusnode.gif b/Lib/idlelib/Icons/minusnode.gif
index c72e46f..173e970 100644
--- a/Lib/idlelib/Icons/minusnode.gif
+++ b/Lib/idlelib/Icons/minusnode.gif
Binary files differ
diff --git a/Lib/idlelib/Icons/plusnode.gif b/Lib/idlelib/Icons/plusnode.gif
index 13ace90..abedde0 100644
--- a/Lib/idlelib/Icons/plusnode.gif
+++ b/Lib/idlelib/Icons/plusnode.gif
Binary files differ
diff --git a/Lib/idlelib/Icons/python.gif b/Lib/idlelib/Icons/python.gif
index b189c2c..01b13e3 100644
--- a/Lib/idlelib/Icons/python.gif
+++ b/Lib/idlelib/Icons/python.gif
Binary files differ
diff --git a/Lib/idlelib/Icons/tk.gif b/Lib/idlelib/Icons/tk.gif
index a603f5e..03bf383 100644
--- a/Lib/idlelib/Icons/tk.gif
+++ b/Lib/idlelib/Icons/tk.gif
Binary files differ
diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt
index 869be0a..424e971 100644
--- a/Lib/idlelib/NEWS.txt
+++ b/Lib/idlelib/NEWS.txt
@@ -1,20 +1,111 @@
-What's New in IDLE 3.9.1
-Released on 2020-12-07?
-======================================
+What's New in IDLE 3.10.z
+after 3.10.0 until 3.10.?
+Released on 2022-05-16
+=========================
 
 
+bpo-28950: Apply IDLE syntax highlighting to `.pyi` files.  Add util.py
+for common components.  Patch by Alex Waygood and Terry Jan Reedy.
+
+bpo-46630: Make query dialogs on Windows start with a cursor in the
+entry box.
+
+bpo-46591: Make the IDLE doc URL on the About IDLE dialog clickable.
+
+bpo-45296: Clarify close, quit, and exit in IDLE.  In the File menu,
+'Close' and 'Exit' are now 'Close Window' (the current one) and 'Exit'
+is now 'Exit IDLE' (by closing all windows).  In Shell, 'quit()' and
+'exit()' mean 'close Shell'.  If there are no other windows,
+this also exits IDLE.
+
+bpo-45495: Add context keywords 'case' and 'match' to completions list.
+
+bpo-45296: On Windows, change exit/quit message to suggest Ctrl-D, which
+works, instead of <Ctrl-Z Return>, which does not work in IDLE.
+
+
+What's New in IDLE 3.10.0
+(since 3.9.0)
+Released on 2021-10-04
+=========================
+
+
+bpo-40128: Mostly fix completions on macOS when not using tcl/tk 8.6.11
+(as with 3.9).
+
+bpo-33962: Move the indent space setting from the Font tab to the new Windows
+tab. Patch by Mark Roseman and Terry Jan Reedy.
+
+bpo-40468: Split the settings dialog General tab into Windows and Shell/Ed
+tabs. Move help sources, which extend the Help menu, to the Extensions tab.
+Make space for new options and shorten the dialog. The latter makes the
+dialog better fit small screens.
+
+bpo-44010: Highlight the new match statement's soft keywords: match, case,
+and _. This highlighting is not perfect and will be incorrect in some rare
+cases, especially for some _s in case patterns.
+
+bpo-44026: Include interpreter's typo fix suggestions in message line
+for NameErrors and AttributeErrors.  Patch by E. Paine.
+
+bpo-41611: Avoid occasional uncaught exceptions and freezing when using
+completions on macOS.
+
+bpo-37903: Add mouse actions to the shell sidebar.  Left click and
+optional drag selects one or more lines of text, as with the
+editor line number sidebar.  Right click after selecting text lines
+displays a context menu with 'copy with prompts'.  This zips together
+prompts from the sidebar with lines from the selected text.  This option
+also appears on the context menu for the text.
+
+bpo-43981: Fix reference leaks in test_sidebar and test_squeezer.
+Patches by Terry Jan Reedy and Pablo Galindo
+
+bpo-37892: Change Shell input indents from tabs to spaces.  Shell input
+now 'looks right'.  Making this feasible motivated the shell sidebar.
+
+bpo-37903: Move the Shell input prompt to a side bar.
+
+bpo-43655: Make window managers on macOS and X Window recognize
+IDLE dialog windows as dialogs.
+
+bpo-42225: Document that IDLE can fail on Unix either from misconfigured IP
+masquerade rules or failure displaying complex colored (non-ascii) characters.
+
+bpo-43283: Document why printing to IDLE's Shell is often slower than
+printing to a system terminal and that it can be made faster by
+pre-formatting a single string before printing.
+
+bpo-23544: Disable Debug=>Stack Viewer when user code is running or
+Debugger is active, to prevent hang or crash.  Patch by Zackery Spytz.
+
+bpo-43008: Make IDLE invoke :func:`sys.excepthook` in normal,
+2-process mode.  User hooks were previously ignored.
+Patch by Ken Hilton.
+
+bpo-33065: Fix problem debugging user classes with __repr__ method.
+
+bpo-32631: Finish zzdummy example extension module: make menu entries
+work; add docstrings and tests with 100% coverage.
+
 bpo-42508: Keep IDLE running on macOS.  Remove obsolete workaround
 that prevented running files with shortcuts when using new universal2
 installers built on macOS 11.
 
 bpo-42426: Fix reporting offset of the RE error in searchengine.
 
-bpo-42416: Get docstrings for IDLE calltips more often
+bpo-42416: Display docstrings in IDLE calltips in more cases,
 by using inspect.getdoc.
 
 bpo-33987: Mostly finish using ttk widgets, mainly for editor,
 settings, and searches.  Some patches by Mark Roseman.
 
+bpo-40511: Stop unnecessary "flashing" when typing opening and closing
+parentheses inside the parentheses of a function call.
+
+bpo-38439: Add a 256x256 pixel IDLE icon to the Windows .ico file. Created by
+Andrew Clover. Remove the low-color gif variations from the .ico file.
+
 bpo-41775: Make 'IDLE Shell' the shell title.
 
 bpo-35764: Rewrite the Calltips doc section.
diff --git a/Lib/idlelib/README.txt b/Lib/idlelib/README.txt
index bc3d978..8870fda 100644
--- a/Lib/idlelib/README.txt
+++ b/Lib/idlelib/README.txt
@@ -82,6 +82,7 @@
 textview.py       # Define read-only text widget (nim).
 tree.py           # Define tree widget, used in browsers (nim).
 undo.py           # Manage undo stack.
+util.py           # Define objects imported elsewhere with no dependencies (nim)
 windows.py        # Manage window list and define listed top level.
 zoomheight.py     # Zoom window to full height of screen.
 
diff --git a/Lib/idlelib/autocomplete.py b/Lib/idlelib/autocomplete.py
index e1e9e17..032d312 100644
--- a/Lib/idlelib/autocomplete.py
+++ b/Lib/idlelib/autocomplete.py
@@ -9,6 +9,12 @@
 import string
 import sys
 
+# Modified keyword list is used in fetch_completions.
+completion_kwds = [s for s in keyword.kwlist
+                     if s not in {'True', 'False', 'None'}]  # In builtins.
+completion_kwds.extend(('match', 'case'))  # Context keywords.
+completion_kwds.sort()
+
 # Two types of completions; defined here for autocomplete_w import below.
 ATTRS, FILES = 0, 1
 from idlelib import autocomplete_w
@@ -31,10 +37,11 @@
 
 class AutoComplete:
 
-    def __init__(self, editwin=None):
+    def __init__(self, editwin=None, tags=None):
         self.editwin = editwin
         if editwin is not None:   # not in subprocess or no-gui test
             self.text = editwin.text
+        self.tags = tags
         self.autocompletewindow = None
         # id of delayed call, and the index of the text insert when
         # the delayed call was issued. If _delayed_completion_id is
@@ -48,7 +55,7 @@
             "extensions", "AutoComplete", "popupwait", type="int", default=0)
 
     def _make_autocomplete_window(self):  # Makes mocking easier.
-        return autocomplete_w.AutoCompleteWindow(self.text)
+        return autocomplete_w.AutoCompleteWindow(self.text, tags=self.tags)
 
     def _remove_autocomplete_window(self, event=None):
         if self.autocompletewindow:
@@ -176,9 +183,7 @@
                     namespace = {**__main__.__builtins__.__dict__,
                                  **__main__.__dict__}
                     bigl = eval("dir()", namespace)
-                    kwds = (s for s in keyword.kwlist
-                            if s not in {'True', 'False', 'None'})
-                    bigl.extend(kwds)
+                    bigl.extend(completion_kwds)
                     bigl.sort()
                     if "__all__" in bigl:
                         smalll = sorted(eval("__all__", namespace))
diff --git a/Lib/idlelib/autocomplete_w.py b/Lib/idlelib/autocomplete_w.py
index fe7a6be..0f835a9 100644
--- a/Lib/idlelib/autocomplete_w.py
+++ b/Lib/idlelib/autocomplete_w.py
@@ -26,9 +26,11 @@
 
 class AutoCompleteWindow:
 
-    def __init__(self, widget):
+    def __init__(self, widget, tags):
         # The widget (Text) on which we place the AutoCompleteWindow
         self.widget = widget
+        # Tags to mark inserted text with
+        self.tags = tags
         # The widgets we create
         self.autocompletewindow = self.listbox = self.scrollbar = None
         # The default foreground and background of a selection. Saved because
@@ -69,7 +71,8 @@
                                "%s+%dc" % (self.startindex, len(self.start)))
         if i < len(newstart):
             self.widget.insert("%s+%dc" % (self.startindex, i),
-                               newstart[i:])
+                               newstart[i:],
+                               self.tags)
         self.start = newstart
 
     def _binary_search(self, s):
@@ -203,6 +206,7 @@
         scrollbar.config(command=listbox.yview)
         scrollbar.pack(side=RIGHT, fill=Y)
         listbox.pack(side=LEFT, fill=BOTH, expand=True)
+        #acw.update_idletasks() # Need for tk8.6.8 on macOS: #40128.
         acw.lift()  # work around bug in Tk 8.5.18+ (issue #24570)
 
         # Initialize the listbox selection
@@ -239,31 +243,46 @@
         self.is_configuring = True
         if not self.is_active():
             return
-        # Position the completion list window
-        text = self.widget
-        text.see(self.startindex)
-        x, y, cx, cy = text.bbox(self.startindex)
-        acw = self.autocompletewindow
-        acw.update()
-        acw_width, acw_height = acw.winfo_width(), acw.winfo_height()
-        text_width, text_height = text.winfo_width(), text.winfo_height()
-        new_x = text.winfo_rootx() + min(x, max(0, text_width - acw_width))
-        new_y = text.winfo_rooty() + y
-        if (text_height - (y + cy) >= acw_height # enough height below
-            or y < acw_height): # not enough height above
-            # place acw below current line
-            new_y += cy
-        else:
-            # place acw above current line
-            new_y -= acw_height
-        acw.wm_geometry("+%d+%d" % (new_x, new_y))
-        acw.update_idletasks()
+
+        # Since the <Configure> event may occur after the completion window is gone,
+        # catch potential TclError exceptions when accessing acw.  See: bpo-41611.
+        try:
+            # Position the completion list window
+            text = self.widget
+            text.see(self.startindex)
+            x, y, cx, cy = text.bbox(self.startindex)
+            acw = self.autocompletewindow
+            if platform.system().startswith('Windows'):
+                # On Windows an update() call is needed for the completion
+                # list window to be created, so that we can fetch its width
+                # and height.  However, this is not needed on other platforms
+                # (tested on Ubuntu and macOS) but at one point began
+                # causing freezes on macOS.  See issues 37849 and 41611.
+                acw.update()
+            acw_width, acw_height = acw.winfo_width(), acw.winfo_height()
+            text_width, text_height = text.winfo_width(), text.winfo_height()
+            new_x = text.winfo_rootx() + min(x, max(0, text_width - acw_width))
+            new_y = text.winfo_rooty() + y
+            if (text_height - (y + cy) >= acw_height # enough height below
+                or y < acw_height): # not enough height above
+                # place acw below current line
+                new_y += cy
+            else:
+                # place acw above current line
+                new_y -= acw_height
+            acw.wm_geometry("+%d+%d" % (new_x, new_y))
+            acw.update_idletasks()
+        except TclError:
+            pass
 
         if platform.system().startswith('Windows'):
-            # See issue 15786. When on Windows platform, Tk will misbehave
+            # See issue 15786.  When on Windows platform, Tk will misbehave
             # to call winconfig_event multiple times, we need to prevent this,
             # otherwise mouse button double click will not be able to used.
-            acw.unbind(WINCONFIG_SEQUENCE, self.winconfigid)
+            try:
+                acw.unbind(WINCONFIG_SEQUENCE, self.winconfigid)
+            except TclError:
+                pass
             self.winconfigid = None
 
         self.is_configuring = False
diff --git a/Lib/idlelib/codecontext.py b/Lib/idlelib/codecontext.py
index 989b30e..f2f44f5 100644
--- a/Lib/idlelib/codecontext.py
+++ b/Lib/idlelib/codecontext.py
@@ -7,11 +7,14 @@
 enclosing block.  The number of hint lines is determined by the maxlines
 variable in the codecontext section of config-extensions.def. Lines which do
 not open blocks are not shown in the context hints pane.
+
+For EditorWindows, <<toggle-code-context>> is bound to CodeContext(self).
+toggle_code_context_event.
 """
 import re
 from sys import maxsize as INFINITY
 
-import tkinter
+from tkinter import Frame, Text, TclError
 from tkinter.constants import NSEW, SUNKEN
 
 from idlelib.config import idleConf
@@ -83,7 +86,7 @@
         if self.t1 is not None:
             try:
                 self.text.after_cancel(self.t1)
-            except tkinter.TclError:  # pragma: no cover
+            except TclError:  # pragma: no cover
                 pass
             self.t1 = None
 
@@ -111,7 +114,7 @@
                 padx += widget.tk.getint(info['padx'])
                 padx += widget.tk.getint(widget.cget('padx'))
                 border += widget.tk.getint(widget.cget('border'))
-            context = self.context = tkinter.Text(
+            context = self.context = Text(
                 self.editwin.text_frame,
                 height=1,
                 width=1,  # Don't request more than we get.
@@ -127,7 +130,7 @@
 
             line_number_colors = idleConf.GetHighlight(idleConf.CurrentTheme(),
                                                        'linenumber')
-            self.cell00 = tkinter.Frame(self.editwin.text_frame,
+            self.cell00 = Frame(self.editwin.text_frame,
                                         bg=line_number_colors['background'])
             self.cell00.grid(row=0, column=0, sticky=NSEW)
             menu_status = 'Hide'
@@ -139,7 +142,7 @@
             self.text.after_cancel(self.t1)
             self._reset()
             menu_status = 'Show'
-        self.editwin.update_menu_label(menu='options', index='* Code Context',
+        self.editwin.update_menu_label(menu='options', index='*ode*ontext',
                                        label=f'{menu_status} Code Context')
         return "break"
 
@@ -221,7 +224,7 @@
         """
         try:
             self.context.index("sel.first")
-        except tkinter.TclError:
+        except TclError:
             lines = len(self.info)
             if lines == 1:  # No context lines are showing.
                 newtop = 1
diff --git a/Lib/idlelib/colorizer.py b/Lib/idlelib/colorizer.py
index db1266f..e9f19c1 100644
--- a/Lib/idlelib/colorizer.py
+++ b/Lib/idlelib/colorizer.py
@@ -8,15 +8,43 @@
 
 DEBUG = False
 
+
 def any(name, alternates):
     "Return a named group pattern matching list of alternates."
     return "(?P<%s>" % name + "|".join(alternates) + ")"
 
+
 def make_pat():
     kw = r"\b" + any("KEYWORD", keyword.kwlist) + r"\b"
+    match_softkw = (
+        r"^[ \t]*" +  # at beginning of line + possible indentation
+        r"(?P<MATCH_SOFTKW>match)\b" +
+        r"(?![ \t]*(?:" + "|".join([  # not followed by ...
+            r"[:,;=^&|@~)\]}]",  # a character which means it can't be a
+                                 # pattern-matching statement
+            r"\b(?:" + r"|".join(keyword.kwlist) + r")\b",  # a keyword
+        ]) +
+        r"))"
+    )
+    case_default = (
+        r"^[ \t]*" +  # at beginning of line + possible indentation
+        r"(?P<CASE_SOFTKW>case)" +
+        r"[ \t]+(?P<CASE_DEFAULT_UNDERSCORE>_\b)"
+    )
+    case_softkw_and_pattern = (
+        r"^[ \t]*" +  # at beginning of line + possible indentation
+        r"(?P<CASE_SOFTKW2>case)\b" +
+        r"(?![ \t]*(?:" + "|".join([  # not followed by ...
+            r"_\b",  # a lone underscore
+            r"[:,;=^&|@~)\]}]",  # a character which means it can't be a
+                                 # pattern-matching case
+            r"\b(?:" + r"|".join(keyword.kwlist) + r")\b",  # a keyword
+        ]) +
+        r"))"
+    )
     builtinlist = [str(name) for name in dir(builtins)
-                                        if not name.startswith('_') and \
-                                        name not in keyword.kwlist]
+                   if not name.startswith('_') and
+                   name not in keyword.kwlist]
     builtin = r"([^.'\"\\#]\b|^)" + any("BUILTIN", builtinlist) + r"\b"
     comment = any("COMMENT", [r"#[^\n]*"])
     stringprefix = r"(?i:r|u|f|fr|rf|b|br|rb)?"
@@ -25,11 +53,30 @@
     sq3string = stringprefix + r"'''[^'\\]*((\\.|'(?!''))[^'\\]*)*(''')?"
     dq3string = stringprefix + r'"""[^"\\]*((\\.|"(?!""))[^"\\]*)*(""")?'
     string = any("STRING", [sq3string, dq3string, sqstring, dqstring])
-    return kw + "|" + builtin + "|" + comment + "|" + string +\
-           "|" + any("SYNC", [r"\n"])
+    prog = re.compile("|".join([
+                                builtin, comment, string, kw,
+                                match_softkw, case_default,
+                                case_softkw_and_pattern,
+                                any("SYNC", [r"\n"]),
+                               ]),
+                      re.DOTALL | re.MULTILINE)
+    return prog
 
-prog = re.compile(make_pat(), re.S)
-idprog = re.compile(r"\s+(\w+)", re.S)
+
+prog = make_pat()
+idprog = re.compile(r"\s+(\w+)")
+prog_group_name_to_tag = {
+    "MATCH_SOFTKW": "KEYWORD",
+    "CASE_SOFTKW": "KEYWORD",
+    "CASE_DEFAULT_UNDERSCORE": "KEYWORD",
+    "CASE_SOFTKW2": "KEYWORD",
+}
+
+
+def matched_named_groups(re_match):
+    "Get only the non-empty named groups from an re.Match object."
+    return ((k, v) for (k, v) in re_match.groupdict().items() if v)
+
 
 def color_config(text):
     """Set color options of Text widget.
@@ -49,7 +96,7 @@
         selectforeground=select_colors['foreground'],
         selectbackground=select_colors['background'],
         inactiveselectbackground=select_colors['background'],  # new in 8.5
-    )
+        )
 
 
 class ColorDelegator(Delegator):
@@ -120,14 +167,16 @@
             "BUILTIN": idleConf.GetHighlight(theme, "builtin"),
             "STRING": idleConf.GetHighlight(theme, "string"),
             "DEFINITION": idleConf.GetHighlight(theme, "definition"),
-            "SYNC": {'background':None,'foreground':None},
-            "TODO": {'background':None,'foreground':None},
+            "SYNC": {'background': None, 'foreground': None},
+            "TODO": {'background': None, 'foreground': None},
             "ERROR": idleConf.GetHighlight(theme, "error"),
-            # The following is used by ReplaceDialog:
+            # "hit" is used by ReplaceDialog to mark matches. It shouldn't be changed by Colorizer, but
+            # that currently isn't technically possible. This should be moved elsewhere in the future
+            # when fixing the "hit" tag's visibility, or when the replace dialog is replaced with a
+            # non-modal alternative.
             "hit": idleConf.GetHighlight(theme, "hit"),
             }
-
-        if DEBUG: print('tagdefs',self.tagdefs)
+        if DEBUG: print('tagdefs', self.tagdefs)
 
     def insert(self, index, chars, tags=None):
         "Insert chars into widget at index and mark for colorizing."
@@ -184,8 +233,8 @@
         if self.allow_colorizing and not self.colorizing:
             self.after_id = self.after(1, self.recolorize)
         if DEBUG:
-            print("auto colorizing turned",\
-                  self.allow_colorizing and "on" or "off")
+            print("auto colorizing turned",
+                  "on" if self.allow_colorizing else "off")
         return "break"
 
     def recolorize(self):
@@ -225,17 +274,10 @@
     def recolorize_main(self):
         "Evaluate text and apply colorizing tags."
         next = "1.0"
-        while True:
-            item = self.tag_nextrange("TODO", next)
-            if not item:
-                break
-            head, tail = item
-            self.tag_remove("SYNC", head, tail)
-            item = self.tag_prevrange("SYNC", head)
-            if item:
-                head = item[1]
-            else:
-                head = "1.0"
+        while todo_tag_range := self.tag_nextrange("TODO", next):
+            self.tag_remove("SYNC", todo_tag_range[0], todo_tag_range[1])
+            sync_tag_range = self.tag_prevrange("SYNC", todo_tag_range[0])
+            head = sync_tag_range[1] if sync_tag_range else "1.0"
 
             chars = ""
             next = head
@@ -253,23 +295,8 @@
                     return
                 for tag in self.tagdefs:
                     self.tag_remove(tag, mark, next)
-                chars = chars + line
-                m = self.prog.search(chars)
-                while m:
-                    for key, value in m.groupdict().items():
-                        if value:
-                            a, b = m.span(key)
-                            self.tag_add(key,
-                                         head + "+%dc" % a,
-                                         head + "+%dc" % b)
-                            if value in ("def", "class"):
-                                m1 = self.idprog.match(chars, b)
-                                if m1:
-                                    a, b = m1.span(1)
-                                    self.tag_add("DEFINITION",
-                                                 head + "+%dc" % a,
-                                                 head + "+%dc" % b)
-                    m = self.prog.search(chars, m.end())
+                chars += line
+                self._add_tags_in_section(chars, head)
                 if "SYNC" in self.tag_names(next + "-1c"):
                     head = next
                     chars = ""
@@ -288,6 +315,40 @@
                     if DEBUG: print("colorizing stopped")
                     return
 
+    def _add_tag(self, start, end, head, matched_group_name):
+        """Add a tag to a given range in the text widget.
+
+        This is a utility function, receiving the range as `start` and
+        `end` positions, each of which is a number of characters
+        relative to the given `head` index in the text widget.
+
+        The tag to add is determined by `matched_group_name`, which is
+        the name of a regular expression "named group" as matched by
+        by the relevant highlighting regexps.
+        """
+        tag = prog_group_name_to_tag.get(matched_group_name,
+                                         matched_group_name)
+        self.tag_add(tag,
+                     f"{head}+{start:d}c",
+                     f"{head}+{end:d}c")
+
+    def _add_tags_in_section(self, chars, head):
+        """Parse and add highlighting tags to a given part of the text.
+
+        `chars` is a string with the text to parse and to which
+        highlighting is to be applied.
+
+            `head` is the index in the text widget where the text is found.
+        """
+        for m in self.prog.finditer(chars):
+            for name, matched_text in matched_named_groups(m):
+                a, b = m.span(name)
+                self._add_tag(a, b, head, name)
+                if matched_text in ("def", "class"):
+                    if m1 := self.idprog.match(chars, b):
+                        a, b = m1.span(1)
+                        self._add_tag(a, b, head, "DEFINITION")
+
     def removecolors(self):
         "Remove all colorizing tags."
         for tag in self.tagdefs:
@@ -296,27 +357,14 @@
 
 def _color_delegator(parent):  # htest #
     from tkinter import Toplevel, Text
+    from idlelib.idle_test.test_colorizer import source
     from idlelib.percolator import Percolator
 
     top = Toplevel(parent)
     top.title("Test ColorDelegator")
     x, y = map(int, parent.geometry().split('+')[1:])
-    top.geometry("700x250+%d+%d" % (x + 20, y + 175))
-    source = (
-        "if True: int ('1') # keyword, builtin, string, comment\n"
-        "elif False: print(0)\n"
-        "else: float(None)\n"
-        "if iF + If + IF: 'keyword matching must respect case'\n"
-        "if'': x or''  # valid string-keyword no-space combinations\n"
-        "async def f(): await g()\n"
-        "# All valid prefixes for unicode and byte strings should be colored.\n"
-        "'x', '''x''', \"x\", \"\"\"x\"\"\"\n"
-        "r'x', u'x', R'x', U'x', f'x', F'x'\n"
-        "fr'x', Fr'x', fR'x', FR'x', rf'x', rF'x', Rf'x', RF'x'\n"
-        "b'x',B'x', br'x',Br'x',bR'x',BR'x', rb'x', rB'x',Rb'x',RB'x'\n"
-        "# Invalid combinations of legal characters should be half colored.\n"
-        "ur'x', ru'x', uf'x', fu'x', UR'x', ufr'x', rfu'x', xf'x', fx'x'\n"
-        )
+    top.geometry("700x550+%d+%d" % (x + 20, y + 175))
+
     text = Text(top, background="white")
     text.pack(expand=1, fill="both")
     text.insert("insert", source)
diff --git a/Lib/idlelib/config_key.py b/Lib/idlelib/config_key.py
index 7510aa9..9ca3a15 100644
--- a/Lib/idlelib/config_key.py
+++ b/Lib/idlelib/config_key.py
@@ -4,6 +4,7 @@
 from tkinter import Toplevel, Listbox, StringVar, TclError
 from tkinter.ttk import Frame, Button, Checkbutton, Entry, Label, Scrollbar
 from tkinter import messagebox
+from tkinter.simpledialog import _setup_dialog
 import string
 import sys
 
@@ -63,6 +64,7 @@
         self.resizable(height=False, width=False)
         self.title(title)
         self.transient(parent)
+        _setup_dialog(self)
         self.grab_set()
         self.protocol("WM_DELETE_WINDOW", self.cancel)
         self.parent = parent
diff --git a/Lib/idlelib/configdialog.py b/Lib/idlelib/configdialog.py
index a84e1c5..6d08936 100644
--- a/Lib/idlelib/configdialog.py
+++ b/Lib/idlelib/configdialog.py
@@ -15,11 +15,12 @@
                      StringVar, BooleanVar, IntVar, TRUE, FALSE,
                      TOP, BOTTOM, RIGHT, LEFT, SOLID, GROOVE,
                      NONE, BOTH, X, Y, W, E, EW, NS, NSEW, NW,
-                     HORIZONTAL, VERTICAL, ANCHOR, ACTIVE, END)
+                     HORIZONTAL, VERTICAL, ANCHOR, ACTIVE, END, TclError)
 from tkinter.ttk import (Frame, LabelFrame, Button, Checkbutton, Entry, Label,
-                         OptionMenu, Notebook, Radiobutton, Scrollbar, Style)
-import tkinter.colorchooser as tkColorChooser
-import tkinter.font as tkFont
+                         OptionMenu, Notebook, Radiobutton, Scrollbar, Style,
+                         Spinbox, Combobox)
+from tkinter import colorchooser
+import tkinter.font as tkfont
 from tkinter import messagebox
 
 from idlelib.config import idleConf, ConfigChanges
@@ -101,8 +102,9 @@
             highpage: HighPage
             fontpage: FontPage
             keyspage: KeysPage
-            genpage: GenPage
-            extpage: self.create_page_extensions
+            winpage: WinPage
+            shedpage: ShedPage
+            extpage: ExtPage
 
         Methods:
             create_action_buttons
@@ -112,15 +114,18 @@
         self.frame = frame = Frame(self, padding="5px")
         self.frame.grid(sticky="nwes")
         self.note = note = Notebook(frame)
-        self.highpage = HighPage(note)
+        self.extpage = ExtPage(note)
+        self.highpage = HighPage(note, self.extpage)
         self.fontpage = FontPage(note, self.highpage)
-        self.keyspage = KeysPage(note)
-        self.genpage = GenPage(note)
-        self.extpage = self.create_page_extensions()
+        self.keyspage = KeysPage(note, self.extpage)
+        self.winpage = WinPage(note)
+        self.shedpage = ShedPage(note)
+
         note.add(self.fontpage, text='Fonts/Tabs')
         note.add(self.highpage, text='Highlights')
         note.add(self.keyspage, text=' Keys ')
-        note.add(self.genpage, text=' General ')
+        note.add(self.winpage, text=' Windows ')
+        note.add(self.shedpage, text=' Shell/Ed ')
         note.add(self.extpage, text='Extensions')
         note.enable_traversal()
         note.pack(side=TOP, expand=TRUE, fill=BOTH)
@@ -167,26 +172,15 @@
         return outer
 
     def ok(self):
-        """Apply config changes, then dismiss dialog.
-
-        Methods:
-            apply
-            destroy: inherited
-        """
+        """Apply config changes, then dismiss dialog."""
         self.apply()
         self.destroy()
 
     def apply(self):
-        """Apply config changes and leave dialog open.
-
-        Methods:
-            deactivate_current_config
-            save_all_changed_extensions
-            activate_config_changes
-        """
+        """Apply config changes and leave dialog open."""
         self.deactivate_current_config()
         changes.save_all()
-        self.save_all_changed_extensions()
+        self.extpage.save_all_changed_extensions()
         self.activate_config_changes()
 
     def cancel(self):
@@ -244,190 +238,6 @@
         for klass in reloadables:
             klass.reload()
 
-    def create_page_extensions(self):
-        """Part of the config dialog used for configuring IDLE extensions.
-
-        This code is generic - it works for any and all IDLE extensions.
-
-        IDLE extensions save their configuration options using idleConf.
-        This code reads the current configuration using idleConf, supplies a
-        GUI interface to change the configuration values, and saves the
-        changes using idleConf.
-
-        Not all changes take effect immediately - some may require restarting IDLE.
-        This depends on each extension's implementation.
-
-        All values are treated as text, and it is up to the user to supply
-        reasonable values. The only exception to this are the 'enable*' options,
-        which are boolean, and can be toggled with a True/False button.
-
-        Methods:
-            load_extensions:
-            extension_selected: Handle selection from list.
-            create_extension_frame: Hold widgets for one extension.
-            set_extension_value: Set in userCfg['extensions'].
-            save_all_changed_extensions: Call extension page Save().
-        """
-        parent = self.parent
-        frame = Frame(self.note)
-        self.ext_defaultCfg = idleConf.defaultCfg['extensions']
-        self.ext_userCfg = idleConf.userCfg['extensions']
-        self.is_int = self.register(is_int)
-        self.load_extensions()
-        # Create widgets - a listbox shows all available extensions, with the
-        # controls for the extension selected in the listbox to the right.
-        self.extension_names = StringVar(self)
-        frame.rowconfigure(0, weight=1)
-        frame.columnconfigure(2, weight=1)
-        self.extension_list = Listbox(frame, listvariable=self.extension_names,
-                                      selectmode='browse')
-        self.extension_list.bind('<<ListboxSelect>>', self.extension_selected)
-        scroll = Scrollbar(frame, command=self.extension_list.yview)
-        self.extension_list.yscrollcommand=scroll.set
-        self.details_frame = LabelFrame(frame, width=250, height=250)
-        self.extension_list.grid(column=0, row=0, sticky='nws')
-        scroll.grid(column=1, row=0, sticky='ns')
-        self.details_frame.grid(column=2, row=0, sticky='nsew', padx=[10, 0])
-        frame.configure(padding=10)
-        self.config_frame = {}
-        self.current_extension = None
-
-        self.outerframe = self                      # TEMPORARY
-        self.tabbed_page_set = self.extension_list  # TEMPORARY
-
-        # Create the frame holding controls for each extension.
-        ext_names = ''
-        for ext_name in sorted(self.extensions):
-            self.create_extension_frame(ext_name)
-            ext_names = ext_names + '{' + ext_name + '} '
-        self.extension_names.set(ext_names)
-        self.extension_list.selection_set(0)
-        self.extension_selected(None)
-
-        return frame
-
-    def load_extensions(self):
-        "Fill self.extensions with data from the default and user configs."
-        self.extensions = {}
-        for ext_name in idleConf.GetExtensions(active_only=False):
-            # Former built-in extensions are already filtered out.
-            self.extensions[ext_name] = []
-
-        for ext_name in self.extensions:
-            opt_list = sorted(self.ext_defaultCfg.GetOptionList(ext_name))
-
-            # Bring 'enable' options to the beginning of the list.
-            enables = [opt_name for opt_name in opt_list
-                       if opt_name.startswith('enable')]
-            for opt_name in enables:
-                opt_list.remove(opt_name)
-            opt_list = enables + opt_list
-
-            for opt_name in opt_list:
-                def_str = self.ext_defaultCfg.Get(
-                        ext_name, opt_name, raw=True)
-                try:
-                    def_obj = {'True':True, 'False':False}[def_str]
-                    opt_type = 'bool'
-                except KeyError:
-                    try:
-                        def_obj = int(def_str)
-                        opt_type = 'int'
-                    except ValueError:
-                        def_obj = def_str
-                        opt_type = None
-                try:
-                    value = self.ext_userCfg.Get(
-                            ext_name, opt_name, type=opt_type, raw=True,
-                            default=def_obj)
-                except ValueError:  # Need this until .Get fixed.
-                    value = def_obj  # Bad values overwritten by entry.
-                var = StringVar(self)
-                var.set(str(value))
-
-                self.extensions[ext_name].append({'name': opt_name,
-                                                  'type': opt_type,
-                                                  'default': def_str,
-                                                  'value': value,
-                                                  'var': var,
-                                                 })
-
-    def extension_selected(self, event):
-        "Handle selection of an extension from the list."
-        newsel = self.extension_list.curselection()
-        if newsel:
-            newsel = self.extension_list.get(newsel)
-        if newsel is None or newsel != self.current_extension:
-            if self.current_extension:
-                self.details_frame.config(text='')
-                self.config_frame[self.current_extension].grid_forget()
-                self.current_extension = None
-        if newsel:
-            self.details_frame.config(text=newsel)
-            self.config_frame[newsel].grid(column=0, row=0, sticky='nsew')
-            self.current_extension = newsel
-
-    def create_extension_frame(self, ext_name):
-        """Create a frame holding the widgets to configure one extension"""
-        f = VerticalScrolledFrame(self.details_frame, height=250, width=250)
-        self.config_frame[ext_name] = f
-        entry_area = f.interior
-        # Create an entry for each configuration option.
-        for row, opt in enumerate(self.extensions[ext_name]):
-            # Create a row with a label and entry/checkbutton.
-            label = Label(entry_area, text=opt['name'])
-            label.grid(row=row, column=0, sticky=NW)
-            var = opt['var']
-            if opt['type'] == 'bool':
-                Checkbutton(entry_area, variable=var,
-                            onvalue='True', offvalue='False', width=8
-                            ).grid(row=row, column=1, sticky=W, padx=7)
-            elif opt['type'] == 'int':
-                Entry(entry_area, textvariable=var, validate='key',
-                      validatecommand=(self.is_int, '%P'), width=10
-                      ).grid(row=row, column=1, sticky=NSEW, padx=7)
-
-            else:  # type == 'str'
-                # Limit size to fit non-expanding space with larger font.
-                Entry(entry_area, textvariable=var, width=15
-                      ).grid(row=row, column=1, sticky=NSEW, padx=7)
-        return
-
-    def set_extension_value(self, section, opt):
-        """Return True if the configuration was added or changed.
-
-        If the value is the same as the default, then remove it
-        from user config file.
-        """
-        name = opt['name']
-        default = opt['default']
-        value = opt['var'].get().strip() or default
-        opt['var'].set(value)
-        # if self.defaultCfg.has_section(section):
-        # Currently, always true; if not, indent to return.
-        if (value == default):
-            return self.ext_userCfg.RemoveOption(section, name)
-        # Set the option.
-        return self.ext_userCfg.SetOption(section, name, value)
-
-    def save_all_changed_extensions(self):
-        """Save configuration changes to the user config file.
-
-        Attributes accessed:
-            extensions
-
-        Methods:
-            set_extension_value
-        """
-        has_changes = False
-        for ext_name in self.extensions:
-            options = self.extensions[ext_name]
-            for opt in options:
-                if self.set_extension_value(ext_name, opt):
-                    has_changes = True
-        if has_changes:
-            self.ext_userCfg.Save()
-
 
 # class TabPage(Frame):  # A template for Page classes.
 #     def __init__(self, master):
@@ -480,12 +290,11 @@
     def __init__(self, master, highpage):
         super().__init__(master)
         self.highlight_sample = highpage.highlight_sample
-        self.create_page_font_tab()
+        self.create_page_font()
         self.load_font_cfg()
-        self.load_tab_cfg()
 
-    def create_page_font_tab(self):
-        """Return frame of widgets for Font/Tabs tab.
+    def create_page_font(self):
+        """Return frame of widgets for Font tab.
 
         Fonts: Enable users to provisionally change font face, size, or
         boldness and to see the consequence of proposed choices.  Each
@@ -509,11 +318,6 @@
         Set_samples applies a new font constructed from the font vars to
         font_sample and to highlight_sample on the highlight page.
 
-        Tabs: Enable users to change spaces entered for indent tabs.
-        Changing indent_scale value with the mouse sets Var space_num,
-        which invokes the default callback to add an entry to
-        changes.  Load_tab_cfg initializes space_num to default.
-
         Widgets for FontPage(Frame):  (*) widgets bound to self
             frame_font: LabelFrame
                 frame_font_name: Frame
@@ -526,23 +330,16 @@
                     (*)bold_toggle: Checkbutton - font_bold
             frame_sample: LabelFrame
                 (*)font_sample: Label
-            frame_indent: LabelFrame
-                    indent_title: Label
-                    (*)indent_scale: Scale - space_num
         """
         self.font_name = tracers.add(StringVar(self), self.var_changed_font)
         self.font_size = tracers.add(StringVar(self), self.var_changed_font)
         self.font_bold = tracers.add(BooleanVar(self), self.var_changed_font)
-        self.space_num = tracers.add(IntVar(self), ('main', 'Indent', 'num-spaces'))
 
         # Define frames and widgets.
-        frame_font = LabelFrame(
-                self, borderwidth=2, relief=GROOVE, text=' Shell/Editor Font ')
-        frame_sample = LabelFrame(
-                self, borderwidth=2, relief=GROOVE,
-                text=' Font Sample (Editable) ')
-        frame_indent = LabelFrame(
-                self, borderwidth=2, relief=GROOVE, text=' Indentation Width ')
+        frame_font = LabelFrame(self, borderwidth=2, relief=GROOVE,
+                                text=' Shell/Editor Font ')
+        frame_sample = LabelFrame(self, borderwidth=2, relief=GROOVE,
+                                  text=' Font Sample (Editable) ')
         # frame_font.
         frame_font_name = Frame(frame_font)
         frame_font_param = Frame(frame_font)
@@ -566,13 +363,6 @@
         self.font_sample = font_sample_frame.text
         self.font_sample.config(wrap=NONE, width=1, height=1)
         self.font_sample.insert(END, font_sample_text)
-        # frame_indent.
-        indent_title = Label(
-                frame_indent, justify=LEFT,
-                text='Python Standard: 4 Spaces!')
-        self.indent_scale = Scale(
-                frame_indent, variable=self.space_num,
-                orient='horizontal', tickinterval=2, from_=2, to=16)
 
         # Grid and pack widgets:
         self.columnconfigure(1, weight=1)
@@ -580,7 +370,6 @@
         frame_font.grid(row=0, column=0, padx=5, pady=5)
         frame_sample.grid(row=0, column=1, rowspan=3, padx=5, pady=5,
                           sticky='nsew')
-        frame_indent.grid(row=1, column=0, padx=5, pady=5, sticky='ew')
         # frame_font.
         frame_font_name.pack(side=TOP, padx=5, pady=5, fill=X)
         frame_font_param.pack(side=TOP, padx=5, pady=5, fill=X)
@@ -592,9 +381,6 @@
         self.bold_toggle.pack(side=LEFT, anchor=W, padx=20)
         # frame_sample.
         font_sample_frame.pack(expand=TRUE, fill=BOTH)
-        # frame_indent.
-        indent_title.pack(side=TOP, anchor=W, padx=5)
-        self.indent_scale.pack(side=TOP, padx=5, fill=X)
 
     def load_font_cfg(self):
         """Load current configuration settings for the font options.
@@ -609,7 +395,7 @@
         font_bold  = configured_font[2]=='bold'
 
         # Set sorted no-duplicate editor font selection list and font_name.
-        fonts = sorted(set(tkFont.families(self)))
+        fonts = sorted(set(tkfont.families(self)))
         for font in fonts:
             self.fontlist.insert(END, font)
         self.font_name.set(font_name)
@@ -663,39 +449,24 @@
         Updates font_sample and highlight page highlight_sample.
         """
         font_name = self.font_name.get()
-        font_weight = tkFont.BOLD if self.font_bold.get() else tkFont.NORMAL
+        font_weight = tkfont.BOLD if self.font_bold.get() else tkfont.NORMAL
         new_font = (font_name, self.font_size.get(), font_weight)
         self.font_sample['font'] = new_font
         self.highlight_sample['font'] = new_font
 
-    def load_tab_cfg(self):
-        """Load current configuration settings for the tab options.
-
-        Attributes updated:
-            space_num: Set to value from idleConf.
-        """
-        # Set indent sizes.
-        space_num = idleConf.GetOption(
-            'main', 'Indent', 'num-spaces', default=4, type='int')
-        self.space_num.set(space_num)
-
-    def var_changed_space_num(self, *params):
-        "Store change to indentation size."
-        value = self.space_num.get()
-        changes.add_option('main', 'Indent', 'num-spaces', value)
-
 
 class HighPage(Frame):
 
-    def __init__(self, master):
+    def __init__(self, master, extpage):
         super().__init__(master)
+        self.extpage = extpage
         self.cd = master.winfo_toplevel()
         self.style = Style(master)
         self.create_page_highlight()
         self.load_theme_cfg()
 
     def create_page_highlight(self):
-        """Return frame of widgets for Highlighting tab.
+        """Return frame of widgets for Highlights tab.
 
         Enable users to provisionally change foreground and background
         colors applied to textual tags.  Color mappings are stored in
@@ -1100,7 +871,7 @@
         target = self.highlight_target.get()
         prev_color = self.style.lookup(self.frame_color_set['style'],
                                        'background')
-        rgbTuplet, color_string = tkColorChooser.askcolor(
+        rgbTuplet, color_string = colorchooser.askcolor(
                 parent=self, title='Pick new color for : '+target,
                 initialcolor=prev_color)
         if color_string and (color_string != prev_color):
@@ -1339,15 +1110,16 @@
         self.builtin_name.set(idleConf.defaultCfg['main'].Get('Theme', 'name'))
         # User can't back out of these changes, they must be applied now.
         changes.save_all()
-        self.cd.save_all_changed_extensions()
+        self.extpage.save_all_changed_extensions()
         self.cd.activate_config_changes()
         self.set_theme_type()
 
 
 class KeysPage(Frame):
 
-    def __init__(self, master):
+    def __init__(self, master, extpage):
         super().__init__(master)
+        self.extpage = extpage
         self.cd = master.winfo_toplevel()
         self.create_page_keys()
         self.load_key_cfg()
@@ -1771,19 +1543,19 @@
                               or idleConf.default_keys())
         # User can't back out of these changes, they must be applied now.
         changes.save_all()
-        self.cd.save_all_changed_extensions()
+        self.extpage.save_all_changed_extensions()
         self.cd.activate_config_changes()
         self.set_keys_type()
 
 
-class GenPage(Frame):
+class WinPage(Frame):
 
     def __init__(self, master):
         super().__init__(master)
 
         self.init_validators()
-        self.create_page_general()
-        self.load_general_cfg()
+        self.create_page_windows()
+        self.load_windows_cfg()
 
     def init_validators(self):
         digits_or_empty_re = re.compile(r'[0-9]*')
@@ -1792,76 +1564,45 @@
             return digits_or_empty_re.fullmatch(s) is not None
         self.digits_only = (self.register(is_digits_or_empty), '%P',)
 
-    def create_page_general(self):
-        """Return frame of widgets for General tab.
+    def create_page_windows(self):
+        """Return frame of widgets for Windows tab.
 
-        Enable users to provisionally change general options. Function
-        load_general_cfg initializes tk variables and helplist using
-        idleConf.  Radiobuttons startup_shell_on and startup_editor_on
-        set var startup_edit. Radiobuttons save_ask_on and save_auto_on
-        set var autosave. Entry boxes win_width_int and win_height_int
-        set var win_width and win_height.  Setting var_name invokes the
-        default callback that adds option to changes.
+        Enable users to provisionally change general window options.
+        Function load_windows_cfg initializes tk variable idleConf.
+        Radiobuttons startup_shell_on and startup_editor_on set var
+        startup_edit. Entry boxes win_width_int and win_height_int set var
+        win_width and win_height.  Setting var_name invokes the default
+        callback that adds option to changes.
 
-        Helplist: load_general_cfg loads list user_helplist with
-        name, position pairs and copies names to listbox helplist.
-        Clicking a name invokes help_source selected. Clicking
-        button_helplist_name invokes helplist_item_name, which also
-        changes user_helplist.  These functions all call
-        set_add_delete_state. All but load call update_help_changes to
-        rewrite changes['main']['HelpFiles'].
-
-        Widgets for GenPage(Frame):  (*) widgets bound to self
+        Widgets for WinPage(Frame):  > vars, bound to self
             frame_window: LabelFrame
                 frame_run: Frame
                     startup_title: Label
-                    (*)startup_editor_on: Radiobutton - startup_edit
-                    (*)startup_shell_on: Radiobutton - startup_edit
+                    startup_editor_on: Radiobutton > startup_edit
+                    startup_shell_on: Radiobutton > startup_edit
                 frame_win_size: Frame
                     win_size_title: Label
                     win_width_title: Label
-                    (*)win_width_int: Entry - win_width
+                    win_width_int: Entry > win_width
                     win_height_title: Label
-                    (*)win_height_int: Entry - win_height
-                frame_cursor_blink: Frame
-                    cursor_blink_title: Label
-                    (*)cursor_blink_bool: Checkbutton - cursor_blink
+                    win_height_int: Entry > win_height
+                frame_cursor: Frame
+                    indent_title: Label
+                    indent_chooser: Spinbox (Combobox < 8.5.9) > indent_spaces
+                    blink_on: Checkbutton > cursor_blink
                 frame_autocomplete: Frame
                     auto_wait_title: Label
-                    (*)auto_wait_int: Entry - autocomplete_wait
+                    auto_wait_int: Entry > autocomplete_wait
                 frame_paren1: Frame
                     paren_style_title: Label
-                    (*)paren_style_type: OptionMenu - paren_style
+                    paren_style_type: OptionMenu > paren_style
                 frame_paren2: Frame
                     paren_time_title: Label
-                    (*)paren_flash_time: Entry - flash_delay
-                    (*)bell_on: Checkbutton - paren_bell
-            frame_editor: LabelFrame
-                frame_save: Frame
-                    run_save_title: Label
-                    (*)save_ask_on: Radiobutton - autosave
-                    (*)save_auto_on: Radiobutton - autosave
+                    paren_flash_time: Entry > flash_delay
+                    bell_on: Checkbutton > paren_bell
                 frame_format: Frame
                     format_width_title: Label
-                    (*)format_width_int: Entry - format_width
-                frame_line_numbers_default: Frame
-                    line_numbers_default_title: Label
-                    (*)line_numbers_default_bool: Checkbutton - line_numbers_default
-                frame_context: Frame
-                    context_title: Label
-                    (*)context_int: Entry - context_lines
-            frame_shell: LabelFrame
-                frame_auto_squeeze_min_lines: Frame
-                    auto_squeeze_min_lines_title: Label
-                    (*)auto_squeeze_min_lines_int: Entry - auto_squeeze_min_lines
-            frame_help: LabelFrame
-                frame_helplist: Frame
-                    frame_helplist_buttons: Frame
-                        (*)button_helplist_edit
-                        (*)button_helplist_add
-                        (*)button_helplist_remove
-                    (*)helplist: ListBox
-                    scroll_helplist: Scrollbar
+                    format_width_int: Entry > format_width
         """
         # Integer values need StringVar because int('') raises.
         self.startup_edit = tracers.add(
@@ -1870,6 +1611,8 @@
                 StringVar(self), ('main', 'EditorWindow', 'width'))
         self.win_height = tracers.add(
                 StringVar(self), ('main', 'EditorWindow', 'height'))
+        self.indent_spaces = tracers.add(
+                StringVar(self), ('main', 'Indent', 'num-spaces'))
         self.cursor_blink = tracers.add(
                 BooleanVar(self), ('main', 'EditorWindow', 'cursor-blink'))
         self.autocomplete_wait = tracers.add(
@@ -1880,31 +1623,13 @@
                 StringVar(self), ('extensions', 'ParenMatch', 'flash-delay'))
         self.paren_bell = tracers.add(
                 BooleanVar(self), ('extensions', 'ParenMatch', 'bell'))
-
-        self.auto_squeeze_min_lines = tracers.add(
-                StringVar(self), ('main', 'PyShell', 'auto-squeeze-min-lines'))
-
-        self.autosave = tracers.add(
-                IntVar(self), ('main', 'General', 'autosave'))
         self.format_width = tracers.add(
                 StringVar(self), ('extensions', 'FormatParagraph', 'max-width'))
-        self.line_numbers_default = tracers.add(
-                BooleanVar(self),
-                ('main', 'EditorWindow', 'line-numbers-default'))
-        self.context_lines = tracers.add(
-                StringVar(self), ('extensions', 'CodeContext', 'maxlines'))
 
         # Create widgets:
-        # Section frames.
         frame_window = LabelFrame(self, borderwidth=2, relief=GROOVE,
                                   text=' Window Preferences')
-        frame_editor = LabelFrame(self, borderwidth=2, relief=GROOVE,
-                                  text=' Editor Preferences')
-        frame_shell = LabelFrame(self, borderwidth=2, relief=GROOVE,
-                                 text=' Shell Preferences')
-        frame_help = LabelFrame(self, borderwidth=2, relief=GROOVE,
-                                text=' Additional Help Sources ')
-        # Frame_window.
+
         frame_run = Frame(frame_window, borderwidth=0)
         startup_title = Label(frame_run, text='At Startup')
         self.startup_editor_on = Radiobutton(
@@ -1928,19 +1653,28 @@
                 validatecommand=self.digits_only, validate='key',
         )
 
-        frame_cursor_blink = Frame(frame_window, borderwidth=0)
-        cursor_blink_title = Label(frame_cursor_blink, text='Cursor Blink')
-        self.cursor_blink_bool = Checkbutton(frame_cursor_blink,
-                variable=self.cursor_blink, width=1)
+        frame_cursor = Frame(frame_window, borderwidth=0)
+        indent_title = Label(frame_cursor,
+                             text='Indent spaces (4 is standard)')
+        try:
+            self.indent_chooser = Spinbox(
+                    frame_cursor, textvariable=self.indent_spaces,
+                    from_=1, to=10, width=2,
+                    validatecommand=self.digits_only, validate='key')
+        except TclError:
+            self.indent_chooser = Combobox(
+                    frame_cursor, textvariable=self.indent_spaces,
+                    state="readonly", values=list(range(1,11)), width=3)
+        cursor_blink_title = Label(frame_cursor, text='Cursor Blink')
+        self.cursor_blink_bool = Checkbutton(frame_cursor, text="Cursor blink",
+                                             variable=self.cursor_blink)
 
         frame_autocomplete = Frame(frame_window, borderwidth=0,)
         auto_wait_title = Label(frame_autocomplete,
-                               text='Completions Popup Wait (milliseconds)')
-        self.auto_wait_int = Entry(frame_autocomplete, width=6,
-                                   textvariable=self.autocomplete_wait,
-                                   validatecommand=self.digits_only,
-                                   validate='key',
-                                   )
+                                text='Completions Popup Wait (milliseconds)')
+        self.auto_wait_int = Entry(
+                frame_autocomplete, textvariable=self.autocomplete_wait,
+                width=6, validatecommand=self.digits_only, validate='key')
 
         frame_paren1 = Frame(frame_window, borderwidth=0)
         paren_style_title = Label(frame_paren1, text='Paren Match Style')
@@ -1952,13 +1686,154 @@
                 frame_paren2, text='Time Match Displayed (milliseconds)\n'
                                   '(0 is until next input)')
         self.paren_flash_time = Entry(
-                frame_paren2, textvariable=self.flash_delay, width=6)
+                frame_paren2, textvariable=self.flash_delay, width=6,
+                validatecommand=self.digits_only, validate='key')
         self.bell_on = Checkbutton(
                 frame_paren2, text="Bell on Mismatch", variable=self.paren_bell)
+        frame_format = Frame(frame_window, borderwidth=0)
+        format_width_title = Label(frame_format,
+                                   text='Format Paragraph Max Width')
+        self.format_width_int = Entry(
+                frame_format, textvariable=self.format_width, width=4,
+                validatecommand=self.digits_only, validate='key',
+                )
 
+        # Pack widgets:
+        frame_window.pack(side=TOP, padx=5, pady=5, expand=TRUE, fill=BOTH)
+        # frame_run.
+        frame_run.pack(side=TOP, padx=5, pady=0, fill=X)
+        startup_title.pack(side=LEFT, anchor=W, padx=5, pady=5)
+        self.startup_shell_on.pack(side=RIGHT, anchor=W, padx=5, pady=5)
+        self.startup_editor_on.pack(side=RIGHT, anchor=W, padx=5, pady=5)
+        # frame_win_size.
+        frame_win_size.pack(side=TOP, padx=5, pady=0, fill=X)
+        win_size_title.pack(side=LEFT, anchor=W, padx=5, pady=5)
+        self.win_height_int.pack(side=RIGHT, anchor=E, padx=10, pady=5)
+        win_height_title.pack(side=RIGHT, anchor=E, pady=5)
+        self.win_width_int.pack(side=RIGHT, anchor=E, padx=10, pady=5)
+        win_width_title.pack(side=RIGHT, anchor=E, pady=5)
+        # frame_cursor.
+        frame_cursor.pack(side=TOP, padx=5, pady=0, fill=X)
+        indent_title.pack(side=LEFT, anchor=W, padx=5)
+        self.indent_chooser.pack(side=LEFT, anchor=W, padx=10)
+        self.cursor_blink_bool.pack(side=RIGHT, anchor=E, padx=15, pady=5)
+        # frame_autocomplete.
+        frame_autocomplete.pack(side=TOP, padx=5, pady=0, fill=X)
+        auto_wait_title.pack(side=LEFT, anchor=W, padx=5, pady=5)
+        self.auto_wait_int.pack(side=TOP, padx=10, pady=5)
+        # frame_paren.
+        frame_paren1.pack(side=TOP, padx=5, pady=0, fill=X)
+        paren_style_title.pack(side=LEFT, anchor=W, padx=5, pady=5)
+        self.paren_style_type.pack(side=TOP, padx=10, pady=5)
+        frame_paren2.pack(side=TOP, padx=5, pady=0, fill=X)
+        paren_time_title.pack(side=LEFT, anchor=W, padx=5)
+        self.bell_on.pack(side=RIGHT, anchor=E, padx=15, pady=5)
+        self.paren_flash_time.pack(side=TOP, anchor=W, padx=15, pady=5)
+        # frame_format.
+        frame_format.pack(side=TOP, padx=5, pady=0, fill=X)
+        format_width_title.pack(side=LEFT, anchor=W, padx=5, pady=5)
+        self.format_width_int.pack(side=TOP, padx=10, pady=5)
+
+    def load_windows_cfg(self):
+        # Set variables for all windows.
+        self.startup_edit.set(idleConf.GetOption(
+                'main', 'General', 'editor-on-startup', type='bool'))
+        self.win_width.set(idleConf.GetOption(
+                'main', 'EditorWindow', 'width', type='int'))
+        self.win_height.set(idleConf.GetOption(
+                'main', 'EditorWindow', 'height', type='int'))
+        self.indent_spaces.set(idleConf.GetOption(
+                'main', 'Indent', 'num-spaces', type='int'))
+        self.cursor_blink.set(idleConf.GetOption(
+                'main', 'EditorWindow', 'cursor-blink', type='bool'))
+        self.autocomplete_wait.set(idleConf.GetOption(
+                'extensions', 'AutoComplete', 'popupwait', type='int'))
+        self.paren_style.set(idleConf.GetOption(
+                'extensions', 'ParenMatch', 'style'))
+        self.flash_delay.set(idleConf.GetOption(
+                'extensions', 'ParenMatch', 'flash-delay', type='int'))
+        self.paren_bell.set(idleConf.GetOption(
+                'extensions', 'ParenMatch', 'bell'))
+        self.format_width.set(idleConf.GetOption(
+                'extensions', 'FormatParagraph', 'max-width', type='int'))
+
+
+class ShedPage(Frame):
+
+    def __init__(self, master):
+        super().__init__(master)
+
+        self.init_validators()
+        self.create_page_shed()
+        self.load_shelled_cfg()
+
+    def init_validators(self):
+        digits_or_empty_re = re.compile(r'[0-9]*')
+        def is_digits_or_empty(s):
+            "Return 's is blank or contains only digits'"
+            return digits_or_empty_re.fullmatch(s) is not None
+        self.digits_only = (self.register(is_digits_or_empty), '%P',)
+
+    def create_page_shed(self):
+        """Return frame of widgets for Shell/Ed tab.
+
+        Enable users to provisionally change shell and editor options.
+        Function load_shed_cfg initializes tk variables using idleConf.
+        Entry box auto_squeeze_min_lines_int sets
+        auto_squeeze_min_lines_int.  Setting var_name invokes the
+        default callback that adds option to changes.
+
+        Widgets for ShedPage(Frame):  (*) widgets bound to self
+            frame_shell: LabelFrame
+                frame_auto_squeeze_min_lines: Frame
+                    auto_squeeze_min_lines_title: Label
+                    (*)auto_squeeze_min_lines_int: Entry -
+                       auto_squeeze_min_lines
+            frame_editor: LabelFrame
+                frame_save: Frame
+                    run_save_title: Label
+                    (*)save_ask_on: Radiobutton - autosave
+                    (*)save_auto_on: Radiobutton - autosave
+                frame_format: Frame
+                    format_width_title: Label
+                    (*)format_width_int: Entry - format_width
+                frame_line_numbers_default: Frame
+                    line_numbers_default_title: Label
+                    (*)line_numbers_default_bool: Checkbutton - line_numbers_default
+                frame_context: Frame
+                    context_title: Label
+                    (*)context_int: Entry - context_lines
+        """
+        # Integer values need StringVar because int('') raises.
+        self.auto_squeeze_min_lines = tracers.add(
+                StringVar(self), ('main', 'PyShell', 'auto-squeeze-min-lines'))
+
+        self.autosave = tracers.add(
+                IntVar(self), ('main', 'General', 'autosave'))
+        self.line_numbers_default = tracers.add(
+                BooleanVar(self),
+                ('main', 'EditorWindow', 'line-numbers-default'))
+        self.context_lines = tracers.add(
+                StringVar(self), ('extensions', 'CodeContext', 'maxlines'))
+
+        # Create widgets:
+        frame_shell = LabelFrame(self, borderwidth=2, relief=GROOVE,
+                                 text=' Shell Preferences')
+        frame_editor = LabelFrame(self, borderwidth=2, relief=GROOVE,
+                                  text=' Editor Preferences')
+        # Frame_shell.
+        frame_auto_squeeze_min_lines = Frame(frame_shell, borderwidth=0)
+        auto_squeeze_min_lines_title = Label(frame_auto_squeeze_min_lines,
+                                             text='Auto-Squeeze Min. Lines:')
+        self.auto_squeeze_min_lines_int = Entry(
+                frame_auto_squeeze_min_lines, width=4,
+                textvariable=self.auto_squeeze_min_lines,
+                validatecommand=self.digits_only, validate='key',
+        )
         # Frame_editor.
         frame_save = Frame(frame_editor, borderwidth=0)
         run_save_title = Label(frame_save, text='At Start of Run (F5)  ')
+
         self.save_ask_on = Radiobutton(
                 frame_save, variable=self.autosave, value=0,
                 text="Prompt to Save")
@@ -1966,14 +1841,6 @@
                 frame_save, variable=self.autosave, value=1,
                 text='No Prompt')
 
-        frame_format = Frame(frame_editor, borderwidth=0)
-        format_width_title = Label(frame_format,
-                                   text='Format Paragraph Max Width')
-        self.format_width_int = Entry(
-                frame_format, textvariable=self.format_width, width=4,
-                validatecommand=self.digits_only, validate='key',
-        )
-
         frame_line_numbers_default = Frame(frame_editor, borderwidth=0)
         line_numbers_default_title = Label(
             frame_line_numbers_default, text='Show line numbers in new windows')
@@ -1989,80 +1856,19 @@
                 validatecommand=self.digits_only, validate='key',
         )
 
-        # Frame_shell.
-        frame_auto_squeeze_min_lines = Frame(frame_shell, borderwidth=0)
-        auto_squeeze_min_lines_title = Label(frame_auto_squeeze_min_lines,
-                                             text='Auto-Squeeze Min. Lines:')
-        self.auto_squeeze_min_lines_int = Entry(
-                frame_auto_squeeze_min_lines, width=4,
-                textvariable=self.auto_squeeze_min_lines,
-                validatecommand=self.digits_only, validate='key',
-        )
-
-        # frame_help.
-        frame_helplist = Frame(frame_help)
-        frame_helplist_buttons = Frame(frame_helplist)
-        self.helplist = Listbox(
-                frame_helplist, height=5, takefocus=True,
-                exportselection=FALSE)
-        scroll_helplist = Scrollbar(frame_helplist)
-        scroll_helplist['command'] = self.helplist.yview
-        self.helplist['yscrollcommand'] = scroll_helplist.set
-        self.helplist.bind('<ButtonRelease-1>', self.help_source_selected)
-        self.button_helplist_edit = Button(
-                frame_helplist_buttons, text='Edit', state='disabled',
-                width=8, command=self.helplist_item_edit)
-        self.button_helplist_add = Button(
-                frame_helplist_buttons, text='Add',
-                width=8, command=self.helplist_item_add)
-        self.button_helplist_remove = Button(
-                frame_helplist_buttons, text='Remove', state='disabled',
-                width=8, command=self.helplist_item_remove)
-
         # Pack widgets:
-        # Body.
-        frame_window.pack(side=TOP, padx=5, pady=5, expand=TRUE, fill=BOTH)
-        frame_editor.pack(side=TOP, padx=5, pady=5, expand=TRUE, fill=BOTH)
-        frame_shell.pack(side=TOP, padx=5, pady=5, expand=TRUE, fill=BOTH)
-        frame_help.pack(side=TOP, padx=5, pady=5, expand=TRUE, fill=BOTH)
-        # frame_run.
-        frame_run.pack(side=TOP, padx=5, pady=0, fill=X)
-        startup_title.pack(side=LEFT, anchor=W, padx=5, pady=5)
-        self.startup_shell_on.pack(side=RIGHT, anchor=W, padx=5, pady=5)
-        self.startup_editor_on.pack(side=RIGHT, anchor=W, padx=5, pady=5)
-        # frame_win_size.
-        frame_win_size.pack(side=TOP, padx=5, pady=0, fill=X)
-        win_size_title.pack(side=LEFT, anchor=W, padx=5, pady=5)
-        self.win_height_int.pack(side=RIGHT, anchor=E, padx=10, pady=5)
-        win_height_title.pack(side=RIGHT, anchor=E, pady=5)
-        self.win_width_int.pack(side=RIGHT, anchor=E, padx=10, pady=5)
-        win_width_title.pack(side=RIGHT, anchor=E, pady=5)
-        # frame_cursor_blink.
-        frame_cursor_blink.pack(side=TOP, padx=5, pady=0, fill=X)
-        cursor_blink_title.pack(side=LEFT, anchor=W, padx=5, pady=5)
-        self.cursor_blink_bool.pack(side=LEFT, padx=5, pady=5)
-        # frame_autocomplete.
-        frame_autocomplete.pack(side=TOP, padx=5, pady=0, fill=X)
-        auto_wait_title.pack(side=LEFT, anchor=W, padx=5, pady=5)
-        self.auto_wait_int.pack(side=TOP, padx=10, pady=5)
-        # frame_paren.
-        frame_paren1.pack(side=TOP, padx=5, pady=0, fill=X)
-        paren_style_title.pack(side=LEFT, anchor=W, padx=5, pady=5)
-        self.paren_style_type.pack(side=TOP, padx=10, pady=5)
-        frame_paren2.pack(side=TOP, padx=5, pady=0, fill=X)
-        paren_time_title.pack(side=LEFT, anchor=W, padx=5)
-        self.bell_on.pack(side=RIGHT, anchor=E, padx=15, pady=5)
-        self.paren_flash_time.pack(side=TOP, anchor=W, padx=15, pady=5)
-
+        frame_shell.pack(side=TOP, padx=5, pady=5, fill=BOTH)
+        Label(self).pack()  # Spacer -- better solution?
+        frame_editor.pack(side=TOP, padx=5, pady=5, fill=BOTH)
+        # frame_auto_squeeze_min_lines
+        frame_auto_squeeze_min_lines.pack(side=TOP, padx=5, pady=0, fill=X)
+        auto_squeeze_min_lines_title.pack(side=LEFT, anchor=W, padx=5, pady=5)
+        self.auto_squeeze_min_lines_int.pack(side=TOP, padx=5, pady=5)
         # frame_save.
         frame_save.pack(side=TOP, padx=5, pady=0, fill=X)
         run_save_title.pack(side=LEFT, anchor=W, padx=5, pady=5)
         self.save_auto_on.pack(side=RIGHT, anchor=W, padx=5, pady=5)
         self.save_ask_on.pack(side=RIGHT, anchor=W, padx=5, pady=5)
-        # frame_format.
-        frame_format.pack(side=TOP, padx=5, pady=0, fill=X)
-        format_width_title.pack(side=LEFT, anchor=W, padx=5, pady=5)
-        self.format_width_int.pack(side=TOP, padx=10, pady=5)
         # frame_line_numbers_default.
         frame_line_numbers_default.pack(side=TOP, padx=5, pady=0, fill=X)
         line_numbers_default_title.pack(side=LEFT, anchor=W, padx=5, pady=5)
@@ -2072,60 +1878,270 @@
         context_title.pack(side=LEFT, anchor=W, padx=5, pady=5)
         self.context_int.pack(side=TOP, padx=5, pady=5)
 
-        # frame_auto_squeeze_min_lines
-        frame_auto_squeeze_min_lines.pack(side=TOP, padx=5, pady=0, fill=X)
-        auto_squeeze_min_lines_title.pack(side=LEFT, anchor=W, padx=5, pady=5)
-        self.auto_squeeze_min_lines_int.pack(side=TOP, padx=5, pady=5)
-
-        # frame_help.
-        frame_helplist_buttons.pack(side=RIGHT, padx=5, pady=5, fill=Y)
-        frame_helplist.pack(side=TOP, padx=5, pady=5, expand=TRUE, fill=BOTH)
-        scroll_helplist.pack(side=RIGHT, anchor=W, fill=Y)
-        self.helplist.pack(side=LEFT, anchor=E, expand=TRUE, fill=BOTH)
-        self.button_helplist_edit.pack(side=TOP, anchor=W, pady=5)
-        self.button_helplist_add.pack(side=TOP, anchor=W)
-        self.button_helplist_remove.pack(side=TOP, anchor=W, pady=5)
-
-    def load_general_cfg(self):
-        "Load current configuration settings for the general options."
-        # Set variables for all windows.
-        self.startup_edit.set(idleConf.GetOption(
-                'main', 'General', 'editor-on-startup', type='bool'))
-        self.win_width.set(idleConf.GetOption(
-                'main', 'EditorWindow', 'width', type='int'))
-        self.win_height.set(idleConf.GetOption(
-                'main', 'EditorWindow', 'height', type='int'))
-        self.cursor_blink.set(idleConf.GetOption(
-                'main', 'EditorWindow', 'cursor-blink', type='bool'))
-        self.autocomplete_wait.set(idleConf.GetOption(
-                'extensions', 'AutoComplete', 'popupwait', type='int'))
-        self.paren_style.set(idleConf.GetOption(
-                'extensions', 'ParenMatch', 'style'))
-        self.flash_delay.set(idleConf.GetOption(
-                'extensions', 'ParenMatch', 'flash-delay', type='int'))
-        self.paren_bell.set(idleConf.GetOption(
-                'extensions', 'ParenMatch', 'bell'))
-
+    def load_shelled_cfg(self):
+        # Set variables for shell windows.
+        self.auto_squeeze_min_lines.set(idleConf.GetOption(
+                'main', 'PyShell', 'auto-squeeze-min-lines', type='int'))
         # Set variables for editor windows.
         self.autosave.set(idleConf.GetOption(
                 'main', 'General', 'autosave', default=0, type='bool'))
-        self.format_width.set(idleConf.GetOption(
-                'extensions', 'FormatParagraph', 'max-width', type='int'))
         self.line_numbers_default.set(idleConf.GetOption(
                 'main', 'EditorWindow', 'line-numbers-default', type='bool'))
         self.context_lines.set(idleConf.GetOption(
                 'extensions', 'CodeContext', 'maxlines', type='int'))
 
-        # Set variables for shell windows.
-        self.auto_squeeze_min_lines.set(idleConf.GetOption(
-                'main', 'PyShell', 'auto-squeeze-min-lines', type='int'))
 
-        # Set additional help sources.
-        self.user_helplist = idleConf.GetAllExtraHelpSourcesList()
-        self.helplist.delete(0, 'end')
-        for help_item in self.user_helplist:
-            self.helplist.insert(END, help_item[0])
-        self.set_add_delete_state()
+class ExtPage(Frame):
+    def __init__(self, master):
+        super().__init__(master)
+        self.ext_defaultCfg = idleConf.defaultCfg['extensions']
+        self.ext_userCfg = idleConf.userCfg['extensions']
+        self.is_int = self.register(is_int)
+        self.load_extensions()
+        self.create_page_extensions()  # Requires extension names.
+
+    def create_page_extensions(self):
+        """Configure IDLE feature extensions and help menu extensions.
+
+        List the feature extensions and a configuration box for the
+        selected extension.  Help menu extensions are in a HelpFrame.
+
+        This code reads the current configuration using idleConf,
+        supplies a GUI interface to change the configuration values,
+        and saves the changes using idleConf.
+
+        Some changes may require restarting IDLE.  This depends on each
+        extension's implementation.
+
+        All values are treated as text, and it is up to the user to
+        supply reasonable values. The only exception to this are the
+        'enable*' options, which are boolean, and can be toggled with a
+        True/False button.
+
+        Methods:
+            extension_selected: Handle selection from list.
+            create_extension_frame: Hold widgets for one extension.
+            set_extension_value: Set in userCfg['extensions'].
+            save_all_changed_extensions: Call extension page Save().
+        """
+        self.extension_names = StringVar(self)
+
+        frame_ext = LabelFrame(self, borderwidth=2, relief=GROOVE,
+                               text=' Feature Extensions ')
+        self.frame_help = HelpFrame(self, borderwidth=2, relief=GROOVE,
+                               text=' Help Menu Extensions ')
+
+        frame_ext.rowconfigure(0, weight=1)
+        frame_ext.columnconfigure(2, weight=1)
+        self.extension_list = Listbox(frame_ext, listvariable=self.extension_names,
+                                      selectmode='browse')
+        self.extension_list.bind('<<ListboxSelect>>', self.extension_selected)
+        scroll = Scrollbar(frame_ext, command=self.extension_list.yview)
+        self.extension_list.yscrollcommand=scroll.set
+        self.details_frame = LabelFrame(frame_ext, width=250, height=250)
+        self.extension_list.grid(column=0, row=0, sticky='nws')
+        scroll.grid(column=1, row=0, sticky='ns')
+        self.details_frame.grid(column=2, row=0, sticky='nsew', padx=[10, 0])
+        frame_ext.configure(padding=10)
+        self.config_frame = {}
+        self.current_extension = None
+
+        self.outerframe = self                      # TEMPORARY
+        self.tabbed_page_set = self.extension_list  # TEMPORARY
+
+        # Create the frame holding controls for each extension.
+        ext_names = ''
+        for ext_name in sorted(self.extensions):
+            self.create_extension_frame(ext_name)
+            ext_names = ext_names + '{' + ext_name + '} '
+        self.extension_names.set(ext_names)
+        self.extension_list.selection_set(0)
+        self.extension_selected(None)
+
+
+        frame_ext.grid(row=0, column=0, sticky='nsew')
+        Label(self).grid(row=1, column=0)  # Spacer.  Replace with config?
+        self.frame_help.grid(row=2, column=0, sticky='sew')
+
+    def load_extensions(self):
+        "Fill self.extensions with data from the default and user configs."
+        self.extensions = {}
+        for ext_name in idleConf.GetExtensions(active_only=False):
+            # Former built-in extensions are already filtered out.
+            self.extensions[ext_name] = []
+
+        for ext_name in self.extensions:
+            opt_list = sorted(self.ext_defaultCfg.GetOptionList(ext_name))
+
+            # Bring 'enable' options to the beginning of the list.
+            enables = [opt_name for opt_name in opt_list
+                       if opt_name.startswith('enable')]
+            for opt_name in enables:
+                opt_list.remove(opt_name)
+            opt_list = enables + opt_list
+
+            for opt_name in opt_list:
+                def_str = self.ext_defaultCfg.Get(
+                        ext_name, opt_name, raw=True)
+                try:
+                    def_obj = {'True':True, 'False':False}[def_str]
+                    opt_type = 'bool'
+                except KeyError:
+                    try:
+                        def_obj = int(def_str)
+                        opt_type = 'int'
+                    except ValueError:
+                        def_obj = def_str
+                        opt_type = None
+                try:
+                    value = self.ext_userCfg.Get(
+                            ext_name, opt_name, type=opt_type, raw=True,
+                            default=def_obj)
+                except ValueError:  # Need this until .Get fixed.
+                    value = def_obj  # Bad values overwritten by entry.
+                var = StringVar(self)
+                var.set(str(value))
+
+                self.extensions[ext_name].append({'name': opt_name,
+                                                  'type': opt_type,
+                                                  'default': def_str,
+                                                  'value': value,
+                                                  'var': var,
+                                                 })
+
+    def extension_selected(self, event):
+        "Handle selection of an extension from the list."
+        newsel = self.extension_list.curselection()
+        if newsel:
+            newsel = self.extension_list.get(newsel)
+        if newsel is None or newsel != self.current_extension:
+            if self.current_extension:
+                self.details_frame.config(text='')
+                self.config_frame[self.current_extension].grid_forget()
+                self.current_extension = None
+        if newsel:
+            self.details_frame.config(text=newsel)
+            self.config_frame[newsel].grid(column=0, row=0, sticky='nsew')
+            self.current_extension = newsel
+
+    def create_extension_frame(self, ext_name):
+        """Create a frame holding the widgets to configure one extension"""
+        f = VerticalScrolledFrame(self.details_frame, height=250, width=250)
+        self.config_frame[ext_name] = f
+        entry_area = f.interior
+        # Create an entry for each configuration option.
+        for row, opt in enumerate(self.extensions[ext_name]):
+            # Create a row with a label and entry/checkbutton.
+            label = Label(entry_area, text=opt['name'])
+            label.grid(row=row, column=0, sticky=NW)
+            var = opt['var']
+            if opt['type'] == 'bool':
+                Checkbutton(entry_area, variable=var,
+                            onvalue='True', offvalue='False', width=8
+                            ).grid(row=row, column=1, sticky=W, padx=7)
+            elif opt['type'] == 'int':
+                Entry(entry_area, textvariable=var, validate='key',
+                      validatecommand=(self.is_int, '%P'), width=10
+                      ).grid(row=row, column=1, sticky=NSEW, padx=7)
+
+            else:  # type == 'str'
+                # Limit size to fit non-expanding space with larger font.
+                Entry(entry_area, textvariable=var, width=15
+                      ).grid(row=row, column=1, sticky=NSEW, padx=7)
+        return
+
+    def set_extension_value(self, section, opt):
+        """Return True if the configuration was added or changed.
+
+        If the value is the same as the default, then remove it
+        from user config file.
+        """
+        name = opt['name']
+        default = opt['default']
+        value = opt['var'].get().strip() or default
+        opt['var'].set(value)
+        # if self.defaultCfg.has_section(section):
+        # Currently, always true; if not, indent to return.
+        if (value == default):
+            return self.ext_userCfg.RemoveOption(section, name)
+        # Set the option.
+        return self.ext_userCfg.SetOption(section, name, value)
+
+    def save_all_changed_extensions(self):
+        """Save configuration changes to the user config file.
+
+        Attributes accessed:
+            extensions
+
+        Methods:
+            set_extension_value
+        """
+        has_changes = False
+        for ext_name in self.extensions:
+            options = self.extensions[ext_name]
+            for opt in options:
+                if self.set_extension_value(ext_name, opt):
+                    has_changes = True
+        if has_changes:
+            self.ext_userCfg.Save()
+
+
+class HelpFrame(LabelFrame):
+
+    def __init__(self, master, **cfg):
+        super().__init__(master, **cfg)
+        self.create_frame_help()
+        self.load_helplist()
+
+    def create_frame_help(self):
+        """Create LabelFrame for additional help menu sources.
+
+        load_helplist loads list user_helplist with
+        name, position pairs and copies names to listbox helplist.
+        Clicking a name invokes help_source selected. Clicking
+        button_helplist_name invokes helplist_item_name, which also
+        changes user_helplist.  These functions all call
+        set_add_delete_state. All but load call update_help_changes to
+        rewrite changes['main']['HelpFiles'].
+
+        Widgets for HelpFrame(LabelFrame):  (*) widgets bound to self
+            frame_helplist: Frame
+                (*)helplist: ListBox
+                scroll_helplist: Scrollbar
+            frame_buttons: Frame
+                (*)button_helplist_edit
+                (*)button_helplist_add
+                (*)button_helplist_remove
+        """
+        # self = frame_help in dialog (until ExtPage class).
+        frame_helplist = Frame(self)
+        self.helplist = Listbox(
+                frame_helplist, height=5, takefocus=True,
+                exportselection=FALSE)
+        scroll_helplist = Scrollbar(frame_helplist)
+        scroll_helplist['command'] = self.helplist.yview
+        self.helplist['yscrollcommand'] = scroll_helplist.set
+        self.helplist.bind('<ButtonRelease-1>', self.help_source_selected)
+
+        frame_buttons = Frame(self)
+        self.button_helplist_edit = Button(
+                frame_buttons, text='Edit', state='disabled',
+                width=8, command=self.helplist_item_edit)
+        self.button_helplist_add = Button(
+                frame_buttons, text='Add',
+                width=8, command=self.helplist_item_add)
+        self.button_helplist_remove = Button(
+                frame_buttons, text='Remove', state='disabled',
+                width=8, command=self.helplist_item_remove)
+
+        # Pack frame_help.
+        frame_helplist.pack(side=LEFT, padx=5, pady=5, expand=TRUE, fill=BOTH)
+        self.helplist.pack(side=LEFT, anchor=E, expand=TRUE, fill=BOTH)
+        scroll_helplist.pack(side=RIGHT, anchor=W, fill=Y)
+        frame_buttons.pack(side=RIGHT, padx=5, pady=5, fill=Y)
+        self.button_helplist_edit.pack(side=TOP, anchor=W, pady=5)
+        self.button_helplist_add.pack(side=TOP, anchor=W)
+        self.button_helplist_remove.pack(side=TOP, anchor=W, pady=5)
 
     def help_source_selected(self, event):
         "Handle event for selecting additional help."
@@ -2195,6 +2211,14 @@
                     'main', 'HelpFiles', str(num),
                     ';'.join(self.user_helplist[num-1][:2]))
 
+    def load_helplist(self):
+        # Set additional help sources.
+        self.user_helplist = idleConf.GetAllExtraHelpSourcesList()
+        self.helplist.delete(0, 'end')
+        for help_item in self.user_helplist:
+            self.helplist.insert(END, help_item[0])
+        self.set_add_delete_state()
+
 
 class VarTrace:
     """Maintain Tk variables trace state."""
@@ -2316,7 +2340,15 @@
 
 Shell Preferences: Auto-Squeeze Min. Lines is the minimum number of lines
 of output to automatically "squeeze".
-'''
+''',
+    'Extensions': '''
+ZzDummy: This extension is provided as an example for how to create and
+use an extension.  Enable indicates whether the extension is active or
+not; likewise enable_editor and enable_shell indicate which windows it
+will be active on.  For this extension, z-text is the text that will be
+inserted at or removed from the beginning of the lines of selected text,
+or the current line if no selection.
+''',
 }
 
 
diff --git a/Lib/idlelib/debugger_r.py b/Lib/idlelib/debugger_r.py
index 9dcfc56..2620443 100644
--- a/Lib/idlelib/debugger_r.py
+++ b/Lib/idlelib/debugger_r.py
@@ -19,7 +19,7 @@
 barrier, in particular frame and traceback objects.
 
 """
-
+import reprlib
 import types
 from idlelib import debugger
 
@@ -170,7 +170,7 @@
     def dict_item(self, did, key):
         dict = dicttable[did]
         value = dict[key]
-        value = repr(value) ### can't pickle module 'builtins'
+        value = reprlib.repr(value) ### can't pickle module 'builtins'
         return value
 
 #----------end class IdbAdapter----------
@@ -390,4 +390,4 @@
 
 if __name__ == "__main__":
     from unittest import main
-    main('idlelib.idle_test.test_debugger', verbosity=2, exit=False)
+    main('idlelib.idle_test.test_debugger_r', verbosity=2, exit=False)
diff --git a/Lib/idlelib/editor.py b/Lib/idlelib/editor.py
index a178eaf..6c52efd 100644
--- a/Lib/idlelib/editor.py
+++ b/Lib/idlelib/editor.py
@@ -12,8 +12,8 @@
 from tkinter import *
 from tkinter.font import Font
 from tkinter.ttk import Scrollbar
-import tkinter.simpledialog as tkSimpleDialog
-import tkinter.messagebox as tkMessageBox
+from tkinter import simpledialog
+from tkinter import messagebox
 
 from idlelib.config import idleConf
 from idlelib import configdialog
@@ -27,6 +27,7 @@
 from idlelib import replace
 from idlelib import search
 from idlelib.tree import wheel_event
+from idlelib.util import py_extensions
 from idlelib import window
 
 # The default tab setting for a Text widget, in average-width characters.
@@ -46,7 +47,7 @@
     return release
 
 
-class EditorWindow(object):
+class EditorWindow:
     from idlelib.percolator import Percolator
     from idlelib.colorizer import ColorDelegator, color_config
     from idlelib.undo import UndoDelegator
@@ -60,7 +61,6 @@
     from idlelib.sidebar import LineNumbers
     from idlelib.format import FormatParagraph, FormatRegion, Indents, Rstrip
     from idlelib.parenmatch import ParenMatch
-    from idlelib.squeezer import Squeezer
     from idlelib.zoomheight import ZoomHeight
 
     filesystemencoding = sys.getfilesystemencoding()  # for file names
@@ -68,6 +68,7 @@
 
     allow_code_context = True
     allow_line_numbers = True
+    user_input_insert_tags = None
 
     def __init__(self, flist=None, filename=None, key=None, root=None):
         # Delay import: runscript imports pyshell imports EditorWindow.
@@ -295,9 +296,9 @@
             window.register_callback(self.postwindowsmenu)
 
         # Some abstractions so IDLE extensions are cross-IDE
-        self.askyesno = tkMessageBox.askyesno
-        self.askinteger = tkSimpleDialog.askinteger
-        self.showerror = tkMessageBox.showerror
+        self.askinteger = simpledialog.askinteger
+        self.askyesno = messagebox.askyesno
+        self.showerror = messagebox.showerror
 
         # Add pseudoevents for former extension fixed keys.
         # (This probably needs to be done once in the process.)
@@ -311,7 +312,7 @@
 
         # Former extension bindings depends on frame.text being packed
         # (called from self.ResetColorizer()).
-        autocomplete = self.AutoComplete(self)
+        autocomplete = self.AutoComplete(self, self.user_input_insert_tags)
         text.bind("<<autocomplete>>", autocomplete.autocomplete_event)
         text.bind("<<try-open-completions>>",
                   autocomplete.try_open_completions_event)
@@ -339,7 +340,7 @@
             text.bind("<<toggle-code-context>>",
                       self.code_context.toggle_code_context_event)
         else:
-            self.update_menu_state('options', '*Code Context', 'disabled')
+            self.update_menu_state('options', '*ode*ontext', 'disabled')
         if self.allow_line_numbers:
             self.line_numbers = self.LineNumbers(self)
             if idleConf.GetOption('main', 'EditorWindow',
@@ -347,7 +348,7 @@
                 self.toggle_line_numbers_event()
             text.bind("<<toggle-line-numbers>>", self.toggle_line_numbers_event)
         else:
-            self.update_menu_state('options', '*Line Numbers', 'disabled')
+            self.update_menu_state('options', '*ine*umbers', 'disabled')
 
     def handle_winconfig(self, event=None):
         self.set_width()
@@ -450,7 +451,9 @@
         self.menudict = menudict = {}
         for name, label in self.menu_specs:
             underline, label = prepstr(label)
-            menudict[name] = menu = Menu(mbar, name=name, tearoff=0)
+            postcommand = getattr(self, f'{name}_menu_postcommand', None)
+            menudict[name] = menu = Menu(mbar, name=name, tearoff=0,
+                                         postcommand=postcommand)
             mbar.add_cascade(label=label, menu=menu, underline=underline)
         if macosx.isCarbonTk():
             # Insert the application menu
@@ -596,7 +599,7 @@
             try:
                 os.startfile(self.help_url)
             except OSError as why:
-                tkMessageBox.showerror(title='Document Start Failure',
+                messagebox.showerror(title='Document Start Failure',
                     message=str(why), parent=self.text)
         else:
             webbrowser.open(self.help_url)
@@ -755,7 +758,7 @@
         if not filename or os.path.isdir(filename):
             return True
         base, ext = os.path.splitext(os.path.basename(filename))
-        if os.path.normcase(ext) in (".py", ".pyw"):
+        if os.path.normcase(ext) in py_extensions:
             return True
         line = self.text.get('1.0', '1.0 lineend')
         return line.startswith('#!') and 'python' in line
@@ -782,9 +785,7 @@
             self.color = self.ColorDelegator()
         # can add more colorizers here...
         if self.color:
-            self.per.removefilter(self.undo)
-            self.per.insertfilter(self.color)
-            self.per.insertfilter(self.undo)
+            self.per.insertfilterafter(filter=self.color, after=self.undo)
 
     def _rmcolorizer(self):
         if not self.color:
@@ -927,7 +928,7 @@
                 try:
                     os.startfile(helpfile)
                 except OSError as why:
-                    tkMessageBox.showerror(title='Document Start Failure',
+                    messagebox.showerror(title='Document Start Failure',
                         message=str(why), parent=self.text)
             else:
                 webbrowser.open(helpfile)
@@ -963,7 +964,7 @@
             except OSError as err:
                 if not getattr(self.root, "recentfiles_message", False):
                     self.root.recentfiles_message = True
-                    tkMessageBox.showwarning(title='IDLE Warning',
+                    messagebox.showwarning(title='IDLE Warning',
                         message="Cannot save Recent Files list to disk.\n"
                                 f"  {err}\n"
                                 "Select OK to continue.",
@@ -1301,8 +1302,6 @@
         # Debug prompt is multilined....
         ncharsdeleted = 0
         while 1:
-            if chars == self.prompt_last_line:  # '' unless PyShell
-                break
             chars = chars[:-1]
             ncharsdeleted = ncharsdeleted + 1
             have = len(chars.expandtabs(tabwidth))
@@ -1311,7 +1310,8 @@
         text.undo_block_start()
         text.delete("insert-%dc" % ncharsdeleted, "insert")
         if have < want:
-            text.insert("insert", ' ' * (want - have))
+            text.insert("insert", ' ' * (want - have),
+                        self.user_input_insert_tags)
         text.undo_block_stop()
         return "break"
 
@@ -1344,7 +1344,7 @@
                     effective = len(prefix.expandtabs(self.tabwidth))
                     n = self.indentwidth
                     pad = ' ' * (n - effective % n)
-                text.insert("insert", pad)
+                text.insert("insert", pad, self.user_input_insert_tags)
             text.see("insert")
             return "break"
         finally:
@@ -1375,13 +1375,14 @@
             if i == n:
                 # The cursor is in or at leading indentation in a continuation
                 # line; just inject an empty line at the start.
-                text.insert("insert linestart", '\n')
+                text.insert("insert linestart", '\n',
+                            self.user_input_insert_tags)
                 return "break"
             indent = line[:i]
 
             # Strip whitespace before insert point unless it's in the prompt.
             i = 0
-            while line and line[-1] in " \t" and line != self.prompt_last_line:
+            while line and line[-1] in " \t":
                 line = line[:-1]
                 i += 1
             if i:
@@ -1392,7 +1393,7 @@
                 text.delete("insert")
 
             # Insert new line.
-            text.insert("insert", '\n')
+            text.insert("insert", '\n', self.user_input_insert_tags)
 
             # Adjust indentation for continuations and block open/close.
             # First need to find the last statement.
@@ -1428,7 +1429,7 @@
                 elif c == pyparse.C_STRING_NEXT_LINES:
                     # Inside a string which started before this line;
                     # just mimic the current indent.
-                    text.insert("insert", indent)
+                    text.insert("insert", indent, self.user_input_insert_tags)
                 elif c == pyparse.C_BRACKET:
                     # Line up with the first (if any) element of the
                     # last open bracket structure; else indent one
@@ -1442,7 +1443,8 @@
                     # beyond leftmost =; else to beyond first chunk of
                     # non-whitespace on initial line.
                     if y.get_num_lines_in_stmt() > 1:
-                        text.insert("insert", indent)
+                        text.insert("insert", indent,
+                                    self.user_input_insert_tags)
                     else:
                         self.reindent_to(y.compute_backslash_indent())
                 else:
@@ -1453,7 +1455,7 @@
             # indentation of initial line of closest preceding
             # interesting statement.
             indent = y.get_base_indent_string()
-            text.insert("insert", indent)
+            text.insert("insert", indent, self.user_input_insert_tags)
             if y.is_block_opener():
                 self.smart_indent_event(event)
             elif indent and y.is_block_closer():
@@ -1500,7 +1502,8 @@
         if text.compare("insert linestart", "!=", "insert"):
             text.delete("insert linestart", "insert")
         if column:
-            text.insert("insert", self._make_blanks(column))
+            text.insert("insert", self._make_blanks(column),
+                        self.user_input_insert_tags)
         text.undo_block_stop()
 
     # Guess indentwidth from text content.
@@ -1527,7 +1530,7 @@
         else:
             self.line_numbers.show_sidebar()
             menu_label = "Hide"
-        self.update_menu_label(menu='options', index='*Line Numbers',
+        self.update_menu_label(menu='options', index='*ine*umbers',
                                label=f'{menu_label} Line Numbers')
 
 # "line.col" -> line, as an int
@@ -1546,7 +1549,7 @@
     return m.end(), len(m.group().expandtabs(tabwidth))
 
 
-class IndentSearcher(object):
+class IndentSearcher:
 
     # .run() chews over the Text widget, looking for a block opener
     # and the stmt following it.  Returns a pair,
diff --git a/Lib/idlelib/extend.txt b/Lib/idlelib/extend.txt
index c9cb2e8..b482f76 100644
--- a/Lib/idlelib/extend.txt
+++ b/Lib/idlelib/extend.txt
@@ -28,8 +28,8 @@
 (There are a few more, but they are rarely useful.)
 
 The extension class must not directly bind Window Manager (e.g. X) events.
-Rather, it must define one or more virtual events, e.g. <<zoom-height>>, and
-corresponding methods, e.g. zoom_height_event().  The virtual events will be
+Rather, it must define one or more virtual events, e.g. <<z-in>>, and
+corresponding methods, e.g. z_in_event().  The virtual events will be
 bound to the corresponding methods, and Window Manager events can then be bound
 to the virtual events. (This indirection is done so that the key bindings can
 easily be changed, and so that other sources of virtual events can exist, such
@@ -54,21 +54,21 @@
 implement.  (They are also not required to create keybindings, but in that
 case there must be empty bindings in cofig-extensions.def)
 
-Here is a complete example:
+Here is a partial example from zzdummy.py:
 
-class ZoomHeight:
+class ZzDummy:
 
     menudefs = [
-        ('edit', [
-            None, # Separator
-            ('_Zoom Height', '<<zoom-height>>'),
-         ])
+        ('format', [
+            ('Z in', '<<z-in>>'),
+            ('Z out', '<<z-out>>'),
+        ] )
     ]
 
     def __init__(self, editwin):
         self.editwin = editwin
 
-    def zoom_height_event(self, event):
+    def z_in_event(self, event=None):
         "...Do what you want here..."
 
 The final piece of the puzzle is the file "config-extensions.def", which is
diff --git a/Lib/idlelib/filelist.py b/Lib/idlelib/filelist.py
index 0d20085..254f5ca 100644
--- a/Lib/idlelib/filelist.py
+++ b/Lib/idlelib/filelist.py
@@ -1,7 +1,7 @@
 "idlelib.filelist"
 
 import os
-from tkinter import messagebox as tkMessageBox
+from tkinter import messagebox
 
 
 class FileList:
@@ -20,7 +20,7 @@
         filename = self.canonize(filename)
         if os.path.isdir(filename):
             # This can happen when bad filename is passed on command line:
-            tkMessageBox.showerror(
+            messagebox.showerror(
                 "File Error",
                 "%r is a directory." % (filename,),
                 master=self.root)
@@ -88,7 +88,7 @@
         if newkey in self.dict:
             conflict = self.dict[newkey]
             self.inversedict[conflict] = None
-            tkMessageBox.showerror(
+            messagebox.showerror(
                 "Name Conflict",
                 "You now have multiple edit windows open for %r" % (filename,),
                 master=self.root)
diff --git a/Lib/idlelib/help.html b/Lib/idlelib/help.html
index 170999e..41626ec 100644
--- a/Lib/idlelib/help.html
+++ b/Lib/idlelib/help.html
@@ -5,7 +5,7 @@
   <head>
     <meta charset="utf-8" />
     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
-    <title>IDLE &#8212; Python 3.10.0a1 documentation</title>
+    <title>IDLE &#8212; Python 3.11.0a4 documentation</title>
     <link rel="stylesheet" href="../_static/pydoctheme.css" type="text/css" />
     <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
 
@@ -18,13 +18,13 @@
     <script src="../_static/sidebar.js"></script>
 
     <link rel="search" type="application/opensearchdescription+xml"
-          title="Search within Python 3.10.0a1 documentation"
+          title="Search within Python 3.11.0a4 documentation"
           href="../_static/opensearch.xml"/>
     <link rel="author" title="About these documents" href="../about.html" />
     <link rel="index" title="Index" href="../genindex.html" />
     <link rel="search" title="Search" href="../search.html" />
     <link rel="copyright" title="Copyright" href="../copyright.html" />
-    <link rel="next" title="Other Graphical User Interface Packages" href="othergui.html" />
+    <link rel="next" title="Development Tools" href="development.html" />
     <link rel="prev" title="tkinter.tix — Extension widgets for Tk" href="tkinter.tix.html" />
     <link rel="canonical" href="https://docs.python.org/3/library/idle.html" />
 
@@ -32,7 +32,6 @@
 
 
 
-
     <style>
       @media only screen {
         table.full-width-table {
@@ -60,7 +59,7 @@
           <a href="../py-modindex.html" title="Python Module Index"
              >modules</a> |</li>
         <li class="right" >
-          <a href="othergui.html" title="Other Graphical User Interface Packages"
+          <a href="development.html" title="Development Tools"
              accesskey="N">next</a> |</li>
         <li class="right" >
           <a href="tkinter.tix.html" title="tkinter.tix — Extension widgets for Tk"
@@ -71,8 +70,8 @@
     <li><a href="https://www.python.org/">Python</a> &#187;</li>
 
 
-    <li>
-      <a href="../index.html">3.10.0a1 Documentation</a> &#187;
+    <li id="cpython-language-and-version">
+      <a href="../index.html">3.11.0a4 Documentation</a> &#187;
     </li>
 
           <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>
@@ -103,7 +102,7 @@
 
   <div class="section" id="idle">
 <span id="id1"></span><h1>IDLE<a class="headerlink" href="#idle" title="Permalink to this headline">¶</a></h1>
-<p><strong>Source code:</strong> <a class="reference external" href="https://github.com/python/cpython/tree/master/Lib/idlelib/">Lib/idlelib/</a></p>
+<p><strong>Source code:</strong> <a class="reference external" href="https://github.com/python/cpython/tree/main/Lib/idlelib/">Lib/idlelib/</a></p>
 <hr class="docutils" id="index-0" />
 <p>IDLE is Python’s Integrated Development and Learning Environment.</p>
 <p>IDLE has the following features:</p>
@@ -164,9 +163,11 @@
 </dd>
 <dt>Print Window</dt><dd><p>Print the current window to the default printer.</p>
 </dd>
-<dt>Close</dt><dd><p>Close the current window (ask to save if unsaved).</p>
+<dt>Close Window</dt><dd><p>Close the current window (if an unsaved editor, ask to save; if an unsaved
+Shell, ask to quit execution).  Calling <code class="docutils literal notranslate"><span class="pre">exit()</span></code> or <code class="docutils literal notranslate"><span class="pre">close()</span></code> in the Shell
+window also closes Shell.  If this is the only window, also exit IDLE.</p>
 </dd>
-<dt>Exit</dt><dd><p>Close all windows and quit IDLE (ask to save unsaved windows).</p>
+<dt>Exit IDLE</dt><dd><p>Close all windows and quit IDLE (ask to save unsaved edit windows).</p>
 </dd>
 </dl>
 </div>
@@ -285,7 +286,7 @@
 <dl class="simple">
 <dt>View Last Restart</dt><dd><p>Scroll the shell window to the last Shell restart.</p>
 </dd>
-<dt>Restart Shell</dt><dd><p>Restart the shell to clean the environment.</p>
+<dt>Restart Shell</dt><dd><p>Restart the shell to clean the environment and reset display and exception handling.</p>
 </dd>
 <dt>Previous History</dt><dd><p>Cycle through earlier commands in history which match the current entry.</p>
 </dd>
@@ -505,7 +506,7 @@
 and not restarting the Shell thereafter.  This is especially useful
 after adding imports at the top of a file.  This also increases
 possible attribute completions.</p>
-<p>Completion boxes intially exclude names beginning with ‘_’ or, for
+<p>Completion boxes initially exclude names beginning with ‘_’ or, for
 modules, not included in ‘__all__’.  The hidden names can be accessed
 by typing ‘_’ after ‘.’, either before or after the box is opened.</p>
 </div>
@@ -582,6 +583,11 @@
 keywords, builtin class and function names, names following <code class="docutils literal notranslate"><span class="pre">class</span></code> and
 <code class="docutils literal notranslate"><span class="pre">def</span></code>, strings, and comments. For any text window, these are the cursor (when
 present), found text (when possible), and selected text.</p>
+<p>IDLE also highlights the <a class="reference internal" href="../reference/lexical_analysis.html#soft-keywords"><span class="std std-ref">soft keywords</span></a> <a class="reference internal" href="../reference/compound_stmts.html#match"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">match</span></code></a>,
+<a class="reference internal" href="../reference/compound_stmts.html#match"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">case</span></code></a>, and <a class="reference internal" href="../reference/compound_stmts.html#wildcard-patterns"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">_</span></code></a> in
+pattern-matching statements. However, this highlighting is not perfect and
+will be incorrect in some rare cases, including some <code class="docutils literal notranslate"><span class="pre">_</span></code>-s in <code class="docutils literal notranslate"><span class="pre">case</span></code>
+patterns.</p>
 <p>Text coloring is done in the background, so uncolorized text is occasionally
 visible.  To change the color scheme, use the Configure IDLE dialog
 Highlighting tab.  The marking of debugger breakpoint lines in the editor and
@@ -633,8 +639,15 @@
 code execution process.  A connection must be established whenever the Shell
 starts or restarts.  (The latter is indicated by a divider line that says
 ‘RESTART’). If the user process fails to connect to the GUI process, it
-displays a <code class="docutils literal notranslate"><span class="pre">Tk</span></code> error box with a ‘cannot connect’ message that directs the
-user here.  It then exits.</p>
+usually displays a <code class="docutils literal notranslate"><span class="pre">Tk</span></code> error box with a ‘cannot connect’ message
+that directs the user here.  It then exits.</p>
+<p>One specific connection failure on Unix systems results from
+misconfigured masquerading rules somewhere in a system’s network setup.
+When IDLE is started from a terminal, one will see a message starting
+with <code class="docutils literal notranslate"><span class="pre">**</span> <span class="pre">Invalid</span> <span class="pre">host:</span></code>.
+The valid value is <code class="docutils literal notranslate"><span class="pre">127.0.0.1</span> <span class="pre">(idlelib.rpc.LOCALHOST)</span></code>.
+One can diagnose with <code class="docutils literal notranslate"><span class="pre">tcpconnect</span> <span class="pre">-irv</span> <span class="pre">127.0.0.1</span> <span class="pre">6543</span></code> in one
+terminal window and <code class="docutils literal notranslate"><span class="pre">tcplisten</span> <span class="pre">&lt;same</span> <span class="pre">args&gt;</span></code> in another.</p>
 <p>A common cause of failure is a user-written file with the same name as a
 standard library module, such as <em>random.py</em> and <em>tkinter.py</em>. When such a
 file is located in the same directory as a file that is about to be run,
@@ -665,6 +678,12 @@
 <p>If IDLE quits with no message, and it was not started from a console, try
 starting it from a console or terminal (<code class="docutils literal notranslate"><span class="pre">python</span> <span class="pre">-m</span> <span class="pre">idlelib</span></code>) and see if
 this results in an error message.</p>
+<p>On Unix-based systems with tcl/tk older than <code class="docutils literal notranslate"><span class="pre">8.6.11</span></code> (see
+<code class="docutils literal notranslate"><span class="pre">About</span> <span class="pre">IDLE</span></code>) certain characters of certain fonts can cause
+a tk failure with a message to the terminal.  This can happen either
+if one starts IDLE to edit a file with such a character or later
+when entering such a character.  If one cannot upgrade tcl/tk,
+then re-configure IDLE to use a font that works better.</p>
 </div>
 <div class="section" id="running-user-code">
 <h3>Running user code<a class="headerlink" href="#running-user-code" title="Permalink to this headline">¶</a></h3>
@@ -673,31 +692,40 @@
 directly with Python in a text-mode system console or terminal window.
 However, the different interface and operation occasionally affect
 visible results.  For instance, <code class="docutils literal notranslate"><span class="pre">sys.modules</span></code> starts with more entries,
-and <code class="docutils literal notranslate"><span class="pre">threading.activeCount()</span></code> returns 2 instead of 1.</p>
+and <code class="docutils literal notranslate"><span class="pre">threading.active_count()</span></code> returns 2 instead of 1.</p>
 <p>By default, IDLE runs user code in a separate OS process rather than in
 the user interface process that runs the shell and editor.  In the execution
 process, it replaces <code class="docutils literal notranslate"><span class="pre">sys.stdin</span></code>, <code class="docutils literal notranslate"><span class="pre">sys.stdout</span></code>, and <code class="docutils literal notranslate"><span class="pre">sys.stderr</span></code>
 with objects that get input from and send output to the Shell window.
 The original values stored in <code class="docutils literal notranslate"><span class="pre">sys.__stdin__</span></code>, <code class="docutils literal notranslate"><span class="pre">sys.__stdout__</span></code>, and
 <code class="docutils literal notranslate"><span class="pre">sys.__stderr__</span></code> are not touched, but may be <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
+<p>Sending print output from one process to a text widget in another is
+slower than printing to a system terminal in the same process.
+This has the most effect when printing multiple arguments, as the string
+for each argument, each separator, the newline are sent separately.
+For development, this is usually not a problem, but if one wants to
+print faster in IDLE, format and join together everything one wants
+displayed together and then print a single string.  Both format strings
+and <a class="reference internal" href="stdtypes.html#str.join" title="str.join"><code class="xref py py-meth docutils literal notranslate"><span class="pre">str.join()</span></code></a> can help combine fields and lines.</p>
+<p>IDLE’s standard stream replacements are not inherited by subprocesses
+created in the execution process, whether directly by user code or by
+modules such as multiprocessing.  If such subprocess use <code class="docutils literal notranslate"><span class="pre">input</span></code> from
+sys.stdin or <code class="docutils literal notranslate"><span class="pre">print</span></code> or <code class="docutils literal notranslate"><span class="pre">write</span></code> to sys.stdout or sys.stderr,
+IDLE should be started in a command line window.  The secondary subprocess
+will then be attached to that window for input and output.</p>
+<p>If <code class="docutils literal notranslate"><span class="pre">sys</span></code> is reset by user code, such as with <code class="docutils literal notranslate"><span class="pre">importlib.reload(sys)</span></code>,
+IDLE’s changes are lost and input from the keyboard and output to the screen
+will not work correctly.</p>
 <p>When Shell has the focus, it controls the keyboard and screen.  This is
 normally transparent, but functions that directly access the keyboard
 and screen will not work.  These include system-specific functions that
 determine whether a key has been pressed and if so, which.</p>
-<p>IDLE’s standard stream replacements are not inherited by subprocesses
-created in the execution process, whether directly by user code or by modules
-such as multiprocessing.  If such subprocess use <code class="docutils literal notranslate"><span class="pre">input</span></code> from sys.stdin
-or <code class="docutils literal notranslate"><span class="pre">print</span></code> or <code class="docutils literal notranslate"><span class="pre">write</span></code> to sys.stdout or sys.stderr,
-IDLE should be started in a command line window.  The secondary subprocess
-will then be attached to that window for input and output.</p>
 <p>The IDLE code running in the execution process adds frames to the call stack
 that would not be there otherwise.  IDLE wraps <code class="docutils literal notranslate"><span class="pre">sys.getrecursionlimit</span></code> and
-<code class="docutils literal notranslate"><span class="pre">sys.setrecursionlimit</span></code> to reduce the effect of the additional stack frames.</p>
-<p>If <code class="docutils literal notranslate"><span class="pre">sys</span></code> is reset by user code, such as with <code class="docutils literal notranslate"><span class="pre">importlib.reload(sys)</span></code>,
-IDLE’s changes are lost and input from the keyboard and output to the screen
-will not work correctly.</p>
-<p>When user code raises SystemExit either directly or by calling sys.exit, IDLE
-returns to a Shell prompt instead of exiting.</p>
+<code class="docutils literal notranslate"><span class="pre">sys.setrecursionlimit</span></code> to reduce the effect of the additional stack
+frames.</p>
+<p>When user code raises SystemExit either directly or by calling sys.exit,
+IDLE returns to a Shell prompt instead of exiting.</p>
 </div>
 <div class="section" id="user-output-in-shell">
 <h3>User output in Shell<a class="headerlink" href="#user-output-in-shell" title="Permalink to this headline">¶</a></h3>
@@ -777,7 +805,7 @@
 <h3>Running without a subprocess<a class="headerlink" href="#running-without-a-subprocess" title="Permalink to this headline">¶</a></h3>
 <p>By default, IDLE executes user code in a separate subprocess via a socket,
 which uses the internal loopback interface.  This connection is not
-externally visible and no data is sent to or received from the Internet.
+externally visible and no data is sent to or received from the internet.
 If firewall software complains anyway, you can ignore it.</p>
 <p>If the attempt to make the socket connection fails, Idle will notify you.
 Such failures are sometimes transient, but if persistent, the problem
@@ -911,14 +939,14 @@
   <p class="topless"><a href="tkinter.tix.html"
                         title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">tkinter.tix</span></code> — Extension widgets for Tk</a></p>
   <h4>Next topic</h4>
-  <p class="topless"><a href="othergui.html"
-                        title="next chapter">Other Graphical User Interface Packages</a></p>
+  <p class="topless"><a href="development.html"
+                        title="next chapter">Development Tools</a></p>
   <div role="note" aria-label="source link">
     <h3>This Page</h3>
     <ul class="this-page-menu">
       <li><a href="../bugs.html">Report a Bug</a></li>
       <li>
-        <a href="https://github.com/python/cpython/blob/master/Doc/library/idle.rst"
+        <a href="https://github.com/python/cpython/blob/main/Doc/library/idle.rst"
             rel="nofollow">Show Source
         </a>
       </li>
@@ -938,7 +966,7 @@
           <a href="../py-modindex.html" title="Python Module Index"
              >modules</a> |</li>
         <li class="right" >
-          <a href="othergui.html" title="Other Graphical User Interface Packages"
+          <a href="development.html" title="Development Tools"
              >next</a> |</li>
         <li class="right" >
           <a href="tkinter.tix.html" title="tkinter.tix — Extension widgets for Tk"
@@ -949,8 +977,8 @@
     <li><a href="https://www.python.org/">Python</a> &#187;</li>
 
 
-    <li>
-      <a href="../index.html">3.10.0a1 Documentation</a> &#187;
+    <li id="cpython-language-and-version">
+      <a href="../index.html">3.11.0a4 Documentation</a> &#187;
     </li>
 
           <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>
@@ -974,7 +1002,7 @@
       </ul>
     </div>
     <div class="footer">
-    &copy; <a href="../copyright.html">Copyright</a> 2001-2020, Python Software Foundation.
+    &copy; <a href="../copyright.html">Copyright</a> 2001-2022, Python Software Foundation.
     <br />
 
     The Python Software Foundation is a non-profit corporation.
@@ -982,8 +1010,8 @@
 <br />
     <br />
 
-    Last updated on Oct 20, 2020.
-    <a href="https://docs.python.org/3/bugs.html">Found a bug</a>?
+    Last updated on Jan 26, 2022.
+    <a href="/bugs.html">Found a bug</a>?
     <br />
 
     Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.2.1.
diff --git a/Lib/idlelib/help_about.py b/Lib/idlelib/help_about.py
index 64b13ac..c59f494 100644
--- a/Lib/idlelib/help_about.py
+++ b/Lib/idlelib/help_about.py
@@ -3,6 +3,7 @@
 """
 import os
 import sys
+import webbrowser
 from platform import python_version, architecture
 
 from tkinter import Toplevel, Frame, Label, Button, PhotoImage
@@ -10,6 +11,8 @@
 
 from idlelib import textview
 
+version = python_version()
+
 
 def build_bits():
     "Return bits for platform."
@@ -42,7 +45,7 @@
         self.create_widgets()
         self.resizable(height=False, width=False)
         self.title(title or
-                   f'About IDLE {python_version()} ({build_bits()} bit)')
+                   f'About IDLE {version} ({build_bits()} bit)')
         self.transient(parent)
         self.grab_set()
         self.protocol("WM_DELETE_WINDOW", self.ok)
@@ -88,17 +91,18 @@
         email = Label(frame_background, text='email:  idle-dev@python.org',
                       justify=LEFT, fg=self.fg, bg=self.bg)
         email.grid(row=6, column=0, columnspan=2, sticky=W, padx=10, pady=0)
-        docs = Label(frame_background, text='https://docs.python.org/' +
-                     python_version()[:3] + '/library/idle.html',
+        docs = Label(frame_background, text="https://docs.python.org/"
+                     f"{version[:version.rindex('.')]}/library/idle.html",
                      justify=LEFT, fg=self.fg, bg=self.bg)
         docs.grid(row=7, column=0, columnspan=2, sticky=W, padx=10, pady=0)
+        docs.bind("<Button-1>", lambda event: webbrowser.open(docs['text']))
 
         Frame(frame_background, borderwidth=1, relief=SUNKEN,
               height=2, bg=self.bg).grid(row=8, column=0, sticky=EW,
                                          columnspan=3, padx=5, pady=5)
 
         pyver = Label(frame_background,
-                      text='Python version:  ' + python_version(),
+                      text='Python version:  ' + version,
                       fg=self.fg, bg=self.bg)
         pyver.grid(row=9, column=0, sticky=W, padx=10, pady=0)
         tkver = Label(frame_background, text='Tk version:  ' + tk_patchlevel,
@@ -124,7 +128,7 @@
                                          columnspan=3, padx=5, pady=5)
 
         idlever = Label(frame_background,
-                        text='IDLE version:   ' + python_version(),
+                        text='IDLE version:   ' + version,
                         fg=self.fg, bg=self.bg)
         idlever.grid(row=12, column=0, sticky=W, padx=10, pady=0)
         idle_buttons = Frame(frame_background, bg=self.bg)
diff --git a/Lib/idlelib/history.py b/Lib/idlelib/history.py
index ad44a96..7ce0925 100644
--- a/Lib/idlelib/history.py
+++ b/Lib/idlelib/history.py
@@ -74,13 +74,13 @@
                 else:
                     if self.text.get("iomark", "end-1c") != prefix:
                         self.text.delete("iomark", "end-1c")
-                        self.text.insert("iomark", prefix)
+                        self.text.insert("iomark", prefix, "stdin")
                     pointer = prefix = None
                 break
             item = self.history[pointer]
             if item[:nprefix] == prefix and len(item) > nprefix:
                 self.text.delete("iomark", "end-1c")
-                self.text.insert("iomark", item)
+                self.text.insert("iomark", item, "stdin")
                 break
         self.text.see("insert")
         self.text.tag_remove("sel", "1.0", "end")
diff --git a/Lib/idlelib/idle_test/example_noext b/Lib/idlelib/idle_test/example_noext
new file mode 100644
index 0000000..7d2510e
--- /dev/null
+++ b/Lib/idlelib/idle_test/example_noext
@@ -0,0 +1,4 @@
+#!usr/bin/env python
+
+def example_function(some_argument):
+    pass
diff --git a/Lib/idlelib/idle_test/example_stub.pyi b/Lib/idlelib/idle_test/example_stub.pyi
new file mode 100644
index 0000000..a9811a7
--- /dev/null
+++ b/Lib/idlelib/idle_test/example_stub.pyi
@@ -0,0 +1,2 @@
+class Example:
+    def method(self, argument1: str, argument2: list[int]) -> None: ...
diff --git a/Lib/idlelib/idle_test/htest.py b/Lib/idlelib/idle_test/htest.py
index 1373b76..d297f8a 100644
--- a/Lib/idlelib/idle_test/htest.py
+++ b/Lib/idlelib/idle_test/htest.py
@@ -77,8 +77,8 @@
     'kwds': {'title': 'help_about test',
              '_htest': True,
              },
-    'msg': "Test every button. Ensure Python, TK and IDLE versions "
-           "are correctly displayed.\n [Close] to exit.",
+    'msg': "Click on URL to open in default browser.\n"
+           "Verify x.y.z versions and test each button, including Close.\n "
     }
 
 # TODO implement ^\; adding '<Control-Key-\\>' to function does not work.
@@ -246,7 +246,7 @@
 _object_browser_spec = {
     'file': 'debugobj',
     'kwds': {},
-    'msg': "Double click on items upto the lowest level.\n"
+    'msg': "Double click on items up to the lowest level.\n"
            "Attributes of the objects and related information "
            "will be displayed side-by-side at each level."
     }
@@ -255,7 +255,7 @@
     'file': 'pathbrowser',
     'kwds': {},
     'msg': "Test for correct display of all paths in sys.path.\n"
-           "Toggle nested items upto the lowest level.\n"
+           "Toggle nested items up to the lowest level.\n"
            "Double clicking on an item prints a traceback\n"
            "for an exception that is ignored."
     }
@@ -341,7 +341,7 @@
     'file': 'tree',
     'kwds': {},
     'msg': "The canvas is scrollable.\n"
-           "Click on folders upto to the lowest level."
+           "Click on folders up to to the lowest level."
     }
 
 _undo_delegator_spec = {
diff --git a/Lib/idlelib/idle_test/mock_tk.py b/Lib/idlelib/idle_test/mock_tk.py
index b736bd0..8304734 100644
--- a/Lib/idlelib/idle_test/mock_tk.py
+++ b/Lib/idlelib/idle_test/mock_tk.py
@@ -59,28 +59,27 @@
 class Mbox:
     """Mock for tkinter.messagebox with an Mbox_func for each function.
 
-    This module was 'tkMessageBox' in 2.x; hence the 'import as' in  3.x.
     Example usage in test_module.py for testing functions in module.py:
     ---
 from idlelib.idle_test.mock_tk import Mbox
 import module
 
-orig_mbox = module.tkMessageBox
+orig_mbox = module.messagebox
 showerror = Mbox.showerror  # example, for attribute access in test methods
 
 class Test(unittest.TestCase):
 
     @classmethod
     def setUpClass(cls):
-        module.tkMessageBox = Mbox
+        module.messagebox = Mbox
 
     @classmethod
     def tearDownClass(cls):
-        module.tkMessageBox = orig_mbox
+        module.messagebox = orig_mbox
     ---
     For 'ask' functions, set func.result return value before calling the method
-    that uses the message function. When tkMessageBox functions are the
-    only gui alls in a method, this replacement makes the method gui-free,
+    that uses the message function. When messagebox functions are the
+    only GUI calls in a method, this replacement makes the method GUI-free,
     """
     askokcancel = Mbox_func()     # True or False
     askquestion = Mbox_func()     # 'yes' or 'no'
diff --git a/Lib/idlelib/idle_test/test_autocomplete.py b/Lib/idlelib/idle_test/test_autocomplete.py
index 9c113bd..a811363 100644
--- a/Lib/idlelib/idle_test/test_autocomplete.py
+++ b/Lib/idlelib/idle_test/test_autocomplete.py
@@ -195,7 +195,7 @@
         self.assertFalse(acp.open_completions(ac.TAB))
         self.text.delete('1.0', 'end')
 
-    class dummy_acw():
+    class dummy_acw:
         __init__ = Func()
         show_window = Func(result=False)
         hide_window = Func()
@@ -218,6 +218,11 @@
         self.assertTrue(acp.open_completions(ac.TAB))
         self.text.delete('1.0', 'end')
 
+    def test_completion_kwds(self):
+        self.assertIn('and', ac.completion_kwds)
+        self.assertIn('case', ac.completion_kwds)
+        self.assertNotIn('None', ac.completion_kwds)
+
     def test_fetch_completions(self):
         # Test that fetch_completions returns 2 lists:
         # For attribute completion, a large list containing all variables, and
diff --git a/Lib/idlelib/idle_test/test_autocomplete_w.py b/Lib/idlelib/idle_test/test_autocomplete_w.py
index b1bdc6c..a59a375 100644
--- a/Lib/idlelib/idle_test/test_autocomplete_w.py
+++ b/Lib/idlelib/idle_test/test_autocomplete_w.py
@@ -15,7 +15,7 @@
         cls.root = Tk()
         cls.root.withdraw()
         cls.text = Text(cls.root)
-        cls.acw = acw.AutoCompleteWindow(cls.text)
+        cls.acw = acw.AutoCompleteWindow(cls.text, tags=None)
 
     @classmethod
     def tearDownClass(cls):
diff --git a/Lib/idlelib/idle_test/test_browser.py b/Lib/idlelib/idle_test/test_browser.py
index 25d6dc6..03a50f2 100644
--- a/Lib/idlelib/idle_test/test_browser.py
+++ b/Lib/idlelib/idle_test/test_browser.py
@@ -61,15 +61,15 @@
 # Nested tree same as in test_pyclbr.py except for supers on C0. C1.
 mb = pyclbr
 module, fname = 'test', 'test.py'
-C0 = mb.Class(module, 'C0', ['base'], fname, 1)
-F1 = mb._nest_function(C0, 'F1', 3)
-C1 = mb._nest_class(C0, 'C1', 6, [''])
-C2 = mb._nest_class(C1, 'C2', 7)
-F3 = mb._nest_function(C2, 'F3', 9)
-f0 = mb.Function(module, 'f0', fname, 11)
-f1 = mb._nest_function(f0, 'f1', 12)
-f2 = mb._nest_function(f1, 'f2', 13)
-c1 = mb._nest_class(f0, 'c1', 15)
+C0 = mb.Class(module, 'C0', ['base'], fname, 1, end_lineno=9)
+F1 = mb._nest_function(C0, 'F1', 3, 5)
+C1 = mb._nest_class(C0, 'C1', 6, 9, [''])
+C2 = mb._nest_class(C1, 'C2', 7, 9)
+F3 = mb._nest_function(C2, 'F3', 9, 9)
+f0 = mb.Function(module, 'f0', fname, 11, end_lineno=15)
+f1 = mb._nest_function(f0, 'f1', 12, 14)
+f2 = mb._nest_function(f1, 'f2', 13, 13)
+c1 = mb._nest_class(f0, 'c1', 15, 15)
 mock_pyclbr_tree = {'C0': C0, 'f0': f0}
 
 # Adjust C0.name, C1.name so tests do not depend on order.
diff --git a/Lib/idlelib/idle_test/test_calltip.py b/Lib/idlelib/idle_test/test_calltip.py
index a76829f..e8d2bd1 100644
--- a/Lib/idlelib/idle_test/test_calltip.py
+++ b/Lib/idlelib/idle_test/test_calltip.py
@@ -10,7 +10,7 @@
 
 
 # Test Class TC is used in multiple get_argspec test methods
-class TC():
+class TC:
     'doc'
     tip = "(ai=None, *b)"
     def __init__(self, ai=None, *b): 'doc'
@@ -106,7 +106,7 @@
 If you want to completely replace the main wrapping algorithm,
 you\'ll probably have to override _wrap_chunks().''')
 
-    def test_properly_formated(self):
+    def test_properly_formatted(self):
 
         def foo(s='a'*100):
             pass
@@ -268,7 +268,7 @@
 # open_calltip is about half the code; the others are fairly trivial.
 # The default mocks are what are needed for open_calltip.
 
-class mock_Shell():
+class mock_Shell:
     "Return mock sufficient to pass to hyperparser."
     def __init__(self, text):
         text.tag_prevrange = Mock(return_value=None)
diff --git a/Lib/idlelib/idle_test/test_codecontext.py b/Lib/idlelib/idle_test/test_codecontext.py
index 9578cc7..6969ad7 100644
--- a/Lib/idlelib/idle_test/test_codecontext.py
+++ b/Lib/idlelib/idle_test/test_codecontext.py
@@ -20,7 +20,7 @@
 }
 code_sample = """\
 
-class C1():
+class C1:
     # Class comment.
     def __init__(self, a, b):
         self.a = a
@@ -178,29 +178,29 @@
         with self.assertRaises(AssertionError):
             gc(1, stopline=0)
 
-        eq(gc(3), ([(2, 0, 'class C1():', 'class')], 0))
+        eq(gc(3), ([(2, 0, 'class C1:', 'class')], 0))
 
         # Don't return comment.
-        eq(gc(4), ([(2, 0, 'class C1():', 'class')], 0))
+        eq(gc(4), ([(2, 0, 'class C1:', 'class')], 0))
 
         # Two indentation levels and no comment.
-        eq(gc(5), ([(2, 0, 'class C1():', 'class'),
+        eq(gc(5), ([(2, 0, 'class C1:', 'class'),
                     (4, 4, '    def __init__(self, a, b):', 'def')], 0))
 
         # Only one 'def' is returned, not both at the same indent level.
-        eq(gc(10), ([(2, 0, 'class C1():', 'class'),
+        eq(gc(10), ([(2, 0, 'class C1:', 'class'),
                      (7, 4, '    def compare(self):', 'def'),
                      (8, 8, '        if a > b:', 'if')], 0))
 
         # With 'elif', also show the 'if' even though it's at the same level.
-        eq(gc(11), ([(2, 0, 'class C1():', 'class'),
+        eq(gc(11), ([(2, 0, 'class C1:', 'class'),
                      (7, 4, '    def compare(self):', 'def'),
                      (8, 8, '        if a > b:', 'if'),
                      (10, 8, '        elif a < b:', 'elif')], 0))
 
         # Set stop_line to not go back to first line in source code.
         # Return includes stop_line.
-        eq(gc(11, stopline=2), ([(2, 0, 'class C1():', 'class'),
+        eq(gc(11, stopline=2), ([(2, 0, 'class C1:', 'class'),
                                  (7, 4, '    def compare(self):', 'def'),
                                  (8, 8, '        if a > b:', 'if'),
                                  (10, 8, '        elif a < b:', 'elif')], 0))
@@ -240,37 +240,37 @@
         # Scroll down to line 2.
         cc.text.yview(2)
         cc.update_code_context()
-        eq(cc.info, [(0, -1, '', False), (2, 0, 'class C1():', 'class')])
+        eq(cc.info, [(0, -1, '', False), (2, 0, 'class C1:', 'class')])
         eq(cc.topvisible, 3)
-        eq(cc.context.get('1.0', 'end-1c'), 'class C1():')
+        eq(cc.context.get('1.0', 'end-1c'), 'class C1:')
 
         # Scroll down to line 3.  Since it's a comment, nothing changes.
         cc.text.yview(3)
         cc.update_code_context()
-        eq(cc.info, [(0, -1, '', False), (2, 0, 'class C1():', 'class')])
+        eq(cc.info, [(0, -1, '', False), (2, 0, 'class C1:', 'class')])
         eq(cc.topvisible, 4)
-        eq(cc.context.get('1.0', 'end-1c'), 'class C1():')
+        eq(cc.context.get('1.0', 'end-1c'), 'class C1:')
 
         # Scroll down to line 4.
         cc.text.yview(4)
         cc.update_code_context()
         eq(cc.info, [(0, -1, '', False),
-                     (2, 0, 'class C1():', 'class'),
+                     (2, 0, 'class C1:', 'class'),
                      (4, 4, '    def __init__(self, a, b):', 'def')])
         eq(cc.topvisible, 5)
-        eq(cc.context.get('1.0', 'end-1c'), 'class C1():\n'
+        eq(cc.context.get('1.0', 'end-1c'), 'class C1:\n'
                                             '    def __init__(self, a, b):')
 
         # Scroll down to line 11.  Last 'def' is removed.
         cc.text.yview(11)
         cc.update_code_context()
         eq(cc.info, [(0, -1, '', False),
-                     (2, 0, 'class C1():', 'class'),
+                     (2, 0, 'class C1:', 'class'),
                      (7, 4, '    def compare(self):', 'def'),
                      (8, 8, '        if a > b:', 'if'),
                      (10, 8, '        elif a < b:', 'elif')])
         eq(cc.topvisible, 12)
-        eq(cc.context.get('1.0', 'end-1c'), 'class C1():\n'
+        eq(cc.context.get('1.0', 'end-1c'), 'class C1:\n'
                                             '    def compare(self):\n'
                                             '        if a > b:\n'
                                             '        elif a < b:')
@@ -279,12 +279,12 @@
         cc.update_code_context()
         cc.context_depth = 1
         eq(cc.info, [(0, -1, '', False),
-                     (2, 0, 'class C1():', 'class'),
+                     (2, 0, 'class C1:', 'class'),
                      (7, 4, '    def compare(self):', 'def'),
                      (8, 8, '        if a > b:', 'if'),
                      (10, 8, '        elif a < b:', 'elif')])
         eq(cc.topvisible, 12)
-        eq(cc.context.get('1.0', 'end-1c'), 'class C1():\n'
+        eq(cc.context.get('1.0', 'end-1c'), 'class C1:\n'
                                             '    def compare(self):\n'
                                             '        if a > b:\n'
                                             '        elif a < b:')
@@ -293,7 +293,7 @@
         cc.text.yview(5)
         cc.update_code_context()
         eq(cc.info, [(0, -1, '', False),
-                     (2, 0, 'class C1():', 'class'),
+                     (2, 0, 'class C1:', 'class'),
                      (4, 4, '    def __init__(self, a, b):', 'def')])
         eq(cc.topvisible, 6)
         # context_depth is 1.
@@ -440,7 +440,7 @@
         # Line 1 is not a BLOCKOPENER.
         eq(gli(lines[0]), (codecontext.INFINITY, '', False))
         # Line 2 is a BLOCKOPENER without an indent.
-        eq(gli(lines[1]), (0, 'class C1():', 'class'))
+        eq(gli(lines[1]), (0, 'class C1:', 'class'))
         # Line 3 is not a BLOCKOPENER and does not return the indent level.
         eq(gli(lines[2]), (codecontext.INFINITY, '    # Class comment.', False))
         # Line 4 is a BLOCKOPENER and is indented.
diff --git a/Lib/idlelib/idle_test/test_colorizer.py b/Lib/idlelib/idle_test/test_colorizer.py
index c31c492..308bc38 100644
--- a/Lib/idlelib/idle_test/test_colorizer.py
+++ b/Lib/idlelib/idle_test/test_colorizer.py
@@ -1,11 +1,12 @@
-"Test colorizer, coverage 93%."
-
+"Test colorizer, coverage 99%."
 from idlelib import colorizer
 from test.support import requires
 import unittest
 from unittest import mock
+from idlelib.idle_test.tkinter_testing_utils import run_in_tk_mainloop
 
 from functools import partial
+import textwrap
 from tkinter import Tk, Text
 from idlelib import config
 from idlelib.percolator import Percolator
@@ -19,15 +20,38 @@
     'extensions': config.IdleUserConfParser(''),
 }
 
-source = (
-    "if True: int ('1') # keyword, builtin, string, comment\n"
-    "elif False: print(0)  # 'string' in comment\n"
-    "else: float(None)  # if in comment\n"
-    "if iF + If + IF: 'keyword matching must respect case'\n"
-    "if'': x or''  # valid string-keyword no-space combinations\n"
-    "async def f(): await g()\n"
-    "'x', '''x''', \"x\", \"\"\"x\"\"\"\n"
-    )
+source = textwrap.dedent("""\
+    if True: int ('1') # keyword, builtin, string, comment
+    elif False: print(0)  # 'string' in comment
+    else: float(None)  # if in comment
+    if iF + If + IF: 'keyword matching must respect case'
+    if'': x or''  # valid keyword-string no-space combinations
+    async def f(): await g()
+    # Strings should be entirely colored, including quotes.
+    'x', '''x''', "x", \"""x\"""
+    'abc\\
+    def'
+    '''abc\\
+    def'''
+    # All valid prefixes for unicode and byte strings should be colored.
+    r'x', u'x', R'x', U'x', f'x', F'x'
+    fr'x', Fr'x', fR'x', FR'x', rf'x', rF'x', Rf'x', RF'x'
+    b'x',B'x', br'x',Br'x',bR'x',BR'x', rb'x', rB'x',Rb'x',RB'x'
+    # Invalid combinations of legal characters should be half colored.
+    ur'x', ru'x', uf'x', fu'x', UR'x', ufr'x', rfu'x', xf'x', fx'x'
+    match point:
+        case (x, 0) as _:
+            print(f"X={x}")
+        case [_, [_], "_",
+                _]:
+            pass
+        case _ if ("a" if _ else set()): pass
+        case _:
+            raise ValueError("Not a point _")
+    '''
+    case _:'''
+    "match x:"
+    """)
 
 
 def setUpModule():
@@ -107,7 +131,7 @@
         requires('gui')
         root = cls.root = Tk()
         root.withdraw()
-        text = cls.text = Text(root)
+        cls.text = Text(root)
 
     @classmethod
     def tearDownClass(cls):
@@ -152,7 +176,7 @@
 
     @classmethod
     def tearDownClass(cls):
-        cls.percolator.redir.close()
+        cls.percolator.close()
         del cls.percolator, cls.text
         cls.root.update_idletasks()
         cls.root.destroy()
@@ -364,8 +388,21 @@
                     ('4.0', ('KEYWORD',)), ('4.3', ()), ('4.6', ()),
                     ('5.2', ('STRING',)), ('5.8', ('KEYWORD',)), ('5.10', ('STRING',)),
                     ('6.0', ('KEYWORD',)), ('6.10', ('DEFINITION',)), ('6.11', ()),
-                    ('7.0', ('STRING',)), ('7.4', ()), ('7.5', ('STRING',)),
-                    ('7.12', ()), ('7.14', ('STRING',)),
+                    ('8.0', ('STRING',)), ('8.4', ()), ('8.5', ('STRING',)),
+                    ('8.12', ()), ('8.14', ('STRING',)),
+                    ('19.0', ('KEYWORD',)),
+                    ('20.4', ('KEYWORD',)), ('20.16', ('KEYWORD',)),# ('20.19', ('KEYWORD',)),
+                    #('22.4', ('KEYWORD',)), ('22.10', ('KEYWORD',)), ('22.14', ('KEYWORD',)), ('22.19', ('STRING',)),
+                    #('23.12', ('KEYWORD',)),
+                    ('24.8', ('KEYWORD',)),
+                    ('25.4', ('KEYWORD',)), ('25.9', ('KEYWORD',)),
+                    ('25.11', ('KEYWORD',)), ('25.15', ('STRING',)),
+                    ('25.19', ('KEYWORD',)), ('25.22', ()),
+                    ('25.24', ('KEYWORD',)), ('25.29', ('BUILTIN',)), ('25.37', ('KEYWORD',)),
+                    ('26.4', ('KEYWORD',)), ('26.9', ('KEYWORD',)),# ('26.11', ('KEYWORD',)), ('26.14', (),),
+                    ('27.25', ('STRING',)), ('27.38', ('STRING',)),
+                    ('29.0', ('STRING',)),
+                    ('30.1', ('STRING',)),
                     # SYNC at the end of every line.
                     ('1.55', ('SYNC',)), ('2.50', ('SYNC',)), ('3.34', ('SYNC',)),
                    )
@@ -391,11 +428,173 @@
         eq(text.tag_nextrange('COMMENT', '2.0'), ('2.22', '2.43'))
         eq(text.tag_nextrange('SYNC', '2.0'), ('2.43', '3.0'))
         eq(text.tag_nextrange('STRING', '2.0'), ('4.17', '4.53'))
-        eq(text.tag_nextrange('STRING', '7.0'), ('7.0', '7.3'))
-        eq(text.tag_nextrange('STRING', '7.3'), ('7.5', '7.12'))
-        eq(text.tag_nextrange('STRING', '7.12'), ('7.14', '7.17'))
-        eq(text.tag_nextrange('STRING', '7.17'), ('7.19', '7.26'))
-        eq(text.tag_nextrange('SYNC', '7.0'), ('7.26', '9.0'))
+        eq(text.tag_nextrange('STRING', '8.0'), ('8.0', '8.3'))
+        eq(text.tag_nextrange('STRING', '8.3'), ('8.5', '8.12'))
+        eq(text.tag_nextrange('STRING', '8.12'), ('8.14', '8.17'))
+        eq(text.tag_nextrange('STRING', '8.17'), ('8.19', '8.26'))
+        eq(text.tag_nextrange('SYNC', '8.0'), ('8.26', '9.0'))
+        eq(text.tag_nextrange('SYNC', '30.0'), ('30.10', '32.0'))
+
+    def _assert_highlighting(self, source, tag_ranges):
+        """Check highlighting of a given piece of code.
+
+        This inserts just this code into the Text widget. It will then
+        check that the resulting highlighting tag ranges exactly match
+        those described in the given `tag_ranges` dict.
+
+        Note that the irrelevant tags 'sel', 'TODO' and 'SYNC' are
+        ignored.
+        """
+        text = self.text
+
+        with mock.patch.object(colorizer.ColorDelegator, 'notify_range'):
+            text.delete('1.0', 'end-1c')
+            text.insert('insert', source)
+            text.tag_add('TODO', '1.0', 'end-1c')
+            self.color.recolorize_main()
+
+        # Make a dict with highlighting tag ranges in the Text widget.
+        text_tag_ranges = {}
+        for tag in set(text.tag_names()) - {'sel', 'TODO', 'SYNC'}:
+            indexes = [rng.string for rng in text.tag_ranges(tag)]
+            for index_pair in zip(indexes[::2], indexes[1::2]):
+                text_tag_ranges.setdefault(tag, []).append(index_pair)
+
+        self.assertEqual(text_tag_ranges, tag_ranges)
+
+        with mock.patch.object(colorizer.ColorDelegator, 'notify_range'):
+            text.delete('1.0', 'end-1c')
+
+    def test_def_statement(self):
+        # empty def
+        self._assert_highlighting('def', {'KEYWORD': [('1.0', '1.3')]})
+
+        # def followed by identifier
+        self._assert_highlighting('def foo:', {'KEYWORD': [('1.0', '1.3')],
+                                               'DEFINITION': [('1.4', '1.7')]})
+
+        # def followed by partial identifier
+        self._assert_highlighting('def fo', {'KEYWORD': [('1.0', '1.3')],
+                                             'DEFINITION': [('1.4', '1.6')]})
+
+        # def followed by non-keyword
+        self._assert_highlighting('def ++', {'KEYWORD': [('1.0', '1.3')]})
+
+    def test_match_soft_keyword(self):
+        # empty match
+        self._assert_highlighting('match', {'KEYWORD': [('1.0', '1.5')]})
+
+        # match followed by partial identifier
+        self._assert_highlighting('match fo', {'KEYWORD': [('1.0', '1.5')]})
+
+        # match followed by identifier and colon
+        self._assert_highlighting('match foo:', {'KEYWORD': [('1.0', '1.5')]})
+
+        # match followed by keyword
+        self._assert_highlighting('match and', {'KEYWORD': [('1.6', '1.9')]})
+
+        # match followed by builtin with keyword prefix
+        self._assert_highlighting('match int:', {'KEYWORD': [('1.0', '1.5')],
+                                                 'BUILTIN': [('1.6', '1.9')]})
+
+        # match followed by non-text operator
+        self._assert_highlighting('match^', {})
+        self._assert_highlighting('match @', {})
+
+        # match followed by colon
+        self._assert_highlighting('match :', {})
+
+        # match followed by comma
+        self._assert_highlighting('match\t,', {})
+
+        # match followed by a lone underscore
+        self._assert_highlighting('match _:', {'KEYWORD': [('1.0', '1.5')]})
+
+    def test_case_soft_keyword(self):
+        # empty case
+        self._assert_highlighting('case', {'KEYWORD': [('1.0', '1.4')]})
+
+        # case followed by partial identifier
+        self._assert_highlighting('case fo', {'KEYWORD': [('1.0', '1.4')]})
+
+        # case followed by identifier and colon
+        self._assert_highlighting('case foo:', {'KEYWORD': [('1.0', '1.4')]})
+
+        # case followed by keyword
+        self._assert_highlighting('case and', {'KEYWORD': [('1.5', '1.8')]})
+
+        # case followed by builtin with keyword prefix
+        self._assert_highlighting('case int:', {'KEYWORD': [('1.0', '1.4')],
+                                                'BUILTIN': [('1.5', '1.8')]})
+
+        # case followed by non-text operator
+        self._assert_highlighting('case^', {})
+        self._assert_highlighting('case @', {})
+
+        # case followed by colon
+        self._assert_highlighting('case :', {})
+
+        # case followed by comma
+        self._assert_highlighting('case\t,', {})
+
+        # case followed by a lone underscore
+        self._assert_highlighting('case _:', {'KEYWORD': [('1.0', '1.4'),
+                                                          ('1.5', '1.6')]})
+
+    def test_long_multiline_string(self):
+        source = textwrap.dedent('''\
+            """a
+            b
+            c
+            d
+            e"""
+            ''')
+        self._assert_highlighting(source, {'STRING': [('1.0', '5.4')]})
+
+    @run_in_tk_mainloop(delay=50)
+    def test_incremental_editing(self):
+        text = self.text
+        eq = self.assertEqual
+
+        # Simulate typing 'inte'. During this, the highlighting should
+        # change from normal to keyword to builtin to normal.
+        text.insert('insert', 'i')
+        yield
+        eq(text.tag_nextrange('BUILTIN', '1.0'), ())
+        eq(text.tag_nextrange('KEYWORD', '1.0'), ())
+
+        text.insert('insert', 'n')
+        yield
+        eq(text.tag_nextrange('BUILTIN', '1.0'), ())
+        eq(text.tag_nextrange('KEYWORD', '1.0'), ('1.0', '1.2'))
+
+        text.insert('insert', 't')
+        yield
+        eq(text.tag_nextrange('BUILTIN', '1.0'), ('1.0', '1.3'))
+        eq(text.tag_nextrange('KEYWORD', '1.0'), ())
+
+        text.insert('insert', 'e')
+        yield
+        eq(text.tag_nextrange('BUILTIN', '1.0'), ())
+        eq(text.tag_nextrange('KEYWORD', '1.0'), ())
+
+        # Simulate deleting three characters from the end of 'inte'.
+        # During this, the highlighting should change from normal to
+        # builtin to keyword to normal.
+        text.delete('insert-1c', 'insert')
+        yield
+        eq(text.tag_nextrange('BUILTIN', '1.0'), ('1.0', '1.3'))
+        eq(text.tag_nextrange('KEYWORD', '1.0'), ())
+
+        text.delete('insert-1c', 'insert')
+        yield
+        eq(text.tag_nextrange('BUILTIN', '1.0'), ())
+        eq(text.tag_nextrange('KEYWORD', '1.0'), ('1.0', '1.2'))
+
+        text.delete('insert-1c', 'insert')
+        yield
+        eq(text.tag_nextrange('BUILTIN', '1.0'), ())
+        eq(text.tag_nextrange('KEYWORD', '1.0'), ())
 
     @mock.patch.object(colorizer.ColorDelegator, 'recolorize')
     @mock.patch.object(colorizer.ColorDelegator, 'notify_range')
diff --git a/Lib/idlelib/idle_test/test_config_key.py b/Lib/idlelib/idle_test/test_config_key.py
index b7fe7fd..bf66cad 100644
--- a/Lib/idlelib/idle_test/test_config_key.py
+++ b/Lib/idlelib/idle_test/test_config_key.py
@@ -2,7 +2,7 @@
 
 Coverage is effectively 100%.  Tkinter dialog is mocked, Mac-only line
 may be skipped, and dummy function in bind test should not be called.
-Not tested: exit with 'self.advanced or self.keys_ok(keys)) ...' False.
+Not tested: exit with 'self.advanced or self.keys_ok(keys) ...' False.
 """
 
 from idlelib import config_key
diff --git a/Lib/idlelib/idle_test/test_configdialog.py b/Lib/idlelib/idle_test/test_configdialog.py
index 1fea6d4..3005ce0 100644
--- a/Lib/idlelib/idle_test/test_configdialog.py
+++ b/Lib/idlelib/idle_test/test_configdialog.py
@@ -73,13 +73,13 @@
     def test_click_apply(self):
         d = dialog
         deactivate = d.deactivate_current_config = mock.Mock()
-        save_ext = d.save_all_changed_extensions = mock.Mock()
+        save_ext = d.extpage.save_all_changed_extensions = mock.Mock()
         activate = d.activate_config_changes = mock.Mock()
         d.buttons['Apply'].invoke()
         deactivate.assert_called_once()
         save_ext.assert_called_once()
         activate.assert_called_once()
-        del d.save_all_changed_extensions
+        del d.extpage.save_all_changed_extensions
         del d.activate_config_changes, d.deactivate_current_config
 
     def test_click_cancel(self):
@@ -260,27 +260,6 @@
         d.set_samples = Func()  # Re-mask for other tests.
 
 
-class IndentTest(unittest.TestCase):
-
-    @classmethod
-    def setUpClass(cls):
-        cls.page = dialog.fontpage
-        cls.page.update()
-
-    def test_load_tab_cfg(self):
-        d = self.page
-        d.space_num.set(16)
-        d.load_tab_cfg()
-        self.assertEqual(d.space_num.get(), 4)
-
-    def test_indent_scale(self):
-        d = self.page
-        changes.clear()
-        d.indent_scale.set(20)
-        self.assertEqual(d.space_num.get(), 16)
-        self.assertEqual(mainpage, {'Indent': {'num-spaces': '16'}})
-
-
 class HighPageTest(unittest.TestCase):
     """Test that highlight tab widgets enable users to make changes.
 
@@ -423,7 +402,7 @@
     def test_color(self):
         d = self.page
         d.on_new_color_set = Func()
-        # self.color is only set in get_color through ColorChooser.
+        # self.color is only set in get_color through colorchooser.
         d.color.set('green')
         self.assertEqual(d.on_new_color_set.called, 1)
         del d.on_new_color_set
@@ -540,8 +519,8 @@
     def test_get_color(self):
         eq = self.assertEqual
         d = self.page
-        orig_chooser = configdialog.tkColorChooser.askcolor
-        chooser = configdialog.tkColorChooser.askcolor = Func()
+        orig_chooser = configdialog.colorchooser.askcolor
+        chooser = configdialog.colorchooser.askcolor = Func()
         gntn = d.get_new_theme_name = Func()
 
         d.highlight_target.set('Editor Breakpoint')
@@ -582,7 +561,7 @@
         eq(d.color.get(), '#de0000')
 
         del d.get_new_theme_name
-        configdialog.tkColorChooser.askcolor = orig_chooser
+        configdialog.colorchooser.askcolor = orig_chooser
 
     def test_on_new_color_set(self):
         d = self.page
@@ -1203,49 +1182,32 @@
         del d.askyesno
 
 
-class GenPageTest(unittest.TestCase):
+class WinPageTest(unittest.TestCase):
     """Test that general tab widgets enable users to make changes.
 
     Test that widget actions set vars, that var changes add
-    options to changes and that helplist works correctly.
+    options to changes.
     """
     @classmethod
     def setUpClass(cls):
-        page = cls.page = dialog.genpage
+        page = cls.page = dialog.winpage
         dialog.note.select(page)
-        page.set = page.set_add_delete_state = Func()
-        page.upc = page.update_help_changes = Func()
         page.update()
 
-    @classmethod
-    def tearDownClass(cls):
-        page = cls.page
-        del page.set, page.set_add_delete_state
-        del page.upc, page.update_help_changes
-        page.helplist.delete(0, 'end')
-        page.user_helplist.clear()
-
     def setUp(self):
         changes.clear()
 
-    def test_load_general_cfg(self):
+    def test_load_windows_cfg(self):
         # Set to wrong values, load, check right values.
         eq = self.assertEqual
         d = self.page
         d.startup_edit.set(1)
-        d.autosave.set(1)
         d.win_width.set(1)
         d.win_height.set(1)
-        d.helplist.insert('end', 'bad')
-        d.user_helplist = ['bad', 'worse']
-        idleConf.SetOption('main', 'HelpFiles', '1', 'name;file')
-        d.load_general_cfg()
+        d.load_windows_cfg()
         eq(d.startup_edit.get(), 0)
-        eq(d.autosave.get(), 0)
         eq(d.win_width.get(), '80')
         eq(d.win_height.get(), '40')
-        eq(d.helplist.get(0, 'end'), ('name',))
-        eq(d.user_helplist, [('name', 'file', '1')])
 
     def test_startup(self):
         d = self.page
@@ -1267,6 +1229,12 @@
         d.win_width_int.insert(0, '11')
         self.assertEqual(mainpage, {'EditorWindow': {'width': '11'}})
 
+    def test_indent_spaces(self):
+        d = self.page
+        d.indent_chooser.set(6)
+        self.assertEqual(d.indent_spaces.get(), '6')
+        self.assertEqual(mainpage, {'Indent': {'num-spaces': '6'}})
+
     def test_cursor_blink(self):
         self.page.cursor_blink_bool.invoke()
         self.assertEqual(mainpage, {'EditorWindow': {'cursor-blink': 'False'}})
@@ -1289,6 +1257,35 @@
         d.bell_on.invoke()
         eq(extpage, {'ParenMatch': {'bell': 'False'}})
 
+    def test_paragraph(self):
+        self.page.format_width_int.delete(0, 'end')
+        self.page.format_width_int.insert(0, '11')
+        self.assertEqual(extpage, {'FormatParagraph': {'max-width': '11'}})
+
+
+class ShedPageTest(unittest.TestCase):
+    """Test that shed tab widgets enable users to make changes.
+
+    Test that widget actions set vars, that var changes add
+    options to changes.
+    """
+    @classmethod
+    def setUpClass(cls):
+        page = cls.page = dialog.shedpage
+        dialog.note.select(page)
+        page.update()
+
+    def setUp(self):
+        changes.clear()
+
+    def test_load_shelled_cfg(self):
+        # Set to wrong values, load, check right values.
+        eq = self.assertEqual
+        d = self.page
+        d.autosave.set(1)
+        d.load_shelled_cfg()
+        eq(d.autosave.get(), 0)
+
     def test_autosave(self):
         d = self.page
         d.save_auto_on.invoke()
@@ -1296,21 +1293,58 @@
         d.save_ask_on.invoke()
         self.assertEqual(mainpage, {'General': {'autosave': '0'}})
 
-    def test_paragraph(self):
-        self.page.format_width_int.delete(0, 'end')
-        self.page.format_width_int.insert(0, '11')
-        self.assertEqual(extpage, {'FormatParagraph': {'max-width': '11'}})
-
     def test_context(self):
         self.page.context_int.delete(0, 'end')
         self.page.context_int.insert(0, '1')
         self.assertEqual(extpage, {'CodeContext': {'maxlines': '1'}})
 
+
+#unittest.skip("Nothing here yet TODO")
+class ExtPageTest(unittest.TestCase):
+    """Test that the help source list works correctly."""
+    @classmethod
+    def setUpClass(cls):
+        page = dialog.extpage
+        dialog.note.select(page)
+
+
+class HelpSourceTest(unittest.TestCase):
+    """Test that the help source list works correctly."""
+    @classmethod
+    def setUpClass(cls):
+        page = dialog.extpage
+        dialog.note.select(page)
+        frame = cls.frame = page.frame_help
+        frame.set = frame.set_add_delete_state = Func()
+        frame.upc = frame.update_help_changes = Func()
+        frame.update()
+
+    @classmethod
+    def tearDownClass(cls):
+        frame = cls.frame
+        del frame.set, frame.set_add_delete_state
+        del frame.upc, frame.update_help_changes
+        frame.helplist.delete(0, 'end')
+        frame.user_helplist.clear()
+
+    def setUp(self):
+        changes.clear()
+
+    def test_load_helplist(self):
+        eq = self.assertEqual
+        fr = self.frame
+        fr.helplist.insert('end', 'bad')
+        fr.user_helplist = ['bad', 'worse']
+        idleConf.SetOption('main', 'HelpFiles', '1', 'name;file')
+        fr.load_helplist()
+        eq(fr.helplist.get(0, 'end'), ('name',))
+        eq(fr.user_helplist, [('name', 'file', '1')])
+
     def test_source_selected(self):
-        d = self.page
-        d.set = d.set_add_delete_state
-        d.upc = d.update_help_changes
-        helplist = d.helplist
+        fr = self.frame
+        fr.set = fr.set_add_delete_state
+        fr.upc = fr.update_help_changes
+        helplist = fr.helplist
         dex = 'end'
         helplist.insert(dex, 'source')
         helplist.activate(dex)
@@ -1321,38 +1355,38 @@
         x, y, dx, dy = helplist.bbox(dex)
         x += dx // 2
         y += dy // 2
-        d.set.called = d.upc.called = 0
+        fr.set.called = fr.upc.called = 0
         helplist.event_generate('<Enter>', x=0, y=0)
         helplist.event_generate('<Motion>', x=x, y=y)
         helplist.event_generate('<Button-1>', x=x, y=y)
         helplist.event_generate('<ButtonRelease-1>', x=x, y=y)
         self.assertEqual(helplist.get('anchor'), 'source')
-        self.assertTrue(d.set.called)
-        self.assertFalse(d.upc.called)
+        self.assertTrue(fr.set.called)
+        self.assertFalse(fr.upc.called)
 
     def test_set_add_delete_state(self):
         # Call with 0 items, 1 unselected item, 1 selected item.
         eq = self.assertEqual
-        d = self.page
-        del d.set_add_delete_state  # Unmask method.
-        sad = d.set_add_delete_state
-        h = d.helplist
+        fr = self.frame
+        del fr.set_add_delete_state  # Unmask method.
+        sad = fr.set_add_delete_state
+        h = fr.helplist
 
         h.delete(0, 'end')
         sad()
-        eq(d.button_helplist_edit.state(), ('disabled',))
-        eq(d.button_helplist_remove.state(), ('disabled',))
+        eq(fr.button_helplist_edit.state(), ('disabled',))
+        eq(fr.button_helplist_remove.state(), ('disabled',))
 
         h.insert(0, 'source')
         sad()
-        eq(d.button_helplist_edit.state(), ('disabled',))
-        eq(d.button_helplist_remove.state(), ('disabled',))
+        eq(fr.button_helplist_edit.state(), ('disabled',))
+        eq(fr.button_helplist_remove.state(), ('disabled',))
 
         h.selection_set(0)
         sad()
-        eq(d.button_helplist_edit.state(), ())
-        eq(d.button_helplist_remove.state(), ())
-        d.set_add_delete_state = Func()  # Mask method.
+        eq(fr.button_helplist_edit.state(), ())
+        eq(fr.button_helplist_remove.state(), ())
+        fr.set_add_delete_state = Func()  # Mask method.
 
     def test_helplist_item_add(self):
         # Call without and twice with HelpSource result.
@@ -1360,25 +1394,25 @@
         eq = self.assertEqual
         orig_helpsource = configdialog.HelpSource
         hs = configdialog.HelpSource = Func(return_self=True)
-        d = self.page
-        d.helplist.delete(0, 'end')
-        d.user_helplist.clear()
-        d.set.called = d.upc.called = 0
+        fr = self.frame
+        fr.helplist.delete(0, 'end')
+        fr.user_helplist.clear()
+        fr.set.called = fr.upc.called = 0
 
         hs.result = ''
-        d.helplist_item_add()
-        self.assertTrue(list(d.helplist.get(0, 'end')) ==
-                        d.user_helplist == [])
-        self.assertFalse(d.upc.called)
+        fr.helplist_item_add()
+        self.assertTrue(list(fr.helplist.get(0, 'end')) ==
+                        fr.user_helplist == [])
+        self.assertFalse(fr.upc.called)
 
         hs.result = ('name1', 'file1')
-        d.helplist_item_add()
+        fr.helplist_item_add()
         hs.result = ('name2', 'file2')
-        d.helplist_item_add()
-        eq(d.helplist.get(0, 'end'), ('name1', 'name2'))
-        eq(d.user_helplist, [('name1', 'file1'), ('name2', 'file2')])
-        eq(d.upc.called, 2)
-        self.assertFalse(d.set.called)
+        fr.helplist_item_add()
+        eq(fr.helplist.get(0, 'end'), ('name1', 'name2'))
+        eq(fr.user_helplist, [('name1', 'file1'), ('name2', 'file2')])
+        eq(fr.upc.called, 2)
+        self.assertFalse(fr.set.called)
 
         configdialog.HelpSource = orig_helpsource
 
@@ -1387,58 +1421,58 @@
         eq = self.assertEqual
         orig_helpsource = configdialog.HelpSource
         hs = configdialog.HelpSource = Func(return_self=True)
-        d = self.page
-        d.helplist.delete(0, 'end')
-        d.helplist.insert(0, 'name1')
-        d.helplist.selection_set(0)
-        d.helplist.selection_anchor(0)
-        d.user_helplist.clear()
-        d.user_helplist.append(('name1', 'file1'))
-        d.set.called = d.upc.called = 0
+        fr = self.frame
+        fr.helplist.delete(0, 'end')
+        fr.helplist.insert(0, 'name1')
+        fr.helplist.selection_set(0)
+        fr.helplist.selection_anchor(0)
+        fr.user_helplist.clear()
+        fr.user_helplist.append(('name1', 'file1'))
+        fr.set.called = fr.upc.called = 0
 
         hs.result = ''
-        d.helplist_item_edit()
+        fr.helplist_item_edit()
         hs.result = ('name1', 'file1')
-        d.helplist_item_edit()
-        eq(d.helplist.get(0, 'end'), ('name1',))
-        eq(d.user_helplist, [('name1', 'file1')])
-        self.assertFalse(d.upc.called)
+        fr.helplist_item_edit()
+        eq(fr.helplist.get(0, 'end'), ('name1',))
+        eq(fr.user_helplist, [('name1', 'file1')])
+        self.assertFalse(fr.upc.called)
 
         hs.result = ('name2', 'file2')
-        d.helplist_item_edit()
-        eq(d.helplist.get(0, 'end'), ('name2',))
-        eq(d.user_helplist, [('name2', 'file2')])
-        self.assertTrue(d.upc.called == d.set.called == 1)
+        fr.helplist_item_edit()
+        eq(fr.helplist.get(0, 'end'), ('name2',))
+        eq(fr.user_helplist, [('name2', 'file2')])
+        self.assertTrue(fr.upc.called == fr.set.called == 1)
 
         configdialog.HelpSource = orig_helpsource
 
     def test_helplist_item_remove(self):
         eq = self.assertEqual
-        d = self.page
-        d.helplist.delete(0, 'end')
-        d.helplist.insert(0, 'name1')
-        d.helplist.selection_set(0)
-        d.helplist.selection_anchor(0)
-        d.user_helplist.clear()
-        d.user_helplist.append(('name1', 'file1'))
-        d.set.called = d.upc.called = 0
+        fr = self.frame
+        fr.helplist.delete(0, 'end')
+        fr.helplist.insert(0, 'name1')
+        fr.helplist.selection_set(0)
+        fr.helplist.selection_anchor(0)
+        fr.user_helplist.clear()
+        fr.user_helplist.append(('name1', 'file1'))
+        fr.set.called = fr.upc.called = 0
 
-        d.helplist_item_remove()
-        eq(d.helplist.get(0, 'end'), ())
-        eq(d.user_helplist, [])
-        self.assertTrue(d.upc.called == d.set.called == 1)
+        fr.helplist_item_remove()
+        eq(fr.helplist.get(0, 'end'), ())
+        eq(fr.user_helplist, [])
+        self.assertTrue(fr.upc.called == fr.set.called == 1)
 
     def test_update_help_changes(self):
-        d = self.page
-        del d.update_help_changes
-        d.user_helplist.clear()
-        d.user_helplist.append(('name1', 'file1'))
-        d.user_helplist.append(('name2', 'file2'))
+        fr = self.frame
+        del fr.update_help_changes
+        fr.user_helplist.clear()
+        fr.user_helplist.append(('name1', 'file1'))
+        fr.user_helplist.append(('name2', 'file2'))
 
-        d.update_help_changes()
+        fr.update_help_changes()
         self.assertEqual(mainpage['HelpFiles'],
                          {'1': 'name1;file1', '2': 'name2;file2'})
-        d.update_help_changes = Func()
+        fr.update_help_changes = Func()
 
 
 class VarTraceTest(unittest.TestCase):
diff --git a/Lib/idlelib/idle_test/test_debugger_r.py b/Lib/idlelib/idle_test/test_debugger_r.py
index 199f634..638ebd3 100644
--- a/Lib/idlelib/idle_test/test_debugger_r.py
+++ b/Lib/idlelib/idle_test/test_debugger_r.py
@@ -25,5 +25,19 @@
 # Classes GUIProxy, IdbAdapter, FrameProxy, CodeProxy, DictProxy,
 # GUIAdapter, IdbProxy plus 7 module functions.
 
+class IdbAdapterTest(unittest.TestCase):
+
+    def test_dict_item_noattr(self):  # Issue 33065.
+
+        class BinData:
+            def __repr__(self):
+                return self.length
+
+        debugger_r.dicttable[0] = {'BinData': BinData()}
+        idb = debugger_r.IdbAdapter(None)
+        self.assertTrue(idb.dict_item(0, 'BinData'))
+        debugger_r.dicttable.clear()
+
+
 if __name__ == '__main__':
     unittest.main(verbosity=2)
diff --git a/Lib/idlelib/idle_test/test_editor.py b/Lib/idlelib/idle_test/test_editor.py
index 443dcf0..8665d68 100644
--- a/Lib/idlelib/idle_test/test_editor.py
+++ b/Lib/idlelib/idle_test/test_editor.py
@@ -167,7 +167,6 @@
                           '2.end'),
                  )
 
-        w.prompt_last_line = ''
         for test in tests:
             with self.subTest(label=test.label):
                 insert(text, test.text)
@@ -182,13 +181,6 @@
         # Deletes selected text before adding new line.
         eq(get('1.0', 'end'), '  def f1(self, a,\n         \n    return a + b\n')
 
-        # Preserves the whitespace in shell prompt.
-        w.prompt_last_line = '>>> '
-        insert(text, '>>> \t\ta =')
-        text.mark_set('insert', '1.5')
-        nl(None)
-        eq(get('1.0', 'end'), '>>> \na =\n')
-
 
 class RMenuTest(unittest.TestCase):
 
diff --git a/Lib/idlelib/idle_test/test_format.py b/Lib/idlelib/idle_test/test_format.py
index a79bb51..e5e9036 100644
--- a/Lib/idlelib/idle_test/test_format.py
+++ b/Lib/idlelib/idle_test/test_format.py
@@ -418,7 +418,7 @@
 
     code_sample = """\
 # WS line needed for test.
-class C1():
+class C1:
     # Class comment.
     def __init__(self, a, b):
         self.a = a
diff --git a/Lib/idlelib/idle_test/test_help_about.py b/Lib/idlelib/idle_test/test_help_about.py
index 7c148d2..b915535 100644
--- a/Lib/idlelib/idle_test/test_help_about.py
+++ b/Lib/idlelib/idle_test/test_help_about.py
@@ -134,7 +134,7 @@
             self.dialog.winfo_class()
 
 
-class Dummy_about_dialog():
+class Dummy_about_dialog:
     # Dummy class for testing file display functions.
     idle_credits = About.show_idle_credits
     idle_readme = About.show_readme
diff --git a/Lib/idlelib/idle_test/test_iomenu.py b/Lib/idlelib/idle_test/test_iomenu.py
index 99f4048..e338893 100644
--- a/Lib/idlelib/idle_test/test_iomenu.py
+++ b/Lib/idlelib/idle_test/test_iomenu.py
@@ -1,6 +1,6 @@
 "Test , coverage 17%."
 
-from idlelib import iomenu
+from idlelib import iomenu, util
 import unittest
 from test.support import requires
 from tkinter import Tk
@@ -45,5 +45,27 @@
         eq(fix(), 'a'+io.eol_convention)
 
 
+def _extension_in_filetypes(extension):
+    return any(
+        f'*{extension}' in filetype_tuple[1]
+        for filetype_tuple in iomenu.IOBinding.filetypes
+    )
+
+
+class FiletypesTest(unittest.TestCase):
+    def test_python_source_files(self):
+        for extension in util.py_extensions:
+            with self.subTest(extension=extension):
+                self.assertTrue(
+                    _extension_in_filetypes(extension)
+                )
+
+    def test_text_files(self):
+        self.assertTrue(_extension_in_filetypes('.txt'))
+
+    def test_all_files(self):
+        self.assertTrue(_extension_in_filetypes(''))
+
+
 if __name__ == '__main__':
     unittest.main(verbosity=2)
diff --git a/Lib/idlelib/idle_test/test_macosx.py b/Lib/idlelib/idle_test/test_macosx.py
index b6bd922..86da884 100644
--- a/Lib/idlelib/idle_test/test_macosx.py
+++ b/Lib/idlelib/idle_test/test_macosx.py
@@ -12,6 +12,15 @@
 alltypes = mactypes | nontypes
 
 
+def setUpModule():
+    global orig_tktype
+    orig_tktype = macosx._tk_type
+
+
+def tearDownModule():
+    macosx._tk_type = orig_tktype
+
+
 class InitTktypeTest(unittest.TestCase):
     "Test _init_tk_type."
 
@@ -34,7 +43,7 @@
         for platform, types in ('darwin', alltypes), ('other', nontypes):
             with self.subTest(platform=platform):
                 macosx.platform = platform
-                macosx._tk_type == None
+                macosx._tk_type = None
                 macosx._init_tk_type()
                 self.assertIn(macosx._tk_type, types)
 
diff --git a/Lib/idlelib/idle_test/test_mainmenu.py b/Lib/idlelib/idle_test/test_mainmenu.py
index 7ec0368..51d2acc 100644
--- a/Lib/idlelib/idle_test/test_mainmenu.py
+++ b/Lib/idlelib/idle_test/test_mainmenu.py
@@ -2,6 +2,7 @@
 # Reported as 88%; mocking turtledemo absence would have no point.
 
 from idlelib import mainmenu
+import re
 import unittest
 
 
@@ -16,6 +17,26 @@
     def test_default_keydefs(self):
         self.assertGreaterEqual(len(mainmenu.default_keydefs), 50)
 
+    def test_tcl_indexes(self):
+        # Test tcl patterns used to find menuitem to alter.
+        # On failure, change pattern here and in function(s).
+        # Patterns here have '.*' for re instead of '*' for tcl.
+        for menu, pattern in (
+            ('debug', '.*tack.*iewer'),  # PyShell.debug_menu_postcommand
+            ('options', '.*ode.*ontext'),  # EW.__init__, CodeContext.toggle...
+            ('options', '.*ine.*umbers'),  # EW.__init__, EW.toggle...event.
+            ):
+            with self.subTest(menu=menu, pattern=pattern):
+                for menutup in mainmenu.menudefs:
+                    if menutup[0] == menu:
+                        break
+                else:
+                    self.assertTrue(0, f"{menu} not in menudefs")
+                self.assertTrue(any(re.search(pattern, menuitem[0])
+                                    for menuitem in menutup[1]
+                                    if menuitem is not None),  # Separator.
+                                f"{pattern} not in {menu}")
+
 
 if __name__ == '__main__':
     unittest.main(verbosity=2)
diff --git a/Lib/idlelib/idle_test/test_multicall.py b/Lib/idlelib/idle_test/test_multicall.py
index ba582bb..b3a3bfb 100644
--- a/Lib/idlelib/idle_test/test_multicall.py
+++ b/Lib/idlelib/idle_test/test_multicall.py
@@ -37,7 +37,7 @@
 
     def test_yview(self):
         # Added for tree.wheel_event
-        # (it depends on yview to not be overriden)
+        # (it depends on yview to not be overridden)
         mc = self.mc
         self.assertIs(mc.yview, Text.yview)
         mctext = self.mc(self.root)
diff --git a/Lib/idlelib/idle_test/test_pyparse.py b/Lib/idlelib/idle_test/test_pyparse.py
index f21baf7..384db56 100644
--- a/Lib/idlelib/idle_test/test_pyparse.py
+++ b/Lib/idlelib/idle_test/test_pyparse.py
@@ -73,11 +73,12 @@
 
         # Split def across lines.
         setcode('"""This is a module docstring"""\n'
-                'class C():\n'
+                'class C:\n'
                 '    def __init__(self, a,\n'
                 '                 b=True):\n'
                 '        pass\n'
                 )
+        pos0, pos = 33, 42  # Start of 'class...', '    def' lines.
 
         # Passing no value or non-callable should fail (issue 32989).
         with self.assertRaises(TypeError):
@@ -91,40 +92,41 @@
 
         # Make all text look like it's not in a string.  This means that it
         # found a good start position.
-        eq(start(char_in_string_false), 44)
+        eq(start(char_in_string_false), pos)
 
         # If the beginning of the def line is not in a string, then it
         # returns that as the index.
-        eq(start(is_char_in_string=lambda index: index > 44), 44)
+        eq(start(is_char_in_string=lambda index: index > pos), pos)
         # If the beginning of the def line is in a string, then it
         # looks for a previous index.
-        eq(start(is_char_in_string=lambda index: index >= 44), 33)
+        eq(start(is_char_in_string=lambda index: index >= pos), pos0)
         # If everything before the 'def' is in a string, then returns None.
         # The non-continuation def line returns 44 (see below).
-        eq(start(is_char_in_string=lambda index: index < 44), None)
+        eq(start(is_char_in_string=lambda index: index < pos), None)
 
         # Code without extra line break in def line - mostly returns the same
         # values.
         setcode('"""This is a module docstring"""\n'
-                'class C():\n'
+                'class C:\n'
                 '    def __init__(self, a, b=True):\n'
                 '        pass\n'
-                )
-        eq(start(char_in_string_false), 44)
-        eq(start(is_char_in_string=lambda index: index > 44), 44)
-        eq(start(is_char_in_string=lambda index: index >= 44), 33)
+                )  # Does not affect class, def positions.
+        eq(start(char_in_string_false), pos)
+        eq(start(is_char_in_string=lambda index: index > pos), pos)
+        eq(start(is_char_in_string=lambda index: index >= pos), pos0)
         # When the def line isn't split, this returns which doesn't match the
         # split line test.
-        eq(start(is_char_in_string=lambda index: index < 44), 44)
+        eq(start(is_char_in_string=lambda index: index < pos), pos)
 
     def test_set_lo(self):
         code = (
                 '"""This is a module docstring"""\n'
-                'class C():\n'
+                'class C:\n'
                 '    def __init__(self, a,\n'
                 '                 b=True):\n'
                 '        pass\n'
                 )
+        pos = 42
         p = self.parser
         p.set_code(code)
 
@@ -137,8 +139,8 @@
         self.assertEqual(p.code, code)
 
         # An index that is preceded by a newline.
-        p.set_lo(44)
-        self.assertEqual(p.code, code[44:])
+        p.set_lo(pos)
+        self.assertEqual(p.code, code[pos:])
 
     def test_study1(self):
         eq = self.assertEqual
@@ -282,7 +284,7 @@
         tests = (
             TestInfo('[x for x in a]\n', 1),      # Closed on one line.
             TestInfo('[x\nfor x in a\n', 2),      # Not closed.
-            TestInfo('[x\\\nfor x in a\\\n', 2),  # "", uneeded backslashes.
+            TestInfo('[x\\\nfor x in a\\\n', 2),  # "", unneeded backslashes.
             TestInfo('[x\nfor x in a\n]\n', 3),   # Closed on multi-line.
             TestInfo('\n"""Docstring comment L1"""\nL2\nL3\nL4\n', 1),
             TestInfo('\n"""Docstring comment L1\nL2"""\nL3\nL4\n', 1),
diff --git a/Lib/idlelib/idle_test/test_pyshell.py b/Lib/idlelib/idle_test/test_pyshell.py
index 4a09667..7067039 100644
--- a/Lib/idlelib/idle_test/test_pyshell.py
+++ b/Lib/idlelib/idle_test/test_pyshell.py
@@ -60,5 +60,89 @@
 ##        self.assertIsInstance(ps, pyshell.PyShell)
 
 
+class PyShellRemoveLastNewlineAndSurroundingWhitespaceTest(unittest.TestCase):
+    regexp = pyshell.PyShell._last_newline_re
+
+    def all_removed(self, text):
+        self.assertEqual('', self.regexp.sub('', text))
+
+    def none_removed(self, text):
+        self.assertEqual(text, self.regexp.sub('', text))
+
+    def check_result(self, text, expected):
+        self.assertEqual(expected, self.regexp.sub('', text))
+
+    def test_empty(self):
+        self.all_removed('')
+
+    def test_newline(self):
+        self.all_removed('\n')
+
+    def test_whitespace_no_newline(self):
+        self.all_removed(' ')
+        self.all_removed('  ')
+        self.all_removed('   ')
+        self.all_removed(' ' * 20)
+        self.all_removed('\t')
+        self.all_removed('\t\t')
+        self.all_removed('\t\t\t')
+        self.all_removed('\t' * 20)
+        self.all_removed('\t ')
+        self.all_removed(' \t')
+        self.all_removed(' \t \t ')
+        self.all_removed('\t \t \t')
+
+    def test_newline_with_whitespace(self):
+        self.all_removed(' \n')
+        self.all_removed('\t\n')
+        self.all_removed(' \t\n')
+        self.all_removed('\t \n')
+        self.all_removed('\n ')
+        self.all_removed('\n\t')
+        self.all_removed('\n \t')
+        self.all_removed('\n\t ')
+        self.all_removed(' \n ')
+        self.all_removed('\t\n ')
+        self.all_removed(' \n\t')
+        self.all_removed('\t\n\t')
+        self.all_removed('\t \t \t\n')
+        self.all_removed(' \t \t \n')
+        self.all_removed('\n\t \t \t')
+        self.all_removed('\n \t \t ')
+
+    def test_multiple_newlines(self):
+        self.check_result('\n\n', '\n')
+        self.check_result('\n' * 5, '\n' * 4)
+        self.check_result('\n' * 5 + '\t', '\n' * 4)
+        self.check_result('\n' * 20, '\n' * 19)
+        self.check_result('\n' * 20 + ' ', '\n' * 19)
+        self.check_result(' \n \n ', ' \n')
+        self.check_result(' \n\n ', ' \n')
+        self.check_result(' \n\n', ' \n')
+        self.check_result('\t\n\n', '\t\n')
+        self.check_result('\n\n ', '\n')
+        self.check_result('\n\n\t', '\n')
+        self.check_result(' \n \n ', ' \n')
+        self.check_result('\t\n\t\n\t', '\t\n')
+
+    def test_non_whitespace(self):
+        self.none_removed('a')
+        self.check_result('a\n', 'a')
+        self.check_result('a\n ', 'a')
+        self.check_result('a \n ', 'a')
+        self.check_result('a \n\t', 'a')
+        self.none_removed('-')
+        self.check_result('-\n', '-')
+        self.none_removed('.')
+        self.check_result('.\n', '.')
+
+    def test_unsupported_whitespace(self):
+        self.none_removed('\v')
+        self.none_removed('\n\v')
+        self.check_result('\v\n', '\v')
+        self.none_removed(' \n\v')
+        self.check_result('\v\n ', '\v')
+
+
 if __name__ == '__main__':
     unittest.main(verbosity=2)
diff --git a/Lib/idlelib/idle_test/test_query.py b/Lib/idlelib/idle_test/test_query.py
index e968862..bb12b2b 100644
--- a/Lib/idlelib/idle_test/test_query.py
+++ b/Lib/idlelib/idle_test/test_query.py
@@ -1,4 +1,4 @@
-"""Test query, coverage 93%).
+"""Test query, coverage 93%.
 
 Non-gui tests for Query, SectionName, ModuleName, and HelpSource use
 dummy versions that extract the non-gui methods and add other needed
@@ -136,8 +136,8 @@
         dialog = self.Dummy_ModuleName('idlelib')
         self.assertTrue(dialog.entry_ok().endswith('__init__.py'))
         self.assertEqual(dialog.entry_error['text'], '')
-        dialog = self.Dummy_ModuleName('os.path')
-        self.assertTrue(dialog.entry_ok().endswith('path.py'))
+        dialog = self.Dummy_ModuleName('idlelib.idle')
+        self.assertTrue(dialog.entry_ok().endswith('idle.py'))
         self.assertEqual(dialog.entry_error['text'], '')
 
 
diff --git a/Lib/idlelib/idle_test/test_replace.py b/Lib/idlelib/idle_test/test_replace.py
index c3c5d2e..6c07389 100644
--- a/Lib/idlelib/idle_test/test_replace.py
+++ b/Lib/idlelib/idle_test/test_replace.py
@@ -10,7 +10,7 @@
 from idlelib.idle_test.mock_tk import Mbox
 import idlelib.searchengine as se
 
-orig_mbox = se.tkMessageBox
+orig_mbox = se.messagebox
 showerror = Mbox.showerror
 
 
@@ -20,7 +20,7 @@
     def setUpClass(cls):
         cls.root = Tk()
         cls.root.withdraw()
-        se.tkMessageBox = Mbox
+        se.messagebox = Mbox
         cls.engine = se.SearchEngine(cls.root)
         cls.dialog = ReplaceDialog(cls.root, cls.engine)
         cls.dialog.bell = lambda: None
@@ -32,7 +32,7 @@
 
     @classmethod
     def tearDownClass(cls):
-        se.tkMessageBox = orig_mbox
+        se.messagebox = orig_mbox
         del cls.text, cls.dialog, cls.engine
         cls.root.destroy()
         del cls.root
diff --git a/Lib/idlelib/idle_test/test_run.py b/Lib/idlelib/idle_test/test_run.py
index 37c0d45..ec4637c 100644
--- a/Lib/idlelib/idle_test/test_run.py
+++ b/Lib/idlelib/idle_test/test_run.py
@@ -1,16 +1,18 @@
-"Test run, coverage 49%."
+"Test run, coverage 54%."
 
 from idlelib import run
-import unittest
-from unittest import mock
-from idlelib.idle_test.mock_idle import Func
-from test.support import captured_output, captured_stderr
-
 import io
 import sys
+from test.support import captured_output, captured_stderr
+import unittest
+from unittest import mock
+import idlelib
+from idlelib.idle_test.mock_idle import Func
+
+idlelib.testing = True  # Use {} for executing test user code.
 
 
-class RunTest(unittest.TestCase):
+class ExceptionTest(unittest.TestCase):
 
     def test_print_exception_unhashable(self):
         class UnhashableException(Exception):
@@ -26,8 +28,7 @@
                 raise ex1
             except UnhashableException:
                 with captured_stderr() as output:
-                    with mock.patch.object(run,
-                                           'cleanup_traceback') as ct:
+                    with mock.patch.object(run, 'cleanup_traceback') as ct:
                         ct.side_effect = lambda t, e: t
                         run.print_exception()
 
@@ -36,6 +37,46 @@
         self.assertIn('UnhashableException: ex2', tb[3])
         self.assertIn('UnhashableException: ex1', tb[10])
 
+    data = (('1/0', ZeroDivisionError, "division by zero\n"),
+            ('abc', NameError, "name 'abc' is not defined. "
+                               "Did you mean: 'abs'?\n"),
+            ('int.reel', AttributeError,
+                 "type object 'int' has no attribute 'reel'. "
+                 "Did you mean: 'real'?\n"),
+            )
+
+    def test_get_message(self):
+        for code, exc, msg in self.data:
+            with self.subTest(code=code):
+                try:
+                    eval(compile(code, '', 'eval'))
+                except exc:
+                    typ, val, tb = sys.exc_info()
+                    actual = run.get_message_lines(typ, val, tb)[0]
+                    expect = f'{exc.__name__}: {msg}'
+                    self.assertEqual(actual, expect)
+
+    @mock.patch.object(run, 'cleanup_traceback',
+                       new_callable=lambda: (lambda t, e: None))
+    def test_get_multiple_message(self, mock):
+        d = self.data
+        data2 = ((d[0], d[1]), (d[1], d[2]), (d[2], d[0]))
+        subtests = 0
+        for (code1, exc1, msg1), (code2, exc2, msg2) in data2:
+            with self.subTest(codes=(code1,code2)):
+                try:
+                    eval(compile(code1, '', 'eval'))
+                except exc1:
+                    try:
+                        eval(compile(code2, '', 'eval'))
+                    except exc2:
+                        with captured_stderr() as output:
+                            run.print_exception()
+                        actual = output.getvalue()
+                        self.assertIn(msg1, actual)
+                        self.assertIn(msg2, actual)
+                        subtests += 1
+        self.assertEqual(subtests, len(data2))  # All subtests ran?
 
 # StdioFile tests.
 
@@ -351,5 +392,38 @@
             self.assertIn('IndexError', msg)
             eq(func.called, 2)
 
+
+class ExecRuncodeTest(unittest.TestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.addClassCleanup(setattr,run,'print_exception',run.print_exception)
+        cls.prt = Func()  # Need reference.
+        run.print_exception = cls.prt
+        mockrpc = mock.Mock()
+        mockrpc.console.getvar = Func(result=False)
+        cls.ex = run.Executive(mockrpc)
+
+    @classmethod
+    def tearDownClass(cls):
+        assert sys.excepthook == sys.__excepthook__
+
+    def test_exceptions(self):
+        ex = self.ex
+        ex.runcode('1/0')
+        self.assertIs(ex.user_exc_info[0], ZeroDivisionError)
+
+        self.addCleanup(setattr, sys, 'excepthook', sys.__excepthook__)
+        sys.excepthook = lambda t, e, tb: run.print_exception(t)
+        ex.runcode('1/0')
+        self.assertIs(self.prt.args[0], ZeroDivisionError)
+
+        sys.excepthook = lambda: None
+        ex.runcode('1/0')
+        t, e, tb = ex.user_exc_info
+        self.assertIs(t, TypeError)
+        self.assertTrue(isinstance(e.__context__, ZeroDivisionError))
+
+
 if __name__ == '__main__':
     unittest.main(verbosity=2)
diff --git a/Lib/idlelib/idle_test/test_searchengine.py b/Lib/idlelib/idle_test/test_searchengine.py
index f8401ce..9d97983 100644
--- a/Lib/idlelib/idle_test/test_searchengine.py
+++ b/Lib/idlelib/idle_test/test_searchengine.py
@@ -4,7 +4,7 @@
 import unittest
 # from test.support import requires
 from tkinter import  BooleanVar, StringVar, TclError  # ,Tk, Text
-import tkinter.messagebox as tkMessageBox
+from tkinter import messagebox
 from idlelib.idle_test.mock_tk import Var, Mbox
 from idlelib.idle_test.mock_tk import Text as mockText
 import re
@@ -19,13 +19,13 @@
     # Replace s-e module tkinter imports other than non-gui TclError.
     se.BooleanVar = Var
     se.StringVar = Var
-    se.tkMessageBox = Mbox
+    se.messagebox = Mbox
 
 def tearDownModule():
     # Restore 'just in case', though other tests should also replace.
     se.BooleanVar = BooleanVar
     se.StringVar = StringVar
-    se.tkMessageBox = tkMessageBox
+    se.messagebox = messagebox
 
 
 class Mock:
diff --git a/Lib/idlelib/idle_test/test_sidebar.py b/Lib/idlelib/idle_test/test_sidebar.py
index 2974a9a..01fd6a0 100644
--- a/Lib/idlelib/idle_test/test_sidebar.py
+++ b/Lib/idlelib/idle_test/test_sidebar.py
@@ -1,13 +1,22 @@
-"""Test sidebar, coverage 93%"""
-import idlelib.sidebar
+"""Test sidebar, coverage 85%"""
+from textwrap import dedent
+import sys
+
 from itertools import chain
 import unittest
 import unittest.mock
-from test.support import requires
+from test.support import requires, swap_attr
 import tkinter as tk
+from idlelib.idle_test.tkinter_testing_utils import run_in_tk_mainloop
 
 from idlelib.delegator import Delegator
+from idlelib.editor import fixwordbreaks
 from idlelib.percolator import Percolator
+import idlelib.pyshell
+from idlelib.pyshell import fix_x11_paste, PyShell, PyShellFileList
+from idlelib.run import fix_scaling
+import idlelib.sidebar
+from idlelib.sidebar import get_end_linenumber, get_lineno
 
 
 class Dummy_editwin:
@@ -31,6 +40,7 @@
     def setUpClass(cls):
         requires('gui')
         cls.root = tk.Tk()
+        cls.root.withdraw()
 
         cls.text_frame = tk.Frame(cls.root)
         cls.text_frame.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
@@ -154,7 +164,7 @@
         self.assert_sidebar_n_lines(3)
         self.assert_state_disabled()
 
-        # Note: deleting up to "2.end" doesn't delete the final newline.
+        # Deleting up to "2.end" doesn't delete the final newline.
         self.text.delete('2.0', '2.end')
         self.assert_text_equals('fbarfoo\n\n\n')
         self.assert_sidebar_n_lines(3)
@@ -165,7 +175,7 @@
         self.assert_sidebar_n_lines(1)
         self.assert_state_disabled()
 
-        # Note: Text widgets always keep a single '\n' character at the end.
+        # Text widgets always keep a single '\n' character at the end.
         self.text.delete('1.0', 'end')
         self.assert_text_equals('\n')
         self.assert_sidebar_n_lines(1)
@@ -234,11 +244,19 @@
         self.assert_sidebar_n_lines(4)
         self.assertEqual(get_width(), 1)
 
-        # Note: Text widgets always keep a single '\n' character at the end.
+        # Text widgets always keep a single '\n' character at the end.
         self.text.delete('1.0', 'end -1c')
         self.assert_sidebar_n_lines(1)
         self.assertEqual(get_width(), 1)
 
+    # The following tests are temporarily disabled due to relying on
+    # simulated user input and inspecting which text is selected, which
+    # are fragile and can fail when several GUI tests are run in parallel
+    # or when the windows created by the test lose focus.
+    #
+    # TODO: Re-work these tests or remove them from the test suite.
+
+    @unittest.skip('test disabled')
     def test_click_selection(self):
         self.linenumber.show_sidebar()
         self.text.insert('1.0', 'one\ntwo\nthree\nfour\n')
@@ -277,6 +295,7 @@
                                                     x=end_x, y=end_y)
         self.root.update()
 
+    @unittest.skip('test disabled')
     def test_drag_selection_down(self):
         self.linenumber.show_sidebar()
         self.text.insert('1.0', 'one\ntwo\nthree\nfour\nfive\n')
@@ -286,6 +305,7 @@
         self.simulate_drag(2, 4)
         self.assertEqual(self.get_selection(), ('2.0', '5.0'))
 
+    @unittest.skip('test disabled')
     def test_drag_selection_up(self):
         self.linenumber.show_sidebar()
         self.text.insert('1.0', 'one\ntwo\nthree\nfour\nfive\n')
@@ -353,7 +373,7 @@
         ln.hide_sidebar()
 
         self.highlight_cfg = test_colors
-        # Nothing breaks with inactive code context.
+        # Nothing breaks with inactive line numbers.
         ln.update_colors()
 
         # Show line numbers, previous colors change is immediately effective.
@@ -370,5 +390,376 @@
         assert_colors_are_equal(orig_colors)
 
 
+class ShellSidebarTest(unittest.TestCase):
+    root: tk.Tk = None
+    shell: PyShell = None
+
+    @classmethod
+    def setUpClass(cls):
+        requires('gui')
+
+        cls.root = root = tk.Tk()
+        root.withdraw()
+
+        fix_scaling(root)
+        fixwordbreaks(root)
+        fix_x11_paste(root)
+
+        cls.flist = flist = PyShellFileList(root)
+        # See #43981 about macosx.setupApp(root, flist) causing failure.
+        root.update_idletasks()
+
+        cls.init_shell()
+
+    @classmethod
+    def tearDownClass(cls):
+        if cls.shell is not None:
+            cls.shell.executing = False
+            cls.shell.close()
+            cls.shell = None
+        cls.flist = None
+        cls.root.update_idletasks()
+        cls.root.destroy()
+        cls.root = None
+
+    @classmethod
+    def init_shell(cls):
+        cls.shell = cls.flist.open_shell()
+        cls.shell.pollinterval = 10
+        cls.root.update()
+        cls.n_preface_lines = get_lineno(cls.shell.text, 'end-1c') - 1
+
+    @classmethod
+    def reset_shell(cls):
+        cls.shell.per.bottom.delete(f'{cls.n_preface_lines+1}.0', 'end-1c')
+        cls.shell.shell_sidebar.update_sidebar()
+        cls.root.update()
+
+    def setUp(self):
+        # In some test environments, e.g. Azure Pipelines (as of
+        # Apr. 2021), sys.stdout is changed between tests. However,
+        # PyShell relies on overriding sys.stdout when run without a
+        # sub-process (as done here; see setUpClass).
+        self._saved_stdout = None
+        if sys.stdout != self.shell.stdout:
+            self._saved_stdout = sys.stdout
+            sys.stdout = self.shell.stdout
+
+        self.reset_shell()
+
+    def tearDown(self):
+        if self._saved_stdout is not None:
+            sys.stdout = self._saved_stdout
+
+    def get_sidebar_lines(self):
+        canvas = self.shell.shell_sidebar.canvas
+        texts = list(canvas.find(tk.ALL))
+        texts_by_y_coords = {
+            canvas.bbox(text)[1]: canvas.itemcget(text, 'text')
+            for text in texts
+        }
+        line_y_coords = self.get_shell_line_y_coords()
+        return [texts_by_y_coords.get(y, None) for y in line_y_coords]
+
+    def assert_sidebar_lines_end_with(self, expected_lines):
+        self.shell.shell_sidebar.update_sidebar()
+        self.assertEqual(
+            self.get_sidebar_lines()[-len(expected_lines):],
+            expected_lines,
+        )
+
+    def get_shell_line_y_coords(self):
+        text = self.shell.text
+        y_coords = []
+        index = text.index("@0,0")
+        if index.split('.', 1)[1] != '0':
+            index = text.index(f"{index} +1line linestart")
+        while (lineinfo := text.dlineinfo(index)) is not None:
+            y_coords.append(lineinfo[1])
+            index = text.index(f"{index} +1line")
+        return y_coords
+
+    def get_sidebar_line_y_coords(self):
+        canvas = self.shell.shell_sidebar.canvas
+        texts = list(canvas.find(tk.ALL))
+        texts.sort(key=lambda text: canvas.bbox(text)[1])
+        return [canvas.bbox(text)[1] for text in texts]
+
+    def assert_sidebar_lines_synced(self):
+        self.assertLessEqual(
+            set(self.get_sidebar_line_y_coords()),
+            set(self.get_shell_line_y_coords()),
+        )
+
+    def do_input(self, input):
+        shell = self.shell
+        text = shell.text
+        for line_index, line in enumerate(input.split('\n')):
+            if line_index > 0:
+                text.event_generate('<<newline-and-indent>>')
+            text.insert('insert', line, 'stdin')
+
+    def test_initial_state(self):
+        sidebar_lines = self.get_sidebar_lines()
+        self.assertEqual(
+            sidebar_lines,
+            [None] * (len(sidebar_lines) - 1) + ['>>>'],
+        )
+        self.assert_sidebar_lines_synced()
+
+    @run_in_tk_mainloop()
+    def test_single_empty_input(self):
+        self.do_input('\n')
+        yield
+        self.assert_sidebar_lines_end_with(['>>>', '>>>'])
+
+    @run_in_tk_mainloop()
+    def test_single_line_statement(self):
+        self.do_input('1\n')
+        yield
+        self.assert_sidebar_lines_end_with(['>>>', None, '>>>'])
+
+    @run_in_tk_mainloop()
+    def test_multi_line_statement(self):
+        # Block statements are not indented because IDLE auto-indents.
+        self.do_input(dedent('''\
+            if True:
+            print(1)
+
+            '''))
+        yield
+        self.assert_sidebar_lines_end_with([
+            '>>>',
+            '...',
+            '...',
+            '...',
+            None,
+            '>>>',
+        ])
+
+    @run_in_tk_mainloop()
+    def test_single_long_line_wraps(self):
+        self.do_input('1' * 200 + '\n')
+        yield
+        self.assert_sidebar_lines_end_with(['>>>', None, '>>>'])
+        self.assert_sidebar_lines_synced()
+
+    @run_in_tk_mainloop()
+    def test_squeeze_multi_line_output(self):
+        shell = self.shell
+        text = shell.text
+
+        self.do_input('print("a\\nb\\nc")\n')
+        yield
+        self.assert_sidebar_lines_end_with(['>>>', None, None, None, '>>>'])
+
+        text.mark_set('insert', f'insert -1line linestart')
+        text.event_generate('<<squeeze-current-text>>')
+        yield
+        self.assert_sidebar_lines_end_with(['>>>', None, '>>>'])
+        self.assert_sidebar_lines_synced()
+
+        shell.squeezer.expandingbuttons[0].expand()
+        yield
+        self.assert_sidebar_lines_end_with(['>>>', None, None, None, '>>>'])
+        self.assert_sidebar_lines_synced()
+
+    @run_in_tk_mainloop()
+    def test_interrupt_recall_undo_redo(self):
+        text = self.shell.text
+        # Block statements are not indented because IDLE auto-indents.
+        initial_sidebar_lines = self.get_sidebar_lines()
+
+        self.do_input(dedent('''\
+            if True:
+            print(1)
+            '''))
+        yield
+        self.assert_sidebar_lines_end_with(['>>>', '...', '...'])
+        with_block_sidebar_lines = self.get_sidebar_lines()
+        self.assertNotEqual(with_block_sidebar_lines, initial_sidebar_lines)
+
+        # Control-C
+        text.event_generate('<<interrupt-execution>>')
+        yield
+        self.assert_sidebar_lines_end_with(['>>>', '...', '...', None, '>>>'])
+
+        # Recall previous via history
+        text.event_generate('<<history-previous>>')
+        text.event_generate('<<interrupt-execution>>')
+        yield
+        self.assert_sidebar_lines_end_with(['>>>', '...', None, '>>>'])
+
+        # Recall previous via recall
+        text.mark_set('insert', text.index('insert -2l'))
+        text.event_generate('<<newline-and-indent>>')
+        yield
+
+        text.event_generate('<<undo>>')
+        yield
+        self.assert_sidebar_lines_end_with(['>>>'])
+
+        text.event_generate('<<redo>>')
+        yield
+        self.assert_sidebar_lines_end_with(['>>>', '...'])
+
+        text.event_generate('<<newline-and-indent>>')
+        text.event_generate('<<newline-and-indent>>')
+        yield
+        self.assert_sidebar_lines_end_with(
+            ['>>>', '...', '...', '...', None, '>>>']
+        )
+
+    @run_in_tk_mainloop()
+    def test_very_long_wrapped_line(self):
+        with swap_attr(self.shell, 'squeezer', None):
+            self.do_input('x = ' + '1'*10_000 + '\n')
+            yield
+            self.assertEqual(self.get_sidebar_lines(), ['>>>'])
+
+    def test_font(self):
+        sidebar = self.shell.shell_sidebar
+
+        test_font = 'TkTextFont'
+
+        def mock_idleconf_GetFont(root, configType, section):
+            return test_font
+        GetFont_patcher = unittest.mock.patch.object(
+            idlelib.sidebar.idleConf, 'GetFont', mock_idleconf_GetFont)
+        GetFont_patcher.start()
+        def cleanup():
+            GetFont_patcher.stop()
+            sidebar.update_font()
+        self.addCleanup(cleanup)
+
+        def get_sidebar_font():
+            canvas = sidebar.canvas
+            texts = list(canvas.find(tk.ALL))
+            fonts = {canvas.itemcget(text, 'font') for text in texts}
+            self.assertEqual(len(fonts), 1)
+            return next(iter(fonts))
+
+        self.assertNotEqual(get_sidebar_font(), test_font)
+        sidebar.update_font()
+        self.assertEqual(get_sidebar_font(), test_font)
+
+    def test_highlight_colors(self):
+        sidebar = self.shell.shell_sidebar
+
+        test_colors = {"background": '#abcdef', "foreground": '#123456'}
+
+        orig_idleConf_GetHighlight = idlelib.sidebar.idleConf.GetHighlight
+        def mock_idleconf_GetHighlight(theme, element):
+            if element in ['linenumber', 'console']:
+                return test_colors
+            return orig_idleConf_GetHighlight(theme, element)
+        GetHighlight_patcher = unittest.mock.patch.object(
+            idlelib.sidebar.idleConf, 'GetHighlight',
+            mock_idleconf_GetHighlight)
+        GetHighlight_patcher.start()
+        def cleanup():
+            GetHighlight_patcher.stop()
+            sidebar.update_colors()
+        self.addCleanup(cleanup)
+
+        def get_sidebar_colors():
+            canvas = sidebar.canvas
+            texts = list(canvas.find(tk.ALL))
+            fgs = {canvas.itemcget(text, 'fill') for text in texts}
+            self.assertEqual(len(fgs), 1)
+            fg = next(iter(fgs))
+            bg = canvas.cget('background')
+            return {"background": bg, "foreground": fg}
+
+        self.assertNotEqual(get_sidebar_colors(), test_colors)
+        sidebar.update_colors()
+        self.assertEqual(get_sidebar_colors(), test_colors)
+
+    @run_in_tk_mainloop()
+    def test_mousewheel(self):
+        sidebar = self.shell.shell_sidebar
+        text = self.shell.text
+
+        # Enter a 100-line string to scroll the shell screen down.
+        self.do_input('x = """' + '\n'*100 + '"""\n')
+        yield
+        self.assertGreater(get_lineno(text, '@0,0'), 1)
+
+        last_lineno = get_end_linenumber(text)
+        self.assertIsNotNone(text.dlineinfo(text.index(f'{last_lineno}.0')))
+
+        # Scroll up using the <MouseWheel> event.
+        # The meaning delta is platform-dependant.
+        delta = -1 if sys.platform == 'darwin' else 120
+        sidebar.canvas.event_generate('<MouseWheel>', x=0, y=0, delta=delta)
+        yield
+        self.assertIsNone(text.dlineinfo(text.index(f'{last_lineno}.0')))
+
+        # Scroll back down using the <Button-5> event.
+        sidebar.canvas.event_generate('<Button-5>', x=0, y=0)
+        yield
+        self.assertIsNotNone(text.dlineinfo(text.index(f'{last_lineno}.0')))
+
+    @run_in_tk_mainloop()
+    def test_copy(self):
+        sidebar = self.shell.shell_sidebar
+        text = self.shell.text
+
+        first_line = get_end_linenumber(text)
+
+        self.do_input(dedent('''\
+            if True:
+            print(1)
+
+            '''))
+        yield
+
+        text.tag_add('sel', f'{first_line}.0', 'end-1c')
+        selected_text = text.get('sel.first', 'sel.last')
+        self.assertTrue(selected_text.startswith('if True:\n'))
+        self.assertIn('\n1\n', selected_text)
+
+        text.event_generate('<<copy>>')
+        self.addCleanup(text.clipboard_clear)
+
+        copied_text = text.clipboard_get()
+        self.assertEqual(copied_text, selected_text)
+
+    @run_in_tk_mainloop()
+    def test_copy_with_prompts(self):
+        sidebar = self.shell.shell_sidebar
+        text = self.shell.text
+
+        first_line = get_end_linenumber(text)
+        self.do_input(dedent('''\
+            if True:
+            print(1)
+
+            '''))
+        yield
+
+        text.tag_add('sel', f'{first_line}.3', 'end-1c')
+        selected_text = text.get('sel.first', 'sel.last')
+        self.assertTrue(selected_text.startswith('True:\n'))
+
+        selected_lines_text = text.get('sel.first linestart', 'sel.last')
+        selected_lines = selected_lines_text.split('\n')
+        # Expect a block of input, a single output line, and a new prompt
+        expected_prompts = \
+            ['>>>'] + ['...'] * (len(selected_lines) - 3) + [None, '>>>']
+        selected_text_with_prompts = '\n'.join(
+            line if prompt is None else prompt + ' ' + line
+            for prompt, line in zip(expected_prompts,
+                                    selected_lines,
+                                    strict=True)
+        ) + '\n'
+
+        text.event_generate('<<copy-with-prompts>>')
+        self.addCleanup(text.clipboard_clear)
+
+        copied_text = text.clipboard_get()
+        self.assertEqual(copied_text, selected_text_with_prompts)
+
+
 if __name__ == '__main__':
     unittest.main(verbosity=2)
diff --git a/Lib/idlelib/idle_test/test_squeezer.py b/Lib/idlelib/idle_test/test_squeezer.py
index e3912f4..86c5d41 100644
--- a/Lib/idlelib/idle_test/test_squeezer.py
+++ b/Lib/idlelib/idle_test/test_squeezer.py
@@ -7,13 +7,12 @@
 from test.support import requires
 
 from idlelib.config import idleConf
+from idlelib.percolator import Percolator
 from idlelib.squeezer import count_lines_with_wrapping, ExpandingButton, \
     Squeezer
 from idlelib import macosx
 from idlelib.textview import view_text
 from idlelib.tooltip import Hovertip
-from idlelib.pyshell import PyShell
-
 
 SENTINEL_VALUE = sentinel.SENTINEL_VALUE
 
@@ -205,8 +204,8 @@
         self.assertEqual(text_widget.get('1.0', 'end'), '\n')
         self.assertEqual(len(squeezer.expandingbuttons), 1)
 
-    def test_squeeze_current_text_event(self):
-        """Test the squeeze_current_text event."""
+    def test_squeeze_current_text(self):
+        """Test the squeeze_current_text method."""
         # Squeezing text should work for both stdout and stderr.
         for tag_name in ["stdout", "stderr"]:
             editwin = self.make_mock_editor_window(with_text_widget=True)
@@ -222,7 +221,7 @@
             self.assertEqual(len(squeezer.expandingbuttons), 0)
 
             # Test squeezing the current text.
-            retval = squeezer.squeeze_current_text_event(event=Mock())
+            retval = squeezer.squeeze_current_text()
             self.assertEqual(retval, "break")
             self.assertEqual(text_widget.get('1.0', 'end'), '\n\n')
             self.assertEqual(len(squeezer.expandingbuttons), 1)
@@ -230,11 +229,11 @@
 
             # Test that expanding the squeezed text works and afterwards
             # the Text widget contains the original text.
-            squeezer.expandingbuttons[0].expand(event=Mock())
+            squeezer.expandingbuttons[0].expand()
             self.assertEqual(text_widget.get('1.0', 'end'), 'SOME\nTEXT\n\n')
             self.assertEqual(len(squeezer.expandingbuttons), 0)
 
-    def test_squeeze_current_text_event_no_allowed_tags(self):
+    def test_squeeze_current_text_no_allowed_tags(self):
         """Test that the event doesn't squeeze text without a relevant tag."""
         editwin = self.make_mock_editor_window(with_text_widget=True)
         text_widget = editwin.text
@@ -249,7 +248,7 @@
         self.assertEqual(len(squeezer.expandingbuttons), 0)
 
         # Test squeezing the current text.
-        retval = squeezer.squeeze_current_text_event(event=Mock())
+        retval = squeezer.squeeze_current_text()
         self.assertEqual(retval, "break")
         self.assertEqual(text_widget.get('1.0', 'end'), 'SOME\nTEXT\n\n')
         self.assertEqual(len(squeezer.expandingbuttons), 0)
@@ -264,13 +263,13 @@
         # Prepare some text in the Text widget and squeeze it.
         text_widget.insert("1.0", "SOME\nTEXT\n", "stdout")
         text_widget.mark_set("insert", "1.0")
-        squeezer.squeeze_current_text_event(event=Mock())
+        squeezer.squeeze_current_text()
         self.assertEqual(len(squeezer.expandingbuttons), 1)
 
         # Test squeezing the current text.
         text_widget.insert("1.0", "MORE\nSTUFF\n", "stdout")
         text_widget.mark_set("insert", "1.0")
-        retval = squeezer.squeeze_current_text_event(event=Mock())
+        retval = squeezer.squeeze_current_text()
         self.assertEqual(retval, "break")
         self.assertEqual(text_widget.get('1.0', 'end'), '\n\n\n')
         self.assertEqual(len(squeezer.expandingbuttons), 2)
@@ -311,6 +310,8 @@
         root = get_test_tk_root(self)
         squeezer = Mock()
         squeezer.editwin.text = Text(root)
+        squeezer.editwin.per = Percolator(squeezer.editwin.text)
+        self.addCleanup(squeezer.editwin.per.close)
 
         # Set default values for the configuration settings.
         squeezer.auto_squeeze_min_lines = 50
@@ -352,14 +353,9 @@
 
         # Insert the button into the text widget
         # (this is normally done by the Squeezer class).
-        text_widget = expandingbutton.text
+        text_widget = squeezer.editwin.text
         text_widget.window_create("1.0", window=expandingbutton)
 
-        # Set base_text to the text widget, so that changes are actually
-        # made to it (by ExpandingButton) and we can inspect these
-        # changes afterwards.
-        expandingbutton.base_text = expandingbutton.text
-
         # trigger the expand event
         retval = expandingbutton.expand(event=Mock())
         self.assertEqual(retval, None)
@@ -390,13 +386,8 @@
         text_widget = expandingbutton.text
         text_widget.window_create("1.0", window=expandingbutton)
 
-        # Set base_text to the text widget, so that changes are actually
-        # made to it (by ExpandingButton) and we can inspect these
-        # changes afterwards.
-        expandingbutton.base_text = expandingbutton.text
-
         # Patch the message box module to always return False.
-        with patch('idlelib.squeezer.tkMessageBox') as mock_msgbox:
+        with patch('idlelib.squeezer.messagebox') as mock_msgbox:
             mock_msgbox.askokcancel.return_value = False
             mock_msgbox.askyesno.return_value = False
             # Trigger the expand event.
@@ -407,7 +398,7 @@
         self.assertEqual(expandingbutton.text.get('1.0', 'end-1c'), '')
 
         # Patch the message box module to always return True.
-        with patch('idlelib.squeezer.tkMessageBox') as mock_msgbox:
+        with patch('idlelib.squeezer.messagebox') as mock_msgbox:
             mock_msgbox.askokcancel.return_value = True
             mock_msgbox.askyesno.return_value = True
             # Trigger the expand event.
diff --git a/Lib/idlelib/idle_test/test_util.py b/Lib/idlelib/idle_test/test_util.py
new file mode 100644
index 0000000..20721fe
--- /dev/null
+++ b/Lib/idlelib/idle_test/test_util.py
@@ -0,0 +1,14 @@
+"""Test util, coverage 100%"""
+
+import unittest
+from idlelib import util
+
+
+class UtilTest(unittest.TestCase):
+    def test_extensions(self):
+        for extension in {'.pyi', '.py', '.pyw'}:
+            self.assertIn(extension, util.py_extensions)
+
+
+if __name__ == '__main__':
+    unittest.main(verbosity=2)
diff --git a/Lib/idlelib/idle_test/test_zzdummy.py b/Lib/idlelib/idle_test/test_zzdummy.py
new file mode 100644
index 0000000..1013cdc
--- /dev/null
+++ b/Lib/idlelib/idle_test/test_zzdummy.py
@@ -0,0 +1,152 @@
+"Test zzdummy, coverage 100%."
+
+from idlelib import zzdummy
+import unittest
+from test.support import requires
+from tkinter import Tk, Text
+from unittest import mock
+from idlelib import config
+from idlelib import editor
+from idlelib import format
+
+
+usercfg = zzdummy.idleConf.userCfg
+testcfg = {
+    'main': config.IdleUserConfParser(''),
+    'highlight': config.IdleUserConfParser(''),
+    'keys': config.IdleUserConfParser(''),
+    'extensions': config.IdleUserConfParser(''),
+}
+code_sample = """\
+
+class C1():
+    # Class comment.
+    def __init__(self, a, b):
+        self.a = a
+        self.b = b
+"""
+
+
+class DummyEditwin:
+    get_selection_indices = editor.EditorWindow.get_selection_indices
+    def __init__(self, root, text):
+        self.root = root
+        self.top = root
+        self.text = text
+        self.fregion = format.FormatRegion(self)
+        self.text.undo_block_start = mock.Mock()
+        self.text.undo_block_stop = mock.Mock()
+
+
+class ZZDummyTest(unittest.TestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        requires('gui')
+        root = cls.root = Tk()
+        root.withdraw()
+        text = cls.text = Text(cls.root)
+        cls.editor = DummyEditwin(root, text)
+        zzdummy.idleConf.userCfg = testcfg
+
+    @classmethod
+    def tearDownClass(cls):
+        zzdummy.idleConf.userCfg = usercfg
+        del cls.editor, cls.text
+        cls.root.update_idletasks()
+        for id in cls.root.tk.call('after', 'info'):
+            cls.root.after_cancel(id)  # Need for EditorWindow.
+        cls.root.destroy()
+        del cls.root
+
+    def setUp(self):
+        text = self.text
+        text.insert('1.0', code_sample)
+        text.undo_block_start.reset_mock()
+        text.undo_block_stop.reset_mock()
+        zz = self.zz = zzdummy.ZzDummy(self.editor)
+        zzdummy.ZzDummy.ztext = '# ignore #'
+
+    def tearDown(self):
+        self.text.delete('1.0', 'end')
+        del self.zz
+
+    def checklines(self, text, value):
+        # Verify that there are lines being checked.
+        end_line = int(float(text.index('end')))
+
+        # Check each line for the starting text.
+        actual = []
+        for line in range(1, end_line):
+            txt = text.get(f'{line}.0', f'{line}.end')
+            actual.append(txt.startswith(value))
+        return actual
+
+    def test_init(self):
+        zz = self.zz
+        self.assertEqual(zz.editwin, self.editor)
+        self.assertEqual(zz.text, self.editor.text)
+
+    def test_reload(self):
+        self.assertEqual(self.zz.ztext, '# ignore #')
+        testcfg['extensions'].SetOption('ZzDummy', 'z-text', 'spam')
+        zzdummy.ZzDummy.reload()
+        self.assertEqual(self.zz.ztext, 'spam')
+
+    def test_z_in_event(self):
+        eq = self.assertEqual
+        zz = self.zz
+        text = zz.text
+        eq(self.zz.ztext, '# ignore #')
+
+        # No lines have the leading text.
+        expected = [False, False, False, False, False, False, False]
+        actual = self.checklines(text, zz.ztext)
+        eq(expected, actual)
+
+        text.tag_add('sel', '2.0', '4.end')
+        eq(zz.z_in_event(), 'break')
+        expected = [False, True, True, True, False, False, False]
+        actual = self.checklines(text, zz.ztext)
+        eq(expected, actual)
+
+        text.undo_block_start.assert_called_once()
+        text.undo_block_stop.assert_called_once()
+
+    def test_z_out_event(self):
+        eq = self.assertEqual
+        zz = self.zz
+        text = zz.text
+        eq(self.zz.ztext, '# ignore #')
+
+        # Prepend text.
+        text.tag_add('sel', '2.0', '5.end')
+        zz.z_in_event()
+        text.undo_block_start.reset_mock()
+        text.undo_block_stop.reset_mock()
+
+        # Select a few lines to remove text.
+        text.tag_remove('sel', '1.0', 'end')
+        text.tag_add('sel', '3.0', '4.end')
+        eq(zz.z_out_event(), 'break')
+        expected = [False, True, False, False, True, False, False]
+        actual = self.checklines(text, zz.ztext)
+        eq(expected, actual)
+
+        text.undo_block_start.assert_called_once()
+        text.undo_block_stop.assert_called_once()
+
+    def test_roundtrip(self):
+        # Insert and remove to all code should give back original text.
+        zz = self.zz
+        text = zz.text
+
+        text.tag_add('sel', '1.0', 'end-1c')
+        zz.z_in_event()
+        zz.z_out_event()
+
+        self.assertEqual(text.get('1.0', 'end-1c'), code_sample)
+
+
+if __name__ == '__main__':
+    unittest.main(verbosity=2)
diff --git a/Lib/idlelib/idle_test/tkinter_testing_utils.py b/Lib/idlelib/idle_test/tkinter_testing_utils.py
new file mode 100644
index 0000000..a89839b
--- /dev/null
+++ b/Lib/idlelib/idle_test/tkinter_testing_utils.py
@@ -0,0 +1,62 @@
+"""Utilities for testing with Tkinter"""
+import functools
+
+
+def run_in_tk_mainloop(delay=1):
+    """Decorator for running a test method with a real Tk mainloop.
+
+    This starts a Tk mainloop before running the test, and stops it
+    at the end. This is faster and more robust than the common
+    alternative method of calling .update() and/or .update_idletasks().
+
+    Test methods using this must be written as generator functions,
+    using "yield" to allow the mainloop to process events and "after"
+    callbacks, and then continue the test from that point.
+
+    The delay argument is passed into root.after(...) calls as the number
+    of ms to wait before passing execution back to the generator function.
+
+    This also assumes that the test class has a .root attribute,
+    which is a tkinter.Tk object.
+
+    For example (from test_sidebar.py):
+
+    @run_test_with_tk_mainloop()
+    def test_single_empty_input(self):
+        self.do_input('\n')
+        yield
+        self.assert_sidebar_lines_end_with(['>>>', '>>>'])
+    """
+    def decorator(test_method):
+        @functools.wraps(test_method)
+        def new_test_method(self):
+            test_generator = test_method(self)
+            root = self.root
+            # Exceptions raised by self.assert...() need to be raised
+            # outside of the after() callback in order for the test
+            # harness to capture them.
+            exception = None
+            def after_callback():
+                nonlocal exception
+                try:
+                    next(test_generator)
+                except StopIteration:
+                    root.quit()
+                except Exception as exc:
+                    exception = exc
+                    root.quit()
+                else:
+                    # Schedule the Tk mainloop to call this function again,
+                    # using a robust method of ensuring that it gets a
+                    # chance to process queued events before doing so.
+                    # See: https://stackoverflow.com/q/18499082#comment65004099_38817470
+                    root.after(delay, root.after_idle, after_callback)
+            root.after(0, root.after_idle, after_callback)
+            root.mainloop()
+
+            if exception:
+                raise exception
+
+        return new_test_method
+
+    return decorator
diff --git a/Lib/idlelib/iomenu.py b/Lib/idlelib/iomenu.py
index 8bb2fa6..ad3109d 100644
--- a/Lib/idlelib/iomenu.py
+++ b/Lib/idlelib/iomenu.py
@@ -5,12 +5,15 @@
 import tempfile
 import tokenize
 
-import tkinter.filedialog as tkFileDialog
-import tkinter.messagebox as tkMessageBox
+from tkinter import filedialog
+from tkinter import messagebox
 from tkinter.simpledialog import askstring
 
 import idlelib
 from idlelib.config import idleConf
+from idlelib.util import py_extensions
+
+py_extensions = ' '.join("*"+ext for ext in py_extensions)
 
 encoding = 'utf-8'
 if sys.platform == 'win32':
@@ -147,10 +150,10 @@
                     eol_convention = f.newlines
                     converted = True
         except OSError as err:
-            tkMessageBox.showerror("I/O Error", str(err), parent=self.text)
+            messagebox.showerror("I/O Error", str(err), parent=self.text)
             return False
         except UnicodeDecodeError:
-            tkMessageBox.showerror("Decoding Error",
+            messagebox.showerror("Decoding Error",
                                    "File %s\nFailed to Decode" % filename,
                                    parent=self.text)
             return False
@@ -159,7 +162,7 @@
             # If the file does not contain line separators, it is None.
             # If the file contains mixed line separators, it is a tuple.
             if eol_convention is not None:
-                tkMessageBox.showwarning("Mixed Newlines",
+                messagebox.showwarning("Mixed Newlines",
                                          "Mixed newlines detected.\n"
                                          "The file will be changed on save.",
                                          parent=self.text)
@@ -187,10 +190,10 @@
             return "yes"
         message = "Do you want to save %s before closing?" % (
             self.filename or "this untitled document")
-        confirm = tkMessageBox.askyesnocancel(
+        confirm = messagebox.askyesnocancel(
                   title="Save On Close",
                   message=message,
-                  default=tkMessageBox.YES,
+                  default=messagebox.YES,
                   parent=self.text)
         if confirm:
             reply = "yes"
@@ -249,7 +252,7 @@
                 os.fsync(f.fileno())
             return True
         except OSError as msg:
-            tkMessageBox.showerror("I/O Error", str(msg),
+            messagebox.showerror("I/O Error", str(msg),
                                    parent=self.text)
             return False
 
@@ -286,7 +289,7 @@
             failed = str(err)
         except UnicodeEncodeError:
             failed = "Invalid encoding '%s'" % enc
-        tkMessageBox.showerror(
+        messagebox.showerror(
             "I/O Error",
             "%s.\nSaving as UTF-8" % failed,
             parent=self.text)
@@ -295,10 +298,10 @@
         return chars.encode('utf-8-sig')
 
     def print_window(self, event):
-        confirm = tkMessageBox.askokcancel(
+        confirm = messagebox.askokcancel(
                   title="Print",
                   message="Print to Default Printer",
-                  default=tkMessageBox.OK,
+                  default=messagebox.OK,
                   parent=self.text)
         if not confirm:
             self.text.focus_set()
@@ -336,10 +339,10 @@
                          status + output
             if output:
                 output = "Printing command: %s\n" % repr(command) + output
-                tkMessageBox.showerror("Print status", output, parent=self.text)
+                messagebox.showerror("Print status", output, parent=self.text)
         else:  #no printing for this platform
             message = "Printing is not enabled for this platform: %s" % platform
-            tkMessageBox.showinfo("Print status", message, parent=self.text)
+            messagebox.showinfo("Print status", message, parent=self.text)
         if tempfilename:
             os.unlink(tempfilename)
         return "break"
@@ -348,7 +351,7 @@
     savedialog = None
 
     filetypes = (
-        ("Python files", "*.py *.pyw", "TEXT"),
+        ("Python files", py_extensions, "TEXT"),
         ("Text files", "*.txt", "TEXT"),
         ("All files", "*"),
         )
@@ -358,7 +361,7 @@
     def askopenfile(self):
         dir, base = self.defaultfilename("open")
         if not self.opendialog:
-            self.opendialog = tkFileDialog.Open(parent=self.text,
+            self.opendialog = filedialog.Open(parent=self.text,
                                                 filetypes=self.filetypes)
         filename = self.opendialog.show(initialdir=dir, initialfile=base)
         return filename
@@ -378,7 +381,7 @@
     def asksavefile(self):
         dir, base = self.defaultfilename("save")
         if not self.savedialog:
-            self.savedialog = tkFileDialog.SaveAs(
+            self.savedialog = filedialog.SaveAs(
                     parent=self.text,
                     filetypes=self.filetypes,
                     defaultextension=self.defaultextension)
diff --git a/Lib/idlelib/macosx.py b/Lib/idlelib/macosx.py
index eeaab59..470de5d 100644
--- a/Lib/idlelib/macosx.py
+++ b/Lib/idlelib/macosx.py
@@ -83,7 +83,7 @@
             return False
         return ("WARNING: The version of Tcl/Tk ({0}) in use may"
                 " be unstable.\n"
-                "Visit http://www.python.org/download/mac/tcltk/"
+                "Visit https://www.python.org/download/mac/tcltk/"
                 " for current information.".format(patchlevel))
     else:
         return False
diff --git a/Lib/idlelib/mainmenu.py b/Lib/idlelib/mainmenu.py
index 74edce2..a1b1691 100644
--- a/Lib/idlelib/mainmenu.py
+++ b/Lib/idlelib/mainmenu.py
@@ -34,8 +34,8 @@
    None,
    ('Prin_t Window', '<<print-window>>'),
    None,
-   ('_Close', '<<close-window>>'),
-   ('E_xit', '<<close-all-windows>>'),
+   ('_Close Window', '<<close-window>>'),
+   ('E_xit IDLE', '<<close-all-windows>>'),
    ]),
 
  ('edit', [
diff --git a/Lib/idlelib/percolator.py b/Lib/idlelib/percolator.py
index db70304..1fe34d2 100644
--- a/Lib/idlelib/percolator.py
+++ b/Lib/idlelib/percolator.py
@@ -38,6 +38,21 @@
         filter.setdelegate(self.top)
         self.top = filter
 
+    def insertfilterafter(self, filter, after):
+        assert isinstance(filter, Delegator)
+        assert isinstance(after, Delegator)
+        assert filter.delegate is None
+
+        f = self.top
+        f.resetcache()
+        while f is not after:
+            assert f is not self.bottom
+            f = f.delegate
+            f.resetcache()
+
+        filter.setdelegate(f.delegate)
+        f.setdelegate(filter)
+
     def removefilter(self, filter):
         # XXX Perhaps should only support popfilter()?
         assert isinstance(filter, Delegator)
diff --git a/Lib/idlelib/pyparse.py b/Lib/idlelib/pyparse.py
index d34872b..8545c63 100644
--- a/Lib/idlelib/pyparse.py
+++ b/Lib/idlelib/pyparse.py
@@ -179,14 +179,10 @@
         # Peeking back worked; look forward until _synchre no longer
         # matches.
         i = pos + 1
-        while 1:
-            m = _synchre(code, i)
-            if m:
-                s, i = m.span()
-                if not is_char_in_string(s):
-                    pos = s
-            else:
-                break
+        while m := _synchre(code, i):
+            s, i = m.span()
+            if not is_char_in_string(s):
+                pos = s
         return pos
 
     def set_lo(self, lo):
diff --git a/Lib/idlelib/pyshell.py b/Lib/idlelib/pyshell.py
index adc3028..6c333b0 100755
--- a/Lib/idlelib/pyshell.py
+++ b/Lib/idlelib/pyshell.py
@@ -21,18 +21,19 @@
     except (ImportError, AttributeError, OSError):
         pass
 
-import tkinter.messagebox as tkMessageBox
+from tkinter import messagebox
 if TkVersion < 8.5:
     root = Tk()  # otherwise create root in main
     root.withdraw()
     from idlelib.run import fix_scaling
     fix_scaling(root)
-    tkMessageBox.showerror("Idle Cannot Start",
+    messagebox.showerror("Idle Cannot Start",
             "Idle requires tcl/tk 8.5+, not %s." % TkVersion,
             parent=root)
     raise SystemExit(1)
 
 from code import InteractiveInterpreter
+import itertools
 import linecache
 import os
 import os.path
@@ -48,18 +49,30 @@
 
 from idlelib.colorizer import ColorDelegator
 from idlelib.config import idleConf
+from idlelib.delegator import Delegator
 from idlelib import debugger
 from idlelib import debugger_r
 from idlelib.editor import EditorWindow, fixwordbreaks
 from idlelib.filelist import FileList
 from idlelib.outwin import OutputWindow
+from idlelib import replace
 from idlelib import rpc
 from idlelib.run import idle_formatwarning, StdInputFile, StdOutputFile
 from idlelib.undo import UndoDelegator
 
+# Default for testing; defaults to True in main() for running.
+use_subprocess = False
+
 HOST = '127.0.0.1' # python execution server on localhost loopback
 PORT = 0  # someday pass in host, port for remote debug capability
 
+try:  # In case IDLE started with -n.
+    eof = 'Ctrl-D (end-of-file)'
+    exit.eof = eof
+    quit.eof = eof
+except NameError: # In case python started with -S.
+    pass
+
 # Override warnings module to write to warning_stream.  Initialize to send IDLE
 # internal warnings to the console.  ScriptBinding.check_syntax() will
 # temporarily redirect the stream to the shell window to display warnings when
@@ -261,7 +274,7 @@
         except OSError as err:
             if not getattr(self.root, "breakpoint_error_displayed", False):
                 self.root.breakpoint_error_displayed = True
-                tkMessageBox.showerror(title='IDLE Error',
+                messagebox.showerror(title='IDLE Error',
                     message='Unable to update breakpoint list:\n%s'
                         % str(err),
                     parent=self.text)
@@ -335,34 +348,19 @@
 
 class ModifiedColorDelegator(ColorDelegator):
     "Extend base class: colorizer for the shell window itself"
-
-    def __init__(self):
-        ColorDelegator.__init__(self)
-        self.LoadTagDefs()
-
     def recolorize_main(self):
         self.tag_remove("TODO", "1.0", "iomark")
         self.tag_add("SYNC", "1.0", "iomark")
         ColorDelegator.recolorize_main(self)
 
-    def LoadTagDefs(self):
-        ColorDelegator.LoadTagDefs(self)
-        theme = idleConf.CurrentTheme()
-        self.tagdefs.update({
-            "stdin": {'background':None,'foreground':None},
-            "stdout": idleConf.GetHighlight(theme, "stdout"),
-            "stderr": idleConf.GetHighlight(theme, "stderr"),
-            "console": idleConf.GetHighlight(theme, "console"),
-        })
-
     def removecolors(self):
         # Don't remove shell color tags before "iomark"
         for tag in self.tagdefs:
             self.tag_remove(tag, "iomark", "end")
 
+
 class ModifiedUndoDelegator(UndoDelegator):
     "Extend base class: forbid insert/delete before the I/O mark"
-
     def insert(self, index, chars, tags=None):
         try:
             if self.delegate.compare(index, "<", "iomark"):
@@ -381,6 +379,27 @@
             pass
         UndoDelegator.delete(self, index1, index2)
 
+    def undo_event(self, event):
+        # Temporarily monkey-patch the delegate's .insert() method to
+        # always use the "stdin" tag.  This is needed for undo-ing
+        # deletions to preserve the "stdin" tag, because UndoDelegator
+        # doesn't preserve tags for deleted text.
+        orig_insert = self.delegate.insert
+        self.delegate.insert = \
+            lambda index, chars: orig_insert(index, chars, "stdin")
+        try:
+            super().undo_event(event)
+        finally:
+            self.delegate.insert = orig_insert
+
+
+class UserInputTaggingDelegator(Delegator):
+    """Delegator used to tag user input with "stdin"."""
+    def insert(self, index, chars, tags=None):
+        if tags is None:
+            tags = "stdin"
+        self.delegate.insert(index, chars, tags)
+
 
 class MyRPCClient(rpc.RPCClient):
 
@@ -463,7 +482,7 @@
         self.rpcclt.listening_sock.settimeout(10)
         try:
             self.rpcclt.accept()
-        except socket.timeout:
+        except TimeoutError:
             self.display_no_subprocess_error()
             return None
         self.rpcclt.register("console", self.tkconsole)
@@ -498,7 +517,7 @@
         self.spawn_subprocess()
         try:
             self.rpcclt.accept()
-        except socket.timeout:
+        except TimeoutError:
             self.display_no_subprocess_error()
             return None
         self.transfer_path(with_cwd=with_cwd)
@@ -771,7 +790,7 @@
                 exec(code, self.locals)
         except SystemExit:
             if not self.tkconsole.closing:
-                if tkMessageBox.askyesno(
+                if messagebox.askyesno(
                     "Exit?",
                     "Do you want to exit altogether?",
                     default="yes",
@@ -805,7 +824,7 @@
         return self.tkconsole.stderr.write(s)
 
     def display_port_binding_error(self):
-        tkMessageBox.showerror(
+        messagebox.showerror(
             "Port Binding Error",
             "IDLE can't bind to a TCP/IP port, which is necessary to "
             "communicate with its Python execution server.  This might be "
@@ -816,7 +835,7 @@
             parent=self.tkconsole.text)
 
     def display_no_subprocess_error(self):
-        tkMessageBox.showerror(
+        messagebox.showerror(
             "Subprocess Connection Error",
             "IDLE's subprocess didn't make connection.\n"
             "See the 'Startup failure' section of the IDLE doc, online at\n"
@@ -824,7 +843,7 @@
             parent=self.tkconsole.text)
 
     def display_executing_dialog(self):
-        tkMessageBox.showerror(
+        messagebox.showerror(
             "Already executing",
             "The Python Shell window is already executing a command; "
             "please wait until it is finished.",
@@ -832,6 +851,7 @@
 
 
 class PyShell(OutputWindow):
+    from idlelib.squeezer import Squeezer
 
     shell_title = "IDLE Shell " + python_version()
 
@@ -853,11 +873,20 @@
     rmenu_specs = OutputWindow.rmenu_specs + [
         ("Squeeze", "<<squeeze-current-text>>"),
     ]
+    _idx = 1 + len(list(itertools.takewhile(
+        lambda rmenu_item: rmenu_item[0] != "Copy", rmenu_specs)
+    ))
+    rmenu_specs.insert(_idx, ("Copy with prompts",
+                              "<<copy-with-prompts>>",
+                              "rmenu_check_copy"))
+    del _idx
 
     allow_line_numbers = False
+    user_input_insert_tags = "stdin"
 
     # New classes
     from idlelib.history import History
+    from idlelib.sidebar import ShellSidebar
 
     def __init__(self, flist=None):
         if use_subprocess:
@@ -871,13 +900,15 @@
             root.withdraw()
             flist = PyShellFileList(root)
 
+        self.shell_sidebar = None  # initialized below
+
         OutputWindow.__init__(self, flist, None, None)
 
-        self.usetabs = True
+        self.usetabs = False
         # indentwidth must be 8 when using tabs.  See note in EditorWindow:
-        self.indentwidth = 8
+        self.indentwidth = 4
 
-        self.sys_ps1 = sys.ps1 if hasattr(sys, 'ps1') else '>>> '
+        self.sys_ps1 = sys.ps1 if hasattr(sys, 'ps1') else '>>>\n'
         self.prompt_last_line = self.sys_ps1.split('\n')[-1]
         self.prompt = self.sys_ps1  # Changes when debug active
 
@@ -890,12 +921,13 @@
         text.bind("<<open-stack-viewer>>", self.open_stack_viewer)
         text.bind("<<toggle-debugger>>", self.toggle_debugger)
         text.bind("<<toggle-jit-stack-viewer>>", self.toggle_jit_stack_viewer)
+        text.bind("<<copy-with-prompts>>", self.copy_with_prompts_callback)
         if use_subprocess:
             text.bind("<<view-restart>>", self.view_restart_mark)
             text.bind("<<restart-shell>>", self.restart_shell)
-        squeezer = self.Squeezer(self)
+        self.squeezer = self.Squeezer(self)
         text.bind("<<squeeze-current-text>>",
-                  squeezer.squeeze_current_text_event)
+                  self.squeeze_current_text_event)
 
         self.save_stdout = sys.stdout
         self.save_stderr = sys.stderr
@@ -926,9 +958,79 @@
         #
         self.pollinterval = 50  # millisec
 
+        self.shell_sidebar = self.ShellSidebar(self)
+
+        # Insert UserInputTaggingDelegator at the top of the percolator,
+        # but make calls to text.insert() skip it.  This causes only insert
+        # events generated in Tcl/Tk to go through this delegator.
+        self.text.insert = self.per.top.insert
+        self.per.insertfilter(UserInputTaggingDelegator())
+
+    def ResetFont(self):
+        super().ResetFont()
+
+        if self.shell_sidebar is not None:
+            self.shell_sidebar.update_font()
+
+    def ResetColorizer(self):
+        super().ResetColorizer()
+
+        theme = idleConf.CurrentTheme()
+        tag_colors = {
+          "stdin": {'background': None, 'foreground': None},
+          "stdout": idleConf.GetHighlight(theme, "stdout"),
+          "stderr": idleConf.GetHighlight(theme, "stderr"),
+          "console": idleConf.GetHighlight(theme, "normal"),
+        }
+        for tag, tag_colors_config in tag_colors.items():
+            self.text.tag_configure(tag, **tag_colors_config)
+
+        if self.shell_sidebar is not None:
+            self.shell_sidebar.update_colors()
+
+    def replace_event(self, event):
+        replace.replace(self.text, insert_tags="stdin")
+        return "break"
+
     def get_standard_extension_names(self):
         return idleConf.GetExtensions(shell_only=True)
 
+    def copy_with_prompts_callback(self, event=None):
+        """Copy selected lines to the clipboard, with prompts.
+
+        This makes the copied text useful for doc-tests and interactive
+        shell code examples.
+
+        This always copies entire lines, even if only part of the first
+        and/or last lines is selected.
+        """
+        text = self.text
+
+        selection_indexes = (
+            self.text.index("sel.first linestart"),
+            self.text.index("sel.last +1line linestart"),
+        )
+        if selection_indexes[0] is None:
+            # There is no selection, so do nothing.
+            return
+
+        selected_text = self.text.get(*selection_indexes)
+        selection_lineno_range = range(
+            int(float(selection_indexes[0])),
+            int(float(selection_indexes[1]))
+        )
+        prompts = [
+            self.shell_sidebar.line_prompts.get(lineno)
+            for lineno in selection_lineno_range
+        ]
+        selected_text_with_prompts = "\n".join(
+            line if prompt is None else f"{prompt} {line}"
+            for prompt, line in zip(prompts, selected_text.splitlines())
+        ) + "\n"
+
+        text.clipboard_clear()
+        text.clipboard_append(selected_text_with_prompts)
+
     reading = False
     executing = False
     canceled = False
@@ -945,7 +1047,7 @@
 
     def toggle_debugger(self, event=None):
         if self.executing:
-            tkMessageBox.showerror("Don't debug now",
+            messagebox.showerror("Don't debug now",
                 "You can only toggle the debugger when idle",
                 parent=self.text)
             self.set_debugger_indicator()
@@ -989,6 +1091,10 @@
         self.showprompt()
         self.set_debugger_indicator()
 
+    def debug_menu_postcommand(self):
+        state = 'disabled' if self.executing else 'normal'
+        self.update_menu_state('debug', '*tack*iewer', state)
+
     def beginexecuting(self):
         "Helper for ModifiedInterpreter"
         self.resetoutput()
@@ -1003,7 +1109,7 @@
     def close(self):
         "Extend EditorWindow.close()"
         if self.executing:
-            response = tkMessageBox.askokcancel(
+            response = messagebox.askokcancel(
                 "Kill?",
                 "Your program is still running!\n Do you want to kill it?",
                 default="ok",
@@ -1061,8 +1167,10 @@
                    (sys.version, sys.platform, self.COPYRIGHT, nosub))
         self.text.focus_force()
         self.showprompt()
+        # User code should use separate default Tk root window
         import tkinter
-        tkinter._default_root = None # 03Jan04 KBK What's this?
+        tkinter._support_default_root = True
+        tkinter._default_root = None
         return True
 
     def stop_readline(self):
@@ -1160,13 +1268,30 @@
         # the current line, less a leading prompt, less leading or
         # trailing whitespace
         if self.text.compare("insert", "<", "iomark linestart"):
-            # Check if there's a relevant stdin range -- if so, use it
+            # Check if there's a relevant stdin range -- if so, use it.
+            # Note: "stdin" blocks may include several successive statements,
+            # so look for "console" tags on the newline before each statement
+            # (and possibly on prompts).
             prev = self.text.tag_prevrange("stdin", "insert")
-            if prev and self.text.compare("insert", "<", prev[1]):
+            if (
+                    prev and
+                    self.text.compare("insert", "<", prev[1]) and
+                    # The following is needed to handle empty statements.
+                    "console" not in self.text.tag_names("insert")
+            ):
+                prev_cons = self.text.tag_prevrange("console", "insert")
+                if prev_cons and self.text.compare(prev_cons[1], ">=", prev[0]):
+                    prev = (prev_cons[1], prev[1])
+                next_cons = self.text.tag_nextrange("console", "insert")
+                if next_cons and self.text.compare(next_cons[0], "<", prev[1]):
+                    prev = (prev[0], self.text.index(next_cons[0] + "+1c"))
                 self.recall(self.text.get(prev[0], prev[1]), event)
                 return "break"
             next = self.text.tag_nextrange("stdin", "insert")
             if next and self.text.compare("insert lineend", ">=", next[0]):
+                next_cons = self.text.tag_nextrange("console", "insert lineend")
+                if next_cons and self.text.compare(next_cons[0], "<", next[1]):
+                    next = (next[0], self.text.index(next_cons[0] + "+1c"))
                 self.recall(self.text.get(next[0], next[1]), event)
                 return "break"
             # No stdin mark -- just get the current line, less any prompt
@@ -1198,7 +1323,6 @@
             self.text.see("insert")
         else:
             self.newline_and_indent_event(event)
-        self.text.tag_add("stdin", "iomark", "end-1c")
         self.text.update_idletasks()
         if self.reading:
             self.top.quit() # Break out of recursive mainloop()
@@ -1208,7 +1332,7 @@
 
     def recall(self, s, event):
         # remove leading and trailing empty or whitespace lines
-        s = re.sub(r'^\s*\n', '' , s)
+        s = re.sub(r'^\s*\n', '', s)
         s = re.sub(r'\n\s*$', '', s)
         lines = s.split('\n')
         self.text.undo_block_start()
@@ -1219,7 +1343,8 @@
             if prefix.rstrip().endswith(':'):
                 self.newline_and_indent_event(event)
                 prefix = self.text.get("insert linestart", "insert")
-            self.text.insert("insert", lines[0].strip())
+            self.text.insert("insert", lines[0].strip(),
+                             self.user_input_insert_tags)
             if len(lines) > 1:
                 orig_base_indent = re.search(r'^([ \t]*)', lines[0]).group(0)
                 new_base_indent  = re.search(r'^([ \t]*)', prefix).group(0)
@@ -1227,24 +1352,24 @@
                     if line.startswith(orig_base_indent):
                         # replace orig base indentation with new indentation
                         line = new_base_indent + line[len(orig_base_indent):]
-                    self.text.insert('insert', '\n'+line.rstrip())
+                    self.text.insert('insert', '\n' + line.rstrip(),
+                                     self.user_input_insert_tags)
         finally:
             self.text.see("insert")
             self.text.undo_block_stop()
 
+    _last_newline_re = re.compile(r"[ \t]*(\n[ \t]*)?\Z")
     def runit(self):
+        index_before = self.text.index("end-2c")
         line = self.text.get("iomark", "end-1c")
         # Strip off last newline and surrounding whitespace.
         # (To allow you to hit return twice to end a statement.)
-        i = len(line)
-        while i > 0 and line[i-1] in " \t":
-            i = i-1
-        if i > 0 and line[i-1] == "\n":
-            i = i-1
-        while i > 0 and line[i-1] in " \t":
-            i = i-1
-        line = line[:i]
-        self.interp.runsource(line)
+        line = self._last_newline_re.sub("", line)
+        input_is_complete = self.interp.runsource(line)
+        if not input_is_complete:
+            if self.text.get(index_before) == '\n':
+                self.text.tag_remove(self.user_input_insert_tags, index_before)
+            self.shell_sidebar.update_sidebar()
 
     def open_stack_viewer(self, event=None):
         if self.interp.rpcclt:
@@ -1252,7 +1377,7 @@
         try:
             sys.last_traceback
         except:
-            tkMessageBox.showerror("No stack trace",
+            messagebox.showerror("No stack trace",
                 "There is no stack trace yet.\n"
                 "(sys.last_traceback is not defined)",
                 parent=self.text)
@@ -1270,7 +1395,14 @@
 
     def showprompt(self):
         self.resetoutput()
-        self.console.write(self.prompt)
+
+        prompt = self.prompt
+        if self.sys_ps1 and prompt.endswith(self.sys_ps1):
+            prompt = prompt[:-len(self.sys_ps1)]
+        self.text.tag_add("console", "iomark-1c")
+        self.console.write(prompt)
+
+        self.shell_sidebar.update_sidebar()
         self.text.mark_set("insert", "end-1c")
         self.set_line_and_column()
         self.io.reset_undo()
@@ -1320,6 +1452,13 @@
             return 'disabled'
         return super().rmenu_check_paste()
 
+    def squeeze_current_text_event(self, event=None):
+        self.squeezer.squeeze_current_text()
+        self.shell_sidebar.update_sidebar()
+
+    def on_squeezed_expand(self, index, text, tags):
+        self.shell_sidebar.update_sidebar()
+
 
 def fix_x11_paste(root):
     "Make paste replace selection on x11.  See issue #5124."
diff --git a/Lib/idlelib/query.py b/Lib/idlelib/query.py
index 015fc7a..df02f21 100644
--- a/Lib/idlelib/query.py
+++ b/Lib/idlelib/query.py
@@ -28,6 +28,7 @@
 from tkinter.ttk import Frame, Button, Entry, Label, Checkbutton
 from tkinter import filedialog
 from tkinter.font import Font
+from tkinter.simpledialog import _setup_dialog
 
 class Query(Toplevel):
     """Base class for getting verified answer from a user.
@@ -60,13 +61,8 @@
         if not _utest:  # Otherwise fail when directly run unittest.
             self.grab_set()
 
-        windowingsystem = self.tk.call('tk', 'windowingsystem')
-        if windowingsystem == 'aqua':
-            try:
-                self.tk.call('::tk::unsupported::MacWindowStyle', 'style',
-                             self._w, 'moveableModal', '')
-            except:
-                pass
+        _setup_dialog(self)
+        if self._windowingsystem == 'aqua':
             self.bind("<Command-.>", self.cancel)
         self.bind('<Key-Escape>', self.cancel)
         self.protocol("WM_DELETE_WINDOW", self.cancel)
@@ -87,6 +83,7 @@
 
         if not _utest:
             self.deiconify()  # Unhide now that geometry set.
+            self.entry.focus_set()
             self.wait_window()
 
     def create_widgets(self, ok_text='OK'):  # Do not replace.
@@ -104,7 +101,6 @@
                            text=self.message)
         self.entryvar = StringVar(self, self.text0)
         self.entry = Entry(frame, width=30, textvariable=self.entryvar)
-        self.entry.focus_set()
         self.error_font = Font(name='TkCaptionFont',
                                exists=True, root=self.parent)
         self.entry_error = Label(frame, text=' ', foreground='red',
diff --git a/Lib/idlelib/replace.py b/Lib/idlelib/replace.py
index 6be034a..ca83173 100644
--- a/Lib/idlelib/replace.py
+++ b/Lib/idlelib/replace.py
@@ -11,7 +11,7 @@
 from idlelib import searchengine
 
 
-def replace(text):
+def replace(text, insert_tags=None):
     """Create or reuse a singleton ReplaceDialog instance.
 
     The singleton dialog saves user entries and preferences
@@ -25,7 +25,7 @@
     if not hasattr(engine, "_replacedialog"):
         engine._replacedialog = ReplaceDialog(root, engine)
     dialog = engine._replacedialog
-    dialog.open(text)
+    dialog.open(text, insert_tags=insert_tags)
 
 
 class ReplaceDialog(SearchDialogBase):
@@ -49,8 +49,9 @@
         """
         super().__init__(root, engine)
         self.replvar = StringVar(root)
+        self.insert_tags = None
 
-    def open(self, text):
+    def open(self, text, insert_tags=None):
         """Make dialog visible on top of others and ready to use.
 
         Also, highlight the currently selected text and set the
@@ -72,6 +73,7 @@
         last = last or first
         self.show_hit(first, last)
         self.ok = True
+        self.insert_tags = insert_tags
 
     def create_entries(self):
         "Create base and additional label and text entry widgets."
@@ -156,11 +158,8 @@
         first = last = None
         # XXX ought to replace circular instead of top-to-bottom when wrapping
         text.undo_block_start()
-        while True:
-            res = self.engine.search_forward(text, prog, line, col,
-                                             wrap=False, ok=ok)
-            if not res:
-                break
+        while res := self.engine.search_forward(
+                text, prog, line, col, wrap=False, ok=ok):
             line, m = res
             chars = text.get("%d.0" % line, "%d.0" % (line+1))
             orig = m.group()
@@ -177,7 +176,7 @@
                 if first != last:
                     text.delete(first, last)
                 if new:
-                    text.insert(first, new)
+                    text.insert(first, new, self.insert_tags)
             col = i + len(new)
             ok = False
         text.undo_block_stop()
@@ -231,7 +230,7 @@
         if m.group():
             text.delete(first, last)
         if new:
-            text.insert(first, new)
+            text.insert(first, new, self.insert_tags)
         text.undo_block_stop()
         self.show_hit(first, text.index("insert"))
         self.ok = False
@@ -264,6 +263,7 @@
         "Close the dialog and remove hit tags."
         SearchDialogBase.close(self, event)
         self.text.tag_remove("hit", "1.0", "end")
+        self.insert_tags = None
 
 
 def _replace_dialog(parent):  # htest #
diff --git a/Lib/idlelib/rpc.py b/Lib/idlelib/rpc.py
index aa8cbd3..8efcf04 100644
--- a/Lib/idlelib/rpc.py
+++ b/Lib/idlelib/rpc.py
@@ -125,7 +125,7 @@
 response_queue = queue.Queue(0)
 
 
-class SocketIO(object):
+class SocketIO:
 
     nextseq = 0
 
@@ -486,7 +486,7 @@
 
 #----------------- end class SocketIO --------------------
 
-class RemoteObject(object):
+class RemoteObject:
     # Token mix-in class
     pass
 
@@ -497,7 +497,7 @@
     return RemoteProxy(oid)
 
 
-class RemoteProxy(object):
+class RemoteProxy:
 
     def __init__(self, oid):
         self.oid = oid
@@ -547,7 +547,7 @@
         return RPCProxy(self, oid)
 
 
-class RPCProxy(object):
+class RPCProxy:
 
     __methods = None
     __attributes = None
@@ -596,7 +596,7 @@
             attributes[name] = 1
 
 
-class MethodProxy(object):
+class MethodProxy:
 
     def __init__(self, sockio, oid, name):
         self.sockio = sockio
diff --git a/Lib/idlelib/run.py b/Lib/idlelib/run.py
index 1e84ecc..aaa9b5c 100644
--- a/Lib/idlelib/run.py
+++ b/Lib/idlelib/run.py
@@ -4,6 +4,7 @@
 f'''{sys.executable} -c "__import__('idlelib.run').run.main()"'''
 '.run' is needed because __import__ returns idlelib, not idlelib.run.
 """
+import contextlib
 import functools
 import io
 import linecache
@@ -16,6 +17,7 @@
 import threading
 import warnings
 
+import idlelib  # testing
 from idlelib import autocomplete  # AutoComplete, fetch_encodings
 from idlelib import calltip  # Calltip
 from idlelib import debugger_r  # start_debugger
@@ -38,6 +40,13 @@
 
 LOCALHOST = '127.0.0.1'
 
+try:
+    eof = 'Ctrl-D (end-of-file)'
+    exit.eof = eof
+    quit.eof = eof
+except NameError: # In case subprocess started with -S (maybe in future).
+    pass
+
 
 def idle_formatwarning(message, category, filename, lineno, line=None):
     """Format warnings the IDLE way."""
@@ -210,6 +219,19 @@
             parent=root)
     root.destroy()
 
+
+def get_message_lines(typ, exc, tb):
+    "Return line composing the exception message."
+    if typ in (AttributeError, NameError):
+        # 3.10+ hints are not directly accessible from python (#44026).
+        err = io.StringIO()
+        with contextlib.redirect_stderr(err):
+            sys.__excepthook__(typ, exc, tb)
+        return [err.getvalue().split("\n")[-2] + "\n"]
+    else:
+        return traceback.format_exception_only(typ, exc)
+
+
 def print_exception():
     import linecache
     linecache.checkcache()
@@ -240,7 +262,7 @@
                        "debugger_r.py", "bdb.py")
             cleanup_traceback(tbe, exclude)
             traceback.print_list(tbe, file=efile)
-        lines = traceback.format_exception_only(typ, exc)
+        lines = get_message_lines(typ, exc, tb)
         for line in lines:
             print(line, end='', file=efile)
 
@@ -460,9 +482,7 @@
         result = self._line_buffer
         self._line_buffer = ''
         if size < 0:
-            while True:
-                line = self.shell.readline()
-                if not line: break
+            while line := self.shell.readline():
                 result += line
         else:
             while len(result) < size:
@@ -538,18 +558,21 @@
         thread.interrupt_main()
 
 
-class Executive(object):
+class Executive:
 
     def __init__(self, rpchandler):
         self.rpchandler = rpchandler
-        self.locals = __main__.__dict__
-        self.calltip = calltip.Calltip()
-        self.autocomplete = autocomplete.AutoComplete()
+        if idlelib.testing is False:
+            self.locals = __main__.__dict__
+            self.calltip = calltip.Calltip()
+            self.autocomplete = autocomplete.AutoComplete()
+        else:
+            self.locals = {}
 
     def runcode(self, code):
         global interruptable
         try:
-            self.usr_exc_info = None
+            self.user_exc_info = None
             interruptable = True
             try:
                 exec(code, self.locals)
@@ -562,10 +585,17 @@
                     print('SystemExit: ' + str(ob), file=sys.stderr)
             # Return to the interactive prompt.
         except:
-            self.usr_exc_info = sys.exc_info()
+            self.user_exc_info = sys.exc_info()  # For testing, hook, viewer.
             if quitting:
                 exit()
-            print_exception()
+            if sys.excepthook is sys.__excepthook__:
+                print_exception()
+            else:
+                try:
+                    sys.excepthook(*self.user_exc_info)
+                except:
+                    self.user_exc_info = sys.exc_info()  # For testing.
+                    print_exception()
             jit = self.rpchandler.console.getvar("<<toggle-jit-stack-viewer>>")
             if jit:
                 self.rpchandler.interp.open_remote_stack_viewer()
@@ -590,8 +620,8 @@
         return self.autocomplete.fetch_completions(what, mode)
 
     def stackviewer(self, flist_oid=None):
-        if self.usr_exc_info:
-            typ, val, tb = self.usr_exc_info
+        if self.user_exc_info:
+            typ, val, tb = self.user_exc_info
         else:
             return None
         flist = None
diff --git a/Lib/idlelib/runscript.py b/Lib/idlelib/runscript.py
index 028b0db..55712e9 100644
--- a/Lib/idlelib/runscript.py
+++ b/Lib/idlelib/runscript.py
@@ -14,7 +14,7 @@
 import time
 import tokenize
 
-import tkinter.messagebox as tkMessageBox
+from tkinter import messagebox
 
 from idlelib.config import idleConf
 from idlelib import macosx
@@ -195,15 +195,15 @@
 
     def ask_save_dialog(self):
         msg = "Source Must Be Saved\n" + 5*' ' + "OK to Save?"
-        confirm = tkMessageBox.askokcancel(title="Save Before Run or Check",
+        confirm = messagebox.askokcancel(title="Save Before Run or Check",
                                            message=msg,
-                                           default=tkMessageBox.OK,
+                                           default=messagebox.OK,
                                            parent=self.editwin.text)
         return confirm
 
     def errorbox(self, title, message):
         # XXX This should really be a function of EditorWindow...
-        tkMessageBox.showerror(title, message, parent=self.editwin.text)
+        messagebox.showerror(title, message, parent=self.editwin.text)
         self.editwin.text.focus_set()
         self.perf = time.perf_counter()
 
diff --git a/Lib/idlelib/searchbase.py b/Lib/idlelib/searchbase.py
index fbef87a..64ed50c 100644
--- a/Lib/idlelib/searchbase.py
+++ b/Lib/idlelib/searchbase.py
@@ -2,6 +2,7 @@
 
 from tkinter import Toplevel
 from tkinter.ttk import Frame, Entry, Label, Button, Checkbutton, Radiobutton
+from tkinter.simpledialog import _setup_dialog
 
 
 class SearchDialogBase:
@@ -83,6 +84,7 @@
         top.protocol("WM_DELETE_WINDOW", self.close)
         top.wm_title(self.title)
         top.wm_iconname(self.icon)
+        _setup_dialog(top)
         self.top = top
         self.frame = Frame(top, padding="5px")
         self.frame.grid(sticky="nwes")
diff --git a/Lib/idlelib/searchengine.py b/Lib/idlelib/searchengine.py
index a50038e..eddef58 100644
--- a/Lib/idlelib/searchengine.py
+++ b/Lib/idlelib/searchengine.py
@@ -2,7 +2,7 @@
 import re
 
 from tkinter import StringVar, BooleanVar, TclError
-import tkinter.messagebox as tkMessageBox
+from tkinter import messagebox
 
 def get(root):
     '''Return the singleton SearchEngine instance for the process.
@@ -96,7 +96,7 @@
             msg = msg + "\nPattern: " + str(pat)
         if col is not None:
             msg = msg + "\nOffset: " + str(col)
-        tkMessageBox.showerror("Regular expression error",
+        messagebox.showerror("Regular expression error",
                                msg, master=self.root)
 
     def search_text(self, text, prog=None, ok=0):
diff --git a/Lib/idlelib/sidebar.py b/Lib/idlelib/sidebar.py
index 41c0968..fb1084d 100644
--- a/Lib/idlelib/sidebar.py
+++ b/Lib/idlelib/sidebar.py
@@ -1,19 +1,35 @@
 """Line numbering implementation for IDLE as an extension.
 Includes BaseSideBar which can be extended for other sidebar based extensions
 """
+import contextlib
 import functools
 import itertools
 
 import tkinter as tk
+from tkinter.font import Font
 from idlelib.config import idleConf
 from idlelib.delegator import Delegator
+from idlelib import macosx
+
+
+def get_lineno(text, index):
+    """Return the line number of an index in a Tk text widget."""
+    text_index = text.index(index)
+    return int(float(text_index)) if text_index else None
 
 
 def get_end_linenumber(text):
-    """Utility to get the last line's number in a Tk text widget."""
-    return int(float(text.index('end-1c')))
+    """Return the number of the last line in a Tk text widget."""
+    return get_lineno(text, 'end-1c')
 
 
+def get_displaylines(text, index):
+    """Display height, in lines, of a logical line in a Tk text widget."""
+    res = text.count(f"{index} linestart",
+                     f"{index} lineend",
+                     "displaylines")
+    return res[0] if res else 0
+
 def get_widget_padding(widget):
     """Get the total padding of a Tk widget, including its border."""
     # TODO: use also in codecontext.py
@@ -40,65 +56,68 @@
     return padx, pady
 
 
+@contextlib.contextmanager
+def temp_enable_text_widget(text):
+    text.configure(state=tk.NORMAL)
+    try:
+        yield
+    finally:
+        text.configure(state=tk.DISABLED)
+
+
 class BaseSideBar:
-    """
-    The base class for extensions which require a sidebar.
-    """
+    """A base class for sidebars using Text."""
     def __init__(self, editwin):
         self.editwin = editwin
         self.parent = editwin.text_frame
         self.text = editwin.text
 
-        _padx, pady = get_widget_padding(self.text)
-        self.sidebar_text = tk.Text(self.parent, width=1, wrap=tk.NONE,
-                                    padx=2, pady=pady,
-                                    borderwidth=0, highlightthickness=0)
-        self.sidebar_text.config(state=tk.DISABLED)
-        self.text['yscrollcommand'] = self.redirect_yscroll_event
+        self.is_shown = False
+
+        self.main_widget = self.init_widgets()
+
+        self.bind_events()
+
         self.update_font()
         self.update_colors()
 
-        self.is_shown = False
+    def init_widgets(self):
+        """Initialize the sidebar's widgets, returning the main widget."""
+        raise NotImplementedError
 
     def update_font(self):
         """Update the sidebar text font, usually after config changes."""
-        font = idleConf.GetFont(self.text, 'main', 'EditorWindow')
-        self._update_font(font)
-
-    def _update_font(self, font):
-        self.sidebar_text['font'] = font
+        raise NotImplementedError
 
     def update_colors(self):
         """Update the sidebar text colors, usually after config changes."""
-        colors = idleConf.GetHighlight(idleConf.CurrentTheme(), 'normal')
-        self._update_colors(foreground=colors['foreground'],
-                            background=colors['background'])
+        raise NotImplementedError
 
-    def _update_colors(self, foreground, background):
-        self.sidebar_text.config(
-            fg=foreground, bg=background,
-            selectforeground=foreground, selectbackground=background,
-            inactiveselectbackground=background,
-        )
+    def grid(self):
+        """Layout the widget, always using grid layout."""
+        raise NotImplementedError
 
     def show_sidebar(self):
         if not self.is_shown:
-            self.sidebar_text.grid(row=1, column=0, sticky=tk.NSEW)
+            self.grid()
             self.is_shown = True
 
     def hide_sidebar(self):
         if self.is_shown:
-            self.sidebar_text.grid_forget()
+            self.main_widget.grid_forget()
             self.is_shown = False
 
+    def yscroll_event(self, *args, **kwargs):
+        """Hook for vertical scrolling for sub-classes to override."""
+        raise NotImplementedError
+
     def redirect_yscroll_event(self, *args, **kwargs):
         """Redirect vertical scrolling to the main editor text widget.
 
         The scroll bar is also updated.
         """
         self.editwin.vbar.set(*args)
-        self.sidebar_text.yview_moveto(args[0])
-        return 'break'
+        return self.yscroll_event(*args, **kwargs)
 
     def redirect_focusin_event(self, event):
         """Redirect focus-in events to the main editor text widget."""
@@ -117,68 +136,17 @@
                                  x=0, y=event.y, delta=event.delta)
         return 'break'
 
-
-class EndLineDelegator(Delegator):
-    """Generate callbacks with the current end line number after
-       insert or delete operations"""
-    def __init__(self, changed_callback):
-        """
-        changed_callback - Callable, will be called after insert
-                           or delete operations with the current
-                           end line number.
-        """
-        Delegator.__init__(self)
-        self.changed_callback = changed_callback
-
-    def insert(self, index, chars, tags=None):
-        self.delegate.insert(index, chars, tags)
-        self.changed_callback(get_end_linenumber(self.delegate))
-
-    def delete(self, index1, index2=None):
-        self.delegate.delete(index1, index2)
-        self.changed_callback(get_end_linenumber(self.delegate))
-
-
-class LineNumbers(BaseSideBar):
-    """Line numbers support for editor windows."""
-    def __init__(self, editwin):
-        BaseSideBar.__init__(self, editwin)
-        self.prev_end = 1
-        self._sidebar_width_type = type(self.sidebar_text['width'])
-        self.sidebar_text.config(state=tk.NORMAL)
-        self.sidebar_text.insert('insert', '1', 'linenumber')
-        self.sidebar_text.config(state=tk.DISABLED)
-        self.sidebar_text.config(takefocus=False, exportselection=False)
-        self.sidebar_text.tag_config('linenumber', justify=tk.RIGHT)
-
-        self.bind_events()
-
-        end = get_end_linenumber(self.text)
-        self.update_sidebar_text(end)
-
-        end_line_delegator = EndLineDelegator(self.update_sidebar_text)
-        # Insert the delegator after the undo delegator, so that line numbers
-        # are properly updated after undo and redo actions.
-        end_line_delegator.setdelegate(self.editwin.undo.delegate)
-        self.editwin.undo.setdelegate(end_line_delegator)
-        # Reset the delegator caches of the delegators "above" the
-        # end line delegator we just inserted.
-        delegator = self.editwin.per.top
-        while delegator is not end_line_delegator:
-            delegator.resetcache()
-            delegator = delegator.delegate
-
-        self.is_shown = False
-
     def bind_events(self):
+        self.text['yscrollcommand'] = self.redirect_yscroll_event
+
         # Ensure focus is always redirected to the main editor text widget.
-        self.sidebar_text.bind('<FocusIn>', self.redirect_focusin_event)
+        self.main_widget.bind('<FocusIn>', self.redirect_focusin_event)
 
         # Redirect mouse scrolling to the main editor text widget.
         #
         # Note that without this, scrolling with the mouse only scrolls
         # the line numbers.
-        self.sidebar_text.bind('<MouseWheel>', self.redirect_mousewheel_event)
+        self.main_widget.bind('<MouseWheel>', self.redirect_mousewheel_event)
 
         # Redirect mouse button events to the main editor text widget,
         # except for the left mouse button (1).
@@ -187,7 +155,7 @@
         def bind_mouse_event(event_name, target_event_name):
             handler = functools.partial(self.redirect_mousebutton_event,
                                         event_name=target_event_name)
-            self.sidebar_text.bind(event_name, handler)
+            self.main_widget.bind(event_name, handler)
 
         for button in [2, 3, 4, 5]:
             for event_name in (f'<Button-{button}>',
@@ -204,83 +172,162 @@
                 bind_mouse_event(event_name,
                                  target_event_name=f'<Button-{button}>')
 
-        # This is set by b1_mousedown_handler() and read by
-        # drag_update_selection_and_insert_mark(), to know where dragging
-        # began.
+        # start_line is set upon <Button-1> to allow selecting a range of rows
+        # by dragging.  It is cleared upon <ButtonRelease-1>.
         start_line = None
-        # These are set by b1_motion_handler() and read by selection_handler().
-        # last_y is passed this way since the mouse Y-coordinate is not
-        # available on selection event objects.  last_yview is passed this way
-        # to recognize scrolling while the mouse isn't moving.
-        last_y = last_yview = None
 
-        def b1_mousedown_handler(event):
-            # select the entire line
-            lineno = int(float(self.sidebar_text.index(f"@0,{event.y}")))
-            self.text.tag_remove("sel", "1.0", "end")
-            self.text.tag_add("sel", f"{lineno}.0", f"{lineno+1}.0")
-            self.text.mark_set("insert", f"{lineno+1}.0")
+        # last_y is initially set upon <B1-Leave> and is continuously updated
+        # upon <B1-Motion>, until <B1-Enter> or the mouse button is released.
+        # It is used in text_auto_scroll(), which is called repeatedly and
+        # does have a mouse event available.
+        last_y = None
 
-            # remember this line in case this is the beginning of dragging
-            nonlocal start_line
-            start_line = lineno
-        self.sidebar_text.bind('<Button-1>', b1_mousedown_handler)
-
-        def b1_mouseup_handler(event):
-            # On mouse up, we're no longer dragging.  Set the shared persistent
-            # variables to None to represent this.
-            nonlocal start_line
-            nonlocal last_y
-            nonlocal last_yview
-            start_line = None
-            last_y = None
-            last_yview = None
-        self.sidebar_text.bind('<ButtonRelease-1>', b1_mouseup_handler)
+        # auto_scrolling_after_id is set whenever text_auto_scroll is
+        # scheduled via .after().  It is used to stop the auto-scrolling
+        # upon <B1-Enter>, as well as to avoid scheduling the function several
+        # times in parallel.
+        auto_scrolling_after_id = None
 
         def drag_update_selection_and_insert_mark(y_coord):
             """Helper function for drag and selection event handlers."""
-            lineno = int(float(self.sidebar_text.index(f"@0,{y_coord}")))
+            lineno = get_lineno(self.text, f"@0,{y_coord}")
             a, b = sorted([start_line, lineno])
             self.text.tag_remove("sel", "1.0", "end")
             self.text.tag_add("sel", f"{a}.0", f"{b+1}.0")
             self.text.mark_set("insert",
                                f"{lineno if lineno == a else lineno + 1}.0")
 
-        # Special handling of dragging with mouse button 1.  In "normal" text
-        # widgets this selects text, but the line numbers text widget has
-        # selection disabled.  Still, dragging triggers some selection-related
-        # functionality under the hood.  Specifically, dragging to above or
-        # below the text widget triggers scrolling, in a way that bypasses the
-        # other scrolling synchronization mechanisms.i
-        def b1_drag_handler(event, *args):
+        def b1_mousedown_handler(event):
+            nonlocal start_line
             nonlocal last_y
-            nonlocal last_yview
+            start_line = int(float(self.text.index(f"@0,{event.y}")))
             last_y = event.y
-            last_yview = self.sidebar_text.yview()
-            if not 0 <= last_y <= self.sidebar_text.winfo_height():
-                self.text.yview_moveto(last_yview[0])
-            drag_update_selection_and_insert_mark(event.y)
-        self.sidebar_text.bind('<B1-Motion>', b1_drag_handler)
 
-        # With mouse-drag scrolling fixed by the above, there is still an edge-
-        # case we need to handle: When drag-scrolling, scrolling can continue
-        # while the mouse isn't moving, leading to the above fix not scrolling
-        # properly.
-        def selection_handler(event):
-            if last_yview is None:
-                # This logic is only needed while dragging.
+            drag_update_selection_and_insert_mark(event.y)
+        self.main_widget.bind('<Button-1>', b1_mousedown_handler)
+
+        def b1_mouseup_handler(event):
+            # On mouse up, we're no longer dragging.  Set the shared persistent
+            # variables to None to represent this.
+            nonlocal start_line
+            nonlocal last_y
+            start_line = None
+            last_y = None
+            self.text.event_generate('<ButtonRelease-1>', x=0, y=event.y)
+        self.main_widget.bind('<ButtonRelease-1>', b1_mouseup_handler)
+
+        def b1_drag_handler(event):
+            nonlocal last_y
+            if last_y is None:  # i.e. if not currently dragging
                 return
-            yview = self.sidebar_text.yview()
-            if yview != last_yview:
-                self.text.yview_moveto(yview[0])
-                drag_update_selection_and_insert_mark(last_y)
-        self.sidebar_text.bind('<<Selection>>', selection_handler)
+            last_y = event.y
+            drag_update_selection_and_insert_mark(event.y)
+        self.main_widget.bind('<B1-Motion>', b1_drag_handler)
+
+        def text_auto_scroll():
+            """Mimic Text auto-scrolling when dragging outside of it."""
+            # See: https://github.com/tcltk/tk/blob/064ff9941b4b80b85916a8afe86a6c21fd388b54/library/text.tcl#L670
+            nonlocal auto_scrolling_after_id
+            y = last_y
+            if y is None:
+                self.main_widget.after_cancel(auto_scrolling_after_id)
+                auto_scrolling_after_id = None
+                return
+            elif y < 0:
+                self.text.yview_scroll(-1 + y, 'pixels')
+                drag_update_selection_and_insert_mark(y)
+            elif y > self.main_widget.winfo_height():
+                self.text.yview_scroll(1 + y - self.main_widget.winfo_height(),
+                                       'pixels')
+                drag_update_selection_and_insert_mark(y)
+            auto_scrolling_after_id = \
+                self.main_widget.after(50, text_auto_scroll)
+
+        def b1_leave_handler(event):
+            # Schedule the initial call to text_auto_scroll(), if not already
+            # scheduled.
+            nonlocal auto_scrolling_after_id
+            if auto_scrolling_after_id is None:
+                nonlocal last_y
+                last_y = event.y
+                auto_scrolling_after_id = \
+                    self.main_widget.after(0, text_auto_scroll)
+        self.main_widget.bind('<B1-Leave>', b1_leave_handler)
+
+        def b1_enter_handler(event):
+            # Cancel the scheduling of text_auto_scroll(), if it exists.
+            nonlocal auto_scrolling_after_id
+            if auto_scrolling_after_id is not None:
+                self.main_widget.after_cancel(auto_scrolling_after_id)
+                auto_scrolling_after_id = None
+        self.main_widget.bind('<B1-Enter>', b1_enter_handler)
+
+
+class EndLineDelegator(Delegator):
+    """Generate callbacks with the current end line number.
+
+    The provided callback is called after every insert and delete.
+    """
+    def __init__(self, changed_callback):
+        Delegator.__init__(self)
+        self.changed_callback = changed_callback
+
+    def insert(self, index, chars, tags=None):
+        self.delegate.insert(index, chars, tags)
+        self.changed_callback(get_end_linenumber(self.delegate))
+
+    def delete(self, index1, index2=None):
+        self.delegate.delete(index1, index2)
+        self.changed_callback(get_end_linenumber(self.delegate))
+
+
+class LineNumbers(BaseSideBar):
+    """Line numbers support for editor windows."""
+    def __init__(self, editwin):
+        super().__init__(editwin)
+
+        end_line_delegator = EndLineDelegator(self.update_sidebar_text)
+        # Insert the delegator after the undo delegator, so that line numbers
+        # are properly updated after undo and redo actions.
+        self.editwin.per.insertfilterafter(end_line_delegator,
+                                           after=self.editwin.undo)
+
+    def init_widgets(self):
+        _padx, pady = get_widget_padding(self.text)
+        self.sidebar_text = tk.Text(self.parent, width=1, wrap=tk.NONE,
+                                    padx=2, pady=pady,
+                                    borderwidth=0, highlightthickness=0)
+        self.sidebar_text.config(state=tk.DISABLED)
+
+        self.prev_end = 1
+        self._sidebar_width_type = type(self.sidebar_text['width'])
+        with temp_enable_text_widget(self.sidebar_text):
+            self.sidebar_text.insert('insert', '1', 'linenumber')
+        self.sidebar_text.config(takefocus=False, exportselection=False)
+        self.sidebar_text.tag_config('linenumber', justify=tk.RIGHT)
+
+        end = get_end_linenumber(self.text)
+        self.update_sidebar_text(end)
+
+        return self.sidebar_text
+
+    def grid(self):
+        self.sidebar_text.grid(row=1, column=0, sticky=tk.NSEW)
+
+    def update_font(self):
+        font = idleConf.GetFont(self.text, 'main', 'EditorWindow')
+        self.sidebar_text['font'] = font
 
     def update_colors(self):
         """Update the sidebar text colors, usually after config changes."""
         colors = idleConf.GetHighlight(idleConf.CurrentTheme(), 'linenumber')
-        self._update_colors(foreground=colors['foreground'],
-                            background=colors['background'])
+        foreground = colors['foreground']
+        background = colors['background']
+        self.sidebar_text.config(
+            fg=foreground, bg=background,
+            selectforeground=foreground, selectbackground=background,
+            inactiveselectbackground=background,
+        )
 
     def update_sidebar_text(self, end):
         """
@@ -297,19 +344,175 @@
             new_width = cur_width + width_difference
             self.sidebar_text['width'] = self._sidebar_width_type(new_width)
 
-        self.sidebar_text.config(state=tk.NORMAL)
-        if end > self.prev_end:
-            new_text = '\n'.join(itertools.chain(
-                [''],
-                map(str, range(self.prev_end + 1, end + 1)),
-            ))
-            self.sidebar_text.insert(f'end -1c', new_text, 'linenumber')
-        else:
-            self.sidebar_text.delete(f'{end+1}.0 -1c', 'end -1c')
-        self.sidebar_text.config(state=tk.DISABLED)
+        with temp_enable_text_widget(self.sidebar_text):
+            if end > self.prev_end:
+                new_text = '\n'.join(itertools.chain(
+                    [''],
+                    map(str, range(self.prev_end + 1, end + 1)),
+                ))
+                self.sidebar_text.insert(f'end -1c', new_text, 'linenumber')
+            else:
+                self.sidebar_text.delete(f'{end+1}.0 -1c', 'end -1c')
 
         self.prev_end = end
 
+    def yscroll_event(self, *args, **kwargs):
+        self.sidebar_text.yview_moveto(args[0])
+        return 'break'
+
+
+class WrappedLineHeightChangeDelegator(Delegator):
+    def __init__(self, callback):
+        """
+        callback - Callable, will be called when an insert, delete or replace
+                   action on the text widget may require updating the shell
+                   sidebar.
+        """
+        Delegator.__init__(self)
+        self.callback = callback
+
+    def insert(self, index, chars, tags=None):
+        is_single_line = '\n' not in chars
+        if is_single_line:
+            before_displaylines = get_displaylines(self, index)
+
+        self.delegate.insert(index, chars, tags)
+
+        if is_single_line:
+            after_displaylines = get_displaylines(self, index)
+            if after_displaylines == before_displaylines:
+                return  # no need to update the sidebar
+
+        self.callback()
+
+    def delete(self, index1, index2=None):
+        if index2 is None:
+            index2 = index1 + "+1c"
+        is_single_line = get_lineno(self, index1) == get_lineno(self, index2)
+        if is_single_line:
+            before_displaylines = get_displaylines(self, index1)
+
+        self.delegate.delete(index1, index2)
+
+        if is_single_line:
+            after_displaylines = get_displaylines(self, index1)
+            if after_displaylines == before_displaylines:
+                return  # no need to update the sidebar
+
+        self.callback()
+
+
+class ShellSidebar(BaseSideBar):
+    """Sidebar for the PyShell window, for prompts etc."""
+    def __init__(self, editwin):
+        self.canvas = None
+        self.line_prompts = {}
+
+        super().__init__(editwin)
+
+        change_delegator = \
+            WrappedLineHeightChangeDelegator(self.change_callback)
+        # Insert the TextChangeDelegator after the last delegator, so that
+        # the sidebar reflects final changes to the text widget contents.
+        d = self.editwin.per.top
+        if d.delegate is not self.text:
+            while d.delegate is not self.editwin.per.bottom:
+                d = d.delegate
+        self.editwin.per.insertfilterafter(change_delegator, after=d)
+
+        self.is_shown = True
+
+    def init_widgets(self):
+        self.canvas = tk.Canvas(self.parent, width=30,
+                                borderwidth=0, highlightthickness=0,
+                                takefocus=False)
+        self.update_sidebar()
+        self.grid()
+        return self.canvas
+
+    def bind_events(self):
+        super().bind_events()
+
+        self.main_widget.bind(
+            # AquaTk defines <2> as the right button, not <3>.
+            "<Button-2>" if macosx.isAquaTk() else "<Button-3>",
+            self.context_menu_event,
+        )
+
+    def context_menu_event(self, event):
+        rmenu = tk.Menu(self.main_widget, tearoff=0)
+        has_selection = bool(self.text.tag_nextrange('sel', '1.0'))
+        def mkcmd(eventname):
+            return lambda: self.text.event_generate(eventname)
+        rmenu.add_command(label='Copy',
+                          command=mkcmd('<<copy>>'),
+                          state='normal' if has_selection else 'disabled')
+        rmenu.add_command(label='Copy with prompts',
+                          command=mkcmd('<<copy-with-prompts>>'),
+                          state='normal' if has_selection else 'disabled')
+        rmenu.tk_popup(event.x_root, event.y_root)
+        return "break"
+
+    def grid(self):
+        self.canvas.grid(row=1, column=0, sticky=tk.NSEW, padx=2, pady=0)
+
+    def change_callback(self):
+        if self.is_shown:
+            self.update_sidebar()
+
+    def update_sidebar(self):
+        text = self.text
+        text_tagnames = text.tag_names
+        canvas = self.canvas
+        line_prompts = self.line_prompts = {}
+
+        canvas.delete(tk.ALL)
+
+        index = text.index("@0,0")
+        if index.split('.', 1)[1] != '0':
+            index = text.index(f'{index}+1line linestart')
+        while (lineinfo := text.dlineinfo(index)) is not None:
+            y = lineinfo[1]
+            prev_newline_tagnames = text_tagnames(f"{index} linestart -1c")
+            prompt = (
+                '>>>' if "console" in prev_newline_tagnames else
+                '...' if "stdin" in prev_newline_tagnames else
+                None
+            )
+            if prompt:
+                canvas.create_text(2, y, anchor=tk.NW, text=prompt,
+                                   font=self.font, fill=self.colors[0])
+                lineno = get_lineno(text, index)
+                line_prompts[lineno] = prompt
+            index = text.index(f'{index}+1line')
+
+    def yscroll_event(self, *args, **kwargs):
+        """Redirect vertical scrolling to the main editor text widget.
+
+        The scroll bar is also updated.
+        """
+        self.change_callback()
+        return 'break'
+
+    def update_font(self):
+        """Update the sidebar text font, usually after config changes."""
+        font = idleConf.GetFont(self.text, 'main', 'EditorWindow')
+        tk_font = Font(self.text, font=font)
+        char_width = max(tk_font.measure(char) for char in ['>', '.'])
+        self.canvas.configure(width=char_width * 3 + 4)
+        self.font = font
+        self.change_callback()
+
+    def update_colors(self):
+        """Update the sidebar text colors, usually after config changes."""
+        linenumbers_colors = idleConf.GetHighlight(idleConf.CurrentTheme(), 'linenumber')
+        prompt_colors = idleConf.GetHighlight(idleConf.CurrentTheme(), 'console')
+        foreground = prompt_colors['foreground']
+        background = linenumbers_colors['background']
+        self.colors = (foreground, background)
+        self.canvas.configure(background=background)
+        self.change_callback()
+
 
 def _linenumbers_drag_scrolling(parent):  # htest #
     from idlelib.idle_test.test_sidebar import Dummy_editwin
diff --git a/Lib/idlelib/squeezer.py b/Lib/idlelib/squeezer.py
index be1538a..929c3fd 100644
--- a/Lib/idlelib/squeezer.py
+++ b/Lib/idlelib/squeezer.py
@@ -17,7 +17,7 @@
 import re
 
 import tkinter as tk
-import tkinter.messagebox as tkMessageBox
+from tkinter import messagebox
 
 from idlelib.config import idleConf
 from idlelib.textview import view_text
@@ -147,7 +147,7 @@
         if self.is_dangerous is None:
             self.set_is_dangerous()
         if self.is_dangerous:
-            confirm = tkMessageBox.askokcancel(
+            confirm = messagebox.askokcancel(
                 title="Expand huge output?",
                 message="\n\n".join([
                     "The squeezed output is very long: %d lines, %d chars.",
@@ -155,13 +155,15 @@
                     "It is recommended to view or copy the output instead.",
                     "Really expand?"
                 ]) % (self.numoflines, len(self.s)),
-                default=tkMessageBox.CANCEL,
+                default=messagebox.CANCEL,
                 parent=self.text)
             if not confirm:
                 return "break"
 
-        self.base_text.insert(self.text.index(self), self.s, self.tags)
+        index = self.text.index(self)
+        self.base_text.insert(index, self.s, self.tags)
         self.base_text.delete(self)
+        self.editwin.on_squeezed_expand(index, self.s, self.tags)
         self.squeezer.expandingbuttons.remove(self)
 
     def copy(self, event=None):
@@ -285,12 +287,10 @@
         """
         return count_lines_with_wrapping(s, self.editwin.width)
 
-    def squeeze_current_text_event(self, event):
-        """squeeze-current-text event handler
+    def squeeze_current_text(self):
+        """Squeeze the text block where the insertion cursor is.
 
-        Squeeze the block of text inside which contains the "insert" cursor.
-
-        If the insert cursor is not in a squeezable block of text, give the
+        If the cursor is not in a squeezable block of text, give the
         user a small warning and do nothing.
         """
         # Set tag_name to the first valid tag found on the "insert" cursor.
diff --git a/Lib/idlelib/tooltip.py b/Lib/idlelib/tooltip.py
index 6965826..d714318 100644
--- a/Lib/idlelib/tooltip.py
+++ b/Lib/idlelib/tooltip.py
@@ -7,7 +7,7 @@
 from tkinter import *
 
 
-class TooltipBase(object):
+class TooltipBase:
     """abstract base class for tooltips"""
 
     def __init__(self, anchor_widget):
diff --git a/Lib/idlelib/util.py b/Lib/idlelib/util.py
new file mode 100644
index 0000000..5480219
--- /dev/null
+++ b/Lib/idlelib/util.py
@@ -0,0 +1,22 @@
+"""
+Idlelib objects with no external idlelib dependencies
+which are needed in more than one idlelib module.
+
+They are included here because
+    a) they don't particularly belong elsewhere; or
+    b) because inclusion here simplifies the idlelib dependency graph.
+
+TODO:
+    * Python versions (editor and help_about),
+    * tk version and patchlevel (pyshell, help_about, maxos?, editor?),
+    * std streams (pyshell, run),
+    * warning stuff (pyshell, run).
+"""
+from os import path
+
+# .pyw is for Windows; .pyi is for stub files.
+py_extensions = ('.py', '.pyw', '.pyi')  # Order needed for open/save dialogs.
+
+if __name__ == '__main__':
+    from unittest import main
+    main('idlelib.idle_test.test_util', verbosity=2)
diff --git a/Lib/idlelib/zzdummy.py b/Lib/idlelib/zzdummy.py
index 3c4b1d2..1247e8f 100644
--- a/Lib/idlelib/zzdummy.py
+++ b/Lib/idlelib/zzdummy.py
@@ -1,42 +1,73 @@
-"Example extension, also used for testing."
+"""Example extension, also used for testing.
+
+See extend.txt for more details on creating an extension.
+See config-extension.def for configuring an extension.
+"""
 
 from idlelib.config import idleConf
+from functools import wraps
 
-ztext = idleConf.GetOption('extensions', 'ZzDummy', 'z-text')
+
+def format_selection(format_line):
+    "Apply a formatting function to all of the selected lines."
+
+    @wraps(format_line)
+    def apply(self, event=None):
+        head, tail, chars, lines = self.formatter.get_region()
+        for pos in range(len(lines) - 1):
+            line = lines[pos]
+            lines[pos] = format_line(self, line)
+        self.formatter.set_region(head, tail, chars, lines)
+        return 'break'
+
+    return apply
 
 
 class ZzDummy:
+    """Prepend or remove initial text from selected lines."""
 
-##    menudefs = [
-##        ('format', [
-##            ('Z in', '<<z-in>>'),
-##            ('Z out', '<<z-out>>'),
-##        ] )
-##    ]
+    # Extend the format menu.
+    menudefs = [
+        ('format', [
+            ('Z in', '<<z-in>>'),
+            ('Z out', '<<z-out>>'),
+        ] )
+    ]
 
     def __init__(self, editwin):
+        "Initialize the settings for this extension."
+        self.editwin = editwin
         self.text = editwin.text
-        z_in = False
+        self.formatter = editwin.fregion
 
     @classmethod
     def reload(cls):
+        "Load class variables from config."
         cls.ztext = idleConf.GetOption('extensions', 'ZzDummy', 'z-text')
 
-    def z_in_event(self, event):
-        """
-        """
-        text = self.text
-        text.undo_block_start()
-        for line in range(1, text.index('end')):
-            text.insert('%d.0', ztext)
-        text.undo_block_stop()
-        return "break"
+    @format_selection
+    def z_in_event(self, line):
+        """Insert text at the beginning of each selected line.
 
-    def z_out_event(self, event): pass
+        This is bound to the <<z-in>> virtual event when the extensions
+        are loaded.
+        """
+        return f'{self.ztext}{line}'
+
+    @format_selection
+    def z_out_event(self, line):
+        """Remove specific text from the beginning of each selected line.
+
+        This is bound to the <<z-out>> virtual event when the extensions
+        are loaded.
+        """
+        zlength = 0 if not line.startswith(self.ztext) else len(self.ztext)
+        return line[zlength:]
+
 
 ZzDummy.reload()
 
-##if __name__ == "__main__":
-##    import unittest
-##    unittest.main('idlelib.idle_test.test_zzdummy',
-##            verbosity=2, exit=False)
+
+if __name__ == "__main__":
+    import unittest
+    unittest.main('idlelib.idle_test.test_zzdummy', verbosity=2, exit=False)
diff --git a/Lib/imaplib.py b/Lib/imaplib.py
index d9720f2..7318439 100644
--- a/Lib/imaplib.py
+++ b/Lib/imaplib.py
@@ -1251,13 +1251,12 @@
             sys.stderr.write('  %s.%02d %s\n' % (tm, (secs*100)%100, s))
             sys.stderr.flush()
 
-        def _dump_ur(self, dict):
-            # Dump untagged responses (in `dict').
-            l = dict.items()
-            if not l: return
-            t = '\n\t\t'
-            l = map(lambda x:'%s: "%s"' % (x[0], x[1][0] and '" "'.join(x[1]) or ''), l)
-            self._mesg('untagged responses dump:%s%s' % (t, t.join(l)))
+        def _dump_ur(self, untagged_resp_dict):
+            if not untagged_resp_dict:
+                return
+            items = (f'{key}: {value!r}'
+                    for key, value in untagged_resp_dict.items())
+            self._mesg('untagged responses dump:' + '\n\t\t'.join(items))
 
         def _log(self, line):
             # Keep log of last `_cmd_log_len' interactions for debugging.
diff --git a/Lib/imp.py b/Lib/imp.py
index 31f8c76..e02aaef 100644
--- a/Lib/imp.py
+++ b/Lib/imp.py
@@ -28,7 +28,8 @@
 import types
 import warnings
 
-warnings.warn("the imp module is deprecated in favour of importlib; "
+warnings.warn("the imp module is deprecated in favour of importlib and slated "
+              "for removal in Python 3.12; "
               "see the module's documentation for alternative uses",
               DeprecationWarning, stacklevel=2)
 
diff --git a/Lib/importlib/__init__.py b/Lib/importlib/__init__.py
index 0c73c50..ce61883 100644
--- a/Lib/importlib/__init__.py
+++ b/Lib/importlib/__init__.py
@@ -34,7 +34,7 @@
     import _frozen_importlib_external as _bootstrap_external
 except ImportError:
     from . import _bootstrap_external
-    _bootstrap_external._setup(_bootstrap)
+    _bootstrap_external._set_bootstrap_module(_bootstrap)
     _bootstrap._bootstrap_external = _bootstrap_external
 else:
     _bootstrap_external.__name__ = 'importlib._bootstrap_external'
@@ -54,7 +54,6 @@
 # Fully bootstrapped at this point, import whatever you like, circular
 # dependencies and startup overhead minimisation permitting :)
 
-import types
 import warnings
 
 
@@ -79,8 +78,8 @@
     This function is deprecated in favor of importlib.util.find_spec().
 
     """
-    warnings.warn('Deprecated since Python 3.4. '
-                  'Use importlib.util.find_spec() instead.',
+    warnings.warn('Deprecated since Python 3.4 and slated for removal in '
+                  'Python 3.12; use importlib.util.find_spec() instead',
                   DeprecationWarning, stacklevel=2)
     try:
         loader = sys.modules[name].__loader__
@@ -136,12 +135,13 @@
     The module must have been successfully imported before.
 
     """
-    if not module or not isinstance(module, types.ModuleType):
-        raise TypeError("reload() argument must be a module")
     try:
         name = module.__spec__.name
     except AttributeError:
-        name = module.__name__
+        try:
+            name = module.__name__
+        except AttributeError:
+            raise TypeError("reload() argument must be a module")
 
     if sys.modules.get(name) is not module:
         msg = "module {} not in sys.modules"
diff --git a/Lib/importlib/_abc.py b/Lib/importlib/_abc.py
new file mode 100644
index 0000000..f80348f
--- /dev/null
+++ b/Lib/importlib/_abc.py
@@ -0,0 +1,54 @@
+"""Subset of importlib.abc used to reduce importlib.util imports."""
+from . import _bootstrap
+import abc
+import warnings
+
+
+class Loader(metaclass=abc.ABCMeta):
+
+    """Abstract base class for import loaders."""
+
+    def create_module(self, spec):
+        """Return a module to initialize and into which to load.
+
+        This method should raise ImportError if anything prevents it
+        from creating a new module.  It may return None to indicate
+        that the spec should create the new module.
+        """
+        # By default, defer to default semantics for the new module.
+        return None
+
+    # We don't define exec_module() here since that would break
+    # hasattr checks we do to support backward compatibility.
+
+    def load_module(self, fullname):
+        """Return the loaded module.
+
+        The module must be added to sys.modules and have import-related
+        attributes set properly.  The fullname is a str.
+
+        ImportError is raised on failure.
+
+        This method is deprecated in favor of loader.exec_module(). If
+        exec_module() exists then it is used to provide a backwards-compatible
+        functionality for this method.
+
+        """
+        if not hasattr(self, 'exec_module'):
+            raise ImportError
+        # Warning implemented in _load_module_shim().
+        return _bootstrap._load_module_shim(self, fullname)
+
+    def module_repr(self, module):
+        """Return a module's repr.
+
+        Used by the module type when the method does not raise
+        NotImplementedError.
+
+        This method is deprecated.
+
+        """
+        warnings.warn("importlib.abc.Loader.module_repr() is deprecated and "
+                      "slated for removal in Python 3.12", DeprecationWarning)
+        # The exception will cause ModuleType.__repr__ to ignore this method.
+        raise NotImplementedError
diff --git a/Lib/importlib/_adapters.py b/Lib/importlib/_adapters.py
new file mode 100644
index 0000000..e72edd1
--- /dev/null
+++ b/Lib/importlib/_adapters.py
@@ -0,0 +1,83 @@
+from contextlib import suppress
+
+from . import abc
+
+
+class SpecLoaderAdapter:
+    """
+    Adapt a package spec to adapt the underlying loader.
+    """
+
+    def __init__(self, spec, adapter=lambda spec: spec.loader):
+        self.spec = spec
+        self.loader = adapter(spec)
+
+    def __getattr__(self, name):
+        return getattr(self.spec, name)
+
+
+class TraversableResourcesLoader:
+    """
+    Adapt a loader to provide TraversableResources.
+    """
+
+    def __init__(self, spec):
+        self.spec = spec
+
+    def get_resource_reader(self, name):
+        return DegenerateFiles(self.spec)._native()
+
+
+class DegenerateFiles:
+    """
+    Adapter for an existing or non-existant resource reader
+    to provide a degenerate .files().
+    """
+
+    class Path(abc.Traversable):
+        def iterdir(self):
+            return iter(())
+
+        def is_dir(self):
+            return False
+
+        is_file = exists = is_dir  # type: ignore
+
+        def joinpath(self, other):
+            return DegenerateFiles.Path()
+
+        @property
+        def name(self):
+            return ''
+
+        def open(self, mode='rb', *args, **kwargs):
+            raise ValueError()
+
+    def __init__(self, spec):
+        self.spec = spec
+
+    @property
+    def _reader(self):
+        with suppress(AttributeError):
+            return self.spec.loader.get_resource_reader(self.spec.name)
+
+    def _native(self):
+        """
+        Return the native reader if it supports files().
+        """
+        reader = self._reader
+        return reader if hasattr(reader, 'files') else self
+
+    def __getattr__(self, attr):
+        return getattr(self._reader, attr)
+
+    def files(self):
+        return DegenerateFiles.Path()
+
+
+def wrap_spec(package):
+    """
+    Construct a package spec with traversable compatibility
+    on the spec/loader/reader.
+    """
+    return SpecLoaderAdapter(package.__spec__, TraversableResourcesLoader)
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
index e00b27e..527bc9c 100644
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -20,10 +20,23 @@
 # reference any injected objects! This includes not only global code but also
 # anything specified at the class level.
 
+def _object_name(obj):
+    try:
+        return obj.__qualname__
+    except AttributeError:
+        return type(obj).__qualname__
+
 # Bootstrap-related code ######################################################
 
+# Modules injected manually by _setup()
+_thread = None
+_warnings = None
+_weakref = None
+
+# Import done by _install_external_importers()
 _bootstrap_external = None
 
+
 def _wrap(new, old):
     """Simple substitute for functools.update_wrapper."""
     for replace in ['__module__', '__name__', '__qualname__', '__doc__']:
@@ -262,9 +275,12 @@
 def _load_module_shim(self, fullname):
     """Load the specified module into sys.modules and return it.
 
-    This method is deprecated.  Use loader.exec_module instead.
+    This method is deprecated.  Use loader.exec_module() instead.
 
     """
+    msg = ("the load_module() method is deprecated and slated for removal in "
+          "Python 3.12; use exec_module() instead")
+    _warnings.warn(msg, DeprecationWarning)
     spec = spec_from_loader(fullname, self)
     if fullname in sys.modules:
         module = sys.modules[fullname]
@@ -276,26 +292,16 @@
 # Module specifications #######################################################
 
 def _module_repr(module):
-    # The implementation of ModuleType.__repr__().
+    """The implementation of ModuleType.__repr__()."""
     loader = getattr(module, '__loader__', None)
-    if hasattr(loader, 'module_repr'):
-        # As soon as BuiltinImporter, FrozenImporter, and NamespaceLoader
-        # drop their implementations for module_repr. we can add a
-        # deprecation warning here.
+    if spec := getattr(module, "__spec__", None):
+        return _module_repr_from_spec(spec)
+    elif hasattr(loader, 'module_repr'):
         try:
             return loader.module_repr(module)
         except Exception:
             pass
-    try:
-        spec = module.__spec__
-    except AttributeError:
-        pass
-    else:
-        if spec is not None:
-            return _module_repr_from_spec(spec)
-
-    # We could use module.__class__.__name__ instead of 'module' in the
-    # various repr permutations.
+    # Fall through to a catch-all which always succeeds.
     try:
         name = module.__name__
     except AttributeError:
@@ -605,9 +611,9 @@
             else:
                 _init_module_attrs(spec, module, override=True)
                 if not hasattr(spec.loader, 'exec_module'):
-                    # (issue19713) Once BuiltinImporter and ExtensionFileLoader
-                    # have exec_module() implemented, we can add a deprecation
-                    # warning here.
+                    msg = (f"{_object_name(spec.loader)}.exec_module() not found; "
+                           "falling back to load_module()")
+                    _warnings.warn(msg, ImportWarning)
                     spec.loader.load_module(name)
                 else:
                     spec.loader.exec_module(module)
@@ -620,9 +626,8 @@
 
 
 def _load_backward_compatible(spec):
-    # (issue19713) Once BuiltinImporter and ExtensionFileLoader
-    # have exec_module() implemented, we can add a deprecation
-    # warning here.
+    # It is assumed that all callers have been warned about using load_module()
+    # appropriately before calling this function.
     try:
         spec.loader.load_module(spec.name)
     except:
@@ -661,6 +666,9 @@
     if spec.loader is not None:
         # Not a namespace package.
         if not hasattr(spec.loader, 'exec_module'):
+            msg = (f"{_object_name(spec.loader)}.exec_module() not found; "
+                    "falling back to load_module()")
+            _warnings.warn(msg, ImportWarning)
             return _load_backward_compatible(spec)
 
     module = module_from_spec(spec)
@@ -731,6 +739,8 @@
         The method is deprecated.  The import machinery does the job itself.
 
         """
+        _warnings.warn("BuiltinImporter.module_repr() is deprecated and "
+                       "slated for removal in Python 3.12", DeprecationWarning)
         return f'<module {module.__name__!r} ({BuiltinImporter._ORIGIN})>'
 
     @classmethod
@@ -751,19 +761,22 @@
         This method is deprecated.  Use find_spec() instead.
 
         """
+        _warnings.warn("BuiltinImporter.find_module() is deprecated and "
+                       "slated for removal in Python 3.12; use find_spec() instead",
+                       DeprecationWarning)
         spec = cls.find_spec(fullname, path)
         return spec.loader if spec is not None else None
 
-    @classmethod
-    def create_module(self, spec):
+    @staticmethod
+    def create_module(spec):
         """Create a built-in module"""
         if spec.name not in sys.builtin_module_names:
             raise ImportError('{!r} is not a built-in module'.format(spec.name),
                               name=spec.name)
         return _call_with_frames_removed(_imp.create_builtin, spec)
 
-    @classmethod
-    def exec_module(self, module):
+    @staticmethod
+    def exec_module(module):
         """Exec a built-in module"""
         _call_with_frames_removed(_imp.exec_builtin, module)
 
@@ -806,6 +819,8 @@
         The method is deprecated.  The import machinery does the job itself.
 
         """
+        _warnings.warn("FrozenImporter.module_repr() is deprecated and "
+                       "slated for removal in Python 3.12", DeprecationWarning)
         return '<module {!r} ({})>'.format(m.__name__, FrozenImporter._ORIGIN)
 
     @classmethod
@@ -822,10 +837,13 @@
         This method is deprecated.  Use find_spec() instead.
 
         """
+        _warnings.warn("FrozenImporter.find_module() is deprecated and "
+                       "slated for removal in Python 3.12; use find_spec() instead",
+                       DeprecationWarning)
         return cls if _imp.is_frozen(fullname) else None
 
-    @classmethod
-    def create_module(cls, spec):
+    @staticmethod
+    def create_module(spec):
         """Use default semantics for module creation."""
 
     @staticmethod
@@ -844,6 +862,7 @@
         This method is deprecated.  Use exec_module() instead.
 
         """
+        # Warning about deprecation implemented in _load_module_shim().
         return _load_module_shim(cls, fullname)
 
     @classmethod
@@ -890,8 +909,9 @@
 
 
 def _find_spec_legacy(finder, name, path):
-    # This would be a good place for a DeprecationWarning if
-    # we ended up going that route.
+    msg = (f"{_object_name(finder)}.find_spec() not found; "
+                           "falling back to find_module()")
+    _warnings.warn(msg, ImportWarning)
     loader = finder.find_module(name, path)
     if loader is None:
         return None
diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py
index 25a3f8c..49bcaea 100644
--- a/Lib/importlib/_bootstrap_external.py
+++ b/Lib/importlib/_bootstrap_external.py
@@ -19,6 +19,37 @@
 # reference any injected objects! This includes not only global code but also
 # anything specified at the class level.
 
+# Module injected manually by _set_bootstrap_module()
+_bootstrap = None
+
+# Import builtin modules
+import _imp
+import _io
+import sys
+import _warnings
+import marshal
+
+
+_MS_WINDOWS = (sys.platform == 'win32')
+if _MS_WINDOWS:
+    import nt as _os
+    import winreg
+else:
+    import posix as _os
+
+
+if _MS_WINDOWS:
+    path_separators = ['\\', '/']
+else:
+    path_separators = ['/']
+# Assumption made in _path_join()
+assert all(len(sep) == 1 for sep in path_separators)
+path_sep = path_separators[0]
+path_sep_tuple = tuple(path_separators)
+path_separators = ''.join(path_separators)
+_pathseps_with_colon = {f':{s}' for s in path_separators}
+
+
 # Bootstrap-related code ######################################################
 _CASE_INSENSITIVE_PLATFORMS_STR_KEY = 'win',
 _CASE_INSENSITIVE_PLATFORMS_BYTES_KEY = 'cygwin', 'darwin'
@@ -42,6 +73,8 @@
             return False
     return _relax_case
 
+_relax_case = _make_relax_case()
+
 
 def _pack_uint32(x):
     """Convert a 32-bit integer to little-endian."""
@@ -59,22 +92,49 @@
     return int.from_bytes(data, 'little')
 
 
-def _path_join(*path_parts):
-    """Replacement for os.path.join()."""
-    return path_sep.join([part.rstrip(path_separators)
-                          for part in path_parts if part])
+if _MS_WINDOWS:
+    def _path_join(*path_parts):
+        """Replacement for os.path.join()."""
+        if not path_parts:
+            return ""
+        if len(path_parts) == 1:
+            return path_parts[0]
+        root = ""
+        path = []
+        for new_root, tail in map(_os._path_splitroot, path_parts):
+            if new_root.startswith(path_sep_tuple) or new_root.endswith(path_sep_tuple):
+                root = new_root.rstrip(path_separators) or root
+                path = [path_sep + tail]
+            elif new_root.endswith(':'):
+                if root.casefold() != new_root.casefold():
+                    # Drive relative paths have to be resolved by the OS, so we reset the
+                    # tail but do not add a path_sep prefix.
+                    root = new_root
+                    path = [tail]
+                else:
+                    path.append(tail)
+            else:
+                root = new_root or root
+                path.append(tail)
+        path = [p.rstrip(path_separators) for p in path if p]
+        if len(path) == 1 and not path[0]:
+            # Avoid losing the root's trailing separator when joining with nothing
+            return root + path_sep
+        return root + path_sep.join(path)
+
+else:
+    def _path_join(*path_parts):
+        """Replacement for os.path.join()."""
+        return path_sep.join([part.rstrip(path_separators)
+                              for part in path_parts if part])
 
 
 def _path_split(path):
     """Replacement for os.path.split()."""
-    if len(path_separators) == 1:
-        front, _, tail = path.rpartition(path_sep)
-        return front, tail
-    for x in reversed(path):
-        if x in path_separators:
-            front, tail = path.rsplit(x, maxsplit=1)
-            return front, tail
-    return '', path
+    i = max(path.rfind(p) for p in path_separators)
+    if i < 0:
+        return '', path
+    return path[:i], path[i + 1:]
 
 
 def _path_stat(path):
@@ -108,13 +168,18 @@
     return _path_is_mode_type(path, 0o040000)
 
 
-def _path_isabs(path):
-    """Replacement for os.path.isabs.
+if _MS_WINDOWS:
+    def _path_isabs(path):
+        """Replacement for os.path.isabs."""
+        if not path:
+            return False
+        root = _os._path_splitroot(path)[0].replace('/', '\\')
+        return len(root) > 1 and (root.startswith('\\\\') or root.endswith('\\'))
 
-    Considers a Windows drive-relative path (no drive, but starts with slash) to
-    still be "absolute".
-    """
-    return path.startswith(path_separators) or path[1:3] in _pathseps_with_colon
+else:
+    def _path_isabs(path):
+        """Replacement for os.path.isabs."""
+        return path.startswith(path_separators)
 
 
 def _write_atomic(path, data, mode=0o666):
@@ -277,6 +342,16 @@
 #     Python 3.9a2  3423 (add IS_OP, CONTAINS_OP and JUMP_IF_NOT_EXC_MATCH bytecodes #39156)
 #     Python 3.9a2  3424 (simplify bytecodes for *value unpacking)
 #     Python 3.9a2  3425 (simplify bytecodes for **value unpacking)
+#     Python 3.10a1 3430 (Make 'annotations' future by default)
+#     Python 3.10a1 3431 (New line number table format -- PEP 626)
+#     Python 3.10a2 3432 (Function annotation for MAKE_FUNCTION is changed from dict to tuple bpo-42202)
+#     Python 3.10a2 3433 (RERAISE restores f_lasti if oparg != 0)
+#     Python 3.10a6 3434 (PEP 634: Structural Pattern Matching)
+#     Python 3.10a7 3435 Use instruction offsets (as opposed to byte offsets).
+#     Python 3.10b1 3436 (Add GEN_START bytecode #43683)
+#     Python 3.10b1 3437 (Undo making 'annotations' future by default - We like to dance among core devs!)
+#     Python 3.10b1 3438 Safer line number table handling.
+#     Python 3.10b1 3439 (Add ROT_N)
 
 #
 # MAGIC must change whenever the bytecode emitted by the compiler may no
@@ -286,13 +361,17 @@
 # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array
 # in PC/launcher.c must also be updated.
 
-MAGIC_NUMBER = (3425).to_bytes(2, 'little') + b'\r\n'
+MAGIC_NUMBER = (3439).to_bytes(2, 'little') + b'\r\n'
 _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little')  # For import.c
 
 _PYCACHE = '__pycache__'
 _OPT = 'opt-'
 
-SOURCE_SUFFIXES = ['.py']  # _setup() adds .pyw as needed.
+SOURCE_SUFFIXES = ['.py']
+if _MS_WINDOWS:
+    SOURCE_SUFFIXES.append('.pyw')
+
+EXTENSION_SUFFIXES = _imp.extension_suffixes()
 
 BYTECODE_SUFFIXES = ['.pyc']
 # Deprecated.
@@ -467,15 +546,18 @@
             raise ImportError('loader for %s cannot handle %s' %
                                 (self.name, name), name=name)
         return method(self, name, *args, **kwargs)
-    try:
+
+    # FIXME: @_check_name is used to define class methods before the
+    # _bootstrap module is set by _set_bootstrap_module().
+    if _bootstrap is not None:
         _wrap = _bootstrap._wrap
-    except NameError:
-        # XXX yuck
+    else:
         def _wrap(new, old):
             for replace in ['__module__', '__name__', '__qualname__', '__doc__']:
                 if hasattr(old, replace):
                     setattr(new, replace, getattr(old, replace))
             new.__dict__.update(old.__dict__)
+
     _wrap(_check_name_wrapper, method)
     return _check_name_wrapper
 
@@ -487,6 +569,9 @@
     This method is deprecated in favor of finder.find_spec().
 
     """
+    _warnings.warn("find_module() is deprecated and "
+                   "slated for removal in Python 3.12; use find_spec() instead",
+                   DeprecationWarning)
     # Call find_loader(). If it returns a string (indicating this
     # is a namespace package portion), generate a warning and
     # return None.
@@ -658,6 +743,11 @@
                 pass
     else:
         location = _os.fspath(location)
+        if not _path_isabs(location):
+            try:
+                location = _path_join(_os.getcwd(), location)
+            except OSError:
+                pass
 
     # If the location is on the filesystem, but doesn't actually exist,
     # we could return None here, indicating that the location is not
@@ -711,10 +801,10 @@
     REGISTRY_KEY_DEBUG = (
         'Software\\Python\\PythonCore\\{sys_version}'
         '\\Modules\\{fullname}\\Debug')
-    DEBUG_BUILD = False  # Changed in _setup()
+    DEBUG_BUILD = (_MS_WINDOWS and '_d.pyd' in EXTENSION_SUFFIXES)
 
-    @classmethod
-    def _open_registry(cls, key):
+    @staticmethod
+    def _open_registry(key):
         try:
             return winreg.OpenKey(winreg.HKEY_CURRENT_USER, key)
         except OSError:
@@ -755,9 +845,12 @@
     def find_module(cls, fullname, path=None):
         """Find module named in the registry.
 
-        This method is deprecated.  Use exec_module() instead.
+        This method is deprecated.  Use find_spec() instead.
 
         """
+        _warnings.warn("WindowsRegistryFinder.find_module() is deprecated and "
+                       "slated for removal in Python 3.12; use find_spec() instead",
+                       DeprecationWarning)
         spec = cls.find_spec(fullname, path)
         if spec is not None:
             return spec.loader
@@ -790,7 +883,8 @@
         _bootstrap._call_with_frames_removed(exec, code, module.__dict__)
 
     def load_module(self, fullname):
-        """This module is deprecated."""
+        """This method is deprecated."""
+        # Warning implemented in _load_module_shim().
         return _bootstrap._load_module_shim(self, fullname)
 
 
@@ -965,7 +1059,7 @@
         """
         # The only reason for this method is for the name check.
         # Issue #14857: Avoid the zero-argument form of super so the implementation
-        # of that form can be updated without breaking the frozen module
+        # of that form can be updated without breaking the frozen module.
         return super(FileLoader, self).load_module(fullname)
 
     @_check_name
@@ -982,32 +1076,10 @@
             with _io.FileIO(path, 'r') as file:
                 return file.read()
 
-    # ResourceReader ABC API.
-
     @_check_name
     def get_resource_reader(self, module):
-        if self.is_package(module):
-            return self
-        return None
-
-    def open_resource(self, resource):
-        path = _path_join(_path_split(self.path)[0], resource)
-        return _io.FileIO(path, 'r')
-
-    def resource_path(self, resource):
-        if not self.is_resource(resource):
-            raise FileNotFoundError
-        path = _path_join(_path_split(self.path)[0], resource)
-        return path
-
-    def is_resource(self, name):
-        if path_sep in name:
-            return False
-        path = _path_join(_path_split(self.path)[0], name)
-        return _path_isfile(path)
-
-    def contents(self):
-        return iter(_os.listdir(_path_split(self.path)[0]))
+        from importlib.readers import FileReader
+        return FileReader(self)
 
 
 class SourceFileLoader(FileLoader, SourceLoader):
@@ -1080,10 +1152,6 @@
         return None
 
 
-# Filled in by _setup().
-EXTENSION_SUFFIXES = []
-
-
 class ExtensionFileLoader(FileLoader, _LoaderBasics):
 
     """Loader for extension modules.
@@ -1144,10 +1212,15 @@
     using path_finder.  For top-level modules, the parent module's path
     is sys.path."""
 
+    # When invalidate_caches() is called, this epoch is incremented
+    # https://bugs.python.org/issue45703
+    _epoch = 0
+
     def __init__(self, name, path, path_finder):
         self._name = name
         self._path = path
         self._last_parent_path = tuple(self._get_parent_path())
+        self._last_epoch = self._epoch
         self._path_finder = path_finder
 
     def _find_parent_path_names(self):
@@ -1167,7 +1240,7 @@
     def _recalculate(self):
         # If the parent's path has changed, recalculate _path
         parent_path = tuple(self._get_parent_path()) # Make a copy
-        if parent_path != self._last_parent_path:
+        if parent_path != self._last_parent_path or self._epoch != self._last_epoch:
             spec = self._path_finder(self._name, parent_path)
             # Note that no changes are made if a loader is returned, but we
             #  do remember the new parent path
@@ -1175,6 +1248,7 @@
                 if spec.submodule_search_locations:
                     self._path = spec.submodule_search_locations
             self._last_parent_path = parent_path     # Save the copy
+            self._last_epoch = self._epoch
         return self._path
 
     def __iter__(self):
@@ -1204,13 +1278,15 @@
     def __init__(self, name, path, path_finder):
         self._path = _NamespacePath(name, path, path_finder)
 
-    @classmethod
-    def module_repr(cls, module):
+    @staticmethod
+    def module_repr(module):
         """Return repr for the module.
 
         The method is deprecated.  The import machinery does the job itself.
 
         """
+        _warnings.warn("_NamespaceLoader.module_repr() is deprecated and "
+                       "slated for removal in Python 3.12", DeprecationWarning)
         return '<module {!r} (namespace)>'.format(module.__name__)
 
     def is_package(self, fullname):
@@ -1237,8 +1313,13 @@
         # The import system never calls this method.
         _bootstrap._verbose_message('namespace module loaded with path {!r}',
                                     self._path)
+        # Warning implemented in _load_module_shim().
         return _bootstrap._load_module_shim(self, fullname)
 
+    def get_resource_reader(self, module):
+        from importlib.readers import NamespaceReader
+        return NamespaceReader(self._path)
+
 
 # Finders #####################################################################
 
@@ -1246,8 +1327,8 @@
 
     """Meta path finder for sys.path and package __path__ attributes."""
 
-    @classmethod
-    def invalidate_caches(cls):
+    @staticmethod
+    def invalidate_caches():
         """Call the invalidate_caches() method on all path entry finders
         stored in sys.path_importer_caches (where implemented)."""
         for name, finder in list(sys.path_importer_cache.items()):
@@ -1255,9 +1336,12 @@
                 del sys.path_importer_cache[name]
             elif hasattr(finder, 'invalidate_caches'):
                 finder.invalidate_caches()
+        # Also invalidate the caches of _NamespacePaths
+        # https://bugs.python.org/issue45703
+        _NamespacePath._epoch += 1
 
-    @classmethod
-    def _path_hooks(cls, path):
+    @staticmethod
+    def _path_hooks(path):
         """Search sys.path_hooks for a finder for 'path'."""
         if sys.path_hooks is not None and not sys.path_hooks:
             _warnings.warn('sys.path_hooks is empty', ImportWarning)
@@ -1296,8 +1380,14 @@
         # This would be a good place for a DeprecationWarning if
         # we ended up going that route.
         if hasattr(finder, 'find_loader'):
+            msg = (f"{_bootstrap._object_name(finder)}.find_spec() not found; "
+                    "falling back to find_loader()")
+            _warnings.warn(msg, ImportWarning)
             loader, portions = finder.find_loader(fullname)
         else:
+            msg = (f"{_bootstrap._object_name(finder)}.find_spec() not found; "
+                    "falling back to find_module()")
+            _warnings.warn(msg, ImportWarning)
             loader = finder.find_module(fullname)
             portions = []
         if loader is not None:
@@ -1370,13 +1460,16 @@
         This method is deprecated.  Use find_spec() instead.
 
         """
+        _warnings.warn("PathFinder.find_module() is deprecated and "
+                       "slated for removal in Python 3.12; use find_spec() instead",
+                       DeprecationWarning)
         spec = cls.find_spec(fullname, path)
         if spec is None:
             return None
         return spec.loader
 
-    @classmethod
-    def find_distributions(cls, *args, **kwargs):
+    @staticmethod
+    def find_distributions(*args, **kwargs):
         """
         Find distributions.
 
@@ -1408,6 +1501,8 @@
         self._loaders = loaders
         # Base (directory) path
         self.path = path or '.'
+        if not _path_isabs(self.path):
+            self.path = _path_join(_os.getcwd(), self.path)
         self._path_mtime = -1
         self._path_cache = set()
         self._relaxed_path_cache = set()
@@ -1425,6 +1520,9 @@
         This method is deprecated.  Use find_spec() instead.
 
         """
+        _warnings.warn("FileFinder.find_loader() is deprecated and "
+                       "slated for removal in Python 3.12; use find_spec() instead",
+                       DeprecationWarning)
         spec = self.find_spec(fullname)
         if spec is None:
             return None, []
@@ -1470,7 +1568,10 @@
                 is_namespace = _path_isdir(base_path)
         # Check for a file w/ a proper suffix exists.
         for suffix, loader_class in self._loaders:
-            full_path = _path_join(self.path, tail_module + suffix)
+            try:
+                full_path = _path_join(self.path, tail_module + suffix)
+            except ValueError:
+                return None
             _bootstrap._verbose_message('trying {}', full_path, verbosity=2)
             if cache_module + suffix in cache:
                 if _path_isfile(full_path):
@@ -1572,66 +1673,14 @@
     return [extensions, source, bytecode]
 
 
-def _setup(_bootstrap_module):
-    """Setup the path-based importers for importlib by importing needed
-    built-in modules and injecting them into the global namespace.
-
-    Other components are extracted from the core bootstrap module.
-
-    """
-    global sys, _imp, _bootstrap
+def _set_bootstrap_module(_bootstrap_module):
+    global _bootstrap
     _bootstrap = _bootstrap_module
-    sys = _bootstrap.sys
-    _imp = _bootstrap._imp
-
-    self_module = sys.modules[__name__]
-
-    # Directly load the os module (needed during bootstrap).
-    os_details = ('posix', ['/']), ('nt', ['\\', '/'])
-    for builtin_os, path_separators in os_details:
-        # Assumption made in _path_join()
-        assert all(len(sep) == 1 for sep in path_separators)
-        path_sep = path_separators[0]
-        if builtin_os in sys.modules:
-            os_module = sys.modules[builtin_os]
-            break
-        else:
-            try:
-                os_module = _bootstrap._builtin_from_name(builtin_os)
-                break
-            except ImportError:
-                continue
-    else:
-        raise ImportError('importlib requires posix or nt')
-
-    setattr(self_module, '_os', os_module)
-    setattr(self_module, 'path_sep', path_sep)
-    setattr(self_module, 'path_separators', ''.join(path_separators))
-    setattr(self_module, '_pathseps_with_colon', {f':{s}' for s in path_separators})
-
-    # Directly load built-in modules needed during bootstrap.
-    builtin_names = ['_io', '_warnings', 'marshal']
-    if builtin_os == 'nt':
-        builtin_names.append('winreg')
-    for builtin_name in builtin_names:
-        if builtin_name not in sys.modules:
-            builtin_module = _bootstrap._builtin_from_name(builtin_name)
-        else:
-            builtin_module = sys.modules[builtin_name]
-        setattr(self_module, builtin_name, builtin_module)
-
-    # Constants
-    setattr(self_module, '_relax_case', _make_relax_case())
-    EXTENSION_SUFFIXES.extend(_imp.extension_suffixes())
-    if builtin_os == 'nt':
-        SOURCE_SUFFIXES.append('.pyw')
-        if '_d.pyd' in EXTENSION_SUFFIXES:
-            WindowsRegistryFinder.DEBUG_BUILD = True
 
 
 def _install(_bootstrap_module):
     """Install the path-based import components."""
-    _setup(_bootstrap_module)
+    _set_bootstrap_module(_bootstrap_module)
     supported_loaders = _get_supported_file_loaders()
     sys.path_hooks.extend([FileFinder.path_hook(*supported_loaders)])
     sys.meta_path.append(PathFinder)
diff --git a/Lib/importlib/_common.py b/Lib/importlib/_common.py
index c1204f0..549fee3 100644
--- a/Lib/importlib/_common.py
+++ b/Lib/importlib/_common.py
@@ -1,9 +1,72 @@
 import os
 import pathlib
-import zipfile
 import tempfile
 import functools
 import contextlib
+import types
+import importlib
+
+from typing import Union, Any, Optional
+from .abc import ResourceReader, Traversable
+
+from ._adapters import wrap_spec
+
+Package = Union[types.ModuleType, str]
+
+
+def files(package):
+    # type: (Package) -> Traversable
+    """
+    Get a Traversable resource from a package
+    """
+    return from_package(get_package(package))
+
+
+def normalize_path(path):
+    # type: (Any) -> str
+    """Normalize a path by ensuring it is a string.
+
+    If the resulting string contains path separators, an exception is raised.
+    """
+    str_path = str(path)
+    parent, file_name = os.path.split(str_path)
+    if parent:
+        raise ValueError(f'{path!r} must be only a file name')
+    return file_name
+
+
+def get_resource_reader(package):
+    # type: (types.ModuleType) -> Optional[ResourceReader]
+    """
+    Return the package's loader if it's a ResourceReader.
+    """
+    # We can't use
+    # a issubclass() check here because apparently abc.'s __subclasscheck__()
+    # hook wants to create a weak reference to the object, but
+    # zipimport.zipimporter does not support weak references, resulting in a
+    # TypeError.  That seems terrible.
+    spec = package.__spec__
+    reader = getattr(spec.loader, 'get_resource_reader', None)  # type: ignore
+    if reader is None:
+        return None
+    return reader(spec.name)  # type: ignore
+
+
+def resolve(cand):
+    # type: (Package) -> types.ModuleType
+    return cand if isinstance(cand, types.ModuleType) else importlib.import_module(cand)
+
+
+def get_package(package):
+    # type: (Package) -> types.ModuleType
+    """Take a package name or module object and return the module.
+
+    Raise an exception if the resolved module is not a package.
+    """
+    resolved = resolve(package)
+    if wrap_spec(resolved).submodule_search_locations is None:
+        raise TypeError(f'{package!r} is not a package')
+    return resolved
 
 
 def from_package(package):
@@ -11,18 +74,9 @@
     Return a Traversable object for the given package.
 
     """
-    return fallback_resources(package.__spec__)
-
-
-def fallback_resources(spec):
-    package_directory = pathlib.Path(spec.origin).parent
-    try:
-        archive_path = spec.loader.archive
-        rel_path = package_directory.relative_to(archive_path)
-        return zipfile.Path(archive_path, str(rel_path) + '/')
-    except Exception:
-        pass
-    return package_directory
+    spec = wrap_spec(package)
+    reader = spec.loader.get_resource_reader(spec.name)
+    return reader.files()
 
 
 @contextlib.contextmanager
@@ -34,6 +88,7 @@
     try:
         os.write(fd, reader())
         os.close(fd)
+        del reader
         yield pathlib.Path(raw_path)
     finally:
         try:
@@ -43,14 +98,12 @@
 
 
 @functools.singledispatch
-@contextlib.contextmanager
 def as_file(path):
     """
     Given a Traversable object, return that object as a
     path on the local file system in a context manager.
     """
-    with _tempfile(path.read_bytes, suffix=path.name) as local:
-        yield local
+    return _tempfile(path.read_bytes, suffix=path.name)
 
 
 @as_file.register(pathlib.Path)
diff --git a/Lib/importlib/abc.py b/Lib/importlib/abc.py
index b8a9bb1..0b4a3f8 100644
--- a/Lib/importlib/abc.py
+++ b/Lib/importlib/abc.py
@@ -1,5 +1,4 @@
 """Abstract base classes related to import."""
-from . import _bootstrap
 from . import _bootstrap_external
 from . import machinery
 try:
@@ -12,8 +11,10 @@
     import _frozen_importlib_external
 except ImportError:
     _frozen_importlib_external = _bootstrap_external
+from ._abc import Loader
 import abc
 import warnings
+from typing import BinaryIO, Iterable, Text
 from typing import Protocol, runtime_checkable
 
 
@@ -40,15 +41,27 @@
     Deprecated since Python 3.3
     """
 
+    def __init__(self):
+        warnings.warn("the Finder ABC is deprecated and "
+                       "slated for removal in Python 3.12; use MetaPathFinder "
+                       "or PathEntryFinder instead",
+                       DeprecationWarning)
+
     @abc.abstractmethod
     def find_module(self, fullname, path=None):
         """An abstract method that should find a module.
         The fullname is a str and the optional path is a str or None.
         Returns a Loader object or None.
         """
+        warnings.warn("importlib.abc.Finder along with its find_module() "
+                      "method are deprecated and "
+                       "slated for removal in Python 3.12; use "
+                       "MetaPathFinder.find_spec() or "
+                       "PathEntryFinder.find_spec() instead",
+                       DeprecationWarning)
 
 
-class MetaPathFinder(Finder):
+class MetaPathFinder(metaclass=abc.ABCMeta):
 
     """Abstract base class for import finders on sys.meta_path."""
 
@@ -67,8 +80,8 @@
 
         """
         warnings.warn("MetaPathFinder.find_module() is deprecated since Python "
-                      "3.4 in favor of MetaPathFinder.find_spec() "
-                      "(available since 3.4)",
+                      "3.4 in favor of MetaPathFinder.find_spec() and is "
+                      "slated for removal in Python 3.12",
                       DeprecationWarning,
                       stacklevel=2)
         if not hasattr(self, 'find_spec'):
@@ -85,7 +98,7 @@
           machinery.PathFinder, machinery.WindowsRegistryFinder)
 
 
-class PathEntryFinder(Finder):
+class PathEntryFinder(metaclass=abc.ABCMeta):
 
     """Abstract base class for path entry finders used by PathFinder."""
 
@@ -134,53 +147,6 @@
 _register(PathEntryFinder, machinery.FileFinder)
 
 
-class Loader(metaclass=abc.ABCMeta):
-
-    """Abstract base class for import loaders."""
-
-    def create_module(self, spec):
-        """Return a module to initialize and into which to load.
-
-        This method should raise ImportError if anything prevents it
-        from creating a new module.  It may return None to indicate
-        that the spec should create the new module.
-        """
-        # By default, defer to default semantics for the new module.
-        return None
-
-    # We don't define exec_module() here since that would break
-    # hasattr checks we do to support backward compatibility.
-
-    def load_module(self, fullname):
-        """Return the loaded module.
-
-        The module must be added to sys.modules and have import-related
-        attributes set properly.  The fullname is a str.
-
-        ImportError is raised on failure.
-
-        This method is deprecated in favor of loader.exec_module(). If
-        exec_module() exists then it is used to provide a backwards-compatible
-        functionality for this method.
-
-        """
-        if not hasattr(self, 'exec_module'):
-            raise ImportError
-        return _bootstrap._load_module_shim(self, fullname)
-
-    def module_repr(self, module):
-        """Return a module's repr.
-
-        Used by the module type when the method does not raise
-        NotImplementedError.
-
-        This method is deprecated.
-
-        """
-        # The exception will cause ModuleType.__repr__ to ignore this method.
-        raise NotImplementedError
-
-
 class ResourceLoader(Loader):
 
     """Abstract base class for loaders which can return data from their
@@ -344,49 +310,45 @@
 
 
 class ResourceReader(metaclass=abc.ABCMeta):
-
-    """Abstract base class to provide resource-reading support.
-
-    Loaders that support resource reading are expected to implement
-    the ``get_resource_reader(fullname)`` method and have it either return None
-    or an object compatible with this ABC.
-    """
+    """Abstract base class for loaders to provide resource reading support."""
 
     @abc.abstractmethod
-    def open_resource(self, resource):
+    def open_resource(self, resource: Text) -> BinaryIO:
         """Return an opened, file-like object for binary reading.
 
-        The 'resource' argument is expected to represent only a file name
-        and thus not contain any subdirectory components.
-
+        The 'resource' argument is expected to represent only a file name.
         If the resource cannot be found, FileNotFoundError is raised.
         """
+        # This deliberately raises FileNotFoundError instead of
+        # NotImplementedError so that if this method is accidentally called,
+        # it'll still do the right thing.
         raise FileNotFoundError
 
     @abc.abstractmethod
-    def resource_path(self, resource):
+    def resource_path(self, resource: Text) -> Text:
         """Return the file system path to the specified resource.
 
-        The 'resource' argument is expected to represent only a file name
-        and thus not contain any subdirectory components.
-
+        The 'resource' argument is expected to represent only a file name.
         If the resource does not exist on the file system, raise
         FileNotFoundError.
         """
+        # This deliberately raises FileNotFoundError instead of
+        # NotImplementedError so that if this method is accidentally called,
+        # it'll still do the right thing.
         raise FileNotFoundError
 
     @abc.abstractmethod
-    def is_resource(self, name):
-        """Return True if the named 'name' is consider a resource."""
+    def is_resource(self, path: Text) -> bool:
+        """Return True if the named 'path' is a resource.
+
+        Files are resources, directories are not.
+        """
         raise FileNotFoundError
 
     @abc.abstractmethod
-    def contents(self):
-        """Return an iterable of strings over the contents of the package."""
-        return []
-
-
-_register(ResourceReader, machinery.SourceFileLoader)
+    def contents(self) -> Iterable[str]:
+        """Return an iterable of entries in `package`."""
+        raise FileNotFoundError
 
 
 @runtime_checkable
@@ -402,26 +364,28 @@
         Yield Traversable objects in self
         """
 
-    @abc.abstractmethod
     def read_bytes(self):
         """
         Read contents of self as bytes
         """
+        with self.open('rb') as strm:
+            return strm.read()
 
-    @abc.abstractmethod
     def read_text(self, encoding=None):
         """
-        Read contents of self as bytes
+        Read contents of self as text
         """
+        with self.open(encoding=encoding) as strm:
+            return strm.read()
 
     @abc.abstractmethod
-    def is_dir(self):
+    def is_dir(self) -> bool:
         """
         Return True if self is a dir
         """
 
     @abc.abstractmethod
-    def is_file(self):
+    def is_file(self) -> bool:
         """
         Return True if self is a file
         """
@@ -432,11 +396,11 @@
         Return Traversable child in self
         """
 
-    @abc.abstractmethod
     def __truediv__(self, child):
         """
         Return Traversable child in self
         """
+        return self.joinpath(child)
 
     @abc.abstractmethod
     def open(self, mode='r', *args, **kwargs):
@@ -449,14 +413,18 @@
         """
 
     @abc.abstractproperty
-    def name(self):
-        # type: () -> str
+    def name(self) -> str:
         """
         The base name of this object without any parent references.
         """
 
 
 class TraversableResources(ResourceReader):
+    """
+    The required interface for providing traversable
+    resources.
+    """
+
     @abc.abstractmethod
     def files(self):
         """Return a Traversable object for the loaded package."""
@@ -468,7 +436,7 @@
         raise FileNotFoundError(resource)
 
     def is_resource(self, path):
-        return self.files().joinpath(path).isfile()
+        return self.files().joinpath(path).is_file()
 
     def contents(self):
         return (item.name for item in self.files().iterdir())
diff --git a/Lib/importlib/machinery.py b/Lib/importlib/machinery.py
index 1b2b5c9..9a7757f 100644
--- a/Lib/importlib/machinery.py
+++ b/Lib/importlib/machinery.py
@@ -1,7 +1,5 @@
 """The machinery of importlib: finders, loaders, hooks, etc."""
 
-import _imp
-
 from ._bootstrap import ModuleSpec
 from ._bootstrap import BuiltinImporter
 from ._bootstrap import FrozenImporter
diff --git a/Lib/importlib/metadata.py b/Lib/importlib/metadata.py
deleted file mode 100644
index ffa0cba..0000000
--- a/Lib/importlib/metadata.py
+++ /dev/null
@@ -1,586 +0,0 @@
-import io
-import os
-import re
-import abc
-import csv
-import sys
-import email
-import pathlib
-import zipfile
-import operator
-import functools
-import itertools
-import posixpath
-import collections
-
-from configparser import ConfigParser
-from contextlib import suppress
-from importlib import import_module
-from importlib.abc import MetaPathFinder
-from itertools import starmap
-
-
-__all__ = [
-    'Distribution',
-    'DistributionFinder',
-    'PackageNotFoundError',
-    'distribution',
-    'distributions',
-    'entry_points',
-    'files',
-    'metadata',
-    'requires',
-    'version',
-    ]
-
-
-class PackageNotFoundError(ModuleNotFoundError):
-    """The package was not found."""
-
-
-class EntryPoint(
-        collections.namedtuple('EntryPointBase', 'name value group')):
-    """An entry point as defined by Python packaging conventions.
-
-    See `the packaging docs on entry points
-    <https://packaging.python.org/specifications/entry-points/>`_
-    for more information.
-    """
-
-    pattern = re.compile(
-        r'(?P<module>[\w.]+)\s*'
-        r'(:\s*(?P<attr>[\w.]+))?\s*'
-        r'(?P<extras>\[.*\])?\s*$'
-        )
-    """
-    A regular expression describing the syntax for an entry point,
-    which might look like:
-
-        - module
-        - package.module
-        - package.module:attribute
-        - package.module:object.attribute
-        - package.module:attr [extra1, extra2]
-
-    Other combinations are possible as well.
-
-    The expression is lenient about whitespace around the ':',
-    following the attr, and following any extras.
-    """
-
-    def load(self):
-        """Load the entry point from its definition. If only a module
-        is indicated by the value, return that module. Otherwise,
-        return the named object.
-        """
-        match = self.pattern.match(self.value)
-        module = import_module(match.group('module'))
-        attrs = filter(None, (match.group('attr') or '').split('.'))
-        return functools.reduce(getattr, attrs, module)
-
-    @property
-    def module(self):
-        match = self.pattern.match(self.value)
-        return match.group('module')
-
-    @property
-    def attr(self):
-        match = self.pattern.match(self.value)
-        return match.group('attr')
-
-    @property
-    def extras(self):
-        match = self.pattern.match(self.value)
-        return list(re.finditer(r'\w+', match.group('extras') or ''))
-
-    @classmethod
-    def _from_config(cls, config):
-        return [
-            cls(name, value, group)
-            for group in config.sections()
-            for name, value in config.items(group)
-            ]
-
-    @classmethod
-    def _from_text(cls, text):
-        config = ConfigParser(delimiters='=')
-        # case sensitive: https://stackoverflow.com/q/1611799/812183
-        config.optionxform = str
-        try:
-            config.read_string(text)
-        except AttributeError:  # pragma: nocover
-            # Python 2 has no read_string
-            config.readfp(io.StringIO(text))
-        return EntryPoint._from_config(config)
-
-    def __iter__(self):
-        """
-        Supply iter so one may construct dicts of EntryPoints easily.
-        """
-        return iter((self.name, self))
-
-    def __reduce__(self):
-        return (
-            self.__class__,
-            (self.name, self.value, self.group),
-            )
-
-
-class PackagePath(pathlib.PurePosixPath):
-    """A reference to a path in a package"""
-
-    def read_text(self, encoding='utf-8'):
-        with self.locate().open(encoding=encoding) as stream:
-            return stream.read()
-
-    def read_binary(self):
-        with self.locate().open('rb') as stream:
-            return stream.read()
-
-    def locate(self):
-        """Return a path-like object for this path"""
-        return self.dist.locate_file(self)
-
-
-class FileHash:
-    def __init__(self, spec):
-        self.mode, _, self.value = spec.partition('=')
-
-    def __repr__(self):
-        return '<FileHash mode: {} value: {}>'.format(self.mode, self.value)
-
-
-class Distribution:
-    """A Python distribution package."""
-
-    @abc.abstractmethod
-    def read_text(self, filename):
-        """Attempt to load metadata file given by the name.
-
-        :param filename: The name of the file in the distribution info.
-        :return: The text if found, otherwise None.
-        """
-
-    @abc.abstractmethod
-    def locate_file(self, path):
-        """
-        Given a path to a file in this distribution, return a path
-        to it.
-        """
-
-    @classmethod
-    def from_name(cls, name):
-        """Return the Distribution for the given package name.
-
-        :param name: The name of the distribution package to search for.
-        :return: The Distribution instance (or subclass thereof) for the named
-            package, if found.
-        :raises PackageNotFoundError: When the named package's distribution
-            metadata cannot be found.
-        """
-        for resolver in cls._discover_resolvers():
-            dists = resolver(DistributionFinder.Context(name=name))
-            dist = next(iter(dists), None)
-            if dist is not None:
-                return dist
-        else:
-            raise PackageNotFoundError(name)
-
-    @classmethod
-    def discover(cls, **kwargs):
-        """Return an iterable of Distribution objects for all packages.
-
-        Pass a ``context`` or pass keyword arguments for constructing
-        a context.
-
-        :context: A ``DistributionFinder.Context`` object.
-        :return: Iterable of Distribution objects for all packages.
-        """
-        context = kwargs.pop('context', None)
-        if context and kwargs:
-            raise ValueError("cannot accept context and kwargs")
-        context = context or DistributionFinder.Context(**kwargs)
-        return itertools.chain.from_iterable(
-            resolver(context)
-            for resolver in cls._discover_resolvers()
-            )
-
-    @staticmethod
-    def at(path):
-        """Return a Distribution for the indicated metadata path
-
-        :param path: a string or path-like object
-        :return: a concrete Distribution instance for the path
-        """
-        return PathDistribution(pathlib.Path(path))
-
-    @staticmethod
-    def _discover_resolvers():
-        """Search the meta_path for resolvers."""
-        declared = (
-            getattr(finder, 'find_distributions', None)
-            for finder in sys.meta_path
-            )
-        return filter(None, declared)
-
-    @classmethod
-    def _local(cls, root='.'):
-        from pep517 import build, meta
-        system = build.compat_system(root)
-        builder = functools.partial(
-            meta.build,
-            source_dir=root,
-            system=system,
-            )
-        return PathDistribution(zipfile.Path(meta.build_as_zip(builder)))
-
-    @property
-    def metadata(self):
-        """Return the parsed metadata for this Distribution.
-
-        The returned object will have keys that name the various bits of
-        metadata.  See PEP 566 for details.
-        """
-        text = (
-            self.read_text('METADATA')
-            or self.read_text('PKG-INFO')
-            # This last clause is here to support old egg-info files.  Its
-            # effect is to just end up using the PathDistribution's self._path
-            # (which points to the egg-info file) attribute unchanged.
-            or self.read_text('')
-            )
-        return email.message_from_string(text)
-
-    @property
-    def version(self):
-        """Return the 'Version' metadata for the distribution package."""
-        return self.metadata['Version']
-
-    @property
-    def entry_points(self):
-        return EntryPoint._from_text(self.read_text('entry_points.txt'))
-
-    @property
-    def files(self):
-        """Files in this distribution.
-
-        :return: List of PackagePath for this distribution or None
-
-        Result is `None` if the metadata file that enumerates files
-        (i.e. RECORD for dist-info or SOURCES.txt for egg-info) is
-        missing.
-        Result may be empty if the metadata exists but is empty.
-        """
-        file_lines = self._read_files_distinfo() or self._read_files_egginfo()
-
-        def make_file(name, hash=None, size_str=None):
-            result = PackagePath(name)
-            result.hash = FileHash(hash) if hash else None
-            result.size = int(size_str) if size_str else None
-            result.dist = self
-            return result
-
-        return file_lines and list(starmap(make_file, csv.reader(file_lines)))
-
-    def _read_files_distinfo(self):
-        """
-        Read the lines of RECORD
-        """
-        text = self.read_text('RECORD')
-        return text and text.splitlines()
-
-    def _read_files_egginfo(self):
-        """
-        SOURCES.txt might contain literal commas, so wrap each line
-        in quotes.
-        """
-        text = self.read_text('SOURCES.txt')
-        return text and map('"{}"'.format, text.splitlines())
-
-    @property
-    def requires(self):
-        """Generated requirements specified for this Distribution"""
-        reqs = self._read_dist_info_reqs() or self._read_egg_info_reqs()
-        return reqs and list(reqs)
-
-    def _read_dist_info_reqs(self):
-        return self.metadata.get_all('Requires-Dist')
-
-    def _read_egg_info_reqs(self):
-        source = self.read_text('requires.txt')
-        return source and self._deps_from_requires_text(source)
-
-    @classmethod
-    def _deps_from_requires_text(cls, source):
-        section_pairs = cls._read_sections(source.splitlines())
-        sections = {
-            section: list(map(operator.itemgetter('line'), results))
-            for section, results in
-            itertools.groupby(section_pairs, operator.itemgetter('section'))
-            }
-        return cls._convert_egg_info_reqs_to_simple_reqs(sections)
-
-    @staticmethod
-    def _read_sections(lines):
-        section = None
-        for line in filter(None, lines):
-            section_match = re.match(r'\[(.*)\]$', line)
-            if section_match:
-                section = section_match.group(1)
-                continue
-            yield locals()
-
-    @staticmethod
-    def _convert_egg_info_reqs_to_simple_reqs(sections):
-        """
-        Historically, setuptools would solicit and store 'extra'
-        requirements, including those with environment markers,
-        in separate sections. More modern tools expect each
-        dependency to be defined separately, with any relevant
-        extras and environment markers attached directly to that
-        requirement. This method converts the former to the
-        latter. See _test_deps_from_requires_text for an example.
-        """
-        def make_condition(name):
-            return name and 'extra == "{name}"'.format(name=name)
-
-        def parse_condition(section):
-            section = section or ''
-            extra, sep, markers = section.partition(':')
-            if extra and markers:
-                markers = '({markers})'.format(markers=markers)
-            conditions = list(filter(None, [markers, make_condition(extra)]))
-            return '; ' + ' and '.join(conditions) if conditions else ''
-
-        for section, deps in sections.items():
-            for dep in deps:
-                yield dep + parse_condition(section)
-
-
-class DistributionFinder(MetaPathFinder):
-    """
-    A MetaPathFinder capable of discovering installed distributions.
-    """
-
-    class Context:
-        """
-        Keyword arguments presented by the caller to
-        ``distributions()`` or ``Distribution.discover()``
-        to narrow the scope of a search for distributions
-        in all DistributionFinders.
-
-        Each DistributionFinder may expect any parameters
-        and should attempt to honor the canonical
-        parameters defined below when appropriate.
-        """
-
-        name = None
-        """
-        Specific name for which a distribution finder should match.
-        A name of ``None`` matches all distributions.
-        """
-
-        def __init__(self, **kwargs):
-            vars(self).update(kwargs)
-
-        @property
-        def path(self):
-            """
-            The path that a distribution finder should search.
-
-            Typically refers to Python package paths and defaults
-            to ``sys.path``.
-            """
-            return vars(self).get('path', sys.path)
-
-    @abc.abstractmethod
-    def find_distributions(self, context=Context()):
-        """
-        Find distributions.
-
-        Return an iterable of all Distribution instances capable of
-        loading the metadata for packages matching the ``context``,
-        a DistributionFinder.Context instance.
-        """
-
-
-class FastPath:
-    """
-    Micro-optimized class for searching a path for
-    children.
-    """
-
-    def __init__(self, root):
-        self.root = root
-        self.base = os.path.basename(self.root).lower()
-
-    def joinpath(self, child):
-        return pathlib.Path(self.root, child)
-
-    def children(self):
-        with suppress(Exception):
-            return os.listdir(self.root or '')
-        with suppress(Exception):
-            return self.zip_children()
-        return []
-
-    def zip_children(self):
-        zip_path = zipfile.Path(self.root)
-        names = zip_path.root.namelist()
-        self.joinpath = zip_path.joinpath
-
-        return dict.fromkeys(
-            child.split(posixpath.sep, 1)[0]
-            for child in names
-            )
-
-    def is_egg(self, search):
-        base = self.base
-        return (
-            base == search.versionless_egg_name
-            or base.startswith(search.prefix)
-            and base.endswith('.egg'))
-
-    def search(self, name):
-        for child in self.children():
-            n_low = child.lower()
-            if (n_low in name.exact_matches
-                    or n_low.startswith(name.prefix)
-                    and n_low.endswith(name.suffixes)
-                    # legacy case:
-                    or self.is_egg(name) and n_low == 'egg-info'):
-                yield self.joinpath(child)
-
-
-class Prepared:
-    """
-    A prepared search for metadata on a possibly-named package.
-    """
-    normalized = ''
-    prefix = ''
-    suffixes = '.dist-info', '.egg-info'
-    exact_matches = [''][:0]
-    versionless_egg_name = ''
-
-    def __init__(self, name):
-        self.name = name
-        if name is None:
-            return
-        self.normalized = name.lower().replace('-', '_')
-        self.prefix = self.normalized + '-'
-        self.exact_matches = [
-            self.normalized + suffix for suffix in self.suffixes]
-        self.versionless_egg_name = self.normalized + '.egg'
-
-
-class MetadataPathFinder(DistributionFinder):
-    @classmethod
-    def find_distributions(cls, context=DistributionFinder.Context()):
-        """
-        Find distributions.
-
-        Return an iterable of all Distribution instances capable of
-        loading the metadata for packages matching ``context.name``
-        (or all names if ``None`` indicated) along the paths in the list
-        of directories ``context.path``.
-        """
-        found = cls._search_paths(context.name, context.path)
-        return map(PathDistribution, found)
-
-    @classmethod
-    def _search_paths(cls, name, paths):
-        """Find metadata directories in paths heuristically."""
-        return itertools.chain.from_iterable(
-            path.search(Prepared(name))
-            for path in map(FastPath, paths)
-            )
-
-
-class PathDistribution(Distribution):
-    def __init__(self, path):
-        """Construct a distribution from a path to the metadata directory.
-
-        :param path: A pathlib.Path or similar object supporting
-                     .joinpath(), __div__, .parent, and .read_text().
-        """
-        self._path = path
-
-    def read_text(self, filename):
-        with suppress(FileNotFoundError, IsADirectoryError, KeyError,
-                      NotADirectoryError, PermissionError):
-            return self._path.joinpath(filename).read_text(encoding='utf-8')
-    read_text.__doc__ = Distribution.read_text.__doc__
-
-    def locate_file(self, path):
-        return self._path.parent / path
-
-
-def distribution(distribution_name):
-    """Get the ``Distribution`` instance for the named package.
-
-    :param distribution_name: The name of the distribution package as a string.
-    :return: A ``Distribution`` instance (or subclass thereof).
-    """
-    return Distribution.from_name(distribution_name)
-
-
-def distributions(**kwargs):
-    """Get all ``Distribution`` instances in the current environment.
-
-    :return: An iterable of ``Distribution`` instances.
-    """
-    return Distribution.discover(**kwargs)
-
-
-def metadata(distribution_name):
-    """Get the metadata for the named package.
-
-    :param distribution_name: The name of the distribution package to query.
-    :return: An email.Message containing the parsed metadata.
-    """
-    return Distribution.from_name(distribution_name).metadata
-
-
-def version(distribution_name):
-    """Get the version string for the named package.
-
-    :param distribution_name: The name of the distribution package to query.
-    :return: The version string for the package as defined in the package's
-        "Version" metadata key.
-    """
-    return distribution(distribution_name).version
-
-
-def entry_points():
-    """Return EntryPoint objects for all installed packages.
-
-    :return: EntryPoint objects for all installed packages.
-    """
-    eps = itertools.chain.from_iterable(
-        dist.entry_points for dist in distributions())
-    by_group = operator.attrgetter('group')
-    ordered = sorted(eps, key=by_group)
-    grouped = itertools.groupby(ordered, by_group)
-    return {
-        group: tuple(eps)
-        for group, eps in grouped
-        }
-
-
-def files(distribution_name):
-    """Return a list of files for the named package.
-
-    :param distribution_name: The name of the distribution package to query.
-    :return: List of files composing the distribution.
-    """
-    return distribution(distribution_name).files
-
-
-def requires(distribution_name):
-    """
-    Return a list of requirements for the named package.
-
-    :return: An iterator of requirements, suitable for
-    packaging.requirement.Requirement.
-    """
-    return distribution(distribution_name).requires
diff --git a/Lib/importlib/metadata/__init__.py b/Lib/importlib/metadata/__init__.py
new file mode 100644
index 0000000..b3063cd
--- /dev/null
+++ b/Lib/importlib/metadata/__init__.py
@@ -0,0 +1,1045 @@
+import os
+import re
+import abc
+import csv
+import sys
+import email
+import pathlib
+import zipfile
+import operator
+import textwrap
+import warnings
+import functools
+import itertools
+import posixpath
+import collections
+
+from . import _adapters, _meta
+from ._meta import PackageMetadata
+from ._collections import FreezableDefaultDict, Pair
+from ._functools import method_cache
+from ._itertools import unique_everseen
+from ._meta import PackageMetadata, SimplePath
+
+from contextlib import suppress
+from importlib import import_module
+from importlib.abc import MetaPathFinder
+from itertools import starmap
+from typing import List, Mapping, Optional, Union
+
+
+__all__ = [
+    'Distribution',
+    'DistributionFinder',
+    'PackageMetadata',
+    'PackageNotFoundError',
+    'distribution',
+    'distributions',
+    'entry_points',
+    'files',
+    'metadata',
+    'packages_distributions',
+    'requires',
+    'version',
+]
+
+
+class PackageNotFoundError(ModuleNotFoundError):
+    """The package was not found."""
+
+    def __str__(self):
+        return f"No package metadata was found for {self.name}"
+
+    @property
+    def name(self):
+        (name,) = self.args
+        return name
+
+
+class Sectioned:
+    """
+    A simple entry point config parser for performance
+
+    >>> for item in Sectioned.read(Sectioned._sample):
+    ...     print(item)
+    Pair(name='sec1', value='# comments ignored')
+    Pair(name='sec1', value='a = 1')
+    Pair(name='sec1', value='b = 2')
+    Pair(name='sec2', value='a = 2')
+
+    >>> res = Sectioned.section_pairs(Sectioned._sample)
+    >>> item = next(res)
+    >>> item.name
+    'sec1'
+    >>> item.value
+    Pair(name='a', value='1')
+    >>> item = next(res)
+    >>> item.value
+    Pair(name='b', value='2')
+    >>> item = next(res)
+    >>> item.name
+    'sec2'
+    >>> item.value
+    Pair(name='a', value='2')
+    >>> list(res)
+    []
+    """
+
+    _sample = textwrap.dedent(
+        """
+        [sec1]
+        # comments ignored
+        a = 1
+        b = 2
+
+        [sec2]
+        a = 2
+        """
+    ).lstrip()
+
+    @classmethod
+    def section_pairs(cls, text):
+        return (
+            section._replace(value=Pair.parse(section.value))
+            for section in cls.read(text, filter_=cls.valid)
+            if section.name is not None
+        )
+
+    @staticmethod
+    def read(text, filter_=None):
+        lines = filter(filter_, map(str.strip, text.splitlines()))
+        name = None
+        for value in lines:
+            section_match = value.startswith('[') and value.endswith(']')
+            if section_match:
+                name = value.strip('[]')
+                continue
+            yield Pair(name, value)
+
+    @staticmethod
+    def valid(line):
+        return line and not line.startswith('#')
+
+
+class EntryPoint(
+        collections.namedtuple('EntryPointBase', 'name value group')):
+    """An entry point as defined by Python packaging conventions.
+
+    See `the packaging docs on entry points
+    <https://packaging.python.org/specifications/entry-points/>`_
+    for more information.
+
+    >>> ep = EntryPoint(
+    ...     name=None, group=None, value='package.module:attr [extra1, extra2]')
+    >>> ep.module
+    'package.module'
+    >>> ep.attr
+    'attr'
+    >>> ep.extras
+    ['extra1', 'extra2']
+    """
+
+    pattern = re.compile(
+        r'(?P<module>[\w.]+)\s*'
+        r'(:\s*(?P<attr>[\w.]+)\s*)?'
+        r'((?P<extras>\[.*\])\s*)?$'
+    )
+    """
+    A regular expression describing the syntax for an entry point,
+    which might look like:
+
+        - module
+        - package.module
+        - package.module:attribute
+        - package.module:object.attribute
+        - package.module:attr [extra1, extra2]
+
+    Other combinations are possible as well.
+
+    The expression is lenient about whitespace around the ':',
+    following the attr, and following any extras.
+    """
+
+    dist: Optional['Distribution'] = None
+
+    def load(self):
+        """Load the entry point from its definition. If only a module
+        is indicated by the value, return that module. Otherwise,
+        return the named object.
+        """
+        match = self.pattern.match(self.value)
+        module = import_module(match.group('module'))
+        attrs = filter(None, (match.group('attr') or '').split('.'))
+        return functools.reduce(getattr, attrs, module)
+
+    @property
+    def module(self):
+        match = self.pattern.match(self.value)
+        return match.group('module')
+
+    @property
+    def attr(self):
+        match = self.pattern.match(self.value)
+        return match.group('attr')
+
+    @property
+    def extras(self):
+        match = self.pattern.match(self.value)
+        return re.findall(r'\w+', match.group('extras') or '')
+
+    def _for(self, dist):
+        self.dist = dist
+        return self
+
+    def __iter__(self):
+        """
+        Supply iter so one may construct dicts of EntryPoints by name.
+        """
+        msg = (
+            "Construction of dict of EntryPoints is deprecated in "
+            "favor of EntryPoints."
+        )
+        warnings.warn(msg, DeprecationWarning)
+        return iter((self.name, self))
+
+    def __reduce__(self):
+        return (
+            self.__class__,
+            (self.name, self.value, self.group),
+        )
+
+    def matches(self, **params):
+        """
+        EntryPoint matches the given parameters.
+
+        >>> ep = EntryPoint(group='foo', name='bar', value='bing:bong [extra1, extra2]')
+        >>> ep.matches(group='foo')
+        True
+        >>> ep.matches(name='bar', value='bing:bong [extra1, extra2]')
+        True
+        >>> ep.matches(group='foo', name='other')
+        False
+        >>> ep.matches()
+        True
+        >>> ep.matches(extras=['extra1', 'extra2'])
+        True
+        >>> ep.matches(module='bing')
+        True
+        >>> ep.matches(attr='bong')
+        True
+        """
+        attrs = (getattr(self, param) for param in params)
+        return all(map(operator.eq, params.values(), attrs))
+
+
+class DeprecatedList(list):
+    """
+    Allow an otherwise immutable object to implement mutability
+    for compatibility.
+
+    >>> recwarn = getfixture('recwarn')
+    >>> dl = DeprecatedList(range(3))
+    >>> dl[0] = 1
+    >>> dl.append(3)
+    >>> del dl[3]
+    >>> dl.reverse()
+    >>> dl.sort()
+    >>> dl.extend([4])
+    >>> dl.pop(-1)
+    4
+    >>> dl.remove(1)
+    >>> dl += [5]
+    >>> dl + [6]
+    [1, 2, 5, 6]
+    >>> dl + (6,)
+    [1, 2, 5, 6]
+    >>> dl.insert(0, 0)
+    >>> dl
+    [0, 1, 2, 5]
+    >>> dl == [0, 1, 2, 5]
+    True
+    >>> dl == (0, 1, 2, 5)
+    True
+    >>> len(recwarn)
+    1
+    """
+
+    __slots__ = ()
+
+    _warn = functools.partial(
+        warnings.warn,
+        "EntryPoints list interface is deprecated. Cast to list if needed.",
+        DeprecationWarning,
+        stacklevel=2,
+    )
+
+    def __setitem__(self, *args, **kwargs):
+        self._warn()
+        return super().__setitem__(*args, **kwargs)
+
+    def __delitem__(self, *args, **kwargs):
+        self._warn()
+        return super().__delitem__(*args, **kwargs)
+
+    def append(self, *args, **kwargs):
+        self._warn()
+        return super().append(*args, **kwargs)
+
+    def reverse(self, *args, **kwargs):
+        self._warn()
+        return super().reverse(*args, **kwargs)
+
+    def extend(self, *args, **kwargs):
+        self._warn()
+        return super().extend(*args, **kwargs)
+
+    def pop(self, *args, **kwargs):
+        self._warn()
+        return super().pop(*args, **kwargs)
+
+    def remove(self, *args, **kwargs):
+        self._warn()
+        return super().remove(*args, **kwargs)
+
+    def __iadd__(self, *args, **kwargs):
+        self._warn()
+        return super().__iadd__(*args, **kwargs)
+
+    def __add__(self, other):
+        if not isinstance(other, tuple):
+            self._warn()
+            other = tuple(other)
+        return self.__class__(tuple(self) + other)
+
+    def insert(self, *args, **kwargs):
+        self._warn()
+        return super().insert(*args, **kwargs)
+
+    def sort(self, *args, **kwargs):
+        self._warn()
+        return super().sort(*args, **kwargs)
+
+    def __eq__(self, other):
+        if not isinstance(other, tuple):
+            self._warn()
+            other = tuple(other)
+
+        return tuple(self).__eq__(other)
+
+
+class EntryPoints(DeprecatedList):
+    """
+    An immutable collection of selectable EntryPoint objects.
+    """
+
+    __slots__ = ()
+
+    def __getitem__(self, name):  # -> EntryPoint:
+        """
+        Get the EntryPoint in self matching name.
+        """
+        if isinstance(name, int):
+            warnings.warn(
+                "Accessing entry points by index is deprecated. "
+                "Cast to tuple if needed.",
+                DeprecationWarning,
+                stacklevel=2,
+            )
+            return super().__getitem__(name)
+        try:
+            return next(iter(self.select(name=name)))
+        except StopIteration:
+            raise KeyError(name)
+
+    def select(self, **params):
+        """
+        Select entry points from self that match the
+        given parameters (typically group and/or name).
+        """
+        return EntryPoints(ep for ep in self if ep.matches(**params))
+
+    @property
+    def names(self):
+        """
+        Return the set of all names of all entry points.
+        """
+        return set(ep.name for ep in self)
+
+    @property
+    def groups(self):
+        """
+        Return the set of all groups of all entry points.
+
+        For coverage while SelectableGroups is present.
+        >>> EntryPoints().groups
+        set()
+        """
+        return set(ep.group for ep in self)
+
+    @classmethod
+    def _from_text_for(cls, text, dist):
+        return cls(ep._for(dist) for ep in cls._from_text(text))
+
+    @classmethod
+    def _from_text(cls, text):
+        return itertools.starmap(EntryPoint, cls._parse_groups(text or ''))
+
+    @staticmethod
+    def _parse_groups(text):
+        return (
+            (item.value.name, item.value.value, item.name)
+            for item in Sectioned.section_pairs(text)
+        )
+
+
+class Deprecated:
+    """
+    Compatibility add-in for mapping to indicate that
+    mapping behavior is deprecated.
+
+    >>> recwarn = getfixture('recwarn')
+    >>> class DeprecatedDict(Deprecated, dict): pass
+    >>> dd = DeprecatedDict(foo='bar')
+    >>> dd.get('baz', None)
+    >>> dd['foo']
+    'bar'
+    >>> list(dd)
+    ['foo']
+    >>> list(dd.keys())
+    ['foo']
+    >>> 'foo' in dd
+    True
+    >>> list(dd.values())
+    ['bar']
+    >>> len(recwarn)
+    1
+    """
+
+    _warn = functools.partial(
+        warnings.warn,
+        "SelectableGroups dict interface is deprecated. Use select.",
+        DeprecationWarning,
+        stacklevel=2,
+    )
+
+    def __getitem__(self, name):
+        self._warn()
+        return super().__getitem__(name)
+
+    def get(self, name, default=None):
+        self._warn()
+        return super().get(name, default)
+
+    def __iter__(self):
+        self._warn()
+        return super().__iter__()
+
+    def __contains__(self, *args):
+        self._warn()
+        return super().__contains__(*args)
+
+    def keys(self):
+        self._warn()
+        return super().keys()
+
+    def values(self):
+        self._warn()
+        return super().values()
+
+
+class SelectableGroups(Deprecated, dict):
+    """
+    A backward- and forward-compatible result from
+    entry_points that fully implements the dict interface.
+    """
+
+    @classmethod
+    def load(cls, eps):
+        by_group = operator.attrgetter('group')
+        ordered = sorted(eps, key=by_group)
+        grouped = itertools.groupby(ordered, by_group)
+        return cls((group, EntryPoints(eps)) for group, eps in grouped)
+
+    @property
+    def _all(self):
+        """
+        Reconstruct a list of all entrypoints from the groups.
+        """
+        groups = super(Deprecated, self).values()
+        return EntryPoints(itertools.chain.from_iterable(groups))
+
+    @property
+    def groups(self):
+        return self._all.groups
+
+    @property
+    def names(self):
+        """
+        for coverage:
+        >>> SelectableGroups().names
+        set()
+        """
+        return self._all.names
+
+    def select(self, **params):
+        if not params:
+            return self
+        return self._all.select(**params)
+
+
+class PackagePath(pathlib.PurePosixPath):
+    """A reference to a path in a package"""
+
+    def read_text(self, encoding='utf-8'):
+        with self.locate().open(encoding=encoding) as stream:
+            return stream.read()
+
+    def read_binary(self):
+        with self.locate().open('rb') as stream:
+            return stream.read()
+
+    def locate(self):
+        """Return a path-like object for this path"""
+        return self.dist.locate_file(self)
+
+
+class FileHash:
+    def __init__(self, spec):
+        self.mode, _, self.value = spec.partition('=')
+
+    def __repr__(self):
+        return f'<FileHash mode: {self.mode} value: {self.value}>'
+
+
+class Distribution:
+    """A Python distribution package."""
+
+    @abc.abstractmethod
+    def read_text(self, filename):
+        """Attempt to load metadata file given by the name.
+
+        :param filename: The name of the file in the distribution info.
+        :return: The text if found, otherwise None.
+        """
+
+    @abc.abstractmethod
+    def locate_file(self, path):
+        """
+        Given a path to a file in this distribution, return a path
+        to it.
+        """
+
+    @classmethod
+    def from_name(cls, name):
+        """Return the Distribution for the given package name.
+
+        :param name: The name of the distribution package to search for.
+        :return: The Distribution instance (or subclass thereof) for the named
+            package, if found.
+        :raises PackageNotFoundError: When the named package's distribution
+            metadata cannot be found.
+        """
+        for resolver in cls._discover_resolvers():
+            dists = resolver(DistributionFinder.Context(name=name))
+            dist = next(iter(dists), None)
+            if dist is not None:
+                return dist
+        else:
+            raise PackageNotFoundError(name)
+
+    @classmethod
+    def discover(cls, **kwargs):
+        """Return an iterable of Distribution objects for all packages.
+
+        Pass a ``context`` or pass keyword arguments for constructing
+        a context.
+
+        :context: A ``DistributionFinder.Context`` object.
+        :return: Iterable of Distribution objects for all packages.
+        """
+        context = kwargs.pop('context', None)
+        if context and kwargs:
+            raise ValueError("cannot accept context and kwargs")
+        context = context or DistributionFinder.Context(**kwargs)
+        return itertools.chain.from_iterable(
+            resolver(context) for resolver in cls._discover_resolvers()
+        )
+
+    @staticmethod
+    def at(path):
+        """Return a Distribution for the indicated metadata path
+
+        :param path: a string or path-like object
+        :return: a concrete Distribution instance for the path
+        """
+        return PathDistribution(pathlib.Path(path))
+
+    @staticmethod
+    def _discover_resolvers():
+        """Search the meta_path for resolvers."""
+        declared = (
+            getattr(finder, 'find_distributions', None) for finder in sys.meta_path
+        )
+        return filter(None, declared)
+
+    @classmethod
+    def _local(cls, root='.'):
+        from pep517 import build, meta
+
+        system = build.compat_system(root)
+        builder = functools.partial(
+            meta.build,
+            source_dir=root,
+            system=system,
+        )
+        return PathDistribution(zipfile.Path(meta.build_as_zip(builder)))
+
+    @property
+    def metadata(self) -> _meta.PackageMetadata:
+        """Return the parsed metadata for this Distribution.
+
+        The returned object will have keys that name the various bits of
+        metadata.  See PEP 566 for details.
+        """
+        text = (
+            self.read_text('METADATA')
+            or self.read_text('PKG-INFO')
+            # This last clause is here to support old egg-info files.  Its
+            # effect is to just end up using the PathDistribution's self._path
+            # (which points to the egg-info file) attribute unchanged.
+            or self.read_text('')
+        )
+        return _adapters.Message(email.message_from_string(text))
+
+    @property
+    def name(self):
+        """Return the 'Name' metadata for the distribution package."""
+        return self.metadata['Name']
+
+    @property
+    def _normalized_name(self):
+        """Return a normalized version of the name."""
+        return Prepared.normalize(self.name)
+
+    @property
+    def version(self):
+        """Return the 'Version' metadata for the distribution package."""
+        return self.metadata['Version']
+
+    @property
+    def entry_points(self):
+        return EntryPoints._from_text_for(self.read_text('entry_points.txt'), self)
+
+    @property
+    def files(self):
+        """Files in this distribution.
+
+        :return: List of PackagePath for this distribution or None
+
+        Result is `None` if the metadata file that enumerates files
+        (i.e. RECORD for dist-info or SOURCES.txt for egg-info) is
+        missing.
+        Result may be empty if the metadata exists but is empty.
+        """
+        file_lines = self._read_files_distinfo() or self._read_files_egginfo()
+
+        def make_file(name, hash=None, size_str=None):
+            result = PackagePath(name)
+            result.hash = FileHash(hash) if hash else None
+            result.size = int(size_str) if size_str else None
+            result.dist = self
+            return result
+
+        return file_lines and list(starmap(make_file, csv.reader(file_lines)))
+
+    def _read_files_distinfo(self):
+        """
+        Read the lines of RECORD
+        """
+        text = self.read_text('RECORD')
+        return text and text.splitlines()
+
+    def _read_files_egginfo(self):
+        """
+        SOURCES.txt might contain literal commas, so wrap each line
+        in quotes.
+        """
+        text = self.read_text('SOURCES.txt')
+        return text and map('"{}"'.format, text.splitlines())
+
+    @property
+    def requires(self):
+        """Generated requirements specified for this Distribution"""
+        reqs = self._read_dist_info_reqs() or self._read_egg_info_reqs()
+        return reqs and list(reqs)
+
+    def _read_dist_info_reqs(self):
+        return self.metadata.get_all('Requires-Dist')
+
+    def _read_egg_info_reqs(self):
+        source = self.read_text('requires.txt')
+        return None if source is None else self._deps_from_requires_text(source)
+
+    @classmethod
+    def _deps_from_requires_text(cls, source):
+        return cls._convert_egg_info_reqs_to_simple_reqs(Sectioned.read(source))
+
+    @staticmethod
+    def _convert_egg_info_reqs_to_simple_reqs(sections):
+        """
+        Historically, setuptools would solicit and store 'extra'
+        requirements, including those with environment markers,
+        in separate sections. More modern tools expect each
+        dependency to be defined separately, with any relevant
+        extras and environment markers attached directly to that
+        requirement. This method converts the former to the
+        latter. See _test_deps_from_requires_text for an example.
+        """
+
+        def make_condition(name):
+            return name and f'extra == "{name}"'
+
+        def quoted_marker(section):
+            section = section or ''
+            extra, sep, markers = section.partition(':')
+            if extra and markers:
+                markers = f'({markers})'
+            conditions = list(filter(None, [markers, make_condition(extra)]))
+            return '; ' + ' and '.join(conditions) if conditions else ''
+
+        def url_req_space(req):
+            """
+            PEP 508 requires a space between the url_spec and the quoted_marker.
+            Ref python/importlib_metadata#357.
+            """
+            # '@' is uniquely indicative of a url_req.
+            return ' ' * ('@' in req)
+
+        for section in sections:
+            space = url_req_space(section.value)
+            yield section.value + space + quoted_marker(section.name)
+
+
+class DistributionFinder(MetaPathFinder):
+    """
+    A MetaPathFinder capable of discovering installed distributions.
+    """
+
+    class Context:
+        """
+        Keyword arguments presented by the caller to
+        ``distributions()`` or ``Distribution.discover()``
+        to narrow the scope of a search for distributions
+        in all DistributionFinders.
+
+        Each DistributionFinder may expect any parameters
+        and should attempt to honor the canonical
+        parameters defined below when appropriate.
+        """
+
+        name = None
+        """
+        Specific name for which a distribution finder should match.
+        A name of ``None`` matches all distributions.
+        """
+
+        def __init__(self, **kwargs):
+            vars(self).update(kwargs)
+
+        @property
+        def path(self):
+            """
+            The sequence of directory path that a distribution finder
+            should search.
+
+            Typically refers to Python installed package paths such as
+            "site-packages" directories and defaults to ``sys.path``.
+            """
+            return vars(self).get('path', sys.path)
+
+    @abc.abstractmethod
+    def find_distributions(self, context=Context()):
+        """
+        Find distributions.
+
+        Return an iterable of all Distribution instances capable of
+        loading the metadata for packages matching the ``context``,
+        a DistributionFinder.Context instance.
+        """
+
+
+class FastPath:
+    """
+    Micro-optimized class for searching a path for
+    children.
+    """
+
+    @functools.lru_cache()  # type: ignore
+    def __new__(cls, root):
+        return super().__new__(cls)
+
+    def __init__(self, root):
+        self.root = root
+
+    def joinpath(self, child):
+        return pathlib.Path(self.root, child)
+
+    def children(self):
+        with suppress(Exception):
+            return os.listdir(self.root or '.')
+        with suppress(Exception):
+            return self.zip_children()
+        return []
+
+    def zip_children(self):
+        zip_path = zipfile.Path(self.root)
+        names = zip_path.root.namelist()
+        self.joinpath = zip_path.joinpath
+
+        return dict.fromkeys(child.split(posixpath.sep, 1)[0] for child in names)
+
+    def search(self, name):
+        return self.lookup(self.mtime).search(name)
+
+    @property
+    def mtime(self):
+        with suppress(OSError):
+            return os.stat(self.root).st_mtime
+        self.lookup.cache_clear()
+
+    @method_cache
+    def lookup(self, mtime):
+        return Lookup(self)
+
+
+class Lookup:
+    def __init__(self, path: FastPath):
+        base = os.path.basename(path.root).lower()
+        base_is_egg = base.endswith(".egg")
+        self.infos = FreezableDefaultDict(list)
+        self.eggs = FreezableDefaultDict(list)
+
+        for child in path.children():
+            low = child.lower()
+            if low.endswith((".dist-info", ".egg-info")):
+                # rpartition is faster than splitext and suitable for this purpose.
+                name = low.rpartition(".")[0].partition("-")[0]
+                normalized = Prepared.normalize(name)
+                self.infos[normalized].append(path.joinpath(child))
+            elif base_is_egg and low == "egg-info":
+                name = base.rpartition(".")[0].partition("-")[0]
+                legacy_normalized = Prepared.legacy_normalize(name)
+                self.eggs[legacy_normalized].append(path.joinpath(child))
+
+        self.infos.freeze()
+        self.eggs.freeze()
+
+    def search(self, prepared):
+        infos = (
+            self.infos[prepared.normalized]
+            if prepared
+            else itertools.chain.from_iterable(self.infos.values())
+        )
+        eggs = (
+            self.eggs[prepared.legacy_normalized]
+            if prepared
+            else itertools.chain.from_iterable(self.eggs.values())
+        )
+        return itertools.chain(infos, eggs)
+
+
+class Prepared:
+    """
+    A prepared search for metadata on a possibly-named package.
+    """
+
+    normalized = None
+    legacy_normalized = None
+
+    def __init__(self, name):
+        self.name = name
+        if name is None:
+            return
+        self.normalized = self.normalize(name)
+        self.legacy_normalized = self.legacy_normalize(name)
+
+    @staticmethod
+    def normalize(name):
+        """
+        PEP 503 normalization plus dashes as underscores.
+        """
+        return re.sub(r"[-_.]+", "-", name).lower().replace('-', '_')
+
+    @staticmethod
+    def legacy_normalize(name):
+        """
+        Normalize the package name as found in the convention in
+        older packaging tools versions and specs.
+        """
+        return name.lower().replace('-', '_')
+
+    def __bool__(self):
+        return bool(self.name)
+
+
+class MetadataPathFinder(DistributionFinder):
+    @classmethod
+    def find_distributions(cls, context=DistributionFinder.Context()):
+        """
+        Find distributions.
+
+        Return an iterable of all Distribution instances capable of
+        loading the metadata for packages matching ``context.name``
+        (or all names if ``None`` indicated) along the paths in the list
+        of directories ``context.path``.
+        """
+        found = cls._search_paths(context.name, context.path)
+        return map(PathDistribution, found)
+
+    @classmethod
+    def _search_paths(cls, name, paths):
+        """Find metadata directories in paths heuristically."""
+        prepared = Prepared(name)
+        return itertools.chain.from_iterable(
+            path.search(prepared) for path in map(FastPath, paths)
+        )
+
+    def invalidate_caches(cls):
+        FastPath.__new__.cache_clear()
+
+
+class PathDistribution(Distribution):
+    def __init__(self, path: SimplePath):
+        """Construct a distribution.
+
+        :param path: SimplePath indicating the metadata directory.
+        """
+        self._path = path
+
+    def read_text(self, filename):
+        with suppress(
+            FileNotFoundError,
+            IsADirectoryError,
+            KeyError,
+            NotADirectoryError,
+            PermissionError,
+        ):
+            return self._path.joinpath(filename).read_text(encoding='utf-8')
+
+    read_text.__doc__ = Distribution.read_text.__doc__
+
+    def locate_file(self, path):
+        return self._path.parent / path
+
+    @property
+    def _normalized_name(self):
+        """
+        Performance optimization: where possible, resolve the
+        normalized name from the file system path.
+        """
+        stem = os.path.basename(str(self._path))
+        return self._name_from_stem(stem) or super()._normalized_name
+
+    def _name_from_stem(self, stem):
+        name, ext = os.path.splitext(stem)
+        if ext not in ('.dist-info', '.egg-info'):
+            return
+        name, sep, rest = stem.partition('-')
+        return name
+
+
+def distribution(distribution_name):
+    """Get the ``Distribution`` instance for the named package.
+
+    :param distribution_name: The name of the distribution package as a string.
+    :return: A ``Distribution`` instance (or subclass thereof).
+    """
+    return Distribution.from_name(distribution_name)
+
+
+def distributions(**kwargs):
+    """Get all ``Distribution`` instances in the current environment.
+
+    :return: An iterable of ``Distribution`` instances.
+    """
+    return Distribution.discover(**kwargs)
+
+
+def metadata(distribution_name) -> _meta.PackageMetadata:
+    """Get the metadata for the named package.
+
+    :param distribution_name: The name of the distribution package to query.
+    :return: A PackageMetadata containing the parsed metadata.
+    """
+    return Distribution.from_name(distribution_name).metadata
+
+
+def version(distribution_name):
+    """Get the version string for the named package.
+
+    :param distribution_name: The name of the distribution package to query.
+    :return: The version string for the package as defined in the package's
+        "Version" metadata key.
+    """
+    return distribution(distribution_name).version
+
+
+def entry_points(**params) -> Union[EntryPoints, SelectableGroups]:
+    """Return EntryPoint objects for all installed packages.
+
+    Pass selection parameters (group or name) to filter the
+    result to entry points matching those properties (see
+    EntryPoints.select()).
+
+    For compatibility, returns ``SelectableGroups`` object unless
+    selection parameters are supplied. In the future, this function
+    will return ``EntryPoints`` instead of ``SelectableGroups``
+    even when no selection parameters are supplied.
+
+    For maximum future compatibility, pass selection parameters
+    or invoke ``.select`` with parameters on the result.
+
+    :return: EntryPoints or SelectableGroups for all installed packages.
+    """
+    norm_name = operator.attrgetter('_normalized_name')
+    unique = functools.partial(unique_everseen, key=norm_name)
+    eps = itertools.chain.from_iterable(
+        dist.entry_points for dist in unique(distributions())
+    )
+    return SelectableGroups.load(eps).select(**params)
+
+
+def files(distribution_name):
+    """Return a list of files for the named package.
+
+    :param distribution_name: The name of the distribution package to query.
+    :return: List of files composing the distribution.
+    """
+    return distribution(distribution_name).files
+
+
+def requires(distribution_name):
+    """
+    Return a list of requirements for the named package.
+
+    :return: An iterator of requirements, suitable for
+        packaging.requirement.Requirement.
+    """
+    return distribution(distribution_name).requires
+
+
+def packages_distributions() -> Mapping[str, List[str]]:
+    """
+    Return a mapping of top-level packages to their
+    distributions.
+
+    >>> import collections.abc
+    >>> pkgs = packages_distributions()
+    >>> all(isinstance(dist, collections.abc.Sequence) for dist in pkgs.values())
+    True
+    """
+    pkg_to_dist = collections.defaultdict(list)
+    for dist in distributions():
+        for pkg in (dist.read_text('top_level.txt') or '').split():
+            pkg_to_dist[pkg].append(dist.metadata['Name'])
+    return dict(pkg_to_dist)
diff --git a/Lib/importlib/metadata/_adapters.py b/Lib/importlib/metadata/_adapters.py
new file mode 100644
index 0000000..aa460d3
--- /dev/null
+++ b/Lib/importlib/metadata/_adapters.py
@@ -0,0 +1,68 @@
+import re
+import textwrap
+import email.message
+
+from ._text import FoldedCase
+
+
+class Message(email.message.Message):
+    multiple_use_keys = set(
+        map(
+            FoldedCase,
+            [
+                'Classifier',
+                'Obsoletes-Dist',
+                'Platform',
+                'Project-URL',
+                'Provides-Dist',
+                'Provides-Extra',
+                'Requires-Dist',
+                'Requires-External',
+                'Supported-Platform',
+                'Dynamic',
+            ],
+        )
+    )
+    """
+    Keys that may be indicated multiple times per PEP 566.
+    """
+
+    def __new__(cls, orig: email.message.Message):
+        res = super().__new__(cls)
+        vars(res).update(vars(orig))
+        return res
+
+    def __init__(self, *args, **kwargs):
+        self._headers = self._repair_headers()
+
+    # suppress spurious error from mypy
+    def __iter__(self):
+        return super().__iter__()
+
+    def _repair_headers(self):
+        def redent(value):
+            "Correct for RFC822 indentation"
+            if not value or '\n' not in value:
+                return value
+            return textwrap.dedent(' ' * 8 + value)
+
+        headers = [(key, redent(value)) for key, value in vars(self)['_headers']]
+        if self._payload:
+            headers.append(('Description', self.get_payload()))
+        return headers
+
+    @property
+    def json(self):
+        """
+        Convert PackageMetadata to a JSON-compatible format
+        per PEP 0566.
+        """
+
+        def transform(key):
+            value = self.get_all(key) if key in self.multiple_use_keys else self[key]
+            if key == 'Keywords':
+                value = re.split(r'\s+', value)
+            tk = key.lower().replace('-', '_')
+            return tk, value
+
+        return dict(map(transform, map(FoldedCase, self)))
diff --git a/Lib/importlib/metadata/_collections.py b/Lib/importlib/metadata/_collections.py
new file mode 100644
index 0000000..cf0954e
--- /dev/null
+++ b/Lib/importlib/metadata/_collections.py
@@ -0,0 +1,30 @@
+import collections
+
+
+# from jaraco.collections 3.3
+class FreezableDefaultDict(collections.defaultdict):
+    """
+    Often it is desirable to prevent the mutation of
+    a default dict after its initial construction, such
+    as to prevent mutation during iteration.
+
+    >>> dd = FreezableDefaultDict(list)
+    >>> dd[0].append('1')
+    >>> dd.freeze()
+    >>> dd[1]
+    []
+    >>> len(dd)
+    1
+    """
+
+    def __missing__(self, key):
+        return getattr(self, '_frozen', super().__missing__)(key)
+
+    def freeze(self):
+        self._frozen = lambda key: self.default_factory()
+
+
+class Pair(collections.namedtuple('Pair', 'name value')):
+    @classmethod
+    def parse(cls, text):
+        return cls(*map(str.strip, text.split("=", 1)))
diff --git a/Lib/importlib/metadata/_functools.py b/Lib/importlib/metadata/_functools.py
new file mode 100644
index 0000000..73f50d0
--- /dev/null
+++ b/Lib/importlib/metadata/_functools.py
@@ -0,0 +1,85 @@
+import types
+import functools
+
+
+# from jaraco.functools 3.3
+def method_cache(method, cache_wrapper=None):
+    """
+    Wrap lru_cache to support storing the cache data in the object instances.
+
+    Abstracts the common paradigm where the method explicitly saves an
+    underscore-prefixed protected property on first call and returns that
+    subsequently.
+
+    >>> class MyClass:
+    ...     calls = 0
+    ...
+    ...     @method_cache
+    ...     def method(self, value):
+    ...         self.calls += 1
+    ...         return value
+
+    >>> a = MyClass()
+    >>> a.method(3)
+    3
+    >>> for x in range(75):
+    ...     res = a.method(x)
+    >>> a.calls
+    75
+
+    Note that the apparent behavior will be exactly like that of lru_cache
+    except that the cache is stored on each instance, so values in one
+    instance will not flush values from another, and when an instance is
+    deleted, so are the cached values for that instance.
+
+    >>> b = MyClass()
+    >>> for x in range(35):
+    ...     res = b.method(x)
+    >>> b.calls
+    35
+    >>> a.method(0)
+    0
+    >>> a.calls
+    75
+
+    Note that if method had been decorated with ``functools.lru_cache()``,
+    a.calls would have been 76 (due to the cached value of 0 having been
+    flushed by the 'b' instance).
+
+    Clear the cache with ``.cache_clear()``
+
+    >>> a.method.cache_clear()
+
+    Same for a method that hasn't yet been called.
+
+    >>> c = MyClass()
+    >>> c.method.cache_clear()
+
+    Another cache wrapper may be supplied:
+
+    >>> cache = functools.lru_cache(maxsize=2)
+    >>> MyClass.method2 = method_cache(lambda self: 3, cache_wrapper=cache)
+    >>> a = MyClass()
+    >>> a.method2()
+    3
+
+    Caution - do not subsequently wrap the method with another decorator, such
+    as ``@property``, which changes the semantics of the function.
+
+    See also
+    http://code.activestate.com/recipes/577452-a-memoize-decorator-for-instance-methods/
+    for another implementation and additional justification.
+    """
+    cache_wrapper = cache_wrapper or functools.lru_cache()
+
+    def wrapper(self, *args, **kwargs):
+        # it's the first call, replace the method with a cached, bound method
+        bound_method = types.MethodType(method, self)
+        cached_method = cache_wrapper(bound_method)
+        setattr(self, method.__name__, cached_method)
+        return cached_method(*args, **kwargs)
+
+    # Support cache clear even before cache has been created.
+    wrapper.cache_clear = lambda: None
+
+    return wrapper
diff --git a/Lib/importlib/metadata/_itertools.py b/Lib/importlib/metadata/_itertools.py
new file mode 100644
index 0000000..dd45f2f
--- /dev/null
+++ b/Lib/importlib/metadata/_itertools.py
@@ -0,0 +1,19 @@
+from itertools import filterfalse
+
+
+def unique_everseen(iterable, key=None):
+    "List unique elements, preserving order. Remember all elements ever seen."
+    # unique_everseen('AAAABBBCCDAABBB') --> A B C D
+    # unique_everseen('ABBCcAD', str.lower) --> A B C D
+    seen = set()
+    seen_add = seen.add
+    if key is None:
+        for element in filterfalse(seen.__contains__, iterable):
+            seen_add(element)
+            yield element
+    else:
+        for element in iterable:
+            k = key(element)
+            if k not in seen:
+                seen_add(k)
+                yield element
diff --git a/Lib/importlib/metadata/_meta.py b/Lib/importlib/metadata/_meta.py
new file mode 100644
index 0000000..1a6edbf
--- /dev/null
+++ b/Lib/importlib/metadata/_meta.py
@@ -0,0 +1,47 @@
+from typing import Any, Dict, Iterator, List, Protocol, TypeVar, Union
+
+
+_T = TypeVar("_T")
+
+
+class PackageMetadata(Protocol):
+    def __len__(self) -> int:
+        ...  # pragma: no cover
+
+    def __contains__(self, item: str) -> bool:
+        ...  # pragma: no cover
+
+    def __getitem__(self, key: str) -> str:
+        ...  # pragma: no cover
+
+    def __iter__(self) -> Iterator[str]:
+        ...  # pragma: no cover
+
+    def get_all(self, name: str, failobj: _T = ...) -> Union[List[Any], _T]:
+        """
+        Return all values associated with a possibly multi-valued key.
+        """
+
+    @property
+    def json(self) -> Dict[str, Union[str, List[str]]]:
+        """
+        A JSON-compatible form of the metadata.
+        """
+
+
+class SimplePath(Protocol):
+    """
+    A minimal subset of pathlib.Path required by PathDistribution.
+    """
+
+    def joinpath(self) -> 'SimplePath':
+        ...  # pragma: no cover
+
+    def __div__(self) -> 'SimplePath':
+        ...  # pragma: no cover
+
+    def parent(self) -> 'SimplePath':
+        ...  # pragma: no cover
+
+    def read_text(self) -> str:
+        ...  # pragma: no cover
diff --git a/Lib/importlib/metadata/_text.py b/Lib/importlib/metadata/_text.py
new file mode 100644
index 0000000..766979d
--- /dev/null
+++ b/Lib/importlib/metadata/_text.py
@@ -0,0 +1,99 @@
+import re
+
+from ._functools import method_cache
+
+
+# from jaraco.text 3.5
+class FoldedCase(str):
+    """
+    A case insensitive string class; behaves just like str
+    except compares equal when the only variation is case.
+
+    >>> s = FoldedCase('hello world')
+
+    >>> s == 'Hello World'
+    True
+
+    >>> 'Hello World' == s
+    True
+
+    >>> s != 'Hello World'
+    False
+
+    >>> s.index('O')
+    4
+
+    >>> s.split('O')
+    ['hell', ' w', 'rld']
+
+    >>> sorted(map(FoldedCase, ['GAMMA', 'alpha', 'Beta']))
+    ['alpha', 'Beta', 'GAMMA']
+
+    Sequence membership is straightforward.
+
+    >>> "Hello World" in [s]
+    True
+    >>> s in ["Hello World"]
+    True
+
+    You may test for set inclusion, but candidate and elements
+    must both be folded.
+
+    >>> FoldedCase("Hello World") in {s}
+    True
+    >>> s in {FoldedCase("Hello World")}
+    True
+
+    String inclusion works as long as the FoldedCase object
+    is on the right.
+
+    >>> "hello" in FoldedCase("Hello World")
+    True
+
+    But not if the FoldedCase object is on the left:
+
+    >>> FoldedCase('hello') in 'Hello World'
+    False
+
+    In that case, use in_:
+
+    >>> FoldedCase('hello').in_('Hello World')
+    True
+
+    >>> FoldedCase('hello') > FoldedCase('Hello')
+    False
+    """
+
+    def __lt__(self, other):
+        return self.lower() < other.lower()
+
+    def __gt__(self, other):
+        return self.lower() > other.lower()
+
+    def __eq__(self, other):
+        return self.lower() == other.lower()
+
+    def __ne__(self, other):
+        return self.lower() != other.lower()
+
+    def __hash__(self):
+        return hash(self.lower())
+
+    def __contains__(self, other):
+        return super(FoldedCase, self).lower().__contains__(other.lower())
+
+    def in_(self, other):
+        "Does self appear in other?"
+        return self in FoldedCase(other)
+
+    # cache lower since it's likely to be called frequently.
+    @method_cache
+    def lower(self):
+        return super(FoldedCase, self).lower()
+
+    def index(self, sub):
+        return self.lower().index(sub.lower())
+
+    def split(self, splitter=' ', maxsplit=0):
+        pattern = re.compile(re.escape(splitter), re.I)
+        return pattern.split(self, maxsplit)
diff --git a/Lib/importlib/readers.py b/Lib/importlib/readers.py
new file mode 100644
index 0000000..41089c0
--- /dev/null
+++ b/Lib/importlib/readers.py
@@ -0,0 +1,123 @@
+import collections
+import zipfile
+import pathlib
+from . import abc
+
+
+def remove_duplicates(items):
+    return iter(collections.OrderedDict.fromkeys(items))
+
+
+class FileReader(abc.TraversableResources):
+    def __init__(self, loader):
+        self.path = pathlib.Path(loader.path).parent
+
+    def resource_path(self, resource):
+        """
+        Return the file system path to prevent
+        `resources.path()` from creating a temporary
+        copy.
+        """
+        return str(self.path.joinpath(resource))
+
+    def files(self):
+        return self.path
+
+
+class ZipReader(abc.TraversableResources):
+    def __init__(self, loader, module):
+        _, _, name = module.rpartition('.')
+        self.prefix = loader.prefix.replace('\\', '/') + name + '/'
+        self.archive = loader.archive
+
+    def open_resource(self, resource):
+        try:
+            return super().open_resource(resource)
+        except KeyError as exc:
+            raise FileNotFoundError(exc.args[0])
+
+    def is_resource(self, path):
+        # workaround for `zipfile.Path.is_file` returning true
+        # for non-existent paths.
+        target = self.files().joinpath(path)
+        return target.is_file() and target.exists()
+
+    def files(self):
+        return zipfile.Path(self.archive, self.prefix)
+
+
+class MultiplexedPath(abc.Traversable):
+    """
+    Given a series of Traversable objects, implement a merged
+    version of the interface across all objects. Useful for
+    namespace packages which may be multihomed at a single
+    name.
+    """
+
+    def __init__(self, *paths):
+        self._paths = list(map(pathlib.Path, remove_duplicates(paths)))
+        if not self._paths:
+            message = 'MultiplexedPath must contain at least one path'
+            raise FileNotFoundError(message)
+        if not all(path.is_dir() for path in self._paths):
+            raise NotADirectoryError('MultiplexedPath only supports directories')
+
+    def iterdir(self):
+        visited = []
+        for path in self._paths:
+            for file in path.iterdir():
+                if file.name in visited:
+                    continue
+                visited.append(file.name)
+                yield file
+
+    def read_bytes(self):
+        raise FileNotFoundError(f'{self} is not a file')
+
+    def read_text(self, *args, **kwargs):
+        raise FileNotFoundError(f'{self} is not a file')
+
+    def is_dir(self):
+        return True
+
+    def is_file(self):
+        return False
+
+    def joinpath(self, child):
+        # first try to find child in current paths
+        for file in self.iterdir():
+            if file.name == child:
+                return file
+        # if it does not exist, construct it with the first path
+        return self._paths[0] / child
+
+    __truediv__ = joinpath
+
+    def open(self, *args, **kwargs):
+        raise FileNotFoundError(f'{self} is not a file')
+
+    @property
+    def name(self):
+        return self._paths[0].name
+
+    def __repr__(self):
+        paths = ', '.join(f"'{path}'" for path in self._paths)
+        return f'MultiplexedPath({paths})'
+
+
+class NamespaceReader(abc.TraversableResources):
+    def __init__(self, namespace_path):
+        if 'NamespacePath' not in str(namespace_path):
+            raise ValueError('Invalid path')
+        self.path = MultiplexedPath(*list(namespace_path))
+
+    def resource_path(self, resource):
+        """
+        Return the file system path to prevent
+        `resources.path()` from creating a temporary
+        copy.
+        """
+        return str(self.path.joinpath(resource))
+
+    def files(self):
+        return self.path
diff --git a/Lib/importlib/resources.py b/Lib/importlib/resources.py
index b803a01..8a98663 100644
--- a/Lib/importlib/resources.py
+++ b/Lib/importlib/resources.py
@@ -1,22 +1,26 @@
 import os
+import io
 
-from . import abc as resources_abc
 from . import _common
-from ._common import as_file
-from contextlib import contextmanager, suppress
-from importlib import import_module
+from ._common import as_file, files
+from .abc import ResourceReader
+from contextlib import suppress
 from importlib.abc import ResourceLoader
+from importlib.machinery import ModuleSpec
 from io import BytesIO, TextIOWrapper
 from pathlib import Path
 from types import ModuleType
-from typing import ContextManager, Iterable, Optional, Union
+from typing import ContextManager, Iterable, Union
 from typing import cast
 from typing.io import BinaryIO, TextIO
+from collections.abc import Sequence
+from functools import singledispatch
 
 
 __all__ = [
     'Package',
     'Resource',
+    'ResourceReader',
     'as_file',
     'contents',
     'files',
@@ -26,99 +30,57 @@
     'path',
     'read_binary',
     'read_text',
-    ]
+]
 
 
 Package = Union[str, ModuleType]
 Resource = Union[str, os.PathLike]
 
 
-def _resolve(name) -> ModuleType:
-    """If name is a string, resolve to a module."""
-    if hasattr(name, '__spec__'):
-        return name
-    return import_module(name)
-
-
-def _get_package(package) -> ModuleType:
-    """Take a package name or module object and return the module.
-
-    If a name, the module is imported.  If the resolved module
-    object is not a package, raise an exception.
-    """
-    module = _resolve(package)
-    if module.__spec__.submodule_search_locations is None:
-        raise TypeError('{!r} is not a package'.format(package))
-    return module
-
-
-def _normalize_path(path) -> str:
-    """Normalize a path by ensuring it is a string.
-
-    If the resulting string contains path separators, an exception is raised.
-    """
-    parent, file_name = os.path.split(path)
-    if parent:
-        raise ValueError('{!r} must be only a file name'.format(path))
-    return file_name
-
-
-def _get_resource_reader(
-        package: ModuleType) -> Optional[resources_abc.ResourceReader]:
-    # Return the package's loader if it's a ResourceReader.  We can't use
-    # a issubclass() check here because apparently abc.'s __subclasscheck__()
-    # hook wants to create a weak reference to the object, but
-    # zipimport.zipimporter does not support weak references, resulting in a
-    # TypeError.  That seems terrible.
-    spec = package.__spec__
-    if hasattr(spec.loader, 'get_resource_reader'):
-        return cast(resources_abc.ResourceReader,
-                    spec.loader.get_resource_reader(spec.name))
-    return None
-
-
-def _check_location(package):
-    if package.__spec__.origin is None or not package.__spec__.has_location:
-        raise FileNotFoundError(f'Package has no location {package!r}')
-
-
 def open_binary(package: Package, resource: Resource) -> BinaryIO:
     """Return a file-like object opened for binary reading of the resource."""
-    resource = _normalize_path(resource)
-    package = _get_package(package)
-    reader = _get_resource_reader(package)
+    resource = _common.normalize_path(resource)
+    package = _common.get_package(package)
+    reader = _common.get_resource_reader(package)
     if reader is not None:
         return reader.open_resource(resource)
-    absolute_package_path = os.path.abspath(
-        package.__spec__.origin or 'non-existent file')
-    package_path = os.path.dirname(absolute_package_path)
-    full_path = os.path.join(package_path, resource)
-    try:
-        return open(full_path, mode='rb')
-    except OSError:
-        # Just assume the loader is a resource loader; all the relevant
-        # importlib.machinery loaders are and an AttributeError for
-        # get_data() will make it clear what is needed from the loader.
-        loader = cast(ResourceLoader, package.__spec__.loader)
-        data = None
-        if hasattr(package.__spec__.loader, 'get_data'):
-            with suppress(OSError):
-                data = loader.get_data(full_path)
-        if data is None:
-            package_name = package.__spec__.name
-            message = '{!r} resource not found in {!r}'.format(
-                resource, package_name)
-            raise FileNotFoundError(message)
-        return BytesIO(data)
+    spec = cast(ModuleSpec, package.__spec__)
+    # Using pathlib doesn't work well here due to the lack of 'strict'
+    # argument for pathlib.Path.resolve() prior to Python 3.6.
+    if spec.submodule_search_locations is not None:
+        paths = spec.submodule_search_locations
+    elif spec.origin is not None:
+        paths = [os.path.dirname(os.path.abspath(spec.origin))]
+
+    for package_path in paths:
+        full_path = os.path.join(package_path, resource)
+        try:
+            return open(full_path, mode='rb')
+        except OSError:
+            # Just assume the loader is a resource loader; all the relevant
+            # importlib.machinery loaders are and an AttributeError for
+            # get_data() will make it clear what is needed from the loader.
+            loader = cast(ResourceLoader, spec.loader)
+            data = None
+            if hasattr(spec.loader, 'get_data'):
+                with suppress(OSError):
+                    data = loader.get_data(full_path)
+            if data is not None:
+                return BytesIO(data)
+
+    raise FileNotFoundError(f'{resource!r} resource not found in {spec.name!r}')
 
 
-def open_text(package: Package,
-              resource: Resource,
-              encoding: str = 'utf-8',
-              errors: str = 'strict') -> TextIO:
+def open_text(
+    package: Package,
+    resource: Resource,
+    encoding: str = 'utf-8',
+    errors: str = 'strict',
+) -> TextIO:
     """Return a file-like object opened for text reading of the resource."""
     return TextIOWrapper(
-        open_binary(package, resource), encoding=encoding, errors=errors)
+        open_binary(package, resource), encoding=encoding, errors=errors
+    )
 
 
 def read_binary(package: Package, resource: Resource) -> bytes:
@@ -127,10 +89,12 @@
         return fp.read()
 
 
-def read_text(package: Package,
-              resource: Resource,
-              encoding: str = 'utf-8',
-              errors: str = 'strict') -> str:
+def read_text(
+    package: Package,
+    resource: Resource,
+    encoding: str = 'utf-8',
+    errors: str = 'strict',
+) -> str:
     """Return the decoded string of the resource.
 
     The decoding-related arguments have the same semantics as those of
@@ -140,16 +104,10 @@
         return fp.read()
 
 
-def files(package: Package) -> resources_abc.Traversable:
-    """
-    Get a Traversable resource from a package
-    """
-    return _common.from_package(_get_package(package))
-
-
 def path(
-        package: Package, resource: Resource,
-        ) -> 'ContextManager[Path]':
+    package: Package,
+    resource: Resource,
+) -> 'ContextManager[Path]':
     """A context manager providing a file path object to the resource.
 
     If the resource does not already exist on its own on the file system,
@@ -158,23 +116,30 @@
     raised if the file was deleted prior to the context manager
     exiting).
     """
-    reader = _get_resource_reader(_get_package(package))
+    reader = _common.get_resource_reader(_common.get_package(package))
     return (
-        _path_from_reader(reader, resource)
-        if reader else
-        _common.as_file(files(package).joinpath(_normalize_path(resource)))
+        _path_from_reader(reader, _common.normalize_path(resource))
+        if reader
+        else _common.as_file(
+            _common.files(package).joinpath(_common.normalize_path(resource))
         )
+    )
 
 
-@contextmanager
 def _path_from_reader(reader, resource):
-    norm_resource = _normalize_path(resource)
+    return _path_from_resource_path(reader, resource) or _path_from_open_resource(
+        reader, resource
+    )
+
+
+def _path_from_resource_path(reader, resource):
     with suppress(FileNotFoundError):
-        yield Path(reader.resource_path(norm_resource))
-        return
-    opener_reader = reader.open_resource(norm_resource)
-    with _common._tempfile(opener_reader.read, suffix=norm_resource) as res:
-        yield res
+        return Path(reader.resource_path(resource))
+
+
+def _path_from_open_resource(reader, resource):
+    saved = io.BytesIO(reader.open_resource(resource).read())
+    return _common._tempfile(saved.read, suffix=resource)
 
 
 def is_resource(package: Package, name: str) -> bool:
@@ -182,9 +147,9 @@
 
     Directories are *not* resources.
     """
-    package = _get_package(package)
-    _normalize_path(name)
-    reader = _get_resource_reader(package)
+    package = _common.get_package(package)
+    _common.normalize_path(name)
+    reader = _common.get_resource_reader(package)
     if reader is not None:
         return reader.is_resource(name)
     package_contents = set(contents(package))
@@ -200,16 +165,21 @@
     not considered resources.  Use `is_resource()` on each entry returned here
     to check if it is a resource or not.
     """
-    package = _get_package(package)
-    reader = _get_resource_reader(package)
+    package = _common.get_package(package)
+    reader = _common.get_resource_reader(package)
     if reader is not None:
-        return reader.contents()
-    # Is the package a namespace package?  By definition, namespace packages
-    # cannot have resources.
-    namespace = (
-        package.__spec__.origin is None or
-        package.__spec__.origin == 'namespace'
-        )
-    if namespace or not package.__spec__.has_location:
-        return ()
-    return list(item.name for item in _common.from_package(package).iterdir())
+        return _ensure_sequence(reader.contents())
+    transversable = _common.from_package(package)
+    if transversable.is_dir():
+        return list(item.name for item in transversable.iterdir())
+    return []
+
+
+@singledispatch
+def _ensure_sequence(iterable):
+    return list(iterable)
+
+
+@_ensure_sequence.register(Sequence)
+def _(iterable):
+    return iterable
diff --git a/Lib/importlib/util.py b/Lib/importlib/util.py
index 269a6fa..8623c89 100644
--- a/Lib/importlib/util.py
+++ b/Lib/importlib/util.py
@@ -1,5 +1,5 @@
 """Utility code for constructing importers, etc."""
-from . import abc
+from ._abc import Loader
 from ._bootstrap import module_from_spec
 from ._bootstrap import _resolve_name
 from ._bootstrap import spec_from_loader
@@ -149,7 +149,8 @@
     """
     @functools.wraps(fxn)
     def set_package_wrapper(*args, **kwargs):
-        warnings.warn('The import system now takes care of this automatically.',
+        warnings.warn('The import system now takes care of this automatically; '
+                      'this decorator is slated for removal in Python 3.12',
                       DeprecationWarning, stacklevel=2)
         module = fxn(*args, **kwargs)
         if getattr(module, '__package__', None) is None:
@@ -168,7 +169,8 @@
     """
     @functools.wraps(fxn)
     def set_loader_wrapper(self, *args, **kwargs):
-        warnings.warn('The import system now takes care of this automatically.',
+        warnings.warn('The import system now takes care of this automatically; '
+                      'this decorator is slated for removal in Python 3.12',
                       DeprecationWarning, stacklevel=2)
         module = fxn(self, *args, **kwargs)
         if getattr(module, '__loader__', None) is None:
@@ -195,7 +197,8 @@
     the second argument.
 
     """
-    warnings.warn('The import system now takes care of this automatically.',
+    warnings.warn('The import system now takes care of this automatically; '
+                  'this decorator is slated for removal in Python 3.12',
                   DeprecationWarning, stacklevel=2)
     @functools.wraps(fxn)
     def module_for_loader_wrapper(self, fullname, *args, **kwargs):
@@ -232,7 +235,6 @@
         # Figure out exactly what attributes were mutated between the creation
         # of the module and now.
         attrs_then = self.__spec__.loader_state['__dict__']
-        original_type = self.__spec__.loader_state['__class__']
         attrs_now = self.__dict__
         attrs_updated = {}
         for key, value in attrs_now.items():
@@ -263,7 +265,7 @@
         delattr(self, attr)
 
 
-class LazyLoader(abc.Loader):
+class LazyLoader(Loader):
 
     """A loader that creates a module which defers loading until attribute access."""
 
diff --git a/Lib/inspect.py b/Lib/inspect.py
index 18bed90..c5881cc 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -24,6 +24,8 @@
     stack(), trace() - get info about frames on the stack or in a traceback
 
     signature() - get a Signature object for the callable
+
+    get_annotations() - safely compute an object's annotations
 """
 
 # This module is in the public domain.  No warranties.
@@ -60,6 +62,122 @@
 # See Include/object.h
 TPFLAGS_IS_ABSTRACT = 1 << 20
 
+
+def get_annotations(obj, *, globals=None, locals=None, eval_str=False):
+    """Compute the annotations dict for an object.
+
+    obj may be a callable, class, or module.
+    Passing in an object of any other type raises TypeError.
+
+    Returns a dict.  get_annotations() returns a new dict every time
+    it's called; calling it twice on the same object will return two
+    different but equivalent dicts.
+
+    This function handles several details for you:
+
+      * If eval_str is true, values of type str will
+        be un-stringized using eval().  This is intended
+        for use with stringized annotations
+        ("from __future__ import annotations").
+      * If obj doesn't have an annotations dict, returns an
+        empty dict.  (Functions and methods always have an
+        annotations dict; classes, modules, and other types of
+        callables may not.)
+      * Ignores inherited annotations on classes.  If a class
+        doesn't have its own annotations dict, returns an empty dict.
+      * All accesses to object members and dict values are done
+        using getattr() and dict.get() for safety.
+      * Always, always, always returns a freshly-created dict.
+
+    eval_str controls whether or not values of type str are replaced
+    with the result of calling eval() on those values:
+
+      * If eval_str is true, eval() is called on values of type str.
+      * If eval_str is false (the default), values of type str are unchanged.
+
+    globals and locals are passed in to eval(); see the documentation
+    for eval() for more information.  If either globals or locals is
+    None, this function may replace that value with a context-specific
+    default, contingent on type(obj):
+
+      * If obj is a module, globals defaults to obj.__dict__.
+      * If obj is a class, globals defaults to
+        sys.modules[obj.__module__].__dict__ and locals
+        defaults to the obj class namespace.
+      * If obj is a callable, globals defaults to obj.__globals__,
+        although if obj is a wrapped function (using
+        functools.update_wrapper()) it is first unwrapped.
+    """
+    if isinstance(obj, type):
+        # class
+        obj_dict = getattr(obj, '__dict__', None)
+        if obj_dict and hasattr(obj_dict, 'get'):
+            ann = obj_dict.get('__annotations__', None)
+            if isinstance(ann, types.GetSetDescriptorType):
+                ann = None
+        else:
+            ann = None
+
+        obj_globals = None
+        module_name = getattr(obj, '__module__', None)
+        if module_name:
+            module = sys.modules.get(module_name, None)
+            if module:
+                obj_globals = getattr(module, '__dict__', None)
+        obj_locals = dict(vars(obj))
+        unwrap = obj
+    elif isinstance(obj, types.ModuleType):
+        # module
+        ann = getattr(obj, '__annotations__', None)
+        obj_globals = getattr(obj, '__dict__')
+        obj_locals = None
+        unwrap = None
+    elif callable(obj):
+        # this includes types.Function, types.BuiltinFunctionType,
+        # types.BuiltinMethodType, functools.partial, functools.singledispatch,
+        # "class funclike" from Lib/test/test_inspect... on and on it goes.
+        ann = getattr(obj, '__annotations__', None)
+        obj_globals = getattr(obj, '__globals__', None)
+        obj_locals = None
+        unwrap = obj
+    else:
+        raise TypeError(f"{obj!r} is not a module, class, or callable.")
+
+    if ann is None:
+        return {}
+
+    if not isinstance(ann, dict):
+        raise ValueError(f"{obj!r}.__annotations__ is neither a dict nor None")
+
+    if not ann:
+        return {}
+
+    if not eval_str:
+        return dict(ann)
+
+    if unwrap is not None:
+        while True:
+            if hasattr(unwrap, '__wrapped__'):
+                unwrap = unwrap.__wrapped__
+                continue
+            if isinstance(unwrap, functools.partial):
+                unwrap = unwrap.func
+                continue
+            break
+        if hasattr(unwrap, "__globals__"):
+            obj_globals = unwrap.__globals__
+
+    if globals is None:
+        globals = obj_globals
+    if locals is None:
+        locals = obj_locals
+
+    return_value = {key:
+        value if not isinstance(value, str) else eval(value, globals, locals)
+        for key, value in ann.items() }
+    return return_value
+
+
 # ----------------------------------------------------------- type-checking
 def ismodule(object):
     """Return true if the object is a module.
@@ -277,7 +395,7 @@
         co_kwonlyargcount   number of keyword only arguments (not including ** arg)
         co_lnotab           encoded mapping of line numbers to bytecode indices
         co_name             name with which this code object was defined
-        co_names            tuple of names of local variables
+        co_names            tuple of names other than arguments and function locals
         co_nlocals          number of local variables
         co_stacksize        virtual machine stack space required
         co_varnames         tuple of names of arguments and local variables"""
@@ -407,7 +525,7 @@
     # attribute with the same name as a DynamicClassAttribute exists.
     for base in mro:
         for k, v in base.__dict__.items():
-            if isinstance(v, types.DynamicClassAttribute):
+            if isinstance(v, types.DynamicClassAttribute) and v.fget is not None:
                 names.append(k)
     result = []
     processed = set()
@@ -663,6 +781,8 @@
             module = sys.modules.get(object.__module__)
             if getattr(module, '__file__', None):
                 return module.__file__
+            if object.__module__ == '__main__':
+                raise OSError('source code not available')
         raise TypeError('{!r} is a built-in class'.format(object))
     if ismethod(object):
         object = object.__func__
@@ -706,10 +826,13 @@
     if os.path.exists(filename):
         return filename
     # only return a non-existent filename if the module has a PEP 302 loader
-    if getattr(getmodule(object, filename), '__loader__', None) is not None:
+    module = getmodule(object, filename)
+    if getattr(module, '__loader__', None) is not None:
+        return filename
+    elif getattr(getattr(module, "__spec__", None), "loader", None) is not None:
         return filename
     # or it is in the linecache
-    if filename in linecache.cache:
+    elif filename in linecache.cache:
         return filename
 
 def getabsfile(object, _filename=None):
@@ -736,7 +859,7 @@
     # Try the cache again with the absolute file name
     try:
         file = getabsfile(object, _filename)
-    except TypeError:
+    except (TypeError, FileNotFoundError):
         return None
     if file in modulesbyfile:
         return sys.modules.get(modulesbyfile[file])
@@ -1162,7 +1285,8 @@
         sig = _signature_from_callable(func,
                                        follow_wrapper_chains=False,
                                        skip_bound_arg=False,
-                                       sigcls=Signature)
+                                       sigcls=Signature,
+                                       eval_str=False)
     except Exception as ex:
         # Most of the times 'signature' will raise ValueError.
         # But, it can also raise AttributeError, and, maybe something
@@ -1233,6 +1357,8 @@
 def formatannotation(annotation, base_module=None):
     if getattr(annotation, '__module__', None) == 'typing':
         return repr(annotation).replace('typing.', '')
+    if isinstance(annotation, types.GenericAlias):
+        return str(annotation)
     if isinstance(annotation, type):
         if annotation.__module__ in ('builtins', base_module):
             return annotation.__qualname__
@@ -1895,7 +2021,7 @@
             isinstance(name, str) and
             (defaults is None or isinstance(defaults, tuple)) and
             (kwdefaults is None or isinstance(kwdefaults, dict)) and
-            isinstance(annotations, dict))
+            (isinstance(annotations, (dict)) or annotations is None) )
 
 
 def _signature_get_bound_param(spec):
@@ -2147,7 +2273,8 @@
     return _signature_fromstr(cls, func, s, skip_bound_arg)
 
 
-def _signature_from_function(cls, func, skip_bound_arg=True):
+def _signature_from_function(cls, func, skip_bound_arg=True,
+                             globals=None, locals=None, eval_str=False):
     """Private helper: constructs Signature for the given python function."""
 
     is_duck_function = False
@@ -2173,7 +2300,7 @@
     positional = arg_names[:pos_count]
     keyword_only_count = func_code.co_kwonlyargcount
     keyword_only = arg_names[pos_count:pos_count + keyword_only_count]
-    annotations = func.__annotations__
+    annotations = get_annotations(func, globals=globals, locals=locals, eval_str=eval_str)
     defaults = func.__defaults__
     kwdefaults = func.__kwdefaults__
 
@@ -2244,23 +2371,30 @@
 def _signature_from_callable(obj, *,
                              follow_wrapper_chains=True,
                              skip_bound_arg=True,
+                             globals=None,
+                             locals=None,
+                             eval_str=False,
                              sigcls):
 
     """Private helper function to get signature for arbitrary
     callable objects.
     """
 
+    _get_signature_of = functools.partial(_signature_from_callable,
+                                follow_wrapper_chains=follow_wrapper_chains,
+                                skip_bound_arg=skip_bound_arg,
+                                globals=globals,
+                                locals=locals,
+                                sigcls=sigcls,
+                                eval_str=eval_str)
+
     if not callable(obj):
         raise TypeError('{!r} is not a callable object'.format(obj))
 
     if isinstance(obj, types.MethodType):
         # In this case we skip the first parameter of the underlying
         # function (usually `self` or `cls`).
-        sig = _signature_from_callable(
-            obj.__func__,
-            follow_wrapper_chains=follow_wrapper_chains,
-            skip_bound_arg=skip_bound_arg,
-            sigcls=sigcls)
+        sig = _get_signature_of(obj.__func__)
 
         if skip_bound_arg:
             return _signature_bound_method(sig)
@@ -2274,11 +2408,7 @@
             # If the unwrapped object is a *method*, we might want to
             # skip its first parameter (self).
             # See test_signature_wrapped_bound_method for details.
-            return _signature_from_callable(
-                obj,
-                follow_wrapper_chains=follow_wrapper_chains,
-                skip_bound_arg=skip_bound_arg,
-                sigcls=sigcls)
+            return _get_signature_of(obj)
 
     try:
         sig = obj.__signature__
@@ -2305,11 +2435,7 @@
             # (usually `self`, or `cls`) will not be passed
             # automatically (as for boundmethods)
 
-            wrapped_sig = _signature_from_callable(
-                partialmethod.func,
-                follow_wrapper_chains=follow_wrapper_chains,
-                skip_bound_arg=skip_bound_arg,
-                sigcls=sigcls)
+            wrapped_sig = _get_signature_of(partialmethod.func)
 
             sig = _signature_get_partial(wrapped_sig, partialmethod, (None,))
             first_wrapped_param = tuple(wrapped_sig.parameters.values())[0]
@@ -2328,18 +2454,15 @@
         # If it's a pure Python function, or an object that is duck type
         # of a Python function (Cython functions, for instance), then:
         return _signature_from_function(sigcls, obj,
-                                        skip_bound_arg=skip_bound_arg)
+                                        skip_bound_arg=skip_bound_arg,
+                                        globals=globals, locals=locals, eval_str=eval_str)
 
     if _signature_is_builtin(obj):
         return _signature_from_builtin(sigcls, obj,
                                        skip_bound_arg=skip_bound_arg)
 
     if isinstance(obj, functools.partial):
-        wrapped_sig = _signature_from_callable(
-            obj.func,
-            follow_wrapper_chains=follow_wrapper_chains,
-            skip_bound_arg=skip_bound_arg,
-            sigcls=sigcls)
+        wrapped_sig = _get_signature_of(obj.func)
         return _signature_get_partial(wrapped_sig, obj)
 
     sig = None
@@ -2350,29 +2473,25 @@
         # in its metaclass
         call = _signature_get_user_defined_method(type(obj), '__call__')
         if call is not None:
-            sig = _signature_from_callable(
-                call,
-                follow_wrapper_chains=follow_wrapper_chains,
-                skip_bound_arg=skip_bound_arg,
-                sigcls=sigcls)
+            sig = _get_signature_of(call)
         else:
-            # Now we check if the 'obj' class has a '__new__' method
+            factory_method = None
             new = _signature_get_user_defined_method(obj, '__new__')
-            if new is not None:
-                sig = _signature_from_callable(
-                    new,
-                    follow_wrapper_chains=follow_wrapper_chains,
-                    skip_bound_arg=skip_bound_arg,
-                    sigcls=sigcls)
-            else:
-                # Finally, we should have at least __init__ implemented
-                init = _signature_get_user_defined_method(obj, '__init__')
-                if init is not None:
-                    sig = _signature_from_callable(
-                        init,
-                        follow_wrapper_chains=follow_wrapper_chains,
-                        skip_bound_arg=skip_bound_arg,
-                        sigcls=sigcls)
+            init = _signature_get_user_defined_method(obj, '__init__')
+            # Now we check if the 'obj' class has an own '__new__' method
+            if '__new__' in obj.__dict__:
+                factory_method = new
+            # or an own '__init__' method
+            elif '__init__' in obj.__dict__:
+                factory_method = init
+            # If not, we take inherited '__new__' or '__init__', if present
+            elif new is not None:
+                factory_method = new
+            elif init is not None:
+                factory_method = init
+
+            if factory_method is not None:
+                sig = _get_signature_of(factory_method)
 
         if sig is None:
             # At this point we know, that `obj` is a class, with no user-
@@ -2392,9 +2511,9 @@
                     pass
                 else:
                     if text_sig:
-                        # If 'obj' class has a __text_signature__ attribute:
+                        # If 'base' class has a __text_signature__ attribute:
                         # return a signature based on it
-                        return _signature_fromstr(sigcls, obj, text_sig)
+                        return _signature_fromstr(sigcls, base, text_sig)
 
             # No '__text_signature__' was found for the 'obj' class.
             # Last option is to check if its '__init__' is
@@ -2418,11 +2537,7 @@
         call = _signature_get_user_defined_method(type(obj), '__call__')
         if call is not None:
             try:
-                sig = _signature_from_callable(
-                    call,
-                    follow_wrapper_chains=follow_wrapper_chains,
-                    skip_bound_arg=skip_bound_arg,
-                    sigcls=sigcls)
+                sig = _get_signature_of(call)
             except ValueError as ex:
                 msg = 'no signature found for {!r}'.format(obj)
                 raise ValueError(msg) from ex
@@ -2874,10 +2989,12 @@
         return _signature_from_builtin(cls, func)
 
     @classmethod
-    def from_callable(cls, obj, *, follow_wrapped=True):
+    def from_callable(cls, obj, *,
+                      follow_wrapped=True, globals=None, locals=None, eval_str=False):
         """Constructs Signature for the given callable object."""
         return _signature_from_callable(obj, sigcls=cls,
-                                        follow_wrapper_chains=follow_wrapped)
+                                        follow_wrapper_chains=follow_wrapped,
+                                        globals=globals, locals=locals, eval_str=eval_str)
 
     @property
     def parameters(self):
@@ -3125,9 +3242,10 @@
         return rendered
 
 
-def signature(obj, *, follow_wrapped=True):
+def signature(obj, *, follow_wrapped=True, globals=None, locals=None, eval_str=False):
     """Get a signature object for the passed callable."""
-    return Signature.from_callable(obj, follow_wrapped=follow_wrapped)
+    return Signature.from_callable(obj, follow_wrapped=follow_wrapped,
+                                   globals=globals, locals=locals, eval_str=eval_str)
 
 
 def _main():
diff --git a/Lib/io.py b/Lib/io.py
index fbce6ef..2a6140c 100644
--- a/Lib/io.py
+++ b/Lib/io.py
@@ -54,9 +54,24 @@
 from _io import (DEFAULT_BUFFER_SIZE, BlockingIOError, UnsupportedOperation,
                  open, open_code, FileIO, BytesIO, StringIO, BufferedReader,
                  BufferedWriter, BufferedRWPair, BufferedRandom,
-                 IncrementalNewlineDecoder, TextIOWrapper)
+                 IncrementalNewlineDecoder, text_encoding, TextIOWrapper)
 
-OpenWrapper = _io.open # for compatibility with _pyio
+
+def __getattr__(name):
+    if name == "OpenWrapper":
+        # bpo-43680: Until Python 3.9, _pyio.open was not a static method and
+        # builtins.open was set to OpenWrapper to not become a bound method
+        # when set to a class variable. _io.open is a built-in function whereas
+        # _pyio.open is a Python function. In Python 3.10, _pyio.open() is now
+        # a static method, and builtins.open() is now io.open().
+        import warnings
+        warnings.warn('OpenWrapper is deprecated, use open instead',
+                      DeprecationWarning, stacklevel=2)
+        global OpenWrapper
+        OpenWrapper = open
+        return OpenWrapper
+    raise AttributeError(name)
+
 
 # Pretend this exception was created here.
 UnsupportedOperation.__module__ = "io"
diff --git a/Lib/ipaddress.py b/Lib/ipaddress.py
index bc662c4..4a6496a 100644
--- a/Lib/ipaddress.py
+++ b/Lib/ipaddress.py
@@ -16,6 +16,7 @@
 IPV4LENGTH = 32
 IPV6LENGTH = 128
 
+
 class AddressValueError(ValueError):
     """A Value Error related to the address."""
 
@@ -1214,7 +1215,7 @@
         """
         if not octet_str:
             raise ValueError("Empty octet not permitted")
-        # Whitelist the characters, since int() allows a lot of bizarre stuff.
+        # Reject non-ASCII digits.
         if not (octet_str.isascii() and octet_str.isdigit()):
             msg = "Only decimal digits permitted in %r"
             raise ValueError(msg % octet_str)
@@ -1223,6 +1224,11 @@
         if len(octet_str) > 3:
             msg = "At most 3 characters permitted in %r"
             raise ValueError(msg % octet_str)
+        # Handle leading zeros as strict as glibc's inet_pton()
+        # See security bug bpo-36384
+        if octet_str != '0' and octet_str[0] == '0':
+            msg = "Leading zeros are not permitted in %r"
+            raise ValueError(msg % octet_str)
         # Convert to integer (we know digits are legal)
         octet_int = int(octet_str, 10)
         if octet_int > 255:
@@ -1719,7 +1725,7 @@
               [0..FFFF].
 
         """
-        # Whitelist the characters, since int() allows a lot of bizarre stuff.
+        # Reject non-ASCII digits.
         if not cls._HEX_DIGITS.issuperset(hextet_str):
             raise ValueError("Only hex digits permitted in %r" % hextet_str)
         # We do the length check second, since the invalid character error
@@ -1997,9 +2003,13 @@
 
         Returns:
             A boolean, True if the address is reserved per
-            iana-ipv6-special-registry.
+            iana-ipv6-special-registry, or is ipv4_mapped and is
+            reserved in the iana-ipv4-special-registry.
 
         """
+        ipv4_mapped = self.ipv4_mapped
+        if ipv4_mapped is not None:
+            return ipv4_mapped.is_private
         return any(self in net for net in self._constants._private_networks)
 
     @property
diff --git a/Lib/json/__init__.py b/Lib/json/__init__.py
index 2c52bde..e4c21da 100644
--- a/Lib/json/__init__.py
+++ b/Lib/json/__init__.py
@@ -133,7 +133,7 @@
 
     If ``check_circular`` is false, then the circular reference check
     for container types will be skipped and a circular reference will
-    result in an ``OverflowError`` (or worse).
+    result in an ``RecursionError`` (or worse).
 
     If ``allow_nan`` is false, then it will be a ``ValueError`` to
     serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``)
@@ -195,7 +195,7 @@
 
     If ``check_circular`` is false, then the circular reference check
     for container types will be skipped and a circular reference will
-    result in an ``OverflowError`` (or worse).
+    result in an ``RecursionError`` (or worse).
 
     If ``allow_nan`` is false, then it will be a ``ValueError`` to
     serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in
diff --git a/Lib/json/encoder.py b/Lib/json/encoder.py
index c8c78b9..21bff2c 100644
--- a/Lib/json/encoder.py
+++ b/Lib/json/encoder.py
@@ -116,7 +116,7 @@
 
         If check_circular is true, then lists, dicts, and custom encoded
         objects will be checked for circular references during encoding to
-        prevent an infinite recursion (which would cause an OverflowError).
+        prevent an infinite recursion (which would cause an RecursionError).
         Otherwise, no such check takes place.
 
         If allow_nan is true, then NaN, Infinity, and -Infinity will be
diff --git a/Lib/json/tool.py b/Lib/json/tool.py
index 5dee0a7..0490b8c 100644
--- a/Lib/json/tool.py
+++ b/Lib/json/tool.py
@@ -13,6 +13,7 @@
 import argparse
 import json
 import sys
+from pathlib import Path
 
 
 def main():
@@ -25,9 +26,9 @@
                         help='a JSON file to be validated or pretty-printed',
                         default=sys.stdin)
     parser.add_argument('outfile', nargs='?',
-                        type=argparse.FileType('w', encoding="utf-8"),
+                        type=Path,
                         help='write the output of infile to outfile',
-                        default=sys.stdout)
+                        default=None)
     parser.add_argument('--sort-keys', action='store_true', default=False,
                         help='sort the output of dictionaries alphabetically by key')
     parser.add_argument('--no-ensure-ascii', dest='ensure_ascii', action='store_false',
@@ -58,15 +59,21 @@
         dump_args['indent'] = None
         dump_args['separators'] = ',', ':'
 
-    with options.infile as infile, options.outfile as outfile:
+    with options.infile as infile:
         try:
             if options.json_lines:
                 objs = (json.loads(line) for line in infile)
             else:
-                objs = (json.load(infile), )
-            for obj in objs:
-                json.dump(obj, outfile, **dump_args)
-                outfile.write('\n')
+                objs = (json.load(infile),)
+
+            if options.outfile is None:
+                out = sys.stdout
+            else:
+                out = options.outfile.open('w', encoding='utf-8')
+            with out as outfile:
+                for obj in objs:
+                    json.dump(obj, outfile, **dump_args)
+                    outfile.write('\n')
         except ValueError as e:
             raise SystemExit(e)
 
diff --git a/Lib/keyword.py b/Lib/keyword.py
index 59fcfb0..cc2b46b 100644
--- a/Lib/keyword.py
+++ b/Lib/keyword.py
@@ -6,7 +6,7 @@
 the python source tree and run:
 
     PYTHONPATH=Tools/peg_generator python3 -m pegen.keywordgen \
-        Grammar/Grammar \
+        Grammar/python.gram \
         Grammar/Tokens \
         Lib/keyword.py
 
@@ -19,7 +19,6 @@
     'False',
     'None',
     'True',
-    '__peg_parser__',
     'and',
     'as',
     'assert',
@@ -55,7 +54,9 @@
 ]
 
 softkwlist = [
-
+    '_',
+    'case',
+    'match'
 ]
 
 iskeyword = frozenset(kwlist).__contains__
diff --git a/Lib/lib2to3/Grammar.txt b/Lib/lib2to3/Grammar.txt
index e007dc1..fa7b150 100644
--- a/Lib/lib2to3/Grammar.txt
+++ b/Lib/lib2to3/Grammar.txt
@@ -18,15 +18,55 @@
 async_funcdef: ASYNC funcdef
 funcdef: 'def' NAME parameters ['->' test] ':' suite
 parameters: '(' [typedargslist] ')'
-typedargslist: ((tfpdef ['=' test] ',')*
-                ('*' [tname] (',' tname ['=' test])* [',' ['**' tname [',']]] | '**' tname [','])
-                | tfpdef ['=' test] (',' tfpdef ['=' test])* [','])
+
+# The following definition for typedarglist is equivalent to this set of rules:
+#
+#     arguments = argument (',' argument)*
+#     argument = tfpdef ['=' test]
+#     kwargs = '**' tname [',']
+#     args = '*' [tname]
+#     kwonly_kwargs = (',' argument)* [',' [kwargs]]
+#     args_kwonly_kwargs = args kwonly_kwargs | kwargs
+#     poskeyword_args_kwonly_kwargs = arguments [',' [args_kwonly_kwargs]]
+#     typedargslist_no_posonly  = poskeyword_args_kwonly_kwargs | args_kwonly_kwargs
+#     typedarglist = arguments ',' '/' [',' [typedargslist_no_posonly]])|(typedargslist_no_posonly)"
+#
+# It needs to be fully expanded to allow our LL(1) parser to work on it.
+
+typedargslist: tfpdef ['=' test] (',' tfpdef ['=' test])* ',' '/' [
+                     ',' [((tfpdef ['=' test] ',')* ('*' [tname] (',' tname ['=' test])*
+                            [',' ['**' tname [',']]] | '**' tname [','])
+                     | tfpdef ['=' test] (',' tfpdef ['=' test])* [','])]
+                ] | ((tfpdef ['=' test] ',')* ('*' [tname] (',' tname ['=' test])*
+                     [',' ['**' tname [',']]] | '**' tname [','])
+                     | tfpdef ['=' test] (',' tfpdef ['=' test])* [','])
+
 tname: NAME [':' test]
 tfpdef: tname | '(' tfplist ')'
 tfplist: tfpdef (',' tfpdef)* [',']
-varargslist: ((vfpdef ['=' test] ',')*
-              ('*' [vname] (',' vname ['=' test])*  [',' ['**' vname [',']]] | '**' vname [','])
-              | vfpdef ['=' test] (',' vfpdef ['=' test])* [','])
+
+# The following definition for varargslist is equivalent to this set of rules:
+#
+#     arguments = argument (',' argument )*
+#     argument = vfpdef ['=' test]
+#     kwargs = '**' vname [',']
+#     args = '*' [vname]
+#     kwonly_kwargs = (',' argument )* [',' [kwargs]]
+#     args_kwonly_kwargs = args kwonly_kwargs | kwargs
+#     poskeyword_args_kwonly_kwargs = arguments [',' [args_kwonly_kwargs]]
+#     vararglist_no_posonly = poskeyword_args_kwonly_kwargs | args_kwonly_kwargs
+#     varargslist = arguments ',' '/' [','[(vararglist_no_posonly)]] | (vararglist_no_posonly)
+#
+# It needs to be fully expanded to allow our LL(1) parser to work on it.
+
+varargslist: vfpdef ['=' test ](',' vfpdef ['=' test])* ',' '/' [',' [
+                     ((vfpdef ['=' test] ',')* ('*' [vname] (',' vname ['=' test])*
+                            [',' ['**' vname [',']]] | '**' vname [','])
+                            | vfpdef ['=' test] (',' vfpdef ['=' test])* [','])
+                     ]] | ((vfpdef ['=' test] ',')*
+                     ('*' [vname] (',' vname ['=' test])*  [',' ['**' vname [',']]]| '**' vname [','])
+                     | vfpdef ['=' test] (',' vfpdef ['=' test])* [','])
+
 vname: NAME
 vfpdef: vname | '(' vfplist ')'
 vfplist: vfpdef (',' vfpdef)* [',']
diff --git a/Lib/lib2to3/fixes/fix_metaclass.py b/Lib/lib2to3/fixes/fix_metaclass.py
index d1cd10d..fe547b2 100644
--- a/Lib/lib2to3/fixes/fix_metaclass.py
+++ b/Lib/lib2to3/fixes/fix_metaclass.py
@@ -51,7 +51,7 @@
             # already in the preferred format, do nothing
             return
 
-    # !%@#! oneliners have no suite node, we have to fake one up
+    # !%@#! one-liners have no suite node, we have to fake one up
     for i, node in enumerate(cls_node.children):
         if node.type == token.COLON:
             break
diff --git a/Lib/lib2to3/fixes/fix_paren.py b/Lib/lib2to3/fixes/fix_paren.py
index b205aa7..df3da5f 100644
--- a/Lib/lib2to3/fixes/fix_paren.py
+++ b/Lib/lib2to3/fixes/fix_paren.py
@@ -1,4 +1,4 @@
-"""Fixer that addes parentheses where they are required
+"""Fixer that adds parentheses where they are required
 
 This converts ``[x for x in 1, 2]`` to ``[x for x in (1, 2)]``."""
 
diff --git a/Lib/lib2to3/pgen2/pgen.py b/Lib/lib2to3/pgen2/pgen.py
index b0cbd16..7abd5ce 100644
--- a/Lib/lib2to3/pgen2/pgen.py
+++ b/Lib/lib2to3/pgen2/pgen.py
@@ -12,7 +12,7 @@
     def __init__(self, filename, stream=None):
         close_stream = None
         if stream is None:
-            stream = open(filename)
+            stream = open(filename, encoding="utf-8")
             close_stream = stream.close
         self.filename = filename
         self.stream = stream
diff --git a/Lib/lib2to3/pgen2/tokenize.py b/Lib/lib2to3/pgen2/tokenize.py
index 0e2685d..099dfa7 100644
--- a/Lib/lib2to3/pgen2/tokenize.py
+++ b/Lib/lib2to3/pgen2/tokenize.py
@@ -512,13 +512,14 @@
                         stashed = tok
                         continue
 
-                    if token == 'def':
+                    if token in ('def', 'for'):
                         if (stashed
                                 and stashed[0] == NAME
                                 and stashed[1] == 'async'):
 
-                            async_def = True
-                            async_def_indent = indents[-1]
+                            if token == 'def':
+                                async_def = True
+                                async_def_indent = indents[-1]
 
                             yield (ASYNC, stashed[1],
                                    stashed[2], stashed[3],
diff --git a/Lib/lib2to3/pytree.py b/Lib/lib2to3/pytree.py
index 2a6ef2e..729023d 100644
--- a/Lib/lib2to3/pytree.py
+++ b/Lib/lib2to3/pytree.py
@@ -720,8 +720,8 @@
                         r[self.name] = nodes[:count]
                     yield count, r
             except RuntimeError:
-                # We fall back to the iterative pattern matching scheme if the recursive
-                # scheme hits the recursion limit.
+                # Fall back to the iterative pattern matching scheme if the
+                # recursive scheme hits the recursion limit (RecursionError).
                 for count, r in self._iterative_matches(nodes):
                     if self.name:
                         r[self.name] = nodes[:count]
diff --git a/Lib/lib2to3/tests/data/infinite_recursion.py b/Lib/lib2to3/tests/data/infinite_recursion.py
index 71715ef..acc62ed 100644
--- a/Lib/lib2to3/tests/data/infinite_recursion.py
+++ b/Lib/lib2to3/tests/data/infinite_recursion.py
@@ -1,5 +1,5 @@
-# This file is used to verify that 2to3 falls back to a slower, iterative pattern matching
-# scheme in the event that the faster recursive system fails due to infinite recursion.
+# Verify that 2to3 falls back from the recursive pattern matching scheme to a
+# slower, iterative scheme in the event of a RecursionError.
 from ctypes import *
 STRING = c_char_p
 
diff --git a/Lib/lib2to3/tests/data/py2_test_grammar.py b/Lib/lib2to3/tests/data/py2_test_grammar.py
index b5a4137..f9e4ea1 100644
--- a/Lib/lib2to3/tests/data/py2_test_grammar.py
+++ b/Lib/lib2to3/tests/data/py2_test_grammar.py
@@ -8,7 +8,7 @@
 # regression test, the filterwarnings() call has been added to
 # regrtest.py.
 
-from test.test_support import run_unittest, check_syntax_error
+from test.test_support import check_syntax_error
 import unittest
 import sys
 # testing import *
@@ -735,7 +735,7 @@
         s = a[-5:]
         s = a[:-1]
         s = a[-4:-3]
-        # A rough test of SF bug 1333982.  http://python.org/sf/1333982
+        # A rough test of SF bug 1333982.  https://python.org/sf/1333982
         # The testing here is fairly incomplete.
         # Test cases should include: commas with 1 and 2 colons
         d = {}
@@ -967,8 +967,5 @@
         self.assertEqual((6 < 4 if 0 else 2), 2)
 
 
-def test_main():
-    run_unittest(TokenTests, GrammarTests)
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/lib2to3/tests/data/py3_test_grammar.py b/Lib/lib2to3/tests/data/py3_test_grammar.py
index d062232..a4a3f7e 100644
--- a/Lib/lib2to3/tests/data/py3_test_grammar.py
+++ b/Lib/lib2to3/tests/data/py3_test_grammar.py
@@ -8,7 +8,7 @@
 # regression test, the filterwarnings() call has been added to
 # regrtest.py.
 
-from test.support import run_unittest, check_syntax_error
+from test.support import check_syntax_error
 import unittest
 import sys
 # testing import *
@@ -714,7 +714,7 @@
         s = a[-5:]
         s = a[:-1]
         s = a[-4:-3]
-        # A rough test of SF bug 1333982.  http://python.org/sf/1333982
+        # A rough test of SF bug 1333982.  https://python.org/sf/1333982
         # The testing here is fairly incomplete.
         # Test cases should include: commas with 1 and 2 colons
         d = {}
@@ -952,8 +952,5 @@
         self.assertEqual((6 < 4 if 0 else 2), 2)
 
 
-def test_main():
-    run_unittest(TokenTests, GrammarTests)
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/lib2to3/tests/test_all_fixers.py b/Lib/lib2to3/tests/test_all_fixers.py
index c0507cf..a265941 100644
--- a/Lib/lib2to3/tests/test_all_fixers.py
+++ b/Lib/lib2to3/tests/test_all_fixers.py
@@ -6,8 +6,10 @@
 # Author: Collin Winter
 
 # Python imports
-import unittest
+import os.path
+import sys
 import test.support
+import unittest
 
 # Local imports
 from . import support
@@ -19,9 +21,22 @@
     def setUp(self):
         self.refactor = support.get_refactorer()
 
+    def refactor_file(self, filepath):
+        if test.support.verbose:
+            print(f"Refactor file: {filepath}")
+        if os.path.basename(filepath) == 'infinite_recursion.py':
+            # bpo-46542: Processing infinite_recursion.py can crash Python
+            # if Python is built in debug mode: lower the recursion limit
+            # to prevent a crash.
+            with test.support.infinite_recursion(150):
+                self.refactor.refactor_file(filepath)
+        else:
+            self.refactor.refactor_file(filepath)
+
     def test_all_project_files(self):
         for filepath in support.all_project_files():
-            self.refactor.refactor_file(filepath)
+            with self.subTest(filepath=filepath):
+                self.refactor_file(filepath)
 
 if __name__ == '__main__':
     unittest.main()
diff --git a/Lib/lib2to3/tests/test_parser.py b/Lib/lib2to3/tests/test_parser.py
index ba2bb78..90a1b34 100644
--- a/Lib/lib2to3/tests/test_parser.py
+++ b/Lib/lib2to3/tests/test_parser.py
@@ -20,6 +20,7 @@
 import subprocess
 import sys
 import tempfile
+import test.support
 import unittest
 
 # Local imports
@@ -84,12 +85,16 @@
             # different hash randomization seed.
             sub_env = dict(os.environ)
             sub_env['PYTHONHASHSEED'] = 'random'
-            subprocess.check_call(
-                    [sys.executable, '-c', """
+            code = """
 from lib2to3.pgen2 import driver as pgen2_driver
 pgen2_driver.load_grammar(%r, save=True, force=True)
-                    """ % (grammar_sub_copy,)],
-                    env=sub_env)
+            """ % (grammar_sub_copy,)
+            msg = ("lib2to3 package is deprecated and may not be able "
+                   "to parse Python 3.10+")
+            cmd = [sys.executable,
+                   f'-Wignore:{msg}:PendingDeprecationWarning',
+                   '-c', code]
+            subprocess.check_call( cmd, env=sub_env)
             self.assertTrue(os.path.exists(pickle_sub_name))
 
             with open(pickle_name, 'rb') as pickle_f_1, \
@@ -196,20 +201,27 @@
         self.validate("""await = 1""")
         self.validate("""def async(): pass""")
 
-    def test_async_with(self):
+    def test_async_for(self):
         self.validate("""async def foo():
                              async for a in b: pass""")
 
-        self.invalid_syntax("""def foo():
-                                   async for a in b: pass""")
-
-    def test_async_for(self):
+    def test_async_with(self):
         self.validate("""async def foo():
                              async with a: pass""")
 
         self.invalid_syntax("""def foo():
                                    async with a: pass""")
 
+    def test_async_generator(self):
+        self.validate(
+            """async def foo():
+                   return (i * 2 async for i in arange(42))"""
+        )
+        self.validate(
+            """def foo():
+                   return (i * 2 async for i in arange(42))"""
+        )
+
 
 class TestRaiseChanges(GrammarTest):
     def test_2x_style_1(self):
@@ -272,6 +284,12 @@
     def test_dict_display_2(self):
         self.validate("""{**{}, 3:4, **{5:6, 7:8}}""")
 
+    def test_complex_star_expression(self):
+        self.validate("func(* [] or [1])")
+
+    def test_complex_double_star_expression(self):
+        self.validate("func(**{1: 3} if False else {x: x for x in range(3)})")
+
     def test_argument_unpacking_1(self):
         self.validate("""f(a, *b, *c, d)""")
 
@@ -569,25 +587,31 @@
 
     """A cut-down version of pytree_idempotency.py."""
 
+    def parse_file(self, filepath):
+        if test.support.verbose:
+            print(f"Parse file: {filepath}")
+        with open(filepath, "rb") as fp:
+            encoding = tokenize.detect_encoding(fp.readline)[0]
+        self.assertIsNotNone(encoding,
+                             "can't detect encoding for %s" % filepath)
+        with open(filepath, "r", encoding=encoding) as fp:
+            source = fp.read()
+        try:
+            tree = driver.parse_string(source)
+        except ParseError:
+            try:
+                tree = driver_no_print_statement.parse_string(source)
+            except ParseError as err:
+                self.fail('ParseError on file %s (%s)' % (filepath, err))
+        new = str(tree)
+        if new != source:
+            print(diff_texts(source, new, filepath))
+            self.fail("Idempotency failed: %s" % filepath)
+
     def test_all_project_files(self):
         for filepath in support.all_project_files():
-            with open(filepath, "rb") as fp:
-                encoding = tokenize.detect_encoding(fp.readline)[0]
-            self.assertIsNotNone(encoding,
-                                 "can't detect encoding for %s" % filepath)
-            with open(filepath, "r", encoding=encoding) as fp:
-                source = fp.read()
-            try:
-                tree = driver.parse_string(source)
-            except ParseError:
-                try:
-                    tree = driver_no_print_statement.parse_string(source)
-                except ParseError as err:
-                    self.fail('ParseError on file %s (%s)' % (filepath, err))
-            new = str(tree)
-            if new != source:
-                print(diff_texts(source, new, filepath))
-                self.fail("Idempotency failed: %s" % filepath)
+            with self.subTest(filepath=filepath):
+                self.parse_file(filepath)
 
     def test_extended_unpacking(self):
         driver.parse_string("a, *b, c = x\n")
@@ -630,6 +654,7 @@
 
 
 class TestNamedAssignments(GrammarTest):
+    """Also known as the walrus operator."""
 
     def test_named_assignment_if(self):
         driver.parse_string("if f := x(): pass\n")
@@ -644,6 +669,30 @@
         driver.parse_string("[(lastNum := num) == 1 for num in [1, 2, 3]]\n")
 
 
+class TestPositionalOnlyArgs(GrammarTest):
+
+    def test_one_pos_only_arg(self):
+        driver.parse_string("def one_pos_only_arg(a, /): pass\n")
+
+    def test_all_markers(self):
+        driver.parse_string(
+                "def all_markers(a, b=2, /, c, d=4, *, e=5, f): pass\n")
+
+    def test_all_with_args_and_kwargs(self):
+        driver.parse_string(
+                """def all_markers_with_args_and_kwargs(
+                           aa, b, /, _cc, d, *args, e, f_f, **kwargs,
+                   ):
+                       pass\n""")
+
+    def test_lambda_soup(self):
+        driver.parse_string(
+                "lambda a, b, /, c, d, *args, e, f, **kw: kw\n")
+
+    def test_only_positional_or_keyword(self):
+        driver.parse_string("def func(a,b,/,*,g,e=3): pass\n")
+
+
 class TestPickleableException(unittest.TestCase):
     def test_ParseError(self):
         err = ParseError('msg', 2, None, (1, 'context'))
diff --git a/Lib/linecache.py b/Lib/linecache.py
index fa5dbd0..23191d6 100644
--- a/Lib/linecache.py
+++ b/Lib/linecache.py
@@ -154,7 +154,7 @@
 
     :return: True if a lazy load is registered in the cache,
         otherwise False. To register such a load a module loader with a
-        get_source method must be found, the filename must be a cachable
+        get_source method must be found, the filename must be a cacheable
         filename, and the filename must not be already cached.
     """
     if filename in cache:
@@ -165,9 +165,14 @@
     if not filename or (filename.startswith('<') and filename.endswith('>')):
         return False
     # Try for a __loader__, if available
-    if module_globals and '__loader__' in module_globals:
-        name = module_globals.get('__name__')
-        loader = module_globals['__loader__']
+    if module_globals and '__name__' in module_globals:
+        name = module_globals['__name__']
+        if (loader := module_globals.get('__loader__')) is None:
+            if spec := module_globals.get('__spec__'):
+                try:
+                    loader = spec.loader
+                except AttributeError:
+                    pass
         get_source = getattr(loader, 'get_source', None)
 
         if name and get_source:
diff --git a/Lib/locale.py b/Lib/locale.py
index 1a4e9f6..6d4f519 100644
--- a/Lib/locale.py
+++ b/Lib/locale.py
@@ -185,8 +185,14 @@
         formatted = percent % ((value,) + additional)
     else:
         formatted = percent % value
+    if percent[-1] in 'eEfFgGdiu':
+        formatted = _localize(formatted, grouping, monetary)
+    return formatted
+
+# Transform formatted as locale number according to the locale settings
+def _localize(formatted, grouping=False, monetary=False):
     # floats and decimal ints need special action!
-    if percent[-1] in 'eEfFgG':
+    if '.' in formatted:
         seps = 0
         parts = formatted.split('.')
         if grouping:
@@ -196,7 +202,7 @@
         formatted = decimal_point.join(parts)
         if seps:
             formatted = _strip_padding(formatted, seps)
-    elif percent[-1] in 'diu':
+    else:
         seps = 0
         if grouping:
             formatted, seps = _group(formatted, monetary=monetary)
@@ -267,7 +273,7 @@
         raise ValueError("Currency formatting is not possible using "
                          "the 'C' locale.")
 
-    s = _format('%%.%if' % digits, abs(val), grouping, monetary=True)
+    s = _localize(f'{abs(val):.{digits}f}', grouping, monetary=True)
     # '<' and '>' are markers if the sign must be inserted between symbol and value
     s = '<' + s + '>'
 
@@ -323,6 +329,10 @@
         string = string.replace(dd, '.')
     return string
 
+def localize(string, grouping=False, monetary=False):
+    """Parses a string as locale number according to the locale settings."""
+    return _localize(string, grouping, monetary)
+
 def atof(string, func=float):
     "Parses a string as a float according to the locale settings."
     return func(delocalize(string))
@@ -619,53 +629,49 @@
     """
     _setlocale(category, _build_localename(getdefaultlocale()))
 
-if sys.platform.startswith("win"):
-    # On Win32, this will return the ANSI code page
-    def getpreferredencoding(do_setlocale = True):
-        """Return the charset that the user is likely using."""
-        if sys.flags.utf8_mode:
-            return 'UTF-8'
-        import _bootlocale
-        return _bootlocale.getpreferredencoding(False)
-else:
-    # On Unix, if CODESET is available, use that.
-    try:
-        CODESET
-    except NameError:
+
+try:
+    from _locale import _get_locale_encoding
+except ImportError:
+    def _get_locale_encoding():
         if hasattr(sys, 'getandroidapilevel'):
             # On Android langinfo.h and CODESET are missing, and UTF-8 is
             # always used in mbstowcs() and wcstombs().
-            def getpreferredencoding(do_setlocale = True):
-                return 'UTF-8'
-        else:
-            # Fall back to parsing environment variables :-(
-            def getpreferredencoding(do_setlocale = True):
-                """Return the charset that the user is likely using,
-                by looking at environment variables."""
-                if sys.flags.utf8_mode:
-                    return 'UTF-8'
-                res = getdefaultlocale()[1]
-                if res is None:
-                    # LANG not set, default conservatively to ASCII
-                    res = 'ascii'
-                return res
-    else:
-        def getpreferredencoding(do_setlocale = True):
-            """Return the charset that the user is likely using,
-            according to the system configuration."""
-            if sys.flags.utf8_mode:
-                return 'UTF-8'
-            import _bootlocale
-            if do_setlocale:
-                oldloc = setlocale(LC_CTYPE)
-                try:
-                    setlocale(LC_CTYPE, "")
-                except Error:
-                    pass
-            result = _bootlocale.getpreferredencoding(False)
-            if do_setlocale:
-                setlocale(LC_CTYPE, oldloc)
-            return result
+            return 'UTF-8'
+        if sys.flags.utf8_mode:
+            return 'UTF-8'
+        encoding = getdefaultlocale()[1]
+        if encoding is None:
+            # LANG not set, default conservatively to ASCII
+            encoding = 'ascii'
+        return encoding
+
+try:
+    CODESET
+except NameError:
+    def getpreferredencoding(do_setlocale=True):
+        """Return the charset that the user is likely using."""
+        return _get_locale_encoding()
+else:
+    # On Unix, if CODESET is available, use that.
+    def getpreferredencoding(do_setlocale=True):
+        """Return the charset that the user is likely using,
+        according to the system configuration."""
+        if sys.flags.utf8_mode:
+            return 'UTF-8'
+
+        if not do_setlocale:
+            return _get_locale_encoding()
+
+        old_loc = setlocale(LC_CTYPE)
+        try:
+            try:
+                setlocale(LC_CTYPE, "")
+            except Error:
+                pass
+            return _get_locale_encoding()
+        finally:
+            setlocale(LC_CTYPE, old_loc)
 
 
 ### Database
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index 7b169a1..19bd2bc 100644
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -118,7 +118,7 @@
 
 def getLevelName(level):
     """
-    Return the textual representation of logging level 'level'.
+    Return the textual or numeric representation of logging level 'level'.
 
     If the level is one of the predefined levels (CRITICAL, ERROR, WARNING,
     INFO, DEBUG) then you get the corresponding string. If you have
@@ -128,7 +128,11 @@
     If a numeric value corresponding to one of the defined levels is passed
     in, the corresponding string representation is returned.
 
-    Otherwise, the string "Level %s" % level is returned.
+    If a string representation of the level is passed in, the corresponding
+    numeric value is returned.
+
+    If no matching numeric or string value is passed in, the string
+    'Level %s' % level is returned.
     """
     # See Issues #22386, #27937 and #29220 for why it's this way
     result = _levelToName.get(level)
@@ -194,7 +198,8 @@
             raise ValueError("Unknown level: %r" % level)
         rv = _nameToLevel[level]
     else:
-        raise TypeError("Level not an integer or a valid string: %r" % level)
+        raise TypeError("Level not an integer or a valid string: %r"
+                        % (level,))
     return rv
 
 #---------------------------------------------------------------------------
@@ -411,8 +416,9 @@
     asctime_search = '%(asctime)'
     validation_pattern = re.compile(r'%\(\w+\)[#0+ -]*(\*|\d+)?(\.(\*|\d+))?[diouxefgcrsa%]', re.I)
 
-    def __init__(self, fmt):
+    def __init__(self, fmt, *, defaults=None):
         self._fmt = fmt or self.default_format
+        self._defaults = defaults
 
     def usesTime(self):
         return self._fmt.find(self.asctime_search) >= 0
@@ -423,7 +429,11 @@
             raise ValueError("Invalid format '%s' for '%s' style" % (self._fmt, self.default_format[0]))
 
     def _format(self, record):
-        return self._fmt % record.__dict__
+        if defaults := self._defaults:
+            values = defaults | record.__dict__
+        else:
+            values = record.__dict__
+        return self._fmt % values
 
     def format(self, record):
         try:
@@ -441,7 +451,11 @@
     field_spec = re.compile(r'^(\d+|\w+)(\.\w+|\[[^]]+\])*$')
 
     def _format(self, record):
-        return self._fmt.format(**record.__dict__)
+        if defaults := self._defaults:
+            values = defaults | record.__dict__
+        else:
+            values = record.__dict__
+        return self._fmt.format(**values)
 
     def validate(self):
         """Validate the input format, ensure it is the correct string formatting style"""
@@ -467,8 +481,8 @@
     asctime_format = '${asctime}'
     asctime_search = '${asctime}'
 
-    def __init__(self, fmt):
-        self._fmt = fmt or self.default_format
+    def __init__(self, *args, **kwargs):
+        super().__init__(*args, **kwargs)
         self._tpl = Template(self._fmt)
 
     def usesTime(self):
@@ -490,7 +504,11 @@
             raise ValueError('invalid format: no fields')
 
     def _format(self, record):
-        return self._tpl.substitute(**record.__dict__)
+        if defaults := self._defaults:
+            values = defaults | record.__dict__
+        else:
+            values = record.__dict__
+        return self._tpl.substitute(**values)
 
 
 BASIC_FORMAT = "%(levelname)s:%(name)s:%(message)s"
@@ -546,7 +564,8 @@
 
     converter = time.localtime
 
-    def __init__(self, fmt=None, datefmt=None, style='%', validate=True):
+    def __init__(self, fmt=None, datefmt=None, style='%', validate=True, *,
+                 defaults=None):
         """
         Initialize the formatter with specified format strings.
 
@@ -565,7 +584,7 @@
         if style not in _STYLES:
             raise ValueError('Style must be one of: %s' % ','.join(
                              _STYLES.keys()))
-        self._style = _STYLES[style][0](fmt)
+        self._style = _STYLES[style][0](fmt, defaults=defaults)
         if validate:
             self._style.validate()
 
@@ -859,6 +878,7 @@
         self._name = None
         self.level = _checkLevel(level)
         self.formatter = None
+        self._closed = False
         # Add the handler to the global _handlerList (for cleanup on shutdown)
         _addHandlerRef(self)
         self.createLock()
@@ -977,6 +997,7 @@
         #get the module data lock, as we're updating a shared structure.
         _acquireLock()
         try:    #unlikely to raise an exception, but you never know...
+            self._closed = True
             if self._name and self._name in _handlers:
                 del _handlers[self._name]
         finally:
@@ -1131,8 +1152,14 @@
         self.baseFilename = os.path.abspath(filename)
         self.mode = mode
         self.encoding = encoding
+        if "b" not in mode:
+            self.encoding = io.text_encoding(encoding)
         self.errors = errors
         self.delay = delay
+        # bpo-26789: FileHandler keeps a reference to the builtin open()
+        # function to be able to open or reopen the file during Python
+        # finalization.
+        self._builtin_open = open
         if delay:
             #We don't open the stream, but we still need to call the
             #Handler constructor to set level, formatter, lock etc.
@@ -1159,6 +1186,8 @@
             finally:
                 # Issue #19523: call unconditionally to
                 # prevent a handler leak when delay is set
+                # Also see Issue #42378: we also rely on
+                # self._closed being set to True there
                 StreamHandler.close(self)
         finally:
             self.release()
@@ -1168,8 +1197,9 @@
         Open the current base file with the (original) mode and encoding.
         Return the resulting stream.
         """
-        return open(self.baseFilename, self.mode, encoding=self.encoding,
-                    errors=self.errors)
+        open_func = self._builtin_open
+        return open_func(self.baseFilename, self.mode,
+                         encoding=self.encoding, errors=self.errors)
 
     def emit(self, record):
         """
@@ -1177,10 +1207,15 @@
 
         If the stream was not opened because 'delay' was specified in the
         constructor, open it before calling the superclass's emit.
+
+        If stream is not open, current mode is 'w' and `_closed=True`, record
+        will not be emitted (see Issue #42378).
         """
         if self.stream is None:
-            self.stream = self._open()
-        StreamHandler.emit(self, record)
+            if self.mode != 'w' or not self._closed:
+                self.stream = self._open()
+        if self.stream:
+            StreamHandler.emit(self, record)
 
     def __repr__(self):
         level = getLevelName(self.level)
@@ -1269,6 +1304,14 @@
         self.loggerClass = None
         self.logRecordFactory = None
 
+    @property
+    def disable(self):
+        return self._disable
+
+    @disable.setter
+    def disable(self, value):
+        self._disable = _checkLevel(value)
+
     def getLogger(self, name):
         """
         Get a logger with the specified name (channel name), creating it
@@ -1480,7 +1523,11 @@
         if self.isEnabledFor(CRITICAL):
             self._log(CRITICAL, msg, args, **kwargs)
 
-    fatal = critical
+    def fatal(self, msg, *args, **kwargs):
+        """
+        Don't use this method, use critical() instead.
+        """
+        self.critical(msg, *args, **kwargs)
 
     def log(self, level, msg, *args, **kwargs):
         """
@@ -1751,7 +1798,7 @@
     information in logging output.
     """
 
-    def __init__(self, logger, extra):
+    def __init__(self, logger, extra=None):
         """
         Initialize the adapter with a logger and a dict-like object which
         provides contextual information. This constructor signature allows
@@ -1986,8 +2033,10 @@
                 filename = kwargs.pop("filename", None)
                 mode = kwargs.pop("filemode", 'a')
                 if filename:
-                    if 'b'in mode:
+                    if 'b' in mode:
                         errors = None
+                    else:
+                        encoding = io.text_encoding(encoding)
                     h = FileHandler(filename, mode,
                                     encoding=encoding, errors=errors)
                 else:
@@ -2039,7 +2088,11 @@
         basicConfig()
     root.critical(msg, *args, **kwargs)
 
-fatal = critical
+def fatal(msg, *args, **kwargs):
+    """
+    Don't use this function, use critical() instead.
+    """
+    critical(msg, *args, **kwargs)
 
 def error(msg, *args, **kwargs):
     """
diff --git a/Lib/logging/config.py b/Lib/logging/config.py
index fd3aded..3bc63b7 100644
--- a/Lib/logging/config.py
+++ b/Lib/logging/config.py
@@ -48,7 +48,7 @@
 #   _listener holds the server object doing the listening
 _listener = None
 
-def fileConfig(fname, defaults=None, disable_existing_loggers=True):
+def fileConfig(fname, defaults=None, disable_existing_loggers=True, encoding=None):
     """
     Read the logging configuration from a ConfigParser-format file.
 
@@ -66,7 +66,8 @@
         if hasattr(fname, 'readline'):
             cp.read_file(fname)
         else:
-            cp.read(fname)
+            encoding = io.text_encoding(encoding)
+            cp.read(fname, encoding=encoding)
 
     formatters = _create_formatters(cp)
 
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
index 867ef4e..61a3995 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -1,4 +1,4 @@
-# Copyright 2001-2016 by Vinay Sajip. All Rights Reserved.
+# Copyright 2001-2021 by Vinay Sajip. All Rights Reserved.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose and without fee is hereby granted,
@@ -18,12 +18,12 @@
 Additional handlers for the logging package for Python. The core package is
 based on PEP 282 and comments thereto in comp.lang.python.
 
-Copyright (C) 2001-2016 Vinay Sajip. All Rights Reserved.
+Copyright (C) 2001-2021 Vinay Sajip. All Rights Reserved.
 
 To use, simply 'import logging.handlers' and log away!
 """
 
-import logging, socket, os, pickle, struct, time, re
+import io, logging, socket, os, pickle, struct, time, re
 from stat import ST_DEV, ST_INO, ST_MTIME
 import queue
 import threading
@@ -150,6 +150,8 @@
         # on each run.
         if maxBytes > 0:
             mode = 'a'
+        if "b" not in mode:
+            encoding = io.text_encoding(encoding)
         BaseRotatingHandler.__init__(self, filename, mode, encoding=encoding,
                                      delay=delay, errors=errors)
         self.maxBytes = maxBytes
@@ -185,14 +187,17 @@
         Basically, see if the supplied record would cause the file to exceed
         the size limit we have.
         """
+        # See bpo-45401: Never rollover anything other than regular files
+        if os.path.exists(self.baseFilename) and not os.path.isfile(self.baseFilename):
+            return False
         if self.stream is None:                 # delay was set...
             self.stream = self._open()
         if self.maxBytes > 0:                   # are we rolling over?
             msg = "%s\n" % self.format(record)
             self.stream.seek(0, 2)  #due to non-posix-compliant Windows feature
             if self.stream.tell() + len(msg) >= self.maxBytes:
-                return 1
-        return 0
+                return True
+        return False
 
 class TimedRotatingFileHandler(BaseRotatingHandler):
     """
@@ -205,6 +210,7 @@
     def __init__(self, filename, when='h', interval=1, backupCount=0,
                  encoding=None, delay=False, utc=False, atTime=None,
                  errors=None):
+        encoding = io.text_encoding(encoding)
         BaseRotatingHandler.__init__(self, filename, 'a', encoding=encoding,
                                      delay=delay, errors=errors)
         self.when = when.upper()
@@ -342,10 +348,13 @@
         record is not used, as we are just comparing times, but it is needed so
         the method signatures are the same
         """
+        # See bpo-45401: Never rollover anything other than regular files
+        if os.path.exists(self.baseFilename) and not os.path.isfile(self.baseFilename):
+            return False
         t = int(time.time())
         if t >= self.rolloverAt:
-            return 1
-        return 0
+            return True
+        return False
 
     def getFilesToDelete(self):
         """
@@ -356,13 +365,32 @@
         dirName, baseName = os.path.split(self.baseFilename)
         fileNames = os.listdir(dirName)
         result = []
-        prefix = baseName + "."
+        # See bpo-44753: Don't use the extension when computing the prefix.
+        n, e = os.path.splitext(baseName)
+        prefix = n + '.'
         plen = len(prefix)
         for fileName in fileNames:
+            if self.namer is None:
+                # Our files will always start with baseName
+                if not fileName.startswith(baseName):
+                    continue
+            else:
+                # Our files could be just about anything after custom naming, but
+                # likely candidates are of the form
+                # foo.log.DATETIME_SUFFIX or foo.DATETIME_SUFFIX.log
+                if (not fileName.startswith(baseName) and fileName.endswith(e) and
+                    len(fileName) > (plen + 1) and not fileName[plen+1].isdigit()):
+                    continue
+
             if fileName[:plen] == prefix:
                 suffix = fileName[plen:]
-                if self.extMatch.match(suffix):
-                    result.append(os.path.join(dirName, fileName))
+                # See bpo-45628: The date/time suffix could be anywhere in the
+                # filename
+                parts = suffix.split('.')
+                for part in parts:
+                    if self.extMatch.match(part):
+                        result.append(os.path.join(dirName, fileName))
+                        break
         if len(result) < self.backupCount:
             result = []
         else:
@@ -442,6 +470,8 @@
     """
     def __init__(self, filename, mode='a', encoding=None, delay=False,
                  errors=None):
+        if "b" not in mode:
+            encoding = io.text_encoding(encoding)
         logging.FileHandler.__init__(self, filename, mode=mode,
                                      encoding=encoding, delay=delay,
                                      errors=errors)
@@ -1142,7 +1172,7 @@
 
 class HTTPHandler(logging.Handler):
     """
-    A class which sends records to a Web server, using either GET or
+    A class which sends records to a web server, using either GET or
     POST semantics.
     """
     def __init__(self, host, url, method="GET", secure=False, credentials=None,
@@ -1191,7 +1221,7 @@
         """
         Emit a record.
 
-        Send the record to the Web server as a percent-encoded dictionary
+        Send the record to the web server as a percent-encoded dictionary
         """
         try:
             import urllib.parse
diff --git a/Lib/lzma.py b/Lib/lzma.py
index 0817b87..800f521 100644
--- a/Lib/lzma.py
+++ b/Lib/lzma.py
@@ -225,14 +225,22 @@
         """Write a bytes object to the file.
 
         Returns the number of uncompressed bytes written, which is
-        always len(data). Note that due to buffering, the file on disk
-        may not reflect the data written until close() is called.
+        always the length of data in bytes. Note that due to buffering,
+        the file on disk may not reflect the data written until close()
+        is called.
         """
         self._check_can_write()
+        if isinstance(data, (bytes, bytearray)):
+            length = len(data)
+        else:
+            # accept any data that supports the buffer protocol
+            data = memoryview(data)
+            length = data.nbytes
+
         compressed = self._compressor.compress(data)
         self._fp.write(compressed)
-        self._pos += len(data)
-        return len(data)
+        self._pos += length
+        return length
 
     def seek(self, offset, whence=io.SEEK_SET):
         """Change the file position.
@@ -302,6 +310,7 @@
                            preset=preset, filters=filters)
 
     if "t" in mode:
+        encoding = io.text_encoding(encoding)
         return io.TextIOWrapper(binary_file, encoding, errors, newline)
     else:
         return binary_file
diff --git a/Lib/mimetypes.py b/Lib/mimetypes.py
index 92c2a47..b72ce08 100644
--- a/Lib/mimetypes.py
+++ b/Lib/mimetypes.py
@@ -27,6 +27,12 @@
 import sys
 import posixpath
 import urllib.parse
+
+try:
+    from _winapi import _mimetypes_read_windows_registry
+except ImportError:
+    _mimetypes_read_windows_registry = None
+
 try:
     import winreg as _winreg
 except ImportError:
@@ -135,25 +141,23 @@
                 type = 'text/plain'
             return type, None           # never compressed, so encoding is None
         base, ext = posixpath.splitext(url)
-        while ext in self.suffix_map:
-            base, ext = posixpath.splitext(base + self.suffix_map[ext])
+        while (ext_lower := ext.lower()) in self.suffix_map:
+            base, ext = posixpath.splitext(base + self.suffix_map[ext_lower])
+        # encodings_map is case sensitive
         if ext in self.encodings_map:
             encoding = self.encodings_map[ext]
             base, ext = posixpath.splitext(base)
         else:
             encoding = None
+        ext = ext.lower()
         types_map = self.types_map[True]
         if ext in types_map:
             return types_map[ext], encoding
-        elif ext.lower() in types_map:
-            return types_map[ext.lower()], encoding
         elif strict:
             return None, encoding
         types_map = self.types_map[False]
         if ext in types_map:
             return types_map[ext], encoding
-        elif ext.lower() in types_map:
-            return types_map[ext.lower()], encoding
         else:
             return None, encoding
 
@@ -169,7 +173,7 @@
         but non-standard types.
         """
         type = type.lower()
-        extensions = self.types_map_inv[True].get(type, [])
+        extensions = list(self.types_map_inv[True].get(type, []))
         if not strict:
             for ext in self.types_map_inv[False].get(type, []):
                 if ext not in extensions:
@@ -237,10 +241,21 @@
         types.
         """
 
-        # Windows only
-        if not _winreg:
+        if not _mimetypes_read_windows_registry and not _winreg:
             return
 
+        add_type = self.add_type
+        if strict:
+            add_type = lambda type, ext: self.add_type(type, ext, True)
+
+        # Accelerated function if it is available
+        if _mimetypes_read_windows_registry:
+            _mimetypes_read_windows_registry(add_type)
+        elif _winreg:
+            self._read_windows_registry(add_type)
+
+    @classmethod
+    def _read_windows_registry(cls, add_type):
         def enum_types(mimedb):
             i = 0
             while True:
@@ -265,7 +280,7 @@
                             subkey, 'Content Type')
                         if datatype != _winreg.REG_SZ:
                             continue
-                        self.add_type(mimetype, subkeyname, strict)
+                        add_type(mimetype, subkeyname)
                 except OSError:
                     continue
 
@@ -349,8 +364,8 @@
 
     if files is None or _db is None:
         db = MimeTypes()
-        if _winreg:
-            db.read_windows_registry()
+        # Quick return if not supported
+        db.read_windows_registry()
 
         if files is None:
             files = knownfiles
@@ -448,6 +463,7 @@
         '.dvi'    : 'application/x-dvi',
         '.gtar'   : 'application/x-gtar',
         '.hdf'    : 'application/x-hdf',
+        '.h5'     : 'application/x-hdf5',
         '.latex'  : 'application/x-latex',
         '.mif'    : 'application/x-mif',
         '.cdf'    : 'application/x-netcdf',
@@ -480,10 +496,19 @@
         '.wsdl'   : 'application/xml',
         '.xpdl'   : 'application/xml',
         '.zip'    : 'application/zip',
+        '.3gp'    : 'audio/3gpp',
+        '.3gpp'   : 'audio/3gpp',
+        '.3g2'    : 'audio/3gpp2',
+        '.3gpp2'  : 'audio/3gpp2',
+        '.aac'    : 'audio/aac',
+        '.adts'   : 'audio/aac',
+        '.loas'   : 'audio/aac',
+        '.ass'    : 'audio/aac',
         '.au'     : 'audio/basic',
         '.snd'    : 'audio/basic',
         '.mp3'    : 'audio/mpeg',
         '.mp2'    : 'audio/mpeg',
+        '.opus'   : 'audio/opus',
         '.aif'    : 'audio/x-aiff',
         '.aifc'   : 'audio/x-aiff',
         '.aiff'   : 'audio/x-aiff',
@@ -495,6 +520,8 @@
         '.jpg'    : 'image/jpeg',
         '.jpe'    : 'image/jpeg',
         '.jpeg'   : 'image/jpeg',
+        '.heic'   : 'image/heic',
+        '.heif'   : 'image/heif',
         '.png'    : 'image/png',
         '.svg'    : 'image/svg+xml',
         '.tiff'   : 'image/tiff',
diff --git a/Lib/msilib/schema.py b/Lib/msilib/schema.py
index eeb3ecd..9f5745c 100644
--- a/Lib/msilib/schema.py
+++ b/Lib/msilib/schema.py
@@ -664,7 +664,7 @@
 ('Class','Component_','N',None, None, 'Component',1,'Identifier',None, 'Required foreign key into the Component Table, specifying the component for which to return a path when called through LocateComponent.',),
 ('Class','Context','N',None, None, None, None, 'Identifier',None, 'The numeric server context for this server. CLSCTX_xxxx',),
 ('Class','DefInprocHandler','Y',None, None, None, None, 'Filename','1;2;3','Optional default inproc handler.  Only optionally provided if Context=CLSCTX_LOCAL_SERVER.  Typically "ole32.dll" or "mapi32.dll"',),
-('Class','FileTypeMask','Y',None, None, None, None, 'Text',None, 'Optional string containing information for the HKCRthis CLSID) key. If multiple patterns exist, they must be delimited by a semicolon, and numeric subkeys will be generated: 0,1,2...',),
+('Class','FileTypeMask','Y',None, None, None, None, 'Text',None, 'Optional string containing information for the HKCRthis CLSID key. If multiple patterns exist, they must be delimited by a semicolon, and numeric subkeys will be generated: 0,1,2...',),
 ('Class','Icon_','Y',None, None, 'Icon',1,'Identifier',None, 'Optional foreign key into the Icon Table, specifying the icon file associated with this CLSID. Will be written under the DefaultIcon key.',),
 ('Class','IconIndex','Y',-32767,32767,None, None, None, None, 'Optional icon index.',),
 ('Class','ProgId_Default','Y',None, None, 'ProgId',1,'Text',None, 'Optional ProgId associated with this CLSID.',),
diff --git a/Lib/multiprocessing/managers.py b/Lib/multiprocessing/managers.py
index 0eb16c6..b6b4cdd 100644
--- a/Lib/multiprocessing/managers.py
+++ b/Lib/multiprocessing/managers.py
@@ -8,8 +8,7 @@
 # Licensed to PSF under a Contributor Agreement.
 #
 
-__all__ = [ 'BaseManager', 'SyncManager', 'BaseProxy', 'Token',
-            'SharedMemoryManager' ]
+__all__ = [ 'BaseManager', 'SyncManager', 'BaseProxy', 'Token' ]
 
 #
 # Imports
@@ -35,9 +34,11 @@
 from . import get_context
 try:
     from . import shared_memory
-    HAS_SHMEM = True
 except ImportError:
     HAS_SHMEM = False
+else:
+    HAS_SHMEM = True
+    __all__.append('SharedMemoryManager')
 
 #
 # Register some things for pickling
@@ -192,11 +193,8 @@
             t.daemon = True
             t.start()
 
-    def handle_request(self, c):
-        '''
-        Handle a new connection
-        '''
-        funcname = result = request = None
+    def _handle_request(self, c):
+        request = None
         try:
             connection.deliver_challenge(c, self.authkey)
             connection.answer_challenge(c, self.authkey)
@@ -213,6 +211,7 @@
                 msg = ('#TRACEBACK', format_exc())
             else:
                 msg = ('#RETURN', result)
+
         try:
             c.send(msg)
         except Exception as e:
@@ -224,7 +223,17 @@
             util.info(' ... request was %r', request)
             util.info(' ... exception was %r', e)
 
-        c.close()
+    def handle_request(self, conn):
+        '''
+        Handle a new connection
+        '''
+        try:
+            self._handle_request(conn)
+        except SystemExit:
+            # Server.serve_client() calls sys.exit(0) on EOF
+            pass
+        finally:
+            conn.close()
 
     def serve_client(self, conn):
         '''
@@ -959,7 +968,7 @@
 
 
 def AutoProxy(token, serializer, manager=None, authkey=None,
-              exposed=None, incref=True):
+              exposed=None, incref=True, manager_owned=False):
     '''
     Return an auto-proxy for `token`
     '''
@@ -979,7 +988,7 @@
 
     ProxyType = MakeProxyType('AutoProxy[%s]' % token.typeid, exposed)
     proxy = ProxyType(token, serializer, manager=manager, authkey=authkey,
-                      incref=incref)
+                      incref=incref, manager_owned=manager_owned)
     proxy._isauto = True
     return proxy
 
diff --git a/Lib/multiprocessing/resource_tracker.py b/Lib/multiprocessing/resource_tracker.py
index c9bfa9b..cc42dbd 100644
--- a/Lib/multiprocessing/resource_tracker.py
+++ b/Lib/multiprocessing/resource_tracker.py
@@ -37,8 +37,16 @@
     import _multiprocessing
     import _posixshmem
 
+    # Use sem_unlink() to clean up named semaphores.
+    #
+    # sem_unlink() may be missing if the Python build process detected the
+    # absence of POSIX named semaphores. In that case, no named semaphores were
+    # ever opened, so no cleanup would be necessary.
+    if hasattr(_multiprocessing, 'sem_unlink'):
+        _CLEANUP_FUNCS.update({
+            'semaphore': _multiprocessing.sem_unlink,
+        })
     _CLEANUP_FUNCS.update({
-        'semaphore': _multiprocessing.sem_unlink,
         'shared_memory': _posixshmem.shm_unlink,
     })
 
diff --git a/Lib/multiprocessing/util.py b/Lib/multiprocessing/util.py
index 21f2a7e..a468333 100644
--- a/Lib/multiprocessing/util.py
+++ b/Lib/multiprocessing/util.py
@@ -419,7 +419,7 @@
     try:
         fd = os.open(os.devnull, os.O_RDONLY)
         try:
-            sys.stdin = open(fd, closefd=False)
+            sys.stdin = open(fd, encoding="utf-8", closefd=False)
         except:
             os.close(fd)
             raise
diff --git a/Lib/netrc.py b/Lib/netrc.py
index f0ae48c..734d94c 100644
--- a/Lib/netrc.py
+++ b/Lib/netrc.py
@@ -26,8 +26,12 @@
             file = os.path.join(os.path.expanduser("~"), ".netrc")
         self.hosts = {}
         self.macros = {}
-        with open(file) as fp:
-            self._parse(file, fp, default_netrc)
+        try:
+            with open(file, encoding="utf-8") as fp:
+                self._parse(file, fp, default_netrc)
+        except UnicodeDecodeError:
+            with open(file, encoding="locale") as fp:
+                self._parse(file, fp, default_netrc)
 
     def _parse(self, file, fp, default_netrc):
         lexer = shlex.shlex(fp)
diff --git a/Lib/ntpath.py b/Lib/ntpath.py
index 6f77177..527c7ae 100644
--- a/Lib/ntpath.py
+++ b/Lib/ntpath.py
@@ -312,12 +312,25 @@
             drive = ''
         userhome = join(drive, os.environ['HOMEPATH'])
 
+    if i != 1: #~user
+        target_user = path[1:i]
+        if isinstance(target_user, bytes):
+            target_user = os.fsdecode(target_user)
+        current_user = os.environ.get('USERNAME')
+
+        if target_user != current_user:
+            # Try to guess user home directory.  By default all user
+            # profile directories are located in the same place and are
+            # named by corresponding usernames.  If userhome isn't a
+            # normal profile directory, this guess is likely wrong,
+            # so we bail out.
+            if current_user != basename(userhome):
+                return path
+            userhome = join(dirname(userhome), target_user)
+
     if isinstance(path, bytes):
         userhome = os.fsencode(userhome)
 
-    if i != 1: #~user
-        userhome = join(dirname(userhome), path[1:i])
-
     return userhome + path[i:]
 
 
@@ -622,7 +635,7 @@
                 tail = join(name, tail) if tail else name
         return tail
 
-    def realpath(path):
+    def realpath(path, *, strict=False):
         path = normpath(path)
         if isinstance(path, bytes):
             prefix = b'\\\\?\\'
@@ -647,6 +660,8 @@
             path = _getfinalpathname(path)
             initial_winerror = 0
         except OSError as ex:
+            if strict:
+                raise
             initial_winerror = ex.winerror
             path = _getfinalpathname_nonstrict(path)
         # The path returned by _getfinalpathname will always start with \\?\ -
diff --git a/Lib/nturl2path.py b/Lib/nturl2path.py
index 853e660..61852af 100644
--- a/Lib/nturl2path.py
+++ b/Lib/nturl2path.py
@@ -50,6 +50,14 @@
     # becomes
     #   ///C:/foo/bar/spam.foo
     import urllib.parse
+    # First, clean up some special forms. We are going to sacrifice
+    # the additional information anyway
+    if p[:4] == '\\\\?\\':
+        p = p[4:]
+        if p[:4].upper() == 'UNC\\':
+            p = '\\' + p[4:]
+        elif p[1:2] != ':':
+            raise OSError('Bad path: ' + p)
     if not ':' in p:
         # No drive specifier, just convert slashes and quote the name
         if p[:2] == '\\\\':
@@ -59,7 +67,7 @@
             p = '\\\\' + p
         components = p.split('\\')
         return urllib.parse.quote('/'.join(components))
-    comp = p.split(':')
+    comp = p.split(':', maxsplit=2)
     if len(comp) != 2 or len(comp[0]) > 1:
         error = 'Bad path: ' + p
         raise OSError(error)
diff --git a/Lib/numbers.py b/Lib/numbers.py
index ed815ef..5b98e64 100644
--- a/Lib/numbers.py
+++ b/Lib/numbers.py
@@ -33,7 +33,7 @@
     """Complex defines the operations that work on the builtin complex type.
 
     In short, those are: a conversion to complex, .real, .imag, +, -,
-    *, /, abs(), .conjugate, ==, and !=.
+    *, /, **, abs(), .conjugate, ==, and !=.
 
     If it is given heterogeneous arguments, and doesn't have special
     knowledge about them, it should fall back to the builtin complex
@@ -292,7 +292,11 @@
 
 
 class Integral(Rational):
-    """Integral adds a conversion to int and the bit-string operations."""
+    """Integral adds methods that work on integral numbers.
+
+    In short, these are conversion to int, pow with modulus, and the
+    bit-string operations.
+    """
 
     __slots__ = ()
 
diff --git a/Lib/opcode.py b/Lib/opcode.py
index ac1aa53..37e88e9 100644
--- a/Lib/opcode.py
+++ b/Lib/opcode.py
@@ -67,7 +67,6 @@
 def_op('UNARY_NOT', 12)
 
 def_op('UNARY_INVERT', 15)
-
 def_op('BINARY_MATRIX_MULTIPLY', 16)
 def_op('INPLACE_MATRIX_MULTIPLY', 17)
 
@@ -82,8 +81,12 @@
 def_op('BINARY_TRUE_DIVIDE', 27)
 def_op('INPLACE_FLOOR_DIVIDE', 28)
 def_op('INPLACE_TRUE_DIVIDE', 29)
+def_op('GET_LEN', 30)
+def_op('MATCH_MAPPING', 31)
+def_op('MATCH_SEQUENCE', 32)
+def_op('MATCH_KEYS', 33)
+def_op('COPY_DICT_WITHOUT_KEYS', 34)
 
-def_op('RERAISE', 48)
 def_op('WITH_EXCEPT_START', 49)
 def_op('GET_AITER', 50)
 def_op('GET_ANEXT', 51)
@@ -105,7 +108,6 @@
 def_op('INPLACE_POWER', 67)
 def_op('GET_ITER', 68)
 def_op('GET_YIELD_FROM_ITER', 69)
-
 def_op('PRINT_EXPR', 70)
 def_op('LOAD_BUILD_CLASS', 71)
 def_op('YIELD_FROM', 72)
@@ -137,6 +139,7 @@
 name_op('DELETE_ATTR', 96)      # ""
 name_op('STORE_GLOBAL', 97)     # ""
 name_op('DELETE_GLOBAL', 98)    # ""
+def_op('ROT_N', 99)
 def_op('LOAD_CONST', 100)       # Index in const list
 hasconst.append(100)
 name_op('LOAD_NAME', 101)       # Index in name list
@@ -149,18 +152,16 @@
 hascompare.append(107)
 name_op('IMPORT_NAME', 108)     # Index in name list
 name_op('IMPORT_FROM', 109)     # Index in name list
-
 jrel_op('JUMP_FORWARD', 110)    # Number of bytes to skip
 jabs_op('JUMP_IF_FALSE_OR_POP', 111) # Target byte offset from beginning of code
 jabs_op('JUMP_IF_TRUE_OR_POP', 112)  # ""
 jabs_op('JUMP_ABSOLUTE', 113)        # ""
 jabs_op('POP_JUMP_IF_FALSE', 114)    # ""
 jabs_op('POP_JUMP_IF_TRUE', 115)     # ""
-
 name_op('LOAD_GLOBAL', 116)     # Index in name list
-
 def_op('IS_OP', 117)
 def_op('CONTAINS_OP', 118)
+def_op('RERAISE', 119)
 
 jabs_op('JUMP_IF_NOT_EXC_MATCH', 121)
 jrel_op('SETUP_FINALLY', 122)   # Distance to target address
@@ -172,10 +173,12 @@
 def_op('DELETE_FAST', 126)      # Local variable number
 haslocal.append(126)
 
+def_op('GEN_START', 129)        # Kind of generator/coroutine
 def_op('RAISE_VARARGS', 130)    # Number of raise arguments (1, 2, or 3)
 def_op('CALL_FUNCTION', 131)    # #args
 def_op('MAKE_FUNCTION', 132)    # Flags
 def_op('BUILD_SLICE', 133)      # Number of items
+
 def_op('LOAD_CLOSURE', 135)
 hasfree.append(135)
 def_op('LOAD_DEREF', 136)
@@ -187,28 +190,24 @@
 
 def_op('CALL_FUNCTION_KW', 141)  # #args + #kwargs
 def_op('CALL_FUNCTION_EX', 142)  # Flags
-
 jrel_op('SETUP_WITH', 143)
-
+def_op('EXTENDED_ARG', 144)
+EXTENDED_ARG = 144
 def_op('LIST_APPEND', 145)
 def_op('SET_ADD', 146)
 def_op('MAP_ADD', 147)
-
 def_op('LOAD_CLASSDEREF', 148)
 hasfree.append(148)
 
-def_op('EXTENDED_ARG', 144)
-EXTENDED_ARG = 144
+def_op('MATCH_CLASS', 152)
 
 jrel_op('SETUP_ASYNC_WITH', 154)
-
 def_op('FORMAT_VALUE', 155)
 def_op('BUILD_CONST_KEY_MAP', 156)
 def_op('BUILD_STRING', 157)
 
 name_op('LOAD_METHOD', 160)
 def_op('CALL_METHOD', 161)
-
 def_op('LIST_EXTEND', 162)
 def_op('SET_UPDATE', 163)
 def_op('DICT_MERGE', 164)
diff --git a/Lib/operator.py b/Lib/operator.py
index fb58851..241fdbb 100644
--- a/Lib/operator.py
+++ b/Lib/operator.py
@@ -155,10 +155,10 @@
     return b in a
 
 def countOf(a, b):
-    "Return the number of times b occurs in a."
+    "Return the number of items in a which are, or which equal, b."
     count = 0
     for i in a:
-        if i == b:
+        if i is b or i == b:
             count += 1
     return count
 
@@ -173,7 +173,7 @@
 def indexOf(a, b):
     "Return the first index of b in a."
     for i, j in enumerate(a):
-        if j == b:
+        if j is b or j == b:
             return i
     else:
         raise ValueError('sequence.index(x): x not in sequence')
diff --git a/Lib/os.py b/Lib/os.py
index b794159..d26cfc9 100644
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -36,7 +36,7 @@
 __all__ = ["altsep", "curdir", "pardir", "sep", "pathsep", "linesep",
            "defpath", "name", "path", "devnull", "SEEK_SET", "SEEK_CUR",
            "SEEK_END", "fsencode", "fsdecode", "get_exec_path", "fdopen",
-           "popen", "extsep"]
+           "extsep"]
 
 def _exists(name):
     return name in globals()
@@ -969,58 +969,64 @@
 
     __all__.extend(["spawnlp", "spawnlpe"])
 
-
-# Supply os.popen()
-def popen(cmd, mode="r", buffering=-1):
-    if not isinstance(cmd, str):
-        raise TypeError("invalid cmd type (%s, expected string)" % type(cmd))
-    if mode not in ("r", "w"):
-        raise ValueError("invalid mode %r" % mode)
-    if buffering == 0 or buffering is None:
-        raise ValueError("popen() does not support unbuffered streams")
-    import subprocess, io
-    if mode == "r":
-        proc = subprocess.Popen(cmd,
-                                shell=True,
-                                stdout=subprocess.PIPE,
-                                bufsize=buffering)
-        return _wrap_close(io.TextIOWrapper(proc.stdout), proc)
-    else:
-        proc = subprocess.Popen(cmd,
-                                shell=True,
-                                stdin=subprocess.PIPE,
-                                bufsize=buffering)
-        return _wrap_close(io.TextIOWrapper(proc.stdin), proc)
-
-# Helper for popen() -- a proxy for a file whose close waits for the process
-class _wrap_close:
-    def __init__(self, stream, proc):
-        self._stream = stream
-        self._proc = proc
-    def close(self):
-        self._stream.close()
-        returncode = self._proc.wait()
-        if returncode == 0:
-            return None
-        if name == 'nt':
-            return returncode
+# VxWorks has no user space shell provided. As a result, running
+# command in a shell can't be supported.
+if sys.platform != 'vxworks':
+    # Supply os.popen()
+    def popen(cmd, mode="r", buffering=-1):
+        if not isinstance(cmd, str):
+            raise TypeError("invalid cmd type (%s, expected string)" % type(cmd))
+        if mode not in ("r", "w"):
+            raise ValueError("invalid mode %r" % mode)
+        if buffering == 0 or buffering is None:
+            raise ValueError("popen() does not support unbuffered streams")
+        import subprocess, io
+        if mode == "r":
+            proc = subprocess.Popen(cmd,
+                                    shell=True, text=True,
+                                    stdout=subprocess.PIPE,
+                                    bufsize=buffering)
+            return _wrap_close(proc.stdout, proc)
         else:
-            return returncode << 8  # Shift left to match old behavior
-    def __enter__(self):
-        return self
-    def __exit__(self, *args):
-        self.close()
-    def __getattr__(self, name):
-        return getattr(self._stream, name)
-    def __iter__(self):
-        return iter(self._stream)
+            proc = subprocess.Popen(cmd,
+                                    shell=True, text=True,
+                                    stdin=subprocess.PIPE,
+                                    bufsize=buffering)
+            return _wrap_close(proc.stdin, proc)
+
+    # Helper for popen() -- a proxy for a file whose close waits for the process
+    class _wrap_close:
+        def __init__(self, stream, proc):
+            self._stream = stream
+            self._proc = proc
+        def close(self):
+            self._stream.close()
+            returncode = self._proc.wait()
+            if returncode == 0:
+                return None
+            if name == 'nt':
+                return returncode
+            else:
+                return returncode << 8  # Shift left to match old behavior
+        def __enter__(self):
+            return self
+        def __exit__(self, *args):
+            self.close()
+        def __getattr__(self, name):
+            return getattr(self._stream, name)
+        def __iter__(self):
+            return iter(self._stream)
+
+    __all__.append("popen")
 
 # Supply os.fdopen()
-def fdopen(fd, *args, **kwargs):
+def fdopen(fd, mode="r", buffering=-1, encoding=None, *args, **kwargs):
     if not isinstance(fd, int):
         raise TypeError("invalid fd type (%s, expected integer)" % type(fd))
     import io
-    return io.open(fd, *args, **kwargs)
+    if "b" not in mode:
+        encoding = io.text_encoding(encoding)
+    return io.open(fd, mode, buffering, encoding, *args, **kwargs)
 
 
 # For testing purposes, make sure the function is available when the C
diff --git a/Lib/pathlib.py b/Lib/pathlib.py
index 147be2f..621fba0 100644
--- a/Lib/pathlib.py
+++ b/Lib/pathlib.py
@@ -6,6 +6,7 @@
 import posixpath
 import re
 import sys
+import warnings
 from _collections_abc import Sequence
 from errno import EINVAL, ENOENT, ENOTDIR, EBADF, ELOOP
 from operator import attrgetter
@@ -13,18 +14,6 @@
 from urllib.parse import quote_from_bytes as urlquote_from_bytes
 
 
-supports_symlinks = True
-if os.name == 'nt':
-    import nt
-    if sys.getwindowsversion()[:2] >= (6, 0):
-        from nt import _getfinalpathname
-    else:
-        supports_symlinks = False
-        _getfinalpathname = None
-else:
-    nt = None
-
-
 __all__ = [
     "PurePath", "PurePosixPath", "PureWindowsPath",
     "Path", "PosixPath", "WindowsPath",
@@ -34,13 +23,17 @@
 # Internals
 #
 
+_WINERROR_NOT_READY = 21  # drive exists but is not accessible
+_WINERROR_INVALID_NAME = 123  # fix for bpo-35306
+_WINERROR_CANT_RESOLVE_FILENAME = 1921  # broken symlink pointing to itself
+
 # EBADF - guard against macOS `stat` throwing EBADF
 _IGNORED_ERROS = (ENOENT, ENOTDIR, EBADF, ELOOP)
 
 _IGNORED_WINERRORS = (
-    21,  # ERROR_NOT_READY - drive exists but is not accessible
-    1921,  # ERROR_CANT_RESOLVE_FILENAME - fix for broken symlink pointing to itself
-)
+    _WINERROR_NOT_READY,
+    _WINERROR_INVALID_NAME,
+    _WINERROR_CANT_RESOLVE_FILENAME)
 
 def _ignore_error(exception):
     return (getattr(exception, 'errno', None) in _IGNORED_ERROS or
@@ -131,16 +124,25 @@
     ext_namespace_prefix = '\\\\?\\'
 
     reserved_names = (
-        {'CON', 'PRN', 'AUX', 'NUL'} |
-        {'COM%d' % i for i in range(1, 10)} |
-        {'LPT%d' % i for i in range(1, 10)}
+        {'CON', 'PRN', 'AUX', 'NUL', 'CONIN$', 'CONOUT$'} |
+        {'COM%s' % c for c in '123456789\xb9\xb2\xb3'} |
+        {'LPT%s' % c for c in '123456789\xb9\xb2\xb3'}
         )
 
     # Interesting findings about extended paths:
-    # - '\\?\c:\a', '//?/c:\a' and '//?/c:/a' are all supported
-    #   but '\\?\c:/a' is not
-    # - extended paths are always absolute; "relative" extended paths will
-    #   fail.
+    # * '\\?\c:\a' is an extended path, which bypasses normal Windows API
+    #   path processing. Thus relative paths are not resolved and slash is not
+    #   translated to backslash. It has the native NT path limit of 32767
+    #   characters, but a bit less after resolving device symbolic links,
+    #   such as '\??\C:' => '\Device\HarddiskVolume2'.
+    # * '\\?\c:/a' looks for a device named 'C:/a' because slash is a
+    #   regular name character in the object namespace.
+    # * '\\?\c:\foo/bar' is invalid because '/' is illegal in NT filesystems.
+    #   The only path separator at the filesystem level is backslash.
+    # * '//?/c:\a' and '//?/c:/a' are effectively equivalent to '\\.\c:\a' and
+    #   thus limited to MAX_PATH.
+    # * Prior to Windows 8, ANSI API bytes paths are limited to MAX_PATH,
+    #   even with the '\\?\' prefix.
 
     def splitroot(self, part, sep=sep):
         first = part[0:1]
@@ -190,30 +192,6 @@
     def compile_pattern(self, pattern):
         return re.compile(fnmatch.translate(pattern), re.IGNORECASE).fullmatch
 
-    def resolve(self, path, strict=False):
-        s = str(path)
-        if not s:
-            return os.getcwd()
-        previous_s = None
-        if _getfinalpathname is not None:
-            if strict:
-                return self._ext_to_normal(_getfinalpathname(s))
-            else:
-                tail_parts = []  # End of the path after the first one not found
-                while True:
-                    try:
-                        s = self._ext_to_normal(_getfinalpathname(s))
-                    except FileNotFoundError:
-                        previous_s = s
-                        s, tail = os.path.split(s)
-                        tail_parts.append(tail)
-                        if previous_s == s:
-                            return path
-                    else:
-                        return os.path.join(s, *reversed(tail_parts))
-        # Means fallback on absolute
-        return None
-
     def _split_extended_path(self, s, ext_prefix=ext_namespace_prefix):
         prefix = ''
         if s.startswith(ext_prefix):
@@ -224,21 +202,18 @@
                 s = '\\' + s[3:]
         return prefix, s
 
-    def _ext_to_normal(self, s):
-        # Turn back an extended path into a normal DOS-like path
-        return self._split_extended_path(s)[1]
-
     def is_reserved(self, parts):
         # NOTE: the rules for reserved names seem somewhat complicated
-        # (e.g. r"..\NUL" is reserved but not r"foo\NUL").
-        # We err on the side of caution and return True for paths which are
-        # not considered reserved by Windows.
+        # (e.g. r"..\NUL" is reserved but not r"foo\NUL" if "foo" does not
+        # exist). We err on the side of caution and return True for paths
+        # which are not considered reserved by Windows.
         if not parts:
             return False
         if parts[0].startswith('\\\\'):
             # UNC paths are never reserved
             return False
-        return parts[-1].partition('.')[0].upper() in self.reserved_names
+        name = parts[-1].partition('.')[0].partition(':')[0].rstrip(' ')
+        return name.upper() in self.reserved_names
 
     def make_uri(self, path):
         # Under Windows, file URIs use the UTF-8 encoding.
@@ -252,34 +227,6 @@
             # It's a path on a network drive => 'file://host/share/a/b'
             return 'file:' + urlquote_from_bytes(path.as_posix().encode('utf-8'))
 
-    def gethomedir(self, username):
-        if 'USERPROFILE' in os.environ:
-            userhome = os.environ['USERPROFILE']
-        elif 'HOMEPATH' in os.environ:
-            try:
-                drv = os.environ['HOMEDRIVE']
-            except KeyError:
-                drv = ''
-            userhome = drv + os.environ['HOMEPATH']
-        else:
-            raise RuntimeError("Can't determine home directory")
-
-        if username:
-            # Try to guess user home directory.  By default all users
-            # directories are located in the same place and are named by
-            # corresponding usernames.  If current user home directory points
-            # to nonstandard place, this guess is likely wrong.
-            if os.environ['USERNAME'] != username:
-                drv, root, parts = self.parse_parts((userhome,))
-                if parts[-1] != os.environ['USERNAME']:
-                    raise RuntimeError("Can't determine home directory "
-                                       "for %r" % username)
-                parts[-1] = username
-                if drv or root:
-                    userhome = drv + root + self.join(parts[1:])
-                else:
-                    userhome = self.join(parts)
-        return userhome
 
 class _PosixFlavour(_Flavour):
     sep = '/'
@@ -313,54 +260,6 @@
     def compile_pattern(self, pattern):
         return re.compile(fnmatch.translate(pattern)).fullmatch
 
-    def resolve(self, path, strict=False):
-        sep = self.sep
-        accessor = path._accessor
-        seen = {}
-        def _resolve(path, rest):
-            if rest.startswith(sep):
-                path = ''
-
-            for name in rest.split(sep):
-                if not name or name == '.':
-                    # current dir
-                    continue
-                if name == '..':
-                    # parent dir
-                    path, _, _ = path.rpartition(sep)
-                    continue
-                if path.endswith(sep):
-                    newpath = path + name
-                else:
-                    newpath = path + sep + name
-                if newpath in seen:
-                    # Already seen this path
-                    path = seen[newpath]
-                    if path is not None:
-                        # use cached value
-                        continue
-                    # The symlink is not resolved, so we must have a symlink loop.
-                    raise RuntimeError("Symlink loop from %r" % newpath)
-                # Resolve the symbolic link
-                try:
-                    target = accessor.readlink(newpath)
-                except OSError as e:
-                    if e.errno != EINVAL and strict:
-                        raise
-                    # Not a symlink, or non-strict mode. We just leave the path
-                    # untouched.
-                    path = newpath
-                else:
-                    seen[newpath] = None # not resolved symlink
-                    path = _resolve(path, target)
-                    seen[newpath] = path # resolved symlink
-
-            return path
-        # NOTE: according to POSIX, getcwd() cannot contain path components
-        # which are symlinks.
-        base = '' if path.is_absolute() else os.getcwd()
-        return _resolve(base, str(path)) or sep
-
     def is_reserved(self, parts):
         return False
 
@@ -370,21 +269,6 @@
         bpath = bytes(path)
         return 'file://' + urlquote_from_bytes(bpath)
 
-    def gethomedir(self, username):
-        if not username:
-            try:
-                return os.environ['HOME']
-            except KeyError:
-                import pwd
-                return pwd.getpwuid(os.getuid()).pw_dir
-        else:
-            import pwd
-            try:
-                return pwd.getpwnam(username).pw_dir
-            except KeyError:
-                raise RuntimeError("Can't determine home directory "
-                                   "for %r" % username)
-
 
 _windows_flavour = _WindowsFlavour()
 _posix_flavour = _PosixFlavour()
@@ -399,9 +283,7 @@
 
     stat = os.stat
 
-    lstat = os.lstat
-
-    open = os.open
+    open = io.open
 
     listdir = os.listdir
 
@@ -409,21 +291,14 @@
 
     chmod = os.chmod
 
-    if hasattr(os, "lchmod"):
-        lchmod = os.lchmod
-    else:
-        def lchmod(self, pathobj, mode):
-            raise NotImplementedError("lchmod() not available on this system")
-
     mkdir = os.mkdir
 
     unlink = os.unlink
 
     if hasattr(os, "link"):
-        link_to = os.link
+        link = os.link
     else:
-        @staticmethod
-        def link_to(self, target):
+        def link(self, src, dst):
             raise NotImplementedError("os.link() not available on this system")
 
     rmdir = os.rmdir
@@ -432,23 +307,35 @@
 
     replace = os.replace
 
-    if nt:
-        if supports_symlinks:
-            symlink = os.symlink
-        else:
-            def symlink(a, b, target_is_directory):
-                raise NotImplementedError("symlink() not available on this system")
+    if hasattr(os, "symlink"):
+        symlink = os.symlink
     else:
-        # Under POSIX, os.symlink() takes two args
-        @staticmethod
-        def symlink(a, b, target_is_directory):
-            return os.symlink(a, b)
+        def symlink(self, src, dst, target_is_directory=False):
+            raise NotImplementedError("os.symlink() not available on this system")
 
-    utime = os.utime
+    def touch(self, path, mode=0o666, exist_ok=True):
+        if exist_ok:
+            # First try to bump modification time
+            # Implementation note: GNU touch uses the UTIME_NOW option of
+            # the utimensat() / futimens() functions.
+            try:
+                os.utime(path, None)
+            except OSError:
+                # Avoid exception chaining
+                pass
+            else:
+                return
+        flags = os.O_CREAT | os.O_WRONLY
+        if not exist_ok:
+            flags |= os.O_EXCL
+        fd = os.open(path, flags, mode)
+        os.close(fd)
 
-    # Helper for resolve()
-    def readlink(self, path):
-        return os.readlink(path)
+    if hasattr(os, "readlink"):
+        readlink = os.readlink
+    else:
+        def readlink(self, path):
+            raise NotImplementedError("os.readlink() not available on this system")
 
     def owner(self, path):
         try:
@@ -464,6 +351,12 @@
         except ImportError:
             raise NotImplementedError("Path.group() is unsupported on this system")
 
+    getcwd = os.getcwd
+
+    expanduser = staticmethod(os.path.expanduser)
+
+    realpath = staticmethod(os.path.realpath)
+
 
 _normal_accessor = _NormalAccessor()
 
@@ -630,7 +523,10 @@
             return len(self._parts)
 
     def __getitem__(self, idx):
-        if idx < 0 or idx >= len(self):
+        if isinstance(idx, slice):
+            return tuple(self[i] for i in range(*idx.indices(len(self))))
+
+        if idx >= len(self) or idx < -len(self):
             raise IndexError(idx)
         return self._pathcls._from_parsed_parts(self._drv, self._root,
                                                 self._parts[:-idx - 1])
@@ -689,7 +585,7 @@
         return cls._flavour.parse_parts(parts)
 
     @classmethod
-    def _from_parts(cls, args, init=True):
+    def _from_parts(cls, args):
         # We need to call _parse_args on the instance, so as to get the
         # right flavour.
         self = object.__new__(cls)
@@ -697,18 +593,14 @@
         self._drv = drv
         self._root = root
         self._parts = parts
-        if init:
-            self._init()
         return self
 
     @classmethod
-    def _from_parsed_parts(cls, drv, root, parts, init=True):
+    def _from_parsed_parts(cls, drv, root, parts):
         self = object.__new__(cls)
         self._drv = drv
         self._root = root
         self._parts = parts
-        if init:
-            self._init()
         return self
 
     @classmethod
@@ -718,10 +610,6 @@
         else:
             return cls._flavour.join(parts)
 
-    def _init(self):
-        # Overridden in concrete Path
-        pass
-
     def _make_child(self, args):
         drv, root, parts = self._parse_args(args)
         drv, root, parts = self._flavour.join_parsed_parts(
@@ -1061,29 +949,18 @@
     object. You can also instantiate a PosixPath or WindowsPath directly,
     but cannot instantiate a WindowsPath on a POSIX system or vice versa.
     """
-    __slots__ = (
-        '_accessor',
-    )
+    _accessor = _normal_accessor
+    __slots__ = ()
 
     def __new__(cls, *args, **kwargs):
         if cls is Path:
             cls = WindowsPath if os.name == 'nt' else PosixPath
-        self = cls._from_parts(args, init=False)
+        self = cls._from_parts(args)
         if not self._flavour.is_supported:
             raise NotImplementedError("cannot instantiate %r on your system"
                                       % (cls.__name__,))
-        self._init()
         return self
 
-    def _init(self,
-              # Private non-constructor arguments
-              template=None,
-              ):
-        if template is not None:
-            self._accessor = template._accessor
-        else:
-            self._accessor = _normal_accessor
-
     def _make_child_relpath(self, part):
         # This is an optimization used for dir walking.  `part` must be
         # a single part relative to this path.
@@ -1104,17 +981,6 @@
         # removed in the future.
         pass
 
-    def _opener(self, name, flags, mode=0o666):
-        # A stub for the opener argument to built-in open()
-        return self._accessor.open(self, flags, mode)
-
-    def _raw_open(self, flags, mode=0o777):
-        """
-        Open the file pointed by this path and return a file descriptor,
-        as os.open() does.
-        """
-        return self._accessor.open(self, flags, mode)
-
     # Public API
 
     @classmethod
@@ -1122,14 +988,14 @@
         """Return a new path pointing to the current working directory
         (as returned by os.getcwd()).
         """
-        return cls(os.getcwd())
+        return cls(cls._accessor.getcwd())
 
     @classmethod
     def home(cls):
         """Return a new path pointing to the user's home directory (as
         returned by os.path.expanduser('~')).
         """
-        return cls(cls()._flavour.gethomedir(None))
+        return cls("~").expanduser()
 
     def samefile(self, other_path):
         """Return whether other_path is the same or not as this file
@@ -1191,9 +1057,7 @@
             return self
         # FIXME this must defer to the specific flavour (and, under Windows,
         # use nt._getfullpathname())
-        obj = self._from_parts([os.getcwd()] + self._parts, init=False)
-        obj._init(template=self)
-        return obj
+        return self._from_parts([self._accessor.getcwd()] + self._parts)
 
     def resolve(self, strict=False):
         """
@@ -1201,24 +1065,34 @@
         normalizing it (for example turning slashes into backslashes under
         Windows).
         """
-        s = self._flavour.resolve(self, strict=strict)
-        if s is None:
-            # No symlink resolution => for consistency, raise an error if
-            # the path doesn't exist or is forbidden
-            self.stat()
-            s = str(self.absolute())
-        # Now we have no symlinks in the path, it's safe to normalize it.
-        normed = self._flavour.pathmod.normpath(s)
-        obj = self._from_parts((normed,), init=False)
-        obj._init(template=self)
-        return obj
 
-    def stat(self):
+        def check_eloop(e):
+            winerror = getattr(e, 'winerror', 0)
+            if e.errno == ELOOP or winerror == _WINERROR_CANT_RESOLVE_FILENAME:
+                raise RuntimeError("Symlink loop from %r" % e.filename)
+
+        try:
+            s = self._accessor.realpath(self, strict=strict)
+        except OSError as e:
+            check_eloop(e)
+            raise
+        p = self._from_parts((s,))
+
+        # In non-strict mode, realpath() doesn't raise on symlink loops.
+        # Ensure we get an exception by calling stat()
+        if not strict:
+            try:
+                p.stat()
+            except OSError as e:
+                check_eloop(e)
+        return p
+
+    def stat(self, *, follow_symlinks=True):
         """
         Return the result of the stat() system call on this path, like
         os.stat() does.
         """
-        return self._accessor.stat(self)
+        return self._accessor.stat(self, follow_symlinks=follow_symlinks)
 
     def owner(self):
         """
@@ -1238,8 +1112,10 @@
         Open the file pointed by this path and return a file object, as
         the built-in open() function does.
         """
-        return io.open(self, mode, buffering, encoding, errors, newline,
-                       opener=self._opener)
+        if "b" not in mode:
+            encoding = io.text_encoding(encoding)
+        return self._accessor.open(self, mode, buffering, encoding, errors,
+                                   newline)
 
     def read_bytes(self):
         """
@@ -1252,6 +1128,7 @@
         """
         Open the file in text mode, read it, and close the file.
         """
+        encoding = io.text_encoding(encoding)
         with self.open(mode='r', encoding=encoding, errors=errors) as f:
             return f.read()
 
@@ -1264,14 +1141,15 @@
         with self.open(mode='wb') as f:
             return f.write(view)
 
-    def write_text(self, data, encoding=None, errors=None):
+    def write_text(self, data, encoding=None, errors=None, newline=None):
         """
         Open the file in text mode, write to it, and close the file.
         """
         if not isinstance(data, str):
             raise TypeError('data must be str, not %s' %
                             data.__class__.__name__)
-        with self.open(mode='w', encoding=encoding, errors=errors) as f:
+        encoding = io.text_encoding(encoding)
+        with self.open(mode='w', encoding=encoding, errors=errors, newline=newline) as f:
             return f.write(data)
 
     def readlink(self):
@@ -1279,30 +1157,13 @@
         Return the path to which the symbolic link points.
         """
         path = self._accessor.readlink(self)
-        obj = self._from_parts((path,), init=False)
-        obj._init(template=self)
-        return obj
+        return self._from_parts((path,))
 
     def touch(self, mode=0o666, exist_ok=True):
         """
         Create this file with the given access mode, if it doesn't exist.
         """
-        if exist_ok:
-            # First try to bump modification time
-            # Implementation note: GNU touch uses the UTIME_NOW option of
-            # the utimensat() / futimens() functions.
-            try:
-                self._accessor.utime(self, None)
-            except OSError:
-                # Avoid exception chaining
-                pass
-            else:
-                return
-        flags = os.O_CREAT | os.O_WRONLY
-        if not exist_ok:
-            flags |= os.O_EXCL
-        fd = self._raw_open(flags, mode)
-        os.close(fd)
+        self._accessor.touch(self, mode, exist_ok)
 
     def mkdir(self, mode=0o777, parents=False, exist_ok=False):
         """
@@ -1321,18 +1182,18 @@
             if not exist_ok or not self.is_dir():
                 raise
 
-    def chmod(self, mode):
+    def chmod(self, mode, *, follow_symlinks=True):
         """
         Change the permissions of the path, like os.chmod().
         """
-        self._accessor.chmod(self, mode)
+        self._accessor.chmod(self, mode, follow_symlinks=follow_symlinks)
 
     def lchmod(self, mode):
         """
         Like chmod(), except if the path points to a symlink, the symlink's
         permissions are changed, rather than its target's.
         """
-        self._accessor.lchmod(self, mode)
+        self.chmod(mode, follow_symlinks=False)
 
     def unlink(self, missing_ok=False):
         """
@@ -1356,13 +1217,7 @@
         Like stat(), except if the path points to a symlink, the symlink's
         status information is returned, rather than its target's.
         """
-        return self._accessor.lstat(self)
-
-    def link_to(self, target):
-        """
-        Create a hard link pointing to a path named target.
-        """
-        self._accessor.link_to(self, target)
+        return self.stat(follow_symlinks=False)
 
     def rename(self, target):
         """
@@ -1392,11 +1247,37 @@
 
     def symlink_to(self, target, target_is_directory=False):
         """
-        Make this path a symlink pointing to the given path.
-        Note the order of arguments (self, target) is the reverse of os.symlink's.
+        Make this path a symlink pointing to the target path.
+        Note the order of arguments (link, target) is the reverse of os.symlink.
         """
         self._accessor.symlink(target, self, target_is_directory)
 
+    def hardlink_to(self, target):
+        """
+        Make this path a hard link pointing to the same file as *target*.
+
+        Note the order of arguments (self, target) is the reverse of os.link's.
+        """
+        self._accessor.link(target, self)
+
+    def link_to(self, target):
+        """
+        Make the target path a hard link pointing to this path.
+
+        Note this function does not make this path a hard link to *target*,
+        despite the implication of the function and argument names. The order
+        of arguments (target, link) is the reverse of Path.symlink_to, but
+        matches that of os.link.
+
+        Deprecated since Python 3.10 and scheduled for removal in Python 3.12.
+        Use `hardlink_to()` instead.
+        """
+        warnings.warn("pathlib.Path.link_to() is deprecated and is scheduled "
+                      "for removal in Python 3.12. "
+                      "Use pathlib.Path.hardlink_to() instead.",
+                      DeprecationWarning, stacklevel=2)
+        self._accessor.link(self, target)
+
     # Convenience functions for querying the stat results
 
     def exists(self):
@@ -1424,7 +1305,7 @@
             if not _ignore_error(e):
                 raise
             # Path doesn't exist or is a broken symlink
-            # (see https://bitbucket.org/pitrou/pathlib/issue/12/)
+            # (see http://web.archive.org/web/20200623061726/https://bitbucket.org/pitrou/pathlib/issues/12/ )
             return False
         except ValueError:
             # Non-encodable path
@@ -1441,7 +1322,7 @@
             if not _ignore_error(e):
                 raise
             # Path doesn't exist or is a broken symlink
-            # (see https://bitbucket.org/pitrou/pathlib/issue/12/)
+            # (see http://web.archive.org/web/20200623061726/https://bitbucket.org/pitrou/pathlib/issues/12/ )
             return False
         except ValueError:
             # Non-encodable path
@@ -1492,7 +1373,7 @@
             if not _ignore_error(e):
                 raise
             # Path doesn't exist or is a broken symlink
-            # (see https://bitbucket.org/pitrou/pathlib/issue/12/)
+            # (see http://web.archive.org/web/20200623061726/https://bitbucket.org/pitrou/pathlib/issues/12/ )
             return False
         except ValueError:
             # Non-encodable path
@@ -1508,7 +1389,7 @@
             if not _ignore_error(e):
                 raise
             # Path doesn't exist or is a broken symlink
-            # (see https://bitbucket.org/pitrou/pathlib/issue/12/)
+            # (see http://web.archive.org/web/20200623061726/https://bitbucket.org/pitrou/pathlib/issues/12/ )
             return False
         except ValueError:
             # Non-encodable path
@@ -1524,7 +1405,7 @@
             if not _ignore_error(e):
                 raise
             # Path doesn't exist or is a broken symlink
-            # (see https://bitbucket.org/pitrou/pathlib/issue/12/)
+            # (see http://web.archive.org/web/20200623061726/https://bitbucket.org/pitrou/pathlib/issues/12/ )
             return False
         except ValueError:
             # Non-encodable path
@@ -1540,7 +1421,7 @@
             if not _ignore_error(e):
                 raise
             # Path doesn't exist or is a broken symlink
-            # (see https://bitbucket.org/pitrou/pathlib/issue/12/)
+            # (see http://web.archive.org/web/20200623061726/https://bitbucket.org/pitrou/pathlib/issues/12/ )
             return False
         except ValueError:
             # Non-encodable path
@@ -1552,7 +1433,9 @@
         """
         if (not (self._drv or self._root) and
             self._parts and self._parts[0][:1] == '~'):
-            homedir = self._flavour.gethomedir(self._parts[0][1:])
+            homedir = self._accessor.expanduser(self._parts[0])
+            if homedir[:1] == "~":
+                raise RuntimeError("Could not determine home directory.")
             return self._from_parts([homedir] + self._parts[1:])
 
         return self
diff --git a/Lib/pdb.py b/Lib/pdb.py
index d7d9571..7ab50b4 100755
--- a/Lib/pdb.py
+++ b/Lib/pdb.py
@@ -384,8 +384,7 @@
                 sys.stdin = save_stdin
                 sys.displayhook = save_displayhook
         except:
-            exc_info = sys.exc_info()[:2]
-            self.error(traceback.format_exception_only(*exc_info)[-1].strip())
+            self._error_exc()
 
     def precmd(self, line):
         """Handle alias expansion and ';;' separator."""
@@ -752,7 +751,8 @@
         """
         # this method should be callable before starting debugging, so default
         # to "no globals" if there is no current frame
-        globs = self.curframe.f_globals if hasattr(self, 'curframe') else None
+        frame = getattr(self, 'curframe', None)
+        globs = frame.f_globals if frame else None
         line = linecache.getline(filename, lineno, globs)
         if not line:
             self.message('End of file')
@@ -893,7 +893,7 @@
             except ValueError:
                 err = "Invalid line number (%s)" % arg
             else:
-                bplist = self.get_breaks(filename, lineno)
+                bplist = self.get_breaks(filename, lineno)[:]
                 err = self.clear_break(filename, lineno)
             if err:
                 self.error(err)
@@ -1026,7 +1026,11 @@
         if arg:
             import shlex
             argv0 = sys.argv[0:1]
-            sys.argv = shlex.split(arg)
+            try:
+                sys.argv = shlex.split(arg)
+            except ValueError as e:
+                self.error('Cannot run %s: %s' % (arg, e))
+                return
             sys.argv[:0] = argv0
         # this is caught in the main debugger loop
         raise Restart
@@ -1103,8 +1107,7 @@
         try:
             sys.call_tracing(p.run, (arg, globals, locals))
         except Exception:
-            exc_info = sys.exc_info()[:2]
-            self.error(traceback.format_exception_only(*exc_info)[-1].strip())
+            self._error_exc()
         self.message("LEAVING RECURSIVE DEBUGGER")
         sys.settrace(self.trace_dispatch)
         self.lastcmd = p.lastcmd
@@ -1162,8 +1165,7 @@
         try:
             return eval(arg, self.curframe.f_globals, self.curframe_locals)
         except:
-            exc_info = sys.exc_info()[:2]
-            self.error(traceback.format_exception_only(*exc_info)[-1].strip())
+            self._error_exc()
             raise
 
     def _getval_except(self, arg, frame=None):
@@ -1177,23 +1179,31 @@
             err = traceback.format_exception_only(*exc_info)[-1].strip()
             return _rstr('** raised %s **' % err)
 
+    def _error_exc(self):
+        exc_info = sys.exc_info()[:2]
+        self.error(traceback.format_exception_only(*exc_info)[-1].strip())
+
+    def _msg_val_func(self, arg, func):
+        try:
+            val = self._getval(arg)
+        except:
+            return  # _getval() has displayed the error
+        try:
+            self.message(func(val))
+        except:
+            self._error_exc()
+
     def do_p(self, arg):
         """p expression
         Print the value of the expression.
         """
-        try:
-            self.message(repr(self._getval(arg)))
-        except:
-            pass
+        self._msg_val_func(arg, repr)
 
     def do_pp(self, arg):
         """pp expression
         Pretty-print the value of the expression.
         """
-        try:
-            self.message(pprint.pformat(self._getval(arg)))
-        except:
-            pass
+        self._msg_val_func(arg, pprint.pformat)
 
     complete_print = _complete_expression
     complete_p = _complete_expression
@@ -1483,6 +1493,9 @@
                 self.error('No help for %r; please do not run Python with -OO '
                            'if you need command help' % arg)
                 return
+            if command.__doc__ is None:
+                self.error('No help for %r; __doc__ string missing' % arg)
+                return
             self.message(command.__doc__.rstrip())
 
     do_h = do_help
@@ -1684,10 +1697,19 @@
         print('Error:', mainpyfile, 'does not exist')
         sys.exit(1)
 
+    if run_as_module:
+        import runpy
+        try:
+            runpy._get_module_details(mainpyfile)
+        except Exception:
+            traceback.print_exc()
+            sys.exit(1)
+
     sys.argv[:] = args      # Hide "pdb.py" and pdb options from argument list
 
-    # Replace pdb's dir with script's dir in front of module search path.
     if not run_as_module:
+        mainpyfile = os.path.realpath(mainpyfile)
+        # Replace pdb's dir with script's dir in front of module search path.
         sys.path[0] = os.path.dirname(mainpyfile)
 
     # Note on saving/restoring sys.argv: it's a good idea when sys.argv was
@@ -1707,7 +1729,7 @@
             print("The program finished and will be restarted")
         except Restart:
             print("Restarting", mainpyfile, "with arguments:")
-            print("\t" + " ".join(args))
+            print("\t" + " ".join(sys.argv[1:]))
         except SystemExit:
             # In most cases SystemExit does not warrant a post-mortem session.
             print("The program exited via sys.exit(). Exit status:", end=' ')
diff --git a/Lib/pickle.py b/Lib/pickle.py
index e63a8b6..e7f30f2 100644
--- a/Lib/pickle.py
+++ b/Lib/pickle.py
@@ -818,6 +818,7 @@
             self._write_large_bytes(BYTEARRAY8 + pack("<Q", n), obj)
         else:
             self.write(BYTEARRAY8 + pack("<Q", n) + obj)
+        self.memoize(obj)
     dispatch[bytearray] = save_bytearray
 
     if _HAVE_PICKLE_BUFFER:
@@ -1172,7 +1173,7 @@
         used in Python 3.  The *encoding* and *errors* tell pickle how
         to decode 8-bit string instances pickled by Python 2; these
         default to 'ASCII' and 'strict', respectively. *encoding* can be
-        'bytes' to read theses 8-bit string instances as bytes objects.
+        'bytes' to read these 8-bit string instances as bytes objects.
         """
         self._buffers = iter(buffers) if buffers is not None else None
         self._file_readline = file.readline
diff --git a/Lib/pipes.py b/Lib/pipes.py
index f1a16f6..8cc74b0 100644
--- a/Lib/pipes.py
+++ b/Lib/pipes.py
@@ -109,7 +109,7 @@
 
     def append(self, cmd, kind):
         """t.append(cmd, kind) adds a new step at the end."""
-        if type(cmd) is not type(''):
+        if not isinstance(cmd, str):
             raise TypeError('Template.append: cmd must be a string')
         if kind not in stepkinds:
             raise ValueError('Template.append: bad kind %r' % (kind,))
@@ -125,7 +125,7 @@
 
     def prepend(self, cmd, kind):
         """t.prepend(cmd, kind) adds a new step at the front."""
-        if type(cmd) is not type(''):
+        if not isinstance(cmd, str):
             raise TypeError('Template.prepend: cmd must be a string')
         if kind not in stepkinds:
             raise ValueError('Template.prepend: bad kind %r' % (kind,))
diff --git a/Lib/pkgutil.py b/Lib/pkgutil.py
index 4c18467..8e010c7 100644
--- a/Lib/pkgutil.py
+++ b/Lib/pkgutil.py
@@ -7,7 +7,6 @@
 import importlib.machinery
 import os
 import os.path
-import re
 import sys
 from types import ModuleType
 import warnings
@@ -205,7 +204,8 @@
 
     def __init__(self, path=None):
         global imp
-        warnings.warn("This emulation is deprecated, use 'importlib' instead",
+        warnings.warn("This emulation is deprecated and slated for removal "
+                      "in Python 3.12; use 'importlib' instead",
              DeprecationWarning)
         _import_imp()
         self.path = path
@@ -272,7 +272,8 @@
     code = source = None
 
     def __init__(self, fullname, file, filename, etc):
-        warnings.warn("This emulation is deprecated, use 'importlib' instead",
+        warnings.warn("This emulation is deprecated and slated for removal in "
+                      "Python 3.12; use 'importlib' instead",
                       DeprecationWarning)
         _import_imp()
         self.file = file
@@ -638,9 +639,7 @@
     return loader.get_data(resource_name)
 
 
-_DOTTED_WORDS = r'(?!\d)(\w+)(\.(?!\d)(\w+))*'
-_NAME_PATTERN = re.compile(f'^(?P<pkg>{_DOTTED_WORDS})(?P<cln>:(?P<obj>{_DOTTED_WORDS})?)?$', re.U)
-del _DOTTED_WORDS
+_NAME_PATTERN = None
 
 def resolve_name(name):
     """
@@ -672,8 +671,17 @@
     ValueError - if `name` isn't in a recognised format
     ImportError - if an import failed when it shouldn't have
     AttributeError - if a failure occurred when traversing the object hierarchy
-                     within the imported package to get to the desired object)
+                     within the imported package to get to the desired object.
     """
+    global _NAME_PATTERN
+    if _NAME_PATTERN is None:
+        # Lazy import to speedup Python startup time
+        import re
+        dotted_words = r'(?!\d)(\w+)(\.(?!\d)(\w+))*'
+        _NAME_PATTERN = re.compile(f'^(?P<pkg>{dotted_words})'
+                                   f'(?P<cln>:(?P<obj>{dotted_words})?)?$',
+                                   re.UNICODE)
+
     m = _NAME_PATTERN.match(name)
     if not m:
         raise ValueError(f'invalid format: {name!r}')
diff --git a/Lib/platform.py b/Lib/platform.py
index e9f50ab..e32f9c1 100755
--- a/Lib/platform.py
+++ b/Lib/platform.py
@@ -174,7 +174,7 @@
         The file is read and scanned in chunks of chunksize bytes.
 
     """
-    if executable is None:
+    if not executable:
         try:
             ver = os.confstr('CS_GNU_LIBC_VERSION')
             # parse 'glibc 2.28' as ('glibc', '2.28')
@@ -239,11 +239,9 @@
     if build:
         l.append(build)
     try:
-        ints = map(int, l)
+        strings = list(map(str, map(int, l)))
     except ValueError:
         strings = l
-    else:
-        strings = list(map(str, ints))
     version = '.'.join(strings[:3])
     return version
 
@@ -282,6 +280,7 @@
     for cmd in ('ver', 'command /c ver', 'cmd /c ver'):
         try:
             info = subprocess.check_output(cmd,
+                                           stdin=subprocess.DEVNULL,
                                            stderr=subprocess.DEVNULL,
                                            text=True,
                                            shell=True)
@@ -365,17 +364,20 @@
         return release, version, csd, ptype
 
     winver = getwindowsversion()
-    maj, min, build = winver.platform_version or winver[:3]
-    version = '{0}.{1}.{2}'.format(maj, min, build)
+    try:
+        major, minor, build = map(int, _syscmd_ver()[2].split('.'))
+    except ValueError:
+        major, minor, build = winver.platform_version or winver[:3]
+    version = '{0}.{1}.{2}'.format(major, minor, build)
 
-    release = (_WIN32_CLIENT_RELEASES.get((maj, min)) or
-               _WIN32_CLIENT_RELEASES.get((maj, None)) or
+    release = (_WIN32_CLIENT_RELEASES.get((major, minor)) or
+               _WIN32_CLIENT_RELEASES.get((major, None)) or
                release)
 
     # getwindowsversion() reflect the compatibility mode Python is
     # running under, and so the service pack value is only going to be
     # valid if the versions match.
-    if winver[:2] == (maj, min):
+    if winver[:2] == (major, minor):
         try:
             csd = 'SP{}'.format(winver.service_pack_major)
         except AttributeError:
@@ -384,8 +386,8 @@
 
     # VER_NT_SERVER = 3
     if getattr(winver, 'product_type', None) == 3:
-        release = (_WIN32_SERVER_RELEASES.get((maj, min)) or
-                   _WIN32_SERVER_RELEASES.get((maj, None)) or
+        release = (_WIN32_SERVER_RELEASES.get((major, minor)) or
+                   _WIN32_SERVER_RELEASES.get((major, None)) or
                    release)
 
     try:
@@ -524,16 +526,6 @@
             # XXX Whatever the new SunOS marketing name is...
             system = 'Solaris'
 
-    elif system == 'IRIX64':
-        # IRIX reports IRIX64 on platforms with 64-bit support; yet it
-        # is really a version and not a different platform, since 32-bit
-        # apps are also supported..
-        system = 'IRIX'
-        if version:
-            version = version + ' (64bit)'
-        else:
-            version = '64bit'
-
     elif system in ('win32', 'win16'):
         # In case one of the other tricks
         system = 'Windows'
@@ -698,9 +690,6 @@
     # Bits
     if '32-bit' in fileout:
         bits = '32bit'
-    elif 'N32' in fileout:
-        # On Irix only
-        bits = 'n32bit'
     elif '64-bit' in fileout:
         bits = '64bit'
 
@@ -782,7 +771,7 @@
         ):
     """
     A uname_result that's largely compatible with a
-    simple namedtuple except that 'platform' is
+    simple namedtuple except that 'processor' is
     resolved late and cached to avoid calling "uname"
     except when needed.
     """
@@ -797,12 +786,25 @@
             (self.processor,)
         )
 
+    @classmethod
+    def _make(cls, iterable):
+        # override factory to affect length check
+        num_fields = len(cls._fields)
+        result = cls.__new__(cls, *iterable)
+        if len(result) != num_fields + 1:
+            msg = f'Expected {num_fields} arguments, got {len(result)}'
+            raise TypeError(msg)
+        return result
+
     def __getitem__(self, key):
-        return tuple(iter(self))[key]
+        return tuple(self)[key]
 
     def __len__(self):
         return len(tuple(iter(self)))
 
+    def __reduce__(self):
+        return uname_result, tuple(self)[:len(self._fields)]
+
 
 _uname_cache = None
 
@@ -1243,6 +1245,63 @@
     _platform_cache[(aliased, terse)] = platform
     return platform
 
+### freedesktop.org os-release standard
+# https://www.freedesktop.org/software/systemd/man/os-release.html
+
+# NAME=value with optional quotes (' or "). The regular expression is less
+# strict than shell lexer, but that's ok.
+_os_release_line = re.compile(
+    "^(?P<name>[a-zA-Z0-9_]+)=(?P<quote>[\"\']?)(?P<value>.*)(?P=quote)$"
+)
+# unescape five special characters mentioned in the standard
+_os_release_unescape = re.compile(r"\\([\\\$\"\'`])")
+# /etc takes precedence over /usr/lib
+_os_release_candidates = ("/etc/os-release", "/usr/lib/os-release")
+_os_release_cache = None
+
+
+def _parse_os_release(lines):
+    # These fields are mandatory fields with well-known defaults
+    # in practice all Linux distributions override NAME, ID, and PRETTY_NAME.
+    info = {
+        "NAME": "Linux",
+        "ID": "linux",
+        "PRETTY_NAME": "Linux",
+    }
+
+    for line in lines:
+        mo = _os_release_line.match(line)
+        if mo is not None:
+            info[mo.group('name')] = _os_release_unescape.sub(
+                r"\1", mo.group('value')
+            )
+
+    return info
+
+
+def freedesktop_os_release():
+    """Return operation system identification from freedesktop.org os-release
+    """
+    global _os_release_cache
+
+    if _os_release_cache is None:
+        errno = None
+        for candidate in _os_release_candidates:
+            try:
+                with open(candidate, encoding="utf-8") as f:
+                    _os_release_cache = _parse_os_release(f)
+                break
+            except OSError as e:
+                errno = e.errno
+        else:
+            raise OSError(
+                errno,
+                f"Unable to read files {', '.join(_os_release_candidates)}"
+            )
+
+    return _os_release_cache.copy()
+
+
 ### Command line interface
 
 if __name__ == '__main__':
diff --git a/Lib/posixpath.py b/Lib/posixpath.py
index ecb4e5a..1953746 100644
--- a/Lib/posixpath.py
+++ b/Lib/posixpath.py
@@ -262,6 +262,9 @@
             # password database, return the path unchanged
             return path
         userhome = pwent.pw_dir
+    # if no user home, return the path unchanged on VxWorks
+    if userhome is None and sys.platform == "vxworks":
+        return path
     if isinstance(path, bytes):
         userhome = os.fsencode(userhome)
         root = b'/'
@@ -349,6 +352,7 @@
     initial_slashes = path.startswith(sep)
     # POSIX allows one or two initial slashes, but treats three or more
     # as single slash.
+    # (see http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13)
     if (initial_slashes and
         path.startswith(sep*2) and not path.startswith(sep*3)):
         initial_slashes = 2
@@ -384,16 +388,16 @@
 # Return a canonical path (i.e. the absolute location of a file on the
 # filesystem).
 
-def realpath(filename):
+def realpath(filename, *, strict=False):
     """Return the canonical path of the specified filename, eliminating any
 symbolic links encountered in the path."""
     filename = os.fspath(filename)
-    path, ok = _joinrealpath(filename[:0], filename, {})
+    path, ok = _joinrealpath(filename[:0], filename, strict, {})
     return abspath(path)
 
 # Join two paths, normalizing and eliminating any symbolic links
 # encountered in the second path.
-def _joinrealpath(path, rest, seen):
+def _joinrealpath(path, rest, strict, seen):
     if isinstance(path, bytes):
         sep = b'/'
         curdir = b'.'
@@ -422,7 +426,15 @@
                 path = pardir
             continue
         newpath = join(path, name)
-        if not islink(newpath):
+        try:
+            st = os.lstat(newpath)
+        except OSError:
+            if strict:
+                raise
+            is_link = False
+        else:
+            is_link = stat.S_ISLNK(st.st_mode)
+        if not is_link:
             path = newpath
             continue
         # Resolve the symbolic link
@@ -433,10 +445,14 @@
                 # use cached value
                 continue
             # The symlink is not resolved, so we must have a symlink loop.
-            # Return already resolved part + rest of the path unchanged.
-            return join(newpath, rest), False
+            if strict:
+                # Raise OSError(errno.ELOOP)
+                os.stat(newpath)
+            else:
+                # Return already resolved part + rest of the path unchanged.
+                return join(newpath, rest), False
         seen[newpath] = None # not resolved symlink
-        path, ok = _joinrealpath(path, os.readlink(newpath), seen)
+        path, ok = _joinrealpath(path, os.readlink(newpath), strict, seen)
         if not ok:
             return join(path, rest), False
         seen[newpath] = path # resolved symlink
diff --git a/Lib/pprint.py b/Lib/pprint.py
index 7c1118a..d91421f 100644
--- a/Lib/pprint.py
+++ b/Lib/pprint.py
@@ -35,6 +35,7 @@
 """
 
 import collections as _collections
+import dataclasses as _dataclasses
 import re
 import sys as _sys
 import types as _types
@@ -45,18 +46,20 @@
 
 
 def pprint(object, stream=None, indent=1, width=80, depth=None, *,
-           compact=False, sort_dicts=True):
+           compact=False, sort_dicts=True, underscore_numbers=False):
     """Pretty-print a Python object to a stream [default is sys.stdout]."""
     printer = PrettyPrinter(
         stream=stream, indent=indent, width=width, depth=depth,
-        compact=compact, sort_dicts=sort_dicts)
+        compact=compact, sort_dicts=sort_dicts,
+        underscore_numbers=underscore_numbers)
     printer.pprint(object)
 
 def pformat(object, indent=1, width=80, depth=None, *,
-            compact=False, sort_dicts=True):
+            compact=False, sort_dicts=True, underscore_numbers=False):
     """Format a Python object into a pretty-printed representation."""
     return PrettyPrinter(indent=indent, width=width, depth=depth,
-                         compact=compact, sort_dicts=sort_dicts).pformat(object)
+                         compact=compact, sort_dicts=sort_dicts,
+                         underscore_numbers=underscore_numbers).pformat(object)
 
 def pp(object, *args, sort_dicts=False, **kwargs):
     """Pretty-print a Python object"""
@@ -64,15 +67,15 @@
 
 def saferepr(object):
     """Version of repr() which can handle recursive data structures."""
-    return _safe_repr(object, {}, None, 0, True)[0]
+    return PrettyPrinter()._safe_repr(object, {}, None, 0)[0]
 
 def isreadable(object):
     """Determine if saferepr(object) is readable by eval()."""
-    return _safe_repr(object, {}, None, 0, True)[1]
+    return PrettyPrinter()._safe_repr(object, {}, None, 0)[1]
 
 def isrecursive(object):
     """Determine if object requires a recursive representation."""
-    return _safe_repr(object, {}, None, 0, True)[2]
+    return PrettyPrinter()._safe_repr(object, {}, None, 0)[2]
 
 class _safe_key:
     """Helper function for key functions when sorting unorderable objects.
@@ -102,7 +105,7 @@
 
 class PrettyPrinter:
     def __init__(self, indent=1, width=80, depth=None, stream=None, *,
-                 compact=False, sort_dicts=True):
+                 compact=False, sort_dicts=True, underscore_numbers=False):
         """Handle pretty printing operations onto a stream using a set of
         configured parameters.
 
@@ -143,6 +146,7 @@
             self._stream = _sys.stdout
         self._compact = bool(compact)
         self._sort_dicts = sort_dicts
+        self._underscore_numbers = underscore_numbers
 
     def pprint(self, object):
         self._format(object, self._stream, 0, 0, {}, 0)
@@ -176,14 +180,26 @@
                 p(self, object, stream, indent, allowance, context, level + 1)
                 del context[objid]
                 return
-            elif isinstance(object, dict):
+            elif (_dataclasses.is_dataclass(object) and
+                  not isinstance(object, type) and
+                  object.__dataclass_params__.repr and
+                  # Check dataclass has generated repr method.
+                  hasattr(object.__repr__, "__wrapped__") and
+                  "__create_fn__" in object.__repr__.__wrapped__.__qualname__):
                 context[objid] = 1
-                self._pprint_dict(object, stream, indent, allowance,
-                                  context, level + 1)
+                self._pprint_dataclass(object, stream, indent, allowance, context, level + 1)
                 del context[objid]
                 return
         stream.write(rep)
 
+    def _pprint_dataclass(self, object, stream, indent, allowance, context, level):
+        cls_name = object.__class__.__name__
+        indent += len(cls_name) + 1
+        items = [(f.name, getattr(object, f.name)) for f in _dataclasses.fields(object) if f.repr]
+        stream.write(cls_name + '(')
+        self._format_namespace_items(items, stream, indent, allowance, context, level)
+        stream.write(')')
+
     _dispatch = {}
 
     def _pprint_dict(self, object, stream, indent, allowance, context, level):
@@ -350,21 +366,9 @@
         else:
             cls_name = object.__class__.__name__
         indent += len(cls_name) + 1
-        delimnl = ',\n' + ' ' * indent
         items = object.__dict__.items()
-        last_index = len(items) - 1
-
         stream.write(cls_name + '(')
-        for i, (key, ent) in enumerate(items):
-            stream.write(key)
-            stream.write('=')
-
-            last = i == last_index
-            self._format(ent, stream, indent + len(key) + 1,
-                         allowance if last else 1,
-                         context, level)
-            if not last:
-                stream.write(delimnl)
+        self._format_namespace_items(items, stream, indent, allowance, context, level)
         stream.write(')')
 
     _dispatch[_types.SimpleNamespace.__repr__] = _pprint_simplenamespace
@@ -386,6 +390,25 @@
             if not last:
                 write(delimnl)
 
+    def _format_namespace_items(self, items, stream, indent, allowance, context, level):
+        write = stream.write
+        delimnl = ',\n' + ' ' * indent
+        last_index = len(items) - 1
+        for i, (key, ent) in enumerate(items):
+            last = i == last_index
+            write(key)
+            write('=')
+            if id(ent) in context:
+                # Special-case representation of recursion to match standard
+                # recursive dataclass repr.
+                write("...")
+            else:
+                self._format(ent, stream, indent + len(key) + 1,
+                             allowance if last else 1,
+                             context, level)
+            if not last:
+                write(delimnl)
+
     def _format_items(self, items, stream, indent, allowance, context, level):
         write = stream.write
         indent += self._indent_per_level
@@ -441,7 +464,7 @@
         and flags indicating whether the representation is 'readable'
         and whether the object represents a recursive construct.
         """
-        return _safe_repr(object, context, maxlevels, level, self._sort_dicts)
+        return self._safe_repr(object, context, maxlevels, level)
 
     def _pprint_default_dict(self, object, stream, indent, allowance, context, level):
         if not len(object):
@@ -524,79 +547,88 @@
 
     _dispatch[_collections.UserString.__repr__] = _pprint_user_string
 
-# Return triple (repr_string, isreadable, isrecursive).
+    def _safe_repr(self, object, context, maxlevels, level):
+        # Return triple (repr_string, isreadable, isrecursive).
+        typ = type(object)
+        if typ in _builtin_scalars:
+            return repr(object), True, False
 
-def _safe_repr(object, context, maxlevels, level, sort_dicts):
-    typ = type(object)
-    if typ in _builtin_scalars:
-        return repr(object), True, False
+        r = getattr(typ, "__repr__", None)
 
-    r = getattr(typ, "__repr__", None)
-    if issubclass(typ, dict) and r is dict.__repr__:
-        if not object:
-            return "{}", True, False
-        objid = id(object)
-        if maxlevels and level >= maxlevels:
-            return "{...}", False, objid in context
-        if objid in context:
-            return _recursion(object), False, True
-        context[objid] = 1
-        readable = True
-        recursive = False
-        components = []
-        append = components.append
-        level += 1
-        if sort_dicts:
-            items = sorted(object.items(), key=_safe_tuple)
-        else:
-            items = object.items()
-        for k, v in items:
-            krepr, kreadable, krecur = _safe_repr(k, context, maxlevels, level, sort_dicts)
-            vrepr, vreadable, vrecur = _safe_repr(v, context, maxlevels, level, sort_dicts)
-            append("%s: %s" % (krepr, vrepr))
-            readable = readable and kreadable and vreadable
-            if krecur or vrecur:
-                recursive = True
-        del context[objid]
-        return "{%s}" % ", ".join(components), readable, recursive
+        if issubclass(typ, int) and r is int.__repr__:
+            if self._underscore_numbers:
+                return f"{object:_d}", True, False
+            else:
+                return repr(object), True, False
 
-    if (issubclass(typ, list) and r is list.__repr__) or \
-       (issubclass(typ, tuple) and r is tuple.__repr__):
-        if issubclass(typ, list):
+        if issubclass(typ, dict) and r is dict.__repr__:
             if not object:
-                return "[]", True, False
-            format = "[%s]"
-        elif len(object) == 1:
-            format = "(%s,)"
-        else:
-            if not object:
-                return "()", True, False
-            format = "(%s)"
-        objid = id(object)
-        if maxlevels and level >= maxlevels:
-            return format % "...", False, objid in context
-        if objid in context:
-            return _recursion(object), False, True
-        context[objid] = 1
-        readable = True
-        recursive = False
-        components = []
-        append = components.append
-        level += 1
-        for o in object:
-            orepr, oreadable, orecur = _safe_repr(o, context, maxlevels, level, sort_dicts)
-            append(orepr)
-            if not oreadable:
-                readable = False
-            if orecur:
-                recursive = True
-        del context[objid]
-        return format % ", ".join(components), readable, recursive
+                return "{}", True, False
+            objid = id(object)
+            if maxlevels and level >= maxlevels:
+                return "{...}", False, objid in context
+            if objid in context:
+                return _recursion(object), False, True
+            context[objid] = 1
+            readable = True
+            recursive = False
+            components = []
+            append = components.append
+            level += 1
+            if self._sort_dicts:
+                items = sorted(object.items(), key=_safe_tuple)
+            else:
+                items = object.items()
+            for k, v in items:
+                krepr, kreadable, krecur = self.format(
+                    k, context, maxlevels, level)
+                vrepr, vreadable, vrecur = self.format(
+                    v, context, maxlevels, level)
+                append("%s: %s" % (krepr, vrepr))
+                readable = readable and kreadable and vreadable
+                if krecur or vrecur:
+                    recursive = True
+            del context[objid]
+            return "{%s}" % ", ".join(components), readable, recursive
 
-    rep = repr(object)
-    return rep, (rep and not rep.startswith('<')), False
+        if (issubclass(typ, list) and r is list.__repr__) or \
+           (issubclass(typ, tuple) and r is tuple.__repr__):
+            if issubclass(typ, list):
+                if not object:
+                    return "[]", True, False
+                format = "[%s]"
+            elif len(object) == 1:
+                format = "(%s,)"
+            else:
+                if not object:
+                    return "()", True, False
+                format = "(%s)"
+            objid = id(object)
+            if maxlevels and level >= maxlevels:
+                return format % "...", False, objid in context
+            if objid in context:
+                return _recursion(object), False, True
+            context[objid] = 1
+            readable = True
+            recursive = False
+            components = []
+            append = components.append
+            level += 1
+            for o in object:
+                orepr, oreadable, orecur = self.format(
+                    o, context, maxlevels, level)
+                append(orepr)
+                if not oreadable:
+                    readable = False
+                if orecur:
+                    recursive = True
+            del context[objid]
+            return format % ", ".join(components), readable, recursive
 
-_builtin_scalars = frozenset({str, bytes, bytearray, int, float, complex,
+        rep = repr(object)
+        return rep, (rep and not rep.startswith('<')), False
+
+_builtin_scalars = frozenset({str, bytes, bytearray, float, complex,
                               bool, type(None)})
 
 def _recursion(object):
@@ -610,7 +642,7 @@
         object = [("string", (1, 2), [3, 4], {5: 6, 7: 8})] * 100000
     p = PrettyPrinter()
     t1 = time.perf_counter()
-    _safe_repr(object, {}, None, 0, True)
+    p._safe_repr(object, {}, None, 0, True)
     t2 = time.perf_counter()
     p.pformat(object)
     t3 = time.perf_counter()
diff --git a/Lib/profile.py b/Lib/profile.py
index 5cb017e..d8599fb 100755
--- a/Lib/profile.py
+++ b/Lib/profile.py
@@ -595,7 +595,12 @@
                 '__package__': None,
                 '__cached__': None,
             }
-        runctx(code, globs, None, options.outfile, options.sort)
+        try:
+            runctx(code, globs, None, options.outfile, options.sort)
+        except BrokenPipeError as exc:
+            # Prevent "Exception ignored" during interpreter shutdown.
+            sys.stdout = None
+            sys.exit(exc.errno)
     else:
         parser.print_usage()
     return parser
diff --git a/Lib/pty.py b/Lib/pty.py
index a324320..8d8ce40 100644
--- a/Lib/pty.py
+++ b/Lib/pty.py
@@ -1,7 +1,7 @@
 """Pseudo terminal utilities."""
 
 # Bugs: No signal handling.  Doesn't set slave termios and window size.
-#       Only tested on Linux.
+#       Only tested on Linux, FreeBSD, and macOS.
 # See:  W. Richard Stevens. 1992.  Advanced Programming in the
 #       UNIX Environment.  Chapter 19.
 # Author: Steen Lumholt -- with additions by Guido.
@@ -11,7 +11,11 @@
 import sys
 import tty
 
-__all__ = ["openpty","fork","spawn"]
+# names imported directly for test mocking purposes
+from os import close, waitpid
+from tty import setraw, tcgetattr, tcsetattr
+
+__all__ = ["openpty", "fork", "spawn"]
 
 STDIN_FILENO = 0
 STDOUT_FILENO = 1
@@ -105,8 +109,8 @@
         os.dup2(slave_fd, STDIN_FILENO)
         os.dup2(slave_fd, STDOUT_FILENO)
         os.dup2(slave_fd, STDERR_FILENO)
-        if (slave_fd > STDERR_FILENO):
-            os.close (slave_fd)
+        if slave_fd > STDERR_FILENO:
+            os.close(slave_fd)
 
         # Explicitly open the tty to make it become a controlling tty.
         tmp_fd = os.open(os.ttyname(STDOUT_FILENO), os.O_RDWR)
@@ -133,14 +137,22 @@
             pty master -> standard output   (master_read)
             standard input -> pty master    (stdin_read)"""
     fds = [master_fd, STDIN_FILENO]
-    while True:
-        rfds, wfds, xfds = select(fds, [], [])
+    while fds:
+        rfds, _wfds, _xfds = select(fds, [], [])
+
         if master_fd in rfds:
-            data = master_read(master_fd)
+            # Some OSes signal EOF by returning an empty byte string,
+            # some throw OSErrors.
+            try:
+                data = master_read(master_fd)
+            except OSError:
+                data = b""
             if not data:  # Reached EOF.
-                fds.remove(master_fd)
+                return    # Assume the child process has exited and is
+                          # unreachable, so we clean up.
             else:
                 os.write(STDOUT_FILENO, data)
+
         if STDIN_FILENO in rfds:
             data = stdin_read(STDIN_FILENO)
             if not data:
@@ -153,20 +165,23 @@
     if type(argv) == type(''):
         argv = (argv,)
     sys.audit('pty.spawn', argv)
+
     pid, master_fd = fork()
     if pid == CHILD:
         os.execlp(argv[0], *argv)
+
     try:
-        mode = tty.tcgetattr(STDIN_FILENO)
-        tty.setraw(STDIN_FILENO)
-        restore = 1
+        mode = tcgetattr(STDIN_FILENO)
+        setraw(STDIN_FILENO)
+        restore = True
     except tty.error:    # This is the same as termios.error
-        restore = 0
+        restore = False
+
     try:
         _copy(master_fd, master_read, stdin_read)
-    except OSError:
+    finally:
         if restore:
-            tty.tcsetattr(STDIN_FILENO, tty.TCSAFLUSH, mode)
+            tcsetattr(STDIN_FILENO, tty.TCSAFLUSH, mode)
 
-    os.close(master_fd)
-    return os.waitpid(pid, 0)[1]
+    close(master_fd)
+    return waitpid(pid, 0)[1]
diff --git a/Lib/py_compile.py b/Lib/py_compile.py
index a81f493..388614e 100644
--- a/Lib/py_compile.py
+++ b/Lib/py_compile.py
@@ -173,43 +173,40 @@
     return cfile
 
 
-def main(args=None):
-    """Compile several source files.
+def main():
+    import argparse
 
-    The files named in 'args' (or on the command line, if 'args' is
-    not specified) are compiled and the resulting bytecode is cached
-    in the normal manner.  This function does not search a directory
-    structure to locate source files; it only compiles files named
-    explicitly.  If '-' is the only parameter in args, the list of
-    files is taken from standard input.
-
-    """
-    if args is None:
-        args = sys.argv[1:]
-    rv = 0
-    if args == ['-']:
-        while True:
-            filename = sys.stdin.readline()
-            if not filename:
-                break
-            filename = filename.rstrip('\n')
-            try:
-                compile(filename, doraise=True)
-            except PyCompileError as error:
-                rv = 1
-                sys.stderr.write("%s\n" % error.msg)
-            except OSError as error:
-                rv = 1
-                sys.stderr.write("%s\n" % error)
+    description = 'A simple command-line interface for py_compile module.'
+    parser = argparse.ArgumentParser(description=description)
+    parser.add_argument(
+        '-q', '--quiet',
+        action='store_true',
+        help='Suppress error output',
+    )
+    parser.add_argument(
+        'filenames',
+        nargs='+',
+        help='Files to compile',
+    )
+    args = parser.parse_args()
+    if args.filenames == ['-']:
+        filenames = [filename.rstrip('\n') for filename in sys.stdin.readlines()]
     else:
-        for filename in args:
-            try:
-                compile(filename, doraise=True)
-            except PyCompileError as error:
-                # return value to indicate at least one failure
-                rv = 1
-                sys.stderr.write("%s\n" % error.msg)
-    return rv
+        filenames = args.filenames
+    for filename in filenames:
+        try:
+            compile(filename, doraise=True)
+        except PyCompileError as error:
+            if args.quiet:
+                parser.exit(1)
+            else:
+                parser.exit(1, error.msg)
+        except OSError as error:
+            if args.quiet:
+                parser.exit(1)
+            else:
+                parser.exit(1, str(error))
+
 
 if __name__ == "__main__":
-    sys.exit(main())
+    main()
diff --git a/Lib/pyclbr.py b/Lib/pyclbr.py
index 99a1734..37f8699 100644
--- a/Lib/pyclbr.py
+++ b/Lib/pyclbr.py
@@ -21,11 +21,14 @@
     name    -- name of the object;
     file    -- file in which the object is defined;
     lineno  -- line in the file where the object's definition starts;
+    end_lineno -- line in the file where the object's definition ends;
     parent  -- parent of this object, if any;
     children -- nested objects contained in this object.
 The 'children' attribute is a dictionary mapping names to objects.
 
-Instances of Function describe functions with the attributes from _Object.
+Instances of Function describe functions with the attributes from _Object,
+plus the following:
+    is_async -- if a function is defined with an 'async' prefix
 
 Instances of Class describe classes with the attributes from _Object,
 plus the following:
@@ -38,11 +41,9 @@
 shouldn't happen often.
 """
 
-import io
+import ast
 import sys
 import importlib.util
-import tokenize
-from token import NAME, DEDENT, OP
 
 __all__ = ["readmodule", "readmodule_ex", "Class", "Function"]
 
@@ -51,48 +52,50 @@
 
 class _Object:
     "Information about Python class or function."
-    def __init__(self, module, name, file, lineno, parent):
+    def __init__(self, module, name, file, lineno, end_lineno, parent):
         self.module = module
         self.name = name
         self.file = file
         self.lineno = lineno
+        self.end_lineno = end_lineno
         self.parent = parent
         self.children = {}
-
-    def _addchild(self, name, obj):
-        self.children[name] = obj
+        if parent is not None:
+            parent.children[name] = self
 
 
+# Odd Function and Class signatures are for back-compatibility.
 class Function(_Object):
     "Information about a Python function, including methods."
-    def __init__(self, module, name, file, lineno, parent=None):
-        _Object.__init__(self, module, name, file, lineno, parent)
+    def __init__(self, module, name, file, lineno,
+                 parent=None, is_async=False, *, end_lineno=None):
+        super().__init__(module, name, file, lineno, end_lineno, parent)
+        self.is_async = is_async
+        if isinstance(parent, Class):
+            parent.methods[name] = lineno
 
 
 class Class(_Object):
     "Information about a Python class."
-    def __init__(self, module, name, super, file, lineno, parent=None):
-        _Object.__init__(self, module, name, file, lineno, parent)
-        self.super = [] if super is None else super
+    def __init__(self, module, name, super_, file, lineno,
+                 parent=None, *, end_lineno=None):
+        super().__init__(module, name, file, lineno, end_lineno, parent)
+        self.super = super_ or []
         self.methods = {}
 
-    def _addmethod(self, name, lineno):
-        self.methods[name] = lineno
 
-
-def _nest_function(ob, func_name, lineno):
+# These 2 functions are used in these tests
+# Lib/test/test_pyclbr, Lib/idlelib/idle_test/test_browser.py
+def _nest_function(ob, func_name, lineno, end_lineno, is_async=False):
     "Return a Function after nesting within ob."
-    newfunc = Function(ob.module, func_name, ob.file, lineno, ob)
-    ob._addchild(func_name, newfunc)
-    if isinstance(ob, Class):
-        ob._addmethod(func_name, lineno)
-    return newfunc
+    return Function(ob.module, func_name, ob.file, lineno,
+                    parent=ob, is_async=is_async, end_lineno=end_lineno)
 
-def _nest_class(ob, class_name, lineno, super=None):
+def _nest_class(ob, class_name, lineno, end_lineno, super=None):
     "Return a Class after nesting within ob."
-    newclass = Class(ob.module, class_name, super, ob.file, lineno, ob)
-    ob._addchild(class_name, newclass)
-    return newclass
+    return Class(ob.module, class_name, super, ob.file, lineno,
+                 parent=ob, end_lineno=end_lineno)
+
 
 def readmodule(module, path=None):
     """Return Class objects for the top-level classes in module.
@@ -115,6 +118,7 @@
     """
     return _readmodule(module, path or [])
 
+
 def _readmodule(module, path, inpackage=None):
     """Do the hard work for readmodule[_ex].
 
@@ -179,187 +183,93 @@
     return _create_tree(fullmodule, path, fname, source, tree, inpackage)
 
 
-def _create_tree(fullmodule, path, fname, source, tree, inpackage):
-    """Return the tree for a particular module.
+class _ModuleBrowser(ast.NodeVisitor):
+    def __init__(self, module, path, file, tree, inpackage):
+        self.path = path
+        self.tree = tree
+        self.file = file
+        self.module = module
+        self.inpackage = inpackage
+        self.stack = []
 
-    fullmodule (full module name), inpackage+module, becomes o.module.
-    path is passed to recursive calls of _readmodule.
-    fname becomes o.file.
-    source is tokenized.  Imports cause recursive calls to _readmodule.
-    tree is {} or {'__path__': <submodule search locations>}.
-    inpackage, None or string, is passed to recursive calls of _readmodule.
+    def visit_ClassDef(self, node):
+        bases = []
+        for base in node.bases:
+            name = ast.unparse(base)
+            if name in self.tree:
+                # We know this super class.
+                bases.append(self.tree[name])
+            elif len(names := name.split(".")) > 1:
+                # Super class form is module.class:
+                # look in module for class.
+                *_, module, class_ = names
+                if module in _modules:
+                    bases.append(_modules[module].get(class_, name))
+            else:
+                bases.append(name)
 
-    The effect of recursive calls is mutation of global _modules.
-    """
-    f = io.StringIO(source)
+        parent = self.stack[-1] if self.stack else None
+        class_ = Class(self.module, node.name, bases, self.file, node.lineno,
+                       parent=parent, end_lineno=node.end_lineno)
+        if parent is None:
+            self.tree[node.name] = class_
+        self.stack.append(class_)
+        self.generic_visit(node)
+        self.stack.pop()
 
-    stack = [] # Initialize stack of (class, indent) pairs.
+    def visit_FunctionDef(self, node, *, is_async=False):
+        parent = self.stack[-1] if self.stack else None
+        function = Function(self.module, node.name, self.file, node.lineno,
+                            parent, is_async, end_lineno=node.end_lineno)
+        if parent is None:
+            self.tree[node.name] = function
+        self.stack.append(function)
+        self.generic_visit(node)
+        self.stack.pop()
 
-    g = tokenize.generate_tokens(f.readline)
-    try:
-        for tokentype, token, start, _end, _line in g:
-            if tokentype == DEDENT:
-                lineno, thisindent = start
-                # Close previous nested classes and defs.
-                while stack and stack[-1][1] >= thisindent:
-                    del stack[-1]
-            elif token == 'def':
-                lineno, thisindent = start
-                # Close previous nested classes and defs.
-                while stack and stack[-1][1] >= thisindent:
-                    del stack[-1]
-                tokentype, func_name, start = next(g)[0:3]
-                if tokentype != NAME:
-                    continue  # Skip def with syntax error.
-                cur_func = None
-                if stack:
-                    cur_obj = stack[-1][0]
-                    cur_func = _nest_function(cur_obj, func_name, lineno)
-                else:
-                    # It is just a function.
-                    cur_func = Function(fullmodule, func_name, fname, lineno)
-                    tree[func_name] = cur_func
-                stack.append((cur_func, thisindent))
-            elif token == 'class':
-                lineno, thisindent = start
-                # Close previous nested classes and defs.
-                while stack and stack[-1][1] >= thisindent:
-                    del stack[-1]
-                tokentype, class_name, start = next(g)[0:3]
-                if tokentype != NAME:
-                    continue # Skip class with syntax error.
-                # Parse what follows the class name.
-                tokentype, token, start = next(g)[0:3]
-                inherit = None
-                if token == '(':
-                    names = [] # Initialize list of superclasses.
-                    level = 1
-                    super = [] # Tokens making up current superclass.
-                    while True:
-                        tokentype, token, start = next(g)[0:3]
-                        if token in (')', ',') and level == 1:
-                            n = "".join(super)
-                            if n in tree:
-                                # We know this super class.
-                                n = tree[n]
-                            else:
-                                c = n.split('.')
-                                if len(c) > 1:
-                                    # Super class form is module.class:
-                                    # look in module for class.
-                                    m = c[-2]
-                                    c = c[-1]
-                                    if m in _modules:
-                                        d = _modules[m]
-                                        if c in d:
-                                            n = d[c]
-                            names.append(n)
-                            super = []
-                        if token == '(':
-                            level += 1
-                        elif token == ')':
-                            level -= 1
-                            if level == 0:
-                                break
-                        elif token == ',' and level == 1:
-                            pass
-                        # Only use NAME and OP (== dot) tokens for type name.
-                        elif tokentype in (NAME, OP) and level == 1:
-                            super.append(token)
-                        # Expressions in the base list are not supported.
-                    inherit = names
-                if stack:
-                    cur_obj = stack[-1][0]
-                    cur_class = _nest_class(
-                            cur_obj, class_name, lineno, inherit)
-                else:
-                    cur_class = Class(fullmodule, class_name, inherit,
-                                      fname, lineno)
-                    tree[class_name] = cur_class
-                stack.append((cur_class, thisindent))
-            elif token == 'import' and start[1] == 0:
-                modules = _getnamelist(g)
-                for mod, _mod2 in modules:
-                    try:
-                        # Recursively read the imported module.
-                        if inpackage is None:
-                            _readmodule(mod, path)
-                        else:
-                            try:
-                                _readmodule(mod, path, inpackage)
-                            except ImportError:
-                                _readmodule(mod, [])
-                    except:
-                        # If we can't find or parse the imported module,
-                        # too bad -- don't die here.
-                        pass
-            elif token == 'from' and start[1] == 0:
-                mod, token = _getname(g)
-                if not mod or token != "import":
-                    continue
-                names = _getnamelist(g)
+    def visit_AsyncFunctionDef(self, node):
+        self.visit_FunctionDef(node, is_async=True)
+
+    def visit_Import(self, node):
+        if node.col_offset != 0:
+            return
+
+        for module in node.names:
+            try:
                 try:
-                    # Recursively read the imported module.
-                    d = _readmodule(mod, path, inpackage)
-                except:
-                    # If we can't find or parse the imported module,
-                    # too bad -- don't die here.
-                    continue
-                # Add any classes that were defined in the imported module
-                # to our name space if they were mentioned in the list.
-                for n, n2 in names:
-                    if n in d:
-                        tree[n2 or n] = d[n]
-                    elif n == '*':
-                        # Don't add names that start with _.
-                        for n in d:
-                            if n[0] != '_':
-                                tree[n] = d[n]
-    except StopIteration:
-        pass
+                    _readmodule(module.name, self.path, self.inpackage)
+                except ImportError:
+                    _readmodule(module.name, [])
+            except (ImportError, SyntaxError):
+                # If we can't find or parse the imported module,
+                # too bad -- don't die here.
+                continue
 
-    f.close()
-    return tree
+    def visit_ImportFrom(self, node):
+        if node.col_offset != 0:
+            return
+        try:
+            module = "." * node.level
+            if node.module:
+                module += node.module
+            module = _readmodule(module, self.path, self.inpackage)
+        except (ImportError, SyntaxError):
+            return
+
+        for name in node.names:
+            if name.name in module:
+                self.tree[name.asname or name.name] = module[name.name]
+            elif name.name == "*":
+                for import_name, import_value in module.items():
+                    if import_name.startswith("_"):
+                        continue
+                    self.tree[import_name] = import_value
 
 
-def _getnamelist(g):
-    """Return list of (dotted-name, as-name or None) tuples for token source g.
-
-    An as-name is the name that follows 'as' in an as clause.
-    """
-    names = []
-    while True:
-        name, token = _getname(g)
-        if not name:
-            break
-        if token == 'as':
-            name2, token = _getname(g)
-        else:
-            name2 = None
-        names.append((name, name2))
-        while token != "," and "\n" not in token:
-            token = next(g)[1]
-        if token != ",":
-            break
-    return names
-
-
-def _getname(g):
-    "Return (dotted-name or None, next-token) tuple for token source g."
-    parts = []
-    tokentype, token = next(g)[0:2]
-    if tokentype != NAME and token != '*':
-        return (None, token)
-    parts.append(token)
-    while True:
-        tokentype, token = next(g)[0:2]
-        if token != '.':
-            break
-        tokentype, token = next(g)[0:2]
-        if tokentype != NAME:
-            break
-        parts.append(token)
-    return (".".join(parts), token)
+def _create_tree(fullmodule, path, fname, source, tree, inpackage):
+    mbrowser = _ModuleBrowser(fullmodule, path, fname, tree, inpackage)
+    mbrowser.visit(ast.parse(source))
+    return mbrowser.tree
 
 
 def _main():
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index 35ef3eb..4a8c10a 100755
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -23,7 +23,7 @@
 local machine.  Port number 0 can be used to get an arbitrary unused port.
 
 Run "pydoc -b" to start an HTTP server on an arbitrary unused port and
-open a Web browser to interactively browse documentation.  Combine with
+open a web browser to interactively browse documentation.  Combine with
 the -n and -p options to control the hostname and port used.
 
 Run "pydoc -w <name>" to write out the HTML documentation for a module
@@ -504,7 +504,7 @@
               not file.startswith(os.path.join(basedir, 'site-packages')))) and
             object.__name__ not in ('xml.etree', 'test.pydoc_mod')):
             if docloc.startswith(("http://", "https://")):
-                docloc = "%s/%s" % (docloc.rstrip("/"), object.__name__.lower())
+                docloc = "{}/{}.html".format(docloc.rstrip("/"), object.__name__.lower())
             else:
                 docloc = os.path.join(docloc, object.__name__.lower() + ".html")
         else:
@@ -694,7 +694,7 @@
                 url = 'http://www.rfc-editor.org/rfc/rfc%d.txt' % int(rfc)
                 results.append('<a href="%s">%s</a>' % (url, escape(all)))
             elif pep:
-                url = 'http://www.python.org/dev/peps/pep-%04d/' % int(pep)
+                url = 'https://www.python.org/dev/peps/pep-%04d/' % int(pep)
                 results.append('<a href="%s">%s</a>' % (url, escape(all)))
             elif selfdot:
                 # Create a link for methods like 'self.method(...)'
@@ -1594,9 +1594,10 @@
 def pipepager(text, cmd):
     """Page through text by feeding it to another program."""
     import subprocess
-    proc = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE)
+    proc = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE,
+                            errors='backslashreplace')
     try:
-        with io.TextIOWrapper(proc.stdin, errors='backslashreplace') as pipe:
+        with proc.stdin as pipe:
             try:
                 pipe.write(text)
             except KeyboardInterrupt:
@@ -1617,13 +1618,14 @@
 def tempfilepager(text, cmd):
     """Page through text by invoking a program on a temporary file."""
     import tempfile
-    filename = tempfile.mktemp()
-    with open(filename, 'w', errors='backslashreplace') as file:
-        file.write(text)
-    try:
+    with tempfile.TemporaryDirectory() as tempdir:
+        filename = os.path.join(tempdir, 'pydoc.out')
+        with open(filename, 'w', errors='backslashreplace',
+                  encoding=os.device_encoding(0) if
+                  sys.platform == 'win32' else None
+                  ) as file:
+            file.write(text)
         os.system(cmd + ' "' + filename + '"')
-    finally:
-        os.unlink(filename)
 
 def _escape_stdout(text):
     # Escape non-encodable characters to avoid encoding errors later
@@ -1817,7 +1819,6 @@
         'False': '',
         'None': '',
         'True': '',
-        '__peg_parser__': '',
         'and': 'BOOLEAN',
         'as': 'with',
         'assert': ('assert', ''),
@@ -2065,7 +2066,7 @@
 Welcome to Python {0}'s help utility!
 
 If this is your first time using Python, you should definitely check out
-the tutorial on the Internet at https://docs.python.org/{0}/tutorial/.
+the tutorial on the internet at https://docs.python.org/{0}/tutorial/.
 
 Enter the name of any module, keyword, or topic to get help on writing
 Python programs and using Python modules.  To quit this help utility and
@@ -2279,13 +2280,13 @@
         warnings.filterwarnings('ignore') # ignore problems during import
         ModuleScanner().run(callback, key, onerror=onerror)
 
-# --------------------------------------- enhanced Web browser interface
+# --------------------------------------- enhanced web browser interface
 
 def _start_server(urlhandler, hostname, port):
     """Start an HTTP server thread on a specific port.
 
     Start an HTML/text server thread, so HTML or text documents can be
-    browsed dynamically and interactively with a Web browser.  Example use:
+    browsed dynamically and interactively with a web browser.  Example use:
 
         >>> import time
         >>> import pydoc
@@ -2457,9 +2458,6 @@
 %s</head><body bgcolor="#f0f0f8">%s<div style="clear:both;padding-top:.5em;">%s</div>
 </body></html>''' % (title, css_link, html_navbar(), contents)
 
-        def filelink(self, url, path):
-            return '<a href="getfile?key=%s">%s</a>' % (url, path)
-
 
     html = _HTMLDoc()
 
@@ -2545,19 +2543,6 @@
             'key = %s' % key, '#ffffff', '#ee77aa', '<br>'.join(results))
         return 'Search Results', contents
 
-    def html_getfile(path):
-        """Get and display a source file listing safely."""
-        path = urllib.parse.unquote(path)
-        with tokenize.open(path) as fp:
-            lines = html.escape(fp.read())
-        body = '<pre>%s</pre>' % lines
-        heading = html.heading(
-            '<big><big><strong>File Listing</strong></big></big>',
-            '#ffffff', '#7799ee')
-        contents = heading + html.bigsection(
-            'File: %s' % path, '#ffffff', '#ee77aa', body)
-        return 'getfile %s' % path, contents
-
     def html_topics():
         """Index of topic texts available."""
 
@@ -2649,8 +2634,6 @@
                 op, _, url = url.partition('=')
                 if op == "search?key":
                     title, content = html_search(url)
-                elif op == "getfile?key":
-                    title, content = html_getfile(url)
                 elif op == "topic?key":
                     # try topics first, then objects.
                     try:
@@ -2689,7 +2672,7 @@
 
 
 def browse(port=0, *, open_browser=True, hostname='localhost'):
-    """Start the enhanced pydoc Web server and open a Web browser.
+    """Start the enhanced pydoc web server and open a web browser.
 
     Use port '0' to start the server on an arbitrary port.
     Set open_browser to False to suppress opening a browser.
@@ -2841,7 +2824,7 @@
     number 0 can be used to get an arbitrary unused port.
 
 {cmd} -b
-    Start an HTTP server on an arbitrary unused port and open a Web browser
+    Start an HTTP server on an arbitrary unused port and open a web browser
     to interactively browse documentation.  This option can be used in
     combination with -n and/or -p.
 
diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py
index d8dd8c5..ac7d16c 100644
--- a/Lib/pydoc_data/topics.py
+++ b/Lib/pydoc_data/topics.py
@@ -1,5 +1,5 @@
 # -*- coding: utf-8 -*-
-# Autogenerated by Sphinx on Mon Dec  7 15:00:07 2020
+# Autogenerated by Sphinx on Wed Mar 16 11:26:55 2022
 topics = {'assert': 'The "assert" statement\n'
            '**********************\n'
            '\n'
@@ -433,11 +433,9 @@
           '\n'
           'Execution of Python coroutines can be suspended and resumed at '
           'many\n'
-          'points (see *coroutine*).  Inside the body of a coroutine '
-          'function,\n'
-          '"await" and "async" identifiers become reserved keywords; "await"\n'
-          'expressions, "async for" and "async with" can only be used in\n'
-          'coroutine function bodies.\n'
+          'points (see *coroutine*). "await" expressions, "async for" and '
+          '"async\n'
+          'with" can only be used in the body of a coroutine function.\n'
           '\n'
           'Functions defined with "async def" syntax are always coroutine\n'
           'functions, even if they do not contain "await" or "async" '
@@ -453,19 +451,22 @@
           '       do_stuff()\n'
           '       await some_coroutine()\n'
           '\n'
+          'Changed in version 3.7: "await" and "async" are now keywords;\n'
+          'previously they were only treated as such inside the body of a\n'
+          'coroutine function.\n'
+          '\n'
           '\n'
           'The "async for" statement\n'
           '=========================\n'
           '\n'
           '   async_for_stmt ::= "async" for_stmt\n'
           '\n'
-          'An *asynchronous iterable* is able to call asynchronous code in '
-          'its\n'
-          '*iter* implementation, and *asynchronous iterator* can call\n'
-          'asynchronous code in its *next* method.\n'
+          'An *asynchronous iterable* provides an "__aiter__" method that\n'
+          'directly returns an *asynchronous iterator*, which can call\n'
+          'asynchronous code in its "__anext__" method.\n'
           '\n'
           'The "async for" statement allows convenient iteration over\n'
-          'asynchronous iterators.\n'
+          'asynchronous iterables.\n'
           '\n'
           'The following code:\n'
           '\n'
@@ -550,13 +551,65 @@
           'exception.\n'
           '    That new exception causes the old one to be lost.\n'
           '\n'
-          '[2] A string literal appearing as the first statement in the '
+          '[2] In pattern matching, a sequence is defined as one of the\n'
+          '    following:\n'
+          '\n'
+          '       * a class that inherits from "collections.abc.Sequence"\n'
+          '\n'
+          '       * a Python class that has been registered as\n'
+          '         "collections.abc.Sequence"\n'
+          '\n'
+          '       * a builtin class that has its (CPython) '
+          '"Py_TPFLAGS_SEQUENCE"\n'
+          '         bit set\n'
+          '\n'
+          '       * a class that inherits from any of the above\n'
+          '\n'
+          '    The following standard library classes are sequences:\n'
+          '\n'
+          '       * "array.array"\n'
+          '\n'
+          '       * "collections.deque"\n'
+          '\n'
+          '       * "list"\n'
+          '\n'
+          '       * "memoryview"\n'
+          '\n'
+          '       * "range"\n'
+          '\n'
+          '       * "tuple"\n'
+          '\n'
+          '    Note:\n'
+          '\n'
+          '      Subject values of type "str", "bytes", and "bytearray" do '
+          'not\n'
+          '      match sequence patterns.\n'
+          '\n'
+          '[3] In pattern matching, a mapping is defined as one of the '
+          'following:\n'
+          '\n'
+          '       * a class that inherits from "collections.abc.Mapping"\n'
+          '\n'
+          '       * a Python class that has been registered as\n'
+          '         "collections.abc.Mapping"\n'
+          '\n'
+          '       * a builtin class that has its (CPython) '
+          '"Py_TPFLAGS_MAPPING"\n'
+          '         bit set\n'
+          '\n'
+          '       * a class that inherits from any of the above\n'
+          '\n'
+          '    The standard library classes "dict" and '
+          '"types.MappingProxyType"\n'
+          '    are mappings.\n'
+          '\n'
+          '[4] A string literal appearing as the first statement in the '
           'function\n'
           '    body is transformed into the function’s "__doc__" attribute '
           'and\n'
           '    therefore the function’s *docstring*.\n'
           '\n'
-          '[3] A string literal appearing as the first statement in the class\n'
+          '[5] A string literal appearing as the first statement in the class\n'
           '    body is transformed into the namespace’s "__doc__" item and\n'
           '    therefore the class’s *docstring*.\n',
  'atom-identifiers': 'Identifiers (Names)\n'
@@ -883,32 +936,6 @@
                      '*instance* of the\n'
                      '   owner class.\n'
                      '\n'
-                     'object.__set_name__(self, owner, name)\n'
-                     '\n'
-                     '   Called at the time the owning class *owner* is '
-                     'created. The\n'
-                     '   descriptor has been assigned to *name*.\n'
-                     '\n'
-                     '   Note:\n'
-                     '\n'
-                     '     "__set_name__()" is only called implicitly as part '
-                     'of the "type"\n'
-                     '     constructor, so it will need to be called '
-                     'explicitly with the\n'
-                     '     appropriate parameters when a descriptor is added '
-                     'to a class\n'
-                     '     after initial creation:\n'
-                     '\n'
-                     '        class A:\n'
-                     '           pass\n'
-                     '        descr = custom_descriptor()\n'
-                     '        A.attr = descr\n'
-                     "        descr.__set_name__(A, 'attr')\n"
-                     '\n'
-                     '     See Creating the class object for more details.\n'
-                     '\n'
-                     '   New in version 3.6.\n'
-                     '\n'
                      'The attribute "__objclass__" is interpreted by the '
                      '"inspect" module as\n'
                      'specifying the class where this object was defined '
@@ -980,16 +1007,16 @@
                      '"super(B,\n'
                      '   obj).m()" searches "obj.__class__.__mro__" for the '
                      'base class "A"\n'
-                     '   immediately preceding "B" and then invokes the '
+                     '   immediately following "B" and then invokes the '
                      'descriptor with the\n'
                      '   call: "A.__dict__[\'m\'].__get__(obj, '
                      'obj.__class__)".\n'
                      '\n'
                      'For instance bindings, the precedence of descriptor '
                      'invocation depends\n'
-                     'on the which descriptor methods are defined.  A '
-                     'descriptor can define\n'
-                     'any combination of "__get__()", "__set__()" and '
+                     'on which descriptor methods are defined.  A descriptor '
+                     'can define any\n'
+                     'combination of "__get__()", "__set__()" and '
                      '"__delete__()".  If it\n'
                      'does not define "__get__()", then accessing the '
                      'attribute will return\n'
@@ -1011,14 +1038,15 @@
                      'can be\n'
                      'overridden by instances.\n'
                      '\n'
-                     'Python methods (including "staticmethod()" and '
-                     '"classmethod()") are\n'
-                     'implemented as non-data descriptors.  Accordingly, '
-                     'instances can\n'
-                     'redefine and override methods.  This allows individual '
-                     'instances to\n'
-                     'acquire behaviors that differ from other instances of '
-                     'the same class.\n'
+                     'Python methods (including those decorated with '
+                     '"@staticmethod" and\n'
+                     '"@classmethod") are implemented as non-data '
+                     'descriptors.  Accordingly,\n'
+                     'instances can redefine and override methods.  This '
+                     'allows individual\n'
+                     'instances to acquire behaviors that differ from other '
+                     'instances of the\n'
+                     'same class.\n'
                      '\n'
                      'The "property()" function is implemented as a data '
                      'descriptor.\n'
@@ -1031,12 +1059,12 @@
                      '\n'
                      '*__slots__* allow us to explicitly declare data members '
                      '(like\n'
-                     'properties) and deny the creation of *__dict__* and '
+                     'properties) and deny the creation of "__dict__" and '
                      '*__weakref__*\n'
                      '(unless explicitly declared in *__slots__* or available '
                      'in a parent.)\n'
                      '\n'
-                     'The space saved over using *__dict__* can be '
+                     'The space saved over using "__dict__" can be '
                      'significant. Attribute\n'
                      'lookup speed can be significantly improved as well.\n'
                      '\n'
@@ -1048,7 +1076,7 @@
                      '*__slots__*\n'
                      '   reserves space for the declared variables and '
                      'prevents the\n'
-                     '   automatic creation of *__dict__* and *__weakref__* '
+                     '   automatic creation of "__dict__" and *__weakref__* '
                      'for each\n'
                      '   instance.\n'
                      '\n'
@@ -1057,11 +1085,11 @@
                      '--------------------------\n'
                      '\n'
                      '* When inheriting from a class without *__slots__*, the '
-                     '*__dict__* and\n'
+                     '"__dict__" and\n'
                      '  *__weakref__* attribute of the instances will always '
                      'be accessible.\n'
                      '\n'
-                     '* Without a *__dict__* variable, instances cannot be '
+                     '* Without a "__dict__" variable, instances cannot be '
                      'assigned new\n'
                      '  variables not listed in the *__slots__* definition.  '
                      'Attempts to\n'
@@ -1075,28 +1103,28 @@
                      '\n'
                      '* Without a *__weakref__* variable for each instance, '
                      'classes defining\n'
-                     '  *__slots__* do not support weak references to its '
-                     'instances. If weak\n'
-                     '  reference support is needed, then add '
+                     '  *__slots__* do not support "weak references" to its '
+                     'instances. If\n'
+                     '  weak reference support is needed, then add '
                      '"\'__weakref__\'" to the\n'
                      '  sequence of strings in the *__slots__* declaration.\n'
                      '\n'
                      '* *__slots__* are implemented at the class level by '
                      'creating\n'
-                     '  descriptors (Implementing Descriptors) for each '
-                     'variable name.  As a\n'
-                     '  result, class attributes cannot be used to set default '
-                     'values for\n'
-                     '  instance variables defined by *__slots__*; otherwise, '
-                     'the class\n'
-                     '  attribute would overwrite the descriptor assignment.\n'
+                     '  descriptors for each variable name.  As a result, '
+                     'class attributes\n'
+                     '  cannot be used to set default values for instance '
+                     'variables defined\n'
+                     '  by *__slots__*; otherwise, the class attribute would '
+                     'overwrite the\n'
+                     '  descriptor assignment.\n'
                      '\n'
                      '* The action of a *__slots__* declaration is not limited '
                      'to the class\n'
                      '  where it is defined.  *__slots__* declared in parents '
                      'are available\n'
                      '  in child classes. However, child subclasses will get a '
-                     '*__dict__*\n'
+                     '"__dict__"\n'
                      '  and *__weakref__* unless they also define *__slots__* '
                      '(which should\n'
                      '  only contain names of any *additional* slots).\n'
@@ -1116,13 +1144,19 @@
                      '  “variable-length” built-in types such as "int", '
                      '"bytes" and "tuple".\n'
                      '\n'
-                     '* Any non-string iterable may be assigned to '
-                     '*__slots__*. Mappings may\n'
-                     '  also be used; however, in the future, special meaning '
-                     'may be\n'
-                     '  assigned to the values corresponding to each key.\n'
+                     '* Any non-string *iterable* may be assigned to '
+                     '*__slots__*.\n'
                      '\n'
-                     '* *__class__* assignment works only if both classes have '
+                     '* If a "dictionary" is used to assign *__slots__*, the '
+                     'dictionary keys\n'
+                     '  will be used as the slot names. The values of the '
+                     'dictionary can be\n'
+                     '  used to provide per-attribute docstrings that will be '
+                     'recognised by\n'
+                     '  "inspect.getdoc()" and displayed in the output of '
+                     '"help()".\n'
+                     '\n'
+                     '* "__class__" assignment works only if both classes have '
                      'the same\n'
                      '  *__slots__*.\n'
                      '\n'
@@ -1134,10 +1168,10 @@
                      'violations\n'
                      '  raise "TypeError".\n'
                      '\n'
-                     '* If an iterator is used for *__slots__* then a '
-                     'descriptor is created\n'
-                     '  for each of the iterator’s values. However, the '
-                     '*__slots__*\n'
+                     '* If an *iterator* is used for *__slots__* then a '
+                     '*descriptor* is\n'
+                     '  created for each of the iterator’s values. However, '
+                     'the *__slots__*\n'
                      '  attribute will be an empty iterator.\n',
  'attribute-references': 'Attribute references\n'
                          '********************\n'
@@ -1260,6 +1294,10 @@
            'In the latter case, sequence repetition is performed; a negative\n'
            'repetition factor yields an empty sequence.\n'
            '\n'
+           'This operation can be customized using the special "__mul__()" '
+           'and\n'
+           '"__rmul__()" methods.\n'
+           '\n'
            'The "@" (at) operator is intended to be used for matrix\n'
            'multiplication.  No builtin Python types implement this operator.\n'
            '\n'
@@ -1275,6 +1313,10 @@
            'result.  Division by zero raises the "ZeroDivisionError" '
            'exception.\n'
            '\n'
+           'This operation can be customized using the special "__truediv__()" '
+           'and\n'
+           '"__floordiv__()" methods.\n'
+           '\n'
            'The "%" (modulo) operator yields the remainder from the division '
            'of\n'
            'the first argument by the second.  The numeric arguments are '
@@ -1306,6 +1348,10 @@
            'string formatting is described in the Python Library Reference,\n'
            'section printf-style String Formatting.\n'
            '\n'
+           'The *modulo* operation can be customized using the special '
+           '"__mod__()"\n'
+           'method.\n'
+           '\n'
            'The floor division operator, the modulo operator, and the '
            '"divmod()"\n'
            'function are not defined for complex numbers.  Instead, convert to '
@@ -1320,9 +1366,16 @@
            'and then added together. In the latter case, the sequences are\n'
            'concatenated.\n'
            '\n'
+           'This operation can be customized using the special "__add__()" '
+           'and\n'
+           '"__radd__()" methods.\n'
+           '\n'
            'The "-" (subtraction) operator yields the difference of its '
            'arguments.\n'
-           'The numeric arguments are first converted to a common type.\n',
+           'The numeric arguments are first converted to a common type.\n'
+           '\n'
+           'This operation can be customized using the special "__sub__()" '
+           'method.\n',
  'bitwise': 'Binary bitwise operations\n'
             '*************************\n'
             '\n'
@@ -1335,14 +1388,18 @@
             '\n'
             'The "&" operator yields the bitwise AND of its arguments, which '
             'must\n'
-            'be integers.\n'
+            'be integers or one of them must be a custom object overriding\n'
+            '"__and__()" or "__rand__()" special methods.\n'
             '\n'
             'The "^" operator yields the bitwise XOR (exclusive OR) of its\n'
-            'arguments, which must be integers.\n'
+            'arguments, which must be integers or one of them must be a '
+            'custom\n'
+            'object overriding "__xor__()" or "__rxor__()" special methods.\n'
             '\n'
             'The "|" operator yields the bitwise (inclusive) OR of its '
             'arguments,\n'
-            'which must be integers.\n',
+            'which must be integers or one of them must be a custom object\n'
+            'overriding "__or__()" or "__ror__()" special methods.\n',
  'bltin-code-objects': 'Code Objects\n'
                        '************\n'
                        '\n'
@@ -1359,6 +1416,10 @@
                        'through their "__code__" attribute. See also the '
                        '"code" module.\n'
                        '\n'
+                       'Accessing "__code__" raises an auditing event '
+                       '"object.__getattr__"\n'
+                       'with arguments "obj" and ""__code__"".\n'
+                       '\n'
                        'A code object can be executed or evaluated by passing '
                        'it (instead of a\n'
                        'source string) to the "exec()" or "eval()"  built-in '
@@ -1703,7 +1764,7 @@
           'original global namespace. (Usually, the suite contains mostly\n'
           'function definitions.)  When the class’s suite finishes execution, '
           'its\n'
-          'execution frame is discarded but its local namespace is saved. [3] '
+          'execution frame is discarded but its local namespace is saved. [5] '
           'A\n'
           'class object is then created using the inheritance list for the '
           'base\n'
@@ -1784,7 +1845,11 @@
                 '   comp_operator ::= "<" | ">" | "==" | ">=" | "<=" | "!="\n'
                 '                     | "is" ["not"] | ["not"] "in"\n'
                 '\n'
-                'Comparisons yield boolean values: "True" or "False".\n'
+                'Comparisons yield boolean values: "True" or "False". Custom '
+                '*rich\n'
+                'comparison methods* may return non-boolean values. In this '
+                'case Python\n'
+                'will call "bool()" on such value in boolean contexts.\n'
                 '\n'
                 'Comparisons can be chained arbitrarily, e.g., "x < y <= z" '
                 'is\n'
@@ -2182,6 +2247,7 @@
              '                     | for_stmt\n'
              '                     | try_stmt\n'
              '                     | with_stmt\n'
+             '                     | match_stmt\n'
              '                     | funcdef\n'
              '                     | classdef\n'
              '                     | async_with_stmt\n'
@@ -2319,33 +2385,6 @@
              ':= a to b do"; e.g., "list(range(3))" returns the list "[0, 1, '
              '2]".\n'
              '\n'
-             'Note:\n'
-             '\n'
-             '  There is a subtlety when the sequence is being modified by the '
-             'loop\n'
-             '  (this can only occur for mutable sequences, e.g. lists).  An\n'
-             '  internal counter is used to keep track of which item is used '
-             'next,\n'
-             '  and this is incremented on each iteration.  When this counter '
-             'has\n'
-             '  reached the length of the sequence the loop terminates.  This '
-             'means\n'
-             '  that if the suite deletes the current (or a previous) item '
-             'from the\n'
-             '  sequence, the next item will be skipped (since it gets the '
-             'index of\n'
-             '  the current item which has already been treated).  Likewise, '
-             'if the\n'
-             '  suite inserts an item in the sequence before the current item, '
-             'the\n'
-             '  current item will be treated again the next time through the '
-             'loop.\n'
-             '  This can lead to nasty bugs that can be avoided by making a\n'
-             '  temporary copy using a slice of the whole sequence, e.g.,\n'
-             '\n'
-             '     for x in a[:]:\n'
-             '         if x < 0: a.remove(x)\n'
-             '\n'
              '\n'
              'The "try" statement\n'
              '===================\n'
@@ -2381,8 +2420,9 @@
              'compatible\n'
              'with an exception if it is the class or a base class of the '
              'exception\n'
-             'object or a tuple containing an item compatible with the '
-             'exception.\n'
+             'object, or a tuple containing an item that is the class or a '
+             'base\n'
+             'class of the exception object.\n'
              '\n'
              'If no except clause matches the exception, the search for an '
              'exception\n'
@@ -2449,11 +2489,32 @@
              '(see\n'
              'section The standard type hierarchy) identifying the point in '
              'the\n'
-             'program where the exception occurred.  "sys.exc_info()" values '
-             'are\n'
-             'restored to their previous values (before the call) when '
-             'returning\n'
-             'from a function that handled an exception.\n'
+             'program where the exception occurred.  The details about the '
+             'exception\n'
+             'accessed via "sys.exc_info()" are restored to their previous '
+             'values\n'
+             'when leaving an exception handler:\n'
+             '\n'
+             '   >>> print(sys.exc_info())\n'
+             '   (None, None, None)\n'
+             '   >>> try:\n'
+             '   ...     raise TypeError\n'
+             '   ... except:\n'
+             '   ...     print(sys.exc_info())\n'
+             '   ...     try:\n'
+             '   ...          raise ValueError\n'
+             '   ...     except:\n'
+             '   ...         print(sys.exc_info())\n'
+             '   ...     print(sys.exc_info())\n'
+             '   ...\n'
+             "   (<class 'TypeError'>, TypeError(), <traceback object at "
+             '0x10efad080>)\n'
+             "   (<class 'ValueError'>, ValueError(), <traceback object at "
+             '0x10efad040>)\n'
+             "   (<class 'TypeError'>, TypeError(), <traceback object at "
+             '0x10efad080>)\n'
+             '   >>> print(sys.exc_info())\n'
+             '   (None, None, None)\n'
              '\n'
              'The optional "else" clause is executed if the control flow '
              'leaves the\n'
@@ -2538,8 +2599,10 @@
              'usage\n'
              'patterns to be encapsulated for convenient reuse.\n'
              '\n'
-             '   with_stmt ::= "with" with_item ("," with_item)* ":" suite\n'
-             '   with_item ::= expression ["as" target]\n'
+             '   with_stmt          ::= "with" ( "(" with_stmt_contents ","? '
+             '")" | with_stmt_contents ) ":" suite\n'
+             '   with_stmt_contents ::= with_item ("," with_item)*\n'
+             '   with_item          ::= expression ["as" target]\n'
              '\n'
              'The execution of the "with" statement with one “item” proceeds '
              'as\n'
@@ -2631,9 +2694,23 @@
              '       with B() as b:\n'
              '           SUITE\n'
              '\n'
+             'You can also write multi-item context managers in multiple lines '
+             'if\n'
+             'the items are surrounded by parentheses. For example:\n'
+             '\n'
+             '   with (\n'
+             '       A() as a,\n'
+             '       B() as b,\n'
+             '   ):\n'
+             '       SUITE\n'
+             '\n'
              'Changed in version 3.1: Support for multiple context '
              'expressions.\n'
              '\n'
+             'Changed in version 3.10: Support for using grouping parentheses '
+             'to\n'
+             'break the statement in multiple lines.\n'
+             '\n'
              'See also:\n'
              '\n'
              '  **PEP 343** - The “with” statement\n'
@@ -2642,6 +2719,746 @@
              '     statement.\n'
              '\n'
              '\n'
+             'The "match" statement\n'
+             '=====================\n'
+             '\n'
+             'New in version 3.10.\n'
+             '\n'
+             'The match statement is used for pattern matching.  Syntax:\n'
+             '\n'
+             '   match_stmt   ::= \'match\' subject_expr ":" NEWLINE INDENT '
+             'case_block+ DEDENT\n'
+             '   subject_expr ::= star_named_expression "," '
+             'star_named_expressions?\n'
+             '                    | named_expression\n'
+             '   case_block   ::= \'case\' patterns [guard] ":" block\n'
+             '\n'
+             'Note:\n'
+             '\n'
+             '  This section uses single quotes to denote soft keywords.\n'
+             '\n'
+             'Pattern matching takes a pattern as input (following "case") and '
+             'a\n'
+             'subject value (following "match").  The pattern (which may '
+             'contain\n'
+             'subpatterns) is matched against the subject value.  The outcomes '
+             'are:\n'
+             '\n'
+             '* A match success or failure (also termed a pattern success or\n'
+             '  failure).\n'
+             '\n'
+             '* Possible binding of matched values to a name.  The '
+             'prerequisites for\n'
+             '  this are further discussed below.\n'
+             '\n'
+             'The "match" and "case" keywords are soft keywords.\n'
+             '\n'
+             'See also:\n'
+             '\n'
+             '  * **PEP 634** – Structural Pattern Matching: Specification\n'
+             '\n'
+             '  * **PEP 636** – Structural Pattern Matching: Tutorial\n'
+             '\n'
+             '\n'
+             'Overview\n'
+             '--------\n'
+             '\n'
+             'Here’s an overview of the logical flow of a match statement:\n'
+             '\n'
+             '1. The subject expression "subject_expr" is evaluated and a '
+             'resulting\n'
+             '   subject value obtained. If the subject expression contains a '
+             'comma,\n'
+             '   a tuple is constructed using the standard rules.\n'
+             '\n'
+             '2. Each pattern in a "case_block" is attempted to match with '
+             'the\n'
+             '   subject value. The specific rules for success or failure are\n'
+             '   described below. The match attempt can also bind some or all '
+             'of the\n'
+             '   standalone names within the pattern. The precise pattern '
+             'binding\n'
+             '   rules vary per pattern type and are specified below.  **Name\n'
+             '   bindings made during a successful pattern match outlive the\n'
+             '   executed block and can be used after the match statement**.\n'
+             '\n'
+             '      Note:\n'
+             '\n'
+             '        During failed pattern matches, some subpatterns may '
+             'succeed.\n'
+             '        Do not rely on bindings being made for a failed match.\n'
+             '        Conversely, do not rely on variables remaining unchanged '
+             'after\n'
+             '        a failed match.  The exact behavior is dependent on\n'
+             '        implementation and may vary.  This is an intentional '
+             'decision\n'
+             '        made to allow different implementations to add '
+             'optimizations.\n'
+             '\n'
+             '3. If the pattern succeeds, the corresponding guard (if present) '
+             'is\n'
+             '   evaluated. In this case all name bindings are guaranteed to '
+             'have\n'
+             '   happened.\n'
+             '\n'
+             '   * If the guard evaluates as true or is missing, the "block" '
+             'inside\n'
+             '     "case_block" is executed.\n'
+             '\n'
+             '   * Otherwise, the next "case_block" is attempted as described '
+             'above.\n'
+             '\n'
+             '   * If there are no further case blocks, the match statement '
+             'is\n'
+             '     completed.\n'
+             '\n'
+             'Note:\n'
+             '\n'
+             '  Users should generally never rely on a pattern being '
+             'evaluated.\n'
+             '  Depending on implementation, the interpreter may cache values '
+             'or use\n'
+             '  other optimizations which skip repeated evaluations.\n'
+             '\n'
+             'A sample match statement:\n'
+             '\n'
+             '   >>> flag = False\n'
+             '   >>> match (100, 200):\n'
+             '   ...    case (100, 300):  # Mismatch: 200 != 300\n'
+             "   ...        print('Case 1')\n"
+             '   ...    case (100, 200) if flag:  # Successful match, but '
+             'guard fails\n'
+             "   ...        print('Case 2')\n"
+             '   ...    case (100, y):  # Matches and binds y to 200\n'
+             "   ...        print(f'Case 3, y: {y}')\n"
+             '   ...    case _:  # Pattern not attempted\n'
+             "   ...        print('Case 4, I match anything!')\n"
+             '   ...\n'
+             '   Case 3, y: 200\n'
+             '\n'
+             'In this case, "if flag" is a guard.  Read more about that in the '
+             'next\n'
+             'section.\n'
+             '\n'
+             '\n'
+             'Guards\n'
+             '------\n'
+             '\n'
+             '   guard ::= "if" named_expression\n'
+             '\n'
+             'A "guard" (which is part of the "case") must succeed for code '
+             'inside\n'
+             'the "case" block to execute.  It takes the form: "if" followed '
+             'by an\n'
+             'expression.\n'
+             '\n'
+             'The logical flow of a "case" block with a "guard" follows:\n'
+             '\n'
+             '1. Check that the pattern in the "case" block succeeded.  If '
+             'the\n'
+             '   pattern failed, the "guard" is not evaluated and the next '
+             '"case"\n'
+             '   block is checked.\n'
+             '\n'
+             '2. If the pattern succeeded, evaluate the "guard".\n'
+             '\n'
+             '   * If the "guard" condition evaluates as true, the case block '
+             'is\n'
+             '     selected.\n'
+             '\n'
+             '   * If the "guard" condition evaluates as false, the case block '
+             'is\n'
+             '     not selected.\n'
+             '\n'
+             '   * If the "guard" raises an exception during evaluation, the\n'
+             '     exception bubbles up.\n'
+             '\n'
+             'Guards are allowed to have side effects as they are '
+             'expressions.\n'
+             'Guard evaluation must proceed from the first to the last case '
+             'block,\n'
+             'one at a time, skipping case blocks whose pattern(s) don’t all\n'
+             'succeed. (I.e., guard evaluation must happen in order.) Guard\n'
+             'evaluation must stop once a case block is selected.\n'
+             '\n'
+             '\n'
+             'Irrefutable Case Blocks\n'
+             '-----------------------\n'
+             '\n'
+             'An irrefutable case block is a match-all case block.  A match\n'
+             'statement may have at most one irrefutable case block, and it '
+             'must be\n'
+             'last.\n'
+             '\n'
+             'A case block is considered irrefutable if it has no guard and '
+             'its\n'
+             'pattern is irrefutable.  A pattern is considered irrefutable if '
+             'we can\n'
+             'prove from its syntax alone that it will always succeed.  Only '
+             'the\n'
+             'following patterns are irrefutable:\n'
+             '\n'
+             '* AS Patterns whose left-hand side is irrefutable\n'
+             '\n'
+             '* OR Patterns containing at least one irrefutable pattern\n'
+             '\n'
+             '* Capture Patterns\n'
+             '\n'
+             '* Wildcard Patterns\n'
+             '\n'
+             '* parenthesized irrefutable patterns\n'
+             '\n'
+             '\n'
+             'Patterns\n'
+             '--------\n'
+             '\n'
+             'Note:\n'
+             '\n'
+             '  This section uses grammar notations beyond standard EBNF:\n'
+             '\n'
+             '  * the notation "SEP.RULE+" is shorthand for "RULE (SEP '
+             'RULE)*"\n'
+             '\n'
+             '  * the notation "!RULE" is shorthand for a negative lookahead\n'
+             '    assertion\n'
+             '\n'
+             'The top-level syntax for "patterns" is:\n'
+             '\n'
+             '   patterns       ::= open_sequence_pattern | pattern\n'
+             '   pattern        ::= as_pattern | or_pattern\n'
+             '   closed_pattern ::= | literal_pattern\n'
+             '                      | capture_pattern\n'
+             '                      | wildcard_pattern\n'
+             '                      | value_pattern\n'
+             '                      | group_pattern\n'
+             '                      | sequence_pattern\n'
+             '                      | mapping_pattern\n'
+             '                      | class_pattern\n'
+             '\n'
+             'The descriptions below will include a description “in simple '
+             'terms” of\n'
+             'what a pattern does for illustration purposes (credits to '
+             'Raymond\n'
+             'Hettinger for a document that inspired most of the '
+             'descriptions). Note\n'
+             'that these descriptions are purely for illustration purposes and '
+             '**may\n'
+             'not** reflect the underlying implementation.  Furthermore, they '
+             'do not\n'
+             'cover all valid forms.\n'
+             '\n'
+             '\n'
+             'OR Patterns\n'
+             '~~~~~~~~~~~\n'
+             '\n'
+             'An OR pattern is two or more patterns separated by vertical bars '
+             '"|".\n'
+             'Syntax:\n'
+             '\n'
+             '   or_pattern ::= "|".closed_pattern+\n'
+             '\n'
+             'Only the final subpattern may be irrefutable, and each '
+             'subpattern must\n'
+             'bind the same set of names to avoid ambiguity.\n'
+             '\n'
+             'An OR pattern matches each of its subpatterns in turn to the '
+             'subject\n'
+             'value, until one succeeds.  The OR pattern is then considered\n'
+             'successful.  Otherwise, if none of the subpatterns succeed, the '
+             'OR\n'
+             'pattern fails.\n'
+             '\n'
+             'In simple terms, "P1 | P2 | ..." will try to match "P1", if it '
+             'fails\n'
+             'it will try to match "P2", succeeding immediately if any '
+             'succeeds,\n'
+             'failing otherwise.\n'
+             '\n'
+             '\n'
+             'AS Patterns\n'
+             '~~~~~~~~~~~\n'
+             '\n'
+             'An AS pattern matches an OR pattern on the left of the "as" '
+             'keyword\n'
+             'against a subject.  Syntax:\n'
+             '\n'
+             '   as_pattern ::= or_pattern "as" capture_pattern\n'
+             '\n'
+             'If the OR pattern fails, the AS pattern fails.  Otherwise, the '
+             'AS\n'
+             'pattern binds the subject to the name on the right of the as '
+             'keyword\n'
+             'and succeeds. "capture_pattern" cannot be a a "_".\n'
+             '\n'
+             'In simple terms "P as NAME" will match with "P", and on success '
+             'it\n'
+             'will set "NAME = <subject>".\n'
+             '\n'
+             '\n'
+             'Literal Patterns\n'
+             '~~~~~~~~~~~~~~~~\n'
+             '\n'
+             'A literal pattern corresponds to most literals in Python.  '
+             'Syntax:\n'
+             '\n'
+             '   literal_pattern ::= signed_number\n'
+             '                       | signed_number "+" NUMBER\n'
+             '                       | signed_number "-" NUMBER\n'
+             '                       | strings\n'
+             '                       | "None"\n'
+             '                       | "True"\n'
+             '                       | "False"\n'
+             '                       | signed_number: NUMBER | "-" NUMBER\n'
+             '\n'
+             'The rule "strings" and the token "NUMBER" are defined in the '
+             'standard\n'
+             'Python grammar.  Triple-quoted strings are supported.  Raw '
+             'strings and\n'
+             'byte strings are supported.  Formatted string literals are not\n'
+             'supported.\n'
+             '\n'
+             'The forms "signed_number \'+\' NUMBER" and "signed_number \'-\' '
+             'NUMBER"\n'
+             'are for expressing complex numbers; they require a real number '
+             'on the\n'
+             'left and an imaginary number on the right. E.g. "3 + 4j".\n'
+             '\n'
+             'In simple terms, "LITERAL" will succeed only if "<subject> ==\n'
+             'LITERAL". For the singletons "None", "True" and "False", the '
+             '"is"\n'
+             'operator is used.\n'
+             '\n'
+             '\n'
+             'Capture Patterns\n'
+             '~~~~~~~~~~~~~~~~\n'
+             '\n'
+             'A capture pattern binds the subject value to a name. Syntax:\n'
+             '\n'
+             "   capture_pattern ::= !'_' NAME\n"
+             '\n'
+             'A single underscore "_" is not a capture pattern (this is what '
+             '"!\'_\'"\n'
+             'expresses). It is instead treated as a "wildcard_pattern".\n'
+             '\n'
+             'In a given pattern, a given name can only be bound once.  E.g. '
+             '"case\n'
+             'x, x: ..." is invalid while "case [x] | x: ..." is allowed.\n'
+             '\n'
+             'Capture patterns always succeed.  The binding follows scoping '
+             'rules\n'
+             'established by the assignment expression operator in **PEP '
+             '572**; the\n'
+             'name becomes a local variable in the closest containing function '
+             'scope\n'
+             'unless there’s an applicable "global" or "nonlocal" statement.\n'
+             '\n'
+             'In simple terms "NAME" will always succeed and it will set "NAME '
+             '=\n'
+             '<subject>".\n'
+             '\n'
+             '\n'
+             'Wildcard Patterns\n'
+             '~~~~~~~~~~~~~~~~~\n'
+             '\n'
+             'A wildcard pattern always succeeds (matches anything) and binds '
+             'no\n'
+             'name.  Syntax:\n'
+             '\n'
+             "   wildcard_pattern ::= '_'\n"
+             '\n'
+             '"_" is a soft keyword within any pattern, but only within '
+             'patterns.\n'
+             'It is an identifier, as usual, even within "match" subject\n'
+             'expressions, "guard"s, and "case" blocks.\n'
+             '\n'
+             'In simple terms, "_" will always succeed.\n'
+             '\n'
+             '\n'
+             'Value Patterns\n'
+             '~~~~~~~~~~~~~~\n'
+             '\n'
+             'A value pattern represents a named value in Python. Syntax:\n'
+             '\n'
+             '   value_pattern ::= attr\n'
+             '   attr          ::= name_or_attr "." NAME\n'
+             '   name_or_attr  ::= attr | NAME\n'
+             '\n'
+             'The dotted name in the pattern is looked up using standard '
+             'Python name\n'
+             'resolution rules.  The pattern succeeds if the value found '
+             'compares\n'
+             'equal to the subject value (using the "==" equality operator).\n'
+             '\n'
+             'In simple terms "NAME1.NAME2" will succeed only if "<subject> '
+             '==\n'
+             'NAME1.NAME2"\n'
+             '\n'
+             'Note:\n'
+             '\n'
+             '  If the same value occurs multiple times in the same match '
+             'statement,\n'
+             '  the interpreter may cache the first value found and reuse it '
+             'rather\n'
+             '  than repeat the same lookup.  This cache is strictly tied to a '
+             'given\n'
+             '  execution of a given match statement.\n'
+             '\n'
+             '\n'
+             'Group Patterns\n'
+             '~~~~~~~~~~~~~~\n'
+             '\n'
+             'A group pattern allows users to add parentheses around patterns '
+             'to\n'
+             'emphasize the intended grouping.  Otherwise, it has no '
+             'additional\n'
+             'syntax. Syntax:\n'
+             '\n'
+             '   group_pattern ::= "(" pattern ")"\n'
+             '\n'
+             'In simple terms "(P)" has the same effect as "P".\n'
+             '\n'
+             '\n'
+             'Sequence Patterns\n'
+             '~~~~~~~~~~~~~~~~~\n'
+             '\n'
+             'A sequence pattern contains several subpatterns to be matched '
+             'against\n'
+             'sequence elements. The syntax is similar to the unpacking of a '
+             'list or\n'
+             'tuple.\n'
+             '\n'
+             '   sequence_pattern       ::= "[" [maybe_sequence_pattern] "]"\n'
+             '                        | "(" [open_sequence_pattern] ")"\n'
+             '   open_sequence_pattern  ::= maybe_star_pattern "," '
+             '[maybe_sequence_pattern]\n'
+             '   maybe_sequence_pattern ::= ",".maybe_star_pattern+ ","?\n'
+             '   maybe_star_pattern     ::= star_pattern | pattern\n'
+             '   star_pattern           ::= "*" (capture_pattern | '
+             'wildcard_pattern)\n'
+             '\n'
+             'There is no difference if parentheses  or square brackets are '
+             'used for\n'
+             'sequence patterns (i.e. "(...)" vs "[...]" ).\n'
+             '\n'
+             'Note:\n'
+             '\n'
+             '  A single pattern enclosed in parentheses without a trailing '
+             'comma\n'
+             '  (e.g. "(3 | 4)") is a group pattern. While a single pattern '
+             'enclosed\n'
+             '  in square brackets (e.g. "[3 | 4]") is still a sequence '
+             'pattern.\n'
+             '\n'
+             'At most one star subpattern may be in a sequence pattern.  The '
+             'star\n'
+             'subpattern may occur in any position. If no star subpattern is\n'
+             'present, the sequence pattern is a fixed-length sequence '
+             'pattern;\n'
+             'otherwise it is a variable-length sequence pattern.\n'
+             '\n'
+             'The following is the logical flow for matching a sequence '
+             'pattern\n'
+             'against a subject value:\n'
+             '\n'
+             '1. If the subject value is not a sequence [2], the sequence '
+             'pattern\n'
+             '   fails.\n'
+             '\n'
+             '2. If the subject value is an instance of "str", "bytes" or\n'
+             '   "bytearray" the sequence pattern fails.\n'
+             '\n'
+             '3. The subsequent steps depend on whether the sequence pattern '
+             'is\n'
+             '   fixed or variable-length.\n'
+             '\n'
+             '   If the sequence pattern is fixed-length:\n'
+             '\n'
+             '   1. If the length of the subject sequence is not equal to the '
+             'number\n'
+             '      of subpatterns, the sequence pattern fails\n'
+             '\n'
+             '   2. Subpatterns in the sequence pattern are matched to their\n'
+             '      corresponding items in the subject sequence from left to '
+             'right.\n'
+             '      Matching stops as soon as a subpattern fails.  If all\n'
+             '      subpatterns succeed in matching their corresponding item, '
+             'the\n'
+             '      sequence pattern succeeds.\n'
+             '\n'
+             '   Otherwise, if the sequence pattern is variable-length:\n'
+             '\n'
+             '   1. If the length of the subject sequence is less than the '
+             'number of\n'
+             '      non-star subpatterns, the sequence pattern fails.\n'
+             '\n'
+             '   2. The leading non-star subpatterns are matched to their\n'
+             '      corresponding items as for fixed-length sequences.\n'
+             '\n'
+             '   3. If the previous step succeeds, the star subpattern matches '
+             'a\n'
+             '      list formed of the remaining subject items, excluding the\n'
+             '      remaining items corresponding to non-star subpatterns '
+             'following\n'
+             '      the star subpattern.\n'
+             '\n'
+             '   4. Remaining non-star subpatterns are matched to their\n'
+             '      corresponding subject items, as for a fixed-length '
+             'sequence.\n'
+             '\n'
+             '   Note:\n'
+             '\n'
+             '     The length of the subject sequence is obtained via "len()" '
+             '(i.e.\n'
+             '     via the "__len__()" protocol).  This length may be cached '
+             'by the\n'
+             '     interpreter in a similar manner as value patterns.\n'
+             '\n'
+             'In simple terms "[P1, P2, P3," … ", P<N>]" matches only if all '
+             'the\n'
+             'following happens:\n'
+             '\n'
+             '* check "<subject>" is a sequence\n'
+             '\n'
+             '* "len(subject) == <N>"\n'
+             '\n'
+             '* "P1" matches "<subject>[0]" (note that this match can also '
+             'bind\n'
+             '  names)\n'
+             '\n'
+             '* "P2" matches "<subject>[1]" (note that this match can also '
+             'bind\n'
+             '  names)\n'
+             '\n'
+             '* … and so on for the corresponding pattern/element.\n'
+             '\n'
+             '\n'
+             'Mapping Patterns\n'
+             '~~~~~~~~~~~~~~~~\n'
+             '\n'
+             'A mapping pattern contains one or more key-value patterns.  The '
+             'syntax\n'
+             'is similar to the construction of a dictionary. Syntax:\n'
+             '\n'
+             '   mapping_pattern     ::= "{" [items_pattern] "}"\n'
+             '   items_pattern       ::= ",".key_value_pattern+ ","?\n'
+             '   key_value_pattern   ::= (literal_pattern | value_pattern) ":" '
+             'pattern\n'
+             '                         | double_star_pattern\n'
+             '   double_star_pattern ::= "**" capture_pattern\n'
+             '\n'
+             'At most one double star pattern may be in a mapping pattern.  '
+             'The\n'
+             'double star pattern must be the last subpattern in the mapping\n'
+             'pattern.\n'
+             '\n'
+             'Duplicate keys in mapping patterns are disallowed. Duplicate '
+             'literal\n'
+             'keys will raise a "SyntaxError". Two keys that otherwise have '
+             'the same\n'
+             'value will raise a "ValueError" at runtime.\n'
+             '\n'
+             'The following is the logical flow for matching a mapping '
+             'pattern\n'
+             'against a subject value:\n'
+             '\n'
+             '1. If the subject value is not a mapping [3],the mapping '
+             'pattern\n'
+             '   fails.\n'
+             '\n'
+             '2. If every key given in the mapping pattern is present in the '
+             'subject\n'
+             '   mapping, and the pattern for each key matches the '
+             'corresponding\n'
+             '   item of the subject mapping, the mapping pattern succeeds.\n'
+             '\n'
+             '3. If duplicate keys are detected in the mapping pattern, the '
+             'pattern\n'
+             '   is considered invalid. A "SyntaxError" is raised for '
+             'duplicate\n'
+             '   literal values; or a "ValueError" for named keys of the same '
+             'value.\n'
+             '\n'
+             'Note:\n'
+             '\n'
+             '  Key-value pairs are matched using the two-argument form of '
+             'the\n'
+             '  mapping subject’s "get()" method.  Matched key-value pairs '
+             'must\n'
+             '  already be present in the mapping, and not created on-the-fly '
+             'via\n'
+             '  "__missing__()" or "__getitem__()".\n'
+             '\n'
+             'In simple terms "{KEY1: P1, KEY2: P2, ... }" matches only if all '
+             'the\n'
+             'following happens:\n'
+             '\n'
+             '* check "<subject>" is a mapping\n'
+             '\n'
+             '* "KEY1 in <subject>"\n'
+             '\n'
+             '* "P1" matches "<subject>[KEY1]"\n'
+             '\n'
+             '* … and so on for the corresponding KEY/pattern pair.\n'
+             '\n'
+             '\n'
+             'Class Patterns\n'
+             '~~~~~~~~~~~~~~\n'
+             '\n'
+             'A class pattern represents a class and its positional and '
+             'keyword\n'
+             'arguments (if any).  Syntax:\n'
+             '\n'
+             '   class_pattern       ::= name_or_attr "(" [pattern_arguments '
+             '","?] ")"\n'
+             '   pattern_arguments   ::= positional_patterns ["," '
+             'keyword_patterns]\n'
+             '                         | keyword_patterns\n'
+             '   positional_patterns ::= ",".pattern+\n'
+             '   keyword_patterns    ::= ",".keyword_pattern+\n'
+             '   keyword_pattern     ::= NAME "=" pattern\n'
+             '\n'
+             'The same keyword should not be repeated in class patterns.\n'
+             '\n'
+             'The following is the logical flow for matching a class pattern '
+             'against\n'
+             'a subject value:\n'
+             '\n'
+             '1. If "name_or_attr" is not an instance of the builtin "type" , '
+             'raise\n'
+             '   "TypeError".\n'
+             '\n'
+             '2. If the subject value is not an instance of "name_or_attr" '
+             '(tested\n'
+             '   via "isinstance()"), the class pattern fails.\n'
+             '\n'
+             '3. If no pattern arguments are present, the pattern succeeds.\n'
+             '   Otherwise, the subsequent steps depend on whether keyword or\n'
+             '   positional argument patterns are present.\n'
+             '\n'
+             '   For a number of built-in types (specified below), a single\n'
+             '   positional subpattern is accepted which will match the '
+             'entire\n'
+             '   subject; for these types keyword patterns also work as for '
+             'other\n'
+             '   types.\n'
+             '\n'
+             '   If only keyword patterns are present, they are processed as\n'
+             '   follows, one by one:\n'
+             '\n'
+             '   I. The keyword is looked up as an attribute on the subject.\n'
+             '\n'
+             '      * If this raises an exception other than "AttributeError", '
+             'the\n'
+             '        exception bubbles up.\n'
+             '\n'
+             '      * If this raises "AttributeError", the class pattern has '
+             'failed.\n'
+             '\n'
+             '      * Else, the subpattern associated with the keyword pattern '
+             'is\n'
+             '        matched against the subject’s attribute value.  If this '
+             'fails,\n'
+             '        the class pattern fails; if this succeeds, the match '
+             'proceeds\n'
+             '        to the next keyword.\n'
+             '\n'
+             '   II. If all keyword patterns succeed, the class pattern '
+             'succeeds.\n'
+             '\n'
+             '   If any positional patterns are present, they are converted '
+             'to\n'
+             '   keyword patterns using the "__match_args__" attribute on the '
+             'class\n'
+             '   "name_or_attr" before matching:\n'
+             '\n'
+             '   I. The equivalent of "getattr(cls, "__match_args__", ())" is\n'
+             '   called.\n'
+             '\n'
+             '      * If this raises an exception, the exception bubbles up.\n'
+             '\n'
+             '      * If the returned value is not a tuple, the conversion '
+             'fails and\n'
+             '        "TypeError" is raised.\n'
+             '\n'
+             '      * If there are more positional patterns than\n'
+             '        "len(cls.__match_args__)", "TypeError" is raised.\n'
+             '\n'
+             '      * Otherwise, positional pattern "i" is converted to a '
+             'keyword\n'
+             '        pattern using "__match_args__[i]" as the keyword.\n'
+             '        "__match_args__[i]" must be a string; if not "TypeError" '
+             'is\n'
+             '        raised.\n'
+             '\n'
+             '      * If there are duplicate keywords, "TypeError" is raised.\n'
+             '\n'
+             '      See also:\n'
+             '\n'
+             '        Customizing positional arguments in class pattern '
+             'matching\n'
+             '\n'
+             '   II. Once all positional patterns have been converted to '
+             'keyword\n'
+             '   patterns,\n'
+             '      the match proceeds as if there were only keyword '
+             'patterns.\n'
+             '\n'
+             '   For the following built-in types the handling of positional\n'
+             '   subpatterns is different:\n'
+             '\n'
+             '   * "bool"\n'
+             '\n'
+             '   * "bytearray"\n'
+             '\n'
+             '   * "bytes"\n'
+             '\n'
+             '   * "dict"\n'
+             '\n'
+             '   * "float"\n'
+             '\n'
+             '   * "frozenset"\n'
+             '\n'
+             '   * "int"\n'
+             '\n'
+             '   * "list"\n'
+             '\n'
+             '   * "set"\n'
+             '\n'
+             '   * "str"\n'
+             '\n'
+             '   * "tuple"\n'
+             '\n'
+             '   These classes accept a single positional argument, and the '
+             'pattern\n'
+             '   there is matched against the whole object rather than an '
+             'attribute.\n'
+             '   For example "int(0|1)" matches the value "0", but not the '
+             'values\n'
+             '   "0.0" or "False".\n'
+             '\n'
+             'In simple terms "CLS(P1, attr=P2)" matches only if the '
+             'following\n'
+             'happens:\n'
+             '\n'
+             '* "isinstance(<subject>, CLS)"\n'
+             '\n'
+             '* convert "P1" to a keyword pattern using "CLS.__match_args__"\n'
+             '\n'
+             '* For each keyword argument "attr=P2":\n'
+             '     * "hasattr(<subject>, "attr")"\n'
+             '\n'
+             '     * "P2" matches "<subject>.attr"\n'
+             '\n'
+             '* … and so on for the corresponding keyword argument/pattern '
+             'pair.\n'
+             '\n'
+             'See also:\n'
+             '\n'
+             '  * **PEP 634** – Structural Pattern Matching: Specification\n'
+             '\n'
+             '  * **PEP 636** – Structural Pattern Matching: Tutorial\n'
+             '\n'
+             '\n'
              'Function definitions\n'
              '====================\n'
              '\n'
@@ -2655,7 +3472,6 @@
              '   decorators                ::= decorator+\n'
              '   decorator                 ::= "@" assignment_expression '
              'NEWLINE\n'
-             '   dotted_name               ::= identifier ("." identifier)*\n'
              '   parameter_list            ::= defparameter ("," '
              'defparameter)* "," "/" ["," [parameter_list_no_posonly]]\n'
              '                        | parameter_list_no_posonly\n'
@@ -2680,7 +3496,7 @@
              '\n'
              'The function definition does not execute the function body; this '
              'gets\n'
-             'executed only when the function is called. [2]\n'
+             'executed only when the function is called. [4]\n'
              '\n'
              'A function definition may be wrapped by one or more *decorator*\n'
              'expressions. Decorator expressions are evaluated when the '
@@ -2733,17 +3549,17 @@
              '“pre-\n'
              'computed” value is used for each call.  This is especially '
              'important\n'
-             'to understand when a default parameter is a mutable object, such '
-             'as a\n'
-             'list or a dictionary: if the function modifies the object (e.g. '
-             'by\n'
-             'appending an item to a list), the default value is in effect '
-             'modified.\n'
-             'This is generally not what was intended.  A way around this is '
-             'to use\n'
-             '"None" as the default, and explicitly test for it in the body of '
-             'the\n'
-             'function, e.g.:\n'
+             'to understand when a default parameter value is a mutable '
+             'object, such\n'
+             'as a list or a dictionary: if the function modifies the object '
+             '(e.g.\n'
+             'by appending an item to a list), the default parameter value is '
+             'in\n'
+             'effect modified.  This is generally not what was intended.  A '
+             'way\n'
+             'around this is to use "None" as the default, and explicitly test '
+             'for\n'
+             'it in the body of the function, e.g.:\n'
              '\n'
              '   def whats_on_the_telly(penguin=None):\n'
              '       if penguin is None:\n'
@@ -2755,7 +3571,7 @@
              'Calls.\n'
              'A function call always assigns values to all parameters '
              'mentioned in\n'
-             'the parameter list, either from position arguments, from '
+             'the parameter list, either from positional arguments, from '
              'keyword\n'
              'arguments, or from default values.  If the form “"*identifier"” '
              'is\n'
@@ -2767,8 +3583,14 @@
              'new\n'
              'empty mapping of the same type.  Parameters after “"*"” or\n'
              '“"*identifier"” are keyword-only parameters and may only be '
-             'passed\n'
-             'used keyword arguments.\n'
+             'passed by\n'
+             'keyword arguments.  Parameters before “"/"” are positional-only\n'
+             'parameters and may only be passed by positional arguments.\n'
+             '\n'
+             'Changed in version 3.8: The "/" function parameter syntax may be '
+             'used\n'
+             'to indicate positional-only parameters. See **PEP 570** for '
+             'details.\n'
              '\n'
              'Parameters may have an *annotation* of the form “": '
              'expression"”\n'
@@ -2879,7 +3701,7 @@
              'function definitions.)  When the class’s suite finishes '
              'execution, its\n'
              'execution frame is discarded but its local namespace is saved. '
-             '[3] A\n'
+             '[5] A\n'
              'class object is then created using the inheritance list for the '
              'base\n'
              'classes and the saved local namespace for the attribute '
@@ -2964,12 +3786,9 @@
              '\n'
              'Execution of Python coroutines can be suspended and resumed at '
              'many\n'
-             'points (see *coroutine*).  Inside the body of a coroutine '
-             'function,\n'
-             '"await" and "async" identifiers become reserved keywords; '
-             '"await"\n'
-             'expressions, "async for" and "async with" can only be used in\n'
-             'coroutine function bodies.\n'
+             'points (see *coroutine*). "await" expressions, "async for" and '
+             '"async\n'
+             'with" can only be used in the body of a coroutine function.\n'
              '\n'
              'Functions defined with "async def" syntax are always coroutine\n'
              'functions, even if they do not contain "await" or "async" '
@@ -2985,19 +3804,22 @@
              '       do_stuff()\n'
              '       await some_coroutine()\n'
              '\n'
+             'Changed in version 3.7: "await" and "async" are now keywords;\n'
+             'previously they were only treated as such inside the body of a\n'
+             'coroutine function.\n'
+             '\n'
              '\n'
              'The "async for" statement\n'
              '-------------------------\n'
              '\n'
              '   async_for_stmt ::= "async" for_stmt\n'
              '\n'
-             'An *asynchronous iterable* is able to call asynchronous code in '
-             'its\n'
-             '*iter* implementation, and *asynchronous iterator* can call\n'
-             'asynchronous code in its *next* method.\n'
+             'An *asynchronous iterable* provides an "__aiter__" method that\n'
+             'directly returns an *asynchronous iterator*, which can call\n'
+             'asynchronous code in its "__anext__" method.\n'
              '\n'
              'The "async for" statement allows convenient iteration over\n'
-             'asynchronous iterators.\n'
+             'asynchronous iterables.\n'
              '\n'
              'The following code:\n'
              '\n'
@@ -3083,13 +3905,65 @@
              'exception.\n'
              '    That new exception causes the old one to be lost.\n'
              '\n'
-             '[2] A string literal appearing as the first statement in the '
+             '[2] In pattern matching, a sequence is defined as one of the\n'
+             '    following:\n'
+             '\n'
+             '       * a class that inherits from "collections.abc.Sequence"\n'
+             '\n'
+             '       * a Python class that has been registered as\n'
+             '         "collections.abc.Sequence"\n'
+             '\n'
+             '       * a builtin class that has its (CPython) '
+             '"Py_TPFLAGS_SEQUENCE"\n'
+             '         bit set\n'
+             '\n'
+             '       * a class that inherits from any of the above\n'
+             '\n'
+             '    The following standard library classes are sequences:\n'
+             '\n'
+             '       * "array.array"\n'
+             '\n'
+             '       * "collections.deque"\n'
+             '\n'
+             '       * "list"\n'
+             '\n'
+             '       * "memoryview"\n'
+             '\n'
+             '       * "range"\n'
+             '\n'
+             '       * "tuple"\n'
+             '\n'
+             '    Note:\n'
+             '\n'
+             '      Subject values of type "str", "bytes", and "bytearray" do '
+             'not\n'
+             '      match sequence patterns.\n'
+             '\n'
+             '[3] In pattern matching, a mapping is defined as one of the '
+             'following:\n'
+             '\n'
+             '       * a class that inherits from "collections.abc.Mapping"\n'
+             '\n'
+             '       * a Python class that has been registered as\n'
+             '         "collections.abc.Mapping"\n'
+             '\n'
+             '       * a builtin class that has its (CPython) '
+             '"Py_TPFLAGS_MAPPING"\n'
+             '         bit set\n'
+             '\n'
+             '       * a class that inherits from any of the above\n'
+             '\n'
+             '    The standard library classes "dict" and '
+             '"types.MappingProxyType"\n'
+             '    are mappings.\n'
+             '\n'
+             '[4] A string literal appearing as the first statement in the '
              'function\n'
              '    body is transformed into the function’s "__doc__" attribute '
              'and\n'
              '    therefore the function’s *docstring*.\n'
              '\n'
-             '[3] A string literal appearing as the first statement in the '
+             '[5] A string literal appearing as the first statement in the '
              'class\n'
              '    body is transformed into the namespace’s "__doc__" item and\n'
              '    therefore the class’s *docstring*.\n',
@@ -3227,13 +4101,13 @@
                   '\n'
                   '   If "__new__()" is invoked during object construction and '
                   'it returns\n'
-                  '   an instance or subclass of *cls*, then the new '
-                  'instance’s\n'
-                  '   "__init__()" method will be invoked like '
-                  '"__init__(self[, ...])",\n'
-                  '   where *self* is the new instance and the remaining '
-                  'arguments are\n'
-                  '   the same as were passed to the object constructor.\n'
+                  '   an instance of *cls*, then the new instance’s '
+                  '"__init__()" method\n'
+                  '   will be invoked like "__init__(self[, ...])", where '
+                  '*self* is the\n'
+                  '   new instance and the remaining arguments are the same as '
+                  'were\n'
+                  '   passed to the object constructor.\n'
                   '\n'
                   '   If "__new__()" does not return an instance of *cls*, '
                   'then the new\n'
@@ -3728,17 +4602,16 @@
              'debugger will pause execution just before the first line of the\n'
              'module.\n'
              '\n'
-             'The typical usage to break into the debugger from a running '
-             'program is\n'
-             'to insert\n'
+             'The typical usage to break into the debugger is to insert:\n'
              '\n'
              '   import pdb; pdb.set_trace()\n'
              '\n'
-             'at the location you want to break into the debugger.  You can '
-             'then\n'
-             'step through the code following this statement, and continue '
-             'running\n'
-             'without the debugger using the "continue" command.\n'
+             'at the location you want to break into the debugger, and then '
+             'run the\n'
+             'program. You can then step through the code following this '
+             'statement,\n'
+             'and continue running without the debugger using the "continue"\n'
+             'command.\n'
              '\n'
              'New in version 3.7: The built-in "breakpoint()", when called '
              'with\n'
@@ -4594,20 +5467,32 @@
               'binding\n'
               'operations.\n'
               '\n'
-              'The following constructs bind names: formal parameters to '
-              'functions,\n'
-              '"import" statements, class and function definitions (these bind '
-              'the\n'
-              'class or function name in the defining block), and targets that '
-              'are\n'
-              'identifiers if occurring in an assignment, "for" loop header, '
-              'or after\n'
-              '"as" in a "with" statement or "except" clause. The "import" '
-              'statement\n'
-              'of the form "from ... import *" binds all names defined in the\n'
-              'imported module, except those beginning with an underscore.  '
-              'This form\n'
-              'may only be used at the module level.\n'
+              'The following constructs bind names:\n'
+              '\n'
+              '* formal parameters to functions,\n'
+              '\n'
+              '* class definitions,\n'
+              '\n'
+              '* function definitions,\n'
+              '\n'
+              '* assignment expressions,\n'
+              '\n'
+              '* targets that are identifiers if occurring in an assignment:\n'
+              '\n'
+              '  * "for" loop header,\n'
+              '\n'
+              '  * after "as" in a "with" statement, "except" clause or in the '
+              'as-\n'
+              '    pattern in structural pattern matching,\n'
+              '\n'
+              '  * in a capture pattern in structural pattern matching\n'
+              '\n'
+              '* "import" statements.\n'
+              '\n'
+              'The "import" statement of the form "from ... import *" binds '
+              'all names\n'
+              'defined in the imported module, except those beginning with an\n'
+              'underscore. This form may only be used at the module level.\n'
               '\n'
               'A target occurring in a "del" statement is also considered '
               'bound for\n'
@@ -4680,9 +5565,9 @@
               'operations.\n'
               '\n'
               'If the "global" statement occurs within a block, all uses of '
-              'the name\n'
-              'specified in the statement refer to the binding of that name in '
-              'the\n'
+              'the names\n'
+              'specified in the statement refer to the bindings of those names '
+              'in the\n'
               'top-level namespace.  Names are resolved in the top-level '
               'namespace by\n'
               'searching the global namespace, i.e. the namespace of the '
@@ -4691,9 +5576,10 @@
               'namespace\n'
               'of the module "builtins".  The global namespace is searched '
               'first.  If\n'
-              'the name is not found there, the builtins namespace is '
-              'searched.  The\n'
-              '"global" statement must precede all uses of the name.\n'
+              'the names are not found there, the builtins namespace is '
+              'searched.\n'
+              'The "global" statement must precede all uses of the listed '
+              'names.\n'
               '\n'
               'The "global" statement has the same scope as a name binding '
               'operation\n'
@@ -4987,30 +5873,7 @@
         'all by the loop.  Hint: the built-in function "range()" returns an\n'
         'iterator of integers suitable to emulate the effect of Pascal’s "for '
         'i\n'
-        ':= a to b do"; e.g., "list(range(3))" returns the list "[0, 1, 2]".\n'
-        '\n'
-        'Note:\n'
-        '\n'
-        '  There is a subtlety when the sequence is being modified by the '
-        'loop\n'
-        '  (this can only occur for mutable sequences, e.g. lists).  An\n'
-        '  internal counter is used to keep track of which item is used next,\n'
-        '  and this is incremented on each iteration.  When this counter has\n'
-        '  reached the length of the sequence the loop terminates.  This '
-        'means\n'
-        '  that if the suite deletes the current (or a previous) item from '
-        'the\n'
-        '  sequence, the next item will be skipped (since it gets the index '
-        'of\n'
-        '  the current item which has already been treated).  Likewise, if '
-        'the\n'
-        '  suite inserts an item in the sequence before the current item, the\n'
-        '  current item will be treated again the next time through the loop.\n'
-        '  This can lead to nasty bugs that can be avoided by making a\n'
-        '  temporary copy using a slice of the whole sequence, e.g.,\n'
-        '\n'
-        '     for x in a[:]:\n'
-        '         if x < 0: a.remove(x)\n',
+        ':= a to b do"; e.g., "list(range(3))" returns the list "[0, 1, 2]".\n',
  'formatstrings': 'Format String Syntax\n'
                   '********************\n'
                   '\n'
@@ -5020,9 +5883,11 @@
                   '"Formatter",\n'
                   'subclasses can define their own format string syntax).  The '
                   'syntax is\n'
-                  'related to that of formatted string literals, but there '
-                  'are\n'
-                  'differences.\n'
+                  'related to that of formatted string literals, but it is '
+                  'less\n'
+                  'sophisticated and, in particular, does not support '
+                  'arbitrary\n'
+                  'expressions.\n'
                   '\n'
                   'Format strings contain “replacement fields” surrounded by '
                   'curly braces\n'
@@ -5216,7 +6081,7 @@
                   'character that can be any character and defaults to a space '
                   'if\n'
                   'omitted. It is not possible to use a literal curly brace '
-                  '(“"{"” or\n'
+                  '(”"{"” or\n'
                   '“"}"”) as the *fill* character in a formatted string '
                   'literal or when\n'
                   'using the "str.format()" method.  However, it is possible '
@@ -5254,9 +6119,9 @@
                   '   |           | in the form ‘+000000120’. This alignment '
                   'option is only    |\n'
                   '   |           | valid for numeric types.  It becomes the '
-                  'default when ‘0’  |\n'
-                  '   |           | immediately precedes the field '
-                  'width.                      |\n'
+                  'default for       |\n'
+                  '   |           | numbers when ‘0’ immediately precedes the '
+                  'field width.     |\n'
                   '   '
                   '+-----------+------------------------------------------------------------+\n'
                   '   | "\'^\'"     | Forces the field to be centered within '
@@ -5311,19 +6176,19 @@
                   'complex\n'
                   'types. For integers, when binary, octal, or hexadecimal '
                   'output is\n'
-                  'used, this option adds the prefix respective "\'0b\'", '
-                  '"\'0o\'", or "\'0x\'"\n'
-                  'to the output value. For float and complex the alternate '
-                  'form causes\n'
-                  'the result of the conversion to always contain a '
-                  'decimal-point\n'
-                  'character, even if no digits follow it. Normally, a '
-                  'decimal-point\n'
-                  'character appears in the result of these conversions only '
-                  'if a digit\n'
-                  'follows it. In addition, for "\'g\'" and "\'G\'" '
-                  'conversions, trailing\n'
-                  'zeros are not removed from the result.\n'
+                  'used, this option adds the respective prefix "\'0b\'", '
+                  '"\'0o\'", "\'0x\'",\n'
+                  'or "\'0X\'" to the output value. For float and complex the '
+                  'alternate\n'
+                  'form causes the result of the conversion to always contain '
+                  'a decimal-\n'
+                  'point character, even if no digits follow it. Normally, a '
+                  'decimal-\n'
+                  'point character appears in the result of these conversions '
+                  'only if a\n'
+                  'digit follows it. In addition, for "\'g\'" and "\'G\'" '
+                  'conversions,\n'
+                  'trailing zeros are not removed from the result.\n'
                   '\n'
                   'The "\',\'" option signals the use of a comma for a '
                   'thousands separator.\n'
@@ -5364,19 +6229,23 @@
                   'with an\n'
                   '*alignment* type of "\'=\'".\n'
                   '\n'
-                  'The *precision* is a decimal number indicating how many '
+                  'Changed in version 3.10: Preceding the *width* field by '
+                  '"\'0\'" no\n'
+                  'longer affects the default alignment for strings.\n'
+                  '\n'
+                  'The *precision* is a decimal integer indicating how many '
                   'digits should\n'
-                  'be displayed after the decimal point for a floating point '
-                  'value\n'
-                  'formatted with "\'f\'" and "\'F\'", or before and after the '
-                  'decimal point\n'
-                  'for a floating point value formatted with "\'g\'" or '
-                  '"\'G\'".  For non-\n'
-                  'number types the field indicates the maximum field size - '
-                  'in other\n'
-                  'words, how many characters will be used from the field '
-                  'content. The\n'
-                  '*precision* is not allowed for integer values.\n'
+                  'be displayed after the decimal point for presentation types '
+                  '"\'f\'" and\n'
+                  '"\'F\'", or before and after the decimal point for '
+                  'presentation types\n'
+                  '"\'g\'" or "\'G\'".  For string presentation types the '
+                  'field indicates the\n'
+                  'maximum field size - in other words, how many characters '
+                  'will be used\n'
+                  'from the field content.  The *precision* is not allowed for '
+                  'integer\n'
+                  'presentation types.\n'
                   '\n'
                   'Finally, the *type* determines how the data should be '
                   'presented.\n'
@@ -5436,8 +6305,12 @@
                   '+-----------+------------------------------------------------------------+\n'
                   '   | "\'X\'"     | Hex format. Outputs the number in base '
                   '16, using upper-    |\n'
-                  '   |           | case letters for the digits above '
-                  '9.                       |\n'
+                  '   |           | case letters for the digits above 9. In '
+                  'case "\'#\'" is      |\n'
+                  '   |           | specified, the prefix "\'0x\'" will be '
+                  'upper-cased to "\'0X\'" |\n'
+                  '   |           | as '
+                  'well.                                                   |\n'
                   '   '
                   '+-----------+------------------------------------------------------------+\n'
                   '   | "\'n\'"     | Number. This is the same as "\'d\'", '
@@ -5530,44 +6403,51 @@
                   '   |           | formats the result in either fixed-point '
                   'format or in      |\n'
                   '   |           | scientific notation, depending on its '
-                  'magnitude.  The      |\n'
-                  '   |           | precise rules are as follows: suppose that '
-                  'the result      |\n'
+                  'magnitude. A         |\n'
+                  '   |           | precision of "0" is treated as equivalent '
+                  'to a precision   |\n'
+                  '   |           | of "1".  The precise rules are as follows: '
+                  'suppose that    |\n'
+                  '   |           | the result formatted with presentation '
+                  'type "\'e\'" and      |\n'
+                  '   |           | precision "p-1" would have exponent '
+                  '"exp".  Then, if "m <= |\n'
+                  '   |           | exp < p", where "m" is -4 for floats and '
+                  '-6 for            |\n'
+                  '   |           | "Decimals", the number is formatted with '
+                  'presentation type |\n'
+                  '   |           | "\'f\'" and precision "p-1-exp".  '
+                  'Otherwise, the number is   |\n'
                   '   |           | formatted with presentation type "\'e\'" '
-                  'and precision "p-1" |\n'
-                  '   |           | would have exponent "exp".  Then, if "m <= '
-                  'exp < p", where |\n'
-                  '   |           | "m" is -4 for floats and -6 for '
-                  '"Decimals", the number is  |\n'
-                  '   |           | formatted with presentation type "\'f\'" '
                   'and precision       |\n'
-                  '   |           | "p-1-exp".  Otherwise, the number is '
-                  'formatted with        |\n'
-                  '   |           | presentation type "\'e\'" and precision '
-                  '"p-1". In both cases |\n'
-                  '   |           | insignificant trailing zeros are removed '
-                  'from the          |\n'
-                  '   |           | significand, and the decimal point is also '
-                  'removed if      |\n'
-                  '   |           | there are no remaining digits following '
-                  'it, unless the     |\n'
-                  '   |           | "\'#\'" option is used.  Positive and '
-                  'negative infinity,     |\n'
-                  '   |           | positive and negative zero, and nans, are '
-                  'formatted as     |\n'
-                  '   |           | "inf", "-inf", "0", "-0" and "nan" '
-                  'respectively,           |\n'
-                  '   |           | regardless of the precision.  A precision '
-                  'of "0" is        |\n'
-                  '   |           | treated as equivalent to a precision of '
-                  '"1". With no       |\n'
-                  '   |           | precision given, uses a precision of "6" '
-                  'significant       |\n'
-                  '   |           | digits for "float", and shows all '
-                  'coefficient digits for   |\n'
-                  '   |           | '
-                  '"Decimal".                                                 '
-                  '|\n'
+                  '   |           | "p-1". In both cases insignificant '
+                  'trailing zeros are      |\n'
+                  '   |           | removed from the significand, and the '
+                  'decimal point is     |\n'
+                  '   |           | also removed if there are no remaining '
+                  'digits following    |\n'
+                  '   |           | it, unless the "\'#\'" option is used.  '
+                  'With no precision    |\n'
+                  '   |           | given, uses a precision of "6" significant '
+                  'digits for      |\n'
+                  '   |           | "float". For "Decimal", the coefficient of '
+                  'the result is   |\n'
+                  '   |           | formed from the coefficient digits of the '
+                  'value;           |\n'
+                  '   |           | scientific notation is used for values '
+                  'smaller than "1e-6" |\n'
+                  '   |           | in absolute value and values where the '
+                  'place value of the  |\n'
+                  '   |           | least significant digit is larger than 1, '
+                  'and fixed-point  |\n'
+                  '   |           | notation is used otherwise.  Positive and '
+                  'negative         |\n'
+                  '   |           | infinity, positive and negative zero, and '
+                  'nans, are        |\n'
+                  '   |           | formatted as "inf", "-inf", "0", "-0" and '
+                  '"nan"            |\n'
+                  '   |           | respectively, regardless of the '
+                  'precision.                 |\n'
                   '   '
                   '+-----------+------------------------------------------------------------+\n'
                   '   | "\'G\'"     | General format. Same as "\'g\'" except '
@@ -5592,19 +6472,24 @@
                   'percent sign.          |\n'
                   '   '
                   '+-----------+------------------------------------------------------------+\n'
-                  '   | None      | Similar to "\'g\'", except that '
-                  'fixed-point notation, when   |\n'
-                  '   |           | used, has at least one digit past the '
-                  'decimal point. The   |\n'
-                  '   |           | default precision is as high as needed to '
-                  'represent the    |\n'
-                  '   |           | particular value. The overall effect is to '
-                  'match the       |\n'
-                  '   |           | output of "str()" as altered by the other '
-                  'format           |\n'
-                  '   |           | '
-                  'modifiers.                                                 '
-                  '|\n'
+                  '   | None      | For "float" this is the same as "\'g\'", '
+                  'except that when    |\n'
+                  '   |           | fixed-point notation is used to format the '
+                  'result, it      |\n'
+                  '   |           | always includes at least one digit past '
+                  'the decimal point. |\n'
+                  '   |           | The precision used is as large as needed '
+                  'to represent the  |\n'
+                  '   |           | given value faithfully.  For "Decimal", '
+                  'this is the same   |\n'
+                  '   |           | as either "\'g\'" or "\'G\'" depending on '
+                  'the value of         |\n'
+                  '   |           | "context.capitals" for the current decimal '
+                  'context.  The   |\n'
+                  '   |           | overall effect is to match the output of '
+                  '"str()" as        |\n'
+                  '   |           | altered by the other format '
+                  'modifiers.                     |\n'
                   '   '
                   '+-----------+------------------------------------------------------------+\n'
                   '\n'
@@ -5782,7 +6667,6 @@
              '   decorators                ::= decorator+\n'
              '   decorator                 ::= "@" assignment_expression '
              'NEWLINE\n'
-             '   dotted_name               ::= identifier ("." identifier)*\n'
              '   parameter_list            ::= defparameter ("," '
              'defparameter)* "," "/" ["," [parameter_list_no_posonly]]\n'
              '                        | parameter_list_no_posonly\n'
@@ -5807,7 +6691,7 @@
              '\n'
              'The function definition does not execute the function body; this '
              'gets\n'
-             'executed only when the function is called. [2]\n'
+             'executed only when the function is called. [4]\n'
              '\n'
              'A function definition may be wrapped by one or more *decorator*\n'
              'expressions. Decorator expressions are evaluated when the '
@@ -5860,17 +6744,17 @@
              '“pre-\n'
              'computed” value is used for each call.  This is especially '
              'important\n'
-             'to understand when a default parameter is a mutable object, such '
-             'as a\n'
-             'list or a dictionary: if the function modifies the object (e.g. '
-             'by\n'
-             'appending an item to a list), the default value is in effect '
-             'modified.\n'
-             'This is generally not what was intended.  A way around this is '
-             'to use\n'
-             '"None" as the default, and explicitly test for it in the body of '
-             'the\n'
-             'function, e.g.:\n'
+             'to understand when a default parameter value is a mutable '
+             'object, such\n'
+             'as a list or a dictionary: if the function modifies the object '
+             '(e.g.\n'
+             'by appending an item to a list), the default parameter value is '
+             'in\n'
+             'effect modified.  This is generally not what was intended.  A '
+             'way\n'
+             'around this is to use "None" as the default, and explicitly test '
+             'for\n'
+             'it in the body of the function, e.g.:\n'
              '\n'
              '   def whats_on_the_telly(penguin=None):\n'
              '       if penguin is None:\n'
@@ -5882,7 +6766,7 @@
              'Calls.\n'
              'A function call always assigns values to all parameters '
              'mentioned in\n'
-             'the parameter list, either from position arguments, from '
+             'the parameter list, either from positional arguments, from '
              'keyword\n'
              'arguments, or from default values.  If the form “"*identifier"” '
              'is\n'
@@ -5894,8 +6778,14 @@
              'new\n'
              'empty mapping of the same type.  Parameters after “"*"” or\n'
              '“"*identifier"” are keyword-only parameters and may only be '
-             'passed\n'
-             'used keyword arguments.\n'
+             'passed by\n'
+             'keyword arguments.  Parameters before “"/"” are positional-only\n'
+             'parameters and may only be passed by positional arguments.\n'
+             '\n'
+             'Changed in version 3.8: The "/" function parameter syntax may be '
+             'used\n'
+             'to indicate positional-only parameters. See **PEP 570** for '
+             'details.\n'
              '\n'
              'Parameters may have an *annotation* of the form “": '
              'expression"”\n'
@@ -5987,8 +6877,10 @@
            '\n'
            'Names listed in a "global" statement must not be defined as '
            'formal\n'
-           'parameters or in a "for" loop control target, "class" definition,\n'
-           'function definition, "import" statement, or variable annotation.\n'
+           'parameters, or as targets in "with" statements or "except" '
+           'clauses, or\n'
+           'in a "for" target list, "class" definition, function definition,\n'
+           '"import" statement, or variable annotation.\n'
            '\n'
            '**CPython implementation detail:** The current implementation does '
            'not\n'
@@ -6020,22 +6912,31 @@
                'trailing underscore characters:\n'
                '\n'
                '"_*"\n'
-               '   Not imported by "from module import *".  The special '
-               'identifier "_"\n'
-               '   is used in the interactive interpreter to store the result '
-               'of the\n'
-               '   last evaluation; it is stored in the "builtins" module.  '
-               'When not\n'
-               '   in interactive mode, "_" has no special meaning and is not '
-               'defined.\n'
-               '   See section The import statement.\n'
+               '   Not imported by "from module import *".\n'
+               '\n'
+               '"_"\n'
+               '   In a "case" pattern within a "match" statement, "_" is a '
+               'soft\n'
+               '   keyword that denotes a wildcard.\n'
+               '\n'
+               '   Separately, the interactive interpreter makes the result of '
+               'the\n'
+               '   last evaluation available in the variable "_". (It is '
+               'stored in the\n'
+               '   "builtins" module, alongside built-in functions like '
+               '"print".)\n'
+               '\n'
+               '   Elsewhere, "_" is a regular identifier. It is often used to '
+               'name\n'
+               '   “special” items, but it is not special to Python itself.\n'
                '\n'
                '   Note:\n'
                '\n'
                '     The name "_" is often used in conjunction with\n'
                '     internationalization; refer to the documentation for the\n'
                '     "gettext" module for more information on this '
-               'convention.\n'
+               'convention.It is\n'
+               '     also commonly used for unused variables.\n'
                '\n'
                '"__*__"\n'
                '   System-defined names, informally known as “dunder” names. '
@@ -6158,6 +7059,28 @@
                 '   async      elif       if         or         yield\n'
                 '\n'
                 '\n'
+                'Soft Keywords\n'
+                '=============\n'
+                '\n'
+                'New in version 3.10.\n'
+                '\n'
+                'Some identifiers are only reserved under specific contexts. '
+                'These are\n'
+                'known as *soft keywords*.  The identifiers "match", "case" '
+                'and "_" can\n'
+                'syntactically act as keywords in contexts related to the '
+                'pattern\n'
+                'matching statement, but this distinction is done at the '
+                'parser level,\n'
+                'not when tokenizing.\n'
+                '\n'
+                'As soft keywords, their use with pattern matching is possible '
+                'while\n'
+                'still preserving compatibility with existing code that uses '
+                '"match",\n'
+                '"case" and "_" as identifier names.\n'
+                '\n'
+                '\n'
                 'Reserved classes of identifiers\n'
                 '===============================\n'
                 '\n'
@@ -6168,15 +7091,23 @@
                 'trailing underscore characters:\n'
                 '\n'
                 '"_*"\n'
-                '   Not imported by "from module import *".  The special '
-                'identifier "_"\n'
-                '   is used in the interactive interpreter to store the result '
+                '   Not imported by "from module import *".\n'
+                '\n'
+                '"_"\n'
+                '   In a "case" pattern within a "match" statement, "_" is a '
+                'soft\n'
+                '   keyword that denotes a wildcard.\n'
+                '\n'
+                '   Separately, the interactive interpreter makes the result '
                 'of the\n'
-                '   last evaluation; it is stored in the "builtins" module.  '
-                'When not\n'
-                '   in interactive mode, "_" has no special meaning and is not '
-                'defined.\n'
-                '   See section The import statement.\n'
+                '   last evaluation available in the variable "_". (It is '
+                'stored in the\n'
+                '   "builtins" module, alongside built-in functions like '
+                '"print".)\n'
+                '\n'
+                '   Elsewhere, "_" is a regular identifier. It is often used '
+                'to name\n'
+                '   “special” items, but it is not special to Python itself.\n'
                 '\n'
                 '   Note:\n'
                 '\n'
@@ -6184,7 +7115,8 @@
                 '     internationalization; refer to the documentation for '
                 'the\n'
                 '     "gettext" module for more information on this '
-                'convention.\n'
+                'convention.It is\n'
+                '     also commonly used for unused variables.\n'
                 '\n'
                 '"__*__"\n'
                 '   System-defined names, informally known as “dunder” names. '
@@ -6256,7 +7188,7 @@
            '                   | "from" relative_module "import" "(" '
            'identifier ["as" identifier]\n'
            '                   ("," identifier ["as" identifier])* [","] ")"\n'
-           '                   | "from" module "import" "*"\n'
+           '                   | "from" relative_module "import" "*"\n'
            '   module          ::= (identifier ".")* identifier\n'
            '   relative_module ::= "."* module | "."+\n'
            '\n'
@@ -6600,10 +7532,7 @@
  'lambda': 'Lambdas\n'
            '*******\n'
            '\n'
-           '   lambda_expr        ::= "lambda" [parameter_list] ":" '
-           'expression\n'
-           '   lambda_expr_nocond ::= "lambda" [parameter_list] ":" '
-           'expression_nocond\n'
+           '   lambda_expr ::= "lambda" [parameter_list] ":" expression\n'
            '\n'
            'Lambda expressions (sometimes called lambda forms) are used to '
            'create\n'
@@ -6648,20 +7577,32 @@
            '*Names* refer to objects.  Names are introduced by name binding\n'
            'operations.\n'
            '\n'
-           'The following constructs bind names: formal parameters to '
-           'functions,\n'
-           '"import" statements, class and function definitions (these bind '
-           'the\n'
-           'class or function name in the defining block), and targets that '
-           'are\n'
-           'identifiers if occurring in an assignment, "for" loop header, or '
-           'after\n'
-           '"as" in a "with" statement or "except" clause. The "import" '
-           'statement\n'
-           'of the form "from ... import *" binds all names defined in the\n'
-           'imported module, except those beginning with an underscore.  This '
-           'form\n'
-           'may only be used at the module level.\n'
+           'The following constructs bind names:\n'
+           '\n'
+           '* formal parameters to functions,\n'
+           '\n'
+           '* class definitions,\n'
+           '\n'
+           '* function definitions,\n'
+           '\n'
+           '* assignment expressions,\n'
+           '\n'
+           '* targets that are identifiers if occurring in an assignment:\n'
+           '\n'
+           '  * "for" loop header,\n'
+           '\n'
+           '  * after "as" in a "with" statement, "except" clause or in the '
+           'as-\n'
+           '    pattern in structural pattern matching,\n'
+           '\n'
+           '  * in a capture pattern in structural pattern matching\n'
+           '\n'
+           '* "import" statements.\n'
+           '\n'
+           'The "import" statement of the form "from ... import *" binds all '
+           'names\n'
+           'defined in the imported module, except those beginning with an\n'
+           'underscore. This form may only be used at the module level.\n'
            '\n'
            'A target occurring in a "del" statement is also considered bound '
            'for\n'
@@ -6731,8 +7672,8 @@
            'operations.\n'
            '\n'
            'If the "global" statement occurs within a block, all uses of the '
-           'name\n'
-           'specified in the statement refer to the binding of that name in '
+           'names\n'
+           'specified in the statement refer to the bindings of those names in '
            'the\n'
            'top-level namespace.  Names are resolved in the top-level '
            'namespace by\n'
@@ -6741,9 +7682,9 @@
            'namespace\n'
            'of the module "builtins".  The global namespace is searched '
            'first.  If\n'
-           'the name is not found there, the builtins namespace is searched.  '
-           'The\n'
-           '"global" statement must precede all uses of the name.\n'
+           'the names are not found there, the builtins namespace is '
+           'searched.\n'
+           'The "global" statement must precede all uses of the listed names.\n'
            '\n'
            'The "global" statement has the same scope as a name binding '
            'operation\n'
@@ -6883,7 +7824,7 @@
             '\n'
             'Note that numeric literals do not include a sign; a phrase like '
             '"-1"\n'
-            'is actually an expression composed of the unary operator ‘"-"‘ '
+            'is actually an expression composed of the unary operator ‘"-"’ '
             'and the\n'
             'literal "1".\n',
  'numeric-types': 'Emulating numeric types\n'
@@ -7028,16 +7969,6 @@
                   'the data\n'
                   '   model.\n'
                   '\n'
-                  '   Note:\n'
-                  '\n'
-                  '     Due to a bug in the dispatching mechanism for "**=", a '
-                  'class that\n'
-                  '     defines "__ipow__()" but returns "NotImplemented" '
-                  'would fail to\n'
-                  '     fall back to "x.__pow__(y)" and "y.__rpow__(x)". This '
-                  'bug is\n'
-                  '     fixed in Python 3.10.\n'
-                  '\n'
                   'object.__neg__(self)\n'
                   'object.__pos__(self)\n'
                   'object.__abs__(self)\n'
@@ -7088,9 +8019,9 @@
                   '   of the object truncated to an "Integral" (typically an '
                   '"int").\n'
                   '\n'
-                  '   If "__int__()" is not defined then the built-in function '
-                  '"int()"\n'
-                  '   falls back to "__trunc__()".\n',
+                  '   The built-in function "int()" falls back to '
+                  '"__trunc__()" if\n'
+                  '   neither "__int__()" nor "__index__()" is defined.\n',
  'objects': 'Objects, values and types\n'
             '*************************\n'
             '\n'
@@ -7224,8 +8155,8 @@
                      '\n'
                      'The following table summarizes the operator precedence '
                      'in Python, from\n'
-                     'lowest precedence (least binding) to highest precedence '
-                     '(most\n'
+                     'highest precedence (most binding) to lowest precedence '
+                     '(least\n'
                      'binding).  Operators in the same box have the same '
                      'precedence.  Unless\n'
                      'the syntax is explicitly given, operators are binary.  '
@@ -7244,65 +8175,6 @@
                      '| Operator                                        | '
                      'Description                           |\n'
                      '|=================================================|=======================================|\n'
-                     '| ":="                                            | '
-                     'Assignment expression                 |\n'
-                     '+-------------------------------------------------+---------------------------------------+\n'
-                     '| "lambda"                                        | '
-                     'Lambda expression                     |\n'
-                     '+-------------------------------------------------+---------------------------------------+\n'
-                     '| "if" – "else"                                   | '
-                     'Conditional expression                |\n'
-                     '+-------------------------------------------------+---------------------------------------+\n'
-                     '| "or"                                            | '
-                     'Boolean OR                            |\n'
-                     '+-------------------------------------------------+---------------------------------------+\n'
-                     '| "and"                                           | '
-                     'Boolean AND                           |\n'
-                     '+-------------------------------------------------+---------------------------------------+\n'
-                     '| "not" "x"                                       | '
-                     'Boolean NOT                           |\n'
-                     '+-------------------------------------------------+---------------------------------------+\n'
-                     '| "in", "not in", "is", "is not", "<", "<=", ">", | '
-                     'Comparisons, including membership     |\n'
-                     '| ">=", "!=", "=="                                | '
-                     'tests and identity tests              |\n'
-                     '+-------------------------------------------------+---------------------------------------+\n'
-                     '| "|"                                             | '
-                     'Bitwise OR                            |\n'
-                     '+-------------------------------------------------+---------------------------------------+\n'
-                     '| "^"                                             | '
-                     'Bitwise XOR                           |\n'
-                     '+-------------------------------------------------+---------------------------------------+\n'
-                     '| "&"                                             | '
-                     'Bitwise AND                           |\n'
-                     '+-------------------------------------------------+---------------------------------------+\n'
-                     '| "<<", ">>"                                      | '
-                     'Shifts                                |\n'
-                     '+-------------------------------------------------+---------------------------------------+\n'
-                     '| "+", "-"                                        | '
-                     'Addition and subtraction              |\n'
-                     '+-------------------------------------------------+---------------------------------------+\n'
-                     '| "*", "@", "/", "//", "%"                        | '
-                     'Multiplication, matrix                |\n'
-                     '|                                                 | '
-                     'multiplication, division, floor       |\n'
-                     '|                                                 | '
-                     'division, remainder [5]               |\n'
-                     '+-------------------------------------------------+---------------------------------------+\n'
-                     '| "+x", "-x", "~x"                                | '
-                     'Positive, negative, bitwise NOT       |\n'
-                     '+-------------------------------------------------+---------------------------------------+\n'
-                     '| "**"                                            | '
-                     'Exponentiation [6]                    |\n'
-                     '+-------------------------------------------------+---------------------------------------+\n'
-                     '| "await" "x"                                     | '
-                     'Await expression                      |\n'
-                     '+-------------------------------------------------+---------------------------------------+\n'
-                     '| "x[index]", "x[index:index]",                   | '
-                     'Subscription, slicing, call,          |\n'
-                     '| "x(arguments...)", "x.attribute"                | '
-                     'attribute reference                   |\n'
-                     '+-------------------------------------------------+---------------------------------------+\n'
                      '| "(expressions...)",  "[expressions...]", "{key: | '
                      'Binding or parenthesized expression,  |\n'
                      '| value...}", "{expressions...}"                  | list '
@@ -7310,6 +8182,65 @@
                      '|                                                 | '
                      'display                               |\n'
                      '+-------------------------------------------------+---------------------------------------+\n'
+                     '| "x[index]", "x[index:index]",                   | '
+                     'Subscription, slicing, call,          |\n'
+                     '| "x(arguments...)", "x.attribute"                | '
+                     'attribute reference                   |\n'
+                     '+-------------------------------------------------+---------------------------------------+\n'
+                     '| "await" "x"                                     | '
+                     'Await expression                      |\n'
+                     '+-------------------------------------------------+---------------------------------------+\n'
+                     '| "**"                                            | '
+                     'Exponentiation [5]                    |\n'
+                     '+-------------------------------------------------+---------------------------------------+\n'
+                     '| "+x", "-x", "~x"                                | '
+                     'Positive, negative, bitwise NOT       |\n'
+                     '+-------------------------------------------------+---------------------------------------+\n'
+                     '| "*", "@", "/", "//", "%"                        | '
+                     'Multiplication, matrix                |\n'
+                     '|                                                 | '
+                     'multiplication, division, floor       |\n'
+                     '|                                                 | '
+                     'division, remainder [6]               |\n'
+                     '+-------------------------------------------------+---------------------------------------+\n'
+                     '| "+", "-"                                        | '
+                     'Addition and subtraction              |\n'
+                     '+-------------------------------------------------+---------------------------------------+\n'
+                     '| "<<", ">>"                                      | '
+                     'Shifts                                |\n'
+                     '+-------------------------------------------------+---------------------------------------+\n'
+                     '| "&"                                             | '
+                     'Bitwise AND                           |\n'
+                     '+-------------------------------------------------+---------------------------------------+\n'
+                     '| "^"                                             | '
+                     'Bitwise XOR                           |\n'
+                     '+-------------------------------------------------+---------------------------------------+\n'
+                     '| "|"                                             | '
+                     'Bitwise OR                            |\n'
+                     '+-------------------------------------------------+---------------------------------------+\n'
+                     '| "in", "not in", "is", "is not", "<", "<=", ">", | '
+                     'Comparisons, including membership     |\n'
+                     '| ">=", "!=", "=="                                | '
+                     'tests and identity tests              |\n'
+                     '+-------------------------------------------------+---------------------------------------+\n'
+                     '| "not" "x"                                       | '
+                     'Boolean NOT                           |\n'
+                     '+-------------------------------------------------+---------------------------------------+\n'
+                     '| "and"                                           | '
+                     'Boolean AND                           |\n'
+                     '+-------------------------------------------------+---------------------------------------+\n'
+                     '| "or"                                            | '
+                     'Boolean OR                            |\n'
+                     '+-------------------------------------------------+---------------------------------------+\n'
+                     '| "if" – "else"                                   | '
+                     'Conditional expression                |\n'
+                     '+-------------------------------------------------+---------------------------------------+\n'
+                     '| "lambda"                                        | '
+                     'Lambda expression                     |\n'
+                     '+-------------------------------------------------+---------------------------------------+\n'
+                     '| ":="                                            | '
+                     'Assignment expression                 |\n'
+                     '+-------------------------------------------------+---------------------------------------+\n'
                      '\n'
                      '-[ Footnotes ]-\n'
                      '\n'
@@ -7389,14 +8320,14 @@
                      'Check their\n'
                      '    documentation for more info.\n'
                      '\n'
-                     '[5] The "%" operator is also used for string formatting; '
-                     'the same\n'
-                     '    precedence applies.\n'
-                     '\n'
-                     '[6] The power operator "**" binds less tightly than an '
+                     '[5] The power operator "**" binds less tightly than an '
                      'arithmetic or\n'
                      '    bitwise unary operator on its right, that is, '
-                     '"2**-1" is "0.5".\n',
+                     '"2**-1" is "0.5".\n'
+                     '\n'
+                     '[6] The "%" operator is also used for string formatting; '
+                     'the same\n'
+                     '    precedence applies.\n',
  'pass': 'The "pass" statement\n'
          '********************\n'
          '\n'
@@ -7444,18 +8375,21 @@
           '"ZeroDivisionError".\n'
           'Raising a negative number to a fractional power results in a '
           '"complex"\n'
-          'number. (In earlier versions it raised a "ValueError".)\n',
+          'number. (In earlier versions it raised a "ValueError".)\n'
+          '\n'
+          'This operation can be customized using the special "__pow__()" '
+          'method.\n',
  'raise': 'The "raise" statement\n'
           '*********************\n'
           '\n'
           '   raise_stmt ::= "raise" [expression ["from" expression]]\n'
           '\n'
-          'If no expressions are present, "raise" re-raises the last '
-          'exception\n'
-          'that was active in the current scope.  If no exception is active '
-          'in\n'
-          'the current scope, a "RuntimeError" exception is raised indicating\n'
-          'that this is an error.\n'
+          'If no expressions are present, "raise" re-raises the exception that '
+          'is\n'
+          'currently being handled, which is also known as the *active\n'
+          'exception*. If there isn’t currently an active exception, a\n'
+          '"RuntimeError" exception is raised indicating that this is an '
+          'error.\n'
           '\n'
           'Otherwise, "raise" evaluates the first expression as the exception\n'
           'object.  It must be either a subclass or an instance of\n'
@@ -7481,12 +8415,18 @@
           '\n'
           'The "from" clause is used for exception chaining: if given, the '
           'second\n'
-          '*expression* must be another exception class or instance, which '
-          'will\n'
-          'then be attached to the raised exception as the "__cause__" '
-          'attribute\n'
-          '(which is writable).  If the raised exception is not handled, both\n'
-          'exceptions will be printed:\n'
+          '*expression* must be another exception class or instance. If the\n'
+          'second expression is an exception instance, it will be attached to '
+          'the\n'
+          'raised exception as the "__cause__" attribute (which is writable). '
+          'If\n'
+          'the expression is an exception class, the class will be '
+          'instantiated\n'
+          'and the resulting exception instance will be attached to the '
+          'raised\n'
+          'exception as the "__cause__" attribute. If the raised exception is '
+          'not\n'
+          'handled, both exceptions will be printed:\n'
           '\n'
           '   >>> try:\n'
           '   ...     print(1 / 0)\n'
@@ -7504,11 +8444,14 @@
           '     File "<stdin>", line 4, in <module>\n'
           '   RuntimeError: Something bad happened\n'
           '\n'
-          'A similar mechanism works implicitly if an exception is raised '
-          'inside\n'
-          'an exception handler or a "finally" clause: the previous exception '
-          'is\n'
-          'then attached as the new exception’s "__context__" attribute:\n'
+          'A similar mechanism works implicitly if a new exception is raised '
+          'when\n'
+          'an exception is already being handled.  An exception may be '
+          'handled\n'
+          'when an "except" or "finally" clause, or a "with" statement, is '
+          'used.\n'
+          'The previous exception is then attached as the new exception’s\n'
+          '"__context__" attribute:\n'
           '\n'
           '   >>> try:\n'
           '   ...     print(1 / 0)\n'
@@ -7590,61 +8533,62 @@
                    '\n'
                    'The following methods can be defined to implement '
                    'container objects.\n'
-                   'Containers usually are sequences (such as lists or tuples) '
-                   'or mappings\n'
-                   '(like dictionaries), but can represent other containers as '
-                   'well.  The\n'
-                   'first set of methods is used either to emulate a sequence '
-                   'or to\n'
-                   'emulate a mapping; the difference is that for a sequence, '
-                   'the\n'
-                   'allowable keys should be the integers *k* for which "0 <= '
-                   'k < N" where\n'
-                   '*N* is the length of the sequence, or slice objects, which '
-                   'define a\n'
-                   'range of items.  It is also recommended that mappings '
-                   'provide the\n'
-                   'methods "keys()", "values()", "items()", "get()", '
-                   '"clear()",\n'
-                   '"setdefault()", "pop()", "popitem()", "copy()", and '
-                   '"update()"\n'
-                   'behaving similar to those for Python’s standard dictionary '
+                   'Containers usually are *sequences* (such as "lists" or '
+                   '"tuples") or\n'
+                   '*mappings* (like "dictionaries"), but can represent other '
+                   'containers\n'
+                   'as well.  The first set of methods is used either to '
+                   'emulate a\n'
+                   'sequence or to emulate a mapping; the difference is that '
+                   'for a\n'
+                   'sequence, the allowable keys should be the integers *k* '
+                   'for which "0\n'
+                   '<= k < N" where *N* is the length of the sequence, or '
+                   '"slice" objects,\n'
+                   'which define a range of items.  It is also recommended '
+                   'that mappings\n'
+                   'provide the methods "keys()", "values()", "items()", '
+                   '"get()",\n'
+                   '"clear()", "setdefault()", "pop()", "popitem()", "copy()", '
+                   'and\n'
+                   '"update()" behaving similar to those for Python’s '
+                   'standard\n'
+                   '"dictionary" objects.  The "collections.abc" module '
+                   'provides a\n'
+                   '"MutableMapping" *abstract base class* to help create '
+                   'those methods\n'
+                   'from a base set of "__getitem__()", "__setitem__()", '
+                   '"__delitem__()",\n'
+                   'and "keys()". Mutable sequences should provide methods '
+                   '"append()",\n'
+                   '"count()", "index()", "extend()", "insert()", "pop()", '
+                   '"remove()",\n'
+                   '"reverse()" and "sort()", like Python standard "list" '
                    'objects.\n'
-                   'The "collections.abc" module provides a "MutableMapping" '
-                   'abstract base\n'
-                   'class to help create those methods from a base set of '
-                   '"__getitem__()",\n'
-                   '"__setitem__()", "__delitem__()", and "keys()". Mutable '
-                   'sequences\n'
-                   'should provide methods "append()", "count()", "index()", '
-                   '"extend()",\n'
-                   '"insert()", "pop()", "remove()", "reverse()" and "sort()", '
-                   'like Python\n'
-                   'standard list objects.  Finally, sequence types should '
-                   'implement\n'
-                   'addition (meaning concatenation) and multiplication '
+                   'Finally, sequence types should implement addition '
                    '(meaning\n'
-                   'repetition) by defining the methods "__add__()", '
-                   '"__radd__()",\n'
-                   '"__iadd__()", "__mul__()", "__rmul__()" and "__imul__()" '
-                   'described\n'
-                   'below; they should not define other numerical operators.  '
+                   'concatenation) and multiplication (meaning repetition) by '
+                   'defining the\n'
+                   'methods "__add__()", "__radd__()", "__iadd__()", '
+                   '"__mul__()",\n'
+                   '"__rmul__()" and "__imul__()" described below; they should '
+                   'not define\n'
+                   'other numerical operators.  It is recommended that both '
+                   'mappings and\n'
+                   'sequences implement the "__contains__()" method to allow '
+                   'efficient use\n'
+                   'of the "in" operator; for mappings, "in" should search the '
+                   'mapping’s\n'
+                   'keys; for sequences, it should search through the values.  '
                    'It is\n'
-                   'recommended that both mappings and sequences implement '
+                   'further recommended that both mappings and sequences '
+                   'implement the\n'
+                   '"__iter__()" method to allow efficient iteration through '
                    'the\n'
-                   '"__contains__()" method to allow efficient use of the "in" '
-                   'operator;\n'
-                   'for mappings, "in" should search the mapping’s keys; for '
-                   'sequences, it\n'
-                   'should search through the values.  It is further '
-                   'recommended that both\n'
-                   'mappings and sequences implement the "__iter__()" method '
-                   'to allow\n'
-                   'efficient iteration through the container; for mappings, '
-                   '"__iter__()"\n'
-                   'should iterate through the object’s keys; for sequences, '
-                   'it should\n'
-                   'iterate through the values.\n'
+                   'container; for mappings, "__iter__()" should iterate '
+                   'through the\n'
+                   'object’s keys; for sequences, it should iterate through '
+                   'the values.\n'
                    '\n'
                    'object.__len__(self)\n'
                    '\n'
@@ -7703,22 +8647,24 @@
                    'object.__getitem__(self, key)\n'
                    '\n'
                    '   Called to implement evaluation of "self[key]". For '
-                   'sequence types,\n'
-                   '   the accepted keys should be integers and slice '
-                   'objects.  Note that\n'
-                   '   the special interpretation of negative indexes (if the '
-                   'class wishes\n'
-                   '   to emulate a sequence type) is up to the '
-                   '"__getitem__()" method. If\n'
-                   '   *key* is of an inappropriate type, "TypeError" may be '
-                   'raised; if of\n'
-                   '   a value outside the set of indexes for the sequence '
-                   '(after any\n'
-                   '   special interpretation of negative values), '
-                   '"IndexError" should be\n'
-                   '   raised. For mapping types, if *key* is missing (not in '
+                   '*sequence*\n'
+                   '   types, the accepted keys should be integers and slice '
+                   'objects.\n'
+                   '   Note that the special interpretation of negative '
+                   'indexes (if the\n'
+                   '   class wishes to emulate a *sequence* type) is up to '
                    'the\n'
-                   '   container), "KeyError" should be raised.\n'
+                   '   "__getitem__()" method. If *key* is of an inappropriate '
+                   'type,\n'
+                   '   "TypeError" may be raised; if of a value outside the '
+                   'set of indexes\n'
+                   '   for the sequence (after any special interpretation of '
+                   'negative\n'
+                   '   values), "IndexError" should be raised. For *mapping* '
+                   'types, if\n'
+                   '   *key* is missing (not in the container), "KeyError" '
+                   'should be\n'
+                   '   raised.\n'
                    '\n'
                    '   Note:\n'
                    '\n'
@@ -7728,6 +8674,15 @@
                    'of the\n'
                    '     sequence.\n'
                    '\n'
+                   '   Note:\n'
+                   '\n'
+                   '     When subscripting a *class*, the special class '
+                   'method\n'
+                   '     "__class_getitem__()" may be called instead of '
+                   '"__getitem__()".\n'
+                   '     See __class_getitem__ versus __getitem__ for more '
+                   'details.\n'
+                   '\n'
                    'object.__setitem__(self, key, value)\n'
                    '\n'
                    '   Called to implement assignment to "self[key]".  Same '
@@ -7763,19 +8718,13 @@
                    '\n'
                    'object.__iter__(self)\n'
                    '\n'
-                   '   This method is called when an iterator is required for '
-                   'a container.\n'
-                   '   This method should return a new iterator object that '
-                   'can iterate\n'
-                   '   over all the objects in the container.  For mappings, '
-                   'it should\n'
-                   '   iterate over the keys of the container.\n'
-                   '\n'
-                   '   Iterator objects also need to implement this method; '
-                   'they are\n'
-                   '   required to return themselves.  For more information on '
-                   'iterator\n'
-                   '   objects, see Iterator Types.\n'
+                   '   This method is called when an *iterator* is required '
+                   'for a\n'
+                   '   container. This method should return a new iterator '
+                   'object that can\n'
+                   '   iterate over all the objects in the container.  For '
+                   'mappings, it\n'
+                   '   should iterate over the keys of the container.\n'
                    '\n'
                    'object.__reversed__(self)\n'
                    '\n'
@@ -7838,6 +8787,10 @@
              'the\n'
              'second argument.\n'
              '\n'
+             'This operation can be customized using the special '
+             '"__lshift__()" and\n'
+             '"__rshift__()" methods.\n'
+             '\n'
              'A right shift by *n* bits is defined as floor division by '
              '"pow(2,n)".\n'
              'A left shift by *n* bits is defined as multiplication with '
@@ -7950,7 +8903,7 @@
                  'immediate\n'
                  '   subclasses.  This method returns a list of all those '
                  'references\n'
-                 '   still alive. Example:\n'
+                 '   still alive.  The list is in definition order.  Example:\n'
                  '\n'
                  '      >>> int.__subclasses__()\n'
                  "      [<class 'bool'>]\n"
@@ -8052,13 +9005,13 @@
                  '\n'
                  '   If "__new__()" is invoked during object construction and '
                  'it returns\n'
-                 '   an instance or subclass of *cls*, then the new '
-                 'instance’s\n'
-                 '   "__init__()" method will be invoked like "__init__(self[, '
-                 '...])",\n'
-                 '   where *self* is the new instance and the remaining '
-                 'arguments are\n'
-                 '   the same as were passed to the object constructor.\n'
+                 '   an instance of *cls*, then the new instance’s '
+                 '"__init__()" method\n'
+                 '   will be invoked like "__init__(self[, ...])", where '
+                 '*self* is the\n'
+                 '   new instance and the remaining arguments are the same as '
+                 'were\n'
+                 '   passed to the object constructor.\n'
                  '\n'
                  '   If "__new__()" does not return an instance of *cls*, then '
                  'the new\n'
@@ -8726,32 +9679,6 @@
                  'of the\n'
                  '   owner class.\n'
                  '\n'
-                 'object.__set_name__(self, owner, name)\n'
-                 '\n'
-                 '   Called at the time the owning class *owner* is created. '
-                 'The\n'
-                 '   descriptor has been assigned to *name*.\n'
-                 '\n'
-                 '   Note:\n'
-                 '\n'
-                 '     "__set_name__()" is only called implicitly as part of '
-                 'the "type"\n'
-                 '     constructor, so it will need to be called explicitly '
-                 'with the\n'
-                 '     appropriate parameters when a descriptor is added to a '
-                 'class\n'
-                 '     after initial creation:\n'
-                 '\n'
-                 '        class A:\n'
-                 '           pass\n'
-                 '        descr = custom_descriptor()\n'
-                 '        A.attr = descr\n'
-                 "        descr.__set_name__(A, 'attr')\n"
-                 '\n'
-                 '     See Creating the class object for more details.\n'
-                 '\n'
-                 '   New in version 3.6.\n'
-                 '\n'
                  'The attribute "__objclass__" is interpreted by the "inspect" '
                  'module as\n'
                  'specifying the class where this object was defined (setting '
@@ -8822,16 +9749,16 @@
                  '"super(B,\n'
                  '   obj).m()" searches "obj.__class__.__mro__" for the base '
                  'class "A"\n'
-                 '   immediately preceding "B" and then invokes the descriptor '
+                 '   immediately following "B" and then invokes the descriptor '
                  'with the\n'
                  '   call: "A.__dict__[\'m\'].__get__(obj, obj.__class__)".\n'
                  '\n'
                  'For instance bindings, the precedence of descriptor '
                  'invocation depends\n'
-                 'on the which descriptor methods are defined.  A descriptor '
-                 'can define\n'
-                 'any combination of "__get__()", "__set__()" and '
-                 '"__delete__()".  If it\n'
+                 'on which descriptor methods are defined.  A descriptor can '
+                 'define any\n'
+                 'combination of "__get__()", "__set__()" and "__delete__()".  '
+                 'If it\n'
                  'does not define "__get__()", then accessing the attribute '
                  'will return\n'
                  'the descriptor object itself unless there is a value in the '
@@ -8852,13 +9779,14 @@
                  'be\n'
                  'overridden by instances.\n'
                  '\n'
-                 'Python methods (including "staticmethod()" and '
-                 '"classmethod()") are\n'
-                 'implemented as non-data descriptors.  Accordingly, instances '
-                 'can\n'
-                 'redefine and override methods.  This allows individual '
-                 'instances to\n'
-                 'acquire behaviors that differ from other instances of the '
+                 'Python methods (including those decorated with '
+                 '"@staticmethod" and\n'
+                 '"@classmethod") are implemented as non-data descriptors.  '
+                 'Accordingly,\n'
+                 'instances can redefine and override methods.  This allows '
+                 'individual\n'
+                 'instances to acquire behaviors that differ from other '
+                 'instances of the\n'
                  'same class.\n'
                  '\n'
                  'The "property()" function is implemented as a data '
@@ -8872,12 +9800,12 @@
                  '\n'
                  '*__slots__* allow us to explicitly declare data members '
                  '(like\n'
-                 'properties) and deny the creation of *__dict__* and '
+                 'properties) and deny the creation of "__dict__" and '
                  '*__weakref__*\n'
                  '(unless explicitly declared in *__slots__* or available in a '
                  'parent.)\n'
                  '\n'
-                 'The space saved over using *__dict__* can be significant. '
+                 'The space saved over using "__dict__" can be significant. '
                  'Attribute\n'
                  'lookup speed can be significantly improved as well.\n'
                  '\n'
@@ -8889,7 +9817,7 @@
                  '*__slots__*\n'
                  '   reserves space for the declared variables and prevents '
                  'the\n'
-                 '   automatic creation of *__dict__* and *__weakref__* for '
+                 '   automatic creation of "__dict__" and *__weakref__* for '
                  'each\n'
                  '   instance.\n'
                  '\n'
@@ -8898,11 +9826,11 @@
                  '~~~~~~~~~~~~~~~~~~~~~~~~~~\n'
                  '\n'
                  '* When inheriting from a class without *__slots__*, the '
-                 '*__dict__* and\n'
+                 '"__dict__" and\n'
                  '  *__weakref__* attribute of the instances will always be '
                  'accessible.\n'
                  '\n'
-                 '* Without a *__dict__* variable, instances cannot be '
+                 '* Without a "__dict__" variable, instances cannot be '
                  'assigned new\n'
                  '  variables not listed in the *__slots__* definition.  '
                  'Attempts to\n'
@@ -8915,28 +9843,28 @@
                  '\n'
                  '* Without a *__weakref__* variable for each instance, '
                  'classes defining\n'
-                 '  *__slots__* do not support weak references to its '
-                 'instances. If weak\n'
-                 '  reference support is needed, then add "\'__weakref__\'" to '
-                 'the\n'
+                 '  *__slots__* do not support "weak references" to its '
+                 'instances. If\n'
+                 '  weak reference support is needed, then add '
+                 '"\'__weakref__\'" to the\n'
                  '  sequence of strings in the *__slots__* declaration.\n'
                  '\n'
                  '* *__slots__* are implemented at the class level by '
                  'creating\n'
-                 '  descriptors (Implementing Descriptors) for each variable '
-                 'name.  As a\n'
-                 '  result, class attributes cannot be used to set default '
-                 'values for\n'
-                 '  instance variables defined by *__slots__*; otherwise, the '
-                 'class\n'
-                 '  attribute would overwrite the descriptor assignment.\n'
+                 '  descriptors for each variable name.  As a result, class '
+                 'attributes\n'
+                 '  cannot be used to set default values for instance '
+                 'variables defined\n'
+                 '  by *__slots__*; otherwise, the class attribute would '
+                 'overwrite the\n'
+                 '  descriptor assignment.\n'
                  '\n'
                  '* The action of a *__slots__* declaration is not limited to '
                  'the class\n'
                  '  where it is defined.  *__slots__* declared in parents are '
                  'available\n'
                  '  in child classes. However, child subclasses will get a '
-                 '*__dict__*\n'
+                 '"__dict__"\n'
                  '  and *__weakref__* unless they also define *__slots__* '
                  '(which should\n'
                  '  only contain names of any *additional* slots).\n'
@@ -8956,13 +9884,18 @@
                  '  “variable-length” built-in types such as "int", "bytes" '
                  'and "tuple".\n'
                  '\n'
-                 '* Any non-string iterable may be assigned to *__slots__*. '
-                 'Mappings may\n'
-                 '  also be used; however, in the future, special meaning may '
-                 'be\n'
-                 '  assigned to the values corresponding to each key.\n'
+                 '* Any non-string *iterable* may be assigned to *__slots__*.\n'
                  '\n'
-                 '* *__class__* assignment works only if both classes have the '
+                 '* If a "dictionary" is used to assign *__slots__*, the '
+                 'dictionary keys\n'
+                 '  will be used as the slot names. The values of the '
+                 'dictionary can be\n'
+                 '  used to provide per-attribute docstrings that will be '
+                 'recognised by\n'
+                 '  "inspect.getdoc()" and displayed in the output of '
+                 '"help()".\n'
+                 '\n'
+                 '* "__class__" assignment works only if both classes have the '
                  'same\n'
                  '  *__slots__*.\n'
                  '\n'
@@ -8974,9 +9907,9 @@
                  'violations\n'
                  '  raise "TypeError".\n'
                  '\n'
-                 '* If an iterator is used for *__slots__* then a descriptor '
-                 'is created\n'
-                 '  for each of the iterator’s values. However, the '
+                 '* If an *iterator* is used for *__slots__* then a '
+                 '*descriptor* is\n'
+                 '  created for each of the iterator’s values. However, the '
                  '*__slots__*\n'
                  '  attribute will be an empty iterator.\n'
                  '\n'
@@ -8985,15 +9918,15 @@
                  '==========================\n'
                  '\n'
                  'Whenever a class inherits from another class, '
-                 '*__init_subclass__* is\n'
-                 'called on that class. This way, it is possible to write '
-                 'classes which\n'
-                 'change the behavior of subclasses. This is closely related '
-                 'to class\n'
-                 'decorators, but where class decorators only affect the '
-                 'specific class\n'
-                 'they’re applied to, "__init_subclass__" solely applies to '
-                 'future\n'
+                 '"__init_subclass__()" is\n'
+                 'called on the parent class. This way, it is possible to '
+                 'write classes\n'
+                 'which change the behavior of subclasses. This is closely '
+                 'related to\n'
+                 'class decorators, but where class decorators only affect the '
+                 'specific\n'
+                 'class they’re applied to, "__init_subclass__" solely applies '
+                 'to future\n'
                  'subclasses of the class defining the method.\n'
                  '\n'
                  'classmethod object.__init_subclass__(cls)\n'
@@ -9041,6 +9974,38 @@
                  '\n'
                  '   New in version 3.6.\n'
                  '\n'
+                 'When a class is created, "type.__new__()" scans the class '
+                 'variables\n'
+                 'and makes callbacks to those with a "__set_name__()" hook.\n'
+                 '\n'
+                 'object.__set_name__(self, owner, name)\n'
+                 '\n'
+                 '   Automatically called at the time the owning class *owner* '
+                 'is\n'
+                 '   created. The object has been assigned to *name* in that '
+                 'class:\n'
+                 '\n'
+                 '      class A:\n'
+                 '          x = C()  # Automatically calls: x.__set_name__(A, '
+                 "'x')\n"
+                 '\n'
+                 '   If the class variable is assigned after the class is '
+                 'created,\n'
+                 '   "__set_name__()" will not be called automatically. If '
+                 'needed,\n'
+                 '   "__set_name__()" can be called directly:\n'
+                 '\n'
+                 '      class A:\n'
+                 '         pass\n'
+                 '\n'
+                 '      c = C()\n'
+                 '      A.x = c                  # The hook is not called\n'
+                 "      c.__set_name__(A, 'x')   # Manually invoke the hook\n"
+                 '\n'
+                 '   See Creating the class object for more details.\n'
+                 '\n'
+                 '   New in version 3.6.\n'
+                 '\n'
                  '\n'
                  'Metaclasses\n'
                  '-----------\n'
@@ -9153,10 +10118,10 @@
                  'come from\n'
                  'the class definition). The "__prepare__" method should be '
                  'implemented\n'
-                 'as a "classmethod()". The namespace returned by '
-                 '"__prepare__" is\n'
-                 'passed in to "__new__", but when the final class object is '
-                 'created the\n'
+                 'as a "classmethod". The namespace returned by "__prepare__" '
+                 'is passed\n'
+                 'in to "__new__", but when the final class object is created '
+                 'the\n'
                  'namespace is copied into a new "dict".\n'
                  '\n'
                  'If the metaclass has no "__prepare__" attribute, then the '
@@ -9236,22 +10201,21 @@
                  'When using the default metaclass "type", or any metaclass '
                  'that\n'
                  'ultimately calls "type.__new__", the following additional\n'
-                 'customisation steps are invoked after creating the class '
+                 'customization steps are invoked after creating the class '
                  'object:\n'
                  '\n'
-                 '* first, "type.__new__" collects all of the descriptors in '
-                 'the class\n'
-                 '  namespace that define a "__set_name__()" method;\n'
+                 '1. The "type.__new__" method collects all of the attributes '
+                 'in the\n'
+                 '   class namespace that define a "__set_name__()" method;\n'
                  '\n'
-                 '* second, all of these "__set_name__" methods are called '
-                 'with the\n'
-                 '  class being defined and the assigned name of that '
-                 'particular\n'
-                 '  descriptor;\n'
+                 '2. Those "__set_name__" methods are called with the class '
+                 'being\n'
+                 '   defined and the assigned name of that particular '
+                 'attribute;\n'
                  '\n'
-                 '* finally, the "__init_subclass__()" hook is called on the '
-                 'immediate\n'
-                 '  parent of the new class in its method resolution order.\n'
+                 '3. The "__init_subclass__()" hook is called on the immediate '
+                 'parent of\n'
+                 '   the new class in its method resolution order.\n'
                  '\n'
                  'After the class object is created, it is passed to the '
                  'class\n'
@@ -9344,9 +10308,33 @@
                  'Emulating generic types\n'
                  '=======================\n'
                  '\n'
-                 'One can implement the generic class syntax as specified by '
-                 '**PEP 484**\n'
-                 '(for example "List[int]") by defining a special method:\n'
+                 'When using *type annotations*, it is often useful to '
+                 '*parameterize* a\n'
+                 '*generic type* using Python’s square-brackets notation. For '
+                 'example,\n'
+                 'the annotation "list[int]" might be used to signify a "list" '
+                 'in which\n'
+                 'all the elements are of type "int".\n'
+                 '\n'
+                 'See also:\n'
+                 '\n'
+                 '  **PEP 484** - Type Hints\n'
+                 '     Introducing Python’s framework for type annotations\n'
+                 '\n'
+                 '  Generic Alias Types\n'
+                 '     Documentation for objects representing parameterized '
+                 'generic\n'
+                 '     classes\n'
+                 '\n'
+                 '  Generics, user-defined generics and "typing.Generic"\n'
+                 '     Documentation on how to implement generic classes that '
+                 'can be\n'
+                 '     parameterized at runtime and understood by static '
+                 'type-checkers.\n'
+                 '\n'
+                 'A class can *generally* only be parameterized if it defines '
+                 'the\n'
+                 'special class method "__class_getitem__()".\n'
                  '\n'
                  'classmethod object.__class_getitem__(cls, key)\n'
                  '\n'
@@ -9354,18 +10342,144 @@
                  'generic class\n'
                  '   by type arguments found in *key*.\n'
                  '\n'
-                 'This method is looked up on the class object itself, and '
-                 'when defined\n'
-                 'in the class body, this method is implicitly a class '
-                 'method.  Note,\n'
-                 'this mechanism is primarily reserved for use with static '
-                 'type hints,\n'
-                 'other usage is discouraged.\n'
+                 '   When defined on a class, "__class_getitem__()" is '
+                 'automatically a\n'
+                 '   class method. As such, there is no need for it to be '
+                 'decorated with\n'
+                 '   "@classmethod" when it is defined.\n'
+                 '\n'
+                 '\n'
+                 'The purpose of *__class_getitem__*\n'
+                 '----------------------------------\n'
+                 '\n'
+                 'The purpose of "__class_getitem__()" is to allow runtime\n'
+                 'parameterization of standard-library generic classes in '
+                 'order to more\n'
+                 'easily apply *type hints* to these classes.\n'
+                 '\n'
+                 'To implement custom generic classes that can be '
+                 'parameterized at\n'
+                 'runtime and understood by static type-checkers, users should '
+                 'either\n'
+                 'inherit from a standard library class that already '
+                 'implements\n'
+                 '"__class_getitem__()", or inherit from "typing.Generic", '
+                 'which has its\n'
+                 'own implementation of "__class_getitem__()".\n'
+                 '\n'
+                 'Custom implementations of "__class_getitem__()" on classes '
+                 'defined\n'
+                 'outside of the standard library may not be understood by '
+                 'third-party\n'
+                 'type-checkers such as mypy. Using "__class_getitem__()" on '
+                 'any class\n'
+                 'for purposes other than type hinting is discouraged.\n'
+                 '\n'
+                 '\n'
+                 '*__class_getitem__* versus *__getitem__*\n'
+                 '----------------------------------------\n'
+                 '\n'
+                 'Usually, the subscription of an object using square brackets '
+                 'will call\n'
+                 'the "__getitem__()" instance method defined on the object’s '
+                 'class.\n'
+                 'However, if the object being subscribed is itself a class, '
+                 'the class\n'
+                 'method "__class_getitem__()" may be called instead.\n'
+                 '"__class_getitem__()" should return a GenericAlias object if '
+                 'it is\n'
+                 'properly defined.\n'
+                 '\n'
+                 'Presented with the *expression* "obj[x]", the Python '
+                 'interpreter\n'
+                 'follows something like the following process to decide '
+                 'whether\n'
+                 '"__getitem__()" or "__class_getitem__()" should be called:\n'
+                 '\n'
+                 '   from inspect import isclass\n'
+                 '\n'
+                 '   def subscribe(obj, x):\n'
+                 '       """Return the result of the expression `obj[x]`"""\n'
+                 '\n'
+                 '       class_of_obj = type(obj)\n'
+                 '\n'
+                 '       # If the class of obj defines __getitem__,\n'
+                 '       # call class_of_obj.__getitem__(obj, x)\n'
+                 "       if hasattr(class_of_obj, '__getitem__'):\n"
+                 '           return class_of_obj.__getitem__(obj, x)\n'
+                 '\n'
+                 '       # Else, if obj is a class and defines '
+                 '__class_getitem__,\n'
+                 '       # call obj.__class_getitem__(x)\n'
+                 '       elif isclass(obj) and hasattr(obj, '
+                 "'__class_getitem__'):\n"
+                 '           return obj.__class_getitem__(x)\n'
+                 '\n'
+                 '       # Else, raise an exception\n'
+                 '       else:\n'
+                 '           raise TypeError(\n'
+                 '               f"\'{class_of_obj.__name__}\' object is not '
+                 'subscriptable"\n'
+                 '           )\n'
+                 '\n'
+                 'In Python, all classes are themselves instances of other '
+                 'classes. The\n'
+                 'class of a class is known as that class’s *metaclass*, and '
+                 'most\n'
+                 'classes have the "type" class as their metaclass. "type" '
+                 'does not\n'
+                 'define "__getitem__()", meaning that expressions such as '
+                 '"list[int]",\n'
+                 '"dict[str, float]" and "tuple[str, bytes]" all result in\n'
+                 '"__class_getitem__()" being called:\n'
+                 '\n'
+                 '   >>> # list has class "type" as its metaclass, like most '
+                 'classes:\n'
+                 '   >>> type(list)\n'
+                 "   <class 'type'>\n"
+                 '   >>> type(dict) == type(list) == type(tuple) == type(str) '
+                 '== type(bytes)\n'
+                 '   True\n'
+                 '   >>> # "list[int]" calls "list.__class_getitem__(int)"\n'
+                 '   >>> list[int]\n'
+                 '   list[int]\n'
+                 '   >>> # list.__class_getitem__ returns a GenericAlias '
+                 'object:\n'
+                 '   >>> type(list[int])\n'
+                 "   <class 'types.GenericAlias'>\n"
+                 '\n'
+                 'However, if a class has a custom metaclass that defines\n'
+                 '"__getitem__()", subscribing the class may result in '
+                 'different\n'
+                 'behaviour. An example of this can be found in the "enum" '
+                 'module:\n'
+                 '\n'
+                 '   >>> from enum import Enum\n'
+                 '   >>> class Menu(Enum):\n'
+                 '   ...     """A breakfast menu"""\n'
+                 "   ...     SPAM = 'spam'\n"
+                 "   ...     BACON = 'bacon'\n"
+                 '   ...\n'
+                 '   >>> # Enum classes have a custom metaclass:\n'
+                 '   >>> type(Menu)\n'
+                 "   <class 'enum.EnumMeta'>\n"
+                 '   >>> # EnumMeta defines __getitem__,\n'
+                 '   >>> # so __class_getitem__ is not called,\n'
+                 '   >>> # and the result is not a GenericAlias object:\n'
+                 "   >>> Menu['SPAM']\n"
+                 "   <Menu.SPAM: 'spam'>\n"
+                 "   >>> type(Menu['SPAM'])\n"
+                 "   <enum 'Menu'>\n"
                  '\n'
                  'See also:\n'
                  '\n'
-                 '  **PEP 560** - Core support for typing module and generic '
+                 '  **PEP 560** - Core Support for typing module and generic '
                  'types\n'
+                 '     Introducing "__class_getitem__()", and outlining when '
+                 'a\n'
+                 '     subscription results in "__class_getitem__()" being '
+                 'called\n'
+                 '     instead of "__getitem__()"\n'
                  '\n'
                  '\n'
                  'Emulating callable objects\n'
@@ -9384,60 +10498,60 @@
                  '\n'
                  'The following methods can be defined to implement container '
                  'objects.\n'
-                 'Containers usually are sequences (such as lists or tuples) '
-                 'or mappings\n'
-                 '(like dictionaries), but can represent other containers as '
-                 'well.  The\n'
-                 'first set of methods is used either to emulate a sequence or '
-                 'to\n'
-                 'emulate a mapping; the difference is that for a sequence, '
-                 'the\n'
-                 'allowable keys should be the integers *k* for which "0 <= k '
-                 '< N" where\n'
-                 '*N* is the length of the sequence, or slice objects, which '
-                 'define a\n'
-                 'range of items.  It is also recommended that mappings '
-                 'provide the\n'
-                 'methods "keys()", "values()", "items()", "get()", '
-                 '"clear()",\n'
-                 '"setdefault()", "pop()", "popitem()", "copy()", and '
-                 '"update()"\n'
-                 'behaving similar to those for Python’s standard dictionary '
+                 'Containers usually are *sequences* (such as "lists" or '
+                 '"tuples") or\n'
+                 '*mappings* (like "dictionaries"), but can represent other '
+                 'containers\n'
+                 'as well.  The first set of methods is used either to emulate '
+                 'a\n'
+                 'sequence or to emulate a mapping; the difference is that for '
+                 'a\n'
+                 'sequence, the allowable keys should be the integers *k* for '
+                 'which "0\n'
+                 '<= k < N" where *N* is the length of the sequence, or '
+                 '"slice" objects,\n'
+                 'which define a range of items.  It is also recommended that '
+                 'mappings\n'
+                 'provide the methods "keys()", "values()", "items()", '
+                 '"get()",\n'
+                 '"clear()", "setdefault()", "pop()", "popitem()", "copy()", '
+                 'and\n'
+                 '"update()" behaving similar to those for Python’s standard\n'
+                 '"dictionary" objects.  The "collections.abc" module provides '
+                 'a\n'
+                 '"MutableMapping" *abstract base class* to help create those '
+                 'methods\n'
+                 'from a base set of "__getitem__()", "__setitem__()", '
+                 '"__delitem__()",\n'
+                 'and "keys()". Mutable sequences should provide methods '
+                 '"append()",\n'
+                 '"count()", "index()", "extend()", "insert()", "pop()", '
+                 '"remove()",\n'
+                 '"reverse()" and "sort()", like Python standard "list" '
                  'objects.\n'
-                 'The "collections.abc" module provides a "MutableMapping" '
-                 'abstract base\n'
-                 'class to help create those methods from a base set of '
-                 '"__getitem__()",\n'
-                 '"__setitem__()", "__delitem__()", and "keys()". Mutable '
-                 'sequences\n'
-                 'should provide methods "append()", "count()", "index()", '
-                 '"extend()",\n'
-                 '"insert()", "pop()", "remove()", "reverse()" and "sort()", '
-                 'like Python\n'
-                 'standard list objects.  Finally, sequence types should '
-                 'implement\n'
-                 'addition (meaning concatenation) and multiplication '
-                 '(meaning\n'
-                 'repetition) by defining the methods "__add__()", '
-                 '"__radd__()",\n'
-                 '"__iadd__()", "__mul__()", "__rmul__()" and "__imul__()" '
-                 'described\n'
-                 'below; they should not define other numerical operators.  It '
-                 'is\n'
-                 'recommended that both mappings and sequences implement the\n'
-                 '"__contains__()" method to allow efficient use of the "in" '
-                 'operator;\n'
-                 'for mappings, "in" should search the mapping’s keys; for '
-                 'sequences, it\n'
-                 'should search through the values.  It is further recommended '
-                 'that both\n'
-                 'mappings and sequences implement the "__iter__()" method to '
-                 'allow\n'
-                 'efficient iteration through the container; for mappings, '
-                 '"__iter__()"\n'
-                 'should iterate through the object’s keys; for sequences, it '
-                 'should\n'
-                 'iterate through the values.\n'
+                 'Finally, sequence types should implement addition (meaning\n'
+                 'concatenation) and multiplication (meaning repetition) by '
+                 'defining the\n'
+                 'methods "__add__()", "__radd__()", "__iadd__()", '
+                 '"__mul__()",\n'
+                 '"__rmul__()" and "__imul__()" described below; they should '
+                 'not define\n'
+                 'other numerical operators.  It is recommended that both '
+                 'mappings and\n'
+                 'sequences implement the "__contains__()" method to allow '
+                 'efficient use\n'
+                 'of the "in" operator; for mappings, "in" should search the '
+                 'mapping’s\n'
+                 'keys; for sequences, it should search through the values.  '
+                 'It is\n'
+                 'further recommended that both mappings and sequences '
+                 'implement the\n'
+                 '"__iter__()" method to allow efficient iteration through '
+                 'the\n'
+                 'container; for mappings, "__iter__()" should iterate through '
+                 'the\n'
+                 'object’s keys; for sequences, it should iterate through the '
+                 'values.\n'
                  '\n'
                  'object.__len__(self)\n'
                  '\n'
@@ -9495,22 +10609,23 @@
                  'object.__getitem__(self, key)\n'
                  '\n'
                  '   Called to implement evaluation of "self[key]". For '
-                 'sequence types,\n'
-                 '   the accepted keys should be integers and slice objects.  '
-                 'Note that\n'
-                 '   the special interpretation of negative indexes (if the '
-                 'class wishes\n'
-                 '   to emulate a sequence type) is up to the "__getitem__()" '
-                 'method. If\n'
-                 '   *key* is of an inappropriate type, "TypeError" may be '
-                 'raised; if of\n'
-                 '   a value outside the set of indexes for the sequence '
-                 '(after any\n'
-                 '   special interpretation of negative values), "IndexError" '
+                 '*sequence*\n'
+                 '   types, the accepted keys should be integers and slice '
+                 'objects.\n'
+                 '   Note that the special interpretation of negative indexes '
+                 '(if the\n'
+                 '   class wishes to emulate a *sequence* type) is up to the\n'
+                 '   "__getitem__()" method. If *key* is of an inappropriate '
+                 'type,\n'
+                 '   "TypeError" may be raised; if of a value outside the set '
+                 'of indexes\n'
+                 '   for the sequence (after any special interpretation of '
+                 'negative\n'
+                 '   values), "IndexError" should be raised. For *mapping* '
+                 'types, if\n'
+                 '   *key* is missing (not in the container), "KeyError" '
                  'should be\n'
-                 '   raised. For mapping types, if *key* is missing (not in '
-                 'the\n'
-                 '   container), "KeyError" should be raised.\n'
+                 '   raised.\n'
                  '\n'
                  '   Note:\n'
                  '\n'
@@ -9520,6 +10635,14 @@
                  'the\n'
                  '     sequence.\n'
                  '\n'
+                 '   Note:\n'
+                 '\n'
+                 '     When subscripting a *class*, the special class method\n'
+                 '     "__class_getitem__()" may be called instead of '
+                 '"__getitem__()".\n'
+                 '     See __class_getitem__ versus __getitem__ for more '
+                 'details.\n'
+                 '\n'
                  'object.__setitem__(self, key, value)\n'
                  '\n'
                  '   Called to implement assignment to "self[key]".  Same note '
@@ -9555,19 +10678,13 @@
                  '\n'
                  'object.__iter__(self)\n'
                  '\n'
-                 '   This method is called when an iterator is required for a '
-                 'container.\n'
-                 '   This method should return a new iterator object that can '
-                 'iterate\n'
-                 '   over all the objects in the container.  For mappings, it '
-                 'should\n'
-                 '   iterate over the keys of the container.\n'
-                 '\n'
-                 '   Iterator objects also need to implement this method; they '
-                 'are\n'
-                 '   required to return themselves.  For more information on '
-                 'iterator\n'
-                 '   objects, see Iterator Types.\n'
+                 '   This method is called when an *iterator* is required for '
+                 'a\n'
+                 '   container. This method should return a new iterator '
+                 'object that can\n'
+                 '   iterate over all the objects in the container.  For '
+                 'mappings, it\n'
+                 '   should iterate over the keys of the container.\n'
                  '\n'
                  'object.__reversed__(self)\n'
                  '\n'
@@ -9760,16 +10877,6 @@
                  'the data\n'
                  '   model.\n'
                  '\n'
-                 '   Note:\n'
-                 '\n'
-                 '     Due to a bug in the dispatching mechanism for "**=", a '
-                 'class that\n'
-                 '     defines "__ipow__()" but returns "NotImplemented" would '
-                 'fail to\n'
-                 '     fall back to "x.__pow__(y)" and "y.__rpow__(x)". This '
-                 'bug is\n'
-                 '     fixed in Python 3.10.\n'
-                 '\n'
                  'object.__neg__(self)\n'
                  'object.__pos__(self)\n'
                  'object.__abs__(self)\n'
@@ -9820,9 +10927,9 @@
                  '   of the object truncated to an "Integral" (typically an '
                  '"int").\n'
                  '\n'
-                 '   If "__int__()" is not defined then the built-in function '
-                 '"int()"\n'
-                 '   falls back to "__trunc__()".\n'
+                 '   The built-in function "int()" falls back to "__trunc__()" '
+                 'if\n'
+                 '   neither "__int__()" nor "__index__()" is defined.\n'
                  '\n'
                  '\n'
                  'With Statement Context Managers\n'
@@ -9888,6 +10995,51 @@
                  '     statement.\n'
                  '\n'
                  '\n'
+                 'Customizing positional arguments in class pattern matching\n'
+                 '==========================================================\n'
+                 '\n'
+                 'When using a class name in a pattern, positional arguments '
+                 'in the\n'
+                 'pattern are not allowed by default, i.e. "case MyClass(x, '
+                 'y)" is\n'
+                 'typically invalid without special support in "MyClass". To '
+                 'be able to\n'
+                 'use that kind of patterns, the class needs to define a\n'
+                 '*__match_args__* attribute.\n'
+                 '\n'
+                 'object.__match_args__\n'
+                 '\n'
+                 '   This class variable can be assigned a tuple of strings. '
+                 'When this\n'
+                 '   class is used in a class pattern with positional '
+                 'arguments, each\n'
+                 '   positional argument will be converted into a keyword '
+                 'argument,\n'
+                 '   using the corresponding value in *__match_args__* as the '
+                 'keyword.\n'
+                 '   The absence of this attribute is equivalent to setting it '
+                 'to "()".\n'
+                 '\n'
+                 'For example, if "MyClass.__match_args__" is "("left", '
+                 '"center",\n'
+                 '"right")" that means that "case MyClass(x, y)" is equivalent '
+                 'to "case\n'
+                 'MyClass(left=x, center=y)". Note that the number of '
+                 'arguments in the\n'
+                 'pattern must be smaller than or equal to the number of '
+                 'elements in\n'
+                 '*__match_args__*; if it is larger, the pattern match attempt '
+                 'will\n'
+                 'raise a "TypeError".\n'
+                 '\n'
+                 'New in version 3.10.\n'
+                 '\n'
+                 'See also:\n'
+                 '\n'
+                 '  **PEP 634** - Structural Pattern Matching\n'
+                 '     The specification for the Python "match" statement.\n'
+                 '\n'
+                 '\n'
                  'Special method lookup\n'
                  '=====================\n'
                  '\n'
@@ -10058,7 +11210,7 @@
                    '*start* and\n'
                    '   *end* are interpreted as in slice notation.\n'
                    '\n'
-                   'str.encode(encoding="utf-8", errors="strict")\n'
+                   "str.encode(encoding='utf-8', errors='strict')\n"
                    '\n'
                    '   Return an encoded version of the string as a bytes '
                    'object. Default\n'
@@ -10307,9 +11459,9 @@
                    '      >>> from keyword import iskeyword\n'
                    '\n'
                    "      >>> 'hello'.isidentifier(), iskeyword('hello')\n"
-                   '      True, False\n'
+                   '      (True, False)\n'
                    "      >>> 'def'.isidentifier(), iskeyword('def')\n"
-                   '      True, True\n'
+                   '      (True, True)\n'
                    '\n'
                    'str.islower()\n'
                    '\n'
@@ -10564,7 +11716,7 @@
                    'followed by\n'
                    '   the string itself.\n'
                    '\n'
-                   'str.rsplit(sep=None, maxsplit=-1)\n'
+                   'str.rsplit(sep=None, maxsplit=- 1)\n'
                    '\n'
                    '   Return a list of the words in the string, using *sep* '
                    'as the\n'
@@ -10605,7 +11757,7 @@
                    "      >>> 'Monty Python'.removesuffix(' Python')\n"
                    "      'Monty'\n"
                    '\n'
-                   'str.split(sep=None, maxsplit=-1)\n'
+                   'str.split(sep=None, maxsplit=- 1)\n'
                    '\n'
                    '   Return a list of the words in the string, using *sep* '
                    'as the\n'
@@ -10660,7 +11812,7 @@
                    "      >>> '   1   2   3   '.split()\n"
                    "      ['1', '2', '3']\n"
                    '\n'
-                   'str.splitlines([keepends])\n'
+                   'str.splitlines(keepends=False)\n'
                    '\n'
                    '   Return a list of the lines in the string, breaking at '
                    'line\n'
@@ -11141,67 +12293,86 @@
  'subscriptions': 'Subscriptions\n'
                   '*************\n'
                   '\n'
-                  'Subscription of a sequence (string, tuple or list) or '
-                  'mapping\n'
-                  '(dictionary) object usually selects an item from the '
-                  'collection:\n'
+                  'The subscription of an instance of a container class will '
+                  'generally\n'
+                  'select an element from the container. The subscription of a '
+                  '*generic\n'
+                  'class* will generally return a GenericAlias object.\n'
                   '\n'
                   '   subscription ::= primary "[" expression_list "]"\n'
                   '\n'
+                  'When an object is subscripted, the interpreter will '
+                  'evaluate the\n'
+                  'primary and the expression list.\n'
+                  '\n'
                   'The primary must evaluate to an object that supports '
-                  'subscription\n'
-                  '(lists or dictionaries for example).  User-defined objects '
-                  'can support\n'
-                  'subscription by defining a "__getitem__()" method.\n'
+                  'subscription. An\n'
+                  'object may support subscription through defining one or '
+                  'both of\n'
+                  '"__getitem__()" and "__class_getitem__()". When the primary '
+                  'is\n'
+                  'subscripted, the evaluated result of the expression list '
+                  'will be\n'
+                  'passed to one of these methods. For more details on when\n'
+                  '"__class_getitem__" is called instead of "__getitem__", '
+                  'see\n'
+                  '__class_getitem__ versus __getitem__.\n'
+                  '\n'
+                  'If the expression list contains at least one comma, it will '
+                  'evaluate\n'
+                  'to a "tuple" containing the items of the expression list. '
+                  'Otherwise,\n'
+                  'the expression list will evaluate to the value of the '
+                  'list’s sole\n'
+                  'member.\n'
                   '\n'
                   'For built-in objects, there are two types of objects that '
                   'support\n'
-                  'subscription:\n'
+                  'subscription via "__getitem__()":\n'
                   '\n'
-                  'If the primary is a mapping, the expression list must '
-                  'evaluate to an\n'
-                  'object whose value is one of the keys of the mapping, and '
+                  '1. Mappings. If the primary is a *mapping*, the expression '
+                  'list must\n'
+                  '   evaluate to an object whose value is one of the keys of '
                   'the\n'
-                  'subscription selects the value in the mapping that '
-                  'corresponds to that\n'
-                  'key.  (The expression list is a tuple except if it has '
-                  'exactly one\n'
-                  'item.)\n'
+                  '   mapping, and the subscription selects the value in the '
+                  'mapping that\n'
+                  '   corresponds to that key. An example of a builtin mapping '
+                  'class is\n'
+                  '   the "dict" class.\n'
                   '\n'
-                  'If the primary is a sequence, the expression list must '
-                  'evaluate to an\n'
-                  'integer or a slice (as discussed in the following '
-                  'section).\n'
+                  '2. Sequences. If the primary is a *sequence*, the '
+                  'expression list must\n'
+                  '   evaluate to an "int" or a "slice" (as discussed in the '
+                  'following\n'
+                  '   section). Examples of builtin sequence classes include '
+                  'the "str",\n'
+                  '   "list" and "tuple" classes.\n'
                   '\n'
                   'The formal syntax makes no special provision for negative '
                   'indices in\n'
-                  'sequences; however, built-in sequences all provide a '
+                  '*sequences*. However, built-in sequences all provide a '
                   '"__getitem__()"\n'
                   'method that interprets negative indices by adding the '
                   'length of the\n'
-                  'sequence to the index (so that "x[-1]" selects the last '
-                  'item of "x").\n'
-                  'The resulting value must be a nonnegative integer less than '
-                  'the number\n'
-                  'of items in the sequence, and the subscription selects the '
-                  'item whose\n'
-                  'index is that value (counting from zero). Since the support '
-                  'for\n'
-                  'negative indices and slicing occurs in the object’s '
-                  '"__getitem__()"\n'
-                  'method, subclasses overriding this method will need to '
-                  'explicitly add\n'
-                  'that support.\n'
+                  'sequence to the index so that, for example, "x[-1]" selects '
+                  'the last\n'
+                  'item of "x". The resulting value must be a nonnegative '
+                  'integer less\n'
+                  'than the number of items in the sequence, and the '
+                  'subscription selects\n'
+                  'the item whose index is that value (counting from zero). '
+                  'Since the\n'
+                  'support for negative indices and slicing occurs in the '
+                  'object’s\n'
+                  '"__getitem__()" method, subclasses overriding this method '
+                  'will need to\n'
+                  'explicitly add that support.\n'
                   '\n'
-                  'A string’s items are characters.  A character is not a '
-                  'separate data\n'
-                  'type but a string of exactly one character.\n'
-                  '\n'
-                  'Subscription of certain *classes* or *types* creates a '
-                  'generic alias.\n'
-                  'In this case, user-defined classes can support subscription '
-                  'by\n'
-                  'providing a "__class_getitem__()" classmethod.\n',
+                  'A "string" is a special kind of sequence whose items are '
+                  '*characters*.\n'
+                  'A character is not a separate data type but a string of '
+                  'exactly one\n'
+                  'character.\n',
  'truth': 'Truth Value Testing\n'
           '*******************\n'
           '\n'
@@ -11259,7 +12430,8 @@
         'object is “compatible” with the exception.  An object is compatible\n'
         'with an exception if it is the class or a base class of the '
         'exception\n'
-        'object or a tuple containing an item compatible with the exception.\n'
+        'object, or a tuple containing an item that is the class or a base\n'
+        'class of the exception object.\n'
         '\n'
         'If no except clause matches the exception, the search for an '
         'exception\n'
@@ -11314,9 +12486,31 @@
         'the\n'
         'exception class, the exception instance and a traceback object (see\n'
         'section The standard type hierarchy) identifying the point in the\n'
-        'program where the exception occurred.  "sys.exc_info()" values are\n'
-        'restored to their previous values (before the call) when returning\n'
-        'from a function that handled an exception.\n'
+        'program where the exception occurred.  The details about the '
+        'exception\n'
+        'accessed via "sys.exc_info()" are restored to their previous values\n'
+        'when leaving an exception handler:\n'
+        '\n'
+        '   >>> print(sys.exc_info())\n'
+        '   (None, None, None)\n'
+        '   >>> try:\n'
+        '   ...     raise TypeError\n'
+        '   ... except:\n'
+        '   ...     print(sys.exc_info())\n'
+        '   ...     try:\n'
+        '   ...          raise ValueError\n'
+        '   ...     except:\n'
+        '   ...         print(sys.exc_info())\n'
+        '   ...     print(sys.exc_info())\n'
+        '   ...\n'
+        "   (<class 'TypeError'>, TypeError(), <traceback object at "
+        '0x10efad080>)\n'
+        "   (<class 'ValueError'>, ValueError(), <traceback object at "
+        '0x10efad040>)\n'
+        "   (<class 'TypeError'>, TypeError(), <traceback object at "
+        '0x10efad080>)\n'
+        '   >>> print(sys.exc_info())\n'
+        '   (None, None, None)\n'
         '\n'
         'The optional "else" clause is executed if the control flow leaves '
         'the\n'
@@ -11480,7 +12674,6 @@
           '      There are two types of integers:\n'
           '\n'
           '      Integers ("int")\n'
-          '\n'
           '         These represent numbers in an unlimited range, subject to\n'
           '         available (virtual) memory only.  For the purpose of '
           'shift\n'
@@ -11577,7 +12770,7 @@
           '         points. All the code points in the range "U+0000 - '
           'U+10FFFF"\n'
           '         can be represented in a string.  Python doesn’t have a '
-          '"char"\n'
+          '*char*\n'
           '         type; instead, every code point in the string is '
           'represented\n'
           '         as a string object with length "1".  The built-in '
@@ -11837,7 +13030,13 @@
           '|             |\n'
           '      |                           | and "\'return\'" for the '
           'return   |             |\n'
-          '      |                           | annotation, if provided.        '
+          '      |                           | annotation, if provided.  For   '
+          '|             |\n'
+          '      |                           | more information on working     '
+          '|             |\n'
+          '      |                           | with this attribute, see        '
+          '|             |\n'
+          '      |                           | Annotations Best Practices.     '
           '|             |\n'
           '      '
           '+---------------------------+---------------------------------+-------------+\n'
@@ -11958,20 +13157,18 @@
           '      A function or method which uses the "yield" statement (see\n'
           '      section The yield statement) is called a *generator '
           'function*.\n'
-          '      Such a function, when called, always returns an iterator '
-          'object\n'
-          '      which can be used to execute the body of the function:  '
-          'calling\n'
-          '      the iterator’s "iterator.__next__()" method will cause the\n'
-          '      function to execute until it provides a value using the '
-          '"yield"\n'
-          '      statement.  When the function executes a "return" statement '
-          'or\n'
-          '      falls off the end, a "StopIteration" exception is raised and '
-          'the\n'
-          '      iterator will have reached the end of the set of values to '
-          'be\n'
-          '      returned.\n'
+          '      Such a function, when called, always returns an *iterator*\n'
+          '      object which can be used to execute the body of the '
+          'function:\n'
+          '      calling the iterator’s "iterator.__next__()" method will '
+          'cause\n'
+          '      the function to execute until it provides a value using the\n'
+          '      "yield" statement.  When the function executes a "return"\n'
+          '      statement or falls off the end, a "StopIteration" exception '
+          'is\n'
+          '      raised and the iterator will have reached the end of the set '
+          'of\n'
+          '      values to be returned.\n'
           '\n'
           '   Coroutine functions\n'
           '      A function or method which is defined using "async def" is\n'
@@ -11987,18 +13184,18 @@
           '      which uses the "yield" statement is called a *asynchronous\n'
           '      generator function*.  Such a function, when called, returns '
           'an\n'
-          '      asynchronous iterator object which can be used in an "async '
-          'for"\n'
-          '      statement to execute the body of the function.\n'
+          '      *asynchronous iterator* object which can be used in an '
+          '"async\n'
+          '      for" statement to execute the body of the function.\n'
           '\n'
-          '      Calling the asynchronous iterator’s "aiterator.__anext__()"\n'
-          '      method will return an *awaitable* which when awaited will\n'
-          '      execute until it provides a value using the "yield" '
-          'expression.\n'
-          '      When the function executes an empty "return" statement or '
-          'falls\n'
-          '      off the end, a "StopAsyncIteration" exception is raised and '
+          '      Calling the asynchronous iterator’s "aiterator.__anext__" '
+          'method\n'
+          '      will return an *awaitable* which when awaited will execute '
+          'until\n'
+          '      it provides a value using the "yield" expression.  When the\n'
+          '      function executes an empty "return" statement or falls off '
           'the\n'
+          '      end, a "StopAsyncIteration" exception is raised and the\n'
           '      asynchronous iterator will have reached the end of the set '
           'of\n'
           '      values to be yielded.\n'
@@ -12062,20 +13259,34 @@
           '   Attribute assignment updates the module’s namespace dictionary,\n'
           '   e.g., "m.x = 1" is equivalent to "m.__dict__["x"] = 1".\n'
           '\n'
-          '   Predefined (writable) attributes: "__name__" is the module’s '
-          'name;\n'
-          '   "__doc__" is the module’s documentation string, or "None" if\n'
-          '   unavailable; "__annotations__" (optional) is a dictionary\n'
-          '   containing *variable annotations* collected during module body\n'
-          '   execution; "__file__" is the pathname of the file from which '
+          '   Predefined (writable) attributes:\n'
+          '\n'
+          '      "__name__"\n'
+          '         The module’s name.\n'
+          '\n'
+          '      "__doc__"\n'
+          '         The module’s documentation string, or "None" if '
+          'unavailable.\n'
+          '\n'
+          '      "__file__"\n'
+          '         The pathname of the file from which the module was loaded, '
+          'if\n'
+          '         it was loaded from a file. The "__file__" attribute may '
+          'be\n'
+          '         missing for certain types of modules, such as C modules '
+          'that\n'
+          '         are statically linked into the interpreter.  For '
+          'extension\n'
+          '         modules loaded dynamically from a shared library, it’s '
           'the\n'
-          '   module was loaded, if it was loaded from a file. The "__file__"\n'
-          '   attribute may be missing for certain types of modules, such as '
-          'C\n'
-          '   modules that are statically linked into the interpreter; for\n'
-          '   extension modules loaded dynamically from a shared library, it '
-          'is\n'
-          '   the pathname of the shared library file.\n'
+          '         pathname of the shared library file.\n'
+          '\n'
+          '      "__annotations__"\n'
+          '         A dictionary containing *variable annotations* collected\n'
+          '         during module body execution.  For best practices on '
+          'working\n'
+          '         with "__annotations__", please see Annotations Best\n'
+          '         Practices.\n'
           '\n'
           '   Special read-only attribute: "__dict__" is the module’s '
           'namespace\n'
@@ -12133,20 +13344,31 @@
           'instance\n'
           '   (see below).\n'
           '\n'
-          '   Special attributes: "__name__" is the class name; "__module__" '
-          'is\n'
-          '   the module name in which the class was defined; "__dict__" is '
-          'the\n'
-          '   dictionary containing the class’s namespace; "__bases__" is a '
-          'tuple\n'
-          '   containing the base classes, in the order of their occurrence '
-          'in\n'
-          '   the base class list; "__doc__" is the class’s documentation '
-          'string,\n'
-          '   or "None" if undefined; "__annotations__" (optional) is a\n'
-          '   dictionary containing *variable annotations* collected during '
-          'class\n'
-          '   body execution.\n'
+          '   Special attributes:\n'
+          '\n'
+          '      "__name__"\n'
+          '         The class name.\n'
+          '\n'
+          '      "__module__"\n'
+          '         The name of the module in which the class was defined.\n'
+          '\n'
+          '      "__dict__"\n'
+          '         The dictionary containing the class’s namespace.\n'
+          '\n'
+          '      "__bases__"\n'
+          '         A tuple containing the base classes, in the order of '
+          'their\n'
+          '         occurrence in the base class list.\n'
+          '\n'
+          '      "__doc__"\n'
+          '         The class’s documentation string, or "None" if undefined.\n'
+          '\n'
+          '      "__annotations__"\n'
+          '         A dictionary containing *variable annotations* collected\n'
+          '         during class body execution.  For best practices on '
+          'working\n'
+          '         with "__annotations__", please see Annotations Best\n'
+          '         Practices.\n'
           '\n'
           'Class instances\n'
           '   A class instance is created by calling a class object (see '
@@ -12307,6 +13529,10 @@
           '      gives the precise instruction (this is an index into the\n'
           '      bytecode string of the code object).\n'
           '\n'
+          '      Accessing "f_code" raises an auditing event '
+          '"object.__getattr__"\n'
+          '      with arguments "obj" and ""f_code"".\n'
+          '\n'
           '      Special writable attributes: "f_trace", if not "None", is a\n'
           '      function called for various events during code execution '
           '(this\n'
@@ -12390,6 +13616,9 @@
           '      the exception occurred in a "try" statement with no matching\n'
           '      except clause or with a finally clause.\n'
           '\n'
+          '      Accessing "tb_frame" raises an auditing event\n'
+          '      "object.__getattr__" with arguments "obj" and ""tb_frame"".\n'
+          '\n'
           '      Special writable attribute: "tb_next" is the next level in '
           'the\n'
           '      stack trace (towards the frame where the exception occurred), '
@@ -12440,9 +13669,8 @@
           '      object actually returned is the wrapped object, which is not\n'
           '      subject to any further transformation. Static method objects '
           'are\n'
-          '      not themselves callable, although the objects they wrap '
-          'usually\n'
-          '      are. Static method objects are created by the built-in\n'
+          '      also callable. Static method objects are created by the '
+          'built-in\n'
           '      "staticmethod()" constructor.\n'
           '\n'
           '   Class method objects\n'
@@ -12511,9 +13739,9 @@
                  '"dict"\n'
                  'constructor.\n'
                  '\n'
-                 'class dict(**kwarg)\n'
-                 'class dict(mapping, **kwarg)\n'
-                 'class dict(iterable, **kwarg)\n'
+                 'class dict(**kwargs)\n'
+                 'class dict(mapping, **kwargs)\n'
+                 'class dict(iterable, **kwargs)\n'
                  '\n'
                  '   Return a new dictionary initialized from an optional '
                  'positional\n'
@@ -12907,6 +14135,14 @@
                  '   Changed in version 3.8: Dictionary views are now '
                  'reversible.\n'
                  '\n'
+                 'dictview.mapping\n'
+                 '\n'
+                 '   Return a "types.MappingProxyType" that wraps the '
+                 'original\n'
+                 '   dictionary to which the view refers.\n'
+                 '\n'
+                 '   New in version 3.10.\n'
+                 '\n'
                  'Keys views are set-like since their entries are unique and '
                  'hashable.\n'
                  'If all values are hashable, so that "(key, value)" pairs are '
@@ -12952,7 +14188,15 @@
                  "   >>> keys & {'eggs', 'bacon', 'salad'}\n"
                  "   {'bacon'}\n"
                  "   >>> keys ^ {'sausage', 'juice'}\n"
-                 "   {'juice', 'sausage', 'bacon', 'spam'}\n",
+                 "   {'juice', 'sausage', 'bacon', 'spam'}\n"
+                 '\n'
+                 '   >>> # get back a read-only proxy for the original '
+                 'dictionary\n'
+                 '   >>> values.mapping\n'
+                 "   mappingproxy({'eggs': 2, 'sausage': 1, 'bacon': 1, "
+                 "'spam': 500})\n"
+                 "   >>> values.mapping['spam']\n"
+                 '   500\n',
  'typesmethods': 'Methods\n'
                  '*******\n'
                  '\n'
@@ -13147,6 +14391,14 @@
              'Comparisons in\n'
              'the language reference.)\n'
              '\n'
+             'Forward and reversed iterators over mutable sequences access '
+             'values\n'
+             'using an index.  That index will continue to march forward (or\n'
+             'backward) even if the underlying sequence is mutated.  The '
+             'iterator\n'
+             'terminates only when an "IndexError" or a "StopIteration" is\n'
+             'encountered (or when the index drops below zero).\n'
+             '\n'
              'Notes:\n'
              '\n'
              '1. While the "in" and "not in" operations are used only for '
@@ -13378,7 +14630,7 @@
              '|                                | "s[i:i] = '
              '[x]")                  |                       |\n'
              '+--------------------------------+----------------------------------+-----------------------+\n'
-             '| "s.pop([i])"                   | retrieves the item at *i* '
+             '| "s.pop()" or "s.pop(i)"        | retrieves the item at *i* '
              'and    | (2)                   |\n'
              '|                                | also removes it from '
              '*s*         |                       |\n'
@@ -13618,7 +14870,8 @@
              '\n'
              '   The arguments to the range constructor must be integers '
              '(either\n'
-             '   built-in "int" or any object that implements the "__index__"\n'
+             '   built-in "int" or any object that implements the '
+             '"__index__()"\n'
              '   special method).  If the *step* argument is omitted, it '
              'defaults to\n'
              '   "1". If the *start* argument is omitted, it defaults to "0". '
@@ -13841,7 +15094,7 @@
                      '|                                | "s[i:i] = '
                      '[x]")                  |                       |\n'
                      '+--------------------------------+----------------------------------+-----------------------+\n'
-                     '| "s.pop([i])"                   | retrieves the item at '
+                     '| "s.pop()" or "s.pop(i)"        | retrieves the item at '
                      '*i* and    | (2)                   |\n'
                      '|                                | also removes it from '
                      '*s*         |                       |\n'
@@ -13906,15 +15159,21 @@
           '   u_expr ::= power | "-" u_expr | "+" u_expr | "~" u_expr\n'
           '\n'
           'The unary "-" (minus) operator yields the negation of its numeric\n'
-          'argument.\n'
+          'argument; the operation can be overridden with the "__neg__()" '
+          'special\n'
+          'method.\n'
           '\n'
           'The unary "+" (plus) operator yields its numeric argument '
-          'unchanged.\n'
+          'unchanged;\n'
+          'the operation can be overridden with the "__pos__()" special '
+          'method.\n'
           '\n'
           'The unary "~" (invert) operator yields the bitwise inversion of '
           'its\n'
           'integer argument.  The bitwise inversion of "x" is defined as\n'
-          '"-(x+1)".  It only applies to integral numbers.\n'
+          '"-(x+1)".  It only applies to integral numbers or to custom '
+          'objects\n'
+          'that override the "__invert__()" special method.\n'
           '\n'
           'In all three cases, if the argument does not have the proper type, '
           'a\n'
@@ -13952,8 +15211,10 @@
          'usage\n'
          'patterns to be encapsulated for convenient reuse.\n'
          '\n'
-         '   with_stmt ::= "with" with_item ("," with_item)* ":" suite\n'
-         '   with_item ::= expression ["as" target]\n'
+         '   with_stmt          ::= "with" ( "(" with_stmt_contents ","? ")" | '
+         'with_stmt_contents ) ":" suite\n'
+         '   with_stmt_contents ::= with_item ("," with_item)*\n'
+         '   with_item          ::= expression ["as" target]\n'
          '\n'
          'The execution of the "with" statement with one “item” proceeds as\n'
          'follows:\n'
@@ -14039,8 +15300,20 @@
          '       with B() as b:\n'
          '           SUITE\n'
          '\n'
+         'You can also write multi-item context managers in multiple lines if\n'
+         'the items are surrounded by parentheses. For example:\n'
+         '\n'
+         '   with (\n'
+         '       A() as a,\n'
+         '       B() as b,\n'
+         '   ):\n'
+         '       SUITE\n'
+         '\n'
          'Changed in version 3.1: Support for multiple context expressions.\n'
          '\n'
+         'Changed in version 3.10: Support for using grouping parentheses to\n'
+         'break the statement in multiple lines.\n'
+         '\n'
          'See also:\n'
          '\n'
          '  **PEP 343** - The “with” statement\n'
diff --git a/Lib/random.py b/Lib/random.py
index a6454f5..1310a2d 100644
--- a/Lib/random.py
+++ b/Lib/random.py
@@ -48,9 +48,10 @@
 from warnings import warn as _warn
 from math import log as _log, exp as _exp, pi as _pi, e as _e, ceil as _ceil
 from math import sqrt as _sqrt, acos as _acos, cos as _cos, sin as _sin
-from math import tau as TWOPI, floor as _floor
+from math import tau as TWOPI, floor as _floor, isfinite as _isfinite
 from os import urandom as _urandom
 from _collections_abc import Set as _Set, Sequence as _Sequence
+from operator import index as _index
 from itertools import accumulate as _accumulate, repeat as _repeat
 from bisect import bisect as _bisect
 import os as _os
@@ -77,6 +78,7 @@
     "lognormvariate",
     "normalvariate",
     "paretovariate",
+    "randbytes",
     "randint",
     "random",
     "randrange",
@@ -95,6 +97,7 @@
 SG_MAGICCONST = 1.0 + _log(4.5)
 BPF = 53        # Number of bits in a float
 RECIP_BPF = 2 ** -BPF
+_ONE = 1
 
 
 class Random(_random.Random):
@@ -151,8 +154,7 @@
         elif version == 2 and isinstance(a, (str, bytes, bytearray)):
             if isinstance(a, str):
                 a = a.encode()
-            a += _sha512(a).digest()
-            a = int.from_bytes(a, 'big')
+            a = int.from_bytes(a + _sha512(a).digest(), 'big')
 
         elif not isinstance(a, (type(None), int, float, str, bytes, bytearray)):
             _warn('Seeding based on hashing is deprecated\n'
@@ -287,7 +289,7 @@
 
     ## -------------------- integer methods  -------------------
 
-    def randrange(self, start, stop=None, step=1):
+    def randrange(self, start, stop=None, step=_ONE):
         """Choose a random item from range(start, stop[, step]).
 
         This fixes the problem with randint() which includes the
@@ -297,38 +299,68 @@
 
         # This code is a bit messy to make it fast for the
         # common case while still doing adequate error checking.
-        istart = int(start)
-        if istart != start:
-            raise ValueError("non-integer arg 1 for randrange()")
+        try:
+            istart = _index(start)
+        except TypeError:
+            istart = int(start)
+            if istart != start:
+                _warn('randrange() will raise TypeError in the future',
+                      DeprecationWarning, 2)
+                raise ValueError("non-integer arg 1 for randrange()")
+            _warn('non-integer arguments to randrange() have been deprecated '
+                  'since Python 3.10 and will be removed in a subsequent '
+                  'version',
+                  DeprecationWarning, 2)
         if stop is None:
+            # We don't check for "step != 1" because it hasn't been
+            # type checked and converted to an integer yet.
+            if step is not _ONE:
+                raise TypeError('Missing a non-None stop argument')
             if istart > 0:
                 return self._randbelow(istart)
             raise ValueError("empty range for randrange()")
 
         # stop argument supplied.
-        istop = int(stop)
-        if istop != stop:
-            raise ValueError("non-integer stop for randrange()")
+        try:
+            istop = _index(stop)
+        except TypeError:
+            istop = int(stop)
+            if istop != stop:
+                _warn('randrange() will raise TypeError in the future',
+                      DeprecationWarning, 2)
+                raise ValueError("non-integer stop for randrange()")
+            _warn('non-integer arguments to randrange() have been deprecated '
+                  'since Python 3.10 and will be removed in a subsequent '
+                  'version',
+                  DeprecationWarning, 2)
         width = istop - istart
-        if step == 1 and width > 0:
-            return istart + self._randbelow(width)
-        if step == 1:
+        try:
+            istep = _index(step)
+        except TypeError:
+            istep = int(step)
+            if istep != step:
+                _warn('randrange() will raise TypeError in the future',
+                      DeprecationWarning, 2)
+                raise ValueError("non-integer step for randrange()")
+            _warn('non-integer arguments to randrange() have been deprecated '
+                  'since Python 3.10 and will be removed in a subsequent '
+                  'version',
+                  DeprecationWarning, 2)
+        # Fast path.
+        if istep == 1:
+            if width > 0:
+                return istart + self._randbelow(width)
             raise ValueError("empty range for randrange() (%d, %d, %d)" % (istart, istop, width))
 
         # Non-unit step argument supplied.
-        istep = int(step)
-        if istep != step:
-            raise ValueError("non-integer step for randrange()")
         if istep > 0:
             n = (width + istep - 1) // istep
         elif istep < 0:
             n = (width + istep + 1) // istep
         else:
             raise ValueError("zero step for randrange()")
-
         if n <= 0:
             raise ValueError("empty range for randrange()")
-
         return istart + istep * self._randbelow(n)
 
     def randint(self, a, b):
@@ -424,13 +456,14 @@
         # too many calls to _randbelow(), making them slower and
         # causing them to eat more entropy than necessary.
 
-        if isinstance(population, _Set):
-            _warn('Sampling from a set deprecated\n'
-                  'since Python 3.9 and will be removed in a subsequent version.',
-                  DeprecationWarning, 2)
-            population = tuple(population)
         if not isinstance(population, _Sequence):
-            raise TypeError("Population must be a sequence.  For dicts or sets, use sorted(d).")
+            if isinstance(population, _Set):
+                _warn('Sampling from a set deprecated\n'
+                      'since Python 3.9 and will be removed in a subsequent version.',
+                      DeprecationWarning, 2)
+                population = tuple(population)
+            else:
+                raise TypeError("Population must be a sequence.  For dicts or sets, use sorted(d).")
         n = len(population)
         if counts is not None:
             cum_counts = list(_accumulate(counts))
@@ -441,7 +474,7 @@
                 raise TypeError('Counts must be integers')
             if total <= 0:
                 raise ValueError('Total of counts must be greater than zero')
-            selections = sample(range(total), k=k)
+            selections = self.sample(range(total), k=k)
             bisect = _bisect
             return [population[bisect(cum_counts, s)] for s in selections]
         randbelow = self._randbelow
@@ -484,7 +517,15 @@
                 floor = _floor
                 n += 0.0    # convert to float for a small speed improvement
                 return [population[floor(random() * n)] for i in _repeat(None, k)]
-            cum_weights = list(_accumulate(weights))
+            try:
+                cum_weights = list(_accumulate(weights))
+            except TypeError:
+                if not isinstance(weights, int):
+                    raise
+                k = weights
+                raise TypeError(
+                    f'The number of choices must be a keyword argument: {k=}'
+                ) from None
         elif weights is not None:
             raise TypeError('Cannot specify both weights and cumulative weights')
         if len(cum_weights) != n:
@@ -492,6 +533,8 @@
         total = cum_weights[-1] + 0.0   # convert to float
         if total <= 0.0:
             raise ValueError('Total of weights must be greater than zero')
+        if not _isfinite(total):
+            raise ValueError('Total of weights must be finite')
         bisect = _bisect
         hi = n - 1
         return [population[bisect(cum_weights, random() * total, 0, hi)]
@@ -682,7 +725,7 @@
             bbb = alpha - LOG4
             ccc = alpha + ainv
 
-            while 1:
+            while True:
                 u1 = random()
                 if not 1e-7 < u1 < 0.9999999:
                     continue
@@ -749,7 +792,7 @@
         # Jain, pg. 495
 
         u = 1.0 - self.random()
-        return 1.0 / u ** (1.0 / alpha)
+        return u ** (-1.0 / alpha)
 
     def weibullvariate(self, alpha, beta):
         """Weibull distribution.
@@ -845,7 +888,7 @@
     from time import perf_counter
 
     t0 = perf_counter()
-    data = [func(*args) for i in range(n)]
+    data = [func(*args) for i in _repeat(None, n)]
     t1 = perf_counter()
 
     xbar = mean(data)
diff --git a/Lib/re.py b/Lib/re.py
index bfb7b1c..1d82b50 100644
--- a/Lib/re.py
+++ b/Lib/re.py
@@ -176,7 +176,6 @@
                 res = f'~{res}'
         return res
     __str__ = object.__str__
-
 globals().update(RegexFlag.__members__)
 
 # sre exception
diff --git a/Lib/rlcompleter.py b/Lib/rlcompleter.py
index bca4a7b..98b7930 100644
--- a/Lib/rlcompleter.py
+++ b/Lib/rlcompleter.py
@@ -31,6 +31,7 @@
 
 import atexit
 import builtins
+import inspect
 import __main__
 
 __all__ = ["Completer"]
@@ -96,7 +97,13 @@
 
     def _callable_postfix(self, val, word):
         if callable(val):
-            word = word + "("
+            word += "("
+            try:
+                if not inspect.signature(val).parameters:
+                    word += ")"
+            except ValueError:
+                pass
+
         return word
 
     def global_matches(self, text):
@@ -169,13 +176,20 @@
                 if (word[:n] == attr and
                     not (noprefix and word[:n+1] == noprefix)):
                     match = "%s.%s" % (expr, word)
-                    try:
-                        val = getattr(thisobject, word)
-                    except Exception:
-                        pass  # Include even if attribute not set
+                    if isinstance(getattr(type(thisobject), word, None),
+                                  property):
+                        # bpo-44752: thisobject.word is a method decorated by
+                        # `@property`. What follows applies a postfix if
+                        # thisobject.word is callable, but know we know that
+                        # this is not callable (because it is a property).
+                        # Also, getattr(thisobject, word) will evaluate the
+                        # property method, which is not desirable.
+                        matches.append(match)
+                        continue
+                    if (value := getattr(thisobject, word, None)) is not None:
+                        matches.append(self._callable_postfix(value, match))
                     else:
-                        match = self._callable_postfix(val, match)
-                    matches.append(match)
+                        matches.append(match)
             if matches or not noprefix:
                 break
             if noprefix == '_':
diff --git a/Lib/runpy.py b/Lib/runpy.py
index 7e1e1ac..caba121 100644
--- a/Lib/runpy.py
+++ b/Lib/runpy.py
@@ -16,7 +16,6 @@
 import io
 import types
 import os
-from pkgutil import read_code, get_importer
 
 __all__ = [
     "run_module", "run_path",
@@ -233,6 +232,7 @@
 
 def _get_code_from_file(run_name, fname):
     # Check for a compiled file first
+    from pkgutil import read_code
     decoded_path = os.path.abspath(os.fsdecode(fname))
     with io.open_code(decoded_path) as f:
         code = read_code(f)
@@ -255,6 +255,7 @@
     if run_name is None:
         run_name = "<run_path>"
     pkg_name = run_name.rpartition(".")[0]
+    from pkgutil import get_importer
     importer = get_importer(path_name)
     # Trying to avoid importing imp so as to not consume the deprecation warning.
     is_NullImporter = False
diff --git a/Lib/sched.py b/Lib/sched.py
index ff87874..14613cf 100644
--- a/Lib/sched.py
+++ b/Lib/sched.py
@@ -26,23 +26,19 @@
 import time
 import heapq
 from collections import namedtuple
+from itertools import count
 import threading
 from time import monotonic as _time
 
 __all__ = ["scheduler"]
 
-class Event(namedtuple('Event', 'time, priority, action, argument, kwargs')):
-    __slots__ = []
-    def __eq__(s, o): return (s.time, s.priority) == (o.time, o.priority)
-    def __lt__(s, o): return (s.time, s.priority) <  (o.time, o.priority)
-    def __le__(s, o): return (s.time, s.priority) <= (o.time, o.priority)
-    def __gt__(s, o): return (s.time, s.priority) >  (o.time, o.priority)
-    def __ge__(s, o): return (s.time, s.priority) >= (o.time, o.priority)
-
+Event = namedtuple('Event', 'time, priority, sequence, action, argument, kwargs')
 Event.time.__doc__ = ('''Numeric type compatible with the return value of the
 timefunc function passed to the constructor.''')
 Event.priority.__doc__ = ('''Events scheduled for the same time will be executed
 in the order of their priority.''')
+Event.sequence.__doc__ = ('''A continually increasing sequence number that
+    separates events if time and priority are equal.''')
 Event.action.__doc__ = ('''Executing the event means executing
 action(*argument, **kwargs)''')
 Event.argument.__doc__ = ('''argument is a sequence holding the positional
@@ -61,6 +57,7 @@
         self._lock = threading.RLock()
         self.timefunc = timefunc
         self.delayfunc = delayfunc
+        self._sequence_generator = count()
 
     def enterabs(self, time, priority, action, argument=(), kwargs=_sentinel):
         """Enter a new event in the queue at an absolute time.
@@ -71,8 +68,10 @@
         """
         if kwargs is _sentinel:
             kwargs = {}
-        event = Event(time, priority, action, argument, kwargs)
+
         with self._lock:
+            event = Event(time, priority, next(self._sequence_generator),
+                          action, argument, kwargs)
             heapq.heappush(self._queue, event)
         return event # The ID
 
@@ -136,7 +135,8 @@
             with lock:
                 if not q:
                     break
-                time, priority, action, argument, kwargs = q[0]
+                (time, priority, sequence, action,
+                 argument, kwargs) = q[0]
                 now = timefunc()
                 if time > now:
                     delay = True
diff --git a/Lib/shelve.py b/Lib/shelve.py
index 5d443a0..e053c39 100644
--- a/Lib/shelve.py
+++ b/Lib/shelve.py
@@ -56,7 +56,7 @@
 the persistent dictionary on disk, if feasible).
 """
 
-from pickle import Pickler, Unpickler
+from pickle import DEFAULT_PROTOCOL, Pickler, Unpickler
 from io import BytesIO
 
 import collections.abc
@@ -85,7 +85,7 @@
                  keyencoding="utf-8"):
         self.dict = dict
         if protocol is None:
-            protocol = 3
+            protocol = DEFAULT_PROTOCOL
         self._protocol = protocol
         self.writeback = writeback
         self.cache = {}
diff --git a/Lib/shutil.py b/Lib/shutil.py
index f0e833d..37bf98d 100644
--- a/Lib/shutil.py
+++ b/Lib/shutil.py
@@ -32,16 +32,6 @@
 except ImportError:
     _LZMA_SUPPORTED = False
 
-try:
-    from pwd import getpwnam
-except ImportError:
-    getpwnam = None
-
-try:
-    from grp import getgrnam
-except ImportError:
-    getgrnam = None
-
 _WINDOWS = os.name == 'nt'
 posix = nt = None
 if os.name == 'posix':
@@ -261,28 +251,37 @@
     if not follow_symlinks and _islink(src):
         os.symlink(os.readlink(src), dst)
     else:
-        with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:
-            # macOS
-            if _HAS_FCOPYFILE:
-                try:
-                    _fastcopy_fcopyfile(fsrc, fdst, posix._COPYFILE_DATA)
-                    return dst
-                except _GiveupOnFastCopy:
-                    pass
-            # Linux
-            elif _USE_CP_SENDFILE:
-                try:
-                    _fastcopy_sendfile(fsrc, fdst)
-                    return dst
-                except _GiveupOnFastCopy:
-                    pass
-            # Windows, see:
-            # https://github.com/python/cpython/pull/7160#discussion_r195405230
-            elif _WINDOWS and file_size > 0:
-                _copyfileobj_readinto(fsrc, fdst, min(file_size, COPY_BUFSIZE))
-                return dst
+        with open(src, 'rb') as fsrc:
+            try:
+                with open(dst, 'wb') as fdst:
+                    # macOS
+                    if _HAS_FCOPYFILE:
+                        try:
+                            _fastcopy_fcopyfile(fsrc, fdst, posix._COPYFILE_DATA)
+                            return dst
+                        except _GiveupOnFastCopy:
+                            pass
+                    # Linux
+                    elif _USE_CP_SENDFILE:
+                        try:
+                            _fastcopy_sendfile(fsrc, fdst)
+                            return dst
+                        except _GiveupOnFastCopy:
+                            pass
+                    # Windows, see:
+                    # https://github.com/python/cpython/pull/7160#discussion_r195405230
+                    elif _WINDOWS and file_size > 0:
+                        _copyfileobj_readinto(fsrc, fdst, min(file_size, COPY_BUFSIZE))
+                        return dst
 
-            copyfileobj(fsrc, fdst)
+                    copyfileobj(fsrc, fdst)
+
+            # Issue 43219, raise a less confusing exception
+            except IsADirectoryError as e:
+                if not os.path.exists(dst):
+                    raise FileNotFoundError(f'Directory does not exist: {dst}') from e
+                else:
+                    raise
 
     return dst
 
@@ -647,6 +646,7 @@
         if is_dir:
             try:
                 dirfd = os.open(entry.name, os.O_RDONLY, dir_fd=topfd)
+                dirfd_closed = False
             except OSError:
                 onerror(os.open, fullname, sys.exc_info())
             else:
@@ -654,6 +654,8 @@
                     if os.path.samestat(orig_st, os.fstat(dirfd)):
                         _rmtree_safe_fd(dirfd, fullname, onerror)
                         try:
+                            os.close(dirfd)
+                            dirfd_closed = True
                             os.rmdir(entry.name, dir_fd=topfd)
                         except OSError:
                             onerror(os.rmdir, fullname, sys.exc_info())
@@ -667,7 +669,8 @@
                         except OSError:
                             onerror(os.path.islink, fullname, sys.exc_info())
                 finally:
-                    os.close(dirfd)
+                    if not dirfd_closed:
+                        os.close(dirfd)
         else:
             try:
                 os.unlink(entry.name, dir_fd=topfd)
@@ -710,6 +713,7 @@
             return
         try:
             fd = os.open(path, os.O_RDONLY)
+            fd_closed = False
         except Exception:
             onerror(os.open, path, sys.exc_info())
             return
@@ -717,6 +721,8 @@
             if os.path.samestat(orig_st, os.fstat(fd)):
                 _rmtree_safe_fd(fd, path, onerror)
                 try:
+                    os.close(fd)
+                    fd_closed = True
                     os.rmdir(path)
                 except OSError:
                     onerror(os.rmdir, path, sys.exc_info())
@@ -727,7 +733,8 @@
                 except OSError:
                     onerror(os.path.islink, path, sys.exc_info())
         finally:
-            os.close(fd)
+            if not fd_closed:
+                os.close(fd)
     else:
         try:
             if _rmtree_islink(path):
@@ -813,6 +820,12 @@
             if _destinsrc(src, dst):
                 raise Error("Cannot move a directory '%s' into itself"
                             " '%s'." % (src, dst))
+            if (_is_immutable(src)
+                    or (not os.access(src, os.W_OK) and os.listdir(src)
+                        and sys.platform == 'darwin')):
+                raise PermissionError("Cannot move the non-empty directory "
+                                      "'%s': Lacking write permission to '%s'."
+                                      % (src, src))
             copytree(src, real_dst, copy_function=copy_function,
                      symlinks=True)
             rmtree(src)
@@ -830,10 +843,21 @@
         dst += os.path.sep
     return dst.startswith(src)
 
+def _is_immutable(src):
+    st = _stat(src)
+    immutable_states = [stat.UF_IMMUTABLE, stat.SF_IMMUTABLE]
+    return hasattr(st, 'st_flags') and st.st_flags in immutable_states
+
 def _get_gid(name):
     """Returns a gid, given a group name."""
-    if getgrnam is None or name is None:
+    if name is None:
         return None
+
+    try:
+        from grp import getgrnam
+    except ImportError:
+        return None
+
     try:
         result = getgrnam(name)
     except KeyError:
@@ -844,8 +868,14 @@
 
 def _get_uid(name):
     """Returns an uid, given a user name."""
-    if getpwnam is None or name is None:
+    if name is None:
         return None
+
+    try:
+        from pwd import getpwnam
+    except ImportError:
+        return None
+
     try:
         result = getpwnam(name)
     except KeyError:
@@ -1148,20 +1178,16 @@
             if name.startswith('/') or '..' in name:
                 continue
 
-            target = os.path.join(extract_dir, *name.split('/'))
-            if not target:
+            targetpath = os.path.join(extract_dir, *name.split('/'))
+            if not targetpath:
                 continue
 
-            _ensure_directory(target)
+            _ensure_directory(targetpath)
             if not name.endswith('/'):
                 # file
-                data = zip.read(info.filename)
-                f = open(target, 'wb')
-                try:
-                    f.write(data)
-                finally:
-                    f.close()
-                    del data
+                with zip.open(name, 'r') as source, \
+                        open(targetpath, 'wb') as target:
+                    copyfileobj(source, target)
     finally:
         zip.close()
 
diff --git a/Lib/signal.py b/Lib/signal.py
index d4a6d6f..50b215b 100644
--- a/Lib/signal.py
+++ b/Lib/signal.py
@@ -1,6 +1,5 @@
 import _signal
 from _signal import *
-from functools import wraps as _wraps
 from enum import IntEnum as _IntEnum
 
 _globals = globals()
@@ -42,6 +41,16 @@
         return value
 
 
+# Similar to functools.wraps(), but only assign __doc__.
+# __module__ should be preserved,
+# __name__ and __qualname__ are already fine,
+# __annotations__ is not set.
+def _wraps(wrapped):
+    def decorator(wrapper):
+        wrapper.__doc__ = wrapped.__doc__
+        return wrapper
+    return decorator
+
 @_wraps(_signal.signal)
 def signal(signalnum, handler):
     handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
@@ -59,7 +68,6 @@
     def pthread_sigmask(how, mask):
         sigs_set = _signal.pthread_sigmask(how, mask)
         return set(_int_to_enum(x, Signals) for x in sigs_set)
-    pthread_sigmask.__doc__ = _signal.pthread_sigmask.__doc__
 
 
 if 'sigpending' in _globals:
@@ -73,7 +81,6 @@
     def sigwait(sigset):
         retsig = _signal.sigwait(sigset)
         return _int_to_enum(retsig, Signals)
-    sigwait.__doc__ = _signal.sigwait
 
 
 if 'valid_signals' in _globals:
diff --git a/Lib/site.py b/Lib/site.py
index 9e617af..939893e 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -88,6 +88,11 @@
 USER_BASE = None
 
 
+def _trace(message):
+    if sys.flags.verbose:
+        print(message, file=sys.stderr)
+
+
 def makepath(*paths):
     dir = os.path.join(*paths)
     try:
@@ -100,8 +105,15 @@
 def abs_paths():
     """Set all module __file__ and __cached__ attributes to an absolute path"""
     for m in set(sys.modules.values()):
-        if (getattr(getattr(m, '__loader__', None), '__module__', None) not in
-                ('_frozen_importlib', '_frozen_importlib_external')):
+        loader_module = None
+        try:
+            loader_module = m.__loader__.__module__
+        except AttributeError:
+            try:
+                loader_module = m.__spec__.loader.__module__
+            except AttributeError:
+                pass
+        if loader_module not in {'_frozen_importlib', '_frozen_importlib_external'}:
             continue   # don't mess with a PEP 302-supplied __file__
         try:
             m.__file__ = os.path.abspath(m.__file__)
@@ -156,14 +168,19 @@
     else:
         reset = False
     fullname = os.path.join(sitedir, name)
+    _trace(f"Processing .pth file: {fullname!r}")
     try:
-        f = io.TextIOWrapper(io.open_code(fullname))
+        # locale encoding is not ideal especially on Windows. But we have used
+        # it for a long time. setuptools uses the locale encoding too.
+        f = io.TextIOWrapper(io.open_code(fullname), encoding="locale")
     except OSError:
         return
     with f:
         for n, line in enumerate(f):
             if line.startswith("#"):
                 continue
+            if line.strip() == "":
+                continue
             try:
                 if line.startswith(("import ", "import\t")):
                     exec(line)
@@ -190,6 +207,7 @@
 def addsitedir(sitedir, known_paths=None):
     """Add 'sitedir' argument to sys.path if missing and handle .pth files in
     'sitedir'"""
+    _trace(f"Adding directory: {sitedir!r}")
     if known_paths is None:
         known_paths = _init_pathinfo()
         reset = True
@@ -248,6 +266,10 @@
     if env_base:
         return env_base
 
+    # VxWorks has no home directories
+    if sys.platform == "vxworks":
+        return None
+
     def joinuser(*args):
         return os.path.expanduser(os.path.join(*args))
 
@@ -267,7 +289,8 @@
     version = sys.version_info
 
     if os.name == 'nt':
-        return f'{userbase}\\Python{version[0]}{version[1]}\\site-packages'
+        ver_nodot = sys.winver.replace('.', '')
+        return f'{userbase}\\Python{ver_nodot}\\site-packages'
 
     if sys.platform == 'darwin' and sys._framework:
         return f'{userbase}/lib/python/site-packages'
@@ -294,11 +317,14 @@
     If the global variable ``USER_SITE`` is not initialized yet, this
     function will also set it.
     """
-    global USER_SITE
+    global USER_SITE, ENABLE_USER_SITE
     userbase = getuserbase() # this will also set USER_BASE
 
     if USER_SITE is None:
-        USER_SITE = _get_path(userbase)
+        if userbase is None:
+            ENABLE_USER_SITE = False # disable user site and return None
+        else:
+            USER_SITE = _get_path(userbase)
 
     return USER_SITE
 
@@ -310,6 +336,7 @@
     """
     # get the per user site-package path
     # this call will also make sure USER_BASE and USER_SITE are set
+    _trace("Processing user site-packages")
     user_site = getusersitepackages()
 
     if ENABLE_USER_SITE and os.path.isdir(user_site):
@@ -354,6 +381,7 @@
 
 def addsitepackages(known_paths, prefixes=None):
     """Add site-packages to sys.path"""
+    _trace("Processing global site-packages")
     for sitedir in getsitepackages(prefixes):
         if os.path.isdir(sitedir):
             addsitedir(sitedir, known_paths)
@@ -611,11 +639,14 @@
         for dir in sys.path:
             print("    %r," % (dir,))
         print("]")
-        print("USER_BASE: %r (%s)" % (user_base,
-            "exists" if os.path.isdir(user_base) else "doesn't exist"))
-        print("USER_SITE: %r (%s)" % (user_site,
-            "exists" if os.path.isdir(user_site) else "doesn't exist"))
-        print("ENABLE_USER_SITE: %r" %  ENABLE_USER_SITE)
+        def exists(path):
+            if path is not None and os.path.isdir(path):
+                return "exists"
+            else:
+                return "doesn't exist"
+        print(f"USER_BASE: {user_base!r} ({exists(user_base)})")
+        print(f"USER_SITE: {user_site!r} ({exists(user_site)})")
+        print(f"ENABLE_USER_SITE: {ENABLE_USER_SITE!r}")
         sys.exit(0)
 
     buffer = []
diff --git a/Lib/smtpd.py b/Lib/smtpd.py
index 8f1a22e..bc43331 100755
--- a/Lib/smtpd.py
+++ b/Lib/smtpd.py
@@ -83,8 +83,6 @@
 import getopt
 import time
 import socket
-import asyncore
-import asynchat
 import collections
 from warnings import warn
 from email._header_value_parser import get_addr_spec, get_angle_addr
@@ -94,6 +92,19 @@
     "MailmanProxy",
 ]
 
+warn(
+    'The smtpd module is deprecated and unmaintained.  Please see aiosmtpd '
+    '(https://aiosmtpd.readthedocs.io/) for the recommended replacement.',
+    DeprecationWarning,
+    stacklevel=2)
+
+
+# These are imported after the above warning so that users get the correct
+# deprecation warning.
+import asyncore
+import asynchat
+
+
 program = sys.argv[0]
 __version__ = 'Python SMTP proxy version 0.3'
 
@@ -163,7 +174,7 @@
             # a race condition  may occur if the other end is closing
             # before we can get the peername
             self.close()
-            if err.args[0] != errno.ENOTCONN:
+            if err.errno != errno.ENOTCONN:
                 raise
             return
         print('Peer:', repr(self.peer), file=DEBUGSTREAM)
diff --git a/Lib/smtplib.py b/Lib/smtplib.py
index 7808ba0..324a1c1 100755
--- a/Lib/smtplib.py
+++ b/Lib/smtplib.py
@@ -64,6 +64,7 @@
 CRLF = "\r\n"
 bCRLF = b"\r\n"
 _MAXLINE = 8192 # more than 8 times larger than RFC 821, 4.5.3
+_MAXCHALLENGE = 5  # Maximum number of AUTH challenges sent
 
 OLDSTYLE_AUTH = re.compile(r"auth=(.*)", re.I)
 
@@ -167,7 +168,7 @@
     """Quote data for email.
 
     Double leading '.', and change Unix newline '\\n', or Mac '\\r' into
-    Internet CRLF end-of-line.
+    internet CRLF end-of-line.
     """
     return re.sub(r'(?m)^\.', '..',
         re.sub(r'(?:\r\n|\n|\r(?!\n))', CRLF, data))
@@ -222,7 +223,7 @@
     helo_resp = None
     ehlo_msg = "ehlo"
     ehlo_resp = None
-    does_esmtp = 0
+    does_esmtp = False
     default_port = SMTP_PORT
 
     def __init__(self, host='', port=0, local_hostname=None,
@@ -230,8 +231,8 @@
                  source_address=None):
         """Initialize a new instance.
 
-        If specified, `host' is the name of the remote host to which to
-        connect.  If specified, `port' specifies the port to which to connect.
+        If specified, `host` is the name of the remote host to which to
+        connect.  If specified, `port` specifies the port to which to connect.
         By default, smtplib.SMTP_PORT is used.  If a host is specified the
         connect method is called, and if it returns anything other than a
         success code an SMTPConnectError is raised.  If specified,
@@ -248,6 +249,7 @@
         self.esmtp_features = {}
         self.command_encoding = 'ascii'
         self.source_address = source_address
+        self._auth_challenge_count = 0
 
         if host:
             (code, msg) = self.connect(host, port)
@@ -365,10 +367,15 @@
     def putcmd(self, cmd, args=""):
         """Send a command to the server."""
         if args == "":
-            str = '%s%s' % (cmd, CRLF)
+            s = cmd
         else:
-            str = '%s %s%s' % (cmd, args, CRLF)
-        self.send(str)
+            s = f'{cmd} {args}'
+        if '\r' in s or '\n' in s:
+            s = s.replace('\n', '\\n').replace('\r', '\\r')
+            raise ValueError(
+                f'command and arguments contain prohibited newline characters: {s}'
+            )
+        self.send(f'{s}{CRLF}')
 
     def getreply(self):
         """Get a reply from the server.
@@ -452,7 +459,7 @@
         self.ehlo_resp = msg
         if code != 250:
             return (code, msg)
-        self.does_esmtp = 1
+        self.does_esmtp = True
         #parse the ehlo response -ddm
         assert isinstance(self.ehlo_resp, bytes), repr(self.ehlo_resp)
         resp = self.ehlo_resp.decode("latin-1").split('\n')
@@ -633,14 +640,23 @@
         if initial_response is not None:
             response = encode_base64(initial_response.encode('ascii'), eol='')
             (code, resp) = self.docmd("AUTH", mechanism + " " + response)
+            self._auth_challenge_count = 1
         else:
             (code, resp) = self.docmd("AUTH", mechanism)
+            self._auth_challenge_count = 0
         # If server responds with a challenge, send the response.
-        if code == 334:
+        while code == 334:
+            self._auth_challenge_count += 1
             challenge = base64.decodebytes(resp)
             response = encode_base64(
                 authobject(challenge).encode('ascii'), eol='')
             (code, resp) = self.docmd(response)
+            # If server keeps sending challenges, something is wrong.
+            if self._auth_challenge_count > _MAXCHALLENGE:
+                raise SMTPException(
+                    "Server AUTH mechanism infinite loop. Last response: "
+                    + repr((code, resp))
+                )
         if code in (235, 503):
             return (code, resp)
         raise SMTPAuthenticationError(code, resp)
@@ -662,7 +678,7 @@
     def auth_login(self, challenge=None):
         """ Authobject to use with LOGIN authentication. Requires self.user and
         self.password to be set."""
-        if challenge is None:
+        if challenge is None or self._auth_challenge_count < 2:
             return self.user
         else:
             return self.password
@@ -781,7 +797,7 @@
             self.helo_resp = None
             self.ehlo_resp = None
             self.esmtp_features = {}
-            self.does_esmtp = 0
+            self.does_esmtp = False
         else:
             # RFC 3207:
             # 501 Syntax error (no parameters allowed)
@@ -1082,7 +1098,8 @@
         # Handle Unix-domain sockets.
         try:
             self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
-            self.sock.settimeout(self.timeout)
+            if self.timeout is not socket._GLOBAL_DEFAULT_TIMEOUT:
+                self.sock.settimeout(self.timeout)
             self.file = None
             self.sock.connect(host)
         except OSError:
diff --git a/Lib/socket.py b/Lib/socket.py
index cafa573..63ba0ac 100755
--- a/Lib/socket.py
+++ b/Lib/socket.py
@@ -337,6 +337,7 @@
             buffer = io.BufferedWriter(raw, buffering)
         if binary:
             return buffer
+        encoding = io.text_encoding(encoding)
         text = io.TextIOWrapper(buffer, encoding, errors, newline)
         text.mode = mode
         return text
@@ -377,7 +378,7 @@
             try:
                 while True:
                     if timeout and not selector_select(timeout):
-                        raise _socket.timeout('timed out')
+                        raise TimeoutError('timed out')
                     if count:
                         blocksize = count - total_sent
                         if blocksize <= 0:
@@ -706,7 +707,7 @@
                 self._timeout_occurred = True
                 raise
             except error as e:
-                if e.args[0] in _blocking_errnos:
+                if e.errno in _blocking_errnos:
                     return None
                 raise
 
@@ -722,7 +723,7 @@
             return self._sock.send(b)
         except error as e:
             # XXX what about EINTR?
-            if e.args[0] in _blocking_errnos:
+            if e.errno in _blocking_errnos:
                 return None
             raise
 
@@ -781,8 +782,9 @@
     An empty argument is interpreted as meaning the local host.
 
     First the hostname returned by gethostbyaddr() is checked, then
-    possibly existing aliases. In case no FQDN is available, hostname
-    from gethostname() is returned.
+    possibly existing aliases. In case no FQDN is available and `name`
+    was given, it is returned unchanged. If `name` was empty or '0.0.0.0',
+    hostname from gethostname() is returned.
     """
     name = name.strip()
     if not name or name == '0.0.0.0':
diff --git a/Lib/socketserver.py b/Lib/socketserver.py
index 57c1ae6..0d9583d 100644
--- a/Lib/socketserver.py
+++ b/Lib/socketserver.py
@@ -628,6 +628,39 @@
             self.collect_children(blocking=self.block_on_close)
 
 
+class _Threads(list):
+    """
+    Joinable list of all non-daemon threads.
+    """
+    def append(self, thread):
+        self.reap()
+        if thread.daemon:
+            return
+        super().append(thread)
+
+    def pop_all(self):
+        self[:], result = [], self[:]
+        return result
+
+    def join(self):
+        for thread in self.pop_all():
+            thread.join()
+
+    def reap(self):
+        self[:] = (thread for thread in self if thread.is_alive())
+
+
+class _NoThreads:
+    """
+    Degenerate version of _Threads.
+    """
+    def append(self, thread):
+        pass
+
+    def join(self):
+        pass
+
+
 class ThreadingMixIn:
     """Mix-in class to handle each request in a new thread."""
 
@@ -636,9 +669,9 @@
     daemon_threads = False
     # If true, server_close() waits until all non-daemonic threads terminate.
     block_on_close = True
-    # For non-daemonic threads, list of threading.Threading objects
+    # Threads object
     # used by server_close() to wait for all threads completion.
-    _threads = None
+    _threads = _NoThreads()
 
     def process_request_thread(self, request, client_address):
         """Same as in BaseServer but as a thread.
@@ -655,23 +688,17 @@
 
     def process_request(self, request, client_address):
         """Start a new thread to process the request."""
+        if self.block_on_close:
+            vars(self).setdefault('_threads', _Threads())
         t = threading.Thread(target = self.process_request_thread,
                              args = (request, client_address))
         t.daemon = self.daemon_threads
-        if not t.daemon and self.block_on_close:
-            if self._threads is None:
-                self._threads = []
-            self._threads.append(t)
+        self._threads.append(t)
         t.start()
 
     def server_close(self):
         super().server_close()
-        if self.block_on_close:
-            threads = self._threads
-            self._threads = None
-            if threads:
-                for thread in threads:
-                    thread.join()
+        self._threads.join()
 
 
 if hasattr(os, "fork"):
diff --git a/Lib/sqlite3/__init__.py b/Lib/sqlite3/__init__.py
index 6c91df2..0dedf18 100644
--- a/Lib/sqlite3/__init__.py
+++ b/Lib/sqlite3/__init__.py
@@ -20,4 +20,52 @@
 #    misrepresented as being the original software.
 # 3. This notice may not be removed or altered from any source distribution.
 
+"""
+The sqlite3 extension module provides a DB-API 2.0 (PEP 249) compilant
+interface to the SQLite library, and requires SQLite 3.7.15 or newer.
+
+To use the module, start by creating a database Connection object:
+
+    import sqlite3
+    cx = sqlite3.connect("test.db")  # test.db will be created or opened
+
+The special path name ":memory:" can be provided to connect to a transient
+in-memory database:
+
+    cx = sqlite3.connect(":memory:")  # connect to a database in RAM
+
+Once a connection has been established, create a Cursor object and call
+its execute() method to perform SQL queries:
+
+    cu = cx.cursor()
+
+    # create a table
+    cu.execute("create table lang(name, first_appeared)")
+
+    # insert values into a table
+    cu.execute("insert into lang values (?, ?)", ("C", 1972))
+
+    # execute a query and iterate over the result
+    for row in cu.execute("select * from lang"):
+        print(row)
+
+    cx.close()
+
+The sqlite3 module is written by Gerhard Häring <gh@ghaering.de>.
+"""
+
 from sqlite3.dbapi2 import *
+
+
+# bpo-42264: OptimizedUnicode was deprecated in Python 3.10.  It's scheduled
+# for removal in Python 3.12.
+def __getattr__(name):
+    if name == "OptimizedUnicode":
+        import warnings
+        msg = ("""
+            OptimizedUnicode is deprecated and will be removed in Python 3.12.
+            Since Python 3.3 it has simply been an alias for 'str'.
+        """)
+        warnings.warn(msg, DeprecationWarning, stacklevel=2)
+        return str
+    raise AttributeError(f"module 'sqlite3' has no attribute '{name}'")
diff --git a/Lib/sqlite3/dbapi2.py b/Lib/sqlite3/dbapi2.py
index 991682c..cfe6225 100644
--- a/Lib/sqlite3/dbapi2.py
+++ b/Lib/sqlite3/dbapi2.py
@@ -84,6 +84,20 @@
 
 register_adapters_and_converters()
 
+# bpo-24464: enable_shared_cache was deprecated in Python 3.10.  It's
+# scheduled for removal in Python 3.12.
+def enable_shared_cache(enable):
+    from _sqlite3 import enable_shared_cache as _old_enable_shared_cache
+    import warnings
+    msg = (
+        "enable_shared_cache is deprecated and will be removed in Python 3.12. "
+        "Shared cache is strongly discouraged by the SQLite 3 documentation. "
+        "If shared cache must be used, open the database in URI mode using"
+        "the cache=shared query parameter."
+    )
+    warnings.warn(msg, DeprecationWarning, stacklevel=2)
+    return _old_enable_shared_cache(enable)
+
 # Clean up namespace
 
 del(register_adapters_and_converters)
diff --git a/Lib/sqlite3/test/backup.py b/Lib/sqlite3/test/backup.py
index ad1da97..4e30594 100644
--- a/Lib/sqlite3/test/backup.py
+++ b/Lib/sqlite3/test/backup.py
@@ -2,7 +2,6 @@
 import unittest
 
 
-@unittest.skipIf(sqlite.sqlite_version_info < (3, 6, 11), "Backup API not supported")
 class BackupTests(unittest.TestCase):
     def setUp(self):
         cx = self.cx = sqlite.connect(":memory:")
@@ -18,9 +17,11 @@
         self.assertEqual(result[0][0], 3)
         self.assertEqual(result[1][0], 4)
 
-    def test_bad_target_none(self):
+    def test_bad_target(self):
         with self.assertRaises(TypeError):
             self.cx.backup(None)
+        with self.assertRaises(TypeError):
+            self.cx.backup()
 
     def test_bad_target_filename(self):
         with self.assertRaises(TypeError):
@@ -148,10 +149,7 @@
         with self.assertRaises(sqlite.OperationalError) as cm:
             with sqlite.connect(':memory:') as bck:
                 self.cx.backup(bck, name='non-existing')
-        self.assertIn(
-            str(cm.exception),
-            ['SQL logic error', 'SQL logic error or missing database']
-        )
+        self.assertIn("unknown database", str(cm.exception))
 
         self.cx.execute("ATTACH DATABASE ':memory:' AS attached_db")
         self.cx.execute('CREATE TABLE attached_db.foo (key INTEGER)')
@@ -163,7 +161,7 @@
 
 
 def suite():
-    return unittest.makeSuite(BackupTests)
+    return unittest.TestLoader().loadTestsFromTestCase(BackupTests)
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/Lib/sqlite3/test/dbapi.py b/Lib/sqlite3/test/dbapi.py
index ad9c9f0..e332184 100644
--- a/Lib/sqlite3/test/dbapi.py
+++ b/Lib/sqlite3/test/dbapi.py
@@ -1,7 +1,6 @@
-#-*- coding: iso-8859-1 -*-
 # pysqlite2/test/dbapi.py: tests for DB-API compliance
 #
-# Copyright (C) 2004-2010 Gerhard Häring <gh@ghaering.de>
+# Copyright (C) 2004-2010 Gerhard Häring <gh@ghaering.de>
 #
 # This file is part of pysqlite.
 #
@@ -21,68 +20,85 @@
 #    misrepresented as being the original software.
 # 3. This notice may not be removed or altered from any source distribution.
 
+import subprocess
 import threading
 import unittest
 import sqlite3 as sqlite
+import sys
 
-from test.support import TESTFN, unlink
+from test.support import check_disallow_instantiation, SHORT_TIMEOUT
+from test.support.os_helper import TESTFN, unlink
 
 
 class ModuleTests(unittest.TestCase):
-    def CheckAPILevel(self):
+    def test_api_level(self):
         self.assertEqual(sqlite.apilevel, "2.0",
                          "apilevel is %s, should be 2.0" % sqlite.apilevel)
 
-    def CheckThreadSafety(self):
+    def test_thread_safety(self):
         self.assertEqual(sqlite.threadsafety, 1,
                          "threadsafety is %d, should be 1" % sqlite.threadsafety)
 
-    def CheckParamStyle(self):
+    def test_param_style(self):
         self.assertEqual(sqlite.paramstyle, "qmark",
                          "paramstyle is '%s', should be 'qmark'" %
                          sqlite.paramstyle)
 
-    def CheckWarning(self):
+    def test_warning(self):
         self.assertTrue(issubclass(sqlite.Warning, Exception),
                      "Warning is not a subclass of Exception")
 
-    def CheckError(self):
+    def test_error(self):
         self.assertTrue(issubclass(sqlite.Error, Exception),
                         "Error is not a subclass of Exception")
 
-    def CheckInterfaceError(self):
+    def test_interface_error(self):
         self.assertTrue(issubclass(sqlite.InterfaceError, sqlite.Error),
                         "InterfaceError is not a subclass of Error")
 
-    def CheckDatabaseError(self):
+    def test_database_error(self):
         self.assertTrue(issubclass(sqlite.DatabaseError, sqlite.Error),
                         "DatabaseError is not a subclass of Error")
 
-    def CheckDataError(self):
+    def test_data_error(self):
         self.assertTrue(issubclass(sqlite.DataError, sqlite.DatabaseError),
                         "DataError is not a subclass of DatabaseError")
 
-    def CheckOperationalError(self):
+    def test_operational_error(self):
         self.assertTrue(issubclass(sqlite.OperationalError, sqlite.DatabaseError),
                         "OperationalError is not a subclass of DatabaseError")
 
-    def CheckIntegrityError(self):
+    def test_integrity_error(self):
         self.assertTrue(issubclass(sqlite.IntegrityError, sqlite.DatabaseError),
                         "IntegrityError is not a subclass of DatabaseError")
 
-    def CheckInternalError(self):
+    def test_internal_error(self):
         self.assertTrue(issubclass(sqlite.InternalError, sqlite.DatabaseError),
                         "InternalError is not a subclass of DatabaseError")
 
-    def CheckProgrammingError(self):
+    def test_programming_error(self):
         self.assertTrue(issubclass(sqlite.ProgrammingError, sqlite.DatabaseError),
                         "ProgrammingError is not a subclass of DatabaseError")
 
-    def CheckNotSupportedError(self):
+    def test_not_supported_error(self):
         self.assertTrue(issubclass(sqlite.NotSupportedError,
                                    sqlite.DatabaseError),
                         "NotSupportedError is not a subclass of DatabaseError")
 
+    # sqlite3_enable_shared_cache() is deprecated on macOS and calling it may raise
+    # OperationalError on some buildbots.
+    @unittest.skipIf(sys.platform == "darwin", "shared cache is deprecated on macOS")
+    def test_shared_cache_deprecated(self):
+        for enable in (True, False):
+            with self.assertWarns(DeprecationWarning) as cm:
+                sqlite.enable_shared_cache(enable)
+            self.assertIn("dbapi.py", cm.filename)
+
+    def test_disallow_instantiation(self):
+        cx = sqlite.connect(":memory:")
+        check_disallow_instantiation(self, type(cx("select 1")))
+
+
 class ConnectionTests(unittest.TestCase):
 
     def setUp(self):
@@ -94,38 +110,38 @@
     def tearDown(self):
         self.cx.close()
 
-    def CheckCommit(self):
+    def test_commit(self):
         self.cx.commit()
 
-    def CheckCommitAfterNoChanges(self):
+    def test_commit_after_no_changes(self):
         """
         A commit should also work when no changes were made to the database.
         """
         self.cx.commit()
         self.cx.commit()
 
-    def CheckRollback(self):
+    def test_rollback(self):
         self.cx.rollback()
 
-    def CheckRollbackAfterNoChanges(self):
+    def test_rollback_after_no_changes(self):
         """
         A rollback should also work when no changes were made to the database.
         """
         self.cx.rollback()
         self.cx.rollback()
 
-    def CheckCursor(self):
+    def test_cursor(self):
         cu = self.cx.cursor()
 
-    def CheckFailedOpen(self):
+    def test_failed_open(self):
         YOU_CANNOT_OPEN_THIS = "/foo/bar/bla/23534/mydb.db"
         with self.assertRaises(sqlite.OperationalError):
             con = sqlite.connect(YOU_CANNOT_OPEN_THIS)
 
-    def CheckClose(self):
+    def test_close(self):
         self.cx.close()
 
-    def CheckExceptions(self):
+    def test_exceptions(self):
         # Optional DB-API extension.
         self.assertEqual(self.cx.Warning, sqlite.Warning)
         self.assertEqual(self.cx.Error, sqlite.Error)
@@ -138,7 +154,7 @@
         self.assertEqual(self.cx.ProgrammingError, sqlite.ProgrammingError)
         self.assertEqual(self.cx.NotSupportedError, sqlite.NotSupportedError)
 
-    def CheckInTransaction(self):
+    def test_in_transaction(self):
         # Can't use db from setUp because we want to test initial state.
         cx = sqlite.connect(":memory:")
         cu = cx.cursor()
@@ -156,11 +172,11 @@
         row = cu.fetchone()
         self.assertEqual(cx.in_transaction, False)
 
-    def CheckInTransactionRO(self):
+    def test_in_transaction_ro(self):
         with self.assertRaises(AttributeError):
             self.cx.in_transaction = True
 
-    def CheckOpenWithPathLikeObject(self):
+    def test_open_with_path_like_object(self):
         """ Checks that we can successfully connect to a database using an object that
             is PathLike, i.e. has __fspath__(). """
         self.addCleanup(unlink, TESTFN)
@@ -171,11 +187,7 @@
         with sqlite.connect(path) as cx:
             cx.execute('create table test(id integer)')
 
-    def CheckOpenUri(self):
-        if sqlite.sqlite_version_info < (3, 7, 7):
-            with self.assertRaises(sqlite.NotSupportedError):
-                sqlite.connect(':memory:', uri=True)
-            return
+    def test_open_uri(self):
         self.addCleanup(unlink, TESTFN)
         with sqlite.connect(TESTFN) as cx:
             cx.execute('create table test(id integer)')
@@ -185,12 +197,26 @@
             with self.assertRaises(sqlite.OperationalError):
                 cx.execute('insert into test(id) values(1)')
 
-    @unittest.skipIf(sqlite.sqlite_version_info >= (3, 3, 1),
-                     'needs sqlite versions older than 3.3.1')
-    def CheckSameThreadErrorOnOldVersion(self):
-        with self.assertRaises(sqlite.NotSupportedError) as cm:
-            sqlite.connect(':memory:', check_same_thread=False)
-        self.assertEqual(str(cm.exception), 'shared connections not available')
+
+class UninitialisedConnectionTests(unittest.TestCase):
+    def setUp(self):
+        self.cx = sqlite.Connection.__new__(sqlite.Connection)
+
+    def test_uninit_operations(self):
+        funcs = (
+            lambda: self.cx.isolation_level,
+            lambda: self.cx.total_changes,
+            lambda: self.cx.in_transaction,
+            lambda: self.cx.iterdump(),
+            lambda: self.cx.cursor(),
+            lambda: self.cx.close(),
+        )
+        for func in funcs:
+            with self.subTest(func=func):
+                self.assertRaisesRegex(sqlite.ProgrammingError,
+                                       "Base Connection.__init__ not called",
+                                       func)
+
 
 class CursorTests(unittest.TestCase):
     def setUp(self):
@@ -206,21 +232,21 @@
         self.cu.close()
         self.cx.close()
 
-    def CheckExecuteNoArgs(self):
+    def test_execute_no_args(self):
         self.cu.execute("delete from test")
 
-    def CheckExecuteIllegalSql(self):
+    def test_execute_illegal_sql(self):
         with self.assertRaises(sqlite.OperationalError):
             self.cu.execute("select asdf")
 
-    def CheckExecuteTooMuchSql(self):
+    def test_execute_too_much_sql(self):
         with self.assertRaises(sqlite.Warning):
             self.cu.execute("select 5+4; select 4+5")
 
-    def CheckExecuteTooMuchSql2(self):
+    def test_execute_too_much_sql2(self):
         self.cu.execute("select 5+4; -- foo bar")
 
-    def CheckExecuteTooMuchSql3(self):
+    def test_execute_too_much_sql3(self):
         self.cu.execute("""
             select 5+4;
 
@@ -229,53 +255,53 @@
             */
             """)
 
-    def CheckExecuteWrongSqlArg(self):
+    def test_execute_wrong_sql_arg(self):
         with self.assertRaises(TypeError):
             self.cu.execute(42)
 
-    def CheckExecuteArgInt(self):
+    def test_execute_arg_int(self):
         self.cu.execute("insert into test(id) values (?)", (42,))
 
-    def CheckExecuteArgFloat(self):
+    def test_execute_arg_float(self):
         self.cu.execute("insert into test(income) values (?)", (2500.32,))
 
-    def CheckExecuteArgString(self):
+    def test_execute_arg_string(self):
         self.cu.execute("insert into test(name) values (?)", ("Hugo",))
 
-    def CheckExecuteArgStringWithZeroByte(self):
+    def test_execute_arg_string_with_zero_byte(self):
         self.cu.execute("insert into test(name) values (?)", ("Hu\x00go",))
 
         self.cu.execute("select name from test where id=?", (self.cu.lastrowid,))
         row = self.cu.fetchone()
         self.assertEqual(row[0], "Hu\x00go")
 
-    def CheckExecuteNonIterable(self):
+    def test_execute_non_iterable(self):
         with self.assertRaises(ValueError) as cm:
             self.cu.execute("insert into test(id) values (?)", 42)
         self.assertEqual(str(cm.exception), 'parameters are of unsupported type')
 
-    def CheckExecuteWrongNoOfArgs1(self):
+    def test_execute_wrong_no_of_args1(self):
         # too many parameters
         with self.assertRaises(sqlite.ProgrammingError):
             self.cu.execute("insert into test(id) values (?)", (17, "Egon"))
 
-    def CheckExecuteWrongNoOfArgs2(self):
+    def test_execute_wrong_no_of_args2(self):
         # too little parameters
         with self.assertRaises(sqlite.ProgrammingError):
             self.cu.execute("insert into test(id) values (?)")
 
-    def CheckExecuteWrongNoOfArgs3(self):
+    def test_execute_wrong_no_of_args3(self):
         # no parameters, parameters are needed
         with self.assertRaises(sqlite.ProgrammingError):
             self.cu.execute("insert into test(id) values (?)")
 
-    def CheckExecuteParamList(self):
+    def test_execute_param_list(self):
         self.cu.execute("insert into test(name) values ('foo')")
         self.cu.execute("select name from test where name=?", ["foo"])
         row = self.cu.fetchone()
         self.assertEqual(row[0], "foo")
 
-    def CheckExecuteParamSequence(self):
+    def test_execute_param_sequence(self):
         class L:
             def __len__(self):
                 return 1
@@ -288,7 +314,7 @@
         row = self.cu.fetchone()
         self.assertEqual(row[0], "foo")
 
-    def CheckExecuteParamSequenceBadLen(self):
+    def test_execute_param_sequence_bad_len(self):
         # Issue41662: Error in __len__() was overridden with ProgrammingError.
         class L:
             def __len__(self):
@@ -300,13 +326,13 @@
         with self.assertRaises(ZeroDivisionError):
             self.cu.execute("select name from test where name=?", L())
 
-    def CheckExecuteDictMapping(self):
+    def test_execute_dict_mapping(self):
         self.cu.execute("insert into test(name) values ('foo')")
         self.cu.execute("select name from test where name=:name", {"name": "foo"})
         row = self.cu.fetchone()
         self.assertEqual(row[0], "foo")
 
-    def CheckExecuteDictMapping_Mapping(self):
+    def test_execute_dict_mapping_mapping(self):
         class D(dict):
             def __missing__(self, key):
                 return "foo"
@@ -316,32 +342,32 @@
         row = self.cu.fetchone()
         self.assertEqual(row[0], "foo")
 
-    def CheckExecuteDictMappingTooLittleArgs(self):
+    def test_execute_dict_mapping_too_little_args(self):
         self.cu.execute("insert into test(name) values ('foo')")
         with self.assertRaises(sqlite.ProgrammingError):
             self.cu.execute("select name from test where name=:name and id=:id", {"name": "foo"})
 
-    def CheckExecuteDictMappingNoArgs(self):
+    def test_execute_dict_mapping_no_args(self):
         self.cu.execute("insert into test(name) values ('foo')")
         with self.assertRaises(sqlite.ProgrammingError):
             self.cu.execute("select name from test where name=:name")
 
-    def CheckExecuteDictMappingUnnamed(self):
+    def test_execute_dict_mapping_unnamed(self):
         self.cu.execute("insert into test(name) values ('foo')")
         with self.assertRaises(sqlite.ProgrammingError):
             self.cu.execute("select name from test where name=?", {"name": "foo"})
 
-    def CheckClose(self):
+    def test_close(self):
         self.cu.close()
 
-    def CheckRowcountExecute(self):
+    def test_rowcount_execute(self):
         self.cu.execute("delete from test")
         self.cu.execute("insert into test(name) values ('foo')")
         self.cu.execute("insert into test(name) values ('foo')")
         self.cu.execute("update test set name='bar'")
         self.assertEqual(self.cu.rowcount, 2)
 
-    def CheckRowcountSelect(self):
+    def test_rowcount_select(self):
         """
         pysqlite does not know the rowcount of SELECT statements, because we
         don't fetch all rows after executing the select statement. The rowcount
@@ -350,12 +376,12 @@
         self.cu.execute("select 5 union select 6")
         self.assertEqual(self.cu.rowcount, -1)
 
-    def CheckRowcountExecutemany(self):
+    def test_rowcount_executemany(self):
         self.cu.execute("delete from test")
         self.cu.executemany("insert into test(name) values (?)", [(1,), (2,), (3,)])
         self.assertEqual(self.cu.rowcount, 3)
 
-    def CheckTotalChanges(self):
+    def test_total_changes(self):
         self.cu.execute("insert into test(name) values ('foo')")
         self.cu.execute("insert into test(name) values ('foo')")
         self.assertLess(2, self.cx.total_changes, msg='total changes reported wrong value')
@@ -364,14 +390,17 @@
     # Sequences are required by the DB-API, iterators
     # enhancements in pysqlite.
 
-    def CheckExecuteManySequence(self):
+    def test_execute_many_sequence(self):
         self.cu.executemany("insert into test(income) values (?)", [(x,) for x in range(100, 110)])
 
-    def CheckExecuteManyIterator(self):
+    def test_execute_many_iterator(self):
         class MyIter:
             def __init__(self):
                 self.value = 5
 
+            def __iter__(self):
+                return self
+
             def __next__(self):
                 if self.value == 10:
                     raise StopIteration
@@ -381,26 +410,26 @@
 
         self.cu.executemany("insert into test(income) values (?)", MyIter())
 
-    def CheckExecuteManyGenerator(self):
+    def test_execute_many_generator(self):
         def mygen():
             for i in range(5):
                 yield (i,)
 
         self.cu.executemany("insert into test(income) values (?)", mygen())
 
-    def CheckExecuteManyWrongSqlArg(self):
+    def test_execute_many_wrong_sql_arg(self):
         with self.assertRaises(TypeError):
             self.cu.executemany(42, [(3,)])
 
-    def CheckExecuteManySelect(self):
+    def test_execute_many_select(self):
         with self.assertRaises(sqlite.ProgrammingError):
             self.cu.executemany("select ?", [(3,)])
 
-    def CheckExecuteManyNotIterable(self):
+    def test_execute_many_not_iterable(self):
         with self.assertRaises(TypeError):
             self.cu.executemany("insert into test(income) values (?)", 42)
 
-    def CheckFetchIter(self):
+    def test_fetch_iter(self):
         # Optional DB-API extension.
         self.cu.execute("delete from test")
         self.cu.execute("insert into test(id) values (?)", (5,))
@@ -412,20 +441,20 @@
         self.assertEqual(lst[0], 5)
         self.assertEqual(lst[1], 6)
 
-    def CheckFetchone(self):
+    def test_fetchone(self):
         self.cu.execute("select name from test")
         row = self.cu.fetchone()
         self.assertEqual(row[0], "foo")
         row = self.cu.fetchone()
         self.assertEqual(row, None)
 
-    def CheckFetchoneNoStatement(self):
+    def test_fetchone_no_statement(self):
         cur = self.cx.cursor()
         row = cur.fetchone()
         self.assertEqual(row, None)
 
-    def CheckArraySize(self):
-        # must default ot 1
+    def test_array_size(self):
+        # must default to 1
         self.assertEqual(self.cu.arraysize, 1)
 
         # now set to 2
@@ -441,51 +470,51 @@
 
         self.assertEqual(len(res), 2)
 
-    def CheckFetchmany(self):
+    def test_fetchmany(self):
         self.cu.execute("select name from test")
         res = self.cu.fetchmany(100)
         self.assertEqual(len(res), 1)
         res = self.cu.fetchmany(100)
         self.assertEqual(res, [])
 
-    def CheckFetchmanyKwArg(self):
+    def test_fetchmany_kw_arg(self):
         """Checks if fetchmany works with keyword arguments"""
         self.cu.execute("select name from test")
         res = self.cu.fetchmany(size=100)
         self.assertEqual(len(res), 1)
 
-    def CheckFetchall(self):
+    def test_fetchall(self):
         self.cu.execute("select name from test")
         res = self.cu.fetchall()
         self.assertEqual(len(res), 1)
         res = self.cu.fetchall()
         self.assertEqual(res, [])
 
-    def CheckSetinputsizes(self):
+    def test_setinputsizes(self):
         self.cu.setinputsizes([3, 4, 5])
 
-    def CheckSetoutputsize(self):
+    def test_setoutputsize(self):
         self.cu.setoutputsize(5, 0)
 
-    def CheckSetoutputsizeNoColumn(self):
+    def test_setoutputsize_no_column(self):
         self.cu.setoutputsize(42)
 
-    def CheckCursorConnection(self):
+    def test_cursor_connection(self):
         # Optional DB-API extension.
         self.assertEqual(self.cu.connection, self.cx)
 
-    def CheckWrongCursorCallable(self):
+    def test_wrong_cursor_callable(self):
         with self.assertRaises(TypeError):
             def f(): pass
             cur = self.cx.cursor(f)
 
-    def CheckCursorWrongClass(self):
+    def test_cursor_wrong_class(self):
         class Foo: pass
         foo = Foo()
         with self.assertRaises(TypeError):
             cur = sqlite.Cursor(foo)
 
-    def CheckLastRowIDOnReplace(self):
+    def test_last_row_id_on_replace(self):
         """
         INSERT OR REPLACE and REPLACE INTO should produce the same behavior.
         """
@@ -495,7 +524,7 @@
                 self.cu.execute(sql.format(statement), (1, 'foo'))
                 self.assertEqual(self.cu.lastrowid, 1)
 
-    def CheckLastRowIDOnIgnore(self):
+    def test_last_row_id_on_ignore(self):
         self.cu.execute(
             "insert or ignore into test(unique_test) values (?)",
             ('test',))
@@ -505,7 +534,7 @@
             ('test',))
         self.assertEqual(self.cu.lastrowid, 2)
 
-    def CheckLastRowIDInsertOR(self):
+    def test_last_row_id_insert_o_r(self):
         results = []
         for statement in ('FAIL', 'ABORT', 'ROLLBACK'):
             sql = 'INSERT OR {} INTO test(unique_test) VALUES (?)'
@@ -533,7 +562,7 @@
         self.cur.close()
         self.con.close()
 
-    def CheckConCursor(self):
+    def test_con_cursor(self):
         def run(con, errors):
             try:
                 cur = con.cursor()
@@ -551,7 +580,7 @@
         if len(errors) > 0:
             self.fail("\n".join(errors))
 
-    def CheckConCommit(self):
+    def test_con_commit(self):
         def run(con, errors):
             try:
                 con.commit()
@@ -569,7 +598,7 @@
         if len(errors) > 0:
             self.fail("\n".join(errors))
 
-    def CheckConRollback(self):
+    def test_con_rollback(self):
         def run(con, errors):
             try:
                 con.rollback()
@@ -587,7 +616,7 @@
         if len(errors) > 0:
             self.fail("\n".join(errors))
 
-    def CheckConClose(self):
+    def test_con_close(self):
         def run(con, errors):
             try:
                 con.close()
@@ -605,7 +634,7 @@
         if len(errors) > 0:
             self.fail("\n".join(errors))
 
-    def CheckCurImplicitBegin(self):
+    def test_cur_implicit_begin(self):
         def run(cur, errors):
             try:
                 cur.execute("insert into test(name) values ('a')")
@@ -623,7 +652,7 @@
         if len(errors) > 0:
             self.fail("\n".join(errors))
 
-    def CheckCurClose(self):
+    def test_cur_close(self):
         def run(cur, errors):
             try:
                 cur.close()
@@ -641,7 +670,7 @@
         if len(errors) > 0:
             self.fail("\n".join(errors))
 
-    def CheckCurExecute(self):
+    def test_cur_execute(self):
         def run(cur, errors):
             try:
                 cur.execute("select name from test")
@@ -660,7 +689,7 @@
         if len(errors) > 0:
             self.fail("\n".join(errors))
 
-    def CheckCurIterNext(self):
+    def test_cur_iter_next(self):
         def run(cur, errors):
             try:
                 row = cur.fetchone()
@@ -681,29 +710,29 @@
             self.fail("\n".join(errors))
 
 class ConstructorTests(unittest.TestCase):
-    def CheckDate(self):
+    def test_date(self):
         d = sqlite.Date(2004, 10, 28)
 
-    def CheckTime(self):
+    def test_time(self):
         t = sqlite.Time(12, 39, 35)
 
-    def CheckTimestamp(self):
+    def test_timestamp(self):
         ts = sqlite.Timestamp(2004, 10, 28, 12, 39, 35)
 
-    def CheckDateFromTicks(self):
+    def test_date_from_ticks(self):
         d = sqlite.DateFromTicks(42)
 
-    def CheckTimeFromTicks(self):
+    def test_time_from_ticks(self):
         t = sqlite.TimeFromTicks(42)
 
-    def CheckTimestampFromTicks(self):
+    def test_timestamp_from_ticks(self):
         ts = sqlite.TimestampFromTicks(42)
 
-    def CheckBinary(self):
+    def test_binary(self):
         b = sqlite.Binary(b"\0'")
 
 class ExtensionTests(unittest.TestCase):
-    def CheckScriptStringSql(self):
+    def test_script_string_sql(self):
         con = sqlite.connect(":memory:")
         cur = con.cursor()
         cur.executescript("""
@@ -716,31 +745,31 @@
         res = cur.fetchone()[0]
         self.assertEqual(res, 5)
 
-    def CheckScriptSyntaxError(self):
+    def test_script_syntax_error(self):
         con = sqlite.connect(":memory:")
         cur = con.cursor()
         with self.assertRaises(sqlite.OperationalError):
             cur.executescript("create table test(x); asdf; create table test2(x)")
 
-    def CheckScriptErrorNormal(self):
+    def test_script_error_normal(self):
         con = sqlite.connect(":memory:")
         cur = con.cursor()
         with self.assertRaises(sqlite.OperationalError):
             cur.executescript("create table test(sadfsadfdsa); select foo from hurz;")
 
-    def CheckCursorExecutescriptAsBytes(self):
+    def test_cursor_executescript_as_bytes(self):
         con = sqlite.connect(":memory:")
         cur = con.cursor()
         with self.assertRaises(ValueError) as cm:
             cur.executescript(b"create table test(foo); insert into test(foo) values (5);")
         self.assertEqual(str(cm.exception), 'script argument must be unicode.')
 
-    def CheckConnectionExecute(self):
+    def test_connection_execute(self):
         con = sqlite.connect(":memory:")
         result = con.execute("select 5").fetchone()[0]
         self.assertEqual(result, 5, "Basic test of Connection.execute")
 
-    def CheckConnectionExecutemany(self):
+    def test_connection_executemany(self):
         con = sqlite.connect(":memory:")
         con.execute("create table test(foo)")
         con.executemany("insert into test(foo) values (?)", [(3,), (4,)])
@@ -748,46 +777,46 @@
         self.assertEqual(result[0][0], 3, "Basic test of Connection.executemany")
         self.assertEqual(result[1][0], 4, "Basic test of Connection.executemany")
 
-    def CheckConnectionExecutescript(self):
+    def test_connection_executescript(self):
         con = sqlite.connect(":memory:")
         con.executescript("create table test(foo); insert into test(foo) values (5);")
         result = con.execute("select foo from test").fetchone()[0]
         self.assertEqual(result, 5, "Basic test of Connection.executescript")
 
 class ClosedConTests(unittest.TestCase):
-    def CheckClosedConCursor(self):
+    def test_closed_con_cursor(self):
         con = sqlite.connect(":memory:")
         con.close()
         with self.assertRaises(sqlite.ProgrammingError):
             cur = con.cursor()
 
-    def CheckClosedConCommit(self):
+    def test_closed_con_commit(self):
         con = sqlite.connect(":memory:")
         con.close()
         with self.assertRaises(sqlite.ProgrammingError):
             con.commit()
 
-    def CheckClosedConRollback(self):
+    def test_closed_con_rollback(self):
         con = sqlite.connect(":memory:")
         con.close()
         with self.assertRaises(sqlite.ProgrammingError):
             con.rollback()
 
-    def CheckClosedCurExecute(self):
+    def test_closed_cur_execute(self):
         con = sqlite.connect(":memory:")
         cur = con.cursor()
         con.close()
         with self.assertRaises(sqlite.ProgrammingError):
             cur.execute("select 4")
 
-    def CheckClosedCreateFunction(self):
+    def test_closed_create_function(self):
         con = sqlite.connect(":memory:")
         con.close()
         def f(x): return 17
         with self.assertRaises(sqlite.ProgrammingError):
             con.create_function("foo", 1, f)
 
-    def CheckClosedCreateAggregate(self):
+    def test_closed_create_aggregate(self):
         con = sqlite.connect(":memory:")
         con.close()
         class Agg:
@@ -800,7 +829,7 @@
         with self.assertRaises(sqlite.ProgrammingError):
             con.create_aggregate("foo", 1, Agg)
 
-    def CheckClosedSetAuthorizer(self):
+    def test_closed_set_authorizer(self):
         con = sqlite.connect(":memory:")
         con.close()
         def authorizer(*args):
@@ -808,21 +837,21 @@
         with self.assertRaises(sqlite.ProgrammingError):
             con.set_authorizer(authorizer)
 
-    def CheckClosedSetProgressCallback(self):
+    def test_closed_set_progress_callback(self):
         con = sqlite.connect(":memory:")
         con.close()
         def progress(): pass
         with self.assertRaises(sqlite.ProgrammingError):
             con.set_progress_handler(progress, 100)
 
-    def CheckClosedCall(self):
+    def test_closed_call(self):
         con = sqlite.connect(":memory:")
         con.close()
         with self.assertRaises(sqlite.ProgrammingError):
             con()
 
 class ClosedCurTests(unittest.TestCase):
-    def CheckClosed(self):
+    def test_closed(self):
         con = sqlite.connect(":memory:")
         cur = con.cursor()
         cur.close()
@@ -860,7 +889,7 @@
         self.cu.close()
         self.cx.close()
 
-    def CheckOnConflictRollbackWithExplicitTransaction(self):
+    def test_on_conflict_rollback_with_explicit_transaction(self):
         self.cx.isolation_level = None  # autocommit mode
         self.cu = self.cx.cursor()
         # Start an explicit transaction.
@@ -875,7 +904,7 @@
         # Transaction should have rolled back and nothing should be in table.
         self.assertEqual(self.cu.fetchall(), [])
 
-    def CheckOnConflictAbortRaisesWithExplicitTransactions(self):
+    def test_on_conflict_abort_raises_with_explicit_transactions(self):
         # Abort cancels the current sql statement but doesn't change anything
         # about the current transaction.
         self.cx.isolation_level = None  # autocommit mode
@@ -891,7 +920,7 @@
         # Expect the first two inserts to work, third to do nothing.
         self.assertEqual(self.cu.fetchall(), [('abort_test', None), (None, 'foo',)])
 
-    def CheckOnConflictRollbackWithoutTransaction(self):
+    def test_on_conflict_rollback_without_transaction(self):
         # Start of implicit transaction
         self.cu.execute("INSERT INTO test(name) VALUES ('abort_test')")
         self.cu.execute("INSERT OR ROLLBACK INTO test(unique_name) VALUES ('foo')")
@@ -901,7 +930,7 @@
         # Implicit transaction is rolled back on error.
         self.assertEqual(self.cu.fetchall(), [])
 
-    def CheckOnConflictAbortRaisesWithoutTransactions(self):
+    def test_on_conflict_abort_raises_without_transactions(self):
         # Abort cancels the current sql statement but doesn't change anything
         # about the current transaction.
         self.cu.execute("INSERT INTO test(name) VALUES ('abort_test')")
@@ -912,20 +941,20 @@
         self.cu.execute("SELECT name, unique_name FROM test")
         self.assertEqual(self.cu.fetchall(), [('abort_test', None), (None, 'foo',)])
 
-    def CheckOnConflictFail(self):
+    def test_on_conflict_fail(self):
         self.cu.execute("INSERT OR FAIL INTO test(unique_name) VALUES ('foo')")
         with self.assertRaises(sqlite.IntegrityError):
             self.cu.execute("INSERT OR FAIL INTO test(unique_name) VALUES ('foo')")
         self.assertEqual(self.cu.fetchall(), [])
 
-    def CheckOnConflictIgnore(self):
+    def test_on_conflict_ignore(self):
         self.cu.execute("INSERT OR IGNORE INTO test(unique_name) VALUES ('foo')")
         # Nothing should happen.
         self.cu.execute("INSERT OR IGNORE INTO test(unique_name) VALUES ('foo')")
         self.cu.execute("SELECT unique_name FROM test")
         self.assertEqual(self.cu.fetchall(), [('foo',)])
 
-    def CheckOnConflictReplace(self):
+    def test_on_conflict_replace(self):
         self.cu.execute("INSERT OR REPLACE INTO test(name, unique_name) VALUES ('Data!', 'foo')")
         # There shouldn't be an IntegrityError exception.
         self.cu.execute("INSERT OR REPLACE INTO test(name, unique_name) VALUES ('Very different data!', 'foo')")
@@ -933,21 +962,94 @@
         self.assertEqual(self.cu.fetchall(), [('Very different data!', 'foo')])
 
 
+class MultiprocessTests(unittest.TestCase):
+    CONNECTION_TIMEOUT = SHORT_TIMEOUT / 1000.  # Defaults to 30 ms
+
+    def tearDown(self):
+        unlink(TESTFN)
+
+    def test_ctx_mgr_rollback_if_commit_failed(self):
+        # bpo-27334: ctx manager does not rollback if commit fails
+        SCRIPT = f"""if 1:
+            import sqlite3
+            def wait():
+                print("started")
+                assert "database is locked" in input()
+
+            cx = sqlite3.connect("{TESTFN}", timeout={self.CONNECTION_TIMEOUT})
+            cx.create_function("wait", 0, wait)
+            with cx:
+                cx.execute("create table t(t)")
+            try:
+                # execute two transactions; both will try to lock the db
+                cx.executescript('''
+                    -- start a transaction and wait for parent
+                    begin transaction;
+                    select * from t;
+                    select wait();
+                    rollback;
+
+                    -- start a new transaction; would fail if parent holds lock
+                    begin transaction;
+                    select * from t;
+                    rollback;
+                ''')
+            finally:
+                cx.close()
+        """
+
+        # spawn child process
+        proc = subprocess.Popen(
+            [sys.executable, "-c", SCRIPT],
+            encoding="utf-8",
+            bufsize=0,
+            stdin=subprocess.PIPE,
+            stdout=subprocess.PIPE,
+        )
+        self.addCleanup(proc.communicate)
+
+        # wait for child process to start
+        self.assertEqual("started", proc.stdout.readline().strip())
+
+        cx = sqlite.connect(TESTFN, timeout=self.CONNECTION_TIMEOUT)
+        try:  # context manager should correctly release the db lock
+            with cx:
+                cx.execute("insert into t values('test')")
+        except sqlite.OperationalError as exc:
+            proc.stdin.write(str(exc))
+        else:
+            proc.stdin.write("no error")
+        finally:
+            cx.close()
+
+        # terminate child process
+        self.assertIsNone(proc.returncode)
+        try:
+            proc.communicate(input="end", timeout=SHORT_TIMEOUT)
+        except subprocess.TimeoutExpired:
+            proc.kill()
+            proc.communicate()
+            raise
+        self.assertEqual(proc.returncode, 0)
+
+
 def suite():
-    module_suite = unittest.makeSuite(ModuleTests, "Check")
-    connection_suite = unittest.makeSuite(ConnectionTests, "Check")
-    cursor_suite = unittest.makeSuite(CursorTests, "Check")
-    thread_suite = unittest.makeSuite(ThreadTests, "Check")
-    constructor_suite = unittest.makeSuite(ConstructorTests, "Check")
-    ext_suite = unittest.makeSuite(ExtensionTests, "Check")
-    closed_con_suite = unittest.makeSuite(ClosedConTests, "Check")
-    closed_cur_suite = unittest.makeSuite(ClosedCurTests, "Check")
-    on_conflict_suite = unittest.makeSuite(SqliteOnConflictTests, "Check")
-    return unittest.TestSuite((
-        module_suite, connection_suite, cursor_suite, thread_suite,
-        constructor_suite, ext_suite, closed_con_suite, closed_cur_suite,
-        on_conflict_suite,
-    ))
+    tests = [
+        ClosedConTests,
+        ClosedCurTests,
+        ConnectionTests,
+        ConstructorTests,
+        CursorTests,
+        ExtensionTests,
+        ModuleTests,
+        MultiprocessTests,
+        SqliteOnConflictTests,
+        ThreadTests,
+        UninitialisedConnectionTests,
+    ]
+    return unittest.TestSuite(
+        [unittest.TestLoader().loadTestsFromTestCase(t) for t in tests]
+    )
 
 def test():
     runner = unittest.TextTestRunner()
diff --git a/Lib/sqlite3/test/dump.py b/Lib/sqlite3/test/dump.py
index a1f45a4..618a7fd 100644
--- a/Lib/sqlite3/test/dump.py
+++ b/Lib/sqlite3/test/dump.py
@@ -11,7 +11,7 @@
     def tearDown(self):
         self.cx.close()
 
-    def CheckTableDump(self):
+    def test_table_dump(self):
         expected_sqls = [
                 """CREATE TABLE "index"("index" blob);"""
                 ,
@@ -49,7 +49,7 @@
         [self.assertEqual(expected_sqls[i], actual_sqls[i])
             for i in range(len(expected_sqls))]
 
-    def CheckUnorderableRow(self):
+    def test_unorderable_row(self):
         # iterdump() should be able to cope with unorderable row types (issue #15545)
         class UnorderableRow:
             def __init__(self, cursor, row):
@@ -71,7 +71,12 @@
         self.assertEqual(expected, got)
 
 def suite():
-    return unittest.TestSuite(unittest.makeSuite(DumpTests, "Check"))
+    tests = [
+        DumpTests,
+    ]
+    return unittest.TestSuite(
+        [unittest.TestLoader().loadTestsFromTestCase(t) for t in tests]
+    )
 
 def test():
     runner = unittest.TextTestRunner()
diff --git a/Lib/sqlite3/test/factory.py b/Lib/sqlite3/test/factory.py
index 95dd24b..8764284 100644
--- a/Lib/sqlite3/test/factory.py
+++ b/Lib/sqlite3/test/factory.py
@@ -1,7 +1,6 @@
-#-*- coding: iso-8859-1 -*-
 # pysqlite2/test/factory.py: tests for the various factories in pysqlite
 #
-# Copyright (C) 2005-2007 Gerhard Häring <gh@ghaering.de>
+# Copyright (C) 2005-2007 Gerhard Häring <gh@ghaering.de>
 #
 # This file is part of pysqlite.
 #
@@ -47,7 +46,7 @@
     def tearDown(self):
         self.con.close()
 
-    def CheckIsInstance(self):
+    def test_is_instance(self):
         self.assertIsInstance(self.con, MyConnection)
 
 class CursorFactoryTests(unittest.TestCase):
@@ -57,7 +56,7 @@
     def tearDown(self):
         self.con.close()
 
-    def CheckIsInstance(self):
+    def test_is_instance(self):
         cur = self.con.cursor()
         self.assertIsInstance(cur, sqlite.Cursor)
         cur = self.con.cursor(MyCursor)
@@ -65,7 +64,7 @@
         cur = self.con.cursor(factory=lambda con: MyCursor(con))
         self.assertIsInstance(cur, MyCursor)
 
-    def CheckInvalidFactory(self):
+    def test_invalid_factory(self):
         # not a callable at all
         self.assertRaises(TypeError, self.con.cursor, None)
         # invalid callable with not exact one argument
@@ -77,7 +76,7 @@
     def setUp(self):
         self.con = sqlite.connect(":memory:")
 
-    def CheckIsProducedByFactory(self):
+    def test_is_produced_by_factory(self):
         cur = self.con.cursor(factory=MyCursor)
         cur.execute("select 4+5 as foo")
         row = cur.fetchone()
@@ -91,12 +90,12 @@
     def setUp(self):
         self.con = sqlite.connect(":memory:")
 
-    def CheckCustomFactory(self):
+    def test_custom_factory(self):
         self.con.row_factory = lambda cur, row: list(row)
         row = self.con.execute("select 1, 2").fetchone()
         self.assertIsInstance(row, list)
 
-    def CheckSqliteRowIndex(self):
+    def test_sqlite_row_index(self):
         self.con.row_factory = sqlite.Row
         row = self.con.execute("select 1 as a_1, 2 as b").fetchone()
         self.assertIsInstance(row, sqlite.Row)
@@ -125,7 +124,7 @@
         with self.assertRaises(IndexError):
             row[2**1000]
 
-    def CheckSqliteRowIndexUnicode(self):
+    def test_sqlite_row_index_unicode(self):
         self.con.row_factory = sqlite.Row
         row = self.con.execute("select 1 as \xff").fetchone()
         self.assertEqual(row["\xff"], 1)
@@ -134,7 +133,7 @@
         with self.assertRaises(IndexError):
             row['\xdf']
 
-    def CheckSqliteRowSlice(self):
+    def test_sqlite_row_slice(self):
         # A sqlite.Row can be sliced like a list.
         self.con.row_factory = sqlite.Row
         row = self.con.execute("select 1, 2, 3, 4").fetchone()
@@ -152,21 +151,21 @@
         self.assertEqual(row[0:4:2], (1, 3))
         self.assertEqual(row[3:0:-2], (4, 2))
 
-    def CheckSqliteRowIter(self):
+    def test_sqlite_row_iter(self):
         """Checks if the row object is iterable"""
         self.con.row_factory = sqlite.Row
         row = self.con.execute("select 1 as a, 2 as b").fetchone()
         for col in row:
             pass
 
-    def CheckSqliteRowAsTuple(self):
+    def test_sqlite_row_as_tuple(self):
         """Checks if the row object can be converted to a tuple"""
         self.con.row_factory = sqlite.Row
         row = self.con.execute("select 1 as a, 2 as b").fetchone()
         t = tuple(row)
         self.assertEqual(t, (row['a'], row['b']))
 
-    def CheckSqliteRowAsDict(self):
+    def test_sqlite_row_as_dict(self):
         """Checks if the row object can be correctly converted to a dictionary"""
         self.con.row_factory = sqlite.Row
         row = self.con.execute("select 1 as a, 2 as b").fetchone()
@@ -174,7 +173,7 @@
         self.assertEqual(d["a"], row["a"])
         self.assertEqual(d["b"], row["b"])
 
-    def CheckSqliteRowHashCmp(self):
+    def test_sqlite_row_hash_cmp(self):
         """Checks if the row object compares and hashes correctly"""
         self.con.row_factory = sqlite.Row
         row_1 = self.con.execute("select 1 as a, 2 as b").fetchone()
@@ -208,7 +207,7 @@
 
         self.assertEqual(hash(row_1), hash(row_2))
 
-    def CheckSqliteRowAsSequence(self):
+    def test_sqlite_row_as_sequence(self):
         """ Checks if the row object can act like a sequence """
         self.con.row_factory = sqlite.Row
         row = self.con.execute("select 1 as a, 2 as b").fetchone()
@@ -217,7 +216,7 @@
         self.assertEqual(list(reversed(row)), list(reversed(as_tuple)))
         self.assertIsInstance(row, Sequence)
 
-    def CheckFakeCursorClass(self):
+    def test_fake_cursor_class(self):
         # Issue #24257: Incorrect use of PyObject_IsInstance() caused
         # segmentation fault.
         # Issue #27861: Also applies for cursor factory.
@@ -234,30 +233,31 @@
     def setUp(self):
         self.con = sqlite.connect(":memory:")
 
-    def CheckUnicode(self):
-        austria = "Österreich"
+    def test_unicode(self):
+        austria = "Österreich"
         row = self.con.execute("select ?", (austria,)).fetchone()
         self.assertEqual(type(row[0]), str, "type of row[0] must be unicode")
 
-    def CheckString(self):
+    def test_string(self):
         self.con.text_factory = bytes
-        austria = "Österreich"
+        austria = "Österreich"
         row = self.con.execute("select ?", (austria,)).fetchone()
         self.assertEqual(type(row[0]), bytes, "type of row[0] must be bytes")
         self.assertEqual(row[0], austria.encode("utf-8"), "column must equal original data in UTF-8")
 
-    def CheckCustom(self):
+    def test_custom(self):
         self.con.text_factory = lambda x: str(x, "utf-8", "ignore")
-        austria = "Österreich"
+        austria = "Österreich"
         row = self.con.execute("select ?", (austria,)).fetchone()
         self.assertEqual(type(row[0]), str, "type of row[0] must be unicode")
         self.assertTrue(row[0].endswith("reich"), "column must contain original data")
 
-    def CheckOptimizedUnicode(self):
-        # In py3k, str objects are always returned when text_factory
-        # is OptimizedUnicode
-        self.con.text_factory = sqlite.OptimizedUnicode
-        austria = "Österreich"
+    def test_optimized_unicode(self):
+        # OptimizedUnicode is deprecated as of Python 3.10
+        with self.assertWarns(DeprecationWarning) as cm:
+            self.con.text_factory = sqlite.OptimizedUnicode
+        self.assertIn("factory.py", cm.filename)
+        austria = "Österreich"
         germany = "Deutchland"
         a_row = self.con.execute("select ?", (austria,)).fetchone()
         d_row = self.con.execute("select ?", (germany,)).fetchone()
@@ -273,25 +273,25 @@
         self.con.execute("create table test (value text)")
         self.con.execute("insert into test (value) values (?)", ("a\x00b",))
 
-    def CheckString(self):
+    def test_string(self):
         # text_factory defaults to str
         row = self.con.execute("select value from test").fetchone()
         self.assertIs(type(row[0]), str)
         self.assertEqual(row[0], "a\x00b")
 
-    def CheckBytes(self):
+    def test_bytes(self):
         self.con.text_factory = bytes
         row = self.con.execute("select value from test").fetchone()
         self.assertIs(type(row[0]), bytes)
         self.assertEqual(row[0], b"a\x00b")
 
-    def CheckBytearray(self):
+    def test_bytearray(self):
         self.con.text_factory = bytearray
         row = self.con.execute("select value from test").fetchone()
         self.assertIs(type(row[0]), bytearray)
         self.assertEqual(row[0], b"a\x00b")
 
-    def CheckCustom(self):
+    def test_custom(self):
         # A custom factory should receive a bytes argument
         self.con.text_factory = lambda x: x
         row = self.con.execute("select value from test").fetchone()
@@ -302,13 +302,17 @@
         self.con.close()
 
 def suite():
-    connection_suite = unittest.makeSuite(ConnectionFactoryTests, "Check")
-    cursor_suite = unittest.makeSuite(CursorFactoryTests, "Check")
-    row_suite_compat = unittest.makeSuite(RowFactoryTestsBackwardsCompat, "Check")
-    row_suite = unittest.makeSuite(RowFactoryTests, "Check")
-    text_suite = unittest.makeSuite(TextFactoryTests, "Check")
-    text_zero_bytes_suite = unittest.makeSuite(TextFactoryTestsWithEmbeddedZeroBytes, "Check")
-    return unittest.TestSuite((connection_suite, cursor_suite, row_suite_compat, row_suite, text_suite, text_zero_bytes_suite))
+    tests = [
+        ConnectionFactoryTests,
+        CursorFactoryTests,
+        RowFactoryTests,
+        RowFactoryTestsBackwardsCompat,
+        TextFactoryTests,
+        TextFactoryTestsWithEmbeddedZeroBytes,
+    ]
+    return unittest.TestSuite(
+        [unittest.TestLoader().loadTestsFromTestCase(t) for t in tests]
+    )
 
 def test():
     runner = unittest.TextTestRunner()
diff --git a/Lib/sqlite3/test/hooks.py b/Lib/sqlite3/test/hooks.py
index d74e74b..8c60bdc 100644
--- a/Lib/sqlite3/test/hooks.py
+++ b/Lib/sqlite3/test/hooks.py
@@ -1,7 +1,6 @@
-#-*- coding: iso-8859-1 -*-
 # pysqlite2/test/hooks.py: tests for various SQLite-specific hooks
 #
-# Copyright (C) 2006-2007 Gerhard Häring <gh@ghaering.de>
+# Copyright (C) 2006-2007 Gerhard Häring <gh@ghaering.de>
 #
 # This file is part of pysqlite.
 #
@@ -24,26 +23,27 @@
 import unittest
 import sqlite3 as sqlite
 
-from test.support import TESTFN, unlink
+from test.support.os_helper import TESTFN, unlink
+
 
 class CollationTests(unittest.TestCase):
-    def CheckCreateCollationNotString(self):
+    def test_create_collation_not_string(self):
         con = sqlite.connect(":memory:")
         with self.assertRaises(TypeError):
             con.create_collation(None, lambda x, y: (x > y) - (x < y))
 
-    def CheckCreateCollationNotCallable(self):
+    def test_create_collation_not_callable(self):
         con = sqlite.connect(":memory:")
         with self.assertRaises(TypeError) as cm:
             con.create_collation("X", 42)
         self.assertEqual(str(cm.exception), 'parameter must be callable')
 
-    def CheckCreateCollationNotAscii(self):
+    def test_create_collation_not_ascii(self):
         con = sqlite.connect(":memory:")
         with self.assertRaises(sqlite.ProgrammingError):
-            con.create_collation("collä", lambda x, y: (x > y) - (x < y))
+            con.create_collation("collä", lambda x, y: (x > y) - (x < y))
 
-    def CheckCreateCollationBadUpper(self):
+    def test_create_collation_bad_upper(self):
         class BadUpperStr(str):
             def upper(self):
                 return None
@@ -60,9 +60,7 @@
         self.assertEqual(result[0][0], 'b')
         self.assertEqual(result[1][0], 'a')
 
-    @unittest.skipIf(sqlite.sqlite_version_info < (3, 2, 1),
-                     'old SQLite versions crash on this test')
-    def CheckCollationIsUsed(self):
+    def test_collation_is_used(self):
         def mycoll(x, y):
             # reverse order
             return -((x > y) - (x < y))
@@ -87,7 +85,7 @@
             result = con.execute(sql).fetchall()
         self.assertEqual(str(cm.exception), 'no such collation sequence: mycoll')
 
-    def CheckCollationReturnsLargeInteger(self):
+    def test_collation_returns_large_integer(self):
         def mycoll(x, y):
             # reverse order
             return -((x > y) - (x < y)) * 2**32
@@ -106,7 +104,7 @@
         self.assertEqual(result, [('c',), ('b',), ('a',)],
                          msg="the expected order was not returned")
 
-    def CheckCollationRegisterTwice(self):
+    def test_collation_register_twice(self):
         """
         Register two different collation functions under the same name.
         Verify that the last one is actually used.
@@ -120,7 +118,7 @@
         self.assertEqual(result[0][0], 'b')
         self.assertEqual(result[1][0], 'a')
 
-    def CheckDeregisterCollation(self):
+    def test_deregister_collation(self):
         """
         Register a collation, then deregister it. Make sure an error is raised if we try
         to use it.
@@ -133,7 +131,7 @@
         self.assertEqual(str(cm.exception), 'no such collation sequence: mycoll')
 
 class ProgressTests(unittest.TestCase):
-    def CheckProgressHandlerUsed(self):
+    def test_progress_handler_used(self):
         """
         Test that the progress handler is invoked once it is set.
         """
@@ -149,7 +147,7 @@
         self.assertTrue(progress_calls)
 
 
-    def CheckOpcodeCount(self):
+    def test_opcode_count(self):
         """
         Test that the opcode argument is respected.
         """
@@ -172,7 +170,7 @@
         second_count = len(progress_calls)
         self.assertGreaterEqual(first_count, second_count)
 
-    def CheckCancelOperation(self):
+    def test_cancel_operation(self):
         """
         Test that returning a non-zero value stops the operation in progress.
         """
@@ -186,7 +184,7 @@
             curs.execute,
             "create table bar (a, b)")
 
-    def CheckClearHandler(self):
+    def test_clear_handler(self):
         """
         Test that setting the progress handler to None clears the previously set handler.
         """
@@ -202,7 +200,7 @@
         self.assertEqual(action, 0, "progress handler was not cleared")
 
 class TraceCallbackTests(unittest.TestCase):
-    def CheckTraceCallbackUsed(self):
+    def test_trace_callback_used(self):
         """
         Test that the trace callback is invoked once it is set.
         """
@@ -215,7 +213,7 @@
         self.assertTrue(traced_statements)
         self.assertTrue(any("create table foo" in stmt for stmt in traced_statements))
 
-    def CheckClearTraceCallback(self):
+    def test_clear_trace_callback(self):
         """
         Test that setting the trace callback to None clears the previously set callback.
         """
@@ -228,7 +226,7 @@
         con.execute("create table foo(a, b)")
         self.assertFalse(traced_statements, "trace callback was not cleared")
 
-    def CheckUnicodeContent(self):
+    def test_unicode_content(self):
         """
         Test that the statement can contain unicode literals.
         """
@@ -239,17 +237,13 @@
             traced_statements.append(statement)
         con.set_trace_callback(trace)
         con.execute("create table foo(x)")
-        # Can't execute bound parameters as their values don't appear
-        # in traced statements before SQLite 3.6.21
-        # (cf. http://www.sqlite.org/draft/releaselog/3_6_21.html)
-        con.execute('insert into foo(x) values ("%s")' % unicode_value)
+        con.execute("insert into foo(x) values ('%s')" % unicode_value)
         con.commit()
         self.assertTrue(any(unicode_value in stmt for stmt in traced_statements),
                         "Unicode data %s garbled in trace callback: %s"
                         % (ascii(unicode_value), ', '.join(map(ascii, traced_statements))))
 
-    @unittest.skipIf(sqlite.sqlite_version_info < (3, 3, 9), "sqlite3_prepare_v2 is not available")
-    def CheckTraceCallbackContent(self):
+    def test_trace_callback_content(self):
         # set_trace_callback() shouldn't produce duplicate content (bpo-26187)
         traced_statements = []
         def trace(statement):
@@ -269,10 +263,14 @@
 
 
 def suite():
-    collation_suite = unittest.makeSuite(CollationTests, "Check")
-    progress_suite = unittest.makeSuite(ProgressTests, "Check")
-    trace_suite = unittest.makeSuite(TraceCallbackTests, "Check")
-    return unittest.TestSuite((collation_suite, progress_suite, trace_suite))
+    tests = [
+        CollationTests,
+        ProgressTests,
+        TraceCallbackTests,
+    ]
+    return unittest.TestSuite(
+        [unittest.TestLoader().loadTestsFromTestCase(t) for t in tests]
+    )
 
 def test():
     runner = unittest.TextTestRunner()
diff --git a/Lib/sqlite3/test/regression.py b/Lib/sqlite3/test/regression.py
index 6aa86d5..70d0ff9 100644
--- a/Lib/sqlite3/test/regression.py
+++ b/Lib/sqlite3/test/regression.py
@@ -1,7 +1,6 @@
-#-*- coding: iso-8859-1 -*-
 # pysqlite2/test/regression.py: pysqlite regression tests
 #
-# Copyright (C) 2006-2010 Gerhard Häring <gh@ghaering.de>
+# Copyright (C) 2006-2010 Gerhard Häring <gh@ghaering.de>
 #
 # This file is part of pysqlite.
 #
@@ -35,12 +34,12 @@
     def tearDown(self):
         self.con.close()
 
-    def CheckPragmaUserVersion(self):
+    def test_pragma_user_version(self):
         # This used to crash pysqlite because this pragma command returns NULL for the column name
         cur = self.con.cursor()
         cur.execute("pragma user_version")
 
-    def CheckPragmaSchemaVersion(self):
+    def test_pragma_schema_version(self):
         # This still crashed pysqlite <= 2.2.1
         con = sqlite.connect(":memory:", detect_types=sqlite.PARSE_COLNAMES)
         try:
@@ -50,7 +49,7 @@
             cur.close()
             con.close()
 
-    def CheckStatementReset(self):
+    def test_statement_reset(self):
         # pysqlite 2.1.0 to 2.2.0 have the problem that not all statements are
         # reset before a rollback, but only those that are still in the
         # statement cache. The others are not accessible from the connection object.
@@ -65,7 +64,7 @@
 
         con.rollback()
 
-    def CheckColumnNameWithSpaces(self):
+    def test_column_name_with_spaces(self):
         cur = self.con.cursor()
         cur.execute('select 1 as "foo bar [datetime]"')
         self.assertEqual(cur.description[0][0], "foo bar [datetime]")
@@ -73,7 +72,7 @@
         cur.execute('select 1 as "foo baz"')
         self.assertEqual(cur.description[0][0], "foo baz")
 
-    def CheckStatementFinalizationOnCloseDb(self):
+    def test_statement_finalization_on_close_db(self):
         # pysqlite versions <= 2.3.3 only finalized statements in the statement
         # cache when closing the database. statements that were still
         # referenced in cursors weren't closed and could provoke "
@@ -87,8 +86,7 @@
             cur.execute("select 1 x union select " + str(i))
         con.close()
 
-    @unittest.skipIf(sqlite.sqlite_version_info < (3, 2, 2), 'needs sqlite 3.2.2 or newer')
-    def CheckOnConflictRollback(self):
+    def test_on_conflict_rollback(self):
         con = sqlite.connect(":memory:")
         con.execute("create table foo(x, unique(x) on conflict rollback)")
         con.execute("insert into foo(x) values (1)")
@@ -102,7 +100,7 @@
         except sqlite.OperationalError:
             self.fail("pysqlite knew nothing about the implicit ROLLBACK")
 
-    def CheckWorkaroundForBuggySqliteTransferBindings(self):
+    def test_workaround_for_buggy_sqlite_transfer_bindings(self):
         """
         pysqlite would crash with older SQLite versions unless
         a workaround is implemented.
@@ -111,14 +109,14 @@
         self.con.execute("drop table foo")
         self.con.execute("create table foo(bar)")
 
-    def CheckEmptyStatement(self):
+    def test_empty_statement(self):
         """
         pysqlite used to segfault with SQLite versions 3.5.x. These return NULL
         for "no-operation" statements
         """
         self.con.execute("")
 
-    def CheckTypeMapUsage(self):
+    def test_type_map_usage(self):
         """
         pysqlite until 2.4.1 did not rebuild the row_cast_map when recompiling
         a statement. This test exhibits the problem.
@@ -127,13 +125,13 @@
         con = sqlite.connect(":memory:",detect_types=sqlite.PARSE_DECLTYPES)
         con.execute("create table foo(bar timestamp)")
         con.execute("insert into foo(bar) values (?)", (datetime.datetime.now(),))
-        con.execute(SELECT)
+        con.execute(SELECT).close()
         con.execute("drop table foo")
         con.execute("create table foo(bar integer)")
         con.execute("insert into foo(bar) values (5)")
-        con.execute(SELECT)
+        con.execute(SELECT).close()
 
-    def CheckBindMutatingList(self):
+    def test_bind_mutating_list(self):
         # Issue41662: Crash when mutate a list of parameters during iteration.
         class X:
             def __conform__(self, protocol):
@@ -146,7 +144,7 @@
         with self.assertRaises(IndexError):
             con.execute("insert into foo(bar, baz) values (?, ?)", parameters)
 
-    def CheckErrorMsgDecodeError(self):
+    def test_error_msg_decode_error(self):
         # When porting the module to Python 3.0, the error message about
         # decoding errors disappeared. This verifies they're back again.
         with self.assertRaises(sqlite.OperationalError) as cm:
@@ -155,13 +153,13 @@
         msg = "Could not decode to UTF-8 column 'colname' with text 'xxx"
         self.assertIn(msg, str(cm.exception))
 
-    def CheckRegisterAdapter(self):
+    def test_register_adapter(self):
         """
         See issue 3312.
         """
         self.assertRaises(TypeError, sqlite.register_adapter, {}, None)
 
-    def CheckSetIsolationLevel(self):
+    def test_set_isolation_level(self):
         # See issue 27881.
         class CustomStr(str):
             def upper(self):
@@ -191,7 +189,7 @@
                     con.isolation_level = value
                 self.assertEqual(con.isolation_level, "DEFERRED")
 
-    def CheckCursorConstructorCallCheck(self):
+    def test_cursor_constructor_call_check(self):
         """
         Verifies that cursor methods check whether base class __init__ was
         called.
@@ -208,14 +206,14 @@
                                     r'^Base Cursor\.__init__ not called\.$'):
             cur.close()
 
-    def CheckStrSubclass(self):
+    def test_str_subclass(self):
         """
         The Python 3.0 port of the module didn't cope with values of subclasses of str.
         """
         class MyStr(str): pass
         self.con.execute("select ?", (MyStr("abc"),))
 
-    def CheckConnectionConstructorCallCheck(self):
+    def test_connection_constructor_call_check(self):
         """
         Verifies that connection methods check whether base class __init__ was
         called.
@@ -228,7 +226,7 @@
         with self.assertRaises(sqlite.ProgrammingError):
             cur = con.cursor()
 
-    def CheckCursorRegistration(self):
+    def test_cursor_registration(self):
         """
         Verifies that subclassed cursor classes are correctly registered with
         the connection object, too.  (fetch-across-rollback problem)
@@ -250,7 +248,7 @@
         with self.assertRaises(sqlite.InterfaceError):
             cur.fetchall()
 
-    def CheckAutoCommit(self):
+    def test_auto_commit(self):
         """
         Verifies that creating a connection in autocommit mode works.
         2.5.3 introduced a regression so that these could no longer
@@ -258,7 +256,7 @@
         """
         con = sqlite.connect(":memory:", isolation_level=None)
 
-    def CheckPragmaAutocommit(self):
+    def test_pragma_autocommit(self):
         """
         Verifies that running a PRAGMA statement that does an autocommit does
         work. This did not work in 2.5.3/2.5.4.
@@ -270,21 +268,21 @@
         cur.execute("pragma page_size")
         row = cur.fetchone()
 
-    def CheckConnectionCall(self):
+    def test_connection_call(self):
         """
         Call a connection with a non-string SQL request: check error handling
         of the statement constructor.
         """
         self.assertRaises(TypeError, self.con, 1)
 
-    def CheckCollation(self):
+    def test_collation(self):
         def collation_cb(a, b):
             return 1
         self.assertRaises(sqlite.ProgrammingError, self.con.create_collation,
             # Lone surrogate cannot be encoded to the default encoding (utf8)
             "\uDC80", collation_cb)
 
-    def CheckRecursiveCursorUse(self):
+    def test_recursive_cursor_use(self):
         """
         http://bugs.python.org/issue10811
 
@@ -305,7 +303,7 @@
             cur.executemany("insert into b (baz) values (?)",
                             ((i,) for i in foo()))
 
-    def CheckConvertTimestampMicrosecondPadding(self):
+    def test_convert_timestamp_microsecond_padding(self):
         """
         http://bugs.python.org/issue14720
 
@@ -331,13 +329,13 @@
             datetime.datetime(2012, 4, 4, 15, 6, 0, 123456),
         ])
 
-    def CheckInvalidIsolationLevelType(self):
+    def test_invalid_isolation_level_type(self):
         # isolation level is a string, not an integer
         self.assertRaises(TypeError,
                           sqlite.connect, ":memory:", isolation_level=123)
 
 
-    def CheckNullCharacter(self):
+    def test_null_character(self):
         # Issue #21147
         con = sqlite.connect(":memory:")
         self.assertRaises(ValueError, con, "\0select 1")
@@ -346,7 +344,7 @@
         self.assertRaises(ValueError, cur.execute, " \0select 2")
         self.assertRaises(ValueError, cur.execute, "select 2\0")
 
-    def CheckCommitCursorReset(self):
+    def test_commit_cursor_reset(self):
         """
         Connection.commit() did reset cursors, which made sqlite3
         to return rows multiple times when fetched from cursors
@@ -377,7 +375,7 @@
                 counter += 1
         self.assertEqual(counter, 3, "should have returned exactly three rows")
 
-    def CheckBpo31770(self):
+    def test_bpo31770(self):
         """
         The interpreter shouldn't crash in case Cursor.__init__() is called
         more than once.
@@ -393,11 +391,11 @@
         del ref
         support.gc_collect()
 
-    def CheckDelIsolation_levelSegfault(self):
+    def test_del_isolation_level_segfault(self):
         with self.assertRaises(AttributeError):
             del self.con.isolation_level
 
-    def CheckBpo37347(self):
+    def test_bpo37347(self):
         class Printer:
             def log(self, *args):
                 return sqlite.SQLITE_OK
@@ -411,13 +409,19 @@
             self.con.execute("select 1")  # trigger seg fault
             method(None)
 
+    def test_return_empty_bytestring(self):
+        cur = self.con.execute("select X''")
+        val = cur.fetchone()[0]
+        self.assertEqual(val, b'')
 
 
 def suite():
-    regression_suite = unittest.makeSuite(RegressionTests, "Check")
-    return unittest.TestSuite((
-        regression_suite,
-    ))
+    tests = [
+        RegressionTests
+    ]
+    return unittest.TestSuite(
+        [unittest.TestLoader().loadTestsFromTestCase(t) for t in tests]
+    )
 
 def test():
     runner = unittest.TextTestRunner()
diff --git a/Lib/sqlite3/test/transactions.py b/Lib/sqlite3/test/transactions.py
index b8a13de..8028490 100644
--- a/Lib/sqlite3/test/transactions.py
+++ b/Lib/sqlite3/test/transactions.py
@@ -1,7 +1,6 @@
-#-*- coding: iso-8859-1 -*-
 # pysqlite2/test/transactions.py: tests transactions
 #
-# Copyright (C) 2005-2007 Gerhard Häring <gh@ghaering.de>
+# Copyright (C) 2005-2007 Gerhard Häring <gh@ghaering.de>
 #
 # This file is part of pysqlite.
 #
@@ -52,7 +51,7 @@
         except OSError:
             pass
 
-    def CheckDMLDoesNotAutoCommitBefore(self):
+    def test_dml_does_not_auto_commit_before(self):
         self.cur1.execute("create table test(i)")
         self.cur1.execute("insert into test(i) values (5)")
         self.cur1.execute("create table test2(j)")
@@ -60,14 +59,14 @@
         res = self.cur2.fetchall()
         self.assertEqual(len(res), 0)
 
-    def CheckInsertStartsTransaction(self):
+    def test_insert_starts_transaction(self):
         self.cur1.execute("create table test(i)")
         self.cur1.execute("insert into test(i) values (5)")
         self.cur2.execute("select i from test")
         res = self.cur2.fetchall()
         self.assertEqual(len(res), 0)
 
-    def CheckUpdateStartsTransaction(self):
+    def test_update_starts_transaction(self):
         self.cur1.execute("create table test(i)")
         self.cur1.execute("insert into test(i) values (5)")
         self.con1.commit()
@@ -76,7 +75,7 @@
         res = self.cur2.fetchone()[0]
         self.assertEqual(res, 5)
 
-    def CheckDeleteStartsTransaction(self):
+    def test_delete_starts_transaction(self):
         self.cur1.execute("create table test(i)")
         self.cur1.execute("insert into test(i) values (5)")
         self.con1.commit()
@@ -85,7 +84,7 @@
         res = self.cur2.fetchall()
         self.assertEqual(len(res), 1)
 
-    def CheckReplaceStartsTransaction(self):
+    def test_replace_starts_transaction(self):
         self.cur1.execute("create table test(i)")
         self.cur1.execute("insert into test(i) values (5)")
         self.con1.commit()
@@ -95,7 +94,7 @@
         self.assertEqual(len(res), 1)
         self.assertEqual(res[0][0], 5)
 
-    def CheckToggleAutoCommit(self):
+    def test_toggle_auto_commit(self):
         self.cur1.execute("create table test(i)")
         self.cur1.execute("insert into test(i) values (5)")
         self.con1.isolation_level = None
@@ -111,17 +110,13 @@
         res = self.cur2.fetchall()
         self.assertEqual(len(res), 1)
 
-    @unittest.skipIf(sqlite.sqlite_version_info < (3, 2, 2),
-                     'test hangs on sqlite versions older than 3.2.2')
-    def CheckRaiseTimeout(self):
+    def test_raise_timeout(self):
         self.cur1.execute("create table test(i)")
         self.cur1.execute("insert into test(i) values (5)")
         with self.assertRaises(sqlite.OperationalError):
             self.cur2.execute("insert into test(i) values (5)")
 
-    @unittest.skipIf(sqlite.sqlite_version_info < (3, 2, 2),
-                     'test hangs on sqlite versions older than 3.2.2')
-    def CheckLocking(self):
+    def test_locking(self):
         """
         This tests the improved concurrency with pysqlite 2.3.4. You needed
         to roll back con2 before you could commit con1.
@@ -133,7 +128,7 @@
         # NO self.con2.rollback() HERE!!!
         self.con1.commit()
 
-    def CheckRollbackCursorConsistency(self):
+    def test_rollback_cursor_consistency(self):
         """
         Checks if cursors on the connection are set into a "reset" state
         when a rollback is done on the connection.
@@ -153,12 +148,12 @@
         self.con = sqlite.connect(":memory:")
         self.cur = self.con.cursor()
 
-    def CheckDropTable(self):
+    def test_drop_table(self):
         self.cur.execute("create table test(i)")
         self.cur.execute("insert into test(i) values (5)")
         self.cur.execute("drop table test")
 
-    def CheckPragma(self):
+    def test_pragma(self):
         self.cur.execute("create table test(i)")
         self.cur.execute("insert into test(i) values (5)")
         self.cur.execute("pragma count_changes=1")
@@ -171,7 +166,7 @@
     def setUp(self):
         self.con = sqlite.connect(":memory:")
 
-    def CheckDdlDoesNotAutostartTransaction(self):
+    def test_ddl_does_not_autostart_transaction(self):
         # For backwards compatibility reasons, DDL statements should not
         # implicitly start a transaction.
         self.con.execute("create table test(i)")
@@ -179,7 +174,7 @@
         result = self.con.execute("select * from test").fetchall()
         self.assertEqual(result, [])
 
-    def CheckImmediateTransactionalDDL(self):
+    def test_immediate_transactional_ddl(self):
         # You can achieve transactional DDL by issuing a BEGIN
         # statement manually.
         self.con.execute("begin immediate")
@@ -188,7 +183,7 @@
         with self.assertRaises(sqlite.OperationalError):
             self.con.execute("select * from test")
 
-    def CheckTransactionalDDL(self):
+    def test_transactional_ddl(self):
         # You can achieve transactional DDL by issuing a BEGIN
         # statement manually.
         self.con.execute("begin")
@@ -201,10 +196,14 @@
         self.con.close()
 
 def suite():
-    default_suite = unittest.makeSuite(TransactionTests, "Check")
-    special_command_suite = unittest.makeSuite(SpecialCommandTests, "Check")
-    ddl_suite = unittest.makeSuite(TransactionalDDL, "Check")
-    return unittest.TestSuite((default_suite, special_command_suite, ddl_suite))
+    tests = [
+        SpecialCommandTests,
+        TransactionTests,
+        TransactionalDDL,
+    ]
+    return unittest.TestSuite(
+        [unittest.TestLoader().loadTestsFromTestCase(t) for t in tests]
+    )
 
 def test():
     runner = unittest.TextTestRunner()
diff --git a/Lib/sqlite3/test/types.py b/Lib/sqlite3/test/types.py
index d26a9cb..4bb1de8 100644
--- a/Lib/sqlite3/test/types.py
+++ b/Lib/sqlite3/test/types.py
@@ -1,7 +1,6 @@
-#-*- coding: iso-8859-1 -*-
 # pysqlite2/test/types.py: tests for type conversion and detection
 #
-# Copyright (C) 2005 Gerhard Häring <gh@ghaering.de>
+# Copyright (C) 2005 Gerhard Häring <gh@ghaering.de>
 #
 # This file is part of pysqlite.
 #
@@ -40,33 +39,33 @@
         self.cur.close()
         self.con.close()
 
-    def CheckString(self):
-        self.cur.execute("insert into test(s) values (?)", ("Österreich",))
+    def test_string(self):
+        self.cur.execute("insert into test(s) values (?)", ("Österreich",))
         self.cur.execute("select s from test")
         row = self.cur.fetchone()
-        self.assertEqual(row[0], "Österreich")
+        self.assertEqual(row[0], "Österreich")
 
-    def CheckSmallInt(self):
+    def test_small_int(self):
         self.cur.execute("insert into test(i) values (?)", (42,))
         self.cur.execute("select i from test")
         row = self.cur.fetchone()
         self.assertEqual(row[0], 42)
 
-    def CheckLargeInt(self):
+    def test_large_int(self):
         num = 2**40
         self.cur.execute("insert into test(i) values (?)", (num,))
         self.cur.execute("select i from test")
         row = self.cur.fetchone()
         self.assertEqual(row[0], num)
 
-    def CheckFloat(self):
+    def test_float(self):
         val = 3.14
         self.cur.execute("insert into test(f) values (?)", (val,))
         self.cur.execute("select f from test")
         row = self.cur.fetchone()
         self.assertEqual(row[0], val)
 
-    def CheckBlob(self):
+    def test_blob(self):
         sample = b"Guglhupf"
         val = memoryview(sample)
         self.cur.execute("insert into test(b) values (?)", (val,))
@@ -74,10 +73,10 @@
         row = self.cur.fetchone()
         self.assertEqual(row[0], sample)
 
-    def CheckUnicodeExecute(self):
-        self.cur.execute("select 'Österreich'")
+    def test_unicode_execute(self):
+        self.cur.execute("select 'Österreich'")
         row = self.cur.fetchone()
-        self.assertEqual(row[0], "Österreich")
+        self.assertEqual(row[0], "Österreich")
 
 class DeclTypesTests(unittest.TestCase):
     class Foo:
@@ -111,7 +110,20 @@
     def setUp(self):
         self.con = sqlite.connect(":memory:", detect_types=sqlite.PARSE_DECLTYPES)
         self.cur = self.con.cursor()
-        self.cur.execute("create table test(i int, s str, f float, b bool, u unicode, foo foo, bin blob, n1 number, n2 number(5), bad bad)")
+        self.cur.execute("""
+            create table test(
+                i int,
+                s str,
+                f float,
+                b bool,
+                u unicode,
+                foo foo,
+                bin blob,
+                n1 number,
+                n2 number(5),
+                bad bad,
+                cbin cblob)
+        """)
 
         # override float, make them always return the same number
         sqlite.converters["FLOAT"] = lambda x: 47.2
@@ -122,6 +134,7 @@
         sqlite.converters["BAD"] = DeclTypesTests.BadConform
         sqlite.converters["WRONG"] = lambda x: "WRONG"
         sqlite.converters["NUMBER"] = float
+        sqlite.converters["CBLOB"] = lambda x: b"blobish"
 
     def tearDown(self):
         del sqlite.converters["FLOAT"]
@@ -130,24 +143,25 @@
         del sqlite.converters["BAD"]
         del sqlite.converters["WRONG"]
         del sqlite.converters["NUMBER"]
+        del sqlite.converters["CBLOB"]
         self.cur.close()
         self.con.close()
 
-    def CheckString(self):
+    def test_string(self):
         # default
         self.cur.execute("insert into test(s) values (?)", ("foo",))
         self.cur.execute('select s as "s [WRONG]" from test')
         row = self.cur.fetchone()
         self.assertEqual(row[0], "foo")
 
-    def CheckSmallInt(self):
+    def test_small_int(self):
         # default
         self.cur.execute("insert into test(i) values (?)", (42,))
         self.cur.execute("select i from test")
         row = self.cur.fetchone()
         self.assertEqual(row[0], 42)
 
-    def CheckLargeInt(self):
+    def test_large_int(self):
         # default
         num = 2**40
         self.cur.execute("insert into test(i) values (?)", (num,))
@@ -155,7 +169,7 @@
         row = self.cur.fetchone()
         self.assertEqual(row[0], num)
 
-    def CheckFloat(self):
+    def test_float(self):
         # custom
         val = 3.14
         self.cur.execute("insert into test(f) values (?)", (val,))
@@ -163,7 +177,7 @@
         row = self.cur.fetchone()
         self.assertEqual(row[0], 47.2)
 
-    def CheckBool(self):
+    def test_bool(self):
         # custom
         self.cur.execute("insert into test(b) values (?)", (False,))
         self.cur.execute("select b from test")
@@ -176,7 +190,7 @@
         row = self.cur.fetchone()
         self.assertIs(row[0], True)
 
-    def CheckUnicode(self):
+    def test_unicode(self):
         # default
         val = "\xd6sterreich"
         self.cur.execute("insert into test(u) values (?)", (val,))
@@ -184,14 +198,14 @@
         row = self.cur.fetchone()
         self.assertEqual(row[0], val)
 
-    def CheckFoo(self):
+    def test_foo(self):
         val = DeclTypesTests.Foo("bla")
         self.cur.execute("insert into test(foo) values (?)", (val,))
         self.cur.execute("select foo from test")
         row = self.cur.fetchone()
         self.assertEqual(row[0], val)
 
-    def CheckErrorInConform(self):
+    def test_error_in_conform(self):
         val = DeclTypesTests.BadConform(TypeError)
         with self.assertRaises(sqlite.InterfaceError):
             self.cur.execute("insert into test(bad) values (?)", (val,))
@@ -204,19 +218,19 @@
         with self.assertRaises(KeyboardInterrupt):
             self.cur.execute("insert into test(bad) values (:val)", {"val": val})
 
-    def CheckUnsupportedSeq(self):
+    def test_unsupported_seq(self):
         class Bar: pass
         val = Bar()
         with self.assertRaises(sqlite.InterfaceError):
             self.cur.execute("insert into test(f) values (?)", (val,))
 
-    def CheckUnsupportedDict(self):
+    def test_unsupported_dict(self):
         class Bar: pass
         val = Bar()
         with self.assertRaises(sqlite.InterfaceError):
             self.cur.execute("insert into test(f) values (:val)", {"val": val})
 
-    def CheckBlob(self):
+    def test_blob(self):
         # default
         sample = b"Guglhupf"
         val = memoryview(sample)
@@ -225,19 +239,27 @@
         row = self.cur.fetchone()
         self.assertEqual(row[0], sample)
 
-    def CheckNumber1(self):
+    def test_number1(self):
         self.cur.execute("insert into test(n1) values (5)")
         value = self.cur.execute("select n1 from test").fetchone()[0]
         # if the converter is not used, it's an int instead of a float
         self.assertEqual(type(value), float)
 
-    def CheckNumber2(self):
+    def test_number2(self):
         """Checks whether converter names are cut off at '(' characters"""
         self.cur.execute("insert into test(n2) values (5)")
         value = self.cur.execute("select n2 from test").fetchone()[0]
         # if the converter is not used, it's an int instead of a float
         self.assertEqual(type(value), float)
 
+    def test_convert_zero_sized_blob(self):
+        self.con.execute("insert into test(cbin) values (?)", (b"",))
+        cur = self.con.execute("select cbin from test")
+        # Zero-sized blobs with converters returns None.  This differs from
+        # blobs without a converter, where b"" is returned.
+        self.assertIsNone(cur.fetchone()[0])
+
+
 class ColNamesTests(unittest.TestCase):
     def setUp(self):
         self.con = sqlite.connect(":memory:", detect_types=sqlite.PARSE_COLNAMES)
@@ -257,7 +279,7 @@
         self.cur.close()
         self.con.close()
 
-    def CheckDeclTypeNotUsed(self):
+    def test_decl_type_not_used(self):
         """
         Assures that the declared type is not used when PARSE_DECLTYPES
         is not set.
@@ -267,13 +289,13 @@
         val = self.cur.fetchone()[0]
         self.assertEqual(val, "xxx")
 
-    def CheckNone(self):
+    def test_none(self):
         self.cur.execute("insert into test(x) values (?)", (None,))
         self.cur.execute("select x from test")
         val = self.cur.fetchone()[0]
         self.assertEqual(val, None)
 
-    def CheckColName(self):
+    def test_col_name(self):
         self.cur.execute("insert into test(x) values (?)", ("xxx",))
         self.cur.execute('select x as "x y [bar]" from test')
         val = self.cur.fetchone()[0]
@@ -283,12 +305,12 @@
         # '[' (and the preceeding space) should be stripped.
         self.assertEqual(self.cur.description[0][0], "x y")
 
-    def CheckCaseInConverterName(self):
+    def test_case_in_converter_name(self):
         self.cur.execute("select 'other' as \"x [b1b1]\"")
         val = self.cur.fetchone()[0]
         self.assertEqual(val, "MARKER")
 
-    def CheckCursorDescriptionNoRow(self):
+    def test_cursor_description_no_row(self):
         """
         cursor.description should at least provide the column name(s), even if
         no row returned.
@@ -296,7 +318,7 @@
         self.cur.execute("select * from test where 0 = 1")
         self.assertEqual(self.cur.description[0][0], "x")
 
-    def CheckCursorDescriptionInsert(self):
+    def test_cursor_description_insert(self):
         self.cur.execute("insert into test values (1)")
         self.assertIsNone(self.cur.description)
 
@@ -313,19 +335,19 @@
         self.cur.close()
         self.con.close()
 
-    def CheckCursorDescriptionCTESimple(self):
+    def test_cursor_description_cte_simple(self):
         self.cur.execute("with one as (select 1) select * from one")
         self.assertIsNotNone(self.cur.description)
         self.assertEqual(self.cur.description[0][0], "1")
 
-    def CheckCursorDescriptionCTESMultipleColumns(self):
+    def test_cursor_description_cte_multiple_columns(self):
         self.cur.execute("insert into test values(1)")
         self.cur.execute("insert into test values(2)")
         self.cur.execute("with testCTE as (select * from test) select * from testCTE")
         self.assertIsNotNone(self.cur.description)
         self.assertEqual(self.cur.description[0][0], "x")
 
-    def CheckCursorDescriptionCTE(self):
+    def test_cursor_description_cte(self):
         self.cur.execute("insert into test values (1)")
         self.cur.execute("with bar as (select * from test) select * from test where x = 1")
         self.assertIsNotNone(self.cur.description)
@@ -354,7 +376,7 @@
         self.cur.close()
         self.con.close()
 
-    def CheckCasterIsUsed(self):
+    def test_caster_is_used(self):
         self.cur.execute("select ?", (4,))
         val = self.cur.fetchone()[0]
         self.assertEqual(type(val), float)
@@ -372,7 +394,7 @@
     def tearDown(self):
         self.con.close()
 
-    def CheckBinaryInputForConverter(self):
+    def test_binary_input_for_converter(self):
         testdata = b"abcdefg" * 10
         result = self.con.execute('select ? as "x [bin]"', (memoryview(zlib.compress(testdata)),)).fetchone()[0]
         self.assertEqual(testdata, result)
@@ -387,23 +409,21 @@
         self.cur.close()
         self.con.close()
 
-    def CheckSqliteDate(self):
+    def test_sqlite_date(self):
         d = sqlite.Date(2004, 2, 14)
         self.cur.execute("insert into test(d) values (?)", (d,))
         self.cur.execute("select d from test")
         d2 = self.cur.fetchone()[0]
         self.assertEqual(d, d2)
 
-    def CheckSqliteTimestamp(self):
+    def test_sqlite_timestamp(self):
         ts = sqlite.Timestamp(2004, 2, 14, 7, 15, 0)
         self.cur.execute("insert into test(ts) values (?)", (ts,))
         self.cur.execute("select ts from test")
         ts2 = self.cur.fetchone()[0]
         self.assertEqual(ts, ts2)
 
-    @unittest.skipIf(sqlite.sqlite_version_info < (3, 1),
-                     'the date functions are available on 3.1 or later')
-    def CheckSqlTimestamp(self):
+    def test_sql_timestamp(self):
         now = datetime.datetime.utcnow()
         self.cur.execute("insert into test(ts) values (current_timestamp)")
         self.cur.execute("select ts from test")
@@ -411,14 +431,14 @@
         self.assertEqual(type(ts), datetime.datetime)
         self.assertEqual(ts.year, now.year)
 
-    def CheckDateTimeSubSeconds(self):
+    def test_date_time_sub_seconds(self):
         ts = sqlite.Timestamp(2004, 2, 14, 7, 15, 0, 500000)
         self.cur.execute("insert into test(ts) values (?)", (ts,))
         self.cur.execute("select ts from test")
         ts2 = self.cur.fetchone()[0]
         self.assertEqual(ts, ts2)
 
-    def CheckDateTimeSubSecondsFloatingPoint(self):
+    def test_date_time_sub_seconds_floating_point(self):
         ts = sqlite.Timestamp(2004, 2, 14, 7, 15, 0, 510241)
         self.cur.execute("insert into test(ts) values (?)", (ts,))
         self.cur.execute("select ts from test")
@@ -426,14 +446,18 @@
         self.assertEqual(ts, ts2)
 
 def suite():
-    sqlite_type_suite = unittest.makeSuite(SqliteTypeTests, "Check")
-    decltypes_type_suite = unittest.makeSuite(DeclTypesTests, "Check")
-    colnames_type_suite = unittest.makeSuite(ColNamesTests, "Check")
-    adaptation_suite = unittest.makeSuite(ObjectAdaptationTests, "Check")
-    bin_suite = unittest.makeSuite(BinaryConverterTests, "Check")
-    date_suite = unittest.makeSuite(DateTimeTests, "Check")
-    cte_suite = unittest.makeSuite(CommonTableExpressionTests, "Check")
-    return unittest.TestSuite((sqlite_type_suite, decltypes_type_suite, colnames_type_suite, adaptation_suite, bin_suite, date_suite, cte_suite))
+    tests = [
+        BinaryConverterTests,
+        ColNamesTests,
+        CommonTableExpressionTests,
+        DateTimeTests,
+        DeclTypesTests,
+        ObjectAdaptationTests,
+        SqliteTypeTests,
+    ]
+    return unittest.TestSuite(
+        [unittest.TestLoader().loadTestsFromTestCase(t) for t in tests]
+    )
 
 def test():
     runner = unittest.TextTestRunner()
diff --git a/Lib/sqlite3/test/userfunctions.py b/Lib/sqlite3/test/userfunctions.py
index c11c82e..539fd4b 100644
--- a/Lib/sqlite3/test/userfunctions.py
+++ b/Lib/sqlite3/test/userfunctions.py
@@ -25,8 +25,13 @@
 import unittest.mock
 import sqlite3 as sqlite
 
+from test.support import gc_collect
+
+
 def func_returntext():
     return "foo"
+def func_returntextwithnull():
+    return "1\x002"
 def func_returnunicode():
     return "bar"
 def func_returnint():
@@ -42,22 +47,6 @@
 def func_raiseexception():
     5/0
 
-def func_isstring(v):
-    return type(v) is str
-def func_isint(v):
-    return type(v) is int
-def func_isfloat(v):
-    return type(v) is float
-def func_isnone(v):
-    return type(v) is type(None)
-def func_isblob(v):
-    return isinstance(v, (bytes, memoryview))
-def func_islonglong(v):
-    return isinstance(v, int) and v >= 1<<31
-
-def func(*args):
-    return len(args)
-
 class AggrNoStep:
     def __init__(self):
         pass
@@ -137,36 +126,44 @@
     def finalize(self):
         return self.val
 
+class AggrText:
+    def __init__(self):
+        self.txt = ""
+    def step(self, txt):
+        self.txt = self.txt + txt
+    def finalize(self):
+        return self.txt
+
+
 class FunctionTests(unittest.TestCase):
     def setUp(self):
         self.con = sqlite.connect(":memory:")
 
         self.con.create_function("returntext", 0, func_returntext)
+        self.con.create_function("returntextwithnull", 0, func_returntextwithnull)
         self.con.create_function("returnunicode", 0, func_returnunicode)
         self.con.create_function("returnint", 0, func_returnint)
         self.con.create_function("returnfloat", 0, func_returnfloat)
         self.con.create_function("returnnull", 0, func_returnnull)
         self.con.create_function("returnblob", 0, func_returnblob)
         self.con.create_function("returnlonglong", 0, func_returnlonglong)
+        self.con.create_function("returnnan", 0, lambda: float("nan"))
+        self.con.create_function("returntoolargeint", 0, lambda: 1 << 65)
         self.con.create_function("raiseexception", 0, func_raiseexception)
 
-        self.con.create_function("isstring", 1, func_isstring)
-        self.con.create_function("isint", 1, func_isint)
-        self.con.create_function("isfloat", 1, func_isfloat)
-        self.con.create_function("isnone", 1, func_isnone)
-        self.con.create_function("isblob", 1, func_isblob)
-        self.con.create_function("islonglong", 1, func_islonglong)
-        self.con.create_function("spam", -1, func)
+        self.con.create_function("isblob", 1, lambda x: isinstance(x, bytes))
+        self.con.create_function("isnone", 1, lambda x: x is None)
+        self.con.create_function("spam", -1, lambda *x: len(x))
         self.con.execute("create table test(t text)")
 
     def tearDown(self):
         self.con.close()
 
-    def CheckFuncErrorOnCreate(self):
+    def test_func_error_on_create(self):
         with self.assertRaises(sqlite.OperationalError):
             self.con.create_function("bla", -100, lambda x: 2*x)
 
-    def CheckFuncRefCount(self):
+    def test_func_ref_count(self):
         def getfunc():
             def f():
                 return 1
@@ -178,28 +175,34 @@
         cur = self.con.cursor()
         cur.execute("select reftest()")
 
-    def CheckFuncReturnText(self):
+    def test_func_return_text(self):
         cur = self.con.cursor()
         cur.execute("select returntext()")
         val = cur.fetchone()[0]
         self.assertEqual(type(val), str)
         self.assertEqual(val, "foo")
 
-    def CheckFuncReturnUnicode(self):
+    def test_func_return_text_with_null_char(self):
+        cur = self.con.cursor()
+        res = cur.execute("select returntextwithnull()").fetchone()[0]
+        self.assertEqual(type(res), str)
+        self.assertEqual(res, "1\x002")
+
+    def test_func_return_unicode(self):
         cur = self.con.cursor()
         cur.execute("select returnunicode()")
         val = cur.fetchone()[0]
         self.assertEqual(type(val), str)
         self.assertEqual(val, "bar")
 
-    def CheckFuncReturnInt(self):
+    def test_func_return_int(self):
         cur = self.con.cursor()
         cur.execute("select returnint()")
         val = cur.fetchone()[0]
         self.assertEqual(type(val), int)
         self.assertEqual(val, 42)
 
-    def CheckFuncReturnFloat(self):
+    def test_func_return_float(self):
         cur = self.con.cursor()
         cur.execute("select returnfloat()")
         val = cur.fetchone()[0]
@@ -207,75 +210,99 @@
         if val < 3.139 or val > 3.141:
             self.fail("wrong value")
 
-    def CheckFuncReturnNull(self):
+    def test_func_return_null(self):
         cur = self.con.cursor()
         cur.execute("select returnnull()")
         val = cur.fetchone()[0]
         self.assertEqual(type(val), type(None))
         self.assertEqual(val, None)
 
-    def CheckFuncReturnBlob(self):
+    def test_func_return_blob(self):
         cur = self.con.cursor()
         cur.execute("select returnblob()")
         val = cur.fetchone()[0]
         self.assertEqual(type(val), bytes)
         self.assertEqual(val, b"blob")
 
-    def CheckFuncReturnLongLong(self):
+    def test_func_return_long_long(self):
         cur = self.con.cursor()
         cur.execute("select returnlonglong()")
         val = cur.fetchone()[0]
         self.assertEqual(val, 1<<31)
 
-    def CheckFuncException(self):
+    def test_func_return_nan(self):
+        cur = self.con.cursor()
+        cur.execute("select returnnan()")
+        self.assertIsNone(cur.fetchone()[0])
+
+    def test_func_return_too_large_int(self):
+        cur = self.con.cursor()
+        with self.assertRaises(sqlite.OperationalError):
+            self.con.execute("select returntoolargeint()")
+
+    def test_func_exception(self):
         cur = self.con.cursor()
         with self.assertRaises(sqlite.OperationalError) as cm:
             cur.execute("select raiseexception()")
             cur.fetchone()
         self.assertEqual(str(cm.exception), 'user-defined function raised exception')
 
-    def CheckParamString(self):
-        cur = self.con.cursor()
-        cur.execute("select isstring(?)", ("foo",))
-        val = cur.fetchone()[0]
-        self.assertEqual(val, 1)
-
-    def CheckParamInt(self):
-        cur = self.con.cursor()
-        cur.execute("select isint(?)", (42,))
-        val = cur.fetchone()[0]
-        self.assertEqual(val, 1)
-
-    def CheckParamFloat(self):
-        cur = self.con.cursor()
-        cur.execute("select isfloat(?)", (3.14,))
-        val = cur.fetchone()[0]
-        self.assertEqual(val, 1)
-
-    def CheckParamNone(self):
-        cur = self.con.cursor()
-        cur.execute("select isnone(?)", (None,))
-        val = cur.fetchone()[0]
-        self.assertEqual(val, 1)
-
-    def CheckParamBlob(self):
-        cur = self.con.cursor()
-        cur.execute("select isblob(?)", (memoryview(b"blob"),))
-        val = cur.fetchone()[0]
-        self.assertEqual(val, 1)
-
-    def CheckParamLongLong(self):
-        cur = self.con.cursor()
-        cur.execute("select islonglong(?)", (1<<42,))
-        val = cur.fetchone()[0]
-        self.assertEqual(val, 1)
-
-    def CheckAnyArguments(self):
+    def test_any_arguments(self):
         cur = self.con.cursor()
         cur.execute("select spam(?, ?)", (1, 2))
         val = cur.fetchone()[0]
         self.assertEqual(val, 2)
 
+    def test_empty_blob(self):
+        cur = self.con.execute("select isblob(x'')")
+        self.assertTrue(cur.fetchone()[0])
+
+    def test_nan_float(self):
+        cur = self.con.execute("select isnone(?)", (float("nan"),))
+        # SQLite has no concept of nan; it is converted to NULL
+        self.assertTrue(cur.fetchone()[0])
+
+    def test_too_large_int(self):
+        err = "Python int too large to convert to SQLite INTEGER"
+        self.assertRaisesRegex(OverflowError, err, self.con.execute,
+                               "select spam(?)", (1 << 65,))
+
+    def test_non_contiguous_blob(self):
+        self.assertRaisesRegex(ValueError, "could not convert BLOB to buffer",
+                               self.con.execute, "select spam(?)",
+                               (memoryview(b"blob")[::2],))
+
+    def test_param_surrogates(self):
+        self.assertRaisesRegex(UnicodeEncodeError, "surrogates not allowed",
+                               self.con.execute, "select spam(?)",
+                               ("\ud803\ude6d",))
+
+    def test_func_params(self):
+        results = []
+        def append_result(arg):
+            results.append((arg, type(arg)))
+        self.con.create_function("test_params", 1, append_result)
+
+        dataset = [
+            (42, int),
+            (-1, int),
+            (1234567890123456789, int),
+            (4611686018427387905, int),  # 63-bit int with non-zero low bits
+            (3.14, float),
+            (float('inf'), float),
+            ("text", str),
+            ("1\x002", str),
+            ("\u02e2q\u02e1\u2071\u1d57\u1d49", str),
+            (b"blob", bytes),
+            (bytearray(range(2)), bytes),
+            (memoryview(b"blob"), bytes),
+            (None, type(None)),
+        ]
+        for val, _ in dataset:
+            cur = self.con.execute("select test_params(?)", (val,))
+            cur.fetchone()
+        self.assertEqual(dataset, results)
+
     # Regarding deterministic functions:
     #
     # Between 3.8.3 and 3.15.0, deterministic functions were only used to
@@ -284,7 +311,7 @@
     # deterministic functions were permitted in WHERE clauses of partial
     # indices, which allows testing based on syntax, iso. the query optimizer.
     @unittest.skipIf(sqlite.sqlite_version_info < (3, 8, 3), "Requires SQLite 3.8.3 or higher")
-    def CheckFuncNonDeterministic(self):
+    def test_func_non_deterministic(self):
         mock = unittest.mock.Mock(return_value=None)
         self.con.create_function("nondeterministic", 0, mock, deterministic=False)
         if sqlite.sqlite_version_info < (3, 15, 0):
@@ -295,7 +322,7 @@
                 self.con.execute("create index t on test(t) where nondeterministic() is not null")
 
     @unittest.skipIf(sqlite.sqlite_version_info < (3, 8, 3), "Requires SQLite 3.8.3 or higher")
-    def CheckFuncDeterministic(self):
+    def test_func_deterministic(self):
         mock = unittest.mock.Mock(return_value=None)
         self.con.create_function("deterministic", 0, mock, deterministic=True)
         if sqlite.sqlite_version_info < (3, 15, 0):
@@ -308,14 +335,30 @@
                 self.fail("Unexpected failure while creating partial index")
 
     @unittest.skipIf(sqlite.sqlite_version_info >= (3, 8, 3), "SQLite < 3.8.3 needed")
-    def CheckFuncDeterministicNotSupported(self):
+    def test_func_deterministic_not_supported(self):
         with self.assertRaises(sqlite.NotSupportedError):
             self.con.create_function("deterministic", 0, int, deterministic=True)
 
-    def CheckFuncDeterministicKeywordOnly(self):
+    def test_func_deterministic_keyword_only(self):
         with self.assertRaises(TypeError):
             self.con.create_function("deterministic", 0, int, True)
 
+    def test_function_destructor_via_gc(self):
+        # See bpo-44304: The destructor of the user function can
+        # crash if is called without the GIL from the gc functions
+        dest = sqlite.connect(':memory:')
+        def md5sum(t):
+            return
+
+        dest.create_function("md5", 1, md5sum)
+        x = dest("create table lang (name, first_appeared)")
+        del md5sum, dest
+
+        y = [x]
+        y.append(y)
+
+        del x,y
+        gc_collect()
 
 class AggregateTests(unittest.TestCase):
     def setUp(self):
@@ -341,87 +384,88 @@
         self.con.create_aggregate("checkType", 2, AggrCheckType)
         self.con.create_aggregate("checkTypes", -1, AggrCheckTypes)
         self.con.create_aggregate("mysum", 1, AggrSum)
+        self.con.create_aggregate("aggtxt", 1, AggrText)
 
     def tearDown(self):
         #self.cur.close()
         #self.con.close()
         pass
 
-    def CheckAggrErrorOnCreate(self):
+    def test_aggr_error_on_create(self):
         with self.assertRaises(sqlite.OperationalError):
             self.con.create_function("bla", -100, AggrSum)
 
-    def CheckAggrNoStep(self):
+    def test_aggr_no_step(self):
         cur = self.con.cursor()
         with self.assertRaises(AttributeError) as cm:
             cur.execute("select nostep(t) from test")
         self.assertEqual(str(cm.exception), "'AggrNoStep' object has no attribute 'step'")
 
-    def CheckAggrNoFinalize(self):
+    def test_aggr_no_finalize(self):
         cur = self.con.cursor()
         with self.assertRaises(sqlite.OperationalError) as cm:
             cur.execute("select nofinalize(t) from test")
             val = cur.fetchone()[0]
         self.assertEqual(str(cm.exception), "user-defined aggregate's 'finalize' method raised error")
 
-    def CheckAggrExceptionInInit(self):
+    def test_aggr_exception_in_init(self):
         cur = self.con.cursor()
         with self.assertRaises(sqlite.OperationalError) as cm:
             cur.execute("select excInit(t) from test")
             val = cur.fetchone()[0]
         self.assertEqual(str(cm.exception), "user-defined aggregate's '__init__' method raised error")
 
-    def CheckAggrExceptionInStep(self):
+    def test_aggr_exception_in_step(self):
         cur = self.con.cursor()
         with self.assertRaises(sqlite.OperationalError) as cm:
             cur.execute("select excStep(t) from test")
             val = cur.fetchone()[0]
         self.assertEqual(str(cm.exception), "user-defined aggregate's 'step' method raised error")
 
-    def CheckAggrExceptionInFinalize(self):
+    def test_aggr_exception_in_finalize(self):
         cur = self.con.cursor()
         with self.assertRaises(sqlite.OperationalError) as cm:
             cur.execute("select excFinalize(t) from test")
             val = cur.fetchone()[0]
         self.assertEqual(str(cm.exception), "user-defined aggregate's 'finalize' method raised error")
 
-    def CheckAggrCheckParamStr(self):
+    def test_aggr_check_param_str(self):
         cur = self.con.cursor()
-        cur.execute("select checkType('str', ?)", ("foo",))
+        cur.execute("select checkTypes('str', ?, ?)", ("foo", str()))
         val = cur.fetchone()[0]
-        self.assertEqual(val, 1)
+        self.assertEqual(val, 2)
 
-    def CheckAggrCheckParamInt(self):
+    def test_aggr_check_param_int(self):
         cur = self.con.cursor()
         cur.execute("select checkType('int', ?)", (42,))
         val = cur.fetchone()[0]
         self.assertEqual(val, 1)
 
-    def CheckAggrCheckParamsInt(self):
+    def test_aggr_check_params_int(self):
         cur = self.con.cursor()
         cur.execute("select checkTypes('int', ?, ?)", (42, 24))
         val = cur.fetchone()[0]
         self.assertEqual(val, 2)
 
-    def CheckAggrCheckParamFloat(self):
+    def test_aggr_check_param_float(self):
         cur = self.con.cursor()
         cur.execute("select checkType('float', ?)", (3.14,))
         val = cur.fetchone()[0]
         self.assertEqual(val, 1)
 
-    def CheckAggrCheckParamNone(self):
+    def test_aggr_check_param_none(self):
         cur = self.con.cursor()
         cur.execute("select checkType('None', ?)", (None,))
         val = cur.fetchone()[0]
         self.assertEqual(val, 1)
 
-    def CheckAggrCheckParamBlob(self):
+    def test_aggr_check_param_blob(self):
         cur = self.con.cursor()
         cur.execute("select checkType('blob', ?)", (memoryview(b"blob"),))
         val = cur.fetchone()[0]
         self.assertEqual(val, 1)
 
-    def CheckAggrCheckAggrSum(self):
+    def test_aggr_check_aggr_sum(self):
         cur = self.con.cursor()
         cur.execute("delete from test")
         cur.executemany("insert into test(i) values (?)", [(10,), (20,), (30,)])
@@ -429,6 +473,20 @@
         val = cur.fetchone()[0]
         self.assertEqual(val, 60)
 
+    def test_aggr_no_match(self):
+        cur = self.con.execute("select mysum(i) from (select 1 as i) where i == 0")
+        val = cur.fetchone()[0]
+        self.assertIsNone(val)
+
+    def test_aggr_text(self):
+        cur = self.con.cursor()
+        for txt in ["foo", "1\x002"]:
+            with self.subTest(txt=txt):
+                cur.execute("select aggtxt(?) from test", (txt,))
+                val = cur.fetchone()[0]
+                self.assertEqual(val, txt)
+
+
 class AuthorizerTests(unittest.TestCase):
     @staticmethod
     def authorizer_cb(action, arg1, arg2, dbname, source):
@@ -494,17 +552,17 @@
 
 
 def suite():
-    function_suite = unittest.makeSuite(FunctionTests, "Check")
-    aggregate_suite = unittest.makeSuite(AggregateTests, "Check")
-    authorizer_suite = unittest.makeSuite(AuthorizerTests)
-    return unittest.TestSuite((
-            function_suite,
-            aggregate_suite,
-            authorizer_suite,
-            unittest.makeSuite(AuthorizerRaiseExceptionTests),
-            unittest.makeSuite(AuthorizerIllegalTypeTests),
-            unittest.makeSuite(AuthorizerLargeIntegerTests),
-        ))
+    tests = [
+        AggregateTests,
+        AuthorizerIllegalTypeTests,
+        AuthorizerLargeIntegerTests,
+        AuthorizerRaiseExceptionTests,
+        AuthorizerTests,
+        FunctionTests,
+    ]
+    return unittest.TestSuite(
+        [unittest.TestLoader().loadTestsFromTestCase(t) for t in tests]
+    )
 
 def test():
     runner = unittest.TextTestRunner()
diff --git a/Lib/ssl.py b/Lib/ssl.py
index 30f4e59..181065d 100644
--- a/Lib/ssl.py
+++ b/Lib/ssl.py
@@ -253,7 +253,7 @@
     from _ssl import enum_certificates, enum_crls
 
 from socket import socket, SOCK_STREAM, create_connection
-from socket import SOL_SOCKET, SO_TYPE
+from socket import SOL_SOCKET, SO_TYPE, _GLOBAL_DEFAULT_TIMEOUT
 import socket as _socket
 import base64        # for DER-to-PEM translation
 import errno
@@ -381,6 +381,11 @@
     CertificateError is raised on failure. On success, the function
     returns nothing.
     """
+    warnings.warn(
+        "ssl.match_hostname() is deprecated",
+        category=DeprecationWarning,
+        stacklevel=2
+    )
     if not cert:
         raise ValueError("empty or no certificate, match_hostname needs a "
                          "SSL socket or SSL context with either "
@@ -479,7 +484,14 @@
     sslsocket_class = None  # SSLSocket is assigned later.
     sslobject_class = None  # SSLObject is assigned later.
 
-    def __new__(cls, protocol=PROTOCOL_TLS, *args, **kwargs):
+    def __new__(cls, protocol=None, *args, **kwargs):
+        if protocol is None:
+            warnings.warn(
+                "ssl.SSLContext() without protocol argument is deprecated.",
+                category=DeprecationWarning,
+                stacklevel=2
+            )
+            protocol = PROTOCOL_TLS
         self = _SSLContext.__new__(cls, protocol)
         return self
 
@@ -518,6 +530,11 @@
         )
 
     def set_npn_protocols(self, npn_protocols):
+        warnings.warn(
+            "ssl NPN is deprecated, use ALPN instead",
+            DeprecationWarning,
+            stacklevel=2
+        )
         protos = bytearray()
         for protocol in npn_protocols:
             b = bytes(protocol, 'ascii')
@@ -734,12 +751,15 @@
     # SSLContext sets OP_NO_SSLv2, OP_NO_SSLv3, OP_NO_COMPRESSION,
     # OP_CIPHER_SERVER_PREFERENCE, OP_SINGLE_DH_USE and OP_SINGLE_ECDH_USE
     # by default.
-    context = SSLContext(PROTOCOL_TLS)
-
     if purpose == Purpose.SERVER_AUTH:
         # verify certs and host name in client mode
+        context = SSLContext(PROTOCOL_TLS_CLIENT)
         context.verify_mode = CERT_REQUIRED
         context.check_hostname = True
+    elif purpose == Purpose.CLIENT_AUTH:
+        context = SSLContext(PROTOCOL_TLS_SERVER)
+    else:
+        raise ValueError(purpose)
 
     if cafile or capath or cadata:
         context.load_verify_locations(cafile, capath, cadata)
@@ -755,7 +775,7 @@
             context.keylog_filename = keylogfile
     return context
 
-def _create_unverified_context(protocol=PROTOCOL_TLS, *, cert_reqs=CERT_NONE,
+def _create_unverified_context(protocol=None, *, cert_reqs=CERT_NONE,
                            check_hostname=False, purpose=Purpose.SERVER_AUTH,
                            certfile=None, keyfile=None,
                            cafile=None, capath=None, cadata=None):
@@ -772,10 +792,18 @@
     # SSLContext sets OP_NO_SSLv2, OP_NO_SSLv3, OP_NO_COMPRESSION,
     # OP_CIPHER_SERVER_PREFERENCE, OP_SINGLE_DH_USE and OP_SINGLE_ECDH_USE
     # by default.
-    context = SSLContext(protocol)
+    if purpose == Purpose.SERVER_AUTH:
+        # verify certs and host name in client mode
+        if protocol is None:
+            protocol = PROTOCOL_TLS_CLIENT
+    elif purpose == Purpose.CLIENT_AUTH:
+        if protocol is None:
+            protocol = PROTOCOL_TLS_SERVER
+    else:
+        raise ValueError(purpose)
 
-    if not check_hostname:
-        context.check_hostname = False
+    context = SSLContext(protocol)
+    context.check_hostname = check_hostname
     if cert_reqs is not None:
         context.verify_mode = cert_reqs
     if check_hostname:
@@ -909,15 +937,17 @@
         """Return the currently selected NPN protocol as a string, or ``None``
         if a next protocol was not negotiated or if NPN is not supported by one
         of the peers."""
-        if _ssl.HAS_NPN:
-            return self._sslobj.selected_npn_protocol()
+        warnings.warn(
+            "ssl NPN is deprecated, use ALPN instead",
+            DeprecationWarning,
+            stacklevel=2
+        )
 
     def selected_alpn_protocol(self):
         """Return the currently selected ALPN protocol as a string, or ``None``
         if a next protocol was not negotiated or if ALPN is not supported by one
         of the peers."""
-        if _ssl.HAS_ALPN:
-            return self._sslobj.selected_alpn_protocol()
+        return self._sslobj.selected_alpn_protocol()
 
     def cipher(self):
         """Return the currently selected cipher as a 3-tuple ``(name,
@@ -1126,10 +1156,12 @@
     @_sslcopydoc
     def selected_npn_protocol(self):
         self._checkClosed()
-        if self._sslobj is None or not _ssl.HAS_NPN:
-            return None
-        else:
-            return self._sslobj.selected_npn_protocol()
+        warnings.warn(
+            "ssl NPN is deprecated, use ALPN instead",
+            DeprecationWarning,
+            stacklevel=2
+        )
+        return None
 
     @_sslcopydoc
     def selected_alpn_protocol(self):
@@ -1388,7 +1420,11 @@
                 do_handshake_on_connect=True,
                 suppress_ragged_eofs=True,
                 ciphers=None):
-
+    warnings.warn(
+        "ssl.wrap_socket() is deprecated, use SSLContext.wrap_socket()",
+        category=DeprecationWarning,
+        stacklevel=2
+    )
     if server_side and not certfile:
         raise ValueError("certfile must be specified for server-side "
                          "operations")
@@ -1466,11 +1502,14 @@
     d = pem_cert_string.strip()[len(PEM_HEADER):-len(PEM_FOOTER)]
     return base64.decodebytes(d.encode('ASCII', 'strict'))
 
-def get_server_certificate(addr, ssl_version=PROTOCOL_TLS, ca_certs=None):
+def get_server_certificate(addr, ssl_version=PROTOCOL_TLS_CLIENT,
+                           ca_certs=None, timeout=_GLOBAL_DEFAULT_TIMEOUT):
     """Retrieve the certificate from the server at the specified address,
     and return it as a PEM-encoded string.
     If 'ca_certs' is specified, validate the server cert against it.
-    If 'ssl_version' is specified, use it in the connection attempt."""
+    If 'ssl_version' is specified, use it in the connection attempt.
+    If 'timeout' is specified, use it in the connection attempt.
+    """
 
     host, port = addr
     if ca_certs is not None:
@@ -1480,8 +1519,8 @@
     context = _create_stdlib_context(ssl_version,
                                      cert_reqs=cert_reqs,
                                      cafile=ca_certs)
-    with  create_connection(addr) as sock:
-        with context.wrap_socket(sock) as sslsock:
+    with create_connection(addr, timeout=timeout) as sock:
+        with context.wrap_socket(sock, server_hostname=host) as sslsock:
             dercert = sslsock.getpeercert(True)
     return DER_cert_to_PEM_cert(dercert)
 
diff --git a/Lib/statistics.py b/Lib/statistics.py
index f9d3802..f662453 100644
--- a/Lib/statistics.py
+++ b/Lib/statistics.py
@@ -73,6 +73,30 @@
 2.5
 
 
+Statistics for relations between two inputs
+-------------------------------------------
+
+==================  ====================================================
+Function            Description
+==================  ====================================================
+covariance          Sample covariance for two variables.
+correlation         Pearson's correlation coefficient for two variables.
+linear_regression   Intercept and slope for simple linear regression.
+==================  ====================================================
+
+Calculate covariance, Pearson's correlation, and simple linear regression
+for two inputs:
+
+>>> x = [1, 2, 3, 4, 5, 6, 7, 8, 9]
+>>> y = [1, 2, 3, 1, 2, 3, 1, 2, 3]
+>>> covariance(x, y)
+0.75
+>>> correlation(x, y)  #doctest: +ELLIPSIS
+0.31622776601...
+>>> linear_regression(x, y)  #doctest:
+LinearRegression(slope=0.1, intercept=1.5)
+
+
 Exceptions
 ----------
 
@@ -83,9 +107,12 @@
 __all__ = [
     'NormalDist',
     'StatisticsError',
+    'correlation',
+    'covariance',
     'fmean',
     'geometric_mean',
     'harmonic_mean',
+    'linear_regression',
     'mean',
     'median',
     'median_grouped',
@@ -106,11 +133,11 @@
 
 from fractions import Fraction
 from decimal import Decimal
-from itertools import groupby
+from itertools import groupby, repeat
 from bisect import bisect_left, bisect_right
 from math import hypot, sqrt, fabs, exp, erf, tau, log, fsum
 from operator import itemgetter
-from collections import Counter
+from collections import Counter, namedtuple
 
 # === Exceptions ===
 
@@ -120,21 +147,17 @@
 
 # === Private utilities ===
 
-def _sum(data, start=0):
-    """_sum(data [, start]) -> (type, sum, count)
+def _sum(data):
+    """_sum(data) -> (type, sum, count)
 
     Return a high-precision sum of the given numeric data as a fraction,
     together with the type to be converted to and the count of items.
 
-    If optional argument ``start`` is given, it is added to the total.
-    If ``data`` is empty, ``start`` (defaulting to 0) is returned.
-
-
     Examples
     --------
 
-    >>> _sum([3, 2.25, 4.5, -0.5, 1.0], 0.75)
-    (<class 'float'>, Fraction(11, 1), 5)
+    >>> _sum([3, 2.25, 4.5, -0.5, 0.25])
+    (<class 'float'>, Fraction(19, 2), 5)
 
     Some sources of round-off error will be avoided:
 
@@ -157,10 +180,9 @@
     allowed.
     """
     count = 0
-    n, d = _exact_ratio(start)
-    partials = {d: n}
+    partials = {}
     partials_get = partials.get
-    T = _coerce(int, type(start))
+    T = int
     for typ, values in groupby(data, type):
         T = _coerce(T, typ)  # or raise TypeError
         for n, d in map(_exact_ratio, values):
@@ -173,8 +195,7 @@
         assert not _isfinite(total)
     else:
         # Sum all the partial sums using builtin sum.
-        # FIXME is this faster if we sum them in order of the denominator?
-        total = sum(Fraction(n, d) for d, n in sorted(partials.items()))
+        total = sum(Fraction(n, d) for d, n in partials.items())
     return (T, total, count)
 
 
@@ -225,27 +246,19 @@
     x is expected to be an int, Fraction, Decimal or float.
     """
     try:
-        # Optimise the common case of floats. We expect that the most often
-        # used numeric type will be builtin floats, so try to make this as
-        # fast as possible.
-        if type(x) is float or type(x) is Decimal:
-            return x.as_integer_ratio()
-        try:
-            # x may be an int, Fraction, or Integral ABC.
-            return (x.numerator, x.denominator)
-        except AttributeError:
-            try:
-                # x may be a float or Decimal subclass.
-                return x.as_integer_ratio()
-            except AttributeError:
-                # Just give up?
-                pass
+        return x.as_integer_ratio()
+    except AttributeError:
+        pass
     except (OverflowError, ValueError):
         # float NAN or INF.
         assert not _isfinite(x)
         return (x, None)
-    msg = "can't convert type '{}' to numerator/denominator"
-    raise TypeError(msg.format(type(x).__name__))
+    try:
+        # x may be an Integral ABC.
+        return (x.numerator, x.denominator)
+    except AttributeError:
+        msg = f"can't convert type '{type(x).__name__}' to numerator/denominator"
+        raise TypeError(msg)
 
 
 def _convert(value, T):
@@ -361,40 +374,39 @@
         return exp(fmean(map(log, data)))
     except ValueError:
         raise StatisticsError('geometric mean requires a non-empty dataset '
-                              ' containing positive numbers') from None
+                              'containing positive numbers') from None
 
 
-def harmonic_mean(data):
+def harmonic_mean(data, weights=None):
     """Return the harmonic mean of data.
 
-    The harmonic mean, sometimes called the subcontrary mean, is the
-    reciprocal of the arithmetic mean of the reciprocals of the data,
-    and is often appropriate when averaging quantities which are rates
-    or ratios, for example speeds. Example:
+    The harmonic mean is the reciprocal of the arithmetic mean of the
+    reciprocals of the data.  It can be used for averaging ratios or
+    rates, for example speeds.
 
-    Suppose an investor purchases an equal value of shares in each of
-    three companies, with P/E (price/earning) ratios of 2.5, 3 and 10.
-    What is the average P/E ratio for the investor's portfolio?
+    Suppose a car travels 40 km/hr for 5 km and then speeds-up to
+    60 km/hr for another 5 km. What is the average speed?
 
-    >>> harmonic_mean([2.5, 3, 10])  # For an equal investment portfolio.
-    3.6
+        >>> harmonic_mean([40, 60])
+        48.0
 
-    Using the arithmetic mean would give an average of about 5.167, which
-    is too high.
+    Suppose a car travels 40 km/hr for 5 km, and when traffic clears,
+    speeds-up to 60 km/hr for the remaining 30 km of the journey. What
+    is the average speed?
+
+        >>> harmonic_mean([40, 60], weights=[5, 30])
+        56.0
 
     If ``data`` is empty, or any element is less than zero,
     ``harmonic_mean`` will raise ``StatisticsError``.
     """
-    # For a justification for using harmonic mean for P/E ratios, see
-    # http://fixthepitch.pellucid.com/comps-analysis-the-missing-harmony-of-summary-statistics/
-    # http://papers.ssrn.com/sol3/papers.cfm?abstract_id=2621087
     if iter(data) is data:
         data = list(data)
     errmsg = 'harmonic mean does not support negative values'
     n = len(data)
     if n < 1:
         raise StatisticsError('harmonic_mean requires at least one data point')
-    elif n == 1:
+    elif n == 1 and weights is None:
         x = data[0]
         if isinstance(x, (numbers.Real, Decimal)):
             if x < 0:
@@ -402,13 +414,23 @@
             return x
         else:
             raise TypeError('unsupported type')
+    if weights is None:
+        weights = repeat(1, n)
+        sum_weights = n
+    else:
+        if iter(weights) is weights:
+            weights = list(weights)
+        if len(weights) != n:
+            raise StatisticsError('Number of weights does not match data size')
+        _, sum_weights, _ = _sum(w for w in _fail_neg(weights, errmsg))
     try:
-        T, total, count = _sum(1 / x for x in _fail_neg(data, errmsg))
+        data = _fail_neg(data, errmsg)
+        T, total, count = _sum(w / x if w else 0 for w, x in zip(weights, data))
     except ZeroDivisionError:
         return 0
-    assert count == n
-    return _convert(n / total, T)
-
+    if total <= 0:
+        raise StatisticsError('Weighted sum must be positive')
+    return _convert(sum_weights / total, T)
 
 # FIXME: investigate ways to calculate medians without sorting? Quickselect?
 def median(data):
@@ -683,14 +705,20 @@
     if c is not None:
         T, total, count = _sum((x-c)**2 for x in data)
         return (T, total)
-    c = mean(data)
-    T, total, count = _sum((x-c)**2 for x in data)
-    # The following sum should mathematically equal zero, but due to rounding
-    # error may not.
-    U, total2, count2 = _sum((x - c) for x in data)
-    assert T == U and count == count2
-    total -= total2 ** 2 / len(data)
-    assert not total < 0, 'negative sum of square deviations: %f' % total
+    T, total, count = _sum(data)
+    mean_n, mean_d = (total / count).as_integer_ratio()
+    partials = Counter()
+    for n, d in map(_exact_ratio, data):
+        diff_n = n * mean_d - d * mean_n
+        diff_d = d * mean_d
+        partials[diff_d * diff_d] += diff_n * diff_n
+    if None in partials:
+        # The sum will be a NAN or INF. We can ignore all the finite
+        # partials, and just look at this special one.
+        total = partials[None]
+        assert not _isfinite(total)
+    else:
+        total = sum(Fraction(n, d) for d, n in partials.items())
     return (T, total)
 
 
@@ -794,6 +822,9 @@
     1.0810874155219827
 
     """
+    # Fixme: Despite the exact sum of squared deviations, some inaccuracy
+    # remain because there are two rounding steps.  The first occurs in
+    # the _convert() step for variance(), the second occurs in math.sqrt().
     var = variance(data, xbar)
     try:
         return var.sqrt()
@@ -810,6 +841,9 @@
     0.986893273527251
 
     """
+    # Fixme: Despite the exact sum of squared deviations, some inaccuracy
+    # remain because there are two rounding steps.  The first occurs in
+    # the _convert() step for pvariance(), the second occurs in math.sqrt().
     var = pvariance(data, mu)
     try:
         return var.sqrt()
@@ -817,6 +851,119 @@
         return math.sqrt(var)
 
 
+# === Statistics for relations between two inputs ===
+
+# See https://en.wikipedia.org/wiki/Covariance
+#     https://en.wikipedia.org/wiki/Pearson_correlation_coefficient
+#     https://en.wikipedia.org/wiki/Simple_linear_regression
+
+
+def covariance(x, y, /):
+    """Covariance
+
+    Return the sample covariance of two inputs *x* and *y*. Covariance
+    is a measure of the joint variability of two inputs.
+
+    >>> x = [1, 2, 3, 4, 5, 6, 7, 8, 9]
+    >>> y = [1, 2, 3, 1, 2, 3, 1, 2, 3]
+    >>> covariance(x, y)
+    0.75
+    >>> z = [9, 8, 7, 6, 5, 4, 3, 2, 1]
+    >>> covariance(x, z)
+    -7.5
+    >>> covariance(z, x)
+    -7.5
+
+    """
+    n = len(x)
+    if len(y) != n:
+        raise StatisticsError('covariance requires that both inputs have same number of data points')
+    if n < 2:
+        raise StatisticsError('covariance requires at least two data points')
+    xbar = fsum(x) / n
+    ybar = fsum(y) / n
+    sxy = fsum((xi - xbar) * (yi - ybar) for xi, yi in zip(x, y))
+    return sxy / (n - 1)
+
+
+def correlation(x, y, /):
+    """Pearson's correlation coefficient
+
+    Return the Pearson's correlation coefficient for two inputs. Pearson's
+    correlation coefficient *r* takes values between -1 and +1. It measures the
+    strength and direction of the linear relationship, where +1 means very
+    strong, positive linear relationship, -1 very strong, negative linear
+    relationship, and 0 no linear relationship.
+
+    >>> x = [1, 2, 3, 4, 5, 6, 7, 8, 9]
+    >>> y = [9, 8, 7, 6, 5, 4, 3, 2, 1]
+    >>> correlation(x, x)
+    1.0
+    >>> correlation(x, y)
+    -1.0
+
+    """
+    n = len(x)
+    if len(y) != n:
+        raise StatisticsError('correlation requires that both inputs have same number of data points')
+    if n < 2:
+        raise StatisticsError('correlation requires at least two data points')
+    xbar = fsum(x) / n
+    ybar = fsum(y) / n
+    sxy = fsum((xi - xbar) * (yi - ybar) for xi, yi in zip(x, y))
+    sxx = fsum((xi - xbar) ** 2.0 for xi in x)
+    syy = fsum((yi - ybar) ** 2.0 for yi in y)
+    try:
+        return sxy / sqrt(sxx * syy)
+    except ZeroDivisionError:
+        raise StatisticsError('at least one of the inputs is constant')
+
+
+LinearRegression = namedtuple('LinearRegression', ('slope', 'intercept'))
+
+
+def linear_regression(x, y, /):
+    """Slope and intercept for simple linear regression.
+
+    Return the slope and intercept of simple linear regression
+    parameters estimated using ordinary least squares. Simple linear
+    regression describes relationship between an independent variable
+    *x* and a dependent variable *y* in terms of linear function:
+
+        y = slope * x + intercept + noise
+
+    where *slope* and *intercept* are the regression parameters that are
+    estimated, and noise represents the variability of the data that was
+    not explained by the linear regression (it is equal to the
+    difference between predicted and actual values of the dependent
+    variable).
+
+    The parameters are returned as a named tuple.
+
+    >>> x = [1, 2, 3, 4, 5]
+    >>> noise = NormalDist().samples(5, seed=42)
+    >>> y = [3 * x[i] + 2 + noise[i] for i in range(5)]
+    >>> linear_regression(x, y)  #doctest: +ELLIPSIS
+    LinearRegression(slope=3.09078914170..., intercept=1.75684970486...)
+
+    """
+    n = len(x)
+    if len(y) != n:
+        raise StatisticsError('linear regression requires that both inputs have same number of data points')
+    if n < 2:
+        raise StatisticsError('linear regression requires at least two data points')
+    xbar = fsum(x) / n
+    ybar = fsum(y) / n
+    sxy = fsum((xi - xbar) * (yi - ybar) for xi, yi in zip(x, y))
+    sxx = fsum((xi - xbar) ** 2.0 for xi in x)
+    try:
+        slope = sxy / sxx   # equivalent to:  covariance(x, y) / variance(x)
+    except ZeroDivisionError:
+        raise StatisticsError('x is constant')
+    intercept = ybar - slope * xbar
+    return LinearRegression(slope=slope, intercept=intercept)
+
+
 ## Normal Distribution #####################################################
 
 
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index f1d829a..ccb46a6 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -5,7 +5,6 @@
 # Copyright (c) 2003-2005 by Peter Astrand <astrand@lysator.liu.se>
 #
 # Licensed to PSF under a Contributor Agreement.
-# See http://www.python.org/2.4/license for licensing details.
 
 r"""Subprocesses with accessible I/O streams
 
@@ -55,13 +54,10 @@
 import types
 
 try:
-    import pwd
+    import fcntl
 except ImportError:
-    pwd = None
-try:
-    import grp
-except ImportError:
-    grp = None
+    fcntl = None
+
 
 __all__ = ["Popen", "PIPE", "STDOUT", "call", "check_call", "getstatusoutput",
            "getoutput", "check_output", "run", "CalledProcessError", "DEVNULL",
@@ -326,7 +322,7 @@
     if dev_mode:
         args.extend(('-X', 'dev'))
     for opt in ('faulthandler', 'tracemalloc', 'importtime',
-                'showrefcount', 'utf8', 'oldparser'):
+                'showrefcount', 'utf8'):
         if opt in xoptions:
             value = xoptions[opt]
             if value is True:
@@ -415,7 +411,11 @@
     if 'input' in kwargs and kwargs['input'] is None:
         # Explicitly passing input=None was previously equivalent to passing an
         # empty string. That is maintained here for backwards compatibility.
-        kwargs['input'] = '' if kwargs.get('universal_newlines', False) else b''
+        if kwargs.get('universal_newlines') or kwargs.get('text'):
+            empty = ''
+        else:
+            empty = b''
+        kwargs['input'] = empty
 
     return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
                **kwargs).stdout
@@ -660,8 +660,9 @@
         # os.posix_spawn() is not available
         return False
 
-    if sys.platform == 'darwin':
-        # posix_spawn() is a syscall on macOS and properly reports errors
+    if sys.platform in ('darwin', 'sunos5'):
+        # posix_spawn() is a syscall on both macOS and Solaris,
+        # and properly reports errors
         return True
 
     # Check libc name and runtime libc version
@@ -693,7 +694,7 @@
 _USE_POSIX_SPAWN = _use_posix_spawn()
 
 
-class Popen(object):
+class Popen:
     """ Execute a child program in a new process.
 
     For a complete description of the arguments see the Python documentation.
@@ -756,7 +757,7 @@
                  startupinfo=None, creationflags=0,
                  restore_signals=True, start_new_session=False,
                  pass_fds=(), *, user=None, group=None, extra_groups=None,
-                 encoding=None, errors=None, text=None, umask=-1):
+                 encoding=None, errors=None, text=None, umask=-1, pipesize=-1):
         """Create new Popen instance."""
         _cleanup()
         # Held while anything is calling waitpid before returncode has been
@@ -773,6 +774,11 @@
         if not isinstance(bufsize, int):
             raise TypeError("bufsize must be an integer")
 
+        if pipesize is None:
+            pipesize = -1  # Restore default
+        if not isinstance(pipesize, int):
+            raise TypeError("pipesize must be an integer")
+
         if _mswindows:
             if preexec_fn is not None:
                 raise ValueError("preexec_fn is not supported on Windows "
@@ -797,6 +803,7 @@
         self.returncode = None
         self.encoding = encoding
         self.errors = errors
+        self.pipesize = pipesize
 
         # Validate the combinations of text and universal_newlines
         if (text is not None and universal_newlines is not None
@@ -838,6 +845,13 @@
 
         self.text_mode = encoding or errors or text or universal_newlines
 
+        # PEP 597: We suppress the EncodingWarning in subprocess module
+        # for now (at Python 3.10), because we focus on files for now.
+        # This will be changed to encoding = io.text_encoding(encoding)
+        # in the future.
+        if self.text_mode and encoding is None:
+            self.encoding = encoding = "locale"
+
         # How long to resume waiting on a child after the first ^C.
         # There is no right value for this.  The purpose is to be polite
         # yet remain good for interactive users trying to exit a tool.
@@ -861,7 +875,9 @@
                                  "current platform")
 
             elif isinstance(group, str):
-                if grp is None:
+                try:
+                    import grp
+                except ImportError:
                     raise ValueError("The group parameter cannot be a string "
                                      "on systems without the grp module")
 
@@ -887,7 +903,9 @@
             gids = []
             for extra_group in extra_groups:
                 if isinstance(extra_group, str):
-                    if grp is None:
+                    try:
+                        import grp
+                    except ImportError:
                         raise ValueError("Items in extra_groups cannot be "
                                          "strings on systems without the "
                                          "grp module")
@@ -913,10 +931,11 @@
                                  "the current platform")
 
             elif isinstance(user, str):
-                if pwd is None:
+                try:
+                    import pwd
+                except ImportError:
                     raise ValueError("The user parameter cannot be a string "
                                      "on systems without the pwd module")
-
                 uid = pwd.getpwnam(user).pw_uid
             elif isinstance(user, int):
                 uid = user
@@ -985,7 +1004,7 @@
     def __repr__(self):
         obj_repr = (
             f"<{self.__class__.__name__}: "
-            f"returncode: {self.returncode} args: {list(self.args)!r}>"
+            f"returncode: {self.returncode} args: {self.args!r}>"
         )
         if len(obj_repr) > 80:
             obj_repr = obj_repr[:76] + "...>"
@@ -1521,10 +1540,8 @@
                 self.stderr.close()
 
             # All data exchanged.  Translate lists into strings.
-            if stdout is not None:
-                stdout = stdout[0]
-            if stderr is not None:
-                stderr = stderr[0]
+            stdout = stdout[0] if stdout else None
+            stderr = stderr[0] if stderr else None
 
             return (stdout, stderr)
 
@@ -1575,6 +1592,8 @@
                 pass
             elif stdin == PIPE:
                 p2cread, p2cwrite = os.pipe()
+                if self.pipesize > 0 and hasattr(fcntl, "F_SETPIPE_SZ"):
+                    fcntl.fcntl(p2cwrite, fcntl.F_SETPIPE_SZ, self.pipesize)
             elif stdin == DEVNULL:
                 p2cread = self._get_devnull()
             elif isinstance(stdin, int):
@@ -1587,6 +1606,8 @@
                 pass
             elif stdout == PIPE:
                 c2pread, c2pwrite = os.pipe()
+                if self.pipesize > 0 and hasattr(fcntl, "F_SETPIPE_SZ"):
+                    fcntl.fcntl(c2pwrite, fcntl.F_SETPIPE_SZ, self.pipesize)
             elif stdout == DEVNULL:
                 c2pwrite = self._get_devnull()
             elif isinstance(stdout, int):
@@ -1599,6 +1620,8 @@
                 pass
             elif stderr == PIPE:
                 errread, errwrite = os.pipe()
+                if self.pipesize > 0 and hasattr(fcntl, "F_SETPIPE_SZ"):
+                    fcntl.fcntl(errwrite, fcntl.F_SETPIPE_SZ, self.pipesize)
             elif stderr == STDOUT:
                 if c2pwrite != -1:
                     errwrite = c2pwrite
diff --git a/Lib/symbol.py b/Lib/symbol.py
deleted file mode 100644
index aaac8c9..0000000
--- a/Lib/symbol.py
+++ /dev/null
@@ -1,122 +0,0 @@
-"""Non-terminal symbols of Python grammar (from "graminit.h")."""
-
-#  This file is automatically generated; please don't muck it up!
-#
-#  To update the symbols in this file, 'cd' to the top directory of
-#  the python source tree after building the interpreter and run:
-#
-#    python3 Tools/scripts/generate_symbol_py.py Include/graminit.h Lib/symbol.py
-#
-# or just
-#
-#    make regen-symbol
-
-import warnings
-
-warnings.warn(
-    "The symbol module is deprecated and will be removed "
-    "in future versions of Python",
-    DeprecationWarning,
-    stacklevel=2,
-)
-
-#--start constants--
-single_input = 256
-file_input = 257
-eval_input = 258
-decorator = 259
-decorators = 260
-decorated = 261
-async_funcdef = 262
-funcdef = 263
-parameters = 264
-typedargslist = 265
-tfpdef = 266
-varargslist = 267
-vfpdef = 268
-stmt = 269
-simple_stmt = 270
-small_stmt = 271
-expr_stmt = 272
-annassign = 273
-testlist_star_expr = 274
-augassign = 275
-del_stmt = 276
-pass_stmt = 277
-flow_stmt = 278
-break_stmt = 279
-continue_stmt = 280
-return_stmt = 281
-yield_stmt = 282
-raise_stmt = 283
-import_stmt = 284
-import_name = 285
-import_from = 286
-import_as_name = 287
-dotted_as_name = 288
-import_as_names = 289
-dotted_as_names = 290
-dotted_name = 291
-global_stmt = 292
-nonlocal_stmt = 293
-assert_stmt = 294
-compound_stmt = 295
-async_stmt = 296
-if_stmt = 297
-while_stmt = 298
-for_stmt = 299
-try_stmt = 300
-with_stmt = 301
-with_item = 302
-except_clause = 303
-suite = 304
-namedexpr_test = 305
-test = 306
-test_nocond = 307
-lambdef = 308
-lambdef_nocond = 309
-or_test = 310
-and_test = 311
-not_test = 312
-comparison = 313
-comp_op = 314
-star_expr = 315
-expr = 316
-xor_expr = 317
-and_expr = 318
-shift_expr = 319
-arith_expr = 320
-term = 321
-factor = 322
-power = 323
-atom_expr = 324
-atom = 325
-testlist_comp = 326
-trailer = 327
-subscriptlist = 328
-subscript = 329
-sliceop = 330
-exprlist = 331
-testlist = 332
-dictorsetmaker = 333
-classdef = 334
-arglist = 335
-argument = 336
-comp_iter = 337
-sync_comp_for = 338
-comp_for = 339
-comp_if = 340
-encoding_decl = 341
-yield_expr = 342
-yield_arg = 343
-func_body_suite = 344
-func_type_input = 345
-func_type = 346
-typelist = 347
-#--end constants--
-
-sym_name = {}
-for _name, _value in list(globals().items()):
-    if type(_value) is type(0):
-        sym_name[_value] = _name
-del _name, _value
diff --git a/Lib/symtable.py b/Lib/symtable.py
index 521540f..98db1e2 100644
--- a/Lib/symtable.py
+++ b/Lib/symtable.py
@@ -10,6 +10,11 @@
 __all__ = ["symtable", "SymbolTable", "Class", "Function", "Symbol"]
 
 def symtable(code, filename, compile_type):
+    """ Return the toplevel *SymbolTable* for the source code.
+
+    *filename* is the name of the file with the code
+    and *compile_type* is the *compile()* mode argument.
+    """
     top = _symtable.symtable(code, filename, compile_type)
     return _newSymbolTable(top, filename)
 
@@ -55,6 +60,11 @@
                                                             self._filename)
 
     def get_type(self):
+        """Return the type of the symbol table.
+
+        The values retuned are 'class', 'module' and
+        'function'.
+        """
         if self._table.type == _symtable.TYPE_MODULE:
             return "module"
         if self._table.type == _symtable.TYPE_FUNCTION:
@@ -65,27 +75,51 @@
                "unexpected type: {0}".format(self._table.type)
 
     def get_id(self):
+        """Return an identifier for the table.
+        """
         return self._table.id
 
     def get_name(self):
+        """Return the table's name.
+
+        This corresponds to the name of the class, function
+        or 'top' if the table is for a class, function or
+        global respectively.
+        """
         return self._table.name
 
     def get_lineno(self):
+        """Return the number of the first line in the
+        block for the table.
+        """
         return self._table.lineno
 
     def is_optimized(self):
+        """Return *True* if the locals in the table
+        are optimizable.
+        """
         return bool(self._table.type == _symtable.TYPE_FUNCTION)
 
     def is_nested(self):
+        """Return *True* if the block is a nested class
+        or function."""
         return bool(self._table.nested)
 
     def has_children(self):
+        """Return *True* if the block has nested namespaces.
+        """
         return bool(self._table.children)
 
     def get_identifiers(self):
+        """Return a list of names of symbols in the table.
+        """
         return self._table.symbols.keys()
 
     def lookup(self, name):
+        """Lookup a *name* in the table.
+
+        Returns a *Symbol* instance.
+        """
         sym = self._symbols.get(name)
         if sym is None:
             flags = self._table.symbols[name]
@@ -96,6 +130,9 @@
         return sym
 
     def get_symbols(self):
+        """Return a list of *Symbol* instances for
+        names in the table.
+        """
         return [self.lookup(ident) for ident in self.get_identifiers()]
 
     def __check_children(self, name):
@@ -104,6 +141,8 @@
                 if st.name == name]
 
     def get_children(self):
+        """Return a list of the nested symbol tables.
+        """
         return [_newSymbolTable(st, self._filename)
                 for st in self._table.children]
 
@@ -122,11 +161,15 @@
                      if test_func(self._table.symbols[ident]))
 
     def get_parameters(self):
+        """Return a tuple of parameters to the function.
+        """
         if self.__params is None:
             self.__params = self.__idents_matching(lambda x:x & DEF_PARAM)
         return self.__params
 
     def get_locals(self):
+        """Return a tuple of locals in the function.
+        """
         if self.__locals is None:
             locs = (LOCAL, CELL)
             test = lambda x: ((x >> SCOPE_OFF) & SCOPE_MASK) in locs
@@ -134,6 +177,8 @@
         return self.__locals
 
     def get_globals(self):
+        """Return a tuple of globals in the function.
+        """
         if self.__globals is None:
             glob = (GLOBAL_IMPLICIT, GLOBAL_EXPLICIT)
             test = lambda x:((x >> SCOPE_OFF) & SCOPE_MASK) in glob
@@ -141,11 +186,15 @@
         return self.__globals
 
     def get_nonlocals(self):
+        """Return a tuple of nonlocals in the function.
+        """
         if self.__nonlocals is None:
             self.__nonlocals = self.__idents_matching(lambda x:x & DEF_NONLOCAL)
         return self.__nonlocals
 
     def get_frees(self):
+        """Return a tuple of free variables in the function.
+        """
         if self.__frees is None:
             is_free = lambda x:((x >> SCOPE_OFF) & SCOPE_MASK) == FREE
             self.__frees = self.__idents_matching(is_free)
@@ -157,6 +206,8 @@
     __methods = None
 
     def get_methods(self):
+        """Return a tuple of methods declared in the class.
+        """
         if self.__methods is None:
             d = {}
             for st in self._table.children:
@@ -178,12 +229,19 @@
         return "<symbol {0!r}>".format(self.__name)
 
     def get_name(self):
+        """Return a name of a symbol.
+        """
         return self.__name
 
     def is_referenced(self):
+        """Return *True* if the symbol is used in
+        its block.
+        """
         return bool(self.__flags & _symtable.USE)
 
     def is_parameter(self):
+        """Return *True* if the symbol is a parameter.
+        """
         return bool(self.__flags & DEF_PARAM)
 
     def is_global(self):
@@ -193,9 +251,12 @@
                     or (self.__module_scope and self.__flags & DEF_BOUND))
 
     def is_nonlocal(self):
+        """Return *True* if the symbol is nonlocal."""
         return bool(self.__flags & DEF_NONLOCAL)
 
     def is_declared_global(self):
+        """Return *True* if the symbol is declared global
+        with a global statement."""
         return bool(self.__scope == GLOBAL_EXPLICIT)
 
     def is_local(self):
@@ -205,19 +266,28 @@
                     or (self.__module_scope and self.__flags & DEF_BOUND))
 
     def is_annotated(self):
+        """Return *True* if the symbol is annotated.
+        """
         return bool(self.__flags & DEF_ANNOT)
 
     def is_free(self):
+        """Return *True* if a referenced symbol is
+        not assigned to.
+        """
         return bool(self.__scope == FREE)
 
     def is_imported(self):
+        """Return *True* if the symbol is created from
+        an import statement.
+        """
         return bool(self.__flags & DEF_IMPORT)
 
     def is_assigned(self):
+        """Return *True* if a symbol is assigned to."""
         return bool(self.__flags & DEF_LOCAL)
 
     def is_namespace(self):
-        """Returns true if name binding introduces new namespace.
+        """Returns *True* if name binding introduces new namespace.
 
         If the name is used as the target of a function or class
         statement, this will be true.
@@ -234,7 +304,7 @@
         return self.__namespaces
 
     def get_namespace(self):
-        """Returns the single namespace bound to this name.
+        """Return the single namespace bound to this name.
 
         Raises ValueError if the name is bound to multiple namespaces.
         """
diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py
index bf04ac5..daf9f00 100644
--- a/Lib/sysconfig.py
+++ b/Lib/sysconfig.py
@@ -18,6 +18,11 @@
     'parse_config_h',
 ]
 
+# Keys for get_config_var() that are never converted to Python integers.
+_ALWAYS_STR = {
+    'MACOSX_DEPLOYMENT_TARGET',
+}
+
 _INSTALL_SCHEMES = {
     'posix_prefix': {
         'stdlib': '{installed_base}/{platlibdir}/python{py_version_short}',
@@ -51,42 +56,73 @@
         'scripts': '{base}/Scripts',
         'data': '{base}',
         },
-    # NOTE: When modifying "purelib" scheme, update site._get_path() too.
-    'nt_user': {
-        'stdlib': '{userbase}/Python{py_version_nodot}',
-        'platstdlib': '{userbase}/Python{py_version_nodot}',
-        'purelib': '{userbase}/Python{py_version_nodot}/site-packages',
-        'platlib': '{userbase}/Python{py_version_nodot}/site-packages',
-        'include': '{userbase}/Python{py_version_nodot}/Include',
-        'scripts': '{userbase}/Python{py_version_nodot}/Scripts',
-        'data': '{userbase}',
-        },
-    'posix_user': {
-        'stdlib': '{userbase}/{platlibdir}/python{py_version_short}',
-        'platstdlib': '{userbase}/{platlibdir}/python{py_version_short}',
-        'purelib': '{userbase}/lib/python{py_version_short}/site-packages',
-        'platlib': '{userbase}/{platlibdir}/python{py_version_short}/site-packages',
-        'include': '{userbase}/include/python{py_version_short}',
-        'scripts': '{userbase}/bin',
-        'data': '{userbase}',
-        },
-    'osx_framework_user': {
-        'stdlib': '{userbase}/lib/python',
-        'platstdlib': '{userbase}/lib/python',
-        'purelib': '{userbase}/lib/python/site-packages',
-        'platlib': '{userbase}/lib/python/site-packages',
-        'include': '{userbase}/include',
-        'scripts': '{userbase}/bin',
-        'data': '{userbase}',
-        },
+    }
+
+
+# NOTE: site.py has copy of this function.
+# Sync it when modify this function.
+def _getuserbase():
+    env_base = os.environ.get("PYTHONUSERBASE", None)
+    if env_base:
+        return env_base
+
+    # VxWorks has no home directories
+    if sys.platform == "vxworks":
+        return None
+
+    def joinuser(*args):
+        return os.path.expanduser(os.path.join(*args))
+
+    if os.name == "nt":
+        base = os.environ.get("APPDATA") or "~"
+        return joinuser(base, "Python")
+
+    if sys.platform == "darwin" and sys._framework:
+        return joinuser("~", "Library", sys._framework,
+                        f"{sys.version_info[0]}.{sys.version_info[1]}")
+
+    return joinuser("~", ".local")
+
+_HAS_USER_BASE = (_getuserbase() is not None)
+
+if _HAS_USER_BASE:
+    _INSTALL_SCHEMES |= {
+        # NOTE: When modifying "purelib" scheme, update site._get_path() too.
+        'nt_user': {
+            'stdlib': '{userbase}/Python{py_version_nodot_plat}',
+            'platstdlib': '{userbase}/Python{py_version_nodot_plat}',
+            'purelib': '{userbase}/Python{py_version_nodot_plat}/site-packages',
+            'platlib': '{userbase}/Python{py_version_nodot_plat}/site-packages',
+            'include': '{userbase}/Python{py_version_nodot_plat}/Include',
+            'scripts': '{userbase}/Python{py_version_nodot_plat}/Scripts',
+            'data': '{userbase}',
+            },
+        'posix_user': {
+            'stdlib': '{userbase}/{platlibdir}/python{py_version_short}',
+            'platstdlib': '{userbase}/{platlibdir}/python{py_version_short}',
+            'purelib': '{userbase}/lib/python{py_version_short}/site-packages',
+            'platlib': '{userbase}/lib/python{py_version_short}/site-packages',
+            'include': '{userbase}/include/python{py_version_short}',
+            'scripts': '{userbase}/bin',
+            'data': '{userbase}',
+            },
+        'osx_framework_user': {
+            'stdlib': '{userbase}/lib/python',
+            'platstdlib': '{userbase}/lib/python',
+            'purelib': '{userbase}/lib/python/site-packages',
+            'platlib': '{userbase}/lib/python/site-packages',
+            'include': '{userbase}/include/python{py_version_short}',
+            'scripts': '{userbase}/bin',
+            'data': '{userbase}',
+            },
     }
 
 _SCHEME_KEYS = ('stdlib', 'platstdlib', 'purelib', 'platlib', 'include',
                 'scripts', 'data')
 
 _PY_VERSION = sys.version.split()[0]
-_PY_VERSION_SHORT = '%d.%d' % sys.version_info[:2]
-_PY_VERSION_SHORT_NO_DOT = '%d%d' % sys.version_info[:2]
+_PY_VERSION_SHORT = f'{sys.version_info[0]}.{sys.version_info[1]}'
+_PY_VERSION_SHORT_NO_DOT = f'{sys.version_info[0]}{sys.version_info[1]}'
 _PREFIX = os.path.normpath(sys.prefix)
 _BASE_PREFIX = os.path.normpath(sys.base_prefix)
 _EXEC_PREFIX = os.path.normpath(sys.exec_prefix)
@@ -94,6 +130,12 @@
 _CONFIG_VARS = None
 _USER_BASE = None
 
+# Regexes needed for parsing Makefile (and similar syntaxes,
+# like old-style Setup files).
+_variable_rx = r"([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)"
+_findvar1_rx = r"\$\(([A-Za-z][A-Za-z0-9_]*)\)"
+_findvar2_rx = r"\${([A-Za-z][A-Za-z0-9_]*)}"
+
 
 def _safe_realpath(path):
     try:
@@ -142,18 +184,24 @@
 
 if _PYTHON_BUILD:
     for scheme in ('posix_prefix', 'posix_home'):
-        _INSTALL_SCHEMES[scheme]['include'] = '{srcdir}/Include'
-        _INSTALL_SCHEMES[scheme]['platinclude'] = '{projectbase}/.'
+        # On POSIX-y platforms, Python will:
+        # - Build from .h files in 'headers' (which is only added to the
+        #   scheme when building CPython)
+        # - Install .h files to 'include'
+        scheme = _INSTALL_SCHEMES[scheme]
+        scheme['headers'] = scheme['include']
+        scheme['include'] = '{srcdir}/Include'
+        scheme['platinclude'] = '{projectbase}/.'
 
 
 def _subst_vars(s, local_vars):
     try:
         return s.format(**local_vars)
-    except KeyError:
+    except KeyError as var:
         try:
             return s.format(**os.environ)
-        except KeyError as var:
-            raise AttributeError('{%s}' % var) from None
+        except KeyError:
+            raise AttributeError(f'{var}') from None
 
 def _extend_dict(target_dict, other_dict):
     target_keys = target_dict.keys()
@@ -176,60 +224,62 @@
     return res
 
 
-def _get_default_scheme():
-    if os.name == 'posix':
-        # the default scheme for posix is posix_prefix
-        return 'posix_prefix'
-    return os.name
+def _get_preferred_schemes():
+    if os.name == 'nt':
+        return {
+            'prefix': 'nt',
+            'home': 'posix_home',
+            'user': 'nt_user',
+        }
+    if sys.platform == 'darwin' and sys._framework:
+        return {
+            'prefix': 'posix_prefix',
+            'home': 'posix_home',
+            'user': 'osx_framework_user',
+        }
+    return {
+        'prefix': 'posix_prefix',
+        'home': 'posix_home',
+        'user': 'posix_user',
+    }
 
 
-# NOTE: site.py has copy of this function.
-# Sync it when modify this function.
-def _getuserbase():
-    env_base = os.environ.get("PYTHONUSERBASE", None)
-    if env_base:
-        return env_base
-
-    def joinuser(*args):
-        return os.path.expanduser(os.path.join(*args))
-
-    if os.name == "nt":
-        base = os.environ.get("APPDATA") or "~"
-        return joinuser(base, "Python")
-
-    if sys.platform == "darwin" and sys._framework:
-        return joinuser("~", "Library", sys._framework,
-                        "%d.%d" % sys.version_info[:2])
-
-    return joinuser("~", ".local")
+def get_preferred_scheme(key):
+    scheme = _get_preferred_schemes()[key]
+    if scheme not in _INSTALL_SCHEMES:
+        raise ValueError(
+            f"{key!r} returned {scheme!r}, which is not a valid scheme "
+            f"on this platform"
+        )
+    return scheme
 
 
-def _parse_makefile(filename, vars=None):
+def get_default_scheme():
+    return get_preferred_scheme('prefix')
+
+
+def _parse_makefile(filename, vars=None, keep_unresolved=True):
     """Parse a Makefile-style file.
 
     A dictionary containing name/value pairs is returned.  If an
     optional dictionary is passed in as the second argument, it is
     used instead of a new dictionary.
     """
-    # Regexes needed for parsing Makefile (and similar syntaxes,
-    # like old-style Setup files).
     import re
-    _variable_rx = re.compile(r"([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)")
-    _findvar1_rx = re.compile(r"\$\(([A-Za-z][A-Za-z0-9_]*)\)")
-    _findvar2_rx = re.compile(r"\${([A-Za-z][A-Za-z0-9_]*)}")
 
     if vars is None:
         vars = {}
     done = {}
     notdone = {}
 
-    with open(filename, errors="surrogateescape") as f:
+    with open(filename, encoding=sys.getfilesystemencoding(),
+              errors="surrogateescape") as f:
         lines = f.readlines()
 
     for line in lines:
         if line.startswith('#') or line.strip() == '':
             continue
-        m = _variable_rx.match(line)
+        m = re.match(_variable_rx, line)
         if m:
             n, v = m.group(1, 2)
             v = v.strip()
@@ -240,6 +290,9 @@
                 notdone[n] = v
             else:
                 try:
+                    if n in _ALWAYS_STR:
+                        raise ValueError
+
                     v = int(v)
                 except ValueError:
                     # insert literal `$'
@@ -259,8 +312,8 @@
     while len(variables) > 0:
         for name in tuple(variables):
             value = notdone[name]
-            m1 = _findvar1_rx.search(value)
-            m2 = _findvar2_rx.search(value)
+            m1 = re.search(_findvar1_rx, value)
+            m2 = re.search(_findvar2_rx, value)
             if m1 and m2:
                 m = m1 if m1.start() < m2.start() else m2
             else:
@@ -298,6 +351,8 @@
                         notdone[name] = value
                     else:
                         try:
+                            if name in _ALWAYS_STR:
+                                raise ValueError
                             value = int(value)
                         except ValueError:
                             done[name] = value.strip()
@@ -313,9 +368,12 @@
                                 done[name] = value
 
             else:
+                # Adds unresolved variables to the done dict.
+                # This is disabled when called from distutils.sysconfig
+                if keep_unresolved:
+                    done[name] = value
                 # bogus variable reference (e.g. "prefix=$/opt/python");
                 # just drop it since we can't deal
-                done[name] = value
                 variables.remove(name)
 
     # strip spurious spaces
@@ -333,21 +391,20 @@
     if _PYTHON_BUILD:
         return os.path.join(_sys_home or _PROJECT_BASE, "Makefile")
     if hasattr(sys, 'abiflags'):
-        config_dir_name = 'config-%s%s' % (_PY_VERSION_SHORT, sys.abiflags)
+        config_dir_name = f'config-{_PY_VERSION_SHORT}{sys.abiflags}'
     else:
         config_dir_name = 'config'
     if hasattr(sys.implementation, '_multiarch'):
-        config_dir_name += '-%s' % sys.implementation._multiarch
+        config_dir_name += f'-{sys.implementation._multiarch}'
     return os.path.join(get_path('stdlib'), config_dir_name, 'Makefile')
 
 
 def _get_sysconfigdata_name():
-    return os.environ.get('_PYTHON_SYSCONFIGDATA_NAME',
-        '_sysconfigdata_{abi}_{platform}_{multiarch}'.format(
-        abi=sys.abiflags,
-        platform=sys.platform,
-        multiarch=getattr(sys.implementation, '_multiarch', ''),
-    ))
+    multiarch = getattr(sys.implementation, '_multiarch', '')
+    return os.environ.get(
+        '_PYTHON_SYSCONFIGDATA_NAME',
+        f'_sysconfigdata_{sys.abiflags}_{sys.platform}_{multiarch}',
+    )
 
 
 def _generate_posix_vars():
@@ -359,19 +416,19 @@
     try:
         _parse_makefile(makefile, vars)
     except OSError as e:
-        msg = "invalid Python installation: unable to open %s" % makefile
+        msg = f"invalid Python installation: unable to open {makefile}"
         if hasattr(e, "strerror"):
-            msg = msg + " (%s)" % e.strerror
+            msg = f"{msg} ({e.strerror})"
         raise OSError(msg)
     # load the installed pyconfig.h:
     config_h = get_config_h_filename()
     try:
-        with open(config_h) as f:
+        with open(config_h, encoding="utf-8") as f:
             parse_config_h(f, vars)
     except OSError as e:
-        msg = "invalid Python installation: unable to open %s" % config_h
+        msg = f"invalid Python installation: unable to open {config_h}"
         if hasattr(e, "strerror"):
-            msg = msg + " (%s)" % e.strerror
+            msg = f"{msg} ({e.strerror})"
         raise OSError(msg)
     # On AIX, there are wrong paths to the linker scripts in the Makefile
     # -- these paths are relative to the Python source, but when installed
@@ -397,7 +454,7 @@
         module.build_time_vars = vars
         sys.modules[name] = module
 
-    pybuilddir = 'build/lib.%s-%s' % (get_platform(), _PY_VERSION_SHORT)
+    pybuilddir = f'build/lib.{get_platform()}-{_PY_VERSION_SHORT}'
     if hasattr(sys, "gettotalrefcount"):
         pybuilddir += '-pydebug'
     os.makedirs(pybuilddir, exist_ok=True)
@@ -424,13 +481,15 @@
 def _init_non_posix(vars):
     """Initialize the module as appropriate for NT"""
     # set basic install directories
+    import _imp
     vars['LIBDEST'] = get_path('stdlib')
     vars['BINLIBDEST'] = get_path('platstdlib')
     vars['INCLUDEPY'] = get_path('include')
-    vars['EXT_SUFFIX'] = '.pyd'
+    vars['EXT_SUFFIX'] = _imp.extension_suffixes()[0]
     vars['EXE'] = '.exe'
     vars['VERSION'] = _PY_VERSION_SHORT_NO_DOT
     vars['BINDIR'] = os.path.dirname(_safe_realpath(sys.executable))
+    vars['TZPATH'] = ''
 
 #
 # public APIs
@@ -458,6 +517,8 @@
         if m:
             n, v = m.group(1, 2)
             try:
+                if n in _ALWAYS_STR:
+                    raise ValueError
                 v = int(v)
             except ValueError:
                 pass
@@ -491,7 +552,7 @@
     return _SCHEME_KEYS
 
 
-def get_paths(scheme=_get_default_scheme(), vars=None, expand=True):
+def get_paths(scheme=get_default_scheme(), vars=None, expand=True):
     """Return a mapping containing an install scheme.
 
     ``scheme`` is the install scheme name. If not provided, it will
@@ -503,7 +564,7 @@
         return _INSTALL_SCHEMES[scheme]
 
 
-def get_path(name, scheme=_get_default_scheme(), vars=None, expand=True):
+def get_path(name, scheme=get_default_scheme(), vars=None, expand=True):
     """Return a path corresponding to the scheme.
 
     ``scheme`` is the install scheme name.
@@ -543,20 +604,24 @@
         except AttributeError:
             # sys.abiflags may not be defined on all platforms.
             _CONFIG_VARS['abiflags'] = ''
+        try:
+            _CONFIG_VARS['py_version_nodot_plat'] = sys.winver.replace('.', '')
+        except AttributeError:
+            _CONFIG_VARS['py_version_nodot_plat'] = ''
 
         if os.name == 'nt':
             _init_non_posix(_CONFIG_VARS)
-            _CONFIG_VARS['TZPATH'] = ''
         if os.name == 'posix':
             _init_posix(_CONFIG_VARS)
         # For backward compatibility, see issue19555
         SO = _CONFIG_VARS.get('EXT_SUFFIX')
         if SO is not None:
             _CONFIG_VARS['SO'] = SO
-        # Setting 'userbase' is done below the call to the
-        # init function to enable using 'get_config_var' in
-        # the init-function.
-        _CONFIG_VARS['userbase'] = _getuserbase()
+        if _HAS_USER_BASE:
+            # Setting 'userbase' is done below the call to the
+            # init function to enable using 'get_config_var' in
+            # the init-function.
+            _CONFIG_VARS['userbase'] = _getuserbase()
 
         # Always convert srcdir to an absolute path
         srcdir = _CONFIG_VARS.get('srcdir', _PROJECT_BASE)
@@ -653,16 +718,16 @@
         # At least on Linux/Intel, 'machine' is the processor --
         # i386, etc.
         # XXX what about Alpha, SPARC, etc?
-        return  "%s-%s" % (osname, machine)
+        return  f"{osname}-{machine}"
     elif osname[:5] == "sunos":
         if release[0] >= "5":           # SunOS 5 == Solaris 2
             osname = "solaris"
-            release = "%d.%s" % (int(release[0]) - 3, release[2:])
+            release = f"{int(release[0]) - 3}.{release[2:]}"
             # We can't use "platform.architecture()[0]" because a
             # bootstrap problem. We use a dict to get an error
             # if some suspicious happens.
             bitness = {2147483647:"32bit", 9223372036854775807:"64bit"}
-            machine += ".%s" % bitness[sys.maxsize]
+            machine += f".{bitness[sys.maxsize]}"
         # fall through to standard osname-release-machine representation
     elif osname[:3] == "aix":
         from _aix_support import aix_platform
@@ -680,18 +745,44 @@
                                             get_config_vars(),
                                             osname, release, machine)
 
-    return "%s-%s-%s" % (osname, release, machine)
+    return f"{osname}-{release}-{machine}"
 
 
 def get_python_version():
     return _PY_VERSION_SHORT
 
 
+def expand_makefile_vars(s, vars):
+    """Expand Makefile-style variables -- "${foo}" or "$(foo)" -- in
+    'string' according to 'vars' (a dictionary mapping variable names to
+    values).  Variables not present in 'vars' are silently expanded to the
+    empty string.  The variable values in 'vars' should not contain further
+    variable expansions; if 'vars' is the output of 'parse_makefile()',
+    you're fine.  Returns a variable-expanded version of 's'.
+    """
+    import re
+
+    # This algorithm does multiple expansion, so if vars['foo'] contains
+    # "${bar}", it will expand ${foo} to ${bar}, and then expand
+    # ${bar}... and so forth.  This is fine as long as 'vars' comes from
+    # 'parse_makefile()', which takes care of such expansions eagerly,
+    # according to make's variable expansion semantics.
+
+    while True:
+        m = re.search(_findvar1_rx, s) or re.search(_findvar2_rx, s)
+        if m:
+            (beg, end) = m.span()
+            s = s[0:beg] + vars.get(m.group(1)) + s[end:]
+        else:
+            break
+    return s
+
+
 def _print_dict(title, data):
     for index, (key, value) in enumerate(sorted(data.items())):
         if index == 0:
-            print('%s: ' % (title))
-        print('\t%s = "%s"' % (key, value))
+            print(f'{title}: ')
+        print(f'\t{key} = "{value}"')
 
 
 def _main():
@@ -699,9 +790,9 @@
     if '--generate-posix-vars' in sys.argv:
         _generate_posix_vars()
         return
-    print('Platform: "%s"' % get_platform())
-    print('Python version: "%s"' % get_python_version())
-    print('Current installation scheme: "%s"' % _get_default_scheme())
+    print(f'Platform: "{get_platform()}"')
+    print(f'Python version: "{get_python_version()}"')
+    print(f'Current installation scheme: "{get_default_scheme()}"')
     print()
     _print_dict('Paths', get_paths())
     print()
diff --git a/Lib/tarfile.py b/Lib/tarfile.py
index 1d15612..6ada9a0 100755
--- a/Lib/tarfile.py
+++ b/Lib/tarfile.py
@@ -200,6 +200,7 @@
     # base-256 representation. This allows values up to (256**(digits-1))-1.
     # A 0o200 byte indicates a positive number, a 0o377 byte a negative
     # number.
+    original_n = n
     n = int(n)
     if 0 <= n < 8 ** (digits - 1):
         s = bytes("%0*o" % (digits - 1, n), "ascii") + NUL
@@ -363,7 +364,7 @@
                 try:
                     import zlib
                 except ImportError:
-                    raise CompressionError("zlib module is not available")
+                    raise CompressionError("zlib module is not available") from None
                 self.zlib = zlib
                 self.crc = zlib.crc32(b"")
                 if mode == "r":
@@ -376,7 +377,7 @@
                 try:
                     import bz2
                 except ImportError:
-                    raise CompressionError("bz2 module is not available")
+                    raise CompressionError("bz2 module is not available") from None
                 if mode == "r":
                     self.dbuf = b""
                     self.cmp = bz2.BZ2Decompressor()
@@ -388,7 +389,7 @@
                 try:
                     import lzma
                 except ImportError:
-                    raise CompressionError("lzma module is not available")
+                    raise CompressionError("lzma module is not available") from None
                 if mode == "r":
                     self.dbuf = b""
                     self.cmp = lzma.LZMADecompressor()
@@ -541,8 +542,8 @@
                     break
             try:
                 buf = self.cmp.decompress(buf)
-            except self.exception:
-                raise ReadError("invalid compressed data")
+            except self.exception as e:
+                raise ReadError("invalid compressed data") from e
             t.append(buf)
             c += len(buf)
         t = b"".join(t)
@@ -887,15 +888,24 @@
         # Test number fields for values that exceed the field limit or values
         # that like to be stored as float.
         for name, digits in (("uid", 8), ("gid", 8), ("size", 12), ("mtime", 12)):
-            if name in pax_headers:
-                # The pax header has priority. Avoid overflow.
-                info[name] = 0
-                continue
+            needs_pax = False
 
             val = info[name]
-            if not 0 <= val < 8 ** (digits - 1) or isinstance(val, float):
-                pax_headers[name] = str(val)
+            val_is_float = isinstance(val, float)
+            val_int = round(val) if val_is_float else val
+            if not 0 <= val_int < 8 ** (digits - 1):
+                # Avoid overflow.
                 info[name] = 0
+                needs_pax = True
+            elif val_is_float:
+                # Put rounded value in ustar header, and full
+                # precision value in pax header.
+                info[name] = val_int
+                needs_pax = True
+
+            # The existing pax header has priority.
+            if needs_pax and name not in pax_headers:
+                pax_headers[name] = str(val)
 
         # Create a pax extended header if necessary.
         if pax_headers:
@@ -1164,8 +1174,8 @@
         # Fetch the next header and process it.
         try:
             next = self.fromtarfile(tarfile)
-        except HeaderError:
-            raise SubsequentHeaderError("missing or bad subsequent header")
+        except HeaderError as e:
+            raise SubsequentHeaderError(str(e)) from None
 
         # Patch the TarInfo object from the next header with
         # the longname information.
@@ -1277,8 +1287,8 @@
         # Fetch the next header.
         try:
             next = self.fromtarfile(tarfile)
-        except HeaderError:
-            raise SubsequentHeaderError("missing or bad subsequent header")
+        except HeaderError as e:
+            raise SubsequentHeaderError(str(e)) from None
 
         # Process GNU sparse information.
         if "GNU.sparse.map" in pax_headers:
@@ -1533,7 +1543,7 @@
                         self.fileobj.seek(self.offset)
                         break
                     except HeaderError as e:
-                        raise ReadError(str(e))
+                        raise ReadError(str(e)) from None
 
             if self.mode in ("a", "w", "x"):
                 self._loaded = True
@@ -1603,17 +1613,20 @@
             # Find out which *open() is appropriate for opening the file.
             def not_compressed(comptype):
                 return cls.OPEN_METH[comptype] == 'taropen'
+            error_msgs = []
             for comptype in sorted(cls.OPEN_METH, key=not_compressed):
                 func = getattr(cls, cls.OPEN_METH[comptype])
                 if fileobj is not None:
                     saved_pos = fileobj.tell()
                 try:
                     return func(name, "r", fileobj, **kwargs)
-                except (ReadError, CompressionError):
+                except (ReadError, CompressionError) as e:
+                    error_msgs.append(f'- method {comptype}: {e!r}')
                     if fileobj is not None:
                         fileobj.seek(saved_pos)
                     continue
-            raise ReadError("file could not be opened successfully")
+            error_msgs_summary = '\n'.join(error_msgs)
+            raise ReadError(f"file could not be opened successfully:\n{error_msgs_summary}")
 
         elif ":" in mode:
             filemode, comptype = mode.split(":", 1)
@@ -1669,21 +1682,21 @@
         try:
             from gzip import GzipFile
         except ImportError:
-            raise CompressionError("gzip module is not available")
+            raise CompressionError("gzip module is not available") from None
 
         try:
             fileobj = GzipFile(name, mode + "b", compresslevel, fileobj)
-        except OSError:
+        except OSError as e:
             if fileobj is not None and mode == 'r':
-                raise ReadError("not a gzip file")
+                raise ReadError("not a gzip file") from e
             raise
 
         try:
             t = cls.taropen(name, mode, fileobj, **kwargs)
-        except OSError:
+        except OSError as e:
             fileobj.close()
             if mode == 'r':
-                raise ReadError("not a gzip file")
+                raise ReadError("not a gzip file") from e
             raise
         except:
             fileobj.close()
@@ -1702,16 +1715,16 @@
         try:
             from bz2 import BZ2File
         except ImportError:
-            raise CompressionError("bz2 module is not available")
+            raise CompressionError("bz2 module is not available") from None
 
         fileobj = BZ2File(fileobj or name, mode, compresslevel=compresslevel)
 
         try:
             t = cls.taropen(name, mode, fileobj, **kwargs)
-        except (OSError, EOFError):
+        except (OSError, EOFError) as e:
             fileobj.close()
             if mode == 'r':
-                raise ReadError("not a bzip2 file")
+                raise ReadError("not a bzip2 file") from e
             raise
         except:
             fileobj.close()
@@ -1730,16 +1743,16 @@
         try:
             from lzma import LZMAFile, LZMAError
         except ImportError:
-            raise CompressionError("lzma module is not available")
+            raise CompressionError("lzma module is not available") from None
 
         fileobj = LZMAFile(fileobj or name, mode, preset=preset)
 
         try:
             t = cls.taropen(name, mode, fileobj, **kwargs)
-        except (LZMAError, EOFError):
+        except (LZMAError, EOFError) as e:
             fileobj.close()
             if mode == 'r':
-                raise ReadError("not an lzma file")
+                raise ReadError("not an lzma file") from e
             raise
         except:
             fileobj.close()
@@ -1785,7 +1798,7 @@
            than once in the archive, its last occurrence is assumed to be the
            most up-to-date version.
         """
-        tarinfo = self._getmember(name)
+        tarinfo = self._getmember(name.rstrip('/'))
         if tarinfo is None:
             raise KeyError("filename %r not found" % name)
         return tarinfo
@@ -2253,7 +2266,7 @@
                 self._extract_member(self._find_link_target(tarinfo),
                                      targetpath)
             except KeyError:
-                raise ExtractError("unable to resolve link inside archive")
+                raise ExtractError("unable to resolve link inside archive") from None
 
     def chown(self, tarinfo, targetpath, numeric_owner):
         """Set owner of targetpath according to tarinfo. If numeric_owner
@@ -2281,16 +2294,16 @@
                     os.lchown(targetpath, u, g)
                 else:
                     os.chown(targetpath, u, g)
-            except OSError:
-                raise ExtractError("could not change owner")
+            except OSError as e:
+                raise ExtractError("could not change owner") from e
 
     def chmod(self, tarinfo, targetpath):
         """Set file permissions of targetpath according to tarinfo.
         """
         try:
             os.chmod(targetpath, tarinfo.mode)
-        except OSError:
-            raise ExtractError("could not change mode")
+        except OSError as e:
+            raise ExtractError("could not change mode") from e
 
     def utime(self, tarinfo, targetpath):
         """Set modification time of targetpath according to tarinfo.
@@ -2299,8 +2312,8 @@
             return
         try:
             os.utime(targetpath, (tarinfo.mtime, tarinfo.mtime))
-        except OSError:
-            raise ExtractError("could not change modification time")
+        except OSError as e:
+            raise ExtractError("could not change modification time") from e
 
     #--------------------------------------------------------------------------
     def next(self):
@@ -2336,15 +2349,24 @@
                     self.offset += BLOCKSIZE
                     continue
                 elif self.offset == 0:
-                    raise ReadError(str(e))
+                    raise ReadError(str(e)) from None
             except EmptyHeaderError:
                 if self.offset == 0:
-                    raise ReadError("empty file")
+                    raise ReadError("empty file") from None
             except TruncatedHeaderError as e:
                 if self.offset == 0:
-                    raise ReadError(str(e))
+                    raise ReadError(str(e)) from None
             except SubsequentHeaderError as e:
-                raise ReadError(str(e))
+                raise ReadError(str(e)) from None
+            except Exception as e:
+                try:
+                    import zlib
+                    if isinstance(e, zlib.error):
+                        raise ReadError(f'zlib error: {e}') from None
+                    else:
+                        raise e
+                except ImportError:
+                    raise e
             break
 
         if tarinfo is not None:
diff --git a/Lib/tempfile.py b/Lib/tempfile.py
index 770f72c..7b68212 100644
--- a/Lib/tempfile.py
+++ b/Lib/tempfile.py
@@ -88,6 +88,10 @@
     for arg in args:
         if arg is None:
             continue
+
+        if isinstance(arg, _os.PathLike):
+            arg = _os.fspath(arg)
+
         if isinstance(arg, bytes):
             if return_type is str:
                 raise TypeError("Can't mix bytes and non-bytes in "
@@ -99,7 +103,11 @@
                                 "path components.")
             return_type = str
     if return_type is None:
-        return str  # tempfile APIs return a str by default.
+        if tempdir is None or isinstance(tempdir, str):
+            return str  # tempfile APIs return a str by default.
+        else:
+            # we could check for bytes but it'll fail later on anyway
+            return bytes
     return return_type
 
 
@@ -143,10 +151,7 @@
         return self
 
     def __next__(self):
-        c = self.characters
-        choose = self.rng.choice
-        letters = [choose(c) for dummy in range(8)]
-        return ''.join(letters)
+        return ''.join(self.rng.choices(self.characters, k=8))
 
 def _candidate_tempdir_list():
     """Generate a list of candidate temporary directories which
@@ -268,17 +273,17 @@
 # User visible interfaces.
 
 def gettempprefix():
-    """The default prefix for temporary directories."""
-    return template
+    """The default prefix for temporary directories as string."""
+    return _os.fsdecode(template)
 
 def gettempprefixb():
     """The default prefix for temporary directories as bytes."""
-    return _os.fsencode(gettempprefix())
+    return _os.fsencode(template)
 
 tempdir = None
 
-def gettempdir():
-    """Accessor for tempfile.tempdir."""
+def _gettempdir():
+    """Private accessor for tempfile.tempdir."""
     global tempdir
     if tempdir is None:
         _once_lock.acquire()
@@ -289,9 +294,13 @@
             _once_lock.release()
     return tempdir
 
+def gettempdir():
+    """Returns tempfile.tempdir as str."""
+    return _os.fsdecode(_gettempdir())
+
 def gettempdirb():
-    """A bytes version of tempfile.gettempdir()."""
-    return _os.fsencode(gettempdir())
+    """Returns tempfile.tempdir as bytes."""
+    return _os.fsencode(_gettempdir())
 
 def mkstemp(suffix=None, prefix=None, dir=None, text=False):
     """User-callable function to create and return a unique temporary
@@ -538,6 +547,9 @@
     if _os.name == 'nt' and delete:
         flags |= _os.O_TEMPORARY
 
+    if "b" not in mode:
+        encoding = _io.text_encoding(encoding)
+
     (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags, output_type)
     try:
         file = _io.open(fd, mode, buffering=buffering,
@@ -578,6 +590,9 @@
         """
         global _O_TMPFILE_WORKS
 
+        if "b" not in mode:
+            encoding = _io.text_encoding(encoding)
+
         prefix, suffix, dir, output_type = _sanitize_params(prefix, suffix, dir)
 
         flags = _bin_openflags
@@ -633,6 +648,7 @@
         if 'b' in mode:
             self._file = _io.BytesIO()
         else:
+            encoding = _io.text_encoding(encoding)
             self._file = _io.TextIOWrapper(_io.BytesIO(),
                             encoding=encoding, errors=errors,
                             newline=newline)
@@ -763,7 +779,7 @@
         return rv
 
 
-class TemporaryDirectory(object):
+class TemporaryDirectory:
     """Create and return a temporary directory.  This has the same
     behavior as mkdtemp but can be used as a context manager.  For
     example:
@@ -775,14 +791,17 @@
     in it are removed.
     """
 
-    def __init__(self, suffix=None, prefix=None, dir=None):
+    def __init__(self, suffix=None, prefix=None, dir=None,
+                 ignore_cleanup_errors=False):
         self.name = mkdtemp(suffix, prefix, dir)
+        self._ignore_cleanup_errors = ignore_cleanup_errors
         self._finalizer = _weakref.finalize(
             self, self._cleanup, self.name,
-            warn_message="Implicitly cleaning up {!r}".format(self))
+            warn_message="Implicitly cleaning up {!r}".format(self),
+            ignore_errors=self._ignore_cleanup_errors)
 
     @classmethod
-    def _rmtree(cls, name):
+    def _rmtree(cls, name, ignore_errors=False):
         def onerror(func, path, exc_info):
             if issubclass(exc_info[0], PermissionError):
                 def resetperms(path):
@@ -801,19 +820,20 @@
                         _os.unlink(path)
                     # PermissionError is raised on FreeBSD for directories
                     except (IsADirectoryError, PermissionError):
-                        cls._rmtree(path)
+                        cls._rmtree(path, ignore_errors=ignore_errors)
                 except FileNotFoundError:
                     pass
             elif issubclass(exc_info[0], FileNotFoundError):
                 pass
             else:
-                raise
+                if not ignore_errors:
+                    raise
 
         _shutil.rmtree(name, onerror=onerror)
 
     @classmethod
-    def _cleanup(cls, name, warn_message):
-        cls._rmtree(name)
+    def _cleanup(cls, name, warn_message, ignore_errors=False):
+        cls._rmtree(name, ignore_errors=ignore_errors)
         _warnings.warn(warn_message, ResourceWarning)
 
     def __repr__(self):
@@ -826,7 +846,7 @@
         self.cleanup()
 
     def cleanup(self):
-        if self._finalizer.detach():
-            self._rmtree(self.name)
+        if self._finalizer.detach() or _os.path.exists(self.name):
+            self._rmtree(self.name, ignore_errors=self._ignore_cleanup_errors)
 
     __class_getitem__ = classmethod(_types.GenericAlias)
diff --git a/Lib/test/_test_atexit.py b/Lib/test/_test_atexit.py
new file mode 100644
index 0000000..55d2808
--- /dev/null
+++ b/Lib/test/_test_atexit.py
@@ -0,0 +1,136 @@
+"""
+Tests run by test_atexit in a subprocess since it clears atexit callbacks.
+"""
+import atexit
+import sys
+import unittest
+from test import support
+
+
+class GeneralTest(unittest.TestCase):
+    def setUp(self):
+        atexit._clear()
+
+    def tearDown(self):
+        atexit._clear()
+
+    def assert_raises_unraisable(self, exc_type, func, *args):
+        with support.catch_unraisable_exception() as cm:
+            atexit.register(func, *args)
+            atexit._run_exitfuncs()
+
+            self.assertEqual(cm.unraisable.object, func)
+            self.assertEqual(cm.unraisable.exc_type, exc_type)
+            self.assertEqual(type(cm.unraisable.exc_value), exc_type)
+
+    def test_order(self):
+        # Check that callbacks are called in reverse order with the expected
+        # positional and keyword arguments.
+        calls = []
+
+        def func1(*args, **kwargs):
+            calls.append(('func1', args, kwargs))
+
+        def func2(*args, **kwargs):
+            calls.append(('func2', args, kwargs))
+
+        # be sure args are handled properly
+        atexit.register(func1, 1, 2)
+        atexit.register(func2)
+        atexit.register(func2, 3, key="value")
+        atexit._run_exitfuncs()
+
+        self.assertEqual(calls,
+                         [('func2', (3,), {'key': 'value'}),
+                          ('func2', (), {}),
+                          ('func1', (1, 2), {})])
+
+    def test_badargs(self):
+        def func():
+            pass
+
+        # func() has no parameter, but it's called with 2 parameters
+        self.assert_raises_unraisable(TypeError, func, 1 ,2)
+
+    def test_raise(self):
+        def raise_type_error():
+            raise TypeError
+
+        self.assert_raises_unraisable(TypeError, raise_type_error)
+
+    def test_raise_unnormalized(self):
+        # bpo-10756: Make sure that an unnormalized exception is handled
+        # properly.
+        def div_zero():
+            1 / 0
+
+        self.assert_raises_unraisable(ZeroDivisionError, div_zero)
+
+    def test_exit(self):
+        self.assert_raises_unraisable(SystemExit, sys.exit)
+
+    def test_stress(self):
+        a = [0]
+        def inc():
+            a[0] += 1
+
+        for i in range(128):
+            atexit.register(inc)
+        atexit._run_exitfuncs()
+
+        self.assertEqual(a[0], 128)
+
+    def test_clear(self):
+        a = [0]
+        def inc():
+            a[0] += 1
+
+        atexit.register(inc)
+        atexit._clear()
+        atexit._run_exitfuncs()
+
+        self.assertEqual(a[0], 0)
+
+    def test_unregister(self):
+        a = [0]
+        def inc():
+            a[0] += 1
+        def dec():
+            a[0] -= 1
+
+        for i in range(4):
+            atexit.register(inc)
+        atexit.register(dec)
+        atexit.unregister(inc)
+        atexit._run_exitfuncs()
+
+        self.assertEqual(a[0], -1)
+
+    def test_bound_methods(self):
+        l = []
+        atexit.register(l.append, 5)
+        atexit._run_exitfuncs()
+        self.assertEqual(l, [5])
+
+        atexit.unregister(l.append)
+        atexit._run_exitfuncs()
+        self.assertEqual(l, [5])
+
+    def test_atexit_with_unregistered_function(self):
+        # See bpo-46025 for more info
+        def func():
+            atexit.unregister(func)
+            1/0
+        atexit.register(func)
+        try:
+            with support.catch_unraisable_exception() as cm:
+                atexit._run_exitfuncs()
+                self.assertEqual(cm.unraisable.object, func)
+                self.assertEqual(cm.unraisable.exc_type, ZeroDivisionError)
+                self.assertEqual(type(cm.unraisable.exc_value), ZeroDivisionError)
+        finally:
+            atexit.unregister(func)
+
+
+if __name__ == "__main__":
+    unittest.main()
diff --git a/Lib/test/eintrdata/eintr_tester.py b/Lib/test/_test_eintr.py
similarity index 97%
rename from Lib/test/eintrdata/eintr_tester.py
rename to Lib/test/_test_eintr.py
index 606f31b..e43b59d 100644
--- a/Lib/test/eintrdata/eintr_tester.py
+++ b/Lib/test/_test_eintr.py
@@ -22,6 +22,7 @@
 import unittest
 
 from test import support
+from test.support import os_helper
 from test.support import socket_helper
 
 @contextlib.contextmanager
@@ -314,16 +315,16 @@
     @support.requires_freebsd_version(10, 3)
     @unittest.skipUnless(hasattr(os, 'mkfifo'), 'needs mkfifo()')
     def _test_open(self, do_open_close_reader, do_open_close_writer):
-        filename = support.TESTFN
+        filename = os_helper.TESTFN
 
         # Use a fifo: until the child opens it for reading, the parent will
         # block when trying to open it for writing.
-        support.unlink(filename)
+        os_helper.unlink(filename)
         try:
             os.mkfifo(filename)
         except PermissionError as e:
             self.skipTest('os.mkfifo(): %s' % e)
-        self.addCleanup(support.unlink, filename)
+        self.addCleanup(os_helper.unlink, filename)
 
         code = '\n'.join((
             'import os, time',
@@ -486,16 +487,16 @@
 
 class FNTLEINTRTest(EINTRBaseTest):
     def _lock(self, lock_func, lock_name):
-        self.addCleanup(support.unlink, support.TESTFN)
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
         code = '\n'.join((
             "import fcntl, time",
-            "with open('%s', 'wb') as f:" % support.TESTFN,
+            "with open('%s', 'wb') as f:" % os_helper.TESTFN,
             "   fcntl.%s(f, fcntl.LOCK_EX)" % lock_name,
             "   time.sleep(%s)" % self.sleep_time))
         start_time = time.monotonic()
         proc = self.subprocess(code)
         with kill_on_error(proc):
-            with open(support.TESTFN, 'wb') as f:
+            with open(os_helper.TESTFN, 'wb') as f:
                 while True:  # synchronize the subprocess
                     dt = time.monotonic() - start_time
                     if dt > 60.0:
diff --git a/Lib/test/_test_embed_set_config.py b/Lib/test/_test_embed_set_config.py
new file mode 100644
index 0000000..82c5d82
--- /dev/null
+++ b/Lib/test/_test_embed_set_config.py
@@ -0,0 +1,261 @@
+# bpo-42260: Test _PyInterpreterState_GetConfigCopy()
+# and _PyInterpreterState_SetConfig().
+#
+# Test run in a subinterpreter since set_config(get_config())
+# does reset sys attributes to their state of the Python startup
+# (before the site module is run).
+
+import _testinternalcapi
+import os
+import sys
+import unittest
+
+
+MS_WINDOWS = (os.name == 'nt')
+MAX_HASH_SEED = 4294967295
+
+class SetConfigTests(unittest.TestCase):
+    def setUp(self):
+        self.old_config = _testinternalcapi.get_config()
+        self.sys_copy = dict(sys.__dict__)
+
+    def tearDown(self):
+        _testinternalcapi.set_config(self.old_config)
+        sys.__dict__.clear()
+        sys.__dict__.update(self.sys_copy)
+
+    def set_config(self, **kwargs):
+        _testinternalcapi.set_config(self.old_config | kwargs)
+
+    def check(self, **kwargs):
+        self.set_config(**kwargs)
+        for key, value in kwargs.items():
+            self.assertEqual(getattr(sys, key), value,
+                             (key, value))
+
+    def test_set_invalid(self):
+        invalid_uint = -1
+        NULL = None
+        invalid_wstr = NULL
+        # PyWideStringList strings must be non-NULL
+        invalid_wstrlist = ["abc", NULL, "def"]
+
+        type_tests = []
+        value_tests = [
+            # enum
+            ('_config_init', 0),
+            ('_config_init', 4),
+            # unsigned long
+            ("hash_seed", -1),
+            ("hash_seed", MAX_HASH_SEED + 1),
+        ]
+
+        # int (unsigned)
+        options = [
+            '_config_init',
+            'isolated',
+            'use_environment',
+            'dev_mode',
+            'install_signal_handlers',
+            'use_hash_seed',
+            'faulthandler',
+            'tracemalloc',
+            'import_time',
+            'show_ref_count',
+            'dump_refs',
+            'malloc_stats',
+            'parse_argv',
+            'site_import',
+            'bytes_warning',
+            'inspect',
+            'interactive',
+            'optimization_level',
+            'parser_debug',
+            'write_bytecode',
+            'verbose',
+            'quiet',
+            'user_site_directory',
+            'configure_c_stdio',
+            'buffered_stdio',
+            'pathconfig_warnings',
+            'module_search_paths_set',
+            'skip_source_first_line',
+            '_install_importlib',
+            '_init_main',
+            '_isolated_interpreter',
+        ]
+        if MS_WINDOWS:
+            options.append('legacy_windows_stdio')
+        for key in options:
+            value_tests.append((key, invalid_uint))
+            type_tests.append((key, "abc"))
+            type_tests.append((key, 2.0))
+
+        # wchar_t*
+        for key in (
+            'filesystem_encoding',
+            'filesystem_errors',
+            'stdio_encoding',
+            'stdio_errors',
+            'check_hash_pycs_mode',
+            'program_name',
+            'platlibdir',
+            # optional wstr:
+            # 'pythonpath_env'
+            # 'home'
+            # 'pycache_prefix'
+            # 'run_command'
+            # 'run_module'
+            # 'run_filename'
+            # 'executable'
+            # 'prefix'
+            # 'exec_prefix'
+            # 'base_executable'
+            # 'base_prefix'
+            # 'base_exec_prefix'
+        ):
+            value_tests.append((key, invalid_wstr))
+            type_tests.append((key, b'bytes'))
+            type_tests.append((key, 123))
+
+        # PyWideStringList
+        for key in (
+            'orig_argv',
+            'argv',
+            'xoptions',
+            'warnoptions',
+            'module_search_paths',
+        ):
+            value_tests.append((key, invalid_wstrlist))
+            type_tests.append((key, 123))
+            type_tests.append((key, "abc"))
+            type_tests.append((key, [123]))
+            type_tests.append((key, [b"bytes"]))
+
+
+        if MS_WINDOWS:
+            value_tests.append(('legacy_windows_stdio', invalid_uint))
+
+        for exc_type, tests in (
+            (ValueError, value_tests),
+            (TypeError, type_tests),
+        ):
+            for key, value in tests:
+                config = self.old_config | {key: value}
+                with self.subTest(key=key, value=value, exc_type=exc_type):
+                    with self.assertRaises(exc_type):
+                        _testinternalcapi.set_config(config)
+
+    def test_flags(self):
+        for sys_attr, key, value in (
+            ("debug", "parser_debug", 1),
+            ("inspect", "inspect", 2),
+            ("interactive", "interactive", 3),
+            ("optimize", "optimization_level", 4),
+            ("verbose", "verbose", 1),
+            ("bytes_warning", "bytes_warning", 10),
+            ("quiet", "quiet", 11),
+            ("isolated", "isolated", 12),
+        ):
+            with self.subTest(sys=sys_attr, key=key, value=value):
+                self.set_config(**{key: value, 'parse_argv': 0})
+                self.assertEqual(getattr(sys.flags, sys_attr), value)
+
+        self.set_config(write_bytecode=0)
+        self.assertEqual(sys.flags.dont_write_bytecode, True)
+        self.assertEqual(sys.dont_write_bytecode, True)
+
+        self.set_config(write_bytecode=1)
+        self.assertEqual(sys.flags.dont_write_bytecode, False)
+        self.assertEqual(sys.dont_write_bytecode, False)
+
+        self.set_config(user_site_directory=0, isolated=0)
+        self.assertEqual(sys.flags.no_user_site, 1)
+        self.set_config(user_site_directory=1, isolated=0)
+        self.assertEqual(sys.flags.no_user_site, 0)
+
+        self.set_config(site_import=0)
+        self.assertEqual(sys.flags.no_site, 1)
+        self.set_config(site_import=1)
+        self.assertEqual(sys.flags.no_site, 0)
+
+        self.set_config(dev_mode=0)
+        self.assertEqual(sys.flags.dev_mode, False)
+        self.set_config(dev_mode=1)
+        self.assertEqual(sys.flags.dev_mode, True)
+
+        self.set_config(use_environment=0, isolated=0)
+        self.assertEqual(sys.flags.ignore_environment, 1)
+        self.set_config(use_environment=1, isolated=0)
+        self.assertEqual(sys.flags.ignore_environment, 0)
+
+        self.set_config(use_hash_seed=1, hash_seed=0)
+        self.assertEqual(sys.flags.hash_randomization, 0)
+        self.set_config(use_hash_seed=0, hash_seed=0)
+        self.assertEqual(sys.flags.hash_randomization, 1)
+        self.set_config(use_hash_seed=1, hash_seed=123)
+        self.assertEqual(sys.flags.hash_randomization, 1)
+
+    def test_options(self):
+        self.check(warnoptions=[])
+        self.check(warnoptions=["default", "ignore"])
+
+        self.set_config(xoptions=[])
+        self.assertEqual(sys._xoptions, {})
+        self.set_config(xoptions=["dev", "tracemalloc=5"])
+        self.assertEqual(sys._xoptions, {"dev": True, "tracemalloc": "5"})
+
+    def test_pathconfig(self):
+        self.check(
+            executable='executable',
+            prefix="prefix",
+            base_prefix="base_prefix",
+            exec_prefix="exec_prefix",
+            base_exec_prefix="base_exec_prefix",
+            platlibdir="platlibdir")
+
+        self.set_config(base_executable="base_executable")
+        self.assertEqual(sys._base_executable, "base_executable")
+
+        # When base_xxx is NULL, value is copied from xxxx
+        self.set_config(
+            executable='executable',
+            prefix="prefix",
+            exec_prefix="exec_prefix",
+            base_executable=None,
+            base_prefix=None,
+            base_exec_prefix=None)
+        self.assertEqual(sys._base_executable, "executable")
+        self.assertEqual(sys.base_prefix, "prefix")
+        self.assertEqual(sys.base_exec_prefix, "exec_prefix")
+
+    def test_path(self):
+        self.set_config(module_search_paths_set=1,
+                        module_search_paths=['a', 'b', 'c'])
+        self.assertEqual(sys.path, ['a', 'b', 'c'])
+
+        # Leave sys.path unchanged if module_search_paths_set=0
+        self.set_config(module_search_paths_set=0,
+                        module_search_paths=['new_path'])
+        self.assertEqual(sys.path, ['a', 'b', 'c'])
+
+    def test_argv(self):
+        self.set_config(parse_argv=0,
+                        argv=['python_program', 'args'],
+                        orig_argv=['orig', 'orig_args'])
+        self.assertEqual(sys.argv, ['python_program', 'args'])
+        self.assertEqual(sys.orig_argv, ['orig', 'orig_args'])
+
+        self.set_config(parse_argv=0,
+                        argv=[],
+                        orig_argv=[])
+        self.assertEqual(sys.argv, [''])
+        self.assertEqual(sys.orig_argv, [])
+
+    def test_pycache_prefix(self):
+        self.check(pycache_prefix=None)
+        self.check(pycache_prefix="pycache_prefix")
+
+
+if __name__ == "__main__":
+    unittest.main()
diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py
index e47905c..04657c0 100644
--- a/Lib/test/_test_multiprocessing.py
+++ b/Lib/test/_test_multiprocessing.py
@@ -27,11 +27,15 @@
 import test.support.script_helper
 from test import support
 from test.support import hashlib_helper
+from test.support import import_helper
+from test.support import os_helper
 from test.support import socket_helper
+from test.support import threading_helper
+from test.support import warnings_helper
 
 
 # Skip tests if _multiprocessing wasn't built.
-_multiprocessing = test.support.import_module('_multiprocessing')
+_multiprocessing = import_helper.import_module('_multiprocessing')
 # Skip tests if sem_open implementation is broken.
 support.skip_if_broken_multiprocessing_synchronize()
 import threading
@@ -69,6 +73,12 @@
     msvcrt = None
 
 
+if support.check_sanitizer(address=True):
+    # bpo-45200: Skip multiprocessing tests if Python is built with ASAN to
+    # work around a libasan race condition: dead lock in pthread_create().
+    raise unittest.SkipTest("libasan has a pthread_create() dead lock")
+
+
 def latin(s):
     return s.encode('latin')
 
@@ -82,7 +92,7 @@
 def join_process(process):
     # Since multiprocessing.Process has the same API than threading.Thread
     # (join() and is_alive(), the support function can be reused
-    support.join_thread(process)
+    threading_helper.join_thread(process)
 
 
 if os.name == "posix":
@@ -607,13 +617,14 @@
         del c
         p.start()
         p.join()
+        gc.collect()  # For PyPy or other GCs.
         self.assertIs(wr(), None)
         self.assertEqual(q.get(), 5)
         close_queue(q)
 
     @classmethod
     def _test_child_fd_inflation(self, evt, q):
-        q.put(test.support.fd_count())
+        q.put(os_helper.fd_count())
         evt.wait()
 
     def test_child_fd_inflation(self):
@@ -817,12 +828,12 @@
         if self.TYPE == "threads":
             self.skipTest('test not appropriate for {}'.format(self.TYPE))
 
-        testfn = test.support.TESTFN
-        self.addCleanup(test.support.unlink, testfn)
+        testfn = os_helper.TESTFN
+        self.addCleanup(os_helper.unlink, testfn)
         proc = self.Process(target=self._test_stderr_flush, args=(testfn,))
         proc.start()
         proc.join()
-        with open(testfn, 'r') as f:
+        with open(testfn, encoding="utf-8") as f:
             err = f.read()
             # The whole traceback was printed
             self.assertIn("ZeroDivisionError", err)
@@ -832,14 +843,14 @@
     @classmethod
     def _test_stderr_flush(cls, testfn):
         fd = os.open(testfn, os.O_WRONLY | os.O_CREAT | os.O_EXCL)
-        sys.stderr = open(fd, 'w', closefd=False)
+        sys.stderr = open(fd, 'w', encoding="utf-8", closefd=False)
         1/0 # MARKER
 
 
     @classmethod
     def _test_sys_exit(cls, reason, testfn):
         fd = os.open(testfn, os.O_WRONLY | os.O_CREAT | os.O_EXCL)
-        sys.stderr = open(fd, 'w', closefd=False)
+        sys.stderr = open(fd, 'w', encoding="utf-8", closefd=False)
         sys.exit(reason)
 
     def test_sys_exit(self):
@@ -847,8 +858,8 @@
         if self.TYPE == 'threads':
             self.skipTest('test not appropriate for {}'.format(self.TYPE))
 
-        testfn = test.support.TESTFN
-        self.addCleanup(test.support.unlink, testfn)
+        testfn = os_helper.TESTFN
+        self.addCleanup(os_helper.unlink, testfn)
 
         for reason in (
             [1, 2, 3],
@@ -860,7 +871,7 @@
             join_process(p)
             self.assertEqual(p.exitcode, 1)
 
-            with open(testfn, 'r') as f:
+            with open(testfn, encoding="utf-8") as f:
                 content = f.read()
             self.assertEqual(content.rstrip(), str(reason))
 
@@ -1112,9 +1123,9 @@
         close_queue(queue)
 
     def test_no_import_lock_contention(self):
-        with test.support.temp_cwd():
+        with os_helper.temp_cwd():
             module_name = 'imported_by_an_imported_module'
-            with open(module_name + '.py', 'w') as f:
+            with open(module_name + '.py', 'w', encoding="utf-8") as f:
                 f.write("""if 1:
                     import multiprocessing
 
@@ -1125,7 +1136,7 @@
                     del q
                 """)
 
-            with test.support.DirsOnSysPath(os.getcwd()):
+            with import_helper.DirsOnSysPath(os.getcwd()):
                 try:
                     __import__(module_name)
                 except pyqueue.Empty:
@@ -2282,6 +2293,16 @@
         self.assertIsInstance(outer[0], list)  # Not a ListProxy
         self.assertEqual(outer[-1][-1]['feed'], 3)
 
+    def test_nested_queue(self):
+        a = self.list() # Test queue inside list
+        a.append(self.Queue())
+        a[0].put(123)
+        self.assertEqual(a[0].get(), 123)
+        b = self.dict() # Test queue inside dict
+        b[0] = self.Queue()
+        b[0].put(456)
+        self.assertEqual(b[0].get(), 456)
+
     def test_namespace(self):
         n = self.Namespace()
         n.name = 'Bob'
@@ -2653,6 +2674,7 @@
         self.pool.map(identity, objs)
 
         del objs
+        gc.collect()  # For PyPy or other GCs.
         time.sleep(DELTA)  # let threaded cleanup code run
         self.assertEqual(set(wr() for wr in refs), {None})
         # With a process pool, copies of the objects are returned, check
@@ -2686,8 +2708,8 @@
         # force state to RUN to emit ResourceWarning in __del__()
         pool._state = multiprocessing.pool.RUN
 
-        with support.check_warnings(('unclosed running multiprocessing pool',
-                                     ResourceWarning)):
+        with warnings_helper.check_warnings(
+                ('unclosed running multiprocessing pool', ResourceWarning)):
             pool = None
             support.gc_collect()
 
@@ -3197,14 +3219,14 @@
         p = self.Process(target=self._writefd, args=(child_conn, b"foo"))
         p.daemon = True
         p.start()
-        self.addCleanup(test.support.unlink, test.support.TESTFN)
-        with open(test.support.TESTFN, "wb") as f:
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
+        with open(os_helper.TESTFN, "wb") as f:
             fd = f.fileno()
             if msvcrt:
                 fd = msvcrt.get_osfhandle(fd)
             reduction.send_handle(conn, fd, p.pid)
         p.join()
-        with open(test.support.TESTFN, "rb") as f:
+        with open(os_helper.TESTFN, "rb") as f:
             self.assertEqual(f.read(), b"foo")
 
     @unittest.skipUnless(HAS_REDUCTION, "test needs multiprocessing.reduction")
@@ -3223,8 +3245,8 @@
         p = self.Process(target=self._writefd, args=(child_conn, b"bar", True))
         p.daemon = True
         p.start()
-        self.addCleanup(test.support.unlink, test.support.TESTFN)
-        with open(test.support.TESTFN, "wb") as f:
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
+        with open(os_helper.TESTFN, "wb") as f:
             fd = f.fileno()
             for newfd in range(256, MAXFD):
                 if not self._is_fd_assigned(newfd):
@@ -3237,7 +3259,7 @@
             finally:
                 os.close(newfd)
         p.join()
-        with open(test.support.TESTFN, "rb") as f:
+        with open(os_helper.TESTFN, "rb") as f:
             self.assertEqual(f.read(), b"bar")
 
     @classmethod
@@ -3757,26 +3779,37 @@
         local_sms.buf[:len(binary_data)] = binary_data
         local_sms.close()
 
+    def _new_shm_name(self, prefix):
+        # Add a PID to the name of a POSIX shared memory object to allow
+        # running multiprocessing tests (test_multiprocessing_fork,
+        # test_multiprocessing_spawn, etc) in parallel.
+        return prefix + str(os.getpid())
+
     def test_shared_memory_basics(self):
-        sms = shared_memory.SharedMemory('test01_tsmb', create=True, size=512)
+        name_tsmb = self._new_shm_name('test01_tsmb')
+        sms = shared_memory.SharedMemory(name_tsmb, create=True, size=512)
         self.addCleanup(sms.unlink)
 
         # Verify attributes are readable.
-        self.assertEqual(sms.name, 'test01_tsmb')
+        self.assertEqual(sms.name, name_tsmb)
         self.assertGreaterEqual(sms.size, 512)
         self.assertGreaterEqual(len(sms.buf), sms.size)
 
+        # Verify __repr__
+        self.assertIn(sms.name, str(sms))
+        self.assertIn(str(sms.size), str(sms))
+
         # Modify contents of shared memory segment through memoryview.
         sms.buf[0] = 42
         self.assertEqual(sms.buf[0], 42)
 
         # Attach to existing shared memory segment.
-        also_sms = shared_memory.SharedMemory('test01_tsmb')
+        also_sms = shared_memory.SharedMemory(name_tsmb)
         self.assertEqual(also_sms.buf[0], 42)
         also_sms.close()
 
         # Attach to existing shared memory segment but specify a new size.
-        same_sms = shared_memory.SharedMemory('test01_tsmb', size=20*sms.size)
+        same_sms = shared_memory.SharedMemory(name_tsmb, size=20*sms.size)
         self.assertLess(same_sms.size, 20*sms.size)  # Size was ignored.
         same_sms.close()
 
@@ -3794,7 +3827,7 @@
             'multiprocessing.shared_memory._make_filename') as mock_make_filename:
 
             NAME_PREFIX = shared_memory._SHM_NAME_PREFIX
-            names = ['test01_fn', 'test02_fn']
+            names = [self._new_shm_name('test01_fn'), self._new_shm_name('test02_fn')]
             # Prepend NAME_PREFIX which can be '/psm_' or 'wnsm_', necessary
             # because some POSIX compliant systems require name to start with /
             names = [NAME_PREFIX + name for name in names]
@@ -3816,17 +3849,17 @@
             # manages unlinking on its own and unlink() does nothing).
             # True release of shared memory segment does not necessarily
             # happen until process exits, depending on the OS platform.
+            name_dblunlink = self._new_shm_name('test01_dblunlink')
+            sms_uno = shared_memory.SharedMemory(
+                name_dblunlink,
+                create=True,
+                size=5000
+            )
             with self.assertRaises(FileNotFoundError):
-                sms_uno = shared_memory.SharedMemory(
-                    'test01_dblunlink',
-                    create=True,
-                    size=5000
-                )
-
                 try:
                     self.assertGreaterEqual(sms_uno.size, 5000)
 
-                    sms_duo = shared_memory.SharedMemory('test01_dblunlink')
+                    sms_duo = shared_memory.SharedMemory(name_dblunlink)
                     sms_duo.unlink()  # First shm_unlink() call.
                     sms_duo.close()
                     sms_uno.close()
@@ -3838,7 +3871,7 @@
             # Attempting to create a new shared memory segment with a
             # name that is already in use triggers an exception.
             there_can_only_be_one_sms = shared_memory.SharedMemory(
-                'test01_tsmb',
+                name_tsmb,
                 create=True,
                 size=512
             )
@@ -3852,7 +3885,7 @@
             # case of MacOS/darwin, requesting a smaller size is disallowed.
             class OptionalAttachSharedMemory(shared_memory.SharedMemory):
                 _flags = os.O_CREAT | os.O_RDWR
-            ok_if_exists_sms = OptionalAttachSharedMemory('test01_tsmb')
+            ok_if_exists_sms = OptionalAttachSharedMemory(name_tsmb)
             self.assertEqual(ok_if_exists_sms.size, sms.size)
             ok_if_exists_sms.close()
 
@@ -3864,6 +3897,29 @@
 
         sms.close()
 
+    def test_shared_memory_recreate(self):
+        # Test if shared memory segment is created properly,
+        # when _make_filename returns an existing shared memory segment name
+        with unittest.mock.patch(
+            'multiprocessing.shared_memory._make_filename') as mock_make_filename:
+
+            NAME_PREFIX = shared_memory._SHM_NAME_PREFIX
+            names = ['test01_fn', 'test02_fn']
+            # Prepend NAME_PREFIX which can be '/psm_' or 'wnsm_', necessary
+            # because some POSIX compliant systems require name to start with /
+            names = [NAME_PREFIX + name for name in names]
+
+            mock_make_filename.side_effect = names
+            shm1 = shared_memory.SharedMemory(create=True, size=1)
+            self.addCleanup(shm1.unlink)
+            self.assertEqual(shm1._name, names[0])
+
+            mock_make_filename.side_effect = names
+            shm2 = shared_memory.SharedMemory(create=True, size=1)
+            self.addCleanup(shm2.unlink)
+            self.assertEqual(shm2._name, names[1])
+
+    def test_invalid_shared_memory_cration(self):
         # Test creating a shared memory segment with negative size
         with self.assertRaises(ValueError):
             sms_invalid = shared_memory.SharedMemory(create=True, size=-1)
@@ -3876,6 +3932,47 @@
         with self.assertRaises(ValueError):
             sms_invalid = shared_memory.SharedMemory(create=True)
 
+    def test_shared_memory_pickle_unpickle(self):
+        for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+            with self.subTest(proto=proto):
+                sms = shared_memory.SharedMemory(create=True, size=512)
+                self.addCleanup(sms.unlink)
+                sms.buf[0:6] = b'pickle'
+
+                # Test pickling
+                pickled_sms = pickle.dumps(sms, protocol=proto)
+
+                # Test unpickling
+                sms2 = pickle.loads(pickled_sms)
+                self.assertIsInstance(sms2, shared_memory.SharedMemory)
+                self.assertEqual(sms.name, sms2.name)
+                self.assertEqual(bytes(sms.buf[0:6]), b'pickle')
+                self.assertEqual(bytes(sms2.buf[0:6]), b'pickle')
+
+                # Test that unpickled version is still the same SharedMemory
+                sms.buf[0:6] = b'newval'
+                self.assertEqual(bytes(sms.buf[0:6]), b'newval')
+                self.assertEqual(bytes(sms2.buf[0:6]), b'newval')
+
+                sms2.buf[0:6] = b'oldval'
+                self.assertEqual(bytes(sms.buf[0:6]), b'oldval')
+                self.assertEqual(bytes(sms2.buf[0:6]), b'oldval')
+
+    def test_shared_memory_pickle_unpickle_dead_object(self):
+        for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+            with self.subTest(proto=proto):
+                sms = shared_memory.SharedMemory(create=True, size=512)
+                sms.buf[0:6] = b'pickle'
+                pickled_sms = pickle.dumps(sms, protocol=proto)
+
+                # Now, we are going to kill the original object.
+                # So, unpickled one won't be able to attach to it.
+                sms.close()
+                sms.unlink()
+
+                with self.assertRaises(FileNotFoundError):
+                    pickle.loads(pickled_sms)
+
     def test_shared_memory_across_processes(self):
         # bpo-40135: don't define shared memory block's name in case of
         # the failure when we run multiprocessing tests in parallel.
@@ -3985,6 +4082,23 @@
         )
         self.addCleanup(sl.shm.unlink)
 
+        # Verify __repr__
+        self.assertIn(sl.shm.name, str(sl))
+        self.assertIn(str(list(sl)), str(sl))
+
+        # Index Out of Range (get)
+        with self.assertRaises(IndexError):
+            sl[7]
+
+        # Index Out of Range (set)
+        with self.assertRaises(IndexError):
+            sl[7] = 2
+
+        # Assign value without format change (str -> str)
+        current_format = sl._get_packing_format(0)
+        sl[0] = 'howdy'
+        self.assertEqual(current_format, sl._get_packing_format(0))
+
         # Verify attributes are readable.
         self.assertEqual(sl.format, '8s8sdqxxxxxx?xxxxxxxx?q')
 
@@ -4040,10 +4154,11 @@
             self.assertEqual(sl.count(b'adios'), 0)
 
         # Exercise creating a duplicate.
-        sl_copy = shared_memory.ShareableList(sl, name='test03_duplicate')
+        name_duplicate = self._new_shm_name('test03_duplicate')
+        sl_copy = shared_memory.ShareableList(sl, name=name_duplicate)
         try:
             self.assertNotEqual(sl.shm.name, sl_copy.shm.name)
-            self.assertEqual('test03_duplicate', sl_copy.shm.name)
+            self.assertEqual(name_duplicate, sl_copy.shm.name)
             self.assertEqual(list(sl), list(sl_copy))
             self.assertEqual(sl.format, sl_copy.format)
             sl_copy[-1] = 77
@@ -4075,29 +4190,45 @@
             empty_sl.shm.unlink()
 
     def test_shared_memory_ShareableList_pickling(self):
-        sl = shared_memory.ShareableList(range(10))
-        self.addCleanup(sl.shm.unlink)
+        for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+            with self.subTest(proto=proto):
+                sl = shared_memory.ShareableList(range(10))
+                self.addCleanup(sl.shm.unlink)
 
-        serialized_sl = pickle.dumps(sl)
-        deserialized_sl = pickle.loads(serialized_sl)
-        self.assertTrue(
-            isinstance(deserialized_sl, shared_memory.ShareableList)
-        )
-        self.assertTrue(deserialized_sl[-1], 9)
-        self.assertFalse(sl is deserialized_sl)
-        deserialized_sl[4] = "changed"
-        self.assertEqual(sl[4], "changed")
+                serialized_sl = pickle.dumps(sl, protocol=proto)
+                deserialized_sl = pickle.loads(serialized_sl)
+                self.assertIsInstance(
+                    deserialized_sl, shared_memory.ShareableList)
+                self.assertEqual(deserialized_sl[-1], 9)
+                self.assertIsNot(sl, deserialized_sl)
 
-        # Verify data is not being put into the pickled representation.
-        name = 'a' * len(sl.shm.name)
-        larger_sl = shared_memory.ShareableList(range(400))
-        self.addCleanup(larger_sl.shm.unlink)
-        serialized_larger_sl = pickle.dumps(larger_sl)
-        self.assertTrue(len(serialized_sl) == len(serialized_larger_sl))
-        larger_sl.shm.close()
+                deserialized_sl[4] = "changed"
+                self.assertEqual(sl[4], "changed")
+                sl[3] = "newvalue"
+                self.assertEqual(deserialized_sl[3], "newvalue")
 
-        deserialized_sl.shm.close()
-        sl.shm.close()
+                larger_sl = shared_memory.ShareableList(range(400))
+                self.addCleanup(larger_sl.shm.unlink)
+                serialized_larger_sl = pickle.dumps(larger_sl, protocol=proto)
+                self.assertEqual(len(serialized_sl), len(serialized_larger_sl))
+                larger_sl.shm.close()
+
+                deserialized_sl.shm.close()
+                sl.shm.close()
+
+    def test_shared_memory_ShareableList_pickling_dead_object(self):
+        for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+            with self.subTest(proto=proto):
+                sl = shared_memory.ShareableList(range(10))
+                serialized_sl = pickle.dumps(sl, protocol=proto)
+
+                # Now, we are going to kill the original object.
+                # So, unpickled one won't be able to attach to it.
+                sl.shm.close()
+                sl.shm.unlink()
+
+                with self.assertRaises(FileNotFoundError):
+                    pickle.loads(serialized_sl)
 
     def test_shared_memory_cleaned_after_process_termination(self):
         cmd = '''if 1:
@@ -4134,6 +4265,13 @@
                                      " a process was abruptly terminated.")
 
             if os.name == 'posix':
+                # Without this line it was raising warnings like:
+                #   UserWarning: resource_tracker:
+                #   There appear to be 1 leaked shared_memory
+                #   objects to clean up at shutdown
+                # See: https://bugs.python.org/issue45209
+                resource_tracker.unregister(f"/{name}", "shared_memory")
+
                 # A warning was emitted by the subprocess' own
                 # resource_tracker (on Windows, shared memory segments
                 # are released automatically by the OS).
@@ -4143,7 +4281,7 @@
                     "shared_memory objects to clean up at shutdown", err)
 
 #
-#
+# Test to verify that `Finalize` works.
 #
 
 class _TestFinalize(BaseTestCase):
@@ -4155,6 +4293,7 @@
         util._finalizer_registry.clear()
 
     def tearDown(self):
+        gc.collect()  # For PyPy or other GCs.
         self.assertFalse(util._finalizer_registry)
         util._finalizer_registry.update(self.registry_backup)
 
@@ -4166,12 +4305,14 @@
         a = Foo()
         util.Finalize(a, conn.send, args=('a',))
         del a           # triggers callback for a
+        gc.collect()  # For PyPy or other GCs.
 
         b = Foo()
         close_b = util.Finalize(b, conn.send, args=('b',))
         close_b()       # triggers callback for b
         close_b()       # does nothing because callback has already been called
         del b           # does nothing because callback has already been called
+        gc.collect()  # For PyPy or other GCs.
 
         c = Foo()
         util.Finalize(c, conn.send, args=('c',))
@@ -4251,7 +4392,7 @@
             gc.set_threshold(5, 5, 5)
             threads = [threading.Thread(target=run_finalizers),
                        threading.Thread(target=make_finalizers)]
-            with test.support.start_threads(threads):
+            with threading_helper.start_threads(threads):
                 time.sleep(4.0)  # Wait a bit to trigger race condition
                 finish = True
             if exc is not None:
@@ -5560,9 +5701,11 @@
 
 class MiscTestCase(unittest.TestCase):
     def test__all__(self):
-        # Just make sure names in blacklist are excluded
+        # Just make sure names in not_exported are excluded
         support.check__all__(self, multiprocessing, extra=multiprocessing.__all__,
-                             blacklist=['SUBDEBUG', 'SUBWARNING'])
+                             not_exported=['SUBDEBUG', 'SUBWARNING'])
+
+
 #
 # Mixins
 #
diff --git a/Lib/test/_typed_dict_helper.py b/Lib/test/_typed_dict_helper.py
new file mode 100644
index 0000000..d333db1
--- /dev/null
+++ b/Lib/test/_typed_dict_helper.py
@@ -0,0 +1,18 @@
+"""Used to test `get_type_hints()` on a cross-module inherited `TypedDict` class
+
+This script uses future annotations to postpone a type that won't be available
+on the module inheriting from to `Foo`. The subclass in the other module should
+look something like this:
+
+    class Bar(_typed_dict_helper.Foo, total=False):
+        b: int
+"""
+
+from __future__ import annotations
+
+from typing import Optional, TypedDict
+
+OptionalIntType = Optional[int]
+
+class Foo(TypedDict):
+    a: OptionalIntType
diff --git a/Lib/test/allsans.pem b/Lib/test/allsans.pem
index 6eebde7..e400e17 100644
--- a/Lib/test/allsans.pem
+++ b/Lib/test/allsans.pem
@@ -1,81 +1,170 @@
 -----BEGIN PRIVATE KEY-----
-MIIG/QIBADANBgkqhkiG9w0BAQEFAASCBucwggbjAgEAAoIBgQCg/pM6dP7BTFNc
-qe6wIJIBB7HjwL42bp0vjcCVl4Z3MRWFswYpfxy+o+8+PguMp4K6zndA5fwNkK/H
-3HmtanncUfPqnV0usN0NHQGh/f9xRoNmB1q2L7kTuO99o0KLQgvonRT2snf8rq9n
-tPRzhHUGYhog7zzNxetYV309PHpPr19BcKepDtM5RMk2aBnoN5vtItorjXiDosFm
-6o5wQHrcupcVydszba6P75BEbc1XIWvq2Fv8muaw4pCe81QYINyLqgcPNO/nF3Os
-5EI4HKjCNRSCOhOcWqYctXLXN9lBdMBBvQc3zDmYzh1eIZewzZXPVEQT33xPkhxz
-HNmhcIctpWX4LTRF6FulkcbeuZDga3gkZYJf/M6IpU1WYXr6q8sNxbgmRRX/NuHo
-V9oDwBzLG07rKUiqRHfjGqoCRmmVeVYpryvXUNjHGH0nlVzz/8lTUxAnJorO3Fdc
-I+6zKLUPICdAlvz51AH6yopgPFhrdgA0pVzPO6L5G8SRQCxKhAUCAwEAAQKCAYAa
-2jtOTcNMFGH3G7TfFZ+kolbuaPCQ/aQkEV2k1dAswzgWw8RsWXI+7fLyi8C7Zhks
-9VD4tyNyU8at7D0zSoYm1Fh9sl+fcQp9rG/gSBA6IYu7EdD0gEM7YeY4K2nm9k4s
-Lz8W4q+WqsBA6PK47cfjF6vKAH1AyRk28+jEtPiln9egf5zHWtyqOanh9D0V+Wh9
-hgmjqAYI1rWxZ7/4Qxj7Bfg7Px7blhi+kzOZ5kKQnNd2JT46hM+jgzah/G3zVE+R
-FFW6ksmJgZ+dCuSbE7HEJmKms1CWq/1Cll0A3uy4JTDZOrK4KcZQ9UjjWJWvlXQm
-uNXSSAp1k287DLVUm9c22SDeXpb9PyKmzyvJvVmMqqBx6QzHZ/L7WPzpUWAoLcU+
-ZHT7vggDymkIO+fcRbUzv8s5R7RnLbcBga51/5OCUvAWDoJXNw0qwYZOIbfTnQgs
-8xbCmbMzllyYM/dK3GxQAwfn8Hzk+DbS/NObMjHLCWLfYeUvutXJSNly6Ny+ZcEC
-gcEAzo5Y1UFOfBX4MZLIZ69LfgaXj9URobMwqlEwKil8pWQMa951ga3moLt91nOe
-SAQz3meFTBX/VAb2ZHLeIf3FoNkiIx48PkxsR/hhLHpvl26zEg3yXs3tv0IFBx2R
-EEnLNpQaAQFR9S1yDOaG2rsb17ZDKyp9isDpAENHAmEnT/XJn+Dc0SOH1EVDjUeM
-JqToAF/fjIx/RF4oUJCAgOPBMlRy5ywLQk8uDi6ft0NCzzCi0eCuk1Ty3KzWFGwx
-7cYRAoHBAMeIPCzHG3No4JGUFunslVwo5TuC7maO6qYKbq0OyvwWfL4b7gjrMBR9
-d5WyZlp/Vf40O463dg8x8qPNOFWp49f3hxTvvfnt2/m3+CQuDOLfqBbHufZApP1J
-U9MubUNnDFHHeJ9l0tg2nhiLw24GHeMARZhA/BimMQPY0OpZPpLVxAUArM2EB7hI
-glQpYCtdXhqwl1pl0u3TZ08y3BXYNg9BycdpGRMWSsAwsApJRgNuI/dfDKu0uMYF
-/pUhXVPatQKBwGgLpAun3dT7bA3sli5ESo6s22OEPGFrVbQ1OUHDrBnTj742TJKJ
-+oY0a2q+ypgUJdx94NM2sWquJybqBaKxpf8j4OI3tLjc3h5SqwAwnE13YZRSmifP
-K1cP9mBjMFM4GLjhWUfwVkxeG/kLlhpP7fJ2yNbRjHN8QOH1AavdLGRGts1mA1UF
-xMHUMfbUd3Bv2L13ja/KhcD2fPA4GcLS9tpXV5nCwdkg8V4LdkBmDR04rotx1f44
-6Czokt2usmfHQQKBwFkufxbUd2SB/72Rnxw27hse/DY5My0Lu70y9HzNG9TIiEDA
-YwgBdp/x5D04W58fQuQ3nFcRkOcBwB2OYBuJr5ibvfiRnyvSMHvQykwBeSj+Jjbo
-VinGgvfiimDdY2C48jyrFzLHZBHXd5oo/dRzT3Bicri2cvbhcQ7zHY1hDiK7AL3r
-q1DALmMjpXzQcXdwZ9suCrgQwtIhpw8zAEOTO7ZeBT3nr5lkYUy9djFixrRJyjGK
-fjNQtzVrAHrPStNr8QKBwQDCC0zhsCnTv4sAJmW7LL6Ayd5rbWhUZ6px1xY0yHMA
-hehj+xbaiC6cfVr5Rg0ncvaa8AExu4kXpVsupTyNwvC4NgzLHtfBw6WUdOnd1awE
-kSrDtDReBt2wByAcQwttQsrJ1/Pt6zcNJJI4Z9s8G4NTcQWJwUhU20N55JQKR//l
-OQJqhq9NVhte/ctDjVwOHs/OhDNvxsAWxdjnf/O2up0os+M2bFkmHuaVW0vQbqTQ
-mw7Vbzk2Ff5oT6E3kbC8Ur4=
+MIIG/gIBADANBgkqhkiG9w0BAQEFAASCBugwggbkAgEAAoIBgQDBGvj+Uy/VUyTR
+mmIA1UEENThh0+pWODcvvUlkeIo+XTJ3FhF4/RVjImDHjozl28Xf2TzKnvQJa1KC
+pqa7fr8cL9QMwk4pH+S4ulxOu02Bl3Yafx2oJVUML37vciJg+zkzPx1k3tXFjXkr
+LGjZwOoufBC3AmPuq2xHFBzHrvp5/DIRH2slQFM9fpVZzN77gYyzxba0wCfCPpCf
+eJFRyYKW8c7MXrwnM82YtE7Rlnf227EkCdMNaSeZLUIxeVpcnScqZl0SIbR3YEiV
+0LPFkx0wJFm8qUEFU/h+0jamgy/ON+11nqmMlp3BjNi/JTVsa7N7A3dvdHC7VVlr
+WnUgU6MoSniyL6ijpucyHtZzK2mJy0sHR8PadHKow0O423/5N8GKTSOvaGMXTjAe
+OGs+9/P1ZYo3IjjQPz/NV3QlhK8zRqxF3cW0ekHHkT+/jZjCvSKm6mdbMQunKE1W
++dokAc815pb48Mzf1eWKd/7UyUf7CXussyAaJ3clpaK1sbbn9m0CAwEAAQKCAYAe
+BaCCgdJk+xk1USg9cuo5ykBqzTSYlQLXdDlN2oO7sGehJhgvVEGX+QdM3ze+oM2B
+wNd3tQDB2iKo11oCunDh4/m2xhq6wA+iPK8POoWRSUf+VJb6xlsTmurENV1s8IHz
+GrPqM87OePFGqg/fEuQVuAotObzppVMfNdxHm0er4W6zRMw2rWqDnAOCQ5zDQ1/p
+ryp5rYpA49M+R9NoAMlByHRbR7s+6Qnk3NuIMDmUcpF2xeQ/KIMUiHnLEU/gKDpi
+bsk+VtyjlibR4zhh9/cJrLTApAIA+4eC176EJvKXCh5UIjd92JC7741HTNQXJpvG
+9PXbzhyUCmncr04U+46snGHdwD+lG4LS7oBGACTLMtpcMrlgAm6XCg4T8gRVE/9n
+FvCkqPHBR+vnhOxm+0x0yUY/DstJby6IPYPsfGK/s2n//j/vJrAZE1Pxlm9EPU13
+MRLcHstwjAc/NXRPnUN1DfcQvPLx6Tt6rqw3Wm1KO75kM+HZ56BX9/Bi1TgkiI0C
+gcEA5JTlXssJ3W8Cz6w1ZtGsThHQBDbvHF2D5AdqO7y6/eqzCQgBQl9BTfXOzsvP
+I1gf2CLEFBtGK09UjAuJQg90/NlKur7i7xt7HpAzEfGsDAL4P5BW5JnMNrzpJjjL
+0uUDsPJlA75Wi29N2SFiaIslY0sZ6nckInat5GRe4O1AMSHoJ5suY9yTZTU3XB4O
+A+XyddutI1GsFZgl8/8LyyNMcyNjxG3T5sr7IKf5/nIv6oMDjC2zLVZa8QS/MEnL
+Kaa7AoHBANhEsxfcjw2MaPkrsqAsOP0dDf7g2rdz6wKT5BzZu9e+/E76NmvVDpns
+e+kCjql9Os3/wonOMINvn1bTCQGTgk8+dw1fMyqg+zQCvH4ImcE6LSqhzblVHsIB
+zZ7rW86trri1U9+olNHG4nwkus0i4LV8eeORns+j8DgXr6/eOvjX3ZW5TyU7/Qgm
+SiSdBapzJbom3xJrbo9KQsrN5PVCOwuwrgY0o+2BeKyKhnt4uGv0bR+ii06EOJUA
+WvjD7gLI9wKBwGVRXk3jH29IOm3EvjLh80bzfEmx89CV3tUfOEZcRGIyOsNhCfXa
+dP7SWqWtDxZyhELwPgtPf43I7wfYQTHH2ioNQqN94ubrPmpwrkJg5cq5MkIyf2F6
+jlsg5xMrD6VeH4G6H25GWuQZJN9+fbkrHBpj+ovD3X9tLWzT1H5Miyx8BAQyM6DN
+74Nn0C8Dn2C49vyor5i9JdK4ivIY9ahH8CYE5L73k3p0NFXoPtY61ORUyCjFROtu
+oIa+fOQxgVzn6wKBwQC3DD7BnY7/Gq7m51ODOqrpoaPs7Qhyagyp298hhDD3hNEt
+T56sWmLHaV/fcqipUDNrlGRmGzz4ooutA2YGDYIn7Gj7ym4WULcN6Jr92e25nLIJ
++XWUvjUQZFJThkXogxz1fZSGI7wCamHcTYJGipTDR54rPV+7w7hY4cN0CZbEdIE6
+buRMUZ/zO+VZZAYdpORz0N7SSlgDtAkgenCmHe64EEzbN8bgCcvHzl/RNfZyeSm7
+supSBJuXkfttvvg/JzUCgcEAlx0Pep9qCLvpk0WqzijBVHc3zK4wYxjhN2MBkF42
+SLWfogKpiPfIqxX6YF94roIA0VlW6Pj50v+sbPwq8nwsgFNhml80A4ODKr3O3Y3M
+fXDBJW5W5ZRb/vhIKRjXyCSckSRfj7N8HUYjCLkxQansNWimrldmSet0H2mYJN0Y
+JpBXdqpa76zoHzWpKFwD0fSVzvnMelPHSDCNOdIEHmR8e1x2F1/ufR/9/dBzPULY
+HMj0OhQHoi8kJyMIj3+bQkbC
 -----END PRIVATE KEY-----
+Certificate:
+    Data:
+        Version: 3 (0x2)
+        Serial Number:
+            cb:2d:80:99:5a:69:52:5f
+        Signature Algorithm: sha256WithRSAEncryption
+        Issuer: C=XY, O=Python Software Foundation CA, CN=our-ca-server
+        Validity
+            Not Before: Aug 29 14:23:16 2018 GMT
+            Not After : Oct 28 14:23:16 2037 GMT
+        Subject: C=XY, L=Castle Anthrax, O=Python Software Foundation, CN=allsans
+        Subject Public Key Info:
+            Public Key Algorithm: rsaEncryption
+                RSA Public-Key: (3072 bit)
+                Modulus:
+                    00:c1:1a:f8:fe:53:2f:d5:53:24:d1:9a:62:00:d5:
+                    41:04:35:38:61:d3:ea:56:38:37:2f:bd:49:64:78:
+                    8a:3e:5d:32:77:16:11:78:fd:15:63:22:60:c7:8e:
+                    8c:e5:db:c5:df:d9:3c:ca:9e:f4:09:6b:52:82:a6:
+                    a6:bb:7e:bf:1c:2f:d4:0c:c2:4e:29:1f:e4:b8:ba:
+                    5c:4e:bb:4d:81:97:76:1a:7f:1d:a8:25:55:0c:2f:
+                    7e:ef:72:22:60:fb:39:33:3f:1d:64:de:d5:c5:8d:
+                    79:2b:2c:68:d9:c0:ea:2e:7c:10:b7:02:63:ee:ab:
+                    6c:47:14:1c:c7:ae:fa:79:fc:32:11:1f:6b:25:40:
+                    53:3d:7e:95:59:cc:de:fb:81:8c:b3:c5:b6:b4:c0:
+                    27:c2:3e:90:9f:78:91:51:c9:82:96:f1:ce:cc:5e:
+                    bc:27:33:cd:98:b4:4e:d1:96:77:f6:db:b1:24:09:
+                    d3:0d:69:27:99:2d:42:31:79:5a:5c:9d:27:2a:66:
+                    5d:12:21:b4:77:60:48:95:d0:b3:c5:93:1d:30:24:
+                    59:bc:a9:41:05:53:f8:7e:d2:36:a6:83:2f:ce:37:
+                    ed:75:9e:a9:8c:96:9d:c1:8c:d8:bf:25:35:6c:6b:
+                    b3:7b:03:77:6f:74:70:bb:55:59:6b:5a:75:20:53:
+                    a3:28:4a:78:b2:2f:a8:a3:a6:e7:32:1e:d6:73:2b:
+                    69:89:cb:4b:07:47:c3:da:74:72:a8:c3:43:b8:db:
+                    7f:f9:37:c1:8a:4d:23:af:68:63:17:4e:30:1e:38:
+                    6b:3e:f7:f3:f5:65:8a:37:22:38:d0:3f:3f:cd:57:
+                    74:25:84:af:33:46:ac:45:dd:c5:b4:7a:41:c7:91:
+                    3f:bf:8d:98:c2:bd:22:a6:ea:67:5b:31:0b:a7:28:
+                    4d:56:f9:da:24:01:cf:35:e6:96:f8:f0:cc:df:d5:
+                    e5:8a:77:fe:d4:c9:47:fb:09:7b:ac:b3:20:1a:27:
+                    77:25:a5:a2:b5:b1:b6:e7:f6:6d
+                Exponent: 65537 (0x10001)
+        X509v3 extensions:
+            X509v3 Subject Alternative Name: 
+                DNS:allsans, othername:<unsupported>, othername:<unsupported>, email:user@example.org, DNS:www.example.org, DirName:/C=XY/L=Castle Anthrax/O=Python Software Foundation/CN=dirname example, URI:https://www.python.org/, IP Address:127.0.0.1, IP Address:0:0:0:0:0:0:0:1, Registered ID:1.2.3.4.5
+            X509v3 Key Usage: critical
+                Digital Signature, Key Encipherment
+            X509v3 Extended Key Usage: 
+                TLS Web Server Authentication, TLS Web Client Authentication
+            X509v3 Basic Constraints: critical
+                CA:FALSE
+            X509v3 Subject Key Identifier: 
+                D4:F1:D8:23:E0:A7:E9:CA:12:45:A0:0D:03:C2:25:A6:E8:65:BC:EE
+            X509v3 Authority Key Identifier: 
+                keyid:B3:8A:A0:A2:BA:71:F1:A8:24:79:D4:A4:5B:25:36:15:1E:49:C8:CD
+                DirName:/C=XY/O=Python Software Foundation CA/CN=our-ca-server
+                serial:CB:2D:80:99:5A:69:52:5B
+
+            Authority Information Access: 
+                CA Issuers - URI:http://testca.pythontest.net/testca/pycacert.cer
+                OCSP - URI:http://testca.pythontest.net/testca/ocsp/
+
+            X509v3 CRL Distribution Points: 
+
+                Full Name:
+                  URI:http://testca.pythontest.net/testca/revocation.crl
+
+    Signature Algorithm: sha256WithRSAEncryption
+         70:77:d8:82:b0:f4:ab:de:84:ce:88:32:63:5e:23:0f:b6:58:
+         a2:b1:65:ff:12:22:0b:88:a6:fa:06:40:9a:e7:63:a7:5d:ae:
+         94:c5:68:3c:4b:e9:95:34:01:75:24:df:9d:6e:9b:e4:ff:3f:
+         61:97:29:7b:ab:34:2c:14:d3:01:d2:eb:fb:84:40:db:12:54:
+         7e:7a:44:bc:08:eb:9f:e2:15:0b:11:4f:25:d2:56:51:95:ad:
+         6d:ad:07:aa:6a:61:f9:39:d5:82:8c:45:31:9f:2a:ff:18:98:
+         49:0c:bb:17:ad:d5:24:d3:d1:c7:c4:10:3e:c4:79:26:58:f4:
+         c5:de:82:16:c4:c3:c4:a7:a3:62:22:41:90:36:0f:bc:4c:fd:
+         6a:18:22:f2:87:e9:07:db:b4:3d:65:00:e4:70:f9:d6:e5:a8:
+         a1:b9:c9:9d:e7:5d:78:aa:98:d5:f8:f4:fd:5c:d9:4c:d0:6d:
+         bf:87:71:d3:5b:ec:f4:bf:46:f9:c8:f8:10:c5:72:af:c3:15:
+         b9:c4:06:67:0b:3f:f6:f4:64:c5:27:74:c1:6b:00:37:da:ea:
+         18:36:77:36:a7:3e:80:2e:5d:54:0f:01:df:ce:9e:97:dd:c9:
+         f2:8b:59:82:c5:65:31:c8:73:20:fd:24:23:25:d8:00:df:90:
+         93:26:76:08:0a:06:a9:0e:d3:d3:4c:6f:ef:a7:fb:de:eb:2a:
+         40:b9:e4:b1:44:0c:37:ca:c6:9e:44:4a:b4:7c:2c:40:52:35:
+         bb:b3:71:28:3d:35:fd:be:c9:4f:54:b3:99:c5:5f:84:38:fb:
+         2b:fb:ea:dd:88:e8:9d:c1:9b:67:87:3d:79:7b:3d:7e:61:1f:
+         70:3c:b7:c8:4c:17:a5:0c:a3:28:c7:ab:48:11:14:f7:98:7a:
+         da:4e:fb:91:76:89:0a:a6:c6:72:e0:96:d9:f1:80:ea:68:90:
+         37:5c:c6:69:c7:d7:bc:c7:d1:ae:5b:a9:12:59:c6:e4:6c:61:
+         a9:8b:ba:51:b3:13
 -----BEGIN CERTIFICATE-----
-MIIHMDCCBZigAwIBAgIJALVVA6v9zJS5MA0GCSqGSIb3DQEBCwUAMF0xCzAJBgNV
-BAYTAlhZMRcwFQYDVQQHDA5DYXN0bGUgQW50aHJheDEjMCEGA1UECgwaUHl0aG9u
-IFNvZnR3YXJlIEZvdW5kYXRpb24xEDAOBgNVBAMMB2FsbHNhbnMwHhcNMTgwODI5
-MTQyMzE3WhcNMjgwODI2MTQyMzE3WjBdMQswCQYDVQQGEwJYWTEXMBUGA1UEBwwO
-Q2FzdGxlIEFudGhyYXgxIzAhBgNVBAoMGlB5dGhvbiBTb2Z0d2FyZSBGb3VuZGF0
-aW9uMRAwDgYDVQQDDAdhbGxzYW5zMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIB
-igKCAYEAoP6TOnT+wUxTXKnusCCSAQex48C+Nm6dL43AlZeGdzEVhbMGKX8cvqPv
-Pj4LjKeCus53QOX8DZCvx9x5rWp53FHz6p1dLrDdDR0Bof3/cUaDZgdati+5E7jv
-faNCi0IL6J0U9rJ3/K6vZ7T0c4R1BmIaIO88zcXrWFd9PTx6T69fQXCnqQ7TOUTJ
-NmgZ6Deb7SLaK414g6LBZuqOcEB63LqXFcnbM22uj++QRG3NVyFr6thb/JrmsOKQ
-nvNUGCDci6oHDzTv5xdzrORCOByowjUUgjoTnFqmHLVy1zfZQXTAQb0HN8w5mM4d
-XiGXsM2Vz1REE998T5IccxzZoXCHLaVl+C00RehbpZHG3rmQ4Gt4JGWCX/zOiKVN
-VmF6+qvLDcW4JkUV/zbh6FfaA8AcyxtO6ylIqkR34xqqAkZplXlWKa8r11DYxxh9
-J5Vc8//JU1MQJyaKztxXXCPusyi1DyAnQJb8+dQB+sqKYDxYa3YANKVczzui+RvE
-kUAsSoQFAgMBAAGjggLxMIIC7TCCATAGA1UdEQSCAScwggEjggdhbGxzYW5zoB4G
-AyoDBKAXDBVzb21lIG90aGVyIGlkZW50aWZpZXKgNQYGKwYBBQICoCswKaAQGw5L
-RVJCRVJPUy5SRUFMTaEVMBOgAwIBAaEMMAobCHVzZXJuYW1lgRB1c2VyQGV4YW1w
-bGUub3Jngg93d3cuZXhhbXBsZS5vcmekZzBlMQswCQYDVQQGEwJYWTEXMBUGA1UE
-BwwOQ2FzdGxlIEFudGhyYXgxIzAhBgNVBAoMGlB5dGhvbiBTb2Z0d2FyZSBGb3Vu
-ZGF0aW9uMRgwFgYDVQQDDA9kaXJuYW1lIGV4YW1wbGWGF2h0dHBzOi8vd3d3LnB5
-dGhvbi5vcmcvhwR/AAABhxAAAAAAAAAAAAAAAAAAAAABiAQqAwQFMA4GA1UdDwEB
-/wQEAwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDAYDVR0TAQH/
-BAIwADAdBgNVHQ4EFgQUoLHAHNTWrHkSCUYkhn5NH0S40CAwgY8GA1UdIwSBhzCB
-hIAUoLHAHNTWrHkSCUYkhn5NH0S40CChYaRfMF0xCzAJBgNVBAYTAlhZMRcwFQYD
-VQQHDA5DYXN0bGUgQW50aHJheDEjMCEGA1UECgwaUHl0aG9uIFNvZnR3YXJlIEZv
-dW5kYXRpb24xEDAOBgNVBAMMB2FsbHNhbnOCCQC1VQOr/cyUuTCBgwYIKwYBBQUH
-AQEEdzB1MDwGCCsGAQUFBzAChjBodHRwOi8vdGVzdGNhLnB5dGhvbnRlc3QubmV0
-L3Rlc3RjYS9weWNhY2VydC5jZXIwNQYIKwYBBQUHMAGGKWh0dHA6Ly90ZXN0Y2Eu
-cHl0aG9udGVzdC5uZXQvdGVzdGNhL29jc3AvMEMGA1UdHwQ8MDowOKA2oDSGMmh0
-dHA6Ly90ZXN0Y2EucHl0aG9udGVzdC5uZXQvdGVzdGNhL3Jldm9jYXRpb24uY3Js
-MA0GCSqGSIb3DQEBCwUAA4IBgQAeKJKycO2DES98gyR2e/GzPYEw87cCS0cEpiiP
-3CEUgzfEbF0X89GDKEey4H3Irvosbvt2hEcf2RNpahLUL/fUv53bDmHNmL8qJg5E
-UJVMOHvOpSOjqoqeRuSyG0GnnAuUwcxdrZY6UzLdslhuq9F8UjgHr6KSMx56G9uK
-LmTy5njMab0in2xL/YRX/0nogK3BHqpUHrfCdEYZkciRxtAa+OPpWn4dcZi+Fpf7
-ZYSgPLNt+djtFDMIAk5Bo+XDaQdW3dhF0w44enrGAOV0xPE+/jOuenNhKBafjuNb
-lkeSr45+QZsi1rd18ny8z3uuaGqIAziFgmllZOH2D8giTn6+5jZcCNZCoGKUkPI9
-l/GMWwxg4HQYYlZcsZzTCem9Rb2XcrasAbmhFapMtR+QAwSed5vKE7ZdtQhj74kB
-7Q0E7Lkgpp6BaObb2As8/f0K/UlSVSvrYk+i3JT9wK/qqkRGxsTFEF7N9t0rKu8y
-4JdQDtZCI552MsFvYW6m+IOYgxg=
+MIIHDTCCBXWgAwIBAgIJAMstgJlaaVJfMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNV
+BAYTAlhZMSYwJAYDVQQKDB1QeXRob24gU29mdHdhcmUgRm91bmRhdGlvbiBDQTEW
+MBQGA1UEAwwNb3VyLWNhLXNlcnZlcjAeFw0xODA4MjkxNDIzMTZaFw0zNzEwMjgx
+NDIzMTZaMF0xCzAJBgNVBAYTAlhZMRcwFQYDVQQHDA5DYXN0bGUgQW50aHJheDEj
+MCEGA1UECgwaUHl0aG9uIFNvZnR3YXJlIEZvdW5kYXRpb24xEDAOBgNVBAMMB2Fs
+bHNhbnMwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDBGvj+Uy/VUyTR
+mmIA1UEENThh0+pWODcvvUlkeIo+XTJ3FhF4/RVjImDHjozl28Xf2TzKnvQJa1KC
+pqa7fr8cL9QMwk4pH+S4ulxOu02Bl3Yafx2oJVUML37vciJg+zkzPx1k3tXFjXkr
+LGjZwOoufBC3AmPuq2xHFBzHrvp5/DIRH2slQFM9fpVZzN77gYyzxba0wCfCPpCf
+eJFRyYKW8c7MXrwnM82YtE7Rlnf227EkCdMNaSeZLUIxeVpcnScqZl0SIbR3YEiV
+0LPFkx0wJFm8qUEFU/h+0jamgy/ON+11nqmMlp3BjNi/JTVsa7N7A3dvdHC7VVlr
+WnUgU6MoSniyL6ijpucyHtZzK2mJy0sHR8PadHKow0O423/5N8GKTSOvaGMXTjAe
+OGs+9/P1ZYo3IjjQPz/NV3QlhK8zRqxF3cW0ekHHkT+/jZjCvSKm6mdbMQunKE1W
++dokAc815pb48Mzf1eWKd/7UyUf7CXussyAaJ3clpaK1sbbn9m0CAwEAAaOCAt4w
+ggLaMIIBMAYDVR0RBIIBJzCCASOCB2FsbHNhbnOgHgYDKgMEoBcMFXNvbWUgb3Ro
+ZXIgaWRlbnRpZmllcqA1BgYrBgEFAgKgKzApoBAbDktFUkJFUk9TLlJFQUxNoRUw
+E6ADAgEBoQwwChsIdXNlcm5hbWWBEHVzZXJAZXhhbXBsZS5vcmeCD3d3dy5leGFt
+cGxlLm9yZ6RnMGUxCzAJBgNVBAYTAlhZMRcwFQYDVQQHDA5DYXN0bGUgQW50aHJh
+eDEjMCEGA1UECgwaUHl0aG9uIFNvZnR3YXJlIEZvdW5kYXRpb24xGDAWBgNVBAMM
+D2Rpcm5hbWUgZXhhbXBsZYYXaHR0cHM6Ly93d3cucHl0aG9uLm9yZy+HBH8AAAGH
+EAAAAAAAAAAAAAAAAAAAAAGIBCoDBAUwDgYDVR0PAQH/BAQDAgWgMB0GA1UdJQQW
+MBQGCCsGAQUFBwMBBggrBgEFBQcDAjAMBgNVHRMBAf8EAjAAMB0GA1UdDgQWBBTU
+8dgj4KfpyhJFoA0DwiWm6GW87jB9BgNVHSMEdjB0gBSziqCiunHxqCR51KRbJTYV
+HknIzaFRpE8wTTELMAkGA1UEBhMCWFkxJjAkBgNVBAoMHVB5dGhvbiBTb2Z0d2Fy
+ZSBGb3VuZGF0aW9uIENBMRYwFAYDVQQDDA1vdXItY2Etc2VydmVyggkAyy2AmVpp
+UlswgYMGCCsGAQUFBwEBBHcwdTA8BggrBgEFBQcwAoYwaHR0cDovL3Rlc3RjYS5w
+eXRob250ZXN0Lm5ldC90ZXN0Y2EvcHljYWNlcnQuY2VyMDUGCCsGAQUFBzABhilo
+dHRwOi8vdGVzdGNhLnB5dGhvbnRlc3QubmV0L3Rlc3RjYS9vY3NwLzBDBgNVHR8E
+PDA6MDigNqA0hjJodHRwOi8vdGVzdGNhLnB5dGhvbnRlc3QubmV0L3Rlc3RjYS9y
+ZXZvY2F0aW9uLmNybDANBgkqhkiG9w0BAQsFAAOCAYEAcHfYgrD0q96EzogyY14j
+D7ZYorFl/xIiC4im+gZAmudjp12ulMVoPEvplTQBdSTfnW6b5P8/YZcpe6s0LBTT
+AdLr+4RA2xJUfnpEvAjrn+IVCxFPJdJWUZWtba0Hqmph+TnVgoxFMZ8q/xiYSQy7
+F63VJNPRx8QQPsR5Jlj0xd6CFsTDxKejYiJBkDYPvEz9ahgi8ofpB9u0PWUA5HD5
+1uWoobnJneddeKqY1fj0/VzZTNBtv4dx01vs9L9G+cj4EMVyr8MVucQGZws/9vRk
+xSd0wWsAN9rqGDZ3Nqc+gC5dVA8B386el93J8otZgsVlMchzIP0kIyXYAN+QkyZ2
+CAoGqQ7T00xv76f73usqQLnksUQMN8rGnkRKtHwsQFI1u7NxKD01/b7JT1SzmcVf
+hDj7K/vq3YjoncGbZ4c9eXs9fmEfcDy3yEwXpQyjKMerSBEU95h62k77kXaJCqbG
+cuCW2fGA6miQN1zGacfXvMfRrlupElnG5GxhqYu6UbMT
 -----END CERTIFICATE-----
diff --git a/Lib/test/ann_module.py b/Lib/test/ann_module.py
index 0567d6d..5081e6b 100644
--- a/Lib/test/ann_module.py
+++ b/Lib/test/ann_module.py
@@ -58,3 +58,5 @@
     def wrapper(*args, **kwargs):
         return func(*args, **kwargs)
     return wrapper
+
+u: int | float
diff --git a/Lib/test/ann_module4.py b/Lib/test/ann_module4.py
new file mode 100644
index 0000000..13e9aee
--- /dev/null
+++ b/Lib/test/ann_module4.py
@@ -0,0 +1,5 @@
+# This ann_module isn't for test_typing,
+# it's for test_module
+
+a:int=3
+b:str=4
diff --git a/Lib/test/ann_module5.py b/Lib/test/ann_module5.py
new file mode 100644
index 0000000..837041e
--- /dev/null
+++ b/Lib/test/ann_module5.py
@@ -0,0 +1,10 @@
+# Used by test_typing to verify that Final wrapped in ForwardRef works.
+
+from __future__ import annotations
+
+from typing import Final
+
+name: Final[str] = "final"
+
+class MyClass:
+    value: Final = 3000
diff --git a/Lib/test/ann_module6.py b/Lib/test/ann_module6.py
new file mode 100644
index 0000000..6791756
--- /dev/null
+++ b/Lib/test/ann_module6.py
@@ -0,0 +1,7 @@
+# Tests that top-level ClassVar is not allowed
+
+from __future__ import annotations
+
+from typing import ClassVar
+
+wrong: ClassVar[int] = 1
diff --git a/Lib/test/ann_module7.py b/Lib/test/ann_module7.py
new file mode 100644
index 0000000..8f890cd
--- /dev/null
+++ b/Lib/test/ann_module7.py
@@ -0,0 +1,11 @@
+# Tests class have ``__text_signature__``
+
+from __future__ import annotations
+
+DEFAULT_BUFFER_SIZE = 8192
+
+class BufferedReader(object):
+    """BufferedReader(raw, buffer_size=DEFAULT_BUFFER_SIZE)\n--\n\n
+    Create a new buffered reader using the given readable raw IO object.
+    """
+    pass
diff --git a/Lib/test/audiotests.py b/Lib/test/audiotests.py
index d3e8e9e..9d6c4cc 100644
--- a/Lib/test/audiotests.py
+++ b/Lib/test/audiotests.py
@@ -1,4 +1,5 @@
-from test.support import findfile, TESTFN, unlink
+from test.support import findfile
+from test.support.os_helper import TESTFN, unlink
 import array
 import io
 import pickle
diff --git a/Lib/test/audit-tests.py b/Lib/test/audit-tests.py
index ee6fc93..ccec9fe 100644
--- a/Lib/test/audit-tests.py
+++ b/Lib/test/audit-tests.py
@@ -6,6 +6,7 @@
 """
 
 import contextlib
+import os
 import sys
 
 
@@ -106,6 +107,32 @@
                 pass
 
 
+def test_marshal():
+    import marshal
+    o = ("a", "b", "c", 1, 2, 3)
+    payload = marshal.dumps(o)
+
+    with TestHook() as hook:
+        assertEqual(o, marshal.loads(marshal.dumps(o)))
+
+        try:
+            with open("test-marshal.bin", "wb") as f:
+                marshal.dump(o, f)
+            with open("test-marshal.bin", "rb") as f:
+                assertEqual(o, marshal.load(f))
+        finally:
+            os.unlink("test-marshal.bin")
+
+    actual = [(a[0], a[1]) for e, a in hook.seen if e == "marshal.dumps"]
+    assertSequenceEqual(actual, [(o, marshal.version)] * 2)
+
+    actual = [a[0] for e, a in hook.seen if e == "marshal.loads"]
+    assertSequenceEqual(actual, [payload])
+
+    actual = [e for e, a in hook.seen if e == "marshal.load"]
+    assertSequenceEqual(actual, ["marshal.load"])
+
+
 def test_pickle():
     import pickle
 
@@ -323,6 +350,64 @@
         sock.close()
 
 
+def test_gc():
+    import gc
+
+    def hook(event, args):
+        if event.startswith("gc."):
+            print(event, *args)
+
+    sys.addaudithook(hook)
+
+    gc.get_objects(generation=1)
+
+    x = object()
+    y = [x]
+
+    gc.get_referrers(x)
+    gc.get_referents(y)
+
+
+def test_http_client():
+    import http.client
+
+    def hook(event, args):
+        if event.startswith("http.client."):
+            print(event, *args[1:])
+
+    sys.addaudithook(hook)
+
+    conn = http.client.HTTPConnection('www.python.org')
+    try:
+        conn.request('GET', '/')
+    except OSError:
+        print('http.client.send', '[cannot send]')
+    finally:
+        conn.close()
+
+
+def test_sqlite3():
+    import sqlite3
+
+    def hook(event, *args):
+        if event.startswith("sqlite3."):
+            print(event, *args)
+
+    sys.addaudithook(hook)
+    cx1 = sqlite3.connect(":memory:")
+    cx2 = sqlite3.Connection(":memory:")
+
+    # Configured without --enable-loadable-sqlite-extensions
+    if hasattr(sqlite3.Connection, "enable_load_extension"):
+        cx1.enable_load_extension(False)
+        try:
+            cx1.load_extension("test")
+        except sqlite3.OperationalError:
+            pass
+        else:
+            raise RuntimeError("Expected sqlite3.load_extension to fail")
+
+
 if __name__ == "__main__":
     from test.support import suppress_msvcrt_asserts
 
diff --git a/Lib/test/capath/b1930218.0 b/Lib/test/capath/b1930218.0
index 730e7fd..941d791 100644
--- a/Lib/test/capath/b1930218.0
+++ b/Lib/test/capath/b1930218.0
@@ -1,26 +1,26 @@
 -----BEGIN CERTIFICATE-----
 MIIEbTCCAtWgAwIBAgIJAMstgJlaaVJbMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNV
 BAYTAlhZMSYwJAYDVQQKDB1QeXRob24gU29mdHdhcmUgRm91bmRhdGlvbiBDQTEW
-MBQGA1UEAwwNb3VyLWNhLXNlcnZlcjAeFw0xODA4MjkxNDIzMTZaFw0yODA4MjYx
+MBQGA1UEAwwNb3VyLWNhLXNlcnZlcjAeFw0xODA4MjkxNDIzMTZaFw0zNzEwMjgx
 NDIzMTZaME0xCzAJBgNVBAYTAlhZMSYwJAYDVQQKDB1QeXRob24gU29mdHdhcmUg
 Rm91bmRhdGlvbiBDQTEWMBQGA1UEAwwNb3VyLWNhLXNlcnZlcjCCAaIwDQYJKoZI
-hvcNAQEBBQADggGPADCCAYoCggGBAJftVUG6NheV23Ec0+FhrFhz48aWzysfuAj1
-nUtLxzD2uAuzUnKgu8lNO47fIo4BV4HJknPMAMbscLA6F0DB3/KMNkzEp4HntiRo
-4qB+NQcvoFv5RUb3HvBGEf7KGjxQ8SapX5winPhB4d9PEpUZL1yQARdufj59z+kJ
-ryX4+EJ3LW1fNvJ4Hn1Kh2hjbAZxG436Jf7U0/WlF7Hv6hfLVMgnmYDLPEXxLFIc
-3R9RRSBQHl6rV3MbQXiW3oSket2PMIU2WHl2oNJhyBuplJljxu74FL+0UlYxl/rr
-rFOelc5MxFpKt8oDJ1s1V84C3OzKafiKWjnLFiAVAyRhbPR6/LZI5VkQXEnQI5/7
-cV466WifNHKAJ7Y/TLHZ22N/Z2hKbhH46MD0WhY5Uwto3nf6Ref4kc14zSiUl3FU
-+8/wN97JJsXcG56JbQmsyERxy23xlzHVTCAzv3VKoODcaRHtKrRkEBEwiw6wpxDY
-isWqG8gmiiXnZp+lahovfF+DxnhPHwIDAQABo1AwTjAdBgNVHQ4EFgQU3b/K2ubR
-NLo3dSHKb5oIKPI1tkgwHwYDVR0jBBgwFoAU3b/K2ubRNLo3dSHKb5oIKPI1tkgw
-DAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAYEAM2pU02vA1wFfnfQFwZNm
-kFDQtxjpsB5KoLbadpOvhNutFVQxFRPk3n5ODNUJHDQ1tuVM1m9lfTJf6/ypawf3
-SYLlgX4HgJpj+CzDQLyP1CraPtHuCLdNp4TK9D+hmEW+sQVp59/Xmasb7oswzPf8
-59QLF66Xv+R7/Q+ntIV541niFoe/HylFLCOTdr7Ahx3e7CtCauW7yPQKSggKjFzY
-fU3RuL/V9yntktGUBOg1Bld/LCOXh6U1jSbTGkfyFtfZxtQfI0PTJpk5yiD0cSNv
-DEp2dvd2H7P+v0ew/CpWgeHS3e4I2PT/WtwlYYqRArmGHPJQc3YlNfy2JSYVy+vE
-K2EMHOfuLxeb7PDUoYTn0q/e5BskFKcBh+OrKVhGoNnACuCN11nTG/hUID54paXI
-T4sDxJaf7PtHz3YtjWU0J7/6rgEFivOSCt2JbJehx+dgUees60t9LLhlyf5dakhV
-juTH+WpA4bhkRem1WSmlX899WH1keeWkCawedmU9lMRo
+hvcNAQEBBQADggGPADCCAYoCggGBALGE009cBICRT4JJujAL9+jL+RTvPZ8LPwpi
+/BsgpSDRYF+HWh8W0e2XcKbaGwMsfqBbPE4vFn4OiSmJ4RANONpqd183E7Moj3tc
+dq2e6NP1nvWDqhAHjeZRmPB8DVLyDCEe2LmZJqklAye7XKsuMyei1iOog4dEKZ+X
+tSRv17kK/Sjuu/tBWOodmd1EhquYvhzcy6mJHTZcqehHtfRSSKq1pGfvPtfi0zPe
+mCnYerBZXOexDsz9n+v21ToOC8/+Cz2iv0UYzpTnqVVgiNTYhFB5BS5BA3SuZyb2
+WxIImM4Kl+0BD4lPF1z6Ph01JEeSMr/3pBgrPNBImeGizaPMUFMgtcbjZoV7VxDs
+M0/Bd+cbfoHGxPNFIMCR3RN2ewOv9naOooNjV91jvLtaHBdSitYGSMwPx9NP6Noi
+bIb5TlymKQc72FZMWbMgSQd7lITPK8McGk6HZJK6QuHmrX0d9lSQbyvps8xLKzMm
+I/1lwDzwea3JwYHvNwTgJz6w7hW+UQIDAQABo1AwTjAdBgNVHQ4EFgQUs4qgorpx
+8agkedSkWyU2FR5JyM0wHwYDVR0jBBgwFoAUs4qgorpx8agkedSkWyU2FR5JyM0w
+DAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAYEAazIv5wUY6lzJlfTgwgxB
+XxoKlcnHfQXuilYpNVBAt/6fe1scw2kvoMvSuJEvUBli9ycYbZV7UxYVolrcFOP7
+sTKpadumM0c8ux/S3HD5ai4M2Ixt5V0dQzxOkd6gyNqgSw6dXrYPSknwe7ZTnv01
+FFvjTbQYpjZh6I8zm9QF+VRm3+DLGKNO3BeooLPBqPTWncp/aFMa15Xa6NOeSABx
+lZkRB8+WwH3OfTDoT+GDFjOh/1mbPkznOjgBnw9nTP0ti0rUAUY3M+gTaxWpHWh2
+RaKCM2kmMGAFyI+9tHWrvnqLSGhwQLQbUcXmeq1rT9sXwGBnLmNhmyxImbh2RaCe
+zO8zHlBOq3LDZciyebM1gyF404tsOhjoZTI5uMCdcS81NorAF2LYiz7hIhgrTGOm
+Dp0K+qtbNfuIkXdMjYydqc/8q8LmWgV7fgRuOc+Tzmc7esuvtjbh+3FkRdSm8M7v
+dQSZaZrliAoQAnSJ7HWERIBI38H36TfOzpKSXIkiCHMf
 -----END CERTIFICATE-----
diff --git a/Lib/test/capath/ceff1710.0 b/Lib/test/capath/ceff1710.0
index 730e7fd..941d791 100644
--- a/Lib/test/capath/ceff1710.0
+++ b/Lib/test/capath/ceff1710.0
@@ -1,26 +1,26 @@
 -----BEGIN CERTIFICATE-----
 MIIEbTCCAtWgAwIBAgIJAMstgJlaaVJbMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNV
 BAYTAlhZMSYwJAYDVQQKDB1QeXRob24gU29mdHdhcmUgRm91bmRhdGlvbiBDQTEW
-MBQGA1UEAwwNb3VyLWNhLXNlcnZlcjAeFw0xODA4MjkxNDIzMTZaFw0yODA4MjYx
+MBQGA1UEAwwNb3VyLWNhLXNlcnZlcjAeFw0xODA4MjkxNDIzMTZaFw0zNzEwMjgx
 NDIzMTZaME0xCzAJBgNVBAYTAlhZMSYwJAYDVQQKDB1QeXRob24gU29mdHdhcmUg
 Rm91bmRhdGlvbiBDQTEWMBQGA1UEAwwNb3VyLWNhLXNlcnZlcjCCAaIwDQYJKoZI
-hvcNAQEBBQADggGPADCCAYoCggGBAJftVUG6NheV23Ec0+FhrFhz48aWzysfuAj1
-nUtLxzD2uAuzUnKgu8lNO47fIo4BV4HJknPMAMbscLA6F0DB3/KMNkzEp4HntiRo
-4qB+NQcvoFv5RUb3HvBGEf7KGjxQ8SapX5winPhB4d9PEpUZL1yQARdufj59z+kJ
-ryX4+EJ3LW1fNvJ4Hn1Kh2hjbAZxG436Jf7U0/WlF7Hv6hfLVMgnmYDLPEXxLFIc
-3R9RRSBQHl6rV3MbQXiW3oSket2PMIU2WHl2oNJhyBuplJljxu74FL+0UlYxl/rr
-rFOelc5MxFpKt8oDJ1s1V84C3OzKafiKWjnLFiAVAyRhbPR6/LZI5VkQXEnQI5/7
-cV466WifNHKAJ7Y/TLHZ22N/Z2hKbhH46MD0WhY5Uwto3nf6Ref4kc14zSiUl3FU
-+8/wN97JJsXcG56JbQmsyERxy23xlzHVTCAzv3VKoODcaRHtKrRkEBEwiw6wpxDY
-isWqG8gmiiXnZp+lahovfF+DxnhPHwIDAQABo1AwTjAdBgNVHQ4EFgQU3b/K2ubR
-NLo3dSHKb5oIKPI1tkgwHwYDVR0jBBgwFoAU3b/K2ubRNLo3dSHKb5oIKPI1tkgw
-DAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAYEAM2pU02vA1wFfnfQFwZNm
-kFDQtxjpsB5KoLbadpOvhNutFVQxFRPk3n5ODNUJHDQ1tuVM1m9lfTJf6/ypawf3
-SYLlgX4HgJpj+CzDQLyP1CraPtHuCLdNp4TK9D+hmEW+sQVp59/Xmasb7oswzPf8
-59QLF66Xv+R7/Q+ntIV541niFoe/HylFLCOTdr7Ahx3e7CtCauW7yPQKSggKjFzY
-fU3RuL/V9yntktGUBOg1Bld/LCOXh6U1jSbTGkfyFtfZxtQfI0PTJpk5yiD0cSNv
-DEp2dvd2H7P+v0ew/CpWgeHS3e4I2PT/WtwlYYqRArmGHPJQc3YlNfy2JSYVy+vE
-K2EMHOfuLxeb7PDUoYTn0q/e5BskFKcBh+OrKVhGoNnACuCN11nTG/hUID54paXI
-T4sDxJaf7PtHz3YtjWU0J7/6rgEFivOSCt2JbJehx+dgUees60t9LLhlyf5dakhV
-juTH+WpA4bhkRem1WSmlX899WH1keeWkCawedmU9lMRo
+hvcNAQEBBQADggGPADCCAYoCggGBALGE009cBICRT4JJujAL9+jL+RTvPZ8LPwpi
+/BsgpSDRYF+HWh8W0e2XcKbaGwMsfqBbPE4vFn4OiSmJ4RANONpqd183E7Moj3tc
+dq2e6NP1nvWDqhAHjeZRmPB8DVLyDCEe2LmZJqklAye7XKsuMyei1iOog4dEKZ+X
+tSRv17kK/Sjuu/tBWOodmd1EhquYvhzcy6mJHTZcqehHtfRSSKq1pGfvPtfi0zPe
+mCnYerBZXOexDsz9n+v21ToOC8/+Cz2iv0UYzpTnqVVgiNTYhFB5BS5BA3SuZyb2
+WxIImM4Kl+0BD4lPF1z6Ph01JEeSMr/3pBgrPNBImeGizaPMUFMgtcbjZoV7VxDs
+M0/Bd+cbfoHGxPNFIMCR3RN2ewOv9naOooNjV91jvLtaHBdSitYGSMwPx9NP6Noi
+bIb5TlymKQc72FZMWbMgSQd7lITPK8McGk6HZJK6QuHmrX0d9lSQbyvps8xLKzMm
+I/1lwDzwea3JwYHvNwTgJz6w7hW+UQIDAQABo1AwTjAdBgNVHQ4EFgQUs4qgorpx
+8agkedSkWyU2FR5JyM0wHwYDVR0jBBgwFoAUs4qgorpx8agkedSkWyU2FR5JyM0w
+DAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAYEAazIv5wUY6lzJlfTgwgxB
+XxoKlcnHfQXuilYpNVBAt/6fe1scw2kvoMvSuJEvUBli9ycYbZV7UxYVolrcFOP7
+sTKpadumM0c8ux/S3HD5ai4M2Ixt5V0dQzxOkd6gyNqgSw6dXrYPSknwe7ZTnv01
+FFvjTbQYpjZh6I8zm9QF+VRm3+DLGKNO3BeooLPBqPTWncp/aFMa15Xa6NOeSABx
+lZkRB8+WwH3OfTDoT+GDFjOh/1mbPkznOjgBnw9nTP0ti0rUAUY3M+gTaxWpHWh2
+RaKCM2kmMGAFyI+9tHWrvnqLSGhwQLQbUcXmeq1rT9sXwGBnLmNhmyxImbh2RaCe
+zO8zHlBOq3LDZciyebM1gyF404tsOhjoZTI5uMCdcS81NorAF2LYiz7hIhgrTGOm
+Dp0K+qtbNfuIkXdMjYydqc/8q8LmWgV7fgRuOc+Tzmc7esuvtjbh+3FkRdSm8M7v
+dQSZaZrliAoQAnSJ7HWERIBI38H36TfOzpKSXIkiCHMf
 -----END CERTIFICATE-----
diff --git a/Lib/test/clinic.test b/Lib/test/clinic.test
index cb76c37..07e1382 100644
--- a/Lib/test/clinic.test
+++ b/Lib/test/clinic.test
@@ -418,11 +418,6 @@
     if (nargs < 3) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     c = _PyLong_AsInt(args[2]);
     if (c == -1 && PyErr_Occurred()) {
         goto exit;
@@ -436,7 +431,7 @@
 
 static PyObject *
 test_bool_converter_impl(PyObject *module, int a, int b, int c)
-/*[clinic end generated code: output=25f20963894256a1 input=939854fa9f248c60]*/
+/*[clinic end generated code: output=b5ec6409d942e0f9 input=939854fa9f248c60]*/
 
 
 /*[clinic input]
@@ -729,11 +724,6 @@
     if (nargs < 1) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         long ival = PyLong_AsLong(args[0]);
         if (ival == -1 && PyErr_Occurred()) {
@@ -756,11 +746,6 @@
     if (nargs < 2) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         long ival = PyLong_AsLong(args[1]);
         if (ival == -1 && PyErr_Occurred()) {
@@ -783,14 +768,9 @@
     if (nargs < 3) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
-        long ival = PyLong_AsUnsignedLongMask(args[2]);
-        if (ival == -1 && PyErr_Occurred()) {
+        unsigned long ival = PyLong_AsUnsignedLongMask(args[2]);
+        if (ival == (unsigned long)-1 && PyErr_Occurred()) {
             goto exit;
         }
         else {
@@ -807,7 +787,7 @@
 static PyObject *
 test_unsigned_char_converter_impl(PyObject *module, unsigned char a,
                                   unsigned char b, unsigned char c)
-/*[clinic end generated code: output=ebf905c5c9414762 input=021414060993e289]*/
+/*[clinic end generated code: output=c0a6ab3144481466 input=021414060993e289]*/
 
 
 /*[clinic input]
@@ -841,11 +821,6 @@
     if (nargs < 1) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         long ival = PyLong_AsLong(args[0]);
         if (ival == -1 && PyErr_Occurred()) {
@@ -874,7 +849,7 @@
 
 static PyObject *
 test_short_converter_impl(PyObject *module, short a)
-/*[clinic end generated code: output=86fe1a1496a7ff20 input=6a8a7a509a498ff4]*/
+/*[clinic end generated code: output=3ccda4bd08b6e4b4 input=6a8a7a509a498ff4]*/
 
 
 /*[clinic input]
@@ -925,11 +900,6 @@
     if (nargs < 3) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     c = (unsigned short)PyLong_AsUnsignedLongMask(args[2]);
     if (c == (unsigned short)-1 && PyErr_Occurred()) {
         goto exit;
@@ -944,7 +914,7 @@
 static PyObject *
 test_unsigned_short_converter_impl(PyObject *module, unsigned short a,
                                    unsigned short b, unsigned short c)
-/*[clinic end generated code: output=3779fe104319e3ae input=cdfd8eff3d9176b4]*/
+/*[clinic end generated code: output=576b5ce48424f351 input=cdfd8eff3d9176b4]*/
 
 
 /*[clinic input]
@@ -984,11 +954,6 @@
     if (nargs < 1) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     a = _PyLong_AsInt(args[0]);
     if (a == -1 && PyErr_Occurred()) {
         goto exit;
@@ -996,11 +961,6 @@
     if (nargs < 2) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     b = _PyLong_AsInt(args[1]);
     if (b == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1023,11 +983,6 @@
     if (nargs < 4) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[3])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     d = _PyLong_AsInt(args[3]);
     if (d == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1041,7 +996,7 @@
 
 static PyObject *
 test_int_converter_impl(PyObject *module, int a, int b, int c, myenum d)
-/*[clinic end generated code: output=10a2e48a34af5d7a input=d20541fc1ca0553e]*/
+/*[clinic end generated code: output=8a1a7b02ebe9eeac input=d20541fc1ca0553e]*/
 
 
 /*[clinic input]
@@ -1092,11 +1047,6 @@
     if (nargs < 3) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     c = (unsigned int)PyLong_AsUnsignedLongMask(args[2]);
     if (c == (unsigned int)-1 && PyErr_Occurred()) {
         goto exit;
@@ -1111,7 +1061,7 @@
 static PyObject *
 test_unsigned_int_converter_impl(PyObject *module, unsigned int a,
                                  unsigned int b, unsigned int c)
-/*[clinic end generated code: output=189176ce67c7d2e7 input=5533534828b62fc0]*/
+/*[clinic end generated code: output=4f53904bfa1a0250 input=5533534828b62fc0]*/
 
 
 /*[clinic input]
@@ -1145,11 +1095,6 @@
     if (nargs < 1) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     a = PyLong_AsLong(args[0]);
     if (a == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1163,7 +1108,7 @@
 
 static PyObject *
 test_long_converter_impl(PyObject *module, long a)
-/*[clinic end generated code: output=44cd8823f59d116b input=d2179e3c9cdcde89]*/
+/*[clinic end generated code: output=e5e7883fddcf4218 input=d2179e3c9cdcde89]*/
 
 
 /*[clinic input]
@@ -1263,11 +1208,6 @@
     if (nargs < 1) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     a = PyLong_AsLongLong(args[0]);
     if (a == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1281,7 +1221,7 @@
 
 static PyObject *
 test_long_long_converter_impl(PyObject *module, long long a)
-/*[clinic end generated code: output=7143b585d7e433e8 input=d5fc81577ff4dd02]*/
+/*[clinic end generated code: output=0488ac9e8c1d77bb input=d5fc81577ff4dd02]*/
 
 
 /*[clinic input]
@@ -1390,14 +1330,9 @@
     if (nargs < 1) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[0]);
+        PyObject *iobj = _PyNumber_Index(args[0]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -1410,14 +1345,9 @@
     if (nargs < 2) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[1]);
+        PyObject *iobj = _PyNumber_Index(args[1]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -1443,7 +1373,7 @@
 static PyObject *
 test_Py_ssize_t_converter_impl(PyObject *module, Py_ssize_t a, Py_ssize_t b,
                                Py_ssize_t c)
-/*[clinic end generated code: output=a46d2aaf40c10398 input=3855f184bb3f299d]*/
+/*[clinic end generated code: output=3bf73f9fdfeab468 input=3855f184bb3f299d]*/
 
 
 /*[clinic input]
@@ -1883,13 +1813,26 @@
     const Py_UNICODE *e;
     Py_ssize_clean_t e_length;
 
-    if (!_PyArg_ParseStack(args, nargs, "uuZu#Z#:test_Py_UNICODE_converter",
-        &a, &b, &c, &d, &d_length, &e, &e_length)) {
+    if (!_PyArg_ParseStack(args, nargs, "O&O&O&u#Z#:test_Py_UNICODE_converter",
+        _PyUnicode_WideCharString_Converter, &a, _PyUnicode_WideCharString_Converter, &b, _PyUnicode_WideCharString_Opt_Converter, &c, &d, &d_length, &e, &e_length)) {
         goto exit;
     }
     return_value = test_Py_UNICODE_converter_impl(module, a, b, c, d, d_length, e, e_length);
 
 exit:
+    /* Cleanup for a */
+    #if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free((void *)a);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+    /* Cleanup for b */
+    #if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free((void *)b);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+    /* Cleanup for c */
+    #if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free((void *)c);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+
     return return_value;
 }
 
@@ -1900,7 +1843,7 @@
                                Py_ssize_clean_t d_length,
                                const Py_UNICODE *e,
                                Py_ssize_clean_t e_length)
-/*[clinic end generated code: output=dd0a09a1b772e57b input=064a3b68ad7f04b0]*/
+/*[clinic end generated code: output=ef45e982fedf0b3d input=064a3b68ad7f04b0]*/
 
 
 /*[clinic input]
diff --git a/Lib/test/crashers/bogus_code_obj.py b/Lib/test/crashers/bogus_code_obj.py
index 198d229..e71b358 100644
--- a/Lib/test/crashers/bogus_code_obj.py
+++ b/Lib/test/crashers/bogus_code_obj.py
@@ -14,6 +14,6 @@
 
 import types
 
-co = types.CodeType(0, 0, 0, 0, 0, b'\x04\x71\x00\x00',
+co = types.CodeType(0, 0, 0, 0, 0, 0, b'\x04\x00\x71\x00',
                     (), (), (), '', '', 1, b'')
 exec(co)
diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py
index b37ef91..5833659 100644
--- a/Lib/test/datetimetester.py
+++ b/Lib/test/datetimetester.py
@@ -344,7 +344,7 @@
         with self.assertRaises(TypeError): timezone(ZERO) < timezone(ZERO)
         self.assertIn(timezone(ZERO), {timezone(ZERO)})
         self.assertTrue(timezone(ZERO) != None)
-        self.assertFalse(timezone(ZERO) ==  None)
+        self.assertFalse(timezone(ZERO) == None)
 
         tz = timezone(ZERO)
         self.assertTrue(tz == ALWAYS_EQ)
@@ -1861,8 +1861,6 @@
 
     def test_fromisoformat_fails_typeerror(self):
         # Test that fromisoformat fails when passed the wrong type
-        import io
-
         bad_types = [b'2009-03-01', None, io.StringIO('2009-03-01')]
         for bad_type in bad_types:
             with self.assertRaises(TypeError):
@@ -2609,6 +2607,7 @@
 
         with self.assertRaises(ValueError): strptime("-2400", "%z")
         with self.assertRaises(ValueError): strptime("-000", "%z")
+        with self.assertRaises(ValueError): strptime("z", "%z")
 
     def test_strptime_single_digit(self):
         # bpo-34903: Check that single digit dates and times are allowed.
@@ -3984,8 +3983,6 @@
 
     def test_fromisoformat_fails_typeerror(self):
         # Test the fromisoformat fails when passed the wrong type
-        import io
-
         bad_types = [b'12:30:45', None, io.StringIO('12:30:45')]
 
         for bad_type in bad_types:
@@ -4063,7 +4060,7 @@
         self.assertEqual(t1, t1)
         self.assertEqual(t2, t2)
 
-        # Equal afer adjustment.
+        # Equal after adjustment.
         t1 = self.theclass(1, 12, 31, 23, 59, tzinfo=FixedOffset(1, ""))
         t2 = self.theclass(2, 1, 1, 3, 13, tzinfo=FixedOffset(3*60+13+2, ""))
         self.assertEqual(t1, t2)
@@ -4902,7 +4899,7 @@
         # OTOH, these fail!  Don't enable them.  The difficulty is that
         # the edge case tests assume that every hour is representable in
         # the "utc" class.  This is always true for a fixed-offset tzinfo
-        # class (lke utc_real and utc_fake), but not for Eastern or Central.
+        # class (like utc_real and utc_fake), but not for Eastern or Central.
         # For these adjacent DST-aware time zones, the range of time offsets
         # tested ends up creating hours in the one that aren't representable
         # in the other.  For the same reason, we would see failures in the
@@ -5110,43 +5107,21 @@
             def __int__(self):
                 return self.value
 
-        for xx in [decimal.Decimal(10),
-                   decimal.Decimal('10.9'),
-                   Number(10)]:
-            with self.assertWarns(DeprecationWarning):
-                self.assertEqual(datetime(10, 10, 10, 10, 10, 10, 10),
-                                 datetime(xx, xx, xx, xx, xx, xx, xx))
-
-        with self.assertRaisesRegex(TypeError, '^an integer is required '
-                                              r'\(got type str\)$'):
-            datetime(10, 10, '10')
-
-        f10 = Number(10.9)
-        with self.assertRaisesRegex(TypeError, '^__int__ returned non-int '
-                                               r'\(type float\)$'):
-            datetime(10, 10, f10)
-
         class Float(float):
             pass
-        s10 = Float(10.9)
-        with self.assertRaisesRegex(TypeError, '^integer argument expected, '
-                                               'got float$'):
-            datetime(10, 10, s10)
 
-        with self.assertRaises(TypeError):
-            datetime(10., 10, 10)
-        with self.assertRaises(TypeError):
-            datetime(10, 10., 10)
-        with self.assertRaises(TypeError):
-            datetime(10, 10, 10.)
-        with self.assertRaises(TypeError):
-            datetime(10, 10, 10, 10.)
-        with self.assertRaises(TypeError):
-            datetime(10, 10, 10, 10, 10.)
-        with self.assertRaises(TypeError):
-            datetime(10, 10, 10, 10, 10, 10.)
-        with self.assertRaises(TypeError):
-            datetime(10, 10, 10, 10, 10, 10, 10.)
+        for xx in [10.0, Float(10.9),
+                   decimal.Decimal(10), decimal.Decimal('10.9'),
+                   Number(10), Number(10.9),
+                   '10']:
+            self.assertRaises(TypeError, datetime, xx, 10, 10, 10, 10, 10, 10)
+            self.assertRaises(TypeError, datetime, 10, xx, 10, 10, 10, 10, 10)
+            self.assertRaises(TypeError, datetime, 10, 10, xx, 10, 10, 10, 10)
+            self.assertRaises(TypeError, datetime, 10, 10, 10, xx, 10, 10, 10)
+            self.assertRaises(TypeError, datetime, 10, 10, 10, 10, xx, 10, 10)
+            self.assertRaises(TypeError, datetime, 10, 10, 10, 10, 10, xx, 10)
+            self.assertRaises(TypeError, datetime, 10, 10, 10, 10, 10, 10, xx)
+
 
 #############################################################################
 # Local Time Disambiguation
@@ -6016,30 +5991,36 @@
 
         for klass in [datetime, DateTimeSubclass]:
             for args in [(1993, 8, 26, 22, 12, 55, 99999),
-                         (1993, 8, 26, 22, 12, 55, 99999)]:
+                         (1993, 8, 26, 22, 12, 55, 99999,
+                          timezone.utc)]:
                 d = klass(*args)
                 with self.subTest(cls=klass, date=args):
-                    hour, minute, second, microsecond = _testcapi.PyDateTime_DATE_GET(d)
+                    hour, minute, second, microsecond, tzinfo = \
+                                            _testcapi.PyDateTime_DATE_GET(d)
 
                     self.assertEqual(hour, d.hour)
                     self.assertEqual(minute, d.minute)
                     self.assertEqual(second, d.second)
                     self.assertEqual(microsecond, d.microsecond)
+                    self.assertIs(tzinfo, d.tzinfo)
 
     def test_PyDateTime_TIME_GET(self):
         class TimeSubclass(time):
             pass
 
         for klass in [time, TimeSubclass]:
-            for args in [(12, 30, 20, 10), (12, 30, 20, 10)]:
+            for args in [(12, 30, 20, 10),
+                         (12, 30, 20, 10, timezone.utc)]:
                 d = klass(*args)
                 with self.subTest(cls=klass, date=args):
-                    hour, minute, second, microsecond = _testcapi.PyDateTime_TIME_GET(d)
+                    hour, minute, second, microsecond, tzinfo = \
+                                              _testcapi.PyDateTime_TIME_GET(d)
 
                     self.assertEqual(hour, d.hour)
                     self.assertEqual(minute, d.minute)
                     self.assertEqual(second, d.second)
                     self.assertEqual(microsecond, d.microsecond)
+                    self.assertIs(tzinfo, d.tzinfo)
 
     def test_timezones_offset_zero(self):
         utc0, utc1, non_utc = _testcapi.get_timezones_offset_zero()
diff --git a/Lib/test/decimaltestdata/abs.decTest b/Lib/test/decimaltestdata/abs.decTest
index 01f73d7..569b8fc 100644
--- a/Lib/test/decimaltestdata/abs.decTest
+++ b/Lib/test/decimaltestdata/abs.decTest
@@ -20,7 +20,7 @@
 version: 2.59
 
 -- This set of tests primarily tests the existence of the operator.
--- Additon, subtraction, rounding, and more overflows are tested
+-- Addition, subtraction, rounding, and more overflows are tested
 -- elsewhere.
 
 precision:   9
diff --git a/Lib/test/decimaltestdata/extra.decTest b/Lib/test/decimaltestdata/extra.decTest
index b630d8e..3129120 100644
--- a/Lib/test/decimaltestdata/extra.decTest
+++ b/Lib/test/decimaltestdata/extra.decTest
@@ -156,7 +156,7 @@
 
 -- max/min/max_mag/min_mag bug in 2.5.2/2.6/3.0: max(NaN, finite) gave
 -- incorrect answers when the finite number required rounding; similarly
--- for the other thre functions
+-- for the other three functions
 maxexponent: 999
 minexponent: -999
 precision: 6
diff --git a/Lib/test/exception_hierarchy.txt b/Lib/test/exception_hierarchy.txt
index 763a6c8..6c5e821 100644
--- a/Lib/test/exception_hierarchy.txt
+++ b/Lib/test/exception_hierarchy.txt
@@ -61,4 +61,5 @@
            +-- ImportWarning
            +-- UnicodeWarning
            +-- BytesWarning
+           +-- EncodingWarning
            +-- ResourceWarning
diff --git a/Lib/test/fork_wait.py b/Lib/test/fork_wait.py
index 249b5e9..4d3dbd8 100644
--- a/Lib/test/fork_wait.py
+++ b/Lib/test/fork_wait.py
@@ -12,6 +12,7 @@
 import os, sys, time, unittest
 import threading
 from test import support
+from test.support import threading_helper
 
 
 LONGSLEEP = 2
@@ -21,7 +22,7 @@
 class ForkWait(unittest.TestCase):
 
     def setUp(self):
-        self._threading_key = support.threading_setup()
+        self._threading_key = threading_helper.threading_setup()
         self.alive = {}
         self.stop = 0
         self.threads = []
@@ -33,7 +34,7 @@
             thread.join()
         thread = None
         self.threads.clear()
-        support.threading_cleanup(*self._threading_key)
+        threading_helper.threading_cleanup(*self._threading_key)
 
     def f(self, id):
         while not self.stop:
diff --git a/Lib/test/idnsans.pem b/Lib/test/idnsans.pem
index e8a41fe..cbcac78 100644
--- a/Lib/test/idnsans.pem
+++ b/Lib/test/idnsans.pem
@@ -1,84 +1,84 @@
 -----BEGIN PRIVATE KEY-----
-MIIG/wIBADANBgkqhkiG9w0BAQEFAASCBukwggblAgEAAoIBgQDAfkvfgnT/+ATq
-IiR5ksgGW4EJK900MkBsY9TXQcNdbrGqbyG4EwEvbDWzsAWBqgg76Alto7JgxKl2
-gNskz3T007xycOVAy4z31gzEWMTx+GxNbCiicJfCZjw6Z4Ck/UipooXAAy/S7jwC
-z369E4RGa5jsIxxJ+NdDqAheoROIeUKawkfF7xXTyzkwuTuNj2YcV/TvJcsGVGQT
-j4tZVSbDVvL38PlQX62VoGmEDK8pl8GL2GUQK3y+gP2VFDHepGxqqXxPLITxpdBF
-aIoQcY4YV+nJtNu8vlUzDMizCHKII+YP9JdstxOLCyEbmjLv3rk4tHgIJuOfOyRh
-3KjIcdghmNZcZ7vOvpbr341gKBNRLVmsAxtJCqqMfWvNOc6rXfp20bCnL/SDDJeB
-/71/KfVeVaffXRtfEWcwJW6YRp7p2MealzAsnUA5xscOKItYhvmJ1FJlUB8LDZ+d
-WESld2a4CIdK9lpuf3LDqy+wmcGTdnoVoi2RT68SDYHAb/bbtx0CAwEAAQKCAYEA
-qNuhjzYPkKNvHDxLJuKd2QXYEcWKzEjwvqRsh0/HI2UBMXM/bwws0/7mtPPKQM55
-XqPT8XvR9JVP2wZ6NrZN8J71BqcGVGq7BIWeuXbtfR3hU6F3m9eNKRkp6En3TcRq
-Q3SwQ5oID86wkf6XPSGrvWKRyUObg0BpBY6XmPtP+T32MXAQKg/rY9k4GAfFuA59
-EowN7uOGT80j5Qzcvsa1tFHH3bxj2B+2VDVdmlrOJXxcamKvdRnQ2gSpbmdCv/4X
-HKmRiP7m2qVMxRaNh3kcL/gACGvZw3rUE7K0PwjW+sQ6lRlWF9IqUSDZaswxWrie
-EaM2et9qD80g3eUV3gMi6I8BIdmD20p/yqa/l0bQk75Y6KQRUlN5HTodFL1u4/7V
-W9N9wVIlx5DB1yJBkCZBDoebr4Y1UOGs4rrkcOd6F+zCeRSwKPFAng5vHpZ8jclS
-1X2pV/KnKWIUfcFH9+v6pD9Y+VC5tz5LgaFz4SYFxgMF69t+PCpdoR2+0zwSWKGB
-AoHBAPr/bC0L7V/HXeoiNxXjOSAYDgyVvzZC3i8cbW2/7DqdY7DfDmZbabdEX1mu
-kaY9S/5abVV5W1eQACh1Cd/MaRkUbm+5nTy/bF9jXfh8408MzrGbAR9KF9GfWgqC
-UxRiAkCa2gLuAhfc6uqokf5yZK0F+kZGGYWEeGcFK46i+8JstqknW0LsN1hhd+wE
-PFokf+/22NiV0t1T0GERz18fFu0XoQC60D9qaW56EI+6OTADw71XkVh35jbNBa96
-bLPVzQKBwQDEVGMtpARdwoU59fRfDBo9S8iJJ/jTFpJs5nrqGZKah4J2pkTBiDpW
-ZNxesVKL6IuvWghIuZGnBw5ovWT9JKQ2NHD4GDm/XJ6veVWOxc7THiBhCvJaG5N7
-3Jbxyn+eJ5yBO9PeR6slZbDrgDSIFUI++XD9A7abod8eTZHh6Q3pYT5mRuvfuDS1
-nlrkvMgGC1ZCQXCVTdq8MmMS9jea4UXhJLn4paGSKQSYXWLWVxTX3Mgk0640XpXN
-HvsdCBMgFpECgcEAtESQkAXZ9Yk9tTPftlOcqqU8KeO/EhyScOmM2l8WLb7uY5DA
-SdlrotlzVfjf2LJ7ivGtRs9DQC9HPcdZUSgBb6bR7mI0QPYGwreePSKNKzA6nyqB
-ctSHKOG3DIcvXhtKHNZar/H7BOKAwgpR2JqWHgKGDsS3/cH3q531+5qpEKl9wx1m
-GTmIQmy2cYdVRTSjwlfaxCtO5/ETXzQoaNvuXlgzJVAG0xT9JgB7No78FbUOd0WW
-OSDb8g3sAGz/92UdAoHBAJqaOV9/gVC0FWWHIWCXjzIls00OhQr1A2luNeyTJrc5
-bqswU4RzWj0eP8rxqCc0gIsdQtjCCMiW7enc+uG9MPLeaPd1XEQtE2jrC0zax/vI
-BYdlr2L1xDYNh2/wHn7UgpHiIv0vQr64TZGl67gdxYUBuNAFVI9J8QFT5EUZ2TKm
-uRShVK1fyWIbyUfGwVzBILQcBCQOoukAZLRR34e/Td/1o90B0THfyxaQs3xGJsu1
-uIYHi28B7MUSWHyMF0N1gQKBwB9jtS7k7ZRgb0WzsgutRzJLfirmMeahzJwAQ46o
-2xRT1y7vr0Idh9OSTz8Iqva6Frse21HT6agymamqEeC2aYwq+ikA0V7K3AhG3PiN
-S5diC+RIZybeTthBTO1yj5pKDniZl+NGe3vIunXMrjZIuk/03VFK2etqdYcXguwH
-SkwvuKqC3vvzcJW8dV2qIJ3Bz9LWz0QKqJQZBlCZvfzHf1jN5rpJJPQezys4k723
-ZPGg6Smyks3ElGXevVdidVcPUA==
+MIIG/QIBADANBgkqhkiG9w0BAQEFAASCBucwggbjAgEAAoIBgQC8sqplTuHuLjbW
+TL5SL2D1fw9U6WQzLVAF5gsyhd5lr2FpfYwjrob5Mav91aOLbJRTvoNyXsJ26FPS
+0RycRGXbomcIEJxXGy9aI+0MLYBt1G5mgqCH+HcVCwPzCNlhVnTwvpgA7y8zs3+6
+ezZAPWkF0yWOMYLtTcq9A5GWeavt5VMgm1KZF3gO4k58oPyk3Ae9D0LAaYsX6DFi
+BYx41eUR5UbSb5IYXaDd8d6jqW/jnYhgc6Cxkv1gTJFn87V5lrG0vYMSRUtWDQ9Y
+Jh/EKAxjGw7AeY429p6TE4UoJhDmoFYR2NLvawhNIplxol/v0fs0veFQjI/UsTD8
+2tRfnYL4IX8szhLsE5/5Iq8aiLHjVbIMwmDYAa0P63Ap2kf1biSn9mpDL8lQazSo
+yr8xzIq2QS5HMvGbeMAmS0ih10Zx84uVmkWlavgvtSflw8K/ZXT9c70rZp/TdBGY
+95cOFsbg5U/20M/Llpis9tcBCaoVaYSFupatrP+p8y19qP2nebsCAwEAAQKCAYEA
+uaYWWwHW6pzxOrnabcVLYX0WunW9LVShbIw97AElI2n/LuhkXh6xkK48BsqP0vaK
+oDHJ5VYxgQdmoP03Zs8sX4BSWe7twg1u8wJxkA+cUXI1BAn0opHjpwJlalEEfe2v
+s8PwjMrF59nsCq56W42PrDlms5UmuQ5WLsw6Co++hZmfxW7LPu+GIS6qBZfluNT5
+kBpZlDDCtkyteUD4SVI3wvmOSi+Wzv4e7P2wC9kByjENIcfhC5QQURRD4sA1hWCp
+2SThYWqJOCEc2SvGgoqgTRaJuQ2aVG9qrntXt0N4V+WdJWXBK0jedkB2flLve1fR
+KmDYuc9k/c1svmS3Y+iZohBha9H8jpuJmXYBxxg1iNg9m7qkfg8F8wxCYLQKB+U6
+tjRS7by+jSE08On7mpDDhJORnlh+rfEuWPPwAKQpLpdp76KDTvR++GvfOMUiOrFM
+e9s5aXp+vcgkSSqYvigE+sFpCjQWwkGBkMdT16Pf9CzhQaM08YuLnzfLEYgLFw6R
+AoHBAN5NQINBmlq/cptGSru66kfecqHfI7xHnnGWKAkto/B1x7Crrgs4Tk5b4vaA
+JmAqatt5P1e7zco7uAXXebY5VURuH/30TlkuaB+oGFp0OMw6165n8RVPT2ZaDViK
+ssJ9LT8fJ+23TWCCT2Z1zUlM/NnHAMjKOVsJK3/KEkVvlc7ROC7uVooc78AsQehg
+zpL3GBYEeBukT8aNUMqUlesCsIs/dQHW7DzQL2xGkQagm5/PDsxaCsT7ynA8eL3X
+TW+IXwKBwQDZTV3TaG6wqtL8y2DR0lN5jY/eYayX4e18iZ+XEZVTntPdVVyJIE4d
+0A5ZfcILb9WE8R21iptROYSjcH/05j+3fQMJ1WAK0sNfGTUNNT3jYU8YzLvos+wW
+G8E+mNMpFPWNvLV5Qrl4VvoifGh8AMvplUEz8uAzGJbXbRxUPcmjth2ph8zULEDn
+/+o4OcT3gh1bp+HCqch0OuiJRn9qNUpsJG5GMm5FtjBjZM97ucZ1/0DaWl3JUxUN
+/pueo3J9vCUCgcBg2Fjdlcvv8u2z1aijJmgATVm1SWfhE3ZkV50zem2sSTNotTJK
+cwoyOveimeueA3ywBp9g0lFx5Bhkex3sFAggmrVXRoKHeZ8lA28woOdJmezybxfp
+R7b4iQy9YRdFgZEfqawUdMHB5KNAqNt5LpANNBQUZX0dOt53eooBM/6Yri8CyxRq
+cPbFysIfwWTdQ8Z7eRD2Qdv7TP9AcgDp9C8DSu7nkUEzsSKn0gpGT9vcgDEbN7Lv
+ZB4qTT3wvoZeq5MCgcBIG18eDtJkN1sp3Yb0OTnP5QSvg3PVNngq0jQt2fzWMacW
+FARP0HN7exW35n4kc2jD44q7OhJOAqsb3PHo3xqXlZkTg0WKceO4w9GR32/46spn
+bVCRaFrX/z/BuM6hHD5bWRpS8aw/3YTFOsklFNKVYRyw01BIREmRlLhIz/QAKidv
+oQt8AG9NTON44tqUUw3Q40WL5fEJeJ6/JrCTGrnmZrRdANEMuucVpFchNEVB1IC9
+tCzY6IPdD/atzojoZi0CgcB2x9oWLjJ0XJIp2pMAb8nCMVjkKrznKFjZbDm8EQBs
+ou7pM2zkO3VRcWT1BXQocinJsjQqjQiTawP6IN2FQgT0d89V+pwd+jdvpdildQhP
+1/6SErVRZV//oopKTsC6TIBL/EmW1TkP3ulQIZs8YklFgybeHdDyNFi+VgPXkVGe
+IHp0nEzrui9q0YJsjHfFHBeGyzDSfbiBYiF7Auk66gYZbXufebP/LZNG/FIamPP3
+rwYIeeV1IVwk9tPBw6fGwrs=
 -----END PRIVATE KEY-----
 Certificate:
     Data:
         Version: 3 (0x2)
         Serial Number:
-            cb:2d:80:99:5a:69:52:5f
-    Signature Algorithm: sha256WithRSAEncryption
+            cb:2d:80:99:5a:69:52:60
+        Signature Algorithm: sha256WithRSAEncryption
         Issuer: C=XY, O=Python Software Foundation CA, CN=our-ca-server
         Validity
-            Not Before: Aug 29 14:23:17 2018 GMT
-            Not After : Jul  7 14:23:17 2028 GMT
+            Not Before: Aug 29 14:23:16 2018 GMT
+            Not After : Oct 28 14:23:16 2037 GMT
         Subject: C=XY, L=Castle Anthrax, O=Python Software Foundation, CN=idnsans
         Subject Public Key Info:
             Public Key Algorithm: rsaEncryption
-                Public-Key: (3072 bit)
+                RSA Public-Key: (3072 bit)
                 Modulus:
-                    00:c0:7e:4b:df:82:74:ff:f8:04:ea:22:24:79:92:
-                    c8:06:5b:81:09:2b:dd:34:32:40:6c:63:d4:d7:41:
-                    c3:5d:6e:b1:aa:6f:21:b8:13:01:2f:6c:35:b3:b0:
-                    05:81:aa:08:3b:e8:09:6d:a3:b2:60:c4:a9:76:80:
-                    db:24:cf:74:f4:d3:bc:72:70:e5:40:cb:8c:f7:d6:
-                    0c:c4:58:c4:f1:f8:6c:4d:6c:28:a2:70:97:c2:66:
-                    3c:3a:67:80:a4:fd:48:a9:a2:85:c0:03:2f:d2:ee:
-                    3c:02:cf:7e:bd:13:84:46:6b:98:ec:23:1c:49:f8:
-                    d7:43:a8:08:5e:a1:13:88:79:42:9a:c2:47:c5:ef:
-                    15:d3:cb:39:30:b9:3b:8d:8f:66:1c:57:f4:ef:25:
-                    cb:06:54:64:13:8f:8b:59:55:26:c3:56:f2:f7:f0:
-                    f9:50:5f:ad:95:a0:69:84:0c:af:29:97:c1:8b:d8:
-                    65:10:2b:7c:be:80:fd:95:14:31:de:a4:6c:6a:a9:
-                    7c:4f:2c:84:f1:a5:d0:45:68:8a:10:71:8e:18:57:
-                    e9:c9:b4:db:bc:be:55:33:0c:c8:b3:08:72:88:23:
-                    e6:0f:f4:97:6c:b7:13:8b:0b:21:1b:9a:32:ef:de:
-                    b9:38:b4:78:08:26:e3:9f:3b:24:61:dc:a8:c8:71:
-                    d8:21:98:d6:5c:67:bb:ce:be:96:eb:df:8d:60:28:
-                    13:51:2d:59:ac:03:1b:49:0a:aa:8c:7d:6b:cd:39:
-                    ce:ab:5d:fa:76:d1:b0:a7:2f:f4:83:0c:97:81:ff:
-                    bd:7f:29:f5:5e:55:a7:df:5d:1b:5f:11:67:30:25:
-                    6e:98:46:9e:e9:d8:c7:9a:97:30:2c:9d:40:39:c6:
-                    c7:0e:28:8b:58:86:f9:89:d4:52:65:50:1f:0b:0d:
-                    9f:9d:58:44:a5:77:66:b8:08:87:4a:f6:5a:6e:7f:
-                    72:c3:ab:2f:b0:99:c1:93:76:7a:15:a2:2d:91:4f:
-                    af:12:0d:81:c0:6f:f6:db:b7:1d
+                    00:bc:b2:aa:65:4e:e1:ee:2e:36:d6:4c:be:52:2f:
+                    60:f5:7f:0f:54:e9:64:33:2d:50:05:e6:0b:32:85:
+                    de:65:af:61:69:7d:8c:23:ae:86:f9:31:ab:fd:d5:
+                    a3:8b:6c:94:53:be:83:72:5e:c2:76:e8:53:d2:d1:
+                    1c:9c:44:65:db:a2:67:08:10:9c:57:1b:2f:5a:23:
+                    ed:0c:2d:80:6d:d4:6e:66:82:a0:87:f8:77:15:0b:
+                    03:f3:08:d9:61:56:74:f0:be:98:00:ef:2f:33:b3:
+                    7f:ba:7b:36:40:3d:69:05:d3:25:8e:31:82:ed:4d:
+                    ca:bd:03:91:96:79:ab:ed:e5:53:20:9b:52:99:17:
+                    78:0e:e2:4e:7c:a0:fc:a4:dc:07:bd:0f:42:c0:69:
+                    8b:17:e8:31:62:05:8c:78:d5:e5:11:e5:46:d2:6f:
+                    92:18:5d:a0:dd:f1:de:a3:a9:6f:e3:9d:88:60:73:
+                    a0:b1:92:fd:60:4c:91:67:f3:b5:79:96:b1:b4:bd:
+                    83:12:45:4b:56:0d:0f:58:26:1f:c4:28:0c:63:1b:
+                    0e:c0:79:8e:36:f6:9e:93:13:85:28:26:10:e6:a0:
+                    56:11:d8:d2:ef:6b:08:4d:22:99:71:a2:5f:ef:d1:
+                    fb:34:bd:e1:50:8c:8f:d4:b1:30:fc:da:d4:5f:9d:
+                    82:f8:21:7f:2c:ce:12:ec:13:9f:f9:22:af:1a:88:
+                    b1:e3:55:b2:0c:c2:60:d8:01:ad:0f:eb:70:29:da:
+                    47:f5:6e:24:a7:f6:6a:43:2f:c9:50:6b:34:a8:ca:
+                    bf:31:cc:8a:b6:41:2e:47:32:f1:9b:78:c0:26:4b:
+                    48:a1:d7:46:71:f3:8b:95:9a:45:a5:6a:f8:2f:b5:
+                    27:e5:c3:c2:bf:65:74:fd:73:bd:2b:66:9f:d3:74:
+                    11:98:f7:97:0e:16:c6:e0:e5:4f:f6:d0:cf:cb:96:
+                    98:ac:f6:d7:01:09:aa:15:69:84:85:ba:96:ad:ac:
+                    ff:a9:f3:2d:7d:a8:fd:a7:79:bb
                 Exponent: 65537 (0x10001)
         X509v3 extensions:
             X509v3 Subject Alternative Name: 
@@ -90,9 +90,9 @@
             X509v3 Basic Constraints: critical
                 CA:FALSE
             X509v3 Subject Key Identifier: 
-                54:53:0C:3C:4C:E3:63:C6:56:08:35:9C:5E:F4:C1:A1:04:3A:C2:C9
+                5C:BE:18:7F:7B:3F:CE:99:66:80:79:53:4B:DD:33:1B:42:A5:7E:00
             X509v3 Authority Key Identifier: 
-                keyid:DD:BF:CA:DA:E6:D1:34:BA:37:75:21:CA:6F:9A:08:28:F2:35:B6:48
+                keyid:B3:8A:A0:A2:BA:71:F1:A8:24:79:D4:A4:5B:25:36:15:1E:49:C8:CD
                 DirName:/C=XY/O=Python Software Foundation CA/CN=our-ca-server
                 serial:CB:2D:80:99:5A:69:52:5B
 
@@ -106,64 +106,64 @@
                   URI:http://testca.pythontest.net/testca/revocation.crl
 
     Signature Algorithm: sha256WithRSAEncryption
-         03:af:93:ab:58:98:74:3c:a1:68:53:18:13:be:56:60:77:d0:
-         a7:0e:c9:8a:02:1f:92:4d:21:18:61:d7:3e:9a:1d:aa:94:37:
-         02:59:31:3b:71:62:d9:cb:04:e8:c7:44:41:f9:0e:0d:90:d1:
-         4a:ab:4e:e2:bd:4e:60:1b:3c:eb:2a:b7:8a:ca:24:58:60:64:
-         d3:a6:20:f6:f5:98:6e:ca:5a:0a:91:63:97:58:f5:18:90:9f:
-         17:55:9f:12:cf:22:a7:31:e6:90:da:36:61:3b:d6:42:e6:18:
-         19:43:bb:17:52:28:40:a5:11:47:7f:32:fe:83:3d:c3:7d:8b:
-         17:1b:5d:f7:20:3e:bd:3b:16:3d:00:01:68:ed:76:7a:a1:af:
-         ce:cd:dd:52:7f:19:22:db:83:c1:89:b6:90:02:4e:22:bc:b1:
-         76:0c:00:ad:c5:3c:33:be:64:92:30:38:1f:b1:04:4f:53:a2:
-         4a:fb:63:80:21:8b:03:72:72:4b:df:f1:9d:08:75:f0:94:06:
-         d3:cb:7c:df:3b:80:19:58:7a:85:ca:2a:bf:b4:8c:5d:f3:b6:
-         65:24:37:b2:1d:46:da:1f:39:48:f2:eb:3a:84:98:3a:0c:59:
-         ff:0a:05:c2:2c:8c:b1:a5:a9:43:a9:8e:47:97:9a:d2:40:9c:
-         b8:c3:e6:46:1b:db:4b:85:a3:e1:e7:4e:2a:1e:b9:a6:de:ee:
-         a7:f0:63:3f:0f:e2:90:b6:82:70:4b:93:7f:e9:74:f3:ab:03:
-         9e:04:38:f1:46:2d:f6:fe:77:0f:4a:8e:66:23:74:3e:c6:5b:
-         eb:0e:dd:72:c3:46:1d:a4:f0:2f:b6:18:2e:f1:1c:f9:85:69:
-         0e:5a:37:5e:f8:ea:4b:2d:e7:63:ee:a1:e4:b9:f7:fa:a9:11:
-         65:64:a1:b7:b5:91:81:5c:4d:b5:27:b4:16:96:4b:df:fc:c4:
-         8a:26:b6:87:62:54:88:fb:1d:7d:af:97:25:65:27:38:1e:f7:
-         8c:a4:16:46:f2:d9
+         5d:7a:f8:81:e0:a7:c1:3f:39:eb:d3:52:2c:e1:cb:4d:29:b3:
+         77:18:17:18:9e:12:fc:11:cc:3c:49:cb:6b:f4:4d:6c:b8:d2:
+         f4:e9:37:f8:6b:ed:f5:d7:f1:eb:5a:41:04:c7:f3:8c:da:e1:
+         05:8e:ae:58:71:d9:01:8a:32:46:b2:dd:95:46:e1:ce:82:04:
+         fa:0b:1c:29:75:07:85:ce:cd:59:d4:cc:f3:56:b3:72:4d:cb:
+         90:0f:ce:02:21:ce:5d:17:84:96:7f:6a:00:57:42:b7:24:5b:
+         07:25:1e:77:a8:9d:da:41:09:8e:29:79:b4:b0:a1:45:c8:70:
+         ae:2c:86:24:ae:3d:9a:74:a7:04:78:d6:1f:1b:17:c5:c1:6d:
+         b1:1a:fd:f4:50:2e:61:16:84:89:d0:42:3f:b6:bf:bd:52:bd:
+         c8:3e:8e:87:b4:f0:bd:ad:c7:51:65:2f:77:e8:69:79:0e:03:
+         63:89:e7:70:ad:c8:d1:2f:1a:a5:06:d2:90:db:7c:07:35:9a:
+         0b:0e:85:87:d1:70:17:a7:88:0f:c6:b5:9c:88:00:fa:f9:b2:
+         0a:19:5a:4b:8d:91:12:51:5e:0e:c1:d8:9e:02:78:d0:2d:24:
+         09:fe:d4:97:3c:cb:a0:1f:9a:ab:f7:0f:e2:fa:64:23:4e:53:
+         0a:15:3e:f5:04:01:86:29:8b:8e:24:40:2f:b1:90:87:5c:3b:
+         7b:a7:4c:06:af:c3:90:7f:e9:c6:56:42:61:15:2c:83:f1:7c:
+         4f:89:17:f3:a0:11:34:3f:8d:af:75:34:60:1e:e0:f2:f3:02:
+         e7:aa:b3:f7:9f:1c:f8:69:f4:fe:da:57:6e:1b:95:53:70:cd:
+         ed:b6:bb:2a:84:eb:ab:c3:a9:b4:d5:15:a0:b2:cc:81:2d:f1:
+         56:c1:54:9b:5f:14:4c:5f:ad:5f:f5:06:ee:22:60:45:e4:50:
+         35:64:ac:ac:ca:4a:bf:86:78:f8:53:2d:17:d8:e8:84:c8:07:
+         a4:c2:29:76:c7:1f
 -----BEGIN CERTIFICATE-----
-MIIGvTCCBSWgAwIBAgIJAMstgJlaaVJfMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNV
+MIIGvTCCBSWgAwIBAgIJAMstgJlaaVJgMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNV
 BAYTAlhZMSYwJAYDVQQKDB1QeXRob24gU29mdHdhcmUgRm91bmRhdGlvbiBDQTEW
-MBQGA1UEAwwNb3VyLWNhLXNlcnZlcjAeFw0xODA4MjkxNDIzMTdaFw0yODA3MDcx
-NDIzMTdaMF0xCzAJBgNVBAYTAlhZMRcwFQYDVQQHDA5DYXN0bGUgQW50aHJheDEj
+MBQGA1UEAwwNb3VyLWNhLXNlcnZlcjAeFw0xODA4MjkxNDIzMTZaFw0zNzEwMjgx
+NDIzMTZaMF0xCzAJBgNVBAYTAlhZMRcwFQYDVQQHDA5DYXN0bGUgQW50aHJheDEj
 MCEGA1UECgwaUHl0aG9uIFNvZnR3YXJlIEZvdW5kYXRpb24xEDAOBgNVBAMMB2lk
-bnNhbnMwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDAfkvfgnT/+ATq
-IiR5ksgGW4EJK900MkBsY9TXQcNdbrGqbyG4EwEvbDWzsAWBqgg76Alto7JgxKl2
-gNskz3T007xycOVAy4z31gzEWMTx+GxNbCiicJfCZjw6Z4Ck/UipooXAAy/S7jwC
-z369E4RGa5jsIxxJ+NdDqAheoROIeUKawkfF7xXTyzkwuTuNj2YcV/TvJcsGVGQT
-j4tZVSbDVvL38PlQX62VoGmEDK8pl8GL2GUQK3y+gP2VFDHepGxqqXxPLITxpdBF
-aIoQcY4YV+nJtNu8vlUzDMizCHKII+YP9JdstxOLCyEbmjLv3rk4tHgIJuOfOyRh
-3KjIcdghmNZcZ7vOvpbr341gKBNRLVmsAxtJCqqMfWvNOc6rXfp20bCnL/SDDJeB
-/71/KfVeVaffXRtfEWcwJW6YRp7p2MealzAsnUA5xscOKItYhvmJ1FJlUB8LDZ+d
-WESld2a4CIdK9lpuf3LDqy+wmcGTdnoVoi2RT68SDYHAb/bbtx0CAwEAAaOCAo4w
+bnNhbnMwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQC8sqplTuHuLjbW
+TL5SL2D1fw9U6WQzLVAF5gsyhd5lr2FpfYwjrob5Mav91aOLbJRTvoNyXsJ26FPS
+0RycRGXbomcIEJxXGy9aI+0MLYBt1G5mgqCH+HcVCwPzCNlhVnTwvpgA7y8zs3+6
+ezZAPWkF0yWOMYLtTcq9A5GWeavt5VMgm1KZF3gO4k58oPyk3Ae9D0LAaYsX6DFi
+BYx41eUR5UbSb5IYXaDd8d6jqW/jnYhgc6Cxkv1gTJFn87V5lrG0vYMSRUtWDQ9Y
+Jh/EKAxjGw7AeY429p6TE4UoJhDmoFYR2NLvawhNIplxol/v0fs0veFQjI/UsTD8
+2tRfnYL4IX8szhLsE5/5Iq8aiLHjVbIMwmDYAa0P63Ap2kf1biSn9mpDL8lQazSo
+yr8xzIq2QS5HMvGbeMAmS0ih10Zx84uVmkWlavgvtSflw8K/ZXT9c70rZp/TdBGY
+95cOFsbg5U/20M/Llpis9tcBCaoVaYSFupatrP+p8y19qP2nebsCAwEAAaOCAo4w
 ggKKMIHhBgNVHREEgdkwgdaCB2lkbnNhbnOCH3huLS1rbmlnLTVxYS5pZG4ucHl0
 aG9udGVzdC5uZXSCLnhuLS1rbmlnc2dzc2NoZW4tbGNiMHcuaWRuYTIwMDMucHl0
 aG9udGVzdC5uZXSCLnhuLS1rbmlnc2djaGVuLWI0YTNkdW4uaWRuYTIwMDgucHl0
 aG9udGVzdC5uZXSCJHhuLS1ueGFzbXE2Yi5pZG5hMjAwMy5weXRob250ZXN0Lm5l
 dIIkeG4tLW54YXNtbTFjLmlkbmEyMDA4LnB5dGhvbnRlc3QubmV0MA4GA1UdDwEB
 /wQEAwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDAYDVR0TAQH/
-BAIwADAdBgNVHQ4EFgQUVFMMPEzjY8ZWCDWcXvTBoQQ6wskwfQYDVR0jBHYwdIAU
-3b/K2ubRNLo3dSHKb5oIKPI1tkihUaRPME0xCzAJBgNVBAYTAlhZMSYwJAYDVQQK
+BAIwADAdBgNVHQ4EFgQUXL4Yf3s/zplmgHlTS90zG0KlfgAwfQYDVR0jBHYwdIAU
+s4qgorpx8agkedSkWyU2FR5JyM2hUaRPME0xCzAJBgNVBAYTAlhZMSYwJAYDVQQK
 DB1QeXRob24gU29mdHdhcmUgRm91bmRhdGlvbiBDQTEWMBQGA1UEAwwNb3VyLWNh
 LXNlcnZlcoIJAMstgJlaaVJbMIGDBggrBgEFBQcBAQR3MHUwPAYIKwYBBQUHMAKG
 MGh0dHA6Ly90ZXN0Y2EucHl0aG9udGVzdC5uZXQvdGVzdGNhL3B5Y2FjZXJ0LmNl
 cjA1BggrBgEFBQcwAYYpaHR0cDovL3Rlc3RjYS5weXRob250ZXN0Lm5ldC90ZXN0
 Y2Evb2NzcC8wQwYDVR0fBDwwOjA4oDagNIYyaHR0cDovL3Rlc3RjYS5weXRob250
 ZXN0Lm5ldC90ZXN0Y2EvcmV2b2NhdGlvbi5jcmwwDQYJKoZIhvcNAQELBQADggGB
-AAOvk6tYmHQ8oWhTGBO+VmB30KcOyYoCH5JNIRhh1z6aHaqUNwJZMTtxYtnLBOjH
-REH5Dg2Q0UqrTuK9TmAbPOsqt4rKJFhgZNOmIPb1mG7KWgqRY5dY9RiQnxdVnxLP
-Iqcx5pDaNmE71kLmGBlDuxdSKEClEUd/Mv6DPcN9ixcbXfcgPr07Fj0AAWjtdnqh
-r87N3VJ/GSLbg8GJtpACTiK8sXYMAK3FPDO+ZJIwOB+xBE9Tokr7Y4AhiwNyckvf
-8Z0IdfCUBtPLfN87gBlYeoXKKr+0jF3ztmUkN7IdRtofOUjy6zqEmDoMWf8KBcIs
-jLGlqUOpjkeXmtJAnLjD5kYb20uFo+HnTioeuabe7qfwYz8P4pC2gnBLk3/pdPOr
-A54EOPFGLfb+dw9KjmYjdD7GW+sO3XLDRh2k8C+2GC7xHPmFaQ5aN1746kst52Pu
-oeS59/qpEWVkobe1kYFcTbUntBaWS9/8xIomtodiVIj7HX2vlyVlJzge94ykFkby
-2Q==
+AF16+IHgp8E/OevTUizhy00ps3cYFxieEvwRzDxJy2v0TWy40vTpN/hr7fXX8eta
+QQTH84za4QWOrlhx2QGKMkay3ZVG4c6CBPoLHCl1B4XOzVnUzPNWs3JNy5APzgIh
+zl0XhJZ/agBXQrckWwclHneondpBCY4pebSwoUXIcK4shiSuPZp0pwR41h8bF8XB
+bbEa/fRQLmEWhInQQj+2v71Svcg+joe08L2tx1FlL3foaXkOA2OJ53CtyNEvGqUG
+0pDbfAc1mgsOhYfRcBeniA/GtZyIAPr5sgoZWkuNkRJRXg7B2J4CeNAtJAn+1Jc8
+y6Afmqv3D+L6ZCNOUwoVPvUEAYYpi44kQC+xkIdcO3unTAavw5B/6cZWQmEVLIPx
+fE+JF/OgETQ/ja91NGAe4PLzAueqs/efHPhp9P7aV24blVNwze22uyqE66vDqbTV
+FaCyzIEt8VbBVJtfFExfrV/1Bu4iYEXkUDVkrKzKSr+GePhTLRfY6ITIB6TCKXbH
+Hw==
 -----END CERTIFICATE-----
diff --git a/Lib/test/imghdrdata/python.gif b/Lib/test/imghdrdata/python.gif
index 96fd9fe..efa0be3 100644
--- a/Lib/test/imghdrdata/python.gif
+++ b/Lib/test/imghdrdata/python.gif
Binary files differ
diff --git a/Lib/test/inspect_stock_annotations.py b/Lib/test/inspect_stock_annotations.py
new file mode 100644
index 0000000..d115a25
--- /dev/null
+++ b/Lib/test/inspect_stock_annotations.py
@@ -0,0 +1,28 @@
+a:int=3
+b:str="foo"
+
+class MyClass:
+    a:int=4
+    b:str="bar"
+    def __init__(self, a, b):
+        self.a = a
+        self.b = b
+    def __eq__(self, other):
+        return isinstance(other, MyClass) and self.a == other.a and self.b == other.b
+
+def function(a:int, b:str) -> MyClass:
+    return MyClass(a, b)
+
+
+def function2(a:int, b:"str", c:MyClass) -> MyClass:
+    pass
+
+
+def function3(a:"int", b:"str", c:"MyClass"):
+    pass
+
+
+class UnannotatedClass:
+    pass
+
+def unannotated_function(a, b, c): pass
diff --git a/Lib/test/inspect_stringized_annotations.py b/Lib/test/inspect_stringized_annotations.py
new file mode 100644
index 0000000..a56fb05
--- /dev/null
+++ b/Lib/test/inspect_stringized_annotations.py
@@ -0,0 +1,34 @@
+from __future__ import annotations
+
+a:int=3
+b:str="foo"
+
+class MyClass:
+    a:int=4
+    b:str="bar"
+    def __init__(self, a, b):
+        self.a = a
+        self.b = b
+    def __eq__(self, other):
+        return isinstance(other, MyClass) and self.a == other.a and self.b == other.b
+
+def function(a:int, b:str) -> MyClass:
+    return MyClass(a, b)
+
+
+def function2(a:int, b:"str", c:MyClass) -> MyClass:
+    pass
+
+
+def function3(a:"int", b:"str", c:"MyClass"):
+    pass
+
+
+class UnannotatedClass:
+    pass
+
+def unannotated_function(a, b, c): pass
+
+class MyClassWithLocalAnnotations:
+    mytype = int
+    x: mytype
diff --git a/Lib/test/inspect_stringized_annotations_2.py b/Lib/test/inspect_stringized_annotations_2.py
new file mode 100644
index 0000000..87206d5
--- /dev/null
+++ b/Lib/test/inspect_stringized_annotations_2.py
@@ -0,0 +1,3 @@
+from __future__ import annotations
+
+def foo(a, b, c):  pass
diff --git a/Lib/test/keycert2.pem b/Lib/test/keycert2.pem
index ed6ae85..e59d454 100644
--- a/Lib/test/keycert2.pem
+++ b/Lib/test/keycert2.pem
@@ -1,66 +1,66 @@
 -----BEGIN PRIVATE KEY-----
-MIIG/QIBADANBgkqhkiG9w0BAQEFAASCBucwggbjAgEAAoIBgQDKjrjWZlfOs1Ch
-qt1RoyLfqyXbHVXIAW0fTzAxfJnxvFOiWqAAKgC2qVQM8Y080kRUuRaXP/w9ywXT
-+MzX6tByy5VbTYJYyTjHOH46EWLNdcqEJs4+FCVqOIYrQPQ6pGAhCXmgBy4Vb42J
-ABLwb+Kt+y2Dk15tggVcAHP2Khri+lRXWvda+kZAe2F1IojmuWyCTy3FEYHic5qN
-BsXcf6u1oyFV8MybOuz1zGj3vd2C+dEKO4Ohw9rRwnvHSatjM+CfwiXf8kTXzDBF
-Z/8W3+6yA49pHxRbG7FE3K1TAPhkrp+BVTIUOcdI74wEA6UEkWFF5sQcmmAth59M
-EQrl2CXorftEPhsKZE59dUP1+nYAPvR/mTySNCSw7/rvdf+csRSZ5ollMu/lxsht
-ulJYJI03+IiDTn47FI5D+IF25REK7d4LzGIo6T73ktsT+qpSXHuTWC+IABm8AMF9
-7ljxHSwMRU/z+O5uiONRItDAgKH/OItFG54PtY2vAhaO0YiZrZcCAwEAAQKCAYB2
-hTo8IVghlySH5B1p5kXCkDcvVaPaypLaLhCp9Blzq9lX9yUF043lU4Ddrf0RaIsY
-88/3IjZqxb+cP0lE0Z20fdDfwqORZfQ2BaU+PuwMAm9EEhy9kDYwR/ChoHkHUyT4
-T7392BWr70Dmt8ddLmp5mK4R/gnTk6+lHJK9p/dhdk4haxWvAyBWHJty2Yk3T6nh
-OYkzdUIFidUVza+6jG2hc1lPGv3tmnYKgNeulkblm10oWphz79C6ycx5WG7TNgef
-CQ3z7//Nn89YTiaUBjLvoLvxRTMwO96r7E/FaslSl/fWnF3HP3lut26Z/mNfhiwj
-qn7AhUwpSNPV0qcxFWXr/rXUjdk745wv8wOODK8atjjE/vt/MRBK0rAOIPSm3ecx
-37PKNtR4i+sNeDEcY1IyTHE6wFvJSy5y8AFpn5y8tbqYfhlEVWZ4pcnlrKxhWm7j
-oBkB/4GBjKQgbQ7ttym9eNG1wIbZ8v9N06+yeLs/NCc4bFZEgcWjFqBH1bLtAYEC
-gcEA8tt8iYNqbsDH2ognjEmbbBxrDBmyYcEKRpg1i1SUopcZl8i93IHpG7EgJIaj
-l7aWSbASAxjnK02t0VZ3nNS60acibzRwY/+e8OrSqlQdMXlAB2ggBA86drDJpfBl
-WGJG8TJVY9bc1TU2uuwtZR1LAMSsRHVp+3IvKLpHrne5exPd3x6KGYcuaM+Uk/rE
-u6tLsFNwaCdh+iBFFDT2bnYIw7jAsokJUkwxMVxSC0/21s2blhO/q5LsN1gFC1kN
-TbpXAoHBANWE7TmG2szPvujPwrK18v6iJlHCA2n50AgAQXrsetj2JcF3HYHYdHnq
-z36MQ6FpBKOiQumozWvb32WTjEwdG2kix7GEfam4DAUBdqYuCHzPcR12K5Tc8hsX
-NG7JXUAeS8ZJEiOdu95X59JHyBxUQtNfte5rcbaV17SVw6K6bsWVJnj60YjtJrpa
-xHvv1ZRnT2WEzJGpA+ii1h3I52N7ipGBiw172qcW+bKJukMi8eHxx5CC9e5tBpnu
-C+Ou/eYewQKBwHxNa0jXQrq9YY2w8s0TP8HuKbxfyrXOIHxRm9ZczFcMD8VosgUT
-WUUbO+B2KXWVtwawYAfFz0ySzcy//SkAmT6F1VIl/QCx7aBSENGti+Ous98WpIxv
-XvUxN4T/rl+2raj2ok4fw5g9TG4QRIvkmmciQyonDr/sicbG0bmy/fTJDl8NOpIm
-ZtKurNWxHNERtAPkMTyeK7/ilHjrQtb3AzVqcvbuvR6qcONa5YN0wlrfkisWoJwo
-707EdpCAXBbUsQKBwQCnpzcpu2Sj+t9ZKIElF87T93gFLETH+ppJHgJMRdDz+NqO
-fTwTD2XtsNz57aLQ44f8AFVv6NZbQYq41FEOFrDGLcQE9BZDpDrz10FVnMGXVr7n
-tjjkK1SCxwapkr0AsoknCYsPojO4kud46loLPHI4TGeq7HyeNCvqJMo3RRHjXIiX
-58GNNUD6hHjRI/FdFH14Jf0GxmJGUU20l2Jwb7nPJJuNm9mE53pqoNA7FP4+Pj1H
-kD0Q2FSdmxeE0IuWHEECgcBgw6ogJ/FRRGLcym+aApqP9BChK+W8FDfDc9Mi4p/J
-g+XmetWNFGCGTlOefGqUDIkwSG+QVOEN3hxziXbsjnvfpGApqoaulAI5oRvrwIcj
-QIvD2mt0PB52k5ZL9QL2K9sgBa43BJDyCKooMAlTy2XMM+NyXVxQKmzf3r3jQ5sl
-Rptk7ro38a9G8Rs99RFDyOmP1haOM0KXZvPksN4nsXuTlE01cnwnI29XKAlEZaoA
-pQPLXD8W/KK4mwDbmokYXmo=
+MIIG/QIBADANBgkqhkiG9w0BAQEFAASCBucwggbjAgEAAoIBgQCf8FWxi4oVlDVx
+e8NDFgb+IYAGr/hZWuY1Zq7d7g57yPoxJrgt+bN89+U7qTduqyB2Hy8G0TqeACOr
+IdpPZ8P7V5E5YiASwfJ72nbVo7qR9DAKA5FE8PU0bJFmFLjDDihc970zc4ilRDfR
+WylUpj68nefOY4CzFzeiqVOLX2wezs7Z0hflkSXGBmC0j1FbQU2I3YJg3CKCabhT
+tU6OyKItzjJ2vVaOoQ+B0Kv8leaRQ6ANZBAFQF2LepSy5F2+oSD+QHjPr+012V5D
+mrsdIc9We8YyonS1u/3HI7lLohf3W+qFroQWjn0DJI56ScV1uEr/B0+hn2jBRTM5
+d1F9BeVWm1u8BOJu50CvOeuxiVLsxJpa4T41DJznJk5V+hE4hKvDKmlrwulsRp8o
+jUEyUi8dzWOBRfAijIWv3qAPjGA/J33n6+PllCczC2BsVZhVmLqSMCwp1g2JTCM/
+KC7T4vOl/EGkm76fcmLeA1Ef8oUdRg+3T77VP+HqZ2JP06J8O8MCAwEAAQKCAYAw
+YvJZ82BEJQGCIrIxMpHNAm+MFmKpDdIFp9oRdDrXgjcG9bLU3e1KSmkEgq4tggIh
+GlAM3PHB6ULhPC2ixj7JZHWgCaqwYhKtG6vF+HGyRFDgRrIFTGyyfoICgxReloLp
+lV2dGj/l19yXLuAzJtRmFdOSYhIGnGiNgnKvAKBiNajoxyHJpv7piPZqyc0QMZJ2
+bKVMDm02TSuhz4FDuzktaGtl9uQf5GQfnvTZRrRpkC70vigGnrFuSBiCgopF6NLq
+6AXl8YS3Jcu2oGWrZDfS/GlG1QmvGGsmr9wndJSGG43jcpcRZt0g1nJNu4Fioq3e
+7y6Gap9TEsciuQOv/6RD457XkNARmTQxFpEwmSgOPQn2pFcDspo71Ej7azzL/Z+3
+jvnVo3wxgxBcrpyh+vhBtJARp4pT4anW4PcD6IcPSOWbnI8Ldoj1XN5QkJcBcykK
+6LmsAUqsmEQDNsmnGZWyYSCns4P2vUJi0hwQz8UiQwgAta3xnq4v5On7l3cq35kC
+gcEA0+joOFbZBeGlCb27tDW4VCW0cQuczzuNEoBUKnsNSqy0nx1O7hgHm/f/NQDD
+cpxiD15bRQ0KM9QbQC4dGaVoLsM07hUGk97dCxQPs2zot4CodCKGohs7E154tEDP
+zVg3YS5mubUmqdqtn8ZCKeeZye/Tv2ageyF300sEgj2Cd7EZ8S4sB0PxZ2tqT3jy
+cBL5cDruLEWuHIQjN7WwSjxnXocpb1OU7dJ+v4zFPCkSCOoa0DTTw4jFhPEOBdqV
+T619AoHBAME3QyW4QVtU2Ct9u0B1XThhqSEyOpUrcH9nOoefggwP4WF3phVx16BG
+aDKUIGQ62klRa5fi2eooxcjQRLv1sWO0UzssnO6ABMnGkUiRdrowo6xukNak0RTp
+0gvNoJ0SZxGF0yWSCw1Rq3qP2Koj7XDumFChAzLMyUsnoOl29SA7GfXcZp1pZTiq
+kOfFMWt0CIHu/EK03YWcd4vfQEq6lus39RCSXuL++Jva3yiEl5s069RFZvP1bNrD
+emkfetDSPwKBwQClk+8fVnzs44sZOW9ZOEB3P57mVbSJGHb6Zdtd9hhEqP3Y9gWe
+dJg9fmGjAJ23CAp3B7s5ER9PsAQ6+c0zJNNq9ox9G2CwWgtNhLdf81FDUPxPAktA
+jxZx4/dcoOe+A5gCD0elA67aOUxA86DvLVA1QXeqrn3muBfwuUUknvs6mt8yXGl6
+o9QUgxHmVxLYD3tn/iPr4+ZP0c/Sz9yXpOsAKYxuuFg+G6N9+HiEsXKuFH4vAZgV
+yODNJ61VVZ4lS+ECgcAqFqOl39E81+qO7sCPdgFsermg5ZQlUmUbG52AVZq6jesG
+lE21disGWs/v1JyJuNg8CGRrnZriiycqa1PNreOKWImY5kr5GSHx4jNbn3RBcr70
+nNEoMJbq+1QqBgzqqkuRYZlxIbMOn6++7v6/cTwT0aWUSr6rnjhrCqLeuG8FKlqp
+V+1ydLb79QvDsQzm30vLIggJb+ShakgQS/1xSdv+OR5FEd1hjTESokbiSJ/Ny2Vj
+xAp9MgUYUmSj6ZuTSXkCgcAggshdRQLom/EK2pYwffIpKfBiyLbi+KIjKxkiPEsb
+jrrQbvh9ZN6iAG3StVAYB5c6vewfeIlcDT0YJDyy1hGRLRG7vf9ubPf+n7Xp1y0W
+oo9L9qfCHu0jmWwtinkFYjpTDkXlxXCG2v3TllNsNX/5afYo8sb9oxXHLTpBlwZB
+fw6IgNZblWQevdgmUMTP9W2W7AZUxEz4gOM6lQkOwC3U59Dx2yO6rD3An6G1tlZF
+2MClyf8o5d5ePObH8rkxrpY=
 -----END PRIVATE KEY-----
 -----BEGIN CERTIFICATE-----
-MIIEYjCCAsqgAwIBAgIJAJm2YulYpr+6MA0GCSqGSIb3DQEBCwUAMGIxCzAJBgNV
-BAYTAlhZMRcwFQYDVQQHDA5DYXN0bGUgQW50aHJheDEjMCEGA1UECgwaUHl0aG9u
-IFNvZnR3YXJlIEZvdW5kYXRpb24xFTATBgNVBAMMDGZha2Vob3N0bmFtZTAeFw0x
-ODA4MjkxNDIzMTZaFw0yODA4MjYxNDIzMTZaMGIxCzAJBgNVBAYTAlhZMRcwFQYD
-VQQHDA5DYXN0bGUgQW50aHJheDEjMCEGA1UECgwaUHl0aG9uIFNvZnR3YXJlIEZv
-dW5kYXRpb24xFTATBgNVBAMMDGZha2Vob3N0bmFtZTCCAaIwDQYJKoZIhvcNAQEB
-BQADggGPADCCAYoCggGBAMqOuNZmV86zUKGq3VGjIt+rJdsdVcgBbR9PMDF8mfG8
-U6JaoAAqALapVAzxjTzSRFS5Fpc//D3LBdP4zNfq0HLLlVtNgljJOMc4fjoRYs11
-yoQmzj4UJWo4hitA9DqkYCEJeaAHLhVvjYkAEvBv4q37LYOTXm2CBVwAc/YqGuL6
-VFda91r6RkB7YXUiiOa5bIJPLcURgeJzmo0Gxdx/q7WjIVXwzJs67PXMaPe93YL5
-0Qo7g6HD2tHCe8dJq2Mz4J/CJd/yRNfMMEVn/xbf7rIDj2kfFFsbsUTcrVMA+GSu
-n4FVMhQ5x0jvjAQDpQSRYUXmxByaYC2Hn0wRCuXYJeit+0Q+GwpkTn11Q/X6dgA+
-9H+ZPJI0JLDv+u91/5yxFJnmiWUy7+XGyG26UlgkjTf4iINOfjsUjkP4gXblEQrt
-3gvMYijpPveS2xP6qlJce5NYL4gAGbwAwX3uWPEdLAxFT/P47m6I41Ei0MCAof84
-i0Ubng+1ja8CFo7RiJmtlwIDAQABoxswGTAXBgNVHREEEDAOggxmYWtlaG9zdG5h
-bWUwDQYJKoZIhvcNAQELBQADggGBAMIVLp6e6saH2NQSg8iFg8Ewg/K/etI++jHo
-gCJ697AY02wtfrBox1XtljlmI2xpJtVAYZWHhrNqwrEG43aB7YEV6RqTcG6QUVqa
-NbD8iNCnMKm7fP89hZizmqA1l4aHnieI3ucOqpgooM7FQwLX6qk+rSue6lD5N/5f
-avsublnj8rNKyDfHpQ3AWduLoj8QqctpzI3CqoDZNLNzaDnzVWpxT1SKDQ88q7VI
-W5zb+lndpdQlCu3v5HM4w5UpwL/k1htl/z6PnPseS2UdlXv6A8KITnCLg5PLP4tz
-2oTAg9gjOtRP/0uwkhvicwoFzFJNVT813lzTLE1jlobMPiZhsS1mjaJGPD9GQZDK
-ny3j8ogrIRGjnI4xpOMNNDVphcvwtV8fRbvURSHCj9Y4kCLpD5ODuoyEyLYicJIv
-GZP456GP0iSCK5GKO0ij/YzGCkPWD5zA+mYFpMMGZPTwajenMw7TVaPXcc9CZBtr
-oOjwwiLEqdkpxUj13mJYTlt5wsS/Kw==
+MIIEbTCCAtWgAwIBAgIUF15VKdwjiTzzKgs6PnNpEekV9QQwDQYJKoZIhvcNAQEL
+BQAwYjELMAkGA1UEBhMCWFkxFzAVBgNVBAcMDkNhc3RsZSBBbnRocmF4MSMwIQYD
+VQQKDBpQeXRob24gU29mdHdhcmUgRm91bmRhdGlvbjEVMBMGA1UEAwwMZmFrZWhv
+c3RuYW1lMB4XDTIxMDMxNzA4NDgyMFoXDTQwMDUxNjA4NDgyMFowYjELMAkGA1UE
+BhMCWFkxFzAVBgNVBAcMDkNhc3RsZSBBbnRocmF4MSMwIQYDVQQKDBpQeXRob24g
+U29mdHdhcmUgRm91bmRhdGlvbjEVMBMGA1UEAwwMZmFrZWhvc3RuYW1lMIIBojAN
+BgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAn/BVsYuKFZQ1cXvDQxYG/iGABq/4
+WVrmNWau3e4Oe8j6MSa4LfmzfPflO6k3bqsgdh8vBtE6ngAjqyHaT2fD+1eROWIg
+EsHye9p21aO6kfQwCgORRPD1NGyRZhS4ww4oXPe9M3OIpUQ30VspVKY+vJ3nzmOA
+sxc3oqlTi19sHs7O2dIX5ZElxgZgtI9RW0FNiN2CYNwigmm4U7VOjsiiLc4ydr1W
+jqEPgdCr/JXmkUOgDWQQBUBdi3qUsuRdvqEg/kB4z6/tNdleQ5q7HSHPVnvGMqJ0
+tbv9xyO5S6IX91vqha6EFo59AySOeknFdbhK/wdPoZ9owUUzOXdRfQXlVptbvATi
+budArznrsYlS7MSaWuE+NQyc5yZOVfoROISrwyppa8LpbEafKI1BMlIvHc1jgUXw
+IoyFr96gD4xgPyd95+vj5ZQnMwtgbFWYVZi6kjAsKdYNiUwjPygu0+LzpfxBpJu+
+n3Ji3gNRH/KFHUYPt0++1T/h6mdiT9OifDvDAgMBAAGjGzAZMBcGA1UdEQQQMA6C
+DGZha2Vob3N0bmFtZTANBgkqhkiG9w0BAQsFAAOCAYEARzdkuqa0Hexi/saMkdi3
+bubpQkc7X0RYKWnjy/PgcmbvQXLiWRMZOH9rMWvd5v+ZfkgAtsbOQuP8ycioNIFY
+Il5SEmxHEN81z5UNSPLOib6ky13gzrnXRAxnnO7cICG7AaMu1dHv57fqjevcx/n/
+nxPNKwKL+TDpMw7ATVZw7Py7JciKyFAfwtkvt17j/ldvaQvuwmWHzyFVrQniQcQq
+QEa4jy/Y/pXHAgCKq1qbe0ush17j1ChyH7l4SkF2xJKcYYQF5ipw8zg6WeOL2NFE
+G1KDJN0SsMmM3PMN1e0lLQP3G+UaatervrKXu51QleKL32Xlby+pp1w9KKs39/Tb
+RT8EMe9A6cecod6TL0ZUQHow6ykNYBkfSKDLTKWnL9ifZ0C/DvgmS7DpJg3oAa1e
+GhIglMrgqJflTHAI/PvEsCKM1O0Un2dVGWsUCzPfhj1cKmagyb0Zd+2Tk9xGSRs9
+2ceXMxRCjOJwEHUCFuTYeqowabdlpi0nyPbSn7JIwCpT
 -----END CERTIFICATE-----
diff --git a/Lib/test/keycert3.pem b/Lib/test/keycert3.pem
index e0a8205..f6887ba 100644
--- a/Lib/test/keycert3.pem
+++ b/Lib/test/keycert3.pem
@@ -1,84 +1,84 @@
 -----BEGIN PRIVATE KEY-----
-MIIG/QIBADANBgkqhkiG9w0BAQEFAASCBucwggbjAgEAAoIBgQCfKC83Qe9/ZGMW
-YhbpARRiKco6mJI9CNNeaf7A89TE+w5Y3GSwS8uzqp5C6QebZzPNueg8HYoTwN85
-Z3xM036/Qw9KhQVth+XDAqM+19e5KHkYcxg3d3ZI1HgY170eakaLBvMDN5ULoFOw
-Is2PtwM2o9cjd5mfSuWttI6+fCqop8/l8cerG9iX2GH39p3iWwWoTZuYndAA9qYv
-07YWajuQ1ESWKPjHYGTnMvu4xIzibC1mXd2M6u/IjNO6g426SKFaRDWQkx01gIV/
-CyKs9DgZoeMHkKZuPqZVOxOK+A/NrmrqHFsPIsrs5wk7QAVju5/X1skpn/UGQlmM
-RwBaQULOs1FagA+54RXU6qUPW0YmhJ4xOB4gHHD1vjAKEsRZ7/6zcxMyOm+M1DbK
-RTH4NWjVWpnY8XaVGdRhtTpH9MjycpKhF+D2Zdy2tQXtqu2GdcMnUedt13fn9xDu
-P4PophE0ip/IMgn+kb4m9e+S+K9lldQl0B+4BcGWAqHelh2KuU0CAwEAAQKCAYEA
-lKiWIYjmyRjdLKUGPTES9vWNvNmRjozV0RQ0LcoSbMMLDZkeO0UwyWqOVHUQ8+ib
-jIcfEjeNJxI57oZopeHOO5vJhpNlFH+g7ltiW2qERqA1K88lSXm99Bzw6FNqhCRE
-K8ub5N9fyfJA+P4o/xm0WK8EXk5yIUV17p/9zJJxzgKgv2jsVTi3QG2OZGvn4Oug
-ByomMZEGHkBDzdxz8c/cP1Tlk1RFuwSgews178k2xq7AYSM/s0YmHi7b/RSvptX6
-1v8P8kXNUe4AwTaNyrlvF2lwIadZ8h1hA7tCE2n44b7a7KfhAkwcbr1T59ioYh6P
-zxsyPT678uD51dbtD/DXJCcoeeFOb8uzkR2KNcrnQzZpCJnRq4Gp5ybxwsxxuzpr
-gz0gbNlhuWtE7EoSzmIK9t+WTS7IM2CvZymd6/OAh1Fuw6AQhSp64XRp3OfMMAAC
-Ie2EPtKj4islWGT8VoUjuRYGmdRh4duAH1dkiAXOWA3R7y5a1/y/iE8KE8BtxocB
-AoHBAM8aiURgpu1Fs0Oqz6izec7KSLL3l8hmW+MKUOfk/Ybng6FrTFsL5YtzR+Ap
-wW4wwWnnIKEc1JLiZ7g8agRETK8hr5PwFXUn/GSWC0SMsazLJToySQS5LOV0tLzK
-kJ3jtNU7tnlDGNkCHTHSoVL2T/8t+IkZI/h5Z6wjlYPvU2Iu0nVIXtiG+alv4A6M
-Hrh9l5or4mjB6rGnVXeYohLkCm6s/W97ahVxLMcEdbsBo1prm2JqGnSoiR/tEFC/
-QHQnbQKBwQDEu7kW0Yg9sZ89QtYtVQ1YpixFZORaUeRIRLnpEs1w7L1mCbOZ2Lj9
-JHxsH05cYAc7HJfPwwxv3+3aGAIC/dfu4VSwEFtatAzUpzlhzKS5+HQCWB4JUNNU
-MQ3+FwK2xQX4Ph8t+OzrFiYcK2g0An5UxWMa2HWIAWUOhnTOydAVsoH6yP31cVm4
-0hxoABCwflaNLNGjRUyfBpLTAcNu/YtcE+KREy7YAAgXXrhRSO4XpLsSXwLnLT7/
-YOkoBWDcTWECgcBPWnSUDZCIQ3efithMZJBciqd2Y2X19Dpq8O31HImD4jtOY0V7
-cUB/wSkeHAGwjd/eCyA2e0x8B2IEdqmMfvr+86JJxekC3dJYXCFvH5WIhsH53YCa
-3bT1KlWCLP9ib/g+58VQC0R/Cc9T4sfLePNH7D5ZkZd1wlbV30CPr+i8KwKay6MD
-xhvtLx+jk07GE+E9wmjbCMo7TclyrLoVEOlqZMAqshgApT+p9eyCPetwXuDHwa3n
-WxhHclcZCV7R4rUCgcAkdGSnxcvpIrDPOUNWwxvmAWTStw9ZbTNP8OxCNCm9cyDl
-d4bAS1h8D/a+Uk7C70hnu7Sl2w7C7Eu2zhwRUdhhe3+l4GINPK/j99i6NqGPlGpq
-xMlMEJ4YS768BqeKFpg0l85PRoEgTsphDeoROSUPsEPdBZ9BxIBlYKTkbKESZDGR
-twzYHljx1n1NCDYPflmrb1KpXn4EOcObNghw2KqqNUUWfOeBPwBA1FxzM4BrAStp
-DBINpGS4Dc0mjViVegECgcA3hTtm82XdxQXj9LQmb/E3lKx/7H87XIOeNMmvjYuZ
-iS9wKrkF+u42vyoDxcKMCnxP5056wpdST4p56r+SBwVTHcc3lGBSGcMTIfwRXrj3
-thOA2our2n4ouNIsYyTlcsQSzifwmpRmVMRPxl9fYVdEWUgB83FgHT0D9avvZnF9
-t9OccnGJXShAIZIBADhVj/JwG4FbaX42NijD5PNpVLk1Y17OV0I576T9SfaQoBjJ
-aH1M/zC4aVaS0DYB/Gxq7v8=
+MIIG/gIBADANBgkqhkiG9w0BAQEFAASCBugwggbkAgEAAoIBgQDFtLOteQlQojN7
+ztkux7m0hmGKkP1hh0hbKqTcD87jkLAqAwZWenjZMjCbbZ3vP+AObCIkYIKzPXY7
+Yi+H5M3O2mXIDxoHGjL/GWtoEyDNXvm9UC+MRuSOq2MaLHHQG0Rx2TxcYrMVUM7b
+93rpN1LGRrCv1gISXM4EvEJooAR7Aadj0pG/o0fqDAdFjH6QZbhn1iZle+eGbjcf
+dgH/H0F8dn1PPGoViHXicbsQ4kB6002Pf+aXP4b2QKAbflyNHEKHPHEOOTXrFjMd
+c+bqKW24epEsMZI59qx9hU/4Rvp3/v+vEwTL7Nm7ilptzZn2cvGCW39LC0nNYLOz
+kO3H8xwA75h6uykdB+WO/v2CKIK9M/ZO+9QNrmaokfKDamCk39b8hlCwNL6LsVpv
+d3XTS5Wn4YWn92EqiltUJJoPo7pc7VTdWCg4zVFn4Q8Zh4NFNn/qTB8lEMgrsNTV
+5cyZ7zhoBiUMSO45bmo2NsnE7ce/JUhlqe5uh0PT1MIBgTV+oDMCAwEAAQKCAYEA
+udsy4gwblqK0tVnxz0lQqYV+os3EdO/BNHr1Oi7eNg2pngTz603812mYSjUVOHma
+vtQmkH3twGQyBoc52Y1dcGzdK+IOfMjDUg7qao840ffL3I1J9ZwbdodlhZBsec94
+W3J1jP/4DDzICf8vm5g3h0+i/9m2Xt7BibAU2dg7/grC+lNUUoxDqaEfIOF/hW0q
+muq1c8e0EisAROIh5FzUqhWVnWxU6eM7tuFlkuyu4whLLHB3LI466Lo+CTqT9M+v
+jJYlvS5+AZW3qMBp6WOI8C+VIiBL178mo+Igkyyy5AYXcWeNkjp6ygRWvtWXIhCv
+CI29mf+BP/54jAY0rQRXJ2UcSHXmM6PTDkE/L2OKeiY1Ou8gLOwun3yBVdbkXJMb
+PWmUW4N8qSIJQ+vE2TDqmkqAT6m+ilzOXl1O+LLTvGyMnOiiSLXK9mC4ND3tqaQu
+hvKivnI1doErcWUaIf1DHiJmLrGxrTCUKjCEoefqVq2/dDdtCfx7CqUvjl3DYKMB
+AoHBAP+Vdi6D07gZFepEGCaJ+YH6cxEyO73CNnea/F1whVAzOv91kHS32jC9PAI3
+/wYlX+DLcN9mVF/q62V4SLZYfOxTPW4vWO0A45URe9s9Z795fdAcQ5jt3QFOVSnk
+3XSaCkIOwckuwabGJi4+foiUEOnLLzQi1/g7x12dwejxVNhqhz5KFkOQPv8fQRed
+sb5LVLYDeprsB2Vsx0fHwg4z9FvTIxLBeI7+sJD30lNpYZrCl/T9x4e1SV2Rwn2W
+bghxgQKBwQDGBx07biZK9RB5g4qPl+G6vz0M+/KBfpwQbMYxSyct7u6gfGD9mWBO
+qocIIr39Unac3kUL237Cn3HbgiGCRe7Mwd7XqnSSGWM5oWSlVQxEKTXYUlTbd9O9
+DKuyQGOl/AMEwD4ZbEOfQNmnd1U4nh1AV052FQY8Ry/atGFT9fApA/5X/bbenOwQ
+YGDsokLzPf2BIDncpE+VNevUMoMI7EnySgjjfpL+cRld0qpLqBMo2h5VddeJ/5YM
+1YcNfMQiw7MCgcEAwXqXuKa7A8aZvHpH/gS9CRRbP01TxFbdfLWrDeE8SnY9111c
+Ob9kQTk/0D4rpK9uYXIgxD1m6iWghXQFN2TNTOnGuz7EhsYBgrt1k4Zsn5qND5oV
+4hNPFsoB1nEW5EooMdGSCYaHuoSOKrvMdgAAvbu+xC0MaTJ3vfrK7Fik7h/WueTD
+7emohuFWGVabU38bZZ5EljrPboxmX4Rs9uuFtG2lQ3GKnlVXvKaeZd6EsO9WsXPc
+NHOcUmUhYokaSvIBAoHAGCxGJTsM8Zl4qVylTWH87A7sJOmccLJD2r1sdBf4cGL6
+PhzwugQ+/VtToGqdRo8Ka5u2Ufw5PQi5nVIFRSHERLpluW3VTQBMXHyXDJeVJ7zg
+Fcf3E9NMxYcGbnvtrhVVSP8ulWvh1U7VQtwOSxsB9xixOzjVygXmkYvzVYxwBJG4
+OoV+DS6aomUhb8Fe6tJmX5zPc1+bV1t9ril8VVqCrFDdROfuiaDEt+8/Wnzp2dLG
+YShBZ1cLugVWtw7D4nqBAoHAF29k64iAxY5Y4OOibVkqjUCPyqG2oxiXqgO7CxZp
+FGUat5UtV2mIBlSENs1o5AZ1nPlgWtPtg0xVCaG2t/Rq7ugvUfAnAhUK6zX8FS+T
+gCXE+7iKuuIJiCo13/iAwF/CLfuXvj4CZ71ta0wX9w99f1FcPEk0x+ytiyuWJK8K
+tyubL34JwNrnkh/8e3LcV3L88Sk9ZmxeTz31f3cA3Fy2ZJOAUMD9dKXeKtY7azzt
+MkhXedRsdLSKqMh0VGeGHoLS
 -----END PRIVATE KEY-----
 Certificate:
     Data:
         Version: 3 (0x2)
         Serial Number:
             cb:2d:80:99:5a:69:52:5c
-    Signature Algorithm: sha256WithRSAEncryption
+        Signature Algorithm: sha256WithRSAEncryption
         Issuer: C=XY, O=Python Software Foundation CA, CN=our-ca-server
         Validity
             Not Before: Aug 29 14:23:16 2018 GMT
-            Not After : Jul  7 14:23:16 2028 GMT
+            Not After : Oct 28 14:23:16 2037 GMT
         Subject: C=XY, L=Castle Anthrax, O=Python Software Foundation, CN=localhost
         Subject Public Key Info:
             Public Key Algorithm: rsaEncryption
-                Public-Key: (3072 bit)
+                RSA Public-Key: (3072 bit)
                 Modulus:
-                    00:9f:28:2f:37:41:ef:7f:64:63:16:62:16:e9:01:
-                    14:62:29:ca:3a:98:92:3d:08:d3:5e:69:fe:c0:f3:
-                    d4:c4:fb:0e:58:dc:64:b0:4b:cb:b3:aa:9e:42:e9:
-                    07:9b:67:33:cd:b9:e8:3c:1d:8a:13:c0:df:39:67:
-                    7c:4c:d3:7e:bf:43:0f:4a:85:05:6d:87:e5:c3:02:
-                    a3:3e:d7:d7:b9:28:79:18:73:18:37:77:76:48:d4:
-                    78:18:d7:bd:1e:6a:46:8b:06:f3:03:37:95:0b:a0:
-                    53:b0:22:cd:8f:b7:03:36:a3:d7:23:77:99:9f:4a:
-                    e5:ad:b4:8e:be:7c:2a:a8:a7:cf:e5:f1:c7:ab:1b:
-                    d8:97:d8:61:f7:f6:9d:e2:5b:05:a8:4d:9b:98:9d:
-                    d0:00:f6:a6:2f:d3:b6:16:6a:3b:90:d4:44:96:28:
-                    f8:c7:60:64:e7:32:fb:b8:c4:8c:e2:6c:2d:66:5d:
-                    dd:8c:ea:ef:c8:8c:d3:ba:83:8d:ba:48:a1:5a:44:
-                    35:90:93:1d:35:80:85:7f:0b:22:ac:f4:38:19:a1:
-                    e3:07:90:a6:6e:3e:a6:55:3b:13:8a:f8:0f:cd:ae:
-                    6a:ea:1c:5b:0f:22:ca:ec:e7:09:3b:40:05:63:bb:
-                    9f:d7:d6:c9:29:9f:f5:06:42:59:8c:47:00:5a:41:
-                    42:ce:b3:51:5a:80:0f:b9:e1:15:d4:ea:a5:0f:5b:
-                    46:26:84:9e:31:38:1e:20:1c:70:f5:be:30:0a:12:
-                    c4:59:ef:fe:b3:73:13:32:3a:6f:8c:d4:36:ca:45:
-                    31:f8:35:68:d5:5a:99:d8:f1:76:95:19:d4:61:b5:
-                    3a:47:f4:c8:f2:72:92:a1:17:e0:f6:65:dc:b6:b5:
-                    05:ed:aa:ed:86:75:c3:27:51:e7:6d:d7:77:e7:f7:
-                    10:ee:3f:83:e8:a6:11:34:8a:9f:c8:32:09:fe:91:
-                    be:26:f5:ef:92:f8:af:65:95:d4:25:d0:1f:b8:05:
-                    c1:96:02:a1:de:96:1d:8a:b9:4d
+                    00:c5:b4:b3:ad:79:09:50:a2:33:7b:ce:d9:2e:c7:
+                    b9:b4:86:61:8a:90:fd:61:87:48:5b:2a:a4:dc:0f:
+                    ce:e3:90:b0:2a:03:06:56:7a:78:d9:32:30:9b:6d:
+                    9d:ef:3f:e0:0e:6c:22:24:60:82:b3:3d:76:3b:62:
+                    2f:87:e4:cd:ce:da:65:c8:0f:1a:07:1a:32:ff:19:
+                    6b:68:13:20:cd:5e:f9:bd:50:2f:8c:46:e4:8e:ab:
+                    63:1a:2c:71:d0:1b:44:71:d9:3c:5c:62:b3:15:50:
+                    ce:db:f7:7a:e9:37:52:c6:46:b0:af:d6:02:12:5c:
+                    ce:04:bc:42:68:a0:04:7b:01:a7:63:d2:91:bf:a3:
+                    47:ea:0c:07:45:8c:7e:90:65:b8:67:d6:26:65:7b:
+                    e7:86:6e:37:1f:76:01:ff:1f:41:7c:76:7d:4f:3c:
+                    6a:15:88:75:e2:71:bb:10:e2:40:7a:d3:4d:8f:7f:
+                    e6:97:3f:86:f6:40:a0:1b:7e:5c:8d:1c:42:87:3c:
+                    71:0e:39:35:eb:16:33:1d:73:e6:ea:29:6d:b8:7a:
+                    91:2c:31:92:39:f6:ac:7d:85:4f:f8:46:fa:77:fe:
+                    ff:af:13:04:cb:ec:d9:bb:8a:5a:6d:cd:99:f6:72:
+                    f1:82:5b:7f:4b:0b:49:cd:60:b3:b3:90:ed:c7:f3:
+                    1c:00:ef:98:7a:bb:29:1d:07:e5:8e:fe:fd:82:28:
+                    82:bd:33:f6:4e:fb:d4:0d:ae:66:a8:91:f2:83:6a:
+                    60:a4:df:d6:fc:86:50:b0:34:be:8b:b1:5a:6f:77:
+                    75:d3:4b:95:a7:e1:85:a7:f7:61:2a:8a:5b:54:24:
+                    9a:0f:a3:ba:5c:ed:54:dd:58:28:38:cd:51:67:e1:
+                    0f:19:87:83:45:36:7f:ea:4c:1f:25:10:c8:2b:b0:
+                    d4:d5:e5:cc:99:ef:38:68:06:25:0c:48:ee:39:6e:
+                    6a:36:36:c9:c4:ed:c7:bf:25:48:65:a9:ee:6e:87:
+                    43:d3:d4:c2:01:81:35:7e:a0:33
                 Exponent: 65537 (0x10001)
         X509v3 extensions:
             X509v3 Subject Alternative Name: 
@@ -90,9 +90,9 @@
             X509v3 Basic Constraints: critical
                 CA:FALSE
             X509v3 Subject Key Identifier: 
-                8F:EA:1D:E3:33:5C:00:16:B3:8B:6F:6B:6F:D3:4C:CB:B5:CB:7C:55
+                85:75:10:25:D0:2C:80:50:24:1A:5B:57:70:DE:B5:CB:71:A9:3B:7B
             X509v3 Authority Key Identifier: 
-                keyid:DD:BF:CA:DA:E6:D1:34:BA:37:75:21:CA:6F:9A:08:28:F2:35:B6:48
+                keyid:B3:8A:A0:A2:BA:71:F1:A8:24:79:D4:A4:5B:25:36:15:1E:49:C8:CD
                 DirName:/C=XY/O=Python Software Foundation CA/CN=our-ca-server
                 serial:CB:2D:80:99:5A:69:52:5B
 
@@ -106,59 +106,59 @@
                   URI:http://testca.pythontest.net/testca/revocation.crl
 
     Signature Algorithm: sha256WithRSAEncryption
-         27:f5:8c:59:10:f4:c6:e7:28:00:bf:ba:8d:7b:13:03:f1:1c:
-         a6:5f:b3:06:55:a4:22:b9:db:b2:d5:46:bd:f7:0c:dd:43:6e:
-         b4:79:65:67:21:0c:2a:55:ee:40:8e:85:9f:9f:47:bb:0a:2a:
-         4d:b6:64:74:98:a0:7f:ae:dc:f1:2e:db:42:77:18:e0:75:8b:
-         26:35:68:c3:41:ed:6b:c8:77:72:6f:6a:9a:5d:55:69:02:fd:
-         5a:54:c8:57:cb:b0:65:03:16:e2:0f:00:39:99:66:a0:9b:88:
-         93:17:e2:5a:2d:79:35:5f:97:57:78:c4:af:f5:99:5e:86:ab:
-         d3:11:ad:1a:a2:0d:fa:52:10:b9:fe:bf:9d:ce:33:d9:86:b2:
-         9c:16:f8:d6:75:08:8a:db:0a:e5:b4:2b:16:7f:b4:f9:2a:9f:
-         c3:d2:77:d7:cd:65:1e:f4:6c:1e:eb:59:b9:f0:ae:5f:a4:1f:
-         cc:4a:c4:b9:7a:a9:d9:6b:32:68:3b:e1:65:b0:84:b7:90:c4:
-         ae:fe:f4:37:4f:21:a0:de:9f:3a:b1:e5:cc:16:04:66:3f:0b:
-         41:dc:42:3d:20:3e:ec:b7:95:2b:35:57:fa:be:7f:b6:3a:ba:
-         ca:4f:58:fe:75:3e:08:89:2c:8c:b0:5d:2e:f9:89:10:2b:f9:
-         41:46:4f:3c:00:b7:27:d3:65:24:28:17:23:26:31:42:ea:7e:
-         4e:93:e4:7b:68:54:ca:9f:46:f3:ef:2b:e9:85:0c:b5:84:b2:
-         d5:35:34:80:75:2b:f0:91:23:b8:08:01:8e:b9:0a:54:d4:fb:
-         34:52:fe:d9:45:f0:80:3b:b6:c1:6f:82:d1:1f:f2:3b:08:f6:
-         46:a6:96:27:61:4b:58:32:7a:0e:1d:59:c5:44:ad:5e:1a:79:
-         33:c1:d4:05:2f:4a:d3:d8:42:42:8d:33:e3:63:ca:d5:87:97:
-         9b:4d:b8:1a:03:34:bb:1c:d2:02:3f:59:23:e2:23:80:88:63:
-         c2:f0:a2:63:a8:8b
+         95:f3:56:bb:d5:8c:70:bd:d1:de:da:63:b0:29:d7:db:60:27:
+         d6:59:fd:61:1b:30:c6:d0:5d:73:7d:34:e1:68:e3:28:a6:89:
+         e6:60:bd:89:d3:0e:f4:72:ad:72:76:f8:86:21:fd:75:3c:f8:
+         6d:be:9c:04:e1:82:03:69:6c:ae:d0:55:ba:5e:f2:ca:f5:0f:
+         8e:d6:d9:8d:c8:56:46:f4:f8:ac:74:2a:19:7b:8e:47:70:1f:
+         fb:fb:bd:69:02:a1:a5:4a:6e:21:1c:04:14:15:55:bf:bf:24:
+         43:c8:17:03:be:3e:2c:ea:db:c8:af:1d:fd:52:df:d6:15:49:
+         9e:c2:44:69:ef:f1:45:43:83:b2:1e:cf:14:1c:13:3f:fe:9c:
+         71:cb:e7:1b:18:56:36:a7:af:44:f1:0b:a1:79:44:46:f9:43:
+         46:29:d8:b0:ca:49:4d:65:60:d3:f6:8e:74:bc:62:9e:1e:8d:
+         4b:29:9a:b4:0d:f0:a2:77:5b:34:e4:11:2f:a7:25:c5:e5:07:
+         76:12:ae:be:75:73:15:e4:0a:7d:53:38:56:3f:79:6d:6e:ca:
+         ed:80:ab:56:ed:7e:8b:1c:e7:e3:d4:62:30:22:70:e7:29:b2:
+         03:3c:fe:fa:3d:f0:36:c0:4d:11:a2:99:d3:29:31:27:b8:c5:
+         b8:15:a3:3c:4f:9b:73:5e:2b:b2:fb:cb:fd:75:47:b8:17:bd:
+         21:d8:e6:c1:b9:ff:73:81:d8:25:08:6d:08:5e:1c:a5:83:50:
+         de:67:e6:da:d0:8e:5a:d3:f2:2a:b1:3f:b8:80:21:07:6a:71:
+         15:6d:05:eb:51:b3:59:8d:d4:15:46:7e:02:a8:13:01:16:99:
+         bd:03:cc:70:71:2a:23:16:78:af:d1:d5:01:9d:04:b4:63:93:
+         9a:04:3a:92:2e:e6:7e:73:93:a5:fe:50:9b:bd:0e:ea:54:86:
+         6f:7c:e5:14:77:fe:c2:28:5a:4a:0e:d7:2d:8c:e9:ed:61:29:
+         b2:53:ff:6c:04:bc
 -----BEGIN CERTIFICATE-----
 MIIF8TCCBFmgAwIBAgIJAMstgJlaaVJcMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNV
 BAYTAlhZMSYwJAYDVQQKDB1QeXRob24gU29mdHdhcmUgRm91bmRhdGlvbiBDQTEW
-MBQGA1UEAwwNb3VyLWNhLXNlcnZlcjAeFw0xODA4MjkxNDIzMTZaFw0yODA3MDcx
+MBQGA1UEAwwNb3VyLWNhLXNlcnZlcjAeFw0xODA4MjkxNDIzMTZaFw0zNzEwMjgx
 NDIzMTZaMF8xCzAJBgNVBAYTAlhZMRcwFQYDVQQHDA5DYXN0bGUgQW50aHJheDEj
 MCEGA1UECgwaUHl0aG9uIFNvZnR3YXJlIEZvdW5kYXRpb24xEjAQBgNVBAMMCWxv
-Y2FsaG9zdDCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBAJ8oLzdB739k
-YxZiFukBFGIpyjqYkj0I015p/sDz1MT7DljcZLBLy7OqnkLpB5tnM8256DwdihPA
-3zlnfEzTfr9DD0qFBW2H5cMCoz7X17koeRhzGDd3dkjUeBjXvR5qRosG8wM3lQug
-U7AizY+3Azaj1yN3mZ9K5a20jr58Kqinz+Xxx6sb2JfYYff2neJbBahNm5id0AD2
-pi/TthZqO5DURJYo+MdgZOcy+7jEjOJsLWZd3Yzq78iM07qDjbpIoVpENZCTHTWA
-hX8LIqz0OBmh4weQpm4+plU7E4r4D82uauocWw8iyuznCTtABWO7n9fWySmf9QZC
-WYxHAFpBQs6zUVqAD7nhFdTqpQ9bRiaEnjE4HiAccPW+MAoSxFnv/rNzEzI6b4zU
-NspFMfg1aNVamdjxdpUZ1GG1Okf0yPJykqEX4PZl3La1Be2q7YZ1wydR523Xd+f3
-EO4/g+imETSKn8gyCf6Rvib175L4r2WV1CXQH7gFwZYCod6WHYq5TQIDAQABo4IB
+Y2FsaG9zdDCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBAMW0s615CVCi
+M3vO2S7HubSGYYqQ/WGHSFsqpNwPzuOQsCoDBlZ6eNkyMJttne8/4A5sIiRggrM9
+djtiL4fkzc7aZcgPGgcaMv8Za2gTIM1e+b1QL4xG5I6rYxoscdAbRHHZPFxisxVQ
+ztv3euk3UsZGsK/WAhJczgS8QmigBHsBp2PSkb+jR+oMB0WMfpBluGfWJmV754Zu
+Nx92Af8fQXx2fU88ahWIdeJxuxDiQHrTTY9/5pc/hvZAoBt+XI0cQoc8cQ45NesW
+Mx1z5uopbbh6kSwxkjn2rH2FT/hG+nf+/68TBMvs2buKWm3NmfZy8YJbf0sLSc1g
+s7OQ7cfzHADvmHq7KR0H5Y7+/YIogr0z9k771A2uZqiR8oNqYKTf1vyGULA0voux
+Wm93ddNLlafhhaf3YSqKW1Qkmg+julztVN1YKDjNUWfhDxmHg0U2f+pMHyUQyCuw
+1NXlzJnvOGgGJQxI7jluajY2ycTtx78lSGWp7m6HQ9PUwgGBNX6gMwIDAQABo4IB
 wDCCAbwwFAYDVR0RBA0wC4IJbG9jYWxob3N0MA4GA1UdDwEB/wQEAwIFoDAdBgNV
 HSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDAYDVR0TAQH/BAIwADAdBgNVHQ4E
-FgQUj+od4zNcABazi29rb9NMy7XLfFUwfQYDVR0jBHYwdIAU3b/K2ubRNLo3dSHK
-b5oIKPI1tkihUaRPME0xCzAJBgNVBAYTAlhZMSYwJAYDVQQKDB1QeXRob24gU29m
+FgQUhXUQJdAsgFAkGltXcN61y3GpO3swfQYDVR0jBHYwdIAUs4qgorpx8agkedSk
+WyU2FR5JyM2hUaRPME0xCzAJBgNVBAYTAlhZMSYwJAYDVQQKDB1QeXRob24gU29m
 dHdhcmUgRm91bmRhdGlvbiBDQTEWMBQGA1UEAwwNb3VyLWNhLXNlcnZlcoIJAMst
 gJlaaVJbMIGDBggrBgEFBQcBAQR3MHUwPAYIKwYBBQUHMAKGMGh0dHA6Ly90ZXN0
 Y2EucHl0aG9udGVzdC5uZXQvdGVzdGNhL3B5Y2FjZXJ0LmNlcjA1BggrBgEFBQcw
 AYYpaHR0cDovL3Rlc3RjYS5weXRob250ZXN0Lm5ldC90ZXN0Y2Evb2NzcC8wQwYD
 VR0fBDwwOjA4oDagNIYyaHR0cDovL3Rlc3RjYS5weXRob250ZXN0Lm5ldC90ZXN0
-Y2EvcmV2b2NhdGlvbi5jcmwwDQYJKoZIhvcNAQELBQADggGBACf1jFkQ9MbnKAC/
-uo17EwPxHKZfswZVpCK527LVRr33DN1DbrR5ZWchDCpV7kCOhZ+fR7sKKk22ZHSY
-oH+u3PEu20J3GOB1iyY1aMNB7WvId3JvappdVWkC/VpUyFfLsGUDFuIPADmZZqCb
-iJMX4loteTVfl1d4xK/1mV6Gq9MRrRqiDfpSELn+v53OM9mGspwW+NZ1CIrbCuW0
-KxZ/tPkqn8PSd9fNZR70bB7rWbnwrl+kH8xKxLl6qdlrMmg74WWwhLeQxK7+9DdP
-IaDenzqx5cwWBGY/C0HcQj0gPuy3lSs1V/q+f7Y6uspPWP51PgiJLIywXS75iRAr
-+UFGTzwAtyfTZSQoFyMmMULqfk6T5HtoVMqfRvPvK+mFDLWEstU1NIB1K/CRI7gI
-AY65ClTU+zRS/tlF8IA7tsFvgtEf8jsI9kamlidhS1gyeg4dWcVErV4aeTPB1AUv
-StPYQkKNM+NjytWHl5tNuBoDNLsc0gI/WSPiI4CIY8LwomOoiw==
+Y2EvcmV2b2NhdGlvbi5jcmwwDQYJKoZIhvcNAQELBQADggGBAJXzVrvVjHC90d7a
+Y7Ap19tgJ9ZZ/WEbMMbQXXN9NOFo4yimieZgvYnTDvRyrXJ2+IYh/XU8+G2+nATh
+ggNpbK7QVbpe8sr1D47W2Y3IVkb0+Kx0Khl7jkdwH/v7vWkCoaVKbiEcBBQVVb+/
+JEPIFwO+Pizq28ivHf1S39YVSZ7CRGnv8UVDg7IezxQcEz/+nHHL5xsYVjanr0Tx
+C6F5REb5Q0Yp2LDKSU1lYNP2jnS8Yp4ejUspmrQN8KJ3WzTkES+nJcXlB3YSrr51
+cxXkCn1TOFY/eW1uyu2Aq1btfosc5+PUYjAicOcpsgM8/vo98DbATRGimdMpMSe4
+xbgVozxPm3NeK7L7y/11R7gXvSHY5sG5/3OB2CUIbQheHKWDUN5n5trQjlrT8iqx
+P7iAIQdqcRVtBetRs1mN1BVGfgKoEwEWmb0DzHBxKiMWeK/R1QGdBLRjk5oEOpIu
+5n5zk6X+UJu9DupUhm985RR3/sIoWkoO1y2M6e1hKbJT/2wEvA==
 -----END CERTIFICATE-----
diff --git a/Lib/test/keycert4.pem b/Lib/test/keycert4.pem
index d1ebb82..1003d67 100644
--- a/Lib/test/keycert4.pem
+++ b/Lib/test/keycert4.pem
@@ -1,84 +1,84 @@
 -----BEGIN PRIVATE KEY-----
-MIIG/QIBADANBgkqhkiG9w0BAQEFAASCBucwggbjAgEAAoIBgQDGjpiHzq7ghxhM
-ZzrnRsGBC/cmw8EREIdbqlrz/l8BFaWeipvO5Hb/MyU8xs2zLUrqIr2JNf+Eii8Y
-m4bYmZclFra4jomaiSlxTZOe3dMV8m4vAq4eT2mSfZZC1+XAutqdz7WhHxhMVEm3
-AyTWvTC3qCbnlbX5VIoQUwFrsSWqDiHyaGdK3rrOTKFUKM8YPiq/BZkm6A4eiFci
-5wd/SPD+w0pIscZbQW1MUr5bs54uylWaUmtfI8KJt6BDZQ/uA06c6i863sSCEI6L
-gq+wyikeJGNMxZMfgu3dzfv4BiZBQX0ZhiRvqseDSdPcuVa2Ifb6CFlg298neweY
-4EAIE1O+uqo5h8FF1aUOMZpQEZuzsp9R/TAMBHX1YmVjG/kRdBeaHe3whzB1Pfue
-PIX2ZTMmLNYbYbfnmxhk1nn8aAvoT98pNw8y3/2k2KNsu24n9uSkkxAoqJ19WKwm
-mL8MpJKAzLv45tRvhN+QLtnRdu+LJ9m29npQHFmYLbdqRfmidnMCAwEAAQKCAYBd
-w1C8MRnb5W/QBJ+IP515NxFLOP2e9VM2MkgpGGH8vSAssf/Jv5GCCcD35lmU1zqd
-PjKK7PjwueBrmmYfOshpN0Sp+oV4eHUdkCi5yL65inYFtRpMLewIxU2D2zgfvx0l
-kMSQhYKP6O22gsGOtmCfGcTlb4kzaHyaINh25nyGxY26TxsX+/3zFbTJbUv+grzk
-39vmx4aDXJbpYHfl36gOZmJZ2bl1tnvKovhJjZSRO/MYoPsbPmPLbO89ZCgVmXFc
-GVkb5Cram6i3iyutSDjxWN7Fb8uy8pFLPGAXZgF7pQoXPSEHZe8GEWBnWSC9KaDa
-uM9Ir847/Muy1ceCmxKcI2WrSjoH2AhPcmHgvbPE9Mynr6+uzReSP3q7Wh9PHm23
-oFx3DwdCfmjysnpAMBawNmJdWyxVDbZ6eyrhp17ADpsMaDTynZ+fJjgMr+MmWtbU
-YSRD0wWtl/DrzsaePZsOjCpKYJyulC+rh9/Zz1aiwrGWPbgEAzDrD6Q1Zp0mUCEC
-gcEA+XskmGIB9rRPy+YQmRgzQ555PsjLWsnQsNktP6KBhlQjFKJZXRZ0DxDTS7h8
-NrJrUDBmwfsgzggVbeO55VP5FGwD6DNeO/Bz++Fdevh8uKQFHDfk4sbIUPS91qw4
-s7OW7PR7C7Jf7Dnjmsn42o2lO4FsbcEn2F+PHOvoLl/OrSx73lS/RkdOEItW8d8/
-ExRohylnba/I2vCE9bNZd4DGjMW87j/THKPadDZWEqWggcrjY8x6ibSQGm2n2Tka
-8B+vAoHBAMu+zl8kqFlYDG24dGfVpMaOYj5Osj0cV5f7O2pZ15sCevjiqoKGHH7G
-O8EiI5pRBZ893+Fsx6YWmcKue88lfGvaoQjV0LUbfMfX/FoD39w/ZLx31yKEiFuc
-KvMiRV5mO3kQiHBVX9vamzr5NeaErccXY9LnhaKOMX9blgiDQZH7fc3RhodcFWrC
-9yfX6ryfidpPnRvK7Ops7hVnFKyyS4FaAarnzH1B2WcVcD4lYYxhMc8VXeU3eKOh
-j1fI/F5ifQKBwQDpCjB670HqUzAexL9IYqSwSz3yedoK6m24ZIWx5XicI8fJJIXZ
-QHoVAKB/IMtWxH8dnri+Bnj0O/TYe1pQb4pBm0xjAGjMEKYm6LNLhQXr67qiS0vQ
-0eKYTKVv+9vTcLRQj2bI3Exh+wkys+tzK9DmrtS8CSvRICIs3+g4OWJzvRPP8NXj
-LgQrzBzhPqpKhkvFxdVJTmSOrxFj+a5exLmzEZqT6qanIB+VYpQwQuqVkxGpTX5B
-V5ssNLYPYRpapx0CgcByCtQixzcAA1u5knR9pkT76ris3YnA0Ptqk3I3XiBjoGjK
-pL0CICUVBMpvmTdKai12a8DDwgqiOaZJJTchxH63NAHNGzkeFkuq5IdYrzB/bHBr
-WbzukjZs6KXVv4oKg7ioVAu6rN7iBaO7x8BWzk8i0EHMzFCto1+rRM1e6HEsUBOj
-v7LIU0+dmZGUGLRIbhhQPR3Yb6ZatSwyiKc23vmKZqHmUqbQOaqBm6te7beDRugF
-XJVY9sqs9IJyhYpVHlUCgcAPoslwYKeAXagsxdQrH3D9VJDXVOHWKMBqQZDio5dB
-Q80uWpuxtt6nhZkQO1JIWnYb6v+zbDbcgjByBIDuxCdBW9d+QQnanKmVyrXguK91
-C3OcHHOmSduFdWC3/zYW1mW97Tz1sXyam2hly1u3L5kW+GnE1hr9VVPjQNrO9+Ge
-qW0coaJqKY78q3Rm2dtyZeJSFFI1o/DQ3blyItsFpg/QrR+a5XrS6Nw2ZLIL4Azo
-J1CTgMwjhwlMNCI4t4dkHd0=
+MIIG/gIBADANBgkqhkiG9w0BAQEFAASCBugwggbkAgEAAoIBgQC34y3S6iXdmdvd
+M/2aFBe6CvRvZwhh1huGl7IQRtdoakPqMLlEdNHJtNeF5M27xLei+p4wt7N1Jyi0
+2keHQb1m9TqH5AruOkE2ti+15zEoKoU9aWydTiH+epKTT0yjg2NcKQjRUaWcbhzB
+H4EMKuCIlzIIz8/EIKkOqhCDwq6+Fv3Ays+z7Bz+yR80ixivKu/l7SjxQ7z7R/kC
+I7OViRcIO5QBQPj7VLvCTz4VA6u/LdXngK2HNuau6WXm5yNNQbqrB11AEJcYZf/c
+VrneV4F+ZjLloAKgSn9GB8eWOyilTQ18TcKd+H2icipRaP/+QR/KPx5GK/SXU3my
+qm62QOGI7t/5ktVdjGhs6tHZxw1SRiipiLYWbtVRrSxa4wYlgpgoUwvrvvtC5kAN
+nTw1VGWsxcs+6a7+PocYnJiq7k4b5OAUb3Ryvl9DLAMy8NqpRWo4cHD/XQ3FCYwF
+HlOSgx/dL5Se0i3dW1KzbP6OvaNg6nl/1EXPUsJ1ATS8nzvzhccCAwEAAQKCAYEA
+nD3GvaJ9MeB802JNZBEWZ9jO/6jHknldQeq6POI0PF+t/NoRUH0BkyS4yucxdw0a
+CrxulG5BaJUxHRkqFV5iE4zhgnzcXLXamyYJO8GIHtyiASAGTVIJyDNVPxztvTDx
+x2iGOXPqBxP4Eo82EqSLywLMXHhVzAsEGZWeGpXb61+Vk62+9Nz1dfZlMTvOaWdO
+Fkp/sx8e/1KT3KGBANlOXIxioP4Xj1Tbg6nY0fogf3vud5j52B1pu8xL7PkPIaFq
+DEGz3XvWhBF/+Cs5iDeYz8eQpfQig7HdHVn2D8dZmzQgpLw1yGbPAnqrgopWfm7R
+MqiyFe82p2t+vfSoG5jz28XxPtzBJV3ljxKxlbnclqu/CAYSjzaYohDzyhjdZOZI
+r9DOfWOqu01Ha3EEsApn95fusHHGTH2FOy0u61FSTrfLfqsLw9WRJPWleirKikhf
+SZzi223QrmzZMtuCF7VgTx3ghDhBmFD8uzVVQ1SwPZ8CgftRkFcn1llXIAfJ3iHB
+AoHBAOg3DOIdtUVgpjMKhpAyuH54fYvGl7afIMNbKRle0kCiP45wtGJ43RPMqiR8
+1rxZB3+iapICI/lnhk3O7vVRkR64yiqQBcl/hXZ1BhyD6iDXWYmm5mcnymcoqfwc
+p9TfzEPyGPb3SM2YlI0cSPRqM/jDvGvnDeKIpzEKvUlwJ59WoN2HOHTIXf+XbN5n
+unpuTt6YKJvc48DrXsPnUzkCmUfbOmgHfeb9/qBs/8kY4YJMsZEjqf88o7mCJCIy
+BtDxTwKBwQDKuOwE8e0GIA01ZHd6RfR+ZCvmp2oauxal4EJsBx+ZZnhEWGaSm1fE
+Bf/ih074ghcSKoSrdYpD1xGZ6fGVWMx3jcL11yLDOUiiPDJsm8hUBZ0IW1qXyfCP
+l7xy1bUkWwPXdmFuGp1exrcjooKrFNuTdYiK4nQZSKuCfXQRADrmEJmM+gYwhqI7
+4XsYo848B9A4hbY6RLEox4uvo/RmafY0iR0PMhVEc+ydNLKB/4LpahZqBQ4kTpMv
+o4+rEvYt1gkCgcB08gx177ozx1nMCLf99N0/LBUmCIytNvR8DfPjyAIg9NUHOjFO
+CkpkR0VEfO50Cm4hVD1RbOyLFRzpIJbtSvfHvg5qYv/XG3auUn8Sa0jE408/aKNO
+PhbL3wnEYvYO2ep4KXtzHNQ4XmgprJ39IWMtG/5PZRx0ApgYtazgSDBcKXd4OTow
+bhwQtUTpuNmMAPONXJnO7O5yYNbn2B7sbiedrYV7kJJSe4X5awtiTjp7sX4XdxuM
+5BAcQ7NI2WLfZTcCgcBp/X9hIoATmMRvKwUQx+yJ/KO7Z8KhETpJJdR0mNDbqmit
+Cy8t7cxYb+6WqLoQUivv0o0k/EJ7L8JDH76woAnfZB4P3RiOy69/K0wN3vFBhOHS
+kbju7aU53lKoE7YuuOtsRrewEng/KlRsbDY3bqNTGLt4KegbpBQQGLmLffxNd1Zh
+EAQWcP33ou9yNYrJdihWtQpOssWRlash/O32ceZJF3s7C6t068tFclz2fPocQdxQ
+OC5pqy9nU/P0tOhDlMkCgcEAosaBJLIeAYlOU0+2uSx5g5mIqOOTyrDEmqqad6T/
+wkB7vW2QaoDvLL22Yrzdn9vQ0V0rqzhVtan7sq5pn/BQJAueZYN8rFxS3uuW+UQk
+Nsc4GLJzU8Az/2DvqEIrnE7zRc5E1FOI9gKLrBlpJB2o0hVcBznDe05Gax6Kjqbm
+jHqzyU73SpxpEy3OesClCeCQIMr47HaL9aSqaEX4U9bMpgHi0HgTTHqvJ5pch0hY
+dYl+WAE9LAyF1DF29BirEXVw
 -----END PRIVATE KEY-----
 Certificate:
     Data:
         Version: 3 (0x2)
         Serial Number:
             cb:2d:80:99:5a:69:52:5d
-    Signature Algorithm: sha256WithRSAEncryption
+        Signature Algorithm: sha256WithRSAEncryption
         Issuer: C=XY, O=Python Software Foundation CA, CN=our-ca-server
         Validity
             Not Before: Aug 29 14:23:16 2018 GMT
-            Not After : Jul  7 14:23:16 2028 GMT
+            Not After : Oct 28 14:23:16 2037 GMT
         Subject: C=XY, L=Castle Anthrax, O=Python Software Foundation, CN=fakehostname
         Subject Public Key Info:
             Public Key Algorithm: rsaEncryption
-                Public-Key: (3072 bit)
+                RSA Public-Key: (3072 bit)
                 Modulus:
-                    00:c6:8e:98:87:ce:ae:e0:87:18:4c:67:3a:e7:46:
-                    c1:81:0b:f7:26:c3:c1:11:10:87:5b:aa:5a:f3:fe:
-                    5f:01:15:a5:9e:8a:9b:ce:e4:76:ff:33:25:3c:c6:
-                    cd:b3:2d:4a:ea:22:bd:89:35:ff:84:8a:2f:18:9b:
-                    86:d8:99:97:25:16:b6:b8:8e:89:9a:89:29:71:4d:
-                    93:9e:dd:d3:15:f2:6e:2f:02:ae:1e:4f:69:92:7d:
-                    96:42:d7:e5:c0:ba:da:9d:cf:b5:a1:1f:18:4c:54:
-                    49:b7:03:24:d6:bd:30:b7:a8:26:e7:95:b5:f9:54:
-                    8a:10:53:01:6b:b1:25:aa:0e:21:f2:68:67:4a:de:
-                    ba:ce:4c:a1:54:28:cf:18:3e:2a:bf:05:99:26:e8:
-                    0e:1e:88:57:22:e7:07:7f:48:f0:fe:c3:4a:48:b1:
-                    c6:5b:41:6d:4c:52:be:5b:b3:9e:2e:ca:55:9a:52:
-                    6b:5f:23:c2:89:b7:a0:43:65:0f:ee:03:4e:9c:ea:
-                    2f:3a:de:c4:82:10:8e:8b:82:af:b0:ca:29:1e:24:
-                    63:4c:c5:93:1f:82:ed:dd:cd:fb:f8:06:26:41:41:
-                    7d:19:86:24:6f:aa:c7:83:49:d3:dc:b9:56:b6:21:
-                    f6:fa:08:59:60:db:df:27:7b:07:98:e0:40:08:13:
-                    53:be:ba:aa:39:87:c1:45:d5:a5:0e:31:9a:50:11:
-                    9b:b3:b2:9f:51:fd:30:0c:04:75:f5:62:65:63:1b:
-                    f9:11:74:17:9a:1d:ed:f0:87:30:75:3d:fb:9e:3c:
-                    85:f6:65:33:26:2c:d6:1b:61:b7:e7:9b:18:64:d6:
-                    79:fc:68:0b:e8:4f:df:29:37:0f:32:df:fd:a4:d8:
-                    a3:6c:bb:6e:27:f6:e4:a4:93:10:28:a8:9d:7d:58:
-                    ac:26:98:bf:0c:a4:92:80:cc:bb:f8:e6:d4:6f:84:
-                    df:90:2e:d9:d1:76:ef:8b:27:d9:b6:f6:7a:50:1c:
-                    59:98:2d:b7:6a:45:f9:a2:76:73
+                    00:b7:e3:2d:d2:ea:25:dd:99:db:dd:33:fd:9a:14:
+                    17:ba:0a:f4:6f:67:08:61:d6:1b:86:97:b2:10:46:
+                    d7:68:6a:43:ea:30:b9:44:74:d1:c9:b4:d7:85:e4:
+                    cd:bb:c4:b7:a2:fa:9e:30:b7:b3:75:27:28:b4:da:
+                    47:87:41:bd:66:f5:3a:87:e4:0a:ee:3a:41:36:b6:
+                    2f:b5:e7:31:28:2a:85:3d:69:6c:9d:4e:21:fe:7a:
+                    92:93:4f:4c:a3:83:63:5c:29:08:d1:51:a5:9c:6e:
+                    1c:c1:1f:81:0c:2a:e0:88:97:32:08:cf:cf:c4:20:
+                    a9:0e:aa:10:83:c2:ae:be:16:fd:c0:ca:cf:b3:ec:
+                    1c:fe:c9:1f:34:8b:18:af:2a:ef:e5:ed:28:f1:43:
+                    bc:fb:47:f9:02:23:b3:95:89:17:08:3b:94:01:40:
+                    f8:fb:54:bb:c2:4f:3e:15:03:ab:bf:2d:d5:e7:80:
+                    ad:87:36:e6:ae:e9:65:e6:e7:23:4d:41:ba:ab:07:
+                    5d:40:10:97:18:65:ff:dc:56:b9:de:57:81:7e:66:
+                    32:e5:a0:02:a0:4a:7f:46:07:c7:96:3b:28:a5:4d:
+                    0d:7c:4d:c2:9d:f8:7d:a2:72:2a:51:68:ff:fe:41:
+                    1f:ca:3f:1e:46:2b:f4:97:53:79:b2:aa:6e:b6:40:
+                    e1:88:ee:df:f9:92:d5:5d:8c:68:6c:ea:d1:d9:c7:
+                    0d:52:46:28:a9:88:b6:16:6e:d5:51:ad:2c:5a:e3:
+                    06:25:82:98:28:53:0b:eb:be:fb:42:e6:40:0d:9d:
+                    3c:35:54:65:ac:c5:cb:3e:e9:ae:fe:3e:87:18:9c:
+                    98:aa:ee:4e:1b:e4:e0:14:6f:74:72:be:5f:43:2c:
+                    03:32:f0:da:a9:45:6a:38:70:70:ff:5d:0d:c5:09:
+                    8c:05:1e:53:92:83:1f:dd:2f:94:9e:d2:2d:dd:5b:
+                    52:b3:6c:fe:8e:bd:a3:60:ea:79:7f:d4:45:cf:52:
+                    c2:75:01:34:bc:9f:3b:f3:85:c7
                 Exponent: 65537 (0x10001)
         X509v3 extensions:
             X509v3 Subject Alternative Name: 
@@ -90,9 +90,9 @@
             X509v3 Basic Constraints: critical
                 CA:FALSE
             X509v3 Subject Key Identifier: 
-                52:E0:93:AA:52:55:B7:BB:E7:A8:E0:8C:DE:41:2E:F4:07:F0:36:FB
+                C8:BD:A8:B4:C0:F2:32:10:73:47:9C:48:81:32:F8:BA:BB:26:84:97
             X509v3 Authority Key Identifier: 
-                keyid:DD:BF:CA:DA:E6:D1:34:BA:37:75:21:CA:6F:9A:08:28:F2:35:B6:48
+                keyid:B3:8A:A0:A2:BA:71:F1:A8:24:79:D4:A4:5B:25:36:15:1E:49:C8:CD
                 DirName:/C=XY/O=Python Software Foundation CA/CN=our-ca-server
                 serial:CB:2D:80:99:5A:69:52:5B
 
@@ -106,59 +106,59 @@
                   URI:http://testca.pythontest.net/testca/revocation.crl
 
     Signature Algorithm: sha256WithRSAEncryption
-         29:d2:3f:82:3f:c1:38:35:a6:bd:81:10:fe:64:ec:ff:7e:e1:
-         c6:6f:7f:86:65:f9:31:6f:fb:ef:32:4e:2f:87:c8:42:de:6c:
-         8d:b8:06:08:8f:37:70:95:7d:e1:40:d4:82:2b:8d:b3:4a:fd:
-         34:c5:9e:df:ff:01:53:4a:4f:08:f4:58:e1:74:fc:78:e3:3e:
-         71:a7:5e:66:07:ea:d2:04:31:e2:75:a8:4c:80:17:86:92:20:
-         d2:32:a7:9a:65:8b:1a:5f:f1:4c:c8:50:6d:00:fc:99:bf:69:
-         b3:48:f3:45:5a:ee:35:50:14:b8:f3:92:92:c6:9f:0e:5d:eb:
-         0d:e8:ec:f2:a4:09:6b:dc:66:2b:fc:df:4c:fc:65:a1:ae:d3:
-         b5:88:6a:a4:e7:08:1c:94:49:e0:b8:c1:04:8c:21:09:6c:55:
-         4b:2c:97:10:f1:8c:6c:d0:bb:ba:8d:93:e8:47:8b:4d:8e:7d:
-         7d:85:53:18:c8:f8:f4:8f:67:3a:b1:aa:3e:18:34:6c:3a:e6:
-         a6:c7:2f:be:83:38:f5:d5:e5:d2:17:28:61:6c:b6:49:99:21:
-         69:a4:a8:b6:94:76:fd:18:ad:35:52:45:64:fb:f1:5d:8e:bb:
-         c0:21:2e:59:55:24:af:bb:8f:b2:0a:7b:17:f0:34:97:8e:68:
-         a9:f2:d0:3e:f6:73:82:f8:7c:4e:9a:70:7d:d6:b3:8c:cc:85:
-         04:5c:02:8f:74:da:88:3a:20:a8:7e:c2:9e:b0:dd:56:1f:ce:
-         cd:42:16:c6:14:91:ad:30:e0:dc:76:f2:2c:56:ea:38:45:d8:
-         c0:3e:b8:90:fa:f3:38:99:ec:44:07:35:8f:69:62:0c:f9:ef:
-         b7:9d:e5:15:42:6e:fb:fe:4c:ff:e8:94:5a:1a:b0:80:b2:0e:
-         17:3d:e1:87:a8:08:84:93:74:68:8d:29:df:ca:0b:6a:44:32:
-         8a:51:3b:d6:38:db:bd:e3:2a:1b:5e:20:48:81:82:19:91:c6:
-         87:8c:0f:cd:51:ea
+         76:87:76:4d:e4:0f:88:bf:2c:f3:58:67:c0:97:6c:cd:59:18:
+         82:83:4c:04:19:a5:6d:aa:fa:64:3d:49:32:3e:e1:56:95:b2:
+         13:f7:cf:d3:11:b0:72:b7:5b:e7:d7:85:69:51:3c:b6:54:80:
+         45:2f:28:10:21:20:b9:ba:e9:27:5a:b7:3f:82:b7:69:f5:46:
+         f5:bf:a2:8b:17:7f:f2:14:d1:46:97:b5:8b:47:fb:9f:e8:5c:
+         05:0e:9d:11:bd:7c:9a:03:84:0b:ca:29:66:4a:ca:0d:6f:09:
+         1e:7a:27:c1:7f:03:96:70:8d:18:a5:2f:a4:98:a5:19:aa:8c:
+         5d:1e:8c:3e:bb:6d:3b:c0:33:c0:15:e1:bd:09:3d:9f:e8:dc:
+         12:d4:cb:44:1d:06:f5:e8:d6:4e:a1:2d:5c:9f:5d:1f:5b:2a:
+         c3:4d:40:8d:da:d1:78:80:d0:c6:31:72:10:48:8a:e9:10:7a:
+         13:30:11:b2:9e:67:0e:ed:a1:aa:ec:73:2d:f0:b8:8a:22:75:
+         0f:30:69:5c:50:7e:91:ce:da:91:c7:70:8c:65:ff:f6:58:fb:
+         00:bd:45:cc:e2:e4:e3:e5:16:36:7d:f3:a2:4a:9c:45:ff:d9:
+         a5:16:e0:2f:b5:5b:6c:e6:8a:13:15:48:73:bd:7c:80:33:c3:
+         d4:3b:3a:1d:85:0e:a4:f7:f7:fb:48:0c:e9:a0:4b:5e:8a:5c:
+         67:f8:25:02:6f:cd:72:c1:aa:5a:93:64:7c:14:20:43:e0:13:
+         7f:0d:e1:0d:61:5e:2e:2c:cd:7a:2e:2a:ae:b6:75:6a:5f:a0:
+         1a:9b:b6:67:2d:b0:a5:1c:54:bc:8c:70:7e:15:2b:c0:50:e3:
+         03:bb:a4:a5:fc:45:01:c9:3f:a7:b8:18:dc:3e:08:07:a1:9b:
+         f5:bd:95:bd:49:e8:10:7c:91:7d:2d:c4:c2:98:b6:b7:51:69:
+         d7:0a:68:40:b5:0f:85:a0:a9:67:77:c6:68:cb:0e:58:34:b3:
+         58:e7:c8:7c:09:67
 -----BEGIN CERTIFICATE-----
 MIIF9zCCBF+gAwIBAgIJAMstgJlaaVJdMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNV
 BAYTAlhZMSYwJAYDVQQKDB1QeXRob24gU29mdHdhcmUgRm91bmRhdGlvbiBDQTEW
-MBQGA1UEAwwNb3VyLWNhLXNlcnZlcjAeFw0xODA4MjkxNDIzMTZaFw0yODA3MDcx
+MBQGA1UEAwwNb3VyLWNhLXNlcnZlcjAeFw0xODA4MjkxNDIzMTZaFw0zNzEwMjgx
 NDIzMTZaMGIxCzAJBgNVBAYTAlhZMRcwFQYDVQQHDA5DYXN0bGUgQW50aHJheDEj
 MCEGA1UECgwaUHl0aG9uIFNvZnR3YXJlIEZvdW5kYXRpb24xFTATBgNVBAMMDGZh
-a2Vob3N0bmFtZTCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBAMaOmIfO
-ruCHGExnOudGwYEL9ybDwREQh1uqWvP+XwEVpZ6Km87kdv8zJTzGzbMtSuoivYk1
-/4SKLxibhtiZlyUWtriOiZqJKXFNk57d0xXybi8Crh5PaZJ9lkLX5cC62p3PtaEf
-GExUSbcDJNa9MLeoJueVtflUihBTAWuxJaoOIfJoZ0reus5MoVQozxg+Kr8FmSbo
-Dh6IVyLnB39I8P7DSkixxltBbUxSvluzni7KVZpSa18jwom3oENlD+4DTpzqLzre
-xIIQjouCr7DKKR4kY0zFkx+C7d3N+/gGJkFBfRmGJG+qx4NJ09y5VrYh9voIWWDb
-3yd7B5jgQAgTU766qjmHwUXVpQ4xmlARm7Oyn1H9MAwEdfViZWMb+RF0F5od7fCH
-MHU9+548hfZlMyYs1htht+ebGGTWefxoC+hP3yk3DzLf/aTYo2y7bif25KSTECio
-nX1YrCaYvwykkoDMu/jm1G+E35Au2dF274sn2bb2elAcWZgtt2pF+aJ2cwIDAQAB
+a2Vob3N0bmFtZTCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBALfjLdLq
+Jd2Z290z/ZoUF7oK9G9nCGHWG4aXshBG12hqQ+owuUR00cm014XkzbvEt6L6njC3
+s3UnKLTaR4dBvWb1OofkCu46QTa2L7XnMSgqhT1pbJ1OIf56kpNPTKODY1wpCNFR
+pZxuHMEfgQwq4IiXMgjPz8QgqQ6qEIPCrr4W/cDKz7PsHP7JHzSLGK8q7+XtKPFD
+vPtH+QIjs5WJFwg7lAFA+PtUu8JPPhUDq78t1eeArYc25q7pZebnI01BuqsHXUAQ
+lxhl/9xWud5XgX5mMuWgAqBKf0YHx5Y7KKVNDXxNwp34faJyKlFo//5BH8o/HkYr
+9JdTebKqbrZA4Yju3/mS1V2MaGzq0dnHDVJGKKmIthZu1VGtLFrjBiWCmChTC+u+
++0LmQA2dPDVUZazFyz7prv4+hxicmKruThvk4BRvdHK+X0MsAzLw2qlFajhwcP9d
+DcUJjAUeU5KDH90vlJ7SLd1bUrNs/o69o2DqeX/URc9SwnUBNLyfO/OFxwIDAQAB
 o4IBwzCCAb8wFwYDVR0RBBAwDoIMZmFrZWhvc3RuYW1lMA4GA1UdDwEB/wQEAwIF
 oDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDAYDVR0TAQH/BAIwADAd
-BgNVHQ4EFgQUUuCTqlJVt7vnqOCM3kEu9AfwNvswfQYDVR0jBHYwdIAU3b/K2ubR
-NLo3dSHKb5oIKPI1tkihUaRPME0xCzAJBgNVBAYTAlhZMSYwJAYDVQQKDB1QeXRo
+BgNVHQ4EFgQUyL2otMDyMhBzR5xIgTL4ursmhJcwfQYDVR0jBHYwdIAUs4qgorpx
+8agkedSkWyU2FR5JyM2hUaRPME0xCzAJBgNVBAYTAlhZMSYwJAYDVQQKDB1QeXRo
 b24gU29mdHdhcmUgRm91bmRhdGlvbiBDQTEWMBQGA1UEAwwNb3VyLWNhLXNlcnZl
 coIJAMstgJlaaVJbMIGDBggrBgEFBQcBAQR3MHUwPAYIKwYBBQUHMAKGMGh0dHA6
 Ly90ZXN0Y2EucHl0aG9udGVzdC5uZXQvdGVzdGNhL3B5Y2FjZXJ0LmNlcjA1Bggr
 BgEFBQcwAYYpaHR0cDovL3Rlc3RjYS5weXRob250ZXN0Lm5ldC90ZXN0Y2Evb2Nz
 cC8wQwYDVR0fBDwwOjA4oDagNIYyaHR0cDovL3Rlc3RjYS5weXRob250ZXN0Lm5l
-dC90ZXN0Y2EvcmV2b2NhdGlvbi5jcmwwDQYJKoZIhvcNAQELBQADggGBACnSP4I/
-wTg1pr2BEP5k7P9+4cZvf4Zl+TFv++8yTi+HyELebI24BgiPN3CVfeFA1IIrjbNK
-/TTFnt//AVNKTwj0WOF0/HjjPnGnXmYH6tIEMeJ1qEyAF4aSINIyp5plixpf8UzI
-UG0A/Jm/abNI80Va7jVQFLjzkpLGnw5d6w3o7PKkCWvcZiv830z8ZaGu07WIaqTn
-CByUSeC4wQSMIQlsVUsslxDxjGzQu7qNk+hHi02OfX2FUxjI+PSPZzqxqj4YNGw6
-5qbHL76DOPXV5dIXKGFstkmZIWmkqLaUdv0YrTVSRWT78V2Ou8AhLllVJK+7j7IK
-exfwNJeOaKny0D72c4L4fE6acH3Ws4zMhQRcAo902og6IKh+wp6w3VYfzs1CFsYU
-ka0w4Nx28ixW6jhF2MA+uJD68ziZ7EQHNY9pYgz577ed5RVCbvv+TP/olFoasICy
-Dhc94YeoCISTdGiNKd/KC2pEMopRO9Y4273jKhteIEiBghmRxoeMD81R6g==
+dC90ZXN0Y2EvcmV2b2NhdGlvbi5jcmwwDQYJKoZIhvcNAQELBQADggGBAHaHdk3k
+D4i/LPNYZ8CXbM1ZGIKDTAQZpW2q+mQ9STI+4VaVshP3z9MRsHK3W+fXhWlRPLZU
+gEUvKBAhILm66Sdatz+Ct2n1RvW/oosXf/IU0UaXtYtH+5/oXAUOnRG9fJoDhAvK
+KWZKyg1vCR56J8F/A5ZwjRilL6SYpRmqjF0ejD67bTvAM8AV4b0JPZ/o3BLUy0Qd
+BvXo1k6hLVyfXR9bKsNNQI3a0XiA0MYxchBIiukQehMwEbKeZw7toarscy3wuIoi
+dQ8waVxQfpHO2pHHcIxl//ZY+wC9Rczi5OPlFjZ986JKnEX/2aUW4C+1W2zmihMV
+SHO9fIAzw9Q7Oh2FDqT39/tIDOmgS16KXGf4JQJvzXLBqlqTZHwUIEPgE38N4Q1h
+Xi4szXouKq62dWpfoBqbtmctsKUcVLyMcH4VK8BQ4wO7pKX8RQHJP6e4GNw+CAeh
+m/W9lb1J6BB8kX0txMKYtrdRadcKaEC1D4WgqWd3xmjLDlg0s1jnyHwJZw==
 -----END CERTIFICATE-----
diff --git a/Lib/test/keycertecc.pem b/Lib/test/keycertecc.pem
index 02eda28..81daa4c 100644
--- a/Lib/test/keycertecc.pem
+++ b/Lib/test/keycertecc.pem
@@ -1,31 +1,31 @@
 -----BEGIN PRIVATE KEY-----
-MIG2AgEAMBAGByqGSM49AgEGBSuBBAAiBIGeMIGbAgEBBDBL2Y5JfpzbgHw+t4Q+
-c5SHhsZcD9ylEtUMg7OyF9xW6j+3VIVORGaokcOtE0Z2Y5ehZANiAASzz/rInKUz
-onpxP5bLxmq8fmrtgRSS0jRPUOU16XKX+KtifnLbmLHQtPrctdkRRROCxnURz2fB
-ihQTJkXyBMSswNTRCs+4DUKbMAfihigMVYgdWbZPFBDleo5aeFw4/FM=
+MIG2AgEAMBAGByqGSM49AgEGBSuBBAAiBIGeMIGbAgEBBDBcNwE+cm17mmr7Yg6d
+0DNCnheGFOjkYH4tYzTyCkcZGShkmF/tKhIqb3imKz0Kx9+hZANiAATyp8ws6CuN
+OI2/3MC4jZVSkmoDzm/X/ZrkEm4TVHKPSZ6kzZRpmmUlLS9l7SQZSLYyDAFBFzoG
+JJYHhZNQXEO7HFszn6KnvLjhwS6ddzlaHPziEknrSr0OKhJmdJHrQAQ=
 -----END PRIVATE KEY-----
 Certificate:
     Data:
         Version: 3 (0x2)
         Serial Number:
             cb:2d:80:99:5a:69:52:5e
-    Signature Algorithm: sha256WithRSAEncryption
+        Signature Algorithm: sha256WithRSAEncryption
         Issuer: C=XY, O=Python Software Foundation CA, CN=our-ca-server
         Validity
             Not Before: Aug 29 14:23:16 2018 GMT
-            Not After : Jul  7 14:23:16 2028 GMT
+            Not After : Oct 28 14:23:16 2037 GMT
         Subject: C=XY, L=Castle Anthrax, O=Python Software Foundation, CN=localhost-ecc
         Subject Public Key Info:
             Public Key Algorithm: id-ecPublicKey
                 Public-Key: (384 bit)
                 pub:
-                    04:b3:cf:fa:c8:9c:a5:33:a2:7a:71:3f:96:cb:c6:
-                    6a:bc:7e:6a:ed:81:14:92:d2:34:4f:50:e5:35:e9:
-                    72:97:f8:ab:62:7e:72:db:98:b1:d0:b4:fa:dc:b5:
-                    d9:11:45:13:82:c6:75:11:cf:67:c1:8a:14:13:26:
-                    45:f2:04:c4:ac:c0:d4:d1:0a:cf:b8:0d:42:9b:30:
-                    07:e2:86:28:0c:55:88:1d:59:b6:4f:14:10:e5:7a:
-                    8e:5a:78:5c:38:fc:53
+                    04:f2:a7:cc:2c:e8:2b:8d:38:8d:bf:dc:c0:b8:8d:
+                    95:52:92:6a:03:ce:6f:d7:fd:9a:e4:12:6e:13:54:
+                    72:8f:49:9e:a4:cd:94:69:9a:65:25:2d:2f:65:ed:
+                    24:19:48:b6:32:0c:01:41:17:3a:06:24:96:07:85:
+                    93:50:5c:43:bb:1c:5b:33:9f:a2:a7:bc:b8:e1:c1:
+                    2e:9d:77:39:5a:1c:fc:e2:12:49:eb:4a:bd:0e:2a:
+                    12:66:74:91:eb:40:04
                 ASN1 OID: secp384r1
                 NIST CURVE: P-384
         X509v3 extensions:
@@ -38,9 +38,9 @@
             X509v3 Basic Constraints: critical
                 CA:FALSE
             X509v3 Subject Key Identifier: 
-                C6:82:22:BF:4F:3D:40:AD:9B:16:AD:E7:C5:ED:C4:82:EB:35:97:98
+                79:11:98:86:15:4F:48:F4:31:0B:D2:CC:C8:26:3A:09:07:5D:96:40
             X509v3 Authority Key Identifier: 
-                keyid:DD:BF:CA:DA:E6:D1:34:BA:37:75:21:CA:6F:9A:08:28:F2:35:B6:48
+                keyid:B3:8A:A0:A2:BA:71:F1:A8:24:79:D4:A4:5B:25:36:15:1E:49:C8:CD
                 DirName:/C=XY/O=Python Software Foundation CA/CN=our-ca-server
                 serial:CB:2D:80:99:5A:69:52:5B
 
@@ -54,53 +54,53 @@
                   URI:http://testca.pythontest.net/testca/revocation.crl
 
     Signature Algorithm: sha256WithRSAEncryption
-         76:e3:19:4d:34:78:50:3e:fa:63:53:d6:3f:01:87:e8:f4:a3:
-         a9:81:5b:31:d6:de:3a:98:f3:bb:70:4d:29:35:1f:b0:6a:b3:
-         9d:bf:03:2b:79:c4:f2:0b:32:f8:fc:f6:cb:13:47:28:81:fa:
-         96:b3:1a:1d:bd:4b:f6:35:df:87:ef:6e:74:63:87:3d:7e:2b:
-         c6:78:d4:8e:ef:03:e6:01:11:22:4e:1b:ef:2c:c1:c5:4e:3f:
-         4a:07:ae:92:ef:d3:ac:79:59:7c:60:89:4b:3d:39:08:ef:c4:
-         9a:dc:b0:8b:ee:5f:30:40:d3:c2:f3:f8:90:77:9d:8c:a7:07:
-         b9:5f:62:83:4d:37:fa:36:e1:1d:26:2b:cc:8f:7c:6f:f1:23:
-         87:71:48:40:ad:6b:30:16:47:4c:d7:98:bb:f5:9b:63:c8:66:
-         47:65:58:d2:c1:07:81:14:0c:25:20:87:b9:1d:ab:0b:56:db:
-         2c:ab:36:db:7f:c7:42:52:af:91:d6:fb:18:cf:94:f7:1e:25:
-         99:ce:20:78:c6:f8:69:6e:9c:53:f3:fe:90:3e:4d:ca:d5:d6:
-         ac:6e:02:17:be:4a:0f:fe:e6:14:d4:ce:25:df:17:8f:6f:b9:
-         d3:28:dc:b4:98:ef:05:6f:eb:20:14:1c:c1:e9:9d:02:7b:0e:
-         0f:e4:a8:bc:3b:62:e0:42:0c:b0:f7:a1:63:fe:98:d7:aa:b0:
-         f6:ed:ff:ab:4f:1a:9a:8f:eb:f0:86:61:d2:d3:a5:08:d0:db:
-         e4:d6:a9:0e:ec:08:6f:af:fb:ef:73:3f:47:69:97:90:b2:5a:
-         6f:31:66:a7:4c:32:0c:e9:ea:18:ce:a9:79:9c:f5:c4:42:f5:
-         68:53:b2:a4:8c:98:3f:97:34:62:61:41:0a:54:d7:0b:cd:33:
-         c8:62:62:da:f7:07:c6:c6:3b:fa:68:ca:5f:62:3e:57:db:bd:
-         cb:16:94:07:9a:b5:31:55:b8:f8:cb:b0:7f:a0:d1:82:df:71:
-         c8:90:60:b3:88:b0
+         6e:42:e8:a2:2d:28:14:e3:25:5c:c1:7e:54:e9:3a:ff:30:db:
+         94:ba:b2:f6:5f:ae:9a:c1:90:b3:4f:ce:65:1d:84:64:c0:71:
+         2c:44:8e:7e:00:79:f5:8c:4a:1d:34:13:44:de:99:2e:db:53:
+         ee:ec:74:97:4d:59:1a:09:82:4f:98:75:91:a7:a0:b9:da:5e:
+         68:f5:32:85:be:36:3d:83:d4:ee:f9:87:67:31:85:41:53:9a:
+         e7:05:96:13:1c:88:2e:7f:33:b1:ee:bd:f9:50:52:24:ed:3d:
+         92:95:6e:30:c3:af:74:a9:ee:15:bb:da:7c:14:50:8e:e3:99:
+         ea:ba:b4:37:8a:50:61:26:de:01:93:b8:a2:6b:d9:c7:38:5e:
+         b2:f8:96:3d:a8:9f:7d:0c:71:d4:7e:cc:a0:57:af:7e:ce:3f:
+         a7:a7:27:68:c1:28:d7:4f:44:c1:b4:93:c3:c7:35:2b:50:c3:
+         8e:2c:d0:46:c1:3f:e1:67:d3:f0:81:ae:f3:5c:3e:4f:d5:a8:
+         07:8f:e0:eb:ef:d8:dc:47:e0:3d:58:eb:de:0e:7f:b2:58:cb:
+         5c:f1:2f:65:7e:0f:0d:cc:ca:ba:83:53:63:bc:dd:18:0c:ee:
+         ed:ec:96:88:d0:38:c5:d7:ab:e7:55:79:7b:6d:ba:c0:a0:e9:
+         5c:ca:7c:fb:f8:70:c7:fb:f5:b2:b5:74:cb:f7:c0:0d:20:9f:
+         1d:b7:4c:bf:8a:8d:cd:e3:bc:4e:30:78:02:12:a0:9b:d5:8f:
+         49:3c:95:91:76:6e:7c:54:dc:61:7a:2e:20:ed:35:25:e0:c5:
+         17:50:02:83:00:74:8f:f0:1c:97:96:08:fc:2e:63:a4:f7:97:
+         87:43:2a:32:04:2d:4c:f9:1a:07:bf:68:91:fc:50:21:a1:3c:
+         8d:8f:fb:83:57:83:1f:b6:55:5c:55:2f:58:64:ad:f3:27:ba:
+         d0:e3:cd:58:01:a3:c9:ba:1d:95:dc:30:d5:af:b9:20:ad:d9:
+         48:ba:8d:9a:66:ee
 -----BEGIN CERTIFICATE-----
 MIIEyzCCAzOgAwIBAgIJAMstgJlaaVJeMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNV
 BAYTAlhZMSYwJAYDVQQKDB1QeXRob24gU29mdHdhcmUgRm91bmRhdGlvbiBDQTEW
-MBQGA1UEAwwNb3VyLWNhLXNlcnZlcjAeFw0xODA4MjkxNDIzMTZaFw0yODA3MDcx
+MBQGA1UEAwwNb3VyLWNhLXNlcnZlcjAeFw0xODA4MjkxNDIzMTZaFw0zNzEwMjgx
 NDIzMTZaMGMxCzAJBgNVBAYTAlhZMRcwFQYDVQQHDA5DYXN0bGUgQW50aHJheDEj
 MCEGA1UECgwaUHl0aG9uIFNvZnR3YXJlIEZvdW5kYXRpb24xFjAUBgNVBAMMDWxv
-Y2FsaG9zdC1lY2MwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASzz/rInKUzonpxP5bL
-xmq8fmrtgRSS0jRPUOU16XKX+KtifnLbmLHQtPrctdkRRROCxnURz2fBihQTJkXy
-BMSswNTRCs+4DUKbMAfihigMVYgdWbZPFBDleo5aeFw4/FOjggHEMIIBwDAYBgNV
+Y2FsaG9zdC1lY2MwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAATyp8ws6CuNOI2/3MC4
+jZVSkmoDzm/X/ZrkEm4TVHKPSZ6kzZRpmmUlLS9l7SQZSLYyDAFBFzoGJJYHhZNQ
+XEO7HFszn6KnvLjhwS6ddzlaHPziEknrSr0OKhJmdJHrQASjggHEMIIBwDAYBgNV
 HREEETAPgg1sb2NhbGhvc3QtZWNjMA4GA1UdDwEB/wQEAwIFoDAdBgNVHSUEFjAU
-BggrBgEFBQcDAQYIKwYBBQUHAwIwDAYDVR0TAQH/BAIwADAdBgNVHQ4EFgQUxoIi
-v089QK2bFq3nxe3Egus1l5gwfQYDVR0jBHYwdIAU3b/K2ubRNLo3dSHKb5oIKPI1
-tkihUaRPME0xCzAJBgNVBAYTAlhZMSYwJAYDVQQKDB1QeXRob24gU29mdHdhcmUg
+BggrBgEFBQcDAQYIKwYBBQUHAwIwDAYDVR0TAQH/BAIwADAdBgNVHQ4EFgQUeRGY
+hhVPSPQxC9LMyCY6CQddlkAwfQYDVR0jBHYwdIAUs4qgorpx8agkedSkWyU2FR5J
+yM2hUaRPME0xCzAJBgNVBAYTAlhZMSYwJAYDVQQKDB1QeXRob24gU29mdHdhcmUg
 Rm91bmRhdGlvbiBDQTEWMBQGA1UEAwwNb3VyLWNhLXNlcnZlcoIJAMstgJlaaVJb
 MIGDBggrBgEFBQcBAQR3MHUwPAYIKwYBBQUHMAKGMGh0dHA6Ly90ZXN0Y2EucHl0
 aG9udGVzdC5uZXQvdGVzdGNhL3B5Y2FjZXJ0LmNlcjA1BggrBgEFBQcwAYYpaHR0
 cDovL3Rlc3RjYS5weXRob250ZXN0Lm5ldC90ZXN0Y2Evb2NzcC8wQwYDVR0fBDww
 OjA4oDagNIYyaHR0cDovL3Rlc3RjYS5weXRob250ZXN0Lm5ldC90ZXN0Y2EvcmV2
-b2NhdGlvbi5jcmwwDQYJKoZIhvcNAQELBQADggGBAHbjGU00eFA++mNT1j8Bh+j0
-o6mBWzHW3jqY87twTSk1H7Bqs52/Ayt5xPILMvj89ssTRyiB+pazGh29S/Y134fv
-bnRjhz1+K8Z41I7vA+YBESJOG+8swcVOP0oHrpLv06x5WXxgiUs9OQjvxJrcsIvu
-XzBA08Lz+JB3nYynB7lfYoNNN/o24R0mK8yPfG/xI4dxSECtazAWR0zXmLv1m2PI
-ZkdlWNLBB4EUDCUgh7kdqwtW2yyrNtt/x0JSr5HW+xjPlPceJZnOIHjG+GlunFPz
-/pA+TcrV1qxuAhe+Sg/+5hTUziXfF49vudMo3LSY7wVv6yAUHMHpnQJ7Dg/kqLw7
-YuBCDLD3oWP+mNeqsPbt/6tPGpqP6/CGYdLTpQjQ2+TWqQ7sCG+v++9zP0dpl5Cy
-Wm8xZqdMMgzp6hjOqXmc9cRC9WhTsqSMmD+XNGJhQQpU1wvNM8hiYtr3B8bGO/po
-yl9iPlfbvcsWlAeatTFVuPjLsH+g0YLfcciQYLOIsA==
+b2NhdGlvbi5jcmwwDQYJKoZIhvcNAQELBQADggGBAG5C6KItKBTjJVzBflTpOv8w
+25S6svZfrprBkLNPzmUdhGTAcSxEjn4AefWMSh00E0TemS7bU+7sdJdNWRoJgk+Y
+dZGnoLnaXmj1MoW+Nj2D1O75h2cxhUFTmucFlhMciC5/M7HuvflQUiTtPZKVbjDD
+r3Sp7hW72nwUUI7jmeq6tDeKUGEm3gGTuKJr2cc4XrL4lj2on30McdR+zKBXr37O
+P6enJ2jBKNdPRMG0k8PHNStQw44s0EbBP+Fn0/CBrvNcPk/VqAeP4Ovv2NxH4D1Y
+694Of7JYy1zxL2V+Dw3MyrqDU2O83RgM7u3slojQOMXXq+dVeXttusCg6VzKfPv4
+cMf79bK1dMv3wA0gnx23TL+Kjc3jvE4weAISoJvVj0k8lZF2bnxU3GF6LiDtNSXg
+xRdQAoMAdI/wHJeWCPwuY6T3l4dDKjIELUz5Gge/aJH8UCGhPI2P+4NXgx+2VVxV
+L1hkrfMnutDjzVgBo8m6HZXcMNWvuSCt2Ui6jZpm7g==
 -----END CERTIFICATE-----
diff --git a/Lib/test/libregrtest/cmdline.py b/Lib/test/libregrtest/cmdline.py
index c0bb051..29f4ede 100644
--- a/Lib/test/libregrtest/cmdline.py
+++ b/Lib/test/libregrtest/cmdline.py
@@ -2,6 +2,7 @@
 import os
 import sys
 from test import support
+from test.support import os_helper
 
 
 USAGE = """\
@@ -139,6 +140,39 @@
 #   default (see bpo-30822).
 RESOURCE_NAMES = ALL_RESOURCES + ('extralargefile', 'tzdata')
 
+
+class Namespace(argparse.Namespace):
+    def __init__(self, **kwargs) -> None:
+        self.testdir = None
+        self.verbose = 0
+        self.quiet = False
+        self.exclude = False
+        self.single = False
+        self.randomize = False
+        self.fromfile = None
+        self.findleaks = 1
+        self.fail_env_changed = False
+        self.use_resources = None
+        self.trace = False
+        self.coverdir = 'coverage'
+        self.runleaks = False
+        self.huntrleaks = False
+        self.verbose2 = False
+        self.verbose3 = False
+        self.print_slow = False
+        self.random_seed = None
+        self.use_mp = None
+        self.forever = False
+        self.header = False
+        self.failfast = False
+        self.match_tests = None
+        self.ignore_tests = None
+        self.pgo = False
+        self.pgo_extended = False
+
+        super().__init__(**kwargs)
+
+
 class _ArgParser(argparse.ArgumentParser):
 
     def error(self, message):
@@ -291,7 +325,7 @@
 def relative_filename(string):
     # CWD is replaced with a temporary dir before calling main(), so we
     # join it with the saved CWD so it ends up where the user expects.
-    return os.path.join(support.SAVEDCWD, string)
+    return os.path.join(os_helper.SAVEDCWD, string)
 
 
 def huntrleaks(string):
@@ -319,13 +353,7 @@
 
 def _parse_args(args, **kwargs):
     # Defaults
-    ns = argparse.Namespace(testdir=None, verbose=0, quiet=False,
-         exclude=False, single=False, randomize=False, fromfile=None,
-         findleaks=1, use_resources=None, trace=False, coverdir='coverage',
-         runleaks=False, huntrleaks=False, verbose2=False, print_slow=False,
-         random_seed=None, use_mp=None, verbose3=False, forever=False,
-         header=False, failfast=False, match_tests=None, ignore_tests=None,
-         pgo=False)
+    ns = Namespace()
     for k, v in kwargs.items():
         if not hasattr(ns, k):
             raise TypeError('%r is an invalid keyword argument '
diff --git a/Lib/test/libregrtest/main.py b/Lib/test/libregrtest/main.py
index e20bf9a..52cc065 100644
--- a/Lib/test/libregrtest/main.py
+++ b/Lib/test/libregrtest/main.py
@@ -1,4 +1,3 @@
-import datetime
 import faulthandler
 import locale
 import os
@@ -12,14 +11,15 @@
 import unittest
 from test.libregrtest.cmdline import _parse_args
 from test.libregrtest.runtest import (
-    findtests, runtest, get_abs_module,
-    STDTESTS, NOTTESTS, PASSED, FAILED, ENV_CHANGED, SKIPPED, RESOURCE_DENIED,
-    INTERRUPTED, CHILD_ERROR, TEST_DID_NOT_RUN, TIMEOUT,
-    PROGRESS_MIN_TIME, format_test_result, is_failed)
+    findtests, runtest, get_abs_module, is_failed,
+    STDTESTS, NOTTESTS, PROGRESS_MIN_TIME,
+    Passed, Failed, EnvChanged, Skipped, ResourceDenied, Interrupted,
+    ChildError, DidNotRun)
 from test.libregrtest.setup import setup_tests
 from test.libregrtest.pgo import setup_pgo_tests
 from test.libregrtest.utils import removepy, count, format_duration, printlist
 from test import support
+from test.support import os_helper
 
 
 # bpo-38203: Maximum delay in seconds to exit Python (call Py_Finalize()).
@@ -66,6 +66,7 @@
         self.resource_denieds = []
         self.environment_changed = []
         self.run_no_tests = []
+        self.need_rerun = []
         self.rerun = []
         self.first_result = None
         self.interrupted = False
@@ -99,34 +100,32 @@
                 | set(self.run_no_tests))
 
     def accumulate_result(self, result, rerun=False):
-        test_name = result.test_name
-        ok = result.result
+        test_name = result.name
 
-        if ok not in (CHILD_ERROR, INTERRUPTED) and not rerun:
-            self.test_times.append((result.test_time, test_name))
+        if not isinstance(result, (ChildError, Interrupted)) and not rerun:
+            self.test_times.append((result.duration_sec, test_name))
 
-        if ok == PASSED:
+        if isinstance(result, Passed):
             self.good.append(test_name)
-        elif ok in (FAILED, CHILD_ERROR):
-            if not rerun:
-                self.bad.append(test_name)
-        elif ok == ENV_CHANGED:
-            self.environment_changed.append(test_name)
-        elif ok == SKIPPED:
-            self.skipped.append(test_name)
-        elif ok == RESOURCE_DENIED:
+        elif isinstance(result, ResourceDenied):
             self.skipped.append(test_name)
             self.resource_denieds.append(test_name)
-        elif ok == TEST_DID_NOT_RUN:
+        elif isinstance(result, Skipped):
+            self.skipped.append(test_name)
+        elif isinstance(result, EnvChanged):
+            self.environment_changed.append(test_name)
+        elif isinstance(result, Failed):
+            if not rerun:
+                self.bad.append(test_name)
+                self.need_rerun.append(result)
+        elif isinstance(result, DidNotRun):
             self.run_no_tests.append(test_name)
-        elif ok == INTERRUPTED:
+        elif isinstance(result, Interrupted):
             self.interrupted = True
-        elif ok == TIMEOUT:
-            self.bad.append(test_name)
         else:
-            raise ValueError("invalid test result: %r" % ok)
+            raise ValueError("invalid test result: %r" % result)
 
-        if rerun and ok not in {FAILED, CHILD_ERROR, INTERRUPTED}:
+        if rerun and not isinstance(result, (Failed, Interrupted)):
             self.bad.remove(test_name)
 
         xml_data = result.xml_data
@@ -149,9 +148,12 @@
 
         # add the timestamp prefix:  "0:01:05 "
         test_time = time.monotonic() - self.start_time
-        test_time = datetime.timedelta(seconds=int(test_time))
-        line = f"{test_time} {line}"
 
+        mins, secs = divmod(int(test_time), 60)
+        hours, mins = divmod(mins, 60)
+        test_time = "%d:%02d:%02d" % (hours, mins, secs)
+
+        line = f"{test_time} {line}"
         if empty:
             line = line[:-1]
 
@@ -215,7 +217,7 @@
             # regex to match 'test_builtin' in line:
             # '0:00:00 [  4/400] test_builtin -- test_dict took 1 sec'
             regex = re.compile(r'\btest_[a-zA-Z0-9_]+\b')
-            with open(os.path.join(support.SAVEDCWD, self.ns.fromfile)) as fp:
+            with open(os.path.join(os_helper.SAVEDCWD, self.ns.fromfile)) as fp:
                 for line in fp:
                     line = line.split('#', 1)[0]
                     line = line.strip()
@@ -311,15 +313,33 @@
 
         self.log()
         self.log("Re-running failed tests in verbose mode")
-        self.rerun = self.bad[:]
-        for test_name in self.rerun:
-            self.log(f"Re-running {test_name} in verbose mode")
+        rerun_list = list(self.need_rerun)
+        self.need_rerun.clear()
+        for result in rerun_list:
+            test_name = result.name
+            self.rerun.append(test_name)
+
+            errors = result.errors or []
+            failures = result.failures or []
+            error_names = [test_full_name.split(" ")[0] for (test_full_name, *_) in errors]
+            failure_names = [test_full_name.split(" ")[0] for (test_full_name, *_) in failures]
             self.ns.verbose = True
+            orig_match_tests = self.ns.match_tests
+            if errors or failures:
+                if self.ns.match_tests is None:
+                    self.ns.match_tests = []
+                self.ns.match_tests.extend(error_names)
+                self.ns.match_tests.extend(failure_names)
+                matching = "matching: " + ", ".join(self.ns.match_tests)
+                self.log(f"Re-running {test_name} in verbose mode ({matching})")
+            else:
+                self.log(f"Re-running {test_name} in verbose mode")
             result = runtest(self.ns, test_name)
+            self.ns.match_tests = orig_match_tests
 
             self.accumulate_result(result, rerun=True)
 
-            if result.result == INTERRUPTED:
+            if isinstance(result, Interrupted):
                 break
 
         if self.bad:
@@ -420,14 +440,14 @@
                 result = runtest(self.ns, test_name)
                 self.accumulate_result(result)
 
-            if result.result == INTERRUPTED:
+            if isinstance(result, Interrupted):
                 break
 
-            previous_test = format_test_result(result)
+            previous_test = str(result)
             test_time = time.monotonic() - start_time
             if test_time >= PROGRESS_MIN_TIME:
                 previous_test = "%s in %s" % (previous_test, format_duration(test_time))
-            elif result.result == PASSED:
+            elif isinstance(result, Passed):
                 # be quiet: say nothing if the test passed shortly
                 previous_test = None
 
@@ -558,7 +578,7 @@
         for k, v in totals.items():
             root.set(k, str(v))
 
-        xmlpath = os.path.join(support.SAVEDCWD, self.ns.xmlpath)
+        xmlpath = os.path.join(os_helper.SAVEDCWD, self.ns.xmlpath)
         with open(xmlpath, 'wb') as f:
             for s in ET.tostringlist(root):
                 f.write(s)
@@ -596,7 +616,7 @@
             test_cwd = 'test_python_worker_{}'.format(pid)
         else:
             test_cwd = 'test_python_{}'.format(pid)
-        test_cwd += support.FS_NONASCII
+        test_cwd += os_helper.FS_NONASCII
         test_cwd = os.path.join(self.tmp_dir, test_cwd)
         return test_cwd
 
@@ -608,10 +628,10 @@
         for name in glob.glob(path):
             if os.path.isdir(name):
                 print("Remove directory: %s" % name)
-                support.rmtree(name)
+                os_helper.rmtree(name)
             else:
                 print("Remove file: %s" % name)
-                support.unlink(name)
+                os_helper.unlink(name)
 
     def main(self, tests=None, **kwargs):
         self.parse_args(kwargs)
@@ -628,8 +648,8 @@
             # Run the tests in a context manager that temporarily changes the CWD
             # to a temporary and writable directory. If it's not possible to
             # create or change the CWD, the original CWD will be used.
-            # The original CWD is available from support.SAVEDCWD.
-            with support.temp_cwd(test_cwd, quiet=True):
+            # The original CWD is available from os_helper.SAVEDCWD.
+            with os_helper.temp_cwd(test_cwd, quiet=True):
                 # When using multiprocessing, worker processes will use test_cwd
                 # as their parent temporary directory. So when the main process
                 # exit, it removes also subdirectories of worker processes.
diff --git a/Lib/test/libregrtest/pgo.py b/Lib/test/libregrtest/pgo.py
index 379ff05..582e812 100644
--- a/Lib/test/libregrtest/pgo.py
+++ b/Lib/test/libregrtest/pgo.py
@@ -35,6 +35,7 @@
     'test_memoryview',
     'test_operator',
     'test_ordered_dict',
+    'test_patma',
     'test_pickle',
     'test_pprint',
     'test_re',
diff --git a/Lib/test/libregrtest/refleak.py b/Lib/test/libregrtest/refleak.py
index 8d22123..b56a848 100644
--- a/Lib/test/libregrtest/refleak.py
+++ b/Lib/test/libregrtest/refleak.py
@@ -4,6 +4,9 @@
 import warnings
 from inspect import isabstract
 from test import support
+from test.support import os_helper
+from test.libregrtest.utils import clear_caches
+
 try:
     from _abc import _get_dump
 except ImportError:
@@ -61,7 +64,7 @@
         return int_pool.setdefault(value, value)
 
     nwarmup, ntracked, fname = ns.huntrleaks
-    fname = os.path.join(support.SAVEDCWD, fname)
+    fname = os.path.join(os_helper.SAVEDCWD, fname)
     repcount = nwarmup + ntracked
 
     # Pre-allocate to ensure that the loop doesn't allocate anything new
@@ -71,7 +74,7 @@
     fd_deltas = [0] * repcount
     getallocatedblocks = sys.getallocatedblocks
     gettotalrefcount = sys.gettotalrefcount
-    fd_count = support.fd_count
+    fd_count = os_helper.fd_count
 
     # initialize variables to make pyflakes quiet
     rc_before = alloc_before = fd_before = 0
@@ -109,7 +112,7 @@
 
     # These checkers return False on success, True on failure
     def check_rc_deltas(deltas):
-        # Checker for reference counters and memomry blocks.
+        # Checker for reference counters and memory blocks.
         #
         # bpo-30776: Try to ignore false positives:
         #
@@ -179,102 +182,6 @@
     clear_caches()
 
 
-def clear_caches():
-    # Clear the warnings registry, so they can be displayed again
-    for mod in sys.modules.values():
-        if hasattr(mod, '__warningregistry__'):
-            del mod.__warningregistry__
-
-    # Flush standard output, so that buffered data is sent to the OS and
-    # associated Python objects are reclaimed.
-    for stream in (sys.stdout, sys.stderr, sys.__stdout__, sys.__stderr__):
-        if stream is not None:
-            stream.flush()
-
-    # Clear assorted module caches.
-    # Don't worry about resetting the cache if the module is not loaded
-    try:
-        distutils_dir_util = sys.modules['distutils.dir_util']
-    except KeyError:
-        pass
-    else:
-        distutils_dir_util._path_created.clear()
-    re.purge()
-
-    try:
-        _strptime = sys.modules['_strptime']
-    except KeyError:
-        pass
-    else:
-        _strptime._regex_cache.clear()
-
-    try:
-        urllib_parse = sys.modules['urllib.parse']
-    except KeyError:
-        pass
-    else:
-        urllib_parse.clear_cache()
-
-    try:
-        urllib_request = sys.modules['urllib.request']
-    except KeyError:
-        pass
-    else:
-        urllib_request.urlcleanup()
-
-    try:
-        linecache = sys.modules['linecache']
-    except KeyError:
-        pass
-    else:
-        linecache.clearcache()
-
-    try:
-        mimetypes = sys.modules['mimetypes']
-    except KeyError:
-        pass
-    else:
-        mimetypes._default_mime_types()
-
-    try:
-        filecmp = sys.modules['filecmp']
-    except KeyError:
-        pass
-    else:
-        filecmp._cache.clear()
-
-    try:
-        struct = sys.modules['struct']
-    except KeyError:
-        pass
-    else:
-        struct._clearcache()
-
-    try:
-        doctest = sys.modules['doctest']
-    except KeyError:
-        pass
-    else:
-        doctest.master = None
-
-    try:
-        ctypes = sys.modules['ctypes']
-    except KeyError:
-        pass
-    else:
-        ctypes._reset_cache()
-
-    try:
-        typing = sys.modules['typing']
-    except KeyError:
-        pass
-    else:
-        for f in typing._cleanups:
-            f()
-
-    support.gc_collect()
-
-
 def warm_caches():
     # char cache
     s = bytes(range(256))
diff --git a/Lib/test/libregrtest/runtest.py b/Lib/test/libregrtest/runtest.py
index 9338b28..489ab98 100644
--- a/Lib/test/libregrtest/runtest.py
+++ b/Lib/test/libregrtest/runtest.py
@@ -1,4 +1,3 @@
-import collections
 import faulthandler
 import functools
 import gc
@@ -11,33 +10,110 @@
 import unittest
 
 from test import support
-from test.libregrtest.refleak import dash_R, clear_caches
+from test.support import os_helper
+from test.libregrtest.cmdline import Namespace
 from test.libregrtest.save_env import saved_test_environment
-from test.libregrtest.utils import format_duration, print_warning
+from test.libregrtest.utils import clear_caches, format_duration, print_warning
 
 
-# Test result constants.
-PASSED = 1
-FAILED = 0
-ENV_CHANGED = -1
-SKIPPED = -2
-RESOURCE_DENIED = -3
-INTERRUPTED = -4
-CHILD_ERROR = -5   # error in a child process
-TEST_DID_NOT_RUN = -6
-TIMEOUT = -7
+class TestResult:
+    def __init__(
+        self,
+        name: str,
+        duration_sec: float = 0.0,
+        xml_data: list[str] | None = None,
+    ) -> None:
+        self.name = name
+        self.duration_sec = duration_sec
+        self.xml_data = xml_data
 
-_FORMAT_TEST_RESULT = {
-    PASSED: '%s passed',
-    FAILED: '%s failed',
-    ENV_CHANGED: '%s failed (env changed)',
-    SKIPPED: '%s skipped',
-    RESOURCE_DENIED: '%s skipped (resource denied)',
-    INTERRUPTED: '%s interrupted',
-    CHILD_ERROR: '%s crashed',
-    TEST_DID_NOT_RUN: '%s run no tests',
-    TIMEOUT: '%s timed out',
-}
+    def __str__(self) -> str:
+        return f"{self.name} finished"
+
+
+class Passed(TestResult):
+    def __str__(self) -> str:
+        return f"{self.name} passed"
+
+
+class Failed(TestResult):
+    def __init__(
+        self,
+        name: str,
+        duration_sec: float = 0.0,
+        xml_data: list[str] | None = None,
+        errors: list[tuple[str, str]] | None = None,
+        failures: list[tuple[str, str]] | None = None,
+    ) -> None:
+        super().__init__(name, duration_sec=duration_sec, xml_data=xml_data)
+        self.errors = errors
+        self.failures = failures
+
+    def __str__(self) -> str:
+        if self.errors and self.failures:
+            le = len(self.errors)
+            lf = len(self.failures)
+            error_s = "error" + ("s" if le > 1 else "")
+            failure_s = "failure" + ("s" if lf > 1 else "")
+            return f"{self.name} failed ({le} {error_s}, {lf} {failure_s})"
+
+        if self.errors:
+            le = len(self.errors)
+            error_s = "error" + ("s" if le > 1 else "")
+            return f"{self.name} failed ({le} {error_s})"
+
+        if self.failures:
+            lf = len(self.failures)
+            failure_s = "failure" + ("s" if lf > 1 else "")
+            return f"{self.name} failed ({lf} {failure_s})"
+
+        return f"{self.name} failed"
+
+
+class UncaughtException(Failed):
+    def __str__(self) -> str:
+        return f"{self.name} failed (uncaught exception)"
+
+
+class EnvChanged(Failed):
+    def __str__(self) -> str:
+        return f"{self.name} failed (env changed)"
+
+
+class RefLeak(Failed):
+    def __str__(self) -> str:
+        return f"{self.name} failed (reference leak)"
+
+
+class Skipped(TestResult):
+    def __str__(self) -> str:
+        return f"{self.name} skipped"
+
+
+class ResourceDenied(Skipped):
+    def __str__(self) -> str:
+        return f"{self.name} skipped (resource denied)"
+
+
+class Interrupted(TestResult):
+    def __str__(self) -> str:
+        return f"{self.name} interrupted"
+
+
+class ChildError(Failed):
+    def __str__(self) -> str:
+        return f"{self.name} crashed"
+
+
+class DidNotRun(TestResult):
+    def __str__(self) -> str:
+        return f"{self.name} ran no tests"
+
+
+class Timeout(Failed):
+    def __str__(self) -> str:
+        return f"{self.name} timed out ({format_duration(self.duration_sec)})"
+
 
 # Minimum duration of a test to display its duration or to mention that
 # the test is running in background
@@ -66,21 +142,10 @@
 FOUND_GARBAGE = []
 
 
-def is_failed(result, ns):
-    ok = result.result
-    if ok in (PASSED, RESOURCE_DENIED, SKIPPED, TEST_DID_NOT_RUN):
-        return False
-    if ok == ENV_CHANGED:
+def is_failed(result: TestResult, ns: Namespace) -> bool:
+    if isinstance(result, EnvChanged):
         return ns.fail_env_changed
-    return True
-
-
-def format_test_result(result):
-    fmt = _FORMAT_TEST_RESULT.get(result.result, "%s")
-    text = fmt % result.test_name
-    if result.result == TIMEOUT:
-        text = '%s (%s)' % (text, format_duration(result.test_time))
-    return text
+    return isinstance(result, Failed)
 
 
 def findtestdir(path=None):
@@ -100,7 +165,7 @@
     return stdtests + sorted(tests)
 
 
-def get_abs_module(ns, test_name):
+def get_abs_module(ns: Namespace, test_name: str) -> str:
     if test_name.startswith('test.') or ns.testdir:
         return test_name
     else:
@@ -108,10 +173,7 @@
         return 'test.' + test_name
 
 
-TestResult = collections.namedtuple('TestResult',
-    'test_name result test_time xml_data')
-
-def _runtest(ns, test_name):
+def _runtest(ns: Namespace, test_name: str) -> TestResult:
     # Handle faulthandler timeout, capture stdout+stderr, XML serialization
     # and measure time.
 
@@ -139,7 +201,7 @@
                 sys.stderr = stream
                 result = _runtest_inner(ns, test_name,
                                         display_failure=False)
-                if result != PASSED:
+                if not isinstance(result, Passed):
                     output = stream.getvalue()
                     orig_stderr.write(output)
                     orig_stderr.flush()
@@ -155,36 +217,26 @@
 
         if xml_list:
             import xml.etree.ElementTree as ET
-            xml_data = [ET.tostring(x).decode('us-ascii') for x in xml_list]
-        else:
-            xml_data = None
+            result.xml_data = [
+                ET.tostring(x).decode('us-ascii')
+                for x in xml_list
+            ]
 
-        test_time = time.perf_counter() - start_time
-
-        return TestResult(test_name, result, test_time, xml_data)
+        result.duration_sec = time.perf_counter() - start_time
+        return result
     finally:
         if use_timeout:
             faulthandler.cancel_dump_traceback_later()
         support.junit_xml_list = None
 
 
-def runtest(ns, test_name):
+def runtest(ns: Namespace, test_name: str) -> TestResult:
     """Run a single test.
 
     ns -- regrtest namespace of options
     test_name -- the name of the test
 
-    Returns the tuple (result, test_time, xml_data), where result is one
-    of the constants:
-
-        INTERRUPTED      KeyboardInterrupt
-        RESOURCE_DENIED  test skipped because resource denied
-        SKIPPED          test skipped for some other reason
-        ENV_CHANGED      test failed because it changed the execution environment
-        FAILED           test failed
-        PASSED           test passed
-        EMPTY_TEST_SUITE test ran no subtests.
-        TIMEOUT          test timed out.
+    Returns a TestResult sub-class depending on the kind of result received.
 
     If ns.xmlpath is not None, xml_data is a list containing each
     generated testsuite element.
@@ -196,7 +248,7 @@
             msg = traceback.format_exc()
             print(f"test {test_name} crashed -- {msg}",
                   file=sys.stderr, flush=True)
-        return TestResult(test_name, FAILED, 0.0, None)
+        return Failed(test_name)
 
 
 def _test_module(the_module):
@@ -209,17 +261,27 @@
     support.run_unittest(tests)
 
 
-def _runtest_inner2(ns, test_name):
+def save_env(ns: Namespace, test_name: str):
+    return saved_test_environment(test_name, ns.verbose, ns.quiet, pgo=ns.pgo)
+
+
+def _runtest_inner2(ns: Namespace, test_name: str) -> bool:
     # Load the test function, run the test function, handle huntrleaks
     # and findleaks to detect leaks
 
     abstest = get_abs_module(ns, test_name)
 
     # remove the module from sys.module to reload it if it was already imported
-    support.unload(abstest)
+    try:
+        del sys.modules[abstest]
+    except KeyError:
+        pass
 
     the_module = importlib.import_module(abstest)
 
+    if ns.huntrleaks:
+        from test.libregrtest.refleak import dash_R
+
     # If the test has a test_main, that will run the appropriate
     # tests.  If not, use normal unittest test loading.
     test_runner = getattr(the_module, "test_main", None)
@@ -227,12 +289,13 @@
         test_runner = functools.partial(_test_module, the_module)
 
     try:
-        if ns.huntrleaks:
-            # Return True if the test leaked references
-            refleak = dash_R(ns, test_name, test_runner)
-        else:
-            test_runner()
-            refleak = False
+        with save_env(ns, test_name):
+            if ns.huntrleaks:
+                # Return True if the test leaked references
+                refleak = dash_R(ns, test_name, test_runner)
+            else:
+                test_runner()
+                refleak = False
     finally:
         cleanup_test_droppings(test_name, ns.verbose)
 
@@ -253,7 +316,9 @@
     return refleak
 
 
-def _runtest_inner(ns, test_name, display_failure=True):
+def _runtest_inner(
+    ns: Namespace, test_name: str, display_failure: bool = True
+) -> TestResult:
     # Detect environment changes, handle exceptions.
 
     # Reset the environment_altered flag to detect if a test altered
@@ -266,42 +331,48 @@
     try:
         clear_caches()
 
-        with saved_test_environment(test_name, ns.verbose, ns.quiet, pgo=ns.pgo) as environment:
+        with save_env(ns, test_name):
             refleak = _runtest_inner2(ns, test_name)
     except support.ResourceDenied as msg:
         if not ns.quiet and not ns.pgo:
             print(f"{test_name} skipped -- {msg}", flush=True)
-        return RESOURCE_DENIED
+        return ResourceDenied(test_name)
     except unittest.SkipTest as msg:
         if not ns.quiet and not ns.pgo:
             print(f"{test_name} skipped -- {msg}", flush=True)
-        return SKIPPED
+        return Skipped(test_name)
+    except support.TestFailedWithDetails as exc:
+        msg = f"test {test_name} failed"
+        if display_failure:
+            msg = f"{msg} -- {exc}"
+        print(msg, file=sys.stderr, flush=True)
+        return Failed(test_name, errors=exc.errors, failures=exc.failures)
     except support.TestFailed as exc:
         msg = f"test {test_name} failed"
         if display_failure:
             msg = f"{msg} -- {exc}"
         print(msg, file=sys.stderr, flush=True)
-        return FAILED
+        return Failed(test_name)
     except support.TestDidNotRun:
-        return TEST_DID_NOT_RUN
+        return DidNotRun(test_name)
     except KeyboardInterrupt:
         print()
-        return INTERRUPTED
+        return Interrupted(test_name)
     except:
         if not ns.pgo:
             msg = traceback.format_exc()
             print(f"test {test_name} crashed -- {msg}",
                   file=sys.stderr, flush=True)
-        return FAILED
+        return UncaughtException(test_name)
 
     if refleak:
-        return FAILED
-    if environment.changed:
-        return ENV_CHANGED
-    return PASSED
+        return RefLeak(test_name)
+    if support.environment_altered:
+        return EnvChanged(test_name)
+    return Passed(test_name)
 
 
-def cleanup_test_droppings(test_name, verbose):
+def cleanup_test_droppings(test_name: str, verbose: int) -> None:
     # First kill any dangling references to open files etc.
     # This can also issue some ResourceWarnings which would otherwise get
     # triggered during the following test run, and possibly produce failures.
@@ -313,7 +384,7 @@
     # since if a test leaves a file open, it cannot be deleted by name (while
     # there's nothing we can do about that here either, we can display the
     # name of the offending test, which is a real help).
-    for name in (support.TESTFN,):
+    for name in (os_helper.TESTFN,):
         if not os.path.exists(name):
             continue
 
diff --git a/Lib/test/libregrtest/runtest_mp.py b/Lib/test/libregrtest/runtest_mp.py
index 7a18e45..d0d63ef 100644
--- a/Lib/test/libregrtest/runtest_mp.py
+++ b/Lib/test/libregrtest/runtest_mp.py
@@ -9,12 +9,15 @@
 import threading
 import time
 import traceback
-import types
-from test import support
+from typing import NamedTuple, NoReturn, Literal, Any
 
+from test import support
+from test.support import os_helper
+
+from test.libregrtest.cmdline import Namespace
+from test.libregrtest.main import Regrtest
 from test.libregrtest.runtest import (
-    runtest, INTERRUPTED, CHILD_ERROR, PROGRESS_MIN_TIME,
-    format_test_result, TestResult, is_failed, TIMEOUT)
+    runtest, is_failed, TestResult, Interrupted, Timeout, ChildError, PROGRESS_MIN_TIME)
 from test.libregrtest.setup import setup_tests
 from test.libregrtest.utils import format_duration, print_warning
 
@@ -35,21 +38,21 @@
 USE_PROCESS_GROUP = (hasattr(os, "setsid") and hasattr(os, "killpg"))
 
 
-def must_stop(result, ns):
-    if result.result == INTERRUPTED:
+def must_stop(result: TestResult, ns: Namespace) -> bool:
+    if isinstance(result, Interrupted):
         return True
     if ns.failfast and is_failed(result, ns):
         return True
     return False
 
 
-def parse_worker_args(worker_args):
+def parse_worker_args(worker_args) -> tuple[Namespace, str]:
     ns_dict, test_name = json.loads(worker_args)
-    ns = types.SimpleNamespace(**ns_dict)
+    ns = Namespace(**ns_dict)
     return (ns, test_name)
 
 
-def run_test_in_subprocess(testname, ns):
+def run_test_in_subprocess(testname: str, ns: Namespace) -> subprocess.Popen:
     ns_dict = vars(ns)
     worker_args = (ns_dict, testname)
     worker_args = json.dumps(worker_args)
@@ -70,19 +73,19 @@
                             stderr=subprocess.PIPE,
                             universal_newlines=True,
                             close_fds=(os.name != 'nt'),
-                            cwd=support.SAVEDCWD,
+                            cwd=os_helper.SAVEDCWD,
                             **kw)
 
 
-def run_tests_worker(ns, test_name):
+def run_tests_worker(ns: Namespace, test_name: str) -> NoReturn:
     setup_tests(ns)
 
     result = runtest(ns, test_name)
 
     print()   # Force a newline (just in case)
 
-    # Serialize TestResult as list in JSON
-    print(json.dumps(list(result)), flush=True)
+    # Serialize TestResult as dict in JSON
+    print(json.dumps(result, cls=EncodeTestResult), flush=True)
     sys.exit(0)
 
 
@@ -109,15 +112,23 @@
             self.tests_iter = None
 
 
-MultiprocessResult = collections.namedtuple('MultiprocessResult',
-    'result stdout stderr error_msg')
+class MultiprocessResult(NamedTuple):
+    result: TestResult
+    stdout: str
+    stderr: str
+    error_msg: str
+
+
+ExcStr = str
+QueueOutput = tuple[Literal[False], MultiprocessResult] | tuple[Literal[True], ExcStr]
+
 
 class ExitThread(Exception):
     pass
 
 
 class TestWorkerProcess(threading.Thread):
-    def __init__(self, worker_id, runner):
+    def __init__(self, worker_id: int, runner: "MultiprocessTestRunner") -> None:
         super().__init__()
         self.worker_id = worker_id
         self.pending = runner.pending
@@ -131,7 +142,7 @@
         self._killed = False
         self._stopped = False
 
-    def __repr__(self):
+    def __repr__(self) -> str:
         info = [f'TestWorkerProcess #{self.worker_id}']
         if self.is_alive():
             info.append("running")
@@ -147,7 +158,7 @@
                          f'time={format_duration(dt)}'))
         return '<%s>' % ' '.join(info)
 
-    def _kill(self):
+    def _kill(self) -> None:
         popen = self._popen
         if popen is None:
             return
@@ -175,18 +186,22 @@
         except OSError as exc:
             print_warning(f"Failed to kill {what}: {exc!r}")
 
-    def stop(self):
+    def stop(self) -> None:
         # Method called from a different thread to stop this thread
         self._stopped = True
         self._kill()
 
-    def mp_result_error(self, test_name, error_type, stdout='', stderr='',
-                        err_msg=None):
-        test_time = time.monotonic() - self.start_time
-        result = TestResult(test_name, error_type, test_time, None)
-        return MultiprocessResult(result, stdout, stderr, err_msg)
+    def mp_result_error(
+        self,
+        test_result: TestResult,
+        stdout: str = '',
+        stderr: str = '',
+        err_msg=None
+    ) -> MultiprocessResult:
+        test_result.duration_sec = time.monotonic() - self.start_time
+        return MultiprocessResult(test_result, stdout, stderr, err_msg)
 
-    def _run_process(self, test_name):
+    def _run_process(self, test_name: str) -> tuple[int, str, str]:
         self.start_time = time.monotonic()
 
         self.current_test_name = test_name
@@ -245,11 +260,11 @@
             self._popen = None
             self.current_test_name = None
 
-    def _runtest(self, test_name):
+    def _runtest(self, test_name: str) -> MultiprocessResult:
         retcode, stdout, stderr = self._run_process(test_name)
 
         if retcode is None:
-            return self.mp_result_error(test_name, TIMEOUT, stdout, stderr)
+            return self.mp_result_error(Timeout(test_name), stdout, stderr)
 
         err_msg = None
         if retcode != 0:
@@ -262,18 +277,17 @@
             else:
                 try:
                     # deserialize run_tests_worker() output
-                    result = json.loads(result)
-                    result = TestResult(*result)
+                    result = json.loads(result, object_hook=decode_test_result)
                 except Exception as exc:
                     err_msg = "Failed to parse worker JSON: %s" % exc
 
         if err_msg is not None:
-            return self.mp_result_error(test_name, CHILD_ERROR,
+            return self.mp_result_error(ChildError(test_name),
                                         stdout, stderr, err_msg)
 
         return MultiprocessResult(result, stdout, stderr, err_msg)
 
-    def run(self):
+    def run(self) -> None:
         while not self._stopped:
             try:
                 try:
@@ -292,7 +306,7 @@
                 self.output.put((True, traceback.format_exc()))
                 break
 
-    def _wait_completed(self):
+    def _wait_completed(self) -> None:
         popen = self._popen
 
         # stdout and stderr must be closed to ensure that communicate()
@@ -307,7 +321,7 @@
                           f"(timeout={format_duration(JOIN_TIMEOUT)}): "
                           f"{exc!r}")
 
-    def wait_stopped(self, start_time):
+    def wait_stopped(self, start_time: float) -> None:
         # bpo-38207: MultiprocessTestRunner.stop_workers() called self.stop()
         # which killed the process. Sometimes, killing the process from the
         # main thread does not interrupt popen.communicate() in
@@ -331,7 +345,7 @@
                 break
 
 
-def get_running(workers):
+def get_running(workers: list[TestWorkerProcess]) -> list[TestWorkerProcess]:
     running = []
     for worker in workers:
         current_test_name = worker.current_test_name
@@ -345,11 +359,11 @@
 
 
 class MultiprocessTestRunner:
-    def __init__(self, regrtest):
+    def __init__(self, regrtest: Regrtest) -> None:
         self.regrtest = regrtest
         self.log = self.regrtest.log
         self.ns = regrtest.ns
-        self.output = queue.Queue()
+        self.output: queue.Queue[QueueOutput] = queue.Queue()
         self.pending = MultiprocessIterator(self.regrtest.tests)
         if self.ns.timeout is not None:
             # Rely on faulthandler to kill a worker process. This timouet is
@@ -361,7 +375,7 @@
             self.worker_timeout = None
         self.workers = None
 
-    def start_workers(self):
+    def start_workers(self) -> None:
         self.workers = [TestWorkerProcess(index, self)
                         for index in range(1, self.ns.use_mp + 1)]
         msg = f"Run tests in parallel using {len(self.workers)} child processes"
@@ -373,24 +387,20 @@
         for worker in self.workers:
             worker.start()
 
-    def stop_workers(self):
+    def stop_workers(self) -> None:
         start_time = time.monotonic()
         for worker in self.workers:
             worker.stop()
         for worker in self.workers:
             worker.wait_stopped(start_time)
 
-    def _get_result(self):
-        if not any(worker.is_alive() for worker in self.workers):
-            # all worker threads are done: consume pending results
-            try:
-                return self.output.get(timeout=0)
-            except queue.Empty:
-                return None
-
+    def _get_result(self) -> QueueOutput | None:
         use_faulthandler = (self.ns.timeout is not None)
         timeout = PROGRESS_UPDATE
-        while True:
+
+        # bpo-46205: check the status of workers every iteration to avoid
+        # waiting forever on an empty queue.
+        while any(worker.is_alive() for worker in self.workers):
             if use_faulthandler:
                 faulthandler.dump_traceback_later(MAIN_PROCESS_TIMEOUT,
                                                   exit=True)
@@ -406,21 +416,28 @@
             if running and not self.ns.pgo:
                 self.log('running: %s' % ', '.join(running))
 
-    def display_result(self, mp_result):
+        # all worker threads are done: consume pending results
+        try:
+            return self.output.get(timeout=0)
+        except queue.Empty:
+            return None
+
+    def display_result(self, mp_result: MultiprocessResult) -> None:
         result = mp_result.result
 
-        text = format_test_result(result)
+        text = str(result)
         if mp_result.error_msg is not None:
             # CHILD_ERROR
             text += ' (%s)' % mp_result.error_msg
-        elif (result.test_time >= PROGRESS_MIN_TIME and not self.ns.pgo):
-            text += ' (%s)' % format_duration(result.test_time)
+        elif (result.duration_sec >= PROGRESS_MIN_TIME and not self.ns.pgo):
+            text += ' (%s)' % format_duration(result.duration_sec)
         running = get_running(self.workers)
         if running and not self.ns.pgo:
             text += ' -- running: %s' % ', '.join(running)
         self.regrtest.display_progress(self.test_index, text)
 
-    def _process_result(self, item):
+    def _process_result(self, item: QueueOutput) -> bool:
+        """Returns True if test runner must stop."""
         if item[0]:
             # Thread got an exception
             format_exc = item[1]
@@ -442,7 +459,7 @@
 
         return False
 
-    def run_tests(self):
+    def run_tests(self) -> None:
         self.start_workers()
 
         self.test_index = 0
@@ -468,5 +485,41 @@
             self.stop_workers()
 
 
-def run_tests_multiprocess(regrtest):
+def run_tests_multiprocess(regrtest: Regrtest) -> None:
     MultiprocessTestRunner(regrtest).run_tests()
+
+
+class EncodeTestResult(json.JSONEncoder):
+    """Encode a TestResult (sub)class object into a JSON dict."""
+
+    def default(self, o: Any) -> dict[str, Any]:
+        if isinstance(o, TestResult):
+            result = vars(o)
+            result["__test_result__"] = o.__class__.__name__
+            return result
+
+        return super().default(o)
+
+
+def decode_test_result(d: dict[str, Any]) -> TestResult | dict[str, Any]:
+    """Decode a TestResult (sub)class object from a JSON dict."""
+
+    if "__test_result__" not in d:
+        return d
+
+    cls_name = d.pop("__test_result__")
+    for cls in get_all_test_result_classes():
+        if cls.__name__ == cls_name:
+            return cls(**d)
+
+
+def get_all_test_result_classes() -> set[type[TestResult]]:
+    prev_count = 0
+    classes = {TestResult}
+    while len(classes) > prev_count:
+        prev_count = len(classes)
+        to_add = []
+        for cls in classes:
+            to_add.extend(cls.__subclasses__())
+        classes.update(to_add)
+    return classes
diff --git a/Lib/test/libregrtest/save_env.py b/Lib/test/libregrtest/save_env.py
index e7c27a6..f0bfcf3 100644
--- a/Lib/test/libregrtest/save_env.py
+++ b/Lib/test/libregrtest/save_env.py
@@ -1,20 +1,15 @@
-import asyncio
 import builtins
 import locale
-import logging
 import os
-import shutil
 import sys
-import sysconfig
 import threading
-import urllib.request
-import warnings
 from test import support
+from test.support import os_helper
 from test.libregrtest.utils import print_warning
-try:
-    import _multiprocessing, multiprocessing.process
-except ImportError:
-    multiprocessing = None
+
+
+class SkipTestEnvironment(Exception):
+    pass
 
 
 # Unit tests are supposed to leave the execution environment unchanged
@@ -32,15 +27,13 @@
             #stuff
 
     Unless quiet is True, a warning is printed to stderr if any of
-    the saved items was changed by the test.  The attribute 'changed'
-    is initially False, but is set to True if a change is detected.
+    the saved items was changed by the test. The support.environment_altered
+    attribute is set to True if a change is detected.
 
     If verbose is more than 1, the before and after state of changed
     items is also printed.
     """
 
-    changed = False
-
     def __init__(self, testname, verbose=0, quiet=False, *, pgo=False):
         self.testname = testname
         self.verbose = verbose
@@ -72,20 +65,36 @@
                  'urllib.requests._url_tempfiles', 'urllib.requests._opener',
                 )
 
+    def get_module(self, name):
+        # function for restore() methods
+        return sys.modules[name]
+
+    def try_get_module(self, name):
+        # function for get() methods
+        try:
+            return self.get_module(name)
+        except KeyError:
+            raise SkipTestEnvironment
+
     def get_urllib_requests__url_tempfiles(self):
-        return list(urllib.request._url_tempfiles)
+        urllib_request = self.try_get_module('urllib.request')
+        return list(urllib_request._url_tempfiles)
     def restore_urllib_requests__url_tempfiles(self, tempfiles):
         for filename in tempfiles:
-            support.unlink(filename)
+            os_helper.unlink(filename)
 
     def get_urllib_requests__opener(self):
-        return urllib.request._opener
+        urllib_request = self.try_get_module('urllib.request')
+        return urllib_request._opener
     def restore_urllib_requests__opener(self, opener):
-        urllib.request._opener = opener
+        urllib_request = self.get_module('urllib.request')
+        urllib_request._opener = opener
 
     def get_asyncio_events__event_loop_policy(self):
+        self.try_get_module('asyncio')
         return support.maybe_get_event_loop_policy()
     def restore_asyncio_events__event_loop_policy(self, policy):
+        asyncio = self.get_module('asyncio')
         asyncio.set_event_loop_policy(policy)
 
     def get_sys_argv(self):
@@ -144,8 +153,10 @@
         builtins.__import__ = import_
 
     def get_warnings_filters(self):
+        warnings = self.try_get_module('warnings')
         return id(warnings.filters), warnings.filters, warnings.filters[:]
     def restore_warnings_filters(self, saved_filters):
+        warnings = self.get_module('warnings')
         warnings.filters = saved_filters[1]
         warnings.filters[:] = saved_filters[2]
 
@@ -160,23 +171,28 @@
             asyncore.socket_map.update(saved_map)
 
     def get_shutil_archive_formats(self):
+        shutil = self.try_get_module('shutil')
         # we could call get_archives_formats() but that only returns the
         # registry keys; we want to check the values too (the functions that
         # are registered)
         return shutil._ARCHIVE_FORMATS, shutil._ARCHIVE_FORMATS.copy()
     def restore_shutil_archive_formats(self, saved):
+        shutil = self.get_module('shutil')
         shutil._ARCHIVE_FORMATS = saved[0]
         shutil._ARCHIVE_FORMATS.clear()
         shutil._ARCHIVE_FORMATS.update(saved[1])
 
     def get_shutil_unpack_formats(self):
+        shutil = self.try_get_module('shutil')
         return shutil._UNPACK_FORMATS, shutil._UNPACK_FORMATS.copy()
     def restore_shutil_unpack_formats(self, saved):
+        shutil = self.get_module('shutil')
         shutil._UNPACK_FORMATS = saved[0]
         shutil._UNPACK_FORMATS.clear()
         shutil._UNPACK_FORMATS.update(saved[1])
 
     def get_logging__handlers(self):
+        logging = self.try_get_module('logging')
         # _handlers is a WeakValueDictionary
         return id(logging._handlers), logging._handlers, logging._handlers.copy()
     def restore_logging__handlers(self, saved_handlers):
@@ -184,6 +200,7 @@
         pass
 
     def get_logging__handlerList(self):
+        logging = self.try_get_module('logging')
         # _handlerList is a list of weakrefs to handlers
         return id(logging._handlerList), logging._handlerList, logging._handlerList[:]
     def restore_logging__handlerList(self, saved_handlerList):
@@ -207,32 +224,34 @@
 
     # Same for Process objects
     def get_multiprocessing_process__dangling(self):
-        if not multiprocessing:
-            return None
+        multiprocessing_process = self.try_get_module('multiprocessing.process')
         # Unjoined process objects can survive after process exits
-        multiprocessing.process._cleanup()
+        multiprocessing_process._cleanup()
         # This copies the weakrefs without making any strong reference
-        return multiprocessing.process._dangling.copy()
+        return multiprocessing_process._dangling.copy()
     def restore_multiprocessing_process__dangling(self, saved):
-        if not multiprocessing:
-            return
-        multiprocessing.process._dangling.clear()
-        multiprocessing.process._dangling.update(saved)
+        multiprocessing_process = self.get_module('multiprocessing.process')
+        multiprocessing_process._dangling.clear()
+        multiprocessing_process._dangling.update(saved)
 
     def get_sysconfig__CONFIG_VARS(self):
         # make sure the dict is initialized
+        sysconfig = self.try_get_module('sysconfig')
         sysconfig.get_config_var('prefix')
         return (id(sysconfig._CONFIG_VARS), sysconfig._CONFIG_VARS,
                 dict(sysconfig._CONFIG_VARS))
     def restore_sysconfig__CONFIG_VARS(self, saved):
+        sysconfig = self.get_module('sysconfig')
         sysconfig._CONFIG_VARS = saved[1]
         sysconfig._CONFIG_VARS.clear()
         sysconfig._CONFIG_VARS.update(saved[2])
 
     def get_sysconfig__INSTALL_SCHEMES(self):
+        sysconfig = self.try_get_module('sysconfig')
         return (id(sysconfig._INSTALL_SCHEMES), sysconfig._INSTALL_SCHEMES,
                 sysconfig._INSTALL_SCHEMES.copy())
     def restore_sysconfig__INSTALL_SCHEMES(self, saved):
+        sysconfig = self.get_module('sysconfig')
         sysconfig._INSTALL_SCHEMES = saved[1]
         sysconfig._INSTALL_SCHEMES.clear()
         sysconfig._INSTALL_SCHEMES.update(saved[2])
@@ -241,12 +260,12 @@
         return sorted(fn + ('/' if os.path.isdir(fn) else '')
                       for fn in os.listdir())
     def restore_files(self, saved_value):
-        fn = support.TESTFN
+        fn = os_helper.TESTFN
         if fn not in saved_value and (fn + '/') not in saved_value:
             if os.path.isfile(fn):
-                support.unlink(fn)
+                os_helper.unlink(fn)
             elif os.path.isdir(fn):
-                support.rmtree(fn)
+                os_helper.rmtree(fn)
 
     _lc = [getattr(locale, lc) for lc in dir(locale)
            if lc.startswith('LC_')]
@@ -263,8 +282,10 @@
             locale.setlocale(lc, setting)
 
     def get_warnings_showwarning(self):
+        warnings = self.try_get_module('warnings')
         return warnings.showwarning
     def restore_warnings_showwarning(self, fxn):
+        warnings = self.get_module('warnings')
         warnings.showwarning = fxn
 
     def resource_info(self):
@@ -275,26 +296,28 @@
             yield name, getattr(self, get_name), getattr(self, restore_name)
 
     def __enter__(self):
-        self.saved_values = dict((name, get()) for name, get, restore
-                                                   in self.resource_info())
+        self.saved_values = []
+        for name, get, restore in self.resource_info():
+            try:
+                original = get()
+            except SkipTestEnvironment:
+                continue
+
+            self.saved_values.append((name, get, restore, original))
         return self
 
     def __exit__(self, exc_type, exc_val, exc_tb):
         saved_values = self.saved_values
-        del self.saved_values
+        self.saved_values = None
 
         # Some resources use weak references
         support.gc_collect()
 
-        # Read support.environment_altered, set by support helper functions
-        self.changed |= support.environment_altered
-
-        for name, get, restore in self.resource_info():
+        for name, get, restore, original in saved_values:
             current = get()
-            original = saved_values.pop(name)
             # Check for changes to the resource's value
             if current != original:
-                self.changed = True
+                support.environment_altered = True
                 restore(original)
                 if not self.quiet and not self.pgo:
                     print_warning(f"{name} was modified by {self.testname}")
diff --git a/Lib/test/libregrtest/setup.py b/Lib/test/libregrtest/setup.py
index 1f264c1..b791759 100644
--- a/Lib/test/libregrtest/setup.py
+++ b/Lib/test/libregrtest/setup.py
@@ -10,7 +10,11 @@
 except ImportError:
     gc = None
 
-from test.libregrtest.utils import setup_unraisable_hook
+from test.libregrtest.utils import (setup_unraisable_hook,
+                                    setup_threading_excepthook)
+
+
+UNICODE_GUARD_ENV = "PYTHONREGRTEST_UNICODE_GUARD"
 
 
 def setup_tests(ns):
@@ -35,6 +39,7 @@
         for signum in signals:
             faulthandler.register(signum, chain=True, file=stderr_fd)
 
+    _adjust_resource_limits()
     replace_stdout()
     support.record_original_stdout(sys.stdout)
 
@@ -62,6 +67,7 @@
 
     if ns.huntrleaks:
         unittest.BaseTestSuite._cleanup = False
+        sys._deactivate_opcache()
 
     if ns.memlimit is not None:
         support.set_memlimit(ns.memlimit)
@@ -80,6 +86,7 @@
         sys.addaudithook(_test_audit_hook)
 
     setup_unraisable_hook()
+    setup_threading_excepthook()
 
     if ns.timeout is not None:
         # For a slow buildbot worker, increase SHORT_TIMEOUT and LONG_TIMEOUT
@@ -92,6 +99,17 @@
         support.SHORT_TIMEOUT = min(support.SHORT_TIMEOUT, ns.timeout)
         support.LONG_TIMEOUT = min(support.LONG_TIMEOUT, ns.timeout)
 
+    if ns.xmlpath:
+        from test.support.testresult import RegressionTestResult
+        RegressionTestResult.USE_XML = True
+
+    # Ensure there's a non-ASCII character in env vars at all times to force
+    # tests consider this case. See BPO-44647 for details.
+    os.environ.setdefault(
+        UNICODE_GUARD_ENV,
+        "\N{SMILING FACE WITH SUNGLASSES}",
+    )
+
 
 def replace_stdout():
     """Set stdout encoder error handler to backslashreplace (as stderr error
@@ -117,3 +135,26 @@
         sys.stdout.close()
         sys.stdout = stdout
     atexit.register(restore_stdout)
+
+
+def _adjust_resource_limits():
+    """Adjust the system resource limits (ulimit) if needed."""
+    try:
+        import resource
+        from resource import RLIMIT_NOFILE, RLIM_INFINITY
+    except ImportError:
+        return
+    fd_limit, max_fds = resource.getrlimit(RLIMIT_NOFILE)
+    # On macOS the default fd limit is sometimes too low (256) for our
+    # test suite to succeed.  Raise it to something more reasonable.
+    # 1024 is a common Linux default.
+    desired_fds = 1024
+    if fd_limit < desired_fds and fd_limit < max_fds:
+        new_fd_limit = min(desired_fds, max_fds)
+        try:
+            resource.setrlimit(RLIMIT_NOFILE, (new_fd_limit, max_fds))
+            print(f"Raised RLIMIT_NOFILE: {fd_limit} -> {new_fd_limit}")
+        except (ValueError, OSError) as err:
+            print(f"Unable to raise RLIMIT_NOFILE from {fd_limit} to "
+                  f"{new_fd_limit}: {err}.")
+
diff --git a/Lib/test/libregrtest/utils.py b/Lib/test/libregrtest/utils.py
index 71f538f..89d7e7e 100644
--- a/Lib/test/libregrtest/utils.py
+++ b/Lib/test/libregrtest/utils.py
@@ -68,14 +68,23 @@
 orig_unraisablehook = None
 
 
+def flush_std_streams():
+    if sys.stdout is not None:
+        sys.stdout.flush()
+    if sys.stderr is not None:
+        sys.stderr.flush()
+
+
 def regrtest_unraisable_hook(unraisable):
     global orig_unraisablehook
     support.environment_altered = True
     print_warning("Unraisable exception")
     old_stderr = sys.stderr
     try:
+        flush_std_streams()
         sys.stderr = sys.__stderr__
         orig_unraisablehook(unraisable)
+        sys.stderr.flush()
     finally:
         sys.stderr = old_stderr
 
@@ -84,3 +93,129 @@
     global orig_unraisablehook
     orig_unraisablehook = sys.unraisablehook
     sys.unraisablehook = regrtest_unraisable_hook
+
+
+orig_threading_excepthook = None
+
+
+def regrtest_threading_excepthook(args):
+    global orig_threading_excepthook
+    support.environment_altered = True
+    print_warning(f"Uncaught thread exception: {args.exc_type.__name__}")
+    old_stderr = sys.stderr
+    try:
+        flush_std_streams()
+        sys.stderr = sys.__stderr__
+        orig_threading_excepthook(args)
+        sys.stderr.flush()
+    finally:
+        sys.stderr = old_stderr
+
+
+def setup_threading_excepthook():
+    global orig_threading_excepthook
+    import threading
+    orig_threading_excepthook = threading.excepthook
+    threading.excepthook = regrtest_threading_excepthook
+
+
+def clear_caches():
+    # Clear the warnings registry, so they can be displayed again
+    for mod in sys.modules.values():
+        if hasattr(mod, '__warningregistry__'):
+            del mod.__warningregistry__
+
+    # Flush standard output, so that buffered data is sent to the OS and
+    # associated Python objects are reclaimed.
+    for stream in (sys.stdout, sys.stderr, sys.__stdout__, sys.__stderr__):
+        if stream is not None:
+            stream.flush()
+
+    # Clear assorted module caches.
+    # Don't worry about resetting the cache if the module is not loaded
+    try:
+        distutils_dir_util = sys.modules['distutils.dir_util']
+    except KeyError:
+        pass
+    else:
+        distutils_dir_util._path_created.clear()
+
+    try:
+        re = sys.modules['re']
+    except KeyError:
+        pass
+    else:
+        re.purge()
+
+    try:
+        _strptime = sys.modules['_strptime']
+    except KeyError:
+        pass
+    else:
+        _strptime._regex_cache.clear()
+
+    try:
+        urllib_parse = sys.modules['urllib.parse']
+    except KeyError:
+        pass
+    else:
+        urllib_parse.clear_cache()
+
+    try:
+        urllib_request = sys.modules['urllib.request']
+    except KeyError:
+        pass
+    else:
+        urllib_request.urlcleanup()
+
+    try:
+        linecache = sys.modules['linecache']
+    except KeyError:
+        pass
+    else:
+        linecache.clearcache()
+
+    try:
+        mimetypes = sys.modules['mimetypes']
+    except KeyError:
+        pass
+    else:
+        mimetypes._default_mime_types()
+
+    try:
+        filecmp = sys.modules['filecmp']
+    except KeyError:
+        pass
+    else:
+        filecmp._cache.clear()
+
+    try:
+        struct = sys.modules['struct']
+    except KeyError:
+        pass
+    else:
+        struct._clearcache()
+
+    try:
+        doctest = sys.modules['doctest']
+    except KeyError:
+        pass
+    else:
+        doctest.master = None
+
+    try:
+        ctypes = sys.modules['ctypes']
+    except KeyError:
+        pass
+    else:
+        ctypes._reset_cache()
+
+    try:
+        typing = sys.modules['typing']
+    except KeyError:
+        pass
+    else:
+        for f in typing._cleanups:
+            f()
+
+    support.gc_collect()
diff --git a/Lib/test/libregrtest/win_utils.py b/Lib/test/libregrtest/win_utils.py
index 028c011..a1cc220 100644
--- a/Lib/test/libregrtest/win_utils.py
+++ b/Lib/test/libregrtest/win_utils.py
@@ -5,7 +5,7 @@
 import subprocess
 import uuid
 import winreg
-from test import support
+from test.support import os_helper
 from test.libregrtest.utils import print_warning
 
 
@@ -69,7 +69,9 @@
         # Spawn off the load monitor
         counter_name = self._get_counter_name()
         command = ['typeperf', counter_name, '-si', str(SAMPLING_INTERVAL)]
-        self._popen = subprocess.Popen(' '.join(command), stdout=command_stdout, cwd=support.SAVEDCWD)
+        self._popen = subprocess.Popen(' '.join(command),
+                                       stdout=command_stdout,
+                                       cwd=os_helper.SAVEDCWD)
 
         # Close our copy of the write end of the pipe
         os.close(command_stdout)
diff --git a/Lib/test/list_tests.py b/Lib/test/list_tests.py
index 44bc2ae..f7eea88 100644
--- a/Lib/test/list_tests.py
+++ b/Lib/test/list_tests.py
@@ -66,20 +66,6 @@
             a = self.type2test([a])
         self.assertRaises(RecursionError, repr, a)
 
-    def test_print(self):
-        d = self.type2test(range(200))
-        d.append(d)
-        d.extend(range(200,400))
-        d.append(d)
-        d.append(400)
-        try:
-            with open(support.TESTFN, "w") as fo:
-                fo.write(str(d))
-            with open(support.TESTFN, "r") as fo:
-                self.assertEqual(fo.read(), repr(d))
-        finally:
-            os.remove(support.TESTFN)
-
     def test_set_subscript(self):
         a = self.type2test(range(20))
         self.assertRaises(ValueError, a.__setitem__, slice(0, 10, 0), [1,2,3])
diff --git a/Lib/test/lock_tests.py b/Lib/test/lock_tests.py
index b397525..dffb7d4 100644
--- a/Lib/test/lock_tests.py
+++ b/Lib/test/lock_tests.py
@@ -3,6 +3,7 @@
 """
 
 import os
+import gc
 import sys
 import time
 from _thread import start_new_thread, TIMEOUT_MAX
@@ -11,6 +12,7 @@
 import weakref
 
 from test import support
+from test.support import threading_helper
 
 
 requires_fork = unittest.skipUnless(hasattr(os, 'fork'),
@@ -37,7 +39,7 @@
         self.started = []
         self.finished = []
         self._can_exit = not wait_before_exit
-        self.wait_thread = support.wait_threads_exit()
+        self.wait_thread = threading_helper.wait_threads_exit()
         self.wait_thread.__enter__()
 
         def task():
@@ -73,10 +75,10 @@
 
 class BaseTestCase(unittest.TestCase):
     def setUp(self):
-        self._threads = support.threading_setup()
+        self._threads = threading_helper.threading_setup()
 
     def tearDown(self):
-        support.threading_cleanup(*self._threads)
+        threading_helper.threading_cleanup(*self._threads)
         support.reap_children()
 
     def assertTimeout(self, actual, expected):
@@ -220,6 +222,7 @@
         lock = self.locktype()
         ref = weakref.ref(lock)
         del lock
+        gc.collect()  # For PyPy or other GCs.
         self.assertIsNone(ref())
 
 
@@ -239,7 +242,7 @@
             lock.acquire()
             phase.append(None)
 
-        with support.wait_threads_exit():
+        with threading_helper.wait_threads_exit():
             start_new_thread(f, ())
             while len(phase) == 0:
                 _wait()
diff --git a/Lib/test/make_ssl_certs.py b/Lib/test/make_ssl_certs.py
index 41b5f46..94a35a6 100644
--- a/Lib/test/make_ssl_certs.py
+++ b/Lib/test/make_ssl_certs.py
@@ -7,6 +7,9 @@
 import tempfile
 from subprocess import *
 
+startdate = "20180829142316Z"
+enddate = "20371028142316Z"
+
 req_template = """
     [ default ]
     base_url               = http://testca.pythontest.net/testca
@@ -21,6 +24,8 @@
     O                      = Python Software Foundation
     CN                     = {hostname}
 
+    [req_x509_extensions_nosan]
+
     [req_x509_extensions_simple]
     subjectAltName         = @san
 
@@ -70,8 +75,12 @@
     database  = $dir/index.txt
     crlnumber = $dir/crl.txt
     default_md = sha256
-    default_days = 3600
-    default_crl_days = 3600
+    startdate = {startdate}
+    default_startdate = {startdate}
+    enddate = {enddate}
+    default_enddate = {enddate}
+    default_days = 7000
+    default_crl_days = 7000
     certificate = pycacert.pem
     private_key = pycakey.pem
     serial    = $dir/serial
@@ -116,10 +125,15 @@
             tempnames.append(f.name)
     req_file, cert_file, key_file = tempnames
     try:
-        req = req_template.format(hostname=hostname, extra_san=extra_san)
+        req = req_template.format(
+            hostname=hostname,
+            extra_san=extra_san,
+            startdate=startdate,
+            enddate=enddate
+        )
         with open(req_file, 'w') as f:
             f.write(req)
-        args = ['req', '-new', '-days', '3650', '-nodes',
+        args = ['req', '-new', '-nodes', '-days', '7000',
                 '-newkey', key, '-keyout', key_file,
                 '-extensions', ext,
                 '-config', req_file]
@@ -168,19 +182,30 @@
         f.write("00")
     with open(os.path.join('cadir','index.txt.attr'),'w+') as f:
         f.write('unique_subject = no')
+    # random start value for serial numbers
+    with open(os.path.join('cadir','serial'), 'w') as f:
+        f.write('CB2D80995A69525B\n')
 
     with tempfile.NamedTemporaryFile("w") as t:
-        t.write(req_template.format(hostname='our-ca-server', extra_san=''))
+        req = req_template.format(
+            hostname='our-ca-server',
+            extra_san='',
+            startdate=startdate,
+            enddate=enddate
+        )
+        t.write(req)
         t.flush()
         with tempfile.NamedTemporaryFile() as f:
-            args = ['req', '-new', '-days', '3650', '-extensions', 'v3_ca', '-nodes',
-                    '-newkey', 'rsa:3072', '-keyout', 'pycakey.pem',
+            args = ['req', '-config', t.name, '-new',
+                    '-nodes',
+                    '-newkey', 'rsa:3072',
+                    '-keyout', 'pycakey.pem',
                     '-out', f.name,
                     '-subj', '/C=XY/L=Castle Anthrax/O=Python Software Foundation CA/CN=our-ca-server']
             check_call(['openssl'] + args)
-            args = ['ca', '-config', t.name, '-create_serial',
+            args = ['ca', '-config', t.name,
                     '-out', 'pycacert.pem', '-batch', '-outdir', TMP_CADIR,
-                    '-keyfile', 'pycakey.pem', '-days', '3650',
+                    '-keyfile', 'pycakey.pem',
                     '-selfsign', '-extensions', 'v3_ca', '-infiles', f.name ]
             check_call(['openssl'] + args)
             args = ['ca', '-config', t.name, '-gencrl', '-out', 'revocation.crl']
@@ -223,18 +248,18 @@
         f.write(key)
         f.write(cert)
 
-    cert, key = make_cert_key('localhost', True)
+    cert, key = make_cert_key('localhost', sign=True)
     with open('keycert3.pem', 'w') as f:
         f.write(key)
         f.write(cert)
 
-    cert, key = make_cert_key('fakehostname', True)
+    cert, key = make_cert_key('fakehostname', sign=True)
     with open('keycert4.pem', 'w') as f:
         f.write(key)
         f.write(cert)
 
     cert, key = make_cert_key(
-        'localhost-ecc', True, key='param:secp384r1.pem'
+        'localhost-ecc', sign=True, key='param:secp384r1.pem'
     )
     with open('keycertecc.pem', 'w') as f:
         f.write(key)
@@ -254,7 +279,7 @@
         'RID.1 = 1.2.3.4.5',
     ]
 
-    cert, key = make_cert_key('allsans', extra_san='\n'.join(extra_san))
+    cert, key = make_cert_key('allsans', sign=True, extra_san='\n'.join(extra_san))
     with open('allsans.pem', 'w') as f:
         f.write(key)
         f.write(cert)
@@ -271,12 +296,17 @@
     ]
 
     # IDN SANS, signed
-    cert, key = make_cert_key('idnsans', True, extra_san='\n'.join(extra_san))
+    cert, key = make_cert_key('idnsans', sign=True, extra_san='\n'.join(extra_san))
     with open('idnsans.pem', 'w') as f:
         f.write(key)
         f.write(cert)
 
+    cert, key = make_cert_key('nosan', sign=True, ext='req_x509_extensions_nosan')
+    with open('nosan.pem', 'w') as f:
+        f.write(key)
+        f.write(cert)
+
     unmake_ca()
-    print("update Lib/test/test_ssl.py and Lib/test/test_asyncio/util.py")
+    print("update Lib/test/test_ssl.py and Lib/test/test_asyncio/utils.py")
     print_cert('keycert.pem')
     print_cert('keycert3.pem')
diff --git a/Lib/test/mime.types b/Lib/test/mime.types
index 6872443..eb39a17 100644
--- a/Lib/test/mime.types
+++ b/Lib/test/mime.types
@@ -1,11 +1,11 @@
 # This is a comment. I love comments.		    -*- indent-tabs-mode: t -*-
 
-# This file controls what Internet media types are sent to the client for
+# This file controls what internet media types are sent to the client for
 # given file extension(s).  Sending the correct media type to the client
 # is important so they know how to handle the content of the file.
 # Extra types can either be added here or by using an AddType directive
-# in your config files. For more information about Internet media types,
-# please read RFC 2045, 2046, 2047, 2048, and 2077.  The Internet media type
+# in your config files. For more information about internet media types,
+# please read RFC 2045, 2046, 2047, 2048, and 2077.  The internet media type
 # registry is at <http://www.iana.org/assignments/media-types/>.
 
 # IANA types
diff --git a/Lib/test/mock_socket.py b/Lib/test/mock_socket.py
index cda4db2..c7abddc 100644
--- a/Lib/test/mock_socket.py
+++ b/Lib/test/mock_socket.py
@@ -107,6 +107,9 @@
     def close(self):
         pass
 
+    def connect(self, host):
+        pass
+
 
 def socket(family=None, type=None, proto=None):
     return MockSocket(family)
@@ -152,8 +155,12 @@
 
 
 # Constants
+_GLOBAL_DEFAULT_TIMEOUT = socket_module._GLOBAL_DEFAULT_TIMEOUT
 AF_INET = socket_module.AF_INET
 AF_INET6 = socket_module.AF_INET6
 SOCK_STREAM = socket_module.SOCK_STREAM
 SOL_SOCKET = None
 SO_REUSEADDR = None
+
+if hasattr(socket_module, 'AF_UNIX'):
+    AF_UNIX = socket_module.AF_UNIX
diff --git a/Lib/test/multibytecodec_support.py b/Lib/test/multibytecodec_support.py
index f76c015..dbf0cc4 100644
--- a/Lib/test/multibytecodec_support.py
+++ b/Lib/test/multibytecodec_support.py
@@ -296,7 +296,7 @@
             self.skipTest("Could not retrieve "+self.mapfileurl)
 
     def open_mapping_file(self):
-        return support.open_urlresource(self.mapfileurl)
+        return support.open_urlresource(self.mapfileurl, encoding="utf-8")
 
     def test_mapping_file(self):
         if self.mapfileurl.endswith('.xml'):
diff --git a/Lib/test/nosan.pem b/Lib/test/nosan.pem
new file mode 100644
index 0000000..ec10cdc
--- /dev/null
+++ b/Lib/test/nosan.pem
@@ -0,0 +1,130 @@
+-----BEGIN PRIVATE KEY-----
+MIIG/QIBADANBgkqhkiG9w0BAQEFAASCBucwggbjAgEAAoIBgQCv3sUoOE4F7Pye
+AT2Q6XpXrGUOu1fYgdnItLLLhvn7ACuHMj7TA5UKXxsepJn5m2Ji9LvAbksr1IWd
+LZAvNgjwsUR+E4HbY108BhVt9sk3HFkvE0OOFbAa14ICtYPe18P/4Hv6Zfu/GJDU
+rwXHNCUu0p6i/mospZ5O3sx5MgVaShknGAEC3Kp7zOgusMmE8XSbkNQa3ARMkW4o
+kTqWKAeAHDjVFVyyhzZQmo+gaLzhWfJVSZhlJsuiLoZGGrVTq85EiXsE4l8rPaI+
+mKkVzWP13IZW+Fx1tiIktumdHWb1OQWrvm8AiT9b8PcFCUUrvhQFcLDSCZjKlQ0t
+RWrSSKrrVsSldOreqRLtpjGzFJpGnTcvslL7rP5pg5DjBsYmVcDjrmRuJuhGq52X
+/6HEC97GouVK8tT1LVMv1wufVPn+i9TzwxOuRWeUvVqLAJgWQ9N3yKdymH+VrpZk
+/oB9ScyDakGezZBW5CeOQbNJ8WoX58jNxefGjtqKxmyztu43r3ECAwEAAQKCAYBQ
+fVoqYCqFV8L95X9x1QljGsldhqxbsIIl811o/KtoDtndFEfgd2E8z+4vhhHaRR0w
+QOW02kWZF7jXCMVWdhp9XgQE15S0/bLsB7TDERFiIZ1HiD+AxbhFcKBV8REbahCQ
+CQN0xDwFZ47RaBDy7JCf71EfM+UP7fSYECvww83jVspQNBIyZx+3bT5OMCbqqz88
++3m3mT52dJDADEeN9WAJZ+Ey1IYKRwu6tCJLvePEF1BrbDVNBgZogXZ+mzalxpjr
+4RpGPMMa+VWc8HmDVd+LtpwKJcQD00GvUP4fNywn+5jvNWl54FdQiTLPrieTWxas
+XUQ2crxP7Aqr2/vsU5Ruru5uF7H+ssMHp9YQDhpJ2+SVhQ9P+/loXCuKGt+BrB2Z
+MlitO3f+vfRtzATmJ8G0qFrOqZK1A/qsiyIze240C1hAl3oy2xpZqTDGp4gRWwoi
+OIN0HmH9UbP7bbNQY1x/zstTbza4/7rGb1+DZKeZIMu7QjBCU0rtsJpGtUvcQGEC
+gcEA42GMYSL/HljZMF1LsDhTX/cmP8FDNgONhWYxT+w0Csnj1usLNBaT63dYnEiW
+QKydRR4casAR1Kdy4Yfcy2lCy1kCfwqkQYk8fxSsOSHRjUfwC1SnfdYlwKFMxw4a
+oZF0R4oVCBYrfP+8kqrj+5gs/gXblsw72XkYtbCdIriKKdmUzTx7MegzSqh2PVRi
+rJzuwCZQ/O0NfhwdOHxLQDo0dgD+vv9e+KOSoJ9FDv8HH1tnolpRMdkSA8AJR/Nk
+DXt1AoHBAMYBfTKQZ2jqLKybe4tP+YKjvjVp8vJx0iNUXFN/P6hBaSBOgq85uxXL
+X3s7N/pkOCjyE95B8QusIkbnbfdyEP89O4bTbUHPXyAkHyRkR7Vny49HYuaR/aXQ
+mXC0J2z5bXVpCQ514l/R/Io3wBph+hbG3To7pp9pMOV4qzvibUZaTZFwH+q+xDwf
+SKSFy3fcomgH4/K5/QuKVj0jOUQsYjQQWb8GukS2KZK3zYJIAG1bBcsCVpSuBdW0
+eCZgqjnwjQKBwCUyUwWc9QEg5b68tGIKhNEhHDe3xOf0ItWcxxpc+JJ/Pm9tGfMW
+cnJFntBKK5I+6qdg6qMn8oLINcnhMORxvsSHNhpUQlSaP7RGTHo4JxCmoQUpfxDd
+1GUzvdyeWQrvQYdmdlRRVCHpsA6KOCtzVIDlsmtz06Ka5cjrMHl6mNeJyYbdiwW6
+B5ICBv23bUDxlzkFy5/ko51qufkAlErYeraHKSVTn1SrZZQzGdf/LkoZ6NUtUzUF
+XqYQZzRHA6oU9QKBwDslzLljC5D6ivfQxln6POV6dmJMUOd9erFVDPNgSqq/R2EA
+MueXDjzXcKFGMlWYxHHuxmKZPiEnfWHC1kWZjFxCdVq0I6oKATd/stHTJtyYseUO
+BQwtRiDXLE7PcguKgtkU1EC+lC3dc1vyhW8cH3HYW9N+aCqsaI/TuQr9e3kNlqhA
+XzhnXgU7rx5+XSZkARukZ8JlLqLY4yQGNqAXxgoZbEW1A8VsyQRr5XbqfT4td5CK
+FUT6qwGIlG+aZp9CLQKBwQCQkwdW9A/Q4Ffq8+XTL1hJ24m/q11OLAPODUypOhWw
+OCbX2fkv59pSBe6niZDBls1NpHB9mzalBrJCfU+yKC667gKcKULOnWULIoOQvmcg
+Ka3hkkW28gTnCjfDIYm3IdsLjc67zJplOixaKgxhO8NtJZGtg0oLIrofG8EYRInv
+OmtGw+XE+s4TVs6WgXnEg9zWQ5ZYtqQVn6PT5jsz+Nrvipi61HWHVBd7g+78ojps
+3suWxl0FvgzTW5HD16WRXeI=
+-----END PRIVATE KEY-----
+Certificate:
+    Data:
+        Version: 1 (0x0)
+        Serial Number:
+            cb:2d:80:99:5a:69:52:61
+        Signature Algorithm: sha256WithRSAEncryption
+        Issuer: C=XY, O=Python Software Foundation CA, CN=our-ca-server
+        Validity
+            Not Before: Aug 29 14:23:16 2018 GMT
+            Not After : Oct 28 14:23:16 2037 GMT
+        Subject: C=XY, L=Castle Anthrax, O=Python Software Foundation, CN=nosan
+        Subject Public Key Info:
+            Public Key Algorithm: rsaEncryption
+                RSA Public-Key: (3072 bit)
+                Modulus:
+                    00:af:de:c5:28:38:4e:05:ec:fc:9e:01:3d:90:e9:
+                    7a:57:ac:65:0e:bb:57:d8:81:d9:c8:b4:b2:cb:86:
+                    f9:fb:00:2b:87:32:3e:d3:03:95:0a:5f:1b:1e:a4:
+                    99:f9:9b:62:62:f4:bb:c0:6e:4b:2b:d4:85:9d:2d:
+                    90:2f:36:08:f0:b1:44:7e:13:81:db:63:5d:3c:06:
+                    15:6d:f6:c9:37:1c:59:2f:13:43:8e:15:b0:1a:d7:
+                    82:02:b5:83:de:d7:c3:ff:e0:7b:fa:65:fb:bf:18:
+                    90:d4:af:05:c7:34:25:2e:d2:9e:a2:fe:6a:2c:a5:
+                    9e:4e:de:cc:79:32:05:5a:4a:19:27:18:01:02:dc:
+                    aa:7b:cc:e8:2e:b0:c9:84:f1:74:9b:90:d4:1a:dc:
+                    04:4c:91:6e:28:91:3a:96:28:07:80:1c:38:d5:15:
+                    5c:b2:87:36:50:9a:8f:a0:68:bc:e1:59:f2:55:49:
+                    98:65:26:cb:a2:2e:86:46:1a:b5:53:ab:ce:44:89:
+                    7b:04:e2:5f:2b:3d:a2:3e:98:a9:15:cd:63:f5:dc:
+                    86:56:f8:5c:75:b6:22:24:b6:e9:9d:1d:66:f5:39:
+                    05:ab:be:6f:00:89:3f:5b:f0:f7:05:09:45:2b:be:
+                    14:05:70:b0:d2:09:98:ca:95:0d:2d:45:6a:d2:48:
+                    aa:eb:56:c4:a5:74:ea:de:a9:12:ed:a6:31:b3:14:
+                    9a:46:9d:37:2f:b2:52:fb:ac:fe:69:83:90:e3:06:
+                    c6:26:55:c0:e3:ae:64:6e:26:e8:46:ab:9d:97:ff:
+                    a1:c4:0b:de:c6:a2:e5:4a:f2:d4:f5:2d:53:2f:d7:
+                    0b:9f:54:f9:fe:8b:d4:f3:c3:13:ae:45:67:94:bd:
+                    5a:8b:00:98:16:43:d3:77:c8:a7:72:98:7f:95:ae:
+                    96:64:fe:80:7d:49:cc:83:6a:41:9e:cd:90:56:e4:
+                    27:8e:41:b3:49:f1:6a:17:e7:c8:cd:c5:e7:c6:8e:
+                    da:8a:c6:6c:b3:b6:ee:37:af:71
+                Exponent: 65537 (0x10001)
+    Signature Algorithm: sha256WithRSAEncryption
+         91:42:c2:15:57:42:47:77:e7:0f:c5:55:26:b1:5b:c3:5e:ba:
+         81:db:e1:a4:9f:b8:42:5a:21:c9:8c:18:ae:0f:90:ab:9a:24:
+         e7:d2:78:fc:bd:97:29:b1:5c:46:1f:5b:b8:d2:a7:87:f1:50:
+         53:5b:d3:be:57:74:bd:e5:75:db:50:81:f7:37:95:0b:69:ef:
+         39:8c:5c:82:d5:64:62:d5:8b:e9:e0:31:e1:73:d2:5a:2c:de:
+         43:5a:06:e5:d3:4d:d0:35:e0:9f:c2:73:31:bc:35:69:d4:fb:
+         7d:f0:1a:33:f7:f6:25:72:9c:a6:84:05:08:f6:b5:e8:04:10:
+         f1:1f:f2:95:ad:a1:f8:d8:80:a5:eb:75:43:99:33:90:0c:79:
+         fc:c0:87:08:95:20:aa:c2:81:0b:22:6f:56:f4:8f:2a:23:f8:
+         40:47:1c:03:a5:b1:04:0a:04:4a:df:d0:88:a8:bc:31:f2:42:
+         9b:d8:11:14:9e:e3:68:ea:07:2c:15:de:d2:36:5a:15:38:ed:
+         d2:af:0e:b4:b6:1d:a0:57:94:ea:c3:c7:4c:14:57:81:00:57:
+         94:d3:b0:27:69:d7:48:02:6c:e5:97:f7:be:22:7c:38:24:af:
+         b2:b0:7b:08:75:1e:ca:2e:c7:41:ef:8b:74:cf:c9:c3:6f:39:
+         b9:52:41:18:c6:70:24:54:51:04:fe:5f:88:70:35:e5:1c:8e:
+         d6:67:69:44:44:33:9b:8c:fe:a5:b9:95:48:66:84:f3:1a:04:
+         ab:a3:57:c1:b6:b4:2f:28:12:45:2b:cb:42:d3:f4:a5:ce:7b:
+         6c:1f:e4:c8:a9:e7:d4:6d:c8:27:2d:69:26:c5:e8:73:10:54:
+         1f:c3:bf:fd:aa:f5:95:6f:f6:ca:d5:06:8f:1b:79:93:e3:86:
+         ba:8d:fe:a8:10:8f:95:3e:14:09:bf:ca:88:59:e2:93:b6:ec:
+         03:a9:7e:dd:1f:5f:13:d3:29:b3:a6:f3:6a:df:30:53:44:c8:
+         cd:e5:82:57:bc:9c
+-----BEGIN CERTIFICATE-----
+MIIEJDCCAowCCQDLLYCZWmlSYTANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQGEwJY
+WTEmMCQGA1UECgwdUHl0aG9uIFNvZnR3YXJlIEZvdW5kYXRpb24gQ0ExFjAUBgNV
+BAMMDW91ci1jYS1zZXJ2ZXIwHhcNMTgwODI5MTQyMzE2WhcNMzcxMDI4MTQyMzE2
+WjBbMQswCQYDVQQGEwJYWTEXMBUGA1UEBwwOQ2FzdGxlIEFudGhyYXgxIzAhBgNV
+BAoMGlB5dGhvbiBTb2Z0d2FyZSBGb3VuZGF0aW9uMQ4wDAYDVQQDDAVub3NhbjCC
+AaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBAK/exSg4TgXs/J4BPZDpeles
+ZQ67V9iB2ci0ssuG+fsAK4cyPtMDlQpfGx6kmfmbYmL0u8BuSyvUhZ0tkC82CPCx
+RH4TgdtjXTwGFW32yTccWS8TQ44VsBrXggK1g97Xw//ge/pl+78YkNSvBcc0JS7S
+nqL+aiylnk7ezHkyBVpKGScYAQLcqnvM6C6wyYTxdJuQ1BrcBEyRbiiROpYoB4Ac
+ONUVXLKHNlCaj6BovOFZ8lVJmGUmy6IuhkYatVOrzkSJewTiXys9oj6YqRXNY/Xc
+hlb4XHW2IiS26Z0dZvU5Bau+bwCJP1vw9wUJRSu+FAVwsNIJmMqVDS1FatJIqutW
+xKV06t6pEu2mMbMUmkadNy+yUvus/mmDkOMGxiZVwOOuZG4m6EarnZf/ocQL3sai
+5Ury1PUtUy/XC59U+f6L1PPDE65FZ5S9WosAmBZD03fIp3KYf5WulmT+gH1JzINq
+QZ7NkFbkJ45Bs0nxahfnyM3F58aO2orGbLO27jevcQIDAQABMA0GCSqGSIb3DQEB
+CwUAA4IBgQCRQsIVV0JHd+cPxVUmsVvDXrqB2+Gkn7hCWiHJjBiuD5CrmiTn0nj8
+vZcpsVxGH1u40qeH8VBTW9O+V3S95XXbUIH3N5ULae85jFyC1WRi1Yvp4DHhc9Ja
+LN5DWgbl003QNeCfwnMxvDVp1Pt98Boz9/YlcpymhAUI9rXoBBDxH/KVraH42ICl
+63VDmTOQDHn8wIcIlSCqwoELIm9W9I8qI/hARxwDpbEECgRK39CIqLwx8kKb2BEU
+nuNo6gcsFd7SNloVOO3Srw60th2gV5Tqw8dMFFeBAFeU07AnaddIAmzll/e+Inw4
+JK+ysHsIdR7KLsdB74t0z8nDbzm5UkEYxnAkVFEE/l+IcDXlHI7WZ2lERDObjP6l
+uZVIZoTzGgSro1fBtrQvKBJFK8tC0/SlzntsH+TIqefUbcgnLWkmxehzEFQfw7/9
+qvWVb/bK1QaPG3mT44a6jf6oEI+VPhQJv8qIWeKTtuwDqX7dH18T0ymzpvNq3zBT
+RMjN5YJXvJw=
+-----END CERTIFICATE-----
diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py
index 3d54617..f13d42f 100644
--- a/Lib/test/pickletester.py
+++ b/Lib/test/pickletester.py
@@ -22,11 +22,15 @@
     _testbuffer = None
 
 from test import support
+from test.support import os_helper
 from test.support import (
-    TestFailed, TESTFN, run_with_locale, no_tracing,
-    _2G, _4G, bigmemtest, reap_threads, forget,
-    save_restore_warnings_filters
+    TestFailed, run_with_locale, no_tracing,
+    _2G, _4G, bigmemtest
     )
+from test.support.import_helper import forget
+from test.support.os_helper import TESTFN
+from test.support import threading_helper
+from test.support.warnings_helper import save_restore_warnings_filters
 
 from pickle import bytes_types
 
@@ -65,6 +69,10 @@
     return n
 
 
+def identity(x):
+    return x
+
+
 class UnseekableIO(io.BytesIO):
     def peek(self, *args):
         raise NotImplementedError
@@ -134,11 +142,12 @@
     def __getinitargs__(self):
         return ()
 
-class H(object):
+# Simple mutable object.
+class Object:
     pass
 
-# Hashable mutable key
-class K(object):
+# Hashable immutable key object containing unheshable mutable data.
+class K:
     def __init__(self, value):
         self.value = value
 
@@ -153,10 +162,6 @@
 D.__module__ = "__main__"
 __main__.E = E
 E.__module__ = "__main__"
-__main__.H = H
-H.__module__ = "__main__"
-__main__.K = K
-K.__module__ = "__main__"
 
 class myint(int):
     def __init__(self, x):
@@ -823,7 +828,7 @@
     return x
 
 
-class AbstractUnpickleTests(unittest.TestCase):
+class AbstractUnpickleTests:
     # Subclass must define self.loads.
 
     _testdata = create_data()
@@ -1374,7 +1379,7 @@
         for p in badpickles:
             self.check_unpickling_error(self.truncated_errors, p)
 
-    @reap_threads
+    @threading_helper.reap_threads
     def test_unpickle_module_race(self):
         # https://bugs.python.org/issue34572
         locker_module = dedent("""
@@ -1436,7 +1441,7 @@
 
 
 
-class AbstractPickleTests(unittest.TestCase):
+class AbstractPickleTests:
     # Subclass must define self.dumps, self.loads.
 
     optimized = False
@@ -1492,54 +1497,182 @@
             got = filelike.getvalue()
             self.assertEqual(expected, got)
 
-    def test_recursive_list(self):
-        l = []
+    def _test_recursive_list(self, cls, aslist=identity, minprotocol=0):
+        # List containing itself.
+        l = cls()
         l.append(l)
-        for proto in protocols:
+        for proto in range(minprotocol, pickle.HIGHEST_PROTOCOL + 1):
             s = self.dumps(l, proto)
             x = self.loads(s)
-            self.assertIsInstance(x, list)
-            self.assertEqual(len(x), 1)
-            self.assertIs(x[0], x)
+            self.assertIsInstance(x, cls)
+            y = aslist(x)
+            self.assertEqual(len(y), 1)
+            self.assertIs(y[0], x)
 
-    def test_recursive_tuple_and_list(self):
-        t = ([],)
+    def test_recursive_list(self):
+        self._test_recursive_list(list)
+
+    def test_recursive_list_subclass(self):
+        self._test_recursive_list(MyList, minprotocol=2)
+
+    def test_recursive_list_like(self):
+        self._test_recursive_list(REX_six, aslist=lambda x: x.items)
+
+    def _test_recursive_tuple_and_list(self, cls, aslist=identity, minprotocol=0):
+        # Tuple containing a list containing the original tuple.
+        t = (cls(),)
         t[0].append(t)
-        for proto in protocols:
+        for proto in range(minprotocol, pickle.HIGHEST_PROTOCOL + 1):
             s = self.dumps(t, proto)
             x = self.loads(s)
             self.assertIsInstance(x, tuple)
             self.assertEqual(len(x), 1)
-            self.assertIsInstance(x[0], list)
-            self.assertEqual(len(x[0]), 1)
-            self.assertIs(x[0][0], x)
+            self.assertIsInstance(x[0], cls)
+            y = aslist(x[0])
+            self.assertEqual(len(y), 1)
+            self.assertIs(y[0], x)
+
+        # List containing a tuple containing the original list.
+        t, = t
+        for proto in range(minprotocol, pickle.HIGHEST_PROTOCOL + 1):
+            s = self.dumps(t, proto)
+            x = self.loads(s)
+            self.assertIsInstance(x, cls)
+            y = aslist(x)
+            self.assertEqual(len(y), 1)
+            self.assertIsInstance(y[0], tuple)
+            self.assertEqual(len(y[0]), 1)
+            self.assertIs(y[0][0], x)
+
+    def test_recursive_tuple_and_list(self):
+        self._test_recursive_tuple_and_list(list)
+
+    def test_recursive_tuple_and_list_subclass(self):
+        self._test_recursive_tuple_and_list(MyList, minprotocol=2)
+
+    def test_recursive_tuple_and_list_like(self):
+        self._test_recursive_tuple_and_list(REX_six, aslist=lambda x: x.items)
+
+    def _test_recursive_dict(self, cls, asdict=identity, minprotocol=0):
+        # Dict containing itself.
+        d = cls()
+        d[1] = d
+        for proto in range(minprotocol, pickle.HIGHEST_PROTOCOL + 1):
+            s = self.dumps(d, proto)
+            x = self.loads(s)
+            self.assertIsInstance(x, cls)
+            y = asdict(x)
+            self.assertEqual(list(y.keys()), [1])
+            self.assertIs(y[1], x)
 
     def test_recursive_dict(self):
-        d = {}
-        d[1] = d
-        for proto in protocols:
+        self._test_recursive_dict(dict)
+
+    def test_recursive_dict_subclass(self):
+        self._test_recursive_dict(MyDict, minprotocol=2)
+
+    def test_recursive_dict_like(self):
+        self._test_recursive_dict(REX_seven, asdict=lambda x: x.table)
+
+    def _test_recursive_tuple_and_dict(self, cls, asdict=identity, minprotocol=0):
+        # Tuple containing a dict containing the original tuple.
+        t = (cls(),)
+        t[0][1] = t
+        for proto in range(minprotocol, pickle.HIGHEST_PROTOCOL + 1):
+            s = self.dumps(t, proto)
+            x = self.loads(s)
+            self.assertIsInstance(x, tuple)
+            self.assertEqual(len(x), 1)
+            self.assertIsInstance(x[0], cls)
+            y = asdict(x[0])
+            self.assertEqual(list(y), [1])
+            self.assertIs(y[1], x)
+
+        # Dict containing a tuple containing the original dict.
+        t, = t
+        for proto in range(minprotocol, pickle.HIGHEST_PROTOCOL + 1):
+            s = self.dumps(t, proto)
+            x = self.loads(s)
+            self.assertIsInstance(x, cls)
+            y = asdict(x)
+            self.assertEqual(list(y), [1])
+            self.assertIsInstance(y[1], tuple)
+            self.assertEqual(len(y[1]), 1)
+            self.assertIs(y[1][0], x)
+
+    def test_recursive_tuple_and_dict(self):
+        self._test_recursive_tuple_and_dict(dict)
+
+    def test_recursive_tuple_and_dict_subclass(self):
+        self._test_recursive_tuple_and_dict(MyDict, minprotocol=2)
+
+    def test_recursive_tuple_and_dict_like(self):
+        self._test_recursive_tuple_and_dict(REX_seven, asdict=lambda x: x.table)
+
+    def _test_recursive_dict_key(self, cls, asdict=identity, minprotocol=0):
+        # Dict containing an immutable object (as key) containing the original
+        # dict.
+        d = cls()
+        d[K(d)] = 1
+        for proto in range(minprotocol, pickle.HIGHEST_PROTOCOL + 1):
             s = self.dumps(d, proto)
             x = self.loads(s)
-            self.assertIsInstance(x, dict)
-            self.assertEqual(list(x.keys()), [1])
-            self.assertIs(x[1], x)
+            self.assertIsInstance(x, cls)
+            y = asdict(x)
+            self.assertEqual(len(y.keys()), 1)
+            self.assertIsInstance(list(y.keys())[0], K)
+            self.assertIs(list(y.keys())[0].value, x)
 
     def test_recursive_dict_key(self):
-        d = {}
-        k = K(d)
-        d[k] = 1
-        for proto in protocols:
-            s = self.dumps(d, proto)
+        self._test_recursive_dict_key(dict)
+
+    def test_recursive_dict_subclass_key(self):
+        self._test_recursive_dict_key(MyDict, minprotocol=2)
+
+    def test_recursive_dict_like_key(self):
+        self._test_recursive_dict_key(REX_seven, asdict=lambda x: x.table)
+
+    def _test_recursive_tuple_and_dict_key(self, cls, asdict=identity, minprotocol=0):
+        # Tuple containing a dict containing an immutable object (as key)
+        # containing the original tuple.
+        t = (cls(),)
+        t[0][K(t)] = 1
+        for proto in range(minprotocol, pickle.HIGHEST_PROTOCOL + 1):
+            s = self.dumps(t, proto)
             x = self.loads(s)
-            self.assertIsInstance(x, dict)
-            self.assertEqual(len(x.keys()), 1)
-            self.assertIsInstance(list(x.keys())[0], K)
-            self.assertIs(list(x.keys())[0].value, x)
+            self.assertIsInstance(x, tuple)
+            self.assertEqual(len(x), 1)
+            self.assertIsInstance(x[0], cls)
+            y = asdict(x[0])
+            self.assertEqual(len(y), 1)
+            self.assertIsInstance(list(y.keys())[0], K)
+            self.assertIs(list(y.keys())[0].value, x)
+
+        # Dict containing an immutable object (as key) containing a tuple
+        # containing the original dict.
+        t, = t
+        for proto in range(minprotocol, pickle.HIGHEST_PROTOCOL + 1):
+            s = self.dumps(t, proto)
+            x = self.loads(s)
+            self.assertIsInstance(x, cls)
+            y = asdict(x)
+            self.assertEqual(len(y), 1)
+            self.assertIsInstance(list(y.keys())[0], K)
+            self.assertIs(list(y.keys())[0].value[0], x)
+
+    def test_recursive_tuple_and_dict_key(self):
+        self._test_recursive_tuple_and_dict_key(dict)
+
+    def test_recursive_tuple_and_dict_subclass_key(self):
+        self._test_recursive_tuple_and_dict_key(MyDict, minprotocol=2)
+
+    def test_recursive_tuple_and_dict_like_key(self):
+        self._test_recursive_tuple_and_dict_key(REX_seven, asdict=lambda x: x.table)
 
     def test_recursive_set(self):
+        # Set containing an immutable object containing the original set.
         y = set()
-        k = K(y)
-        y.add(k)
+        y.add(K(y))
         for proto in range(4, pickle.HIGHEST_PROTOCOL + 1):
             s = self.dumps(y, proto)
             x = self.loads(s)
@@ -1548,52 +1681,31 @@
             self.assertIsInstance(list(x)[0], K)
             self.assertIs(list(x)[0].value, x)
 
-    def test_recursive_list_subclass(self):
-        y = MyList()
-        y.append(y)
-        for proto in range(2, pickle.HIGHEST_PROTOCOL + 1):
+        # Immutable object containing a set containing the original object.
+        y, = y
+        for proto in range(4, pickle.HIGHEST_PROTOCOL + 1):
             s = self.dumps(y, proto)
             x = self.loads(s)
-            self.assertIsInstance(x, MyList)
-            self.assertEqual(len(x), 1)
-            self.assertIs(x[0], x)
-
-    def test_recursive_dict_subclass(self):
-        d = MyDict()
-        d[1] = d
-        for proto in range(2, pickle.HIGHEST_PROTOCOL + 1):
-            s = self.dumps(d, proto)
-            x = self.loads(s)
-            self.assertIsInstance(x, MyDict)
-            self.assertEqual(list(x.keys()), [1])
-            self.assertIs(x[1], x)
-
-    def test_recursive_dict_subclass_key(self):
-        d = MyDict()
-        k = K(d)
-        d[k] = 1
-        for proto in range(2, pickle.HIGHEST_PROTOCOL + 1):
-            s = self.dumps(d, proto)
-            x = self.loads(s)
-            self.assertIsInstance(x, MyDict)
-            self.assertEqual(len(list(x.keys())), 1)
-            self.assertIsInstance(list(x.keys())[0], K)
-            self.assertIs(list(x.keys())[0].value, x)
+            self.assertIsInstance(x, K)
+            self.assertIsInstance(x.value, set)
+            self.assertEqual(len(x.value), 1)
+            self.assertIs(list(x.value)[0], x)
 
     def test_recursive_inst(self):
-        i = C()
+        # Mutable object containing itself.
+        i = Object()
         i.attr = i
         for proto in protocols:
             s = self.dumps(i, proto)
             x = self.loads(s)
-            self.assertIsInstance(x, C)
+            self.assertIsInstance(x, Object)
             self.assertEqual(dir(x), dir(i))
             self.assertIs(x.attr, x)
 
     def test_recursive_multi(self):
         l = []
         d = {1:l}
-        i = C()
+        i = Object()
         i.attr = d
         l.append(i)
         for proto in protocols:
@@ -1603,49 +1715,94 @@
             self.assertEqual(len(x), 1)
             self.assertEqual(dir(x[0]), dir(i))
             self.assertEqual(list(x[0].attr.keys()), [1])
-            self.assertTrue(x[0].attr[1] is x)
+            self.assertIs(x[0].attr[1], x)
 
-    def check_recursive_collection_and_inst(self, factory):
-        h = H()
-        y = factory([h])
-        h.attr = y
+    def _test_recursive_collection_and_inst(self, factory):
+        # Mutable object containing a collection containing the original
+        # object.
+        o = Object()
+        o.attr = factory([o])
+        t = type(o.attr)
         for proto in protocols:
-            s = self.dumps(y, proto)
+            s = self.dumps(o, proto)
             x = self.loads(s)
-            self.assertIsInstance(x, type(y))
+            self.assertIsInstance(x.attr, t)
+            self.assertEqual(len(x.attr), 1)
+            self.assertIsInstance(list(x.attr)[0], Object)
+            self.assertIs(list(x.attr)[0], x)
+
+        # Collection containing a mutable object containing the original
+        # collection.
+        o = o.attr
+        for proto in protocols:
+            s = self.dumps(o, proto)
+            x = self.loads(s)
+            self.assertIsInstance(x, t)
             self.assertEqual(len(x), 1)
-            self.assertIsInstance(list(x)[0], H)
+            self.assertIsInstance(list(x)[0], Object)
             self.assertIs(list(x)[0].attr, x)
 
     def test_recursive_list_and_inst(self):
-        self.check_recursive_collection_and_inst(list)
+        self._test_recursive_collection_and_inst(list)
 
     def test_recursive_tuple_and_inst(self):
-        self.check_recursive_collection_and_inst(tuple)
+        self._test_recursive_collection_and_inst(tuple)
 
     def test_recursive_dict_and_inst(self):
-        self.check_recursive_collection_and_inst(dict.fromkeys)
+        self._test_recursive_collection_and_inst(dict.fromkeys)
 
     def test_recursive_set_and_inst(self):
-        self.check_recursive_collection_and_inst(set)
+        self._test_recursive_collection_and_inst(set)
 
     def test_recursive_frozenset_and_inst(self):
-        self.check_recursive_collection_and_inst(frozenset)
+        self._test_recursive_collection_and_inst(frozenset)
 
     def test_recursive_list_subclass_and_inst(self):
-        self.check_recursive_collection_and_inst(MyList)
+        self._test_recursive_collection_and_inst(MyList)
 
     def test_recursive_tuple_subclass_and_inst(self):
-        self.check_recursive_collection_and_inst(MyTuple)
+        self._test_recursive_collection_and_inst(MyTuple)
 
     def test_recursive_dict_subclass_and_inst(self):
-        self.check_recursive_collection_and_inst(MyDict.fromkeys)
+        self._test_recursive_collection_and_inst(MyDict.fromkeys)
 
     def test_recursive_set_subclass_and_inst(self):
-        self.check_recursive_collection_and_inst(MySet)
+        self._test_recursive_collection_and_inst(MySet)
 
     def test_recursive_frozenset_subclass_and_inst(self):
-        self.check_recursive_collection_and_inst(MyFrozenSet)
+        self._test_recursive_collection_and_inst(MyFrozenSet)
+
+    def test_recursive_inst_state(self):
+        # Mutable object containing itself.
+        y = REX_state()
+        y.state = y
+        for proto in protocols:
+            s = self.dumps(y, proto)
+            x = self.loads(s)
+            self.assertIsInstance(x, REX_state)
+            self.assertIs(x.state, x)
+
+    def test_recursive_tuple_and_inst_state(self):
+        # Tuple containing a mutable object containing the original tuple.
+        t = (REX_state(),)
+        t[0].state = t
+        for proto in protocols:
+            s = self.dumps(t, proto)
+            x = self.loads(s)
+            self.assertIsInstance(x, tuple)
+            self.assertEqual(len(x), 1)
+            self.assertIsInstance(x[0], REX_state)
+            self.assertIs(x[0].state, x)
+
+        # Mutable object containing a tuple containing the object.
+        t, = t
+        for proto in protocols:
+            s = self.dumps(t, proto)
+            x = self.loads(s)
+            self.assertIsInstance(x, REX_state)
+            self.assertIsInstance(x.state, tuple)
+            self.assertEqual(len(x.state), 1)
+            self.assertIs(x.state[0], x)
 
     def test_unicode(self):
         endcases = ['', '<\\u>', '<\\\u1234>', '<\n>',
@@ -1696,6 +1853,14 @@
                     self.assertNotIn(b'bytearray', p)
                     self.assertTrue(opcode_in_pickle(pickle.BYTEARRAY8, p))
 
+    def test_bytearray_memoization_bug(self):
+        for proto in protocols:
+            for s in b'', b'xyz', b'xyz'*100:
+                b = bytearray(s)
+                p = self.dumps((b, b), proto)
+                b1, b2 = self.loads(p)
+                self.assertIs(b1, b2)
+
     def test_ints(self):
         for proto in protocols:
             n = sys.maxsize
@@ -2218,7 +2383,8 @@
         # Issue #3514: crash when there is an infinite loop in __getattr__
         x = BadGetattr()
         for proto in protocols:
-            self.assertRaises(RuntimeError, self.dumps, x, proto)
+            with support.infinite_recursion():
+                self.assertRaises(RuntimeError, self.dumps, x, proto)
 
     def test_reduce_bad_iterator(self):
         # Issue4176: crash when 4th and 5th items of __reduce__()
@@ -2867,7 +3033,7 @@
         check_array(arr[::2])
 
 
-class BigmemPickleTests(unittest.TestCase):
+class BigmemPickleTests:
 
     # Binary protocols can serialize longs of up to 2 GiB-1
 
@@ -3058,6 +3224,19 @@
     def __reduce__(self):
         return type(self), (), None, None, iter(self.table.items())
 
+class REX_state(object):
+    """This class is used to check the 3th argument (state) of
+    the reduce protocol.
+    """
+    def __init__(self, state=None):
+        self.state = state
+    def __eq__(self, other):
+        return type(self) is type(other) and self.state == other.state
+    def __setstate__(self, state):
+        self.state = state
+    def __reduce__(self):
+        return type(self), (), self.state
+
 
 # Test classes for newobj
 
@@ -3127,7 +3306,7 @@
         self.foo
 
 
-class AbstractPickleModuleTests(unittest.TestCase):
+class AbstractPickleModuleTests:
 
     def test_dump_closed_file(self):
         f = open(TESTFN, "wb")
@@ -3135,7 +3314,7 @@
             f.close()
             self.assertRaises(ValueError, self.dump, 123, f)
         finally:
-            support.unlink(TESTFN)
+            os_helper.unlink(TESTFN)
 
     def test_load_closed_file(self):
         f = open(TESTFN, "wb")
@@ -3143,7 +3322,7 @@
             f.close()
             self.assertRaises(ValueError, self.dump, 123, f)
         finally:
-            support.unlink(TESTFN)
+            os_helper.unlink(TESTFN)
 
     def test_load_from_and_dump_to_file(self):
         stream = io.BytesIO()
@@ -3174,7 +3353,7 @@
                 self.assertRaises(TypeError, self.dump, 123, f, proto)
         finally:
             f.close()
-            support.unlink(TESTFN)
+            os_helper.unlink(TESTFN)
 
     def test_incomplete_input(self):
         s = io.BytesIO(b"X''.")
@@ -3234,7 +3413,7 @@
         self.check_dumps_loads_oob_buffers(dumps, loads)
 
 
-class AbstractPersistentPicklerTests(unittest.TestCase):
+class AbstractPersistentPicklerTests:
 
     # This class defines persistent_id() and persistent_load()
     # functions that should be used by the pickler.  All even integers
@@ -3274,7 +3453,7 @@
             self.assertEqual(self.load_false_count, 1)
 
 
-class AbstractIdentityPersistentPicklerTests(unittest.TestCase):
+class AbstractIdentityPersistentPicklerTests:
 
     def persistent_id(self, obj):
         return obj
@@ -3303,7 +3482,7 @@
         self.assertRaises(pickle.UnpicklingError, self.loads, pickled)
 
 
-class AbstractPicklerUnpicklerObjectTests(unittest.TestCase):
+class AbstractPicklerUnpicklerObjectTests:
 
     pickler_class = None
     unpickler_class = None
@@ -3517,7 +3696,7 @@
 
         return NotImplemented
 
-class AbstractHookTests(unittest.TestCase):
+class AbstractHookTests:
     def test_pickler_hook(self):
         # test the ability of a custom, user-defined CPickler subclass to
         # override the default reducing routines of any type using the method
@@ -3545,7 +3724,7 @@
 
                 self.assertEqual(new_f, 5)
                 self.assertEqual(some_str, 'some str')
-                # math.log does not have its usual reducer overriden, so the
+                # math.log does not have its usual reducer overridden, so the
                 # custom reduction callback should silently direct the pickler
                 # to the default pickling by attribute, by returning
                 # NotImplemented
@@ -3562,7 +3741,7 @@
     def test_reducer_override_no_reference_cycle(self):
         # bpo-39492: reducer_override used to induce a spurious reference cycle
         # inside the Pickler object, that could prevent all serialized objects
-        # from being garbage-collected without explicity invoking gc.collect.
+        # from being garbage-collected without explicitly invoking gc.collect.
 
         for proto in range(0, pickle.HIGHEST_PROTOCOL + 1):
             with self.subTest(proto=proto):
@@ -3583,7 +3762,7 @@
                 self.assertIsNone(wr())
 
 
-class AbstractDispatchTableTests(unittest.TestCase):
+class AbstractDispatchTableTests:
 
     def test_default_dispatch_table(self):
         # No dispatch_table attribute by default
diff --git a/Lib/test/pycacert.pem b/Lib/test/pycacert.pem
index 73150c9..360cd57 100644
--- a/Lib/test/pycacert.pem
+++ b/Lib/test/pycacert.pem
@@ -3,97 +3,97 @@
         Version: 3 (0x2)
         Serial Number:
             cb:2d:80:99:5a:69:52:5b
-    Signature Algorithm: sha256WithRSAEncryption
+        Signature Algorithm: sha256WithRSAEncryption
         Issuer: C=XY, O=Python Software Foundation CA, CN=our-ca-server
         Validity
             Not Before: Aug 29 14:23:16 2018 GMT
-            Not After : Aug 26 14:23:16 2028 GMT
+            Not After : Oct 28 14:23:16 2037 GMT
         Subject: C=XY, O=Python Software Foundation CA, CN=our-ca-server
         Subject Public Key Info:
             Public Key Algorithm: rsaEncryption
-                Public-Key: (3072 bit)
+                RSA Public-Key: (3072 bit)
                 Modulus:
-                    00:97:ed:55:41:ba:36:17:95:db:71:1c:d3:e1:61:
-                    ac:58:73:e3:c6:96:cf:2b:1f:b8:08:f5:9d:4b:4b:
-                    c7:30:f6:b8:0b:b3:52:72:a0:bb:c9:4d:3b:8e:df:
-                    22:8e:01:57:81:c9:92:73:cc:00:c6:ec:70:b0:3a:
-                    17:40:c1:df:f2:8c:36:4c:c4:a7:81:e7:b6:24:68:
-                    e2:a0:7e:35:07:2f:a0:5b:f9:45:46:f7:1e:f0:46:
-                    11:fe:ca:1a:3c:50:f1:26:a9:5f:9c:22:9c:f8:41:
-                    e1:df:4f:12:95:19:2f:5c:90:01:17:6e:7e:3e:7d:
-                    cf:e9:09:af:25:f8:f8:42:77:2d:6d:5f:36:f2:78:
-                    1e:7d:4a:87:68:63:6c:06:71:1b:8d:fa:25:fe:d4:
-                    d3:f5:a5:17:b1:ef:ea:17:cb:54:c8:27:99:80:cb:
-                    3c:45:f1:2c:52:1c:dd:1f:51:45:20:50:1e:5e:ab:
-                    57:73:1b:41:78:96:de:84:a4:7a:dd:8f:30:85:36:
-                    58:79:76:a0:d2:61:c8:1b:a9:94:99:63:c6:ee:f8:
-                    14:bf:b4:52:56:31:97:fa:eb:ac:53:9e:95:ce:4c:
-                    c4:5a:4a:b7:ca:03:27:5b:35:57:ce:02:dc:ec:ca:
-                    69:f8:8a:5a:39:cb:16:20:15:03:24:61:6c:f4:7a:
-                    fc:b6:48:e5:59:10:5c:49:d0:23:9f:fb:71:5e:3a:
-                    e9:68:9f:34:72:80:27:b6:3f:4c:b1:d9:db:63:7f:
-                    67:68:4a:6e:11:f8:e8:c0:f4:5a:16:39:53:0b:68:
-                    de:77:fa:45:e7:f8:91:cd:78:cd:28:94:97:71:54:
-                    fb:cf:f0:37:de:c9:26:c5:dc:1b:9e:89:6d:09:ac:
-                    c8:44:71:cb:6d:f1:97:31:d5:4c:20:33:bf:75:4a:
-                    a0:e0:dc:69:11:ed:2a:b4:64:10:11:30:8b:0e:b0:
-                    a7:10:d8:8a:c5:aa:1b:c8:26:8a:25:e7:66:9f:a5:
-                    6a:1a:2f:7c:5f:83:c6:78:4f:1f
+                    00:b1:84:d3:4f:5c:04:80:91:4f:82:49:ba:30:0b:
+                    f7:e8:cb:f9:14:ef:3d:9f:0b:3f:0a:62:fc:1b:20:
+                    a5:20:d1:60:5f:87:5a:1f:16:d1:ed:97:70:a6:da:
+                    1b:03:2c:7e:a0:5b:3c:4e:2f:16:7e:0e:89:29:89:
+                    e1:10:0d:38:da:6a:77:5f:37:13:b3:28:8f:7b:5c:
+                    76:ad:9e:e8:d3:f5:9e:f5:83:aa:10:07:8d:e6:51:
+                    98:f0:7c:0d:52:f2:0c:21:1e:d8:b9:99:26:a9:25:
+                    03:27:bb:5c:ab:2e:33:27:a2:d6:23:a8:83:87:44:
+                    29:9f:97:b5:24:6f:d7:b9:0a:fd:28:ee:bb:fb:41:
+                    58:ea:1d:99:dd:44:86:ab:98:be:1c:dc:cb:a9:89:
+                    1d:36:5c:a9:e8:47:b5:f4:52:48:aa:b5:a4:67:ef:
+                    3e:d7:e2:d3:33:de:98:29:d8:7a:b0:59:5c:e7:b1:
+                    0e:cc:fd:9f:eb:f6:d5:3a:0e:0b:cf:fe:0b:3d:a2:
+                    bf:45:18:ce:94:e7:a9:55:60:88:d4:d8:84:50:79:
+                    05:2e:41:03:74:ae:67:26:f6:5b:12:08:98:ce:0a:
+                    97:ed:01:0f:89:4f:17:5c:fa:3e:1d:35:24:47:92:
+                    32:bf:f7:a4:18:2b:3c:d0:48:99:e1:a2:cd:a3:cc:
+                    50:53:20:b5:c6:e3:66:85:7b:57:10:ec:33:4f:c1:
+                    77:e7:1b:7e:81:c6:c4:f3:45:20:c0:91:dd:13:76:
+                    7b:03:af:f6:76:8e:a2:83:63:57:dd:63:bc:bb:5a:
+                    1c:17:52:8a:d6:06:48:cc:0f:c7:d3:4f:e8:da:22:
+                    6c:86:f9:4e:5c:a6:29:07:3b:d8:56:4c:59:b3:20:
+                    49:07:7b:94:84:cf:2b:c3:1c:1a:4e:87:64:92:ba:
+                    42:e1:e6:ad:7d:1d:f6:54:90:6f:2b:e9:b3:cc:4b:
+                    2b:33:26:23:fd:65:c0:3c:f0:79:ad:c9:c1:81:ef:
+                    37:04:e0:27:3e:b0:ee:15:be:51
                 Exponent: 65537 (0x10001)
         X509v3 extensions:
             X509v3 Subject Key Identifier: 
-                DD:BF:CA:DA:E6:D1:34:BA:37:75:21:CA:6F:9A:08:28:F2:35:B6:48
+                B3:8A:A0:A2:BA:71:F1:A8:24:79:D4:A4:5B:25:36:15:1E:49:C8:CD
             X509v3 Authority Key Identifier: 
-                keyid:DD:BF:CA:DA:E6:D1:34:BA:37:75:21:CA:6F:9A:08:28:F2:35:B6:48
+                keyid:B3:8A:A0:A2:BA:71:F1:A8:24:79:D4:A4:5B:25:36:15:1E:49:C8:CD
 
             X509v3 Basic Constraints: 
                 CA:TRUE
     Signature Algorithm: sha256WithRSAEncryption
-         33:6a:54:d3:6b:c0:d7:01:5f:9d:f4:05:c1:93:66:90:50:d0:
-         b7:18:e9:b0:1e:4a:a0:b6:da:76:93:af:84:db:ad:15:54:31:
-         15:13:e4:de:7e:4e:0c:d5:09:1c:34:35:b6:e5:4c:d6:6f:65:
-         7d:32:5f:eb:fc:a9:6b:07:f7:49:82:e5:81:7e:07:80:9a:63:
-         f8:2c:c3:40:bc:8f:d4:2a:da:3e:d1:ee:08:b7:4d:a7:84:ca:
-         f4:3f:a1:98:45:be:b1:05:69:e7:df:d7:99:ab:1b:ee:8b:30:
-         cc:f7:fc:e7:d4:0b:17:ae:97:bf:e4:7b:fd:0f:a7:b4:85:79:
-         e3:59:e2:16:87:bf:1f:29:45:2c:23:93:76:be:c0:87:1d:de:
-         ec:2b:42:6a:e5:bb:c8:f4:0a:4a:08:0a:8c:5c:d8:7d:4d:d1:
-         b8:bf:d5:f7:29:ed:92:d1:94:04:e8:35:06:57:7f:2c:23:97:
-         87:a5:35:8d:26:d3:1a:47:f2:16:d7:d9:c6:d4:1f:23:43:d3:
-         26:99:39:ca:20:f4:71:23:6f:0c:4a:76:76:f7:76:1f:b3:fe:
-         bf:47:b0:fc:2a:56:81:e1:d2:dd:ee:08:d8:f4:ff:5a:dc:25:
-         61:8a:91:02:b9:86:1c:f2:50:73:76:25:35:fc:b6:25:26:15:
-         cb:eb:c4:2b:61:0c:1c:e7:ee:2f:17:9b:ec:f0:d4:a1:84:e7:
-         d2:af:de:e4:1b:24:14:a7:01:87:e3:ab:29:58:46:a0:d9:c0:
-         0a:e0:8d:d7:59:d3:1b:f8:54:20:3e:78:a5:a5:c8:4f:8b:03:
-         c4:96:9f:ec:fb:47:cf:76:2d:8d:65:34:27:bf:fa:ae:01:05:
-         8a:f3:92:0a:dd:89:6c:97:a1:c7:e7:60:51:e7:ac:eb:4b:7d:
-         2c:b8:65:c9:fe:5d:6a:48:55:8e:e4:c7:f9:6a:40:e1:b8:64:
-         45:e9:b5:59:29:a5:5f:cf:7d:58:7d:64:79:e5:a4:09:ac:1e:
-         76:65:3d:94:c4:68
+         6b:32:2f:e7:05:18:ea:5c:c9:95:f4:e0:c2:0c:41:5f:1a:0a:
+         95:c9:c7:7d:05:ee:8a:56:29:35:50:40:b7:fe:9f:7b:5b:1c:
+         c3:69:2f:a0:cb:d2:b8:91:2f:50:19:62:f7:27:18:6d:95:7b:
+         53:16:15:a2:5a:dc:14:e3:fb:b1:32:a9:69:db:a6:33:47:3c:
+         bb:1f:d2:dc:70:f9:6a:2e:0c:d8:8c:6d:e5:5d:1d:43:3c:4e:
+         91:de:a0:c8:da:a0:4b:0e:9d:5e:b6:0f:4a:49:f0:7b:b6:53:
+         9e:fd:35:14:5b:e3:4d:b4:18:a6:36:61:e8:8f:33:9b:d4:05:
+         f9:54:66:df:e0:cb:18:a3:4e:dc:17:a8:a0:b3:c1:a8:f4:d6:
+         9d:ca:7f:68:53:1a:d7:95:da:e8:d3:9e:48:00:71:95:99:11:
+         07:cf:96:c0:7d:ce:7d:30:e8:4f:e1:83:16:33:a1:ff:59:9b:
+         3e:4c:e7:3a:38:01:9f:0f:67:4c:fd:2d:8b:4a:d4:01:46:37:
+         33:e8:13:6b:15:a9:1d:68:76:45:a2:82:33:69:26:30:60:05:
+         c8:8f:bd:b4:75:ab:be:7a:8b:48:68:70:40:b4:1b:51:c5:e6:
+         7a:ad:6b:4f:db:17:c0:60:67:2e:63:61:9b:2c:48:99:b8:76:
+         45:a0:9e:cc:ef:33:1e:50:4e:ab:72:c3:65:c8:b2:79:b3:35:
+         83:21:78:d3:8b:6c:3a:18:e8:65:32:39:b8:c0:9d:71:2f:35:
+         36:8a:c0:17:62:d8:8b:3e:e1:22:18:2b:4c:63:a6:0e:9d:0a:
+         fa:ab:5b:35:fb:88:91:77:4c:8d:8c:9d:a9:cf:fc:ab:c2:e6:
+         5a:05:7b:7e:04:6e:39:cf:93:ce:67:3b:7a:cb:af:b6:36:e1:
+         fb:71:64:45:d4:a6:f0:ce:ef:75:04:99:69:9a:e5:88:0a:10:
+         02:74:89:ec:75:84:44:80:48:df:c1:f7:e9:37:ce:ce:92:92:
+         5c:89:22:08:73:1f
 -----BEGIN CERTIFICATE-----
 MIIEbTCCAtWgAwIBAgIJAMstgJlaaVJbMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNV
 BAYTAlhZMSYwJAYDVQQKDB1QeXRob24gU29mdHdhcmUgRm91bmRhdGlvbiBDQTEW
-MBQGA1UEAwwNb3VyLWNhLXNlcnZlcjAeFw0xODA4MjkxNDIzMTZaFw0yODA4MjYx
+MBQGA1UEAwwNb3VyLWNhLXNlcnZlcjAeFw0xODA4MjkxNDIzMTZaFw0zNzEwMjgx
 NDIzMTZaME0xCzAJBgNVBAYTAlhZMSYwJAYDVQQKDB1QeXRob24gU29mdHdhcmUg
 Rm91bmRhdGlvbiBDQTEWMBQGA1UEAwwNb3VyLWNhLXNlcnZlcjCCAaIwDQYJKoZI
-hvcNAQEBBQADggGPADCCAYoCggGBAJftVUG6NheV23Ec0+FhrFhz48aWzysfuAj1
-nUtLxzD2uAuzUnKgu8lNO47fIo4BV4HJknPMAMbscLA6F0DB3/KMNkzEp4HntiRo
-4qB+NQcvoFv5RUb3HvBGEf7KGjxQ8SapX5winPhB4d9PEpUZL1yQARdufj59z+kJ
-ryX4+EJ3LW1fNvJ4Hn1Kh2hjbAZxG436Jf7U0/WlF7Hv6hfLVMgnmYDLPEXxLFIc
-3R9RRSBQHl6rV3MbQXiW3oSket2PMIU2WHl2oNJhyBuplJljxu74FL+0UlYxl/rr
-rFOelc5MxFpKt8oDJ1s1V84C3OzKafiKWjnLFiAVAyRhbPR6/LZI5VkQXEnQI5/7
-cV466WifNHKAJ7Y/TLHZ22N/Z2hKbhH46MD0WhY5Uwto3nf6Ref4kc14zSiUl3FU
-+8/wN97JJsXcG56JbQmsyERxy23xlzHVTCAzv3VKoODcaRHtKrRkEBEwiw6wpxDY
-isWqG8gmiiXnZp+lahovfF+DxnhPHwIDAQABo1AwTjAdBgNVHQ4EFgQU3b/K2ubR
-NLo3dSHKb5oIKPI1tkgwHwYDVR0jBBgwFoAU3b/K2ubRNLo3dSHKb5oIKPI1tkgw
-DAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAYEAM2pU02vA1wFfnfQFwZNm
-kFDQtxjpsB5KoLbadpOvhNutFVQxFRPk3n5ODNUJHDQ1tuVM1m9lfTJf6/ypawf3
-SYLlgX4HgJpj+CzDQLyP1CraPtHuCLdNp4TK9D+hmEW+sQVp59/Xmasb7oswzPf8
-59QLF66Xv+R7/Q+ntIV541niFoe/HylFLCOTdr7Ahx3e7CtCauW7yPQKSggKjFzY
-fU3RuL/V9yntktGUBOg1Bld/LCOXh6U1jSbTGkfyFtfZxtQfI0PTJpk5yiD0cSNv
-DEp2dvd2H7P+v0ew/CpWgeHS3e4I2PT/WtwlYYqRArmGHPJQc3YlNfy2JSYVy+vE
-K2EMHOfuLxeb7PDUoYTn0q/e5BskFKcBh+OrKVhGoNnACuCN11nTG/hUID54paXI
-T4sDxJaf7PtHz3YtjWU0J7/6rgEFivOSCt2JbJehx+dgUees60t9LLhlyf5dakhV
-juTH+WpA4bhkRem1WSmlX899WH1keeWkCawedmU9lMRo
+hvcNAQEBBQADggGPADCCAYoCggGBALGE009cBICRT4JJujAL9+jL+RTvPZ8LPwpi
+/BsgpSDRYF+HWh8W0e2XcKbaGwMsfqBbPE4vFn4OiSmJ4RANONpqd183E7Moj3tc
+dq2e6NP1nvWDqhAHjeZRmPB8DVLyDCEe2LmZJqklAye7XKsuMyei1iOog4dEKZ+X
+tSRv17kK/Sjuu/tBWOodmd1EhquYvhzcy6mJHTZcqehHtfRSSKq1pGfvPtfi0zPe
+mCnYerBZXOexDsz9n+v21ToOC8/+Cz2iv0UYzpTnqVVgiNTYhFB5BS5BA3SuZyb2
+WxIImM4Kl+0BD4lPF1z6Ph01JEeSMr/3pBgrPNBImeGizaPMUFMgtcbjZoV7VxDs
+M0/Bd+cbfoHGxPNFIMCR3RN2ewOv9naOooNjV91jvLtaHBdSitYGSMwPx9NP6Noi
+bIb5TlymKQc72FZMWbMgSQd7lITPK8McGk6HZJK6QuHmrX0d9lSQbyvps8xLKzMm
+I/1lwDzwea3JwYHvNwTgJz6w7hW+UQIDAQABo1AwTjAdBgNVHQ4EFgQUs4qgorpx
+8agkedSkWyU2FR5JyM0wHwYDVR0jBBgwFoAUs4qgorpx8agkedSkWyU2FR5JyM0w
+DAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAYEAazIv5wUY6lzJlfTgwgxB
+XxoKlcnHfQXuilYpNVBAt/6fe1scw2kvoMvSuJEvUBli9ycYbZV7UxYVolrcFOP7
+sTKpadumM0c8ux/S3HD5ai4M2Ixt5V0dQzxOkd6gyNqgSw6dXrYPSknwe7ZTnv01
+FFvjTbQYpjZh6I8zm9QF+VRm3+DLGKNO3BeooLPBqPTWncp/aFMa15Xa6NOeSABx
+lZkRB8+WwH3OfTDoT+GDFjOh/1mbPkznOjgBnw9nTP0ti0rUAUY3M+gTaxWpHWh2
+RaKCM2kmMGAFyI+9tHWrvnqLSGhwQLQbUcXmeq1rT9sXwGBnLmNhmyxImbh2RaCe
+zO8zHlBOq3LDZciyebM1gyF404tsOhjoZTI5uMCdcS81NorAF2LYiz7hIhgrTGOm
+Dp0K+qtbNfuIkXdMjYydqc/8q8LmWgV7fgRuOc+Tzmc7esuvtjbh+3FkRdSm8M7v
+dQSZaZrliAoQAnSJ7HWERIBI38H36TfOzpKSXIkiCHMf
 -----END CERTIFICATE-----
diff --git a/Lib/test/pycakey.pem b/Lib/test/pycakey.pem
index c283f89..819bdef 100644
--- a/Lib/test/pycakey.pem
+++ b/Lib/test/pycakey.pem
@@ -1,40 +1,40 @@
 -----BEGIN PRIVATE KEY-----
-MIIG/AIBADANBgkqhkiG9w0BAQEFAASCBuYwggbiAgEAAoIBgQCX7VVBujYXldtx
-HNPhYaxYc+PGls8rH7gI9Z1LS8cw9rgLs1JyoLvJTTuO3yKOAVeByZJzzADG7HCw
-OhdAwd/yjDZMxKeB57YkaOKgfjUHL6Bb+UVG9x7wRhH+yho8UPEmqV+cIpz4QeHf
-TxKVGS9ckAEXbn4+fc/pCa8l+PhCdy1tXzbyeB59SodoY2wGcRuN+iX+1NP1pRex
-7+oXy1TIJ5mAyzxF8SxSHN0fUUUgUB5eq1dzG0F4lt6EpHrdjzCFNlh5dqDSYcgb
-qZSZY8bu+BS/tFJWMZf666xTnpXOTMRaSrfKAydbNVfOAtzsymn4ilo5yxYgFQMk
-YWz0evy2SOVZEFxJ0COf+3FeOulonzRygCe2P0yx2dtjf2doSm4R+OjA9FoWOVML
-aN53+kXn+JHNeM0olJdxVPvP8DfeySbF3BueiW0JrMhEcctt8Zcx1UwgM791SqDg
-3GkR7Sq0ZBARMIsOsKcQ2IrFqhvIJool52afpWoaL3xfg8Z4Tx8CAwEAAQKCAYB6
-1g1kwyYRE70FS4WUaOBr8+dqHW0LNO4bcFrpEi/PSuurqiUzQPoT3DoXXhoWLseN
-zGh476yBKZJDKfS7CwYCmZMdprK4uZvu/E6f7Or7EGrbckOtCQkew8iw9L8ZnWgd
-FjyThPjdUIdLgidIHcDJWjVHuLKh3B9KD+ZpEU/IjYtRLvbCPJSKQMQShrBE1Rau
-SF6IF5P4vK7X0162NlQqMLpQBAKLml93VJcERzVY1u53JJnkG1loIrNvE32zvZ0C
-ZnGVpWwamixVrO9K66F+Ml3Y3bkguF8aPUitc+l+yPmUSXmcDcKmhw9DZA0k5t39
-FxVYGn1uJlvHll8QvV9aZtzuTSkAN8VWNufGwivLLsoRlRb1LtGWqHY583FlUWtz
-99ABCBehZ2EpAP+MrRj+pyKuMrkQH61bbOhjqifBM8MhHdn9uNmMpvnKyGPMIdRY
-cLH4i2S5aQVvmsQbOa98DLOFGXdf+z5HuwdxHtG1S3J7jkT+FkIyYDehJA3X8UEC
-gcEAyCpD8rMFfR5qLwrajhy8vbV7TIkNfFHEkm9tCWDBHwuOJqA0DFuMDAKl7cMv
-Uo7Z6R2Fqe2OyWvxYkOi/CSjvtT+PTiA0ux1tXUZcxcRSIsLqQZV+elsKcv+QJPy
-vf02vNvHjaMaRwl+NYtqpfr1s/3EdJnWCNC3nV1dD+mWVJoO3kGAK5grLAPM1/uP
-stARN5Tnh3Doh8e1Yl4V4UKcVqyVqDykX1OLSmPqNH86T4Um0B4h+jf4UBBdDBz1
-rD3JAoHBAMJOZ3M7LqX+F2haSrF/hnG1y9qAqDWGsvy+8YgjFwPFWu7LvqLuXLuz
-S3+5GGhplMuM0itqA9PyPotlgtG5O9hAU8SyMitrx1uTW+Q2U3iYPZQ9O327l1cO
-F2jKljq0aJrXp+5iWUq8t/FG6DAqYYUCY/X1SheqEXCgCh4ldRhXig3TBYbVZNs9
-7azN0lk408AO/Hx7WYreFQVS7A/EJhk/M1yyIqnJESuxkDefjV4hTVkRXhh+MrCe
-vF/jHqh5pwKBwHxXPQRbzvINXbrBTEjxcxGJ1gESNg1fIfQxQZOMxgrJ+9DkvdBb
-YiDn2DldgV0Qni8ghrKrfoKDClyXVXy6KfnWh+Rx4BymhOxmxJto3fSpY2HpLKll
-JirErLli7my1CjbBdDH4+s7cB8mtRF+9CLp5znr8QSgSt60KnU/QM/F0Df5kxADQ
-syjRZ4NXoslaVQeo+TZ6nggSuAtWFNNstH9nEESE/zq0RBe+/3MDAa76MMUhosuz
-zw21TIfEyZvoeQKBwDpszNpvPzWWU3+DNtZsXAaw/Vz0Np/xorwwxfuDYZY2r4MC
-LI5dUfD2losPIvGyXZVfAIshU4lVW80adt2M7xu1K/sHAeLgg49bndPfKfYnAM0k
-JFFIKNd6WzudPtLkEFgO5GXfmK3KVRztjz98XtpZv6jjWqYG8zuEQ8aQyMbK+63w
-d8b1P2BVHLRLJybA2Zr0ZqMfi+sfn/570pNjDXml8VG8FoQq+0jCGXVAOofFR7ay
-bDK9L4zADjBe4IcUHQKBwFwj8TEVlWxtG+IWO5d+vyuP0OPjSYOmYq4dCMyZ2+Xy
-Y+XDYEhlgGTVxafRMTwt57VV3hJTtRxUZziDA++atr8+gPio+QHBYg1JgCKsqKYL
-TGoSVrM1jTfdl1orwkpgQmq2q5j7ExpNA3Spsm5kyCaJ1S/8Ivusqaod8S4t7UhW
-BRec3gQ+UYv/V3Pc9hS1Zdzf5+G+PDOYoNmveY16hcu0DKc/PlqGtJuBoQjjH7ir
-1YVK9GAgLk0VqJvePnF57A==
+MIIG/gIBADANBgkqhkiG9w0BAQEFAASCBugwggbkAgEAAoIBgQCxhNNPXASAkU+C
+SbowC/foy/kU7z2fCz8KYvwbIKUg0WBfh1ofFtHtl3Cm2hsDLH6gWzxOLxZ+Dokp
+ieEQDTjaandfNxOzKI97XHatnujT9Z71g6oQB43mUZjwfA1S8gwhHti5mSapJQMn
+u1yrLjMnotYjqIOHRCmfl7Ukb9e5Cv0o7rv7QVjqHZndRIarmL4c3MupiR02XKno
+R7X0UkiqtaRn7z7X4tMz3pgp2HqwWVznsQ7M/Z/r9tU6DgvP/gs9or9FGM6U56lV
+YIjU2IRQeQUuQQN0rmcm9lsSCJjOCpftAQ+JTxdc+j4dNSRHkjK/96QYKzzQSJnh
+os2jzFBTILXG42aFe1cQ7DNPwXfnG36BxsTzRSDAkd0TdnsDr/Z2jqKDY1fdY7y7
+WhwXUorWBkjMD8fTT+jaImyG+U5cpikHO9hWTFmzIEkHe5SEzyvDHBpOh2SSukLh
+5q19HfZUkG8r6bPMSyszJiP9ZcA88HmtycGB7zcE4Cc+sO4VvlECAwEAAQKCAYB7
+gUnzALYxLOgAYYMkQm9si9zz768TpCNr+ooj5YZ9Wq6OSAEveBT+FErQCxaYErDW
+qCNA0gn4Eezj9YWcQVa4vzHmEM+n6iRJU39ONC0Qqua5Ma10EY1sHIEnb2dlufku
+YeOu3RrEu3eCgRxsDGySuvv5OxinV4kN++KPQzD3EOopPE+U81YFLCsMgsyfPlmm
+gwc/IKIuXDHp5Vp2bXkZK98CYLV8RddjUw7SrkZNwx6cI9eET0CgTs7y4SrevoOy
+jCdnA0j1HvL8AbLQuYoXo9fdGYDeq55hyYlxSMYLaEToZG3DJ0UAldrT+r7x52D8
+2QMnJUo2XHzVYPlXPJIAkFJisZZ36TkBvywCgXZMMLibPo9U6V0nfkybTtXKoory
+nmgBv+XSGSNrVWMiygpDPqpX1G6bBgqUX3CiTlxtSkYYz1M4Vgj2cux5XEPTnVCq
+CLVzvNIXZt1RyzXPxGWpPidCjOaiWBRT4u1Dol9fs3PmVvDaRxcKo9nspiUHCfEC
+gcEA4GgxZ+IJwpAMHkdYId0oxjKgTqIg+Ua+EwfUoQT10ERl/k/V4cDwJRHT8lML
+rKhTNQJMEE040jq+6mPJDl1KqMb/v05Q7fF22ToGw1HkZwK52O6CeEiJW4/J6bR1
+pZGN0irsa6GvzV65Y6gZVFEUl0JPRf8wPvQHXsWAw8/2LuXkXjV0ieIMq4pbWJf4
+kaid7dYLHnobiP9RVk7BGr7ifmCshoPjWp4TRMwYf6iIZrqMxUSX0QY8Xsqx6bch
+LLx/AoHBAMqCvvwUKTrF4gKh5jyl6T6DTZ/Dujaz7BuAJdsSSHvuTa/Y1EfsQHZN
+jABn89ZqHYDiyyCuVFO3dqhLtsPjhyFMSXj+98JYcL3FGKnqQqRTwtzzx2P2lV5X
+U0WhrNRb3iLu79Tr8pE/2EPnvTr+J5b0DHEeRyM72LWs43zrDYHorH0/Aa5Qd37F
+gDLCTBEl8jO5irRuAIq/KV9ZFnn8JDjNGVpXgHPW3354ON1YaMLnPASk7FQizSOQ
+QZAsyxtdLwKBwGUosvTYYXvygXP4x1LkpmfKFJe94E1exXpAsmovmTvcSXn9tTXC
+Sr77LWb0ZrPbYT7pHS7QEMg8MSnp941hIrG4mzs666KHkgLUdI4B0YtaIDsZMXlV
+gY3j4KpYbhxH4/2U2eSfC2fxxnKVKW3n6vdQrfmo0q/eQ6BGOgiLK7fybCLHyBQL
+8Zg2k3z5bNUEhMTdE0AW3WjBZ4IXmFcdK26616r/szJ7RcZilrydVXexqpmWlTVl
+sTst9kucAPlwswKBwQCwf7my/GNezR8Jik+fZj7edBQQfcdra+8JnOvhfpLcKLte
+2s1RjjA0q6usou1bYAsszP2bEzV97XWmgq7dFg4tUE7s/NO1d91zGDhBx2Gj1TkN
+2A5dKonOuq9iDeITB6qYqcUvvyEfxRRZQr2jj+WzZCr/4BLCO6PJ29A9jKOuKLtF
+QcfWRF2RiNMN6lffzkHFIR4p2YHxa2DEsGGtmbt8Ig3Jtl/HFmydzmxJRoev71dY
++ODdB6PhLhZmcRPoWpMCgcEAhGArwL68GwwRMqAX79gMv8tVT0CJnDyGk5mD/ZIB
+Nzt0yQFO7rTEa1l1vAtOiVJ9IpAak2lgbEwodOfGnQst7lujNYDFzTRPTFt/lID1
+u6JBxmqawOSlqa00bt4l2YsTZV+BfSznBP6XO1PK4iR3o5G3NkoKJjZWm3e3asHk
+6eTeMLcsIJ+Fp7gG0ve2EdQwhVSVMFEu4Q4C2FcJeU++L4kYpY7sTnAjUtiLvtHn
+yp3jllEn3CBD8Uhs4B+sL/6p
 -----END PRIVATE KEY-----
diff --git a/Lib/test/pythoninfo.py b/Lib/test/pythoninfo.py
index cc228fb..8c8011b 100644
--- a/Lib/test/pythoninfo.py
+++ b/Lib/test/pythoninfo.py
@@ -96,6 +96,7 @@
         'maxunicode',
         'path',
         'platform',
+        'platlibdir',
         'prefix',
         'thread_info',
         'version',
@@ -504,7 +505,7 @@
     copy_attributes(info_add, ssl, 'ssl.%s', attributes, formatter=format_attr)
 
     for name, ctx in (
-        ('SSLContext', ssl.SSLContext()),
+        ('SSLContext', ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)),
         ('default_https_context', ssl._create_default_https_context()),
         ('stdlib_context', ssl._create_stdlib_context()),
     ):
@@ -719,6 +720,48 @@
     except (ImportError, AttributeError):
         pass
 
+    import subprocess
+    try:
+        # When wmic.exe output is redirected to a pipe,
+        # it uses the OEM code page
+        proc = subprocess.Popen(["wmic", "os", "get", "Caption,Version", "/value"],
+                                stdout=subprocess.PIPE,
+                                stderr=subprocess.PIPE,
+                                encoding="oem",
+                                text=True)
+        output, stderr = proc.communicate()
+        if proc.returncode:
+            output = ""
+    except OSError:
+        pass
+    else:
+        for line in output.splitlines():
+            line = line.strip()
+            if line.startswith('Caption='):
+                line = line.removeprefix('Caption=').strip()
+                if line:
+                    info_add('windows.version_caption', line)
+            elif line.startswith('Version='):
+                line = line.removeprefix('Version=').strip()
+                if line:
+                    info_add('windows.version', line)
+
+    try:
+        proc = subprocess.Popen(["ver"], shell=True,
+                                stdout=subprocess.PIPE,
+                                stderr=subprocess.PIPE,
+                                text=True)
+        output = proc.communicate()[0]
+        if proc.returncode:
+            output = ""
+    except OSError:
+        return
+    else:
+        output = output.strip()
+        line = output.splitlines()[0]
+        if line:
+            info_add('windows.ver', line)
+
 
 def collect_fips(info_add):
     try:
diff --git a/Lib/test/revocation.crl b/Lib/test/revocation.crl
index c05461c..621675e 100644
--- a/Lib/test/revocation.crl
+++ b/Lib/test/revocation.crl
@@ -1,14 +1,14 @@
 -----BEGIN X509 CRL-----
 MIICJjCBjwIBATANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQGEwJYWTEmMCQGA1UE
 CgwdUHl0aG9uIFNvZnR3YXJlIEZvdW5kYXRpb24gQ0ExFjAUBgNVBAMMDW91ci1j
-YS1zZXJ2ZXIXDTE4MDgyOTE0MjMxNloXDTI4MDcwNzE0MjMxNlqgDjAMMAoGA1Ud
-FAQDAgEAMA0GCSqGSIb3DQEBCwUAA4IBgQCPhrtGSbuvxPAI3YWQFDB4iOWdBnVk
-ugW1lsifmCsE86FfID0EwUut1SRHlksltMtcoULMEIdu8yMLWci++4ve22EEuMKT
-HUc3T/wBIuQUhA7U4deFG8CZPAxRpNoK470y7dkD4OVf0Gxa6WYDl9z8mXKmWCB9
-hvzqVfLWNSLTAVPsHtkD5PXdi5yRkQr6wYD7poWaIvkpsn7EKCY6Tw5V3rsbRuZq
-AGVCq5TH3mctcmwLloCJ4Xr/1q0DsRrYxeeLYxE+UpvvCbVBKgtjBK7zINS7AbcJ
-CYCYKUwGWv1fYKJ+KQQHf75mT3jQ9lWuzOj/YWK4k1EBnYmVGuKKt73lLFxC6h3y
-MUnaBZc1KZSyJj0IxfHg/o6qx8NgKOl9XRIQ5g5B30cwpPOskGhEhodbTTY3bPtm
-RQ36JvQZngzmkhyhr+MDEV5yUTOShfUiclzQOx26CmLmLHWxOZgXtFZob/oKrvbm
-Gen/+7K7YTw6hfY52U7J2FuQRGOyzBXfBYQ=
+YS1zZXJ2ZXIXDTIxMDMxNzA4NDgyMFoXDTQwMDUxNjA4NDgyMFqgDjAMMAoGA1Ud
+FAQDAgEAMA0GCSqGSIb3DQEBCwUAA4IBgQCd2GrHb4zr2R8eK7YMHwlkgICxbWP1
+4nuEi55yzUcmMcCZJ6ZQV3yYqTlAULGQ9qWAUdhsyH+yu3hRKFKHQv0DAdKKxgow
+66YasAQQ99DskXOPxmRoIA7qtIWZbLtBwHQJWh+uUFlTdUXitGIX5Xie74xu5YIr
+moa3QeuZyG5+gigSTUyst5T/J/cHfBzlAJLc2k3Ty4EPYXKHCVnrZWJbRmxq199l
+A7S+eBb9qWXSYXCn6v+EZ76pUS3u/66kZ86PO3h9294BzdhxbCJ27dQXNHw6owe2
+Iyiv0aWx+TNSGSf4yCqaYTH6RtEoviI3h/inVFHNGgjlMzdaGw/0I3bkB0rt2WSR
+Vck37HnXvQvVEkgO/39C0WKZus6m4gmOgZcbJbXaR8uIR5Hmw3SEyGEPEIBu6tXV
+BLJOSOSu2vVUH5GUIrpvK9FTySKYa+MGryoPasuqZNfwpaXK+ON2G6QsmcXPWZY0
+Dry6t0w2geW6UYVGmb831i8ZP3JVVVwcwi0=
 -----END X509 CRL-----
diff --git a/Lib/test/string_tests.py b/Lib/test/string_tests.py
index 527f505..840d7bb 100644
--- a/Lib/test/string_tests.py
+++ b/Lib/test/string_tests.py
@@ -5,6 +5,7 @@
 import unittest, string, sys, struct
 from test import support
 from collections import UserList
+import random
 
 class Sequence:
     def __init__(self, seq='wxyz'): self.seq = seq
@@ -317,6 +318,44 @@
         else:
             self.checkraises(TypeError, 'hello', 'rindex', 42)
 
+    def test_find_periodic_pattern(self):
+        """Cover the special path for periodic patterns."""
+        def reference_find(p, s):
+            for i in range(len(s)):
+                if s.startswith(p, i):
+                    return i
+            return -1
+
+        rr = random.randrange
+        choices = random.choices
+        for _ in range(1000):
+            p0 = ''.join(choices('abcde', k=rr(10))) * rr(10, 20)
+            p = p0[:len(p0) - rr(10)] # pop off some characters
+            left = ''.join(choices('abcdef', k=rr(2000)))
+            right = ''.join(choices('abcdef', k=rr(2000)))
+            text = left + p + right
+            with self.subTest(p=p, text=text):
+                self.checkequal(reference_find(p, text),
+                                text, 'find', p)
+
+    def test_find_shift_table_overflow(self):
+        """When the table of 8-bit shifts overflows."""
+        N = 2**8 + 100
+
+        # first check the periodic case
+        # here, the shift for 'b' is N + 1.
+        pattern1 = 'a' * N + 'b' + 'a' * N
+        text1 = 'babbaa' * N + pattern1
+        self.checkequal(len(text1)-len(pattern1),
+                        text1, 'find', pattern1)
+
+        # now check the non-periodic case
+        # here, the shift for 'd' is 3*(N+1)+1
+        pattern2 = 'ddd' + 'abc' * N + "eee"
+        text2 = pattern2[:-1] + "ddeede" * 2 * N + pattern2 + "de" * N
+        self.checkequal(len(text2) - N*len("de") - len(pattern2),
+                        text2, 'find', pattern2)
+
     def test_lower(self):
         self.checkequal('hello', 'HeLLo', 'lower')
         self.checkequal('hello', 'hello', 'lower')
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index aee3737..6343578 100644
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -3,24 +3,13 @@
 if __name__ != 'test.support':
     raise ImportError('support must be imported from the test package')
 
-import collections.abc
 import contextlib
-import errno
-import fnmatch
 import functools
-import glob
-import importlib
-import importlib.util
 import os
-import platform
 import re
 import stat
-import struct
-import subprocess
 import sys
 import sysconfig
-import _thread
-import threading
 import time
 import types
 import unittest
@@ -28,48 +17,42 @@
 
 from .testresult import get_test_runner
 
+
+try:
+    from _testcapi import unicode_legacy_string
+except ImportError:
+    unicode_legacy_string = None
+
 __all__ = [
     # globals
     "PIPE_MAX_SIZE", "verbose", "max_memuse", "use_resources", "failfast",
     # exceptions
     "Error", "TestFailed", "TestDidNotRun", "ResourceDenied",
-    # imports
-    "import_module", "import_fresh_module", "CleanImport",
-    # modules
-    "unload", "forget",
     # io
     "record_original_stdout", "get_original_stdout", "captured_stdout",
     "captured_stdin", "captured_stderr",
-    # filesystem
-    "TESTFN", "SAVEDCWD", "unlink", "rmtree", "temp_cwd", "findfile",
-    "create_empty_file", "can_symlink", "fs_is_case_insensitive",
     # unittest
     "is_resource_enabled", "requires", "requires_freebsd_version",
     "requires_linux_version", "requires_mac_ver",
-    "check_syntax_error", "check_syntax_warning",
-    "TransientResource", "time_out", "socket_peer_reset", "ioerror_peer_reset",
+    "check_syntax_error",
     "BasicTestRunner", "run_unittest", "run_doctest",
-    "skip_unless_symlink", "requires_gzip", "requires_bz2", "requires_lzma",
+    "requires_gzip", "requires_bz2", "requires_lzma",
     "bigmemtest", "bigaddrspacetest", "cpython_only", "get_attribute",
-    "requires_IEEE_754", "skip_unless_xattr", "requires_zlib",
+    "requires_IEEE_754", "requires_zlib",
     "anticipate_failure", "load_package_tests", "detect_api_mismatch",
     "check__all__", "skip_if_buggy_ucrt_strfptime",
-    "ignore_warnings",
+    "check_disallow_instantiation", "check_sanitizer", "skip_if_sanitizer",
     # sys
     "is_jython", "is_android", "check_impl_detail", "unix_shell",
     "setswitchinterval",
     # network
     "open_urlresource",
     # processes
-    'temp_umask', "reap_children",
-    # threads
-    "threading_setup", "threading_cleanup", "reap_threads", "start_threads",
+    "reap_children",
     # miscellaneous
-    "check_warnings", "check_no_resource_warning", "check_no_warnings",
-    "EnvironmentVarGuard",
-    "run_with_locale", "swap_item",
+    "run_with_locale", "swap_item", "findfile",
     "swap_attr", "Matcher", "set_memlimit", "SuppressCrashReport", "sortdict",
-    "run_with_tz", "PGO", "missing_compiler_executable", "fd_count",
+    "run_with_tz", "PGO", "missing_compiler_executable",
     "ALWAYS_EQ", "NEVER_EQ", "LARGEST", "SMALLEST",
     "LOOPBACK_TIMEOUT", "INTERNET_TIMEOUT", "SHORT_TIMEOUT", "LONG_TIMEOUT",
     ]
@@ -85,13 +68,15 @@
 # The timeout should be long enough for connect(), recv() and send() methods
 # of socket.socket.
 LOOPBACK_TIMEOUT = 5.0
-if sys.platform == 'win32' and platform.machine() == 'ARM':
+if sys.platform == 'win32' and ' 32 bit (ARM)' in sys.version:
     # bpo-37553: test_socket.SendfileUsingSendTest is taking longer than 2
     # seconds on Windows ARM32 buildbot
     LOOPBACK_TIMEOUT = 10
+elif sys.platform == 'vxworks':
+    LOOPBACK_TIMEOUT = 10
 
-# Timeout in seconds for network requests going to the Internet. The timeout is
-# short enough to prevent a test to wait for too long if the Internet request
+# Timeout in seconds for network requests going to the internet. The timeout is
+# short enough to prevent a test to wait for too long if the internet request
 # is blocked for whatever reason.
 #
 # Usually, a timeout using INTERNET_TIMEOUT should not mark a test as failed,
@@ -121,6 +106,17 @@
 class TestFailed(Error):
     """Test failed."""
 
+class TestFailedWithDetails(TestFailed):
+    """Test failed."""
+    def __init__(self, msg, errors, failures):
+        self.msg = msg
+        self.errors = errors
+        self.failures = failures
+        super().__init__(msg, errors, failures)
+
+    def __str__(self):
+        return self.msg
+
 class TestDidNotRun(Error):
     """Test did not run any subtests."""
 
@@ -132,84 +128,6 @@
     and unexpected skips.
     """
 
-@contextlib.contextmanager
-def _ignore_deprecated_imports(ignore=True):
-    """Context manager to suppress package and module deprecation
-    warnings when importing them.
-
-    If ignore is False, this context manager has no effect.
-    """
-    if ignore:
-        with warnings.catch_warnings():
-            warnings.filterwarnings("ignore", ".+ (module|package)",
-                                    DeprecationWarning)
-            yield
-    else:
-        yield
-
-
-def ignore_warnings(*, category):
-    """Decorator to suppress deprecation warnings.
-
-    Use of context managers to hide warnings make diffs
-    more noisy and tools like 'git blame' less useful.
-    """
-    def decorator(test):
-        @functools.wraps(test)
-        def wrapper(self, *args, **kwargs):
-            with warnings.catch_warnings():
-                warnings.simplefilter('ignore', category=category)
-                return test(self, *args, **kwargs)
-        return wrapper
-    return decorator
-
-
-def import_module(name, deprecated=False, *, required_on=()):
-    """Import and return the module to be tested, raising SkipTest if
-    it is not available.
-
-    If deprecated is True, any module or package deprecation messages
-    will be suppressed. If a module is required on a platform but optional for
-    others, set required_on to an iterable of platform prefixes which will be
-    compared against sys.platform.
-    """
-    with _ignore_deprecated_imports(deprecated):
-        try:
-            return importlib.import_module(name)
-        except ImportError as msg:
-            if sys.platform.startswith(tuple(required_on)):
-                raise
-            raise unittest.SkipTest(str(msg))
-
-
-def _save_and_remove_module(name, orig_modules):
-    """Helper function to save and remove a module from sys.modules
-
-    Raise ImportError if the module can't be imported.
-    """
-    # try to import the module and raise an error if it can't be imported
-    if name not in sys.modules:
-        __import__(name)
-        del sys.modules[name]
-    for modname in list(sys.modules):
-        if modname == name or modname.startswith(name + '.'):
-            orig_modules[modname] = sys.modules[modname]
-            del sys.modules[modname]
-
-def _save_and_block_module(name, orig_modules):
-    """Helper function to save and block a module in sys.modules
-
-    Return True if the module was in sys.modules, False otherwise.
-    """
-    saved = True
-    try:
-        orig_modules[name] = sys.modules[name]
-    except KeyError:
-        saved = False
-    sys.modules[name] = None
-    return saved
-
-
 def anticipate_failure(condition):
     """Decorator to mark a test that is known to be broken in some cases
 
@@ -240,56 +158,6 @@
     return standard_tests
 
 
-def import_fresh_module(name, fresh=(), blocked=(), deprecated=False):
-    """Import and return a module, deliberately bypassing sys.modules.
-
-    This function imports and returns a fresh copy of the named Python module
-    by removing the named module from sys.modules before doing the import.
-    Note that unlike reload, the original module is not affected by
-    this operation.
-
-    *fresh* is an iterable of additional module names that are also removed
-    from the sys.modules cache before doing the import.
-
-    *blocked* is an iterable of module names that are replaced with None
-    in the module cache during the import to ensure that attempts to import
-    them raise ImportError.
-
-    The named module and any modules named in the *fresh* and *blocked*
-    parameters are saved before starting the import and then reinserted into
-    sys.modules when the fresh import is complete.
-
-    Module and package deprecation messages are suppressed during this import
-    if *deprecated* is True.
-
-    This function will raise ImportError if the named module cannot be
-    imported.
-    """
-    # NOTE: test_heapq, test_json and test_warnings include extra sanity checks
-    # to make sure that this utility function is working as expected
-    with _ignore_deprecated_imports(deprecated):
-        # Keep track of modules saved for later restoration as well
-        # as those which just need a blocking entry removed
-        orig_modules = {}
-        names_to_remove = []
-        _save_and_remove_module(name, orig_modules)
-        try:
-            for fresh_name in fresh:
-                _save_and_remove_module(fresh_name, orig_modules)
-            for blocked_name in blocked:
-                if not _save_and_block_module(blocked_name, orig_modules):
-                    names_to_remove.append(blocked_name)
-            fresh_module = importlib.import_module(name)
-        except ImportError:
-            fresh_module = None
-        finally:
-            for orig_name, module in orig_modules.items():
-                sys.modules[orig_name] = module
-            for name_to_remove in names_to_remove:
-                del sys.modules[name_to_remove]
-        return fresh_module
-
-
 def get_attribute(obj, name):
     """Get an attribute, raising SkipTest if AttributeError is raised."""
     try:
@@ -318,11 +186,6 @@
 def get_original_stdout():
     return _original_stdout or sys.stdout
 
-def unload(name):
-    try:
-        del sys.modules[name]
-    except KeyError:
-        pass
 
 def _force_run(path, func, *args):
     try:
@@ -334,157 +197,12 @@
         os.chmod(path, stat.S_IRWXU)
         return func(*args)
 
-if sys.platform.startswith("win"):
-    def _waitfor(func, pathname, waitall=False):
-        # Perform the operation
-        func(pathname)
-        # Now setup the wait loop
-        if waitall:
-            dirname = pathname
-        else:
-            dirname, name = os.path.split(pathname)
-            dirname = dirname or '.'
-        # Check for `pathname` to be removed from the filesystem.
-        # The exponential backoff of the timeout amounts to a total
-        # of ~1 second after which the deletion is probably an error
-        # anyway.
-        # Testing on an i7@4.3GHz shows that usually only 1 iteration is
-        # required when contention occurs.
-        timeout = 0.001
-        while timeout < 1.0:
-            # Note we are only testing for the existence of the file(s) in
-            # the contents of the directory regardless of any security or
-            # access rights.  If we have made it this far, we have sufficient
-            # permissions to do that much using Python's equivalent of the
-            # Windows API FindFirstFile.
-            # Other Windows APIs can fail or give incorrect results when
-            # dealing with files that are pending deletion.
-            L = os.listdir(dirname)
-            if not (L if waitall else name in L):
-                return
-            # Increase the timeout and try again
-            time.sleep(timeout)
-            timeout *= 2
-        warnings.warn('tests may fail, delete still pending for ' + pathname,
-                      RuntimeWarning, stacklevel=4)
-
-    def _unlink(filename):
-        _waitfor(os.unlink, filename)
-
-    def _rmdir(dirname):
-        _waitfor(os.rmdir, dirname)
-
-    def _rmtree(path):
-        def _rmtree_inner(path):
-            for name in _force_run(path, os.listdir, path):
-                fullname = os.path.join(path, name)
-                try:
-                    mode = os.lstat(fullname).st_mode
-                except OSError as exc:
-                    print("support.rmtree(): os.lstat(%r) failed with %s" % (fullname, exc),
-                          file=sys.__stderr__)
-                    mode = 0
-                if stat.S_ISDIR(mode):
-                    _waitfor(_rmtree_inner, fullname, waitall=True)
-                    _force_run(fullname, os.rmdir, fullname)
-                else:
-                    _force_run(fullname, os.unlink, fullname)
-        _waitfor(_rmtree_inner, path, waitall=True)
-        _waitfor(lambda p: _force_run(p, os.rmdir, p), path)
-
-    def _longpath(path):
-        try:
-            import ctypes
-        except ImportError:
-            # No ctypes means we can't expands paths.
-            pass
-        else:
-            buffer = ctypes.create_unicode_buffer(len(path) * 2)
-            length = ctypes.windll.kernel32.GetLongPathNameW(path, buffer,
-                                                             len(buffer))
-            if length:
-                return buffer[:length]
-        return path
-else:
-    _unlink = os.unlink
-    _rmdir = os.rmdir
-
-    def _rmtree(path):
-        import shutil
-        try:
-            shutil.rmtree(path)
-            return
-        except OSError:
-            pass
-
-        def _rmtree_inner(path):
-            for name in _force_run(path, os.listdir, path):
-                fullname = os.path.join(path, name)
-                try:
-                    mode = os.lstat(fullname).st_mode
-                except OSError:
-                    mode = 0
-                if stat.S_ISDIR(mode):
-                    _rmtree_inner(fullname)
-                    _force_run(path, os.rmdir, fullname)
-                else:
-                    _force_run(path, os.unlink, fullname)
-        _rmtree_inner(path)
-        os.rmdir(path)
-
-    def _longpath(path):
-        return path
-
-def unlink(filename):
-    try:
-        _unlink(filename)
-    except (FileNotFoundError, NotADirectoryError):
-        pass
-
-def rmdir(dirname):
-    try:
-        _rmdir(dirname)
-    except FileNotFoundError:
-        pass
-
-def rmtree(path):
-    try:
-        _rmtree(path)
-    except FileNotFoundError:
-        pass
-
-def make_legacy_pyc(source):
-    """Move a PEP 3147/488 pyc file to its legacy pyc location.
-
-    :param source: The file system path to the source file.  The source file
-        does not need to exist, however the PEP 3147/488 pyc file must exist.
-    :return: The file system path to the legacy pyc file.
-    """
-    pyc_file = importlib.util.cache_from_source(source)
-    up_one = os.path.dirname(os.path.abspath(source))
-    legacy_pyc = os.path.join(up_one, source + 'c')
-    os.rename(pyc_file, legacy_pyc)
-    return legacy_pyc
-
-def forget(modname):
-    """'Forget' a module was ever imported.
-
-    This removes the module from sys.modules and deletes any PEP 3147/488 or
-    legacy .pyc files.
-    """
-    unload(modname)
-    for dirname in sys.path:
-        source = os.path.join(dirname, modname + '.py')
-        # It doesn't matter if they exist or not, unlink all possible
-        # combinations of PEP 3147/488 and legacy pyc files.
-        unlink(source + 'c')
-        for opt in ('', 1, 2):
-            unlink(importlib.util.cache_from_source(source, optimization=opt))
 
 # Check whether a gui is actually available
 def _is_gui_available():
     if hasattr(_is_gui_available, 'result'):
         return _is_gui_available.result
+    import platform
     reason = None
     if sys.platform.startswith('win') and platform.win32_is_iot():
         reason = "gui is not available on Windows IoT Core"
@@ -631,6 +349,7 @@
         @functools.wraps(func)
         def wrapper(*args, **kw):
             if sys.platform == 'darwin':
+                import platform
                 version_txt = platform.mac_ver()[0]
                 try:
                     version = tuple(map(int, version_txt.split('.')))
@@ -648,6 +367,41 @@
     return decorator
 
 
+def check_sanitizer(*, address=False, memory=False, ub=False):
+    """Returns True if Python is compiled with sanitizer support"""
+    if not (address or memory or ub):
+        raise ValueError('At least one of address, memory, or ub must be True')
+
+
+    _cflags = sysconfig.get_config_var('CFLAGS') or ''
+    _config_args = sysconfig.get_config_var('CONFIG_ARGS') or ''
+    memory_sanitizer = (
+        '-fsanitize=memory' in _cflags or
+        '--with-memory-sanitizer' in _config_args
+    )
+    address_sanitizer = (
+        '-fsanitize=address' in _cflags or
+        '--with-memory-sanitizer' in _config_args
+    )
+    ub_sanitizer = (
+        '-fsanitize=undefined' in _cflags or
+        '--with-undefined-behavior-sanitizer' in _config_args
+    )
+    return (
+        (memory and memory_sanitizer) or
+        (address and address_sanitizer) or
+        (ub and ub_sanitizer)
+    )
+
+
+def skip_if_sanitizer(reason=None, *, address=False, memory=False, ub=False):
+    """Decorator raising SkipTest if running with a sanitizer active."""
+    if not reason:
+        reason = 'not working with sanitizers active'
+    skip = check_sanitizer(address=address, memory=memory, ub=ub)
+    return unittest.skipIf(skip, reason)
+
+
 def system_must_validate_cert(f):
     """Skip the test on TLS certificate validation failures."""
     @functools.wraps(f)
@@ -671,8 +425,8 @@
 # A constant likely larger than the underlying OS socket buffer size, to make
 # writes blocking.
 # The socket buffer sizes can usually be tuned system-wide (e.g. through sysctl
-# on Linux), or on a per-socket basis (SO_SNDBUF/SO_RCVBUF). See issue #18643
-# for a discussion of this number).
+# on Linux), or on a per-socket basis (SO_SNDBUF/SO_RCVBUF).  See issue #18643
+# for a discussion of this number.
 SOCK_MAX_SIZE = 16 * 1024 * 1024 + 1
 
 # decorator for skipping tests on non-IEEE 754 platforms
@@ -708,160 +462,22 @@
         lzma = None
     return unittest.skipUnless(lzma, reason)
 
+requires_legacy_unicode_capi = unittest.skipUnless(unicode_legacy_string,
+                        'requires legacy Unicode C API')
+
 is_jython = sys.platform.startswith('java')
 
 is_android = hasattr(sys, 'getandroidapilevel')
 
-if sys.platform != 'win32':
+if sys.platform not in ('win32', 'vxworks'):
     unix_shell = '/system/bin/sh' if is_android else '/bin/sh'
 else:
     unix_shell = None
 
-# Filename used for testing
-if os.name == 'java':
-    # Jython disallows @ in module names
-    TESTFN_ASCII = '$test'
-else:
-    TESTFN_ASCII = '@test'
-
-# Disambiguate TESTFN for parallel testing, while letting it remain a valid
-# module name.
-TESTFN_ASCII = "{}_{}_tmp".format(TESTFN_ASCII, os.getpid())
-
 # Define the URL of a dedicated HTTP server for the network tests.
 # The URL must use clear-text HTTP: no redirection to encrypted HTTPS.
 TEST_HTTP_URL = "http://www.pythontest.net"
 
-# FS_NONASCII: non-ASCII character encodable by os.fsencode(),
-# or an empty string if there is no such character.
-FS_NONASCII = ''
-for character in (
-    # First try printable and common characters to have a readable filename.
-    # For each character, the encoding list are just example of encodings able
-    # to encode the character (the list is not exhaustive).
-
-    # U+00E6 (Latin Small Letter Ae): cp1252, iso-8859-1
-    '\u00E6',
-    # U+0130 (Latin Capital Letter I With Dot Above): cp1254, iso8859_3
-    '\u0130',
-    # U+0141 (Latin Capital Letter L With Stroke): cp1250, cp1257
-    '\u0141',
-    # U+03C6 (Greek Small Letter Phi): cp1253
-    '\u03C6',
-    # U+041A (Cyrillic Capital Letter Ka): cp1251
-    '\u041A',
-    # U+05D0 (Hebrew Letter Alef): Encodable to cp424
-    '\u05D0',
-    # U+060C (Arabic Comma): cp864, cp1006, iso8859_6, mac_arabic
-    '\u060C',
-    # U+062A (Arabic Letter Teh): cp720
-    '\u062A',
-    # U+0E01 (Thai Character Ko Kai): cp874
-    '\u0E01',
-
-    # Then try more "special" characters. "special" because they may be
-    # interpreted or displayed differently depending on the exact locale
-    # encoding and the font.
-
-    # U+00A0 (No-Break Space)
-    '\u00A0',
-    # U+20AC (Euro Sign)
-    '\u20AC',
-):
-    try:
-        # If Python is set up to use the legacy 'mbcs' in Windows,
-        # 'replace' error mode is used, and encode() returns b'?'
-        # for characters missing in the ANSI codepage
-        if os.fsdecode(os.fsencode(character)) != character:
-            raise UnicodeError
-    except UnicodeError:
-        pass
-    else:
-        FS_NONASCII = character
-        break
-
-# TESTFN_UNICODE is a non-ascii filename
-TESTFN_UNICODE = TESTFN_ASCII + "-\xe0\xf2\u0258\u0141\u011f"
-if sys.platform == 'darwin':
-    # In Mac OS X's VFS API file names are, by definition, canonically
-    # decomposed Unicode, encoded using UTF-8. See QA1173:
-    # http://developer.apple.com/mac/library/qa/qa2001/qa1173.html
-    import unicodedata
-    TESTFN_UNICODE = unicodedata.normalize('NFD', TESTFN_UNICODE)
-TESTFN_ENCODING = sys.getfilesystemencoding()
-
-# TESTFN_UNENCODABLE is a filename (str type) that should *not* be able to be
-# encoded by the filesystem encoding (in strict mode). It can be None if we
-# cannot generate such filename.
-TESTFN_UNENCODABLE = None
-if os.name == 'nt':
-    # skip win32s (0) or Windows 9x/ME (1)
-    if sys.getwindowsversion().platform >= 2:
-        # Different kinds of characters from various languages to minimize the
-        # probability that the whole name is encodable to MBCS (issue #9819)
-        TESTFN_UNENCODABLE = TESTFN_ASCII + "-\u5171\u0141\u2661\u0363\uDC80"
-        try:
-            TESTFN_UNENCODABLE.encode(TESTFN_ENCODING)
-        except UnicodeEncodeError:
-            pass
-        else:
-            print('WARNING: The filename %r CAN be encoded by the filesystem encoding (%s). '
-                  'Unicode filename tests may not be effective'
-                  % (TESTFN_UNENCODABLE, TESTFN_ENCODING))
-            TESTFN_UNENCODABLE = None
-# Mac OS X denies unencodable filenames (invalid utf-8)
-elif sys.platform != 'darwin':
-    try:
-        # ascii and utf-8 cannot encode the byte 0xff
-        b'\xff'.decode(TESTFN_ENCODING)
-    except UnicodeDecodeError:
-        # 0xff will be encoded using the surrogate character u+DCFF
-        TESTFN_UNENCODABLE = TESTFN_ASCII \
-            + b'-\xff'.decode(TESTFN_ENCODING, 'surrogateescape')
-    else:
-        # File system encoding (eg. ISO-8859-* encodings) can encode
-        # the byte 0xff. Skip some unicode filename tests.
-        pass
-
-# TESTFN_UNDECODABLE is a filename (bytes type) that should *not* be able to be
-# decoded from the filesystem encoding (in strict mode). It can be None if we
-# cannot generate such filename (ex: the latin1 encoding can decode any byte
-# sequence). On UNIX, TESTFN_UNDECODABLE can be decoded by os.fsdecode() thanks
-# to the surrogateescape error handler (PEP 383), but not from the filesystem
-# encoding in strict mode.
-TESTFN_UNDECODABLE = None
-for name in (
-    # b'\xff' is not decodable by os.fsdecode() with code page 932. Windows
-    # accepts it to create a file or a directory, or don't accept to enter to
-    # such directory (when the bytes name is used). So test b'\xe7' first: it is
-    # not decodable from cp932.
-    b'\xe7w\xf0',
-    # undecodable from ASCII, UTF-8
-    b'\xff',
-    # undecodable from iso8859-3, iso8859-6, iso8859-7, cp424, iso8859-8, cp856
-    # and cp857
-    b'\xae\xd5'
-    # undecodable from UTF-8 (UNIX and Mac OS X)
-    b'\xed\xb2\x80', b'\xed\xb4\x80',
-    # undecodable from shift_jis, cp869, cp874, cp932, cp1250, cp1251, cp1252,
-    # cp1253, cp1254, cp1255, cp1257, cp1258
-    b'\x81\x98',
-):
-    try:
-        name.decode(TESTFN_ENCODING)
-    except UnicodeDecodeError:
-        TESTFN_UNDECODABLE = os.fsencode(TESTFN_ASCII) + name
-        break
-
-if FS_NONASCII:
-    TESTFN_NONASCII = TESTFN_ASCII + FS_NONASCII
-else:
-    TESTFN_NONASCII = None
-TESTFN = TESTFN_NONASCII or TESTFN_ASCII
-
-# Save the initial cwd
-SAVEDCWD = os.getcwd()
-
 # Set by libregrtest/main.py so we can skip tests that are not
 # useful for PGO
 PGO = False
@@ -870,103 +486,6 @@
 # PGO task.  If this is True, PGO is also True.
 PGO_EXTENDED = False
 
-@contextlib.contextmanager
-def temp_dir(path=None, quiet=False):
-    """Return a context manager that creates a temporary directory.
-
-    Arguments:
-
-      path: the directory to create temporarily.  If omitted or None,
-        defaults to creating a temporary directory using tempfile.mkdtemp.
-
-      quiet: if False (the default), the context manager raises an exception
-        on error.  Otherwise, if the path is specified and cannot be
-        created, only a warning is issued.
-
-    """
-    import tempfile
-    dir_created = False
-    if path is None:
-        path = tempfile.mkdtemp()
-        dir_created = True
-        path = os.path.realpath(path)
-    else:
-        try:
-            os.mkdir(path)
-            dir_created = True
-        except OSError as exc:
-            if not quiet:
-                raise
-            warnings.warn(f'tests may fail, unable to create '
-                          f'temporary directory {path!r}: {exc}',
-                          RuntimeWarning, stacklevel=3)
-    if dir_created:
-        pid = os.getpid()
-    try:
-        yield path
-    finally:
-        # In case the process forks, let only the parent remove the
-        # directory. The child has a different process id. (bpo-30028)
-        if dir_created and pid == os.getpid():
-            rmtree(path)
-
-@contextlib.contextmanager
-def change_cwd(path, quiet=False):
-    """Return a context manager that changes the current working directory.
-
-    Arguments:
-
-      path: the directory to use as the temporary current working directory.
-
-      quiet: if False (the default), the context manager raises an exception
-        on error.  Otherwise, it issues only a warning and keeps the current
-        working directory the same.
-
-    """
-    saved_dir = os.getcwd()
-    try:
-        os.chdir(os.path.realpath(path))
-    except OSError as exc:
-        if not quiet:
-            raise
-        warnings.warn(f'tests may fail, unable to change the current working '
-                      f'directory to {path!r}: {exc}',
-                      RuntimeWarning, stacklevel=3)
-    try:
-        yield os.getcwd()
-    finally:
-        os.chdir(saved_dir)
-
-
-@contextlib.contextmanager
-def temp_cwd(name='tempcwd', quiet=False):
-    """
-    Context manager that temporarily creates and changes the CWD.
-
-    The function temporarily changes the current working directory
-    after creating a temporary directory in the current directory with
-    name *name*.  If *name* is None, the temporary directory is
-    created using tempfile.mkdtemp.
-
-    If *quiet* is False (default) and it is not possible to
-    create or change the CWD, an error is raised.  If *quiet* is True,
-    only a warning is raised and the original CWD is used.
-
-    """
-    with temp_dir(path=name, quiet=quiet) as temp_path:
-        with change_cwd(temp_path, quiet=quiet) as cwd_dir:
-            yield cwd_dir
-
-if hasattr(os, "umask"):
-    @contextlib.contextmanager
-    def temp_umask(umask):
-        """Context manager that temporarily sets the process umask."""
-        oldmask = os.umask(umask)
-        try:
-            yield
-        finally:
-            os.umask(oldmask)
-
 # TEST_HOME_DIR refers to the top level directory of the "test" package
 # that contains Python's regression test suite
 TEST_SUPPORT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -975,6 +494,25 @@
 # TEST_DATA_DIR is used as a target download location for remote resources
 TEST_DATA_DIR = os.path.join(TEST_HOME_DIR, "data")
 
+
+def darwin_malloc_err_warning(test_name):
+    """Assure user that loud errors generated by macOS libc's malloc are
+    expected."""
+    if sys.platform != 'darwin':
+        return
+
+    import shutil
+    msg = ' NOTICE '
+    detail = (f'{test_name} may generate "malloc can\'t allocate region"\n'
+              'warnings on macOS systems. This behavior is known. Do not\n'
+              'report a bug unless tests are also failing. See bpo-40928.')
+
+    padding, _ = shutil.get_terminal_size()
+    print(msg.center(padding, '-'))
+    print(detail)
+    print('-' * padding)
+
+
 def findfile(filename, subdir=None):
     """Try to find a file on sys.path or in the test directory.  If it is not
     found the argument passed to the function is returned (this does not
@@ -993,10 +531,6 @@
         if os.path.exists(fn): return fn
     return filename
 
-def create_empty_file(filename):
-    """Create an empty file. If the file already exists, truncate it."""
-    fd = os.open(filename, os.O_WRONLY | os.O_CREAT | os.O_TRUNC)
-    os.close(fd)
 
 def sortdict(dict):
     "Like repr(dict), but in sorted order."
@@ -1005,19 +539,6 @@
     withcommas = ", ".join(reprpairs)
     return "{%s}" % withcommas
 
-def make_bad_fd():
-    """
-    Create an invalid file descriptor by opening and closing a file and return
-    its fd.
-    """
-    file = open(TESTFN, "wb")
-    try:
-        return file.fileno()
-    finally:
-        file.close()
-        unlink(TESTFN)
-
-
 def check_syntax_error(testcase, statement, errtext='', *, lineno=None, offset=None):
     with testcase.assertRaisesRegex(SyntaxError, errtext) as cm:
         compile(statement, '<test string>', 'exec')
@@ -1029,35 +550,10 @@
     if offset is not None:
         testcase.assertEqual(err.offset, offset)
 
-def check_syntax_warning(testcase, statement, errtext='', *, lineno=1, offset=None):
-    # Test also that a warning is emitted only once.
-    with warnings.catch_warnings(record=True) as warns:
-        warnings.simplefilter('always', SyntaxWarning)
-        compile(statement, '<testcase>', 'exec')
-    testcase.assertEqual(len(warns), 1, warns)
-
-    warn, = warns
-    testcase.assertTrue(issubclass(warn.category, SyntaxWarning), warn.category)
-    if errtext:
-        testcase.assertRegex(str(warn.message), errtext)
-    testcase.assertEqual(warn.filename, '<testcase>')
-    testcase.assertIsNotNone(warn.lineno)
-    if lineno is not None:
-        testcase.assertEqual(warn.lineno, lineno)
-
-    # SyntaxWarning should be converted to SyntaxError when raised,
-    # since the latter contains more information and provides better
-    # error report.
-    with warnings.catch_warnings(record=True) as warns:
-        warnings.simplefilter('error', SyntaxWarning)
-        check_syntax_error(testcase, statement, errtext,
-                           lineno=lineno, offset=offset)
-    # No warnings are leaked when a SyntaxError is raised.
-    testcase.assertEqual(warns, [])
-
 
 def open_urlresource(url, *args, **kw):
     import urllib.request, urllib.parse
+    from .os_helper import unlink
     try:
         import gzip
     except ImportError:
@@ -1110,277 +606,6 @@
     raise TestFailed('invalid resource %r' % fn)
 
 
-class WarningsRecorder(object):
-    """Convenience wrapper for the warnings list returned on
-       entry to the warnings.catch_warnings() context manager.
-    """
-    def __init__(self, warnings_list):
-        self._warnings = warnings_list
-        self._last = 0
-
-    def __getattr__(self, attr):
-        if len(self._warnings) > self._last:
-            return getattr(self._warnings[-1], attr)
-        elif attr in warnings.WarningMessage._WARNING_DETAILS:
-            return None
-        raise AttributeError("%r has no attribute %r" % (self, attr))
-
-    @property
-    def warnings(self):
-        return self._warnings[self._last:]
-
-    def reset(self):
-        self._last = len(self._warnings)
-
-
-def _filterwarnings(filters, quiet=False):
-    """Catch the warnings, then check if all the expected
-    warnings have been raised and re-raise unexpected warnings.
-    If 'quiet' is True, only re-raise the unexpected warnings.
-    """
-    # Clear the warning registry of the calling module
-    # in order to re-raise the warnings.
-    frame = sys._getframe(2)
-    registry = frame.f_globals.get('__warningregistry__')
-    if registry:
-        registry.clear()
-    with warnings.catch_warnings(record=True) as w:
-        # Set filter "always" to record all warnings.  Because
-        # test_warnings swap the module, we need to look up in
-        # the sys.modules dictionary.
-        sys.modules['warnings'].simplefilter("always")
-        yield WarningsRecorder(w)
-    # Filter the recorded warnings
-    reraise = list(w)
-    missing = []
-    for msg, cat in filters:
-        seen = False
-        for w in reraise[:]:
-            warning = w.message
-            # Filter out the matching messages
-            if (re.match(msg, str(warning), re.I) and
-                issubclass(warning.__class__, cat)):
-                seen = True
-                reraise.remove(w)
-        if not seen and not quiet:
-            # This filter caught nothing
-            missing.append((msg, cat.__name__))
-    if reraise:
-        raise AssertionError("unhandled warning %s" % reraise[0])
-    if missing:
-        raise AssertionError("filter (%r, %s) did not catch any warning" %
-                             missing[0])
-
-
-@contextlib.contextmanager
-def check_warnings(*filters, **kwargs):
-    """Context manager to silence warnings.
-
-    Accept 2-tuples as positional arguments:
-        ("message regexp", WarningCategory)
-
-    Optional argument:
-     - if 'quiet' is True, it does not fail if a filter catches nothing
-        (default True without argument,
-         default False if some filters are defined)
-
-    Without argument, it defaults to:
-        check_warnings(("", Warning), quiet=True)
-    """
-    quiet = kwargs.get('quiet')
-    if not filters:
-        filters = (("", Warning),)
-        # Preserve backward compatibility
-        if quiet is None:
-            quiet = True
-    return _filterwarnings(filters, quiet)
-
-
-@contextlib.contextmanager
-def check_no_warnings(testcase, message='', category=Warning, force_gc=False):
-    """Context manager to check that no warnings are emitted.
-
-    This context manager enables a given warning within its scope
-    and checks that no warnings are emitted even with that warning
-    enabled.
-
-    If force_gc is True, a garbage collection is attempted before checking
-    for warnings. This may help to catch warnings emitted when objects
-    are deleted, such as ResourceWarning.
-
-    Other keyword arguments are passed to warnings.filterwarnings().
-    """
-    with warnings.catch_warnings(record=True) as warns:
-        warnings.filterwarnings('always',
-                                message=message,
-                                category=category)
-        yield
-        if force_gc:
-            gc_collect()
-    testcase.assertEqual(warns, [])
-
-
-@contextlib.contextmanager
-def check_no_resource_warning(testcase):
-    """Context manager to check that no ResourceWarning is emitted.
-
-    Usage:
-
-        with check_no_resource_warning(self):
-            f = open(...)
-            ...
-            del f
-
-    You must remove the object which may emit ResourceWarning before
-    the end of the context manager.
-    """
-    with check_no_warnings(testcase, category=ResourceWarning, force_gc=True):
-        yield
-
-
-class CleanImport(object):
-    """Context manager to force import to return a new module reference.
-
-    This is useful for testing module-level behaviours, such as
-    the emission of a DeprecationWarning on import.
-
-    Use like this:
-
-        with CleanImport("foo"):
-            importlib.import_module("foo") # new reference
-    """
-
-    def __init__(self, *module_names):
-        self.original_modules = sys.modules.copy()
-        for module_name in module_names:
-            if module_name in sys.modules:
-                module = sys.modules[module_name]
-                # It is possible that module_name is just an alias for
-                # another module (e.g. stub for modules renamed in 3.x).
-                # In that case, we also need delete the real module to clear
-                # the import cache.
-                if module.__name__ != module_name:
-                    del sys.modules[module.__name__]
-                del sys.modules[module_name]
-
-    def __enter__(self):
-        return self
-
-    def __exit__(self, *ignore_exc):
-        sys.modules.update(self.original_modules)
-
-
-class EnvironmentVarGuard(collections.abc.MutableMapping):
-
-    """Class to help protect the environment variable properly.  Can be used as
-    a context manager."""
-
-    def __init__(self):
-        self._environ = os.environ
-        self._changed = {}
-
-    def __getitem__(self, envvar):
-        return self._environ[envvar]
-
-    def __setitem__(self, envvar, value):
-        # Remember the initial value on the first access
-        if envvar not in self._changed:
-            self._changed[envvar] = self._environ.get(envvar)
-        self._environ[envvar] = value
-
-    def __delitem__(self, envvar):
-        # Remember the initial value on the first access
-        if envvar not in self._changed:
-            self._changed[envvar] = self._environ.get(envvar)
-        if envvar in self._environ:
-            del self._environ[envvar]
-
-    def keys(self):
-        return self._environ.keys()
-
-    def __iter__(self):
-        return iter(self._environ)
-
-    def __len__(self):
-        return len(self._environ)
-
-    def set(self, envvar, value):
-        self[envvar] = value
-
-    def unset(self, envvar):
-        del self[envvar]
-
-    def __enter__(self):
-        return self
-
-    def __exit__(self, *ignore_exc):
-        for (k, v) in self._changed.items():
-            if v is None:
-                if k in self._environ:
-                    del self._environ[k]
-            else:
-                self._environ[k] = v
-        os.environ = self._environ
-
-
-class DirsOnSysPath(object):
-    """Context manager to temporarily add directories to sys.path.
-
-    This makes a copy of sys.path, appends any directories given
-    as positional arguments, then reverts sys.path to the copied
-    settings when the context ends.
-
-    Note that *all* sys.path modifications in the body of the
-    context manager, including replacement of the object,
-    will be reverted at the end of the block.
-    """
-
-    def __init__(self, *paths):
-        self.original_value = sys.path[:]
-        self.original_object = sys.path
-        sys.path.extend(paths)
-
-    def __enter__(self):
-        return self
-
-    def __exit__(self, *ignore_exc):
-        sys.path = self.original_object
-        sys.path[:] = self.original_value
-
-
-class TransientResource(object):
-
-    """Raise ResourceDenied if an exception is raised while the context manager
-    is in effect that matches the specified exception and attributes."""
-
-    def __init__(self, exc, **kwargs):
-        self.exc = exc
-        self.attrs = kwargs
-
-    def __enter__(self):
-        return self
-
-    def __exit__(self, type_=None, value=None, traceback=None):
-        """If type_ is a subclass of self.exc and value has attributes matching
-        self.attrs, raise ResourceDenied.  Otherwise let the exception
-        propagate (if any)."""
-        if type_ is not None and issubclass(self.exc, type_):
-            for attr, attr_value in self.attrs.items():
-                if not hasattr(value, attr):
-                    break
-                if getattr(value, attr) != attr_value:
-                    break
-            else:
-                raise ResourceDenied("an optional resource is not available")
-
-# Context managers that raise ResourceDenied when various issues
-# with the Internet connection manifest themselves as exceptions.
-# XXX deprecate these and use transient_internet() instead
-time_out = TransientResource(OSError, errno=errno.ETIMEDOUT)
-socket_peer_reset = TransientResource(OSError, errno=errno.ECONNRESET)
-ioerror_peer_reset = TransientResource(OSError, errno=errno.ECONNRESET)
-
-
 @contextlib.contextmanager
 def captured_output(stream_name):
     """Return a context manager used by captured_stdout/stdin/stderr
@@ -1471,9 +696,11 @@
 _vheader = _header + 'n'
 
 def calcobjsize(fmt):
+    import struct
     return struct.calcsize(_header + fmt + _align)
 
 def calcvobjsize(fmt):
+    import struct
     return struct.calcsize(_vheader + fmt + _align)
 
 
@@ -1495,9 +722,8 @@
 # Decorator for running a function in a different locale, correctly resetting
 # it afterwards.
 
+@contextlib.contextmanager
 def run_with_locale(catstr, *locales):
-    def decorator(func):
-        def inner(*args, **kwds):
             try:
                 import locale
                 category = getattr(locale, catstr)
@@ -1516,16 +742,11 @@
                     except:
                         pass
 
-            # now run the function, resetting the locale on exceptions
             try:
-                return func(*args, **kwds)
+                yield
             finally:
                 if locale and orig_locale:
                     locale.setlocale(category, orig_locale)
-        inner.__name__ = func.__name__
-        inner.__doc__ = func.__doc__
-        return inner
-    return decorator
 
 #=======================================================================
 # Decorator for running a function in a specific timezone, correctly
@@ -1604,6 +825,7 @@
         self.started = False
 
     def start(self):
+        import warnings
         try:
             f = open(self.procfile, 'r')
         except OSError as e:
@@ -1612,6 +834,7 @@
             sys.stderr.flush()
             return
 
+        import subprocess
         with f:
             watchdog_script = findfile("memory_watchdog.py")
             self.mem_watchdog = subprocess.Popen([sys.executable, watchdog_script],
@@ -1745,7 +968,7 @@
           if check_impl_detail(cpython=False):  # everywhere except on CPython
     """
     guards, default = _parse_guards(guards)
-    return guards.get(platform.python_implementation().lower(), default)
+    return guards.get(sys.implementation.name, default)
 
 
 def no_tracing(func):
@@ -1808,7 +1031,9 @@
         else:
             err = "multiple errors occurred"
             if not verbose: err += "; run in verbose mode for details"
-        raise TestFailed(err)
+        errors = [(str(tc), exc_str) for tc, exc_str in result.errors]
+        failures = [(str(tc), exc_str) for tc, exc_str in result.failures]
+        raise TestFailedWithDetails(err, errors, failures)
 
 
 # By default, don't filter tests
@@ -1879,6 +1104,7 @@
         # The test.bisect_cmd utility only uses such full test identifiers.
         func = set(patterns).__contains__
     else:
+        import fnmatch
         regex = '|'.join(map(fnmatch.translate, patterns))
         # The search *is* case sensitive on purpose:
         # don't use flags=re.IGNORECASE
@@ -1973,139 +1199,15 @@
     for line in msg.splitlines():
         print(f"Warning -- {line}", file=sys.__stderr__, flush=True)
 
-def modules_setup():
-    return sys.modules.copy(),
-
-def modules_cleanup(oldmodules):
-    # Encoders/decoders are registered permanently within the internal
-    # codec cache. If we destroy the corresponding modules their
-    # globals will be set to None which will trip up the cached functions.
-    encodings = [(k, v) for k, v in sys.modules.items()
-                 if k.startswith('encodings.')]
-    sys.modules.clear()
-    sys.modules.update(encodings)
-    # XXX: This kind of problem can affect more than just encodings. In particular
-    # extension modules (such as _ssl) don't cope with reloading properly.
-    # Really, test modules should be cleaning out the test specific modules they
-    # know they added (ala test_runpy) rather than relying on this function (as
-    # test_importhooks and test_pkg do currently).
-    # Implicitly imported *real* modules should be left alone (see issue 10556).
-    sys.modules.update(oldmodules)
-
-#=======================================================================
-# Threading support to prevent reporting refleaks when running regrtest.py -R
 
 # Flag used by saved_test_environment of test.libregrtest.save_env,
 # to check if a test modified the environment. The flag should be set to False
 # before running a new test.
 #
-# For example, threading_cleanup() sets the flag is the function fails
+# For example, threading_helper.threading_cleanup() sets the flag is the function fails
 # to cleanup threads.
 environment_altered = False
 
-# NOTE: we use thread._count() rather than threading.enumerate() (or the
-# moral equivalent thereof) because a threading.Thread object is still alive
-# until its __bootstrap() method has returned, even after it has been
-# unregistered from the threading module.
-# thread._count(), on the other hand, only gets decremented *after* the
-# __bootstrap() method has returned, which gives us reliable reference counts
-# at the end of a test run.
-
-def threading_setup():
-    return _thread._count(), threading._dangling.copy()
-
-def threading_cleanup(*original_values):
-    global environment_altered
-
-    _MAX_COUNT = 100
-
-    for count in range(_MAX_COUNT):
-        values = _thread._count(), threading._dangling
-        if values == original_values:
-            break
-
-        if not count:
-            # Display a warning at the first iteration
-            environment_altered = True
-            dangling_threads = values[1]
-            print_warning(f"threading_cleanup() failed to cleanup "
-                          f"{values[0] - original_values[0]} threads "
-                          f"(count: {values[0]}, "
-                          f"dangling: {len(dangling_threads)})")
-            for thread in dangling_threads:
-                print_warning(f"Dangling thread: {thread!r}")
-
-            # Don't hold references to threads
-            dangling_threads = None
-        values = None
-
-        time.sleep(0.01)
-        gc_collect()
-
-
-def reap_threads(func):
-    """Use this function when threads are being used.  This will
-    ensure that the threads are cleaned up even when the test fails.
-    """
-    @functools.wraps(func)
-    def decorator(*args):
-        key = threading_setup()
-        try:
-            return func(*args)
-        finally:
-            threading_cleanup(*key)
-    return decorator
-
-
-@contextlib.contextmanager
-def wait_threads_exit(timeout=None):
-    """
-    bpo-31234: Context manager to wait until all threads created in the with
-    statement exit.
-
-    Use _thread.count() to check if threads exited. Indirectly, wait until
-    threads exit the internal t_bootstrap() C function of the _thread module.
-
-    threading_setup() and threading_cleanup() are designed to emit a warning
-    if a test leaves running threads in the background. This context manager
-    is designed to cleanup threads started by the _thread.start_new_thread()
-    which doesn't allow to wait for thread exit, whereas thread.Thread has a
-    join() method.
-    """
-    if timeout is None:
-        timeout = SHORT_TIMEOUT
-    old_count = _thread._count()
-    try:
-        yield
-    finally:
-        start_time = time.monotonic()
-        deadline = start_time + timeout
-        while True:
-            count = _thread._count()
-            if count <= old_count:
-                break
-            if time.monotonic() > deadline:
-                dt = time.monotonic() - start_time
-                msg = (f"wait_threads() failed to cleanup {count - old_count} "
-                       f"threads after {dt:.1f} seconds "
-                       f"(count: {count}, old count: {old_count})")
-                raise AssertionError(msg)
-            time.sleep(0.010)
-            gc_collect()
-
-
-def join_thread(thread, timeout=None):
-    """Join a thread. Raise an AssertionError if the thread is still alive
-    after timeout seconds.
-    """
-    if timeout is None:
-        timeout = SHORT_TIMEOUT
-    thread.join(timeout)
-    if thread.is_alive():
-        msg = f"failed to join the thread in {timeout:.1f} seconds"
-        raise AssertionError(msg)
-
-
 def reap_children():
     """Use this function at the end of test_main() whenever sub-processes
     are started.  This will help ensure that no extra children (zombies)
@@ -2135,43 +1237,6 @@
 
 
 @contextlib.contextmanager
-def start_threads(threads, unlock=None):
-    import faulthandler
-    threads = list(threads)
-    started = []
-    try:
-        try:
-            for t in threads:
-                t.start()
-                started.append(t)
-        except:
-            if verbose:
-                print("Can't start %d threads, only %d threads started" %
-                      (len(threads), len(started)))
-            raise
-        yield
-    finally:
-        try:
-            if unlock:
-                unlock()
-            endtime = starttime = time.monotonic()
-            for timeout in range(1, 16):
-                endtime += 60
-                for t in started:
-                    t.join(max(endtime - time.monotonic(), 0.01))
-                started = [t for t in started if t.is_alive()]
-                if not started:
-                    break
-                if verbose:
-                    print('Unable to join %d threads during a period of '
-                          '%d minutes' % (len(started), timeout))
-        finally:
-            started = [t for t in started if t.is_alive()]
-            if started:
-                faulthandler.dump_traceback(sys.stdout)
-                raise AssertionError('Unable to join %d threads' % len(started))
-
-@contextlib.contextmanager
 def swap_attr(obj, attr, new_val):
     """Temporary swap out an attribute with a new object.
 
@@ -2236,11 +1301,13 @@
 def args_from_interpreter_flags():
     """Return a list of command-line arguments reproducing the current
     settings in sys.flags and sys.warnoptions."""
+    import subprocess
     return subprocess._args_from_interpreter_flags()
 
 def optim_args_from_interpreter_flags():
     """Return a list of command-line arguments reproducing the current
     optimization settings in sys.flags."""
+    import subprocess
     return subprocess._optim_args_from_interpreter_flags()
 
 
@@ -2278,28 +1345,6 @@
         return result
 
 
-_can_symlink = None
-def can_symlink():
-    global _can_symlink
-    if _can_symlink is not None:
-        return _can_symlink
-    symlink_path = TESTFN + "can_symlink"
-    try:
-        os.symlink(TESTFN, symlink_path)
-        can = True
-    except (OSError, NotImplementedError, AttributeError):
-        can = False
-    else:
-        os.remove(symlink_path)
-    _can_symlink = can
-    return can
-
-def skip_unless_symlink(test):
-    """Skip decorator for tests that require functional symlink"""
-    ok = can_symlink()
-    msg = "Requires functional symlink implementation"
-    return test if ok else unittest.skip(msg)(test)
-
 _buggy_ucrt = None
 def skip_if_buggy_ucrt_strfptime(test):
     """
@@ -2325,6 +1370,8 @@
 class PythonSymlink:
     """Creates a symlink for the current Python executable"""
     def __init__(self, link=None):
+        from .os_helper import TESTFN
+
         self.link = link or os.path.abspath(TESTFN)
         self._linked = []
         self.real = os.path.realpath(sys.executable)
@@ -2334,11 +1381,9 @@
 
         self._platform_specific()
 
-    def _platform_specific(self):
-        pass
-
     if sys.platform == "win32":
         def _platform_specific(self):
+            import glob
             import _winapi
 
             if os.path.lexists(self.real) and not os.path.exists(self.real):
@@ -2363,6 +1408,9 @@
             self._env["PYTHONHOME"] = os.path.dirname(self.real)
             if sysconfig.is_python_build(True):
                 self._env["PYTHONPATH"] = os.path.dirname(os.__file__)
+    else:
+        def _platform_specific(self):
+            pass
 
     def __enter__(self):
         os.symlink(self.real, self.link)
@@ -2381,6 +1429,7 @@
                     print("failed to clean up {}: {}".format(link, ex))
 
     def _call(self, python, args, env, returncode):
+        import subprocess
         cmd = [python, *args]
         p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
                              stderr=subprocess.PIPE, env=env)
@@ -2400,44 +1449,6 @@
         return self._call(self.link, args, self._env, returncode)
 
 
-_can_xattr = None
-def can_xattr():
-    import tempfile
-    global _can_xattr
-    if _can_xattr is not None:
-        return _can_xattr
-    if not hasattr(os, "setxattr"):
-        can = False
-    else:
-        tmp_dir = tempfile.mkdtemp()
-        tmp_fp, tmp_name = tempfile.mkstemp(dir=tmp_dir)
-        try:
-            with open(TESTFN, "wb") as fp:
-                try:
-                    # TESTFN & tempfile may use different file systems with
-                    # different capabilities
-                    os.setxattr(tmp_fp, b"user.test", b"")
-                    os.setxattr(tmp_name, b"trusted.foo", b"42")
-                    os.setxattr(fp.fileno(), b"user.test", b"")
-                    # Kernels < 2.6.39 don't respect setxattr flags.
-                    kernel_version = platform.release()
-                    m = re.match(r"2.6.(\d{1,2})", kernel_version)
-                    can = m is None or int(m.group(1)) >= 39
-                except OSError:
-                    can = False
-        finally:
-            unlink(TESTFN)
-            unlink(tmp_name)
-            rmdir(tmp_dir)
-    _can_xattr = can
-    return can
-
-def skip_unless_xattr(test):
-    """Skip decorator for tests that require functional extended attributes"""
-    ok = can_xattr()
-    msg = "no non-broken extended attribute support"
-    return test if ok else unittest.skip(msg)(test)
-
 def skip_if_pgo_task(test):
     """Skip decorator for tests not run in (non-extended) PGO task"""
     ok = not PGO or PGO_EXTENDED
@@ -2445,20 +1456,6 @@
     return test if ok else unittest.skip(msg)(test)
 
 
-def fs_is_case_insensitive(directory):
-    """Detects if the file system for the specified directory is case-insensitive."""
-    import tempfile
-    with tempfile.NamedTemporaryFile(dir=directory) as base:
-        base_path = base.name
-        case_path = base_path.upper()
-        if case_path == base_path:
-            case_path = base_path.lower()
-        try:
-            return os.path.samefile(base_path, case_path)
-        except FileNotFoundError:
-            return False
-
-
 def detect_api_mismatch(ref_api, other_api, *, ignore=()):
     """Returns the set of items in ref_api not in other_api, except for a
     defined list of items to be ignored in this check.
@@ -2475,7 +1472,7 @@
 
 
 def check__all__(test_case, module, name_of_module=None, extra=(),
-                 blacklist=()):
+                 not_exported=()):
     """Assert that the __all__ variable of 'module' contains all public names.
 
     The module's public names (its API) are detected automatically based on
@@ -2492,7 +1489,7 @@
     '__module__' attribute. If provided, it will be added to the
     automatically detected ones.
 
-    The 'blacklist' argument can be a set of names that must not be treated
+    The 'not_exported' argument can be a set of names that must not be treated
     as part of the public API even though their names indicate otherwise.
 
     Usage:
@@ -2508,10 +1505,10 @@
         class OtherTestCase(unittest.TestCase):
             def test__all__(self):
                 extra = {'BAR_CONST', 'FOO_CONST'}
-                blacklist = {'baz'}  # Undocumented name.
+                not_exported = {'baz'}  # Undocumented name.
                 # bar imports part of its API from _bar.
                 support.check__all__(self, bar, ('bar', '_bar'),
-                                     extra=extra, blacklist=blacklist)
+                                     extra=extra, not_exported=not_exported)
 
     """
 
@@ -2523,7 +1520,7 @@
     expected = set(extra)
 
     for name in dir(module):
-        if name.startswith('_') or name in blacklist:
+        if name.startswith('_') or name in not_exported:
             continue
         obj = getattr(module, name)
         if (getattr(obj, '__module__', None) in name_of_module or
@@ -2572,14 +1569,12 @@
         """
         if sys.platform.startswith('win'):
             # see http://msdn.microsoft.com/en-us/library/windows/desktop/ms680621.aspx
-            # GetErrorMode is not available on Windows XP and Windows Server 2003,
-            # but SetErrorMode returns the previous value, so we can use that
             try:
                 import msvcrt
             except ImportError:
                 return
 
-            self.old_value = msvcrt.SetErrorMode(msvcrt.SEM_NOGPFAULTERRORBOX)
+            self.old_value = msvcrt.GetErrorMode()
 
             msvcrt.SetErrorMode(self.old_value | msvcrt.SEM_NOGPFAULTERRORBOX)
 
@@ -2611,6 +1606,7 @@
                     pass
 
             if sys.platform == 'darwin':
+                import subprocess
                 # Check if the 'Crash Reporter' on OSX was configured
                 # in 'Developer' mode and warn that it will get triggered
                 # when it is.
@@ -2733,6 +1729,7 @@
     missing.
 
     """
+    # TODO (PEP 632): alternate check without using distutils
     from distutils import ccompiler, sysconfig, spawn, errors
     compiler = ccompiler.new_compiler()
     sysconfig.customize_compiler(compiler)
@@ -2763,6 +1760,7 @@
     if is_android and interval < minimum_interval:
         global _is_android_emulator
         if _is_android_emulator is None:
+            import subprocess
             _is_android_emulator = (subprocess.check_output(
                                ['getprop', 'ro.kernel.qemu']).strip() == b'1')
         if _is_android_emulator:
@@ -2788,65 +1786,6 @@
             faulthandler.enable(file=fd, all_threads=True)
 
 
-def fd_count():
-    """Count the number of open file descriptors.
-    """
-    if sys.platform.startswith(('linux', 'freebsd')):
-        try:
-            names = os.listdir("/proc/self/fd")
-            # Subtract one because listdir() internally opens a file
-            # descriptor to list the content of the /proc/self/fd/ directory.
-            return len(names) - 1
-        except FileNotFoundError:
-            pass
-
-    MAXFD = 256
-    if hasattr(os, 'sysconf'):
-        try:
-            MAXFD = os.sysconf("SC_OPEN_MAX")
-        except OSError:
-            pass
-
-    old_modes = None
-    if sys.platform == 'win32':
-        # bpo-25306, bpo-31009: Call CrtSetReportMode() to not kill the process
-        # on invalid file descriptor if Python is compiled in debug mode
-        try:
-            import msvcrt
-            msvcrt.CrtSetReportMode
-        except (AttributeError, ImportError):
-            # no msvcrt or a release build
-            pass
-        else:
-            old_modes = {}
-            for report_type in (msvcrt.CRT_WARN,
-                                msvcrt.CRT_ERROR,
-                                msvcrt.CRT_ASSERT):
-                old_modes[report_type] = msvcrt.CrtSetReportMode(report_type, 0)
-
-    try:
-        count = 0
-        for fd in range(MAXFD):
-            try:
-                # Prefer dup() over fstat(). fstat() can require input/output
-                # whereas dup() doesn't.
-                fd2 = os.dup(fd)
-            except OSError as e:
-                if e.errno != errno.EBADF:
-                    raise
-            else:
-                os.close(fd2)
-                count += 1
-    finally:
-        if old_modes is not None:
-            for report_type in (msvcrt.CRT_WARN,
-                                msvcrt.CRT_ERROR,
-                                msvcrt.CRT_ASSERT):
-                msvcrt.CrtSetReportMode(report_type, old_modes[report_type])
-
-    return count
-
-
 class SaveSignals:
     """
     Save and restore signal handlers.
@@ -2891,24 +1830,6 @@
     return _testcapi.WITH_PYMALLOC
 
 
-class FakePath:
-    """Simple implementing of the path protocol.
-    """
-    def __init__(self, path):
-        self.path = path
-
-    def __repr__(self):
-        return f'<FakePath {self.path!r}>'
-
-    def __fspath__(self):
-        if (isinstance(self.path, BaseException) or
-            isinstance(self.path, type) and
-                issubclass(self.path, BaseException)):
-            raise self.path
-        else:
-            return self.path
-
-
 class _ALWAYS_EQ:
     """
     Object that is equal to anything.
@@ -3048,63 +1969,6 @@
         del self.unraisable
 
 
-class catch_threading_exception:
-    """
-    Context manager catching threading.Thread exception using
-    threading.excepthook.
-
-    Attributes set when an exception is catched:
-
-    * exc_type
-    * exc_value
-    * exc_traceback
-    * thread
-
-    See threading.excepthook() documentation for these attributes.
-
-    These attributes are deleted at the context manager exit.
-
-    Usage:
-
-        with support.catch_threading_exception() as cm:
-            # code spawning a thread which raises an exception
-            ...
-
-            # check the thread exception, use cm attributes:
-            # exc_type, exc_value, exc_traceback, thread
-            ...
-
-        # exc_type, exc_value, exc_traceback, thread attributes of cm no longer
-        # exists at this point
-        # (to avoid reference cycles)
-    """
-
-    def __init__(self):
-        self.exc_type = None
-        self.exc_value = None
-        self.exc_traceback = None
-        self.thread = None
-        self._old_hook = None
-
-    def _hook(self, args):
-        self.exc_type = args.exc_type
-        self.exc_value = args.exc_value
-        self.exc_traceback = args.exc_traceback
-        self.thread = args.thread
-
-    def __enter__(self):
-        self._old_hook = threading.excepthook
-        threading.excepthook = self._hook
-        return self
-
-    def __exit__(self, *exc_info):
-        threading.excepthook = self._old_hook
-        del self.exc_type
-        del self.exc_value
-        del self.exc_traceback
-        del self.thread
-
-
 def wait_process(pid, *, exitcode, timeout=None):
     """
     Wait until process pid completes and check that the process exit code is
@@ -3157,32 +2021,13 @@
     if pid2 != pid:
         raise AssertionError(f"pid {pid2} != pid {pid}")
 
-
-def use_old_parser():
-    import _testinternalcapi
-    config = _testinternalcapi.get_configs()
-    return (config['config']['_use_peg_parser'] == 0)
-
-
-def skip_if_new_parser(msg):
-    return unittest.skipIf(not use_old_parser(), msg)
-
-
-@contextlib.contextmanager
-def save_restore_warnings_filters():
-    old_filters = warnings.filters[:]
-    try:
-        yield
-    finally:
-        warnings.filters[:] = old_filters
-
-
 def skip_if_broken_multiprocessing_synchronize():
     """
     Skip tests if the multiprocessing.synchronize module is missing, if there
     is no available semaphore implementation, or if creating a lock raises an
     OSError (on Linux only).
     """
+    from .import_helper import import_module
 
     # Skip tests if the _multiprocessing extension is missing.
     import_module('_multiprocessing')
@@ -3199,3 +2044,60 @@
             synchronize.Lock(ctx=None)
         except OSError as exc:
             raise unittest.SkipTest(f"broken multiprocessing SemLock: {exc!r}")
+
+
+@contextlib.contextmanager
+def infinite_recursion(max_depth=75):
+    original_depth = sys.getrecursionlimit()
+    try:
+        sys.setrecursionlimit(max_depth)
+        yield
+    finally:
+        sys.setrecursionlimit(original_depth)
+
+
+def check_disallow_instantiation(testcase, tp, *args, **kwds):
+    """
+    Check that given type cannot be instantiated using *args and **kwds.
+
+    See bpo-43916: Add Py_TPFLAGS_DISALLOW_INSTANTIATION type flag.
+    """
+    mod = tp.__module__
+    name = tp.__name__
+    if mod != 'builtins':
+        qualname = f"{mod}.{name}"
+    else:
+        qualname = f"{name}"
+    msg = f"cannot create '{re.escape(qualname)}' instances"
+    testcase.assertRaisesRegex(TypeError, msg, tp, *args, **kwds)
+
+
+def ignore_deprecations_from(module: str, *, like: str) -> object:
+    token = object()
+    warnings.filterwarnings(
+        "ignore",
+        category=DeprecationWarning,
+        module=module,
+        message=like + fr"(?#support{id(token)})",
+    )
+    return token
+
+
+def clear_ignored_deprecations(*tokens: object) -> None:
+    if not tokens:
+        raise ValueError("Provide token or tokens returned by ignore_deprecations_from")
+
+    new_filters = []
+    endswith = tuple(rf"(?#support{id(token)})" for token in tokens)
+    for action, message, category, module, lineno in warnings.filters:
+        if action == "ignore" and category is DeprecationWarning:
+            if isinstance(message, re.Pattern):
+                msg = message.pattern
+            else:
+                msg = message or ""
+            if msg.endswith(endswith):
+                continue
+        new_filters.append((action, message, category, module, lineno))
+    if warnings.filters != new_filters:
+        warnings.filters[:] = new_filters
+        warnings._filters_mutated()
diff --git a/Lib/test/support/bytecode_helper.py b/Lib/test/support/bytecode_helper.py
index 348e277..471d4a6 100644
--- a/Lib/test/support/bytecode_helper.py
+++ b/Lib/test/support/bytecode_helper.py
@@ -35,7 +35,8 @@
                 disassembly = self.get_disassembly_as_string(x)
                 if argval is _UNSPECIFIED:
                     msg = '%s occurs in bytecode:\n%s' % (opname, disassembly)
+                    self.fail(msg)
                 elif instr.argval == argval:
                     msg = '(%s,%r) occurs in bytecode:\n%s'
                     msg = msg % (opname, argval, disassembly)
-                self.fail(msg)
+                    self.fail(msg)
diff --git a/Lib/test/support/hashlib_helper.py b/Lib/test/support/hashlib_helper.py
index a28132a..a4e6c92 100644
--- a/Lib/test/support/hashlib_helper.py
+++ b/Lib/test/support/hashlib_helper.py
@@ -21,8 +21,21 @@
     ValueError: [digital envelope routines: EVP_DigestInit_ex] disabled for FIPS
     ValueError: unsupported hash type md4
     """
-    def decorator(func):
-        @functools.wraps(func)
+    def decorator(func_or_class):
+        if isinstance(func_or_class, type):
+            setUpClass = func_or_class.__dict__.get('setUpClass')
+            if setUpClass is None:
+                def setUpClass(cls):
+                    super(func_or_class, cls).setUpClass()
+                setUpClass.__qualname__ = func_or_class.__qualname__ + '.setUpClass'
+                setUpClass.__module__ = func_or_class.__module__
+            else:
+                setUpClass = setUpClass.__func__
+            setUpClass = classmethod(decorator(setUpClass))
+            func_or_class.setUpClass = setUpClass
+            return func_or_class
+
+        @functools.wraps(func_or_class)
         def wrapper(*args, **kwargs):
             try:
                 if openssl and _hashlib is not None:
@@ -33,6 +46,6 @@
                 raise unittest.SkipTest(
                     f"hash digest '{digestname}' is not available."
                 )
-            return func(*args, **kwargs)
+            return func_or_class(*args, **kwargs)
         return wrapper
     return decorator
diff --git a/Lib/test/support/import_helper.py b/Lib/test/support/import_helper.py
new file mode 100644
index 0000000..efa8ffa
--- /dev/null
+++ b/Lib/test/support/import_helper.py
@@ -0,0 +1,220 @@
+import contextlib
+import importlib
+import importlib.util
+import os
+import shutil
+import sys
+import unittest
+import warnings
+
+from .os_helper import unlink
+
+
+@contextlib.contextmanager
+def _ignore_deprecated_imports(ignore=True):
+    """Context manager to suppress package and module deprecation
+    warnings when importing them.
+
+    If ignore is False, this context manager has no effect.
+    """
+    if ignore:
+        with warnings.catch_warnings():
+            warnings.filterwarnings("ignore", ".+ (module|package)",
+                                    DeprecationWarning)
+            yield
+    else:
+        yield
+
+
+def unload(name):
+    try:
+        del sys.modules[name]
+    except KeyError:
+        pass
+
+
+def forget(modname):
+    """'Forget' a module was ever imported.
+
+    This removes the module from sys.modules and deletes any PEP 3147/488 or
+    legacy .pyc files.
+    """
+    unload(modname)
+    for dirname in sys.path:
+        source = os.path.join(dirname, modname + '.py')
+        # It doesn't matter if they exist or not, unlink all possible
+        # combinations of PEP 3147/488 and legacy pyc files.
+        unlink(source + 'c')
+        for opt in ('', 1, 2):
+            unlink(importlib.util.cache_from_source(source, optimization=opt))
+
+
+def make_legacy_pyc(source):
+    """Move a PEP 3147/488 pyc file to its legacy pyc location.
+
+    :param source: The file system path to the source file.  The source file
+        does not need to exist, however the PEP 3147/488 pyc file must exist.
+    :return: The file system path to the legacy pyc file.
+    """
+    pyc_file = importlib.util.cache_from_source(source)
+    up_one = os.path.dirname(os.path.abspath(source))
+    legacy_pyc = os.path.join(up_one, source + 'c')
+    shutil.move(pyc_file, legacy_pyc)
+    return legacy_pyc
+
+
+def import_module(name, deprecated=False, *, required_on=()):
+    """Import and return the module to be tested, raising SkipTest if
+    it is not available.
+
+    If deprecated is True, any module or package deprecation messages
+    will be suppressed. If a module is required on a platform but optional for
+    others, set required_on to an iterable of platform prefixes which will be
+    compared against sys.platform.
+    """
+    with _ignore_deprecated_imports(deprecated):
+        try:
+            return importlib.import_module(name)
+        except ImportError as msg:
+            if sys.platform.startswith(tuple(required_on)):
+                raise
+            raise unittest.SkipTest(str(msg))
+
+
+def _save_and_remove_modules(names):
+    orig_modules = {}
+    prefixes = tuple(name + '.' for name in names)
+    for modname in list(sys.modules):
+        if modname in names or modname.startswith(prefixes):
+            orig_modules[modname] = sys.modules.pop(modname)
+    return orig_modules
+
+
+def import_fresh_module(name, fresh=(), blocked=(), deprecated=False):
+    """Import and return a module, deliberately bypassing sys.modules.
+
+    This function imports and returns a fresh copy of the named Python module
+    by removing the named module from sys.modules before doing the import.
+    Note that unlike reload, the original module is not affected by
+    this operation.
+
+    *fresh* is an iterable of additional module names that are also removed
+    from the sys.modules cache before doing the import. If one of these
+    modules can't be imported, None is returned.
+
+    *blocked* is an iterable of module names that are replaced with None
+    in the module cache during the import to ensure that attempts to import
+    them raise ImportError.
+
+    The named module and any modules named in the *fresh* and *blocked*
+    parameters are saved before starting the import and then reinserted into
+    sys.modules when the fresh import is complete.
+
+    Module and package deprecation messages are suppressed during this import
+    if *deprecated* is True.
+
+    This function will raise ImportError if the named module cannot be
+    imported.
+    """
+    # NOTE: test_heapq, test_json and test_warnings include extra sanity checks
+    # to make sure that this utility function is working as expected
+    with _ignore_deprecated_imports(deprecated):
+        # Keep track of modules saved for later restoration as well
+        # as those which just need a blocking entry removed
+        fresh = list(fresh)
+        blocked = list(blocked)
+        names = {name, *fresh, *blocked}
+        orig_modules = _save_and_remove_modules(names)
+        for modname in blocked:
+            sys.modules[modname] = None
+
+        try:
+            # Return None when one of the "fresh" modules can not be imported.
+            try:
+                for modname in fresh:
+                    __import__(modname)
+            except ImportError:
+                return None
+            return importlib.import_module(name)
+        finally:
+            _save_and_remove_modules(names)
+            sys.modules.update(orig_modules)
+
+
+class CleanImport(object):
+    """Context manager to force import to return a new module reference.
+
+    This is useful for testing module-level behaviours, such as
+    the emission of a DeprecationWarning on import.
+
+    Use like this:
+
+        with CleanImport("foo"):
+            importlib.import_module("foo") # new reference
+    """
+
+    def __init__(self, *module_names):
+        self.original_modules = sys.modules.copy()
+        for module_name in module_names:
+            if module_name in sys.modules:
+                module = sys.modules[module_name]
+                # It is possible that module_name is just an alias for
+                # another module (e.g. stub for modules renamed in 3.x).
+                # In that case, we also need delete the real module to clear
+                # the import cache.
+                if module.__name__ != module_name:
+                    del sys.modules[module.__name__]
+                del sys.modules[module_name]
+
+    def __enter__(self):
+        return self
+
+    def __exit__(self, *ignore_exc):
+        sys.modules.update(self.original_modules)
+
+
+class DirsOnSysPath(object):
+    """Context manager to temporarily add directories to sys.path.
+
+    This makes a copy of sys.path, appends any directories given
+    as positional arguments, then reverts sys.path to the copied
+    settings when the context ends.
+
+    Note that *all* sys.path modifications in the body of the
+    context manager, including replacement of the object,
+    will be reverted at the end of the block.
+    """
+
+    def __init__(self, *paths):
+        self.original_value = sys.path[:]
+        self.original_object = sys.path
+        sys.path.extend(paths)
+
+    def __enter__(self):
+        return self
+
+    def __exit__(self, *ignore_exc):
+        sys.path = self.original_object
+        sys.path[:] = self.original_value
+
+
+def modules_setup():
+    return sys.modules.copy(),
+
+
+def modules_cleanup(oldmodules):
+    # Encoders/decoders are registered permanently within the internal
+    # codec cache. If we destroy the corresponding modules their
+    # globals will be set to None which will trip up the cached functions.
+    encodings = [(k, v) for k, v in sys.modules.items()
+                 if k.startswith('encodings.')]
+    sys.modules.clear()
+    sys.modules.update(encodings)
+    # XXX: This kind of problem can affect more than just encodings.
+    # In particular extension modules (such as _ssl) don't cope
+    # with reloading properly. Really, test modules should be cleaning
+    # out the test specific modules they know they added (ala test_runpy)
+    # rather than relying on this function (as test_importhooks and test_pkg
+    # do currently). Implicitly imported *real* modules should be left alone
+    # (see issue 10556).
+    sys.modules.update(oldmodules)
diff --git a/Lib/test/support/interpreters.py b/Lib/test/support/interpreters.py
new file mode 100644
index 0000000..2935708
--- /dev/null
+++ b/Lib/test/support/interpreters.py
@@ -0,0 +1,197 @@
+"""Subinterpreters High Level Module."""
+
+import time
+import _xxsubinterpreters as _interpreters
+
+# aliases:
+from _xxsubinterpreters import (
+    ChannelError, ChannelNotFoundError, ChannelEmptyError,
+    is_shareable,
+)
+
+
+__all__ = [
+    'Interpreter', 'get_current', 'get_main', 'create', 'list_all',
+    'SendChannel', 'RecvChannel',
+    'create_channel', 'list_all_channels', 'is_shareable',
+    'ChannelError', 'ChannelNotFoundError',
+    'ChannelEmptyError',
+    ]
+
+
+def create(*, isolated=True):
+    """Return a new (idle) Python interpreter."""
+    id = _interpreters.create(isolated=isolated)
+    return Interpreter(id, isolated=isolated)
+
+
+def list_all():
+    """Return all existing interpreters."""
+    return [Interpreter(id) for id in _interpreters.list_all()]
+
+
+def get_current():
+    """Return the currently running interpreter."""
+    id = _interpreters.get_current()
+    return Interpreter(id)
+
+
+def get_main():
+    """Return the main interpreter."""
+    id = _interpreters.get_main()
+    return Interpreter(id)
+
+
+class Interpreter:
+    """A single Python interpreter."""
+
+    def __init__(self, id, *, isolated=None):
+        if not isinstance(id, (int, _interpreters.InterpreterID)):
+            raise TypeError(f'id must be an int, got {id!r}')
+        self._id = id
+        self._isolated = isolated
+
+    def __repr__(self):
+        data = dict(id=int(self._id), isolated=self._isolated)
+        kwargs = (f'{k}={v!r}' for k, v in data.items())
+        return f'{type(self).__name__}({", ".join(kwargs)})'
+
+    def __hash__(self):
+        return hash(self._id)
+
+    def __eq__(self, other):
+        if not isinstance(other, Interpreter):
+            return NotImplemented
+        else:
+            return other._id == self._id
+
+    @property
+    def id(self):
+        return self._id
+
+    @property
+    def isolated(self):
+        if self._isolated is None:
+            # XXX The low-level function has not been added yet.
+            # See bpo-....
+            self._isolated = _interpreters.is_isolated(self._id)
+        return self._isolated
+
+    def is_running(self):
+        """Return whether or not the identified interpreter is running."""
+        return _interpreters.is_running(self._id)
+
+    def close(self):
+        """Finalize and destroy the interpreter.
+
+        Attempting to destroy the current interpreter results
+        in a RuntimeError.
+        """
+        return _interpreters.destroy(self._id)
+
+    def run(self, src_str, /, *, channels=None):
+        """Run the given source code in the interpreter.
+
+        This blocks the current Python thread until done.
+        """
+        _interpreters.run_string(self._id, src_str, channels)
+
+
+def create_channel():
+    """Return (recv, send) for a new cross-interpreter channel.
+
+    The channel may be used to pass data safely between interpreters.
+    """
+    cid = _interpreters.channel_create()
+    recv, send = RecvChannel(cid), SendChannel(cid)
+    return recv, send
+
+
+def list_all_channels():
+    """Return a list of (recv, send) for all open channels."""
+    return [(RecvChannel(cid), SendChannel(cid))
+            for cid in _interpreters.channel_list_all()]
+
+
+class _ChannelEnd:
+    """The base class for RecvChannel and SendChannel."""
+
+    def __init__(self, id):
+        if not isinstance(id, (int, _interpreters.ChannelID)):
+            raise TypeError(f'id must be an int, got {id!r}')
+        self._id = id
+
+    def __repr__(self):
+        return f'{type(self).__name__}(id={int(self._id)})'
+
+    def __hash__(self):
+        return hash(self._id)
+
+    def __eq__(self, other):
+        if isinstance(self, RecvChannel):
+            if not isinstance(other, RecvChannel):
+                return NotImplemented
+        elif not isinstance(other, SendChannel):
+            return NotImplemented
+        return other._id == self._id
+
+    @property
+    def id(self):
+        return self._id
+
+
+_NOT_SET = object()
+
+
+class RecvChannel(_ChannelEnd):
+    """The receiving end of a cross-interpreter channel."""
+
+    def recv(self, *, _sentinel=object(), _delay=10 / 1000):  # 10 milliseconds
+        """Return the next object from the channel.
+
+        This blocks until an object has been sent, if none have been
+        sent already.
+        """
+        obj = _interpreters.channel_recv(self._id, _sentinel)
+        while obj is _sentinel:
+            time.sleep(_delay)
+            obj = _interpreters.channel_recv(self._id, _sentinel)
+        return obj
+
+    def recv_nowait(self, default=_NOT_SET):
+        """Return the next object from the channel.
+
+        If none have been sent then return the default if one
+        is provided or fail with ChannelEmptyError.  Otherwise this
+        is the same as recv().
+        """
+        if default is _NOT_SET:
+            return _interpreters.channel_recv(self._id)
+        else:
+            return _interpreters.channel_recv(self._id, default)
+
+
+class SendChannel(_ChannelEnd):
+    """The sending end of a cross-interpreter channel."""
+
+    def send(self, obj):
+        """Send the object (i.e. its data) to the channel's receiving end.
+
+        This blocks until the object is received.
+        """
+        _interpreters.channel_send(self._id, obj)
+        # XXX We are missing a low-level channel_send_wait().
+        # See bpo-32604 and gh-19829.
+        # Until that shows up we fake it:
+        time.sleep(2)
+
+    def send_nowait(self, obj):
+        """Send the object to the channel's receiving end.
+
+        If the object is immediately received then return True
+        (else False).  Otherwise this is the same as send().
+        """
+        # XXX Note that at the moment channel_send() only ever returns
+        # None.  This should be fixed when channel_send_wait() is added.
+        # See bpo-32604 and gh-19829.
+        return _interpreters.channel_send(self._id, obj)
diff --git a/Lib/test/support/os_helper.py b/Lib/test/support/os_helper.py
new file mode 100644
index 0000000..82a6de7
--- /dev/null
+++ b/Lib/test/support/os_helper.py
@@ -0,0 +1,623 @@
+import collections.abc
+import contextlib
+import errno
+import os
+import re
+import stat
+import sys
+import time
+import unittest
+import warnings
+
+
+# Filename used for testing
+if os.name == 'java':
+    # Jython disallows @ in module names
+    TESTFN_ASCII = '$test'
+else:
+    TESTFN_ASCII = '@test'
+
+# Disambiguate TESTFN for parallel testing, while letting it remain a valid
+# module name.
+TESTFN_ASCII = "{}_{}_tmp".format(TESTFN_ASCII, os.getpid())
+
+# TESTFN_UNICODE is a non-ascii filename
+TESTFN_UNICODE = TESTFN_ASCII + "-\xe0\xf2\u0258\u0141\u011f"
+if sys.platform == 'darwin':
+    # In Mac OS X's VFS API file names are, by definition, canonically
+    # decomposed Unicode, encoded using UTF-8. See QA1173:
+    # http://developer.apple.com/mac/library/qa/qa2001/qa1173.html
+    import unicodedata
+    TESTFN_UNICODE = unicodedata.normalize('NFD', TESTFN_UNICODE)
+
+# TESTFN_UNENCODABLE is a filename (str type) that should *not* be able to be
+# encoded by the filesystem encoding (in strict mode). It can be None if we
+# cannot generate such filename.
+TESTFN_UNENCODABLE = None
+if os.name == 'nt':
+    # skip win32s (0) or Windows 9x/ME (1)
+    if sys.getwindowsversion().platform >= 2:
+        # Different kinds of characters from various languages to minimize the
+        # probability that the whole name is encodable to MBCS (issue #9819)
+        TESTFN_UNENCODABLE = TESTFN_ASCII + "-\u5171\u0141\u2661\u0363\uDC80"
+        try:
+            TESTFN_UNENCODABLE.encode(sys.getfilesystemencoding())
+        except UnicodeEncodeError:
+            pass
+        else:
+            print('WARNING: The filename %r CAN be encoded by the filesystem '
+                  'encoding (%s). Unicode filename tests may not be effective'
+                  % (TESTFN_UNENCODABLE, sys.getfilesystemencoding()))
+            TESTFN_UNENCODABLE = None
+# Mac OS X denies unencodable filenames (invalid utf-8)
+elif sys.platform != 'darwin':
+    try:
+        # ascii and utf-8 cannot encode the byte 0xff
+        b'\xff'.decode(sys.getfilesystemencoding())
+    except UnicodeDecodeError:
+        # 0xff will be encoded using the surrogate character u+DCFF
+        TESTFN_UNENCODABLE = TESTFN_ASCII \
+            + b'-\xff'.decode(sys.getfilesystemencoding(), 'surrogateescape')
+    else:
+        # File system encoding (eg. ISO-8859-* encodings) can encode
+        # the byte 0xff. Skip some unicode filename tests.
+        pass
+
+# FS_NONASCII: non-ASCII character encodable by os.fsencode(),
+# or an empty string if there is no such character.
+FS_NONASCII = ''
+for character in (
+    # First try printable and common characters to have a readable filename.
+    # For each character, the encoding list are just example of encodings able
+    # to encode the character (the list is not exhaustive).
+
+    # U+00E6 (Latin Small Letter Ae): cp1252, iso-8859-1
+    '\u00E6',
+    # U+0130 (Latin Capital Letter I With Dot Above): cp1254, iso8859_3
+    '\u0130',
+    # U+0141 (Latin Capital Letter L With Stroke): cp1250, cp1257
+    '\u0141',
+    # U+03C6 (Greek Small Letter Phi): cp1253
+    '\u03C6',
+    # U+041A (Cyrillic Capital Letter Ka): cp1251
+    '\u041A',
+    # U+05D0 (Hebrew Letter Alef): Encodable to cp424
+    '\u05D0',
+    # U+060C (Arabic Comma): cp864, cp1006, iso8859_6, mac_arabic
+    '\u060C',
+    # U+062A (Arabic Letter Teh): cp720
+    '\u062A',
+    # U+0E01 (Thai Character Ko Kai): cp874
+    '\u0E01',
+
+    # Then try more "special" characters. "special" because they may be
+    # interpreted or displayed differently depending on the exact locale
+    # encoding and the font.
+
+    # U+00A0 (No-Break Space)
+    '\u00A0',
+    # U+20AC (Euro Sign)
+    '\u20AC',
+):
+    try:
+        # If Python is set up to use the legacy 'mbcs' in Windows,
+        # 'replace' error mode is used, and encode() returns b'?'
+        # for characters missing in the ANSI codepage
+        if os.fsdecode(os.fsencode(character)) != character:
+            raise UnicodeError
+    except UnicodeError:
+        pass
+    else:
+        FS_NONASCII = character
+        break
+
+# Save the initial cwd
+SAVEDCWD = os.getcwd()
+
+# TESTFN_UNDECODABLE is a filename (bytes type) that should *not* be able to be
+# decoded from the filesystem encoding (in strict mode). It can be None if we
+# cannot generate such filename (ex: the latin1 encoding can decode any byte
+# sequence). On UNIX, TESTFN_UNDECODABLE can be decoded by os.fsdecode() thanks
+# to the surrogateescape error handler (PEP 383), but not from the filesystem
+# encoding in strict mode.
+TESTFN_UNDECODABLE = None
+for name in (
+    # b'\xff' is not decodable by os.fsdecode() with code page 932. Windows
+    # accepts it to create a file or a directory, or don't accept to enter to
+    # such directory (when the bytes name is used). So test b'\xe7' first:
+    # it is not decodable from cp932.
+    b'\xe7w\xf0',
+    # undecodable from ASCII, UTF-8
+    b'\xff',
+    # undecodable from iso8859-3, iso8859-6, iso8859-7, cp424, iso8859-8, cp856
+    # and cp857
+    b'\xae\xd5'
+    # undecodable from UTF-8 (UNIX and Mac OS X)
+    b'\xed\xb2\x80', b'\xed\xb4\x80',
+    # undecodable from shift_jis, cp869, cp874, cp932, cp1250, cp1251, cp1252,
+    # cp1253, cp1254, cp1255, cp1257, cp1258
+    b'\x81\x98',
+):
+    try:
+        name.decode(sys.getfilesystemencoding())
+    except UnicodeDecodeError:
+        TESTFN_UNDECODABLE = os.fsencode(TESTFN_ASCII) + name
+        break
+
+if FS_NONASCII:
+    TESTFN_NONASCII = TESTFN_ASCII + FS_NONASCII
+else:
+    TESTFN_NONASCII = None
+TESTFN = TESTFN_NONASCII or TESTFN_ASCII
+
+
+def make_bad_fd():
+    """
+    Create an invalid file descriptor by opening and closing a file and return
+    its fd.
+    """
+    file = open(TESTFN, "wb")
+    try:
+        return file.fileno()
+    finally:
+        file.close()
+        unlink(TESTFN)
+
+
+_can_symlink = None
+
+
+def can_symlink():
+    global _can_symlink
+    if _can_symlink is not None:
+        return _can_symlink
+    symlink_path = TESTFN + "can_symlink"
+    try:
+        os.symlink(TESTFN, symlink_path)
+        can = True
+    except (OSError, NotImplementedError, AttributeError):
+        can = False
+    else:
+        os.remove(symlink_path)
+    _can_symlink = can
+    return can
+
+
+def skip_unless_symlink(test):
+    """Skip decorator for tests that require functional symlink"""
+    ok = can_symlink()
+    msg = "Requires functional symlink implementation"
+    return test if ok else unittest.skip(msg)(test)
+
+
+_can_xattr = None
+
+
+def can_xattr():
+    import tempfile
+    global _can_xattr
+    if _can_xattr is not None:
+        return _can_xattr
+    if not hasattr(os, "setxattr"):
+        can = False
+    else:
+        import platform
+        tmp_dir = tempfile.mkdtemp()
+        tmp_fp, tmp_name = tempfile.mkstemp(dir=tmp_dir)
+        try:
+            with open(TESTFN, "wb") as fp:
+                try:
+                    # TESTFN & tempfile may use different file systems with
+                    # different capabilities
+                    os.setxattr(tmp_fp, b"user.test", b"")
+                    os.setxattr(tmp_name, b"trusted.foo", b"42")
+                    os.setxattr(fp.fileno(), b"user.test", b"")
+                    # Kernels < 2.6.39 don't respect setxattr flags.
+                    kernel_version = platform.release()
+                    m = re.match(r"2.6.(\d{1,2})", kernel_version)
+                    can = m is None or int(m.group(1)) >= 39
+                except OSError:
+                    can = False
+        finally:
+            unlink(TESTFN)
+            unlink(tmp_name)
+            rmdir(tmp_dir)
+    _can_xattr = can
+    return can
+
+
+def skip_unless_xattr(test):
+    """Skip decorator for tests that require functional extended attributes"""
+    ok = can_xattr()
+    msg = "no non-broken extended attribute support"
+    return test if ok else unittest.skip(msg)(test)
+
+
+def unlink(filename):
+    try:
+        _unlink(filename)
+    except (FileNotFoundError, NotADirectoryError):
+        pass
+
+
+if sys.platform.startswith("win"):
+    def _waitfor(func, pathname, waitall=False):
+        # Perform the operation
+        func(pathname)
+        # Now setup the wait loop
+        if waitall:
+            dirname = pathname
+        else:
+            dirname, name = os.path.split(pathname)
+            dirname = dirname or '.'
+        # Check for `pathname` to be removed from the filesystem.
+        # The exponential backoff of the timeout amounts to a total
+        # of ~1 second after which the deletion is probably an error
+        # anyway.
+        # Testing on an i7@4.3GHz shows that usually only 1 iteration is
+        # required when contention occurs.
+        timeout = 0.001
+        while timeout < 1.0:
+            # Note we are only testing for the existence of the file(s) in
+            # the contents of the directory regardless of any security or
+            # access rights.  If we have made it this far, we have sufficient
+            # permissions to do that much using Python's equivalent of the
+            # Windows API FindFirstFile.
+            # Other Windows APIs can fail or give incorrect results when
+            # dealing with files that are pending deletion.
+            L = os.listdir(dirname)
+            if not (L if waitall else name in L):
+                return
+            # Increase the timeout and try again
+            time.sleep(timeout)
+            timeout *= 2
+        warnings.warn('tests may fail, delete still pending for ' + pathname,
+                      RuntimeWarning, stacklevel=4)
+
+    def _unlink(filename):
+        _waitfor(os.unlink, filename)
+
+    def _rmdir(dirname):
+        _waitfor(os.rmdir, dirname)
+
+    def _rmtree(path):
+        from test.support import _force_run
+
+        def _rmtree_inner(path):
+            for name in _force_run(path, os.listdir, path):
+                fullname = os.path.join(path, name)
+                try:
+                    mode = os.lstat(fullname).st_mode
+                except OSError as exc:
+                    print("support.rmtree(): os.lstat(%r) failed with %s"
+                          % (fullname, exc),
+                          file=sys.__stderr__)
+                    mode = 0
+                if stat.S_ISDIR(mode):
+                    _waitfor(_rmtree_inner, fullname, waitall=True)
+                    _force_run(fullname, os.rmdir, fullname)
+                else:
+                    _force_run(fullname, os.unlink, fullname)
+        _waitfor(_rmtree_inner, path, waitall=True)
+        _waitfor(lambda p: _force_run(p, os.rmdir, p), path)
+
+    def _longpath(path):
+        try:
+            import ctypes
+        except ImportError:
+            # No ctypes means we can't expands paths.
+            pass
+        else:
+            buffer = ctypes.create_unicode_buffer(len(path) * 2)
+            length = ctypes.windll.kernel32.GetLongPathNameW(path, buffer,
+                                                             len(buffer))
+            if length:
+                return buffer[:length]
+        return path
+else:
+    _unlink = os.unlink
+    _rmdir = os.rmdir
+
+    def _rmtree(path):
+        import shutil
+        try:
+            shutil.rmtree(path)
+            return
+        except OSError:
+            pass
+
+        def _rmtree_inner(path):
+            from test.support import _force_run
+            for name in _force_run(path, os.listdir, path):
+                fullname = os.path.join(path, name)
+                try:
+                    mode = os.lstat(fullname).st_mode
+                except OSError:
+                    mode = 0
+                if stat.S_ISDIR(mode):
+                    _rmtree_inner(fullname)
+                    _force_run(path, os.rmdir, fullname)
+                else:
+                    _force_run(path, os.unlink, fullname)
+        _rmtree_inner(path)
+        os.rmdir(path)
+
+    def _longpath(path):
+        return path
+
+
+def rmdir(dirname):
+    try:
+        _rmdir(dirname)
+    except FileNotFoundError:
+        pass
+
+
+def rmtree(path):
+    try:
+        _rmtree(path)
+    except FileNotFoundError:
+        pass
+
+
+@contextlib.contextmanager
+def temp_dir(path=None, quiet=False):
+    """Return a context manager that creates a temporary directory.
+
+    Arguments:
+
+      path: the directory to create temporarily.  If omitted or None,
+        defaults to creating a temporary directory using tempfile.mkdtemp.
+
+      quiet: if False (the default), the context manager raises an exception
+        on error.  Otherwise, if the path is specified and cannot be
+        created, only a warning is issued.
+
+    """
+    import tempfile
+    dir_created = False
+    if path is None:
+        path = tempfile.mkdtemp()
+        dir_created = True
+        path = os.path.realpath(path)
+    else:
+        try:
+            os.mkdir(path)
+            dir_created = True
+        except OSError as exc:
+            if not quiet:
+                raise
+            warnings.warn(f'tests may fail, unable to create '
+                          f'temporary directory {path!r}: {exc}',
+                          RuntimeWarning, stacklevel=3)
+    if dir_created:
+        pid = os.getpid()
+    try:
+        yield path
+    finally:
+        # In case the process forks, let only the parent remove the
+        # directory. The child has a different process id. (bpo-30028)
+        if dir_created and pid == os.getpid():
+            rmtree(path)
+
+
+@contextlib.contextmanager
+def change_cwd(path, quiet=False):
+    """Return a context manager that changes the current working directory.
+
+    Arguments:
+
+      path: the directory to use as the temporary current working directory.
+
+      quiet: if False (the default), the context manager raises an exception
+        on error.  Otherwise, it issues only a warning and keeps the current
+        working directory the same.
+
+    """
+    saved_dir = os.getcwd()
+    try:
+        os.chdir(os.path.realpath(path))
+    except OSError as exc:
+        if not quiet:
+            raise
+        warnings.warn(f'tests may fail, unable to change the current working '
+                      f'directory to {path!r}: {exc}',
+                      RuntimeWarning, stacklevel=3)
+    try:
+        yield os.getcwd()
+    finally:
+        os.chdir(saved_dir)
+
+
+@contextlib.contextmanager
+def temp_cwd(name='tempcwd', quiet=False):
+    """
+    Context manager that temporarily creates and changes the CWD.
+
+    The function temporarily changes the current working directory
+    after creating a temporary directory in the current directory with
+    name *name*.  If *name* is None, the temporary directory is
+    created using tempfile.mkdtemp.
+
+    If *quiet* is False (default) and it is not possible to
+    create or change the CWD, an error is raised.  If *quiet* is True,
+    only a warning is raised and the original CWD is used.
+
+    """
+    with temp_dir(path=name, quiet=quiet) as temp_path:
+        with change_cwd(temp_path, quiet=quiet) as cwd_dir:
+            yield cwd_dir
+
+
+def create_empty_file(filename):
+    """Create an empty file. If the file already exists, truncate it."""
+    fd = os.open(filename, os.O_WRONLY | os.O_CREAT | os.O_TRUNC)
+    os.close(fd)
+
+
+@contextlib.contextmanager
+def open_dir_fd(path):
+    """Open a file descriptor to a directory."""
+    assert os.path.isdir(path)
+    dir_fd = os.open(path, os.O_RDONLY)
+    try:
+        yield dir_fd
+    finally:
+        os.close(dir_fd)
+
+
+def fs_is_case_insensitive(directory):
+    """Detects if the file system for the specified directory
+    is case-insensitive."""
+    import tempfile
+    with tempfile.NamedTemporaryFile(dir=directory) as base:
+        base_path = base.name
+        case_path = base_path.upper()
+        if case_path == base_path:
+            case_path = base_path.lower()
+        try:
+            return os.path.samefile(base_path, case_path)
+        except FileNotFoundError:
+            return False
+
+
+class FakePath:
+    """Simple implementing of the path protocol.
+    """
+    def __init__(self, path):
+        self.path = path
+
+    def __repr__(self):
+        return f'<FakePath {self.path!r}>'
+
+    def __fspath__(self):
+        if (isinstance(self.path, BaseException) or
+            isinstance(self.path, type) and
+                issubclass(self.path, BaseException)):
+            raise self.path
+        else:
+            return self.path
+
+
+def fd_count():
+    """Count the number of open file descriptors.
+    """
+    if sys.platform.startswith(('linux', 'freebsd')):
+        try:
+            names = os.listdir("/proc/self/fd")
+            # Subtract one because listdir() internally opens a file
+            # descriptor to list the content of the /proc/self/fd/ directory.
+            return len(names) - 1
+        except FileNotFoundError:
+            pass
+
+    MAXFD = 256
+    if hasattr(os, 'sysconf'):
+        try:
+            MAXFD = os.sysconf("SC_OPEN_MAX")
+        except OSError:
+            pass
+
+    old_modes = None
+    if sys.platform == 'win32':
+        # bpo-25306, bpo-31009: Call CrtSetReportMode() to not kill the process
+        # on invalid file descriptor if Python is compiled in debug mode
+        try:
+            import msvcrt
+            msvcrt.CrtSetReportMode
+        except (AttributeError, ImportError):
+            # no msvcrt or a release build
+            pass
+        else:
+            old_modes = {}
+            for report_type in (msvcrt.CRT_WARN,
+                                msvcrt.CRT_ERROR,
+                                msvcrt.CRT_ASSERT):
+                old_modes[report_type] = msvcrt.CrtSetReportMode(report_type,
+                                                                 0)
+
+    try:
+        count = 0
+        for fd in range(MAXFD):
+            try:
+                # Prefer dup() over fstat(). fstat() can require input/output
+                # whereas dup() doesn't.
+                fd2 = os.dup(fd)
+            except OSError as e:
+                if e.errno != errno.EBADF:
+                    raise
+            else:
+                os.close(fd2)
+                count += 1
+    finally:
+        if old_modes is not None:
+            for report_type in (msvcrt.CRT_WARN,
+                                msvcrt.CRT_ERROR,
+                                msvcrt.CRT_ASSERT):
+                msvcrt.CrtSetReportMode(report_type, old_modes[report_type])
+
+    return count
+
+
+if hasattr(os, "umask"):
+    @contextlib.contextmanager
+    def temp_umask(umask):
+        """Context manager that temporarily sets the process umask."""
+        oldmask = os.umask(umask)
+        try:
+            yield
+        finally:
+            os.umask(oldmask)
+
+
+class EnvironmentVarGuard(collections.abc.MutableMapping):
+
+    """Class to help protect the environment variable properly.  Can be used as
+    a context manager."""
+
+    def __init__(self):
+        self._environ = os.environ
+        self._changed = {}
+
+    def __getitem__(self, envvar):
+        return self._environ[envvar]
+
+    def __setitem__(self, envvar, value):
+        # Remember the initial value on the first access
+        if envvar not in self._changed:
+            self._changed[envvar] = self._environ.get(envvar)
+        self._environ[envvar] = value
+
+    def __delitem__(self, envvar):
+        # Remember the initial value on the first access
+        if envvar not in self._changed:
+            self._changed[envvar] = self._environ.get(envvar)
+        if envvar in self._environ:
+            del self._environ[envvar]
+
+    def keys(self):
+        return self._environ.keys()
+
+    def __iter__(self):
+        return iter(self._environ)
+
+    def __len__(self):
+        return len(self._environ)
+
+    def set(self, envvar, value):
+        self[envvar] = value
+
+    def unset(self, envvar):
+        del self[envvar]
+
+    def __enter__(self):
+        return self
+
+    def __exit__(self, *ignore_exc):
+        for (k, v) in self._changed.items():
+            if v is None:
+                if k in self._environ:
+                    del self._environ[k]
+            else:
+                self._environ[k] = v
+        os.environ = self._environ
diff --git a/Lib/test/support/script_helper.py b/Lib/test/support/script_helper.py
index 37e576d..6d699c8 100644
--- a/Lib/test/support/script_helper.py
+++ b/Lib/test/support/script_helper.py
@@ -11,12 +11,14 @@
 import zipfile
 
 from importlib.util import source_from_cache
-from test.support import make_legacy_pyc
+from test import support
+from test.support.import_helper import make_legacy_pyc
 
 
 # Cached result of the expensive test performed in the function below.
 __cached_interp_requires_environment = None
 
+
 def interpreter_requires_environment():
     """
     Returns True if our sys.executable interpreter requires environment
@@ -136,12 +138,14 @@
     rc = proc.returncode
     return _PythonRunResult(rc, out, err), cmd_line
 
+
 def _assert_python(expected_success, /, *args, **env_vars):
     res, cmd_line = run_python_until_end(*args, **env_vars)
     if (res.rc and expected_success) or (not res.rc and not expected_success):
         res.fail(cmd_line)
     return res
 
+
 def assert_python_ok(*args, **env_vars):
     """
     Assert that running the interpreter with `args` and optional environment
@@ -155,6 +159,7 @@
     """
     return _assert_python(True, *args, **env_vars)
 
+
 def assert_python_failure(*args, **env_vars):
     """
     Assert that running the interpreter with `args` and optional environment
@@ -165,6 +170,7 @@
     """
     return _assert_python(False, *args, **env_vars)
 
+
 def spawn_python(*args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, **kw):
     """Run a Python subprocess with the given arguments.
 
@@ -187,6 +193,7 @@
                             stdout=stdout, stderr=stderr,
                             **kw)
 
+
 def kill_python(p):
     """Run the given Popen process until completion and return stdout."""
     p.stdin.close()
@@ -198,6 +205,7 @@
     subprocess._cleanup()
     return data
 
+
 def make_script(script_dir, script_basename, source, omit_suffix=False):
     script_filename = script_basename
     if not omit_suffix:
@@ -209,6 +217,7 @@
     importlib.invalidate_caches()
     return script_name
 
+
 def make_zip_script(zip_dir, zip_basename, script_name, name_in_zip=None):
     zip_filename = zip_basename+os.extsep+'zip'
     zip_name = os.path.join(zip_dir, zip_filename)
@@ -228,10 +237,12 @@
     #        zip_file.printdir()
     return zip_name, os.path.join(zip_name, name_in_zip)
 
+
 def make_pkg(pkg_dir, init_source=''):
     os.mkdir(pkg_dir)
     make_script(pkg_dir, '__init__', init_source)
 
+
 def make_zip_pkg(zip_dir, zip_basename, pkg_name, script_basename,
                  source, depth=1, compiled=False):
     unlink = []
@@ -260,3 +271,24 @@
     #        print 'Contents of %r:' % zip_name
     #        zip_file.printdir()
     return zip_name, os.path.join(zip_name, script_name_in_zip)
+
+
+def run_test_script(script):
+    # use -u to try to get the full output if the test hangs or crash
+    if support.verbose:
+        def title(text):
+            return f"===== {text} ======"
+
+        name = f"script {os.path.basename(script)}"
+        print()
+        print(title(name), flush=True)
+        # In verbose mode, the child process inherit stdout and stdout,
+        # to see output in realtime and reduce the risk of losing output.
+        args = [sys.executable, "-E", "-X", "faulthandler", "-u", script, "-v"]
+        proc = subprocess.run(args)
+        print(title(f"{name} completed: exit code {proc.returncode}"),
+              flush=True)
+        if proc.returncode:
+            raise AssertionError(f"{name} failed")
+    else:
+        assert_python_ok("-u", script, "-v")
diff --git a/Lib/test/support/socket_helper.py b/Lib/test/support/socket_helper.py
index f709ffd..b516773 100644
--- a/Lib/test/support/socket_helper.py
+++ b/Lib/test/support/socket_helper.py
@@ -146,7 +146,7 @@
         return unittest.skip('No UNIX Sockets')(test)
     global _bind_nix_socket_error
     if _bind_nix_socket_error is None:
-        from test.support import TESTFN, unlink
+        from .os_helper import TESTFN, unlink
         path = TESTFN + "can_bind_unix_socket"
         with socket.socket(socket.AF_UNIX) as sock:
             try:
@@ -189,7 +189,7 @@
 @contextlib.contextmanager
 def transient_internet(resource_name, *, timeout=_NOT_SET, errnos=()):
     """Return a context manager that raises ResourceDenied when various issues
-    with the Internet connection manifest themselves as exceptions."""
+    with the internet connection manifest themselves as exceptions."""
     import nntplib
     import urllib.error
     if timeout is _NOT_SET:
@@ -225,7 +225,7 @@
 
     def filter_error(err):
         n = getattr(err, 'errno', None)
-        if (isinstance(err, socket.timeout) or
+        if (isinstance(err, TimeoutError) or
             (isinstance(err, socket.gaierror) and n in gai_errnos) or
             (isinstance(err, urllib.error.HTTPError) and
              500 <= err.code <= 599) or
diff --git a/Lib/test/support/testresult.py b/Lib/test/support/testresult.py
index 67e126d..6f2edda 100644
--- a/Lib/test/support/testresult.py
+++ b/Lib/test/support/testresult.py
@@ -9,24 +9,21 @@
 import traceback
 import unittest
 
-import xml.etree.ElementTree as ET
-
-from datetime import datetime
-
 class RegressionTestResult(unittest.TextTestResult):
-    separator1 = '=' * 70 + '\n'
-    separator2 = '-' * 70 + '\n'
+    USE_XML = False
 
     def __init__(self, stream, descriptions, verbosity):
-        super().__init__(stream=stream, descriptions=descriptions, verbosity=0)
+        super().__init__(stream=stream, descriptions=descriptions,
+                         verbosity=2 if verbosity else 0)
         self.buffer = True
-        self.__suite = ET.Element('testsuite')
-        self.__suite.set('start', datetime.utcnow().isoformat(' '))
-
-        self.__e = None
+        if self.USE_XML:
+            from xml.etree import ElementTree as ET
+            from datetime import datetime
+            self.__ET = ET
+            self.__suite = ET.Element('testsuite')
+            self.__suite.set('start', datetime.utcnow().isoformat(' '))
+            self.__e = None
         self.__start_time = None
-        self.__results = []
-        self.__verbose = bool(verbosity)
 
     @classmethod
     def __getId(cls, test):
@@ -42,17 +39,19 @@
 
     def startTest(self, test):
         super().startTest(test)
-        self.__e = e = ET.SubElement(self.__suite, 'testcase')
+        if self.USE_XML:
+            self.__e = e = self.__ET.SubElement(self.__suite, 'testcase')
         self.__start_time = time.perf_counter()
-        if self.__verbose:
-            self.stream.write(f'{self.getDescription(test)} ... ')
-            self.stream.flush()
 
     def _add_result(self, test, capture=False, **args):
+        if not self.USE_XML:
+            return
         e = self.__e
         self.__e = None
         if e is None:
             return
+        ET = self.__ET
+
         e.set('name', args.pop('name', self.__getId(test)))
         e.set('status', args.pop('status', 'run'))
         e.set('result', args.pop('result', 'completed'))
@@ -80,10 +79,6 @@
             else:
                 e2.text = str(v)
 
-    def __write(self, c, word):
-        if self.__verbose:
-            self.stream.write(f'{word}\n')
-
     @classmethod
     def __makeErrorDict(cls, err_type, err_value, err_tb):
         if isinstance(err_type, type):
@@ -106,47 +101,30 @@
     def addError(self, test, err):
         self._add_result(test, True, error=self.__makeErrorDict(*err))
         super().addError(test, err)
-        self.__write('E', 'ERROR')
 
     def addExpectedFailure(self, test, err):
         self._add_result(test, True, output=self.__makeErrorDict(*err))
         super().addExpectedFailure(test, err)
-        self.__write('x', 'expected failure')
 
     def addFailure(self, test, err):
         self._add_result(test, True, failure=self.__makeErrorDict(*err))
         super().addFailure(test, err)
-        self.__write('F', 'FAIL')
 
     def addSkip(self, test, reason):
         self._add_result(test, skipped=reason)
         super().addSkip(test, reason)
-        self.__write('S', f'skipped {reason!r}')
 
     def addSuccess(self, test):
         self._add_result(test)
         super().addSuccess(test)
-        self.__write('.', 'ok')
 
     def addUnexpectedSuccess(self, test):
         self._add_result(test, outcome='UNEXPECTED_SUCCESS')
         super().addUnexpectedSuccess(test)
-        self.__write('u', 'unexpected success')
-
-    def printErrors(self):
-        if self.__verbose:
-            self.stream.write('\n')
-        self.printErrorList('ERROR', self.errors)
-        self.printErrorList('FAIL', self.failures)
-
-    def printErrorList(self, flavor, errors):
-        for test, err in errors:
-            self.stream.write(self.separator1)
-            self.stream.write(f'{flavor}: {self.getDescription(test)}\n')
-            self.stream.write(self.separator2)
-            self.stream.write('%s\n' % err)
 
     def get_xml_element(self):
+        if not self.USE_XML:
+            raise ValueError("USE_XML is false")
         e = self.__suite
         e.set('tests', str(self.testsRun))
         e.set('errors', str(len(self.errors)))
@@ -174,6 +152,9 @@
     return get_test_runner_class(verbosity, capture_output)(stream)
 
 if __name__ == '__main__':
+    import xml.etree.ElementTree as ET
+    RegressionTestResult.USE_XML = True
+
     class TestTests(unittest.TestCase):
         def test_pass(self):
             pass
diff --git a/Lib/test/support/threading_helper.py b/Lib/test/support/threading_helper.py
new file mode 100644
index 0000000..92a64e8
--- /dev/null
+++ b/Lib/test/support/threading_helper.py
@@ -0,0 +1,209 @@
+import _thread
+import contextlib
+import functools
+import sys
+import threading
+import time
+
+from test import support
+
+
+#=======================================================================
+# Threading support to prevent reporting refleaks when running regrtest.py -R
+
+# NOTE: we use thread._count() rather than threading.enumerate() (or the
+# moral equivalent thereof) because a threading.Thread object is still alive
+# until its __bootstrap() method has returned, even after it has been
+# unregistered from the threading module.
+# thread._count(), on the other hand, only gets decremented *after* the
+# __bootstrap() method has returned, which gives us reliable reference counts
+# at the end of a test run.
+
+
+def threading_setup():
+    return _thread._count(), threading._dangling.copy()
+
+
+def threading_cleanup(*original_values):
+    _MAX_COUNT = 100
+
+    for count in range(_MAX_COUNT):
+        values = _thread._count(), threading._dangling
+        if values == original_values:
+            break
+
+        if not count:
+            # Display a warning at the first iteration
+            support.environment_altered = True
+            dangling_threads = values[1]
+            support.print_warning(f"threading_cleanup() failed to cleanup "
+                                  f"{values[0] - original_values[0]} threads "
+                                  f"(count: {values[0]}, "
+                                  f"dangling: {len(dangling_threads)})")
+            for thread in dangling_threads:
+                support.print_warning(f"Dangling thread: {thread!r}")
+
+            # Don't hold references to threads
+            dangling_threads = None
+        values = None
+
+        time.sleep(0.01)
+        support.gc_collect()
+
+
+def reap_threads(func):
+    """Use this function when threads are being used.  This will
+    ensure that the threads are cleaned up even when the test fails.
+    """
+    @functools.wraps(func)
+    def decorator(*args):
+        key = threading_setup()
+        try:
+            return func(*args)
+        finally:
+            threading_cleanup(*key)
+    return decorator
+
+
+@contextlib.contextmanager
+def wait_threads_exit(timeout=None):
+    """
+    bpo-31234: Context manager to wait until all threads created in the with
+    statement exit.
+
+    Use _thread.count() to check if threads exited. Indirectly, wait until
+    threads exit the internal t_bootstrap() C function of the _thread module.
+
+    threading_setup() and threading_cleanup() are designed to emit a warning
+    if a test leaves running threads in the background. This context manager
+    is designed to cleanup threads started by the _thread.start_new_thread()
+    which doesn't allow to wait for thread exit, whereas thread.Thread has a
+    join() method.
+    """
+    if timeout is None:
+        timeout = support.SHORT_TIMEOUT
+    old_count = _thread._count()
+    try:
+        yield
+    finally:
+        start_time = time.monotonic()
+        deadline = start_time + timeout
+        while True:
+            count = _thread._count()
+            if count <= old_count:
+                break
+            if time.monotonic() > deadline:
+                dt = time.monotonic() - start_time
+                msg = (f"wait_threads() failed to cleanup {count - old_count} "
+                       f"threads after {dt:.1f} seconds "
+                       f"(count: {count}, old count: {old_count})")
+                raise AssertionError(msg)
+            time.sleep(0.010)
+            support.gc_collect()
+
+
+def join_thread(thread, timeout=None):
+    """Join a thread. Raise an AssertionError if the thread is still alive
+    after timeout seconds.
+    """
+    if timeout is None:
+        timeout = support.SHORT_TIMEOUT
+    thread.join(timeout)
+    if thread.is_alive():
+        msg = f"failed to join the thread in {timeout:.1f} seconds"
+        raise AssertionError(msg)
+
+
+@contextlib.contextmanager
+def start_threads(threads, unlock=None):
+    import faulthandler
+    threads = list(threads)
+    started = []
+    try:
+        try:
+            for t in threads:
+                t.start()
+                started.append(t)
+        except:
+            if support.verbose:
+                print("Can't start %d threads, only %d threads started" %
+                      (len(threads), len(started)))
+            raise
+        yield
+    finally:
+        try:
+            if unlock:
+                unlock()
+            endtime = time.monotonic()
+            for timeout in range(1, 16):
+                endtime += 60
+                for t in started:
+                    t.join(max(endtime - time.monotonic(), 0.01))
+                started = [t for t in started if t.is_alive()]
+                if not started:
+                    break
+                if support.verbose:
+                    print('Unable to join %d threads during a period of '
+                          '%d minutes' % (len(started), timeout))
+        finally:
+            started = [t for t in started if t.is_alive()]
+            if started:
+                faulthandler.dump_traceback(sys.stdout)
+                raise AssertionError('Unable to join %d threads' % len(started))
+
+
+class catch_threading_exception:
+    """
+    Context manager catching threading.Thread exception using
+    threading.excepthook.
+
+    Attributes set when an exception is caught:
+
+    * exc_type
+    * exc_value
+    * exc_traceback
+    * thread
+
+    See threading.excepthook() documentation for these attributes.
+
+    These attributes are deleted at the context manager exit.
+
+    Usage:
+
+        with threading_helper.catch_threading_exception() as cm:
+            # code spawning a thread which raises an exception
+            ...
+
+            # check the thread exception, use cm attributes:
+            # exc_type, exc_value, exc_traceback, thread
+            ...
+
+        # exc_type, exc_value, exc_traceback, thread attributes of cm no longer
+        # exists at this point
+        # (to avoid reference cycles)
+    """
+
+    def __init__(self):
+        self.exc_type = None
+        self.exc_value = None
+        self.exc_traceback = None
+        self.thread = None
+        self._old_hook = None
+
+    def _hook(self, args):
+        self.exc_type = args.exc_type
+        self.exc_value = args.exc_value
+        self.exc_traceback = args.exc_traceback
+        self.thread = args.thread
+
+    def __enter__(self):
+        self._old_hook = threading.excepthook
+        threading.excepthook = self._hook
+        return self
+
+    def __exit__(self, *exc_info):
+        threading.excepthook = self._old_hook
+        del self.exc_type
+        del self.exc_value
+        del self.exc_traceback
+        del self.thread
diff --git a/Lib/test/support/warnings_helper.py b/Lib/test/support/warnings_helper.py
new file mode 100644
index 0000000..a024fbe
--- /dev/null
+++ b/Lib/test/support/warnings_helper.py
@@ -0,0 +1,199 @@
+import contextlib
+import functools
+import re
+import sys
+import warnings
+
+
+def check_syntax_warning(testcase, statement, errtext='',
+                         *, lineno=1, offset=None):
+    # Test also that a warning is emitted only once.
+    from test.support import check_syntax_error
+    with warnings.catch_warnings(record=True) as warns:
+        warnings.simplefilter('always', SyntaxWarning)
+        compile(statement, '<testcase>', 'exec')
+    testcase.assertEqual(len(warns), 1, warns)
+
+    warn, = warns
+    testcase.assertTrue(issubclass(warn.category, SyntaxWarning),
+                        warn.category)
+    if errtext:
+        testcase.assertRegex(str(warn.message), errtext)
+    testcase.assertEqual(warn.filename, '<testcase>')
+    testcase.assertIsNotNone(warn.lineno)
+    if lineno is not None:
+        testcase.assertEqual(warn.lineno, lineno)
+
+    # SyntaxWarning should be converted to SyntaxError when raised,
+    # since the latter contains more information and provides better
+    # error report.
+    with warnings.catch_warnings(record=True) as warns:
+        warnings.simplefilter('error', SyntaxWarning)
+        check_syntax_error(testcase, statement, errtext,
+                           lineno=lineno, offset=offset)
+    # No warnings are leaked when a SyntaxError is raised.
+    testcase.assertEqual(warns, [])
+
+
+def ignore_warnings(*, category):
+    """Decorator to suppress deprecation warnings.
+
+    Use of context managers to hide warnings make diffs
+    more noisy and tools like 'git blame' less useful.
+    """
+    def decorator(test):
+        @functools.wraps(test)
+        def wrapper(self, *args, **kwargs):
+            with warnings.catch_warnings():
+                warnings.simplefilter('ignore', category=category)
+                return test(self, *args, **kwargs)
+        return wrapper
+    return decorator
+
+
+class WarningsRecorder(object):
+    """Convenience wrapper for the warnings list returned on
+       entry to the warnings.catch_warnings() context manager.
+    """
+    def __init__(self, warnings_list):
+        self._warnings = warnings_list
+        self._last = 0
+
+    def __getattr__(self, attr):
+        if len(self._warnings) > self._last:
+            return getattr(self._warnings[-1], attr)
+        elif attr in warnings.WarningMessage._WARNING_DETAILS:
+            return None
+        raise AttributeError("%r has no attribute %r" % (self, attr))
+
+    @property
+    def warnings(self):
+        return self._warnings[self._last:]
+
+    def reset(self):
+        self._last = len(self._warnings)
+
+
+@contextlib.contextmanager
+def check_warnings(*filters, **kwargs):
+    """Context manager to silence warnings.
+
+    Accept 2-tuples as positional arguments:
+        ("message regexp", WarningCategory)
+
+    Optional argument:
+     - if 'quiet' is True, it does not fail if a filter catches nothing
+        (default True without argument,
+         default False if some filters are defined)
+
+    Without argument, it defaults to:
+        check_warnings(("", Warning), quiet=True)
+    """
+    quiet = kwargs.get('quiet')
+    if not filters:
+        filters = (("", Warning),)
+        # Preserve backward compatibility
+        if quiet is None:
+            quiet = True
+    return _filterwarnings(filters, quiet)
+
+
+@contextlib.contextmanager
+def check_no_warnings(testcase, message='', category=Warning, force_gc=False):
+    """Context manager to check that no warnings are emitted.
+
+    This context manager enables a given warning within its scope
+    and checks that no warnings are emitted even with that warning
+    enabled.
+
+    If force_gc is True, a garbage collection is attempted before checking
+    for warnings. This may help to catch warnings emitted when objects
+    are deleted, such as ResourceWarning.
+
+    Other keyword arguments are passed to warnings.filterwarnings().
+    """
+    from test.support import gc_collect
+    with warnings.catch_warnings(record=True) as warns:
+        warnings.filterwarnings('always',
+                                message=message,
+                                category=category)
+        yield
+        if force_gc:
+            gc_collect()
+    testcase.assertEqual(warns, [])
+
+
+@contextlib.contextmanager
+def check_no_resource_warning(testcase):
+    """Context manager to check that no ResourceWarning is emitted.
+
+    Usage:
+
+        with check_no_resource_warning(self):
+            f = open(...)
+            ...
+            del f
+
+    You must remove the object which may emit ResourceWarning before
+    the end of the context manager.
+    """
+    with check_no_warnings(testcase, category=ResourceWarning, force_gc=True):
+        yield
+
+
+def _filterwarnings(filters, quiet=False):
+    """Catch the warnings, then check if all the expected
+    warnings have been raised and re-raise unexpected warnings.
+    If 'quiet' is True, only re-raise the unexpected warnings.
+    """
+    # Clear the warning registry of the calling module
+    # in order to re-raise the warnings.
+    frame = sys._getframe(2)
+    registry = frame.f_globals.get('__warningregistry__')
+    if registry:
+        registry.clear()
+    with warnings.catch_warnings(record=True) as w:
+        # Set filter "always" to record all warnings.  Because
+        # test_warnings swap the module, we need to look up in
+        # the sys.modules dictionary.
+        sys.modules['warnings'].simplefilter("always")
+        yield WarningsRecorder(w)
+    # Filter the recorded warnings
+    reraise = list(w)
+    missing = []
+    for msg, cat in filters:
+        seen = False
+        for w in reraise[:]:
+            warning = w.message
+            # Filter out the matching messages
+            if (re.match(msg, str(warning), re.I) and
+                issubclass(warning.__class__, cat)):
+                seen = True
+                reraise.remove(w)
+        if not seen and not quiet:
+            # This filter caught nothing
+            missing.append((msg, cat.__name__))
+    if reraise:
+        raise AssertionError("unhandled warning %s" % reraise[0])
+    if missing:
+        raise AssertionError("filter (%r, %s) did not catch any warning" %
+                             missing[0])
+
+
+@contextlib.contextmanager
+def save_restore_warnings_filters():
+    old_filters = warnings.filters[:]
+    try:
+        yield
+    finally:
+        warnings.filters[:] = old_filters
+
+
+def _warn_about_deprecation():
+    warnings.warn(
+        "This is used in test_support test to ensure"
+        " support.ignore_deprecations_from() works as expected."
+        " You should not be seeing this.",
+        DeprecationWarning,
+        stacklevel=0,
+    )
diff --git a/Lib/test/test___all__.py b/Lib/test/test___all__.py
index 0ba243e..6368ef0 100644
--- a/Lib/test/test___all__.py
+++ b/Lib/test/test___all__.py
@@ -1,9 +1,17 @@
 import unittest
 from test import support
+from test.support import warnings_helper
 import os
 import sys
 
 
+if support.check_sanitizer(address=True, memory=True):
+    # bpo-46633: test___all__ is skipped because importing some modules
+    # directly can trigger known problems with ASAN (like tk or crypt).
+    raise unittest.SkipTest("workaround ASAN build issues on loading tests "
+                            "like tk or crypt")
+
+
 class NoAll(RuntimeError):
     pass
 
@@ -15,7 +23,7 @@
 
     def check_all(self, modname):
         names = {}
-        with support.check_warnings(
+        with warnings_helper.check_warnings(
             (".* (module|package)", DeprecationWarning),
             (".* (module|package)", PendingDeprecationWarning),
             ("", ResourceWarning),
@@ -31,7 +39,7 @@
             raise NoAll(modname)
         names = {}
         with self.subTest(module=modname):
-            with support.check_warnings(
+            with warnings_helper.check_warnings(
                 ("", DeprecationWarning),
                 ("", ResourceWarning),
                 quiet=True):
@@ -68,8 +76,8 @@
             yield path, modpath + fn[:-3]
 
     def test_all(self):
-        # Blacklisted modules and packages
-        blacklist = set([
+        # List of denied modules and packages
+        denylist = set([
             # Will raise a SyntaxError when compiling the exec statement
             '__future__',
         ])
@@ -84,13 +92,13 @@
         lib_dir = os.path.dirname(os.path.dirname(__file__))
         for path, modname in self.walk_modules(lib_dir, ""):
             m = modname
-            blacklisted = False
+            denied = False
             while m:
-                if m in blacklist:
-                    blacklisted = True
+                if m in denylist:
+                    denied = True
                     break
                 m = m.rpartition('.')[0]
-            if blacklisted:
+            if denied:
                 continue
             if support.verbose:
                 print(modname)
diff --git a/Lib/test/test__opcode.py b/Lib/test/test__opcode.py
index 0fb39ee..3bb64a7 100644
--- a/Lib/test/test__opcode.py
+++ b/Lib/test/test__opcode.py
@@ -1,5 +1,5 @@
 import dis
-from test.support import import_module
+from test.support.import_helper import import_module
 import unittest
 
 _opcode = import_module("_opcode")
diff --git a/Lib/test/test__osx_support.py b/Lib/test/test__osx_support.py
index 1a5d649..907ae27 100644
--- a/Lib/test/test__osx_support.py
+++ b/Lib/test/test__osx_support.py
@@ -8,7 +8,7 @@
 import sys
 import unittest
 
-import test.support
+from test.support import os_helper
 
 import _osx_support
 
@@ -19,7 +19,7 @@
         self.maxDiff = None
         self.prog_name = 'bogus_program_xxxx'
         self.temp_path_dir = os.path.abspath(os.getcwd())
-        self.env = test.support.EnvironmentVarGuard()
+        self.env = os_helper.EnvironmentVarGuard()
         self.addCleanup(self.env.__exit__)
         for cv in ('CFLAGS', 'LDFLAGS', 'CPPFLAGS',
                             'BASECFLAGS', 'BLDSHARED', 'LDSHARED', 'CC',
@@ -39,9 +39,9 @@
         if self.env['PATH']:
             self.env['PATH'] = self.env['PATH'] + ':'
         self.env['PATH'] = self.env['PATH'] + os.path.abspath(self.temp_path_dir)
-        test.support.unlink(self.prog_name)
+        os_helper.unlink(self.prog_name)
         self.assertIsNone(_osx_support._find_executable(self.prog_name))
-        self.addCleanup(test.support.unlink, self.prog_name)
+        self.addCleanup(os_helper.unlink, self.prog_name)
         with open(self.prog_name, 'w') as f:
             f.write("#!/bin/sh\n/bin/echo OK\n")
         os.chmod(self.prog_name, stat.S_IRWXU)
@@ -52,8 +52,8 @@
         if self.env['PATH']:
             self.env['PATH'] = self.env['PATH'] + ':'
         self.env['PATH'] = self.env['PATH'] + os.path.abspath(self.temp_path_dir)
-        test.support.unlink(self.prog_name)
-        self.addCleanup(test.support.unlink, self.prog_name)
+        os_helper.unlink(self.prog_name)
+        self.addCleanup(os_helper.unlink, self.prog_name)
         with open(self.prog_name, 'w') as f:
             f.write("#!/bin/sh\n/bin/echo ExpectedOutput\n")
         os.chmod(self.prog_name, stat.S_IRWXU)
@@ -143,8 +143,8 @@
         suffix = (':' + self.env['PATH']) if self.env['PATH'] else ''
         self.env['PATH'] = os.path.abspath(self.temp_path_dir) + suffix
         for c_name, c_output in compilers:
-            test.support.unlink(c_name)
-            self.addCleanup(test.support.unlink, c_name)
+            os_helper.unlink(c_name)
+            self.addCleanup(os_helper.unlink, c_name)
             with open(c_name, 'w') as f:
                 f.write("#!/bin/sh\n/bin/echo " + c_output)
             os.chmod(c_name, stat.S_IRWXU)
@@ -221,8 +221,8 @@
         suffix = (':' + self.env['PATH']) if self.env['PATH'] else ''
         self.env['PATH'] = os.path.abspath(self.temp_path_dir) + suffix
         c_name = 'clang'
-        test.support.unlink(c_name)
-        self.addCleanup(test.support.unlink, c_name)
+        os_helper.unlink(c_name)
+        self.addCleanup(os_helper.unlink, c_name)
         # exit status 255 means no PPC support in this compiler chain
         with open(c_name, 'w') as f:
             f.write("#!/bin/sh\nexit 255")
diff --git a/Lib/test/test__xxsubinterpreters.py b/Lib/test/test__xxsubinterpreters.py
index 7aec021..177a8a6 100644
--- a/Lib/test/test__xxsubinterpreters.py
+++ b/Lib/test/test__xxsubinterpreters.py
@@ -10,10 +10,11 @@
 import unittest
 
 from test import support
+from test.support import import_helper
 from test.support import script_helper
 
 
-interpreters = support.import_module('_xxsubinterpreters')
+interpreters = import_helper.import_module('_xxsubinterpreters')
 
 
 ##################################
@@ -24,11 +25,11 @@
     indented = script.replace('\n', '\n                ')
     wrapped = dedent(f"""
         import contextlib
-        with open({w}, 'w') as spipe:
+        with open({w}, 'w', encoding="utf-8") as spipe:
             with contextlib.redirect_stdout(spipe):
                 {indented}
         """)
-    return wrapped, open(r)
+    return wrapped, open(r, encoding="utf-8")
 
 
 def _run_output(interp, request, shared=None):
@@ -38,22 +39,37 @@
         return rpipe.read()
 
 
+def _wait_for_interp_to_run(interp, timeout=None):
+    # bpo-37224: Running this test file in multiprocesses will fail randomly.
+    # The failure reason is that the thread can't acquire the cpu to
+    # run subinterpreter eariler than the main thread in multiprocess.
+    if timeout is None:
+        timeout = support.SHORT_TIMEOUT
+    start_time = time.monotonic()
+    deadline = start_time + timeout
+    while not interpreters.is_running(interp):
+        if time.monotonic() > deadline:
+            raise RuntimeError('interp is not running')
+        time.sleep(0.010)
+
+
 @contextlib.contextmanager
 def _running(interp):
     r, w = os.pipe()
     def run():
         interpreters.run_string(interp, dedent(f"""
             # wait for "signal"
-            with open({r}) as rpipe:
+            with open({r}, encoding="utf-8") as rpipe:
                 rpipe.read()
             """))
 
     t = threading.Thread(target=run)
     t.start()
+    _wait_for_interp_to_run(interp)
 
     yield
 
-    with open(w, 'w') as spipe:
+    with open(w, 'w', encoding="utf-8") as spipe:
         spipe.write('done')
     t.join()
 
@@ -473,6 +489,7 @@
         main = interpreters.get_main()
         self.assertTrue(interpreters.is_running(main))
 
+    @unittest.skip('Fails on FreeBSD')
     def test_subinterpreter(self):
         interp = interpreters.create()
         self.assertFalse(interpreters.is_running(interp))
@@ -759,21 +776,9 @@
 
 class RunStringTests(TestBase):
 
-    SCRIPT = dedent("""
-        with open('{}', 'w') as out:
-            out.write('{}')
-        """)
-    FILENAME = 'spam'
-
     def setUp(self):
         super().setUp()
         self.id = interpreters.create()
-        self._fs = None
-
-    def tearDown(self):
-        if self._fs is not None:
-            self._fs.close()
-        super().tearDown()
 
     def test_success(self):
         script, file = _captured_script('print("it worked!", end="")')
@@ -816,7 +821,7 @@
     @unittest.skipUnless(hasattr(os, 'fork'), "test needs os.fork()")
     def test_fork(self):
         import tempfile
-        with tempfile.NamedTemporaryFile('w+') as file:
+        with tempfile.NamedTemporaryFile('w+', encoding="utf-8") as file:
             file.write('')
             file.flush()
 
@@ -826,7 +831,7 @@
                 try:
                     os.fork()
                 except RuntimeError:
-                    with open('{file.name}', 'w') as out:
+                    with open('{file.name}', 'w', encoding='utf-8') as out:
                         out.write('{expected}')
                 """)
             interpreters.run_string(self.id, script)
@@ -1216,7 +1221,7 @@
             import _xxsubinterpreters as _interpreters
             obj = _interpreters.channel_recv({cid})
             """))
-        # Test for channel that has boths ends associated to an interpreter.
+        # Test for channel that has both ends associated to an interpreter.
         send_interps = interpreters.channel_list_interpreters(cid, send=True)
         recv_interps = interpreters.channel_list_interpreters(cid, send=False)
         self.assertEqual(send_interps, [interp0])
diff --git a/Lib/test/test_abc.py b/Lib/test/test_abc.py
index 7e9c47b..c1d750d 100644
--- a/Lib/test/test_abc.py
+++ b/Lib/test/test_abc.py
@@ -459,6 +459,24 @@
             with self.assertRaisesRegex(Exception, exc_msg):
                 issubclass(int, S)
 
+        def test_subclasshook(self):
+            class A(metaclass=abc.ABCMeta):
+                @classmethod
+                def __subclasshook__(cls, C):
+                    if cls is A:
+                        return 'foo' in C.__dict__
+                    return NotImplemented
+            self.assertFalse(issubclass(A, A))
+            self.assertFalse(issubclass(A, (A,)))
+            class B:
+                foo = 42
+            self.assertTrue(issubclass(B, A))
+            self.assertTrue(issubclass(B, (A,)))
+            class C:
+                spam = 42
+            self.assertFalse(issubclass(C, A))
+            self.assertFalse(issubclass(C, (A,)))
+
         def test_all_new_methods_are_called(self):
             class A(metaclass=abc_ABCMeta):
                 pass
@@ -488,6 +506,155 @@
                 pass
             self.assertEqual(C.__class__, abc_ABCMeta)
 
+        def test_update_del(self):
+            class A(metaclass=abc_ABCMeta):
+                @abc.abstractmethod
+                def foo(self):
+                    pass
+
+            del A.foo
+            self.assertEqual(A.__abstractmethods__, {'foo'})
+            self.assertFalse(hasattr(A, 'foo'))
+
+            abc.update_abstractmethods(A)
+
+            self.assertEqual(A.__abstractmethods__, set())
+            A()
+
+
+        def test_update_new_abstractmethods(self):
+            class A(metaclass=abc_ABCMeta):
+                @abc.abstractmethod
+                def bar(self):
+                    pass
+
+            @abc.abstractmethod
+            def updated_foo(self):
+                pass
+
+            A.foo = updated_foo
+            abc.update_abstractmethods(A)
+            self.assertEqual(A.__abstractmethods__, {'foo', 'bar'})
+            msg = "class A with abstract methods bar, foo"
+            self.assertRaisesRegex(TypeError, msg, A)
+
+        def test_update_implementation(self):
+            class A(metaclass=abc_ABCMeta):
+                @abc.abstractmethod
+                def foo(self):
+                    pass
+
+            class B(A):
+                pass
+
+            msg = "class B with abstract method foo"
+            self.assertRaisesRegex(TypeError, msg, B)
+            self.assertEqual(B.__abstractmethods__, {'foo'})
+
+            B.foo = lambda self: None
+
+            abc.update_abstractmethods(B)
+
+            B()
+            self.assertEqual(B.__abstractmethods__, set())
+
+        def test_update_as_decorator(self):
+            class A(metaclass=abc_ABCMeta):
+                @abc.abstractmethod
+                def foo(self):
+                    pass
+
+            def class_decorator(cls):
+                cls.foo = lambda self: None
+                return cls
+
+            @abc.update_abstractmethods
+            @class_decorator
+            class B(A):
+                pass
+
+            B()
+            self.assertEqual(B.__abstractmethods__, set())
+
+        def test_update_non_abc(self):
+            class A:
+                pass
+
+            @abc.abstractmethod
+            def updated_foo(self):
+                pass
+
+            A.foo = updated_foo
+            abc.update_abstractmethods(A)
+            A()
+            self.assertFalse(hasattr(A, '__abstractmethods__'))
+
+        def test_update_del_implementation(self):
+            class A(metaclass=abc_ABCMeta):
+                @abc.abstractmethod
+                def foo(self):
+                    pass
+
+            class B(A):
+                def foo(self):
+                    pass
+
+            B()
+
+            del B.foo
+
+            abc.update_abstractmethods(B)
+
+            msg = "class B with abstract method foo"
+            self.assertRaisesRegex(TypeError, msg, B)
+
+        def test_update_layered_implementation(self):
+            class A(metaclass=abc_ABCMeta):
+                @abc.abstractmethod
+                def foo(self):
+                    pass
+
+            class B(A):
+                pass
+
+            class C(B):
+                def foo(self):
+                    pass
+
+            C()
+
+            del C.foo
+
+            abc.update_abstractmethods(C)
+
+            msg = "class C with abstract method foo"
+            self.assertRaisesRegex(TypeError, msg, C)
+
+        def test_update_multi_inheritance(self):
+            class A(metaclass=abc_ABCMeta):
+                @abc.abstractmethod
+                def foo(self):
+                    pass
+
+            class B(metaclass=abc_ABCMeta):
+                def foo(self):
+                    pass
+
+            class C(B, A):
+                @abc.abstractmethod
+                def foo(self):
+                    pass
+
+            self.assertEqual(C.__abstractmethods__, {'foo'})
+
+            del C.foo
+
+            abc.update_abstractmethods(C)
+
+            self.assertEqual(C.__abstractmethods__, set())
+
+            C()
+
 
     class TestABCWithInitSubclass(unittest.TestCase):
         def test_works_with_init_subclass(self):
diff --git a/Lib/test/test_aifc.py b/Lib/test/test_aifc.py
index 5a95099..fb6da41 100644
--- a/Lib/test/test_aifc.py
+++ b/Lib/test/test_aifc.py
@@ -1,4 +1,6 @@
-from test.support import check_no_resource_warning, findfile, TESTFN, unlink
+from test.support import findfile
+from test.support.os_helper import TESTFN, unlink
+from test.support.warnings_helper import check_no_resource_warning
 import unittest
 from unittest import mock
 from test import audiotests
diff --git a/Lib/test/test_argparse.py b/Lib/test/test_argparse.py
index 22cae62..d4426ba 100644
--- a/Lib/test/test_argparse.py
+++ b/Lib/test/test_argparse.py
@@ -1,6 +1,8 @@
 # Author: Steven J. Bethard <steven.bethard@gmail.com>.
 
 import inspect
+import io
+import operator
 import os
 import shutil
 import stat
@@ -10,12 +12,27 @@
 import unittest
 import argparse
 
-from io import StringIO
-
-from test import support
+from test.support import os_helper
 from unittest import mock
-class StdIOBuffer(StringIO):
-    pass
+
+
+class StdIOBuffer(io.TextIOWrapper):
+    '''Replacement for writable io.StringIO that behaves more like real file
+
+    Unlike StringIO, provides a buffer attribute that holds the underlying
+    binary data, allowing it to replace sys.stdout/sys.stderr in more
+    contexts.
+    '''
+
+    def __init__(self, initial_value='', newline='\n'):
+        initial_value = initial_value.encode('utf-8')
+        super().__init__(io.BufferedWriter(io.BytesIO(initial_value)),
+                         'utf-8', newline=newline)
+
+    def getvalue(self):
+        self.flush()
+        return self.buffer.raw.getvalue().decode('utf-8')
+
 
 class TestCase(unittest.TestCase):
 
@@ -23,7 +40,7 @@
         # The tests assume that line wrapping occurs at 80 columns, but this
         # behaviour can be overridden by setting the COLUMNS environment
         # variable.  To ensure that this width is used, set COLUMNS to 80.
-        env = support.EnvironmentVarGuard()
+        env = os_helper.EnvironmentVarGuard()
         env['COLUMNS'] = '80'
         self.addCleanup(env.__exit__)
 
@@ -42,11 +59,14 @@
                 os.chmod(os.path.join(self.temp_dir, name), stat.S_IWRITE)
         shutil.rmtree(self.temp_dir, True)
 
-    def create_readonly_file(self, filename):
+    def create_writable_file(self, filename):
         file_path = os.path.join(self.temp_dir, filename)
-        with open(file_path, 'w') as file:
+        with open(file_path, 'w', encoding="utf-8") as file:
             file.write(filename)
-        os.chmod(file_path, stat.S_IREAD)
+        return file_path
+
+    def create_readonly_file(self, filename):
+        os.chmod(self.create_writable_file(filename), stat.S_IREAD)
 
 class Sig(object):
 
@@ -96,13 +116,18 @@
         try:
             result = parse_args(*args, **kwargs)
             for key in list(vars(result)):
-                if getattr(result, key) is sys.stdout:
+                attr = getattr(result, key)
+                if attr is sys.stdout:
                     setattr(result, key, old_stdout)
-                if getattr(result, key) is sys.stderr:
+                elif attr is sys.stdout.buffer:
+                    setattr(result, key, getattr(old_stdout, 'buffer', BIN_STDOUT_SENTINEL))
+                elif attr is sys.stderr:
                     setattr(result, key, old_stderr)
+                elif attr is sys.stderr.buffer:
+                    setattr(result, key, getattr(old_stderr, 'buffer', BIN_STDERR_SENTINEL))
             return result
-        except SystemExit:
-            code = sys.exc_info()[1].code
+        except SystemExit as e:
+            code = e.code
             stdout = sys.stdout.getvalue()
             stderr = sys.stderr.getvalue()
             raise ArgumentParserError(
@@ -1467,7 +1492,7 @@
             ('invalid', '@no-such-path\n'),
         ]
         for path, text in file_texts:
-            with open(path, 'w') as file:
+            with open(path, 'w', encoding="utf-8") as file:
                 file.write(text)
 
     parser_signature = Sig(fromfile_prefix_chars='@')
@@ -1497,7 +1522,7 @@
             ('hello', 'hello world!\n'),
         ]
         for path, text in file_texts:
-            with open(path, 'w') as file:
+            with open(path, 'w', encoding="utf-8") as file:
                 file.write(text)
 
     class FromFileConverterArgumentParser(ErrorRaisingArgumentParser):
@@ -1545,16 +1570,40 @@
         type = argparse.FileType('r', 1, errors='replace')
         self.assertEqual("FileType('r', 1, errors='replace')", repr(type))
 
+
+BIN_STDOUT_SENTINEL = object()
+BIN_STDERR_SENTINEL = object()
+
+
 class StdStreamComparer:
     def __init__(self, attr):
-        self.attr = attr
+        # We try to use the actual stdXXX.buffer attribute as our
+        # marker, but but under some test environments,
+        # sys.stdout/err are replaced by io.StringIO which won't have .buffer,
+        # so we use a sentinel simply to show that the tests do the right thing
+        # for any buffer supporting object
+        self.getattr = operator.attrgetter(attr)
+        if attr == 'stdout.buffer':
+            self.backupattr = BIN_STDOUT_SENTINEL
+        elif attr == 'stderr.buffer':
+            self.backupattr = BIN_STDERR_SENTINEL
+        else:
+            self.backupattr = object() # Not equal to anything
 
     def __eq__(self, other):
-        return other == getattr(sys, self.attr)
+        try:
+            return other == self.getattr(sys)
+        except AttributeError:
+            return other == self.backupattr
+
 
 eq_stdin = StdStreamComparer('stdin')
 eq_stdout = StdStreamComparer('stdout')
 eq_stderr = StdStreamComparer('stderr')
+eq_bstdin = StdStreamComparer('stdin.buffer')
+eq_bstdout = StdStreamComparer('stdout.buffer')
+eq_bstderr = StdStreamComparer('stderr.buffer')
+
 
 class RFile(object):
     seen = {}
@@ -1579,7 +1628,8 @@
     def setUp(self):
         super(TestFileTypeR, self).setUp()
         for file_name in ['foo', 'bar']:
-            with open(os.path.join(self.temp_dir, file_name), 'w') as file:
+            with open(os.path.join(self.temp_dir, file_name),
+                      'w', encoding="utf-8") as file:
                 file.write(file_name)
         self.create_readonly_file('readonly')
 
@@ -1600,7 +1650,7 @@
     """Test that a file is not created unless the default is needed"""
     def setUp(self):
         super(TestFileTypeDefaults, self).setUp()
-        file = open(os.path.join(self.temp_dir, 'good'), 'w')
+        file = open(os.path.join(self.temp_dir, 'good'), 'w', encoding="utf-8")
         file.write('good')
         file.close()
 
@@ -1619,7 +1669,8 @@
     def setUp(self):
         super(TestFileTypeRB, self).setUp()
         for file_name in ['foo', 'bar']:
-            with open(os.path.join(self.temp_dir, file_name), 'w') as file:
+            with open(os.path.join(self.temp_dir, file_name),
+                      'w', encoding="utf-8") as file:
                 file.write(file_name)
 
     argument_signatures = [
@@ -1631,7 +1682,7 @@
         ('foo', NS(x=None, spam=RFile('foo'))),
         ('-x foo bar', NS(x=RFile('foo'), spam=RFile('bar'))),
         ('bar -x foo', NS(x=RFile('foo'), spam=RFile('bar'))),
-        ('-x - -', NS(x=eq_stdin, spam=eq_stdin)),
+        ('-x - -', NS(x=eq_bstdin, spam=eq_bstdin)),
     ]
 
 
@@ -1658,8 +1709,9 @@
     """Test the FileType option/argument type for writing files"""
 
     def setUp(self):
-        super(TestFileTypeW, self).setUp()
+        super().setUp()
         self.create_readonly_file('readonly')
+        self.create_writable_file('writable')
 
     argument_signatures = [
         Sig('-x', type=argparse.FileType('w')),
@@ -1668,13 +1720,37 @@
     failures = ['-x', '', 'readonly']
     successes = [
         ('foo', NS(x=None, spam=WFile('foo'))),
+        ('writable', NS(x=None, spam=WFile('writable'))),
         ('-x foo bar', NS(x=WFile('foo'), spam=WFile('bar'))),
         ('bar -x foo', NS(x=WFile('foo'), spam=WFile('bar'))),
         ('-x - -', NS(x=eq_stdout, spam=eq_stdout)),
     ]
 
+@unittest.skipIf(hasattr(os, 'geteuid') and os.geteuid() == 0,
+                 "non-root user required")
+class TestFileTypeX(TempDirMixin, ParserTestCase):
+    """Test the FileType option/argument type for writing new files only"""
 
+    def setUp(self):
+        super().setUp()
+        self.create_readonly_file('readonly')
+        self.create_writable_file('writable')
+
+    argument_signatures = [
+        Sig('-x', type=argparse.FileType('x')),
+        Sig('spam', type=argparse.FileType('x')),
+    ]
+    failures = ['-x', '', 'readonly', 'writable']
+    successes = [
+        ('-x foo bar', NS(x=WFile('foo'), spam=WFile('bar'))),
+        ('-x - -', NS(x=eq_stdout, spam=eq_stdout)),
+    ]
+
+
+@unittest.skipIf(hasattr(os, 'geteuid') and os.geteuid() == 0,
+                 "non-root user required")
 class TestFileTypeWB(TempDirMixin, ParserTestCase):
+    """Test the FileType option/argument type for writing binary files"""
 
     argument_signatures = [
         Sig('-x', type=argparse.FileType('wb')),
@@ -1685,7 +1761,22 @@
         ('foo', NS(x=None, spam=WFile('foo'))),
         ('-x foo bar', NS(x=WFile('foo'), spam=WFile('bar'))),
         ('bar -x foo', NS(x=WFile('foo'), spam=WFile('bar'))),
-        ('-x - -', NS(x=eq_stdout, spam=eq_stdout)),
+        ('-x - -', NS(x=eq_bstdout, spam=eq_bstdout)),
+    ]
+
+
+@unittest.skipIf(hasattr(os, 'geteuid') and os.geteuid() == 0,
+                 "non-root user required")
+class TestFileTypeXB(TestFileTypeX):
+    "Test the FileType option/argument type for writing new binary files only"
+
+    argument_signatures = [
+        Sig('-x', type=argparse.FileType('xb')),
+        Sig('spam', type=argparse.FileType('xb')),
+    ]
+    successes = [
+        ('-x foo bar', NS(x=WFile('foo'), spam=WFile('bar'))),
+        ('-x - -', NS(x=eq_bstdout, spam=eq_bstdout)),
     ]
 
 
@@ -1828,8 +1919,7 @@
                     raise AssertionError('value: %s' % value)
                 assert expected_ns == namespace, ('expected %s, got %s' %
                                                   (expected_ns, namespace))
-            except AssertionError:
-                e = sys.exc_info()[1]
+            except AssertionError as e:
                 raise ArgumentParserError('opt_action failed: %s' % e)
             setattr(namespace, 'spam', value)
 
@@ -1854,8 +1944,7 @@
                     raise AssertionError('value: %s' % value)
                 assert expected_ns == namespace, ('expected %s, got %s' %
                                                   (expected_ns, namespace))
-            except AssertionError:
-                e = sys.exc_info()[1]
+            except AssertionError as e:
                 raise ArgumentParserError('arg_action failed: %s' % e)
             setattr(namespace, 'badger', value)
 
@@ -2057,6 +2146,30 @@
         ret = parser.parse_args(())
         self.assertIsNone(ret.command)
 
+    def test_required_subparsers_no_destination_error(self):
+        parser = ErrorRaisingArgumentParser()
+        subparsers = parser.add_subparsers(required=True)
+        subparsers.add_parser('foo')
+        subparsers.add_parser('bar')
+        with self.assertRaises(ArgumentParserError) as excinfo:
+            parser.parse_args(())
+        self.assertRegex(
+            excinfo.exception.stderr,
+            'error: the following arguments are required: {foo,bar}\n$'
+        )
+
+    def test_wrong_argument_subparsers_no_destination_error(self):
+        parser = ErrorRaisingArgumentParser()
+        subparsers = parser.add_subparsers(required=True)
+        subparsers.add_parser('foo')
+        subparsers.add_parser('bar')
+        with self.assertRaises(ArgumentParserError) as excinfo:
+            parser.parse_args(('baz',))
+        self.assertRegex(
+            excinfo.exception.stderr,
+            r"error: argument {foo,bar}: invalid choice: 'baz' \(choose from 'foo', 'bar'\)\n$"
+        )
+
     def test_optional_subparsers(self):
         parser = ErrorRaisingArgumentParser()
         subparsers = parser.add_subparsers(dest='command', required=False)
@@ -2077,7 +2190,7 @@
               bar         bar help
               {1,2,3}     command help
 
-            optional arguments:
+            options:
               -h, --help  show this help message and exit
               --foo       foo help
             '''))
@@ -2096,7 +2209,7 @@
               bar         bar help
               {1,2,3}     command help
 
-            optional arguments:
+            options:
               -h, --help  show this help message and exit
               ++foo       foo help
             '''))
@@ -2113,12 +2226,48 @@
 
             main description
 
-            optional arguments:
+            options:
               -h, --help      show this help message and exit
               --non-breaking  help message containing non-breaking spaces shall not
                               wrap\N{NO-BREAK SPACE}at non-breaking spaces
         '''))
 
+    def test_help_blank(self):
+        # Issue 24444
+        parser = ErrorRaisingArgumentParser(
+            prog='PROG', description='main description')
+        parser.add_argument(
+            'foo',
+            help='    ')
+        self.assertEqual(parser.format_help(), textwrap.dedent('''\
+            usage: PROG [-h] foo
+
+            main description
+
+            positional arguments:
+              foo         
+
+            options:
+              -h, --help  show this help message and exit
+        '''))
+
+        parser = ErrorRaisingArgumentParser(
+            prog='PROG', description='main description')
+        parser.add_argument(
+            'foo', choices=[],
+            help='%(choices)s')
+        self.assertEqual(parser.format_help(), textwrap.dedent('''\
+            usage: PROG [-h] {}
+
+            main description
+
+            positional arguments:
+              {}          
+
+            options:
+              -h, --help  show this help message and exit
+        '''))
+
     def test_help_alternate_prefix_chars(self):
         parser = self._get_parser(prefix_chars='+:/')
         self.assertEqual(parser.format_usage(),
@@ -2132,7 +2281,7 @@
               bar         bar help
               {1,2,3}     command help
 
-            optional arguments:
+            options:
               +h, ++help  show this help message and exit
               ++foo       foo help
             '''))
@@ -2153,7 +2302,7 @@
                 2         2 help
                 3         3 help
 
-            optional arguments:
+            options:
               -h, --help  show this help message and exit
               --foo       foo help
             '''))
@@ -2178,7 +2327,7 @@
             positional arguments:
               bar         bar help
 
-            optional arguments:
+            options:
               -h, --help  show this help message and exit
               --foo       foo help
 
@@ -2202,7 +2351,7 @@
             positional arguments:
               {a,b,c}     x help
 
-            optional arguments:
+            options:
               -h, --help  show this help message and exit
               -w W        w help
             '''))
@@ -2216,7 +2365,7 @@
             positional arguments:
               z           z help
 
-            optional arguments:
+            options:
               -h, --help  show this help message and exit
               -y {1,2,3}  y help
             '''))
@@ -2248,7 +2397,7 @@
             positional arguments:
               bar                   bar help
 
-            optional arguments:
+            options:
               -h, --help            show this help message and exit
               --foo                 foo help
 
@@ -2436,7 +2585,7 @@
               a
               z
 
-            optional arguments:
+            options:
               -h, --help  show this help message and exit
               -b B
               --w W
@@ -2466,7 +2615,7 @@
         self.assertEqual(parser_help, textwrap.dedent('''\
             usage: {}{}[-h] [-w W] [-x X] [-y Y | -z Z]
 
-            optional arguments:
+            options:
               -h, --help  show this help message and exit
               -y Y
               -z Z
@@ -2511,7 +2660,7 @@
         expected = '''\
             usage: PROG [-h] [--foo | --bar] [--soup | --nuts]
 
-            optional arguments:
+            options:
               -h, --help  show this help message and exit
               --foo
               --bar
@@ -2520,6 +2669,13 @@
               '''
         self.assertEqual(parser.format_help(), textwrap.dedent(expected))
 
+    def test_empty_group(self):
+        # See issue 26952
+        parser = argparse.ArgumentParser()
+        group = parser.add_mutually_exclusive_group()
+        with self.assertRaises(ValueError):
+            parser.parse_args(['-h'])
+
 class MEMixin(object):
 
     def test_failures_when_not_required(self):
@@ -2596,7 +2752,7 @@
         '''
     help = '''\
 
-        optional arguments:
+        options:
           -h, --help   show this help message and exit
           --bar BAR    bar help
           --baz [BAZ]  baz help
@@ -2637,7 +2793,7 @@
     '''
     help = '''\
 
-    optional arguments:
+    options:
       -h, --help     show this help message and exit
       --abcde ABCDE  abcde help
       --fghij FGHIJ  fghij help
@@ -2673,7 +2829,7 @@
         '''
     help = '''\
 
-        optional arguments:
+        options:
           -h, --help  show this help message and exit
           -y          y help
         '''
@@ -2710,7 +2866,7 @@
         '''
     help = '''\
 
-        optional arguments:
+        options:
           -h, --help  show this help message and exit
         '''
 
@@ -2753,7 +2909,7 @@
         positional arguments:
           badger       BADGER
 
-        optional arguments:
+        options:
           -h, --help   show this help message and exit
           --foo        FOO
           --spam SPAM  SPAM
@@ -2792,7 +2948,7 @@
         '''
     help = '''\
 
-        optional arguments:
+        options:
           -h, --help  show this help message and exit
           -x          x help
           -a          a help
@@ -2831,7 +2987,7 @@
         '''
     help = '''\
 
-        optional arguments:
+        options:
           -h, --help  show this help message and exit
 
         Titled group:
@@ -2876,7 +3032,7 @@
           x           x help
           a           a help
 
-        optional arguments:
+        options:
           -h, --help  show this help message and exit
           -y          y help
           -b          b help
@@ -2907,7 +3063,7 @@
 
     help = '''\
 
-        optional arguments:
+        options:
           -h, --help  show this help message and exit
           -a A
           -b B
@@ -3225,7 +3381,7 @@
           foo            FOO HELP
           bar            BAR HELP
 
-        optional arguments:
+        options:
           -h, --help     show this help message and exit
           -v, --version  show program's version number and exit
           -x             X HELP
@@ -3244,7 +3400,7 @@
     but we don't want any exceptions thrown in such cases. Only ugly representation.
     '''
     def setUp(self):
-        env = support.EnvironmentVarGuard()
+        env = os_helper.EnvironmentVarGuard()
         env.set("COLUMNS", '15')
         self.addCleanup(env.__exit__)
 
@@ -3270,7 +3426,7 @@
           bar
             BAR HELP
 
-        optional arguments:
+        options:
           -h, --help
             show this
             help
@@ -3320,7 +3476,7 @@
           foo            FOO HELP
           bar            BAR HELP
 
-        optional arguments:
+        options:
           -h, --help     show this help message and exit
           -v, --version  show program's version number and exit
           -x             X HELP
@@ -3361,7 +3517,7 @@
           ekiekiekifekang  EKI HELP
           bar              BAR HELP
 
-        optional arguments:
+        options:
           -h, --help       show this help message and exit
           -x               X HELP
           --y Y            Y HELP
@@ -3408,7 +3564,7 @@
         positional arguments:
           yyy         normal y help
 
-        optional arguments:
+        options:
           -h, --help  show this help message and exit
           -x XX       oddly formatted -x help
 
@@ -3448,7 +3604,7 @@
 YHYH YHYH
                       YHYH YHYH YHYH YHYH YHYH YHYH YHYH YH
 
-        optional arguments:
+        options:
           -h, --help  show this help message and exit
           -x XX       XHH HXXHH HXXHH HXXHH HXXHH HXXHH HXXHH HXXHH HXXHH \
 HXXHH HXXHH
@@ -3491,7 +3647,7 @@
 YHYH YHYH
                                 YHYH YHYH YHYH YHYH YHYH YHYH YHYH YHYH YHYH YH
 
-        optional arguments:
+        options:
           -h, --help            show this help message and exit
           -v, --version         show program's version number and exit
           -x XXXXXXXXXXXXXXXXXXXXXXXXX
@@ -3530,6 +3686,8 @@
         Sig('--bar', help='Whether to bar', default=True,
                      action=argparse.BooleanOptionalAction),
         Sig('-f', '--foobar', '--barfoo', action=argparse.BooleanOptionalAction),
+        Sig('--bazz', action=argparse.BooleanOptionalAction,
+                      default=argparse.SUPPRESS, help='Bazz!'),
     ]
     argument_group_signatures = [
         (Sig('group'), [
@@ -3542,8 +3700,8 @@
     usage = '''\
         usage: PROG [-h] [-w W [W ...]] [-x [X ...]] [--foo | --no-foo]
                     [--bar | --no-bar]
-                    [-f | --foobar | --no-foobar | --barfoo | --no-barfoo] [-y [Y]]
-                    [-z Z Z Z]
+                    [-f | --foobar | --no-foobar | --barfoo | --no-barfoo]
+                    [--bazz | --no-bazz] [-y [Y]] [-z Z Z Z]
                     a b b [c] [d ...] e [e ...]
         '''
     help = usage + '''\
@@ -3553,13 +3711,14 @@
           b                     b
           c                     c
 
-        optional arguments:
+        options:
           -h, --help            show this help message and exit
           -w W [W ...]          w
           -x [X ...]            x
           --foo, --no-foo       Whether to foo
           --bar, --no-bar       Whether to bar (default: True)
           -f, --foobar, --no-foobar, --barfoo, --no-barfoo
+          --bazz, --no-bazz     Bazz!
 
         group:
           -y [Y]                y
@@ -3622,7 +3781,7 @@
           a
           b
 
-        optional arguments:
+        options:
           -h, --help  show this help message and exit
           -w W
           -x X
@@ -3656,7 +3815,7 @@
           a
           b
 
-        optional arguments:
+        options:
           -h, --help            show this help message and exit
           -w WWWWWWWWWWWWWWWWWWWWWWWWW
           -x XXXXXXXXXXXXXXXXXXXXXXXXX
@@ -3719,7 +3878,7 @@
           b
           c
 
-        optional arguments:
+        options:
           -h, --help            show this help message and exit
           -w WWWWWWWWWWWWWWWWWWWWWWWWW
           -x XXXXXXXXXXXXXXXXXXXXXXXXX
@@ -3754,7 +3913,7 @@
           bbbbbbbbbbbbbbbbbbbbbbbbb
           ccccccccccccccccccccccccc
 
-        optional arguments:
+        options:
           -h, --help            show this help message and exit
           -x X
           -y Y
@@ -3790,7 +3949,7 @@
           bbbbbbbbbbbbbbbbbbbbbbbbb
           ccccccccccccccccccccccccc
 
-        optional arguments:
+        options:
           -h, --help            show this help message and exit
           -x XXXXXXXXXXXXXXXXXXXXXXXXX
           -y YYYYYYYYYYYYYYYYYYYYYYYYY
@@ -3816,7 +3975,7 @@
         '''
     help = usage + '''\
 
-        optional arguments:
+        options:
           -h, --help            show this help message and exit
           -x XXXXXXXXXXXXXXXXXXXXXXXXX
           -y YYYYYYYYYYYYYYYYYYYYYYYYY
@@ -3881,7 +4040,7 @@
           spam           spam PROG None
           badger         badger PROG 0.5
 
-        optional arguments:
+        options:
           -h, --help     show this help message and exit
           -x X           x PROG None int %
           -y             y PROG 42 XXX
@@ -3906,7 +4065,7 @@
         ''')
     help = usage + '''\
 
-        optional arguments:
+        options:
           -h, --help  show this help message and exit
         '''
     version = ''
@@ -3938,7 +4097,7 @@
         positional arguments:
           spam        spam help
 
-        optional arguments:
+        options:
           -h, --help  show this help message and exit
           --foo FOO   foo help
         '''
@@ -3985,7 +4144,7 @@
         positional arguments:
           spam        spam help
 
-        optional arguments:
+        options:
           -h, --help  show this help message and exit
           --foo FOO   foo help
         '''
@@ -4006,7 +4165,7 @@
         '''
     help = usage + '''\
 
-        optional arguments:
+        options:
           -h, --help  show this help message and exit
           --foo FOO   foo help
         '''
@@ -4026,7 +4185,7 @@
         '''
     help = usage + '''\
 
-        optional arguments:
+        options:
           -h, --help  show this help message and exit
           --foo FOO   foo help
         '''
@@ -4047,7 +4206,7 @@
         '''
     help = usage + '''\
 
-        optional arguments:
+        options:
           ^^foo              foo help
           ;b BAR, ;;bar BAR  bar help
         '''
@@ -4071,7 +4230,7 @@
         positional arguments:
           spam       spam help
 
-        optional arguments:
+        options:
           --foo FOO  foo help
         '''
     version = ''
@@ -4094,7 +4253,7 @@
         positional arguments:
           spam
 
-        optional arguments:
+        options:
           -h, --help  show this help message and exit
           --foo FOO
         '''
@@ -4118,7 +4277,7 @@
         '''
     help = usage + '''\
 
-        optional arguments:
+        options:
           -h, --help        show this help message and exit
           -w W1 [W2 ...]    w
           -x [X1 [X2 ...]]  x
@@ -4162,7 +4321,7 @@
         positional arguments:
           spam        spam help
 
-        optional arguments:
+        options:
           -h, --help  show this help message and exit
           --foo FOO       foo help should also
                       appear as given here
@@ -4211,7 +4370,7 @@
         positional arguments:
           spam        spam help
 
-        optional arguments:
+        options:
           -h, --help  show this help message and exit
           --foo FOO   foo help should not retain this odd formatting
 
@@ -4235,6 +4394,9 @@
     argument_signatures = [
         Sig('--foo', help='foo help - oh and by the way, %(default)s'),
         Sig('--bar', action='store_true', help='bar help'),
+        Sig('--taz', action=argparse.BooleanOptionalAction,
+            help='Whether to taz it', default=True),
+        Sig('--quux', help="Set the quux", default=42),
         Sig('spam', help='spam help'),
         Sig('badger', nargs='?', default='wooden', help='badger help'),
     ]
@@ -4243,25 +4405,29 @@
          [Sig('--baz', type=int, default=42, help='baz help')]),
     ]
     usage = '''\
-        usage: PROG [-h] [--foo FOO] [--bar] [--baz BAZ] spam [badger]
+        usage: PROG [-h] [--foo FOO] [--bar] [--taz | --no-taz] [--quux QUUX]
+                    [--baz BAZ]
+                    spam [badger]
         '''
     help = usage + '''\
 
         description
 
         positional arguments:
-          spam        spam help
-          badger      badger help (default: wooden)
+          spam             spam help
+          badger           badger help (default: wooden)
 
-        optional arguments:
-          -h, --help  show this help message and exit
-          --foo FOO   foo help - oh and by the way, None
-          --bar       bar help (default: False)
+        options:
+          -h, --help       show this help message and exit
+          --foo FOO        foo help - oh and by the way, None
+          --bar            bar help (default: False)
+          --taz, --no-taz  Whether to taz it (default: True)
+          --quux QUUX      Set the quux (default: 42)
 
         title:
           description
 
-          --baz BAZ   baz help (default: 42)
+          --baz BAZ        baz help (default: 42)
         '''
     version = ''
 
@@ -4278,7 +4444,7 @@
 
         description
 
-        optional arguments:
+        options:
           -h, --help     show this help message and exit
           -V, --version  show program's version number and exit
         '''
@@ -4304,7 +4470,7 @@
         positional arguments:
           spam        spam help
 
-        optional arguments:
+        options:
           -h, --help  show this help message and exit
           --foo FOO   foo help
         '''
@@ -4330,7 +4496,7 @@
         positional arguments:
           {a,b,c,d,e}
 
-        optional arguments:
+        options:
           -h, --help     show this help message and exit
           -v, --version  show program's version number and exit
         '''
@@ -4371,7 +4537,7 @@
             d            d subcommand help
             e            e subcommand help
 
-        optional arguments:
+        options:
           -h, --help     show this help message and exit
           -v, --version  show program's version number and exit
         '''
@@ -4403,7 +4569,7 @@
         positional arguments:
           int
 
-        optional arguments:
+        options:
           -h, --help      show this help message and exit
           -b custom_type
           -c SOME FLOAT
@@ -4595,7 +4761,7 @@
         self.assertEqual(parser.format_help(), textwrap.dedent('''\
             usage: PROG [-h] [-x X]
 
-            optional arguments:
+            options:
               -h, --help  show this help message and exit
               -x X        NEW X
             '''))
@@ -4605,7 +4771,7 @@
         self.assertEqual(parser.format_help(), textwrap.dedent('''\
             usage: PROG [-h] [-x X] [--spam NEW_SPAM]
 
-            optional arguments:
+            options:
               -h, --help       show this help message and exit
               -x X             NEW X
               --spam NEW_SPAM
@@ -5336,7 +5502,7 @@
             usage: this_is_spammy_prog_with_a_long_name_sorry_about_the_name
                    [-h] [--proxy <http[s]://example:1234>]
 
-            optional arguments:
+            options:
               -h, --help            show this help message and exit
               --proxy <http[s]://example:1234>
             '''))
@@ -5357,13 +5523,11 @@
             self.parser.parse_args('--integers a'.split())
 
 
-def test_main():
-    support.run_unittest(__name__)
+def tearDownModule():
     # Remove global references to avoid looking like we have refleaks.
     RFile.seen = {}
     WFile.seen = set()
 
 
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py
old mode 100644
new mode 100755
index f731b70..6a48c1c
--- a/Lib/test/test_array.py
+++ b/Lib/test/test_array.py
@@ -2,8 +2,10 @@
    Roger E. Masse
 """
 
+import collections.abc
 import unittest
 from test import support
+from test.support import os_helper
 from test.support import _2G
 import weakref
 import pickle
@@ -28,12 +30,29 @@
 
 class MiscTest(unittest.TestCase):
 
+    def test_array_is_sequence(self):
+        self.assertIsInstance(array.array("B"), collections.abc.MutableSequence)
+        self.assertIsInstance(array.array("B"), collections.abc.Reversible)
+
     def test_bad_constructor(self):
         self.assertRaises(TypeError, array.array)
         self.assertRaises(TypeError, array.array, spam=42)
         self.assertRaises(TypeError, array.array, 'xx')
         self.assertRaises(ValueError, array.array, 'x')
 
+    @support.cpython_only
+    def test_disallow_instantiation(self):
+        my_array = array.array("I")
+        support.check_disallow_instantiation(
+            self, type(iter(my_array)), my_array
+        )
+
+    @support.cpython_only
+    def test_immutable(self):
+        # bpo-43908: check that array.array is immutable
+        with self.assertRaises(TypeError):
+            array.array.foo = 1
+
     def test_empty(self):
         # Exercise code for handling zero-length arrays
         a = array.array('B')
@@ -330,6 +349,67 @@
         self.assertEqual(list(empit), [self.outside])
         self.assertEqual(list(a), list(self.example) + [self.outside])
 
+    def test_reverse_iterator(self):
+        a = array.array(self.typecode, self.example)
+        self.assertEqual(list(a), list(self.example))
+        self.assertEqual(list(reversed(a)), list(iter(a))[::-1])
+
+    def test_reverse_iterator_picking(self):
+        orig = array.array(self.typecode, self.example)
+        data = list(orig)
+        data2 = [self.outside] + data
+        rev_data = data[len(data)-2::-1] + [self.outside]
+        for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+            # initial iterator
+            itorig = reversed(orig)
+            d = pickle.dumps((itorig, orig), proto)
+            it, a = pickle.loads(d)
+            a.insert(0, self.outside)
+            self.assertEqual(type(it), type(itorig))
+            self.assertEqual(list(it), rev_data)
+            self.assertEqual(list(a), data2)
+
+            # running iterator
+            next(itorig)
+            d = pickle.dumps((itorig, orig), proto)
+            it, a = pickle.loads(d)
+            a.insert(0, self.outside)
+            self.assertEqual(type(it), type(itorig))
+            self.assertEqual(list(it), rev_data[1:])
+            self.assertEqual(list(a), data2)
+
+            # empty iterator
+            for i in range(1, len(data)):
+                next(itorig)
+            d = pickle.dumps((itorig, orig), proto)
+            it, a = pickle.loads(d)
+            a.insert(0, self.outside)
+            self.assertEqual(type(it), type(itorig))
+            self.assertEqual(list(it), [])
+            self.assertEqual(list(a), data2)
+
+            # exhausted iterator
+            self.assertRaises(StopIteration, next, itorig)
+            d = pickle.dumps((itorig, orig), proto)
+            it, a = pickle.loads(d)
+            a.insert(0, self.outside)
+            self.assertEqual(list(it), [])
+            self.assertEqual(list(a), data2)
+
+    def test_exhausted_reverse_iterator(self):
+        a = array.array(self.typecode, self.example)
+        self.assertEqual(list(a), list(self.example))
+        exhit = reversed(a)
+        empit = reversed(a)
+        for x in exhit:  # exhaust the iterator
+            next(empit)  # Pointing past the 0th position.
+        a.insert(0, self.outside)
+        self.assertEqual(list(exhit), [])
+        # The iterator index points past the 0th position so inserting
+        # an element in the beginning does not make it appear.
+        self.assertEqual(list(empit), [])
+        self.assertEqual(list(a), [self.outside] + list(self.example))
+
     def test_insert(self):
         a = array.array(self.typecode, self.example)
         a.insert(0, self.example[0])
@@ -366,13 +446,13 @@
     def test_tofromfile(self):
         a = array.array(self.typecode, 2*self.example)
         self.assertRaises(TypeError, a.tofile)
-        support.unlink(support.TESTFN)
-        f = open(support.TESTFN, 'wb')
+        os_helper.unlink(os_helper.TESTFN)
+        f = open(os_helper.TESTFN, 'wb')
         try:
             a.tofile(f)
             f.close()
             b = array.array(self.typecode)
-            f = open(support.TESTFN, 'rb')
+            f = open(os_helper.TESTFN, 'rb')
             self.assertRaises(TypeError, b.fromfile)
             b.fromfile(f, len(self.example))
             self.assertEqual(b, array.array(self.typecode, self.example))
@@ -383,27 +463,27 @@
         finally:
             if not f.closed:
                 f.close()
-            support.unlink(support.TESTFN)
+            os_helper.unlink(os_helper.TESTFN)
 
     def test_fromfile_ioerror(self):
         # Issue #5395: Check if fromfile raises a proper OSError
         # instead of EOFError.
         a = array.array(self.typecode)
-        f = open(support.TESTFN, 'wb')
+        f = open(os_helper.TESTFN, 'wb')
         try:
             self.assertRaises(OSError, a.fromfile, f, len(self.example))
         finally:
             f.close()
-            support.unlink(support.TESTFN)
+            os_helper.unlink(os_helper.TESTFN)
 
     def test_filewrite(self):
         a = array.array(self.typecode, 2*self.example)
-        f = open(support.TESTFN, 'wb')
+        f = open(os_helper.TESTFN, 'wb')
         try:
             f.write(a)
             f.close()
             b = array.array(self.typecode)
-            f = open(support.TESTFN, 'rb')
+            f = open(os_helper.TESTFN, 'rb')
             b.fromfile(f, len(self.example))
             self.assertEqual(b, array.array(self.typecode, self.example))
             self.assertNotEqual(a, b)
@@ -413,7 +493,7 @@
         finally:
             if not f.closed:
                 f.close()
-            support.unlink(support.TESTFN)
+            os_helper.unlink(os_helper.TESTFN)
 
     def test_tofromlist(self):
         a = array.array(self.typecode, 2*self.example)
@@ -851,6 +931,17 @@
         self.assertRaises(ValueError, a.index, None)
         self.assertRaises(ValueError, a.index, self.outside)
 
+        a = array.array('i', [-2, -1, 0, 0, 1, 2])
+        self.assertEqual(a.index(0), 2)
+        self.assertEqual(a.index(0, 2), 2)
+        self.assertEqual(a.index(0, -4), 2)
+        self.assertEqual(a.index(-2, -10), 0)
+        self.assertEqual(a.index(0, 3), 3)
+        self.assertEqual(a.index(0, -3), 3)
+        self.assertEqual(a.index(0, 3, 4), 3)
+        self.assertEqual(a.index(0, -3, -2), 3)
+        self.assertRaises(ValueError, a.index, 2, 0, -10)
+
     def test_count(self):
         example = 2*self.example
         a = array.array(self.typecode, example)
@@ -1006,6 +1097,7 @@
         p = weakref.proxy(s)
         self.assertEqual(p.tobytes(), s.tobytes())
         s = None
+        support.gc_collect()  # For PyPy or other GCs.
         self.assertRaises(ReferenceError, len, p)
 
     @unittest.skipUnless(hasattr(sys, 'getrefcount'),
diff --git a/Lib/test/test_asdl_parser.py b/Lib/test/test_asdl_parser.py
index 2c14817..2c198a6 100644
--- a/Lib/test/test_asdl_parser.py
+++ b/Lib/test/test_asdl_parser.py
@@ -1,6 +1,7 @@
 """Tests for the asdl parser in Parser/asdl.py"""
 
 import importlib.machinery
+import importlib.util
 import os
 from os.path import dirname
 import sys
@@ -26,7 +27,10 @@
         sys.path.insert(0, parser_dir)
         loader = importlib.machinery.SourceFileLoader(
                 'asdl', os.path.join(parser_dir, 'asdl.py'))
-        cls.asdl = loader.load_module()
+        spec = importlib.util.spec_from_loader('asdl', loader)
+        module = importlib.util.module_from_spec(spec)
+        loader.exec_module(module)
+        cls.asdl = module
         cls.mod = cls.asdl.parse(os.path.join(parser_dir, 'Python.asdl'))
         cls.assertTrue(cls.asdl.check(cls.mod), 'Module validation failed')
 
@@ -58,7 +62,9 @@
         alias = self.types['alias']
         self.assertEqual(
             str(alias),
-            'Product([Field(identifier, name), Field(identifier, asname, opt=True)])')
+            'Product([Field(identifier, name), Field(identifier, asname, opt=True)], '
+            '[Field(int, lineno), Field(int, col_offset), '
+            'Field(int, end_lineno, opt=True), Field(int, end_col_offset, opt=True)])')
 
     def test_attributes(self):
         stmt = self.types['stmt']
diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py
index 5f57ce8..95af9e2 100644
--- a/Lib/test/test_ast.py
+++ b/Lib/test/test_ast.py
@@ -273,6 +273,7 @@
                     self._assertTrueorder(child, first_pos)
             elif value is not None:
                 self._assertTrueorder(value, parent_pos)
+        self.assertEqual(ast_node._fields, ast_node.__match_args__)
 
     def test_AST_objects(self):
         x = ast.AST()
@@ -334,6 +335,26 @@
         mod.body[0].module = " __future__ ".strip()
         compile(mod, "<test>", "exec")
 
+    def test_alias(self):
+        im = ast.parse("from bar import y").body[0]
+        self.assertEqual(len(im.names), 1)
+        alias = im.names[0]
+        self.assertEqual(alias.name, 'y')
+        self.assertIsNone(alias.asname)
+        self.assertEqual(alias.lineno, 1)
+        self.assertEqual(alias.end_lineno, 1)
+        self.assertEqual(alias.col_offset, 16)
+        self.assertEqual(alias.end_col_offset, 17)
+
+        im = ast.parse("from bar import *").body[0]
+        alias = im.names[0]
+        self.assertEqual(alias.name, '*')
+        self.assertIsNone(alias.asname)
+        self.assertEqual(alias.lineno, 1)
+        self.assertEqual(alias.end_lineno, 1)
+        self.assertEqual(alias.col_offset, 16)
+        self.assertEqual(alias.end_col_offset, 17)
+
     def test_base_classes(self):
         self.assertTrue(issubclass(ast.For, ast.stmt))
         self.assertTrue(issubclass(ast.Name, ast.expr))
@@ -674,7 +695,7 @@
         for constant in "True", "False", "None":
             expr = ast.Expression(ast.Name(constant, ast.Load()))
             ast.fix_missing_locations(expr)
-            with self.assertRaisesRegex(ValueError, f"Name node can't be used with '{constant}' constant"):
+            with self.assertRaisesRegex(ValueError, f"identifier field can't represent '{constant}' constant"):
                 compile(expr, "<test>", "eval")
 
 
@@ -1005,6 +1026,31 @@
         malformed = ast.Dict(keys=[ast.Constant(1)], values=[ast.Constant(2), ast.Constant(3)])
         self.assertRaises(ValueError, ast.literal_eval, malformed)
 
+    def test_literal_eval_trailing_ws(self):
+        self.assertEqual(ast.literal_eval("    -1"), -1)
+        self.assertEqual(ast.literal_eval("\t\t-1"), -1)
+        self.assertEqual(ast.literal_eval(" \t -1"), -1)
+        self.assertRaises(IndentationError, ast.literal_eval, "\n -1")
+
+    def test_literal_eval_malformed_lineno(self):
+        msg = r'malformed node or string on line 3:'
+        with self.assertRaisesRegex(ValueError, msg):
+            ast.literal_eval("{'a': 1,\n'b':2,\n'c':++3,\n'd':4}")
+
+        node = ast.UnaryOp(
+            ast.UAdd(), ast.UnaryOp(ast.UAdd(), ast.Constant(6)))
+        self.assertIsNone(getattr(node, 'lineno', None))
+        msg = r'malformed node or string:'
+        with self.assertRaisesRegex(ValueError, msg):
+            ast.literal_eval(node)
+
+    def test_literal_eval_syntax_errors(self):
+        with self.assertRaisesRegex(SyntaxError, "unexpected indent"):
+            ast.literal_eval(r'''
+                \
+                (\
+            \ ''')
+
     def test_bad_integer(self):
         # issue13436: Bad error message with invalid numeric values
         body = [ast.ImportFrom(module='time',
@@ -1018,7 +1064,8 @@
 
     def test_level_as_none(self):
         body = [ast.ImportFrom(module='time',
-                               names=[ast.alias(name='sleep')],
+                               names=[ast.alias(name='sleep',
+                                                lineno=0, col_offset=0)],
                                level=None,
                                lineno=0, col_offset=0)]
         mod = ast.Module(body, [])
@@ -1027,6 +1074,22 @@
         exec(code, ns)
         self.assertIn('sleep', ns)
 
+    def test_recursion_direct(self):
+        e = ast.UnaryOp(op=ast.Not(), lineno=0, col_offset=0)
+        e.operand = e
+        with self.assertRaises(RecursionError):
+            with support.infinite_recursion():
+                compile(ast.Expression(e), "<test>", "eval")
+
+    def test_recursion_indirect(self):
+        e = ast.UnaryOp(op=ast.Not(), lineno=0, col_offset=0)
+        f = ast.UnaryOp(op=ast.Not(), lineno=0, col_offset=0)
+        e.operand = f
+        f.operand = e
+        with self.assertRaises(RecursionError):
+            with support.infinite_recursion():
+                compile(ast.Expression(e), "<test>", "eval")
+
 
 class ASTValidatorTests(unittest.TestCase):
 
@@ -1420,6 +1483,151 @@
                 mod = ast.parse(source, fn)
                 compile(mod, fn, "exec")
 
+    constant_1 = ast.Constant(1)
+    pattern_1 = ast.MatchValue(constant_1)
+
+    constant_x = ast.Constant('x')
+    pattern_x = ast.MatchValue(constant_x)
+
+    constant_true = ast.Constant(True)
+    pattern_true = ast.MatchSingleton(True)
+
+    name_carter = ast.Name('carter', ast.Load())
+
+    _MATCH_PATTERNS = [
+        ast.MatchValue(
+            ast.Attribute(
+                ast.Attribute(
+                    ast.Name('x', ast.Store()),
+                    'y', ast.Load()
+                ),
+                'z', ast.Load()
+            )
+        ),
+        ast.MatchValue(
+            ast.Attribute(
+                ast.Attribute(
+                    ast.Name('x', ast.Load()),
+                    'y', ast.Store()
+                ),
+                'z', ast.Load()
+            )
+        ),
+        ast.MatchValue(
+            ast.Constant(...)
+        ),
+        ast.MatchValue(
+            ast.Constant(True)
+        ),
+        ast.MatchValue(
+            ast.Constant((1,2,3))
+        ),
+        ast.MatchSingleton('string'),
+        ast.MatchSequence([
+          ast.MatchSingleton('string')
+        ]),
+        ast.MatchSequence(
+            [
+                ast.MatchSequence(
+                    [
+                        ast.MatchSingleton('string')
+                    ]
+                )
+            ]
+        ),
+        ast.MatchMapping(
+            [constant_1, constant_true],
+            [pattern_x]
+        ),
+        ast.MatchMapping(
+            [constant_true, constant_1],
+            [pattern_x, pattern_1],
+            rest='True'
+        ),
+        ast.MatchMapping(
+            [constant_true, ast.Starred(ast.Name('lol', ast.Load()), ast.Load())],
+            [pattern_x, pattern_1],
+            rest='legit'
+        ),
+        ast.MatchClass(
+            ast.Attribute(
+                ast.Attribute(
+                    constant_x,
+                    'y', ast.Load()),
+                'z', ast.Load()),
+            patterns=[], kwd_attrs=[], kwd_patterns=[]
+        ),
+        ast.MatchClass(
+            name_carter,
+            patterns=[],
+            kwd_attrs=['True'],
+            kwd_patterns=[pattern_1]
+        ),
+        ast.MatchClass(
+            name_carter,
+            patterns=[],
+            kwd_attrs=[],
+            kwd_patterns=[pattern_1]
+        ),
+        ast.MatchClass(
+            name_carter,
+            patterns=[ast.MatchSingleton('string')],
+            kwd_attrs=[],
+            kwd_patterns=[]
+        ),
+        ast.MatchClass(
+            name_carter,
+            patterns=[ast.MatchStar()],
+            kwd_attrs=[],
+            kwd_patterns=[]
+        ),
+        ast.MatchClass(
+            name_carter,
+            patterns=[],
+            kwd_attrs=[],
+            kwd_patterns=[ast.MatchStar()]
+        ),
+        ast.MatchSequence(
+            [
+                ast.MatchStar("True")
+            ]
+        ),
+        ast.MatchAs(
+            name='False'
+        ),
+        ast.MatchOr(
+            []
+        ),
+        ast.MatchOr(
+            [pattern_1]
+        ),
+        ast.MatchOr(
+            [pattern_1, pattern_x, ast.MatchSingleton('xxx')]
+        ),
+        ast.MatchAs(name="_"),
+        ast.MatchStar(name="x"),
+        ast.MatchSequence([ast.MatchStar("_")]),
+        ast.MatchMapping([], [], rest="_"),
+    ]
+
+    def test_match_validation_pattern(self):
+        name_x = ast.Name('x', ast.Load())
+        for pattern in self._MATCH_PATTERNS:
+            with self.subTest(ast.dump(pattern, indent=4)):
+                node = ast.Match(
+                    subject=name_x,
+                    cases = [
+                        ast.match_case(
+                            pattern=pattern,
+                            body = [ast.Pass()]
+                        )
+                    ]
+                )
+                node = ast.fix_missing_locations(node)
+                module = ast.Module([node], [])
+                with self.assertRaises(ValueError):
+                    compile(module, "<test>", "exec")
+
 
 class ConstantTests(unittest.TestCase):
     """Tests on the ast.Constant node type."""
@@ -1716,6 +1924,7 @@
         ''').strip()
         imp = ast.parse(s).body[0]
         self._check_end_pos(imp, 3, 1)
+        self._check_end_pos(imp.names[2], 2, 16)
 
     def test_slices(self):
         s1 = 'f()[1, 2] [0]'
@@ -2076,8 +2285,8 @@
 ('Module', [('Try', (1, 0, 4, 6), [('Pass', (2, 2, 2, 6))], [('ExceptHandler', (3, 0, 4, 6), ('Name', (3, 7, 3, 16), 'Exception', ('Load',)), None, [('Pass', (4, 2, 4, 6))])], [], [])], []),
 ('Module', [('Try', (1, 0, 4, 6), [('Pass', (2, 2, 2, 6))], [], [], [('Pass', (4, 2, 4, 6))])], []),
 ('Module', [('Assert', (1, 0, 1, 8), ('Name', (1, 7, 1, 8), 'v', ('Load',)), None)], []),
-('Module', [('Import', (1, 0, 1, 10), [('alias', 'sys', None)])], []),
-('Module', [('ImportFrom', (1, 0, 1, 17), 'sys', [('alias', 'v', None)], 0)], []),
+('Module', [('Import', (1, 0, 1, 10), [('alias', (1, 7, 1, 10), 'sys', None)])], []),
+('Module', [('ImportFrom', (1, 0, 1, 17), 'sys', [('alias', (1, 16, 1, 17), 'v', None)], 0)], []),
 ('Module', [('Global', (1, 0, 1, 8), ['v'])], []),
 ('Module', [('Expr', (1, 0, 1, 1), ('Constant', (1, 0, 1, 1), 1, None))], []),
 ('Module', [('Pass', (1, 0, 1, 4))], []),
diff --git a/Lib/test/test_asyncgen.py b/Lib/test/test_asyncgen.py
index 62bf877..473bce4 100644
--- a/Lib/test/test_asyncgen.py
+++ b/Lib/test/test_asyncgen.py
@@ -1,11 +1,16 @@
 import inspect
 import types
 import unittest
+import contextlib
 
-from test.support import import_module
+from test.support.import_helper import import_module
+from test.support import gc_collect
 asyncio = import_module("asyncio")
 
 
+_no_default = object()
+
+
 class AwaitException(Exception):
     pass
 
@@ -44,6 +49,37 @@
     return run_until_complete(iterate())
 
 
+def py_anext(iterator, default=_no_default):
+    """Pure-Python implementation of anext() for testing purposes.
+
+    Closely matches the builtin anext() C implementation.
+    Can be used to compare the built-in implementation of the inner
+    coroutines machinery to C-implementation of __anext__() and send()
+    or throw() on the returned generator.
+    """
+
+    try:
+        __anext__ = type(iterator).__anext__
+    except AttributeError:
+        raise TypeError(f'{iterator!r} is not an async iterator')
+
+    if default is _no_default:
+        return __anext__(iterator)
+
+    async def anext_impl():
+        try:
+            # The C code is way more low-level than this, as it implements
+            # all methods of the iterator protocol. In this implementation
+            # we're relying on higher-level coroutine concepts, but that's
+            # exactly what we want -- crosstest pure-Python high-level
+            # implementation and low-level C anext() iterators.
+            return await __anext__(iterator)
+        except StopAsyncIteration:
+            return default
+
+    return anext_impl()
+
+
 class AsyncGenSyntaxTest(unittest.TestCase):
 
     def test_async_gen_syntax_01(self):
@@ -372,6 +408,355 @@
         self.loop = None
         asyncio.set_event_loop_policy(None)
 
+    def check_async_iterator_anext(self, ait_class):
+        with self.subTest(anext="pure-Python"):
+            self._check_async_iterator_anext(ait_class, py_anext)
+        with self.subTest(anext="builtin"):
+            self._check_async_iterator_anext(ait_class, anext)
+
+    def _check_async_iterator_anext(self, ait_class, anext):
+        g = ait_class()
+        async def consume():
+            results = []
+            results.append(await anext(g))
+            results.append(await anext(g))
+            results.append(await anext(g, 'buckle my shoe'))
+            return results
+        res = self.loop.run_until_complete(consume())
+        self.assertEqual(res, [1, 2, 'buckle my shoe'])
+        with self.assertRaises(StopAsyncIteration):
+            self.loop.run_until_complete(consume())
+
+        async def test_2():
+            g1 = ait_class()
+            self.assertEqual(await anext(g1), 1)
+            self.assertEqual(await anext(g1), 2)
+            with self.assertRaises(StopAsyncIteration):
+                await anext(g1)
+            with self.assertRaises(StopAsyncIteration):
+                await anext(g1)
+
+            g2 = ait_class()
+            self.assertEqual(await anext(g2, "default"), 1)
+            self.assertEqual(await anext(g2, "default"), 2)
+            self.assertEqual(await anext(g2, "default"), "default")
+            self.assertEqual(await anext(g2, "default"), "default")
+
+            return "completed"
+
+        result = self.loop.run_until_complete(test_2())
+        self.assertEqual(result, "completed")
+
+        def test_send():
+            p = ait_class()
+            obj = anext(p, "completed")
+            with self.assertRaises(StopIteration):
+                with contextlib.closing(obj.__await__()) as g:
+                    g.send(None)
+
+        test_send()
+
+        async def test_throw():
+            p = ait_class()
+            obj = anext(p, "completed")
+            self.assertRaises(SyntaxError, obj.throw, SyntaxError)
+            return "completed"
+
+        result = self.loop.run_until_complete(test_throw())
+        self.assertEqual(result, "completed")
+
+    def test_async_generator_anext(self):
+        async def agen():
+            yield 1
+            yield 2
+        self.check_async_iterator_anext(agen)
+
+    def test_python_async_iterator_anext(self):
+        class MyAsyncIter:
+            """Asynchronously yield 1, then 2."""
+            def __init__(self):
+                self.yielded = 0
+            def __aiter__(self):
+                return self
+            async def __anext__(self):
+                if self.yielded >= 2:
+                    raise StopAsyncIteration()
+                else:
+                    self.yielded += 1
+                    return self.yielded
+        self.check_async_iterator_anext(MyAsyncIter)
+
+    def test_python_async_iterator_types_coroutine_anext(self):
+        import types
+        class MyAsyncIterWithTypesCoro:
+            """Asynchronously yield 1, then 2."""
+            def __init__(self):
+                self.yielded = 0
+            def __aiter__(self):
+                return self
+            @types.coroutine
+            def __anext__(self):
+                if False:
+                    yield "this is a generator-based coroutine"
+                if self.yielded >= 2:
+                    raise StopAsyncIteration()
+                else:
+                    self.yielded += 1
+                    return self.yielded
+        self.check_async_iterator_anext(MyAsyncIterWithTypesCoro)
+
+    def test_async_gen_aiter(self):
+        async def gen():
+            yield 1
+            yield 2
+        g = gen()
+        async def consume():
+            return [i async for i in aiter(g)]
+        res = self.loop.run_until_complete(consume())
+        self.assertEqual(res, [1, 2])
+
+    def test_async_gen_aiter_class(self):
+        results = []
+        class Gen:
+            async def __aiter__(self):
+                yield 1
+                yield 2
+        g = Gen()
+        async def consume():
+            ait = aiter(g)
+            while True:
+                try:
+                    results.append(await anext(ait))
+                except StopAsyncIteration:
+                    break
+        self.loop.run_until_complete(consume())
+        self.assertEqual(results, [1, 2])
+
+    def test_aiter_idempotent(self):
+        async def gen():
+            yield 1
+        applied_once = aiter(gen())
+        applied_twice = aiter(applied_once)
+        self.assertIs(applied_once, applied_twice)
+
+    def test_anext_bad_args(self):
+        async def gen():
+            yield 1
+        async def call_with_too_few_args():
+            await anext()
+        async def call_with_too_many_args():
+            await anext(gen(), 1, 3)
+        async def call_with_wrong_type_args():
+            await anext(1, gen())
+        async def call_with_kwarg():
+            await anext(aiterator=gen())
+        with self.assertRaises(TypeError):
+            self.loop.run_until_complete(call_with_too_few_args())
+        with self.assertRaises(TypeError):
+            self.loop.run_until_complete(call_with_too_many_args())
+        with self.assertRaises(TypeError):
+            self.loop.run_until_complete(call_with_wrong_type_args())
+        with self.assertRaises(TypeError):
+            self.loop.run_until_complete(call_with_kwarg())
+
+    def test_anext_bad_await(self):
+        async def bad_awaitable():
+            class BadAwaitable:
+                def __await__(self):
+                    return 42
+            class MyAsyncIter:
+                def __aiter__(self):
+                    return self
+                def __anext__(self):
+                    return BadAwaitable()
+            regex = r"__await__.*iterator"
+            awaitable = anext(MyAsyncIter(), "default")
+            with self.assertRaisesRegex(TypeError, regex):
+                await awaitable
+            awaitable = anext(MyAsyncIter())
+            with self.assertRaisesRegex(TypeError, regex):
+                await awaitable
+            return "completed"
+        result = self.loop.run_until_complete(bad_awaitable())
+        self.assertEqual(result, "completed")
+
+    async def check_anext_returning_iterator(self, aiter_class):
+        awaitable = anext(aiter_class(), "default")
+        with self.assertRaises(TypeError):
+            await awaitable
+        awaitable = anext(aiter_class())
+        with self.assertRaises(TypeError):
+            await awaitable
+        return "completed"
+
+    def test_anext_return_iterator(self):
+        class WithIterAnext:
+            def __aiter__(self):
+                return self
+            def __anext__(self):
+                return iter("abc")
+        result = self.loop.run_until_complete(self.check_anext_returning_iterator(WithIterAnext))
+        self.assertEqual(result, "completed")
+
+    def test_anext_return_generator(self):
+        class WithGenAnext:
+            def __aiter__(self):
+                return self
+            def __anext__(self):
+                yield
+        result = self.loop.run_until_complete(self.check_anext_returning_iterator(WithGenAnext))
+        self.assertEqual(result, "completed")
+
+    def test_anext_await_raises(self):
+        class RaisingAwaitable:
+            def __await__(self):
+                raise ZeroDivisionError()
+                yield
+        class WithRaisingAwaitableAnext:
+            def __aiter__(self):
+                return self
+            def __anext__(self):
+                return RaisingAwaitable()
+        async def do_test():
+            awaitable = anext(WithRaisingAwaitableAnext())
+            with self.assertRaises(ZeroDivisionError):
+                await awaitable
+            awaitable = anext(WithRaisingAwaitableAnext(), "default")
+            with self.assertRaises(ZeroDivisionError):
+                await awaitable
+            return "completed"
+        result = self.loop.run_until_complete(do_test())
+        self.assertEqual(result, "completed")
+
+    def test_anext_iter(self):
+        @types.coroutine
+        def _async_yield(v):
+            return (yield v)
+
+        class MyError(Exception):
+            pass
+
+        async def agenfn():
+            try:
+                await _async_yield(1)
+            except MyError:
+                await _async_yield(2)
+            return
+            yield
+
+        def test1(anext):
+            agen = agenfn()
+            with contextlib.closing(anext(agen, "default").__await__()) as g:
+                self.assertEqual(g.send(None), 1)
+                self.assertEqual(g.throw(MyError, MyError(), None), 2)
+                try:
+                    g.send(None)
+                except StopIteration as e:
+                    err = e
+                else:
+                    self.fail('StopIteration was not raised')
+                self.assertEqual(err.value, "default")
+
+        def test2(anext):
+            agen = agenfn()
+            with contextlib.closing(anext(agen, "default").__await__()) as g:
+                self.assertEqual(g.send(None), 1)
+                self.assertEqual(g.throw(MyError, MyError(), None), 2)
+                with self.assertRaises(MyError):
+                    g.throw(MyError, MyError(), None)
+
+        def test3(anext):
+            agen = agenfn()
+            with contextlib.closing(anext(agen, "default").__await__()) as g:
+                self.assertEqual(g.send(None), 1)
+                g.close()
+                with self.assertRaisesRegex(RuntimeError, 'cannot reuse'):
+                    self.assertEqual(g.send(None), 1)
+
+        def test4(anext):
+            @types.coroutine
+            def _async_yield(v):
+                yield v * 10
+                return (yield (v * 10 + 1))
+
+            async def agenfn():
+                try:
+                    await _async_yield(1)
+                except MyError:
+                    await _async_yield(2)
+                return
+                yield
+
+            agen = agenfn()
+            with contextlib.closing(anext(agen, "default").__await__()) as g:
+                self.assertEqual(g.send(None), 10)
+                self.assertEqual(g.throw(MyError, MyError(), None), 20)
+                with self.assertRaisesRegex(MyError, 'val'):
+                    g.throw(MyError, MyError('val'), None)
+
+        def test5(anext):
+            @types.coroutine
+            def _async_yield(v):
+                yield v * 10
+                return (yield (v * 10 + 1))
+
+            async def agenfn():
+                try:
+                    await _async_yield(1)
+                except MyError:
+                    return
+                yield 'aaa'
+
+            agen = agenfn()
+            with contextlib.closing(anext(agen, "default").__await__()) as g:
+                self.assertEqual(g.send(None), 10)
+                with self.assertRaisesRegex(StopIteration, 'default'):
+                    g.throw(MyError, MyError(), None)
+
+        def test6(anext):
+            @types.coroutine
+            def _async_yield(v):
+                yield v * 10
+                return (yield (v * 10 + 1))
+
+            async def agenfn():
+                await _async_yield(1)
+                yield 'aaa'
+
+            agen = agenfn()
+            with contextlib.closing(anext(agen, "default").__await__()) as g:
+                with self.assertRaises(MyError):
+                    g.throw(MyError, MyError(), None)
+
+        def run_test(test):
+            with self.subTest('pure-Python anext()'):
+                test(py_anext)
+            with self.subTest('builtin anext()'):
+                test(anext)
+
+        run_test(test1)
+        run_test(test2)
+        run_test(test3)
+        run_test(test4)
+        run_test(test5)
+        run_test(test6)
+
+    def test_aiter_bad_args(self):
+        async def gen():
+            yield 1
+        async def call_with_too_few_args():
+            await aiter()
+        async def call_with_too_many_args():
+            await aiter(gen(), 1)
+        async def call_with_wrong_type_arg():
+            await aiter(1)
+        with self.assertRaises(TypeError):
+            self.loop.run_until_complete(call_with_too_few_args())
+        with self.assertRaises(TypeError):
+            self.loop.run_until_complete(call_with_too_many_args())
+        with self.assertRaises(TypeError):
+            self.loop.run_until_complete(call_with_wrong_type_arg())
+
     async def to_list(self, gen):
         res = []
         async for i in gen:
@@ -659,6 +1044,7 @@
             await g.__anext__()
             await g.__anext__()
             del g
+            gc_collect()  # For PyPy or other GCs.
 
             await asyncio.sleep(0.1)
 
@@ -1075,6 +1461,85 @@
 
         self.assertEqual(finalized, 2)
 
+    def test_async_gen_asyncio_shutdown_02(self):
+        messages = []
+
+        def exception_handler(loop, context):
+            messages.append(context)
+
+        async def async_iterate():
+            yield 1
+            yield 2
+
+        it = async_iterate()
+        async def main():
+            loop = asyncio.get_running_loop()
+            loop.set_exception_handler(exception_handler)
+
+            async for i in it:
+                break
+
+        asyncio.run(main())
+
+        self.assertEqual(messages, [])
+
+    def test_async_gen_asyncio_shutdown_exception_01(self):
+        messages = []
+
+        def exception_handler(loop, context):
+            messages.append(context)
+
+        async def async_iterate():
+            try:
+                yield 1
+                yield 2
+            finally:
+                1/0
+
+        it = async_iterate()
+        async def main():
+            loop = asyncio.get_running_loop()
+            loop.set_exception_handler(exception_handler)
+
+            async for i in it:
+                break
+
+        asyncio.run(main())
+
+        message, = messages
+        self.assertEqual(message['asyncgen'], it)
+        self.assertIsInstance(message['exception'], ZeroDivisionError)
+        self.assertIn('an error occurred during closing of asynchronous generator',
+                      message['message'])
+
+    def test_async_gen_asyncio_shutdown_exception_02(self):
+        messages = []
+
+        def exception_handler(loop, context):
+            messages.append(context)
+
+        async def async_iterate():
+            try:
+                yield 1
+                yield 2
+            finally:
+                1/0
+
+        async def main():
+            loop = asyncio.get_running_loop()
+            loop.set_exception_handler(exception_handler)
+
+            async for i in async_iterate():
+                break
+            gc_collect()
+
+        asyncio.run(main())
+
+        message, = messages
+        self.assertIsInstance(message['exception'], ZeroDivisionError)
+        self.assertIn('unhandled exception during asyncio.run() shutdown',
+                      message['message'])
+
     def test_async_gen_expression_01(self):
         async def arange(n):
             for i in range(n):
diff --git a/Lib/test/test_asynchat.py b/Lib/test/test_asynchat.py
index 004d368..973ac1f 100644
--- a/Lib/test/test_asynchat.py
+++ b/Lib/test/test_asynchat.py
@@ -2,9 +2,8 @@
 
 from test import support
 from test.support import socket_helper
+from test.support import threading_helper
 
-import asynchat
-import asyncore
 import errno
 import socket
 import sys
@@ -13,6 +12,12 @@
 import unittest
 import unittest.mock
 
+import warnings
+with warnings.catch_warnings():
+    warnings.simplefilter('ignore', DeprecationWarning)
+    import asynchat
+    import asyncore
+
 HOST = socket_helper.HOST
 SERVER_QUIT = b'QUIT\n'
 
@@ -103,10 +108,10 @@
     usepoll = False
 
     def setUp(self):
-        self._threads = support.threading_setup()
+        self._threads = threading_helper.threading_setup()
 
     def tearDown(self):
-        support.threading_cleanup(*self._threads)
+        threading_helper.threading_cleanup(*self._threads)
 
     def line_terminator_check(self, term, server_chunk):
         event = threading.Event()
@@ -122,7 +127,7 @@
         c.push(b"I'm not dead yet!" + term)
         c.push(SERVER_QUIT)
         asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01)
-        support.join_thread(s)
+        threading_helper.join_thread(s)
 
         self.assertEqual(c.contents, [b"hello world", b"I'm not dead yet!"])
 
@@ -153,7 +158,7 @@
         c.push(data)
         c.push(SERVER_QUIT)
         asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01)
-        support.join_thread(s)
+        threading_helper.join_thread(s)
 
         self.assertEqual(c.contents, [data[:termlen]])
 
@@ -173,7 +178,7 @@
         c.push(data)
         c.push(SERVER_QUIT)
         asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01)
-        support.join_thread(s)
+        threading_helper.join_thread(s)
 
         self.assertEqual(c.contents, [])
         self.assertEqual(c.buffer, data)
@@ -185,7 +190,7 @@
         p = asynchat.simple_producer(data+SERVER_QUIT, buffer_size=8)
         c.push_with_producer(p)
         asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01)
-        support.join_thread(s)
+        threading_helper.join_thread(s)
 
         self.assertEqual(c.contents, [b"hello world", b"I'm not dead yet!"])
 
@@ -195,7 +200,7 @@
         data = b"hello world\nI'm not dead yet!\n"
         c.push_with_producer(data+SERVER_QUIT)
         asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01)
-        support.join_thread(s)
+        threading_helper.join_thread(s)
 
         self.assertEqual(c.contents, [b"hello world", b"I'm not dead yet!"])
 
@@ -206,7 +211,7 @@
         c.push(b"hello world\n\nI'm not dead yet!\n")
         c.push(SERVER_QUIT)
         asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01)
-        support.join_thread(s)
+        threading_helper.join_thread(s)
 
         self.assertEqual(c.contents,
                          [b"hello world", b"", b"I'm not dead yet!"])
@@ -225,7 +230,7 @@
         # where the server echoes all of its data before we can check that it
         # got any down below.
         s.start_resend_event.set()
-        support.join_thread(s)
+        threading_helper.join_thread(s)
 
         self.assertEqual(c.contents, [])
         # the server might have been able to send a byte or two back, but this
@@ -246,7 +251,7 @@
         self.assertRaises(TypeError, c.push, 'unicode')
         c.push(SERVER_QUIT)
         asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01)
-        support.join_thread(s)
+        threading_helper.join_thread(s)
         self.assertEqual(c.contents, [b'bytes', b'bytes', b'bytes'])
 
 
diff --git a/Lib/test/test_asyncio/__init__.py b/Lib/test/test_asyncio/__init__.py
index c77c7a8..5d41504 100644
--- a/Lib/test/test_asyncio/__init__.py
+++ b/Lib/test/test_asyncio/__init__.py
@@ -1,8 +1,10 @@
 import os
-from test.support import load_package_tests, import_module
+from test.support import load_package_tests
+from test.support import import_helper
+
 
 # Skip tests if we don't have concurrent.futures.
-import_module('concurrent.futures')
+import_helper.import_module('concurrent.futures')
 
 def load_tests(*args):
     return load_package_tests(os.path.dirname(__file__), *args)
diff --git a/Lib/test/test_asyncio/functional.py b/Lib/test/test_asyncio/functional.py
index 5cd0659..d19c7a6 100644
--- a/Lib/test/test_asyncio/functional.py
+++ b/Lib/test/test_asyncio/functional.py
@@ -29,10 +29,6 @@
         self.loop.set_exception_handler(self.loop_exception_handler)
         self.__unhandled_exceptions = []
 
-        # Disable `_get_running_loop`.
-        self._old_get_running_loop = asyncio.events._get_running_loop
-        asyncio.events._get_running_loop = lambda: None
-
     def tearDown(self):
         try:
             self.loop.close()
@@ -43,7 +39,6 @@
                 self.fail('unexpected calls to loop.call_exception_handler()')
 
         finally:
-            asyncio.events._get_running_loop = self._old_get_running_loop
             asyncio.set_event_loop(None)
             self.loop = None
 
@@ -248,7 +243,7 @@
                     conn, addr = self._sock.accept()
                 except BlockingIOError:
                     continue
-                except socket.timeout:
+                except TimeoutError:
                     if not self._active:
                         return
                     else:
diff --git a/Lib/test/test_asyncio/test_asyncio_waitfor.py b/Lib/test/test_asyncio/test_asyncio_waitfor.py
new file mode 100644
index 0000000..2ca64ab
--- /dev/null
+++ b/Lib/test/test_asyncio/test_asyncio_waitfor.py
@@ -0,0 +1,61 @@
+import asyncio
+import unittest
+import time
+
+def tearDownModule():
+    asyncio.set_event_loop_policy(None)
+
+
+class SlowTask:
+    """ Task will run for this defined time, ignoring cancel requests """
+    TASK_TIMEOUT = 0.2
+
+    def __init__(self):
+        self.exited = False
+
+    async def run(self):
+        exitat = time.monotonic() + self.TASK_TIMEOUT
+
+        while True:
+            tosleep = exitat - time.monotonic()
+            if tosleep <= 0:
+                break
+
+            try:
+                await asyncio.sleep(tosleep)
+            except asyncio.CancelledError:
+                pass
+
+        self.exited = True
+
+class AsyncioWaitForTest(unittest.TestCase):
+
+    async def atest_asyncio_wait_for_cancelled(self):
+        t  = SlowTask()
+
+        waitfortask = asyncio.create_task(asyncio.wait_for(t.run(), t.TASK_TIMEOUT * 2))
+        await asyncio.sleep(0)
+        waitfortask.cancel()
+        await asyncio.wait({waitfortask})
+
+        self.assertTrue(t.exited)
+
+    def test_asyncio_wait_for_cancelled(self):
+        asyncio.run(self.atest_asyncio_wait_for_cancelled())
+
+    async def atest_asyncio_wait_for_timeout(self):
+        t  = SlowTask()
+
+        try:
+            await asyncio.wait_for(t.run(), t.TASK_TIMEOUT / 2)
+        except asyncio.TimeoutError:
+            pass
+
+        self.assertTrue(t.exited)
+
+    def test_asyncio_wait_for_timeout(self):
+        asyncio.run(self.atest_asyncio_wait_for_timeout())
+
+
+if __name__ == '__main__':
+    unittest.main()
diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py
index 533d5cc..d77bf95 100644
--- a/Lib/test/test_asyncio/test_base_events.py
+++ b/Lib/test/test_asyncio/test_base_events.py
@@ -16,8 +16,9 @@
 from test.test_asyncio import utils as test_utils
 from test import support
 from test.support.script_helper import assert_python_ok
+from test.support import os_helper
 from test.support import socket_helper
-
+import warnings
 
 MOCK_ANY = mock.ANY
 PY34 = sys.version_info >= (3, 4)
@@ -642,7 +643,7 @@
                                 'Exception in callback.*zero'),
                         exc_info=(ZeroDivisionError, MOCK_ANY, MOCK_ANY))
 
-        assert not mock_handler.called
+        self.assertFalse(mock_handler.called)
 
     def test_set_exc_handler_broken(self):
         def run_loop():
@@ -800,6 +801,17 @@
         task._log_destroy_pending = False
         coro.close()
 
+    def test_create_task_error_closes_coro(self):
+        async def test():
+            pass
+        loop = asyncio.new_event_loop()
+        loop.close()
+        with warnings.catch_warnings(record=True) as w:
+            with self.assertRaises(RuntimeError):
+                asyncio.ensure_future(test(), loop=loop)
+            self.assertEqual(len(w), 0)
+
+
     def test_create_named_task_with_default_factory(self):
         async def test():
             pass
@@ -1002,22 +1014,26 @@
         if create_future:
             self.done = asyncio.get_running_loop().create_future()
 
+    def _assert_state(self, *expected):
+        if self.state not in expected:
+            raise AssertionError(f'state: {self.state!r}, expected: {expected!r}')
+
     def connection_made(self, transport):
         self.transport = transport
-        assert self.state == 'INITIAL', self.state
+        self._assert_state('INITIAL')
         self.state = 'CONNECTED'
         transport.write(b'GET / HTTP/1.0\r\nHost: example.com\r\n\r\n')
 
     def data_received(self, data):
-        assert self.state == 'CONNECTED', self.state
+        self._assert_state('CONNECTED')
         self.nbytes += len(data)
 
     def eof_received(self):
-        assert self.state == 'CONNECTED', self.state
+        self._assert_state('CONNECTED')
         self.state = 'EOF'
 
     def connection_lost(self, exc):
-        assert self.state in ('CONNECTED', 'EOF'), self.state
+        self._assert_state('CONNECTED', 'EOF')
         self.state = 'CLOSED'
         if self.done:
             self.done.set_result(None)
@@ -1032,20 +1048,24 @@
         if create_future:
             self.done = loop.create_future()
 
+    def _assert_state(self, expected):
+        if self.state != expected:
+            raise AssertionError(f'state: {self.state!r}, expected: {expected!r}')
+
     def connection_made(self, transport):
         self.transport = transport
-        assert self.state == 'INITIAL', self.state
+        self._assert_state('INITIAL')
         self.state = 'INITIALIZED'
 
     def datagram_received(self, data, addr):
-        assert self.state == 'INITIALIZED', self.state
+        self._assert_state('INITIALIZED')
         self.nbytes += len(data)
 
     def error_received(self, exc):
-        assert self.state == 'INITIALIZED', self.state
+        self._assert_state('INITIALIZED')
 
     def connection_lost(self, exc):
-        assert self.state == 'INITIALIZED', self.state
+        self._assert_state('INITIALIZED')
         self.state = 'CLOSED'
         if self.done:
             self.done.set_result(None)
@@ -1159,9 +1179,7 @@
     @unittest.skipUnless(socket_helper.IPV6_ENABLED, 'no IPv6 support')
     def test_create_server_ipv6(self):
         async def main():
-            with self.assertWarns(DeprecationWarning):
-                srv = await asyncio.start_server(
-                    lambda: None, '::1', 0, loop=self.loop)
+            srv = await asyncio.start_server(lambda: None, '::1', 0)
             try:
                 self.assertGreater(len(srv.sockets), 0)
             finally:
@@ -1396,7 +1414,7 @@
         addr = ('00:01:02:03:04:05', 1)
 
         def getaddrinfo(host, port, *args, **kw):
-            assert (host, port) == addr
+            self.assertEqual((host, port), addr)
             return [(999, 1, 999, '', (addr, 1))]
 
         m_socket.getaddrinfo = getaddrinfo
@@ -1695,7 +1713,7 @@
             lambda: MyDatagramProto(create_future=True, loop=self.loop),
             family=socket.AF_UNIX)
         transport, protocol = self.loop.run_until_complete(fut)
-        assert transport._sock.family == socket.AF_UNIX
+        self.assertEqual(transport._sock.family, socket.AF_UNIX)
         transport.close()
         self.loop.run_until_complete(protocol.done)
         self.assertEqual('CLOSED', protocol.state)
@@ -1746,6 +1764,8 @@
             MyDatagramProto, allow_broadcast=True, sock=FakeSock())
         self.assertRaises(ValueError, self.loop.run_until_complete, fut)
 
+    @unittest.skipIf(sys.platform == 'vxworks',
+                    "SO_BROADCAST is enabled by default on VxWorks")
     def test_create_datagram_endpoint_sockopts(self):
         # Socket options should not be applied unless asked for.
         # SO_REUSEPORT is not available on all platforms.
@@ -1983,14 +2003,14 @@
     def setUpClass(cls):
         cls.__old_bufsize = constants.SENDFILE_FALLBACK_READBUFFER_SIZE
         constants.SENDFILE_FALLBACK_READBUFFER_SIZE = 1024 * 16
-        with open(support.TESTFN, 'wb') as fp:
+        with open(os_helper.TESTFN, 'wb') as fp:
             fp.write(cls.DATA)
         super().setUpClass()
 
     @classmethod
     def tearDownClass(cls):
         constants.SENDFILE_FALLBACK_READBUFFER_SIZE = cls.__old_bufsize
-        support.unlink(support.TESTFN)
+        os_helper.unlink(os_helper.TESTFN)
         super().tearDownClass()
 
     def setUp(self):
@@ -1998,7 +2018,7 @@
         # BaseSelectorEventLoop() has no native implementation
         self.loop = BaseSelectorEventLoop()
         self.set_event_loop(self.loop)
-        self.file = open(support.TESTFN, 'rb')
+        self.file = open(os_helper.TESTFN, 'rb')
         self.addCleanup(self.file.close)
         super().setUp()
 
@@ -2095,7 +2115,7 @@
 
     def test_nonbinary_file(self):
         sock = self.make_socket()
-        with open(support.TESTFN, 'r') as f:
+        with open(os_helper.TESTFN, encoding="utf-8") as f:
             with self.assertRaisesRegex(ValueError, "binary mode"):
                 self.run_loop(self.loop.sock_sendfile(sock, f))
 
diff --git a/Lib/test/test_asyncio/test_context.py b/Lib/test/test_asyncio/test_context.py
index 63b1eb3..6b80721 100644
--- a/Lib/test/test_asyncio/test_context.py
+++ b/Lib/test/test_asyncio/test_context.py
@@ -32,3 +32,7 @@
 
         self.assertEqual(str(r2[0]), '0.333333')
         self.assertEqual(str(r2[1]), '0.111111')
+
+
+if __name__ == '__main__':
+    unittest.main()
diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py
index fa6c49d..bed7b5d 100644
--- a/Lib/test/test_asyncio/test_events.py
+++ b/Lib/test/test_asyncio/test_events.py
@@ -22,7 +22,7 @@
 from unittest import mock
 import weakref
 
-if sys.platform != 'win32':
+if sys.platform not in ('win32', 'vxworks'):
     import tty
 
 import asyncio
@@ -33,6 +33,7 @@
 from test.test_asyncio import utils as test_utils
 from test import support
 from test.support import socket_helper
+from test.support import threading_helper
 from test.support import ALWAYS_EQ, LARGEST, SMALLEST
 
 
@@ -86,23 +87,27 @@
             self.connected = loop.create_future()
             self.done = loop.create_future()
 
+    def _assert_state(self, *expected):
+        if self.state not in expected:
+            raise AssertionError(f'state: {self.state!r}, expected: {expected!r}')
+
     def connection_made(self, transport):
         self.transport = transport
-        assert self.state == 'INITIAL', self.state
+        self._assert_state('INITIAL')
         self.state = 'CONNECTED'
         if self.connected:
             self.connected.set_result(None)
 
     def data_received(self, data):
-        assert self.state == 'CONNECTED', self.state
+        self._assert_state('CONNECTED')
         self.nbytes += len(data)
 
     def eof_received(self):
-        assert self.state == 'CONNECTED', self.state
+        self._assert_state('CONNECTED')
         self.state = 'EOF'
 
     def connection_lost(self, exc):
-        assert self.state in ('CONNECTED', 'EOF'), self.state
+        self._assert_state('CONNECTED', 'EOF')
         self.state = 'CLOSED'
         if self.done:
             self.done.set_result(None)
@@ -123,20 +128,24 @@
         if loop is not None:
             self.done = loop.create_future()
 
+    def _assert_state(self, expected):
+        if self.state != expected:
+            raise AssertionError(f'state: {self.state!r}, expected: {expected!r}')
+
     def connection_made(self, transport):
         self.transport = transport
-        assert self.state == 'INITIAL', self.state
+        self._assert_state('INITIAL')
         self.state = 'INITIALIZED'
 
     def datagram_received(self, data, addr):
-        assert self.state == 'INITIALIZED', self.state
+        self._assert_state('INITIALIZED')
         self.nbytes += len(data)
 
     def error_received(self, exc):
-        assert self.state == 'INITIALIZED', self.state
+        self._assert_state('INITIALIZED')
 
     def connection_lost(self, exc):
-        assert self.state == 'INITIALIZED', self.state
+        self._assert_state('INITIALIZED')
         self.state = 'CLOSED'
         if self.done:
             self.done.set_result(None)
@@ -152,23 +161,27 @@
         if loop is not None:
             self.done = loop.create_future()
 
+    def _assert_state(self, expected):
+        if self.state != expected:
+            raise AssertionError(f'state: {self.state!r}, expected: {expected!r}')
+
     def connection_made(self, transport):
         self.transport = transport
-        assert self.state == ['INITIAL'], self.state
+        self._assert_state(['INITIAL'])
         self.state.append('CONNECTED')
 
     def data_received(self, data):
-        assert self.state == ['INITIAL', 'CONNECTED'], self.state
+        self._assert_state(['INITIAL', 'CONNECTED'])
         self.nbytes += len(data)
 
     def eof_received(self):
-        assert self.state == ['INITIAL', 'CONNECTED'], self.state
+        self._assert_state(['INITIAL', 'CONNECTED'])
         self.state.append('EOF')
 
     def connection_lost(self, exc):
         if 'EOF' not in self.state:
             self.state.append('EOF')  # It is okay if EOF is missed.
-        assert self.state == ['INITIAL', 'CONNECTED', 'EOF'], self.state
+        self._assert_state(['INITIAL', 'CONNECTED', 'EOF'])
         self.state.append('CLOSED')
         if self.done:
             self.done.set_result(None)
@@ -183,13 +196,17 @@
         if loop is not None:
             self.done = loop.create_future()
 
+    def _assert_state(self, expected):
+        if self.state != expected:
+            raise AssertionError(f'state: {self.state!r}, expected: {expected!r}')
+
     def connection_made(self, transport):
         self.transport = transport
-        assert self.state == 'INITIAL', self.state
+        self._assert_state('INITIAL')
         self.state = 'CONNECTED'
 
     def connection_lost(self, exc):
-        assert self.state == 'CONNECTED', self.state
+        self._assert_state('CONNECTED')
         self.state = 'CLOSED'
         if self.done:
             self.done.set_result(None)
@@ -205,34 +222,38 @@
         self.disconnects = {fd: loop.create_future() for fd in range(3)}
         self.data = {1: b'', 2: b''}
         self.returncode = None
-        self.got_data = {1: asyncio.Event(loop=loop),
-                         2: asyncio.Event(loop=loop)}
+        self.got_data = {1: asyncio.Event(),
+                         2: asyncio.Event()}
+
+    def _assert_state(self, expected):
+        if self.state != expected:
+            raise AssertionError(f'state: {self.state!r}, expected: {expected!r}')
 
     def connection_made(self, transport):
         self.transport = transport
-        assert self.state == 'INITIAL', self.state
+        self._assert_state('INITIAL')
         self.state = 'CONNECTED'
         self.connected.set_result(None)
 
     def connection_lost(self, exc):
-        assert self.state == 'CONNECTED', self.state
+        self._assert_state('CONNECTED')
         self.state = 'CLOSED'
         self.completed.set_result(None)
 
     def pipe_data_received(self, fd, data):
-        assert self.state == 'CONNECTED', self.state
+        self._assert_state('CONNECTED')
         self.data[fd] += data
         self.got_data[fd].set()
 
     def pipe_connection_lost(self, fd, exc):
-        assert self.state == 'CONNECTED', self.state
+        self._assert_state('CONNECTED')
         if exc:
             self.disconnects[fd].set_exception(exc)
         else:
             self.disconnects[fd].set_result(exc)
 
     def process_exited(self):
-        assert self.state == 'CONNECTED', self.state
+        self._assert_state('CONNECTED')
         self.returncode = self.transport.get_returncode()
 
 
@@ -464,6 +485,8 @@
         self.assertFalse(self.loop.remove_signal_handler(signal.SIGINT))
 
     @unittest.skipUnless(hasattr(signal, 'SIGALRM'), 'No SIGALRM')
+    @unittest.skipUnless(hasattr(signal, 'setitimer'),
+                         'need signal.setitimer()')
     def test_signal_handling_while_selecting(self):
         # Test with a signal actually arriving during a select() call.
         caught = 0
@@ -481,6 +504,8 @@
         self.assertEqual(caught, 1)
 
     @unittest.skipUnless(hasattr(signal, 'SIGALRM'), 'No SIGALRM')
+    @unittest.skipUnless(hasattr(signal, 'setitimer'),
+                         'need signal.setitimer()')
     def test_signal_handling_args(self):
         some_args = (42,)
         caught = 0
@@ -703,7 +728,7 @@
         proto.transport.close()
         lsock.close()
 
-        support.join_thread(thread)
+        threading_helper.join_thread(thread)
         self.assertFalse(thread.is_alive())
         self.assertEqual(proto.state, 'CLOSED')
         self.assertEqual(proto.nbytes, len(message))
@@ -1278,7 +1303,7 @@
             else:
                 break
         else:
-            assert False, 'Can not create socket.'
+            self.fail('Can not create socket.')
 
         f = self.loop.create_datagram_endpoint(
             lambda: MyDatagramProto(loop=self.loop), sock=sock)
@@ -1344,7 +1369,7 @@
 
         rpipe, wpipe = os.pipe()
         rpipeobj = io.open(rpipe, 'rb', 1024)
-        wpipeobj = io.open(wpipe, 'w', 1024)
+        wpipeobj = io.open(wpipe, 'w', 1024, encoding="utf-8")
 
         async def connect():
             read_transport, _ = await loop.connect_read_pipe(
@@ -1370,6 +1395,7 @@
 
     @unittest.skipUnless(sys.platform != 'win32',
                          "Don't support pipes for Windows")
+    @unittest.skipUnless(hasattr(os, 'openpty'), 'need os.openpty()')
     def test_read_pty_output(self):
         proto = MyReadPipeProto(loop=self.loop)
 
@@ -1467,6 +1493,7 @@
 
     @unittest.skipUnless(sys.platform != 'win32',
                          "Don't support pipes for Windows")
+    @unittest.skipUnless(hasattr(os, 'openpty'), 'need os.openpty()')
     # select, poll and kqueue don't support character devices (PTY) on Mac OS X
     # older than 10.6 (Snow Leopard)
     @support.requires_mac_ver(10, 6)
@@ -1511,6 +1538,7 @@
 
     @unittest.skipUnless(sys.platform != 'win32',
                          "Don't support pipes for Windows")
+    @unittest.skipUnless(hasattr(os, 'openpty'), 'need os.openpty()')
     # select, poll and kqueue don't support character devices (PTY) on Mac OS X
     # older than 10.6 (Snow Leopard)
     @support.requires_mac_ver(10, 6)
@@ -1736,20 +1764,20 @@
         connect = self.loop.subprocess_exec(
                         functools.partial(MySubprocessProtocol, self.loop),
                         sys.executable, prog)
-        with self.assertWarns(DeprecationWarning):
-            transp, proto = self.loop.run_until_complete(connect)
-            self.assertIsInstance(proto, MySubprocessProtocol)
-            self.loop.run_until_complete(proto.connected)
-            self.assertEqual('CONNECTED', proto.state)
 
-            stdin = transp.get_pipe_transport(0)
-            stdin.write(b'Python The Winner')
-            self.loop.run_until_complete(proto.got_data[1].wait())
-            with test_utils.disable_logger():
-                transp.close()
-            self.loop.run_until_complete(proto.completed)
-            self.check_killed(proto.returncode)
-            self.assertEqual(b'Python The Winner', proto.data[1])
+        transp, proto = self.loop.run_until_complete(connect)
+        self.assertIsInstance(proto, MySubprocessProtocol)
+        self.loop.run_until_complete(proto.connected)
+        self.assertEqual('CONNECTED', proto.state)
+
+        stdin = transp.get_pipe_transport(0)
+        stdin.write(b'Python The Winner')
+        self.loop.run_until_complete(proto.got_data[1].wait())
+        with test_utils.disable_logger():
+            transp.close()
+        self.loop.run_until_complete(proto.completed)
+        self.check_killed(proto.returncode)
+        self.assertEqual(b'Python The Winner', proto.data[1])
 
     def test_subprocess_interactive(self):
         prog = os.path.join(os.path.dirname(__file__), 'echo.py')
@@ -1758,51 +1786,48 @@
                         functools.partial(MySubprocessProtocol, self.loop),
                         sys.executable, prog)
 
-        with self.assertWarns(DeprecationWarning):
-            transp, proto = self.loop.run_until_complete(connect)
-            self.assertIsInstance(proto, MySubprocessProtocol)
-            self.loop.run_until_complete(proto.connected)
-            self.assertEqual('CONNECTED', proto.state)
+        transp, proto = self.loop.run_until_complete(connect)
+        self.assertIsInstance(proto, MySubprocessProtocol)
+        self.loop.run_until_complete(proto.connected)
+        self.assertEqual('CONNECTED', proto.state)
 
-            stdin = transp.get_pipe_transport(0)
-            stdin.write(b'Python ')
-            self.loop.run_until_complete(proto.got_data[1].wait())
-            proto.got_data[1].clear()
-            self.assertEqual(b'Python ', proto.data[1])
+        stdin = transp.get_pipe_transport(0)
+        stdin.write(b'Python ')
+        self.loop.run_until_complete(proto.got_data[1].wait())
+        proto.got_data[1].clear()
+        self.assertEqual(b'Python ', proto.data[1])
 
-            stdin.write(b'The Winner')
-            self.loop.run_until_complete(proto.got_data[1].wait())
-            self.assertEqual(b'Python The Winner', proto.data[1])
+        stdin.write(b'The Winner')
+        self.loop.run_until_complete(proto.got_data[1].wait())
+        self.assertEqual(b'Python The Winner', proto.data[1])
 
-            with test_utils.disable_logger():
-                transp.close()
-            self.loop.run_until_complete(proto.completed)
-            self.check_killed(proto.returncode)
+        with test_utils.disable_logger():
+            transp.close()
+        self.loop.run_until_complete(proto.completed)
+        self.check_killed(proto.returncode)
 
     def test_subprocess_shell(self):
-        with self.assertWarns(DeprecationWarning):
-            connect = self.loop.subprocess_shell(
-                            functools.partial(MySubprocessProtocol, self.loop),
-                            'echo Python')
-            transp, proto = self.loop.run_until_complete(connect)
-            self.assertIsInstance(proto, MySubprocessProtocol)
-            self.loop.run_until_complete(proto.connected)
+        connect = self.loop.subprocess_shell(
+                        functools.partial(MySubprocessProtocol, self.loop),
+                        'echo Python')
+        transp, proto = self.loop.run_until_complete(connect)
+        self.assertIsInstance(proto, MySubprocessProtocol)
+        self.loop.run_until_complete(proto.connected)
 
-            transp.get_pipe_transport(0).close()
-            self.loop.run_until_complete(proto.completed)
-            self.assertEqual(0, proto.returncode)
-            self.assertTrue(all(f.done() for f in proto.disconnects.values()))
-            self.assertEqual(proto.data[1].rstrip(b'\r\n'), b'Python')
-            self.assertEqual(proto.data[2], b'')
-            transp.close()
+        transp.get_pipe_transport(0).close()
+        self.loop.run_until_complete(proto.completed)
+        self.assertEqual(0, proto.returncode)
+        self.assertTrue(all(f.done() for f in proto.disconnects.values()))
+        self.assertEqual(proto.data[1].rstrip(b'\r\n'), b'Python')
+        self.assertEqual(proto.data[2], b'')
+        transp.close()
 
     def test_subprocess_exitcode(self):
         connect = self.loop.subprocess_shell(
                         functools.partial(MySubprocessProtocol, self.loop),
                         'exit 7', stdin=None, stdout=None, stderr=None)
 
-        with self.assertWarns(DeprecationWarning):
-            transp, proto = self.loop.run_until_complete(connect)
+        transp, proto = self.loop.run_until_complete(connect)
         self.assertIsInstance(proto, MySubprocessProtocol)
         self.loop.run_until_complete(proto.completed)
         self.assertEqual(7, proto.returncode)
@@ -1812,8 +1837,8 @@
         connect = self.loop.subprocess_shell(
                         functools.partial(MySubprocessProtocol, self.loop),
                         'exit 7', stdin=None, stdout=None, stderr=None)
-        with self.assertWarns(DeprecationWarning):
-            transp, proto = self.loop.run_until_complete(connect)
+
+        transp, proto = self.loop.run_until_complete(connect)
         self.assertIsInstance(proto, MySubprocessProtocol)
         self.assertIsNone(transp.get_pipe_transport(0))
         self.assertIsNone(transp.get_pipe_transport(1))
@@ -1829,15 +1854,14 @@
                         functools.partial(MySubprocessProtocol, self.loop),
                         sys.executable, prog)
 
-        with self.assertWarns(DeprecationWarning):
-            transp, proto = self.loop.run_until_complete(connect)
-            self.assertIsInstance(proto, MySubprocessProtocol)
-            self.loop.run_until_complete(proto.connected)
+        transp, proto = self.loop.run_until_complete(connect)
+        self.assertIsInstance(proto, MySubprocessProtocol)
+        self.loop.run_until_complete(proto.connected)
 
-            transp.kill()
-            self.loop.run_until_complete(proto.completed)
-            self.check_killed(proto.returncode)
-            transp.close()
+        transp.kill()
+        self.loop.run_until_complete(proto.completed)
+        self.check_killed(proto.returncode)
+        transp.close()
 
     def test_subprocess_terminate(self):
         prog = os.path.join(os.path.dirname(__file__), 'echo.py')
@@ -1846,15 +1870,14 @@
                         functools.partial(MySubprocessProtocol, self.loop),
                         sys.executable, prog)
 
-        with self.assertWarns(DeprecationWarning):
-            transp, proto = self.loop.run_until_complete(connect)
-            self.assertIsInstance(proto, MySubprocessProtocol)
-            self.loop.run_until_complete(proto.connected)
+        transp, proto = self.loop.run_until_complete(connect)
+        self.assertIsInstance(proto, MySubprocessProtocol)
+        self.loop.run_until_complete(proto.connected)
 
-            transp.terminate()
-            self.loop.run_until_complete(proto.completed)
-            self.check_terminated(proto.returncode)
-            transp.close()
+        transp.terminate()
+        self.loop.run_until_complete(proto.completed)
+        self.check_terminated(proto.returncode)
+        transp.close()
 
     @unittest.skipIf(sys.platform == 'win32', "Don't have SIGHUP")
     def test_subprocess_send_signal(self):
@@ -1869,15 +1892,15 @@
                             functools.partial(MySubprocessProtocol, self.loop),
                             sys.executable, prog)
 
-            with self.assertWarns(DeprecationWarning):
-                transp, proto = self.loop.run_until_complete(connect)
-                self.assertIsInstance(proto, MySubprocessProtocol)
-                self.loop.run_until_complete(proto.connected)
 
-                transp.send_signal(signal.SIGHUP)
-                self.loop.run_until_complete(proto.completed)
-                self.assertEqual(-signal.SIGHUP, proto.returncode)
-                transp.close()
+            transp, proto = self.loop.run_until_complete(connect)
+            self.assertIsInstance(proto, MySubprocessProtocol)
+            self.loop.run_until_complete(proto.connected)
+
+            transp.send_signal(signal.SIGHUP)
+            self.loop.run_until_complete(proto.completed)
+            self.assertEqual(-signal.SIGHUP, proto.returncode)
+            transp.close()
         finally:
             signal.signal(signal.SIGHUP, old_handler)
 
@@ -1888,20 +1911,19 @@
                         functools.partial(MySubprocessProtocol, self.loop),
                         sys.executable, prog)
 
-        with self.assertWarns(DeprecationWarning):
-            transp, proto = self.loop.run_until_complete(connect)
-            self.assertIsInstance(proto, MySubprocessProtocol)
-            self.loop.run_until_complete(proto.connected)
+        transp, proto = self.loop.run_until_complete(connect)
+        self.assertIsInstance(proto, MySubprocessProtocol)
+        self.loop.run_until_complete(proto.connected)
 
-            stdin = transp.get_pipe_transport(0)
-            stdin.write(b'test')
+        stdin = transp.get_pipe_transport(0)
+        stdin.write(b'test')
 
-            self.loop.run_until_complete(proto.completed)
+        self.loop.run_until_complete(proto.completed)
 
-            transp.close()
-            self.assertEqual(b'OUT:test', proto.data[1])
-            self.assertTrue(proto.data[2].startswith(b'ERR:test'), proto.data[2])
-            self.assertEqual(0, proto.returncode)
+        transp.close()
+        self.assertEqual(b'OUT:test', proto.data[1])
+        self.assertTrue(proto.data[2].startswith(b'ERR:test'), proto.data[2])
+        self.assertEqual(0, proto.returncode)
 
     def test_subprocess_stderr_redirect_to_stdout(self):
         prog = os.path.join(os.path.dirname(__file__), 'echo2.py')
@@ -1910,23 +1932,23 @@
                         functools.partial(MySubprocessProtocol, self.loop),
                         sys.executable, prog, stderr=subprocess.STDOUT)
 
-        with self.assertWarns(DeprecationWarning):
-            transp, proto = self.loop.run_until_complete(connect)
-            self.assertIsInstance(proto, MySubprocessProtocol)
-            self.loop.run_until_complete(proto.connected)
 
-            stdin = transp.get_pipe_transport(0)
-            self.assertIsNotNone(transp.get_pipe_transport(1))
-            self.assertIsNone(transp.get_pipe_transport(2))
+        transp, proto = self.loop.run_until_complete(connect)
+        self.assertIsInstance(proto, MySubprocessProtocol)
+        self.loop.run_until_complete(proto.connected)
 
-            stdin.write(b'test')
-            self.loop.run_until_complete(proto.completed)
-            self.assertTrue(proto.data[1].startswith(b'OUT:testERR:test'),
-                            proto.data[1])
-            self.assertEqual(b'', proto.data[2])
+        stdin = transp.get_pipe_transport(0)
+        self.assertIsNotNone(transp.get_pipe_transport(1))
+        self.assertIsNone(transp.get_pipe_transport(2))
 
-            transp.close()
-            self.assertEqual(0, proto.returncode)
+        stdin.write(b'test')
+        self.loop.run_until_complete(proto.completed)
+        self.assertTrue(proto.data[1].startswith(b'OUT:testERR:test'),
+                        proto.data[1])
+        self.assertEqual(b'', proto.data[2])
+
+        transp.close()
+        self.assertEqual(0, proto.returncode)
 
     def test_subprocess_close_client_stream(self):
         prog = os.path.join(os.path.dirname(__file__), 'echo3.py')
@@ -1934,33 +1956,33 @@
         connect = self.loop.subprocess_exec(
                         functools.partial(MySubprocessProtocol, self.loop),
                         sys.executable, prog)
-        with self.assertWarns(DeprecationWarning):
-            transp, proto = self.loop.run_until_complete(connect)
-            self.assertIsInstance(proto, MySubprocessProtocol)
-            self.loop.run_until_complete(proto.connected)
 
-            stdin = transp.get_pipe_transport(0)
-            stdout = transp.get_pipe_transport(1)
-            stdin.write(b'test')
-            self.loop.run_until_complete(proto.got_data[1].wait())
-            self.assertEqual(b'OUT:test', proto.data[1])
+        transp, proto = self.loop.run_until_complete(connect)
+        self.assertIsInstance(proto, MySubprocessProtocol)
+        self.loop.run_until_complete(proto.connected)
 
-            stdout.close()
-            self.loop.run_until_complete(proto.disconnects[1])
-            stdin.write(b'xxx')
-            self.loop.run_until_complete(proto.got_data[2].wait())
-            if sys.platform != 'win32':
-                self.assertEqual(b'ERR:BrokenPipeError', proto.data[2])
-            else:
-                # After closing the read-end of a pipe, writing to the
-                # write-end using os.write() fails with errno==EINVAL and
-                # GetLastError()==ERROR_INVALID_NAME on Windows!?!  (Using
-                # WriteFile() we get ERROR_BROKEN_PIPE as expected.)
-                self.assertEqual(b'ERR:OSError', proto.data[2])
-            with test_utils.disable_logger():
-                transp.close()
-            self.loop.run_until_complete(proto.completed)
-            self.check_killed(proto.returncode)
+        stdin = transp.get_pipe_transport(0)
+        stdout = transp.get_pipe_transport(1)
+        stdin.write(b'test')
+        self.loop.run_until_complete(proto.got_data[1].wait())
+        self.assertEqual(b'OUT:test', proto.data[1])
+
+        stdout.close()
+        self.loop.run_until_complete(proto.disconnects[1])
+        stdin.write(b'xxx')
+        self.loop.run_until_complete(proto.got_data[2].wait())
+        if sys.platform != 'win32':
+            self.assertEqual(b'ERR:BrokenPipeError', proto.data[2])
+        else:
+            # After closing the read-end of a pipe, writing to the
+            # write-end using os.write() fails with errno==EINVAL and
+            # GetLastError()==ERROR_INVALID_NAME on Windows!?!  (Using
+            # WriteFile() we get ERROR_BROKEN_PIPE as expected.)
+            self.assertEqual(b'ERR:OSError', proto.data[2])
+        with test_utils.disable_logger():
+            transp.close()
+        self.loop.run_until_complete(proto.completed)
+        self.check_killed(proto.returncode)
 
     def test_subprocess_wait_no_same_group(self):
         # start the new process in a new session
@@ -1968,10 +1990,11 @@
                         functools.partial(MySubprocessProtocol, self.loop),
                         'exit 7', stdin=None, stdout=None, stderr=None,
                         start_new_session=True)
-        _, proto = yield self.loop.run_until_complete(connect)
+        transp, proto = self.loop.run_until_complete(connect)
         self.assertIsInstance(proto, MySubprocessProtocol)
         self.loop.run_until_complete(proto.completed)
         self.assertEqual(7, proto.returncode)
+        transp.close()
 
     def test_subprocess_exec_invalid_args(self):
         async def connect(**kwds):
@@ -2700,14 +2723,18 @@
             asyncio.set_event_loop_policy(Policy())
             loop = asyncio.new_event_loop()
 
-            with self.assertRaises(TestError):
-                asyncio.get_event_loop()
+            with self.assertWarns(DeprecationWarning) as cm:
+                with self.assertRaises(TestError):
+                    asyncio.get_event_loop()
+            self.assertEqual(cm.warnings[0].filename, __file__)
             asyncio.set_event_loop(None)
-            with self.assertRaises(TestError):
-                asyncio.get_event_loop()
+            with self.assertWarns(DeprecationWarning) as cm:
+                with self.assertRaises(TestError):
+                    asyncio.get_event_loop()
+            self.assertEqual(cm.warnings[0].filename, __file__)
 
             with self.assertRaisesRegex(RuntimeError, 'no running'):
-                self.assertIs(asyncio.get_running_loop(), None)
+                asyncio.get_running_loop()
             self.assertIs(asyncio._get_running_loop(), None)
 
             async def func():
@@ -2718,12 +2745,16 @@
             loop.run_until_complete(func())
 
             asyncio.set_event_loop(loop)
-            with self.assertRaises(TestError):
-                asyncio.get_event_loop()
+            with self.assertWarns(DeprecationWarning) as cm:
+                with self.assertRaises(TestError):
+                    asyncio.get_event_loop()
+            self.assertEqual(cm.warnings[0].filename, __file__)
 
             asyncio.set_event_loop(None)
-            with self.assertRaises(TestError):
-                asyncio.get_event_loop()
+            with self.assertWarns(DeprecationWarning) as cm:
+                with self.assertRaises(TestError):
+                    asyncio.get_event_loop()
+            self.assertEqual(cm.warnings[0].filename, __file__)
 
         finally:
             asyncio.set_event_loop_policy(old_policy)
@@ -2731,7 +2762,56 @@
                 loop.close()
 
         with self.assertRaisesRegex(RuntimeError, 'no running'):
-            self.assertIs(asyncio.get_running_loop(), None)
+            asyncio.get_running_loop()
+
+        self.assertIs(asyncio._get_running_loop(), None)
+
+    def test_get_event_loop_returns_running_loop2(self):
+        old_policy = asyncio.get_event_loop_policy()
+        try:
+            asyncio.set_event_loop_policy(asyncio.DefaultEventLoopPolicy())
+            loop = asyncio.new_event_loop()
+            self.addCleanup(loop.close)
+
+            with self.assertWarns(DeprecationWarning) as cm:
+                loop2 = asyncio.get_event_loop()
+            self.addCleanup(loop2.close)
+            self.assertEqual(cm.warnings[0].filename, __file__)
+            asyncio.set_event_loop(None)
+            with self.assertWarns(DeprecationWarning) as cm:
+                with self.assertRaisesRegex(RuntimeError, 'no current'):
+                    asyncio.get_event_loop()
+            self.assertEqual(cm.warnings[0].filename, __file__)
+
+            with self.assertRaisesRegex(RuntimeError, 'no running'):
+                asyncio.get_running_loop()
+            self.assertIs(asyncio._get_running_loop(), None)
+
+            async def func():
+                self.assertIs(asyncio.get_event_loop(), loop)
+                self.assertIs(asyncio.get_running_loop(), loop)
+                self.assertIs(asyncio._get_running_loop(), loop)
+
+            loop.run_until_complete(func())
+
+            asyncio.set_event_loop(loop)
+            with self.assertWarns(DeprecationWarning) as cm:
+                self.assertIs(asyncio.get_event_loop(), loop)
+            self.assertEqual(cm.warnings[0].filename, __file__)
+
+            asyncio.set_event_loop(None)
+            with self.assertWarns(DeprecationWarning) as cm:
+                with self.assertRaisesRegex(RuntimeError, 'no current'):
+                    asyncio.get_event_loop()
+            self.assertEqual(cm.warnings[0].filename, __file__)
+
+        finally:
+            asyncio.set_event_loop_policy(old_policy)
+            if loop is not None:
+                loop.close()
+
+        with self.assertRaisesRegex(RuntimeError, 'no running'):
+            asyncio.get_running_loop()
 
         self.assertIs(asyncio._get_running_loop(), None)
 
diff --git a/Lib/test/test_asyncio/test_futures.py b/Lib/test/test_asyncio/test_futures.py
index ec00896..838147b 100644
--- a/Lib/test/test_asyncio/test_futures.py
+++ b/Lib/test/test_asyncio/test_futures.py
@@ -7,7 +7,7 @@
 import threading
 import unittest
 from unittest import mock
-
+from types import GenericAlias
 import asyncio
 from asyncio import futures
 from test.test_asyncio import utils as test_utils
@@ -54,30 +54,30 @@
                 or self.__exception is not None)
 
     def result(self):
-        assert not self.cancelled()
+        self.assertFalse(self.cancelled())
         if self.__exception is not None:
             raise self.__exception
         return self.__result
 
     def exception(self):
-        assert not self.cancelled()
+        self.assertFalse(self.cancelled())
         return self.__exception
 
     def set_result(self, result):
-        assert not self.done()
-        assert result is not None
+        self.assertFalse(self.done())
+        self.assertIsNotNone(result)
         self.__result = result
 
     def set_exception(self, exception):
-        assert not self.done()
-        assert exception is not None
+        self.assertFalse(self.done())
+        self.assertIsNotNone(exception)
         self.__exception = exception
 
     def __iter__(self):
         if not self.done():
             self._asyncio_future_blocking = True
             yield self
-        assert self.done()
+        self.assertTrue(self.done())
         return self.result()
 
 
@@ -91,12 +91,12 @@
     def test_wrap_future(self):
         f = DuckFuture()
         g = asyncio.wrap_future(f)
-        assert g is f
+        self.assertIs(g, f)
 
     def test_ensure_future(self):
         f = DuckFuture()
         g = asyncio.ensure_future(f)
-        assert g is f
+        self.assertIs(g, f)
 
 
 class BaseFutureTests:
@@ -109,6 +109,11 @@
         self.loop = self.new_test_loop()
         self.addCleanup(self.loop.close)
 
+    def test_generic_alias(self):
+        future = self.cls[str]
+        self.assertEqual(future.__args__, (str,))
+        self.assertIsInstance(future, GenericAlias)
+
     def test_isfuture(self):
         class MyFuture:
             _asyncio_future_blocking = None
@@ -139,9 +144,26 @@
         f.cancel()
         self.assertTrue(f.cancelled())
 
-    def test_init_constructor_default_loop(self):
+    def test_constructor_without_loop(self):
+        with self.assertWarns(DeprecationWarning) as cm:
+            with self.assertRaisesRegex(RuntimeError, 'There is no current event loop'):
+                self._new_future()
+        self.assertEqual(cm.warnings[0].filename, __file__)
+
+    def test_constructor_use_running_loop(self):
+        async def test():
+            return self._new_future()
+        f = self.loop.run_until_complete(test())
+        self.assertIs(f._loop, self.loop)
+        self.assertIs(f.get_loop(), self.loop)
+
+    def test_constructor_use_global_loop(self):
+        # Deprecated in 3.10
         asyncio.set_event_loop(self.loop)
-        f = self._new_future()
+        self.addCleanup(asyncio.set_event_loop, None)
+        with self.assertWarns(DeprecationWarning) as cm:
+            f = self._new_future()
+        self.assertEqual(cm.warnings[0].filename, __file__)
         self.assertIs(f._loop, self.loop)
         self.assertIs(f.get_loop(), self.loop)
 
@@ -472,16 +494,41 @@
         f2 = asyncio.wrap_future(f1)
         self.assertIs(f1, f2)
 
+    def test_wrap_future_without_loop(self):
+        def run(arg):
+            return (arg, threading.get_ident())
+        ex = concurrent.futures.ThreadPoolExecutor(1)
+        f1 = ex.submit(run, 'oi')
+        with self.assertWarns(DeprecationWarning) as cm:
+            with self.assertRaises(RuntimeError):
+                asyncio.wrap_future(f1)
+        self.assertEqual(cm.warnings[0].filename, __file__)
+        ex.shutdown(wait=True)
+
+    def test_wrap_future_use_running_loop(self):
+        def run(arg):
+            return (arg, threading.get_ident())
+        ex = concurrent.futures.ThreadPoolExecutor(1)
+        f1 = ex.submit(run, 'oi')
+        async def test():
+            return asyncio.wrap_future(f1)
+        f2 = self.loop.run_until_complete(test())
+        self.assertIs(self.loop, f2._loop)
+        ex.shutdown(wait=True)
+
     def test_wrap_future_use_global_loop(self):
-        with mock.patch('asyncio.futures.events') as events:
-            events.get_event_loop = lambda: self.loop
-            def run(arg):
-                return (arg, threading.get_ident())
-            ex = concurrent.futures.ThreadPoolExecutor(1)
-            f1 = ex.submit(run, 'oi')
+        # Deprecated in 3.10
+        asyncio.set_event_loop(self.loop)
+        self.addCleanup(asyncio.set_event_loop, None)
+        def run(arg):
+            return (arg, threading.get_ident())
+        ex = concurrent.futures.ThreadPoolExecutor(1)
+        f1 = ex.submit(run, 'oi')
+        with self.assertWarns(DeprecationWarning) as cm:
             f2 = asyncio.wrap_future(f1)
-            self.assertIs(self.loop, f2._loop)
-            ex.shutdown(wait=True)
+        self.assertEqual(cm.warnings[0].filename, __file__)
+        self.assertIs(self.loop, f2._loop)
+        ex.shutdown(wait=True)
 
     def test_wrap_future_cancel(self):
         f1 = concurrent.futures.Future()
@@ -876,6 +923,8 @@
         return futures._PyFuture
 
 
+@unittest.skipUnless(hasattr(futures, '_CFuture'),
+                     'requires the C _asyncio module')
 class CFutureInheritanceTests(BaseFutureInheritanceTests,
                               test_utils.TestCase):
     def _get_future_cls(self):
diff --git a/Lib/test/test_asyncio/test_futures2.py b/Lib/test/test_asyncio/test_futures2.py
index 13dbc70..60b5885 100644
--- a/Lib/test/test_asyncio/test_futures2.py
+++ b/Lib/test/test_asyncio/test_futures2.py
@@ -3,6 +3,10 @@
 import unittest
 
 
+def tearDownModule():
+    asyncio.set_event_loop_policy(None)
+
+
 class FutureTests(unittest.IsolatedAsyncioTestCase):
     async def test_recursive_repr_for_pending_tasks(self):
         # The call crashes if the guard for recursive call
@@ -16,3 +20,7 @@
         # The check for returned string is not very reliable but
         # exact comparison for the whole string is even weaker.
         self.assertIn('...', repr(await asyncio.wait_for(func(), timeout=10)))
+
+
+if __name__ == '__main__':
+    unittest.main()
diff --git a/Lib/test/test_asyncio/test_locks.py b/Lib/test/test_asyncio/test_locks.py
index 8c93fae..e2cd2ba 100644
--- a/Lib/test/test_asyncio/test_locks.py
+++ b/Lib/test/test_asyncio/test_locks.py
@@ -5,7 +5,6 @@
 import re
 
 import asyncio
-from test.test_asyncio import utils as test_utils
 
 STR_RGX_REPR = (
     r'^<(?P<class>.*?) object at (?P<address>.*?)'
@@ -20,41 +19,21 @@
     asyncio.set_event_loop_policy(None)
 
 
-class LockTests(test_utils.TestCase):
+class LockTests(unittest.IsolatedAsyncioTestCase):
 
-    def setUp(self):
-        super().setUp()
-        self.loop = self.new_test_loop()
-
-    def test_ctor_loop(self):
-        loop = mock.Mock()
-        with self.assertWarns(DeprecationWarning):
-            lock = asyncio.Lock(loop=loop)
-        self.assertIs(lock._loop, loop)
-
-        with self.assertWarns(DeprecationWarning):
-            lock = asyncio.Lock(loop=self.loop)
-        self.assertIs(lock._loop, self.loop)
-
-    def test_ctor_noloop(self):
-        asyncio.set_event_loop(self.loop)
+    async def test_repr(self):
         lock = asyncio.Lock()
-        self.assertIs(lock._loop, self.loop)
-
-    def test_repr(self):
-        with self.assertWarns(DeprecationWarning):
-            lock = asyncio.Lock(loop=self.loop)
         self.assertTrue(repr(lock).endswith('[unlocked]>'))
         self.assertTrue(RGX_REPR.match(repr(lock)))
 
-        self.loop.run_until_complete(lock.acquire())
+        await lock.acquire()
         self.assertTrue(repr(lock).endswith('[locked]>'))
         self.assertTrue(RGX_REPR.match(repr(lock)))
 
-    def test_lock(self):
-        with self.assertWarns(DeprecationWarning):
-            lock = asyncio.Lock(loop=self.loop)
+    async def test_lock(self):
+        lock = asyncio.Lock()
 
+        with self.assertWarns(DeprecationWarning):
             @asyncio.coroutine
             def acquire_lock():
                 return (yield from lock)
@@ -63,21 +42,38 @@
             TypeError,
             "object is not iterable"
         ):
-            self.loop.run_until_complete(acquire_lock())
+            await acquire_lock()
 
         self.assertFalse(lock.locked())
 
-    def test_lock_by_with_statement(self):
-        loop = asyncio.new_event_loop()  # don't use TestLoop quirks
-        self.set_event_loop(loop)
-        with self.assertWarns(DeprecationWarning):
-            primitives = [
-                asyncio.Lock(loop=loop),
-                asyncio.Condition(loop=loop),
-                asyncio.Semaphore(loop=loop),
-                asyncio.BoundedSemaphore(loop=loop),
-            ]
+    async def test_lock_doesnt_accept_loop_parameter(self):
+        primitives_cls = [
+            asyncio.Lock,
+            asyncio.Condition,
+            asyncio.Event,
+            asyncio.Semaphore,
+            asyncio.BoundedSemaphore,
+        ]
 
+        loop = asyncio.get_running_loop()
+
+        for cls in primitives_cls:
+            with self.assertRaisesRegex(
+                TypeError,
+                rf'As of 3.10, the \*loop\* parameter was removed from '
+                rf'{cls.__name__}\(\) since it is no longer necessary'
+            ):
+                cls(loop=loop)
+
+    async def test_lock_by_with_statement(self):
+        primitives = [
+            asyncio.Lock(),
+            asyncio.Condition(),
+            asyncio.Semaphore(),
+            asyncio.BoundedSemaphore(),
+        ]
+
+        with self.assertWarns(DeprecationWarning):
             @asyncio.coroutine
             def test(lock):
                 yield from asyncio.sleep(0.01)
@@ -90,16 +86,15 @@
                         pass
                 self.assertFalse(lock.locked())
 
-        for primitive in primitives:
-            loop.run_until_complete(test(primitive))
-            self.assertFalse(primitive.locked())
+        for lock in primitives:
+            await test(lock)
+            self.assertFalse(lock.locked())
 
-    def test_acquire(self):
-        with self.assertWarns(DeprecationWarning):
-            lock = asyncio.Lock(loop=self.loop)
+    async def test_acquire(self):
+        lock = asyncio.Lock()
         result = []
 
-        self.assertTrue(self.loop.run_until_complete(lock.acquire()))
+        self.assertTrue(await lock.acquire())
 
         async def c1(result):
             if await lock.acquire():
@@ -116,27 +111,27 @@
                 result.append(3)
             return True
 
-        t1 = self.loop.create_task(c1(result))
-        t2 = self.loop.create_task(c2(result))
+        t1 = asyncio.create_task(c1(result))
+        t2 = asyncio.create_task(c2(result))
 
-        test_utils.run_briefly(self.loop)
+        await asyncio.sleep(0)
         self.assertEqual([], result)
 
         lock.release()
-        test_utils.run_briefly(self.loop)
+        await asyncio.sleep(0)
         self.assertEqual([1], result)
 
-        test_utils.run_briefly(self.loop)
+        await asyncio.sleep(0)
         self.assertEqual([1], result)
 
-        t3 = self.loop.create_task(c3(result))
+        t3 = asyncio.create_task(c3(result))
 
         lock.release()
-        test_utils.run_briefly(self.loop)
+        await asyncio.sleep(0)
         self.assertEqual([1, 2], result)
 
         lock.release()
-        test_utils.run_briefly(self.loop)
+        await asyncio.sleep(0)
         self.assertEqual([1, 2, 3], result)
 
         self.assertTrue(t1.done())
@@ -146,19 +141,17 @@
         self.assertTrue(t3.done())
         self.assertTrue(t3.result())
 
-    def test_acquire_cancel(self):
-        with self.assertWarns(DeprecationWarning):
-            lock = asyncio.Lock(loop=self.loop)
-        self.assertTrue(self.loop.run_until_complete(lock.acquire()))
+    async def test_acquire_cancel(self):
+        lock = asyncio.Lock()
+        self.assertTrue(await lock.acquire())
 
-        task = self.loop.create_task(lock.acquire())
-        self.loop.call_soon(task.cancel)
-        self.assertRaises(
-            asyncio.CancelledError,
-            self.loop.run_until_complete, task)
+        task = asyncio.create_task(lock.acquire())
+        asyncio.get_running_loop().call_soon(task.cancel)
+        with self.assertRaises(asyncio.CancelledError):
+            await task
         self.assertFalse(lock._waiters)
 
-    def test_cancel_race(self):
+    async def test_cancel_race(self):
         # Several tasks:
         # - A acquires the lock
         # - B is blocked in acquire()
@@ -173,8 +166,7 @@
         # B's waiter; instead, it should move on to C's waiter.
 
         # Setup: A has the lock, b and c are waiting.
-        with self.assertWarns(DeprecationWarning):
-            lock = asyncio.Lock(loop=self.loop)
+        lock = asyncio.Lock()
 
         async def lockit(name, blocker):
             await lock.acquire()
@@ -184,15 +176,15 @@
             finally:
                 lock.release()
 
-        fa = self.loop.create_future()
-        ta = self.loop.create_task(lockit('A', fa))
-        test_utils.run_briefly(self.loop)
+        fa = asyncio.get_running_loop().create_future()
+        ta = asyncio.create_task(lockit('A', fa))
+        await asyncio.sleep(0)
         self.assertTrue(lock.locked())
-        tb = self.loop.create_task(lockit('B', None))
-        test_utils.run_briefly(self.loop)
+        tb = asyncio.create_task(lockit('B', None))
+        await asyncio.sleep(0)
         self.assertEqual(len(lock._waiters), 1)
-        tc = self.loop.create_task(lockit('C', None))
-        test_utils.run_briefly(self.loop)
+        tc = asyncio.create_task(lockit('C', None))
+        await asyncio.sleep(0)
         self.assertEqual(len(lock._waiters), 2)
 
         # Create the race and check.
@@ -200,18 +192,18 @@
         fa.set_result(None)
         tb.cancel()
         self.assertTrue(lock._waiters[0].cancelled())
-        test_utils.run_briefly(self.loop)
+        await asyncio.sleep(0)
         self.assertFalse(lock.locked())
         self.assertTrue(ta.done())
         self.assertTrue(tb.cancelled())
-        self.assertTrue(tc.done())
+        await tc
 
-    def test_cancel_release_race(self):
+    async def test_cancel_release_race(self):
         # Issue 32734
         # Acquire 4 locks, cancel second, release first
         # and 2 locks are taken at once.
-        with self.assertWarns(DeprecationWarning):
-            lock = asyncio.Lock(loop=self.loop)
+        loop = asyncio.get_running_loop()
+        lock = asyncio.Lock()
         lock_count = 0
         call_count = 0
 
@@ -222,27 +214,23 @@
             await lock.acquire()
             lock_count += 1
 
-        async def lockandtrigger():
-            await lock.acquire()
-            self.loop.call_soon(trigger)
-
         def trigger():
             t1.cancel()
             lock.release()
 
-        t0 = self.loop.create_task(lockandtrigger())
-        t1 = self.loop.create_task(lockit())
-        t2 = self.loop.create_task(lockit())
-        t3 = self.loop.create_task(lockit())
+        await lock.acquire()
 
-        # First loop acquires all
-        test_utils.run_briefly(self.loop)
-        self.assertTrue(t0.done())
+        t1 = asyncio.create_task(lockit())
+        t2 = asyncio.create_task(lockit())
+        t3 = asyncio.create_task(lockit())
 
-        # Second loop calls trigger
-        test_utils.run_briefly(self.loop)
-        # Third loop calls cancellation
-        test_utils.run_briefly(self.loop)
+        # Start scheduled tasks
+        await asyncio.sleep(0)
+
+        loop.call_soon(trigger)
+        with self.assertRaises(asyncio.CancelledError):
+            # Wait for cancellation
+            await t1
 
         # Make sure only one lock was taken
         self.assertEqual(lock_count, 1)
@@ -252,84 +240,59 @@
 
         # Cleanup the task that is stuck on acquire.
         t3.cancel()
-        test_utils.run_briefly(self.loop)
+        await asyncio.sleep(0)
         self.assertTrue(t3.cancelled())
 
-    def test_finished_waiter_cancelled(self):
-        with self.assertWarns(DeprecationWarning):
-            lock = asyncio.Lock(loop=self.loop)
+    async def test_finished_waiter_cancelled(self):
+        lock = asyncio.Lock()
 
-        ta = self.loop.create_task(lock.acquire())
-        test_utils.run_briefly(self.loop)
+        await lock.acquire()
         self.assertTrue(lock.locked())
 
-        tb = self.loop.create_task(lock.acquire())
-        test_utils.run_briefly(self.loop)
+        tb = asyncio.create_task(lock.acquire())
+        await asyncio.sleep(0)
         self.assertEqual(len(lock._waiters), 1)
 
         # Create a second waiter, wake up the first, and cancel it.
         # Without the fix, the second was not woken up.
-        tc = self.loop.create_task(lock.acquire())
-        lock.release()
+        tc = asyncio.create_task(lock.acquire())
         tb.cancel()
-        test_utils.run_briefly(self.loop)
+        lock.release()
+        await asyncio.sleep(0)
 
         self.assertTrue(lock.locked())
-        self.assertTrue(ta.done())
         self.assertTrue(tb.cancelled())
 
-    def test_release_not_acquired(self):
-        with self.assertWarns(DeprecationWarning):
-            lock = asyncio.Lock(loop=self.loop)
+        # Cleanup
+        await tc
+
+    async def test_release_not_acquired(self):
+        lock = asyncio.Lock()
 
         self.assertRaises(RuntimeError, lock.release)
 
-    def test_release_no_waiters(self):
-        with self.assertWarns(DeprecationWarning):
-            lock = asyncio.Lock(loop=self.loop)
-        self.loop.run_until_complete(lock.acquire())
+    async def test_release_no_waiters(self):
+        lock = asyncio.Lock()
+        await lock.acquire()
         self.assertTrue(lock.locked())
 
         lock.release()
         self.assertFalse(lock.locked())
 
-    def test_context_manager(self):
-        async def f():
-            lock = asyncio.Lock()
-            self.assertFalse(lock.locked())
+    async def test_context_manager(self):
+        lock = asyncio.Lock()
+        self.assertFalse(lock.locked())
 
-            async with lock:
-                self.assertTrue(lock.locked())
+        async with lock:
+            self.assertTrue(lock.locked())
 
-            self.assertFalse(lock.locked())
-
-        self.loop.run_until_complete(f())
+        self.assertFalse(lock.locked())
 
 
-class EventTests(test_utils.TestCase):
-
-    def setUp(self):
-        super().setUp()
-        self.loop = self.new_test_loop()
-
-    def test_ctor_loop(self):
-        loop = mock.Mock()
-        with self.assertWarns(DeprecationWarning):
-            ev = asyncio.Event(loop=loop)
-        self.assertIs(ev._loop, loop)
-
-        with self.assertWarns(DeprecationWarning):
-            ev = asyncio.Event(loop=self.loop)
-        self.assertIs(ev._loop, self.loop)
-
-    def test_ctor_noloop(self):
-        asyncio.set_event_loop(self.loop)
-        ev = asyncio.Event()
-        self.assertIs(ev._loop, self.loop)
+class EventTests(unittest.IsolatedAsyncioTestCase):
 
     def test_repr(self):
-        with self.assertWarns(DeprecationWarning):
-            ev = asyncio.Event(loop=self.loop)
+        ev = asyncio.Event()
         self.assertTrue(repr(ev).endswith('[unset]>'))
         match = RGX_REPR.match(repr(ev))
         self.assertEqual(match.group('extras'), 'unset')
@@ -342,9 +305,8 @@
         self.assertTrue('waiters:1' in repr(ev))
         self.assertTrue(RGX_REPR.match(repr(ev)))
 
-    def test_wait(self):
-        with self.assertWarns(DeprecationWarning):
-            ev = asyncio.Event(loop=self.loop)
+    async def test_wait(self):
+        ev = asyncio.Event()
         self.assertFalse(ev.is_set())
 
         result = []
@@ -361,16 +323,16 @@
             if await ev.wait():
                 result.append(3)
 
-        t1 = self.loop.create_task(c1(result))
-        t2 = self.loop.create_task(c2(result))
+        t1 = asyncio.create_task(c1(result))
+        t2 = asyncio.create_task(c2(result))
 
-        test_utils.run_briefly(self.loop)
+        await asyncio.sleep(0)
         self.assertEqual([], result)
 
-        t3 = self.loop.create_task(c3(result))
+        t3 = asyncio.create_task(c3(result))
 
         ev.set()
-        test_utils.run_briefly(self.loop)
+        await asyncio.sleep(0)
         self.assertEqual([3, 1, 2], result)
 
         self.assertTrue(t1.done())
@@ -380,28 +342,24 @@
         self.assertTrue(t3.done())
         self.assertIsNone(t3.result())
 
-    def test_wait_on_set(self):
-        with self.assertWarns(DeprecationWarning):
-            ev = asyncio.Event(loop=self.loop)
+    async def test_wait_on_set(self):
+        ev = asyncio.Event()
         ev.set()
 
-        res = self.loop.run_until_complete(ev.wait())
+        res = await ev.wait()
         self.assertTrue(res)
 
-    def test_wait_cancel(self):
-        with self.assertWarns(DeprecationWarning):
-            ev = asyncio.Event(loop=self.loop)
+    async def test_wait_cancel(self):
+        ev = asyncio.Event()
 
-        wait = self.loop.create_task(ev.wait())
-        self.loop.call_soon(wait.cancel)
-        self.assertRaises(
-            asyncio.CancelledError,
-            self.loop.run_until_complete, wait)
+        wait = asyncio.create_task(ev.wait())
+        asyncio.get_running_loop().call_soon(wait.cancel)
+        with self.assertRaises(asyncio.CancelledError):
+            await wait
         self.assertFalse(ev._waiters)
 
-    def test_clear(self):
-        with self.assertWarns(DeprecationWarning):
-            ev = asyncio.Event(loop=self.loop)
+    async def test_clear(self):
+        ev = asyncio.Event()
         self.assertFalse(ev.is_set())
 
         ev.set()
@@ -410,9 +368,8 @@
         ev.clear()
         self.assertFalse(ev.is_set())
 
-    def test_clear_with_waiters(self):
-        with self.assertWarns(DeprecationWarning):
-            ev = asyncio.Event(loop=self.loop)
+    async def test_clear_with_waiters(self):
+        ev = asyncio.Event()
         result = []
 
         async def c1(result):
@@ -420,8 +377,8 @@
                 result.append(1)
             return True
 
-        t = self.loop.create_task(c1(result))
-        test_utils.run_briefly(self.loop)
+        t = asyncio.create_task(c1(result))
+        await asyncio.sleep(0)
         self.assertEqual([], result)
 
         ev.set()
@@ -432,7 +389,7 @@
         ev.set()
         self.assertEqual(1, len(ev._waiters))
 
-        test_utils.run_briefly(self.loop)
+        await asyncio.sleep(0)
         self.assertEqual([1], result)
         self.assertEqual(0, len(ev._waiters))
 
@@ -440,29 +397,10 @@
         self.assertTrue(t.result())
 
 
-class ConditionTests(test_utils.TestCase):
+class ConditionTests(unittest.IsolatedAsyncioTestCase):
 
-    def setUp(self):
-        super().setUp()
-        self.loop = self.new_test_loop()
-
-    def test_ctor_loop(self):
-        loop = mock.Mock()
-        with self.assertWarns(DeprecationWarning):
-            cond = asyncio.Condition(loop=loop)
-            self.assertIs(cond._loop, loop)
-
-            cond = asyncio.Condition(loop=self.loop)
-            self.assertIs(cond._loop, self.loop)
-
-    def test_ctor_noloop(self):
-        asyncio.set_event_loop(self.loop)
+    async def test_wait(self):
         cond = asyncio.Condition()
-        self.assertIs(cond._loop, self.loop)
-
-    def test_wait(self):
-        with self.assertWarns(DeprecationWarning):
-            cond = asyncio.Condition(loop=self.loop)
         result = []
 
         async def c1(result):
@@ -483,37 +421,37 @@
                 result.append(3)
             return True
 
-        t1 = self.loop.create_task(c1(result))
-        t2 = self.loop.create_task(c2(result))
-        t3 = self.loop.create_task(c3(result))
+        t1 = asyncio.create_task(c1(result))
+        t2 = asyncio.create_task(c2(result))
+        t3 = asyncio.create_task(c3(result))
 
-        test_utils.run_briefly(self.loop)
+        await asyncio.sleep(0)
         self.assertEqual([], result)
         self.assertFalse(cond.locked())
 
-        self.assertTrue(self.loop.run_until_complete(cond.acquire()))
+        self.assertTrue(await cond.acquire())
         cond.notify()
-        test_utils.run_briefly(self.loop)
+        await asyncio.sleep(0)
         self.assertEqual([], result)
         self.assertTrue(cond.locked())
 
         cond.release()
-        test_utils.run_briefly(self.loop)
+        await asyncio.sleep(0)
         self.assertEqual([1], result)
         self.assertTrue(cond.locked())
 
         cond.notify(2)
-        test_utils.run_briefly(self.loop)
+        await asyncio.sleep(0)
         self.assertEqual([1], result)
         self.assertTrue(cond.locked())
 
         cond.release()
-        test_utils.run_briefly(self.loop)
+        await asyncio.sleep(0)
         self.assertEqual([1, 2], result)
         self.assertTrue(cond.locked())
 
         cond.release()
-        test_utils.run_briefly(self.loop)
+        await asyncio.sleep(0)
         self.assertEqual([1, 2, 3], result)
         self.assertTrue(cond.locked())
 
@@ -524,81 +462,75 @@
         self.assertTrue(t3.done())
         self.assertTrue(t3.result())
 
-    def test_wait_cancel(self):
-        with self.assertWarns(DeprecationWarning):
-            cond = asyncio.Condition(loop=self.loop)
-        self.loop.run_until_complete(cond.acquire())
+    async def test_wait_cancel(self):
+        cond = asyncio.Condition()
+        await cond.acquire()
 
-        wait = self.loop.create_task(cond.wait())
-        self.loop.call_soon(wait.cancel)
-        self.assertRaises(
-            asyncio.CancelledError,
-            self.loop.run_until_complete, wait)
+        wait = asyncio.create_task(cond.wait())
+        asyncio.get_running_loop().call_soon(wait.cancel)
+        with self.assertRaises(asyncio.CancelledError):
+            await wait
         self.assertFalse(cond._waiters)
         self.assertTrue(cond.locked())
 
-    def test_wait_cancel_contested(self):
-        with self.assertWarns(DeprecationWarning):
-            cond = asyncio.Condition(loop=self.loop)
+    async def test_wait_cancel_contested(self):
+        cond = asyncio.Condition()
 
-        self.loop.run_until_complete(cond.acquire())
+        await cond.acquire()
         self.assertTrue(cond.locked())
 
-        wait_task = self.loop.create_task(cond.wait())
-        test_utils.run_briefly(self.loop)
+        wait_task = asyncio.create_task(cond.wait())
+        await asyncio.sleep(0)
         self.assertFalse(cond.locked())
 
         # Notify, but contest the lock before cancelling
-        self.loop.run_until_complete(cond.acquire())
+        await cond.acquire()
         self.assertTrue(cond.locked())
         cond.notify()
-        self.loop.call_soon(wait_task.cancel)
-        self.loop.call_soon(cond.release)
+        asyncio.get_running_loop().call_soon(wait_task.cancel)
+        asyncio.get_running_loop().call_soon(cond.release)
 
         try:
-            self.loop.run_until_complete(wait_task)
+            await wait_task
         except asyncio.CancelledError:
             # Should not happen, since no cancellation points
             pass
 
         self.assertTrue(cond.locked())
 
-    def test_wait_cancel_after_notify(self):
+    async def test_wait_cancel_after_notify(self):
         # See bpo-32841
-        with self.assertWarns(DeprecationWarning):
-            cond = asyncio.Condition(loop=self.loop)
         waited = False
 
+        cond = asyncio.Condition()
+
         async def wait_on_cond():
             nonlocal waited
             async with cond:
                 waited = True  # Make sure this area was reached
                 await cond.wait()
 
-        waiter = asyncio.ensure_future(wait_on_cond(), loop=self.loop)
-        test_utils.run_briefly(self.loop)  # Start waiting
+        waiter = asyncio.create_task(wait_on_cond())
+        await asyncio.sleep(0)  # Start waiting
 
-        self.loop.run_until_complete(cond.acquire())
+        await cond.acquire()
         cond.notify()
-        test_utils.run_briefly(self.loop)  # Get to acquire()
+        await asyncio.sleep(0)  # Get to acquire()
         waiter.cancel()
-        test_utils.run_briefly(self.loop)  # Activate cancellation
+        await asyncio.sleep(0)  # Activate cancellation
         cond.release()
-        test_utils.run_briefly(self.loop)  # Cancellation should occur
+        await asyncio.sleep(0)  # Cancellation should occur
 
         self.assertTrue(waiter.cancelled())
         self.assertTrue(waited)
 
-    def test_wait_unacquired(self):
-        with self.assertWarns(DeprecationWarning):
-            cond = asyncio.Condition(loop=self.loop)
-        self.assertRaises(
-            RuntimeError,
-            self.loop.run_until_complete, cond.wait())
+    async def test_wait_unacquired(self):
+        cond = asyncio.Condition()
+        with self.assertRaises(RuntimeError):
+            await cond.wait()
 
-    def test_wait_for(self):
-        with self.assertWarns(DeprecationWarning):
-            cond = asyncio.Condition(loop=self.loop)
+    async def test_wait_for(self):
+        cond = asyncio.Condition()
         presult = False
 
         def predicate():
@@ -613,43 +545,39 @@
                 cond.release()
             return True
 
-        t = self.loop.create_task(c1(result))
+        t = asyncio.create_task(c1(result))
 
-        test_utils.run_briefly(self.loop)
+        await asyncio.sleep(0)
         self.assertEqual([], result)
 
-        self.loop.run_until_complete(cond.acquire())
+        await cond.acquire()
         cond.notify()
         cond.release()
-        test_utils.run_briefly(self.loop)
+        await asyncio.sleep(0)
         self.assertEqual([], result)
 
         presult = True
-        self.loop.run_until_complete(cond.acquire())
+        await cond.acquire()
         cond.notify()
         cond.release()
-        test_utils.run_briefly(self.loop)
+        await asyncio.sleep(0)
         self.assertEqual([1], result)
 
         self.assertTrue(t.done())
         self.assertTrue(t.result())
 
-    def test_wait_for_unacquired(self):
-        with self.assertWarns(DeprecationWarning):
-            cond = asyncio.Condition(loop=self.loop)
+    async def test_wait_for_unacquired(self):
+        cond = asyncio.Condition()
 
         # predicate can return true immediately
-        res = self.loop.run_until_complete(cond.wait_for(lambda: [1, 2, 3]))
+        res = await cond.wait_for(lambda: [1, 2, 3])
         self.assertEqual([1, 2, 3], res)
 
-        self.assertRaises(
-            RuntimeError,
-            self.loop.run_until_complete,
-            cond.wait_for(lambda: False))
+        with self.assertRaises(RuntimeError):
+            await cond.wait_for(lambda: False)
 
-    def test_notify(self):
-        with self.assertWarns(DeprecationWarning):
-            cond = asyncio.Condition(loop=self.loop)
+    async def test_notify(self):
+        cond = asyncio.Condition()
         result = []
 
         async def c1(result):
@@ -673,24 +601,24 @@
                 cond.release()
             return True
 
-        t1 = self.loop.create_task(c1(result))
-        t2 = self.loop.create_task(c2(result))
-        t3 = self.loop.create_task(c3(result))
+        t1 = asyncio.create_task(c1(result))
+        t2 = asyncio.create_task(c2(result))
+        t3 = asyncio.create_task(c3(result))
 
-        test_utils.run_briefly(self.loop)
+        await asyncio.sleep(0)
         self.assertEqual([], result)
 
-        self.loop.run_until_complete(cond.acquire())
+        await cond.acquire()
         cond.notify(1)
         cond.release()
-        test_utils.run_briefly(self.loop)
+        await asyncio.sleep(0)
         self.assertEqual([1], result)
 
-        self.loop.run_until_complete(cond.acquire())
+        await cond.acquire()
         cond.notify(1)
         cond.notify(2048)
         cond.release()
-        test_utils.run_briefly(self.loop)
+        await asyncio.sleep(0)
         self.assertEqual([1, 2, 3], result)
 
         self.assertTrue(t1.done())
@@ -700,9 +628,8 @@
         self.assertTrue(t3.done())
         self.assertTrue(t3.result())
 
-    def test_notify_all(self):
-        with self.assertWarns(DeprecationWarning):
-            cond = asyncio.Condition(loop=self.loop)
+    async def test_notify_all(self):
+        cond = asyncio.Condition()
 
         result = []
 
@@ -720,16 +647,16 @@
                 cond.release()
             return True
 
-        t1 = self.loop.create_task(c1(result))
-        t2 = self.loop.create_task(c2(result))
+        t1 = asyncio.create_task(c1(result))
+        t2 = asyncio.create_task(c2(result))
 
-        test_utils.run_briefly(self.loop)
+        await asyncio.sleep(0)
         self.assertEqual([], result)
 
-        self.loop.run_until_complete(cond.acquire())
+        await cond.acquire()
         cond.notify_all()
         cond.release()
-        test_utils.run_briefly(self.loop)
+        await asyncio.sleep(0)
         self.assertEqual([1, 2], result)
 
         self.assertTrue(t1.done())
@@ -738,22 +665,19 @@
         self.assertTrue(t2.result())
 
     def test_notify_unacquired(self):
-        with self.assertWarns(DeprecationWarning):
-            cond = asyncio.Condition(loop=self.loop)
+        cond = asyncio.Condition()
         self.assertRaises(RuntimeError, cond.notify)
 
     def test_notify_all_unacquired(self):
-        with self.assertWarns(DeprecationWarning):
-            cond = asyncio.Condition(loop=self.loop)
+        cond = asyncio.Condition()
         self.assertRaises(RuntimeError, cond.notify_all)
 
-    def test_repr(self):
-        with self.assertWarns(DeprecationWarning):
-            cond = asyncio.Condition(loop=self.loop)
+    async def test_repr(self):
+        cond = asyncio.Condition()
         self.assertTrue('unlocked' in repr(cond))
         self.assertTrue(RGX_REPR.match(repr(cond)))
 
-        self.loop.run_until_complete(cond.acquire())
+        await cond.acquire()
         self.assertTrue('locked' in repr(cond))
 
         cond._waiters.append(mock.Mock())
@@ -764,79 +688,96 @@
         self.assertTrue('waiters:2' in repr(cond))
         self.assertTrue(RGX_REPR.match(repr(cond)))
 
-    def test_context_manager(self):
-        async def f():
-            cond = asyncio.Condition()
+    async def test_context_manager(self):
+        cond = asyncio.Condition()
+        self.assertFalse(cond.locked())
+        async with cond:
+            self.assertTrue(cond.locked())
+        self.assertFalse(cond.locked())
+
+    async def test_explicit_lock(self):
+        async def f(lock=None, cond=None):
+            if lock is None:
+                lock = asyncio.Lock()
+            if cond is None:
+                cond = asyncio.Condition(lock)
+            self.assertIs(cond._lock, lock)
+            self.assertFalse(lock.locked())
             self.assertFalse(cond.locked())
             async with cond:
+                self.assertTrue(lock.locked())
                 self.assertTrue(cond.locked())
+            self.assertFalse(lock.locked())
+            self.assertFalse(cond.locked())
+            async with lock:
+                self.assertTrue(lock.locked())
+                self.assertTrue(cond.locked())
+            self.assertFalse(lock.locked())
             self.assertFalse(cond.locked())
 
-        self.loop.run_until_complete(f())
+        # All should work in the same way.
+        await f()
+        await f(asyncio.Lock())
+        lock = asyncio.Lock()
+        await f(lock, asyncio.Condition(lock))
 
-    def test_explicit_lock(self):
-        with self.assertWarns(DeprecationWarning):
-            lock = asyncio.Lock(loop=self.loop)
-            cond = asyncio.Condition(lock, loop=self.loop)
-
-        self.assertIs(cond._lock, lock)
-        self.assertIs(cond._loop, lock._loop)
-
-    def test_ambiguous_loops(self):
-        loop = self.new_test_loop()
-        self.addCleanup(loop.close)
-        with self.assertWarns(DeprecationWarning):
-            lock = asyncio.Lock(loop=self.loop)
-            with self.assertRaises(ValueError):
-                asyncio.Condition(lock, loop=loop)
-
-    def test_timeout_in_block(self):
+    async def test_ambiguous_loops(self):
         loop = asyncio.new_event_loop()
         self.addCleanup(loop.close)
 
-        async def task_timeout():
-            condition = asyncio.Condition(loop=loop)
-            async with condition:
-                with self.assertRaises(asyncio.TimeoutError):
-                    await asyncio.wait_for(condition.wait(), timeout=0.5)
+        async def wrong_loop_in_lock():
+            with self.assertRaises(TypeError):
+                asyncio.Lock(loop=loop)  # actively disallowed since 3.10
+            lock = asyncio.Lock()
+            lock._loop = loop  # use private API for testing
+            async with lock:
+                # acquired immediately via the fast-path
+                # without interaction with any event loop.
+                cond = asyncio.Condition(lock)
+                # cond.acquire() will trigger waiting on the lock
+                # and it will discover the event loop mismatch.
+                with self.assertRaisesRegex(
+                    RuntimeError,
+                    "is bound to a different event loop",
+                ):
+                    await cond.acquire()
 
-        with self.assertWarns(DeprecationWarning):
-            loop.run_until_complete(task_timeout())
+        async def wrong_loop_in_cond():
+            # Same analogy here with the condition's loop.
+            lock = asyncio.Lock()
+            async with lock:
+                with self.assertRaises(TypeError):
+                    asyncio.Condition(lock, loop=loop)
+                cond = asyncio.Condition(lock)
+                cond._loop = loop
+                with self.assertRaisesRegex(
+                    RuntimeError,
+                    "is bound to a different event loop",
+                ):
+                    await cond.wait()
+
+        await wrong_loop_in_lock()
+        await wrong_loop_in_cond()
+
+    async def test_timeout_in_block(self):
+        condition = asyncio.Condition()
+        async with condition:
+            with self.assertRaises(asyncio.TimeoutError):
+                await asyncio.wait_for(condition.wait(), timeout=0.5)
 
 
-class SemaphoreTests(test_utils.TestCase):
-
-    def setUp(self):
-        super().setUp()
-        self.loop = self.new_test_loop()
-
-    def test_ctor_loop(self):
-        loop = mock.Mock()
-        with self.assertWarns(DeprecationWarning):
-            sem = asyncio.Semaphore(loop=loop)
-        self.assertIs(sem._loop, loop)
-
-        with self.assertWarns(DeprecationWarning):
-            sem = asyncio.Semaphore(loop=self.loop)
-        self.assertIs(sem._loop, self.loop)
-
-    def test_ctor_noloop(self):
-        asyncio.set_event_loop(self.loop)
-        sem = asyncio.Semaphore()
-        self.assertIs(sem._loop, self.loop)
+class SemaphoreTests(unittest.IsolatedAsyncioTestCase):
 
     def test_initial_value_zero(self):
-        with self.assertWarns(DeprecationWarning):
-            sem = asyncio.Semaphore(0, loop=self.loop)
+        sem = asyncio.Semaphore(0)
         self.assertTrue(sem.locked())
 
-    def test_repr(self):
-        with self.assertWarns(DeprecationWarning):
-            sem = asyncio.Semaphore(loop=self.loop)
+    async def test_repr(self):
+        sem = asyncio.Semaphore()
         self.assertTrue(repr(sem).endswith('[unlocked, value:1]>'))
         self.assertTrue(RGX_REPR.match(repr(sem)))
 
-        self.loop.run_until_complete(sem.acquire())
+        await sem.acquire()
         self.assertTrue(repr(sem).endswith('[locked]>'))
         self.assertTrue('waiters' not in repr(sem))
         self.assertTrue(RGX_REPR.match(repr(sem)))
@@ -849,9 +790,8 @@
         self.assertTrue('waiters:2' in repr(sem))
         self.assertTrue(RGX_REPR.match(repr(sem)))
 
-    def test_semaphore(self):
-        with self.assertWarns(DeprecationWarning):
-            sem = asyncio.Semaphore(loop=self.loop)
+    async def test_semaphore(self):
+        sem = asyncio.Semaphore()
         self.assertEqual(1, sem._value)
 
         with self.assertWarns(DeprecationWarning):
@@ -863,7 +803,7 @@
             TypeError,
             "'Semaphore' object is not iterable",
         ):
-            self.loop.run_until_complete(acquire_lock())
+            await acquire_lock()
 
         self.assertFalse(sem.locked())
         self.assertEqual(1, sem._value)
@@ -871,13 +811,12 @@
     def test_semaphore_value(self):
         self.assertRaises(ValueError, asyncio.Semaphore, -1)
 
-    def test_acquire(self):
-        with self.assertWarns(DeprecationWarning):
-            sem = asyncio.Semaphore(3, loop=self.loop)
+    async def test_acquire(self):
+        sem = asyncio.Semaphore(3)
         result = []
 
-        self.assertTrue(self.loop.run_until_complete(sem.acquire()))
-        self.assertTrue(self.loop.run_until_complete(sem.acquire()))
+        self.assertTrue(await sem.acquire())
+        self.assertTrue(await sem.acquire())
         self.assertFalse(sem.locked())
 
         async def c1(result):
@@ -900,23 +839,23 @@
             result.append(4)
             return True
 
-        t1 = self.loop.create_task(c1(result))
-        t2 = self.loop.create_task(c2(result))
-        t3 = self.loop.create_task(c3(result))
+        t1 = asyncio.create_task(c1(result))
+        t2 = asyncio.create_task(c2(result))
+        t3 = asyncio.create_task(c3(result))
 
-        test_utils.run_briefly(self.loop)
+        await asyncio.sleep(0)
         self.assertEqual([1], result)
         self.assertTrue(sem.locked())
         self.assertEqual(2, len(sem._waiters))
         self.assertEqual(0, sem._value)
 
-        t4 = self.loop.create_task(c4(result))
+        t4 = asyncio.create_task(c4(result))
 
         sem.release()
         sem.release()
         self.assertEqual(2, sem._value)
 
-        test_utils.run_briefly(self.loop)
+        await asyncio.sleep(0)
         self.assertEqual(0, sem._value)
         self.assertEqual(3, len(result))
         self.assertTrue(sem.locked())
@@ -931,69 +870,64 @@
 
         # cleanup locked semaphore
         sem.release()
-        self.loop.run_until_complete(asyncio.gather(*race_tasks))
+        await asyncio.gather(*race_tasks)
 
-    def test_acquire_cancel(self):
-        with self.assertWarns(DeprecationWarning):
-            sem = asyncio.Semaphore(loop=self.loop)
-        self.loop.run_until_complete(sem.acquire())
+    async def test_acquire_cancel(self):
+        sem = asyncio.Semaphore()
+        await sem.acquire()
 
-        acquire = self.loop.create_task(sem.acquire())
-        self.loop.call_soon(acquire.cancel)
-        self.assertRaises(
-            asyncio.CancelledError,
-            self.loop.run_until_complete, acquire)
+        acquire = asyncio.create_task(sem.acquire())
+        asyncio.get_running_loop().call_soon(acquire.cancel)
+        with self.assertRaises(asyncio.CancelledError):
+            await acquire
         self.assertTrue((not sem._waiters) or
                         all(waiter.done() for waiter in sem._waiters))
 
-    def test_acquire_cancel_before_awoken(self):
-        with self.assertWarns(DeprecationWarning):
-            sem = asyncio.Semaphore(value=0, loop=self.loop)
+    async def test_acquire_cancel_before_awoken(self):
+        sem = asyncio.Semaphore(value=0)
 
-        t1 = self.loop.create_task(sem.acquire())
-        t2 = self.loop.create_task(sem.acquire())
-        t3 = self.loop.create_task(sem.acquire())
-        t4 = self.loop.create_task(sem.acquire())
+        t1 = asyncio.create_task(sem.acquire())
+        t2 = asyncio.create_task(sem.acquire())
+        t3 = asyncio.create_task(sem.acquire())
+        t4 = asyncio.create_task(sem.acquire())
 
-        test_utils.run_briefly(self.loop)
+        await asyncio.sleep(0)
 
-        sem.release()
         t1.cancel()
         t2.cancel()
+        sem.release()
 
-        test_utils.run_briefly(self.loop)
+        await asyncio.sleep(0)
         num_done = sum(t.done() for t in [t3, t4])
         self.assertEqual(num_done, 1)
+        self.assertTrue(t3.done())
+        self.assertFalse(t4.done())
 
         t3.cancel()
         t4.cancel()
-        test_utils.run_briefly(self.loop)
+        await asyncio.sleep(0)
 
-    def test_acquire_hang(self):
-        with self.assertWarns(DeprecationWarning):
-            sem = asyncio.Semaphore(value=0, loop=self.loop)
+    async def test_acquire_hang(self):
+        sem = asyncio.Semaphore(value=0)
 
-        t1 = self.loop.create_task(sem.acquire())
-        t2 = self.loop.create_task(sem.acquire())
+        t1 = asyncio.create_task(sem.acquire())
+        t2 = asyncio.create_task(sem.acquire())
+        await asyncio.sleep(0)
 
-        test_utils.run_briefly(self.loop)
-
-        sem.release()
         t1.cancel()
-
-        test_utils.run_briefly(self.loop)
+        sem.release()
+        await asyncio.sleep(0)
         self.assertTrue(sem.locked())
+        self.assertTrue(t2.done())
 
     def test_release_not_acquired(self):
-        with self.assertWarns(DeprecationWarning):
-            sem = asyncio.BoundedSemaphore(loop=self.loop)
+        sem = asyncio.BoundedSemaphore()
 
         self.assertRaises(ValueError, sem.release)
 
-    def test_release_no_waiters(self):
-        with self.assertWarns(DeprecationWarning):
-            sem = asyncio.Semaphore(loop=self.loop)
-        self.loop.run_until_complete(sem.acquire())
+    async def test_release_no_waiters(self):
+        sem = asyncio.Semaphore()
+        await sem.acquire()
         self.assertTrue(sem.locked())
 
         sem.release()
diff --git a/Lib/test/test_asyncio/test_pep492.py b/Lib/test/test_asyncio/test_pep492.py
index c5e3a5c..4bd50f4 100644
--- a/Lib/test/test_asyncio/test_pep492.py
+++ b/Lib/test/test_asyncio/test_pep492.py
@@ -43,13 +43,12 @@
 class LockTests(BaseTest):
 
     def test_context_manager_async_with(self):
-        with self.assertWarns(DeprecationWarning):
-            primitives = [
-                asyncio.Lock(loop=self.loop),
-                asyncio.Condition(loop=self.loop),
-                asyncio.Semaphore(loop=self.loop),
-                asyncio.BoundedSemaphore(loop=self.loop),
-            ]
+        primitives = [
+            asyncio.Lock(),
+            asyncio.Condition(),
+            asyncio.Semaphore(),
+            asyncio.BoundedSemaphore(),
+        ]
 
         async def test(lock):
             await asyncio.sleep(0.01)
@@ -66,13 +65,12 @@
             self.assertFalse(primitive.locked())
 
     def test_context_manager_with_await(self):
-        with self.assertWarns(DeprecationWarning):
-            primitives = [
-                asyncio.Lock(loop=self.loop),
-                asyncio.Condition(loop=self.loop),
-                asyncio.Semaphore(loop=self.loop),
-                asyncio.BoundedSemaphore(loop=self.loop),
-            ]
+        primitives = [
+            asyncio.Lock(),
+            asyncio.Condition(),
+            asyncio.Semaphore(),
+            asyncio.BoundedSemaphore(),
+        ]
 
         async def test(lock):
             await asyncio.sleep(0.01)
diff --git a/Lib/test/test_asyncio/test_proactor_events.py b/Lib/test/test_asyncio/test_proactor_events.py
index 451f86a..fc6ee1c 100644
--- a/Lib/test/test_asyncio/test_proactor_events.py
+++ b/Lib/test/test_asyncio/test_proactor_events.py
@@ -12,7 +12,7 @@
 from asyncio.proactor_events import _ProactorWritePipeTransport
 from asyncio.proactor_events import _ProactorDuplexPipeTransport
 from asyncio.proactor_events import _ProactorDatagramTransport
-from test import support
+from test.support import os_helper
 from test.support import socket_helper
 from test.test_asyncio import utils as test_utils
 
@@ -40,6 +40,7 @@
         self.loop._proactor = self.proactor
         self.protocol = test_utils.make_test_protocol(asyncio.Protocol)
         self.sock = mock.Mock(socket.socket)
+        self.buffer_size = 65536
 
     def socket_transport(self, waiter=None):
         transport = _ProactorSocketTransport(self.loop, self.sock,
@@ -53,28 +54,32 @@
         test_utils.run_briefly(self.loop)
         self.assertIsNone(fut.result())
         self.protocol.connection_made(tr)
-        self.proactor.recv.assert_called_with(self.sock, 32768)
+        self.proactor.recv_into.assert_called_with(self.sock, bytearray(self.buffer_size))
 
     def test_loop_reading(self):
         tr = self.socket_transport()
         tr._loop_reading()
-        self.loop._proactor.recv.assert_called_with(self.sock, 32768)
+        self.loop._proactor.recv_into.assert_called_with(self.sock, bytearray(self.buffer_size))
         self.assertFalse(self.protocol.data_received.called)
         self.assertFalse(self.protocol.eof_received.called)
 
     def test_loop_reading_data(self):
+        buf = b'data'
         res = self.loop.create_future()
-        res.set_result(b'data')
+        res.set_result(len(buf))
 
         tr = self.socket_transport()
         tr._read_fut = res
+        tr._data[:len(buf)] = buf
         tr._loop_reading(res)
-        self.loop._proactor.recv.assert_called_with(self.sock, 32768)
-        self.protocol.data_received.assert_called_with(b'data')
+        called_buf = bytearray(self.buffer_size)
+        called_buf[:len(buf)] = buf
+        self.loop._proactor.recv_into.assert_called_with(self.sock, called_buf)
+        self.protocol.data_received.assert_called_with(bytearray(buf))
 
     def test_loop_reading_no_data(self):
         res = self.loop.create_future()
-        res.set_result(b'')
+        res.set_result(0)
 
         tr = self.socket_transport()
         self.assertRaises(AssertionError, tr._loop_reading, res)
@@ -82,12 +87,12 @@
         tr.close = mock.Mock()
         tr._read_fut = res
         tr._loop_reading(res)
-        self.assertFalse(self.loop._proactor.recv.called)
+        self.assertFalse(self.loop._proactor.recv_into.called)
         self.assertTrue(self.protocol.eof_received.called)
         self.assertTrue(tr.close.called)
 
     def test_loop_reading_aborted(self):
-        err = self.loop._proactor.recv.side_effect = ConnectionAbortedError()
+        err = self.loop._proactor.recv_into.side_effect = ConnectionAbortedError()
 
         tr = self.socket_transport()
         tr._fatal_error = mock.Mock()
@@ -97,7 +102,7 @@
                             'Fatal read error on pipe transport')
 
     def test_loop_reading_aborted_closing(self):
-        self.loop._proactor.recv.side_effect = ConnectionAbortedError()
+        self.loop._proactor.recv_into.side_effect = ConnectionAbortedError()
 
         tr = self.socket_transport()
         tr._closing = True
@@ -106,7 +111,7 @@
         self.assertFalse(tr._fatal_error.called)
 
     def test_loop_reading_aborted_is_fatal(self):
-        self.loop._proactor.recv.side_effect = ConnectionAbortedError()
+        self.loop._proactor.recv_into.side_effect = ConnectionAbortedError()
         tr = self.socket_transport()
         tr._closing = False
         tr._fatal_error = mock.Mock()
@@ -114,7 +119,7 @@
         self.assertTrue(tr._fatal_error.called)
 
     def test_loop_reading_conn_reset_lost(self):
-        err = self.loop._proactor.recv.side_effect = ConnectionResetError()
+        err = self.loop._proactor.recv_into.side_effect = ConnectionResetError()
 
         tr = self.socket_transport()
         tr._closing = False
@@ -125,7 +130,7 @@
         tr._force_close.assert_called_with(err)
 
     def test_loop_reading_exception(self):
-        err = self.loop._proactor.recv.side_effect = (OSError())
+        err = self.loop._proactor.recv_into.side_effect = (OSError())
 
         tr = self.socket_transport()
         tr._fatal_error = mock.Mock()
@@ -236,6 +241,14 @@
         test_utils.run_briefly(self.loop)
         self.assertFalse(self.protocol.connection_lost.called)
 
+    def test_close_invalid_sockobj(self):
+        tr = self.socket_transport()
+        self.sock.fileno.return_value = -1
+        tr.close()
+        test_utils.run_briefly(self.loop)
+        self.protocol.connection_lost.assert_called_with(None)
+        self.assertFalse(self.sock.shutdown.called)
+
     @mock.patch('asyncio.base_events.logger')
     def test_fatal_error(self, m_logging):
         tr = self.socket_transport()
@@ -351,20 +364,31 @@
 
     def test_pause_resume_reading(self):
         tr = self.socket_transport()
-        futures = []
-        for msg in [b'data1', b'data2', b'data3', b'data4', b'data5', b'']:
-            f = self.loop.create_future()
-            f.set_result(msg)
-            futures.append(f)
+        index = 0
+        msgs = [b'data1', b'data2', b'data3', b'data4', b'data5', b'']
+        reversed_msgs = list(reversed(msgs))
 
-        self.loop._proactor.recv.side_effect = futures
+        def recv_into(sock, data):
+            f = self.loop.create_future()
+            msg = reversed_msgs.pop()
+
+            result = f.result
+            def monkey():
+                data[:len(msg)] = msg
+                return result()
+            f.result = monkey
+
+            f.set_result(len(msg))
+            return f
+
+        self.loop._proactor.recv_into.side_effect = recv_into
         self.loop._run_once()
         self.assertFalse(tr._paused)
         self.assertTrue(tr.is_reading())
-        self.loop._run_once()
-        self.protocol.data_received.assert_called_with(b'data1')
-        self.loop._run_once()
-        self.protocol.data_received.assert_called_with(b'data2')
+
+        for msg in msgs[:2]:
+            self.loop._run_once()
+            self.protocol.data_received.assert_called_with(bytearray(msg))
 
         tr.pause_reading()
         tr.pause_reading()
@@ -372,23 +396,23 @@
         self.assertFalse(tr.is_reading())
         for i in range(10):
             self.loop._run_once()
-        self.protocol.data_received.assert_called_with(b'data2')
+        self.protocol.data_received.assert_called_with(bytearray(msgs[1]))
 
         tr.resume_reading()
         tr.resume_reading()
         self.assertFalse(tr._paused)
         self.assertTrue(tr.is_reading())
-        self.loop._run_once()
-        self.protocol.data_received.assert_called_with(b'data3')
-        self.loop._run_once()
-        self.protocol.data_received.assert_called_with(b'data4')
+
+        for msg in msgs[2:4]:
+            self.loop._run_once()
+            self.protocol.data_received.assert_called_with(bytearray(msg))
 
         tr.pause_reading()
         tr.resume_reading()
         self.loop.call_exception_handler = mock.Mock()
         self.loop._run_once()
         self.loop.call_exception_handler.assert_not_called()
-        self.protocol.data_received.assert_called_with(b'data5')
+        self.protocol.data_received.assert_called_with(bytearray(msgs[4]))
         tr.close()
 
         self.assertFalse(tr.is_reading())
@@ -822,6 +846,7 @@
     def test_make_datagram_transport(self):
         tr = self.datagram_transport()
         self.assertIsInstance(tr, _ProactorDatagramTransport)
+        self.assertIsInstance(tr, asyncio.DatagramTransport)
         close_transport(tr)
 
     def test_datagram_loop_writing(self):
@@ -920,20 +945,20 @@
 
     @classmethod
     def setUpClass(cls):
-        with open(support.TESTFN, 'wb') as fp:
+        with open(os_helper.TESTFN, 'wb') as fp:
             fp.write(cls.DATA)
         super().setUpClass()
 
     @classmethod
     def tearDownClass(cls):
-        support.unlink(support.TESTFN)
+        os_helper.unlink(os_helper.TESTFN)
         super().tearDownClass()
 
     def setUp(self):
         self.loop = asyncio.ProactorEventLoop()
         self.set_event_loop(self.loop)
         self.addCleanup(self.loop.close)
-        self.file = open(support.TESTFN, 'rb')
+        self.file = open(os_helper.TESTFN, 'rb')
         self.addCleanup(self.file.close)
         super().setUp()
 
diff --git a/Lib/test/test_asyncio/test_protocols.py b/Lib/test/test_asyncio/test_protocols.py
index 438111c..0f23263 100644
--- a/Lib/test/test_asyncio/test_protocols.py
+++ b/Lib/test/test_asyncio/test_protocols.py
@@ -4,6 +4,12 @@
 import asyncio
 
 
+def tearDownModule():
+    # not needed for the test file but added for uniformness with all other
+    # asyncio test files for the sake of unified cleanup
+    asyncio.set_event_loop_policy(None)
+
+
 class ProtocolsAbsTests(unittest.TestCase):
 
     def test_base_protocol(self):
@@ -55,3 +61,7 @@
         self.assertIsNone(sp.pipe_connection_lost(1, f))
         self.assertIsNone(sp.process_exited())
         self.assertFalse(hasattr(sp, '__dict__'))
+
+
+if __name__ == '__main__':
+    unittest.main()
diff --git a/Lib/test/test_asyncio/test_queues.py b/Lib/test/test_asyncio/test_queues.py
index 5c9aaa8..b1a53b8 100644
--- a/Lib/test/test_asyncio/test_queues.py
+++ b/Lib/test/test_asyncio/test_queues.py
@@ -1,9 +1,8 @@
 """Tests for queues.py"""
 
 import unittest
-from unittest import mock
-
 import asyncio
+from types import GenericAlias
 from test.test_asyncio import utils as test_utils
 
 
@@ -35,14 +34,13 @@
 
         loop = self.new_test_loop(gen)
 
-        with self.assertWarns(DeprecationWarning):
-            q = asyncio.Queue(loop=loop)
+        q = asyncio.Queue()
         self.assertTrue(fn(q).startswith('<Queue'), fn(q))
         id_is_present = hex(id(q)) in fn(q)
         self.assertEqual(expect_id, id_is_present)
 
         async def add_getter():
-            q = asyncio.Queue(loop=loop)
+            q = asyncio.Queue()
             # Start a task that waits to get.
             loop.create_task(q.get())
             # Let it start waiting.
@@ -51,11 +49,10 @@
             # resume q.get coroutine to finish generator
             q.put_nowait(0)
 
-        with self.assertWarns(DeprecationWarning):
-            loop.run_until_complete(add_getter())
+        loop.run_until_complete(add_getter())
 
         async def add_putter():
-            q = asyncio.Queue(maxsize=1, loop=loop)
+            q = asyncio.Queue(maxsize=1)
             q.put_nowait(1)
             # Start a task that waits to put.
             loop.create_task(q.put(2))
@@ -65,36 +62,24 @@
             # resume q.put coroutine to finish generator
             q.get_nowait()
 
-        with self.assertWarns(DeprecationWarning):
-            loop.run_until_complete(add_putter())
-            q = asyncio.Queue(loop=loop)
+        loop.run_until_complete(add_putter())
+        q = asyncio.Queue()
         q.put_nowait(1)
         self.assertTrue('_queue=[1]' in fn(q))
 
-    def test_ctor_loop(self):
-        loop = mock.Mock()
-        with self.assertWarns(DeprecationWarning):
-            q = asyncio.Queue(loop=loop)
-        self.assertIs(q._loop, loop)
-
-        with self.assertWarns(DeprecationWarning):
-            q = asyncio.Queue(loop=self.loop)
-        self.assertIs(q._loop, self.loop)
-
-    def test_ctor_noloop(self):
-        asyncio.set_event_loop(self.loop)
-        q = asyncio.Queue()
-        self.assertIs(q._loop, self.loop)
-
     def test_repr(self):
         self._test_repr_or_str(repr, True)
 
     def test_str(self):
         self._test_repr_or_str(str, False)
 
+    def test_generic_alias(self):
+        q = asyncio.Queue[int]
+        self.assertEqual(q.__args__, (int,))
+        self.assertIsInstance(q, GenericAlias)
+
     def test_empty(self):
-        with self.assertWarns(DeprecationWarning):
-            q = asyncio.Queue(loop=self.loop)
+        q = asyncio.Queue()
         self.assertTrue(q.empty())
         q.put_nowait(1)
         self.assertFalse(q.empty())
@@ -102,18 +87,15 @@
         self.assertTrue(q.empty())
 
     def test_full(self):
-        with self.assertWarns(DeprecationWarning):
-            q = asyncio.Queue(loop=self.loop)
+        q = asyncio.Queue()
         self.assertFalse(q.full())
 
-        with self.assertWarns(DeprecationWarning):
-            q = asyncio.Queue(maxsize=1, loop=self.loop)
+        q = asyncio.Queue(maxsize=1)
         q.put_nowait(1)
         self.assertTrue(q.full())
 
     def test_order(self):
-        with self.assertWarns(DeprecationWarning):
-            q = asyncio.Queue(loop=self.loop)
+        q = asyncio.Queue()
         for i in [1, 3, 2]:
             q.put_nowait(i)
 
@@ -131,8 +113,7 @@
 
         loop = self.new_test_loop(gen)
 
-        with self.assertWarns(DeprecationWarning):
-            q = asyncio.Queue(maxsize=2, loop=loop)
+        q = asyncio.Queue(maxsize=2)
         self.assertEqual(2, q.maxsize)
         have_been_put = []
 
@@ -166,8 +147,7 @@
 class QueueGetTests(_QueueTestBase):
 
     def test_blocking_get(self):
-        with self.assertWarns(DeprecationWarning):
-            q = asyncio.Queue(loop=self.loop)
+        q = asyncio.Queue()
         q.put_nowait(1)
 
         async def queue_get():
@@ -177,8 +157,7 @@
         self.assertEqual(1, res)
 
     def test_get_with_putters(self):
-        with self.assertWarns(DeprecationWarning):
-            q = asyncio.Queue(1, loop=self.loop)
+        q = asyncio.Queue(1)
         q.put_nowait(1)
 
         waiter = self.loop.create_future()
@@ -198,9 +177,8 @@
 
         loop = self.new_test_loop(gen)
 
-        with self.assertWarns(DeprecationWarning):
-            q = asyncio.Queue(loop=loop)
-            started = asyncio.Event(loop=loop)
+        q = asyncio.Queue()
+        started = asyncio.Event()
         finished = False
 
         async def queue_get():
@@ -224,14 +202,12 @@
         self.assertAlmostEqual(0.01, loop.time())
 
     def test_nonblocking_get(self):
-        with self.assertWarns(DeprecationWarning):
-            q = asyncio.Queue(loop=self.loop)
+        q = asyncio.Queue()
         q.put_nowait(1)
         self.assertEqual(1, q.get_nowait())
 
     def test_nonblocking_get_exception(self):
-        with self.assertWarns(DeprecationWarning):
-            q = asyncio.Queue(loop=self.loop)
+        q = asyncio.Queue()
         self.assertRaises(asyncio.QueueEmpty, q.get_nowait)
 
     def test_get_cancelled(self):
@@ -245,8 +221,7 @@
 
         loop = self.new_test_loop(gen)
 
-        with self.assertWarns(DeprecationWarning):
-            q = asyncio.Queue(loop=loop)
+        q = asyncio.Queue()
 
         async def queue_get():
             return await asyncio.wait_for(q.get(), 0.051)
@@ -261,8 +236,7 @@
         self.assertAlmostEqual(0.06, loop.time())
 
     def test_get_cancelled_race(self):
-        with self.assertWarns(DeprecationWarning):
-            q = asyncio.Queue(loop=self.loop)
+        q = asyncio.Queue()
 
         t1 = self.loop.create_task(q.get())
         t2 = self.loop.create_task(q.get())
@@ -276,8 +250,7 @@
         self.assertEqual(t2.result(), 'a')
 
     def test_get_with_waiting_putters(self):
-        with self.assertWarns(DeprecationWarning):
-            q = asyncio.Queue(loop=self.loop, maxsize=1)
+        q = asyncio.Queue(maxsize=1)
         self.loop.create_task(q.put('a'))
         self.loop.create_task(q.put('b'))
         test_utils.run_briefly(self.loop)
@@ -286,6 +259,7 @@
 
     def test_why_are_getters_waiting(self):
         # From issue #268.
+        asyncio.set_event_loop(self.loop)
 
         async def consumer(queue, num_expected):
             for _ in range(num_expected):
@@ -298,14 +272,17 @@
         queue_size = 1
         producer_num_items = 5
 
-        with self.assertWarns(DeprecationWarning):
-            q = asyncio.Queue(queue_size, loop=self.loop)
+        async def create_queue():
+            queue = asyncio.Queue(queue_size)
+            queue._get_loop()
+            return queue
 
-        self.loop.run_until_complete(
-            asyncio.gather(producer(q, producer_num_items),
-                           consumer(q, producer_num_items),
-                           loop=self.loop),
-            )
+        async def test():
+            q = await create_queue()
+            await asyncio.gather(producer(q, producer_num_items),
+                                 consumer(q, producer_num_items))
+
+        self.loop.run_until_complete(test())
 
     def test_cancelled_getters_not_being_held_in_self_getters(self):
         def a_generator():
@@ -320,8 +297,7 @@
             except asyncio.TimeoutError:
                 pass
 
-        with self.assertWarns(DeprecationWarning):
-            queue = asyncio.Queue(loop=self.loop, maxsize=5)
+        queue = asyncio.Queue(maxsize=5)
         self.loop.run_until_complete(self.loop.create_task(consumer(queue)))
         self.assertEqual(len(queue._getters), 0)
 
@@ -329,8 +305,7 @@
 class QueuePutTests(_QueueTestBase):
 
     def test_blocking_put(self):
-        with self.assertWarns(DeprecationWarning):
-            q = asyncio.Queue(loop=self.loop)
+        q = asyncio.Queue()
 
         async def queue_put():
             # No maxsize, won't block.
@@ -347,9 +322,8 @@
 
         loop = self.new_test_loop(gen)
 
-        with self.assertWarns(DeprecationWarning):
-            q = asyncio.Queue(maxsize=1, loop=loop)
-            started = asyncio.Event(loop=loop)
+        q = asyncio.Queue(maxsize=1)
+        started = asyncio.Event()
         finished = False
 
         async def queue_put():
@@ -371,8 +345,7 @@
         self.assertAlmostEqual(0.01, loop.time())
 
     def test_nonblocking_put(self):
-        with self.assertWarns(DeprecationWarning):
-            q = asyncio.Queue(loop=self.loop)
+        q = asyncio.Queue()
         q.put_nowait(1)
         self.assertEqual(1, q.get_nowait())
 
@@ -383,8 +356,7 @@
 
         loop = self.new_test_loop(gen)
 
-        with self.assertWarns(DeprecationWarning):
-            q = asyncio.Queue(loop=loop)
+        q = asyncio.Queue()
 
         reader = loop.create_task(q.get())
 
@@ -413,8 +385,7 @@
         loop = self.new_test_loop(gen)
         loop.set_debug(True)
 
-        with self.assertWarns(DeprecationWarning):
-            q = asyncio.Queue(loop=loop)
+        q = asyncio.Queue()
 
         reader1 = loop.create_task(q.get())
         reader2 = loop.create_task(q.get())
@@ -444,8 +415,7 @@
 
         loop = self.new_test_loop(gen)
 
-        with self.assertWarns(DeprecationWarning):
-            q = asyncio.Queue(1, loop=loop)
+        q = asyncio.Queue(1)
 
         q.put_nowait(1)
 
@@ -469,21 +439,18 @@
         self.assertEqual(q.qsize(), 0)
 
     def test_nonblocking_put_exception(self):
-        with self.assertWarns(DeprecationWarning):
-            q = asyncio.Queue(maxsize=1, loop=self.loop)
+        q = asyncio.Queue(maxsize=1, )
         q.put_nowait(1)
         self.assertRaises(asyncio.QueueFull, q.put_nowait, 2)
 
     def test_float_maxsize(self):
-        with self.assertWarns(DeprecationWarning):
-            q = asyncio.Queue(maxsize=1.3, loop=self.loop)
+        q = asyncio.Queue(maxsize=1.3, )
         q.put_nowait(1)
         q.put_nowait(2)
         self.assertTrue(q.full())
         self.assertRaises(asyncio.QueueFull, q.put_nowait, 3)
 
-        with self.assertWarns(DeprecationWarning):
-            q = asyncio.Queue(maxsize=1.3, loop=self.loop)
+        q = asyncio.Queue(maxsize=1.3, )
 
         async def queue_put():
             await q.put(1)
@@ -492,8 +459,7 @@
         self.loop.run_until_complete(queue_put())
 
     def test_put_cancelled(self):
-        with self.assertWarns(DeprecationWarning):
-            q = asyncio.Queue(loop=self.loop)
+        q = asyncio.Queue()
 
         async def queue_put():
             await q.put(1)
@@ -508,8 +474,7 @@
         self.assertTrue(t.result())
 
     def test_put_cancelled_race(self):
-        with self.assertWarns(DeprecationWarning):
-            q = asyncio.Queue(loop=self.loop, maxsize=1)
+        q = asyncio.Queue(maxsize=1)
 
         put_a = self.loop.create_task(q.put('a'))
         put_b = self.loop.create_task(q.put('b'))
@@ -529,8 +494,7 @@
         self.loop.run_until_complete(put_b)
 
     def test_put_with_waiting_getters(self):
-        with self.assertWarns(DeprecationWarning):
-            q = asyncio.Queue(loop=self.loop)
+        q = asyncio.Queue()
         t = self.loop.create_task(q.get())
         test_utils.run_briefly(self.loop)
         self.loop.run_until_complete(q.put('a'))
@@ -538,9 +502,14 @@
 
     def test_why_are_putters_waiting(self):
         # From issue #265.
+        asyncio.set_event_loop(self.loop)
 
-        with self.assertWarns(DeprecationWarning):
-            queue = asyncio.Queue(2, loop=self.loop)
+        async def create_queue():
+            q = asyncio.Queue(2)
+            q._get_loop()
+            return q
+
+        queue = self.loop.run_until_complete(create_queue())
 
         async def putter(item):
             await queue.put(item)
@@ -551,12 +520,14 @@
             for _ in range(num):
                 item = queue.get_nowait()
 
-        t0 = putter(0)
-        t1 = putter(1)
-        t2 = putter(2)
-        t3 = putter(3)
-        self.loop.run_until_complete(
-            asyncio.gather(getter(), t0, t1, t2, t3, loop=self.loop))
+        async def test():
+            t0 = putter(0)
+            t1 = putter(1)
+            t2 = putter(2)
+            t3 = putter(3)
+            await asyncio.gather(getter(), t0, t1, t2, t3)
+
+        self.loop.run_until_complete(test())
 
     def test_cancelled_puts_not_being_held_in_self_putters(self):
         def a_generator():
@@ -566,8 +537,7 @@
         loop = self.new_test_loop(a_generator)
 
         # Full queue.
-        with self.assertWarns(DeprecationWarning):
-            queue = asyncio.Queue(loop=loop, maxsize=1)
+        queue = asyncio.Queue(maxsize=1)
         queue.put_nowait(1)
 
         # Task waiting for space to put an item in the queue.
@@ -590,8 +560,7 @@
         loop = self.new_test_loop(gen)
 
         # Full Queue.
-        with self.assertWarns(DeprecationWarning):
-            queue = asyncio.Queue(1, loop=loop)
+        queue = asyncio.Queue(1)
         queue.put_nowait(1)
 
         # Task waiting for space to put a item in the queue.
@@ -614,8 +583,7 @@
 class LifoQueueTests(_QueueTestBase):
 
     def test_order(self):
-        with self.assertWarns(DeprecationWarning):
-            q = asyncio.LifoQueue(loop=self.loop)
+        q = asyncio.LifoQueue()
         for i in [1, 3, 2]:
             q.put_nowait(i)
 
@@ -626,8 +594,7 @@
 class PriorityQueueTests(_QueueTestBase):
 
     def test_order(self):
-        with self.assertWarns(DeprecationWarning):
-            q = asyncio.PriorityQueue(loop=self.loop)
+        q = asyncio.PriorityQueue()
         for i in [1, 3, 2]:
             q.put_nowait(i)
 
@@ -640,13 +607,11 @@
     q_class = None
 
     def test_task_done_underflow(self):
-        with self.assertWarns(DeprecationWarning):
-            q = self.q_class(loop=self.loop)
+        q = self.q_class()
         self.assertRaises(ValueError, q.task_done)
 
     def test_task_done(self):
-        with self.assertWarns(DeprecationWarning):
-            q = self.q_class(loop=self.loop)
+        q = self.q_class()
         for i in range(100):
             q.put_nowait(i)
 
@@ -681,8 +646,7 @@
         self.loop.run_until_complete(asyncio.wait(tasks))
 
     def test_join_empty_queue(self):
-        with self.assertWarns(DeprecationWarning):
-            q = self.q_class(loop=self.loop)
+        q = self.q_class()
 
         # Test that a queue join()s successfully, and before anything else
         # (done twice for insurance).
@@ -694,8 +658,7 @@
         self.loop.run_until_complete(join())
 
     def test_format(self):
-        with self.assertWarns(DeprecationWarning):
-            q = self.q_class(loop=self.loop)
+        q = self.q_class()
         self.assertEqual(q._format(), 'maxsize=0')
 
         q._unfinished_tasks = 2
diff --git a/Lib/test/test_asyncio/test_runners.py b/Lib/test/test_asyncio/test_runners.py
index b9ae02d..1122736 100644
--- a/Lib/test/test_asyncio/test_runners.py
+++ b/Lib/test/test_asyncio/test_runners.py
@@ -2,7 +2,11 @@
 import unittest
 
 from unittest import mock
-from . import utils as test_utils
+from test.test_asyncio import utils as test_utils
+
+
+def tearDownModule():
+    asyncio.set_event_loop_policy(None)
 
 
 class TestPolicy(asyncio.AbstractEventLoopPolicy):
@@ -180,3 +184,7 @@
 
         self.assertIsNone(spinner.ag_frame)
         self.assertFalse(spinner.ag_running)
+
+
+if __name__ == '__main__':
+    unittest.main()
diff --git a/Lib/test/test_asyncio/test_selector_events.py b/Lib/test/test_asyncio/test_selector_events.py
index 1613c75..ac221da 100644
--- a/Lib/test/test_asyncio/test_selector_events.py
+++ b/Lib/test/test_asyncio/test_selector_events.py
@@ -188,6 +188,24 @@
         self.loop._csock.send.side_effect = RuntimeError()
         self.assertRaises(RuntimeError, self.loop._write_to_self)
 
+    @mock.patch('socket.getaddrinfo')
+    def test_sock_connect_resolve_using_socket_params(self, m_gai):
+        addr = ('need-resolution.com', 8080)
+        for sock_type in [socket.SOCK_STREAM, socket.SOCK_DGRAM]:
+            with self.subTest(sock_type):
+                sock = test_utils.mock_nonblocking_socket(type=sock_type)
+
+                m_gai.side_effect = \
+                    lambda *args: [(None, None, None, None, ('127.0.0.1', 0))]
+
+                con = self.loop.create_task(self.loop.sock_connect(sock, addr))
+                self.loop.run_until_complete(con)
+                m_gai.assert_called_with(
+                    addr[0], addr[1], sock.family, sock.type, sock.proto, 0)
+
+                self.loop.run_until_complete(con)
+                sock.connect.assert_called_with(('127.0.0.1', 0))
+
     def test_add_reader(self):
         self.loop._selector.get_key.side_effect = KeyError
         cb = lambda: True
diff --git a/Lib/test/test_asyncio/test_sendfile.py b/Lib/test/test_asyncio/test_sendfile.py
index 1b1af08..effca66 100644
--- a/Lib/test/test_asyncio/test_sendfile.py
+++ b/Lib/test/test_asyncio/test_sendfile.py
@@ -10,6 +10,7 @@
 from asyncio import constants
 from unittest import mock
 from test import support
+from test.support import os_helper
 from test.support import socket_helper
 from test.test_asyncio import utils as test_utils
 
@@ -35,25 +36,29 @@
         self.data = bytearray()
         self.close_after = close_after
 
+    def _assert_state(self, *expected):
+        if self.state not in expected:
+            raise AssertionError(f'state: {self.state!r}, expected: {expected!r}')
+
     def connection_made(self, transport):
         self.transport = transport
-        assert self.state == 'INITIAL', self.state
+        self._assert_state('INITIAL')
         self.state = 'CONNECTED'
         if self.connected:
             self.connected.set_result(None)
 
     def eof_received(self):
-        assert self.state == 'CONNECTED', self.state
+        self._assert_state('CONNECTED')
         self.state = 'EOF'
 
     def connection_lost(self, exc):
-        assert self.state in ('CONNECTED', 'EOF'), self.state
+        self._assert_state('CONNECTED', 'EOF')
         self.state = 'CLOSED'
         if self.done:
             self.done.set_result(None)
 
     def data_received(self, data):
-        assert self.state == 'CONNECTED', self.state
+        self._assert_state('CONNECTED')
         self.nbytes += len(data)
         self.data.extend(data)
         super().data_received(data)
@@ -87,9 +92,13 @@
 
 class SendfileBase:
 
-      # 128 KiB plus small unaligned to buffer chunk
-    DATA = b"SendfileBaseData" * (1024 * 8 + 1)
-
+    # 256 KiB plus small unaligned to buffer chunk
+    # Newer versions of Windows seems to have increased its internal 
+    # buffer and tries to send as much of the data as it can as it 
+    # has some form of buffering for this which is less than 256KiB
+    # on newer server versions and Windows 11.
+    # So DATA should be larger than 256 KiB to make this test reliable.
+    DATA = b"x" * (1024 * 256 + 1)
     # Reduce socket buffer size to test on relative small data sets.
     BUF_SIZE = 4 * 1024   # 4 KiB
 
@@ -98,17 +107,17 @@
 
     @classmethod
     def setUpClass(cls):
-        with open(support.TESTFN, 'wb') as fp:
+        with open(os_helper.TESTFN, 'wb') as fp:
             fp.write(cls.DATA)
         super().setUpClass()
 
     @classmethod
     def tearDownClass(cls):
-        support.unlink(support.TESTFN)
+        os_helper.unlink(os_helper.TESTFN)
         super().tearDownClass()
 
     def setUp(self):
-        self.file = open(support.TESTFN, 'rb')
+        self.file = open(os_helper.TESTFN, 'rb')
         self.addCleanup(self.file.close)
         self.loop = self.create_event_loop()
         self.set_event_loop(self.loop)
@@ -560,3 +569,7 @@
 
         def create_event_loop(self):
             return asyncio.SelectorEventLoop(selectors.SelectSelector())
+
+
+if __name__ == '__main__':
+    unittest.main()
diff --git a/Lib/test/test_asyncio/test_server.py b/Lib/test/test_asyncio/test_server.py
index 2de4dca..860d62d 100644
--- a/Lib/test/test_asyncio/test_server.py
+++ b/Lib/test/test_asyncio/test_server.py
@@ -45,9 +45,8 @@
             async with srv:
                 await srv.serve_forever()
 
-        with self.assertWarns(DeprecationWarning):
-            srv = self.loop.run_until_complete(asyncio.start_server(
-                serve, socket_helper.HOSTv4, 0, loop=self.loop, start_serving=False))
+        srv = self.loop.run_until_complete(asyncio.start_server(
+            serve, socket_helper.HOSTv4, 0, start_serving=False))
 
         self.assertFalse(srv.is_serving())
 
@@ -102,9 +101,8 @@
                 await srv.serve_forever()
 
         with test_utils.unix_socket_path() as addr:
-            with self.assertWarns(DeprecationWarning):
-                srv = self.loop.run_until_complete(asyncio.start_unix_server(
-                    serve, addr, loop=self.loop, start_serving=False))
+            srv = self.loop.run_until_complete(asyncio.start_unix_server(
+                serve, addr, start_serving=False))
 
             main_task = self.loop.create_task(main(srv))
 
diff --git a/Lib/test/test_asyncio/test_sock_lowlevel.py b/Lib/test/test_asyncio/test_sock_lowlevel.py
index d8a5df8..14001a4 100644
--- a/Lib/test/test_asyncio/test_sock_lowlevel.py
+++ b/Lib/test/test_asyncio/test_sock_lowlevel.py
@@ -1,5 +1,4 @@
 import socket
-import time
 import asyncio
 import sys
 import unittest
@@ -11,6 +10,10 @@
 from test.support import socket_helper
 
 
+def tearDownModule():
+    asyncio.set_event_loop_policy(None)
+
+
 class MyProto(asyncio.Protocol):
     connected = None
     done = None
@@ -23,24 +26,28 @@
             self.connected = loop.create_future()
             self.done = loop.create_future()
 
+    def _assert_state(self, *expected):
+        if self.state not in expected:
+            raise AssertionError(f'state: {self.state!r}, expected: {expected!r}')
+
     def connection_made(self, transport):
         self.transport = transport
-        assert self.state == 'INITIAL', self.state
+        self._assert_state('INITIAL')
         self.state = 'CONNECTED'
         if self.connected:
             self.connected.set_result(None)
         transport.write(b'GET / HTTP/1.0\r\nHost: example.com\r\n\r\n')
 
     def data_received(self, data):
-        assert self.state == 'CONNECTED', self.state
+        self._assert_state('CONNECTED')
         self.nbytes += len(data)
 
     def eof_received(self):
-        assert self.state == 'CONNECTED', self.state
+        self._assert_state('CONNECTED')
         self.state = 'EOF'
 
     def connection_lost(self, exc):
-        assert self.state in ('CONNECTED', 'EOF'), self.state
+        self._assert_state('CONNECTED', 'EOF')
         self.state = 'CLOSED'
         if self.done:
             self.done.set_result(None)
@@ -451,7 +458,7 @@
                 else:
                     break
             else:
-                assert False, 'Can not create socket.'
+                self.fail('Can not create socket.')
 
             f = self.loop.create_connection(
                 lambda: MyProto(loop=self.loop), sock=sock)
@@ -508,3 +515,7 @@
 
         def create_event_loop(self):
             return asyncio.SelectorEventLoop(selectors.SelectSelector())
+
+
+if __name__ == '__main__':
+    unittest.main()
diff --git a/Lib/test/test_asyncio/test_sslproto.py b/Lib/test/test_asyncio/test_sslproto.py
index 948820c..f7411a8 100644
--- a/Lib/test/test_asyncio/test_sslproto.py
+++ b/Lib/test/test_asyncio/test_sslproto.py
@@ -2,7 +2,6 @@
 
 import logging
 import socket
-from test import support
 import unittest
 import weakref
 from unittest import mock
@@ -278,6 +277,7 @@
 
         # No garbage is left if SSL is closed uncleanly
         client_context = weakref.ref(client_context)
+        support.gc_collect()
         self.assertIsNone(client_context())
 
     def test_create_connection_memory_leak(self):
@@ -341,6 +341,7 @@
         # No garbage is left for SSL client from loop.create_connection, even
         # if user stores the SSLTransport in corresponding protocol instance
         client_context = weakref.ref(client_context)
+        support.gc_collect()
         self.assertIsNone(client_context())
 
     def test_start_tls_client_buf_proto_1(self):
@@ -381,9 +382,9 @@
             def get_buffer(self, sizehint):
                 return self.buf
 
-            def buffer_updated(self, nsize):
-                assert nsize == 1
-                self.on_data.set_result(bytes(self.buf[:nsize]))
+            def buffer_updated(slf, nsize):
+                self.assertEqual(nsize, 1)
+                slf.on_data.set_result(bytes(slf.buf[:nsize]))
 
         class ClientProtoSecond(asyncio.Protocol):
             def __init__(self, on_data, on_eof):
@@ -640,6 +641,7 @@
         # The 10s handshake timeout should be cancelled to free related
         # objects without really waiting for 10s
         client_sslctx = weakref.ref(client_sslctx)
+        support.gc_collect()
         self.assertIsNone(client_sslctx())
 
     def test_create_connection_ssl_slow_handshake(self):
@@ -657,13 +659,11 @@
                 sock.close()
 
         async def client(addr):
-            with self.assertWarns(DeprecationWarning):
-                reader, writer = await asyncio.open_connection(
-                    *addr,
-                    ssl=client_sslctx,
-                    server_hostname='',
-                    loop=self.loop,
-                    ssl_handshake_timeout=1.0)
+            reader, writer = await asyncio.open_connection(
+                *addr,
+                ssl=client_sslctx,
+                server_hostname='',
+                ssl_handshake_timeout=1.0)
 
         with self.tcp_server(server,
                              max_clients=1,
@@ -697,13 +697,11 @@
                 sock.close()
 
         async def client(addr):
-            with self.assertWarns(DeprecationWarning):
-                reader, writer = await asyncio.open_connection(
-                    *addr,
-                    ssl=client_sslctx,
-                    server_hostname='',
-                    loop=self.loop,
-                    ssl_handshake_timeout=support.LOOPBACK_TIMEOUT)
+            reader, writer = await asyncio.open_connection(
+                *addr,
+                ssl=client_sslctx,
+                server_hostname='',
+                ssl_handshake_timeout=support.LOOPBACK_TIMEOUT)
 
         with self.tcp_server(server,
                              max_clients=1,
@@ -734,12 +732,10 @@
                 sock.close()
 
         async def client(addr):
-            with self.assertWarns(DeprecationWarning):
-                reader, writer = await asyncio.open_connection(
-                    *addr,
-                    ssl=client_sslctx,
-                    server_hostname='',
-                    loop=self.loop)
+            reader, writer = await asyncio.open_connection(
+                *addr,
+                ssl=client_sslctx,
+                server_hostname='')
 
             self.assertEqual(await reader.readline(), b'A\n')
             writer.write(b'B')
diff --git a/Lib/test/test_asyncio/test_streams.py b/Lib/test/test_asyncio/test_streams.py
index 71de82d..227b227 100644
--- a/Lib/test/test_asyncio/test_streams.py
+++ b/Lib/test/test_asyncio/test_streams.py
@@ -40,16 +40,10 @@
         gc.collect()
         super().tearDown()
 
-    @mock.patch('asyncio.streams.events')
-    def test_ctor_global_loop(self, m_events):
-        stream = asyncio.StreamReader()
-        self.assertIs(stream._loop, m_events.get_event_loop.return_value)
-
     def _basetest_open_connection(self, open_connection_fut):
         messages = []
         self.loop.set_exception_handler(lambda loop, ctx: messages.append(ctx))
-        with self.assertWarns(DeprecationWarning):
-            reader, writer = self.loop.run_until_complete(open_connection_fut)
+        reader, writer = self.loop.run_until_complete(open_connection_fut)
         writer.write(b'GET / HTTP/1.0\r\n\r\n')
         f = reader.readline()
         data = self.loop.run_until_complete(f)
@@ -62,23 +56,20 @@
 
     def test_open_connection(self):
         with test_utils.run_test_server() as httpd:
-            conn_fut = asyncio.open_connection(*httpd.address,
-                                               loop=self.loop)
+            conn_fut = asyncio.open_connection(*httpd.address)
             self._basetest_open_connection(conn_fut)
 
     @socket_helper.skip_unless_bind_unix_socket
     def test_open_unix_connection(self):
         with test_utils.run_test_unix_server() as httpd:
-            conn_fut = asyncio.open_unix_connection(httpd.address,
-                                                    loop=self.loop)
+            conn_fut = asyncio.open_unix_connection(httpd.address)
             self._basetest_open_connection(conn_fut)
 
     def _basetest_open_connection_no_loop_ssl(self, open_connection_fut):
         messages = []
         self.loop.set_exception_handler(lambda loop, ctx: messages.append(ctx))
         try:
-            with self.assertWarns(DeprecationWarning):
-                reader, writer = self.loop.run_until_complete(open_connection_fut)
+            reader, writer = self.loop.run_until_complete(open_connection_fut)
         finally:
             asyncio.set_event_loop(None)
         writer.write(b'GET / HTTP/1.0\r\n\r\n')
@@ -94,8 +85,7 @@
         with test_utils.run_test_server(use_ssl=True) as httpd:
             conn_fut = asyncio.open_connection(
                 *httpd.address,
-                ssl=test_utils.dummy_ssl_context(),
-                loop=self.loop)
+                ssl=test_utils.dummy_ssl_context())
 
             self._basetest_open_connection_no_loop_ssl(conn_fut)
 
@@ -107,15 +97,14 @@
                 httpd.address,
                 ssl=test_utils.dummy_ssl_context(),
                 server_hostname='',
-                loop=self.loop)
+            )
 
             self._basetest_open_connection_no_loop_ssl(conn_fut)
 
     def _basetest_open_connection_error(self, open_connection_fut):
         messages = []
         self.loop.set_exception_handler(lambda loop, ctx: messages.append(ctx))
-        with self.assertWarns(DeprecationWarning):
-            reader, writer = self.loop.run_until_complete(open_connection_fut)
+        reader, writer = self.loop.run_until_complete(open_connection_fut)
         writer._protocol.connection_lost(ZeroDivisionError())
         f = reader.read()
         with self.assertRaises(ZeroDivisionError):
@@ -126,15 +115,13 @@
 
     def test_open_connection_error(self):
         with test_utils.run_test_server() as httpd:
-            conn_fut = asyncio.open_connection(*httpd.address,
-                                               loop=self.loop)
+            conn_fut = asyncio.open_connection(*httpd.address)
             self._basetest_open_connection_error(conn_fut)
 
     @socket_helper.skip_unless_bind_unix_socket
     def test_open_unix_connection_error(self):
         with test_utils.run_test_unix_server() as httpd:
-            conn_fut = asyncio.open_unix_connection(httpd.address,
-                                                    loop=self.loop)
+            conn_fut = asyncio.open_unix_connection(httpd.address)
             self._basetest_open_connection_error(conn_fut)
 
     def test_feed_empty_data(self):
@@ -598,8 +585,7 @@
                 sock = socket.create_server(('127.0.0.1', 0))
                 self.server = self.loop.run_until_complete(
                     asyncio.start_server(self.handle_client,
-                                         sock=sock,
-                                         loop=self.loop))
+                                         sock=sock))
                 return sock.getsockname()
 
             def handle_client_callback(self, client_reader, client_writer):
@@ -612,8 +598,7 @@
                 sock.close()
                 self.server = self.loop.run_until_complete(
                     asyncio.start_server(self.handle_client_callback,
-                                         host=addr[0], port=addr[1],
-                                         loop=self.loop))
+                                         host=addr[0], port=addr[1]))
                 return addr
 
             def stop(self):
@@ -623,9 +608,7 @@
                     self.server = None
 
         async def client(addr):
-            with self.assertWarns(DeprecationWarning):
-                reader, writer = await asyncio.open_connection(
-                    *addr, loop=self.loop)
+            reader, writer = await asyncio.open_connection(*addr)
             # send a line
             writer.write(b"hello world!\n")
             # read it back
@@ -639,16 +622,14 @@
 
         # test the server variant with a coroutine as client handler
         server = MyServer(self.loop)
-        with self.assertWarns(DeprecationWarning):
-            addr = server.start()
+        addr = server.start()
         msg = self.loop.run_until_complete(self.loop.create_task(client(addr)))
         server.stop()
         self.assertEqual(msg, b"hello world!\n")
 
         # test the server variant with a callback as client handler
         server = MyServer(self.loop)
-        with self.assertWarns(DeprecationWarning):
-            addr = server.start_callback()
+        addr = server.start_callback()
         msg = self.loop.run_until_complete(self.loop.create_task(client(addr)))
         server.stop()
         self.assertEqual(msg, b"hello world!\n")
@@ -675,8 +656,7 @@
             def start(self):
                 self.server = self.loop.run_until_complete(
                     asyncio.start_unix_server(self.handle_client,
-                                              path=self.path,
-                                              loop=self.loop))
+                                              path=self.path))
 
             def handle_client_callback(self, client_reader, client_writer):
                 self.loop.create_task(self.handle_client(client_reader,
@@ -684,8 +664,7 @@
 
             def start_callback(self):
                 start = asyncio.start_unix_server(self.handle_client_callback,
-                                                  path=self.path,
-                                                  loop=self.loop)
+                                                  path=self.path)
                 self.server = self.loop.run_until_complete(start)
 
             def stop(self):
@@ -695,9 +674,7 @@
                     self.server = None
 
         async def client(path):
-            with self.assertWarns(DeprecationWarning):
-                reader, writer = await asyncio.open_unix_connection(
-                    path, loop=self.loop)
+            reader, writer = await asyncio.open_unix_connection(path)
             # send a line
             writer.write(b"hello world!\n")
             # read it back
@@ -712,8 +689,7 @@
         # test the server variant with a coroutine as client handler
         with test_utils.unix_socket_path() as path:
             server = MyServer(self.loop, path)
-            with self.assertWarns(DeprecationWarning):
-                server.start()
+            server.start()
             msg = self.loop.run_until_complete(
                 self.loop.create_task(client(path)))
             server.stop()
@@ -722,8 +698,7 @@
         # test the server variant with a callback as client handler
         with test_utils.unix_socket_path() as path:
             server = MyServer(self.loop, path)
-            with self.assertWarns(DeprecationWarning):
-                server.start_callback()
+            server.start_callback()
             msg = self.loop.run_until_complete(
                 self.loop.create_task(client(path)))
             server.stop()
@@ -736,7 +711,7 @@
         # See asyncio issue 168.  This test is derived from the example
         # subprocess_attach_read_pipe.py, but we configure the
         # StreamReader's limit so that twice it is less than the size
-        # of the data writter.  Also we must explicitly attach a child
+        # of the data writer.  Also we must explicitly attach a child
         # watcher to the event loop.
 
         code = """\
@@ -771,23 +746,59 @@
         data = self.loop.run_until_complete(reader.read(-1))
         self.assertEqual(data, b'data')
 
-    def test_streamreader_constructor(self):
-        self.addCleanup(asyncio.set_event_loop, None)
-        asyncio.set_event_loop(self.loop)
+    def test_streamreader_constructor_without_loop(self):
+        with self.assertWarns(DeprecationWarning) as cm:
+            with self.assertRaisesRegex(RuntimeError, 'There is no current event loop'):
+                asyncio.StreamReader()
+        self.assertEqual(cm.warnings[0].filename, __file__)
 
+    def test_streamreader_constructor_use_running_loop(self):
         # asyncio issue #184: Ensure that StreamReaderProtocol constructor
         # retrieves the current loop if the loop parameter is not set
-        reader = asyncio.StreamReader()
+        async def test():
+            return asyncio.StreamReader()
+
+        reader = self.loop.run_until_complete(test())
         self.assertIs(reader._loop, self.loop)
 
-    def test_streamreaderprotocol_constructor(self):
+    def test_streamreader_constructor_use_global_loop(self):
+        # asyncio issue #184: Ensure that StreamReaderProtocol constructor
+        # retrieves the current loop if the loop parameter is not set
+        # Deprecated in 3.10
         self.addCleanup(asyncio.set_event_loop, None)
         asyncio.set_event_loop(self.loop)
+        with self.assertWarns(DeprecationWarning) as cm:
+            reader = asyncio.StreamReader()
+        self.assertEqual(cm.warnings[0].filename, __file__)
+        self.assertIs(reader._loop, self.loop)
 
+
+    def test_streamreaderprotocol_constructor_without_loop(self):
+        reader = mock.Mock()
+        with self.assertWarns(DeprecationWarning) as cm:
+            with self.assertRaisesRegex(RuntimeError, 'There is no current event loop'):
+                asyncio.StreamReaderProtocol(reader)
+        self.assertEqual(cm.warnings[0].filename, __file__)
+
+    def test_streamreaderprotocol_constructor_use_running_loop(self):
         # asyncio issue #184: Ensure that StreamReaderProtocol constructor
         # retrieves the current loop if the loop parameter is not set
         reader = mock.Mock()
-        protocol = asyncio.StreamReaderProtocol(reader)
+        async def test():
+            return asyncio.StreamReaderProtocol(reader)
+        protocol = self.loop.run_until_complete(test())
+        self.assertIs(protocol._loop, self.loop)
+
+    def test_streamreaderprotocol_constructor_use_global_loop(self):
+        # asyncio issue #184: Ensure that StreamReaderProtocol constructor
+        # retrieves the current loop if the loop parameter is not set
+        # Deprecated in 3.10
+        self.addCleanup(asyncio.set_event_loop, None)
+        asyncio.set_event_loop(self.loop)
+        reader = mock.Mock()
+        with self.assertWarns(DeprecationWarning) as cm:
+            protocol = asyncio.StreamReaderProtocol(reader)
+        self.assertEqual(cm.warnings[0].filename, __file__)
         self.assertIs(protocol._loop, self.loop)
 
     def test_drain_raises(self):
@@ -811,9 +822,7 @@
                 clt.close()
 
         async def client(host, port):
-            with self.assertWarns(DeprecationWarning):
-                reader, writer = await asyncio.open_connection(
-                    host, port, loop=self.loop)
+            reader, writer = await asyncio.open_connection(host, port)
 
             while True:
                 writer.write(b"foo\n")
@@ -821,7 +830,7 @@
 
         # Start the server thread and wait for it to be listening.
         thread = threading.Thread(target=server)
-        thread.setDaemon(True)
+        thread.daemon = True
         thread.start()
         addr = q.get()
 
@@ -897,9 +906,8 @@
 
     def test_wait_closed_on_close(self):
         with test_utils.run_test_server() as httpd:
-            with self.assertWarns(DeprecationWarning):
-                rd, wr = self.loop.run_until_complete(
-                    asyncio.open_connection(*httpd.address, loop=self.loop))
+            rd, wr = self.loop.run_until_complete(
+                asyncio.open_connection(*httpd.address))
 
             wr.write(b'GET / HTTP/1.0\r\n\r\n')
             f = rd.readline()
@@ -915,9 +923,8 @@
 
     def test_wait_closed_on_close_with_unread_data(self):
         with test_utils.run_test_server() as httpd:
-            with self.assertWarns(DeprecationWarning):
-                rd, wr = self.loop.run_until_complete(
-                    asyncio.open_connection(*httpd.address, loop=self.loop))
+            rd, wr = self.loop.run_until_complete(
+                asyncio.open_connection(*httpd.address))
 
             wr.write(b'GET / HTTP/1.0\r\n\r\n')
             f = rd.readline()
@@ -974,18 +981,16 @@
         self.loop.set_exception_handler(lambda loop, ctx: messages.append(ctx))
 
         with test_utils.run_test_server() as httpd:
-            with self.assertWarns(DeprecationWarning):
-                rd, wr = self.loop.run_until_complete(
-                    asyncio.open_connection(*httpd.address,
-                                            loop=self.loop))
+            rd, wr = self.loop.run_until_complete(
+                    asyncio.open_connection(*httpd.address))
 
             wr.close()
             f = wr.wait_closed()
             self.loop.run_until_complete(f)
-            assert rd.at_eof()
+            self.assertTrue(rd.at_eof())
             f = rd.read()
             data = self.loop.run_until_complete(f)
-            assert data == b''
+            self.assertEqual(data, b'')
 
         self.assertEqual(messages, [])
 
diff --git a/Lib/test/test_asyncio/test_subprocess.py b/Lib/test/test_asyncio/test_subprocess.py
index 6657a88..14fa6dd 100644
--- a/Lib/test/test_asyncio/test_subprocess.py
+++ b/Lib/test/test_asyncio/test_subprocess.py
@@ -10,6 +10,7 @@
 from asyncio import subprocess
 from test.test_asyncio import utils as test_utils
 from test import support
+from test.support import os_helper
 
 if sys.platform != 'win32':
     from asyncio import unix_events
@@ -227,7 +228,7 @@
         # buffer large enough to feed the whole pipe buffer
         large_data = b'x' * support.PIPE_MAX_SIZE
 
-        # the program ends before the stdin can be feeded
+        # the program ends before the stdin can be fed
         proc = self.loop.run_until_complete(
             asyncio.create_subprocess_exec(
                 sys.executable, '-c', 'pass',
@@ -626,34 +627,14 @@
     def test_create_subprocess_exec_with_path(self):
         async def execute():
             p = await subprocess.create_subprocess_exec(
-                support.FakePath(sys.executable), '-c', 'pass')
+                os_helper.FakePath(sys.executable), '-c', 'pass')
             await p.wait()
             p = await subprocess.create_subprocess_exec(
-                sys.executable, '-c', 'pass', support.FakePath('.'))
+                sys.executable, '-c', 'pass', os_helper.FakePath('.'))
             await p.wait()
 
         self.assertIsNone(self.loop.run_until_complete(execute()))
 
-    def test_exec_loop_deprecated(self):
-        async def go():
-            with self.assertWarns(DeprecationWarning):
-                proc = await asyncio.create_subprocess_exec(
-                    sys.executable, '-c', 'pass',
-                    loop=self.loop,
-                )
-            await proc.wait()
-        self.loop.run_until_complete(go())
-
-    def test_shell_loop_deprecated(self):
-        async def go():
-            with self.assertWarns(DeprecationWarning):
-                proc = await asyncio.create_subprocess_shell(
-                    "exit 0",
-                    loop=self.loop,
-                )
-            await proc.wait()
-        self.loop.run_until_complete(go())
-
 
 if sys.platform != 'win32':
     # Unix
@@ -684,6 +665,8 @@
 
         Watcher = unix_events.ThreadedChildWatcher
 
+    @unittest.skip("bpo-38323: MultiLoopChildWatcher has a race condition \
+                    and these tests can hang the test suite")
     class SubprocessMultiLoopWatcherTests(SubprocessWatcherMixin,
                                           test_utils.TestCase):
 
@@ -737,7 +720,7 @@
 
             with self.assertRaises(RuntimeError):
                 await subprocess.create_subprocess_exec(
-                    support.FakePath(sys.executable), '-c', 'pass')
+                    os_helper.FakePath(sys.executable), '-c', 'pass')
 
             watcher.add_child_handler.assert_not_called()
 
diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py
index 01f62b7..398b143 100644
--- a/Lib/test/test_asyncio/test_tasks.py
+++ b/Lib/test/test_asyncio/test_tasks.py
@@ -15,6 +15,7 @@
 import unittest
 import weakref
 from unittest import mock
+from types import GenericAlias
 
 import asyncio
 from asyncio import coroutines
@@ -120,6 +121,12 @@
         self.loop.set_task_factory(self.new_task)
         self.loop.create_future = lambda: self.new_future(self.loop)
 
+
+    def test_generic_alias(self):
+        task = self.__class__.Task[str]
+        self.assertEqual(task.__args__, (str,))
+        self.assertIsInstance(task, GenericAlias)
+
     def test_task_cancel_message_getter(self):
         async def coro():
             pass
@@ -155,7 +162,7 @@
         self.loop.run_until_complete(
             asyncio.gather(*[
                 self.new_task(self.loop, run()) for _ in range(100)
-            ], loop=self.loop))
+            ]))
 
     def test_other_loop_future(self):
         other_loop = asyncio.new_event_loop()
@@ -200,22 +207,76 @@
         loop.close()
 
     def test_ensure_future_coroutine(self):
+        async def notmuch():
+            return 'ok'
+        t = asyncio.ensure_future(notmuch(), loop=self.loop)
+        self.assertIs(t._loop, self.loop)
+        self.loop.run_until_complete(t)
+        self.assertTrue(t.done())
+        self.assertEqual(t.result(), 'ok')
+
+        a = notmuch()
+        self.addCleanup(a.close)
+        with self.assertWarns(DeprecationWarning) as cm:
+            with self.assertRaisesRegex(RuntimeError, 'There is no current event loop'):
+                asyncio.ensure_future(a)
+        self.assertEqual(cm.warnings[0].filename, __file__)
+
+        async def test():
+            return asyncio.ensure_future(notmuch())
+        t = self.loop.run_until_complete(test())
+        self.assertIs(t._loop, self.loop)
+        self.loop.run_until_complete(t)
+        self.assertTrue(t.done())
+        self.assertEqual(t.result(), 'ok')
+
+        # Deprecated in 3.10
+        asyncio.set_event_loop(self.loop)
+        self.addCleanup(asyncio.set_event_loop, None)
+        with self.assertWarns(DeprecationWarning) as cm:
+            t = asyncio.ensure_future(notmuch())
+        self.assertEqual(cm.warnings[0].filename, __file__)
+        self.assertIs(t._loop, self.loop)
+        self.loop.run_until_complete(t)
+        self.assertTrue(t.done())
+        self.assertEqual(t.result(), 'ok')
+
+    def test_ensure_future_coroutine_2(self):
         with self.assertWarns(DeprecationWarning):
             @asyncio.coroutine
             def notmuch():
                 return 'ok'
         t = asyncio.ensure_future(notmuch(), loop=self.loop)
+        self.assertIs(t._loop, self.loop)
         self.loop.run_until_complete(t)
         self.assertTrue(t.done())
         self.assertEqual(t.result(), 'ok')
-        self.assertIs(t._loop, self.loop)
 
-        loop = asyncio.new_event_loop()
-        self.set_event_loop(loop)
-        t = asyncio.ensure_future(notmuch(), loop=loop)
-        self.assertIs(t._loop, loop)
-        loop.run_until_complete(t)
-        loop.close()
+        a = notmuch()
+        self.addCleanup(a.close)
+        with self.assertWarns(DeprecationWarning) as cm:
+            with self.assertRaisesRegex(RuntimeError, 'There is no current event loop'):
+                asyncio.ensure_future(a)
+        self.assertEqual(cm.warnings[0].filename, __file__)
+
+        async def test():
+            return asyncio.ensure_future(notmuch())
+        t = self.loop.run_until_complete(test())
+        self.assertIs(t._loop, self.loop)
+        self.loop.run_until_complete(t)
+        self.assertTrue(t.done())
+        self.assertEqual(t.result(), 'ok')
+
+        # Deprecated in 3.10
+        asyncio.set_event_loop(self.loop)
+        self.addCleanup(asyncio.set_event_loop, None)
+        with self.assertWarns(DeprecationWarning) as cm:
+            t = asyncio.ensure_future(notmuch())
+        self.assertEqual(cm.warnings[0].filename, __file__)
+        self.assertIs(t._loop, self.loop)
+        self.loop.run_until_complete(t)
+        self.assertTrue(t.done())
+        self.assertEqual(t.result(), 'ok')
 
     def test_ensure_future_future(self):
         f_orig = self.new_future(self.loop)
@@ -275,7 +336,7 @@
         self.set_event_loop(loop)
         fut = asyncio.ensure_future(Aw(coro()), loop=loop)
         loop.run_until_complete(fut)
-        assert fut.result() == 'ok'
+        self.assertEqual(fut.result(), 'ok')
 
     def test_ensure_future_neither(self):
         with self.assertRaises(TypeError):
@@ -1078,33 +1139,6 @@
         res = loop.run_until_complete(asyncio.wait_for(coro(), timeout=None))
         self.assertEqual(res, 'done')
 
-    def test_wait_for_with_global_loop(self):
-
-        def gen():
-            when = yield
-            self.assertAlmostEqual(0.2, when)
-            when = yield 0
-            self.assertAlmostEqual(0.01, when)
-            yield 0.01
-
-        loop = self.new_test_loop(gen)
-
-        async def foo():
-            await asyncio.sleep(0.2)
-            return 'done'
-
-        asyncio.set_event_loop(loop)
-        try:
-            fut = self.new_task(loop, foo())
-            with self.assertRaises(asyncio.TimeoutError):
-                loop.run_until_complete(asyncio.wait_for(fut, 0.01))
-        finally:
-            asyncio.set_event_loop(None)
-
-        self.assertAlmostEqual(0.01, loop.time())
-        self.assertTrue(fut.done())
-        self.assertTrue(fut.cancelled())
-
     def test_wait_for_race_condition(self):
 
         def gen():
@@ -1121,20 +1155,16 @@
         self.assertEqual(res, "ok")
 
     def test_wait_for_cancellation_race_condition(self):
-        def gen():
-            yield 0.1
-            yield 0.1
-            yield 0.1
-            yield 0.1
+        async def inner():
+            with contextlib.suppress(asyncio.CancelledError):
+                await asyncio.sleep(1)
+            return 1
 
-        loop = self.new_test_loop(gen)
+        async def main():
+            result = await asyncio.wait_for(inner(), timeout=.01)
+            self.assertEqual(result, 1)
 
-        fut = self.new_future(loop)
-        loop.call_later(0.1, fut.set_result, "ok")
-        task = loop.create_task(asyncio.wait_for(fut, timeout=1))
-        loop.call_later(0.1, task.cancel)
-        res = loop.run_until_complete(task)
-        self.assertEqual(res, "ok")
+        asyncio.run(main())
 
     def test_wait_for_waits_for_task_cancellation(self):
         loop = asyncio.new_event_loop()
@@ -1213,24 +1243,6 @@
         with self.assertRaises(FooException):
             loop.run_until_complete(foo())
 
-    def test_wait_for_raises_timeout_error_if_returned_during_cancellation(self):
-        loop = asyncio.new_event_loop()
-        self.addCleanup(loop.close)
-
-        async def foo():
-            async def inner():
-                try:
-                    await asyncio.sleep(0.2)
-                except asyncio.CancelledError:
-                    return 42
-
-            inner_task = self.new_task(loop, inner())
-
-            await asyncio.wait_for(inner_task, timeout=_EPSILON)
-
-        with self.assertRaises(asyncio.TimeoutError):
-            loop.run_until_complete(foo())
-
     def test_wait_for_self_cancellation(self):
         loop = asyncio.new_event_loop()
         self.addCleanup(loop.close)
@@ -1293,32 +1305,6 @@
         self.assertAlmostEqual(0.15, loop.time())
         self.assertEqual(res, 42)
 
-    def test_wait_with_global_loop(self):
-
-        def gen():
-            when = yield
-            self.assertAlmostEqual(0.01, when)
-            when = yield 0
-            self.assertAlmostEqual(0.015, when)
-            yield 0.015
-
-        loop = self.new_test_loop(gen)
-
-        a = self.new_task(loop, asyncio.sleep(0.01))
-        b = self.new_task(loop, asyncio.sleep(0.015))
-
-        async def foo():
-            done, pending = await asyncio.wait([b, a])
-            self.assertEqual(done, set([a, b]))
-            self.assertEqual(pending, set())
-            return 42
-
-        asyncio.set_event_loop(loop)
-        res = loop.run_until_complete(
-            self.new_task(loop, foo()))
-
-        self.assertEqual(res, 42)
-
     def test_wait_duplicate_coroutines(self):
 
         with self.assertWarns(DeprecationWarning):
@@ -1603,19 +1589,18 @@
 
         async def foo():
             values = []
-            for f in asyncio.as_completed([b, c, a], loop=loop):
+            for f in asyncio.as_completed([b, c, a]):
                 values.append(await f)
             return values
-        with self.assertWarns(DeprecationWarning):
-            res = loop.run_until_complete(self.new_task(loop, foo()))
+
+        res = loop.run_until_complete(self.new_task(loop, foo()))
         self.assertAlmostEqual(0.15, loop.time())
         self.assertTrue('a' in res[:2])
         self.assertTrue('b' in res[:2])
         self.assertEqual(res[2], 'c')
 
         # Doing it again should take no time and exercise a different path.
-        with self.assertWarns(DeprecationWarning):
-            res = loop.run_until_complete(self.new_task(loop, foo()))
+        res = loop.run_until_complete(self.new_task(loop, foo()))
         self.assertAlmostEqual(0.15, loop.time())
 
     def test_as_completed_with_timeout(self):
@@ -1633,7 +1618,7 @@
 
         async def foo():
             values = []
-            for f in asyncio.as_completed([a, b], timeout=0.12, loop=loop):
+            for f in asyncio.as_completed([a, b], timeout=0.12):
                 if values:
                     loop.advance_time(0.02)
                 try:
@@ -1643,8 +1628,7 @@
                     values.append((2, exc))
             return values
 
-        with self.assertWarns(DeprecationWarning):
-            res = loop.run_until_complete(self.new_task(loop, foo()))
+        res = loop.run_until_complete(self.new_task(loop, foo()))
         self.assertEqual(len(res), 2, res)
         self.assertEqual(res[0], (1, 'a'))
         self.assertEqual(res[1][0], 2)
@@ -1667,12 +1651,11 @@
         a = asyncio.sleep(0.01, 'a')
 
         async def foo():
-            for f in asyncio.as_completed([a], timeout=1, loop=loop):
+            for f in asyncio.as_completed([a], timeout=1):
                 v = await f
                 self.assertEqual(v, 'a')
 
-        with self.assertWarns(DeprecationWarning):
-            loop.run_until_complete(self.new_task(loop, foo()))
+        loop.run_until_complete(self.new_task(loop, foo()))
 
     def test_as_completed_reverse_wait(self):
 
@@ -1687,17 +1670,19 @@
         b = asyncio.sleep(0.10, 'b')
         fs = {a, b}
 
-        with self.assertWarns(DeprecationWarning):
-            futs = list(asyncio.as_completed(fs, loop=loop))
-        self.assertEqual(len(futs), 2)
+        async def test():
+            futs = list(asyncio.as_completed(fs))
+            self.assertEqual(len(futs), 2)
 
-        x = loop.run_until_complete(futs[1])
-        self.assertEqual(x, 'a')
-        self.assertAlmostEqual(0.05, loop.time())
-        loop.advance_time(0.05)
-        y = loop.run_until_complete(futs[0])
-        self.assertEqual(y, 'b')
-        self.assertAlmostEqual(0.10, loop.time())
+            x = await futs[1]
+            self.assertEqual(x, 'a')
+            self.assertAlmostEqual(0.05, loop.time())
+            loop.advance_time(0.05)
+            y = await futs[0]
+            self.assertEqual(y, 'b')
+            self.assertAlmostEqual(0.10, loop.time())
+
+        loop.run_until_complete(test())
 
     def test_as_completed_concurrent(self):
 
@@ -1708,19 +1693,22 @@
             self.assertAlmostEqual(0.05, when)
             yield 0.05
 
-        loop = self.new_test_loop(gen)
-
         a = asyncio.sleep(0.05, 'a')
         b = asyncio.sleep(0.05, 'b')
         fs = {a, b}
-        with self.assertWarns(DeprecationWarning):
-            futs = list(asyncio.as_completed(fs, loop=loop))
-        self.assertEqual(len(futs), 2)
-        waiter = asyncio.wait(futs)
-        # Deprecation from passing coros in futs to asyncio.wait()
-        with self.assertWarns(DeprecationWarning):
-            done, pending = loop.run_until_complete(waiter)
-        self.assertEqual(set(f.result() for f in done), {'a', 'b'})
+
+        async def test():
+            futs = list(asyncio.as_completed(fs))
+            self.assertEqual(len(futs), 2)
+            waiter = asyncio.wait(futs)
+            # Deprecation from passing coros in futs to asyncio.wait()
+            with self.assertWarns(DeprecationWarning) as cm:
+                done, pending = await waiter
+            self.assertEqual(cm.warnings[0].filename, __file__)
+            self.assertEqual(set(f.result() for f in done), {'a', 'b'})
+
+        loop = self.new_test_loop(gen)
+        loop.run_until_complete(test())
 
     def test_as_completed_duplicate_coroutines(self):
 
@@ -1734,18 +1722,57 @@
             def runner():
                 result = []
                 c = coro('ham')
-                for f in asyncio.as_completed([c, c, coro('spam')],
-                                              loop=self.loop):
+                for f in asyncio.as_completed([c, c, coro('spam')]):
                     result.append((yield from f))
                 return result
 
-        with self.assertWarns(DeprecationWarning):
-            fut = self.new_task(self.loop, runner())
-            self.loop.run_until_complete(fut)
+        fut = self.new_task(self.loop, runner())
+        self.loop.run_until_complete(fut)
         result = fut.result()
         self.assertEqual(set(result), {'ham', 'spam'})
         self.assertEqual(len(result), 2)
 
+    def test_as_completed_coroutine_without_loop(self):
+        async def coro():
+            return 42
+
+        a = coro()
+        self.addCleanup(a.close)
+
+        futs = asyncio.as_completed([a])
+        with self.assertWarns(DeprecationWarning) as cm:
+            with self.assertRaisesRegex(RuntimeError, 'There is no current event loop'):
+                list(futs)
+        self.assertEqual(cm.warnings[0].filename, __file__)
+
+    def test_as_completed_coroutine_use_running_loop(self):
+        loop = self.new_test_loop()
+
+        async def coro():
+            return 42
+
+        async def test():
+            futs = list(asyncio.as_completed([coro()]))
+            self.assertEqual(len(futs), 1)
+            self.assertEqual(await futs[0], 42)
+
+        loop.run_until_complete(test())
+
+    def test_as_completed_coroutine_use_global_loop(self):
+        # Deprecated in 3.10
+        async def coro():
+            return 42
+
+        loop = self.new_test_loop()
+        asyncio.set_event_loop(loop)
+        self.addCleanup(asyncio.set_event_loop, None)
+        futs = asyncio.as_completed([coro()])
+        with self.assertWarns(DeprecationWarning) as cm:
+            futs = list(futs)
+        self.assertEqual(cm.warnings[0].filename, __file__)
+        self.assertEqual(len(futs), 1)
+        self.assertEqual(loop.run_until_complete(futs[0]), 42)
+
     def test_sleep(self):
 
         def gen():
@@ -2018,7 +2045,7 @@
         self.assertIsNone(asyncio.current_task(loop=self.loop))
 
         async def coro(loop):
-            self.assertIs(asyncio.current_task(loop=loop), task)
+            self.assertIs(asyncio.current_task(), task)
 
             self.assertIs(asyncio.current_task(None), task)
             self.assertIs(asyncio.current_task(), task)
@@ -2034,16 +2061,16 @@
         fut2 = self.new_future(self.loop)
 
         async def coro1(loop):
-            self.assertTrue(asyncio.current_task(loop=loop) is task1)
+            self.assertTrue(asyncio.current_task() is task1)
             await fut1
-            self.assertTrue(asyncio.current_task(loop=loop) is task1)
+            self.assertTrue(asyncio.current_task() is task1)
             fut2.set_result(True)
 
         async def coro2(loop):
-            self.assertTrue(asyncio.current_task(loop=loop) is task2)
+            self.assertTrue(asyncio.current_task() is task2)
             fut1.set_result(True)
             await fut2
-            self.assertTrue(asyncio.current_task(loop=loop) is task2)
+            self.assertTrue(asyncio.current_task() is task2)
 
         task1 = self.new_task(self.loop, coro1(self.loop))
         task2 = self.new_task(self.loop, coro2(self.loop))
@@ -2205,15 +2232,51 @@
         child2.set_result(2)
         test_utils.run_briefly(self.loop)
 
+    def test_shield_coroutine_without_loop(self):
+        async def coro():
+            return 42
+
+        inner = coro()
+        self.addCleanup(inner.close)
+        with self.assertWarns(DeprecationWarning) as cm:
+            with self.assertRaisesRegex(RuntimeError, 'There is no current event loop'):
+                asyncio.shield(inner)
+        self.assertEqual(cm.warnings[0].filename, __file__)
+
+    def test_shield_coroutine_use_running_loop(self):
+        async def coro():
+            return 42
+
+        async def test():
+            return asyncio.shield(coro())
+        outer = self.loop.run_until_complete(test())
+        self.assertEqual(outer._loop, self.loop)
+        res = self.loop.run_until_complete(outer)
+        self.assertEqual(res, 42)
+
+    def test_shield_coroutine_use_global_loop(self):
+        # Deprecated in 3.10
+        async def coro():
+            return 42
+
+        asyncio.set_event_loop(self.loop)
+        self.addCleanup(asyncio.set_event_loop, None)
+        with self.assertWarns(DeprecationWarning) as cm:
+            outer = asyncio.shield(coro())
+        self.assertEqual(cm.warnings[0].filename, __file__)
+        self.assertEqual(outer._loop, self.loop)
+        res = self.loop.run_until_complete(outer)
+        self.assertEqual(res, 42)
+
     def test_as_completed_invalid_args(self):
         fut = self.new_future(self.loop)
 
         # as_completed() expects a list of futures, not a future instance
         self.assertRaises(TypeError, self.loop.run_until_complete,
-            asyncio.as_completed(fut, loop=self.loop))
+            asyncio.as_completed(fut))
         coro = coroutine_function()
         self.assertRaises(TypeError, self.loop.run_until_complete,
-            asyncio.as_completed(coro, loop=self.loop))
+            asyncio.as_completed(coro))
         coro.close()
 
     def test_wait_invalid_args(self):
@@ -2514,12 +2577,14 @@
         self.addCleanup(loop.close)
 
         fut = self.new_future(loop)
-        # The indirection fut->child_coro is needed since otherwise the
-        # gathering task is done at the same time as the child future
-        def child_coro():
-            return (yield from fut)
-        gather_future = asyncio.gather(child_coro(), loop=loop)
-        gather_task = asyncio.ensure_future(gather_future, loop=loop)
+        async def create():
+            # The indirection fut->child_coro is needed since otherwise the
+            # gathering task is done at the same time as the child future
+            def child_coro():
+                return (yield from fut)
+            gather_future = asyncio.gather(child_coro())
+            return asyncio.ensure_future(gather_future)
+        gather_task = loop.run_until_complete(create())
 
         cancel_result = None
         def cancelling_callback(_):
@@ -2555,8 +2620,7 @@
                     while True:
                         time += 0.05
                         await asyncio.gather(asyncio.sleep(0.05),
-                                             return_exceptions=True,
-                                             loop=loop)
+                                             return_exceptions=True)
                         if time > 1:
                             return
 
@@ -2611,6 +2675,7 @@
                 self.new_task(self.loop, gen)
             finally:
                 gen.close()
+        gc.collect()  # For PyPy or other GCs.
 
         self.assertTrue(m_log.error.called)
         message = m_log.error.call_args[0][0]
@@ -2771,7 +2836,7 @@
                 task = loop.create_task(sub(random.randint(0, 10)))
                 tasks.append(task)
 
-            await asyncio.gather(*tasks, loop=loop)
+            await asyncio.gather(*tasks)
 
         loop = asyncio.new_event_loop()
         try:
@@ -3196,15 +3261,18 @@
     def test_future_subclass(self):
         self.assertTrue(issubclass(asyncio.Task, asyncio.Future))
 
+    @support.cpython_only
     def test_asyncio_module_compiled(self):
         # Because of circular imports it's easy to make _asyncio
         # module non-importable.  This is a simple test that will
         # fail on systems where C modules were successfully compiled
-        # (hence the test for _functools), but _asyncio somehow didn't.
+        # (hence the test for _functools etc), but _asyncio somehow didn't.
         try:
             import _functools
+            import _json
+            import _pickle
         except ImportError:
-            pass
+            self.skipTest('C modules are not available')
         else:
             try:
                 import _asyncio
@@ -3226,7 +3294,7 @@
 
     def _check_success(self, **kwargs):
         a, b, c = [self.one_loop.create_future() for i in range(3)]
-        fut = asyncio.gather(*self.wrap_futures(a, b, c), **kwargs)
+        fut = self._gather(*self.wrap_futures(a, b, c), **kwargs)
         cb = test_utils.MockCallback()
         fut.add_done_callback(cb)
         b.set_result(1)
@@ -3248,7 +3316,7 @@
 
     def test_one_exception(self):
         a, b, c, d, e = [self.one_loop.create_future() for i in range(5)]
-        fut = asyncio.gather(*self.wrap_futures(a, b, c, d, e))
+        fut = self._gather(*self.wrap_futures(a, b, c, d, e))
         cb = test_utils.MockCallback()
         fut.add_done_callback(cb)
         exc = ZeroDivisionError()
@@ -3266,8 +3334,8 @@
 
     def test_return_exceptions(self):
         a, b, c, d = [self.one_loop.create_future() for i in range(4)]
-        fut = asyncio.gather(*self.wrap_futures(a, b, c, d),
-                             return_exceptions=True)
+        fut = self._gather(*self.wrap_futures(a, b, c, d),
+                           return_exceptions=True)
         cb = test_utils.MockCallback()
         fut.add_done_callback(cb)
         exc = ZeroDivisionError()
@@ -3319,32 +3387,43 @@
     def wrap_futures(self, *futures):
         return futures
 
-    def _check_empty_sequence(self, seq_or_iter):
-        asyncio.set_event_loop(self.one_loop)
-        self.addCleanup(asyncio.set_event_loop, None)
-        fut = asyncio.gather(*seq_or_iter)
+    def _gather(self, *args, **kwargs):
+        return asyncio.gather(*args, **kwargs)
+
+    def test_constructor_empty_sequence_without_loop(self):
+        with self.assertWarns(DeprecationWarning) as cm:
+            with self.assertRaises(RuntimeError):
+                asyncio.gather()
+        self.assertEqual(cm.warnings[0].filename, __file__)
+
+    def test_constructor_empty_sequence_use_running_loop(self):
+        async def gather():
+            return asyncio.gather()
+        fut = self.one_loop.run_until_complete(gather())
         self.assertIsInstance(fut, asyncio.Future)
         self.assertIs(fut._loop, self.one_loop)
         self._run_loop(self.one_loop)
         self.assertTrue(fut.done())
         self.assertEqual(fut.result(), [])
-        with self.assertWarns(DeprecationWarning):
-            fut = asyncio.gather(*seq_or_iter, loop=self.other_loop)
-        self.assertIs(fut._loop, self.other_loop)
 
-    def test_constructor_empty_sequence(self):
-        self._check_empty_sequence([])
-        self._check_empty_sequence(())
-        self._check_empty_sequence(set())
-        self._check_empty_sequence(iter(""))
+    def test_constructor_empty_sequence_use_global_loop(self):
+        # Deprecated in 3.10
+        asyncio.set_event_loop(self.one_loop)
+        self.addCleanup(asyncio.set_event_loop, None)
+        with self.assertWarns(DeprecationWarning) as cm:
+            fut = asyncio.gather()
+        self.assertEqual(cm.warnings[0].filename, __file__)
+        self.assertIsInstance(fut, asyncio.Future)
+        self.assertIs(fut._loop, self.one_loop)
+        self._run_loop(self.one_loop)
+        self.assertTrue(fut.done())
+        self.assertEqual(fut.result(), [])
 
     def test_constructor_heterogenous_futures(self):
         fut1 = self.one_loop.create_future()
         fut2 = self.other_loop.create_future()
         with self.assertRaises(ValueError):
             asyncio.gather(fut1, fut2)
-        with self.assertRaises(ValueError):
-            asyncio.gather(fut1, loop=self.other_loop)
 
     def test_constructor_homogenous_futures(self):
         children = [self.other_loop.create_future() for i in range(3)]
@@ -3352,7 +3431,7 @@
         self.assertIs(fut._loop, self.other_loop)
         self._run_loop(self.other_loop)
         self.assertFalse(fut.done())
-        fut = asyncio.gather(*children, loop=self.other_loop)
+        fut = asyncio.gather(*children)
         self.assertIs(fut._loop, self.other_loop)
         self._run_loop(self.other_loop)
         self.assertFalse(fut.done())
@@ -3401,10 +3480,6 @@
 
 class CoroutineGatherTests(GatherTestsBase, test_utils.TestCase):
 
-    def setUp(self):
-        super().setUp()
-        asyncio.set_event_loop(self.one_loop)
-
     def wrap_futures(self, *futures):
         coros = []
         for fut in futures:
@@ -3413,21 +3488,47 @@
             coros.append(coro())
         return coros
 
-    def test_constructor_loop_selection(self):
+    def _gather(self, *args, **kwargs):
+        async def coro():
+            return asyncio.gather(*args, **kwargs)
+        return self.one_loop.run_until_complete(coro())
+
+    def test_constructor_without_loop(self):
+        async def coro():
+            return 'abc'
+        gen1 = coro()
+        self.addCleanup(gen1.close)
+        gen2 = coro()
+        self.addCleanup(gen2.close)
+        with self.assertWarns(DeprecationWarning) as cm:
+            with self.assertRaises(RuntimeError):
+                asyncio.gather(gen1, gen2)
+        self.assertEqual(cm.warnings[0].filename, __file__)
+
+    def test_constructor_use_running_loop(self):
         async def coro():
             return 'abc'
         gen1 = coro()
         gen2 = coro()
-        fut = asyncio.gather(gen1, gen2)
+        async def gather():
+            return asyncio.gather(gen1, gen2)
+        fut = self.one_loop.run_until_complete(gather())
         self.assertIs(fut._loop, self.one_loop)
         self.one_loop.run_until_complete(fut)
 
-        self.set_event_loop(self.other_loop, cleanup=False)
-        gen3 = coro()
-        gen4 = coro()
-        fut2 = asyncio.gather(gen3, gen4, loop=self.other_loop)
-        self.assertIs(fut2._loop, self.other_loop)
-        self.other_loop.run_until_complete(fut2)
+    def test_constructor_use_global_loop(self):
+        # Deprecated in 3.10
+        async def coro():
+            return 'abc'
+        asyncio.set_event_loop(self.other_loop)
+        self.addCleanup(asyncio.set_event_loop, None)
+        gen1 = coro()
+        gen2 = coro()
+        with self.assertWarns(DeprecationWarning) as cm:
+            fut = asyncio.gather(gen1, gen2)
+        self.assertEqual(cm.warnings[0].filename, __file__)
+        self.assertIs(fut._loop, self.other_loop)
+        self.other_loop.run_until_complete(fut)
 
     def test_duplicate_coroutines(self):
         with self.assertWarns(DeprecationWarning):
@@ -3435,7 +3536,7 @@
             def coro(s):
                 return s
         c = coro('abc')
-        fut = asyncio.gather(c, c, coro('def'), c, loop=self.one_loop)
+        fut = self._gather(c, c, coro('def'), c)
         self._run_loop(self.one_loop)
         self.assertEqual(fut.result(), ['abc', 'abc', 'def', 'abc'])
 
@@ -3455,7 +3556,7 @@
 
         async def outer():
             nonlocal proof, gatherer
-            gatherer = asyncio.gather(child1, child2, loop=self.one_loop)
+            gatherer = asyncio.gather(child1, child2)
             await gatherer
             proof += 100
 
@@ -3482,7 +3583,7 @@
         b = self.one_loop.create_future()
 
         async def outer():
-            await asyncio.gather(inner(a), inner(b), loop=self.one_loop)
+            await asyncio.gather(inner(a), inner(b))
 
         f = asyncio.ensure_future(outer(), loop=self.one_loop)
         test_utils.run_briefly(self.one_loop)
@@ -3492,6 +3593,20 @@
         test_utils.run_briefly(self.one_loop)
         self.assertIsInstance(f.exception(), RuntimeError)
 
+    def test_issue46672(self):
+        with mock.patch(
+            'asyncio.base_events.BaseEventLoop.call_exception_handler',
+        ):
+            async def coro(s):
+                return s
+            c = coro('abc')
+
+            with self.assertRaises(TypeError):
+                self._gather(c, {})
+            self._run_loop(self.one_loop)
+            # NameError should not happen:
+            self.one_loop.call_exception_handler.assert_not_called()
+
 
 class RunCoroutineThreadsafeTests(test_utils.TestCase):
     """Test case for asyncio.run_coroutine_threadsafe."""
@@ -3557,7 +3672,7 @@
             self.assertTrue(task.done())
 
     def test_run_coroutine_threadsafe_task_cancelled(self):
-        """Test coroutine submission from a tread to an event loop
+        """Test coroutine submission from a thread to an event loop
         when the task is cancelled."""
         callback = lambda: self.target(cancel=True)
         future = self.loop.run_in_executor(None, callback)
@@ -3565,7 +3680,7 @@
             self.loop.run_until_complete(future)
 
     def test_run_coroutine_threadsafe_task_factory_exception(self):
-        """Test coroutine submission from a tread to an event loop
+        """Test coroutine submission from a thread to an event loop
         when the task factory raise an exception."""
 
         def task_factory(loop, coro):
@@ -3621,11 +3736,6 @@
         self.loop.run_until_complete(coro())
         self.assertEqual(result, 11)
 
-    def test_loop_argument_is_deprecated(self):
-        # Remove test when loop argument is removed in Python 3.10
-        with self.assertWarns(DeprecationWarning):
-            self.loop.run_until_complete(asyncio.sleep(0.01, loop=self.loop))
-
 
 class WaitTests(test_utils.TestCase):
     def setUp(self):
@@ -3638,18 +3748,6 @@
         self.loop = None
         super().tearDown()
 
-    def test_loop_argument_is_deprecated_in_wait(self):
-        # Remove test when loop argument is removed in Python 3.10
-        with self.assertWarns(DeprecationWarning):
-            self.loop.run_until_complete(
-                asyncio.wait([coroutine_function()], loop=self.loop))
-
-    def test_loop_argument_is_deprecated_in_wait_for(self):
-        # Remove test when loop argument is removed in Python 3.10
-        with self.assertWarns(DeprecationWarning):
-            self.loop.run_until_complete(
-                asyncio.wait_for(coroutine_function(), 0.01, loop=self.loop))
-
     def test_coro_is_deprecated_in_wait(self):
         # Remove test when passing coros to asyncio.wait() is removed in 3.11
         with self.assertWarns(DeprecationWarning):
@@ -3701,7 +3799,7 @@
                 return 'ok2'
 
         async def inner():
-            return await asyncio.gather(coro1(), coro2(), loop=self.loop)
+            return await asyncio.gather(coro1(), coro2())
 
         result = self.loop.run_until_complete(inner())
         self.assertEqual(['ok1', 'ok2'], result)
diff --git a/Lib/test/test_asyncio/test_transports.py b/Lib/test/test_asyncio/test_transports.py
index df44855..bbdb218 100644
--- a/Lib/test/test_asyncio/test_transports.py
+++ b/Lib/test/test_asyncio/test_transports.py
@@ -7,6 +7,12 @@
 from asyncio import transports
 
 
+def tearDownModule():
+    # not needed for the test file but added for uniformness with all other
+    # asyncio test files for the sake of unified cleanup
+    asyncio.set_event_loop_policy(None)
+
+
 class TransportTests(unittest.TestCase):
 
     def test_ctor_extra_is_none(self):
diff --git a/Lib/test/test_asyncio/test_unix_events.py b/Lib/test/test_asyncio/test_unix_events.py
index 10bd46d..2f68459 100644
--- a/Lib/test/test_asyncio/test_unix_events.py
+++ b/Lib/test/test_asyncio/test_unix_events.py
@@ -1,6 +1,5 @@
 """Tests for unix_events.py."""
 
-import collections
 import contextlib
 import errno
 import io
@@ -14,7 +13,7 @@
 import threading
 import unittest
 from unittest import mock
-from test import support
+from test.support import os_helper
 from test.support import socket_helper
 
 if sys.platform == 'win32':
@@ -27,11 +26,21 @@
 from test.test_asyncio import utils as test_utils
 
 
+def tearDownModule():
+    asyncio.set_event_loop_policy(None)
+
+
 MOCK_ANY = mock.ANY
 
 
-def tearDownModule():
-    asyncio.set_event_loop_policy(None)
+def EXITCODE(exitcode):
+    return 32768 + exitcode
+
+
+def SIGNAL(signum):
+    if not 1 <= signum <= 68:
+        raise AssertionError(f'invalid signum {signum}')
+    return 32768 - signum
 
 
 def close_pipe_transport(transport):
@@ -467,19 +476,19 @@
 
     @classmethod
     def setUpClass(cls):
-        with open(support.TESTFN, 'wb') as fp:
+        with open(os_helper.TESTFN, 'wb') as fp:
             fp.write(cls.DATA)
         super().setUpClass()
 
     @classmethod
     def tearDownClass(cls):
-        support.unlink(support.TESTFN)
+        os_helper.unlink(os_helper.TESTFN)
         super().tearDownClass()
 
     def setUp(self):
         self.loop = asyncio.new_event_loop()
         self.set_event_loop(self.loop)
-        self.file = open(support.TESTFN, 'rb')
+        self.file = open(os_helper.TESTFN, 'rb')
         self.addCleanup(self.file.close)
         super().setUp()
 
@@ -1125,15 +1134,6 @@
             NotImplementedError, watcher._do_waitpid, f)
 
 
-WaitPidMocks = collections.namedtuple("WaitPidMocks",
-                                      ("waitpid",
-                                       "WIFEXITED",
-                                       "WIFSIGNALED",
-                                       "WEXITSTATUS",
-                                       "WTERMSIG",
-                                       ))
-
-
 class ChildWatcherTestsMixin:
 
     ignore_warnings = mock.patch.object(log.logger, "warning")
@@ -1164,22 +1164,16 @@
         else:
             raise ChildProcessError()
 
-    def add_zombie(self, pid, returncode):
-        self.zombies[pid] = returncode + 32768
+    def add_zombie(self, pid, status):
+        self.zombies[pid] = status
 
-    def WIFEXITED(self, status):
-        return status >= 32768
-
-    def WIFSIGNALED(self, status):
-        return 32700 < status < 32768
-
-    def WEXITSTATUS(self, status):
-        self.assertTrue(self.WIFEXITED(status))
-        return status - 32768
-
-    def WTERMSIG(self, status):
-        self.assertTrue(self.WIFSIGNALED(status))
-        return 32768 - status
+    def waitstatus_to_exitcode(self, status):
+        if status > 32768:
+            return status - 32768
+        elif 32700 < status < 32768:
+            return status - 32768
+        else:
+            return status
 
     def test_create_watcher(self):
         self.m_add_signal_handler.assert_called_once_with(
@@ -1191,19 +1185,13 @@
                 return mock.patch(target, wraps=wrapper,
                                   new_callable=mock.Mock)
 
-            with patch('os.WTERMSIG', self.WTERMSIG) as m_WTERMSIG, \
-                 patch('os.WEXITSTATUS', self.WEXITSTATUS) as m_WEXITSTATUS, \
-                 patch('os.WIFSIGNALED', self.WIFSIGNALED) as m_WIFSIGNALED, \
-                 patch('os.WIFEXITED', self.WIFEXITED) as m_WIFEXITED, \
+            with patch('asyncio.unix_events.waitstatus_to_exitcode', self.waitstatus_to_exitcode), \
                  patch('os.waitpid', self.waitpid) as m_waitpid:
-                func(self, WaitPidMocks(m_waitpid,
-                                        m_WIFEXITED, m_WIFSIGNALED,
-                                        m_WEXITSTATUS, m_WTERMSIG,
-                                        ))
+                func(self, m_waitpid)
         return wrapped_func
 
     @waitpid_mocks
-    def test_sigchld(self, m):
+    def test_sigchld(self, m_waitpid):
         # register a child
         callback = mock.Mock()
 
@@ -1212,59 +1200,36 @@
             self.watcher.add_child_handler(42, callback, 9, 10, 14)
 
         self.assertFalse(callback.called)
-        self.assertFalse(m.WIFEXITED.called)
-        self.assertFalse(m.WIFSIGNALED.called)
-        self.assertFalse(m.WEXITSTATUS.called)
-        self.assertFalse(m.WTERMSIG.called)
 
         # child is running
         self.watcher._sig_chld()
 
         self.assertFalse(callback.called)
-        self.assertFalse(m.WIFEXITED.called)
-        self.assertFalse(m.WIFSIGNALED.called)
-        self.assertFalse(m.WEXITSTATUS.called)
-        self.assertFalse(m.WTERMSIG.called)
 
         # child terminates (returncode 12)
         self.running = False
-        self.add_zombie(42, 12)
+        self.add_zombie(42, EXITCODE(12))
         self.watcher._sig_chld()
 
-        self.assertTrue(m.WIFEXITED.called)
-        self.assertTrue(m.WEXITSTATUS.called)
-        self.assertFalse(m.WTERMSIG.called)
         callback.assert_called_once_with(42, 12, 9, 10, 14)
 
-        m.WIFSIGNALED.reset_mock()
-        m.WIFEXITED.reset_mock()
-        m.WEXITSTATUS.reset_mock()
         callback.reset_mock()
 
         # ensure that the child is effectively reaped
-        self.add_zombie(42, 13)
+        self.add_zombie(42, EXITCODE(13))
         with self.ignore_warnings:
             self.watcher._sig_chld()
 
         self.assertFalse(callback.called)
-        self.assertFalse(m.WTERMSIG.called)
-
-        m.WIFSIGNALED.reset_mock()
-        m.WIFEXITED.reset_mock()
-        m.WEXITSTATUS.reset_mock()
 
         # sigchld called again
         self.zombies.clear()
         self.watcher._sig_chld()
 
         self.assertFalse(callback.called)
-        self.assertFalse(m.WIFEXITED.called)
-        self.assertFalse(m.WIFSIGNALED.called)
-        self.assertFalse(m.WEXITSTATUS.called)
-        self.assertFalse(m.WTERMSIG.called)
 
     @waitpid_mocks
-    def test_sigchld_two_children(self, m):
+    def test_sigchld_two_children(self, m_waitpid):
         callback1 = mock.Mock()
         callback2 = mock.Mock()
 
@@ -1275,10 +1240,6 @@
 
         self.assertFalse(callback1.called)
         self.assertFalse(callback2.called)
-        self.assertFalse(m.WIFEXITED.called)
-        self.assertFalse(m.WIFSIGNALED.called)
-        self.assertFalse(m.WEXITSTATUS.called)
-        self.assertFalse(m.WTERMSIG.called)
 
         # register child 2
         with self.watcher:
@@ -1286,34 +1247,20 @@
 
         self.assertFalse(callback1.called)
         self.assertFalse(callback2.called)
-        self.assertFalse(m.WIFEXITED.called)
-        self.assertFalse(m.WIFSIGNALED.called)
-        self.assertFalse(m.WEXITSTATUS.called)
-        self.assertFalse(m.WTERMSIG.called)
 
         # children are running
         self.watcher._sig_chld()
 
         self.assertFalse(callback1.called)
         self.assertFalse(callback2.called)
-        self.assertFalse(m.WIFEXITED.called)
-        self.assertFalse(m.WIFSIGNALED.called)
-        self.assertFalse(m.WEXITSTATUS.called)
-        self.assertFalse(m.WTERMSIG.called)
 
         # child 1 terminates (signal 3)
-        self.add_zombie(43, -3)
+        self.add_zombie(43, SIGNAL(3))
         self.watcher._sig_chld()
 
         callback1.assert_called_once_with(43, -3, 7, 8)
         self.assertFalse(callback2.called)
-        self.assertTrue(m.WIFSIGNALED.called)
-        self.assertFalse(m.WEXITSTATUS.called)
-        self.assertTrue(m.WTERMSIG.called)
 
-        m.WIFSIGNALED.reset_mock()
-        m.WIFEXITED.reset_mock()
-        m.WTERMSIG.reset_mock()
         callback1.reset_mock()
 
         # child 2 still running
@@ -1321,40 +1268,25 @@
 
         self.assertFalse(callback1.called)
         self.assertFalse(callback2.called)
-        self.assertFalse(m.WIFEXITED.called)
-        self.assertFalse(m.WIFSIGNALED.called)
-        self.assertFalse(m.WEXITSTATUS.called)
-        self.assertFalse(m.WTERMSIG.called)
 
         # child 2 terminates (code 108)
-        self.add_zombie(44, 108)
+        self.add_zombie(44, EXITCODE(108))
         self.running = False
         self.watcher._sig_chld()
 
         callback2.assert_called_once_with(44, 108, 147, 18)
         self.assertFalse(callback1.called)
-        self.assertTrue(m.WIFEXITED.called)
-        self.assertTrue(m.WEXITSTATUS.called)
-        self.assertFalse(m.WTERMSIG.called)
 
-        m.WIFSIGNALED.reset_mock()
-        m.WIFEXITED.reset_mock()
-        m.WEXITSTATUS.reset_mock()
         callback2.reset_mock()
 
         # ensure that the children are effectively reaped
-        self.add_zombie(43, 14)
-        self.add_zombie(44, 15)
+        self.add_zombie(43, EXITCODE(14))
+        self.add_zombie(44, EXITCODE(15))
         with self.ignore_warnings:
             self.watcher._sig_chld()
 
         self.assertFalse(callback1.called)
         self.assertFalse(callback2.called)
-        self.assertFalse(m.WTERMSIG.called)
-
-        m.WIFSIGNALED.reset_mock()
-        m.WIFEXITED.reset_mock()
-        m.WEXITSTATUS.reset_mock()
 
         # sigchld called again
         self.zombies.clear()
@@ -1362,13 +1294,9 @@
 
         self.assertFalse(callback1.called)
         self.assertFalse(callback2.called)
-        self.assertFalse(m.WIFEXITED.called)
-        self.assertFalse(m.WIFSIGNALED.called)
-        self.assertFalse(m.WEXITSTATUS.called)
-        self.assertFalse(m.WTERMSIG.called)
 
     @waitpid_mocks
-    def test_sigchld_two_children_terminating_together(self, m):
+    def test_sigchld_two_children_terminating_together(self, m_waitpid):
         callback1 = mock.Mock()
         callback2 = mock.Mock()
 
@@ -1379,10 +1307,6 @@
 
         self.assertFalse(callback1.called)
         self.assertFalse(callback2.called)
-        self.assertFalse(m.WIFEXITED.called)
-        self.assertFalse(m.WIFSIGNALED.called)
-        self.assertFalse(m.WEXITSTATUS.called)
-        self.assertFalse(m.WTERMSIG.called)
 
         # register child 2
         with self.watcher:
@@ -1390,60 +1314,43 @@
 
         self.assertFalse(callback1.called)
         self.assertFalse(callback2.called)
-        self.assertFalse(m.WIFEXITED.called)
-        self.assertFalse(m.WIFSIGNALED.called)
-        self.assertFalse(m.WEXITSTATUS.called)
-        self.assertFalse(m.WTERMSIG.called)
 
         # children are running
         self.watcher._sig_chld()
 
         self.assertFalse(callback1.called)
         self.assertFalse(callback2.called)
-        self.assertFalse(m.WIFEXITED.called)
-        self.assertFalse(m.WIFSIGNALED.called)
-        self.assertFalse(m.WEXITSTATUS.called)
-        self.assertFalse(m.WTERMSIG.called)
 
         # child 1 terminates (code 78)
         # child 2 terminates (signal 5)
-        self.add_zombie(45, 78)
-        self.add_zombie(46, -5)
+        self.add_zombie(45, EXITCODE(78))
+        self.add_zombie(46, SIGNAL(5))
         self.running = False
         self.watcher._sig_chld()
 
         callback1.assert_called_once_with(45, 78, 17, 8)
         callback2.assert_called_once_with(46, -5, 1147, 18)
-        self.assertTrue(m.WIFSIGNALED.called)
-        self.assertTrue(m.WIFEXITED.called)
-        self.assertTrue(m.WEXITSTATUS.called)
-        self.assertTrue(m.WTERMSIG.called)
 
-        m.WIFSIGNALED.reset_mock()
-        m.WIFEXITED.reset_mock()
-        m.WTERMSIG.reset_mock()
-        m.WEXITSTATUS.reset_mock()
         callback1.reset_mock()
         callback2.reset_mock()
 
         # ensure that the children are effectively reaped
-        self.add_zombie(45, 14)
-        self.add_zombie(46, 15)
+        self.add_zombie(45, EXITCODE(14))
+        self.add_zombie(46, EXITCODE(15))
         with self.ignore_warnings:
             self.watcher._sig_chld()
 
         self.assertFalse(callback1.called)
         self.assertFalse(callback2.called)
-        self.assertFalse(m.WTERMSIG.called)
 
     @waitpid_mocks
-    def test_sigchld_race_condition(self, m):
+    def test_sigchld_race_condition(self, m_waitpid):
         # register a child
         callback = mock.Mock()
 
         with self.watcher:
             # child terminates before being registered
-            self.add_zombie(50, 4)
+            self.add_zombie(50, EXITCODE(4))
             self.watcher._sig_chld()
 
             self.watcher.add_child_handler(50, callback, 1, 12)
@@ -1452,14 +1359,14 @@
         callback.reset_mock()
 
         # ensure that the child is effectively reaped
-        self.add_zombie(50, -1)
+        self.add_zombie(50, SIGNAL(1))
         with self.ignore_warnings:
             self.watcher._sig_chld()
 
         self.assertFalse(callback.called)
 
     @waitpid_mocks
-    def test_sigchld_replace_handler(self, m):
+    def test_sigchld_replace_handler(self, m_waitpid):
         callback1 = mock.Mock()
         callback2 = mock.Mock()
 
@@ -1470,10 +1377,6 @@
 
         self.assertFalse(callback1.called)
         self.assertFalse(callback2.called)
-        self.assertFalse(m.WIFEXITED.called)
-        self.assertFalse(m.WIFSIGNALED.called)
-        self.assertFalse(m.WEXITSTATUS.called)
-        self.assertFalse(m.WTERMSIG.called)
 
         # register the same child again
         with self.watcher:
@@ -1481,38 +1384,27 @@
 
         self.assertFalse(callback1.called)
         self.assertFalse(callback2.called)
-        self.assertFalse(m.WIFEXITED.called)
-        self.assertFalse(m.WIFSIGNALED.called)
-        self.assertFalse(m.WEXITSTATUS.called)
-        self.assertFalse(m.WTERMSIG.called)
 
         # child terminates (signal 8)
         self.running = False
-        self.add_zombie(51, -8)
+        self.add_zombie(51, SIGNAL(8))
         self.watcher._sig_chld()
 
         callback2.assert_called_once_with(51, -8, 21)
         self.assertFalse(callback1.called)
-        self.assertTrue(m.WIFSIGNALED.called)
-        self.assertFalse(m.WEXITSTATUS.called)
-        self.assertTrue(m.WTERMSIG.called)
 
-        m.WIFSIGNALED.reset_mock()
-        m.WIFEXITED.reset_mock()
-        m.WTERMSIG.reset_mock()
         callback2.reset_mock()
 
         # ensure that the child is effectively reaped
-        self.add_zombie(51, 13)
+        self.add_zombie(51, EXITCODE(13))
         with self.ignore_warnings:
             self.watcher._sig_chld()
 
         self.assertFalse(callback1.called)
         self.assertFalse(callback2.called)
-        self.assertFalse(m.WTERMSIG.called)
 
     @waitpid_mocks
-    def test_sigchld_remove_handler(self, m):
+    def test_sigchld_remove_handler(self, m_waitpid):
         callback = mock.Mock()
 
         # register a child
@@ -1521,30 +1413,22 @@
             self.watcher.add_child_handler(52, callback, 1984)
 
         self.assertFalse(callback.called)
-        self.assertFalse(m.WIFEXITED.called)
-        self.assertFalse(m.WIFSIGNALED.called)
-        self.assertFalse(m.WEXITSTATUS.called)
-        self.assertFalse(m.WTERMSIG.called)
 
         # unregister the child
         self.watcher.remove_child_handler(52)
 
         self.assertFalse(callback.called)
-        self.assertFalse(m.WIFEXITED.called)
-        self.assertFalse(m.WIFSIGNALED.called)
-        self.assertFalse(m.WEXITSTATUS.called)
-        self.assertFalse(m.WTERMSIG.called)
 
         # child terminates (code 99)
         self.running = False
-        self.add_zombie(52, 99)
+        self.add_zombie(52, EXITCODE(99))
         with self.ignore_warnings:
             self.watcher._sig_chld()
 
         self.assertFalse(callback.called)
 
     @waitpid_mocks
-    def test_sigchld_unknown_status(self, m):
+    def test_sigchld_unknown_status(self, m_waitpid):
         callback = mock.Mock()
 
         # register a child
@@ -1553,10 +1437,6 @@
             self.watcher.add_child_handler(53, callback, -19)
 
         self.assertFalse(callback.called)
-        self.assertFalse(m.WIFEXITED.called)
-        self.assertFalse(m.WIFSIGNALED.called)
-        self.assertFalse(m.WEXITSTATUS.called)
-        self.assertFalse(m.WTERMSIG.called)
 
         # terminate with unknown status
         self.zombies[53] = 1178
@@ -1564,24 +1444,18 @@
         self.watcher._sig_chld()
 
         callback.assert_called_once_with(53, 1178, -19)
-        self.assertTrue(m.WIFEXITED.called)
-        self.assertTrue(m.WIFSIGNALED.called)
-        self.assertFalse(m.WEXITSTATUS.called)
-        self.assertFalse(m.WTERMSIG.called)
 
         callback.reset_mock()
-        m.WIFEXITED.reset_mock()
-        m.WIFSIGNALED.reset_mock()
 
         # ensure that the child is effectively reaped
-        self.add_zombie(53, 101)
+        self.add_zombie(53, EXITCODE(101))
         with self.ignore_warnings:
             self.watcher._sig_chld()
 
         self.assertFalse(callback.called)
 
     @waitpid_mocks
-    def test_remove_child_handler(self, m):
+    def test_remove_child_handler(self, m_waitpid):
         callback1 = mock.Mock()
         callback2 = mock.Mock()
         callback3 = mock.Mock()
@@ -1602,9 +1476,9 @@
         self.assertFalse(self.watcher.remove_child_handler(55))
 
         # all children terminate
-        self.add_zombie(54, 0)
-        self.add_zombie(55, 1)
-        self.add_zombie(56, 2)
+        self.add_zombie(54, EXITCODE(0))
+        self.add_zombie(55, EXITCODE(1))
+        self.add_zombie(56, EXITCODE(2))
         self.running = False
         with self.ignore_warnings:
             self.watcher._sig_chld()
@@ -1614,7 +1488,7 @@
         callback3.assert_called_once_with(56, 2, 3)
 
     @waitpid_mocks
-    def test_sigchld_unhandled_exception(self, m):
+    def test_sigchld_unhandled_exception(self, m_waitpid):
         callback = mock.Mock()
 
         # register a child
@@ -1623,7 +1497,7 @@
             self.watcher.add_child_handler(57, callback)
 
         # raise an exception
-        m.waitpid.side_effect = ValueError
+        m_waitpid.side_effect = ValueError
 
         with mock.patch.object(log.logger,
                                'error') as m_error:
@@ -1632,7 +1506,7 @@
             self.assertTrue(m_error.called)
 
     @waitpid_mocks
-    def test_sigchld_child_reaped_elsewhere(self, m):
+    def test_sigchld_child_reaped_elsewhere(self, m_waitpid):
         # register a child
         callback = mock.Mock()
 
@@ -1641,19 +1515,15 @@
             self.watcher.add_child_handler(58, callback)
 
         self.assertFalse(callback.called)
-        self.assertFalse(m.WIFEXITED.called)
-        self.assertFalse(m.WIFSIGNALED.called)
-        self.assertFalse(m.WEXITSTATUS.called)
-        self.assertFalse(m.WTERMSIG.called)
 
         # child terminates
         self.running = False
-        self.add_zombie(58, 4)
+        self.add_zombie(58, EXITCODE(4))
 
         # waitpid is called elsewhere
         os.waitpid(58, os.WNOHANG)
 
-        m.waitpid.reset_mock()
+        m_waitpid.reset_mock()
 
         # sigchld
         with self.ignore_warnings:
@@ -1667,7 +1537,7 @@
             callback.assert_called_once_with(58, 255)
 
     @waitpid_mocks
-    def test_sigchld_unknown_pid_during_registration(self, m):
+    def test_sigchld_unknown_pid_during_registration(self, m_waitpid):
         # register two children
         callback1 = mock.Mock()
         callback2 = mock.Mock()
@@ -1675,9 +1545,9 @@
         with self.ignore_warnings, self.watcher:
             self.running = True
             # child 1 terminates
-            self.add_zombie(591, 7)
+            self.add_zombie(591, EXITCODE(7))
             # an unknown child terminates
-            self.add_zombie(593, 17)
+            self.add_zombie(593, EXITCODE(17))
 
             self.watcher._sig_chld()
 
@@ -1688,7 +1558,7 @@
         self.assertFalse(callback2.called)
 
     @waitpid_mocks
-    def test_set_loop(self, m):
+    def test_set_loop(self, m_waitpid):
         # register a child
         callback = mock.Mock()
 
@@ -1713,13 +1583,13 @@
 
         # child terminates
         self.running = False
-        self.add_zombie(60, 9)
+        self.add_zombie(60, EXITCODE(9))
         self.watcher._sig_chld()
 
         callback.assert_called_once_with(60, 9)
 
     @waitpid_mocks
-    def test_set_loop_race_condition(self, m):
+    def test_set_loop_race_condition(self, m_waitpid):
         # register 3 children
         callback1 = mock.Mock()
         callback2 = mock.Mock()
@@ -1746,8 +1616,8 @@
                 signal.SIGCHLD)
 
         # child 1 & 2 terminate
-        self.add_zombie(61, 11)
-        self.add_zombie(62, -5)
+        self.add_zombie(61, EXITCODE(11))
+        self.add_zombie(62, SIGNAL(5))
 
         # SIGCHLD was not caught
         self.assertFalse(callback1.called)
@@ -1773,7 +1643,7 @@
 
         # child 3 terminates
         self.running = False
-        self.add_zombie(622, 19)
+        self.add_zombie(622, EXITCODE(19))
         self.watcher._sig_chld()
 
         self.assertFalse(callback1.called)
@@ -1781,16 +1651,16 @@
         callback3.assert_called_once_with(622, 19)
 
     @waitpid_mocks
-    def test_close(self, m):
+    def test_close(self, m_waitpid):
         # register two children
         callback1 = mock.Mock()
 
         with self.watcher:
             self.running = True
             # child 1 terminates
-            self.add_zombie(63, 9)
+            self.add_zombie(63, EXITCODE(9))
             # other child terminates
-            self.add_zombie(65, 18)
+            self.add_zombie(65, EXITCODE(18))
             self.watcher._sig_chld()
 
             self.watcher.add_child_handler(63, callback1)
diff --git a/Lib/test/test_asyncio/test_windows_utils.py b/Lib/test/test_asyncio/test_windows_utils.py
index 45c09bb..eafa5be 100644
--- a/Lib/test/test_asyncio/test_windows_utils.py
+++ b/Lib/test/test_asyncio/test_windows_utils.py
@@ -107,7 +107,8 @@
 
         events = [ovin.event, ovout.event, overr.event]
         # Super-long timeout for slow buildbots.
-        res = _winapi.WaitForMultipleObjects(events, True, 10000)
+        res = _winapi.WaitForMultipleObjects(events, True,
+                                             int(support.SHORT_TIMEOUT * 1000))
         self.assertEqual(res, _winapi.WAIT_OBJECT_0)
         self.assertFalse(ovout.pending)
         self.assertFalse(overr.pending)
diff --git a/Lib/test/test_asyncio/utils.py b/Lib/test/test_asyncio/utils.py
index 804db91..0b9cde6 100644
--- a/Lib/test/test_asyncio/utils.py
+++ b/Lib/test/test_asyncio/utils.py
@@ -34,6 +34,7 @@
 from asyncio import tasks
 from asyncio.log import logger
 from test import support
+from test.support import threading_helper
 
 
 def data_file(filename):
@@ -58,7 +59,7 @@
     'issuer': ((('countryName', 'XY'),),
             (('organizationName', 'Python Software Foundation CA'),),
             (('commonName', 'our-ca-server'),)),
-    'notAfter': 'Jul  7 14:23:16 2028 GMT',
+    'notAfter': 'Oct 28 14:23:16 2037 GMT',
     'notBefore': 'Aug 29 14:23:16 2018 GMT',
     'serialNumber': 'CB2D80995A69525C',
     'subject': ((('countryName', 'XY'),),
@@ -90,7 +91,7 @@
     if ssl is None:
         return None
     else:
-        return ssl.SSLContext(ssl.PROTOCOL_TLS)
+        return simple_client_sslcontext(disable_verify=True)
 
 
 def run_briefly(loop):
@@ -157,7 +158,7 @@
         # contains the ssl key and certificate files) differs
         # between the stdlib and stand-alone asyncio.
         # Prefer our own if we can find it.
-        context = ssl.SSLContext()
+        context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
         context.load_cert_chain(ONLYCERT, ONLYKEY)
 
         ssock = context.wrap_socket(request, server_side=True)
@@ -408,12 +409,13 @@
             return False
 
     def assert_writer(self, fd, callback, *args):
-        assert fd in self.writers, 'fd {} is not registered'.format(fd)
+        if fd not in self.writers:
+            raise AssertionError(f'fd {fd} is not registered')
         handle = self.writers[fd]
-        assert handle._callback == callback, '{!r} != {!r}'.format(
-            handle._callback, callback)
-        assert handle._args == args, '{!r} != {!r}'.format(
-            handle._args, args)
+        if handle._callback != callback:
+            raise AssertionError(f'{handle._callback!r} != {callback!r}')
+        if handle._args != args:
+            raise AssertionError(f'{handle._args!r} != {args!r}')
 
     def _ensure_fd_no_transport(self, fd):
         if not isinstance(fd, int):
@@ -529,7 +531,8 @@
                         thread.join()
 
     def set_event_loop(self, loop, *, cleanup=True):
-        assert loop is not None
+        if loop is None:
+            raise AssertionError('loop is None')
         # ensure that the event loop is passed explicitly in asyncio
         events.set_event_loop(None)
         if cleanup:
@@ -540,17 +543,10 @@
         self.set_event_loop(loop)
         return loop
 
-    def unpatch_get_running_loop(self):
-        events._get_running_loop = self._get_running_loop
-
     def setUp(self):
-        self._get_running_loop = events._get_running_loop
-        events._get_running_loop = lambda: None
-        self._thread_cleanup = support.threading_setup()
+        self._thread_cleanup = threading_helper.threading_setup()
 
     def tearDown(self):
-        self.unpatch_get_running_loop()
-
         events.set_event_loop(None)
 
         # Detect CPython bug #23353: ensure that yield/yield-from is not used
@@ -558,7 +554,7 @@
         self.assertEqual(sys.exc_info(), (None, None, None))
 
         self.doCleanups()
-        support.threading_cleanup(*self._thread_cleanup)
+        threading_helper.threading_cleanup(*self._thread_cleanup)
         support.reap_children()
 
 
diff --git a/Lib/test/test_asyncore.py b/Lib/test/test_asyncore.py
index 3c3abe4..ecd1e12 100644
--- a/Lib/test/test_asyncore.py
+++ b/Lib/test/test_asyncore.py
@@ -1,4 +1,3 @@
-import asyncore
 import unittest
 import select
 import os
@@ -10,12 +9,20 @@
 import threading
 
 from test import support
+from test.support import os_helper
 from test.support import socket_helper
+from test.support import threading_helper
+from test.support import warnings_helper
 from io import BytesIO
 
 if support.PGO:
     raise unittest.SkipTest("test is not helpful for PGO")
 
+import warnings
+with warnings.catch_warnings():
+    warnings.simplefilter('ignore', DeprecationWarning)
+    import asyncore
+
 
 HAS_UNIX_SOCKETS = hasattr(socket, 'AF_UNIX')
 
@@ -66,7 +73,7 @@
     try:
         serv.listen()
         conn, addr = serv.accept()
-    except socket.timeout:
+    except TimeoutError:
         pass
     else:
         n = 200
@@ -91,7 +98,7 @@
     """Helper function to bind a socket according to its family."""
     if HAS_UNIX_SOCKETS and sock.family == socket.AF_UNIX:
         # Make sure the path doesn't exist.
-        support.unlink(addr)
+        os_helper.unlink(addr)
         socket_helper.bind_unix_socket(sock, addr)
     else:
         sock.bind(addr)
@@ -323,7 +330,7 @@
     def tearDown(self):
         asyncore.close_all()
 
-    @support.reap_threads
+    @threading_helper.reap_threads
     def test_send(self):
         evt = threading.Event()
         sock = socket.socket()
@@ -360,7 +367,7 @@
 
             self.assertEqual(cap.getvalue(), data*2)
         finally:
-            support.join_thread(t)
+            threading_helper.join_thread(t)
 
 
 @unittest.skipUnless(hasattr(asyncore, 'file_wrapper'),
@@ -368,14 +375,14 @@
 class FileWrapperTest(unittest.TestCase):
     def setUp(self):
         self.d = b"It's not dead, it's sleeping!"
-        with open(support.TESTFN, 'wb') as file:
+        with open(os_helper.TESTFN, 'wb') as file:
             file.write(self.d)
 
     def tearDown(self):
-        support.unlink(support.TESTFN)
+        os_helper.unlink(os_helper.TESTFN)
 
     def test_recv(self):
-        fd = os.open(support.TESTFN, os.O_RDONLY)
+        fd = os.open(os_helper.TESTFN, os.O_RDONLY)
         w = asyncore.file_wrapper(fd)
         os.close(fd)
 
@@ -389,20 +396,20 @@
     def test_send(self):
         d1 = b"Come again?"
         d2 = b"I want to buy some cheese."
-        fd = os.open(support.TESTFN, os.O_WRONLY | os.O_APPEND)
+        fd = os.open(os_helper.TESTFN, os.O_WRONLY | os.O_APPEND)
         w = asyncore.file_wrapper(fd)
         os.close(fd)
 
         w.write(d1)
         w.send(d2)
         w.close()
-        with open(support.TESTFN, 'rb') as file:
+        with open(os_helper.TESTFN, 'rb') as file:
             self.assertEqual(file.read(), self.d + d1 + d2)
 
     @unittest.skipUnless(hasattr(asyncore, 'file_dispatcher'),
                          'asyncore.file_dispatcher required')
     def test_dispatcher(self):
-        fd = os.open(support.TESTFN, os.O_RDONLY)
+        fd = os.open(os_helper.TESTFN, os.O_RDONLY)
         data = []
         class FileDispatcher(asyncore.file_dispatcher):
             def handle_read(self):
@@ -414,16 +421,16 @@
 
     def test_resource_warning(self):
         # Issue #11453
-        fd = os.open(support.TESTFN, os.O_RDONLY)
+        fd = os.open(os_helper.TESTFN, os.O_RDONLY)
         f = asyncore.file_wrapper(fd)
 
         os.close(fd)
-        with support.check_warnings(('', ResourceWarning)):
+        with warnings_helper.check_warnings(('', ResourceWarning)):
             f = None
             support.gc_collect()
 
     def test_close_twice(self):
-        fd = os.open(support.TESTFN, os.O_RDONLY)
+        fd = os.open(os_helper.TESTFN, os.O_RDONLY)
         f = asyncore.file_wrapper(fd)
         os.close(fd)
 
@@ -766,7 +773,7 @@
                 self.assertTrue(s.socket.getsockopt(socket.SOL_SOCKET,
                                                      socket.SO_REUSEADDR))
 
-    @support.reap_threads
+    @threading_helper.reap_threads
     def test_quick_connect(self):
         # see: http://bugs.python.org/issue10340
         if self.family not in (socket.AF_INET, getattr(socket, "AF_INET6", object())):
@@ -788,7 +795,7 @@
                 except OSError:
                     pass
         finally:
-            support.join_thread(t)
+            threading_helper.join_thread(t)
 
 class TestAPI_UseIPv4Sockets(BaseTestAPI):
     family = socket.AF_INET
@@ -803,10 +810,10 @@
 class TestAPI_UseUnixSockets(BaseTestAPI):
     if HAS_UNIX_SOCKETS:
         family = socket.AF_UNIX
-    addr = support.TESTFN
+    addr = os_helper.TESTFN
 
     def tearDown(self):
-        support.unlink(self.addr)
+        os_helper.unlink(self.addr)
         BaseTestAPI.tearDown(self)
 
 class TestAPI_UseIPv4Select(TestAPI_UseIPv4Sockets, unittest.TestCase):
diff --git a/Lib/test/test_atexit.py b/Lib/test/test_atexit.py
index 3105f6c..e0feef7 100644
--- a/Lib/test/test_atexit.py
+++ b/Lib/test/test_atexit.py
@@ -1,162 +1,22 @@
-import sys
-import unittest
-import io
 import atexit
 import os
+import sys
+import textwrap
+import unittest
 from test import support
 from test.support import script_helper
 
-### helpers
-def h1():
-    print("h1")
-
-def h2():
-    print("h2")
-
-def h3():
-    print("h3")
-
-def h4(*args, **kwargs):
-    print("h4", args, kwargs)
-
-def raise1():
-    raise TypeError
-
-def raise2():
-    raise SystemError
-
-def exit():
-    raise SystemExit
-
 
 class GeneralTest(unittest.TestCase):
+    def test_general(self):
+        # Run _test_atexit.py in a subprocess since it calls atexit._clear()
+        script = support.findfile("_test_atexit.py")
+        script_helper.run_test_script(script)
 
-    def setUp(self):
-        self.save_stdout = sys.stdout
-        self.save_stderr = sys.stderr
-        self.stream = io.StringIO()
-        sys.stdout = sys.stderr = self.stream
-        atexit._clear()
-
-    def tearDown(self):
-        sys.stdout = self.save_stdout
-        sys.stderr = self.save_stderr
-        atexit._clear()
-
-    def test_args(self):
-        # be sure args are handled properly
-        atexit.register(h1)
-        atexit.register(h4)
-        atexit.register(h4, 4, kw="abc")
-        atexit._run_exitfuncs()
-
-        self.assertEqual(self.stream.getvalue(),
-                            "h4 (4,) {'kw': 'abc'}\nh4 () {}\nh1\n")
-
-    def test_badargs(self):
-        atexit.register(lambda: 1, 0, 0, (x for x in (1,2)), 0, 0)
-        self.assertRaises(TypeError, atexit._run_exitfuncs)
-
-    def test_order(self):
-        # be sure handlers are executed in reverse order
-        atexit.register(h1)
-        atexit.register(h2)
-        atexit.register(h3)
-        atexit._run_exitfuncs()
-
-        self.assertEqual(self.stream.getvalue(), "h3\nh2\nh1\n")
-
-    def test_raise(self):
-        # be sure raises are handled properly
-        atexit.register(raise1)
-        atexit.register(raise2)
-
-        self.assertRaises(TypeError, atexit._run_exitfuncs)
-
-    def test_raise_unnormalized(self):
-        # Issue #10756: Make sure that an unnormalized exception is
-        # handled properly
-        atexit.register(lambda: 1 / 0)
-
-        self.assertRaises(ZeroDivisionError, atexit._run_exitfuncs)
-        self.assertIn("ZeroDivisionError", self.stream.getvalue())
-
-    def test_exit(self):
-        # be sure a SystemExit is handled properly
-        atexit.register(exit)
-
-        self.assertRaises(SystemExit, atexit._run_exitfuncs)
-        self.assertEqual(self.stream.getvalue(), '')
-
-    def test_print_tracebacks(self):
-        # Issue #18776: the tracebacks should be printed when errors occur.
-        def f():
-            1/0  # one
-        def g():
-            1/0  # two
-        def h():
-            1/0  # three
-        atexit.register(f)
-        atexit.register(g)
-        atexit.register(h)
-
-        self.assertRaises(ZeroDivisionError, atexit._run_exitfuncs)
-        stderr = self.stream.getvalue()
-        self.assertEqual(stderr.count("ZeroDivisionError"), 3)
-        self.assertIn("# one", stderr)
-        self.assertIn("# two", stderr)
-        self.assertIn("# three", stderr)
-
-    def test_stress(self):
-        a = [0]
-        def inc():
-            a[0] += 1
-
-        for i in range(128):
-            atexit.register(inc)
-        atexit._run_exitfuncs()
-
-        self.assertEqual(a[0], 128)
-
-    def test_clear(self):
-        a = [0]
-        def inc():
-            a[0] += 1
-
-        atexit.register(inc)
-        atexit._clear()
-        atexit._run_exitfuncs()
-
-        self.assertEqual(a[0], 0)
-
-    def test_unregister(self):
-        a = [0]
-        def inc():
-            a[0] += 1
-        def dec():
-            a[0] -= 1
-
-        for i in range(4):
-            atexit.register(inc)
-        atexit.register(dec)
-        atexit.unregister(inc)
-        atexit._run_exitfuncs()
-
-        self.assertEqual(a[0], -1)
-
-    def test_bound_methods(self):
-        l = []
-        atexit.register(l.append, 5)
-        atexit._run_exitfuncs()
-        self.assertEqual(l, [5])
-
-        atexit.unregister(l.append)
-        atexit._run_exitfuncs()
-        self.assertEqual(l, [5])
-
+class FunctionalTest(unittest.TestCase):
     def test_shutdown(self):
         # Actually test the shutdown mechanism in a subprocess
-        code = """if 1:
+        code = textwrap.dedent("""
             import atexit
 
             def f(msg):
@@ -164,11 +24,29 @@
 
             atexit.register(f, "one")
             atexit.register(f, "two")
-            """
+        """)
         res = script_helper.assert_python_ok("-c", code)
         self.assertEqual(res.out.decode().splitlines(), ["two", "one"])
         self.assertFalse(res.err)
 
+    def test_atexit_instances(self):
+        # bpo-42639: It is safe to have more than one atexit instance.
+        code = textwrap.dedent("""
+            import sys
+            import atexit as atexit1
+            del sys.modules['atexit']
+            import atexit as atexit2
+            del sys.modules['atexit']
+
+            assert atexit2 is not atexit1
+
+            atexit1.register(print, "atexit1")
+            atexit2.register(print, "atexit2")
+        """)
+        res = script_helper.assert_python_ok("-c", code)
+        self.assertEqual(res.out.decode().splitlines(), ["atexit2", "atexit1"])
+        self.assertFalse(res.err)
+
 
 @support.cpython_only
 class SubinterpreterTest(unittest.TestCase):
@@ -178,13 +56,13 @@
         # take care to free callbacks in its per-subinterpreter module
         # state.
         n = atexit._ncallbacks()
-        code = r"""if 1:
+        code = textwrap.dedent(r"""
             import atexit
             def f():
                 pass
             atexit.register(f)
             del atexit
-            """
+        """)
         ret = support.run_in_subinterp(code)
         self.assertEqual(ret, 0)
         self.assertEqual(atexit._ncallbacks(), n)
@@ -193,13 +71,13 @@
         # Similar to the above, but with a refcycle through the atexit
         # module.
         n = atexit._ncallbacks()
-        code = r"""if 1:
+        code = textwrap.dedent(r"""
             import atexit
             def f():
                 pass
             atexit.register(f)
             atexit.__atexit = atexit
-            """
+        """)
         ret = support.run_in_subinterp(code)
         self.assertEqual(ret, 0)
         self.assertEqual(atexit._ncallbacks(), n)
@@ -210,13 +88,13 @@
         expected = b"The test has passed!"
         r, w = os.pipe()
 
-        code = r"""if 1:
+        code = textwrap.dedent(r"""
             import os
             import atexit
             def callback():
                 os.write({:d}, b"The test has passed!")
             atexit.register(callback)
-        """.format(w)
+        """.format(w))
         ret = support.run_in_subinterp(code)
         os.close(w)
         self.assertEqual(os.read(r, len(expected)), expected)
diff --git a/Lib/test/test_audit.py b/Lib/test/test_audit.py
index f79edbc..c5ce263 100644
--- a/Lib/test/test_audit.py
+++ b/Lib/test/test_audit.py
@@ -5,6 +5,9 @@
 import sys
 import unittest
 from test import support
+from test.support import import_helper
+from test.support import os_helper
+
 
 if not hasattr(sys, "addaudithook") or not hasattr(sys, "audit"):
     raise unittest.SkipTest("test only relevant when sys.audit is available")
@@ -51,8 +54,13 @@
     def test_block_add_hook_baseexception(self):
         self.do_test("test_block_add_hook_baseexception")
 
+    def test_marshal(self):
+        import_helper.import_module("marshal")
+
+        self.do_test("test_marshal")
+
     def test_pickle(self):
-        support.import_module("pickle")
+        import_helper.import_module("pickle")
 
         self.do_test("test_pickle")
 
@@ -60,7 +68,7 @@
         self.do_test("test_monkeypatch")
 
     def test_open(self):
-        self.do_test("test_open", support.TESTFN)
+        self.do_test("test_open", os_helper.TESTFN)
 
     def test_cantrace(self):
         self.do_test("test_cantrace")
@@ -89,7 +97,7 @@
         )
 
     def test_winreg(self):
-        support.import_module("winreg")
+        import_helper.import_module("winreg")
         returncode, events, stderr = self.run_python("test_winreg")
         if returncode:
             self.fail(stderr)
@@ -103,7 +111,7 @@
         self.assertSequenceEqual(["winreg.PyHKEY.Detach", " ", expected], events[4])
 
     def test_socket(self):
-        support.import_module("socket")
+        import_helper.import_module("socket")
         returncode, events, stderr = self.run_python("test_socket")
         if returncode:
             self.fail(stderr)
@@ -115,5 +123,55 @@
         self.assertEqual(events[2][0], "socket.bind")
         self.assertTrue(events[2][2].endswith("('127.0.0.1', 8080)"))
 
+    def test_gc(self):
+        returncode, events, stderr = self.run_python("test_gc")
+        if returncode:
+            self.fail(stderr)
+
+        if support.verbose:
+            print(*events, sep='\n')
+        self.assertEqual(
+            [event[0] for event in events],
+            ["gc.get_objects", "gc.get_referrers", "gc.get_referents"]
+        )
+
+
+    def test_http(self):
+        import_helper.import_module("http.client")
+        returncode, events, stderr = self.run_python("test_http_client")
+        if returncode:
+            self.fail(stderr)
+
+        if support.verbose:
+            print(*events, sep='\n')
+        self.assertEqual(events[0][0], "http.client.connect")
+        self.assertEqual(events[0][2], "www.python.org 80")
+        self.assertEqual(events[1][0], "http.client.send")
+        if events[1][2] != '[cannot send]':
+            self.assertIn('HTTP', events[1][2])
+
+
+    def test_sqlite3(self):
+        try:
+            import sqlite3
+        except ImportError:
+            return
+        returncode, events, stderr = self.run_python("test_sqlite3")
+        if returncode:
+            self.fail(stderr)
+
+        if support.verbose:
+            print(*events, sep='\n')
+        actual = [ev[0] for ev in events]
+        expected = ["sqlite3.connect", "sqlite3.connect/handle"] * 2
+
+        if hasattr(sqlite3.Connection, "enable_load_extension"):
+            expected += [
+                "sqlite3.enable_load_extension",
+                "sqlite3.load_extension",
+            ]
+        self.assertEqual(actual, expected)
+
+
 if __name__ == "__main__":
     unittest.main()
diff --git a/Lib/test/test_base64.py b/Lib/test/test_base64.py
index 1dbeac4..4184924 100644
--- a/Lib/test/test_base64.py
+++ b/Lib/test/test_base64.py
@@ -1,9 +1,9 @@
 import unittest
-from test import support
 import base64
 import binascii
 import os
 from array import array
+from test.support import os_helper
 from test.support import script_helper
 
 
@@ -351,6 +351,76 @@
                 with self.assertRaises(binascii.Error):
                     base64.b32decode(data.decode('ascii'))
 
+    def test_b32hexencode(self):
+        test_cases = [
+            # to_encode, expected
+            (b'',      b''),
+            (b'\x00',  b'00======'),
+            (b'a',     b'C4======'),
+            (b'ab',    b'C5H0===='),
+            (b'abc',   b'C5H66==='),
+            (b'abcd',  b'C5H66P0='),
+            (b'abcde', b'C5H66P35'),
+        ]
+        for to_encode, expected in test_cases:
+            with self.subTest(to_decode=to_encode):
+                self.assertEqual(base64.b32hexencode(to_encode), expected)
+
+    def test_b32hexencode_other_types(self):
+        self.check_other_types(base64.b32hexencode, b'abcd', b'C5H66P0=')
+        self.check_encode_type_errors(base64.b32hexencode)
+
+    def test_b32hexdecode(self):
+        test_cases = [
+            # to_decode, expected, casefold
+            (b'',         b'',      False),
+            (b'00======', b'\x00',  False),
+            (b'C4======', b'a',     False),
+            (b'C5H0====', b'ab',    False),
+            (b'C5H66===', b'abc',   False),
+            (b'C5H66P0=', b'abcd',  False),
+            (b'C5H66P35', b'abcde', False),
+            (b'',         b'',      True),
+            (b'00======', b'\x00',  True),
+            (b'C4======', b'a',     True),
+            (b'C5H0====', b'ab',    True),
+            (b'C5H66===', b'abc',   True),
+            (b'C5H66P0=', b'abcd',  True),
+            (b'C5H66P35', b'abcde', True),
+            (b'c4======', b'a',     True),
+            (b'c5h0====', b'ab',    True),
+            (b'c5h66===', b'abc',   True),
+            (b'c5h66p0=', b'abcd',  True),
+            (b'c5h66p35', b'abcde', True),
+        ]
+        for to_decode, expected, casefold in test_cases:
+            with self.subTest(to_decode=to_decode, casefold=casefold):
+                self.assertEqual(base64.b32hexdecode(to_decode, casefold),
+                                 expected)
+                self.assertEqual(base64.b32hexdecode(to_decode.decode('ascii'),
+                                 casefold), expected)
+
+    def test_b32hexdecode_other_types(self):
+        self.check_other_types(base64.b32hexdecode, b'C5H66===', b'abc')
+        self.check_decode_type_errors(base64.b32hexdecode)
+
+    def test_b32hexdecode_error(self):
+        tests = [b'abc', b'ABCDEF==', b'==ABCDEF', b'c4======']
+        prefixes = [b'M', b'ME', b'MFRA', b'MFRGG', b'MFRGGZA', b'MFRGGZDF']
+        for i in range(0, 17):
+            if i:
+                tests.append(b'='*i)
+            for prefix in prefixes:
+                if len(prefix) + i != 8:
+                    tests.append(prefix + b'='*i)
+        for data in tests:
+            with self.subTest(to_decode=data):
+                with self.assertRaises(binascii.Error):
+                    base64.b32hexdecode(data)
+                with self.assertRaises(binascii.Error):
+                    base64.b32hexdecode(data.decode('ascii'))
+
+
     def test_b16encode(self):
         eq = self.assertEqual
         eq(base64.b16encode(b'\x01\x02\xab\xcd\xef'), b'0102ABCDEF')
@@ -644,11 +714,50 @@
     def test_ErrorHeritage(self):
         self.assertTrue(issubclass(binascii.Error, ValueError))
 
+    def test_RFC4648_test_cases(self):
+        # test cases from RFC 4648 section 10
+        b64encode = base64.b64encode
+        b32hexencode = base64.b32hexencode
+        b32encode = base64.b32encode
+        b16encode = base64.b16encode
+
+        self.assertEqual(b64encode(b""), b"")
+        self.assertEqual(b64encode(b"f"), b"Zg==")
+        self.assertEqual(b64encode(b"fo"), b"Zm8=")
+        self.assertEqual(b64encode(b"foo"), b"Zm9v")
+        self.assertEqual(b64encode(b"foob"), b"Zm9vYg==")
+        self.assertEqual(b64encode(b"fooba"), b"Zm9vYmE=")
+        self.assertEqual(b64encode(b"foobar"), b"Zm9vYmFy")
+
+        self.assertEqual(b32encode(b""), b"")
+        self.assertEqual(b32encode(b"f"), b"MY======")
+        self.assertEqual(b32encode(b"fo"), b"MZXQ====")
+        self.assertEqual(b32encode(b"foo"), b"MZXW6===")
+        self.assertEqual(b32encode(b"foob"), b"MZXW6YQ=")
+        self.assertEqual(b32encode(b"fooba"), b"MZXW6YTB")
+        self.assertEqual(b32encode(b"foobar"), b"MZXW6YTBOI======")
+
+        self.assertEqual(b32hexencode(b""), b"")
+        self.assertEqual(b32hexencode(b"f"), b"CO======")
+        self.assertEqual(b32hexencode(b"fo"), b"CPNG====")
+        self.assertEqual(b32hexencode(b"foo"), b"CPNMU===")
+        self.assertEqual(b32hexencode(b"foob"), b"CPNMUOG=")
+        self.assertEqual(b32hexencode(b"fooba"), b"CPNMUOJ1")
+        self.assertEqual(b32hexencode(b"foobar"), b"CPNMUOJ1E8======")
+
+        self.assertEqual(b16encode(b""), b"")
+        self.assertEqual(b16encode(b"f"), b"66")
+        self.assertEqual(b16encode(b"fo"), b"666F")
+        self.assertEqual(b16encode(b"foo"), b"666F6F")
+        self.assertEqual(b16encode(b"foob"), b"666F6F62")
+        self.assertEqual(b16encode(b"fooba"), b"666F6F6261")
+        self.assertEqual(b16encode(b"foobar"), b"666F6F626172")
+
 
 class TestMain(unittest.TestCase):
     def tearDown(self):
-        if os.path.exists(support.TESTFN):
-            os.unlink(support.TESTFN)
+        if os.path.exists(os_helper.TESTFN):
+            os.unlink(os_helper.TESTFN)
 
     def get_output(self, *args):
         return script_helper.assert_python_ok('-m', 'base64', *args).out
@@ -662,9 +771,9 @@
         ))
 
     def test_encode_file(self):
-        with open(support.TESTFN, 'wb') as fp:
+        with open(os_helper.TESTFN, 'wb') as fp:
             fp.write(b'a\xffb\n')
-        output = self.get_output('-e', support.TESTFN)
+        output = self.get_output('-e', os_helper.TESTFN)
         self.assertEqual(output.rstrip(), b'Yf9iCg==')
 
     def test_encode_from_stdin(self):
@@ -674,9 +783,9 @@
         self.assertIsNone(err)
 
     def test_decode(self):
-        with open(support.TESTFN, 'wb') as fp:
+        with open(os_helper.TESTFN, 'wb') as fp:
             fp.write(b'Yf9iCg==')
-        output = self.get_output('-d', support.TESTFN)
+        output = self.get_output('-d', os_helper.TESTFN)
         self.assertEqual(output.rstrip(), b'a\xffb')
 
 if __name__ == '__main__':
diff --git a/Lib/test/test_baseexception.py b/Lib/test/test_baseexception.py
index c324682..8db497a 100644
--- a/Lib/test/test_baseexception.py
+++ b/Lib/test/test_baseexception.py
@@ -28,8 +28,9 @@
             except TypeError:
                 pass
 
-        inheritance_tree = open(os.path.join(os.path.split(__file__)[0],
-                                                'exception_hierarchy.txt'))
+        inheritance_tree = open(
+                os.path.join(os.path.split(__file__)[0], 'exception_hierarchy.txt'),
+                encoding="utf-8")
         try:
             superclass_name = inheritance_tree.readline().rstrip()
             try:
diff --git a/Lib/test/test_bdb.py b/Lib/test/test_bdb.py
index ae16880..6ec5953 100644
--- a/Lib/test/test_bdb.py
+++ b/Lib/test/test_bdb.py
@@ -57,7 +57,9 @@
 import linecache
 from contextlib import contextmanager
 from itertools import islice, repeat
-import test.support
+from test.support import import_helper
+from test.support import os_helper
+
 
 class BdbException(Exception): pass
 class BdbError(BdbException): """Error raised by the Bdb instance."""
@@ -71,9 +73,7 @@
 dry_run = 0
 
 def reset_Breakpoint():
-    _bdb.Breakpoint.next = 1
-    _bdb.Breakpoint.bplist = {}
-    _bdb.Breakpoint.bpbynumber = [None]
+    _bdb.Breakpoint.clearBreakpoints()
 
 def info_breakpoints():
     bp_list = [bp for  bp in _bdb.Breakpoint.bpbynumber if bp]
@@ -531,19 +531,19 @@
 
 @contextmanager
 def create_modules(modules):
-    with test.support.temp_cwd():
+    with os_helper.temp_cwd():
         sys.path.append(os.getcwd())
         try:
             for m in modules:
                 fname = m + '.py'
-                with open(fname, 'w') as f:
+                with open(fname, 'w', encoding="utf-8") as f:
                     f.write(textwrap.dedent(modules[m]))
                 linecache.checkcache(fname)
             importlib.invalidate_caches()
             yield
         finally:
             for m in modules:
-                test.support.forget(m)
+                import_helper.forget(m)
             sys.path.pop()
 
 def break_in_func(funcname, fname=__file__, temporary=False, cond=None):
@@ -948,6 +948,49 @@
         with TracerRun(self) as tracer:
             self.assertRaises(BdbError, tracer.runcall, tfunc_import)
 
+    def test_load_bps_from_previous_Bdb_instance(self):
+        reset_Breakpoint()
+        db1 = Bdb()
+        fname = db1.canonic(__file__)
+        db1.set_break(__file__, 1)
+        self.assertEqual(db1.get_all_breaks(), {fname: [1]})
+
+        db2 = Bdb()
+        db2.set_break(__file__, 2)
+        db2.set_break(__file__, 3)
+        db2.set_break(__file__, 4)
+        self.assertEqual(db1.get_all_breaks(), {fname: [1]})
+        self.assertEqual(db2.get_all_breaks(), {fname: [1, 2, 3, 4]})
+        db2.clear_break(__file__, 1)
+        self.assertEqual(db1.get_all_breaks(), {fname: [1]})
+        self.assertEqual(db2.get_all_breaks(), {fname: [2, 3, 4]})
+
+        db3 = Bdb()
+        self.assertEqual(db1.get_all_breaks(), {fname: [1]})
+        self.assertEqual(db2.get_all_breaks(), {fname: [2, 3, 4]})
+        self.assertEqual(db3.get_all_breaks(), {fname: [2, 3, 4]})
+        db2.clear_break(__file__, 2)
+        self.assertEqual(db1.get_all_breaks(), {fname: [1]})
+        self.assertEqual(db2.get_all_breaks(), {fname: [3, 4]})
+        self.assertEqual(db3.get_all_breaks(), {fname: [2, 3, 4]})
+
+        db4 = Bdb()
+        db4.set_break(__file__, 5)
+        self.assertEqual(db1.get_all_breaks(), {fname: [1]})
+        self.assertEqual(db2.get_all_breaks(), {fname: [3, 4]})
+        self.assertEqual(db3.get_all_breaks(), {fname: [2, 3, 4]})
+        self.assertEqual(db4.get_all_breaks(), {fname: [3, 4, 5]})
+        reset_Breakpoint()
+
+        db5 = Bdb()
+        db5.set_break(__file__, 6)
+        self.assertEqual(db1.get_all_breaks(), {fname: [1]})
+        self.assertEqual(db2.get_all_breaks(), {fname: [3, 4]})
+        self.assertEqual(db3.get_all_breaks(), {fname: [2, 3, 4]})
+        self.assertEqual(db4.get_all_breaks(), {fname: [3, 4, 5]})
+        self.assertEqual(db5.get_all_breaks(), {fname: [6]})
+
+
 class RunTestCase(BaseTestCase):
     """Test run, runeval and set_trace."""
 
@@ -1149,13 +1192,6 @@
             with TracerRun(self) as tracer:
                 tracer.runcall(tfunc_import)
 
-def test_main():
-    test.support.run_unittest(
-        StateTestCase,
-        RunTestCase,
-        BreakpointTestCase,
-        IssuesTestCase,
-    )
 
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_bigaddrspace.py b/Lib/test/test_bigaddrspace.py
index aa1f8ca..50272e9 100644
--- a/Lib/test/test_bigaddrspace.py
+++ b/Lib/test/test_bigaddrspace.py
@@ -92,10 +92,7 @@
             x = None
 
 
-def test_main():
-    support.run_unittest(BytesTest, StrTest)
-
 if __name__ == '__main__':
     if len(sys.argv) > 1:
         support.set_memlimit(sys.argv[1])
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_bigmem.py b/Lib/test/test_bigmem.py
index 6a244dd..859f153 100644
--- a/Lib/test/test_bigmem.py
+++ b/Lib/test/test_bigmem.py
@@ -1247,11 +1247,8 @@
         self.assertEqual(l[:10], [1] * 10)
         self.assertEqual(l[-10:], [5] * 10)
 
-def test_main():
-    support.run_unittest(StrTest, BytesTest, BytearrayTest,
-        TupleTest, ListTest)
 
 if __name__ == '__main__':
     if len(sys.argv) > 1:
         support.set_memlimit(sys.argv[1])
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_binascii.py b/Lib/test/test_binascii.py
index 4532795..4d1bf2c 100644
--- a/Lib/test/test_binascii.py
+++ b/Lib/test/test_binascii.py
@@ -4,7 +4,8 @@
 import binascii
 import array
 import re
-from test import support
+from test.support import warnings_helper
+
 
 # Note: "*_hex" functions are aliases for "(un)hexlify"
 b2a_functions = ['b2a_base64', 'b2a_hex', 'b2a_hqx', 'b2a_qp', 'b2a_uu',
@@ -37,7 +38,7 @@
             self.assertTrue(hasattr(getattr(binascii, name), '__call__'))
             self.assertRaises(TypeError, getattr(binascii, name))
 
-    @support.ignore_warnings(category=DeprecationWarning)
+    @warnings_helper.ignore_warnings(category=DeprecationWarning)
     def test_returned_value(self):
         # Limit to the minimum of all limits (b2a_uu)
         MAX_ALL = 45
@@ -181,7 +182,7 @@
         with self.assertRaises(TypeError):
             binascii.b2a_uu(b"", True)
 
-    @support.ignore_warnings(category=DeprecationWarning)
+    @warnings_helper.ignore_warnings(category=DeprecationWarning)
     def test_crc_hqx(self):
         crc = binascii.crc_hqx(self.type2test(b"Test the CRC-32 of"), 0)
         crc = binascii.crc_hqx(self.type2test(b" this string."), crc)
@@ -201,7 +202,7 @@
 
         self.assertRaises(TypeError, binascii.crc32)
 
-    @support.ignore_warnings(category=DeprecationWarning)
+    @warnings_helper.ignore_warnings(category=DeprecationWarning)
     def test_hqx(self):
         # Perform binhex4 style RLE-compression
         # Then calculate the hexbin4 binary-to-ASCII translation
@@ -212,7 +213,7 @@
         res = binascii.rledecode_hqx(b)
         self.assertEqual(res, self.rawdata)
 
-    @support.ignore_warnings(category=DeprecationWarning)
+    @warnings_helper.ignore_warnings(category=DeprecationWarning)
     def test_rle(self):
         # test repetition with a repetition longer than the limit of 255
         data = (b'a' * 100 + b'b' + b'c' * 300)
@@ -359,7 +360,7 @@
         self.assertEqual(b2a_qp(type2test(b'a.\n')), b'a.\n')
         self.assertEqual(b2a_qp(type2test(b'.a')[:-1]), b'=2E')
 
-    @support.ignore_warnings(category=DeprecationWarning)
+    @warnings_helper.ignore_warnings(category=DeprecationWarning)
     def test_empty_string(self):
         # A test for SF bug #1022953.  Make sure SystemError is not raised.
         empty = self.type2test(b'')
@@ -384,7 +385,7 @@
         # crc_hqx needs 2 arguments
         self.assertRaises(TypeError, binascii.crc_hqx, "test", 0)
 
-    @support.ignore_warnings(category=DeprecationWarning)
+    @warnings_helper.ignore_warnings(category=DeprecationWarning)
     def test_unicode_a2b(self):
         # Unicode strings are accepted by a2b_* functions.
         MAX_ALL = 45
diff --git a/Lib/test/test_binhex.py b/Lib/test/test_binhex.py
index 9c9486e..efc1654 100644
--- a/Lib/test/test_binhex.py
+++ b/Lib/test/test_binhex.py
@@ -5,23 +5,27 @@
 """
 import unittest
 from test import support
+from test.support import import_helper
+from test.support import os_helper
+from test.support import warnings_helper
 
-with support.check_warnings(('', DeprecationWarning)):
-    binhex = support.import_fresh_module('binhex')
+
+with warnings_helper.check_warnings(('', DeprecationWarning)):
+    binhex = import_helper.import_fresh_module('binhex')
 
 
 class BinHexTestCase(unittest.TestCase):
 
     def setUp(self):
         # binhex supports only file names encodable to Latin1
-        self.fname1 = support.TESTFN_ASCII + "1"
-        self.fname2 = support.TESTFN_ASCII + "2"
-        self.fname3 = support.TESTFN_ASCII + "very_long_filename__very_long_filename__very_long_filename__very_long_filename__"
+        self.fname1 = os_helper.TESTFN_ASCII + "1"
+        self.fname2 = os_helper.TESTFN_ASCII + "2"
+        self.fname3 = os_helper.TESTFN_ASCII + "very_long_filename__very_long_filename__very_long_filename__very_long_filename__"
 
     def tearDown(self):
-        support.unlink(self.fname1)
-        support.unlink(self.fname2)
-        support.unlink(self.fname3)
+        os_helper.unlink(self.fname1)
+        os_helper.unlink(self.fname2)
+        os_helper.unlink(self.fname3)
 
     DATA = b'Jack is my hero'
 
diff --git a/Lib/test/test_bisect.py b/Lib/test/test_bisect.py
index 580a963..20f8b9d 100644
--- a/Lib/test/test_bisect.py
+++ b/Lib/test/test_bisect.py
@@ -1,10 +1,11 @@
 import sys
 import unittest
-from test import support
+from test.support import import_helper
 from collections import UserList
 
-py_bisect = support.import_fresh_module('bisect', blocked=['_bisect'])
-c_bisect = support.import_fresh_module('bisect', fresh=['_bisect'])
+
+py_bisect = import_helper.import_fresh_module('bisect', blocked=['_bisect'])
+c_bisect = import_helper.import_fresh_module('bisect', fresh=['_bisect'])
 
 class Range(object):
     """A trivial range()-like object that has an insert() method."""
@@ -199,6 +200,63 @@
         self.module.insort(a=data, x=25, lo=1, hi=3)
         self.assertEqual(data, [10, 20, 25, 25, 25, 30, 40, 50])
 
+    def test_lookups_with_key_function(self):
+        mod = self.module
+
+        # Invariant: Index with a keyfunc on an array
+        # should match the index on an array where
+        # key function has already been applied.
+
+        keyfunc = abs
+        arr = sorted([2, -4, 6, 8, -10], key=keyfunc)
+        precomputed_arr = list(map(keyfunc, arr))
+        for x in precomputed_arr:
+            self.assertEqual(
+                mod.bisect_left(arr, x, key=keyfunc),
+                mod.bisect_left(precomputed_arr, x)
+            )
+            self.assertEqual(
+                mod.bisect_right(arr, x, key=keyfunc),
+                mod.bisect_right(precomputed_arr, x)
+            )
+
+        keyfunc = str.casefold
+        arr = sorted('aBcDeEfgHhiIiij', key=keyfunc)
+        precomputed_arr = list(map(keyfunc, arr))
+        for x in precomputed_arr:
+            self.assertEqual(
+                mod.bisect_left(arr, x, key=keyfunc),
+                mod.bisect_left(precomputed_arr, x)
+            )
+            self.assertEqual(
+                mod.bisect_right(arr, x, key=keyfunc),
+                mod.bisect_right(precomputed_arr, x)
+            )
+
+    def test_insort(self):
+        from random import shuffle
+        mod = self.module
+
+        # Invariant:  As random elements are inserted in
+        # a target list, the targetlist remains sorted.
+        keyfunc = abs
+        data = list(range(-10, 11)) + list(range(-20, 20, 2))
+        shuffle(data)
+        target = []
+        for x in data:
+            mod.insort_left(target, x, key=keyfunc)
+            self.assertEqual(
+                sorted(target, key=keyfunc),
+                target
+            )
+        target = []
+        for x in data:
+            mod.insort_right(target, x, key=keyfunc)
+            self.assertEqual(
+                sorted(target, key=keyfunc),
+                target
+            )
+
 class TestBisectPython(TestBisect, unittest.TestCase):
     module = py_bisect
 
diff --git a/Lib/test/test_bool.py b/Lib/test/test_bool.py
index 909a59a..4b32aad 100644
--- a/Lib/test/test_bool.py
+++ b/Lib/test/test_bool.py
@@ -1,7 +1,7 @@
 # Test properties of bool promised by PEP 285
 
 import unittest
-from test import support
+from test.support import os_helper
 
 import os
 
@@ -18,20 +18,11 @@
 
         self.assertRaises(TypeError, int.__new__, bool, 0)
 
-    def test_print(self):
-        try:
-            with open(support.TESTFN, "w") as fo:
-                print(False, True, file=fo)
-            with open(support.TESTFN, "r") as fi:
-                self.assertEqual(fi.read(), 'False True\n')
-        finally:
-            os.remove(support.TESTFN)
-
     def test_repr(self):
         self.assertEqual(repr(False), 'False')
         self.assertEqual(repr(True), 'True')
-        self.assertEqual(eval(repr(False)), False)
-        self.assertEqual(eval(repr(True)), True)
+        self.assertIs(eval(repr(False)), False)
+        self.assertIs(eval(repr(True)), True)
 
     def test_str(self):
         self.assertEqual(str(False), 'False')
@@ -243,11 +234,11 @@
 
     def test_fileclosed(self):
         try:
-            with open(support.TESTFN, "w") as f:
+            with open(os_helper.TESTFN, "w", encoding="utf-8") as f:
                 self.assertIs(f.closed, False)
             self.assertIs(f.closed, True)
         finally:
-            os.remove(support.TESTFN)
+            os.remove(os_helper.TESTFN)
 
     def test_types(self):
         # types are always true.
@@ -362,8 +353,22 @@
         self.assertIs(type(False.real), int)
         self.assertIs(type(False.imag), int)
 
-def test_main():
-    support.run_unittest(BoolTest)
+    def test_bool_called_at_least_once(self):
+        class X:
+            def __init__(self):
+                self.count = 0
+            def __bool__(self):
+                self.count += 1
+                return True
+
+        def f(x):
+            if x or True:
+                pass
+
+        x = X()
+        f(x)
+        self.assertGreaterEqual(x.count, 1)
+
 
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_buffer.py b/Lib/test/test_buffer.py
index d440bcf..468c6ea 100644
--- a/Lib/test/test_buffer.py
+++ b/Lib/test/test_buffer.py
@@ -16,6 +16,7 @@
 import contextlib
 import unittest
 from test import support
+from test.support import os_helper
 from itertools import permutations, product
 from random import randrange, sample, choice
 import warnings
@@ -39,7 +40,7 @@
     ctypes = None
 
 try:
-    with support.EnvironmentVarGuard() as os.environ, \
+    with os_helper.EnvironmentVarGuard() as os.environ, \
          warnings.catch_warnings():
         from numpy import ndarray as numpy_array
 except ImportError:
diff --git a/Lib/test/test_bufio.py b/Lib/test/test_bufio.py
index fea6da4..17151b1 100644
--- a/Lib/test/test_bufio.py
+++ b/Lib/test/test_bufio.py
@@ -1,5 +1,6 @@
 import unittest
 from test import support
+from test.support import os_helper
 
 import io # C implementation.
 import _pyio as pyio # Python implementation.
@@ -17,18 +18,18 @@
         # .readline()s deliver what we wrote.
 
         # Ensure we can open TESTFN for writing.
-        support.unlink(support.TESTFN)
+        os_helper.unlink(os_helper.TESTFN)
 
         # Since C doesn't guarantee we can write/read arbitrary bytes in text
         # files, use binary mode.
-        f = self.open(support.TESTFN, "wb")
+        f = self.open(os_helper.TESTFN, "wb")
         try:
             # write once with \n and once without
             f.write(s)
             f.write(b"\n")
             f.write(s)
             f.close()
-            f = open(support.TESTFN, "rb")
+            f = open(os_helper.TESTFN, "rb")
             line = f.readline()
             self.assertEqual(line, s + b"\n")
             line = f.readline()
@@ -37,7 +38,7 @@
             self.assertFalse(line) # Must be at EOF
             f.close()
         finally:
-            support.unlink(support.TESTFN)
+            os_helper.unlink(os_helper.TESTFN)
 
     def drive_one(self, pattern):
         for length in lengths:
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py
index 4df1b95..4b0b15f 100644
--- a/Lib/test/test_builtin.py
+++ b/Lib/test/test_builtin.py
@@ -6,6 +6,7 @@
 import collections
 import decimal
 import fractions
+import gc
 import io
 import locale
 import os
@@ -26,10 +27,10 @@
 from types import AsyncGeneratorType, FunctionType
 from operator import neg
 from test import support
-from test.support import (
-    EnvironmentVarGuard, TESTFN, check_warnings, swap_attr, unlink,
-    maybe_get_event_loop_policy)
+from test.support import (swap_attr, maybe_get_event_loop_policy)
+from test.support.os_helper import (EnvironmentVarGuard, TESTFN, unlink)
 from test.support.script_helper import assert_python_ok
+from test.support.warnings_helper import check_warnings
 from unittest.mock import MagicMock, patch
 try:
     import pty, signal
@@ -580,8 +581,8 @@
         # dir(traceback)
         try:
             raise IndexError
-        except:
-            self.assertEqual(len(dir(sys.exc_info()[2])), 4)
+        except IndexError as e:
+            self.assertEqual(len(dir(e.__traceback__)), 4)
 
         # test that object has a __dir__()
         self.assertEqual(sorted([].__dir__()), dir([]))
@@ -1158,7 +1159,7 @@
 
     def write_testfile(self):
         # NB the first 4 lines are also used to test input, below
-        fp = open(TESTFN, 'w')
+        fp = open(TESTFN, 'w', encoding="utf-8")
         self.addCleanup(unlink, TESTFN)
         with fp:
             fp.write('1+1\n')
@@ -1170,7 +1171,7 @@
 
     def test_open(self):
         self.write_testfile()
-        fp = open(TESTFN, 'r')
+        fp = open(TESTFN, encoding="utf-8")
         with fp:
             self.assertEqual(fp.readline(4), '1+1\n')
             self.assertEqual(fp.readline(), 'The quick brown fox jumps over the lazy dog.\n')
@@ -1196,7 +1197,9 @@
 
             self.write_testfile()
             current_locale_encoding = locale.getpreferredencoding(False)
-            fp = open(TESTFN, 'w')
+            with warnings.catch_warnings():
+                warnings.simplefilter("ignore", EncodingWarning)
+                fp = open(TESTFN, 'w')
             with fp:
                 self.assertEqual(fp.encoding, current_locale_encoding)
         finally:
@@ -1204,7 +1207,7 @@
             os.environ.update(old_environ)
 
     def test_open_non_inheritable(self):
-        fileobj = open(__file__)
+        fileobj = open(__file__, encoding="utf-8")
         with fileobj:
             self.assertFalse(os.get_inheritable(fileobj.fileno()))
 
@@ -1299,7 +1302,7 @@
 
     def test_input(self):
         self.write_testfile()
-        fp = open(TESTFN, 'r')
+        fp = open(TESTFN, encoding="utf-8")
         savestdin = sys.stdin
         savestdout = sys.stdout # Eats the echo
         try:
@@ -1542,6 +1545,14 @@
         self.assertRaises(TypeError, vars, 42)
         self.assertEqual(vars(self.C_get_vars()), {'a':2})
 
+    def iter_error(self, iterable, error):
+        """Collect `iterable` into a list, catching an expected `error`."""
+        items = []
+        with self.assertRaises(error):
+            for item in iterable:
+                items.append(item)
+        return items
+
     def test_zip(self):
         a = (1, 2, 3)
         b = (4, 5, 6)
@@ -1594,6 +1605,24 @@
             z1 = zip(a, b)
             self.check_iter_pickle(z1, t, proto)
 
+    def test_zip_pickle_strict(self):
+        a = (1, 2, 3)
+        b = (4, 5, 6)
+        t = [(1, 4), (2, 5), (3, 6)]
+        for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+            z1 = zip(a, b, strict=True)
+            self.check_iter_pickle(z1, t, proto)
+
+    def test_zip_pickle_strict_fail(self):
+        a = (1, 2, 3)
+        b = (4, 5, 6, 7)
+        t = [(1, 4), (2, 5), (3, 6)]
+        for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+            z1 = zip(a, b, strict=True)
+            z2 = pickle.loads(pickle.dumps(z1, proto))
+            self.assertEqual(self.iter_error(z1, ValueError), t)
+            self.assertEqual(self.iter_error(z2, ValueError), t)
+
     def test_zip_bad_iterable(self):
         exception = TypeError()
 
@@ -1606,6 +1635,100 @@
 
         self.assertIs(cm.exception, exception)
 
+    def test_zip_strict(self):
+        self.assertEqual(tuple(zip((1, 2, 3), 'abc', strict=True)),
+                         ((1, 'a'), (2, 'b'), (3, 'c')))
+        self.assertRaises(ValueError, tuple,
+                          zip((1, 2, 3, 4), 'abc', strict=True))
+        self.assertRaises(ValueError, tuple,
+                          zip((1, 2), 'abc', strict=True))
+        self.assertRaises(ValueError, tuple,
+                          zip((1, 2), (1, 2), 'abc', strict=True))
+
+    def test_zip_strict_iterators(self):
+        x = iter(range(5))
+        y = [0]
+        z = iter(range(5))
+        self.assertRaises(ValueError, list,
+                          (zip(x, y, z, strict=True)))
+        self.assertEqual(next(x), 2)
+        self.assertEqual(next(z), 1)
+
+    def test_zip_strict_error_handling(self):
+
+        class Error(Exception):
+            pass
+
+        class Iter:
+            def __init__(self, size):
+                self.size = size
+            def __iter__(self):
+                return self
+            def __next__(self):
+                self.size -= 1
+                if self.size < 0:
+                    raise Error
+                return self.size
+
+        l1 = self.iter_error(zip("AB", Iter(1), strict=True), Error)
+        self.assertEqual(l1, [("A", 0)])
+        l2 = self.iter_error(zip("AB", Iter(2), "A", strict=True), ValueError)
+        self.assertEqual(l2, [("A", 1, "A")])
+        l3 = self.iter_error(zip("AB", Iter(2), "ABC", strict=True), Error)
+        self.assertEqual(l3, [("A", 1, "A"), ("B", 0, "B")])
+        l4 = self.iter_error(zip("AB", Iter(3), strict=True), ValueError)
+        self.assertEqual(l4, [("A", 2), ("B", 1)])
+        l5 = self.iter_error(zip(Iter(1), "AB", strict=True), Error)
+        self.assertEqual(l5, [(0, "A")])
+        l6 = self.iter_error(zip(Iter(2), "A", strict=True), ValueError)
+        self.assertEqual(l6, [(1, "A")])
+        l7 = self.iter_error(zip(Iter(2), "ABC", strict=True), Error)
+        self.assertEqual(l7, [(1, "A"), (0, "B")])
+        l8 = self.iter_error(zip(Iter(3), "AB", strict=True), ValueError)
+        self.assertEqual(l8, [(2, "A"), (1, "B")])
+
+    def test_zip_strict_error_handling_stopiteration(self):
+
+        class Iter:
+            def __init__(self, size):
+                self.size = size
+            def __iter__(self):
+                return self
+            def __next__(self):
+                self.size -= 1
+                if self.size < 0:
+                    raise StopIteration
+                return self.size
+
+        l1 = self.iter_error(zip("AB", Iter(1), strict=True), ValueError)
+        self.assertEqual(l1, [("A", 0)])
+        l2 = self.iter_error(zip("AB", Iter(2), "A", strict=True), ValueError)
+        self.assertEqual(l2, [("A", 1, "A")])
+        l3 = self.iter_error(zip("AB", Iter(2), "ABC", strict=True), ValueError)
+        self.assertEqual(l3, [("A", 1, "A"), ("B", 0, "B")])
+        l4 = self.iter_error(zip("AB", Iter(3), strict=True), ValueError)
+        self.assertEqual(l4, [("A", 2), ("B", 1)])
+        l5 = self.iter_error(zip(Iter(1), "AB", strict=True), ValueError)
+        self.assertEqual(l5, [(0, "A")])
+        l6 = self.iter_error(zip(Iter(2), "A", strict=True), ValueError)
+        self.assertEqual(l6, [(1, "A")])
+        l7 = self.iter_error(zip(Iter(2), "ABC", strict=True), ValueError)
+        self.assertEqual(l7, [(1, "A"), (0, "B")])
+        l8 = self.iter_error(zip(Iter(3), "AB", strict=True), ValueError)
+        self.assertEqual(l8, [(2, "A"), (1, "B")])
+
+    @support.cpython_only
+    def test_zip_result_gc(self):
+        # bpo-42536: zip's tuple-reuse speed trick breaks the GC's assumptions
+        # about what can be untracked. Make sure we re-track result tuples
+        # whenever we reuse them.
+        it = zip([[]])
+        gc.collect()
+        # That GC collection probably untracked the recycled internal result
+        # tuple, which is initialized to (None,). Make sure it's re-tracked when
+        # it's mutated and returned from __next__:
+        self.assertTrue(gc.is_tracked(next(it)))
+
     def test_format(self):
         # Test the basic machinery of the format() builtin.  Don't test
         #  the specifics of the various formatters
@@ -1738,7 +1861,7 @@
         # be evaluated in a boolean context (virtually all such use cases
         # are a result of accidental misuse implementing rich comparison
         # operations in terms of one another).
-        # For the time being, it will continue to evaluate as truthy, but
+        # For the time being, it will continue to evaluate as a true value, but
         # issue a deprecation warning (with the eventual intent to make it
         # a TypeError).
         self.assertWarns(DeprecationWarning, bool, NotImplemented)
@@ -1901,7 +2024,7 @@
         os.write(fd, terminal_input)
 
         # Get results from the pipe
-        with open(r, "r") as rpipe:
+        with open(r, encoding="utf-8") as rpipe:
             lines = []
             while True:
                 line = rpipe.readline().strip()
@@ -1967,12 +2090,24 @@
         # is different and invokes GNU readline if available).
         self.check_input_tty("prompt", b"quux")
 
+    def skip_if_readline(self):
+        # bpo-13886: When the readline module is loaded, PyOS_Readline() uses
+        # the readline implementation. In some cases, the Python readline
+        # callback rlhandler() is called by readline with a string without
+        # non-ASCII characters. Skip tests on non-ASCII characters if the
+        # readline module is loaded, since test_builtin is not intented to test
+        # the readline module, but the builtins module.
+        if 'readline' in sys.modules:
+            self.skipTest("the readline module is loaded")
+
     def test_input_tty_non_ascii(self):
-        # Check stdin/stdout encoding is used when invoking GNU readline
+        self.skip_if_readline()
+        # Check stdin/stdout encoding is used when invoking PyOS_Readline()
         self.check_input_tty("prompté", b"quux\xe9", "utf-8")
 
     def test_input_tty_non_ascii_unicode_errors(self):
-        # Check stdin/stdout error handler is used when invoking GNU readline
+        self.skip_if_readline()
+        # Check stdin/stdout error handler is used when invoking PyOS_Readline()
         self.check_input_tty("prompté", b"quux\xe9", "ascii")
 
     def test_input_no_stdout_fileno(self):
diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py
index 05568f2..13ad238 100644
--- a/Lib/test/test_bytes.py
+++ b/Lib/test/test_bytes.py
@@ -16,6 +16,8 @@
 import unittest
 
 import test.support
+from test.support import import_helper
+from test.support import warnings_helper
 import test.string_tests
 import test.list_tests
 from test.support import bigaddrspacetest, MAX_Py_ssize_t
@@ -26,7 +28,7 @@
     def check_bytes_warnings(func):
         @functools.wraps(func)
         def wrapper(*args, **kw):
-            with test.support.check_warnings(('', BytesWarning)):
+            with warnings_helper.check_warnings(('', BytesWarning)):
                 return func(*args, **kw)
         return wrapper
 else:
@@ -967,7 +969,7 @@
         self.assertEqual(c, b'hllo')
 
     def test_sq_item(self):
-        _testcapi = test.support.import_module('_testcapi')
+        _testcapi = import_helper.import_module('_testcapi')
         obj = self.type2test((42,))
         with self.assertRaises(IndexError):
             _testcapi.sequence_getitem(obj, -2)
@@ -1024,8 +1026,8 @@
 
     # Test PyBytes_FromFormat()
     def test_from_format(self):
-        ctypes = test.support.import_module('ctypes')
-        _testcapi = test.support.import_module('_testcapi')
+        ctypes = import_helper.import_module('ctypes')
+        _testcapi = import_helper.import_module('_testcapi')
         from ctypes import pythonapi, py_object
         from ctypes import (
             c_int, c_uint,
@@ -1167,6 +1169,28 @@
         self.assertEqual(bytes(ba), b'ab')
         self.assertRaises(TypeError, bytes, bb)
 
+    def test_repeat_id_preserving(self):
+        a = b'123abc1@'
+        b = b'456zyx-+'
+        self.assertEqual(id(a), id(a))
+        self.assertNotEqual(id(a), id(b))
+        self.assertNotEqual(id(a), id(a * -4))
+        self.assertNotEqual(id(a), id(a * 0))
+        self.assertEqual(id(a), id(a * 1))
+        self.assertEqual(id(a), id(1 * a))
+        self.assertNotEqual(id(a), id(a * 2))
+
+        class SubBytes(bytes):
+            pass
+
+        s = SubBytes(b'qwerty()')
+        self.assertEqual(id(s), id(s))
+        self.assertNotEqual(id(s), id(s * -4))
+        self.assertNotEqual(id(s), id(s * 0))
+        self.assertNotEqual(id(s), id(s * 1))
+        self.assertNotEqual(id(s), id(1 * s))
+        self.assertNotEqual(id(s), id(s * 2))
+
 
 class ByteArrayTest(BaseBytesTest, unittest.TestCase):
     type2test = bytearray
@@ -1664,6 +1688,16 @@
         # Shouldn't raise an error
         self.assertEqual(list(it), [])
 
+    def test_repeat_after_setslice(self):
+        # bpo-42924: * used to copy from the wrong memory location
+        b = bytearray(b'abc')
+        b[:2] = b'x'
+        b1 = b * 1
+        b3 = b * 3
+        self.assertEqual(b1, b'xc')
+        self.assertEqual(b1, b)
+        self.assertEqual(b3, b'xcxcxc')
+
 
 class AssortedBytesTest(unittest.TestCase):
     #
@@ -1769,7 +1803,7 @@
                          "BytesWarning is needed for this test: use -bb option")
     def test_compare(self):
         def bytes_warning():
-            return test.support.check_warnings(('', BytesWarning))
+            return warnings_helper.check_warnings(('', BytesWarning))
         with bytes_warning():
             b'' == ''
         with bytes_warning():
diff --git a/Lib/test/test_bz2.py b/Lib/test/test_bz2.py
index 1fce9d8..9965c1f 100644
--- a/Lib/test/test_bz2.py
+++ b/Lib/test/test_bz2.py
@@ -1,6 +1,7 @@
 from test import support
 from test.support import bigmemtest, _4G
 
+import array
 import unittest
 from io import BytesIO, DEFAULT_BUFFER_SIZE
 import os
@@ -12,13 +13,15 @@
 import shutil
 import subprocess
 import threading
-from test.support import unlink
+from test.support import import_helper
+from test.support import threading_helper
+from test.support.os_helper import unlink
 import _compression
 import sys
 
 
 # Skip tests if the bz2 module doesn't exist.
-bz2 = support.import_module('bz2')
+bz2 = import_helper.import_module('bz2')
 from bz2 import BZ2File, BZ2Compressor, BZ2Decompressor
 
 has_cmdline_bunzip2 = None
@@ -502,7 +505,7 @@
                 for i in range(5):
                     f.write(data)
             threads = [threading.Thread(target=comp) for i in range(nthreads)]
-            with support.start_threads(threads):
+            with threading_helper.start_threads(threads):
                 pass
 
     def testMixedIterationAndReads(self):
@@ -618,6 +621,14 @@
             with BZ2File(BytesIO(truncated[:i])) as f:
                 self.assertRaises(EOFError, f.read, 1)
 
+    def test_issue44439(self):
+        q = array.array('Q', [1, 2, 3, 4, 5])
+        LENGTH = len(q) * q.itemsize
+
+        with BZ2File(BytesIO(), 'w') as f:
+            self.assertEqual(f.write(q), LENGTH)
+            self.assertEqual(f.tell(), LENGTH)
+
 
 class BZ2CompressorTest(BaseTest):
     def testCompress(self):
@@ -920,14 +931,14 @@
         for mode in ("wt", "xt"):
             if mode == "xt":
                 unlink(self.filename)
-            with self.open(self.filename, mode) as f:
+            with self.open(self.filename, mode, encoding="ascii") as f:
                 f.write(text)
             with open(self.filename, "rb") as f:
                 file_data = ext_decompress(f.read()).decode("ascii")
                 self.assertEqual(file_data, text_native_eol)
-            with self.open(self.filename, "rt") as f:
+            with self.open(self.filename, "rt", encoding="ascii") as f:
                 self.assertEqual(f.read(), text)
-            with self.open(self.filename, "at") as f:
+            with self.open(self.filename, "at", encoding="ascii") as f:
                 f.write(text)
             with open(self.filename, "rb") as f:
                 file_data = ext_decompress(f.read()).decode("ascii")
@@ -936,7 +947,8 @@
     def test_x_mode(self):
         for mode in ("x", "xb", "xt"):
             unlink(self.filename)
-            with self.open(self.filename, mode) as f:
+            encoding = "utf-8" if "t" in mode else None
+            with self.open(self.filename, mode, encoding=encoding) as f:
                 pass
             with self.assertRaises(FileExistsError):
                 with self.open(self.filename, mode) as f:
@@ -948,7 +960,7 @@
         with self.open(BytesIO(self.DATA), "rb") as f:
             self.assertEqual(f.read(), self.TEXT)
         text = self.TEXT.decode("ascii")
-        with self.open(BytesIO(self.DATA), "rt") as f:
+        with self.open(BytesIO(self.DATA), "rt", encoding="utf-8") as f:
             self.assertEqual(f.read(), text)
 
     def test_bad_params(self):
@@ -987,21 +999,15 @@
     def test_newline(self):
         # Test with explicit newline (universal newline mode disabled).
         text = self.TEXT.decode("ascii")
-        with self.open(self.filename, "wt", newline="\n") as f:
+        with self.open(self.filename, "wt", encoding="utf-8", newline="\n") as f:
             f.write(text)
-        with self.open(self.filename, "rt", newline="\r") as f:
+        with self.open(self.filename, "rt", encoding="utf-8", newline="\r") as f:
             self.assertEqual(f.readlines(), [text])
 
 
-def test_main():
-    support.run_unittest(
-        BZ2FileTest,
-        BZ2CompressorTest,
-        BZ2DecompressorTest,
-        CompressDecompressTest,
-        OpenTest,
-    )
+def tearDownModule():
     support.reap_children()
 
+
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_c_locale_coercion.py b/Lib/test/test_c_locale_coercion.py
index fcc8599..71f9347 100644
--- a/Lib/test/test_c_locale_coercion.py
+++ b/Lib/test/test_c_locale_coercion.py
@@ -427,12 +427,9 @@
         self.assertEqual(cmd.stdout.rstrip(), loc)
 
 
-def test_main():
-    support.run_unittest(
-        LocaleConfigurationTests,
-        LocaleCoercionTests
-    )
+def tearDownModule():
     support.reap_children()
 
+
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_calendar.py b/Lib/test/test_calendar.py
index 6241d11..39094ad 100644
--- a/Lib/test/test_calendar.py
+++ b/Lib/test/test_calendar.py
@@ -564,6 +564,30 @@
         new_october = calendar.TextCalendar().formatmonthname(2010, 10, 10)
         self.assertEqual(old_october, new_october)
 
+    def test_locale_html_calendar_custom_css_class_month_name(self):
+        try:
+            cal = calendar.LocaleHTMLCalendar(locale='')
+            local_month = cal.formatmonthname(2010, 10, 10)
+        except locale.Error:
+            # cannot set the system default locale -- skip rest of test
+            raise unittest.SkipTest('cannot set the system default locale')
+        self.assertIn('class="month"', local_month)
+        cal.cssclass_month_head = "text-center month"
+        local_month = cal.formatmonthname(2010, 10, 10)
+        self.assertIn('class="text-center month"', local_month)
+
+    def test_locale_html_calendar_custom_css_class_weekday(self):
+        try:
+            cal = calendar.LocaleHTMLCalendar(locale='')
+            local_weekday = cal.formatweekday(6)
+        except locale.Error:
+            # cannot set the system default locale -- skip rest of test
+            raise unittest.SkipTest('cannot set the system default locale')
+        self.assertIn('class="sun"', local_weekday)
+        cal.cssclasses_weekday_head = ["mon2", "tue2", "wed2", "thu2", "fri2", "sat2", "sun2"]
+        local_weekday = cal.formatweekday(6)
+        self.assertIn('class="sun2"', local_weekday)
+
     def test_itermonthdays3(self):
         # ensure itermonthdays3 doesn't overflow after datetime.MAXYEAR
         list(calendar.Calendar().itermonthdays3(datetime.MAXYEAR, 12))
@@ -910,12 +934,11 @@
 
 class MiscTestCase(unittest.TestCase):
     def test__all__(self):
-        blacklist = {'mdays', 'January', 'February', 'EPOCH',
-                     'MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY', 'FRIDAY',
-                     'SATURDAY', 'SUNDAY', 'different_locale', 'c',
-                     'prweek', 'week', 'format', 'formatstring', 'main',
-                     'monthlen', 'prevmonth', 'nextmonth'}
-        support.check__all__(self, calendar, blacklist=blacklist)
+        not_exported = {
+            'mdays', 'January', 'February', 'EPOCH',
+            'different_locale', 'c', 'prweek', 'week', 'format',
+            'formatstring', 'main', 'monthlen', 'prevmonth', 'nextmonth'}
+        support.check__all__(self, calendar, not_exported=not_exported)
 
 
 class TestSubClassingCase(unittest.TestCase):
diff --git a/Lib/test/test_call.py b/Lib/test/test_call.py
index 451a717..3f45922 100644
--- a/Lib/test/test_call.py
+++ b/Lib/test/test_call.py
@@ -8,6 +8,7 @@
 import collections
 import itertools
 import gc
+import contextlib
 
 
 class FunctionCalls(unittest.TestCase):
@@ -665,5 +666,52 @@
                 self.assertEqual(expected, wrapped(*args, **kwargs))
 
 
+class A:
+    def method_two_args(self, x, y):
+        pass
+
+    @staticmethod
+    def static_no_args():
+        pass
+
+    @staticmethod
+    def positional_only(arg, /):
+        pass
+
+@cpython_only
+class TestErrorMessagesUseQualifiedName(unittest.TestCase):
+
+    @contextlib.contextmanager
+    def check_raises_type_error(self, message):
+        with self.assertRaises(TypeError) as cm:
+            yield
+        self.assertEqual(str(cm.exception), message)
+
+    def test_missing_arguments(self):
+        msg = "A.method_two_args() missing 1 required positional argument: 'y'"
+        with self.check_raises_type_error(msg):
+            A().method_two_args("x")
+
+    def test_too_many_positional(self):
+        msg = "A.static_no_args() takes 0 positional arguments but 1 was given"
+        with self.check_raises_type_error(msg):
+            A.static_no_args("oops it's an arg")
+
+    def test_positional_only_passed_as_keyword(self):
+        msg = "A.positional_only() got some positional-only arguments passed as keyword arguments: 'arg'"
+        with self.check_raises_type_error(msg):
+            A.positional_only(arg="x")
+
+    def test_unexpected_keyword(self):
+        msg = "A.method_two_args() got an unexpected keyword argument 'bad'"
+        with self.check_raises_type_error(msg):
+            A().method_two_args(bad="x")
+
+    def test_multiple_values(self):
+        msg = "A.method_two_args() got multiple values for argument 'x'"
+        with self.check_raises_type_error(msg):
+            A().method_two_args("x", "y", x="oops")
+
+
 if __name__ == "__main__":
     unittest.main()
diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py
index 5150d57..7b208c9 100644
--- a/Lib/test/test_capi.py
+++ b/Lib/test/test_capi.py
@@ -2,6 +2,8 @@
 # these are all functions _testcapi exports whose name begins with 'test_'.
 
 from collections import OrderedDict
+import importlib.machinery
+import importlib.util
 import os
 import pickle
 import random
@@ -13,10 +15,11 @@
 import time
 import unittest
 import weakref
-import importlib.machinery
-import importlib.util
 from test import support
 from test.support import MISSING_C_DOCSTRINGS
+from test.support import import_helper
+from test.support import threading_helper
+from test.support import warnings_helper
 from test.support.script_helper import assert_python_failure, assert_python_ok
 try:
     import _posixsubprocess
@@ -24,7 +27,7 @@
     _posixsubprocess = None
 
 # Skip this test if the _testcapi module isn't available.
-_testcapi = support.import_module('_testcapi')
+_testcapi = import_helper.import_module('_testcapi')
 
 import _testinternalcapi
 
@@ -32,6 +35,10 @@
 Py_DEBUG = hasattr(sys, 'gettotalrefcount')
 
 
+def decode_stderr(err):
+    return err.decode('utf-8', 'replace').replace('\r', '')
+
+
 def testfunction(self):
     """some doc"""
     return self
@@ -204,23 +211,22 @@
                     _testcapi.return_null_without_error()
             """)
             rc, out, err = assert_python_failure('-c', code)
-            self.assertRegex(err.replace(b'\r', b''),
-                             br'Fatal Python error: _Py_CheckFunctionResult: '
-                                br'a function returned NULL '
-                                br'without setting an error\n'
-                             br'Python runtime state: initialized\n'
-                             br'SystemError: <built-in function '
-                                 br'return_null_without_error> returned NULL '
-                                 br'without setting an error\n'
-                             br'\n'
-                             br'Current thread.*:\n'
-                             br'  File .*", line 6 in <module>')
+            err = decode_stderr(err)
+            self.assertRegex(err,
+                r'Fatal Python error: _Py_CheckFunctionResult: '
+                    r'a function returned NULL without setting an exception\n'
+                r'Python runtime state: initialized\n'
+                r'SystemError: <built-in function return_null_without_error> '
+                    r'returned NULL without setting an exception\n'
+                r'\n'
+                r'Current thread.*:\n'
+                r'  File .*", line 6 in <module>\n')
         else:
             with self.assertRaises(SystemError) as cm:
                 _testcapi.return_null_without_error()
             self.assertRegex(str(cm.exception),
                              'return_null_without_error.* '
-                             'returned NULL without setting an error')
+                             'returned NULL without setting an exception')
 
     def test_return_result_with_error(self):
         # Issue #23571: A function must not return a result with an error set
@@ -233,28 +239,58 @@
                     _testcapi.return_result_with_error()
             """)
             rc, out, err = assert_python_failure('-c', code)
-            self.assertRegex(err.replace(b'\r', b''),
-                             br'Fatal Python error: _Py_CheckFunctionResult: '
-                                 br'a function returned a result '
-                                 br'with an error set\n'
-                             br'Python runtime state: initialized\n'
-                             br'ValueError\n'
-                             br'\n'
-                             br'The above exception was the direct cause '
-                                br'of the following exception:\n'
-                             br'\n'
-                             br'SystemError: <built-in '
-                                br'function return_result_with_error> '
-                                br'returned a result with an error set\n'
-                             br'\n'
-                             br'Current thread.*:\n'
-                             br'  File .*, line 6 in <module>')
+            err = decode_stderr(err)
+            self.assertRegex(err,
+                    r'Fatal Python error: _Py_CheckFunctionResult: '
+                        r'a function returned a result with an exception set\n'
+                    r'Python runtime state: initialized\n'
+                    r'ValueError\n'
+                    r'\n'
+                    r'The above exception was the direct cause '
+                        r'of the following exception:\n'
+                    r'\n'
+                    r'SystemError: <built-in '
+                        r'function return_result_with_error> '
+                        r'returned a result with an exception set\n'
+                    r'\n'
+                    r'Current thread.*:\n'
+                    r'  File .*, line 6 in <module>\n')
         else:
             with self.assertRaises(SystemError) as cm:
                 _testcapi.return_result_with_error()
             self.assertRegex(str(cm.exception),
                              'return_result_with_error.* '
-                             'returned a result with an error set')
+                             'returned a result with an exception set')
+
+    def test_getitem_with_error(self):
+        # Test _Py_CheckSlotResult(). Raise an exception and then calls
+        # PyObject_GetItem(): check that the assertion catches the bug.
+        # PyObject_GetItem() must not be called with an exception set.
+        code = textwrap.dedent("""
+            import _testcapi
+            from test import support
+
+            with support.SuppressCrashReport():
+                _testcapi.getitem_with_error({1: 2}, 1)
+        """)
+        rc, out, err = assert_python_failure('-c', code)
+        err = decode_stderr(err)
+        if 'SystemError: ' not in err:
+            self.assertRegex(err,
+                    r'Fatal Python error: _Py_CheckSlotResult: '
+                        r'Slot __getitem__ of type dict succeeded '
+                        r'with an exception set\n'
+                    r'Python runtime state: initialized\n'
+                    r'ValueError: bug\n'
+                    r'\n'
+                    r'Current thread .* \(most recent call first\):\n'
+                    r'  File .*, line 6 in <module>\n'
+                    r'\n'
+                    r'Extension modules: _testcapi \(total: 1\)\n')
+        else:
+            # Python built with NDEBUG macro defined:
+            # test _Py_CheckFunctionResult() instead.
+            self.assertIn('returned a result with an exception set', err)
 
     def test_buildvalue_N(self):
         _testcapi.test_buildvalue_N()
@@ -398,6 +434,13 @@
             del L
             self.assertEqual(PyList.num, 0)
 
+    def test_heap_ctype_doc_and_text_signature(self):
+        self.assertEqual(_testcapi.HeapDocCType.__doc__, "somedoc")
+        self.assertEqual(_testcapi.HeapDocCType.__text_signature__, "(arg1, arg2)")
+
+    def test_null_type_doc(self):
+        self.assertEqual(_testcapi.NullTpDocType.__doc__, None)
+
     def test_subclass_of_heap_gc_ctype_with_tpdealloc_decrefs_once(self):
         class HeapGcCTypeSubclass(_testcapi.HeapGcCType):
             def __init__(self):
@@ -537,6 +580,65 @@
         self.assertRaises(TypeError, pynumber_tobase, '123', 10)
         self.assertRaises(SystemError, pynumber_tobase, 123, 0)
 
+    def check_fatal_error(self, code, expected, not_expected=()):
+        with support.SuppressCrashReport():
+            rc, out, err = assert_python_failure('-sSI', '-c', code)
+
+        err = decode_stderr(err)
+        self.assertIn('Fatal Python error: test_fatal_error: MESSAGE\n',
+                      err)
+
+        match = re.search(r'^Extension modules:(.*) \(total: ([0-9]+)\)$',
+                          err, re.MULTILINE)
+        if not match:
+            self.fail(f"Cannot find 'Extension modules:' in {err!r}")
+        modules = set(match.group(1).strip().split(', '))
+        total = int(match.group(2))
+
+        for name in expected:
+            self.assertIn(name, modules)
+        for name in not_expected:
+            self.assertNotIn(name, modules)
+        self.assertEqual(len(modules), total)
+
+    def test_fatal_error(self):
+        # By default, stdlib extension modules are ignored,
+        # but not test modules.
+        expected = ('_testcapi',)
+        not_expected = ('sys',)
+        code = 'import _testcapi, sys; _testcapi.fatal_error(b"MESSAGE")'
+        self.check_fatal_error(code, expected, not_expected)
+
+        # Mark _testcapi as stdlib module, but not sys
+        expected = ('sys',)
+        not_expected = ('_testcapi',)
+        code = textwrap.dedent('''
+            import _testcapi, sys
+            sys.stdlib_module_names = frozenset({"_testcapi"})
+            _testcapi.fatal_error(b"MESSAGE")
+        ''')
+        self.check_fatal_error(code, expected)
+
+    def test_pyobject_repr_from_null(self):
+        s = _testcapi.pyobject_repr_from_null()
+        self.assertEqual(s, '<NULL>')
+
+    def test_pyobject_str_from_null(self):
+        s = _testcapi.pyobject_str_from_null()
+        self.assertEqual(s, '<NULL>')
+
+    def test_pyobject_bytes_from_null(self):
+        s = _testcapi.pyobject_bytes_from_null()
+        self.assertEqual(s, b'<NULL>')
+
+    def test_Py_CompileString(self):
+        # Check that Py_CompileString respects the coding cookie
+        _compile = _testcapi.Py_CompileString
+        code = b"# -*- coding: latin1 -*-\nprint('\xc2\xa4')\n"
+        result = _compile(code)
+        expected = compile(code, "<string>", "exec")
+        self.assertEqual(result.co_consts, expected.co_consts)
+
 
 class TestPendingCalls(unittest.TestCase):
 
@@ -553,11 +655,11 @@
             #unsuccessful.
             while True:
                 if _testcapi._pending_threadfunc(callback):
-                    break;
+                    break
 
     def pendingcalls_wait(self, l, n, context = None):
         #now, stick around until l[0] has grown to 10
-        count = 0;
+        count = 0
         while len(l) != n:
             #this busy loop is where we expect to be interrupted to
             #run our callbacks.  Note that callbacks are only run on the
@@ -591,7 +693,7 @@
         threads = [threading.Thread(target=self.pendingcalls_thread,
                                     args=(context,))
                    for i in range(context.nThreads)]
-        with support.start_threads(threads):
+        with threading_helper.start_threads(threads):
             self.pendingcalls_wait(context.l, n, context)
 
     def pendingcalls_thread(self, context):
@@ -668,10 +770,41 @@
 
         self.assertFalse(hasattr(binascii.Error, "foobar"))
 
+    def test_module_state_shared_in_global(self):
+        """
+        bpo-44050: Extension module state should be shared between interpreters
+        when it doesn't support sub-interpreters.
+        """
+        r, w = os.pipe()
+        self.addCleanup(os.close, r)
+        self.addCleanup(os.close, w)
+
+        script = textwrap.dedent(f"""
+            import importlib.machinery
+            import importlib.util
+            import os
+
+            fullname = '_test_module_state_shared'
+            origin = importlib.util.find_spec('_testmultiphase').origin
+            loader = importlib.machinery.ExtensionFileLoader(fullname, origin)
+            spec = importlib.util.spec_from_loader(fullname, loader)
+            module = importlib.util.module_from_spec(spec)
+            attr_id = str(id(module.Error)).encode()
+
+            os.write({w}, attr_id)
+            """)
+        exec(script)
+        main_attr_id = os.read(r, 100)
+
+        ret = support.run_in_subinterp(script)
+        self.assertEqual(ret, 0)
+        subinterp_attr_id = os.read(r, 100)
+        self.assertEqual(main_attr_id, subinterp_attr_id)
+
 
 class TestThreadState(unittest.TestCase):
 
-    @support.reap_threads
+    @threading_helper.reap_threads
     def test_thread_state(self):
         # some extra thread-state tests driven via _testcapi
         def target():
@@ -698,6 +831,11 @@
                     for name in dir(_testcapi)
                     if name.startswith('test_') and not name.endswith('_code'))
 
+    # Suppress warning from PyUnicode_FromUnicode().
+    @warnings_helper.ignore_warnings(category=DeprecationWarning)
+    def test_widechar(self):
+        _testcapi.test_widechar()
+
 
 class Test_testinternalcapi(unittest.TestCase):
     locals().update((name, getattr(_testinternalcapi, name))
@@ -712,8 +850,13 @@
 
     def check(self, code):
         with support.SuppressCrashReport():
-            out = assert_python_failure('-c', code,
-                                        PYTHONMALLOC=self.PYTHONMALLOC)
+            out = assert_python_failure(
+                '-c', code,
+                PYTHONMALLOC=self.PYTHONMALLOC,
+                # FreeBSD: instruct jemalloc to not fill freed() memory
+                # with junk byte 0x5a, see JEMALLOC(3)
+                MALLOC_CONF="junk:false",
+            )
         stderr = out.err
         return stderr.decode('ascii', 'replace')
 
@@ -783,7 +926,11 @@
             except _testcapi.error:
                 os._exit(1)
         ''')
-        assert_python_ok('-c', code, PYTHONMALLOC=self.PYTHONMALLOC)
+        assert_python_ok(
+            '-c', code,
+            PYTHONMALLOC=self.PYTHONMALLOC,
+            MALLOC_CONF="junk:false",
+        )
 
     def test_pyobject_null_is_freed(self):
         self.check_pyobject_is_freed('check_pyobject_null_is_freed')
@@ -883,6 +1030,22 @@
                 with self.assertRaises(TypeError):
                     increment_count(1, 2, 3)
 
+    def test_get_module_bad_def(self):
+        # _PyType_GetModuleByDef fails gracefully if it doesn't
+        # find what it's looking for.
+        # see bpo-46433
+        instance = self.module.StateAccessType()
+        with self.assertRaises(TypeError):
+            instance.getmodulebydef_bad_def()
+
+    def test_get_module_static_in_mro(self):
+        # Here, the class _PyType_GetModuleByDef is looking for
+        # appears in the MRO after a static type (Exception).
+        # see bpo-46433
+        class Subclass(BaseException, self.module.StateAccessType):
+            pass
+        self.assertIs(Subclass().get_defining_module(), self.module)
+
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/Lib/test/test_cgi.py b/Lib/test/test_cgi.py
index 101942d..c1b893d 100644
--- a/Lib/test/test_cgi.py
+++ b/Lib/test/test_cgi.py
@@ -6,6 +6,7 @@
 from collections import namedtuple
 from io import StringIO, BytesIO
 from test import support
+from test.support import warnings_helper
 
 class HackedSysModule:
     # The regression test will have real values in sys.argv, which
@@ -53,12 +54,9 @@
     ("", ValueError("bad query field: ''")),
     ("&", ValueError("bad query field: ''")),
     ("&&", ValueError("bad query field: ''")),
-    (";", ValueError("bad query field: ''")),
-    (";&;", ValueError("bad query field: ''")),
     # Should the next few really be valid?
     ("=", {}),
     ("=&=", {}),
-    ("=;=", {}),
     # This rest seem to make sense
     ("=a", {'': ['a']}),
     ("&=a", ValueError("bad query field: ''")),
@@ -73,8 +71,6 @@
     ("a=a+b&b=b+c", {'a': ['a b'], 'b': ['b c']}),
     ("a=a+b&a=b+a", {'a': ['a b', 'b a']}),
     ("x=1&y=2.0&z=2-3.%2b0", {'x': ['1'], 'y': ['2.0'], 'z': ['2-3.+0']}),
-    ("x=1;y=2.0&z=2-3.%2b0", {'x': ['1'], 'y': ['2.0'], 'z': ['2-3.+0']}),
-    ("x=1;y=2.0;z=2-3.%2b0", {'x': ['1'], 'y': ['2.0'], 'z': ['2-3.+0']}),
     ("Hbc5161168c542333633315dee1182227:key_store_seqid=400006&cuyer=r&view=bustomer&order_id=0bb2e248638833d48cb7fed300000f1b&expire=964546263&lobale=en-US&kid=130003.300038&ss=env",
      {'Hbc5161168c542333633315dee1182227:key_store_seqid': ['400006'],
       'cuyer': ['r'],
@@ -201,6 +197,31 @@
                     else:
                         self.assertEqual(fs.getvalue(key), expect_val[0])
 
+    def test_separator(self):
+        parse_semicolon = [
+            ("x=1;y=2.0", {'x': ['1'], 'y': ['2.0']}),
+            ("x=1;y=2.0;z=2-3.%2b0", {'x': ['1'], 'y': ['2.0'], 'z': ['2-3.+0']}),
+            (";", ValueError("bad query field: ''")),
+            (";;", ValueError("bad query field: ''")),
+            ("=;a", ValueError("bad query field: 'a'")),
+            (";b=a", ValueError("bad query field: ''")),
+            ("b;=a", ValueError("bad query field: 'b'")),
+            ("a=a+b;b=b+c", {'a': ['a b'], 'b': ['b c']}),
+            ("a=a+b;a=b+a", {'a': ['a b', 'b a']}),
+        ]
+        for orig, expect in parse_semicolon:
+            env = {'QUERY_STRING': orig}
+            fs = cgi.FieldStorage(separator=';', environ=env)
+            if isinstance(expect, dict):
+                for key in expect.keys():
+                    expect_val = expect[key]
+                    self.assertIn(key, fs)
+                    if len(expect_val) > 1:
+                        self.assertEqual(fs.getvalue(key), expect_val)
+                    else:
+                        self.assertEqual(fs.getvalue(key), expect_val[0])
+
+    @warnings_helper.ignore_warnings(category=DeprecationWarning)
     def test_log(self):
         cgi.log("Testing")
 
@@ -553,9 +574,10 @@
             ("form-data", {"name": "files", "filename": 'fo"o;bar'}))
 
     def test_all(self):
-        blacklist = {"logfile", "logfp", "initlog", "dolog", "nolog",
-                     "closelog", "log", "maxlen", "valid_boundary"}
-        support.check__all__(self, cgi, blacklist=blacklist)
+        not_exported = {
+            "logfile", "logfp", "initlog", "dolog", "nolog", "closelog", "log",
+            "maxlen", "valid_boundary"}
+        support.check__all__(self, cgi, not_exported=not_exported)
 
 
 BOUNDARY = "---------------------------721837373350705526688164684"
diff --git a/Lib/test/test_cgitb.py b/Lib/test/test_cgitb.py
index bab152d..590ffde 100644
--- a/Lib/test/test_cgitb.py
+++ b/Lib/test/test_cgitb.py
@@ -1,4 +1,4 @@
-from test.support import temp_dir
+from test.support.os_helper import temp_dir
 from test.support.script_helper import assert_python_failure
 import unittest
 import sys
diff --git a/Lib/test/test_charmapcodec.py b/Lib/test/test_charmapcodec.py
index 0d4594d..3f62890 100644
--- a/Lib/test/test_charmapcodec.py
+++ b/Lib/test/test_charmapcodec.py
@@ -20,12 +20,15 @@
         return tuple(testcodec.getregentry())
     return None
 
-codecs.register(codec_search_function)
-
 # test codec's name (see test/testcodec.py)
 codecname = 'testcodec'
 
 class CharmapCodecTest(unittest.TestCase):
+
+    def setUp(self):
+        codecs.register(codec_search_function)
+        self.addCleanup(codecs.unregister, codec_search_function)
+
     def test_constructorx(self):
         self.assertEqual(str(b'abc', codecname), 'abc')
         self.assertEqual(str(b'xdef', codecname), 'abcdef')
diff --git a/Lib/test/test_clinic.py b/Lib/test/test_clinic.py
index 9989b14..4aa9691 100644
--- a/Lib/test/test_clinic.py
+++ b/Lib/test/test_clinic.py
@@ -3,6 +3,7 @@
 # Licensed to the PSF under a contributor agreement.
 
 from test import support, test_tools
+from test.support import os_helper
 from unittest import TestCase
 import collections
 import inspect
@@ -801,7 +802,7 @@
         with open(source, 'r', encoding='utf-8') as f:
             orig_contents = f.read()
 
-        with support.temp_dir() as tmp_dir:
+        with os_helper.temp_dir() as tmp_dir:
             testfile = os.path.join(tmp_dir, 'clinic.test.c')
             with open(testfile, 'w', encoding='utf-8') as f:
                 f.write(orig_contents)
diff --git a/Lib/test/test_cmath.py b/Lib/test/test_cmath.py
index 668f27c..9bb9393 100644
--- a/Lib/test/test_cmath.py
+++ b/Lib/test/test_cmath.py
@@ -60,7 +60,7 @@
     test_functions.append(lambda x : cmath.log(14.-27j, x))
 
     def setUp(self):
-        self.test_values = open(test_file)
+        self.test_values = open(test_file, encoding="utf-8")
 
     def tearDown(self):
         self.test_values.close()
diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py
index 051c092..d93e98f 100644
--- a/Lib/test/test_cmd_line.py
+++ b/Lib/test/test_cmd_line.py
@@ -9,6 +9,7 @@
 import textwrap
 import unittest
 from test import support
+from test.support import os_helper
 from test.support.script_helper import (
     spawn_python, kill_python, assert_python_ok, assert_python_failure,
     interpreter_requires_environment
@@ -145,13 +146,21 @@
         # All good if execution is successful
         assert_python_ok('-c', 'pass')
 
-    @unittest.skipUnless(support.FS_NONASCII, 'need support.FS_NONASCII')
+    @unittest.skipUnless(os_helper.FS_NONASCII, 'need os_helper.FS_NONASCII')
     def test_non_ascii(self):
         # Test handling of non-ascii data
         command = ("assert(ord(%r) == %s)"
-                   % (support.FS_NONASCII, ord(support.FS_NONASCII)))
+                   % (os_helper.FS_NONASCII, ord(os_helper.FS_NONASCII)))
         assert_python_ok('-c', command)
 
+    @unittest.skipUnless(os_helper.FS_NONASCII, 'need os_helper.FS_NONASCII')
+    def test_coding(self):
+        # bpo-32381: the -c command ignores the coding cookie
+        ch = os_helper.FS_NONASCII
+        cmd = f"# coding: latin1\nprint(ascii('{ch}'))"
+        res = assert_python_ok('-c', cmd)
+        self.assertEqual(res.out.rstrip(), ascii(ch).encode('ascii'))
+
     # On Windows, pass bytes to subprocess doesn't test how Python decodes the
     # command line, but how subprocess does decode bytes to unicode. Python
     # doesn't decode the command line because Windows provides directly the
@@ -191,38 +200,72 @@
         if not stdout.startswith(pattern):
             raise AssertionError("%a doesn't start with %a" % (stdout, pattern))
 
+    @unittest.skipIf(sys.platform == 'win32',
+                     'Windows has a native unicode API')
+    def test_invalid_utf8_arg(self):
+        # bpo-35883: Py_DecodeLocale() must escape b'\xfd\xbf\xbf\xbb\xba\xba'
+        # byte sequence with surrogateescape rather than decoding it as the
+        # U+7fffbeba character which is outside the [U+0000; U+10ffff] range of
+        # Python Unicode characters.
+        #
+        # Test with default config, in the C locale, in the Python UTF-8 Mode.
+        code = 'import sys, os; s=os.fsencode(sys.argv[1]); print(ascii(s))'
+        base_cmd = [sys.executable, '-c', code]
+
+        def run_default(arg):
+            cmd = [sys.executable, '-c', code, arg]
+            return subprocess.run(cmd, stdout=subprocess.PIPE, text=True)
+
+        def run_c_locale(arg):
+            cmd = [sys.executable, '-c', code, arg]
+            env = dict(os.environ)
+            env['LC_ALL'] = 'C'
+            return subprocess.run(cmd, stdout=subprocess.PIPE,
+                                  text=True, env=env)
+
+        def run_utf8_mode(arg):
+            cmd = [sys.executable, '-X', 'utf8', '-c', code, arg]
+            return subprocess.run(cmd, stdout=subprocess.PIPE, text=True)
+
+        valid_utf8 = 'e:\xe9, euro:\u20ac, non-bmp:\U0010ffff'.encode('utf-8')
+        # invalid UTF-8 byte sequences with a valid UTF-8 sequence
+        # in the middle.
+        invalid_utf8 = (
+            b'\xff'                      # invalid byte
+            b'\xc3\xff'                  # invalid byte sequence
+            b'\xc3\xa9'                  # valid utf-8: U+00E9 character
+            b'\xed\xa0\x80'              # lone surrogate character (invalid)
+            b'\xfd\xbf\xbf\xbb\xba\xba'  # character outside [U+0000; U+10ffff]
+        )
+        test_args = [valid_utf8, invalid_utf8]
+
+        for run_cmd in (run_default, run_c_locale, run_utf8_mode):
+            with self.subTest(run_cmd=run_cmd):
+                for arg in test_args:
+                    proc = run_cmd(arg)
+                    self.assertEqual(proc.stdout.rstrip(), ascii(arg))
+
     @unittest.skipUnless((sys.platform == 'darwin' or
                 support.is_android), 'test specific to Mac OS X and Android')
     def test_osx_android_utf8(self):
-        def check_output(text):
-            decoded = text.decode('utf-8', 'surrogateescape')
-            expected = ascii(decoded).encode('ascii') + b'\n'
-
-            env = os.environ.copy()
-            # C locale gives ASCII locale encoding, but Python uses UTF-8
-            # to parse the command line arguments on Mac OS X and Android.
-            env['LC_ALL'] = 'C'
-
-            p = subprocess.Popen(
-                (sys.executable, "-c", "import sys; print(ascii(sys.argv[1]))", text),
-                stdout=subprocess.PIPE,
-                env=env)
-            stdout, stderr = p.communicate()
-            self.assertEqual(stdout, expected)
-            self.assertEqual(p.returncode, 0)
-
-        # test valid utf-8
         text = 'e:\xe9, euro:\u20ac, non-bmp:\U0010ffff'.encode('utf-8')
-        check_output(text)
+        code = "import sys; print(ascii(sys.argv[1]))"
 
-        # test invalid utf-8
-        text = (
-            b'\xff'         # invalid byte
-            b'\xc3\xa9'     # valid utf-8 character
-            b'\xc3\xff'     # invalid byte sequence
-            b'\xed\xa0\x80' # lone surrogate character (invalid)
-        )
-        check_output(text)
+        decoded = text.decode('utf-8', 'surrogateescape')
+        expected = ascii(decoded).encode('ascii') + b'\n'
+
+        env = os.environ.copy()
+        # C locale gives ASCII locale encoding, but Python uses UTF-8
+        # to parse the command line arguments on Mac OS X and Android.
+        env['LC_ALL'] = 'C'
+
+        p = subprocess.Popen(
+            (sys.executable, "-c", code, text),
+            stdout=subprocess.PIPE,
+            env=env)
+        stdout, stderr = p.communicate()
+        self.assertEqual(stdout, expected)
+        self.assertEqual(p.returncode, 0)
 
     def test_non_interactive_output_buffering(self):
         code = textwrap.dedent("""
@@ -467,9 +510,9 @@
         # Issue #15001: PyRun_SimpleFileExFlags() did crash because it kept a
         # borrowed reference to the dict of __main__ module and later modify
         # the dict whereas the module was destroyed
-        filename = support.TESTFN
-        self.addCleanup(support.unlink, filename)
-        with open(filename, "w") as script:
+        filename = os_helper.TESTFN
+        self.addCleanup(os_helper.unlink, filename)
+        with open(filename, "w", encoding="utf-8") as script:
             print("import sys", file=script)
             print("del sys.modules['__main__']", file=script)
         assert_python_ok(filename)
@@ -503,12 +546,12 @@
             # dummyvar to prevent extraneous -E
             dummyvar="")
         self.assertEqual(out.strip(), b'1 1 1')
-        with support.temp_cwd() as tmpdir:
+        with os_helper.temp_cwd() as tmpdir:
             fake = os.path.join(tmpdir, "uuid.py")
             main = os.path.join(tmpdir, "main.py")
-            with open(fake, "w") as f:
+            with open(fake, "w", encoding="utf-8") as f:
                 f.write("raise RuntimeError('isolated mode test')\n")
-            with open(main, "w") as f:
+            with open(main, "w", encoding="utf-8") as f:
                 f.write("import uuid\n")
                 f.write("print('ok')\n")
             self.assertRaises(subprocess.CalledProcessError,
@@ -565,7 +608,7 @@
             elif opt is not None:
                 args[:0] = ['-X', f'pycache_prefix={opt}']
             with self.subTest(envval=envval, opt=opt):
-                with support.temp_cwd():
+                with os_helper.temp_cwd():
                     assert_python_ok(*args, **env)
 
     def run_xdev(self, *args, check_exitcode=True, xdev=True):
@@ -648,7 +691,8 @@
 
     def check_warnings_filters(self, cmdline_option, envvar, use_pywarning=False):
         if use_pywarning:
-            code = ("import sys; from test.support import import_fresh_module; "
+            code = ("import sys; from test.support.import_helper import "
+                    "import_fresh_module; "
                     "warnings = import_fresh_module('warnings', blocked=['_warnings']); ")
         else:
             code = "import sys, warnings; "
@@ -806,10 +850,24 @@
             PYTHONVERBOSE="1",
         )
 
+class SyntaxErrorTests(unittest.TestCase):
+    def check_string(self, code):
+        proc = subprocess.run([sys.executable, "-"], input=code,
+                              stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+        self.assertNotEqual(proc.returncode, 0)
+        self.assertNotEqual(proc.stderr, None)
+        self.assertIn(b"\nSyntaxError", proc.stderr)
 
-def test_main():
-    support.run_unittest(CmdLineTest, IgnoreEnvironmentTest)
+    def test_tokenizer_error_with_stdin(self):
+        self.check_string(b"(1+2+3")
+
+    def test_decoding_error_at_the_end_of_the_line(self):
+        self.check_string(br"'\u1f'")
+
+
+def tearDownModule():
     support.reap_children()
 
+
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_cmd_line_script.py b/Lib/test/test_cmd_line_script.py
index 7a3707d..c93ed5b 100644
--- a/Lib/test/test_cmd_line_script.py
+++ b/Lib/test/test_cmd_line_script.py
@@ -14,6 +14,8 @@
 
 import textwrap
 from test import support
+from test.support import import_helper
+from test.support import os_helper
 from test.support.script_helper import (
     make_pkg, make_script, make_zip_pkg, make_zip_script,
     assert_python_ok, assert_python_failure, spawn_python, kill_python)
@@ -214,7 +216,7 @@
         self.check_repl_stderr_flush(True)
 
     def test_basic_script(self):
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             script_name = _make_test_script(script_dir, 'script')
             self._check_script(script_name, script_name, script_name,
                                script_dir, None,
@@ -224,7 +226,7 @@
     def test_script_abspath(self):
         # pass the script using the relative path, expect the absolute path
         # in __file__
-        with support.temp_cwd() as script_dir:
+        with os_helper.temp_cwd() as script_dir:
             self.assertTrue(os.path.isabs(script_dir), script_dir)
 
             script_name = _make_test_script(script_dir, 'script')
@@ -234,46 +236,46 @@
                                importlib.machinery.SourceFileLoader)
 
     def test_script_compiled(self):
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             script_name = _make_test_script(script_dir, 'script')
             py_compile.compile(script_name, doraise=True)
             os.remove(script_name)
-            pyc_file = support.make_legacy_pyc(script_name)
+            pyc_file = import_helper.make_legacy_pyc(script_name)
             self._check_script(pyc_file, pyc_file,
                                pyc_file, script_dir, None,
                                importlib.machinery.SourcelessFileLoader)
 
     def test_directory(self):
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             script_name = _make_test_script(script_dir, '__main__')
             self._check_script(script_dir, script_name, script_dir,
                                script_dir, '',
                                importlib.machinery.SourceFileLoader)
 
     def test_directory_compiled(self):
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             script_name = _make_test_script(script_dir, '__main__')
             py_compile.compile(script_name, doraise=True)
             os.remove(script_name)
-            pyc_file = support.make_legacy_pyc(script_name)
+            pyc_file = import_helper.make_legacy_pyc(script_name)
             self._check_script(script_dir, pyc_file, script_dir,
                                script_dir, '',
                                importlib.machinery.SourcelessFileLoader)
 
     def test_directory_error(self):
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             msg = "can't find '__main__' module in %r" % script_dir
             self._check_import_error(script_dir, msg)
 
     def test_zipfile(self):
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             script_name = _make_test_script(script_dir, '__main__')
             zip_name, run_name = make_zip_script(script_dir, 'test_zip', script_name)
             self._check_script(zip_name, run_name, zip_name, zip_name, '',
                                zipimport.zipimporter)
 
     def test_zipfile_compiled_timestamp(self):
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             script_name = _make_test_script(script_dir, '__main__')
             compiled_name = py_compile.compile(
                 script_name, doraise=True,
@@ -283,7 +285,7 @@
                                zipimport.zipimporter)
 
     def test_zipfile_compiled_checked_hash(self):
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             script_name = _make_test_script(script_dir, '__main__')
             compiled_name = py_compile.compile(
                 script_name, doraise=True,
@@ -293,7 +295,7 @@
                                zipimport.zipimporter)
 
     def test_zipfile_compiled_unchecked_hash(self):
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             script_name = _make_test_script(script_dir, '__main__')
             compiled_name = py_compile.compile(
                 script_name, doraise=True,
@@ -303,14 +305,14 @@
                                zipimport.zipimporter)
 
     def test_zipfile_error(self):
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             script_name = _make_test_script(script_dir, 'not_main')
             zip_name, run_name = make_zip_script(script_dir, 'test_zip', script_name)
             msg = "can't find '__main__' module in %r" % zip_name
             self._check_import_error(zip_name, msg)
 
     def test_module_in_package(self):
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             pkg_dir = os.path.join(script_dir, 'test_pkg')
             make_pkg(pkg_dir)
             script_name = _make_test_script(pkg_dir, 'script')
@@ -320,14 +322,14 @@
                                cwd=script_dir)
 
     def test_module_in_package_in_zipfile(self):
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             zip_name, run_name = _make_test_zip_pkg(script_dir, 'test_zip', 'test_pkg', 'script')
             self._check_script(["-m", "test_pkg.script"], run_name, run_name,
                                script_dir, 'test_pkg', zipimport.zipimporter,
                                PYTHONPATH=zip_name, cwd=script_dir)
 
     def test_module_in_subpackage_in_zipfile(self):
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             zip_name, run_name = _make_test_zip_pkg(script_dir, 'test_zip', 'test_pkg', 'script', depth=2)
             self._check_script(["-m", "test_pkg.test_pkg.script"], run_name, run_name,
                                script_dir, 'test_pkg.test_pkg',
@@ -335,7 +337,7 @@
                                PYTHONPATH=zip_name, cwd=script_dir)
 
     def test_package(self):
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             pkg_dir = os.path.join(script_dir, 'test_pkg')
             make_pkg(pkg_dir)
             script_name = _make_test_script(pkg_dir, '__main__')
@@ -345,20 +347,20 @@
                                cwd=script_dir)
 
     def test_package_compiled(self):
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             pkg_dir = os.path.join(script_dir, 'test_pkg')
             make_pkg(pkg_dir)
             script_name = _make_test_script(pkg_dir, '__main__')
             compiled_name = py_compile.compile(script_name, doraise=True)
             os.remove(script_name)
-            pyc_file = support.make_legacy_pyc(script_name)
+            pyc_file = import_helper.make_legacy_pyc(script_name)
             self._check_script(["-m", "test_pkg"], pyc_file,
                                pyc_file, script_dir, 'test_pkg',
                                importlib.machinery.SourcelessFileLoader,
                                cwd=script_dir)
 
     def test_package_error(self):
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             pkg_dir = os.path.join(script_dir, 'test_pkg')
             make_pkg(pkg_dir)
             msg = ("'test_pkg' is a package and cannot "
@@ -366,7 +368,7 @@
             self._check_import_error(["-m", "test_pkg"], msg, cwd=script_dir)
 
     def test_package_recursion(self):
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             pkg_dir = os.path.join(script_dir, 'test_pkg')
             make_pkg(pkg_dir)
             main_dir = os.path.join(pkg_dir, '__main__')
@@ -379,8 +381,8 @@
     def test_issue8202(self):
         # Make sure package __init__ modules see "-m" in sys.argv0 while
         # searching for the module to execute
-        with support.temp_dir() as script_dir:
-            with support.change_cwd(path=script_dir):
+        with os_helper.temp_dir() as script_dir:
+            with os_helper.change_cwd(path=script_dir):
                 pkg_dir = os.path.join(script_dir, 'test_pkg')
                 make_pkg(pkg_dir, "import sys; print('init_argv0==%r' % sys.argv[0])")
                 script_name = _make_test_script(pkg_dir, 'script')
@@ -396,9 +398,9 @@
     def test_issue8202_dash_c_file_ignored(self):
         # Make sure a "-c" file in the current directory
         # does not alter the value of sys.path[0]
-        with support.temp_dir() as script_dir:
-            with support.change_cwd(path=script_dir):
-                with open("-c", "w") as f:
+        with os_helper.temp_dir() as script_dir:
+            with os_helper.change_cwd(path=script_dir):
+                with open("-c", "w", encoding="utf-8") as f:
                     f.write("data")
                     rc, out, err = assert_python_ok('-c',
                         'import sys; print("sys.path[0]==%r" % sys.path[0])',
@@ -411,10 +413,10 @@
     def test_issue8202_dash_m_file_ignored(self):
         # Make sure a "-m" file in the current directory
         # does not alter the value of sys.path[0]
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             script_name = _make_test_script(script_dir, 'other')
-            with support.change_cwd(path=script_dir):
-                with open("-m", "w") as f:
+            with os_helper.change_cwd(path=script_dir):
+                with open("-m", "w", encoding="utf-8") as f:
                     f.write("data")
                     rc, out, err = assert_python_ok('-m', 'other', *example_args,
                                                     __isolated=False)
@@ -425,24 +427,24 @@
     def test_issue20884(self):
         # On Windows, script with encoding cookie and LF line ending
         # will be failed.
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             script_name = os.path.join(script_dir, "issue20884.py")
-            with open(script_name, "w", newline='\n') as f:
+            with open(script_name, "w", encoding="latin1", newline='\n') as f:
                 f.write("#coding: iso-8859-1\n")
                 f.write('"""\n')
                 for _ in range(30):
                     f.write('x'*80 + '\n')
                 f.write('"""\n')
 
-            with support.change_cwd(path=script_dir):
+            with os_helper.change_cwd(path=script_dir):
                 rc, out, err = assert_python_ok(script_name)
             self.assertEqual(b"", out)
             self.assertEqual(b"", err)
 
     @contextlib.contextmanager
     def setup_test_pkg(self, *args):
-        with support.temp_dir() as script_dir, \
-                support.change_cwd(path=script_dir):
+        with os_helper.temp_dir() as script_dir, \
+                os_helper.change_cwd(path=script_dir):
             pkg_dir = os.path.join(script_dir, 'test_pkg')
             make_pkg(pkg_dir, *args)
             yield pkg_dir
@@ -486,8 +488,8 @@
                 self.assertNotIn(b'Traceback', err)
 
     def test_dash_m_bad_pyc(self):
-        with support.temp_dir() as script_dir, \
-                support.change_cwd(path=script_dir):
+        with os_helper.temp_dir() as script_dir, \
+                os_helper.change_cwd(path=script_dir):
             os.mkdir('test_pkg')
             # Create invalid *.pyc as empty file
             with open('test_pkg/__init__.pyc', 'wb'):
@@ -500,8 +502,8 @@
             self.assertNotIn(b'Traceback', err)
 
     def test_hint_when_triying_to_import_a_py_file(self):
-        with support.temp_dir() as script_dir, \
-                support.change_cwd(path=script_dir):
+        with os_helper.temp_dir() as script_dir, \
+                os_helper.change_cwd(path=script_dir):
             # Create invalid *.pyc as empty file
             with open('asyncio.py', 'wb'):
                 pass
@@ -542,7 +544,7 @@
             except:
                 raise NameError from None
             """)
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             script_name = _make_test_script(script_dir, 'script', script)
             exitcode, stdout, stderr = assert_python_failure(script_name)
             text = stderr.decode('ascii').split('\n')
@@ -555,18 +557,18 @@
         # Mac OS X denies the creation of a file with an invalid UTF-8 name.
         # Windows allows creating a name with an arbitrary bytes name, but
         # Python cannot a undecodable bytes argument to a subprocess.
-        if (support.TESTFN_UNDECODABLE
+        if (os_helper.TESTFN_UNDECODABLE
         and sys.platform not in ('win32', 'darwin')):
-            name = os.fsdecode(support.TESTFN_UNDECODABLE)
-        elif support.TESTFN_NONASCII:
-            name = support.TESTFN_NONASCII
+            name = os.fsdecode(os_helper.TESTFN_UNDECODABLE)
+        elif os_helper.TESTFN_NONASCII:
+            name = os_helper.TESTFN_NONASCII
         else:
-            self.skipTest("need support.TESTFN_NONASCII")
+            self.skipTest("need os_helper.TESTFN_NONASCII")
 
         # Issue #16218
         source = 'print(ascii(__file__))\n'
         script_name = _make_test_script(os.getcwd(), name, source)
-        self.addCleanup(support.unlink, script_name)
+        self.addCleanup(os_helper.unlink, script_name)
         rc, stdout, stderr = assert_python_ok(script_name)
         self.assertEqual(
             ascii(script_name),
@@ -586,7 +588,7 @@
             if error:
                 sys.exit(error)
             """)
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             script_name = _make_test_script(script_dir, 'script', script)
             exitcode, stdout, stderr = assert_python_failure(script_name)
             text = stderr.decode('ascii')
@@ -594,24 +596,24 @@
 
     def test_syntaxerror_unindented_caret_position(self):
         script = "1 + 1 = 2\n"
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             script_name = _make_test_script(script_dir, 'script', script)
             exitcode, stdout, stderr = assert_python_failure(script_name)
             text = io.TextIOWrapper(io.BytesIO(stderr), 'ascii').read()
-            # Confirm that the caret is located under the first 1 character
-            self.assertIn("\n    1 + 1 = 2\n    ^", text)
+            # Confirm that the caret is located under the '=' sign
+            self.assertIn("\n    ^^^^^\n", text)
 
     def test_syntaxerror_indented_caret_position(self):
         script = textwrap.dedent("""\
             if True:
                 1 + 1 = 2
             """)
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             script_name = _make_test_script(script_dir, 'script', script)
             exitcode, stdout, stderr = assert_python_failure(script_name)
             text = io.TextIOWrapper(io.BytesIO(stderr), 'ascii').read()
-            # Confirm that the caret is located under the first 1 character
-            self.assertIn("\n    1 + 1 = 2\n    ^", text)
+            # Confirm that the caret starts under the first 1 character
+            self.assertIn("\n    1 + 1 = 2\n    ^^^^^\n", text)
 
             # Try the same with a form feed at the start of the indented line
             script = (
@@ -622,11 +624,11 @@
             exitcode, stdout, stderr = assert_python_failure(script_name)
             text = io.TextIOWrapper(io.BytesIO(stderr), "ascii").read()
             self.assertNotIn("\f", text)
-            self.assertIn("\n    1 + 1 = 2\n    ^", text)
+            self.assertIn("\n    1 + 1 = 2\n    ^^^^^\n", text)
 
     def test_syntaxerror_multi_line_fstring(self):
         script = 'foo = f"""{}\nfoo"""\n'
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             script_name = _make_test_script(script_dir, 'script', script)
             exitcode, stdout, stderr = assert_python_failure(script_name)
             self.assertEqual(
@@ -640,7 +642,7 @@
 
     def test_syntaxerror_invalid_escape_sequence_multi_line(self):
         script = 'foo = """\\q"""\n'
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             script_name = _make_test_script(script_dir, 'script', script)
             exitcode, stdout, stderr = assert_python_failure(
                 '-Werror', script_name,
@@ -648,8 +650,8 @@
             self.assertEqual(
                 stderr.splitlines()[-3:],
                 [   b'    foo = """\\q"""',
-                    b'          ^',
-                    b'SyntaxError: invalid escape sequence \\q'
+                    b'          ^^^^^^^^',
+                    b'SyntaxError: invalid escape sequence \'\\q\''
                 ],
             )
 
@@ -667,7 +669,7 @@
             """)
         # Always show full path diffs on errors
         self.maxDiff = None
-        with support.temp_dir() as work_dir, support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as work_dir, os_helper.temp_dir() as script_dir:
             script_name = _make_test_script(script_dir, '__main__', script)
             # Reference output comes from directly executing __main__.py
             # We omit PYTHONPATH and user site to align with isolated mode
@@ -699,7 +701,7 @@
             """)
         # Always show full path diffs on errors
         self.maxDiff = None
-        with support.temp_dir() as work_dir:
+        with os_helper.temp_dir() as work_dir:
             script_dir = os.path.join(work_dir, "script_pkg")
             os.mkdir(script_dir)
             script_name = _make_test_script(script_dir, '__main__', script)
@@ -737,9 +739,9 @@
         self.assertNotEqual(proc.returncode, 0)
 
 
-def test_main():
-    support.run_unittest(CmdLineTest)
+def tearDownModule():
     support.reap_children()
 
+
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_code.py b/Lib/test/test_code.py
index ac3dde7..b9c4f8b 100644
--- a/Lib/test/test_code.py
+++ b/Lib/test/test_code.py
@@ -135,7 +135,7 @@
 except ImportError:
     ctypes = None
 from test.support import (run_doctest, run_unittest, cpython_only,
-                          check_impl_detail)
+                          check_impl_detail, gc_collect)
 
 
 def consts(t):
@@ -213,7 +213,7 @@
         CodeType = type(co)
 
         # test code constructor
-        return CodeType(co.co_argcount,
+        CodeType(co.co_argcount,
                         co.co_posonlyargcount,
                         co.co_kwonlyargcount,
                         co.co_nlocals,
@@ -258,12 +258,18 @@
             ("co_cellvars", ("cellvar",)),
             ("co_filename", "newfilename"),
             ("co_name", "newname"),
-            ("co_lnotab", code2.co_lnotab),
+            ("co_linetable", code2.co_linetable),
         ):
             with self.subTest(attr=attr, value=value):
                 new_code = code.replace(**{attr: value})
                 self.assertEqual(getattr(new_code, attr), value)
 
+    def test_empty_linetable(self):
+        def func():
+            pass
+        new_code = code = func.__code__.replace(co_linetable=b'')
+        self.assertEqual(list(new_code.co_lines()), [])
+
 
 def isinterned(s):
     return s is sys.intern(('_' + s + '_')[1:-1])
@@ -337,6 +343,7 @@
         coderef = weakref.ref(f.__code__, callback)
         self.assertTrue(bool(coderef()))
         del f
+        gc_collect()  # For PyPy or other GCs.
         self.assertFalse(bool(coderef()))
         self.assertTrue(self.called)
 
diff --git a/Lib/test/test_code_module.py b/Lib/test/test_code_module.py
index 24db0ac..226bc3a 100644
--- a/Lib/test/test_code_module.py
+++ b/Lib/test/test_code_module.py
@@ -4,9 +4,10 @@
 from textwrap import dedent
 from contextlib import ExitStack
 from unittest import mock
-from test import support
+from test.support import import_helper
 
-code = support.import_module('code')
+
+code = import_helper.import_module('code')
 
 
 class TestInteractiveConsole(unittest.TestCase):
diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py
index 8d112a1..a9c43d9 100644
--- a/Lib/test/test_codecs.py
+++ b/Lib/test/test_codecs.py
@@ -8,6 +8,8 @@
 from unittest import mock
 
 from test import support
+from test.support import os_helper
+from test.support import warnings_helper
 
 try:
     import _testcapi
@@ -30,7 +32,7 @@
 # On small versions of Windows like Windows IoT or Windows Nano Server not all codepages are present
 def is_code_page_present(cp):
     from ctypes import POINTER, WINFUNCTYPE, WinDLL
-    from ctypes.wintypes import BOOL, UINT, BYTE, WCHAR, UINT, DWORD
+    from ctypes.wintypes import BOOL, BYTE, WCHAR, UINT, DWORD
 
     MAX_LEADBYTES = 12  # 5 ranges, 2 bytes ea., 0 term.
     MAX_DEFAULTCHAR = 2 # single or double byte
@@ -112,7 +114,7 @@
         q = Queue(b"")
         r = codecs.getreader(self.encoding)(q)
         result = ""
-        for (c, partialresult) in zip(input.encode(self.encoding), partialresults):
+        for (c, partialresult) in zip(input.encode(self.encoding), partialresults, strict=True):
             q.write(bytes([c]))
             result += r.read()
             self.assertEqual(result, partialresult)
@@ -123,7 +125,7 @@
         # do the check again, this time using an incremental decoder
         d = codecs.getincrementaldecoder(self.encoding)()
         result = ""
-        for (c, partialresult) in zip(input.encode(self.encoding), partialresults):
+        for (c, partialresult) in zip(input.encode(self.encoding), partialresults, strict=True):
             result += d.decode(bytes([c]))
             self.assertEqual(result, partialresult)
         # check that there's nothing left in the buffers
@@ -133,7 +135,7 @@
         # Check whether the reset method works properly
         d.reset()
         result = ""
-        for (c, partialresult) in zip(input.encode(self.encoding), partialresults):
+        for (c, partialresult) in zip(input.encode(self.encoding), partialresults, strict=True):
             result += d.decode(bytes([c]))
             self.assertEqual(result, partialresult)
         # check that there's nothing left in the buffers
@@ -709,11 +711,11 @@
         s1 = 'Hello\r\nworld\r\n'
 
         s = s1.encode(self.encoding)
-        self.addCleanup(support.unlink, support.TESTFN)
-        with open(support.TESTFN, 'wb') as fp:
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
+        with open(os_helper.TESTFN, 'wb') as fp:
             fp.write(s)
-        with support.check_warnings(('', DeprecationWarning)):
-            reader = codecs.open(support.TESTFN, 'U', encoding=self.encoding)
+        with warnings_helper.check_warnings(('', DeprecationWarning)):
+            reader = codecs.open(os_helper.TESTFN, 'U', encoding=self.encoding)
         with reader:
             self.assertEqual(reader.read(), s1)
 
@@ -1639,6 +1641,18 @@
         self.assertRaises(TypeError, codecs.register)
         self.assertRaises(TypeError, codecs.register, 42)
 
+    def test_unregister(self):
+        name = "nonexistent_codec_name"
+        search_function = mock.Mock()
+        codecs.register(search_function)
+        self.assertRaises(TypeError, codecs.lookup, name)
+        search_function.assert_called_with(name)
+        search_function.reset_mock()
+
+        codecs.unregister(search_function)
+        self.assertRaises(LookupError, codecs.lookup, name)
+        search_function.assert_not_called()
+
     def test_lookup(self):
         self.assertRaises(TypeError, codecs.lookup)
         self.assertRaises(LookupError, codecs.lookup, "__spam__")
@@ -1697,10 +1711,10 @@
             getattr(codecs, api)
 
     def test_open(self):
-        self.addCleanup(support.unlink, support.TESTFN)
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
         for mode in ('w', 'r', 'r+', 'w+', 'a', 'a+'):
             with self.subTest(mode), \
-                    codecs.open(support.TESTFN, mode, 'ascii') as file:
+                    codecs.open(os_helper.TESTFN, mode, 'ascii') as file:
                 self.assertIsInstance(file, codecs.StreamReaderWriter)
 
     def test_undefined(self):
@@ -1718,7 +1732,7 @@
         mock_open = mock.mock_open()
         with mock.patch('builtins.open', mock_open) as file:
             with self.assertRaises(LookupError):
-                codecs.open(support.TESTFN, 'wt', 'invalid-encoding')
+                codecs.open(os_helper.TESTFN, 'wt', 'invalid-encoding')
 
             file().close.assert_called()
 
@@ -2327,7 +2341,11 @@
                          (r"\x5c\x55\x30\x30\x31\x31\x30\x30\x30\x30", 10))
 
 
-class UnicodeEscapeTest(unittest.TestCase):
+class UnicodeEscapeTest(ReadTest, unittest.TestCase):
+    encoding = "unicode-escape"
+
+    test_lone_surrogates = None
+
     def test_empty(self):
         self.assertEqual(codecs.unicode_escape_encode(""), (b"", 0))
         self.assertEqual(codecs.unicode_escape_decode(b""), ("", 0))
@@ -2414,8 +2432,50 @@
         self.assertEqual(decode(br"\U00110000", "ignore"), ("", 10))
         self.assertEqual(decode(br"\U00110000", "replace"), ("\ufffd", 10))
 
+    def test_partial(self):
+        self.check_partial(
+            "\x00\t\n\r\\\xff\uffff\U00010000",
+            [
+                '',
+                '',
+                '',
+                '\x00',
+                '\x00',
+                '\x00\t',
+                '\x00\t',
+                '\x00\t\n',
+                '\x00\t\n',
+                '\x00\t\n\r',
+                '\x00\t\n\r',
+                '\x00\t\n\r\\',
+                '\x00\t\n\r\\',
+                '\x00\t\n\r\\',
+                '\x00\t\n\r\\',
+                '\x00\t\n\r\\\xff',
+                '\x00\t\n\r\\\xff',
+                '\x00\t\n\r\\\xff',
+                '\x00\t\n\r\\\xff',
+                '\x00\t\n\r\\\xff',
+                '\x00\t\n\r\\\xff',
+                '\x00\t\n\r\\\xff\uffff',
+                '\x00\t\n\r\\\xff\uffff',
+                '\x00\t\n\r\\\xff\uffff',
+                '\x00\t\n\r\\\xff\uffff',
+                '\x00\t\n\r\\\xff\uffff',
+                '\x00\t\n\r\\\xff\uffff',
+                '\x00\t\n\r\\\xff\uffff',
+                '\x00\t\n\r\\\xff\uffff',
+                '\x00\t\n\r\\\xff\uffff',
+                '\x00\t\n\r\\\xff\uffff',
+                '\x00\t\n\r\\\xff\uffff\U00010000',
+            ]
+        )
 
-class RawUnicodeEscapeTest(unittest.TestCase):
+class RawUnicodeEscapeTest(ReadTest, unittest.TestCase):
+    encoding = "raw-unicode-escape"
+
+    test_lone_surrogates = None
+
     def test_empty(self):
         self.assertEqual(codecs.raw_unicode_escape_encode(""), (b"", 0))
         self.assertEqual(codecs.raw_unicode_escape_decode(b""), ("", 0))
@@ -2464,6 +2524,35 @@
         self.assertEqual(decode(br"\U00110000", "ignore"), ("", 10))
         self.assertEqual(decode(br"\U00110000", "replace"), ("\ufffd", 10))
 
+    def test_partial(self):
+        self.check_partial(
+            "\x00\t\n\r\\\xff\uffff\U00010000",
+            [
+                '\x00',
+                '\x00\t',
+                '\x00\t\n',
+                '\x00\t\n\r',
+                '\x00\t\n\r',
+                '\x00\t\n\r\\\xff',
+                '\x00\t\n\r\\\xff',
+                '\x00\t\n\r\\\xff',
+                '\x00\t\n\r\\\xff',
+                '\x00\t\n\r\\\xff',
+                '\x00\t\n\r\\\xff',
+                '\x00\t\n\r\\\xff\uffff',
+                '\x00\t\n\r\\\xff\uffff',
+                '\x00\t\n\r\\\xff\uffff',
+                '\x00\t\n\r\\\xff\uffff',
+                '\x00\t\n\r\\\xff\uffff',
+                '\x00\t\n\r\\\xff\uffff',
+                '\x00\t\n\r\\\xff\uffff',
+                '\x00\t\n\r\\\xff\uffff',
+                '\x00\t\n\r\\\xff\uffff',
+                '\x00\t\n\r\\\xff\uffff',
+                '\x00\t\n\r\\\xff\uffff\U00010000',
+            ]
+        )
+
 
 class EscapeEncodeTest(unittest.TestCase):
 
@@ -2528,10 +2617,10 @@
                  "utf-32",
                  "utf-32-le",
                  "utf-32-be")
-        self.addCleanup(support.unlink, support.TESTFN)
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
         for encoding in tests:
             # Check if the BOM is written only once
-            with codecs.open(support.TESTFN, 'w+', encoding=encoding) as f:
+            with codecs.open(os_helper.TESTFN, 'w+', encoding=encoding) as f:
                 f.write(data)
                 f.write(data)
                 f.seek(0)
@@ -2540,7 +2629,7 @@
                 self.assertEqual(f.read(), data * 2)
 
             # Check that the BOM is written after a seek(0)
-            with codecs.open(support.TESTFN, 'w+', encoding=encoding) as f:
+            with codecs.open(os_helper.TESTFN, 'w+', encoding=encoding) as f:
                 f.write(data[0])
                 self.assertNotEqual(f.tell(), 0)
                 f.seek(0)
@@ -2549,7 +2638,7 @@
                 self.assertEqual(f.read(), data)
 
             # (StreamWriter) Check that the BOM is written after a seek(0)
-            with codecs.open(support.TESTFN, 'w+', encoding=encoding) as f:
+            with codecs.open(os_helper.TESTFN, 'w+', encoding=encoding) as f:
                 f.writer.write(data[0])
                 self.assertNotEqual(f.writer.tell(), 0)
                 f.writer.seek(0)
@@ -2559,7 +2648,7 @@
 
             # Check that the BOM is not written after a seek() at a position
             # different than the start
-            with codecs.open(support.TESTFN, 'w+', encoding=encoding) as f:
+            with codecs.open(os_helper.TESTFN, 'w+', encoding=encoding) as f:
                 f.write(data)
                 f.seek(f.tell())
                 f.write(data)
@@ -2568,7 +2657,7 @@
 
             # (StreamWriter) Check that the BOM is not written after a seek()
             # at a position different than the start
-            with codecs.open(support.TESTFN, 'w+', encoding=encoding) as f:
+            with codecs.open(os_helper.TESTFN, 'w+', encoding=encoding) as f:
                 f.writer.write(data)
                 f.writer.seek(f.writer.tell())
                 f.writer.write(data)
@@ -2654,7 +2743,7 @@
                 view_decoded = codecs.decode(view, encoding)
                 self.assertEqual(view_decoded, data)
 
-    def test_text_to_binary_blacklists_binary_transforms(self):
+    def test_text_to_binary_denylists_binary_transforms(self):
         # Check binary -> binary codecs give a good error for str input
         bad_input = "bad input type"
         for encoding in bytes_transform_encodings:
@@ -2666,14 +2755,14 @@
                     bad_input.encode(encoding)
                 self.assertIsNone(failure.exception.__cause__)
 
-    def test_text_to_binary_blacklists_text_transforms(self):
+    def test_text_to_binary_denylists_text_transforms(self):
         # Check str.encode gives a good error message for str -> str codecs
         msg = (r"^'rot_13' is not a text encoding; "
                r"use codecs.encode\(\) to handle arbitrary codecs")
         with self.assertRaisesRegex(LookupError, msg):
             "just an example message".encode("rot_13")
 
-    def test_binary_to_text_blacklists_binary_transforms(self):
+    def test_binary_to_text_denylists_binary_transforms(self):
         # Check bytes.decode and bytearray.decode give a good error
         # message for binary -> binary codecs
         data = b"encode first to ensure we meet any format restrictions"
@@ -2688,7 +2777,7 @@
                 with self.assertRaisesRegex(LookupError, msg):
                     bytearray(encoded_data).decode(encoding)
 
-    def test_binary_to_text_blacklists_text_transforms(self):
+    def test_binary_to_text_denylists_text_transforms(self):
         # Check str -> str codec gives a good error for binary input
         for bad_input in (b"immutable", bytearray(b"mutable")):
             with self.subTest(bad_input=bad_input):
@@ -2752,29 +2841,14 @@
 
 def _get_test_codec(codec_name):
     return _TEST_CODECS.get(codec_name)
-codecs.register(_get_test_codec) # Returns None, not usable as a decorator
-
-try:
-    # Issue #22166: Also need to clear the internal cache in CPython
-    from _codecs import _forget_codec
-except ImportError:
-    def _forget_codec(codec_name):
-        pass
 
 
 class ExceptionChainingTest(unittest.TestCase):
 
     def setUp(self):
-        # There's no way to unregister a codec search function, so we just
-        # ensure we render this one fairly harmless after the test
-        # case finishes by using the test case repr as the codec name
-        # The codecs module normalizes codec names, although this doesn't
-        # appear to be formally documented...
-        # We also make sure we use a truly unique id for the custom codec
-        # to avoid issues with the codec cache when running these tests
-        # multiple times (e.g. when hunting for refleaks)
-        unique_id = repr(self) + str(id(self))
-        self.codec_name = encodings.normalize_encoding(unique_id).lower()
+        self.codec_name = 'exception_chaining_test'
+        codecs.register(_get_test_codec)
+        self.addCleanup(codecs.unregister, _get_test_codec)
 
         # We store the object to raise on the instance because of a bad
         # interaction between the codec caching (which means we can't
@@ -2789,10 +2863,6 @@
         _TEST_CODECS.pop(self.codec_name, None)
         # Issue #22166: Also pop from caches to avoid appearance of ref leaks
         encodings._cache.pop(self.codec_name, None)
-        try:
-            _forget_codec(self.codec_name)
-        except KeyError:
-            pass
 
     def set_codec(self, encode, decode):
         codec_info = codecs.CodecInfo(encode, decode,
@@ -3413,5 +3483,42 @@
             'To be, or not to be, that is the question')
 
 
+class CodecNameNormalizationTest(unittest.TestCase):
+    """Test codec name normalization"""
+    def test_codecs_lookup(self):
+        FOUND = (1, 2, 3, 4)
+        NOT_FOUND = (None, None, None, None)
+        def search_function(encoding):
+            if encoding == "aaa_8":
+                return FOUND
+            else:
+                return NOT_FOUND
+
+        codecs.register(search_function)
+        self.addCleanup(codecs.unregister, search_function)
+        self.assertEqual(FOUND, codecs.lookup('aaa_8'))
+        self.assertEqual(FOUND, codecs.lookup('AAA-8'))
+        self.assertEqual(FOUND, codecs.lookup('AAA---8'))
+        self.assertEqual(FOUND, codecs.lookup('AAA   8'))
+        self.assertEqual(FOUND, codecs.lookup('aaa\xe9\u20ac-8'))
+        self.assertEqual(NOT_FOUND, codecs.lookup('AAA.8'))
+        self.assertEqual(NOT_FOUND, codecs.lookup('AAA...8'))
+        self.assertEqual(NOT_FOUND, codecs.lookup('BBB-8'))
+        self.assertEqual(NOT_FOUND, codecs.lookup('BBB.8'))
+        self.assertEqual(NOT_FOUND, codecs.lookup('a\xe9\u20ac-8'))
+
+    def test_encodings_normalize_encoding(self):
+        # encodings.normalize_encoding() ignores non-ASCII characters.
+        normalize = encodings.normalize_encoding
+        self.assertEqual(normalize('utf_8'), 'utf_8')
+        self.assertEqual(normalize('utf\xE9\u20AC\U0010ffff-8'), 'utf_8')
+        self.assertEqual(normalize('utf   8'), 'utf_8')
+        # encodings.normalize_encoding() doesn't convert
+        # characters to lower case.
+        self.assertEqual(normalize('UTF 8'), 'UTF_8')
+        self.assertEqual(normalize('utf.8'), 'utf.8')
+        self.assertEqual(normalize('utf...8'), 'utf...8')
+
+
 if __name__ == "__main__":
     unittest.main()
diff --git a/Lib/test/test_codeop.py b/Lib/test/test_codeop.py
index 66caf5a..17376c7 100644
--- a/Lib/test/test_codeop.py
+++ b/Lib/test/test_codeop.py
@@ -6,6 +6,7 @@
 import unittest
 import warnings
 from test import support
+from test.support import warnings_helper
 
 from codeop import compile_command, PyCF_DONT_IMPLY_DEDENT
 import io
@@ -134,6 +135,10 @@
         ai("a = {")
         ai("b + {")
 
+        ai("print([1,\n2,")
+        ai("print({1:1,\n2:3,")
+        ai("print((1,\n2,")
+
         ai("if 9==3:\n   pass\nelse:")
         ai("if 9==3:\n   pass\nelse:\n")
         ai("if 9==3:\n   pass\nelse:\n   pass")
@@ -159,7 +164,6 @@
         ai("","eval")
         ai("\n","eval")
         ai("(","eval")
-        ai("(\n\n\n","eval")
         ai("(9+","eval")
         ai("9+ \\","eval")
         ai("lambda z: \\","eval")
@@ -178,21 +182,21 @@
         ai("from a import (b,c")
         ai("from a import (b,c,")
 
-        ai("[");
-        ai("[a");
-        ai("[a,");
-        ai("[a,b");
-        ai("[a,b,");
+        ai("[")
+        ai("[a")
+        ai("[a,")
+        ai("[a,b")
+        ai("[a,b,")
 
-        ai("{");
-        ai("{a");
-        ai("{a:");
-        ai("{a:b");
-        ai("{a:b,");
-        ai("{a:b,c");
-        ai("{a:b,c:");
-        ai("{a:b,c:d");
-        ai("{a:b,c:d,");
+        ai("{")
+        ai("{a")
+        ai("{a:")
+        ai("{a:b")
+        ai("{a:b,")
+        ai("{a:b,c")
+        ai("{a:b,c:")
+        ai("{a:b,c:d")
+        ai("{a:b,c:d,")
 
         ai("a(")
         ai("a(b")
@@ -271,7 +275,6 @@
         ai("a = 'a\\\n")
 
         ai("a = 1","eval")
-        ai("a = (","eval")
         ai("]","eval")
         ai("())","eval")
         ai("[}","eval")
@@ -306,7 +309,7 @@
 
     def test_warning(self):
         # Test that the warning is only returned once.
-        with support.check_warnings(
+        with warnings_helper.check_warnings(
                 (".*literal", SyntaxWarning),
                 (".*invalid", DeprecationWarning),
                 ) as w:
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py
index 057ec92..3404b8a 100644
--- a/Lib/test/test_collections.py
+++ b/Lib/test/test_collections.py
@@ -7,6 +7,7 @@
 import operator
 import pickle
 from random import choice, randrange
+from itertools import product, chain, combinations
 import string
 import sys
 from test import support
@@ -248,6 +249,10 @@
         for k, v in dict(a=1, B=20, C=30, z=100).items():             # check get
             self.assertEqual(d.get(k, 100), v)
 
+        c = ChainMap({'a': 1, 'b': 2})
+        d = c.new_child(b=20, c=30)
+        self.assertEqual(d.maps, [{'b': 20, 'c': 30}, {'a': 1, 'b': 2}])
+
     def test_union_operators(self):
         cm1 = ChainMap(dict(a=1, b=2), dict(c=3, d=4))
         cm2 = ChainMap(dict(a=10, e=5), dict(b=20, d=4))
@@ -663,6 +668,7 @@
         a.w = 5
         self.assertEqual(a.__dict__, {'w': 5})
 
+    @support.cpython_only
     def test_field_descriptor(self):
         Point = namedtuple('Point', 'x y')
         p = Point(11, 22)
@@ -680,6 +686,16 @@
         self.assertEqual(np.x, 1)
         self.assertEqual(np.y, 2)
 
+    def test_new_builtins_issue_43102(self):
+        obj = namedtuple('C', ())
+        new_func = obj.__new__
+        self.assertEqual(new_func.__globals__['__builtins__'], {})
+        self.assertEqual(new_func.__builtins__, {})
+
+    def test_match_args(self):
+        Point = namedtuple('Point', 'x y')
+        self.assertEqual(Point.__match_args__, ('x', 'y'))
+
 
 ################################################################################
 ### Abstract Base Classes
@@ -1497,8 +1513,12 @@
                 return result
             def __repr__(self):
                 return "MySet(%s)" % repr(list(self))
-        s = MySet([5,43,2,1])
-        self.assertEqual(s.pop(), 1)
+        items = [5,43,2,1]
+        s = MySet(items)
+        r = s.pop()
+        self.assertEqual(len(s), len(items) - 1)
+        self.assertNotIn(r, s)
+        self.assertIn(r, items)
 
     def test_issue8750(self):
         empty = WithSet()
@@ -1575,7 +1595,7 @@
         self.assertSetEqual(set(s1), set(s2))
 
     def test_Set_from_iterable(self):
-        """Verify _from_iterable overriden to an instance method works."""
+        """Verify _from_iterable overridden to an instance method works."""
         class SetUsingInstanceFromIterable(MutableSet):
             def __init__(self, values, created_by):
                 if not created_by:
@@ -1782,6 +1802,18 @@
         self.assertTrue(f1 != l1)
         self.assertTrue(f1 != l2)
 
+    def test_Set_hash_matches_frozenset(self):
+        sets = [
+            {}, {1}, {None}, {-1}, {0.0}, {"abc"}, {1, 2, 3},
+            {10**100, 10**101}, {"a", "b", "ab", ""}, {False, True},
+            {object(), object(), object()}, {float("nan")},  {frozenset()},
+            {*range(1000)}, {*range(1000)} - {100, 200, 300},
+            {*range(sys.maxsize - 10, sys.maxsize + 10)},
+        ]
+        for s in sets:
+            fs = frozenset(s)
+            self.assertEqual(hash(fs), Set._hash(fs), msg=s)
+
     def test_Mapping(self):
         for sample in [dict]:
             self.assertIsInstance(sample(), Mapping)
@@ -1948,6 +1980,12 @@
         self.assertEqual(len(mss), len(mss2))
         self.assertEqual(list(mss), list(mss2))
 
+    def test_illegal_patma_flags(self):
+        with self.assertRaises(TypeError):
+            class Both(Collection):
+                __abc_tpflags__ = (Sequence.__flags__ | Mapping.__flags__)
+
+
 
 ################################################################################
 ### Counter
@@ -2041,6 +2079,10 @@
         self.assertRaises(TypeError, Counter, (), ())
         self.assertRaises(TypeError, Counter.__init__)
 
+    def test_total(self):
+        c = Counter(a=10, b=5, c=0)
+        self.assertEqual(c.total(), 15)
+
     def test_order_preservation(self):
         # Input order dictates items() order
         self.assertEqual(list(Counter('abracadabra').items()),
@@ -2194,29 +2236,6 @@
                 set_result = setop(set(p.elements()), set(q.elements()))
                 self.assertEqual(counter_result, dict.fromkeys(set_result, 1))
 
-    def test_subset_superset_not_implemented(self):
-        # Verify that multiset comparison operations are not implemented.
-
-        # These operations were intentionally omitted because multiset
-        # comparison semantics conflict with existing dict equality semantics.
-
-        # For multisets, we would expect that if p<=q and p>=q are both true,
-        # then p==q.  However, dict equality semantics require that p!=q when
-        # one of sets contains an element with a zero count and the other
-        # doesn't.
-
-        p = Counter(a=1, b=0)
-        q = Counter(a=1, c=0)
-        self.assertNotEqual(p, q)
-        with self.assertRaises(TypeError):
-            p < q
-        with self.assertRaises(TypeError):
-            p <= q
-        with self.assertRaises(TypeError):
-            p > q
-        with self.assertRaises(TypeError):
-            p >= q
-
     def test_inplace_operations(self):
         elements = 'abcd'
         for i in range(1000):
@@ -2291,6 +2310,47 @@
         self.assertTrue(c.called)
         self.assertEqual(dict(c), {'a': 5, 'b': 2, 'c': 1, 'd': 1, 'r':2 })
 
+    def test_multiset_operations_equivalent_to_set_operations(self):
+        # When the multiplicities are all zero or one, multiset operations
+        # are guaranteed to be equivalent to the corresponding operations
+        # for regular sets.
+        s = list(product(('a', 'b', 'c'), range(2)))
+        powerset = chain.from_iterable(combinations(s, r) for r in range(len(s)+1))
+        counters = [Counter(dict(groups)) for groups in powerset]
+        for cp, cq in product(counters, repeat=2):
+            sp = set(cp.elements())
+            sq = set(cq.elements())
+            self.assertEqual(set(cp + cq), sp | sq)
+            self.assertEqual(set(cp - cq), sp - sq)
+            self.assertEqual(set(cp | cq), sp | sq)
+            self.assertEqual(set(cp & cq), sp & sq)
+            self.assertEqual(cp == cq, sp == sq)
+            self.assertEqual(cp != cq, sp != sq)
+            self.assertEqual(cp <= cq, sp <= sq)
+            self.assertEqual(cp >= cq, sp >= sq)
+            self.assertEqual(cp < cq, sp < sq)
+            self.assertEqual(cp > cq, sp > sq)
+
+    def test_eq(self):
+        self.assertEqual(Counter(a=3, b=2, c=0), Counter('ababa'))
+        self.assertNotEqual(Counter(a=3, b=2), Counter('babab'))
+
+    def test_le(self):
+        self.assertTrue(Counter(a=3, b=2, c=0) <= Counter('ababa'))
+        self.assertFalse(Counter(a=3, b=2) <= Counter('babab'))
+
+    def test_lt(self):
+        self.assertTrue(Counter(a=3, b=1, c=0) < Counter('ababa'))
+        self.assertFalse(Counter(a=3, b=2, c=0) < Counter('ababa'))
+
+    def test_ge(self):
+        self.assertTrue(Counter(a=2, b=1, c=0) >= Counter('aab'))
+        self.assertFalse(Counter(a=3, b=2, c=0) >= Counter('aabd'))
+
+    def test_gt(self):
+        self.assertTrue(Counter(a=3, b=2, c=0) > Counter('aab'))
+        self.assertFalse(Counter(a=2, b=1, c=0) > Counter('aab'))
+
 
 ################################################################################
 ### Run tests
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py
index 55716fd..9859d9a 100644
--- a/Lib/test/test_compile.py
+++ b/Lib/test/test_compile.py
@@ -7,7 +7,9 @@
 import tempfile
 import types
 from test import support
-from test.support import script_helper, FakePath
+from test.support import script_helper
+from test.support.os_helper import FakePath
+
 
 class TestSpecifics(unittest.TestCase):
 
@@ -153,14 +155,14 @@
     def test_leading_newlines(self):
         s256 = "".join(["\n"] * 256 + ["spam"])
         co = compile(s256, 'fn', 'exec')
-        self.assertEqual(co.co_firstlineno, 257)
-        self.assertEqual(co.co_lnotab, bytes())
+        self.assertEqual(co.co_firstlineno, 1)
+        self.assertEqual(list(co.co_lines()), [(0, 8, 257)])
 
     def test_literals_with_leading_zeroes(self):
         for arg in ["077787", "0xj", "0x.", "0e",  "090000000000000",
                     "080000000000000", "000000000000009", "000000000000008",
                     "0b42", "0BADCAFE", "0o123456789", "0b1.1", "0o4.2",
-                    "0b101j2", "0o153j2", "0b100e1", "0o777e1", "0777",
+                    "0b101j", "0o153j", "0b100e1", "0o777e1", "0777",
                     "000777", "000000000000007"]:
             self.assertRaises(SyntaxError, eval, arg)
 
@@ -425,7 +427,7 @@
         fname = __file__
         if fname.lower().endswith('pyc'):
             fname = fname[:-1]
-        with open(fname, 'r') as f:
+        with open(fname, encoding='utf-8') as f:
             fcontents = f.read()
         sample_code = [
             ['<assign>', 'x = 5'],
@@ -500,6 +502,7 @@
         self.compile_single("if x:\n   f(x)")
         self.compile_single("if x:\n   f(x)\nelse:\n   g(x)")
         self.compile_single("class T:\n   pass")
+        self.compile_single("c = '''\na=1\nb=2\nc=3\n'''")
 
     def test_bad_single_statement(self):
         self.assertInvalidSingle('1\n2')
@@ -510,6 +513,7 @@
         self.assertInvalidSingle('f()\n# blah\nblah()')
         self.assertInvalidSingle('f()\nxy # blah\nblah()')
         self.assertInvalidSingle('x = 5 # comment\nx = 6\n')
+        self.assertInvalidSingle("c = '''\nd=1\n'''\na = 1\n\nb = 2\n")
 
     def test_particularly_evil_undecodable(self):
         # Issue 24022
@@ -541,21 +545,26 @@
         # XXX (ncoghlan): duplicating the scaling factor here is a little
         # ugly. Perhaps it should be exposed somewhere...
         fail_depth = sys.getrecursionlimit() * 3
+        crash_depth = sys.getrecursionlimit() * 300
         success_depth = int(fail_depth * 0.75)
 
-        def check_limit(prefix, repeated):
+        def check_limit(prefix, repeated, mode="single"):
             expect_ok = prefix + repeated * success_depth
-            self.compile_single(expect_ok)
-            broken = prefix + repeated * fail_depth
-            details = "Compiling ({!r} + {!r} * {})".format(
-                         prefix, repeated, fail_depth)
-            with self.assertRaises(RecursionError, msg=details):
-                self.compile_single(broken)
+            compile(expect_ok, '<test>', mode)
+            for depth in (fail_depth, crash_depth):
+                broken = prefix + repeated * depth
+                details = "Compiling ({!r} + {!r} * {})".format(
+                            prefix, repeated, depth)
+                with self.assertRaises(RecursionError, msg=details):
+                    compile(broken, '<test>', mode)
 
         check_limit("a", "()")
         check_limit("a", ".b")
         check_limit("a", "[0]")
         check_limit("a", "*a")
+        # XXX Crashes in the parser.
+        # check_limit("a", " if a else a")
+        # check_limit("if a: pass", "\nelif a: pass", mode="exec")
 
     def test_null_terminated(self):
         # The source code is null-terminated internally, but bytes-like
@@ -630,6 +639,28 @@
         self.check_constant(f1, frozenset({0}))
         self.assertTrue(f1(0))
 
+    # Merging equal co_linetable and co_code is not a strict requirement
+    # for the Python semantics, it's a more an implementation detail.
+    @support.cpython_only
+    def test_merge_code_attrs(self):
+        # See https://bugs.python.org/issue42217
+        f1 = lambda x: x.y.z
+        f2 = lambda a: a.b.c
+
+        self.assertIs(f1.__code__.co_linetable, f2.__code__.co_linetable)
+        self.assertIs(f1.__code__.co_code, f2.__code__.co_code)
+
+    # Stripping unused constants is not a strict requirement for the
+    # Python semantics, it's a more an implementation detail.
+    @support.cpython_only
+    def test_strip_unused_consts(self):
+        # Python 3.10rc1 appended None to co_consts when None is not used
+        # at all. See bpo-45056.
+        def f1():
+            "docstring"
+            return 42
+        self.assertEqual(f1.__code__.co_consts, ("docstring", 42))
+
     # This is a regression test for a CPython specific peephole optimizer
     # implementation bug present in a few releases.  It's assertion verifies
     # that peephole optimization was actually done though that isn't an
@@ -726,10 +757,10 @@
 
         for func in funcs:
             opcodes = list(dis.get_instructions(func))
-            self.assertEqual(2, len(opcodes))
-            self.assertEqual('LOAD_CONST', opcodes[0].opname)
-            self.assertEqual(None, opcodes[0].argval)
-            self.assertEqual('RETURN_VALUE', opcodes[1].opname)
+            self.assertLessEqual(len(opcodes), 3)
+            self.assertEqual('LOAD_CONST', opcodes[-2].opname)
+            self.assertEqual(None, opcodes[-2].argval)
+            self.assertEqual('RETURN_VALUE', opcodes[-1].opname)
 
     def test_false_while_loop(self):
         def break_in_while():
@@ -750,6 +781,159 @@
             self.assertEqual(None, opcodes[0].argval)
             self.assertEqual('RETURN_VALUE', opcodes[1].opname)
 
+    def test_consts_in_conditionals(self):
+        def and_true(x):
+            return True and x
+
+        def and_false(x):
+            return False and x
+
+        def or_true(x):
+            return True or x
+
+        def or_false(x):
+            return False or x
+
+        funcs = [and_true, and_false, or_true, or_false]
+
+        # Check that condition is removed.
+        for func in funcs:
+            with self.subTest(func=func):
+                opcodes = list(dis.get_instructions(func))
+                self.assertEqual(2, len(opcodes))
+                self.assertIn('LOAD_', opcodes[0].opname)
+                self.assertEqual('RETURN_VALUE', opcodes[1].opname)
+
+    def test_lineno_procedure_call(self):
+        def call():
+            (
+                print()
+            )
+        line1 = call.__code__.co_firstlineno + 1
+        assert line1 not in [line for (_, _, line) in call.__code__.co_lines()]
+
+    def test_lineno_after_implicit_return(self):
+        TRUE = True
+        # Don't use constant True or False, as compiler will remove test
+        def if1(x):
+            x()
+            if TRUE:
+                pass
+        def if2(x):
+            x()
+            if TRUE:
+                pass
+            else:
+                pass
+        def if3(x):
+            x()
+            if TRUE:
+                pass
+            else:
+                return None
+        def if4(x):
+            x()
+            if not TRUE:
+                pass
+        funcs = [ if1, if2, if3, if4]
+        lastlines = [ 3, 3, 3, 2]
+        frame = None
+        def save_caller_frame():
+            nonlocal frame
+            frame = sys._getframe(1)
+        for func, lastline in zip(funcs, lastlines, strict=True):
+            with self.subTest(func=func):
+                func(save_caller_frame)
+                self.assertEqual(frame.f_lineno-frame.f_code.co_firstlineno, lastline)
+
+    def test_lineno_after_no_code(self):
+        def no_code1():
+            "doc string"
+
+        def no_code2():
+            a: int
+
+        for func in (no_code1, no_code2):
+            with self.subTest(func=func):
+                code = func.__code__
+                lines = list(code.co_lines())
+                self.assertEqual(len(lines), 1)
+                start, end, line = lines[0]
+                self.assertEqual(start, 0)
+                self.assertEqual(end, len(code.co_code))
+                self.assertEqual(line, code.co_firstlineno)
+
+    def test_lineno_attribute(self):
+        def load_attr():
+            return (
+                o.
+                a
+            )
+        load_attr_lines = [ 2, 3, 1 ]
+
+        def load_method():
+            return (
+                o.
+                m(
+                    0
+                )
+            )
+        load_method_lines = [ 2, 3, 4, 3, 1 ]
+
+        def store_attr():
+            (
+                o.
+                a
+            ) = (
+                v
+            )
+        store_attr_lines = [ 5, 2, 3 ]
+
+        def aug_store_attr():
+            (
+                o.
+                a
+            ) += (
+                v
+            )
+        aug_store_attr_lines = [ 2, 3, 5, 1, 3 ]
+
+        funcs = [ load_attr, load_method, store_attr, aug_store_attr]
+        func_lines = [ load_attr_lines, load_method_lines,
+                 store_attr_lines, aug_store_attr_lines]
+
+        for func, lines in zip(funcs, func_lines, strict=True):
+            with self.subTest(func=func):
+                code_lines = [ line-func.__code__.co_firstlineno
+                              for (_, _, line) in func.__code__.co_lines() ]
+                self.assertEqual(lines, code_lines)
+
+    def test_line_number_genexp(self):
+
+        def return_genexp():
+            return (1
+                    for
+                    x
+                    in
+                    y)
+        genexp_lines = [None, 1, 3, 1]
+
+        genexp_code = return_genexp.__code__.co_consts[1]
+        code_lines = [ None if line is None else line-return_genexp.__code__.co_firstlineno
+                      for (_, _, line) in genexp_code.co_lines() ]
+        self.assertEqual(genexp_lines, code_lines)
+
+    def test_line_number_implicit_return_after_async_for(self):
+
+        async def test(aseq):
+            async for i in aseq:
+                body
+
+        expected_lines = [None, 1, 2, 1]
+        code_lines = [ None if line is None else line-test.__code__.co_firstlineno
+                      for (_, _, line) in test.__code__.co_lines() ]
+        self.assertEqual(expected_lines, code_lines)
+
     def test_big_dict_literal(self):
         # The compiler has a flushing point in "compiler_dict" that calls compiles
         # a portion of the dictionary literal when the loop that iterates over the items
@@ -760,6 +944,34 @@
         the_dict = "{" + ",".join(f"{x}:{x}" for x in range(dict_size)) + "}"
         self.assertEqual(len(eval(the_dict)), dict_size)
 
+    def test_redundant_jump_in_if_else_break(self):
+        # Check if bytecode containing jumps that simply point to the next line
+        # is generated around if-else-break style structures. See bpo-42615.
+
+        def if_else_break():
+            val = 1
+            while True:
+                if val > 0:
+                    val -= 1
+                else:
+                    break
+                val = -1
+
+        INSTR_SIZE = 2
+        HANDLED_JUMPS = (
+            'POP_JUMP_IF_FALSE',
+            'POP_JUMP_IF_TRUE',
+            'JUMP_ABSOLUTE',
+            'JUMP_FORWARD',
+        )
+
+        for line, instr in enumerate(dis.Bytecode(if_else_break)):
+            if instr.opname == 'JUMP_FORWARD':
+                self.assertNotEqual(instr.arg, 0)
+            elif instr.opname in HANDLED_JUMPS:
+                self.assertNotEqual(instr.arg, (line + 1)*INSTR_SIZE)
+
+
 class TestExpressionStackSize(unittest.TestCase):
     # These tests check that the computed stack size for a code object
     # stays within reasonable bounds (see issue #21523 for an example
@@ -792,6 +1004,32 @@
     def test_binop(self):
         self.check_stack_size("x + " * self.N + "x")
 
+    def test_list(self):
+        self.check_stack_size("[" + "x, " * self.N + "x]")
+
+    def test_tuple(self):
+        self.check_stack_size("(" + "x, " * self.N + "x)")
+
+    def test_set(self):
+        self.check_stack_size("{" + "x, " * self.N + "x}")
+
+    def test_dict(self):
+        self.check_stack_size("{" + "x:x, " * self.N + "x:x}")
+
+    def test_func_args(self):
+        self.check_stack_size("f(" + "x, " * self.N + ")")
+
+    def test_func_kwargs(self):
+        kwargs = (f'a{i}=x' for i in range(self.N))
+        self.check_stack_size("f(" +  ", ".join(kwargs) + ")")
+
+    def test_meth_args(self):
+        self.check_stack_size("o.m(" + "x, " * self.N + ")")
+
+    def test_meth_kwargs(self):
+        kwargs = (f'a{i}=x' for i in range(self.N))
+        self.check_stack_size("o.m(" +  ", ".join(kwargs) + ")")
+
     def test_func_and(self):
         code = "def f(x):\n"
         code += "   x and x\n" * self.N
diff --git a/Lib/test/test_compileall.py b/Lib/test/test_compileall.py
index 3bbc681..33f0c93 100644
--- a/Lib/test/test_compileall.py
+++ b/Lib/test/test_compileall.py
@@ -3,7 +3,6 @@
 import filecmp
 import importlib.util
 import io
-import itertools
 import os
 import pathlib
 import py_compile
@@ -16,17 +15,21 @@
 import unittest
 
 from unittest import mock, skipUnless
+from concurrent.futures import ProcessPoolExecutor
 try:
-    from concurrent.futures import ProcessPoolExecutor
+    # compileall relies on ProcessPoolExecutor if ProcessPoolExecutor exists
+    # and it can function.
+    from concurrent.futures.process import _check_system_limits
+    _check_system_limits()
     _have_multiprocessing = True
-except ImportError:
+except NotImplementedError:
     _have_multiprocessing = False
 
 from test import support
+from test.support import os_helper
 from test.support import script_helper
-
-from .test_py_compile import without_source_date_epoch
-from .test_py_compile import SourceDateEpochTestMeta
+from test.test_py_compile import without_source_date_epoch
+from test.test_py_compile import SourceDateEpochTestMeta
 
 
 def get_pyc(script, opt):
@@ -53,7 +56,7 @@
         self.directory = tempfile.mkdtemp()
         self.source_path = os.path.join(self.directory, '_test.py')
         self.bc_path = importlib.util.cache_from_source(self.source_path)
-        with open(self.source_path, 'w') as file:
+        with open(self.source_path, 'w', encoding="utf-8") as file:
             file.write('x = 123\n')
         self.source_path2 = os.path.join(self.directory, '_test2.py')
         self.bc_path2 = importlib.util.cache_from_source(self.source_path2)
@@ -68,16 +71,37 @@
 
     def add_bad_source_file(self):
         self.bad_source_path = os.path.join(self.directory, '_test_bad.py')
-        with open(self.bad_source_path, 'w') as file:
+        with open(self.bad_source_path, 'w', encoding="utf-8") as file:
             file.write('x (\n')
 
     def timestamp_metadata(self):
         with open(self.bc_path, 'rb') as file:
             data = file.read(12)
         mtime = int(os.stat(self.source_path).st_mtime)
-        compare = struct.pack('<4sll', importlib.util.MAGIC_NUMBER, 0, mtime)
+        compare = struct.pack('<4sLL', importlib.util.MAGIC_NUMBER, 0,
+                              mtime & 0xFFFF_FFFF)
         return data, compare
 
+    def test_year_2038_mtime_compilation(self):
+        # Test to make sure we can handle mtimes larger than what a 32-bit
+        # signed number can hold as part of bpo-34990
+        try:
+            os.utime(self.source_path, (2**32 - 1, 2**32 - 1))
+        except (OverflowError, OSError):
+            self.skipTest("filesystem doesn't support timestamps near 2**32")
+        with contextlib.redirect_stdout(io.StringIO()):
+            self.assertTrue(compileall.compile_file(self.source_path))
+
+    def test_larger_than_32_bit_times(self):
+        # This is similar to the test above but we skip it if the OS doesn't
+        # support modification times larger than 32-bits.
+        try:
+            os.utime(self.source_path, (2**35, 2**35))
+        except (OverflowError, OSError):
+            self.skipTest("filesystem doesn't support large timestamps")
+        with contextlib.redirect_stdout(io.StringIO()):
+            self.assertTrue(compileall.compile_file(self.source_path))
+
     def recreation_check(self, metadata):
         """Check that compileall recreates bytecode when the new metadata is
         used."""
@@ -96,7 +120,7 @@
 
     def test_mtime(self):
         # Test a change in mtime leads to a new .pyc.
-        self.recreation_check(struct.pack('<4sll', importlib.util.MAGIC_NUMBER,
+        self.recreation_check(struct.pack('<4sLL', importlib.util.MAGIC_NUMBER,
                                           0, 1))
 
     def test_magic_number(self):
@@ -159,11 +183,19 @@
         data_file = os.path.join(data_dir, 'file')
         os.mkdir(data_dir)
         # touch data/file
-        with open(data_file, 'w'):
+        with open(data_file, 'wb'):
             pass
         compileall.compile_file(data_file)
         self.assertFalse(os.path.exists(os.path.join(data_dir, '__pycache__')))
 
+
+    def test_compile_file_encoding_fallback(self):
+        # Bug 44666 reported that compile_file failed when sys.stdout.encoding is None
+        self.add_bad_source_file()
+        with contextlib.redirect_stdout(io.StringIO()):
+            self.assertFalse(compileall.compile_file(self.bad_source_path))
+
+
     def test_optimize(self):
         # make sure compiling with different optimization settings than the
         # interpreter's creates the correct file names
@@ -187,6 +219,7 @@
         self.assertRegex(line, r'Listing ([^WindowsPath|PosixPath].*)')
         self.assertTrue(os.path.isfile(self.bc_path))
 
+    @skipUnless(_have_multiprocessing, "requires multiprocessing")
     @mock.patch('concurrent.futures.ProcessPoolExecutor')
     def test_compile_pool_called(self, pool_mock):
         compileall.compile_dir(self.directory, quiet=True, workers=5)
@@ -197,11 +230,13 @@
                                     "workers must be greater or equal to 0"):
             compileall.compile_dir(self.directory, workers=-1)
 
+    @skipUnless(_have_multiprocessing, "requires multiprocessing")
     @mock.patch('concurrent.futures.ProcessPoolExecutor')
     def test_compile_workers_cpu_count(self, pool_mock):
         compileall.compile_dir(self.directory, quiet=True, workers=0)
         self.assertEqual(pool_mock.call_args[1]['max_workers'], None)
 
+    @skipUnless(_have_multiprocessing, "requires multiprocessing")
     @mock.patch('concurrent.futures.ProcessPoolExecutor')
     @mock.patch('compileall.compile_file')
     def test_compile_one_worker(self, compile_file_mock, pool_mock):
@@ -356,7 +391,7 @@
                 except Exception:
                     pass
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_ignore_symlink_destination(self):
         # Create folders for allowed files, symlinks and prohibited area
         allowed_path = os.path.join(self.directory, "test", "dir", "allowed")
@@ -432,13 +467,12 @@
                 if not directory.is_dir():
                     directory.mkdir()
                     directory_created = True
-                with path.open('w') as file:
-                    file.write('# for test_compileall')
+                path.write_text('# for test_compileall', encoding="utf-8")
             except OSError:
                 sys_path_writable = False
                 break
             finally:
-                support.unlink(str(path))
+                os_helper.unlink(str(path))
                 if directory_created:
                     directory.rmdir()
         else:
@@ -477,7 +511,7 @@
 
     def setUp(self):
         self.directory = tempfile.mkdtemp()
-        self.addCleanup(support.rmtree, self.directory)
+        self.addCleanup(os_helper.rmtree, self.directory)
         self.pkgdir = os.path.join(self.directory, 'foo')
         os.mkdir(self.pkgdir)
         self.pkgdir_cachedir = os.path.join(self.pkgdir, '__pycache__')
@@ -625,7 +659,7 @@
         self.assertCompiled(spamfn)
         self.assertCompiled(eggfn)
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_symlink_loop(self):
         # Currently, compileall ignores symlinks to directories.
         # If that limitation is ever lifted, it should protect against
@@ -696,7 +730,7 @@
         f2 = script_helper.make_script(self.pkgdir, 'f2', '')
         f3 = script_helper.make_script(self.pkgdir, 'f3', '')
         f4 = script_helper.make_script(self.pkgdir, 'f4', '')
-        with open(os.path.join(self.directory, 'l1'), 'w') as l1:
+        with open(os.path.join(self.directory, 'l1'), 'w', encoding="utf-8") as l1:
             l1.write(os.path.join(self.pkgdir, 'f1.py')+os.linesep)
             l1.write(os.path.join(self.pkgdir, 'f2.py')+os.linesep)
         self.assertRunOK('-i', os.path.join(self.directory, 'l1'), f4)
@@ -710,7 +744,7 @@
         f2 = script_helper.make_script(self.pkgdir, 'f2', '')
         f3 = script_helper.make_script(self.pkgdir, 'f3', '')
         f4 = script_helper.make_script(self.pkgdir, 'f4', '')
-        with open(os.path.join(self.directory, 'l1'), 'w') as l1:
+        with open(os.path.join(self.directory, 'l1'), 'w', encoding="utf-8") as l1:
             l1.write(os.path.join(self.pkgdir, 'f2.py')+os.linesep)
         self.assertRunOK('-i', os.path.join(self.directory, 'l1'))
         self.assertNotCompiled(f1)
@@ -823,7 +857,7 @@
                 except Exception:
                     pass
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_ignore_symlink_destination(self):
         # Create folders for allowed files, symlinks and prohibited area
         allowed_path = os.path.join(self.directory, "test", "dir", "allowed")
diff --git a/Lib/test/test_complex.py b/Lib/test/test_complex.py
index dee5c7f..c6a261b 100644
--- a/Lib/test/test_complex.py
+++ b/Lib/test/test_complex.py
@@ -1,4 +1,5 @@
 import unittest
+import sys
 from test import support
 from test.test_grammar import (VALID_UNDERSCORE_LITERALS,
                                INVALID_UNDERSCORE_LITERALS)
@@ -11,6 +12,14 @@
 NAN = float("nan")
 # These tests ensure that complex math does the right thing
 
+ZERO_DIVISION = (
+    (1+1j, 0+0j),
+    (1+1j, 0.0),
+    (1+1j, 0),
+    (1.0, 0+0j),
+    (1, 0+0j),
+)
+
 class ComplexTest(unittest.TestCase):
 
     def assertAlmostEqual(self, a, b):
@@ -99,20 +108,34 @@
             self.check_div(complex(random(), random()),
                            complex(random(), random()))
 
-        self.assertRaises(ZeroDivisionError, complex.__truediv__, 1+1j, 0+0j)
-        self.assertRaises(OverflowError, pow, 1e200+1j, 1e200+1j)
-
         self.assertAlmostEqual(complex.__truediv__(2+0j, 1+1j), 1-1j)
-        self.assertRaises(ZeroDivisionError, complex.__truediv__, 1+1j, 0+0j)
 
         for denom_real, denom_imag in [(0, NAN), (NAN, 0), (NAN, NAN)]:
             z = complex(0, 0) / complex(denom_real, denom_imag)
             self.assertTrue(isnan(z.real))
             self.assertTrue(isnan(z.imag))
 
+    def test_truediv_zero_division(self):
+        for a, b in ZERO_DIVISION:
+            with self.assertRaises(ZeroDivisionError):
+                a / b
+
     def test_floordiv(self):
-        self.assertRaises(TypeError, complex.__floordiv__, 3+0j, 1.5+0j)
-        self.assertRaises(TypeError, complex.__floordiv__, 3+0j, 0+0j)
+        with self.assertRaises(TypeError):
+            (1+1j) // (1+0j)
+        with self.assertRaises(TypeError):
+            (1+1j) // 1.0
+        with self.assertRaises(TypeError):
+            (1+1j) // 1
+        with self.assertRaises(TypeError):
+            1.0 // (1+0j)
+        with self.assertRaises(TypeError):
+            1 // (1+0j)
+
+    def test_floordiv_zero_division(self):
+        for a, b in ZERO_DIVISION:
+            with self.assertRaises(TypeError):
+                a // b
 
     def test_richcompare(self):
         self.assertIs(complex.__eq__(1+1j, 1<<10000), False)
@@ -159,13 +182,32 @@
 
     def test_mod(self):
         # % is no longer supported on complex numbers
-        self.assertRaises(TypeError, (1+1j).__mod__, 0+0j)
-        self.assertRaises(TypeError, lambda: (3.33+4.43j) % 0)
-        self.assertRaises(TypeError, (1+1j).__mod__, 4.3j)
+        with self.assertRaises(TypeError):
+            (1+1j) % (1+0j)
+        with self.assertRaises(TypeError):
+            (1+1j) % 1.0
+        with self.assertRaises(TypeError):
+            (1+1j) % 1
+        with self.assertRaises(TypeError):
+            1.0 % (1+0j)
+        with self.assertRaises(TypeError):
+            1 % (1+0j)
+
+    def test_mod_zero_division(self):
+        for a, b in ZERO_DIVISION:
+            with self.assertRaises(TypeError):
+                a % b
 
     def test_divmod(self):
         self.assertRaises(TypeError, divmod, 1+1j, 1+0j)
-        self.assertRaises(TypeError, divmod, 1+1j, 0+0j)
+        self.assertRaises(TypeError, divmod, 1+1j, 1.0)
+        self.assertRaises(TypeError, divmod, 1+1j, 1)
+        self.assertRaises(TypeError, divmod, 1.0, 1+0j)
+        self.assertRaises(TypeError, divmod, 1, 1+0j)
+
+    def test_divmod_zero_division(self):
+        for a, b in ZERO_DIVISION:
+            self.assertRaises(TypeError, divmod, a, b)
 
     def test_pow(self):
         self.assertAlmostEqual(pow(1+1j, 0+0j), 1.0)
@@ -174,6 +216,7 @@
         self.assertAlmostEqual(pow(1j, -1), 1/1j)
         self.assertAlmostEqual(pow(1j, 200), 1)
         self.assertRaises(ValueError, pow, 1+1j, 1+1j, 1+1j)
+        self.assertRaises(OverflowError, pow, 1e200+1j, 1e200+1j)
 
         a = 3.33+4.43j
         self.assertEqual(a ** 0j, 1)
@@ -206,6 +249,54 @@
         b = 5.1+2.3j
         self.assertRaises(ValueError, pow, a, b, 0)
 
+        # Check some boundary conditions; some of these used to invoke
+        # undefined behaviour (https://bugs.python.org/issue44698). We're
+        # not actually checking the results of these operations, just making
+        # sure they don't crash (for example when using clang's
+        # UndefinedBehaviourSanitizer).
+        values = (sys.maxsize, sys.maxsize+1, sys.maxsize-1,
+                  -sys.maxsize, -sys.maxsize+1, -sys.maxsize+1)
+        for real in values:
+            for imag in values:
+                with self.subTest(real=real, imag=imag):
+                    c = complex(real, imag)
+                    try:
+                        c ** real
+                    except OverflowError:
+                        pass
+                    try:
+                        c ** c
+                    except OverflowError:
+                        pass
+
+    def test_pow_with_small_integer_exponents(self):
+        # Check that small integer exponents are handled identically
+        # regardless of their type.
+        values = [
+            complex(5.0, 12.0),
+            complex(5.0e100, 12.0e100),
+            complex(-4.0, INF),
+            complex(INF, 0.0),
+        ]
+        exponents = [-19, -5, -3, -2, -1, 0, 1, 2, 3, 5, 19]
+        for value in values:
+            for exponent in exponents:
+                with self.subTest(value=value, exponent=exponent):
+                    try:
+                        int_pow = value**exponent
+                    except OverflowError:
+                        int_pow = "overflow"
+                    try:
+                        float_pow = value**float(exponent)
+                    except OverflowError:
+                        float_pow = "overflow"
+                    try:
+                        complex_pow = value**complex(exponent)
+                    except OverflowError:
+                        complex_pow = "overflow"
+                    self.assertEqual(str(float_pow), str(int_pow))
+                    self.assertEqual(str(complex_pow), str(int_pow))
+
     def test_boolcontext(self):
         for i in range(100):
             self.assertTrue(complex(random() + 1e-6, random() + 1e-6))
@@ -500,22 +591,6 @@
     def test_neg(self):
         self.assertEqual(-(1+6j), -1-6j)
 
-    def test_file(self):
-        a = 3.33+4.43j
-        b = 5.1+2.3j
-
-        fo = None
-        try:
-            fo = open(support.TESTFN, "w")
-            print(a, b, file=fo)
-            fo.close()
-            fo = open(support.TESTFN, "r")
-            self.assertEqual(fo.read(), ("%s %s\n" % (a, b)))
-        finally:
-            if (fo is not None) and (not fo.closed):
-                fo.close()
-            support.unlink(support.TESTFN)
-
     def test_getnewargs(self):
         self.assertEqual((1+2j).__getnewargs__(), (1.0, 2.0))
         self.assertEqual((1-2j).__getnewargs__(), (1.0, -2.0))
@@ -702,8 +777,6 @@
         self.assertEqual(format(complex(INF, 1), 'F'), 'INF+1.000000j')
         self.assertEqual(format(complex(INF, -1), 'F'), 'INF-1.000000j')
 
-def test_main():
-    support.run_unittest(ComplexTest)
 
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py
index 4fe4bf7..50fa1f1 100644
--- a/Lib/test/test_concurrent_futures.py
+++ b/Lib/test/test_concurrent_futures.py
@@ -1,9 +1,9 @@
 from test import support
+from test.support import import_helper
+from test.support import threading_helper
 
 # Skip tests if _multiprocessing wasn't built.
-support.import_module('_multiprocessing')
-# Skip tests if sem_open implementation is broken.
-support.skip_if_broken_multiprocessing_synchronize()
+import_helper.import_module('_multiprocessing')
 
 from test.support import hashlib_helper
 from test.support.script_helper import assert_python_ok
@@ -25,13 +25,19 @@
 from concurrent.futures._base import (
     PENDING, RUNNING, CANCELLED, CANCELLED_AND_NOTIFIED, FINISHED, Future,
     BrokenExecutor)
-from concurrent.futures.process import BrokenProcessPool
+from concurrent.futures.process import BrokenProcessPool, _check_system_limits
 from multiprocessing import get_context
 
 import multiprocessing.process
 import multiprocessing.util
 
 
+if support.check_sanitizer(address=True, memory=True):
+    # bpo-46633: Skip the test because it is too slow when Python is built
+    # with ASAN/MSAN: between 5 and 20 minutes on GitHub Actions.
+    raise unittest.SkipTest("test too slow on ASAN/MSAN build")
+
+
 def create_future(state=PENDING, exception=None, result=None):
     f = Future()
     f._state = state
@@ -101,11 +107,11 @@
 
 class BaseTestCase(unittest.TestCase):
     def setUp(self):
-        self._thread_key = support.threading_setup()
+        self._thread_key = threading_helper.threading_setup()
 
     def tearDown(self):
         support.reap_children()
-        support.threading_cleanup(*self._thread_key)
+        threading_helper.threading_cleanup(*self._thread_key)
 
 
 class ExecutorMixin:
@@ -159,6 +165,10 @@
     ctx = "fork"
 
     def get_context(self):
+        try:
+            _check_system_limits()
+        except NotImplementedError:
+            self.skipTest("ProcessPoolExecutor unavailable on this system")
         if sys.platform == "win32":
             self.skipTest("require unix system")
         return super().get_context()
@@ -168,12 +178,23 @@
     executor_type = futures.ProcessPoolExecutor
     ctx = "spawn"
 
+    def get_context(self):
+        try:
+            _check_system_limits()
+        except NotImplementedError:
+            self.skipTest("ProcessPoolExecutor unavailable on this system")
+        return super().get_context()
+
 
 class ProcessPoolForkserverMixin(ExecutorMixin):
     executor_type = futures.ProcessPoolExecutor
     ctx = "forkserver"
 
     def get_context(self):
+        try:
+            _check_system_limits()
+        except NotImplementedError:
+            self.skipTest("ProcessPoolExecutor unavailable on this system")
         if sys.platform == "win32":
             self.skipTest("require unix system")
         return super().get_context()
@@ -448,6 +469,7 @@
         executor.map(abs, range(-5, 5))
         threads = executor._threads
         del executor
+        support.gc_collect()  # For PyPy or other GCs.
 
         for t in threads:
             self.assertRegex(t.name, r'^SpecialPool_[0-4]$')
@@ -458,6 +480,7 @@
         executor.map(abs, range(-5, 5))
         threads = executor._threads
         del executor
+        support.gc_collect()  # For PyPy or other GCs.
 
         for t in threads:
             # Ensure that our default name is reasonably sane and unique when
@@ -520,6 +543,7 @@
         call_queue = executor._call_queue
         executor_manager_thread = executor._executor_manager_thread
         del executor
+        support.gc_collect()  # For PyPy or other GCs.
 
         # Make sure that all the executor resources were properly cleaned by
         # the shutdown process
@@ -561,6 +585,14 @@
 
 
 class WaitTests:
+    def test_20369(self):
+        # See https://bugs.python.org/issue20369
+        future = self.executor.submit(time.sleep, 1.5)
+        done, not_done = futures.wait([future, future],
+                            return_when=futures.ALL_COMPLETED)
+        self.assertEqual({future}, done)
+        self.assertEqual(set(), not_done)
+
 
     def test_first_completed(self):
         future1 = self.executor.submit(mul, 21, 2)
@@ -744,6 +776,7 @@
                 futures_list.remove(future)
                 wr = weakref.ref(future)
                 del future
+                support.gc_collect()  # For PyPy or other GCs.
                 self.assertIsNone(wr())
 
         futures_list[0].set_result("test")
@@ -751,6 +784,7 @@
             futures_list.remove(future)
             wr = weakref.ref(future)
             del future
+            support.gc_collect()  # For PyPy or other GCs.
             self.assertIsNone(wr())
             if futures_list:
                 futures_list[0].set_result("test")
@@ -850,6 +884,7 @@
         for obj in self.executor.map(make_dummy_object, range(10)):
             wr = weakref.ref(obj)
             del obj
+            support.gc_collect()  # For PyPy or other GCs.
             self.assertIsNone(wr())
 
 
@@ -890,6 +925,20 @@
         self.assertEqual(len(executor._threads), 1)
         executor.shutdown(wait=True)
 
+    @unittest.skipUnless(hasattr(os, 'register_at_fork'), 'need os.register_at_fork')
+    def test_hang_global_shutdown_lock(self):
+        # bpo-45021: _global_shutdown_lock should be reinitialized in the child
+        # process, otherwise it will never exit
+        def submit(pool):
+            pool.submit(submit, pool)
+
+        with futures.ThreadPoolExecutor(1) as pool:
+            pool.submit(submit, pool)
+
+            for _ in range(50):
+                with futures.ProcessPoolExecutor(1, mp_context=get_context('fork')) as workers:
+                    workers.submit(tuple)
+
 
 class ProcessPoolExecutorTest(ExecutorTest):
 
@@ -1494,16 +1543,10 @@
         self.assertEqual(f.exception(), e)
 
 
-_threads_key = None
-
 def setUpModule():
-    global _threads_key
-    _threads_key = support.threading_setup()
-
-
-def tearDownModule():
-    support.threading_cleanup(*_threads_key)
-    multiprocessing.util._cleanup_tests()
+    unittest.addModuleCleanup(multiprocessing.util._cleanup_tests)
+    thread_info = threading_helper.threading_setup()
+    unittest.addModuleCleanup(threading_helper.threading_cleanup, *thread_info)
 
 
 if __name__ == "__main__":
diff --git a/Lib/test/test_configparser.py b/Lib/test/test_configparser.py
index f16da11..e9b03e6 100644
--- a/Lib/test/test_configparser.py
+++ b/Lib/test/test_configparser.py
@@ -8,6 +8,7 @@
 import warnings
 
 from test import support
+from test.support import os_helper
 
 
 class SortedDict(collections.UserDict):
@@ -78,6 +79,7 @@
              'Spacey Bar',
              'Spacey Bar From The Beginning',
              'Types',
+             'This One Has A ] In It',
              ]
 
         if self.allow_no_value:
@@ -129,6 +131,7 @@
         eq(cf.get('Types', 'float'), "0.44")
         eq(cf.getboolean('Types', 'boolean'), False)
         eq(cf.get('Types', '123'), 'strange but acceptable')
+        eq(cf.get('This One Has A ] In It', 'forks'), 'spoons')
         if self.allow_no_value:
             eq(cf.get('NoValue', 'option-without-value'), None)
 
@@ -319,6 +322,8 @@
 float {0[0]} 0.44
 boolean {0[0]} NO
 123 {0[1]} strange but acceptable
+[This One Has A ] In It]
+  forks {0[0]} spoons
 """.format(self.delimiters, self.comment_prefixes)
         if self.allow_no_value:
             config_string += (
@@ -393,6 +398,9 @@
                 "boolean": False,
                 123: "strange but acceptable",
             },
+            "This One Has A ] In It": {
+                "forks": "spoons"
+            },
         }
         if self.allow_no_value:
             config.update({
@@ -713,31 +721,31 @@
         file1 = support.findfile("cfgparser.1")
         # check when we pass a mix of readable and non-readable files:
         cf = self.newconfig()
-        parsed_files = cf.read([file1, "nonexistent-file"])
+        parsed_files = cf.read([file1, "nonexistent-file"], encoding="utf-8")
         self.assertEqual(parsed_files, [file1])
         self.assertEqual(cf.get("Foo Bar", "foo"), "newbar")
         # check when we pass only a filename:
         cf = self.newconfig()
-        parsed_files = cf.read(file1)
+        parsed_files = cf.read(file1, encoding="utf-8")
         self.assertEqual(parsed_files, [file1])
         self.assertEqual(cf.get("Foo Bar", "foo"), "newbar")
         # check when we pass only a Path object:
         cf = self.newconfig()
-        parsed_files = cf.read(pathlib.Path(file1))
+        parsed_files = cf.read(pathlib.Path(file1), encoding="utf-8")
         self.assertEqual(parsed_files, [file1])
         self.assertEqual(cf.get("Foo Bar", "foo"), "newbar")
         # check when we passed both a filename and a Path object:
         cf = self.newconfig()
-        parsed_files = cf.read([pathlib.Path(file1), file1])
+        parsed_files = cf.read([pathlib.Path(file1), file1], encoding="utf-8")
         self.assertEqual(parsed_files, [file1, file1])
         self.assertEqual(cf.get("Foo Bar", "foo"), "newbar")
         # check when we pass only missing files:
         cf = self.newconfig()
-        parsed_files = cf.read(["nonexistent-file"])
+        parsed_files = cf.read(["nonexistent-file"], encoding="utf-8")
         self.assertEqual(parsed_files, [])
         # check when we pass no files:
         cf = self.newconfig()
-        parsed_files = cf.read([])
+        parsed_files = cf.read([], encoding="utf-8")
         self.assertEqual(parsed_files, [])
 
     def test_read_returns_file_list_with_bytestring_path(self):
@@ -746,15 +754,15 @@
         file1_bytestring = support.findfile("cfgparser.1").encode()
         # check when passing an existing bytestring path
         cf = self.newconfig()
-        parsed_files = cf.read(file1_bytestring)
+        parsed_files = cf.read(file1_bytestring, encoding="utf-8")
         self.assertEqual(parsed_files, [file1_bytestring])
         # check when passing an non-existing bytestring path
         cf = self.newconfig()
-        parsed_files = cf.read(b'nonexistent-file')
+        parsed_files = cf.read(b'nonexistent-file', encoding="utf-8")
         self.assertEqual(parsed_files, [])
         # check when passing both an existing and non-existing bytestring path
         cf = self.newconfig()
-        parsed_files = cf.read([file1_bytestring, b'nonexistent-file'])
+        parsed_files = cf.read([file1_bytestring, b'nonexistent-file'], encoding="utf-8")
         self.assertEqual(parsed_files, [file1_bytestring])
 
     # shared by subclasses
@@ -1063,17 +1071,17 @@
             cf.add_section(s)
             for j in range(10):
                 cf.set(s, 'lovely_spam{}'.format(j), self.wonderful_spam)
-        with open(support.TESTFN, 'w') as f:
+        with open(os_helper.TESTFN, 'w', encoding="utf-8") as f:
             cf.write(f)
 
     def tearDown(self):
-        os.unlink(support.TESTFN)
+        os.unlink(os_helper.TESTFN)
 
     def test_dominating_multiline_values(self):
         # We're reading from file because this is where the code changed
         # during performance updates in Python 3.2
         cf_from_file = self.newconfig()
-        with open(support.TESTFN) as f:
+        with open(os_helper.TESTFN, encoding="utf-8") as f:
             cf_from_file.read_file(f)
         self.assertEqual(cf_from_file.get('section8', 'lovely_spam4'),
                          self.wonderful_spam.replace('\t\n', '\n'))
@@ -1472,7 +1480,7 @@
 class FakeFile:
     def __init__(self):
         file_path = support.findfile("cfgparser.1")
-        with open(file_path) as f:
+        with open(file_path, encoding="utf-8") as f:
             self.lines = f.readlines()
             self.lines.reverse()
 
@@ -1499,7 +1507,7 @@
             pass   # unfortunately we can't test bytes on this path
         for file_path in file_paths:
             parser = configparser.ConfigParser()
-            with open(file_path) as f:
+            with open(file_path, encoding="utf-8") as f:
                 parser.read_file(f)
             self.assertIn("Foo Bar", parser)
             self.assertIn("foo", parser["Foo Bar"])
@@ -2127,8 +2135,7 @@
 
 class MiscTestCase(unittest.TestCase):
     def test__all__(self):
-        blacklist = {"Error"}
-        support.check__all__(self, configparser, blacklist=blacklist)
+        support.check__all__(self, configparser, not_exported={"Error"})
 
 
 if __name__ == '__main__':
diff --git a/Lib/test/test_contextlib.py b/Lib/test/test_contextlib.py
index 024f912..fbaae2d 100644
--- a/Lib/test/test_contextlib.py
+++ b/Lib/test/test_contextlib.py
@@ -7,6 +7,7 @@
 import unittest
 from contextlib import *  # Tests __all__
 from test import support
+from test.support import os_helper
 import weakref
 
 
@@ -125,19 +126,22 @@
         self.assertEqual(state, [1, 42, 999])
 
     def test_contextmanager_except_stopiter(self):
-        stop_exc = StopIteration('spam')
         @contextmanager
         def woohoo():
             yield
-        try:
-            with self.assertWarnsRegex(DeprecationWarning,
-                                       "StopIteration"):
-                with woohoo():
-                    raise stop_exc
-        except Exception as ex:
-            self.assertIs(ex, stop_exc)
-        else:
-            self.fail('StopIteration was suppressed')
+
+        class StopIterationSubclass(StopIteration):
+            pass
+
+        for stop_exc in (StopIteration('spam'), StopIterationSubclass('spam')):
+            with self.subTest(type=type(stop_exc)):
+                try:
+                    with woohoo():
+                        raise stop_exc
+                except Exception as ex:
+                    self.assertIs(ex, stop_exc)
+                else:
+                    self.fail(f'{stop_exc} was suppressed')
 
     def test_contextmanager_except_pep479(self):
         code = """\
@@ -227,6 +231,8 @@
         def woohoo(a, b):
             a = weakref.ref(a)
             b = weakref.ref(b)
+            # Allow test to work with a non-refcounted GC
+            support.gc_collect()
             self.assertIsNone(a())
             self.assertIsNone(b())
             yield
@@ -315,19 +321,19 @@
         tfn = tempfile.mktemp()
         try:
             f = None
-            with open(tfn, "w") as f:
+            with open(tfn, "w", encoding="utf-8") as f:
                 self.assertFalse(f.closed)
                 f.write("Booh\n")
             self.assertTrue(f.closed)
             f = None
             with self.assertRaises(ZeroDivisionError):
-                with open(tfn, "r") as f:
+                with open(tfn, "r", encoding="utf-8") as f:
                     self.assertFalse(f.closed)
                     self.assertEqual(f.read(), "Booh\n")
                     1 / 0
             self.assertTrue(f.closed)
         finally:
-            support.unlink(tfn)
+            os_helper.unlink(tfn)
 
 class LockContextTestCase(unittest.TestCase):
 
@@ -774,6 +780,40 @@
         self.assertIsInstance(inner_exc, ValueError)
         self.assertIsInstance(inner_exc.__context__, ZeroDivisionError)
 
+    def test_exit_exception_explicit_none_context(self):
+        # Ensure ExitStack chaining matches actual nested `with` statements
+        # regarding explicit __context__ = None.
+
+        class MyException(Exception):
+            pass
+
+        @contextmanager
+        def my_cm():
+            try:
+                yield
+            except BaseException:
+                exc = MyException()
+                try:
+                    raise exc
+                finally:
+                    exc.__context__ = None
+
+        @contextmanager
+        def my_cm_with_exit_stack():
+            with self.exit_stack() as stack:
+                stack.enter_context(my_cm())
+                yield stack
+
+        for cm in (my_cm, my_cm_with_exit_stack):
+            with self.subTest():
+                try:
+                    with cm():
+                        raise IndexError()
+                except MyException as exc:
+                    self.assertIsNone(exc.__context__)
+                else:
+                    self.fail("Expected IndexError, but no exception was raised")
+
     def test_exit_exception_non_suppressing(self):
         # http://bugs.python.org/issue19092
         def raise_exc(exc):
diff --git a/Lib/test/test_contextlib_async.py b/Lib/test/test_contextlib_async.py
index 43fb7fc..127d750 100644
--- a/Lib/test/test_contextlib_async.py
+++ b/Lib/test/test_contextlib_async.py
@@ -1,5 +1,7 @@
 import asyncio
-from contextlib import asynccontextmanager, AbstractAsyncContextManager, AsyncExitStack
+from contextlib import (
+    asynccontextmanager, AbstractAsyncContextManager,
+    AsyncExitStack, nullcontext, aclosing, contextmanager)
 import functools
 from test import support
 import unittest
@@ -207,7 +209,18 @@
         async def woohoo():
             yield
 
-        for stop_exc in (StopIteration('spam'), StopAsyncIteration('ham')):
+        class StopIterationSubclass(StopIteration):
+            pass
+
+        class StopAsyncIterationSubclass(StopAsyncIteration):
+            pass
+
+        for stop_exc in (
+            StopIteration('spam'),
+            StopAsyncIteration('ham'),
+            StopIterationSubclass('spam'),
+            StopAsyncIterationSubclass('spam')
+        ):
             with self.subTest(type=type(stop_exc)):
                 try:
                     async with woohoo():
@@ -278,6 +291,93 @@
         async with woohoo(self=11, func=22, args=33, kwds=44) as target:
             self.assertEqual(target, (11, 22, 33, 44))
 
+    @_async_test
+    async def test_recursive(self):
+        depth = 0
+        ncols = 0
+
+        @asynccontextmanager
+        async def woohoo():
+            nonlocal ncols
+            ncols += 1
+
+            nonlocal depth
+            before = depth
+            depth += 1
+            yield
+            depth -= 1
+            self.assertEqual(depth, before)
+
+        @woohoo()
+        async def recursive():
+            if depth < 10:
+                await recursive()
+
+        await recursive()
+
+        self.assertEqual(ncols, 10)
+        self.assertEqual(depth, 0)
+
+
+class AclosingTestCase(unittest.TestCase):
+
+    @support.requires_docstrings
+    def test_instance_docs(self):
+        cm_docstring = aclosing.__doc__
+        obj = aclosing(None)
+        self.assertEqual(obj.__doc__, cm_docstring)
+
+    @_async_test
+    async def test_aclosing(self):
+        state = []
+        class C:
+            async def aclose(self):
+                state.append(1)
+        x = C()
+        self.assertEqual(state, [])
+        async with aclosing(x) as y:
+            self.assertEqual(x, y)
+        self.assertEqual(state, [1])
+
+    @_async_test
+    async def test_aclosing_error(self):
+        state = []
+        class C:
+            async def aclose(self):
+                state.append(1)
+        x = C()
+        self.assertEqual(state, [])
+        with self.assertRaises(ZeroDivisionError):
+            async with aclosing(x) as y:
+                self.assertEqual(x, y)
+                1 / 0
+        self.assertEqual(state, [1])
+
+    @_async_test
+    async def test_aclosing_bpo41229(self):
+        state = []
+
+        @contextmanager
+        def sync_resource():
+            try:
+                yield
+            finally:
+                state.append(1)
+
+        async def agenfunc():
+            with sync_resource():
+                yield -1
+                yield -2
+
+        x = agenfunc()
+        self.assertEqual(state, [])
+        with self.assertRaises(ZeroDivisionError):
+            async with aclosing(x) as y:
+                self.assertEqual(x, y)
+                self.assertEqual(-1, await x.__anext__())
+                1 / 0
+        self.assertEqual(state, [1])
+
 
 class TestAsyncExitStack(TestBaseExitStack, unittest.TestCase):
     class SyncAsyncExitStack(AsyncExitStack):
@@ -452,6 +552,51 @@
         self.assertIsInstance(inner_exc, ValueError)
         self.assertIsInstance(inner_exc.__context__, ZeroDivisionError)
 
+    @_async_test
+    async def test_async_exit_exception_explicit_none_context(self):
+        # Ensure AsyncExitStack chaining matches actual nested `with` statements
+        # regarding explicit __context__ = None.
+
+        class MyException(Exception):
+            pass
+
+        @asynccontextmanager
+        async def my_cm():
+            try:
+                yield
+            except BaseException:
+                exc = MyException()
+                try:
+                    raise exc
+                finally:
+                    exc.__context__ = None
+
+        @asynccontextmanager
+        async def my_cm_with_exit_stack():
+            async with self.exit_stack() as stack:
+                await stack.enter_async_context(my_cm())
+                yield stack
+
+        for cm in (my_cm, my_cm_with_exit_stack):
+            with self.subTest():
+                try:
+                    async with cm():
+                        raise IndexError()
+                except MyException as exc:
+                    self.assertIsNone(exc.__context__)
+                else:
+                    self.fail("Expected IndexError, but no exception was raised")
+
+
+class TestAsyncNullcontext(unittest.TestCase):
+    @_async_test
+    async def test_async_nullcontext(self):
+        class C:
+            pass
+        c = C()
+        async with nullcontext(c) as c_in:
+            self.assertIs(c_in, c)
+
 
 if __name__ == '__main__':
     unittest.main()
diff --git a/Lib/test/test_copy.py b/Lib/test/test_copy.py
index 35f72fb..f1ca8cb 100644
--- a/Lib/test/test_copy.py
+++ b/Lib/test/test_copy.py
@@ -7,6 +7,7 @@
 from operator import le, lt, ge, gt, eq, ne
 
 import unittest
+from test import support
 
 order_comparisons = le, lt, ge, gt
 equality_comparisons = eq, ne
@@ -357,7 +358,7 @@
             pass
         tests = [None, 42, 2**100, 3.14, True, False, 1j,
                  "hello", "hello\u1234", f.__code__,
-                 NewStyle, Classic, max, property()]
+                 NewStyle, range(10), Classic, max, property()]
         for x in tests:
             self.assertIs(copy.deepcopy(x), x)
 
@@ -579,17 +580,6 @@
         self.assertIsNot(y, x)
         self.assertIs(y.foo, y)
 
-    def test_deepcopy_range(self):
-        class I(int):
-            pass
-        x = range(I(10))
-        y = copy.deepcopy(x)
-        self.assertIsNot(y, x)
-        self.assertEqual(y, x)
-        self.assertIsNot(y.stop, x.stop)
-        self.assertEqual(y.stop, x.stop)
-        self.assertIsInstance(y.stop, I)
-
     # _reconstruct()
 
     def test_reconstruct_string(self):
@@ -816,6 +806,7 @@
         self.assertEqual(v[c], d)
         self.assertEqual(len(v), 2)
         del c, d
+        support.gc_collect()  # For PyPy or other GCs.
         self.assertEqual(len(v), 1)
         x, y = C(), C()
         # The underlying containers are decoupled
@@ -845,6 +836,7 @@
         self.assertEqual(v[a].i, b.i)
         self.assertEqual(v[c].i, d.i)
         del c
+        support.gc_collect()  # For PyPy or other GCs.
         self.assertEqual(len(v), 1)
 
     def test_deepcopy_weakvaluedict(self):
@@ -868,6 +860,7 @@
         self.assertIs(t, d)
         del x, y, z, t
         del d
+        support.gc_collect()  # For PyPy or other GCs.
         self.assertEqual(len(v), 1)
 
     def test_deepcopy_bound_method(self):
diff --git a/Lib/test/test_coroutines.py b/Lib/test/test_coroutines.py
index 8d1e069..a6a199e 100644
--- a/Lib/test/test_coroutines.py
+++ b/Lib/test/test_coroutines.py
@@ -7,6 +7,8 @@
 import unittest
 import warnings
 from test import support
+from test.support import import_helper
+from test.support import warnings_helper
 from test.support.script_helper import assert_python_ok
 
 
@@ -1203,41 +1205,47 @@
             def __aenter__(self):
                 pass
 
-        body_executed = False
+        body_executed = None
         async def foo():
+            nonlocal body_executed
+            body_executed = False
             async with CM():
                 body_executed = True
 
         with self.assertRaisesRegex(AttributeError, '__aexit__'):
             run_async(foo())
-        self.assertFalse(body_executed)
+        self.assertIs(body_executed, False)
 
     def test_with_3(self):
         class CM:
             def __aexit__(self):
                 pass
 
-        body_executed = False
+        body_executed = None
         async def foo():
+            nonlocal body_executed
+            body_executed = False
             async with CM():
                 body_executed = True
 
         with self.assertRaisesRegex(AttributeError, '__aenter__'):
             run_async(foo())
-        self.assertFalse(body_executed)
+        self.assertIs(body_executed, False)
 
     def test_with_4(self):
         class CM:
             pass
 
-        body_executed = False
+        body_executed = None
         async def foo():
+            nonlocal body_executed
+            body_executed = False
             async with CM():
                 body_executed = True
 
         with self.assertRaisesRegex(AttributeError, '__aenter__'):
             run_async(foo())
-        self.assertFalse(body_executed)
+        self.assertIs(body_executed, False)
 
     def test_with_5(self):
         # While this test doesn't make a lot of sense,
@@ -2117,7 +2125,7 @@
     def test_asyncio_1(self):
         # asyncio cannot be imported when Python is compiled without thread
         # support
-        asyncio = support.import_module('asyncio')
+        asyncio = import_helper.import_module('asyncio')
 
         class MyException(Exception):
             pass
@@ -2258,8 +2266,9 @@
         try:
             warnings._warn_unawaited_coroutine = lambda coro: 1/0
             with support.catch_unraisable_exception() as cm, \
-                 support.check_warnings((r'coroutine .* was never awaited',
-                                         RuntimeWarning)):
+                 warnings_helper.check_warnings(
+                         (r'coroutine .* was never awaited',
+                          RuntimeWarning)):
                 # only store repr() to avoid keeping the coroutine alive
                 coro = corofn()
                 coro_repr = repr(coro)
@@ -2272,8 +2281,8 @@
                 self.assertEqual(cm.unraisable.exc_type, ZeroDivisionError)
 
             del warnings._warn_unawaited_coroutine
-            with support.check_warnings((r'coroutine .* was never awaited',
-                                         RuntimeWarning)):
+            with warnings_helper.check_warnings(
+                    (r'coroutine .* was never awaited', RuntimeWarning)):
                 corofn()
                 support.gc_collect()
 
diff --git a/Lib/test/test_crypt.py b/Lib/test/test_crypt.py
index 5dc83b4..877c575 100644
--- a/Lib/test/test_crypt.py
+++ b/Lib/test/test_crypt.py
@@ -1,8 +1,11 @@
 import sys
 import unittest
+from test.support import check_sanitizer
 
 
 try:
+    if check_sanitizer(address=True, memory=True):
+        raise unittest.SkipTest("The crypt module SEGFAULTs on ASAN/MSAN builds")
     import crypt
     IMPORT_ERROR = None
 except ImportError as ex:
diff --git a/Lib/test/test_csv.py b/Lib/test/test_csv.py
index d421be0..6e5dfc6 100644
--- a/Lib/test/test_csv.py
+++ b/Lib/test/test_csv.py
@@ -10,6 +10,7 @@
 import gc
 import pickle
 from test import support
+from test.support import warnings_helper
 from itertools import permutations
 from textwrap import dedent
 from collections import OrderedDict
@@ -132,7 +133,7 @@
 
 
     def _write_test(self, fields, expect, **kwargs):
-        with TemporaryFile("w+", newline='') as fileobj:
+        with TemporaryFile("w+", encoding="utf-8", newline='') as fileobj:
             writer = csv.writer(fileobj, **kwargs)
             writer.writerow(fields)
             fileobj.seek(0)
@@ -140,7 +141,7 @@
                              expect + writer.dialect.lineterminator)
 
     def _write_error_test(self, exc, fields, **kwargs):
-        with TemporaryFile("w+", newline='') as fileobj:
+        with TemporaryFile("w+", encoding="utf-8", newline='') as fileobj:
             writer = csv.writer(fileobj, **kwargs)
             with self.assertRaises(exc):
                 writer.writerow(fields)
@@ -156,7 +157,7 @@
         self._write_error_test(OSError, BadIterable())
         class BadList:
             def __len__(self):
-                return 10;
+                return 10
             def __getitem__(self, i):
                 if i > 2:
                     raise OSError
@@ -201,6 +202,20 @@
                          escapechar='\\', quoting = csv.QUOTE_NONE)
         self._write_test(['a',1,'p,q'], 'a,1,p\\,q',
                          escapechar='\\', quoting = csv.QUOTE_NONE)
+        self._write_test(['\\', 'a'], '\\\\,a',
+                         escapechar='\\', quoting=csv.QUOTE_NONE)
+        self._write_test(['\\', 'a'], '\\\\,a',
+                         escapechar='\\', quoting=csv.QUOTE_MINIMAL)
+        self._write_test(['\\', 'a'], '"\\\\","a"',
+                         escapechar='\\', quoting=csv.QUOTE_ALL)
+        self._write_test(['\\ ', 'a'], '\\\\ ,a',
+                         escapechar='\\', quoting=csv.QUOTE_MINIMAL)
+        self._write_test(['\\,', 'a'], '\\\\\\,,a',
+                         escapechar='\\', quoting=csv.QUOTE_NONE)
+        self._write_test([',\\', 'a'], '",\\\\",a',
+                         escapechar='\\', quoting=csv.QUOTE_MINIMAL)
+        self._write_test(['C\\', '6', '7', 'X"'], 'C\\\\,6,7,"X"""',
+                         escapechar='\\', quoting=csv.QUOTE_MINIMAL)
 
     def test_write_iterable(self):
         self._write_test(iter(['a', 1, 'p,q']), 'a,1,"p,q"')
@@ -217,7 +232,7 @@
         writer = csv.writer(BrokenFile())
         self.assertRaises(OSError, writer.writerows, [['a']])
 
-        with TemporaryFile("w+", newline='') as fileobj:
+        with TemporaryFile("w+", encoding="utf-8", newline='') as fileobj:
             writer = csv.writer(fileobj)
             self.assertRaises(TypeError, writer.writerows, None)
             writer.writerows([['a', 'b'], ['c', 'd']])
@@ -225,36 +240,37 @@
             self.assertEqual(fileobj.read(), "a,b\r\nc,d\r\n")
 
     def test_writerows_with_none(self):
-        with TemporaryFile("w+", newline='') as fileobj:
+        with TemporaryFile("w+", encoding="utf-8", newline='') as fileobj:
             writer = csv.writer(fileobj)
             writer.writerows([['a', None], [None, 'd']])
             fileobj.seek(0)
             self.assertEqual(fileobj.read(), "a,\r\n,d\r\n")
 
-        with TemporaryFile("w+", newline='') as fileobj:
+        with TemporaryFile("w+", encoding="utf-8", newline='') as fileobj:
             writer = csv.writer(fileobj)
             writer.writerows([[None], ['a']])
             fileobj.seek(0)
             self.assertEqual(fileobj.read(), '""\r\na\r\n')
 
-        with TemporaryFile("w+", newline='') as fileobj:
+        with TemporaryFile("w+", encoding="utf-8", newline='') as fileobj:
             writer = csv.writer(fileobj)
             writer.writerows([['a'], [None]])
             fileobj.seek(0)
             self.assertEqual(fileobj.read(), 'a\r\n""\r\n')
 
     def test_writerows_errors(self):
-        with TemporaryFile("w+", newline='') as fileobj:
+        with TemporaryFile("w+", encoding="utf-8", newline='') as fileobj:
             writer = csv.writer(fileobj)
             self.assertRaises(TypeError, writer.writerows, None)
             self.assertRaises(OSError, writer.writerows, BadIterable())
 
     @support.cpython_only
+    @support.requires_legacy_unicode_capi
+    @warnings_helper.ignore_warnings(category=DeprecationWarning)
     def test_writerows_legacy_strings(self):
         import _testcapi
-
         c = _testcapi.unicode_legacy_string('a')
-        with TemporaryFile("w+", newline='') as fileobj:
+        with TemporaryFile("w+", encoding="utf-8", newline='') as fileobj:
             writer = csv.writer(fileobj)
             writer.writerows([[c]])
             fileobj.seek(0)
@@ -351,7 +367,7 @@
         self.assertEqual(r.line_num, 3)
 
     def test_roundtrip_quoteed_newlines(self):
-        with TemporaryFile("w+", newline='') as fileobj:
+        with TemporaryFile("w+", encoding="utf-8", newline='') as fileobj:
             writer = csv.writer(fileobj)
             rows = [['a\nb','b'],['c','x\r\nd']]
             writer.writerows(rows)
@@ -360,7 +376,7 @@
                 self.assertEqual(row, rows[i])
 
     def test_roundtrip_escaped_unquoted_newlines(self):
-        with TemporaryFile("w+", newline='') as fileobj:
+        with TemporaryFile("w+", encoding="utf-8", newline='') as fileobj:
             writer = csv.writer(fileobj,quoting=csv.QUOTE_NONE,escapechar="\\")
             rows = [['a\nb','b'],['c','x\r\nd']]
             writer.writerows(rows)
@@ -416,7 +432,7 @@
             quoting = csv.QUOTE_NONE
             escapechar = "\\"
 
-        with TemporaryFile("w+") as fileobj:
+        with TemporaryFile("w+", encoding="utf-8") as fileobj:
             fileobj.write("abc def\nc1ccccc1 benzene\n")
             fileobj.seek(0)
             reader = csv.reader(fileobj, dialect=space())
@@ -442,9 +458,15 @@
         class testUni(csv.excel):
             delimiter = "\u039B"
 
+        class unspecified():
+            # A class to pass as dialect but with no dialect attributes.
+            pass
+
         csv.register_dialect('testC', testC)
         try:
             self.compare_dialect_123("1,2,3\r\n")
+            self.compare_dialect_123("1,2,3\r\n", dialect=None)
+            self.compare_dialect_123("1,2,3\r\n", dialect=unspecified)
             self.compare_dialect_123("1\t2\t3\r\n", testA)
             self.compare_dialect_123("1:2:3\r\n", dialect=testB())
             self.compare_dialect_123("1|2|3\r\n", dialect='testC')
@@ -477,7 +499,7 @@
 
 class TestCsvBase(unittest.TestCase):
     def readerAssertEqual(self, input, expected_result):
-        with TemporaryFile("w+", newline='') as fileobj:
+        with TemporaryFile("w+", encoding="utf-8", newline='') as fileobj:
             fileobj.write(input)
             fileobj.seek(0)
             reader = csv.reader(fileobj, dialect = self.dialect)
@@ -485,7 +507,7 @@
             self.assertEqual(fields, expected_result)
 
     def writerAssertEqual(self, input, expected_result):
-        with TemporaryFile("w+", newline='') as fileobj:
+        with TemporaryFile("w+", encoding="utf-8", newline='') as fileobj:
             writer = csv.writer(fileobj, dialect = self.dialect)
             writer.writerows(input)
             fileobj.seek(0)
@@ -627,13 +649,13 @@
     ### "long" means the row is longer than the number of fieldnames
     ### "short" means there are fewer elements in the row than fieldnames
     def test_writeheader_return_value(self):
-        with TemporaryFile("w+", newline='') as fileobj:
+        with TemporaryFile("w+", encoding="utf-8", newline='') as fileobj:
             writer = csv.DictWriter(fileobj, fieldnames = ["f1", "f2", "f3"])
             writeheader_return_value = writer.writeheader()
             self.assertEqual(writeheader_return_value, 10)
 
     def test_write_simple_dict(self):
-        with TemporaryFile("w+", newline='') as fileobj:
+        with TemporaryFile("w+", encoding="utf-8", newline='') as fileobj:
             writer = csv.DictWriter(fileobj, fieldnames = ["f1", "f2", "f3"])
             writer.writeheader()
             fileobj.seek(0)
@@ -658,7 +680,7 @@
         self.assertRaises(TypeError, csv.DictWriter, fileobj)
 
     def test_write_fields_not_in_fieldnames(self):
-        with TemporaryFile("w+", newline='') as fileobj:
+        with TemporaryFile("w+", encoding="utf-8", newline='') as fileobj:
             writer = csv.DictWriter(fileobj, fieldnames = ["f1", "f2", "f3"])
             # Of special note is the non-string key (issue 19449)
             with self.assertRaises(ValueError) as cx:
@@ -688,7 +710,7 @@
         self.assertEqual(fileobj.getvalue(), "1,2\r\n")
 
     def test_read_dict_fields(self):
-        with TemporaryFile("w+") as fileobj:
+        with TemporaryFile("w+", encoding="utf-8") as fileobj:
             fileobj.write("1,2,abc\r\n")
             fileobj.seek(0)
             reader = csv.DictReader(fileobj,
@@ -696,7 +718,7 @@
             self.assertEqual(next(reader), {"f1": '1', "f2": '2', "f3": 'abc'})
 
     def test_read_dict_no_fieldnames(self):
-        with TemporaryFile("w+") as fileobj:
+        with TemporaryFile("w+", encoding="utf-8") as fileobj:
             fileobj.write("f1,f2,f3\r\n1,2,abc\r\n")
             fileobj.seek(0)
             reader = csv.DictReader(fileobj)
@@ -706,7 +728,7 @@
     # Two test cases to make sure existing ways of implicitly setting
     # fieldnames continue to work.  Both arise from discussion in issue3436.
     def test_read_dict_fieldnames_from_file(self):
-        with TemporaryFile("w+") as fileobj:
+        with TemporaryFile("w+", encoding="utf-8") as fileobj:
             fileobj.write("f1,f2,f3\r\n1,2,abc\r\n")
             fileobj.seek(0)
             reader = csv.DictReader(fileobj,
@@ -716,7 +738,7 @@
 
     def test_read_dict_fieldnames_chain(self):
         import itertools
-        with TemporaryFile("w+") as fileobj:
+        with TemporaryFile("w+", encoding="utf-8") as fileobj:
             fileobj.write("f1,f2,f3\r\n1,2,abc\r\n")
             fileobj.seek(0)
             reader = csv.DictReader(fileobj)
@@ -726,7 +748,7 @@
                 self.assertEqual(row, {"f1": '1', "f2": '2', "f3": 'abc'})
 
     def test_read_long(self):
-        with TemporaryFile("w+") as fileobj:
+        with TemporaryFile("w+", encoding="utf-8") as fileobj:
             fileobj.write("1,2,abc,4,5,6\r\n")
             fileobj.seek(0)
             reader = csv.DictReader(fileobj,
@@ -735,7 +757,7 @@
                                              None: ["abc", "4", "5", "6"]})
 
     def test_read_long_with_rest(self):
-        with TemporaryFile("w+") as fileobj:
+        with TemporaryFile("w+", encoding="utf-8") as fileobj:
             fileobj.write("1,2,abc,4,5,6\r\n")
             fileobj.seek(0)
             reader = csv.DictReader(fileobj,
@@ -744,7 +766,7 @@
                                              "_rest": ["abc", "4", "5", "6"]})
 
     def test_read_long_with_rest_no_fieldnames(self):
-        with TemporaryFile("w+") as fileobj:
+        with TemporaryFile("w+", encoding="utf-8") as fileobj:
             fileobj.write("f1,f2\r\n1,2,abc,4,5,6\r\n")
             fileobj.seek(0)
             reader = csv.DictReader(fileobj, restkey="_rest")
@@ -753,7 +775,7 @@
                                              "_rest": ["abc", "4", "5", "6"]})
 
     def test_read_short(self):
-        with TemporaryFile("w+") as fileobj:
+        with TemporaryFile("w+", encoding="utf-8") as fileobj:
             fileobj.write("1,2,abc,4,5,6\r\n1,2,abc\r\n")
             fileobj.seek(0)
             reader = csv.DictReader(fileobj,
@@ -802,7 +824,7 @@
         contents = [(20-i) for i in range(20)]
         a = array.array('i', contents)
 
-        with TemporaryFile("w+", newline='') as fileobj:
+        with TemporaryFile("w+", encoding="utf-8", newline='') as fileobj:
             writer = csv.writer(fileobj, dialect="excel")
             writer.writerow(a)
             expected = ",".join([str(i) for i in a])+"\r\n"
@@ -813,7 +835,7 @@
         import array
         contents = [(20-i)*0.1 for i in range(20)]
         a = array.array('d', contents)
-        with TemporaryFile("w+", newline='') as fileobj:
+        with TemporaryFile("w+", encoding="utf-8", newline='') as fileobj:
             writer = csv.writer(fileobj, dialect="excel")
             writer.writerow(a)
             expected = ",".join([str(i) for i in a])+"\r\n"
@@ -824,7 +846,7 @@
         import array
         contents = [(20-i)*0.1 for i in range(20)]
         a = array.array('f', contents)
-        with TemporaryFile("w+", newline='') as fileobj:
+        with TemporaryFile("w+", encoding="utf-8", newline='') as fileobj:
             writer = csv.writer(fileobj, dialect="excel")
             writer.writerow(a)
             expected = ",".join([str(i) for i in a])+"\r\n"
@@ -835,7 +857,7 @@
         import array, string
         a = array.array('u', string.ascii_letters)
 
-        with TemporaryFile("w+", newline='') as fileobj:
+        with TemporaryFile("w+", encoding="utf-8", newline='') as fileobj:
             writer = csv.writer(fileobj, dialect="excel")
             writer.writerow(a)
             expected = ",".join(a)+"\r\n"
@@ -875,7 +897,7 @@
         with self.assertRaises(csv.Error) as cm:
             mydialect()
         self.assertEqual(str(cm.exception),
-                         '"quotechar" must be string, not int')
+                         '"quotechar" must be string or None, not int')
 
     def test_delimiter(self):
         class mydialect(csv.Dialect):
@@ -912,6 +934,35 @@
         self.assertEqual(str(cm.exception),
                          '"delimiter" must be string, not int')
 
+        mydialect.delimiter = None
+        with self.assertRaises(csv.Error) as cm:
+            mydialect()
+        self.assertEqual(str(cm.exception),
+                         '"delimiter" must be string, not NoneType')
+
+    def test_escapechar(self):
+        class mydialect(csv.Dialect):
+            delimiter = ";"
+            escapechar = '\\'
+            doublequote = False
+            skipinitialspace = True
+            lineterminator = '\r\n'
+            quoting = csv.QUOTE_NONE
+        d = mydialect()
+        self.assertEqual(d.escapechar, "\\")
+
+        mydialect.escapechar = "**"
+        with self.assertRaisesRegex(csv.Error, '"escapechar" must be a 1-character string'):
+            mydialect()
+
+        mydialect.escapechar = b"*"
+        with self.assertRaisesRegex(csv.Error, '"escapechar" must be string or None, not bytes'):
+            mydialect()
+
+        mydialect.escapechar = 4
+        with self.assertRaisesRegex(csv.Error, '"escapechar" must be string or None, not int'):
+            mydialect()
+
     def test_lineterminator(self):
         class mydialect(csv.Dialect):
             delimiter = ";"
@@ -998,6 +1049,42 @@
 'Stonecutters ''Seafood'' and Chop House'+ 'Lemont'+ 'IL'+ '12/19/02'+ 'Week Back'
 """
 
+    sample10 = dedent("""
+                        abc,def
+                        ghijkl,mno
+                        ghi,jkl
+                        """)
+
+    sample11 = dedent("""
+                        abc,def
+                        ghijkl,mnop
+                        ghi,jkl
+                         """)
+
+    sample12 = dedent(""""time","forces"
+                        1,1.5
+                        0.5,5+0j
+                        0,0
+                        1+1j,6
+                        """)
+
+    sample13 = dedent(""""time","forces"
+                        0,0
+                        1,2
+                        a,b
+                        """)
+
+    def test_issue43625(self):
+        sniffer = csv.Sniffer()
+        self.assertTrue(sniffer.has_header(self.sample12))
+        self.assertFalse(sniffer.has_header(self.sample13))
+
+    def test_has_header_strings(self):
+        "More to document existing (unexpected?) behavior than anything else."
+        sniffer = csv.Sniffer()
+        self.assertFalse(sniffer.has_header(self.sample10))
+        self.assertFalse(sniffer.has_header(self.sample11))
+
     def test_has_header(self):
         sniffer = csv.Sniffer()
         self.assertIs(sniffer.has_header(self.sample1), False)
@@ -1221,6 +1308,9 @@
         extra = {'__doc__', '__version__'}
         support.check__all__(self, csv, ('csv', '_csv'), extra=extra)
 
+    def test_subclassable(self):
+        # issue 44089
+        class Foo(csv.Error): ...
 
 if __name__ == '__main__':
     unittest.main()
diff --git a/Lib/test/test_ctypes.py b/Lib/test/test_ctypes.py
index 6826899..b0a12c9 100644
--- a/Lib/test/test_ctypes.py
+++ b/Lib/test/test_ctypes.py
@@ -1,5 +1,6 @@
 import unittest
-from test.support import import_module
+from test.support.import_helper import import_module
+
 
 ctypes_test = import_module('ctypes.test')
 
diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py
index 5e619d1..d3c152c 100644
--- a/Lib/test/test_curses.py
+++ b/Lib/test/test_curses.py
@@ -1,26 +1,18 @@
-#
-# Test script for the curses module
-#
-# This script doesn't actually display anything very coherent. but it
-# does call (nearly) every method and function.
-#
-# Functions not tested: {def,reset}_{shell,prog}_mode, getch(), getstr(),
-# init_color()
-# Only called, not tested: getmouse(), ungetmouse()
-#
-
+import functools
+import inspect
 import os
 import string
 import sys
 import tempfile
 import unittest
 
-from test.support import requires, import_module, verbose, SaveSignals
+from test.support import (requires, verbose, SaveSignals, cpython_only,
+                          check_disallow_instantiation)
+from test.support.import_helper import import_module
 
 # Optionally test curses module.  This currently requires that the
 # 'curses' resource be given on the regrtest command line using the -u
 # option.  If not available, nothing after this line will be executed.
-import inspect
 requires('curses')
 
 # If either of these don't exist, skip the tests.
@@ -36,7 +28,28 @@
     return unittest.skipUnless(hasattr(curses, name),
                                'requires curses.%s' % name)
 
+def requires_curses_window_meth(name):
+    def deco(test):
+        @functools.wraps(test)
+        def wrapped(self, *args, **kwargs):
+            if not hasattr(self.stdscr, name):
+                raise unittest.SkipTest('requires curses.window.%s' % name)
+            test(self, *args, **kwargs)
+        return wrapped
+    return deco
+
+
+def requires_colors(test):
+    @functools.wraps(test)
+    def wrapped(self, *args, **kwargs):
+        if not curses.has_colors():
+            self.skipTest('requires colors support')
+        curses.start_color()
+        test(self, *args, **kwargs)
+    return wrapped
+
 term = os.environ.get('TERM')
+SHORT_MAX = 0x7fff
 
 # If newterm was supported we could use it instead of initscr and not exit
 @unittest.skipIf(not term or term == 'unknown',
@@ -47,254 +60,946 @@
 
     @classmethod
     def setUpClass(cls):
-        if not sys.__stdout__.isatty():
-            # Temporary skip tests on non-tty
-            raise unittest.SkipTest('sys.__stdout__ is not a tty')
-            cls.tmp = tempfile.TemporaryFile()
-            fd = cls.tmp.fileno()
-        else:
-            cls.tmp = None
-            fd = sys.__stdout__.fileno()
+        if verbose:
+            print(f'TERM={term}', file=sys.stderr, flush=True)
         # testing setupterm() inside initscr/endwin
         # causes terminal breakage
-        curses.setupterm(fd=fd)
-
-    @classmethod
-    def tearDownClass(cls):
-        if cls.tmp:
-            cls.tmp.close()
-            del cls.tmp
+        stdout_fd = sys.__stdout__.fileno()
+        curses.setupterm(fd=stdout_fd)
 
     def setUp(self):
+        self.isatty = True
+        self.output = sys.__stdout__
+        stdout_fd = sys.__stdout__.fileno()
+        if not sys.__stdout__.isatty():
+            # initstr() unconditionally uses C stdout.
+            # If it is redirected to file or pipe, try to attach it
+            # to terminal.
+            # First, save a copy of the file descriptor of stdout, so it
+            # can be restored after finishing the test.
+            dup_fd = os.dup(stdout_fd)
+            self.addCleanup(os.close, dup_fd)
+            self.addCleanup(os.dup2, dup_fd, stdout_fd)
+
+            if sys.__stderr__.isatty():
+                # If stderr is connected to terminal, use it.
+                tmp = sys.__stderr__
+                self.output = sys.__stderr__
+            else:
+                try:
+                    # Try to open the terminal device.
+                    tmp = open('/dev/tty', 'wb', buffering=0)
+                except OSError:
+                    # As a fallback, use regular file to write control codes.
+                    # Some functions (like savetty) will not work, but at
+                    # least the garbage control sequences will not be mixed
+                    # with the testing report.
+                    tmp = tempfile.TemporaryFile(mode='wb', buffering=0)
+                    self.isatty = False
+                self.addCleanup(tmp.close)
+                self.output = None
+            os.dup2(tmp.fileno(), stdout_fd)
+
         self.save_signals = SaveSignals()
         self.save_signals.save()
-        if verbose:
+        self.addCleanup(self.save_signals.restore)
+        if verbose and self.output is not None:
             # just to make the test output a little more readable
-            print()
+            sys.stderr.flush()
+            sys.stdout.flush()
+            print(file=self.output, flush=True)
         self.stdscr = curses.initscr()
-        curses.savetty()
+        if self.isatty:
+            curses.savetty()
+            self.addCleanup(curses.endwin)
+            self.addCleanup(curses.resetty)
+        self.stdscr.erase()
 
-    def tearDown(self):
-        curses.resetty()
-        curses.endwin()
-        self.save_signals.restore()
+    @requires_curses_func('filter')
+    def test_filter(self):
+        # TODO: Should be called before initscr() or newterm() are called.
+        # TODO: nofilter()
+        curses.filter()
 
-    def test_window_funcs(self):
-        "Test the methods of windows"
+    @requires_curses_func('use_env')
+    def test_use_env(self):
+        # TODO: Should be called before initscr() or newterm() are called.
+        # TODO: use_tioctl()
+        curses.use_env(False)
+        curses.use_env(True)
+
+    def test_create_windows(self):
+        win = curses.newwin(5, 10)
+        self.assertEqual(win.getbegyx(), (0, 0))
+        self.assertEqual(win.getparyx(), (-1, -1))
+        self.assertEqual(win.getmaxyx(), (5, 10))
+
+        win = curses.newwin(10, 15, 2, 5)
+        self.assertEqual(win.getbegyx(), (2, 5))
+        self.assertEqual(win.getparyx(), (-1, -1))
+        self.assertEqual(win.getmaxyx(), (10, 15))
+
+        win2 = win.subwin(3, 7)
+        self.assertEqual(win2.getbegyx(), (3, 7))
+        self.assertEqual(win2.getparyx(), (1, 2))
+        self.assertEqual(win2.getmaxyx(), (9, 13))
+
+        win2 = win.subwin(5, 10, 3, 7)
+        self.assertEqual(win2.getbegyx(), (3, 7))
+        self.assertEqual(win2.getparyx(), (1, 2))
+        self.assertEqual(win2.getmaxyx(), (5, 10))
+
+        win3 = win.derwin(2, 3)
+        self.assertEqual(win3.getbegyx(), (4, 8))
+        self.assertEqual(win3.getparyx(), (2, 3))
+        self.assertEqual(win3.getmaxyx(), (8, 12))
+
+        win3 = win.derwin(6, 11, 2, 3)
+        self.assertEqual(win3.getbegyx(), (4, 8))
+        self.assertEqual(win3.getparyx(), (2, 3))
+        self.assertEqual(win3.getmaxyx(), (6, 11))
+
+        win.mvwin(0, 1)
+        self.assertEqual(win.getbegyx(), (0, 1))
+        self.assertEqual(win.getparyx(), (-1, -1))
+        self.assertEqual(win.getmaxyx(), (10, 15))
+        self.assertEqual(win2.getbegyx(), (3, 7))
+        self.assertEqual(win2.getparyx(), (1, 2))
+        self.assertEqual(win2.getmaxyx(), (5, 10))
+        self.assertEqual(win3.getbegyx(), (4, 8))
+        self.assertEqual(win3.getparyx(), (2, 3))
+        self.assertEqual(win3.getmaxyx(), (6, 11))
+
+        win2.mvderwin(2, 1)
+        self.assertEqual(win2.getbegyx(), (3, 7))
+        self.assertEqual(win2.getparyx(), (2, 1))
+        self.assertEqual(win2.getmaxyx(), (5, 10))
+
+        win3.mvderwin(2, 1)
+        self.assertEqual(win3.getbegyx(), (4, 8))
+        self.assertEqual(win3.getparyx(), (2, 1))
+        self.assertEqual(win3.getmaxyx(), (6, 11))
+
+    def test_move_cursor(self):
         stdscr = self.stdscr
-        win = curses.newwin(10,10)
-        win = curses.newwin(5,5, 5,5)
-        win2 = curses.newwin(15,15, 5,5)
+        win = stdscr.subwin(10, 15, 2, 5)
+        stdscr.move(1, 2)
+        win.move(2, 4)
+        self.assertEqual(stdscr.getyx(), (1, 2))
+        self.assertEqual(win.getyx(), (2, 4))
 
-        for meth in [stdscr.addch, stdscr.addstr]:
-            for args in [('a',), ('a', curses.A_BOLD),
-                         (4,4, 'a'), (5,5, 'a', curses.A_BOLD)]:
-                with self.subTest(meth=meth.__qualname__, args=args):
-                    meth(*args)
+        win.cursyncup()
+        self.assertEqual(stdscr.getyx(), (4, 9))
 
-        for meth in [stdscr.clear, stdscr.clrtobot,
-                     stdscr.clrtoeol, stdscr.cursyncup, stdscr.delch,
-                     stdscr.deleteln, stdscr.erase, stdscr.getbegyx,
-                     stdscr.getbkgd, stdscr.getkey, stdscr.getmaxyx,
-                     stdscr.getparyx, stdscr.getyx, stdscr.inch,
-                     stdscr.insertln, stdscr.instr, stdscr.is_wintouched,
-                     win.noutrefresh, stdscr.redrawwin, stdscr.refresh,
-                     stdscr.standout, stdscr.standend, stdscr.syncdown,
-                     stdscr.syncup, stdscr.touchwin, stdscr.untouchwin]:
-            with self.subTest(meth=meth.__qualname__):
-                meth()
+    def test_refresh_control(self):
+        stdscr = self.stdscr
+        # touchwin()/untouchwin()/is_wintouched()
+        stdscr.refresh()
+        self.assertIs(stdscr.is_wintouched(), False)
+        stdscr.touchwin()
+        self.assertIs(stdscr.is_wintouched(), True)
+        stdscr.refresh()
+        self.assertIs(stdscr.is_wintouched(), False)
+        stdscr.touchwin()
+        self.assertIs(stdscr.is_wintouched(), True)
+        stdscr.untouchwin()
+        self.assertIs(stdscr.is_wintouched(), False)
 
-        stdscr.addnstr('1234', 3)
-        stdscr.addnstr('1234', 3, curses.A_BOLD)
-        stdscr.addnstr(4,4, '1234', 3)
-        stdscr.addnstr(5,5, '1234', 3, curses.A_BOLD)
+        # touchline()/untouchline()/is_linetouched()
+        stdscr.touchline(5, 2)
+        self.assertIs(stdscr.is_linetouched(5), True)
+        self.assertIs(stdscr.is_linetouched(6), True)
+        self.assertIs(stdscr.is_wintouched(), True)
+        stdscr.touchline(5, 1, False)
+        self.assertIs(stdscr.is_linetouched(5), False)
 
-        stdscr.attron(curses.A_BOLD)
-        stdscr.attroff(curses.A_BOLD)
-        stdscr.attrset(curses.A_BOLD)
-        stdscr.bkgd(' ')
-        stdscr.bkgd(' ', curses.A_REVERSE)
-        stdscr.bkgdset(' ')
-        stdscr.bkgdset(' ', curses.A_REVERSE)
+        # syncup()
+        win = stdscr.subwin(10, 15, 2, 5)
+        win2 = win.subwin(5, 10, 3, 7)
+        win2.touchwin()
+        stdscr.untouchwin()
+        win2.syncup()
+        self.assertIs(win.is_wintouched(), True)
+        self.assertIs(stdscr.is_wintouched(), True)
 
-        win.border(65, 66, 67, 68,
-                   69, 70, 71, 72)
+        # syncdown()
+        stdscr.touchwin()
+        win.untouchwin()
+        win2.untouchwin()
+        win2.syncdown()
+        self.assertIs(win2.is_wintouched(), True)
+
+        # syncok()
+        if hasattr(stdscr, 'syncok') and not sys.platform.startswith("sunos"):
+            win.untouchwin()
+            stdscr.untouchwin()
+            for syncok in [False, True]:
+                win2.syncok(syncok)
+                win2.addch('a')
+                self.assertIs(win.is_wintouched(), syncok)
+                self.assertIs(stdscr.is_wintouched(), syncok)
+
+    def test_output_character(self):
+        stdscr = self.stdscr
+        encoding = stdscr.encoding
+        # addch()
+        stdscr.refresh()
+        stdscr.move(0, 0)
+        stdscr.addch('A')
+        stdscr.addch(b'A')
+        stdscr.addch(65)
+        c = '\u20ac'
+        try:
+            stdscr.addch(c)
+        except UnicodeEncodeError:
+            self.assertRaises(UnicodeEncodeError, c.encode, encoding)
+        except OverflowError:
+            encoded = c.encode(encoding)
+            self.assertNotEqual(len(encoded), 1, repr(encoded))
+        stdscr.addch('A', curses.A_BOLD)
+        stdscr.addch(1, 2, 'A')
+        stdscr.addch(2, 3, 'A', curses.A_BOLD)
+        self.assertIs(stdscr.is_wintouched(), True)
+
+        # echochar()
+        stdscr.refresh()
+        stdscr.move(0, 0)
+        stdscr.echochar('A')
+        stdscr.echochar(b'A')
+        stdscr.echochar(65)
+        with self.assertRaises((UnicodeEncodeError, OverflowError)):
+            stdscr.echochar('\u20ac')
+        stdscr.echochar('A', curses.A_BOLD)
+        self.assertIs(stdscr.is_wintouched(), False)
+
+    def test_output_string(self):
+        stdscr = self.stdscr
+        encoding = stdscr.encoding
+        # addstr()/insstr()
+        for func in [stdscr.addstr, stdscr.insstr]:
+            with self.subTest(func.__qualname__):
+                stdscr.move(0, 0)
+                func('abcd')
+                func(b'abcd')
+                s = 'àßçđ'
+                try:
+                    func(s)
+                except UnicodeEncodeError:
+                    self.assertRaises(UnicodeEncodeError, s.encode, encoding)
+                func('abcd', curses.A_BOLD)
+                func(1, 2, 'abcd')
+                func(2, 3, 'abcd', curses.A_BOLD)
+
+        # addnstr()/insnstr()
+        for func in [stdscr.addnstr, stdscr.insnstr]:
+            with self.subTest(func.__qualname__):
+                stdscr.move(0, 0)
+                func('1234', 3)
+                func(b'1234', 3)
+                s = '\u0661\u0662\u0663\u0664'
+                try:
+                    func(s, 3)
+                except UnicodeEncodeError:
+                    self.assertRaises(UnicodeEncodeError, s.encode, encoding)
+                func('1234', 5)
+                func('1234', 3, curses.A_BOLD)
+                func(1, 2, '1234', 3)
+                func(2, 3, '1234', 3, curses.A_BOLD)
+
+    def test_output_string_embedded_null_chars(self):
+        # reject embedded null bytes and characters
+        stdscr = self.stdscr
+        for arg in ['a\0', b'a\0']:
+            with self.subTest(arg=arg):
+                self.assertRaises(ValueError, stdscr.addstr, arg)
+                self.assertRaises(ValueError, stdscr.addnstr, arg, 1)
+                self.assertRaises(ValueError, stdscr.insstr, arg)
+                self.assertRaises(ValueError, stdscr.insnstr, arg, 1)
+
+    def test_read_from_window(self):
+        stdscr = self.stdscr
+        stdscr.addstr(0, 1, 'ABCD', curses.A_BOLD)
+        # inch()
+        stdscr.move(0, 1)
+        self.assertEqual(stdscr.inch(), 65 | curses.A_BOLD)
+        self.assertEqual(stdscr.inch(0, 3), 67 | curses.A_BOLD)
+        stdscr.move(0, 0)
+        # instr()
+        self.assertEqual(stdscr.instr()[:6], b' ABCD ')
+        self.assertEqual(stdscr.instr(3)[:6], b' AB')
+        self.assertEqual(stdscr.instr(0, 2)[:4], b'BCD ')
+        self.assertEqual(stdscr.instr(0, 2, 4), b'BCD ')
+        self.assertRaises(ValueError, stdscr.instr, -2)
+        self.assertRaises(ValueError, stdscr.instr, 0, 2, -2)
+
+    def test_getch(self):
+        win = curses.newwin(5, 12, 5, 2)
+
+        # TODO: Test with real input by writing to master fd.
+        for c in 'spam\n'[::-1]:
+            curses.ungetch(c)
+        self.assertEqual(win.getch(3, 1), b's'[0])
+        self.assertEqual(win.getyx(), (3, 1))
+        self.assertEqual(win.getch(3, 4), b'p'[0])
+        self.assertEqual(win.getyx(), (3, 4))
+        self.assertEqual(win.getch(), b'a'[0])
+        self.assertEqual(win.getyx(), (3, 4))
+        self.assertEqual(win.getch(), b'm'[0])
+        self.assertEqual(win.getch(), b'\n'[0])
+
+    def test_getstr(self):
+        win = curses.newwin(5, 12, 5, 2)
+        curses.echo()
+        self.addCleanup(curses.noecho)
+
+        self.assertRaises(ValueError, win.getstr, -400)
+        self.assertRaises(ValueError, win.getstr, 2, 3, -400)
+
+        # TODO: Test with real input by writing to master fd.
+        for c in 'Lorem\nipsum\ndolor\nsit\namet\n'[::-1]:
+            curses.ungetch(c)
+        self.assertEqual(win.getstr(3, 1, 2), b'Lo')
+        self.assertEqual(win.instr(3, 0), b' Lo         ')
+        self.assertEqual(win.getstr(3, 5, 10), b'ipsum')
+        self.assertEqual(win.instr(3, 0), b' Lo  ipsum  ')
+        self.assertEqual(win.getstr(1, 5), b'dolor')
+        self.assertEqual(win.instr(1, 0), b'     dolor  ')
+        self.assertEqual(win.getstr(2), b'si')
+        self.assertEqual(win.instr(1, 0), b'si   dolor  ')
+        self.assertEqual(win.getstr(), b'amet')
+        self.assertEqual(win.instr(1, 0), b'amet dolor  ')
+
+    def test_clear(self):
+        win = curses.newwin(5, 15, 5, 2)
+        lorem_ipsum(win)
+
+        win.move(0, 8)
+        win.clrtoeol()
+        self.assertEqual(win.instr(0, 0).rstrip(), b'Lorem ip')
+        self.assertEqual(win.instr(1, 0).rstrip(), b'dolor sit amet,')
+
+        win.move(0, 3)
+        win.clrtobot()
+        self.assertEqual(win.instr(0, 0).rstrip(), b'Lor')
+        self.assertEqual(win.instr(1, 0).rstrip(), b'')
+
+        for func in [win.erase, win.clear]:
+            lorem_ipsum(win)
+            func()
+            self.assertEqual(win.instr(0, 0).rstrip(), b'')
+            self.assertEqual(win.instr(1, 0).rstrip(), b'')
+
+    def test_insert_delete(self):
+        win = curses.newwin(5, 15, 5, 2)
+        lorem_ipsum(win)
+
+        win.move(0, 2)
+        win.delch()
+        self.assertEqual(win.instr(0, 0), b'Loem ipsum     ')
+        win.delch(0, 7)
+        self.assertEqual(win.instr(0, 0), b'Loem ipum      ')
+
+        win.move(1, 5)
+        win.deleteln()
+        self.assertEqual(win.instr(0, 0), b'Loem ipum      ')
+        self.assertEqual(win.instr(1, 0), b'consectetur    ')
+        self.assertEqual(win.instr(2, 0), b'adipiscing elit')
+        self.assertEqual(win.instr(3, 0), b'sed do eiusmod ')
+        self.assertEqual(win.instr(4, 0), b'               ')
+
+        win.move(1, 5)
+        win.insertln()
+        self.assertEqual(win.instr(0, 0), b'Loem ipum      ')
+        self.assertEqual(win.instr(1, 0), b'               ')
+        self.assertEqual(win.instr(2, 0), b'consectetur    ')
+
+        win.clear()
+        lorem_ipsum(win)
+        win.move(1, 5)
+        win.insdelln(2)
+        self.assertEqual(win.instr(0, 0), b'Lorem ipsum    ')
+        self.assertEqual(win.instr(1, 0), b'               ')
+        self.assertEqual(win.instr(2, 0), b'               ')
+        self.assertEqual(win.instr(3, 0), b'dolor sit amet,')
+
+        win.clear()
+        lorem_ipsum(win)
+        win.move(1, 5)
+        win.insdelln(-2)
+        self.assertEqual(win.instr(0, 0), b'Lorem ipsum    ')
+        self.assertEqual(win.instr(1, 0), b'adipiscing elit')
+        self.assertEqual(win.instr(2, 0), b'sed do eiusmod ')
+        self.assertEqual(win.instr(3, 0), b'               ')
+
+    def test_scroll(self):
+        win = curses.newwin(5, 15, 5, 2)
+        lorem_ipsum(win)
+        win.scrollok(True)
+        win.scroll()
+        self.assertEqual(win.instr(0, 0), b'dolor sit amet,')
+        win.scroll(2)
+        self.assertEqual(win.instr(0, 0), b'adipiscing elit')
+        win.scroll(-3)
+        self.assertEqual(win.instr(0, 0), b'               ')
+        self.assertEqual(win.instr(2, 0), b'               ')
+        self.assertEqual(win.instr(3, 0), b'adipiscing elit')
+        win.scrollok(False)
+
+    def test_attributes(self):
+        # TODO: attr_get(), attr_set(), ...
+        win = curses.newwin(5, 15, 5, 2)
+        win.attron(curses.A_BOLD)
+        win.attroff(curses.A_BOLD)
+        win.attrset(curses.A_BOLD)
+
+        win.standout()
+        win.standend()
+
+    @requires_curses_window_meth('chgat')
+    def test_chgat(self):
+        win = curses.newwin(5, 15, 5, 2)
+        win.addstr(2, 0, 'Lorem ipsum')
+        win.addstr(3, 0, 'dolor sit amet')
+
+        win.move(2, 8)
+        win.chgat(curses.A_BLINK)
+        self.assertEqual(win.inch(2, 7), b'p'[0])
+        self.assertEqual(win.inch(2, 8), b's'[0] | curses.A_BLINK)
+        self.assertEqual(win.inch(2, 14), b' '[0] | curses.A_BLINK)
+
+        win.move(2, 1)
+        win.chgat(3, curses.A_BOLD)
+        self.assertEqual(win.inch(2, 0), b'L'[0])
+        self.assertEqual(win.inch(2, 1), b'o'[0] | curses.A_BOLD)
+        self.assertEqual(win.inch(2, 3), b'e'[0] | curses.A_BOLD)
+        self.assertEqual(win.inch(2, 4), b'm'[0])
+
+        win.chgat(3, 2, curses.A_UNDERLINE)
+        self.assertEqual(win.inch(3, 1), b'o'[0])
+        self.assertEqual(win.inch(3, 2), b'l'[0] | curses.A_UNDERLINE)
+        self.assertEqual(win.inch(3, 14), b' '[0] | curses.A_UNDERLINE)
+
+        win.chgat(3, 4, 7, curses.A_BLINK)
+        self.assertEqual(win.inch(3, 3), b'o'[0] | curses.A_UNDERLINE)
+        self.assertEqual(win.inch(3, 4), b'r'[0] | curses.A_BLINK)
+        self.assertEqual(win.inch(3, 10), b'a'[0] | curses.A_BLINK)
+        self.assertEqual(win.inch(3, 11), b'm'[0] | curses.A_UNDERLINE)
+        self.assertEqual(win.inch(3, 14), b' '[0] | curses.A_UNDERLINE)
+
+    def test_background(self):
+        win = curses.newwin(5, 15, 5, 2)
+        win.addstr(0, 0, 'Lorem ipsum')
+
+        self.assertIn(win.getbkgd(), (0, 32))
+
+        # bkgdset()
+        win.bkgdset('_')
+        self.assertEqual(win.getbkgd(), b'_'[0])
+        win.bkgdset(b'#')
+        self.assertEqual(win.getbkgd(), b'#'[0])
+        win.bkgdset(65)
+        self.assertEqual(win.getbkgd(), 65)
+        win.bkgdset(0)
+        self.assertEqual(win.getbkgd(), 32)
+
+        win.bkgdset('#', curses.A_REVERSE)
+        self.assertEqual(win.getbkgd(), b'#'[0] | curses.A_REVERSE)
+        self.assertEqual(win.inch(0, 0), b'L'[0])
+        self.assertEqual(win.inch(0, 5), b' '[0])
+        win.bkgdset(0)
+
+        # bkgd()
+        win.bkgd('_')
+        self.assertEqual(win.getbkgd(), b'_'[0])
+        self.assertEqual(win.inch(0, 0), b'L'[0])
+        self.assertEqual(win.inch(0, 5), b'_'[0])
+
+        win.bkgd('#', curses.A_REVERSE)
+        self.assertEqual(win.getbkgd(), b'#'[0] | curses.A_REVERSE)
+        self.assertEqual(win.inch(0, 0), b'L'[0] | curses.A_REVERSE)
+        self.assertEqual(win.inch(0, 5), b'#'[0] | curses.A_REVERSE)
+
+    def test_overlay(self):
+        srcwin = curses.newwin(5, 18, 3, 4)
+        lorem_ipsum(srcwin)
+        dstwin = curses.newwin(7, 17, 5, 7)
+        for i in range(6):
+            dstwin.addstr(i, 0, '_'*17)
+
+        srcwin.overlay(dstwin)
+        self.assertEqual(dstwin.instr(0, 0), b'sectetur_________')
+        self.assertEqual(dstwin.instr(1, 0), b'piscing_elit,____')
+        self.assertEqual(dstwin.instr(2, 0), b'_do_eiusmod______')
+        self.assertEqual(dstwin.instr(3, 0), b'_________________')
+
+        srcwin.overwrite(dstwin)
+        self.assertEqual(dstwin.instr(0, 0), b'sectetur       __')
+        self.assertEqual(dstwin.instr(1, 0), b'piscing elit,  __')
+        self.assertEqual(dstwin.instr(2, 0), b' do eiusmod    __')
+        self.assertEqual(dstwin.instr(3, 0), b'_________________')
+
+        srcwin.overlay(dstwin, 1, 4, 3, 2, 4, 11)
+        self.assertEqual(dstwin.instr(3, 0), b'__r_sit_amet_____')
+        self.assertEqual(dstwin.instr(4, 0), b'__ectetur________')
+        self.assertEqual(dstwin.instr(5, 0), b'_________________')
+
+        srcwin.overwrite(dstwin, 1, 4, 3, 2, 4, 11)
+        self.assertEqual(dstwin.instr(3, 0), b'__r sit amet_____')
+        self.assertEqual(dstwin.instr(4, 0), b'__ectetur   _____')
+        self.assertEqual(dstwin.instr(5, 0), b'_________________')
+
+    def test_refresh(self):
+        win = curses.newwin(5, 15, 2, 5)
+        win.noutrefresh()
+        win.redrawln(1, 2)
+        win.redrawwin()
+        win.refresh()
+        curses.doupdate()
+
+    @requires_curses_window_meth('resize')
+    def test_resize(self):
+        win = curses.newwin(5, 15, 2, 5)
+        win.resize(4, 20)
+        self.assertEqual(win.getmaxyx(), (4, 20))
+        win.resize(5, 15)
+        self.assertEqual(win.getmaxyx(), (5, 15))
+
+    @requires_curses_window_meth('enclose')
+    def test_enclose(self):
+        win = curses.newwin(5, 15, 2, 5)
+        self.assertIs(win.enclose(2, 5), True)
+        self.assertIs(win.enclose(1, 5), False)
+        self.assertIs(win.enclose(2, 4), False)
+        self.assertIs(win.enclose(6, 19), True)
+        self.assertIs(win.enclose(7, 19), False)
+        self.assertIs(win.enclose(6, 20), False)
+
+    def test_putwin(self):
+        win = curses.newwin(5, 12, 1, 2)
+        win.addstr(2, 1, 'Lorem ipsum')
+        with tempfile.TemporaryFile() as f:
+            win.putwin(f)
+            del win
+            f.seek(0)
+            win = curses.getwin(f)
+            self.assertEqual(win.getbegyx(), (1, 2))
+            self.assertEqual(win.getmaxyx(), (5, 12))
+            self.assertEqual(win.instr(2, 0), b' Lorem ipsum')
+
+    def test_borders_and_lines(self):
+        win = curses.newwin(5, 10, 5, 2)
         win.border('|', '!', '-', '_',
                    '+', '\\', '#', '/')
-        with self.assertRaises(TypeError,
-                               msg="Expected win.border() to raise TypeError"):
-            win.border(65, 66, 67, 68,
-                       69, [], 71, 72)
+        self.assertEqual(win.instr(0, 0), b'+--------\\')
+        self.assertEqual(win.instr(1, 0), b'|        !')
+        self.assertEqual(win.instr(4, 0), b'#________/')
+        win.border(b'|', b'!', b'-', b'_',
+                   b'+', b'\\', b'#', b'/')
+        win.border(65, 66, 67, 68,
+                   69, 70, 71, 72)
+        self.assertRaises(TypeError, win.border,
+                          65, 66, 67, 68, 69, [], 71, 72)
+        self.assertRaises(TypeError, win.border,
+                          65, 66, 67, 68, 69, 70, 71, 72, 73)
+        self.assertRaises(TypeError, win.border,
+                          65, 66, 67, 68, 69, 70, 71, 72, 73)
+        win.border(65, 66, 67, 68, 69, 70, 71)
+        win.border(65, 66, 67, 68, 69, 70)
+        win.border(65, 66, 67, 68, 69)
+        win.border(65, 66, 67, 68)
+        win.border(65, 66, 67)
+        win.border(65, 66)
+        win.border(65)
+        win.border()
 
-        win.box(65, 67)
-        win.box('!', '_')
+        win.box(':', '~')
+        self.assertEqual(win.instr(0, 1, 8), b'~~~~~~~~')
+        self.assertEqual(win.instr(1, 0),   b':        :')
+        self.assertEqual(win.instr(4, 1, 8), b'~~~~~~~~')
         win.box(b':', b'~')
+        win.box(65, 67)
         self.assertRaises(TypeError, win.box, 65, 66, 67)
         self.assertRaises(TypeError, win.box, 65)
         win.box()
 
-        stdscr.clearok(1)
+        win.move(1, 2)
+        win.hline('-', 5)
+        self.assertEqual(win.instr(1, 1, 7), b' ----- ')
+        win.hline(b'-', 5)
+        win.hline(45, 5)
+        win.hline('-', 5, curses.A_BOLD)
+        win.hline(1, 1, '-', 5)
+        win.hline(1, 1, '-', 5, curses.A_BOLD)
 
-        win4 = stdscr.derwin(2,2)
-        win4 = stdscr.derwin(1,1, 5,5)
-        win4.mvderwin(9,9)
+        win.move(1, 2)
+        win.vline('a', 3)
+        win.vline(b'a', 3)
+        win.vline(97, 3)
+        win.vline('a', 3, curses.A_STANDOUT)
+        win.vline(1, 1, 'a', 3)
+        win.vline(1, 1, ';', 2, curses.A_STANDOUT)
+        self.assertEqual(win.inch(1, 1), b';'[0] | curses.A_STANDOUT)
+        self.assertEqual(win.inch(2, 1), b';'[0] | curses.A_STANDOUT)
+        self.assertEqual(win.inch(3, 1), b'a'[0])
 
-        stdscr.echochar('a')
-        stdscr.echochar('a', curses.A_BOLD)
-        stdscr.hline('-', 5)
-        stdscr.hline('-', 5, curses.A_BOLD)
-        stdscr.hline(1,1,'-', 5)
-        stdscr.hline(1,1,'-', 5, curses.A_BOLD)
+    def test_unctrl(self):
+        # TODO: wunctrl()
+        self.assertEqual(curses.unctrl(b'A'), b'A')
+        self.assertEqual(curses.unctrl('A'), b'A')
+        self.assertEqual(curses.unctrl(65), b'A')
+        self.assertEqual(curses.unctrl(b'\n'), b'^J')
+        self.assertEqual(curses.unctrl('\n'), b'^J')
+        self.assertEqual(curses.unctrl(10), b'^J')
+        self.assertRaises(TypeError, curses.unctrl, b'')
+        self.assertRaises(TypeError, curses.unctrl, b'AB')
+        self.assertRaises(TypeError, curses.unctrl, '')
+        self.assertRaises(TypeError, curses.unctrl, 'AB')
+        self.assertRaises(OverflowError, curses.unctrl, 2**64)
 
-        stdscr.idcok(1)
-        stdscr.idlok(1)
-        if hasattr(stdscr, 'immedok'):
-            stdscr.immedok(1)
-            stdscr.immedok(0)
-        stdscr.insch('c')
-        stdscr.insdelln(1)
-        stdscr.insnstr('abc', 3)
-        stdscr.insnstr('abc', 3, curses.A_BOLD)
-        stdscr.insnstr(5, 5, 'abc', 3)
-        stdscr.insnstr(5, 5, 'abc', 3, curses.A_BOLD)
+    def test_endwin(self):
+        if not self.isatty:
+            self.skipTest('requires terminal')
+        self.assertIs(curses.isendwin(), False)
+        curses.endwin()
+        self.assertIs(curses.isendwin(), True)
+        curses.doupdate()
+        self.assertIs(curses.isendwin(), False)
 
-        stdscr.insstr('def')
-        stdscr.insstr('def', curses.A_BOLD)
-        stdscr.insstr(5, 5, 'def')
-        stdscr.insstr(5, 5, 'def', curses.A_BOLD)
-        stdscr.is_linetouched(0)
-        stdscr.keypad(1)
-        stdscr.leaveok(1)
-        stdscr.move(3,3)
-        win.mvwin(2,2)
-        stdscr.nodelay(1)
-        stdscr.notimeout(1)
-        win2.overlay(win)
-        win2.overwrite(win)
-        win2.overlay(win, 1, 2, 2, 1, 3, 3)
-        win2.overwrite(win, 1, 2, 2, 1, 3, 3)
-        stdscr.redrawln(1,2)
+    def test_terminfo(self):
+        self.assertIsInstance(curses.tigetflag('hc'), int)
+        self.assertEqual(curses.tigetflag('cols'), -1)
+        self.assertEqual(curses.tigetflag('cr'), -1)
 
-        stdscr.scrollok(1)
-        stdscr.scroll()
-        stdscr.scroll(2)
-        stdscr.scroll(-3)
+        self.assertIsInstance(curses.tigetnum('cols'), int)
+        self.assertEqual(curses.tigetnum('hc'), -2)
+        self.assertEqual(curses.tigetnum('cr'), -2)
 
-        stdscr.move(12, 2)
-        stdscr.setscrreg(10,15)
-        win3 = stdscr.subwin(10,10)
-        win3 = stdscr.subwin(10,10, 5,5)
-        if hasattr(stdscr, 'syncok') and not sys.platform.startswith("sunos"):
-            stdscr.syncok(1)
-        stdscr.timeout(5)
-        stdscr.touchline(5,5)
-        stdscr.touchline(5,5,0)
-        stdscr.vline('a', 3)
-        stdscr.vline('a', 3, curses.A_STANDOUT)
-        if hasattr(stdscr, 'chgat'):
-            stdscr.chgat(5, 2, 3, curses.A_BLINK)
-            stdscr.chgat(3, curses.A_BOLD)
-            stdscr.chgat(5, 8, curses.A_UNDERLINE)
-            stdscr.chgat(curses.A_BLINK)
-        stdscr.refresh()
+        self.assertIsInstance(curses.tigetstr('cr'), (bytes, type(None)))
+        self.assertIsNone(curses.tigetstr('hc'))
+        self.assertIsNone(curses.tigetstr('cols'))
 
-        stdscr.vline(1,1, 'a', 3)
-        stdscr.vline(1,1, 'a', 3, curses.A_STANDOUT)
+        cud = curses.tigetstr('cud')
+        if cud is not None:
+            # See issue10570.
+            self.assertIsInstance(cud, bytes)
+            curses.tparm(cud, 2)
+            cud_2 = curses.tparm(cud, 2)
+            self.assertIsInstance(cud_2, bytes)
+            curses.putp(cud_2)
 
-        if hasattr(stdscr, 'resize'):
-            stdscr.resize(25, 80)
-        if hasattr(stdscr, 'enclose'):
-            stdscr.enclose(10, 10)
+        curses.putp(b'abc\n')
 
-        self.assertRaises(ValueError, stdscr.getstr, -400)
-        self.assertRaises(ValueError, stdscr.getstr, 2, 3, -400)
-        self.assertRaises(ValueError, stdscr.instr, -2)
-        self.assertRaises(ValueError, stdscr.instr, 2, 3, -2)
-
-    def test_embedded_null_chars(self):
-        # reject embedded null bytes and characters
-        stdscr = self.stdscr
-        for arg in ['a', b'a']:
-            with self.subTest(arg=arg):
-                self.assertRaises(ValueError, stdscr.addstr, 'a\0')
-                self.assertRaises(ValueError, stdscr.addnstr, 'a\0', 1)
-                self.assertRaises(ValueError, stdscr.insstr, 'a\0')
-                self.assertRaises(ValueError, stdscr.insnstr, 'a\0', 1)
-
-    def test_module_funcs(self):
-        "Test module-level functions"
-        for func in [curses.baudrate, curses.beep, curses.can_change_color,
-                     curses.cbreak, curses.def_prog_mode, curses.doupdate,
-                     curses.flash, curses.flushinp,
-                     curses.has_colors, curses.has_ic, curses.has_il,
-                     curses.isendwin, curses.killchar, curses.longname,
-                     curses.nocbreak, curses.noecho, curses.nonl,
-                     curses.noqiflush, curses.noraw,
-                     curses.reset_prog_mode, curses.termattrs,
-                     curses.termname, curses.erasechar]:
-            with self.subTest(func=func.__qualname__):
-                func()
-        if hasattr(curses, 'filter'):
-            curses.filter()
-        if hasattr(curses, 'getsyx'):
-            curses.getsyx()
-
-        # Functions that actually need arguments
-        if curses.tigetstr("cnorm"):
-            curses.curs_set(1)
+    def test_misc_module_funcs(self):
         curses.delay_output(1)
-        curses.echo() ; curses.echo(1)
+        curses.flushinp()
 
-        with tempfile.TemporaryFile() as f:
-            self.stdscr.putwin(f)
-            f.seek(0)
-            curses.getwin(f)
+        curses.doupdate()
+        self.assertIs(curses.isendwin(), False)
 
-        curses.halfdelay(1)
-        curses.intrflush(1)
-        curses.meta(1)
         curses.napms(100)
-        curses.newpad(50,50)
-        win = curses.newwin(5,5)
-        win = curses.newwin(5,5, 1,1)
-        curses.nl() ; curses.nl(1)
-        curses.putp(b'abc')
+
+        curses.newpad(50, 50)
+
+    def test_env_queries(self):
+        # TODO: term_attrs(), erasewchar(), killwchar()
+        self.assertIsInstance(curses.termname(), bytes)
+        self.assertIsInstance(curses.longname(), bytes)
+        self.assertIsInstance(curses.baudrate(), int)
+        self.assertIsInstance(curses.has_ic(), bool)
+        self.assertIsInstance(curses.has_il(), bool)
+        self.assertIsInstance(curses.termattrs(), int)
+
+        c = curses.killchar()
+        self.assertIsInstance(c, bytes)
+        self.assertEqual(len(c), 1)
+        c = curses.erasechar()
+        self.assertIsInstance(c, bytes)
+        self.assertEqual(len(c), 1)
+
+    def test_output_options(self):
+        stdscr = self.stdscr
+
+        stdscr.clearok(True)
+        stdscr.clearok(False)
+
+        stdscr.idcok(True)
+        stdscr.idcok(False)
+
+        stdscr.idlok(False)
+        stdscr.idlok(True)
+
+        if hasattr(stdscr, 'immedok'):
+            stdscr.immedok(True)
+            stdscr.immedok(False)
+
+        stdscr.leaveok(True)
+        stdscr.leaveok(False)
+
+        stdscr.scrollok(True)
+        stdscr.scrollok(False)
+
+        stdscr.setscrreg(5, 10)
+
+        curses.nonl()
+        curses.nl(True)
+        curses.nl(False)
+        curses.nl()
+
+
+    def test_input_options(self):
+        stdscr = self.stdscr
+
+        if self.isatty:
+            curses.nocbreak()
+            curses.cbreak()
+            curses.cbreak(False)
+            curses.cbreak(True)
+
+            curses.intrflush(True)
+            curses.intrflush(False)
+
+            curses.raw()
+            curses.raw(False)
+            curses.raw(True)
+            curses.noraw()
+
+        curses.noecho()
+        curses.echo()
+        curses.echo(False)
+        curses.echo(True)
+
+        curses.halfdelay(255)
+        curses.halfdelay(1)
+
+        stdscr.keypad(True)
+        stdscr.keypad(False)
+
+        curses.meta(True)
+        curses.meta(False)
+
+        stdscr.nodelay(True)
+        stdscr.nodelay(False)
+
+        curses.noqiflush()
+        curses.qiflush(True)
+        curses.qiflush(False)
         curses.qiflush()
-        curses.raw() ; curses.raw(1)
+
+        stdscr.notimeout(True)
+        stdscr.notimeout(False)
+
+        stdscr.timeout(-1)
+        stdscr.timeout(0)
+        stdscr.timeout(5)
+
+    @requires_curses_func('typeahead')
+    def test_typeahead(self):
+        curses.typeahead(sys.__stdin__.fileno())
+        curses.typeahead(-1)
+
+    def test_prog_mode(self):
+        if not self.isatty:
+            self.skipTest('requires terminal')
+        curses.def_prog_mode()
+        curses.reset_prog_mode()
+
+    def test_beep(self):
+        if (curses.tigetstr("bel") is not None
+            or curses.tigetstr("flash") is not None):
+            curses.beep()
+        else:
+            try:
+                curses.beep()
+            except curses.error:
+                self.skipTest('beep() failed')
+
+    def test_flash(self):
+        if (curses.tigetstr("bel") is not None
+            or curses.tigetstr("flash") is not None):
+            curses.flash()
+        else:
+            try:
+                curses.flash()
+            except curses.error:
+                self.skipTest('flash() failed')
+
+    def test_curs_set(self):
+        for vis, cap in [(0, 'civis'), (2, 'cvvis'), (1, 'cnorm')]:
+            if curses.tigetstr(cap) is not None:
+                curses.curs_set(vis)
+            else:
+                try:
+                    curses.curs_set(vis)
+                except curses.error:
+                    pass
+
+    @requires_curses_func('get_escdelay')
+    def test_escdelay(self):
+        escdelay = curses.get_escdelay()
+        self.assertIsInstance(escdelay, int)
         curses.set_escdelay(25)
         self.assertEqual(curses.get_escdelay(), 25)
+        curses.set_escdelay(escdelay)
+
+    @requires_curses_func('get_tabsize')
+    def test_tabsize(self):
+        tabsize = curses.get_tabsize()
+        self.assertIsInstance(tabsize, int)
         curses.set_tabsize(4)
         self.assertEqual(curses.get_tabsize(), 4)
-        if hasattr(curses, 'setsyx'):
-            curses.setsyx(5,5)
-        curses.tigetflag('hc')
-        curses.tigetnum('co')
-        curses.tigetstr('cr')
-        curses.tparm(b'cr')
-        if hasattr(curses, 'typeahead'):
-            curses.typeahead(sys.__stdin__.fileno())
-        curses.unctrl('a')
-        curses.ungetch('a')
-        if hasattr(curses, 'use_env'):
-            curses.use_env(1)
+        curses.set_tabsize(tabsize)
 
-    # Functions only available on a few platforms
-    def test_colors_funcs(self):
+    @requires_curses_func('getsyx')
+    def test_getsyx(self):
+        y, x = curses.getsyx()
+        self.assertIsInstance(y, int)
+        self.assertIsInstance(x, int)
+        curses.setsyx(4, 5)
+        self.assertEqual(curses.getsyx(), (4, 5))
+
+    def bad_colors(self):
+        return (-1, curses.COLORS, -2**31 - 1, 2**31, -2**63 - 1, 2**63, 2**64)
+
+    def bad_colors2(self):
+        return (curses.COLORS, 2**31, 2**63, 2**64)
+
+    def bad_pairs(self):
+        return (-1, -2**31 - 1, 2**31, -2**63 - 1, 2**63, 2**64)
+
+    def test_has_colors(self):
+        self.assertIsInstance(curses.has_colors(), bool)
+        self.assertIsInstance(curses.can_change_color(), bool)
+
+    def test_start_color(self):
         if not curses.has_colors():
             self.skipTest('requires colors support')
         curses.start_color()
-        curses.init_pair(2, 1,1)
-        curses.color_content(1)
-        curses.color_pair(2)
-        curses.pair_content(curses.COLOR_PAIRS - 1)
-        curses.pair_number(0)
+        if verbose:
+            print(f'COLORS = {curses.COLORS}', file=sys.stderr)
+            print(f'COLOR_PAIRS = {curses.COLOR_PAIRS}', file=sys.stderr)
 
-        if hasattr(curses, 'use_default_colors'):
+    @requires_colors
+    def test_color_content(self):
+        self.assertEqual(curses.color_content(curses.COLOR_BLACK), (0, 0, 0))
+        curses.color_content(0)
+        maxcolor = curses.COLORS - 1
+        curses.color_content(maxcolor)
+
+        for color in self.bad_colors():
+            self.assertRaises(ValueError, curses.color_content, color)
+
+    @requires_colors
+    def test_init_color(self):
+        if not curses.can_change_color():
+            self.skipTest('cannot change color')
+
+        old = curses.color_content(0)
+        try:
+            curses.init_color(0, *old)
+        except curses.error:
+            self.skipTest('cannot change color (init_color() failed)')
+        self.addCleanup(curses.init_color, 0, *old)
+        curses.init_color(0, 0, 0, 0)
+        self.assertEqual(curses.color_content(0), (0, 0, 0))
+        curses.init_color(0, 1000, 1000, 1000)
+        self.assertEqual(curses.color_content(0), (1000, 1000, 1000))
+
+        maxcolor = curses.COLORS - 1
+        old = curses.color_content(maxcolor)
+        curses.init_color(maxcolor, *old)
+        self.addCleanup(curses.init_color, maxcolor, *old)
+        curses.init_color(maxcolor, 0, 500, 1000)
+        self.assertEqual(curses.color_content(maxcolor), (0, 500, 1000))
+
+        for color in self.bad_colors():
+            self.assertRaises(ValueError, curses.init_color, color, 0, 0, 0)
+        for comp in (-1, 1001):
+            self.assertRaises(ValueError, curses.init_color, 0, comp, 0, 0)
+            self.assertRaises(ValueError, curses.init_color, 0, 0, comp, 0)
+            self.assertRaises(ValueError, curses.init_color, 0, 0, 0, comp)
+
+    def get_pair_limit(self):
+        pair_limit = curses.COLOR_PAIRS
+        if hasattr(curses, 'ncurses_version'):
+            if curses.has_extended_color_support():
+                pair_limit += 2*curses.COLORS + 1
+            if (not curses.has_extended_color_support()
+                    or (6, 1) <= curses.ncurses_version < (6, 2)):
+                pair_limit = min(pair_limit, SHORT_MAX)
+            # If use_default_colors() is called, the upper limit of the extended
+            # range may be restricted, so we need to check if the limit is still
+            # correct
+            try:
+                curses.init_pair(pair_limit - 1, 0, 0)
+            except ValueError:
+                pair_limit = curses.COLOR_PAIRS
+        return pair_limit
+
+    @requires_colors
+    def test_pair_content(self):
+        if not hasattr(curses, 'use_default_colors'):
+            self.assertEqual(curses.pair_content(0),
+                             (curses.COLOR_WHITE, curses.COLOR_BLACK))
+        curses.pair_content(0)
+        maxpair = self.get_pair_limit() - 1
+        if maxpair > 0:
+            curses.pair_content(maxpair)
+
+        for pair in self.bad_pairs():
+            self.assertRaises(ValueError, curses.pair_content, pair)
+
+    @requires_colors
+    def test_init_pair(self):
+        old = curses.pair_content(1)
+        curses.init_pair(1, *old)
+        self.addCleanup(curses.init_pair, 1, *old)
+
+        curses.init_pair(1, 0, 0)
+        self.assertEqual(curses.pair_content(1), (0, 0))
+        maxcolor = curses.COLORS - 1
+        curses.init_pair(1, maxcolor, 0)
+        self.assertEqual(curses.pair_content(1), (maxcolor, 0))
+        curses.init_pair(1, 0, maxcolor)
+        self.assertEqual(curses.pair_content(1), (0, maxcolor))
+        maxpair = self.get_pair_limit() - 1
+        if maxpair > 1:
+            curses.init_pair(maxpair, 0, 0)
+            self.assertEqual(curses.pair_content(maxpair), (0, 0))
+
+        for pair in self.bad_pairs():
+            self.assertRaises(ValueError, curses.init_pair, pair, 0, 0)
+        for color in self.bad_colors2():
+            self.assertRaises(ValueError, curses.init_pair, 1, color, 0)
+            self.assertRaises(ValueError, curses.init_pair, 1, 0, color)
+
+    @requires_colors
+    def test_color_attrs(self):
+        for pair in 0, 1, 255:
+            attr = curses.color_pair(pair)
+            self.assertEqual(curses.pair_number(attr), pair, attr)
+            self.assertEqual(curses.pair_number(attr | curses.A_BOLD), pair)
+        self.assertEqual(curses.color_pair(0), 0)
+        self.assertEqual(curses.pair_number(0), 0)
+
+    @requires_curses_func('use_default_colors')
+    @requires_colors
+    def test_use_default_colors(self):
+        old = curses.pair_content(0)
+        try:
             curses.use_default_colors()
+        except curses.error:
+            self.skipTest('cannot change color (use_default_colors() failed)')
+        self.assertEqual(curses.pair_content(0), (-1, -1))
+        self.assertIn(old, [(curses.COLOR_WHITE, curses.COLOR_BLACK), (-1, -1), (0, 0)])
 
-    @requires_curses_func('keyname')
     def test_keyname(self):
-        curses.keyname(13)
+        # TODO: key_name()
+        self.assertEqual(curses.keyname(65), b'A')
+        self.assertEqual(curses.keyname(13), b'^M')
+        self.assertEqual(curses.keyname(127), b'^?')
+        self.assertEqual(curses.keyname(0), b'^@')
+        self.assertRaises(ValueError, curses.keyname, -1)
+        self.assertIsInstance(curses.keyname(256), bytes)
 
     @requires_curses_func('has_key')
     def test_has_key(self):
@@ -342,31 +1047,56 @@
         panel.set_userptr(A())
         panel.set_userptr(None)
 
+    @cpython_only
     @requires_curses_func('panel')
-    def test_new_curses_panel(self):
+    def test_disallow_instantiation(self):
+        # Ensure that the type disallows instantiation (bpo-43916)
         w = curses.newwin(10, 10)
         panel = curses.panel.new_panel(w)
-        self.assertRaises(TypeError, type(panel))
+        check_disallow_instantiation(self, type(panel))
 
     @requires_curses_func('is_term_resized')
     def test_is_term_resized(self):
-        curses.is_term_resized(*self.stdscr.getmaxyx())
+        lines, cols = curses.LINES, curses.COLS
+        self.assertIs(curses.is_term_resized(lines, cols), False)
+        self.assertIs(curses.is_term_resized(lines-1, cols-1), True)
 
     @requires_curses_func('resize_term')
     def test_resize_term(self):
-        curses.resize_term(*self.stdscr.getmaxyx())
+        curses.update_lines_cols()
+        lines, cols = curses.LINES, curses.COLS
+        new_lines = lines - 1
+        new_cols = cols + 1
+        curses.resize_term(new_lines, new_cols)
+        self.assertEqual(curses.LINES, new_lines)
+        self.assertEqual(curses.COLS, new_cols)
+
+        curses.resize_term(lines, cols)
+        self.assertEqual(curses.LINES, lines)
+        self.assertEqual(curses.COLS, cols)
 
     @requires_curses_func('resizeterm')
     def test_resizeterm(self):
-        stdscr = self.stdscr
+        curses.update_lines_cols()
         lines, cols = curses.LINES, curses.COLS
         new_lines = lines - 1
         new_cols = cols + 1
         curses.resizeterm(new_lines, new_cols)
-
         self.assertEqual(curses.LINES, new_lines)
         self.assertEqual(curses.COLS, new_cols)
 
+        curses.resizeterm(lines, cols)
+        self.assertEqual(curses.LINES, lines)
+        self.assertEqual(curses.COLS, cols)
+
+    def test_ungetch(self):
+        curses.ungetch(b'A')
+        self.assertEqual(self.stdscr.getkey(), 'A')
+        curses.ungetch('B')
+        self.assertEqual(self.stdscr.getkey(), 'B')
+        curses.ungetch(67)
+        self.assertEqual(self.stdscr.getkey(), 'C')
+
     def test_issue6243(self):
         curses.ungetch(1025)
         self.stdscr.getkey()
@@ -395,10 +1125,6 @@
             read = stdscr.get_wch()
             self.assertEqual(read, ch)
 
-    def test_issue10570(self):
-        b = curses.tparm(curses.tigetstr("cup"), 5, 3)
-        self.assertIs(type(b), bytes)
-
     def test_encoding(self):
         stdscr = self.stdscr
         import codecs
@@ -438,13 +1164,12 @@
         human_readable_signature = stdscr.addch.__doc__.split("\n")[0]
         self.assertIn("[y, x,]", human_readable_signature)
 
+    @requires_curses_window_meth('resize')
     def test_issue13051(self):
-        stdscr = self.stdscr
-        if not hasattr(stdscr, 'resize'):
-            raise unittest.SkipTest('requires curses.window.resize')
-        box = curses.textpad.Textbox(stdscr, insert_mode=True)
-        lines, cols = stdscr.getmaxyx()
-        stdscr.resize(lines-2, cols-2)
+        win = curses.newwin(5, 15, 2, 5)
+        box = curses.textpad.Textbox(win, insert_mode=True)
+        lines, cols = win.getmaxyx()
+        win.resize(lines-2, cols-2)
         # this may cause infinite recursion, leading to a RuntimeError
         box._insert_printable_char('a')
 
@@ -453,15 +1178,18 @@
 
     @requires_curses_func('update_lines_cols')
     def test_update_lines_cols(self):
-        # this doesn't actually test that LINES and COLS are updated,
-        # because we can't automate changing them. See Issue #4254 for
-        # a manual test script. We can only test that the function
-        # can be called.
         curses.update_lines_cols()
+        lines, cols = curses.LINES, curses.COLS
+        curses.LINES = curses.COLS = 0
+        curses.update_lines_cols()
+        self.assertEqual(curses.LINES, lines)
+        self.assertEqual(curses.COLS, cols)
 
     @requires_curses_func('ncurses_version')
     def test_ncurses_version(self):
         v = curses.ncurses_version
+        if verbose:
+            print(f'ncurses_version = {curses.ncurses_version}', flush=True)
         self.assertIsInstance(v[:], tuple)
         self.assertEqual(len(v), 3)
         self.assertIsInstance(v[0], int)
@@ -477,6 +1205,11 @@
         self.assertGreaterEqual(v.minor, 0)
         self.assertGreaterEqual(v.patch, 0)
 
+    def test_has_extended_color_support(self):
+        r = curses.has_extended_color_support()
+        self.assertIsInstance(r, bool)
+
+
 class TestAscii(unittest.TestCase):
 
     def test_controlnames(self):
@@ -565,5 +1298,21 @@
         self.assertEqual(unctrl(ord('\xc1')), '!A')
 
 
+def lorem_ipsum(win):
+    text = [
+        'Lorem ipsum',
+        'dolor sit amet,',
+        'consectetur',
+        'adipiscing elit,',
+        'sed do eiusmod',
+        'tempor incididunt',
+        'ut labore et',
+        'dolore magna',
+        'aliqua.',
+    ]
+    maxy, maxx = win.getmaxyx()
+    for y, line in enumerate(text[:maxy]):
+        win.addstr(y, 0, line[:maxx - (y == maxy - 1)])
+
 if __name__ == '__main__':
     unittest.main()
diff --git a/Lib/test/test_dataclasses.py b/Lib/test/test_dataclasses.py
index b20103b..ef5009a 100644
--- a/Lib/test/test_dataclasses.py
+++ b/Lib/test/test_dataclasses.py
@@ -4,12 +4,14 @@
 
 from dataclasses import *
 
+import abc
 import pickle
 import inspect
 import builtins
+import types
 import unittest
 from unittest.mock import Mock
-from typing import ClassVar, Any, List, Union, Tuple, Dict, Generic, TypeVar, Optional
+from typing import ClassVar, Any, List, Union, Tuple, Dict, Generic, TypeVar, Optional, Protocol
 from typing import get_type_hints
 from collections import deque, OrderedDict, namedtuple
 from functools import total_ordering
@@ -60,6 +62,7 @@
                            f"default=1,default_factory={MISSING!r}," \
                            "init=True,repr=False,hash=None," \
                            "compare=True,metadata=mappingproxy({})," \
+                           f"kw_only={MISSING!r}," \
                            "_field_type=None)"
 
         self.assertEqual(repr_output, expected_output)
@@ -1124,6 +1127,10 @@
         self.assertEqual(repr(InitVar[int]), 'dataclasses.InitVar[int]')
         self.assertEqual(repr(InitVar[List[int]]),
                          'dataclasses.InitVar[typing.List[int]]')
+        self.assertEqual(repr(InitVar[list[int]]),
+                         'dataclasses.InitVar[list[int]]')
+        self.assertEqual(repr(InitVar[int|str]),
+                         'dataclasses.InitVar[int | str]')
 
     def test_init_var_inheritance(self):
         # Note that this deliberately tests that a dataclass need not
@@ -1348,6 +1355,17 @@
                 with self.assertRaisesRegex(TypeError, 'should be called on dataclass instances'):
                     replace(obj, x=0)
 
+    def test_is_dataclass_genericalias(self):
+        @dataclass
+        class A(types.GenericAlias):
+            origin: type
+            args: type
+        self.assertTrue(is_dataclass(A))
+        a = A(list, int)
+        self.assertTrue(is_dataclass(type(a)))
+        self.assertTrue(is_dataclass(a))
+
+
     def test_helper_fields_with_class_instance(self):
         # Check that we can call fields() on either a class or instance,
         #  and get back the same thing.
@@ -1905,7 +1923,7 @@
         # Check MRO resolution.
         self.assertEqual(Child.__mro__, (Child, Parent, Generic, object))
 
-    def test_dataclassses_pickleable(self):
+    def test_dataclasses_pickleable(self):
         global P, Q, R
         @dataclass
         class P:
@@ -1934,6 +1952,30 @@
                     self.assertEqual(new_sample.x, another_new_sample.x)
                     self.assertEqual(sample.y, another_new_sample.y)
 
+    def test_dataclasses_qualnames(self):
+        @dataclass(order=True, unsafe_hash=True, frozen=True)
+        class A:
+            x: int
+            y: int
+
+        self.assertEqual(A.__init__.__name__, "__init__")
+        for function in (
+            '__eq__',
+            '__lt__',
+            '__le__',
+            '__gt__',
+            '__ge__',
+            '__hash__',
+            '__init__',
+            '__repr__',
+            '__setattr__',
+            '__delattr__',
+        ):
+            self.assertEqual(getattr(A, function).__qualname__, f"TestCase.test_dataclasses_qualnames.<locals>.A.{function}")
+
+        with self.assertRaisesRegex(TypeError, r"A\.__init__\(\) missing"):
+            A()
+
 
 class TestFieldNoAnnotation(unittest.TestCase):
     def test_field_without_annotation(self):
@@ -2124,6 +2166,26 @@
                 self.x = 2 * x
         self.assertEqual(C(5).x, 10)
 
+    def test_inherit_from_protocol(self):
+        # Dataclasses inheriting from protocol should preserve their own `__init__`.
+        # See bpo-45081.
+
+        class P(Protocol):
+            a: int
+
+        @dataclass
+        class C(P):
+            a: int
+
+        self.assertEqual(C(5).a, 5)
+
+        @dataclass
+        class D(P):
+            def __init__(self, a):
+                self.a = a * 2
+
+        self.assertEqual(D(5).a, 10)
+
 
 class TestRepr(unittest.TestCase):
     def test_repr(self):
@@ -2568,6 +2630,30 @@
         self.assertEqual(d.i, 0)
         self.assertEqual(d.j, 10)
 
+    def test_inherit_nonfrozen_from_empty_frozen(self):
+        @dataclass(frozen=True)
+        class C:
+            pass
+
+        with self.assertRaisesRegex(TypeError,
+                                    'cannot inherit non-frozen dataclass from a frozen one'):
+            @dataclass
+            class D(C):
+                j: int
+
+    def test_inherit_nonfrozen_from_empty(self):
+        @dataclass
+        class C:
+            pass
+
+        @dataclass
+        class D(C):
+            j: int
+
+        d = D(3)
+        self.assertEqual(d.j, 3)
+        self.assertIsInstance(d, C)
+
     # Test both ways: with an intermediate normal (non-dataclass)
     #  class and without an intermediate class.
     def test_inherit_nonfrozen_from_frozen(self):
@@ -2731,6 +2817,107 @@
         # We can add a new field to the derived instance.
         d.z = 10
 
+    def test_generated_slots(self):
+        @dataclass(slots=True)
+        class C:
+            x: int
+            y: int
+
+        c = C(1, 2)
+        self.assertEqual((c.x, c.y), (1, 2))
+
+        c.x = 3
+        c.y = 4
+        self.assertEqual((c.x, c.y), (3, 4))
+
+        with self.assertRaisesRegex(AttributeError, "'C' object has no attribute 'z'"):
+            c.z = 5
+
+    def test_add_slots_when_slots_exists(self):
+        with self.assertRaisesRegex(TypeError, '^C already specifies __slots__$'):
+            @dataclass(slots=True)
+            class C:
+                __slots__ = ('x',)
+                x: int
+
+    def test_generated_slots_value(self):
+        @dataclass(slots=True)
+        class Base:
+            x: int
+
+        self.assertEqual(Base.__slots__, ('x',))
+
+        @dataclass(slots=True)
+        class Delivered(Base):
+            y: int
+
+        self.assertEqual(Delivered.__slots__, ('x', 'y'))
+
+        @dataclass
+        class AnotherDelivered(Base):
+            z: int
+
+        self.assertTrue('__slots__' not in AnotherDelivered.__dict__)
+
+    def test_returns_new_class(self):
+        class A:
+            x: int
+
+        B = dataclass(A, slots=True)
+        self.assertIsNot(A, B)
+
+        self.assertFalse(hasattr(A, "__slots__"))
+        self.assertTrue(hasattr(B, "__slots__"))
+
+    # Can't be local to test_frozen_pickle.
+    @dataclass(frozen=True, slots=True)
+    class FrozenSlotsClass:
+        foo: str
+        bar: int
+
+    @dataclass(frozen=True)
+    class FrozenWithoutSlotsClass:
+        foo: str
+        bar: int
+
+    def test_frozen_pickle(self):
+        # bpo-43999
+
+        self.assertEqual(self.FrozenSlotsClass.__slots__, ("foo", "bar"))
+        for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+            with self.subTest(proto=proto):
+                obj = self.FrozenSlotsClass("a", 1)
+                p = pickle.loads(pickle.dumps(obj, protocol=proto))
+                self.assertIsNot(obj, p)
+                self.assertEqual(obj, p)
+
+                obj = self.FrozenWithoutSlotsClass("a", 1)
+                p = pickle.loads(pickle.dumps(obj, protocol=proto))
+                self.assertIsNot(obj, p)
+                self.assertEqual(obj, p)
+
+    def test_slots_with_default_no_init(self):
+        # Originally reported in bpo-44649.
+        @dataclass(slots=True)
+        class A:
+            a: str
+            b: str = field(default='b', init=False)
+
+        obj = A("a")
+        self.assertEqual(obj.a, 'a')
+        self.assertEqual(obj.b, 'b')
+
+    def test_slots_with_default_factory_no_init(self):
+        # Originally reported in bpo-44649.
+        @dataclass(slots=True)
+        class A:
+            a: str
+            b: str = field(default_factory=lambda:'b', init=False)
+
+        obj = A("a")
+        self.assertEqual(obj.a, 'a')
+        self.assertEqual(obj.b, 'b')
+
 class TestDescriptors(unittest.TestCase):
     def test_set_name(self):
         # See bpo-33141.
@@ -2811,7 +2998,7 @@
         # These tests assume that both "import typing" and "from
         # typing import *" have been run in this file.
         for typestr in ('ClassVar[int]',
-                        'ClassVar [int]'
+                        'ClassVar [int]',
                         ' ClassVar [int]',
                         'ClassVar',
                         ' ClassVar ',
@@ -3245,6 +3432,24 @@
         c = replace(c, x=3, y=5)
         self.assertEqual(c.x, 15)
 
+    def test_initvar_with_default_value(self):
+        @dataclass
+        class C:
+            x: int
+            y: InitVar[int] = None
+            z: InitVar[int] = 42
+
+            def __post_init__(self, y, z):
+                if y is not None:
+                    self.x += y
+                if z is not None:
+                    self.x += z
+
+        c = C(x=1, y=10, z=1)
+        self.assertEqual(replace(c), C(x=12))
+        self.assertEqual(replace(c, y=4), C(x=12, y=4, z=42))
+        self.assertEqual(replace(c, y=4, z=1), C(x=12, y=4, z=1))
+
     def test_recursive_repr(self):
         @dataclass
         class C:
@@ -3332,6 +3537,381 @@
 
     ##     replace(c, x=5)
 
+class TestAbstract(unittest.TestCase):
+    def test_abc_implementation(self):
+        class Ordered(abc.ABC):
+            @abc.abstractmethod
+            def __lt__(self, other):
+                pass
+
+            @abc.abstractmethod
+            def __le__(self, other):
+                pass
+
+        @dataclass(order=True)
+        class Date(Ordered):
+            year: int
+            month: 'Month'
+            day: 'int'
+
+        self.assertFalse(inspect.isabstract(Date))
+        self.assertGreater(Date(2020,12,25), Date(2020,8,31))
+
+    def test_maintain_abc(self):
+        class A(abc.ABC):
+            @abc.abstractmethod
+            def foo(self):
+                pass
+
+        @dataclass
+        class Date(A):
+            year: int
+            month: 'Month'
+            day: 'int'
+
+        self.assertTrue(inspect.isabstract(Date))
+        msg = 'class Date with abstract method foo'
+        self.assertRaisesRegex(TypeError, msg, Date)
+
+
+class TestMatchArgs(unittest.TestCase):
+    def test_match_args(self):
+        @dataclass
+        class C:
+            a: int
+        self.assertEqual(C(42).__match_args__, ('a',))
+
+    def test_explicit_match_args(self):
+        ma = ()
+        @dataclass
+        class C:
+            a: int
+            __match_args__ = ma
+        self.assertIs(C(42).__match_args__, ma)
+
+    def test_bpo_43764(self):
+        @dataclass(repr=False, eq=False, init=False)
+        class X:
+            a: int
+            b: int
+            c: int
+        self.assertEqual(X.__match_args__, ("a", "b", "c"))
+
+    def test_match_args_argument(self):
+        @dataclass(match_args=False)
+        class X:
+            a: int
+        self.assertNotIn('__match_args__', X.__dict__)
+
+        @dataclass(match_args=False)
+        class Y:
+            a: int
+            __match_args__ = ('b',)
+        self.assertEqual(Y.__match_args__, ('b',))
+
+        @dataclass(match_args=False)
+        class Z(Y):
+            z: int
+        self.assertEqual(Z.__match_args__, ('b',))
+
+        # Ensure parent dataclass __match_args__ is seen, if child class
+        # specifies match_args=False.
+        @dataclass
+        class A:
+            a: int
+            z: int
+        @dataclass(match_args=False)
+        class B(A):
+            b: int
+        self.assertEqual(B.__match_args__, ('a', 'z'))
+
+    def test_make_dataclasses(self):
+        C = make_dataclass('C', [('x', int), ('y', int)])
+        self.assertEqual(C.__match_args__, ('x', 'y'))
+
+        C = make_dataclass('C', [('x', int), ('y', int)], match_args=True)
+        self.assertEqual(C.__match_args__, ('x', 'y'))
+
+        C = make_dataclass('C', [('x', int), ('y', int)], match_args=False)
+        self.assertNotIn('__match__args__', C.__dict__)
+
+        C = make_dataclass('C', [('x', int), ('y', int)], namespace={'__match_args__': ('z',)})
+        self.assertEqual(C.__match_args__, ('z',))
+
+
+class TestKeywordArgs(unittest.TestCase):
+    def test_no_classvar_kwarg(self):
+        msg = 'field a is a ClassVar but specifies kw_only'
+        with self.assertRaisesRegex(TypeError, msg):
+            @dataclass
+            class A:
+                a: ClassVar[int] = field(kw_only=True)
+
+        with self.assertRaisesRegex(TypeError, msg):
+            @dataclass
+            class A:
+                a: ClassVar[int] = field(kw_only=False)
+
+        with self.assertRaisesRegex(TypeError, msg):
+            @dataclass(kw_only=True)
+            class A:
+                a: ClassVar[int] = field(kw_only=False)
+
+    def test_field_marked_as_kwonly(self):
+        #######################
+        # Using dataclass(kw_only=True)
+        @dataclass(kw_only=True)
+        class A:
+            a: int
+        self.assertTrue(fields(A)[0].kw_only)
+
+        @dataclass(kw_only=True)
+        class A:
+            a: int = field(kw_only=True)
+        self.assertTrue(fields(A)[0].kw_only)
+
+        @dataclass(kw_only=True)
+        class A:
+            a: int = field(kw_only=False)
+        self.assertFalse(fields(A)[0].kw_only)
+
+        #######################
+        # Using dataclass(kw_only=False)
+        @dataclass(kw_only=False)
+        class A:
+            a: int
+        self.assertFalse(fields(A)[0].kw_only)
+
+        @dataclass(kw_only=False)
+        class A:
+            a: int = field(kw_only=True)
+        self.assertTrue(fields(A)[0].kw_only)
+
+        @dataclass(kw_only=False)
+        class A:
+            a: int = field(kw_only=False)
+        self.assertFalse(fields(A)[0].kw_only)
+
+        #######################
+        # Not specifying dataclass(kw_only)
+        @dataclass
+        class A:
+            a: int
+        self.assertFalse(fields(A)[0].kw_only)
+
+        @dataclass
+        class A:
+            a: int = field(kw_only=True)
+        self.assertTrue(fields(A)[0].kw_only)
+
+        @dataclass
+        class A:
+            a: int = field(kw_only=False)
+        self.assertFalse(fields(A)[0].kw_only)
+
+    def test_match_args(self):
+        # kw fields don't show up in __match_args__.
+        @dataclass(kw_only=True)
+        class C:
+            a: int
+        self.assertEqual(C(a=42).__match_args__, ())
+
+        @dataclass
+        class C:
+            a: int
+            b: int = field(kw_only=True)
+        self.assertEqual(C(42, b=10).__match_args__, ('a',))
+
+    def test_KW_ONLY(self):
+        @dataclass
+        class A:
+            a: int
+            _: KW_ONLY
+            b: int
+            c: int
+        A(3, c=5, b=4)
+        msg = "takes 2 positional arguments but 4 were given"
+        with self.assertRaisesRegex(TypeError, msg):
+            A(3, 4, 5)
+
+
+        @dataclass(kw_only=True)
+        class B:
+            a: int
+            _: KW_ONLY
+            b: int
+            c: int
+        B(a=3, b=4, c=5)
+        msg = "takes 1 positional argument but 4 were given"
+        with self.assertRaisesRegex(TypeError, msg):
+            B(3, 4, 5)
+
+        # Explicitly make a field that follows KW_ONLY be non-keyword-only.
+        @dataclass
+        class C:
+            a: int
+            _: KW_ONLY
+            b: int
+            c: int = field(kw_only=False)
+        c = C(1, 2, b=3)
+        self.assertEqual(c.a, 1)
+        self.assertEqual(c.b, 3)
+        self.assertEqual(c.c, 2)
+        c = C(1, b=3, c=2)
+        self.assertEqual(c.a, 1)
+        self.assertEqual(c.b, 3)
+        self.assertEqual(c.c, 2)
+        c = C(1, b=3, c=2)
+        self.assertEqual(c.a, 1)
+        self.assertEqual(c.b, 3)
+        self.assertEqual(c.c, 2)
+        c = C(c=2, b=3, a=1)
+        self.assertEqual(c.a, 1)
+        self.assertEqual(c.b, 3)
+        self.assertEqual(c.c, 2)
+
+    def test_KW_ONLY_as_string(self):
+        @dataclass
+        class A:
+            a: int
+            _: 'dataclasses.KW_ONLY'
+            b: int
+            c: int
+        A(3, c=5, b=4)
+        msg = "takes 2 positional arguments but 4 were given"
+        with self.assertRaisesRegex(TypeError, msg):
+            A(3, 4, 5)
+
+    def test_KW_ONLY_twice(self):
+        msg = "'Y' is KW_ONLY, but KW_ONLY has already been specified"
+
+        with self.assertRaisesRegex(TypeError, msg):
+            @dataclass
+            class A:
+                a: int
+                X: KW_ONLY
+                Y: KW_ONLY
+                b: int
+                c: int
+
+        with self.assertRaisesRegex(TypeError, msg):
+            @dataclass
+            class A:
+                a: int
+                X: KW_ONLY
+                b: int
+                Y: KW_ONLY
+                c: int
+
+        with self.assertRaisesRegex(TypeError, msg):
+            @dataclass
+            class A:
+                a: int
+                X: KW_ONLY
+                b: int
+                c: int
+                Y: KW_ONLY
+
+        # But this usage is okay, since it's not using KW_ONLY.
+        @dataclass
+        class A:
+            a: int
+            _: KW_ONLY
+            b: int
+            c: int = field(kw_only=True)
+
+        # And if inheriting, it's okay.
+        @dataclass
+        class A:
+            a: int
+            _: KW_ONLY
+            b: int
+            c: int
+        @dataclass
+        class B(A):
+            _: KW_ONLY
+            d: int
+
+        # Make sure the error is raised in a derived class.
+        with self.assertRaisesRegex(TypeError, msg):
+            @dataclass
+            class A:
+                a: int
+                _: KW_ONLY
+                b: int
+                c: int
+            @dataclass
+            class B(A):
+                X: KW_ONLY
+                d: int
+                Y: KW_ONLY
+
+
+    def test_post_init(self):
+        @dataclass
+        class A:
+            a: int
+            _: KW_ONLY
+            b: InitVar[int]
+            c: int
+            d: InitVar[int]
+            def __post_init__(self, b, d):
+                raise CustomError(f'{b=} {d=}')
+        with self.assertRaisesRegex(CustomError, 'b=3 d=4'):
+            A(1, c=2, b=3, d=4)
+
+        @dataclass
+        class B:
+            a: int
+            _: KW_ONLY
+            b: InitVar[int]
+            c: int
+            d: InitVar[int]
+            def __post_init__(self, b, d):
+                self.a = b
+                self.c = d
+        b = B(1, c=2, b=3, d=4)
+        self.assertEqual(asdict(b), {'a': 3, 'c': 4})
+
+    def test_defaults(self):
+        # For kwargs, make sure we can have defaults after non-defaults.
+        @dataclass
+        class A:
+            a: int = 0
+            _: KW_ONLY
+            b: int
+            c: int = 1
+            d: int
+
+        a = A(d=4, b=3)
+        self.assertEqual(a.a, 0)
+        self.assertEqual(a.b, 3)
+        self.assertEqual(a.c, 1)
+        self.assertEqual(a.d, 4)
+
+        # Make sure we still check for non-kwarg non-defaults not following
+        # defaults.
+        err_regex = "non-default argument 'z' follows default argument"
+        with self.assertRaisesRegex(TypeError, err_regex):
+            @dataclass
+            class A:
+                a: int = 0
+                z: int
+                _: KW_ONLY
+                b: int
+                c: int = 1
+                d: int
+
+    def test_make_dataclass(self):
+        A = make_dataclass("A", ['a'], kw_only=True)
+        self.assertTrue(fields(A)[0].kw_only)
+
+        B = make_dataclass("B",
+                           ['a', ('b', int, field(kw_only=False))],
+                           kw_only=True)
+        self.assertTrue(fields(B)[0].kw_only)
+        self.assertFalse(fields(B)[1].kw_only)
+
 
 if __name__ == '__main__':
     unittest.main()
diff --git a/Lib/test/test_datetime.py b/Lib/test/test_datetime.py
index d659f36..7f9094f 100644
--- a/Lib/test/test_datetime.py
+++ b/Lib/test/test_datetime.py
@@ -1,57 +1,57 @@
 import unittest
 import sys
 
-from test.support import import_fresh_module, run_unittest
+from test.support.import_helper import import_fresh_module
+
 
 TESTS = 'test.datetimetester'
 
-try:
-    pure_tests = import_fresh_module(TESTS, fresh=['datetime', '_strptime'],
-                                     blocked=['_datetime'])
-    fast_tests = import_fresh_module(TESTS, fresh=['datetime',
-                                                   '_datetime', '_strptime'])
-finally:
-    # XXX: import_fresh_module() is supposed to leave sys.module cache untouched,
-    # XXX: but it does not, so we have to cleanup ourselves.
-    for modname in ['datetime', '_datetime', '_strptime']:
-        sys.modules.pop(modname, None)
-test_modules = [pure_tests, fast_tests]
-test_suffixes = ["_Pure", "_Fast"]
-# XXX(gb) First run all the _Pure tests, then all the _Fast tests.  You might
-# not believe this, but in spite of all the sys.modules trickery running a _Pure
-# test last will leave a mix of pure and native datetime stuff lying around.
-all_test_classes = []
+def load_tests(loader, tests, pattern):
+    try:
+        pure_tests = import_fresh_module(TESTS, fresh=['datetime', '_strptime'],
+                                        blocked=['_datetime'])
+        fast_tests = import_fresh_module(TESTS, fresh=['datetime',
+                                                    '_datetime', '_strptime'])
+    finally:
+        # XXX: import_fresh_module() is supposed to leave sys.module cache untouched,
+        # XXX: but it does not, so we have to cleanup ourselves.
+        for modname in ['datetime', '_datetime', '_strptime']:
+            sys.modules.pop(modname, None)
 
-for module, suffix in zip(test_modules, test_suffixes):
-    test_classes = []
-    for name, cls in module.__dict__.items():
-        if not isinstance(cls, type):
-            continue
-        if issubclass(cls, unittest.TestCase):
-            test_classes.append(cls)
-        elif issubclass(cls, unittest.TestSuite):
-            suit = cls()
-            test_classes.extend(type(test) for test in suit)
-    test_classes = sorted(set(test_classes), key=lambda cls: cls.__qualname__)
-    for cls in test_classes:
-        cls.__name__ += suffix
-        cls.__qualname__ += suffix
-        @classmethod
-        def setUpClass(cls_, module=module):
-            cls_._save_sys_modules = sys.modules.copy()
-            sys.modules[TESTS] = module
-            sys.modules['datetime'] = module.datetime_module
-            sys.modules['_strptime'] = module._strptime
-        @classmethod
-        def tearDownClass(cls_):
-            sys.modules.clear()
-            sys.modules.update(cls_._save_sys_modules)
-        cls.setUpClass = setUpClass
-        cls.tearDownClass = tearDownClass
-    all_test_classes.extend(test_classes)
+    test_modules = [pure_tests, fast_tests]
+    test_suffixes = ["_Pure", "_Fast"]
+    # XXX(gb) First run all the _Pure tests, then all the _Fast tests.  You might
+    # not believe this, but in spite of all the sys.modules trickery running a _Pure
+    # test last will leave a mix of pure and native datetime stuff lying around.
+    for module, suffix in zip(test_modules, test_suffixes):
+        test_classes = []
+        for name, cls in module.__dict__.items():
+            if not isinstance(cls, type):
+                continue
+            if issubclass(cls, unittest.TestCase):
+                test_classes.append(cls)
+            elif issubclass(cls, unittest.TestSuite):
+                suit = cls()
+                test_classes.extend(type(test) for test in suit)
+        test_classes = sorted(set(test_classes), key=lambda cls: cls.__qualname__)
+        for cls in test_classes:
+            cls.__name__ += suffix
+            cls.__qualname__ += suffix
+            @classmethod
+            def setUpClass(cls_, module=module):
+                cls_._save_sys_modules = sys.modules.copy()
+                sys.modules[TESTS] = module
+                sys.modules['datetime'] = module.datetime_module
+                sys.modules['_strptime'] = module._strptime
+            @classmethod
+            def tearDownClass(cls_):
+                sys.modules.clear()
+                sys.modules.update(cls_._save_sys_modules)
+            cls.setUpClass = setUpClass
+            cls.tearDownClass = tearDownClass
+            tests.addTests(loader.loadTestsFromTestCase(cls))
+    return tests
 
-def test_main():
-    run_unittest(*all_test_classes)
 
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_dbm.py b/Lib/test/test_dbm.py
index 571da97..16a0230 100644
--- a/Lib/test/test_dbm.py
+++ b/Lib/test/test_dbm.py
@@ -1,22 +1,21 @@
 """Test script for the dbm.open function based on testdumbdbm.py"""
 
 import unittest
-import glob
-import test.support
-
-# Skip tests if dbm module doesn't exist.
-dbm = test.support.import_module('dbm')
+import dbm
+import os
+from test.support import import_helper
+from test.support import os_helper
 
 try:
     from dbm import ndbm
 except ImportError:
     ndbm = None
 
-_fname = test.support.TESTFN
+dirname = os_helper.TESTFN
+_fname = os.path.join(dirname, os_helper.TESTFN)
 
 #
-# Iterates over every database module supported by dbm currently available,
-# setting dbm to use each in turn, and yielding that module
+# Iterates over every database module supported by dbm currently available.
 #
 def dbm_iterator():
     for name in dbm._names:
@@ -30,11 +29,12 @@
 #
 # Clean up all scratch databases we might have created during testing
 #
-def delete_files():
-    # we don't know the precise name the underlying database uses
-    # so we use glob to locate all names
-    for f in glob.glob(glob.escape(_fname) + "*"):
-        test.support.unlink(f)
+def cleaunup_test_dir():
+    os_helper.rmtree(dirname)
+
+def setup_test_dir():
+    cleaunup_test_dir()
+    os.mkdir(dirname)
 
 
 class AnyDBMTestCase:
@@ -74,7 +74,7 @@
 
     def test_anydbm_creation_n_file_exists_with_invalid_contents(self):
         # create an empty file
-        test.support.create_empty_file(_fname)
+        os_helper.create_empty_file(_fname)
         with dbm.open(_fname, 'n') as f:
             self.assertEqual(len(f), 0)
 
@@ -133,80 +133,67 @@
         for key in self._dict:
             self.assertEqual(self._dict[key], f[key.encode("ascii")])
 
-    def tearDown(self):
-        delete_files()
+    def test_keys(self):
+        with dbm.open(_fname, 'c') as d:
+            self.assertEqual(d.keys(), [])
+            a = [(b'a', b'b'), (b'12345678910', b'019237410982340912840198242')]
+            for k, v in a:
+                d[k] = v
+            self.assertEqual(sorted(d.keys()), sorted(k for (k, v) in a))
+            for k, v in a:
+                self.assertIn(k, d)
+                self.assertEqual(d[k], v)
+            self.assertNotIn(b'xxx', d)
+            self.assertRaises(KeyError, lambda: d[b'xxx'])
 
     def setUp(self):
+        self.addCleanup(setattr, dbm, '_defaultmod', dbm._defaultmod)
         dbm._defaultmod = self.module
-        delete_files()
+        self.addCleanup(cleaunup_test_dir)
+        setup_test_dir()
 
 
 class WhichDBTestCase(unittest.TestCase):
     def test_whichdb(self):
+        self.addCleanup(setattr, dbm, '_defaultmod', dbm._defaultmod)
         for module in dbm_iterator():
             # Check whether whichdb correctly guesses module name
             # for databases opened with "module" module.
-            # Try with empty files first
             name = module.__name__
-            if name == 'dbm.dumb':
-                continue   # whichdb can't support dbm.dumb
-            delete_files()
-            f = module.open(_fname, 'c')
-            f.close()
+            setup_test_dir()
+            dbm._defaultmod = module
+            # Try with empty files first
+            with module.open(_fname, 'c'): pass
             self.assertEqual(name, self.dbm.whichdb(_fname))
             # Now add a key
-            f = module.open(_fname, 'w')
-            f[b"1"] = b"1"
-            # and test that we can find it
-            self.assertIn(b"1", f)
-            # and read it
-            self.assertEqual(f[b"1"], b"1")
-            f.close()
+            with module.open(_fname, 'w') as f:
+                f[b"1"] = b"1"
+                # and test that we can find it
+                self.assertIn(b"1", f)
+                # and read it
+                self.assertEqual(f[b"1"], b"1")
             self.assertEqual(name, self.dbm.whichdb(_fname))
 
     @unittest.skipUnless(ndbm, reason='Test requires ndbm')
     def test_whichdb_ndbm(self):
         # Issue 17198: check that ndbm which is referenced in whichdb is defined
-        db_file = '{}_ndbm.db'.format(_fname)
-        with open(db_file, 'w'):
-            self.addCleanup(test.support.unlink, db_file)
-        self.assertIsNone(self.dbm.whichdb(db_file[:-3]))
-
-    def tearDown(self):
-        delete_files()
+        with open(_fname + '.db', 'wb'): pass
+        self.assertIsNone(self.dbm.whichdb(_fname))
 
     def setUp(self):
-        delete_files()
-        self.filename = test.support.TESTFN
-        self.d = dbm.open(self.filename, 'c')
-        self.d.close()
-        self.dbm = test.support.import_fresh_module('dbm')
-
-    def test_keys(self):
-        self.d = dbm.open(self.filename, 'c')
-        self.assertEqual(self.d.keys(), [])
-        a = [(b'a', b'b'), (b'12345678910', b'019237410982340912840198242')]
-        for k, v in a:
-            self.d[k] = v
-        self.assertEqual(sorted(self.d.keys()), sorted(k for (k, v) in a))
-        for k, v in a:
-            self.assertIn(k, self.d)
-            self.assertEqual(self.d[k], v)
-        self.assertNotIn(b'xxx', self.d)
-        self.assertRaises(KeyError, lambda: self.d[b'xxx'])
-        self.d.close()
+        self.addCleanup(cleaunup_test_dir)
+        setup_test_dir()
+        self.dbm = import_helper.import_fresh_module('dbm')
 
 
-def load_tests(loader, tests, pattern):
-    classes = []
-    for mod in dbm_iterator():
-        classes.append(type("TestCase-" + mod.__name__,
-                            (AnyDBMTestCase, unittest.TestCase),
-                            {'module': mod}))
-    suites = [unittest.makeSuite(c) for c in classes]
+for mod in dbm_iterator():
+    assert mod.__name__.startswith('dbm.')
+    suffix = mod.__name__[4:]
+    testname = f'TestCase_{suffix}'
+    globals()[testname] = type(testname,
+                               (AnyDBMTestCase, unittest.TestCase),
+                               {'module': mod})
 
-    tests.addTests(suites)
-    return tests
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/Lib/test/test_dbm_dumb.py b/Lib/test/test_dbm_dumb.py
index 0a60778..ddaffb4 100644
--- a/Lib/test/test_dbm_dumb.py
+++ b/Lib/test/test_dbm_dumb.py
@@ -10,9 +10,11 @@
 import unittest
 import dbm.dumb as dumbdbm
 from test import support
+from test.support import os_helper
 from functools import partial
 
-_fname = support.TESTFN
+_fname = os_helper.TESTFN
+
 
 def _delete_files():
     for ext in [".dir", ".dat", ".bak"]:
@@ -230,7 +232,7 @@
             self.assertEqual(f.keys(), [])
 
     def test_eval(self):
-        with open(_fname + '.dir', 'w') as stream:
+        with open(_fname + '.dir', 'w', encoding="utf-8") as stream:
             stream.write("str(print('Hacked!')), 0\n")
         with support.captured_stdout() as stdout:
             with self.assertRaises(ValueError):
@@ -264,7 +266,7 @@
                 dumbdbm.open(_fname, flag)
 
     def test_readonly_files(self):
-        with support.temp_dir() as dir:
+        with os_helper.temp_dir() as dir:
             fname = os.path.join(dir, 'db')
             with dumbdbm.open(fname, 'n') as f:
                 self.assertEqual(list(f.keys()), [])
@@ -277,12 +279,12 @@
                 self.assertEqual(sorted(f.keys()), sorted(self._dict))
                 f.close()  # don't write
 
-    @unittest.skipUnless(support.TESTFN_NONASCII,
+    @unittest.skipUnless(os_helper.TESTFN_NONASCII,
                          'requires OS support of non-ASCII encodings')
     def test_nonascii_filename(self):
-        filename = support.TESTFN_NONASCII
+        filename = os_helper.TESTFN_NONASCII
         for suffix in ['.dir', '.dat', '.bak']:
-            self.addCleanup(support.unlink, filename + suffix)
+            self.addCleanup(os_helper.unlink, filename + suffix)
         with dumbdbm.open(filename, 'c') as db:
             db[b'key'] = b'value'
         self.assertTrue(os.path.exists(filename + '.dat'))
diff --git a/Lib/test/test_dbm_gnu.py b/Lib/test/test_dbm_gnu.py
index f1c7d34..f39b002 100644
--- a/Lib/test/test_dbm_gnu.py
+++ b/Lib/test/test_dbm_gnu.py
@@ -1,8 +1,9 @@
 from test import support
-gdbm = support.import_module("dbm.gnu") #skip if not supported
+from test.support import import_helper, cpython_only
+gdbm = import_helper.import_module("dbm.gnu") #skip if not supported
 import unittest
 import os
-from test.support import TESTFN, TESTFN_NONASCII, unlink
+from test.support.os_helper import TESTFN, TESTFN_NONASCII, unlink
 
 
 filename = TESTFN
@@ -26,6 +27,12 @@
             self.g.close()
         unlink(filename)
 
+    @cpython_only
+    def test_disallow_instantiation(self):
+        # Ensure that the type disallows instantiation (bpo-43916)
+        self.g = gdbm.open(filename, 'c')
+        support.check_disallow_instantiation(self, type(self.g))
+
     def test_key_methods(self):
         self.g = gdbm.open(filename, 'c')
         self.assertEqual(self.g.keys(), [])
diff --git a/Lib/test/test_dbm_ndbm.py b/Lib/test/test_dbm_ndbm.py
index 7ac75c5..639c833 100644
--- a/Lib/test/test_dbm_ndbm.py
+++ b/Lib/test/test_dbm_ndbm.py
@@ -1,5 +1,6 @@
-from test import support
-support.import_module("dbm.ndbm") #skip if not supported
+from test.support import import_helper
+from test.support import os_helper
+import_helper.import_module("dbm.ndbm") #skip if not supported
 import os
 import unittest
 import dbm.ndbm
@@ -8,13 +9,13 @@
 class DbmTestCase(unittest.TestCase):
 
     def setUp(self):
-        self.filename = support.TESTFN
+        self.filename = os_helper.TESTFN
         self.d = dbm.ndbm.open(self.filename, 'c')
         self.d.close()
 
     def tearDown(self):
         for suffix in ['', '.pag', '.dir', '.db']:
-            support.unlink(self.filename + suffix)
+            os_helper.unlink(self.filename + suffix)
 
     def test_keys(self):
         self.d = dbm.ndbm.open(self.filename, 'c')
@@ -101,12 +102,12 @@
             with self.assertRaises(error):
                 db[b'not exist key'] = b'not exist value'
 
-    @unittest.skipUnless(support.TESTFN_NONASCII,
+    @unittest.skipUnless(os_helper.TESTFN_NONASCII,
                          'requires OS support of non-ASCII encodings')
     def test_nonascii_filename(self):
-        filename = support.TESTFN_NONASCII
+        filename = os_helper.TESTFN_NONASCII
         for suffix in ['', '.pag', '.dir', '.db']:
-            self.addCleanup(support.unlink, filename + suffix)
+            self.addCleanup(os_helper.unlink, filename + suffix)
         with dbm.ndbm.open(filename, 'c') as db:
             db[b'key'] = b'value'
         self.assertTrue(any(os.path.exists(filename + suffix)
diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py
index fd62f37..310c105 100644
--- a/Lib/test/test_decimal.py
+++ b/Lib/test/test_decimal.py
@@ -33,17 +33,25 @@
 import numbers
 import locale
 from test.support import (run_unittest, run_doctest, is_resource_enabled,
-                          requires_IEEE_754, requires_docstrings)
-from test.support import (import_fresh_module, TestFailed,
-                          run_with_locale, cpython_only)
+                          requires_IEEE_754, requires_docstrings,
+                          requires_legacy_unicode_capi, check_sanitizer)
+from test.support import (TestFailed,
+                          run_with_locale, cpython_only,
+                          darwin_malloc_err_warning)
+from test.support.import_helper import import_fresh_module
+from test.support import warnings_helper
 import random
 import inspect
 import threading
 
 
+if sys.platform == 'darwin':
+    darwin_malloc_err_warning('test_decimal')
+
+
 C = import_fresh_module('decimal', fresh=['_decimal'])
 P = import_fresh_module('decimal', blocked=['_decimal'])
-orig_sys_decimal = sys.modules['decimal']
+import decimal as orig_sys_decimal
 
 # fractions module must import the correct decimal module.
 cfractions = import_fresh_module('fractions', fresh=['fractions'])
@@ -286,7 +294,7 @@
         global skip_expected
         if skip_expected:
             raise unittest.SkipTest
-        with open(file) as f:
+        with open(file, encoding="utf-8") as f:
             for line in f:
                 line = line.replace('\r\n', '').replace('\n', '')
                 #print line
@@ -581,6 +589,8 @@
             self.assertRaises(InvalidOperation, Decimal, "1_2_\u00003")
 
     @cpython_only
+    @requires_legacy_unicode_capi
+    @warnings_helper.ignore_warnings(category=DeprecationWarning)
     def test_from_legacy_strings(self):
         import _testcapi
         Decimal = self.decimal.Decimal
@@ -1809,13 +1819,7 @@
 
         # check that hash(d) == hash(int(d)) for integral values
         for value in test_values:
-            self.assertEqual(hashit(value), hashit(int(value)))
-
-        #the same hash that to an int
-        self.assertEqual(hashit(Decimal(23)), hashit(23))
-        self.assertRaises(TypeError, hash, Decimal('sNaN'))
-        self.assertTrue(hashit(Decimal('Inf')))
-        self.assertTrue(hashit(Decimal('-Inf')))
+            self.assertEqual(hashit(value), hash(int(value)))
 
         # check that the hashes of a Decimal float match when they
         # represent exactly the same values
@@ -1824,7 +1828,7 @@
         for s in test_strings:
             f = float(s)
             d = Decimal(s)
-            self.assertEqual(hashit(f), hashit(d))
+            self.assertEqual(hashit(d), hash(f))
 
         with localcontext() as c:
             # check that the value of the hash doesn't depend on the
@@ -1845,6 +1849,19 @@
             x = 1100 ** 1248
             self.assertEqual(hashit(Decimal(x)), hashit(x))
 
+    def test_hash_method_nan(self):
+        Decimal = self.decimal.Decimal
+        self.assertRaises(TypeError, hash, Decimal('sNaN'))
+        value = Decimal('NaN')
+        self.assertEqual(hash(value), object.__hash__(value))
+        class H:
+            def __hash__(self):
+                return 42
+        class D(Decimal, H):
+            pass
+        value = D('NaN')
+        self.assertEqual(hash(value), object.__hash__(value))
+
     def test_min_and_max_methods(self):
         Decimal = self.decimal.Decimal
 
@@ -2816,6 +2833,8 @@
                                               Overflow])
 
     @cpython_only
+    @requires_legacy_unicode_capi
+    @warnings_helper.ignore_warnings(category=DeprecationWarning)
     def test_from_legacy_strings(self):
         import _testcapi
         c = self.decimal.Context()
@@ -5481,6 +5500,9 @@
     # Issue 41540:
     @unittest.skipIf(sys.platform.startswith("aix"),
                      "AIX: default ulimit: test is flaky because of extreme over-allocation")
+    @unittest.skipIf(check_sanitizer(address=True, memory=True),
+                     "ASAN/MSAN sanitizer defaults to crashing "
+                     "instead of returning NULL for malloc failure.")
     def test_maxcontext_exact_arith(self):
 
         # Make sure that exact operations do not raise MemoryError due
diff --git a/Lib/test/test_decorators.py b/Lib/test/test_decorators.py
index 298979e..57a741f 100644
--- a/Lib/test/test_decorators.py
+++ b/Lib/test/test_decorators.py
@@ -1,4 +1,6 @@
+from test import support
 import unittest
+from types import MethodType
 
 def funcattrs(**kwds):
     def decorate(func):
@@ -76,11 +78,32 @@
         self.assertEqual(C.foo(), 42)
         self.assertEqual(C().foo(), 42)
 
-    def test_staticmethod_function(self):
-        @staticmethod
-        def notamethod(x):
+    def check_wrapper_attrs(self, method_wrapper, format_str):
+        def func(x):
             return x
-        self.assertRaises(TypeError, notamethod, 1)
+        wrapper = method_wrapper(func)
+
+        self.assertIs(wrapper.__func__, func)
+        self.assertIs(wrapper.__wrapped__, func)
+
+        for attr in ('__module__', '__qualname__', '__name__',
+                     '__doc__', '__annotations__'):
+            self.assertIs(getattr(wrapper, attr),
+                          getattr(func, attr))
+
+        self.assertEqual(repr(wrapper), format_str.format(func))
+        return wrapper
+
+    def test_staticmethod(self):
+        wrapper = self.check_wrapper_attrs(staticmethod, '<staticmethod({!r})>')
+
+        # bpo-43682: Static methods are callable since Python 3.10
+        self.assertEqual(wrapper(1), 1)
+
+    def test_classmethod(self):
+        wrapper = self.check_wrapper_attrs(classmethod, '<classmethod({!r})>')
+
+        self.assertRaises(TypeError, wrapper, 1)
 
     def test_dotted(self):
         decorators = MiscDecorators()
@@ -307,6 +330,91 @@
         self.assertEqual(Class().inner(), 'spam')
         self.assertEqual(Class().outer(), 'eggs')
 
+    def test_wrapped_classmethod_inside_classmethod(self):
+        class MyClassMethod1:
+            def __init__(self, func):
+                self.func = func
+
+            def __call__(self, cls):
+                if hasattr(self.func, '__get__'):
+                    return self.func.__get__(cls, cls)()
+                return self.func(cls)
+
+            def __get__(self, instance, owner=None):
+                if owner is None:
+                    owner = type(instance)
+                return MethodType(self, owner)
+
+        class MyClassMethod2:
+            def __init__(self, func):
+                if isinstance(func, classmethod):
+                    func = func.__func__
+                self.func = func
+
+            def __call__(self, cls):
+                return self.func(cls)
+
+            def __get__(self, instance, owner=None):
+                if owner is None:
+                    owner = type(instance)
+                return MethodType(self, owner)
+
+        for myclassmethod in [MyClassMethod1, MyClassMethod2]:
+            class A:
+                @myclassmethod
+                def f1(cls):
+                    return cls
+
+                @classmethod
+                @myclassmethod
+                def f2(cls):
+                    return cls
+
+                @myclassmethod
+                @classmethod
+                def f3(cls):
+                    return cls
+
+                @classmethod
+                @classmethod
+                def f4(cls):
+                    return cls
+
+                @myclassmethod
+                @MyClassMethod1
+                def f5(cls):
+                    return cls
+
+                @myclassmethod
+                @MyClassMethod2
+                def f6(cls):
+                    return cls
+
+            self.assertIs(A.f1(), A)
+            self.assertIs(A.f2(), A)
+            self.assertIs(A.f3(), A)
+            self.assertIs(A.f4(), A)
+            self.assertIs(A.f5(), A)
+            self.assertIs(A.f6(), A)
+            a = A()
+            self.assertIs(a.f1(), A)
+            self.assertIs(a.f2(), A)
+            self.assertIs(a.f3(), A)
+            self.assertIs(a.f4(), A)
+            self.assertIs(a.f5(), A)
+            self.assertIs(a.f6(), A)
+
+            def f(cls):
+                return cls
+
+            self.assertIs(myclassmethod(f).__get__(a)(), A)
+            self.assertIs(myclassmethod(f).__get__(a, A)(), A)
+            self.assertIs(myclassmethod(f).__get__(A, A)(), A)
+            self.assertIs(myclassmethod(f).__get__(A)(), type(A))
+            self.assertIs(classmethod(f).__get__(a)(), A)
+            self.assertIs(classmethod(f).__get__(a, A)(), A)
+            self.assertIs(classmethod(f).__get__(A, A)(), A)
+            self.assertIs(classmethod(f).__get__(A)(), type(A))
 
 class TestClassDecorators(unittest.TestCase):
 
diff --git a/Lib/test/test_defaultdict.py b/Lib/test/test_defaultdict.py
index b48c649..68fc449 100644
--- a/Lib/test/test_defaultdict.py
+++ b/Lib/test/test_defaultdict.py
@@ -72,27 +72,6 @@
         d3[13]
         self.assertEqual(repr(d3), "defaultdict(%s, {13: 43})" % repr(foo))
 
-    def test_print(self):
-        d1 = defaultdict()
-        def foo(): return 42
-        d2 = defaultdict(foo, {1: 2})
-        # NOTE: We can't use tempfile.[Named]TemporaryFile since this
-        # code must exercise the tp_print C code, which only gets
-        # invoked for *real* files.
-        tfn = tempfile.mktemp()
-        try:
-            f = open(tfn, "w+")
-            try:
-                print(d1, file=f)
-                print(d2, file=f)
-                f.seek(0)
-                self.assertEqual(f.readline(), repr(d1) + "\n")
-                self.assertEqual(f.readline(), repr(d2) + "\n")
-            finally:
-                f.close()
-        finally:
-            os.remove(tfn)
-
     def test_copy(self):
         d1 = defaultdict()
         d2 = d1.copy()
@@ -160,18 +139,6 @@
             r"sub\(<bound method .*sub\._factory "
             r"of sub\(\.\.\., \{\}\)>, \{\}\)")
 
-        # NOTE: printing a subclass of a builtin type does not call its
-        # tp_print slot. So this part is essentially the same test as above.
-        tfn = tempfile.mktemp()
-        try:
-            f = open(tfn, "w+")
-            try:
-                print(d, file=f)
-            finally:
-                f.close()
-        finally:
-            os.remove(tfn)
-
     def test_callable_arg(self):
         self.assertRaises(TypeError, defaultdict, {})
 
diff --git a/Lib/test/test_deque.py b/Lib/test/test_deque.py
index c0f7138..7886bbf 100644
--- a/Lib/test/test_deque.py
+++ b/Lib/test/test_deque.py
@@ -66,28 +66,9 @@
         self.assertEqual(list(d), [7, 8, 9])
         d = deque(range(200), maxlen=10)
         d.append(d)
-        support.unlink(support.TESTFN)
-        fo = open(support.TESTFN, "w")
-        try:
-            fo.write(str(d))
-            fo.close()
-            fo = open(support.TESTFN, "r")
-            self.assertEqual(fo.read(), repr(d))
-        finally:
-            fo.close()
-            support.unlink(support.TESTFN)
-
+        self.assertEqual(repr(d)[-30:], ', 198, 199, [...]], maxlen=10)')
         d = deque(range(10), maxlen=None)
         self.assertEqual(repr(d), 'deque([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])')
-        fo = open(support.TESTFN, "w")
-        try:
-            fo.write(str(d))
-            fo.close()
-            fo = open(support.TESTFN, "r")
-            self.assertEqual(fo.read(), repr(d))
-        finally:
-            fo.close()
-            support.unlink(support.TESTFN)
 
     def test_maxlen_zero(self):
         it = iter(range(100))
@@ -148,7 +129,8 @@
         self.assertEqual(d.count(None), 16)
 
     def test_comparisons(self):
-        d = deque('xabc'); d.popleft()
+        d = deque('xabc')
+        d.popleft()
         for e in [d, deque('abc'), deque('ab'), deque(), list(d)]:
             self.assertEqual(d==e, type(d)==type(e) and list(d)==list(e))
             self.assertEqual(d!=e, not(type(d)==type(e) and list(d)==list(e)))
@@ -545,25 +527,11 @@
         e = eval(repr(d))
         self.assertEqual(list(d), list(e))
         d.append(d)
-        self.assertIn('...', repr(d))
-
-    def test_print(self):
-        d = deque(range(200))
-        d.append(d)
-        try:
-            support.unlink(support.TESTFN)
-            fo = open(support.TESTFN, "w")
-            print(d, file=fo, end='')
-            fo.close()
-            fo = open(support.TESTFN, "r")
-            self.assertEqual(fo.read(), repr(d))
-        finally:
-            fo.close()
-            support.unlink(support.TESTFN)
+        self.assertEqual(repr(d)[-20:], '7, 198, 199, [...]])')
 
     def test_init(self):
-        self.assertRaises(TypeError, deque, 'abc', 2, 3);
-        self.assertRaises(TypeError, deque, 1);
+        self.assertRaises(TypeError, deque, 'abc', 2, 3)
+        self.assertRaises(TypeError, deque, 1)
 
     def test_hash(self):
         self.assertRaises(TypeError, hash, deque('abc'))
@@ -901,6 +869,7 @@
         p = weakref.proxy(d)
         self.assertEqual(str(p), str(d))
         d = None
+        support.gc_collect()  # For PyPy or other GCs.
         self.assertRaises(ReferenceError, str, p)
 
     def test_strange_subclass(self):
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index 9e875da..f3dd1b3 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -4,6 +4,8 @@
 import itertools
 import math
 import pickle
+import random
+import string
 import sys
 import types
 import unittest
@@ -845,6 +847,14 @@
             self.fail("inheriting from ModuleType and str at the same time "
                       "should fail")
 
+        # Issue 34805: Verify that definition order is retained
+        def random_name():
+            return ''.join(random.choices(string.ascii_letters, k=10))
+        class A:
+            pass
+        subclasses = [type(random_name(), (A,), {}) for i in range(100)]
+        self.assertEqual(A.__subclasses__(), subclasses)
+
     def test_multiple_inheritance(self):
         # Testing multiple inheritance...
         class C(object):
@@ -1293,6 +1303,12 @@
         with self.assertRaises(AttributeError):
             del X().a
 
+        # Inherit from object on purpose to check some backwards compatibility paths
+        class X(object):
+            __slots__ = "a"
+        with self.assertRaisesRegex(AttributeError, "'X' object has no attribute 'a'"):
+            X().a
+
     def test_slots_special(self):
         # Testing __dict__ and __weakref__ in __slots__...
         class D(object):
@@ -1535,7 +1551,9 @@
         self.assertEqual(d.foo(1), (d, 1))
         self.assertEqual(D.foo(d, 1), (d, 1))
         # Test for a specific crash (SF bug 528132)
-        def f(cls, arg): return (cls, arg)
+        def f(cls, arg):
+            "f docstring"
+            return (cls, arg)
         ff = classmethod(f)
         self.assertEqual(ff.__get__(0, int)(42), (int, 42))
         self.assertEqual(ff.__get__(0)(42), (int, 42))
@@ -1561,10 +1579,16 @@
             self.fail("classmethod shouldn't accept keyword args")
 
         cm = classmethod(f)
-        self.assertEqual(cm.__dict__, {})
+        cm_dict = {'__annotations__': {},
+                   '__doc__': "f docstring",
+                   '__module__': __name__,
+                   '__name__': 'f',
+                   '__qualname__': f.__qualname__}
+        self.assertEqual(cm.__dict__, cm_dict)
+
         cm.x = 42
         self.assertEqual(cm.x, 42)
-        self.assertEqual(cm.__dict__, {"x" : 42})
+        self.assertEqual(cm.__dict__, {"x" : 42, **cm_dict})
         del cm.x
         self.assertNotHasAttr(cm, "x")
 
@@ -1644,10 +1668,10 @@
         self.assertEqual(d.foo(1), (d, 1))
         self.assertEqual(D.foo(d, 1), (d, 1))
         sm = staticmethod(None)
-        self.assertEqual(sm.__dict__, {})
+        self.assertEqual(sm.__dict__, {'__doc__': None})
         sm.x = 42
         self.assertEqual(sm.x, 42)
-        self.assertEqual(sm.__dict__, {"x" : 42})
+        self.assertEqual(sm.__dict__, {"x" : 42, '__doc__': None})
         del sm.x
         self.assertNotHasAttr(sm, "x")
 
@@ -2521,10 +2545,8 @@
         m2instance.b = 2
         m2instance.a = 1
         self.assertEqual(m2instance.__dict__, "Not a dict!")
-        try:
+        with self.assertRaises(TypeError):
             dir(m2instance)
-        except TypeError:
-            pass
 
         # Two essentially featureless objects, (Ellipsis just inherits stuff
         # from object.
@@ -2975,12 +2997,12 @@
         ##             self.ateof = 1
         ##        return s
         ##
-        ## f = file(name=support.TESTFN, mode='w')
+        ## f = file(name=os_helper.TESTFN, mode='w')
         ## lines = ['a\n', 'b\n', 'c\n']
         ## try:
         ##     f.writelines(lines)
         ##     f.close()
-        ##     f = CountedInput(support.TESTFN)
+        ##     f = CountedInput(os_helper.TESTFN)
         ##     for (i, expected) in zip(range(1, 5) + [4], lines + 2 * [""]):
         ##         got = f.readline()
         ##         self.assertEqual(expected, got)
@@ -2992,7 +3014,7 @@
         ##         f.close()
         ##     except:
         ##         pass
-        ##     support.unlink(support.TESTFN)
+        ##     os_helper.unlink(os_helper.TESTFN)
 
     def test_keywords(self):
         # Testing keyword args to basic type constructors ...
@@ -3552,13 +3574,6 @@
         self.assertEqual(o.__str__(), '41')
         self.assertEqual(o.__repr__(), 'A repr')
 
-        capture = io.StringIO()
-        # Calling str() or not exercises different internal paths.
-        print(o, file=capture)
-        print(str(o), file=capture)
-        self.assertEqual(capture.getvalue(), '41\n41\n')
-        capture.close()
-
     def test_keyword_arguments(self):
         # Testing keyword arguments to __init__, __call__...
         def f(a): return a
@@ -3900,6 +3915,48 @@
         a = C()
         a **= 2
 
+    def test_ipow_returns_not_implemented(self):
+        class A:
+            def __ipow__(self, other):
+                return NotImplemented
+
+        class B(A):
+            def __rpow__(self, other):
+                return 1
+
+        class C(A):
+            def __pow__(self, other):
+                return 2
+        a = A()
+        b = B()
+        c = C()
+
+        a **= b
+        self.assertEqual(a, 1)
+
+        c **= b
+        self.assertEqual(c, 2)
+
+    def test_no_ipow(self):
+        class B:
+            def __rpow__(self, other):
+                return 1
+
+        a = object()
+        b = B()
+        a **= b
+        self.assertEqual(a, 1)
+
+    def test_ipow_exception_text(self):
+        x = None
+        with self.assertRaises(TypeError) as cm:
+            x **= 2
+        self.assertIn('unsupported operand type(s) for **=', str(cm.exception))
+
+        with self.assertRaises(TypeError) as cm:
+            y = x ** 2
+        self.assertIn('unsupported operand type(s) for **', str(cm.exception))
+
     def test_mutable_bases(self):
         # Testing mutable bases...
 
@@ -4003,7 +4060,7 @@
         except TypeError:
             pass
         else:
-            assert 0, "best_base calculation found wanting"
+            self.fail("best_base calculation found wanting")
 
     def test_unsubclassable_types(self):
         with self.assertRaises(TypeError):
@@ -4389,6 +4446,8 @@
             print("Oops!")
         except RuntimeError:
             pass
+        else:
+            self.fail("Didn't raise RuntimeError")
         finally:
             sys.stdout = test_stdout
 
@@ -4710,12 +4769,14 @@
             "elephant"
         X.__doc__ = "banana"
         self.assertEqual(X.__doc__, "banana")
+
         with self.assertRaises(TypeError) as cm:
             type(list).__dict__["__doc__"].__set__(list, "blah")
-        self.assertIn("can't set list.__doc__", str(cm.exception))
+        self.assertIn("cannot set '__doc__' attribute of immutable type 'list'", str(cm.exception))
+
         with self.assertRaises(TypeError) as cm:
             type(X).__dict__["__doc__"].__delete__(X)
-        self.assertIn("can't delete X.__doc__", str(cm.exception))
+        self.assertIn("cannot delete '__doc__' attribute of immutable type 'X'", str(cm.exception))
         self.assertEqual(X.__doc__, "banana")
 
     def test_qualname(self):
@@ -4935,8 +4996,11 @@
             self.assertIn('{!r}: {!r}'.format(k, v), r)
 
 
-class PTypesLongInitTest(unittest.TestCase):
+class AAAPTypesLongInitTest(unittest.TestCase):
     # This is in its own TestCase so that it can be run before any other tests.
+    # (Hence the 'AAA' in the test class name: to make it the first
+    # item in a list sorted by name, like
+    # unittest.TestLoader.getTestCaseNames() does.)
     def test_pytype_long_ready(self):
         # Testing SF bug 551412 ...
 
@@ -5659,7 +5723,7 @@
 
     def test_incomplete_super(self):
         """
-        Attrubute lookup on a super object must be aware that
+        Attribute lookup on a super object must be aware that
         its target type can be uninitialized (type->tp_mro == NULL).
         """
         class M(DebugHelperMeta):
@@ -5674,12 +5738,5 @@
             pass
 
 
-def test_main():
-    # Run all local test cases, with PTypesLongInitTest first.
-    support.run_unittest(PTypesLongInitTest, OperatorsTest,
-                         ClassPropertiesAndMethods, DictProxyTests,
-                         MiscTests, PicklingTests, SharedKeyTests,
-                         MroTest)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_devpoll.py b/Lib/test/test_devpoll.py
index 110c006..85e0acc 100644
--- a/Lib/test/test_devpoll.py
+++ b/Lib/test/test_devpoll.py
@@ -6,7 +6,7 @@
 import random
 import select
 import unittest
-from test.support import run_unittest, cpython_only
+from test.support import cpython_only
 
 if not hasattr(select, 'devpoll') :
     raise unittest.SkipTest('test works only on Solaris OS family')
@@ -138,8 +138,5 @@
         self.assertRaises(OverflowError, pollster.modify, 1, USHRT_MAX + 1)
 
 
-def test_main():
-    run_unittest(DevPollTests)
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_dict.py b/Lib/test/test_dict.py
index 6b8596f..8aad4a5 100644
--- a/Lib/test/test_dict.py
+++ b/Lib/test/test_dict.py
@@ -105,6 +105,26 @@
         self.assertRaises(TypeError, d.items, None)
         self.assertEqual(repr(dict(a=1).items()), "dict_items([('a', 1)])")
 
+    def test_views_mapping(self):
+        mappingproxy = type(type.__dict__)
+        class Dict(dict):
+            pass
+        for cls in [dict, Dict]:
+            d = cls()
+            m1 = d.keys().mapping
+            m2 = d.values().mapping
+            m3 = d.items().mapping
+
+            for m in [m1, m2, m3]:
+                self.assertIsInstance(m, mappingproxy)
+                self.assertEqual(m, d)
+
+            d["foo"] = "bar"
+
+            for m in [m1, m2, m3]:
+                self.assertIsInstance(m, mappingproxy)
+                self.assertEqual(m, d)
+
     def test_contains(self):
         d = {}
         self.assertNotIn('a', d)
@@ -697,6 +717,16 @@
         self.assertEqual(k1 ^ k2, {(3,3)})
         self.assertEqual(k1 ^ k3, {(1,1), (2,2), (4,4)})
 
+    def test_items_symmetric_difference(self):
+        rr = random.randrange
+        for _ in range(100):
+            left = {x:rr(3) for x in range(20) if rr(2)}
+            right = {x:rr(3) for x in range(20) if rr(2)}
+            with self.subTest(left=left, right=right):
+                expected = set(left.items()) ^ set(right.items())
+                actual = left.items() ^ right.items()
+                self.assertEqual(actual, expected)
+
     def test_dictview_mixed_set_operations(self):
         # Just a few for .keys()
         self.assertTrue({1:1}.keys() == {1})
@@ -1021,7 +1051,7 @@
 
     @support.cpython_only
     def test_splittable_pop_pending(self):
-        """pop a pending key in a splitted table should not crash"""
+        """pop a pending key in a split table should not crash"""
         a, b = self.make_shared_key_dict(2)
 
         a['a'] = 4
@@ -1368,7 +1398,7 @@
         self.assertRaises(StopIteration, next, r)
 
     def test_reverse_iterator_for_empty_dict(self):
-        # bpo-38525: revered iterator should work properly
+        # bpo-38525: reversed iterator should work properly
 
         # empty dict is directly used for reference count test
         self.assertEqual(list(reversed({})), [])
@@ -1422,6 +1452,125 @@
         d = CustomReversedDict(pairs)
         self.assertEqual(pairs[::-1], list(dict(d).items()))
 
+    @support.cpython_only
+    def test_dict_items_result_gc(self):
+        # bpo-42536: dict.items's tuple-reuse speed trick breaks the GC's
+        # assumptions about what can be untracked. Make sure we re-track result
+        # tuples whenever we reuse them.
+        it = iter({None: []}.items())
+        gc.collect()
+        # That GC collection probably untracked the recycled internal result
+        # tuple, which is initialized to (None, None). Make sure it's re-tracked
+        # when it's mutated and returned from __next__:
+        self.assertTrue(gc.is_tracked(next(it)))
+
+    @support.cpython_only
+    def test_dict_items_result_gc_reversed(self):
+        # Same as test_dict_items_result_gc above, but reversed.
+        it = reversed({None: []}.items())
+        gc.collect()
+        self.assertTrue(gc.is_tracked(next(it)))
+
+    def test_str_nonstr(self):
+        # cpython uses a different lookup function if the dict only contains
+        # `str` keys. Make sure the unoptimized path is used when a non-`str`
+        # key appears.
+
+        class StrSub(str):
+            pass
+
+        eq_count = 0
+        # This class compares equal to the string 'key3'
+        class Key3:
+            def __hash__(self):
+                return hash('key3')
+
+            def __eq__(self, other):
+                nonlocal eq_count
+                if isinstance(other, Key3) or isinstance(other, str) and other == 'key3':
+                    eq_count += 1
+                    return True
+                return False
+
+        key3_1 = StrSub('key3')
+        key3_2 = Key3()
+        key3_3 = Key3()
+
+        dicts = []
+
+        # Create dicts of the form `{'key1': 42, 'key2': 43, key3: 44}` in a
+        # bunch of different ways. In all cases, `key3` is not of type `str`.
+        # `key3_1` is a `str` subclass and `key3_2` is a completely unrelated
+        # type.
+        for key3 in (key3_1, key3_2):
+            # A literal
+            dicts.append({'key1': 42, 'key2': 43, key3: 44})
+
+            # key3 inserted via `dict.__setitem__`
+            d = {'key1': 42, 'key2': 43}
+            d[key3] = 44
+            dicts.append(d)
+
+            # key3 inserted via `dict.setdefault`
+            d = {'key1': 42, 'key2': 43}
+            self.assertEqual(d.setdefault(key3, 44), 44)
+            dicts.append(d)
+
+            # key3 inserted via `dict.update`
+            d = {'key1': 42, 'key2': 43}
+            d.update({key3: 44})
+            dicts.append(d)
+
+            # key3 inserted via `dict.__ior__`
+            d = {'key1': 42, 'key2': 43}
+            d |= {key3: 44}
+            dicts.append(d)
+
+            # `dict(iterable)`
+            def make_pairs():
+                yield ('key1', 42)
+                yield ('key2', 43)
+                yield (key3, 44)
+            d = dict(make_pairs())
+            dicts.append(d)
+
+            # `dict.copy`
+            d = d.copy()
+            dicts.append(d)
+
+            # dict comprehension
+            d = {key: 42 + i for i,key in enumerate(['key1', 'key2', key3])}
+            dicts.append(d)
+
+        for d in dicts:
+            with self.subTest(d=d):
+                self.assertEqual(d.get('key1'), 42)
+
+                # Try to make an object that is of type `str` and is equal to
+                # `'key1'`, but (at least on cpython) is a different object.
+                noninterned_key1 = 'ke'
+                noninterned_key1 += 'y1'
+                if support.check_impl_detail(cpython=True):
+                    # suppress a SyntaxWarning
+                    interned_key1 = 'key1'
+                    self.assertFalse(noninterned_key1 is interned_key1)
+                self.assertEqual(d.get(noninterned_key1), 42)
+
+                self.assertEqual(d.get('key3'), 44)
+                self.assertEqual(d.get(key3_1), 44)
+                self.assertEqual(d.get(key3_2), 44)
+
+                # `key3_3` itself is definitely not a dict key, so make sure
+                # that `__eq__` gets called.
+                #
+                # Note that this might not hold for `key3_1` and `key3_2`
+                # because they might be the same object as one of the dict keys,
+                # in which case implementations are allowed to skip the call to
+                # `__eq__`.
+                eq_count = 0
+                self.assertEqual(d.get(key3_3), 44)
+                self.assertGreaterEqual(eq_count, 1)
+
 
 class CAPITest(unittest.TestCase):
 
diff --git a/Lib/test/test_dict_version.py b/Lib/test/test_dict_version.py
index b237865..243084c 100644
--- a/Lib/test/test_dict_version.py
+++ b/Lib/test/test_dict_version.py
@@ -1,12 +1,12 @@
 """
-Test implementation of the PEP 509: dictionary versionning.
+Test implementation of the PEP 509: dictionary versioning.
 """
 import unittest
-from test import support
+from test.support import import_helper
 
 # PEP 509 is implemented in CPython but other Python implementations
 # don't require to implement it
-_testcapi = support.import_module('_testcapi')
+_testcapi = import_helper.import_module('_testcapi')
 
 
 class DictVersionTests(unittest.TestCase):
diff --git a/Lib/test/test_difflib.py b/Lib/test/test_difflib.py
index 42ac1fd..6afd90a 100644
--- a/Lib/test/test_difflib.py
+++ b/Lib/test/test_difflib.py
@@ -1,5 +1,5 @@
 import difflib
-from test.support import run_unittest, findfile
+from test.support import findfile
 import unittest
 import doctest
 import sys
@@ -241,7 +241,7 @@
         #with open('test_difflib_expect.html','w') as fp:
         #    fp.write(actual)
 
-        with open(findfile('test_difflib_expect.html')) as fp:
+        with open(findfile('test_difflib_expect.html'), encoding="utf-8") as fp:
             self.assertEqual(actual, fp.read())
 
     def test_recursion_limit(self):
@@ -547,12 +547,14 @@
         self.assertFalse(self.longer_match_exists(a, b, match.size))
 
 
-def test_main():
+def setUpModule():
     difflib.HtmlDiff._default_prefix = 0
-    Doctests = doctest.DocTestSuite(difflib)
-    run_unittest(
-        TestWithAscii, TestAutojunk, TestSFpatches, TestSFbugs,
-        TestOutputFormat, TestBytes, TestJunkAPIs, TestFindLongest, Doctests)
+
+
+def load_tests(loader, tests, pattern):
+    tests.addTest(doctest.DocTestSuite(difflib))
+    return tests
+
 
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py
index ac5836d..23a1718 100644
--- a/Lib/test/test_dis.py
+++ b/Lib/test/test_dis.py
@@ -127,16 +127,18 @@
 
 %3d           6 CALL_FUNCTION            2
               8 GET_ITER
-        >>   10 FOR_ITER                 4 (to 16)
+        >>   10 FOR_ITER                 2 (to 16)
              12 STORE_FAST               0 (res)
 
-%3d          14 JUMP_ABSOLUTE           10
-        >>   16 LOAD_CONST               0 (None)
+%3d          14 JUMP_ABSOLUTE            5 (to 10)
+
+%3d     >>   16 LOAD_CONST               0 (None)
              18 RETURN_VALUE
 """ % (bug708901.__code__.co_firstlineno + 1,
        bug708901.__code__.co_firstlineno + 2,
        bug708901.__code__.co_firstlineno + 1,
-       bug708901.__code__.co_firstlineno + 3)
+       bug708901.__code__.co_firstlineno + 3,
+       bug708901.__code__.co_firstlineno + 1)
 
 
 def bug1333982(x=[]):
@@ -145,30 +147,55 @@
     pass
 
 dis_bug1333982 = """\
-%3d           0 LOAD_CONST               1 (0)
-              2 POP_JUMP_IF_TRUE        26
-              4 LOAD_ASSERTION_ERROR
-              6 LOAD_CONST               2 (<code object <listcomp> at 0x..., file "%s", line %d>)
-              8 LOAD_CONST               3 ('bug1333982.<locals>.<listcomp>')
-             10 MAKE_FUNCTION            0
-             12 LOAD_FAST                0 (x)
-             14 GET_ITER
-             16 CALL_FUNCTION            1
+%3d           0 LOAD_ASSERTION_ERROR
+              2 LOAD_CONST               2 (<code object <listcomp> at 0x..., file "%s", line %d>)
+              4 LOAD_CONST               3 ('bug1333982.<locals>.<listcomp>')
+              6 MAKE_FUNCTION            0
+              8 LOAD_FAST                0 (x)
+             10 GET_ITER
+             12 CALL_FUNCTION            1
 
-%3d          18 LOAD_CONST               4 (1)
+%3d          14 LOAD_CONST               4 (1)
 
-%3d          20 BINARY_ADD
-             22 CALL_FUNCTION            1
-             24 RAISE_VARARGS            1
-
-%3d     >>   26 LOAD_CONST               0 (None)
-             28 RETURN_VALUE
+%3d          16 BINARY_ADD
+             18 CALL_FUNCTION            1
+             20 RAISE_VARARGS            1
 """ % (bug1333982.__code__.co_firstlineno + 1,
        __file__,
        bug1333982.__code__.co_firstlineno + 1,
        bug1333982.__code__.co_firstlineno + 2,
-       bug1333982.__code__.co_firstlineno + 1,
-       bug1333982.__code__.co_firstlineno + 3)
+       bug1333982.__code__.co_firstlineno + 1)
+
+
+def bug42562():
+    pass
+
+
+# Set line number for 'pass' to None
+bug42562.__code__ = bug42562.__code__.replace(co_linetable=b'\x04\x80')
+
+
+dis_bug42562 = """\
+          0 LOAD_CONST               0 (None)
+          2 RETURN_VALUE
+"""
+
+# Extended arg followed by NOP
+code_bug_45757 = bytes([
+        0x90, 0x01,  # EXTENDED_ARG 0x01
+        0x09, 0xFF,  # NOP 0xFF
+        0x90, 0x01,  # EXTENDED_ARG 0x01
+        0x64, 0x29,  # LOAD_CONST 0x29
+        0x53, 0x00,  # RETURN_VALUE 0x00
+    ])
+
+dis_bug_45757 = """\
+          0 EXTENDED_ARG             1
+          2 NOP
+          4 EXTENDED_ARG             1
+          6 LOAD_CONST             297 (297)
+          8 RETURN_VALUE
+"""
 
 _BIG_LINENO_FORMAT = """\
 %3d           0 LOAD_GLOBAL              0 (spam)
@@ -261,55 +288,60 @@
   1           0 LOAD_CONST               0 (0)
               2 STORE_NAME               0 (x)
 
-  3     >>    4 LOAD_NAME                0 (x)
-              6 LOAD_CONST               1 (1)
-              8 INPLACE_ADD
-             10 STORE_NAME               0 (x)
-             12 JUMP_ABSOLUTE            4
-             14 LOAD_CONST               2 (None)
-             16 RETURN_VALUE
+  2           4 NOP
+
+  3     >>    6 LOAD_NAME                0 (x)
+              8 LOAD_CONST               1 (1)
+             10 INPLACE_ADD
+             12 STORE_NAME               0 (x)
+
+  2          14 JUMP_ABSOLUTE            3 (to 6)
 """
 
 dis_traceback = """\
-%3d           0 SETUP_FINALLY           12 (to 14)
+%3d           0 SETUP_FINALLY            7 (to 16)
 
 %3d           2 LOAD_CONST               1 (1)
               4 LOAD_CONST               2 (0)
     -->       6 BINARY_TRUE_DIVIDE
               8 POP_TOP
              10 POP_BLOCK
-             12 JUMP_FORWARD            42 (to 56)
 
-%3d     >>   14 DUP_TOP
-             16 LOAD_GLOBAL              0 (Exception)
-             18 JUMP_IF_NOT_EXC_MATCH    54
-             20 POP_TOP
-             22 STORE_FAST               0 (e)
-             24 POP_TOP
-             26 SETUP_FINALLY           18 (to 46)
+%3d          12 LOAD_FAST                1 (tb)
+             14 RETURN_VALUE
 
-%3d          28 LOAD_FAST                0 (e)
-             30 LOAD_ATTR                1 (__traceback__)
-             32 STORE_FAST               1 (tb)
-             34 POP_BLOCK
-             36 POP_EXCEPT
-             38 LOAD_CONST               0 (None)
-             40 STORE_FAST               0 (e)
-             42 DELETE_FAST              0 (e)
-             44 JUMP_FORWARD            10 (to 56)
-        >>   46 LOAD_CONST               0 (None)
-             48 STORE_FAST               0 (e)
-             50 DELETE_FAST              0 (e)
-             52 RERAISE
-        >>   54 RERAISE
+%3d     >>   16 DUP_TOP
+             18 LOAD_GLOBAL              0 (Exception)
+             20 JUMP_IF_NOT_EXC_MATCH    29 (to 58)
+             22 POP_TOP
+             24 STORE_FAST               0 (e)
+             26 POP_TOP
+             28 SETUP_FINALLY           10 (to 50)
 
-%3d     >>   56 LOAD_FAST                1 (tb)
-             58 RETURN_VALUE
+%3d          30 LOAD_FAST                0 (e)
+             32 LOAD_ATTR                1 (__traceback__)
+             34 STORE_FAST               1 (tb)
+             36 POP_BLOCK
+             38 POP_EXCEPT
+             40 LOAD_CONST               0 (None)
+             42 STORE_FAST               0 (e)
+             44 DELETE_FAST              0 (e)
+
+%3d          46 LOAD_FAST                1 (tb)
+             48 RETURN_VALUE
+        >>   50 LOAD_CONST               0 (None)
+             52 STORE_FAST               0 (e)
+             54 DELETE_FAST              0 (e)
+             56 RERAISE                  1
+
+%3d     >>   58 RERAISE                  0
 """ % (TRACEBACK_CODE.co_firstlineno + 1,
        TRACEBACK_CODE.co_firstlineno + 2,
+       TRACEBACK_CODE.co_firstlineno + 5,
        TRACEBACK_CODE.co_firstlineno + 3,
        TRACEBACK_CODE.co_firstlineno + 4,
-       TRACEBACK_CODE.co_firstlineno + 5)
+       TRACEBACK_CODE.co_firstlineno + 5,
+       TRACEBACK_CODE.co_firstlineno + 3)
 
 def _fstring(a, b, c, d):
     return f'{a} {b:4} {c!r} {d!r:4}'
@@ -345,7 +377,7 @@
         b()
 
 dis_tryfinally = """\
-%3d           0 SETUP_FINALLY           12 (to 14)
+%3d           0 SETUP_FINALLY            6 (to 14)
 
 %3d           2 LOAD_FAST                0 (a)
               4 POP_BLOCK
@@ -353,45 +385,33 @@
 %3d           6 LOAD_FAST                1 (b)
               8 CALL_FUNCTION            0
              10 POP_TOP
-
-%3d          12 RETURN_VALUE
-
-%3d     >>   14 LOAD_FAST                1 (b)
+             12 RETURN_VALUE
+        >>   14 LOAD_FAST                1 (b)
              16 CALL_FUNCTION            0
              18 POP_TOP
-             20 RERAISE
-             22 LOAD_CONST               0 (None)
-             24 RETURN_VALUE
+             20 RERAISE                  0
 """ % (_tryfinally.__code__.co_firstlineno + 1,
        _tryfinally.__code__.co_firstlineno + 2,
        _tryfinally.__code__.co_firstlineno + 4,
-       _tryfinally.__code__.co_firstlineno + 2,
-       _tryfinally.__code__.co_firstlineno + 4,
        )
 
 dis_tryfinallyconst = """\
-%3d           0 SETUP_FINALLY           12 (to 14)
+%3d           0 SETUP_FINALLY            6 (to 14)
 
 %3d           2 POP_BLOCK
 
 %3d           4 LOAD_FAST                0 (b)
               6 CALL_FUNCTION            0
               8 POP_TOP
-
-%3d          10 LOAD_CONST               1 (1)
+             10 LOAD_CONST               1 (1)
              12 RETURN_VALUE
-
-%3d     >>   14 LOAD_FAST                0 (b)
+        >>   14 LOAD_FAST                0 (b)
              16 CALL_FUNCTION            0
              18 POP_TOP
-             20 RERAISE
-             22 LOAD_CONST               0 (None)
-             24 RETURN_VALUE
+             20 RERAISE                  0
 """ % (_tryfinallyconst.__code__.co_firstlineno + 1,
        _tryfinallyconst.__code__.co_firstlineno + 2,
        _tryfinallyconst.__code__.co_firstlineno + 4,
-       _tryfinallyconst.__code__.co_firstlineno + 2,
-       _tryfinallyconst.__code__.co_firstlineno + 4,
        )
 
 def _g(x):
@@ -449,13 +469,13 @@
 Disassembly of <code object <listcomp> at 0x..., file "%s", line %d>:
 %3d           0 BUILD_LIST               0
               2 LOAD_FAST                0 (.0)
-        >>    4 FOR_ITER                12 (to 18)
+        >>    4 FOR_ITER                 6 (to 18)
               6 STORE_FAST               1 (z)
               8 LOAD_DEREF               0 (x)
              10 LOAD_FAST                1 (z)
              12 BINARY_ADD
              14 LIST_APPEND              2
-             16 JUMP_ABSOLUTE            4
+             16 JUMP_ABSOLUTE            2 (to 4)
         >>   18 RETURN_VALUE
 """ % (dis_nested_1,
        __file__,
@@ -528,6 +548,13 @@
 
         self.do_disassembly_test(bug1333982, dis_bug1333982)
 
+    def test_bug_42562(self):
+        self.do_disassembly_test(bug42562, dis_bug42562)
+
+    def test_bug_45757(self):
+        # Extended arg followed by NOP
+        self.do_disassembly_test(code_bug_45757, dis_bug_45757)
+
     def test_big_linenos(self):
         def func(count):
             namespace = {}
@@ -680,8 +707,12 @@
         return output.getvalue()
 
 
+if sys.flags.optimize:
+    code_info_consts = "0: None"
+else:
+    code_info_consts = "0: 'Formatted details of methods, functions, or code.'"
 
-code_info_code_info = """\
+code_info_code_info = f"""\
 Name:              code_info
 Filename:          (.*)
 Argument count:    1
@@ -691,13 +722,13 @@
 Stack size:        3
 Flags:             OPTIMIZED, NEWLOCALS, NOFREE
 Constants:
-   0: %r
+   {code_info_consts}
 Names:
    0: _format_code_info
    1: _get_code_object
 Variable names:
-   0: x""" % (('Formatted details of methods, functions, or code.',)
-              if sys.flags.optimize < 2 else (None,))
+   0: x"""
+
 
 @staticmethod
 def tricky(a, b, /, x, y, z=True, *args, c, d, e=[], **kwds):
@@ -803,7 +834,6 @@
 Constants:
    0: 0
    1: 1
-   2: None
 Names:
    0: x"""
 
@@ -998,7 +1028,7 @@
   Instruction(opname='LOAD_CONST', opcode=100, arg=1, argval=10, argrepr='10', offset=2, starts_line=None, is_jump_target=False),
   Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=4, starts_line=None, is_jump_target=False),
   Instruction(opname='GET_ITER', opcode=68, arg=None, argval=None, argrepr='', offset=6, starts_line=None, is_jump_target=False),
-  Instruction(opname='FOR_ITER', opcode=93, arg=34, argval=44, argrepr='to 44', offset=8, starts_line=None, is_jump_target=True),
+  Instruction(opname='FOR_ITER', opcode=93, arg=17, argval=44, argrepr='to 44', offset=8, starts_line=None, is_jump_target=True),
   Instruction(opname='STORE_FAST', opcode=125, arg=0, argval='i', argrepr='i', offset=10, starts_line=None, is_jump_target=False),
   Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=12, starts_line=4, is_jump_target=False),
   Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=14, starts_line=None, is_jump_target=False),
@@ -1007,22 +1037,22 @@
   Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=20, starts_line=5, is_jump_target=False),
   Instruction(opname='LOAD_CONST', opcode=100, arg=2, argval=4, argrepr='4', offset=22, starts_line=None, is_jump_target=False),
   Instruction(opname='COMPARE_OP', opcode=107, arg=0, argval='<', argrepr='<', offset=24, starts_line=None, is_jump_target=False),
-  Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=30, argval=30, argrepr='', offset=26, starts_line=None, is_jump_target=False),
-  Instruction(opname='JUMP_ABSOLUTE', opcode=113, arg=8, argval=8, argrepr='', offset=28, starts_line=6, is_jump_target=False),
+  Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=15, argval=30, argrepr='to 30', offset=26, starts_line=None, is_jump_target=False),
+  Instruction(opname='JUMP_ABSOLUTE', opcode=113, arg=4, argval=8, argrepr='to 8', offset=28, starts_line=6, is_jump_target=False),
   Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=30, starts_line=7, is_jump_target=True),
   Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=6, argrepr='6', offset=32, starts_line=None, is_jump_target=False),
   Instruction(opname='COMPARE_OP', opcode=107, arg=4, argval='>', argrepr='>', offset=34, starts_line=None, is_jump_target=False),
-  Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=8, argval=8, argrepr='', offset=36, starts_line=None, is_jump_target=False),
+  Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=21, argval=42, argrepr='to 42', offset=36, starts_line=None, is_jump_target=False),
   Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=38, starts_line=8, is_jump_target=False),
-  Instruction(opname='JUMP_ABSOLUTE', opcode=113, arg=52, argval=52, argrepr='', offset=40, starts_line=None, is_jump_target=False),
-  Instruction(opname='JUMP_ABSOLUTE', opcode=113, arg=8, argval=8, argrepr='', offset=42, starts_line=None, is_jump_target=False),
+  Instruction(opname='JUMP_FORWARD', opcode=110, arg=5, argval=52, argrepr='to 52', offset=40, starts_line=None, is_jump_target=False),
+  Instruction(opname='JUMP_ABSOLUTE', opcode=113, arg=4, argval=8, argrepr='to 8', offset=42, starts_line=7, is_jump_target=True),
   Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=44, starts_line=10, is_jump_target=True),
   Instruction(opname='LOAD_CONST', opcode=100, arg=4, argval='I can haz else clause?', argrepr="'I can haz else clause?'", offset=46, starts_line=None, is_jump_target=False),
   Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=48, starts_line=None, is_jump_target=False),
   Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=50, starts_line=None, is_jump_target=False),
   Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=52, starts_line=11, is_jump_target=True),
-  Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=94, argval=94, argrepr='', offset=54, starts_line=None, is_jump_target=False),
-  Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=56, starts_line=12, is_jump_target=False),
+  Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=48, argval=96, argrepr='to 96', offset=54, starts_line=None, is_jump_target=False),
+  Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=56, starts_line=12, is_jump_target=True),
   Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=58, starts_line=None, is_jump_target=False),
   Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=60, starts_line=None, is_jump_target=False),
   Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=62, starts_line=None, is_jump_target=False),
@@ -1033,74 +1063,88 @@
   Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=72, starts_line=14, is_jump_target=False),
   Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=6, argrepr='6', offset=74, starts_line=None, is_jump_target=False),
   Instruction(opname='COMPARE_OP', opcode=107, arg=4, argval='>', argrepr='>', offset=76, starts_line=None, is_jump_target=False),
-  Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=82, argval=82, argrepr='', offset=78, starts_line=None, is_jump_target=False),
-  Instruction(opname='JUMP_ABSOLUTE', opcode=113, arg=52, argval=52, argrepr='', offset=80, starts_line=15, is_jump_target=False),
+  Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=41, argval=82, argrepr='to 82', offset=78, starts_line=None, is_jump_target=False),
+  Instruction(opname='JUMP_ABSOLUTE', opcode=113, arg=26, argval=52, argrepr='to 52', offset=80, starts_line=15, is_jump_target=False),
   Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=82, starts_line=16, is_jump_target=True),
   Instruction(opname='LOAD_CONST', opcode=100, arg=2, argval=4, argrepr='4', offset=84, starts_line=None, is_jump_target=False),
   Instruction(opname='COMPARE_OP', opcode=107, arg=0, argval='<', argrepr='<', offset=86, starts_line=None, is_jump_target=False),
-  Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=52, argval=52, argrepr='', offset=88, starts_line=None, is_jump_target=False),
-  Instruction(opname='JUMP_ABSOLUTE', opcode=113, arg=102, argval=102, argrepr='', offset=90, starts_line=17, is_jump_target=False),
-  Instruction(opname='JUMP_ABSOLUTE', opcode=113, arg=52, argval=52, argrepr='', offset=92, starts_line=None, is_jump_target=False),
-  Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=94, starts_line=19, is_jump_target=True),
-  Instruction(opname='LOAD_CONST', opcode=100, arg=6, argval='Who let lolcatz into this test suite?', argrepr="'Who let lolcatz into this test suite?'", offset=96, starts_line=None, is_jump_target=False),
-  Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=98, starts_line=None, is_jump_target=False),
-  Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=100, starts_line=None, is_jump_target=False),
-  Instruction(opname='SETUP_FINALLY', opcode=122, arg=96, argval=200, argrepr='to 200', offset=102, starts_line=20, is_jump_target=True),
-  Instruction(opname='SETUP_FINALLY', opcode=122, arg=12, argval=118, argrepr='to 118', offset=104, starts_line=None, is_jump_target=False),
-  Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval=1, argrepr='1', offset=106, starts_line=21, is_jump_target=False),
-  Instruction(opname='LOAD_CONST', opcode=100, arg=7, argval=0, argrepr='0', offset=108, starts_line=None, is_jump_target=False),
-  Instruction(opname='BINARY_TRUE_DIVIDE', opcode=27, arg=None, argval=None, argrepr='', offset=110, starts_line=None, is_jump_target=False),
-  Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=112, starts_line=None, is_jump_target=False),
-  Instruction(opname='POP_BLOCK', opcode=87, arg=None, argval=None, argrepr='', offset=114, starts_line=None, is_jump_target=False),
-  Instruction(opname='JUMP_FORWARD', opcode=110, arg=26, argval=144, argrepr='to 144', offset=116, starts_line=None, is_jump_target=False),
-  Instruction(opname='DUP_TOP', opcode=4, arg=None, argval=None, argrepr='', offset=118, starts_line=22, is_jump_target=True),
-  Instruction(opname='LOAD_GLOBAL', opcode=116, arg=2, argval='ZeroDivisionError', argrepr='ZeroDivisionError', offset=120, starts_line=None, is_jump_target=False),
-  Instruction(opname='JUMP_IF_NOT_EXC_MATCH', opcode=121, arg=142, argval=142, argrepr='', offset=122, starts_line=None, is_jump_target=False),
-  Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=124, starts_line=None, is_jump_target=False),
+  Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=46, argval=92, argrepr='to 92', offset=88, starts_line=None, is_jump_target=False),
+  Instruction(opname='JUMP_FORWARD', opcode=110, arg=6, argval=104, argrepr='to 104', offset=90, starts_line=17, is_jump_target=False),
+  Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=92, starts_line=11, is_jump_target=True),
+  Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=28, argval=56, argrepr='to 56', offset=94, starts_line=None, is_jump_target=False),
+  Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=96, starts_line=19, is_jump_target=True),
+  Instruction(opname='LOAD_CONST', opcode=100, arg=6, argval='Who let lolcatz into this test suite?', argrepr="'Who let lolcatz into this test suite?'", offset=98, starts_line=None, is_jump_target=False),
+  Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=100, starts_line=None, is_jump_target=False),
+  Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=102, starts_line=None, is_jump_target=False),
+  Instruction(opname='SETUP_FINALLY', opcode=122, arg=63, argval=232, argrepr='to 232', offset=104, starts_line=20, is_jump_target=True),
+  Instruction(opname='SETUP_FINALLY', opcode=122, arg=6, argval=120, argrepr='to 120', offset=106, starts_line=None, is_jump_target=False),
+  Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval=1, argrepr='1', offset=108, starts_line=21, is_jump_target=False),
+  Instruction(opname='LOAD_CONST', opcode=100, arg=7, argval=0, argrepr='0', offset=110, starts_line=None, is_jump_target=False),
+  Instruction(opname='BINARY_TRUE_DIVIDE', opcode=27, arg=None, argval=None, argrepr='', offset=112, starts_line=None, is_jump_target=False),
+  Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=114, starts_line=None, is_jump_target=False),
+  Instruction(opname='POP_BLOCK', opcode=87, arg=None, argval=None, argrepr='', offset=116, starts_line=None, is_jump_target=False),
+  Instruction(opname='JUMP_FORWARD', opcode=110, arg=13, argval=146, argrepr='to 146', offset=118, starts_line=None, is_jump_target=False),
+  Instruction(opname='DUP_TOP', opcode=4, arg=None, argval=None, argrepr='', offset=120, starts_line=22, is_jump_target=True),
+  Instruction(opname='LOAD_GLOBAL', opcode=116, arg=2, argval='ZeroDivisionError', argrepr='ZeroDivisionError', offset=122, starts_line=None, is_jump_target=False),
+  Instruction(opname='JUMP_IF_NOT_EXC_MATCH', opcode=121, arg=72, argval=144, argrepr='to 144', offset=124, starts_line=None, is_jump_target=False),
   Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=126, starts_line=None, is_jump_target=False),
   Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=128, starts_line=None, is_jump_target=False),
-  Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=130, starts_line=23, is_jump_target=False),
-  Instruction(opname='LOAD_CONST', opcode=100, arg=8, argval='Here we go, here we go, here we go...', argrepr="'Here we go, here we go, here we go...'", offset=132, starts_line=None, is_jump_target=False),
-  Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=134, starts_line=None, is_jump_target=False),
-  Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=136, starts_line=None, is_jump_target=False),
-  Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=138, starts_line=None, is_jump_target=False),
-  Instruction(opname='JUMP_FORWARD', opcode=110, arg=46, argval=188, argrepr='to 188', offset=140, starts_line=None, is_jump_target=False),
-  Instruction(opname='RERAISE', opcode=48, arg=None, argval=None, argrepr='', offset=142, starts_line=None, is_jump_target=True),
-  Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=144, starts_line=25, is_jump_target=True),
-  Instruction(opname='SETUP_WITH', opcode=143, arg=24, argval=172, argrepr='to 172', offset=146, starts_line=None, is_jump_target=False),
-  Instruction(opname='STORE_FAST', opcode=125, arg=1, argval='dodgy', argrepr='dodgy', offset=148, starts_line=None, is_jump_target=False),
-  Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=150, starts_line=26, is_jump_target=False),
-  Instruction(opname='LOAD_CONST', opcode=100, arg=9, argval='Never reach this', argrepr="'Never reach this'", offset=152, starts_line=None, is_jump_target=False),
-  Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=154, starts_line=None, is_jump_target=False),
-  Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=156, starts_line=None, is_jump_target=False),
-  Instruction(opname='POP_BLOCK', opcode=87, arg=None, argval=None, argrepr='', offset=158, starts_line=None, is_jump_target=False),
-  Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=160, starts_line=None, is_jump_target=False),
-  Instruction(opname='DUP_TOP', opcode=4, arg=None, argval=None, argrepr='', offset=162, starts_line=None, is_jump_target=False),
+  Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=130, starts_line=None, is_jump_target=False),
+  Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=132, starts_line=23, is_jump_target=False),
+  Instruction(opname='LOAD_CONST', opcode=100, arg=8, argval='Here we go, here we go, here we go...', argrepr="'Here we go, here we go, here we go...'", offset=134, starts_line=None, is_jump_target=False),
+  Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=136, starts_line=None, is_jump_target=False),
+  Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=138, starts_line=None, is_jump_target=False),
+  Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=140, starts_line=None, is_jump_target=False),
+  Instruction(opname='JUMP_FORWARD', opcode=110, arg=30, argval=204, argrepr='to 204', offset=142, starts_line=None, is_jump_target=False),
+  Instruction(opname='RERAISE', opcode=119, arg=0, argval=0, argrepr='', offset=144, starts_line=22, is_jump_target=True),
+  Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=146, starts_line=25, is_jump_target=True),
+  Instruction(opname='SETUP_WITH', opcode=143, arg=12, argval=174, argrepr='to 174', offset=148, starts_line=None, is_jump_target=False),
+  Instruction(opname='STORE_FAST', opcode=125, arg=1, argval='dodgy', argrepr='dodgy', offset=150, starts_line=None, is_jump_target=False),
+  Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=152, starts_line=26, is_jump_target=False),
+  Instruction(opname='LOAD_CONST', opcode=100, arg=9, argval='Never reach this', argrepr="'Never reach this'", offset=154, starts_line=None, is_jump_target=False),
+  Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=156, starts_line=None, is_jump_target=False),
+  Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=158, starts_line=None, is_jump_target=False),
+  Instruction(opname='POP_BLOCK', opcode=87, arg=None, argval=None, argrepr='', offset=160, starts_line=None, is_jump_target=False),
+  Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=162, starts_line=25, is_jump_target=False),
   Instruction(opname='DUP_TOP', opcode=4, arg=None, argval=None, argrepr='', offset=164, starts_line=None, is_jump_target=False),
-  Instruction(opname='CALL_FUNCTION', opcode=131, arg=3, argval=3, argrepr='', offset=166, starts_line=None, is_jump_target=False),
-  Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=168, starts_line=None, is_jump_target=False),
-  Instruction(opname='JUMP_FORWARD', opcode=110, arg=16, argval=188, argrepr='to 188', offset=170, starts_line=None, is_jump_target=False),
-  Instruction(opname='WITH_EXCEPT_START', opcode=49, arg=None, argval=None, argrepr='', offset=172, starts_line=None, is_jump_target=True),
-  Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=178, argval=178, argrepr='', offset=174, starts_line=None, is_jump_target=False),
-  Instruction(opname='RERAISE', opcode=48, arg=None, argval=None, argrepr='', offset=176, starts_line=None, is_jump_target=False),
-  Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=178, starts_line=None, is_jump_target=True),
-  Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=180, starts_line=None, is_jump_target=False),
+  Instruction(opname='DUP_TOP', opcode=4, arg=None, argval=None, argrepr='', offset=166, starts_line=None, is_jump_target=False),
+  Instruction(opname='CALL_FUNCTION', opcode=131, arg=3, argval=3, argrepr='', offset=168, starts_line=None, is_jump_target=False),
+  Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=170, starts_line=None, is_jump_target=False),
+  Instruction(opname='JUMP_FORWARD', opcode=110, arg=22, argval=218, argrepr='to 218', offset=172, starts_line=None, is_jump_target=False),
+  Instruction(opname='WITH_EXCEPT_START', opcode=49, arg=None, argval=None, argrepr='', offset=174, starts_line=None, is_jump_target=True),
+  Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=90, argval=180, argrepr='to 180', offset=176, starts_line=None, is_jump_target=False),
+  Instruction(opname='RERAISE', opcode=119, arg=1, argval=1, argrepr='', offset=178, starts_line=None, is_jump_target=False),
+  Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=180, starts_line=None, is_jump_target=True),
   Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=182, starts_line=None, is_jump_target=False),
-  Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=184, starts_line=None, is_jump_target=False),
-  Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=186, starts_line=None, is_jump_target=False),
-  Instruction(opname='POP_BLOCK', opcode=87, arg=None, argval=None, argrepr='', offset=188, starts_line=None, is_jump_target=True),
-  Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=190, starts_line=28, is_jump_target=False),
-  Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=192, starts_line=None, is_jump_target=False),
-  Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=194, starts_line=None, is_jump_target=False),
-  Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=196, starts_line=None, is_jump_target=False),
-  Instruction(opname='JUMP_FORWARD', opcode=110, arg=10, argval=210, argrepr='to 210', offset=198, starts_line=None, is_jump_target=False),
-  Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=200, starts_line=None, is_jump_target=True),
-  Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=202, starts_line=None, is_jump_target=False),
-  Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=204, starts_line=None, is_jump_target=False),
-  Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=206, starts_line=None, is_jump_target=False),
-  Instruction(opname='RERAISE', opcode=48, arg=None, argval=None, argrepr='', offset=208, starts_line=None, is_jump_target=False),
-  Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=210, starts_line=None, is_jump_target=True),
-  Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr='', offset=212, starts_line=None, is_jump_target=False),
+  Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=184, starts_line=None, is_jump_target=False),
+  Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=186, starts_line=None, is_jump_target=False),
+  Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=188, starts_line=None, is_jump_target=False),
+  Instruction(opname='POP_BLOCK', opcode=87, arg=None, argval=None, argrepr='', offset=190, starts_line=None, is_jump_target=False),
+  Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=192, starts_line=28, is_jump_target=False),
+  Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=194, starts_line=None, is_jump_target=False),
+  Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=196, starts_line=None, is_jump_target=False),
+  Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=198, starts_line=None, is_jump_target=False),
+  Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=200, starts_line=None, is_jump_target=False),
+  Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr='', offset=202, starts_line=None, is_jump_target=False),
+  Instruction(opname='POP_BLOCK', opcode=87, arg=None, argval=None, argrepr='', offset=204, starts_line=23, is_jump_target=True),
+  Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=206, starts_line=28, is_jump_target=False),
+  Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=208, starts_line=None, is_jump_target=False),
+  Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=210, starts_line=None, is_jump_target=False),
+  Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=212, starts_line=None, is_jump_target=False),
+  Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=214, starts_line=None, is_jump_target=False),
+  Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr='', offset=216, starts_line=None, is_jump_target=False),
+  Instruction(opname='POP_BLOCK', opcode=87, arg=None, argval=None, argrepr='', offset=218, starts_line=25, is_jump_target=True),
+  Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=220, starts_line=28, is_jump_target=False),
+  Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=222, starts_line=None, is_jump_target=False),
+  Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=224, starts_line=None, is_jump_target=False),
+  Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=226, starts_line=None, is_jump_target=False),
+  Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=228, starts_line=None, is_jump_target=False),
+  Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr='', offset=230, starts_line=None, is_jump_target=False),
+  Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=232, starts_line=None, is_jump_target=True),
+  Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=234, starts_line=None, is_jump_target=False),
+  Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=236, starts_line=None, is_jump_target=False),
+  Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=238, starts_line=None, is_jump_target=False),
+  Instruction(opname='RERAISE', opcode=119, arg=0, argval=0, argrepr='', offset=240, starts_line=None, is_jump_target=False),
 ]
 
 # One last piece of inspect fodder to check the default line number handling
@@ -1202,5 +1246,65 @@
         b = dis.Bytecode.from_traceback(tb)
         self.assertEqual(b.dis(), dis_traceback)
 
+
+class TestBytecodeTestCase(BytecodeTestCase):
+    def test_assert_not_in_with_op_not_in_bytecode(self):
+        code = compile("a = 1", "<string>", "exec")
+        self.assertInBytecode(code, "LOAD_CONST", 1)
+        self.assertNotInBytecode(code, "LOAD_NAME")
+        self.assertNotInBytecode(code, "LOAD_NAME", "a")
+
+    def test_assert_not_in_with_arg_not_in_bytecode(self):
+        code = compile("a = 1", "<string>", "exec")
+        self.assertInBytecode(code, "LOAD_CONST")
+        self.assertInBytecode(code, "LOAD_CONST", 1)
+        self.assertNotInBytecode(code, "LOAD_CONST", 2)
+
+    def test_assert_not_in_with_arg_in_bytecode(self):
+        code = compile("a = 1", "<string>", "exec")
+        with self.assertRaises(AssertionError):
+            self.assertNotInBytecode(code, "LOAD_CONST", 1)
+
+
+class TestDisTraceback(unittest.TestCase):
+    def setUp(self) -> None:
+        try:  # We need to clean up existing tracebacks
+            del sys.last_traceback
+        except AttributeError:
+            pass
+        return super().setUp()
+
+    def get_disassembly(self, tb):
+        output = io.StringIO()
+        with contextlib.redirect_stdout(output):
+            dis.distb(tb)
+        return output.getvalue()
+
+    def test_distb_empty(self):
+        with self.assertRaises(RuntimeError):
+            dis.distb()
+
+    def test_distb_last_traceback(self):
+        # We need to have an existing last traceback in `sys`:
+        tb = get_tb()
+        sys.last_traceback = tb
+
+        self.assertEqual(self.get_disassembly(None), dis_traceback)
+
+    def test_distb_explicit_arg(self):
+        tb = get_tb()
+
+        self.assertEqual(self.get_disassembly(tb), dis_traceback)
+
+
+class TestDisTracebackWithFile(TestDisTraceback):
+    # Run the `distb` tests again, using the file arg instead of print
+    def get_disassembly(self, tb):
+        output = io.StringIO()
+        with contextlib.redirect_stdout(output):
+            dis.distb(tb, file=output)
+        return output.getvalue()
+
+
 if __name__ == "__main__":
     unittest.main()
diff --git a/Lib/test/test_distutils.py b/Lib/test/test_distutils.py
index a37f117..d82d2b6 100644
--- a/Lib/test/test_distutils.py
+++ b/Lib/test/test_distutils.py
@@ -5,14 +5,14 @@
 be run.
 """
 
-import distutils.tests
-import test.support
+import unittest
+from test import support
+from test.support import warnings_helper
 
+with warnings_helper.check_warnings(
+    ("The distutils package is deprecated", DeprecationWarning), quiet=True):
 
-def test_main():
-    # used by regrtest
-    test.support.run_unittest(distutils.tests.test_suite())
-    test.support.reap_children()
+    import distutils.tests
 
 
 def load_tests(*_):
@@ -20,5 +20,9 @@
     return distutils.tests.test_suite()
 
 
+def tearDownModule():
+    support.reap_children()
+
+
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_doctest.py b/Lib/test/test_doctest.py
index 3efe5da..9703f87 100644
--- a/Lib/test/test_doctest.py
+++ b/Lib/test/test_doctest.py
@@ -3,6 +3,8 @@
 """
 
 from test import support
+from test.support import import_helper
+from test.support import os_helper
 import doctest
 import functools
 import os
@@ -13,6 +15,7 @@
 import unittest
 import tempfile
 import shutil
+import types
 import contextlib
 
 # NOTE: There are some additional tests relating to interaction with
@@ -93,6 +96,17 @@
         22
         """)
 
+    a_class_attribute = 42
+
+    @classmethod
+    @property
+    def a_classmethod_property(cls):
+        """
+        >>> print(SampleClass.a_classmethod_property)
+        42
+        """
+        return cls.a_class_attribute
+
     class NestedClass:
         """
         >>> x = SampleClass.NestedClass(5)
@@ -441,7 +455,7 @@
     >>> tests = finder.find(sample_func)
 
     >>> print(tests)  # doctest: +ELLIPSIS
-    [<DocTest sample_func from ...:25 (1 example)>]
+    [<DocTest sample_func from test_doctest.py:28 (1 example)>]
 
 The exact name depends on how test_doctest was invoked, so allow for
 leading path components.
@@ -498,6 +512,7 @@
      1  SampleClass.NestedClass.__init__
      1  SampleClass.__init__
      2  SampleClass.a_classmethod
+     1  SampleClass.a_classmethod_property
      1  SampleClass.a_property
      1  SampleClass.a_staticmethod
      1  SampleClass.double
@@ -553,6 +568,7 @@
      1  some_module.SampleClass.NestedClass.__init__
      1  some_module.SampleClass.__init__
      2  some_module.SampleClass.a_classmethod
+     1  some_module.SampleClass.a_classmethod_property
      1  some_module.SampleClass.a_property
      1  some_module.SampleClass.a_staticmethod
      1  some_module.SampleClass.double
@@ -594,6 +610,7 @@
      1  SampleClass.NestedClass.__init__
      1  SampleClass.__init__
      2  SampleClass.a_classmethod
+     1  SampleClass.a_classmethod_property
      1  SampleClass.a_property
      1  SampleClass.a_staticmethod
      1  SampleClass.double
@@ -614,6 +631,7 @@
      0  SampleClass.NestedClass.square
      1  SampleClass.__init__
      2  SampleClass.a_classmethod
+     1  SampleClass.a_classmethod_property
      1  SampleClass.a_property
      1  SampleClass.a_staticmethod
      1  SampleClass.double
@@ -669,7 +687,7 @@
     True
     >>> real_tests = [t for t in tests if len(t.examples) > 0]
     >>> len(real_tests) # objects that actually have doctests
-    13
+    14
     >>> for t in real_tests:
     ...     print('{}  {}'.format(len(t.examples), t.name))
     ...
@@ -682,6 +700,7 @@
     1  builtins.hex
     1  builtins.int
     3  builtins.int.as_integer_ratio
+    2  builtins.int.bit_count
     2  builtins.int.bit_length
     5  builtins.memoryview.hex
     1  builtins.oct
@@ -695,6 +714,18 @@
 
 class TestDocTestFinder(unittest.TestCase):
 
+    def test_issue35753(self):
+        # This import of `call` should trigger issue35753 when
+        # `support.run_doctest` is called due to unwrap failing,
+        # however with a patched doctest this should succeed.
+        from unittest.mock import call
+        dummy_module = types.ModuleType("dummy")
+        dummy_module.__dict__['inject_call'] = call
+        try:
+            support.run_doctest(dummy_module, verbosity=True)
+        except ValueError as e:
+            raise support.TestFailed("Doctest unwrap failed") from e
+
     def test_empty_namespace_package(self):
         pkg_name = 'doctest_empty_pkg'
         with tempfile.TemporaryDirectory() as parent_dir:
@@ -704,7 +735,7 @@
             try:
                 mod = importlib.import_module(pkg_name)
             finally:
-                support.forget(pkg_name)
+                import_helper.forget(pkg_name)
                 sys.path.pop()
 
             include_empty_finder = doctest.DocTestFinder(exclude_empty=False)
@@ -2757,7 +2788,7 @@
     >>> dn = tempfile.mkdtemp()
     >>> pkg = os.path.join(dn, "doctest_testpkg")
     >>> os.mkdir(pkg)
-    >>> support.create_empty_file(os.path.join(pkg, "__init__.py"))
+    >>> os_helper.create_empty_file(os.path.join(pkg, "__init__.py"))
     >>> fn = os.path.join(pkg, "doctest_testfile.txt")
     >>> with open(fn, 'wb') as f:
     ...     f.write(
@@ -2839,10 +2870,11 @@
 simple tests and no errors.  We'll run both the unadorned doctest command, and
 the verbose version, and then check the output:
 
-    >>> from test.support import script_helper, temp_dir
+    >>> from test.support import script_helper
+    >>> from test.support.os_helper import temp_dir
     >>> with temp_dir() as tmpdir:
     ...     fn = os.path.join(tmpdir, 'myfile.doc')
-    ...     with open(fn, 'w') as f:
+    ...     with open(fn, 'w', encoding='utf-8') as f:
     ...         _ = f.write('This is a very simple test file.\n')
     ...         _ = f.write('   >>> 1 + 1\n')
     ...         _ = f.write('   2\n')
@@ -2890,10 +2922,11 @@
 file ends in '.py', its handling of python module files (as opposed to straight
 text files).
 
-    >>> from test.support import script_helper, temp_dir
+    >>> from test.support import script_helper
+    >>> from test.support.os_helper import temp_dir
     >>> with temp_dir() as tmpdir:
     ...     fn = os.path.join(tmpdir, 'myfile.doc')
-    ...     with open(fn, 'w') as f:
+    ...     with open(fn, 'w', encoding="utf-8") as f:
     ...         _ = f.write('This is another simple test file.\n')
     ...         _ = f.write('   >>> 1 + 1\n')
     ...         _ = f.write('   2\n')
@@ -2904,7 +2937,7 @@
     ...         _ = f.write('\n')
     ...         _ = f.write('And that is it.\n')
     ...     fn2 = os.path.join(tmpdir, 'myfile2.py')
-    ...     with open(fn2, 'w') as f:
+    ...     with open(fn2, 'w', encoding='utf-8') as f:
     ...         _ = f.write('def test_func():\n')
     ...         _ = f.write('   \"\"\"\n')
     ...         _ = f.write('   This is simple python test function.\n')
@@ -3034,10 +3067,11 @@
     ...         '-m', 'doctest', 'nosuchfile')
     >>> rc, out
     (1, b'')
+    >>> # The exact error message changes depending on the platform.
     >>> print(normalize(err))                    # doctest: +ELLIPSIS
     Traceback (most recent call last):
       ...
-    FileNotFoundError: [Errno ...] No such file or directory: 'nosuchfile'
+    FileNotFoundError: [Errno ...] ...nosuchfile...
 
 Invalid doctest option:
 
@@ -3091,24 +3125,15 @@
     patches that contain trailing whitespace. More info on Issue 24746.
     """
 
-######################################################################
-## Main
-######################################################################
 
-def test_main():
-    # Check the doctest cases in doctest itself:
-    ret = support.run_doctest(doctest, verbosity=True)
-
-    # Check the doctest cases defined here:
-    from test import test_doctest
-    support.run_doctest(test_doctest, verbosity=True)
-
-    # Run unittests
-    support.run_unittest(__name__)
+def load_tests(loader, tests, pattern):
+    tests.addTest(doctest.DocTestSuite(doctest))
+    tests.addTest(doctest.DocTestSuite())
+    return tests
 
 
 def test_coverage(coverdir):
-    trace = support.import_module('trace')
+    trace = import_helper.import_module('trace')
     tracer = trace.Trace(ignoredirs=[sys.base_prefix, sys.base_exec_prefix,],
                          trace=0, count=1)
     tracer.run('test_main()')
@@ -3117,8 +3142,9 @@
     r.write_results(show_missing=True, summary=True,
                     coverdir=coverdir)
 
+
 if __name__ == '__main__':
     if '-c' in sys.argv:
         test_coverage('/tmp/doctest.cover')
     else:
-        test_main()
+        unittest.main()
diff --git a/Lib/test/test_doctest2.py b/Lib/test/test_doctest2.py
index 347a143..ab8a069 100644
--- a/Lib/test/test_doctest2.py
+++ b/Lib/test/test_doctest2.py
@@ -13,7 +13,6 @@
 
 import sys
 import unittest
-from test import support
 if sys.flags.optimize >= 2:
     raise unittest.SkipTest("Cannot test docstrings with -O2")
 
@@ -107,17 +106,21 @@
         """
         return val
 
-def test_main():
-    from test import test_doctest2
-    EXPECTED = 19
-    f, t = support.run_doctest(test_doctest2)
-    if t != EXPECTED:
-        raise support.TestFailed("expected %d tests to run, not %d" %
-                                      (EXPECTED, t))
+
+class Test(unittest.TestCase):
+    def test_testmod(self):
+        import doctest, sys
+        EXPECTED = 19
+        f, t = doctest.testmod(sys.modules[__name__])
+        if f:
+            self.fail("%d of %d doctests failed" % (f, t))
+        if t != EXPECTED:
+            self.fail("expected %d tests to run, not %d" % (EXPECTED, t))
+
 
 # Pollute the namespace with a bunch of imported functions and classes,
 # to make sure they don't get tested.
 from doctest import *
 
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_docxmlrpc.py b/Lib/test/test_docxmlrpc.py
index 7d3e30c..7725250 100644
--- a/Lib/test/test_docxmlrpc.py
+++ b/Lib/test/test_docxmlrpc.py
@@ -133,7 +133,7 @@
         self.assertIn(
             (b'<dl><dt><a name="-add"><strong>add</strong></a>(x, y)</dt><dd>'
              b'<tt>Add&nbsp;two&nbsp;instances&nbsp;together.&nbsp;This&nbsp;'
-             b'follows&nbsp;<a href="http://www.python.org/dev/peps/pep-0008/">'
+             b'follows&nbsp;<a href="https://www.python.org/dev/peps/pep-0008/">'
              b'PEP008</a>,&nbsp;but&nbsp;has&nbsp;nothing<br>\nto&nbsp;do&nbsp;'
              b'with&nbsp;<a href="http://www.rfc-editor.org/rfc/rfc1952.txt">'
              b'RFC1952</a>.&nbsp;Case&nbsp;should&nbsp;matter:&nbsp;pEp008&nbsp;'
diff --git a/Lib/test/test_dtrace.py b/Lib/test/test_dtrace.py
index 8612e27..8a436ad 100644
--- a/Lib/test/test_dtrace.py
+++ b/Lib/test/test_dtrace.py
@@ -6,7 +6,7 @@
 import types
 import unittest
 
-from test.support import findfile, run_unittest
+from test.support import findfile
 
 
 def abspath(filename):
@@ -34,7 +34,7 @@
         return "\n".join(result)
     except (IndexError, ValueError):
         raise AssertionError(
-            "tracer produced unparseable output:\n{}".format(output)
+            "tracer produced unparsable output:\n{}".format(output)
         )
 
 
@@ -97,7 +97,7 @@
     COMMAND = ["stap", "-g"]
 
 
-class TraceTests(unittest.TestCase):
+class TraceTests:
     # unittest.TestCase options
     maxDiff = None
 
@@ -149,30 +149,25 @@
         self.run_case("line")
 
 
-class DTraceNormalTests(TraceTests):
+class DTraceNormalTests(TraceTests, unittest.TestCase):
     backend = DTraceBackend()
     optimize_python = 0
 
 
-class DTraceOptimizedTests(TraceTests):
+class DTraceOptimizedTests(TraceTests, unittest.TestCase):
     backend = DTraceBackend()
     optimize_python = 2
 
 
-class SystemTapNormalTests(TraceTests):
+class SystemTapNormalTests(TraceTests, unittest.TestCase):
     backend = SystemTapBackend()
     optimize_python = 0
 
 
-class SystemTapOptimizedTests(TraceTests):
+class SystemTapOptimizedTests(TraceTests, unittest.TestCase):
     backend = SystemTapBackend()
     optimize_python = 2
 
 
-def test_main():
-    run_unittest(DTraceNormalTests, DTraceOptimizedTests, SystemTapNormalTests,
-                 SystemTapOptimizedTests)
-
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_eintr.py b/Lib/test/test_eintr.py
index a5f8f64..5281478 100644
--- a/Lib/test/test_eintr.py
+++ b/Lib/test/test_eintr.py
@@ -1,9 +1,6 @@
 import os
 import signal
-import subprocess
-import sys
 import unittest
-
 from test import support
 from test.support import script_helper
 
@@ -15,22 +12,8 @@
     def test_all(self):
         # Run the tester in a sub-process, to make sure there is only one
         # thread (for reliable signal delivery).
-        tester = support.findfile("eintr_tester.py", subdir="eintrdata")
-        # use -u to try to get the full output if the test hangs or crash
-        args = ["-u", tester, "-v"]
-        if support.verbose:
-            print()
-            print("--- run eintr_tester.py ---", flush=True)
-            # In verbose mode, the child process inherit stdout and stdout,
-            # to see output in realtime and reduce the risk of losing output.
-            args = [sys.executable, "-E", "-X", "faulthandler", *args]
-            proc = subprocess.run(args)
-            print(f"--- eintr_tester.py completed: "
-                  f"exit code {proc.returncode} ---", flush=True)
-            if proc.returncode:
-                self.fail("eintr_tester.py failed")
-        else:
-            script_helper.assert_python_ok("-u", tester, "-v")
+        script = support.findfile("_test_eintr.py")
+        script_helper.run_test_script(script)
 
 
 if __name__ == "__main__":
diff --git a/Lib/test/test_email/__init__.py b/Lib/test/test_email/__init__.py
index 888751e..5d708e6 100644
--- a/Lib/test/test_email/__init__.py
+++ b/Lib/test/test_email/__init__.py
@@ -38,7 +38,7 @@
     ndiffAssertEqual = unittest.TestCase.assertEqual
 
     def _msgobj(self, filename):
-        with openfile(filename) as fp:
+        with openfile(filename, encoding="utf-8") as fp:
             return email.message_from_file(fp, policy=self.policy)
 
     def _str_msg(self, string, message=None, policy=None):
diff --git a/Lib/test/test_email/data/PyBanner048.gif b/Lib/test/test_email/data/PyBanner048.gif
index 1a5c87f..7e308f5 100644
--- a/Lib/test/test_email/data/PyBanner048.gif
+++ b/Lib/test/test_email/data/PyBanner048.gif
Binary files differ
diff --git a/Lib/test/test_email/test__header_value_parser.py b/Lib/test/test_email/test__header_value_parser.py
index 1bdcfa1..854f2ff 100644
--- a/Lib/test/test_email/test__header_value_parser.py
+++ b/Lib/test/test_email/test__header_value_parser.py
@@ -395,7 +395,7 @@
             [errors.InvalidHeaderDefect],
             '')
 
-    def test_get_unstructured_invalid_ew(self):
+    def test_get_unstructured_invalid_ew2(self):
         self._test_get_x(self._get_unst,
             '=?utf-8?q?=somevalue?=',
             '=?utf-8?q?=somevalue?=',
diff --git a/Lib/test/test_email/test_contentmanager.py b/Lib/test/test_email/test_contentmanager.py
index f4f6bb7..694cef4 100644
--- a/Lib/test/test_email/test_contentmanager.py
+++ b/Lib/test/test_email/test_contentmanager.py
@@ -776,6 +776,18 @@
             foo
             """).encode('ascii'))
 
+    def test_set_content_bytes_cte_7bit(self):
+        m = self._make_message()
+        m.set_content(b'ASCII-only message.\n',
+            maintype='application', subtype='octet-stream', cte='7bit')
+        self.assertEqual(str(m), textwrap.dedent("""\
+            Content-Type: application/octet-stream
+            Content-Transfer-Encoding: 7bit
+            MIME-Version: 1.0
+
+            ASCII-only message.
+            """))
+
     content_object_params = {
         'text_plain': ('content', ()),
         'text_html': ('content', ('html',)),
diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_email.py
index ab68cdd..a3ccbbb 100644
--- a/Lib/test/test_email/test_email.py
+++ b/Lib/test/test_email/test_email.py
@@ -37,7 +37,8 @@
 from email import base64mime
 from email import quoprimime
 
-from test.support import unlink, start_threads
+from test.support import threading_helper
+from test.support.os_helper import unlink
 from test.test_email import openfile, TestEmailBase
 
 # These imports are documented to work, but we are testing them using a
@@ -213,7 +214,7 @@
     def test_message_rfc822_only(self):
         # Issue 7970: message/rfc822 not in multipart parsed by
         # HeaderParser caused an exception when flattened.
-        with openfile('msg_46.txt') as fp:
+        with openfile('msg_46.txt', encoding="utf-8") as fp:
             msgdata = fp.read()
         parser = HeaderParser()
         msg = parser.parsestr(msgdata)
@@ -224,7 +225,7 @@
 
     def test_byte_message_rfc822_only(self):
         # Make sure new bytes header parser also passes this.
-        with openfile('msg_46.txt') as fp:
+        with openfile('msg_46.txt', encoding="utf-8") as fp:
             msgdata = fp.read().encode('ascii')
         parser = email.parser.BytesHeaderParser()
         msg = parser.parsebytes(msgdata)
@@ -273,7 +274,7 @@
     def test_decoded_generator(self):
         eq = self.assertEqual
         msg = self._msgobj('msg_07.txt')
-        with openfile('msg_17.txt') as fp:
+        with openfile('msg_17.txt', encoding="utf-8") as fp:
             text = fp.read()
         s = StringIO()
         g = DecodedGenerator(s)
@@ -294,7 +295,7 @@
 
     def test_as_string(self):
         msg = self._msgobj('msg_01.txt')
-        with openfile('msg_01.txt') as fp:
+        with openfile('msg_01.txt', encoding="utf-8") as fp:
             text = fp.read()
         self.assertEqual(text, str(msg))
         fullrepr = msg.as_string(unixfrom=True)
@@ -348,7 +349,7 @@
 
     def test_as_bytes(self):
         msg = self._msgobj('msg_01.txt')
-        with openfile('msg_01.txt') as fp:
+        with openfile('msg_01.txt', encoding="utf-8") as fp:
             data = fp.read().encode('ascii')
         self.assertEqual(data, bytes(msg))
         fullrepr = msg.as_bytes(unixfrom=True)
@@ -2435,7 +2436,7 @@
 # Test the MIMEMessage class
 class TestMIMEMessage(TestEmailBase):
     def setUp(self):
-        with openfile('msg_11.txt') as fp:
+        with openfile('msg_11.txt', encoding="utf-8") as fp:
             self._text = fp.read()
 
     def test_type_error(self):
@@ -2554,7 +2555,7 @@
 
     def test_epilogue(self):
         eq = self.ndiffAssertEqual
-        with openfile('msg_21.txt') as fp:
+        with openfile('msg_21.txt', encoding="utf-8") as fp:
             text = fp.read()
         msg = Message()
         msg['From'] = 'aperson@dom.ain'
@@ -2609,7 +2610,7 @@
 
     def test_default_type(self):
         eq = self.assertEqual
-        with openfile('msg_30.txt') as fp:
+        with openfile('msg_30.txt', encoding="utf-8") as fp:
             msg = email.message_from_file(fp)
         container1 = msg.get_payload(0)
         eq(container1.get_default_type(), 'message/rfc822')
@@ -2626,7 +2627,7 @@
 
     def test_default_type_with_explicit_container_type(self):
         eq = self.assertEqual
-        with openfile('msg_28.txt') as fp:
+        with openfile('msg_28.txt', encoding="utf-8") as fp:
             msg = email.message_from_file(fp)
         container1 = msg.get_payload(0)
         eq(container1.get_default_type(), 'message/rfc822')
@@ -2742,6 +2743,20 @@
         self.assertEqual(str(cm.exception),
                          'There may be at most 1 To headers in a message')
 
+
+# Test the NonMultipart class
+class TestNonMultipart(TestEmailBase):
+    def test_nonmultipart_is_not_multipart(self):
+        msg = MIMENonMultipart('text', 'plain')
+        self.assertFalse(msg.is_multipart())
+
+    def test_attach_raises_exception(self):
+        msg = Message()
+        msg['Subject'] = 'subpart 1'
+        r = MIMENonMultipart('text', 'plain')
+        self.assertRaises(errors.MultipartConversionError, r.attach, msg)
+
+
 # A general test of parser->model->generator idempotency.  IOW, read a message
 # in, parse it into a message object tree, then without touching the tree,
 # regenerate the plain text.  The original text and the transformed text
@@ -2752,7 +2767,7 @@
     linesep = '\n'
 
     def _msgobj(self, filename):
-        with openfile(filename) as fp:
+        with openfile(filename, encoding="utf-8") as fp:
             data = fp.read()
         msg = email.message_from_string(data)
         return msg, data
@@ -2908,7 +2923,7 @@
 # Test various other bits of the package's functionality
 class TestMiscellaneous(TestEmailBase):
     def test_message_from_string(self):
-        with openfile('msg_01.txt') as fp:
+        with openfile('msg_01.txt', encoding="utf-8") as fp:
             text = fp.read()
         msg = email.message_from_string(text)
         s = StringIO()
@@ -2919,7 +2934,7 @@
         self.assertEqual(text, s.getvalue())
 
     def test_message_from_file(self):
-        with openfile('msg_01.txt') as fp:
+        with openfile('msg_01.txt', encoding="utf-8") as fp:
             text = fp.read()
             fp.seek(0)
             msg = email.message_from_file(fp)
@@ -2931,7 +2946,7 @@
             self.assertEqual(text, s.getvalue())
 
     def test_message_from_string_with_class(self):
-        with openfile('msg_01.txt') as fp:
+        with openfile('msg_01.txt', encoding="utf-8") as fp:
             text = fp.read()
 
         # Create a subclass
@@ -2941,7 +2956,7 @@
         msg = email.message_from_string(text, MyMessage)
         self.assertIsInstance(msg, MyMessage)
         # Try something more complicated
-        with openfile('msg_02.txt') as fp:
+        with openfile('msg_02.txt', encoding="utf-8") as fp:
             text = fp.read()
         msg = email.message_from_string(text, MyMessage)
         for subpart in msg.walk():
@@ -2952,11 +2967,11 @@
         class MyMessage(Message):
             pass
 
-        with openfile('msg_01.txt') as fp:
+        with openfile('msg_01.txt', encoding="utf-8") as fp:
             msg = email.message_from_file(fp, MyMessage)
         self.assertIsInstance(msg, MyMessage)
         # Try something more complicated
-        with openfile('msg_02.txt') as fp:
+        with openfile('msg_02.txt', encoding="utf-8") as fp:
             msg = email.message_from_file(fp, MyMessage)
         for subpart in msg.walk():
             self.assertIsInstance(subpart, MyMessage)
@@ -3002,10 +3017,13 @@
     def test_parsedate_returns_None_for_invalid_strings(self):
         self.assertIsNone(utils.parsedate(''))
         self.assertIsNone(utils.parsedate_tz(''))
+        self.assertIsNone(utils.parsedate(' '))
+        self.assertIsNone(utils.parsedate_tz(' '))
         self.assertIsNone(utils.parsedate('0'))
         self.assertIsNone(utils.parsedate_tz('0'))
         self.assertIsNone(utils.parsedate('A Complete Waste of Time'))
         self.assertIsNone(utils.parsedate_tz('A Complete Waste of Time'))
+        self.assertIsNone(utils.parsedate_tz('Wed, 3 Apr 2002 12.34.56.78+0800'))
         # Not a part of the spec but, but this has historically worked:
         self.assertIsNone(utils.parsedate(None))
         self.assertIsNone(utils.parsedate_tz(None))
@@ -3262,6 +3280,11 @@
         addrs = utils.getaddresses(['User ((nested comment)) <foo@bar.com>'])
         eq(addrs[0][1], 'foo@bar.com')
 
+    def test_getaddresses_header_obj(self):
+        """Test the handling of a Header object."""
+        addrs = utils.getaddresses([Header('Al Person <aperson@dom.ain>')])
+        self.assertEqual(addrs[0][1], 'aperson@dom.ain')
+
     def test_make_msgid_collisions(self):
         # Test make_msgid uniqueness, even with multiple threads
         class MsgidsThread(Thread):
@@ -3276,7 +3299,7 @@
                     append(make_msgid(domain='testdomain-string'))
 
         threads = [MsgidsThread() for i in range(5)]
-        with start_threads(threads):
+        with threading_helper.start_threads(threads):
             pass
         all_ids = sum([t.msgids for t in threads], [])
         self.assertEqual(len(set(all_ids)), len(all_ids))
@@ -3385,7 +3408,7 @@
 
     def test_Generator_linend(self):
         # Issue 14645.
-        with openfile('msg_26.txt', newline='\n') as f:
+        with openfile('msg_26.txt', encoding="utf-8", newline='\n') as f:
             msgtxt = f.read()
         msgtxt_nl = msgtxt.replace('\r\n', '\n')
         msg = email.message_from_string(msgtxt)
@@ -3396,7 +3419,7 @@
 
     def test_BytesGenerator_linend(self):
         # Issue 14645.
-        with openfile('msg_26.txt', newline='\n') as f:
+        with openfile('msg_26.txt', encoding="utf-8", newline='\n') as f:
             msgtxt = f.read()
         msgtxt_nl = msgtxt.replace('\r\n', '\n')
         msg = email.message_from_string(msgtxt_nl)
@@ -3455,7 +3478,7 @@
         it = iterators.body_line_iterator(msg)
         lines = list(it)
         eq(len(lines), 43)
-        with openfile('msg_19.txt') as fp:
+        with openfile('msg_19.txt', encoding="utf-8") as fp:
             neq(EMPTYSTRING.join(lines), fp.read())
 
     def test_typed_subpart_iterator(self):
@@ -3596,7 +3619,7 @@
     def test_header_parser(self):
         eq = self.assertEqual
         # Parse only the headers of a complex multipart MIME document
-        with openfile('msg_02.txt') as fp:
+        with openfile('msg_02.txt', encoding="utf-8") as fp:
             msg = HeaderParser().parse(fp)
         eq(msg['from'], 'ppp-request@zzz.org')
         eq(msg['to'], 'ppp@zzz.org')
@@ -3630,12 +3653,12 @@
             self.assertFalse(fp.closed)
 
     def test_parser_does_not_close_file(self):
-        with openfile('msg_02.txt', 'r') as fp:
+        with openfile('msg_02.txt', encoding="utf-8") as fp:
             email.parser.Parser().parse(fp)
             self.assertFalse(fp.closed)
 
     def test_parser_on_exception_does_not_close_file(self):
-        with openfile('msg_15.txt', 'r') as fp:
+        with openfile('msg_15.txt', encoding="utf-8") as fp:
             parser = email.parser.Parser
             self.assertRaises(email.errors.StartBoundaryNotFoundDefect,
                               parser(policy=email.policy.strict).parse, fp)
@@ -3679,7 +3702,7 @@
 
     def test_crlf_separation(self):
         eq = self.assertEqual
-        with openfile('msg_26.txt', newline='\n') as fp:
+        with openfile('msg_26.txt', encoding="utf-8", newline='\n') as fp:
             msg = Parser().parse(fp)
         eq(len(msg.get_payload()), 2)
         part1 = msg.get_payload(0)
@@ -3690,7 +3713,7 @@
 
     def test_crlf_flatten(self):
         # Using newline='\n' preserves the crlfs in this input file.
-        with openfile('msg_26.txt', newline='\n') as fp:
+        with openfile('msg_26.txt', encoding="utf-8", newline='\n') as fp:
             text = fp.read()
         msg = email.message_from_string(text)
         s = StringIO()
@@ -3703,7 +3726,7 @@
     def test_multipart_digest_with_extra_mime_headers(self):
         eq = self.assertEqual
         neq = self.ndiffAssertEqual
-        with openfile('msg_28.txt') as fp:
+        with openfile('msg_28.txt', encoding="utf-8") as fp:
             msg = email.message_from_file(fp)
         # Structure is:
         # multipart/digest
@@ -4260,7 +4283,7 @@
 
     def test_encode(self):
         eq = self.assertEqual
-        eq(base64mime.body_encode(b''), b'')
+        eq(base64mime.body_encode(b''), '')
         eq(base64mime.body_encode(b'hello'), 'aGVsbG8=\n')
         # Test the binary flag
         eq(base64mime.body_encode(b'hello\n'), 'aGVsbG8K\n')
@@ -4291,7 +4314,6 @@
         eq(he('hello\nworld'), '=?iso-8859-1?b?aGVsbG8Kd29ybGQ=?=')
 
 
-
 class TestQuopri(unittest.TestCase):
     def setUp(self):
         # Set of characters (as byte integers) that don't need to be encoded
@@ -5447,7 +5469,7 @@
 class TestSigned(TestEmailBase):
 
     def _msg_and_obj(self, filename):
-        with openfile(filename) as fp:
+        with openfile(filename, encoding="utf-8") as fp:
             original = fp.read()
             msg = email.message_from_string(original)
         return original, msg
diff --git a/Lib/test/test_email/test_headerregistry.py b/Lib/test/test_email/test_headerregistry.py
index 68bbc95..59fcd93 100644
--- a/Lib/test/test_email/test_headerregistry.py
+++ b/Lib/test/test_email/test_headerregistry.py
@@ -204,6 +204,22 @@
         self.assertEqual(len(h.defects), 1)
         self.assertIsInstance(h.defects[0], errors.HeaderMissingRequiredValue)
 
+    def test_invalid_date_format(self):
+        s = 'Not a date header'
+        h = self.make_header('date', s)
+        self.assertEqual(h, s)
+        self.assertIsNone(h.datetime)
+        self.assertEqual(len(h.defects), 1)
+        self.assertIsInstance(h.defects[0], errors.InvalidDateDefect)
+
+    def test_invalid_date_value(self):
+        s = 'Tue, 06 Jun 2017 27:39:33 +0600'
+        h = self.make_header('date', s)
+        self.assertEqual(h, s)
+        self.assertIsNone(h.datetime)
+        self.assertEqual(len(h.defects), 1)
+        self.assertIsInstance(h.defects[0], errors.InvalidDateDefect)
+
     def test_datetime_read_only(self):
         h = self.make_header('date', self.datestring)
         with self.assertRaises(AttributeError):
diff --git a/Lib/test/test_email/test_inversion.py b/Lib/test/test_email/test_inversion.py
index 8e8d676..7bd7f2a 100644
--- a/Lib/test/test_email/test_inversion.py
+++ b/Lib/test/test_email/test_inversion.py
@@ -46,6 +46,14 @@
             foo
             """),),
 
+        'header_with_invalid_date': (dedent(b"""\
+            Date: Tue, 06 Jun 2017 27:39:33 +0600
+            From: abc@xyz.com
+            Subject: timezones
+
+            How do they work even?
+            """),),
+
             }
 
     payload_params = {
diff --git a/Lib/test/test_email/test_message.py b/Lib/test/test_email/test_message.py
index fab97d9..4c754bf 100644
--- a/Lib/test/test_email/test_message.py
+++ b/Lib/test/test_email/test_message.py
@@ -433,7 +433,7 @@
                 --===
                 Content-Type: text/plain
 
-                Your message has bounced, ser.
+                Your message has bounced, sir.
 
                 --===
                 Content-Type: message/rfc822
@@ -487,10 +487,14 @@
         self.assertEqual(list(m.iter_attachments()), attachments)
 
     def message_as_iter_parts(self, body_parts, attachments, parts, msg):
+        def _is_multipart_msg(msg):
+            return 'Content-Type: multipart' in msg
+
         m = self._str_msg(msg)
         allparts = list(m.walk())
         parts = [allparts[n] for n in parts]
-        self.assertEqual(list(m.iter_parts()), parts)
+        iter_parts = list(m.iter_parts()) if _is_multipart_msg(msg) else []
+        self.assertEqual(iter_parts, parts)
 
     class _TestContentManager:
         def get_content(self, msg, *args, **kw):
@@ -775,6 +779,13 @@
         self.assertEqual(len(m.as_string(maxheaderlen=34).strip().splitlines()),
                          6)
 
+    def test_as_string_unixform(self):
+        m = self._str_msg('test')
+        m.set_unixfrom('From foo@bar Thu Jan  1 00:00:00 1970')
+        self.assertEqual(m.as_string(unixfrom=True),
+                        'From foo@bar Thu Jan  1 00:00:00 1970\n\ntest')
+        self.assertEqual(m.as_string(unixfrom=False), '\ntest')
+
     def test_str_defaults_to_policy_max_line_length(self):
         m = self._str_msg('Subject: long line' + ' ab'*50 + '\n\n')
         self.assertEqual(len(str(m).strip().splitlines()), 3)
@@ -916,6 +927,34 @@
                          b'123456789-123456789\n 123456789 Hello '
                          b'=?utf-8?q?W=C3=B6rld!?= 123456789 123456789\n\n')
 
+    def test_get_body_malformed(self):
+        """test for bpo-42892"""
+        msg = textwrap.dedent("""\
+            Message-ID: <674392CA.4347091@email.au>
+            Date: Wed, 08 Nov 2017 08:50:22 +0700
+            From: Foo Bar <email@email.au>
+            MIME-Version: 1.0
+            To: email@email.com <email@email.com>
+            Subject: Python Email
+            Content-Type: multipart/mixed;
+            boundary="------------879045806563892972123996"
+            X-Global-filter:Messagescannedforspamandviruses:passedalltests
+
+            This is a multi-part message in MIME format.
+            --------------879045806563892972123996
+            Content-Type: text/plain; charset=ISO-8859-1; format=flowed
+            Content-Transfer-Encoding: 7bit
+
+            Your message is ready to be sent with the following file or link
+            attachments:
+            XU89 - 08.11.2017
+            """)
+        m = self._str_msg(msg)
+        # In bpo-42892, this would raise
+        # AttributeError: 'str' object has no attribute 'is_attachment'
+        m.get_body()
+
+
 class TestMIMEPart(TestEmailMessageBase, TestEmailBase):
     # Doing the full test run here may seem a bit redundant, since the two
     # classes are almost identical.  But what if they drift apart?  So we do
diff --git a/Lib/test/test_email/test_utils.py b/Lib/test/test_email/test_utils.py
index 4e3c3f3..e3d3eae 100644
--- a/Lib/test/test_email/test_utils.py
+++ b/Lib/test/test_email/test_utils.py
@@ -48,6 +48,16 @@
             utils.parsedate_to_datetime(self.datestring + ' -0000'),
             self.naive_dt)
 
+    def test_parsedate_to_datetime_with_invalid_raises_valueerror(self):
+        invalid_dates = ['',
+                         '0',
+                         'A Complete Waste of Time'
+                         'Tue, 06 Jun 2017 27:39:33 +0600',
+                         'Tue, 06 Jun 2017 07:39:33 +2600',
+                         'Tue, 06 Jun 2017 27:39:33']
+        for dtstr in invalid_dates:
+            with self.subTest(dtstr=dtstr):
+                self.assertRaises(ValueError, utils.parsedate_to_datetime, dtstr)
 
 class LocaltimeTests(unittest.TestCase):
 
diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py
index aeb44d7..503d492 100644
--- a/Lib/test/test_embed.py
+++ b/Lib/test/test_embed.py
@@ -1,5 +1,7 @@
 # Run the tests in Programs/_testembed.c (tests for the CPython embedding APIs)
 from test import support
+from test.support import import_helper
+from test.support import os_helper
 import unittest
 
 from collections import namedtuple
@@ -28,6 +30,9 @@
 # _PyCoreConfig_InitIsolatedConfig()
 API_ISOLATED = 3
 
+INIT_LOOPS = 16
+MAX_HASH_SEED = 4294967295
+
 
 def debug_build(program):
     program = os.path.basename(program)
@@ -107,13 +112,13 @@
         self.assertEqual(err, "")
 
         # The output from _testembed looks like this:
-        # --- Pass 0 ---
+        # --- Pass 1 ---
         # interp 0 <0x1cf9330>, thread state <0x1cf9700>: id(modules) = 139650431942728
         # interp 1 <0x1d4f690>, thread state <0x1d35350>: id(modules) = 139650431165784
         # interp 2 <0x1d5a690>, thread state <0x1d99ed0>: id(modules) = 139650413140368
         # interp 3 <0x1d4f690>, thread state <0x1dc3340>: id(modules) = 139650412862200
         # interp 0 <0x1cf9330>, thread state <0x1cf9700>: id(modules) = 139650431942728
-        # --- Pass 1 ---
+        # --- Pass 2 ---
         # ...
 
         interp_pat = (r"^interp (\d+) <(0x[\dA-F]+)>, "
@@ -121,7 +126,7 @@
                       r"id\(modules\) = ([\d]+)$")
         Interp = namedtuple("Interp", "id interp tstate modules")
 
-        numloops = 0
+        numloops = 1
         current_run = []
         for line in out.splitlines():
             if line == "--- Pass {} ---".format(numloops):
@@ -155,6 +160,8 @@
 
 
 class EmbeddingTests(EmbeddingTestsMixin, unittest.TestCase):
+    maxDiff = 100 * 50
+
     def test_subinterps_main(self):
         for run in self.run_repeated_init_and_subinterpreters():
             main = run[0]
@@ -190,6 +197,14 @@
                 self.assertNotEqual(sub.tstate, main.tstate)
                 self.assertNotEqual(sub.modules, main.modules)
 
+    def test_repeated_init_and_inittab(self):
+        out, err = self.run_embedded_interpreter("test_repeated_init_and_inittab")
+        self.assertEqual(err, "")
+
+        lines = [f"--- Pass {i} ---" for i in range(1, INIT_LOOPS+1)]
+        lines = "\n".join(lines) + "\n"
+        self.assertEqual(out, lines)
+
     def test_forced_io_encoding(self):
         # Checks forced configuration of embedded interpreter IO streams
         env = dict(os.environ, PYTHONIOENCODING="utf-8:surrogateescape")
@@ -235,7 +250,7 @@
 
     def test_pre_initialization_api(self):
         """
-        Checks some key parts of the C-API that need to work before the runtine
+        Checks some key parts of the C-API that need to work before the runtime
         is initialized (via Py_Initialize()).
         """
         env = dict(os.environ, PYTHONPATH=os.pathsep.join(sys.path))
@@ -296,6 +311,14 @@
         self.assertEqual(out.rstrip(), "Py_RunMain(): sys.argv=['-c', 'arg2']")
         self.assertEqual(err, '')
 
+    def test_run_main_loop(self):
+        # bpo-40413: Calling Py_InitializeFromConfig()+Py_RunMain() multiple
+        # times must not crash.
+        nloop = 5
+        out, err = self.run_embedded_interpreter("test_run_main_loop")
+        self.assertEqual(out, "Py_RunMain(): sys.argv=['-c', 'arg2']\n" * nloop)
+        self.assertEqual(err, '')
+
 
 class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
     maxDiff = 4096
@@ -347,7 +370,6 @@
         'isolated': 0,
         'use_environment': 1,
         'dev_mode': 0,
-        '_use_peg_parser': 1,
 
         'install_signal_handlers': 1,
         'use_hash_seed': 0,
@@ -366,7 +388,7 @@
         'program_name': GET_DEFAULT_CONFIG,
         'parse_argv': 0,
         'argv': [""],
-        '_orig_argv': [],
+        'orig_argv': [],
 
         'xoptions': [],
         'warnoptions': [],
@@ -381,10 +403,12 @@
         'exec_prefix': GET_DEFAULT_CONFIG,
         'base_exec_prefix': GET_DEFAULT_CONFIG,
         'module_search_paths': GET_DEFAULT_CONFIG,
+        'module_search_paths_set': 1,
         'platlibdir': sys.platlibdir,
 
         'site_import': 1,
         'bytes_warning': 0,
+        'warn_default_encoding': 0,
         'inspect': 0,
         'interactive': 0,
         'optimization_level': 0,
@@ -418,7 +442,7 @@
     CONFIG_PYTHON = dict(CONFIG_COMPAT,
         _config_init=API_PYTHON,
         configure_c_stdio=1,
-        parse_argv=1,
+        parse_argv=2,
     )
     CONFIG_ISOLATED = dict(CONFIG_COMPAT,
         _config_init=API_ISOLATED,
@@ -472,6 +496,31 @@
             ('Py_LegacyWindowsStdioFlag', 'legacy_windows_stdio'),
         ))
 
+    # path config
+    if MS_WINDOWS:
+        PATH_CONFIG = {
+            'isolated': -1,
+            'site_import': -1,
+            'python3_dll': GET_DEFAULT_CONFIG,
+        }
+    else:
+        PATH_CONFIG = {}
+    # other keys are copied by COPY_PATH_CONFIG
+
+    COPY_PATH_CONFIG = [
+        # Copy core config to global config for expected values
+        'prefix',
+        'exec_prefix',
+        'program_name',
+        'home',
+        # program_full_path and module_search_path are copied indirectly from
+        # the core configuration in check_path_config().
+    ]
+    if MS_WINDOWS:
+        COPY_PATH_CONFIG.extend((
+            'base_executable',
+        ))
+
     EXPECTED_CONFIG = None
 
     @classmethod
@@ -536,9 +585,9 @@
             configs[config_key] = config
         return configs
 
-    def get_expected_config(self, expected_preconfig, expected, env, api,
+    def get_expected_config(self, expected_preconfig, expected,
+                            expected_pathconfig, env, api,
                             modify_path_cb=None):
-        cls = self.__class__
         configs = self._get_expected_config()
 
         pre_config = configs['pre_config']
@@ -546,6 +595,11 @@
             if value is self.GET_DEFAULT_CONFIG:
                 expected_preconfig[key] = pre_config[key]
 
+        path_config = configs['path_config']
+        for key, value in expected_pathconfig.items():
+            if value is self.GET_DEFAULT_CONFIG:
+                expected_pathconfig[key] = path_config[key]
+
         if not expected_preconfig['configure_locale'] or api == API_COMPAT:
             # there is no easy way to get the locale encoding before
             # setlocale(LC_CTYPE, "") is called: don't test encodings
@@ -638,8 +692,19 @@
 
         self.assertEqual(configs['global_config'], expected)
 
+    def check_path_config(self, configs, expected):
+        config = configs['config']
+
+        for key in self.COPY_PATH_CONFIG:
+            expected[key] = config[key]
+        expected['module_search_path'] = os.path.pathsep.join(config['module_search_paths'])
+        expected['program_full_path'] = config['executable']
+
+        self.assertEqual(configs['path_config'], expected)
+
     def check_all_configs(self, testname, expected_config=None,
-                          expected_preconfig=None, modify_path_cb=None,
+                          expected_preconfig=None, expected_pathconfig=None,
+                          modify_path_cb=None,
                           stderr=None, *, api, preconfig_api=None,
                           env=None, ignore_stderr=False, cwd=None):
         new_env = remove_python_envvars()
@@ -658,9 +723,14 @@
         if expected_preconfig is None:
             expected_preconfig = {}
         expected_preconfig = dict(default_preconfig, **expected_preconfig)
+
         if expected_config is None:
             expected_config = {}
 
+        if expected_pathconfig is None:
+            expected_pathconfig = {}
+        expected_pathconfig = dict(self.PATH_CONFIG, **expected_pathconfig)
+
         if api == API_PYTHON:
             default_config = self.CONFIG_PYTHON
         elif api == API_ISOLATED:
@@ -670,7 +740,9 @@
         expected_config = dict(default_config, **expected_config)
 
         self.get_expected_config(expected_preconfig,
-                                 expected_config, env,
+                                 expected_config,
+                                 expected_pathconfig,
+                                 env,
                                  api, modify_path_cb)
 
         out, err = self.run_embedded_interpreter(testname,
@@ -687,6 +759,7 @@
         self.check_pre_config(configs, expected_preconfig)
         self.check_config(configs, expected_config)
         self.check_global_config(configs)
+        self.check_path_config(configs, expected_pathconfig)
         return configs
 
     def test_init_default_config(self):
@@ -734,7 +807,6 @@
             'import_time': 1,
             'show_ref_count': 1,
             'malloc_stats': 1,
-            '_use_peg_parser': 0,
 
             'stdio_encoding': 'iso8859-1',
             'stdio_errors': 'replace',
@@ -742,12 +814,12 @@
             'pycache_prefix': 'conf_pycache_prefix',
             'program_name': './conf_program_name',
             'argv': ['-c', 'arg2'],
-            '_orig_argv': ['python3',
-                           '-W', 'cmdline_warnoption',
-                           '-X', 'cmdline_xoption',
-                           '-c', 'pass',
-                           'arg2'],
-            'parse_argv': 1,
+            'orig_argv': ['python3',
+                          '-W', 'cmdline_warnoption',
+                          '-X', 'cmdline_xoption',
+                          '-c', 'pass',
+                          'arg2'],
+            'parse_argv': 2,
             'xoptions': [
                 'config_xoption1=3',
                 'config_xoption2=',
@@ -808,7 +880,6 @@
             'warnoptions': ['EnvVar'],
             'platlibdir': 'env_platlibdir',
             'module_search_paths': self.IGNORE_CONFIG,
-            '_use_peg_parser': 0,
         }
         self.check_all_configs("test_init_compat_env", config, preconfig,
                                api=API_COMPAT)
@@ -838,7 +909,6 @@
             'warnoptions': ['EnvVar'],
             'platlibdir': 'env_platlibdir',
             'module_search_paths': self.IGNORE_CONFIG,
-            '_use_peg_parser': 0,
         }
         self.check_all_configs("test_init_python_env", config, preconfig,
                                api=API_PYTHON)
@@ -879,7 +949,7 @@
         }
         config = {
             'argv': ['script.py'],
-            '_orig_argv': ['python3', '-X', 'dev', 'script.py'],
+            'orig_argv': ['python3', '-X', 'dev', 'script.py'],
             'run_filename': os.path.abspath('script.py'),
             'dev_mode': 1,
             'faulthandler': 1,
@@ -901,7 +971,7 @@
                "script.py"]
         config = {
             'argv': argv,
-            '_orig_argv': argv,
+            'orig_argv': argv,
             'isolated': 0,
         }
         self.check_all_configs("test_preinit_dont_parse_argv", config, preconfig,
@@ -980,9 +1050,9 @@
                 'ignore:::sysadd_warnoption',
                 'ignore:::config_warnoption',
             ],
-            '_orig_argv': ['python3',
-                           '-W', 'ignore:::cmdline_warnoption',
-                           '-X', 'cmdline_xoption'],
+            'orig_argv': ['python3',
+                          '-W', 'ignore:::cmdline_warnoption',
+                          '-X', 'cmdline_xoption'],
         }
         self.check_all_configs("test_init_sys_add", config, api=API_PYTHON)
 
@@ -991,10 +1061,10 @@
                 'print(json.dumps(_testinternalcapi.get_configs()))')
         config = {
             'argv': ['-c', 'arg2'],
-            '_orig_argv': ['python3', '-c', code, 'arg2'],
+            'orig_argv': ['python3', '-c', code, 'arg2'],
             'program_name': './python3',
             'run_command': code + '\n',
-            'parse_argv': 1,
+            'parse_argv': 2,
         }
         self.check_all_configs("test_init_run_main", config, api=API_PYTHON)
 
@@ -1003,12 +1073,12 @@
                 'print(json.dumps(_testinternalcapi.get_configs()))')
         config = {
             'argv': ['-c', 'arg2'],
-            '_orig_argv': ['python3',
-                           '-c', code,
-                           'arg2'],
+            'orig_argv': ['python3',
+                          '-c', code,
+                          'arg2'],
             'program_name': './python3',
             'run_command': code + '\n',
-            'parse_argv': 1,
+            'parse_argv': 2,
             '_init_main': 0,
         }
         self.check_all_configs("test_init_main", config,
@@ -1017,9 +1087,9 @@
 
     def test_init_parse_argv(self):
         config = {
-            'parse_argv': 1,
+            'parse_argv': 2,
             'argv': ['-c', 'arg1', '-v', 'arg3'],
-            '_orig_argv': ['./argv0', '-E', '-c', 'pass', 'arg1', '-v', 'arg3'],
+            'orig_argv': ['./argv0', '-E', '-c', 'pass', 'arg1', '-v', 'arg3'],
             'program_name': './argv0',
             'run_command': 'pass\n',
             'use_environment': 0,
@@ -1033,7 +1103,7 @@
         config = {
             'parse_argv': 0,
             'argv': ['./argv0', '-E', '-c', 'pass', 'arg1', '-v', 'arg3'],
-            '_orig_argv': ['./argv0', '-E', '-c', 'pass', 'arg1', '-v', 'arg3'],
+            'orig_argv': ['./argv0', '-E', '-c', 'pass', 'arg1', '-v', 'arg3'],
             'program_name': './argv0',
         }
         self.check_all_configs("test_init_dont_parse_argv", config, pre_config,
@@ -1086,7 +1156,7 @@
             'base_prefix': '',
             'exec_prefix': '',
             'base_exec_prefix': '',
-            # overriden by PyConfig
+            # overridden by PyConfig
             'program_name': 'conf_program_name',
             'base_executable': 'conf_executable',
             'executable': 'conf_executable',
@@ -1164,7 +1234,6 @@
             self.fail(f"Unable to find home in {paths!r}")
 
         prefix = exec_prefix = home
-        ver = sys.version_info
         expected_paths = self.module_search_paths(prefix=home, exec_prefix=home)
 
         config = {
@@ -1262,22 +1331,24 @@
                 'executable': executable,
                 'module_search_paths': paths,
             }
+            path_config = {}
             if MS_WINDOWS:
                 config['base_prefix'] = pyvenv_home
                 config['prefix'] = pyvenv_home
-            env = self.copy_paths_by_env(config)
-            actual = self.check_all_configs("test_init_compat_config", config,
-                                            api=API_COMPAT, env=env,
-                                            ignore_stderr=True, cwd=tmpdir)
-            if MS_WINDOWS:
-                self.assertEqual(
-                    actual['windows']['python3_dll'],
-                    os.path.join(
-                        tmpdir,
-                        os.path.basename(self.EXPECTED_CONFIG['windows']['python3_dll'])
-                    )
-                )
 
+                ver = sys.version_info
+                dll = f'python{ver.major}'
+                if debug_build(executable):
+                    dll += '_d'
+                dll += '.DLL'
+                dll = os.path.join(os.path.dirname(executable), dll)
+                path_config['python3_dll'] = dll
+
+            env = self.copy_paths_by_env(config)
+            self.check_all_configs("test_init_compat_config", config,
+                                   expected_pathconfig=path_config,
+                                   api=API_COMPAT, env=env,
+                                   ignore_stderr=True, cwd=tmpdir)
 
     def test_global_pathconfig(self):
         # Test C API functions getting the path configuration:
@@ -1291,8 +1362,8 @@
         #
         # The global path configuration (_Py_path_config) must be a copy
         # of the path configuration of PyInterpreter.config (PyConfig).
-        ctypes = support.import_module('ctypes')
-        _testinternalcapi = support.import_module('_testinternalcapi')
+        ctypes = import_helper.import_module('ctypes')
+        _testinternalcapi = import_helper.import_module('_testinternalcapi')
 
         def get_func(name):
             func = getattr(ctypes.pythonapi, name)
@@ -1337,18 +1408,38 @@
             'faulthandler': 1,
             'bytes_warning': 1,
             'warnoptions': warnoptions,
-            '_orig_argv': ['python3',
-                           '-Wignore:::cmdline1',
-                           '-Wignore:::cmdline2'],
+            'orig_argv': ['python3',
+                          '-Wignore:::cmdline1',
+                          '-Wignore:::cmdline2'],
         }
         self.check_all_configs("test_init_warnoptions", config, preconfig,
                                api=API_PYTHON)
 
+    def test_init_set_config(self):
+        config = {
+            '_init_main': 0,
+            'bytes_warning': 2,
+            'warnoptions': ['error::BytesWarning'],
+        }
+        self.check_all_configs("test_init_set_config", config,
+                               api=API_ISOLATED)
+
     def test_get_argc_argv(self):
         self.run_embedded_interpreter("test_get_argc_argv")
         # ignore output
 
 
+class SetConfigTests(unittest.TestCase):
+    def test_set_config(self):
+        # bpo-42260: Test _PyInterpreterState_SetConfig()
+        cmd = [sys.executable, '-I', '-m', 'test._test_embed_set_config']
+        proc = subprocess.run(cmd,
+                              stdout=subprocess.PIPE,
+                              stderr=subprocess.PIPE)
+        self.assertEqual(proc.returncode, 0,
+                         (proc.returncode, proc.stdout, proc.stderr))
+
+
 class AuditingTests(EmbeddingTestsMixin, unittest.TestCase):
     def test_open_code_hook(self):
         self.run_embedded_interpreter("test_open_code_hook")
@@ -1370,7 +1461,7 @@
                                       returncode=1)
 
     def test_audit_run_interactivehook(self):
-        startup = os.path.join(self.oldcwd, support.TESTFN) + ".py"
+        startup = os.path.join(self.oldcwd, os_helper.TESTFN) + ".py"
         with open(startup, "w", encoding="utf-8") as f:
             print("import sys", file=f)
             print("sys.__interactivehook__ = lambda: None", file=f)
@@ -1383,7 +1474,7 @@
             os.unlink(startup)
 
     def test_audit_run_startup(self):
-        startup = os.path.join(self.oldcwd, support.TESTFN) + ".py"
+        startup = os.path.join(self.oldcwd, os_helper.TESTFN) + ".py"
         with open(startup, "w", encoding="utf-8") as f:
             print("pass", file=f)
         try:
@@ -1399,5 +1490,64 @@
                                       timeout=support.SHORT_TIMEOUT,
                                       returncode=1)
 
+
+class MiscTests(EmbeddingTestsMixin, unittest.TestCase):
+    def test_unicode_id_init(self):
+        # bpo-42882: Test that _PyUnicode_FromId() works
+        # when Python is initialized multiples times.
+        self.run_embedded_interpreter("test_unicode_id_init")
+
+
+class StdPrinterTests(EmbeddingTestsMixin, unittest.TestCase):
+    # Test PyStdPrinter_Type which is used by _PySys_SetPreliminaryStderr():
+    #   "Set up a preliminary stderr printer until we have enough
+    #    infrastructure for the io module in place."
+
+    STDOUT_FD = 1
+
+    def create_printer(self, fd):
+        ctypes = import_helper.import_module('ctypes')
+        PyFile_NewStdPrinter = ctypes.pythonapi.PyFile_NewStdPrinter
+        PyFile_NewStdPrinter.argtypes = (ctypes.c_int,)
+        PyFile_NewStdPrinter.restype = ctypes.py_object
+        return PyFile_NewStdPrinter(fd)
+
+    def test_write(self):
+        message = "unicode:\xe9-\u20ac-\udc80!\n"
+
+        stdout_fd = self.STDOUT_FD
+        stdout_fd_copy = os.dup(stdout_fd)
+        self.addCleanup(os.close, stdout_fd_copy)
+
+        rfd, wfd = os.pipe()
+        self.addCleanup(os.close, rfd)
+        self.addCleanup(os.close, wfd)
+        try:
+            # PyFile_NewStdPrinter() only accepts fileno(stdout)
+            # or fileno(stderr) file descriptor.
+            os.dup2(wfd, stdout_fd)
+
+            printer = self.create_printer(stdout_fd)
+            printer.write(message)
+        finally:
+            os.dup2(stdout_fd_copy, stdout_fd)
+
+        data = os.read(rfd, 100)
+        self.assertEqual(data, message.encode('utf8', 'backslashreplace'))
+
+    def test_methods(self):
+        fd = self.STDOUT_FD
+        printer = self.create_printer(fd)
+        self.assertEqual(printer.fileno(), fd)
+        self.assertEqual(printer.isatty(), os.isatty(fd))
+        printer.flush()  # noop
+        printer.close()  # noop
+
+    def test_disallow_instantiation(self):
+        fd = self.STDOUT_FD
+        printer = self.create_printer(fd)
+        support.check_disallow_instantiation(self, type(printer))
+
+
 if __name__ == "__main__":
     unittest.main()
diff --git a/Lib/test/test_ensurepip.py b/Lib/test/test_ensurepip.py
index 4786d28..bfca0cd 100644
--- a/Lib/test/test_ensurepip.py
+++ b/Lib/test/test_ensurepip.py
@@ -1,19 +1,68 @@
-import unittest
-import unittest.mock
-import test.support
+import contextlib
 import os
 import os.path
-import contextlib
 import sys
+import tempfile
+import test.support
+import unittest
+import unittest.mock
 
 import ensurepip
 import ensurepip._uninstall
 
 
-class TestEnsurePipVersion(unittest.TestCase):
+class TestPackages(unittest.TestCase):
+    def touch(self, directory, filename):
+        fullname = os.path.join(directory, filename)
+        open(fullname, "wb").close()
 
-    def test_returns_version(self):
-        self.assertEqual(ensurepip._PIP_VERSION, ensurepip.version())
+    def test_version(self):
+        # Test version()
+        with tempfile.TemporaryDirectory() as tmpdir:
+            self.touch(tmpdir, "pip-1.2.3b1-py2.py3-none-any.whl")
+            self.touch(tmpdir, "setuptools-49.1.3-py3-none-any.whl")
+            with (unittest.mock.patch.object(ensurepip, '_PACKAGES', None),
+                  unittest.mock.patch.object(ensurepip, '_WHEEL_PKG_DIR', tmpdir)):
+                self.assertEqual(ensurepip.version(), '1.2.3b1')
+
+    def test_get_packages_no_dir(self):
+        # Test _get_packages() without a wheel package directory
+        with (unittest.mock.patch.object(ensurepip, '_PACKAGES', None),
+              unittest.mock.patch.object(ensurepip, '_WHEEL_PKG_DIR', None)):
+            packages = ensurepip._get_packages()
+
+            # when bundled wheel packages are used, we get _PIP_VERSION
+            self.assertEqual(ensurepip._PIP_VERSION, ensurepip.version())
+
+        # use bundled wheel packages
+        self.assertIsNotNone(packages['pip'].wheel_name)
+        self.assertIsNotNone(packages['setuptools'].wheel_name)
+
+    def test_get_packages_with_dir(self):
+        # Test _get_packages() with a wheel package directory
+        setuptools_filename = "setuptools-49.1.3-py3-none-any.whl"
+        pip_filename = "pip-20.2.2-py2.py3-none-any.whl"
+
+        with tempfile.TemporaryDirectory() as tmpdir:
+            self.touch(tmpdir, setuptools_filename)
+            self.touch(tmpdir, pip_filename)
+            # not used, make sure that it's ignored
+            self.touch(tmpdir, "wheel-0.34.2-py2.py3-none-any.whl")
+
+            with (unittest.mock.patch.object(ensurepip, '_PACKAGES', None),
+                  unittest.mock.patch.object(ensurepip, '_WHEEL_PKG_DIR', tmpdir)):
+                packages = ensurepip._get_packages()
+
+            self.assertEqual(packages['setuptools'].version, '49.1.3')
+            self.assertEqual(packages['setuptools'].wheel_path,
+                             os.path.join(tmpdir, setuptools_filename))
+            self.assertEqual(packages['pip'].version, '20.2.2')
+            self.assertEqual(packages['pip'].wheel_path,
+                             os.path.join(tmpdir, pip_filename))
+
+            # wheel package is ignored
+            self.assertEqual(sorted(packages), ['pip', 'setuptools'])
+
 
 class EnsurepipMixin:
 
@@ -27,6 +76,8 @@
         real_devnull = os.devnull
         os_patch = unittest.mock.patch("ensurepip.os")
         patched_os = os_patch.start()
+        # But expose os.listdir() used by _find_packages()
+        patched_os.listdir = os.listdir
         self.addCleanup(os_patch.stop)
         patched_os.devnull = real_devnull
         patched_os.path = os.path
@@ -147,7 +198,7 @@
         self.assertEqual(self.os_environ["PIP_CONFIG_FILE"], os.devnull)
 
 @contextlib.contextmanager
-def fake_pip(version=ensurepip._PIP_VERSION):
+def fake_pip(version=ensurepip.version()):
     if version is None:
         pip = None
     else:
@@ -243,7 +294,7 @@
 
 # Basic testing of the main functions and their argument parsing
 
-EXPECTED_VERSION_OUTPUT = "pip " + ensurepip._PIP_VERSION
+EXPECTED_VERSION_OUTPUT = "pip " + ensurepip.version()
 
 class TestBootstrappingMainFunction(EnsurepipMixin, unittest.TestCase):
 
diff --git a/Lib/test/test_enum.py b/Lib/test/test_enum.py
index 0e6b1b1..03cf353 100644
--- a/Lib/test/test_enum.py
+++ b/Lib/test/test_enum.py
@@ -8,10 +8,10 @@
 from enum import Enum, IntEnum, EnumMeta, Flag, IntFlag, unique, auto
 from io import StringIO
 from pickle import dumps, loads, PicklingError, HIGHEST_PROTOCOL
-from test import support
-from test.support import ALWAYS_EQ
+from test.support import ALWAYS_EQ, check__all__, threading_helper
 from datetime import timedelta
 
+python_version = sys.version_info[:2]
 
 # for pickle tests
 try:
@@ -215,6 +215,18 @@
                 set(['__class__', '__doc__', '__module__', 'name', 'value', 'invisible']),
                 )
 
+    def test_dir_on_sub_with_behavior_including_instance_dict_on_super(self):
+        # see issue40084
+        class SuperEnum(IntEnum):
+            def __new__(cls, value, description=""):
+                obj = int.__new__(cls, value)
+                obj._value_ = value
+                obj.description = description
+                return obj
+        class SubEnum(SuperEnum):
+            sample = 5
+        self.assertTrue({'description'} <= set(dir(SubEnum.sample)))
+
     def test_enum_in_enum_out(self):
         Season = self.Season
         self.assertIs(Season(Season.WINTER), Season.WINTER)
@@ -336,17 +348,38 @@
         self.assertTrue(IntLogic.true)
         self.assertFalse(IntLogic.false)
 
-    def test_contains(self):
+    @unittest.skipIf(
+            python_version >= (3, 12),
+            '__contains__ now returns True/False for all inputs',
+            )
+    def test_contains_er(self):
         Season = self.Season
         self.assertIn(Season.AUTUMN, Season)
         with self.assertRaises(TypeError):
-            3 in Season
+            with self.assertWarns(DeprecationWarning):
+                3 in Season
         with self.assertRaises(TypeError):
-            'AUTUMN' in Season
-
+            with self.assertWarns(DeprecationWarning):
+                'AUTUMN' in Season
         val = Season(3)
         self.assertIn(val, Season)
+        #
+        class OtherEnum(Enum):
+            one = 1; two = 2
+        self.assertNotIn(OtherEnum.two, Season)
 
+    @unittest.skipIf(
+            python_version < (3, 12),
+            '__contains__ only works with enum memmbers before 3.12',
+            )
+    def test_contains_tf(self):
+        Season = self.Season
+        self.assertIn(Season.AUTUMN, Season)
+        self.assertTrue(3 in Season)
+        self.assertFalse('AUTUMN' in Season)
+        val = Season(3)
+        self.assertIn(val, Season)
+        #
         class OtherEnum(Enum):
             one = 1; two = 2
         self.assertNotIn(OtherEnum.two, Season)
@@ -570,22 +603,61 @@
         class Test1Enum(MyMethodEnum, int, MyStrEnum):
             One = 1
             Two = 2
+        self.assertTrue(Test1Enum._member_type_ is int)
         self.assertEqual(str(Test1Enum.One), 'MyStr')
+        self.assertEqual(format(Test1Enum.One, ''), 'MyStr')
         #
         class Test2Enum(MyStrEnum, MyMethodEnum):
             One = 1
             Two = 2
         self.assertEqual(str(Test2Enum.One), 'MyStr')
+        self.assertEqual(format(Test1Enum.One, ''), 'MyStr')
 
     def test_inherited_data_type(self):
         class HexInt(int):
+            __qualname__ = 'HexInt'
             def __repr__(self):
                 return hex(self)
         class MyEnum(HexInt, enum.Enum):
+            __qualname__ = 'MyEnum'
             A = 1
             B = 2
             C = 3
         self.assertEqual(repr(MyEnum.A), '<MyEnum.A: 0x1>')
+        globals()['HexInt'] = HexInt
+        globals()['MyEnum'] = MyEnum
+        test_pickle_dump_load(self.assertIs, MyEnum.A)
+        test_pickle_dump_load(self.assertIs, MyEnum)
+        #
+        class SillyInt(HexInt):
+            __qualname__ = 'SillyInt'
+            pass
+        class MyOtherEnum(SillyInt, enum.Enum):
+            __qualname__ = 'MyOtherEnum'
+            D = 4
+            E = 5
+            F = 6
+        self.assertIs(MyOtherEnum._member_type_, SillyInt)
+        globals()['SillyInt'] = SillyInt
+        globals()['MyOtherEnum'] = MyOtherEnum
+        test_pickle_dump_load(self.assertIs, MyOtherEnum.E)
+        test_pickle_dump_load(self.assertIs, MyOtherEnum)
+        #
+        class BrokenInt(int):
+            __qualname__ = 'BrokenInt'
+            def __new__(cls, value):
+                return int.__new__(cls, value)
+        class MyBrokenEnum(BrokenInt, Enum):
+            __qualname__ = 'MyBrokenEnum'
+            G = 7
+            H = 8
+            I = 9
+        self.assertIs(MyBrokenEnum._member_type_, BrokenInt)
+        self.assertIs(MyBrokenEnum(7), MyBrokenEnum.G)
+        globals()['BrokenInt'] = BrokenInt
+        globals()['MyBrokenEnum'] = MyBrokenEnum
+        test_pickle_exception(self.assertRaises, TypeError, MyBrokenEnum.G)
+        test_pickle_exception(self.assertRaises, PicklingError, MyBrokenEnum)
 
     def test_too_many_data_types(self):
         with self.assertRaisesRegex(TypeError, 'too many data types'):
@@ -1132,6 +1204,7 @@
         class auto_enum(type(Enum)):
             def __new__(metacls, cls, bases, classdict):
                 temp = type(classdict)()
+                temp._cls_name = cls
                 names = set(classdict._member_names)
                 i = 0
                 for k in classdict._member_names:
@@ -1881,6 +1954,38 @@
         else:
             raise Exception('Exception not raised.')
 
+    def test_missing_exceptions_reset(self):
+        import weakref
+        #
+        class TestEnum(enum.Enum):
+            VAL1 = 'val1'
+            VAL2 = 'val2'
+        #
+        class Class1:
+            def __init__(self):
+                # Gracefully handle an exception of our own making
+                try:
+                    raise ValueError()
+                except ValueError:
+                    pass
+        #
+        class Class2:
+            def __init__(self):
+                # Gracefully handle an exception of Enum's making
+                try:
+                    TestEnum('invalid_value')
+                except ValueError:
+                    pass
+        # No strong refs here so these are free to die.
+        class_1_ref = weakref.ref(Class1())
+        class_2_ref = weakref.ref(Class2())
+        #
+        # The exception raised by Enum creates a reference loop and thus
+        # Class2 instances will stick around until the next gargage collection
+        # cycle, unlike Class1.
+        self.assertIs(class_1_ref(), None)
+        self.assertIs(class_2_ref(), None)
+
     def test_multiple_mixin(self):
         class MaxMixin:
             @classproperty
@@ -1998,6 +2103,32 @@
             REVERT_ALL = "REVERT_ALL"
             RETRY = "RETRY"
 
+    def test_multiple_mixin_inherited(self):
+        class MyInt(int):
+            def __new__(cls, value):
+                return super().__new__(cls, value)
+
+        class HexMixin:
+            def __repr__(self):
+                return hex(self)
+
+        class MyIntEnum(HexMixin, MyInt, enum.Enum):
+            pass
+
+        class Foo(MyIntEnum):
+            TEST = 1
+        self.assertTrue(isinstance(Foo.TEST, MyInt))
+        self.assertEqual(repr(Foo.TEST), "0x1")
+
+        class Fee(MyIntEnum):
+            TEST = 1
+            def __new__(cls, value):
+                value += 1
+                member = int.__new__(cls, value)
+                member._value_ = value
+                return member
+        self.assertEqual(Fee.TEST, 2)
+
     def test_empty_globals(self):
         # bpo-35717: sys._getframe(2).f_globals['__name__'] fails with KeyError
         # when using compile and exec because f_globals is empty
@@ -2007,6 +2138,22 @@
         local_ls = {}
         exec(code, global_ns, local_ls)
 
+    @unittest.skipUnless(
+            python_version == (3, 9),
+            'private variables are now normal attributes',
+            )
+    def test_warning_for_private_variables(self):
+        with self.assertWarns(DeprecationWarning):
+            class Private(Enum):
+                __corporal = 'Radar'
+        self.assertEqual(Private._Private__corporal.value, 'Radar')
+        try:
+            with self.assertWarns(DeprecationWarning):
+                class Private(Enum):
+                    __major_ = 'Hoolihan'
+        except ValueError:
+            pass
+
 
 class TestOrder(unittest.TestCase):
 
@@ -2144,6 +2291,11 @@
         self.assertEqual(repr(~(Open.RO | Open.CE)), '<Open.AC: 3>')
         self.assertEqual(repr(~(Open.WO | Open.CE)), '<Open.RW: 2>')
 
+    def test_format(self):
+        Perm = self.Perm
+        self.assertEqual(format(Perm.R, ''), 'Perm.R')
+        self.assertEqual(format(Perm.R | Perm.X, ''), 'Perm.R|X')
+
     def test_or(self):
         Perm = self.Perm
         for i in Perm:
@@ -2292,19 +2444,42 @@
         test_pickle_dump_load(self.assertIs, FlagStooges.CURLY|FlagStooges.MOE)
         test_pickle_dump_load(self.assertIs, FlagStooges)
 
-    def test_contains(self):
+    @unittest.skipIf(
+            python_version >= (3, 12),
+            '__contains__ now returns True/False for all inputs',
+            )
+    def test_contains_er(self):
         Open = self.Open
         Color = self.Color
         self.assertFalse(Color.BLACK in Open)
         self.assertFalse(Open.RO in Color)
         with self.assertRaises(TypeError):
-            'BLACK' in Color
+            with self.assertWarns(DeprecationWarning):
+                'BLACK' in Color
         with self.assertRaises(TypeError):
-            'RO' in Open
+            with self.assertWarns(DeprecationWarning):
+                'RO' in Open
         with self.assertRaises(TypeError):
-            1 in Color
+            with self.assertWarns(DeprecationWarning):
+                1 in Color
         with self.assertRaises(TypeError):
-            1 in Open
+            with self.assertWarns(DeprecationWarning):
+                1 in Open
+
+    @unittest.skipIf(
+            python_version < (3, 12),
+            '__contains__ only works with enum memmbers before 3.12',
+            )
+    def test_contains_tf(self):
+        Open = self.Open
+        Color = self.Color
+        self.assertFalse(Color.BLACK in Open)
+        self.assertFalse(Open.RO in Color)
+        self.assertFalse('BLACK' in Color)
+        self.assertFalse('RO' in Open)
+        self.assertTrue(1 in Color)
+        self.assertTrue(1 in Open)
+
 
     def test_member_contains(self):
         Perm = self.Perm
@@ -2414,7 +2589,7 @@
         self.assertEqual(Color.ALL.value, 7)
         self.assertEqual(str(Color.BLUE), 'blue')
 
-    @support.reap_threads
+    @threading_helper.reap_threads
     def test_unique_composite(self):
         # override __eq__ to be identity only
         class TestFlag(Flag):
@@ -2444,7 +2619,7 @@
                 threading.Thread(target=cycle_enum)
                 for _ in range(8)
                 ]
-        with support.start_threads(threads):
+        with threading_helper.start_threads(threads):
             pass
         # check that only 248 members were created
         self.assertFalse(
@@ -2452,6 +2627,42 @@
                 'at least one thread failed while creating composite members')
         self.assertEqual(256, len(seen), 'too many composite members created')
 
+    def test_init_subclass(self):
+        class MyEnum(Flag):
+            def __init_subclass__(cls, **kwds):
+                super().__init_subclass__(**kwds)
+                self.assertFalse(cls.__dict__.get('_test', False))
+                cls._test1 = 'MyEnum'
+        #
+        class TheirEnum(MyEnum):
+            def __init_subclass__(cls, **kwds):
+                super(TheirEnum, cls).__init_subclass__(**kwds)
+                cls._test2 = 'TheirEnum'
+        class WhoseEnum(TheirEnum):
+            def __init_subclass__(cls, **kwds):
+                pass
+        class NoEnum(WhoseEnum):
+            ONE = 1
+        self.assertEqual(TheirEnum.__dict__['_test1'], 'MyEnum')
+        self.assertEqual(WhoseEnum.__dict__['_test1'], 'MyEnum')
+        self.assertEqual(WhoseEnum.__dict__['_test2'], 'TheirEnum')
+        self.assertFalse(NoEnum.__dict__.get('_test1', False))
+        self.assertFalse(NoEnum.__dict__.get('_test2', False))
+        #
+        class OurEnum(MyEnum):
+            def __init_subclass__(cls, **kwds):
+                cls._test2 = 'OurEnum'
+        class WhereEnum(OurEnum):
+            def __init_subclass__(cls, **kwds):
+                pass
+        class NeverEnum(WhereEnum):
+            ONE = 1
+        self.assertEqual(OurEnum.__dict__['_test1'], 'MyEnum')
+        self.assertFalse(WhereEnum.__dict__.get('_test1', False))
+        self.assertEqual(WhereEnum.__dict__['_test2'], 'OurEnum')
+        self.assertFalse(NeverEnum.__dict__.get('_test1', False))
+        self.assertFalse(NeverEnum.__dict__.get('_test2', False))
+
 
 class TestIntFlag(unittest.TestCase):
     """Tests of the IntFlags."""
@@ -2477,6 +2688,7 @@
 
     def test_type(self):
         Perm = self.Perm
+        self.assertTrue(Perm._member_type_ is int)
         Open = self.Open
         for f in Perm:
             self.assertTrue(isinstance(f, Perm))
@@ -2556,6 +2768,11 @@
         self.assertEqual(repr(~(Open.WO | Open.CE)), '<Open.RW: -524290>')
         self.assertEqual(repr(Open(~4)), '<Open.CE|AC|RW|WO: -5>')
 
+    def test_format(self):
+        Perm = self.Perm
+        self.assertEqual(format(Perm.R, ''), '4')
+        self.assertEqual(format(Perm.R | Perm.X, ''), '5')
+
     def test_or(self):
         Perm = self.Perm
         for i in Perm:
@@ -2743,7 +2960,11 @@
         self.assertEqual(len(lst), len(Thing))
         self.assertEqual(len(Thing), 0, Thing)
 
-    def test_contains(self):
+    @unittest.skipIf(
+            python_version >= (3, 12),
+            '__contains__ now returns True/False for all inputs',
+            )
+    def test_contains_er(self):
         Open = self.Open
         Color = self.Color
         self.assertTrue(Color.GREEN in Color)
@@ -2751,13 +2972,33 @@
         self.assertFalse(Color.GREEN in Open)
         self.assertFalse(Open.RW in Color)
         with self.assertRaises(TypeError):
-            'GREEN' in Color
+            with self.assertWarns(DeprecationWarning):
+                'GREEN' in Color
         with self.assertRaises(TypeError):
-            'RW' in Open
+            with self.assertWarns(DeprecationWarning):
+                'RW' in Open
         with self.assertRaises(TypeError):
-            2 in Color
+            with self.assertWarns(DeprecationWarning):
+                2 in Color
         with self.assertRaises(TypeError):
-            2 in Open
+            with self.assertWarns(DeprecationWarning):
+                2 in Open
+
+    @unittest.skipIf(
+            python_version < (3, 12),
+            '__contains__ only works with enum memmbers before 3.12',
+            )
+    def test_contains_tf(self):
+        Open = self.Open
+        Color = self.Color
+        self.assertTrue(Color.GREEN in Color)
+        self.assertTrue(Open.RW in Open)
+        self.assertTrue(Color.GREEN in Open)
+        self.assertTrue(Open.RW in Color)
+        self.assertFalse('GREEN' in Color)
+        self.assertFalse('RW' in Open)
+        self.assertTrue(2 in Color)
+        self.assertTrue(2 in Open)
 
     def test_member_contains(self):
         Perm = self.Perm
@@ -2832,7 +3073,7 @@
         self.assertEqual(Color.ALL.value, 7)
         self.assertEqual(str(Color.BLUE), 'blue')
 
-    @support.reap_threads
+    @threading_helper.reap_threads
     def test_unique_composite(self):
         # override __eq__ to be identity only
         class TestFlag(IntFlag):
@@ -2862,7 +3103,7 @@
                 threading.Thread(target=cycle_enum)
                 for _ in range(8)
                 ]
-        with support.start_threads(threads):
+        with threading_helper.start_threads(threads):
             pass
         # check that only 248 members were created
         self.assertFalse(
@@ -3087,7 +3328,7 @@
 
 class MiscTestCase(unittest.TestCase):
     def test__all__(self):
-        support.check__all__(self, enum)
+        check__all__(self, enum)
 
 
 # These are unordered here on purpose to ensure that declaration order
@@ -3127,7 +3368,7 @@
                           if name[0:2] not in ('CO', '__')],
                          [], msg='Names other than CONVERT_TEST_* found.')
 
-    @unittest.skipUnless(sys.version_info[:2] == (3, 8),
+    @unittest.skipUnless(python_version == (3, 8),
                          '_convert was deprecated in 3.8')
     def test_convert_warn(self):
         with self.assertWarns(DeprecationWarning):
@@ -3136,7 +3377,7 @@
                 ('test.test_enum', '__main__')[__name__=='__main__'],
                 filter=lambda x: x.startswith('CONVERT_TEST_'))
 
-    @unittest.skipUnless(sys.version_info >= (3, 9),
+    @unittest.skipUnless(python_version >= (3, 9),
                          '_convert was removed in 3.9')
     def test_convert_raise(self):
         with self.assertRaises(AttributeError):
@@ -3145,6 +3386,33 @@
                 ('test.test_enum', '__main__')[__name__=='__main__'],
                 filter=lambda x: x.startswith('CONVERT_TEST_'))
 
+class TestHelpers(unittest.TestCase):
+
+    sunder_names = '_bad_', '_good_', '_what_ho_'
+    dunder_names = '__mal__', '__bien__', '__que_que__'
+    private_names = '_MyEnum__private', '_MyEnum__still_private'
+    private_and_sunder_names = '_MyEnum__private_', '_MyEnum__also_private_'
+    random_names = 'okay', '_semi_private', '_weird__', '_MyEnum__'
+
+    def test_sunder(self):
+        for name in self.sunder_names + self.private_and_sunder_names:
+            self.assertTrue(enum._is_sunder(name), '%r is a not sunder name?' % name)
+        for name in self.dunder_names + self.private_names + self.random_names:
+            self.assertFalse(enum._is_sunder(name), '%r is a sunder name?' % name)
+
+    def test_dunder(self):
+        for name in self.dunder_names:
+            self.assertTrue(enum._is_dunder(name), '%r is a not dunder name?' % name)
+        for name in self.sunder_names + self.private_names + self.private_and_sunder_names + self.random_names:
+            self.assertFalse(enum._is_dunder(name), '%r is a dunder name?' % name)
+
+    def test_is_private(self):
+        for name in self.private_names + self.private_and_sunder_names:
+            self.assertTrue(enum._is_private('MyEnum', name), '%r is a not private name?')
+        for name in self.sunder_names + self.dunder_names + self.random_names:
+            self.assertFalse(enum._is_private('MyEnum', name), '%r is a private name?')
+
 
 if __name__ == '__main__':
     unittest.main()
+
diff --git a/Lib/test/test_enumerate.py b/Lib/test/test_enumerate.py
index 5785cb4..906bfc2 100644
--- a/Lib/test/test_enumerate.py
+++ b/Lib/test/test_enumerate.py
@@ -2,6 +2,7 @@
 import operator
 import sys
 import pickle
+import gc
 
 from test import support
 
@@ -134,6 +135,18 @@
         self.assertEqual(len(set(map(id, list(enumerate(self.seq))))), len(self.seq))
         self.assertEqual(len(set(map(id, enumerate(self.seq)))), min(1,len(self.seq)))
 
+    @support.cpython_only
+    def test_enumerate_result_gc(self):
+        # bpo-42536: enumerate's tuple-reuse speed trick breaks the GC's
+        # assumptions about what can be untracked. Make sure we re-track result
+        # tuples whenever we reuse them.
+        it = self.enum([[]])
+        gc.collect()
+        # That GC collection probably untracked the recycled internal result
+        # tuple, which is initialized to (None, None). Make sure it's re-tracked
+        # when it's mutated and returned from __next__:
+        self.assertTrue(gc.is_tracked(next(it)))
+
 class MyEnum(enumerate):
     pass
 
diff --git a/Lib/test/test_eof.py b/Lib/test/test_eof.py
index 51cbbd8..abcbf04 100644
--- a/Lib/test/test_eof.py
+++ b/Lib/test/test_eof.py
@@ -2,30 +2,40 @@
 
 import sys
 from test import support
+from test.support import os_helper
 from test.support import script_helper
 import unittest
 
 class EOFTestCase(unittest.TestCase):
-    def test_EOFC(self):
-        expect = "EOL while scanning string literal (<string>, line 1)"
-        try:
-            eval("""'this is a test\
-            """)
-        except SyntaxError as msg:
-            self.assertEqual(str(msg), expect)
-        else:
-            raise support.TestFailed
+    def test_EOF_single_quote(self):
+        expect = "unterminated string literal (detected at line 1) (<string>, line 1)"
+        for quote in ("'", "\""):
+            try:
+                eval(f"""{quote}this is a test\
+                """)
+            except SyntaxError as msg:
+                self.assertEqual(str(msg), expect)
+                self.assertEqual(msg.offset, 1)
+            else:
+                raise support.TestFailed
 
     def test_EOFS(self):
-        expect = ("EOF while scanning triple-quoted string literal "
-                  "(<string>, line 1)")
+        expect = ("unterminated triple-quoted string literal (detected at line 1) (<string>, line 1)")
         try:
             eval("""'''this is a test""")
         except SyntaxError as msg:
             self.assertEqual(str(msg), expect)
+            self.assertEqual(msg.offset, 1)
         else:
             raise support.TestFailed
 
+    def test_EOFS_with_file(self):
+        expect = ("(<string>, line 1)")
+        with os_helper.temp_dir() as temp_dir:
+            file_name = script_helper.make_script(temp_dir, 'foo', """'''this is \na \ntest""")
+            rc, out, err = script_helper.assert_python_failure(file_name)
+        self.assertIn(b'unterminated triple-quoted string literal (detected at line 3)', err)
+
     def test_eof_with_line_continuation(self):
         expect = "unexpected EOF while parsing (<string>, line 1)"
         try:
@@ -48,17 +58,17 @@
     @unittest.skipIf(not sys.executable, "sys.executable required")
     def test_line_continuation_EOF_from_file_bpo2180(self):
         """Ensure tok_nextc() does not add too many ending newlines."""
-        with support.temp_dir() as temp_dir:
+        with os_helper.temp_dir() as temp_dir:
             file_name = script_helper.make_script(temp_dir, 'foo', '\\')
             rc, out, err = script_helper.assert_python_failure(file_name)
             self.assertIn(b'unexpected EOF while parsing', err)
-            self.assertIn(b'line 2', err)
+            self.assertIn(b'line 1', err)
             self.assertIn(b'\\', err)
 
             file_name = script_helper.make_script(temp_dir, 'foo', 'y = 6\\')
             rc, out, err = script_helper.assert_python_failure(file_name)
             self.assertIn(b'unexpected EOF while parsing', err)
-            self.assertIn(b'line 2', err)
+            self.assertIn(b'line 1', err)
             self.assertIn(b'y = 6\\', err)
 
 if __name__ == "__main__":
diff --git a/Lib/test/test_epoll.py b/Lib/test/test_epoll.py
index 10f148f..b623852 100644
--- a/Lib/test/test_epoll.py
+++ b/Lib/test/test_epoll.py
@@ -160,44 +160,42 @@
             self.fail("epoll on closed fd didn't raise EBADF")
 
     def test_control_and_wait(self):
+        # create the epoll object
         client, server = self._connected_pair()
-
         ep = select.epoll(16)
         ep.register(server.fileno(),
                     select.EPOLLIN | select.EPOLLOUT | select.EPOLLET)
         ep.register(client.fileno(),
                     select.EPOLLIN | select.EPOLLOUT | select.EPOLLET)
 
+        # EPOLLOUT
         now = time.monotonic()
         events = ep.poll(1, 4)
         then = time.monotonic()
         self.assertFalse(then - now > 0.1, then - now)
 
-        events.sort()
         expected = [(client.fileno(), select.EPOLLOUT),
                     (server.fileno(), select.EPOLLOUT)]
-        expected.sort()
+        self.assertEqual(sorted(events), sorted(expected))
 
-        self.assertEqual(events, expected)
-
-        events = ep.poll(timeout=2.1, maxevents=4)
+        # no event
+        events = ep.poll(timeout=0.1, maxevents=4)
         self.assertFalse(events)
 
-        client.send(b"Hello!")
-        server.send(b"world!!!")
+        # send: EPOLLIN and EPOLLOUT
+        client.sendall(b"Hello!")
+        server.sendall(b"world!!!")
 
         now = time.monotonic()
-        events = ep.poll(1, 4)
+        events = ep.poll(1.0, 4)
         then = time.monotonic()
         self.assertFalse(then - now > 0.01)
 
-        events.sort()
         expected = [(client.fileno(), select.EPOLLIN | select.EPOLLOUT),
                     (server.fileno(), select.EPOLLIN | select.EPOLLOUT)]
-        expected.sort()
+        self.assertEqual(sorted(events), sorted(expected))
 
-        self.assertEqual(events, expected)
-
+        # unregister, modify
         ep.unregister(client.fileno())
         ep.modify(server.fileno(), select.EPOLLOUT)
         now = time.monotonic()
diff --git a/Lib/test/test_exception_hierarchy.py b/Lib/test/test_exception_hierarchy.py
index 43b4af8..89fe9dd 100644
--- a/Lib/test/test_exception_hierarchy.py
+++ b/Lib/test/test_exception_hierarchy.py
@@ -40,10 +40,10 @@
         self.assertIs(EnvironmentError, OSError)
 
     def test_socket_errors(self):
-        self.assertIs(socket.error, IOError)
+        self.assertIs(socket.error, OSError)
         self.assertIs(socket.gaierror.__base__, OSError)
         self.assertIs(socket.herror.__base__, OSError)
-        self.assertIs(socket.timeout.__base__, OSError)
+        self.assertIs(socket.timeout, TimeoutError)
 
     def test_select_error(self):
         self.assertIs(select.error, OSError)
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
index 8d125b5..2bdd721 100644
--- a/Lib/test/test_exceptions.py
+++ b/Lib/test/test_exceptions.py
@@ -8,11 +8,15 @@
 import pickle
 import weakref
 import errno
+from textwrap import dedent
 
-from test.support import (TESTFN, captured_stderr, check_impl_detail,
-                          check_warnings, cpython_only, gc_collect,
-                          no_tracing, unlink, import_module, script_helper,
+from test.support import (captured_stderr, check_impl_detail,
+                          cpython_only, gc_collect,
+                          no_tracing, script_helper,
                           SuppressCrashReport)
+from test.support.import_helper import import_module
+from test.support.os_helper import TESTFN, unlink
+from test.support.warnings_helper import check_warnings
 from test import support
 
 
@@ -51,9 +55,9 @@
         self.assertRaises(AttributeError, getattr, sys, "undefined_attribute")
 
         self.raise_catch(EOFError, "EOFError")
-        fp = open(TESTFN, 'w')
+        fp = open(TESTFN, 'w', encoding="utf-8")
         fp.close()
-        fp = open(TESTFN, 'r')
+        fp = open(TESTFN, 'r', encoding="utf-8")
         savestdin = sys.stdin
         try:
             try:
@@ -164,19 +168,32 @@
                 self.fail("failed to get expected SyntaxError")
 
         s = '''print "old style"'''
-        ckmsg(s, "Missing parentheses in call to 'print'. "
-                 "Did you mean print(\"old style\")?")
+        ckmsg(s, "Missing parentheses in call to 'print'. Did you mean print(...)?")
 
         s = '''print "old style",'''
-        ckmsg(s, "Missing parentheses in call to 'print'. "
-                 "Did you mean print(\"old style\", end=\" \")?")
+        ckmsg(s, "Missing parentheses in call to 'print'. Did you mean print(...)?")
+
+        s = 'print f(a+b,c)'
+        ckmsg(s, "Missing parentheses in call to 'print'. Did you mean print(...)?")
 
         s = '''exec "old style"'''
-        ckmsg(s, "Missing parentheses in call to 'exec'")
+        ckmsg(s, "Missing parentheses in call to 'exec'. Did you mean exec(...)?")
+
+        s = 'exec f(a+b,c)'
+        ckmsg(s, "Missing parentheses in call to 'exec'. Did you mean exec(...)?")
+
+        # Check that we don't incorrectly identify '(...)' as an expression to the right
+        # of 'print'
+
+        s = 'print (a+b,c) $ 42'
+        ckmsg(s, "invalid syntax")
+
+        s = 'exec (a+b,c) $ 42'
+        ckmsg(s, "invalid syntax")
 
         # should not apply to subclasses, see issue #31161
         s = '''if True:\nprint "No indent"'''
-        ckmsg(s, "expected an indented block", IndentationError)
+        ckmsg(s, "expected an indented block after 'if' statement on line 1", IndentationError)
 
         s = '''if True:\n        print()\n\texec "mixed tabs and spaces"'''
         ckmsg(s, "inconsistent use of tabs and spaces in indentation", TabError)
@@ -192,6 +209,10 @@
                     src = src.decode(encoding, 'replace')
                 line = src.split('\n')[lineno-1]
                 self.assertIn(line, cm.exception.text)
+    
+    def test_error_offset_continuation_characters(self):
+        check = self.check
+        check('"\\\n"(1 for c in I,\\\n\\', 2, 2)
 
     def testSyntaxErrorOffset(self):
         check = self.check
@@ -203,22 +224,30 @@
         check(b'# -*- coding: cp1251 -*-\nPython = "\xcf\xb3\xf2\xee\xed" +',
               2, 19, encoding='cp1251')
         check(b'Python = "\xcf\xb3\xf2\xee\xed" +', 1, 18)
-        check('x = "a', 1, 7)
+        check('x = "a', 1, 5)
         check('lambda x: x = 2', 1, 1)
         check('f{a + b + c}', 1, 2)
+        check('[file for str(file) in []\n]', 1, 11)
+        check('a = « hello » « world »', 1, 5)
+        check('[\nfile\nfor str(file)\nin\n[]\n]', 3, 5)
+        check('[file for\n str(file) in []]', 2, 2)
+        check("ages = {'Alice'=22, 'Bob'=23}", 1, 9)
+        check('match ...:\n    case {**rest, "key": value}:\n        ...', 2, 19)
+        check("[a b c d e f]", 1, 2)
+        check("for x yfff:", 1, 7)
 
         # Errors thrown by compile.c
         check('class foo:return 1', 1, 11)
         check('def f():\n  continue', 2, 3)
         check('def f():\n  break', 2, 3)
-        check('try:\n  pass\nexcept:\n  pass\nexcept ValueError:\n  pass', 2, 3)
+        check('try:\n  pass\nexcept:\n  pass\nexcept ValueError:\n  pass', 3, 1)
 
         # Errors thrown by tokenizer.c
         check('(0x+1)', 1, 3)
         check('x = 0xI', 1, 6)
-        check('0010 + 2', 1, 4)
+        check('0010 + 2', 1, 1)
         check('x = 32e-+4', 1, 8)
-        check('x = 0o9', 1, 6)
+        check('x = 0o9', 1, 7)
         check('\u03b1 = 0xI', 1, 6)
         check(b'\xce\xb1 = 0xI', 1, 6)
         check(b'# -*- coding: iso8859-7 -*-\n\xe1 = 0xI', 2, 6,
@@ -232,14 +261,35 @@
 
             def baz():
                 '''quux'''
-            """, 9, 20)
+            """, 9, 24)
         check("pass\npass\npass\n(1+)\npass\npass\npass", 4, 4)
         check("(1+)", 1, 4)
+        check("[interesting\nfoo()\n", 1, 1)
+        check(b"\xef\xbb\xbf#coding: utf8\nprint('\xe6\x88\x91')\n", 0, -1)
+        check("""f'''
+            {
+            (123_a)
+            }'''""", 3, 17)
+        check("""f'''
+            {
+            f\"\"\"
+            {
+            (123_a)
+            }
+            \"\"\"
+            }'''""", 5, 17)
+        check('''f"""
+
+
+            {
+            6
+            0="""''', 5, 13)
 
         # Errors thrown by symtable.c
-        check('x = [(yield i) for i in range(3)]', 1, 5)
-        check('def f():\n  from _ import *', 1, 1)
-        check('def f(x, x):\n  pass', 1, 1)
+        check('x = [(yield i) for i in range(3)]', 1, 7)
+        check('def f():\n  from _ import *', 2, 17)
+        check('def f(x, x):\n  pass', 1, 10)
+        check('{i for i in range(5) if (j := 0) for j in range(5)}', 1, 38)
         check('def f(x):\n  nonlocal x', 2, 3)
         check('def f(x):\n  x = 1\n  global x', 3, 3)
         check('nonlocal x', 1, 1)
@@ -253,9 +303,9 @@
         check('def f():\n  x, y: int', 2, 3)
         check('[*x for x in xs]', 1, 2)
         check('foo(x for x in range(10), 100)', 1, 5)
-        check('(yield i) = 2', 1, 1 if support.use_old_parser() else 2)
-        check('def f(*):\n  pass', 1, 7 if support.use_old_parser() else 8)
         check('for 1 in []: pass', 1, 5)
+        check('(yield i) = 2', 1, 2)
+        check('def f(*):\n  pass', 1, 7)
 
     @cpython_only
     def testSettingException(self):
@@ -389,25 +439,31 @@
                  'filename' : 'filenameStr', 'filename2' : None}),
             (SyntaxError, (), {'msg' : None, 'text' : None,
                 'filename' : None, 'lineno' : None, 'offset' : None,
-                'print_file_and_line' : None}),
+                'end_offset': None, 'print_file_and_line' : None}),
             (SyntaxError, ('msgStr',),
                 {'args' : ('msgStr',), 'text' : None,
                  'print_file_and_line' : None, 'msg' : 'msgStr',
-                 'filename' : None, 'lineno' : None, 'offset' : None}),
+                 'filename' : None, 'lineno' : None, 'offset' : None,
+                 'end_offset': None}),
             (SyntaxError, ('msgStr', ('filenameStr', 'linenoStr', 'offsetStr',
-                           'textStr')),
+                           'textStr', 'endLinenoStr', 'endOffsetStr')),
                 {'offset' : 'offsetStr', 'text' : 'textStr',
                  'args' : ('msgStr', ('filenameStr', 'linenoStr',
-                                      'offsetStr', 'textStr')),
+                                      'offsetStr', 'textStr',
+                                      'endLinenoStr', 'endOffsetStr')),
                  'print_file_and_line' : None, 'msg' : 'msgStr',
-                 'filename' : 'filenameStr', 'lineno' : 'linenoStr'}),
+                 'filename' : 'filenameStr', 'lineno' : 'linenoStr',
+                 'end_lineno': 'endLinenoStr', 'end_offset': 'endOffsetStr'}),
             (SyntaxError, ('msgStr', 'filenameStr', 'linenoStr', 'offsetStr',
-                           'textStr', 'print_file_and_lineStr'),
+                           'textStr', 'endLinenoStr', 'endOffsetStr',
+                           'print_file_and_lineStr'),
                 {'text' : None,
                  'args' : ('msgStr', 'filenameStr', 'linenoStr', 'offsetStr',
-                           'textStr', 'print_file_and_lineStr'),
+                           'textStr', 'endLinenoStr', 'endOffsetStr',
+                           'print_file_and_lineStr'),
                  'print_file_and_line' : None, 'msg' : 'msgStr',
-                 'filename' : None, 'lineno' : None, 'offset' : None}),
+                 'filename' : None, 'lineno' : None, 'offset' : None,
+                 'end_lineno': None, 'end_offset': None}),
             (UnicodeError, (), {'args' : (),}),
             (UnicodeEncodeError, ('ascii', 'a', 0, 1,
                                   'ordinal not in range'),
@@ -453,7 +509,7 @@
                 e = exc(*args)
             except:
                 print("\nexc=%r, args=%r" % (exc, args), file=sys.stderr)
-                raise
+                # raise
             else:
                 # Verify module name
                 if not type(e).__name__.endswith('NaiveException'):
@@ -592,15 +648,27 @@
         self.assertTrue(str(Exception('a')))
         self.assertTrue(str(Exception('a', 'b')))
 
-    def testExceptionCleanupNames(self):
+    def test_exception_cleanup_names(self):
         # Make sure the local variable bound to the exception instance by
         # an "except" statement is only visible inside the except block.
         try:
             raise Exception()
         except Exception as e:
-            self.assertTrue(e)
+            self.assertIsInstance(e, Exception)
+        self.assertNotIn('e', locals())
+        with self.assertRaises(UnboundLocalError):
+            e
+
+    def test_exception_cleanup_names2(self):
+        # Make sure the cleanup doesn't break if the variable is explicitly deleted.
+        try:
+            raise Exception()
+        except Exception as e:
+            self.assertIsInstance(e, Exception)
             del e
         self.assertNotIn('e', locals())
+        with self.assertRaises(UnboundLocalError):
+            e
 
     def testExceptionCleanupState(self):
         # Make sure exception state is cleaned up as soon as the except
@@ -625,6 +693,7 @@
         except MyException as e:
             pass
         obj = None
+        gc_collect()  # For PyPy or other GCs.
         obj = wr()
         self.assertIsNone(obj)
 
@@ -636,6 +705,7 @@
         except MyException:
             pass
         obj = None
+        gc_collect()  # For PyPy or other GCs.
         obj = wr()
         self.assertIsNone(obj)
 
@@ -647,6 +717,7 @@
         except:
             pass
         obj = None
+        gc_collect()  # For PyPy or other GCs.
         obj = wr()
         self.assertIsNone(obj)
 
@@ -659,6 +730,7 @@
             except:
                 break
         obj = None
+        gc_collect()  # For PyPy or other GCs.
         obj = wr()
         self.assertIsNone(obj)
 
@@ -677,6 +749,7 @@
             # must clear the latter manually for our test to succeed.
             e.__context__ = None
             obj = None
+            gc_collect()  # For PyPy or other GCs.
             obj = wr()
             # guarantee no ref cycles on CPython (don't gc_collect)
             if check_impl_detail(cpython=False):
@@ -867,6 +940,7 @@
         next(g)
         testfunc(g)
         g = obj = None
+        gc_collect()  # For PyPy or other GCs.
         obj = wr()
         self.assertIsNone(obj)
 
@@ -920,8 +994,152 @@
             raise Exception(MyObject())
         except:
             pass
+        gc_collect()  # For PyPy or other GCs.
         self.assertEqual(e, (None, None, None))
 
+    def test_raise_does_not_create_context_chain_cycle(self):
+        class A(Exception):
+            pass
+        class B(Exception):
+            pass
+        class C(Exception):
+            pass
+
+        # Create a context chain:
+        # C -> B -> A
+        # Then raise A in context of C.
+        try:
+            try:
+                raise A
+            except A as a_:
+                a = a_
+                try:
+                    raise B
+                except B as b_:
+                    b = b_
+                    try:
+                        raise C
+                    except C as c_:
+                        c = c_
+                        self.assertIsInstance(a, A)
+                        self.assertIsInstance(b, B)
+                        self.assertIsInstance(c, C)
+                        self.assertIsNone(a.__context__)
+                        self.assertIs(b.__context__, a)
+                        self.assertIs(c.__context__, b)
+                        raise a
+        except A as e:
+            exc = e
+
+        # Expect A -> C -> B, without cycle
+        self.assertIs(exc, a)
+        self.assertIs(a.__context__, c)
+        self.assertIs(c.__context__, b)
+        self.assertIsNone(b.__context__)
+
+    def test_no_hang_on_context_chain_cycle1(self):
+        # See issue 25782. Cycle in context chain.
+
+        def cycle():
+            try:
+                raise ValueError(1)
+            except ValueError as ex:
+                ex.__context__ = ex
+                raise TypeError(2)
+
+        try:
+            cycle()
+        except Exception as e:
+            exc = e
+
+        self.assertIsInstance(exc, TypeError)
+        self.assertIsInstance(exc.__context__, ValueError)
+        self.assertIs(exc.__context__.__context__, exc.__context__)
+
+    @unittest.skip("See issue 44895")
+    def test_no_hang_on_context_chain_cycle2(self):
+        # See issue 25782. Cycle at head of context chain.
+
+        class A(Exception):
+            pass
+        class B(Exception):
+            pass
+        class C(Exception):
+            pass
+
+        # Context cycle:
+        # +-----------+
+        # V           |
+        # C --> B --> A
+        with self.assertRaises(C) as cm:
+            try:
+                raise A()
+            except A as _a:
+                a = _a
+                try:
+                    raise B()
+                except B as _b:
+                    b = _b
+                    try:
+                        raise C()
+                    except C as _c:
+                        c = _c
+                        a.__context__ = c
+                        raise c
+
+        self.assertIs(cm.exception, c)
+        # Verify the expected context chain cycle
+        self.assertIs(c.__context__, b)
+        self.assertIs(b.__context__, a)
+        self.assertIs(a.__context__, c)
+
+    def test_no_hang_on_context_chain_cycle3(self):
+        # See issue 25782. Longer context chain with cycle.
+
+        class A(Exception):
+            pass
+        class B(Exception):
+            pass
+        class C(Exception):
+            pass
+        class D(Exception):
+            pass
+        class E(Exception):
+            pass
+
+        # Context cycle:
+        #             +-----------+
+        #             V           |
+        # E --> D --> C --> B --> A
+        with self.assertRaises(E) as cm:
+            try:
+                raise A()
+            except A as _a:
+                a = _a
+                try:
+                    raise B()
+                except B as _b:
+                    b = _b
+                    try:
+                        raise C()
+                    except C as _c:
+                        c = _c
+                        a.__context__ = c
+                        try:
+                            raise D()
+                        except D as _d:
+                            d = _d
+                            e = E()
+                            raise e
+
+        self.assertIs(cm.exception, e)
+        # Verify the expected context chain cycle
+        self.assertIs(e.__context__, d)
+        self.assertIs(d.__context__, c)
+        self.assertIs(c.__context__, b)
+        self.assertIs(b.__context__, a)
+        self.assertIs(a.__context__, c)
+
     def test_unicode_change_attributes(self):
         # See issue 7309. This was a crasher.
 
@@ -996,6 +1214,21 @@
         self.assertIsInstance(v, RecursionError, type(v))
         self.assertIn("maximum recursion depth exceeded", str(v))
 
+
+    @cpython_only
+    def test_trashcan_recursion(self):
+        # See bpo-33930
+
+        def foo():
+            o = object()
+            for x in range(1_000_000):
+                # Create a big chain of method objects that will trigger
+                # a deep chain of calls when they need to be destructed.
+                o = o.__dir__
+
+        foo()
+        support.gc_collect()
+
     @cpython_only
     def test_recursion_normalizing_exception(self):
         # Issue #22898.
@@ -1043,7 +1276,7 @@
                 # tstate->recursion_depth is equal to (recursion_limit - 1)
                 # and is equal to recursion_limit when _gen_throw() calls
                 # PyErr_NormalizeException().
-                recurse(setrecursionlimit(depth + 2) - depth - 1)
+                recurse(setrecursionlimit(depth + 2) - depth)
             finally:
                 sys.setrecursionlimit(recursionlimit)
                 print('Done.')
@@ -1073,6 +1306,54 @@
                       b'while normalizing an exception', err)
         self.assertIn(b'Done.', out)
 
+
+    def test_recursion_in_except_handler(self):
+
+        def set_relative_recursion_limit(n):
+            depth = 1
+            while True:
+                try:
+                    sys.setrecursionlimit(depth)
+                except RecursionError:
+                    depth += 1
+                else:
+                    break
+            sys.setrecursionlimit(depth+n)
+
+        def recurse_in_except():
+            try:
+                1/0
+            except:
+                recurse_in_except()
+
+        def recurse_after_except():
+            try:
+                1/0
+            except:
+                pass
+            recurse_after_except()
+
+        def recurse_in_body_and_except():
+            try:
+                recurse_in_body_and_except()
+            except:
+                recurse_in_body_and_except()
+
+        recursionlimit = sys.getrecursionlimit()
+        try:
+            set_relative_recursion_limit(10)
+            for func in (recurse_in_except, recurse_after_except, recurse_in_body_and_except):
+                with self.subTest(func=func):
+                    try:
+                        func()
+                    except RecursionError:
+                        pass
+                    else:
+                        self.fail("Should have raised a RecursionError")
+        finally:
+            sys.setrecursionlimit(recursionlimit)
+
+
     @cpython_only
     def test_recursion_normalizing_with_no_memory(self):
         # Issue #30697. Test that in the abort that occurs when there is no
@@ -1109,7 +1390,7 @@
             except MemoryError as e:
                 tb = e.__traceback__
             else:
-                self.fail("Should have raises a MemoryError")
+                self.fail("Should have raised a MemoryError")
             return traceback.format_tb(tb)
 
         tb1 = raiseMemError()
@@ -1176,6 +1457,7 @@
             self.assertNotEqual(wr(), None)
         else:
             self.fail("MemoryError not raised")
+        gc_collect()  # For PyPy or other GCs.
         self.assertEqual(wr(), None)
 
     @no_tracing
@@ -1196,6 +1478,7 @@
             self.assertNotEqual(wr(), None)
         else:
             self.fail("RecursionError not raised")
+        gc_collect()  # For PyPy or other GCs.
         self.assertEqual(wr(), None)
 
     def test_errno_ENOTDIR(self):
@@ -1216,6 +1499,7 @@
         with support.catch_unraisable_exception() as cm:
             del obj
 
+            gc_collect()  # For PyPy or other GCs.
             self.assertEqual(cm.unraisable.object, BrokenDel.__del__)
             self.assertIsNotNone(cm.unraisable.exc_traceback)
 
@@ -1359,6 +1643,582 @@
 
             gc_collect()
 
+global_for_suggestions = None
+
+class NameErrorTests(unittest.TestCase):
+    def test_name_error_has_name(self):
+        try:
+            bluch
+        except NameError as exc:
+            self.assertEqual("bluch", exc.name)
+
+    def test_name_error_suggestions(self):
+        def Substitution():
+            noise = more_noise = a = bc = None
+            blech = None
+            print(bluch)
+
+        def Elimination():
+            noise = more_noise = a = bc = None
+            blch = None
+            print(bluch)
+
+        def Addition():
+            noise = more_noise = a = bc = None
+            bluchin = None
+            print(bluch)
+
+        def SubstitutionOverElimination():
+            blach = None
+            bluc = None
+            print(bluch)
+
+        def SubstitutionOverAddition():
+            blach = None
+            bluchi = None
+            print(bluch)
+
+        def EliminationOverAddition():
+            blucha = None
+            bluc = None
+            print(bluch)
+
+        for func, suggestion in [(Substitution, "'blech'?"),
+                                (Elimination, "'blch'?"),
+                                (Addition, "'bluchin'?"),
+                                (EliminationOverAddition, "'blucha'?"),
+                                (SubstitutionOverElimination, "'blach'?"),
+                                (SubstitutionOverAddition, "'blach'?")]:
+            err = None
+            try:
+                func()
+            except NameError as exc:
+                with support.captured_stderr() as err:
+                    sys.__excepthook__(*sys.exc_info())
+            self.assertIn(suggestion, err.getvalue())
+
+    def test_name_error_suggestions_from_globals(self):
+        def func():
+            print(global_for_suggestio)
+        try:
+            func()
+        except NameError as exc:
+            with support.captured_stderr() as err:
+                sys.__excepthook__(*sys.exc_info())
+        self.assertIn("'global_for_suggestions'?", err.getvalue())
+
+    def test_name_error_suggestions_from_builtins(self):
+        def func():
+            print(ZeroDivisionErrrrr)
+        try:
+            func()
+        except NameError as exc:
+            with support.captured_stderr() as err:
+                sys.__excepthook__(*sys.exc_info())
+        self.assertIn("'ZeroDivisionError'?", err.getvalue())
+
+    def test_name_error_suggestions_do_not_trigger_for_long_names(self):
+        def f():
+            somethingverywronghehehehehehe = None
+            print(somethingverywronghe)
+
+        try:
+            f()
+        except NameError as exc:
+            with support.captured_stderr() as err:
+                sys.__excepthook__(*sys.exc_info())
+
+        self.assertNotIn("somethingverywronghehe", err.getvalue())
+
+    def test_name_error_bad_suggestions_do_not_trigger_for_small_names(self):
+        vvv = mom = w = id = pytho = None
+
+        with self.subTest(name="b"):
+            try:
+                b
+            except NameError as exc:
+                with support.captured_stderr() as err:
+                    sys.__excepthook__(*sys.exc_info())
+            self.assertNotIn("you mean", err.getvalue())
+            self.assertNotIn("vvv", err.getvalue())
+            self.assertNotIn("mom", err.getvalue())
+            self.assertNotIn("'id'", err.getvalue())
+            self.assertNotIn("'w'", err.getvalue())
+            self.assertNotIn("'pytho'", err.getvalue())
+
+        with self.subTest(name="v"):
+            try:
+                v
+            except NameError as exc:
+                with support.captured_stderr() as err:
+                    sys.__excepthook__(*sys.exc_info())
+            self.assertNotIn("you mean", err.getvalue())
+            self.assertNotIn("vvv", err.getvalue())
+            self.assertNotIn("mom", err.getvalue())
+            self.assertNotIn("'id'", err.getvalue())
+            self.assertNotIn("'w'", err.getvalue())
+            self.assertNotIn("'pytho'", err.getvalue())
+
+        with self.subTest(name="m"):
+            try:
+                m
+            except NameError as exc:
+                with support.captured_stderr() as err:
+                    sys.__excepthook__(*sys.exc_info())
+            self.assertNotIn("you mean", err.getvalue())
+            self.assertNotIn("vvv", err.getvalue())
+            self.assertNotIn("mom", err.getvalue())
+            self.assertNotIn("'id'", err.getvalue())
+            self.assertNotIn("'w'", err.getvalue())
+            self.assertNotIn("'pytho'", err.getvalue())
+
+        with self.subTest(name="py"):
+            try:
+                py
+            except NameError as exc:
+                with support.captured_stderr() as err:
+                    sys.__excepthook__(*sys.exc_info())
+            self.assertNotIn("you mean", err.getvalue())
+            self.assertNotIn("vvv", err.getvalue())
+            self.assertNotIn("mom", err.getvalue())
+            self.assertNotIn("'id'", err.getvalue())
+            self.assertNotIn("'w'", err.getvalue())
+            self.assertNotIn("'pytho'", err.getvalue())
+
+    def test_name_error_suggestions_do_not_trigger_for_too_many_locals(self):
+        def f():
+            # Mutating locals() is unreliable, so we need to do it by hand
+            a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = a9 = a10 = \
+            a11 = a12 = a13 = a14 = a15 = a16 = a17 = a18 = a19 = a20 = \
+            a21 = a22 = a23 = a24 = a25 = a26 = a27 = a28 = a29 = a30 = \
+            a31 = a32 = a33 = a34 = a35 = a36 = a37 = a38 = a39 = a40 = \
+            a41 = a42 = a43 = a44 = a45 = a46 = a47 = a48 = a49 = a50 = \
+            a51 = a52 = a53 = a54 = a55 = a56 = a57 = a58 = a59 = a60 = \
+            a61 = a62 = a63 = a64 = a65 = a66 = a67 = a68 = a69 = a70 = \
+            a71 = a72 = a73 = a74 = a75 = a76 = a77 = a78 = a79 = a80 = \
+            a81 = a82 = a83 = a84 = a85 = a86 = a87 = a88 = a89 = a90 = \
+            a91 = a92 = a93 = a94 = a95 = a96 = a97 = a98 = a99 = a100 = \
+            a101 = a102 = a103 = a104 = a105 = a106 = a107 = a108 = a109 = a110 = \
+            a111 = a112 = a113 = a114 = a115 = a116 = a117 = a118 = a119 = a120 = \
+            a121 = a122 = a123 = a124 = a125 = a126 = a127 = a128 = a129 = a130 = \
+            a131 = a132 = a133 = a134 = a135 = a136 = a137 = a138 = a139 = a140 = \
+            a141 = a142 = a143 = a144 = a145 = a146 = a147 = a148 = a149 = a150 = \
+            a151 = a152 = a153 = a154 = a155 = a156 = a157 = a158 = a159 = a160 = \
+            a161 = a162 = a163 = a164 = a165 = a166 = a167 = a168 = a169 = a170 = \
+            a171 = a172 = a173 = a174 = a175 = a176 = a177 = a178 = a179 = a180 = \
+            a181 = a182 = a183 = a184 = a185 = a186 = a187 = a188 = a189 = a190 = \
+            a191 = a192 = a193 = a194 = a195 = a196 = a197 = a198 = a199 = a200 = \
+            a201 = a202 = a203 = a204 = a205 = a206 = a207 = a208 = a209 = a210 = \
+            a211 = a212 = a213 = a214 = a215 = a216 = a217 = a218 = a219 = a220 = \
+            a221 = a222 = a223 = a224 = a225 = a226 = a227 = a228 = a229 = a230 = \
+            a231 = a232 = a233 = a234 = a235 = a236 = a237 = a238 = a239 = a240 = \
+            a241 = a242 = a243 = a244 = a245 = a246 = a247 = a248 = a249 = a250 = \
+            a251 = a252 = a253 = a254 = a255 = a256 = a257 = a258 = a259 = a260 = \
+            a261 = a262 = a263 = a264 = a265 = a266 = a267 = a268 = a269 = a270 = \
+            a271 = a272 = a273 = a274 = a275 = a276 = a277 = a278 = a279 = a280 = \
+            a281 = a282 = a283 = a284 = a285 = a286 = a287 = a288 = a289 = a290 = \
+            a291 = a292 = a293 = a294 = a295 = a296 = a297 = a298 = a299 = a300 = \
+            a301 = a302 = a303 = a304 = a305 = a306 = a307 = a308 = a309 = a310 = \
+            a311 = a312 = a313 = a314 = a315 = a316 = a317 = a318 = a319 = a320 = \
+            a321 = a322 = a323 = a324 = a325 = a326 = a327 = a328 = a329 = a330 = \
+            a331 = a332 = a333 = a334 = a335 = a336 = a337 = a338 = a339 = a340 = \
+            a341 = a342 = a343 = a344 = a345 = a346 = a347 = a348 = a349 = a350 = \
+            a351 = a352 = a353 = a354 = a355 = a356 = a357 = a358 = a359 = a360 = \
+            a361 = a362 = a363 = a364 = a365 = a366 = a367 = a368 = a369 = a370 = \
+            a371 = a372 = a373 = a374 = a375 = a376 = a377 = a378 = a379 = a380 = \
+            a381 = a382 = a383 = a384 = a385 = a386 = a387 = a388 = a389 = a390 = \
+            a391 = a392 = a393 = a394 = a395 = a396 = a397 = a398 = a399 = a400 = \
+            a401 = a402 = a403 = a404 = a405 = a406 = a407 = a408 = a409 = a410 = \
+            a411 = a412 = a413 = a414 = a415 = a416 = a417 = a418 = a419 = a420 = \
+            a421 = a422 = a423 = a424 = a425 = a426 = a427 = a428 = a429 = a430 = \
+            a431 = a432 = a433 = a434 = a435 = a436 = a437 = a438 = a439 = a440 = \
+            a441 = a442 = a443 = a444 = a445 = a446 = a447 = a448 = a449 = a450 = \
+            a451 = a452 = a453 = a454 = a455 = a456 = a457 = a458 = a459 = a460 = \
+            a461 = a462 = a463 = a464 = a465 = a466 = a467 = a468 = a469 = a470 = \
+            a471 = a472 = a473 = a474 = a475 = a476 = a477 = a478 = a479 = a480 = \
+            a481 = a482 = a483 = a484 = a485 = a486 = a487 = a488 = a489 = a490 = \
+            a491 = a492 = a493 = a494 = a495 = a496 = a497 = a498 = a499 = a500 = \
+            a501 = a502 = a503 = a504 = a505 = a506 = a507 = a508 = a509 = a510 = \
+            a511 = a512 = a513 = a514 = a515 = a516 = a517 = a518 = a519 = a520 = \
+            a521 = a522 = a523 = a524 = a525 = a526 = a527 = a528 = a529 = a530 = \
+            a531 = a532 = a533 = a534 = a535 = a536 = a537 = a538 = a539 = a540 = \
+            a541 = a542 = a543 = a544 = a545 = a546 = a547 = a548 = a549 = a550 = \
+            a551 = a552 = a553 = a554 = a555 = a556 = a557 = a558 = a559 = a560 = \
+            a561 = a562 = a563 = a564 = a565 = a566 = a567 = a568 = a569 = a570 = \
+            a571 = a572 = a573 = a574 = a575 = a576 = a577 = a578 = a579 = a580 = \
+            a581 = a582 = a583 = a584 = a585 = a586 = a587 = a588 = a589 = a590 = \
+            a591 = a592 = a593 = a594 = a595 = a596 = a597 = a598 = a599 = a600 = \
+            a601 = a602 = a603 = a604 = a605 = a606 = a607 = a608 = a609 = a610 = \
+            a611 = a612 = a613 = a614 = a615 = a616 = a617 = a618 = a619 = a620 = \
+            a621 = a622 = a623 = a624 = a625 = a626 = a627 = a628 = a629 = a630 = \
+            a631 = a632 = a633 = a634 = a635 = a636 = a637 = a638 = a639 = a640 = \
+            a641 = a642 = a643 = a644 = a645 = a646 = a647 = a648 = a649 = a650 = \
+            a651 = a652 = a653 = a654 = a655 = a656 = a657 = a658 = a659 = a660 = \
+            a661 = a662 = a663 = a664 = a665 = a666 = a667 = a668 = a669 = a670 = \
+            a671 = a672 = a673 = a674 = a675 = a676 = a677 = a678 = a679 = a680 = \
+            a681 = a682 = a683 = a684 = a685 = a686 = a687 = a688 = a689 = a690 = \
+            a691 = a692 = a693 = a694 = a695 = a696 = a697 = a698 = a699 = a700 = \
+            a701 = a702 = a703 = a704 = a705 = a706 = a707 = a708 = a709 = a710 = \
+            a711 = a712 = a713 = a714 = a715 = a716 = a717 = a718 = a719 = a720 = \
+            a721 = a722 = a723 = a724 = a725 = a726 = a727 = a728 = a729 = a730 = \
+            a731 = a732 = a733 = a734 = a735 = a736 = a737 = a738 = a739 = a740 = \
+            a741 = a742 = a743 = a744 = a745 = a746 = a747 = a748 = a749 = a750 = \
+            a751 = a752 = a753 = a754 = a755 = a756 = a757 = a758 = a759 = a760 = \
+            a761 = a762 = a763 = a764 = a765 = a766 = a767 = a768 = a769 = a770 = \
+            a771 = a772 = a773 = a774 = a775 = a776 = a777 = a778 = a779 = a780 = \
+            a781 = a782 = a783 = a784 = a785 = a786 = a787 = a788 = a789 = a790 = \
+            a791 = a792 = a793 = a794 = a795 = a796 = a797 = a798 = a799 = a800 \
+                = None
+            print(a0)
+
+        try:
+            f()
+        except NameError as exc:
+            with support.captured_stderr() as err:
+                sys.__excepthook__(*sys.exc_info())
+
+        self.assertNotRegex(err.getvalue(), r"NameError.*a1")
+
+    def test_name_error_with_custom_exceptions(self):
+        def f():
+            blech = None
+            raise NameError()
+
+        try:
+            f()
+        except NameError as exc:
+            with support.captured_stderr() as err:
+                sys.__excepthook__(*sys.exc_info())
+
+        self.assertNotIn("blech", err.getvalue())
+
+        def f():
+            blech = None
+            raise NameError
+
+        try:
+            f()
+        except NameError as exc:
+            with support.captured_stderr() as err:
+                sys.__excepthook__(*sys.exc_info())
+
+        self.assertNotIn("blech", err.getvalue())
+
+    def test_unbound_local_error_doesn_not_match(self):
+        def foo():
+            something = 3
+            print(somethong)
+            somethong = 3
+
+        try:
+            foo()
+        except UnboundLocalError as exc:
+            with support.captured_stderr() as err:
+                sys.__excepthook__(*sys.exc_info())
+
+        self.assertNotIn("something", err.getvalue())
+
+    def test_issue45826(self):
+        # regression test for bpo-45826
+        def f():
+            with self.assertRaisesRegex(NameError, 'aaa'):
+                aab
+
+        try:
+            f()
+        except self.failureException:
+            with support.captured_stderr() as err:
+                sys.__excepthook__(*sys.exc_info())
+
+        self.assertIn("aab", err.getvalue())
+
+    def test_issue45826_focused(self):
+        def f():
+            try:
+                nonsense
+            except BaseException as E:
+                E.with_traceback(None)
+                raise ZeroDivisionError()
+
+        try:
+            f()
+        except ZeroDivisionError:
+            with support.captured_stderr() as err:
+                sys.__excepthook__(*sys.exc_info())
+
+        self.assertIn("nonsense", err.getvalue())
+        self.assertIn("ZeroDivisionError", err.getvalue())
+
+
+class AttributeErrorTests(unittest.TestCase):
+    def test_attributes(self):
+        # Setting 'attr' should not be a problem.
+        exc = AttributeError('Ouch!')
+        self.assertIsNone(exc.name)
+        self.assertIsNone(exc.obj)
+
+        sentinel = object()
+        exc = AttributeError('Ouch', name='carry', obj=sentinel)
+        self.assertEqual(exc.name, 'carry')
+        self.assertIs(exc.obj, sentinel)
+
+    def test_getattr_has_name_and_obj(self):
+        class A:
+            blech = None
+
+        obj = A()
+        try:
+            obj.bluch
+        except AttributeError as exc:
+            self.assertEqual("bluch", exc.name)
+            self.assertEqual(obj, exc.obj)
+
+    def test_getattr_has_name_and_obj_for_method(self):
+        class A:
+            def blech(self):
+                return
+
+        obj = A()
+        try:
+            obj.bluch()
+        except AttributeError as exc:
+            self.assertEqual("bluch", exc.name)
+            self.assertEqual(obj, exc.obj)
+
+    def test_getattr_suggestions(self):
+        class Substitution:
+            noise = more_noise = a = bc = None
+            blech = None
+
+        class Elimination:
+            noise = more_noise = a = bc = None
+            blch = None
+
+        class Addition:
+            noise = more_noise = a = bc = None
+            bluchin = None
+
+        class SubstitutionOverElimination:
+            blach = None
+            bluc = None
+
+        class SubstitutionOverAddition:
+            blach = None
+            bluchi = None
+
+        class EliminationOverAddition:
+            blucha = None
+            bluc = None
+
+        for cls, suggestion in [(Substitution, "'blech'?"),
+                                (Elimination, "'blch'?"),
+                                (Addition, "'bluchin'?"),
+                                (EliminationOverAddition, "'bluc'?"),
+                                (SubstitutionOverElimination, "'blach'?"),
+                                (SubstitutionOverAddition, "'blach'?")]:
+            try:
+                cls().bluch
+            except AttributeError as exc:
+                with support.captured_stderr() as err:
+                    sys.__excepthook__(*sys.exc_info())
+
+            self.assertIn(suggestion, err.getvalue())
+
+    def test_getattr_suggestions_do_not_trigger_for_long_attributes(self):
+        class A:
+            blech = None
+
+        try:
+            A().somethingverywrong
+        except AttributeError as exc:
+            with support.captured_stderr() as err:
+                sys.__excepthook__(*sys.exc_info())
+
+        self.assertNotIn("blech", err.getvalue())
+
+    def test_getattr_error_bad_suggestions_do_not_trigger_for_small_names(self):
+        class MyClass:
+            vvv = mom = w = id = pytho = None
+
+        with self.subTest(name="b"):
+            try:
+                MyClass.b
+            except AttributeError as exc:
+                with support.captured_stderr() as err:
+                    sys.__excepthook__(*sys.exc_info())
+            self.assertNotIn("you mean", err.getvalue())
+            self.assertNotIn("vvv", err.getvalue())
+            self.assertNotIn("mom", err.getvalue())
+            self.assertNotIn("'id'", err.getvalue())
+            self.assertNotIn("'w'", err.getvalue())
+            self.assertNotIn("'pytho'", err.getvalue())
+
+        with self.subTest(name="v"):
+            try:
+                MyClass.v
+            except AttributeError as exc:
+                with support.captured_stderr() as err:
+                    sys.__excepthook__(*sys.exc_info())
+            self.assertNotIn("you mean", err.getvalue())
+            self.assertNotIn("vvv", err.getvalue())
+            self.assertNotIn("mom", err.getvalue())
+            self.assertNotIn("'id'", err.getvalue())
+            self.assertNotIn("'w'", err.getvalue())
+            self.assertNotIn("'pytho'", err.getvalue())
+
+        with self.subTest(name="m"):
+            try:
+                MyClass.m
+            except AttributeError as exc:
+                with support.captured_stderr() as err:
+                    sys.__excepthook__(*sys.exc_info())
+            self.assertNotIn("you mean", err.getvalue())
+            self.assertNotIn("vvv", err.getvalue())
+            self.assertNotIn("mom", err.getvalue())
+            self.assertNotIn("'id'", err.getvalue())
+            self.assertNotIn("'w'", err.getvalue())
+            self.assertNotIn("'pytho'", err.getvalue())
+
+        with self.subTest(name="py"):
+            try:
+                MyClass.py
+            except AttributeError as exc:
+                with support.captured_stderr() as err:
+                    sys.__excepthook__(*sys.exc_info())
+            self.assertNotIn("you mean", err.getvalue())
+            self.assertNotIn("vvv", err.getvalue())
+            self.assertNotIn("mom", err.getvalue())
+            self.assertNotIn("'id'", err.getvalue())
+            self.assertNotIn("'w'", err.getvalue())
+            self.assertNotIn("'pytho'", err.getvalue())
+
+
+    def test_getattr_suggestions_do_not_trigger_for_big_dicts(self):
+        class A:
+            blech = None
+        # A class with a very big __dict__ will not be consider
+        # for suggestions.
+        for index in range(2000):
+            setattr(A, f"index_{index}", None)
+
+        try:
+            A().bluch
+        except AttributeError as exc:
+            with support.captured_stderr() as err:
+                sys.__excepthook__(*sys.exc_info())
+
+        self.assertNotIn("blech", err.getvalue())
+
+    def test_getattr_suggestions_no_args(self):
+        class A:
+            blech = None
+            def __getattr__(self, attr):
+                raise AttributeError()
+
+        try:
+            A().bluch
+        except AttributeError as exc:
+            with support.captured_stderr() as err:
+                sys.__excepthook__(*sys.exc_info())
+
+        self.assertIn("blech", err.getvalue())
+
+        class A:
+            blech = None
+            def __getattr__(self, attr):
+                raise AttributeError
+
+        try:
+            A().bluch
+        except AttributeError as exc:
+            with support.captured_stderr() as err:
+                sys.__excepthook__(*sys.exc_info())
+
+        self.assertIn("blech", err.getvalue())
+
+    def test_getattr_suggestions_invalid_args(self):
+        class NonStringifyClass:
+            __str__ = None
+            __repr__ = None
+
+        class A:
+            blech = None
+            def __getattr__(self, attr):
+                raise AttributeError(NonStringifyClass())
+
+        class B:
+            blech = None
+            def __getattr__(self, attr):
+                raise AttributeError("Error", 23)
+
+        class C:
+            blech = None
+            def __getattr__(self, attr):
+                raise AttributeError(23)
+
+        for cls in [A, B, C]:
+            try:
+                cls().bluch
+            except AttributeError as exc:
+                with support.captured_stderr() as err:
+                    sys.__excepthook__(*sys.exc_info())
+
+            self.assertIn("blech", err.getvalue())
+
+    def test_getattr_suggestions_for_same_name(self):
+        class A:
+            def __dir__(self):
+                return ['blech']
+        try:
+            A().blech
+        except AttributeError as exc:
+            with support.captured_stderr() as err:
+                sys.__excepthook__(*sys.exc_info())
+
+        self.assertNotIn("Did you mean", err.getvalue())
+
+    def test_attribute_error_with_failing_dict(self):
+        class T:
+            bluch = 1
+            def __dir__(self):
+                raise AttributeError("oh no!")
+
+        try:
+            T().blich
+        except AttributeError as exc:
+            with support.captured_stderr() as err:
+                sys.__excepthook__(*sys.exc_info())
+
+        self.assertNotIn("blech", err.getvalue())
+        self.assertNotIn("oh no!", err.getvalue())
+
+    def test_attribute_error_with_bad_name(self):
+        try:
+            raise AttributeError(name=12, obj=23)
+        except AttributeError as exc:
+            with support.captured_stderr() as err:
+                sys.__excepthook__(*sys.exc_info())
+
+        self.assertNotIn("?", err.getvalue())
+
+    def test_attribute_error_inside_nested_getattr(self):
+        class A:
+            bluch = 1
+
+        class B:
+            def __getattribute__(self, attr):
+                a = A()
+                return a.blich
+
+        try:
+            B().something
+        except AttributeError as exc:
+            with support.captured_stderr() as err:
+                sys.__excepthook__(*sys.exc_info())
+
+        self.assertIn("Did you mean", err.getvalue())
+        self.assertIn("bluch", err.getvalue())
+
 
 class ImportErrorTests(unittest.TestCase):
 
@@ -1436,6 +2296,281 @@
                 self.assertEqual(exc.name, orig.name)
                 self.assertEqual(exc.path, orig.path)
 
+class SyntaxErrorTests(unittest.TestCase):
+    def test_range_of_offsets(self):
+        cases = [
+            # Basic range from 2->7
+            (("bad.py", 1, 2, "abcdefg", 1, 7),
+             dedent(
+             """
+               File "bad.py", line 1
+                 abcdefg
+                  ^^^^^
+             SyntaxError: bad bad
+             """)),
+            # end_offset = start_offset + 1
+            (("bad.py", 1, 2, "abcdefg", 1, 3),
+             dedent(
+             """
+               File "bad.py", line 1
+                 abcdefg
+                  ^
+             SyntaxError: bad bad
+             """)),
+            # Negative end offset
+            (("bad.py", 1, 2, "abcdefg", 1, -2),
+             dedent(
+             """
+               File "bad.py", line 1
+                 abcdefg
+                  ^
+             SyntaxError: bad bad
+             """)),
+            # end offset before starting offset
+            (("bad.py", 1, 4, "abcdefg", 1, 2),
+             dedent(
+             """
+               File "bad.py", line 1
+                 abcdefg
+                    ^
+             SyntaxError: bad bad
+             """)),
+            # Both offsets negative
+            (("bad.py", 1, -4, "abcdefg", 1, -2),
+             dedent(
+             """
+               File "bad.py", line 1
+                 abcdefg
+             SyntaxError: bad bad
+             """)),
+            # Both offsets negative and the end more negative
+            (("bad.py", 1, -4, "abcdefg", 1, -5),
+             dedent(
+             """
+               File "bad.py", line 1
+                 abcdefg
+             SyntaxError: bad bad
+             """)),
+            # Both offsets 0
+            (("bad.py", 1, 0, "abcdefg", 1, 0),
+             dedent(
+             """
+               File "bad.py", line 1
+                 abcdefg
+             SyntaxError: bad bad
+             """)),
+            # Start offset 0 and end offset not 0
+            (("bad.py", 1, 0, "abcdefg", 1, 5),
+             dedent(
+             """
+               File "bad.py", line 1
+                 abcdefg
+             SyntaxError: bad bad
+             """)),
+            # End offset pass the source length
+            (("bad.py", 1, 2, "abcdefg", 1, 100),
+             dedent(
+             """
+               File "bad.py", line 1
+                 abcdefg
+                  ^^^^^^
+             SyntaxError: bad bad
+             """)),
+        ]
+        for args, expected in cases:
+            with self.subTest(args=args):
+                try:
+                    raise SyntaxError("bad bad", args)
+                except SyntaxError as exc:
+                    with support.captured_stderr() as err:
+                        sys.__excepthook__(*sys.exc_info())
+                    self.assertIn(expected, err.getvalue())
+                    the_exception = exc
+
+    def test_encodings(self):
+        source = (
+            '# -*- coding: cp437 -*-\n'
+            '"¢¢¢¢¢¢" + f(4, x for x in range(1))\n'
+        )
+        try:
+            with open(TESTFN, 'w', encoding='cp437') as testfile:
+                testfile.write(source)
+            rc, out, err = script_helper.assert_python_failure('-Wd', '-X', 'utf8', TESTFN)
+            err = err.decode('utf-8').splitlines()
+
+            self.assertEqual(err[-3], '    "¢¢¢¢¢¢" + f(4, x for x in range(1))')
+            self.assertEqual(err[-2], '                          ^^^^^^^^^^^^^^^^^^^')
+        finally:
+            unlink(TESTFN)
+
+        # Check backwards tokenizer errors
+        source = '# -*- coding: ascii -*-\n\n(\n'
+        try:
+            with open(TESTFN, 'w', encoding='ascii') as testfile:
+                testfile.write(source)
+            rc, out, err = script_helper.assert_python_failure('-Wd', '-X', 'utf8', TESTFN)
+            err = err.decode('utf-8').splitlines()
+
+            self.assertEqual(err[-3], '    (')
+            self.assertEqual(err[-2], '    ^')
+        finally:
+            unlink(TESTFN)
+
+    def test_non_utf8(self):
+        # Check non utf-8 characters
+        try:
+            with open(TESTFN, 'bw') as testfile:
+                testfile.write(b"\x89")
+            rc, out, err = script_helper.assert_python_failure('-Wd', '-X', 'utf8', TESTFN)
+            err = err.decode('utf-8').splitlines()
+
+            self.assertIn("SyntaxError: Non-UTF-8 code starting with '\\x89' in file", err[-1])
+        finally:
+            unlink(TESTFN)
+
+    def test_attributes_new_constructor(self):
+        args = ("bad.py", 1, 2, "abcdefg", 1, 100)
+        the_exception = SyntaxError("bad bad", args)
+        filename, lineno, offset, error, end_lineno, end_offset = args
+        self.assertEqual(filename, the_exception.filename)
+        self.assertEqual(lineno, the_exception.lineno)
+        self.assertEqual(end_lineno, the_exception.end_lineno)
+        self.assertEqual(offset, the_exception.offset)
+        self.assertEqual(end_offset, the_exception.end_offset)
+        self.assertEqual(error, the_exception.text)
+        self.assertEqual("bad bad", the_exception.msg)
+
+    def test_attributes_old_constructor(self):
+        args = ("bad.py", 1, 2, "abcdefg")
+        the_exception = SyntaxError("bad bad", args)
+        filename, lineno, offset, error = args
+        self.assertEqual(filename, the_exception.filename)
+        self.assertEqual(lineno, the_exception.lineno)
+        self.assertEqual(None, the_exception.end_lineno)
+        self.assertEqual(offset, the_exception.offset)
+        self.assertEqual(None, the_exception.end_offset)
+        self.assertEqual(error, the_exception.text)
+        self.assertEqual("bad bad", the_exception.msg)
+
+    def test_incorrect_constructor(self):
+        args = ("bad.py", 1, 2)
+        self.assertRaises(TypeError, SyntaxError, "bad bad", args)
+
+        args = ("bad.py", 1, 2, 4, 5, 6, 7)
+        self.assertRaises(TypeError, SyntaxError, "bad bad", args)
+
+        args = ("bad.py", 1, 2, "abcdefg", 1)
+        self.assertRaises(TypeError, SyntaxError, "bad bad", args)
+
+
+class PEP626Tests(unittest.TestCase):
+
+    def lineno_after_raise(self, f, *expected):
+        try:
+            f()
+        except Exception as ex:
+            t = ex.__traceback__
+        else:
+            self.fail("No exception raised")
+        lines = []
+        t = t.tb_next # Skip this function
+        while t:
+            frame = t.tb_frame
+            lines.append(
+                None if frame.f_lineno is None else
+                frame.f_lineno-frame.f_code.co_firstlineno
+            )
+            t = t.tb_next
+        self.assertEqual(tuple(lines), expected)
+
+    def test_lineno_after_raise_simple(self):
+        def simple():
+            1/0
+            pass
+        self.lineno_after_raise(simple, 1)
+
+    def test_lineno_after_raise_in_except(self):
+        def in_except():
+            try:
+                1/0
+            except:
+                1/0
+                pass
+        self.lineno_after_raise(in_except, 4)
+
+    def test_lineno_after_other_except(self):
+        def other_except():
+            try:
+                1/0
+            except TypeError as ex:
+                pass
+        self.lineno_after_raise(other_except, 3)
+
+    def test_lineno_in_named_except(self):
+        def in_named_except():
+            try:
+                1/0
+            except Exception as ex:
+                1/0
+                pass
+        self.lineno_after_raise(in_named_except, 4)
+
+    def test_lineno_in_try(self):
+        def in_try():
+            try:
+                1/0
+            finally:
+                pass
+        self.lineno_after_raise(in_try, 4)
+
+    def test_lineno_in_finally_normal(self):
+        def in_finally_normal():
+            try:
+                pass
+            finally:
+                1/0
+                pass
+        self.lineno_after_raise(in_finally_normal, 4)
+
+    def test_lineno_in_finally_except(self):
+        def in_finally_except():
+            try:
+                1/0
+            finally:
+                1/0
+                pass
+        self.lineno_after_raise(in_finally_except, 4)
+
+    def test_lineno_after_with(self):
+        class Noop:
+            def __enter__(self):
+                return self
+            def __exit__(self, *args):
+                pass
+        def after_with():
+            with Noop():
+                1/0
+                pass
+        self.lineno_after_raise(after_with, 2)
+
+    def test_missing_lineno_shows_as_none(self):
+        def f():
+            1/0
+        self.lineno_after_raise(f, 1)
+        f.__code__ = f.__code__.replace(co_linetable=b'\x04\x80\xff\x80')
+        self.lineno_after_raise(f, None)
+
+    def test_lineno_after_raise_in_with_exit(self):
+        class ExitFails:
+            def __enter__(self):
+                return self
+            def __exit__(self, *args):
+                raise ValueError
+
+        def after_with():
+            with ExitFails():
+                1/0
+        self.lineno_after_raise(after_with, 1, 1)
 
 if __name__ == '__main__':
     unittest.main()
diff --git a/Lib/test/test_faulthandler.py b/Lib/test/test_faulthandler.py
index c64afe8..e0f09e8 100644
--- a/Lib/test/test_faulthandler.py
+++ b/Lib/test/test_faulthandler.py
@@ -2,12 +2,14 @@
 import datetime
 import faulthandler
 import os
+import re
 import signal
 import subprocess
 import sys
-import sysconfig
 from test import support
+from test.support import os_helper
 from test.support import script_helper, is_android
+from test.support import skip_if_sanitizer
 import tempfile
 import unittest
 from textwrap import dedent
@@ -19,16 +21,6 @@
 
 TIMEOUT = 0.5
 MS_WINDOWS = (os.name == 'nt')
-_cflags = sysconfig.get_config_var('CFLAGS') or ''
-_config_args = sysconfig.get_config_var('CONFIG_ARGS') or ''
-UB_SANITIZER = (
-    '-fsanitize=undefined' in _cflags or
-    '--with-undefined-behavior-sanitizer' in _config_args
-)
-MEMORY_SANITIZER = (
-    '-fsanitize=memory' in _cflags or
-    '--with-memory-sanitizer' in _config_args
-)
 
 
 def expected_traceback(lineno1, lineno2, header, min_count=1):
@@ -51,7 +43,7 @@
     try:
         yield filename
     finally:
-        support.unlink(filename)
+        os_helper.unlink(filename)
 
 class FaultHandlerTests(unittest.TestCase):
     def get_output(self, code, filename=None, fd=None):
@@ -87,10 +79,12 @@
             output = output.decode('ascii', 'backslashreplace')
         return output.splitlines(), exitcode
 
-    def check_error(self, code, line_number, fatal_error, *,
+    def check_error(self, code, lineno, fatal_error, *,
                     filename=None, all_threads=True, other_regex=None,
                     fd=None, know_current_thread=True,
-                    py_fatal_error=False):
+                    py_fatal_error=False,
+                    garbage_collecting=False,
+                    function='<module>'):
         """
         Check that the fault handler for fatal errors is enabled and check the
         traceback from the child process output.
@@ -104,20 +98,21 @@
                 header = 'Thread 0x[0-9a-f]+'
         else:
             header = 'Stack'
-        regex = r"""
-            (?m)^{fatal_error}
-
-            {header} \(most recent call first\):
-              File "<string>", line {lineno} in <module>
-            """
+        regex = [f'^{fatal_error}']
         if py_fatal_error:
-            fatal_error += "\nPython runtime state: initialized"
-        regex = dedent(regex).format(
-            lineno=line_number,
-            fatal_error=fatal_error,
-            header=header).strip()
+            regex.append("Python runtime state: initialized")
+        regex.append('')
+        regex.append(fr'{header} \(most recent call first\):')
+        if garbage_collecting:
+            regex.append('  Garbage-collecting')
+        regex.append(fr'  File "<string>", line {lineno} in {function}')
+        regex = '\n'.join(regex)
+
         if other_regex:
-            regex += '|' + other_regex
+            regex = f'(?:{regex}|{other_regex})'
+
+        # Enable MULTILINE flag
+        regex = f'(?m){regex}'
         output, exitcode = self.get_output(code, filename=filename, fd=fd)
         output = '\n'.join(output)
         self.assertRegex(output, regex)
@@ -166,6 +161,42 @@
             3,
             'Segmentation fault')
 
+    @skip_segfault_on_android
+    def test_gc(self):
+        # bpo-44466: Detect if the GC is running
+        self.check_fatal_error("""
+            import faulthandler
+            import gc
+            import sys
+
+            faulthandler.enable()
+
+            class RefCycle:
+                def __del__(self):
+                    faulthandler._sigsegv()
+
+            # create a reference cycle which triggers a fatal
+            # error in a destructor
+            a = RefCycle()
+            b = RefCycle()
+            a.b = b
+            b.a = a
+
+            # Delete the objects, not the cycle
+            a = None
+            b = None
+
+            # Break the reference cycle: call __del__()
+            gc.collect()
+
+            # Should not reach this line
+            print("exit", file=sys.stderr)
+            """,
+            9,
+            'Segmentation fault',
+            function='__del__',
+            garbage_collecting=True)
+
     def test_fatal_error_c_thread(self):
         self.check_fatal_error("""
             import faulthandler
@@ -226,25 +257,23 @@
             5,
             'Illegal instruction')
 
+    def check_fatal_error_func(self, release_gil):
+        # Test that Py_FatalError() dumps a traceback
+        with support.SuppressCrashReport():
+            self.check_fatal_error(f"""
+                import _testcapi
+                _testcapi.fatal_error(b'xyz', {release_gil})
+                """,
+                2,
+                'xyz',
+                func='test_fatal_error',
+                py_fatal_error=True)
+
     def test_fatal_error(self):
-        self.check_fatal_error("""
-            import faulthandler
-            faulthandler._fatal_error(b'xyz')
-            """,
-            2,
-            'xyz',
-            func='faulthandler_fatal_error_py',
-            py_fatal_error=True)
+        self.check_fatal_error_func(False)
 
     def test_fatal_error_without_gil(self):
-        self.check_fatal_error("""
-            import faulthandler
-            faulthandler._fatal_error(b'xyz', True)
-            """,
-            2,
-            'xyz',
-            func='faulthandler_fatal_error_py',
-            py_fatal_error=True)
+        self.check_fatal_error_func(True)
 
     @unittest.skipIf(sys.platform.startswith('openbsd'),
                      "Issue #12868: sigaltstack() doesn't work on "
@@ -271,8 +300,8 @@
             3,
             'Segmentation fault')
 
-    @unittest.skipIf(UB_SANITIZER or MEMORY_SANITIZER,
-                     "sanitizer builds change crashing process output.")
+    @skip_if_sanitizer(memory=True, ub=True, reason="sanitizer "
+                       "builds change crashing process output.")
     @skip_segfault_on_android
     def test_enable_file(self):
         with temporary_filename() as filename:
@@ -288,8 +317,8 @@
 
     @unittest.skipIf(sys.platform == "win32",
                      "subprocess doesn't support pass_fds on Windows")
-    @unittest.skipIf(UB_SANITIZER or MEMORY_SANITIZER,
-                     "sanitizer builds change crashing process output.")
+    @skip_if_sanitizer(memory=True, ub=True, reason="sanitizer "
+                       "builds change crashing process output.")
     @skip_segfault_on_android
     def test_enable_fd(self):
         with tempfile.TemporaryFile('wb+') as fp:
@@ -330,6 +359,26 @@
                      "%r is present in %r" % (not_expected, stderr))
         self.assertNotEqual(exitcode, 0)
 
+    @skip_segfault_on_android
+    def test_dump_ext_modules(self):
+        code = """
+            import faulthandler
+            import sys
+            # Don't filter stdlib module names
+            sys.stdlib_module_names = frozenset()
+            faulthandler.enable()
+            faulthandler._sigsegv()
+            """
+        stderr, exitcode = self.get_output(code)
+        stderr = '\n'.join(stderr)
+        match = re.search(r'^Extension modules:(.*) \(total: [0-9]+\)$',
+                          stderr, re.MULTILINE)
+        if not match:
+            self.fail(f"Cannot find 'Extension modules:' in {stderr!r}")
+        modules = set(match.group(1).strip().split(', '))
+        for name in ('sys', 'faulthandler'):
+            self.assertIn(name, modules)
+
     def test_is_enabled(self):
         orig_stderr = sys.stderr
         try:
@@ -643,7 +692,7 @@
             import sys
 
             all_threads = {all_threads}
-            signum = {signum}
+            signum = {signum:d}
             unregister = {unregister}
             chain = {chain}
             filename = {filename!r}
diff --git a/Lib/test/test_fcntl.py b/Lib/test/test_fcntl.py
index 9ab68c6..fc8c393 100644
--- a/Lib/test/test_fcntl.py
+++ b/Lib/test/test_fcntl.py
@@ -6,8 +6,10 @@
 import sys
 import unittest
 from multiprocessing import Process
-from test.support import (verbose, TESTFN, unlink, run_unittest, import_module,
-                          cpython_only)
+from test.support import verbose, cpython_only
+from test.support.import_helper import import_module
+from test.support.os_helper import TESTFN, unlink
+
 
 # Skip test if no fcntl module.
 fcntl = import_module('fcntl')
@@ -188,8 +190,25 @@
         res = fcntl.fcntl(self.f.fileno(), fcntl.F_GETPATH, bytes(len(expected)))
         self.assertEqual(expected, res)
 
-def test_main():
-    run_unittest(TestFcntl)
+    @unittest.skipUnless(
+        hasattr(fcntl, "F_SETPIPE_SZ") and hasattr(fcntl, "F_GETPIPE_SZ"),
+        "F_SETPIPE_SZ and F_GETPIPE_SZ are not available on all platforms.")
+    def test_fcntl_f_pipesize(self):
+        test_pipe_r, test_pipe_w = os.pipe()
+        try:
+            # Get the default pipesize with F_GETPIPE_SZ
+            pipesize_default = fcntl.fcntl(test_pipe_w, fcntl.F_GETPIPE_SZ)
+            pipesize = pipesize_default // 2  # A new value to detect change.
+            if pipesize < 512:  # the POSIX minimum
+                raise unittest.SkitTest(
+                    'default pipesize too small to perform test.')
+            fcntl.fcntl(test_pipe_w, fcntl.F_SETPIPE_SZ, pipesize)
+            self.assertEqual(fcntl.fcntl(test_pipe_w, fcntl.F_GETPIPE_SZ),
+                             pipesize)
+        finally:
+            os.close(test_pipe_r)
+            os.close(test_pipe_w)
+
 
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_file.py b/Lib/test/test_file.py
index cd642e7..1146a37 100644
--- a/Lib/test/test_file.py
+++ b/Lib/test/test_file.py
@@ -7,8 +7,10 @@
 import io
 import _pyio as pyio
 
-from test.support import TESTFN
-from test import support
+from test.support import gc_collect
+from test.support.os_helper import TESTFN
+from test.support import os_helper
+from test.support import warnings_helper
 from collections import UserList
 
 class AutoFileTests:
@@ -20,7 +22,7 @@
     def tearDown(self):
         if self.f:
             self.f.close()
-        support.unlink(TESTFN)
+        os_helper.unlink(TESTFN)
 
     def testWeakRefs(self):
         # verify weak references
@@ -29,6 +31,7 @@
         self.assertEqual(self.f.tell(), p.tell())
         self.f.close()
         self.f = None
+        gc_collect()  # For PyPy or other GCs.
         self.assertRaises(ReferenceError, getattr, p, 'tell')
 
     def testAttributes(self):
@@ -51,7 +54,7 @@
         # verify readinto refuses text files
         a = array('b', b'x'*10)
         self.f.close()
-        self.f = self.open(TESTFN, 'r')
+        self.f = self.open(TESTFN, encoding="utf-8")
         if hasattr(self.f, "readinto"):
             self.assertRaises(TypeError, self.f.readinto, a)
 
@@ -139,7 +142,7 @@
 class OtherFileTests:
 
     def tearDown(self):
-        support.unlink(TESTFN)
+        os_helper.unlink(TESTFN)
 
     def testModeStrings(self):
         # check invalid mode strings
@@ -153,6 +156,22 @@
                 f.close()
                 self.fail('%r is an invalid file mode' % mode)
 
+    def testStdin(self):
+        if sys.platform == 'osf1V5':
+            # This causes the interpreter to exit on OSF1 v5.1.
+            self.skipTest(
+                ' sys.stdin.seek(-1) may crash the interpreter on OSF1.'
+                ' Test manually.')
+
+        if not sys.stdin.isatty():
+            # Issue 14853: stdin becomes seekable when redirected to a file
+            self.skipTest('stdin must be a TTY in this test')
+
+        with self.assertRaises((IOError, ValueError)):
+            sys.stdin.seek(-1)
+        with self.assertRaises((IOError, ValueError)):
+            sys.stdin.truncate()
+
     def testBadModeArgument(self):
         # verify that we get a sensible error message for bad mode argument
         bad_mode = "qwerty"
@@ -187,7 +206,7 @@
         # make sure that explicitly setting the buffer size doesn't cause
         # misbehaviour especially with repeated close() calls
         for s in (-1, 0, 512):
-            with support.check_no_warnings(self,
+            with warnings_helper.check_no_warnings(self,
                                            message='line buffering',
                                            category=RuntimeWarning):
                 self._checkBufferSize(s)
diff --git a/Lib/test/test_file_eintr.py b/Lib/test/test_file_eintr.py
index f1efd26..01408d8 100644
--- a/Lib/test/test_file_eintr.py
+++ b/Lib/test/test_file_eintr.py
@@ -213,7 +213,7 @@
     def _generate_infile_setup_code(self):
         """Returns the infile = ... line of code to make a TextIOWrapper."""
         return ('import %s as io ;'
-                'infile = io.open(sys.stdin.fileno(), "rt", newline=None) ;'
+                'infile = io.open(sys.stdin.fileno(), encoding="utf-8", newline=None) ;'
                 'assert isinstance(infile, io.TextIOWrapper)' %
                 self.modname)
 
diff --git a/Lib/test/test_filecmp.py b/Lib/test/test_filecmp.py
index b5b24a2..9b5ac12 100644
--- a/Lib/test/test_filecmp.py
+++ b/Lib/test/test_filecmp.py
@@ -5,19 +5,20 @@
 import unittest
 
 from test import support
+from test.support import os_helper
 
 
 class FileCompareTestCase(unittest.TestCase):
     def setUp(self):
-        self.name = support.TESTFN
-        self.name_same = support.TESTFN + '-same'
-        self.name_diff = support.TESTFN + '-diff'
+        self.name = os_helper.TESTFN
+        self.name_same = os_helper.TESTFN + '-same'
+        self.name_diff = os_helper.TESTFN + '-diff'
         data = 'Contents of file go here.\n'
         for name in [self.name, self.name_same, self.name_diff]:
-            with open(name, 'w') as output:
+            with open(name, 'w', encoding="utf-8") as output:
                 output.write(data)
 
-        with open(self.name_diff, 'a+') as output:
+        with open(self.name_diff, 'a+', encoding="utf-8") as output:
             output.write('An extra line.\n')
         self.dir = tempfile.gettempdir()
 
@@ -65,14 +66,16 @@
         for dir in (self.dir, self.dir_same, self.dir_diff, self.dir_ignored):
             shutil.rmtree(dir, True)
             os.mkdir(dir)
+            subdir_path = os.path.join(dir, 'subdir')
+            os.mkdir(subdir_path)
             if self.caseinsensitive and dir is self.dir_same:
                 fn = 'FiLe'     # Verify case-insensitive comparison
             else:
                 fn = 'file'
-            with open(os.path.join(dir, fn), 'w') as output:
+            with open(os.path.join(dir, fn), 'w', encoding="utf-8") as output:
                 output.write(data)
 
-        with open(os.path.join(self.dir_diff, 'file2'), 'w') as output:
+        with open(os.path.join(self.dir_diff, 'file2'), 'w', encoding="utf-8") as output:
             output.write('An extra file.\n')
 
     def tearDown(self):
@@ -100,7 +103,7 @@
                         "Comparing directory to same fails")
 
         # Add different file2
-        with open(os.path.join(self.dir, 'file2'), 'w') as output:
+        with open(os.path.join(self.dir, 'file2'), 'w', encoding="utf-8") as output:
             output.write('Different contents.\n')
 
         self.assertFalse(filecmp.cmpfiles(self.dir, self.dir_same,
@@ -109,6 +112,11 @@
                     "Comparing mismatched directories fails")
 
 
+    def _assert_lists(self, actual, expected):
+        """Assert that two lists are equal, up to ordering."""
+        self.assertEqual(sorted(actual), sorted(expected))
+
+
     def test_dircmp(self):
         # Check attributes for comparison of two identical directories
         left_dir, right_dir = self.dir, self.dir_same
@@ -116,10 +124,13 @@
         self.assertEqual(d.left, left_dir)
         self.assertEqual(d.right, right_dir)
         if self.caseinsensitive:
-            self.assertEqual([d.left_list, d.right_list],[['file'], ['FiLe']])
+            self._assert_lists(d.left_list, ['file', 'subdir'])
+            self._assert_lists(d.right_list, ['FiLe', 'subdir'])
         else:
-            self.assertEqual([d.left_list, d.right_list],[['file'], ['file']])
-        self.assertEqual(d.common, ['file'])
+            self._assert_lists(d.left_list, ['file', 'subdir'])
+            self._assert_lists(d.right_list, ['file', 'subdir'])
+        self._assert_lists(d.common, ['file', 'subdir'])
+        self._assert_lists(d.common_dirs, ['subdir'])
         self.assertEqual(d.left_only, [])
         self.assertEqual(d.right_only, [])
         self.assertEqual(d.same_files, ['file'])
@@ -127,6 +138,7 @@
         expected_report = [
             "diff {} {}".format(self.dir, self.dir_same),
             "Identical files : ['file']",
+            "Common subdirectories : ['subdir']",
         ]
         self._assert_report(d.report, expected_report)
 
@@ -135,9 +147,10 @@
         d = filecmp.dircmp(left_dir, right_dir)
         self.assertEqual(d.left, left_dir)
         self.assertEqual(d.right, right_dir)
-        self.assertEqual(d.left_list, ['file'])
-        self.assertEqual(d.right_list, ['file', 'file2'])
-        self.assertEqual(d.common, ['file'])
+        self._assert_lists(d.left_list, ['file', 'subdir'])
+        self._assert_lists(d.right_list, ['file', 'file2', 'subdir'])
+        self._assert_lists(d.common, ['file', 'subdir'])
+        self._assert_lists(d.common_dirs, ['subdir'])
         self.assertEqual(d.left_only, [])
         self.assertEqual(d.right_only, ['file2'])
         self.assertEqual(d.same_files, ['file'])
@@ -146,6 +159,7 @@
             "diff {} {}".format(self.dir, self.dir_diff),
             "Only in {} : ['file2']".format(self.dir_diff),
             "Identical files : ['file']",
+            "Common subdirectories : ['subdir']",
         ]
         self._assert_report(d.report, expected_report)
 
@@ -158,9 +172,9 @@
         d = filecmp.dircmp(left_dir, right_dir)
         self.assertEqual(d.left, left_dir)
         self.assertEqual(d.right, right_dir)
-        self.assertEqual(d.left_list, ['file', 'file2'])
-        self.assertEqual(d.right_list, ['file'])
-        self.assertEqual(d.common, ['file'])
+        self._assert_lists(d.left_list, ['file', 'file2', 'subdir'])
+        self._assert_lists(d.right_list, ['file', 'subdir'])
+        self._assert_lists(d.common, ['file', 'subdir'])
         self.assertEqual(d.left_only, ['file2'])
         self.assertEqual(d.right_only, [])
         self.assertEqual(d.same_files, ['file'])
@@ -169,11 +183,12 @@
             "diff {} {}".format(self.dir, self.dir_diff),
             "Only in {} : ['file2']".format(self.dir),
             "Identical files : ['file']",
+            "Common subdirectories : ['subdir']",
         ]
         self._assert_report(d.report, expected_report)
 
         # Add different file2
-        with open(os.path.join(self.dir_diff, 'file2'), 'w') as output:
+        with open(os.path.join(self.dir_diff, 'file2'), 'w', encoding="utf-8") as output:
             output.write('Different contents.\n')
         d = filecmp.dircmp(self.dir, self.dir_diff)
         self.assertEqual(d.same_files, ['file'])
@@ -182,24 +197,45 @@
             "diff {} {}".format(self.dir, self.dir_diff),
             "Identical files : ['file']",
             "Differing files : ['file2']",
+            "Common subdirectories : ['subdir']",
         ]
         self._assert_report(d.report, expected_report)
 
+    def test_dircmp_subdirs_type(self):
+        """Check that dircmp.subdirs respects subclassing."""
+        class MyDirCmp(filecmp.dircmp):
+            pass
+        d = MyDirCmp(self.dir, self.dir_diff)
+        sub_dirs = d.subdirs
+        self.assertEqual(list(sub_dirs.keys()), ['subdir'])
+        sub_dcmp = sub_dirs['subdir']
+        self.assertEqual(type(sub_dcmp), MyDirCmp)
+
     def test_report_partial_closure(self):
         left_dir, right_dir = self.dir, self.dir_same
         d = filecmp.dircmp(left_dir, right_dir)
+        left_subdir = os.path.join(left_dir, 'subdir')
+        right_subdir = os.path.join(right_dir, 'subdir')
         expected_report = [
             "diff {} {}".format(self.dir, self.dir_same),
             "Identical files : ['file']",
+            "Common subdirectories : ['subdir']",
+            '',
+            "diff {} {}".format(left_subdir, right_subdir),
         ]
         self._assert_report(d.report_partial_closure, expected_report)
 
     def test_report_full_closure(self):
         left_dir, right_dir = self.dir, self.dir_same
         d = filecmp.dircmp(left_dir, right_dir)
+        left_subdir = os.path.join(left_dir, 'subdir')
+        right_subdir = os.path.join(right_dir, 'subdir')
         expected_report = [
             "diff {} {}".format(self.dir, self.dir_same),
             "Identical files : ['file']",
+            "Common subdirectories : ['subdir']",
+            '',
+            "diff {} {}".format(left_subdir, right_subdir),
         ]
         self._assert_report(d.report_full_closure, expected_report)
 
@@ -210,8 +246,5 @@
             self.assertEqual(report_lines, expected_report_lines)
 
 
-def test_main():
-    support.run_unittest(FileCompareTestCase, DirCompareTestCase)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_fileinput.py b/Lib/test/test_fileinput.py
index 014f19e..cae0eb1 100644
--- a/Lib/test/test_fileinput.py
+++ b/Lib/test/test_fileinput.py
@@ -2,6 +2,7 @@
 Tests for fileinput module.
 Nick Mathewson
 '''
+import io
 import os
 import sys
 import re
@@ -24,8 +25,11 @@
 from fileinput import FileInput, hook_encoded
 from pathlib import Path
 
-from test.support import verbose, TESTFN, check_warnings
-from test.support import unlink as safe_unlink
+from test.support import verbose
+from test.support.os_helper import TESTFN
+from test.support.os_helper import unlink as safe_unlink
+from test.support import os_helper
+from test.support import warnings_helper
 from test import support
 from unittest import mock
 
@@ -39,8 +43,9 @@
     # temp file's name.
     def writeTmp(self, content, *, mode='w'):  # opening in text mode is the default
         fd, name = tempfile.mkstemp()
-        self.addCleanup(support.unlink, name)
-        with open(fd, mode) as f:
+        self.addCleanup(os_helper.unlink, name)
+        encoding = None if "b" in mode else "utf-8"
+        with open(fd, mode, encoding=encoding) as f:
             f.write(content)
         return name
 
@@ -92,7 +97,7 @@
 
         if verbose:
             print('1. Simple iteration')
-        fi = FileInput(files=(t1, t2, t3, t4))
+        fi = FileInput(files=(t1, t2, t3, t4), encoding="utf-8")
         lines = list(fi)
         fi.close()
         self.assertEqual(len(lines), 31)
@@ -103,7 +108,7 @@
 
         if verbose:
             print('2. Status variables')
-        fi = FileInput(files=(t1, t2, t3, t4))
+        fi = FileInput(files=(t1, t2, t3, t4), encoding="utf-8")
         s = "x"
         while s and s != 'Line 6 of file 2\n':
             s = fi.readline()
@@ -122,7 +127,7 @@
 
         if verbose:
             print('4. Stdin')
-        fi = FileInput(files=(t1, t2, t3, t4, '-'))
+        fi = FileInput(files=(t1, t2, t3, t4, '-'), encoding="utf-8")
         savestdin = sys.stdin
         try:
             sys.stdin = StringIO("Line 1 of stdin\nLine 2 of stdin\n")
@@ -136,7 +141,7 @@
 
         if verbose:
             print('5. Boundary conditions')
-        fi = FileInput(files=(t1, t2, t3, t4))
+        fi = FileInput(files=(t1, t2, t3, t4), encoding="utf-8")
         self.assertEqual(fi.lineno(), 0)
         self.assertEqual(fi.filename(), None)
         fi.nextfile()
@@ -147,7 +152,7 @@
             print('6. Inplace')
         savestdout = sys.stdout
         try:
-            fi = FileInput(files=(t1, t2, t3, t4), inplace=1)
+            fi = FileInput(files=(t1, t2, t3, t4), inplace=1, encoding="utf-8")
             for line in fi:
                 line = line[:-1].upper()
                 print(line)
@@ -155,7 +160,7 @@
         finally:
             sys.stdout = savestdout
 
-        fi = FileInput(files=(t1, t2, t3, t4))
+        fi = FileInput(files=(t1, t2, t3, t4), encoding="utf-8")
         for line in fi:
             self.assertEqual(line[-1], '\n')
             m = pat.match(line[:-1])
@@ -178,7 +183,7 @@
         t2 = self.writeTmp("")
         t3 = self.writeTmp("The only line there is.\n")
         t4 = self.writeTmp("")
-        fi = FileInput(files=(t1, t2, t3, t4))
+        fi = FileInput(files=(t1, t2, t3, t4), encoding="utf-8")
 
         line = fi.readline()
         self.assertEqual(line, 'The only line there is.\n')
@@ -196,7 +201,7 @@
     def test_files_that_dont_end_with_newline(self):
         t1 = self.writeTmp("A\nB\nC")
         t2 = self.writeTmp("D\nE\nF")
-        fi = FileInput(files=(t1, t2))
+        fi = FileInput(files=(t1, t2), encoding="utf-8")
         lines = list(fi)
         self.assertEqual(lines, ["A\n", "B\n", "C", "D\n", "E\n", "F"])
         self.assertEqual(fi.filelineno(), 3)
@@ -209,14 +214,14 @@
 ##         encoding = sys.getfilesystemencoding()
 ##         if encoding is None:
 ##             encoding = 'ascii'
-##         fi = FileInput(files=str(t1, encoding))
+##         fi = FileInput(files=str(t1, encoding), encoding="utf-8")
 ##         lines = list(fi)
 ##         self.assertEqual(lines, ["A\n", "B"])
 
     def test_fileno(self):
         t1 = self.writeTmp("A\nB")
         t2 = self.writeTmp("C\nD")
-        fi = FileInput(files=(t1, t2))
+        fi = FileInput(files=(t1, t2), encoding="utf-8")
         self.assertEqual(fi.fileno(), -1)
         line = next(fi)
         self.assertNotEqual(fi.fileno(), -1)
@@ -228,15 +233,15 @@
     def test_opening_mode(self):
         try:
             # invalid mode, should raise ValueError
-            fi = FileInput(mode="w")
+            fi = FileInput(mode="w", encoding="utf-8")
             self.fail("FileInput should reject invalid mode argument")
         except ValueError:
             pass
         # try opening in universal newline mode
         t1 = self.writeTmp(b"A\nB\r\nC\rD", mode="wb")
-        with check_warnings(('', DeprecationWarning)):
-            fi = FileInput(files=t1, mode="U")
-        with check_warnings(('', DeprecationWarning)):
+        with warnings_helper.check_warnings(('', DeprecationWarning)):
+            fi = FileInput(files=t1, mode="U", encoding="utf-8")
+        with warnings_helper.check_warnings(('', DeprecationWarning)):
             lines = list(fi)
         self.assertEqual(lines, ["A\n", "B\n", "C\n", "D"])
 
@@ -275,9 +280,9 @@
         class CustomOpenHook:
             def __init__(self):
                 self.invoked = False
-            def __call__(self, *args):
+            def __call__(self, *args, **kargs):
                 self.invoked = True
-                return open(*args)
+                return open(*args, encoding="utf-8")
 
         t = self.writeTmp("\n")
         custom_open_hook = CustomOpenHook()
@@ -331,10 +336,18 @@
         with open(temp_file, 'rb') as f:
             self.assertEqual(f.read(), b'New line.')
 
+    def test_file_hook_backward_compatibility(self):
+        def old_hook(filename, mode):
+            return io.StringIO("I used to receive only filename and mode")
+        t = self.writeTmp("\n")
+        with FileInput([t], openhook=old_hook) as fi:
+            result = fi.readline()
+        self.assertEqual(result, "I used to receive only filename and mode")
+
     def test_context_manager(self):
         t1 = self.writeTmp("A\nB\nC")
         t2 = self.writeTmp("D\nE\nF")
-        with FileInput(files=(t1, t2)) as fi:
+        with FileInput(files=(t1, t2), encoding="utf-8") as fi:
             lines = list(fi)
         self.assertEqual(lines, ["A\n", "B\n", "C", "D\n", "E\n", "F"])
         self.assertEqual(fi.filelineno(), 3)
@@ -344,21 +357,21 @@
     def test_close_on_exception(self):
         t1 = self.writeTmp("")
         try:
-            with FileInput(files=t1) as fi:
+            with FileInput(files=t1, encoding="utf-8") as fi:
                 raise OSError
         except OSError:
             self.assertEqual(fi._files, ())
 
     def test_empty_files_list_specified_to_constructor(self):
-        with FileInput(files=[]) as fi:
+        with FileInput(files=[], encoding="utf-8") as fi:
             self.assertEqual(fi._files, ('-',))
 
-    @support.ignore_warnings(category=DeprecationWarning)
+    @warnings_helper.ignore_warnings(category=DeprecationWarning)
     def test__getitem__(self):
         """Tests invoking FileInput.__getitem__() with the current
            line number"""
         t = self.writeTmp("line1\nline2\n")
-        with FileInput(files=[t]) as fi:
+        with FileInput(files=[t], encoding="utf-8") as fi:
             retval1 = fi[0]
             self.assertEqual(retval1, "line1\n")
             retval2 = fi[1]
@@ -371,22 +384,22 @@
             with FileInput(files=[t]) as fi:
                 self.assertEqual(fi[0], "line1\n")
 
-    @support.ignore_warnings(category=DeprecationWarning)
+    @warnings_helper.ignore_warnings(category=DeprecationWarning)
     def test__getitem__invalid_key(self):
         """Tests invoking FileInput.__getitem__() with an index unequal to
            the line number"""
         t = self.writeTmp("line1\nline2\n")
-        with FileInput(files=[t]) as fi:
+        with FileInput(files=[t], encoding="utf-8") as fi:
             with self.assertRaises(RuntimeError) as cm:
                 fi[1]
         self.assertEqual(cm.exception.args, ("accessing lines out of order",))
 
-    @support.ignore_warnings(category=DeprecationWarning)
+    @warnings_helper.ignore_warnings(category=DeprecationWarning)
     def test__getitem__eof(self):
         """Tests invoking FileInput.__getitem__() with the line number but at
            end-of-input"""
         t = self.writeTmp('')
-        with FileInput(files=[t]) as fi:
+        with FileInput(files=[t], encoding="utf-8") as fi:
             with self.assertRaises(IndexError) as cm:
                 fi[0]
         self.assertEqual(cm.exception.args, ("end of input reached",))
@@ -400,8 +413,8 @@
         os_unlink_replacement = UnconditionallyRaise(OSError)
         try:
             t = self.writeTmp("\n")
-            self.addCleanup(support.unlink, t + '.bak')
-            with FileInput(files=[t], inplace=True) as fi:
+            self.addCleanup(safe_unlink, t + '.bak')
+            with FileInput(files=[t], inplace=True, encoding="utf-8") as fi:
                 next(fi) # make sure the file is opened
                 os.unlink = os_unlink_replacement
                 fi.nextfile()
@@ -420,7 +433,7 @@
         os_fstat_replacement = UnconditionallyRaise(OSError)
         try:
             t = self.writeTmp("\n")
-            with FileInput(files=[t], inplace=True) as fi:
+            with FileInput(files=[t], inplace=True, encoding="utf-8") as fi:
                 os.fstat = os_fstat_replacement
                 fi.readline()
         finally:
@@ -438,7 +451,7 @@
         os_chmod_replacement = UnconditionallyRaise(OSError)
         try:
             t = self.writeTmp("\n")
-            with FileInput(files=[t], inplace=True) as fi:
+            with FileInput(files=[t], inplace=True, encoding="utf-8") as fi:
                 os.chmod = os_chmod_replacement
                 fi.readline()
         finally:
@@ -457,7 +470,7 @@
 
         unconditionally_raise_ValueError = FilenoRaisesValueError()
         t = self.writeTmp("\n")
-        with FileInput(files=[t]) as fi:
+        with FileInput(files=[t], encoding="utf-8") as fi:
             file_backup = fi._file
             try:
                 fi._file = unconditionally_raise_ValueError
@@ -505,7 +518,7 @@
 
     def test_pathlib_file(self):
         t1 = Path(self.writeTmp("Pathlib file."))
-        with FileInput(t1) as fi:
+        with FileInput(t1, encoding="utf-8") as fi:
             line = fi.readline()
             self.assertEqual(line, 'Pathlib file.')
             self.assertEqual(fi.lineno(), 1)
@@ -514,11 +527,11 @@
 
     def test_pathlib_file_inplace(self):
         t1 = Path(self.writeTmp('Pathlib file.'))
-        with FileInput(t1, inplace=True) as fi:
+        with FileInput(t1, inplace=True, encoding="utf-8") as fi:
             line = fi.readline()
             self.assertEqual(line, 'Pathlib file.')
             print('Modified %s' % line)
-        with open(t1) as f:
+        with open(t1, encoding="utf-8") as f:
             self.assertEqual(f.read(), 'Modified Pathlib file.\n')
 
 
@@ -526,12 +539,14 @@
     """A class that mocks out fileinput.FileInput for use during unit tests"""
 
     def __init__(self, files=None, inplace=False, backup="", *,
-                 mode="r", openhook=None):
+                 mode="r", openhook=None, encoding=None, errors=None):
         self.files = files
         self.inplace = inplace
         self.backup = backup
         self.mode = mode
         self.openhook = openhook
+        self.encoding = encoding
+        self.errors = errors
         self._file = None
         self.invocation_counts = collections.defaultdict(lambda: 0)
         self.return_values = {}
@@ -634,10 +649,11 @@
         backup = object()
         mode = object()
         openhook = object()
+        encoding = object()
 
         # call fileinput.input() with different values for each argument
         result = fileinput.input(files=files, inplace=inplace, backup=backup,
-            mode=mode, openhook=openhook)
+            mode=mode, openhook=openhook, encoding=encoding)
 
         # ensure fileinput._state was set to the returned object
         self.assertIs(result, fileinput._state, "fileinput._state")
@@ -860,11 +876,15 @@
         self.assertIs(fileinput._state, instance)
 
 class InvocationRecorder:
+
     def __init__(self):
         self.invocation_count = 0
+
     def __call__(self, *args, **kwargs):
         self.invocation_count += 1
         self.last_invocation = (args, kwargs)
+        return io.BytesIO(b'some bytes')
+
 
 class Test_hook_compressed(unittest.TestCase):
     """Unit tests for fileinput.hook_compressed()"""
@@ -883,33 +903,43 @@
         original_open = gzip.open
         gzip.open = self.fake_open
         try:
-            result = fileinput.hook_compressed("test.gz", 3)
+            result = fileinput.hook_compressed("test.gz", "3")
         finally:
             gzip.open = original_open
 
         self.assertEqual(self.fake_open.invocation_count, 1)
-        self.assertEqual(self.fake_open.last_invocation, (("test.gz", 3), {}))
+        self.assertEqual(self.fake_open.last_invocation, (("test.gz", "3"), {}))
+
+    @unittest.skipUnless(gzip, "Requires gzip and zlib")
+    def test_gz_with_encoding_fake(self):
+        original_open = gzip.open
+        gzip.open = lambda filename, mode: io.BytesIO(b'Ex-binary string')
+        try:
+            result = fileinput.hook_compressed("test.gz", "3", encoding="utf-8")
+        finally:
+            gzip.open = original_open
+        self.assertEqual(list(result), ['Ex-binary string'])
 
     @unittest.skipUnless(bz2, "Requires bz2")
     def test_bz2_ext_fake(self):
         original_open = bz2.BZ2File
         bz2.BZ2File = self.fake_open
         try:
-            result = fileinput.hook_compressed("test.bz2", 4)
+            result = fileinput.hook_compressed("test.bz2", "4")
         finally:
             bz2.BZ2File = original_open
 
         self.assertEqual(self.fake_open.invocation_count, 1)
-        self.assertEqual(self.fake_open.last_invocation, (("test.bz2", 4), {}))
+        self.assertEqual(self.fake_open.last_invocation, (("test.bz2", "4"), {}))
 
     def test_blah_ext(self):
-        self.do_test_use_builtin_open("abcd.blah", 5)
+        self.do_test_use_builtin_open("abcd.blah", "5")
 
     def test_gz_ext_builtin(self):
-        self.do_test_use_builtin_open("abcd.Gz", 6)
+        self.do_test_use_builtin_open("abcd.Gz", "6")
 
     def test_bz2_ext_builtin(self):
-        self.do_test_use_builtin_open("abcd.Bz2", 7)
+        self.do_test_use_builtin_open("abcd.Bz2", "7")
 
     def do_test_use_builtin_open(self, filename, mode):
         original_open = self.replace_builtin_open(self.fake_open)
@@ -920,7 +950,7 @@
 
         self.assertEqual(self.fake_open.invocation_count, 1)
         self.assertEqual(self.fake_open.last_invocation,
-                         ((filename, mode), {}))
+                         ((filename, mode), {'encoding': 'locale', 'errors': None}))
 
     @staticmethod
     def replace_builtin_open(new_open_func):
diff --git a/Lib/test/test_fileio.py b/Lib/test/test_fileio.py
index 26e4500..4269b0e 100644
--- a/Lib/test/test_fileio.py
+++ b/Lib/test/test_fileio.py
@@ -9,8 +9,9 @@
 from weakref import proxy
 from functools import wraps
 
-from test.support import (TESTFN, TESTFN_UNICODE, check_warnings, run_unittest,
-                          make_bad_fd, cpython_only, swap_attr)
+from test.support import cpython_only, swap_attr, gc_collect
+from test.support.os_helper import (TESTFN, TESTFN_UNICODE, make_bad_fd)
+from test.support.warnings_helper import check_warnings
 from collections import UserList
 
 import _io  # C implementation of io
@@ -35,6 +36,7 @@
         self.assertEqual(self.f.tell(), p.tell())
         self.f.close()
         self.f = None
+        gc_collect()  # For PyPy or other GCs.
         self.assertRaises(ReferenceError, getattr, p, 'tell')
 
     def testSeekTell(self):
@@ -604,15 +606,12 @@
             self.assertNotEqual(w.warnings, [])
 
 
-def test_main():
+def tearDownModule():
     # Historically, these tests have been sloppy about removing TESTFN.
     # So get rid of it no matter what.
-    try:
-        run_unittest(CAutoFileTests, PyAutoFileTests,
-                     COtherFileTests, PyOtherFileTests)
-    finally:
-        if os.path.exists(TESTFN):
-            os.unlink(TESTFN)
+    if os.path.exists(TESTFN):
+        os.unlink(TESTFN)
+
 
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py
index 9651281..29f7756 100644
--- a/Lib/test/test_float.py
+++ b/Lib/test/test_float.py
@@ -64,6 +64,9 @@
         # See bpo-34087
         self.assertRaises(ValueError, float, '\u3053\u3093\u306b\u3061\u306f')
 
+    def test_noargs(self):
+        self.assertEqual(float(), 0.0)
+
     def test_underscores(self):
         for lit in VALID_UNDERSCORE_LITERALS:
             if not any(ch in lit for ch in 'jJxXoObB'):
@@ -561,6 +564,25 @@
             #self.assertTrue(0.0 < pow_op(2.0, -1047) < 1e-315)
             #self.assertTrue(0.0 > pow_op(-2.0, -1047) > -1e-315)
 
+    def test_hash(self):
+        for x in range(-30, 30):
+            self.assertEqual(hash(float(x)), hash(x))
+        self.assertEqual(hash(float(sys.float_info.max)),
+                         hash(int(sys.float_info.max)))
+        self.assertEqual(hash(float('inf')), sys.hash_info.inf)
+        self.assertEqual(hash(float('-inf')), -sys.hash_info.inf)
+
+    def test_hash_nan(self):
+        value = float('nan')
+        self.assertEqual(hash(value), object.__hash__(value))
+        class H:
+            def __hash__(self):
+                return 42
+        class F(float, H):
+            pass
+        value = F('nan')
+        self.assertEqual(hash(value), object.__hash__(value))
+
 
 @requires_setformat
 class FormatFunctionsTestCase(unittest.TestCase):
@@ -726,7 +748,7 @@
 
     @support.requires_IEEE_754
     def test_format_testfile(self):
-        with open(format_testfile) as testfile:
+        with open(format_testfile, encoding="utf-8") as testfile:
             for line in testfile:
                 if line.startswith('--'):
                     continue
@@ -766,7 +788,7 @@
 class ReprTestCase(unittest.TestCase):
     def test_repr(self):
         with open(os.path.join(os.path.split(__file__)[0],
-                  'floating_points.txt')) as floats_file:
+                  'floating_points.txt'), encoding="utf-8") as floats_file:
             for line in floats_file:
                 line = line.strip()
                 if not line or line.startswith('#'):
@@ -1162,10 +1184,10 @@
 
 
     def test_from_hex(self):
-        MIN = self.MIN;
-        MAX = self.MAX;
-        TINY = self.TINY;
-        EPS = self.EPS;
+        MIN = self.MIN
+        MAX = self.MAX
+        TINY = self.TINY
+        EPS = self.EPS
 
         # two spellings of infinity, with optional signs; case-insensitive
         self.identical(fromHex('inf'), INF)
@@ -1446,6 +1468,20 @@
         self.identical(fromHex('0X1.0000000000001fp0'), 1.0+2*EPS)
         self.identical(fromHex('0x1.00000000000020p0'), 1.0+2*EPS)
 
+        # Regression test for a corner-case bug reported in b.p.o. 44954
+        self.identical(fromHex('0x.8p-1074'), 0.0)
+        self.identical(fromHex('0x.80p-1074'), 0.0)
+        self.identical(fromHex('0x.81p-1074'), TINY)
+        self.identical(fromHex('0x8p-1078'), 0.0)
+        self.identical(fromHex('0x8.0p-1078'), 0.0)
+        self.identical(fromHex('0x8.1p-1078'), TINY)
+        self.identical(fromHex('0x80p-1082'), 0.0)
+        self.identical(fromHex('0x81p-1082'), TINY)
+        self.identical(fromHex('.8p-1074'), 0.0)
+        self.identical(fromHex('8p-1078'), 0.0)
+        self.identical(fromHex('-.8p-1074'), -0.0)
+        self.identical(fromHex('+8p-1078'), 0.0)
+
     def test_roundtrip(self):
         def roundtrip(x):
             return fromHex(toHex(x))
diff --git a/Lib/test/test_flufl.py b/Lib/test/test_flufl.py
index 2228585..a81a4d4 100644
--- a/Lib/test/test_flufl.py
+++ b/Lib/test/test_flufl.py
@@ -17,10 +17,10 @@
         self.assertIn('2 != 3', cm.exception.text)
         self.assertEqual(cm.exception.filename, '<FLUFL test>')
 
-        self.assertTrue(cm.exception.lineno, 2)
+        self.assertEqual(cm.exception.lineno, 2)
         # The old parser reports the end of the token and the new
         # parser reports the start of the token
-        self.assertEqual(cm.exception.offset, 4 if support.use_old_parser() else 3)
+        self.assertEqual(cm.exception.offset, 3)
 
     def test_guido_as_bdfl(self):
         code = '2 {0} 3'
@@ -33,7 +33,7 @@
         self.assertEqual(cm.exception.lineno, 1)
         # The old parser reports the end of the token and the new
         # parser reports the start of the token
-        self.assertEqual(cm.exception.offset, 4 if support.use_old_parser() else 3)
+        self.assertEqual(cm.exception.offset, 3)
 
 
 if __name__ == '__main__':
diff --git a/Lib/test/test_format.py b/Lib/test/test_format.py
index 9653e46..ae0d4f7 100644
--- a/Lib/test/test_format.py
+++ b/Lib/test/test_format.py
@@ -249,7 +249,7 @@
         # base marker shouldn't change the size
         testcommon("%0#35.33o", big, "0o012345670123456701234567012345670")
 
-        # Some small ints, in both Python int and flavors).
+        # Some small ints, in both Python int and flavors.
         testcommon("%d", 42, "42")
         testcommon("%d", -42, "-42")
         testcommon("%d", 42.0, "42")
@@ -275,9 +275,9 @@
         test_exc_common('% %s', 1, ValueError,
                         "unsupported format character '%' (0x25) at index 2")
         test_exc_common('%d', '1', TypeError,
-                        "%d format: a number is required, not str")
+                        "%d format: a real number is required, not str")
         test_exc_common('%d', b'1', TypeError,
-                        "%d format: a number is required, not bytes")
+                        "%d format: a real number is required, not bytes")
         test_exc_common('%x', '1', TypeError,
                         "%x format: an integer is required, not str")
         test_exc_common('%x', 3.14, TypeError,
diff --git a/Lib/test/test_fractions.py b/Lib/test/test_fractions.py
index 0845f79..b925525 100644
--- a/Lib/test/test_fractions.py
+++ b/Lib/test/test_fractions.py
@@ -369,7 +369,9 @@
         self.assertEqual(F(1, 2), F(1, 10) + F(2, 5))
         self.assertEqual(F(-3, 10), F(1, 10) - F(2, 5))
         self.assertEqual(F(1, 25), F(1, 10) * F(2, 5))
+        self.assertEqual(F(5, 6), F(2, 3) * F(5, 4))
         self.assertEqual(F(1, 4), F(1, 10) / F(2, 5))
+        self.assertEqual(F(-15, 8), F(3, 4) / F(-2, 5))
         self.assertTypedEquals(2, F(9, 10) // F(2, 5))
         self.assertTypedEquals(10**23, F(10**23, 1) // F(1))
         self.assertEqual(F(5, 6), F(7, 3) % F(3, 2))
diff --git a/Lib/test/test_frame.py b/Lib/test/test_frame.py
index a8696f0..7ac37b6 100644
--- a/Lib/test/test_frame.py
+++ b/Lib/test/test_frame.py
@@ -1,4 +1,5 @@
 import re
+import sys
 import types
 import unittest
 import weakref
@@ -94,6 +95,26 @@
         f.clear()
         self.assertTrue(endly)
 
+    def test_lineno_with_tracing(self):
+        def record_line():
+            f = sys._getframe(1)
+            lines.append(f.f_lineno-f.f_code.co_firstlineno)
+
+        def test(trace):
+            record_line()
+            if trace:
+                sys._getframe(0).f_trace = True
+            record_line()
+            record_line()
+
+        expected_lines = [1, 4, 5]
+        lines = []
+        test(False)
+        self.assertEqual(lines, expected_lines)
+        lines = []
+        test(True)
+        self.assertEqual(lines, expected_lines)
+
     @support.cpython_only
     def test_clear_refcycles(self):
         # .clear() doesn't leave any refcycle behind
diff --git a/Lib/test/test_fstring.py b/Lib/test/test_fstring.py
index 2ae815a..0c255c2 100644
--- a/Lib/test/test_fstring.py
+++ b/Lib/test/test_fstring.py
@@ -13,7 +13,7 @@
 import types
 import decimal
 import unittest
-from test.support import temp_cwd, use_old_parser
+from test.support.os_helper import temp_cwd
 from test.support.script_helper import assert_python_failure
 
 a_global = 'global variable'
@@ -212,11 +212,6 @@
         self.assertEqual(call.col_offset, 11)
 
     def test_ast_line_numbers_duplicate_expression(self):
-        """Duplicate expression
-
-        NOTE: this is currently broken, always sets location of the first
-        expression.
-        """
         expr = """
 a = 10
 f'{a * x()} {a * x()} {a * x()}'
@@ -266,9 +261,9 @@
         self.assertEqual(binop.lineno, 3)
         self.assertEqual(binop.left.lineno, 3)
         self.assertEqual(binop.right.lineno, 3)
-        self.assertEqual(binop.col_offset, 3)  # FIXME: this is wrong
-        self.assertEqual(binop.left.col_offset, 3)  # FIXME: this is wrong
-        self.assertEqual(binop.right.col_offset, 7)  # FIXME: this is wrong
+        self.assertEqual(binop.col_offset, 13)
+        self.assertEqual(binop.left.col_offset, 13)
+        self.assertEqual(binop.right.col_offset, 17)
         # check the third binop location
         binop = t.body[1].value.values[4].value
         self.assertEqual(type(binop), ast.BinOp)
@@ -278,9 +273,32 @@
         self.assertEqual(binop.lineno, 3)
         self.assertEqual(binop.left.lineno, 3)
         self.assertEqual(binop.right.lineno, 3)
-        self.assertEqual(binop.col_offset, 3)  # FIXME: this is wrong
-        self.assertEqual(binop.left.col_offset, 3)  # FIXME: this is wrong
-        self.assertEqual(binop.right.col_offset, 7)  # FIXME: this is wrong
+        self.assertEqual(binop.col_offset, 23)
+        self.assertEqual(binop.left.col_offset, 23)
+        self.assertEqual(binop.right.col_offset, 27)
+
+    def test_ast_numbers_fstring_with_formatting(self):
+
+        t = ast.parse('f"Here is that pesky {xxx:.3f} again"')
+        self.assertEqual(len(t.body), 1)
+        self.assertEqual(t.body[0].lineno, 1)
+
+        self.assertEqual(type(t.body[0]), ast.Expr)
+        self.assertEqual(type(t.body[0].value), ast.JoinedStr)
+        self.assertEqual(len(t.body[0].value.values), 3)
+
+        self.assertEqual(type(t.body[0].value.values[0]), ast.Constant)
+        self.assertEqual(type(t.body[0].value.values[1]), ast.FormattedValue)
+        self.assertEqual(type(t.body[0].value.values[2]), ast.Constant)
+
+        _, expr, _ = t.body[0].value.values
+
+        name = expr.value
+        self.assertEqual(type(name), ast.Name)
+        self.assertEqual(name.lineno, 1)
+        self.assertEqual(name.end_lineno, 1)
+        self.assertEqual(name.col_offset, 22)
+        self.assertEqual(name.end_col_offset, 25)
 
     def test_ast_line_numbers_multiline_fstring(self):
         # See bpo-30465 for details.
@@ -332,6 +350,59 @@
         self.assertEqual(binop.left.col_offset, 4)
         self.assertEqual(binop.right.col_offset, 7)
 
+    def test_ast_line_numbers_with_parentheses(self):
+        expr = """
+x = (
+    f" {test(t)}"
+)"""
+        t = ast.parse(expr)
+        self.assertEqual(type(t), ast.Module)
+        self.assertEqual(len(t.body), 1)
+        # check the test(t) location
+        call = t.body[0].value.values[1].value
+        self.assertEqual(type(call), ast.Call)
+        self.assertEqual(call.lineno, 3)
+        self.assertEqual(call.end_lineno, 3)
+        self.assertEqual(call.col_offset, 8)
+        self.assertEqual(call.end_col_offset, 15)
+
+        expr = """
+x = (
+        'PERL_MM_OPT', (
+            f'wat'
+            f'some_string={f(x)} '
+            f'wat'
+        ),
+)
+"""
+        t = ast.parse(expr)
+        self.assertEqual(type(t), ast.Module)
+        self.assertEqual(len(t.body), 1)
+        # check the fstring
+        fstring = t.body[0].value.elts[1]
+        self.assertEqual(type(fstring), ast.JoinedStr)
+        self.assertEqual(len(fstring.values), 3)
+        wat1, middle, wat2 = fstring.values
+        # check the first wat
+        self.assertEqual(type(wat1), ast.Constant)
+        self.assertEqual(wat1.lineno, 4)
+        self.assertEqual(wat1.end_lineno, 6)
+        self.assertEqual(wat1.col_offset, 12)
+        self.assertEqual(wat1.end_col_offset, 18)
+        # check the call
+        call = middle.value
+        self.assertEqual(type(call), ast.Call)
+        self.assertEqual(call.lineno, 5)
+        self.assertEqual(call.end_lineno, 5)
+        self.assertEqual(call.col_offset, 27)
+        self.assertEqual(call.end_col_offset, 31)
+        # check the second wat
+        self.assertEqual(type(wat2), ast.Constant)
+        self.assertEqual(wat2.lineno, 4)
+        self.assertEqual(wat2.end_lineno, 6)
+        self.assertEqual(wat2.col_offset, 12)
+        self.assertEqual(wat2.end_col_offset, 18)
+
     def test_docstring(self):
         def f():
             f'''Not a docstring'''
@@ -525,8 +596,7 @@
                              # This looks like a nested format spec.
                              ])
 
-        err_msg = "invalid syntax" if use_old_parser() else "f-string: invalid syntax"
-        self.assertAllRaise(SyntaxError, err_msg,
+        self.assertAllRaise(SyntaxError, "f-string: invalid syntax",
                             [# Invalid syntax inside a nested spec.
                              "f'{4:{/5}}'",
                              ])
@@ -600,8 +670,7 @@
         #  are added around it. But we shouldn't go from an invalid
         #  expression to a valid one. The added parens are just
         #  supposed to allow whitespace (including newlines).
-        err_msg = "invalid syntax" if use_old_parser() else "f-string: invalid syntax"
-        self.assertAllRaise(SyntaxError, err_msg,
+        self.assertAllRaise(SyntaxError, 'f-string: invalid syntax',
                             ["f'{,}'",
                              "f'{,}'",  # this is (,), which is an error
                              ])
@@ -610,9 +679,12 @@
                             ["f'{3)+(4}'",
                              ])
 
-        self.assertAllRaise(SyntaxError, 'EOL while scanning string literal',
+        self.assertAllRaise(SyntaxError, 'unterminated string literal',
                             ["f'{\n}'",
                              ])
+    def test_newlines_before_syntax_error(self):
+        self.assertAllRaise(SyntaxError, "invalid syntax",
+                ["f'{.}'", "\nf'{.}'", "\n\nf'{.}'"])
 
     def test_backslashes_in_string_part(self):
         self.assertEqual(f'\t', '\t')
@@ -674,12 +746,16 @@
         # differently inside f-strings.
         self.assertAllRaise(SyntaxError, r"\(unicode error\) 'unicodeescape' codec can't decode bytes in position .*: malformed \\N character escape",
                             [r"f'\N'",
+                             r"f'\N '",
+                             r"f'\N  '",  # See bpo-46503.
                              r"f'\N{'",
                              r"f'\N{GREEK CAPITAL LETTER DELTA'",
 
                              # Here are the non-f-string versions,
                              #  which should give the same errors.
                              r"'\N'",
+                             r"'\N '",
+                             r"'\N  '",
                              r"'\N{'",
                              r"'\N{GREEK CAPITAL LETTER DELTA'",
                              ])
@@ -719,8 +795,7 @@
 
         # lambda doesn't work without parens, because the colon
         #  makes the parser think it's a format_spec
-        err_msg = "invalid syntax" if use_old_parser() else "f-string: invalid syntax"
-        self.assertAllRaise(SyntaxError, err_msg,
+        self.assertAllRaise(SyntaxError, 'f-string: invalid syntax',
                             ["f'{lambda x:x}'",
                              ])
 
@@ -873,12 +948,7 @@
                              "Bf''",
                              "BF''",]
         double_quote_cases = [case.replace("'", '"') for case in single_quote_cases]
-        error_msg = (
-            'invalid syntax'
-            if use_old_parser()
-            else 'unexpected EOF while parsing'
-        )
-        self.assertAllRaise(SyntaxError, error_msg,
+        self.assertAllRaise(SyntaxError, 'invalid syntax',
                             single_quote_cases + double_quote_cases)
 
     def test_leading_trailing_spaces(self):
@@ -942,7 +1012,7 @@
                              ])
 
     def test_assignment(self):
-        self.assertAllRaise(SyntaxError, 'invalid syntax',
+        self.assertAllRaise(SyntaxError, r'invalid syntax',
                             ["f'' = 3",
                              "f'{0}' = x",
                              "f'{x}' = x",
@@ -983,6 +1053,8 @@
                              "f'{{{'",
                              "f'{{}}{'",
                              "f'{'",
+                             "f'x{<'",  # See bpo-46762.
+                             "f'x{>'",
                              ])
 
         # But these are just normal strings.
@@ -1058,12 +1130,11 @@
                              r"f'{1000:j}'",
                             ])
 
-    @unittest.skipIf(use_old_parser(), "The old parser only supports <fstring> as the filename")
     def test_filename_in_syntaxerror(self):
         # see issue 38964
         with temp_cwd() as cwd:
             file_path = os.path.join(cwd, 't.py')
-            with open(file_path, 'w') as f:
+            with open(file_path, 'w', encoding="utf-8") as f:
                 f.write('f"{a b}"') # This generates a SyntaxError
             _, _, stderr = assert_python_failure(file_path,
                                                  PYTHONIOENCODING='ascii')
@@ -1205,8 +1276,7 @@
         self.assertEqual(x, 10)
 
     def test_invalid_syntax_error_message(self):
-        err_msg = "invalid syntax" if use_old_parser() else "f-string: invalid syntax"
-        with self.assertRaisesRegex(SyntaxError, err_msg):
+        with self.assertRaisesRegex(SyntaxError, "f-string: invalid syntax"):
             compile("f'{a $ b}'", "?", "exec")
 
     def test_with_two_commas_in_format_specifier(self):
@@ -1229,5 +1299,14 @@
         with self.assertRaisesRegex(ValueError, error_msg):
             f'{1:_,}'
 
+    def test_syntax_error_for_starred_expressions(self):
+        error_msg = re.escape("cannot use starred expression here")
+        with self.assertRaisesRegex(SyntaxError, error_msg):
+            compile("f'{*a}'", "?", "exec")
+
+        error_msg = re.escape("cannot use double starred expression here")
+        with self.assertRaisesRegex(SyntaxError, error_msg):
+            compile("f'{**a}'", "?", "exec")
+
 if __name__ == '__main__':
     unittest.main()
diff --git a/Lib/test/test_ftplib.py b/Lib/test/test_ftplib.py
index e424076..2f5cc06 100644
--- a/Lib/test/test_ftplib.py
+++ b/Lib/test/test_ftplib.py
@@ -4,14 +4,13 @@
 # environment
 
 import ftplib
-import asyncore
-import asynchat
 import socket
 import io
 import errno
 import os
 import threading
 import time
+import unittest
 try:
     import ssl
 except ImportError:
@@ -19,9 +18,18 @@
 
 from unittest import TestCase, skipUnless
 from test import support
+from test.support import threading_helper
 from test.support import socket_helper
+from test.support import warnings_helper
 from test.support.socket_helper import HOST, HOSTv6
 
+import warnings
+with warnings.catch_warnings():
+    warnings.simplefilter('ignore', DeprecationWarning)
+    import asyncore
+    import asynchat
+
+
 TIMEOUT = support.LOOPBACK_TIMEOUT
 DEFAULT_ENCODING = 'utf-8'
 # the dummy data returned by server over the data channel when
@@ -48,6 +56,13 @@
              "type=file;perm=r;unique==SGP2; file \xAE non-ascii char\r\n")
 
 
+def default_error_handler():
+    # bpo-44359: Silently ignore socket errors. Such errors occur when a client
+    # socket is closed, in TestFTPClass.tearDown() and makepasv() tests, and
+    # the server gets an error on its side.
+    pass
+
+
 class DummyDTPHandler(asynchat.async_chat):
     dtp_conn_closed = False
 
@@ -79,7 +94,7 @@
         super(DummyDTPHandler, self).push(what.encode(self.encoding))
 
     def handle_error(self):
-        raise Exception
+        default_error_handler()
 
 
 class DummyFTPHandler(asynchat.async_chat):
@@ -101,6 +116,10 @@
         self.next_retr_data = RETR_DATA
         self.push('220 welcome')
         self.encoding = encoding
+        # We use this as the string IPv4 address to direct the client
+        # to in response to a PASV command.  To test security behavior.
+        # https://bugs.python.org/issue43285/.
+        self.fake_pasv_server_ip = '252.253.254.255'
 
     def collect_incoming_data(self, data):
         self.in_buffer.append(data)
@@ -125,7 +144,7 @@
             self.push('550 command "%s" not understood.' %cmd)
 
     def handle_error(self):
-        raise Exception
+        default_error_handler()
 
     def push(self, data):
         asynchat.async_chat.push(self, data.encode(self.encoding) + b'\r\n')
@@ -141,7 +160,8 @@
     def cmd_pasv(self, arg):
         with socket.create_server((self.socket.getsockname()[0], 0)) as sock:
             sock.settimeout(TIMEOUT)
-            ip, port = sock.getsockname()[:2]
+            port = sock.getsockname()[1]
+            ip = self.fake_pasv_server_ip
             ip = ip.replace('.', ','); p1 = port / 256; p2 = port % 256
             self.push('227 entering passive mode (%s,%d,%d)' %(ip, p1, p2))
             conn, addr = sock.accept()
@@ -302,7 +322,7 @@
         return 0
 
     def handle_error(self):
-        raise Exception
+        default_error_handler()
 
 
 if ssl is not None:
@@ -317,7 +337,7 @@
         _ssl_closing = False
 
         def secure_connection(self):
-            context = ssl.SSLContext()
+            context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
             context.load_cert_chain(CERTFILE)
             socket = context.wrap_socket(self.socket,
                                          suppress_ragged_eofs=False,
@@ -405,7 +425,7 @@
                 raise
 
         def handle_error(self):
-            raise Exception
+            default_error_handler()
 
         def close(self):
             if (isinstance(self.socket, ssl.SSLSocket) and
@@ -622,7 +642,7 @@
 
         f = io.StringIO(RETR_DATA.replace('\r\n', '\n'))
         # storlines() expects a binary file, not a text file
-        with support.check_warnings(('', BytesWarning), quiet=True):
+        with warnings_helper.check_warnings(('', BytesWarning), quiet=True):
             self.assertRaises(TypeError, self.client.storlines, 'stor foo', f)
 
     def test_nlst(self):
@@ -705,6 +725,26 @@
         # IPv4 is in use, just make sure send_epsv has not been used
         self.assertEqual(self.server.handler_instance.last_received_cmd, 'pasv')
 
+    def test_makepasv_issue43285_security_disabled(self):
+        """Test the opt-in to the old vulnerable behavior."""
+        self.client.trust_server_pasv_ipv4_address = True
+        bad_host, port = self.client.makepasv()
+        self.assertEqual(
+                bad_host, self.server.handler_instance.fake_pasv_server_ip)
+        # Opening and closing a connection keeps the dummy server happy
+        # instead of timing out on accept.
+        socket.create_connection((self.client.sock.getpeername()[0], port),
+                                 timeout=TIMEOUT).close()
+
+    def test_makepasv_issue43285_security_enabled_default(self):
+        self.assertFalse(self.client.trust_server_pasv_ipv4_address)
+        trusted_host, port = self.client.makepasv()
+        self.assertNotEqual(
+                trusted_host, self.server.handler_instance.fake_pasv_server_ip)
+        # Opening and closing a connection keeps the dummy server happy
+        # instead of timing out on accept.
+        socket.create_connection((trusted_host, port), timeout=TIMEOUT).close()
+
     def test_with_statement(self):
         self.client.quit()
 
@@ -1034,7 +1074,7 @@
         self.evt.set()
         try:
             conn, addr = self.sock.accept()
-        except socket.timeout:
+        except TimeoutError:
             pass
         else:
             conn.sendall(b"1 Hola mundo\n")
@@ -1105,24 +1145,17 @@
 
 class MiscTestCase(TestCase):
     def test__all__(self):
-        blacklist = {'MSG_OOB', 'FTP_PORT', 'MAXLINE', 'CRLF', 'B_CRLF',
-                     'Error', 'parse150', 'parse227', 'parse229', 'parse257',
-                     'print_line', 'ftpcp', 'test'}
-        support.check__all__(self, ftplib, blacklist=blacklist)
+        not_exported = {
+            'MSG_OOB', 'FTP_PORT', 'MAXLINE', 'CRLF', 'B_CRLF', 'Error',
+            'parse150', 'parse227', 'parse229', 'parse257', 'print_line',
+            'ftpcp', 'test'}
+        support.check__all__(self, ftplib, not_exported=not_exported)
 
 
-def test_main():
-    tests = [TestFTPClass, TestTimeouts,
-             TestIPv6Environment,
-             TestTLS_FTPClassMixin, TestTLS_FTPClass,
-             MiscTestCase]
-
-    thread_info = support.threading_setup()
-    try:
-        support.run_unittest(*tests)
-    finally:
-        support.threading_cleanup(*thread_info)
+def setUpModule():
+    thread_info = threading_helper.threading_setup()
+    unittest.addModuleCleanup(threading_helper.threading_cleanup, *thread_info)
 
 
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_funcattrs.py b/Lib/test/test_funcattrs.py
index 11d68cc..77977d0 100644
--- a/Lib/test/test_funcattrs.py
+++ b/Lib/test/test_funcattrs.py
@@ -1,3 +1,4 @@
+import textwrap
 import types
 import unittest
 
@@ -73,6 +74,37 @@
         self.cannot_set_attr(self.b, '__globals__', 2,
                              (AttributeError, TypeError))
 
+    def test___builtins__(self):
+        self.assertIs(self.b.__builtins__, __builtins__)
+        self.cannot_set_attr(self.b, '__builtins__', 2,
+                             (AttributeError, TypeError))
+
+        # bpo-42990: If globals is specified and has no "__builtins__" key,
+        # a function inherits the current builtins namespace.
+        def func(s): return len(s)
+        ns = {}
+        func2 = type(func)(func.__code__, ns)
+        self.assertIs(func2.__globals__, ns)
+        self.assertIs(func2.__builtins__, __builtins__)
+
+        # Make sure that the function actually works.
+        self.assertEqual(func2("abc"), 3)
+        self.assertEqual(ns, {})
+
+        # Define functions using exec() with different builtins,
+        # and test inheritance when globals has no "__builtins__" key
+        code = textwrap.dedent("""
+            def func3(s): pass
+            func4 = type(func3)(func3.__code__, {})
+        """)
+        safe_builtins = {'None': None}
+        ns = {'type': type, '__builtins__': safe_builtins}
+        exec(code, ns)
+        self.assertIs(ns['func3'].__builtins__, safe_builtins)
+        self.assertIs(ns['func4'].__builtins__, safe_builtins)
+        self.assertIs(ns['func3'].__globals__['__builtins__'], safe_builtins)
+        self.assertNotIn('__builtins__', ns['func4'].__globals__)
+
     def test___closure__(self):
         a = 12
         def f(): print(a)
diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py
index 11e8aa3..9343d4e 100644
--- a/Lib/test/test_functools.py
+++ b/Lib/test/test_functools.py
@@ -19,14 +19,17 @@
 from weakref import proxy
 import contextlib
 
+from test.support import import_helper
+from test.support import threading_helper
 from test.support.script_helper import assert_python_ok
 
 import functools
 
-py_functools = support.import_fresh_module('functools', blocked=['_functools'])
-c_functools = support.import_fresh_module('functools', fresh=['_functools'])
+py_functools = import_helper.import_fresh_module('functools',
+                                                 blocked=['_functools'])
+c_functools = import_helper.import_fresh_module('functools')
 
-decimal = support.import_fresh_module('decimal', fresh=['_decimal'])
+decimal = import_helper.import_fresh_module('decimal', fresh=['_decimal'])
 
 @contextlib.contextmanager
 def replaced_module(name, replacement):
@@ -164,6 +167,7 @@
         p = proxy(f)
         self.assertEqual(f.func, p.func)
         f = None
+        support.gc_collect()  # For PyPy or other GCs.
         self.assertRaises(ReferenceError, getattr, p, 'func')
 
     def test_with_bound_and_unbound_methods(self):
@@ -945,6 +949,13 @@
     if c_functools:
         cmp_to_key = c_functools.cmp_to_key
 
+    @support.cpython_only
+    def test_disallow_instantiation(self):
+        # Ensure that the type disallows instantiation (bpo-43916)
+        support.check_disallow_instantiation(
+            self, type(c_functools.cmp_to_key(None))
+        )
+
 
 class TestCmpToKeyPy(TestCmpToKey, unittest.TestCase):
     cmp_to_key = staticmethod(py_functools.cmp_to_key)
@@ -1153,6 +1164,34 @@
                     method_copy = pickle.loads(pickle.dumps(method, proto))
                     self.assertIs(method_copy, method)
 
+
+    def test_total_ordering_for_metaclasses_issue_44605(self):
+
+        @functools.total_ordering
+        class SortableMeta(type):
+            def __new__(cls, name, bases, ns):
+                return super().__new__(cls, name, bases, ns)
+
+            def __lt__(self, other):
+                if not isinstance(other, SortableMeta):
+                    pass
+                return self.__name__ < other.__name__
+
+            def __eq__(self, other):
+                if not isinstance(other, SortableMeta):
+                    pass
+                return self.__name__ == other.__name__
+
+        class B(metaclass=SortableMeta):
+            pass
+
+        class A(metaclass=SortableMeta):
+            pass
+
+        self.assertTrue(A < B)
+        self.assertFalse(A > B)
+
+
 @functools.total_ordering
 class Orderable_LT:
     def __init__(self, value):
@@ -1529,7 +1568,7 @@
             # create n threads in order to fill cache
             threads = [threading.Thread(target=full, args=[k])
                        for k in range(n)]
-            with support.start_threads(threads):
+            with threading_helper.start_threads(threads):
                 start.set()
 
             hits, misses, maxsize, currsize = f.cache_info()
@@ -1547,7 +1586,7 @@
             threads += [threading.Thread(target=full, args=[k])
                         for k in range(n)]
             start.clear()
-            with support.start_threads(threads):
+            with threading_helper.start_threads(threads):
                 start.set()
         finally:
             sys.setswitchinterval(orig_si)
@@ -1569,7 +1608,7 @@
                 self.assertEqual(f(i), 3 * i)
                 stop.wait(10)
         threads = [threading.Thread(target=test) for k in range(n)]
-        with support.start_threads(threads):
+        with threading_helper.start_threads(threads):
             for i in range(m):
                 start.wait(10)
                 stop.reset()
@@ -1589,7 +1628,7 @@
                 self.assertEqual(f(x), 3 * x, i)
         threads = [threading.Thread(target=test, args=(i, v))
                    for i, v in enumerate([1, 2, 2, 3, 2])]
-        with support.start_threads(threads):
+        with threading_helper.start_threads(threads):
             pass
 
     def test_need_for_rlock(self):
@@ -2372,7 +2411,7 @@
         self.assertEqual(A.t(0.0).arg, "base")
 
     def test_abstractmethod_register(self):
-        class Abstract(abc.ABCMeta):
+        class Abstract(metaclass=abc.ABCMeta):
 
             @functools.singledispatchmethod
             @abc.abstractmethod
@@ -2380,6 +2419,10 @@
                 pass
 
         self.assertTrue(Abstract.add.__isabstractmethod__)
+        self.assertTrue(Abstract.__dict__['add'].__isabstractmethod__)
+
+        with self.assertRaises(TypeError):
+            Abstract()
 
     def test_type_ann_register(self):
         class A:
@@ -2398,6 +2441,183 @@
         self.assertEqual(a.t(''), "str")
         self.assertEqual(a.t(0.0), "base")
 
+    def test_staticmethod_type_ann_register(self):
+        class A:
+            @functools.singledispatchmethod
+            @staticmethod
+            def t(arg):
+                return arg
+            @t.register
+            @staticmethod
+            def _(arg: int):
+                return isinstance(arg, int)
+            @t.register
+            @staticmethod
+            def _(arg: str):
+                return isinstance(arg, str)
+        a = A()
+
+        self.assertTrue(A.t(0))
+        self.assertTrue(A.t(''))
+        self.assertEqual(A.t(0.0), 0.0)
+
+    def test_classmethod_type_ann_register(self):
+        class A:
+            def __init__(self, arg):
+                self.arg = arg
+
+            @functools.singledispatchmethod
+            @classmethod
+            def t(cls, arg):
+                return cls("base")
+            @t.register
+            @classmethod
+            def _(cls, arg: int):
+                return cls("int")
+            @t.register
+            @classmethod
+            def _(cls, arg: str):
+                return cls("str")
+
+        self.assertEqual(A.t(0).arg, "int")
+        self.assertEqual(A.t('').arg, "str")
+        self.assertEqual(A.t(0.0).arg, "base")
+
+    def test_method_wrapping_attributes(self):
+        class A:
+            @functools.singledispatchmethod
+            def func(self, arg: int) -> str:
+                """My function docstring"""
+                return str(arg)
+            @functools.singledispatchmethod
+            @classmethod
+            def cls_func(cls, arg: int) -> str:
+                """My function docstring"""
+                return str(arg)
+            @functools.singledispatchmethod
+            @staticmethod
+            def static_func(arg: int) -> str:
+                """My function docstring"""
+                return str(arg)
+
+        for meth in (
+            A.func,
+            A().func,
+            A.cls_func,
+            A().cls_func,
+            A.static_func,
+            A().static_func
+        ):
+            with self.subTest(meth=meth):
+                self.assertEqual(meth.__doc__, 'My function docstring')
+                self.assertEqual(meth.__annotations__['arg'], int)
+
+        self.assertEqual(A.func.__name__, 'func')
+        self.assertEqual(A().func.__name__, 'func')
+        self.assertEqual(A.cls_func.__name__, 'cls_func')
+        self.assertEqual(A().cls_func.__name__, 'cls_func')
+        self.assertEqual(A.static_func.__name__, 'static_func')
+        self.assertEqual(A().static_func.__name__, 'static_func')
+
+    def test_double_wrapped_methods(self):
+        def classmethod_friendly_decorator(func):
+            wrapped = func.__func__
+            @classmethod
+            @functools.wraps(wrapped)
+            def wrapper(*args, **kwargs):
+                return wrapped(*args, **kwargs)
+            return wrapper
+
+        class WithoutSingleDispatch:
+            @classmethod
+            @contextlib.contextmanager
+            def cls_context_manager(cls, arg: int) -> str:
+                try:
+                    yield str(arg)
+                finally:
+                    return 'Done'
+
+            @classmethod_friendly_decorator
+            @classmethod
+            def decorated_classmethod(cls, arg: int) -> str:
+                return str(arg)
+
+        class WithSingleDispatch:
+            @functools.singledispatchmethod
+            @classmethod
+            @contextlib.contextmanager
+            def cls_context_manager(cls, arg: int) -> str:
+                """My function docstring"""
+                try:
+                    yield str(arg)
+                finally:
+                    return 'Done'
+
+            @functools.singledispatchmethod
+            @classmethod_friendly_decorator
+            @classmethod
+            def decorated_classmethod(cls, arg: int) -> str:
+                """My function docstring"""
+                return str(arg)
+
+        # These are sanity checks
+        # to test the test itself is working as expected
+        with WithoutSingleDispatch.cls_context_manager(5) as foo:
+            without_single_dispatch_foo = foo
+
+        with WithSingleDispatch.cls_context_manager(5) as foo:
+            single_dispatch_foo = foo
+
+        self.assertEqual(without_single_dispatch_foo, single_dispatch_foo)
+        self.assertEqual(single_dispatch_foo, '5')
+
+        self.assertEqual(
+            WithoutSingleDispatch.decorated_classmethod(5),
+            WithSingleDispatch.decorated_classmethod(5)
+        )
+
+        self.assertEqual(WithSingleDispatch.decorated_classmethod(5), '5')
+
+        # Behavioural checks now follow
+        for method_name in ('cls_context_manager', 'decorated_classmethod'):
+            with self.subTest(method=method_name):
+                self.assertEqual(
+                    getattr(WithSingleDispatch, method_name).__name__,
+                    getattr(WithoutSingleDispatch, method_name).__name__
+                )
+
+                self.assertEqual(
+                    getattr(WithSingleDispatch(), method_name).__name__,
+                    getattr(WithoutSingleDispatch(), method_name).__name__
+                )
+
+        for meth in (
+            WithSingleDispatch.cls_context_manager,
+            WithSingleDispatch().cls_context_manager,
+            WithSingleDispatch.decorated_classmethod,
+            WithSingleDispatch().decorated_classmethod
+        ):
+            with self.subTest(meth=meth):
+                self.assertEqual(meth.__doc__, 'My function docstring')
+                self.assertEqual(meth.__annotations__['arg'], int)
+
+        self.assertEqual(
+            WithSingleDispatch.cls_context_manager.__name__,
+            'cls_context_manager'
+        )
+        self.assertEqual(
+            WithSingleDispatch().cls_context_manager.__name__,
+            'cls_context_manager'
+        )
+        self.assertEqual(
+            WithSingleDispatch.decorated_classmethod.__name__,
+            'decorated_classmethod'
+        )
+        self.assertEqual(
+            WithSingleDispatch().decorated_classmethod.__name__,
+            'decorated_classmethod'
+        )
+
     def test_invalid_registrations(self):
         msg_prefix = "Invalid first argument to `register()`: "
         msg_suffix = (
@@ -2445,6 +2665,74 @@
         with self.assertRaisesRegex(TypeError, msg):
             f()
 
+    def test_register_genericalias(self):
+        @functools.singledispatch
+        def f(arg):
+            return "default"
+
+        with self.assertRaisesRegex(TypeError, "Invalid first argument to "):
+            f.register(list[int], lambda arg: "types.GenericAlias")
+        with self.assertRaisesRegex(TypeError, "Invalid first argument to "):
+            f.register(typing.List[int], lambda arg: "typing.GenericAlias")
+        with self.assertRaisesRegex(TypeError, "Invalid first argument to "):
+            f.register(list[int] | str, lambda arg: "types.UnionTypes(types.GenericAlias)")
+        with self.assertRaisesRegex(TypeError, "Invalid first argument to "):
+            f.register(typing.List[float] | bytes, lambda arg: "typing.Union[typing.GenericAlias]")
+        with self.assertRaisesRegex(TypeError, "Invalid first argument to "):
+            f.register(typing.Any, lambda arg: "typing.Any")
+
+        self.assertEqual(f([1]), "default")
+        self.assertEqual(f([1.0]), "default")
+        self.assertEqual(f(""), "default")
+        self.assertEqual(f(b""), "default")
+
+    def test_register_genericalias_decorator(self):
+        @functools.singledispatch
+        def f(arg):
+            return "default"
+
+        with self.assertRaisesRegex(TypeError, "Invalid first argument to "):
+            f.register(list[int])
+        with self.assertRaisesRegex(TypeError, "Invalid first argument to "):
+            f.register(typing.List[int])
+        with self.assertRaisesRegex(TypeError, "Invalid first argument to "):
+            f.register(list[int] | str)
+        with self.assertRaisesRegex(TypeError, "Invalid first argument to "):
+            f.register(typing.List[int] | str)
+        with self.assertRaisesRegex(TypeError, "Invalid first argument to "):
+            f.register(typing.Any)
+
+    def test_register_genericalias_annotation(self):
+        @functools.singledispatch
+        def f(arg):
+            return "default"
+
+        with self.assertRaisesRegex(TypeError, "Invalid annotation for 'arg'"):
+            @f.register
+            def _(arg: list[int]):
+                return "types.GenericAlias"
+        with self.assertRaisesRegex(TypeError, "Invalid annotation for 'arg'"):
+            @f.register
+            def _(arg: typing.List[float]):
+                return "typing.GenericAlias"
+        with self.assertRaisesRegex(TypeError, "Invalid annotation for 'arg'"):
+            @f.register
+            def _(arg: list[int] | str):
+                return "types.UnionType(types.GenericAlias)"
+        with self.assertRaisesRegex(TypeError, "Invalid annotation for 'arg'"):
+            @f.register
+            def _(arg: typing.List[float] | bytes):
+                return "typing.Union[typing.GenericAlias]"
+        with self.assertRaisesRegex(TypeError, "Invalid annotation for 'arg'"):
+            @f.register
+            def _(arg: typing.Any):
+                return "typing.Any"
+
+        self.assertEqual(f([1]), "default")
+        self.assertEqual(f([1.0]), "default")
+        self.assertEqual(f(""), "default")
+        self.assertEqual(f(b""), "default")
+
 
 class CachedCostItem:
     _cost = 1
@@ -2523,7 +2811,7 @@
                 threading.Thread(target=lambda: item.cost)
                 for k in range(num_threads)
             ]
-            with support.start_threads(threads):
+            with threading_helper.start_threads(threads):
                 go.set()
         finally:
             sys.setswitchinterval(orig_si)
diff --git a/Lib/test/test_future.py b/Lib/test/test_future.py
index 0f40357..5a3944e 100644
--- a/Lib/test/test_future.py
+++ b/Lib/test/test_future.py
@@ -4,6 +4,7 @@
 import ast
 import unittest
 from test import support
+from test.support import import_helper
 from textwrap import dedent
 import os
 import re
@@ -24,17 +25,17 @@
         self.assertEqual(err.offset, offset)
 
     def test_future1(self):
-        with support.CleanImport('future_test1'):
+        with import_helper.CleanImport('future_test1'):
             from test import future_test1
             self.assertEqual(future_test1.result, 6)
 
     def test_future2(self):
-        with support.CleanImport('future_test2'):
+        with import_helper.CleanImport('future_test2'):
             from test import future_test2
             self.assertEqual(future_test2.result, 6)
 
     def test_future3(self):
-        with support.CleanImport('test_future3'):
+        with import_helper.CleanImport('test_future3'):
             from test import test_future3
 
     def test_badfuture3(self):
@@ -113,7 +114,7 @@
             self.fail("syntax error didn't occur")
 
     def test_multiple_features(self):
-        with support.CleanImport("test.test_future5"):
+        with import_helper.CleanImport("test.test_future5"):
             from test import test_future5
 
     def test_unicode_literals_exec(self):
@@ -133,8 +134,12 @@
             ...
         async def g2(arg: {ann}) -> None:
             ...
+        class H:
+            var: {ann}
+            object.attr: {ann}
         var: {ann}
         var2: {ann} = None
+        object.attr: {ann}
         """
     )
 
@@ -166,6 +171,14 @@
 
         self.assertEqual(actual, expected)
 
+    def _exec_future(self, code):
+        scope = {}
+        exec(
+            "from __future__ import annotations\n"
+            + code, {}, scope
+        )
+        return scope
+
     def test_annotations(self):
         eq = self.assertAnnotationEqual
         eq('...')
@@ -305,10 +318,6 @@
         eq("f'{x}'")
         eq("f'{x!r}'")
         eq("f'{x!a}'")
-        eq('(yield from outside_of_generator)')
-        eq('(yield)')
-        eq('(yield a + b)')
-        eq('await some.complicated[0].call(with_args=True or 1 is not 1)')
         eq('[x for x in (a if b else c)]')
         eq('[x for x in a if (b if c else d)]')
         eq('f(x for x in a)')
@@ -316,13 +325,11 @@
         eq('f((x for x in a), 2)')
         eq('(((a)))', 'a')
         eq('(((a, b)))', '(a, b)')
-        eq("(x := 10)")
-        eq("f'{(x := 10):=10}'")
         eq("1 + 2 + 3")
 
     def test_fstring_debug_annotations(self):
         # f-strings with '=' don't round trip very well, so set the expected
-        # result explicitely.
+        # result explicitly.
         self.assertAnnotationEqual("f'{x=!r}'", expected="f'x={x!r}'")
         self.assertAnnotationEqual("f'{x=:}'", expected="f'x={x:}'")
         self.assertAnnotationEqual("f'{x=:.2f}'", expected="f'x={x:.2f}'")
@@ -342,6 +349,60 @@
         self.assertAnnotationEqual("('inf', 1e1000, 'infxxx', 1e1000j)", expected=f"('inf', {inf}, 'infxxx', {infj})")
         self.assertAnnotationEqual("(1e1000, (1e1000j,))", expected=f"({inf}, ({infj},))")
 
+    def test_annotation_with_complex_target(self):
+        with self.assertRaises(SyntaxError):
+            exec(
+                "from __future__ import annotations\n"
+                "object.__debug__: int"
+            )
+
+    def test_annotations_symbol_table_pass(self):
+        namespace = self._exec_future(dedent("""
+        from __future__ import annotations
+
+        def foo():
+            outer = 1
+            def bar():
+                inner: outer = 1
+            return bar
+        """))
+
+        foo = namespace.pop("foo")
+        self.assertIsNone(foo().__closure__)
+        self.assertEqual(foo.__code__.co_cellvars, ())
+        self.assertEqual(foo().__code__.co_freevars, ())
+
+    def test_annotations_forbidden(self):
+        with self.assertRaises(SyntaxError):
+            self._exec_future("test: (yield)")
+
+        with self.assertRaises(SyntaxError):
+            self._exec_future("test.test: (yield a + b)")
+
+        with self.assertRaises(SyntaxError):
+            self._exec_future("test[something]: (yield from x)")
+
+        with self.assertRaises(SyntaxError):
+            self._exec_future("def func(test: (yield from outside_of_generator)): pass")
+
+        with self.assertRaises(SyntaxError):
+            self._exec_future("def test() -> (await y): pass")
+
+        with self.assertRaises(SyntaxError):
+            self._exec_future("async def test() -> something((a := b)): pass")
+
+        with self.assertRaises(SyntaxError):
+            self._exec_future("test: await some.complicated[0].call(with_args=True or 1 is not 1)")
+
+        with self.assertRaises(SyntaxError):
+            self._exec_future("test: f'{(x := 10):=10}'")
+
+        with self.assertRaises(SyntaxError):
+            self._exec_future(dedent("""\
+            def foo():
+                def bar(arg: (yield)): pass
+            """))
+
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/Lib/test/test_gc.py b/Lib/test/test_gc.py
index 38c9cb7..6c28b2b 100644
--- a/Lib/test/test_gc.py
+++ b/Lib/test/test_gc.py
@@ -1,10 +1,11 @@
 import unittest
 import unittest.mock
-from test.support import (verbose, refcount_test, run_unittest,
-                          cpython_only, start_threads,
-                          temp_dir, TESTFN, unlink,
-                          import_module)
+from test.support import (verbose, refcount_test,
+                          cpython_only)
+from test.support.import_helper import import_module
+from test.support.os_helper import temp_dir, TESTFN, unlink
 from test.support.script_helper import assert_python_ok, make_script
+from test.support import threading_helper
 
 import gc
 import sys
@@ -415,7 +416,7 @@
             for i in range(N_THREADS):
                 t = threading.Thread(target=run_thread)
                 threads.append(t)
-            with start_threads(threads, lambda: exit.append(1)):
+            with threading_helper.start_threads(threads, lambda: exit.append(1)):
                 time.sleep(1.0)
         finally:
             sys.setswitchinterval(old_switchinterval)
@@ -749,7 +750,7 @@
             a.link = a
             raise SystemExit(0)"""
         self.addCleanup(unlink, TESTFN)
-        with open(TESTFN, 'w') as script:
+        with open(TESTFN, 'w', encoding="utf-8") as script:
             script.write(code)
         rc, out, err = assert_python_ok(TESTFN)
         self.assertEqual(out.strip(), b'__del__ called')
@@ -1360,26 +1361,55 @@
             # empty __dict__.
             self.assertEqual(x, None)
 
-def test_main():
+
+class PythonFinalizationTests(unittest.TestCase):
+    def test_ast_fini(self):
+        # bpo-44184: Regression test for subtype_dealloc() when deallocating
+        # an AST instance also destroy its AST type: subtype_dealloc() must
+        # not access the type memory after deallocating the instance, since
+        # the type memory can be freed as well. The test is also related to
+        # _PyAST_Fini() which clears references to AST types.
+        code = textwrap.dedent("""
+            import ast
+            import codecs
+
+            # Small AST tree to keep their AST types alive
+            tree = ast.parse("def f(x, y): return 2*x-y")
+            x = [tree]
+            x.append(x)
+
+            # Put the cycle somewhere to survive until the last GC collection.
+            # Codec search functions are only cleared at the end of
+            # interpreter_clear().
+            def search_func(encoding):
+                return None
+            search_func.a = x
+            codecs.register(search_func)
+        """)
+        assert_python_ok("-c", code)
+
+
+def setUpModule():
+    global enabled, debug
     enabled = gc.isenabled()
     gc.disable()
     assert not gc.isenabled()
     debug = gc.get_debug()
     gc.set_debug(debug & ~gc.DEBUG_LEAK) # this test is supposed to leak
+    gc.collect() # Delete 2nd generation garbage
 
-    try:
-        gc.collect() # Delete 2nd generation garbage
-        run_unittest(GCTests, GCTogglingTests, GCCallbackTests)
-    finally:
-        gc.set_debug(debug)
-        # test gc.enable() even if GC is disabled by default
-        if verbose:
-            print("restoring automatic collection")
-        # make sure to always test gc.enable()
-        gc.enable()
-        assert gc.isenabled()
-        if not enabled:
-            gc.disable()
+
+def tearDownModule():
+    gc.set_debug(debug)
+    # test gc.enable() even if GC is disabled by default
+    if verbose:
+        print("restoring automatic collection")
+    # make sure to always test gc.enable()
+    gc.enable()
+    assert gc.isenabled()
+    if not enabled:
+        gc.disable()
+
 
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py
index 22c75ba..5f55489 100644
--- a/Lib/test/test_gdb.py
+++ b/Lib/test/test_gdb.py
@@ -145,7 +145,8 @@
     def get_stack_trace(self, source=None, script=None,
                         breakpoint=BREAKPOINT_FN,
                         cmds_after_breakpoint=None,
-                        import_site=False):
+                        import_site=False,
+                        ignore_stderr=False):
         '''
         Run 'python -c SOURCE' under gdb with a breakpoint.
 
@@ -224,8 +225,9 @@
         # Use "args" to invoke gdb, capturing stdout, stderr:
         out, err = run_gdb(*args, PYTHONHASHSEED=PYTHONHASHSEED)
 
-        for line in err.splitlines():
-            print(line, file=sys.stderr)
+        if not ignore_stderr:
+            for line in err.splitlines():
+                print(line, file=sys.stderr)
 
         # bpo-34007: Sometimes some versions of the shared libraries that
         # are part of the traceback are compiled in optimised mode and the
@@ -908,6 +910,9 @@
                         cmd,
                         breakpoint=func_name,
                         cmds_after_breakpoint=['bt', 'py-bt'],
+                        # bpo-45207: Ignore 'Function "meth_varargs" not
+                        # defined.' message in stderr.
+                        ignore_stderr=True,
                     )
                     self.assertIn(f'<built-in method {func_name}', gdb_output)
 
@@ -916,6 +921,9 @@
                         cmd,
                         breakpoint=func_name,
                         cmds_after_breakpoint=['py-bt-full'],
+                        # bpo-45207: Ignore 'Function "meth_varargs" not
+                        # defined.' message in stderr.
+                        ignore_stderr=True,
                     )
                     self.assertIn(
                         f'#{expected_frame} <built-in method {func_name}',
diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py
index 3bf1522..3bf5f3b 100644
--- a/Lib/test/test_generators.py
+++ b/Lib/test/test_generators.py
@@ -161,6 +161,14 @@
             with self.assertRaises((TypeError, pickle.PicklingError)):
                 pickle.dumps(g, proto)
 
+    def test_send_non_none_to_new_gen(self):
+        def f():
+            yield 1
+        g = f()
+        with self.assertRaises(TypeError):
+            g.send(0)
+        self.assertEqual(next(g), 1)
+
 
 class ExceptionTest(unittest.TestCase):
     # Tests for the issue #23353: check that the currently handled exception
@@ -270,6 +278,32 @@
         self.assertEqual(next(g), "done")
         self.assertEqual(sys.exc_info(), (None, None, None))
 
+    def test_except_throw_bad_exception(self):
+        class E(Exception):
+            def __new__(cls, *args, **kwargs):
+                return cls
+
+        def boring_generator():
+            yield
+
+        gen = boring_generator()
+
+        err_msg = 'should have returned an instance of BaseException'
+
+        with self.assertRaisesRegex(TypeError, err_msg):
+            gen.throw(E)
+
+        self.assertRaises(StopIteration, next, gen)
+
+        def generator():
+            with self.assertRaisesRegex(TypeError, err_msg):
+                yield
+
+        gen = generator()
+        next(gen)
+        with self.assertRaises(StopIteration):
+            gen.throw(E)
+
     def test_stopiteration_error(self):
         # See also PEP 479.
 
@@ -881,7 +915,7 @@
 >>> i.gi_running = 42
 Traceback (most recent call last):
   ...
-AttributeError: readonly attribute
+AttributeError: attribute 'gi_running' of 'generator' objects is not writable
 >>> def g():
 ...     yield me.gi_running
 >>> me = g()
@@ -1940,6 +1974,8 @@
 """
 
 coroutine_tests = """\
+>>> from test.support import gc_collect
+
 Sending a value into a started generator:
 
 >>> def f():
@@ -2013,7 +2049,7 @@
 >>> def f(): (yield bar) = y
 Traceback (most recent call last):
   ...
-SyntaxError: cannot assign to yield expression
+SyntaxError: cannot assign to yield expression here. Maybe you meant '==' instead of '='?
 
 >>> def f(): (yield bar) += y
 Traceback (most recent call last):
@@ -2163,7 +2199,7 @@
 
 >>> g = f()
 >>> next(g)
->>> del g
+>>> del g; gc_collect()  # For PyPy or other GCs.
 exiting
 
 
@@ -2178,7 +2214,7 @@
 
 >>> g = f()
 >>> next(g)
->>> del g
+>>> del g; gc_collect()  # For PyPy or other GCs.
 finally
 
 
diff --git a/Lib/test/test_genericalias.py b/Lib/test/test_genericalias.py
index c113e53..0daaff0 100644
--- a/Lib/test/test_genericalias.py
+++ b/Lib/test/test_genericalias.py
@@ -2,6 +2,7 @@
 
 import unittest
 import pickle
+import copy
 from collections import (
     defaultdict, deque, OrderedDict, Counter, UserDict, UserList
 )
@@ -62,7 +63,6 @@
                      Iterable, Iterator,
                      Reversible,
                      Container, Collection,
-                     Callable,
                      Mailbox, _PartialFile,
                      ContextVar, Token,
                      Field,
@@ -271,11 +271,30 @@
 
     def test_pickle(self):
         alias = GenericAlias(list, T)
-        s = pickle.dumps(alias)
-        loaded = pickle.loads(s)
-        self.assertEqual(alias.__origin__, loaded.__origin__)
-        self.assertEqual(alias.__args__, loaded.__args__)
-        self.assertEqual(alias.__parameters__, loaded.__parameters__)
+        for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+            s = pickle.dumps(alias, proto)
+            loaded = pickle.loads(s)
+            self.assertEqual(loaded.__origin__, alias.__origin__)
+            self.assertEqual(loaded.__args__, alias.__args__)
+            self.assertEqual(loaded.__parameters__, alias.__parameters__)
+
+    def test_copy(self):
+        class X(list):
+            def __copy__(self):
+                return self
+            def __deepcopy__(self, memo):
+                return self
+
+        for origin in list, deque, X:
+            alias = GenericAlias(origin, T)
+            copied = copy.copy(alias)
+            self.assertEqual(copied.__origin__, alias.__origin__)
+            self.assertEqual(copied.__args__, alias.__args__)
+            self.assertEqual(copied.__parameters__, alias.__parameters__)
+            copied = copy.deepcopy(alias)
+            self.assertEqual(copied.__origin__, alias.__origin__)
+            self.assertEqual(copied.__args__, alias.__args__)
+            self.assertEqual(copied.__parameters__, alias.__parameters__)
 
     def test_union(self):
         a = typing.Union[list[int], list[str]]
@@ -307,6 +326,17 @@
         with self.assertRaises(TypeError):
             GenericAlias(bad=float)
 
+    def test_subclassing_types_genericalias(self):
+        class SubClass(GenericAlias): ...
+        alias = SubClass(list, int)
+        class Bad(GenericAlias):
+            def __new__(cls, *args, **kwargs):
+                super().__new__(cls, *args, **kwargs)
+
+        self.assertEqual(alias, list[int])
+        with self.assertRaises(TypeError):
+            Bad(list, int, bad=int)
+
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/Lib/test/test_genericpath.py b/Lib/test/test_genericpath.py
index e7acbcd..1ff7f75 100644
--- a/Lib/test/test_genericpath.py
+++ b/Lib/test/test_genericpath.py
@@ -7,9 +7,10 @@
 import sys
 import unittest
 import warnings
-from test import support
+from test.support import os_helper
+from test.support import warnings_helper
 from test.support.script_helper import assert_python_ok
-from test.support import FakePath
+from test.support.os_helper import FakePath
 
 
 def create_file(filename, data=b'foo'):
@@ -97,8 +98,8 @@
                     self.assertNotEqual(s1[n:n+1], s2[n:n+1])
 
     def test_getsize(self):
-        filename = support.TESTFN
-        self.addCleanup(support.unlink, filename)
+        filename = os_helper.TESTFN
+        self.addCleanup(os_helper.unlink, filename)
 
         create_file(filename, b'Hello')
         self.assertEqual(self.pathmodule.getsize(filename), 5)
@@ -108,8 +109,8 @@
         self.assertEqual(self.pathmodule.getsize(filename), 12)
 
     def test_filetime(self):
-        filename = support.TESTFN
-        self.addCleanup(support.unlink, filename)
+        filename = os_helper.TESTFN
+        self.addCleanup(os_helper.unlink, filename)
 
         create_file(filename, b'foo')
 
@@ -126,9 +127,9 @@
         )
 
     def test_exists(self):
-        filename = support.TESTFN
+        filename = os_helper.TESTFN
         bfilename = os.fsencode(filename)
-        self.addCleanup(support.unlink, filename)
+        self.addCleanup(os_helper.unlink, filename)
 
         self.assertIs(self.pathmodule.exists(filename), False)
         self.assertIs(self.pathmodule.exists(bfilename), False)
@@ -163,7 +164,7 @@
         self.assertFalse(self.pathmodule.exists(r))
 
     def test_isdir(self):
-        filename = support.TESTFN
+        filename = os_helper.TESTFN
         bfilename = os.fsencode(filename)
         self.assertIs(self.pathmodule.isdir(filename), False)
         self.assertIs(self.pathmodule.isdir(bfilename), False)
@@ -178,17 +179,17 @@
             self.assertIs(self.pathmodule.isdir(filename), False)
             self.assertIs(self.pathmodule.isdir(bfilename), False)
         finally:
-            support.unlink(filename)
+            os_helper.unlink(filename)
 
         try:
             os.mkdir(filename)
             self.assertIs(self.pathmodule.isdir(filename), True)
             self.assertIs(self.pathmodule.isdir(bfilename), True)
         finally:
-            support.rmdir(filename)
+            os_helper.rmdir(filename)
 
     def test_isfile(self):
-        filename = support.TESTFN
+        filename = os_helper.TESTFN
         bfilename = os.fsencode(filename)
         self.assertIs(self.pathmodule.isfile(filename), False)
         self.assertIs(self.pathmodule.isfile(bfilename), False)
@@ -203,20 +204,20 @@
             self.assertIs(self.pathmodule.isfile(filename), True)
             self.assertIs(self.pathmodule.isfile(bfilename), True)
         finally:
-            support.unlink(filename)
+            os_helper.unlink(filename)
 
         try:
             os.mkdir(filename)
             self.assertIs(self.pathmodule.isfile(filename), False)
             self.assertIs(self.pathmodule.isfile(bfilename), False)
         finally:
-            support.rmdir(filename)
+            os_helper.rmdir(filename)
 
     def test_samefile(self):
-        file1 = support.TESTFN
-        file2 = support.TESTFN + "2"
-        self.addCleanup(support.unlink, file1)
-        self.addCleanup(support.unlink, file2)
+        file1 = os_helper.TESTFN
+        file2 = os_helper.TESTFN + "2"
+        self.addCleanup(os_helper.unlink, file1)
+        self.addCleanup(os_helper.unlink, file2)
 
         create_file(file1)
         self.assertTrue(self.pathmodule.samefile(file1, file1))
@@ -227,10 +228,10 @@
         self.assertRaises(TypeError, self.pathmodule.samefile)
 
     def _test_samefile_on_link_func(self, func):
-        test_fn1 = support.TESTFN
-        test_fn2 = support.TESTFN + "2"
-        self.addCleanup(support.unlink, test_fn1)
-        self.addCleanup(support.unlink, test_fn2)
+        test_fn1 = os_helper.TESTFN
+        test_fn2 = os_helper.TESTFN + "2"
+        self.addCleanup(os_helper.unlink, test_fn1)
+        self.addCleanup(os_helper.unlink, test_fn2)
 
         create_file(test_fn1)
 
@@ -241,7 +242,7 @@
         create_file(test_fn2)
         self.assertFalse(self.pathmodule.samefile(test_fn1, test_fn2))
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_samefile_on_symlink(self):
         self._test_samefile_on_link_func(os.symlink)
 
@@ -252,10 +253,10 @@
             self.skipTest('os.link(): %s' % e)
 
     def test_samestat(self):
-        test_fn1 = support.TESTFN
-        test_fn2 = support.TESTFN + "2"
-        self.addCleanup(support.unlink, test_fn1)
-        self.addCleanup(support.unlink, test_fn2)
+        test_fn1 = os_helper.TESTFN
+        test_fn2 = os_helper.TESTFN + "2"
+        self.addCleanup(os_helper.unlink, test_fn1)
+        self.addCleanup(os_helper.unlink, test_fn2)
 
         create_file(test_fn1)
         stat1 = os.stat(test_fn1)
@@ -268,10 +269,10 @@
         self.assertRaises(TypeError, self.pathmodule.samestat)
 
     def _test_samestat_on_link_func(self, func):
-        test_fn1 = support.TESTFN + "1"
-        test_fn2 = support.TESTFN + "2"
-        self.addCleanup(support.unlink, test_fn1)
-        self.addCleanup(support.unlink, test_fn2)
+        test_fn1 = os_helper.TESTFN + "1"
+        test_fn2 = os_helper.TESTFN + "2"
+        self.addCleanup(os_helper.unlink, test_fn1)
+        self.addCleanup(os_helper.unlink, test_fn2)
 
         create_file(test_fn1)
         func(test_fn1, test_fn2)
@@ -283,7 +284,7 @@
         self.assertFalse(self.pathmodule.samestat(os.stat(test_fn1),
                                                   os.stat(test_fn2)))
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_samestat_on_symlink(self):
         self._test_samestat_on_link_func(os.symlink)
 
@@ -294,8 +295,8 @@
             self.skipTest('os.link(): %s' % e)
 
     def test_sameopenfile(self):
-        filename = support.TESTFN
-        self.addCleanup(support.unlink, filename)
+        filename = os_helper.TESTFN
+        self.addCleanup(os_helper.unlink, filename)
         create_file(filename)
 
         with open(filename, "rb", 0) as fp1:
@@ -374,7 +375,7 @@
 
     def test_expandvars(self):
         expandvars = self.pathmodule.expandvars
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env.clear()
             env["foo"] = "bar"
             env["{foo"] = "baz1"
@@ -403,14 +404,14 @@
             self.assertEqual(expandvars(b"$foo$foo"), b"barbar")
             self.assertEqual(expandvars(b"$bar$bar"), b"$bar$bar")
 
-    @unittest.skipUnless(support.FS_NONASCII, 'need support.FS_NONASCII')
+    @unittest.skipUnless(os_helper.FS_NONASCII, 'need os_helper.FS_NONASCII')
     def test_expandvars_nonascii(self):
         expandvars = self.pathmodule.expandvars
         def check(value, expected):
             self.assertEqual(expandvars(value), expected)
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env.clear()
-            nonascii = support.FS_NONASCII
+            nonascii = os_helper.FS_NONASCII
             env['spam'] = nonascii
             env[nonascii] = 'ham' + nonascii
             check(nonascii, nonascii)
@@ -469,31 +470,31 @@
             # FS encoding is probably ASCII
             pass
         else:
-            with support.temp_cwd(unicwd):
+            with os_helper.temp_cwd(unicwd):
                 for path in ('', 'fuu', 'f\xf9\xf9', '/fuu', 'U:\\'):
                     self.assertIsInstance(abspath(path), str)
 
     def test_nonascii_abspath(self):
-        if (support.TESTFN_UNDECODABLE
+        if (os_helper.TESTFN_UNDECODABLE
         # Mac OS X denies the creation of a directory with an invalid
         # UTF-8 name. Windows allows creating a directory with an
         # arbitrary bytes name, but fails to enter this directory
         # (when the bytes name is used).
         and sys.platform not in ('win32', 'darwin')):
-            name = support.TESTFN_UNDECODABLE
-        elif support.TESTFN_NONASCII:
-            name = support.TESTFN_NONASCII
+            name = os_helper.TESTFN_UNDECODABLE
+        elif os_helper.TESTFN_NONASCII:
+            name = os_helper.TESTFN_NONASCII
         else:
-            self.skipTest("need support.TESTFN_NONASCII")
+            self.skipTest("need os_helper.TESTFN_NONASCII")
 
         with warnings.catch_warnings():
             warnings.simplefilter("ignore", DeprecationWarning)
-            with support.temp_cwd(name):
+            with os_helper.temp_cwd(name):
                 self.test_abspath()
 
     def test_join_errors(self):
         # Check join() raises friendly TypeErrors.
-        with support.check_warnings(('', BytesWarning), quiet=True):
+        with warnings_helper.check_warnings(('', BytesWarning), quiet=True):
             errmsg = "Can't mix strings and bytes in path components"
             with self.assertRaisesRegex(TypeError, errmsg):
                 self.pathmodule.join(b'bytes', 'str')
@@ -513,8 +514,8 @@
 
     def test_relpath_errors(self):
         # Check relpath() raises friendly TypeErrors.
-        with support.check_warnings(('', (BytesWarning, DeprecationWarning)),
-                                    quiet=True):
+        with warnings_helper.check_warnings(
+                ('', (BytesWarning, DeprecationWarning)), quiet=True):
             errmsg = "Can't mix strings and bytes in path components"
             with self.assertRaisesRegex(TypeError, errmsg):
                 self.pathmodule.relpath(b'bytes', 'str')
@@ -534,9 +535,9 @@
 class PathLikeTests(unittest.TestCase):
 
     def setUp(self):
-        self.file_name = support.TESTFN
-        self.file_path = FakePath(support.TESTFN)
-        self.addCleanup(support.unlink, self.file_name)
+        self.file_name = os_helper.TESTFN
+        self.file_path = FakePath(os_helper.TESTFN)
+        self.addCleanup(os_helper.unlink, self.file_name)
         create_file(self.file_name, b"test_genericpath.PathLikeTests")
 
     def assertPathEqual(self, func):
diff --git a/Lib/test/test_genexps.py b/Lib/test/test_genexps.py
index 5c1a209..70fe2bb 100644
--- a/Lib/test/test_genexps.py
+++ b/Lib/test/test_genexps.py
@@ -103,7 +103,7 @@
     >>> dict(a = i for i in range(10))
     Traceback (most recent call last):
        ...
-    SyntaxError: invalid syntax
+    SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
 
 Verify that parenthesis are required when used as a keyword argument value
 
diff --git a/Lib/test/test_getargs2.py b/Lib/test/test_getargs2.py
index 1a73fa4..e0db9e4 100644
--- a/Lib/test/test_getargs2.py
+++ b/Lib/test/test_getargs2.py
@@ -3,8 +3,10 @@
 import string
 import sys
 from test import support
+from test.support import import_helper
+from test.support import warnings_helper
 # Skip this test if the _testcapi module isn't available.
-_testcapi = support.import_module('_testcapi')
+_testcapi = import_helper.import_module('_testcapi')
 from _testcapi import getargs_keywords, getargs_keyword_only
 
 # > How about the following counterproposal. This also changes some of
@@ -161,12 +163,10 @@
         with self.assertWarns(DeprecationWarning):
             self.assertEqual(1, getargs_b(BadIndex2()))
         self.assertEqual(0, getargs_b(BadIndex3()))
-        with self.assertWarns(DeprecationWarning):
-            self.assertEqual(99, getargs_b(Int()))
+        self.assertRaises(TypeError, getargs_b, Int())
         self.assertEqual(0, getargs_b(IntSubclass()))
         self.assertRaises(TypeError, getargs_b, BadInt())
-        with self.assertWarns(DeprecationWarning):
-            self.assertEqual(1, getargs_b(BadInt2()))
+        self.assertRaises(TypeError, getargs_b, BadInt2())
         self.assertEqual(0, getargs_b(BadInt3()))
 
         self.assertRaises(OverflowError, getargs_b, -1)
@@ -187,12 +187,10 @@
         with self.assertWarns(DeprecationWarning):
             self.assertEqual(1, getargs_B(BadIndex2()))
         self.assertEqual(0, getargs_B(BadIndex3()))
-        with self.assertWarns(DeprecationWarning):
-            self.assertEqual(99, getargs_B(Int()))
+        self.assertRaises(TypeError, getargs_B, Int())
         self.assertEqual(0, getargs_B(IntSubclass()))
         self.assertRaises(TypeError, getargs_B, BadInt())
-        with self.assertWarns(DeprecationWarning):
-            self.assertEqual(1, getargs_B(BadInt2()))
+        self.assertRaises(TypeError, getargs_B, BadInt2())
         self.assertEqual(0, getargs_B(BadInt3()))
 
         self.assertEqual(UCHAR_MAX, getargs_B(-1))
@@ -213,12 +211,10 @@
         with self.assertWarns(DeprecationWarning):
             self.assertEqual(1, getargs_H(BadIndex2()))
         self.assertEqual(0, getargs_H(BadIndex3()))
-        with self.assertWarns(DeprecationWarning):
-            self.assertEqual(99, getargs_H(Int()))
+        self.assertRaises(TypeError, getargs_H, Int())
         self.assertEqual(0, getargs_H(IntSubclass()))
         self.assertRaises(TypeError, getargs_H, BadInt())
-        with self.assertWarns(DeprecationWarning):
-            self.assertEqual(1, getargs_H(BadInt2()))
+        self.assertRaises(TypeError, getargs_H, BadInt2())
         self.assertEqual(0, getargs_H(BadInt3()))
 
         self.assertEqual(USHRT_MAX, getargs_H(-1))
@@ -240,12 +236,10 @@
         with self.assertWarns(DeprecationWarning):
             self.assertEqual(1, getargs_I(BadIndex2()))
         self.assertEqual(0, getargs_I(BadIndex3()))
-        with self.assertWarns(DeprecationWarning):
-            self.assertEqual(99, getargs_I(Int()))
+        self.assertRaises(TypeError, getargs_I, Int())
         self.assertEqual(0, getargs_I(IntSubclass()))
         self.assertRaises(TypeError, getargs_I, BadInt())
-        with self.assertWarns(DeprecationWarning):
-            self.assertEqual(1, getargs_I(BadInt2()))
+        self.assertRaises(TypeError, getargs_I, BadInt2())
         self.assertEqual(0, getargs_I(BadInt3()))
 
         self.assertEqual(UINT_MAX, getargs_I(-1))
@@ -293,12 +287,10 @@
         with self.assertWarns(DeprecationWarning):
             self.assertEqual(1, getargs_h(BadIndex2()))
         self.assertEqual(0, getargs_h(BadIndex3()))
-        with self.assertWarns(DeprecationWarning):
-            self.assertEqual(99, getargs_h(Int()))
+        self.assertRaises(TypeError, getargs_h, Int())
         self.assertEqual(0, getargs_h(IntSubclass()))
         self.assertRaises(TypeError, getargs_h, BadInt())
-        with self.assertWarns(DeprecationWarning):
-            self.assertEqual(1, getargs_h(BadInt2()))
+        self.assertRaises(TypeError, getargs_h, BadInt2())
         self.assertEqual(0, getargs_h(BadInt3()))
 
         self.assertRaises(OverflowError, getargs_h, SHRT_MIN-1)
@@ -319,12 +311,10 @@
         with self.assertWarns(DeprecationWarning):
             self.assertEqual(1, getargs_i(BadIndex2()))
         self.assertEqual(0, getargs_i(BadIndex3()))
-        with self.assertWarns(DeprecationWarning):
-            self.assertEqual(99, getargs_i(Int()))
+        self.assertRaises(TypeError, getargs_i, Int())
         self.assertEqual(0, getargs_i(IntSubclass()))
         self.assertRaises(TypeError, getargs_i, BadInt())
-        with self.assertWarns(DeprecationWarning):
-            self.assertEqual(1, getargs_i(BadInt2()))
+        self.assertRaises(TypeError, getargs_i, BadInt2())
         self.assertEqual(0, getargs_i(BadInt3()))
 
         self.assertRaises(OverflowError, getargs_i, INT_MIN-1)
@@ -345,12 +335,10 @@
         with self.assertWarns(DeprecationWarning):
             self.assertEqual(1, getargs_l(BadIndex2()))
         self.assertEqual(0, getargs_l(BadIndex3()))
-        with self.assertWarns(DeprecationWarning):
-            self.assertEqual(99, getargs_l(Int()))
+        self.assertRaises(TypeError, getargs_l, Int())
         self.assertEqual(0, getargs_l(IntSubclass()))
         self.assertRaises(TypeError, getargs_l, BadInt())
-        with self.assertWarns(DeprecationWarning):
-            self.assertEqual(1, getargs_l(BadInt2()))
+        self.assertRaises(TypeError, getargs_l, BadInt2())
         self.assertEqual(0, getargs_l(BadInt3()))
 
         self.assertRaises(OverflowError, getargs_l, LONG_MIN-1)
@@ -400,12 +388,10 @@
         with self.assertWarns(DeprecationWarning):
             self.assertEqual(1, getargs_L(BadIndex2()))
         self.assertEqual(0, getargs_L(BadIndex3()))
-        with self.assertWarns(DeprecationWarning):
-            self.assertEqual(99, getargs_L(Int()))
+        self.assertRaises(TypeError, getargs_L, Int())
         self.assertEqual(0, getargs_L(IntSubclass()))
         self.assertRaises(TypeError, getargs_L, BadInt())
-        with self.assertWarns(DeprecationWarning):
-            self.assertEqual(1, getargs_L(BadInt2()))
+        self.assertRaises(TypeError, getargs_L, BadInt2())
         self.assertEqual(0, getargs_L(BadInt3()))
 
         self.assertRaises(OverflowError, getargs_L, LLONG_MIN-1)
@@ -888,6 +874,13 @@
         self.assertRaises(TypeError, getargs_s_hash, memoryview(b'memoryview'))
         self.assertRaises(TypeError, getargs_s_hash, None)
 
+    def test_s_hash_int(self):
+        # "s#" without PY_SSIZE_T_CLEAN defined.
+        from _testcapi import getargs_s_hash_int
+        self.assertRaises(SystemError, getargs_s_hash_int, "abc")
+        self.assertRaises(SystemError, getargs_s_hash_int, x=42)
+        # getargs_s_hash_int() don't raise SystemError because skipitem() is not called.
+
     def test_z(self):
         from _testcapi import getargs_z
         self.assertEqual(getargs_z('abc\xe9'), b'abc\xc3\xa9')
@@ -991,41 +984,69 @@
         buf = bytearray()
         self.assertRaises(ValueError, getargs_et_hash, 'abc\xe9', 'latin1', buf)
 
+    @support.requires_legacy_unicode_capi
     def test_u(self):
         from _testcapi import getargs_u
-        self.assertEqual(getargs_u('abc\xe9'), 'abc\xe9')
-        self.assertRaises(ValueError, getargs_u, 'nul:\0')
-        self.assertRaises(TypeError, getargs_u, b'bytes')
-        self.assertRaises(TypeError, getargs_u, bytearray(b'bytearray'))
-        self.assertRaises(TypeError, getargs_u, memoryview(b'memoryview'))
-        self.assertRaises(TypeError, getargs_u, None)
+        with self.assertWarns(DeprecationWarning):
+            self.assertEqual(getargs_u('abc\xe9'), 'abc\xe9')
+        with self.assertWarns(DeprecationWarning):
+            self.assertRaises(ValueError, getargs_u, 'nul:\0')
+        with self.assertWarns(DeprecationWarning):
+            self.assertRaises(TypeError, getargs_u, b'bytes')
+        with self.assertWarns(DeprecationWarning):
+            self.assertRaises(TypeError, getargs_u, bytearray(b'bytearray'))
+        with self.assertWarns(DeprecationWarning):
+            self.assertRaises(TypeError, getargs_u, memoryview(b'memoryview'))
+        with self.assertWarns(DeprecationWarning):
+            self.assertRaises(TypeError, getargs_u, None)
 
+    @support.requires_legacy_unicode_capi
     def test_u_hash(self):
         from _testcapi import getargs_u_hash
-        self.assertEqual(getargs_u_hash('abc\xe9'), 'abc\xe9')
-        self.assertEqual(getargs_u_hash('nul:\0'), 'nul:\0')
-        self.assertRaises(TypeError, getargs_u_hash, b'bytes')
-        self.assertRaises(TypeError, getargs_u_hash, bytearray(b'bytearray'))
-        self.assertRaises(TypeError, getargs_u_hash, memoryview(b'memoryview'))
-        self.assertRaises(TypeError, getargs_u_hash, None)
+        with self.assertWarns(DeprecationWarning):
+            self.assertEqual(getargs_u_hash('abc\xe9'), 'abc\xe9')
+        with self.assertWarns(DeprecationWarning):
+            self.assertEqual(getargs_u_hash('nul:\0'), 'nul:\0')
+        with self.assertWarns(DeprecationWarning):
+            self.assertRaises(TypeError, getargs_u_hash, b'bytes')
+        with self.assertWarns(DeprecationWarning):
+            self.assertRaises(TypeError, getargs_u_hash, bytearray(b'bytearray'))
+        with self.assertWarns(DeprecationWarning):
+            self.assertRaises(TypeError, getargs_u_hash, memoryview(b'memoryview'))
+        with self.assertWarns(DeprecationWarning):
+            self.assertRaises(TypeError, getargs_u_hash, None)
 
+    @support.requires_legacy_unicode_capi
     def test_Z(self):
         from _testcapi import getargs_Z
-        self.assertEqual(getargs_Z('abc\xe9'), 'abc\xe9')
-        self.assertRaises(ValueError, getargs_Z, 'nul:\0')
-        self.assertRaises(TypeError, getargs_Z, b'bytes')
-        self.assertRaises(TypeError, getargs_Z, bytearray(b'bytearray'))
-        self.assertRaises(TypeError, getargs_Z, memoryview(b'memoryview'))
-        self.assertIsNone(getargs_Z(None))
+        with self.assertWarns(DeprecationWarning):
+            self.assertEqual(getargs_Z('abc\xe9'), 'abc\xe9')
+        with self.assertWarns(DeprecationWarning):
+            self.assertRaises(ValueError, getargs_Z, 'nul:\0')
+        with self.assertWarns(DeprecationWarning):
+            self.assertRaises(TypeError, getargs_Z, b'bytes')
+        with self.assertWarns(DeprecationWarning):
+            self.assertRaises(TypeError, getargs_Z, bytearray(b'bytearray'))
+        with self.assertWarns(DeprecationWarning):
+            self.assertRaises(TypeError, getargs_Z, memoryview(b'memoryview'))
+        with self.assertWarns(DeprecationWarning):
+            self.assertIsNone(getargs_Z(None))
 
+    @support.requires_legacy_unicode_capi
     def test_Z_hash(self):
         from _testcapi import getargs_Z_hash
-        self.assertEqual(getargs_Z_hash('abc\xe9'), 'abc\xe9')
-        self.assertEqual(getargs_Z_hash('nul:\0'), 'nul:\0')
-        self.assertRaises(TypeError, getargs_Z_hash, b'bytes')
-        self.assertRaises(TypeError, getargs_Z_hash, bytearray(b'bytearray'))
-        self.assertRaises(TypeError, getargs_Z_hash, memoryview(b'memoryview'))
-        self.assertIsNone(getargs_Z_hash(None))
+        with self.assertWarns(DeprecationWarning):
+            self.assertEqual(getargs_Z_hash('abc\xe9'), 'abc\xe9')
+        with self.assertWarns(DeprecationWarning):
+            self.assertEqual(getargs_Z_hash('nul:\0'), 'nul:\0')
+        with self.assertWarns(DeprecationWarning):
+            self.assertRaises(TypeError, getargs_Z_hash, b'bytes')
+        with self.assertWarns(DeprecationWarning):
+            self.assertRaises(TypeError, getargs_Z_hash, bytearray(b'bytearray'))
+        with self.assertWarns(DeprecationWarning):
+            self.assertRaises(TypeError, getargs_Z_hash, memoryview(b'memoryview'))
+        with self.assertWarns(DeprecationWarning):
+            self.assertIsNone(getargs_Z_hash(None))
 
 
 class Object_TestCase(unittest.TestCase):
@@ -1064,6 +1085,8 @@
 
 class SkipitemTest(unittest.TestCase):
 
+    # u, and Z raises DeprecationWarning
+    @warnings_helper.ignore_warnings(category=DeprecationWarning)
     def test_skipitem(self):
         """
         If this test failed, you probably added a new "format unit"
@@ -1232,6 +1255,14 @@
                     for name in dir(_testcapi)
                     if name.startswith('test_') and name.endswith('_code'))
 
+    @warnings_helper.ignore_warnings(category=DeprecationWarning)
+    def test_u_code(self):
+        _testcapi.test_u_code()
+
+    @warnings_helper.ignore_warnings(category=DeprecationWarning)
+    def test_Z_code(self):
+        _testcapi.test_Z_code()
+
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/Lib/test/test_getopt.py b/Lib/test/test_getopt.py
index 9275dc4..9261276 100644
--- a/Lib/test/test_getopt.py
+++ b/Lib/test/test_getopt.py
@@ -1,7 +1,8 @@
 # test_getopt.py
 # David Goodger <dgoodger@bigfoot.com> 2000-08-19
 
-from test.support import verbose, run_doctest, EnvironmentVarGuard
+from test.support import verbose, run_doctest
+from test.support.os_helper import EnvironmentVarGuard
 import unittest
 
 import getopt
diff --git a/Lib/test/test_gettext.py b/Lib/test/test_gettext.py
index baf300b..575914d 100644
--- a/Lib/test/test_gettext.py
+++ b/Lib/test/test_gettext.py
@@ -5,6 +5,7 @@
 import unittest
 
 from test import support
+from test.support import os_helper
 
 
 # TODO:
@@ -129,14 +130,14 @@
             fp.write(base64.decodebytes(UMO_DATA))
         with open(MMOFILE, 'wb') as fp:
             fp.write(base64.decodebytes(MMO_DATA))
-        self.env = support.EnvironmentVarGuard()
+        self.env = os_helper.EnvironmentVarGuard()
         self.env['LANGUAGE'] = 'xx'
         gettext._translations.clear()
 
     def tearDown(self):
         self.env.__exit__()
         del self.env
-        support.rmtree(os.path.split(LOCALEDIR)[0])
+        os_helper.rmtree(os.path.split(LOCALEDIR)[0])
 
 GNU_MO_DATA_ISSUE_17898 = b'''\
 3hIElQAAAAABAAAAHAAAACQAAAAAAAAAAAAAAAAAAAAsAAAAggAAAC0AAAAAUGx1cmFsLUZvcm1z
@@ -819,8 +820,8 @@
 
 class MiscTestCase(unittest.TestCase):
     def test__all__(self):
-        blacklist = {'c2py', 'ENOENT'}
-        support.check__all__(self, gettext, blacklist=blacklist)
+        support.check__all__(self, gettext,
+                             not_exported={'c2py', 'ENOENT'})
 
 
 if __name__ == '__main__':
diff --git a/Lib/test/test_glob.py b/Lib/test/test_glob.py
index cba8c7c..96db31b 100644
--- a/Lib/test/test_glob.py
+++ b/Lib/test/test_glob.py
@@ -4,11 +4,12 @@
 import sys
 import unittest
 
-from test.support import (TESTFN, skip_unless_symlink,
-                          can_symlink, create_empty_file, change_cwd)
+from test.support.os_helper import (TESTFN, skip_unless_symlink,
+                                    can_symlink, create_empty_file, change_cwd)
 
 
 class GlobTests(unittest.TestCase):
+    dir_fd = None
 
     def norm(self, *parts):
         return os.path.normpath(os.path.join(self.tempdir, *parts))
@@ -38,8 +39,14 @@
             os.symlink(self.norm('broken'), self.norm('sym1'))
             os.symlink('broken', self.norm('sym2'))
             os.symlink(os.path.join('a', 'bcd'), self.norm('sym3'))
+        if {os.open, os.stat} <= os.supports_dir_fd and os.scandir in os.supports_fd:
+            self.dir_fd = os.open(self.tempdir, os.O_RDONLY | os.O_DIRECTORY)
+        else:
+            self.dir_fd = None
 
     def tearDown(self):
+        if self.dir_fd is not None:
+            os.close(self.dir_fd)
         shutil.rmtree(self.tempdir)
 
     def glob(self, *parts, **kwargs):
@@ -53,6 +60,41 @@
         bres = [os.fsencode(x) for x in res]
         self.assertCountEqual(glob.glob(os.fsencode(p), **kwargs), bres)
         self.assertCountEqual(glob.iglob(os.fsencode(p), **kwargs), bres)
+
+        with change_cwd(self.tempdir):
+            res2 = glob.glob(pattern, **kwargs)
+            for x in res2:
+                self.assertFalse(os.path.isabs(x), x)
+            if pattern == '**' or pattern == '**' + os.sep:
+                expected = res[1:]
+            else:
+                expected = res
+            self.assertCountEqual([os.path.join(self.tempdir, x) for x in res2],
+                                  expected)
+            self.assertCountEqual(glob.iglob(pattern, **kwargs), res2)
+            bpattern = os.fsencode(pattern)
+            bres2 = [os.fsencode(x) for x in res2]
+            self.assertCountEqual(glob.glob(bpattern, **kwargs), bres2)
+            self.assertCountEqual(glob.iglob(bpattern, **kwargs), bres2)
+
+        self.assertCountEqual(glob.glob(pattern, root_dir=self.tempdir, **kwargs), res2)
+        self.assertCountEqual(glob.iglob(pattern, root_dir=self.tempdir, **kwargs), res2)
+        btempdir = os.fsencode(self.tempdir)
+        self.assertCountEqual(
+            glob.glob(bpattern, root_dir=btempdir, **kwargs), bres2)
+        self.assertCountEqual(
+            glob.iglob(bpattern, root_dir=btempdir, **kwargs), bres2)
+
+        if self.dir_fd is not None:
+            self.assertCountEqual(
+                glob.glob(pattern, dir_fd=self.dir_fd, **kwargs), res2)
+            self.assertCountEqual(
+                glob.iglob(pattern, dir_fd=self.dir_fd, **kwargs), res2)
+            self.assertCountEqual(
+                glob.glob(bpattern, dir_fd=self.dir_fd, **kwargs), bres2)
+            self.assertCountEqual(
+                glob.iglob(bpattern, dir_fd=self.dir_fd, **kwargs), bres2)
+
         return res
 
     def assertSequencesEqual_noorder(self, l1, l2):
@@ -78,6 +120,14 @@
         res = glob.glob(os.path.join(os.fsencode(os.curdir), b'*'))
         self.assertEqual({type(r) for r in res}, {bytes})
 
+    def test_glob_empty_pattern(self):
+        self.assertEqual(glob.glob(''), [])
+        self.assertEqual(glob.glob(b''), [])
+        self.assertEqual(glob.glob('', root_dir=self.tempdir), [])
+        self.assertEqual(glob.glob(b'', root_dir=os.fsencode(self.tempdir)), [])
+        self.assertEqual(glob.glob('', dir_fd=self.dir_fd), [])
+        self.assertEqual(glob.glob(b'', dir_fd=self.dir_fd), [])
+
     def test_glob_one_directory(self):
         eq = self.assertSequencesEqual_noorder
         eq(self.glob('a*'), map(self.norm, ['a', 'aab', 'aaa']))
diff --git a/Lib/test/test_global.py b/Lib/test/test_global.py
index 8159602..d0bde3f 100644
--- a/Lib/test/test_global.py
+++ b/Lib/test/test_global.py
@@ -1,6 +1,7 @@
 """Verify that warnings are issued for global statements following use."""
 
-from test.support import run_unittest, check_syntax_error, check_warnings
+from test.support import check_syntax_error
+from test.support.warnings_helper import check_warnings
 import unittest
 import warnings
 
@@ -52,10 +53,12 @@
         compile(prog_text_4, "<test string>", "exec")
 
 
-def test_main():
-    with warnings.catch_warnings():
-        warnings.filterwarnings("error", module="<test string>")
-        run_unittest(GlobalTests)
+def setUpModule():
+    cm = warnings.catch_warnings()
+    cm.__enter__()
+    unittest.addModuleCleanup(cm.__exit__, None, None, None)
+    warnings.filterwarnings("error", module="<test string>")
+
 
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py
index e1a402e..2b9f7df 100644
--- a/Lib/test/test_grammar.py
+++ b/Lib/test/test_grammar.py
@@ -1,7 +1,9 @@
 # Python test set -- part 1, grammar.
 # This just tests whether the parser accepts them all.
 
-from test.support import check_syntax_error, check_syntax_warning, use_old_parser
+from test.support import check_syntax_error
+from test.support import import_helper
+from test.support.warnings_helper import check_syntax_warning
 import inspect
 import unittest
 import sys
@@ -175,8 +177,10 @@
 
     def test_float_exponent_tokenization(self):
         # See issue 21642.
-        self.assertEqual(1 if 1else 0, 1)
-        self.assertEqual(1 if 0else 0, 0)
+        with warnings.catch_warnings():
+            warnings.simplefilter('ignore', DeprecationWarning)
+            self.assertEqual(eval("1 if 1else 0"), 1)
+            self.assertEqual(eval("1 if 0else 0"), 0)
         self.assertRaises(SyntaxError, eval, "0 if 1Else 0")
 
     def test_underscore_literals(self):
@@ -209,6 +213,37 @@
         check("1e2_", "invalid decimal literal")
         check("1e+", "invalid decimal literal")
 
+    def test_end_of_numerical_literals(self):
+        def check(test, error=False):
+            with self.subTest(expr=test):
+                if error:
+                    with warnings.catch_warnings(record=True) as w:
+                        with self.assertRaises(SyntaxError):
+                            compile(test, "<testcase>", "eval")
+                    self.assertEqual(w,  [])
+                else:
+                    with self.assertWarns(DeprecationWarning):
+                        compile(test, "<testcase>", "eval")
+
+        for num in "0xf", "0o7", "0b1", "9", "0", "1.", "1e3", "1j":
+            compile(num, "<testcase>", "eval")
+            check(f"{num}and x", error=(num == "0xf"))
+            check(f"{num}or x", error=(num == "0"))
+            check(f"{num}in x")
+            check(f"{num}not in x")
+            with warnings.catch_warnings():
+                warnings.filterwarnings('ignore', '"is" with a literal',
+                                        SyntaxWarning)
+                check(f"{num}is x")
+            check(f"{num}if x else y")
+            check(f"x if {num}else y", error=(num == "0xf"))
+            check(f"[{num}for x in ()]")
+            check(f"{num}spam", error=True)
+
+        check("[0x1ffor x in ()]")
+        check("[0x1for x in ()]")
+        check("[0xfor x in ()]")
+
     def test_string_literals(self):
         x = ''; y = ""; self.assertTrue(len(x) == 0 and x == y)
         x = '\''; y = "'"; self.assertTrue(len(x) == 1 and x == y and ord(x) == 39)
@@ -259,7 +294,7 @@
         for s in samples:
             with self.assertRaises(SyntaxError) as cm:
                 compile(s, "<test>", "exec")
-            self.assertIn("unexpected EOF", str(cm.exception))
+            self.assertIn("was never closed", str(cm.exception))
 
 var_annot_global: int # a global annotated is necessary for test_var_annot
 
@@ -276,7 +311,9 @@
 
 class GrammarTests(unittest.TestCase):
 
-    from test.support import check_syntax_error, check_syntax_warning
+    from test.support import check_syntax_error
+    from test.support.warnings_helper import check_syntax_warning
+    from test.support.warnings_helper import check_no_warnings
 
     # single_input: NEWLINE | simple_stmt | compound_stmt NEWLINE
     # XXX can't test in a script -- this rule is only used when interactive
@@ -379,10 +416,9 @@
         self.assertEqual(CC.__annotations__['xx'], 'ANNOT')
 
     def test_var_annot_module_semantics(self):
-        with self.assertRaises(AttributeError):
-            print(test.__annotations__)
+        self.assertEqual(test.__annotations__, {})
         self.assertEqual(ann_module.__annotations__,
-                     {1: 2, 'x': int, 'y': str, 'f': typing.Tuple[int, int]})
+                     {1: 2, 'x': int, 'y': str, 'f': typing.Tuple[int, int], 'u': int | float})
         self.assertEqual(ann_module.M.__annotations__,
                               {'123': 123, 'o': type})
         self.assertEqual(ann_module2.__annotations__, {})
@@ -390,13 +426,13 @@
     def test_var_annot_in_module(self):
         # check that functions fail the same way when executed
         # outside of module where they were defined
-        from test.ann_module3 import f_bad_ann, g_bad_ann, D_bad_ann
+        ann_module3 = import_helper.import_fresh_module("test.ann_module3")
         with self.assertRaises(NameError):
-            f_bad_ann()
+            ann_module3.f_bad_ann()
         with self.assertRaises(NameError):
-            g_bad_ann()
+            ann_module3.g_bad_ann()
         with self.assertRaises(NameError):
-            D_bad_ann(5)
+            ann_module3.D_bad_ann(5)
 
     def test_var_annot_simple_exec(self):
         gns = {}; lns= {}
@@ -582,12 +618,14 @@
         d22v(1, *(2, 3), **{'d': 4})
 
         # keyword argument type tests
-        try:
-            str('x', **{b'foo':1 })
-        except TypeError:
-            pass
-        else:
-            self.fail('Bytes should not work as keyword argument names')
+        with warnings.catch_warnings():
+            warnings.simplefilter('ignore', BytesWarning)
+            try:
+                str('x', **{b'foo':1 })
+            except TypeError:
+                pass
+            else:
+                self.fail('Bytes should not work as keyword argument names')
         # keyword only argument tests
         def pos0key1(*, key): return key
         pos0key1(key=100)
@@ -1196,7 +1234,7 @@
 
     # these tests fail if python is run with -O, so check __debug__
     @unittest.skipUnless(__debug__, "Won't work if __debug__ is False")
-    def testAssert2(self):
+    def test_assert_failures(self):
         try:
             assert 0, "msg"
         except AssertionError as e:
@@ -1211,11 +1249,36 @@
         else:
             self.fail("AssertionError not raised by 'assert False'")
 
+    def test_assert_syntax_warnings(self):
+        # Ensure that we warn users if they provide a non-zero length tuple as
+        # the assertion test.
         self.check_syntax_warning('assert(x, "msg")',
                                   'assertion is always true')
+        self.check_syntax_warning('assert(False, "msg")',
+                                  'assertion is always true')
+        self.check_syntax_warning('assert(False,)',
+                                  'assertion is always true')
+
+        with self.check_no_warnings(category=SyntaxWarning):
+            compile('assert x, "msg"', '<testcase>', 'exec')
+            compile('assert False, "msg"', '<testcase>', 'exec')
+
+    def test_assert_warning_promotes_to_syntax_error(self):
+        # If SyntaxWarning is configured to be an error, it actually raises a
+        # SyntaxError.
+        # https://bugs.python.org/issue35029
         with warnings.catch_warnings():
             warnings.simplefilter('error', SyntaxWarning)
-            compile('assert x, "msg"', '<testcase>', 'exec')
+            try:
+                compile('assert x, "msg" ', '<testcase>', 'exec')
+            except SyntaxError:
+                self.fail('SyntaxError incorrectly raised for \'assert x, "msg"\'')
+            with self.assertRaises(SyntaxError):
+                compile('assert(x, "msg")', '<testcase>', 'exec')
+            with self.assertRaises(SyntaxError):
+                compile('assert(False, "msg")', '<testcase>', 'exec')
+            with self.assertRaises(SyntaxError):
+                compile('assert(False,)', '<testcase>', 'exec')
 
 
     ### compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | funcdef | classdef
@@ -1714,69 +1777,53 @@
         with manager() as x, manager():
             pass
 
-        if not use_old_parser():
-            test_cases = [
-                """if 1:
-                    with (
-                        manager()
-                    ):
-                        pass
-                """,
-                """if 1:
-                    with (
-                        manager() as x
-                    ):
-                        pass
-                """,
-                """if 1:
-                    with (
-                        manager() as (x, y),
-                        manager() as z,
-                    ):
-                        pass
-                """,
-                """if 1:
-                    with (
-                        manager(),
-                        manager()
-                    ):
-                        pass
-                """,
-                """if 1:
-                    with (
-                        manager() as x,
-                        manager() as y
-                    ):
-                        pass
-                """,
-                """if 1:
-                    with (
-                        manager() as x,
-                        manager()
-                    ):
-                        pass
-                """,
-                """if 1:
-                    with (
-                        manager() as x,
-                        manager() as y,
-                        manager() as z,
-                    ):
-                        pass
-                """,
-                """if 1:
-                    with (
-                        manager() as x,
-                        manager() as y,
-                        manager(),
-                    ):
-                        pass
-                """,
-            ]
-            for case in test_cases:
-                with self.subTest(case=case):
-                    compile(case, "<string>", "exec")
+        with (
+            manager()
+        ):
+            pass
 
+        with (
+            manager() as x
+        ):
+            pass
+
+        with (
+            manager() as (x, y),
+            manager() as z,
+        ):
+            pass
+
+        with (
+            manager(),
+            manager()
+        ):
+            pass
+
+        with (
+            manager() as x,
+            manager() as y
+        ):
+            pass
+
+        with (
+            manager() as x,
+            manager()
+        ):
+            pass
+
+        with (
+            manager() as x,
+            manager() as y,
+            manager() as z,
+        ):
+            pass
+
+        with (
+            manager() as x,
+            manager() as y,
+            manager(),
+        ):
+            pass
 
     def test_if_else_expr(self):
         # Test ifelse expressions in various cases
diff --git a/Lib/test/test_graphlib.py b/Lib/test/test_graphlib.py
index 0043253..86246a6 100644
--- a/Lib/test/test_graphlib.py
+++ b/Lib/test/test_graphlib.py
@@ -13,13 +13,19 @@
                 nodes = ts.get_ready()
                 for node in nodes:
                     ts.done(node)
-                yield nodes
+                yield tuple(sorted(nodes))
 
         ts = graphlib.TopologicalSorter(graph)
         self.assertEqual(list(static_order_with_groups(ts)), list(expected))
 
         ts = graphlib.TopologicalSorter(graph)
-        self.assertEqual(list(ts.static_order()), list(chain(*expected)))
+        # need to be a bit careful comparing the result of ts.static_order and
+        # expected, because the order within a group is dependent on set
+        # iteration order
+        it = iter(ts.static_order())
+        for group in expected:
+            tsgroup = {next(it) for element in group}
+            self.assertEqual(set(group), tsgroup)
 
     def _assert_cycle(self, graph, cycle):
         ts = graphlib.TopologicalSorter()
@@ -36,7 +42,7 @@
     def test_simple_cases(self):
         self._test_graph(
             {2: {11}, 9: {11, 8}, 10: {11, 3}, 11: {7, 5}, 8: {7, 3}},
-            [(3, 5, 7), (11, 8), (2, 10, 9)],
+            [(3, 5, 7), (8, 11), (2, 9, 10)],
         )
 
         self._test_graph({1: {}}, [(1,)])
@@ -80,7 +86,7 @@
 
     def test_the_node_multiple_times(self):
         # Test same node multiple times in dependencies
-        self._test_graph({1: {2}, 3: {4}, 0: [2, 4, 4, 4, 4, 4]}, [(2, 4), (1, 3, 0)])
+        self._test_graph({1: {2}, 3: {4}, 0: [2, 4, 4, 4, 4, 4]}, [(2, 4), (0, 1, 3)])
 
         # Test adding the same dependency multiple times
         ts = graphlib.TopologicalSorter()
@@ -242,3 +248,6 @@
         self.assertNotEqual(run1, "")
         self.assertNotEqual(run2, "")
         self.assertEqual(run1, run2)
+
+if __name__ == "__main__":
+    unittest.main()
diff --git a/Lib/test/test_grp.py b/Lib/test/test_grp.py
index e511947..c7ec03e 100644
--- a/Lib/test/test_grp.py
+++ b/Lib/test/test_grp.py
@@ -1,9 +1,10 @@
 """Test script for the grp module."""
 
 import unittest
-from test import support
+from test.support import import_helper
 
-grp = support.import_module('grp')
+
+grp = import_helper.import_module('grp')
 
 class GroupDatabaseTestCase(unittest.TestCase):
 
@@ -100,8 +101,8 @@
             self.skipTest('no groups')
         # Choose an existent gid.
         gid = entries[0][2]
-        self.assertWarns(DeprecationWarning, grp.getgrgid, float(gid))
-        self.assertWarns(DeprecationWarning, grp.getgrgid, str(gid))
+        self.assertRaises(TypeError, grp.getgrgid, float(gid))
+        self.assertRaises(TypeError, grp.getgrgid, str(gid))
 
 
 if __name__ == "__main__":
diff --git a/Lib/test/test_gzip.py b/Lib/test/test_gzip.py
index 0f235d1..f86e767 100644
--- a/Lib/test/test_gzip.py
+++ b/Lib/test/test_gzip.py
@@ -10,11 +10,12 @@
 import sys
 import unittest
 from subprocess import PIPE, Popen
-from test import support
+from test.support import import_helper
+from test.support import os_helper
 from test.support import _4G, bigmemtest
 from test.support.script_helper import assert_python_ok, assert_python_failure
 
-gzip = support.import_module('gzip')
+gzip = import_helper.import_module('gzip')
 
 data1 = b"""  int length=DEFAULTALLOC, err = Z_OK;
   PyObject *RetVal;
@@ -29,7 +30,7 @@
 """
 
 
-TEMPDIR = os.path.abspath(support.TESTFN) + '-gzdir'
+TEMPDIR = os.path.abspath(os_helper.TESTFN) + '-gzdir'
 
 
 class UnseekableIO(io.BytesIO):
@@ -44,13 +45,13 @@
 
 
 class BaseTest(unittest.TestCase):
-    filename = support.TESTFN
+    filename = os_helper.TESTFN
 
     def setUp(self):
-        support.unlink(self.filename)
+        os_helper.unlink(self.filename)
 
     def tearDown(self):
-        support.unlink(self.filename)
+        os_helper.unlink(self.filename)
 
 
 class TestGzip(BaseTest):
@@ -286,7 +287,7 @@
         self.test_write()
         with gzip.GzipFile(self.filename, 'r') as f:
             self.assertEqual(f.myfileobj.mode, 'rb')
-        support.unlink(self.filename)
+        os_helper.unlink(self.filename)
         with gzip.GzipFile(self.filename, 'x') as f:
             self.assertEqual(f.myfileobj.mode, 'xb')
 
@@ -365,7 +366,7 @@
             self.assertEqual(isizeBytes, struct.pack('<i', len(data1)))
 
     def test_metadata_ascii_name(self):
-        self.filename = support.TESTFN_ASCII
+        self.filename = os_helper.TESTFN_ASCII
         self.test_metadata()
 
     def test_compresslevel_metadata(self):
@@ -497,7 +498,7 @@
                     self.assertEqual(g.mode, gzip.READ)
         for mode in "wb", "ab", "xb":
             if "x" in mode:
-                support.unlink(self.filename)
+                os_helper.unlink(self.filename)
             with open(self.filename, mode) as f:
                 with self.assertWarns(FutureWarning):
                     g = gzip.GzipFile(fileobj=f)
@@ -590,6 +591,15 @@
         with gzip.open(self.filename, "rb") as f:
             f._buffer.raw._fp.prepend()
 
+    def test_issue44439(self):
+        q = array.array('Q', [1, 2, 3, 4, 5])
+        LENGTH = len(q) * q.itemsize
+
+        with gzip.GzipFile(fileobj=io.BytesIO(), mode='w') as f:
+            self.assertEqual(f.write(q), LENGTH)
+            self.assertEqual(f.tell(), LENGTH)
+
+
 class TestOpen(BaseTest):
     def test_binary_modes(self):
         uncompressed = data1 * 50
@@ -611,7 +621,7 @@
 
         with self.assertRaises(FileExistsError):
             gzip.open(self.filename, "xb")
-        support.unlink(self.filename)
+        os_helper.unlink(self.filename)
         with gzip.open(self.filename, "xb") as f:
             f.write(uncompressed)
         with open(self.filename, "rb") as f:
@@ -648,7 +658,7 @@
 
         with self.assertRaises(FileExistsError):
             gzip.open(self.filename, "x")
-        support.unlink(self.filename)
+        os_helper.unlink(self.filename)
         with gzip.open(self.filename, "x") as f:
             f.write(uncompressed)
         with open(self.filename, "rb") as f:
@@ -658,14 +668,14 @@
     def test_text_modes(self):
         uncompressed = data1.decode("ascii") * 50
         uncompressed_raw = uncompressed.replace("\n", os.linesep)
-        with gzip.open(self.filename, "wt") as f:
+        with gzip.open(self.filename, "wt", encoding="ascii") as f:
             f.write(uncompressed)
         with open(self.filename, "rb") as f:
             file_data = gzip.decompress(f.read()).decode("ascii")
             self.assertEqual(file_data, uncompressed_raw)
-        with gzip.open(self.filename, "rt") as f:
+        with gzip.open(self.filename, "rt", encoding="ascii") as f:
             self.assertEqual(f.read(), uncompressed)
-        with gzip.open(self.filename, "at") as f:
+        with gzip.open(self.filename, "at", encoding="ascii") as f:
             f.write(uncompressed)
         with open(self.filename, "rb") as f:
             file_data = gzip.decompress(f.read()).decode("ascii")
@@ -679,7 +689,7 @@
             self.assertEqual(f.read(), uncompressed_bytes)
         with gzip.open(io.BytesIO(compressed), "rb") as f:
             self.assertEqual(f.read(), uncompressed_bytes)
-        with gzip.open(io.BytesIO(compressed), "rt") as f:
+        with gzip.open(io.BytesIO(compressed), "rt", encoding="ascii") as f:
             self.assertEqual(f.read(), uncompressed_str)
 
     def test_bad_params(self):
@@ -720,9 +730,9 @@
     def test_newline(self):
         # Test with explicit newline (universal newline mode disabled).
         uncompressed = data1.decode("ascii") * 50
-        with gzip.open(self.filename, "wt", newline="\n") as f:
+        with gzip.open(self.filename, "wt", encoding="ascii", newline="\n") as f:
             f.write(uncompressed)
-        with gzip.open(self.filename, "rt", newline="\r") as f:
+        with gzip.open(self.filename, "rt", encoding="ascii", newline="\r") as f:
             self.assertEqual(f.readlines(), [uncompressed])
 
 
@@ -734,7 +744,7 @@
             try:
                 return function(*args, **kwargs)
             finally:
-                support.rmtree(directory)
+                os_helper.rmtree(directory)
         return wrapper
     return decorator
 
@@ -772,10 +782,10 @@
         self.assertEqual(err, b'')
 
     def test_decompress_infile_outfile_error(self):
-        rc, out, err = assert_python_ok('-m', 'gzip', '-d', 'thisisatest.out')
-        self.assertIn(b"filename doesn't end in .gz:", out)
-        self.assertEqual(rc, 0)
-        self.assertEqual(err, b'')
+        rc, out, err = assert_python_failure('-m', 'gzip', '-d', 'thisisatest.out')
+        self.assertEqual(b"filename doesn't end in .gz: 'thisisatest.out'", err.strip())
+        self.assertEqual(rc, 1)
+        self.assertEqual(out, b'')
 
     @create_and_remove_directory(TEMPDIR)
     def test_compress_stdin_outfile(self):
@@ -831,9 +841,5 @@
         self.assertEqual(out, b'')
 
 
-def test_main(verbose=None):
-    support.run_unittest(TestGzip, TestOpen, TestCommandLine)
-
-
 if __name__ == "__main__":
-    test_main(verbose=True)
+    unittest.main()
diff --git a/Lib/test/test_hashlib.py b/Lib/test/test_hashlib.py
index 86f31a5..ea31f8b 100644
--- a/Lib/test/test_hashlib.py
+++ b/Lib/test/test_hashlib.py
@@ -18,7 +18,10 @@
 import unittest
 import warnings
 from test import support
-from test.support import _4G, bigmemtest, import_fresh_module
+from test.support import _4G, bigmemtest
+from test.support.import_helper import import_fresh_module
+from test.support import threading_helper
+from test.support import warnings_helper
 from http.client import HTTPException
 
 # Were we compiled --with-pydebug or with #define Py_DEBUG?
@@ -45,12 +48,15 @@
     builtin_hashlib = None
 
 try:
-    from _hashlib import HASH, HASHXOF, openssl_md_meth_names
+    from _hashlib import HASH, HASHXOF, openssl_md_meth_names, get_fips_mode
 except ImportError:
     HASH = None
     HASHXOF = None
     openssl_md_meth_names = frozenset()
 
+    def get_fips_mode():
+        return 0
+
 try:
     import _blake2
 except ImportError:
@@ -58,12 +64,9 @@
 
 requires_blake2 = unittest.skipUnless(_blake2, 'requires _blake2')
 
-try:
-    import _sha3
-except ImportError:
-    _sha3 = None
-
-requires_sha3 = unittest.skipUnless(_sha3, 'requires _sha3')
+# bpo-46913: Don't test the _sha3 extension on a Python UBSAN build
+SKIP_SHA3 = support.check_sanitizer(ub=True)
+requires_sha3 = unittest.skipUnless(not SKIP_SHA3, 'requires _sha3')
 
 
 def hexstr(s):
@@ -80,7 +83,7 @@
 def read_vectors(hash_name):
     url = URL.format(hash_name)
     try:
-        testdata = support.open_urlresource(url)
+        testdata = support.open_urlresource(url, encoding="utf-8")
     except (OSError, HTTPException):
         raise unittest.SkipTest("Could not retrieve {}".format(url))
     with testdata:
@@ -126,6 +129,8 @@
 
         self.constructors_to_test = {}
         for algorithm in algorithms:
+            if SKIP_SHA3 and algorithm.startswith('sha3_'):
+                continue
             self.constructors_to_test[algorithm] = set()
 
         # For each algorithm, test the direct constructor and the use
@@ -178,14 +183,15 @@
             add_builtin_constructor('blake2s')
             add_builtin_constructor('blake2b')
 
-        _sha3 = self._conditional_import_module('_sha3')
-        if _sha3:
-            add_builtin_constructor('sha3_224')
-            add_builtin_constructor('sha3_256')
-            add_builtin_constructor('sha3_384')
-            add_builtin_constructor('sha3_512')
-            add_builtin_constructor('shake_128')
-            add_builtin_constructor('shake_256')
+        if not SKIP_SHA3:
+            _sha3 = self._conditional_import_module('_sha3')
+            if _sha3:
+                add_builtin_constructor('sha3_224')
+                add_builtin_constructor('sha3_256')
+                add_builtin_constructor('sha3_384')
+                add_builtin_constructor('sha3_512')
+                add_builtin_constructor('shake_128')
+                add_builtin_constructor('shake_256')
 
         super(HashLibTestCase, self).__init__(*args, **kwargs)
 
@@ -196,10 +202,7 @@
 
     @property
     def is_fips_mode(self):
-        if hasattr(self._hashlib, "get_fips_mode"):
-            return self._hashlib.get_fips_mode()
-        else:
-            return None
+        return get_fips_mode()
 
     def test_hash_array(self):
         a = array.array("b", range(10))
@@ -826,26 +829,22 @@
         for msg, md in read_vectors('sha3_512'):
             self.check('sha3_512', msg, md)
 
-    @requires_sha3
     def test_case_shake_128_0(self):
         self.check('shake_128', b"",
           "7f9c2ba4e88f827d616045507605853ed73b8093f6efbc88eb1a6eacfa66ef26",
           True)
         self.check('shake_128', b"", "7f9c", True)
 
-    @requires_sha3
     def test_case_shake128_vector(self):
         for msg, md in read_vectors('shake_128'):
             self.check('shake_128', msg, md, True)
 
-    @requires_sha3
     def test_case_shake_256_0(self):
         self.check('shake_256', b"",
           "46b9dd2b0ba88d13233b3feb743eeb243fcd52ea62b81b82b50c27646ed5762f",
           True)
         self.check('shake_256', b"", "46b9", True)
 
-    @requires_sha3
     def test_case_shake256_vector(self):
         for msg, md in read_vectors('shake_256'):
             self.check('shake_256', msg, md, True)
@@ -879,7 +878,7 @@
             '1cfceca95989f51f658e3f3ffe7f1cd43726c9e088c13ee10b46f57cef135b94'
         )
 
-    @support.reap_threads
+    @threading_helper.reap_threads
     def test_threaded_hashing(self):
         # Updating the same hash object from several threads at once
         # using data chunk sizes containing the same byte sequences.
@@ -920,17 +919,40 @@
         if fips_mode is not None:
             self.assertIsInstance(fips_mode, int)
 
+    @support.cpython_only
+    def test_disallow_instantiation(self):
+        for algorithm, constructors in self.constructors_to_test.items():
+            if algorithm.startswith(("sha3_", "shake", "blake")):
+                # _sha3 and _blake types can be instantiated
+                continue
+            # all other types have DISALLOW_INSTANTIATION
+            for constructor in constructors:
+                # In FIPS mode some algorithms are not available raising ValueError
+                try:
+                    h = constructor()
+                except ValueError:
+                    continue
+                with self.subTest(constructor=constructor):
+                    support.check_disallow_instantiation(self, type(h))
+
     @unittest.skipUnless(HASH is not None, 'need _hashlib')
-    def test_internal_types(self):
+    def test_hash_disallow_instantiation(self):
         # internal types like _hashlib.HASH are not constructable
-        with self.assertRaisesRegex(
-            TypeError, "cannot create 'HASH' instance"
-        ):
-            HASH()
-        with self.assertRaisesRegex(
-            TypeError, "cannot create 'HASHXOF' instance"
-        ):
-            HASHXOF()
+        support.check_disallow_instantiation(self, HASH)
+        support.check_disallow_instantiation(self, HASHXOF)
+
+    def test_readonly_types(self):
+        for algorithm, constructors in self.constructors_to_test.items():
+            # all other types have DISALLOW_INSTANTIATION
+            for constructor in constructors:
+                # In FIPS mode some algorithms are not available raising ValueError
+                try:
+                    hash_type = type(constructor())
+                except ValueError:
+                    continue
+                with self.subTest(hash_type=hash_type):
+                    with self.assertRaisesRegex(TypeError, "immutable type"):
+                        hash_type.value = False
 
 
 class KDFTests(unittest.TestCase):
@@ -1013,7 +1035,7 @@
                     self.assertEqual(out, expected,
                                      (digest_name, password, salt, rounds))
 
-        with self.assertRaisesRegex(ValueError, 'unsupported hash type'):
+        with self.assertRaisesRegex(ValueError, '.*unsupported.*'):
             pbkdf2('unknown', b'pass', b'salt', 1)
 
         if 'sha1' in supported:
@@ -1041,7 +1063,10 @@
 
     @unittest.skipIf(builtin_hashlib is None, "test requires builtin_hashlib")
     def test_pbkdf2_hmac_py(self):
-        self._test_pbkdf2_hmac(builtin_hashlib.pbkdf2_hmac, builtin_hashes)
+        with warnings_helper.check_warnings():
+            self._test_pbkdf2_hmac(
+                builtin_hashlib.pbkdf2_hmac, builtin_hashes
+            )
 
     @unittest.skipUnless(hasattr(openssl_hashlib, 'pbkdf2_hmac'),
                      '   test requires OpenSSL > 1.0')
@@ -1050,6 +1075,7 @@
 
     @unittest.skipUnless(hasattr(hashlib, 'scrypt'),
                      '   test requires OpenSSL > 1.1')
+    @unittest.skipIf(get_fips_mode(), reason="scrypt is blocked in FIPS mode")
     def test_scrypt(self):
         for password, salt, n, r, p, expected in self.scrypt_test_vectors:
             result = hashlib.scrypt(password, salt=salt, n=n, r=r, p=p)
diff --git a/Lib/test/test_heapq.py b/Lib/test/test_heapq.py
index 6902573..cb1e450 100644
--- a/Lib/test/test_heapq.py
+++ b/Lib/test/test_heapq.py
@@ -5,11 +5,12 @@
 import doctest
 
 from test import support
+from test.support import import_helper
 from unittest import TestCase, skipUnless
 from operator import itemgetter
 
-py_heapq = support.import_fresh_module('heapq', blocked=['_heapq'])
-c_heapq = support.import_fresh_module('heapq', fresh=['_heapq'])
+py_heapq = import_helper.import_fresh_module('heapq', blocked=['_heapq'])
+c_heapq = import_helper.import_fresh_module('heapq', fresh=['_heapq'])
 
 # _heapq.nlargest/nsmallest are saved in heapq._nlargest/_smallest when
 # _heapq is imported, so check them there
@@ -145,11 +146,11 @@
         self.assertEqual(type(h[0]), int)
         self.assertEqual(type(x), float)
 
-        h = [10];
+        h = [10]
         x = self.module.heappushpop(h, 9)
         self.assertEqual((h, x), ([10], 9))
 
-        h = [10];
+        h = [10]
         x = self.module.heappushpop(h, 11)
         self.assertEqual((h, x), ([11], 10))
 
diff --git a/Lib/test/test_hmac.py b/Lib/test/test_hmac.py
index 6daf22c..7cf9973 100644
--- a/Lib/test/test_hmac.py
+++ b/Lib/test/test_hmac.py
@@ -6,19 +6,26 @@
 import unittest.mock
 import warnings
 
-from test.support import hashlib_helper
+from test.support import hashlib_helper, check_disallow_instantiation
 
 from _operator import _compare_digest as operator_compare_digest
 
 try:
+    import _hashlib as _hashopenssl
     from _hashlib import HMAC as C_HMAC
     from _hashlib import hmac_new as c_hmac_new
     from _hashlib import compare_digest as openssl_compare_digest
 except ImportError:
+    _hashopenssl = None
     C_HMAC = None
     c_hmac_new = None
     openssl_compare_digest = None
 
+try:
+    import _sha256 as sha256_module
+except ImportError:
+    sha256_module = None
+
 
 def ignore_warning(func):
     @functools.wraps(func)
@@ -32,22 +39,27 @@
 
 class TestVectorsTestCase(unittest.TestCase):
 
-    def asssert_hmac(
-        self, key, data, digest, hashfunc, hashname, digest_size, block_size
+    def assert_hmac_internals(
+            self, h, digest, hashname, digest_size, block_size
     ):
-        h = hmac.HMAC(key, data, digestmod=hashfunc)
         self.assertEqual(h.hexdigest().upper(), digest.upper())
         self.assertEqual(h.digest(), binascii.unhexlify(digest))
         self.assertEqual(h.name, f"hmac-{hashname}")
         self.assertEqual(h.digest_size, digest_size)
         self.assertEqual(h.block_size, block_size)
 
+    def assert_hmac(
+        self, key, data, digest, hashfunc, hashname, digest_size, block_size
+    ):
+        h = hmac.HMAC(key, data, digestmod=hashfunc)
+        self.assert_hmac_internals(
+            h, digest, hashname, digest_size, block_size
+        )
+
         h = hmac.HMAC(key, data, digestmod=hashname)
-        self.assertEqual(h.hexdigest().upper(), digest.upper())
-        self.assertEqual(h.digest(), binascii.unhexlify(digest))
-        self.assertEqual(h.name, f"hmac-{hashname}")
-        self.assertEqual(h.digest_size, digest_size)
-        self.assertEqual(h.block_size, block_size)
+        self.assert_hmac_internals(
+            h, digest, hashname, digest_size, block_size
+        )
 
         h = hmac.HMAC(key, digestmod=hashname)
         h2 = h.copy()
@@ -56,11 +68,9 @@
         self.assertEqual(h.hexdigest().upper(), digest.upper())
 
         h = hmac.new(key, data, digestmod=hashname)
-        self.assertEqual(h.hexdigest().upper(), digest.upper())
-        self.assertEqual(h.digest(), binascii.unhexlify(digest))
-        self.assertEqual(h.name, f"hmac-{hashname}")
-        self.assertEqual(h.digest_size, digest_size)
-        self.assertEqual(h.block_size, block_size)
+        self.assert_hmac_internals(
+            h, digest, hashname, digest_size, block_size
+        )
 
         h = hmac.new(key, None, digestmod=hashname)
         h.update(data)
@@ -81,23 +91,18 @@
             hmac.digest(key, data, digest=hashfunc),
             binascii.unhexlify(digest)
         )
-        with unittest.mock.patch('hmac._openssl_md_meths', {}):
-            self.assertEqual(
-                hmac.digest(key, data, digest=hashname),
-                binascii.unhexlify(digest)
-            )
-            self.assertEqual(
-                hmac.digest(key, data, digest=hashfunc),
-                binascii.unhexlify(digest)
-            )
+
+        h = hmac.HMAC.__new__(hmac.HMAC)
+        h._init_old(key, data, digestmod=hashname)
+        self.assert_hmac_internals(
+            h, digest, hashname, digest_size, block_size
+        )
 
         if c_hmac_new is not None:
             h = c_hmac_new(key, data, digestmod=hashname)
-            self.assertEqual(h.hexdigest().upper(), digest.upper())
-            self.assertEqual(h.digest(), binascii.unhexlify(digest))
-            self.assertEqual(h.name, f"hmac-{hashname}")
-            self.assertEqual(h.digest_size, digest_size)
-            self.assertEqual(h.block_size, block_size)
+            self.assert_hmac_internals(
+                h, digest, hashname, digest_size, block_size
+            )
 
             h = c_hmac_new(key, digestmod=hashname)
             h2 = h.copy()
@@ -105,12 +110,24 @@
             h.update(data)
             self.assertEqual(h.hexdigest().upper(), digest.upper())
 
+            func = getattr(_hashopenssl, f"openssl_{hashname}")
+            h = c_hmac_new(key, data, digestmod=func)
+            self.assert_hmac_internals(
+                h, digest, hashname, digest_size, block_size
+            )
+
+            h = hmac.HMAC.__new__(hmac.HMAC)
+            h._init_hmac(key, data, digestmod=hashname)
+            self.assert_hmac_internals(
+                h, digest, hashname, digest_size, block_size
+            )
+
     @hashlib_helper.requires_hashdigest('md5', openssl=True)
     def test_md5_vectors(self):
         # Test the HMAC module against test vectors from the RFC.
 
         def md5test(key, data, digest):
-            self.asssert_hmac(
+            self.assert_hmac(
                 key, data, digest,
                 hashfunc=hashlib.md5,
                 hashname="md5",
@@ -150,7 +167,7 @@
     @hashlib_helper.requires_hashdigest('sha1', openssl=True)
     def test_sha_vectors(self):
         def shatest(key, data, digest):
-            self.asssert_hmac(
+            self.assert_hmac(
                 key, data, digest,
                 hashfunc=hashlib.sha1,
                 hashname="sha1",
@@ -191,7 +208,7 @@
         def hmactest(key, data, hexdigests):
             digest = hexdigests[hashfunc]
 
-            self.asssert_hmac(
+            self.assert_hmac(
                 key, data, digest,
                 hashfunc=hashfunc,
                 hashname=hash_name,
@@ -422,10 +439,18 @@
     @unittest.skipUnless(C_HMAC is not None, 'need _hashlib')
     def test_internal_types(self):
         # internal types like _hashlib.C_HMAC are not constructable
-        with self.assertRaisesRegex(
-            TypeError, "cannot create 'HMAC' instance"
-        ):
-            C_HMAC()
+        check_disallow_instantiation(self, C_HMAC)
+        with self.assertRaisesRegex(TypeError, "immutable type"):
+            C_HMAC.value = None
+
+    @unittest.skipUnless(sha256_module is not None, 'need _sha256')
+    def test_with_sha256_module(self):
+        h = hmac.HMAC(b"key", b"hash this!", digestmod=sha256_module.sha256)
+        self.assertEqual(h.hexdigest(), self.expected)
+        self.assertEqual(h.name, "hmac-sha256")
+
+        digest = hmac.digest(b"key", b"hash this!", sha256_module.sha256)
+        self.assertEqual(digest, binascii.unhexlify(self.expected))
 
 
 class SanityTestCase(unittest.TestCase):
@@ -447,21 +472,21 @@
 class CopyTestCase(unittest.TestCase):
 
     @hashlib_helper.requires_hashdigest('sha256')
-    def test_attributes(self):
+    def test_attributes_old(self):
         # Testing if attributes are of same type.
-        h1 = hmac.HMAC(b"key", digestmod="sha256")
+        h1 = hmac.HMAC.__new__(hmac.HMAC)
+        h1._init_old(b"key", b"msg", digestmod="sha256")
         h2 = h1.copy()
-        self.assertTrue(h1._digest_cons == h2._digest_cons,
-            "digest constructors don't match.")
         self.assertEqual(type(h1._inner), type(h2._inner),
             "Types of inner don't match.")
         self.assertEqual(type(h1._outer), type(h2._outer),
             "Types of outer don't match.")
 
     @hashlib_helper.requires_hashdigest('sha256')
-    def test_realcopy(self):
+    def test_realcopy_old(self):
         # Testing if the copy method created a real copy.
-        h1 = hmac.HMAC(b"key", digestmod="sha256")
+        h1 = hmac.HMAC.__new__(hmac.HMAC)
+        h1._init_old(b"key", b"msg", digestmod="sha256")
         h2 = h1.copy()
         # Using id() in case somebody has overridden __eq__/__ne__.
         self.assertTrue(id(h1) != id(h2), "No real copy of the HMAC instance.")
@@ -469,17 +494,15 @@
             "No real copy of the attribute 'inner'.")
         self.assertTrue(id(h1._outer) != id(h2._outer),
             "No real copy of the attribute 'outer'.")
-        self.assertEqual(h1._inner, h1.inner)
-        self.assertEqual(h1._outer, h1.outer)
-        self.assertEqual(h1._digest_cons, h1.digest_cons)
+        self.assertIs(h1._hmac, None)
 
+    @unittest.skipIf(_hashopenssl is None, "test requires _hashopenssl")
     @hashlib_helper.requires_hashdigest('sha256')
-    def test_properties(self):
-        # deprecated properties
-        h1 = hmac.HMAC(b"key", digestmod="sha256")
-        self.assertEqual(h1._inner, h1.inner)
-        self.assertEqual(h1._outer, h1.outer)
-        self.assertEqual(h1._digest_cons, h1.digest_cons)
+    def test_realcopy_hmac(self):
+        h1 = hmac.HMAC.__new__(hmac.HMAC)
+        h1._init_hmac(b"key", b"msg", digestmod="sha256")
+        h2 = h1.copy()
+        self.assertTrue(id(h1._hmac) != id(h2._hmac))
 
     @hashlib_helper.requires_hashdigest('sha256')
     def test_equality(self):
diff --git a/Lib/test/test_htmlparser.py b/Lib/test/test_htmlparser.py
index a2bfb39..1291775 100644
--- a/Lib/test/test_htmlparser.py
+++ b/Lib/test/test_htmlparser.py
@@ -452,42 +452,6 @@
         self._run_check('<!spacer type="block" height="25">',
                         [('comment', 'spacer type="block" height="25"')])
 
-    def test_with_unquoted_attributes(self):
-        # see #12008
-        html = ("<html><body bgcolor=d0ca90 text='181008'>"
-                "<table cellspacing=0 cellpadding=1 width=100% ><tr>"
-                "<td align=left><font size=-1>"
-                "- <a href=/rabota/><span class=en> software-and-i</span></a>"
-                "- <a href='/1/'><span class=en> library</span></a></table>")
-        expected = [
-            ('starttag', 'html', []),
-            ('starttag', 'body', [('bgcolor', 'd0ca90'), ('text', '181008')]),
-            ('starttag', 'table',
-                [('cellspacing', '0'), ('cellpadding', '1'), ('width', '100%')]),
-            ('starttag', 'tr', []),
-            ('starttag', 'td', [('align', 'left')]),
-            ('starttag', 'font', [('size', '-1')]),
-            ('data', '- '), ('starttag', 'a', [('href', '/rabota/')]),
-            ('starttag', 'span', [('class', 'en')]), ('data', ' software-and-i'),
-            ('endtag', 'span'), ('endtag', 'a'),
-            ('data', '- '), ('starttag', 'a', [('href', '/1/')]),
-            ('starttag', 'span', [('class', 'en')]), ('data', ' library'),
-            ('endtag', 'span'), ('endtag', 'a'), ('endtag', 'table')
-        ]
-        self._run_check(html, expected)
-
-    def test_comma_between_attributes(self):
-        self._run_check('<form action="/xxx.php?a=1&amp;b=2&amp", '
-                        'method="post">', [
-                            ('starttag', 'form',
-                                [('action', '/xxx.php?a=1&b=2&'),
-                                 (',', None), ('method', 'post')])])
-
-    def test_weird_chars_in_unquoted_attribute_values(self):
-        self._run_check('<form action=bogus|&#()value>', [
-                            ('starttag', 'form',
-                                [('action', 'bogus|&#()value')])])
-
     def test_invalid_end_tags(self):
         # A collection of broken end tags. <br> is used as separator.
         # see http://www.w3.org/TR/html5/tokenization.html#end-tag-open-state
@@ -766,6 +730,62 @@
                           [("href", "http://www.example.org/\">;")]),
                          ("data", "spam"), ("endtag", "a")])
 
+    def test_with_unquoted_attributes(self):
+        # see #12008
+        html = ("<html><body bgcolor=d0ca90 text='181008'>"
+                "<table cellspacing=0 cellpadding=1 width=100% ><tr>"
+                "<td align=left><font size=-1>"
+                "- <a href=/rabota/><span class=en> software-and-i</span></a>"
+                "- <a href='/1/'><span class=en> library</span></a></table>")
+        expected = [
+            ('starttag', 'html', []),
+            ('starttag', 'body', [('bgcolor', 'd0ca90'), ('text', '181008')]),
+            ('starttag', 'table',
+                [('cellspacing', '0'), ('cellpadding', '1'), ('width', '100%')]),
+            ('starttag', 'tr', []),
+            ('starttag', 'td', [('align', 'left')]),
+            ('starttag', 'font', [('size', '-1')]),
+            ('data', '- '), ('starttag', 'a', [('href', '/rabota/')]),
+            ('starttag', 'span', [('class', 'en')]), ('data', ' software-and-i'),
+            ('endtag', 'span'), ('endtag', 'a'),
+            ('data', '- '), ('starttag', 'a', [('href', '/1/')]),
+            ('starttag', 'span', [('class', 'en')]), ('data', ' library'),
+            ('endtag', 'span'), ('endtag', 'a'), ('endtag', 'table')
+        ]
+        self._run_check(html, expected)
+
+    def test_comma_between_attributes(self):
+        # see bpo 41478
+        # HTMLParser preserves duplicate attributes, leaving the task of
+        # removing duplicate attributes to a conformant html tree builder
+        html = ('<div class=bar,baz=asd>'        # between attrs (unquoted)
+                '<div class="bar",baz="asd">'    # between attrs (quoted)
+                '<div class=bar, baz=asd,>'      # after values (unquoted)
+                '<div class="bar", baz="asd",>'  # after values (quoted)
+                '<div class="bar",>'             # one comma values (quoted)
+                '<div class=,bar baz=,asd>'      # before values (unquoted)
+                '<div class=,"bar" baz=,"asd">'  # before values (quoted)
+                '<div ,class=bar ,baz=asd>'      # before names
+                '<div class,="bar" baz,="asd">'  # after names
+        )
+        expected = [
+            ('starttag', 'div', [('class', 'bar,baz=asd'),]),
+            ('starttag', 'div', [('class', 'bar'), (',baz', 'asd')]),
+            ('starttag', 'div', [('class', 'bar,'), ('baz', 'asd,')]),
+            ('starttag', 'div', [('class', 'bar'), (',', None),
+                                 ('baz', 'asd'), (',', None)]),
+            ('starttag', 'div', [('class', 'bar'), (',', None)]),
+            ('starttag', 'div', [('class', ',bar'), ('baz', ',asd')]),
+            ('starttag', 'div', [('class', ',"bar"'), ('baz', ',"asd"')]),
+            ('starttag', 'div', [(',class', 'bar'), (',baz', 'asd')]),
+            ('starttag', 'div', [('class,', 'bar'), ('baz,', 'asd')]),
+        ]
+        self._run_check(html, expected)
+
+    def test_weird_chars_in_unquoted_attribute_values(self):
+        self._run_check('<form action=bogus|&#()value>', [
+                            ('starttag', 'form',
+                                [('action', 'bogus|&#()value')])])
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/Lib/test/test_http_cookiejar.py b/Lib/test/test_http_cookiejar.py
index 2d7077a..9450104 100644
--- a/Lib/test/test_http_cookiejar.py
+++ b/Lib/test/test_http_cookiejar.py
@@ -3,6 +3,8 @@
 import os
 import re
 import test.support
+from test.support import os_helper
+from test.support import warnings_helper
 import time
 import unittest
 import urllib.request
@@ -328,12 +330,12 @@
 
 class FileCookieJarTests(unittest.TestCase):
     def test_constructor_with_str(self):
-        filename = test.support.TESTFN
+        filename = os_helper.TESTFN
         c = LWPCookieJar(filename)
         self.assertEqual(c.filename, filename)
 
     def test_constructor_with_path_like(self):
-        filename = pathlib.Path(test.support.TESTFN)
+        filename = pathlib.Path(os_helper.TESTFN)
         c = LWPCookieJar(filename)
         self.assertEqual(c.filename, os.fspath(filename))
 
@@ -353,7 +355,7 @@
 
     def test_lwp_valueless_cookie(self):
         # cookies with no value should be saved and loaded consistently
-        filename = test.support.TESTFN
+        filename = os_helper.TESTFN
         c = LWPCookieJar()
         interact_netscape(c, "http://www.acme.com/", 'boo')
         self.assertEqual(c._cookies["www.acme.com"]["/"]["boo"].value, None)
@@ -368,7 +370,7 @@
 
     def test_bad_magic(self):
         # OSErrors (eg. file doesn't exist) are allowed to propagate
-        filename = test.support.TESTFN
+        filename = os_helper.TESTFN
         for cookiejar_class in LWPCookieJar, MozillaCookieJar:
             c = cookiejar_class()
             try:
@@ -475,7 +477,7 @@
     def test_missing_value(self):
         # missing = sign in Cookie: header is regarded by Mozilla as a missing
         # name, and by http.cookiejar as a missing value
-        filename = test.support.TESTFN
+        filename = os_helper.TESTFN
         c = MozillaCookieJar(filename)
         interact_netscape(c, "http://www.acme.com/", 'eggs')
         interact_netscape(c, "http://www.acme.com/", '"spam"; path=/foo/')
@@ -599,7 +601,7 @@
         c = CookieJar()
         future = time2netscape(time.time()+3600)
 
-        with test.support.check_no_warnings(self):
+        with warnings_helper.check_no_warnings(self):
             headers = [f"Set-Cookie: FOO=BAR; path=/; expires={future}"]
             req = urllib.request.Request("http://www.coyote.com/")
             res = FakeResponse(headers, "http://www.coyote.com/")
@@ -1713,7 +1715,7 @@
         self.assertEqual(len(c), 6)
 
         # save and restore
-        filename = test.support.TESTFN
+        filename = os_helper.TESTFN
 
         try:
             c.save(filename, ignore_discard=True)
@@ -1753,7 +1755,7 @@
         # Save / load Mozilla/Netscape cookie file format.
         year_plus_one = time.localtime()[0] + 1
 
-        filename = test.support.TESTFN
+        filename = os_helper.TESTFN
 
         c = MozillaCookieJar(filename,
                              policy=DefaultCookiePolicy(rfc2965=True))
@@ -1771,6 +1773,10 @@
         interact_netscape(c, "http://www.foo.com/",
                           "fooc=bar; Domain=www.foo.com; %s" % expires)
 
+        for cookie in c:
+            if cookie.name == "foo1":
+                cookie.set_nonstandard_attr("HTTPOnly", "")
+
         def save_and_restore(cj, ignore_discard):
             try:
                 cj.save(ignore_discard=ignore_discard)
@@ -1785,6 +1791,7 @@
         new_c = save_and_restore(c, True)
         self.assertEqual(len(new_c), 6)  # none discarded
         self.assertIn("name='foo1', value='bar'", repr(new_c))
+        self.assertIn("rest={'HTTPOnly': ''}", repr(new_c))
 
         new_c = save_and_restore(c, False)
         self.assertEqual(len(new_c), 4)  # 2 of them discarded on save
@@ -1913,14 +1920,5 @@
         self.assertNotEqual(counter["session_before"], 0)
 
 
-def test_main(verbose=None):
-    test.support.run_unittest(
-        DateTimeTests,
-        HeaderTests,
-        CookieTests,
-        FileCookieJarTests,
-        LWPCookieTests,
-        )
-
 if __name__ == "__main__":
-    test_main(verbose=True)
+    unittest.main()
diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py
index ed12589..77152cf 100644
--- a/Lib/test/test_httplib.py
+++ b/Lib/test/test_httplib.py
@@ -1,5 +1,5 @@
 import errno
-from http import client
+from http import client, HTTPStatus
 import io
 import itertools
 import os
@@ -10,10 +10,14 @@
 import warnings
 
 import unittest
+from unittest import mock
 TestCase = unittest.TestCase
 
 from test import support
+from test.support import os_helper
 from test.support import socket_helper
+from test.support import warnings_helper
+
 
 here = os.path.dirname(__file__)
 # Self-signed cert file for 'localhost'
@@ -516,6 +520,10 @@
 
 
 class BasicTest(TestCase):
+    def test_dir_with_added_behavior_on_status(self):
+        # see issue40084
+        self.assertTrue({'description', 'name', 'phrase', 'value'} <= set(dir(HTTPStatus(404))))
+
     def test_status_lines(self):
         # Test HTTP status lines
 
@@ -591,6 +599,33 @@
         resp.close()
         self.assertTrue(resp.closed)
 
+    def test_partial_reads_past_end(self):
+        # if we have Content-Length, clip reads to the end
+        body = "HTTP/1.1 200 Ok\r\nContent-Length: 4\r\n\r\nText"
+        sock = FakeSocket(body)
+        resp = client.HTTPResponse(sock)
+        resp.begin()
+        self.assertEqual(resp.read(10), b'Text')
+        self.assertTrue(resp.isclosed())
+        self.assertFalse(resp.closed)
+        resp.close()
+        self.assertTrue(resp.closed)
+
+    def test_partial_readintos_past_end(self):
+        # if we have Content-Length, clip readintos to the end
+        body = "HTTP/1.1 200 Ok\r\nContent-Length: 4\r\n\r\nText"
+        sock = FakeSocket(body)
+        resp = client.HTTPResponse(sock)
+        resp.begin()
+        b = bytearray(10)
+        n = resp.readinto(b)
+        self.assertEqual(n, 4)
+        self.assertEqual(bytes(b)[:4], b'Text')
+        self.assertTrue(resp.isclosed())
+        self.assertFalse(resp.closed)
+        resp.close()
+        self.assertTrue(resp.closed)
+
     def test_partial_reads_no_content_length(self):
         # when no length is present, the socket should be gracefully closed when
         # all data was read
@@ -1000,6 +1035,19 @@
         resp = client.HTTPResponse(FakeSocket(body))
         self.assertRaises(client.LineTooLong, resp.begin)
 
+    def test_overflowing_header_limit_after_100(self):
+        body = (
+            'HTTP/1.1 100 OK\r\n'
+            'r\n' * 32768
+        )
+        resp = client.HTTPResponse(FakeSocket(body))
+        with self.assertRaises(client.HTTPException) as cm:
+            resp.begin()
+        # We must assert more because other reasonable errors that we
+        # do not want can also be HTTPException derived.
+        self.assertIn('got more than ', str(cm.exception))
+        self.assertIn('headers', str(cm.exception))
+
     def test_overflowing_chunked_line(self):
         body = (
             'HTTP/1.1 200 OK\r\n'
@@ -1401,12 +1449,12 @@
 class OfflineTest(TestCase):
     def test_all(self):
         # Documented objects defined in the module should be in __all__
-        expected = {"responses"}  # White-list documented dict() object
+        expected = {"responses"}  # Allowlist documented dict() object
         # HTTPMessage, parse_headers(), and the HTTP status code constants are
         # intentionally omitted for simplicity
-        blacklist = {"HTTPMessage", "parse_headers"}
+        denylist = {"HTTPMessage", "parse_headers"}
         for name in dir(client):
-            if name.startswith("_") or name in blacklist:
+            if name.startswith("_") or name in denylist:
                 continue
             module_object = getattr(client, name)
             if getattr(module_object, "__module__", None) == "http.client":
@@ -1761,14 +1809,14 @@
         with self.assertRaises(ssl.CertificateError):
             h.request('GET', '/')
         # Same with explicit check_hostname=True
-        with support.check_warnings(('', DeprecationWarning)):
+        with warnings_helper.check_warnings(('', DeprecationWarning)):
             h = client.HTTPSConnection('localhost', server.port,
                                        context=context, check_hostname=True)
         with self.assertRaises(ssl.CertificateError):
             h.request('GET', '/')
         # With check_hostname=False, the mismatching is ignored
         context.check_hostname = False
-        with support.check_warnings(('', DeprecationWarning)):
+        with warnings_helper.check_warnings(('', DeprecationWarning)):
             h = client.HTTPSConnection('localhost', server.port,
                                        context=context, check_hostname=False)
         h.request('GET', '/nonexistent')
@@ -1787,7 +1835,7 @@
         h.close()
         # Passing check_hostname to HTTPSConnection should override the
         # context's setting.
-        with support.check_warnings(('', DeprecationWarning)):
+        with warnings_helper.check_warnings(('', DeprecationWarning)):
             h = client.HTTPSConnection('localhost', server.port,
                                        context=context, check_hostname=True)
         with self.assertRaises(ssl.CertificateError):
@@ -1903,10 +1951,10 @@
         self.assertEqual(b'body\xc1', f.read())
 
     def test_text_file_body(self):
-        self.addCleanup(support.unlink, support.TESTFN)
-        with open(support.TESTFN, "w") as f:
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
+        with open(os_helper.TESTFN, "w", encoding="utf-8") as f:
             f.write("body")
-        with open(support.TESTFN) as f:
+        with open(os_helper.TESTFN, encoding="utf-8") as f:
             self.conn.request("PUT", "/url", f)
             message, f = self.get_headers_and_fp()
             self.assertEqual("text/plain", message.get_content_type())
@@ -1918,10 +1966,10 @@
             self.assertEqual(b'4\r\nbody\r\n0\r\n\r\n', f.read())
 
     def test_binary_file_body(self):
-        self.addCleanup(support.unlink, support.TESTFN)
-        with open(support.TESTFN, "wb") as f:
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
+        with open(os_helper.TESTFN, "wb") as f:
             f.write(b"body\xc1")
-        with open(support.TESTFN, "rb") as f:
+        with open(os_helper.TESTFN, "rb") as f:
             self.conn.request("PUT", "/url", f)
             message, f = self.get_headers_and_fp()
             self.assertEqual("text/plain", message.get_content_type())
@@ -2017,6 +2065,23 @@
         # This test should be removed when CONNECT gets the HTTP/1.1 blessing
         self.assertNotIn(b'Host: proxy.com', self.conn.sock.data)
 
+    def test_tunnel_connect_single_send_connection_setup(self):
+        """Regresstion test for https://bugs.python.org/issue43332."""
+        with mock.patch.object(self.conn, 'send') as mock_send:
+            self.conn.set_tunnel('destination.com')
+            self.conn.connect()
+            self.conn.request('GET', '/')
+        mock_send.assert_called()
+        # Likely 2, but this test only cares about the first.
+        self.assertGreater(
+                len(mock_send.mock_calls), 1,
+                msg=f'unexpected number of send calls: {mock_send.mock_calls}')
+        proxy_setup_data_sent = mock_send.mock_calls[0][1][0]
+        self.assertIn(b'CONNECT destination.com', proxy_setup_data_sent)
+        self.assertTrue(
+                proxy_setup_data_sent.endswith(b'\r\n\r\n'),
+                msg=f'unexpected proxy data sent {proxy_setup_data_sent!r}')
+
     def test_connect_put_request(self):
         self.conn.set_tunnel('destination.com')
         self.conn.request('PUT', '/', '')
diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py
index 8df0b52..1cc020f 100644
--- a/Lib/test/test_httpservers.py
+++ b/Lib/test/test_httpservers.py
@@ -30,6 +30,8 @@
 
 import unittest
 from test import support
+from test.support import os_helper
+from test.support import threading_helper
 
 
 class NoLogRequestHandler:
@@ -64,8 +66,8 @@
 
 class BaseTestCase(unittest.TestCase):
     def setUp(self):
-        self._threads = support.threading_setup()
-        os.environ = support.EnvironmentVarGuard()
+        self._threads = threading_helper.threading_setup()
+        os.environ = os_helper.EnvironmentVarGuard()
         self.server_started = threading.Event()
         self.thread = TestServerThread(self, self.request_handler)
         self.thread.start()
@@ -75,7 +77,7 @@
         self.thread.stop()
         self.thread = None
         os.environ.__exit__()
-        support.threading_cleanup(*self._threads)
+        threading_helper.threading_cleanup(*self._threads)
 
     def request(self, uri, method='GET', body=None, headers={}):
         self.connection = http.client.HTTPConnection(self.HOST, self.PORT)
@@ -390,13 +392,13 @@
                      'undecodable name cannot always be decoded on macOS')
     @unittest.skipIf(sys.platform == 'win32',
                      'undecodable name cannot be decoded on win32')
-    @unittest.skipUnless(support.TESTFN_UNDECODABLE,
-                         'need support.TESTFN_UNDECODABLE')
+    @unittest.skipUnless(os_helper.TESTFN_UNDECODABLE,
+                         'need os_helper.TESTFN_UNDECODABLE')
     def test_undecodable_filename(self):
         enc = sys.getfilesystemencoding()
-        filename = os.fsdecode(support.TESTFN_UNDECODABLE) + '.txt'
+        filename = os.fsdecode(os_helper.TESTFN_UNDECODABLE) + '.txt'
         with open(os.path.join(self.tempdir, filename), 'wb') as f:
-            f.write(support.TESTFN_UNDECODABLE)
+            f.write(os_helper.TESTFN_UNDECODABLE)
         response = self.request(self.base_url + '/')
         if sys.platform == 'darwin':
             # On Mac OS the HFS+ filesystem replaces bytes that aren't valid
@@ -413,7 +415,7 @@
                       .encode(enc, 'surrogateescape'), body)
         response = self.request(self.base_url + '/' + quotedname)
         self.check_status_and_reason(response, HTTPStatus.OK,
-                                     data=support.TESTFN_UNDECODABLE)
+                                     data=os_helper.TESTFN_UNDECODABLE)
 
     def test_get(self):
         #constructs the path relative to the root directory of the HTTPServer
@@ -426,6 +428,7 @@
         self.check_status_and_reason(response, HTTPStatus.OK)
         response = self.request(self.base_url)
         self.check_status_and_reason(response, HTTPStatus.MOVED_PERMANENTLY)
+        self.assertEqual(response.getheader("Content-Length"), "0")
         response = self.request(self.base_url + '/?hi=2')
         self.check_status_and_reason(response, HTTPStatus.OK)
         response = self.request(self.base_url + '?hi=1')
@@ -539,7 +542,7 @@
         fullpath = os.path.join(self.tempdir, filename)
 
         try:
-            open(fullpath, 'w').close()
+            open(fullpath, 'wb').close()
         except OSError:
             raise unittest.SkipTest('Can not create file %s on current file '
                                     'system' % filename)
@@ -590,9 +593,18 @@
 #!%s
 import os
 
-print("Content-type: text/plain")
+print("X-ambv: was here")
+print("Content-type: text/html")
 print()
-print(repr(os.environ))
+print("<pre>")
+for k, v in os.environ.items():
+    try:
+        k.encode('ascii')
+        v.encode('ascii')
+    except UnicodeEncodeError:
+        continue  # see: BPO-44647
+    print(f"{k}={v}")
+print("</pre>")
 """
 
 
@@ -628,7 +640,7 @@
         # The shebang line should be pure ASCII: use symlink if possible.
         # See issue #7668.
         self._pythonexe_symlink = None
-        if support.can_symlink():
+        if os_helper.can_symlink():
             self.pythonexe = os.path.join(self.parent_dir, 'python')
             self._pythonexe_symlink = support.PythonSymlink(self.pythonexe).__enter__()
         else:
@@ -644,7 +656,7 @@
             self.skipTest("Python executable path is not encodable to utf-8")
 
         self.nocgi_path = os.path.join(self.parent_dir, 'nocgi.py')
-        with open(self.nocgi_path, 'w') as fp:
+        with open(self.nocgi_path, 'w', encoding='utf-8') as fp:
             fp.write(cgi_file1 % self.pythonexe)
         os.chmod(self.nocgi_path, 0o777)
 
@@ -847,8 +859,8 @@
             with self.subTest(headers):
                 res = self.request('/cgi-bin/file6.py', 'GET', headers=headers)
                 self.assertEqual(http.HTTPStatus.OK, res.status)
-                expected = f"'HTTP_ACCEPT': {expected!r}"
-                self.assertIn(expected.encode('ascii'), res.read())
+                expected = f"HTTP_ACCEPT={expected}".encode('ascii')
+                self.assertIn(expected, res.read())
 
 
 class SocketlessRequestHandler(SimpleHTTPRequestHandler):
@@ -1220,9 +1232,9 @@
 class MiscTestCase(unittest.TestCase):
     def test_all(self):
         expected = []
-        blacklist = {'executable', 'nobody_uid', 'test'}
+        denylist = {'executable', 'nobody_uid', 'test'}
         for name in dir(server):
-            if name.startswith('_') or name in blacklist:
+            if name.startswith('_') or name in denylist:
                 continue
             module_object = getattr(server, name)
             if getattr(module_object, '__module__', None) == 'http.server':
@@ -1290,21 +1302,9 @@
             self.assertEqual(mock_server.address_family, socket.AF_INET)
 
 
-def test_main(verbose=None):
-    cwd = os.getcwd()
-    try:
-        support.run_unittest(
-            RequestHandlerLoggingTestCase,
-            BaseHTTPRequestHandlerTestCase,
-            BaseHTTPServerTestCase,
-            SimpleHTTPServerTestCase,
-            CGIHTTPServerTestCase,
-            SimpleHTTPRequestHandlerTestCase,
-            MiscTestCase,
-            ScriptTestCase
-        )
-    finally:
-        os.chdir(cwd)
+def setUpModule():
+    unittest.addModuleCleanup(os.chdir, os.getcwd())
+
 
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_idle.py b/Lib/test/test_idle.py
index 8bc01de..b94b18a 100644
--- a/Lib/test/test_idle.py
+++ b/Lib/test/test_idle.py
@@ -1,5 +1,9 @@
 import unittest
-from test.support import import_module
+from test.support.import_helper import import_module
+from test.support import check_sanitizer
+
+if check_sanitizer(address=True, memory=True):
+    raise unittest.SkipTest("Tests involvin libX11 can SEGFAULT on ASAN/MSAN builds")
 
 # Skip test_idle if _tkinter wasn't built, if tkinter is missing,
 # if tcl/tk is not the 8.5+ needed for ttk widgets,
@@ -20,5 +24,5 @@
 if __name__ == '__main__':
     tk.NoDefaultRoot()
     unittest.main(exit=False)
-    tk._support_default_root = 1
+    tk._support_default_root = True
     tk._default_root = None
diff --git a/Lib/test/test_imaplib.py b/Lib/test/test_imaplib.py
index 914a75a..30b5537 100644
--- a/Lib/test/test_imaplib.py
+++ b/Lib/test/test_imaplib.py
@@ -10,9 +10,11 @@
 import threading
 import socket
 
-from test.support import (reap_threads, verbose,
+from test.support import (verbose,
                           run_with_tz, run_with_locale, cpython_only)
 from test.support import hashlib_helper
+from test.support import threading_helper
+from test.support import warnings_helper
 import unittest
 from unittest import mock
 from datetime import datetime, timezone, timedelta
@@ -94,7 +96,7 @@
 
         def get_request(self):
             newsocket, fromaddr = self.socket.accept()
-            context = ssl.SSLContext()
+            context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
             context.load_cert_chain(CERTFILE)
             connstream = context.wrap_socket(newsocket, server_side=True)
             return connstream, fromaddr
@@ -252,7 +254,7 @@
         # cleanup the server
         self.server.shutdown()
         self.server.server_close()
-        support.join_thread(self.thread)
+        threading_helper.join_thread(self.thread)
         # Explicitly clear the attribute to prevent dangling thread
         self.thread = None
 
@@ -385,7 +387,7 @@
         self.assertEqual(code, 'OK')
         self.assertEqual(server.response, b'ZmFrZQ==\r\n')  # b64 encoded 'fake'
 
-    @hashlib_helper.requires_hashdigest('md5')
+    @hashlib_helper.requires_hashdigest('md5', openssl=True)
     def test_login_cram_md5_bytes(self):
         class AuthHandler(SimpleIMAPHandler):
             capabilities = 'LOGINDISABLED AUTH=CRAM-MD5'
@@ -403,7 +405,7 @@
         ret, _ = client.login_cram_md5("tim", b"tanstaaftanstaaf")
         self.assertEqual(ret, "OK")
 
-    @hashlib_helper.requires_hashdigest('md5')
+    @hashlib_helper.requires_hashdigest('md5', openssl=True)
     def test_login_cram_md5_plain_text(self):
         class AuthHandler(SimpleIMAPHandler):
             capabilities = 'LOGINDISABLED AUTH=CRAM-MD5'
@@ -474,7 +476,7 @@
 
         _, server = self._setup(TimeoutHandler)
         addr = server.server_address[1]
-        with self.assertRaises(socket.timeout):
+        with self.assertRaises(TimeoutError):
             client = self.imap_class("localhost", addr, timeout=0.001)
 
     def test_with_statement(self):
@@ -574,7 +576,7 @@
     # to CPython stdlib
     @cpython_only
     def test_certfile_arg_warn(self):
-        with support.check_warnings(('', DeprecationWarning)):
+        with warnings_helper.check_warnings(('', DeprecationWarning)):
             with mock.patch.object(self.imap_class, 'open'):
                 with mock.patch.object(self.imap_class, '_connect'):
                     self.imap_class('localhost', 143, certfile=CERTFILE)
@@ -641,13 +643,13 @@
             finally:
                 client.logout()
 
-    @reap_threads
+    @threading_helper.reap_threads
     def test_connect(self):
         with self.reaped_server(SimpleIMAPHandler) as server:
             client = self.imap_class(*server.server_address)
             client.shutdown()
 
-    @reap_threads
+    @threading_helper.reap_threads
     def test_bracket_flags(self):
 
         # This violates RFC 3501, which disallows ']' characters in tag names,
@@ -696,7 +698,7 @@
             typ, [data] = client.response('PERMANENTFLAGS')
             self.assertIn(b'[test]', data)
 
-    @reap_threads
+    @threading_helper.reap_threads
     def test_issue5949(self):
 
         class EOFHandler(socketserver.StreamRequestHandler):
@@ -708,7 +710,7 @@
             self.assertRaises(imaplib.IMAP4.abort,
                               self.imap_class, *server.server_address)
 
-    @reap_threads
+    @threading_helper.reap_threads
     def test_line_termination(self):
 
         class BadNewlineHandler(SimpleIMAPHandler):
@@ -732,7 +734,7 @@
             self.server.response = yield
             self._send_tagged(tag, 'OK', 'FAKEAUTH successful')
 
-    @reap_threads
+    @threading_helper.reap_threads
     def test_enable_raises_error_if_not_AUTH(self):
         with self.reaped_pair(self.UTF8Server) as (server, client):
             self.assertFalse(client.utf8_enabled)
@@ -741,14 +743,14 @@
 
     # XXX Also need a test that enable after SELECT raises an error.
 
-    @reap_threads
+    @threading_helper.reap_threads
     def test_enable_raises_error_if_no_capability(self):
         class NoEnableServer(self.UTF8Server):
             capabilities = 'AUTH'
         with self.reaped_pair(NoEnableServer) as (server, client):
             self.assertRaises(imaplib.IMAP4.error, client.enable, 'foo')
 
-    @reap_threads
+    @threading_helper.reap_threads
     def test_enable_UTF8_raises_error_if_not_supported(self):
         class NonUTF8Server(SimpleIMAPHandler):
             pass
@@ -759,7 +761,7 @@
                 client.enable('UTF8=ACCEPT')
                 pass
 
-    @reap_threads
+    @threading_helper.reap_threads
     def test_enable_UTF8_True_append(self):
 
         class UTF8AppendServer(self.UTF8Server):
@@ -789,7 +791,7 @@
     # XXX also need a test that makes sure that the Literal and Untagged_status
     # regexes uses unicode in UTF8 mode instead of the default ASCII.
 
-    @reap_threads
+    @threading_helper.reap_threads
     def test_search_disallows_charset_in_utf8_mode(self):
         with self.reaped_pair(self.UTF8Server) as (server, client):
             typ, _ = client.authenticate('MYAUTH', lambda x: b'fake')
@@ -799,7 +801,7 @@
             self.assertTrue(client.utf8_enabled)
             self.assertRaises(imaplib.IMAP4.error, client.search, 'foo', 'bar')
 
-    @reap_threads
+    @threading_helper.reap_threads
     def test_bad_auth_name(self):
 
         class MyServer(SimpleIMAPHandler):
@@ -812,7 +814,7 @@
             with self.assertRaises(imaplib.IMAP4.error):
                 client.authenticate('METHOD', lambda: 1)
 
-    @reap_threads
+    @threading_helper.reap_threads
     def test_invalid_authentication(self):
 
         class MyServer(SimpleIMAPHandler):
@@ -826,7 +828,7 @@
             with self.assertRaises(imaplib.IMAP4.error):
                 code, data = client.authenticate('MYAUTH', lambda x: b'fake')
 
-    @reap_threads
+    @threading_helper.reap_threads
     def test_valid_authentication(self):
 
         class MyServer(SimpleIMAPHandler):
@@ -848,8 +850,8 @@
             self.assertEqual(server.response,
                              b'ZmFrZQ==\r\n')  # b64 encoded 'fake'
 
-    @reap_threads
-    @hashlib_helper.requires_hashdigest('md5')
+    @threading_helper.reap_threads
+    @hashlib_helper.requires_hashdigest('md5', openssl=True)
     def test_login_cram_md5(self):
 
         class AuthHandler(SimpleIMAPHandler):
@@ -877,7 +879,7 @@
             self.assertEqual(ret, "OK")
 
 
-    @reap_threads
+    @threading_helper.reap_threads
     def test_aborted_authentication(self):
 
         class MyServer(SimpleIMAPHandler):
@@ -906,14 +908,14 @@
             self.assertRaises(imaplib.IMAP4.error,
                               self.imap_class, *server.server_address)
 
-    @reap_threads
+    @threading_helper.reap_threads
     def test_simple_with_statement(self):
         # simplest call
         with self.reaped_server(SimpleIMAPHandler) as server:
             with self.imap_class(*server.server_address):
                 pass
 
-    @reap_threads
+    @threading_helper.reap_threads
     def test_with_statement(self):
         with self.reaped_server(SimpleIMAPHandler) as server:
             with self.imap_class(*server.server_address) as imap:
@@ -921,7 +923,7 @@
                 self.assertEqual(server.logged, 'user')
             self.assertIsNone(server.logged)
 
-    @reap_threads
+    @threading_helper.reap_threads
     def test_with_statement_logout(self):
         # what happens if already logout in the block?
         with self.reaped_server(SimpleIMAPHandler) as server:
@@ -932,13 +934,27 @@
                 self.assertIsNone(server.logged)
             self.assertIsNone(server.logged)
 
+    @threading_helper.reap_threads
+    @cpython_only
+    def test_dump_ur(self):
+        # See: http://bugs.python.org/issue26543
+        untagged_resp_dict = {'READ-WRITE': [b'']}
+
+        with self.reaped_server(SimpleIMAPHandler) as server:
+            with self.imap_class(*server.server_address) as imap:
+                with mock.patch.object(imap, '_mesg') as mock_mesg:
+                    imap._dump_ur(untagged_resp_dict)
+                    mock_mesg.assert_called_with(
+                        "untagged responses dump:READ-WRITE: [b'']"
+                    )
+
 
 @unittest.skipUnless(ssl, "SSL not available")
 class ThreadedNetworkedTestsSSL(ThreadedNetworkedTests):
     server_class = SecureTCPServer
     imap_class = IMAP4_SSL
 
-    @reap_threads
+    @threading_helper.reap_threads
     def test_ssl_verified(self):
         ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
         ssl_context.load_verify_locations(CAFILE)
diff --git a/Lib/test/test_imghdr.py b/Lib/test/test_imghdr.py
index 476ba95..b2d1fc8 100644
--- a/Lib/test/test_imghdr.py
+++ b/Lib/test/test_imghdr.py
@@ -4,7 +4,9 @@
 import pathlib
 import unittest
 import warnings
-from test.support import findfile, TESTFN, unlink
+from test.support import findfile
+from test.support.os_helper import TESTFN, unlink
+
 
 TEST_FILES = (
     ('python.png', 'png'),
diff --git a/Lib/test/test_imp.py b/Lib/test/test_imp.py
index fe394dc..5abe28e 100644
--- a/Lib/test/test_imp.py
+++ b/Lib/test/test_imp.py
@@ -5,6 +5,8 @@
 import py_compile
 import sys
 from test import support
+from test.support import import_helper
+from test.support import os_helper
 from test.support import script_helper
 import unittest
 import warnings
@@ -100,15 +102,15 @@
         temp_mod_name = 'test_imp_helper'
         sys.path.insert(0, '.')
         try:
-            with open(temp_mod_name + '.py', 'w') as file:
+            with open(temp_mod_name + '.py', 'w', encoding="latin-1") as file:
                 file.write("# coding: cp1252\nu = 'test.test_imp'\n")
             file, filename, info = imp.find_module(temp_mod_name)
             file.close()
             self.assertEqual(file.encoding, 'cp1252')
         finally:
             del sys.path[0]
-            support.unlink(temp_mod_name + '.py')
-            support.unlink(temp_mod_name + '.pyc')
+            os_helper.unlink(temp_mod_name + '.py')
+            os_helper.unlink(temp_mod_name + '.pyc')
 
     def test_issue5604(self):
         # Test cannot cover imp.load_compiled function.
@@ -155,7 +157,7 @@
             # if the curdir is not in sys.path the test fails when run with
             # ./python ./Lib/test/regrtest.py test_imp
             sys.path.insert(0, os.curdir)
-            with open(temp_mod_name + '.py', 'w') as file:
+            with open(temp_mod_name + '.py', 'w', encoding="utf-8") as file:
                 file.write('a = 1\n')
             file, filename, info = imp.find_module(temp_mod_name)
             with file:
@@ -183,7 +185,7 @@
 
             if not os.path.exists(test_package_name):
                 os.mkdir(test_package_name)
-            with open(init_file_name, 'w') as file:
+            with open(init_file_name, 'w', encoding="utf-8") as file:
                 file.write('b = 2\n')
             with warnings.catch_warnings():
                 warnings.simplefilter('ignore')
@@ -192,10 +194,10 @@
         finally:
             del sys.path[0]
             for ext in ('.py', '.pyc'):
-                support.unlink(temp_mod_name + ext)
-                support.unlink(init_file_name + ext)
-            support.rmtree(test_package_name)
-            support.rmtree('__pycache__')
+                os_helper.unlink(temp_mod_name + ext)
+                os_helper.unlink(init_file_name + ext)
+            os_helper.rmtree(test_package_name)
+            os_helper.rmtree('__pycache__')
 
     def test_issue9319(self):
         path = os.path.dirname(__file__)
@@ -204,7 +206,7 @@
 
     def test_load_from_source(self):
         # Verify that the imp module can correctly load and find .py files
-        # XXX (ncoghlan): It would be nice to use support.CleanImport
+        # XXX (ncoghlan): It would be nice to use import_helper.CleanImport
         # here, but that breaks because the os module registers some
         # handlers in copy_reg on import. Since CleanImport doesn't
         # revert that registration, the module is left in a broken
@@ -213,7 +215,7 @@
         # workaround
         orig_path = os.path
         orig_getenv = os.getenv
-        with support.EnvironmentVarGuard():
+        with os_helper.EnvironmentVarGuard():
             x = imp.find_module("os")
             self.addCleanup(x[0].close)
             new_os = imp.load_module("os", *x)
@@ -299,16 +301,16 @@
     @unittest.skipIf(sys.dont_write_bytecode,
         "test meaningful only when writing bytecode")
     def test_bug7732(self):
-        with support.temp_cwd():
-            source = support.TESTFN + '.py'
+        with os_helper.temp_cwd():
+            source = os_helper.TESTFN + '.py'
             os.mkdir(source)
             self.assertRaisesRegex(ImportError, '^No module',
-                imp.find_module, support.TESTFN, ["."])
+                imp.find_module, os_helper.TESTFN, ["."])
 
     def test_multiple_calls_to_get_data(self):
         # Issue #18755: make sure multiple calls to get_data() can succeed.
         loader = imp._LoadSourceCompatibility('imp', imp.__file__,
-                                              open(imp.__file__))
+                                              open(imp.__file__, encoding="utf-8"))
         loader.get_data(imp.__file__)  # File should be closed
         loader.get_data(imp.__file__)  # Will need to create a newly opened file
 
@@ -364,7 +366,7 @@
 
     def test_find_and_load_checked_pyc(self):
         # issue 34056
-        with support.temp_cwd():
+        with os_helper.temp_cwd():
             with open('mymod.py', 'wb') as fp:
                 fp.write(b'x = 42\n')
             py_compile.compile(
@@ -383,24 +385,24 @@
     reload()."""
 
     def test_source(self):
-        # XXX (ncoghlan): It would be nice to use test.support.CleanImport
+        # XXX (ncoghlan): It would be nice to use test.import_helper.CleanImport
         # here, but that breaks because the os module registers some
         # handlers in copy_reg on import. Since CleanImport doesn't
         # revert that registration, the module is left in a broken
         # state after reversion. Reinitialising the module contents
         # and just reverting os.environ to its previous state is an OK
         # workaround
-        with support.EnvironmentVarGuard():
+        with os_helper.EnvironmentVarGuard():
             import os
             imp.reload(os)
 
     def test_extension(self):
-        with support.CleanImport('time'):
+        with import_helper.CleanImport('time'):
             import time
             imp.reload(time)
 
     def test_builtin(self):
-        with support.CleanImport('marshal'):
+        with import_helper.CleanImport('marshal'):
             import marshal
             imp.reload(marshal)
 
@@ -443,10 +445,10 @@
 
 
 class NullImporterTests(unittest.TestCase):
-    @unittest.skipIf(support.TESTFN_UNENCODABLE is None,
+    @unittest.skipIf(os_helper.TESTFN_UNENCODABLE is None,
                      "Need an undecodeable filename")
     def test_unencodeable(self):
-        name = support.TESTFN_UNENCODABLE
+        name = os_helper.TESTFN_UNENCODABLE
         os.mkdir(name)
         try:
             self.assertRaises(ImportError, imp.NullImporter, name)
diff --git a/Lib/test/test_import/__init__.py b/Lib/test/test_import/__init__.py
index d1dafbe..9744761 100644
--- a/Lib/test/test_import/__init__.py
+++ b/Lib/test/test_import/__init__.py
@@ -18,13 +18,14 @@
 import unittest
 from unittest import mock
 
-import test.support
-from test.support import (
-    TESTFN, forget, is_jython,
-    make_legacy_pyc, rmtree, swap_attr, swap_item, temp_umask,
-    unlink, unload, cpython_only, TESTFN_UNENCODABLE,
-    temp_dir, DirsOnSysPath)
+from test.support import os_helper
+from test.support import (is_jython, swap_attr, swap_item, cpython_only)
+from test.support.import_helper import (
+    forget, make_legacy_pyc, unlink, unload, DirsOnSysPath)
+from test.support.os_helper import (
+    TESTFN, rmtree, temp_umask, TESTFN_UNENCODABLE, temp_dir)
 from test.support import script_helper
+from test.support import threading_helper
 from test.test_importlib.util import uncache
 from types import ModuleType
 
@@ -116,7 +117,7 @@
     def test_from_import_star_invalid_type(self):
         import re
         with _ready_to_import() as (name, path):
-            with open(path, 'w') as f:
+            with open(path, 'w', encoding='utf-8') as f:
                 f.write("__all__ = [b'invalid_type']")
             globals = {}
             with self.assertRaisesRegex(
@@ -125,7 +126,7 @@
                 exec(f"from {name} import *", globals)
             self.assertNotIn(b"invalid_type", globals)
         with _ready_to_import() as (name, path):
-            with open(path, 'w') as f:
+            with open(path, 'w', encoding='utf-8') as f:
                 f.write("globals()[b'invalid_type'] = object()")
             globals = {}
             with self.assertRaisesRegex(
@@ -154,7 +155,7 @@
             else:
                 pyc = TESTFN + ".pyc"
 
-            with open(source, "w") as f:
+            with open(source, "w", encoding='utf-8') as f:
                 print("# This tests Python's ability to import a",
                       ext, "file.", file=f)
                 a = random.randrange(1000)
@@ -194,7 +195,7 @@
         filename = module + '.py'
 
         # Create a file with a list of 65000 elements.
-        with open(filename, 'w') as f:
+        with open(filename, 'w', encoding='utf-8') as f:
             f.write('d = [\n')
             for i in range(65000):
                 f.write('"",\n')
@@ -231,7 +232,7 @@
 
     def test_failing_import_sticks(self):
         source = TESTFN + ".py"
-        with open(source, "w") as f:
+        with open(source, "w", encoding='utf-8') as f:
             print("a = 1/0", file=f)
 
         # New in 2.4, we shouldn't be able to import that no matter how often
@@ -280,7 +281,7 @@
     def test_failing_reload(self):
         # A failing reload should leave the module object in sys.modules.
         source = TESTFN + os.extsep + "py"
-        with open(source, "w") as f:
+        with open(source, "w", encoding='utf-8') as f:
             f.write("a = 1\nb=2\n")
 
         sys.path.insert(0, os.curdir)
@@ -297,7 +298,7 @@
             remove_files(TESTFN)
 
             # Now damage the module.
-            with open(source, "w") as f:
+            with open(source, "w", encoding='utf-8') as f:
                 f.write("a = 10\nb=20//0\n")
 
             self.assertRaises(ZeroDivisionError, importlib.reload, mod)
@@ -319,7 +320,7 @@
     def test_file_to_source(self):
         # check if __file__ points to the source file where available
         source = TESTFN + ".py"
-        with open(source, "w") as f:
+        with open(source, "w", encoding='utf-8') as f:
             f.write("test = None\n")
 
         sys.path.insert(0, os.curdir)
@@ -368,7 +369,7 @@
         try:
             source = TESTFN + ".py"
             compiled = importlib.util.cache_from_source(source)
-            with open(source, 'w') as f:
+            with open(source, 'w', encoding='utf-8') as f:
                 pass
             try:
                 os.utime(source, (2 ** 33 - 5, 2 ** 33 - 5))
@@ -459,7 +460,7 @@
                 event = threading.Event()
                 threads = [threading.Thread(target=run) for x in range(2)]
                 try:
-                    with test.support.start_threads(threads, event.set):
+                    with threading_helper.start_threads(threads, event.set):
                         time.sleep(0)
                 finally:
                     sys.modules.pop('package', None)
@@ -478,7 +479,7 @@
             os.path.dirname(pydname),
             "sqlite3{}.dll".format("_d" if "_d" in pydname else ""))
 
-        with test.support.temp_dir() as tmp:
+        with os_helper.temp_dir() as tmp:
             tmp2 = os.path.join(tmp, "DLLs")
             os.mkdir(tmp2)
 
@@ -573,7 +574,7 @@
         # with later updates, see issue #6074 for details
         with _ready_to_import() as (name, path):
             # Write a Python file, make it read-only and import it
-            with open(path, 'w') as f:
+            with open(path, 'w', encoding='utf-8') as f:
                 f.write("x = 'original'\n")
             # Tweak the mtime of the source to ensure pyc gets updated later
             s = os.stat(path)
@@ -583,7 +584,7 @@
             self.assertEqual(m.x, 'original')
             # Change the file and then reimport it
             os.chmod(path, 0o600)
-            with open(path, 'w') as f:
+            with open(path, 'w', encoding='utf-8') as f:
                 f.write("x = 'rewritten'\n")
             unload(name)
             importlib.invalidate_caches()
@@ -622,7 +623,7 @@
         self.sys_path = sys.path[:]
         self.orig_module = sys.modules.pop(self.module_name, None)
         os.mkdir(self.dir_name)
-        with open(self.file_name, "w") as f:
+        with open(self.file_name, "w", encoding='utf-8') as f:
             f.write(self.module_source)
         sys.path.insert(0, self.dir_name)
         importlib.invalidate_caches()
@@ -703,7 +704,8 @@
 
     # Regression test for http://bugs.python.org/issue1293.
     def test_trailing_slash(self):
-        with open(os.path.join(self.path, 'test_trailing_slash.py'), 'w') as f:
+        with open(os.path.join(self.path, 'test_trailing_slash.py'),
+                  'w', encoding='utf-8') as f:
             f.write("testdata = 'test_trailing_slash'")
         sys.path.append(self.path+'/')
         mod = __import__("test_trailing_slash")
@@ -841,7 +843,7 @@
     def setUp(self):
         self.source = TESTFN + '.py'
         self._clean()
-        with open(self.source, 'w') as fp:
+        with open(self.source, 'w', encoding='utf-8') as fp:
             print('# This is a test file written by test_import.py', file=fp)
         sys.path.insert(0, os.curdir)
         importlib.invalidate_caches()
@@ -904,7 +906,7 @@
         m = __import__(TESTFN)
         try:
             self.assertEqual(m.__file__,
-                             os.path.join(os.curdir, os.path.relpath(pyc_file)))
+                             os.path.join(os.getcwd(), os.curdir, os.path.relpath(pyc_file)))
         finally:
             os.remove(pyc_file)
 
@@ -912,7 +914,7 @@
         # Modules now also have an __cached__ that points to the pyc file.
         m = __import__(TESTFN)
         pyc_file = importlib.util.cache_from_source(TESTFN + '.py')
-        self.assertEqual(m.__cached__, os.path.join(os.curdir, pyc_file))
+        self.assertEqual(m.__cached__, os.path.join(os.getcwd(), os.curdir, pyc_file))
 
     @skip_if_dont_write_bytecode
     def test___cached___legacy_pyc(self):
@@ -928,7 +930,7 @@
         importlib.invalidate_caches()
         m = __import__(TESTFN)
         self.assertEqual(m.__cached__,
-                         os.path.join(os.curdir, os.path.relpath(pyc_file)))
+                         os.path.join(os.getcwd(), os.curdir, os.path.relpath(pyc_file)))
 
     @skip_if_dont_write_bytecode
     def test_package___cached__(self):
@@ -940,18 +942,18 @@
         os.mkdir('pep3147')
         self.addCleanup(cleanup)
         # Touch the __init__.py
-        with open(os.path.join('pep3147', '__init__.py'), 'w'):
+        with open(os.path.join('pep3147', '__init__.py'), 'wb'):
             pass
-        with open(os.path.join('pep3147', 'foo.py'), 'w'):
+        with open(os.path.join('pep3147', 'foo.py'), 'wb'):
             pass
         importlib.invalidate_caches()
         m = __import__('pep3147.foo')
         init_pyc = importlib.util.cache_from_source(
             os.path.join('pep3147', '__init__.py'))
-        self.assertEqual(m.__cached__, os.path.join(os.curdir, init_pyc))
+        self.assertEqual(m.__cached__, os.path.join(os.getcwd(), os.curdir, init_pyc))
         foo_pyc = importlib.util.cache_from_source(os.path.join('pep3147', 'foo.py'))
         self.assertEqual(sys.modules['pep3147.foo'].__cached__,
-                         os.path.join(os.curdir, foo_pyc))
+                         os.path.join(os.getcwd(), os.curdir, foo_pyc))
 
     def test_package___cached___from_pyc(self):
         # Like test___cached__ but ensuring __cached__ when imported from a
@@ -963,9 +965,9 @@
         os.mkdir('pep3147')
         self.addCleanup(cleanup)
         # Touch the __init__.py
-        with open(os.path.join('pep3147', '__init__.py'), 'w'):
+        with open(os.path.join('pep3147', '__init__.py'), 'wb'):
             pass
-        with open(os.path.join('pep3147', 'foo.py'), 'w'):
+        with open(os.path.join('pep3147', 'foo.py'), 'wb'):
             pass
         importlib.invalidate_caches()
         m = __import__('pep3147.foo')
@@ -975,17 +977,17 @@
         m = __import__('pep3147.foo')
         init_pyc = importlib.util.cache_from_source(
             os.path.join('pep3147', '__init__.py'))
-        self.assertEqual(m.__cached__, os.path.join(os.curdir, init_pyc))
+        self.assertEqual(m.__cached__, os.path.join(os.getcwd(), os.curdir, init_pyc))
         foo_pyc = importlib.util.cache_from_source(os.path.join('pep3147', 'foo.py'))
         self.assertEqual(sys.modules['pep3147.foo'].__cached__,
-                         os.path.join(os.curdir, foo_pyc))
+                         os.path.join(os.getcwd(), os.curdir, foo_pyc))
 
     def test_recompute_pyc_same_second(self):
         # Even when the source file doesn't change timestamp, a change in
         # source size is enough to trigger recomputation of the pyc file.
         __import__(TESTFN)
         unload(TESTFN)
-        with open(self.source, 'a') as fp:
+        with open(self.source, 'a', encoding='utf-8') as fp:
             print("x = 5", file=fp)
         m = __import__(TESTFN)
         self.assertEqual(m.x, 5)
@@ -996,22 +998,22 @@
     tagged = package_name + '-tagged'
 
     def setUp(self):
-        test.support.rmtree(self.tagged)
-        test.support.rmtree(self.package_name)
+        os_helper.rmtree(self.tagged)
+        os_helper.rmtree(self.package_name)
         self.orig_sys_path = sys.path[:]
 
         # create a sample package; imagine you have a package with a tag and
         #  you want to symbolically link it from its untagged name.
         os.mkdir(self.tagged)
-        self.addCleanup(test.support.rmtree, self.tagged)
+        self.addCleanup(os_helper.rmtree, self.tagged)
         init_file = os.path.join(self.tagged, '__init__.py')
-        test.support.create_empty_file(init_file)
+        os_helper.create_empty_file(init_file)
         assert os.path.exists(init_file)
 
         # now create a symlink to the tagged package
         # sample -> sample-tagged
         os.symlink(self.tagged, self.package_name, target_is_directory=True)
-        self.addCleanup(test.support.unlink, self.package_name)
+        self.addCleanup(os_helper.unlink, self.package_name)
         importlib.invalidate_caches()
 
         self.assertEqual(os.path.isdir(self.package_name), True)
@@ -1026,7 +1028,7 @@
         not hasattr(sys, 'getwindowsversion')
         or sys.getwindowsversion() >= (6, 0),
         "Windows Vista or later required")
-    @test.support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_symlinked_dir_importable(self):
         # make sure sample can only be imported from the current directory.
         sys.path[:] = ['.']
@@ -1084,7 +1086,7 @@
         # Given a valid bytecode path, return the path to the corresponding
         # source file if it exists.
         with mock.patch('importlib._bootstrap_external._path_isfile') as _path_isfile:
-            _path_isfile.return_value = True;
+            _path_isfile.return_value = True
             path = TESTFN + '.pyc'
             expect = TESTFN + '.py'
             self.assertEqual(_get_sourcefile(path), expect)
@@ -1093,7 +1095,7 @@
         # Given a valid bytecode path without a corresponding source path,
         # return the original bytecode path.
         with mock.patch('importlib._bootstrap_external._path_isfile') as _path_isfile:
-            _path_isfile.return_value = False;
+            _path_isfile.return_value = False
             path = TESTFN + '.pyc'
             self.assertEqual(_get_sourcefile(path), path)
 
@@ -1117,7 +1119,7 @@
 
     def create_module(self, mod, contents, ext=".py"):
         fname = os.path.join(TESTFN, mod + ext)
-        with open(fname, "w") as f:
+        with open(fname, "w", encoding='utf-8') as f:
             f.write(contents)
         self.addCleanup(unload, mod)
         importlib.invalidate_caches()
@@ -1194,10 +1196,10 @@
         os.mkdir(pkg_path)
         # Touch the __init__.py
         init_path = os.path.join(pkg_path, '__init__.py')
-        with open(init_path, 'w') as f:
+        with open(init_path, 'w', encoding='utf-8') as f:
             f.write(parent)
         bar_path = os.path.join(pkg_path, 'bar.py')
-        with open(bar_path, 'w') as f:
+        with open(bar_path, 'w', encoding='utf-8') as f:
             f.write(child)
         importlib.invalidate_caches()
         return init_path, bar_path
diff --git a/Lib/test/test_importlib/builtin/test_finder.py b/Lib/test/test_importlib/builtin/test_finder.py
index 084f3de..6f51aba 100644
--- a/Lib/test/test_importlib/builtin/test_finder.py
+++ b/Lib/test/test_importlib/builtin/test_finder.py
@@ -5,6 +5,7 @@
 
 import sys
 import unittest
+import warnings
 
 
 @unittest.skipIf(util.BUILTINS.good_name is None, 'no reasonable builtin module')
@@ -58,7 +59,9 @@
     def test_module(self):
         # Common case.
         with util.uncache(util.BUILTINS.good_name):
-            found = self.machinery.BuiltinImporter.find_module(util.BUILTINS.good_name)
+            with warnings.catch_warnings():
+                warnings.simplefilter("ignore", DeprecationWarning)
+                found = self.machinery.BuiltinImporter.find_module(util.BUILTINS.good_name)
             self.assertTrue(found)
             self.assertTrue(hasattr(found, 'load_module'))
 
@@ -70,14 +73,19 @@
 
     def test_failure(self):
         assert 'importlib' not in sys.builtin_module_names
-        loader = self.machinery.BuiltinImporter.find_module('importlib')
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", DeprecationWarning)
+            loader = self.machinery.BuiltinImporter.find_module('importlib')
         self.assertIsNone(loader)
 
     def test_ignore_path(self):
         # The value for 'path' should always trigger a failed import.
         with util.uncache(util.BUILTINS.good_name):
-            loader = self.machinery.BuiltinImporter.find_module(util.BUILTINS.good_name,
-                                                            ['pkg'])
+            with warnings.catch_warnings():
+                warnings.simplefilter("ignore", DeprecationWarning)
+                loader = self.machinery.BuiltinImporter.find_module(
+                                                        util.BUILTINS.good_name,
+                                                        ['pkg'])
             self.assertIsNone(loader)
 
 
diff --git a/Lib/test/test_importlib/builtin/test_loader.py b/Lib/test/test_importlib/builtin/test_loader.py
index b1349ec..f6b6d97 100644
--- a/Lib/test/test_importlib/builtin/test_loader.py
+++ b/Lib/test/test_importlib/builtin/test_loader.py
@@ -6,6 +6,7 @@
 import sys
 import types
 import unittest
+import warnings
 
 @unittest.skipIf(util.BUILTINS.good_name is None, 'no reasonable builtin module')
 class LoaderTests(abc.LoaderTests):
@@ -24,7 +25,9 @@
         self.assertIn(module.__name__, sys.modules)
 
     def load_module(self, name):
-        return self.machinery.BuiltinImporter.load_module(name)
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", DeprecationWarning)
+            return self.machinery.BuiltinImporter.load_module(name)
 
     def test_module(self):
         # Common case.
diff --git a/Lib/test/test_importlib/extension/test_case_sensitivity.py b/Lib/test/test_importlib/extension/test_case_sensitivity.py
index 3a85784..20bf035 100644
--- a/Lib/test/test_importlib/extension/test_case_sensitivity.py
+++ b/Lib/test/test_importlib/extension/test_case_sensitivity.py
@@ -1,5 +1,5 @@
 from importlib import _bootstrap_external
-from test import support
+from test.support import os_helper
 import unittest
 import sys
 from .. import util
@@ -12,30 +12,30 @@
 @util.case_insensitive_tests
 class ExtensionModuleCaseSensitivityTest(util.CASEOKTestBase):
 
-    def find_module(self):
+    def find_spec(self):
         good_name = util.EXTENSIONS.name
         bad_name = good_name.upper()
         assert good_name != bad_name
         finder = self.machinery.FileFinder(util.EXTENSIONS.path,
                                           (self.machinery.ExtensionFileLoader,
                                            self.machinery.EXTENSION_SUFFIXES))
-        return finder.find_module(bad_name)
+        return finder.find_spec(bad_name)
 
     @unittest.skipIf(sys.flags.ignore_environment, 'ignore_environment flag was set')
     def test_case_sensitive(self):
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env.unset('PYTHONCASEOK')
             self.caseok_env_changed(should_exist=False)
-            loader = self.find_module()
-            self.assertIsNone(loader)
+            spec = self.find_spec()
+            self.assertIsNone(spec)
 
     @unittest.skipIf(sys.flags.ignore_environment, 'ignore_environment flag was set')
     def test_case_insensitivity(self):
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env.set('PYTHONCASEOK', '1')
             self.caseok_env_changed(should_exist=True)
-            loader = self.find_module()
-            self.assertTrue(hasattr(loader, 'load_module'))
+            spec = self.find_spec()
+            self.assertTrue(spec)
 
 
 (Frozen_ExtensionCaseSensitivity,
diff --git a/Lib/test/test_importlib/extension/test_finder.py b/Lib/test/test_importlib/extension/test_finder.py
index c9b4a37..e8065d7 100644
--- a/Lib/test/test_importlib/extension/test_finder.py
+++ b/Lib/test/test_importlib/extension/test_finder.py
@@ -11,16 +11,15 @@
 
     """Test the finder for extension modules."""
 
-    def find_module(self, fullname):
+    def find_spec(self, fullname):
         importer = self.machinery.FileFinder(util.EXTENSIONS.path,
                                             (self.machinery.ExtensionFileLoader,
                                              self.machinery.EXTENSION_SUFFIXES))
-        with warnings.catch_warnings():
-            warnings.simplefilter('ignore', DeprecationWarning)
-            return importer.find_module(fullname)
+
+        return importer.find_spec(fullname)
 
     def test_module(self):
-        self.assertTrue(self.find_module(util.EXTENSIONS.name))
+        self.assertTrue(self.find_spec(util.EXTENSIONS.name))
 
     # No extension module as an __init__ available for testing.
     test_package = test_package_in_package = None
@@ -32,7 +31,7 @@
     test_package_over_module = None
 
     def test_failure(self):
-        self.assertIsNone(self.find_module('asdfjkl;'))
+        self.assertIsNone(self.find_spec('asdfjkl;'))
 
 
 (Frozen_FinderTests,
diff --git a/Lib/test/test_importlib/extension/test_loader.py b/Lib/test/test_importlib/extension/test_loader.py
index abd612f..8fd556d 100644
--- a/Lib/test/test_importlib/extension/test_loader.py
+++ b/Lib/test/test_importlib/extension/test_loader.py
@@ -1,3 +1,4 @@
+from warnings import catch_warnings
 from .. import abc
 from .. import util
 
@@ -7,6 +8,7 @@
 import sys
 import types
 import unittest
+import warnings
 import importlib.util
 import importlib
 from test.support.script_helper import assert_python_failure
@@ -20,14 +22,18 @@
                                                          util.EXTENSIONS.file_path)
 
     def load_module(self, fullname):
-        return self.loader.load_module(fullname)
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", DeprecationWarning)
+            return self.loader.load_module(fullname)
 
     def test_load_module_API(self):
         # Test the default argument for load_module().
-        self.loader.load_module()
-        self.loader.load_module(None)
-        with self.assertRaises(ImportError):
-            self.load_module('XXX')
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", DeprecationWarning)
+            self.loader.load_module()
+            self.loader.load_module(None)
+            with self.assertRaises(ImportError):
+                self.load_module('XXX')
 
     def test_equality(self):
         other = self.machinery.ExtensionFileLoader(util.EXTENSIONS.name,
@@ -83,8 +89,7 @@
  ) = util.test_both(LoaderTests, machinery=machinery)
 
 class MultiPhaseExtensionModuleTests(abc.LoaderTests):
-    """Test loading extension modules with multi-phase initialization (PEP 489)
-    """
+    # Test loading extension modules with multi-phase initialization (PEP 489).
 
     def setUp(self):
         self.name = '_testmultiphase'
@@ -94,6 +99,21 @@
         self.loader = self.machinery.ExtensionFileLoader(
             self.name, self.spec.origin)
 
+    def load_module(self):
+        # Load the module from the test extension.
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", DeprecationWarning)
+            return self.loader.load_module(self.name)
+
+    def load_module_by_name(self, fullname):
+        # Load a module from the test extension by name.
+        origin = self.spec.origin
+        loader = self.machinery.ExtensionFileLoader(fullname, origin)
+        spec = importlib.util.spec_from_loader(fullname, loader)
+        module = importlib.util.module_from_spec(spec)
+        loader.exec_module(module)
+        return module
+
     # No extension module as __init__ available for testing.
     test_package = None
 
@@ -104,7 +124,7 @@
     test_state_after_failure = None
 
     def test_module(self):
-        '''Test loading an extension module'''
+        # Test loading an extension module.
         with util.uncache(self.name):
             module = self.load_module()
             for attr, value in [('__name__', self.name),
@@ -118,7 +138,7 @@
                                   self.machinery.ExtensionFileLoader)
 
     def test_functionality(self):
-        '''Test basic functionality of stuff defined in an extension module'''
+        # Test basic functionality of stuff defined in an extension module.
         with util.uncache(self.name):
             module = self.load_module()
             self.assertIsInstance(module, types.ModuleType)
@@ -138,7 +158,7 @@
             self.assertEqual(module.str_const, 'something different')
 
     def test_reload(self):
-        '''Test that reload didn't re-set the module's attributes'''
+        # Test that reload didn't re-set the module's attributes.
         with util.uncache(self.name):
             module = self.load_module()
             ex_class = module.Example
@@ -146,7 +166,7 @@
             self.assertIs(ex_class, module.Example)
 
     def test_try_registration(self):
-        '''Assert that the PyState_{Find,Add,Remove}Module C API doesn't work'''
+        # Assert that the PyState_{Find,Add,Remove}Module C API doesn't work.
         module = self.load_module()
         with self.subTest('PyState_FindModule'):
             self.assertEqual(module.call_state_registration_func(0), None)
@@ -157,28 +177,15 @@
             with self.assertRaises(SystemError):
                 module.call_state_registration_func(2)
 
-    def load_module(self):
-        '''Load the module from the test extension'''
-        return self.loader.load_module(self.name)
-
-    def load_module_by_name(self, fullname):
-        '''Load a module from the test extension by name'''
-        origin = self.spec.origin
-        loader = self.machinery.ExtensionFileLoader(fullname, origin)
-        spec = importlib.util.spec_from_loader(fullname, loader)
-        module = importlib.util.module_from_spec(spec)
-        loader.exec_module(module)
-        return module
-
     def test_load_submodule(self):
-        '''Test loading a simulated submodule'''
+        # Test loading a simulated submodule.
         module = self.load_module_by_name('pkg.' + self.name)
         self.assertIsInstance(module, types.ModuleType)
         self.assertEqual(module.__name__, 'pkg.' + self.name)
         self.assertEqual(module.str_const, 'something different')
 
     def test_load_short_name(self):
-        '''Test loading module with a one-character name'''
+        # Test loading module with a one-character name.
         module = self.load_module_by_name('x')
         self.assertIsInstance(module, types.ModuleType)
         self.assertEqual(module.__name__, 'x')
@@ -186,27 +193,27 @@
         self.assertNotIn('x', sys.modules)
 
     def test_load_twice(self):
-        '''Test that 2 loads result in 2 module objects'''
+        # Test that 2 loads result in 2 module objects.
         module1 = self.load_module_by_name(self.name)
         module2 = self.load_module_by_name(self.name)
         self.assertIsNot(module1, module2)
 
     def test_unloadable(self):
-        '''Test nonexistent module'''
+        # Test nonexistent module.
         name = 'asdfjkl;'
         with self.assertRaises(ImportError) as cm:
             self.load_module_by_name(name)
         self.assertEqual(cm.exception.name, name)
 
     def test_unloadable_nonascii(self):
-        '''Test behavior with nonexistent module with non-ASCII name'''
+        # Test behavior with nonexistent module with non-ASCII name.
         name = 'fo\xf3'
         with self.assertRaises(ImportError) as cm:
             self.load_module_by_name(name)
         self.assertEqual(cm.exception.name, name)
 
     def test_nonmodule(self):
-        '''Test returning a non-module object from create works'''
+        # Test returning a non-module object from create works.
         name = self.name + '_nonmodule'
         mod = self.load_module_by_name(name)
         self.assertNotEqual(type(mod), type(unittest))
@@ -214,7 +221,7 @@
 
     # issue 27782
     def test_nonmodule_with_methods(self):
-        '''Test creating a non-module object with methods defined'''
+        # Test creating a non-module object with methods defined.
         name = self.name + '_nonmodule_with_methods'
         mod = self.load_module_by_name(name)
         self.assertNotEqual(type(mod), type(unittest))
@@ -222,14 +229,14 @@
         self.assertEqual(mod.bar(10, 1), 9)
 
     def test_null_slots(self):
-        '''Test that NULL slots aren't a problem'''
+        # Test that NULL slots aren't a problem.
         name = self.name + '_null_slots'
         module = self.load_module_by_name(name)
         self.assertIsInstance(module, types.ModuleType)
         self.assertEqual(module.__name__, name)
 
     def test_bad_modules(self):
-        '''Test SystemError is raised for misbehaving extensions'''
+        # Test SystemError is raised for misbehaving extensions.
         for name_base in [
                 'bad_slot_large',
                 'bad_slot_negative',
@@ -253,9 +260,9 @@
                     self.load_module_by_name(name)
 
     def test_nonascii(self):
-        '''Test that modules with non-ASCII names can be loaded'''
+        # Test that modules with non-ASCII names can be loaded.
         # punycode behaves slightly differently in some-ASCII and no-ASCII
-        # cases, so test both
+        # cases, so test both.
         cases = [
             (self.name + '_zkou\u0161ka_na\u010dten\xed', 'Czech'),
             ('\uff3f\u30a4\u30f3\u30dd\u30fc\u30c8\u30c6\u30b9\u30c8',
diff --git a/Lib/test/test_importlib/fixtures.py b/Lib/test/test_importlib/fixtures.py
index 2e55d14..12ed07d 100644
--- a/Lib/test/test_importlib/fixtures.py
+++ b/Lib/test/test_importlib/fixtures.py
@@ -1,11 +1,15 @@
 import os
 import sys
+import copy
 import shutil
 import pathlib
 import tempfile
 import textwrap
 import contextlib
 
+from test.support.os_helper import FS_NONASCII
+from typing import Dict, Union
+
 
 @contextlib.contextmanager
 def tempdir():
@@ -69,8 +73,13 @@
         self.fixtures.enter_context(self.add_sys_path(self.site_dir))
 
 
+# Except for python/mypy#731, prefer to define
+# FilesDef = Dict[str, Union['FilesDef', str]]
+FilesDef = Dict[str, Union[Dict[str, Union[Dict[str, str], str]], str]]
+
+
 class DistInfoPkg(OnSysPath, SiteDir):
-    files = {
+    files: FilesDef = {
         "distinfo_pkg-1.0.0.dist-info": {
             "METADATA": """
                 Name: distinfo-pkg
@@ -78,24 +87,74 @@
                 Version: 1.0.0
                 Requires-Dist: wheel >= 1.0
                 Requires-Dist: pytest; extra == 'test'
+                Keywords: sample package
+
+                Once upon a time
+                There was a distinfo pkg
                 """,
             "RECORD": "mod.py,sha256=abc,20\n",
             "entry_points.txt": """
                 [entries]
                 main = mod:main
                 ns:sub = mod:main
-            """
-            },
+            """,
+        },
         "mod.py": """
             def main():
                 print("hello world")
             """,
-        }
+    }
 
     def setUp(self):
         super(DistInfoPkg, self).setUp()
         build_files(DistInfoPkg.files, self.site_dir)
 
+    def make_uppercase(self):
+        """
+        Rewrite metadata with everything uppercase.
+        """
+        shutil.rmtree(self.site_dir / "distinfo_pkg-1.0.0.dist-info")
+        files = copy.deepcopy(DistInfoPkg.files)
+        info = files["distinfo_pkg-1.0.0.dist-info"]
+        info["METADATA"] = info["METADATA"].upper()
+        build_files(files, self.site_dir)
+
+
+class DistInfoPkgWithDot(OnSysPath, SiteDir):
+    files: FilesDef = {
+        "pkg_dot-1.0.0.dist-info": {
+            "METADATA": """
+                Name: pkg.dot
+                Version: 1.0.0
+                """,
+        },
+    }
+
+    def setUp(self):
+        super(DistInfoPkgWithDot, self).setUp()
+        build_files(DistInfoPkgWithDot.files, self.site_dir)
+
+
+class DistInfoPkgWithDotLegacy(OnSysPath, SiteDir):
+    files: FilesDef = {
+        "pkg.dot-1.0.0.dist-info": {
+            "METADATA": """
+                Name: pkg.dot
+                Version: 1.0.0
+                """,
+        },
+        "pkg.lot.egg-info": {
+            "METADATA": """
+                Name: pkg.lot
+                Version: 1.0.0
+                """,
+        },
+    }
+
+    def setUp(self):
+        super(DistInfoPkgWithDotLegacy, self).setUp()
+        build_files(DistInfoPkgWithDotLegacy.files, self.site_dir)
+
 
 class DistInfoPkgOffPath(SiteDir):
     def setUp(self):
@@ -104,7 +163,7 @@
 
 
 class EggInfoPkg(OnSysPath, SiteDir):
-    files = {
+    files: FilesDef = {
         "egginfo_pkg.egg-info": {
             "PKG-INFO": """
                 Name: egginfo-pkg
@@ -113,6 +172,9 @@
                 Version: 1.0.0
                 Classifier: Intended Audience :: Developers
                 Classifier: Topic :: Software Development :: Libraries
+                Keywords: sample package
+                Description: Once upon a time
+                        There was an egginfo package
                 """,
             "SOURCES.txt": """
                 mod.py
@@ -127,13 +189,13 @@
                 [test]
                 pytest
             """,
-            "top_level.txt": "mod\n"
-            },
+            "top_level.txt": "mod\n",
+        },
         "mod.py": """
             def main():
                 print("hello world")
             """,
-        }
+    }
 
     def setUp(self):
         super(EggInfoPkg, self).setUp()
@@ -141,7 +203,7 @@
 
 
 class EggInfoFile(OnSysPath, SiteDir):
-    files = {
+    files: FilesDef = {
         "egginfo_file.egg-info": """
             Metadata-Version: 1.0
             Name: egginfo_file
@@ -154,7 +216,7 @@
             Description: UNKNOWN
             Platform: UNKNOWN
             """,
-        }
+    }
 
     def setUp(self):
         super(EggInfoFile, self).setUp()
@@ -162,12 +224,12 @@
 
 
 class LocalPackage:
-    files = {
+    files: FilesDef = {
         "setup.py": """
             import setuptools
             setuptools.setup(name="local-pkg", version="2.0.1")
             """,
-        }
+    }
 
     def setUp(self):
         self.fixtures = contextlib.ExitStack()
@@ -206,19 +268,13 @@
                 with full_name.open('wb') as f:
                     f.write(contents)
             else:
-                with full_name.open('w') as f:
+                with full_name.open('w', encoding='utf-8') as f:
                     f.write(DALS(contents))
 
 
 class FileBuilder:
     def unicode_filename(self):
-        try:
-            import test.support
-        except ImportError:
-            # outside CPython, hard-code a unicode snowman
-            return '☃'
-        return test.support.FS_NONASCII or \
-            self.skip("File system does not support non-ascii.")
+        return FS_NONASCII or self.skip("File system does not support non-ascii.")
 
 
 def DALS(str):
diff --git a/Lib/test/test_importlib/frozen/test_finder.py b/Lib/test/test_importlib/frozen/test_finder.py
index 519aa02..eb7a4d2 100644
--- a/Lib/test/test_importlib/frozen/test_finder.py
+++ b/Lib/test/test_importlib/frozen/test_finder.py
@@ -4,6 +4,7 @@
 machinery = util.import_importlib('importlib.machinery')
 
 import unittest
+import warnings
 
 
 class FindSpecTests(abc.FinderTests):
@@ -49,7 +50,9 @@
 
     def find(self, name, path=None):
         finder = self.machinery.FrozenImporter
-        return finder.find_module(name, path)
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", DeprecationWarning)
+            return finder.find_module(name, path)
 
     def test_module(self):
         name = '__hello__'
diff --git a/Lib/test/test_importlib/frozen/test_loader.py b/Lib/test/test_importlib/frozen/test_loader.py
index 29ecff1..f0cf179 100644
--- a/Lib/test/test_importlib/frozen/test_loader.py
+++ b/Lib/test/test_importlib/frozen/test_loader.py
@@ -78,7 +78,7 @@
     test_state_after_failure = None
 
     def test_unloadable(self):
-        assert self.machinery.FrozenImporter.find_module('_not_real') is None
+        assert self.machinery.FrozenImporter.find_spec('_not_real') is None
         with self.assertRaises(ImportError) as cm:
             self.exec_module('_not_real')
         self.assertEqual(cm.exception.name, '_not_real')
@@ -160,20 +160,16 @@
             self.assertEqual(repr_str,
                              "<module '__hello__' (frozen)>")
 
-    def test_module_repr_indirect(self):
-        with util.uncache('__hello__'), captured_stdout():
-            module = self.machinery.FrozenImporter.load_module('__hello__')
-        self.assertEqual(repr(module),
-                         "<module '__hello__' (frozen)>")
-
     # No way to trigger an error in a frozen module.
     test_state_after_failure = None
 
     def test_unloadable(self):
-        assert self.machinery.FrozenImporter.find_module('_not_real') is None
-        with self.assertRaises(ImportError) as cm:
-            self.machinery.FrozenImporter.load_module('_not_real')
-        self.assertEqual(cm.exception.name, '_not_real')
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", DeprecationWarning)
+            assert self.machinery.FrozenImporter.find_module('_not_real') is None
+            with self.assertRaises(ImportError) as cm:
+                self.machinery.FrozenImporter.load_module('_not_real')
+            self.assertEqual(cm.exception.name, '_not_real')
 
 
 (Frozen_LoaderTests,
diff --git a/Lib/test/test_importlib/import_/test___loader__.py b/Lib/test/test_importlib/import_/test___loader__.py
index 4b18093..ecd83c6 100644
--- a/Lib/test/test_importlib/import_/test___loader__.py
+++ b/Lib/test/test_importlib/import_/test___loader__.py
@@ -2,6 +2,7 @@
 import sys
 import types
 import unittest
+import warnings
 
 from .. import util
 
@@ -45,25 +46,29 @@
 class LoaderAttributeTests:
 
     def test___loader___missing(self):
-        module = types.ModuleType('blah')
-        try:
-            del module.__loader__
-        except AttributeError:
-            pass
-        loader = LoaderMock()
-        loader.module = module
-        with util.uncache('blah'), util.import_state(meta_path=[loader]):
-            module = self.__import__('blah')
-        self.assertEqual(loader, module.__loader__)
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", ImportWarning)
+            module = types.ModuleType('blah')
+            try:
+                del module.__loader__
+            except AttributeError:
+                pass
+            loader = LoaderMock()
+            loader.module = module
+            with util.uncache('blah'), util.import_state(meta_path=[loader]):
+                module = self.__import__('blah')
+            self.assertEqual(loader, module.__loader__)
 
     def test___loader___is_None(self):
-        module = types.ModuleType('blah')
-        module.__loader__ = None
-        loader = LoaderMock()
-        loader.module = module
-        with util.uncache('blah'), util.import_state(meta_path=[loader]):
-            returned_module = self.__import__('blah')
-        self.assertEqual(loader, module.__loader__)
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", ImportWarning)
+            module = types.ModuleType('blah')
+            module.__loader__ = None
+            loader = LoaderMock()
+            loader.module = module
+            with util.uncache('blah'), util.import_state(meta_path=[loader]):
+                returned_module = self.__import__('blah')
+            self.assertEqual(loader, module.__loader__)
 
 
 (Frozen_Tests,
diff --git a/Lib/test/test_importlib/import_/test___package__.py b/Lib/test/test_importlib/import_/test___package__.py
index 761b256..4a2b34e 100644
--- a/Lib/test/test_importlib/import_/test___package__.py
+++ b/Lib/test/test_importlib/import_/test___package__.py
@@ -98,6 +98,16 @@
 class Using__package__PEP302(Using__package__):
     mock_modules = util.mock_modules
 
+    def test_using___package__(self):
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", ImportWarning)
+            super().test_using___package__()
+
+    def test_spec_fallback(self):
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", ImportWarning)
+            super().test_spec_fallback()
+
 
 (Frozen_UsingPackagePEP302,
  Source_UsingPackagePEP302
@@ -155,6 +165,21 @@
 class Setting__package__PEP302(Setting__package__, unittest.TestCase):
     mock_modules = util.mock_modules
 
+    def test_top_level(self):
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", ImportWarning)
+            super().test_top_level()
+
+    def test_package(self):
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", ImportWarning)
+            super().test_package()
+
+    def test_submodule(self):
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", ImportWarning)
+            super().test_submodule()
+
 class Setting__package__PEP451(Setting__package__, unittest.TestCase):
     mock_modules = util.mock_spec
 
diff --git a/Lib/test/test_importlib/import_/test_api.py b/Lib/test/test_importlib/import_/test_api.py
index 0cd9de4..35c2697 100644
--- a/Lib/test/test_importlib/import_/test_api.py
+++ b/Lib/test/test_importlib/import_/test_api.py
@@ -4,6 +4,7 @@
 import sys
 import types
 import unittest
+import warnings
 
 PKG_NAME = 'fine'
 SUBMOD_NAME = 'fine.bogus'
@@ -100,6 +101,36 @@
 class OldAPITests(APITest):
     bad_finder_loader = BadLoaderFinder
 
+    def test_raises_ModuleNotFoundError(self):
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", ImportWarning)
+            super().test_raises_ModuleNotFoundError()
+
+    def test_name_requires_rparition(self):
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", ImportWarning)
+            super().test_name_requires_rparition()
+
+    def test_negative_level(self):
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", ImportWarning)
+            super().test_negative_level()
+
+    def test_nonexistent_fromlist_entry(self):
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", ImportWarning)
+            super().test_nonexistent_fromlist_entry()
+
+    def test_fromlist_load_error_propagates(self):
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", ImportWarning)
+            super().test_fromlist_load_error_propagates
+
+    def test_blocked_fromlist(self):
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", ImportWarning)
+            super().test_blocked_fromlist()
+
 
 (Frozen_OldAPITests,
  Source_OldAPITests
diff --git a/Lib/test/test_importlib/import_/test_caching.py b/Lib/test/test_importlib/import_/test_caching.py
index 8079add..0f987b2 100644
--- a/Lib/test/test_importlib/import_/test_caching.py
+++ b/Lib/test/test_importlib/import_/test_caching.py
@@ -3,6 +3,7 @@
 import sys
 from types import MethodType
 import unittest
+import warnings
 
 
 class UseCache:
@@ -63,30 +64,36 @@
     #   to when to use the module in sys.modules and when not to.
     def test_using_cache_after_loader(self):
         # [from cache on return]
-        with self.create_mock('module') as mock:
-            with util.import_state(meta_path=[mock]):
-                module = self.__import__('module')
-                self.assertEqual(id(module), id(sys.modules['module']))
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", ImportWarning)
+            with self.create_mock('module') as mock:
+                with util.import_state(meta_path=[mock]):
+                    module = self.__import__('module')
+                    self.assertEqual(id(module), id(sys.modules['module']))
 
     # See test_using_cache_after_loader() for reasoning.
     def test_using_cache_for_assigning_to_attribute(self):
         # [from cache to attribute]
-        with self.create_mock('pkg.__init__', 'pkg.module') as importer:
-            with util.import_state(meta_path=[importer]):
-                module = self.__import__('pkg.module')
-                self.assertTrue(hasattr(module, 'module'))
-                self.assertEqual(id(module.module),
-                                 id(sys.modules['pkg.module']))
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", ImportWarning)
+            with self.create_mock('pkg.__init__', 'pkg.module') as importer:
+                with util.import_state(meta_path=[importer]):
+                    module = self.__import__('pkg.module')
+                    self.assertTrue(hasattr(module, 'module'))
+                    self.assertEqual(id(module.module),
+                                    id(sys.modules['pkg.module']))
 
     # See test_using_cache_after_loader() for reasoning.
     def test_using_cache_for_fromlist(self):
         # [from cache for fromlist]
-        with self.create_mock('pkg.__init__', 'pkg.module') as importer:
-            with util.import_state(meta_path=[importer]):
-                module = self.__import__('pkg', fromlist=['module'])
-                self.assertTrue(hasattr(module, 'module'))
-                self.assertEqual(id(module.module),
-                                 id(sys.modules['pkg.module']))
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", ImportWarning)
+            with self.create_mock('pkg.__init__', 'pkg.module') as importer:
+                with util.import_state(meta_path=[importer]):
+                    module = self.__import__('pkg', fromlist=['module'])
+                    self.assertTrue(hasattr(module, 'module'))
+                    self.assertEqual(id(module.module),
+                                    id(sys.modules['pkg.module']))
 
 
 if __name__ == '__main__':
diff --git a/Lib/test/test_importlib/import_/test_fromlist.py b/Lib/test/test_importlib/import_/test_fromlist.py
index 018c172..deb2171 100644
--- a/Lib/test/test_importlib/import_/test_fromlist.py
+++ b/Lib/test/test_importlib/import_/test_fromlist.py
@@ -24,7 +24,7 @@
 
     def test_return_from_from_import(self):
         # [from return]
-        with util.mock_modules('pkg.__init__', 'pkg.module')as importer:
+        with util.mock_spec('pkg.__init__', 'pkg.module')as importer:
             with util.import_state(meta_path=[importer]):
                 module = self.__import__('pkg.module', fromlist=['attr'])
                 self.assertEqual(module.__name__, 'pkg.module')
@@ -52,14 +52,14 @@
 
     def test_object(self):
         # [object case]
-        with util.mock_modules('module') as importer:
+        with util.mock_spec('module') as importer:
             with util.import_state(meta_path=[importer]):
                 module = self.__import__('module', fromlist=['attr'])
                 self.assertEqual(module.__name__, 'module')
 
     def test_nonexistent_object(self):
         # [bad object]
-        with util.mock_modules('module') as importer:
+        with util.mock_spec('module') as importer:
             with util.import_state(meta_path=[importer]):
                 module = self.__import__('module', fromlist=['non_existent'])
                 self.assertEqual(module.__name__, 'module')
@@ -67,7 +67,7 @@
 
     def test_module_from_package(self):
         # [module]
-        with util.mock_modules('pkg.__init__', 'pkg.module') as importer:
+        with util.mock_spec('pkg.__init__', 'pkg.module') as importer:
             with util.import_state(meta_path=[importer]):
                 module = self.__import__('pkg', fromlist=['module'])
                 self.assertEqual(module.__name__, 'pkg')
@@ -75,7 +75,7 @@
                 self.assertEqual(module.module.__name__, 'pkg.module')
 
     def test_nonexistent_from_package(self):
-        with util.mock_modules('pkg.__init__') as importer:
+        with util.mock_spec('pkg.__init__') as importer:
             with util.import_state(meta_path=[importer]):
                 module = self.__import__('pkg', fromlist=['non_existent'])
                 self.assertEqual(module.__name__, 'pkg')
@@ -87,7 +87,7 @@
         # ModuleNotFoundError propagate.
         def module_code():
             import i_do_not_exist
-        with util.mock_modules('pkg.__init__', 'pkg.mod',
+        with util.mock_spec('pkg.__init__', 'pkg.mod',
                                module_code={'pkg.mod': module_code}) as importer:
             with util.import_state(meta_path=[importer]):
                 with self.assertRaises(ModuleNotFoundError) as exc:
@@ -95,14 +95,14 @@
                 self.assertEqual('i_do_not_exist', exc.exception.name)
 
     def test_empty_string(self):
-        with util.mock_modules('pkg.__init__', 'pkg.mod') as importer:
+        with util.mock_spec('pkg.__init__', 'pkg.mod') as importer:
             with util.import_state(meta_path=[importer]):
                 module = self.__import__('pkg.mod', fromlist=[''])
                 self.assertEqual(module.__name__, 'pkg.mod')
 
     def basic_star_test(self, fromlist=['*']):
         # [using *]
-        with util.mock_modules('pkg.__init__', 'pkg.module') as mock:
+        with util.mock_spec('pkg.__init__', 'pkg.module') as mock:
             with util.import_state(meta_path=[mock]):
                 mock['pkg'].__all__ = ['module']
                 module = self.__import__('pkg', fromlist=fromlist)
@@ -119,7 +119,7 @@
 
     def test_star_with_others(self):
         # [using * with others]
-        context = util.mock_modules('pkg.__init__', 'pkg.module1', 'pkg.module2')
+        context = util.mock_spec('pkg.__init__', 'pkg.module1', 'pkg.module2')
         with context as mock:
             with util.import_state(meta_path=[mock]):
                 mock['pkg'].__all__ = ['module1']
@@ -131,7 +131,7 @@
                 self.assertEqual(module.module2.__name__, 'pkg.module2')
 
     def test_nonexistent_in_all(self):
-        with util.mock_modules('pkg.__init__') as importer:
+        with util.mock_spec('pkg.__init__') as importer:
             with util.import_state(meta_path=[importer]):
                 importer['pkg'].__all__ = ['non_existent']
                 module = self.__import__('pkg', fromlist=['*'])
@@ -139,7 +139,7 @@
                 self.assertFalse(hasattr(module, 'non_existent'))
 
     def test_star_in_all(self):
-        with util.mock_modules('pkg.__init__') as importer:
+        with util.mock_spec('pkg.__init__') as importer:
             with util.import_state(meta_path=[importer]):
                 importer['pkg'].__all__ = ['*']
                 module = self.__import__('pkg', fromlist=['*'])
@@ -147,7 +147,7 @@
                 self.assertFalse(hasattr(module, '*'))
 
     def test_invalid_type(self):
-        with util.mock_modules('pkg.__init__') as importer:
+        with util.mock_spec('pkg.__init__') as importer:
             with util.import_state(meta_path=[importer]), \
                  warnings.catch_warnings():
                 warnings.simplefilter('error', BytesWarning)
@@ -157,7 +157,7 @@
                     self.__import__('pkg', fromlist=iter([b'attr']))
 
     def test_invalid_type_in_all(self):
-        with util.mock_modules('pkg.__init__') as importer:
+        with util.mock_spec('pkg.__init__') as importer:
             with util.import_state(meta_path=[importer]), \
                  warnings.catch_warnings():
                 warnings.simplefilter('error', BytesWarning)
diff --git a/Lib/test/test_importlib/import_/test_meta_path.py b/Lib/test/test_importlib/import_/test_meta_path.py
index 5a41e89..5730119 100644
--- a/Lib/test/test_importlib/import_/test_meta_path.py
+++ b/Lib/test/test_importlib/import_/test_meta_path.py
@@ -100,8 +100,20 @@
                 self.assertEqual(args[0], mod_name)
                 self.assertIs(args[1], path)
 
+class CallSignoreSuppressImportWarning(CallSignature):
 
-class CallSignaturePEP302(CallSignature):
+    def test_no_path(self):
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", ImportWarning)
+            super().test_no_path()
+
+    def test_with_path(self):
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", ImportWarning)
+            super().test_no_path()
+
+
+class CallSignaturePEP302(CallSignoreSuppressImportWarning):
     mock_modules = util.mock_modules
     finder_name = 'find_module'
 
diff --git a/Lib/test/test_importlib/import_/test_packages.py b/Lib/test/test_importlib/import_/test_packages.py
index 2439604..c73ac63 100644
--- a/Lib/test/test_importlib/import_/test_packages.py
+++ b/Lib/test/test_importlib/import_/test_packages.py
@@ -2,6 +2,7 @@
 import sys
 import unittest
 from test import support
+from test.support import import_helper
 
 
 class ParentModuleTests:
@@ -98,7 +99,7 @@
                 try:
                     submodule = self.__import__(subname)
                 finally:
-                    support.unload(subname)
+                    import_helper.unload(subname)
 
 
 (Frozen_ParentTests,
diff --git a/Lib/test/test_importlib/import_/test_path.py b/Lib/test/test_importlib/import_/test_path.py
index 18c81dd..57a2522 100644
--- a/Lib/test/test_importlib/import_/test_path.py
+++ b/Lib/test/test_importlib/import_/test_path.py
@@ -75,7 +75,8 @@
         with util.import_state(path_importer_cache={}, path_hooks=[],
                                path=[path_entry]):
             with warnings.catch_warnings(record=True) as w:
-                warnings.simplefilter('always')
+                warnings.simplefilter('always', ImportWarning)
+                warnings.simplefilter('ignore', DeprecationWarning)
                 self.assertIsNone(self.find('os'))
                 self.assertIsNone(sys.path_importer_cache[path_entry])
                 self.assertEqual(len(w), 1)
@@ -123,12 +124,16 @@
         failing_finder.to_return = None
         path = 'testing path'
         with util.import_state(path_importer_cache={path: failing_finder}):
-            self.assertIsNone(
+            with warnings.catch_warnings():
+                warnings.simplefilter("ignore", ImportWarning)
+                self.assertIsNone(
                     self.machinery.PathFinder.find_spec('whatever', [path]))
         success_finder = TestFinder()
         success_finder.to_return = __loader__
         with util.import_state(path_importer_cache={path: success_finder}):
-            spec = self.machinery.PathFinder.find_spec('whatever', [path])
+            with warnings.catch_warnings():
+                warnings.simplefilter("ignore", ImportWarning)
+                spec = self.machinery.PathFinder.find_spec('whatever', [path])
         self.assertEqual(spec.loader, __loader__)
 
     def test_finder_with_find_loader(self):
@@ -139,12 +144,16 @@
                 return self.loader, self.portions
         path = 'testing path'
         with util.import_state(path_importer_cache={path: TestFinder()}):
-            self.assertIsNone(
+            with warnings.catch_warnings():
+                warnings.simplefilter("ignore", ImportWarning)
+                self.assertIsNone(
                     self.machinery.PathFinder.find_spec('whatever', [path]))
         success_finder = TestFinder()
         success_finder.loader = __loader__
         with util.import_state(path_importer_cache={path: success_finder}):
-            spec = self.machinery.PathFinder.find_spec('whatever', [path])
+            with warnings.catch_warnings():
+                warnings.simplefilter("ignore", ImportWarning)
+                spec = self.machinery.PathFinder.find_spec('whatever', [path])
         self.assertEqual(spec.loader, __loader__)
 
     def test_finder_with_find_spec(self):
@@ -208,7 +217,9 @@
 
 class FindModuleTests(FinderTests):
     def find(self, *args, **kwargs):
-        return self.machinery.PathFinder.find_module(*args, **kwargs)
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", DeprecationWarning)
+            return self.machinery.PathFinder.find_module(*args, **kwargs)
     def check_found(self, found, importer):
         self.assertIs(found, importer)
 
@@ -248,7 +259,9 @@
 
         with util.import_state(path=[Finder.path_location]+sys.path[:],
                                path_hooks=[Finder]):
-            self.machinery.PathFinder.find_spec('importlib')
+            with warnings.catch_warnings():
+                warnings.simplefilter("ignore", ImportWarning)
+                self.machinery.PathFinder.find_spec('importlib')
 
     def test_finder_with_failing_find_module(self):
         # PathEntryFinder with find_module() defined should work.
@@ -266,7 +279,10 @@
 
         with util.import_state(path=[Finder.path_location]+sys.path[:],
                                path_hooks=[Finder]):
-            self.machinery.PathFinder.find_module('importlib')
+            with warnings.catch_warnings():
+                warnings.simplefilter("ignore", ImportWarning)
+                warnings.simplefilter("ignore", DeprecationWarning)
+                self.machinery.PathFinder.find_module('importlib')
 
 
 (Frozen_PEFTests,
diff --git a/Lib/test/test_importlib/namespacedata01/binary.file b/Lib/test/test_importlib/namespacedata01/binary.file
new file mode 100644
index 0000000..eaf36c1
--- /dev/null
+++ b/Lib/test/test_importlib/namespacedata01/binary.file
Binary files differ
diff --git a/Lib/test/test_importlib/namespacedata01/utf-16.file b/Lib/test/test_importlib/namespacedata01/utf-16.file
new file mode 100644
index 0000000..2cb7722
--- /dev/null
+++ b/Lib/test/test_importlib/namespacedata01/utf-16.file
Binary files differ
diff --git a/Lib/test/test_importlib/namespacedata01/utf-8.file b/Lib/test/test_importlib/namespacedata01/utf-8.file
new file mode 100644
index 0000000..1c0132a
--- /dev/null
+++ b/Lib/test/test_importlib/namespacedata01/utf-8.file
@@ -0,0 +1 @@
+Hello, UTF-8 world!
diff --git a/Lib/test/test_importlib/partial/cfimport.py b/Lib/test/test_importlib/partial/cfimport.py
new file mode 100644
index 0000000..c92d2fe
--- /dev/null
+++ b/Lib/test/test_importlib/partial/cfimport.py
@@ -0,0 +1,38 @@
+import os
+import sys
+import threading
+import traceback
+
+
+NLOOPS = 50
+NTHREADS = 30
+
+
+def t1():
+    try:
+        from concurrent.futures import ThreadPoolExecutor
+    except Exception:
+        traceback.print_exc()
+        os._exit(1)
+
+def t2():
+    try:
+        from concurrent.futures.thread import ThreadPoolExecutor
+    except Exception:
+        traceback.print_exc()
+        os._exit(1)
+
+def main():
+    for j in range(NLOOPS):
+        threads = []
+        for i in range(NTHREADS):
+            threads.append(threading.Thread(target=t2 if i % 1 else t1))
+        for thread in threads:
+            thread.start()
+        for thread in threads:
+            thread.join()
+        sys.modules.pop('concurrent.futures', None)
+        sys.modules.pop('concurrent.futures.thread', None)
+
+if __name__ == "__main__":
+    main()
diff --git a/Lib/test/test_importlib/partial/pool_in_threads.py b/Lib/test/test_importlib/partial/pool_in_threads.py
new file mode 100644
index 0000000..faa7867
--- /dev/null
+++ b/Lib/test/test_importlib/partial/pool_in_threads.py
@@ -0,0 +1,27 @@
+import multiprocessing
+import os
+import threading
+import traceback
+
+
+def t():
+    try:
+        with multiprocessing.Pool(1):
+            pass
+    except Exception:
+        traceback.print_exc()
+        os._exit(1)
+
+
+def main():
+    threads = []
+    for i in range(20):
+        threads.append(threading.Thread(target=t))
+    for thread in threads:
+        thread.start()
+    for thread in threads:
+        thread.join()
+
+
+if __name__ == "__main__":
+    main()
diff --git a/Lib/test/test_importlib/source/test_case_sensitivity.py b/Lib/test/test_importlib/source/test_case_sensitivity.py
index ad1cfdb..19543f4 100644
--- a/Lib/test/test_importlib/source/test_case_sensitivity.py
+++ b/Lib/test/test_importlib/source/test_case_sensitivity.py
@@ -7,8 +7,9 @@
 machinery = util.import_importlib('importlib.machinery')
 
 import os
-from test import support as test_support
+from test.support import os_helper
 import unittest
+import warnings
 
 
 @util.case_insensitive_tests
@@ -42,7 +43,7 @@
 
     @unittest.skipIf(sys.flags.ignore_environment, 'ignore_environment flag was set')
     def test_sensitive(self):
-        with test_support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env.unset('PYTHONCASEOK')
             self.caseok_env_changed(should_exist=False)
             sensitive, insensitive = self.sensitivity_test()
@@ -52,7 +53,7 @@
 
     @unittest.skipIf(sys.flags.ignore_environment, 'ignore_environment flag was set')
     def test_insensitive(self):
-        with test_support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env.set('PYTHONCASEOK', '1')
             self.caseok_env_changed(should_exist=True)
             sensitive, insensitive = self.sensitivity_test()
@@ -64,7 +65,9 @@
 
 class CaseSensitivityTestPEP302(CaseSensitivityTest):
     def find(self, finder):
-        return finder.find_module(self.name)
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", DeprecationWarning)
+            return finder.find_module(self.name)
 
 
 (Frozen_CaseSensitivityTestPEP302,
diff --git a/Lib/test/test_importlib/source/test_file_loader.py b/Lib/test/test_importlib/source/test_file_loader.py
index ab44722..1065ac5 100644
--- a/Lib/test/test_importlib/source/test_file_loader.py
+++ b/Lib/test/test_importlib/source/test_file_loader.py
@@ -17,7 +17,7 @@
 import unittest
 import warnings
 
-from test.support import make_legacy_pyc, unload
+from test.support.import_helper import make_legacy_pyc, unload
 
 from test.test_py_compile import without_source_date_epoch
 from test.test_py_compile import SourceDateEpochTestMeta
@@ -124,7 +124,7 @@
                 module = loader.load_module('_temp')
             module_id = id(module)
             module_dict_id = id(module.__dict__)
-            with open(mapping['_temp'], 'w') as file:
+            with open(mapping['_temp'], 'w', encoding='utf-8') as file:
                 file.write("testing_var = 42\n")
             with warnings.catch_warnings():
                 warnings.simplefilter('ignore', DeprecationWarning)
@@ -145,7 +145,7 @@
             orig_module = types.ModuleType(name)
             for attr in attributes:
                 setattr(orig_module, attr, value)
-            with open(mapping[name], 'w') as file:
+            with open(mapping[name], 'w', encoding='utf-8') as file:
                 file.write('+++ bad syntax +++')
             loader = self.machinery.SourceFileLoader('_temp', mapping['_temp'])
             with self.assertRaises(SyntaxError):
@@ -162,7 +162,7 @@
     # [syntax error]
     def test_bad_syntax(self):
         with util.create_modules('_temp') as mapping:
-            with open(mapping['_temp'], 'w') as file:
+            with open(mapping['_temp'], 'w', encoding='utf-8') as file:
                 file.write('=')
             loader = self.machinery.SourceFileLoader('_temp', mapping['_temp'])
             with self.assertRaises(SyntaxError):
@@ -175,7 +175,7 @@
         # Loading a module found from an empty string entry on sys.path should
         # not only work, but keep all attributes relative.
         file_path = '_temp.py'
-        with open(file_path, 'w') as file:
+        with open(file_path, 'w', encoding='utf-8') as file:
             file.write("# test file for importlib")
         try:
             with util.uncache('_temp'):
@@ -199,7 +199,7 @@
         with util.create_modules('_temp') as mapping:
             source = mapping['_temp']
             compiled = self.util.cache_from_source(source)
-            with open(source, 'w') as f:
+            with open(source, 'w', encoding='utf-8') as f:
                 f.write("x = 5")
             try:
                 os.utime(source, (2 ** 33 - 5, 2 ** 33 - 5))
diff --git a/Lib/test/test_importlib/source/test_finder.py b/Lib/test/test_importlib/source/test_finder.py
index f372b85..80e930c 100644
--- a/Lib/test/test_importlib/source/test_finder.py
+++ b/Lib/test/test_importlib/source/test_finder.py
@@ -9,7 +9,7 @@
 import stat
 import sys
 import tempfile
-from test.support import make_legacy_pyc
+from test.support.import_helper import make_legacy_pyc
 import unittest
 import warnings
 
@@ -127,7 +127,7 @@
         # The empty string from sys.path means to search in the cwd.
         finder = self.machinery.FileFinder('', (self.machinery.SourceFileLoader,
             self.machinery.SOURCE_SUFFIXES))
-        with open('mod.py', 'w') as file:
+        with open('mod.py', 'w', encoding='utf-8') as file:
             file.write("# test file for importlib")
         try:
             loader = self._find(finder, 'mod', loader_only=True)
diff --git a/Lib/test/test_importlib/source/test_source_encoding.py b/Lib/test/test_importlib/source/test_source_encoding.py
index 980855f..c0b9b03 100644
--- a/Lib/test/test_importlib/source/test_source_encoding.py
+++ b/Lib/test/test_importlib/source/test_source_encoding.py
@@ -23,7 +23,7 @@
 
     PEP 263 specifies how that can change on a per-file basis. Either the first
     or second line can contain the encoding line [encoding first line]
-    encoding second line]. If the file has the BOM marker it is considered UTF-8
+    [encoding second line]. If the file has the BOM marker it is considered UTF-8
     implicitly [BOM]. If any encoding is specified it must be UTF-8, else it is
     an error [BOM and utf-8][BOM conflict].
 
diff --git a/Lib/test/test_importlib/test_abc.py b/Lib/test/test_importlib/test_abc.py
index 9816b35..45cbf90 100644
--- a/Lib/test/test_importlib/test_abc.py
+++ b/Lib/test/test_importlib/test_abc.py
@@ -3,6 +3,7 @@
 import os
 import sys
 from test import support
+from test.support import import_helper
 import types
 import unittest
 from unittest import mock
@@ -54,7 +55,7 @@
 
 
 class MetaPathFinder(InheritanceTests):
-    superclass_names = ['Finder']
+    superclass_names = []
     subclass_names = ['BuiltinImporter', 'FrozenImporter', 'PathFinder',
                       'WindowsRegistryFinder']
 
@@ -65,7 +66,7 @@
 
 
 class PathEntryFinder(InheritanceTests):
-    superclass_names = ['Finder']
+    superclass_names = []
     subclass_names = ['FileFinder']
 
 
@@ -219,12 +220,14 @@
 
     def test_module_repr(self):
         mod = types.ModuleType('blah')
-        with self.assertRaises(NotImplementedError):
-            self.ins.module_repr(mod)
-        original_repr = repr(mod)
-        mod.__loader__ = self.ins
-        # Should still return a proper repr.
-        self.assertTrue(repr(mod))
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", DeprecationWarning)
+            with self.assertRaises(NotImplementedError):
+                self.ins.module_repr(mod)
+            original_repr = repr(mod)
+            mod.__loader__ = self.ins
+            # Should still return a proper repr.
+            self.assertTrue(repr(mod))
 
 
 (Frozen_LDefaultTests,
@@ -337,7 +340,9 @@
             self.ins.is_resource('dummy_file')
 
     def test_contents(self):
-        self.assertEqual([], list(self.ins.contents()))
+        with self.assertRaises(FileNotFoundError):
+            self.ins.contents()
+
 
 (Frozen_RRDefaultTests,
  Source_RRDefaultsTests
@@ -457,32 +462,36 @@
         return SpecLoader()
 
     def test_fresh(self):
-        loader = self.loader()
-        name = 'blah'
-        with test_util.uncache(name):
-            loader.load_module(name)
-            module = loader.found
-            self.assertIs(sys.modules[name], module)
-        self.assertEqual(loader, module.__loader__)
-        self.assertEqual(loader, module.__spec__.loader)
-        self.assertEqual(name, module.__name__)
-        self.assertEqual(name, module.__spec__.name)
-        self.assertIsNotNone(module.__path__)
-        self.assertIsNotNone(module.__path__,
-                             module.__spec__.submodule_search_locations)
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", DeprecationWarning)
+            loader = self.loader()
+            name = 'blah'
+            with test_util.uncache(name):
+                loader.load_module(name)
+                module = loader.found
+                self.assertIs(sys.modules[name], module)
+            self.assertEqual(loader, module.__loader__)
+            self.assertEqual(loader, module.__spec__.loader)
+            self.assertEqual(name, module.__name__)
+            self.assertEqual(name, module.__spec__.name)
+            self.assertIsNotNone(module.__path__)
+            self.assertIsNotNone(module.__path__,
+                                module.__spec__.submodule_search_locations)
 
     def test_reload(self):
-        name = 'blah'
-        loader = self.loader()
-        module = types.ModuleType(name)
-        module.__spec__ = self.util.spec_from_loader(name, loader)
-        module.__loader__ = loader
-        with test_util.uncache(name):
-            sys.modules[name] = module
-            loader.load_module(name)
-            found = loader.found
-            self.assertIs(found, sys.modules[name])
-            self.assertIs(module, sys.modules[name])
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", DeprecationWarning)
+            name = 'blah'
+            loader = self.loader()
+            module = types.ModuleType(name)
+            module.__spec__ = self.util.spec_from_loader(name, loader)
+            module.__loader__ = loader
+            with test_util.uncache(name):
+                sys.modules[name] = module
+                loader.load_module(name)
+                found = loader.found
+                self.assertIs(found, sys.modules[name])
+                self.assertIs(module, sys.modules[name])
 
 
 (Frozen_LoaderLoadModuleTests,
@@ -579,8 +588,8 @@
     module_name = 'blah'
 
     def setUp(self):
-        support.unload(self.module_name)
-        self.addCleanup(support.unload, self.module_name)
+        import_helper.unload(self.module_name)
+        self.addCleanup(import_helper.unload, self.module_name)
 
     def load(self, loader):
         spec = self.util.spec_from_loader(self.module_name, loader)
@@ -836,25 +845,29 @@
         # Loading a module should set __name__, __loader__, __package__,
         # __path__ (for packages), __file__, and __cached__.
         # The module should also be put into sys.modules.
-        with test_util.uncache(self.name):
-            with warnings.catch_warnings():
-                warnings.simplefilter('ignore', DeprecationWarning)
-                module = self.loader.load_module(self.name)
-            self.verify_module(module)
-            self.assertEqual(module.__path__, [os.path.dirname(self.path)])
-            self.assertIn(self.name, sys.modules)
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", ImportWarning)
+            with test_util.uncache(self.name):
+                with warnings.catch_warnings():
+                    warnings.simplefilter('ignore', DeprecationWarning)
+                    module = self.loader.load_module(self.name)
+                self.verify_module(module)
+                self.assertEqual(module.__path__, [os.path.dirname(self.path)])
+                self.assertIn(self.name, sys.modules)
 
     def test_package_settings(self):
         # __package__ needs to be set, while __path__ is set on if the module
         # is a package.
         # Testing the values for a package are covered by test_load_module.
-        self.setUp(is_package=False)
-        with test_util.uncache(self.name):
-            with warnings.catch_warnings():
-                warnings.simplefilter('ignore', DeprecationWarning)
-                module = self.loader.load_module(self.name)
-            self.verify_module(module)
-            self.assertFalse(hasattr(module, '__path__'))
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", ImportWarning)
+            self.setUp(is_package=False)
+            with test_util.uncache(self.name):
+                with warnings.catch_warnings():
+                    warnings.simplefilter('ignore', DeprecationWarning)
+                    module = self.loader.load_module(self.name)
+                self.verify_module(module)
+                self.assertFalse(hasattr(module, '__path__'))
 
     def test_get_source_encoding(self):
         # Source is considered encoded in UTF-8 by default unless otherwise
diff --git a/Lib/test/test_importlib/test_api.py b/Lib/test/test_importlib/test_api.py
index 0fb1346..763b2ad 100644
--- a/Lib/test/test_importlib/test_api.py
+++ b/Lib/test/test_importlib/test_api.py
@@ -7,6 +7,8 @@
 import os.path
 import sys
 from test import support
+from test.support import import_helper
+from test.support import os_helper
 import types
 import unittest
 import warnings
@@ -18,7 +20,7 @@
 
     def test_module_import(self):
         # Test importing a top-level module.
-        with test_util.mock_modules('top_level') as mock:
+        with test_util.mock_spec('top_level') as mock:
             with test_util.import_state(meta_path=[mock]):
                 module = self.init.import_module('top_level')
                 self.assertEqual(module.__name__, 'top_level')
@@ -28,7 +30,7 @@
         pkg_name = 'pkg'
         pkg_long_name = '{0}.__init__'.format(pkg_name)
         name = '{0}.mod'.format(pkg_name)
-        with test_util.mock_modules(pkg_long_name, name) as mock:
+        with test_util.mock_spec(pkg_long_name, name) as mock:
             with test_util.import_state(meta_path=[mock]):
                 module = self.init.import_module(name)
                 self.assertEqual(module.__name__, name)
@@ -40,7 +42,7 @@
         module_name = 'mod'
         absolute_name = '{0}.{1}'.format(pkg_name, module_name)
         relative_name = '.{0}'.format(module_name)
-        with test_util.mock_modules(pkg_long_name, absolute_name) as mock:
+        with test_util.mock_spec(pkg_long_name, absolute_name) as mock:
             with test_util.import_state(meta_path=[mock]):
                 self.init.import_module(pkg_name)
                 module = self.init.import_module(relative_name, pkg_name)
@@ -48,7 +50,7 @@
 
     def test_deep_relative_package_import(self):
         modules = ['a.__init__', 'a.b.__init__', 'a.c']
-        with test_util.mock_modules(*modules) as mock:
+        with test_util.mock_spec(*modules) as mock:
             with test_util.import_state(meta_path=[mock]):
                 self.init.import_module('a')
                 self.init.import_module('a.b')
@@ -61,7 +63,7 @@
         pkg_name = 'pkg'
         pkg_long_name = '{0}.__init__'.format(pkg_name)
         name = '{0}.mod'.format(pkg_name)
-        with test_util.mock_modules(pkg_long_name, name) as mock:
+        with test_util.mock_spec(pkg_long_name, name) as mock:
             with test_util.import_state(meta_path=[mock]):
                 self.init.import_module(pkg_name)
                 module = self.init.import_module(name, pkg_name)
@@ -86,7 +88,7 @@
             b_load_count += 1
         code = {'a': load_a, 'a.b': load_b}
         modules = ['a.__init__', 'a.b']
-        with test_util.mock_modules(*modules, module_code=code) as mock:
+        with test_util.mock_spec(*modules, module_code=code) as mock:
             with test_util.import_state(meta_path=[mock]):
                 self.init.import_module('a.b')
         self.assertEqual(b_load_count, 1)
@@ -149,6 +151,7 @@
             with test_util.import_state(meta_path=[self.FakeMetaFinder]):
                 with warnings.catch_warnings():
                     warnings.simplefilter('ignore', DeprecationWarning)
+                    warnings.simplefilter('ignore', ImportWarning)
                     self.assertEqual((name, None), self.init.find_loader(name))
 
     def test_success_path(self):
@@ -159,6 +162,7 @@
             with test_util.import_state(meta_path=[self.FakeMetaFinder]):
                 with warnings.catch_warnings():
                     warnings.simplefilter('ignore', DeprecationWarning)
+                    warnings.simplefilter('ignore', ImportWarning)
                     self.assertEqual((name, path),
                                      self.init.find_loader(name, path))
 
@@ -200,7 +204,7 @@
     def test_reload_modules(self):
         for mod in ('tokenize', 'time', 'marshal'):
             with self.subTest(module=mod):
-                with support.CleanImport(mod):
+                with import_helper.CleanImport(mod):
                     module = self.init.import_module(mod)
                     self.init.reload(module)
 
@@ -210,8 +214,8 @@
             module = type(sys)('top_level')
             module.spam = 3
             sys.modules['top_level'] = module
-        mock = test_util.mock_modules('top_level',
-                                      module_code={'top_level': code})
+        mock = test_util.mock_spec('top_level',
+                                   module_code={'top_level': code})
         with mock:
             with test_util.import_state(meta_path=[mock]):
                 module = self.init.import_module('top_level')
@@ -221,7 +225,7 @@
                 self.assertEqual(reloaded.spam, 3)
 
     def test_reload_missing_loader(self):
-        with support.CleanImport('types'):
+        with import_helper.CleanImport('types'):
             import types
             loader = types.__loader__
             del types.__loader__
@@ -232,7 +236,7 @@
             self.assertEqual(reloaded.__loader__.path, loader.path)
 
     def test_reload_loader_replaced(self):
-        with support.CleanImport('types'):
+        with import_helper.CleanImport('types'):
             import types
             types.__loader__ = None
             self.init.invalidate_caches()
@@ -244,9 +248,9 @@
 
     def test_reload_location_changed(self):
         name = 'spam'
-        with support.temp_cwd(None) as cwd:
+        with os_helper.temp_cwd(None) as cwd:
             with test_util.uncache('spam'):
-                with support.DirsOnSysPath(cwd):
+                with import_helper.DirsOnSysPath(cwd):
                     # Start as a plain module.
                     self.init.invalidate_caches()
                     path = os.path.join(cwd, name + '.py')
@@ -257,7 +261,7 @@
                                 '__cached__': cached,
                                 '__doc__': None,
                                 }
-                    support.create_empty_file(path)
+                    os_helper.create_empty_file(path)
                     module = self.init.import_module(name)
                     ns = vars(module).copy()
                     loader = ns.pop('__loader__')
@@ -295,9 +299,9 @@
 
     def test_reload_namespace_changed(self):
         name = 'spam'
-        with support.temp_cwd(None) as cwd:
+        with os_helper.temp_cwd(None) as cwd:
             with test_util.uncache('spam'):
-                with support.DirsOnSysPath(cwd):
+                with import_helper.DirsOnSysPath(cwd):
                     # Start as a namespace package.
                     self.init.invalidate_caches()
                     bad_path = os.path.join(cwd, name, '__init.py')
@@ -308,7 +312,7 @@
                                 '__file__': None,
                                 }
                     os.mkdir(name)
-                    with open(bad_path, 'w') as init_file:
+                    with open(bad_path, 'w', encoding='utf-8') as init_file:
                         init_file.write('eggs = None')
                     module = self.init.import_module(name)
                     ns = vars(module).copy()
@@ -436,9 +440,9 @@
                 with self.subTest(name=name):
                     self.assertTrue(hasattr(module, '__loader__'),
                                     '{!r} lacks a __loader__ attribute'.format(name))
-                    if self.machinery.BuiltinImporter.find_module(name):
+                    if self.machinery.BuiltinImporter.find_spec(name):
                         self.assertIsNot(module.__loader__, None)
-                    elif self.machinery.FrozenImporter.find_module(name):
+                    elif self.machinery.FrozenImporter.find_spec(name):
                         self.assertIsNot(module.__loader__, None)
 
     def test_everyone_has___spec__(self):
@@ -446,9 +450,9 @@
             if isinstance(module, types.ModuleType):
                 with self.subTest(name=name):
                     self.assertTrue(hasattr(module, '__spec__'))
-                    if self.machinery.BuiltinImporter.find_module(name):
+                    if self.machinery.BuiltinImporter.find_spec(name):
                         self.assertIsNot(module.__spec__, None)
-                    elif self.machinery.FrozenImporter.find_module(name):
+                    elif self.machinery.FrozenImporter.find_spec(name):
                         self.assertIsNot(module.__spec__, None)
 
 
diff --git a/Lib/test/test_importlib/test_files.py b/Lib/test/test_importlib/test_files.py
index fa7af82..481829b 100644
--- a/Lib/test/test_importlib/test_files.py
+++ b/Lib/test/test_importlib/test_files.py
@@ -15,13 +15,13 @@
 
     def test_read_text(self):
         files = resources.files(self.data)
-        actual = files.joinpath('utf-8.file').read_text()
+        actual = files.joinpath('utf-8.file').read_text(encoding='utf-8')
         assert actual == 'Hello, UTF-8 world!\n'
 
     @unittest.skipUnless(
         hasattr(typing, 'runtime_checkable'),
         "Only suitable when typing supports runtime_checkable",
-        )
+    )
     def test_traversable(self):
         assert isinstance(resources.files(self.data), Traversable)
 
diff --git a/Lib/test/test_importlib/test_locks.py b/Lib/test/test_importlib/test_locks.py
index 21794d9..9290bac 100644
--- a/Lib/test/test_importlib/test_locks.py
+++ b/Lib/test/test_importlib/test_locks.py
@@ -4,9 +4,11 @@
 
 import sys
 import threading
+import unittest
 import weakref
 
 from test import support
+from test.support import threading_helper
 from test import lock_tests
 
 
@@ -138,15 +140,10 @@
  ) = test_util.test_both(LifetimeTests, init=init)
 
 
-@support.reap_threads
-def test_main():
-    support.run_unittest(Frozen_ModuleLockAsRLockTests,
-                         Source_ModuleLockAsRLockTests,
-                         Frozen_DeadlockAvoidanceTests,
-                         Source_DeadlockAvoidanceTests,
-                         Frozen_LifetimeTests,
-                         Source_LifetimeTests)
+def setUpModule():
+    thread_info = threading_helper.threading_setup()
+    unittest.addModuleCleanup(threading_helper.threading_cleanup, *thread_info)
 
 
 if __name__ == '__main__':
-    test_main()
+    unittets.main()
diff --git a/Lib/test/test_importlib/test_main.py b/Lib/test/test_importlib/test_main.py
index 91e501a..52cb637 100644
--- a/Lib/test/test_importlib/test_main.py
+++ b/Lib/test/test_importlib/test_main.py
@@ -1,10 +1,9 @@
-# coding: utf-8
-
 import re
 import json
 import pickle
 import textwrap
 import unittest
+import warnings
 import importlib.metadata
 
 try:
@@ -14,10 +13,14 @@
 
 from . import fixtures
 from importlib.metadata import (
-    Distribution, EntryPoint,
-    PackageNotFoundError, distributions,
-    entry_points, metadata, version,
-    )
+    Distribution,
+    EntryPoint,
+    PackageNotFoundError,
+    distributions,
+    entry_points,
+    metadata,
+    version,
+)
 
 
 class BasicTests(fixtures.DistInfoPkg, unittest.TestCase):
@@ -32,6 +35,16 @@
         with self.assertRaises(PackageNotFoundError):
             Distribution.from_name('does-not-exist')
 
+    def test_package_not_found_mentions_metadata(self):
+        # When a package is not found, that could indicate that the
+        # packgae is not installed or that it is installed without
+        # metadata. Ensure the exception mentions metadata to help
+        # guide users toward the cause. See #124.
+        with self.assertRaises(PackageNotFoundError) as ctx:
+            Distribution.from_name('does-not-exist')
+
+        assert "metadata" in str(ctx.exception)
+
     def test_new_style_classes(self):
         self.assertIsInstance(Distribution, type)
 
@@ -44,13 +57,11 @@
             importlib.import_module('does_not_exist')
 
     def test_resolve(self):
-        entries = dict(entry_points()['entries'])
-        ep = entries['main']
+        ep = entry_points(group='entries')['main']
         self.assertEqual(ep.load().__name__, "main")
 
     def test_entrypoint_with_colon_in_name(self):
-        entries = dict(entry_points()['entries'])
-        ep = entries['ns:sub']
+        ep = entry_points(group='entries')['ns:sub']
         self.assertEqual(ep.value, 'mod:main')
 
     def test_resolve_without_attr(self):
@@ -58,12 +69,11 @@
             name='ep',
             value='importlib.metadata',
             group='grp',
-            )
+        )
         assert ep.load() is importlib.metadata
 
 
-class NameNormalizationTests(
-        fixtures.OnSysPath, fixtures.SiteDir, unittest.TestCase):
+class NameNormalizationTests(fixtures.OnSysPath, fixtures.SiteDir, unittest.TestCase):
     @staticmethod
     def pkg_with_dashes(site_dir):
         """
@@ -73,15 +83,13 @@
         metadata_dir = site_dir / 'my_pkg.dist-info'
         metadata_dir.mkdir()
         metadata = metadata_dir / 'METADATA'
-        with metadata.open('w') as strm:
+        with metadata.open('w', encoding='utf-8') as strm:
             strm.write('Version: 1.0\n')
         return 'my-pkg'
 
     def test_dashes_in_dist_name_found_as_underscores(self):
-        """
-        For a package with a dash in the name, the dist-info metadata
-        uses underscores in the name. Ensure the metadata loads.
-        """
+        # For a package with a dash in the name, the dist-info metadata
+        # uses underscores in the name. Ensure the metadata loads.
         pkg_name = self.pkg_with_dashes(self.site_dir)
         assert version(pkg_name) == '1.0'
 
@@ -94,14 +102,12 @@
         metadata_dir = site_dir / 'CherryPy.dist-info'
         metadata_dir.mkdir()
         metadata = metadata_dir / 'METADATA'
-        with metadata.open('w') as strm:
+        with metadata.open('w', encoding='utf-8') as strm:
             strm.write('Version: 1.0\n')
         return 'CherryPy'
 
     def test_dist_name_found_as_any_case(self):
-        """
-        Ensure the metadata loads when queried with any case.
-        """
+        # Ensure the metadata loads when queried with any case.
         pkg_name = self.pkg_with_mixed_case(self.site_dir)
         assert version(pkg_name) == '1.0'
         assert version(pkg_name.lower()) == '1.0'
@@ -119,7 +125,7 @@
         metadata_dir.mkdir()
         metadata = metadata_dir / 'METADATA'
         with metadata.open('w', encoding='utf-8') as fp:
-            fp.write('Description: pôrˈtend\n')
+            fp.write('Description: pôrˈtend')
         return 'portend'
 
     @staticmethod
@@ -132,11 +138,15 @@
         metadata_dir.mkdir()
         metadata = metadata_dir / 'METADATA'
         with metadata.open('w', encoding='utf-8') as fp:
-            fp.write(textwrap.dedent("""
+            fp.write(
+                textwrap.dedent(
+                    """
                 Name: portend
 
                 pôrˈtend
-                """).lstrip())
+                """
+                ).strip()
+            )
         return 'portend'
 
     def test_metadata_loads(self):
@@ -147,27 +157,15 @@
     def test_metadata_loads_egg_info(self):
         pkg_name = self.pkg_with_non_ascii_description_egg_info(self.site_dir)
         meta = metadata(pkg_name)
-        assert meta.get_payload() == 'pôrˈtend\n'
+        assert meta['Description'] == 'pôrˈtend'
 
 
-class DiscoveryTests(fixtures.EggInfoPkg,
-                     fixtures.DistInfoPkg,
-                     unittest.TestCase):
-
+class DiscoveryTests(fixtures.EggInfoPkg, fixtures.DistInfoPkg, unittest.TestCase):
     def test_package_discovery(self):
         dists = list(distributions())
-        assert all(
-            isinstance(dist, Distribution)
-            for dist in dists
-            )
-        assert any(
-            dist.metadata['Name'] == 'egginfo-pkg'
-            for dist in dists
-            )
-        assert any(
-            dist.metadata['Name'] == 'distinfo-pkg'
-            for dist in dists
-            )
+        assert all(isinstance(dist, Distribution) for dist in dists)
+        assert any(dist.metadata['Name'] == 'egginfo-pkg' for dist in dists)
+        assert any(dist.metadata['Name'] == 'distinfo-pkg' for dist in dists)
 
     def test_invalid_usage(self):
         with self.assertRaises(ValueError):
@@ -237,15 +235,14 @@
         assert "'name'" in repr(self.ep)
 
     def test_hashable(self):
-        """EntryPoints should be hashable"""
+        # EntryPoints should be hashable.
         hash(self.ep)
 
     def test_json_dump(self):
-        """
-        json should not expect to be able to dump an EntryPoint
-        """
+        # json should not expect to be able to dump an EntryPoint.
         with self.assertRaises(Exception):
-            json.dumps(self.ep)
+            with warnings.catch_warnings(record=True):
+                json.dumps(self.ep)
 
     def test_module(self):
         assert self.ep.module == 'value'
@@ -253,17 +250,24 @@
     def test_attr(self):
         assert self.ep.attr is None
 
+    def test_sortable(self):
+        # EntryPoint objects are sortable, but result is undefined.
+        sorted(
+            [
+                EntryPoint('b', 'val', 'group'),
+                EntryPoint('a', 'val', 'group'),
+            ]
+        )
+
 
 class FileSystem(
-        fixtures.OnSysPath, fixtures.SiteDir, fixtures.FileBuilder,
-        unittest.TestCase):
+    fixtures.OnSysPath, fixtures.SiteDir, fixtures.FileBuilder, unittest.TestCase
+):
     def test_unicode_dir_on_sys_path(self):
-        """
-        Ensure a Unicode subdirectory of a directory on sys.path
-        does not crash.
-        """
+        # Ensure a Unicode subdirectory of a directory on sys.path
+        # does not crash.
         fixtures.build_files(
             {self.unicode_filename(): {}},
             prefix=self.site_dir,
-            )
+        )
         list(distributions())
diff --git a/Lib/test/test_importlib/test_metadata_api.py b/Lib/test/test_importlib/test_metadata_api.py
index 1d7b29a..799f007 100644
--- a/Lib/test/test_importlib/test_metadata_api.py
+++ b/Lib/test/test_importlib/test_metadata_api.py
@@ -1,21 +1,37 @@
 import re
 import textwrap
 import unittest
-
-from collections.abc import Iterator
+import warnings
+import importlib
+import contextlib
 
 from . import fixtures
 from importlib.metadata import (
-    Distribution, PackageNotFoundError, distribution,
-    entry_points, files, metadata, requires, version,
-    )
+    Distribution,
+    PackageNotFoundError,
+    distribution,
+    entry_points,
+    files,
+    metadata,
+    requires,
+    version,
+)
+
+
+@contextlib.contextmanager
+def suppress_known_deprecation():
+    with warnings.catch_warnings(record=True) as ctx:
+        warnings.simplefilter('default')
+        yield ctx
 
 
 class APITests(
-        fixtures.EggInfoPkg,
-        fixtures.DistInfoPkg,
-        fixtures.EggInfoFile,
-        unittest.TestCase):
+    fixtures.EggInfoPkg,
+    fixtures.DistInfoPkg,
+    fixtures.DistInfoPkgWithDot,
+    fixtures.EggInfoFile,
+    unittest.TestCase,
+):
 
     version_pattern = r'\d+\.\d+(\.\d)?'
 
@@ -33,24 +49,134 @@
         with self.assertRaises(PackageNotFoundError):
             distribution('does-not-exist')
 
+    def test_name_normalization(self):
+        names = 'pkg.dot', 'pkg_dot', 'pkg-dot', 'pkg..dot', 'Pkg.Dot'
+        for name in names:
+            with self.subTest(name):
+                assert distribution(name).metadata['Name'] == 'pkg.dot'
+
+    def test_prefix_not_matched(self):
+        prefixes = 'p', 'pkg', 'pkg.'
+        for prefix in prefixes:
+            with self.subTest(prefix):
+                with self.assertRaises(PackageNotFoundError):
+                    distribution(prefix)
+
     def test_for_top_level(self):
         self.assertEqual(
-            distribution('egginfo-pkg').read_text('top_level.txt').strip(),
-            'mod')
+            distribution('egginfo-pkg').read_text('top_level.txt').strip(), 'mod'
+        )
 
     def test_read_text(self):
         top_level = [
-            path for path in files('egginfo-pkg')
-            if path.name == 'top_level.txt'
-            ][0]
+            path for path in files('egginfo-pkg') if path.name == 'top_level.txt'
+        ][0]
         self.assertEqual(top_level.read_text(), 'mod\n')
 
     def test_entry_points(self):
-        entries = dict(entry_points()['entries'])
+        eps = entry_points()
+        assert 'entries' in eps.groups
+        entries = eps.select(group='entries')
+        assert 'main' in entries.names
         ep = entries['main']
         self.assertEqual(ep.value, 'mod:main')
         self.assertEqual(ep.extras, [])
 
+    def test_entry_points_distribution(self):
+        entries = entry_points(group='entries')
+        for entry in ("main", "ns:sub"):
+            ep = entries[entry]
+            self.assertIn(ep.dist.name, ('distinfo-pkg', 'egginfo-pkg'))
+            self.assertEqual(ep.dist.version, "1.0.0")
+
+    def test_entry_points_unique_packages(self):
+        # Entry points should only be exposed for the first package
+        # on sys.path with a given name.
+        alt_site_dir = self.fixtures.enter_context(fixtures.tempdir())
+        self.fixtures.enter_context(self.add_sys_path(alt_site_dir))
+        alt_pkg = {
+            "distinfo_pkg-1.1.0.dist-info": {
+                "METADATA": """
+                Name: distinfo-pkg
+                Version: 1.1.0
+                """,
+                "entry_points.txt": """
+                [entries]
+                main = mod:altmain
+            """,
+            },
+        }
+        fixtures.build_files(alt_pkg, alt_site_dir)
+        entries = entry_points(group='entries')
+        assert not any(
+            ep.dist.name == 'distinfo-pkg' and ep.dist.version == '1.0.0'
+            for ep in entries
+        )
+        # ns:sub doesn't exist in alt_pkg
+        assert 'ns:sub' not in entries
+
+    def test_entry_points_missing_name(self):
+        with self.assertRaises(KeyError):
+            entry_points(group='entries')['missing']
+
+    def test_entry_points_missing_group(self):
+        assert entry_points(group='missing') == ()
+
+    def test_entry_points_dict_construction(self):
+        # Prior versions of entry_points() returned simple lists and
+        # allowed casting those lists into maps by name using ``dict()``.
+        # Capture this now deprecated use-case.
+        with suppress_known_deprecation() as caught:
+            eps = dict(entry_points(group='entries'))
+
+        assert 'main' in eps
+        assert eps['main'] == entry_points(group='entries')['main']
+
+        # check warning
+        expected = next(iter(caught))
+        assert expected.category is DeprecationWarning
+        assert "Construction of dict of EntryPoints is deprecated" in str(expected)
+
+    def test_entry_points_by_index(self):
+        """
+        Prior versions of Distribution.entry_points would return a
+        tuple that allowed access by index.
+        Capture this now deprecated use-case
+        See python/importlib_metadata#300 and bpo-44246.
+        """
+        eps = distribution('distinfo-pkg').entry_points
+        with suppress_known_deprecation() as caught:
+            eps[0]
+
+        # check warning
+        expected = next(iter(caught))
+        assert expected.category is DeprecationWarning
+        assert "Accessing entry points by index is deprecated" in str(expected)
+
+    def test_entry_points_groups_getitem(self):
+        # Prior versions of entry_points() returned a dict. Ensure
+        # that callers using '.__getitem__()' are supported but warned to
+        # migrate.
+        with suppress_known_deprecation():
+            entry_points()['entries'] == entry_points(group='entries')
+
+            with self.assertRaises(KeyError):
+                entry_points()['missing']
+
+    def test_entry_points_groups_get(self):
+        # Prior versions of entry_points() returned a dict. Ensure
+        # that callers using '.get()' are supported but warned to
+        # migrate.
+        with suppress_known_deprecation():
+            entry_points().get('missing', 'default') == 'default'
+            entry_points().get('entries', 'default') == entry_points()['entries']
+            entry_points().get('missing', ()) == ()
+
+    def test_entry_points_allows_no_attributes(self):
+        ep = entry_points().select(group='entries', name='main')
+        with self.assertRaises(AttributeError):
+            ep.foo = 4
+
     def test_metadata_for_this_package(self):
         md = metadata('egginfo-pkg')
         assert md['author'] == 'Steven Ma'
@@ -75,13 +201,8 @@
     def test_file_hash_repr(self):
         assertRegex = self.assertRegex
 
-        util = [
-            p for p in files('distinfo-pkg')
-            if p.name == 'mod.py'
-            ][0]
-        assertRegex(
-            repr(util.hash),
-            '<FileHash mode: sha256 value: .*>')
+        util = [p for p in files('distinfo-pkg') if p.name == 'mod.py'][0]
+        assertRegex(repr(util.hash), '<FileHash mode: sha256 value: .*>')
 
     def test_files_dist_info(self):
         self._test_files(files('distinfo-pkg'))
@@ -99,10 +220,17 @@
     def test_requires_egg_info(self):
         deps = requires('egginfo-pkg')
         assert len(deps) == 2
-        assert any(
-            dep == 'wheel >= 1.0; python_version >= "2.7"'
-            for dep in deps
-            )
+        assert any(dep == 'wheel >= 1.0; python_version >= "2.7"' for dep in deps)
+
+    def test_requires_egg_info_empty(self):
+        fixtures.build_files(
+            {
+                'requires.txt': '',
+            },
+            self.site_dir.joinpath('egginfo_pkg.egg-info'),
+        )
+        deps = requires('egginfo-pkg')
+        assert deps == []
 
     def test_requires_dist_info(self):
         deps = requires('distinfo-pkg')
@@ -112,7 +240,8 @@
         assert "pytest; extra == 'test'" in deps
 
     def test_more_complex_deps_requires_text(self):
-        requires = textwrap.dedent("""
+        requires = textwrap.dedent(
+            """
             dep1
             dep2
 
@@ -121,10 +250,12 @@
 
             [extra1]
             dep4
+            dep6@ git+https://example.com/python/dep.git@v1.0.0
 
             [extra2:python_version < "3"]
             dep5
-            """)
+            """
+        )
         deps = sorted(Distribution._deps_from_requires_text(requires))
         expected = [
             'dep1',
@@ -132,25 +263,59 @@
             'dep3; python_version < "3"',
             'dep4; extra == "extra1"',
             'dep5; (python_version < "3") and extra == "extra2"',
-            ]
+            'dep6@ git+https://example.com/python/dep.git@v1.0.0 ; extra == "extra1"',
+        ]
         # It's important that the environment marker expression be
         # wrapped in parentheses to avoid the following 'and' binding more
         # tightly than some other part of the environment expression.
 
         assert deps == expected
 
+    def test_as_json(self):
+        md = metadata('distinfo-pkg').json
+        assert 'name' in md
+        assert md['keywords'] == ['sample', 'package']
+        desc = md['description']
+        assert desc.startswith('Once upon a time\nThere was')
+        assert len(md['requires_dist']) == 2
+
+    def test_as_json_egg_info(self):
+        md = metadata('egginfo-pkg').json
+        assert 'name' in md
+        assert md['keywords'] == ['sample', 'package']
+        desc = md['description']
+        assert desc.startswith('Once upon a time\nThere was')
+        assert len(md['classifier']) == 2
+
+    def test_as_json_odd_case(self):
+        self.make_uppercase()
+        md = metadata('distinfo-pkg').json
+        assert 'name' in md
+        assert len(md['requires_dist']) == 2
+        assert md['keywords'] == ['SAMPLE', 'PACKAGE']
+
+
+class LegacyDots(fixtures.DistInfoPkgWithDotLegacy, unittest.TestCase):
+    def test_name_normalization(self):
+        names = 'pkg.dot', 'pkg_dot', 'pkg-dot', 'pkg..dot', 'Pkg.Dot'
+        for name in names:
+            with self.subTest(name):
+                assert distribution(name).metadata['Name'] == 'pkg.dot'
+
+    def test_name_normalization_versionless_egg_info(self):
+        names = 'pkg.lot', 'pkg_lot', 'pkg-lot', 'pkg..lot', 'Pkg.Lot'
+        for name in names:
+            with self.subTest(name):
+                assert distribution(name).metadata['Name'] == 'pkg.lot'
+
 
 class OffSysPathTests(fixtures.DistInfoPkgOffPath, unittest.TestCase):
     def test_find_distributions_specified_path(self):
         dists = Distribution.discover(path=[str(self.site_dir)])
-        assert any(
-            dist.metadata['Name'] == 'distinfo-pkg'
-            for dist in dists
-            )
+        assert any(dist.metadata['Name'] == 'distinfo-pkg' for dist in dists)
 
     def test_distribution_at_pathlib(self):
-        """Demonstrate how to load metadata direct from a directory.
-        """
+        # Demonstrate how to load metadata direct from a directory.
         dist_info_path = self.site_dir / 'distinfo_pkg-1.0.0.dist-info'
         dist = Distribution.at(dist_info_path)
         assert dist.version == '1.0.0'
@@ -159,3 +324,9 @@
         dist_info_path = self.site_dir / 'distinfo_pkg-1.0.0.dist-info'
         dist = Distribution.at(str(dist_info_path))
         assert dist.version == '1.0.0'
+
+
+class InvalidateCache(unittest.TestCase):
+    def test_invalidate_cache(self):
+        # No externally observable behavior, but ensures test coverage...
+        importlib.invalidate_caches()
diff --git a/Lib/test/test_importlib/test_namespace_pkgs.py b/Lib/test/test_importlib/test_namespace_pkgs.py
index a8f95a0..295f97e 100644
--- a/Lib/test/test_importlib/test_namespace_pkgs.py
+++ b/Lib/test/test_importlib/test_namespace_pkgs.py
@@ -2,7 +2,9 @@
 import importlib
 import os
 import sys
+import tempfile
 import unittest
+import warnings
 
 from test.test_importlib import util
 
@@ -82,7 +84,10 @@
 
     def test_module_repr(self):
         import foo.one
-        self.assertEqual(repr(foo), "<module 'foo' (namespace)>")
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore")
+            self.assertEqual(foo.__spec__.loader.module_repr(foo),
+                            "<module 'foo' (namespace)>")
 
 
 class DynamicPathNamespacePackage(NamespacePackageTest):
@@ -124,6 +129,40 @@
         self.assertEqual(foo.two.attr, 'portion2 foo two')
 
 
+class SeparatedNamespacePackagesCreatedWhileRunning(NamespacePackageTest):
+    paths = ['portion1']
+
+    def test_invalidate_caches(self):
+        with tempfile.TemporaryDirectory() as temp_dir:
+            # we manipulate sys.path before anything is imported to avoid
+            # accidental cache invalidation when changing it
+            sys.path.append(temp_dir)
+
+            import foo.one
+            self.assertEqual(foo.one.attr, 'portion1 foo one')
+
+            # the module does not exist, so it cannot be imported
+            with self.assertRaises(ImportError):
+                import foo.just_created
+
+            # util.create_modules() manipulates sys.path
+            # so we must create the modules manually instead
+            namespace_path = os.path.join(temp_dir, 'foo')
+            os.mkdir(namespace_path)
+            module_path = os.path.join(namespace_path, 'just_created.py')
+            with open(module_path, 'w', encoding='utf-8') as file:
+                file.write('attr = "just_created foo"')
+
+            # the module is not known, so it cannot be imported yet
+            with self.assertRaises(ImportError):
+                import foo.just_created
+
+            # but after explicit cache invalidation, it is importable
+            importlib.invalidate_caches()
+            import foo.just_created
+            self.assertEqual(foo.just_created.attr, 'just_created foo')
+
+
 class SeparatedOverlappingNamespacePackages(NamespacePackageTest):
     paths = ['portion1', 'both_portions']
 
diff --git a/Lib/test/test_importlib/test_open.py b/Lib/test/test_importlib/test_open.py
index fd6e84b..b75675f 100644
--- a/Lib/test/test_importlib/test_open.py
+++ b/Lib/test/test_importlib/test_open.py
@@ -29,34 +29,32 @@
             self.assertEqual(result, 'Hello, UTF-8 world!\n')
 
     def test_open_text_given_encoding(self):
-        with resources.open_text(
-                self.data, 'utf-16.file', 'utf-16', 'strict') as fp:
+        with resources.open_text(self.data, 'utf-16.file', 'utf-16', 'strict') as fp:
             result = fp.read()
         self.assertEqual(result, 'Hello, UTF-16 world!\n')
 
     def test_open_text_with_errors(self):
         # Raises UnicodeError without the 'errors' argument.
-        with resources.open_text(
-                self.data, 'utf-16.file', 'utf-8', 'strict') as fp:
+        with resources.open_text(self.data, 'utf-16.file', 'utf-8', 'strict') as fp:
             self.assertRaises(UnicodeError, fp.read)
-        with resources.open_text(
-                self.data, 'utf-16.file', 'utf-8', 'ignore') as fp:
+        with resources.open_text(self.data, 'utf-16.file', 'utf-8', 'ignore') as fp:
             result = fp.read()
         self.assertEqual(
             result,
             'H\x00e\x00l\x00l\x00o\x00,\x00 '
             '\x00U\x00T\x00F\x00-\x001\x006\x00 '
-            '\x00w\x00o\x00r\x00l\x00d\x00!\x00\n\x00')
+            '\x00w\x00o\x00r\x00l\x00d\x00!\x00\n\x00',
+        )
 
     def test_open_binary_FileNotFoundError(self):
         self.assertRaises(
-            FileNotFoundError,
-            resources.open_binary, self.data, 'does-not-exist')
+            FileNotFoundError, resources.open_binary, self.data, 'does-not-exist'
+        )
 
     def test_open_text_FileNotFoundError(self):
         self.assertRaises(
-            FileNotFoundError,
-            resources.open_text, self.data, 'does-not-exist')
+            FileNotFoundError, resources.open_text, self.data, 'does-not-exist'
+        )
 
 
 class OpenDiskTests(OpenTests, unittest.TestCase):
@@ -64,6 +62,13 @@
         self.data = data01
 
 
+class OpenDiskNamespaceTests(OpenTests, unittest.TestCase):
+    def setUp(self):
+        from . import namespacedata01
+
+        self.data = namespacedata01
+
+
 class OpenZipTests(OpenTests, util.ZipSetup, unittest.TestCase):
     pass
 
diff --git a/Lib/test/test_importlib/test_path.py b/Lib/test/test_importlib/test_path.py
index c4e7285..d6ed09a 100644
--- a/Lib/test/test_importlib/test_path.py
+++ b/Lib/test/test_importlib/test_path.py
@@ -1,3 +1,4 @@
+import io
 import unittest
 
 from importlib import resources
@@ -27,6 +28,24 @@
 class PathDiskTests(PathTests, unittest.TestCase):
     data = data01
 
+    def test_natural_path(self):
+        # Guarantee the internal implementation detail that
+        # file-system-backed resources do not get the tempdir
+        # treatment.
+        with resources.path(self.data, 'utf-8.file') as path:
+            assert 'data' in str(path)
+
+
+class PathMemoryTests(PathTests, unittest.TestCase):
+    def setUp(self):
+        file = io.BytesIO(b'Hello, UTF-8 world!\n')
+        self.addCleanup(file.close)
+        self.data = util.create_package(
+            file=file, path=FileNotFoundError("package exists only in memory")
+        )
+        self.data.__spec__.origin = None
+        self.data.__spec__.has_location = False
+
 
 class PathZipTests(PathTests, util.ZipSetup, unittest.TestCase):
     def test_remove_in_context_manager(self):
diff --git a/Lib/test/test_importlib/test_pkg_import.py b/Lib/test/test_importlib/test_pkg_import.py
index 6181dcf..66f5f8b 100644
--- a/Lib/test/test_importlib/test_pkg_import.py
+++ b/Lib/test/test_importlib/test_pkg_import.py
@@ -7,7 +7,7 @@
 import unittest
 
 from importlib.util import cache_from_source
-from test.support import create_empty_file
+from test.support.os_helper import create_empty_file
 
 class TestImport(unittest.TestCase):
 
@@ -42,7 +42,7 @@
         compiled_path = cache_from_source(self.module_path)
         if os.path.exists(compiled_path):
             os.remove(compiled_path)
-        with open(self.module_path, 'w') as f:
+        with open(self.module_path, 'w', encoding='utf-8') as f:
             f.write(contents)
 
     def test_package_import__semantics(self):
diff --git a/Lib/test/test_importlib/test_read.py b/Lib/test/test_importlib/test_read.py
index ff78d0b..f6ec13a 100644
--- a/Lib/test/test_importlib/test_read.py
+++ b/Lib/test/test_importlib/test_read.py
@@ -25,20 +25,19 @@
         self.assertEqual(result, 'Hello, UTF-8 world!\n')
 
     def test_read_text_given_encoding(self):
-        result = resources.read_text(
-            self.data, 'utf-16.file', encoding='utf-16')
+        result = resources.read_text(self.data, 'utf-16.file', encoding='utf-16')
         self.assertEqual(result, 'Hello, UTF-16 world!\n')
 
     def test_read_text_with_errors(self):
         # Raises UnicodeError without the 'errors' argument.
-        self.assertRaises(
-            UnicodeError, resources.read_text, self.data, 'utf-16.file')
+        self.assertRaises(UnicodeError, resources.read_text, self.data, 'utf-16.file')
         result = resources.read_text(self.data, 'utf-16.file', errors='ignore')
         self.assertEqual(
             result,
             'H\x00e\x00l\x00l\x00o\x00,\x00 '
             '\x00U\x00T\x00F\x00-\x001\x006\x00 '
-            '\x00w\x00o\x00r\x00l\x00d\x00!\x00\n\x00')
+            '\x00w\x00o\x00r\x00l\x00d\x00!\x00\n\x00',
+        )
 
 
 class ReadDiskTests(ReadTests, unittest.TestCase):
@@ -48,13 +47,11 @@
 class ReadZipTests(ReadTests, util.ZipSetup, unittest.TestCase):
     def test_read_submodule_resource(self):
         submodule = import_module('ziptestdata.subdirectory')
-        result = resources.read_binary(
-            submodule, 'binary.file')
+        result = resources.read_binary(submodule, 'binary.file')
         self.assertEqual(result, b'\0\1\2\3')
 
     def test_read_submodule_resource_by_name(self):
-        result = resources.read_binary(
-            'ziptestdata.subdirectory', 'binary.file')
+        result = resources.read_binary('ziptestdata.subdirectory', 'binary.file')
         self.assertEqual(result, b'\0\1\2\3')
 
 
diff --git a/Lib/test/test_importlib/test_reader.py b/Lib/test/test_importlib/test_reader.py
new file mode 100644
index 0000000..9d20c97
--- /dev/null
+++ b/Lib/test/test_importlib/test_reader.py
@@ -0,0 +1,128 @@
+import os.path
+import sys
+import pathlib
+import unittest
+
+from importlib import import_module
+from importlib.readers import MultiplexedPath, NamespaceReader
+
+
+class MultiplexedPathTest(unittest.TestCase):
+    @classmethod
+    def setUpClass(cls):
+        path = pathlib.Path(__file__).parent / 'namespacedata01'
+        cls.folder = str(path)
+
+    def test_init_no_paths(self):
+        with self.assertRaises(FileNotFoundError):
+            MultiplexedPath()
+
+    def test_init_file(self):
+        with self.assertRaises(NotADirectoryError):
+            MultiplexedPath(os.path.join(self.folder, 'binary.file'))
+
+    def test_iterdir(self):
+        contents = {path.name for path in MultiplexedPath(self.folder).iterdir()}
+        try:
+            contents.remove('__pycache__')
+        except (KeyError, ValueError):
+            pass
+        self.assertEqual(contents, {'binary.file', 'utf-16.file', 'utf-8.file'})
+
+    def test_iterdir_duplicate(self):
+        data01 = os.path.abspath(os.path.join(__file__, '..', 'data01'))
+        contents = {
+            path.name for path in MultiplexedPath(self.folder, data01).iterdir()
+        }
+        for remove in ('__pycache__', '__init__.pyc'):
+            try:
+                contents.remove(remove)
+            except (KeyError, ValueError):
+                pass
+        self.assertEqual(
+            contents,
+            {'__init__.py', 'binary.file', 'subdirectory', 'utf-16.file', 'utf-8.file'},
+        )
+
+    def test_is_dir(self):
+        self.assertEqual(MultiplexedPath(self.folder).is_dir(), True)
+
+    def test_is_file(self):
+        self.assertEqual(MultiplexedPath(self.folder).is_file(), False)
+
+    def test_open_file(self):
+        path = MultiplexedPath(self.folder)
+        with self.assertRaises(FileNotFoundError):
+            path.read_bytes()
+        with self.assertRaises(FileNotFoundError):
+            path.read_text()
+        with self.assertRaises(FileNotFoundError):
+            path.open()
+
+    def test_join_path(self):
+        prefix = os.path.abspath(os.path.join(__file__, '..'))
+        data01 = os.path.join(prefix, 'data01')
+        path = MultiplexedPath(self.folder, data01)
+        self.assertEqual(
+            str(path.joinpath('binary.file'))[len(prefix) + 1 :],
+            os.path.join('namespacedata01', 'binary.file'),
+        )
+        self.assertEqual(
+            str(path.joinpath('subdirectory'))[len(prefix) + 1 :],
+            os.path.join('data01', 'subdirectory'),
+        )
+        self.assertEqual(
+            str(path.joinpath('imaginary'))[len(prefix) + 1 :],
+            os.path.join('namespacedata01', 'imaginary'),
+        )
+
+    def test_repr(self):
+        self.assertEqual(
+            repr(MultiplexedPath(self.folder)),
+            f"MultiplexedPath('{self.folder}')",
+        )
+
+    def test_name(self):
+        self.assertEqual(
+            MultiplexedPath(self.folder).name,
+            os.path.basename(self.folder),
+        )
+
+
+class NamespaceReaderTest(unittest.TestCase):
+    site_dir = str(pathlib.Path(__file__).parent)
+
+    @classmethod
+    def setUpClass(cls):
+        sys.path.append(cls.site_dir)
+
+    @classmethod
+    def tearDownClass(cls):
+        sys.path.remove(cls.site_dir)
+
+    def test_init_error(self):
+        with self.assertRaises(ValueError):
+            NamespaceReader(['path1', 'path2'])
+
+    def test_resource_path(self):
+        namespacedata01 = import_module('namespacedata01')
+        reader = NamespaceReader(namespacedata01.__spec__.submodule_search_locations)
+
+        root = os.path.abspath(os.path.join(__file__, '..', 'namespacedata01'))
+        self.assertEqual(
+            reader.resource_path('binary.file'), os.path.join(root, 'binary.file')
+        )
+        self.assertEqual(
+            reader.resource_path('imaginary'), os.path.join(root, 'imaginary')
+        )
+
+    def test_files(self):
+        namespacedata01 = import_module('namespacedata01')
+        reader = NamespaceReader(namespacedata01.__spec__.submodule_search_locations)
+        root = os.path.abspath(os.path.join(__file__, '..', 'namespacedata01'))
+        self.assertIsInstance(reader.files(), MultiplexedPath)
+        self.assertEqual(repr(reader.files()), f"MultiplexedPath('{root}')")
+
+
+if __name__ == '__main__':
+    unittest.main()
diff --git a/Lib/test/test_importlib/test_resource.py b/Lib/test/test_importlib/test_resource.py
index e132c57..003f7e9 100644
--- a/Lib/test/test_importlib/test_resource.py
+++ b/Lib/test/test_importlib/test_resource.py
@@ -1,13 +1,14 @@
 import sys
 import unittest
 import uuid
+import pathlib
 
 from . import data01
 from . import zipdata01, zipdata02
 from . import util
 from importlib import resources, import_module
-from pathlib import Path
-from test import support
+from test.support import import_helper
+from test.support.os_helper import unlink
 
 
 class ResourceTests:
@@ -26,20 +27,21 @@
     def test_contents(self):
         contents = set(resources.contents(self.data))
         # There may be cruft in the directory listing of the data directory.
-        # Under Python 3 we could have a __pycache__ directory, and under
-        # Python 2 we could have .pyc files.  These are both artifacts of the
-        # test suite importing these modules and writing these caches.  They
-        # aren't germane to this test, so just filter them out.
+        # It could have a __pycache__ directory,
+        # an artifact of the
+        # test suite importing these modules, which
+        # are not germane to this test, so just filter them out.
         contents.discard('__pycache__')
-        contents.discard('__init__.pyc')
-        contents.discard('__init__.pyo')
-        self.assertEqual(contents, {
-            '__init__.py',
-            'subdirectory',
-            'utf-8.file',
-            'binary.file',
-            'utf-16.file',
-            })
+        self.assertEqual(
+            contents,
+            {
+                '__init__.py',
+                'subdirectory',
+                'utf-8.file',
+                'binary.file',
+                'utf-16.file',
+            },
+        )
 
 
 class ResourceDiskTests(ResourceTests, unittest.TestCase):
@@ -54,27 +56,26 @@
 class ResourceLoaderTests(unittest.TestCase):
     def test_resource_contents(self):
         package = util.create_package(
-            file=data01, path=data01.__file__, contents=['A', 'B', 'C'])
-        self.assertEqual(
-            set(resources.contents(package)),
-            {'A', 'B', 'C'})
+            file=data01, path=data01.__file__, contents=['A', 'B', 'C']
+        )
+        self.assertEqual(set(resources.contents(package)), {'A', 'B', 'C'})
 
     def test_resource_is_resource(self):
         package = util.create_package(
-            file=data01, path=data01.__file__,
-            contents=['A', 'B', 'C', 'D/E', 'D/F'])
+            file=data01, path=data01.__file__, contents=['A', 'B', 'C', 'D/E', 'D/F']
+        )
         self.assertTrue(resources.is_resource(package, 'B'))
 
     def test_resource_directory_is_not_resource(self):
         package = util.create_package(
-            file=data01, path=data01.__file__,
-            contents=['A', 'B', 'C', 'D/E', 'D/F'])
+            file=data01, path=data01.__file__, contents=['A', 'B', 'C', 'D/E', 'D/F']
+        )
         self.assertFalse(resources.is_resource(package, 'D'))
 
     def test_resource_missing_is_not_resource(self):
         package = util.create_package(
-            file=data01, path=data01.__file__,
-            contents=['A', 'B', 'C', 'D/E', 'D/F'])
+            file=data01, path=data01.__file__, contents=['A', 'B', 'C', 'D/E', 'D/F']
+        )
         self.assertFalse(resources.is_resource(package, 'Z'))
 
 
@@ -85,100 +86,73 @@
         # 2. Are not on the file system
         # 3. Are not in a zip file
         module = util.create_package(
-            file=data01, path=data01.__file__, contents=['A', 'B', 'C'])
+            file=data01, path=data01.__file__, contents=['A', 'B', 'C']
+        )
         # Give the module a dummy loader.
         module.__loader__ = object()
         # Give the module a dummy origin.
         module.__file__ = '/path/which/shall/not/be/named'
-        if sys.version_info >= (3,):
-            module.__spec__.loader = module.__loader__
-            module.__spec__.origin = module.__file__
+        module.__spec__.loader = module.__loader__
+        module.__spec__.origin = module.__file__
         self.assertFalse(resources.is_resource(module, 'A'))
 
 
-class ResourceFromZipsTest(util.ZipSetupBase, unittest.TestCase):
-    ZIP_MODULE = zipdata02                          # type: ignore
-
-    def test_unrelated_contents(self):
-        # https://gitlab.com/python-devs/importlib_resources/issues/44
-        #
-        # Here we have a zip file with two unrelated subpackages.  The bug
-        # reports that getting the contents of a resource returns unrelated
-        # files.
-        self.assertEqual(
-            set(resources.contents('ziptestdata.one')),
-            {'__init__.py', 'resource1.txt'})
-        self.assertEqual(
-            set(resources.contents('ziptestdata.two')),
-            {'__init__.py', 'resource2.txt'})
-
-
-class SubdirectoryResourceFromZipsTest(util.ZipSetupBase, unittest.TestCase):
-    ZIP_MODULE = zipdata01                          # type: ignore
+class ResourceFromZipsTest01(util.ZipSetupBase, unittest.TestCase):
+    ZIP_MODULE = zipdata01  # type: ignore
 
     def test_is_submodule_resource(self):
         submodule = import_module('ziptestdata.subdirectory')
-        self.assertTrue(
-            resources.is_resource(submodule, 'binary.file'))
+        self.assertTrue(resources.is_resource(submodule, 'binary.file'))
 
     def test_read_submodule_resource_by_name(self):
         self.assertTrue(
-            resources.is_resource('ziptestdata.subdirectory', 'binary.file'))
+            resources.is_resource('ziptestdata.subdirectory', 'binary.file')
+        )
 
     def test_submodule_contents(self):
         submodule = import_module('ziptestdata.subdirectory')
         self.assertEqual(
-            set(resources.contents(submodule)),
-            {'__init__.py', 'binary.file'})
+            set(resources.contents(submodule)), {'__init__.py', 'binary.file'}
+        )
 
     def test_submodule_contents_by_name(self):
         self.assertEqual(
             set(resources.contents('ziptestdata.subdirectory')),
-            {'__init__.py', 'binary.file'})
+            {'__init__.py', 'binary.file'},
+        )
 
 
-class NamespaceTest(unittest.TestCase):
-    def test_namespaces_cannot_have_resources(self):
-        contents = resources.contents('test.test_importlib.data03.namespace')
-        self.assertFalse(list(contents))
-        # Even though there is a file in the namespace directory, it is not
-        # considered a resource, since namespace packages can't have them.
-        self.assertFalse(resources.is_resource(
-            'test.test_importlib.data03.namespace',
-            'resource1.txt'))
-        # We should get an exception if we try to read it or open it.
-        self.assertRaises(
-            FileNotFoundError,
-            resources.open_text,
-            'test.test_importlib.data03.namespace', 'resource1.txt')
-        self.assertRaises(
-            FileNotFoundError,
-            resources.open_binary,
-            'test.test_importlib.data03.namespace', 'resource1.txt')
-        self.assertRaises(
-            FileNotFoundError,
-            resources.read_text,
-            'test.test_importlib.data03.namespace', 'resource1.txt')
-        self.assertRaises(
-            FileNotFoundError,
-            resources.read_binary,
-            'test.test_importlib.data03.namespace', 'resource1.txt')
+class ResourceFromZipsTest02(util.ZipSetupBase, unittest.TestCase):
+    ZIP_MODULE = zipdata02  # type: ignore
+
+    def test_unrelated_contents(self):
+        """
+        Test thata zip with two unrelated subpackages return
+        distinct resources. Ref python/importlib_resources#44.
+        """
+        self.assertEqual(
+            set(resources.contents('ziptestdata.one')), {'__init__.py', 'resource1.txt'}
+        )
+        self.assertEqual(
+            set(resources.contents('ziptestdata.two')), {'__init__.py', 'resource2.txt'}
+        )
 
 
 class DeletingZipsTest(unittest.TestCase):
     """Having accessed resources in a zip file should not keep an open
     reference to the zip.
     """
+
     ZIP_MODULE = zipdata01
 
     def setUp(self):
-        modules = support.modules_setup()
-        self.addCleanup(support.modules_cleanup, *modules)
+        modules = import_helper.modules_setup()
+        self.addCleanup(import_helper.modules_cleanup, *modules)
 
-        data_path = Path(self.ZIP_MODULE.__file__)
+        data_path = pathlib.Path(self.ZIP_MODULE.__file__)
         data_dir = data_path.parent
         self.source_zip_path = data_dir / 'ziptestdata.zip'
-        self.zip_path = Path.cwd() / '{}.zip'.format(uuid.uuid4())
+        self.zip_path = pathlib.Path(f'{uuid.uuid4()}.zip').absolute()
         self.zip_path.write_bytes(self.source_zip_path.read_bytes())
         sys.path.append(str(self.zip_path))
         self.data = import_module('ziptestdata')
@@ -196,7 +170,7 @@
             pass
 
         try:
-            support.unlink(self.zip_path)
+            unlink(self.zip_path)
         except OSError:
             # If the test fails, this will probably fail too
             pass
@@ -204,32 +178,77 @@
     def test_contents_does_not_keep_open(self):
         c = resources.contents('ziptestdata')
         self.zip_path.unlink()
+        del c
 
     def test_is_resource_does_not_keep_open(self):
         c = resources.is_resource('ziptestdata', 'binary.file')
         self.zip_path.unlink()
+        del c
 
     def test_is_resource_failure_does_not_keep_open(self):
         c = resources.is_resource('ziptestdata', 'not-present')
         self.zip_path.unlink()
+        del c
 
+    @unittest.skip("Desired but not supported.")
     def test_path_does_not_keep_open(self):
         c = resources.path('ziptestdata', 'binary.file')
         self.zip_path.unlink()
+        del c
 
     def test_entered_path_does_not_keep_open(self):
         # This is what certifi does on import to make its bundle
         # available for the process duration.
         c = resources.path('ziptestdata', 'binary.file').__enter__()
         self.zip_path.unlink()
+        del c
 
     def test_read_binary_does_not_keep_open(self):
         c = resources.read_binary('ziptestdata', 'binary.file')
         self.zip_path.unlink()
+        del c
 
     def test_read_text_does_not_keep_open(self):
         c = resources.read_text('ziptestdata', 'utf-8.file', encoding='utf-8')
         self.zip_path.unlink()
+        del c
+
+
+class ResourceFromNamespaceTest01(unittest.TestCase):
+    site_dir = str(pathlib.Path(__file__).parent)
+
+    @classmethod
+    def setUpClass(cls):
+        sys.path.append(cls.site_dir)
+
+    @classmethod
+    def tearDownClass(cls):
+        sys.path.remove(cls.site_dir)
+
+    def test_is_submodule_resource(self):
+        self.assertTrue(
+            resources.is_resource(import_module('namespacedata01'), 'binary.file')
+        )
+
+    def test_read_submodule_resource_by_name(self):
+        self.assertTrue(resources.is_resource('namespacedata01', 'binary.file'))
+
+    def test_submodule_contents(self):
+        contents = set(resources.contents(import_module('namespacedata01')))
+        try:
+            contents.remove('__pycache__')
+        except KeyError:
+            pass
+        self.assertEqual(contents, {'binary.file', 'utf-8.file', 'utf-16.file'})
+
+    def test_submodule_contents_by_name(self):
+        contents = set(resources.contents('namespacedata01'))
+        try:
+            contents.remove('__pycache__')
+        except KeyError:
+            pass
+        self.assertEqual(contents, {'binary.file', 'utf-8.file', 'utf-16.file'})
+
 
 if __name__ == '__main__':
     unittest.main()
diff --git a/Lib/test/test_importlib/test_spec.py b/Lib/test/test_importlib/test_spec.py
index 5a16a03..dcb0527 100644
--- a/Lib/test/test_importlib/test_spec.py
+++ b/Lib/test/test_importlib/test_spec.py
@@ -6,7 +6,7 @@
 
 import os.path
 import pathlib
-from test.support import CleanImport
+from test.support.import_helper import CleanImport
 import unittest
 import sys
 import warnings
@@ -303,32 +303,38 @@
             self.assertNotIn(self.spec.name, sys.modules)
 
     def test_load_legacy(self):
-        self.spec.loader = LegacyLoader()
-        with CleanImport(self.spec.name):
-            loaded = self.bootstrap._load(self.spec)
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", ImportWarning)
+            self.spec.loader = LegacyLoader()
+            with CleanImport(self.spec.name):
+                loaded = self.bootstrap._load(self.spec)
 
-        self.assertEqual(loaded.ham, -1)
+            self.assertEqual(loaded.ham, -1)
 
     def test_load_legacy_attributes(self):
-        self.spec.loader = LegacyLoader()
-        with CleanImport(self.spec.name):
-            loaded = self.bootstrap._load(self.spec)
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", ImportWarning)
+            self.spec.loader = LegacyLoader()
+            with CleanImport(self.spec.name):
+                loaded = self.bootstrap._load(self.spec)
 
-        self.assertIs(loaded.__loader__, self.spec.loader)
-        self.assertEqual(loaded.__package__, self.spec.parent)
-        self.assertIs(loaded.__spec__, self.spec)
+            self.assertIs(loaded.__loader__, self.spec.loader)
+            self.assertEqual(loaded.__package__, self.spec.parent)
+            self.assertIs(loaded.__spec__, self.spec)
 
     def test_load_legacy_attributes_immutable(self):
         module = object()
-        class ImmutableLoader(TestLoader):
-            def load_module(self, name):
-                sys.modules[name] = module
-                return module
-        self.spec.loader = ImmutableLoader()
-        with CleanImport(self.spec.name):
-            loaded = self.bootstrap._load(self.spec)
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", ImportWarning)
+            class ImmutableLoader(TestLoader):
+                def load_module(self, name):
+                    sys.modules[name] = module
+                    return module
+            self.spec.loader = ImmutableLoader()
+            with CleanImport(self.spec.name):
+                loaded = self.bootstrap._load(self.spec)
 
-            self.assertIs(sys.modules[self.spec.name], module)
+                self.assertIs(sys.modules[self.spec.name], module)
 
     # reload()
 
@@ -382,11 +388,13 @@
         self.assertFalse(hasattr(loaded, '__cached__'))
 
     def test_reload_legacy(self):
-        self.spec.loader = LegacyLoader()
-        with CleanImport(self.spec.name):
-            loaded = self.bootstrap._load(self.spec)
-            reloaded = self.bootstrap._exec(self.spec, loaded)
-            installed = sys.modules[self.spec.name]
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", ImportWarning)
+            self.spec.loader = LegacyLoader()
+            with CleanImport(self.spec.name):
+                loaded = self.bootstrap._load(self.spec)
+                reloaded = self.bootstrap._exec(self.spec, loaded)
+                installed = sys.modules[self.spec.name]
 
         self.assertEqual(loaded.ham, -1)
         self.assertIs(reloaded, loaded)
@@ -498,7 +506,7 @@
 
     def setUp(self):
         self.name = 'spam'
-        self.path = 'spam.py'
+        self.path = os.path.abspath('spam.py')
         self.cached = self.util.cache_from_source(self.path)
         self.loader = TestLoader()
         self.fileloader = TestLoader(self.path)
@@ -637,7 +645,7 @@
         self.assertEqual(spec.loader, self.fileloader)
         self.assertEqual(spec.origin, self.path)
         self.assertIs(spec.loader_state, None)
-        self.assertEqual(spec.submodule_search_locations, [''])
+        self.assertEqual(spec.submodule_search_locations, [os.getcwd()])
         self.assertEqual(spec.cached, self.cached)
         self.assertTrue(spec.has_location)
 
@@ -650,8 +658,8 @@
         # Need to use a circuitous route to get at importlib.machinery to make
         # sure the same class object is used in the isinstance() check as
         # would have been used to create the loader.
-        self.assertIsInstance(spec.loader,
-                              self.util.abc.machinery.SourceFileLoader)
+        SourceFileLoader = self.util.spec_from_file_location.__globals__['SourceFileLoader']
+        self.assertIsInstance(spec.loader, SourceFileLoader)
         self.assertEqual(spec.loader.name, self.name)
         self.assertEqual(spec.loader.path, self.path)
         self.assertEqual(spec.origin, self.path)
@@ -736,7 +744,7 @@
         self.assertEqual(spec.loader, self.fileloader)
         self.assertEqual(spec.origin, self.path)
         self.assertIs(spec.loader_state, None)
-        self.assertEqual(spec.submodule_search_locations, [''])
+        self.assertEqual(spec.submodule_search_locations, [os.getcwd()])
         self.assertEqual(spec.cached, self.cached)
         self.assertTrue(spec.has_location)
 
@@ -761,7 +769,7 @@
         self.assertEqual(spec.loader, self.pkgloader)
         self.assertEqual(spec.origin, self.path)
         self.assertIs(spec.loader_state, None)
-        self.assertEqual(spec.submodule_search_locations, [''])
+        self.assertEqual(spec.submodule_search_locations, [os.getcwd()])
         self.assertEqual(spec.cached, self.cached)
         self.assertTrue(spec.has_location)
 
@@ -809,6 +817,17 @@
         self.assertEqual(spec.cached, self.cached)
         self.assertTrue(spec.has_location)
 
+    def test_spec_from_file_location_relative_path(self):
+        spec = self.util.spec_from_file_location(self.name,
+            os.path.basename(self.path), loader=self.fileloader)
+
+        self.assertEqual(spec.name, self.name)
+        self.assertEqual(spec.loader, self.fileloader)
+        self.assertEqual(spec.origin, self.path)
+        self.assertIs(spec.loader_state, None)
+        self.assertIs(spec.submodule_search_locations, None)
+        self.assertEqual(spec.cached, self.cached)
+        self.assertTrue(spec.has_location)
 
 (Frozen_FactoryTests,
  Source_FactoryTests
diff --git a/Lib/test/test_importlib/test_threaded_import.py b/Lib/test/test_importlib/test_threaded_import.py
index d1f64c7..76b028e 100644
--- a/Lib/test/test_importlib/test_threaded_import.py
+++ b/Lib/test/test_importlib/test_threaded_import.py
@@ -14,9 +14,10 @@
 import threading
 import unittest
 from unittest import mock
-from test.support import (
-    verbose, run_unittest, TESTFN, reap_threads,
-    forget, unlink, rmtree, start_threads)
+from test.support import verbose
+from test.support.import_helper import forget
+from test.support.os_helper import (TESTFN, unlink, rmtree)
+from test.support import script_helper, threading_helper
 
 def task(N, done, done_tasks, errors):
     try:
@@ -124,9 +125,9 @@
             done_tasks = []
             done.clear()
             t0 = time.monotonic()
-            with start_threads(threading.Thread(target=task,
-                                                args=(N, done, done_tasks, errors,))
-                               for i in range(N)):
+            with threading_helper.start_threads(
+                    threading.Thread(target=task, args=(N, done, done_tasks, errors,))
+                    for i in range(N)):
                 pass
             completed = done.wait(10 * 60)
             dt = time.monotonic() - t0
@@ -244,20 +245,29 @@
         __import__(TESTFN)
         del sys.modules[TESTFN]
 
+    def test_concurrent_futures_circular_import(self):
+        # Regression test for bpo-43515
+        fn = os.path.join(os.path.dirname(__file__),
+                          'partial', 'cfimport.py')
+        script_helper.assert_python_ok(fn)
 
-@reap_threads
-def test_main():
-    old_switchinterval = None
+    def test_multiprocessing_pool_circular_import(self):
+        # Regression test for bpo-41567
+        fn = os.path.join(os.path.dirname(__file__),
+                          'partial', 'pool_in_threads.py')
+        script_helper.assert_python_ok(fn)
+
+
+def setUpModule():
+    thread_info = threading_helper.threading_setup()
+    unittest.addModuleCleanup(threading_helper.threading_cleanup, *thread_info)
     try:
         old_switchinterval = sys.getswitchinterval()
+        unittest.addModuleCleanup(sys.setswitchinterval, old_switchinterval)
         sys.setswitchinterval(1e-5)
     except AttributeError:
         pass
-    try:
-        run_unittest(ThreadedImportTests)
-    finally:
-        if old_switchinterval is not None:
-            sys.setswitchinterval(old_switchinterval)
+
 
 if __name__ == "__main__":
-    test_main()
+    unittets.main()
diff --git a/Lib/test/test_importlib/test_util.py b/Lib/test/test_importlib/test_util.py
index d6c10ed..f9ff26f 100644
--- a/Lib/test/test_importlib/test_util.py
+++ b/Lib/test/test_importlib/test_util.py
@@ -845,23 +845,21 @@
         'only applies to candidate or final python release levels'
     )
     def test_magic_number(self):
-        """
-        Each python minor release should generally have a MAGIC_NUMBER
-        that does not change once the release reaches candidate status.
+        # Each python minor release should generally have a MAGIC_NUMBER
+        # that does not change once the release reaches candidate status.
 
-        Once a release reaches candidate status, the value of the constant
-        EXPECTED_MAGIC_NUMBER in this test should be changed.
-        This test will then check that the actual MAGIC_NUMBER matches
-        the expected value for the release.
+        # Once a release reaches candidate status, the value of the constant
+        # EXPECTED_MAGIC_NUMBER in this test should be changed.
+        # This test will then check that the actual MAGIC_NUMBER matches
+        # the expected value for the release.
 
-        In exceptional cases, it may be required to change the MAGIC_NUMBER
-        for a maintenance release. In this case the change should be
-        discussed in python-dev. If a change is required, community
-        stakeholders such as OS package maintainers must be notified
-        in advance. Such exceptional releases will then require an
-        adjustment to this test case.
-        """
-        EXPECTED_MAGIC_NUMBER = 3425
+        # In exceptional cases, it may be required to change the MAGIC_NUMBER
+        # for a maintenance release. In this case the change should be
+        # discussed in python-dev. If a change is required, community
+        # stakeholders such as OS package maintainers must be notified
+        # in advance. Such exceptional releases will then require an
+        # adjustment to this test case.
+        EXPECTED_MAGIC_NUMBER = 3439
         actual = int.from_bytes(importlib.util.MAGIC_NUMBER[:2], 'little')
 
         msg = (
diff --git a/Lib/test/test_importlib/test_windows.py b/Lib/test/test_importlib/test_windows.py
index 005b685..1b9e185 100644
--- a/Lib/test/test_importlib/test_windows.py
+++ b/Lib/test/test_importlib/test_windows.py
@@ -5,18 +5,38 @@
 import re
 import sys
 import unittest
+import warnings
 from test import support
-from distutils.util import get_platform
+from test.support import import_helper
 from contextlib import contextmanager
 from .util import temp_module
 
-support.import_module('winreg', required_on=['win'])
+import_helper.import_module('winreg', required_on=['win'])
 from winreg import (
     CreateKey, HKEY_CURRENT_USER,
     SetValue, REG_SZ, KEY_ALL_ACCESS,
     EnumKey, CloseKey, DeleteKey, OpenKey
 )
 
+def get_platform():
+    # Port of distutils.util.get_platform().
+    TARGET_TO_PLAT = {
+            'x86' : 'win32',
+            'x64' : 'win-amd64',
+            'arm' : 'win-arm32',
+        }
+    if ('VSCMD_ARG_TGT_ARCH' in os.environ and
+        os.environ['VSCMD_ARG_TGT_ARCH'] in TARGET_TO_PLAT):
+        return TARGET_TO_PLAT[os.environ['VSCMD_ARG_TGT_ARCH']]
+    elif 'amd64' in sys.version.lower():
+        return 'win-amd64'
+    elif '(arm)' in sys.version.lower():
+        return 'win-arm32'
+    elif '(arm64)' in sys.version.lower():
+        return 'win-arm64'
+    else:
+        return sys.platform
+
 def delete_registry_tree(root, subkey):
     try:
         hkey = OpenKey(root, subkey, access=KEY_ALL_ACCESS)
@@ -41,17 +61,28 @@
         root = machinery.WindowsRegistryFinder.REGISTRY_KEY
     key = root.format(fullname=name,
                       sys_version='%d.%d' % sys.version_info[:2])
+    base_key = "Software\\Python\\PythonCore\\{}.{}".format(
+        sys.version_info.major, sys.version_info.minor)
+    assert key.casefold().startswith(base_key.casefold()), (
+        "expected key '{}' to start with '{}'".format(key, base_key))
     try:
         with temp_module(name, "a = 1") as location:
+            try:
+                OpenKey(HKEY_CURRENT_USER, base_key)
+                if machinery.WindowsRegistryFinder.DEBUG_BUILD:
+                    delete_key = os.path.dirname(key)
+                else:
+                    delete_key = key
+            except OSError:
+                delete_key = base_key
             subkey = CreateKey(HKEY_CURRENT_USER, key)
             if path is None:
                 path = location + ".py"
             SetValue(subkey, "", REG_SZ, path)
             yield
     finally:
-        if machinery.WindowsRegistryFinder.DEBUG_BUILD:
-            key = os.path.dirname(key)
-        delete_registry_tree(HKEY_CURRENT_USER, key)
+        if delete_key:
+            delete_registry_tree(HKEY_CURRENT_USER, delete_key)
 
 
 @unittest.skipUnless(sys.platform.startswith('win'), 'requires Windows')
@@ -65,19 +96,25 @@
         self.assertIs(spec, None)
 
     def test_find_module_missing(self):
-        loader = self.machinery.WindowsRegistryFinder.find_module('spam')
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", DeprecationWarning)
+            loader = self.machinery.WindowsRegistryFinder.find_module('spam')
         self.assertIs(loader, None)
 
     def test_module_found(self):
         with setup_module(self.machinery, self.test_module):
-            loader = self.machinery.WindowsRegistryFinder.find_module(self.test_module)
+            with warnings.catch_warnings():
+                warnings.simplefilter("ignore", DeprecationWarning)
+                loader = self.machinery.WindowsRegistryFinder.find_module(self.test_module)
             spec = self.machinery.WindowsRegistryFinder.find_spec(self.test_module)
             self.assertIsNot(loader, None)
             self.assertIsNot(spec, None)
 
     def test_module_not_found(self):
         with setup_module(self.machinery, self.test_module, path="."):
-            loader = self.machinery.WindowsRegistryFinder.find_module(self.test_module)
+            with warnings.catch_warnings():
+                warnings.simplefilter("ignore", DeprecationWarning)
+                loader = self.machinery.WindowsRegistryFinder.find_module(self.test_module)
             spec = self.machinery.WindowsRegistryFinder.find_spec(self.test_module)
             self.assertIsNone(loader)
             self.assertIsNone(spec)
@@ -100,10 +137,55 @@
 
         self.assertIn(expected_tag, suffixes)
 
-        # Ensure the tags are in the correct order
+        # Ensure the tags are in the correct order.
         tagged_i = suffixes.index(expected_tag)
         self.assertLess(tagged_i, untagged_i)
 
 (Frozen_WindowsExtensionSuffixTests,
  Source_WindowsExtensionSuffixTests
  ) = test_util.test_both(WindowsExtensionSuffixTests, machinery=machinery)
+
+
+@unittest.skipUnless(sys.platform.startswith('win'), 'requires Windows')
+class WindowsBootstrapPathTests(unittest.TestCase):
+    def check_join(self, expected, *inputs):
+        from importlib._bootstrap_external import _path_join
+        actual = _path_join(*inputs)
+        if expected.casefold() == actual.casefold():
+            return
+        self.assertEqual(expected, actual)
+
+    def test_path_join(self):
+        self.check_join(r"C:\A\B", "C:\\", "A", "B")
+        self.check_join(r"C:\A\B", "D:\\", "D", "C:\\", "A", "B")
+        self.check_join(r"C:\A\B", "C:\\", "A", "C:B")
+        self.check_join(r"C:\A\B", "C:\\", "A\\B")
+        self.check_join(r"C:\A\B", r"C:\A\B")
+
+        self.check_join("D:A", r"D:", "A")
+        self.check_join("D:A", r"C:\B\C", "D:", "A")
+        self.check_join("D:A", r"C:\B\C", r"D:A")
+
+        self.check_join(r"A\B\C", "A", "B", "C")
+        self.check_join(r"A\B\C", "A", r"B\C")
+        self.check_join(r"A\B/C", "A", "B/C")
+        self.check_join(r"A\B\C", "A/", "B\\", "C")
+
+        # Dots are not normalised by this function
+        self.check_join(r"A\../C", "A", "../C")
+        self.check_join(r"A.\.\B", "A.", ".", "B")
+
+        self.check_join(r"\\Server\Share\A\B\C", r"\\Server\Share", "A", "B", "C")
+        self.check_join(r"\\Server\Share\A\B\C", r"\\Server\Share", "D", r"\A", "B", "C")
+        self.check_join(r"\\Server\Share\A\B\C", r"\\Server2\Share2", "D",
+                                                 r"\\Server\Share", "A", "B", "C")
+        self.check_join(r"\\Server\Share\A\B\C", r"\\Server", r"\Share", "A", "B", "C")
+        self.check_join(r"\\Server\Share", r"\\Server\Share")
+        self.check_join(r"\\Server\Share\\", r"\\Server\Share\\")
+
+        # Handle edge cases with empty segments
+        self.check_join("C:\\A", "C:/A", "")
+        self.check_join("C:\\", "C:/", "")
+        self.check_join("C:", "C:", "")
+        self.check_join("//Server/Share\\", "//Server/Share/", "")
+        self.check_join("//Server/Share\\", "//Server/Share", "")
diff --git a/Lib/test/test_importlib/test_zip.py b/Lib/test/test_importlib/test_zip.py
index a5399c1..bf16a3b 100644
--- a/Lib/test/test_importlib/test_zip.py
+++ b/Lib/test/test_importlib/test_zip.py
@@ -3,8 +3,12 @@
 
 from contextlib import ExitStack
 from importlib.metadata import (
-    distribution, entry_points, files, PackageNotFoundError,
-    version, distributions,
+    PackageNotFoundError,
+    distribution,
+    distributions,
+    entry_points,
+    files,
+    version,
 )
 from importlib import resources
 
@@ -37,7 +41,7 @@
             version('definitely-not-installed')
 
     def test_zip_entry_points(self):
-        scripts = dict(entry_points()['console_scripts'])
+        scripts = entry_points(group='console_scripts')
         entry_point = scripts['example']
         self.assertEqual(entry_point.value, 'example:main')
         entry_point = scripts['Example']
@@ -72,3 +76,7 @@
         for file in files('example'):
             path = str(file.dist.locate_file(file))
             assert '.egg/' in path, path
+
+    def test_normalized_name(self):
+        dist = distribution('example')
+        assert dist._normalized_name == 'example'
diff --git a/Lib/test/test_importlib/update-zips.py b/Lib/test/test_importlib/update-zips.py
new file mode 100755
index 0000000..9ef0224
--- /dev/null
+++ b/Lib/test/test_importlib/update-zips.py
@@ -0,0 +1,53 @@
+"""
+Generate the zip test data files.
+
+Run to build the tests/zipdataNN/ziptestdata.zip files from
+files in tests/dataNN.
+
+Replaces the file with the working copy, but does commit anything
+to the source repo.
+"""
+
+import contextlib
+import os
+import pathlib
+import zipfile
+
+
+def main():
+    """
+    >>> from unittest import mock
+    >>> monkeypatch = getfixture('monkeypatch')
+    >>> monkeypatch.setattr(zipfile, 'ZipFile', mock.MagicMock())
+    >>> print(); main()  # print workaround for bpo-32509
+    <BLANKLINE>
+    ...data01... -> ziptestdata/...
+    ...
+    ...data02... -> ziptestdata/...
+    ...
+    """
+    suffixes = '01', '02'
+    tuple(map(generate, suffixes))
+
+
+def generate(suffix):
+    root = pathlib.Path(__file__).parent.relative_to(os.getcwd())
+    zfpath = root / f'zipdata{suffix}/ziptestdata.zip'
+    with zipfile.ZipFile(zfpath, 'w') as zf:
+        for src, rel in walk(root / f'data{suffix}'):
+            dst = 'ziptestdata' / pathlib.PurePosixPath(rel.as_posix())
+            print(src, '->', dst)
+            zf.write(src, dst)
+
+
+def walk(datapath):
+    for dirpath, dirnames, filenames in os.walk(datapath):
+        with contextlib.suppress(KeyError):
+            dirnames.remove('__pycache__')
+        for filename in filenames:
+            res = pathlib.Path(dirpath) / filename
+            rel = res.relative_to(datapath)
+            yield res, rel
+
+
+__name__ == '__main__' and main()
diff --git a/Lib/test/test_importlib/util.py b/Lib/test/test_importlib/util.py
index de6e0b0..ca0d8c9 100644
--- a/Lib/test/test_importlib/util.py
+++ b/Lib/test/test_importlib/util.py
@@ -12,6 +12,8 @@
 import os.path
 from pathlib import Path, PurePath
 from test import support
+from test.support import import_helper
+from test.support import os_helper
 import unittest
 import sys
 import tempfile
@@ -55,8 +57,8 @@
 def import_importlib(module_name):
     """Import a module from importlib both w/ and w/o _frozen_importlib."""
     fresh = ('importlib',) if '.' in module_name else ()
-    frozen = support.import_fresh_module(module_name)
-    source = support.import_fresh_module(module_name, fresh=fresh,
+    frozen = import_helper.import_fresh_module(module_name)
+    source = import_helper.import_fresh_module(module_name, fresh=fresh,
                                          blocked=('_frozen_importlib', '_frozen_importlib_external'))
     return {'Frozen': frozen, 'Source': source}
 
@@ -114,7 +116,7 @@
 
 def submodule(parent, name, pkg_dir, content=''):
     path = os.path.join(pkg_dir, name + '.py')
-    with open(path, 'w') as subfile:
+    with open(path, 'w', encoding='utf-8') as subfile:
         subfile.write(content)
     return '{}.{}'.format(parent, name), path
 
@@ -158,9 +160,9 @@
 @contextlib.contextmanager
 def temp_module(name, content='', *, pkg=False):
     conflicts = [n for n in sys.modules if n.partition('.')[0] == name]
-    with support.temp_cwd(None) as cwd:
+    with os_helper.temp_cwd(None) as cwd:
         with uncache(name, *conflicts):
-            with support.DirsOnSysPath(cwd):
+            with import_helper.DirsOnSysPath(cwd):
                 invalidate_caches()
 
                 location = os.path.join(cwd, name)
@@ -174,7 +176,7 @@
                         content = ''
                 if content is not None:
                     # not a namespace package
-                    with open(modpath, 'w') as modfile:
+                    with open(modpath, 'w', encoding='utf-8') as modfile:
                         modfile.write(content)
                 yield location
 
@@ -382,7 +384,7 @@
                     os.mkdir(file_path)
                     created_paths.append(file_path)
             file_path = os.path.join(file_path, name_parts[-1] + '.py')
-            with open(file_path, 'w') as file:
+            with open(file_path, 'w', encoding='utf-8') as file:
                 file.write(source.format(name))
             created_paths.append(file_path)
             mapping[name] = file_path
@@ -396,7 +398,7 @@
             state_manager.__exit__(None, None, None)
         if uncache_manager is not None:
             uncache_manager.__exit__(None, None, None)
-        support.rmtree(temp_dir)
+        os_helper.rmtree(temp_dir)
 
 
 def mock_path_hook(*entries, importer):
@@ -572,8 +574,8 @@
             pass
 
     def setUp(self):
-        modules = support.modules_setup()
-        self.addCleanup(support.modules_cleanup, *modules)
+        modules = import_helper.modules_setup()
+        self.addCleanup(import_helper.modules_cleanup, *modules)
 
 
 class ZipSetup(ZipSetupBase):
diff --git a/Lib/test/test_importlib/zipdata01/ziptestdata.zip b/Lib/test/test_importlib/zipdata01/ziptestdata.zip
index 8d8fa97..9a3bb07 100644
--- a/Lib/test/test_importlib/zipdata01/ziptestdata.zip
+++ b/Lib/test/test_importlib/zipdata01/ziptestdata.zip
Binary files differ
diff --git a/Lib/test/test_importlib/zipdata02/ziptestdata.zip b/Lib/test/test_importlib/zipdata02/ziptestdata.zip
index 6f34889..d63ff51 100644
--- a/Lib/test/test_importlib/zipdata02/ziptestdata.zip
+++ b/Lib/test/test_importlib/zipdata02/ziptestdata.zip
Binary files differ
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py
index d9e26a3..28e4f5b 100644
--- a/Lib/test/test_inspect.py
+++ b/Lib/test/test_inspect.py
@@ -24,12 +24,17 @@
 except ImportError:
     ThreadPoolExecutor = None
 
-from test.support import run_unittest, TESTFN, DirsOnSysPath, cpython_only
+from test.support import cpython_only
 from test.support import MISSING_C_DOCSTRINGS, ALWAYS_EQ
+from test.support.import_helper import DirsOnSysPath
+from test.support.os_helper import TESTFN
 from test.support.script_helper import assert_python_ok, assert_python_failure
 from test import inspect_fodder as mod
 from test import inspect_fodder2 as mod2
 from test import support
+from test import inspect_stock_annotations
+from test import inspect_stringized_annotations
+from test import inspect_stringized_annotations_2
 
 from test.test_import import _ready_to_import
 
@@ -127,8 +132,8 @@
         self.istest(inspect.iscode, 'mod.spam.__code__')
         try:
             1/0
-        except:
-            tb = sys.exc_info()[2]
+        except Exception as e:
+            tb = e.__traceback__
             self.istest(inspect.isframe, 'tb.tb_frame')
             self.istest(inspect.istraceback, 'tb')
             if hasattr(types, 'GetSetDescriptorType'):
@@ -361,7 +366,7 @@
     fodderModule = None
 
     def setUp(self):
-        with open(inspect.getsourcefile(self.fodderModule)) as fp:
+        with open(inspect.getsourcefile(self.fodderModule), encoding="utf-8") as fp:
             self.source = fp.read()
 
     def sourcerange(self, top, bottom):
@@ -488,6 +493,15 @@
         # Check filename override
         self.assertEqual(inspect.getmodule(None, modfile), mod)
 
+    def test_getmodule_file_not_found(self):
+        # See bpo-45406
+        def _getabsfile(obj, _filename):
+            raise FileNotFoundError('bad file')
+        with unittest.mock.patch('inspect.getabsfile', _getabsfile):
+            f = inspect.currentframe()
+            self.assertIsNone(inspect.getmodule(f))
+            inspect.getouterframes(f)  # smoke test
+
     def test_getframeinfo_get_first_line(self):
         frame_info = inspect.getframeinfo(self.fodderModule.fr, 50)
         self.assertEqual(frame_info.code_context[0], "# line 1\n")
@@ -580,6 +594,17 @@
     def test_getsource_on_code_object(self):
         self.assertSourceEqual(mod.eggs.__code__, 12, 18)
 
+class TestGetsourceInteractive(unittest.TestCase):
+    def test_getclasses_interactive(self):
+        # bpo-44648: simulate a REPL session;
+        # there is no `__file__` in the __main__ module
+        code = "import sys, inspect; \
+                assert not hasattr(sys.modules['__main__'], '__file__'); \
+                A = type('A', (), {}); \
+                inspect.getsource(A)"
+        _, _, stderr = assert_python_failure("-c", code, __isolated=True)
+        self.assertIn(b'OSError: source code not available', stderr)
+
 class TestGettingSourceOfToplevelFrames(GetSourceBase):
     fodderModule = mod
 
@@ -771,8 +796,8 @@
     def setUp(self):
         self.tempdir = TESTFN + '_dir'
         os.mkdir(self.tempdir)
-        with open(os.path.join(self.tempdir,
-                               'inspect_fodder3%spy' % os.extsep), 'w') as f:
+        with open(os.path.join(self.tempdir, 'inspect_fodder3%spy' % os.extsep),
+                  'w', encoding='utf-8') as f:
             f.write("class X:\n    pass # No EOL")
         with DirsOnSysPath(self.tempdir):
             import inspect_fodder3 as mod3
@@ -1279,6 +1304,106 @@
         attrs = [a[0] for a in inspect.getmembers(C)]
         self.assertNotIn('missing', attrs)
 
+    def test_get_annotations_with_stock_annotations(self):
+        def foo(a:int, b:str): pass
+        self.assertEqual(inspect.get_annotations(foo), {'a': int, 'b': str})
+
+        foo.__annotations__ = {'a': 'foo', 'b':'str'}
+        self.assertEqual(inspect.get_annotations(foo), {'a': 'foo', 'b': 'str'})
+
+        self.assertEqual(inspect.get_annotations(foo, eval_str=True, locals=locals()), {'a': foo, 'b': str})
+        self.assertEqual(inspect.get_annotations(foo, eval_str=True, globals=locals()), {'a': foo, 'b': str})
+
+        isa = inspect_stock_annotations
+        self.assertEqual(inspect.get_annotations(isa), {'a': int, 'b': str})
+        self.assertEqual(inspect.get_annotations(isa.MyClass), {'a': int, 'b': str})
+        self.assertEqual(inspect.get_annotations(isa.function), {'a': int, 'b': str, 'return': isa.MyClass})
+        self.assertEqual(inspect.get_annotations(isa.function2), {'a': int, 'b': 'str', 'c': isa.MyClass, 'return': isa.MyClass})
+        self.assertEqual(inspect.get_annotations(isa.function3), {'a': 'int', 'b': 'str', 'c': 'MyClass'})
+        self.assertEqual(inspect.get_annotations(inspect), {}) # inspect module has no annotations
+        self.assertEqual(inspect.get_annotations(isa.UnannotatedClass), {})
+        self.assertEqual(inspect.get_annotations(isa.unannotated_function), {})
+
+        self.assertEqual(inspect.get_annotations(isa, eval_str=True), {'a': int, 'b': str})
+        self.assertEqual(inspect.get_annotations(isa.MyClass, eval_str=True), {'a': int, 'b': str})
+        self.assertEqual(inspect.get_annotations(isa.function, eval_str=True), {'a': int, 'b': str, 'return': isa.MyClass})
+        self.assertEqual(inspect.get_annotations(isa.function2, eval_str=True), {'a': int, 'b': str, 'c': isa.MyClass, 'return': isa.MyClass})
+        self.assertEqual(inspect.get_annotations(isa.function3, eval_str=True), {'a': int, 'b': str, 'c': isa.MyClass})
+        self.assertEqual(inspect.get_annotations(inspect, eval_str=True), {})
+        self.assertEqual(inspect.get_annotations(isa.UnannotatedClass, eval_str=True), {})
+        self.assertEqual(inspect.get_annotations(isa.unannotated_function, eval_str=True), {})
+
+        self.assertEqual(inspect.get_annotations(isa, eval_str=False), {'a': int, 'b': str})
+        self.assertEqual(inspect.get_annotations(isa.MyClass, eval_str=False), {'a': int, 'b': str})
+        self.assertEqual(inspect.get_annotations(isa.function, eval_str=False), {'a': int, 'b': str, 'return': isa.MyClass})
+        self.assertEqual(inspect.get_annotations(isa.function2, eval_str=False), {'a': int, 'b': 'str', 'c': isa.MyClass, 'return': isa.MyClass})
+        self.assertEqual(inspect.get_annotations(isa.function3, eval_str=False), {'a': 'int', 'b': 'str', 'c': 'MyClass'})
+        self.assertEqual(inspect.get_annotations(inspect, eval_str=False), {})
+        self.assertEqual(inspect.get_annotations(isa.UnannotatedClass, eval_str=False), {})
+        self.assertEqual(inspect.get_annotations(isa.unannotated_function, eval_str=False), {})
+
+        def times_three(fn):
+            @functools.wraps(fn)
+            def wrapper(a, b):
+                return fn(a*3, b*3)
+            return wrapper
+
+        wrapped = times_three(isa.function)
+        self.assertEqual(wrapped(1, 'x'), isa.MyClass(3, 'xxx'))
+        self.assertIsNot(wrapped.__globals__, isa.function.__globals__)
+        self.assertEqual(inspect.get_annotations(wrapped), {'a': int, 'b': str, 'return': isa.MyClass})
+        self.assertEqual(inspect.get_annotations(wrapped, eval_str=True), {'a': int, 'b': str, 'return': isa.MyClass})
+        self.assertEqual(inspect.get_annotations(wrapped, eval_str=False), {'a': int, 'b': str, 'return': isa.MyClass})
+
+    def test_get_annotations_with_stringized_annotations(self):
+        isa = inspect_stringized_annotations
+        self.assertEqual(inspect.get_annotations(isa), {'a': 'int', 'b': 'str'})
+        self.assertEqual(inspect.get_annotations(isa.MyClass), {'a': 'int', 'b': 'str'})
+        self.assertEqual(inspect.get_annotations(isa.function), {'a': 'int', 'b': 'str', 'return': 'MyClass'})
+        self.assertEqual(inspect.get_annotations(isa.function2), {'a': 'int', 'b': "'str'", 'c': 'MyClass', 'return': 'MyClass'})
+        self.assertEqual(inspect.get_annotations(isa.function3), {'a': "'int'", 'b': "'str'", 'c': "'MyClass'"})
+        self.assertEqual(inspect.get_annotations(isa.UnannotatedClass), {})
+        self.assertEqual(inspect.get_annotations(isa.unannotated_function), {})
+
+        self.assertEqual(inspect.get_annotations(isa, eval_str=True), {'a': int, 'b': str})
+        self.assertEqual(inspect.get_annotations(isa.MyClass, eval_str=True), {'a': int, 'b': str})
+        self.assertEqual(inspect.get_annotations(isa.function, eval_str=True), {'a': int, 'b': str, 'return': isa.MyClass})
+        self.assertEqual(inspect.get_annotations(isa.function2, eval_str=True), {'a': int, 'b': 'str', 'c': isa.MyClass, 'return': isa.MyClass})
+        self.assertEqual(inspect.get_annotations(isa.function3, eval_str=True), {'a': 'int', 'b': 'str', 'c': 'MyClass'})
+        self.assertEqual(inspect.get_annotations(isa.UnannotatedClass, eval_str=True), {})
+        self.assertEqual(inspect.get_annotations(isa.unannotated_function, eval_str=True), {})
+
+        self.assertEqual(inspect.get_annotations(isa, eval_str=False), {'a': 'int', 'b': 'str'})
+        self.assertEqual(inspect.get_annotations(isa.MyClass, eval_str=False), {'a': 'int', 'b': 'str'})
+        self.assertEqual(inspect.get_annotations(isa.function, eval_str=False), {'a': 'int', 'b': 'str', 'return': 'MyClass'})
+        self.assertEqual(inspect.get_annotations(isa.function2, eval_str=False), {'a': 'int', 'b': "'str'", 'c': 'MyClass', 'return': 'MyClass'})
+        self.assertEqual(inspect.get_annotations(isa.function3, eval_str=False), {'a': "'int'", 'b': "'str'", 'c': "'MyClass'"})
+        self.assertEqual(inspect.get_annotations(isa.UnannotatedClass, eval_str=False), {})
+        self.assertEqual(inspect.get_annotations(isa.unannotated_function, eval_str=False), {})
+
+        isa2 = inspect_stringized_annotations_2
+        self.assertEqual(inspect.get_annotations(isa2), {})
+        self.assertEqual(inspect.get_annotations(isa2, eval_str=True), {})
+        self.assertEqual(inspect.get_annotations(isa2, eval_str=False), {})
+
+        def times_three(fn):
+            @functools.wraps(fn)
+            def wrapper(a, b):
+                return fn(a*3, b*3)
+            return wrapper
+
+        wrapped = times_three(isa.function)
+        self.assertEqual(wrapped(1, 'x'), isa.MyClass(3, 'xxx'))
+        self.assertIsNot(wrapped.__globals__, isa.function.__globals__)
+        self.assertEqual(inspect.get_annotations(wrapped), {'a': 'int', 'b': 'str', 'return': 'MyClass'})
+        self.assertEqual(inspect.get_annotations(wrapped, eval_str=True), {'a': int, 'b': str, 'return': isa.MyClass})
+        self.assertEqual(inspect.get_annotations(wrapped, eval_str=False), {'a': 'int', 'b': 'str', 'return': 'MyClass'})
+
+        # test that local namespace lookups work
+        self.assertEqual(inspect.get_annotations(isa.MyClassWithLocalAnnotations), {'x': 'mytype'})
+        self.assertEqual(inspect.get_annotations(isa.MyClassWithLocalAnnotations, eval_str=True), {'x': int})
+
+
 class TestIsDataDescriptor(unittest.TestCase):
 
     def test_custom_descriptors(self):
@@ -1803,7 +1928,7 @@
 
     def test_no_dict_no_slots_instance_member(self):
         # returns descriptor
-        with open(__file__) as handle:
+        with open(__file__, encoding='utf-8') as handle:
             self.assertEqual(inspect.getattr_static(handle, 'name'), type(handle).name)
 
     def test_inherited_slots(self):
@@ -2784,13 +2909,13 @@
                 pass
             ham = partialmethod(test, c=1)
 
-        self.assertEqual(self.signature(Spam.ham),
+        self.assertEqual(self.signature(Spam.ham, eval_str=False),
                          ((('it', ..., ..., 'positional_or_keyword'),
                            ('a', ..., ..., 'positional_or_keyword'),
                            ('c', 1, ..., 'keyword_only')),
                           'spam'))
 
-        self.assertEqual(self.signature(Spam().ham),
+        self.assertEqual(self.signature(Spam().ham, eval_str=False),
                          ((('a', ..., ..., 'positional_or_keyword'),
                            ('c', 1, ..., 'keyword_only')),
                           'spam'))
@@ -2801,7 +2926,7 @@
 
             g = partialmethod(test, 1)
 
-        self.assertEqual(self.signature(Spam.g),
+        self.assertEqual(self.signature(Spam.g, eval_str=False),
                          ((('self', ..., 'anno', 'positional_or_keyword'),),
                           ...))
 
@@ -2958,6 +3083,47 @@
                            ('bar', 2, ..., "keyword_only")),
                           ...))
 
+    def test_signature_on_subclass(self):
+        class A:
+            def __new__(cls, a=1, *args, **kwargs):
+                return object.__new__(cls)
+        class B(A):
+            def __init__(self, b):
+                pass
+        class C(A):
+            def __new__(cls, a=1, b=2, *args, **kwargs):
+                return object.__new__(cls)
+        class D(A):
+            pass
+
+        self.assertEqual(self.signature(B),
+                         ((('b', ..., ..., "positional_or_keyword"),),
+                          ...))
+        self.assertEqual(self.signature(C),
+                         ((('a', 1, ..., 'positional_or_keyword'),
+                           ('b', 2, ..., 'positional_or_keyword'),
+                           ('args', ..., ..., 'var_positional'),
+                           ('kwargs', ..., ..., 'var_keyword')),
+                          ...))
+        self.assertEqual(self.signature(D),
+                         ((('a', 1, ..., 'positional_or_keyword'),
+                           ('args', ..., ..., 'var_positional'),
+                           ('kwargs', ..., ..., 'var_keyword')),
+                          ...))
+
+    def test_signature_on_generic_subclass(self):
+        from typing import Generic, TypeVar
+
+        T = TypeVar('T')
+
+        class A(Generic[T]):
+            def __init__(self, *, a: int) -> None:
+                pass
+
+        self.assertEqual(self.signature(A),
+                         ((('a', ..., int, 'keyword_only'),),
+                          None))
+
     @unittest.skipIf(MISSING_C_DOCSTRINGS,
                      "Signature information for builtins requires docstrings")
     def test_signature_on_class_without_init(self):
@@ -3159,6 +3325,17 @@
             pass
         self.assertEqual(str(inspect.signature(foo)), '()')
 
+        def foo(a: list[str]) -> tuple[str, float]:
+            pass
+        self.assertEqual(str(inspect.signature(foo)),
+                         '(a: list[str]) -> tuple[str, float]')
+
+        from typing import Tuple
+        def foo(a: list[str]) -> Tuple[str, float]:
+            pass
+        self.assertEqual(str(inspect.signature(foo)),
+                         '(a: list[str]) -> Tuple[str, float]')
+
     def test_signature_str_positional_only(self):
         P = inspect.Parameter
         S = inspect.Signature
@@ -3252,6 +3429,156 @@
         p2 = inspect.signature(lambda y, x: None).parameters
         self.assertNotEqual(p1, p2)
 
+    def test_signature_annotations_with_local_namespaces(self):
+        class Foo: ...
+        def func(foo: Foo) -> int: pass
+        def func2(foo: Foo, bar: 'Bar') -> int: pass
+
+        for signature_func in (inspect.signature, inspect.Signature.from_callable):
+            with self.subTest(signature_func = signature_func):
+                sig1 = signature_func(func)
+                self.assertEqual(sig1.return_annotation, int)
+                self.assertEqual(sig1.parameters['foo'].annotation, Foo)
+
+                sig2 = signature_func(func, locals=locals())
+                self.assertEqual(sig2.return_annotation, int)
+                self.assertEqual(sig2.parameters['foo'].annotation, Foo)
+
+                sig3 = signature_func(func2, globals={'Bar': int}, locals=locals())
+                self.assertEqual(sig3.return_annotation, int)
+                self.assertEqual(sig3.parameters['foo'].annotation, Foo)
+                self.assertEqual(sig3.parameters['bar'].annotation, 'Bar')
+
+    def test_signature_eval_str(self):
+        isa = inspect_stringized_annotations
+        sig = inspect.Signature
+        par = inspect.Parameter
+        PORK = inspect.Parameter.POSITIONAL_OR_KEYWORD
+        for signature_func in (inspect.signature, inspect.Signature.from_callable):
+            with self.subTest(signature_func = signature_func):
+                self.assertEqual(
+                    signature_func(isa.MyClass),
+                    sig(
+                        parameters=(
+                            par('a', PORK),
+                            par('b', PORK),
+                        )))
+                self.assertEqual(
+                    signature_func(isa.function),
+                    sig(
+                        return_annotation='MyClass',
+                        parameters=(
+                            par('a', PORK, annotation='int'),
+                            par('b', PORK, annotation='str'),
+                        )))
+                self.assertEqual(
+                    signature_func(isa.function2),
+                    sig(
+                        return_annotation='MyClass',
+                        parameters=(
+                            par('a', PORK, annotation='int'),
+                            par('b', PORK, annotation="'str'"),
+                            par('c', PORK, annotation="MyClass"),
+                        )))
+                self.assertEqual(
+                    signature_func(isa.function3),
+                    sig(
+                        parameters=(
+                            par('a', PORK, annotation="'int'"),
+                            par('b', PORK, annotation="'str'"),
+                            par('c', PORK, annotation="'MyClass'"),
+                        )))
+
+                self.assertEqual(signature_func(isa.UnannotatedClass), sig())
+                self.assertEqual(signature_func(isa.unannotated_function),
+                    sig(
+                        parameters=(
+                            par('a', PORK),
+                            par('b', PORK),
+                            par('c', PORK),
+                        )))
+
+                self.assertEqual(
+                    signature_func(isa.MyClass, eval_str=True),
+                    sig(
+                        parameters=(
+                            par('a', PORK),
+                            par('b', PORK),
+                        )))
+                self.assertEqual(
+                    signature_func(isa.function, eval_str=True),
+                    sig(
+                        return_annotation=isa.MyClass,
+                        parameters=(
+                            par('a', PORK, annotation=int),
+                            par('b', PORK, annotation=str),
+                        )))
+                self.assertEqual(
+                    signature_func(isa.function2, eval_str=True),
+                    sig(
+                        return_annotation=isa.MyClass,
+                        parameters=(
+                            par('a', PORK, annotation=int),
+                            par('b', PORK, annotation='str'),
+                            par('c', PORK, annotation=isa.MyClass),
+                        )))
+                self.assertEqual(
+                    signature_func(isa.function3, eval_str=True),
+                    sig(
+                        parameters=(
+                            par('a', PORK, annotation='int'),
+                            par('b', PORK, annotation='str'),
+                            par('c', PORK, annotation='MyClass'),
+                        )))
+
+                globalns = {'int': float, 'str': complex}
+                localns = {'str': tuple, 'MyClass': dict}
+                with self.assertRaises(NameError):
+                    signature_func(isa.function, eval_str=True, globals=globalns)
+
+                self.assertEqual(
+                    signature_func(isa.function, eval_str=True, locals=localns),
+                    sig(
+                        return_annotation=dict,
+                        parameters=(
+                            par('a', PORK, annotation=int),
+                            par('b', PORK, annotation=tuple),
+                        )))
+
+                self.assertEqual(
+                    signature_func(isa.function, eval_str=True, globals=globalns, locals=localns),
+                    sig(
+                        return_annotation=dict,
+                        parameters=(
+                            par('a', PORK, annotation=float),
+                            par('b', PORK, annotation=tuple),
+                        )))
+
+    def test_signature_none_annotation(self):
+        class funclike:
+            # Has to be callable, and have correct
+            # __code__, __annotations__, __defaults__, __name__,
+            # and __kwdefaults__ attributes
+
+            def __init__(self, func):
+                self.__name__ = func.__name__
+                self.__code__ = func.__code__
+                self.__annotations__ = func.__annotations__
+                self.__defaults__ = func.__defaults__
+                self.__kwdefaults__ = func.__kwdefaults__
+                self.func = func
+
+            def __call__(self, *args, **kwargs):
+                return self.func(*args, **kwargs)
+
+        def foo(): pass
+        foo = funclike(foo)
+        foo.__annotations__ = None
+        for signature_func in (inspect.signature, inspect.Signature.from_callable):
+            with self.subTest(signature_func = signature_func):
+                self.assertEqual(signature_func(foo), inspect.Signature())
+        self.assertEqual(inspect.get_annotations(foo), {})
+
 
 class TestParameterObject(unittest.TestCase):
     def test_signature_parameter_kinds(self):
@@ -3842,6 +4169,9 @@
         needs_groups = {"range", "slice", "dir", "getattr",
                         "next", "iter", "vars"}
         no_signature |= needs_groups
+        # These have unrepresentable parameter default values of NULL
+        needs_null = {"anext"}
+        no_signature |= needs_null
         # These need PEP 457 groups or a signature change to accept None
         needs_semantic_update = {"round"}
         no_signature |= needs_semantic_update
@@ -3888,6 +4218,17 @@
         sig = inspect.signature(func)
         self.assertEqual(str(sig), '(self, a, b=1, /, *args, c, d=2, **kwargs)')
 
+    def test_base_class_have_text_signature(self):
+        # see issue 43118
+        from test.ann_module7 import BufferedReader
+        class MyBufferedReader(BufferedReader):
+            """buffer reader class."""
+
+        text_signature = BufferedReader.__text_signature__
+        self.assertEqual(text_signature, '(raw, buffer_size=DEFAULT_BUFFER_SIZE)')
+        sig = inspect.signature(MyBufferedReader)
+        self.assertEqual(str(sig), '(raw, buffer_size=8192)')
+
 
 class NTimesUnwrappable:
     def __init__(self, n):
@@ -4024,7 +4365,7 @@
 
     def assertInspectEqual(self, path, source):
         inspected_src = inspect.getsource(source)
-        with open(path) as src:
+        with open(path, encoding='utf-8') as src:
             self.assertEqual(
                 src.read().splitlines(True),
                 inspected_src.splitlines(True)
@@ -4035,23 +4376,10 @@
         with _ready_to_import('reload_bug', self.src_before) as (name, path):
             module = importlib.import_module(name)
             self.assertInspectEqual(path, module)
-            with open(path, 'w') as src:
+            with open(path, 'w', encoding='utf-8') as src:
                 src.write(self.src_after)
             self.assertInspectEqual(path, module)
 
 
-def test_main():
-    run_unittest(
-        TestDecorators, TestRetrievingSourceCode, TestOneliners, TestBlockComments,
-        TestBuggyCases, TestInterpreterStack, TestClassesAndFunctions, TestPredicates,
-        TestGetcallargsFunctions, TestGetcallargsMethods,
-        TestGetcallargsUnboundMethods, TestGetattrStatic, TestGetGeneratorState,
-        TestNoEOL, TestSignatureObject, TestSignatureBind, TestParameterObject,
-        TestBoundArguments, TestSignaturePrivateHelpers,
-        TestSignatureDefinitions, TestIsDataDescriptor,
-        TestGetClosureVars, TestUnwrap, TestMain, TestReload,
-        TestGetCoroutineState, TestGettingSourceOfToplevelFrames
-    )
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_int.py b/Lib/test/test_int.py
index 6fdf52e..d6be64e 100644
--- a/Lib/test/test_int.py
+++ b/Lib/test/test_int.py
@@ -517,10 +517,7 @@
         self.assertIs(type(n), int)
 
         bad_int = TruncReturnsBadInt()
-        with self.assertWarns(DeprecationWarning):
-            n = int(bad_int)
-        self.assertEqual(n, 1)
-        self.assertIs(type(n), int)
+        self.assertRaises(TypeError, int, bad_int)
 
         good_int = TruncReturnsIntSubclass()
         n = int(good_int)
diff --git a/Lib/test/test_interpreters.py b/Lib/test/test_interpreters.py
new file mode 100644
index 0000000..6266aa7
--- /dev/null
+++ b/Lib/test/test_interpreters.py
@@ -0,0 +1,745 @@
+import contextlib
+import os
+import threading
+from textwrap import dedent
+import unittest
+import time
+
+import _xxsubinterpreters as _interpreters
+from test.support import interpreters
+
+
+def _captured_script(script):
+    r, w = os.pipe()
+    indented = script.replace('\n', '\n                ')
+    wrapped = dedent(f"""
+        import contextlib
+        with open({w}, 'w', encoding='utf-8') as spipe:
+            with contextlib.redirect_stdout(spipe):
+                {indented}
+        """)
+    return wrapped, open(r, encoding='utf-8')
+
+
+def clean_up_interpreters():
+    for interp in interpreters.list_all():
+        if interp.id == 0:  # main
+            continue
+        try:
+            interp.close()
+        except RuntimeError:
+            pass  # already destroyed
+
+
+def _run_output(interp, request, channels=None):
+    script, rpipe = _captured_script(request)
+    with rpipe:
+        interp.run(script, channels=channels)
+        return rpipe.read()
+
+
+@contextlib.contextmanager
+def _running(interp):
+    r, w = os.pipe()
+    def run():
+        interp.run(dedent(f"""
+            # wait for "signal"
+            with open({r}) as rpipe:
+                rpipe.read()
+            """))
+
+    t = threading.Thread(target=run)
+    t.start()
+
+    yield
+
+    with open(w, 'w') as spipe:
+        spipe.write('done')
+    t.join()
+
+
+class TestBase(unittest.TestCase):
+
+    def tearDown(self):
+        clean_up_interpreters()
+
+
+class CreateTests(TestBase):
+
+    def test_in_main(self):
+        interp = interpreters.create()
+        self.assertIsInstance(interp, interpreters.Interpreter)
+        self.assertIn(interp, interpreters.list_all())
+
+    def test_in_thread(self):
+        lock = threading.Lock()
+        interp = None
+        def f():
+            nonlocal interp
+            interp = interpreters.create()
+            lock.acquire()
+            lock.release()
+        t = threading.Thread(target=f)
+        with lock:
+            t.start()
+        t.join()
+        self.assertIn(interp, interpreters.list_all())
+
+    def test_in_subinterpreter(self):
+        main, = interpreters.list_all()
+        interp = interpreters.create()
+        out = _run_output(interp, dedent("""
+            from test.support import interpreters
+            interp = interpreters.create()
+            print(interp.id)
+            """))
+        interp2 = interpreters.Interpreter(int(out))
+        self.assertEqual(interpreters.list_all(), [main, interp, interp2])
+
+    def test_after_destroy_all(self):
+        before = set(interpreters.list_all())
+        # Create 3 subinterpreters.
+        interp_lst = []
+        for _ in range(3):
+            interps = interpreters.create()
+            interp_lst.append(interps)
+        # Now destroy them.
+        for interp in interp_lst:
+            interp.close()
+        # Finally, create another.
+        interp = interpreters.create()
+        self.assertEqual(set(interpreters.list_all()), before | {interp})
+
+    def test_after_destroy_some(self):
+        before = set(interpreters.list_all())
+        # Create 3 subinterpreters.
+        interp1 = interpreters.create()
+        interp2 = interpreters.create()
+        interp3 = interpreters.create()
+        # Now destroy 2 of them.
+        interp1.close()
+        interp2.close()
+        # Finally, create another.
+        interp = interpreters.create()
+        self.assertEqual(set(interpreters.list_all()), before | {interp3, interp})
+
+
+class GetCurrentTests(TestBase):
+
+    def test_main(self):
+        main = interpreters.get_main()
+        current = interpreters.get_current()
+        self.assertEqual(current, main)
+
+    def test_subinterpreter(self):
+        main = _interpreters.get_main()
+        interp = interpreters.create()
+        out = _run_output(interp, dedent("""
+            from test.support import interpreters
+            cur = interpreters.get_current()
+            print(cur.id)
+            """))
+        current = interpreters.Interpreter(int(out))
+        self.assertNotEqual(current, main)
+
+
+class ListAllTests(TestBase):
+
+    def test_initial(self):
+        interps = interpreters.list_all()
+        self.assertEqual(1, len(interps))
+
+    def test_after_creating(self):
+        main = interpreters.get_current()
+        first = interpreters.create()
+        second = interpreters.create()
+
+        ids = []
+        for interp in interpreters.list_all():
+            ids.append(interp.id)
+
+        self.assertEqual(ids, [main.id, first.id, second.id])
+
+    def test_after_destroying(self):
+        main = interpreters.get_current()
+        first = interpreters.create()
+        second = interpreters.create()
+        first.close()
+
+        ids = []
+        for interp in interpreters.list_all():
+            ids.append(interp.id)
+
+        self.assertEqual(ids, [main.id, second.id])
+
+
+class TestInterpreterAttrs(TestBase):
+
+    def test_id_type(self):
+        main = interpreters.get_main()
+        current = interpreters.get_current()
+        interp = interpreters.create()
+        self.assertIsInstance(main.id, _interpreters.InterpreterID)
+        self.assertIsInstance(current.id, _interpreters.InterpreterID)
+        self.assertIsInstance(interp.id, _interpreters.InterpreterID)
+
+    def test_main_id(self):
+        main = interpreters.get_main()
+        self.assertEqual(main.id, 0)
+
+    def test_custom_id(self):
+        interp = interpreters.Interpreter(1)
+        self.assertEqual(interp.id, 1)
+
+        with self.assertRaises(TypeError):
+            interpreters.Interpreter('1')
+
+    def test_id_readonly(self):
+        interp = interpreters.Interpreter(1)
+        with self.assertRaises(AttributeError):
+            interp.id = 2
+
+    @unittest.skip('not ready yet (see bpo-32604)')
+    def test_main_isolated(self):
+        main = interpreters.get_main()
+        self.assertFalse(main.isolated)
+
+    @unittest.skip('not ready yet (see bpo-32604)')
+    def test_subinterpreter_isolated_default(self):
+        interp = interpreters.create()
+        self.assertFalse(interp.isolated)
+
+    def test_subinterpreter_isolated_explicit(self):
+        interp1 = interpreters.create(isolated=True)
+        interp2 = interpreters.create(isolated=False)
+        self.assertTrue(interp1.isolated)
+        self.assertFalse(interp2.isolated)
+
+    @unittest.skip('not ready yet (see bpo-32604)')
+    def test_custom_isolated_default(self):
+        interp = interpreters.Interpreter(1)
+        self.assertFalse(interp.isolated)
+
+    def test_custom_isolated_explicit(self):
+        interp1 = interpreters.Interpreter(1, isolated=True)
+        interp2 = interpreters.Interpreter(1, isolated=False)
+        self.assertTrue(interp1.isolated)
+        self.assertFalse(interp2.isolated)
+
+    def test_isolated_readonly(self):
+        interp = interpreters.Interpreter(1)
+        with self.assertRaises(AttributeError):
+            interp.isolated = True
+
+    def test_equality(self):
+        interp1 = interpreters.create()
+        interp2 = interpreters.create()
+        self.assertEqual(interp1, interp1)
+        self.assertNotEqual(interp1, interp2)
+
+
+class TestInterpreterIsRunning(TestBase):
+
+    def test_main(self):
+        main = interpreters.get_main()
+        self.assertTrue(main.is_running())
+
+    @unittest.skip('Fails on FreeBSD')
+    def test_subinterpreter(self):
+        interp = interpreters.create()
+        self.assertFalse(interp.is_running())
+
+        with _running(interp):
+            self.assertTrue(interp.is_running())
+        self.assertFalse(interp.is_running())
+
+    def test_from_subinterpreter(self):
+        interp = interpreters.create()
+        out = _run_output(interp, dedent(f"""
+            import _xxsubinterpreters as _interpreters
+            if _interpreters.is_running({interp.id}):
+                print(True)
+            else:
+                print(False)
+            """))
+        self.assertEqual(out.strip(), 'True')
+
+    def test_already_destroyed(self):
+        interp = interpreters.create()
+        interp.close()
+        with self.assertRaises(RuntimeError):
+            interp.is_running()
+
+    def test_does_not_exist(self):
+        interp = interpreters.Interpreter(1_000_000)
+        with self.assertRaises(RuntimeError):
+            interp.is_running()
+
+    def test_bad_id(self):
+        interp = interpreters.Interpreter(-1)
+        with self.assertRaises(ValueError):
+            interp.is_running()
+
+
+class TestInterpreterClose(TestBase):
+
+    def test_basic(self):
+        main = interpreters.get_main()
+        interp1 = interpreters.create()
+        interp2 = interpreters.create()
+        interp3 = interpreters.create()
+        self.assertEqual(set(interpreters.list_all()),
+                         {main, interp1, interp2, interp3})
+        interp2.close()
+        self.assertEqual(set(interpreters.list_all()),
+                         {main, interp1, interp3})
+
+    def test_all(self):
+        before = set(interpreters.list_all())
+        interps = set()
+        for _ in range(3):
+            interp = interpreters.create()
+            interps.add(interp)
+        self.assertEqual(set(interpreters.list_all()), before | interps)
+        for interp in interps:
+            interp.close()
+        self.assertEqual(set(interpreters.list_all()), before)
+
+    def test_main(self):
+        main, = interpreters.list_all()
+        with self.assertRaises(RuntimeError):
+            main.close()
+
+        def f():
+            with self.assertRaises(RuntimeError):
+                main.close()
+
+        t = threading.Thread(target=f)
+        t.start()
+        t.join()
+
+    def test_already_destroyed(self):
+        interp = interpreters.create()
+        interp.close()
+        with self.assertRaises(RuntimeError):
+            interp.close()
+
+    def test_does_not_exist(self):
+        interp = interpreters.Interpreter(1_000_000)
+        with self.assertRaises(RuntimeError):
+            interp.close()
+
+    def test_bad_id(self):
+        interp = interpreters.Interpreter(-1)
+        with self.assertRaises(ValueError):
+            interp.close()
+
+    def test_from_current(self):
+        main, = interpreters.list_all()
+        interp = interpreters.create()
+        out = _run_output(interp, dedent(f"""
+            from test.support import interpreters
+            interp = interpreters.Interpreter({int(interp.id)})
+            try:
+                interp.close()
+            except RuntimeError:
+                print('failed')
+            """))
+        self.assertEqual(out.strip(), 'failed')
+        self.assertEqual(set(interpreters.list_all()), {main, interp})
+
+    def test_from_sibling(self):
+        main, = interpreters.list_all()
+        interp1 = interpreters.create()
+        interp2 = interpreters.create()
+        self.assertEqual(set(interpreters.list_all()),
+                         {main, interp1, interp2})
+        interp1.run(dedent(f"""
+            from test.support import interpreters
+            interp2 = interpreters.Interpreter(int({interp2.id}))
+            interp2.close()
+            interp3 = interpreters.create()
+            interp3.close()
+            """))
+        self.assertEqual(set(interpreters.list_all()), {main, interp1})
+
+    def test_from_other_thread(self):
+        interp = interpreters.create()
+        def f():
+            interp.close()
+
+        t = threading.Thread(target=f)
+        t.start()
+        t.join()
+
+    @unittest.skip('Fails on FreeBSD')
+    def test_still_running(self):
+        main, = interpreters.list_all()
+        interp = interpreters.create()
+        with _running(interp):
+            with self.assertRaises(RuntimeError):
+                interp.close()
+            self.assertTrue(interp.is_running())
+
+
+class TestInterpreterRun(TestBase):
+
+    def test_success(self):
+        interp = interpreters.create()
+        script, file = _captured_script('print("it worked!", end="")')
+        with file:
+            interp.run(script)
+            out = file.read()
+
+        self.assertEqual(out, 'it worked!')
+
+    def test_in_thread(self):
+        interp = interpreters.create()
+        script, file = _captured_script('print("it worked!", end="")')
+        with file:
+            def f():
+                interp.run(script)
+
+            t = threading.Thread(target=f)
+            t.start()
+            t.join()
+            out = file.read()
+
+        self.assertEqual(out, 'it worked!')
+
+    @unittest.skipUnless(hasattr(os, 'fork'), "test needs os.fork()")
+    def test_fork(self):
+        interp = interpreters.create()
+        import tempfile
+        with tempfile.NamedTemporaryFile('w+', encoding='utf-8') as file:
+            file.write('')
+            file.flush()
+
+            expected = 'spam spam spam spam spam'
+            script = dedent(f"""
+                import os
+                try:
+                    os.fork()
+                except RuntimeError:
+                    with open('{file.name}', 'w', encoding='utf-8') as out:
+                        out.write('{expected}')
+                """)
+            interp.run(script)
+
+            file.seek(0)
+            content = file.read()
+            self.assertEqual(content, expected)
+
+    @unittest.skip('Fails on FreeBSD')
+    def test_already_running(self):
+        interp = interpreters.create()
+        with _running(interp):
+            with self.assertRaises(RuntimeError):
+                interp.run('print("spam")')
+
+    def test_does_not_exist(self):
+        interp = interpreters.Interpreter(1_000_000)
+        with self.assertRaises(RuntimeError):
+            interp.run('print("spam")')
+
+    def test_bad_id(self):
+        interp = interpreters.Interpreter(-1)
+        with self.assertRaises(ValueError):
+            interp.run('print("spam")')
+
+    def test_bad_script(self):
+        interp = interpreters.create()
+        with self.assertRaises(TypeError):
+            interp.run(10)
+
+    def test_bytes_for_script(self):
+        interp = interpreters.create()
+        with self.assertRaises(TypeError):
+            interp.run(b'print("spam")')
+
+    # test_xxsubinterpreters covers the remaining Interpreter.run() behavior.
+
+
+class TestIsShareable(TestBase):
+
+    def test_default_shareables(self):
+        shareables = [
+                # singletons
+                None,
+                # builtin objects
+                b'spam',
+                'spam',
+                10,
+                -10,
+                ]
+        for obj in shareables:
+            with self.subTest(obj):
+                shareable = interpreters.is_shareable(obj)
+                self.assertTrue(shareable)
+
+    def test_not_shareable(self):
+        class Cheese:
+            def __init__(self, name):
+                self.name = name
+            def __str__(self):
+                return self.name
+
+        class SubBytes(bytes):
+            """A subclass of a shareable type."""
+
+        not_shareables = [
+                # singletons
+                True,
+                False,
+                NotImplemented,
+                ...,
+                # builtin types and objects
+                type,
+                object,
+                object(),
+                Exception(),
+                100.0,
+                # user-defined types and objects
+                Cheese,
+                Cheese('Wensleydale'),
+                SubBytes(b'spam'),
+                ]
+        for obj in not_shareables:
+            with self.subTest(repr(obj)):
+                self.assertFalse(
+                    interpreters.is_shareable(obj))
+
+
+class TestChannels(TestBase):
+
+    def test_create(self):
+        r, s = interpreters.create_channel()
+        self.assertIsInstance(r, interpreters.RecvChannel)
+        self.assertIsInstance(s, interpreters.SendChannel)
+
+    def test_list_all(self):
+        self.assertEqual(interpreters.list_all_channels(), [])
+        created = set()
+        for _ in range(3):
+            ch = interpreters.create_channel()
+            created.add(ch)
+        after = set(interpreters.list_all_channels())
+        self.assertEqual(after, created)
+
+
+class TestRecvChannelAttrs(TestBase):
+
+    def test_id_type(self):
+        rch, _ = interpreters.create_channel()
+        self.assertIsInstance(rch.id, _interpreters.ChannelID)
+
+    def test_custom_id(self):
+        rch = interpreters.RecvChannel(1)
+        self.assertEqual(rch.id, 1)
+
+        with self.assertRaises(TypeError):
+            interpreters.RecvChannel('1')
+
+    def test_id_readonly(self):
+        rch = interpreters.RecvChannel(1)
+        with self.assertRaises(AttributeError):
+            rch.id = 2
+
+    def test_equality(self):
+        ch1, _ = interpreters.create_channel()
+        ch2, _ = interpreters.create_channel()
+        self.assertEqual(ch1, ch1)
+        self.assertNotEqual(ch1, ch2)
+
+
+class TestSendChannelAttrs(TestBase):
+
+    def test_id_type(self):
+        _, sch = interpreters.create_channel()
+        self.assertIsInstance(sch.id, _interpreters.ChannelID)
+
+    def test_custom_id(self):
+        sch = interpreters.SendChannel(1)
+        self.assertEqual(sch.id, 1)
+
+        with self.assertRaises(TypeError):
+            interpreters.SendChannel('1')
+
+    def test_id_readonly(self):
+        sch = interpreters.SendChannel(1)
+        with self.assertRaises(AttributeError):
+            sch.id = 2
+
+    def test_equality(self):
+        _, ch1 = interpreters.create_channel()
+        _, ch2 = interpreters.create_channel()
+        self.assertEqual(ch1, ch1)
+        self.assertNotEqual(ch1, ch2)
+
+
+class TestSendRecv(TestBase):
+
+    def test_send_recv_main(self):
+        r, s = interpreters.create_channel()
+        orig = b'spam'
+        s.send_nowait(orig)
+        obj = r.recv()
+
+        self.assertEqual(obj, orig)
+        self.assertIsNot(obj, orig)
+
+    def test_send_recv_same_interpreter(self):
+        interp = interpreters.create()
+        interp.run(dedent("""
+            from test.support import interpreters
+            r, s = interpreters.create_channel()
+            orig = b'spam'
+            s.send_nowait(orig)
+            obj = r.recv()
+            assert obj == orig, 'expected: obj == orig'
+            assert obj is not orig, 'expected: obj is not orig'
+            """))
+
+    @unittest.skip('broken (see BPO-...)')
+    def test_send_recv_different_interpreters(self):
+        r1, s1 = interpreters.create_channel()
+        r2, s2 = interpreters.create_channel()
+        orig1 = b'spam'
+        s1.send_nowait(orig1)
+        out = _run_output(
+            interpreters.create(),
+            dedent(f"""
+                obj1 = r.recv()
+                assert obj1 == b'spam', 'expected: obj1 == orig1'
+                # When going to another interpreter we get a copy.
+                assert id(obj1) != {id(orig1)}, 'expected: obj1 is not orig1'
+                orig2 = b'eggs'
+                print(id(orig2))
+                s.send_nowait(orig2)
+                """),
+            channels=dict(r=r1, s=s2),
+            )
+        obj2 = r2.recv()
+
+        self.assertEqual(obj2, b'eggs')
+        self.assertNotEqual(id(obj2), int(out))
+
+    def test_send_recv_different_threads(self):
+        r, s = interpreters.create_channel()
+
+        def f():
+            while True:
+                try:
+                    obj = r.recv()
+                    break
+                except interpreters.ChannelEmptyError:
+                    time.sleep(0.1)
+            s.send(obj)
+        t = threading.Thread(target=f)
+        t.start()
+
+        orig = b'spam'
+        s.send(orig)
+        t.join()
+        obj = r.recv()
+
+        self.assertEqual(obj, orig)
+        self.assertIsNot(obj, orig)
+
+    def test_send_recv_nowait_main(self):
+        r, s = interpreters.create_channel()
+        orig = b'spam'
+        s.send_nowait(orig)
+        obj = r.recv_nowait()
+
+        self.assertEqual(obj, orig)
+        self.assertIsNot(obj, orig)
+
+    def test_send_recv_nowait_main_with_default(self):
+        r, _ = interpreters.create_channel()
+        obj = r.recv_nowait(None)
+
+        self.assertIsNone(obj)
+
+    def test_send_recv_nowait_same_interpreter(self):
+        interp = interpreters.create()
+        interp.run(dedent("""
+            from test.support import interpreters
+            r, s = interpreters.create_channel()
+            orig = b'spam'
+            s.send_nowait(orig)
+            obj = r.recv_nowait()
+            assert obj == orig, 'expected: obj == orig'
+            # When going back to the same interpreter we get the same object.
+            assert obj is not orig, 'expected: obj is not orig'
+            """))
+
+    @unittest.skip('broken (see BPO-...)')
+    def test_send_recv_nowait_different_interpreters(self):
+        r1, s1 = interpreters.create_channel()
+        r2, s2 = interpreters.create_channel()
+        orig1 = b'spam'
+        s1.send_nowait(orig1)
+        out = _run_output(
+            interpreters.create(),
+            dedent(f"""
+                obj1 = r.recv_nowait()
+                assert obj1 == b'spam', 'expected: obj1 == orig1'
+                # When going to another interpreter we get a copy.
+                assert id(obj1) != {id(orig1)}, 'expected: obj1 is not orig1'
+                orig2 = b'eggs'
+                print(id(orig2))
+                s.send_nowait(orig2)
+                """),
+            channels=dict(r=r1, s=s2),
+            )
+        obj2 = r2.recv_nowait()
+
+        self.assertEqual(obj2, b'eggs')
+        self.assertNotEqual(id(obj2), int(out))
+
+    def test_recv_channel_does_not_exist(self):
+        ch = interpreters.RecvChannel(1_000_000)
+        with self.assertRaises(interpreters.ChannelNotFoundError):
+            ch.recv()
+
+    def test_send_channel_does_not_exist(self):
+        ch = interpreters.SendChannel(1_000_000)
+        with self.assertRaises(interpreters.ChannelNotFoundError):
+            ch.send(b'spam')
+
+    def test_recv_nowait_channel_does_not_exist(self):
+        ch = interpreters.RecvChannel(1_000_000)
+        with self.assertRaises(interpreters.ChannelNotFoundError):
+            ch.recv_nowait()
+
+    def test_send_nowait_channel_does_not_exist(self):
+        ch = interpreters.SendChannel(1_000_000)
+        with self.assertRaises(interpreters.ChannelNotFoundError):
+            ch.send_nowait(b'spam')
+
+    def test_recv_nowait_empty(self):
+        ch, _ = interpreters.create_channel()
+        with self.assertRaises(interpreters.ChannelEmptyError):
+            ch.recv_nowait()
+
+    def test_recv_nowait_default(self):
+        default = object()
+        rch, sch = interpreters.create_channel()
+        obj1 = rch.recv_nowait(default)
+        sch.send_nowait(None)
+        sch.send_nowait(1)
+        sch.send_nowait(b'spam')
+        sch.send_nowait(b'eggs')
+        obj2 = rch.recv_nowait(default)
+        obj3 = rch.recv_nowait(default)
+        obj4 = rch.recv_nowait()
+        obj5 = rch.recv_nowait(default)
+        obj6 = rch.recv_nowait(default)
+
+        self.assertIs(obj1, default)
+        self.assertIs(obj2, None)
+        self.assertEqual(obj3, 1)
+        self.assertEqual(obj4, b'spam')
+        self.assertEqual(obj5, b'eggs')
+        self.assertIs(obj6, default)
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
index d2e3877..fb83762 100644
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -28,7 +28,6 @@
 import random
 import signal
 import sys
-import sysconfig
 import textwrap
 import threading
 import time
@@ -40,7 +39,12 @@
 from test import support
 from test.support.script_helper import (
     assert_python_ok, assert_python_failure, run_python_until_end)
-from test.support import FakePath
+from test.support import import_helper
+from test.support import os_helper
+from test.support import threading_helper
+from test.support import warnings_helper
+from test.support import skip_if_sanitizer
+from test.support.os_helper import FakePath
 
 import codecs
 import io  # C implementation of io
@@ -62,13 +66,6 @@
     class EmptyStruct(ctypes.Structure):
         pass
 
-_cflags = sysconfig.get_config_var('CFLAGS') or ''
-_config_args = sysconfig.get_config_var('CONFIG_ARGS') or ''
-MEMORY_SANITIZER = (
-    '-fsanitize=memory' in _cflags or
-    '--with-memory-sanitizer' in _config_args
-)
-
 # Does io.IOBase finalizer log the exception if the close() method fails?
 # The exception is ignored silently by default in release build.
 IOBASE_EMITS_UNRAISABLE = (hasattr(sys, "gettotalrefcount") or sys.flags.dev_mode)
@@ -316,10 +313,10 @@
 class IOTest(unittest.TestCase):
 
     def setUp(self):
-        support.unlink(support.TESTFN)
+        os_helper.unlink(os_helper.TESTFN)
 
     def tearDown(self):
-        support.unlink(support.TESTFN)
+        os_helper.unlink(os_helper.TESTFN)
 
     def write_ops(self, f):
         self.assertEqual(f.write(b"blah."), 5)
@@ -403,20 +400,22 @@
     def test_invalid_operations(self):
         # Try writing on a file opened in read mode and vice-versa.
         exc = self.UnsupportedOperation
-        for mode in ("w", "wb"):
-            with self.open(support.TESTFN, mode) as fp:
-                self.assertRaises(exc, fp.read)
-                self.assertRaises(exc, fp.readline)
-        with self.open(support.TESTFN, "wb", buffering=0) as fp:
+        with self.open(os_helper.TESTFN, "w", encoding="utf-8") as fp:
             self.assertRaises(exc, fp.read)
             self.assertRaises(exc, fp.readline)
-        with self.open(support.TESTFN, "rb", buffering=0) as fp:
+        with self.open(os_helper.TESTFN, "wb") as fp:
+            self.assertRaises(exc, fp.read)
+            self.assertRaises(exc, fp.readline)
+        with self.open(os_helper.TESTFN, "wb", buffering=0) as fp:
+            self.assertRaises(exc, fp.read)
+            self.assertRaises(exc, fp.readline)
+        with self.open(os_helper.TESTFN, "rb", buffering=0) as fp:
             self.assertRaises(exc, fp.write, b"blah")
             self.assertRaises(exc, fp.writelines, [b"blah\n"])
-        with self.open(support.TESTFN, "rb") as fp:
+        with self.open(os_helper.TESTFN, "rb") as fp:
             self.assertRaises(exc, fp.write, b"blah")
             self.assertRaises(exc, fp.writelines, [b"blah\n"])
-        with self.open(support.TESTFN, "r") as fp:
+        with self.open(os_helper.TESTFN, "r", encoding="utf-8") as fp:
             self.assertRaises(exc, fp.write, "blah")
             self.assertRaises(exc, fp.writelines, ["blah\n"])
             # Non-zero seeking from current or end pos
@@ -529,41 +528,41 @@
 
     def test_open_handles_NUL_chars(self):
         fn_with_NUL = 'foo\0bar'
-        self.assertRaises(ValueError, self.open, fn_with_NUL, 'w')
+        self.assertRaises(ValueError, self.open, fn_with_NUL, 'w', encoding="utf-8")
 
         bytes_fn = bytes(fn_with_NUL, 'ascii')
         with warnings.catch_warnings():
             warnings.simplefilter("ignore", DeprecationWarning)
-            self.assertRaises(ValueError, self.open, bytes_fn, 'w')
+            self.assertRaises(ValueError, self.open, bytes_fn, 'w', encoding="utf-8")
 
     def test_raw_file_io(self):
-        with self.open(support.TESTFN, "wb", buffering=0) as f:
+        with self.open(os_helper.TESTFN, "wb", buffering=0) as f:
             self.assertEqual(f.readable(), False)
             self.assertEqual(f.writable(), True)
             self.assertEqual(f.seekable(), True)
             self.write_ops(f)
-        with self.open(support.TESTFN, "rb", buffering=0) as f:
+        with self.open(os_helper.TESTFN, "rb", buffering=0) as f:
             self.assertEqual(f.readable(), True)
             self.assertEqual(f.writable(), False)
             self.assertEqual(f.seekable(), True)
             self.read_ops(f)
 
     def test_buffered_file_io(self):
-        with self.open(support.TESTFN, "wb") as f:
+        with self.open(os_helper.TESTFN, "wb") as f:
             self.assertEqual(f.readable(), False)
             self.assertEqual(f.writable(), True)
             self.assertEqual(f.seekable(), True)
             self.write_ops(f)
-        with self.open(support.TESTFN, "rb") as f:
+        with self.open(os_helper.TESTFN, "rb") as f:
             self.assertEqual(f.readable(), True)
             self.assertEqual(f.writable(), False)
             self.assertEqual(f.seekable(), True)
             self.read_ops(f, True)
 
     def test_readline(self):
-        with self.open(support.TESTFN, "wb") as f:
+        with self.open(os_helper.TESTFN, "wb") as f:
             f.write(b"abc\ndef\nxyzzy\nfoo\x00bar\nanother line")
-        with self.open(support.TESTFN, "rb") as f:
+        with self.open(os_helper.TESTFN, "rb") as f:
             self.assertEqual(f.readline(), b"abc\n")
             self.assertEqual(f.readline(10), b"def\n")
             self.assertEqual(f.readline(2), b"xy")
@@ -571,7 +570,7 @@
             self.assertEqual(f.readline(), b"foo\x00bar\n")
             self.assertEqual(f.readline(None), b"another line")
             self.assertRaises(TypeError, f.readline, 5.3)
-        with self.open(support.TESTFN, "r") as f:
+        with self.open(os_helper.TESTFN, "r", encoding="utf-8") as f:
             self.assertRaises(TypeError, f.readline, 5.3)
 
     def test_readline_nonsizeable(self):
@@ -606,20 +605,20 @@
             support.requires(
                 'largefile',
                 'test requires %s bytes and a long time to run' % self.LARGE)
-        with self.open(support.TESTFN, "w+b", 0) as f:
+        with self.open(os_helper.TESTFN, "w+b", 0) as f:
             self.large_file_ops(f)
-        with self.open(support.TESTFN, "w+b") as f:
+        with self.open(os_helper.TESTFN, "w+b") as f:
             self.large_file_ops(f)
 
     def test_with_open(self):
         for bufsize in (0, 100):
             f = None
-            with self.open(support.TESTFN, "wb", bufsize) as f:
+            with self.open(os_helper.TESTFN, "wb", bufsize) as f:
                 f.write(b"xxx")
             self.assertEqual(f.closed, True)
             f = None
             try:
-                with self.open(support.TESTFN, "wb", bufsize) as f:
+                with self.open(os_helper.TESTFN, "wb", bufsize) as f:
                     1/0
             except ZeroDivisionError:
                 self.assertEqual(f.closed, True)
@@ -628,13 +627,13 @@
 
     # issue 5008
     def test_append_mode_tell(self):
-        with self.open(support.TESTFN, "wb") as f:
+        with self.open(os_helper.TESTFN, "wb") as f:
             f.write(b"xxx")
-        with self.open(support.TESTFN, "ab", buffering=0) as f:
+        with self.open(os_helper.TESTFN, "ab", buffering=0) as f:
             self.assertEqual(f.tell(), 3)
-        with self.open(support.TESTFN, "ab") as f:
+        with self.open(os_helper.TESTFN, "ab") as f:
             self.assertEqual(f.tell(), 3)
-        with self.open(support.TESTFN, "a") as f:
+        with self.open(os_helper.TESTFN, "a", encoding="utf-8") as f:
             self.assertGreater(f.tell(), 0)
 
     def test_destructor(self):
@@ -654,13 +653,13 @@
             def flush(self):
                 record.append(3)
                 super().flush()
-        with support.check_warnings(('', ResourceWarning)):
-            f = MyFileIO(support.TESTFN, "wb")
+        with warnings_helper.check_warnings(('', ResourceWarning)):
+            f = MyFileIO(os_helper.TESTFN, "wb")
             f.write(b"xxx")
             del f
             support.gc_collect()
             self.assertEqual(record, [1, 2, 3])
-            with self.open(support.TESTFN, "rb") as f:
+            with self.open(os_helper.TESTFN, "rb") as f:
                 self.assertEqual(f.read(), b"xxx")
 
     def _check_base_destructor(self, base):
@@ -706,9 +705,9 @@
         self._check_base_destructor(self.TextIOBase)
 
     def test_close_flushes(self):
-        with self.open(support.TESTFN, "wb") as f:
+        with self.open(os_helper.TESTFN, "wb") as f:
             f.write(b"xxx")
-        with self.open(support.TESTFN, "rb") as f:
+        with self.open(os_helper.TESTFN, "rb") as f:
             self.assertEqual(f.read(), b"xxx")
 
     def test_array_writes(self):
@@ -719,25 +718,25 @@
                 self.assertEqual(f.write(a), n)
                 f.writelines((a,))
         check(self.BytesIO())
-        check(self.FileIO(support.TESTFN, "w"))
+        check(self.FileIO(os_helper.TESTFN, "w"))
         check(self.BufferedWriter(self.MockRawIO()))
         check(self.BufferedRandom(self.MockRawIO()))
         check(self.BufferedRWPair(self.MockRawIO(), self.MockRawIO()))
 
     def test_closefd(self):
-        self.assertRaises(ValueError, self.open, support.TESTFN, 'w',
-                          closefd=False)
+        self.assertRaises(ValueError, self.open, os_helper.TESTFN, 'w',
+                          encoding="utf-8", closefd=False)
 
     def test_read_closed(self):
-        with self.open(support.TESTFN, "w") as f:
+        with self.open(os_helper.TESTFN, "w", encoding="utf-8") as f:
             f.write("egg\n")
-        with self.open(support.TESTFN, "r") as f:
-            file = self.open(f.fileno(), "r", closefd=False)
+        with self.open(os_helper.TESTFN, "r", encoding="utf-8") as f:
+            file = self.open(f.fileno(), "r", encoding="utf-8", closefd=False)
             self.assertEqual(file.read(), "egg\n")
             file.seek(0)
             file.close()
             self.assertRaises(ValueError, file.read)
-        with self.open(support.TESTFN, "rb") as f:
+        with self.open(os_helper.TESTFN, "rb") as f:
             file = self.open(f.fileno(), "rb", closefd=False)
             self.assertEqual(file.read()[:3], b"egg")
             file.close()
@@ -745,28 +744,29 @@
 
     def test_no_closefd_with_filename(self):
         # can't use closefd in combination with a file name
-        self.assertRaises(ValueError, self.open, support.TESTFN, "r", closefd=False)
+        self.assertRaises(ValueError, self.open, os_helper.TESTFN, "r",
+                          encoding="utf-8", closefd=False)
 
     def test_closefd_attr(self):
-        with self.open(support.TESTFN, "wb") as f:
+        with self.open(os_helper.TESTFN, "wb") as f:
             f.write(b"egg\n")
-        with self.open(support.TESTFN, "r") as f:
+        with self.open(os_helper.TESTFN, "r", encoding="utf-8") as f:
             self.assertEqual(f.buffer.raw.closefd, True)
-            file = self.open(f.fileno(), "r", closefd=False)
+            file = self.open(f.fileno(), "r", encoding="utf-8", closefd=False)
             self.assertEqual(file.buffer.raw.closefd, False)
 
     def test_garbage_collection(self):
         # FileIO objects are collected, and collecting them flushes
         # all data to disk.
-        with support.check_warnings(('', ResourceWarning)):
-            f = self.FileIO(support.TESTFN, "wb")
+        with warnings_helper.check_warnings(('', ResourceWarning)):
+            f = self.FileIO(os_helper.TESTFN, "wb")
             f.write(b"abcxxx")
             f.f = f
             wr = weakref.ref(f)
             del f
             support.gc_collect()
         self.assertIsNone(wr(), wr)
-        with self.open(support.TESTFN, "rb") as f:
+        with self.open(os_helper.TESTFN, "rb") as f:
             self.assertEqual(f.read(), b"abcxxx")
 
     def test_unbounded_file(self):
@@ -803,29 +803,29 @@
     def test_flush_error_on_close(self):
         # raw file
         # Issue #5700: io.FileIO calls flush() after file closed
-        self.check_flush_error_on_close(support.TESTFN, 'wb', buffering=0)
-        fd = os.open(support.TESTFN, os.O_WRONLY|os.O_CREAT)
+        self.check_flush_error_on_close(os_helper.TESTFN, 'wb', buffering=0)
+        fd = os.open(os_helper.TESTFN, os.O_WRONLY|os.O_CREAT)
         self.check_flush_error_on_close(fd, 'wb', buffering=0)
-        fd = os.open(support.TESTFN, os.O_WRONLY|os.O_CREAT)
+        fd = os.open(os_helper.TESTFN, os.O_WRONLY|os.O_CREAT)
         self.check_flush_error_on_close(fd, 'wb', buffering=0, closefd=False)
         os.close(fd)
         # buffered io
-        self.check_flush_error_on_close(support.TESTFN, 'wb')
-        fd = os.open(support.TESTFN, os.O_WRONLY|os.O_CREAT)
+        self.check_flush_error_on_close(os_helper.TESTFN, 'wb')
+        fd = os.open(os_helper.TESTFN, os.O_WRONLY|os.O_CREAT)
         self.check_flush_error_on_close(fd, 'wb')
-        fd = os.open(support.TESTFN, os.O_WRONLY|os.O_CREAT)
+        fd = os.open(os_helper.TESTFN, os.O_WRONLY|os.O_CREAT)
         self.check_flush_error_on_close(fd, 'wb', closefd=False)
         os.close(fd)
         # text io
-        self.check_flush_error_on_close(support.TESTFN, 'w')
-        fd = os.open(support.TESTFN, os.O_WRONLY|os.O_CREAT)
-        self.check_flush_error_on_close(fd, 'w')
-        fd = os.open(support.TESTFN, os.O_WRONLY|os.O_CREAT)
-        self.check_flush_error_on_close(fd, 'w', closefd=False)
+        self.check_flush_error_on_close(os_helper.TESTFN, 'w', encoding="utf-8")
+        fd = os.open(os_helper.TESTFN, os.O_WRONLY|os.O_CREAT)
+        self.check_flush_error_on_close(fd, 'w', encoding="utf-8")
+        fd = os.open(os_helper.TESTFN, os.O_WRONLY|os.O_CREAT)
+        self.check_flush_error_on_close(fd, 'w', encoding="utf-8", closefd=False)
         os.close(fd)
 
     def test_multi_close(self):
-        f = self.open(support.TESTFN, "wb", buffering=0)
+        f = self.open(os_helper.TESTFN, "wb", buffering=0)
         f.close()
         f.close()
         f.close()
@@ -856,12 +856,12 @@
             self.assertTrue(hasattr(obj, "__dict__"))
 
     def test_opener(self):
-        with self.open(support.TESTFN, "w") as f:
+        with self.open(os_helper.TESTFN, "w", encoding="utf-8") as f:
             f.write("egg\n")
-        fd = os.open(support.TESTFN, os.O_RDONLY)
+        fd = os.open(os_helper.TESTFN, os.O_RDONLY)
         def opener(path, flags):
             return fd
-        with self.open("non-existent", "r", opener=opener) as f:
+        with self.open("non-existent", "r", encoding="utf-8", opener=opener) as f:
             self.assertEqual(f.read(), "egg\n")
 
     def test_bad_opener_negative_1(self):
@@ -893,14 +893,14 @@
             f2.readline()
 
     def test_nonbuffered_textio(self):
-        with support.check_no_resource_warning(self):
+        with warnings_helper.check_no_resource_warning(self):
             with self.assertRaises(ValueError):
-                self.open(support.TESTFN, 'w', buffering=0)
+                self.open(os_helper.TESTFN, 'w', encoding="utf-8", buffering=0)
 
     def test_invalid_newline(self):
-        with support.check_no_resource_warning(self):
+        with warnings_helper.check_no_resource_warning(self):
             with self.assertRaises(ValueError):
-                self.open(support.TESTFN, 'w', newline='invalid')
+                self.open(os_helper.TESTFN, 'w', encoding="utf-8", newline='invalid')
 
     def test_buffered_readinto_mixin(self):
         # Test the implementation provided by BufferedIOBase
@@ -917,31 +917,31 @@
 
     def test_fspath_support(self):
         def check_path_succeeds(path):
-            with self.open(path, "w") as f:
+            with self.open(path, "w", encoding="utf-8") as f:
                 f.write("egg\n")
 
-            with self.open(path, "r") as f:
+            with self.open(path, "r", encoding="utf-8") as f:
                 self.assertEqual(f.read(), "egg\n")
 
-        check_path_succeeds(FakePath(support.TESTFN))
-        check_path_succeeds(FakePath(os.fsencode(support.TESTFN)))
+        check_path_succeeds(FakePath(os_helper.TESTFN))
+        check_path_succeeds(FakePath(os.fsencode(os_helper.TESTFN)))
 
-        with self.open(support.TESTFN, "w") as f:
+        with self.open(os_helper.TESTFN, "w", encoding="utf-8") as f:
             bad_path = FakePath(f.fileno())
             with self.assertRaises(TypeError):
-                self.open(bad_path, 'w')
+                self.open(bad_path, 'w', encoding="utf-8")
 
         bad_path = FakePath(None)
         with self.assertRaises(TypeError):
-            self.open(bad_path, 'w')
+            self.open(bad_path, 'w', encoding="utf-8")
 
         bad_path = FakePath(FloatingPointError)
         with self.assertRaises(FloatingPointError):
-            self.open(bad_path, 'w')
+            self.open(bad_path, 'w', encoding="utf-8")
 
         # ensure that refcounting is correct with some error conditions
         with self.assertRaisesRegex(ValueError, 'read/write/append mode'):
-            self.open(FakePath(support.TESTFN), 'rwxa')
+            self.open(FakePath(os_helper.TESTFN), 'rwxa', encoding="utf-8")
 
     def test_RawIOBase_readall(self):
         # Exercise the default unlimited RawIOBase.read() and readall()
@@ -1453,9 +1453,9 @@
             l = list(range(256)) * N
             random.shuffle(l)
             s = bytes(bytearray(l))
-            with self.open(support.TESTFN, "wb") as f:
+            with self.open(os_helper.TESTFN, "wb") as f:
                 f.write(s)
-            with self.open(support.TESTFN, self.read_mode, buffering=0) as raw:
+            with self.open(os_helper.TESTFN, self.read_mode, buffering=0) as raw:
                 bufio = self.tp(raw, 8)
                 errors = []
                 results = []
@@ -1472,7 +1472,7 @@
                         errors.append(e)
                         raise
                 threads = [threading.Thread(target=f) for x in range(20)]
-                with support.start_threads(threads):
+                with threading_helper.start_threads(threads):
                     time.sleep(0.02) # yield
                 self.assertFalse(errors,
                     "the following exceptions were caught: %r" % errors)
@@ -1481,7 +1481,7 @@
                     c = bytes(bytearray([i]))
                     self.assertEqual(s.count(c), N)
         finally:
-            support.unlink(support.TESTFN)
+            os_helper.unlink(os_helper.TESTFN)
 
     def test_unseekable(self):
         bufio = self.tp(self.MockUnseekableIO(b"A" * 10))
@@ -1539,8 +1539,8 @@
 class CBufferedReaderTest(BufferedReaderTest, SizeofTest):
     tp = io.BufferedReader
 
-    @unittest.skipIf(MEMORY_SANITIZER, "MSan defaults to crashing "
-                     "instead of returning NULL for malloc failure.")
+    @skip_if_sanitizer(memory=True, address=True, reason= "sanitizer defaults to crashing "
+                       "instead of returning NULL for malloc failure.")
     def test_constructor(self):
         BufferedReaderTest.test_constructor(self)
         # The allocation can succeed on 32-bit builds, e.g. with more
@@ -1571,9 +1571,9 @@
     def test_garbage_collection(self):
         # C BufferedReader objects are collected.
         # The Python version has __del__, so it ends into gc.garbage instead
-        self.addCleanup(support.unlink, support.TESTFN)
-        with support.check_warnings(('', ResourceWarning)):
-            rawio = self.FileIO(support.TESTFN, "w+b")
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
+        with warnings_helper.check_warnings(('', ResourceWarning)):
+            rawio = self.FileIO(os_helper.TESTFN, "w+b")
             f = self.tp(rawio)
             f.f = f
             wr = weakref.ref(f)
@@ -1586,6 +1586,22 @@
         with self.assertRaisesRegex(TypeError, "BufferedReader"):
             self.tp(io.BytesIO(), 1024, 1024, 1024)
 
+    def test_bad_readinto_value(self):
+        rawio = io.BufferedReader(io.BytesIO(b"12"))
+        rawio.readinto = lambda buf: -1
+        bufio = self.tp(rawio)
+        with self.assertRaises(OSError) as cm:
+            bufio.readline()
+        self.assertIsNone(cm.exception.__cause__)
+
+    def test_bad_readinto_type(self):
+        rawio = io.BufferedReader(io.BytesIO(b"12"))
+        rawio.readinto = lambda buf: b''
+        bufio = self.tp(rawio)
+        with self.assertRaises(OSError) as cm:
+            bufio.readline()
+        self.assertIsInstance(cm.exception.__cause__, TypeError)
+
 
 class PyBufferedReaderTest(BufferedReaderTest):
     tp = pyio.BufferedReader
@@ -1774,26 +1790,26 @@
 
     def test_truncate(self):
         # Truncate implicitly flushes the buffer.
-        self.addCleanup(support.unlink, support.TESTFN)
-        with self.open(support.TESTFN, self.write_mode, buffering=0) as raw:
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
+        with self.open(os_helper.TESTFN, self.write_mode, buffering=0) as raw:
             bufio = self.tp(raw, 8)
             bufio.write(b"abcdef")
             self.assertEqual(bufio.truncate(3), 3)
             self.assertEqual(bufio.tell(), 6)
-        with self.open(support.TESTFN, "rb", buffering=0) as f:
+        with self.open(os_helper.TESTFN, "rb", buffering=0) as f:
             self.assertEqual(f.read(), b"abc")
 
     def test_truncate_after_write(self):
         # Ensure that truncate preserves the file position after
         # writes longer than the buffer size.
         # Issue: https://bugs.python.org/issue32228
-        self.addCleanup(support.unlink, support.TESTFN)
-        with self.open(support.TESTFN, "wb") as f:
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
+        with self.open(os_helper.TESTFN, "wb") as f:
             # Fill with some buffer
             f.write(b'\x00' * 10000)
         buffer_sizes = [8192, 4096, 200]
         for buffer_size in buffer_sizes:
-            with self.open(support.TESTFN, "r+b", buffering=buffer_size) as f:
+            with self.open(os_helper.TESTFN, "r+b", buffering=buffer_size) as f:
                 f.write(b'\x00' * (buffer_size + 1))
                 # After write write_pos and write_end are set to 0
                 f.read(1)
@@ -1821,7 +1837,7 @@
             # writing the buffer to the raw streams. This is in addition
             # to concurrency issues due to switching threads in the middle
             # of Python code.
-            with self.open(support.TESTFN, self.write_mode, buffering=0) as raw:
+            with self.open(os_helper.TESTFN, self.write_mode, buffering=0) as raw:
                 bufio = self.tp(raw, 8)
                 errors = []
                 def f():
@@ -1836,17 +1852,17 @@
                         errors.append(e)
                         raise
                 threads = [threading.Thread(target=f) for x in range(20)]
-                with support.start_threads(threads):
+                with threading_helper.start_threads(threads):
                     time.sleep(0.02) # yield
                 self.assertFalse(errors,
                     "the following exceptions were caught: %r" % errors)
                 bufio.close()
-            with self.open(support.TESTFN, "rb") as f:
+            with self.open(os_helper.TESTFN, "rb") as f:
                 s = f.read()
             for i in range(256):
                 self.assertEqual(s.count(bytes([i])), N)
         finally:
-            support.unlink(support.TESTFN)
+            os_helper.unlink(os_helper.TESTFN)
 
     def test_misbehaved_io(self):
         rawio = self.MisbehavedRawIO()
@@ -1888,8 +1904,8 @@
 class CBufferedWriterTest(BufferedWriterTest, SizeofTest):
     tp = io.BufferedWriter
 
-    @unittest.skipIf(MEMORY_SANITIZER, "MSan defaults to crashing "
-                     "instead of returning NULL for malloc failure.")
+    @skip_if_sanitizer(memory=True, address=True, reason= "sanitizer defaults to crashing "
+                       "instead of returning NULL for malloc failure.")
     def test_constructor(self):
         BufferedWriterTest.test_constructor(self)
         # The allocation can succeed on 32-bit builds, e.g. with more
@@ -1914,9 +1930,9 @@
         # C BufferedWriter objects are collected, and collecting them flushes
         # all data to disk.
         # The Python version has __del__, so it ends into gc.garbage instead
-        self.addCleanup(support.unlink, support.TESTFN)
-        with support.check_warnings(('', ResourceWarning)):
-            rawio = self.FileIO(support.TESTFN, "w+b")
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
+        with warnings_helper.check_warnings(('', ResourceWarning)):
+            rawio = self.FileIO(os_helper.TESTFN, "w+b")
             f = self.tp(rawio)
             f.write(b"123xxx")
             f.x = f
@@ -1924,7 +1940,7 @@
             del f
             support.gc_collect()
         self.assertIsNone(wr(), wr)
-        with self.open(support.TESTFN, "rb") as f:
+        with self.open(os_helper.TESTFN, "rb") as f:
             self.assertEqual(f.read(), b"123xxx")
 
     def test_args_error(self):
@@ -2387,8 +2403,8 @@
 class CBufferedRandomTest(BufferedRandomTest, SizeofTest):
     tp = io.BufferedRandom
 
-    @unittest.skipIf(MEMORY_SANITIZER, "MSan defaults to crashing "
-                     "instead of returning NULL for malloc failure.")
+    @skip_if_sanitizer(memory=True, address=True, reason= "sanitizer defaults to crashing "
+                       "instead of returning NULL for malloc failure.")
     def test_constructor(self):
         BufferedRandomTest.test_constructor(self)
         # The allocation can succeed on 32-bit builds, e.g. with more
@@ -2499,19 +2515,17 @@
 
     codecEnabled = False
 
-    @classmethod
-    def lookupTestDecoder(cls, name):
-        if cls.codecEnabled and name == 'test_decoder':
-            latin1 = codecs.lookup('latin-1')
-            return codecs.CodecInfo(
-                name='test_decoder', encode=latin1.encode, decode=None,
-                incrementalencoder=None,
-                streamreader=None, streamwriter=None,
-                incrementaldecoder=cls)
 
-# Register the previous decoder for testing.
-# Disabled by default, tests will enable it.
-codecs.register(StatefulIncrementalDecoder.lookupTestDecoder)
+# bpo-41919: This method is separated from StatefulIncrementalDecoder to avoid a resource leak
+# when registering codecs and cleanup functions.
+def lookupTestDecoder(name):
+    if StatefulIncrementalDecoder.codecEnabled and name == 'test_decoder':
+        latin1 = codecs.lookup('latin-1')
+        return codecs.CodecInfo(
+            name='test_decoder', encode=latin1.encode, decode=None,
+            incrementalencoder=None,
+            streamreader=None, streamwriter=None,
+            incrementaldecoder=StatefulIncrementalDecoder)
 
 
 class StatefulIncrementalDecoderTest(unittest.TestCase):
@@ -2562,15 +2576,17 @@
     def setUp(self):
         self.testdata = b"AAA\r\nBBB\rCCC\r\nDDD\nEEE\r\n"
         self.normalized = b"AAA\nBBB\nCCC\nDDD\nEEE\n".decode("ascii")
-        support.unlink(support.TESTFN)
+        os_helper.unlink(os_helper.TESTFN)
+        codecs.register(lookupTestDecoder)
+        self.addCleanup(codecs.unregister, lookupTestDecoder)
 
     def tearDown(self):
-        support.unlink(support.TESTFN)
+        os_helper.unlink(os_helper.TESTFN)
 
     def test_constructor(self):
         r = self.BytesIO(b"\xc3\xa9\n\n")
         b = self.BufferedReader(r, 1000)
-        t = self.TextIOWrapper(b)
+        t = self.TextIOWrapper(b, encoding="utf-8")
         t.__init__(b, encoding="latin-1", newline="\r\n")
         self.assertEqual(t.encoding, "latin-1")
         self.assertEqual(t.line_buffering, False)
@@ -2578,8 +2594,8 @@
         self.assertEqual(t.encoding, "utf-8")
         self.assertEqual(t.line_buffering, True)
         self.assertEqual("\xe9\n", t.readline())
-        self.assertRaises(TypeError, t.__init__, b, newline=42)
-        self.assertRaises(ValueError, t.__init__, b, newline='xyzzy')
+        self.assertRaises(TypeError, t.__init__, b, encoding="utf-8", newline=42)
+        self.assertRaises(ValueError, t.__init__, b, encoding="utf-8", newline='xyzzy')
 
     def test_uninitialized(self):
         t = self.TextIOWrapper.__new__(self.TextIOWrapper)
@@ -2589,7 +2605,7 @@
         self.assertRaisesRegex((ValueError, AttributeError),
                                'uninitialized|has no attribute',
                                t.read, 0)
-        t.__init__(self.MockRawIO())
+        t.__init__(self.MockRawIO(), encoding="utf-8")
         self.assertEqual(t.read(0), '')
 
     def test_non_text_encoding_codecs_are_rejected(self):
@@ -2604,7 +2620,7 @@
     def test_detach(self):
         r = self.BytesIO()
         b = self.BufferedWriter(r)
-        t = self.TextIOWrapper(b)
+        t = self.TextIOWrapper(b, encoding="ascii")
         self.assertIs(t.detach(), b)
 
         t = self.TextIOWrapper(b, encoding="ascii")
@@ -2644,7 +2660,7 @@
     def test_recursive_repr(self):
         # Issue #25455
         raw = self.BytesIO()
-        t = self.TextIOWrapper(raw)
+        t = self.TextIOWrapper(raw, encoding="utf-8")
         with support.swap_attr(raw, 'name', t):
             try:
                 repr(t)  # Should not crash
@@ -2654,7 +2670,7 @@
     def test_line_buffering(self):
         r = self.BytesIO()
         b = self.BufferedWriter(r, 1000)
-        t = self.TextIOWrapper(b, newline="\n", line_buffering=True)
+        t = self.TextIOWrapper(b, encoding="utf-8", newline="\n", line_buffering=True)
         t.write("X")
         self.assertEqual(r.getvalue(), b"")  # No flush happened
         t.write("Y\nZ")
@@ -2665,7 +2681,7 @@
     def test_reconfigure_line_buffering(self):
         r = self.BytesIO()
         b = self.BufferedWriter(r, 1000)
-        t = self.TextIOWrapper(b, newline="\n", line_buffering=False)
+        t = self.TextIOWrapper(b, encoding="utf-8", newline="\n", line_buffering=False)
         t.write("AB\nC")
         self.assertEqual(r.getvalue(), b"")
 
@@ -2702,7 +2718,9 @@
 
             current_locale_encoding = locale.getpreferredencoding(False)
             b = self.BytesIO()
-            t = self.TextIOWrapper(b)
+            with warnings.catch_warnings():
+                warnings.simplefilter("ignore", EncodingWarning)
+                t = self.TextIOWrapper(b)
             self.assertEqual(t.encoding, current_locale_encoding)
         finally:
             os.environ.clear()
@@ -2715,16 +2733,18 @@
         import _testcapi
         b = self.BytesIO()
         b.fileno = lambda: _testcapi.INT_MAX + 1
-        self.assertRaises(OverflowError, self.TextIOWrapper, b)
+        self.assertRaises(OverflowError, self.TextIOWrapper, b, encoding="locale")
         b.fileno = lambda: _testcapi.UINT_MAX + 1
-        self.assertRaises(OverflowError, self.TextIOWrapper, b)
+        self.assertRaises(OverflowError, self.TextIOWrapper, b, encoding="locale")
 
     def test_encoding(self):
         # Check the encoding attribute is always set, and valid
         b = self.BytesIO()
         t = self.TextIOWrapper(b, encoding="utf-8")
         self.assertEqual(t.encoding, "utf-8")
-        t = self.TextIOWrapper(b)
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", EncodingWarning)
+            t = self.TextIOWrapper(b)
         self.assertIsNotNone(t.encoding)
         codecs.lookup(t.encoding)
 
@@ -2889,7 +2909,7 @@
         rawio = self.CloseFailureIO()
         with support.catch_unraisable_exception() as cm:
             with self.assertRaises(AttributeError):
-                self.TextIOWrapper(rawio).xyzzy
+                self.TextIOWrapper(rawio, encoding="utf-8").xyzzy
 
             if not IOBASE_EMITS_UNRAISABLE:
                 self.assertIsNone(cm.unraisable)
@@ -2901,11 +2921,11 @@
     def test_basic_io(self):
         for chunksize in (1, 2, 3, 4, 5, 15, 16, 17, 31, 32, 33, 63, 64, 65):
             for enc in "ascii", "latin-1", "utf-8" :# , "utf-16-be", "utf-16-le":
-                f = self.open(support.TESTFN, "w+", encoding=enc)
+                f = self.open(os_helper.TESTFN, "w+", encoding=enc)
                 f._CHUNK_SIZE = chunksize
                 self.assertEqual(f.write("abc"), 3)
                 f.close()
-                f = self.open(support.TESTFN, "r+", encoding=enc)
+                f = self.open(os_helper.TESTFN, "r+", encoding=enc)
                 f._CHUNK_SIZE = chunksize
                 self.assertEqual(f.tell(), 0)
                 self.assertEqual(f.read(), "abc")
@@ -2950,7 +2970,7 @@
         self.assertEqual(rlines, wlines)
 
     def test_telling(self):
-        f = self.open(support.TESTFN, "w+", encoding="utf-8")
+        f = self.open(os_helper.TESTFN, "w+", encoding="utf-8")
         p0 = f.tell()
         f.write("\xff\n")
         p1 = f.tell()
@@ -2978,9 +2998,9 @@
         u_suffix = "\u8888\n"
         suffix = bytes(u_suffix.encode("utf-8"))
         line = prefix + suffix
-        with self.open(support.TESTFN, "wb") as f:
+        with self.open(os_helper.TESTFN, "wb") as f:
             f.write(line*2)
-        with self.open(support.TESTFN, "r", encoding="utf-8") as f:
+        with self.open(os_helper.TESTFN, "r", encoding="utf-8") as f:
             s = f.read(prefix_size)
             self.assertEqual(s, str(prefix, "ascii"))
             self.assertEqual(f.tell(), prefix_size)
@@ -2989,9 +3009,9 @@
     def test_seeking_too(self):
         # Regression test for a specific bug
         data = b'\xe0\xbf\xbf\n'
-        with self.open(support.TESTFN, "wb") as f:
+        with self.open(os_helper.TESTFN, "wb") as f:
             f.write(data)
-        with self.open(support.TESTFN, "r", encoding="utf-8") as f:
+        with self.open(os_helper.TESTFN, "r", encoding="utf-8") as f:
             f._CHUNK_SIZE  # Just test that it exists
             f._CHUNK_SIZE = 2
             f.readline()
@@ -3005,17 +3025,17 @@
         def test_seek_and_tell_with_data(data, min_pos=0):
             """Tell/seek to various points within a data stream and ensure
             that the decoded data returned by read() is consistent."""
-            f = self.open(support.TESTFN, 'wb')
+            f = self.open(os_helper.TESTFN, 'wb')
             f.write(data)
             f.close()
-            f = self.open(support.TESTFN, encoding='test_decoder')
+            f = self.open(os_helper.TESTFN, encoding='test_decoder')
             f._CHUNK_SIZE = CHUNK_SIZE
             decoded = f.read()
             f.close()
 
             for i in range(min_pos, len(decoded) + 1): # seek positions
                 for j in [1, 5, len(decoded) - i]: # read lengths
-                    f = self.open(support.TESTFN, encoding='test_decoder')
+                    f = self.open(os_helper.TESTFN, encoding='test_decoder')
                     self.assertEqual(f.read(i), decoded[:i])
                     cookie = f.tell()
                     self.assertEqual(f.read(j), decoded[i:i + j])
@@ -3045,11 +3065,11 @@
             StatefulIncrementalDecoder.codecEnabled = 0
 
     def test_multibyte_seek_and_tell(self):
-        f = self.open(support.TESTFN, "w", encoding="euc_jp")
+        f = self.open(os_helper.TESTFN, "w", encoding="euc_jp")
         f.write("AB\n\u3046\u3048\n")
         f.close()
 
-        f = self.open(support.TESTFN, "r", encoding="euc_jp")
+        f = self.open(os_helper.TESTFN, "r", encoding="euc_jp")
         self.assertEqual(f.readline(), "AB\n")
         p0 = f.tell()
         self.assertEqual(f.readline(), "\u3046\u3048\n")
@@ -3060,7 +3080,7 @@
         f.close()
 
     def test_seek_with_encoder_state(self):
-        f = self.open(support.TESTFN, "w", encoding="euc_jis_2004")
+        f = self.open(os_helper.TESTFN, "w", encoding="euc_jis_2004")
         f.write("\u00e6\u0300")
         p0 = f.tell()
         f.write("\u00e6")
@@ -3068,7 +3088,7 @@
         f.write("\u0300")
         f.close()
 
-        f = self.open(support.TESTFN, "r", encoding="euc_jis_2004")
+        f = self.open(os_helper.TESTFN, "r", encoding="euc_jis_2004")
         self.assertEqual(f.readline(), "\u00e6\u0300\u0300")
         f.close()
 
@@ -3096,11 +3116,11 @@
         class UnReadable(self.BytesIO):
             def readable(self):
                 return False
-        txt = self.TextIOWrapper(UnReadable())
+        txt = self.TextIOWrapper(UnReadable(), encoding="utf-8")
         self.assertRaises(OSError, txt.read)
 
     def test_read_one_by_one(self):
-        txt = self.TextIOWrapper(self.BytesIO(b"AA\r\nBB"))
+        txt = self.TextIOWrapper(self.BytesIO(b"AA\r\nBB"), encoding="utf-8")
         reads = ""
         while True:
             c = txt.read(1)
@@ -3110,7 +3130,7 @@
         self.assertEqual(reads, "AA\nBB")
 
     def test_readlines(self):
-        txt = self.TextIOWrapper(self.BytesIO(b"AA\nBB\nCC"))
+        txt = self.TextIOWrapper(self.BytesIO(b"AA\nBB\nCC"), encoding="utf-8")
         self.assertEqual(txt.readlines(), ["AA\n", "BB\n", "CC"])
         txt.seek(0)
         self.assertEqual(txt.readlines(None), ["AA\n", "BB\n", "CC"])
@@ -3120,7 +3140,7 @@
     # read in amounts equal to TextIOWrapper._CHUNK_SIZE which is 128.
     def test_read_by_chunk(self):
         # make sure "\r\n" straddles 128 char boundary.
-        txt = self.TextIOWrapper(self.BytesIO(b"A" * 127 + b"\r\nB"))
+        txt = self.TextIOWrapper(self.BytesIO(b"A" * 127 + b"\r\nB"), encoding="utf-8")
         reads = ""
         while True:
             c = txt.read(128)
@@ -3132,7 +3152,7 @@
     def test_writelines(self):
         l = ['ab', 'cd', 'ef']
         buf = self.BytesIO()
-        txt = self.TextIOWrapper(buf)
+        txt = self.TextIOWrapper(buf, encoding="utf-8")
         txt.writelines(l)
         txt.flush()
         self.assertEqual(buf.getvalue(), b'abcdef')
@@ -3140,13 +3160,13 @@
     def test_writelines_userlist(self):
         l = UserList(['ab', 'cd', 'ef'])
         buf = self.BytesIO()
-        txt = self.TextIOWrapper(buf)
+        txt = self.TextIOWrapper(buf, encoding="utf-8")
         txt.writelines(l)
         txt.flush()
         self.assertEqual(buf.getvalue(), b'abcdef')
 
     def test_writelines_error(self):
-        txt = self.TextIOWrapper(self.BytesIO())
+        txt = self.TextIOWrapper(self.BytesIO(), encoding="utf-8")
         self.assertRaises(TypeError, txt.writelines, [1, 2, 3])
         self.assertRaises(TypeError, txt.writelines, None)
         self.assertRaises(TypeError, txt.writelines, b'abc')
@@ -3212,7 +3232,7 @@
 
     def test_append_bom(self):
         # The BOM is not written again when appending to a non-empty file
-        filename = support.TESTFN
+        filename = os_helper.TESTFN
         for charset in ('utf-8-sig', 'utf-16', 'utf-32'):
             with self.open(filename, 'w', encoding=charset) as f:
                 f.write('aaa')
@@ -3227,7 +3247,7 @@
 
     def test_seek_bom(self):
         # Same test, but when seeking manually
-        filename = support.TESTFN
+        filename = os_helper.TESTFN
         for charset in ('utf-8-sig', 'utf-16', 'utf-32'):
             with self.open(filename, 'w', encoding=charset) as f:
                 f.write('aaa')
@@ -3242,7 +3262,7 @@
 
     def test_seek_append_bom(self):
         # Same test, but first seek to the start and then to the end
-        filename = support.TESTFN
+        filename = os_helper.TESTFN
         for charset in ('utf-8-sig', 'utf-16', 'utf-32'):
             with self.open(filename, 'w', encoding=charset) as f:
                 f.write('aaa')
@@ -3254,25 +3274,25 @@
                 self.assertEqual(f.read(), 'aaaxxx'.encode(charset))
 
     def test_errors_property(self):
-        with self.open(support.TESTFN, "w") as f:
+        with self.open(os_helper.TESTFN, "w", encoding="utf-8") as f:
             self.assertEqual(f.errors, "strict")
-        with self.open(support.TESTFN, "w", errors="replace") as f:
+        with self.open(os_helper.TESTFN, "w", encoding="utf-8", errors="replace") as f:
             self.assertEqual(f.errors, "replace")
 
     @support.no_tracing
     def test_threads_write(self):
         # Issue6750: concurrent writes could duplicate data
         event = threading.Event()
-        with self.open(support.TESTFN, "w", buffering=1) as f:
+        with self.open(os_helper.TESTFN, "w", encoding="utf-8", buffering=1) as f:
             def run(n):
                 text = "Thread%03d\n" % n
                 event.wait()
                 f.write(text)
             threads = [threading.Thread(target=run, args=(x,))
                        for x in range(20)]
-            with support.start_threads(threads, event.set):
+            with threading_helper.start_threads(threads, event.set):
                 time.sleep(0.02)
-        with self.open(support.TESTFN) as f:
+        with self.open(os_helper.TESTFN, encoding="utf-8") as f:
             content = f.read()
             for n in range(20):
                 self.assertEqual(content.count("Thread%03d\n" % n), 1)
@@ -3343,7 +3363,7 @@
         self.assertRaises(ValueError, txt.flush)
 
     def test_unseekable(self):
-        txt = self.TextIOWrapper(self.MockUnseekableIO(self.testdata))
+        txt = self.TextIOWrapper(self.MockUnseekableIO(self.testdata), encoding="utf-8")
         self.assertRaises(self.UnsupportedOperation, txt.tell)
         self.assertRaises(self.UnsupportedOperation, txt.seek, 0)
 
@@ -3432,11 +3452,11 @@
     def test_read_nonbytes(self):
         # Issue #17106
         # Crash when underlying read() returns non-bytes
-        t = self.TextIOWrapper(self.StringIO('a'))
+        t = self.TextIOWrapper(self.StringIO('a'), encoding="utf-8")
         self.assertRaises(TypeError, t.read, 1)
-        t = self.TextIOWrapper(self.StringIO('a'))
+        t = self.TextIOWrapper(self.StringIO('a'), encoding="utf-8")
         self.assertRaises(TypeError, t.readline)
-        t = self.TextIOWrapper(self.StringIO('a'))
+        t = self.TextIOWrapper(self.StringIO('a'), encoding="utf-8")
         self.assertRaises(TypeError, t.read)
 
     def test_illegal_encoder(self):
@@ -3704,8 +3724,8 @@
     def test_initialization(self):
         r = self.BytesIO(b"\xc3\xa9\n\n")
         b = self.BufferedReader(r, 1000)
-        t = self.TextIOWrapper(b)
-        self.assertRaises(ValueError, t.__init__, b, newline='xyzzy')
+        t = self.TextIOWrapper(b, encoding="utf-8")
+        self.assertRaises(ValueError, t.__init__, b, encoding="utf-8", newline='xyzzy')
         self.assertRaises(ValueError, t.read)
 
         t = self.TextIOWrapper.__new__(self.TextIOWrapper)
@@ -3715,8 +3735,8 @@
         # C TextIOWrapper objects are collected, and collecting them flushes
         # all data to disk.
         # The Python version has __del__, so it ends in gc.garbage instead.
-        with support.check_warnings(('', ResourceWarning)):
-            rawio = io.FileIO(support.TESTFN, "wb")
+        with warnings_helper.check_warnings(('', ResourceWarning)):
+            rawio = io.FileIO(os_helper.TESTFN, "wb")
             b = self.BufferedWriter(rawio)
             t = self.TextIOWrapper(b, encoding="ascii")
             t.write("456def")
@@ -3725,7 +3745,7 @@
             del t
             support.gc_collect()
         self.assertIsNone(wr(), wr)
-        with self.open(support.TESTFN, "rb") as f:
+        with self.open(os_helper.TESTFN, "rb") as f:
             self.assertEqual(f.read(), b"456def")
 
     def test_rwpair_cleared_before_textio(self):
@@ -3747,6 +3767,33 @@
         with self.assertRaises(AttributeError):
             del t._CHUNK_SIZE
 
+    def test_internal_buffer_size(self):
+        # bpo-43260: TextIOWrapper's internal buffer should not store
+        # data larger than chunk size.
+        chunk_size = 8192  # default chunk size, updated later
+
+        class MockIO(self.MockRawIO):
+            def write(self, data):
+                if len(data) > chunk_size:
+                    raise RuntimeError
+                return super().write(data)
+
+        buf = MockIO()
+        t = self.TextIOWrapper(buf, encoding="ascii")
+        chunk_size = t._CHUNK_SIZE
+        t.write("abc")
+        t.write("def")
+        # default chunk size is 8192 bytes so t don't write data to buf.
+        self.assertEqual([], buf._write_stack)
+
+        with self.assertRaises(RuntimeError):
+            t.write("x"*(chunk_size+1))
+
+        self.assertEqual([b"abcdef"], buf._write_stack)
+        t.write("ghi")
+        t.write("x"*chunk_size)
+        self.assertEqual([b"abcdef", b"ghi", b"x"*chunk_size], buf._write_stack)
+
 
 class PyTextIOWrapperTest(TextIOWrapperTest):
     io = pyio
@@ -3882,7 +3929,7 @@
 class MiscIOTest(unittest.TestCase):
 
     def tearDown(self):
-        support.unlink(support.TESTFN)
+        os_helper.unlink(os_helper.TESTFN)
 
     def test___all__(self):
         for name in self.io.__all__:
@@ -3896,21 +3943,21 @@
                 self.assertTrue(issubclass(obj, self.IOBase))
 
     def test_attributes(self):
-        f = self.open(support.TESTFN, "wb", buffering=0)
+        f = self.open(os_helper.TESTFN, "wb", buffering=0)
         self.assertEqual(f.mode, "wb")
         f.close()
 
-        with support.check_warnings(('', DeprecationWarning)):
-            f = self.open(support.TESTFN, "U")
-        self.assertEqual(f.name,            support.TESTFN)
-        self.assertEqual(f.buffer.name,     support.TESTFN)
-        self.assertEqual(f.buffer.raw.name, support.TESTFN)
+        with warnings_helper.check_warnings(('', DeprecationWarning)):
+            f = self.open(os_helper.TESTFN, "U", encoding="utf-8")
+        self.assertEqual(f.name,            os_helper.TESTFN)
+        self.assertEqual(f.buffer.name,     os_helper.TESTFN)
+        self.assertEqual(f.buffer.raw.name, os_helper.TESTFN)
         self.assertEqual(f.mode,            "U")
         self.assertEqual(f.buffer.mode,     "rb")
         self.assertEqual(f.buffer.raw.mode, "rb")
         f.close()
 
-        f = self.open(support.TESTFN, "w+")
+        f = self.open(os_helper.TESTFN, "w+", encoding="utf-8")
         self.assertEqual(f.mode,            "w+")
         self.assertEqual(f.buffer.mode,     "rb+") # Does it really matter?
         self.assertEqual(f.buffer.raw.mode, "rb+")
@@ -3927,7 +3974,7 @@
         # bpo-27805: Ignore ESPIPE from lseek() in open().
         r, w = os.pipe()
         self.addCleanup(os.close, r)
-        f = self.open(w, 'a')
+        f = self.open(w, 'a', encoding="utf-8")
         self.addCleanup(f.close)
         # Check that the file is marked non-seekable. On Windows, however, lseek
         # somehow succeeds on pipes.
@@ -3952,7 +3999,9 @@
                 {"mode": "w+", "buffering": 2},
                 {"mode": "w+b", "buffering": 0},
             ]:
-            f = self.open(support.TESTFN, **kwargs)
+            if "b" not in kwargs["mode"]:
+                kwargs["encoding"] = "utf-8"
+            f = self.open(os_helper.TESTFN, **kwargs)
             f.close()
             self.assertRaises(ValueError, f.flush)
             self.assertRaises(ValueError, f.fileno)
@@ -4002,17 +4051,17 @@
         self.assertIsInstance(self.TextIOBase, abc.ABCMeta)
 
     def _check_abc_inheritance(self, abcmodule):
-        with self.open(support.TESTFN, "wb", buffering=0) as f:
+        with self.open(os_helper.TESTFN, "wb", buffering=0) as f:
             self.assertIsInstance(f, abcmodule.IOBase)
             self.assertIsInstance(f, abcmodule.RawIOBase)
             self.assertNotIsInstance(f, abcmodule.BufferedIOBase)
             self.assertNotIsInstance(f, abcmodule.TextIOBase)
-        with self.open(support.TESTFN, "wb") as f:
+        with self.open(os_helper.TESTFN, "wb") as f:
             self.assertIsInstance(f, abcmodule.IOBase)
             self.assertNotIsInstance(f, abcmodule.RawIOBase)
             self.assertIsInstance(f, abcmodule.BufferedIOBase)
             self.assertNotIsInstance(f, abcmodule.TextIOBase)
-        with self.open(support.TESTFN, "w") as f:
+        with self.open(os_helper.TESTFN, "w", encoding="utf-8") as f:
             self.assertIsInstance(f, abcmodule.IOBase)
             self.assertNotIsInstance(f, abcmodule.RawIOBase)
             self.assertNotIsInstance(f, abcmodule.BufferedIOBase)
@@ -4036,9 +4085,9 @@
         self.assertIn(r, str(cm.warning.args[0]))
 
     def test_warn_on_dealloc(self):
-        self._check_warn_on_dealloc(support.TESTFN, "wb", buffering=0)
-        self._check_warn_on_dealloc(support.TESTFN, "wb")
-        self._check_warn_on_dealloc(support.TESTFN, "w")
+        self._check_warn_on_dealloc(os_helper.TESTFN, "wb", buffering=0)
+        self._check_warn_on_dealloc(os_helper.TESTFN, "wb")
+        self._check_warn_on_dealloc(os_helper.TESTFN, "w", encoding="utf-8")
 
     def _check_warn_on_dealloc_fd(self, *args, **kwargs):
         fds = []
@@ -4056,13 +4105,13 @@
         # When using closefd=False, there's no warning
         r, w = os.pipe()
         fds += r, w
-        with support.check_no_resource_warning(self):
+        with warnings_helper.check_no_resource_warning(self):
             open(r, *args, closefd=False, **kwargs)
 
     def test_warn_on_dealloc_fd(self):
         self._check_warn_on_dealloc_fd("rb", buffering=0)
         self._check_warn_on_dealloc_fd("rb")
-        self._check_warn_on_dealloc_fd("r")
+        self._check_warn_on_dealloc_fd("r", encoding="utf-8")
 
 
     def test_pickling(self):
@@ -4078,8 +4127,10 @@
                 {"mode": "w+b"},
                 {"mode": "w+b", "buffering": 0},
             ]:
+            if "b" not in kwargs["mode"]:
+                kwargs["encoding"] = "utf-8"
             for protocol in range(pickle.HIGHEST_PROTOCOL + 1):
-                with self.open(support.TESTFN, **kwargs) as f:
+                with self.open(os_helper.TESTFN, **kwargs) as f:
                     self.assertRaises(TypeError, pickle.dumps, f, protocol)
 
     def test_nonblock_pipe_write_bigbuf(self):
@@ -4142,20 +4193,20 @@
 
     def test_create_fail(self):
         # 'x' mode fails if file is existing
-        with self.open(support.TESTFN, 'w'):
+        with self.open(os_helper.TESTFN, 'w', encoding="utf-8"):
             pass
-        self.assertRaises(FileExistsError, self.open, support.TESTFN, 'x')
+        self.assertRaises(FileExistsError, self.open, os_helper.TESTFN, 'x', encoding="utf-8")
 
     def test_create_writes(self):
         # 'x' mode opens for writing
-        with self.open(support.TESTFN, 'xb') as f:
+        with self.open(os_helper.TESTFN, 'xb') as f:
             f.write(b"spam")
-        with self.open(support.TESTFN, 'rb') as f:
+        with self.open(os_helper.TESTFN, 'rb') as f:
             self.assertEqual(b"spam", f.read())
 
     def test_open_allargs(self):
         # there used to be a buffer overflow in the parser for rawmode
-        self.assertRaises(ValueError, self.open, support.TESTFN, 'rwax+')
+        self.assertRaises(ValueError, self.open, os_helper.TESTFN, 'rwax+', encoding="utf-8")
 
     def test_check_encoding_errors(self):
         # bpo-37388: open() and TextIOWrapper must check encoding and errors
@@ -4202,6 +4253,37 @@
         proc = assert_python_failure('-X', 'dev', '-c', code)
         self.assertEqual(proc.rc, 10, proc)
 
+    def test_check_encoding_warning(self):
+        # PEP 597: Raise warning when encoding is not specified
+        # and sys.flags.warn_default_encoding is set.
+        mod = self.io.__name__
+        filename = __file__
+        code = textwrap.dedent(f'''\
+            import sys
+            from {mod} import open, TextIOWrapper
+            import pathlib
+
+            with open({filename!r}) as f:           # line 5
+                pass
+
+            pathlib.Path({filename!r}).read_text()  # line 8
+        ''')
+        proc = assert_python_ok('-X', 'warn_default_encoding', '-c', code)
+        warnings = proc.err.splitlines()
+        self.assertEqual(len(warnings), 2)
+        self.assertTrue(
+            warnings[0].startswith(b"<string>:5: EncodingWarning: "))
+        self.assertTrue(
+            warnings[1].startswith(b"<string>:8: EncodingWarning: "))
+
+    @support.cpython_only
+    # Depending if OpenWrapper was already created or not, the warning is
+    # emitted or not. For example, the attribute is already created when this
+    # test is run multiple times.
+    @warnings_helper.ignore_warnings(category=DeprecationWarning)
+    def test_openwrapper(self):
+        self.assertIs(self.io.OpenWrapper, self.io.open)
+
 
 class CMiscIOTest(MiscIOTest):
     io = io
@@ -4283,6 +4365,31 @@
         """Check that a partial write, when it gets interrupted, properly
         invokes the signal handler, and bubbles up the exception raised
         in the latter."""
+
+        # XXX This test has three flaws that appear when objects are
+        # XXX not reference counted.
+
+        # - if wio.write() happens to trigger a garbage collection,
+        #   the signal exception may be raised when some __del__
+        #   method is running; it will not reach the assertRaises()
+        #   call.
+
+        # - more subtle, if the wio object is not destroyed at once
+        #   and survives this function, the next opened file is likely
+        #   to have the same fileno (since the file descriptor was
+        #   actively closed).  When wio.__del__ is finally called, it
+        #   will close the other's test file...  To trigger this with
+        #   CPython, try adding "global wio" in this function.
+
+        # - This happens only for streams created by the _pyio module,
+        #   because a wio.close() that fails still consider that the
+        #   file needs to be closed again.  You can try adding an
+        #   "assert wio.closed" at the end of the function.
+
+        # Fortunately, a little gc.collect() seems to be enough to
+        # work around all these issues.
+        support.gc_collect()  # For PyPy or other GCs.
+
         read_results = []
         def _read():
             s = os.read(r, 1)
@@ -4404,13 +4511,13 @@
 
     def test_interrupted_read_retry_text(self):
         self.check_interrupted_read_retry(lambda x: x,
-                                          mode="r")
+                                          mode="r", encoding="latin1")
 
     def check_interrupted_write_retry(self, item, **fdopen_kwargs):
         """Check that a buffered write, when it gets interrupted (either
         returning a partial result or EINTR), properly invokes the signal
         handler and retries if the latter returned successfully."""
-        select = support.import_module("select")
+        select = import_helper.import_module("select")
 
         # A quantity that exceeds the buffer size of an anonymous pipe's
         # write end.
@@ -4517,8 +4624,6 @@
     globs = globals()
     c_io_ns.update((x.__name__, globs["C" + x.__name__]) for x in mocks)
     py_io_ns.update((x.__name__, globs["Py" + x.__name__]) for x in mocks)
-    # Avoid turning open into a bound method.
-    py_io_ns["open"] = pyio.OpenWrapper
     for test in tests:
         if test.__name__.startswith("C"):
             for name, obj in c_io_ns.items():
diff --git a/Lib/test/test_ioctl.py b/Lib/test/test_ioctl.py
index a287358..7b7067e 100644
--- a/Lib/test/test_ioctl.py
+++ b/Lib/test/test_ioctl.py
@@ -1,6 +1,7 @@
 import array
 import unittest
-from test.support import import_module, get_attribute
+from test.support import get_attribute
+from test.support.import_helper import import_module
 import os, struct
 fcntl = import_module('fcntl')
 termios = import_module('termios')
diff --git a/Lib/test/test_ipaddress.py b/Lib/test/test_ipaddress.py
index 3c07008..ff77bdb 100644
--- a/Lib/test/test_ipaddress.py
+++ b/Lib/test/test_ipaddress.py
@@ -96,10 +96,23 @@
 class CommonTestMixin_v4(CommonTestMixin):
 
     def test_leading_zeros(self):
-        self.assertInstancesEqual("000.000.000.000", "0.0.0.0")
-        self.assertInstancesEqual("192.168.000.001", "192.168.0.1")
-        self.assertInstancesEqual("016.016.016.016", "16.16.16.16")
-        self.assertInstancesEqual("001.000.008.016", "1.0.8.16")
+        # bpo-36384: no leading zeros to avoid ambiguity with octal notation
+        msg = "Leading zeros are not permitted in '\\d+'"
+        addresses = [
+            "000.000.000.000",
+            "192.168.000.001",
+            "016.016.016.016",
+            "192.168.000.001",
+            "001.000.008.016",
+            "01.2.3.40",
+            "1.02.3.40",
+            "1.2.03.40",
+            "1.2.3.040",
+        ]
+        for address in addresses:
+            with self.subTest(address=address):
+                with self.assertAddressError(msg):
+                    self.factory(address)
 
     def test_int(self):
         self.assertInstancesEqual(0, "0.0.0.0")
@@ -2326,6 +2339,12 @@
         self.assertEqual(ipaddress.ip_address('::ffff:c0a8:101').ipv4_mapped,
                          ipaddress.ip_address('192.168.1.1'))
 
+    def testIpv4MappedPrivateCheck(self):
+        self.assertEqual(
+                True, ipaddress.ip_address('::ffff:192.168.1.1').is_private)
+        self.assertEqual(
+                False, ipaddress.ip_address('::ffff:172.32.0.0').is_private)
+
     def testAddrExclude(self):
         addr1 = ipaddress.ip_network('10.1.1.0/24')
         addr2 = ipaddress.ip_network('10.1.1.0/26')
diff --git a/Lib/test/test_isinstance.py b/Lib/test/test_isinstance.py
index 31b3899..9d37cff 100644
--- a/Lib/test/test_isinstance.py
+++ b/Lib/test/test_isinstance.py
@@ -4,6 +4,8 @@
 
 import unittest
 import sys
+import typing
+from test import support
 
 
 
@@ -208,6 +210,25 @@
         self.assertEqual(False, isinstance(AbstractChild(), Super))
         self.assertEqual(False, isinstance(AbstractChild(), Child))
 
+    def test_isinstance_with_or_union(self):
+        self.assertTrue(isinstance(Super(), Super | int))
+        self.assertFalse(isinstance(None, str | int))
+        self.assertTrue(isinstance(3, str | int))
+        self.assertTrue(isinstance("", str | int))
+        self.assertTrue(isinstance([], typing.List | typing.Tuple))
+        self.assertTrue(isinstance(2, typing.List | int))
+        self.assertFalse(isinstance(2, typing.List | typing.Tuple))
+        self.assertTrue(isinstance(None, int | None))
+        self.assertFalse(isinstance(3.14, int | str))
+        with self.assertRaises(TypeError):
+            isinstance(2, list[int])
+        with self.assertRaises(TypeError):
+            isinstance(2, list[int] | int)
+        with self.assertRaises(TypeError):
+            isinstance(2, int | str | list[int] | float)
+
+
+
     def test_subclass_normal(self):
         # normal classes
         self.assertEqual(True, issubclass(Super, Super))
@@ -217,6 +238,8 @@
         self.assertEqual(True, issubclass(Child, Child))
         self.assertEqual(True, issubclass(Child, Super))
         self.assertEqual(False, issubclass(Child, AbstractSuper))
+        self.assertTrue(issubclass(typing.List, typing.List|typing.Tuple))
+        self.assertFalse(issubclass(int, typing.List|typing.Tuple))
 
     def test_subclass_abstract(self):
         # abstract classes
@@ -244,12 +267,24 @@
     def test_subclass_recursion_limit(self):
         # make sure that issubclass raises RecursionError before the C stack is
         # blown
-        self.assertRaises(RecursionError, blowstack, issubclass, str, str)
+        with support.infinite_recursion():
+            self.assertRaises(RecursionError, blowstack, issubclass, str, str)
 
     def test_isinstance_recursion_limit(self):
         # make sure that issubclass raises RecursionError before the C stack is
         # blown
-        self.assertRaises(RecursionError, blowstack, isinstance, '', str)
+        with support.infinite_recursion():
+            self.assertRaises(RecursionError, blowstack, isinstance, '', str)
+
+    def test_subclass_with_union(self):
+        self.assertTrue(issubclass(int, int | float | int))
+        self.assertTrue(issubclass(str, str | Child | str))
+        self.assertFalse(issubclass(dict, float|str))
+        self.assertFalse(issubclass(object, float|str))
+        with self.assertRaises(TypeError):
+            issubclass(2, Child | Super)
+        with self.assertRaises(TypeError):
+            issubclass(int, list[int] | Child)
 
     def test_issubclass_refcount_handling(self):
         # bpo-39382: abstract_issubclass() didn't hold item reference while
@@ -276,10 +311,42 @@
             @property
             def __bases__(self):
                 return self.__bases__
+        with support.infinite_recursion():
+            self.assertRaises(RecursionError, issubclass, X(), int)
+            self.assertRaises(RecursionError, issubclass, int, X())
+            self.assertRaises(RecursionError, isinstance, 1, X())
 
-        self.assertRaises(RecursionError, issubclass, X(), int)
-        self.assertRaises(RecursionError, issubclass, int, X())
-        self.assertRaises(RecursionError, isinstance, 1, X())
+    def test_infinite_recursion_via_bases_tuple(self):
+        """Regression test for bpo-30570."""
+        class Failure(object):
+            def __getattr__(self, attr):
+                return (self, None)
+        with support.infinite_recursion():
+            with self.assertRaises(RecursionError):
+                issubclass(Failure(), int)
+
+    def test_infinite_cycle_in_bases(self):
+        """Regression test for bpo-30570."""
+        class X:
+            @property
+            def __bases__(self):
+                return (self, self, self)
+        with support.infinite_recursion():
+            self.assertRaises(RecursionError, issubclass, X(), int)
+
+    def test_infinitely_many_bases(self):
+        """Regression test for bpo-30570."""
+        class X:
+            def __getattr__(self, attr):
+                self.assertEqual(attr, "__bases__")
+                class A:
+                    pass
+                class B:
+                    pass
+                A.__getattr__ = B.__getattr__ = X.__getattr__
+                return (A(), B())
+        with support.infinite_recursion():
+            self.assertRaises(RecursionError, issubclass, X(), int)
 
 
 def blowstack(fxn, arg, compare_to):
diff --git a/Lib/test/test_iter.py b/Lib/test/test_iter.py
index 5243469..554f602 100644
--- a/Lib/test/test_iter.py
+++ b/Lib/test/test_iter.py
@@ -2,7 +2,8 @@
 
 import sys
 import unittest
-from test.support import run_unittest, TESTFN, unlink, cpython_only
+from test.support import cpython_only
+from test.support.os_helper import TESTFN, unlink
 from test.support import check_free_after_iterating, ALWAYS_EQ, NEVER_EQ
 import pickle
 import collections.abc
@@ -336,13 +337,13 @@
 
     # Test a file
     def test_iter_file(self):
-        f = open(TESTFN, "w")
+        f = open(TESTFN, "w", encoding="utf-8")
         try:
             for i in range(5):
                 f.write("%d\n" % i)
         finally:
             f.close()
-        f = open(TESTFN, "r")
+        f = open(TESTFN, "r", encoding="utf-8")
         try:
             self.check_for_loop(f, ["0\n", "1\n", "2\n", "3\n", "4\n"], pickle=False)
             self.check_for_loop(f, [], pickle=False)
@@ -365,13 +366,13 @@
         self.assertRaises(TypeError, list, list)
         self.assertRaises(TypeError, list, 42)
 
-        f = open(TESTFN, "w")
+        f = open(TESTFN, "w", encoding="utf-8")
         try:
             for i in range(5):
                 f.write("%d\n" % i)
         finally:
             f.close()
-        f = open(TESTFN, "r")
+        f = open(TESTFN, "r", encoding="utf-8")
         try:
             self.assertEqual(list(f), ["0\n", "1\n", "2\n", "3\n", "4\n"])
             f.seek(0, 0)
@@ -398,13 +399,13 @@
         self.assertRaises(TypeError, tuple, list)
         self.assertRaises(TypeError, tuple, 42)
 
-        f = open(TESTFN, "w")
+        f = open(TESTFN, "w", encoding="utf-8")
         try:
             for i in range(5):
                 f.write("%d\n" % i)
         finally:
             f.close()
-        f = open(TESTFN, "r")
+        f = open(TESTFN, "r", encoding="utf-8")
         try:
             self.assertEqual(tuple(f), ("0\n", "1\n", "2\n", "3\n", "4\n"))
             f.seek(0, 0)
@@ -475,14 +476,14 @@
         self.assertEqual(max(d.values()), 3)
         self.assertEqual(min(iter(d.values())), 1)
 
-        f = open(TESTFN, "w")
+        f = open(TESTFN, "w", encoding="utf-8")
         try:
             f.write("medium line\n")
             f.write("xtra large line\n")
             f.write("itty-bitty line\n")
         finally:
             f.close()
-        f = open(TESTFN, "r")
+        f = open(TESTFN, "r", encoding="utf-8")
         try:
             self.assertEqual(min(f), "itty-bitty line\n")
             f.seek(0, 0)
@@ -508,13 +509,13 @@
                      i < len(d) and dkeys[i] or None)
                     for i in range(3)]
 
-        f = open(TESTFN, "w")
+        f = open(TESTFN, "w", encoding="utf-8")
         try:
             for i in range(10):
                 f.write("xy" * i + "\n") # line i has len 2*i+1
         finally:
             f.close()
-        f = open(TESTFN, "r")
+        f = open(TESTFN, "r", encoding="utf-8")
         try:
             self.assertEqual(list(map(len, f)), list(range(1, 21, 2)))
         finally:
@@ -555,12 +556,12 @@
                 self.i = i+1
                 return i
 
-        f = open(TESTFN, "w")
+        f = open(TESTFN, "w", encoding="utf-8")
         try:
             f.write("a\n" "bbb\n" "cc\n")
         finally:
             f.close()
-        f = open(TESTFN, "r")
+        f = open(TESTFN, "r", encoding="utf-8")
         try:
             self.assertEqual(list(zip(IntsFrom(0), f, IntsFrom(-100))),
                              [(0, "a\n", -100),
@@ -623,13 +624,13 @@
                     return "fooled you!"
                 return next(self.it)
 
-        f = open(TESTFN, "w")
+        f = open(TESTFN, "w", encoding="utf-8")
         try:
             f.write("a\n" + "b\n" + "c\n")
         finally:
             f.close()
 
-        f = open(TESTFN, "r")
+        f = open(TESTFN, "r", encoding="utf-8")
         # Nasty:  string.join(s) can't know whether unicode.join() is needed
         # until it's seen all of s's elements.  But in this case, f's
         # iterator cannot be restarted.  So what we're testing here is
@@ -675,12 +676,12 @@
             self.assertIn((k, v), d.items())
             self.assertNotIn((v, k), d.items())
 
-        f = open(TESTFN, "w")
+        f = open(TESTFN, "w", encoding="utf-8")
         try:
             f.write("a\n" "b\n" "c\n")
         finally:
             f.close()
-        f = open(TESTFN, "r")
+        f = open(TESTFN, "r", encoding="utf-8")
         try:
             for chunk in "abc":
                 f.seek(0, 0)
@@ -712,12 +713,12 @@
         self.assertEqual(countOf(d.values(), 2j), 1)
         self.assertEqual(countOf(d.values(), 1j), 0)
 
-        f = open(TESTFN, "w")
+        f = open(TESTFN, "w", encoding="utf-8")
         try:
             f.write("a\n" "b\n" "c\n" "b\n")
         finally:
             f.close()
-        f = open(TESTFN, "r")
+        f = open(TESTFN, "r", encoding="utf-8")
         try:
             for letter, count in ("a", 1), ("b", 2), ("c", 1), ("d", 0):
                 f.seek(0, 0)
@@ -747,12 +748,12 @@
         self.assertRaises(TypeError, indexOf, indexOf, indexOf)
         self.assertRaises(ZeroDivisionError, indexOf, BadIterableClass(), 1)
 
-        f = open(TESTFN, "w")
+        f = open(TESTFN, "w", encoding="utf-8")
         try:
             f.write("a\n" "b\n" "c\n" "d\n" "e\n")
         finally:
             f.close()
-        f = open(TESTFN, "r")
+        f = open(TESTFN, "r", encoding="utf-8")
         try:
             fiter = iter(f)
             self.assertEqual(indexOf(fiter, "b\n"), 1)
@@ -773,7 +774,7 @@
 
     # Test iterators with file.writelines().
     def test_writelines(self):
-        f = open(TESTFN, "w")
+        f = open(TESTFN, "w", encoding="utf-8")
 
         try:
             self.assertRaises(TypeError, f.writelines, None)
@@ -812,7 +813,7 @@
             f.writelines(Whatever(6, 6+2000))
             f.close()
 
-            f = open(TESTFN)
+            f = open(TESTFN, encoding="utf-8")
             expected = [str(i) + "\n" for i in range(1, 2006)]
             self.assertEqual(list(f), expected)
 
@@ -856,14 +857,14 @@
         a, b, c = {1: 42, 2: 42, 3: 42}.values()
         self.assertEqual((a, b, c), (42, 42, 42))
 
-        f = open(TESTFN, "w")
+        f = open(TESTFN, "w", encoding="utf-8")
         lines = ("a\n", "bb\n", "ccc\n")
         try:
             for line in lines:
                 f.write(line)
         finally:
             f.close()
-        f = open(TESTFN, "r")
+        f = open(TESTFN, "r", encoding="utf-8")
         try:
             a, b, c = f
             self.assertEqual((a, b, c), lines)
@@ -1036,9 +1037,5 @@
         self.assertRaises(ZeroDivisionError, iter, BadIterableClass())
 
 
-def test_main():
-    run_unittest(TestCase)
-
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py
index 702cf08..4c9c597 100644
--- a/Lib/test/test_itertools.py
+++ b/Lib/test/test_itertools.py
@@ -12,6 +12,8 @@
 import sys
 import struct
 import threading
+import gc
+
 maxsize = support.MAX_Py_ssize_t
 minsize = -maxsize-1
 
@@ -1024,6 +1026,25 @@
         self.assertEqual(next(it), (1, 2))
         self.assertRaises(RuntimeError, next, it)
 
+    def test_pairwise(self):
+        self.assertEqual(list(pairwise('')), [])
+        self.assertEqual(list(pairwise('a')), [])
+        self.assertEqual(list(pairwise('ab')),
+                              [('a', 'b')]),
+        self.assertEqual(list(pairwise('abcde')),
+                              [('a', 'b'), ('b', 'c'), ('c', 'd'), ('d', 'e')])
+        self.assertEqual(list(pairwise(range(10_000))),
+                         list(zip(range(10_000), range(1, 10_000))))
+
+        with self.assertRaises(TypeError):
+            pairwise()                                      # too few arguments
+        with self.assertRaises(TypeError):
+            pairwise('abc', 10)                             # too many arguments
+        with self.assertRaises(TypeError):
+            pairwise(iterable='abc')                        # keyword arguments
+        with self.assertRaises(TypeError):
+            pairwise(None)                                  # non-iterable argument
+
     def test_product(self):
         for args, result in [
             ([], [()]),                     # zero iterables
@@ -1421,6 +1442,7 @@
         p = weakref.proxy(a)
         self.assertEqual(getattr(p, '__class__'), type(b))
         del a
+        support.gc_collect()  # For PyPy or other GCs.
         self.assertRaises(ReferenceError, getattr, p, '__class__')
 
         ans = list('abc')
@@ -1554,6 +1576,51 @@
             self.assertRaises(StopIteration, next, f(lambda x:x, []))
             self.assertRaises(StopIteration, next, f(lambda x:x, StopNow()))
 
+    @support.cpython_only
+    def test_combinations_result_gc(self):
+        # bpo-42536: combinations's tuple-reuse speed trick breaks the GC's
+        # assumptions about what can be untracked. Make sure we re-track result
+        # tuples whenever we reuse them.
+        it = combinations([None, []], 1)
+        next(it)
+        gc.collect()
+        # That GC collection probably untracked the recycled internal result
+        # tuple, which has the value (None,). Make sure it's re-tracked when
+        # it's mutated and returned from __next__:
+        self.assertTrue(gc.is_tracked(next(it)))
+
+    @support.cpython_only
+    def test_combinations_with_replacement_result_gc(self):
+        # Ditto for combinations_with_replacement.
+        it = combinations_with_replacement([None, []], 1)
+        next(it)
+        gc.collect()
+        self.assertTrue(gc.is_tracked(next(it)))
+
+    @support.cpython_only
+    def test_permutations_result_gc(self):
+        # Ditto for permutations.
+        it = permutations([None, []], 1)
+        next(it)
+        gc.collect()
+        self.assertTrue(gc.is_tracked(next(it)))
+
+    @support.cpython_only
+    def test_product_result_gc(self):
+        # Ditto for product.
+        it = product([None, []])
+        next(it)
+        gc.collect()
+        self.assertTrue(gc.is_tracked(next(it)))
+
+    @support.cpython_only
+    def test_zip_longest_result_gc(self):
+        # Ditto for zip_longest.
+        it = zip_longest([[]])
+        gc.collect()
+        self.assertTrue(gc.is_tracked(next(it)))
+
+
 class TestExamples(unittest.TestCase):
 
     def test_accumulate(self):
@@ -1787,6 +1854,10 @@
         a = []
         self.makecycle(islice([a]*2, None), a)
 
+    def test_pairwise(self):
+        a = []
+        self.makecycle(pairwise([a]*5), a)
+
     def test_permutations(self):
         a = []
         self.makecycle(permutations([1,2,a,3], 3), a)
@@ -1995,6 +2066,17 @@
             self.assertRaises(TypeError, islice, N(s), 10)
             self.assertRaises(ZeroDivisionError, list, islice(E(s), 10))
 
+    def test_pairwise(self):
+        for s in ("123", "", range(1000), ('do', 1.2), range(2000,2200,5)):
+            for g in (G, I, Ig, S, L, R):
+                seq = list(g(s))
+                expected = list(zip(seq, seq[1:]))
+                actual = list(pairwise(g(s)))
+                self.assertEqual(actual, expected)
+            self.assertRaises(TypeError, pairwise, X(s))
+            self.assertRaises(TypeError, pairwise, N(s))
+            self.assertRaises(ZeroDivisionError, list, pairwise(E(s)))
+
     def test_starmap(self):
         for s in (range(10), range(0), range(100), (7,11), range(20,50,5)):
             for g in (G, I, Ig, S, L, R):
@@ -2312,19 +2394,37 @@
 ...     else:
 ...         return starmap(func, repeat(args, times))
 
->>> def pairwise(iterable):
-...     "s -> (s0,s1), (s1,s2), (s2, s3), ..."
-...     a, b = tee(iterable)
-...     try:
-...         next(b)
-...     except StopIteration:
-...         pass
-...     return zip(a, b)
-
->>> def grouper(n, iterable, fillvalue=None):
-...     "grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx"
+>>> def grouper(iterable, n, *, incomplete='fill', fillvalue=None):
+...     "Collect data into non-overlapping fixed-length chunks or blocks"
+...     # grouper('ABCDEFG', 3, fillvalue='x') --> ABC DEF Gxx
+...     # grouper('ABCDEFG', 3, incomplete='strict') --> ABC DEF ValueError
+...     # grouper('ABCDEFG', 3, incomplete='ignore') --> ABC DEF
 ...     args = [iter(iterable)] * n
-...     return zip_longest(*args, fillvalue=fillvalue)
+...     if incomplete == 'fill':
+...         return zip_longest(*args, fillvalue=fillvalue)
+...     if incomplete == 'strict':
+...         return zip(*args, strict=True)
+...     if incomplete == 'ignore':
+...         return zip(*args)
+...     else:
+...         raise ValueError('Expected fill, strict, or ignore')
+
+>>> def triplewise(iterable):
+...     "Return overlapping triplets from an iterable"
+...     # pairwise('ABCDEFG') -> ABC BCD CDE DEF EFG
+...     for (a, _), (b, c) in pairwise(pairwise(iterable)):
+...         yield a, b, c
+
+>>> import collections
+>>> def sliding_window(iterable, n):
+...     # sliding_window('ABCDEFG', 4) -> ABCD BCDE CDEF DEFG
+...     it = iter(iterable)
+...     window = collections.deque(islice(it, n), maxlen=n)
+...     if len(window) == n:
+...         yield tuple(window)
+...     for x in it:
+...         window.append(x)
+...         yield tuple(window)
 
 >>> def roundrobin(*iterables):
 ...     "roundrobin('ABC', 'D', 'EF') --> A D E B F C"
@@ -2339,6 +2439,40 @@
 ...             pending -= 1
 ...             nexts = cycle(islice(nexts, pending))
 
+>>> def partition(pred, iterable):
+...     "Use a predicate to partition entries into false entries and true entries"
+...     # partition(is_odd, range(10)) --> 0 2 4 6 8   and  1 3 5 7 9
+...     t1, t2 = tee(iterable)
+...     return filterfalse(pred, t1), filter(pred, t2)
+
+>>> def before_and_after(predicate, it):
+...     ''' Variant of takewhile() that allows complete
+...         access to the remainder of the iterator.
+...
+...         >>> all_upper, remainder = before_and_after(str.isupper, 'ABCdEfGhI')
+...         >>> str.join('', all_upper)
+...         'ABC'
+...         >>> str.join('', remainder)
+...         'dEfGhI'
+...
+...         Note that the first iterator must be fully
+...         consumed before the second iterator can
+...         generate valid results.
+...     '''
+...     it = iter(it)
+...     transition = []
+...     def true_iterator():
+...         for elem in it:
+...             if predicate(elem):
+...                 yield elem
+...             else:
+...                 transition.append(elem)
+...                 return
+...     def remainder_iterator():
+...         yield from transition
+...         yield from it
+...     return true_iterator(), remainder_iterator()
+
 >>> def powerset(iterable):
 ...     "powerset([1,2,3]) --> () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)"
 ...     s = list(iterable)
@@ -2451,15 +2585,6 @@
 >>> take(5, map(int, repeatfunc(random.random)))
 [0, 0, 0, 0, 0]
 
->>> list(pairwise('abcd'))
-[('a', 'b'), ('b', 'c'), ('c', 'd')]
-
->>> list(pairwise([]))
-[]
-
->>> list(pairwise('a'))
-[]
-
 >>> list(islice(pad_none('abc'), 0, 6))
 ['a', 'b', 'c', None, None, None]
 
@@ -2469,12 +2594,47 @@
 >>> dotproduct([1,2,3], [4,5,6])
 32
 
->>> list(grouper(3, 'abcdefg', 'x'))
+>>> list(grouper('abcdefg', 3, fillvalue='x'))
 [('a', 'b', 'c'), ('d', 'e', 'f'), ('g', 'x', 'x')]
 
+>>> it = grouper('abcdefg', 3, incomplete='strict')
+>>> next(it)
+('a', 'b', 'c')
+>>> next(it)
+('d', 'e', 'f')
+>>> next(it)
+Traceback (most recent call last):
+  ...
+ValueError: zip() argument 2 is shorter than argument 1
+
+>>> list(grouper('abcdefg', n=3, incomplete='ignore'))
+[('a', 'b', 'c'), ('d', 'e', 'f')]
+
+>>> list(triplewise('ABCDEFG'))
+[('A', 'B', 'C'), ('B', 'C', 'D'), ('C', 'D', 'E'), ('D', 'E', 'F'), ('E', 'F', 'G')]
+
+>>> list(sliding_window('ABCDEFG', 4))
+[('A', 'B', 'C', 'D'), ('B', 'C', 'D', 'E'), ('C', 'D', 'E', 'F'), ('D', 'E', 'F', 'G')]
+
 >>> list(roundrobin('abc', 'd', 'ef'))
 ['a', 'd', 'e', 'b', 'f', 'c']
 
+>>> def is_odd(x):
+...     return x % 2 == 1
+
+>>> evens, odds = partition(is_odd, range(10))
+>>> list(evens)
+[0, 2, 4, 6, 8]
+>>> list(odds)
+[1, 3, 5, 7, 9]
+
+>>> it = iter('ABCdEfGhI')
+>>> all_upper, remainder = before_and_after(str.isupper, it)
+>>> ''.join(all_upper)
+'ABC'
+>>> ''.join(remainder)
+'dEfGhI'
+
 >>> list(powerset([1,2,3]))
 [(), (1,), (2,), (3,), (1, 2), (1, 3), (2, 3), (1, 2, 3)]
 
diff --git a/Lib/test/test_json/__init__.py b/Lib/test/test_json/__init__.py
index bac370d..74b64ed 100644
--- a/Lib/test/test_json/__init__.py
+++ b/Lib/test/test_json/__init__.py
@@ -4,10 +4,12 @@
 import unittest
 
 from test import support
+from test.support import import_helper
+
 
 # import json with and without accelerations
-cjson = support.import_fresh_module('json', fresh=['_json'])
-pyjson = support.import_fresh_module('json', blocked=['_json'])
+cjson = import_helper.import_fresh_module('json', fresh=['_json'])
+pyjson = import_helper.import_fresh_module('json', blocked=['_json'])
 # JSONDecodeError is cached inside the _json module
 cjson.JSONDecodeError = cjson.decoder.JSONDecodeError = json.JSONDecodeError
 
diff --git a/Lib/test/test_json/test_recursion.py b/Lib/test/test_json/test_recursion.py
index 543c628..9919d7f 100644
--- a/Lib/test/test_json/test_recursion.py
+++ b/Lib/test/test_json/test_recursion.py
@@ -1,3 +1,4 @@
+from test import support
 from test.test_json import PyTest, CTest
 
 
@@ -69,11 +70,14 @@
         # test that loading highly-nested objects doesn't segfault when C
         # accelerations are used. See #12017
         with self.assertRaises(RecursionError):
-            self.loads('{"a":' * 100000 + '1' + '}' * 100000)
+            with support.infinite_recursion():
+                self.loads('{"a":' * 100000 + '1' + '}' * 100000)
         with self.assertRaises(RecursionError):
-            self.loads('{"a":' * 100000 + '[1]' + '}' * 100000)
+            with support.infinite_recursion():
+                self.loads('{"a":' * 100000 + '[1]' + '}' * 100000)
         with self.assertRaises(RecursionError):
-            self.loads('[' * 100000 + '1' + ']' * 100000)
+            with support.infinite_recursion():
+                self.loads('[' * 100000 + '1' + ']' * 100000)
 
     def test_highly_nested_objects_encoding(self):
         # See #12051
@@ -81,9 +85,11 @@
         for x in range(100000):
             l, d = [l], {'k':d}
         with self.assertRaises(RecursionError):
-            self.dumps(l)
+            with support.infinite_recursion():
+                self.dumps(l)
         with self.assertRaises(RecursionError):
-            self.dumps(d)
+            with support.infinite_recursion():
+                self.dumps(d)
 
     def test_endless_recursion(self):
         # See #12051
@@ -93,7 +99,8 @@
                 return [o]
 
         with self.assertRaises(RecursionError):
-            EndlessJSONEncoder(check_circular=False).encode(5j)
+            with support.infinite_recursion():
+                EndlessJSONEncoder(check_circular=False).encode(5j)
 
 
 class TestPyRecursion(TestRecursion, PyTest): pass
diff --git a/Lib/test/test_json/test_speedups.py b/Lib/test/test_json/test_speedups.py
index fbfee1a..682014c 100644
--- a/Lib/test/test_json/test_speedups.py
+++ b/Lib/test/test_json/test_speedups.py
@@ -59,6 +59,15 @@
         with self.assertRaises(ZeroDivisionError):
             enc('spam', 4)
 
+    def test_bad_markers_argument_to_encoder(self):
+        # https://bugs.python.org/issue45269
+        with self.assertRaisesRegex(
+            TypeError,
+            r'make_encoder\(\) argument 1 must be dict or None, not int',
+        ):
+            self.json.encoder.c_make_encoder(1, None, None, None, ': ', ', ',
+                                             False, False, False)
+
     def test_bad_bool_args(self):
         def test(name):
             self.json.encoder.JSONEncoder(**{name: BadBool()}).encode({'a': 1})
diff --git a/Lib/test/test_json/test_tool.py b/Lib/test/test_json/test_tool.py
index fc2a7a4..1d7fca6 100644
--- a/Lib/test/test_json/test_tool.py
+++ b/Lib/test/test_json/test_tool.py
@@ -6,6 +6,7 @@
 import subprocess
 
 from test import support
+from test.support import os_helper
 from test.support.script_helper import assert_python_ok
 
 
@@ -91,7 +92,7 @@
         self.assertEqual(process.stderr, '')
 
     def _create_infile(self, data=None):
-        infile = support.TESTFN
+        infile = os_helper.TESTFN
         with open(infile, "w", encoding="utf-8") as fp:
             self.addCleanup(os.remove, infile)
             fp.write(data or self.data)
@@ -121,10 +122,19 @@
 
     def test_infile_outfile(self):
         infile = self._create_infile()
-        outfile = support.TESTFN + '.out'
+        outfile = os_helper.TESTFN + '.out'
         rc, out, err = assert_python_ok('-m', 'json.tool', infile, outfile)
         self.addCleanup(os.remove, outfile)
-        with open(outfile, "r") as fp:
+        with open(outfile, "r", encoding="utf-8") as fp:
+            self.assertEqual(fp.read(), self.expect)
+        self.assertEqual(rc, 0)
+        self.assertEqual(out, b'')
+        self.assertEqual(err, b'')
+
+    def test_writing_in_place(self):
+        infile = self._create_infile()
+        rc, out, err = assert_python_ok('-m', 'json.tool', infile, infile)
+        with open(infile, "r", encoding="utf-8") as fp:
             self.assertEqual(fp.read(), self.expect)
         self.assertEqual(rc, 0)
         self.assertEqual(out, b'')
@@ -189,7 +199,7 @@
 
     def test_no_ensure_ascii_flag(self):
         infile = self._create_infile('{"key":"💩"}')
-        outfile = support.TESTFN + '.out'
+        outfile = os_helper.TESTFN + '.out'
         self.addCleanup(os.remove, outfile)
         assert_python_ok('-m', 'json.tool', '--no-ensure-ascii', infile, outfile)
         with open(outfile, "rb") as f:
@@ -200,7 +210,7 @@
 
     def test_ensure_ascii_default(self):
         infile = self._create_infile('{"key":"💩"}')
-        outfile = support.TESTFN + '.out'
+        outfile = os_helper.TESTFN + '.out'
         self.addCleanup(os.remove, outfile)
         assert_python_ok('-m', 'json.tool', infile, outfile)
         with open(outfile, "rb") as f:
diff --git a/Lib/test/test_keyword.py b/Lib/test/test_keyword.py
index e1042cf..3e2a8b3 100644
--- a/Lib/test/test_keyword.py
+++ b/Lib/test/test_keyword.py
@@ -1,6 +1,5 @@
 import keyword
 import unittest
-from test.support import use_old_parser
 
 
 class Test_iskeyword(unittest.TestCase):
@@ -22,10 +21,7 @@
         self.assertFalse(keyword.iskeyword('eggs'))
 
     def test_all_keywords_fail_to_be_used_as_names(self):
-        all_keywords = set(keyword.kwlist)
-        if use_old_parser():
-            all_keywords.discard('__peg_parser__')
-        for key in all_keywords:
+        for key in keyword.kwlist:
             with self.assertRaises(SyntaxError):
                 exec(f"{key} = 42")
 
diff --git a/Lib/test/test_keywordonlyarg.py b/Lib/test/test_keywordonlyarg.py
index 2cf8a89..df82f67 100644
--- a/Lib/test/test_keywordonlyarg.py
+++ b/Lib/test/test_keywordonlyarg.py
@@ -63,7 +63,8 @@
             pass
         with self.assertRaises(TypeError) as exc:
             f(1, 2, 3)
-        expected = "f() takes from 1 to 2 positional arguments but 3 were given"
+        expected = (f"{f.__qualname__}() takes from 1 to 2 "
+                    "positional arguments but 3 were given")
         self.assertEqual(str(exc.exception), expected)
 
     def testSyntaxErrorForFunctionCall(self):
diff --git a/Lib/test/test_largefile.py b/Lib/test/test_largefile.py
index a99b4ba..8f6bec1 100644
--- a/Lib/test/test_largefile.py
+++ b/Lib/test/test_largefile.py
@@ -8,9 +8,10 @@
 import socket
 import shutil
 import threading
-from test.support import TESTFN, requires, unlink, bigmemtest
+from test.support import requires, bigmemtest
 from test.support import SHORT_TIMEOUT
 from test.support import socket_helper
+from test.support.os_helper import TESTFN, unlink
 import io  # C implementation of io
 import _pyio as pyio # Python implementation of io
 
diff --git a/Lib/test/test_lib2to3.py b/Lib/test/test_lib2to3.py
index e939d47..fd12a7e 100644
--- a/Lib/test/test_lib2to3.py
+++ b/Lib/test/test_lib2to3.py
@@ -1,5 +1,6 @@
 import unittest
-from test.support import check_warnings, import_fresh_module
+from test.support.import_helper import import_fresh_module
+from test.support.warnings_helper import check_warnings
 
 with check_warnings(("", PendingDeprecationWarning)):
     load_tests = import_fresh_module('lib2to3.tests', fresh=['lib2to3']).load_tests
diff --git a/Lib/test/test_linecache.py b/Lib/test/test_linecache.py
index 375d9c4..c6e2dad 100644
--- a/Lib/test/test_linecache.py
+++ b/Lib/test/test_linecache.py
@@ -6,6 +6,7 @@
 import tempfile
 import tokenize
 from test import support
+from test.support import os_helper
 
 
 FILENAME = linecache.__file__
@@ -44,7 +45,7 @@
         with tempfile.NamedTemporaryFile(delete=False) as fp:
             self.file_name = fp.name
             fp.write(self.file_byte_string)
-        self.addCleanup(support.unlink, self.file_name)
+        self.addCleanup(os_helper.unlink, self.file_name)
 
 
 class GetLineTestsGoodData(TempFile):
@@ -115,7 +116,7 @@
         # Check module loading
         for entry in MODULES:
             filename = os.path.join(MODULE_PATH, entry) + '.py'
-            with open(filename) as file:
+            with open(filename, encoding='utf-8') as file:
                 for index, line in enumerate(file):
                     self.assertEqual(line, getline(filename, index + 1))
 
@@ -124,10 +125,10 @@
         self.assertEqual(empty, [])
 
     def test_no_ending_newline(self):
-        self.addCleanup(support.unlink, support.TESTFN)
-        with open(support.TESTFN, "w") as fp:
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
+        with open(os_helper.TESTFN, "w", encoding='utf-8') as fp:
             fp.write(SOURCE_3)
-        lines = linecache.getlines(support.TESTFN)
+        lines = linecache.getlines(os_helper.TESTFN)
         self.assertEqual(lines, ["\n", "def f():\n", "    return 3\n"])
 
     def test_clearcache(self):
@@ -150,20 +151,20 @@
     def test_checkcache(self):
         getline = linecache.getline
         # Create a source file and cache its contents
-        source_name = support.TESTFN + '.py'
-        self.addCleanup(support.unlink, source_name)
-        with open(source_name, 'w') as source:
+        source_name = os_helper.TESTFN + '.py'
+        self.addCleanup(os_helper.unlink, source_name)
+        with open(source_name, 'w', encoding='utf-8') as source:
             source.write(SOURCE_1)
         getline(source_name, 1)
 
         # Keep a copy of the old contents
         source_list = []
-        with open(source_name) as source:
+        with open(source_name, encoding='utf-8') as source:
             for index, line in enumerate(source):
                 self.assertEqual(line, getline(source_name, index + 1))
                 source_list.append(line)
 
-        with open(source_name, 'w') as source:
+        with open(source_name, 'w', encoding='utf-8') as source:
             source.write(SOURCE_2)
 
         # Try to update a bogus cache entry
@@ -175,7 +176,7 @@
 
         # Update the cache and check whether it matches the new source file
         linecache.checkcache(source_name)
-        with open(source_name) as source:
+        with open(source_name, encoding='utf-8') as source:
             for index, line in enumerate(source):
                 self.assertEqual(line, getline(source_name, index + 1))
                 source_list.append(line)
@@ -238,5 +239,47 @@
         self.assertEqual(linecache.getlines(FILENAME), lines)
 
 
+class LineCacheInvalidationTests(unittest.TestCase):
+    def setUp(self):
+        super().setUp()
+        linecache.clearcache()
+        self.deleted_file = os_helper.TESTFN + '.1'
+        self.modified_file = os_helper.TESTFN + '.2'
+        self.unchanged_file = os_helper.TESTFN + '.3'
+
+        for fname in (self.deleted_file,
+                      self.modified_file,
+                      self.unchanged_file):
+            self.addCleanup(os_helper.unlink, fname)
+            with open(fname, 'w', encoding='utf-8') as source:
+                source.write(f'print("I am {fname}")')
+
+            self.assertNotIn(fname, linecache.cache)
+            linecache.getlines(fname)
+            self.assertIn(fname, linecache.cache)
+
+        os.remove(self.deleted_file)
+        with open(self.modified_file, 'w', encoding='utf-8') as source:
+            source.write('print("was modified")')
+
+    def test_checkcache_for_deleted_file(self):
+        linecache.checkcache(self.deleted_file)
+        self.assertNotIn(self.deleted_file, linecache.cache)
+        self.assertIn(self.modified_file, linecache.cache)
+        self.assertIn(self.unchanged_file, linecache.cache)
+
+    def test_checkcache_for_modified_file(self):
+        linecache.checkcache(self.modified_file)
+        self.assertIn(self.deleted_file, linecache.cache)
+        self.assertNotIn(self.modified_file, linecache.cache)
+        self.assertIn(self.unchanged_file, linecache.cache)
+
+    def test_checkcache_with_no_parameter(self):
+        linecache.checkcache()
+        self.assertNotIn(self.deleted_file, linecache.cache)
+        self.assertNotIn(self.modified_file, linecache.cache)
+        self.assertIn(self.unchanged_file, linecache.cache)
+
+
 if __name__ == "__main__":
     unittest.main()
diff --git a/Lib/test/test_lltrace.py b/Lib/test/test_lltrace.py
index 49fae81..06e33f4 100644
--- a/Lib/test/test_lltrace.py
+++ b/Lib/test/test_lltrace.py
@@ -2,7 +2,7 @@
 import textwrap
 import unittest
 
-from test import support
+from test.support import os_helper
 from test.support.script_helper import assert_python_ok
 
 
@@ -12,9 +12,9 @@
         # If this test fails, it will reproduce a crash reported as
         # bpo-34113. The crash happened at the command line console of
         # debug Python builds with __ltrace__ enabled (only possible in console),
-        # when the interal Python stack was negatively adjusted
-        with open(support.TESTFN, 'w') as fd:
-            self.addCleanup(os.unlink, support.TESTFN)
+        # when the internal Python stack was negatively adjusted
+        with open(os_helper.TESTFN, 'w', encoding='utf-8') as fd:
+            self.addCleanup(os_helper.unlink, os_helper.TESTFN)
             fd.write(textwrap.dedent("""\
             import code
 
@@ -25,7 +25,7 @@
             print('unreachable if bug exists')
             """))
 
-            assert_python_ok(support.TESTFN)
+            assert_python_ok(os_helper.TESTFN)
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/Lib/test/test_locale.py b/Lib/test/test_locale.py
index 2863d20..f844e62 100644
--- a/Lib/test/test_locale.py
+++ b/Lib/test/test_locale.py
@@ -1,4 +1,6 @@
-from test.support import verbose, is_android, check_warnings
+from decimal import Decimal
+from test.support import verbose, is_android
+from test.support.warnings_helper import check_warnings
 import unittest
 import locale
 import sys
@@ -494,7 +496,7 @@
 class TestMiscellaneous(unittest.TestCase):
     def test_defaults_UTF8(self):
         # Issue #18378: on (at least) macOS setting LC_CTYPE to "UTF-8" is
-        # valid. Futhermore LC_CTYPE=UTF is used by the UTF-8 locale coercing
+        # valid. Furthermore LC_CTYPE=UTF is used by the UTF-8 locale coercing
         # during interpreter startup (on macOS).
         import _locale
         import os
@@ -563,7 +565,13 @@
         loc = locale.getlocale(locale.LC_CTYPE)
         if verbose:
             print('testing with %a' % (loc,), end=' ', flush=True)
-        locale.setlocale(locale.LC_CTYPE, loc)
+        try:
+            locale.setlocale(locale.LC_CTYPE, loc)
+        except locale.Error as exc:
+            # bpo-37945: setlocale(LC_CTYPE) fails with getlocale(LC_CTYPE)
+            # and the tr_TR locale on Windows. getlocale() builds a locale
+            # which is not recognize by setlocale().
+            self.skipTest(f"setlocale(LC_CTYPE, {loc!r}) failed: {exc!r}")
         self.assertEqual(loc, locale.getlocale(locale.LC_CTYPE))
 
     def test_invalid_locale_format_in_localetuple(self):
@@ -629,5 +637,32 @@
         self._test_atoi('50 000', 50000)
 
 
+class BaseLocalizeTest(BaseLocalizedTest):
+
+    def _test_localize(self, value, out, grouping=False):
+        self.assertEqual(locale.localize(value, grouping=grouping), out)
+
+
+class TestEnUSLocalize(EnUSCookedTest, BaseLocalizeTest):
+
+    def test_localize(self):
+        self._test_localize('50000.00', '50000.00')
+        self._test_localize(
+            '{0:.16f}'.format(Decimal('1.15')), '1.1500000000000000')
+
+
+class TestCLocalize(CCookedTest, BaseLocalizeTest):
+
+    def test_localize(self):
+        self._test_localize('50000.00', '50000.00')
+
+
+class TestfrFRLocalize(FrFRCookedTest, BaseLocalizeTest):
+
+    def test_localize(self):
+        self._test_localize('50000.00', '50000,00')
+        self._test_localize('50000.00', '50 000,00', grouping=True)
+
+
 if __name__ == '__main__':
     unittest.main()
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
index 410eae2..8212cf7 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -1,4 +1,4 @@
-# Copyright 2001-2019 by Vinay Sajip. All Rights Reserved.
+# Copyright 2001-2021 by Vinay Sajip. All Rights Reserved.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose and without fee is hereby granted,
@@ -16,7 +16,7 @@
 
 """Test harness for the logging module. Run all tests.
 
-Copyright (C) 2001-2019 Vinay Sajip. All Rights Reserved.
+Copyright (C) 2001-2021 Vinay Sajip. All Rights Reserved.
 """
 
 import logging
@@ -36,13 +36,17 @@
 import queue
 import random
 import re
+import shutil
 import socket
 import struct
 import sys
 import tempfile
 from test.support.script_helper import assert_python_ok, assert_python_failure
 from test import support
+from test.support import os_helper
 from test.support import socket_helper
+from test.support import threading_helper
+from test.support import warnings_helper
 from test.support.logging_helper import TestHandler
 import textwrap
 import threading
@@ -51,13 +55,16 @@
 import warnings
 import weakref
 
-import asyncore
 from http.server import HTTPServer, BaseHTTPRequestHandler
-import smtpd
 from urllib.parse import urlparse, parse_qs
 from socketserver import (ThreadingUDPServer, DatagramRequestHandler,
                           ThreadingTCPServer, StreamRequestHandler)
 
+with warnings.catch_warnings():
+    warnings.simplefilter('ignore', DeprecationWarning)
+    import asyncore
+    import smtpd
+
 try:
     import win32evtlog, win32evtlogutil, pywintypes
 except ImportError:
@@ -79,7 +86,7 @@
     def setUp(self):
         """Setup the default logging stream to an internal StringIO instance,
         so that we can examine log output as we want."""
-        self._threading_key = support.threading_setup()
+        self._threading_key = threading_helper.threading_setup()
 
         logger_dict = logging.getLogger().manager.loggerDict
         logging._acquireLock()
@@ -150,7 +157,7 @@
             logging._releaseLock()
 
         self.doCleanups()
-        support.threading_cleanup(*self._threading_key)
+        threading_helper.threading_cleanup(*self._threading_key)
 
     def assert_log_lines(self, expected_values, stream=None, pat=None):
         """Match the collected log lines against the regular expression
@@ -550,7 +557,7 @@
                 os.close(fd)
                 if not existing:
                     os.unlink(fn)
-                h = logging.handlers.WatchedFileHandler(fn, delay=True)
+                h = logging.handlers.WatchedFileHandler(fn, encoding='utf-8', delay=True)
                 if existing:
                     dev, ino = h.dev, h.ino
                     self.assertEqual(dev, -1)
@@ -613,7 +620,7 @@
         if sys.platform in ('linux', 'darwin'):
             cases += ((logging.handlers.WatchedFileHandler, (pfn, 'w')),)
         for cls, args in cases:
-            h = cls(*args)
+            h = cls(*args, encoding="utf-8")
             self.assertTrue(os.path.exists(fn))
             h.close()
             os.unlink(fn)
@@ -642,7 +649,7 @@
             remover = threading.Thread(target=remove_loop, args=(fn, del_count))
             remover.daemon = True
             remover.start()
-            h = logging.handlers.WatchedFileHandler(fn, delay=delay)
+            h = logging.handlers.WatchedFileHandler(fn, encoding='utf-8', delay=delay)
             f = logging.Formatter('%(asctime)s: %(levelname)s: %(message)s')
             h.setFormatter(f)
             try:
@@ -674,7 +681,7 @@
             def __init__(self):
                 super().__init__()
                 self.sub_handler = logging.StreamHandler(
-                    stream=open('/dev/null', 'wt'))
+                    stream=open('/dev/null', 'wt', encoding='utf-8'))
 
             def emit(self, record):
                 self.sub_handler.acquire()
@@ -826,6 +833,7 @@
         self.port = self.socket.getsockname()[1]
         self._handler = handler
         self._thread = None
+        self._quit = False
         self.poll_interval = poll_interval
 
     def process_message(self, peer, mailfrom, rcpttos, data):
@@ -846,7 +854,7 @@
         """
         self._thread = t = threading.Thread(target=self.serve_forever,
                                             args=(self.poll_interval,))
-        t.setDaemon(True)
+        t.daemon = True
         t.start()
 
     def serve_forever(self, poll_interval):
@@ -857,16 +865,18 @@
                               :func:`select` or :func:`poll` call by
                               :func:`asyncore.loop`.
         """
-        asyncore.loop(poll_interval, map=self._map)
+        while not self._quit:
+            asyncore.loop(poll_interval, map=self._map, count=1)
 
     def stop(self):
         """
         Stop the thread by closing the server instance.
         Wait for the server thread to terminate.
         """
-        self.close()
-        support.join_thread(self._thread)
+        self._quit = True
+        threading_helper.join_thread(self._thread)
         self._thread = None
+        self.close()
         asyncore.close_all(map=self._map, ignore_all=True)
 
 
@@ -882,7 +892,7 @@
                     single parameter - the request - in order to
                     process the request. This handler is called on the
                     server thread, effectively meaning that requests are
-                    processed serially. While not quite Web scale ;-),
+                    processed serially. While not quite web scale ;-),
                     this should be fine for testing applications.
     :param poll_interval: The polling interval in seconds.
     """
@@ -898,7 +908,7 @@
         """
         self._thread = t = threading.Thread(target=self.serve_forever,
                                             args=(self.poll_interval,))
-        t.setDaemon(True)
+        t.daemon = True
         t.start()
 
     def serve_forever(self, poll_interval):
@@ -915,7 +925,7 @@
         """
         self.shutdown()
         if self._thread is not None:
-            support.join_thread(self._thread)
+            threading_helper.join_thread(self._thread)
             self._thread = None
         self.server_close()
         self.ready.clear()
@@ -1181,7 +1191,7 @@
                 self.mem_logger.warning("flushed")
         finally:
             for thread in target.threads:
-                support.join_thread(thread)
+                threading_helper.join_thread(thread)
 
 
 class ExceptionFormatter(logging.Formatter):
@@ -1194,7 +1204,7 @@
 
     """Reading logging config from a .ini-style config file."""
 
-    check_no_resource_warning = support.check_no_resource_warning
+    check_no_resource_warning = warnings_helper.check_no_resource_warning
     expected_log_pat = r"^(\w+) \+\+ (\w+)$"
 
     # config0 is a standard configuration.
@@ -1422,6 +1432,7 @@
     class=FileHandler
     level=DEBUG
     args=("{tempfile}",)
+    kwargs={{"encoding": "utf-8"}}
     """
 
     disable_test = """
@@ -1447,7 +1458,7 @@
 
     def apply_config(self, conf, **kwargs):
         file = io.StringIO(textwrap.dedent(conf))
-        logging.config.fileConfig(file, **kwargs)
+        logging.config.fileConfig(file, encoding="utf-8", **kwargs)
 
     def test_config0_ok(self):
         # A simple config file which overrides the default settings.
@@ -1653,6 +1664,7 @@
             os.close(fd)
             logging.config.fileConfig(
                 fn,
+                encoding="utf-8",
                 defaults=dict(
                     version=1,
                     disable_existing_loggers=False,
@@ -1781,7 +1793,7 @@
 
     def tearDown(self):
         SocketHandlerTest.tearDown(self)
-        support.unlink(self.address)
+        os_helper.unlink(self.address)
 
 class DatagramHandlerTest(BaseTest):
 
@@ -1862,7 +1874,7 @@
 
     def tearDown(self):
         DatagramHandlerTest.tearDown(self)
-        support.unlink(self.address)
+        os_helper.unlink(self.address)
 
 class SysLogHandlerTest(BaseTest):
 
@@ -1946,7 +1958,7 @@
 
     def tearDown(self):
         SysLogHandlerTest.tearDown(self)
-        support.unlink(self.address)
+        os_helper.unlink(self.address)
 
 @unittest.skipUnless(socket_helper.IPV6_ENABLED,
                      'IPv6 support required for this test.')
@@ -2200,7 +2212,7 @@
 
     """Reading logging config from a dictionary."""
 
-    check_no_resource_warning = support.check_no_resource_warning
+    check_no_resource_warning = warnings_helper.check_no_resource_warning
     expected_log_pat = r"^(\w+) \+\+ (\w+)$"
 
     # config0 is a standard configuration.
@@ -3198,7 +3210,8 @@
                 "handlers": {
                     "file": {
                         "class": "logging.FileHandler",
-                        "filename": fn
+                        "filename": fn,
+                        "encoding": "utf-8",
                     }
                 },
                 "root": {
@@ -3238,7 +3251,7 @@
         finally:
             t.ready.wait(2.0)
             logging.config.stopListening()
-            support.join_thread(t)
+            threading_helper.join_thread(t)
 
     def test_listen_config_10_ok(self):
         with support.captured_stdout() as output:
@@ -3722,7 +3735,15 @@
 
 utc = UTC()
 
-class FormatterTest(unittest.TestCase):
+class AssertErrorMessage:
+
+    def assert_error_message(self, exception, message, *args, **kwargs):
+        try:
+            self.assertRaises((), *args, **kwargs)
+        except exception as e:
+            self.assertEqual(message, str(e))
+
+class FormatterTest(unittest.TestCase, AssertErrorMessage):
     def setUp(self):
         self.common = {
             'name': 'formatter.test',
@@ -3735,6 +3756,9 @@
             'args': (2, 'placeholders'),
         }
         self.variants = {
+            'custom': {
+                'custom': 1234
+            }
         }
 
     def get_record(self, name=None):
@@ -3743,12 +3767,6 @@
             result.update(self.variants[name])
         return logging.makeLogRecord(result)
 
-    def assert_error_message(self, exception, message, *args, **kwargs):
-        try:
-            self.assertRaises(exception, *args, **kwargs)
-        except exception as e:
-            self.assertEqual(message, e.message)
-
     def test_percent(self):
         # Test %-formatting
         r = self.get_record()
@@ -3867,7 +3885,7 @@
         # Testing failure for '-' in field name
         self.assert_error_message(
             ValueError,
-            "invalid field name/expression: 'name-thing'",
+            "invalid format: invalid field name/expression: 'name-thing'",
             logging.Formatter, "{name-thing}", style="{"
         )
         # Testing failure for style mismatch
@@ -3890,7 +3908,7 @@
         # Testing failure for invalid spec
         self.assert_error_message(
             ValueError,
-            "bad specifier: '.2ff'",
+            "invalid format: bad specifier: '.2ff'",
             logging.Formatter, '{process:.2ff}', style='{'
         )
         self.assertRaises(ValueError, logging.Formatter, '{process:.2Z}', style='{')
@@ -3900,12 +3918,12 @@
         # Testing failure for mismatch braces
         self.assert_error_message(
             ValueError,
-            "invalid format: unmatched '{' in format spec",
+            "invalid format: expected '}' before end of string",
             logging.Formatter, '{process', style='{'
         )
         self.assert_error_message(
             ValueError,
-            "invalid format: unmatched '{' in format spec",
+            "invalid format: Single '}' encountered in format string",
             logging.Formatter, 'process}', style='{'
         )
         self.assertRaises(ValueError, logging.Formatter, '{{foo!r:4.2}', style='{')
@@ -3951,6 +3969,26 @@
         )
         self.assertRaises(ValueError, logging.Formatter, '${asctime', style='$')
 
+    def test_defaults_parameter(self):
+        fmts = ['%(custom)s %(message)s', '{custom} {message}', '$custom $message']
+        styles = ['%', '{', '$']
+        for fmt, style in zip(fmts, styles):
+            f = logging.Formatter(fmt, style=style, defaults={'custom': 'Default'})
+            r = self.get_record()
+            self.assertEqual(f.format(r), 'Default Message with 2 placeholders')
+            r = self.get_record("custom")
+            self.assertEqual(f.format(r), '1234 Message with 2 placeholders')
+
+            # Without default
+            f = logging.Formatter(fmt, style=style)
+            r = self.get_record()
+            self.assertRaises(ValueError, f.format, r)
+
+            # Non-existing default is ignored
+            f = logging.Formatter(fmt, style=style, defaults={'Non-existing': 'Default'})
+            r = self.get_record("custom")
+            self.assertEqual(f.format(r), '1234 Message with 2 placeholders')
+
     def test_invalid_style(self):
         self.assertRaises(ValueError, logging.Formatter, None, None, 'x')
 
@@ -4191,6 +4229,15 @@
         logging.disable(83)
         self.assertEqual(logging.root.manager.disable, 83)
 
+        self.assertRaises(ValueError, logging.disable, "doesnotexists")
+
+        class _NotAnIntOrString:
+            pass
+
+        self.assertRaises(TypeError, logging.disable, _NotAnIntOrString())
+
+        logging.disable("WARN")
+
         # test the default value introduced in 3.7
         # (Issue #28524)
         logging.disable()
@@ -4282,8 +4329,8 @@
             logging.setLoggerClass(logging.Logger)
 
     def test_logging_at_shutdown(self):
-        # Issue #20037
-        code = """if 1:
+        # bpo-20037: Doing text I/O late at interpreter shutdown must not crash
+        code = textwrap.dedent("""
             import logging
 
             class A:
@@ -4293,22 +4340,55 @@
                     except Exception:
                         logging.exception("exception in __del__")
 
-            a = A()"""
+            a = A()
+        """)
         rc, out, err = assert_python_ok("-c", code)
         err = err.decode()
         self.assertIn("exception in __del__", err)
         self.assertIn("ValueError: some error", err)
 
+    def test_logging_at_shutdown_open(self):
+        # bpo-26789: FileHandler keeps a reference to the builtin open()
+        # function to be able to open or reopen the file during Python
+        # finalization.
+        filename = os_helper.TESTFN
+        self.addCleanup(os_helper.unlink, filename)
+
+        code = textwrap.dedent(f"""
+            import builtins
+            import logging
+
+            class A:
+                def __del__(self):
+                    logging.error("log in __del__")
+
+            # basicConfig() opens the file, but logging.shutdown() closes
+            # it at Python exit. When A.__del__() is called,
+            # FileHandler._open() must be called again to re-open the file.
+            logging.basicConfig(filename={filename!r}, encoding="utf-8")
+
+            a = A()
+
+            # Simulate the Python finalization which removes the builtin
+            # open() function.
+            del builtins.open
+        """)
+        assert_python_ok("-c", code)
+
+        with open(filename, encoding="utf-8") as fp:
+            self.assertEqual(fp.read().rstrip(), "ERROR:root:log in __del__")
+
     def test_recursion_error(self):
         # Issue 36272
-        code = """if 1:
+        code = textwrap.dedent("""
             import logging
 
             def rec():
                 logging.error("foo")
                 rec()
 
-            rec()"""
+            rec()
+        """)
         rc, out, err = assert_python_failure("-c", code)
         err = err.decode()
         self.assertNotIn("Cannot recover from stack overflow.", err)
@@ -4333,15 +4413,66 @@
         r.removeHandler(h)
         h.close()
 
-    def test_multiprocessing(self):
-        r = logging.makeLogRecord({})
-        self.assertEqual(r.processName, 'MainProcess')
+    @staticmethod # pickled as target of child process in the following test
+    def _extract_logrecord_process_name(key, logMultiprocessing, conn=None):
+        prev_logMultiprocessing = logging.logMultiprocessing
+        logging.logMultiprocessing = logMultiprocessing
         try:
             import multiprocessing as mp
+            name = mp.current_process().name
+
+            r1 = logging.makeLogRecord({'msg': f'msg1_{key}'})
+
+            # https://bugs.python.org/issue45128
+            with support.swap_item(sys.modules, 'multiprocessing', None):
+                r2 = logging.makeLogRecord({'msg': f'msg2_{key}'})
+
+            results = {'processName'  : name,
+                       'r1.processName': r1.processName,
+                       'r2.processName': r2.processName,
+                      }
+        finally:
+            logging.logMultiprocessing = prev_logMultiprocessing
+        if conn:
+            conn.send(results)
+        else:
+            return results
+
+    def test_multiprocessing(self):
+        multiprocessing_imported = 'multiprocessing' in sys.modules
+        try:
+            # logMultiprocessing is True by default
+            self.assertEqual(logging.logMultiprocessing, True)
+
+            LOG_MULTI_PROCESSING = True
+            # When logMultiprocessing == True:
+            # In the main process processName = 'MainProcess'
             r = logging.makeLogRecord({})
-            self.assertEqual(r.processName, mp.current_process().name)
-        except ImportError:
-            pass
+            self.assertEqual(r.processName, 'MainProcess')
+
+            results = self._extract_logrecord_process_name(1, LOG_MULTI_PROCESSING)
+            self.assertEqual('MainProcess', results['processName'])
+            self.assertEqual('MainProcess', results['r1.processName'])
+            self.assertEqual('MainProcess', results['r2.processName'])
+
+            # In other processes, processName is correct when multiprocessing in imported,
+            # but it is (incorrectly) defaulted to 'MainProcess' otherwise (bpo-38762).
+            import multiprocessing
+            parent_conn, child_conn = multiprocessing.Pipe()
+            p = multiprocessing.Process(
+                target=self._extract_logrecord_process_name,
+                args=(2, LOG_MULTI_PROCESSING, child_conn,)
+            )
+            p.start()
+            results = parent_conn.recv()
+            self.assertNotEqual('MainProcess', results['processName'])
+            self.assertEqual(results['processName'], results['r1.processName'])
+            self.assertEqual('MainProcess', results['r2.processName'])
+            p.join()
+
+        finally:
+            if multiprocessing_imported:
+                import multiprocessing
 
     def test_optional(self):
         r = logging.makeLogRecord({})
@@ -4437,13 +4568,13 @@
             h2.close()
             os.remove(fn)
 
-        logging.basicConfig(filename='test.log')
+        logging.basicConfig(filename='test.log', encoding='utf-8')
 
         self.assertEqual(len(logging.root.handlers), 1)
         handler = logging.root.handlers[0]
         self.assertIsInstance(handler, logging.FileHandler)
 
-        expected = logging.FileHandler('test.log', 'a')
+        expected = logging.FileHandler('test.log', 'a', encoding='utf-8')
         self.assertEqual(handler.stream.mode, expected.stream.mode)
         self.assertEqual(handler.stream.name, expected.stream.name)
         self.addCleanup(cleanup, handler, expected, 'test.log')
@@ -4796,7 +4927,7 @@
         self.assertIs(self.logger.manager, orig_manager)
 
 
-class LoggerTest(BaseTest):
+class LoggerTest(BaseTest, AssertErrorMessage):
 
     def setUp(self):
         super(LoggerTest, self).setUp()
@@ -4808,7 +4939,12 @@
         self.addCleanup(logging.shutdown)
 
     def test_set_invalid_level(self):
-        self.assertRaises(TypeError, self.logger.setLevel, object())
+        self.assert_error_message(
+            TypeError, 'Level not an integer or a valid string: None',
+            self.logger.setLevel, None)
+        self.assert_error_message(
+            TypeError, 'Level not an integer or a valid string: (0, 0)',
+            self.logger.setLevel, (0, 0))
 
     def test_exception(self):
         msg = 'testing exception: %r'
@@ -5032,11 +5168,14 @@
                         msg="Log file %r does not exist" % filename)
         self.rmfiles.append(filename)
 
+    def next_rec(self):
+        return logging.LogRecord('n', logging.DEBUG, 'p', 1,
+                                 self.next_message(), None, None, None)
 
 class FileHandlerTest(BaseFileTest):
     def test_delay(self):
         os.unlink(self.fn)
-        fh = logging.FileHandler(self.fn, delay=True)
+        fh = logging.FileHandler(self.fn, encoding='utf-8', delay=True)
         self.assertIsNone(fh.stream)
         self.assertFalse(os.path.exists(self.fn))
         fh.handle(logging.makeLogRecord({}))
@@ -5044,26 +5183,41 @@
         self.assertTrue(os.path.exists(self.fn))
         fh.close()
 
-class RotatingFileHandlerTest(BaseFileTest):
-    def next_rec(self):
-        return logging.LogRecord('n', logging.DEBUG, 'p', 1,
-                                 self.next_message(), None, None, None)
+    def test_emit_after_closing_in_write_mode(self):
+        # Issue #42378
+        os.unlink(self.fn)
+        fh = logging.FileHandler(self.fn, encoding='utf-8', mode='w')
+        fh.setFormatter(logging.Formatter('%(message)s'))
+        fh.emit(self.next_rec())    # '1'
+        fh.close()
+        fh.emit(self.next_rec())    # '2'
+        with open(self.fn) as fp:
+            self.assertEqual(fp.read().strip(), '1')
 
+class RotatingFileHandlerTest(BaseFileTest):
     def test_should_not_rollover(self):
         # If maxbytes is zero rollover never occurs
-        rh = logging.handlers.RotatingFileHandler(self.fn, maxBytes=0)
+        rh = logging.handlers.RotatingFileHandler(
+                self.fn, encoding="utf-8", maxBytes=0)
         self.assertFalse(rh.shouldRollover(None))
         rh.close()
+        # bpo-45401 - test with special file
+        # We set maxBytes to 1 so that rollover would normally happen, except
+        # for the check for regular files
+        rh = logging.handlers.RotatingFileHandler(
+                os.devnull, encoding="utf-8", maxBytes=1)
+        self.assertFalse(rh.shouldRollover(self.next_rec()))
+        rh.close()
 
     def test_should_rollover(self):
-        rh = logging.handlers.RotatingFileHandler(self.fn, maxBytes=1)
+        rh = logging.handlers.RotatingFileHandler(self.fn, encoding="utf-8", maxBytes=1)
         self.assertTrue(rh.shouldRollover(self.next_rec()))
         rh.close()
 
     def test_file_created(self):
         # checks that the file is created and assumes it was created
         # by us
-        rh = logging.handlers.RotatingFileHandler(self.fn)
+        rh = logging.handlers.RotatingFileHandler(self.fn, encoding="utf-8")
         rh.emit(self.next_rec())
         self.assertLogFile(self.fn)
         rh.close()
@@ -5072,7 +5226,7 @@
         def namer(name):
             return name + ".test"
         rh = logging.handlers.RotatingFileHandler(
-            self.fn, backupCount=2, maxBytes=1)
+            self.fn, encoding="utf-8", backupCount=2, maxBytes=1)
         rh.namer = namer
         rh.emit(self.next_rec())
         self.assertLogFile(self.fn)
@@ -5090,10 +5244,10 @@
 
             def rotator(self, source, dest):
                 if os.path.exists(source):
-                    os.rename(source, dest + ".rotated")
+                    os.replace(source, dest + ".rotated")
 
         rh = HandlerWithNamerAndRotator(
-            self.fn, backupCount=2, maxBytes=1)
+            self.fn, encoding="utf-8", backupCount=2, maxBytes=1)
         self.assertEqual(rh.namer(self.fn), self.fn + ".test")
         rh.emit(self.next_rec())
         self.assertLogFile(self.fn)
@@ -5116,7 +5270,7 @@
             os.remove(source)
 
         rh = logging.handlers.RotatingFileHandler(
-            self.fn, backupCount=2, maxBytes=1)
+            self.fn, encoding="utf-8", backupCount=2, maxBytes=1)
         rh.rotator = rotator
         rh.namer = namer
         m1 = self.next_rec()
@@ -5148,10 +5302,19 @@
         rh.close()
 
 class TimedRotatingFileHandlerTest(BaseFileTest):
+    def test_should_not_rollover(self):
+        # See bpo-45401. Should only ever rollover regular files
+        fh = logging.handlers.TimedRotatingFileHandler(
+                os.devnull, 'S', encoding="utf-8", backupCount=1)
+        time.sleep(1.1)    # a little over a second ...
+        r = logging.makeLogRecord({'msg': 'testing - device file'})
+        self.assertFalse(fh.shouldRollover(r))
+        fh.close()
+
     # other test methods added below
     def test_rollover(self):
-        fh = logging.handlers.TimedRotatingFileHandler(self.fn, 'S',
-                                                       backupCount=1)
+        fh = logging.handlers.TimedRotatingFileHandler(
+                self.fn, 'S', encoding="utf-8", backupCount=1)
         fmt = logging.Formatter('%(asctime)s %(message)s')
         fh.setFormatter(fmt)
         r1 = logging.makeLogRecord({'msg': 'testing - initial'})
@@ -5194,18 +5357,18 @@
     def test_invalid(self):
         assertRaises = self.assertRaises
         assertRaises(ValueError, logging.handlers.TimedRotatingFileHandler,
-                     self.fn, 'X', delay=True)
+                     self.fn, 'X', encoding="utf-8", delay=True)
         assertRaises(ValueError, logging.handlers.TimedRotatingFileHandler,
-                     self.fn, 'W', delay=True)
+                     self.fn, 'W', encoding="utf-8", delay=True)
         assertRaises(ValueError, logging.handlers.TimedRotatingFileHandler,
-                     self.fn, 'W7', delay=True)
+                     self.fn, 'W7', encoding="utf-8", delay=True)
 
     def test_compute_rollover_daily_attime(self):
         currentTime = 0
         atTime = datetime.time(12, 0, 0)
         rh = logging.handlers.TimedRotatingFileHandler(
-            self.fn, when='MIDNIGHT', interval=1, backupCount=0, utc=True,
-            atTime=atTime)
+            self.fn, encoding="utf-8", when='MIDNIGHT', interval=1, backupCount=0,
+            utc=True, atTime=atTime)
         try:
             actual = rh.computeRollover(currentTime)
             self.assertEqual(actual, currentTime + 12 * 60 * 60)
@@ -5225,8 +5388,8 @@
         wday = time.gmtime(today).tm_wday
         for day in range(7):
             rh = logging.handlers.TimedRotatingFileHandler(
-                self.fn, when='W%d' % day, interval=1, backupCount=0, utc=True,
-                atTime=atTime)
+                self.fn, encoding="utf-8", when='W%d' % day, interval=1, backupCount=0,
+                utc=True, atTime=atTime)
             try:
                 if wday > day:
                     # The rollover day has already passed this week, so we
@@ -5256,6 +5419,54 @@
             finally:
                 rh.close()
 
+    def test_compute_files_to_delete(self):
+        # See bpo-46063 for background
+        wd = tempfile.mkdtemp(prefix='test_logging_')
+        self.addCleanup(shutil.rmtree, wd)
+        times = []
+        dt = datetime.datetime.now()
+        for i in range(10):
+            times.append(dt.strftime('%Y-%m-%d_%H-%M-%S'))
+            dt += datetime.timedelta(seconds=5)
+        prefixes = ('a.b', 'a.b.c', 'd.e', 'd.e.f')
+        files = []
+        rotators = []
+        for prefix in prefixes:
+            p = os.path.join(wd, '%s.log' % prefix)
+            rotator = logging.handlers.TimedRotatingFileHandler(p, when='s',
+                                                                interval=5,
+                                                                backupCount=7,
+                                                                delay=True)
+            rotators.append(rotator)
+            if prefix.startswith('a.b'):
+                for t in times:
+                    files.append('%s.log.%s' % (prefix, t))
+            else:
+                rotator.namer = lambda name: name.replace('.log', '') + '.log'
+                for t in times:
+                    files.append('%s.%s.log' % (prefix, t))
+        # Create empty files
+        for fn in files:
+            p = os.path.join(wd, fn)
+            with open(p, 'wb') as f:
+                pass
+        # Now the checks that only the correct files are offered up for deletion
+        for i, prefix in enumerate(prefixes):
+            rotator = rotators[i]
+            candidates = rotator.getFilesToDelete()
+            self.assertEqual(len(candidates), 3)
+            if prefix.startswith('a.b'):
+                p = '%s.log.' % prefix
+                for c in candidates:
+                    d, fn = os.path.split(c)
+                    self.assertTrue(fn.startswith(p))
+            else:
+                for c in candidates:
+                    d, fn = os.path.split(c)
+                    self.assertTrue(fn.endswith('.log'))
+                    self.assertTrue(fn.startswith(prefix + '.') and
+                                    fn[len(prefix) + 2].isdigit())
+
 
 def secs(**kw):
     return datetime.timedelta(**kw) // datetime.timedelta(seconds=1)
@@ -5270,7 +5481,7 @@
                  ):
     def test_compute_rollover(self, when=when, exp=exp):
         rh = logging.handlers.TimedRotatingFileHandler(
-            self.fn, when=when, interval=1, backupCount=0, utc=True)
+            self.fn, encoding="utf-8", when=when, interval=1, backupCount=0, utc=True)
         currentTime = 0.0
         actual = rh.computeRollover(currentTime)
         if exp != actual:
@@ -5297,8 +5508,8 @@
                     print('currentSecond: %s' % currentSecond, file=sys.stderr)
                     print('r: %s' % r, file=sys.stderr)
                     print('result: %s' % result, file=sys.stderr)
-                except Exception:
-                    print('exception in diagnostic code: %s' % sys.exc_info()[1], file=sys.stderr)
+                except Exception as e:
+                    print('exception in diagnostic code: %s' % e, file=sys.stderr)
         self.assertEqual(exp, actual)
         rh.close()
     setattr(TimedRotatingFileHandlerTest, "test_compute_rollover_%s" % when, test_compute_rollover)
@@ -5342,36 +5553,22 @@
 
 class MiscTestCase(unittest.TestCase):
     def test__all__(self):
-        blacklist = {'logThreads', 'logMultiprocessing',
-                     'logProcesses', 'currentframe',
-                     'PercentStyle', 'StrFormatStyle', 'StringTemplateStyle',
-                     'Filterer', 'PlaceHolder', 'Manager', 'RootLogger',
-                     'root', 'threading'}
-        support.check__all__(self, logging, blacklist=blacklist)
+        not_exported = {
+            'logThreads', 'logMultiprocessing', 'logProcesses', 'currentframe',
+            'PercentStyle', 'StrFormatStyle', 'StringTemplateStyle',
+            'Filterer', 'PlaceHolder', 'Manager', 'RootLogger', 'root',
+            'threading'}
+        support.check__all__(self, logging, not_exported=not_exported)
 
 
 # Set the locale to the platform-dependent default.  I have no idea
 # why the test does this, but in any case we save the current locale
 # first and restore it at the end.
-@support.run_with_locale('LC_ALL', '')
-def test_main():
-    tests = [
-        BuiltinLevelsTest, BasicFilterTest, CustomLevelsAndFiltersTest,
-        HandlerTest, MemoryHandlerTest, ConfigFileTest, SocketHandlerTest,
-        DatagramHandlerTest, MemoryTest, EncodingTest, WarningsTest,
-        ConfigDictTest, ManagerTest, FormatterTest, BufferingFormatterTest,
-        StreamHandlerTest, LogRecordFactoryTest, ChildLoggerTest,
-        QueueHandlerTest, ShutdownTest, ModuleLevelMiscTest, BasicConfigTest,
-        LoggerAdapterTest, LoggerTest, SMTPHandlerTest, FileHandlerTest,
-        RotatingFileHandlerTest,  LastResortTest, LogRecordTest,
-        ExceptionTest, SysLogHandlerTest, IPv6SysLogHandlerTest, HTTPHandlerTest,
-        NTEventLogHandlerTest, TimedRotatingFileHandlerTest,
-        UnixSocketHandlerTest, UnixDatagramHandlerTest, UnixSysLogHandlerTest,
-        MiscTestCase
-    ]
-    if hasattr(logging.handlers, 'QueueListener'):
-        tests.append(QueueListenerTest)
-    support.run_unittest(*tests)
+def setUpModule():
+    cm = support.run_with_locale('LC_ALL', '')
+    cm.__enter__()
+    unittest.addModuleCleanup(cm.__exit__, None, None, None)
+
 
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_long.py b/Lib/test/test_long.py
index 7ce37e8..c97842b 100644
--- a/Lib/test/test_long.py
+++ b/Lib/test/test_long.py
@@ -1016,6 +1016,17 @@
             self.assertEqual((a+1).bit_length(), i+1)
             self.assertEqual((-a-1).bit_length(), i+1)
 
+    def test_bit_count(self):
+        for a in range(-1000, 1000):
+            self.assertEqual(a.bit_count(), bin(a).count("1"))
+
+        for exp in [10, 17, 63, 64, 65, 1009, 70234, 1234567]:
+            a = 2**exp
+            self.assertEqual(a.bit_count(), 1)
+            self.assertEqual((a - 1).bit_count(), exp)
+            self.assertEqual((a ^ 63).bit_count(), 7)
+            self.assertEqual(((a - 1) ^ 510).bit_count(), exp - 8)
+
     def test_round(self):
         # check round-half-even algorithm. For round to nearest ten;
         # rounding map is invariant under adding multiples of 20
diff --git a/Lib/test/test_lzma.py b/Lib/test/test_lzma.py
index 0f3af27..145c8cf 100644
--- a/Lib/test/test_lzma.py
+++ b/Lib/test/test_lzma.py
@@ -1,4 +1,5 @@
 import _compression
+import array
 from io import BytesIO, UnsupportedOperation, DEFAULT_BUFFER_SIZE
 import os
 import pathlib
@@ -8,8 +9,10 @@
 from test import support
 import unittest
 
-from test.support import (
-    _4G, TESTFN, import_module, bigmemtest, run_unittest, unlink
+from test.support import _4G, bigmemtest
+from test.support.import_helper import import_module
+from test.support.os_helper import (
+    TESTFN, unlink
 )
 
 lzma = import_module("lzma")
@@ -1227,6 +1230,14 @@
         self.assertTrue(d2.eof)
         self.assertEqual(out1 + out2, entire)
 
+    def test_issue44439(self):
+        q = array.array('Q', [1, 2, 3, 4, 5])
+        LENGTH = len(q) * q.itemsize
+
+        with LZMAFile(BytesIO(), 'w') as f:
+            self.assertEqual(f.write(q), LENGTH)
+            self.assertEqual(f.tell(), LENGTH)
+
 
 class OpenTestCase(unittest.TestCase):
 
@@ -1246,14 +1257,14 @@
     def test_text_modes(self):
         uncompressed = INPUT.decode("ascii")
         uncompressed_raw = uncompressed.replace("\n", os.linesep)
-        with lzma.open(BytesIO(COMPRESSED_XZ), "rt") as f:
+        with lzma.open(BytesIO(COMPRESSED_XZ), "rt", encoding="ascii") as f:
             self.assertEqual(f.read(), uncompressed)
         with BytesIO() as bio:
-            with lzma.open(bio, "wt") as f:
+            with lzma.open(bio, "wt", encoding="ascii") as f:
                 f.write(uncompressed)
             file_data = lzma.decompress(bio.getvalue()).decode("ascii")
             self.assertEqual(file_data, uncompressed_raw)
-            with lzma.open(bio, "at") as f:
+            with lzma.open(bio, "at", encoding="ascii") as f:
                 f.write(uncompressed)
             file_data = lzma.decompress(bio.getvalue()).decode("ascii")
             self.assertEqual(file_data, uncompressed_raw * 2)
@@ -1330,17 +1341,18 @@
         # Test with explicit newline (universal newline mode disabled).
         text = INPUT.decode("ascii")
         with BytesIO() as bio:
-            with lzma.open(bio, "wt", newline="\n") as f:
+            with lzma.open(bio, "wt", encoding="ascii", newline="\n") as f:
                 f.write(text)
             bio.seek(0)
-            with lzma.open(bio, "rt", newline="\r") as f:
+            with lzma.open(bio, "rt", encoding="ascii", newline="\r") as f:
                 self.assertEqual(f.readlines(), [text])
 
     def test_x_mode(self):
         self.addCleanup(unlink, TESTFN)
         for mode in ("x", "xb", "xt"):
             unlink(TESTFN)
-            with lzma.open(TESTFN, mode):
+            encoding = "ascii" if "t" in mode else None
+            with lzma.open(TESTFN, mode, encoding=encoding):
                 pass
             with self.assertRaises(FileExistsError):
                 with lzma.open(TESTFN, mode):
@@ -1927,14 +1939,5 @@
 )
 
 
-def test_main():
-    run_unittest(
-        CompressorDecompressorTestCase,
-        CompressDecompressFunctionTestCase,
-        FileTestCase,
-        OpenTestCase,
-        MiscellaneousTestCase,
-    )
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_mailbox.py b/Lib/test/test_mailbox.py
index 6f891d4..604fc45 100644
--- a/Lib/test/test_mailbox.py
+++ b/Lib/test/test_mailbox.py
@@ -9,6 +9,7 @@
 import io
 import tempfile
 from test import support
+from test.support import os_helper
 import unittest
 import textwrap
 import mailbox
@@ -38,9 +39,9 @@
     def _delete_recursively(self, target):
         # Delete a file or delete a directory recursively
         if os.path.isdir(target):
-            support.rmtree(target)
+            os_helper.rmtree(target)
         elif os.path.exists(target):
-            support.unlink(target)
+            os_helper.unlink(target)
 
 
 class TestMailbox(TestBase):
@@ -51,7 +52,7 @@
     _template = 'From: foo\n\n%s\n'
 
     def setUp(self):
-        self._path = support.TESTFN
+        self._path = os_helper.TESTFN
         self._delete_recursively(self._path)
         self._box = self._factory(self._path)
 
@@ -76,7 +77,7 @@
         self.assertEqual(len(self._box), 6)
         with self.assertWarns(DeprecationWarning):
             keys.append(self._box.add(
-                io.TextIOWrapper(io.BytesIO(_bytes_sample_message))))
+                io.TextIOWrapper(io.BytesIO(_bytes_sample_message), encoding="utf-8")))
         self.assertEqual(len(self._box), 7)
         self.assertEqual(self._box.get_string(keys[0]), self._template % 0)
         for i in (1, 2, 3, 4, 5, 6):
@@ -159,7 +160,7 @@
             self._non_latin_bin_msg.split(b'\n'))
 
     def test_add_text_file_warns(self):
-        with tempfile.TemporaryFile('w+') as f:
+        with tempfile.TemporaryFile('w+', encoding='utf-8') as f:
             f.write(_sample_message)
             f.seek(0)
             with self.assertWarns(DeprecationWarning):
@@ -723,9 +724,9 @@
         # Remove old files from 'tmp'
         foo_path = os.path.join(self._path, 'tmp', 'foo')
         bar_path = os.path.join(self._path, 'tmp', 'bar')
-        with open(foo_path, 'w') as f:
+        with open(foo_path, 'w', encoding='utf-8') as f:
             f.write("@")
-        with open(bar_path, 'w') as f:
+        with open(bar_path, 'w', encoding='utf-8') as f:
             f.write("@")
         self._box.clean()
         self.assertTrue(os.path.exists(foo_path))
@@ -926,7 +927,7 @@
         # the mtime and should cause a re-read. Note that "sleep
         # emulation" is still in effect, as skewfactor is -3.
         filename = os.path.join(self._path, 'cur', 'stray-file')
-        support.create_empty_file(filename)
+        os_helper.create_empty_file(filename)
         os.unlink(filename)
         self._box._refresh()
         self.assertTrue(refreshed())
@@ -980,10 +981,10 @@
         self._box.close()
         self._delete_recursively(self._path)
         for lock_remnant in glob.glob(glob.escape(self._path) + '.*'):
-            support.unlink(lock_remnant)
+            os_helper.unlink(lock_remnant)
 
     def assertMailboxEmpty(self):
-        with open(self._path) as f:
+        with open(self._path, 'rb') as f:
             self.assertEqual(f.readlines(), [])
 
     def test_get_bytes_from(self):
@@ -1149,12 +1150,12 @@
     def test_message_separator(self):
         # Check there's always a single blank line after each message
         self._box.add('From: foo\n\n0')  # No newline at the end
-        with open(self._path) as f:
+        with open(self._path, encoding='utf-8') as f:
             data = f.read()
             self.assertEqual(data[-3:], '0\n\n')
 
         self._box.add('From: foo\n\n0\n')  # Newline at the end
-        with open(self._path) as f:
+        with open(self._path, encoding='utf-8') as f:
             data = f.read()
             self.assertEqual(data[-3:], '0\n\n')
 
@@ -1304,7 +1305,7 @@
     _factory = lambda self, path, factory=None: mailbox.Babyl(path, factory)
 
     def assertMailboxEmpty(self):
-        with open(self._path) as f:
+        with open(self._path, 'rb') as f:
             self.assertEqual(f.readlines(), [])
 
     def tearDown(self):
@@ -1312,7 +1313,7 @@
         self._box.close()
         self._delete_recursively(self._path)
         for lock_remnant in glob.glob(glob.escape(self._path) + '.*'):
-            support.unlink(lock_remnant)
+            os_helper.unlink(lock_remnant)
 
     def test_labels(self):
         # Get labels from the mailbox
@@ -1369,7 +1370,7 @@
     _factory = mailbox.Message      # Overridden by subclasses to reuse tests
 
     def setUp(self):
-        self._path = support.TESTFN
+        self._path = os_helper.TESTFN
 
     def tearDown(self):
         self._delete_recursively(self._path)
@@ -1389,7 +1390,7 @@
 
     def test_initialize_with_file(self):
         # Initialize based on contents of file
-        with open(self._path, 'w+') as f:
+        with open(self._path, 'w+', encoding='utf-8') as f:
             f.write(_sample_message)
             f.seek(0)
             msg = self._factory(f)
@@ -2019,7 +2020,7 @@
 class TestProxyFile(TestProxyFileBase, unittest.TestCase):
 
     def setUp(self):
-        self._path = support.TESTFN
+        self._path = os_helper.TESTFN
         self._file = open(self._path, 'wb+')
 
     def tearDown(self):
@@ -2068,7 +2069,7 @@
 class TestPartialFile(TestProxyFileBase, unittest.TestCase):
 
     def setUp(self):
-        self._path = support.TESTFN
+        self._path = os_helper.TESTFN
         self._file = open(self._path, 'wb+')
 
     def tearDown(self):
@@ -2131,11 +2132,11 @@
 
     def setUp(self):
         # create a new maildir mailbox to work with:
-        self._dir = support.TESTFN
+        self._dir = os_helper.TESTFN
         if os.path.isdir(self._dir):
-            support.rmtree(self._dir)
+            os_helper.rmtree(self._dir)
         elif os.path.isfile(self._dir):
-            support.unlink(self._dir)
+            os_helper.unlink(self._dir)
         os.mkdir(self._dir)
         os.mkdir(os.path.join(self._dir, "cur"))
         os.mkdir(os.path.join(self._dir, "tmp"))
@@ -2145,10 +2146,10 @@
 
     def tearDown(self):
         list(map(os.unlink, self._msgfiles))
-        support.rmdir(os.path.join(self._dir, "cur"))
-        support.rmdir(os.path.join(self._dir, "tmp"))
-        support.rmdir(os.path.join(self._dir, "new"))
-        support.rmdir(self._dir)
+        os_helper.rmdir(os.path.join(self._dir, "cur"))
+        os_helper.rmdir(os.path.join(self._dir, "tmp"))
+        os_helper.rmdir(os.path.join(self._dir, "new"))
+        os_helper.rmdir(self._dir)
 
     def createMessage(self, dir, mbox=False):
         t = int(time.time() % 1000000)
@@ -2157,7 +2158,7 @@
         filename = ".".join((str(t), str(pid), "myhostname", "mydomain"))
         tmpname = os.path.join(self._dir, "tmp", filename)
         newname = os.path.join(self._dir, dir, filename)
-        with open(tmpname, "w") as fp:
+        with open(tmpname, "w", encoding="utf-8") as fp:
             self._msgfiles.append(tmpname)
             if mbox:
                 fp.write(FROM_)
@@ -2174,7 +2175,7 @@
         """Test an empty maildir mailbox"""
         # Test for regression on bug #117490:
         # Make sure the boxes attribute actually gets set.
-        self.mbox = mailbox.Maildir(support.TESTFN)
+        self.mbox = mailbox.Maildir(os_helper.TESTFN)
         #self.assertTrue(hasattr(self.mbox, "boxes"))
         #self.assertEqual(len(self.mbox.boxes), 0)
         self.assertIsNone(self.mbox.next())
@@ -2182,7 +2183,7 @@
 
     def test_nonempty_maildir_cur(self):
         self.createMessage("cur")
-        self.mbox = mailbox.Maildir(support.TESTFN)
+        self.mbox = mailbox.Maildir(os_helper.TESTFN)
         #self.assertEqual(len(self.mbox.boxes), 1)
         self.assertIsNotNone(self.mbox.next())
         self.assertIsNone(self.mbox.next())
@@ -2190,7 +2191,7 @@
 
     def test_nonempty_maildir_new(self):
         self.createMessage("new")
-        self.mbox = mailbox.Maildir(support.TESTFN)
+        self.mbox = mailbox.Maildir(os_helper.TESTFN)
         #self.assertEqual(len(self.mbox.boxes), 1)
         self.assertIsNotNone(self.mbox.next())
         self.assertIsNone(self.mbox.next())
@@ -2199,7 +2200,7 @@
     def test_nonempty_maildir_both(self):
         self.createMessage("cur")
         self.createMessage("new")
-        self.mbox = mailbox.Maildir(support.TESTFN)
+        self.mbox = mailbox.Maildir(os_helper.TESTFN)
         #self.assertEqual(len(self.mbox.boxes), 2)
         self.assertIsNotNone(self.mbox.next())
         self.assertIsNotNone(self.mbox.next())
@@ -2295,19 +2296,13 @@
 
 class MiscTestCase(unittest.TestCase):
     def test__all__(self):
-        blacklist = {"linesep", "fcntl"}
-        support.check__all__(self, mailbox, blacklist=blacklist)
+        support.check__all__(self, mailbox,
+                             not_exported={"linesep", "fcntl"})
 
 
-def test_main():
-    tests = (TestMailboxSuperclass, TestMaildir, TestMbox, TestMMDF, TestMH,
-             TestBabyl, TestMessage, TestMaildirMessage, TestMboxMessage,
-             TestMHMessage, TestBabylMessage, TestMMDFMessage,
-             TestMessageConversion, TestProxyFile, TestPartialFile,
-             MaildirTestCase, TestFakeMailBox, MiscTestCase)
-    support.run_unittest(*tests)
+def tearDownModule():
     support.reap_children()
 
 
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_mailcap.py b/Lib/test/test_mailcap.py
index c08423c..ef9cad4 100644
--- a/Lib/test/test_mailcap.py
+++ b/Lib/test/test_mailcap.py
@@ -2,7 +2,9 @@
 import os
 import copy
 import test.support
+from test.support import os_helper
 import unittest
+import sys
 
 # Location of mailcap file
 MAILCAPFILE = test.support.findfile("mailcap.txt")
@@ -74,7 +76,7 @@
         self.assertIsInstance(mcfiles, list)
         for m in mcfiles:
             self.assertIsInstance(m, str)
-        with test.support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             # According to RFC 1524, if MAILCAPS env variable exists, use that
             # and only that.
             if "MAILCAPS" in env:
@@ -136,7 +138,7 @@
         # Test mailcap.getcaps() using mock mailcap file in this dir.
         # Temporarily override any existing system mailcap file by pointing the
         # MAILCAPS environment variable to our mock file.
-        with test.support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env["MAILCAPS"] = MAILCAPFILE
             caps = mailcap.getcaps()
             self.assertDictEqual(caps, MAILCAPDICT)
@@ -213,6 +215,7 @@
         self._run_cases(cases)
 
     @unittest.skipUnless(os.name == "posix", "Requires 'test' command on system")
+    @unittest.skipIf(sys.platform == "vxworks", "'test' command is not supported on VxWorks")
     def test_test(self):
         # findmatch() will automatically check any "test" conditions and skip
         # the entry if the check fails.
diff --git a/Lib/test/test_marshal.py b/Lib/test/test_marshal.py
index ace1593..7bcf8e8 100644
--- a/Lib/test/test_marshal.py
+++ b/Lib/test/test_marshal.py
@@ -1,4 +1,5 @@
 from test import support
+from test.support import os_helper
 import array
 import io
 import marshal
@@ -17,13 +18,13 @@
         new = marshal.loads(marshal.dumps(sample, *extra))
         self.assertEqual(sample, new)
         try:
-            with open(support.TESTFN, "wb") as f:
+            with open(os_helper.TESTFN, "wb") as f:
                 marshal.dump(sample, f, *extra)
-            with open(support.TESTFN, "rb") as f:
+            with open(os_helper.TESTFN, "rb") as f:
                 new = marshal.load(f)
             self.assertEqual(sample, new)
         finally:
-            support.unlink(support.TESTFN)
+            os_helper.unlink(os_helper.TESTFN)
 
 class IntTestCase(unittest.TestCase, HelperMixin):
     def test_ints(self):
@@ -158,13 +159,6 @@
         for constructor in (set, frozenset):
             self.helper(constructor(self.d.keys()))
 
-    @support.cpython_only
-    def test_empty_frozenset_singleton(self):
-        # marshal.loads() must reuse the empty frozenset singleton
-        obj = frozenset()
-        obj2 = marshal.loads(marshal.dumps(obj))
-        self.assertIs(obj2, obj)
-
 
 class BufferTestCase(unittest.TestCase, HelperMixin):
 
@@ -288,20 +282,20 @@
             ilen = len(interleaved)
             positions = []
             try:
-                with open(support.TESTFN, 'wb') as f:
+                with open(os_helper.TESTFN, 'wb') as f:
                     for d in data:
                         marshal.dump(d, f)
                         if ilen:
                             f.write(interleaved)
                         positions.append(f.tell())
-                with open(support.TESTFN, 'rb') as f:
+                with open(os_helper.TESTFN, 'rb') as f:
                     for i, d in enumerate(data):
                         self.assertEqual(d, marshal.load(f))
                         if ilen:
                             f.read(ilen)
                         self.assertEqual(positions[i], f.tell())
             finally:
-                support.unlink(support.TESTFN)
+                os_helper.unlink(os_helper.TESTFN)
 
     def test_loads_reject_unicode_strings(self):
         # Issue #14177: marshal.loads() should not accept unicode strings
@@ -523,81 +517,81 @@
 
     def test_write_long_to_file(self):
         for v in range(marshal.version + 1):
-            _testcapi.pymarshal_write_long_to_file(0x12345678, support.TESTFN, v)
-            with open(support.TESTFN, 'rb') as f:
+            _testcapi.pymarshal_write_long_to_file(0x12345678, os_helper.TESTFN, v)
+            with open(os_helper.TESTFN, 'rb') as f:
                 data = f.read()
-            support.unlink(support.TESTFN)
+            os_helper.unlink(os_helper.TESTFN)
             self.assertEqual(data, b'\x78\x56\x34\x12')
 
     def test_write_object_to_file(self):
         obj = ('\u20ac', b'abc', 123, 45.6, 7+8j, 'long line '*1000)
         for v in range(marshal.version + 1):
-            _testcapi.pymarshal_write_object_to_file(obj, support.TESTFN, v)
-            with open(support.TESTFN, 'rb') as f:
+            _testcapi.pymarshal_write_object_to_file(obj, os_helper.TESTFN, v)
+            with open(os_helper.TESTFN, 'rb') as f:
                 data = f.read()
-            support.unlink(support.TESTFN)
+            os_helper.unlink(os_helper.TESTFN)
             self.assertEqual(marshal.loads(data), obj)
 
     def test_read_short_from_file(self):
-        with open(support.TESTFN, 'wb') as f:
+        with open(os_helper.TESTFN, 'wb') as f:
             f.write(b'\x34\x12xxxx')
-        r, p = _testcapi.pymarshal_read_short_from_file(support.TESTFN)
-        support.unlink(support.TESTFN)
+        r, p = _testcapi.pymarshal_read_short_from_file(os_helper.TESTFN)
+        os_helper.unlink(os_helper.TESTFN)
         self.assertEqual(r, 0x1234)
         self.assertEqual(p, 2)
 
-        with open(support.TESTFN, 'wb') as f:
+        with open(os_helper.TESTFN, 'wb') as f:
             f.write(b'\x12')
         with self.assertRaises(EOFError):
-            _testcapi.pymarshal_read_short_from_file(support.TESTFN)
-        support.unlink(support.TESTFN)
+            _testcapi.pymarshal_read_short_from_file(os_helper.TESTFN)
+        os_helper.unlink(os_helper.TESTFN)
 
     def test_read_long_from_file(self):
-        with open(support.TESTFN, 'wb') as f:
+        with open(os_helper.TESTFN, 'wb') as f:
             f.write(b'\x78\x56\x34\x12xxxx')
-        r, p = _testcapi.pymarshal_read_long_from_file(support.TESTFN)
-        support.unlink(support.TESTFN)
+        r, p = _testcapi.pymarshal_read_long_from_file(os_helper.TESTFN)
+        os_helper.unlink(os_helper.TESTFN)
         self.assertEqual(r, 0x12345678)
         self.assertEqual(p, 4)
 
-        with open(support.TESTFN, 'wb') as f:
+        with open(os_helper.TESTFN, 'wb') as f:
             f.write(b'\x56\x34\x12')
         with self.assertRaises(EOFError):
-            _testcapi.pymarshal_read_long_from_file(support.TESTFN)
-        support.unlink(support.TESTFN)
+            _testcapi.pymarshal_read_long_from_file(os_helper.TESTFN)
+        os_helper.unlink(os_helper.TESTFN)
 
     def test_read_last_object_from_file(self):
         obj = ('\u20ac', b'abc', 123, 45.6, 7+8j)
         for v in range(marshal.version + 1):
             data = marshal.dumps(obj, v)
-            with open(support.TESTFN, 'wb') as f:
+            with open(os_helper.TESTFN, 'wb') as f:
                 f.write(data + b'xxxx')
-            r, p = _testcapi.pymarshal_read_last_object_from_file(support.TESTFN)
-            support.unlink(support.TESTFN)
+            r, p = _testcapi.pymarshal_read_last_object_from_file(os_helper.TESTFN)
+            os_helper.unlink(os_helper.TESTFN)
             self.assertEqual(r, obj)
 
-            with open(support.TESTFN, 'wb') as f:
+            with open(os_helper.TESTFN, 'wb') as f:
                 f.write(data[:1])
             with self.assertRaises(EOFError):
-                _testcapi.pymarshal_read_last_object_from_file(support.TESTFN)
-            support.unlink(support.TESTFN)
+                _testcapi.pymarshal_read_last_object_from_file(os_helper.TESTFN)
+            os_helper.unlink(os_helper.TESTFN)
 
     def test_read_object_from_file(self):
         obj = ('\u20ac', b'abc', 123, 45.6, 7+8j)
         for v in range(marshal.version + 1):
             data = marshal.dumps(obj, v)
-            with open(support.TESTFN, 'wb') as f:
+            with open(os_helper.TESTFN, 'wb') as f:
                 f.write(data + b'xxxx')
-            r, p = _testcapi.pymarshal_read_object_from_file(support.TESTFN)
-            support.unlink(support.TESTFN)
+            r, p = _testcapi.pymarshal_read_object_from_file(os_helper.TESTFN)
+            os_helper.unlink(os_helper.TESTFN)
             self.assertEqual(r, obj)
             self.assertEqual(p, len(data))
 
-            with open(support.TESTFN, 'wb') as f:
+            with open(os_helper.TESTFN, 'wb') as f:
                 f.write(data[:1])
             with self.assertRaises(EOFError):
-                _testcapi.pymarshal_read_object_from_file(support.TESTFN)
-            support.unlink(support.TESTFN)
+                _testcapi.pymarshal_read_object_from_file(os_helper.TESTFN)
+            os_helper.unlink(os_helper.TESTFN)
 
 
 if __name__ == "__main__":
diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py
index 4b848a5..e5f4e2b 100644
--- a/Lib/test/test_math.py
+++ b/Lib/test/test_math.py
@@ -130,7 +130,7 @@
       id fn arg -> expected [flag]*
 
     """
-    with open(fname) as fp:
+    with open(fname, encoding="utf-8") as fp:
         for line in fp:
             # strip comments, and skip blank lines
             if '--' in line:
@@ -153,7 +153,7 @@
     Empty lines or lines starting with -- are ignored
     yields id, fn, arg_real, arg_imag, exp_real, exp_imag
     """
-    with open(fname) as fp:
+    with open(fname, encoding="utf-8") as fp:
         for line in fp:
             # skip comment lines and blank lines
             if line.startswith('--') or not line.strip():
@@ -502,14 +502,10 @@
         self.assertRaises(ValueError, math.factorial, -10**100)
 
     def testFactorialNonIntegers(self):
-        with self.assertWarns(DeprecationWarning):
-            self.assertEqual(math.factorial(5.0), 120)
-        with self.assertWarns(DeprecationWarning):
-            self.assertRaises(ValueError, math.factorial, 5.2)
-        with self.assertWarns(DeprecationWarning):
-            self.assertRaises(ValueError, math.factorial, -1.0)
-        with self.assertWarns(DeprecationWarning):
-            self.assertRaises(ValueError, math.factorial, -1e100)
+        self.assertRaises(TypeError, math.factorial, 5.0)
+        self.assertRaises(TypeError, math.factorial, 5.2)
+        self.assertRaises(TypeError, math.factorial, -1.0)
+        self.assertRaises(TypeError, math.factorial, -1e100)
         self.assertRaises(TypeError, math.factorial, decimal.Decimal('5'))
         self.assertRaises(TypeError, math.factorial, decimal.Decimal('5.2'))
         self.assertRaises(TypeError, math.factorial, "5")
@@ -520,8 +516,7 @@
         # Currently raises OverflowError for inputs that are too large
         # to fit into a C long.
         self.assertRaises(OverflowError, math.factorial, 10**100)
-        with self.assertWarns(DeprecationWarning):
-            self.assertRaises(OverflowError, math.factorial, 1e100)
+        self.assertRaises(TypeError, math.factorial, 1e100)
 
     def testFloor(self):
         self.assertRaises(TypeError, math.floor)
@@ -800,13 +795,77 @@
         # Verify scaling for extremely large values
         fourthmax = FLOAT_MAX / 4.0
         for n in range(32):
-            self.assertEqual(hypot(*([fourthmax]*n)), fourthmax * math.sqrt(n))
+            self.assertTrue(math.isclose(hypot(*([fourthmax]*n)),
+                                         fourthmax * math.sqrt(n)))
 
         # Verify scaling for extremely small values
         for exp in range(32):
             scale = FLOAT_MIN / 2.0 ** exp
             self.assertEqual(math.hypot(4*scale, 3*scale), 5*scale)
 
+    @requires_IEEE_754
+    @unittest.skipIf(HAVE_DOUBLE_ROUNDING,
+                     "hypot() loses accuracy on machines with double rounding")
+    def testHypotAccuracy(self):
+        # Verify improved accuracy in cases that were known to be inaccurate.
+        #
+        # The new algorithm's accuracy depends on IEEE 754 arithmetic
+        # guarantees, on having the usual ROUND HALF EVEN rounding mode, on
+        # the system not having double rounding due to extended precision,
+        # and on the compiler maintaining the specified order of operations.
+        #
+        # This test is known to succeed on most of our builds.  If it fails
+        # some build, we either need to add another skipIf if the cause is
+        # identifiable; otherwise, we can remove this test entirely.
+
+        hypot = math.hypot
+        Decimal = decimal.Decimal
+        high_precision = decimal.Context(prec=500)
+
+        for hx, hy in [
+            # Cases with a 1 ulp error in Python 3.7 compiled with Clang
+            ('0x1.10e89518dca48p+29', '0x1.1970f7565b7efp+30'),
+            ('0x1.10106eb4b44a2p+29', '0x1.ef0596cdc97f8p+29'),
+            ('0x1.459c058e20bb7p+30', '0x1.993ca009b9178p+29'),
+            ('0x1.378371ae67c0cp+30', '0x1.fbe6619854b4cp+29'),
+            ('0x1.f4cd0574fb97ap+29', '0x1.50fe31669340ep+30'),
+            ('0x1.494b2cdd3d446p+29', '0x1.212a5367b4c7cp+29'),
+            ('0x1.f84e649f1e46dp+29', '0x1.1fa56bef8eec4p+30'),
+            ('0x1.2e817edd3d6fap+30', '0x1.eb0814f1e9602p+29'),
+            ('0x1.0d3a6e3d04245p+29', '0x1.32a62fea52352p+30'),
+            ('0x1.888e19611bfc5p+29', '0x1.52b8e70b24353p+29'),
+
+            # Cases with 2 ulp error in Python 3.8
+            ('0x1.538816d48a13fp+29', '0x1.7967c5ca43e16p+29'),
+            ('0x1.57b47b7234530p+29', '0x1.74e2c7040e772p+29'),
+            ('0x1.821b685e9b168p+30', '0x1.677dc1c1e3dc6p+29'),
+            ('0x1.9e8247f67097bp+29', '0x1.24bd2dc4f4baep+29'),
+            ('0x1.b73b59e0cb5f9p+29', '0x1.da899ab784a97p+28'),
+            ('0x1.94a8d2842a7cfp+30', '0x1.326a51d4d8d8ap+30'),
+            ('0x1.e930b9cd99035p+29', '0x1.5a1030e18dff9p+30'),
+            ('0x1.1592bbb0e4690p+29', '0x1.a9c337b33fb9ap+29'),
+            ('0x1.1243a50751fd4p+29', '0x1.a5a10175622d9p+29'),
+            ('0x1.57a8596e74722p+30', '0x1.42d1af9d04da9p+30'),
+
+            # Cases with 1 ulp error in version fff3c28052e6b0
+            ('0x1.ee7dbd9565899p+29', '0x1.7ab4d6fc6e4b4p+29'),
+            ('0x1.5c6bfbec5c4dcp+30', '0x1.02511184b4970p+30'),
+            ('0x1.59dcebba995cap+30', '0x1.50ca7e7c38854p+29'),
+            ('0x1.768cdd94cf5aap+29', '0x1.9cfdc5571d38ep+29'),
+            ('0x1.dcf137d60262ep+29', '0x1.1101621990b3ep+30'),
+            ('0x1.3a2d006e288b0p+30', '0x1.e9a240914326cp+29'),
+            ('0x1.62a32f7f53c61p+29', '0x1.47eb6cd72684fp+29'),
+            ('0x1.d3bcb60748ef2p+29', '0x1.3f13c4056312cp+30'),
+            ('0x1.282bdb82f17f3p+30', '0x1.640ba4c4eed3ap+30'),
+            ('0x1.89d8c423ea0c6p+29', '0x1.d35dcfe902bc3p+29'),
+        ]:
+            x = float.fromhex(hx)
+            y = float.fromhex(hy)
+            with self.subTest(hx=hx, hy=hy, x=x, y=y):
+                with decimal.localcontext(high_precision):
+                    z = float((Decimal(x)**2 + Decimal(y)**2).sqrt())
+                self.assertEqual(hypot(x, y), z)
+
     def testDist(self):
         from decimal import Decimal as D
         from fractions import Fraction as F
@@ -909,8 +968,8 @@
         for n in range(32):
             p = (fourthmax,) * n
             q = (0.0,) * n
-            self.assertEqual(dist(p, q), fourthmax * math.sqrt(n))
-            self.assertEqual(dist(q, p), fourthmax * math.sqrt(n))
+            self.assertTrue(math.isclose(dist(p, q), fourthmax * math.sqrt(n)))
+            self.assertTrue(math.isclose(dist(q, p), fourthmax * math.sqrt(n)))
 
         # Verify scaling for extremely small values
         for exp in range(32):
@@ -1724,16 +1783,22 @@
         self.assertRaises(TypeError, prod)
         self.assertRaises(TypeError, prod, 42)
         self.assertRaises(TypeError, prod, ['a', 'b', 'c'])
-        self.assertRaises(TypeError, prod, ['a', 'b', 'c'], '')
-        self.assertRaises(TypeError, prod, [b'a', b'c'], b'')
+        self.assertRaises(TypeError, prod, ['a', 'b', 'c'], start='')
+        self.assertRaises(TypeError, prod, [b'a', b'c'], start=b'')
         values = [bytearray(b'a'), bytearray(b'b')]
-        self.assertRaises(TypeError, prod, values, bytearray(b''))
+        self.assertRaises(TypeError, prod, values, start=bytearray(b''))
         self.assertRaises(TypeError, prod, [[1], [2], [3]])
         self.assertRaises(TypeError, prod, [{2:3}])
-        self.assertRaises(TypeError, prod, [{2:3}]*2, {2:3})
-        self.assertRaises(TypeError, prod, [[1], [2], [3]], [])
+        self.assertRaises(TypeError, prod, [{2:3}]*2, start={2:3})
+        self.assertRaises(TypeError, prod, [[1], [2], [3]], start=[])
+
+        # Some odd cases
+        self.assertEqual(prod([2, 3], start='ab'), 'abababababab')
+        self.assertEqual(prod([2, 3], start=[1, 2]), [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2])
+        self.assertEqual(prod([], start={2: 3}), {2:3})
+
         with self.assertRaises(TypeError):
-            prod([10, 20], [30, 40])     # start is a keyword-only argument
+            prod([10, 20], 1)     # start is a keyword-only argument
 
         self.assertEqual(prod([0, 1, 2, 3]), 0)
         self.assertEqual(prod([1, 0, 2, 3]), 0)
diff --git a/Lib/test/test_memoryview.py b/Lib/test/test_memoryview.py
index ca307d8..d7e3f0c 100644
--- a/Lib/test/test_memoryview.py
+++ b/Lib/test/test_memoryview.py
@@ -14,6 +14,8 @@
 import copy
 import pickle
 
+from test.support import import_helper
+
 
 class AbstractMemoryTests:
     source_bytes = b"abcdef"
@@ -508,7 +510,7 @@
 class OtherTest(unittest.TestCase):
     def test_ctypes_cast(self):
         # Issue 15944: Allow all source formats when casting to bytes.
-        ctypes = test.support.import_module("ctypes")
+        ctypes = import_helper.import_module("ctypes")
         p6 = bytes(ctypes.c_double(0.6))
 
         d = ctypes.c_double()
diff --git a/Lib/test/test_mimetypes.py b/Lib/test/test_mimetypes.py
index 683d393..f31ea46 100644
--- a/Lib/test/test_mimetypes.py
+++ b/Lib/test/test_mimetypes.py
@@ -3,11 +3,17 @@
 import mimetypes
 import pathlib
 import sys
-import unittest
+import unittest.mock
 
 from test import support
+from test.support import os_helper
 from platform import win32_edition
 
+try:
+    import _winapi
+except ImportError:
+    _winapi = None
+
 
 def setUpModule():
     global knownfiles
@@ -27,6 +33,13 @@
 class MimeTypesTestCase(unittest.TestCase):
     def setUp(self):
         self.db = mimetypes.MimeTypes()
+        
+    def test_case_sensitivity(self):
+        eq = self.assertEqual
+        eq(self.db.guess_type("foobar.HTML"), self.db.guess_type("foobar.html"))
+        eq(self.db.guess_type("foobar.TGZ"), self.db.guess_type("foobar.tgz"))
+        eq(self.db.guess_type("foobar.tar.Z"), ("application/x-tar", "compress"))
+        eq(self.db.guess_type("foobar.tar.z"), (None, None))
 
     def test_default_data(self):
         eq = self.assertEqual
@@ -60,24 +73,24 @@
         # Unreadable file returns None
         self.assertIsNone(mimetypes.read_mime_types("non-existent"))
 
-        with support.temp_dir() as directory:
+        with os_helper.temp_dir() as directory:
             data = "x-application/x-unittest pyunit\n"
             file = pathlib.Path(directory, "sample.mimetype")
-            file.write_text(data)
+            file.write_text(data, encoding="utf-8")
             mime_dict = mimetypes.read_mime_types(file)
             eq(mime_dict[".pyunit"], "x-application/x-unittest")
 
         # bpo-41048: read_mime_types should read the rule file with 'utf-8' encoding.
         # Not with locale encoding. _bootlocale has been imported because io.open(...)
         # uses it.
-        with support.temp_dir() as directory:
-            data = "application/no-mans-land  Fran\u00E7ais"
-            file = pathlib.Path(directory, "sample.mimetype")
-            file.write_text(data, encoding='utf-8')
-            import _bootlocale
-            with support.swap_attr(_bootlocale, 'getpreferredencoding', lambda do_setlocale=True: 'ASCII'):
-                mime_dict = mimetypes.read_mime_types(file)
-            eq(mime_dict[".Français"], "application/no-mans-land")
+        data = "application/no-mans-land  Fran\u00E7ais"
+        filename = "filename"
+        fp = io.StringIO(data)
+        with unittest.mock.patch.object(mimetypes, 'open',
+                                        return_value=fp) as mock_open:
+            mime_dict = mimetypes.read_mime_types(filename)
+            mock_open.assert_called_with(filename, encoding='utf-8')
+        eq(mime_dict[".Français"], "application/no-mans-land")
 
     def test_non_standard_types(self):
         eq = self.assertEqual
@@ -107,20 +120,29 @@
         eq(self.db.guess_type(r" \"\`;b&b&c |.tar.gz"), gzip_expected)
 
     def test_guess_all_types(self):
-        eq = self.assertEqual
-        unless = self.assertTrue
         # First try strict.  Use a set here for testing the results because if
         # test_urllib2 is run before test_mimetypes, global state is modified
         # such that the 'all' set will have more items in it.
-        all = set(self.db.guess_all_extensions('text/plain', strict=True))
-        unless(all >= set(['.bat', '.c', '.h', '.ksh', '.pl', '.txt']))
+        all = self.db.guess_all_extensions('text/plain', strict=True)
+        self.assertTrue(set(all) >= {'.bat', '.c', '.h', '.ksh', '.pl', '.txt'})
+        self.assertEqual(len(set(all)), len(all))  # no duplicates
         # And now non-strict
         all = self.db.guess_all_extensions('image/jpg', strict=False)
-        all.sort()
-        eq(all, ['.jpg'])
+        self.assertEqual(all, ['.jpg'])
         # And now for no hits
         all = self.db.guess_all_extensions('image/jpg', strict=True)
-        eq(all, [])
+        self.assertEqual(all, [])
+        # And now for type existing in both strict and non-strict mappings.
+        self.db.add_type('test-type', '.strict-ext')
+        self.db.add_type('test-type', '.non-strict-ext', strict=False)
+        all = self.db.guess_all_extensions('test-type', strict=False)
+        self.assertEqual(all, ['.strict-ext', '.non-strict-ext'])
+        all = self.db.guess_all_extensions('test-type')
+        self.assertEqual(all, ['.strict-ext'])
+        # Test that changing the result list does not affect the global state
+        all.append('.no-such-ext')
+        all = self.db.guess_all_extensions('test-type')
+        self.assertNotIn('.no-such-ext', all)
 
     def test_encoding(self):
         getpreferredencoding = locale.getpreferredencoding
@@ -234,6 +256,21 @@
         eq(self.db.guess_type("image.jpg"), ("image/jpeg", None))
         eq(self.db.guess_type("image.png"), ("image/png", None))
 
+    @unittest.skipIf(not hasattr(_winapi, "_mimetypes_read_windows_registry"),
+                     "read_windows_registry accelerator unavailable")
+    def test_registry_accelerator(self):
+        from_accel = {}
+        from_reg = {}
+        _winapi._mimetypes_read_windows_registry(
+            lambda v, k: from_accel.setdefault(k, set()).add(v)
+        )
+        mimetypes.MimeTypes._read_windows_registry(
+            lambda v, k: from_reg.setdefault(k, set()).add(v)
+        )
+        self.assertEqual(list(from_reg), list(from_accel))
+        for k in from_reg:
+            self.assertEqual(from_reg[k], from_accel[k])
+
 
 class MiscTestCase(unittest.TestCase):
     def test__all__(self):
@@ -287,6 +324,5 @@
         type_info = self.mimetypes_cmd("foo.pic")
         eq(type_info, "I don't know anything about type foo.pic")
 
-
 if __name__ == "__main__":
     unittest.main()
diff --git a/Lib/test/test_minidom.py b/Lib/test/test_minidom.py
index 1663b1f..9762025 100644
--- a/Lib/test/test_minidom.py
+++ b/Lib/test/test_minidom.py
@@ -6,10 +6,12 @@
 from test import support
 import unittest
 
+import pyexpat
 import xml.dom.minidom
 
 from xml.dom.minidom import parse, Node, Document, parseString
 from xml.dom.minidom import getDOMImplementation
+from xml.parsers.expat import ExpatError
 
 
 tstfile = support.findfile("test.xml", subdir="xmltestdata")
@@ -1147,7 +1149,13 @@
 
         # Verify that character decoding errors raise exceptions instead
         # of crashing
-        self.assertRaises(UnicodeDecodeError, parseString,
+        if pyexpat.version_info >= (2, 4, 5):
+            self.assertRaises(ExpatError, parseString,
+                    b'<fran\xe7ais></fran\xe7ais>')
+            self.assertRaises(ExpatError, parseString,
+                    b'<franais>Comment \xe7a va ? Tr\xe8s bien ?</franais>')
+        else:
+            self.assertRaises(UnicodeDecodeError, parseString,
                 b'<fran\xe7ais>Comment \xe7a va ? Tr\xe8s bien ?</fran\xe7ais>')
 
         doc.unlink()
@@ -1609,7 +1617,12 @@
         self.confirm(doc2.namespaceURI == xml.dom.EMPTY_NAMESPACE)
 
     def testExceptionOnSpacesInXMLNSValue(self):
-        with self.assertRaisesRegex(ValueError, 'Unsupported syntax'):
+        if pyexpat.version_info >= (2, 4, 5):
+            context = self.assertRaisesRegex(ExpatError, 'syntax error')
+        else:
+            context = self.assertRaisesRegex(ValueError, 'Unsupported syntax')
+
+        with context:
             parseString('<element xmlns:abc="http:abc.com/de f g/hi/j k"><abc:foo /></element>')
 
     def testDocRemoveChild(self):
diff --git a/Lib/test/test_mmap.py b/Lib/test/test_mmap.py
index 5400f25..8f34c18 100644
--- a/Lib/test/test_mmap.py
+++ b/Lib/test/test_mmap.py
@@ -1,5 +1,6 @@
-from test.support import (TESTFN, import_module, unlink,
-                          requires, _2G, _4G, gc_collect, cpython_only)
+from test.support import (requires, _2G, _4G, gc_collect, cpython_only)
+from test.support.import_helper import import_module
+from test.support.os_helper import TESTFN, unlink
 import unittest
 import os
 import re
diff --git a/Lib/test/test_module.py b/Lib/test/test_module.py
index 1d44563..65319d5 100644
--- a/Lib/test/test_module.py
+++ b/Lib/test/test_module.py
@@ -2,6 +2,7 @@
 import unittest
 import weakref
 from test.support import gc_collect
+from test.support import import_helper
 from test.support.script_helper import assert_python_ok
 
 import sys
@@ -22,7 +23,7 @@
         # and __doc__ is None
         foo = ModuleType.__new__(ModuleType)
         self.assertTrue(foo.__dict__ is None)
-        self.assertRaises(SystemError, dir, foo)
+        self.assertRaises(TypeError, dir, foo)
         try:
             s = foo.__name__
             self.fail("__name__ = %s" % repr(s))
@@ -286,6 +287,60 @@
             melon = Descr()
         self.assertRaises(RuntimeError, getattr, M("mymod"), "melon")
 
+    def test_lazy_create_annotations(self):
+        # module objects lazy create their __annotations__ dict on demand.
+        # the annotations dict is stored in module.__dict__.
+        # a freshly created module shouldn't have an annotations dict yet.
+        foo = ModuleType("foo")
+        for i in range(4):
+            self.assertFalse("__annotations__" in foo.__dict__)
+            d = foo.__annotations__
+            self.assertTrue("__annotations__" in foo.__dict__)
+            self.assertEqual(foo.__annotations__, d)
+            self.assertEqual(foo.__dict__['__annotations__'], d)
+            if i % 2:
+                del foo.__annotations__
+            else:
+                del foo.__dict__['__annotations__']
+
+    def test_setting_annotations(self):
+        foo = ModuleType("foo")
+        for i in range(4):
+            self.assertFalse("__annotations__" in foo.__dict__)
+            d = {'a': int}
+            foo.__annotations__ = d
+            self.assertTrue("__annotations__" in foo.__dict__)
+            self.assertEqual(foo.__annotations__, d)
+            self.assertEqual(foo.__dict__['__annotations__'], d)
+            if i % 2:
+                del foo.__annotations__
+            else:
+                del foo.__dict__['__annotations__']
+
+    def test_annotations_getset_raises(self):
+        # module has no dict, all operations fail
+        foo = ModuleType.__new__(ModuleType)
+        with self.assertRaises(TypeError):
+            print(foo.__annotations__)
+        with self.assertRaises(TypeError):
+            foo.__annotations__ = {}
+        with self.assertRaises(TypeError):
+            del foo.__annotations__
+
+        # double delete
+        foo = ModuleType("foo")
+        foo.__annotations__ = {}
+        del foo.__annotations__
+        with self.assertRaises(AttributeError):
+            del foo.__annotations__
+
+    def test_annotations_are_created_correctly(self):
+        ann_module4 = import_helper.import_fresh_module('test.ann_module4')
+        self.assertTrue("__annotations__" in ann_module4.__dict__)
+        del ann_module4.__annotations__
+        self.assertFalse("__annotations__" in ann_module4.__dict__)
+
+
     # frozen and namespace module reprs are tested in importlib.
 
 
diff --git a/Lib/test/test_msilib.py b/Lib/test/test_msilib.py
index 4a233c3..e29cd4a 100644
--- a/Lib/test/test_msilib.py
+++ b/Lib/test/test_msilib.py
@@ -1,7 +1,8 @@
 """ Test suite for the code in msilib """
 import os
 import unittest
-from test.support import TESTFN, import_module, unlink
+from test.support.import_helper import import_module
+from test.support.os_helper import TESTFN, unlink
 msilib = import_module('msilib')
 import msilib.schema
 
@@ -112,6 +113,16 @@
         with self.assertRaises(msilib.MSIError):
             si.GetProperty(-1)
 
+    def test_FCICreate(self):
+        filepath = TESTFN + '.txt'
+        cabpath = TESTFN + '.cab'
+        self.addCleanup(unlink, filepath)
+        with open(filepath, 'wb'):
+            pass
+        self.addCleanup(unlink, cabpath)
+        msilib.FCICreate(cabpath, [(filepath, 'test.txt')])
+        self.assertTrue(os.path.isfile(cabpath))
+
 
 class Test_make_id(unittest.TestCase):
     #http://msdn.microsoft.com/en-us/library/aa369212(v=vs.85).aspx
diff --git a/Lib/test/test_multibytecodec.py b/Lib/test/test_multibytecodec.py
index 3cf5d7b..cf8bb5e 100644
--- a/Lib/test/test_multibytecodec.py
+++ b/Lib/test/test_multibytecodec.py
@@ -3,10 +3,15 @@
 #   Unit test for multibytecodec itself
 #
 
-from test import support
-from test.support import TESTFN
-import unittest, io, codecs, sys
 import _multibytecodec
+import codecs
+import io
+import sys
+import textwrap
+import unittest
+from test import support
+from test.support import os_helper
+from test.support.os_helper import TESTFN
 
 ALL_CJKENCODINGS = [
 # _codecs_cn
@@ -57,7 +62,7 @@
                 code = '# coding: {}\n'.format(enc)
                 exec(code)
         finally:
-            support.unlink(TESTFN)
+            os_helper.unlink(TESTFN)
 
     def test_init_segfault(self):
         # bug #3305: this used to segfault
@@ -204,6 +209,24 @@
         self.assertEqual(encoder.encode('\xff'), b'\\xff')
         self.assertEqual(encoder.encode('\n'), b'\n')
 
+    @support.cpython_only
+    def test_subinterp(self):
+        # bpo-42846: Test a CJK codec in a subinterpreter
+        import _testcapi
+        encoding = 'cp932'
+        text = "Python の開発は、1990 年ごろから開始されています。"
+        code = textwrap.dedent("""
+            import codecs
+            encoding = %r
+            text = %r
+            encoder = codecs.getincrementalencoder(encoding)()
+            text2 = encoder.encode(text).decode(encoding)
+            if text2 != text:
+                raise ValueError(f"encoding issue: {text2!a} != {text!a}")
+        """) % (encoding, text)
+        res = _testcapi.run_in_subinterp(code)
+        self.assertEqual(res, 0)
+
 class Test_IncrementalDecoder(unittest.TestCase):
 
     def test_dbcs(self):
@@ -296,7 +319,7 @@
             finally:
                 f.close()
         finally:
-            support.unlink(TESTFN)
+            os_helper.unlink(TESTFN)
 
 class Test_StreamWriter(unittest.TestCase):
     def test_gb18030(self):
@@ -380,8 +403,6 @@
     reset = b'~}'
     expected_reset = expected + reset
 
-def test_main():
-    support.run_unittest(__name__)
 
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_multiprocessing_main_handling.py b/Lib/test/test_multiprocessing_main_handling.py
index be1ff10..510d8d3 100644
--- a/Lib/test/test_multiprocessing_main_handling.py
+++ b/Lib/test/test_multiprocessing_main_handling.py
@@ -1,7 +1,8 @@
 # tests __main__ module handling in multiprocessing
 from test import support
+from test.support import import_helper
 # Skip tests if _multiprocessing wasn't built.
-support.import_module('_multiprocessing')
+import_helper.import_module('_multiprocessing')
 
 import importlib
 import importlib.machinery
@@ -11,6 +12,7 @@
 import os.path
 import py_compile
 
+from test.support import os_helper
 from test.support.script_helper import (
     make_pkg, make_script, make_zip_pkg, make_zip_script,
     assert_python_ok)
@@ -167,12 +169,12 @@
         self._check_output(script_name, rc, out, err)
 
     def test_basic_script(self):
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             script_name = _make_test_script(script_dir, 'script')
             self._check_script(script_name)
 
     def test_basic_script_no_suffix(self):
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             script_name = _make_test_script(script_dir, 'script',
                                             omit_suffix=True)
             self._check_script(script_name)
@@ -183,7 +185,7 @@
         # a workaround for that case
         # See https://github.com/ipython/ipython/issues/4698
         source = test_source_main_skipped_in_children
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             script_name = _make_test_script(script_dir, 'ipython',
                                             source=source)
             self._check_script(script_name)
@@ -193,33 +195,33 @@
             self._check_script(script_no_suffix)
 
     def test_script_compiled(self):
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             script_name = _make_test_script(script_dir, 'script')
             py_compile.compile(script_name, doraise=True)
             os.remove(script_name)
-            pyc_file = support.make_legacy_pyc(script_name)
+            pyc_file = import_helper.make_legacy_pyc(script_name)
             self._check_script(pyc_file)
 
     def test_directory(self):
         source = self.main_in_children_source
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             script_name = _make_test_script(script_dir, '__main__',
                                             source=source)
             self._check_script(script_dir)
 
     def test_directory_compiled(self):
         source = self.main_in_children_source
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             script_name = _make_test_script(script_dir, '__main__',
                                             source=source)
             py_compile.compile(script_name, doraise=True)
             os.remove(script_name)
-            pyc_file = support.make_legacy_pyc(script_name)
+            pyc_file = import_helper.make_legacy_pyc(script_name)
             self._check_script(script_dir)
 
     def test_zipfile(self):
         source = self.main_in_children_source
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             script_name = _make_test_script(script_dir, '__main__',
                                             source=source)
             zip_name, run_name = make_zip_script(script_dir, 'test_zip', script_name)
@@ -227,7 +229,7 @@
 
     def test_zipfile_compiled(self):
         source = self.main_in_children_source
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             script_name = _make_test_script(script_dir, '__main__',
                                             source=source)
             compiled_name = py_compile.compile(script_name, doraise=True)
@@ -235,7 +237,7 @@
             self._check_script(zip_name)
 
     def test_module_in_package(self):
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             pkg_dir = os.path.join(script_dir, 'test_pkg')
             make_pkg(pkg_dir)
             script_name = _make_test_script(pkg_dir, 'check_sibling')
@@ -244,20 +246,20 @@
             self._check_script(launch_name)
 
     def test_module_in_package_in_zipfile(self):
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             zip_name, run_name = _make_test_zip_pkg(script_dir, 'test_zip', 'test_pkg', 'script')
             launch_name = _make_launch_script(script_dir, 'launch', 'test_pkg.script', zip_name)
             self._check_script(launch_name)
 
     def test_module_in_subpackage_in_zipfile(self):
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             zip_name, run_name = _make_test_zip_pkg(script_dir, 'test_zip', 'test_pkg', 'script', depth=2)
             launch_name = _make_launch_script(script_dir, 'launch', 'test_pkg.test_pkg.script', zip_name)
             self._check_script(launch_name)
 
     def test_package(self):
         source = self.main_in_children_source
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             pkg_dir = os.path.join(script_dir, 'test_pkg')
             make_pkg(pkg_dir)
             script_name = _make_test_script(pkg_dir, '__main__',
@@ -267,14 +269,14 @@
 
     def test_package_compiled(self):
         source = self.main_in_children_source
-        with support.temp_dir() as script_dir:
+        with os_helper.temp_dir() as script_dir:
             pkg_dir = os.path.join(script_dir, 'test_pkg')
             make_pkg(pkg_dir)
             script_name = _make_test_script(pkg_dir, '__main__',
                                             source=source)
             compiled_name = py_compile.compile(script_name, doraise=True)
             os.remove(script_name)
-            pyc_file = support.make_legacy_pyc(script_name)
+            pyc_file = import_helper.make_legacy_pyc(script_name)
             launch_name = _make_launch_script(script_dir, 'launch', 'test_pkg')
             self._check_script(launch_name)
 
diff --git a/Lib/test/test_named_expressions.py b/Lib/test/test_named_expressions.py
index 2adcd4b..20ac2e6 100644
--- a/Lib/test/test_named_expressions.py
+++ b/Lib/test/test_named_expressions.py
@@ -101,7 +101,8 @@
     def test_named_expression_invalid_17(self):
         code = "[i := 0, j := 1 for i, j in [(1, 2), (3, 4)]]"
 
-        with self.assertRaisesRegex(SyntaxError, "invalid syntax"):
+        with self.assertRaisesRegex(SyntaxError,
+                "did you forget parentheses around the comprehension target?"):
             exec(code, {}, {})
 
     def test_named_expression_invalid_in_class_body(self):
@@ -325,6 +326,27 @@
         fib = {(c := a): (a := b) + (b := a + c) - b for __ in range(6)}
         self.assertEqual(fib, {1: 2, 2: 3, 3: 5, 5: 8, 8: 13, 13: 21})
 
+    def test_named_expression_assignment_17(self):
+        a = [1]
+        element = a[b:=0]
+        self.assertEqual(b, 0)
+        self.assertEqual(element, a[0])
+
+    def test_named_expression_assignment_18(self):
+        class TwoDimensionalList:
+            def __init__(self, two_dimensional_list):
+                self.two_dimensional_list = two_dimensional_list
+
+            def __getitem__(self, index):
+                return self.two_dimensional_list[index[0]][index[1]]
+
+        a = TwoDimensionalList([[1], [2]])
+        element = a[b:=0, c:=0]
+        self.assertEqual(b, 0)
+        self.assertEqual(c, 0)
+        self.assertEqual(element, a.two_dimensional_list[b][c])
+
+
 
 class NamedExpressionScopeTest(unittest.TestCase):
 
diff --git a/Lib/test/test_netrc.py b/Lib/test/test_netrc.py
index 7ce7e56..90ef5cd 100644
--- a/Lib/test/test_netrc.py
+++ b/Lib/test/test_netrc.py
@@ -1,5 +1,6 @@
 import netrc, os, unittest, sys, tempfile, textwrap
 from test import support
+from test.support import os_helper
 
 
 class NetrcTestCase(unittest.TestCase):
@@ -108,62 +109,56 @@
     def test_security(self):
         # This test is incomplete since we are normally not run as root and
         # therefore can't test the file ownership being wrong.
-        d = support.TESTFN
-        os.mkdir(d)
-        self.addCleanup(support.rmtree, d)
-        fn = os.path.join(d, '.netrc')
-        with open(fn, 'wt') as f:
-            f.write("""\
-                machine foo.domain.com login bar password pass
-                default login foo password pass
-                """)
-        with support.EnvironmentVarGuard() as environ:
-            environ.set('HOME', d)
-            os.chmod(fn, 0o600)
-            nrc = netrc.netrc()
-            self.assertEqual(nrc.hosts['foo.domain.com'],
-                             ('bar', None, 'pass'))
-            os.chmod(fn, 0o622)
-            self.assertRaises(netrc.NetrcParseError, netrc.netrc)
+        with os_helper.temp_cwd(None) as d:
+            fn = os.path.join(d, '.netrc')
+            with open(fn, 'wt') as f:
+                f.write("""\
+                    machine foo.domain.com login bar password pass
+                    default login foo password pass
+                    """)
+            with os_helper.EnvironmentVarGuard() as environ:
+                environ.set('HOME', d)
+                os.chmod(fn, 0o600)
+                nrc = netrc.netrc()
+                self.assertEqual(nrc.hosts['foo.domain.com'],
+                                 ('bar', None, 'pass'))
+                os.chmod(fn, 0o622)
+                self.assertRaises(netrc.NetrcParseError, netrc.netrc)
 
     def test_file_not_found_in_home(self):
-        d = support.TESTFN
-        os.mkdir(d)
-        self.addCleanup(support.rmtree, d)
-        with support.EnvironmentVarGuard() as environ:
-            environ.set('HOME', d)
-            self.assertRaises(FileNotFoundError, netrc.netrc)
+        with os_helper.temp_cwd(None) as d:
+            with os_helper.EnvironmentVarGuard() as environ:
+                environ.set('HOME', d)
+                self.assertRaises(FileNotFoundError, netrc.netrc)
 
     def test_file_not_found_explicit(self):
         self.assertRaises(FileNotFoundError, netrc.netrc,
                           file='unlikely_netrc')
 
     def test_home_not_set(self):
-        fake_home = support.TESTFN
-        os.mkdir(fake_home)
-        self.addCleanup(support.rmtree, fake_home)
-        fake_netrc_path = os.path.join(fake_home, '.netrc')
-        with open(fake_netrc_path, 'w') as f:
-            f.write('machine foo.domain.com login bar password pass')
-        os.chmod(fake_netrc_path, 0o600)
+        with os_helper.temp_cwd(None) as fake_home:
+            fake_netrc_path = os.path.join(fake_home, '.netrc')
+            with open(fake_netrc_path, 'w') as f:
+                f.write('machine foo.domain.com login bar password pass')
+            os.chmod(fake_netrc_path, 0o600)
 
-        orig_expanduser = os.path.expanduser
-        called = []
+            orig_expanduser = os.path.expanduser
+            called = []
 
-        def fake_expanduser(s):
-            called.append(s)
-            with support.EnvironmentVarGuard() as environ:
-                environ.set('HOME', fake_home)
-                environ.set('USERPROFILE', fake_home)
-                result = orig_expanduser(s)
-                return result
+            def fake_expanduser(s):
+                called.append(s)
+                with os_helper.EnvironmentVarGuard() as environ:
+                    environ.set('HOME', fake_home)
+                    environ.set('USERPROFILE', fake_home)
+                    result = orig_expanduser(s)
+                    return result
 
-        with support.swap_attr(os.path, 'expanduser', fake_expanduser):
-            nrc = netrc.netrc()
-            login, account, password = nrc.authenticators('foo.domain.com')
-            self.assertEqual(login, 'bar')
+            with support.swap_attr(os.path, 'expanduser', fake_expanduser):
+                nrc = netrc.netrc()
+                login, account, password = nrc.authenticators('foo.domain.com')
+                self.assertEqual(login, 'bar')
 
-        self.assertTrue(called)
+            self.assertTrue(called)
 
 
 if __name__ == "__main__":
diff --git a/Lib/test/test_nis.py b/Lib/test/test_nis.py
index 21074c6..a22142f 100644
--- a/Lib/test/test_nis.py
+++ b/Lib/test/test_nis.py
@@ -1,8 +1,10 @@
 from test import support
+from test.support import import_helper
 import unittest
 
+
 # Skip test if nis module does not exist.
-nis = support.import_module('nis')
+nis = import_helper.import_module('nis')
 
 
 class NisTests(unittest.TestCase):
diff --git a/Lib/test/test_nntplib.py b/Lib/test/test_nntplib.py
index 1df64fa..4f05921 100644
--- a/Lib/test/test_nntplib.py
+++ b/Lib/test/test_nntplib.py
@@ -37,6 +37,8 @@
 
 class NetworkedNNTPTestsMixin:
 
+    ssl_context = None
+
     def test_welcome(self):
         welcome = self.server.getwelcome()
         self.assertEqual(str, type(welcome))
@@ -82,7 +84,7 @@
         desc = self.server.description(self.GROUP_NAME)
         _check_desc(desc)
         # Another sanity check
-        self.assertIn("Python", desc)
+        self.assertIn(self.DESC, desc)
         # With a pattern
         desc = self.server.description(self.GROUP_PAT)
         _check_desc(desc)
@@ -197,11 +199,11 @@
         self.assertTrue(resp.startswith("220 "), resp)
         self.check_article_resp(resp, article, art_num)
         # Tolerate running the tests from behind a NNTP virus checker
-        blacklist = lambda line: line.startswith(b'X-Antivirus')
+        denylist = lambda line: line.startswith(b'X-Antivirus')
         filtered_head_lines = [line for line in head.lines
-                               if not blacklist(line)]
+                               if not denylist(line)]
         filtered_lines = [line for line in article.lines
-                          if not blacklist(line)]
+                          if not denylist(line)]
         self.assertEqual(filtered_lines, filtered_head_lines + [b''] + body.lines)
 
     def test_capabilities(self):
@@ -273,18 +275,21 @@
                 return False
             return True
 
+        kwargs = dict(
+            timeout=support.INTERNET_TIMEOUT,
+            usenetrc=False
+        )
+        if self.ssl_context is not None:
+            kwargs["ssl_context"] = self.ssl_context
+
         try:
-            server = self.NNTP_CLASS(self.NNTP_HOST,
-                                     timeout=support.INTERNET_TIMEOUT,
-                                     usenetrc=False)
+            server = self.NNTP_CLASS(self.NNTP_HOST, **kwargs)
             with server:
                 self.assertTrue(is_connected())
                 self.assertTrue(server.help())
             self.assertFalse(is_connected())
 
-            server = self.NNTP_CLASS(self.NNTP_HOST,
-                                     timeout=support.INTERNET_TIMEOUT,
-                                     usenetrc=False)
+            server = self.NNTP_CLASS(self.NNTP_HOST, **kwargs)
             with server:
                 server.quit()
             self.assertFalse(is_connected())
@@ -309,22 +314,28 @@
     NNTP_HOST = 'news.trigofacile.com'
     GROUP_NAME = 'fr.comp.lang.python'
     GROUP_PAT = 'fr.comp.lang.*'
+    DESC = 'Python'
 
     NNTP_CLASS = NNTP
 
     @classmethod
     def setUpClass(cls):
         support.requires("network")
+        kwargs = dict(
+            timeout=support.INTERNET_TIMEOUT,
+            usenetrc=False
+        )
+        if cls.ssl_context is not None:
+            kwargs["ssl_context"] = cls.ssl_context
         with socket_helper.transient_internet(cls.NNTP_HOST):
             try:
-                cls.server = cls.NNTP_CLASS(cls.NNTP_HOST,
-                                            timeout=support.INTERNET_TIMEOUT,
-                                            usenetrc=False)
+                cls.server = cls.NNTP_CLASS(cls.NNTP_HOST, **kwargs)
             except SSLError as ssl_err:
                 # matches "[SSL: DH_KEY_TOO_SMALL] dh key too small"
                 if re.search(r'(?i)KEY.TOO.SMALL', ssl_err.reason):
                     raise unittest.SkipTest(f"{cls} got {ssl_err} connecting "
                                             f"to {cls.NNTP_HOST!r}")
+                print(cls.NNTP_HOST)
                 raise
             except EOF_ERRORS:
                 raise unittest.SkipTest(f"{cls} got EOF error on connecting "
@@ -343,8 +354,11 @@
     # 400 connections per day are accepted from each IP address."
 
     NNTP_HOST = 'nntp.aioe.org'
-    GROUP_NAME = 'comp.lang.python'
-    GROUP_PAT = 'comp.lang.*'
+    # bpo-42794: aioe.test is one of the official groups on this server
+    # used for testing: https://news.aioe.org/manual/aioe-hierarchy/
+    GROUP_NAME = 'aioe.test'
+    GROUP_PAT = 'aioe.*'
+    DESC = 'test'
 
     NNTP_CLASS = getattr(nntplib, 'NNTP_SSL', None)
 
@@ -354,6 +368,10 @@
     # Disabled as the connection will already be encrypted.
     test_starttls = None
 
+    if ssl is not None:
+        ssl_context = ssl._create_unverified_context()
+        ssl_context.set_ciphers("DEFAULT")
+        ssl_context.maximum_version = ssl.TLSVersion.TLSv1_2
 
 #
 # Non-networked tests using a local server (or something mocking it).
@@ -1598,7 +1616,7 @@
                 elif cmd == b'STARTTLS\r\n':
                     reader.close()
                     client.sendall(b'382 Begin TLS negotiation now\r\n')
-                    context = ssl.SSLContext()
+                    context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
                     context.load_cert_chain(certfile)
                     client = context.wrap_socket(
                         client, server_side=True)
diff --git a/Lib/test/test_ntpath.py b/Lib/test/test_ntpath.py
index 6f881f1..661c59d 100644
--- a/Lib/test/test_ntpath.py
+++ b/Lib/test/test_ntpath.py
@@ -3,8 +3,10 @@
 import sys
 import unittest
 import warnings
-from test.support import TestFailed, FakePath
-from test import support, test_genericpath
+from test.support import os_helper
+from test.support import TestFailed
+from test.support.os_helper import FakePath
+from test import test_genericpath
 from tempfile import TemporaryFile
 
 
@@ -254,38 +256,49 @@
         tester("ntpath.realpath('\\'.join(['..'] * 50))",
                ntpath.splitdrive(expected)[0] + '\\')
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     @unittest.skipUnless(HAVE_GETFINALPATHNAME, 'need _getfinalpathname')
     def test_realpath_basic(self):
-        ABSTFN = ntpath.abspath(support.TESTFN)
+        ABSTFN = ntpath.abspath(os_helper.TESTFN)
         open(ABSTFN, "wb").close()
-        self.addCleanup(support.unlink, ABSTFN)
-        self.addCleanup(support.unlink, ABSTFN + "1")
+        self.addCleanup(os_helper.unlink, ABSTFN)
+        self.addCleanup(os_helper.unlink, ABSTFN + "1")
 
         os.symlink(ABSTFN, ABSTFN + "1")
         self.assertPathEqual(ntpath.realpath(ABSTFN + "1"), ABSTFN)
         self.assertPathEqual(ntpath.realpath(os.fsencode(ABSTFN + "1")),
                          os.fsencode(ABSTFN))
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
+    @unittest.skipUnless(HAVE_GETFINALPATHNAME, 'need _getfinalpathname')
+    def test_realpath_strict(self):
+        # Bug #43757: raise FileNotFoundError in strict mode if we encounter
+        # a path that does not exist.
+        ABSTFN = ntpath.abspath(os_helper.TESTFN)
+        os.symlink(ABSTFN + "1", ABSTFN)
+        self.addCleanup(os_helper.unlink, ABSTFN)
+        self.assertRaises(FileNotFoundError, ntpath.realpath, ABSTFN, strict=True)
+        self.assertRaises(FileNotFoundError, ntpath.realpath, ABSTFN + "2", strict=True)
+
+    @os_helper.skip_unless_symlink
     @unittest.skipUnless(HAVE_GETFINALPATHNAME, 'need _getfinalpathname')
     def test_realpath_relative(self):
-        ABSTFN = ntpath.abspath(support.TESTFN)
+        ABSTFN = ntpath.abspath(os_helper.TESTFN)
         open(ABSTFN, "wb").close()
-        self.addCleanup(support.unlink, ABSTFN)
-        self.addCleanup(support.unlink, ABSTFN + "1")
+        self.addCleanup(os_helper.unlink, ABSTFN)
+        self.addCleanup(os_helper.unlink, ABSTFN + "1")
 
         os.symlink(ABSTFN, ntpath.relpath(ABSTFN + "1"))
         self.assertPathEqual(ntpath.realpath(ABSTFN + "1"), ABSTFN)
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     @unittest.skipUnless(HAVE_GETFINALPATHNAME, 'need _getfinalpathname')
     def test_realpath_broken_symlinks(self):
-        ABSTFN = ntpath.abspath(support.TESTFN)
+        ABSTFN = ntpath.abspath(os_helper.TESTFN)
         os.mkdir(ABSTFN)
-        self.addCleanup(support.rmtree, ABSTFN)
+        self.addCleanup(os_helper.rmtree, ABSTFN)
 
-        with support.change_cwd(ABSTFN):
+        with os_helper.change_cwd(ABSTFN):
             os.mkdir("subdir")
             os.chdir("subdir")
             os.symlink(".", "recursive")
@@ -335,18 +348,19 @@
             self.assertPathEqual(ntpath.realpath(b"broken5"),
                                  os.fsencode(ABSTFN + r"\missing"))
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     @unittest.skipUnless(HAVE_GETFINALPATHNAME, 'need _getfinalpathname')
     def test_realpath_symlink_loops(self):
-        # Symlink loops are non-deterministic as to which path is returned, but
-        # it will always be the fully resolved path of one member of the cycle
-        ABSTFN = ntpath.abspath(support.TESTFN)
-        self.addCleanup(support.unlink, ABSTFN)
-        self.addCleanup(support.unlink, ABSTFN + "1")
-        self.addCleanup(support.unlink, ABSTFN + "2")
-        self.addCleanup(support.unlink, ABSTFN + "y")
-        self.addCleanup(support.unlink, ABSTFN + "c")
-        self.addCleanup(support.unlink, ABSTFN + "a")
+        # Symlink loops in non-strict mode are non-deterministic as to which
+        # path is returned, but it will always be the fully resolved path of
+        # one member of the cycle
+        ABSTFN = ntpath.abspath(os_helper.TESTFN)
+        self.addCleanup(os_helper.unlink, ABSTFN)
+        self.addCleanup(os_helper.unlink, ABSTFN + "1")
+        self.addCleanup(os_helper.unlink, ABSTFN + "2")
+        self.addCleanup(os_helper.unlink, ABSTFN + "y")
+        self.addCleanup(os_helper.unlink, ABSTFN + "c")
+        self.addCleanup(os_helper.unlink, ABSTFN + "a")
 
         os.symlink(ABSTFN, ABSTFN)
         self.assertPathEqual(ntpath.realpath(ABSTFN), ABSTFN)
@@ -381,14 +395,58 @@
         # Test using relative path as well.
         self.assertPathEqual(ntpath.realpath(ntpath.basename(ABSTFN)), ABSTFN)
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
+    @unittest.skipUnless(HAVE_GETFINALPATHNAME, 'need _getfinalpathname')
+    def test_realpath_symlink_loops_strict(self):
+        # Symlink loops raise OSError in strict mode
+        ABSTFN = ntpath.abspath(os_helper.TESTFN)
+        self.addCleanup(os_helper.unlink, ABSTFN)
+        self.addCleanup(os_helper.unlink, ABSTFN + "1")
+        self.addCleanup(os_helper.unlink, ABSTFN + "2")
+        self.addCleanup(os_helper.unlink, ABSTFN + "y")
+        self.addCleanup(os_helper.unlink, ABSTFN + "c")
+        self.addCleanup(os_helper.unlink, ABSTFN + "a")
+
+        os.symlink(ABSTFN, ABSTFN)
+        self.assertRaises(OSError, ntpath.realpath, ABSTFN, strict=True)
+
+        os.symlink(ABSTFN + "1", ABSTFN + "2")
+        os.symlink(ABSTFN + "2", ABSTFN + "1")
+        self.assertRaises(OSError, ntpath.realpath, ABSTFN + "1", strict=True)
+        self.assertRaises(OSError, ntpath.realpath, ABSTFN + "2", strict=True)
+        self.assertRaises(OSError, ntpath.realpath, ABSTFN + "1\\x", strict=True)
+        # Windows eliminates '..' components before resolving links, so the
+        # following call is not expected to raise.
+        self.assertPathEqual(ntpath.realpath(ABSTFN + "1\\..", strict=True),
+                             ntpath.dirname(ABSTFN))
+        self.assertRaises(OSError, ntpath.realpath, ABSTFN + "1\\..\\x", strict=True)
+        os.symlink(ABSTFN + "x", ABSTFN + "y")
+        self.assertRaises(OSError, ntpath.realpath, ABSTFN + "1\\..\\"
+                                             + ntpath.basename(ABSTFN) + "y",
+                                             strict=True)
+        self.assertRaises(OSError, ntpath.realpath,
+                          ABSTFN + "1\\..\\" + ntpath.basename(ABSTFN) + "1",
+                          strict=True)
+
+        os.symlink(ntpath.basename(ABSTFN) + "a\\b", ABSTFN + "a")
+        self.assertRaises(OSError, ntpath.realpath, ABSTFN + "a", strict=True)
+
+        os.symlink("..\\" + ntpath.basename(ntpath.dirname(ABSTFN))
+                   + "\\" + ntpath.basename(ABSTFN) + "c", ABSTFN + "c")
+        self.assertRaises(OSError, ntpath.realpath, ABSTFN + "c", strict=True)
+
+        # Test using relative path as well.
+        self.assertRaises(OSError, ntpath.realpath, ntpath.basename(ABSTFN),
+                          strict=True)
+
+    @os_helper.skip_unless_symlink
     @unittest.skipUnless(HAVE_GETFINALPATHNAME, 'need _getfinalpathname')
     def test_realpath_symlink_prefix(self):
-        ABSTFN = ntpath.abspath(support.TESTFN)
-        self.addCleanup(support.unlink, ABSTFN + "3")
-        self.addCleanup(support.unlink, "\\\\?\\" + ABSTFN + "3.")
-        self.addCleanup(support.unlink, ABSTFN + "3link")
-        self.addCleanup(support.unlink, ABSTFN + "3.link")
+        ABSTFN = ntpath.abspath(os_helper.TESTFN)
+        self.addCleanup(os_helper.unlink, ABSTFN + "3")
+        self.addCleanup(os_helper.unlink, "\\\\?\\" + ABSTFN + "3.")
+        self.addCleanup(os_helper.unlink, ABSTFN + "3link")
+        self.addCleanup(os_helper.unlink, ABSTFN + "3.link")
 
         with open(ABSTFN + "3", "wb") as f:
             f.write(b'0')
@@ -422,12 +480,12 @@
     @unittest.skipUnless(HAVE_GETFINALPATHNAME, 'need _getfinalpathname')
     @unittest.skipUnless(HAVE_GETSHORTPATHNAME, 'need _getshortpathname')
     def test_realpath_cwd(self):
-        ABSTFN = ntpath.abspath(support.TESTFN)
+        ABSTFN = ntpath.abspath(os_helper.TESTFN)
 
-        support.unlink(ABSTFN)
-        support.rmtree(ABSTFN)
+        os_helper.unlink(ABSTFN)
+        os_helper.rmtree(ABSTFN)
         os.mkdir(ABSTFN)
-        self.addCleanup(support.rmtree, ABSTFN)
+        self.addCleanup(os_helper.rmtree, ABSTFN)
 
         test_dir_long = ntpath.join(ABSTFN, "MyVeryLongDirectoryName")
         os.mkdir(test_dir_long)
@@ -441,15 +499,15 @@
 
         self.assertPathEqual(test_file_long, ntpath.realpath(test_file_short))
 
-        with support.change_cwd(test_dir_long):
+        with os_helper.change_cwd(test_dir_long):
             self.assertPathEqual(test_file_long, ntpath.realpath("file.txt"))
-        with support.change_cwd(test_dir_long.lower()):
+        with os_helper.change_cwd(test_dir_long.lower()):
             self.assertPathEqual(test_file_long, ntpath.realpath("file.txt"))
-        with support.change_cwd(test_dir_short):
+        with os_helper.change_cwd(test_dir_short):
             self.assertPathEqual(test_file_long, ntpath.realpath("file.txt"))
 
     def test_expandvars(self):
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env.clear()
             env["foo"] = "bar"
             env["{foo"] = "baz1"
@@ -474,13 +532,13 @@
             tester('ntpath.expandvars("\'%foo%\'%bar")', "\'%foo%\'%bar")
             tester('ntpath.expandvars("bar\'%foo%")', "bar\'%foo%")
 
-    @unittest.skipUnless(support.FS_NONASCII, 'need support.FS_NONASCII')
+    @unittest.skipUnless(os_helper.FS_NONASCII, 'need os_helper.FS_NONASCII')
     def test_expandvars_nonascii(self):
         def check(value, expected):
             tester('ntpath.expandvars(%r)' % value, expected)
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env.clear()
-            nonascii = support.FS_NONASCII
+            nonascii = os_helper.FS_NONASCII
             env['spam'] = nonascii
             env[nonascii] = 'ham' + nonascii
             check('$spam bar', '%s bar' % nonascii)
@@ -497,43 +555,56 @@
     def test_expanduser(self):
         tester('ntpath.expanduser("test")', 'test')
 
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env.clear()
             tester('ntpath.expanduser("~test")', '~test')
 
-            env['HOMEPATH'] = 'eric\\idle'
             env['HOMEDRIVE'] = 'C:\\'
-            tester('ntpath.expanduser("~test")', 'C:\\eric\\test')
-            tester('ntpath.expanduser("~")', 'C:\\eric\\idle')
+            env['HOMEPATH'] = 'Users\\eric'
+            env['USERNAME'] = 'eric'
+            tester('ntpath.expanduser("~test")', 'C:\\Users\\test')
+            tester('ntpath.expanduser("~")', 'C:\\Users\\eric')
 
             del env['HOMEDRIVE']
-            tester('ntpath.expanduser("~test")', 'eric\\test')
-            tester('ntpath.expanduser("~")', 'eric\\idle')
+            tester('ntpath.expanduser("~test")', 'Users\\test')
+            tester('ntpath.expanduser("~")', 'Users\\eric')
 
             env.clear()
-            env['USERPROFILE'] = 'C:\\eric\\idle'
-            tester('ntpath.expanduser("~test")', 'C:\\eric\\test')
-            tester('ntpath.expanduser("~")', 'C:\\eric\\idle')
+            env['USERPROFILE'] = 'C:\\Users\\eric'
+            env['USERNAME'] = 'eric'
+            tester('ntpath.expanduser("~test")', 'C:\\Users\\test')
+            tester('ntpath.expanduser("~")', 'C:\\Users\\eric')
             tester('ntpath.expanduser("~test\\foo\\bar")',
-                   'C:\\eric\\test\\foo\\bar')
+                   'C:\\Users\\test\\foo\\bar')
             tester('ntpath.expanduser("~test/foo/bar")',
-                   'C:\\eric\\test/foo/bar')
+                   'C:\\Users\\test/foo/bar')
             tester('ntpath.expanduser("~\\foo\\bar")',
-                   'C:\\eric\\idle\\foo\\bar')
+                   'C:\\Users\\eric\\foo\\bar')
             tester('ntpath.expanduser("~/foo/bar")',
-                   'C:\\eric\\idle/foo/bar')
+                   'C:\\Users\\eric/foo/bar')
 
             # bpo-36264: ignore `HOME` when set on windows
             env.clear()
             env['HOME'] = 'F:\\'
-            env['USERPROFILE'] = 'C:\\eric\\idle'
-            tester('ntpath.expanduser("~test")', 'C:\\eric\\test')
-            tester('ntpath.expanduser("~")', 'C:\\eric\\idle')
+            env['USERPROFILE'] = 'C:\\Users\\eric'
+            env['USERNAME'] = 'eric'
+            tester('ntpath.expanduser("~test")', 'C:\\Users\\test')
+            tester('ntpath.expanduser("~")', 'C:\\Users\\eric')
+
+            # bpo-39899: don't guess another user's home directory if
+            # `%USERNAME% != basename(%USERPROFILE%)`
+            env.clear()
+            env['USERPROFILE'] = 'C:\\Users\\eric'
+            env['USERNAME'] = 'idle'
+            tester('ntpath.expanduser("~test")', '~test')
+            tester('ntpath.expanduser("~")', 'C:\\Users\\eric')
+
+
 
     @unittest.skipUnless(nt, "abspath requires 'nt' module")
     def test_abspath(self):
         tester('ntpath.abspath("C:\\")', "C:\\")
-        with support.temp_cwd(support.TESTFN) as cwd_dir: # bpo-31047
+        with os_helper.temp_cwd(os_helper.TESTFN) as cwd_dir: # bpo-31047
             tester('ntpath.abspath("")', cwd_dir)
             tester('ntpath.abspath(" ")', cwd_dir + "\\ ")
             tester('ntpath.abspath("?")', cwd_dir + "\\?")
@@ -545,7 +616,7 @@
         tester('ntpath.relpath(ntpath.abspath("a"))', 'a')
         tester('ntpath.relpath("a/b")', 'a\\b')
         tester('ntpath.relpath("../a/b")', '..\\a\\b')
-        with support.temp_cwd(support.TESTFN) as cwd_dir:
+        with os_helper.temp_cwd(os_helper.TESTFN) as cwd_dir:
             currentdir = ntpath.basename(cwd_dir)
             tester('ntpath.relpath("a", "../b")', '..\\'+currentdir+'\\a')
             tester('ntpath.relpath("a/b", "../c")', '..\\'+currentdir+'\\a\\b')
@@ -661,7 +732,7 @@
         self.assertTrue(ntpath.ismount(b"\\\\.\\c:\\"))
         self.assertTrue(ntpath.ismount(b"\\\\.\\C:\\"))
 
-        with support.temp_dir() as d:
+        with os_helper.temp_dir() as d:
             self.assertFalse(ntpath.ismount(d))
 
         if sys.platform == "win32":
@@ -671,7 +742,7 @@
             # locations below cannot then refer to mount points
             #
             drive, path = ntpath.splitdrive(sys.executable)
-            with support.change_cwd(ntpath.dirname(sys.executable)):
+            with os_helper.change_cwd(ntpath.dirname(sys.executable)):
                 self.assertFalse(ntpath.ismount(drive.lower()))
                 self.assertFalse(ntpath.ismount(drive.upper()))
 
@@ -725,9 +796,9 @@
     path = ntpath
 
     def setUp(self):
-        self.file_name = support.TESTFN
-        self.file_path = FakePath(support.TESTFN)
-        self.addCleanup(support.unlink, self.file_name)
+        self.file_name = os_helper.TESTFN
+        self.file_path = FakePath(os_helper.TESTFN)
+        self.addCleanup(os_helper.unlink, self.file_name)
         with open(self.file_name, 'xb', 0) as file:
             file.write(b"test_ntpath.PathLikeTests")
 
diff --git a/Lib/test/test_opcache.py b/Lib/test/test_opcache.py
new file mode 100644
index 0000000..61f337d
--- /dev/null
+++ b/Lib/test/test_opcache.py
@@ -0,0 +1,23 @@
+import unittest
+
+class TestLoadAttrCache(unittest.TestCase):
+    def test_descriptor_added_after_optimization(self):
+        class Descriptor:
+            pass
+
+        class C:
+            def __init__(self):
+                self.x = 1
+            x = Descriptor()
+
+        def f(o):
+            return o.x
+
+        o = C()
+        for i in range(1025):
+            assert f(o) == 1
+
+        Descriptor.__get__ = lambda self, instance, value: 2
+        Descriptor.__set__ = lambda *args: None
+
+        self.assertEqual(f(o), 2)
diff --git a/Lib/test/test_opcodes.py b/Lib/test/test_opcodes.py
index 527aca6..e880c3f 100644
--- a/Lib/test/test_opcodes.py
+++ b/Lib/test/test_opcodes.py
@@ -24,17 +24,16 @@
     def test_setup_annotations_line(self):
         # check that SETUP_ANNOTATIONS does not create spurious line numbers
         try:
-            with open(ann_module.__file__) as f:
+            with open(ann_module.__file__, encoding="utf-8") as f:
                 txt = f.read()
             co = compile(txt, ann_module.__file__, 'exec')
-            self.assertEqual(co.co_firstlineno, 3)
+            self.assertEqual(co.co_firstlineno, 1)
         except OSError:
             pass
 
-    def test_no_annotations_if_not_needed(self):
+    def test_default_annotations_exist(self):
         class C: pass
-        with self.assertRaises(AttributeError):
-            C.__annotations__
+        self.assertEqual(C.__annotations__, {})
 
     def test_use_existing_annotations(self):
         ns = {'__annotations__': {1: 2}}
diff --git a/Lib/test/test_operator.py b/Lib/test/test_operator.py
index 29f5e42..b9b8f15 100644
--- a/Lib/test/test_operator.py
+++ b/Lib/test/test_operator.py
@@ -3,9 +3,13 @@
 import sys
 
 from test import support
+from test.support import import_helper
 
-py_operator = support.import_fresh_module('operator', blocked=['_operator'])
-c_operator = support.import_fresh_module('operator', fresh=['_operator'])
+
+py_operator = import_helper.import_fresh_module('operator',
+                                                blocked=['_operator'])
+c_operator = import_helper.import_fresh_module('operator',
+                                               fresh=['_operator'])
 
 class Seq1:
     def __init__(self, lst):
@@ -149,6 +153,11 @@
         self.assertRaises(ZeroDivisionError, operator.countOf, BadIterable(), 1)
         self.assertEqual(operator.countOf([1, 2, 1, 3, 1, 4], 3), 1)
         self.assertEqual(operator.countOf([1, 2, 1, 3, 1, 4], 5), 0)
+        # is but not ==
+        nan = float("nan")
+        self.assertEqual(operator.countOf([nan, nan, 21], nan), 2)
+        # == but not is
+        self.assertEqual(operator.countOf([{}, 1, {}, 2], {}), 2)
 
     def test_delitem(self):
         operator = self.module
@@ -184,6 +193,9 @@
         self.assertRaises(ZeroDivisionError, operator.indexOf, BadIterable(), 1)
         self.assertEqual(operator.indexOf([4, 3, 2, 1], 3), 1)
         self.assertRaises(ValueError, operator.indexOf, [4, 3, 2, 1], 0)
+        nan = float("nan")
+        self.assertEqual(operator.indexOf([nan, nan, 21], nan), 0)
+        self.assertEqual(operator.indexOf([{}, 1, {}, 2], {}), 0)
 
     def test_invert(self):
         operator = self.module
diff --git a/Lib/test/test_optparse.py b/Lib/test/test_optparse.py
index 437fdd2..28b2744 100644
--- a/Lib/test/test_optparse.py
+++ b/Lib/test/test_optparse.py
@@ -14,6 +14,7 @@
 
 from io import StringIO
 from test import support
+from test.support import os_helper
 
 
 import optparse
@@ -1021,10 +1022,10 @@
         self.parser.add_option("-f", "--file", type="file", dest="file")
 
     def tearDown(self):
-        if os.path.isdir(support.TESTFN):
-            os.rmdir(support.TESTFN)
-        elif os.path.isfile(support.TESTFN):
-            os.unlink(support.TESTFN)
+        if os.path.isdir(os_helper.TESTFN):
+            os.rmdir(os_helper.TESTFN)
+        elif os.path.isfile(os_helper.TESTFN):
+            os.unlink(os_helper.TESTFN)
 
     class MyOption (Option):
         def check_file(option, opt, value):
@@ -1039,21 +1040,21 @@
         TYPE_CHECKER["file"] = check_file
 
     def test_filetype_ok(self):
-        support.create_empty_file(support.TESTFN)
-        self.assertParseOK(["--file", support.TESTFN, "-afoo"],
-                           {'file': support.TESTFN, 'a': 'foo'},
+        os_helper.create_empty_file(os_helper.TESTFN)
+        self.assertParseOK(["--file", os_helper.TESTFN, "-afoo"],
+                           {'file': os_helper.TESTFN, 'a': 'foo'},
                            [])
 
     def test_filetype_noexist(self):
-        self.assertParseFail(["--file", support.TESTFN, "-afoo"],
+        self.assertParseFail(["--file", os_helper.TESTFN, "-afoo"],
                              "%s: file does not exist" %
-                             support.TESTFN)
+                             os_helper.TESTFN)
 
     def test_filetype_notfile(self):
-        os.mkdir(support.TESTFN)
-        self.assertParseFail(["--file", support.TESTFN, "-afoo"],
+        os.mkdir(os_helper.TESTFN)
+        self.assertParseFail(["--file", os_helper.TESTFN, "-afoo"],
                              "%s: not a regular file" %
-                             support.TESTFN)
+                             os_helper.TESTFN)
 
 
 class TestExtendAddActions(BaseTest):
@@ -1497,7 +1498,7 @@
         # we must restore its original value -- otherwise, this test
         # screws things up for other tests when it's part of the Python
         # test suite.
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env['COLUMNS'] = str(columns)
             return InterceptingOptionParser(option_list=options)
 
@@ -1522,7 +1523,7 @@
         self.assertHelpEquals(_expected_help_long_opts_first)
 
     def test_help_title_formatter(self):
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env["COLUMNS"] = "80"
             self.parser.formatter = TitledHelpFormatter()
             self.assertHelpEquals(_expected_help_title_formatter)
@@ -1651,12 +1652,9 @@
 
 class MiscTestCase(unittest.TestCase):
     def test__all__(self):
-        blacklist = {'check_builtin', 'AmbiguousOptionError', 'NO_DEFAULT'}
-        support.check__all__(self, optparse, blacklist=blacklist)
+        not_exported = {'check_builtin', 'AmbiguousOptionError', 'NO_DEFAULT'}
+        support.check__all__(self, optparse, not_exported=not_exported)
 
 
-def test_main():
-    support.run_unittest(__name__)
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_ordered_dict.py b/Lib/test/test_ordered_dict.py
index fdea44e..eb40446 100644
--- a/Lib/test/test_ordered_dict.py
+++ b/Lib/test/test_ordered_dict.py
@@ -10,10 +10,13 @@
 import weakref
 from collections.abc import MutableMapping
 from test import mapping_tests, support
+from test.support import import_helper
 
 
-py_coll = support.import_fresh_module('collections', blocked=['_collections'])
-c_coll = support.import_fresh_module('collections', fresh=['_collections'])
+py_coll = import_helper.import_fresh_module('collections',
+                                            blocked=['_collections'])
+c_coll = import_helper.import_fresh_module('collections',
+                                           fresh=['_collections'])
 
 
 @contextlib.contextmanager
@@ -697,6 +700,17 @@
         with self.assertRaises(ValueError):
             a |= "BAD"
 
+    @support.cpython_only
+    def test_ordered_dict_items_result_gc(self):
+        # bpo-42536: OrderedDict.items's tuple-reuse speed trick breaks the GC's
+        # assumptions about what can be untracked. Make sure we re-track result
+        # tuples whenever we reuse them.
+        it = iter(self.OrderedDict({None: []}).items())
+        gc.collect()
+        # That GC collection probably untracked the recycled internal result
+        # tuple, which is initialized to (None, None). Make sure it's re-tracked
+        # when it's mutated and returned from __next__:
+        self.assertTrue(gc.is_tracked(next(it)))
 
 class PurePythonOrderedDictTests(OrderedDictTests, unittest.TestCase):
 
@@ -737,20 +751,21 @@
         size = support.calcobjsize
         check = self.check_sizeof
 
-        basicsize = size('nQ2P' + '3PnPn2P') + calcsize('2nP2n')
+        basicsize = size('nQ2P' + '3PnPn2P')
+        keysize = calcsize('2nP2n')
 
         entrysize = calcsize('n2P')
         p = calcsize('P')
         nodesize = calcsize('Pn2P')
 
         od = OrderedDict()
-        check(od, basicsize + 8 + 5*entrysize)  # 8byte indices + 8*2//3 * entry table
+        check(od, basicsize)  # 8byte indices + 8*2//3 * entry table
         od.x = 1
-        check(od, basicsize + 8 + 5*entrysize)
+        check(od, basicsize)
         od.update([(i, i) for i in range(3)])
-        check(od, basicsize + 8*p + 8 + 5*entrysize + 3*nodesize)
+        check(od, basicsize + keysize + 8*p + 8 + 5*entrysize + 3*nodesize)
         od.update([(i, i) for i in range(3, 10)])
-        check(od, basicsize + 16*p + 16 + 10*entrysize + 10*nodesize)
+        check(od, basicsize + keysize + 16*p + 16 + 10*entrysize + 10*nodesize)
 
         check(od.keys(), size('P'))
         check(od.items(), size('P'))
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index bf1cb5f..7f7d14e 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -2,8 +2,6 @@
 # does add tests for a few functions which have been determined to be more
 # portable than they had been thought to be.
 
-import asynchat
-import asyncore
 import codecs
 import contextlib
 import decimal
@@ -15,10 +13,12 @@
 import mmap
 import os
 import pickle
+import select
 import shutil
 import signal
 import socket
 import stat
+import struct
 import subprocess
 import sys
 import sysconfig
@@ -30,9 +30,18 @@
 import uuid
 import warnings
 from test import support
+from test.support import import_helper
+from test.support import os_helper
 from test.support import socket_helper
+from test.support import threading_helper
+from test.support import warnings_helper
 from platform import win32_is_iot
 
+with warnings.catch_warnings():
+    warnings.simplefilter('ignore', DeprecationWarning)
+    import asynchat
+    import asyncore
+
 try:
     import resource
 except ImportError:
@@ -55,8 +64,10 @@
 except ImportError:
     INT_MAX = PY_SSIZE_T_MAX = sys.maxsize
 
+
 from test.support.script_helper import assert_python_ok
-from test.support import unix_shell, FakePath
+from test.support import unix_shell
+from test.support.os_helper import FakePath
 
 
 root_in_posix = False
@@ -85,6 +96,11 @@
         fp.write(content)
 
 
+# bpo-41625: On AIX, splice() only works with a socket, not with a pipe.
+requires_splice_pipe = unittest.skipIf(sys.platform.startswith("aix"),
+                                       'on AIX, splice() only accepts sockets')
+
+
 class MiscTests(unittest.TestCase):
     def test_getcwd(self):
         cwd = os.getcwd()
@@ -103,12 +119,16 @@
         # than MAX_PATH if long paths support is disabled:
         # see RtlAreLongPathsEnabled().
         min_len = 2000   # characters
+        # On VxWorks, PATH_MAX is defined as 1024 bytes. Creating a path
+        # longer than PATH_MAX will fail.
+        if sys.platform == 'vxworks':
+            min_len = 1000
         dirlen = 200     # characters
         dirname = 'python_test_dir_'
         dirname = dirname + ('a' * (dirlen - len(dirname)))
 
         with tempfile.TemporaryDirectory() as tmpdir:
-            with support.change_cwd(tmpdir) as path:
+            with os_helper.change_cwd(tmpdir) as path:
                 expected = path
 
                 while True:
@@ -152,17 +172,17 @@
 # Tests creating TESTFN
 class FileTests(unittest.TestCase):
     def setUp(self):
-        if os.path.lexists(support.TESTFN):
-            os.unlink(support.TESTFN)
+        if os.path.lexists(os_helper.TESTFN):
+            os.unlink(os_helper.TESTFN)
     tearDown = setUp
 
     def test_access(self):
-        f = os.open(support.TESTFN, os.O_CREAT|os.O_RDWR)
+        f = os.open(os_helper.TESTFN, os.O_CREAT|os.O_RDWR)
         os.close(f)
-        self.assertTrue(os.access(support.TESTFN, os.W_OK))
+        self.assertTrue(os.access(os_helper.TESTFN, os.W_OK))
 
     def test_closerange(self):
-        first = os.open(support.TESTFN, os.O_CREAT|os.O_RDWR)
+        first = os.open(os_helper.TESTFN, os.O_CREAT|os.O_RDWR)
         # We must allocate two consecutive file descriptors, otherwise
         # it will mess up other file descriptors (perhaps even the three
         # standard ones).
@@ -184,14 +204,14 @@
 
     @support.cpython_only
     def test_rename(self):
-        path = support.TESTFN
+        path = os_helper.TESTFN
         old = sys.getrefcount(path)
         self.assertRaises(TypeError, os.rename, path, 0)
         new = sys.getrefcount(path)
         self.assertEqual(old, new)
 
     def test_read(self):
-        with open(support.TESTFN, "w+b") as fobj:
+        with open(os_helper.TESTFN, "w+b") as fobj:
             fobj.write(b"spam")
             fobj.flush()
             fd = fobj.fileno()
@@ -207,12 +227,12 @@
                          "needs INT_MAX < PY_SSIZE_T_MAX")
     @support.bigmemtest(size=INT_MAX + 10, memuse=1, dry_run=False)
     def test_large_read(self, size):
-        self.addCleanup(support.unlink, support.TESTFN)
-        create_file(support.TESTFN, b'test')
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
+        create_file(os_helper.TESTFN, b'test')
 
         # Issue #21932: Make sure that os.read() does not raise an
         # OverflowError for size larger than INT_MAX
-        with open(support.TESTFN, "rb") as fp:
+        with open(os_helper.TESTFN, "rb") as fp:
             data = os.read(fp.fileno(), size)
 
         # The test does not try to read more than 2 GiB at once because the
@@ -221,13 +241,13 @@
 
     def test_write(self):
         # os.write() accepts bytes- and buffer-like objects but not strings
-        fd = os.open(support.TESTFN, os.O_CREAT | os.O_WRONLY)
+        fd = os.open(os_helper.TESTFN, os.O_CREAT | os.O_WRONLY)
         self.assertRaises(TypeError, os.write, fd, "beans")
         os.write(fd, b"bacon\n")
         os.write(fd, bytearray(b"eggs\n"))
         os.write(fd, memoryview(b"spam\n"))
         os.close(fd)
-        with open(support.TESTFN, "rb") as fobj:
+        with open(os_helper.TESTFN, "rb") as fobj:
             self.assertEqual(fobj.read().splitlines(),
                 [b"bacon", b"eggs", b"spam"])
 
@@ -251,12 +271,12 @@
         self.write_windows_console(sys.executable, "-u", "-c", code)
 
     def fdopen_helper(self, *args):
-        fd = os.open(support.TESTFN, os.O_RDONLY)
-        f = os.fdopen(fd, *args)
+        fd = os.open(os_helper.TESTFN, os.O_RDONLY)
+        f = os.fdopen(fd, *args, encoding="utf-8")
         f.close()
 
     def test_fdopen(self):
-        fd = os.open(support.TESTFN, os.O_CREAT|os.O_RDWR)
+        fd = os.open(os_helper.TESTFN, os.O_CREAT|os.O_RDWR)
         os.close(fd)
 
         self.fdopen_helper()
@@ -264,16 +284,16 @@
         self.fdopen_helper('r', 100)
 
     def test_replace(self):
-        TESTFN2 = support.TESTFN + ".2"
-        self.addCleanup(support.unlink, support.TESTFN)
-        self.addCleanup(support.unlink, TESTFN2)
+        TESTFN2 = os_helper.TESTFN + ".2"
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
+        self.addCleanup(os_helper.unlink, TESTFN2)
 
-        create_file(support.TESTFN, b"1")
+        create_file(os_helper.TESTFN, b"1")
         create_file(TESTFN2, b"2")
 
-        os.replace(support.TESTFN, TESTFN2)
-        self.assertRaises(FileNotFoundError, os.stat, support.TESTFN)
-        with open(TESTFN2, 'r') as f:
+        os.replace(os_helper.TESTFN, TESTFN2)
+        self.assertRaises(FileNotFoundError, os.stat, os_helper.TESTFN)
+        with open(TESTFN2, 'r', encoding='utf-8') as f:
             self.assertEqual(f.read(), "1")
 
     def test_open_keywords(self):
@@ -284,7 +304,7 @@
     def test_symlink_keywords(self):
         symlink = support.get_attribute(os, "symlink")
         try:
-            symlink(src='target', dst=support.TESTFN,
+            symlink(src='target', dst=os_helper.TESTFN,
                 target_is_directory=False, dir_fd=None)
         except (NotImplementedError, OSError):
             pass  # No OS support or unprivileged user
@@ -296,18 +316,18 @@
 
     @unittest.skipUnless(hasattr(os, 'copy_file_range'), 'test needs os.copy_file_range()')
     def test_copy_file_range(self):
-        TESTFN2 = support.TESTFN + ".3"
+        TESTFN2 = os_helper.TESTFN + ".3"
         data = b'0123456789'
 
-        create_file(support.TESTFN, data)
-        self.addCleanup(support.unlink, support.TESTFN)
+        create_file(os_helper.TESTFN, data)
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
 
-        in_file = open(support.TESTFN, 'rb')
+        in_file = open(os_helper.TESTFN, 'rb')
         self.addCleanup(in_file.close)
         in_fd = in_file.fileno()
 
         out_file = open(TESTFN2, 'w+b')
-        self.addCleanup(support.unlink, TESTFN2)
+        self.addCleanup(os_helper.unlink, TESTFN2)
         self.addCleanup(out_file.close)
         out_fd = out_file.fileno()
 
@@ -330,21 +350,21 @@
 
     @unittest.skipUnless(hasattr(os, 'copy_file_range'), 'test needs os.copy_file_range()')
     def test_copy_file_range_offset(self):
-        TESTFN4 = support.TESTFN + ".4"
+        TESTFN4 = os_helper.TESTFN + ".4"
         data = b'0123456789'
         bytes_to_copy = 6
         in_skip = 3
         out_seek = 5
 
-        create_file(support.TESTFN, data)
-        self.addCleanup(support.unlink, support.TESTFN)
+        create_file(os_helper.TESTFN, data)
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
 
-        in_file = open(support.TESTFN, 'rb')
+        in_file = open(os_helper.TESTFN, 'rb')
         self.addCleanup(in_file.close)
         in_fd = in_file.fileno()
 
         out_file = open(TESTFN4, 'w+b')
-        self.addCleanup(support.unlink, TESTFN4)
+        self.addCleanup(os_helper.unlink, TESTFN4)
         self.addCleanup(out_file.close)
         out_fd = out_file.fileno()
 
@@ -373,11 +393,131 @@
             self.assertEqual(read[out_seek:],
                              data[in_skip:in_skip+i])
 
+    @unittest.skipUnless(hasattr(os, 'splice'), 'test needs os.splice()')
+    def test_splice_invalid_values(self):
+        with self.assertRaises(ValueError):
+            os.splice(0, 1, -10)
+
+    @unittest.skipUnless(hasattr(os, 'splice'), 'test needs os.splice()')
+    @requires_splice_pipe
+    def test_splice(self):
+        TESTFN2 = os_helper.TESTFN + ".3"
+        data = b'0123456789'
+
+        create_file(os_helper.TESTFN, data)
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
+
+        in_file = open(os_helper.TESTFN, 'rb')
+        self.addCleanup(in_file.close)
+        in_fd = in_file.fileno()
+
+        read_fd, write_fd = os.pipe()
+        self.addCleanup(lambda: os.close(read_fd))
+        self.addCleanup(lambda: os.close(write_fd))
+
+        try:
+            i = os.splice(in_fd, write_fd, 5)
+        except OSError as e:
+            # Handle the case in which Python was compiled
+            # in a system with the syscall but without support
+            # in the kernel.
+            if e.errno != errno.ENOSYS:
+                raise
+            self.skipTest(e)
+        else:
+            # The number of copied bytes can be less than
+            # the number of bytes originally requested.
+            self.assertIn(i, range(0, 6));
+
+            self.assertEqual(os.read(read_fd, 100), data[:i])
+
+    @unittest.skipUnless(hasattr(os, 'splice'), 'test needs os.splice()')
+    @requires_splice_pipe
+    def test_splice_offset_in(self):
+        TESTFN4 = os_helper.TESTFN + ".4"
+        data = b'0123456789'
+        bytes_to_copy = 6
+        in_skip = 3
+
+        create_file(os_helper.TESTFN, data)
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
+
+        in_file = open(os_helper.TESTFN, 'rb')
+        self.addCleanup(in_file.close)
+        in_fd = in_file.fileno()
+
+        read_fd, write_fd = os.pipe()
+        self.addCleanup(lambda: os.close(read_fd))
+        self.addCleanup(lambda: os.close(write_fd))
+
+        try:
+            i = os.splice(in_fd, write_fd, bytes_to_copy, offset_src=in_skip)
+        except OSError as e:
+            # Handle the case in which Python was compiled
+            # in a system with the syscall but without support
+            # in the kernel.
+            if e.errno != errno.ENOSYS:
+                raise
+            self.skipTest(e)
+        else:
+            # The number of copied bytes can be less than
+            # the number of bytes originally requested.
+            self.assertIn(i, range(0, bytes_to_copy+1));
+
+            read = os.read(read_fd, 100)
+            # 012 are skipped (in_skip)
+            # 345678 are copied in the file (in_skip + bytes_to_copy)
+            self.assertEqual(read, data[in_skip:in_skip+i])
+
+    @unittest.skipUnless(hasattr(os, 'splice'), 'test needs os.splice()')
+    @requires_splice_pipe
+    def test_splice_offset_out(self):
+        TESTFN4 = os_helper.TESTFN + ".4"
+        data = b'0123456789'
+        bytes_to_copy = 6
+        out_seek = 3
+
+        create_file(os_helper.TESTFN, data)
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
+
+        read_fd, write_fd = os.pipe()
+        self.addCleanup(lambda: os.close(read_fd))
+        self.addCleanup(lambda: os.close(write_fd))
+        os.write(write_fd, data)
+
+        out_file = open(TESTFN4, 'w+b')
+        self.addCleanup(os_helper.unlink, TESTFN4)
+        self.addCleanup(out_file.close)
+        out_fd = out_file.fileno()
+
+        try:
+            i = os.splice(read_fd, out_fd, bytes_to_copy, offset_dst=out_seek)
+        except OSError as e:
+            # Handle the case in which Python was compiled
+            # in a system with the syscall but without support
+            # in the kernel.
+            if e.errno != errno.ENOSYS:
+                raise
+            self.skipTest(e)
+        else:
+            # The number of copied bytes can be less than
+            # the number of bytes originally requested.
+            self.assertIn(i, range(0, bytes_to_copy+1));
+
+            with open(TESTFN4, 'rb') as in_file:
+                read = in_file.read()
+            # seeked bytes (5) are zero'ed
+            self.assertEqual(read[:out_seek], b'\x00'*out_seek)
+            # 012 are skipped (in_skip)
+            # 345678 are copied in the file (in_skip + bytes_to_copy)
+            self.assertEqual(read[out_seek:], data[:i])
+
+
 # Test attributes on return values from os.*stat* family.
 class StatAttributeTests(unittest.TestCase):
     def setUp(self):
-        self.fname = support.TESTFN
-        self.addCleanup(support.unlink, self.fname)
+        self.fname = os_helper.TESTFN
+        self.addCleanup(os_helper.unlink, self.fname)
         create_file(self.fname, b"ABC")
 
     def check_stat_attributes(self, fname):
@@ -562,7 +702,7 @@
             0)
 
         # test directory st_file_attributes (FILE_ATTRIBUTE_DIRECTORY set)
-        dirname = support.TESTFN + "dir"
+        dirname = os_helper.TESTFN + "dir"
         os.mkdir(dirname)
         self.addCleanup(os.rmdir, dirname)
 
@@ -579,7 +719,7 @@
         # os.environ['TEMP'] should be located on a volume that
         # supports file ACLs.
         fname = os.path.join(os.environ['TEMP'], self.fname)
-        self.addCleanup(support.unlink, fname)
+        self.addCleanup(os_helper.unlink, fname)
         create_file(fname, b'ABC')
         # Deny the right to [S]YNCHRONIZE on the file to
         # force CreateFile to fail with ERROR_ACCESS_DENIED.
@@ -604,10 +744,10 @@
 
 class UtimeTests(unittest.TestCase):
     def setUp(self):
-        self.dirname = support.TESTFN
+        self.dirname = os_helper.TESTFN
         self.fname = os.path.join(self.dirname, "f1")
 
-        self.addCleanup(support.rmtree, self.dirname)
+        self.addCleanup(os_helper.rmtree, self.dirname)
         os.mkdir(self.dirname)
         create_file(self.fname)
 
@@ -708,12 +848,9 @@
     def test_utime_dir_fd(self):
         def set_time(filename, ns):
             dirname, name = os.path.split(filename)
-            dirfd = os.open(dirname, os.O_RDONLY)
-            try:
+            with os_helper.open_dir_fd(dirname) as dirfd:
                 # pass dir_fd to test utimensat(timespec) or futimesat(timeval)
                 os.utime(name, dir_fd=dirfd, ns=ns)
-            finally:
-                os.close(dirfd)
         self._test_utime(set_time)
 
     def test_utime_directory(self):
@@ -854,6 +991,7 @@
     # Bug 1110478
     @unittest.skipUnless(unix_shell and os.path.exists(unix_shell),
                          'requires a shell')
+    @unittest.skipUnless(hasattr(os, 'popen'), "needs os.popen()")
     def test_update2(self):
         os.environ.clear()
         os.environ.update(HELLO="World")
@@ -863,6 +1001,7 @@
 
     @unittest.skipUnless(unix_shell and os.path.exists(unix_shell),
                          'requires a shell')
+    @unittest.skipUnless(hasattr(os, 'popen'), "needs os.popen()")
     def test_os_popen_iter(self):
         with os.popen("%s -c 'echo \"line1\nline2\nline3\"'"
                       % unix_shell) as popen:
@@ -960,7 +1099,7 @@
         value = "testvalue"
         code = f'import os; print(repr(os.environ.get({name!r})))'
 
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env.pop(name, None)
 
             os.putenv(name, value)
@@ -1131,7 +1270,7 @@
 
     def setUp(self):
         join = os.path.join
-        self.addCleanup(support.rmtree, support.TESTFN)
+        self.addCleanup(os_helper.rmtree, os_helper.TESTFN)
 
         # Build:
         #     TESTFN/
@@ -1150,7 +1289,7 @@
         #           broken_link3
         #       TEST2/
         #         tmp4              a lone file
-        self.walk_path = join(support.TESTFN, "TEST1")
+        self.walk_path = join(os_helper.TESTFN, "TEST1")
         self.sub1_path = join(self.walk_path, "SUB1")
         self.sub11_path = join(self.sub1_path, "SUB11")
         sub2_path = join(self.walk_path, "SUB2")
@@ -1160,8 +1299,8 @@
         tmp3_path = join(sub2_path, "tmp3")
         tmp5_path = join(sub21_path, "tmp3")
         self.link_path = join(sub2_path, "link")
-        t2_path = join(support.TESTFN, "TEST2")
-        tmp4_path = join(support.TESTFN, "TEST2", "tmp4")
+        t2_path = join(os_helper.TESTFN, "TEST2")
+        tmp4_path = join(os_helper.TESTFN, "TEST2", "tmp4")
         broken_link_path = join(sub2_path, "broken_link")
         broken_link2_path = join(sub2_path, "broken_link2")
         broken_link3_path = join(sub2_path, "broken_link3")
@@ -1176,7 +1315,7 @@
             with open(path, "x", encoding='utf-8') as f:
                 f.write("I'm " + path + " and proud of it.  Blame test_os.\n")
 
-        if support.can_symlink():
+        if os_helper.can_symlink():
             os.symlink(os.path.abspath(t2_path), self.link_path)
             os.symlink('broken', broken_link_path, True)
             os.symlink(join('tmp3', 'broken'), broken_link2_path, True)
@@ -1259,7 +1398,7 @@
                          self.sub2_tree)
 
     def test_walk_symlink(self):
-        if not support.can_symlink():
+        if not os_helper.can_symlink():
             self.skipTest("need symlink support")
 
         # Walk, following symlinks.
@@ -1295,7 +1434,7 @@
 
     def test_walk_many_open_files(self):
         depth = 30
-        base = os.path.join(support.TESTFN, 'deep')
+        base = os.path.join(os_helper.TESTFN, 'deep')
         p = os.path.join(base, *(['d']*depth))
         os.makedirs(p)
 
@@ -1345,13 +1484,13 @@
                 self.assertEqual(expected[root], (set(dirs), set(files)))
 
     def test_compare_to_walk(self):
-        kwargs = {'top': support.TESTFN}
+        kwargs = {'top': os_helper.TESTFN}
         self._compare_to_walk(kwargs, kwargs)
 
     def test_dir_fd(self):
         try:
             fd = os.open(".", os.O_RDONLY)
-            walk_kwargs = {'top': support.TESTFN}
+            walk_kwargs = {'top': os_helper.TESTFN}
             fwalk_kwargs = walk_kwargs.copy()
             fwalk_kwargs['dir_fd'] = fd
             self._compare_to_walk(walk_kwargs, fwalk_kwargs)
@@ -1361,7 +1500,7 @@
     def test_yields_correct_dir_fd(self):
         # check returned file descriptors
         for topdown, follow_symlinks in itertools.product((True, False), repeat=2):
-            args = support.TESTFN, topdown, None
+            args = os_helper.TESTFN, topdown, None
             for root, dirs, files, rootfd in self.fwalk(*args, follow_symlinks=follow_symlinks):
                 # check that the FD is valid
                 os.fstat(rootfd)
@@ -1377,7 +1516,7 @@
         minfd = os.dup(1)
         os.close(minfd)
         for i in range(256):
-            for x in self.fwalk(support.TESTFN):
+            for x in self.fwalk(os_helper.TESTFN):
                 pass
         newfd = os.dup(1)
         self.addCleanup(os.close, newfd)
@@ -1415,10 +1554,10 @@
 
 class MakedirTests(unittest.TestCase):
     def setUp(self):
-        os.mkdir(support.TESTFN)
+        os.mkdir(os_helper.TESTFN)
 
     def test_makedir(self):
-        base = support.TESTFN
+        base = os_helper.TESTFN
         path = os.path.join(base, 'dir1', 'dir2', 'dir3')
         os.makedirs(path)             # Should work
         path = os.path.join(base, 'dir1', 'dir2', 'dir3', 'dir4')
@@ -1433,8 +1572,8 @@
         os.makedirs(path)
 
     def test_mode(self):
-        with support.temp_umask(0o002):
-            base = support.TESTFN
+        with os_helper.temp_umask(0o002):
+            base = os_helper.TESTFN
             parent = os.path.join(base, 'dir1')
             path = os.path.join(parent, 'dir2')
             os.makedirs(path, 0o555)
@@ -1445,7 +1584,7 @@
                 self.assertEqual(os.stat(parent).st_mode & 0o777, 0o775)
 
     def test_exist_ok_existing_directory(self):
-        path = os.path.join(support.TESTFN, 'dir1')
+        path = os.path.join(os_helper.TESTFN, 'dir1')
         mode = 0o777
         old_mask = os.umask(0o022)
         os.makedirs(path, mode)
@@ -1459,18 +1598,18 @@
         os.makedirs(os.path.abspath('/'), exist_ok=True)
 
     def test_exist_ok_s_isgid_directory(self):
-        path = os.path.join(support.TESTFN, 'dir1')
+        path = os.path.join(os_helper.TESTFN, 'dir1')
         S_ISGID = stat.S_ISGID
         mode = 0o777
         old_mask = os.umask(0o022)
         try:
             existing_testfn_mode = stat.S_IMODE(
-                    os.lstat(support.TESTFN).st_mode)
+                    os.lstat(os_helper.TESTFN).st_mode)
             try:
-                os.chmod(support.TESTFN, existing_testfn_mode | S_ISGID)
+                os.chmod(os_helper.TESTFN, existing_testfn_mode | S_ISGID)
             except PermissionError:
                 raise unittest.SkipTest('Cannot set S_ISGID for dir.')
-            if (os.lstat(support.TESTFN).st_mode & S_ISGID != S_ISGID):
+            if (os.lstat(os_helper.TESTFN).st_mode & S_ISGID != S_ISGID):
                 raise unittest.SkipTest('No support for S_ISGID dir mode.')
             # The os should apply S_ISGID from the parent dir for us, but
             # this test need not depend on that behavior.  Be explicit.
@@ -1486,9 +1625,9 @@
             os.umask(old_mask)
 
     def test_exist_ok_existing_regular_file(self):
-        base = support.TESTFN
-        path = os.path.join(support.TESTFN, 'dir1')
-        with open(path, 'w') as f:
+        base = os_helper.TESTFN
+        path = os.path.join(os_helper.TESTFN, 'dir1')
+        with open(path, 'w', encoding='utf-8') as f:
             f.write('abc')
         self.assertRaises(OSError, os.makedirs, path)
         self.assertRaises(OSError, os.makedirs, path, exist_ok=False)
@@ -1496,12 +1635,12 @@
         os.remove(path)
 
     def tearDown(self):
-        path = os.path.join(support.TESTFN, 'dir1', 'dir2', 'dir3',
+        path = os.path.join(os_helper.TESTFN, 'dir1', 'dir2', 'dir3',
                             'dir4', 'dir5', 'dir6')
         # If the tests failed, the bottom-most directory ('../dir6')
         # may not have been created, so we look for the outermost directory
         # that exists.
-        while not os.path.exists(path) and path != support.TESTFN:
+        while not os.path.exists(path) and path != os_helper.TESTFN:
             path = os.path.dirname(path)
 
         os.removedirs(path)
@@ -1512,17 +1651,17 @@
 
     @classmethod
     def setUpClass(cls):
-        os.mkdir(support.TESTFN)
+        os.mkdir(os_helper.TESTFN)
 
     def test_chown_uid_gid_arguments_must_be_index(self):
-        stat = os.stat(support.TESTFN)
+        stat = os.stat(os_helper.TESTFN)
         uid = stat.st_uid
         gid = stat.st_gid
         for value in (-1.0, -1j, decimal.Decimal(-1), fractions.Fraction(-2, 2)):
-            self.assertRaises(TypeError, os.chown, support.TESTFN, value, gid)
-            self.assertRaises(TypeError, os.chown, support.TESTFN, uid, value)
-        self.assertIsNone(os.chown(support.TESTFN, uid, gid))
-        self.assertIsNone(os.chown(support.TESTFN, -1, -1))
+            self.assertRaises(TypeError, os.chown, os_helper.TESTFN, value, gid)
+            self.assertRaises(TypeError, os.chown, os_helper.TESTFN, uid, value)
+        self.assertIsNone(os.chown(os_helper.TESTFN, uid, gid))
+        self.assertIsNone(os.chown(os_helper.TESTFN, -1, -1))
 
     @unittest.skipUnless(hasattr(os, 'getgroups'), 'need os.getgroups')
     def test_chown_gid(self):
@@ -1531,61 +1670,61 @@
             self.skipTest("test needs at least 2 groups")
 
         gid_1, gid_2 = groups[:2]
-        uid = os.stat(support.TESTFN).st_uid
+        uid = os.stat(os_helper.TESTFN).st_uid
 
-        os.chown(support.TESTFN, uid, gid_1)
-        gid = os.stat(support.TESTFN).st_gid
+        os.chown(os_helper.TESTFN, uid, gid_1)
+        gid = os.stat(os_helper.TESTFN).st_gid
         self.assertEqual(gid, gid_1)
 
-        os.chown(support.TESTFN, uid, gid_2)
-        gid = os.stat(support.TESTFN).st_gid
+        os.chown(os_helper.TESTFN, uid, gid_2)
+        gid = os.stat(os_helper.TESTFN).st_gid
         self.assertEqual(gid, gid_2)
 
     @unittest.skipUnless(root_in_posix and len(all_users) > 1,
                          "test needs root privilege and more than one user")
     def test_chown_with_root(self):
         uid_1, uid_2 = all_users[:2]
-        gid = os.stat(support.TESTFN).st_gid
-        os.chown(support.TESTFN, uid_1, gid)
-        uid = os.stat(support.TESTFN).st_uid
+        gid = os.stat(os_helper.TESTFN).st_gid
+        os.chown(os_helper.TESTFN, uid_1, gid)
+        uid = os.stat(os_helper.TESTFN).st_uid
         self.assertEqual(uid, uid_1)
-        os.chown(support.TESTFN, uid_2, gid)
-        uid = os.stat(support.TESTFN).st_uid
+        os.chown(os_helper.TESTFN, uid_2, gid)
+        uid = os.stat(os_helper.TESTFN).st_uid
         self.assertEqual(uid, uid_2)
 
     @unittest.skipUnless(not root_in_posix and len(all_users) > 1,
                          "test needs non-root account and more than one user")
     def test_chown_without_permission(self):
         uid_1, uid_2 = all_users[:2]
-        gid = os.stat(support.TESTFN).st_gid
+        gid = os.stat(os_helper.TESTFN).st_gid
         with self.assertRaises(PermissionError):
-            os.chown(support.TESTFN, uid_1, gid)
-            os.chown(support.TESTFN, uid_2, gid)
+            os.chown(os_helper.TESTFN, uid_1, gid)
+            os.chown(os_helper.TESTFN, uid_2, gid)
 
     @classmethod
     def tearDownClass(cls):
-        os.rmdir(support.TESTFN)
+        os.rmdir(os_helper.TESTFN)
 
 
 class RemoveDirsTests(unittest.TestCase):
     def setUp(self):
-        os.makedirs(support.TESTFN)
+        os.makedirs(os_helper.TESTFN)
 
     def tearDown(self):
-        support.rmtree(support.TESTFN)
+        os_helper.rmtree(os_helper.TESTFN)
 
     def test_remove_all(self):
-        dira = os.path.join(support.TESTFN, 'dira')
+        dira = os.path.join(os_helper.TESTFN, 'dira')
         os.mkdir(dira)
         dirb = os.path.join(dira, 'dirb')
         os.mkdir(dirb)
         os.removedirs(dirb)
         self.assertFalse(os.path.exists(dirb))
         self.assertFalse(os.path.exists(dira))
-        self.assertFalse(os.path.exists(support.TESTFN))
+        self.assertFalse(os.path.exists(os_helper.TESTFN))
 
     def test_remove_partial(self):
-        dira = os.path.join(support.TESTFN, 'dira')
+        dira = os.path.join(os_helper.TESTFN, 'dira')
         os.mkdir(dira)
         dirb = os.path.join(dira, 'dirb')
         os.mkdir(dirb)
@@ -1593,10 +1732,10 @@
         os.removedirs(dirb)
         self.assertFalse(os.path.exists(dirb))
         self.assertTrue(os.path.exists(dira))
-        self.assertTrue(os.path.exists(support.TESTFN))
+        self.assertTrue(os.path.exists(os_helper.TESTFN))
 
     def test_remove_nothing(self):
-        dira = os.path.join(support.TESTFN, 'dira')
+        dira = os.path.join(os_helper.TESTFN, 'dira')
         os.mkdir(dira)
         dirb = os.path.join(dira, 'dirb')
         os.mkdir(dirb)
@@ -1605,7 +1744,7 @@
             os.removedirs(dirb)
         self.assertTrue(os.path.exists(dirb))
         self.assertTrue(os.path.exists(dira))
-        self.assertTrue(os.path.exists(support.TESTFN))
+        self.assertTrue(os.path.exists(os_helper.TESTFN))
 
 
 class DevNullTests(unittest.TestCase):
@@ -1743,8 +1882,8 @@
     def test_urandom_fd_reopened(self):
         # Issue #21207: urandom() should detect its fd to /dev/urandom
         # changed to something else, and reopen it.
-        self.addCleanup(support.unlink, support.TESTFN)
-        create_file(support.TESTFN, b"x" * 256)
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
+        create_file(os_helper.TESTFN, b"x" * 256)
 
         code = """if 1:
             import os
@@ -1770,7 +1909,7 @@
                     os.dup2(new_fd, fd)
                 sys.stdout.buffer.write(os.urandom(4))
                 sys.stdout.buffer.write(os.urandom(4))
-            """.format(TESTFN=support.TESTFN)
+            """.format(TESTFN=os_helper.TESTFN)
         rc, out, err = assert_python_ok('-Sc', code)
         self.assertEqual(len(out), 8)
         self.assertNotEqual(out[0:4], out[4:8])
@@ -1922,40 +2061,40 @@
 class Win32ErrorTests(unittest.TestCase):
     def setUp(self):
         try:
-            os.stat(support.TESTFN)
+            os.stat(os_helper.TESTFN)
         except FileNotFoundError:
             exists = False
         except OSError as exc:
             exists = True
             self.fail("file %s must not exist; os.stat failed with %s"
-                      % (support.TESTFN, exc))
+                      % (os_helper.TESTFN, exc))
         else:
-            self.fail("file %s must not exist" % support.TESTFN)
+            self.fail("file %s must not exist" % os_helper.TESTFN)
 
     def test_rename(self):
-        self.assertRaises(OSError, os.rename, support.TESTFN, support.TESTFN+".bak")
+        self.assertRaises(OSError, os.rename, os_helper.TESTFN, os_helper.TESTFN+".bak")
 
     def test_remove(self):
-        self.assertRaises(OSError, os.remove, support.TESTFN)
+        self.assertRaises(OSError, os.remove, os_helper.TESTFN)
 
     def test_chdir(self):
-        self.assertRaises(OSError, os.chdir, support.TESTFN)
+        self.assertRaises(OSError, os.chdir, os_helper.TESTFN)
 
     def test_mkdir(self):
-        self.addCleanup(support.unlink, support.TESTFN)
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
 
-        with open(support.TESTFN, "x") as f:
-            self.assertRaises(OSError, os.mkdir, support.TESTFN)
+        with open(os_helper.TESTFN, "x") as f:
+            self.assertRaises(OSError, os.mkdir, os_helper.TESTFN)
 
     def test_utime(self):
-        self.assertRaises(OSError, os.utime, support.TESTFN, None)
+        self.assertRaises(OSError, os.utime, os_helper.TESTFN, None)
 
     def test_chmod(self):
-        self.assertRaises(OSError, os.chmod, support.TESTFN, 0)
+        self.assertRaises(OSError, os.chmod, os_helper.TESTFN, 0)
 
 
 class TestInvalidFD(unittest.TestCase):
-    singles = ["fchdir", "dup", "fdopen", "fdatasync", "fstat",
+    singles = ["fchdir", "dup", "fdatasync", "fstat",
                "fstatvfs", "fsync", "tcgetpgrp", "ttyname"]
     #singles.append("close")
     #We omit close because it doesn't raise an exception on some platforms
@@ -1967,22 +2106,25 @@
     for f in singles:
         locals()["test_"+f] = get_single(f)
 
-    def check(self, f, *args):
+    def check(self, f, *args, **kwargs):
         try:
-            f(support.make_bad_fd(), *args)
+            f(os_helper.make_bad_fd(), *args, **kwargs)
         except OSError as e:
             self.assertEqual(e.errno, errno.EBADF)
         else:
             self.fail("%r didn't raise an OSError with a bad file descriptor"
                       % f)
 
+    def test_fdopen(self):
+        self.check(os.fdopen, encoding="utf-8")
+
     @unittest.skipUnless(hasattr(os, 'isatty'), 'test needs os.isatty()')
     def test_isatty(self):
-        self.assertEqual(os.isatty(support.make_bad_fd()), False)
+        self.assertEqual(os.isatty(os_helper.make_bad_fd()), False)
 
     @unittest.skipUnless(hasattr(os, 'closerange'), 'test needs os.closerange()')
     def test_closerange(self):
-        fd = support.make_bad_fd()
+        fd = os_helper.make_bad_fd()
         # Make sure none of the descriptors we are about to close are
         # currently valid (issue 6542).
         for i in range(10):
@@ -2056,8 +2198,8 @@
 
 class LinkTests(unittest.TestCase):
     def setUp(self):
-        self.file1 = support.TESTFN
-        self.file2 = os.path.join(support.TESTFN + "2")
+        self.file1 = os_helper.TESTFN
+        self.file2 = os.path.join(os_helper.TESTFN + "2")
 
     def tearDown(self):
         for file in (self.file1, self.file2):
@@ -2071,7 +2213,7 @@
             os.link(file1, file2)
         except PermissionError as e:
             self.skipTest('os.link(): %s' % e)
-        with open(file1, "r") as f1, open(file2, "r") as f2:
+        with open(file1, "rb") as f1, open(file2, "rb") as f2:
             self.assertTrue(os.path.sameopenfile(f1.fileno(), f2.fileno()))
 
     def test_link(self):
@@ -2162,12 +2304,12 @@
 @unittest.skipIf(sys.platform == "win32", "Posix specific tests")
 class Pep383Tests(unittest.TestCase):
     def setUp(self):
-        if support.TESTFN_UNENCODABLE:
-            self.dir = support.TESTFN_UNENCODABLE
-        elif support.TESTFN_NONASCII:
-            self.dir = support.TESTFN_NONASCII
+        if os_helper.TESTFN_UNENCODABLE:
+            self.dir = os_helper.TESTFN_UNENCODABLE
+        elif os_helper.TESTFN_NONASCII:
+            self.dir = os_helper.TESTFN_NONASCII
         else:
-            self.dir = support.TESTFN
+            self.dir = os_helper.TESTFN
         self.bdir = os.fsencode(self.dir)
 
         bytesfn = []
@@ -2177,11 +2319,11 @@
             except UnicodeEncodeError:
                 return
             bytesfn.append(fn)
-        add_filename(support.TESTFN_UNICODE)
-        if support.TESTFN_UNENCODABLE:
-            add_filename(support.TESTFN_UNENCODABLE)
-        if support.TESTFN_NONASCII:
-            add_filename(support.TESTFN_NONASCII)
+        add_filename(os_helper.TESTFN_UNICODE)
+        if os_helper.TESTFN_UNENCODABLE:
+            add_filename(os_helper.TESTFN_UNENCODABLE)
+        if os_helper.TESTFN_NONASCII:
+            add_filename(os_helper.TESTFN_NONASCII)
         if not bytesfn:
             self.skipTest("couldn't create any non-ascii filename")
 
@@ -2189,7 +2331,7 @@
         os.mkdir(self.dir)
         try:
             for fn in bytesfn:
-                support.create_empty_file(os.path.join(self.bdir, fn))
+                os_helper.create_empty_file(os.path.join(self.bdir, fn))
                 fn = os.fsdecode(fn)
                 if fn in self.unicodefn:
                     raise ValueError("duplicate filename")
@@ -2355,9 +2497,9 @@
         self.created_paths = []
         for i in range(2):
             dir_name = 'SUB%d' % i
-            dir_path = os.path.join(support.TESTFN, dir_name)
+            dir_path = os.path.join(os_helper.TESTFN, dir_name)
             file_name = 'FILE%d' % i
-            file_path = os.path.join(support.TESTFN, file_name)
+            file_path = os.path.join(os_helper.TESTFN, file_name)
             os.makedirs(dir_path)
             with open(file_path, 'w', encoding='utf-8') as f:
                 f.write("I'm %s and proud of it. Blame test_os.\n" % file_path)
@@ -2365,31 +2507,31 @@
         self.created_paths.sort()
 
     def tearDown(self):
-        shutil.rmtree(support.TESTFN)
+        shutil.rmtree(os_helper.TESTFN)
 
     def test_listdir_no_extended_path(self):
         """Test when the path is not an "extended" path."""
         # unicode
         self.assertEqual(
-                sorted(os.listdir(support.TESTFN)),
+                sorted(os.listdir(os_helper.TESTFN)),
                 self.created_paths)
 
         # bytes
         self.assertEqual(
-                sorted(os.listdir(os.fsencode(support.TESTFN))),
+                sorted(os.listdir(os.fsencode(os_helper.TESTFN))),
                 [os.fsencode(path) for path in self.created_paths])
 
     def test_listdir_extended_path(self):
         """Test when the path starts with '\\\\?\\'."""
         # See: http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#maxpath
         # unicode
-        path = '\\\\?\\' + os.path.abspath(support.TESTFN)
+        path = '\\\\?\\' + os.path.abspath(os_helper.TESTFN)
         self.assertEqual(
                 sorted(os.listdir(path)),
                 self.created_paths)
 
         # bytes
-        path = b'\\\\?\\' + os.fsencode(os.path.abspath(support.TESTFN))
+        path = b'\\\\?\\' + os.fsencode(os.path.abspath(os_helper.TESTFN))
         self.assertEqual(
                 sorted(os.listdir(path)),
                 [os.fsencode(path) for path in self.created_paths])
@@ -2432,32 +2574,32 @@
         self.assertRaises(FileNotFoundError, os.readlink,
                           FakePath('missing-link'))
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_pathlike(self):
         os.symlink(self.filelink_target, self.filelink)
-        self.addCleanup(support.unlink, self.filelink)
+        self.addCleanup(os_helper.unlink, self.filelink)
         filelink = FakePath(self.filelink)
         self.assertPathEqual(os.readlink(filelink), self.filelink_target)
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_pathlike_bytes(self):
         os.symlink(self.filelinkb_target, self.filelinkb)
-        self.addCleanup(support.unlink, self.filelinkb)
+        self.addCleanup(os_helper.unlink, self.filelinkb)
         path = os.readlink(FakePath(self.filelinkb))
         self.assertPathEqual(path, self.filelinkb_target)
         self.assertIsInstance(path, bytes)
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_bytes(self):
         os.symlink(self.filelinkb_target, self.filelinkb)
-        self.addCleanup(support.unlink, self.filelinkb)
+        self.addCleanup(os_helper.unlink, self.filelinkb)
         path = os.readlink(self.filelinkb)
         self.assertPathEqual(path, self.filelinkb_target)
         self.assertIsInstance(path, bytes)
 
 
 @unittest.skipUnless(sys.platform == "win32", "Win32 specific tests")
-@support.skip_unless_symlink
+@os_helper.skip_unless_symlink
 class Win32SymlinkTests(unittest.TestCase):
     filelink = 'filelinktest'
     filelink_target = os.path.abspath(__file__)
@@ -2528,10 +2670,10 @@
         self.assertNotEqual(os.lstat(bytes_link), os.stat(bytes_link))
 
     def test_12084(self):
-        level1 = os.path.abspath(support.TESTFN)
+        level1 = os.path.abspath(os_helper.TESTFN)
         level2 = os.path.join(level1, "level2")
         level3 = os.path.join(level2, "level3")
-        self.addCleanup(support.rmtree, level1)
+        self.addCleanup(os_helper.rmtree, level1)
 
         os.mkdir(level1)
         os.mkdir(level2)
@@ -2670,8 +2812,8 @@
 @unittest.skipUnless(sys.platform == "win32", "Win32 specific tests")
 class Win32NtTests(unittest.TestCase):
     def test_getfinalpathname_handles(self):
-        nt = support.import_module('nt')
-        ctypes = support.import_module('ctypes')
+        nt = import_helper.import_module('nt')
+        ctypes = import_helper.import_module('ctypes')
         import ctypes.wintypes
 
         kernel = ctypes.WinDLL('Kernel32.dll', use_last_error=True)
@@ -2717,7 +2859,7 @@
 
         self.assertEqual(0, handle_delta)
 
-@support.skip_unless_symlink
+@os_helper.skip_unless_symlink
 class NonLocalSymlinkTests(unittest.TestCase):
 
     def setUp(self):
@@ -2856,8 +2998,8 @@
     def create_args(self, *, with_env=False, use_bytes=False):
         self.exitcode = 17
 
-        filename = support.TESTFN
-        self.addCleanup(support.unlink, filename)
+        filename = os_helper.TESTFN
+        self.addCleanup(os_helper.unlink, filename)
 
         if not with_env:
             code = 'import sys; sys.exit(%s)' % self.exitcode
@@ -2870,7 +3012,7 @@
             code = ('import sys, os; magic = os.environ[%r]; sys.exit(%s)'
                     % (self.key, self.exitcode))
 
-        with open(filename, "w") as fp:
+        with open(filename, "w", encoding="utf-8") as fp:
             fp.write(code)
 
         args = [sys.executable, filename]
@@ -3008,9 +3150,9 @@
             self.assertEqual(exitcode, 127)
 
         # equal character in the environment variable value
-        filename = support.TESTFN
-        self.addCleanup(support.unlink, filename)
-        with open(filename, "w") as fp:
+        filename = os_helper.TESTFN
+        self.addCleanup(os_helper.unlink, filename)
+        with open(filename, "w", encoding="utf-8") as fp:
             fp.write('import sys, os\n'
                      'if os.getenv("FRUIT") != "orange=lemon":\n'
                      '    raise AssertionError')
@@ -3163,13 +3305,13 @@
 
     @classmethod
     def setUpClass(cls):
-        cls.key = support.threading_setup()
-        create_file(support.TESTFN, cls.DATA)
+        cls.key = threading_helper.threading_setup()
+        create_file(os_helper.TESTFN, cls.DATA)
 
     @classmethod
     def tearDownClass(cls):
-        support.threading_cleanup(*cls.key)
-        support.unlink(support.TESTFN)
+        threading_helper.threading_cleanup(*cls.key)
+        os_helper.unlink(os_helper.TESTFN)
 
     def setUp(self):
         self.server = SendfileTestServer((socket_helper.HOST, 0))
@@ -3180,7 +3322,7 @@
         # synchronize by waiting for "220 ready" response
         self.client.recv(1024)
         self.sockno = self.client.fileno()
-        self.file = open(support.TESTFN, 'rb')
+        self.file = open(os_helper.TESTFN, 'rb')
         self.fileno = self.file.fileno()
 
     def tearDown(self):
@@ -3312,10 +3454,10 @@
 
     @requires_headers_trailers
     def test_trailers(self):
-        TESTFN2 = support.TESTFN + "2"
+        TESTFN2 = os_helper.TESTFN + "2"
         file_data = b"abcdef"
 
-        self.addCleanup(support.unlink, TESTFN2)
+        self.addCleanup(os_helper.unlink, TESTFN2)
         create_file(TESTFN2, file_data)
 
         with open(TESTFN2, 'rb') as f:
@@ -3361,13 +3503,13 @@
         return False
 
     try:
-        with open(support.TESTFN, "xb", 0) as fp:
+        with open(os_helper.TESTFN, "xb", 0) as fp:
             try:
                 os.setxattr(fp.fileno(), b"user.test", b"")
             except OSError:
                 return False
     finally:
-        support.unlink(support.TESTFN)
+        os_helper.unlink(os_helper.TESTFN)
 
     return True
 
@@ -3379,8 +3521,8 @@
 class ExtendedAttributeTests(unittest.TestCase):
 
     def _check_xattrs_str(self, s, getxattr, setxattr, removexattr, listxattr, **kwargs):
-        fn = support.TESTFN
-        self.addCleanup(support.unlink, fn)
+        fn = os_helper.TESTFN
+        self.addCleanup(os_helper.unlink, fn)
         create_file(fn)
 
         with self.assertRaises(OSError) as cm:
@@ -3428,10 +3570,10 @@
 
     def _check_xattrs(self, *args, **kwargs):
         self._check_xattrs_str(str, *args, **kwargs)
-        support.unlink(support.TESTFN)
+        os_helper.unlink(os_helper.TESTFN)
 
         self._check_xattrs_str(os.fsencode, *args, **kwargs)
-        support.unlink(support.TESTFN)
+        os_helper.unlink(os_helper.TESTFN)
 
     def test_simple(self):
         self._check_xattrs(os.getxattr, os.setxattr, os.removexattr,
@@ -3523,6 +3665,89 @@
         self.assertFalse(os.get_inheritable(fd2))
 
 
+@unittest.skipUnless(hasattr(os, 'eventfd'), 'requires os.eventfd')
+@support.requires_linux_version(2, 6, 30)
+class EventfdTests(unittest.TestCase):
+    def test_eventfd_initval(self):
+        def pack(value):
+            """Pack as native uint64_t
+            """
+            return struct.pack("@Q", value)
+        size = 8  # read/write 8 bytes
+        initval = 42
+        fd = os.eventfd(initval)
+        self.assertNotEqual(fd, -1)
+        self.addCleanup(os.close, fd)
+        self.assertFalse(os.get_inheritable(fd))
+
+        # test with raw read/write
+        res = os.read(fd, size)
+        self.assertEqual(res, pack(initval))
+
+        os.write(fd, pack(23))
+        res = os.read(fd, size)
+        self.assertEqual(res, pack(23))
+
+        os.write(fd, pack(40))
+        os.write(fd, pack(2))
+        res = os.read(fd, size)
+        self.assertEqual(res, pack(42))
+
+        # test with eventfd_read/eventfd_write
+        os.eventfd_write(fd, 20)
+        os.eventfd_write(fd, 3)
+        res = os.eventfd_read(fd)
+        self.assertEqual(res, 23)
+
+    def test_eventfd_semaphore(self):
+        initval = 2
+        flags = os.EFD_CLOEXEC | os.EFD_SEMAPHORE | os.EFD_NONBLOCK
+        fd = os.eventfd(initval, flags)
+        self.assertNotEqual(fd, -1)
+        self.addCleanup(os.close, fd)
+
+        # semaphore starts has initval 2, two reads return '1'
+        res = os.eventfd_read(fd)
+        self.assertEqual(res, 1)
+        res = os.eventfd_read(fd)
+        self.assertEqual(res, 1)
+        # third read would block
+        with self.assertRaises(BlockingIOError):
+            os.eventfd_read(fd)
+        with self.assertRaises(BlockingIOError):
+            os.read(fd, 8)
+
+        # increase semaphore counter, read one
+        os.eventfd_write(fd, 1)
+        res = os.eventfd_read(fd)
+        self.assertEqual(res, 1)
+        # next read would block, too
+        with self.assertRaises(BlockingIOError):
+            os.eventfd_read(fd)
+
+    def test_eventfd_select(self):
+        flags = os.EFD_CLOEXEC | os.EFD_NONBLOCK
+        fd = os.eventfd(0, flags)
+        self.assertNotEqual(fd, -1)
+        self.addCleanup(os.close, fd)
+
+        # counter is zero, only writeable
+        rfd, wfd, xfd = select.select([fd], [fd], [fd], 0)
+        self.assertEqual((rfd, wfd, xfd), ([], [fd], []))
+
+        # counter is non-zero, read and writeable
+        os.eventfd_write(fd, 23)
+        rfd, wfd, xfd = select.select([fd], [fd], [fd], 0)
+        self.assertEqual((rfd, wfd, xfd), ([fd], [fd], []))
+        self.assertEqual(os.eventfd_read(fd), 23)
+
+        # counter at max, only readable
+        os.eventfd_write(fd, (2**64) - 2)
+        rfd, wfd, xfd = select.select([fd], [fd], [fd], 0)
+        self.assertEqual((rfd, wfd, xfd), ([fd], [], []))
+        os.eventfd_read(fd)
+
+
 class OSErrorTests(unittest.TestCase):
     def setUp(self):
         class Str(str):
@@ -3530,16 +3755,16 @@
 
         self.bytes_filenames = []
         self.unicode_filenames = []
-        if support.TESTFN_UNENCODABLE is not None:
-            decoded = support.TESTFN_UNENCODABLE
+        if os_helper.TESTFN_UNENCODABLE is not None:
+            decoded = os_helper.TESTFN_UNENCODABLE
         else:
-            decoded = support.TESTFN
+            decoded = os_helper.TESTFN
         self.unicode_filenames.append(decoded)
         self.unicode_filenames.append(Str(decoded))
-        if support.TESTFN_UNDECODABLE is not None:
-            encoded = support.TESTFN_UNDECODABLE
+        if os_helper.TESTFN_UNDECODABLE is not None:
+            encoded = os_helper.TESTFN_UNDECODABLE
         else:
-            encoded = os.fsencode(support.TESTFN)
+            encoded = os.fsencode(os_helper.TESTFN)
         self.bytes_filenames.append(encoded)
         self.bytes_filenames.append(bytearray(encoded))
         self.bytes_filenames.append(memoryview(encoded))
@@ -3659,6 +3884,33 @@
         self.assertEqual(fcntl.fcntl(fd, fcntl.F_GETFD) & fcntl.FD_CLOEXEC,
                          0)
 
+    @unittest.skipUnless(hasattr(os, 'O_PATH'), "need os.O_PATH")
+    def test_get_set_inheritable_o_path(self):
+        fd = os.open(__file__, os.O_PATH)
+        self.addCleanup(os.close, fd)
+        self.assertEqual(os.get_inheritable(fd), False)
+
+        os.set_inheritable(fd, True)
+        self.assertEqual(os.get_inheritable(fd), True)
+
+        os.set_inheritable(fd, False)
+        self.assertEqual(os.get_inheritable(fd), False)
+
+    def test_get_set_inheritable_badf(self):
+        fd = os_helper.make_bad_fd()
+
+        with self.assertRaises(OSError) as ctx:
+            os.get_inheritable(fd)
+        self.assertEqual(ctx.exception.errno, errno.EBADF)
+
+        with self.assertRaises(OSError) as ctx:
+            os.set_inheritable(fd, True)
+        self.assertEqual(ctx.exception.errno, errno.EBADF)
+
+        with self.assertRaises(OSError) as ctx:
+            os.set_inheritable(fd, False)
+        self.assertEqual(ctx.exception.errno, errno.EBADF)
+
     def test_open(self):
         fd = os.open(__file__, os.O_RDONLY)
         self.addCleanup(os.close, fd)
@@ -3733,14 +3985,14 @@
     ]
 
     def test_path_t_converter(self):
-        str_filename = support.TESTFN
+        str_filename = os_helper.TESTFN
         if os.name == 'nt':
             bytes_fspath = bytes_filename = None
         else:
-            bytes_filename = os.fsencode(support.TESTFN)
+            bytes_filename = os.fsencode(os_helper.TESTFN)
             bytes_fspath = FakePath(bytes_filename)
         fd = os.open(FakePath(str_filename), os.O_WRONLY|os.O_CREAT)
-        self.addCleanup(support.unlink, support.TESTFN)
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
         self.addCleanup(os.close, fd)
 
         int_fspath = FakePath(fd)
@@ -3810,8 +4062,8 @@
 
 class TestDirEntry(unittest.TestCase):
     def setUp(self):
-        self.path = os.path.realpath(support.TESTFN)
-        self.addCleanup(support.rmtree, self.path)
+        self.path = os.path.realpath(os_helper.TESTFN)
+        self.addCleanup(os_helper.rmtree, self.path)
         os.mkdir(self.path)
 
     def test_uninstantiable(self):
@@ -3827,12 +4079,12 @@
 
 
 class TestScandir(unittest.TestCase):
-    check_no_resource_warning = support.check_no_resource_warning
+    check_no_resource_warning = warnings_helper.check_no_resource_warning
 
     def setUp(self):
-        self.path = os.path.realpath(support.TESTFN)
+        self.path = os.path.realpath(os_helper.TESTFN)
         self.bytes_path = os.fsencode(self.path)
-        self.addCleanup(support.rmtree, self.path)
+        self.addCleanup(os_helper.rmtree, self.path)
         os.mkdir(self.path)
 
     def create_file(self, name="file.txt"):
@@ -3902,7 +4154,7 @@
 
     def test_attributes(self):
         link = hasattr(os, 'link')
-        symlink = support.can_symlink()
+        symlink = os_helper.can_symlink()
 
         dirname = os.path.join(self.path, "dir")
         os.mkdir(dirname)
@@ -4026,7 +4278,7 @@
             self.assertRaises(FileNotFoundError, entry.stat, follow_symlinks=False)
 
     def test_broken_symlink(self):
-        if not support.can_symlink():
+        if not os_helper.can_symlink():
             return self.skipTest('cannot create symbolic link')
 
         filename = self.create_file("file.txt")
@@ -4080,12 +4332,11 @@
         self.assertIn(os.scandir, os.supports_fd)
         self.create_file('file.txt')
         expected_names = ['file.txt']
-        if support.can_symlink():
+        if os_helper.can_symlink():
             os.symlink('file.txt', os.path.join(self.path, 'link'))
             expected_names.append('link')
 
-        fd = os.open(self.path, os.O_RDONLY)
-        try:
+        with os_helper.open_dir_fd(self.path) as fd:
             with os.scandir(fd) as it:
                 entries = list(it)
             names = [entry.name for entry in entries]
@@ -4100,8 +4351,6 @@
                     self.assertEqual(entry.stat(), st)
                     st = os.stat(entry.name, dir_fd=fd, follow_symlinks=False)
                     self.assertEqual(entry.stat(follow_symlinks=False), st)
-        finally:
-            os.close(fd)
 
     def test_empty_path(self):
         self.assertRaises(FileNotFoundError, os.scandir, '')
@@ -4246,6 +4495,22 @@
             self.assertEqual(times.elapsed, 0)
 
 
+@requires_os_func('fork')
+class ForkTests(unittest.TestCase):
+    def test_fork(self):
+        # bpo-42540: ensure os.fork() with non-default memory allocator does
+        # not crash on exit.
+        code = """if 1:
+            import os
+            from test import support
+            pid = os.fork()
+            if pid != 0:
+                support.wait_process(pid, exitcode=0)
+        """
+        assert_python_ok("-c", code)
+        assert_python_ok("-c", code, PYTHONMALLOC="malloc_debug")
+
+
 # Only test if the C version is provided, otherwise TestPEP519 already tested
 # the pure Python implementation.
 if hasattr(os, "_fspath"):
diff --git a/Lib/test/test_ossaudiodev.py b/Lib/test/test_ossaudiodev.py
index 624fbf2..ebce3e9 100644
--- a/Lib/test/test_ossaudiodev.py
+++ b/Lib/test/test_ossaudiodev.py
@@ -1,9 +1,10 @@
 from test import support
+from test.support import import_helper
 support.requires('audio')
 
 from test.support import findfile
 
-ossaudiodev = support.import_module('ossaudiodev')
+ossaudiodev = import_helper.import_module('ossaudiodev')
 
 import errno
 import sys
@@ -187,7 +188,7 @@
         mixer.close()
         self.assertRaises(ValueError, mixer.fileno)
 
-def test_main():
+def setUpModule():
     try:
         dsp = ossaudiodev.open('w')
     except (ossaudiodev.error, OSError) as msg:
@@ -196,7 +197,6 @@
             raise unittest.SkipTest(msg)
         raise
     dsp.close()
-    support.run_unittest(__name__)
 
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_osx_env.py b/Lib/test/test_osx_env.py
index 8a3bc5a..80198ed 100644
--- a/Lib/test/test_osx_env.py
+++ b/Lib/test/test_osx_env.py
@@ -2,7 +2,7 @@
 Test suite for OS X interpreter environment variables.
 """
 
-from test.support import EnvironmentVarGuard
+from test.support.os_helper import EnvironmentVarGuard
 import subprocess
 import sys
 import sysconfig
diff --git a/Lib/test/test_parser.py b/Lib/test/test_parser.py
deleted file mode 100644
index a4d2cdc..0000000
--- a/Lib/test/test_parser.py
+++ /dev/null
@@ -1,1046 +0,0 @@
-import copy
-import warnings
-with warnings.catch_warnings():
-    warnings.filterwarnings('ignore', 'The parser module is deprecated',
-                            DeprecationWarning)
-    import parser
-import pickle
-import unittest
-import operator
-import struct
-from test import support
-from test.support.script_helper import assert_python_failure
-from test.support.script_helper import assert_python_ok
-
-#
-#  First, we test that we can generate trees from valid source fragments,
-#  and that these valid trees are indeed allowed by the tree-loading side
-#  of the parser module.
-#
-
-class RoundtripLegalSyntaxTestCase(unittest.TestCase):
-
-    def roundtrip(self, f, s):
-        st1 = f(s)
-        t = st1.totuple()
-        try:
-            st2 = parser.sequence2st(t)
-        except parser.ParserError as why:
-            self.fail("could not roundtrip %r: %s" % (s, why))
-
-        self.assertEqual(t, st2.totuple(),
-                         "could not re-generate syntax tree")
-
-    def check_expr(self, s):
-        self.roundtrip(parser.expr, s)
-
-    def test_flags_passed(self):
-        # The unicode literals flags has to be passed from the parser to AST
-        # generation.
-        suite = parser.suite("from __future__ import unicode_literals; x = ''")
-        code = suite.compile()
-        scope = {}
-        exec(code, {}, scope)
-        self.assertIsInstance(scope["x"], str)
-
-    def check_suite(self, s):
-        self.roundtrip(parser.suite, s)
-
-    def test_yield_statement(self):
-        self.check_suite("def f(): yield 1")
-        self.check_suite("def f(): yield")
-        self.check_suite("def f(): x += yield")
-        self.check_suite("def f(): x = yield 1")
-        self.check_suite("def f(): x = y = yield 1")
-        self.check_suite("def f(): x = yield")
-        self.check_suite("def f(): x = y = yield")
-        self.check_suite("def f(): 1 + (yield)*2")
-        self.check_suite("def f(): (yield 1)*2")
-        self.check_suite("def f(): return; yield 1")
-        self.check_suite("def f(): yield 1; return")
-        self.check_suite("def f(): yield from 1")
-        self.check_suite("def f(): x = yield from 1")
-        self.check_suite("def f(): f((yield from 1))")
-        self.check_suite("def f(): yield 1; return 1")
-        self.check_suite("def f():\n"
-                         "    for x in range(30):\n"
-                         "        yield x\n")
-        self.check_suite("def f():\n"
-                         "    if (yield):\n"
-                         "        yield x\n")
-
-    def test_await_statement(self):
-        self.check_suite("async def f():\n await smth()")
-        self.check_suite("async def f():\n foo = await smth()")
-        self.check_suite("async def f():\n foo, bar = await smth()")
-        self.check_suite("async def f():\n (await smth())")
-        self.check_suite("async def f():\n foo((await smth()))")
-        self.check_suite("async def f():\n await foo(); return 42")
-
-    def test_async_with_statement(self):
-        self.check_suite("async def f():\n async with 1: pass")
-        self.check_suite("async def f():\n async with a as b, c as d: pass")
-
-    def test_async_for_statement(self):
-        self.check_suite("async def f():\n async for i in (): pass")
-        self.check_suite("async def f():\n async for i, b in (): pass")
-
-    def test_nonlocal_statement(self):
-        self.check_suite("def f():\n"
-                         "    x = 0\n"
-                         "    def g():\n"
-                         "        nonlocal x\n")
-        self.check_suite("def f():\n"
-                         "    x = y = 0\n"
-                         "    def g():\n"
-                         "        nonlocal x, y\n")
-
-    def test_expressions(self):
-        self.check_expr("foo(1)")
-        self.check_expr("[1, 2, 3]")
-        self.check_expr("[x**3 for x in range(20)]")
-        self.check_expr("[x**3 for x in range(20) if x % 3]")
-        self.check_expr("[x**3 for x in range(20) if x % 2 if x % 3]")
-        self.check_expr("list(x**3 for x in range(20))")
-        self.check_expr("list(x**3 for x in range(20) if x % 3)")
-        self.check_expr("list(x**3 for x in range(20) if x % 2 if x % 3)")
-        self.check_expr("foo(*args)")
-        self.check_expr("foo(*args, **kw)")
-        self.check_expr("foo(**kw)")
-        self.check_expr("foo(key=value)")
-        self.check_expr("foo(key=value, *args)")
-        self.check_expr("foo(key=value, *args, **kw)")
-        self.check_expr("foo(key=value, **kw)")
-        self.check_expr("foo(a, b, c, *args)")
-        self.check_expr("foo(a, b, c, *args, **kw)")
-        self.check_expr("foo(a, b, c, **kw)")
-        self.check_expr("foo(a, *args, keyword=23)")
-        self.check_expr("foo + bar")
-        self.check_expr("foo - bar")
-        self.check_expr("foo * bar")
-        self.check_expr("foo / bar")
-        self.check_expr("foo // bar")
-        self.check_expr("(foo := 1)")
-        self.check_expr("lambda: 0")
-        self.check_expr("lambda x: 0")
-        self.check_expr("lambda *y: 0")
-        self.check_expr("lambda *y, **z: 0")
-        self.check_expr("lambda **z: 0")
-        self.check_expr("lambda x, y: 0")
-        self.check_expr("lambda foo=bar: 0")
-        self.check_expr("lambda foo=bar, spaz=nifty+spit: 0")
-        self.check_expr("lambda foo=bar, **z: 0")
-        self.check_expr("lambda foo=bar, blaz=blat+2, **z: 0")
-        self.check_expr("lambda foo=bar, blaz=blat+2, *y, **z: 0")
-        self.check_expr("lambda x, *y, **z: 0")
-        self.check_expr("(x for x in range(10))")
-        self.check_expr("foo(x for x in range(10))")
-        self.check_expr("...")
-        self.check_expr("a[...]")
-
-    def test_simple_expression(self):
-        # expr_stmt
-        self.check_suite("a")
-
-    def test_simple_assignments(self):
-        self.check_suite("a = b")
-        self.check_suite("a = b = c = d = e")
-
-    def test_var_annot(self):
-        self.check_suite("x: int = 5")
-        self.check_suite("y: List[T] = []; z: [list] = fun()")
-        self.check_suite("x: tuple = (1, 2)")
-        self.check_suite("d[f()]: int = 42")
-        self.check_suite("f(d[x]): str = 'abc'")
-        self.check_suite("x.y.z.w: complex = 42j")
-        self.check_suite("x: int")
-        self.check_suite("def f():\n"
-                         "    x: str\n"
-                         "    y: int = 5\n")
-        self.check_suite("class C:\n"
-                         "    x: str\n"
-                         "    y: int = 5\n")
-        self.check_suite("class C:\n"
-                         "    def __init__(self, x: int) -> None:\n"
-                         "        self.x: int = x\n")
-        # double check for nonsense
-        with self.assertRaises(SyntaxError):
-            exec("2+2: int", {}, {})
-        with self.assertRaises(SyntaxError):
-            exec("[]: int = 5", {}, {})
-        with self.assertRaises(SyntaxError):
-            exec("x, *y, z: int = range(5)", {}, {})
-        with self.assertRaises(SyntaxError):
-            exec("x: int = 1, y = 2", {}, {})
-        with self.assertRaises(SyntaxError):
-            exec("u = v: int", {}, {})
-        with self.assertRaises(SyntaxError):
-            exec("False: int", {}, {})
-        with self.assertRaises(SyntaxError):
-            exec("x.False: int", {}, {})
-        with self.assertRaises(SyntaxError):
-            exec("x.y,: int", {}, {})
-        with self.assertRaises(SyntaxError):
-            exec("[0]: int", {}, {})
-        with self.assertRaises(SyntaxError):
-            exec("f(): int", {}, {})
-
-    def test_simple_augmented_assignments(self):
-        self.check_suite("a += b")
-        self.check_suite("a -= b")
-        self.check_suite("a *= b")
-        self.check_suite("a /= b")
-        self.check_suite("a //= b")
-        self.check_suite("a %= b")
-        self.check_suite("a &= b")
-        self.check_suite("a |= b")
-        self.check_suite("a ^= b")
-        self.check_suite("a <<= b")
-        self.check_suite("a >>= b")
-        self.check_suite("a **= b")
-
-    def test_function_defs(self):
-        self.check_suite("def f(): pass")
-        self.check_suite("def f(*args): pass")
-        self.check_suite("def f(*args, **kw): pass")
-        self.check_suite("def f(**kw): pass")
-        self.check_suite("def f(foo=bar): pass")
-        self.check_suite("def f(foo=bar, *args): pass")
-        self.check_suite("def f(foo=bar, *args, **kw): pass")
-        self.check_suite("def f(foo=bar, **kw): pass")
-
-        self.check_suite("def f(a, b): pass")
-        self.check_suite("def f(a, b, *args): pass")
-        self.check_suite("def f(a, b, *args, **kw): pass")
-        self.check_suite("def f(a, b, **kw): pass")
-        self.check_suite("def f(a, b, foo=bar): pass")
-        self.check_suite("def f(a, b, foo=bar, *args): pass")
-        self.check_suite("def f(a, b, foo=bar, *args, **kw): pass")
-        self.check_suite("def f(a, b, foo=bar, **kw): pass")
-
-        self.check_suite("@staticmethod\n"
-                         "def f(): pass")
-        self.check_suite("@staticmethod\n"
-                         "@funcattrs(x, y)\n"
-                         "def f(): pass")
-        self.check_suite("@funcattrs()\n"
-                         "def f(): pass")
-
-        self.check_suite("@False or x\n"
-                         "def f(): pass")
-        self.check_suite("@d := x\n"
-                         "def f(): pass")
-        self.check_suite("@lambda f: x(f)\n"
-                         "def f(): pass")
-        self.check_suite("@[..., x, ...][1]\n"
-                         "def f(): pass")
-        self.check_suite("@x(x)(x)\n"
-                         "def f(): pass")
-        self.check_suite("@(x, x)\n"
-                         "def f(): pass")
-        self.check_suite("@...\n"
-                         "def f(): pass")
-        self.check_suite("@None\n"
-                         "def f(): pass")
-        self.check_suite("@w @(x @y) @(z)\n"
-                         "def f(): pass")
-        self.check_suite("@w[x].y.z\n"
-                         "def f(): pass")
-
-        # keyword-only arguments
-        self.check_suite("def f(*, a): pass")
-        self.check_suite("def f(*, a = 5): pass")
-        self.check_suite("def f(*, a = 5, b): pass")
-        self.check_suite("def f(*, a, b = 5): pass")
-        self.check_suite("def f(*, a, b = 5, **kwds): pass")
-        self.check_suite("def f(*args, a): pass")
-        self.check_suite("def f(*args, a = 5): pass")
-        self.check_suite("def f(*args, a = 5, b): pass")
-        self.check_suite("def f(*args, a, b = 5): pass")
-        self.check_suite("def f(*args, a, b = 5, **kwds): pass")
-
-        # positional-only arguments
-        self.check_suite("def f(a, /): pass")
-        self.check_suite("def f(a, /,): pass")
-        self.check_suite("def f(a, b, /): pass")
-        self.check_suite("def f(a, b, /, c): pass")
-        self.check_suite("def f(a, b, /, c = 6): pass")
-        self.check_suite("def f(a, b, /, c, *, d): pass")
-        self.check_suite("def f(a, b, /, c = 1, *, d): pass")
-        self.check_suite("def f(a, b, /, c, *, d = 1): pass")
-        self.check_suite("def f(a, b=1, /, c=2, *, d = 3): pass")
-        self.check_suite("def f(a=0, b=1, /, c=2, *, d = 3): pass")
-
-        # function annotations
-        self.check_suite("def f(a: int): pass")
-        self.check_suite("def f(a: int = 5): pass")
-        self.check_suite("def f(*args: list): pass")
-        self.check_suite("def f(**kwds: dict): pass")
-        self.check_suite("def f(*, a: int): pass")
-        self.check_suite("def f(*, a: int = 5): pass")
-        self.check_suite("def f() -> int: pass")
-
-    def test_class_defs(self):
-        self.check_suite("class foo():pass")
-        self.check_suite("class foo(object):pass")
-        self.check_suite("@class_decorator\n"
-                         "class foo():pass")
-        self.check_suite("@class_decorator(arg)\n"
-                         "class foo():pass")
-        self.check_suite("@decorator1\n"
-                         "@decorator2\n"
-                         "class foo():pass")
-
-        self.check_suite("@False or x\n"
-                         "class C: pass")
-        self.check_suite("@d := x\n"
-                         "class C: pass")
-        self.check_suite("@lambda f: x(f)\n"
-                         "class C: pass")
-        self.check_suite("@[..., x, ...][1]\n"
-                         "class C: pass")
-        self.check_suite("@x(x)(x)\n"
-                         "class C: pass")
-        self.check_suite("@(x, x)\n"
-                         "class C: pass")
-        self.check_suite("@...\n"
-                         "class C: pass")
-        self.check_suite("@None\n"
-                         "class C: pass")
-        self.check_suite("@w @(x @y) @(z)\n"
-                         "class C: pass")
-        self.check_suite("@w[x].y.z\n"
-                         "class C: pass")
-
-    def test_import_from_statement(self):
-        self.check_suite("from sys.path import *")
-        self.check_suite("from sys.path import dirname")
-        self.check_suite("from sys.path import (dirname)")
-        self.check_suite("from sys.path import (dirname,)")
-        self.check_suite("from sys.path import dirname as my_dirname")
-        self.check_suite("from sys.path import (dirname as my_dirname)")
-        self.check_suite("from sys.path import (dirname as my_dirname,)")
-        self.check_suite("from sys.path import dirname, basename")
-        self.check_suite("from sys.path import (dirname, basename)")
-        self.check_suite("from sys.path import (dirname, basename,)")
-        self.check_suite(
-            "from sys.path import dirname as my_dirname, basename")
-        self.check_suite(
-            "from sys.path import (dirname as my_dirname, basename)")
-        self.check_suite(
-            "from sys.path import (dirname as my_dirname, basename,)")
-        self.check_suite(
-            "from sys.path import dirname, basename as my_basename")
-        self.check_suite(
-            "from sys.path import (dirname, basename as my_basename)")
-        self.check_suite(
-            "from sys.path import (dirname, basename as my_basename,)")
-        self.check_suite("from .bogus import x")
-
-    def test_basic_import_statement(self):
-        self.check_suite("import sys")
-        self.check_suite("import sys as system")
-        self.check_suite("import sys, math")
-        self.check_suite("import sys as system, math")
-        self.check_suite("import sys, math as my_math")
-
-    def test_relative_imports(self):
-        self.check_suite("from . import name")
-        self.check_suite("from .. import name")
-        # check all the way up to '....', since '...' is tokenized
-        # differently from '.' (it's an ellipsis token).
-        self.check_suite("from ... import name")
-        self.check_suite("from .... import name")
-        self.check_suite("from .pkg import name")
-        self.check_suite("from ..pkg import name")
-        self.check_suite("from ...pkg import name")
-        self.check_suite("from ....pkg import name")
-
-    def test_pep263(self):
-        self.check_suite("# -*- coding: iso-8859-1 -*-\n"
-                         "pass\n")
-
-    def test_assert(self):
-        self.check_suite("assert alo < ahi and blo < bhi\n")
-
-    def test_with(self):
-        self.check_suite("with open('x'): pass\n")
-        self.check_suite("with open('x') as f: pass\n")
-        self.check_suite("with open('x') as f, open('y') as g: pass\n")
-
-    def test_try_stmt(self):
-        self.check_suite("try: pass\nexcept: pass\n")
-        self.check_suite("try: pass\nfinally: pass\n")
-        self.check_suite("try: pass\nexcept A: pass\nfinally: pass\n")
-        self.check_suite("try: pass\nexcept A: pass\nexcept: pass\n"
-                         "finally: pass\n")
-        self.check_suite("try: pass\nexcept: pass\nelse: pass\n")
-        self.check_suite("try: pass\nexcept: pass\nelse: pass\n"
-                         "finally: pass\n")
-
-    def test_if_stmt(self):
-        self.check_suite("if True:\n  pass\nelse:\n  pass\n")
-        self.check_suite("if True:\n  pass\nelif True:\n  pass\nelse:\n  pass\n")
-
-    def test_position(self):
-        # An absolutely minimal test of position information.  Better
-        # tests would be a big project.
-        code = "def f(x):\n    return x + 1"
-        st = parser.suite(code)
-
-        def walk(tree):
-            node_type = tree[0]
-            next = tree[1]
-            if isinstance(next, (tuple, list)):
-                for elt in tree[1:]:
-                    for x in walk(elt):
-                        yield x
-            else:
-                yield tree
-
-        expected = [
-            (1, 'def', 1, 0),
-            (1, 'f', 1, 4),
-            (7, '(', 1, 5),
-            (1, 'x', 1, 6),
-            (8, ')', 1, 7),
-            (11, ':', 1, 8),
-            (4, '', 1, 9),
-            (5, '', 2, -1),
-            (1, 'return', 2, 4),
-            (1, 'x', 2, 11),
-            (14, '+', 2, 13),
-            (2, '1', 2, 15),
-            (4, '', 2, 16),
-            (6, '', 2, -1),
-            (4, '', 2, -1),
-            (0, '', 2, -1),
-        ]
-
-        self.assertEqual(list(walk(st.totuple(line_info=True, col_info=True))),
-                         expected)
-        self.assertEqual(list(walk(st.totuple())),
-                         [(t, n) for t, n, l, c in expected])
-        self.assertEqual(list(walk(st.totuple(line_info=True))),
-                         [(t, n, l) for t, n, l, c in expected])
-        self.assertEqual(list(walk(st.totuple(col_info=True))),
-                         [(t, n, c) for t, n, l, c in expected])
-        self.assertEqual(list(walk(st.tolist(line_info=True, col_info=True))),
-                         [list(x) for x in expected])
-        self.assertEqual(list(walk(parser.st2tuple(st, line_info=True,
-                                                   col_info=True))),
-                         expected)
-        self.assertEqual(list(walk(parser.st2list(st, line_info=True,
-                                                  col_info=True))),
-                         [list(x) for x in expected])
-
-    def test_extended_unpacking(self):
-        self.check_suite("*a = y")
-        self.check_suite("x, *b, = m")
-        self.check_suite("[*a, *b] = y")
-        self.check_suite("for [*x, b] in x: pass")
-
-    def test_raise_statement(self):
-        self.check_suite("raise\n")
-        self.check_suite("raise e\n")
-        self.check_suite("try:\n"
-                         "    suite\n"
-                         "except Exception as e:\n"
-                         "    raise ValueError from e\n")
-
-    def test_list_displays(self):
-        self.check_expr('[]')
-        self.check_expr('[*{2}, 3, *[4]]')
-
-    def test_set_displays(self):
-        self.check_expr('{*{2}, 3, *[4]}')
-        self.check_expr('{2}')
-        self.check_expr('{2,}')
-        self.check_expr('{2, 3}')
-        self.check_expr('{2, 3,}')
-
-    def test_dict_displays(self):
-        self.check_expr('{}')
-        self.check_expr('{a:b}')
-        self.check_expr('{a:b,}')
-        self.check_expr('{a:b, c:d}')
-        self.check_expr('{a:b, c:d,}')
-        self.check_expr('{**{}}')
-        self.check_expr('{**{}, 3:4, **{5:6, 7:8}}')
-
-    def test_argument_unpacking(self):
-        self.check_expr("f(*a, **b)")
-        self.check_expr('f(a, *b, *c, *d)')
-        self.check_expr('f(**a, **b)')
-        self.check_expr('f(2, *a, *b, **b, **c, **d)')
-        self.check_expr("f(*b, *() or () and (), **{} and {}, **() or {})")
-
-    def test_set_comprehensions(self):
-        self.check_expr('{x for x in seq}')
-        self.check_expr('{f(x) for x in seq}')
-        self.check_expr('{f(x) for x in seq if condition(x)}')
-
-    def test_dict_comprehensions(self):
-        self.check_expr('{x:x for x in seq}')
-        self.check_expr('{x**2:x[3] for x in seq if condition(x)}')
-        self.check_expr('{x:x for x in seq1 for y in seq2 if condition(x, y)}')
-
-    def test_named_expressions(self):
-        self.check_suite("(a := 1)")
-        self.check_suite("(a := a)")
-        self.check_suite("if (match := pattern.search(data)) is None: pass")
-        self.check_suite("while match := pattern.search(f.read()): pass")
-        self.check_suite("[y := f(x), y**2, y**3]")
-        self.check_suite("filtered_data = [y for x in data if (y := f(x)) is None]")
-        self.check_suite("(y := f(x))")
-        self.check_suite("y0 = (y1 := f(x))")
-        self.check_suite("foo(x=(y := f(x)))")
-        self.check_suite("def foo(answer=(p := 42)): pass")
-        self.check_suite("def foo(answer: (p := 42) = 5): pass")
-        self.check_suite("lambda: (x := 1)")
-        self.check_suite("(x := lambda: 1)")
-        self.check_suite("(x := lambda: (y := 1))")  # not in PEP
-        self.check_suite("lambda line: (m := re.match(pattern, line)) and m.group(1)")
-        self.check_suite("x = (y := 0)")
-        self.check_suite("(z:=(y:=(x:=0)))")
-        self.check_suite("(info := (name, phone, *rest))")
-        self.check_suite("(x:=1,2)")
-        self.check_suite("(total := total + tax)")
-        self.check_suite("len(lines := f.readlines())")
-        self.check_suite("foo(x := 3, cat='vector')")
-        self.check_suite("foo(cat=(category := 'vector'))")
-        self.check_suite("if any(len(longline := l) >= 100 for l in lines): print(longline)")
-        self.check_suite(
-            "if env_base := os.environ.get('PYTHONUSERBASE', None): return env_base"
-        )
-        self.check_suite(
-            "if self._is_special and (ans := self._check_nans(context=context)): return ans"
-        )
-        self.check_suite("foo(b := 2, a=1)")
-        self.check_suite("foo(b := 2, a=1)")
-        self.check_suite("foo((b := 2), a=1)")
-        self.check_suite("foo(c=(b := 2), a=1)")
-        self.check_suite("{(x := C(i)).q: x for i in y}")
-
-
-#
-#  Second, we take *invalid* trees and make sure we get ParserError
-#  rejections for them.
-#
-
-class IllegalSyntaxTestCase(unittest.TestCase):
-
-    def check_bad_tree(self, tree, label):
-        try:
-            parser.sequence2st(tree)
-        except parser.ParserError:
-            pass
-        else:
-            self.fail("did not detect invalid tree for %r" % label)
-
-    def test_junk(self):
-        # not even remotely valid:
-        self.check_bad_tree((1, 2, 3), "<junk>")
-
-    def test_illegal_terminal(self):
-        tree = \
-            (257,
-             (269,
-              (270,
-               (271,
-                (277,
-                 (1,))),
-               (4, ''))),
-             (4, ''),
-             (0, ''))
-        self.check_bad_tree(tree, "too small items in terminal node")
-        tree = \
-            (257,
-             (269,
-              (270,
-               (271,
-                (277,
-                 (1, b'pass'))),
-               (4, ''))),
-             (4, ''),
-             (0, ''))
-        self.check_bad_tree(tree, "non-string second item in terminal node")
-        tree = \
-            (257,
-             (269,
-              (270,
-               (271,
-                (277,
-                 (1, 'pass', '0', 0))),
-               (4, ''))),
-             (4, ''),
-             (0, ''))
-        self.check_bad_tree(tree, "non-integer third item in terminal node")
-        tree = \
-            (257,
-             (269,
-              (270,
-               (271,
-                (277,
-                 (1, 'pass', 0, 0))),
-               (4, ''))),
-             (4, ''),
-             (0, ''))
-        self.check_bad_tree(tree, "too many items in terminal node")
-
-    def test_illegal_yield_1(self):
-        # Illegal yield statement: def f(): return 1; yield 1
-        tree = \
-        (257,
-         (264,
-          (285,
-           (259,
-            (1, 'def'),
-            (1, 'f'),
-            (260, (7, '('), (8, ')')),
-            (11, ':'),
-            (291,
-             (4, ''),
-             (5, ''),
-             (264,
-              (265,
-               (266,
-                (272,
-                 (275,
-                  (1, 'return'),
-                  (313,
-                   (292,
-                    (293,
-                     (294,
-                      (295,
-                       (297,
-                        (298,
-                         (299,
-                          (300,
-                           (301,
-                            (302, (303, (304, (305, (2, '1')))))))))))))))))),
-               (264,
-                (265,
-                 (266,
-                  (272,
-                   (276,
-                    (1, 'yield'),
-                    (313,
-                     (292,
-                      (293,
-                       (294,
-                        (295,
-                         (297,
-                          (298,
-                           (299,
-                            (300,
-                             (301,
-                              (302,
-                               (303, (304, (305, (2, '1')))))))))))))))))),
-                 (4, ''))),
-               (6, ''))))),
-           (4, ''),
-           (0, ''))))
-        self.check_bad_tree(tree, "def f():\n  return 1\n  yield 1")
-
-    def test_illegal_yield_2(self):
-        # Illegal return in generator: def f(): return 1; yield 1
-        tree = \
-        (257,
-         (264,
-          (265,
-           (266,
-            (278,
-             (1, 'from'),
-             (281, (1, '__future__')),
-             (1, 'import'),
-             (279, (1, 'generators')))),
-           (4, ''))),
-         (264,
-          (285,
-           (259,
-            (1, 'def'),
-            (1, 'f'),
-            (260, (7, '('), (8, ')')),
-            (11, ':'),
-            (291,
-             (4, ''),
-             (5, ''),
-             (264,
-              (265,
-               (266,
-                (272,
-                 (275,
-                  (1, 'return'),
-                  (313,
-                   (292,
-                    (293,
-                     (294,
-                      (295,
-                       (297,
-                        (298,
-                         (299,
-                          (300,
-                           (301,
-                            (302, (303, (304, (305, (2, '1')))))))))))))))))),
-               (264,
-                (265,
-                 (266,
-                  (272,
-                   (276,
-                    (1, 'yield'),
-                    (313,
-                     (292,
-                      (293,
-                       (294,
-                        (295,
-                         (297,
-                          (298,
-                           (299,
-                            (300,
-                             (301,
-                              (302,
-                               (303, (304, (305, (2, '1')))))))))))))))))),
-                 (4, ''))),
-               (6, ''))))),
-           (4, ''),
-           (0, ''))))
-        self.check_bad_tree(tree, "def f():\n  return 1\n  yield 1")
-
-    def test_a_comma_comma_c(self):
-        # Illegal input: a,,c
-        tree = \
-        (258,
-         (311,
-          (290,
-           (291,
-            (292,
-             (293,
-              (295,
-               (296,
-                (297,
-                 (298, (299, (300, (301, (302, (303, (1, 'a')))))))))))))),
-          (12, ','),
-          (12, ','),
-          (290,
-           (291,
-            (292,
-             (293,
-              (295,
-               (296,
-                (297,
-                 (298, (299, (300, (301, (302, (303, (1, 'c'))))))))))))))),
-         (4, ''),
-         (0, ''))
-        self.check_bad_tree(tree, "a,,c")
-
-    def test_illegal_operator(self):
-        # Illegal input: a $= b
-        tree = \
-        (257,
-         (264,
-          (265,
-           (266,
-            (267,
-             (312,
-              (291,
-               (292,
-                (293,
-                 (294,
-                  (296,
-                   (297,
-                    (298,
-                     (299,
-                      (300, (301, (302, (303, (304, (1, 'a'))))))))))))))),
-             (268, (37, '$=')),
-             (312,
-              (291,
-               (292,
-                (293,
-                 (294,
-                  (296,
-                   (297,
-                    (298,
-                     (299,
-                      (300, (301, (302, (303, (304, (1, 'b'))))))))))))))))),
-           (4, ''))),
-         (0, ''))
-        self.check_bad_tree(tree, "a $= b")
-
-    def test_malformed_global(self):
-        #doesn't have global keyword in ast
-        tree = (257,
-                (264,
-                 (265,
-                  (266,
-                   (282, (1, 'foo'))), (4, ''))),
-                (4, ''),
-                (0, ''))
-        self.check_bad_tree(tree, "malformed global ast")
-
-    def test_missing_import_source(self):
-        # from import fred
-        tree = \
-            (257,
-             (268,
-              (269,
-               (270,
-                (282,
-                 (284, (1, 'from'), (1, 'import'),
-                  (287, (285, (1, 'fred')))))),
-               (4, ''))),
-             (4, ''), (0, ''))
-        self.check_bad_tree(tree, "from import fred")
-
-    def test_illegal_encoding(self):
-        # Illegal encoding declaration
-        tree = \
-            (341,
-             (257, (0, '')))
-        self.check_bad_tree(tree, "missed encoding")
-        tree = \
-            (341,
-             (257, (0, '')),
-              b'iso-8859-1')
-        self.check_bad_tree(tree, "non-string encoding")
-        tree = \
-            (341,
-             (257, (0, '')),
-              '\udcff')
-        with self.assertRaises(UnicodeEncodeError):
-            parser.sequence2st(tree)
-
-    def test_invalid_node_id(self):
-        tree = (257, (269, (-7, '')))
-        self.check_bad_tree(tree, "negative node id")
-        tree = (257, (269, (99, '')))
-        self.check_bad_tree(tree, "invalid token id")
-        tree = (257, (269, (9999, (0, ''))))
-        self.check_bad_tree(tree, "invalid symbol id")
-
-    def test_ParserError_message(self):
-        try:
-            parser.sequence2st((257,(269,(257,(0,'')))))
-        except parser.ParserError as why:
-            self.assertIn("compound_stmt", str(why))  # Expected
-            self.assertIn("file_input", str(why))     # Got
-
-
-
-class CompileTestCase(unittest.TestCase):
-
-    # These tests are very minimal. :-(
-
-    def test_compile_expr(self):
-        st = parser.expr('2 + 3')
-        code = parser.compilest(st)
-        self.assertEqual(eval(code), 5)
-
-    def test_compile_suite(self):
-        st = parser.suite('x = 2; y = x + 3')
-        code = parser.compilest(st)
-        globs = {}
-        exec(code, globs)
-        self.assertEqual(globs['y'], 5)
-
-    def test_compile_error(self):
-        st = parser.suite('1 = 3 + 4')
-        self.assertRaises(SyntaxError, parser.compilest, st)
-
-    def test_compile_badunicode(self):
-        st = parser.suite('a = "\\U12345678"')
-        self.assertRaises(SyntaxError, parser.compilest, st)
-        st = parser.suite('a = "\\u1"')
-        self.assertRaises(SyntaxError, parser.compilest, st)
-
-    def test_issue_9011(self):
-        # Issue 9011: compilation of an unary minus expression changed
-        # the meaning of the ST, so that a second compilation produced
-        # incorrect results.
-        st = parser.expr('-3')
-        code1 = parser.compilest(st)
-        self.assertEqual(eval(code1), -3)
-        code2 = parser.compilest(st)
-        self.assertEqual(eval(code2), -3)
-
-    def test_compile_filename(self):
-        st = parser.expr('a + 5')
-        code = parser.compilest(st)
-        self.assertEqual(code.co_filename, '<syntax-tree>')
-        code = st.compile()
-        self.assertEqual(code.co_filename, '<syntax-tree>')
-        for filename in 'file.py', b'file.py':
-            code = parser.compilest(st, filename)
-            self.assertEqual(code.co_filename, 'file.py')
-            code = st.compile(filename)
-            self.assertEqual(code.co_filename, 'file.py')
-        for filename in bytearray(b'file.py'), memoryview(b'file.py'):
-            with self.assertWarns(DeprecationWarning):
-                code = parser.compilest(st, filename)
-            self.assertEqual(code.co_filename, 'file.py')
-            with self.assertWarns(DeprecationWarning):
-                code = st.compile(filename)
-            self.assertEqual(code.co_filename, 'file.py')
-        self.assertRaises(TypeError, parser.compilest, st, list(b'file.py'))
-        self.assertRaises(TypeError, st.compile, list(b'file.py'))
-
-
-class ParserStackLimitTestCase(unittest.TestCase):
-    """try to push the parser to/over its limits.
-    see http://bugs.python.org/issue1881 for a discussion
-    """
-    def _nested_expression(self, level):
-        return "["*level+"]"*level
-
-    def test_deeply_nested_list(self):
-        # This has fluctuated between 99 levels in 2.x, down to 93 levels in
-        # 3.7.X and back up to 99 in 3.8.X. Related to MAXSTACK size in Parser.h
-        e = self._nested_expression(99)
-        st = parser.expr(e)
-        st.compile()
-
-    def test_trigger_memory_error(self):
-        e = self._nested_expression(100)
-        rc, out, err = assert_python_failure('-Xoldparser', '-c', e)
-        # parsing the expression will result in an error message
-        # followed by a MemoryError (see #11963)
-        self.assertIn(b's_push: parser stack overflow', err)
-        self.assertIn(b'MemoryError', err)
-
-class STObjectTestCase(unittest.TestCase):
-    """Test operations on ST objects themselves"""
-
-    def test_comparisons(self):
-        # ST objects should support order and equality comparisons
-        st1 = parser.expr('2 + 3')
-        st2 = parser.suite('x = 2; y = x + 3')
-        st3 = parser.expr('list(x**3 for x in range(20))')
-        st1_copy = parser.expr('2 + 3')
-        st2_copy = parser.suite('x = 2; y = x + 3')
-        st3_copy = parser.expr('list(x**3 for x in range(20))')
-
-        # exercise fast path for object identity
-        self.assertEqual(st1 == st1, True)
-        self.assertEqual(st2 == st2, True)
-        self.assertEqual(st3 == st3, True)
-        # slow path equality
-        self.assertEqual(st1, st1_copy)
-        self.assertEqual(st2, st2_copy)
-        self.assertEqual(st3, st3_copy)
-        self.assertEqual(st1 == st2, False)
-        self.assertEqual(st1 == st3, False)
-        self.assertEqual(st2 == st3, False)
-        self.assertEqual(st1 != st1, False)
-        self.assertEqual(st2 != st2, False)
-        self.assertEqual(st3 != st3, False)
-        self.assertEqual(st1 != st1_copy, False)
-        self.assertEqual(st2 != st2_copy, False)
-        self.assertEqual(st3 != st3_copy, False)
-        self.assertEqual(st2 != st1, True)
-        self.assertEqual(st1 != st3, True)
-        self.assertEqual(st3 != st2, True)
-        # we don't particularly care what the ordering is;  just that
-        # it's usable and self-consistent
-        self.assertEqual(st1 < st2, not (st2 <= st1))
-        self.assertEqual(st1 < st3, not (st3 <= st1))
-        self.assertEqual(st2 < st3, not (st3 <= st2))
-        self.assertEqual(st1 < st2, st2 > st1)
-        self.assertEqual(st1 < st3, st3 > st1)
-        self.assertEqual(st2 < st3, st3 > st2)
-        self.assertEqual(st1 <= st2, st2 >= st1)
-        self.assertEqual(st3 <= st1, st1 >= st3)
-        self.assertEqual(st2 <= st3, st3 >= st2)
-        # transitivity
-        bottom = min(st1, st2, st3)
-        top = max(st1, st2, st3)
-        mid = sorted([st1, st2, st3])[1]
-        self.assertTrue(bottom < mid)
-        self.assertTrue(bottom < top)
-        self.assertTrue(mid < top)
-        self.assertTrue(bottom <= mid)
-        self.assertTrue(bottom <= top)
-        self.assertTrue(mid <= top)
-        self.assertTrue(bottom <= bottom)
-        self.assertTrue(mid <= mid)
-        self.assertTrue(top <= top)
-        # interaction with other types
-        self.assertEqual(st1 == 1588.602459, False)
-        self.assertEqual('spanish armada' != st2, True)
-        self.assertRaises(TypeError, operator.ge, st3, None)
-        self.assertRaises(TypeError, operator.le, False, st1)
-        self.assertRaises(TypeError, operator.lt, st1, 1815)
-        self.assertRaises(TypeError, operator.gt, b'waterloo', st2)
-
-    def test_copy_pickle(self):
-        sts = [
-            parser.expr('2 + 3'),
-            parser.suite('x = 2; y = x + 3'),
-            parser.expr('list(x**3 for x in range(20))')
-        ]
-        for st in sts:
-            st_copy = copy.copy(st)
-            self.assertEqual(st_copy.totuple(), st.totuple())
-            st_copy = copy.deepcopy(st)
-            self.assertEqual(st_copy.totuple(), st.totuple())
-            for proto in range(pickle.HIGHEST_PROTOCOL+1):
-                st_copy = pickle.loads(pickle.dumps(st, proto))
-                self.assertEqual(st_copy.totuple(), st.totuple())
-
-    check_sizeof = support.check_sizeof
-
-    @support.cpython_only
-    def test_sizeof(self):
-        def XXXROUNDUP(n):
-            if n <= 1:
-                return n
-            if n <= 128:
-                return (n + 3) & ~3
-            return 1 << (n - 1).bit_length()
-
-        basesize = support.calcobjsize('Piii')
-        nodesize = struct.calcsize('hP3iP0h2i')
-        def sizeofchildren(node):
-            if node is None:
-                return 0
-            res = 0
-            hasstr = len(node) > 1 and isinstance(node[-1], str)
-            if hasstr:
-                res += len(node[-1]) + 1
-            children = node[1:-1] if hasstr else node[1:]
-            if children:
-                res += XXXROUNDUP(len(children)) * nodesize
-                for child in children:
-                    res += sizeofchildren(child)
-            return res
-
-        def check_st_sizeof(st):
-            self.check_sizeof(st, basesize + nodesize +
-                                  sizeofchildren(st.totuple()))
-
-        check_st_sizeof(parser.expr('2 + 3'))
-        check_st_sizeof(parser.expr('2 + 3 + 4'))
-        check_st_sizeof(parser.suite('x = 2 + 3'))
-        check_st_sizeof(parser.suite(''))
-        check_st_sizeof(parser.suite('# -*- coding: utf-8 -*-'))
-        check_st_sizeof(parser.expr('[' + '2,' * 1000 + ']'))
-
-
-    # XXX tests for pickling and unpickling of ST objects should go here
-
-class OtherParserCase(unittest.TestCase):
-
-    def test_two_args_to_expr(self):
-        # See bug #12264
-        with self.assertRaises(TypeError):
-            parser.expr("a", "b")
-
-
-class TestDeprecation(unittest.TestCase):
-    def test_deprecation_message(self):
-        code = "def f():\n  import parser\n\nf()"
-        rc, out, err = assert_python_ok('-c', code)
-        self.assertIn(b'<string>:2: DeprecationWarning', err)
-
-
-if __name__ == "__main__":
-    unittest.main()
diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py
index 3da3571..555c7ee 100644
--- a/Lib/test/test_pathlib.py
+++ b/Lib/test/test_pathlib.py
@@ -11,8 +11,9 @@
 import unittest
 from unittest import mock
 
-from test import support
-from test.support import TESTFN, FakePath
+from test.support import import_helper
+from test.support import os_helper
+from test.support.os_helper import TESTFN, FakePath
 
 try:
     import grp, pwd
@@ -323,7 +324,7 @@
         self.assertFalse(P('b/py').match('b.py'))
         self.assertFalse(P('/a.py').match('b.py'))
         self.assertFalse(P('b.py/c').match('b.py'))
-        # Wilcard relative pattern.
+        # Wildcard relative pattern.
         self.assertTrue(P('b.py').match('*.py'))
         self.assertTrue(P('a/b.py').match('*.py'))
         self.assertTrue(P('/a/b.py').match('*.py'))
@@ -439,9 +440,18 @@
         self.assertEqual(par[0], P('a/b'))
         self.assertEqual(par[1], P('a'))
         self.assertEqual(par[2], P('.'))
+        self.assertEqual(par[-1], P('.'))
+        self.assertEqual(par[-2], P('a'))
+        self.assertEqual(par[-3], P('a/b'))
+        self.assertEqual(par[0:1], (P('a/b'),))
+        self.assertEqual(par[:2], (P('a/b'), P('a')))
+        self.assertEqual(par[:-1], (P('a/b'), P('a')))
+        self.assertEqual(par[1:], (P('a'), P('.')))
+        self.assertEqual(par[::2], (P('a/b'), P('.')))
+        self.assertEqual(par[::-1], (P('.'), P('a'), P('a/b')))
         self.assertEqual(list(par), [P('a/b'), P('a'), P('.')])
         with self.assertRaises(IndexError):
-            par[-1]
+            par[-4]
         with self.assertRaises(IndexError):
             par[3]
         with self.assertRaises(TypeError):
@@ -453,6 +463,12 @@
         self.assertEqual(par[0], P('/a/b'))
         self.assertEqual(par[1], P('/a'))
         self.assertEqual(par[2], P('/'))
+        self.assertEqual(par[0:1], (P('/a/b'),))
+        self.assertEqual(par[:2], (P('/a/b'), P('/a')))
+        self.assertEqual(par[:-1], (P('/a/b'), P('/a')))
+        self.assertEqual(par[1:], (P('/a'), P('/')))
+        self.assertEqual(par[::2], (P('/a/b'), P('/')))
+        self.assertEqual(par[::-1], (P('/'), P('/a'), P('/a/b')))
         self.assertEqual(list(par), [P('/a/b'), P('/a'), P('/')])
         with self.assertRaises(IndexError):
             par[3]
@@ -904,6 +920,12 @@
         self.assertEqual(len(par), 2)
         self.assertEqual(par[0], P('z:a'))
         self.assertEqual(par[1], P('z:'))
+        self.assertEqual(par[0:1], (P('z:a'),))
+        self.assertEqual(par[:-1], (P('z:a'),))
+        self.assertEqual(par[:2], (P('z:a'), P('z:')))
+        self.assertEqual(par[1:], (P('z:'),))
+        self.assertEqual(par[::2], (P('z:a'),))
+        self.assertEqual(par[::-1], (P('z:'), P('z:a')))
         self.assertEqual(list(par), [P('z:a'), P('z:')])
         with self.assertRaises(IndexError):
             par[2]
@@ -912,6 +934,12 @@
         self.assertEqual(len(par), 2)
         self.assertEqual(par[0], P('z:/a'))
         self.assertEqual(par[1], P('z:/'))
+        self.assertEqual(par[0:1], (P('z:/a'),))
+        self.assertEqual(par[0:-1], (P('z:/a'),))
+        self.assertEqual(par[:2], (P('z:/a'), P('z:/')))
+        self.assertEqual(par[1:], (P('z:/'),))
+        self.assertEqual(par[::2], (P('z:/a'),))
+        self.assertEqual(par[::-1], (P('z:/'), P('z:/a'),))
         self.assertEqual(list(par), [P('z:/a'), P('z:/')])
         with self.assertRaises(IndexError):
             par[2]
@@ -920,6 +948,12 @@
         self.assertEqual(len(par), 2)
         self.assertEqual(par[0], P('//a/b/c'))
         self.assertEqual(par[1], P('//a/b'))
+        self.assertEqual(par[0:1], (P('//a/b/c'),))
+        self.assertEqual(par[0:-1], (P('//a/b/c'),))
+        self.assertEqual(par[:2], (P('//a/b/c'), P('//a/b')))
+        self.assertEqual(par[1:], (P('//a/b'),))
+        self.assertEqual(par[::2], (P('//a/b/c'),))
+        self.assertEqual(par[::-1], (P('//a/b'), P('//a/b/c')))
         self.assertEqual(list(par), [P('//a/b/c'), P('//a/b')])
         with self.assertRaises(IndexError):
             par[2]
@@ -1248,19 +1282,35 @@
         self.assertIs(False, P('').is_reserved())
         self.assertIs(False, P('/').is_reserved())
         self.assertIs(False, P('/foo/bar').is_reserved())
-        self.assertIs(True, P('con').is_reserved())
-        self.assertIs(True, P('NUL').is_reserved())
-        self.assertIs(True, P('NUL.txt').is_reserved())
-        self.assertIs(True, P('com1').is_reserved())
-        self.assertIs(True, P('com9.bar').is_reserved())
-        self.assertIs(False, P('bar.com9').is_reserved())
-        self.assertIs(True, P('lpt1').is_reserved())
-        self.assertIs(True, P('lpt9.bar').is_reserved())
-        self.assertIs(False, P('bar.lpt9').is_reserved())
-        # Only the last component matters.
-        self.assertIs(False, P('c:/NUL/con/baz').is_reserved())
         # UNC paths are never reserved.
         self.assertIs(False, P('//my/share/nul/con/aux').is_reserved())
+        # Case-insensitive DOS-device names are reserved.
+        self.assertIs(True, P('nul').is_reserved())
+        self.assertIs(True, P('aux').is_reserved())
+        self.assertIs(True, P('prn').is_reserved())
+        self.assertIs(True, P('con').is_reserved())
+        self.assertIs(True, P('conin$').is_reserved())
+        self.assertIs(True, P('conout$').is_reserved())
+        # COM/LPT + 1-9 or + superscript 1-3 are reserved.
+        self.assertIs(True, P('COM1').is_reserved())
+        self.assertIs(True, P('LPT9').is_reserved())
+        self.assertIs(True, P('com\xb9').is_reserved())
+        self.assertIs(True, P('com\xb2').is_reserved())
+        self.assertIs(True, P('lpt\xb3').is_reserved())
+        # DOS-device name mataching ignores characters after a dot or
+        # a colon and also ignores trailing spaces.
+        self.assertIs(True, P('NUL.txt').is_reserved())
+        self.assertIs(True, P('PRN  ').is_reserved())
+        self.assertIs(True, P('AUX  .txt').is_reserved())
+        self.assertIs(True, P('COM1:bar').is_reserved())
+        self.assertIs(True, P('LPT9   :bar').is_reserved())
+        # DOS-device names are only matched at the beginning
+        # of a path component.
+        self.assertIs(False, P('bar.com9').is_reserved())
+        self.assertIs(False, P('bar.lpt9').is_reserved())
+        # Only the last path component matters.
+        self.assertIs(True, P('c:/baz/con/NUL').is_reserved())
+        self.assertIs(False, P('c:/NUL/con/baz').is_reserved())
 
 class PurePathTest(_BasePurePathTest, unittest.TestCase):
     cls = pathlib.PurePath
@@ -1346,7 +1396,7 @@
     def setUp(self):
         def cleanup():
             os.chmod(join('dirE'), 0o777)
-            support.rmtree(BASE)
+            os_helper.rmtree(BASE)
         self.addCleanup(cleanup)
         os.mkdir(BASE)
         os.mkdir(join('dirA'))
@@ -1363,7 +1413,7 @@
         with open(join('dirC', 'dirD', 'fileD'), 'wb') as f:
             f.write(b"this is file D\n")
         os.chmod(join('dirE'), 0)
-        if support.can_symlink():
+        if os_helper.can_symlink():
             # Relative symlinks.
             os.symlink('fileA', join('linkA'))
             os.symlink('non-existing', join('brokenLink'))
@@ -1414,7 +1464,7 @@
         self.assertTrue(p.is_absolute())
 
     def test_home(self):
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             self._test_home(self.cls.home())
 
             env.clear()
@@ -1470,7 +1520,7 @@
         self.assertIs(True, (p / 'dirA').exists())
         self.assertIs(True, (p / 'fileA').exists())
         self.assertIs(False, (p / 'fileA' / 'bah').exists())
-        if support.can_symlink():
+        if os_helper.can_symlink():
             self.assertIs(True, (p / 'linkA').exists())
             self.assertIs(True, (p / 'linkB').exists())
             self.assertIs(True, (p / 'linkB' / 'fileB').exists())
@@ -1509,17 +1559,37 @@
         self.assertRaises(TypeError, (p / 'fileA').write_text, b'somebytes')
         self.assertEqual((p / 'fileA').read_text(encoding='latin-1'), 'äbcdefg')
 
+    def test_write_text_with_newlines(self):
+        p = self.cls(BASE)
+        # Check that `\n` character change nothing
+        (p / 'fileA').write_text('abcde\r\nfghlk\n\rmnopq', newline='\n')
+        self.assertEqual((p / 'fileA').read_bytes(),
+                         b'abcde\r\nfghlk\n\rmnopq')
+        # Check that `\r` character replaces `\n`
+        (p / 'fileA').write_text('abcde\r\nfghlk\n\rmnopq', newline='\r')
+        self.assertEqual((p / 'fileA').read_bytes(),
+                         b'abcde\r\rfghlk\r\rmnopq')
+        # Check that `\r\n` character replaces `\n`
+        (p / 'fileA').write_text('abcde\r\nfghlk\n\rmnopq', newline='\r\n')
+        self.assertEqual((p / 'fileA').read_bytes(),
+                         b'abcde\r\r\nfghlk\r\n\rmnopq')
+        # Check that no argument passed will change `\n` to `os.linesep`
+        os_linesep_byte = bytes(os.linesep, encoding='ascii')
+        (p / 'fileA').write_text('abcde\nfghlk\n\rmnopq')
+        self.assertEqual((p / 'fileA').read_bytes(),
+                          b'abcde' + os_linesep_byte + b'fghlk' + os_linesep_byte + b'\rmnopq')
+
     def test_iterdir(self):
         P = self.cls
         p = P(BASE)
         it = p.iterdir()
         paths = set(it)
         expected = ['dirA', 'dirB', 'dirC', 'dirE', 'fileA']
-        if support.can_symlink():
+        if os_helper.can_symlink():
             expected += ['linkA', 'linkB', 'brokenLink', 'brokenLinkLoop']
         self.assertEqual(paths, { P(BASE, q) for q in expected })
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_iterdir_symlink(self):
         # __iter__ on a symlink to a directory.
         P = self.cls
@@ -1548,16 +1618,16 @@
         _check(it, ["fileA"])
         _check(p.glob("fileB"), [])
         _check(p.glob("dir*/file*"), ["dirB/fileB", "dirC/fileC"])
-        if not support.can_symlink():
+        if not os_helper.can_symlink():
             _check(p.glob("*A"), ['dirA', 'fileA'])
         else:
             _check(p.glob("*A"), ['dirA', 'fileA', 'linkA'])
-        if not support.can_symlink():
+        if not os_helper.can_symlink():
             _check(p.glob("*B/*"), ['dirB/fileB'])
         else:
             _check(p.glob("*B/*"), ['dirB/fileB', 'dirB/linkD',
                                     'linkB/fileB', 'linkB/linkD'])
-        if not support.can_symlink():
+        if not os_helper.can_symlink():
             _check(p.glob("*/fileB"), ['dirB/fileB'])
         else:
             _check(p.glob("*/fileB"), ['dirB/fileB', 'linkB/fileB'])
@@ -1572,7 +1642,7 @@
         _check(it, ["fileA"])
         _check(p.rglob("fileB"), ["dirB/fileB"])
         _check(p.rglob("*/fileA"), [])
-        if not support.can_symlink():
+        if not os_helper.can_symlink():
             _check(p.rglob("*/fileB"), ["dirB/fileB"])
         else:
             _check(p.rglob("*/fileB"), ["dirB/fileB", "dirB/linkD/fileB",
@@ -1583,7 +1653,7 @@
         _check(p.rglob("file*"), ["dirC/fileC", "dirC/dirD/fileD"])
         _check(p.rglob("*/*"), ["dirC/dirD/fileD"])
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_rglob_symlink_loop(self):
         # Don't get fooled by symlink loops (Issue #26012).
         P = self.cls
@@ -1626,7 +1696,7 @@
         self.assertEqual(set(p.glob("dirA/../file*")), { P(BASE, "dirA/../fileA") })
         self.assertEqual(set(p.glob("../xyzzy")), set())
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_glob_permissions(self):
         # See bpo-38894
         P = self.cls
@@ -1670,7 +1740,7 @@
     # This can be used to check both relative and absolute resolutions.
     _check_resolve_relative = _check_resolve_absolute = _check_resolve
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_resolve_common(self):
         P = self.cls
         p = P(BASE, 'foo')
@@ -1710,8 +1780,9 @@
             # resolves to 'dirB/..' first before resolving to parent of dirB.
             self._check_resolve_relative(p, P(BASE, 'foo', 'in', 'spam'), False)
         # Now create absolute symlinks.
-        d = support._longpath(tempfile.mkdtemp(suffix='-dirD', dir=os.getcwd()))
-        self.addCleanup(support.rmtree, d)
+        d = os_helper._longpath(tempfile.mkdtemp(suffix='-dirD',
+                                                 dir=os.getcwd()))
+        self.addCleanup(os_helper.rmtree, d)
         os.symlink(os.path.join(d), join('dirA', 'linkX'))
         os.symlink(join('dirB'), os.path.join(d, 'linkY'))
         p = P(BASE, 'dirA', 'linkX', 'linkY', 'fileB')
@@ -1730,7 +1801,7 @@
             # resolves to 'dirB/..' first before resolving to parent of dirB.
             self._check_resolve_relative(p, P(BASE, 'foo', 'in', 'spam'), False)
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_resolve_dot(self):
         # See https://bitbucket.org/pitrou/pathlib/issue/9/pathresolve-fails-on-complex-symlinks
         p = self.cls(BASE)
@@ -1744,6 +1815,16 @@
         # Non-strict
         self.assertEqual(r.resolve(strict=False), p / '3' / '4')
 
+    def test_resolve_nonexist_relative_issue38671(self):
+        p = self.cls('non', 'exist')
+
+        old_cwd = os.getcwd()
+        os.chdir(BASE)
+        try:
+            self.assertEqual(p.resolve(), self.cls(BASE, p))
+        finally:
+            os.chdir(old_cwd)
+
     def test_with(self):
         p = self.cls(BASE)
         it = p.iterdir()
@@ -1773,6 +1854,21 @@
         p.chmod(new_mode)
         self.assertEqual(p.stat().st_mode, new_mode)
 
+    # On Windows, os.chmod does not follow symlinks (issue #15411)
+    @only_posix
+    def test_chmod_follow_symlinks_true(self):
+        p = self.cls(BASE) / 'linkA'
+        q = p.resolve()
+        mode = q.stat().st_mode
+        # Clear writable bit.
+        new_mode = mode & ~0o222
+        p.chmod(new_mode, follow_symlinks=True)
+        self.assertEqual(q.stat().st_mode, new_mode)
+        # Set writable bit
+        new_mode = mode | 0o222
+        p.chmod(new_mode, follow_symlinks=True)
+        self.assertEqual(q.stat().st_mode, new_mode)
+
     # XXX also need a test for lchmod.
 
     def test_stat(self):
@@ -1784,7 +1880,18 @@
         self.addCleanup(p.chmod, st.st_mode)
         self.assertNotEqual(p.stat(), st)
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
+    def test_stat_no_follow_symlinks(self):
+        p = self.cls(BASE) / 'linkA'
+        st = p.stat()
+        self.assertNotEqual(st, p.stat(follow_symlinks=False))
+
+    def test_stat_no_follow_symlinks_nosymlink(self):
+        p = self.cls(BASE) / 'fileA'
+        st = p.stat()
+        self.assertEqual(st, p.stat(follow_symlinks=False))
+
+    @os_helper.skip_unless_symlink
     def test_lstat(self):
         p = self.cls(BASE)/ 'linkA'
         st = p.stat()
@@ -1844,7 +1951,8 @@
         # linking to another path.
         q = P / 'dirA' / 'fileAA'
         try:
-            p.link_to(q)
+            with self.assertWarns(DeprecationWarning):
+                p.link_to(q)
         except PermissionError as e:
             self.skipTest('os.link(): %s' % e)
         self.assertEqual(q.stat().st_size, size)
@@ -1852,10 +1960,29 @@
         self.assertTrue(p.stat)
         # Linking to a str of a relative path.
         r = rel_join('fileAAA')
-        q.link_to(r)
+        with self.assertWarns(DeprecationWarning):
+            q.link_to(r)
         self.assertEqual(os.stat(r).st_size, size)
         self.assertTrue(q.stat)
 
+    @unittest.skipUnless(hasattr(os, "link"), "os.link() is not present")
+    def test_hardlink_to(self):
+        P = self.cls(BASE)
+        target = P / 'fileA'
+        size = target.stat().st_size
+        # linking to another path.
+        link = P / 'dirA' / 'fileAA'
+        link.hardlink_to(target)
+        self.assertEqual(link.stat().st_size, size)
+        self.assertTrue(os.path.samefile(target, link))
+        self.assertTrue(target.exists())
+        # Linking to a str of a relative path.
+        link2 = P / 'dirA' / 'fileAAA'
+        target2 = rel_join('fileA')
+        link2.hardlink_to(target2)
+        self.assertEqual(os.stat(target2).st_size, size)
+        self.assertTrue(link2.exists())
+
     @unittest.skipIf(hasattr(os, "link"), "os.link() is present")
     def test_link_to_not_implemented(self):
         P = self.cls(BASE)
@@ -1899,7 +2026,7 @@
         self.assertEqual(os.stat(r).st_size, size)
         self.assertFileNotFound(q.stat)
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_readlink(self):
         P = self.cls(BASE)
         self.assertEqual((P / 'linkA').readlink(), self.cls('fileA'))
@@ -2074,7 +2201,7 @@
                 self.assertNotIn(str(p12), concurrently_created)
             self.assertTrue(p.exists())
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_symlink_to(self):
         P = self.cls(BASE)
         target = P / 'fileA'
@@ -2104,7 +2231,7 @@
         self.assertFalse((P / 'fileA').is_dir())
         self.assertFalse((P / 'non-existing').is_dir())
         self.assertFalse((P / 'fileA' / 'bah').is_dir())
-        if support.can_symlink():
+        if os_helper.can_symlink():
             self.assertFalse((P / 'linkA').is_dir())
             self.assertTrue((P / 'linkB').is_dir())
             self.assertFalse((P/ 'brokenLink').is_dir(), False)
@@ -2117,7 +2244,7 @@
         self.assertFalse((P / 'dirA').is_file())
         self.assertFalse((P / 'non-existing').is_file())
         self.assertFalse((P / 'fileA' / 'bah').is_file())
-        if support.can_symlink():
+        if os_helper.can_symlink():
             self.assertTrue((P / 'linkA').is_file())
             self.assertFalse((P / 'linkB').is_file())
             self.assertFalse((P/ 'brokenLink').is_file())
@@ -2133,7 +2260,7 @@
         self.assertFalse((P / 'non-existing').is_mount())
         self.assertFalse((P / 'fileA' / 'bah').is_mount())
         self.assertTrue(R.is_mount())
-        if support.can_symlink():
+        if os_helper.can_symlink():
             self.assertFalse((P / 'linkA').is_mount())
         self.assertIs(self.cls('/\udfff').is_mount(), False)
         self.assertIs(self.cls('/\x00').is_mount(), False)
@@ -2144,13 +2271,13 @@
         self.assertFalse((P / 'dirA').is_symlink())
         self.assertFalse((P / 'non-existing').is_symlink())
         self.assertFalse((P / 'fileA' / 'bah').is_symlink())
-        if support.can_symlink():
+        if os_helper.can_symlink():
             self.assertTrue((P / 'linkA').is_symlink())
             self.assertTrue((P / 'linkB').is_symlink())
             self.assertTrue((P/ 'brokenLink').is_symlink())
         self.assertIs((P / 'fileA\udfff').is_file(), False)
         self.assertIs((P / 'fileA\x00').is_file(), False)
-        if support.can_symlink():
+        if os_helper.can_symlink():
             self.assertIs((P / 'linkA\udfff').is_file(), False)
             self.assertIs((P / 'linkA\x00').is_file(), False)
 
@@ -2164,6 +2291,8 @@
         self.assertIs((P / 'fileA\x00').is_fifo(), False)
 
     @unittest.skipUnless(hasattr(os, "mkfifo"), "os.mkfifo() required")
+    @unittest.skipIf(sys.platform == "vxworks",
+                    "fifo requires special path on VxWorks")
     def test_is_fifo_true(self):
         P = self.cls(BASE, 'myfifo')
         try:
@@ -2288,15 +2417,15 @@
         finally:
             os.chdir(old_path)
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_complex_symlinks_absolute(self):
         self._check_complex_symlinks(BASE)
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_complex_symlinks_relative(self):
         self._check_complex_symlinks('.')
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_complex_symlinks_relative_dot_dot(self):
         self._check_complex_symlinks(os.path.join('dirA', '..'))
 
@@ -2371,7 +2500,7 @@
         st = os.stat(join('masked_new_file'))
         self.assertEqual(stat.S_IMODE(st.st_mode), 0o750)
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_resolve_loop(self):
         # Loops with relative symlinks.
         os.symlink('linkX/inside', join('linkX'))
@@ -2396,7 +2525,7 @@
         P = self.cls
         p = P(BASE)
         given = set(p.glob("FILEa"))
-        expect = set() if not support.fs_is_case_insensitive(BASE) else given
+        expect = set() if not os_helper.fs_is_case_insensitive(BASE) else given
         self.assertEqual(given, expect)
         self.assertEqual(set(p.glob("FILEa*")), set())
 
@@ -2404,15 +2533,17 @@
         P = self.cls
         p = P(BASE, "dirC")
         given = set(p.rglob("FILEd"))
-        expect = set() if not support.fs_is_case_insensitive(BASE) else given
+        expect = set() if not os_helper.fs_is_case_insensitive(BASE) else given
         self.assertEqual(given, expect)
         self.assertEqual(set(p.rglob("FILEd*")), set())
 
     @unittest.skipUnless(hasattr(pwd, 'getpwall'),
                          'pwd module does not expose getpwall()')
+    @unittest.skipIf(sys.platform == "vxworks",
+                     "no home directory on VxWorks")
     def test_expanduser(self):
         P = self.cls
-        support.import_module('pwd')
+        import_helper.import_module('pwd')
         import pwd
         pwdent = pwd.getpwuid(os.getuid())
         username = pwdent.pw_name
@@ -2427,15 +2558,23 @@
             othername = username
             otherhome = userhome
 
-        p1 = P('~/Documents')
-        p2 = P('~' + username + '/Documents')
-        p3 = P('~' + othername + '/Documents')
-        p4 = P('../~' + username + '/Documents')
-        p5 = P('/~' + username + '/Documents')
-        p6 = P('')
-        p7 = P('~fakeuser/Documents')
+        fakename = 'fakeuser'
+        # This user can theoretically exist on a test runner. Create unique name:
+        try:
+            while pwd.getpwnam(fakename):
+                fakename += '1'
+        except KeyError:
+            pass  # Non-existent name found
 
-        with support.EnvironmentVarGuard() as env:
+        p1 = P('~/Documents')
+        p2 = P(f'~{username}/Documents')
+        p3 = P(f'~{othername}/Documents')
+        p4 = P(f'../~{username}/Documents')
+        p5 = P(f'/~{username}/Documents')
+        p6 = P('')
+        p7 = P(f'~{fakename}/Documents')
+
+        with os_helper.EnvironmentVarGuard() as env:
             env.pop('HOME', None)
 
             self.assertEqual(p1.expanduser(), P(userhome) / 'Documents')
@@ -2499,7 +2638,7 @@
 
     def test_expanduser(self):
         P = self.cls
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env.pop('HOME', None)
             env.pop('USERPROFILE', None)
             env.pop('HOMEPATH', None)
@@ -2524,7 +2663,7 @@
                 env.pop('USERNAME', None)
                 self.assertEqual(p1.expanduser(),
                                  P('C:/Users/alice/My Documents'))
-                self.assertRaises(KeyError, p2.expanduser)
+                self.assertRaises(RuntimeError, p2.expanduser)
                 env['USERNAME'] = 'alice'
                 self.assertEqual(p2.expanduser(),
                                  P('C:/Users/alice/My Documents'))
diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py
new file mode 100644
index 0000000..aa18e29
--- /dev/null
+++ b/Lib/test/test_patma.py
@@ -0,0 +1,3176 @@
+import array
+import collections
+import dataclasses
+import enum
+import inspect
+import sys
+import unittest
+
+
+@dataclasses.dataclass
+class Point:
+    x: int
+    y: int
+
+
+class TestCompiler(unittest.TestCase):
+
+    def test_refleaks(self):
+        # Hunting for leaks using -R doesn't catch leaks in the compiler itself,
+        # just the code under test. This test ensures that if there are leaks in
+        # the pattern compiler, those runs will fail:
+        with open(__file__) as file:
+            compile(file.read(), __file__, "exec")
+
+
+class TestInheritance(unittest.TestCase):
+
+    @staticmethod
+    def check_sequence_then_mapping(x):
+        match x:
+            case [*_]:
+                return "seq"
+            case {}:
+                return "map"
+
+    @staticmethod
+    def check_mapping_then_sequence(x):
+        match x:
+            case {}:
+                return "map"
+            case [*_]:
+                return "seq"
+
+    def test_multiple_inheritance_mapping(self):
+        class C:
+            pass
+        class M1(collections.UserDict, collections.abc.Sequence):
+            pass
+        class M2(C, collections.UserDict, collections.abc.Sequence):
+            pass
+        class M3(collections.UserDict, C, list):
+            pass
+        class M4(dict, collections.abc.Sequence, C):
+            pass
+        self.assertEqual(self.check_sequence_then_mapping(M1()), "map")
+        self.assertEqual(self.check_sequence_then_mapping(M2()), "map")
+        self.assertEqual(self.check_sequence_then_mapping(M3()), "map")
+        self.assertEqual(self.check_sequence_then_mapping(M4()), "map")
+        self.assertEqual(self.check_mapping_then_sequence(M1()), "map")
+        self.assertEqual(self.check_mapping_then_sequence(M2()), "map")
+        self.assertEqual(self.check_mapping_then_sequence(M3()), "map")
+        self.assertEqual(self.check_mapping_then_sequence(M4()), "map")
+
+    def test_multiple_inheritance_sequence(self):
+        class C:
+            pass
+        class S1(collections.UserList, collections.abc.Mapping):
+            pass
+        class S2(C, collections.UserList, collections.abc.Mapping):
+            pass
+        class S3(list, C, collections.abc.Mapping):
+            pass
+        class S4(collections.UserList, dict, C):
+            pass
+        self.assertEqual(self.check_sequence_then_mapping(S1()), "seq")
+        self.assertEqual(self.check_sequence_then_mapping(S2()), "seq")
+        self.assertEqual(self.check_sequence_then_mapping(S3()), "seq")
+        self.assertEqual(self.check_sequence_then_mapping(S4()), "seq")
+        self.assertEqual(self.check_mapping_then_sequence(S1()), "seq")
+        self.assertEqual(self.check_mapping_then_sequence(S2()), "seq")
+        self.assertEqual(self.check_mapping_then_sequence(S3()), "seq")
+        self.assertEqual(self.check_mapping_then_sequence(S4()), "seq")
+
+    def test_late_registration_mapping(self):
+        class Parent:
+            pass
+        class ChildPre(Parent):
+            pass
+        class GrandchildPre(ChildPre):
+            pass
+        collections.abc.Mapping.register(Parent)
+        class ChildPost(Parent):
+            pass
+        class GrandchildPost(ChildPost):
+            pass
+        self.assertEqual(self.check_sequence_then_mapping(Parent()), "map")
+        self.assertEqual(self.check_sequence_then_mapping(ChildPre()), "map")
+        self.assertEqual(self.check_sequence_then_mapping(GrandchildPre()), "map")
+        self.assertEqual(self.check_sequence_then_mapping(ChildPost()), "map")
+        self.assertEqual(self.check_sequence_then_mapping(GrandchildPost()), "map")
+        self.assertEqual(self.check_mapping_then_sequence(Parent()), "map")
+        self.assertEqual(self.check_mapping_then_sequence(ChildPre()), "map")
+        self.assertEqual(self.check_mapping_then_sequence(GrandchildPre()), "map")
+        self.assertEqual(self.check_mapping_then_sequence(ChildPost()), "map")
+        self.assertEqual(self.check_mapping_then_sequence(GrandchildPost()), "map")
+
+    def test_late_registration_sequence(self):
+        class Parent:
+            pass
+        class ChildPre(Parent):
+            pass
+        class GrandchildPre(ChildPre):
+            pass
+        collections.abc.Sequence.register(Parent)
+        class ChildPost(Parent):
+            pass
+        class GrandchildPost(ChildPost):
+            pass
+        self.assertEqual(self.check_sequence_then_mapping(Parent()), "seq")
+        self.assertEqual(self.check_sequence_then_mapping(ChildPre()), "seq")
+        self.assertEqual(self.check_sequence_then_mapping(GrandchildPre()), "seq")
+        self.assertEqual(self.check_sequence_then_mapping(ChildPost()), "seq")
+        self.assertEqual(self.check_sequence_then_mapping(GrandchildPost()), "seq")
+        self.assertEqual(self.check_mapping_then_sequence(Parent()), "seq")
+        self.assertEqual(self.check_mapping_then_sequence(ChildPre()), "seq")
+        self.assertEqual(self.check_mapping_then_sequence(GrandchildPre()), "seq")
+        self.assertEqual(self.check_mapping_then_sequence(ChildPost()), "seq")
+        self.assertEqual(self.check_mapping_then_sequence(GrandchildPost()), "seq")
+
+
+class TestPatma(unittest.TestCase):
+
+    def test_patma_000(self):
+        match 0:
+            case 0:
+                x = True
+        self.assertIs(x, True)
+
+    def test_patma_001(self):
+        match 0:
+            case 0 if False:
+                x = False
+            case 0 if True:
+                x = True
+        self.assertIs(x, True)
+
+    def test_patma_002(self):
+        match 0:
+            case 0:
+                x = True
+            case 0:
+                x = False
+        self.assertIs(x, True)
+
+    def test_patma_003(self):
+        x = False
+        match 0:
+            case 0 | 1 | 2 | 3:
+                x = True
+        self.assertIs(x, True)
+
+    def test_patma_004(self):
+        x = False
+        match 1:
+            case 0 | 1 | 2 | 3:
+                x = True
+        self.assertIs(x, True)
+
+    def test_patma_005(self):
+        x = False
+        match 2:
+            case 0 | 1 | 2 | 3:
+                x = True
+        self.assertIs(x, True)
+
+    def test_patma_006(self):
+        x = False
+        match 3:
+            case 0 | 1 | 2 | 3:
+                x = True
+        self.assertIs(x, True)
+
+    def test_patma_007(self):
+        x = False
+        match 4:
+            case 0 | 1 | 2 | 3:
+                x = True
+        self.assertIs(x, False)
+
+    def test_patma_008(self):
+        x = 0
+        class A:
+            y = 1
+        match x:
+            case A.y as z:
+                pass
+        self.assertEqual(x, 0)
+        self.assertEqual(A.y, 1)
+
+    def test_patma_009(self):
+        class A:
+            B = 0
+        match 0:
+            case x if x:
+                z = 0
+            case _ as y if y == x and y:
+                z = 1
+            case A.B:
+                z = 2
+        self.assertEqual(A.B, 0)
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+        self.assertEqual(z, 2)
+
+    def test_patma_010(self):
+        match ():
+            case []:
+                x = 0
+        self.assertEqual(x, 0)
+
+    def test_patma_011(self):
+        match (0, 1, 2):
+            case [*x]:
+                y = 0
+        self.assertEqual(x, [0, 1, 2])
+        self.assertEqual(y, 0)
+
+    def test_patma_012(self):
+        match (0, 1, 2):
+            case [0, *x]:
+                y = 0
+        self.assertEqual(x, [1, 2])
+        self.assertEqual(y, 0)
+
+    def test_patma_013(self):
+        match (0, 1, 2):
+            case [0, 1, *x,]:
+                y = 0
+        self.assertEqual(x, [2])
+        self.assertEqual(y, 0)
+
+    def test_patma_014(self):
+        match (0, 1, 2):
+            case [0, 1, 2, *x]:
+                y = 0
+        self.assertEqual(x, [])
+        self.assertEqual(y, 0)
+
+    def test_patma_015(self):
+        match (0, 1, 2):
+            case [*x, 2,]:
+                y = 0
+        self.assertEqual(x, [0, 1])
+        self.assertEqual(y, 0)
+
+    def test_patma_016(self):
+        match (0, 1, 2):
+            case [*x, 1, 2]:
+                y = 0
+        self.assertEqual(x, [0])
+        self.assertEqual(y, 0)
+
+    def test_patma_017(self):
+        match (0, 1, 2):
+            case [*x, 0, 1, 2,]:
+                y = 0
+        self.assertEqual(x, [])
+        self.assertEqual(y, 0)
+
+    def test_patma_018(self):
+        match (0, 1, 2):
+            case [0, *x, 2]:
+                y = 0
+        self.assertEqual(x, [1])
+        self.assertEqual(y, 0)
+
+    def test_patma_019(self):
+        match (0, 1, 2):
+            case [0, 1, *x, 2,]:
+                y = 0
+        self.assertEqual(x, [])
+        self.assertEqual(y, 0)
+
+    def test_patma_020(self):
+        match (0, 1, 2):
+            case [0, *x, 1, 2]:
+                y = 0
+        self.assertEqual(x, [])
+        self.assertEqual(y, 0)
+
+    def test_patma_021(self):
+        match (0, 1, 2):
+            case [*x,]:
+                y = 0
+        self.assertEqual(x, [0, 1, 2])
+        self.assertEqual(y, 0)
+
+    def test_patma_022(self):
+        x = {}
+        match x:
+            case {}:
+                y = 0
+        self.assertEqual(x, {})
+        self.assertEqual(y, 0)
+
+    def test_patma_023(self):
+        x = {0: 0}
+        match x:
+            case {}:
+                y = 0
+        self.assertEqual(x, {0: 0})
+        self.assertEqual(y, 0)
+
+    def test_patma_024(self):
+        x = {}
+        y = None
+        match x:
+            case {0: 0}:
+                y = 0
+        self.assertEqual(x, {})
+        self.assertIs(y, None)
+
+    def test_patma_025(self):
+        x = {0: 0}
+        match x:
+            case {0: (0 | 1 | 2 as z)}:
+                y = 0
+        self.assertEqual(x, {0: 0})
+        self.assertEqual(y, 0)
+        self.assertEqual(z, 0)
+
+    def test_patma_026(self):
+        x = {0: 1}
+        match x:
+            case {0: (0 | 1 | 2 as z)}:
+                y = 0
+        self.assertEqual(x, {0: 1})
+        self.assertEqual(y, 0)
+        self.assertEqual(z, 1)
+
+    def test_patma_027(self):
+        x = {0: 2}
+        match x:
+            case {0: (0 | 1 | 2 as z)}:
+                y = 0
+        self.assertEqual(x, {0: 2})
+        self.assertEqual(y, 0)
+        self.assertEqual(z, 2)
+
+    def test_patma_028(self):
+        x = {0: 3}
+        y = None
+        match x:
+            case {0: (0 | 1 | 2 as z)}:
+                y = 0
+        self.assertEqual(x, {0: 3})
+        self.assertIs(y, None)
+
+    def test_patma_029(self):
+        x = {}
+        y = None
+        match x:
+            case {0: [1, 2, {}]}:
+                y = 0
+            case {0: [1, 2, {}], 1: [[]]}:
+                y = 1
+            case []:
+                y = 2
+        self.assertEqual(x, {})
+        self.assertIs(y, None)
+
+    def test_patma_030(self):
+        x = {False: (True, 2.0, {})}
+        match x:
+            case {0: [1, 2, {}]}:
+                y = 0
+            case {0: [1, 2, {}], 1: [[]]}:
+                y = 1
+            case []:
+                y = 2
+        self.assertEqual(x, {False: (True, 2.0, {})})
+        self.assertEqual(y, 0)
+
+    def test_patma_031(self):
+        x = {False: (True, 2.0, {}), 1: [[]], 2: 0}
+        match x:
+            case {0: [1, 2, {}]}:
+                y = 0
+            case {0: [1, 2, {}], 1: [[]]}:
+                y = 1
+            case []:
+                y = 2
+        self.assertEqual(x, {False: (True, 2.0, {}), 1: [[]], 2: 0})
+        self.assertEqual(y, 0)
+
+    def test_patma_032(self):
+        x = {False: (True, 2.0, {}), 1: [[]], 2: 0}
+        match x:
+            case {0: [1, 2]}:
+                y = 0
+            case {0: [1, 2, {}], 1: [[]]}:
+                y = 1
+            case []:
+                y = 2
+        self.assertEqual(x, {False: (True, 2.0, {}), 1: [[]], 2: 0})
+        self.assertEqual(y, 1)
+
+    def test_patma_033(self):
+        x = []
+        match x:
+            case {0: [1, 2, {}]}:
+                y = 0
+            case {0: [1, 2, {}], 1: [[]]}:
+                y = 1
+            case []:
+                y = 2
+        self.assertEqual(x, [])
+        self.assertEqual(y, 2)
+
+    def test_patma_034(self):
+        x = {0: 0}
+        match x:
+            case {0: [1, 2, {}]}:
+                y = 0
+            case {0: ([1, 2, {}] | False)} | {1: [[]]} | {0: [1, 2, {}]} | [] | "X" | {}:
+                y = 1
+            case []:
+                y = 2
+        self.assertEqual(x, {0: 0})
+        self.assertEqual(y, 1)
+
+    def test_patma_035(self):
+        x = {0: 0}
+        match x:
+            case {0: [1, 2, {}]}:
+                y = 0
+            case {0: [1, 2, {}] | True} | {1: [[]]} | {0: [1, 2, {}]} | [] | "X" | {}:
+                y = 1
+            case []:
+                y = 2
+        self.assertEqual(x, {0: 0})
+        self.assertEqual(y, 1)
+
+    def test_patma_036(self):
+        x = 0
+        match x:
+            case 0 | 1 | 2:
+                y = 0
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+
+    def test_patma_037(self):
+        x = 1
+        match x:
+            case 0 | 1 | 2:
+                y = 0
+        self.assertEqual(x, 1)
+        self.assertEqual(y, 0)
+
+    def test_patma_038(self):
+        x = 2
+        match x:
+            case 0 | 1 | 2:
+                y = 0
+        self.assertEqual(x, 2)
+        self.assertEqual(y, 0)
+
+    def test_patma_039(self):
+        x = 3
+        y = None
+        match x:
+            case 0 | 1 | 2:
+                y = 0
+        self.assertEqual(x, 3)
+        self.assertIs(y, None)
+
+    def test_patma_040(self):
+        x = 0
+        match x:
+            case (0 as z) | (1 as z) | (2 as z) if z == x % 2:
+                y = 0
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+        self.assertEqual(z, 0)
+
+    def test_patma_041(self):
+        x = 1
+        match x:
+            case (0 as z) | (1 as z) | (2 as z) if z == x % 2:
+                y = 0
+        self.assertEqual(x, 1)
+        self.assertEqual(y, 0)
+        self.assertEqual(z, 1)
+
+    def test_patma_042(self):
+        x = 2
+        y = None
+        match x:
+            case (0 as z) | (1 as z) | (2 as z) if z == x % 2:
+                y = 0
+        self.assertEqual(x, 2)
+        self.assertIs(y, None)
+        self.assertEqual(z, 2)
+
+    def test_patma_043(self):
+        x = 3
+        y = None
+        match x:
+            case (0 as z) | (1 as z) | (2 as z) if z == x % 2:
+                y = 0
+        self.assertEqual(x, 3)
+        self.assertIs(y, None)
+
+    def test_patma_044(self):
+        x = ()
+        match x:
+            case []:
+                y = 0
+        self.assertEqual(x, ())
+        self.assertEqual(y, 0)
+
+    def test_patma_045(self):
+        x = ()
+        match x:
+            case ():
+                y = 0
+        self.assertEqual(x, ())
+        self.assertEqual(y, 0)
+
+    def test_patma_046(self):
+        x = (0,)
+        match x:
+            case [0]:
+                y = 0
+        self.assertEqual(x, (0,))
+        self.assertEqual(y, 0)
+
+    def test_patma_047(self):
+        x = ((),)
+        match x:
+            case [[]]:
+                y = 0
+        self.assertEqual(x, ((),))
+        self.assertEqual(y, 0)
+
+    def test_patma_048(self):
+        x = [0, 1]
+        match x:
+            case [0, 1] | [1, 0]:
+                y = 0
+        self.assertEqual(x, [0, 1])
+        self.assertEqual(y, 0)
+
+    def test_patma_049(self):
+        x = [1, 0]
+        match x:
+            case [0, 1] | [1, 0]:
+                y = 0
+        self.assertEqual(x, [1, 0])
+        self.assertEqual(y, 0)
+
+    def test_patma_050(self):
+        x = [0, 0]
+        y = None
+        match x:
+            case [0, 1] | [1, 0]:
+                y = 0
+        self.assertEqual(x, [0, 0])
+        self.assertIs(y, None)
+
+    def test_patma_051(self):
+        w = None
+        x = [1, 0]
+        match x:
+            case [(0 as w)]:
+                y = 0
+            case [z] | [1, (0 | 1 as z)] | [z]:
+                y = 1
+        self.assertIs(w, None)
+        self.assertEqual(x, [1, 0])
+        self.assertEqual(y, 1)
+        self.assertEqual(z, 0)
+
+    def test_patma_052(self):
+        x = [1, 0]
+        match x:
+            case [0]:
+                y = 0
+            case [1, 0] if (x := x[:0]):
+                y = 1
+            case [1, 0]:
+                y = 2
+        self.assertEqual(x, [])
+        self.assertEqual(y, 2)
+
+    def test_patma_053(self):
+        x = {0}
+        y = None
+        match x:
+            case [0]:
+                y = 0
+        self.assertEqual(x, {0})
+        self.assertIs(y, None)
+
+    def test_patma_054(self):
+        x = set()
+        y = None
+        match x:
+            case []:
+                y = 0
+        self.assertEqual(x, set())
+        self.assertIs(y, None)
+
+    def test_patma_055(self):
+        x = iter([1, 2, 3])
+        y = None
+        match x:
+            case []:
+                y = 0
+        self.assertEqual([*x], [1, 2, 3])
+        self.assertIs(y, None)
+
+    def test_patma_056(self):
+        x = {}
+        y = None
+        match x:
+            case []:
+                y = 0
+        self.assertEqual(x, {})
+        self.assertIs(y, None)
+
+    def test_patma_057(self):
+        x = {0: False, 1: True}
+        y = None
+        match x:
+            case [0, 1]:
+                y = 0
+        self.assertEqual(x, {0: False, 1: True})
+        self.assertIs(y, None)
+
+    def test_patma_058(self):
+        x = 0
+        match x:
+            case 0:
+                y = 0
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+
+    def test_patma_059(self):
+        x = 0
+        y = None
+        match x:
+            case False:
+                y = 0
+        self.assertEqual(x, 0)
+        self.assertEqual(y, None)
+
+    def test_patma_060(self):
+        x = 0
+        y = None
+        match x:
+            case 1:
+                y = 0
+        self.assertEqual(x, 0)
+        self.assertIs(y, None)
+
+    def test_patma_061(self):
+        x = 0
+        y = None
+        match x:
+            case None:
+                y = 0
+        self.assertEqual(x, 0)
+        self.assertIs(y, None)
+
+    def test_patma_062(self):
+        x = 0
+        match x:
+            case 0:
+                y = 0
+            case 0:
+                y = 1
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+
+    def test_patma_063(self):
+        x = 0
+        y = None
+        match x:
+            case 1:
+                y = 0
+            case 1:
+                y = 1
+        self.assertEqual(x, 0)
+        self.assertIs(y, None)
+
+    def test_patma_064(self):
+        x = "x"
+        match x:
+            case "x":
+                y = 0
+            case "y":
+                y = 1
+        self.assertEqual(x, "x")
+        self.assertEqual(y, 0)
+
+    def test_patma_065(self):
+        x = "x"
+        match x:
+            case "y":
+                y = 0
+            case "x":
+                y = 1
+        self.assertEqual(x, "x")
+        self.assertEqual(y, 1)
+
+    def test_patma_066(self):
+        x = "x"
+        match x:
+            case "":
+                y = 0
+            case "x":
+                y = 1
+        self.assertEqual(x, "x")
+        self.assertEqual(y, 1)
+
+    def test_patma_067(self):
+        x = b"x"
+        match x:
+            case b"y":
+                y = 0
+            case b"x":
+                y = 1
+        self.assertEqual(x, b"x")
+        self.assertEqual(y, 1)
+
+    def test_patma_068(self):
+        x = 0
+        match x:
+            case 0 if False:
+                y = 0
+            case 0:
+                y = 1
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 1)
+
+    def test_patma_069(self):
+        x = 0
+        y = None
+        match x:
+            case 0 if 0:
+                y = 0
+            case 0 if 0:
+                y = 1
+        self.assertEqual(x, 0)
+        self.assertIs(y, None)
+
+    def test_patma_070(self):
+        x = 0
+        match x:
+            case 0 if True:
+                y = 0
+            case 0 if True:
+                y = 1
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+
+    def test_patma_071(self):
+        x = 0
+        match x:
+            case 0 if 1:
+                y = 0
+            case 0 if 1:
+                y = 1
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+
+    def test_patma_072(self):
+        x = 0
+        match x:
+            case 0 if True:
+                y = 0
+            case 0 if True:
+                y = 1
+        y = 2
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 2)
+
+    def test_patma_073(self):
+        x = 0
+        match x:
+            case 0 if 0:
+                y = 0
+            case 0 if 1:
+                y = 1
+        y = 2
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 2)
+
+    def test_patma_074(self):
+        x = 0
+        y = None
+        match x:
+            case 0 if not (x := 1):
+                y = 0
+            case 1:
+                y = 1
+        self.assertEqual(x, 1)
+        self.assertIs(y, None)
+
+    def test_patma_075(self):
+        x = "x"
+        match x:
+            case ["x"]:
+                y = 0
+            case "x":
+                y = 1
+        self.assertEqual(x, "x")
+        self.assertEqual(y, 1)
+
+    def test_patma_076(self):
+        x = b"x"
+        match x:
+            case [b"x"]:
+                y = 0
+            case ["x"]:
+                y = 1
+            case [120]:
+                y = 2
+            case b"x":
+                y = 4
+        self.assertEqual(x, b"x")
+        self.assertEqual(y, 4)
+
+    def test_patma_077(self):
+        x = bytearray(b"x")
+        y = None
+        match x:
+            case [120]:
+                y = 0
+            case 120:
+                y = 1
+        self.assertEqual(x, b"x")
+        self.assertIs(y, None)
+
+    def test_patma_078(self):
+        x = ""
+        match x:
+            case []:
+                y = 0
+            case [""]:
+                y = 1
+            case "":
+                y = 2
+        self.assertEqual(x, "")
+        self.assertEqual(y, 2)
+
+    def test_patma_079(self):
+        x = "xxx"
+        match x:
+            case ["x", "x", "x"]:
+                y = 0
+            case ["xxx"]:
+                y = 1
+            case "xxx":
+                y = 2
+        self.assertEqual(x, "xxx")
+        self.assertEqual(y, 2)
+
+    def test_patma_080(self):
+        x = b"xxx"
+        match x:
+            case [120, 120, 120]:
+                y = 0
+            case [b"xxx"]:
+                y = 1
+            case b"xxx":
+                y = 2
+        self.assertEqual(x, b"xxx")
+        self.assertEqual(y, 2)
+
+    def test_patma_081(self):
+        x = 0
+        match x:
+            case 0 if not (x := 1):
+                y = 0
+            case (0 as z):
+                y = 1
+        self.assertEqual(x, 1)
+        self.assertEqual(y, 1)
+        self.assertEqual(z, 0)
+
+    def test_patma_082(self):
+        x = 0
+        match x:
+            case (1 as z) if not (x := 1):
+                y = 0
+            case 0:
+                y = 1
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 1)
+
+    def test_patma_083(self):
+        x = 0
+        match x:
+            case (0 as z):
+                y = 0
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+        self.assertEqual(z, 0)
+
+    def test_patma_084(self):
+        x = 0
+        y = None
+        match x:
+            case (1 as z):
+                y = 0
+        self.assertEqual(x, 0)
+        self.assertIs(y, None)
+
+    def test_patma_085(self):
+        x = 0
+        y = None
+        match x:
+            case (0 as z) if (w := 0):
+                y = 0
+        self.assertEqual(w, 0)
+        self.assertEqual(x, 0)
+        self.assertIs(y, None)
+        self.assertEqual(z, 0)
+
+    def test_patma_086(self):
+        x = 0
+        match x:
+            case ((0 as w) as z):
+                y = 0
+        self.assertEqual(w, 0)
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+        self.assertEqual(z, 0)
+
+    def test_patma_087(self):
+        x = 0
+        match x:
+            case (0 | 1) | 2:
+                y = 0
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+
+    def test_patma_088(self):
+        x = 1
+        match x:
+            case (0 | 1) | 2:
+                y = 0
+        self.assertEqual(x, 1)
+        self.assertEqual(y, 0)
+
+    def test_patma_089(self):
+        x = 2
+        match x:
+            case (0 | 1) | 2:
+                y = 0
+        self.assertEqual(x, 2)
+        self.assertEqual(y, 0)
+
+    def test_patma_090(self):
+        x = 3
+        y = None
+        match x:
+            case (0 | 1) | 2:
+                y = 0
+        self.assertEqual(x, 3)
+        self.assertIs(y, None)
+
+    def test_patma_091(self):
+        x = 0
+        match x:
+            case 0 | (1 | 2):
+                y = 0
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+
+    def test_patma_092(self):
+        x = 1
+        match x:
+            case 0 | (1 | 2):
+                y = 0
+        self.assertEqual(x, 1)
+        self.assertEqual(y, 0)
+
+    def test_patma_093(self):
+        x = 2
+        match x:
+            case 0 | (1 | 2):
+                y = 0
+        self.assertEqual(x, 2)
+        self.assertEqual(y, 0)
+
+    def test_patma_094(self):
+        x = 3
+        y = None
+        match x:
+            case 0 | (1 | 2):
+                y = 0
+        self.assertEqual(x, 3)
+        self.assertIs(y, None)
+
+    def test_patma_095(self):
+        x = 0
+        match x:
+            case -0:
+                y = 0
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+
+    def test_patma_096(self):
+        x = 0
+        match x:
+            case -0.0:
+                y = 0
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+
+    def test_patma_097(self):
+        x = 0
+        match x:
+            case -0j:
+                y = 0
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+
+    def test_patma_098(self):
+        x = 0
+        match x:
+            case -0.0j:
+                y = 0
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+
+    def test_patma_099(self):
+        x = -1
+        match x:
+            case -1:
+                y = 0
+        self.assertEqual(x, -1)
+        self.assertEqual(y, 0)
+
+    def test_patma_100(self):
+        x = -1.5
+        match x:
+            case -1.5:
+                y = 0
+        self.assertEqual(x, -1.5)
+        self.assertEqual(y, 0)
+
+    def test_patma_101(self):
+        x = -1j
+        match x:
+            case -1j:
+                y = 0
+        self.assertEqual(x, -1j)
+        self.assertEqual(y, 0)
+
+    def test_patma_102(self):
+        x = -1.5j
+        match x:
+            case -1.5j:
+                y = 0
+        self.assertEqual(x, -1.5j)
+        self.assertEqual(y, 0)
+
+    def test_patma_103(self):
+        x = 0
+        match x:
+            case 0 + 0j:
+                y = 0
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+
+    def test_patma_104(self):
+        x = 0
+        match x:
+            case 0 - 0j:
+                y = 0
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+
+    def test_patma_105(self):
+        x = 0
+        match x:
+            case -0 + 0j:
+                y = 0
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+
+    def test_patma_106(self):
+        x = 0
+        match x:
+            case -0 - 0j:
+                y = 0
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+
+    def test_patma_107(self):
+        x = 0.25 + 1.75j
+        match x:
+            case 0.25 + 1.75j:
+                y = 0
+        self.assertEqual(x, 0.25 + 1.75j)
+        self.assertEqual(y, 0)
+
+    def test_patma_108(self):
+        x = 0.25 - 1.75j
+        match x:
+            case 0.25 - 1.75j:
+                y = 0
+        self.assertEqual(x, 0.25 - 1.75j)
+        self.assertEqual(y, 0)
+
+    def test_patma_109(self):
+        x = -0.25 + 1.75j
+        match x:
+            case -0.25 + 1.75j:
+                y = 0
+        self.assertEqual(x, -0.25 + 1.75j)
+        self.assertEqual(y, 0)
+
+    def test_patma_110(self):
+        x = -0.25 - 1.75j
+        match x:
+            case -0.25 - 1.75j:
+                y = 0
+        self.assertEqual(x, -0.25 - 1.75j)
+        self.assertEqual(y, 0)
+
+    def test_patma_111(self):
+        class A:
+            B = 0
+        x = 0
+        match x:
+            case A.B:
+                y = 0
+        self.assertEqual(A.B, 0)
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+
+    def test_patma_112(self):
+        class A:
+            class B:
+                C = 0
+        x = 0
+        match x:
+            case A.B.C:
+                y = 0
+        self.assertEqual(A.B.C, 0)
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+
+    def test_patma_113(self):
+        class A:
+            class B:
+                C = 0
+                D = 1
+        x = 1
+        match x:
+            case A.B.C:
+                y = 0
+            case A.B.D:
+                y = 1
+        self.assertEqual(A.B.C, 0)
+        self.assertEqual(A.B.D, 1)
+        self.assertEqual(x, 1)
+        self.assertEqual(y, 1)
+
+    def test_patma_114(self):
+        class A:
+            class B:
+                class C:
+                    D = 0
+        x = 0
+        match x:
+            case A.B.C.D:
+                y = 0
+        self.assertEqual(A.B.C.D, 0)
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+
+    def test_patma_115(self):
+        class A:
+            class B:
+                class C:
+                    D = 0
+                    E = 1
+        x = 1
+        match x:
+            case A.B.C.D:
+                y = 0
+            case A.B.C.E:
+                y = 1
+        self.assertEqual(A.B.C.D, 0)
+        self.assertEqual(A.B.C.E, 1)
+        self.assertEqual(x, 1)
+        self.assertEqual(y, 1)
+
+    def test_patma_116(self):
+        match = case = 0
+        match match:
+            case case:
+                x = 0
+        self.assertEqual(match, 0)
+        self.assertEqual(case, 0)
+        self.assertEqual(x, 0)
+
+    def test_patma_117(self):
+        match = case = 0
+        match case:
+            case match:
+                x = 0
+        self.assertEqual(match, 0)
+        self.assertEqual(case, 0)
+        self.assertEqual(x, 0)
+
+    def test_patma_118(self):
+        x = []
+        match x:
+            case [*_, _]:
+                y = 0
+            case []:
+                y = 1
+        self.assertEqual(x, [])
+        self.assertEqual(y, 1)
+
+    def test_patma_119(self):
+        x = collections.defaultdict(int)
+        match x:
+            case {0: 0}:
+                y = 0
+            case {}:
+                y = 1
+        self.assertEqual(x, {})
+        self.assertEqual(y, 1)
+
+    def test_patma_120(self):
+        x = collections.defaultdict(int)
+        match x:
+            case {0: 0}:
+                y = 0
+            case {**z}:
+                y = 1
+        self.assertEqual(x, {})
+        self.assertEqual(y, 1)
+        self.assertEqual(z, {})
+
+    def test_patma_121(self):
+        match ():
+            case ():
+                x = 0
+        self.assertEqual(x, 0)
+
+    def test_patma_122(self):
+        match (0, 1, 2):
+            case (*x,):
+                y = 0
+        self.assertEqual(x, [0, 1, 2])
+        self.assertEqual(y, 0)
+
+    def test_patma_123(self):
+        match (0, 1, 2):
+            case 0, *x:
+                y = 0
+        self.assertEqual(x, [1, 2])
+        self.assertEqual(y, 0)
+
+    def test_patma_124(self):
+        match (0, 1, 2):
+            case (0, 1, *x,):
+                y = 0
+        self.assertEqual(x, [2])
+        self.assertEqual(y, 0)
+
+    def test_patma_125(self):
+        match (0, 1, 2):
+            case 0, 1, 2, *x:
+                y = 0
+        self.assertEqual(x, [])
+        self.assertEqual(y, 0)
+
+    def test_patma_126(self):
+        match (0, 1, 2):
+            case *x, 2,:
+                y = 0
+        self.assertEqual(x, [0, 1])
+        self.assertEqual(y, 0)
+
+    def test_patma_127(self):
+        match (0, 1, 2):
+            case (*x, 1, 2):
+                y = 0
+        self.assertEqual(x, [0])
+        self.assertEqual(y, 0)
+
+    def test_patma_128(self):
+        match (0, 1, 2):
+            case *x, 0, 1, 2,:
+                y = 0
+        self.assertEqual(x, [])
+        self.assertEqual(y, 0)
+
+    def test_patma_129(self):
+        match (0, 1, 2):
+            case (0, *x, 2):
+                y = 0
+        self.assertEqual(x, [1])
+        self.assertEqual(y, 0)
+
+    def test_patma_130(self):
+        match (0, 1, 2):
+            case 0, 1, *x, 2,:
+                y = 0
+        self.assertEqual(x, [])
+        self.assertEqual(y, 0)
+
+    def test_patma_131(self):
+        match (0, 1, 2):
+            case (0, *x, 1, 2):
+                y = 0
+        self.assertEqual(x, [])
+        self.assertEqual(y, 0)
+
+    def test_patma_132(self):
+        match (0, 1, 2):
+            case *x,:
+                y = 0
+        self.assertEqual(x, [0, 1, 2])
+        self.assertEqual(y, 0)
+
+    def test_patma_133(self):
+        x = collections.defaultdict(int, {0: 1})
+        match x:
+            case {1: 0}:
+                y = 0
+            case {0: 0}:
+                y = 1
+            case {}:
+                y = 2
+        self.assertEqual(x, {0: 1})
+        self.assertEqual(y, 2)
+
+    def test_patma_134(self):
+        x = collections.defaultdict(int, {0: 1})
+        match x:
+            case {1: 0}:
+                y = 0
+            case {0: 0}:
+                y = 1
+            case {**z}:
+                y = 2
+        self.assertEqual(x, {0: 1})
+        self.assertEqual(y, 2)
+        self.assertEqual(z, {0: 1})
+
+    def test_patma_135(self):
+        x = collections.defaultdict(int, {0: 1})
+        match x:
+            case {1: 0}:
+                y = 0
+            case {0: 0}:
+                y = 1
+            case {0: _, **z}:
+                y = 2
+        self.assertEqual(x, {0: 1})
+        self.assertEqual(y, 2)
+        self.assertEqual(z, {})
+
+    def test_patma_136(self):
+        x = {0: 1}
+        match x:
+            case {1: 0}:
+                y = 0
+            case {0: 0}:
+                y = 0
+            case {}:
+                y = 1
+        self.assertEqual(x, {0: 1})
+        self.assertEqual(y, 1)
+
+    def test_patma_137(self):
+        x = {0: 1}
+        match x:
+            case {1: 0}:
+                y = 0
+            case {0: 0}:
+                y = 0
+            case {**z}:
+                y = 1
+        self.assertEqual(x, {0: 1})
+        self.assertEqual(y, 1)
+        self.assertEqual(z, {0: 1})
+
+    def test_patma_138(self):
+        x = {0: 1}
+        match x:
+            case {1: 0}:
+                y = 0
+            case {0: 0}:
+                y = 0
+            case {0: _, **z}:
+                y = 1
+        self.assertEqual(x, {0: 1})
+        self.assertEqual(y, 1)
+        self.assertEqual(z, {})
+
+    def test_patma_139(self):
+        x = False
+        match x:
+            case bool(z):
+                y = 0
+        self.assertIs(x, False)
+        self.assertEqual(y, 0)
+        self.assertIs(z, x)
+
+    def test_patma_140(self):
+        x = True
+        match x:
+            case bool(z):
+                y = 0
+        self.assertIs(x, True)
+        self.assertEqual(y, 0)
+        self.assertIs(z, x)
+
+    def test_patma_141(self):
+        x = bytearray()
+        match x:
+            case bytearray(z):
+                y = 0
+        self.assertEqual(x, bytearray())
+        self.assertEqual(y, 0)
+        self.assertIs(z, x)
+
+    def test_patma_142(self):
+        x = b""
+        match x:
+            case bytes(z):
+                y = 0
+        self.assertEqual(x, b"")
+        self.assertEqual(y, 0)
+        self.assertIs(z, x)
+
+    def test_patma_143(self):
+        x = {}
+        match x:
+            case dict(z):
+                y = 0
+        self.assertEqual(x, {})
+        self.assertEqual(y, 0)
+        self.assertIs(z, x)
+
+    def test_patma_144(self):
+        x = 0.0
+        match x:
+            case float(z):
+                y = 0
+        self.assertEqual(x, 0.0)
+        self.assertEqual(y, 0)
+        self.assertIs(z, x)
+
+    def test_patma_145(self):
+        x = frozenset()
+        match x:
+            case frozenset(z):
+                y = 0
+        self.assertEqual(x, frozenset())
+        self.assertEqual(y, 0)
+        self.assertIs(z, x)
+
+    def test_patma_146(self):
+        x = 0
+        match x:
+            case int(z):
+                y = 0
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+        self.assertIs(z, x)
+
+    def test_patma_147(self):
+        x = []
+        match x:
+            case list(z):
+                y = 0
+        self.assertEqual(x, [])
+        self.assertEqual(y, 0)
+        self.assertIs(z, x)
+
+    def test_patma_148(self):
+        x = set()
+        match x:
+            case set(z):
+                y = 0
+        self.assertEqual(x, set())
+        self.assertEqual(y, 0)
+        self.assertIs(z, x)
+
+    def test_patma_149(self):
+        x = ""
+        match x:
+            case str(z):
+                y = 0
+        self.assertEqual(x, "")
+        self.assertEqual(y, 0)
+        self.assertIs(z, x)
+
+    def test_patma_150(self):
+        x = ()
+        match x:
+            case tuple(z):
+                y = 0
+        self.assertEqual(x, ())
+        self.assertEqual(y, 0)
+        self.assertIs(z, x)
+
+    def test_patma_151(self):
+        x = 0
+        match x,:
+            case y,:
+                z = 0
+        self.assertEqual(x, 0)
+        self.assertIs(y, x)
+        self.assertIs(z, 0)
+
+    def test_patma_152(self):
+        w = 0
+        x = 0
+        match w, x:
+            case y, z:
+                v = 0
+        self.assertEqual(w, 0)
+        self.assertEqual(x, 0)
+        self.assertIs(y, w)
+        self.assertIs(z, x)
+        self.assertEqual(v, 0)
+
+    def test_patma_153(self):
+        x = 0
+        match w := x,:
+            case y as v,:
+                z = 0
+        self.assertEqual(x, 0)
+        self.assertIs(y, x)
+        self.assertEqual(z, 0)
+        self.assertIs(w, x)
+        self.assertIs(v, y)
+
+    def test_patma_154(self):
+        x = 0
+        y = None
+        match x:
+            case 0 if x:
+                y = 0
+        self.assertEqual(x, 0)
+        self.assertIs(y, None)
+
+    def test_patma_155(self):
+        x = 0
+        y = None
+        match x:
+            case 1e1000:
+                y = 0
+        self.assertEqual(x, 0)
+        self.assertIs(y, None)
+
+    def test_patma_156(self):
+        x = 0
+        match x:
+            case z:
+                y = 0
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+        self.assertIs(z, x)
+
+    def test_patma_157(self):
+        x = 0
+        y = None
+        match x:
+            case _ if x:
+                y = 0
+        self.assertEqual(x, 0)
+        self.assertIs(y, None)
+
+    def test_patma_158(self):
+        x = 0
+        match x:
+            case -1e1000:
+                y = 0
+            case 0:
+                y = 1
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 1)
+
+    def test_patma_159(self):
+        x = 0
+        match x:
+            case 0 if not x:
+                y = 0
+            case 1:
+                y = 1
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+
+    def test_patma_160(self):
+        x = 0
+        z = None
+        match x:
+            case 0:
+                y = 0
+            case z if x:
+                y = 1
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+        self.assertIs(z, None)
+
+    def test_patma_161(self):
+        x = 0
+        match x:
+            case 0:
+                y = 0
+            case _:
+                y = 1
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+
+    def test_patma_162(self):
+        x = 0
+        match x:
+            case 1 if x:
+                y = 0
+            case 0:
+                y = 1
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 1)
+
+    def test_patma_163(self):
+        x = 0
+        y = None
+        match x:
+            case 1:
+                y = 0
+            case 1 if not x:
+                y = 1
+        self.assertEqual(x, 0)
+        self.assertIs(y, None)
+
+    def test_patma_164(self):
+        x = 0
+        match x:
+            case 1:
+                y = 0
+            case z:
+                y = 1
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 1)
+        self.assertIs(z, x)
+
+    def test_patma_165(self):
+        x = 0
+        match x:
+            case 1 if x:
+                y = 0
+            case _:
+                y = 1
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 1)
+
+    def test_patma_166(self):
+        x = 0
+        match x:
+            case z if not z:
+                y = 0
+            case 0 if x:
+                y = 1
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+        self.assertIs(z, x)
+
+    def test_patma_167(self):
+        x = 0
+        match x:
+            case z if not z:
+                y = 0
+            case 1:
+                y = 1
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+        self.assertIs(z, x)
+
+    def test_patma_168(self):
+        x = 0
+        match x:
+            case z if not x:
+                y = 0
+            case z:
+                y = 1
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+        self.assertIs(z, x)
+
+    def test_patma_169(self):
+        x = 0
+        match x:
+            case z if not z:
+                y = 0
+            case _ if x:
+                y = 1
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+        self.assertIs(z, x)
+
+    def test_patma_170(self):
+        x = 0
+        match x:
+            case _ if not x:
+                y = 0
+            case 0:
+                y = 1
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+
+    def test_patma_171(self):
+        x = 0
+        y = None
+        match x:
+            case _ if x:
+                y = 0
+            case 1:
+                y = 1
+        self.assertEqual(x, 0)
+        self.assertIs(y, None)
+
+    def test_patma_172(self):
+        x = 0
+        z = None
+        match x:
+            case _ if not x:
+                y = 0
+            case z if not x:
+                y = 1
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+        self.assertIs(z, None)
+
+    def test_patma_173(self):
+        x = 0
+        match x:
+            case _ if not x:
+                y = 0
+            case _:
+                y = 1
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+
+    def test_patma_174(self):
+        def http_error(status):
+            match status:
+                case 400:
+                    return "Bad request"
+                case 401:
+                    return "Unauthorized"
+                case 403:
+                    return "Forbidden"
+                case 404:
+                    return "Not found"
+                case 418:
+                    return "I'm a teapot"
+                case _:
+                    return "Something else"
+        self.assertEqual(http_error(400), "Bad request")
+        self.assertEqual(http_error(401), "Unauthorized")
+        self.assertEqual(http_error(403), "Forbidden")
+        self.assertEqual(http_error(404), "Not found")
+        self.assertEqual(http_error(418), "I'm a teapot")
+        self.assertEqual(http_error(123), "Something else")
+        self.assertEqual(http_error("400"), "Something else")
+        self.assertEqual(http_error(401 | 403 | 404), "Something else")  # 407
+
+    def test_patma_175(self):
+        def http_error(status):
+            match status:
+                case 400:
+                    return "Bad request"
+                case 401 | 403 | 404:
+                    return "Not allowed"
+                case 418:
+                    return "I'm a teapot"
+        self.assertEqual(http_error(400), "Bad request")
+        self.assertEqual(http_error(401), "Not allowed")
+        self.assertEqual(http_error(403), "Not allowed")
+        self.assertEqual(http_error(404), "Not allowed")
+        self.assertEqual(http_error(418), "I'm a teapot")
+        self.assertIs(http_error(123), None)
+        self.assertIs(http_error("400"), None)
+        self.assertIs(http_error(401 | 403 | 404), None)  # 407
+
+    def test_patma_176(self):
+        def whereis(point):
+            match point:
+                case (0, 0):
+                    return "Origin"
+                case (0, y):
+                    return f"Y={y}"
+                case (x, 0):
+                    return f"X={x}"
+                case (x, y):
+                    return f"X={x}, Y={y}"
+                case _:
+                    return "Not a point"
+        self.assertEqual(whereis((0, 0)), "Origin")
+        self.assertEqual(whereis((0, -1.0)), "Y=-1.0")
+        self.assertEqual(whereis(("X", 0)), "X=X")
+        self.assertEqual(whereis((None, 1j)), "X=None, Y=1j")
+        self.assertEqual(whereis(42), "Not a point")
+
+    def test_patma_177(self):
+        def whereis(point):
+            match point:
+                case Point(0, 0):
+                    return "Origin"
+                case Point(0, y):
+                    return f"Y={y}"
+                case Point(x, 0):
+                    return f"X={x}"
+                case Point():
+                    return "Somewhere else"
+                case _:
+                    return "Not a point"
+        self.assertEqual(whereis(Point(1, 0)), "X=1")
+        self.assertEqual(whereis(Point(0, 0)), "Origin")
+        self.assertEqual(whereis(10), "Not a point")
+        self.assertEqual(whereis(Point(False, False)), "Origin")
+        self.assertEqual(whereis(Point(0, -1.0)), "Y=-1.0")
+        self.assertEqual(whereis(Point("X", 0)), "X=X")
+        self.assertEqual(whereis(Point(None, 1j)), "Somewhere else")
+        self.assertEqual(whereis(Point), "Not a point")
+        self.assertEqual(whereis(42), "Not a point")
+
+    def test_patma_178(self):
+        def whereis(point):
+            match point:
+                case Point(1, var):
+                    return var
+        self.assertEqual(whereis(Point(1, 0)), 0)
+        self.assertIs(whereis(Point(0, 0)), None)
+
+    def test_patma_179(self):
+        def whereis(point):
+            match point:
+                case Point(1, y=var):
+                    return var
+        self.assertEqual(whereis(Point(1, 0)), 0)
+        self.assertIs(whereis(Point(0, 0)), None)
+
+    def test_patma_180(self):
+        def whereis(point):
+            match point:
+                case Point(x=1, y=var):
+                    return var
+        self.assertEqual(whereis(Point(1, 0)), 0)
+        self.assertIs(whereis(Point(0, 0)), None)
+
+    def test_patma_181(self):
+        def whereis(point):
+            match point:
+                case Point(y=var, x=1):
+                    return var
+        self.assertEqual(whereis(Point(1, 0)), 0)
+        self.assertIs(whereis(Point(0, 0)), None)
+
+    def test_patma_182(self):
+        def whereis(points):
+            match points:
+                case []:
+                    return "No points"
+                case [Point(0, 0)]:
+                    return "The origin"
+                case [Point(x, y)]:
+                    return f"Single point {x}, {y}"
+                case [Point(0, y1), Point(0, y2)]:
+                    return f"Two on the Y axis at {y1}, {y2}"
+                case _:
+                    return "Something else"
+        self.assertEqual(whereis([]), "No points")
+        self.assertEqual(whereis([Point(0, 0)]), "The origin")
+        self.assertEqual(whereis([Point(0, 1)]), "Single point 0, 1")
+        self.assertEqual(whereis([Point(0, 0), Point(0, 0)]), "Two on the Y axis at 0, 0")
+        self.assertEqual(whereis([Point(0, 1), Point(0, 1)]), "Two on the Y axis at 1, 1")
+        self.assertEqual(whereis([Point(0, 0), Point(1, 0)]), "Something else")
+        self.assertEqual(whereis([Point(0, 0), Point(0, 0), Point(0, 0)]), "Something else")
+        self.assertEqual(whereis([Point(0, 1), Point(0, 1), Point(0, 1)]), "Something else")
+
+    def test_patma_183(self):
+        def whereis(point):
+            match point:
+                case Point(x, y) if x == y:
+                    return f"Y=X at {x}"
+                case Point(x, y):
+                    return "Not on the diagonal"
+        self.assertEqual(whereis(Point(0, 0)), "Y=X at 0")
+        self.assertEqual(whereis(Point(0, False)), "Y=X at 0")
+        self.assertEqual(whereis(Point(False, 0)), "Y=X at False")
+        self.assertEqual(whereis(Point(-1 - 1j, -1 - 1j)), "Y=X at (-1-1j)")
+        self.assertEqual(whereis(Point("X", "X")), "Y=X at X")
+        self.assertEqual(whereis(Point("X", "x")), "Not on the diagonal")
+
+    def test_patma_184(self):
+        class Seq(collections.abc.Sequence):
+            __getitem__ = None
+            def __len__(self):
+                return 0
+        match Seq():
+            case []:
+                y = 0
+        self.assertEqual(y, 0)
+
+    def test_patma_185(self):
+        class Seq(collections.abc.Sequence):
+            __getitem__ = None
+            def __len__(self):
+                return 42
+        match Seq():
+            case [*_]:
+                y = 0
+        self.assertEqual(y, 0)
+
+    def test_patma_186(self):
+        class Seq(collections.abc.Sequence):
+            def __getitem__(self, i):
+                return i
+            def __len__(self):
+                return 42
+        match Seq():
+            case [x, *_, y]:
+                z = 0
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 41)
+        self.assertEqual(z, 0)
+
+    def test_patma_187(self):
+        w = range(10)
+        match w:
+            case [x, y, *rest]:
+                z = 0
+        self.assertEqual(w, range(10))
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 1)
+        self.assertEqual(z, 0)
+        self.assertEqual(rest, list(range(2, 10)))
+
+    def test_patma_188(self):
+        w = range(100)
+        match w:
+            case (x, y, *rest):
+                z = 0
+        self.assertEqual(w, range(100))
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 1)
+        self.assertEqual(z, 0)
+        self.assertEqual(rest, list(range(2, 100)))
+
+    def test_patma_189(self):
+        w = range(1000)
+        match w:
+            case x, y, *rest:
+                z = 0
+        self.assertEqual(w, range(1000))
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 1)
+        self.assertEqual(z, 0)
+        self.assertEqual(rest, list(range(2, 1000)))
+
+    def test_patma_190(self):
+        w = range(1 << 10)
+        match w:
+            case [x, y, *_]:
+                z = 0
+        self.assertEqual(w, range(1 << 10))
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 1)
+        self.assertEqual(z, 0)
+
+    def test_patma_191(self):
+        w = range(1 << 20)
+        match w:
+            case (x, y, *_):
+                z = 0
+        self.assertEqual(w, range(1 << 20))
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 1)
+        self.assertEqual(z, 0)
+
+    def test_patma_192(self):
+        w = range(1 << 30)
+        match w:
+            case x, y, *_:
+                z = 0
+        self.assertEqual(w, range(1 << 30))
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 1)
+        self.assertEqual(z, 0)
+
+    def test_patma_193(self):
+        x = {"bandwidth": 0, "latency": 1}
+        match x:
+            case {"bandwidth": b, "latency": l}:
+                y = 0
+        self.assertEqual(x, {"bandwidth": 0, "latency": 1})
+        self.assertIs(b, x["bandwidth"])
+        self.assertIs(l, x["latency"])
+        self.assertEqual(y, 0)
+
+    def test_patma_194(self):
+        x = {"bandwidth": 0, "latency": 1, "key": "value"}
+        match x:
+            case {"latency": l, "bandwidth": b}:
+                y = 0
+        self.assertEqual(x, {"bandwidth": 0, "latency": 1, "key": "value"})
+        self.assertIs(l, x["latency"])
+        self.assertIs(b, x["bandwidth"])
+        self.assertEqual(y, 0)
+
+    def test_patma_195(self):
+        x = {"bandwidth": 0, "latency": 1, "key": "value"}
+        match x:
+            case {"bandwidth": b, "latency": l, **rest}:
+                y = 0
+        self.assertEqual(x, {"bandwidth": 0, "latency": 1, "key": "value"})
+        self.assertIs(b, x["bandwidth"])
+        self.assertIs(l, x["latency"])
+        self.assertEqual(rest, {"key": "value"})
+        self.assertEqual(y, 0)
+
+    def test_patma_196(self):
+        x = {"bandwidth": 0, "latency": 1}
+        match x:
+            case {"latency": l, "bandwidth": b, **rest}:
+                y = 0
+        self.assertEqual(x, {"bandwidth": 0, "latency": 1})
+        self.assertIs(l, x["latency"])
+        self.assertIs(b, x["bandwidth"])
+        self.assertEqual(rest, {})
+        self.assertEqual(y, 0)
+
+    def test_patma_197(self):
+        w = [Point(-1, 0), Point(1, 2)]
+        match w:
+            case (Point(x1, y1), Point(x2, y2) as p2):
+                z = 0
+        self.assertEqual(w, [Point(-1, 0), Point(1, 2)])
+        self.assertIs(x1, w[0].x)
+        self.assertIs(y1, w[0].y)
+        self.assertIs(p2, w[1])
+        self.assertIs(x2, w[1].x)
+        self.assertIs(y2, w[1].y)
+        self.assertIs(z, 0)
+
+    def test_patma_198(self):
+        class Color(enum.Enum):
+            RED = 0
+            GREEN = 1
+            BLUE = 2
+        def f(color):
+            match color:
+                case Color.RED:
+                    return "I see red!"
+                case Color.GREEN:
+                    return "Grass is green"
+                case Color.BLUE:
+                    return "I'm feeling the blues :("
+        self.assertEqual(f(Color.RED), "I see red!")
+        self.assertEqual(f(Color.GREEN), "Grass is green")
+        self.assertEqual(f(Color.BLUE), "I'm feeling the blues :(")
+        self.assertIs(f(Color), None)
+        self.assertIs(f(0), None)
+        self.assertIs(f(1), None)
+        self.assertIs(f(2), None)
+        self.assertIs(f(3), None)
+        self.assertIs(f(False), None)
+        self.assertIs(f(True), None)
+        self.assertIs(f(2+0j), None)
+        self.assertIs(f(3.0), None)
+
+    def test_patma_199(self):
+        class Color(int, enum.Enum):
+            RED = 0
+            GREEN = 1
+            BLUE = 2
+        def f(color):
+            match color:
+                case Color.RED:
+                    return "I see red!"
+                case Color.GREEN:
+                    return "Grass is green"
+                case Color.BLUE:
+                    return "I'm feeling the blues :("
+        self.assertEqual(f(Color.RED), "I see red!")
+        self.assertEqual(f(Color.GREEN), "Grass is green")
+        self.assertEqual(f(Color.BLUE), "I'm feeling the blues :(")
+        self.assertIs(f(Color), None)
+        self.assertEqual(f(0), "I see red!")
+        self.assertEqual(f(1), "Grass is green")
+        self.assertEqual(f(2), "I'm feeling the blues :(")
+        self.assertIs(f(3), None)
+        self.assertEqual(f(False), "I see red!")
+        self.assertEqual(f(True), "Grass is green")
+        self.assertEqual(f(2+0j), "I'm feeling the blues :(")
+        self.assertIs(f(3.0), None)
+
+    def test_patma_200(self):
+        class Class:
+            __match_args__ = ("a", "b")
+        c = Class()
+        c.a = 0
+        c.b = 1
+        match c:
+            case Class(x, y):
+                z = 0
+        self.assertIs(x, c.a)
+        self.assertIs(y, c.b)
+        self.assertEqual(z, 0)
+
+    def test_patma_201(self):
+        class Class:
+            __match_args__ = ("a", "b")
+        c = Class()
+        c.a = 0
+        c.b = 1
+        match c:
+            case Class(x, b=y):
+                z = 0
+        self.assertIs(x, c.a)
+        self.assertIs(y, c.b)
+        self.assertEqual(z, 0)
+
+    def test_patma_202(self):
+        class Parent:
+            __match_args__ = "a", "b"
+        class Child(Parent):
+            __match_args__ = ("c", "d")
+        c = Child()
+        c.a = 0
+        c.b = 1
+        match c:
+            case Parent(x, y):
+                z = 0
+        self.assertIs(x, c.a)
+        self.assertIs(y, c.b)
+        self.assertEqual(z, 0)
+
+    def test_patma_203(self):
+        class Parent:
+            __match_args__ = ("a", "b")
+        class Child(Parent):
+            __match_args__ = "c", "d"
+        c = Child()
+        c.a = 0
+        c.b = 1
+        match c:
+            case Parent(x, b=y):
+                z = 0
+        self.assertIs(x, c.a)
+        self.assertIs(y, c.b)
+        self.assertEqual(z, 0)
+
+    def test_patma_204(self):
+        def f(w):
+            match w:
+                case 42:
+                    out = locals()
+                    del out["w"]
+                    return out
+        self.assertEqual(f(42), {})
+        self.assertIs(f(0), None)
+        self.assertEqual(f(42.0), {})
+        self.assertIs(f("42"), None)
+
+    def test_patma_205(self):
+        def f(w):
+            match w:
+                case 42.0:
+                    out = locals()
+                    del out["w"]
+                    return out
+        self.assertEqual(f(42.0), {})
+        self.assertEqual(f(42), {})
+        self.assertIs(f(0.0), None)
+        self.assertIs(f(0), None)
+
+    def test_patma_206(self):
+        def f(w):
+            match w:
+                case 1 | 2 | 3:
+                    out = locals()
+                    del out["w"]
+                    return out
+        self.assertEqual(f(1), {})
+        self.assertEqual(f(2), {})
+        self.assertEqual(f(3), {})
+        self.assertEqual(f(3.0), {})
+        self.assertIs(f(0), None)
+        self.assertIs(f(4), None)
+        self.assertIs(f("1"), None)
+
+    def test_patma_207(self):
+        def f(w):
+            match w:
+                case [1, 2] | [3, 4]:
+                    out = locals()
+                    del out["w"]
+                    return out
+        self.assertEqual(f([1, 2]), {})
+        self.assertEqual(f([3, 4]), {})
+        self.assertIs(f(42), None)
+        self.assertIs(f([2, 3]), None)
+        self.assertIs(f([1, 2, 3]), None)
+        self.assertEqual(f([1, 2.0]), {})
+
+    def test_patma_208(self):
+        def f(w):
+            match w:
+                case x:
+                    out = locals()
+                    del out["w"]
+                    return out
+        self.assertEqual(f(42), {"x": 42})
+        self.assertEqual(f((1, 2)), {"x": (1, 2)})
+        self.assertEqual(f(None), {"x": None})
+
+    def test_patma_209(self):
+        def f(w):
+            match w:
+                case _:
+                    out = locals()
+                    del out["w"]
+                    return out
+        self.assertEqual(f(42), {})
+        self.assertEqual(f(None), {})
+        self.assertEqual(f((1, 2)), {})
+
+    def test_patma_210(self):
+        def f(w):
+            match w:
+                case (x, y, z):
+                    out = locals()
+                    del out["w"]
+                    return out
+        self.assertEqual(f((1, 2, 3)), {"x": 1, "y": 2, "z": 3})
+        self.assertIs(f((1, 2)), None)
+        self.assertIs(f((1, 2, 3, 4)), None)
+        self.assertIs(f(123), None)
+        self.assertIs(f("abc"), None)
+        self.assertIs(f(b"abc"), None)
+        self.assertEqual(f(array.array("b", b"abc")), {'x': 97, 'y': 98, 'z': 99})
+        self.assertEqual(f(memoryview(b"abc")), {"x": 97, "y": 98, "z": 99})
+        self.assertIs(f(bytearray(b"abc")), None)
+
+    def test_patma_211(self):
+        def f(w):
+            match w:
+                case {"x": x, "y": "y", "z": z}:
+                    out = locals()
+                    del out["w"]
+                    return out
+        self.assertEqual(f({"x": "x", "y": "y", "z": "z"}), {"x": "x", "z": "z"})
+        self.assertEqual(f({"x": "x", "y": "y", "z": "z", "a": "a"}), {"x": "x", "z": "z"})
+        self.assertIs(f(({"x": "x", "y": "yy", "z": "z", "a": "a"})), None)
+        self.assertIs(f(({"x": "x", "y": "y"})), None)
+
+    def test_patma_212(self):
+        def f(w):
+            match w:
+                case Point(int(xx), y="hello"):
+                    out = locals()
+                    del out["w"]
+                    return out
+        self.assertEqual(f(Point(42, "hello")), {"xx": 42})
+
+    def test_patma_213(self):
+        def f(w):
+            match w:
+                case (p, q) as x:
+                    out = locals()
+                    del out["w"]
+                    return out
+        self.assertEqual(f((1, 2)), {"p": 1, "q": 2, "x": (1, 2)})
+        self.assertEqual(f([1, 2]), {"p": 1, "q": 2, "x": [1, 2]})
+        self.assertIs(f(12), None)
+        self.assertIs(f((1, 2, 3)), None)
+
+    def test_patma_214(self):
+        def f():
+            match 42:
+                case 42:
+                    return locals()
+        self.assertEqual(set(f()), set())
+
+    def test_patma_215(self):
+        def f():
+            match 1:
+                case 1 | 2 | 3:
+                    return locals()
+        self.assertEqual(set(f()), set())
+
+    def test_patma_216(self):
+        def f():
+            match ...:
+                case _:
+                    return locals()
+        self.assertEqual(set(f()), set())
+
+    def test_patma_217(self):
+        def f():
+            match ...:
+                case abc:
+                    return locals()
+        self.assertEqual(set(f()), {"abc"})
+
+    def test_patma_218(self):
+        def f():
+            match ..., ...:
+                case a, b:
+                    return locals()
+        self.assertEqual(set(f()), {"a", "b"})
+
+    def test_patma_219(self):
+        def f():
+            match {"k": ..., "l": ...}:
+                case {"k": a, "l": b}:
+                    return locals()
+        self.assertEqual(set(f()), {"a", "b"})
+
+    def test_patma_220(self):
+        def f():
+            match Point(..., ...):
+                case Point(x, y=y):
+                    return locals()
+        self.assertEqual(set(f()), {"x", "y"})
+
+    def test_patma_221(self):
+        def f():
+            match ...:
+                case b as a:
+                    return locals()
+        self.assertEqual(set(f()), {"a", "b"})
+
+    def test_patma_222(self):
+        def f(x):
+            match x:
+                case _:
+                    return 0
+        self.assertEqual(f(0), 0)
+        self.assertEqual(f(1), 0)
+        self.assertEqual(f(2), 0)
+        self.assertEqual(f(3), 0)
+
+    def test_patma_223(self):
+        def f(x):
+            match x:
+                case 0:
+                    return 0
+        self.assertEqual(f(0), 0)
+        self.assertIs(f(1), None)
+        self.assertIs(f(2), None)
+        self.assertIs(f(3), None)
+
+    def test_patma_224(self):
+        def f(x):
+            match x:
+                case 0:
+                    return 0
+                case _:
+                    return 1
+        self.assertEqual(f(0), 0)
+        self.assertEqual(f(1), 1)
+        self.assertEqual(f(2), 1)
+        self.assertEqual(f(3), 1)
+
+    def test_patma_225(self):
+        def f(x):
+            match x:
+                case 0:
+                    return 0
+                case 1:
+                    return 1
+        self.assertEqual(f(0), 0)
+        self.assertEqual(f(1), 1)
+        self.assertIs(f(2), None)
+        self.assertIs(f(3), None)
+
+    def test_patma_226(self):
+        def f(x):
+            match x:
+                case 0:
+                    return 0
+                case 1:
+                    return 1
+                case _:
+                    return 2
+        self.assertEqual(f(0), 0)
+        self.assertEqual(f(1), 1)
+        self.assertEqual(f(2), 2)
+        self.assertEqual(f(3), 2)
+
+    def test_patma_227(self):
+        def f(x):
+            match x:
+                case 0:
+                    return 0
+                case 1:
+                    return 1
+                case 2:
+                    return 2
+        self.assertEqual(f(0), 0)
+        self.assertEqual(f(1), 1)
+        self.assertEqual(f(2), 2)
+        self.assertIs(f(3), None)
+
+    def test_patma_228(self):
+        match():
+            case():
+                x = 0
+        self.assertEqual(x, 0)
+
+    def test_patma_229(self):
+        x = 0
+        match(x):
+            case(x):
+                y = 0
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+
+    def test_patma_230(self):
+        x = 0
+        match x:
+            case False:
+                y = 0
+            case 0:
+                y = 1
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 1)
+
+    def test_patma_231(self):
+        x = 1
+        match x:
+            case True:
+                y = 0
+            case 1:
+                y = 1
+        self.assertEqual(x, 1)
+        self.assertEqual(y, 1)
+
+    def test_patma_232(self):
+        class Eq:
+            def __eq__(self, other):
+                return True
+        x = eq = Eq()
+        y = None
+        match x:
+            case None:
+                y = 0
+        self.assertIs(x, eq)
+        self.assertEqual(y, None)
+
+    def test_patma_233(self):
+        x = False
+        match x:
+            case False:
+                y = 0
+        self.assertIs(x, False)
+        self.assertEqual(y, 0)
+
+    def test_patma_234(self):
+        x = True
+        match x:
+            case True:
+                y = 0
+        self.assertIs(x, True)
+        self.assertEqual(y, 0)
+
+    def test_patma_235(self):
+        x = None
+        match x:
+            case None:
+                y = 0
+        self.assertIs(x, None)
+        self.assertEqual(y, 0)
+
+    def test_patma_236(self):
+        x = 0
+        match x:
+            case (0 as w) as z:
+                y = 0
+        self.assertEqual(w, 0)
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+        self.assertEqual(z, 0)
+
+    def test_patma_237(self):
+        x = 0
+        match x:
+            case (0 as w) as z:
+                y = 0
+        self.assertEqual(w, 0)
+        self.assertEqual(x, 0)
+        self.assertEqual(y, 0)
+        self.assertEqual(z, 0)
+
+    def test_patma_238(self):
+        x = ((0, 1), (2, 3))
+        match x:
+            case ((a as b, c as d) as e) as w, ((f as g, h) as i) as z:
+                y = 0
+        self.assertEqual(a, 0)
+        self.assertEqual(b, 0)
+        self.assertEqual(c, 1)
+        self.assertEqual(d, 1)
+        self.assertEqual(e, (0, 1))
+        self.assertEqual(f, 2)
+        self.assertEqual(g, 2)
+        self.assertEqual(h, 3)
+        self.assertEqual(i, (2, 3))
+        self.assertEqual(w, (0, 1))
+        self.assertEqual(x, ((0, 1), (2, 3)))
+        self.assertEqual(y, 0)
+        self.assertEqual(z, (2, 3))
+
+    def test_patma_239(self):
+        x = collections.UserDict({0: 1, 2: 3})
+        match x:
+            case {2: 3}:
+                y = 0
+        self.assertEqual(x, {0: 1, 2: 3})
+        self.assertEqual(y, 0)
+
+    def test_patma_240(self):
+        x = collections.UserDict({0: 1, 2: 3})
+        match x:
+            case {2: 3, **z}:
+                y = 0
+        self.assertEqual(x, {0: 1, 2: 3})
+        self.assertEqual(y, 0)
+        self.assertEqual(z, {0: 1})
+
+    def test_patma_241(self):
+        x = [[{0: 0}]]
+        match x:
+            case list([({-0-0j: int(real=0+0j, imag=0-0j) | (1) as z},)]):
+                y = 0
+        self.assertEqual(x, [[{0: 0}]])
+        self.assertEqual(y, 0)
+        self.assertEqual(z, 0)
+
+    def test_patma_242(self):
+        x = range(3)
+        match x:
+            case [y, *_, z]:
+                w = 0
+        self.assertEqual(w, 0)
+        self.assertEqual(x, range(3))
+        self.assertEqual(y, 0)
+        self.assertEqual(z, 2)
+
+    def test_patma_243(self):
+        x = range(3)
+        match x:
+            case [_, *_, y]:
+                z = 0
+        self.assertEqual(x, range(3))
+        self.assertEqual(y, 2)
+        self.assertEqual(z, 0)
+
+    def test_patma_244(self):
+        x = range(3)
+        match x:
+            case [*_, y]:
+                z = 0
+        self.assertEqual(x, range(3))
+        self.assertEqual(y, 2)
+        self.assertEqual(z, 0)
+
+    def test_patma_245(self):
+        x = {"y": 1}
+        match x:
+            case {"y": (0 as y) | (1 as y)}:
+                z = 0
+        self.assertEqual(x, {"y": 1})
+        self.assertEqual(y, 1)
+        self.assertEqual(z, 0)
+
+    def test_patma_246(self):
+        def f(x):
+            match x:
+                case ((a, b, c, d, e, f, g, h, i, 9) |
+                      (h, g, i, a, b, d, e, c, f, 10) |
+                      (g, b, a, c, d, -5, e, h, i, f) |
+                      (-1, d, f, b, g, e, i, a, h, c)):
+                    w = 0
+            out = locals()
+            del out["x"]
+            return out
+        alts = [
+            dict(a=0, b=1, c=2, d=3, e=4, f=5, g=6, h=7, i=8, w=0),
+            dict(h=1, g=2, i=3, a=4, b=5, d=6, e=7, c=8, f=9, w=0),
+            dict(g=0, b=-1, a=-2, c=-3, d=-4, e=-6, h=-7, i=-8, f=-9, w=0),
+            dict(d=-2, f=-3, b=-4, g=-5, e=-6, i=-7, a=-8, h=-9, c=-10, w=0),
+            dict(),
+        ]
+        self.assertEqual(f(range(10)), alts[0])
+        self.assertEqual(f(range(1, 11)), alts[1])
+        self.assertEqual(f(range(0, -10, -1)), alts[2])
+        self.assertEqual(f(range(-1, -11, -1)), alts[3])
+        self.assertEqual(f(range(10, 20)), alts[4])
+
+    def test_patma_247(self):
+        def f(x):
+            match x:
+                case [y, (a, b, c, d, e, f, g, h, i, 9) |
+                         (h, g, i, a, b, d, e, c, f, 10) |
+                         (g, b, a, c, d, -5, e, h, i, f) |
+                         (-1, d, f, b, g, e, i, a, h, c), z]:
+                    w = 0
+            out = locals()
+            del out["x"]
+            return out
+        alts = [
+            dict(a=0, b=1, c=2, d=3, e=4, f=5, g=6, h=7, i=8, w=0, y=False, z=True),
+            dict(h=1, g=2, i=3, a=4, b=5, d=6, e=7, c=8, f=9, w=0, y=False, z=True),
+            dict(g=0, b=-1, a=-2, c=-3, d=-4, e=-6, h=-7, i=-8, f=-9, w=0, y=False, z=True),
+            dict(d=-2, f=-3, b=-4, g=-5, e=-6, i=-7, a=-8, h=-9, c=-10, w=0, y=False, z=True),
+            dict(),
+        ]
+        self.assertEqual(f((False, range(10), True)), alts[0])
+        self.assertEqual(f((False, range(1, 11), True)), alts[1])
+        self.assertEqual(f((False, range(0, -10, -1), True)), alts[2])
+        self.assertEqual(f((False, range(-1, -11, -1), True)), alts[3])
+        self.assertEqual(f((False, range(10, 20), True)), alts[4])
+
+
+class TestSyntaxErrors(unittest.TestCase):
+
+    def assert_syntax_error(self, code: str):
+        with self.assertRaises(SyntaxError):
+            compile(inspect.cleandoc(code), "<test>", "exec")
+
+    def test_alternative_patterns_bind_different_names_0(self):
+        self.assert_syntax_error("""
+        match ...:
+            case "a" | a:
+                pass
+        """)
+
+    def test_alternative_patterns_bind_different_names_1(self):
+        self.assert_syntax_error("""
+        match ...:
+            case [a, [b] | [c] | [d]]:
+                pass
+        """)
+
+
+    def test_attribute_name_repeated_in_class_pattern(self):
+        self.assert_syntax_error("""
+        match ...:
+            case Class(a=_, a=_):
+                pass
+        """)
+
+    def test_imaginary_number_required_in_complex_literal_0(self):
+        self.assert_syntax_error("""
+        match ...:
+            case 0+0:
+                pass
+        """)
+
+    def test_imaginary_number_required_in_complex_literal_1(self):
+        self.assert_syntax_error("""
+        match ...:
+            case {0+0: _}:
+                pass
+        """)
+
+    def test_invalid_syntax_0(self):
+        self.assert_syntax_error("""
+        match ...:
+            case {**rest, "key": value}:
+                pass
+        """)
+
+    def test_invalid_syntax_1(self):
+        self.assert_syntax_error("""
+        match ...:
+            case {"first": first, **rest, "last": last}:
+                pass
+        """)
+
+    def test_invalid_syntax_2(self):
+        self.assert_syntax_error("""
+        match ...:
+            case {**_}:
+                pass
+        """)
+
+    def test_invalid_syntax_3(self):
+        self.assert_syntax_error("""
+        match ...:
+            case 42 as _:
+                pass
+        """)
+
+    def test_mapping_pattern_keys_may_only_match_literals_and_attribute_lookups(self):
+        self.assert_syntax_error("""
+        match ...:
+            case {f"": _}:
+                pass
+        """)
+
+    def test_multiple_assignments_to_name_in_pattern_0(self):
+        self.assert_syntax_error("""
+        match ...:
+            case a, a:
+                pass
+        """)
+
+    def test_multiple_assignments_to_name_in_pattern_1(self):
+        self.assert_syntax_error("""
+        match ...:
+            case {"k": a, "l": a}:
+                pass
+        """)
+
+    def test_multiple_assignments_to_name_in_pattern_2(self):
+        self.assert_syntax_error("""
+        match ...:
+            case MyClass(x, x):
+                pass
+        """)
+
+    def test_multiple_assignments_to_name_in_pattern_3(self):
+        self.assert_syntax_error("""
+        match ...:
+            case MyClass(x=x, y=x):
+                pass
+        """)
+
+    def test_multiple_assignments_to_name_in_pattern_4(self):
+        self.assert_syntax_error("""
+        match ...:
+            case MyClass(x, y=x):
+                pass
+        """)
+
+    def test_multiple_assignments_to_name_in_pattern_5(self):
+        self.assert_syntax_error("""
+        match ...:
+            case a as a:
+                pass
+        """)
+
+    def test_multiple_starred_names_in_sequence_pattern_0(self):
+        self.assert_syntax_error("""
+        match ...:
+            case *a, b, *c, d, *e:
+                pass
+        """)
+
+    def test_multiple_starred_names_in_sequence_pattern_1(self):
+        self.assert_syntax_error("""
+        match ...:
+            case a, *b, c, *d, e:
+                pass
+        """)
+
+    def test_name_capture_makes_remaining_patterns_unreachable_0(self):
+        self.assert_syntax_error("""
+        match ...:
+            case a | "a":
+                pass
+        """)
+
+    def test_name_capture_makes_remaining_patterns_unreachable_1(self):
+        self.assert_syntax_error("""
+        match 42:
+            case x:
+                pass
+            case y:
+                pass
+        """)
+
+    def test_name_capture_makes_remaining_patterns_unreachable_2(self):
+        self.assert_syntax_error("""
+        match ...:
+            case x | [_ as x] if x:
+                pass
+        """)
+
+    def test_name_capture_makes_remaining_patterns_unreachable_3(self):
+        self.assert_syntax_error("""
+        match ...:
+            case x:
+                pass
+            case [x] if x:
+                pass
+        """)
+
+    def test_name_capture_makes_remaining_patterns_unreachable_4(self):
+        self.assert_syntax_error("""
+        match ...:
+            case x:
+                pass
+            case _:
+                pass
+        """)
+
+    def test_patterns_may_only_match_literals_and_attribute_lookups_0(self):
+        self.assert_syntax_error("""
+        match ...:
+            case f"":
+                pass
+        """)
+
+    def test_patterns_may_only_match_literals_and_attribute_lookups_1(self):
+        self.assert_syntax_error("""
+        match ...:
+            case f"{x}":
+                pass
+        """)
+
+    def test_real_number_required_in_complex_literal_0(self):
+        self.assert_syntax_error("""
+        match ...:
+            case 0j+0:
+                pass
+        """)
+
+    def test_real_number_required_in_complex_literal_1(self):
+        self.assert_syntax_error("""
+        match ...:
+            case 0j+0j:
+                pass
+        """)
+
+    def test_real_number_required_in_complex_literal_2(self):
+        self.assert_syntax_error("""
+        match ...:
+            case {0j+0: _}:
+                pass
+        """)
+
+    def test_real_number_required_in_complex_literal_3(self):
+        self.assert_syntax_error("""
+        match ...:
+            case {0j+0j: _}:
+                pass
+        """)
+
+    def test_wildcard_makes_remaining_patterns_unreachable_0(self):
+        self.assert_syntax_error("""
+        match ...:
+            case _ | _:
+                pass
+        """)
+
+    def test_wildcard_makes_remaining_patterns_unreachable_1(self):
+        self.assert_syntax_error("""
+        match ...:
+            case (_ as x) | [x]:
+                pass
+        """)
+
+    def test_wildcard_makes_remaining_patterns_unreachable_2(self):
+        self.assert_syntax_error("""
+        match ...:
+            case _ | _ if condition():
+                pass
+        """)
+
+    def test_wildcard_makes_remaining_patterns_unreachable_3(self):
+        self.assert_syntax_error("""
+        match ...:
+            case _:
+                pass
+            case None:
+                pass
+        """)
+
+    def test_wildcard_makes_remaining_patterns_unreachable_4(self):
+        self.assert_syntax_error("""
+        match ...:
+            case (None | _) | _:
+                pass
+        """)
+
+    def test_wildcard_makes_remaining_patterns_unreachable_5(self):
+        self.assert_syntax_error("""
+        match ...:
+            case _ | (True | False):
+                pass
+        """)
+
+    def test_mapping_pattern_duplicate_key(self):
+        self.assert_syntax_error("""
+        match ...:
+            case {"a": _, "a": _}:
+                pass
+        """)
+
+    def test_mapping_pattern_duplicate_key_edge_case0(self):
+        self.assert_syntax_error("""
+        match ...:
+            case {0: _, False: _}:
+                pass
+        """)
+
+    def test_mapping_pattern_duplicate_key_edge_case1(self):
+        self.assert_syntax_error("""
+        match ...:
+            case {0: _, 0.0: _}:
+                pass
+        """)
+
+    def test_mapping_pattern_duplicate_key_edge_case2(self):
+        self.assert_syntax_error("""
+        match ...:
+            case {0: _, -0: _}:
+                pass
+        """)
+
+    def test_mapping_pattern_duplicate_key_edge_case3(self):
+        self.assert_syntax_error("""
+        match ...:
+            case {0: _, 0j: _}:
+                pass
+        """)
+
+class TestTypeErrors(unittest.TestCase):
+
+    def test_accepts_positional_subpatterns_0(self):
+        class Class:
+            __match_args__ = ()
+        x = Class()
+        y = z = None
+        with self.assertRaises(TypeError):
+            match x:
+                case Class(y):
+                    z = 0
+        self.assertIs(y, None)
+        self.assertIs(z, None)
+
+    def test_accepts_positional_subpatterns_1(self):
+        x = range(10)
+        y = None
+        with self.assertRaises(TypeError):
+            match x:
+                case range(10):
+                    y = 0
+        self.assertEqual(x, range(10))
+        self.assertIs(y, None)
+
+    def test_got_multiple_subpatterns_for_attribute_0(self):
+        class Class:
+            __match_args__ = ("a", "a")
+            a = None
+        x = Class()
+        w = y = z = None
+        with self.assertRaises(TypeError):
+            match x:
+                case Class(y, z):
+                    w = 0
+        self.assertIs(w, None)
+        self.assertIs(y, None)
+        self.assertIs(z, None)
+
+    def test_got_multiple_subpatterns_for_attribute_1(self):
+        class Class:
+            __match_args__ = ("a",)
+            a = None
+        x = Class()
+        w = y = z = None
+        with self.assertRaises(TypeError):
+            match x:
+                case Class(y, a=z):
+                    w = 0
+        self.assertIs(w, None)
+        self.assertIs(y, None)
+        self.assertIs(z, None)
+
+    def test_match_args_elements_must_be_strings(self):
+        class Class:
+            __match_args__ = (None,)
+        x = Class()
+        y = z = None
+        with self.assertRaises(TypeError):
+            match x:
+                case Class(y):
+                    z = 0
+        self.assertIs(y, None)
+        self.assertIs(z, None)
+
+    def test_match_args_must_be_a_tuple_0(self):
+        class Class:
+            __match_args__ = None
+        x = Class()
+        y = z = None
+        with self.assertRaises(TypeError):
+            match x:
+                case Class(y):
+                    z = 0
+        self.assertIs(y, None)
+        self.assertIs(z, None)
+
+    def test_match_args_must_be_a_tuple_1(self):
+        class Class:
+            __match_args__ = "XYZ"
+        x = Class()
+        y = z = None
+        with self.assertRaises(TypeError):
+            match x:
+                case Class(y):
+                    z = 0
+        self.assertIs(y, None)
+        self.assertIs(z, None)
+
+    def test_match_args_must_be_a_tuple_2(self):
+        class Class:
+            __match_args__ = ["spam", "eggs"]
+            spam = 0
+            eggs = 1
+        x = Class()
+        w = y = z = None
+        with self.assertRaises(TypeError):
+            match x:
+                case Class(y, z):
+                    w = 0
+        self.assertIs(w, None)
+        self.assertIs(y, None)
+        self.assertIs(z, None)
+
+
+class TestValueErrors(unittest.TestCase):
+
+    def test_mapping_pattern_checks_duplicate_key_1(self):
+        class Keys:
+            KEY = "a"
+        x = {"a": 0, "b": 1}
+        w = y = z = None
+        with self.assertRaises(ValueError):
+            match x:
+                case {Keys.KEY: y, "a": z}:
+                    w = 0
+        self.assertIs(w, None)
+        self.assertIs(y, None)
+        self.assertIs(z, None)
+
+
+class TestTracing(unittest.TestCase):
+
+    @staticmethod
+    def _trace(func, *args, **kwargs):
+        actual_linenos = []
+
+        def trace(frame, event, arg):
+            if event == "line" and frame.f_code.co_name == func.__name__:
+                assert arg is None
+                relative_lineno = frame.f_lineno - func.__code__.co_firstlineno
+                actual_linenos.append(relative_lineno)
+            return trace
+
+        old_trace = sys.gettrace()
+        sys.settrace(trace)
+        try:
+            func(*args, **kwargs)
+        finally:
+            sys.settrace(old_trace)
+        return actual_linenos
+
+    def test_default_wildcard(self):
+        def f(command):                                         # 0
+            match command.split():                              # 1
+                case ["go", direction] if direction in "nesw":  # 2
+                    return f"go {direction}"                    # 3
+                case ["go", _]:                                 # 4
+                    return "no go"                              # 5
+                case _:                                         # 6
+                    return "default"                            # 7
+
+        self.assertListEqual(self._trace(f, "go n"), [1, 2, 3])
+        self.assertListEqual(self._trace(f, "go x"), [1, 2, 4, 5])
+        self.assertListEqual(self._trace(f, "spam"), [1, 2, 4, 6, 7])
+
+    def test_default_capture(self):
+        def f(command):                                         # 0
+            match command.split():                              # 1
+                case ["go", direction] if direction in "nesw":  # 2
+                    return f"go {direction}"                    # 3
+                case ["go", _]:                                 # 4
+                    return "no go"                              # 5
+                case x:                                         # 6
+                    return x                                    # 7
+
+        self.assertListEqual(self._trace(f, "go n"), [1, 2, 3])
+        self.assertListEqual(self._trace(f, "go x"), [1, 2, 4, 5])
+        self.assertListEqual(self._trace(f, "spam"), [1, 2, 4, 6, 7])
+
+    def test_no_default(self):
+        def f(command):                                         # 0
+            match command.split():                              # 1
+                case ["go", direction] if direction in "nesw":  # 2
+                    return f"go {direction}"                    # 3
+                case ["go", _]:                                 # 4
+                    return "no go"                              # 5
+
+        self.assertListEqual(self._trace(f, "go n"), [1, 2, 3])
+        self.assertListEqual(self._trace(f, "go x"), [1, 2, 4, 5])
+        self.assertListEqual(self._trace(f, "spam"), [1, 2, 4])
+
+    def test_only_default_wildcard(self):
+        def f(command):               # 0
+            match command.split():    # 1
+                case _:               # 2
+                    return "default"  # 3
+
+        self.assertListEqual(self._trace(f, "go n"), [1, 2, 3])
+        self.assertListEqual(self._trace(f, "go x"), [1, 2, 3])
+        self.assertListEqual(self._trace(f, "spam"), [1, 2, 3])
+
+    def test_only_default_capture(self):
+        def f(command):             # 0
+            match command.split():  # 1
+                case x:             # 2
+                    return x        # 3
+
+        self.assertListEqual(self._trace(f, "go n"), [1, 2, 3])
+        self.assertListEqual(self._trace(f, "go x"), [1, 2, 3])
+        self.assertListEqual(self._trace(f, "spam"), [1, 2, 3])
+
+
+if __name__ == "__main__":
+    """
+    # From inside environment using this Python, with pyperf installed:
+    sudo $(which pyperf) system tune && \
+         $(which python) -m test.test_patma --rigorous; \
+    sudo $(which pyperf) system reset
+    """
+    import pyperf
+
+
+    class PerfPatma(TestPatma):
+
+        def assertEqual(*_, **__):
+            pass
+
+        def assertIs(*_, **__):
+            pass
+
+        def assertRaises(*_, **__):
+            assert False, "this test should be a method of a different class!"
+
+        def run_perf(self, count):
+            tests = []
+            for attr in vars(TestPatma):
+                if attr.startswith("test_"):
+                    tests.append(getattr(self, attr))
+            tests *= count
+            start = pyperf.perf_counter()
+            for test in tests:
+                test()
+            return pyperf.perf_counter() - start
+
+
+    runner = pyperf.Runner()
+    runner.bench_time_func("patma", PerfPatma().run_perf)
diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
index 8016f81..6ac1a4a 100644
--- a/Lib/test/test_pdb.py
+++ b/Lib/test/test_pdb.py
@@ -9,10 +9,11 @@
 import unittest
 import subprocess
 import textwrap
+import linecache
 
-from contextlib import ExitStack
+from contextlib import ExitStack, redirect_stdout
 from io import StringIO
-from test import support
+from test.support import os_helper
 # This little helper class is essential for testing pdb under doctest.
 from test.test_doctest import _FakeInput
 from unittest.mock import patch
@@ -213,6 +214,9 @@
     BAZ
     """
 
+def reset_Breakpoint():
+    import bdb
+    bdb.Breakpoint.clearBreakpoints()
 
 def test_pdb_breakpoint_commands():
     """Test basic commands related to breakpoints.
@@ -227,10 +231,7 @@
     First, need to clear bdb state that might be left over from previous tests.
     Otherwise, the new breakpoints might get assigned different numbers.
 
-    >>> from bdb import Breakpoint
-    >>> Breakpoint.next = 1
-    >>> Breakpoint.bplist = {}
-    >>> Breakpoint.bpbynumber = [None]
+    >>> reset_Breakpoint()
 
     Now test the breakpoint commands.  NORMALIZE_WHITESPACE is needed because
     the breakpoint list outputs a tab for the "stop only" and "ignore next"
@@ -323,6 +324,100 @@
     4
     """
 
+def test_pdb_breakpoints_preserved_across_interactive_sessions():
+    """Breakpoints are remembered between interactive sessions
+
+    >>> reset_Breakpoint()
+    >>> with PdbTestInput([  # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
+    ...    'import test.test_pdb',
+    ...    'break test.test_pdb.do_something',
+    ...    'break test.test_pdb.do_nothing',
+    ...    'break',
+    ...    'continue',
+    ... ]):
+    ...    pdb.run('print()')
+    > <string>(1)<module>()...
+    (Pdb) import test.test_pdb
+    (Pdb) break test.test_pdb.do_something
+    Breakpoint 1 at ...test_pdb.py:...
+    (Pdb) break test.test_pdb.do_nothing
+    Breakpoint 2 at ...test_pdb.py:...
+    (Pdb) break
+    Num Type         Disp Enb   Where
+    1   breakpoint   keep yes   at ...test_pdb.py:...
+    2   breakpoint   keep yes   at ...test_pdb.py:...
+    (Pdb) continue
+
+    >>> with PdbTestInput([  # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
+    ...    'break',
+    ...    'break pdb.find_function',
+    ...    'break',
+    ...    'clear 1',
+    ...    'continue',
+    ... ]):
+    ...    pdb.run('print()')
+    > <string>(1)<module>()...
+    (Pdb) break
+    Num Type         Disp Enb   Where
+    1   breakpoint   keep yes   at ...test_pdb.py:...
+    2   breakpoint   keep yes   at ...test_pdb.py:...
+    (Pdb) break pdb.find_function
+    Breakpoint 3 at ...pdb.py:94
+    (Pdb) break
+    Num Type         Disp Enb   Where
+    1   breakpoint   keep yes   at ...test_pdb.py:...
+    2   breakpoint   keep yes   at ...test_pdb.py:...
+    3   breakpoint   keep yes   at ...pdb.py:...
+    (Pdb) clear 1
+    Deleted breakpoint 1 at ...test_pdb.py:...
+    (Pdb) continue
+
+    >>> with PdbTestInput([  # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
+    ...    'break',
+    ...    'clear 2',
+    ...    'clear 3',
+    ...    'continue',
+    ... ]):
+    ...    pdb.run('print()')
+    > <string>(1)<module>()...
+    (Pdb) break
+    Num Type         Disp Enb   Where
+    2   breakpoint   keep yes   at ...test_pdb.py:...
+    3   breakpoint   keep yes   at ...pdb.py:...
+    (Pdb) clear 2
+    Deleted breakpoint 2 at ...test_pdb.py:...
+    (Pdb) clear 3
+    Deleted breakpoint 3 at ...pdb.py:...
+    (Pdb) continue
+    """
+
+def test_pdb_pp_repr_exc():
+    """Test that do_p/do_pp do not swallow exceptions.
+
+    >>> class BadRepr:
+    ...     def __repr__(self):
+    ...         raise Exception('repr_exc')
+    >>> obj = BadRepr()
+
+    >>> def test_function():
+    ...     import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
+
+    >>> with PdbTestInput([  # doctest: +NORMALIZE_WHITESPACE
+    ...     'p obj',
+    ...     'pp obj',
+    ...     'continue',
+    ... ]):
+    ...    test_function()
+    --Return--
+    > <doctest test.test_pdb.test_pdb_pp_repr_exc[2]>(2)test_function()->None
+    -> import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
+    (Pdb) p obj
+    *** Exception: repr_exc
+    (Pdb) pp obj
+    *** Exception: repr_exc
+    (Pdb) continue
+    """
+
 
 def do_nothing():
     pass
@@ -699,8 +794,7 @@
     ...     test_function_2()
     ...     end = 1
 
-    >>> from bdb import Breakpoint
-    >>> Breakpoint.next = 1
+    >>> reset_Breakpoint()
     >>> with PdbTestInput(['break test_function_2',
     ...                    'continue',
     ...                    'return',
@@ -1127,6 +1221,7 @@
     ...         print('value', i)
     ...     x = 123
 
+    >>> reset_Breakpoint()
     >>> with PdbTestInput(['break test_gen',
     ...                    'continue',
     ...                    'next',
@@ -1137,7 +1232,7 @@
     > <doctest test.test_pdb.test_pdb_next_command_in_generator_for_loop[1]>(3)test_function()
     -> for i in test_gen():
     (Pdb) break test_gen
-    Breakpoint 6 at <doctest test.test_pdb.test_pdb_next_command_in_generator_for_loop[0]>:1
+    Breakpoint 1 at <doctest test.test_pdb.test_pdb_next_command_in_generator_for_loop[0]>:1
     (Pdb) continue
     > <doctest test.test_pdb.test_pdb_next_command_in_generator_for_loop[0]>(2)test_gen()
     -> yield 0
@@ -1213,6 +1308,7 @@
     ...         print('pdb %d: %s' % (i, sess._previous_sigint_handler))
     ...         i += 1
 
+    >>> reset_Breakpoint()
     >>> with PdbTestInput(['continue',
     ...                    'continue']):
     ...     test_function()
@@ -1220,19 +1316,48 @@
     -> print('pdb %d: %s' % (i, sess._previous_sigint_handler))
     (Pdb) continue
     pdb 1: <built-in function default_int_handler>
-    > <doctest test.test_pdb.test_pdb_issue_20766[0]>(5)test_function()
-    -> sess.set_trace(sys._getframe())
+    > <doctest test.test_pdb.test_pdb_issue_20766[0]>(6)test_function()
+    -> print('pdb %d: %s' % (i, sess._previous_sigint_handler))
     (Pdb) continue
     pdb 2: <built-in function default_int_handler>
     """
 
+def test_pdb_issue_43318():
+    """echo breakpoints cleared with filename:lineno
+
+    >>> def test_function():
+    ...     import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
+    ...     print(1)
+    ...     print(2)
+    ...     print(3)
+    ...     print(4)
+    >>> reset_Breakpoint()
+    >>> with PdbTestInput([  # doctest: +NORMALIZE_WHITESPACE
+    ...     'break 3',
+    ...     'clear <doctest test.test_pdb.test_pdb_issue_43318[0]>:3',
+    ...     'continue'
+    ... ]):
+    ...     test_function()
+    > <doctest test.test_pdb.test_pdb_issue_43318[0]>(3)test_function()
+    -> print(1)
+    (Pdb) break 3
+    Breakpoint 1 at <doctest test.test_pdb.test_pdb_issue_43318[0]>:3
+    (Pdb) clear <doctest test.test_pdb.test_pdb_issue_43318[0]>:3
+    Deleted breakpoint 1 at <doctest test.test_pdb.test_pdb_issue_43318[0]>:3
+    (Pdb) continue
+    1
+    2
+    3
+    4
+    """
+
 
 class PdbTestCase(unittest.TestCase):
     def tearDown(self):
-        support.unlink(support.TESTFN)
+        os_helper.unlink(os_helper.TESTFN)
 
     def _run_pdb(self, pdb_args, commands):
-        self.addCleanup(support.rmtree, '__pycache__')
+        self.addCleanup(os_helper.rmtree, '__pycache__')
         cmd = [sys.executable, '-m', 'pdb'] + pdb_args
         with subprocess.Popen(
                 cmd,
@@ -1251,13 +1376,13 @@
         filename = 'main.py'
         with open(filename, 'w') as f:
             f.write(textwrap.dedent(script))
-        self.addCleanup(support.unlink, filename)
+        self.addCleanup(os_helper.unlink, filename)
         return self._run_pdb([filename], commands)
 
     def run_pdb_module(self, script, commands):
         """Runs the script code as part of a module"""
         self.module_name = 't_main'
-        support.rmtree(self.module_name)
+        os_helper.rmtree(self.module_name)
         main_file = self.module_name + '/__main__.py'
         init_file = self.module_name + '/__init__.py'
         os.mkdir(self.module_name)
@@ -1265,17 +1390,17 @@
             pass
         with open(main_file, 'w') as f:
             f.write(textwrap.dedent(script))
-        self.addCleanup(support.rmtree, self.module_name)
+        self.addCleanup(os_helper.rmtree, self.module_name)
         return self._run_pdb(['-m', self.module_name], commands)
 
     def _assert_find_function(self, file_content, func_name, expected):
-        with open(support.TESTFN, 'wb') as f:
+        with open(os_helper.TESTFN, 'wb') as f:
             f.write(file_content)
 
         expected = None if not expected else (
-            expected[0], support.TESTFN, expected[1])
+            expected[0], os_helper.TESTFN, expected[1])
         self.assertEqual(
-            expected, pdb.find_function(func_name, support.TESTFN))
+            expected, pdb.find_function(func_name, os_helper.TESTFN))
 
     def test_find_function_empty_file(self):
         self._assert_find_function(b'', 'foo', None)
@@ -1325,9 +1450,9 @@
 
     def test_issue7964(self):
         # open the file as binary so we can force \r\n newline
-        with open(support.TESTFN, 'wb') as f:
+        with open(os_helper.TESTFN, 'wb') as f:
             f.write(b'print("testing my pdb")\r\n')
-        cmd = [sys.executable, '-m', 'pdb', support.TESTFN]
+        cmd = [sys.executable, '-m', 'pdb', os_helper.TESTFN]
         proc = subprocess.Popen(cmd,
             stdout=subprocess.PIPE,
             stdin=subprocess.PIPE,
@@ -1338,6 +1463,27 @@
         self.assertNotIn(b'SyntaxError', stdout,
                          "Got a syntax error running test script under PDB")
 
+    def test_issue46434(self):
+        # Temporarily patch in an extra help command which doesn't have a
+        # docstring to emulate what happens in an embeddable distribution
+        script = """
+            def do_testcmdwithnodocs(self, arg):
+                pass
+
+            import pdb
+            pdb.Pdb.do_testcmdwithnodocs = do_testcmdwithnodocs
+        """
+        commands = """
+            continue
+            help testcmdwithnodocs
+        """
+        stdout, stderr = self.run_pdb_script(script, commands)
+        output = (stdout or '') + (stderr or '')
+        self.assertNotIn('AttributeError', output,
+                         'Calling help on a command with no docs should be handled gracefully')
+        self.assertIn("*** No help for 'testcmdwithnodocs'; __doc__ string missing", output,
+                      'Calling help on a command with no docs should print an error')
+
     def test_issue13183(self):
         script = """
             from bar import bar
@@ -1368,7 +1514,7 @@
         """
         with open('bar.py', 'w') as f:
             f.write(textwrap.dedent(bar))
-        self.addCleanup(support.unlink, 'bar.py')
+        self.addCleanup(os_helper.unlink, 'bar.py')
         stdout, stderr = self.run_pdb_script(script, commands)
         self.assertTrue(
             any('main.py(5)foo()->None' in l for l in stdout.splitlines()),
@@ -1378,7 +1524,7 @@
         # Invoking "continue" on a non-main thread triggered an exception
         # inside signal.signal.
 
-        with open(support.TESTFN, 'wb') as f:
+        with open(os_helper.TESTFN, 'wb') as f:
             f.write(textwrap.dedent("""
                 import threading
                 import pdb
@@ -1390,7 +1536,7 @@
 
                 t = threading.Thread(target=start_pdb)
                 t.start()""").encode('ascii'))
-        cmd = [sys.executable, '-u', support.TESTFN]
+        cmd = [sys.executable, '-u', os_helper.TESTFN]
         proc = subprocess.Popen(cmd,
             stdout=subprocess.PIPE,
             stdin=subprocess.PIPE,
@@ -1404,7 +1550,7 @@
 
     def test_issue36250(self):
 
-        with open(support.TESTFN, 'wb') as f:
+        with open(os_helper.TESTFN, 'wb') as f:
             f.write(textwrap.dedent("""
                 import threading
                 import pdb
@@ -1420,7 +1566,7 @@
                 pdb.Pdb(readrc=False).set_trace()
                 evt.set()
                 t.join()""").encode('ascii'))
-        cmd = [sys.executable, '-u', support.TESTFN]
+        cmd = [sys.executable, '-u', os_helper.TESTFN]
         proc = subprocess.Popen(cmd,
             stdout=subprocess.PIPE,
             stdin=subprocess.PIPE,
@@ -1443,6 +1589,19 @@
             'Fail to handle a syntax error in the debuggee.'
             .format(expected, stdout))
 
+    def test_issue26053(self):
+        # run command of pdb prompt echoes the correct args
+        script = "print('hello')"
+        commands = """
+            continue
+            run a b c
+            run d e f
+            quit
+        """
+        stdout, stderr = self.run_pdb_script(script, commands)
+        res = '\n'.join([x.strip() for x in stdout.splitlines()])
+        self.assertRegex(res, "Restarting .* with arguments:\na b c")
+        self.assertRegex(res, "Restarting .* with arguments:\nd e f")
 
     def test_readrc_kwarg(self):
         script = textwrap.dedent("""
@@ -1453,7 +1612,7 @@
 
         save_home = os.environ.pop('HOME', None)
         try:
-            with support.temp_cwd():
+            with os_helper.temp_cwd():
                 with open('.pdbrc', 'w') as f:
                     f.write("invalid\n")
 
@@ -1478,7 +1637,7 @@
 
     def test_readrc_homedir(self):
         save_home = os.environ.pop("HOME", None)
-        with support.temp_dir() as temp_dir, patch("os.path.expanduser"):
+        with os_helper.temp_dir() as temp_dir, patch("os.path.expanduser"):
             rc_path = os.path.join(temp_dir, ".pdbrc")
             os.path.expanduser.return_value = rc_path
             try:
@@ -1547,16 +1706,30 @@
 
     def test_module_without_a_main(self):
         module_name = 't_main'
-        support.rmtree(module_name)
+        os_helper.rmtree(module_name)
         init_file = module_name + '/__init__.py'
         os.mkdir(module_name)
-        with open(init_file, 'w') as f:
+        with open(init_file, 'w'):
             pass
-        self.addCleanup(support.rmtree, module_name)
+        self.addCleanup(os_helper.rmtree, module_name)
         stdout, stderr = self._run_pdb(['-m', module_name], "")
         self.assertIn("ImportError: No module named t_main.__main__",
                       stdout.splitlines())
 
+    def test_package_without_a_main(self):
+        pkg_name = 't_pkg'
+        module_name = 't_main'
+        os_helper.rmtree(pkg_name)
+        modpath = pkg_name + '/' + module_name
+        os.makedirs(modpath)
+        with open(modpath + '/__init__.py', 'w'):
+            pass
+        self.addCleanup(os_helper.rmtree, pkg_name)
+        stdout, stderr = self._run_pdb(['-m', modpath.replace('/', '.')], "")
+        self.assertIn(
+            "'t_pkg.t_main' is a package and cannot be directly executed",
+            stdout)
+
     def test_blocks_at_first_code_line(self):
         script = """
                 #This is a comment, on line 2
@@ -1572,11 +1745,11 @@
 
     def test_relative_imports(self):
         self.module_name = 't_main'
-        support.rmtree(self.module_name)
+        os_helper.rmtree(self.module_name)
         main_file = self.module_name + '/__main__.py'
         init_file = self.module_name + '/__init__.py'
         module_file = self.module_name + '/module.py'
-        self.addCleanup(support.rmtree, self.module_name)
+        self.addCleanup(os_helper.rmtree, self.module_name)
         os.mkdir(self.module_name)
         with open(init_file, 'w') as f:
             f.write(textwrap.dedent("""
@@ -1610,11 +1783,11 @@
     def test_relative_imports_on_plain_module(self):
         # Validates running a plain module. See bpo32691
         self.module_name = 't_main'
-        support.rmtree(self.module_name)
+        os_helper.rmtree(self.module_name)
         main_file = self.module_name + '/runme.py'
         init_file = self.module_name + '/__init__.py'
         module_file = self.module_name + '/module.py'
-        self.addCleanup(support.rmtree, self.module_name)
+        self.addCleanup(os_helper.rmtree, self.module_name)
         os.mkdir(self.module_name)
         with open(init_file, 'w') as f:
             f.write(textwrap.dedent("""
@@ -1645,13 +1818,14 @@
             'debug doesnotexist',
             'c',
         ])
-        stdout, _ = self.run_pdb_script('', commands + '\n')
+        stdout, _ = self.run_pdb_script('pass', commands + '\n')
 
         self.assertEqual(stdout.splitlines()[1:], [
-            '(Pdb) *** SyntaxError: unexpected EOF while parsing',
+            '-> pass',
+            '(Pdb) *** SyntaxError: \'(\' was never closed',
 
             '(Pdb) ENTERING RECURSIVE DEBUGGER',
-            '*** SyntaxError: unexpected EOF while parsing',
+            '*** SyntaxError: \'(\' was never closed',
             'LEAVING RECURSIVE DEBUGGER',
 
             '(Pdb) ENTERING RECURSIVE DEBUGGER',
@@ -1661,10 +1835,128 @@
             '(Pdb) ',
         ])
 
+    def test_issue34266(self):
+        '''do_run handles exceptions from parsing its arg'''
+        def check(bad_arg, msg):
+            commands = "\n".join([
+                f'run {bad_arg}',
+                'q',
+            ])
+            stdout, _ = self.run_pdb_script('pass', commands + '\n')
+            self.assertEqual(stdout.splitlines()[1:], [
+                '-> pass',
+                f'(Pdb) *** Cannot run {bad_arg}: {msg}',
+                '(Pdb) ',
+            ])
+        check('\\', 'No escaped character')
+        check('"', 'No closing quotation')
+
+    def test_issue42384(self):
+        '''When running `python foo.py` sys.path[0] is an absolute path. `python -m pdb foo.py` should behave the same'''
+        script = textwrap.dedent("""
+            import sys
+            print('sys.path[0] is', sys.path[0])
+        """)
+        commands = 'c\nq'
+
+        with os_helper.temp_cwd() as cwd:
+            expected = f'(Pdb) sys.path[0] is {os.path.realpath(cwd)}'
+
+            stdout, stderr = self.run_pdb_script(script, commands)
+
+            self.assertEqual(stdout.split('\n')[2].rstrip('\r'), expected)
+
+    @os_helper.skip_unless_symlink
+    def test_issue42384_symlink(self):
+        '''When running `python foo.py` sys.path[0] resolves symlinks. `python -m pdb foo.py` should behave the same'''
+        script = textwrap.dedent("""
+            import sys
+            print('sys.path[0] is', sys.path[0])
+        """)
+        commands = 'c\nq'
+
+        with os_helper.temp_cwd() as cwd:
+            cwd = os.path.realpath(cwd)
+            dir_one = os.path.join(cwd, 'dir_one')
+            dir_two = os.path.join(cwd, 'dir_two')
+            expected = f'(Pdb) sys.path[0] is {dir_one}'
+
+            os.mkdir(dir_one)
+            with open(os.path.join(dir_one, 'foo.py'), 'w') as f:
+                f.write(script)
+            os.mkdir(dir_two)
+            os.symlink(os.path.join(dir_one, 'foo.py'), os.path.join(dir_two, 'foo.py'))
+
+            stdout, stderr = self._run_pdb([os.path.join('dir_two', 'foo.py')], commands)
+
+            self.assertEqual(stdout.split('\n')[2].rstrip('\r'), expected)
+
+    def test_issue42383(self):
+        with os_helper.temp_cwd() as cwd:
+            with open('foo.py', 'w') as f:
+                s = textwrap.dedent("""
+                    print('The correct file was executed')
+
+                    import os
+                    os.chdir("subdir")
+                """)
+                f.write(s)
+
+            subdir = os.path.join(cwd, 'subdir')
+            os.mkdir(subdir)
+            os.mkdir(os.path.join(subdir, 'subdir'))
+            wrong_file = os.path.join(subdir, 'foo.py')
+
+            with open(wrong_file, 'w') as f:
+                f.write('print("The wrong file was executed")')
+
+            stdout, stderr = self._run_pdb(['foo.py'], 'c\nc\nq')
+            expected = '(Pdb) The correct file was executed'
+            self.assertEqual(stdout.split('\n')[6].rstrip('\r'), expected)
+
+
+class ChecklineTests(unittest.TestCase):
+    def setUp(self):
+        linecache.clearcache()  # Pdb.checkline() uses linecache.getline()
+
+    def tearDown(self):
+        os_helper.unlink(os_helper.TESTFN)
+
+    def test_checkline_before_debugging(self):
+        with open(os_helper.TESTFN, "w") as f:
+            f.write("print(123)")
+        db = pdb.Pdb()
+        self.assertEqual(db.checkline(os_helper.TESTFN, 1), 1)
+
+    def test_checkline_after_reset(self):
+        with open(os_helper.TESTFN, "w") as f:
+            f.write("print(123)")
+        db = pdb.Pdb()
+        db.reset()
+        self.assertEqual(db.checkline(os_helper.TESTFN, 1), 1)
+
+    def test_checkline_is_not_executable(self):
+        # Test for comments, docstrings and empty lines
+        s = textwrap.dedent("""
+            # Comment
+            \"\"\" docstring \"\"\"
+            ''' docstring '''
+
+        """)
+        with open(os_helper.TESTFN, "w") as f:
+            f.write(s)
+        num_lines = len(s.splitlines()) + 2  # Test for EOF
+        with redirect_stdout(StringIO()):
+            db = pdb.Pdb()
+            for lineno in range(num_lines):
+                self.assertFalse(db.checkline(os_helper.TESTFN, lineno))
+
+
 def load_tests(*args):
     from test import test_pdb
     suites = [
         unittest.makeSuite(PdbTestCase),
+        unittest.makeSuite(ChecklineTests),
         doctest.DocTestSuite(test_pdb)
     ]
     return unittest.TestSuite(suites)
diff --git a/Lib/test/test_peepholer.py b/Lib/test/test_peepholer.py
index 55543de..11a4d17 100644
--- a/Lib/test/test_peepholer.py
+++ b/Lib/test/test_peepholer.py
@@ -409,21 +409,6 @@
         self.assertLessEqual(len(returns), 6)
         self.check_lnotab(f)
 
-    def test_elim_jump_after_return2(self):
-        # Eliminate dead code: jumps immediately after returns can't be reached
-        def f(cond1, cond2):
-            while 1:
-                if cond1: return 4
-        self.assertNotInBytecode(f, 'JUMP_FORWARD')
-        # There should be one jump for the while loop.
-        returns = [instr for instr in dis.get_instructions(f)
-                          if instr.opname == 'JUMP_ABSOLUTE']
-        self.assertEqual(len(returns), 1)
-        returns = [instr for instr in dis.get_instructions(f)
-                          if instr.opname == 'RETURN_VALUE']
-        self.assertLessEqual(len(returns), 2)
-        self.check_lnotab(f)
-
     def test_make_function_doesnt_bail(self):
         def f():
             def g()->1+1:
@@ -529,6 +514,12 @@
             except Exception or Exception:
                 pass
 
+    def test_bpo_45773_pop_jump_if_true(self):
+        compile("while True or spam: pass", "<test>", "exec")
+
+    def test_bpo_45773_pop_jump_if_false(self):
+        compile("while True or not spam: pass", "<test>", "exec")
+
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/Lib/test/test_peg_generator/__init__.py b/Lib/test/test_peg_generator/__init__.py
index fa855f2..77f72fc 100644
--- a/Lib/test/test_peg_generator/__init__.py
+++ b/Lib/test/test_peg_generator/__init__.py
@@ -1,7 +1,15 @@
-import os
-
+import os.path
+import unittest
+from test import support
 from test.support import load_package_tests
 
+
+if support.check_sanitizer(address=True, memory=True):
+    # bpo-46633: Skip the test because it is too slow when Python is built
+    # with ASAN/MSAN: between 5 and 20 minutes on GitHub Actions.
+    raise unittest.SkipTest("test too slow on ASAN/MSAN build")
+
+
 # Load all tests in package
 def load_tests(*args):
     return load_package_tests(os.path.dirname(__file__), *args)
diff --git a/Lib/test/test_peg_generator/test_c_parser.py b/Lib/test/test_peg_generator/test_c_parser.py
index 9701d4f..013b3af 100644
--- a/Lib/test/test_peg_generator/test_c_parser.py
+++ b/Lib/test/test_peg_generator/test_c_parser.py
@@ -1,11 +1,14 @@
 import sysconfig
 import textwrap
 import unittest
-from distutils.tests.support import TempdirManager
+import os
+import shutil
+import tempfile
 from pathlib import Path
 
 from test import test_tools
 from test import support
+from test.support import os_helper
 from test.support.script_helper import assert_python_ok
 
 _py_cflags_nodist = sysconfig.get_config_var('PY_CFLAGS_NODIST')
@@ -67,19 +70,23 @@
 """
 
 
-class TestCParser(TempdirManager, unittest.TestCase):
+class TestCParser(unittest.TestCase):
     def setUp(self):
+        self._backup_config_vars = dict(sysconfig._CONFIG_VARS)
         cmd = support.missing_compiler_executable()
         if cmd is not None:
             self.skipTest("The %r command is not found" % cmd)
-        super(TestCParser, self).setUp()
-        self.tmp_path = self.mkdtemp()
-        change_cwd = support.change_cwd(self.tmp_path)
+        self.old_cwd = os.getcwd()
+        self.tmp_path = tempfile.mkdtemp()
+        change_cwd = os_helper.change_cwd(self.tmp_path)
         change_cwd.__enter__()
         self.addCleanup(change_cwd.__exit__, None, None, None)
 
     def tearDown(self):
-        super(TestCParser, self).tearDown()
+        os.chdir(self.old_cwd)
+        shutil.rmtree(self.tmp_path)
+        sysconfig._CONFIG_VARS.clear()
+        sysconfig._CONFIG_VARS.update(self._backup_config_vars)
 
     def build_extension(self, grammar_source):
         grammar = parse_string(grammar_source, GrammarParser)
@@ -95,15 +102,15 @@
 
     def test_c_parser(self) -> None:
         grammar_source = """
-        start[mod_ty]: a=stmt* $ { Module(a, NULL, p->arena) }
+        start[mod_ty]: a[asdl_stmt_seq*]=stmt* $ { _PyAST_Module(a, NULL, p->arena) }
         stmt[stmt_ty]: a=expr_stmt { a }
-        expr_stmt[stmt_ty]: a=expression NEWLINE { _Py_Expr(a, EXTRA) }
-        expression[expr_ty]: ( l=expression '+' r=term { _Py_BinOp(l, Add, r, EXTRA) }
-                            | l=expression '-' r=term { _Py_BinOp(l, Sub, r, EXTRA) }
+        expr_stmt[stmt_ty]: a=expression NEWLINE { _PyAST_Expr(a, EXTRA) }
+        expression[expr_ty]: ( l=expression '+' r=term { _PyAST_BinOp(l, Add, r, EXTRA) }
+                            | l=expression '-' r=term { _PyAST_BinOp(l, Sub, r, EXTRA) }
                             | t=term { t }
                             )
-        term[expr_ty]: ( l=term '*' r=factor { _Py_BinOp(l, Mult, r, EXTRA) }
-                    | l=term '/' r=factor { _Py_BinOp(l, Div, r, EXTRA) }
+        term[expr_ty]: ( l=term '*' r=factor { _PyAST_BinOp(l, Mult, r, EXTRA) }
+                    | l=term '/' r=factor { _PyAST_BinOp(l, Div, r, EXTRA) }
                     | f=factor { f }
                     )
         factor[expr_ty]: ('(' e=expression ')' { e }
@@ -236,12 +243,12 @@
 
     def test_return_stmt_noexpr_action(self) -> None:
         grammar_source = """
-        start[mod_ty]: a=[statements] ENDMARKER { Module(a, NULL, p->arena) }
-        statements[asdl_seq*]: a=statement+ { a }
+        start[mod_ty]: a=[statements] ENDMARKER { _PyAST_Module(a, NULL, p->arena) }
+        statements[asdl_stmt_seq*]: a[asdl_stmt_seq*]=statement+ { a }
         statement[stmt_ty]: simple_stmt
         simple_stmt[stmt_ty]: small_stmt
         small_stmt[stmt_ty]: return_stmt
-        return_stmt[stmt_ty]: a='return' NEWLINE { _Py_Return(NULL, EXTRA) }
+        return_stmt[stmt_ty]: a='return' NEWLINE { _PyAST_Return(NULL, EXTRA) }
         """
         test_source = """
         stmt = "return"
@@ -251,8 +258,8 @@
 
     def test_gather_action_ast(self) -> None:
         grammar_source = """
-        start[mod_ty]: a=';'.pass_stmt+ NEWLINE ENDMARKER { Module(a, NULL, p->arena) }
-        pass_stmt[stmt_ty]: a='pass' { _Py_Pass(EXTRA)}
+        start[mod_ty]: a[asdl_stmt_seq*]=';'.pass_stmt+ NEWLINE ENDMARKER { _PyAST_Module(a, NULL, p->arena) }
+        pass_stmt[stmt_ty]: a='pass' { _PyAST_Pass(EXTRA)}
         """
         test_source = """
         stmt = "pass; pass"
@@ -262,12 +269,12 @@
 
     def test_pass_stmt_action(self) -> None:
         grammar_source = """
-        start[mod_ty]: a=[statements] ENDMARKER { Module(a, NULL, p->arena) }
-        statements[asdl_seq*]: a=statement+ { a }
+        start[mod_ty]: a=[statements] ENDMARKER { _PyAST_Module(a, NULL, p->arena) }
+        statements[asdl_stmt_seq*]: a[asdl_stmt_seq*]=statement+ { a }
         statement[stmt_ty]: simple_stmt
         simple_stmt[stmt_ty]: small_stmt
         small_stmt[stmt_ty]: pass_stmt
-        pass_stmt[stmt_ty]: a='pass' NEWLINE { _Py_Pass(EXTRA) }
+        pass_stmt[stmt_ty]: a='pass' NEWLINE { _PyAST_Pass(EXTRA) }
         """
         test_source = """
         stmt = "pass"
@@ -277,22 +284,23 @@
 
     def test_if_stmt_action(self) -> None:
         grammar_source = """
-        start[mod_ty]: a=[statements] ENDMARKER { Module(a, NULL, p->arena) }
-        statements[asdl_seq*]: a=statement+ { _PyPegen_seq_flatten(p, a) }
-        statement[asdl_seq*]:  a=compound_stmt { _PyPegen_singleton_seq(p, a) } | simple_stmt
+        start[mod_ty]: a=[statements] ENDMARKER { _PyAST_Module(a, NULL, p->arena) }
+        statements[asdl_stmt_seq*]: a=statement+ { (asdl_stmt_seq*)_PyPegen_seq_flatten(p, a) }
+        statement[asdl_stmt_seq*]:  a=compound_stmt { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, a) } | simple_stmt
 
-        simple_stmt[asdl_seq*]: a=small_stmt b=further_small_stmt* [';'] NEWLINE { _PyPegen_seq_insert_in_front(p, a, b) }
+        simple_stmt[asdl_stmt_seq*]: a=small_stmt b=further_small_stmt* [';'] NEWLINE {
+                                            (asdl_stmt_seq*)_PyPegen_seq_insert_in_front(p, a, b) }
         further_small_stmt[stmt_ty]: ';' a=small_stmt { a }
 
         block: simple_stmt | NEWLINE INDENT a=statements DEDENT { a }
 
         compound_stmt: if_stmt
 
-        if_stmt: 'if' a=full_expression ':' b=block { _Py_If(a, b, NULL, EXTRA) }
+        if_stmt: 'if' a=full_expression ':' b=block { _PyAST_If(a, b, NULL, EXTRA) }
 
         small_stmt[stmt_ty]: pass_stmt
 
-        pass_stmt[stmt_ty]: a='pass' { _Py_Pass(EXTRA) }
+        pass_stmt[stmt_ty]: a='pass' { _PyAST_Pass(EXTRA) }
 
         full_expression: NAME
         """
@@ -304,15 +312,15 @@
 
     def test_same_name_different_types(self) -> None:
         grammar_source = """
-        start[mod_ty]: a=import_from+ NEWLINE ENDMARKER { Module(a, NULL, p->arena)}
+        start[mod_ty]: a[asdl_stmt_seq*]=import_from+ NEWLINE ENDMARKER { _PyAST_Module(a, NULL, p->arena)}
         import_from[stmt_ty]: ( a='from' !'import' c=simple_name 'import' d=import_as_names_from {
-                                _Py_ImportFrom(c->v.Name.id, d, 0, EXTRA) }
+                                _PyAST_ImportFrom(c->v.Name.id, d, 0, EXTRA) }
                             | a='from' '.' 'import' c=import_as_names_from {
-                                _Py_ImportFrom(NULL, c, 1, EXTRA) }
+                                _PyAST_ImportFrom(NULL, c, 1, EXTRA) }
                             )
         simple_name[expr_ty]: NAME
-        import_as_names_from[asdl_seq*]: a=','.import_as_name_from+ { a }
-        import_as_name_from[alias_ty]: a=NAME 'as' b=NAME { _Py_alias(((expr_ty) a)->v.Name.id, ((expr_ty) b)->v.Name.id, p->arena) }
+        import_as_names_from[asdl_alias_seq*]: a[asdl_alias_seq*]=','.import_as_name_from+ { a }
+        import_as_name_from[alias_ty]: a=NAME 'as' b=NAME { _PyAST_alias(((expr_ty) a)->v.Name.id, ((expr_ty) b)->v.Name.id, EXTRA) }
         """
         test_source = """
         for stmt in ("from a import b as c", "from . import a as b"):
@@ -324,19 +332,19 @@
 
     def test_with_stmt_with_paren(self) -> None:
         grammar_source = """
-        start[mod_ty]: a=[statements] ENDMARKER { Module(a, NULL, p->arena) }
-        statements[asdl_seq*]: a=statement+ { _PyPegen_seq_flatten(p, a) }
-        statement[asdl_seq*]: a=compound_stmt { _PyPegen_singleton_seq(p, a) }
+        start[mod_ty]: a=[statements] ENDMARKER { _PyAST_Module(a, NULL, p->arena) }
+        statements[asdl_stmt_seq*]: a=statement+ { (asdl_stmt_seq*)_PyPegen_seq_flatten(p, a) }
+        statement[asdl_stmt_seq*]: a=compound_stmt { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, a) }
         compound_stmt[stmt_ty]: with_stmt
         with_stmt[stmt_ty]: (
-            a='with' '(' b=','.with_item+ ')' ':' c=block {
-                _Py_With(b, _PyPegen_singleton_seq(p, c), NULL, EXTRA) }
+            a='with' '(' b[asdl_withitem_seq*]=','.with_item+ ')' ':' c=block {
+                _PyAST_With(b, (asdl_stmt_seq*) _PyPegen_singleton_seq(p, c), NULL, EXTRA) }
         )
         with_item[withitem_ty]: (
-            e=NAME o=['as' t=NAME { t }] { _Py_withitem(e, _PyPegen_set_expr_context(p, o, Store), p->arena) }
+            e=NAME o=['as' t=NAME { t }] { _PyAST_withitem(e, _PyPegen_set_expr_context(p, o, Store), p->arena) }
         )
         block[stmt_ty]: a=pass_stmt NEWLINE { a } | NEWLINE INDENT a=pass_stmt DEDENT { a }
-        pass_stmt[stmt_ty]: a='pass' { _Py_Pass(EXTRA) }
+        pass_stmt[stmt_ty]: a='pass' { _PyAST_Pass(EXTRA) }
         """
         test_source = """
         stmt = "with (\\n    a as b,\\n    c as d\\n): pass"
@@ -350,14 +358,14 @@
 
     def test_ternary_operator(self) -> None:
         grammar_source = """
-        start[mod_ty]: a=expr ENDMARKER { Module(a, NULL, p->arena) }
-        expr[asdl_seq*]: a=listcomp NEWLINE { _PyPegen_singleton_seq(p, _Py_Expr(a, EXTRA)) }
+        start[mod_ty]: a=expr ENDMARKER { _PyAST_Module(a, NULL, p->arena) }
+        expr[asdl_stmt_seq*]: a=listcomp NEWLINE { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, _PyAST_Expr(a, EXTRA)) }
         listcomp[expr_ty]: (
-            a='[' b=NAME c=for_if_clauses d=']' { _Py_ListComp(b, c, EXTRA) }
+            a='[' b=NAME c=for_if_clauses d=']' { _PyAST_ListComp(b, c, EXTRA) }
         )
-        for_if_clauses[asdl_seq*]: (
-            a=(y=[ASYNC] 'for' a=NAME 'in' b=NAME c=('if' z=NAME { z })*
-                { _Py_comprehension(_Py_Name(((expr_ty) a)->v.Name.id, Store, EXTRA), b, c, (y == NULL) ? 0 : 1, p->arena) })+ { a }
+        for_if_clauses[asdl_comprehension_seq*]: (
+            a[asdl_comprehension_seq*]=(y=[ASYNC] 'for' a=NAME 'in' b=NAME c[asdl_expr_seq*]=('if' z=NAME { z })*
+                { _PyAST_comprehension(_PyAST_Name(((expr_ty) a)->v.Name.id, Store, EXTRA), b, c, (y == NULL) ? 0 : 1, p->arena) })+ { a }
         )
         """
         test_source = """
diff --git a/Lib/test/test_peg_generator/test_grammar_validator.py b/Lib/test/test_peg_generator/test_grammar_validator.py
new file mode 100644
index 0000000..2e72ff8
--- /dev/null
+++ b/Lib/test/test_peg_generator/test_grammar_validator.py
@@ -0,0 +1,51 @@
+import unittest
+from test import test_tools
+
+test_tools.skip_if_missing('peg_generator')
+with test_tools.imports_under_tool('peg_generator'):
+    from pegen.grammar_parser import GeneratedParser as GrammarParser
+    from pegen.validator import SubRuleValidator, ValidationError
+    from pegen.testutil import parse_string
+    from pegen.grammar import Grammar
+
+
+class TestPegen(unittest.TestCase):
+    def test_rule_with_no_collision(self) -> None:
+        grammar_source = """
+        start: bad_rule
+        sum:
+            | NAME '-' NAME
+            | NAME '+' NAME
+        """
+        grammar: Grammar = parse_string(grammar_source, GrammarParser)
+        validator = SubRuleValidator(grammar)
+        for rule_name, rule in grammar.rules.items():
+            validator.validate_rule(rule_name, rule)
+
+    def test_rule_with_simple_collision(self) -> None:
+        grammar_source = """
+        start: bad_rule
+        sum:
+            | NAME '+' NAME
+            | NAME '+' NAME ';'
+        """
+        grammar: Grammar = parse_string(grammar_source, GrammarParser)
+        validator = SubRuleValidator(grammar)
+        with self.assertRaises(ValidationError):
+            for rule_name, rule in grammar.rules.items():
+                validator.validate_rule(rule_name, rule)
+
+    def test_rule_with_collision_after_some_other_rules(self) -> None:
+        grammar_source = """
+        start: bad_rule
+        sum:
+            | NAME '+' NAME
+            | NAME '*' NAME ';'
+            | NAME '-' NAME
+            | NAME '+' NAME ';'
+        """
+        grammar: Grammar = parse_string(grammar_source, GrammarParser)
+        validator = SubRuleValidator(grammar)
+        with self.assertRaises(ValidationError):
+            for rule_name, rule in grammar.rules.items():
+                validator.validate_rule(rule_name, rule)
diff --git a/Lib/test/test_peg_parser.py b/Lib/test/test_peg_parser.py
deleted file mode 100644
index f4aaef8..0000000
--- a/Lib/test/test_peg_parser.py
+++ /dev/null
@@ -1,803 +0,0 @@
-import ast
-import _peg_parser as peg_parser
-import unittest
-from typing import Any, Union, Iterable, Tuple
-from textwrap import dedent
-from test import support
-
-
-TEST_CASES = [
-    ('annotated_assignment', 'x: int = 42'),
-    ('annotated_assignment_with_tuple', 'x: tuple = 1, 2'),
-    ('annotated_assignment_with_parens', '(paren): int = 3+2'),
-    ('annotated_assignment_with_yield', 'x: int = yield 42'),
-    ('annotated_no_assignment', 'x: int'),
-    ('annotation_with_multiple_parens', '((parens)): int'),
-    ('annotation_with_parens', '(parens): int'),
-    ('annotated_assignment_with_attr', 'a.b: int'),
-    ('annotated_assignment_with_subscript', 'a[b]: int'),
-    ('annotated_assignment_with_attr_and_parens', '(a.b): int'),
-    ('annotated_assignment_with_subscript_and_parens', '(a[b]): int'),
-    ('assert', 'assert a'),
-    ('assert_message', 'assert a, b'),
-    ('assignment_false', 'a = False'),
-    ('assignment_none', 'a = None'),
-    ('assignment_true', 'a = True'),
-    ('assignment_paren', '(a) = 42'),
-    ('assignment_paren_multiple', '(a, b) = (0, 1)'),
-    ('asyncfor',
-     '''
-        async for i in a:
-            pass
-     '''),
-    ('attribute_call', 'a.b()'),
-    ('attribute_multiple_names', 'abcd.efg.hij'),
-    ('attribute_simple', 'a.b'),
-    ('attributes_subscript', 'a.b[0]'),
-    ('augmented_assignment', 'x += 42'),
-    ('augmented_assignment_attribute', 'a.b.c += 42'),
-    ('augmented_assignment_paren', '(x) += 42'),
-    ('augmented_assignment_paren_subscript', '(x[0]) -= 42'),
-    ('binop_add', '1 + 1'),
-    ('binop_add_multiple', '1 + 1 + 1 + 1'),
-    ('binop_all', '1 + 2 * 5 + 3 ** 2 - -3'),
-    ('binop_boolop_comp', '1 + 1 == 2 or 1 + 1 == 3 and not b'),
-    ('boolop_or', 'a or b'),
-    ('boolop_or_multiple', 'a or b or c'),
-    ('class_def_bases',
-     '''
-        class C(A, B):
-            pass
-     '''),
-    ('class_def_decorators',
-     '''
-        @a
-        class C:
-            pass
-     '''),
-    ('class_def_decorator_with_expression',
-     '''
-        @lambda x: 42
-        class C:
-            pass
-     '''),
-    ('class_def_decorator_with_expression_and_walrus',
-     '''
-        @x:=lambda x: 42
-        class C:
-            pass
-     '''),
-
-    ('class_def_keywords',
-     '''
-        class C(keyword=a+b, **c):
-            pass
-     '''),
-    ('class_def_mixed',
-     '''
-        class C(A, B, keyword=0, **a):
-            pass
-     '''),
-    ('class_def_simple',
-     '''
-        class C:
-            pass
-     '''),
-    ('class_def_starred_and_kwarg',
-     '''
-        class C(A, B, *x, **y):
-            pass
-     '''),
-    ('class_def_starred_in_kwargs',
-     '''
-        class C(A, x=2, *[B, C], y=3):
-            pass
-     '''),
-    ('call_attribute', 'f().b'),
-    ('call_genexp', 'f(i for i in a)'),
-    ('call_mixed_args', 'f(a, b, *c, **d)'),
-    ('call_mixed_args_named', 'f(a, b, *c, d=4, **v)'),
-    ('call_one_arg', 'f(a)'),
-    ('call_posarg_genexp', 'f(a, (i for i in a))'),
-    ('call_simple', 'f()'),
-    ('call_subscript', 'f()[0]'),
-    ('comp', 'a == b'),
-    ('comp_multiple', 'a == b == c'),
-    ('comp_paren_end', 'a == (b-1)'),
-    ('comp_paren_start', '(a-1) == b'),
-    ('decorator',
-     '''
-        @a
-        def f():
-            pass
-     '''),
-    ('decorator_async',
-     '''
-        @a
-        async def d():
-            pass
-     '''),
-    ('decorator_with_expression',
-     '''
-        @lambda x: 42
-        def f():
-            pass
-     '''),
-    ('decorator_with_expression_and_walrus',
-     '''
-        @x:=lambda x: 42
-        def f():
-            pass
-     '''),
-    ('del_attribute', 'del a.b'),
-    ('del_call_attribute', 'del a().c'),
-    ('del_call_genexp_attribute', 'del a(i for i in b).c'),
-    ('del_empty', 'del()'),
-    ('del_list', 'del a, [b, c]'),
-    ('del_mixed', 'del a[0].b().c'),
-    ('del_multiple', 'del a, b'),
-    ('del_multiple_calls_attribute', 'del a()().b'),
-    ('del_paren', 'del(a,b)'),
-    ('del_paren_single_target', 'del(a)'),
-    ('del_subscript_attribute', 'del a[0].b'),
-    ('del_tuple', 'del a, (b, c)'),
-    ('delete', 'del a'),
-    ('dict',
-     '''
-        {
-            a: 1,
-            b: 2,
-            c: 3
-        }
-     '''),
-    ('dict_comp', '{x:1 for x in a}'),
-    ('dict_comp_if', '{x:1+2 for x in a if b}'),
-    ('dict_empty', '{}'),
-    ('empty_line_after_linecont',
-     r'''
-        pass
-        \
-
-        pass
-     '''),
-    ('for',
-     '''
-        for i in a:
-            pass
-     '''),
-    ('for_else',
-     '''
-        for i in a:
-            pass
-        else:
-            pass
-     '''),
-    ('for_star_target_in_paren', 'for (a) in b: pass'),
-    ('for_star_targets_attribute', 'for a.b in c: pass'),
-    ('for_star_targets_call_attribute', 'for a().c in b: pass'),
-    ('for_star_targets_empty', 'for () in a: pass'),
-    ('for_star_targets_mixed', 'for a[0].b().c in d: pass'),
-    ('for_star_targets_mixed_starred',
-     '''
-        for a, *b, (c, d) in e:
-            pass
-     '''),
-    ('for_star_targets_multiple', 'for a, b in c: pass'),
-    ('for_star_targets_nested_starred', 'for *[*a] in b: pass'),
-    ('for_star_targets_starred', 'for *a in b: pass'),
-    ('for_star_targets_subscript_attribute', 'for a[0].b in c: pass'),
-    ('for_star_targets_trailing_comma',
-     '''
-        for a, (b, c), in d:
-            pass
-     '''),
-    ('for_star_targets_tuple', 'for a, (b, c) in d: pass'),
-    ('for_underscore',
-     '''
-        for _ in a:
-            pass
-     '''),
-    ('function_return_type',
-     '''
-        def f() -> Any:
-            pass
-     '''),
-    ('f-string_slice', "f'{x[2]}'"),
-    ('f-string_slice_upper', "f'{x[2:3]}'"),
-    ('f-string_slice_step', "f'{x[2:3:-2]}'"),
-    ('f-string_constant', "f'{42}'"),
-    ('f-string_boolop', "f'{x and y}'"),
-    ('f-string_named_expr', "f'{(x:=42)}'"),
-    ('f-string_binop', "f'{x+y}'"),
-    ('f-string_unaryop', "f'{not x}'"),
-    ('f-string_lambda', "f'{(lambda x, /, y, y2=42 , *z, k1, k2=34, **k3: 42)}'"),
-    ('f-string_lambda_call', "f'{(lambda: 2)(2)}'"),
-    ('f-string_ifexpr', "f'{x if y else z}'"),
-    ('f-string_dict', "f'{ {2:34, 3:34} }'"),
-    ('f-string_set', "f'{ {2,-45} }'"),
-    ('f-string_list', "f'{ [2,-45] }'"),
-    ('f-string_tuple', "f'{ (2,-45) }'"),
-    ('f-string_listcomp', "f'{[x for x in y if z]}'"),
-    ('f-string_setcomp', "f'{ {x for x in y if z} }'"),
-    ('f-string_dictcomp', "f'{ {x:x for x in y if z} }'"),
-    ('f-string_genexpr', "f'{ (x for x in y if z) }'"),
-    ('f-string_yield', "f'{ (yield x) }'"),
-    ('f-string_yieldfrom', "f'{ (yield from x) }'"),
-    ('f-string_await', "f'{ await x }'"),
-    ('f-string_compare', "f'{ x == y }'"),
-    ('f-string_call', "f'{ f(x,y,z) }'"),
-    ('f-string_attribute', "f'{ f.x.y.z }'"),
-    ('f-string_starred', "f'{ *x, }'"),
-    ('f-string_doublestarred', "f'{ {**x} }'"),
-    ('f-string_escape_brace', "f'{{Escape'"),
-    ('f-string_escape_closing_brace', "f'Escape}}'"),
-    ('f-string_repr', "f'{a!r}'"),
-    ('f-string_str', "f'{a!s}'"),
-    ('f-string_ascii', "f'{a!a}'"),
-    ('f-string_debug', "f'{a=}'"),
-    ('f-string_padding', "f'{a:03d}'"),
-    ('f-string_multiline',
-     """
-        f'''
-        {hello}
-        '''
-     """),
-    ('f-string_multiline_in_expr',
-     """
-        f'''
-        {
-        hello
-        }
-        '''
-     """),
-    ('f-string_multiline_in_call',
-     """
-        f'''
-        {f(
-            a, b, c
-        )}
-        '''
-     """),
-    ('global', 'global a, b'),
-    ('group', '(yield a)'),
-    ('if_elif',
-     '''
-        if a:
-            pass
-        elif b:
-            pass
-     '''),
-    ('if_elif_elif',
-     '''
-        if a:
-            pass
-        elif b:
-            pass
-        elif c:
-            pass
-     '''),
-    ('if_elif_else',
-     '''
-        if a:
-            pass
-        elif b:
-            pass
-        else:
-           pass
-     '''),
-    ('if_else',
-     '''
-        if a:
-            pass
-        else:
-            pass
-     '''),
-    ('if_simple', 'if a: pass'),
-    ('import', 'import a'),
-    ('import_alias', 'import a as b'),
-    ('import_dotted', 'import a.b'),
-    ('import_dotted_alias', 'import a.b as c'),
-    ('import_dotted_multichar', 'import ab.cd'),
-    ('import_from', 'from a import b'),
-    ('import_from_alias', 'from a import b as c'),
-    ('import_from_dotted', 'from a.b import c'),
-    ('import_from_dotted_alias', 'from a.b import c as d'),
-    ('import_from_multiple_aliases', 'from a import b as c, d as e'),
-    ('import_from_one_dot', 'from .a import b'),
-    ('import_from_one_dot_alias', 'from .a import b as c'),
-    ('import_from_star', 'from a import *'),
-    ('import_from_three_dots', 'from ...a import b'),
-    ('import_from_trailing_comma', 'from a import (b,)'),
-    ('kwarg',
-     '''
-        def f(**a):
-            pass
-     '''),
-    ('kwonly_args',
-     '''
-        def f(*, a, b):
-            pass
-     '''),
-    ('kwonly_args_with_default',
-     '''
-        def f(*, a=2, b):
-            pass
-     '''),
-    ('lambda_kwarg', 'lambda **a: 42'),
-    ('lambda_kwonly_args', 'lambda *, a, b: 42'),
-    ('lambda_kwonly_args_with_default', 'lambda *, a=2, b: 42'),
-    ('lambda_mixed_args', 'lambda a, /, b, *, c: 42'),
-    ('lambda_mixed_args_with_default', 'lambda a, b=2, /, c=3, *e, f, **g: 42'),
-    ('lambda_no_args', 'lambda: 42'),
-    ('lambda_pos_args', 'lambda a,b: 42'),
-    ('lambda_pos_args_with_default', 'lambda a, b=2: 42'),
-    ('lambda_pos_only_args', 'lambda a, /: 42'),
-    ('lambda_pos_only_args_with_default', 'lambda a=0, /: 42'),
-    ('lambda_pos_posonly_args', 'lambda a, b, /, c, d: 42'),
-    ('lambda_pos_posonly_args_with_default', 'lambda a, b=0, /, c=2: 42'),
-    ('lambda_vararg', 'lambda *a: 42'),
-    ('lambda_vararg_kwonly_args', 'lambda *a, b: 42'),
-    ('list', '[1, 2, a]'),
-    ('list_comp', '[i for i in a]'),
-    ('list_comp_if', '[i for i in a if b]'),
-    ('list_trailing_comma', '[1+2, a, 3+4,]'),
-    ('mixed_args',
-     '''
-        def f(a, /, b, *, c):
-            pass
-     '''),
-    ('mixed_args_with_default',
-     '''
-        def f(a, b=2, /, c=3, *e, f, **g):
-            pass
-     '''),
-    ('multipart_string_bytes', 'b"Hola" b"Hello" b"Bye"'),
-    ('multipart_string_triple', '"""Something here""" "and now"'),
-    ('multipart_string_different_prefixes', 'u"Something" "Other thing" r"last thing"'),
-    ('multiple_assignments', 'x = y = z = 42'),
-    ('multiple_assignments_with_yield', 'x = y = z = yield 42'),
-    ('multiple_pass',
-     '''
-        pass; pass
-        pass
-     '''),
-    ('namedexpr', '(x := [1, 2, 3])'),
-    ('namedexpr_false', '(x := False)'),
-    ('namedexpr_none', '(x := None)'),
-    ('namedexpr_true', '(x := True)'),
-    ('nonlocal', 'nonlocal a, b'),
-    ('number_complex', '-2.234+1j'),
-    ('number_float', '-34.2333'),
-    ('number_imaginary_literal', '1.1234j'),
-    ('number_integer', '-234'),
-    ('number_underscores', '1_234_567'),
-    ('pass', 'pass'),
-    ('pos_args',
-     '''
-        def f(a, b):
-            pass
-     '''),
-    ('pos_args_with_default',
-     '''
-        def f(a, b=2):
-            pass
-     '''),
-    ('pos_only_args',
-     '''
-        def f(a, /):
-            pass
-     '''),
-    ('pos_only_args_with_default',
-     '''
-        def f(a=0, /):
-            pass
-     '''),
-    ('pos_posonly_args',
-     '''
-        def f(a, b, /, c, d):
-            pass
-     '''),
-    ('pos_posonly_args_with_default',
-     '''
-        def f(a, b=0, /, c=2):
-            pass
-     '''),
-    ('primary_mixed', 'a.b.c().d[0]'),
-    ('raise', 'raise'),
-    ('raise_ellipsis', 'raise ...'),
-    ('raise_expr', 'raise a'),
-    ('raise_from', 'raise a from b'),
-    ('return', 'return'),
-    ('return_expr', 'return a'),
-    ('set', '{1, 2+4, 3+5}'),
-    ('set_comp', '{i for i in a}'),
-    ('set_trailing_comma', '{1, 2, 3,}'),
-    ('simple_assignment', 'x = 42'),
-    ('simple_assignment_with_yield', 'x = yield 42'),
-    ('string_bytes', 'b"hello"'),
-    ('string_concatenation_bytes', 'b"hello" b"world"'),
-    ('string_concatenation_simple', '"abcd" "efgh"'),
-    ('string_format_simple', 'f"hello"'),
-    ('string_format_with_formatted_value', 'f"hello {world}"'),
-    ('string_simple', '"hello"'),
-    ('string_unicode', 'u"hello"'),
-    ('subscript_attribute', 'a[0].b'),
-    ('subscript_call', 'a[b]()'),
-    ('subscript_multiple_slices', 'a[0:a:2, 1]'),
-    ('subscript_simple', 'a[0]'),
-    ('subscript_single_element_tuple', 'a[0,]'),
-    ('subscript_trailing_comma', 'a[0, 1, 2,]'),
-    ('subscript_tuple', 'a[0, 1, 2]'),
-    ('subscript_whole_slice', 'a[0+1:b:c]'),
-    ('try_except',
-     '''
-        try:
-            pass
-        except:
-            pass
-     '''),
-    ('try_except_else',
-     '''
-        try:
-            pass
-        except:
-            pass
-        else:
-            pass
-     '''),
-    ('try_except_else_finally',
-     '''
-        try:
-            pass
-        except:
-            pass
-        else:
-            pass
-        finally:
-            pass
-     '''),
-    ('try_except_expr',
-     '''
-        try:
-            pass
-        except a:
-            pass
-     '''),
-    ('try_except_expr_target',
-     '''
-        try:
-            pass
-        except a as b:
-            pass
-     '''),
-    ('try_except_finally',
-     '''
-        try:
-            pass
-        except:
-            pass
-        finally:
-            pass
-     '''),
-    ('try_finally',
-     '''
-        try:
-            pass
-        finally:
-            pass
-     '''),
-    ('unpacking_binop', '[*([1, 2, 3] + [3, 4, 5])]'),
-    ('unpacking_call', '[*b()]'),
-    ('unpacking_compare', '[*(x < y)]'),
-    ('unpacking_constant', '[*3]'),
-    ('unpacking_dict', '[*{1: 2, 3: 4}]'),
-    ('unpacking_dict_comprehension', '[*{x:y for x,y in z}]'),
-    ('unpacking_ifexpr', '[*([1, 2, 3] if x else y)]'),
-    ('unpacking_list', '[*[1,2,3]]'),
-    ('unpacking_list_comprehension', '[*[x for x in y]]'),
-    ('unpacking_namedexpr', '[*(x:=[1, 2, 3])]'),
-    ('unpacking_set', '[*{1,2,3}]'),
-    ('unpacking_set_comprehension', '[*{x for x in y}]'),
-    ('unpacking_string', '[*"myvalue"]'),
-    ('unpacking_tuple', '[*(1,2,3)]'),
-    ('unpacking_unaryop', '[*(not [1, 2, 3])]'),
-    ('unpacking_yield', '[*(yield 42)]'),
-    ('unpacking_yieldfrom', '[*(yield from x)]'),
-    ('tuple', '(1, 2, 3)'),
-    ('vararg',
-     '''
-        def f(*a):
-            pass
-     '''),
-    ('vararg_kwonly_args',
-     '''
-        def f(*a, b):
-            pass
-     '''),
-    ('while',
-     '''
-        while a:
-            pass
-     '''),
-    ('while_else',
-     '''
-        while a:
-            pass
-        else:
-             pass
-    '''),
-    ('with',
-     '''
-        with a:
-            pass
-     '''),
-    ('with_as',
-     '''
-        with a as b:
-            pass
-     '''),
-    ('with_as_paren',
-     '''
-        with a as (b):
-            pass
-     '''),
-    ('with_as_empty', 'with a as (): pass'),
-    ('with_list_recursive',
-     '''
-        with a as [x, [y, z]]:
-            pass
-     '''),
-    ('with_tuple_recursive',
-     '''
-        with a as ((x, y), z):
-            pass
-     '''),
-    ('with_tuple_target',
-     '''
-        with a as (x, y):
-            pass
-     '''),
-    ('with_list_target',
-     '''
-        with a as [x, y]:
-            pass
-     '''),
-    ('yield', 'yield'),
-    ('yield_expr', 'yield a'),
-    ('yield_from', 'yield from a'),
-]
-
-FAIL_TEST_CASES = [
-    ("annotation_multiple_targets", "(a, b): int = 42"),
-    ("annotation_nested_tuple", "((a, b)): int"),
-    ("annotation_list", "[a]: int"),
-    ("annotation_lambda", "lambda: int = 42"),
-    ("annotation_tuple", "(a,): int"),
-    ("annotation_tuple_without_paren", "a,: int"),
-    ("assignment_keyword", "a = if"),
-    ("augmented_assignment_list", "[a, b] += 1"),
-    ("augmented_assignment_tuple", "a, b += 1"),
-    ("augmented_assignment_tuple_paren", "(a, b) += (1, 2)"),
-    ("comprehension_lambda", "(a for a in lambda: b)"),
-    ("comprehension_else", "(a for a in b if c else d"),
-    ("del_call", "del a()"),
-    ("del_call_genexp", "del a(i for i in b)"),
-    ("del_subscript_call", "del a[b]()"),
-    ("del_attribute_call", "del a.b()"),
-    ("del_mixed_call", "del a[0].b().c.d()"),
-    ("for_star_targets_call", "for a() in b: pass"),
-    ("for_star_targets_subscript_call", "for a[b]() in c: pass"),
-    ("for_star_targets_attribute_call", "for a.b() in c: pass"),
-    ("for_star_targets_mixed_call", "for a[0].b().c.d() in e: pass"),
-    ("for_star_targets_in", "for a, in in b: pass"),
-    ("f-string_assignment", "f'{x = 42}'"),
-    ("f-string_empty", "f'{}'"),
-    ("f-string_function_def", "f'{def f(): pass}'"),
-    ("f-string_lambda", "f'{lambda x: 42}'"),
-    ("f-string_singe_brace", "f'{'"),
-    ("f-string_single_closing_brace", "f'}'"),
-    ("from_import_invalid", "from import import a"),
-    ("from_import_trailing_comma", "from a import b,"),
-    ("import_non_ascii_syntax_error", "import ä £"),
-    # This test case checks error paths involving tokens with uninitialized
-    # values of col_offset and end_col_offset.
-    ("invalid indentation",
-     """
-     def f():
-         a
-             a
-     """),
-    ("not_terminated_string", "a = 'example"),
-    ("try_except_attribute_target",
-     """
-     try:
-         pass
-     except Exception as a.b:
-         pass
-     """),
-    ("try_except_subscript_target",
-     """
-     try:
-         pass
-     except Exception as a[0]:
-         pass
-     """),
-]
-
-FAIL_SPECIALIZED_MESSAGE_CASES = [
-    ("f(x, y, z=1, **b, *a", "iterable argument unpacking follows keyword argument unpacking"),
-    ("f(x, y=1, *z, **a, b", "positional argument follows keyword argument unpacking"),
-    ("f(x, y, z=1, a=2, b", "positional argument follows keyword argument"),
-    ("True = 1", "cannot assign to True"),
-    ("a() = 1", "cannot assign to function call"),
-    ("(a, b): int", "only single target (not tuple) can be annotated"),
-    ("[a, b]: int", "only single target (not list) can be annotated"),
-    ("a(): int", "illegal target for annotation"),
-    ("1 += 1", "'literal' is an illegal expression for augmented assignment"),
-    ("pass\n    pass", "unexpected indent"),
-    ("def f():\npass", "expected an indented block"),
-    ("def f(*): pass", "named arguments must follow bare *"),
-    ("def f(*,): pass", "named arguments must follow bare *"),
-    ("def f(*, **a): pass", "named arguments must follow bare *"),
-    ("lambda *: pass", "named arguments must follow bare *"),
-    ("lambda *,: pass", "named arguments must follow bare *"),
-    ("lambda *, **a: pass", "named arguments must follow bare *"),
-    ("f(g()=2", "expression cannot contain assignment, perhaps you meant \"==\"?"),
-    ("f(a, b, *c, d.e=2", "expression cannot contain assignment, perhaps you meant \"==\"?"),
-    ("f(*a, **b, c=0, d[1]=3)", "expression cannot contain assignment, perhaps you meant \"==\"?"),
-]
-
-GOOD_BUT_FAIL_TEST_CASES = [
-    ('string_concatenation_format', 'f"{hello} world" f"again {and_again}"'),
-    ('string_concatenation_multiple',
-     '''
-        f"hello" f"{world} again" f"and_again"
-     '''),
-    ('f-string_multiline_comp',
-     """
-        f'''
-        {(i for i in a
-            if b)}
-        '''
-     """),
-]
-
-FSTRINGS_TRACEBACKS = {
-    'multiline_fstrings_same_line_with_brace': (
-        """
-            f'''
-            {a$b}
-            '''
-        """,
-        '(a$b)\n',
-    ),
-    'multiline_fstring_brace_on_next_line': (
-        """
-            f'''
-            {a$b
-            }'''
-        """,
-        '(a$b\n',
-    ),
-    'multiline_fstring_brace_on_previous_line': (
-        """
-            f'''
-            {
-            a$b}'''
-        """,
-        'a$b)\n',
-    ),
-}
-
-EXPRESSIONS_TEST_CASES = [
-    ("expression_add", "1+1"),
-    ("expression_add_2", "a+b"),
-    ("expression_call", "f(a, b=2, **kw)"),
-    ("expression_tuple", "1, 2, 3"),
-    ("expression_tuple_one_value", "1,")
-]
-
-
-def cleanup_source(source: Any) -> str:
-    if isinstance(source, str):
-        result = dedent(source)
-    elif not isinstance(source, (list, tuple)):
-        result = "\n".join(source)
-    else:
-        raise TypeError(f"Invalid type for test source: {source}")
-    return result
-
-
-def prepare_test_cases(
-    test_cases: Iterable[Tuple[str, Union[str, Iterable[str]]]]
-) -> Tuple[Iterable[str], Iterable[str]]:
-
-    test_ids, _test_sources = zip(*test_cases)
-    test_sources = list(_test_sources)
-    for index, source in enumerate(test_sources):
-        result = cleanup_source(source)
-        test_sources[index] = result
-    return test_ids, test_sources
-
-
-TEST_IDS, TEST_SOURCES = prepare_test_cases(TEST_CASES)
-
-GOOD_BUT_FAIL_TEST_IDS, GOOD_BUT_FAIL_SOURCES = prepare_test_cases(
-    GOOD_BUT_FAIL_TEST_CASES
-)
-
-FAIL_TEST_IDS, FAIL_SOURCES = prepare_test_cases(FAIL_TEST_CASES)
-
-EXPRESSIONS_TEST_IDS, EXPRESSIONS_TEST_SOURCES = prepare_test_cases(
-    EXPRESSIONS_TEST_CASES
-)
-
-
-class ASTGenerationTest(unittest.TestCase):
-    def test_correct_ast_generation_on_source_files(self) -> None:
-        self.maxDiff = None
-        for source in TEST_SOURCES:
-            actual_ast = peg_parser.parse_string(source)
-            expected_ast = peg_parser.parse_string(source, oldparser=True)
-            self.assertEqual(
-                ast.dump(actual_ast, include_attributes=True),
-                ast.dump(expected_ast, include_attributes=True),
-                f"Wrong AST generation for source: {source}",
-            )
-
-    def test_incorrect_ast_generation_on_source_files(self) -> None:
-        for source in FAIL_SOURCES:
-            with self.assertRaises(SyntaxError, msg=f"Parsing {source} did not raise an exception"):
-                peg_parser.parse_string(source)
-
-    def test_incorrect_ast_generation_with_specialized_errors(self) -> None:
-        for source, error_text in FAIL_SPECIALIZED_MESSAGE_CASES:
-            exc = IndentationError if "indent" in error_text else SyntaxError
-            with self.assertRaises(exc) as se:
-                peg_parser.parse_string(source)
-            self.assertTrue(
-                error_text in se.exception.msg,
-                f"Actual error message does not match expexted for {source}"
-            )
-
-    @unittest.expectedFailure
-    def test_correct_but_known_to_fail_ast_generation_on_source_files(self) -> None:
-        for source in GOOD_BUT_FAIL_SOURCES:
-            actual_ast = peg_parser.parse_string(source)
-            expected_ast = peg_parser.parse_string(source, oldparser=True)
-            self.assertEqual(
-                ast.dump(actual_ast, include_attributes=True),
-                ast.dump(expected_ast, include_attributes=True),
-                f"Wrong AST generation for source: {source}",
-            )
-
-    def test_correct_ast_generation_without_pos_info(self) -> None:
-        for source in GOOD_BUT_FAIL_SOURCES:
-            actual_ast = peg_parser.parse_string(source)
-            expected_ast = peg_parser.parse_string(source, oldparser=True)
-            self.assertEqual(
-                ast.dump(actual_ast),
-                ast.dump(expected_ast),
-                f"Wrong AST generation for source: {source}",
-            )
-
-    def test_fstring_parse_error_tracebacks(self) -> None:
-        for source, error_text in FSTRINGS_TRACEBACKS.values():
-            with self.assertRaises(SyntaxError) as se:
-                peg_parser.parse_string(dedent(source))
-            self.assertEqual(error_text, se.exception.text)
-
-    def test_correct_ast_generatrion_eval(self) -> None:
-        for source in EXPRESSIONS_TEST_SOURCES:
-            actual_ast = peg_parser.parse_string(source, mode='eval')
-            expected_ast = peg_parser.parse_string(source, mode='eval', oldparser=True)
-            self.assertEqual(
-                ast.dump(actual_ast, include_attributes=True),
-                ast.dump(expected_ast, include_attributes=True),
-                f"Wrong AST generation for source: {source}",
-            )
-
-    def test_tokenizer_errors_are_propagated(self) -> None:
-        n=201
-        with self.assertRaisesRegex(SyntaxError, "too many nested parentheses"):
-            peg_parser.parse_string(n*'(' + ')'*n)
diff --git a/Lib/test/test_pickle.py b/Lib/test/test_pickle.py
index 2307b13..8775ff4 100644
--- a/Lib/test/test_pickle.py
+++ b/Lib/test/test_pickle.py
@@ -6,10 +6,13 @@
 import collections
 import struct
 import sys
+import warnings
 import weakref
 
+import doctest
 import unittest
 from test import support
+from test.support import import_helper
 
 from test.pickletester import AbstractHookTests
 from test.pickletester import AbstractUnpickleTests
@@ -29,7 +32,7 @@
     has_c_implementation = False
 
 
-class PyPickleTests(AbstractPickleModuleTests):
+class PyPickleTests(AbstractPickleModuleTests, unittest.TestCase):
     dump = staticmethod(pickle._dump)
     dumps = staticmethod(pickle._dumps)
     load = staticmethod(pickle._load)
@@ -38,7 +41,7 @@
     Unpickler = pickle._Unpickler
 
 
-class PyUnpicklerTests(AbstractUnpickleTests):
+class PyUnpicklerTests(AbstractUnpickleTests, unittest.TestCase):
 
     unpickler = pickle._Unpickler
     bad_stack_errors = (IndexError,)
@@ -52,7 +55,7 @@
         return u.load()
 
 
-class PyPicklerTests(AbstractPickleTests):
+class PyPicklerTests(AbstractPickleTests, unittest.TestCase):
 
     pickler = pickle._Pickler
     unpickler = pickle._Unpickler
@@ -71,7 +74,7 @@
 
 
 class InMemoryPickleTests(AbstractPickleTests, AbstractUnpickleTests,
-                          BigmemPickleTests):
+                          BigmemPickleTests, unittest.TestCase):
 
     bad_stack_errors = (pickle.UnpicklingError, IndexError)
     truncated_errors = (pickle.UnpicklingError, EOFError,
@@ -108,14 +111,14 @@
 
 
 class PyPersPicklerTests(AbstractPersistentPicklerTests,
-                         PersistentPicklerUnpicklerMixin):
+                         PersistentPicklerUnpicklerMixin, unittest.TestCase):
 
     pickler = pickle._Pickler
     unpickler = pickle._Unpickler
 
 
 class PyIdPersPicklerTests(AbstractIdentityPersistentPicklerTests,
-                           PersistentPicklerUnpicklerMixin):
+                           PersistentPicklerUnpicklerMixin, unittest.TestCase):
 
     pickler = pickle._Pickler
     unpickler = pickle._Unpickler
@@ -181,13 +184,13 @@
         check(PersUnpickler)
 
 
-class PyPicklerUnpicklerObjectTests(AbstractPicklerUnpicklerObjectTests):
+class PyPicklerUnpicklerObjectTests(AbstractPicklerUnpicklerObjectTests, unittest.TestCase):
 
     pickler_class = pickle._Pickler
     unpickler_class = pickle._Unpickler
 
 
-class PyDispatchTableTests(AbstractDispatchTableTests):
+class PyDispatchTableTests(AbstractDispatchTableTests, unittest.TestCase):
 
     pickler_class = pickle._Pickler
 
@@ -195,7 +198,7 @@
         return pickle.dispatch_table.copy()
 
 
-class PyChainDispatchTableTests(AbstractDispatchTableTests):
+class PyChainDispatchTableTests(AbstractDispatchTableTests, unittest.TestCase):
 
     pickler_class = pickle._Pickler
 
@@ -203,7 +206,7 @@
         return collections.ChainMap({}, pickle.dispatch_table)
 
 
-class PyPicklerHookTests(AbstractHookTests):
+class PyPicklerHookTests(AbstractHookTests, unittest.TestCase):
     class CustomPyPicklerClass(pickle._Pickler,
                                AbstractCustomPicklerClass):
         pass
@@ -211,7 +214,7 @@
 
 
 if has_c_implementation:
-    class CPickleTests(AbstractPickleModuleTests):
+    class CPickleTests(AbstractPickleModuleTests, unittest.TestCase):
         from _pickle import dump, dumps, load, loads, Pickler, Unpickler
 
     class CUnpicklerTests(PyUnpicklerTests):
@@ -239,7 +242,7 @@
         pickler = pickle._Pickler
         unpickler = _pickle.Unpickler
 
-    class CPicklerUnpicklerObjectTests(AbstractPicklerUnpicklerObjectTests):
+    class CPicklerUnpicklerObjectTests(AbstractPicklerUnpicklerObjectTests, unittest.TestCase):
         pickler_class = _pickle.Pickler
         unpickler_class = _pickle.Unpickler
 
@@ -252,17 +255,17 @@
                 unpickler.memo = {-1: None}
             unpickler.memo = {1: None}
 
-    class CDispatchTableTests(AbstractDispatchTableTests):
+    class CDispatchTableTests(AbstractDispatchTableTests, unittest.TestCase):
         pickler_class = pickle.Pickler
         def get_dispatch_table(self):
             return pickle.dispatch_table.copy()
 
-    class CChainDispatchTableTests(AbstractDispatchTableTests):
+    class CChainDispatchTableTests(AbstractDispatchTableTests, unittest.TestCase):
         pickler_class = pickle.Pickler
         def get_dispatch_table(self):
             return collections.ChainMap({}, pickle.dispatch_table)
 
-    class CPicklerHookTests(AbstractHookTests):
+    class CPicklerHookTests(AbstractHookTests, unittest.TestCase):
         class CustomCPicklerClass(_pickle.Pickler, AbstractCustomPicklerClass):
             pass
         pickler_class = CustomCPicklerClass
@@ -366,7 +369,10 @@
         return sys.modules[module]
     except KeyError:
         try:
-            __import__(module)
+            with warnings.catch_warnings():
+                action = 'always' if support.verbose else 'ignore'
+                warnings.simplefilter(action, DeprecationWarning)
+                __import__(module)
         except AttributeError as exc:
             if support.verbose:
                 print("Can't import module %r: %s" % (module, exc))
@@ -482,7 +488,8 @@
                 if exc in (BlockingIOError,
                            ResourceWarning,
                            StopAsyncIteration,
-                           RecursionError):
+                           RecursionError,
+                           EncodingWarning):
                     continue
                 if exc is not OSError and issubclass(exc, OSError):
                     self.assertEqual(reverse_mapping('builtins', name),
@@ -499,7 +506,7 @@
                                      ('builtins', name))
 
     def test_multiprocessing_exceptions(self):
-        module = support.import_module('multiprocessing.context')
+        module = import_helper.import_module('multiprocessing.context')
         for name, exc in get_exceptions(module):
             with self.subTest(name):
                 self.assertEqual(reverse_mapping('multiprocessing.context', name),
@@ -508,22 +515,10 @@
                                  ('multiprocessing.context', name))
 
 
-def test_main():
-    tests = [PyPickleTests, PyUnpicklerTests, PyPicklerTests,
-             PyPersPicklerTests, PyIdPersPicklerTests,
-             PyDispatchTableTests, PyChainDispatchTableTests,
-             CompatPickleTests, PyPicklerHookTests]
-    if has_c_implementation:
-        tests.extend([CPickleTests, CUnpicklerTests, CPicklerTests,
-                      CPersPicklerTests, CIdPersPicklerTests,
-                      CDumpPickle_LoadPickle, DumpPickle_CLoadPickle,
-                      PyPicklerUnpicklerObjectTests,
-                      CPicklerUnpicklerObjectTests,
-                      CDispatchTableTests, CChainDispatchTableTests,
-                      CPicklerHookTests,
-                      InMemoryPickleTests, SizeofTests])
-    support.run_unittest(*tests)
-    support.run_doctest(pickle)
+def load_tests(loader, tests, pattern):
+    tests.addTest(doctest.DocTestSuite())
+    return tests
+
 
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_picklebuffer.py b/Lib/test/test_picklebuffer.py
index 97981c8..435b3e0 100644
--- a/Lib/test/test_picklebuffer.py
+++ b/Lib/test/test_picklebuffer.py
@@ -8,7 +8,7 @@
 import weakref
 import unittest
 
-from test import support
+from test.support import import_helper
 
 
 class B(bytes):
@@ -75,7 +75,7 @@
 
     def test_ndarray_2d(self):
         # C-contiguous
-        ndarray = support.import_module("_testbuffer").ndarray
+        ndarray = import_helper.import_module("_testbuffer").ndarray
         arr = ndarray(list(range(12)), shape=(4, 3), format='<i')
         self.assertTrue(arr.c_contiguous)
         self.assertFalse(arr.f_contiguous)
@@ -109,7 +109,7 @@
 
     def test_raw_ndarray(self):
         # 1-D, contiguous
-        ndarray = support.import_module("_testbuffer").ndarray
+        ndarray = import_helper.import_module("_testbuffer").ndarray
         arr = ndarray(list(range(3)), shape=(3,), format='<h')
         equiv = b"\x00\x00\x01\x00\x02\x00"
         self.check_raw(arr, equiv)
@@ -135,7 +135,7 @@
 
     def test_raw_non_contiguous(self):
         # 1-D
-        ndarray = support.import_module("_testbuffer").ndarray
+        ndarray = import_helper.import_module("_testbuffer").ndarray
         arr = ndarray(list(range(6)), shape=(6,), format='<i')[::2]
         self.check_raw_non_contiguous(arr)
         # 2-D
diff --git a/Lib/test/test_pickletools.py b/Lib/test/test_pickletools.py
index 8cc6ca5..d37af79 100644
--- a/Lib/test/test_pickletools.py
+++ b/Lib/test/test_pickletools.py
@@ -2,9 +2,10 @@
 import pickletools
 from test import support
 from test.pickletester import AbstractPickleTests
+import doctest
 import unittest
 
-class OptimizedPickleTests(AbstractPickleTests):
+class OptimizedPickleTests(AbstractPickleTests, unittest.TestCase):
 
     def dumps(self, arg, proto=None, **kwargs):
         return pickletools.optimize(pickle.dumps(arg, proto, **kwargs))
@@ -63,41 +64,41 @@
 
 class MiscTestCase(unittest.TestCase):
     def test__all__(self):
-        blacklist = {'bytes_types',
-                     'UP_TO_NEWLINE', 'TAKEN_FROM_ARGUMENT1',
-                     'TAKEN_FROM_ARGUMENT4', 'TAKEN_FROM_ARGUMENT4U',
-                     'TAKEN_FROM_ARGUMENT8U', 'ArgumentDescriptor',
-                     'read_uint1', 'read_uint2', 'read_int4', 'read_uint4',
-                     'read_uint8', 'read_stringnl', 'read_stringnl_noescape',
-                     'read_stringnl_noescape_pair', 'read_string1',
-                     'read_string4', 'read_bytes1', 'read_bytes4',
-                     'read_bytes8', 'read_bytearray8', 'read_unicodestringnl',
-                     'read_unicodestring1', 'read_unicodestring4',
-                     'read_unicodestring8', 'read_decimalnl_short',
-                     'read_decimalnl_long', 'read_floatnl', 'read_float8',
-                     'read_long1', 'read_long4',
-                     'uint1', 'uint2', 'int4', 'uint4', 'uint8', 'stringnl',
-                     'stringnl_noescape', 'stringnl_noescape_pair', 'string1',
-                     'string4', 'bytes1', 'bytes4', 'bytes8', 'bytearray8',
-                     'unicodestringnl', 'unicodestring1', 'unicodestring4',
-                     'unicodestring8', 'decimalnl_short', 'decimalnl_long',
-                     'floatnl', 'float8', 'long1', 'long4',
-                     'StackObject',
-                     'pyint', 'pylong', 'pyinteger_or_bool', 'pybool', 'pyfloat',
-                     'pybytes_or_str', 'pystring', 'pybytes', 'pybytearray',
-                     'pyunicode', 'pynone', 'pytuple', 'pylist', 'pydict',
-                     'pyset', 'pyfrozenset', 'pybuffer', 'anyobject',
-                     'markobject', 'stackslice', 'OpcodeInfo', 'opcodes',
-                     'code2op',
-                     }
-        support.check__all__(self, pickletools, blacklist=blacklist)
+        not_exported = {
+            'bytes_types',
+            'UP_TO_NEWLINE', 'TAKEN_FROM_ARGUMENT1',
+            'TAKEN_FROM_ARGUMENT4', 'TAKEN_FROM_ARGUMENT4U',
+            'TAKEN_FROM_ARGUMENT8U', 'ArgumentDescriptor',
+            'read_uint1', 'read_uint2', 'read_int4', 'read_uint4',
+            'read_uint8', 'read_stringnl', 'read_stringnl_noescape',
+            'read_stringnl_noescape_pair', 'read_string1',
+            'read_string4', 'read_bytes1', 'read_bytes4',
+            'read_bytes8', 'read_bytearray8', 'read_unicodestringnl',
+            'read_unicodestring1', 'read_unicodestring4',
+            'read_unicodestring8', 'read_decimalnl_short',
+            'read_decimalnl_long', 'read_floatnl', 'read_float8',
+            'read_long1', 'read_long4',
+            'uint1', 'uint2', 'int4', 'uint4', 'uint8', 'stringnl',
+            'stringnl_noescape', 'stringnl_noescape_pair', 'string1',
+            'string4', 'bytes1', 'bytes4', 'bytes8', 'bytearray8',
+            'unicodestringnl', 'unicodestring1', 'unicodestring4',
+            'unicodestring8', 'decimalnl_short', 'decimalnl_long',
+            'floatnl', 'float8', 'long1', 'long4',
+            'StackObject',
+            'pyint', 'pylong', 'pyinteger_or_bool', 'pybool', 'pyfloat',
+            'pybytes_or_str', 'pystring', 'pybytes', 'pybytearray',
+            'pyunicode', 'pynone', 'pytuple', 'pylist', 'pydict',
+            'pyset', 'pyfrozenset', 'pybuffer', 'anyobject',
+            'markobject', 'stackslice', 'OpcodeInfo', 'opcodes',
+            'code2op',
+        }
+        support.check__all__(self, pickletools, not_exported=not_exported)
 
 
-def test_main():
-    support.run_unittest(OptimizedPickleTests)
-    support.run_unittest(MiscTestCase)
-    support.run_doctest(pickletools)
+def load_tests(loader, tests, pattern):
+    tests.addTest(doctest.DocTestSuite(pickletools))
+    return tests
 
 
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_pipes.py b/Lib/test/test_pipes.py
index 1d538b9..6335e7c 100644
--- a/Lib/test/test_pipes.py
+++ b/Lib/test/test_pipes.py
@@ -3,11 +3,16 @@
 import string
 import unittest
 import shutil
-from test.support import TESTFN, run_unittest, unlink, reap_children
+from test.support import reap_children, unix_shell
+from test.support.os_helper import TESTFN, unlink
+
 
 if os.name != 'posix':
     raise unittest.SkipTest('pipes module only works on posix')
 
+if not (unix_shell and os.path.exists(unix_shell)):
+    raise unittest.SkipTest('pipes module requires a shell')
+
 TESTFN2 = TESTFN + "2"
 
 # tr a-z A-Z is not portable, so make the ranges explicit
@@ -194,9 +199,10 @@
         self.assertNotEqual(id(t.steps), id(u.steps))
         self.assertEqual(t.debugging, u.debugging)
 
-def test_main():
-    run_unittest(SimplePipeTests)
+
+def tearDownModule():
     reap_children()
 
+
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_pkgutil.py b/Lib/test/test_pkgutil.py
index b162f99..800fe38 100644
--- a/Lib/test/test_pkgutil.py
+++ b/Lib/test/test_pkgutil.py
@@ -1,4 +1,5 @@
-from test.support import run_unittest, unload, check_warnings, CleanImport
+from test.support.import_helper import unload, CleanImport
+from test.support.warnings_helper import check_warnings
 import unittest
 import sys
 import importlib
@@ -496,7 +497,8 @@
 
     def check_deprecated(self):
         return check_warnings(
-            ("This emulation is deprecated, use 'importlib' instead",
+            ("This emulation is deprecated and slated for removal in "
+             "Python 3.12; use 'importlib' instead",
              DeprecationWarning))
 
     def test_importer_deprecated(self):
@@ -577,9 +579,7 @@
             self.assertEqual(len(w.warnings), 0)
 
 
-def test_main():
-    run_unittest(PkgutilTests, PkgutilPEP302Tests, ExtendPathTests,
-                 NestedNamespacePackageTest, ImportlibMigrationTests)
+def tearDownModule():
     # this is necessary if test is run repeated (like when finding leaks)
     import zipimport
     import importlib
@@ -588,4 +588,4 @@
 
 
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_platform.py b/Lib/test/test_platform.py
index a3b06fe..1a68877 100644
--- a/Lib/test/test_platform.py
+++ b/Lib/test/test_platform.py
@@ -1,4 +1,6 @@
 import os
+import copy
+import pickle
 import platform
 import subprocess
 import sys
@@ -6,6 +8,64 @@
 from unittest import mock
 
 from test import support
+from test.support import os_helper
+
+FEDORA_OS_RELEASE = """\
+NAME=Fedora
+VERSION="32 (Thirty Two)"
+ID=fedora
+VERSION_ID=32
+VERSION_CODENAME=""
+PLATFORM_ID="platform:f32"
+PRETTY_NAME="Fedora 32 (Thirty Two)"
+ANSI_COLOR="0;34"
+LOGO=fedora-logo-icon
+CPE_NAME="cpe:/o:fedoraproject:fedora:32"
+HOME_URL="https://fedoraproject.org/"
+DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f32/system-administrators-guide/"
+SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help"
+BUG_REPORT_URL="https://bugzilla.redhat.com/"
+REDHAT_BUGZILLA_PRODUCT="Fedora"
+REDHAT_BUGZILLA_PRODUCT_VERSION=32
+REDHAT_SUPPORT_PRODUCT="Fedora"
+REDHAT_SUPPORT_PRODUCT_VERSION=32
+PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
+"""
+
+UBUNTU_OS_RELEASE = """\
+NAME="Ubuntu"
+VERSION="20.04.1 LTS (Focal Fossa)"
+ID=ubuntu
+ID_LIKE=debian
+PRETTY_NAME="Ubuntu 20.04.1 LTS"
+VERSION_ID="20.04"
+HOME_URL="https://www.ubuntu.com/"
+SUPPORT_URL="https://help.ubuntu.com/"
+BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
+PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
+VERSION_CODENAME=focal
+UBUNTU_CODENAME=focal
+"""
+
+TEST_OS_RELEASE = r"""
+# test data
+ID_LIKE="egg spam viking"
+EMPTY=
+# comments and empty lines are ignored
+
+SINGLE_QUOTE='single'
+EMPTY_SINGLE=''
+DOUBLE_QUOTE="double"
+EMPTY_DOUBLE=""
+QUOTES="double\'s"
+SPECIALS="\$\`\\\'\""
+# invalid lines
+=invalid
+=
+INVALID
+IN-VALID=value
+IN VALID=value
+"""
 
 
 class PlatformTest(unittest.TestCase):
@@ -13,11 +73,12 @@
         platform._platform_cache.clear()
         platform._sys_version_cache.clear()
         platform._uname_cache = None
+        platform._os_release_cache = None
 
     def test_architecture(self):
         res = platform.architecture()
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_architecture_via_symlink(self): # issue3762
         with support.PythonSymlink() as py:
             cmd = "-c", "import platform; print(platform.architecture())"
@@ -175,6 +236,38 @@
         )
         self.assertEqual(tuple(res), expected)
 
+    def test_uname_replace(self):
+        res = platform.uname()
+        new = res._replace(
+            system='system', node='node', release='release',
+            version='version', machine='machine')
+        self.assertEqual(new.system, 'system')
+        self.assertEqual(new.node, 'node')
+        self.assertEqual(new.release, 'release')
+        self.assertEqual(new.version, 'version')
+        self.assertEqual(new.machine, 'machine')
+        # processor cannot be replaced
+        self.assertEqual(new.processor, res.processor)
+
+    def test_uname_copy(self):
+        uname = platform.uname()
+        self.assertEqual(copy.copy(uname), uname)
+        self.assertEqual(copy.deepcopy(uname), uname)
+
+    def test_uname_pickle(self):
+        orig = platform.uname()
+        for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+            with self.subTest(protocol=proto):
+                pickled = pickle.dumps(orig, proto)
+                restored = pickle.loads(pickled)
+                self.assertEqual(restored, orig)
+
+    def test_uname_slices(self):
+        res = platform.uname()
+        expected = tuple(res)
+        self.assertEqual(res[:], expected)
+        self.assertEqual(res[:5], expected[:5])
+
     @unittest.skipIf(sys.platform in ['win32', 'OpenVMS'], "uname -p not used")
     def test_uname_processor(self):
         """
@@ -195,7 +288,7 @@
         # using it, per
         # http://blogs.msdn.com/david.wang/archive/2006/03/26/HOWTO-Detect-Process-Bitness.aspx
         try:
-            with support.EnvironmentVarGuard() as environ:
+            with os_helper.EnvironmentVarGuard() as environ:
                 if 'PROCESSOR_ARCHITEW6432' in environ:
                     del environ['PROCESSOR_ARCHITEW6432']
                 environ['PROCESSOR_ARCHITECTURE'] = 'foo'
@@ -284,8 +377,8 @@
             executable = sys.executable
         platform.libc_ver(executable)
 
-        filename = support.TESTFN
-        self.addCleanup(support.unlink, filename)
+        filename = os_helper.TESTFN
+        self.addCleanup(os_helper.unlink, filename)
 
         with mock.patch('os.confstr', create=True, return_value='mock 1.0'):
             # test os.confstr() code path
@@ -381,6 +474,54 @@
                     self.assertEqual(platform.platform(terse=1), expected_terse)
                     self.assertEqual(platform.platform(), expected)
 
+    def test_freedesktop_os_release(self):
+        self.addCleanup(self.clear_caches)
+        self.clear_caches()
+
+        if any(os.path.isfile(fn) for fn in platform._os_release_candidates):
+            info = platform.freedesktop_os_release()
+            self.assertIn("NAME", info)
+            self.assertIn("ID", info)
+
+            info["CPYTHON_TEST"] = "test"
+            self.assertNotIn(
+                "CPYTHON_TEST",
+                platform.freedesktop_os_release()
+            )
+        else:
+            with self.assertRaises(OSError):
+                platform.freedesktop_os_release()
+
+    def test_parse_os_release(self):
+        info = platform._parse_os_release(FEDORA_OS_RELEASE.splitlines())
+        self.assertEqual(info["NAME"], "Fedora")
+        self.assertEqual(info["ID"], "fedora")
+        self.assertNotIn("ID_LIKE", info)
+        self.assertEqual(info["VERSION_CODENAME"], "")
+
+        info = platform._parse_os_release(UBUNTU_OS_RELEASE.splitlines())
+        self.assertEqual(info["NAME"], "Ubuntu")
+        self.assertEqual(info["ID"], "ubuntu")
+        self.assertEqual(info["ID_LIKE"], "debian")
+        self.assertEqual(info["VERSION_CODENAME"], "focal")
+
+        info = platform._parse_os_release(TEST_OS_RELEASE.splitlines())
+        expected = {
+            "ID": "linux",
+            "NAME": "Linux",
+            "PRETTY_NAME": "Linux",
+            "ID_LIKE": "egg spam viking",
+            "EMPTY": "",
+            "DOUBLE_QUOTE": "double",
+            "EMPTY_DOUBLE": "",
+            "SINGLE_QUOTE": "single",
+            "EMPTY_SINGLE": "",
+            "QUOTES": "double's",
+            "SPECIALS": "$`\\'\"",
+        }
+        self.assertEqual(info, expected)
+        self.assertEqual(len(info["SPECIALS"]), 5)
+
 
 if __name__ == '__main__':
     unittest.main()
diff --git a/Lib/test/test_plistlib.py b/Lib/test/test_plistlib.py
index 9e53305..ef96c6c 100644
--- a/Lib/test/test_plistlib.py
+++ b/Lib/test/test_plistlib.py
@@ -11,6 +11,7 @@
 import binascii
 import collections
 from test import support
+from test.support import os_helper
 from io import BytesIO
 
 from plistlib import UID
@@ -403,7 +404,7 @@
 
     def tearDown(self):
         try:
-            os.unlink(support.TESTFN)
+            os.unlink(os_helper.TESTFN)
         except:
             pass
 
@@ -441,10 +442,10 @@
 
     def test_io(self):
         pl = self._create()
-        with open(support.TESTFN, 'wb') as fp:
+        with open(os_helper.TESTFN, 'wb') as fp:
             plistlib.dump(pl, fp)
 
-        with open(support.TESTFN, 'rb') as fp:
+        with open(os_helper.TESTFN, 'rb') as fp:
             pl2 = plistlib.load(fp)
 
         self.assertEqual(dict(pl), dict(pl2))
@@ -993,8 +994,8 @@
 
 class MiscTestCase(unittest.TestCase):
     def test__all__(self):
-        blacklist = {"PlistFormat", "PLISTHEADER"}
-        support.check__all__(self, plistlib, blacklist=blacklist)
+        not_exported = {"PlistFormat", "PLISTHEADER"}
+        support.check__all__(self, plistlib, not_exported=not_exported)
 
 
 if __name__ == '__main__':
diff --git a/Lib/test/test_poll.py b/Lib/test/test_poll.py
index ef966bf..82bbb3a 100644
--- a/Lib/test/test_poll.py
+++ b/Lib/test/test_poll.py
@@ -7,7 +7,10 @@
 import threading
 import time
 import unittest
-from test.support import TESTFN, run_unittest, reap_threads, cpython_only
+from test.support import cpython_only
+from test.support import threading_helper
+from test.support.os_helper import TESTFN
+
 
 try:
     select.poll
@@ -175,7 +178,7 @@
         self.assertRaises(OverflowError, pollster.poll, INT_MAX + 1)
         self.assertRaises(OverflowError, pollster.poll, UINT_MAX + 1)
 
-    @reap_threads
+    @threading_helper.reap_threads
     def test_threaded_poll(self):
         r, w = os.pipe()
         self.addCleanup(os.close, r)
@@ -204,7 +207,7 @@
             t.join()
 
     @unittest.skipUnless(threading, 'Threading required for this test.')
-    @reap_threads
+    @threading_helper.reap_threads
     def test_poll_blocks_with_negative_ms(self):
         for timeout_ms in [None, -1000, -1, -1.0, -0.1, -1e-100]:
             # Create two file descriptors. This will be used to unlock
@@ -226,8 +229,5 @@
             os.close(w)
 
 
-def test_main():
-    run_unittest(PollTests)
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_popen.py b/Lib/test/test_popen.py
index ab1bc77..cac2f61 100644
--- a/Lib/test/test_popen.py
+++ b/Lib/test/test_popen.py
@@ -7,6 +7,9 @@
 from test import support
 import os, sys
 
+if not hasattr(os, 'popen'):
+    raise unittest.SkipTest("need os.popen()")
+
 # Test that command-lines get down as we expect.
 # To do this we execute:
 #    python -c "import sys;print(sys.argv)" {rest_of_commandline}
diff --git a/Lib/test/test_poplib.py b/Lib/test/test_poplib.py
index b670afc..1220ca3 100644
--- a/Lib/test/test_poplib.py
+++ b/Lib/test/test_poplib.py
@@ -4,17 +4,23 @@
 # a real test suite
 
 import poplib
-import asyncore
-import asynchat
 import socket
 import os
 import errno
 import threading
 
+import unittest
 from unittest import TestCase, skipUnless
 from test import support as test_support
 from test.support import hashlib_helper
 from test.support import socket_helper
+from test.support import threading_helper
+
+import warnings
+with warnings.catch_warnings():
+    warnings.simplefilter('ignore', DeprecationWarning)
+    import asynchat
+    import asyncore
 
 HOST = socket_helper.HOST
 PORT = 0
@@ -154,7 +160,7 @@
         def cmd_stls(self, arg):
             if self.tls_active is False:
                 self.push('+OK Begin TLS negotiation')
-                context = ssl.SSLContext()
+                context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
                 context.load_cert_chain(CERTFILE)
                 tls_sock = context.wrap_socket(self.socket,
                                                server_side=True,
@@ -312,11 +318,11 @@
     def test_rpop(self):
         self.assertOK(self.client.rpop('foo'))
 
-    @hashlib_helper.requires_hashdigest('md5')
+    @hashlib_helper.requires_hashdigest('md5', openssl=True)
     def test_apop_normal(self):
         self.assertOK(self.client.apop('foo', 'dummypassword'))
 
-    @hashlib_helper.requires_hashdigest('md5')
+    @hashlib_helper.requires_hashdigest('md5', openssl=True)
     def test_apop_REDOS(self):
         # Replace welcome with very long evil welcome.
         # NB The upper bound on welcome length is currently 2048.
@@ -500,7 +506,7 @@
             conn, addr = serv.accept()
             conn.send(b"+ Hola mundo\n")
             conn.close()
-        except socket.timeout:
+        except TimeoutError:
             pass
         finally:
             serv.close()
@@ -533,15 +539,10 @@
             poplib.POP3(HOST, self.port, timeout=0)
 
 
-def test_main():
-    tests = [TestPOP3Class, TestTimeouts,
-             TestPOP3_SSLClass, TestPOP3_TLSClass]
-    thread_info = test_support.threading_setup()
-    try:
-        test_support.run_unittest(*tests)
-    finally:
-        test_support.threading_cleanup(*thread_info)
+def setUpModule():
+    thread_info = threading_helper.threading_setup()
+    unittest.addModuleCleanup(threading_helper.threading_cleanup, *thread_info)
 
 
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index bfbcbab..974edd7 100644
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -1,10 +1,13 @@
 "Test posix functions"
 
 from test import support
+from test.support import import_helper
+from test.support import os_helper
+from test.support import warnings_helper
 from test.support.script_helper import assert_python_ok
 
 # Skip these tests if there is no posix module.
-posix = support.import_module('posix')
+posix = import_helper.import_module('posix')
 
 import errno
 import sys
@@ -18,9 +21,10 @@
 import unittest
 import warnings
 import textwrap
+from contextlib import contextmanager
 
 _DUMMY_SYMLINK = os.path.join(tempfile.gettempdir(),
-                              support.TESTFN + '-dummy-symlink')
+                              os_helper.TESTFN + '-dummy-symlink')
 
 requires_32b = unittest.skipUnless(sys.maxsize < 2**32,
         'test is only meaningful on 32-bit builds')
@@ -42,17 +46,17 @@
 
     def setUp(self):
         # create empty file
-        fp = open(support.TESTFN, 'w+')
-        fp.close()
-        self.teardown_files = [ support.TESTFN ]
-        self._warnings_manager = support.check_warnings()
+        with open(os_helper.TESTFN, "wb"):
+            pass
+        self.teardown_files = [ os_helper.TESTFN ]
+        self._warnings_manager = warnings_helper.check_warnings()
         self._warnings_manager.__enter__()
         warnings.filterwarnings('ignore', '.* potential security risk .*',
                                 RuntimeWarning)
 
     def tearDown(self):
         for teardown_file in self.teardown_files:
-            support.unlink(teardown_file)
+            os_helper.unlink(teardown_file)
         self._warnings_manager.__exit__(None, None, None)
 
     def testNoArgFunctions(self):
@@ -153,7 +157,7 @@
     @unittest.skipUnless(hasattr(posix, 'fstatvfs'),
                          'test needs posix.fstatvfs()')
     def test_fstatvfs(self):
-        fp = open(support.TESTFN)
+        fp = open(os_helper.TESTFN)
         try:
             self.assertTrue(posix.fstatvfs(fp.fileno()))
             self.assertTrue(posix.statvfs(fp.fileno()))
@@ -163,7 +167,7 @@
     @unittest.skipUnless(hasattr(posix, 'ftruncate'),
                          'test needs posix.ftruncate()')
     def test_ftruncate(self):
-        fp = open(support.TESTFN, 'w+')
+        fp = open(os_helper.TESTFN, 'w+')
         try:
             # we need to have some data to truncate
             fp.write('test')
@@ -174,10 +178,10 @@
 
     @unittest.skipUnless(hasattr(posix, 'truncate'), "test needs posix.truncate()")
     def test_truncate(self):
-        with open(support.TESTFN, 'w') as fp:
+        with open(os_helper.TESTFN, 'w') as fp:
             fp.write('test')
             fp.flush()
-        posix.truncate(support.TESTFN, 0)
+        posix.truncate(os_helper.TESTFN, 0)
 
     @unittest.skipUnless(getattr(os, 'execve', None) in os.supports_fd, "test needs execve() to support the fd parameter")
     @unittest.skipUnless(hasattr(os, 'fork'), "test needs os.fork()")
@@ -268,7 +272,7 @@
 
     @unittest.skipUnless(hasattr(posix, 'lockf'), "test needs posix.lockf()")
     def test_lockf(self):
-        fd = os.open(support.TESTFN, os.O_WRONLY | os.O_CREAT)
+        fd = os.open(os_helper.TESTFN, os.O_WRONLY | os.O_CREAT)
         try:
             os.write(fd, b'test')
             os.lseek(fd, 0, os.SEEK_SET)
@@ -280,7 +284,7 @@
 
     @unittest.skipUnless(hasattr(posix, 'pread'), "test needs posix.pread()")
     def test_pread(self):
-        fd = os.open(support.TESTFN, os.O_RDWR | os.O_CREAT)
+        fd = os.open(os_helper.TESTFN, os.O_RDWR | os.O_CREAT)
         try:
             os.write(fd, b'test')
             os.lseek(fd, 0, os.SEEK_SET)
@@ -292,7 +296,7 @@
 
     @unittest.skipUnless(hasattr(posix, 'preadv'), "test needs posix.preadv()")
     def test_preadv(self):
-        fd = os.open(support.TESTFN, os.O_RDWR | os.O_CREAT)
+        fd = os.open(os_helper.TESTFN, os.O_RDWR | os.O_CREAT)
         try:
             os.write(fd, b'test1tt2t3t5t6t6t8')
             buf = [bytearray(i) for i in [5, 3, 2]]
@@ -304,7 +308,7 @@
     @unittest.skipUnless(hasattr(posix, 'preadv'), "test needs posix.preadv()")
     @unittest.skipUnless(hasattr(posix, 'RWF_HIPRI'), "test needs posix.RWF_HIPRI")
     def test_preadv_flags(self):
-        fd = os.open(support.TESTFN, os.O_RDWR | os.O_CREAT)
+        fd = os.open(os_helper.TESTFN, os.O_RDWR | os.O_CREAT)
         try:
             os.write(fd, b'test1tt2t3t5t6t6t8')
             buf = [bytearray(i) for i in [5, 3, 2]]
@@ -326,7 +330,7 @@
     @unittest.skipUnless(hasattr(posix, 'preadv'), "test needs posix.preadv()")
     @requires_32b
     def test_preadv_overflow_32bits(self):
-        fd = os.open(support.TESTFN, os.O_RDWR | os.O_CREAT)
+        fd = os.open(os_helper.TESTFN, os.O_RDWR | os.O_CREAT)
         try:
             buf = [bytearray(2**16)] * 2**15
             with self.assertRaises(OSError) as cm:
@@ -338,7 +342,7 @@
 
     @unittest.skipUnless(hasattr(posix, 'pwrite'), "test needs posix.pwrite()")
     def test_pwrite(self):
-        fd = os.open(support.TESTFN, os.O_RDWR | os.O_CREAT)
+        fd = os.open(os_helper.TESTFN, os.O_RDWR | os.O_CREAT)
         try:
             os.write(fd, b'test')
             os.lseek(fd, 0, os.SEEK_SET)
@@ -349,7 +353,7 @@
 
     @unittest.skipUnless(hasattr(posix, 'pwritev'), "test needs posix.pwritev()")
     def test_pwritev(self):
-        fd = os.open(support.TESTFN, os.O_RDWR | os.O_CREAT)
+        fd = os.open(os_helper.TESTFN, os.O_RDWR | os.O_CREAT)
         try:
             os.write(fd, b"xx")
             os.lseek(fd, 0, os.SEEK_SET)
@@ -364,7 +368,7 @@
     @unittest.skipUnless(hasattr(posix, 'pwritev'), "test needs posix.pwritev()")
     @unittest.skipUnless(hasattr(posix, 'os.RWF_SYNC'), "test needs os.RWF_SYNC")
     def test_pwritev_flags(self):
-        fd = os.open(support.TESTFN, os.O_RDWR | os.O_CREAT)
+        fd = os.open(os_helper.TESTFN, os.O_RDWR | os.O_CREAT)
         try:
             os.write(fd,b"xx")
             os.lseek(fd, 0, os.SEEK_SET)
@@ -379,7 +383,7 @@
     @unittest.skipUnless(hasattr(posix, 'pwritev'), "test needs posix.pwritev()")
     @requires_32b
     def test_pwritev_overflow_32bits(self):
-        fd = os.open(support.TESTFN, os.O_RDWR | os.O_CREAT)
+        fd = os.open(os_helper.TESTFN, os.O_RDWR | os.O_CREAT)
         try:
             with self.assertRaises(OSError) as cm:
                 os.pwritev(fd, [b"x" * 2**16] * 2**15, 0)
@@ -390,7 +394,7 @@
     @unittest.skipUnless(hasattr(posix, 'posix_fallocate'),
         "test needs posix.posix_fallocate()")
     def test_posix_fallocate(self):
-        fd = os.open(support.TESTFN, os.O_WRONLY | os.O_CREAT)
+        fd = os.open(os_helper.TESTFN, os.O_WRONLY | os.O_CREAT)
         try:
             posix.posix_fallocate(fd, 0, 10)
         except OSError as inst:
@@ -419,7 +423,7 @@
     @unittest.skipUnless(hasattr(posix, 'posix_fadvise'),
         "test needs posix.posix_fadvise()")
     def test_posix_fadvise(self):
-        fd = os.open(support.TESTFN, os.O_RDONLY)
+        fd = os.open(os_helper.TESTFN, os.O_RDONLY)
         try:
             posix.posix_fadvise(fd, 0, 0, posix.POSIX_FADV_WILLNEED)
         finally:
@@ -437,7 +441,7 @@
     @unittest.skipUnless(os.utime in os.supports_fd, "test needs fd support in os.utime")
     def test_utime_with_fd(self):
         now = time.time()
-        fd = os.open(support.TESTFN, os.O_RDONLY)
+        fd = os.open(os_helper.TESTFN, os.O_RDONLY)
         try:
             posix.utime(fd)
             posix.utime(fd, None)
@@ -458,17 +462,21 @@
     @unittest.skipUnless(os.utime in os.supports_follow_symlinks, "test needs follow_symlinks support in os.utime")
     def test_utime_nofollow_symlinks(self):
         now = time.time()
-        posix.utime(support.TESTFN, None, follow_symlinks=False)
-        self.assertRaises(TypeError, posix.utime, support.TESTFN, (None, None), follow_symlinks=False)
-        self.assertRaises(TypeError, posix.utime, support.TESTFN, (now, None), follow_symlinks=False)
-        self.assertRaises(TypeError, posix.utime, support.TESTFN, (None, now), follow_symlinks=False)
-        posix.utime(support.TESTFN, (int(now), int(now)), follow_symlinks=False)
-        posix.utime(support.TESTFN, (now, now), follow_symlinks=False)
-        posix.utime(support.TESTFN, follow_symlinks=False)
+        posix.utime(os_helper.TESTFN, None, follow_symlinks=False)
+        self.assertRaises(TypeError, posix.utime, os_helper.TESTFN,
+                          (None, None), follow_symlinks=False)
+        self.assertRaises(TypeError, posix.utime, os_helper.TESTFN,
+                          (now, None), follow_symlinks=False)
+        self.assertRaises(TypeError, posix.utime, os_helper.TESTFN,
+                          (None, now), follow_symlinks=False)
+        posix.utime(os_helper.TESTFN, (int(now), int(now)),
+                    follow_symlinks=False)
+        posix.utime(os_helper.TESTFN, (now, now), follow_symlinks=False)
+        posix.utime(os_helper.TESTFN, follow_symlinks=False)
 
     @unittest.skipUnless(hasattr(posix, 'writev'), "test needs posix.writev()")
     def test_writev(self):
-        fd = os.open(support.TESTFN, os.O_RDWR | os.O_CREAT)
+        fd = os.open(os_helper.TESTFN, os.O_RDWR | os.O_CREAT)
         try:
             n = os.writev(fd, (b'test1', b'tt2', b't3'))
             self.assertEqual(n, 10)
@@ -491,7 +499,7 @@
     @unittest.skipUnless(hasattr(posix, 'writev'), "test needs posix.writev()")
     @requires_32b
     def test_writev_overflow_32bits(self):
-        fd = os.open(support.TESTFN, os.O_RDWR | os.O_CREAT)
+        fd = os.open(os_helper.TESTFN, os.O_RDWR | os.O_CREAT)
         try:
             with self.assertRaises(OSError) as cm:
                 os.writev(fd, [b"x" * 2**16] * 2**15)
@@ -501,7 +509,7 @@
 
     @unittest.skipUnless(hasattr(posix, 'readv'), "test needs posix.readv()")
     def test_readv(self):
-        fd = os.open(support.TESTFN, os.O_RDWR | os.O_CREAT)
+        fd = os.open(os_helper.TESTFN, os.O_RDWR | os.O_CREAT)
         try:
             os.write(fd, b'test1tt2t3')
             os.lseek(fd, 0, os.SEEK_SET)
@@ -524,7 +532,7 @@
     @unittest.skipUnless(hasattr(posix, 'readv'), "test needs posix.readv()")
     @requires_32b
     def test_readv_overflow_32bits(self):
-        fd = os.open(support.TESTFN, os.O_RDWR | os.O_CREAT)
+        fd = os.open(os_helper.TESTFN, os.O_RDWR | os.O_CREAT)
         try:
             buf = [bytearray(2**16)] * 2**15
             with self.assertRaises(OSError) as cm:
@@ -537,7 +545,7 @@
     @unittest.skipUnless(hasattr(posix, 'dup'),
                          'test needs posix.dup()')
     def test_dup(self):
-        fp = open(support.TESTFN)
+        fp = open(os_helper.TESTFN)
         try:
             fd = posix.dup(fp.fileno())
             self.assertIsInstance(fd, int)
@@ -554,8 +562,8 @@
     @unittest.skipUnless(hasattr(posix, 'dup2'),
                          'test needs posix.dup2()')
     def test_dup2(self):
-        fp1 = open(support.TESTFN)
-        fp2 = open(support.TESTFN)
+        fp1 = open(os_helper.TESTFN)
+        fp2 = open(os_helper.TESTFN)
         try:
             posix.dup2(fp1.fileno(), fp2.fileno())
         finally:
@@ -565,47 +573,47 @@
     @unittest.skipUnless(hasattr(os, 'O_CLOEXEC'), "needs os.O_CLOEXEC")
     @support.requires_linux_version(2, 6, 23)
     def test_oscloexec(self):
-        fd = os.open(support.TESTFN, os.O_RDONLY|os.O_CLOEXEC)
+        fd = os.open(os_helper.TESTFN, os.O_RDONLY|os.O_CLOEXEC)
         self.addCleanup(os.close, fd)
         self.assertFalse(os.get_inheritable(fd))
 
     @unittest.skipUnless(hasattr(posix, 'O_EXLOCK'),
                          'test needs posix.O_EXLOCK')
     def test_osexlock(self):
-        fd = os.open(support.TESTFN,
+        fd = os.open(os_helper.TESTFN,
                      os.O_WRONLY|os.O_EXLOCK|os.O_CREAT)
-        self.assertRaises(OSError, os.open, support.TESTFN,
+        self.assertRaises(OSError, os.open, os_helper.TESTFN,
                           os.O_WRONLY|os.O_EXLOCK|os.O_NONBLOCK)
         os.close(fd)
 
         if hasattr(posix, "O_SHLOCK"):
-            fd = os.open(support.TESTFN,
+            fd = os.open(os_helper.TESTFN,
                          os.O_WRONLY|os.O_SHLOCK|os.O_CREAT)
-            self.assertRaises(OSError, os.open, support.TESTFN,
+            self.assertRaises(OSError, os.open, os_helper.TESTFN,
                               os.O_WRONLY|os.O_EXLOCK|os.O_NONBLOCK)
             os.close(fd)
 
     @unittest.skipUnless(hasattr(posix, 'O_SHLOCK'),
                          'test needs posix.O_SHLOCK')
     def test_osshlock(self):
-        fd1 = os.open(support.TESTFN,
+        fd1 = os.open(os_helper.TESTFN,
                      os.O_WRONLY|os.O_SHLOCK|os.O_CREAT)
-        fd2 = os.open(support.TESTFN,
+        fd2 = os.open(os_helper.TESTFN,
                       os.O_WRONLY|os.O_SHLOCK|os.O_CREAT)
         os.close(fd2)
         os.close(fd1)
 
         if hasattr(posix, "O_EXLOCK"):
-            fd = os.open(support.TESTFN,
+            fd = os.open(os_helper.TESTFN,
                          os.O_WRONLY|os.O_SHLOCK|os.O_CREAT)
-            self.assertRaises(OSError, os.open, support.TESTFN,
+            self.assertRaises(OSError, os.open, os_helper.TESTFN,
                               os.O_RDONLY|os.O_EXLOCK|os.O_NONBLOCK)
             os.close(fd)
 
     @unittest.skipUnless(hasattr(posix, 'fstat'),
                          'test needs posix.fstat()')
     def test_fstat(self):
-        fp = open(support.TESTFN)
+        fp = open(os_helper.TESTFN)
         try:
             self.assertTrue(posix.fstat(fp.fileno()))
             self.assertTrue(posix.stat(fp.fileno()))
@@ -617,58 +625,63 @@
             fp.close()
 
     def test_stat(self):
-        self.assertTrue(posix.stat(support.TESTFN))
-        self.assertTrue(posix.stat(os.fsencode(support.TESTFN)))
+        self.assertTrue(posix.stat(os_helper.TESTFN))
+        self.assertTrue(posix.stat(os.fsencode(os_helper.TESTFN)))
 
         self.assertWarnsRegex(DeprecationWarning,
                 'should be string, bytes, os.PathLike or integer, not',
-                posix.stat, bytearray(os.fsencode(support.TESTFN)))
+                posix.stat, bytearray(os.fsencode(os_helper.TESTFN)))
         self.assertRaisesRegex(TypeError,
                 'should be string, bytes, os.PathLike or integer, not',
                 posix.stat, None)
         self.assertRaisesRegex(TypeError,
                 'should be string, bytes, os.PathLike or integer, not',
-                posix.stat, list(support.TESTFN))
+                posix.stat, list(os_helper.TESTFN))
         self.assertRaisesRegex(TypeError,
                 'should be string, bytes, os.PathLike or integer, not',
-                posix.stat, list(os.fsencode(support.TESTFN)))
+                posix.stat, list(os.fsencode(os_helper.TESTFN)))
 
     @unittest.skipUnless(hasattr(posix, 'mkfifo'), "don't have mkfifo()")
     def test_mkfifo(self):
-        support.unlink(support.TESTFN)
+        if sys.platform == "vxworks":
+            fifo_path = os.path.join("/fifos/", os_helper.TESTFN)
+        else:
+            fifo_path = os_helper.TESTFN
+        os_helper.unlink(fifo_path)
+        self.addCleanup(os_helper.unlink, fifo_path)
         try:
-            posix.mkfifo(support.TESTFN, stat.S_IRUSR | stat.S_IWUSR)
+            posix.mkfifo(fifo_path, stat.S_IRUSR | stat.S_IWUSR)
         except PermissionError as e:
             self.skipTest('posix.mkfifo(): %s' % e)
-        self.assertTrue(stat.S_ISFIFO(posix.stat(support.TESTFN).st_mode))
+        self.assertTrue(stat.S_ISFIFO(posix.stat(fifo_path).st_mode))
 
     @unittest.skipUnless(hasattr(posix, 'mknod') and hasattr(stat, 'S_IFIFO'),
                          "don't have mknod()/S_IFIFO")
     def test_mknod(self):
         # Test using mknod() to create a FIFO (the only use specified
         # by POSIX).
-        support.unlink(support.TESTFN)
+        os_helper.unlink(os_helper.TESTFN)
         mode = stat.S_IFIFO | stat.S_IRUSR | stat.S_IWUSR
         try:
-            posix.mknod(support.TESTFN, mode, 0)
+            posix.mknod(os_helper.TESTFN, mode, 0)
         except OSError as e:
             # Some old systems don't allow unprivileged users to use
             # mknod(), or only support creating device nodes.
             self.assertIn(e.errno, (errno.EPERM, errno.EINVAL, errno.EACCES))
         else:
-            self.assertTrue(stat.S_ISFIFO(posix.stat(support.TESTFN).st_mode))
+            self.assertTrue(stat.S_ISFIFO(posix.stat(os_helper.TESTFN).st_mode))
 
         # Keyword arguments are also supported
-        support.unlink(support.TESTFN)
+        os_helper.unlink(os_helper.TESTFN)
         try:
-            posix.mknod(path=support.TESTFN, mode=mode, device=0,
+            posix.mknod(path=os_helper.TESTFN, mode=mode, device=0,
                 dir_fd=None)
         except OSError as e:
             self.assertIn(e.errno, (errno.EPERM, errno.EINVAL, errno.EACCES))
 
     @unittest.skipUnless(hasattr(posix, 'makedev'), 'test needs posix.makedev()')
     def test_makedev(self):
-        st = posix.stat(support.TESTFN)
+        st = posix.stat(os_helper.TESTFN)
         dev = st.st_dev
         self.assertIsInstance(dev, int)
         self.assertGreaterEqual(dev, 0)
@@ -712,11 +725,20 @@
         chown_func(first_param, uid, -1)
         check_stat(uid, gid)
 
-        if uid == 0:
+        if sys.platform == "vxworks":
+            # On VxWorks, root user id is 1 and 0 means no login user:
+            # both are super users.
+            is_root = (uid in (0, 1))
+        else:
+            is_root = (uid == 0)
+        if is_root:
             # Try an amusingly large uid/gid to make sure we handle
             # large unsigned values.  (chown lets you use any
             # uid/gid you like, even if they aren't defined.)
             #
+            # On VxWorks uid_t is defined as unsigned short. A big
+            # value greater than 65535 will result in underflow error.
+            #
             # This problem keeps coming up:
             #   http://bugs.python.org/issue1747858
             #   http://bugs.python.org/issue4591
@@ -726,7 +748,7 @@
             # This part of the test only runs when run as root.
             # Only scary people run their tests as root.
 
-            big_value = 2**31
+            big_value = (2**31 if sys.platform != "vxworks" else 2**15)
             chown_func(first_param, big_value, big_value)
             check_stat(big_value, big_value)
             chown_func(first_param, -1, -1)
@@ -757,19 +779,19 @@
     @unittest.skipUnless(hasattr(posix, 'chown'), "test needs os.chown()")
     def test_chown(self):
         # raise an OSError if the file does not exist
-        os.unlink(support.TESTFN)
-        self.assertRaises(OSError, posix.chown, support.TESTFN, -1, -1)
+        os.unlink(os_helper.TESTFN)
+        self.assertRaises(OSError, posix.chown, os_helper.TESTFN, -1, -1)
 
         # re-create the file
-        support.create_empty_file(support.TESTFN)
-        self._test_all_chown_common(posix.chown, support.TESTFN, posix.stat)
+        os_helper.create_empty_file(os_helper.TESTFN)
+        self._test_all_chown_common(posix.chown, os_helper.TESTFN, posix.stat)
 
     @unittest.skipUnless(hasattr(posix, 'fchown'), "test needs os.fchown()")
     def test_fchown(self):
-        os.unlink(support.TESTFN)
+        os.unlink(os_helper.TESTFN)
 
         # re-create the file
-        test_file = open(support.TESTFN, 'w')
+        test_file = open(os_helper.TESTFN, 'w')
         try:
             fd = test_file.fileno()
             self._test_all_chown_common(posix.fchown, fd,
@@ -779,35 +801,35 @@
 
     @unittest.skipUnless(hasattr(posix, 'lchown'), "test needs os.lchown()")
     def test_lchown(self):
-        os.unlink(support.TESTFN)
+        os.unlink(os_helper.TESTFN)
         # create a symlink
-        os.symlink(_DUMMY_SYMLINK, support.TESTFN)
-        self._test_all_chown_common(posix.lchown, support.TESTFN,
+        os.symlink(_DUMMY_SYMLINK, os_helper.TESTFN)
+        self._test_all_chown_common(posix.lchown, os_helper.TESTFN,
                                     getattr(posix, 'lstat', None))
 
     @unittest.skipUnless(hasattr(posix, 'chdir'), 'test needs posix.chdir()')
     def test_chdir(self):
         posix.chdir(os.curdir)
-        self.assertRaises(OSError, posix.chdir, support.TESTFN)
+        self.assertRaises(OSError, posix.chdir, os_helper.TESTFN)
 
     def test_listdir(self):
-        self.assertIn(support.TESTFN, posix.listdir(os.curdir))
+        self.assertIn(os_helper.TESTFN, posix.listdir(os.curdir))
 
     def test_listdir_default(self):
         # When listdir is called without argument,
         # it's the same as listdir(os.curdir).
-        self.assertIn(support.TESTFN, posix.listdir())
+        self.assertIn(os_helper.TESTFN, posix.listdir())
 
     def test_listdir_bytes(self):
         # When listdir is called with a bytes object,
         # the returned strings are of type bytes.
-        self.assertIn(os.fsencode(support.TESTFN), posix.listdir(b'.'))
+        self.assertIn(os.fsencode(os_helper.TESTFN), posix.listdir(b'.'))
 
     def test_listdir_bytes_like(self):
         for cls in bytearray, memoryview:
             with self.assertWarns(DeprecationWarning):
                 names = posix.listdir(cls(b'.'))
-            self.assertIn(os.fsencode(support.TESTFN), names)
+            self.assertIn(os.fsencode(os_helper.TESTFN), names)
             for name in names:
                 self.assertIs(type(name), bytes)
 
@@ -828,7 +850,7 @@
 
     @unittest.skipUnless(hasattr(posix, 'access'), 'test needs posix.access()')
     def test_access(self):
-        self.assertTrue(posix.access(support.TESTFN, os.R_OK))
+        self.assertTrue(posix.access(os_helper.TESTFN, os.R_OK))
 
     @unittest.skipUnless(hasattr(posix, 'umask'), 'test needs posix.umask()')
     def test_umask(self):
@@ -887,12 +909,15 @@
     @unittest.skipUnless(hasattr(posix, 'utime'), 'test needs posix.utime()')
     def test_utime(self):
         now = time.time()
-        posix.utime(support.TESTFN, None)
-        self.assertRaises(TypeError, posix.utime, support.TESTFN, (None, None))
-        self.assertRaises(TypeError, posix.utime, support.TESTFN, (now, None))
-        self.assertRaises(TypeError, posix.utime, support.TESTFN, (None, now))
-        posix.utime(support.TESTFN, (int(now), int(now)))
-        posix.utime(support.TESTFN, (now, now))
+        posix.utime(os_helper.TESTFN, None)
+        self.assertRaises(TypeError, posix.utime,
+                          os_helper.TESTFN, (None, None))
+        self.assertRaises(TypeError, posix.utime,
+                          os_helper.TESTFN, (now, None))
+        self.assertRaises(TypeError, posix.utime,
+                          os_helper.TESTFN, (None, now))
+        posix.utime(os_helper.TESTFN, (int(now), int(now)))
+        posix.utime(os_helper.TESTFN, (now, now))
 
     def _test_chflags_regular_file(self, chflags_func, target_file, **kwargs):
         st = os.stat(target_file)
@@ -920,20 +945,21 @@
 
     @unittest.skipUnless(hasattr(posix, 'chflags'), 'test needs os.chflags()')
     def test_chflags(self):
-        self._test_chflags_regular_file(posix.chflags, support.TESTFN)
+        self._test_chflags_regular_file(posix.chflags, os_helper.TESTFN)
 
     @unittest.skipUnless(hasattr(posix, 'lchflags'), 'test needs os.lchflags()')
     def test_lchflags_regular_file(self):
-        self._test_chflags_regular_file(posix.lchflags, support.TESTFN)
-        self._test_chflags_regular_file(posix.chflags, support.TESTFN, follow_symlinks=False)
+        self._test_chflags_regular_file(posix.lchflags, os_helper.TESTFN)
+        self._test_chflags_regular_file(posix.chflags, os_helper.TESTFN,
+                                        follow_symlinks=False)
 
     @unittest.skipUnless(hasattr(posix, 'lchflags'), 'test needs os.lchflags()')
     def test_lchflags_symlink(self):
-        testfn_st = os.stat(support.TESTFN)
+        testfn_st = os.stat(os_helper.TESTFN)
 
         self.assertTrue(hasattr(testfn_st, 'st_flags'))
 
-        os.symlink(support.TESTFN, _DUMMY_SYMLINK)
+        os.symlink(os_helper.TESTFN, _DUMMY_SYMLINK)
         self.teardown_files.append(_DUMMY_SYMLINK)
         dummy_symlink_st = os.lstat(_DUMMY_SYMLINK)
 
@@ -951,7 +977,7 @@
                 msg = 'chflag UF_IMMUTABLE not supported by underlying fs'
                 self.skipTest(msg)
             try:
-                new_testfn_st = os.stat(support.TESTFN)
+                new_testfn_st = os.stat(os_helper.TESTFN)
                 new_dummy_symlink_st = os.lstat(_DUMMY_SYMLINK)
 
                 self.assertEqual(testfn_st.st_flags, new_testfn_st.st_flags)
@@ -987,7 +1013,7 @@
     def test_getcwd_long_pathnames(self):
         dirname = 'getcwd-test-directory-0123456789abcdef-01234567890abcdef'
         curdir = os.getcwd()
-        base_path = os.path.abspath(support.TESTFN) + '.getcwd'
+        base_path = os.path.abspath(os_helper.TESTFN) + '.getcwd'
 
         try:
             os.mkdir(base_path)
@@ -1017,7 +1043,7 @@
 
         finally:
             os.chdir(curdir)
-            support.rmtree(base_path)
+            os_helper.rmtree(base_path)
 
     @unittest.skipUnless(hasattr(posix, 'getgrouplist'), "test needs posix.getgrouplist()")
     @unittest.skipUnless(hasattr(pwd, 'getpwuid'), "test needs pwd.getpwuid()")
@@ -1029,6 +1055,7 @@
 
 
     @unittest.skipUnless(hasattr(os, 'getegid'), "test needs os.getegid()")
+    @unittest.skipUnless(hasattr(os, 'popen'), "test needs os.popen()")
     def test_getgroups(self):
         with os.popen('id -G 2>/dev/null') as idg:
             groups = idg.read().strip()
@@ -1044,8 +1071,8 @@
         # Issues 16698: OS X ABIs prior to 10.6 have limits on getgroups()
         if sys.platform == 'darwin':
             import sysconfig
-            dt = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') or '10.0'
-            if tuple(int(n) for n in str(dt).split('.')[0:2]) < (10, 6):
+            dt = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') or '10.3'
+            if tuple(int(n) for n in dt.split('.')[0:2]) < (10, 6):
                 raise unittest.SkipTest("getgroups(2) is broken prior to 10.6")
 
         # 'id -G' and 'os.getgroups()' should return the same
@@ -1055,176 +1082,6 @@
         symdiff = idg_groups.symmetric_difference(posix.getgroups())
         self.assertTrue(not symdiff or symdiff == {posix.getegid()})
 
-    # tests for the posix *at functions follow
-
-    @unittest.skipUnless(os.access in os.supports_dir_fd, "test needs dir_fd support for os.access()")
-    def test_access_dir_fd(self):
-        f = posix.open(posix.getcwd(), posix.O_RDONLY)
-        try:
-            self.assertTrue(posix.access(support.TESTFN, os.R_OK, dir_fd=f))
-        finally:
-            posix.close(f)
-
-    @unittest.skipUnless(os.chmod in os.supports_dir_fd, "test needs dir_fd support in os.chmod()")
-    def test_chmod_dir_fd(self):
-        os.chmod(support.TESTFN, stat.S_IRUSR)
-
-        f = posix.open(posix.getcwd(), posix.O_RDONLY)
-        try:
-            posix.chmod(support.TESTFN, stat.S_IRUSR | stat.S_IWUSR, dir_fd=f)
-
-            s = posix.stat(support.TESTFN)
-            self.assertEqual(s[0] & stat.S_IRWXU, stat.S_IRUSR | stat.S_IWUSR)
-        finally:
-            posix.close(f)
-
-    @unittest.skipUnless(os.chown in os.supports_dir_fd, "test needs dir_fd support in os.chown()")
-    def test_chown_dir_fd(self):
-        support.unlink(support.TESTFN)
-        support.create_empty_file(support.TESTFN)
-
-        f = posix.open(posix.getcwd(), posix.O_RDONLY)
-        try:
-            posix.chown(support.TESTFN, os.getuid(), os.getgid(), dir_fd=f)
-        finally:
-            posix.close(f)
-
-    @unittest.skipUnless(os.stat in os.supports_dir_fd, "test needs dir_fd support in os.stat()")
-    def test_stat_dir_fd(self):
-        support.unlink(support.TESTFN)
-        with open(support.TESTFN, 'w') as outfile:
-            outfile.write("testline\n")
-
-        f = posix.open(posix.getcwd(), posix.O_RDONLY)
-        try:
-            s1 = posix.stat(support.TESTFN)
-            s2 = posix.stat(support.TESTFN, dir_fd=f)
-            self.assertEqual(s1, s2)
-            s2 = posix.stat(support.TESTFN, dir_fd=None)
-            self.assertEqual(s1, s2)
-            self.assertRaisesRegex(TypeError, 'should be integer or None, not',
-                    posix.stat, support.TESTFN, dir_fd=posix.getcwd())
-            self.assertRaisesRegex(TypeError, 'should be integer or None, not',
-                    posix.stat, support.TESTFN, dir_fd=float(f))
-            self.assertRaises(OverflowError,
-                    posix.stat, support.TESTFN, dir_fd=10**20)
-        finally:
-            posix.close(f)
-
-    @unittest.skipUnless(os.utime in os.supports_dir_fd, "test needs dir_fd support in os.utime()")
-    def test_utime_dir_fd(self):
-        f = posix.open(posix.getcwd(), posix.O_RDONLY)
-        try:
-            now = time.time()
-            posix.utime(support.TESTFN, None, dir_fd=f)
-            posix.utime(support.TESTFN, dir_fd=f)
-            self.assertRaises(TypeError, posix.utime, support.TESTFN, now, dir_fd=f)
-            self.assertRaises(TypeError, posix.utime, support.TESTFN, (None, None), dir_fd=f)
-            self.assertRaises(TypeError, posix.utime, support.TESTFN, (now, None), dir_fd=f)
-            self.assertRaises(TypeError, posix.utime, support.TESTFN, (None, now), dir_fd=f)
-            self.assertRaises(TypeError, posix.utime, support.TESTFN, (now, "x"), dir_fd=f)
-            posix.utime(support.TESTFN, (int(now), int(now)), dir_fd=f)
-            posix.utime(support.TESTFN, (now, now), dir_fd=f)
-            posix.utime(support.TESTFN,
-                    (int(now), int((now - int(now)) * 1e9)), dir_fd=f)
-            posix.utime(support.TESTFN, dir_fd=f,
-                            times=(int(now), int((now - int(now)) * 1e9)))
-
-            # try dir_fd and follow_symlinks together
-            if os.utime in os.supports_follow_symlinks:
-                try:
-                    posix.utime(support.TESTFN, follow_symlinks=False, dir_fd=f)
-                except ValueError:
-                    # whoops!  using both together not supported on this platform.
-                    pass
-
-        finally:
-            posix.close(f)
-
-    @unittest.skipUnless(os.link in os.supports_dir_fd, "test needs dir_fd support in os.link()")
-    def test_link_dir_fd(self):
-        f = posix.open(posix.getcwd(), posix.O_RDONLY)
-        try:
-            posix.link(support.TESTFN, support.TESTFN + 'link', src_dir_fd=f, dst_dir_fd=f)
-        except PermissionError as e:
-            self.skipTest('posix.link(): %s' % e)
-        else:
-            # should have same inodes
-            self.assertEqual(posix.stat(support.TESTFN)[1],
-                posix.stat(support.TESTFN + 'link')[1])
-        finally:
-            posix.close(f)
-            support.unlink(support.TESTFN + 'link')
-
-    @unittest.skipUnless(os.mkdir in os.supports_dir_fd, "test needs dir_fd support in os.mkdir()")
-    def test_mkdir_dir_fd(self):
-        f = posix.open(posix.getcwd(), posix.O_RDONLY)
-        try:
-            posix.mkdir(support.TESTFN + 'dir', dir_fd=f)
-            posix.stat(support.TESTFN + 'dir') # should not raise exception
-        finally:
-            posix.close(f)
-            support.rmtree(support.TESTFN + 'dir')
-
-    @unittest.skipUnless((os.mknod in os.supports_dir_fd) and hasattr(stat, 'S_IFIFO'),
-                         "test requires both stat.S_IFIFO and dir_fd support for os.mknod()")
-    def test_mknod_dir_fd(self):
-        # Test using mknodat() to create a FIFO (the only use specified
-        # by POSIX).
-        support.unlink(support.TESTFN)
-        mode = stat.S_IFIFO | stat.S_IRUSR | stat.S_IWUSR
-        f = posix.open(posix.getcwd(), posix.O_RDONLY)
-        try:
-            posix.mknod(support.TESTFN, mode, 0, dir_fd=f)
-        except OSError as e:
-            # Some old systems don't allow unprivileged users to use
-            # mknod(), or only support creating device nodes.
-            self.assertIn(e.errno, (errno.EPERM, errno.EINVAL, errno.EACCES))
-        else:
-            self.assertTrue(stat.S_ISFIFO(posix.stat(support.TESTFN).st_mode))
-        finally:
-            posix.close(f)
-
-    @unittest.skipUnless(os.open in os.supports_dir_fd, "test needs dir_fd support in os.open()")
-    def test_open_dir_fd(self):
-        support.unlink(support.TESTFN)
-        with open(support.TESTFN, 'w') as outfile:
-            outfile.write("testline\n")
-        a = posix.open(posix.getcwd(), posix.O_RDONLY)
-        b = posix.open(support.TESTFN, posix.O_RDONLY, dir_fd=a)
-        try:
-            res = posix.read(b, 9).decode(encoding="utf-8")
-            self.assertEqual("testline\n", res)
-        finally:
-            posix.close(a)
-            posix.close(b)
-
-    @unittest.skipUnless(os.readlink in os.supports_dir_fd, "test needs dir_fd support in os.readlink()")
-    def test_readlink_dir_fd(self):
-        os.symlink(support.TESTFN, support.TESTFN + 'link')
-        f = posix.open(posix.getcwd(), posix.O_RDONLY)
-        try:
-            self.assertEqual(posix.readlink(support.TESTFN + 'link'),
-                posix.readlink(support.TESTFN + 'link', dir_fd=f))
-        finally:
-            support.unlink(support.TESTFN + 'link')
-            posix.close(f)
-
-    @unittest.skipUnless(os.rename in os.supports_dir_fd, "test needs dir_fd support in os.rename()")
-    def test_rename_dir_fd(self):
-        support.unlink(support.TESTFN)
-        support.create_empty_file(support.TESTFN + 'ren')
-        f = posix.open(posix.getcwd(), posix.O_RDONLY)
-        try:
-            posix.rename(support.TESTFN + 'ren', support.TESTFN, src_dir_fd=f, dst_dir_fd=f)
-        except:
-            posix.rename(support.TESTFN + 'ren', support.TESTFN)
-            raise
-        else:
-            posix.stat(support.TESTFN) # should not raise exception
-        finally:
-            posix.close(f)
-
     @unittest.skipUnless(hasattr(signal, 'SIGCHLD'), 'CLD_XXXX be placed in si_code for a SIGCHLD signal')
     @unittest.skipUnless(hasattr(os, 'waitid_result'), "test needs os.waitid_result")
     def test_cld_xxxx_constants(self):
@@ -1235,45 +1092,6 @@
         os.CLD_STOPPED
         os.CLD_CONTINUED
 
-    @unittest.skipUnless(os.symlink in os.supports_dir_fd, "test needs dir_fd support in os.symlink()")
-    def test_symlink_dir_fd(self):
-        f = posix.open(posix.getcwd(), posix.O_RDONLY)
-        try:
-            posix.symlink(support.TESTFN, support.TESTFN + 'link', dir_fd=f)
-            self.assertEqual(posix.readlink(support.TESTFN + 'link'), support.TESTFN)
-        finally:
-            posix.close(f)
-            support.unlink(support.TESTFN + 'link')
-
-    @unittest.skipUnless(os.unlink in os.supports_dir_fd, "test needs dir_fd support in os.unlink()")
-    def test_unlink_dir_fd(self):
-        f = posix.open(posix.getcwd(), posix.O_RDONLY)
-        support.create_empty_file(support.TESTFN + 'del')
-        posix.stat(support.TESTFN + 'del') # should not raise exception
-        try:
-            posix.unlink(support.TESTFN + 'del', dir_fd=f)
-        except:
-            support.unlink(support.TESTFN + 'del')
-            raise
-        else:
-            self.assertRaises(OSError, posix.stat, support.TESTFN + 'link')
-        finally:
-            posix.close(f)
-
-    @unittest.skipUnless(os.mkfifo in os.supports_dir_fd, "test needs dir_fd support in os.mkfifo()")
-    def test_mkfifo_dir_fd(self):
-        support.unlink(support.TESTFN)
-        f = posix.open(posix.getcwd(), posix.O_RDONLY)
-        try:
-            try:
-                posix.mkfifo(support.TESTFN,
-                             stat.S_IRUSR | stat.S_IWUSR, dir_fd=f)
-            except PermissionError as e:
-                self.skipTest('posix.mkfifo(): %s' % e)
-            self.assertTrue(stat.S_ISFIFO(posix.stat(support.TESTFN).st_mode))
-        finally:
-            posix.close(f)
-
     requires_sched_h = unittest.skipUnless(hasattr(posix, 'sched_yield'),
                                            "don't have scheduling support")
     requires_sched_affinity = unittest.skipUnless(hasattr(posix, 'sched_setaffinity'),
@@ -1397,7 +1215,7 @@
         # behaviour:
         # os.SEEK_DATA = current position
         # os.SEEK_HOLE = end of file position
-        with open(support.TESTFN, 'r+b') as fp:
+        with open(os_helper.TESTFN, 'r+b') as fp:
             fp.write(b"hello")
             fp.flush()
             size = fp.tell()
@@ -1424,7 +1242,7 @@
             if function is None:
                 continue
 
-            for dst in ("noodly2", support.TESTFN):
+            for dst in ("noodly2", os_helper.TESTFN):
                 try:
                     function('doesnotexistfilename', dst)
                 except OSError as e:
@@ -1434,10 +1252,10 @@
                 self.fail("No valid path_error2() test for os." + name)
 
     def test_path_with_null_character(self):
-        fn = support.TESTFN
+        fn = os_helper.TESTFN
         fn_with_NUL = fn + '\0'
-        self.addCleanup(support.unlink, fn)
-        support.unlink(fn)
+        self.addCleanup(os_helper.unlink, fn)
+        os_helper.unlink(fn)
         fd = None
         try:
             with self.assertRaises(ValueError):
@@ -1452,10 +1270,10 @@
         self.assertRaises(ValueError, os.stat, fn_with_NUL)
 
     def test_path_with_null_byte(self):
-        fn = os.fsencode(support.TESTFN)
+        fn = os.fsencode(os_helper.TESTFN)
         fn_with_NUL = fn + b'\0'
-        self.addCleanup(support.unlink, fn)
-        support.unlink(fn)
+        self.addCleanup(os_helper.unlink, fn)
+        os_helper.unlink(fn)
         fd = None
         try:
             with self.assertRaises(ValueError):
@@ -1480,6 +1298,200 @@
         self.assertEqual(cm.exception.errno, errno.EINVAL)
         os.close(os.pidfd_open(os.getpid(), 0))
 
+
+# tests for the posix *at functions follow
+class TestPosixDirFd(unittest.TestCase):
+    count = 0
+
+    @contextmanager
+    def prepare(self):
+        TestPosixDirFd.count += 1
+        name = f'{os_helper.TESTFN}_{self.count}'
+        base_dir = f'{os_helper.TESTFN}_{self.count}base'
+        posix.mkdir(base_dir)
+        self.addCleanup(posix.rmdir, base_dir)
+        fullname = os.path.join(base_dir, name)
+        assert not os.path.exists(fullname)
+        with os_helper.open_dir_fd(base_dir) as dir_fd:
+            yield (dir_fd, name, fullname)
+
+    @contextmanager
+    def prepare_file(self):
+        with self.prepare() as (dir_fd, name, fullname):
+            os_helper.create_empty_file(fullname)
+            self.addCleanup(posix.unlink, fullname)
+            yield (dir_fd, name, fullname)
+
+    @unittest.skipUnless(os.access in os.supports_dir_fd, "test needs dir_fd support for os.access()")
+    def test_access_dir_fd(self):
+        with self.prepare_file() as (dir_fd, name, fullname):
+            self.assertTrue(posix.access(name, os.R_OK, dir_fd=dir_fd))
+
+    @unittest.skipUnless(os.chmod in os.supports_dir_fd, "test needs dir_fd support in os.chmod()")
+    def test_chmod_dir_fd(self):
+        with self.prepare_file() as (dir_fd, name, fullname):
+            posix.chmod(fullname, stat.S_IRUSR)
+            posix.chmod(name, stat.S_IRUSR | stat.S_IWUSR, dir_fd=dir_fd)
+            s = posix.stat(fullname)
+            self.assertEqual(s.st_mode & stat.S_IRWXU,
+                             stat.S_IRUSR | stat.S_IWUSR)
+
+    @unittest.skipUnless(hasattr(os, 'chown') and (os.chown in os.supports_dir_fd),
+                         "test needs dir_fd support in os.chown()")
+    def test_chown_dir_fd(self):
+        with self.prepare_file() as (dir_fd, name, fullname):
+            posix.chown(name, os.getuid(), os.getgid(), dir_fd=dir_fd)
+
+    @unittest.skipUnless(os.stat in os.supports_dir_fd, "test needs dir_fd support in os.stat()")
+    def test_stat_dir_fd(self):
+        with self.prepare() as (dir_fd, name, fullname):
+            with open(fullname, 'w') as outfile:
+                outfile.write("testline\n")
+            self.addCleanup(posix.unlink, fullname)
+
+            s1 = posix.stat(fullname)
+            s2 = posix.stat(name, dir_fd=dir_fd)
+            self.assertEqual(s1, s2)
+            s2 = posix.stat(fullname, dir_fd=None)
+            self.assertEqual(s1, s2)
+
+            self.assertRaisesRegex(TypeError, 'should be integer or None, not',
+                    posix.stat, name, dir_fd=posix.getcwd())
+            self.assertRaisesRegex(TypeError, 'should be integer or None, not',
+                    posix.stat, name, dir_fd=float(dir_fd))
+            self.assertRaises(OverflowError,
+                    posix.stat, name, dir_fd=10**20)
+
+    @unittest.skipUnless(os.utime in os.supports_dir_fd, "test needs dir_fd support in os.utime()")
+    def test_utime_dir_fd(self):
+        with self.prepare_file() as (dir_fd, name, fullname):
+            now = time.time()
+            posix.utime(name, None, dir_fd=dir_fd)
+            posix.utime(name, dir_fd=dir_fd)
+            self.assertRaises(TypeError, posix.utime, name,
+                              now, dir_fd=dir_fd)
+            self.assertRaises(TypeError, posix.utime, name,
+                              (None, None), dir_fd=dir_fd)
+            self.assertRaises(TypeError, posix.utime, name,
+                              (now, None), dir_fd=dir_fd)
+            self.assertRaises(TypeError, posix.utime, name,
+                              (None, now), dir_fd=dir_fd)
+            self.assertRaises(TypeError, posix.utime, name,
+                              (now, "x"), dir_fd=dir_fd)
+            posix.utime(name, (int(now), int(now)), dir_fd=dir_fd)
+            posix.utime(name, (now, now), dir_fd=dir_fd)
+            posix.utime(name,
+                    (int(now), int((now - int(now)) * 1e9)), dir_fd=dir_fd)
+            posix.utime(name, dir_fd=dir_fd,
+                            times=(int(now), int((now - int(now)) * 1e9)))
+
+            # try dir_fd and follow_symlinks together
+            if os.utime in os.supports_follow_symlinks:
+                try:
+                    posix.utime(name, follow_symlinks=False, dir_fd=dir_fd)
+                except ValueError:
+                    # whoops!  using both together not supported on this platform.
+                    pass
+
+    @unittest.skipUnless(os.link in os.supports_dir_fd, "test needs dir_fd support in os.link()")
+    def test_link_dir_fd(self):
+        with self.prepare_file() as (dir_fd, name, fullname), \
+             self.prepare() as (dir_fd2, linkname, fulllinkname):
+            try:
+                posix.link(name, linkname, src_dir_fd=dir_fd, dst_dir_fd=dir_fd2)
+            except PermissionError as e:
+                self.skipTest('posix.link(): %s' % e)
+            self.addCleanup(posix.unlink, fulllinkname)
+            # should have same inodes
+            self.assertEqual(posix.stat(fullname)[1],
+                posix.stat(fulllinkname)[1])
+
+    @unittest.skipUnless(os.mkdir in os.supports_dir_fd, "test needs dir_fd support in os.mkdir()")
+    def test_mkdir_dir_fd(self):
+        with self.prepare() as (dir_fd, name, fullname):
+            posix.mkdir(name, dir_fd=dir_fd)
+            self.addCleanup(posix.rmdir, fullname)
+            posix.stat(fullname) # should not raise exception
+
+    @unittest.skipUnless(hasattr(os, 'mknod')
+                         and (os.mknod in os.supports_dir_fd)
+                         and hasattr(stat, 'S_IFIFO'),
+                         "test requires both stat.S_IFIFO and dir_fd support for os.mknod()")
+    def test_mknod_dir_fd(self):
+        # Test using mknodat() to create a FIFO (the only use specified
+        # by POSIX).
+        with self.prepare() as (dir_fd, name, fullname):
+            mode = stat.S_IFIFO | stat.S_IRUSR | stat.S_IWUSR
+            try:
+                posix.mknod(name, mode, 0, dir_fd=dir_fd)
+            except OSError as e:
+                # Some old systems don't allow unprivileged users to use
+                # mknod(), or only support creating device nodes.
+                self.assertIn(e.errno, (errno.EPERM, errno.EINVAL, errno.EACCES))
+            else:
+                self.addCleanup(posix.unlink, fullname)
+                self.assertTrue(stat.S_ISFIFO(posix.stat(fullname).st_mode))
+
+    @unittest.skipUnless(os.open in os.supports_dir_fd, "test needs dir_fd support in os.open()")
+    def test_open_dir_fd(self):
+        with self.prepare() as (dir_fd, name, fullname):
+            with open(fullname, 'wb') as outfile:
+                outfile.write(b"testline\n")
+            self.addCleanup(posix.unlink, fullname)
+            fd = posix.open(name, posix.O_RDONLY, dir_fd=dir_fd)
+            try:
+                res = posix.read(fd, 9)
+                self.assertEqual(b"testline\n", res)
+            finally:
+                posix.close(fd)
+
+    @unittest.skipUnless(hasattr(os, 'readlink') and (os.readlink in os.supports_dir_fd),
+                         "test needs dir_fd support in os.readlink()")
+    def test_readlink_dir_fd(self):
+        with self.prepare() as (dir_fd, name, fullname):
+            os.symlink('symlink', fullname)
+            self.addCleanup(posix.unlink, fullname)
+            self.assertEqual(posix.readlink(name, dir_fd=dir_fd), 'symlink')
+
+    @unittest.skipUnless(os.rename in os.supports_dir_fd, "test needs dir_fd support in os.rename()")
+    def test_rename_dir_fd(self):
+        with self.prepare_file() as (dir_fd, name, fullname), \
+             self.prepare() as (dir_fd2, name2, fullname2):
+            posix.rename(name, name2,
+                         src_dir_fd=dir_fd, dst_dir_fd=dir_fd2)
+            posix.stat(fullname2) # should not raise exception
+            posix.rename(fullname2, fullname)
+
+    @unittest.skipUnless(os.symlink in os.supports_dir_fd, "test needs dir_fd support in os.symlink()")
+    def test_symlink_dir_fd(self):
+        with self.prepare() as (dir_fd, name, fullname):
+            posix.symlink('symlink', name, dir_fd=dir_fd)
+            self.addCleanup(posix.unlink, fullname)
+            self.assertEqual(posix.readlink(fullname), 'symlink')
+
+    @unittest.skipUnless(os.unlink in os.supports_dir_fd, "test needs dir_fd support in os.unlink()")
+    def test_unlink_dir_fd(self):
+        with self.prepare() as (dir_fd, name, fullname):
+            os_helper.create_empty_file(fullname)
+            posix.stat(fullname) # should not raise exception
+            try:
+                posix.unlink(name, dir_fd=dir_fd)
+                self.assertRaises(OSError, posix.stat, fullname)
+            except:
+                self.addCleanup(posix.unlink, fullname)
+                raise
+
+    @unittest.skipUnless(os.mkfifo in os.supports_dir_fd, "test needs dir_fd support in os.mkfifo()")
+    def test_mkfifo_dir_fd(self):
+        with self.prepare() as (dir_fd, name, fullname):
+            try:
+                posix.mkfifo(name, stat.S_IRUSR | stat.S_IWUSR, dir_fd=dir_fd)
+            except PermissionError as e:
+                self.skipTest('posix.mkfifo(): %s' % e)
+            self.addCleanup(posix.unlink, fullname)
+            self.assertTrue(stat.S_ISFIFO(posix.stat(fullname).st_mode))
+
+
 class PosixGroupsTester(unittest.TestCase):
 
     def setUp(self):
@@ -1530,8 +1542,8 @@
         return (sys.executable, '-I', '-S', *args)
 
     def test_returns_pid(self):
-        pidfile = support.TESTFN
-        self.addCleanup(support.unlink, pidfile)
+        pidfile = os_helper.TESTFN
+        self.addCleanup(os_helper.unlink, pidfile)
         script = f"""if 1:
             import os
             with open({pidfile!r}, "w") as pidfile:
@@ -1540,7 +1552,7 @@
         args = self.python_args('-c', script)
         pid = self.spawn_func(args[0], args, os.environ)
         support.wait_process(pid, exitcode=0)
-        with open(pidfile) as f:
+        with open(pidfile, encoding="utf-8") as f:
             self.assertEqual(f.read(), str(pid))
 
     def test_no_such_executable(self):
@@ -1559,18 +1571,18 @@
             self.assertNotEqual(status, 0)
 
     def test_specify_environment(self):
-        envfile = support.TESTFN
-        self.addCleanup(support.unlink, envfile)
+        envfile = os_helper.TESTFN
+        self.addCleanup(os_helper.unlink, envfile)
         script = f"""if 1:
             import os
-            with open({envfile!r}, "w") as envfile:
+            with open({envfile!r}, "w", encoding="utf-8") as envfile:
                 envfile.write(os.environ['foo'])
         """
         args = self.python_args('-c', script)
         pid = self.spawn_func(args[0], args,
                               {**os.environ, 'foo': 'bar'})
         support.wait_process(pid, exitcode=0)
-        with open(envfile) as f:
+        with open(envfile, encoding="utf-8") as f:
             self.assertEqual(f.read(), 'bar')
 
     def test_none_file_actions(self):
@@ -1806,8 +1818,8 @@
                                            os.O_RDONLY, 0)])
 
     def test_open_file(self):
-        outfile = support.TESTFN
-        self.addCleanup(support.unlink, outfile)
+        outfile = os_helper.TESTFN
+        self.addCleanup(os_helper.unlink, outfile)
         script = """if 1:
             import sys
             sys.stdout.write("hello")
@@ -1822,18 +1834,18 @@
                               file_actions=file_actions)
 
         support.wait_process(pid, exitcode=0)
-        with open(outfile) as f:
+        with open(outfile, encoding="utf-8") as f:
             self.assertEqual(f.read(), 'hello')
 
     def test_close_file(self):
-        closefile = support.TESTFN
-        self.addCleanup(support.unlink, closefile)
+        closefile = os_helper.TESTFN
+        self.addCleanup(os_helper.unlink, closefile)
         script = f"""if 1:
             import os
             try:
                 os.fstat(0)
             except OSError as e:
-                with open({closefile!r}, 'w') as closefile:
+                with open({closefile!r}, 'w', encoding='utf-8') as closefile:
                     closefile.write('is closed %d' % e.errno)
             """
         args = self.python_args('-c', script)
@@ -1841,12 +1853,12 @@
                               file_actions=[(os.POSIX_SPAWN_CLOSE, 0)])
 
         support.wait_process(pid, exitcode=0)
-        with open(closefile) as f:
+        with open(closefile, encoding="utf-8") as f:
             self.assertEqual(f.read(), 'is closed %d' % errno.EBADF)
 
     def test_dup2(self):
-        dupfile = support.TESTFN
-        self.addCleanup(support.unlink, dupfile)
+        dupfile = os_helper.TESTFN
+        self.addCleanup(os_helper.unlink, dupfile)
         script = """if 1:
             import sys
             sys.stdout.write("hello")
@@ -1859,7 +1871,7 @@
             pid = self.spawn_func(args[0], args, os.environ,
                                   file_actions=file_actions)
             support.wait_process(pid, exitcode=0)
-        with open(dupfile) as f:
+        with open(dupfile, encoding="utf-8") as f:
             self.assertEqual(f.read(), 'hello')
 
 
@@ -1872,11 +1884,11 @@
 class TestPosixSpawnP(unittest.TestCase, _PosixSpawnMixin):
     spawn_func = getattr(posix, 'posix_spawnp', None)
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_posix_spawnp(self):
         # Use a symlink to create a program in its own temporary directory
         temp_dir = tempfile.mkdtemp()
-        self.addCleanup(support.rmtree, temp_dir)
+        self.addCleanup(os_helper.rmtree, temp_dir)
 
         program = 'posix_spawnp_test_program.exe'
         program_fullpath = os.path.join(temp_dir, program)
@@ -2004,7 +2016,7 @@
                 os.link("source", "target",  src_dir_fd=0, dst_dir_fd=0)
 
             # issue 41355: !HAVE_LINKAT code path ignores the follow_symlinks flag
-            with support.temp_dir() as base_path:
+            with os_helper.temp_dir() as base_path:
                 link_path = os.path.join(base_path, "link")
                 target_path = os.path.join(base_path, "target")
                 source_path = os.path.join(base_path, "source")
@@ -2132,17 +2144,9 @@
                 os.utime("path", dir_fd=0)
 
 
-def test_main():
-    try:
-        support.run_unittest(
-            PosixTester,
-            PosixGroupsTester,
-            TestPosixSpawn,
-            TestPosixSpawnP,
-            TestPosixWeaklinking
-        )
-    finally:
-        support.reap_children()
+def tearDownModule():
+    support.reap_children()
+
 
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_posixpath.py b/Lib/test/test_posixpath.py
index 18819a5..8d398ec 100644
--- a/Lib/test/test_posixpath.py
+++ b/Lib/test/test_posixpath.py
@@ -1,9 +1,12 @@
 import os
 import posixpath
+import sys
 import unittest
 from posixpath import realpath, abspath, dirname, basename
-from test import support, test_genericpath
-from test.support import FakePath
+from test import test_genericpath
+from test.support import import_helper
+from test.support import os_helper
+from test.support.os_helper import FakePath
 from unittest import mock
 
 try:
@@ -15,7 +18,7 @@
 # An absolute path to a temporary filename for testing. We can't rely on TESTFN
 # being an absolute path, so we need this.
 
-ABSTFN = abspath(support.TESTFN)
+ABSTFN = abspath(os_helper.TESTFN)
 
 def skip_if_ABSTFN_contains_backslash(test):
     """
@@ -40,8 +43,8 @@
 
     def tearDown(self):
         for suffix in ["", "1", "2"]:
-            support.unlink(support.TESTFN + suffix)
-            safe_rmdir(support.TESTFN + suffix)
+            os_helper.unlink(os_helper.TESTFN + suffix)
+            safe_rmdir(os_helper.TESTFN + suffix)
 
     def test_join(self):
         self.assertEqual(posixpath.join("/foo", "bar", "/bar", "baz"),
@@ -152,25 +155,25 @@
         self.assertEqual(posixpath.dirname(b"//foo//bar"), b"//foo")
 
     def test_islink(self):
-        self.assertIs(posixpath.islink(support.TESTFN + "1"), False)
-        self.assertIs(posixpath.lexists(support.TESTFN + "2"), False)
+        self.assertIs(posixpath.islink(os_helper.TESTFN + "1"), False)
+        self.assertIs(posixpath.lexists(os_helper.TESTFN + "2"), False)
 
-        with open(support.TESTFN + "1", "wb") as f:
+        with open(os_helper.TESTFN + "1", "wb") as f:
             f.write(b"foo")
-        self.assertIs(posixpath.islink(support.TESTFN + "1"), False)
+        self.assertIs(posixpath.islink(os_helper.TESTFN + "1"), False)
 
-        if support.can_symlink():
-            os.symlink(support.TESTFN + "1", support.TESTFN + "2")
-            self.assertIs(posixpath.islink(support.TESTFN + "2"), True)
-            os.remove(support.TESTFN + "1")
-            self.assertIs(posixpath.islink(support.TESTFN + "2"), True)
-            self.assertIs(posixpath.exists(support.TESTFN + "2"), False)
-            self.assertIs(posixpath.lexists(support.TESTFN + "2"), True)
+        if os_helper.can_symlink():
+            os.symlink(os_helper.TESTFN + "1", os_helper.TESTFN + "2")
+            self.assertIs(posixpath.islink(os_helper.TESTFN + "2"), True)
+            os.remove(os_helper.TESTFN + "1")
+            self.assertIs(posixpath.islink(os_helper.TESTFN + "2"), True)
+            self.assertIs(posixpath.exists(os_helper.TESTFN + "2"), False)
+            self.assertIs(posixpath.lexists(os_helper.TESTFN + "2"), True)
 
-        self.assertIs(posixpath.islink(support.TESTFN + "\udfff"), False)
-        self.assertIs(posixpath.islink(os.fsencode(support.TESTFN) + b"\xff"), False)
-        self.assertIs(posixpath.islink(support.TESTFN + "\x00"), False)
-        self.assertIs(posixpath.islink(os.fsencode(support.TESTFN) + b"\x00"), False)
+        self.assertIs(posixpath.islink(os_helper.TESTFN + "\udfff"), False)
+        self.assertIs(posixpath.islink(os.fsencode(os_helper.TESTFN) + b"\xff"), False)
+        self.assertIs(posixpath.islink(os_helper.TESTFN + "\x00"), False)
+        self.assertIs(posixpath.islink(os.fsencode(os_helper.TESTFN) + b"\x00"), False)
 
     def test_ismount(self):
         self.assertIs(posixpath.ismount("/"), True)
@@ -190,7 +193,7 @@
         self.assertIs(posixpath.ismount('/\x00'), False)
         self.assertIs(posixpath.ismount(b'/\x00'), False)
 
-    @unittest.skipUnless(support.can_symlink(),
+    @unittest.skipUnless(os_helper.can_symlink(),
                          "Test requires symlink support")
     def test_ismount_symlinks(self):
         # Symlinks are never mountpoints.
@@ -245,7 +248,7 @@
         self.assertEqual(posixpath.expanduser(b"foo"), b"foo")
 
     def test_expanduser_home_envvar(self):
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env['HOME'] = '/home/victor'
             self.assertEqual(posixpath.expanduser("~"), "/home/victor")
 
@@ -260,8 +263,10 @@
                     self.assertEqual(posixpath.expanduser("~/"), "/")
                     self.assertEqual(posixpath.expanduser("~/foo"), "/foo")
 
+    @unittest.skipIf(sys.platform == "vxworks",
+                     "no home directory on VxWorks")
     def test_expanduser_pwd(self):
-        pwd = support.import_module('pwd')
+        pwd = import_helper.import_module('pwd')
 
         self.assertIsInstance(posixpath.expanduser("~/"), str)
         self.assertIsInstance(posixpath.expanduser(b"~/"), bytes)
@@ -281,7 +286,7 @@
         self.assertIsInstance(posixpath.expanduser(b"~root/"), bytes)
         self.assertIsInstance(posixpath.expanduser(b"~foo/"), bytes)
 
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             # expanduser should fall back to using the password database
             del env['HOME']
 
@@ -348,7 +353,20 @@
             os.symlink(ABSTFN+"1", ABSTFN)
             self.assertEqual(realpath(ABSTFN), ABSTFN+"1")
         finally:
-            support.unlink(ABSTFN)
+            os_helper.unlink(ABSTFN)
+
+    @unittest.skipUnless(hasattr(os, "symlink"),
+                         "Missing symlink implementation")
+    @skip_if_ABSTFN_contains_backslash
+    def test_realpath_strict(self):
+        # Bug #43757: raise FileNotFoundError in strict mode if we encounter
+        # a path that does not exist.
+        try:
+            os.symlink(ABSTFN+"1", ABSTFN)
+            self.assertRaises(FileNotFoundError, realpath, ABSTFN, strict=True)
+            self.assertRaises(FileNotFoundError, realpath, ABSTFN + "2", strict=True)
+        finally:
+            os_helper.unlink(ABSTFN)
 
     @unittest.skipUnless(hasattr(os, "symlink"),
                          "Missing symlink implementation")
@@ -358,14 +376,14 @@
             os.symlink(posixpath.relpath(ABSTFN+"1"), ABSTFN)
             self.assertEqual(realpath(ABSTFN), ABSTFN+"1")
         finally:
-            support.unlink(ABSTFN)
+            os_helper.unlink(ABSTFN)
 
     @unittest.skipUnless(hasattr(os, "symlink"),
                          "Missing symlink implementation")
     @skip_if_ABSTFN_contains_backslash
     def test_realpath_symlink_loops(self):
         # Bug #930024, return the path unchanged if we get into an infinite
-        # symlink loop.
+        # symlink loop in non-strict mode (default).
         try:
             os.symlink(ABSTFN, ABSTFN)
             self.assertEqual(realpath(ABSTFN), ABSTFN)
@@ -392,15 +410,57 @@
             self.assertEqual(realpath(ABSTFN+"c"), ABSTFN+"c")
 
             # Test using relative path as well.
-            with support.change_cwd(dirname(ABSTFN)):
+            with os_helper.change_cwd(dirname(ABSTFN)):
                 self.assertEqual(realpath(basename(ABSTFN)), ABSTFN)
         finally:
-            support.unlink(ABSTFN)
-            support.unlink(ABSTFN+"1")
-            support.unlink(ABSTFN+"2")
-            support.unlink(ABSTFN+"y")
-            support.unlink(ABSTFN+"c")
-            support.unlink(ABSTFN+"a")
+            os_helper.unlink(ABSTFN)
+            os_helper.unlink(ABSTFN+"1")
+            os_helper.unlink(ABSTFN+"2")
+            os_helper.unlink(ABSTFN+"y")
+            os_helper.unlink(ABSTFN+"c")
+            os_helper.unlink(ABSTFN+"a")
+
+    @unittest.skipUnless(hasattr(os, "symlink"),
+                         "Missing symlink implementation")
+    @skip_if_ABSTFN_contains_backslash
+    def test_realpath_symlink_loops_strict(self):
+        # Bug #43757, raise OSError if we get into an infinite symlink loop in
+        # strict mode.
+        try:
+            os.symlink(ABSTFN, ABSTFN)
+            self.assertRaises(OSError, realpath, ABSTFN, strict=True)
+
+            os.symlink(ABSTFN+"1", ABSTFN+"2")
+            os.symlink(ABSTFN+"2", ABSTFN+"1")
+            self.assertRaises(OSError, realpath, ABSTFN+"1", strict=True)
+            self.assertRaises(OSError, realpath, ABSTFN+"2", strict=True)
+
+            self.assertRaises(OSError, realpath, ABSTFN+"1/x", strict=True)
+            self.assertRaises(OSError, realpath, ABSTFN+"1/..", strict=True)
+            self.assertRaises(OSError, realpath, ABSTFN+"1/../x", strict=True)
+            os.symlink(ABSTFN+"x", ABSTFN+"y")
+            self.assertRaises(OSError, realpath,
+                              ABSTFN+"1/../" + basename(ABSTFN) + "y", strict=True)
+            self.assertRaises(OSError, realpath,
+                              ABSTFN+"1/../" + basename(ABSTFN) + "1", strict=True)
+
+            os.symlink(basename(ABSTFN) + "a/b", ABSTFN+"a")
+            self.assertRaises(OSError, realpath, ABSTFN+"a", strict=True)
+
+            os.symlink("../" + basename(dirname(ABSTFN)) + "/" +
+                       basename(ABSTFN) + "c", ABSTFN+"c")
+            self.assertRaises(OSError, realpath, ABSTFN+"c", strict=True)
+
+            # Test using relative path as well.
+            with os_helper.change_cwd(dirname(ABSTFN)):
+                self.assertRaises(OSError, realpath, basename(ABSTFN), strict=True)
+        finally:
+            os_helper.unlink(ABSTFN)
+            os_helper.unlink(ABSTFN+"1")
+            os_helper.unlink(ABSTFN+"2")
+            os_helper.unlink(ABSTFN+"y")
+            os_helper.unlink(ABSTFN+"c")
+            os_helper.unlink(ABSTFN+"a")
 
     @unittest.skipUnless(hasattr(os, "symlink"),
                          "Missing symlink implementation")
@@ -413,8 +473,8 @@
             os.symlink('self/self/self', ABSTFN + '/link')
             self.assertEqual(realpath(ABSTFN + '/link'), ABSTFN)
         finally:
-            support.unlink(ABSTFN + '/self')
-            support.unlink(ABSTFN + '/link')
+            os_helper.unlink(ABSTFN + '/self')
+            os_helper.unlink(ABSTFN + '/link')
             safe_rmdir(ABSTFN)
 
     @unittest.skipUnless(hasattr(os, "symlink"),
@@ -430,11 +490,11 @@
             self.assertEqual(realpath(ABSTFN + '/%d' % depth), ABSTFN)
 
             # Test using relative path as well.
-            with support.change_cwd(ABSTFN):
+            with os_helper.change_cwd(ABSTFN):
                 self.assertEqual(realpath('%d' % depth), ABSTFN)
         finally:
             for i in range(depth + 1):
-                support.unlink(ABSTFN + '/%d' % i)
+                os_helper.unlink(ABSTFN + '/%d' % i)
             safe_rmdir(ABSTFN)
 
     @unittest.skipUnless(hasattr(os, "symlink"),
@@ -450,10 +510,10 @@
             os.mkdir(ABSTFN + "/y")
             os.symlink(ABSTFN + "/y", ABSTFN + "/k")
 
-            with support.change_cwd(ABSTFN + "/k"):
+            with os_helper.change_cwd(ABSTFN + "/k"):
                 self.assertEqual(realpath("a"), ABSTFN + "/y/a")
         finally:
-            support.unlink(ABSTFN + "/k")
+            os_helper.unlink(ABSTFN + "/k")
             safe_rmdir(ABSTFN + "/y")
             safe_rmdir(ABSTFN)
 
@@ -477,11 +537,11 @@
             # Absolute path.
             self.assertEqual(realpath(ABSTFN + "/link-y/.."), ABSTFN + "/k")
             # Relative path.
-            with support.change_cwd(dirname(ABSTFN)):
+            with os_helper.change_cwd(dirname(ABSTFN)):
                 self.assertEqual(realpath(basename(ABSTFN) + "/link-y/.."),
                                  ABSTFN + "/k")
         finally:
-            support.unlink(ABSTFN + "/link-y")
+            os_helper.unlink(ABSTFN + "/link-y")
             safe_rmdir(ABSTFN + "/k/y")
             safe_rmdir(ABSTFN + "/k")
             safe_rmdir(ABSTFN)
@@ -497,12 +557,12 @@
             os.mkdir(ABSTFN)
             os.mkdir(ABSTFN + "/k")
             os.symlink(ABSTFN, ABSTFN + "link")
-            with support.change_cwd(dirname(ABSTFN)):
+            with os_helper.change_cwd(dirname(ABSTFN)):
                 base = basename(ABSTFN)
                 self.assertEqual(realpath(base + "link"), ABSTFN)
                 self.assertEqual(realpath(base + "link/k"), ABSTFN + "/k")
         finally:
-            support.unlink(ABSTFN + "link")
+            os_helper.unlink(ABSTFN + "link")
             safe_rmdir(ABSTFN + "/k")
             safe_rmdir(ABSTFN)
 
@@ -627,9 +687,9 @@
     path = posixpath
 
     def setUp(self):
-        self.file_name = support.TESTFN
-        self.file_path = FakePath(support.TESTFN)
-        self.addCleanup(support.unlink, self.file_name)
+        self.file_name = os_helper.TESTFN
+        self.file_path = FakePath(os_helper.TESTFN)
+        self.addCleanup(os_helper.unlink, self.file_name)
         with open(self.file_name, 'xb', 0) as file:
             file.write(b"test_posixpath.PathLikeTests")
 
diff --git a/Lib/test/test_pprint.py b/Lib/test/test_pprint.py
index cf3e4f0..6c714fd 100644
--- a/Lib/test/test_pprint.py
+++ b/Lib/test/test_pprint.py
@@ -1,6 +1,7 @@
 # -*- coding: utf-8 -*-
 
 import collections
+import dataclasses
 import io
 import itertools
 import pprint
@@ -18,6 +19,10 @@
     def __repr__(self):
         return list.__repr__(self)
 
+class list_custom_repr(list):
+    def __repr__(self):
+        return '*'*len(list.__repr__(self))
+
 class tuple2(tuple):
     pass
 
@@ -25,6 +30,10 @@
     def __repr__(self):
         return tuple.__repr__(self)
 
+class tuple_custom_repr(tuple):
+    def __repr__(self):
+        return '*'*len(tuple.__repr__(self))
+
 class set2(set):
     pass
 
@@ -32,6 +41,10 @@
     def __repr__(self):
         return set.__repr__(self)
 
+class set_custom_repr(set):
+    def __repr__(self):
+        return '*'*len(set.__repr__(self))
+
 class frozenset2(frozenset):
     pass
 
@@ -39,6 +52,10 @@
     def __repr__(self):
         return frozenset.__repr__(self)
 
+class frozenset_custom_repr(frozenset):
+    def __repr__(self):
+        return '*'*len(frozenset.__repr__(self))
+
 class dict2(dict):
     pass
 
@@ -46,6 +63,42 @@
     def __repr__(self):
         return dict.__repr__(self)
 
+class dict_custom_repr(dict):
+    def __repr__(self):
+        return '*'*len(dict.__repr__(self))
+
+@dataclasses.dataclass
+class dataclass1:
+    field1: str
+    field2: int
+    field3: bool = False
+    field4: int = dataclasses.field(default=1, repr=False)
+
+@dataclasses.dataclass
+class dataclass2:
+    a: int = 1
+    def __repr__(self):
+        return "custom repr that doesn't fit within pprint width"
+
+@dataclasses.dataclass(repr=False)
+class dataclass3:
+    a: int = 1
+
+@dataclasses.dataclass
+class dataclass4:
+    a: "dataclass4"
+    b: int = 1
+
+@dataclasses.dataclass
+class dataclass5:
+    a: "dataclass6"
+    b: int = 1
+
+@dataclasses.dataclass
+class dataclass6:
+    c: "dataclass5"
+    d: int = 1
+
 class Unorderable:
     def __repr__(self):
         return str(id(self))
@@ -155,7 +208,8 @@
                              "expected not isreadable for %r" % (unreadable,))
 
     def test_same_as_repr(self):
-        # Simple objects, small containers and classes that overwrite __repr__
+        # Simple objects, small containers and classes that override __repr__
+        # to directly call super's __repr__.
         # For those the result should be the same as repr().
         # Ahem.  The docs don't say anything about that -- this appears to
         # be testing an implementation quirk.  Starting in Python 2.5, it's
@@ -185,8 +239,35 @@
             self.assertEqual(pprint.pformat(simple), native)
             self.assertEqual(pprint.pformat(simple, width=1, indent=0)
                              .replace('\n', ' '), native)
+            self.assertEqual(pprint.pformat(simple, underscore_numbers=True), native)
             self.assertEqual(pprint.saferepr(simple), native)
 
+    def test_container_repr_override_called(self):
+        N = 1000
+        # Ensure that __repr__ override is called for subclasses of containers
+
+        for cont in (list_custom_repr(),
+                     list_custom_repr([1,2,3]),
+                     list_custom_repr(range(N)),
+                     tuple_custom_repr(),
+                     tuple_custom_repr([1,2,3]),
+                     tuple_custom_repr(range(N)),
+                     set_custom_repr(),
+                     set_custom_repr([1,2,3]),
+                     set_custom_repr(range(N)),
+                     frozenset_custom_repr(),
+                     frozenset_custom_repr([1,2,3]),
+                     frozenset_custom_repr(range(N)),
+                     dict_custom_repr(),
+                     dict_custom_repr({5: 6}),
+                     dict_custom_repr(zip(range(N),range(N))),
+                    ):
+            native = repr(cont)
+            expected = '*' * len(native)
+            self.assertEqual(pprint.pformat(cont), expected)
+            self.assertEqual(pprint.pformat(cont, width=1, indent=0), expected)
+            self.assertEqual(pprint.saferepr(cont), expected)
+
     def test_basic_line_wrap(self):
         # verify basic line-wrapping operation
         o = {'RPM_cal': 0,
@@ -276,6 +357,18 @@
      '1 '
      '2']]]]]""")
 
+    def test_integer(self):
+        self.assertEqual(pprint.pformat(1234567), '1234567')
+        self.assertEqual(pprint.pformat(1234567, underscore_numbers=True), '1_234_567')
+
+        class Temperature(int):
+            def __new__(cls, celsius_degrees):
+                return super().__new__(Temperature, celsius_degrees)
+            def __repr__(self):
+                kelvin_degrees = self + 273.15
+                return f"{kelvin_degrees}°K"
+        self.assertEqual(pprint.pformat(Temperature(1000)), '1273.15°K')
+
     def test_sorted_dict(self):
         # Starting in Python 2.5, pprint sorts dict displays by key regardless
         # of how small the dictionary may be.
@@ -368,7 +461,7 @@
             lazy=7,
             dog=8,
         )
-        formatted = pprint.pformat(ns, width=60)
+        formatted = pprint.pformat(ns, width=60, indent=4)
         self.assertEqual(formatted, """\
 namespace(the=0,
           quick=1,
@@ -405,13 +498,74 @@
                   lazy=7,
                   dog=8)""")
 
+    def test_empty_dataclass(self):
+        dc = dataclasses.make_dataclass("MyDataclass", ())()
+        formatted = pprint.pformat(dc)
+        self.assertEqual(formatted, "MyDataclass()")
+
+    def test_small_dataclass(self):
+        dc = dataclass1("text", 123)
+        formatted = pprint.pformat(dc)
+        self.assertEqual(formatted, "dataclass1(field1='text', field2=123, field3=False)")
+
+    def test_larger_dataclass(self):
+        dc = dataclass1("some fairly long text", int(1e10), True)
+        formatted = pprint.pformat([dc, dc], width=60, indent=4)
+        self.assertEqual(formatted, """\
+[   dataclass1(field1='some fairly long text',
+               field2=10000000000,
+               field3=True),
+    dataclass1(field1='some fairly long text',
+               field2=10000000000,
+               field3=True)]""")
+
+    def test_dataclass_with_repr(self):
+        dc = dataclass2()
+        formatted = pprint.pformat(dc, width=20)
+        self.assertEqual(formatted, "custom repr that doesn't fit within pprint width")
+
+    def test_dataclass_no_repr(self):
+        dc = dataclass3()
+        formatted = pprint.pformat(dc, width=10)
+        self.assertRegex(formatted, r"<test.test_pprint.dataclass3 object at \w+>")
+
+    def test_recursive_dataclass(self):
+        dc = dataclass4(None)
+        dc.a = dc
+        formatted = pprint.pformat(dc, width=10)
+        self.assertEqual(formatted, """\
+dataclass4(a=...,
+           b=1)""")
+
+    def test_cyclic_dataclass(self):
+        dc5 = dataclass5(None)
+        dc6 = dataclass6(None)
+        dc5.a = dc6
+        dc6.c = dc5
+        formatted = pprint.pformat(dc5, width=10)
+        self.assertEqual(formatted, """\
+dataclass5(a=dataclass6(c=...,
+                        d=1),
+           b=1)""")
+
     def test_subclassing(self):
+        # length(repr(obj)) > width
         o = {'names with spaces': 'should be presented using repr()',
              'others.should.not.be': 'like.this'}
         exp = """\
 {'names with spaces': 'should be presented using repr()',
  others.should.not.be: like.this}"""
-        self.assertEqual(DottedPrettyPrinter().pformat(o), exp)
+
+        dotted_printer = DottedPrettyPrinter()
+        self.assertEqual(dotted_printer.pformat(o), exp)
+
+        # length(repr(obj)) < width
+        o1 = ['with space']
+        exp1 = "['with space']"
+        self.assertEqual(dotted_printer.pformat(o1), exp1)
+        o2 = ['without.space']
+        exp2 = "[without.space]"
+        self.assertEqual(dotted_printer.pformat(o2), exp2)
 
     def test_set_reprs(self):
         self.assertEqual(pprint.pformat(set()), 'set()')
diff --git a/Lib/test/test_print.py b/Lib/test/test_print.py
index e838112..5f1bfd9 100644
--- a/Lib/test/test_print.py
+++ b/Lib/test/test_print.py
@@ -140,21 +140,24 @@
         with self.assertRaises(SyntaxError) as context:
             exec(python2_print_str)
 
-        self.assertIn('print("Hello World")', str(context.exception))
+        self.assertIn("Missing parentheses in call to 'print'. Did you mean print(...)",
+                str(context.exception))
 
     def test_string_with_soft_space(self):
         python2_print_str = 'print "Hello World",'
         with self.assertRaises(SyntaxError) as context:
             exec(python2_print_str)
 
-        self.assertIn('print("Hello World", end=" ")', str(context.exception))
+        self.assertIn("Missing parentheses in call to 'print'. Did you mean print(...)",
+                str(context.exception))
 
     def test_string_with_excessive_whitespace(self):
         python2_print_str = 'print  "Hello World", '
         with self.assertRaises(SyntaxError) as context:
             exec(python2_print_str)
 
-        self.assertIn('print("Hello World", end=" ")', str(context.exception))
+        self.assertIn("Missing parentheses in call to 'print'. Did you mean print(...)",
+                str(context.exception))
 
     def test_string_with_leading_whitespace(self):
         python2_print_str = '''if 1:
@@ -163,7 +166,8 @@
         with self.assertRaises(SyntaxError) as context:
             exec(python2_print_str)
 
-        self.assertIn('print("Hello World")', str(context.exception))
+        self.assertIn("Missing parentheses in call to 'print'. Did you mean print(...)",
+                str(context.exception))
 
     # bpo-32685: Suggestions for print statement should be proper when
     # it is in the same line as the header of a compound statement
@@ -173,14 +177,16 @@
         with self.assertRaises(SyntaxError) as context:
             exec(python2_print_str)
 
-        self.assertIn('print(p)', str(context.exception))
+        self.assertIn("Missing parentheses in call to 'print'. Did you mean print(...)",
+                str(context.exception))
 
     def test_string_in_loop_on_same_line(self):
         python2_print_str = 'for i in s: print i'
         with self.assertRaises(SyntaxError) as context:
             exec(python2_print_str)
 
-        self.assertIn('print(i)', str(context.exception))
+        self.assertIn("Missing parentheses in call to 'print'. Did you mean print(...)",
+                str(context.exception))
 
     def test_stream_redirection_hint_for_py2_migration(self):
         # Test correct hint produced for Py2 redirection syntax
diff --git a/Lib/test/test_profile.py b/Lib/test/test_profile.py
index 2336498..d97fe44 100644
--- a/Lib/test/test_profile.py
+++ b/Lib/test/test_profile.py
@@ -6,7 +6,7 @@
 import os
 from difflib import unified_diff
 from io import StringIO
-from test.support import TESTFN, run_unittest, unlink, temp_dir, change_cwd
+from test.support.os_helper import TESTFN, unlink, temp_dir, change_cwd
 from contextlib import contextmanager
 
 import profile
@@ -114,7 +114,7 @@
     def test_output_file_when_changing_directory(self):
         with temp_dir() as tmpdir, change_cwd(tmpdir):
             os.mkdir('dest')
-            with open('demo.py', 'w') as f:
+            with open('demo.py', 'w', encoding="utf-8") as f:
                 f.write('import os; os.chdir("dest")')
 
             assert_python_ok(
@@ -155,12 +155,10 @@
     finally:
         sys.stdout = stdout
 
-def test_main():
-    run_unittest(ProfileTest)
 
 def main():
     if '-r' not in sys.argv:
-        test_main()
+        unittest.main()
     else:
         regenerate_expected_output(__file__, ProfileTest)
 
diff --git a/Lib/test/test_property.py b/Lib/test/test_property.py
index 172737a..7f3813f 100644
--- a/Lib/test/test_property.py
+++ b/Lib/test/test_property.py
@@ -204,6 +204,16 @@
                 return 'Second'
         self.assertEqual(A.__doc__, 'Second')
 
+    def test_property_set_name_incorrect_args(self):
+        p = property()
+
+        for i in (0, 1, 3):
+            with self.assertRaisesRegex(
+                TypeError,
+                fr'^__set_name__\(\) takes 2 positional arguments but {i} were given$'
+            ):
+                p.__set_name__(*([0] * i))
+
 
 # Issue 5890: subclasses of property do not preserve method __doc__ strings
 class PropertySub(property):
@@ -299,6 +309,46 @@
         self.assertEqual(Foo.spam.__doc__, "a new docstring")
 
 
+class _PropertyUnreachableAttribute:
+    msg_format = None
+    obj = None
+    cls = None
+
+    def _format_exc_msg(self, msg):
+        return self.msg_format.format(msg)
+
+    @classmethod
+    def setUpClass(cls):
+        cls.obj = cls.cls()
+
+    def test_get_property(self):
+        with self.assertRaisesRegex(AttributeError, self._format_exc_msg("unreadable attribute")):
+            self.obj.foo
+
+    def test_set_property(self):
+        with self.assertRaisesRegex(AttributeError, self._format_exc_msg("can't set attribute")):
+            self.obj.foo = None
+
+    def test_del_property(self):
+        with self.assertRaisesRegex(AttributeError, self._format_exc_msg("can't delete attribute")):
+            del self.obj.foo
+
+
+class PropertyUnreachableAttributeWithName(_PropertyUnreachableAttribute, unittest.TestCase):
+    msg_format = "^{} 'foo'$"
+
+    class cls:
+        foo = property()
+
+
+class PropertyUnreachableAttributeNoName(_PropertyUnreachableAttribute, unittest.TestCase):
+    msg_format = "^{}$"
+
+    class cls:
+        pass
+
+    cls.foo = property()
+
 
 if __name__ == '__main__':
     unittest.main()
diff --git a/Lib/test/test_pstats.py b/Lib/test/test_pstats.py
index 4f78b99..c9a5fd5 100644
--- a/Lib/test/test_pstats.py
+++ b/Lib/test/test_pstats.py
@@ -61,13 +61,6 @@
             self.assertEqual(self.stats.sort_type,
                              self.stats.sort_arg_dict_default[sortkey][-1])
 
-    def test_sort_stats_enum(self):
-        for member in SortKey:
-            self.stats.sort_stats(member)
-            self.assertEqual(
-                    self.stats.sort_type,
-                    self.stats.sort_arg_dict_default[member.value][-1])
-
     def test_sort_starts_mix(self):
         self.assertRaises(TypeError, self.stats.sort_stats,
                           'calls',
diff --git a/Lib/test/test_pty.py b/Lib/test/test_pty.py
index 9c32467..0243b8a 100644
--- a/Lib/test/test_pty.py
+++ b/Lib/test/test_pty.py
@@ -1,11 +1,13 @@
-from test.support import verbose, import_module, reap_children
+from test.support import verbose, reap_children
+from test.support.import_helper import import_module
 
 # Skip these tests if termios is not available
 import_module('termios')
 
 import errno
-import pty
 import os
+import pty
+import tty
 import sys
 import select
 import signal
@@ -13,9 +15,20 @@
 import io # readline
 import unittest
 
+import struct
+import fcntl
+import warnings
+
 TEST_STRING_1 = b"I wish to buy a fish license.\n"
 TEST_STRING_2 = b"For my pet fish, Eric.\n"
 
+try:
+    _TIOCGWINSZ = tty.TIOCGWINSZ
+    _TIOCSWINSZ = tty.TIOCSWINSZ
+    _HAVE_WINSZ = True
+except AttributeError:
+    _HAVE_WINSZ = False
+
 if verbose:
     def debug(msg):
         print(msg)
@@ -59,11 +72,25 @@
     reader = io.FileIO(fd, mode='rb', closefd=False)
     return reader.readline()
 
+def expectedFailureIfStdinIsTTY(fun):
+    # avoid isatty()
+    try:
+        tty.tcgetattr(pty.STDIN_FILENO)
+        return unittest.expectedFailure(fun)
+    except tty.error:
+        pass
+    return fun
+
+def _get_term_winsz(fd):
+    s = struct.pack("HHHH", 0, 0, 0, 0)
+    return fcntl.ioctl(fd, _TIOCGWINSZ, s)
+
+def _set_term_winsz(fd, winsz):
+    fcntl.ioctl(fd, _TIOCSWINSZ, winsz)
 
 
 # Marginal testing of pty suite. Cannot do extensive 'do or fail' testing
 # because pty code is not too portable.
-# XXX(nnorwitz):  these tests leak fds when there is an error.
 class PtyTest(unittest.TestCase):
     def setUp(self):
         old_alarm = signal.signal(signal.SIGALRM, self.handle_sig)
@@ -77,34 +104,85 @@
         self.addCleanup(signal.alarm, 0)
         signal.alarm(10)
 
+        # Save original stdin window size
+        self.stdin_rows = None
+        self.stdin_cols = None
+        if _HAVE_WINSZ:
+            try:
+                stdin_dim = os.get_terminal_size(pty.STDIN_FILENO)
+                self.stdin_rows = stdin_dim.lines
+                self.stdin_cols = stdin_dim.columns
+                old_stdin_winsz = struct.pack("HHHH", self.stdin_rows,
+                                              self.stdin_cols, 0, 0)
+                self.addCleanup(_set_term_winsz, pty.STDIN_FILENO, old_stdin_winsz)
+            except OSError:
+                pass
+
     def handle_sig(self, sig, frame):
         self.fail("isatty hung")
 
     @staticmethod
     def handle_sighup(signum, frame):
-        # bpo-38547: if the process is the session leader, os.close(master_fd)
-        # of "master_fd, slave_name = pty.master_open()" raises SIGHUP
-        # signal: just ignore the signal.
         pass
 
-    def test_basic(self):
+    @expectedFailureIfStdinIsTTY
+    def test_openpty(self):
         try:
-            debug("Calling master_open()")
-            master_fd, slave_name = pty.master_open()
-            debug("Got master_fd '%d', slave_name '%s'" %
-                  (master_fd, slave_name))
-            debug("Calling slave_open(%r)" % (slave_name,))
-            slave_fd = pty.slave_open(slave_name)
-            debug("Got slave_fd '%d'" % slave_fd)
+            mode = tty.tcgetattr(pty.STDIN_FILENO)
+        except tty.error:
+            # not a tty or bad/closed fd
+            debug("tty.tcgetattr(pty.STDIN_FILENO) failed")
+            mode = None
+
+        new_stdin_winsz = None
+        if self.stdin_rows is not None and self.stdin_cols is not None:
+            try:
+                # Modify pty.STDIN_FILENO window size; we need to
+                # check if pty.openpty() is able to set pty slave
+                # window size accordingly.
+                debug("Setting pty.STDIN_FILENO window size")
+                debug(f"original size: (rows={self.stdin_rows}, cols={self.stdin_cols})")
+                target_stdin_rows = self.stdin_rows + 1
+                target_stdin_cols = self.stdin_cols + 1
+                debug(f"target size: (rows={target_stdin_rows}, cols={target_stdin_cols})")
+                target_stdin_winsz = struct.pack("HHHH", target_stdin_rows,
+                                                 target_stdin_cols, 0, 0)
+                _set_term_winsz(pty.STDIN_FILENO, target_stdin_winsz)
+
+                # Were we able to set the window size
+                # of pty.STDIN_FILENO successfully?
+                new_stdin_winsz = _get_term_winsz(pty.STDIN_FILENO)
+                self.assertEqual(new_stdin_winsz, target_stdin_winsz,
+                                 "pty.STDIN_FILENO window size unchanged")
+            except OSError:
+                warnings.warn("Failed to set pty.STDIN_FILENO window size")
+                pass
+
+        try:
+            debug("Calling pty.openpty()")
+            try:
+                master_fd, slave_fd = pty.openpty(mode, new_stdin_winsz)
+            except TypeError:
+                master_fd, slave_fd = pty.openpty()
+            debug(f"Got master_fd '{master_fd}', slave_fd '{slave_fd}'")
         except OSError:
             # " An optional feature could not be imported " ... ?
             raise unittest.SkipTest("Pseudo-terminals (seemingly) not functional.")
 
-        self.assertTrue(os.isatty(slave_fd), 'slave_fd is not a tty')
+        # closing master_fd can raise a SIGHUP if the process is
+        # the session leader: we installed a SIGHUP signal handler
+        # to ignore this signal.
+        self.addCleanup(os.close, master_fd)
+        self.addCleanup(os.close, slave_fd)
 
-        # Solaris requires reading the fd before anything is returned.
-        # My guess is that since we open and close the slave fd
-        # in master_open(), we need to read the EOF.
+        self.assertTrue(os.isatty(slave_fd), "slave_fd is not a tty")
+
+        if mode:
+            self.assertEqual(tty.tcgetattr(slave_fd), mode,
+                             "openpty() failed to set slave termios")
+        if new_stdin_winsz:
+            self.assertEqual(_get_term_winsz(slave_fd), new_stdin_winsz,
+                             "openpty() failed to set slave window size")
 
         # Ensure the fd is non-blocking in case there's nothing to read.
         blocking = os.get_blocking(master_fd)
@@ -132,15 +210,10 @@
         s2 = _readline(master_fd)
         self.assertEqual(b'For my pet fish, Eric.\n', normalize_output(s2))
 
-        os.close(slave_fd)
-        # closing master_fd can raise a SIGHUP if the process is
-        # the session leader: we installed a SIGHUP signal handler
-        # to ignore this signal.
-        os.close(master_fd)
-
     def test_fork(self):
         debug("calling pty.fork()")
         pid, master_fd = pty.fork()
+        self.addCleanup(os.close, master_fd)
         if pid == pty.CHILD:
             # stdout should be connected to a tty.
             if not os.isatty(1):
@@ -219,10 +292,27 @@
             ##else:
             ##    raise TestFailed("Read from master_fd did not raise exception")
 
-        os.close(master_fd)
+    def test_master_read(self):
+        # XXX(nnorwitz):  this test leaks fds when there is an error.
+        debug("Calling pty.openpty()")
+        master_fd, slave_fd = pty.openpty()
+        debug(f"Got master_fd '{master_fd}', slave_fd '{slave_fd}'")
 
-        # pty.fork() passed.
+        self.addCleanup(os.close, master_fd)
 
+        debug("Closing slave_fd")
+        os.close(slave_fd)
+
+        debug("Reading from master_fd")
+        try:
+            data = os.read(master_fd, 1)
+        except OSError: # Linux
+            data = b""
+
+        self.assertEqual(data, b"")
+
+    def test_spawn_doesnt_hang(self):
+        pty.spawn([sys.executable, '-c', 'print("hi there")'])
 
 class SmallPtyTests(unittest.TestCase):
     """These tests don't spawn children or hang."""
@@ -230,16 +320,31 @@
     def setUp(self):
         self.orig_stdin_fileno = pty.STDIN_FILENO
         self.orig_stdout_fileno = pty.STDOUT_FILENO
+        self.orig_pty_close = pty.close
+        self.orig_pty__copy = pty._copy
+        self.orig_pty_fork = pty.fork
         self.orig_pty_select = pty.select
+        self.orig_pty_setraw = pty.setraw
+        self.orig_pty_tcgetattr = pty.tcgetattr
+        self.orig_pty_tcsetattr = pty.tcsetattr
+        self.orig_pty_waitpid = pty.waitpid
         self.fds = []  # A list of file descriptors to close.
         self.files = []
         self.select_rfds_lengths = []
         self.select_rfds_results = []
+        self.tcsetattr_mode_setting = None
 
     def tearDown(self):
         pty.STDIN_FILENO = self.orig_stdin_fileno
         pty.STDOUT_FILENO = self.orig_stdout_fileno
+        pty.close = self.orig_pty_close
+        pty._copy = self.orig_pty__copy
+        pty.fork = self.orig_pty_fork
         pty.select = self.orig_pty_select
+        pty.setraw = self.orig_pty_setraw
+        pty.tcgetattr = self.orig_pty_tcgetattr
+        pty.tcsetattr = self.orig_pty_tcsetattr
+        pty.waitpid = self.orig_pty_waitpid
         for file in self.files:
             try:
                 file.close()
@@ -261,11 +366,20 @@
         self.files.extend(socketpair)
         return socketpair
 
-    def _mock_select(self, rfds, wfds, xfds):
+    def _mock_select(self, rfds, wfds, xfds, timeout=0):
         # This will raise IndexError when no more expected calls exist.
+        # This ignores the timeout
         self.assertEqual(self.select_rfds_lengths.pop(0), len(rfds))
         return self.select_rfds_results.pop(0), [], []
 
+    def _make_mock_fork(self, pid):
+        def mock_fork():
+            return (pid, 12)
+        return mock_fork
+
+    def _mock_tcsetattr(self, fileno, opt, mode):
+        self.tcsetattr_mode_setting = mode
+
     def test__copy_to_each(self):
         """Test the normal data case on both master_fd and stdin."""
         read_from_stdout_fd, mock_stdout_fd = self._pipe()
@@ -306,7 +420,6 @@
         socketpair[1].close()
         os.close(write_to_stdin_fd)
 
-        # Expect two select calls, the last one will cause IndexError
         pty.select = self._mock_select
         self.select_rfds_lengths.append(2)
         self.select_rfds_results.append([mock_stdin_fd, masters[0]])
@@ -314,12 +427,34 @@
         # both encountered an EOF before the second select call.
         self.select_rfds_lengths.append(0)
 
-        with self.assertRaises(IndexError):
-            pty._copy(masters[0])
+        # We expect the function to return without error.
+        self.assertEqual(pty._copy(masters[0]), None)
+
+    def test__restore_tty_mode_normal_return(self):
+        """Test that spawn resets the tty mode no when _copy returns normally."""
+
+        # PID 1 is returned from mocked fork to run the parent branch
+        # of code
+        pty.fork = self._make_mock_fork(1)
+
+        status_sentinel = object()
+        pty.waitpid = lambda _1, _2: [None, status_sentinel]
+        pty.close = lambda _: None
+
+        pty._copy = lambda _1, _2, _3: None
+
+        mode_sentinel = object()
+        pty.tcgetattr = lambda fd: mode_sentinel
+        pty.tcsetattr = self._mock_tcsetattr
+        pty.setraw = lambda _: None
+
+        self.assertEqual(pty.spawn([]), status_sentinel, "pty.waitpid process status not returned by pty.spawn")
+        self.assertEqual(self.tcsetattr_mode_setting, mode_sentinel, "pty.tcsetattr not called with original mode value")
 
 
 def tearDownModule():
     reap_children()
 
+
 if __name__ == "__main__":
     unittest.main()
diff --git a/Lib/test/test_pwd.py b/Lib/test/test_pwd.py
index 85740ce..f8f1257 100644
--- a/Lib/test/test_pwd.py
+++ b/Lib/test/test_pwd.py
@@ -1,8 +1,8 @@
 import sys
 import unittest
-from test import support
+from test.support import import_helper
 
-pwd = support.import_module('pwd')
+pwd = import_helper.import_module('pwd')
 
 @unittest.skipUnless(hasattr(pwd, 'getpwall'), 'Does not have getpwall()')
 class PwdTest(unittest.TestCase):
diff --git a/Lib/test/test_py_compile.py b/Lib/test/test_py_compile.py
index e6791c6..5ed98db 100644
--- a/Lib/test/test_py_compile.py
+++ b/Lib/test/test_py_compile.py
@@ -10,14 +10,14 @@
 import unittest
 
 from test import support
-from test.support import script_helper
+from test.support import os_helper, script_helper
 
 
 def without_source_date_epoch(fxn):
     """Runs function with SOURCE_DATE_EPOCH unset."""
     @functools.wraps(fxn)
     def wrapper(*args, **kwargs):
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env.unset('SOURCE_DATE_EPOCH')
             return fxn(*args, **kwargs)
     return wrapper
@@ -27,7 +27,7 @@
     """Runs function with SOURCE_DATE_EPOCH set."""
     @functools.wraps(fxn)
     def wrapper(*args, **kwargs):
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env['SOURCE_DATE_EPOCH'] = '123456789'
             return fxn(*args, **kwargs)
     return wrapper
@@ -103,7 +103,7 @@
         self.assertTrue(os.path.exists(self.cache_path))
 
     def test_cwd(self):
-        with support.change_cwd(self.directory):
+        with os_helper.change_cwd(self.directory):
             py_compile.compile(os.path.basename(self.source_path),
                                os.path.basename(self.pyc_path))
         self.assertTrue(os.path.exists(self.pyc_path))
@@ -228,7 +228,7 @@
             file.write('x = 123\n')
 
     def tearDown(self):
-        support.rmtree(self.directory)
+        os_helper.rmtree(self.directory)
 
     def pycompilecmd(self, *args, **kwargs):
         # assert_python_* helpers don't return proc object. We'll just use
@@ -264,12 +264,26 @@
         self.assertEqual(stdout, b'')
         self.assertIn(b'SyntaxError', stderr)
 
+    def test_bad_syntax_with_quiet(self):
+        bad_syntax = os.path.join(os.path.dirname(__file__), 'badsyntax_3131.py')
+        rc, stdout, stderr = self.pycompilecmd_failure('-q', bad_syntax)
+        self.assertEqual(rc, 1)
+        self.assertEqual(stdout, b'')
+        self.assertEqual(stderr, b'')
+
     def test_file_not_exists(self):
         should_not_exists = os.path.join(os.path.dirname(__file__), 'should_not_exists.py')
         rc, stdout, stderr = self.pycompilecmd_failure(self.source_path, should_not_exists)
         self.assertEqual(rc, 1)
         self.assertEqual(stdout, b'')
-        self.assertIn(b'No such file or directory', stderr)
+        self.assertIn(b'no such file or directory', stderr.lower())
+
+    def test_file_not_exists_with_quiet(self):
+        should_not_exists = os.path.join(os.path.dirname(__file__), 'should_not_exists.py')
+        rc, stdout, stderr = self.pycompilecmd_failure('-q', self.source_path, should_not_exists)
+        self.assertEqual(rc, 1)
+        self.assertEqual(stdout, b'')
+        self.assertEqual(stderr, b'')
 
 
 if __name__ == "__main__":
diff --git a/Lib/test/test_pyclbr.py b/Lib/test/test_pyclbr.py
index 869799c..82c1ebb 100644
--- a/Lib/test/test_pyclbr.py
+++ b/Lib/test/test_pyclbr.py
@@ -150,9 +150,6 @@
         self.checkModule('difflib', ignore=("Match",))
 
     def test_decorators(self):
-        # XXX: See comment in pyclbr_input.py for a test that would fail
-        #      if it were not commented out.
-        #
         self.checkModule('test.pyclbr_input', ignore=['om'])
 
     def test_nested(self):
@@ -160,10 +157,10 @@
         # Set arguments for descriptor creation and _creat_tree call.
         m, p, f, t, i = 'test', '', 'test.py', {}, None
         source = dedent("""\
-        def f0:
+        def f0():
             def f1(a,b,c):
                 def f2(a=1, b=2, c=3): pass
-                    return f1(a,b,d)
+                return f1(a,b,d)
             class c1: pass
         class C0:
             "Test class."
@@ -179,15 +176,15 @@
         actual = mb._create_tree(m, p, f, source, t, i)
 
         # Create descriptors, linked together, and expected dict.
-        f0 = mb.Function(m, 'f0', f, 1)
-        f1 = mb._nest_function(f0, 'f1', 2)
-        f2 = mb._nest_function(f1, 'f2', 3)
-        c1 = mb._nest_class(f0, 'c1', 5)
-        C0 = mb.Class(m, 'C0', None, f, 6)
-        F1 = mb._nest_function(C0, 'F1', 8)
-        C1 = mb._nest_class(C0, 'C1', 11)
-        C2 = mb._nest_class(C1, 'C2', 12)
-        F3 = mb._nest_function(C2, 'F3', 14)
+        f0 = mb.Function(m, 'f0', f, 1, end_lineno=5)
+        f1 = mb._nest_function(f0, 'f1', 2, 4)
+        f2 = mb._nest_function(f1, 'f2', 3, 3)
+        c1 = mb._nest_class(f0, 'c1', 5, 5)
+        C0 = mb.Class(m, 'C0', None, f, 6, end_lineno=14)
+        F1 = mb._nest_function(C0, 'F1', 8, 10)
+        C1 = mb._nest_class(C0, 'C1', 11, 14)
+        C2 = mb._nest_class(C1, 'C2', 12, 14)
+        F3 = mb._nest_function(C2, 'F3', 14, 14)
         expected = {'f0':f0, 'C0':C0}
 
         def compare(parent1, children1, parent2, children2):
@@ -206,8 +203,8 @@
                 self.assertIs(ob.parent, parent2)
             for key in children1.keys():
                 o1, o2 = children1[key], children2[key]
-                t1 = type(o1), o1.name, o1.file, o1.module, o1.lineno
-                t2 = type(o2), o2.name, o2.file, o2.module, o2.lineno
+                t1 = type(o1), o1.name, o1.file, o1.module, o1.lineno, o1.end_lineno
+                t2 = type(o2), o2.name, o2.file, o2.module, o2.lineno, o2.end_lineno
                 self.assertEqual(t1, t2)
                 if type(o1) is mb.Class:
                     self.assertEqual(o1.methods, o2.methods)
diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py
index ffabb7f..44c1698 100644
--- a/Lib/test/test_pydoc.py
+++ b/Lib/test/test_pydoc.py
@@ -23,12 +23,12 @@
 import textwrap
 from io import StringIO
 from collections import namedtuple
+from test.support import os_helper
 from test.support.script_helper import assert_python_ok
-from test.support import (
-    TESTFN, rmtree,
-    reap_children, reap_threads, captured_output, captured_stdout,
-    captured_stderr, unlink, requires_docstrings
-)
+from test.support import threading_helper
+from test.support import (reap_children, captured_output, captured_stdout,
+                          captured_stderr, requires_docstrings)
+from test.support.os_helper import (TESTFN, rmtree, unlink)
 from test import pydoc_mod
 
 
@@ -727,7 +727,7 @@
         self.assertEqual(synopsis, expected)
 
     def test_synopsis_sourceless_empty_doc(self):
-        with test.support.temp_cwd() as test_dir:
+        with os_helper.temp_cwd() as test_dir:
             init_path = os.path.join(test_dir, 'foomod42.py')
             cached_path = importlib.util.cache_from_source(init_path)
             with open(init_path, 'w') as fobj:
@@ -744,11 +744,11 @@
                          ('I Am A Doc', '\nHere is my description'))
 
     def test_is_package_when_not_package(self):
-        with test.support.temp_cwd() as test_dir:
+        with os_helper.temp_cwd() as test_dir:
             self.assertFalse(pydoc.ispackage(test_dir))
 
     def test_is_package_when_is_package(self):
-        with test.support.temp_cwd() as test_dir:
+        with os_helper.temp_cwd() as test_dir:
             init_path = os.path.join(test_dir, '__init__.py')
             open(init_path, 'w').close()
             self.assertTrue(pydoc.ispackage(test_dir))
@@ -1142,7 +1142,8 @@
                 '''A static method'''
                 ...
         self.assertEqual(self._get_summary_lines(X.__dict__['sm']),
-                         "<staticmethod object>")
+                         'sm(x, y)\n'
+                         '    A static method\n')
         self.assertEqual(self._get_summary_lines(X.sm), """\
 sm(x, y)
     A static method
@@ -1162,7 +1163,8 @@
                 '''A class method'''
                 ...
         self.assertEqual(self._get_summary_lines(X.__dict__['cm']),
-                         "<classmethod object>")
+                         'cm(...)\n'
+                         '    A class method\n')
         self.assertEqual(self._get_summary_lines(X.cm), """\
 cm(x) method of builtins.type instance
     A class method
@@ -1374,18 +1376,12 @@
             ("topic?key=def", "Pydoc: KEYWORD def"),
             ("topic?key=STRINGS", "Pydoc: TOPIC STRINGS"),
             ("foobar", "Pydoc: Error - foobar"),
-            ("getfile?key=foobar", "Pydoc: Error - getfile?key=foobar"),
             ]
 
         with self.restrict_walk_packages():
             for url, title in requests:
                 self.call_url_handler(url, title)
 
-            path = string.__file__
-            title = "Pydoc: getfile " + path
-            url = "getfile?key=" + path
-            self.call_url_handler(url, title)
-
 
 class TestHelper(unittest.TestCase):
     def test_keywords(self):
@@ -1575,20 +1571,11 @@
                 self.assertIsNone(self._get_revised_path(trailing_argv0dir))
 
 
-@reap_threads
-def test_main():
-    try:
-        test.support.run_unittest(PydocDocTest,
-                                  PydocImportTest,
-                                  TestDescriptions,
-                                  PydocServerTest,
-                                  PydocUrlHandlerTest,
-                                  TestHelper,
-                                  PydocWithMetaClasses,
-                                  TestInternalUtilities,
-                                  )
-    finally:
-        reap_children()
+def setUpModule():
+    thread_info = threading_helper.threading_setup()
+    unittest.addModuleCleanup(threading_helper.threading_cleanup, *thread_info)
+    unittest.addModuleCleanup(reap_children)
+
 
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_queue.py b/Lib/test/test_queue.py
index d88e28a..cfa6003 100644
--- a/Lib/test/test_queue.py
+++ b/Lib/test/test_queue.py
@@ -6,10 +6,13 @@
 import time
 import unittest
 import weakref
-from test import support
+from test.support import gc_collect
+from test.support import import_helper
+from test.support import threading_helper
 
-py_queue = support.import_fresh_module('queue', blocked=['_queue'])
-c_queue = support.import_fresh_module('queue', fresh=['_queue'])
+
+py_queue = import_helper.import_fresh_module('queue', blocked=['_queue'])
+c_queue = import_helper.import_fresh_module('queue', fresh=['_queue'])
 need_c_queue = unittest.skipUnless(c_queue, "No _queue module found")
 
 QUEUE_SIZE = 5
@@ -63,7 +66,7 @@
                           block_func)
             return self.result
         finally:
-            support.join_thread(thread) # make sure the thread terminates
+            threading_helper.join_thread(thread) # make sure the thread terminates
 
     # Call this instead if block_func is supposed to raise an exception.
     def do_exceptional_blocking_test(self,block_func, block_args, trigger_func,
@@ -79,7 +82,7 @@
                 self.fail("expected exception of kind %r" %
                                  expected_exception_class)
         finally:
-            support.join_thread(thread) # make sure the thread terminates
+            threading_helper.join_thread(thread) # make sure the thread terminates
             if not thread.startedEvent.is_set():
                 self.fail("trigger thread ended but event never set")
 
@@ -417,11 +420,12 @@
     def setUp(self):
         self.q = self.type2test()
 
-    def feed(self, q, seq, rnd):
+    def feed(self, q, seq, rnd, sentinel):
         while True:
             try:
                 val = seq.pop()
             except IndexError:
+                q.put(sentinel)
                 return
             q.put(val)
             if rnd.random() > 0.5:
@@ -460,11 +464,10 @@
                 return
             results.append(val)
 
-    def run_threads(self, n_feeders, n_consumers, q, inputs,
-                    feed_func, consume_func):
+    def run_threads(self, n_threads, q, inputs, feed_func, consume_func):
         results = []
         sentinel = None
-        seq = inputs + [sentinel] * n_consumers
+        seq = inputs.copy()
         seq.reverse()
         rnd = random.Random(42)
 
@@ -478,13 +481,13 @@
             return wrapper
 
         feeders = [threading.Thread(target=log_exceptions(feed_func),
-                                    args=(q, seq, rnd))
-                   for i in range(n_feeders)]
+                                    args=(q, seq, rnd, sentinel))
+                   for i in range(n_threads)]
         consumers = [threading.Thread(target=log_exceptions(consume_func),
                                       args=(q, results, sentinel))
-                     for i in range(n_consumers)]
+                     for i in range(n_threads)]
 
-        with support.start_threads(feeders + consumers):
+        with threading_helper.start_threads(feeders + consumers):
             pass
 
         self.assertFalse(exceptions)
@@ -540,7 +543,7 @@
         # Test a pair of concurrent put() and get()
         q = self.q
         inputs = list(range(100))
-        results = self.run_threads(1, 1, q, inputs, self.feed, self.consume)
+        results = self.run_threads(1, q, inputs, self.feed, self.consume)
 
         # One producer, one consumer => results appended in well-defined order
         self.assertEqual(results, inputs)
@@ -550,7 +553,7 @@
         N = 50
         q = self.q
         inputs = list(range(10000))
-        results = self.run_threads(N, N, q, inputs, self.feed, self.consume)
+        results = self.run_threads(N, q, inputs, self.feed, self.consume)
 
         # Multiple consumers without synchronization append the
         # results in random order
@@ -561,7 +564,7 @@
         N = 50
         q = self.q
         inputs = list(range(10000))
-        results = self.run_threads(N, N, q, inputs,
+        results = self.run_threads(N, q, inputs,
                                    self.feed, self.consume_nonblock)
 
         self.assertEqual(sorted(results), inputs)
@@ -571,7 +574,7 @@
         N = 50
         q = self.q
         inputs = list(range(1000))
-        results = self.run_threads(N, N, q, inputs,
+        results = self.run_threads(N, q, inputs,
                                    self.feed, self.consume_timeout)
 
         self.assertEqual(sorted(results), inputs)
@@ -588,6 +591,7 @@
             q.put(C())
         for i in range(N):
             wr = weakref.ref(q.get())
+            gc_collect()  # For PyPy or other GCs.
             self.assertIsNone(wr())
 
 
diff --git a/Lib/test/test_raise.py b/Lib/test/test_raise.py
index 57da0e1..5936d75 100644
--- a/Lib/test/test_raise.py
+++ b/Lib/test/test_raise.py
@@ -12,8 +12,8 @@
 def get_tb():
     try:
         raise OSError()
-    except:
-        return sys.exc_info()[2]
+    except OSError as e:
+        return e.__traceback__
 
 
 class Context:
@@ -303,7 +303,7 @@
             except:
                 raise OSError()
         except OSError as e:
-            self.assertEqual(e.__context__, context)
+            self.assertIs(e.__context__, context)
         else:
             self.fail("No exception raised")
 
@@ -315,7 +315,7 @@
             except:
                 raise OSError()
         except OSError as e:
-            self.assertNotEqual(e.__context__, context)
+            self.assertIsNot(e.__context__, context)
             self.assertIsInstance(e.__context__, context)
         else:
             self.fail("No exception raised")
@@ -328,7 +328,7 @@
             except:
                 raise OSError
         except OSError as e:
-            self.assertNotEqual(e.__context__, context)
+            self.assertIsNot(e.__context__, context)
             self.assertIsInstance(e.__context__, context)
         else:
             self.fail("No exception raised")
@@ -415,6 +415,22 @@
         except NameError as e:
             self.assertIsNone(e.__context__.__context__)
 
+    def test_not_last(self):
+        # Context is not necessarily the last exception
+        context = Exception("context")
+        try:
+            raise context
+        except Exception:
+            try:
+                raise Exception("caught")
+            except Exception:
+                pass
+            try:
+                raise Exception("new")
+            except Exception as exc:
+                raised = exc
+        self.assertIs(raised.__context__, context)
+
     def test_3118(self):
         # deleting the generator caused the __context__ to be cleared
         def gen():
@@ -438,6 +454,7 @@
         f()
 
     def test_3611(self):
+        import gc
         # A re-raised exception in a __del__ caused the __context__
         # to be cleared
         class C:
@@ -451,9 +468,11 @@
             x = C()
             try:
                 try:
-                    x.x
+                    f.x
                 except AttributeError:
+                    # make x.__del__ trigger
                     del x
+                    gc.collect()  # For PyPy or other GCs.
                     raise TypeError
             except Exception as e:
                 self.assertNotEqual(e.__context__, None)
diff --git a/Lib/test/test_random.py b/Lib/test/test_random.py
index a80e71e..5354edd 100644
--- a/Lib/test/test_random.py
+++ b/Lib/test/test_random.py
@@ -11,7 +11,7 @@
 from math import log, exp, pi, fsum, sin, factorial
 from test import support
 from fractions import Fraction
-from collections import Counter
+from collections import abc, Counter
 
 class TestBasicOps:
     # Superclass with tests common to all generators.
@@ -57,6 +57,11 @@
         self.assertRaises(TypeError, self.gen.seed, 1, 2, 3, 4)
         self.assertRaises(TypeError, type(self.gen), [])
 
+    def test_seed_no_mutate_bug_44018(self):
+        a = bytearray(b'1234')
+        self.gen.seed(a)
+        self.assertEqual(a, bytearray(b'1234'))
+
     @unittest.mock.patch('random._urandom') # os.urandom
     def test_seed_when_randomness_source_not_found(self, urandom_mock):
         # Random.seed() uses time.time() when an operating system specific
@@ -163,6 +168,22 @@
             population = {10, 20, 30, 40, 50, 60, 70}
             self.gen.sample(population, k=5)
 
+    def test_sample_on_seqsets(self):
+        class SeqSet(abc.Sequence, abc.Set):
+            def __init__(self, items):
+                self._items = items
+
+            def __len__(self):
+                return len(self._items)
+
+            def __getitem__(self, index):
+                return self._items[index]
+
+        population = SeqSet([2, 4, 1, 3])
+        with warnings.catch_warnings():
+            warnings.simplefilter("error", DeprecationWarning)
+            self.gen.sample(population, k=2)
+
     def test_sample_with_counts(self):
         sample = self.gen.sample
 
@@ -207,33 +228,6 @@
         with self.assertRaises(ValueError):
             sample(['red', 'green', 'blue'], counts=[1, 2, 3, 4], k=2)      # too many counts
 
-    def test_sample_counts_equivalence(self):
-        # Test the documented strong equivalence to a sample with repeated elements.
-        # We run this test on random.Random() which makes deterministic selections
-        # for a given seed value.
-        sample = random.sample
-        seed = random.seed
-
-        colors =  ['red', 'green', 'blue', 'orange', 'black', 'amber']
-        counts = [500,      200,     20,       10,       5,       1 ]
-        k = 700
-        seed(8675309)
-        s1 = sample(colors, counts=counts, k=k)
-        seed(8675309)
-        expanded = [color for (color, count) in zip(colors, counts) for i in range(count)]
-        self.assertEqual(len(expanded), sum(counts))
-        s2 = sample(expanded, k=k)
-        self.assertEqual(s1, s2)
-
-        pop = 'abcdefghi'
-        counts = [10, 9, 8, 7, 6, 5, 4, 3, 2]
-        seed(8675309)
-        s1 = ''.join(sample(pop, counts=counts, k=30))
-        expanded = ''.join([letter for (letter, count) in zip(pop, counts) for i in range(count)])
-        seed(8675309)
-        s2 = ''.join(sample(expanded, k=30))
-        self.assertEqual(s1, s2)
-
     def test_choices(self):
         choices = self.gen.choices
         data = ['red', 'green', 'blue', 'yellow']
@@ -324,6 +318,22 @@
         with self.assertRaises(ValueError):
             self.gen.choices('AB', [0.0, 0.0])
 
+    def test_choices_negative_total(self):
+        with self.assertRaises(ValueError):
+            self.gen.choices('ABC', [3, -5, 1])
+
+    def test_choices_infinite_total(self):
+        with self.assertRaises(ValueError):
+            self.gen.choices('A', [float('inf')])
+        with self.assertRaises(ValueError):
+            self.gen.choices('AB', [0.0, float('inf')])
+        with self.assertRaises(ValueError):
+            self.gen.choices('AB', [-float('inf'), 123])
+        with self.assertRaises(ValueError):
+            self.gen.choices('AB', [0.0, float('nan')])
+        with self.assertRaises(ValueError):
+            self.gen.choices('AB', [float('-inf'), float('inf')])
+
     def test_gauss(self):
         # Ensure that the seed() method initializes all the hidden state.  In
         # particular, through 2.2.1 it failed to reset a piece of state used
@@ -382,6 +392,15 @@
             r = _random.Random()
             self.assertRaises(TypeError, pickle.dumps, r, proto)
 
+    @test.support.cpython_only
+    def test_bug_42008(self):
+        # _random.Random should call seed with first element of arg tuple
+        import _random
+        r1 = _random.Random()
+        r1.seed(8675309)
+        r2 = _random.Random(8675309)
+        self.assertEqual(r1.random(), r2.random())
+
     def test_bug_1727780(self):
         # verify that version-2-pickles can be loaded
         # fine, whether they are created on 32-bit or 64-bit
@@ -495,11 +514,52 @@
         raises(-721)
         raises(0, 100, -12)
         # Non-integer start/stop
-        raises(3.14159)
-        raises(0, 2.71828)
+        self.assertWarns(DeprecationWarning, raises, 3.14159)
+        self.assertWarns(DeprecationWarning, self.gen.randrange, 3.0)
+        self.assertWarns(DeprecationWarning, self.gen.randrange, Fraction(3, 1))
+        self.assertWarns(DeprecationWarning, raises, '3')
+        self.assertWarns(DeprecationWarning, raises, 0, 2.71828)
+        self.assertWarns(DeprecationWarning, self.gen.randrange, 0, 2.0)
+        self.assertWarns(DeprecationWarning, self.gen.randrange, 0, Fraction(2, 1))
+        self.assertWarns(DeprecationWarning, raises, 0, '2')
         # Zero and non-integer step
         raises(0, 42, 0)
-        raises(0, 42, 3.14159)
+        self.assertWarns(DeprecationWarning, raises, 0, 42, 0.0)
+        self.assertWarns(DeprecationWarning, raises, 0, 0, 0.0)
+        self.assertWarns(DeprecationWarning, raises, 0, 42, 3.14159)
+        self.assertWarns(DeprecationWarning, self.gen.randrange, 0, 42, 3.0)
+        self.assertWarns(DeprecationWarning, self.gen.randrange, 0, 42, Fraction(3, 1))
+        self.assertWarns(DeprecationWarning, raises, 0, 42, '3')
+        self.assertWarns(DeprecationWarning, self.gen.randrange, 0, 42, 1.0)
+        self.assertWarns(DeprecationWarning, raises, 0, 0, 1.0)
+
+    def test_randrange_argument_handling(self):
+        randrange = self.gen.randrange
+        with self.assertWarns(DeprecationWarning):
+            randrange(10.0, 20, 2)
+        with self.assertWarns(DeprecationWarning):
+            randrange(10, 20.0, 2)
+        with self.assertWarns(DeprecationWarning):
+            randrange(10, 20, 1.0)
+        with self.assertWarns(DeprecationWarning):
+            randrange(10, 20, 2.0)
+        with self.assertWarns(DeprecationWarning):
+            with self.assertRaises(ValueError):
+                randrange(10.5)
+        with self.assertWarns(DeprecationWarning):
+            with self.assertRaises(ValueError):
+                randrange(10, 20.5)
+        with self.assertWarns(DeprecationWarning):
+            with self.assertRaises(ValueError):
+                randrange(10, 20, 1.5)
+
+    def test_randrange_step(self):
+        # bpo-42772: When stop is None, the step argument was being ignored.
+        randrange = self.gen.randrange
+        with self.assertRaises(TypeError):
+            randrange(1000, step=100)
+        with self.assertRaises(TypeError):
+            randrange(1000, None, step=100)
 
     def test_randbelow_logic(self, _log=log, int=int):
         # check bitcount transition points:  2**i and 2**(i+1)-1
@@ -888,6 +948,33 @@
             self.assertEqual(self.gen.randbytes(n),
                              gen2.getrandbits(n * 8).to_bytes(n, 'little'))
 
+    def test_sample_counts_equivalence(self):
+        # Test the documented strong equivalence to a sample with repeated elements.
+        # We run this test on random.Random() which makes deterministic selections
+        # for a given seed value.
+        sample = self.gen.sample
+        seed = self.gen.seed
+
+        colors =  ['red', 'green', 'blue', 'orange', 'black', 'amber']
+        counts = [500,      200,     20,       10,       5,       1 ]
+        k = 700
+        seed(8675309)
+        s1 = sample(colors, counts=counts, k=k)
+        seed(8675309)
+        expanded = [color for (color, count) in zip(colors, counts) for i in range(count)]
+        self.assertEqual(len(expanded), sum(counts))
+        s2 = sample(expanded, k=k)
+        self.assertEqual(s1, s2)
+
+        pop = 'abcdefghi'
+        counts = [10, 9, 8, 7, 6, 5, 4, 3, 2]
+        seed(8675309)
+        s1 = ''.join(sample(pop, counts=counts, k=30))
+        expanded = ''.join([letter for (letter, count) in zip(pop, counts) for i in range(count)])
+        seed(8675309)
+        s2 = ''.join(sample(expanded, k=30))
+        self.assertEqual(s1, s2)
+
 
 def gamma(z, sqrt2pi=(2.0*pi)**0.5):
     # Reflection to right half of complex plane
diff --git a/Lib/test/test_range.py b/Lib/test/test_range.py
index 30fa129..851ad5b 100644
--- a/Lib/test/test_range.py
+++ b/Lib/test/test_range.py
@@ -374,26 +374,47 @@
                                      list(r))
 
     def test_iterator_pickling(self):
-        testcases = [(13,), (0, 11), (-22, 10), (20, 3, -1),
-                     (13, 21, 3), (-2, 2, 2), (2**65, 2**65+2)]
+        testcases = [(13,), (0, 11), (-22, 10), (20, 3, -1), (13, 21, 3),
+                     (-2, 2, 2)]
+        for M in 2**31, 2**63:
+            testcases += [
+                (M-3, M-1), (4*M, 4*M+2),
+                (M-2, M-1, 2), (-M+1, -M, -2),
+                (1, 2, M-1), (-1, -2, -M),
+                (1, M-1, M-1), (-1, -M, -M),
+            ]
         for proto in range(pickle.HIGHEST_PROTOCOL + 1):
             for t in testcases:
-                it = itorg = iter(range(*t))
-                data = list(range(*t))
+                with self.subTest(proto=proto, t=t):
+                    it = itorg = iter(range(*t))
+                    data = list(range(*t))
 
+                    d = pickle.dumps(it, proto)
+                    it = pickle.loads(d)
+                    self.assertEqual(type(itorg), type(it))
+                    self.assertEqual(list(it), data)
+
+                    it = pickle.loads(d)
+                    try:
+                        next(it)
+                    except StopIteration:
+                        continue
+                    d = pickle.dumps(it, proto)
+                    it = pickle.loads(d)
+                    self.assertEqual(list(it), data[1:])
+
+    def test_iterator_pickling_overflowing_index(self):
+        for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+            with self.subTest(proto=proto):
+                it = iter(range(2**32 + 2))
+                _, _, idx = it.__reduce__()
+                self.assertEqual(idx, 0)
+                it.__setstate__(2**32 + 1)  # undocumented way to set r->index
+                _, _, idx = it.__reduce__()
+                self.assertEqual(idx, 2**32 + 1)
                 d = pickle.dumps(it, proto)
                 it = pickle.loads(d)
-                self.assertEqual(type(itorg), type(it))
-                self.assertEqual(list(it), data)
-
-                it = pickle.loads(d)
-                try:
-                    next(it)
-                except StopIteration:
-                    continue
-                d = pickle.dumps(it, proto)
-                it = pickle.loads(d)
-                self.assertEqual(list(it), data[1:])
+                self.assertEqual(next(it), 2**32 + 1)
 
     def test_exhausted_iterator_pickling(self):
         for proto in range(pickle.HIGHEST_PROTOCOL + 1):
@@ -648,11 +669,17 @@
         self.assert_attrs(range(0, 10, 3), 0, 10, 3)
         self.assert_attrs(range(10, 0, -1), 10, 0, -1)
         self.assert_attrs(range(10, 0, -3), 10, 0, -3)
+        self.assert_attrs(range(True), 0, 1, 1)
+        self.assert_attrs(range(False, True), 0, 1, 1)
+        self.assert_attrs(range(False, True, True), 0, 1, 1)
 
     def assert_attrs(self, rangeobj, start, stop, step):
         self.assertEqual(rangeobj.start, start)
         self.assertEqual(rangeobj.stop, stop)
         self.assertEqual(rangeobj.step, step)
+        self.assertIs(type(rangeobj.start), int)
+        self.assertIs(type(rangeobj.stop), int)
+        self.assertIs(type(rangeobj.step), int)
 
         with self.assertRaises(AttributeError):
             rangeobj.start = 0
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py
index 1bfbcb8..588cc79 100644
--- a/Lib/test/test_re.py
+++ b/Lib/test/test_re.py
@@ -1,5 +1,6 @@
 from test.support import (gc_collect, bigmemtest, _2G,
-                          cpython_only, captured_stdout)
+                          cpython_only, captured_stdout,
+                          check_disallow_instantiation)
 import locale
 import re
 import sre_compile
@@ -2188,6 +2189,18 @@
     Test implementation details of the re module.
     """
 
+    @cpython_only
+    def test_immutable(self):
+        # bpo-43908: check that re types are immutable
+        with self.assertRaises(TypeError):
+            re.Match.foo = 1
+        with self.assertRaises(TypeError):
+            re.Pattern.foo = 1
+        with self.assertRaises(TypeError):
+            pat = re.compile("")
+            tp = type(pat.scanner(""))
+            tp.foo = 1
+
     def test_overlap_table(self):
         f = sre_compile._generate_overlap_table
         self.assertEqual(f(""), [])
@@ -2197,6 +2210,18 @@
         self.assertEqual(f("ababba"), [0, 0, 1, 2, 0, 1])
         self.assertEqual(f("abcabdac"), [0, 0, 0, 1, 2, 0, 1, 0])
 
+    def test_signedness(self):
+        self.assertGreaterEqual(sre_compile.MAXREPEAT, 0)
+        self.assertGreaterEqual(sre_compile.MAXGROUPS, 0)
+
+    @cpython_only
+    def test_disallow_instantiation(self):
+        # Ensure that the type disallows instantiation (bpo-43916)
+        check_disallow_instantiation(self, re.Match)
+        check_disallow_instantiation(self, re.Pattern)
+        pat = re.compile("")
+        check_disallow_instantiation(self, type(pat.scanner("")))
+
 
 class ExternalTests(unittest.TestCase):
 
diff --git a/Lib/test/test_readline.py b/Lib/test/test_readline.py
index 67ee9b7..59dbef9 100644
--- a/Lib/test/test_readline.py
+++ b/Lib/test/test_readline.py
@@ -10,7 +10,9 @@
 import sys
 import tempfile
 import unittest
-from test.support import import_module, unlink, temp_dir, TESTFN, verbose
+from test.support import verbose
+from test.support.import_helper import import_module
+from test.support.os_helper import unlink, temp_dir, TESTFN
 from test.support.script_helper import assert_python_ok
 
 # Skip tests if there is no readline module
@@ -100,8 +102,15 @@
 
         # test 'no such file' behaviour
         os.unlink(hfilename)
-        with self.assertRaises(FileNotFoundError):
+        try:
             readline.append_history_file(1, hfilename)
+        except FileNotFoundError:
+            pass  # Some implementations return this error (libreadline).
+        else:
+            os.unlink(hfilename)  # Some create it anyways (libedit).
+            # If the file wasn't created, unlink will fail.
+        # We're just testing that one of the two expected behaviors happens
+        # instead of an incorrect error.
 
         # write_history_file can create the target
         readline.write_history_file(hfilename)
@@ -147,11 +156,15 @@
 
     def test_auto_history_enabled(self):
         output = run_pty(self.auto_history_script.format(True))
-        self.assertIn(b"History length: 1\r\n", output)
+        # bpo-44949: Sometimes, the newline character is not written at the
+        # end, so don't expect it in the output.
+        self.assertIn(b"History length: 1", output)
 
     def test_auto_history_disabled(self):
         output = run_pty(self.auto_history_script.format(False))
-        self.assertIn(b"History length: 0\r\n", output)
+        # bpo-44949: Sometimes, the newline character is not written at the
+        # end, so don't expect it in the output.
+        self.assertIn(b"History length: 0", output)
 
     def test_nonascii(self):
         loc = locale.setlocale(locale.LC_CTYPE, None)
@@ -226,13 +239,25 @@
         output = run_pty(script, input)
         self.assertIn(b"text 't\\xeb'\r\n", output)
         self.assertIn(b"line '[\\xefnserted]|t\\xeb[after]'\r\n", output)
-        self.assertIn(b"indexes 11 13\r\n", output)
+        if sys.platform == "darwin" or not is_editline:
+            self.assertIn(b"indexes 11 13\r\n", output)
+            # Non-macOS libedit does not handle non-ASCII bytes
+            # the same way and generates character indices
+            # rather than byte indices via get_begidx() and
+            # get_endidx().  Ex: libedit2 3.1-20191231-2 on Debian
+            # winds up with "indexes 10 12".  Stemming from the
+            # start and end values calls back into readline.c's
+            # rl_attempted_completion_function = flex_complete with:
+            # (11, 13) instead of libreadline's (12, 15).
+
         if not is_editline and hasattr(readline, "set_pre_input_hook"):
             self.assertIn(b"substitution 't\\xeb'\r\n", output)
             self.assertIn(b"matches ['t\\xebnt', 't\\xebxt']\r\n", output)
         expected = br"'[\xefnserted]|t\xebxt[after]'"
         self.assertIn(b"result " + expected + b"\r\n", output)
-        self.assertIn(b"history " + expected + b"\r\n", output)
+        # bpo-45195: Sometimes, the newline character is not written at the
+        # end, so don't expect it in the output.
+        self.assertIn(b"history " + expected, output)
 
     # We have 2 reasons to skip this test:
     # - readline: history size was added in 6.0
diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py
index a77638b..3780fee 100644
--- a/Lib/test/test_regrtest.py
+++ b/Lib/test/test_regrtest.py
@@ -15,10 +15,12 @@
 import sysconfig
 import tempfile
 import textwrap
+import time
 import unittest
 from test import libregrtest
 from test import support
-from test.libregrtest import utils
+from test.support import os_helper
+from test.libregrtest import utils, setup
 
 
 Py_DEBUG = hasattr(sys, 'gettotalrefcount')
@@ -161,12 +163,12 @@
                 self.assertEqual(ns.ignore_tests, ['pattern'])
                 self.checkError([opt], 'expected one argument')
 
-        self.addCleanup(support.unlink, support.TESTFN)
-        with open(support.TESTFN, "w") as fp:
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
+        with open(os_helper.TESTFN, "w") as fp:
             print('matchfile1', file=fp)
             print('matchfile2', file=fp)
 
-        filename = os.path.abspath(support.TESTFN)
+        filename = os.path.abspath(os_helper.TESTFN)
         ns = libregrtest._parse_args(['-m', 'match',
                                       '--ignorefile', filename])
         self.assertEqual(ns.ignore_tests,
@@ -183,12 +185,12 @@
                                       '-m', 'pattern2'])
         self.assertEqual(ns.match_tests, ['pattern1', 'pattern2'])
 
-        self.addCleanup(support.unlink, support.TESTFN)
-        with open(support.TESTFN, "w") as fp:
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
+        with open(os_helper.TESTFN, "w") as fp:
             print('matchfile1', file=fp)
             print('matchfile2', file=fp)
 
-        filename = os.path.abspath(support.TESTFN)
+        filename = os.path.abspath(os_helper.TESTFN)
         ns = libregrtest._parse_args(['-m', 'match',
                                       '--matchfile', filename])
         self.assertEqual(ns.match_tests,
@@ -237,7 +239,7 @@
 
     def test_testdir(self):
         ns = libregrtest._parse_args(['--testdir', 'foo'])
-        self.assertEqual(ns.testdir, os.path.join(support.SAVEDCWD, 'foo'))
+        self.assertEqual(ns.testdir, os.path.join(os_helper.SAVEDCWD, 'foo'))
         self.checkError(['--testdir'], 'expected one argument')
 
     def test_runleaks(self):
@@ -284,7 +286,7 @@
             with self.subTest(opt=opt):
                 ns = libregrtest._parse_args([opt, 'foo'])
                 self.assertEqual(ns.coverdir,
-                                 os.path.join(support.SAVEDCWD, 'foo'))
+                                 os.path.join(os_helper.SAVEDCWD, 'foo'))
                 self.checkError([opt], 'expected one argument')
 
     def test_nocoverdir(self):
@@ -363,7 +365,7 @@
         self.testdir = os.path.realpath(os.path.dirname(__file__))
 
         self.tmptestdir = tempfile.mkdtemp()
-        self.addCleanup(support.rmtree, self.tmptestdir)
+        self.addCleanup(os_helper.rmtree, self.tmptestdir)
 
     def create_test(self, name=None, code=None):
         if not name:
@@ -384,7 +386,7 @@
         name = self.TESTNAME_PREFIX + name
         path = os.path.join(self.tmptestdir, name + '.py')
 
-        self.addCleanup(support.unlink, path)
+        self.addCleanup(os_helper.unlink, path)
         # Use 'x' mode to ensure that we do not override existing tests
         try:
             with open(path, 'x', encoding='utf-8') as fp:
@@ -413,7 +415,7 @@
 
     def check_executed_tests(self, output, tests, skipped=(), failed=(),
                              env_changed=(), omitted=(),
-                             rerun=(), no_test_ran=(),
+                             rerun={}, no_test_ran=(),
                              randomize=False, interrupted=False,
                              fail_env_changed=False):
         if isinstance(tests, str):
@@ -426,8 +428,6 @@
             env_changed = [env_changed]
         if isinstance(omitted, str):
             omitted = [omitted]
-        if isinstance(rerun, str):
-            rerun = [rerun]
         if isinstance(no_test_ran, str):
             no_test_ran = [no_test_ran]
 
@@ -465,12 +465,12 @@
             self.check_line(output, regex)
 
         if rerun:
-            regex = list_regex('%s re-run test%s', rerun)
+            regex = list_regex('%s re-run test%s', rerun.keys())
             self.check_line(output, regex)
             regex = LOG_PREFIX + r"Re-running failed tests in verbose mode"
             self.check_line(output, regex)
-            for test_name in rerun:
-                regex = LOG_PREFIX + f"Re-running {test_name} in verbose mode"
+            for name, match in rerun.items():
+                regex = LOG_PREFIX + f"Re-running {name} in verbose mode \\(matching: {match}\\)"
                 self.check_line(output, regex)
 
         if no_test_ran:
@@ -548,11 +548,10 @@
 
 
 class CheckActualTests(BaseTestCase):
-    """
-    Check that regrtest appears to find the expected set of tests.
-    """
-
     def test_finds_expected_number_of_tests(self):
+        """
+        Check that regrtest appears to find the expected set of tests.
+        """
         args = ['-Wd', '-E', '-bb', '-m', 'test.regrtest', '--list-tests']
         output = self.run_python(args)
         rough_number_of_tests_found = len(output.splitlines())
@@ -770,8 +769,8 @@
         # Write the list of files using a format similar to regrtest output:
         # [1/2] test_1
         # [2/2] test_2
-        filename = support.TESTFN
-        self.addCleanup(support.unlink, filename)
+        filename = os_helper.TESTFN
+        self.addCleanup(os_helper.unlink, filename)
 
         # test format '0:00:00 [2/7] test_opcodes -- test_grammar took 0 sec'
         with open(filename, "w") as fp:
@@ -886,7 +885,7 @@
         test = self.create_test('huntrleaks', code=code)
 
         filename = 'reflog.txt'
-        self.addCleanup(support.unlink, filename)
+        self.addCleanup(os_helper.unlink, filename)
         output = self.run_tests('--huntrleaks', '3:3:', test,
                                 exitcode=2,
                                 stderr=subprocess.STDOUT)
@@ -997,8 +996,8 @@
         testname = self.create_test(code=code)
 
         # only run a subset
-        filename = support.TESTFN
-        self.addCleanup(support.unlink, filename)
+        filename = os_helper.TESTFN
+        self.addCleanup(os_helper.unlink, filename)
 
         subset = [
             # only ignore the method name
@@ -1038,8 +1037,8 @@
         self.assertEqual(methods, all_methods)
 
         # only run a subset
-        filename = support.TESTFN
-        self.addCleanup(support.unlink, filename)
+        filename = os_helper.TESTFN
+        self.addCleanup(os_helper.unlink, filename)
 
         subset = [
             # only match the method name
@@ -1080,15 +1079,18 @@
             import unittest
 
             class Tests(unittest.TestCase):
-                def test_bug(self):
-                    # test always fail
+                def test_succeed(self):
+                    return
+
+                def test_fail_always(self):
+                    # test that always fails
                     self.fail("bug")
         """)
         testname = self.create_test(code=code)
 
         output = self.run_tests("-w", testname, exitcode=2)
         self.check_executed_tests(output, [testname],
-                                  failed=testname, rerun=testname)
+                                  failed=testname, rerun={testname: "test_fail_always"})
 
     def test_rerun_success(self):
         # FAILURE then SUCCESS
@@ -1097,7 +1099,8 @@
             import unittest
 
             class Tests(unittest.TestCase):
-                failed = False
+                def test_succeed(self):
+                    return
 
                 def test_fail_once(self):
                     if not hasattr(builtins, '_test_failed'):
@@ -1108,7 +1111,7 @@
 
         output = self.run_tests("-w", testname, exitcode=0)
         self.check_executed_tests(output, [testname],
-                                  rerun=testname)
+                                  rerun={testname: "test_fail_once"})
 
     def test_no_tests_ran(self):
         code = textwrap.dedent("""
@@ -1235,7 +1238,7 @@
 
     def test_unraisable_exc(self):
         # --fail-env-changed must catch unraisable exception.
-        # The exceptioin must be displayed even if sys.stderr is redirected.
+        # The exception must be displayed even if sys.stderr is redirected.
         code = textwrap.dedent(r"""
             import unittest
             import weakref
@@ -1266,6 +1269,45 @@
         self.assertIn("Warning -- Unraisable exception", output)
         self.assertIn("Exception: weakref callback bug", output)
 
+    def test_threading_excepthook(self):
+        # --fail-env-changed must catch uncaught thread exception.
+        # The exception must be displayed even if sys.stderr is redirected.
+        code = textwrap.dedent(r"""
+            import threading
+            import unittest
+            from test.support import captured_stderr
+
+            class MyObject:
+                pass
+
+            def func_bug():
+                raise Exception("bug in thread")
+
+            class Tests(unittest.TestCase):
+                def test_threading_excepthook(self):
+                    with captured_stderr() as stderr:
+                        thread = threading.Thread(target=func_bug)
+                        thread.start()
+                        thread.join()
+                    self.assertEqual(stderr.getvalue(), '')
+        """)
+        testname = self.create_test(code=code)
+
+        output = self.run_tests("--fail-env-changed", "-v", testname, exitcode=3)
+        self.check_executed_tests(output, [testname],
+                                  env_changed=[testname],
+                                  fail_env_changed=True)
+        self.assertIn("Warning -- Uncaught thread exception", output)
+        self.assertIn("Exception: bug in thread", output)
+
+    def test_unicode_guard_env(self):
+        guard = os.environ.get(setup.UNICODE_GUARD_ENV)
+        self.assertIsNotNone(guard, f"{setup.UNICODE_GUARD_ENV} not set")
+        if guard != "\N{SMILING FACE WITH SUNGLASSES}":
+            # Skip to signify that the env var value was changed by the user;
+            # possibly to something ASCII to work around Unicode issues.
+            self.skipTest("Modified guard")
+
     def test_cleanup(self):
         dirname = os.path.join(self.tmptestdir, "test_python_123")
         os.mkdir(dirname)
diff --git a/Lib/test/test_reprlib.py b/Lib/test/test_reprlib.py
index 4bf9194..0555b71 100644
--- a/Lib/test/test_reprlib.py
+++ b/Lib/test/test_reprlib.py
@@ -10,7 +10,8 @@
 import importlib.util
 import unittest
 
-from test.support import create_empty_file, verbose
+from test.support import verbose
+from test.support.os_helper import create_empty_file
 from reprlib import repr as r # Don't shadow builtin repr
 from reprlib import Repr
 from reprlib import recursive_repr
@@ -202,9 +203,9 @@
         class C:
             def foo(cls): pass
         x = staticmethod(C.foo)
-        self.assertTrue(repr(x).startswith('<staticmethod object at 0x'))
+        self.assertEqual(repr(x), f'<staticmethod({C.foo!r})>')
         x = classmethod(C.foo)
-        self.assertTrue(repr(x).startswith('<classmethod object at 0x'))
+        self.assertEqual(repr(x), f'<classmethod({C.foo!r})>')
 
     def test_unsortable(self):
         # Repr.repr() used to call sorted() on sets, frozensets and dicts
diff --git a/Lib/test/test_resource.py b/Lib/test/test_resource.py
index e5ece52..f2642c6 100644
--- a/Lib/test/test_resource.py
+++ b/Lib/test/test_resource.py
@@ -2,9 +2,11 @@
 import sys
 import unittest
 from test import support
+from test.support import import_helper
+from test.support import os_helper
 import time
 
-resource = support.import_module('resource')
+resource = import_helper.import_module('resource')
 
 # This test is checking a few specific problem spots with the resource module.
 
@@ -51,7 +53,7 @@
                     limit_set = True
                 except ValueError:
                     limit_set = False
-                f = open(support.TESTFN, "wb")
+                f = open(os_helper.TESTFN, "wb")
                 try:
                     f.write(b"X" * 1024)
                     try:
@@ -77,7 +79,7 @@
             finally:
                 if limit_set:
                     resource.setrlimit(resource.RLIMIT_FSIZE, (cur, max))
-                support.unlink(support.TESTFN)
+                os_helper.unlink(os_helper.TESTFN)
 
     def test_fsize_toobig(self):
         # Be sure that setrlimit is checking for really large values
@@ -172,8 +174,5 @@
                          limits)
 
 
-def test_main(verbose=None):
-    support.run_unittest(ResourceTest)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_rlcompleter.py b/Lib/test/test_rlcompleter.py
index 0dc1080..1f7a6ed 100644
--- a/Lib/test/test_rlcompleter.py
+++ b/Lib/test/test_rlcompleter.py
@@ -40,12 +40,12 @@
 
         # test with a customized namespace
         self.assertEqual(self.completer.global_matches('CompleteM'),
-                         ['CompleteMe('])
+                         ['CompleteMe()'])
         self.assertEqual(self.completer.global_matches('eg'),
                          ['egg('])
         # XXX: see issue5256
         self.assertEqual(self.completer.global_matches('CompleteM'),
-                         ['CompleteMe('])
+                         ['CompleteMe()'])
 
     def test_attr_matches(self):
         # test with builtins namespace
@@ -64,7 +64,7 @@
                          ['CompleteMe.spam'])
         self.assertEqual(self.completer.attr_matches('Completeme.egg'), [])
         self.assertEqual(self.completer.attr_matches('CompleteMe.'),
-                         ['CompleteMe.mro(', 'CompleteMe.spam'])
+                         ['CompleteMe.mro()', 'CompleteMe.spam'])
         self.assertEqual(self.completer.attr_matches('CompleteMe._'),
                          ['CompleteMe._ham'])
         matches = self.completer.attr_matches('CompleteMe.__')
@@ -81,18 +81,42 @@
                               if x.startswith('s')])
 
     def test_excessive_getattr(self):
-        # Ensure getattr() is invoked no more than once per attribute
+        """Ensure getattr() is invoked no more than once per attribute"""
+
+        # note the special case for @property methods below; that is why
+        # we use __dir__ and __getattr__ in class Foo to create a "magic"
+        # class attribute 'bar'. This forces `getattr` to call __getattr__
+        # (which is doesn't necessarily do).
         class Foo:
             calls = 0
-            @property
-            def bar(self):
-                self.calls += 1
-                return None
+            bar = ''
+            def __getattribute__(self, name):
+                if name == 'bar':
+                    self.calls += 1
+                    return None
+                return super().__getattribute__(name)
+
         f = Foo()
         completer = rlcompleter.Completer(dict(f=f))
         self.assertEqual(completer.complete('f.b', 0), 'f.bar')
         self.assertEqual(f.calls, 1)
 
+    def test_property_method_not_called(self):
+        class Foo:
+            _bar = 0
+            property_called = False
+
+            @property
+            def bar(self):
+                self.property_called = True
+                return self._bar
+
+        f = Foo()
+        completer = rlcompleter.Completer(dict(f=f))
+        self.assertEqual(completer.complete('f.b', 0), 'f.bar')
+        self.assertFalse(f.property_called)
+
+
     def test_uncreated_attr(self):
         # Attributes like properties and slots should be completed even when
         # they haven't been created on an instance
@@ -134,7 +158,7 @@
         # No opening bracket "(" because we overrode the built-in class
         self.assertEqual(completer.complete('memoryview', 0), 'memoryview')
         self.assertIsNone(completer.complete('memoryview', 1))
-        self.assertEqual(completer.complete('Ellipsis', 0), 'Ellipsis(')
+        self.assertEqual(completer.complete('Ellipsis', 0), 'Ellipsis()')
         self.assertIsNone(completer.complete('Ellipsis', 1))
 
 if __name__ == '__main__':
diff --git a/Lib/test/test_robotparser.py b/Lib/test/test_robotparser.py
index a3112b8..b0bed43 100644
--- a/Lib/test/test_robotparser.py
+++ b/Lib/test/test_robotparser.py
@@ -5,6 +5,7 @@
 import urllib.robotparser
 from test import support
 from test.support import socket_helper
+from test.support import threading_helper
 from http.server import BaseHTTPRequestHandler, HTTPServer
 
 
@@ -330,7 +331,7 @@
         self.t.join()
         self.server.server_close()
 
-    @support.reap_threads
+    @threading_helper.reap_threads
     def testPasswordProtectedSite(self):
         addr = self.server.server_address
         url = 'http://' + socket_helper.HOST + ':' + str(addr[1])
diff --git a/Lib/test/test_runpy.py b/Lib/test/test_runpy.py
index 4aaf75b..2954dfe 100644
--- a/Lib/test/test_runpy.py
+++ b/Lib/test/test_runpy.py
@@ -12,9 +12,9 @@
 import textwrap
 import unittest
 import warnings
-from test.support import (
-    forget, make_legacy_pyc, unload, verbose, no_tracing,
-    create_empty_file, temp_dir)
+from test.support import no_tracing, verbose
+from test.support.import_helper import forget, make_legacy_pyc, unload
+from test.support.os_helper import create_empty_file, temp_dir
 from test.support.script_helper import make_script, make_zip_script
 
 
diff --git a/Lib/test/test_sax.py b/Lib/test/test_sax.py
index ce3a422..eda4e6a 100644
--- a/Lib/test/test_sax.py
+++ b/Lib/test/test_sax.py
@@ -13,16 +13,20 @@
 from xml.sax.saxutils import XMLGenerator, escape, unescape, quoteattr, \
                              XMLFilterBase, prepare_input_source
 from xml.sax.expatreader import create_parser
-from xml.sax.handler import feature_namespaces, feature_external_ges
+from xml.sax.handler import (feature_namespaces, feature_external_ges,
+                             LexicalHandler)
 from xml.sax.xmlreader import InputSource, AttributesImpl, AttributesNSImpl
 from io import BytesIO, StringIO
 import codecs
 import os.path
 import shutil
+import sys
 from urllib.error import URLError
 import urllib.request
-from test import support
-from test.support import findfile, run_unittest, FakePath, TESTFN
+from test.support import os_helper
+from test.support import findfile
+from test.support.os_helper import FakePath, TESTFN
+
 
 TEST_XMLFILE = findfile("test.xml", subdir="xmltestdata")
 TEST_XMLFILE_OUT = findfile("test.xml.out", subdir="xmltestdata")
@@ -35,7 +39,7 @@
 supports_nonascii_filenames = True
 if not os.path.supports_unicode_filenames:
     try:
-        support.TESTFN_UNICODE.encode(support.TESTFN_ENCODING)
+        os_helper.TESTFN_UNICODE.encode(sys.getfilesystemencoding())
     except (UnicodeError, TypeError):
         # Either the file system encoding is None, or the file name
         # cannot be encoded in the file system encoding.
@@ -120,7 +124,7 @@
     data = '<money value="$\xa3\u20ac\U0001017b">$\xa3\u20ac\U0001017b</money>'
 
     def tearDown(self):
-        support.unlink(TESTFN)
+        os_helper.unlink(TESTFN)
 
     def check_parse(self, f):
         from xml.sax import parse
@@ -348,12 +352,12 @@
 class PrepareInputSourceTest(unittest.TestCase):
 
     def setUp(self):
-        self.file = support.TESTFN
+        self.file = os_helper.TESTFN
         with open(self.file, "w") as tmp:
             tmp.write("This was read from a file.")
 
     def tearDown(self):
-        support.unlink(self.file)
+        os_helper.unlink(self.file)
 
     def make_byte_stream(self):
         return BytesIO(b"This is a byte stream.")
@@ -823,14 +827,14 @@
                 (encoding, doc)).encode('ascii', 'xmlcharrefreplace')
 
 class StreamReaderWriterXmlgenTest(XmlgenTest, unittest.TestCase):
-    fname = support.TESTFN + '-codecs'
+    fname = os_helper.TESTFN + '-codecs'
 
     def ioclass(self):
         writer = codecs.open(self.fname, 'w', encoding='ascii',
                              errors='xmlcharrefreplace', buffering=0)
         def cleanup():
             writer.close()
-            support.unlink(self.fname)
+            os_helper.unlink(self.fname)
         self.addCleanup(cleanup)
         def getvalue():
             # Windows will not let use reopen without first closing
@@ -900,9 +904,9 @@
 
     @requires_nonascii_filenames
     def test_expat_binary_file_nonascii(self):
-        fname = support.TESTFN_UNICODE
+        fname = os_helper.TESTFN_UNICODE
         shutil.copyfile(TEST_XMLFILE, fname)
-        self.addCleanup(support.unlink, fname)
+        self.addCleanup(os_helper.unlink, fname)
 
         parser = create_parser()
         result = BytesIO()
@@ -1136,9 +1140,9 @@
 
     @requires_nonascii_filenames
     def test_expat_inpsource_sysid_nonascii(self):
-        fname = support.TESTFN_UNICODE
+        fname = os_helper.TESTFN_UNICODE
         shutil.copyfile(TEST_XMLFILE, fname)
-        self.addCleanup(support.unlink, fname)
+        self.addCleanup(os_helper.unlink, fname)
 
         parser = create_parser()
         result = BytesIO()
@@ -1238,9 +1242,9 @@
 
     @requires_nonascii_filenames
     def test_expat_locator_withinfo_nonascii(self):
-        fname = support.TESTFN_UNICODE
+        fname = os_helper.TESTFN_UNICODE
         shutil.copyfile(TEST_XMLFILE, fname)
-        self.addCleanup(support.unlink, fname)
+        self.addCleanup(os_helper.unlink, fname)
 
         result = BytesIO()
         xmlgen = XMLGenerator(result)
@@ -1353,19 +1357,154 @@
         self.assertEqual(attrs.getQNameByName((ns_uri, "attr")), "ns:attr")
 
 
-def test_main():
-    run_unittest(MakeParserTest,
-                 ParseTest,
-                 SaxutilsTest,
-                 PrepareInputSourceTest,
-                 StringXmlgenTest,
-                 BytesXmlgenTest,
-                 WriterXmlgenTest,
-                 StreamWriterXmlgenTest,
-                 StreamReaderWriterXmlgenTest,
-                 ExpatReaderTest,
-                 ErrorReportingTest,
-                 XmlReaderTest)
+class LexicalHandlerTest(unittest.TestCase):
+    def setUp(self):
+        self.parser = None
+
+        self.specified_version = '1.0'
+        self.specified_encoding = 'UTF-8'
+        self.specified_doctype = 'wish'
+        self.specified_entity_names = ('nbsp', 'source', 'target')
+        self.specified_comment = ('Comment in a DTD',
+                                  'Really! You think so?')
+        self.test_data = StringIO()
+        self.test_data.write('<?xml version="{}" encoding="{}"?>\n'.
+                             format(self.specified_version,
+                                    self.specified_encoding))
+        self.test_data.write('<!DOCTYPE {} [\n'.
+                             format(self.specified_doctype))
+        self.test_data.write('<!-- {} -->\n'.
+                             format(self.specified_comment[0]))
+        self.test_data.write('<!ELEMENT {} (to,from,heading,body,footer)>\n'.
+                             format(self.specified_doctype))
+        self.test_data.write('<!ELEMENT to (#PCDATA)>\n')
+        self.test_data.write('<!ELEMENT from (#PCDATA)>\n')
+        self.test_data.write('<!ELEMENT heading (#PCDATA)>\n')
+        self.test_data.write('<!ELEMENT body (#PCDATA)>\n')
+        self.test_data.write('<!ELEMENT footer (#PCDATA)>\n')
+        self.test_data.write('<!ENTITY {} "&#xA0;">\n'.
+                             format(self.specified_entity_names[0]))
+        self.test_data.write('<!ENTITY {} "Written by: Alexander.">\n'.
+                             format(self.specified_entity_names[1]))
+        self.test_data.write('<!ENTITY {} "Hope it gets to: Aristotle.">\n'.
+                             format(self.specified_entity_names[2]))
+        self.test_data.write(']>\n')
+        self.test_data.write('<{}>'.format(self.specified_doctype))
+        self.test_data.write('<to>Aristotle</to>\n')
+        self.test_data.write('<from>Alexander</from>\n')
+        self.test_data.write('<heading>Supplication</heading>\n')
+        self.test_data.write('<body>Teach me patience!</body>\n')
+        self.test_data.write('<footer>&{};&{};&{};</footer>\n'.
+                             format(self.specified_entity_names[1],
+                                    self.specified_entity_names[0],
+                                    self.specified_entity_names[2]))
+        self.test_data.write('<!-- {} -->\n'.format(self.specified_comment[1]))
+        self.test_data.write('</{}>\n'.format(self.specified_doctype))
+        self.test_data.seek(0)
+
+        # Data received from handlers - to be validated
+        self.version = None
+        self.encoding = None
+        self.standalone = None
+        self.doctype = None
+        self.publicID = None
+        self.systemID = None
+        self.end_of_dtd = False
+        self.comments = []
+
+    def test_handlers(self):
+        class TestLexicalHandler(LexicalHandler):
+            def __init__(self, test_harness, *args, **kwargs):
+                super().__init__(*args, **kwargs)
+                self.test_harness = test_harness
+
+            def startDTD(self, doctype, publicID, systemID):
+                self.test_harness.doctype = doctype
+                self.test_harness.publicID = publicID
+                self.test_harness.systemID = systemID
+
+            def endDTD(self):
+                self.test_harness.end_of_dtd = True
+
+            def comment(self, text):
+                self.test_harness.comments.append(text)
+
+        self.parser = create_parser()
+        self.parser.setContentHandler(ContentHandler())
+        self.parser.setProperty(
+            'http://xml.org/sax/properties/lexical-handler',
+            TestLexicalHandler(self))
+        source = InputSource()
+        source.setCharacterStream(self.test_data)
+        self.parser.parse(source)
+        self.assertEqual(self.doctype, self.specified_doctype)
+        self.assertIsNone(self.publicID)
+        self.assertIsNone(self.systemID)
+        self.assertTrue(self.end_of_dtd)
+        self.assertEqual(len(self.comments),
+                         len(self.specified_comment))
+        self.assertEqual(f' {self.specified_comment[0]} ', self.comments[0])
+
+
+class CDATAHandlerTest(unittest.TestCase):
+    def setUp(self):
+        self.parser = None
+        self.specified_chars = []
+        self.specified_chars.append(('Parseable character data', False))
+        self.specified_chars.append(('<> &% - assorted other XML junk.', True))
+        self.char_index = 0  # Used to index specified results within handlers
+        self.test_data = StringIO()
+        self.test_data.write('<root_doc>\n')
+        self.test_data.write('<some_pcdata>\n')
+        self.test_data.write(f'{self.specified_chars[0][0]}\n')
+        self.test_data.write('</some_pcdata>\n')
+        self.test_data.write('<some_cdata>\n')
+        self.test_data.write(f'<![CDATA[{self.specified_chars[1][0]}]]>\n')
+        self.test_data.write('</some_cdata>\n')
+        self.test_data.write('</root_doc>\n')
+        self.test_data.seek(0)
+
+        # Data received from handlers - to be validated
+        self.chardata = []
+        self.in_cdata = False
+
+    def test_handlers(self):
+        class TestLexicalHandler(LexicalHandler):
+            def __init__(self, test_harness, *args, **kwargs):
+                super().__init__(*args, **kwargs)
+                self.test_harness = test_harness
+
+            def startCDATA(self):
+                self.test_harness.in_cdata = True
+
+            def endCDATA(self):
+                self.test_harness.in_cdata = False
+
+        class TestCharHandler(ContentHandler):
+            def __init__(self, test_harness, *args, **kwargs):
+                super().__init__(*args, **kwargs)
+                self.test_harness = test_harness
+
+            def characters(self, content):
+                if content != '\n':
+                    h = self.test_harness
+                    t = h.specified_chars[h.char_index]
+                    h.assertEqual(t[0], content)
+                    h.assertEqual(t[1], h.in_cdata)
+                    h.char_index += 1
+
+        self.parser = create_parser()
+        self.parser.setContentHandler(TestCharHandler(self))
+        self.parser.setProperty(
+            'http://xml.org/sax/properties/lexical-handler',
+            TestLexicalHandler(self))
+        source = InputSource()
+        source.setCharacterStream(self.test_data)
+        self.parser.parse(source)
+
+        self.assertFalse(self.in_cdata)
+        self.assertEqual(self.char_index, 2)
+
 
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_sched.py b/Lib/test/test_sched.py
index 26cb4be..7ae7baa 100644
--- a/Lib/test/test_sched.py
+++ b/Lib/test/test_sched.py
@@ -4,6 +4,7 @@
 import time
 import unittest
 from test import support
+from test.support import threading_helper
 
 
 TIMEOUT = support.SHORT_TIMEOUT
@@ -82,7 +83,7 @@
         self.assertEqual(q.get(timeout=TIMEOUT), 5)
         self.assertTrue(q.empty())
         timer.advance(1000)
-        support.join_thread(t)
+        threading_helper.join_thread(t)
         self.assertTrue(q.empty())
         self.assertEqual(timer.time(), 5)
 
@@ -137,10 +138,21 @@
         self.assertEqual(q.get(timeout=TIMEOUT), 4)
         self.assertTrue(q.empty())
         timer.advance(1000)
-        support.join_thread(t)
+        threading_helper.join_thread(t)
         self.assertTrue(q.empty())
         self.assertEqual(timer.time(), 4)
 
+    def test_cancel_correct_event(self):
+        # bpo-19270
+        events = []
+        scheduler = sched.scheduler()
+        scheduler.enterabs(1, 1, events.append, ("a",))
+        b = scheduler.enterabs(1, 1, events.append, ("b",))
+        scheduler.enterabs(1, 1, events.append, ("c",))
+        scheduler.cancel(b)
+        scheduler.run()
+        self.assertEqual(events, ["a", "c"])
+
     def test_empty(self):
         l = []
         fun = lambda x: l.append(x)
diff --git a/Lib/test/test_scope.py b/Lib/test/test_scope.py
index 4239b26..59d5912 100644
--- a/Lib/test/test_scope.py
+++ b/Lib/test/test_scope.py
@@ -2,6 +2,7 @@
 import weakref
 
 from test.support import check_syntax_error, cpython_only
+from test.support import gc_collect
 
 
 class ScopeTests(unittest.TestCase):
@@ -422,6 +423,7 @@
         for i in range(100):
             f1()
 
+        gc_collect()  # For PyPy or other GCs.
         self.assertEqual(Foo.count, 0)
 
     def testClassAndGlobal(self):
@@ -754,6 +756,7 @@
         tester.dig()
         ref = weakref.ref(tester)
         del tester
+        gc_collect()  # For PyPy or other GCs.
         self.assertIsNone(ref())
 
 
diff --git a/Lib/test/test_select.py b/Lib/test/test_select.py
index 458998a..cf32cf2 100644
--- a/Lib/test/test_select.py
+++ b/Lib/test/test_select.py
@@ -1,7 +1,9 @@
 import errno
 import os
 import select
+import subprocess
 import sys
+import textwrap
 import unittest
 from test import support
 
@@ -44,17 +46,27 @@
         self.assertIsNot(r, x)
         self.assertIsNot(w, x)
 
+    @unittest.skipUnless(hasattr(os, 'popen'), "need os.popen()")
     def test_select(self):
-        cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 1; done'
-        with os.popen(cmd) as p:
-            for tout in (0, 1, 2, 4, 8, 16) + (None,)*10:
+        code = textwrap.dedent('''
+            import time
+            for i in range(10):
+                print("testing...", flush=True)
+                time.sleep(0.050)
+        ''')
+        cmd = [sys.executable, '-I', '-c', code]
+        with subprocess.Popen(cmd, stdout=subprocess.PIPE) as proc:
+            pipe = proc.stdout
+            for timeout in (0, 1, 2, 4, 8, 16) + (None,)*10:
                 if support.verbose:
-                    print('timeout =', tout)
-                rfd, wfd, xfd = select.select([p], [], [], tout)
-                if (rfd, wfd, xfd) == ([], [], []):
+                    print(f'timeout = {timeout}')
+                rfd, wfd, xfd = select.select([pipe], [], [], timeout)
+                self.assertEqual(wfd, [])
+                self.assertEqual(xfd, [])
+                if not rfd:
                     continue
-                if (rfd, wfd, xfd) == ([p], [], []):
-                    line = p.readline()
+                if rfd == [pipe]:
+                    line = pipe.readline()
                     if support.verbose:
                         print(repr(line))
                     if not line:
@@ -62,7 +74,8 @@
                             print('EOF')
                         break
                     continue
-                self.fail('Unexpected return values from select():', rfd, wfd, xfd)
+                self.fail('Unexpected return values from select():',
+                          rfd, wfd, xfd)
 
     # Issue 16230: Crash on select resized list
     def test_select_mutated(self):
@@ -74,6 +87,12 @@
         a[:] = [F()] * 10
         self.assertEqual(select.select([], a, []), ([], a[:5], []))
 
+    def test_disallow_instantiation(self):
+        support.check_disallow_instantiation(self, type(select.poll()))
+
+        if hasattr(select, 'devpoll'):
+            support.check_disallow_instantiation(self, type(select.devpoll()))
+
 def tearDownModule():
     support.reap_children()
 
diff --git a/Lib/test/test_selectors.py b/Lib/test/test_selectors.py
index 2274c39..fe6b725 100644
--- a/Lib/test/test_selectors.py
+++ b/Lib/test/test_selectors.py
@@ -6,6 +6,7 @@
 import socket
 import sys
 from test import support
+from test.support import os_helper
 from test.support import socket_helper
 from time import sleep
 import unittest
@@ -48,7 +49,7 @@
     return match
 
 
-class BaseSelectorTestCase(unittest.TestCase):
+class BaseSelectorTestCase:
 
     def make_socketpair(self):
         rd, wr = socketpair()
@@ -492,26 +493,28 @@
         self.assertEqual(NUM_FDS // 2, len(fds))
 
 
-class DefaultSelectorTestCase(BaseSelectorTestCase):
+class DefaultSelectorTestCase(BaseSelectorTestCase, unittest.TestCase):
 
     SELECTOR = selectors.DefaultSelector
 
 
-class SelectSelectorTestCase(BaseSelectorTestCase):
+class SelectSelectorTestCase(BaseSelectorTestCase, unittest.TestCase):
 
     SELECTOR = selectors.SelectSelector
 
 
 @unittest.skipUnless(hasattr(selectors, 'PollSelector'),
                      "Test needs selectors.PollSelector")
-class PollSelectorTestCase(BaseSelectorTestCase, ScalableSelectorMixIn):
+class PollSelectorTestCase(BaseSelectorTestCase, ScalableSelectorMixIn,
+                           unittest.TestCase):
 
     SELECTOR = getattr(selectors, 'PollSelector', None)
 
 
 @unittest.skipUnless(hasattr(selectors, 'EpollSelector'),
                      "Test needs selectors.EpollSelector")
-class EpollSelectorTestCase(BaseSelectorTestCase, ScalableSelectorMixIn):
+class EpollSelectorTestCase(BaseSelectorTestCase, ScalableSelectorMixIn,
+                            unittest.TestCase):
 
     SELECTOR = getattr(selectors, 'EpollSelector', None)
 
@@ -528,7 +531,8 @@
 
 @unittest.skipUnless(hasattr(selectors, 'KqueueSelector'),
                      "Test needs selectors.KqueueSelector)")
-class KqueueSelectorTestCase(BaseSelectorTestCase, ScalableSelectorMixIn):
+class KqueueSelectorTestCase(BaseSelectorTestCase, ScalableSelectorMixIn,
+                             unittest.TestCase):
 
     SELECTOR = getattr(selectors, 'KqueueSelector', None)
 
@@ -536,7 +540,7 @@
         # a file descriptor that's been closed should raise an OSError
         # with EBADF
         s = self.SELECTOR()
-        bad_f = support.make_bad_fd()
+        bad_f = os_helper.make_bad_fd()
         with self.assertRaises(OSError) as cm:
             s.register(bad_f, selectors.EVENT_READ)
         self.assertEqual(cm.exception.errno, errno.EBADF)
@@ -560,19 +564,15 @@
 
 @unittest.skipUnless(hasattr(selectors, 'DevpollSelector'),
                      "Test needs selectors.DevpollSelector")
-class DevpollSelectorTestCase(BaseSelectorTestCase, ScalableSelectorMixIn):
+class DevpollSelectorTestCase(BaseSelectorTestCase, ScalableSelectorMixIn,
+                              unittest.TestCase):
 
     SELECTOR = getattr(selectors, 'DevpollSelector', None)
 
 
-
-def test_main():
-    tests = [DefaultSelectorTestCase, SelectSelectorTestCase,
-             PollSelectorTestCase, EpollSelectorTestCase,
-             KqueueSelectorTestCase, DevpollSelectorTestCase]
-    support.run_unittest(*tests)
+def tearDownModule():
     support.reap_children()
 
 
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_set.py b/Lib/test/test_set.py
index e4766ab..824eddb 100644
--- a/Lib/test/test_set.py
+++ b/Lib/test/test_set.py
@@ -1,5 +1,6 @@
 import unittest
 from test import support
+from test.support import warnings_helper
 import gc
 import weakref
 import operator
@@ -317,20 +318,6 @@
             name = repr(s).partition('(')[0]    # strip class name
             self.assertEqual(repr(s), '%s({%s(...)})' % (name, name))
 
-    def test_cyclical_print(self):
-        w = ReprWrapper()
-        s = self.thetype([w])
-        w.value = s
-        fo = open(support.TESTFN, "w")
-        try:
-            fo.write(str(s))
-            fo.close()
-            fo = open(support.TESTFN, "r")
-            self.assertEqual(fo.read(), repr(s))
-        finally:
-            fo.close()
-            support.unlink(support.TESTFN)
-
     def test_do_not_rehash_dict_keys(self):
         n = 10
         d = dict.fromkeys(map(HashCountingInt, range(n)))
@@ -375,8 +362,8 @@
         self.assertEqual(s, set(self.word))
         s.__init__(self.otherword)
         self.assertEqual(s, set(self.otherword))
-        self.assertRaises(TypeError, s.__init__, s, 2);
-        self.assertRaises(TypeError, s.__init__, 1);
+        self.assertRaises(TypeError, s.__init__, s, 2)
+        self.assertRaises(TypeError, s.__init__, 1)
 
     def test_constructor_identity(self):
         s = self.thetype(range(3))
@@ -606,6 +593,7 @@
         p = weakref.proxy(s)
         self.assertEqual(str(p), str(s))
         s = None
+        support.gc_collect()  # For PyPy or other GCs.
         self.assertRaises(ReferenceError, str, p)
 
     def test_rich_compare(self):
@@ -675,15 +663,6 @@
         s.__init__(self.otherword)
         self.assertEqual(s, set(self.word))
 
-    def test_singleton_empty_frozenset(self):
-        f = frozenset()
-        efs = [frozenset(), frozenset([]), frozenset(()), frozenset(''),
-               frozenset(), frozenset([]), frozenset(()), frozenset(''),
-               frozenset(range(0)), frozenset(frozenset()),
-               frozenset(f), f]
-        # All of the empty frozensets should have just one id()
-        self.assertEqual(len(set(map(id, efs))), 1)
-
     def test_constructor_identity(self):
         s = self.thetype(range(3))
         t = self.thetype(s)
@@ -803,17 +782,6 @@
         sorted_repr_values.sort()
         self.assertEqual(result, sorted_repr_values)
 
-    def test_print(self):
-        try:
-            fo = open(support.TESTFN, "w")
-            fo.write(str(self.set))
-            fo.close()
-            fo = open(support.TESTFN, "r")
-            self.assertEqual(fo.read(), repr(self.set))
-        finally:
-            fo.close()
-            support.unlink(support.TESTFN)
-
     def test_length(self):
         self.assertEqual(len(self.set), self.length)
 
@@ -987,7 +955,7 @@
 
 class TestBasicOpsMixedStringBytes(TestBasicOps, unittest.TestCase):
     def setUp(self):
-        self._warning_filters = support.check_warnings()
+        self._warning_filters = warnings_helper.check_warnings()
         self._warning_filters.__enter__()
         warnings.simplefilter('ignore', BytesWarning)
         self.case   = "string and bytes set"
@@ -1798,6 +1766,192 @@
         s = {0}
         s.update(other)
 
+
+class TestOperationsMutating:
+    """Regression test for bpo-46615"""
+
+    constructor1 = None
+    constructor2 = None
+
+    def make_sets_of_bad_objects(self):
+        class Bad:
+            def __eq__(self, other):
+                if not enabled:
+                    return False
+                if randrange(20) == 0:
+                    set1.clear()
+                if randrange(20) == 0:
+                    set2.clear()
+                return bool(randrange(2))
+            def __hash__(self):
+                return randrange(2)
+        # Don't behave poorly during construction.
+        enabled = False
+        set1 = self.constructor1(Bad() for _ in range(randrange(50)))
+        set2 = self.constructor2(Bad() for _ in range(randrange(50)))
+        # Now start behaving poorly
+        enabled = True
+        return set1, set2
+
+    def check_set_op_does_not_crash(self, function):
+        for _ in range(100):
+            set1, set2 = self.make_sets_of_bad_objects()
+            try:
+                function(set1, set2)
+            except RuntimeError as e:
+                # Just make sure we don't crash here.
+                self.assertIn("changed size during iteration", str(e))
+
+
+class TestBinaryOpsMutating(TestOperationsMutating):
+
+    def test_eq_with_mutation(self):
+        self.check_set_op_does_not_crash(lambda a, b: a == b)
+
+    def test_ne_with_mutation(self):
+        self.check_set_op_does_not_crash(lambda a, b: a != b)
+
+    def test_lt_with_mutation(self):
+        self.check_set_op_does_not_crash(lambda a, b: a < b)
+
+    def test_le_with_mutation(self):
+        self.check_set_op_does_not_crash(lambda a, b: a <= b)
+
+    def test_gt_with_mutation(self):
+        self.check_set_op_does_not_crash(lambda a, b: a > b)
+
+    def test_ge_with_mutation(self):
+        self.check_set_op_does_not_crash(lambda a, b: a >= b)
+
+    def test_and_with_mutation(self):
+        self.check_set_op_does_not_crash(lambda a, b: a & b)
+
+    def test_or_with_mutation(self):
+        self.check_set_op_does_not_crash(lambda a, b: a | b)
+
+    def test_sub_with_mutation(self):
+        self.check_set_op_does_not_crash(lambda a, b: a - b)
+
+    def test_xor_with_mutation(self):
+        self.check_set_op_does_not_crash(lambda a, b: a ^ b)
+
+    def test_iadd_with_mutation(self):
+        def f(a, b):
+            a &= b
+        self.check_set_op_does_not_crash(f)
+
+    def test_ior_with_mutation(self):
+        def f(a, b):
+            a |= b
+        self.check_set_op_does_not_crash(f)
+
+    def test_isub_with_mutation(self):
+        def f(a, b):
+            a -= b
+        self.check_set_op_does_not_crash(f)
+
+    def test_ixor_with_mutation(self):
+        def f(a, b):
+            a ^= b
+        self.check_set_op_does_not_crash(f)
+
+    def test_iteration_with_mutation(self):
+        def f1(a, b):
+            for x in a:
+                pass
+            for y in b:
+                pass
+        def f2(a, b):
+            for y in b:
+                pass
+            for x in a:
+                pass
+        def f3(a, b):
+            for x, y in zip(a, b):
+                pass
+        self.check_set_op_does_not_crash(f1)
+        self.check_set_op_does_not_crash(f2)
+        self.check_set_op_does_not_crash(f3)
+
+
+class TestBinaryOpsMutating_Set_Set(TestBinaryOpsMutating, unittest.TestCase):
+    constructor1 = set
+    constructor2 = set
+
+class TestBinaryOpsMutating_Subclass_Subclass(TestBinaryOpsMutating, unittest.TestCase):
+    constructor1 = SetSubclass
+    constructor2 = SetSubclass
+
+class TestBinaryOpsMutating_Set_Subclass(TestBinaryOpsMutating, unittest.TestCase):
+    constructor1 = set
+    constructor2 = SetSubclass
+
+class TestBinaryOpsMutating_Subclass_Set(TestBinaryOpsMutating, unittest.TestCase):
+    constructor1 = SetSubclass
+    constructor2 = set
+
+
+class TestMethodsMutating(TestOperationsMutating):
+
+    def test_issubset_with_mutation(self):
+        self.check_set_op_does_not_crash(set.issubset)
+
+    def test_issuperset_with_mutation(self):
+        self.check_set_op_does_not_crash(set.issuperset)
+
+    def test_intersection_with_mutation(self):
+        self.check_set_op_does_not_crash(set.intersection)
+
+    def test_union_with_mutation(self):
+        self.check_set_op_does_not_crash(set.union)
+
+    def test_difference_with_mutation(self):
+        self.check_set_op_does_not_crash(set.difference)
+
+    def test_symmetric_difference_with_mutation(self):
+        self.check_set_op_does_not_crash(set.symmetric_difference)
+
+    def test_isdisjoint_with_mutation(self):
+        self.check_set_op_does_not_crash(set.isdisjoint)
+
+    def test_difference_update_with_mutation(self):
+        self.check_set_op_does_not_crash(set.difference_update)
+
+    def test_intersection_update_with_mutation(self):
+        self.check_set_op_does_not_crash(set.intersection_update)
+
+    def test_symmetric_difference_update_with_mutation(self):
+        self.check_set_op_does_not_crash(set.symmetric_difference_update)
+
+    def test_update_with_mutation(self):
+        self.check_set_op_does_not_crash(set.update)
+
+
+class TestMethodsMutating_Set_Set(TestMethodsMutating, unittest.TestCase):
+    constructor1 = set
+    constructor2 = set
+
+class TestMethodsMutating_Subclass_Subclass(TestMethodsMutating, unittest.TestCase):
+    constructor1 = SetSubclass
+    constructor2 = SetSubclass
+
+class TestMethodsMutating_Set_Subclass(TestMethodsMutating, unittest.TestCase):
+    constructor1 = set
+    constructor2 = SetSubclass
+
+class TestMethodsMutating_Subclass_Set(TestMethodsMutating, unittest.TestCase):
+    constructor1 = SetSubclass
+    constructor2 = set
+
+class TestMethodsMutating_Set_Dict(TestMethodsMutating, unittest.TestCase):
+    constructor1 = set
+    constructor2 = dict.fromkeys
+
+class TestMethodsMutating_Set_List(TestMethodsMutating, unittest.TestCase):
+    constructor1 = set
+    constructor2 = list
+
+
 # Application tests (based on David Eppstein's graph recipes ====================================
 
 def powerset(U):
diff --git a/Lib/test/test_shelve.py b/Lib/test/test_shelve.py
index 9ffe2cb..dcb5aef 100644
--- a/Lib/test/test_shelve.py
+++ b/Lib/test/test_shelve.py
@@ -1,7 +1,12 @@
 import unittest
+import dbm
+import os
 import shelve
 import glob
+import pickle
+
 from test import support
+from test.support import os_helper
 from collections.abc import MutableMapping
 from test.test_dbm import dbm_iterator
 
@@ -40,12 +45,8 @@
 
 
 class TestCase(unittest.TestCase):
-
-    fn = "shelftemp.db"
-
-    def tearDown(self):
-        for f in glob.glob(self.fn+"*"):
-            support.unlink(f)
+    dirname = os_helper.TESTFN
+    fn = os.path.join(os_helper.TESTFN, "shelftemp.db")
 
     def test_close(self):
         d1 = {}
@@ -62,29 +63,24 @@
         else:
             self.fail('Closed shelf should not find a key')
 
-    def test_ascii_file_shelf(self):
-        s = shelve.open(self.fn, protocol=0)
+    def test_open_template(self, protocol=None):
+        os.mkdir(self.dirname)
+        self.addCleanup(os_helper.rmtree, self.dirname)
+        s = shelve.open(self.fn, protocol=protocol)
         try:
             s['key1'] = (1,2,3,4)
             self.assertEqual(s['key1'], (1,2,3,4))
         finally:
             s.close()
 
+    def test_ascii_file_shelf(self):
+        self.test_open_template(protocol=0)
+
     def test_binary_file_shelf(self):
-        s = shelve.open(self.fn, protocol=1)
-        try:
-            s['key1'] = (1,2,3,4)
-            self.assertEqual(s['key1'], (1,2,3,4))
-        finally:
-            s.close()
+        self.test_open_template(protocol=1)
 
     def test_proto2_file_shelf(self):
-        s = shelve.open(self.fn, protocol=2)
-        try:
-            s['key1'] = (1,2,3,4)
-            self.assertEqual(s['key1'], (1,2,3,4))
-        finally:
-            s.close()
+        self.test_open_template(protocol=2)
 
     def test_in_memory_shelf(self):
         d1 = byteskeydict()
@@ -159,65 +155,54 @@
 
     def test_default_protocol(self):
         with shelve.Shelf({}) as s:
-            self.assertEqual(s._protocol, 3)
+            self.assertEqual(s._protocol, pickle.DEFAULT_PROTOCOL)
+
+
+class TestShelveBase:
+    type2test = shelve.Shelf
+
+    def _reference(self):
+        return {"key1":"value1", "key2":2, "key3":(1,2,3)}
+
+
+class TestShelveInMemBase(TestShelveBase):
+    def _empty_mapping(self):
+        return shelve.Shelf(byteskeydict(), **self._args)
+
+
+class TestShelveFileBase(TestShelveBase):
+    counter = 0
+
+    def _empty_mapping(self):
+        self.counter += 1
+        x = shelve.open(self.base_path + str(self.counter), **self._args)
+        self.addCleanup(x.close)
+        return x
+
+    def setUp(self):
+        dirname = os_helper.TESTFN
+        os.mkdir(dirname)
+        self.addCleanup(os_helper.rmtree, dirname)
+        self.base_path = os.path.join(dirname, "shelftemp.db")
+        self.addCleanup(setattr, dbm, '_defaultmod', dbm._defaultmod)
+        dbm._defaultmod = self.dbm_mod
+
 
 from test import mapping_tests
 
-class TestShelveBase(mapping_tests.BasicTestMappingProtocol):
-    fn = "shelftemp.db"
-    counter = 0
-    def __init__(self, *args, **kw):
-        self._db = []
-        mapping_tests.BasicTestMappingProtocol.__init__(self, *args, **kw)
-    type2test = shelve.Shelf
-    def _reference(self):
-        return {"key1":"value1", "key2":2, "key3":(1,2,3)}
-    def _empty_mapping(self):
-        if self._in_mem:
-            x= shelve.Shelf(byteskeydict(), **self._args)
-        else:
-            self.counter+=1
-            x= shelve.open(self.fn+str(self.counter), **self._args)
-        self._db.append(x)
-        return x
-    def tearDown(self):
-        for db in self._db:
-            db.close()
-        self._db = []
-        if not self._in_mem:
-            for f in glob.glob(self.fn+"*"):
-                support.unlink(f)
+for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+    bases = (TestShelveInMemBase, mapping_tests.BasicTestMappingProtocol)
+    name = f'TestProto{proto}MemShelve'
+    globals()[name] = type(name, bases,
+                           {'_args': {'protocol': proto}})
+    bases = (TestShelveFileBase, mapping_tests.BasicTestMappingProtocol)
+    for dbm_mod in dbm_iterator():
+        assert dbm_mod.__name__.startswith('dbm.')
+        suffix = dbm_mod.__name__[4:]
+        name = f'TestProto{proto}File_{suffix}Shelve'
+        globals()[name] = type(name, bases,
+                               {'dbm_mod': dbm_mod, '_args': {'protocol': proto}})
 
-class TestAsciiFileShelve(TestShelveBase):
-    _args={'protocol':0}
-    _in_mem = False
-class TestBinaryFileShelve(TestShelveBase):
-    _args={'protocol':1}
-    _in_mem = False
-class TestProto2FileShelve(TestShelveBase):
-    _args={'protocol':2}
-    _in_mem = False
-class TestAsciiMemShelve(TestShelveBase):
-    _args={'protocol':0}
-    _in_mem = True
-class TestBinaryMemShelve(TestShelveBase):
-    _args={'protocol':1}
-    _in_mem = True
-class TestProto2MemShelve(TestShelveBase):
-    _args={'protocol':2}
-    _in_mem = True
-
-def test_main():
-    for module in dbm_iterator():
-        support.run_unittest(
-            TestAsciiFileShelve,
-            TestBinaryFileShelve,
-            TestProto2FileShelve,
-            TestAsciiMemShelve,
-            TestBinaryMemShelve,
-            TestProto2MemShelve,
-            TestCase
-        )
 
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py
index e19af64..7669b94 100644
--- a/Lib/test/test_shutil.py
+++ b/Lib/test/test_shutil.py
@@ -30,10 +30,14 @@
     posix = None
 
 from test import support
-from test.support import TESTFN, FakePath
+from test.support import os_helper
+from test.support.os_helper import TESTFN, FakePath
 
 TESTFN2 = TESTFN + "2"
+TESTFN_SRC = TESTFN + "_SRC"
+TESTFN_DST = TESTFN + "_DST"
 MACOS = sys.platform.startswith("darwin")
+SOLARIS = sys.platform.startswith("sunos")
 AIX = sys.platform[:3] == 'aix'
 try:
     import grp
@@ -71,7 +75,9 @@
     """
     if isinstance(path, tuple):
         path = os.path.join(*path)
-    with open(path, 'wb' if binary else 'w') as fp:
+    mode = 'wb' if binary else 'w'
+    encoding = None if binary else "utf-8"
+    with open(path, mode, encoding=encoding) as fp:
         fp.write(content)
 
 def write_test_file(path, size):
@@ -101,7 +107,9 @@
     """
     if isinstance(path, tuple):
         path = os.path.join(*path)
-    with open(path, 'rb' if binary else 'r') as fp:
+    mode = 'rb' if binary else 'r'
+    encoding = None if binary else "utf-8"
+    with open(path, mode, encoding=encoding) as fp:
         return fp.read()
 
 def rlistdir(path):
@@ -140,9 +148,9 @@
                     return True
     finally:
         if srcname is not None:
-            support.unlink(srcname)
+            os_helper.unlink(srcname)
         if dstname is not None:
-            support.unlink(dstname)
+            os_helper.unlink(dstname)
 
 
 SUPPORTS_SENDFILE = supports_file2file_sendfile()
@@ -168,7 +176,7 @@
         Returns the path of the directory.
         """
         d = tempfile.mkdtemp(prefix=prefix, dir=os.getcwd())
-        self.addCleanup(support.rmtree, d)
+        self.addCleanup(os_helper.rmtree, d)
         return d
 
 
@@ -183,7 +191,7 @@
         self.assertIsInstance(victim, bytes)
         shutil.rmtree(victim)
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_rmtree_fails_on_symlink(self):
         tmp = self.mkdtemp()
         dir_ = os.path.join(tmp, 'dir')
@@ -202,7 +210,7 @@
         self.assertEqual(errors[0][1], link)
         self.assertIsInstance(errors[0][2][1], OSError)
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_rmtree_works_on_symlinks(self):
         tmp = self.mkdtemp()
         dir1 = os.path.join(tmp, 'dir1')
@@ -231,7 +239,7 @@
         os.mkdir(dir_)
         link = os.path.join(tmp, 'link')
         _winapi.CreateJunction(dir_, link)
-        self.addCleanup(support.unlink, link)
+        self.addCleanup(os_helper.unlink, link)
         self.assertRaises(OSError, shutil.rmtree, link)
         self.assertTrue(os.path.exists(dir_))
         self.assertTrue(os.path.lexists(link))
@@ -279,10 +287,7 @@
         filename = os.path.join(tmpdir, "tstfile")
         with self.assertRaises(NotADirectoryError) as cm:
             shutil.rmtree(filename)
-        # The reason for this rather odd construct is that Windows sprinkles
-        # a \*.* at the end of file names. But only sometimes on some buildbots
-        possible_args = [filename, os.path.join(filename, '*.*')]
-        self.assertIn(cm.exception.filename, possible_args)
+        self.assertEqual(cm.exception.filename, filename)
         self.assertTrue(os.path.exists(filename))
         # test that ignore_errors option is honored
         shutil.rmtree(filename, ignore_errors=True)
@@ -295,11 +300,11 @@
         self.assertIs(errors[0][0], os.scandir)
         self.assertEqual(errors[0][1], filename)
         self.assertIsInstance(errors[0][2][1], NotADirectoryError)
-        self.assertIn(errors[0][2][1].filename, possible_args)
+        self.assertEqual(errors[0][2][1].filename, filename)
         self.assertIs(errors[1][0], os.rmdir)
         self.assertEqual(errors[1][1], filename)
         self.assertIsInstance(errors[1][2][1], NotADirectoryError)
-        self.assertIn(errors[1][2][1].filename, possible_args)
+        self.assertEqual(errors[1][2][1].filename, filename)
 
 
     @unittest.skipIf(sys.platform[:6] == 'cygwin',
@@ -313,7 +318,7 @@
 
         self.child_file_path = os.path.join(TESTFN, 'a')
         self.child_dir_path = os.path.join(TESTFN, 'b')
-        support.create_empty_file(self.child_file_path)
+        os_helper.create_empty_file(self.child_file_path)
         os.mkdir(self.child_dir_path)
         old_dir_mode = os.stat(TESTFN).st_mode
         old_child_file_mode = os.stat(self.child_file_path).st_mode
@@ -407,7 +412,7 @@
         self.assertRaises(NotADirectoryError, shutil.rmtree, path)
         os.remove(path)
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_rmtree_on_symlink(self):
         # bug 1669.
         os.mkdir(TESTFN)
@@ -482,7 +487,7 @@
         with self.assertRaises(FileExistsError):
             shutil.copytree(src_dir, dst_dir, dirs_exist_ok=False)
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_copytree_symlinks(self):
         tmp_dir = self.mkdtemp()
         src_dir = os.path.join(tmp_dir, 'src')
@@ -634,7 +639,7 @@
         write_file((src_dir, 'restrictive.txt'), '456')
         os.chmod(os.path.join(src_dir, 'restrictive.txt'), 0o600)
         restrictive_subdir = tempfile.mkdtemp(dir=src_dir)
-        self.addCleanup(support.rmtree, restrictive_subdir)
+        self.addCleanup(os_helper.rmtree, restrictive_subdir)
         os.chmod(restrictive_subdir, 0o600)
 
         shutil.copytree(src_dir, dst_dir)
@@ -674,14 +679,16 @@
         flag = []
         src = self.mkdtemp()
         dst = tempfile.mktemp(dir=self.mkdtemp())
-        with open(os.path.join(src, 'foo'), 'w') as f:
+        with open(os.path.join(src, 'foo'), 'w', encoding='utf-8') as f:
             f.close()
         shutil.copytree(src, dst, copy_function=custom_cpfun)
         self.assertEqual(len(flag), 1)
 
     # Issue #3002: copyfile and copytree block indefinitely on named pipes
     @unittest.skipUnless(hasattr(os, "mkfifo"), 'requires os.mkfifo()')
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
+    @unittest.skipIf(sys.platform == "vxworks",
+                    "fifo requires special path on VxWorks")
     def test_copytree_named_pipe(self):
         os.mkdir(TESTFN)
         try:
@@ -719,7 +726,7 @@
         shutil.copytree(src_dir, dst_dir, copy_function=_copy)
         self.assertEqual(len(copied), 2)
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_copytree_dangling_symlinks(self):
         # a dangling symlink raises an error at the end
         src_dir = self.mkdtemp()
@@ -739,12 +746,12 @@
         shutil.copytree(src_dir, dst_dir, symlinks=True)
         self.assertIn('test.txt', os.listdir(dst_dir))
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_copytree_symlink_dir(self):
         src_dir = self.mkdtemp()
         dst_dir = os.path.join(self.mkdtemp(), 'destination')
         os.mkdir(os.path.join(src_dir, 'real_dir'))
-        with open(os.path.join(src_dir, 'real_dir', 'test.txt'), 'w'):
+        with open(os.path.join(src_dir, 'real_dir', 'test.txt'), 'wb'):
             pass
         os.symlink(os.path.join(src_dir, 'real_dir'),
                    os.path.join(src_dir, 'link_to_dir'),
@@ -785,7 +792,7 @@
 
     ### shutil.copymode
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_copymode_follow_symlinks(self):
         tmp_dir = self.mkdtemp()
         src = os.path.join(tmp_dir, 'foo')
@@ -818,7 +825,7 @@
             self.assertEqual(os.stat(src).st_mode, os.stat(dst).st_mode)
 
     @unittest.skipUnless(hasattr(os, 'lchmod'), 'requires os.lchmod')
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_copymode_symlink_to_symlink(self):
         tmp_dir = self.mkdtemp()
         src = os.path.join(tmp_dir, 'foo')
@@ -848,7 +855,7 @@
         self.assertEqual(os.stat(src).st_mode, os.stat(dst).st_mode)
 
     @unittest.skipIf(hasattr(os, 'lchmod'), 'requires os.lchmod to be missing')
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_copymode_symlink_to_symlink_wo_lchmod(self):
         tmp_dir = self.mkdtemp()
         src = os.path.join(tmp_dir, 'foo')
@@ -863,7 +870,7 @@
 
     ### shutil.copystat
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_copystat_symlinks(self):
         tmp_dir = self.mkdtemp()
         src = os.path.join(tmp_dir, 'foo')
@@ -935,7 +942,7 @@
 
     ### shutil.copyxattr
 
-    @support.skip_unless_xattr
+    @os_helper.skip_unless_xattr
     def test_copyxattr(self):
         tmp_dir = self.mkdtemp()
         src = os.path.join(tmp_dir, 'foo')
@@ -999,8 +1006,8 @@
         self.assertEqual(os.getxattr(dst, 'user.the_value'), b'fiddly')
         self.assertEqual(os.getxattr(dstro, 'user.the_value'), b'fiddly')
 
-    @support.skip_unless_symlink
-    @support.skip_unless_xattr
+    @os_helper.skip_unless_symlink
+    @os_helper.skip_unless_xattr
     @unittest.skipUnless(hasattr(os, 'geteuid') and os.geteuid() == 0,
                          'root privileges required')
     def test_copyxattr_symlinks(self):
@@ -1042,7 +1049,7 @@
         self.assertTrue(os.path.exists(file2))
         self.assertEqual(os.stat(file1).st_mode, os.stat(file2).st_mode)
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_copy_symlinks(self):
         tmp_dir = self.mkdtemp()
         src = os.path.join(tmp_dir, 'foo')
@@ -1084,7 +1091,7 @@
             self.assertEqual(getattr(file1_stat, 'st_flags'),
                              getattr(file2_stat, 'st_flags'))
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_copy2_symlinks(self):
         tmp_dir = self.mkdtemp()
         src = os.path.join(tmp_dir, 'foo')
@@ -1119,7 +1126,7 @@
         if hasattr(os, 'lchflags') and hasattr(src_link_stat, 'st_flags'):
             self.assertEqual(src_link_stat.st_flags, dst_stat.st_flags)
 
-    @support.skip_unless_xattr
+    @os_helper.skip_unless_xattr
     def test_copy2_xattr(self):
         tmp_dir = self.mkdtemp()
         src = os.path.join(tmp_dir, 'foo')
@@ -1144,9 +1151,31 @@
             rv = fn(src, os.path.join(dst_dir, 'bar'))
             self.assertEqual(rv, os.path.join(dst_dir, 'bar'))
 
+    def test_copy_dir(self):
+        self._test_copy_dir(shutil.copy)
+
+    def test_copy2_dir(self):
+        self._test_copy_dir(shutil.copy2)
+
+    def _test_copy_dir(self, copy_func):
+        src_dir = self.mkdtemp()
+        src_file = os.path.join(src_dir, 'foo')
+        dir2 = self.mkdtemp()
+        dst = os.path.join(src_dir, 'does_not_exist/')
+        write_file(src_file, 'foo')
+        if sys.platform == "win32":
+            err = PermissionError
+        else:
+            err = IsADirectoryError
+        self.assertRaises(err, copy_func, dir2, src_dir)
+
+        # raise *err* because of src rather than FileNotFoundError because of dst
+        self.assertRaises(err, copy_func, dir2, dst)
+        copy_func(src_file, dir2)     # should not raise exceptions
+
     ### shutil.copyfile
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_copyfile_symlinks(self):
         tmp_dir = self.mkdtemp()
         src = os.path.join(tmp_dir, 'src')
@@ -1170,34 +1199,34 @@
         src = os.path.join(TESTFN, 'cheese')
         dst = os.path.join(TESTFN, 'shop')
         try:
-            with open(src, 'w') as f:
+            with open(src, 'w', encoding='utf-8') as f:
                 f.write('cheddar')
             try:
                 os.link(src, dst)
             except PermissionError as e:
                 self.skipTest('os.link(): %s' % e)
             self.assertRaises(shutil.SameFileError, shutil.copyfile, src, dst)
-            with open(src, 'r') as f:
+            with open(src, 'r', encoding='utf-8') as f:
                 self.assertEqual(f.read(), 'cheddar')
             os.remove(dst)
         finally:
             shutil.rmtree(TESTFN, ignore_errors=True)
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_dont_copy_file_onto_symlink_to_itself(self):
         # bug 851123.
         os.mkdir(TESTFN)
         src = os.path.join(TESTFN, 'cheese')
         dst = os.path.join(TESTFN, 'shop')
         try:
-            with open(src, 'w') as f:
+            with open(src, 'w', encoding='utf-8') as f:
                 f.write('cheddar')
             # Using `src` here would mean we end up with a symlink pointing
             # to TESTFN/TESTFN/cheese, while it should point at
             # TESTFN/cheese.
             os.symlink('cheese', dst)
             self.assertRaises(shutil.SameFileError, shutil.copyfile, src, dst)
-            with open(src, 'r') as f:
+            with open(src, 'r', encoding='utf-8') as f:
                 self.assertEqual(f.read(), 'cheddar')
             os.remove(dst)
         finally:
@@ -1205,6 +1234,8 @@
 
     # Issue #3002: copyfile and copytree block indefinitely on named pipes
     @unittest.skipUnless(hasattr(os, "mkfifo"), 'requires os.mkfifo()')
+    @unittest.skipIf(sys.platform == "vxworks",
+                    "fifo requires special path on VxWorks")
     def test_copyfile_named_pipe(self):
         try:
             os.mkfifo(TESTFN)
@@ -1241,6 +1272,33 @@
         # Make sure file is not corrupted.
         self.assertEqual(read_file(src_file), 'foo')
 
+    @unittest.skipIf(MACOS or SOLARIS or _winapi, 'On MACOS, Solaris and Windows the errors are not confusing (though different)')
+    def test_copyfile_nonexistent_dir(self):
+        # Issue 43219
+        src_dir = self.mkdtemp()
+        src_file = os.path.join(src_dir, 'foo')
+        dst = os.path.join(src_dir, 'does_not_exist/')
+        write_file(src_file, 'foo')
+        self.assertRaises(FileNotFoundError, shutil.copyfile, src_file, dst)
+
+    def test_copyfile_copy_dir(self):
+        # Issue 45234
+        # test copy() and copyfile() raising proper exceptions when src and/or
+        # dst are directories
+        src_dir = self.mkdtemp()
+        src_file = os.path.join(src_dir, 'foo')
+        dir2 = self.mkdtemp()
+        dst = os.path.join(src_dir, 'does_not_exist/')
+        write_file(src_file, 'foo')
+        if sys.platform == "win32":
+            err = PermissionError
+        else:
+            err = IsADirectoryError
+
+        self.assertRaises(err, shutil.copyfile, src_dir, dst)
+        self.assertRaises(err, shutil.copyfile, src_file, src_dir)
+        self.assertRaises(err, shutil.copyfile, dir2, src_dir)
+
 
 class TestArchives(BaseTest, unittest.TestCase):
 
@@ -1258,7 +1316,7 @@
         work_dir = os.path.dirname(tmpdir2)
         rel_base_name = os.path.join(os.path.basename(tmpdir2), 'archive')
 
-        with support.change_cwd(work_dir):
+        with os_helper.change_cwd(work_dir):
             base_name = os.path.abspath(rel_base_name)
             tarball = make_archive(rel_base_name, 'gztar', root_dir, '.')
 
@@ -1272,7 +1330,7 @@
                                    './file1', './file2', './sub/file3'])
 
         # trying an uncompressed one
-        with support.change_cwd(work_dir):
+        with os_helper.change_cwd(work_dir):
             tarball = make_archive(rel_base_name, 'tar', root_dir, '.')
         self.assertEqual(tarball, base_name + '.tar')
         self.assertTrue(os.path.isfile(tarball))
@@ -1347,7 +1405,7 @@
         work_dir = os.path.dirname(tmpdir2)
         rel_base_name = os.path.join(os.path.basename(tmpdir2), 'archive')
 
-        with support.change_cwd(work_dir):
+        with os_helper.change_cwd(work_dir):
             base_name = os.path.abspath(rel_base_name)
             res = make_archive(rel_base_name, 'zip', root_dir)
 
@@ -1360,7 +1418,7 @@
                      'dist/file1', 'dist/file2', 'dist/sub/file3',
                      'outer'])
 
-        with support.change_cwd(work_dir):
+        with os_helper.change_cwd(work_dir):
             base_name = os.path.abspath(rel_base_name)
             res = make_archive(rel_base_name, 'zip', root_dir, base_dir)
 
@@ -1412,7 +1470,7 @@
 
         # now check the ZIP file using `unzip -t`
         zip_cmd = ['unzip', '-t', archive]
-        with support.change_cwd(root_dir):
+        with os_helper.change_cwd(root_dir):
             try:
                 subprocess.check_output(zip_cmd, stderr=subprocess.STDOUT)
             except subprocess.CalledProcessError as exc:
@@ -1462,7 +1520,7 @@
         base_name = os.path.join(self.mkdtemp(), 'archive')
         group = grp.getgrgid(0)[0]
         owner = pwd.getpwuid(0)[0]
-        with support.change_cwd(root_dir):
+        with os_helper.change_cwd(root_dir):
             archive_name = make_archive(base_name, 'gztar', root_dir, 'dist',
                                         owner=owner, group=group)
 
@@ -1496,7 +1554,7 @@
     def test_make_tarfile_in_curdir(self):
         # Issue #21280
         root_dir = self.mkdtemp()
-        with support.change_cwd(root_dir):
+        with os_helper.change_cwd(root_dir):
             self.assertEqual(make_archive('test', 'tar'), 'test.tar')
             self.assertTrue(os.path.isfile('test.tar'))
 
@@ -1504,7 +1562,7 @@
     def test_make_zipfile_in_curdir(self):
         # Issue #21280
         root_dir = self.mkdtemp()
-        with support.change_cwd(root_dir):
+        with os_helper.change_cwd(root_dir):
             self.assertEqual(make_archive('test', 'zip'), 'test.zip')
             self.assertTrue(os.path.isfile('test.zip'))
 
@@ -1711,18 +1769,18 @@
         # that exists, it should be returned.
         base_dir, tail_dir = os.path.split(self.dir)
         relpath = os.path.join(tail_dir, self.file)
-        with support.change_cwd(path=base_dir):
+        with os_helper.change_cwd(path=base_dir):
             rv = shutil.which(relpath, path=self.temp_dir)
             self.assertEqual(rv, relpath)
         # But it shouldn't be searched in PATH directories (issue #16957).
-        with support.change_cwd(path=self.dir):
+        with os_helper.change_cwd(path=self.dir):
             rv = shutil.which(relpath, path=base_dir)
             self.assertIsNone(rv)
 
     def test_cwd(self):
         # Issue #16957
         base_dir = os.path.dirname(self.dir)
-        with support.change_cwd(path=self.dir):
+        with os_helper.change_cwd(path=self.dir):
             rv = shutil.which(self.file, path=base_dir)
             if sys.platform == "win32":
                 # Windows: current directory implicitly on PATH
@@ -1743,7 +1801,7 @@
 
     def test_relative_path(self):
         base_dir, tail_dir = os.path.split(self.dir)
-        with support.change_cwd(path=base_dir):
+        with os_helper.change_cwd(path=base_dir):
             rv = shutil.which(self.file, path=tail_dir)
             self.assertEqual(rv, os.path.join(tail_dir, self.file))
 
@@ -1761,19 +1819,19 @@
         self.assertEqual(rv, self.temp_file.name[:-4] + self.ext)
 
     def test_environ_path(self):
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env['PATH'] = self.env_path
             rv = shutil.which(self.file)
             self.assertEqual(rv, self.temp_file.name)
 
     def test_environ_path_empty(self):
         # PATH='': no match
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env['PATH'] = ''
             with unittest.mock.patch('os.confstr', return_value=self.dir, \
                                      create=True), \
                  support.swap_attr(os, 'defpath', self.dir), \
-                 support.change_cwd(self.dir):
+                 os_helper.change_cwd(self.dir):
                 rv = shutil.which(self.file)
                 self.assertIsNone(rv)
 
@@ -1786,7 +1844,7 @@
             expected_cwd = os.path.join(curdir, expected_cwd)
 
         # PATH=':': explicitly looks in the current directory
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env['PATH'] = os.pathsep
             with unittest.mock.patch('os.confstr', return_value=self.dir, \
                                      create=True), \
@@ -1795,12 +1853,12 @@
                 self.assertIsNone(rv)
 
                 # look in current directory
-                with support.change_cwd(self.dir):
+                with os_helper.change_cwd(self.dir):
                     rv = shutil.which(self.file)
                     self.assertEqual(rv, expected_cwd)
 
     def test_environ_path_missing(self):
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env.pop('PATH', None)
 
             # without confstr
@@ -1819,14 +1877,14 @@
 
     def test_empty_path(self):
         base_dir = os.path.dirname(self.dir)
-        with support.change_cwd(path=self.dir), \
-             support.EnvironmentVarGuard() as env:
+        with os_helper.change_cwd(path=self.dir), \
+             os_helper.EnvironmentVarGuard() as env:
             env['PATH'] = self.env_path
             rv = shutil.which(self.file, path='')
             self.assertIsNone(rv)
 
     def test_empty_path_no_PATH(self):
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env.pop('PATH', None)
             rv = shutil.which(self.file)
             self.assertIsNone(rv)
@@ -1843,7 +1901,7 @@
         program = os.path.basename(temp_filexyz.name)
         program = os.path.splitext(program)[0]
 
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env['PATHEXT'] = ext
             rv = shutil.which(program, path=self.temp_dir)
             self.assertEqual(rv, temp_filexyz.name)
@@ -1860,7 +1918,7 @@
         program = os.path.basename(temp_filexyz.name)
         program = os.path.splitext(program)[0]
 
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env['PATHEXT'] = f"{ext};"  # note the ;
             rv = shutil.which(program, path=self.temp_dir)
             self.assertEqual(rv, temp_filexyz.name)
@@ -1935,7 +1993,7 @@
         try:
             self._check_move_dir(self.src_dir, dst_dir, dst_dir)
         finally:
-            support.rmtree(dst_dir)
+            os_helper.rmtree(dst_dir)
 
     @mock_rename
     def test_move_dir_other_fs(self):
@@ -1982,7 +2040,7 @@
                              msg='_destinsrc() wrongly concluded that '
                              'dst (%s) is not in src (%s)' % (dst, src))
         finally:
-            support.rmtree(TESTFN)
+            os_helper.rmtree(TESTFN)
 
     def test_destinsrc_false_positive(self):
         os.mkdir(TESTFN)
@@ -1994,9 +2052,9 @@
                             msg='_destinsrc() wrongly concluded that '
                             'dst (%s) is in src (%s)' % (dst, src))
         finally:
-            support.rmtree(TESTFN)
+            os_helper.rmtree(TESTFN)
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     @mock_rename
     def test_move_file_symlink(self):
         dst = os.path.join(self.src_dir, 'bar')
@@ -2005,7 +2063,7 @@
         self.assertTrue(os.path.islink(self.dst_file))
         self.assertTrue(os.path.samefile(self.src_file, self.dst_file))
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     @mock_rename
     def test_move_file_symlink_to_dir(self):
         filename = "bar"
@@ -2016,7 +2074,7 @@
         self.assertTrue(os.path.islink(final_link))
         self.assertTrue(os.path.samefile(self.src_file, final_link))
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     @mock_rename
     def test_move_dangling_symlink(self):
         src = os.path.join(self.src_dir, 'baz')
@@ -2027,7 +2085,7 @@
         self.assertTrue(os.path.islink(dst_link))
         self.assertEqual(os.path.realpath(src), os.path.realpath(dst_link))
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     @mock_rename
     def test_move_dir_symlink(self):
         src = os.path.join(self.src_dir, 'baz')
@@ -2061,8 +2119,8 @@
         moved = []
         def _copy(src, dst):
             moved.append((src, dst))
-        support.create_empty_file(os.path.join(self.src_dir, 'child'))
-        support.create_empty_file(os.path.join(self.src_dir, 'child1'))
+        os_helper.create_empty_file(os.path.join(self.src_dir, 'child'))
+        os_helper.create_empty_file(os.path.join(self.src_dir, 'child1'))
         shutil.move(self.src_dir, self.dst_dir, copy_function=_copy)
         self.assertEqual(len(moved), 3)
 
@@ -2083,6 +2141,41 @@
             os.rmdir(dst_dir)
 
 
+    @unittest.skipUnless(hasattr(os, 'geteuid') and os.geteuid() == 0
+                         and hasattr(os, 'lchflags')
+                         and hasattr(stat, 'SF_IMMUTABLE')
+                         and hasattr(stat, 'UF_OPAQUE'),
+                         'root privileges required')
+    def test_move_dir_permission_denied(self):
+        # bpo-42782: shutil.move should not create destination directories
+        # if the source directory cannot be removed.
+        try:
+            os.mkdir(TESTFN_SRC)
+            os.lchflags(TESTFN_SRC, stat.SF_IMMUTABLE)
+
+            # Testing on an empty immutable directory
+            # TESTFN_DST should not exist if shutil.move failed
+            self.assertRaises(PermissionError, shutil.move, TESTFN_SRC, TESTFN_DST)
+            self.assertFalse(TESTFN_DST in os.listdir())
+
+            # Create a file and keep the directory immutable
+            os.lchflags(TESTFN_SRC, stat.UF_OPAQUE)
+            os_helper.create_empty_file(os.path.join(TESTFN_SRC, 'child'))
+            os.lchflags(TESTFN_SRC, stat.SF_IMMUTABLE)
+
+            # Testing on a non-empty immutable directory
+            # TESTFN_DST should not exist if shutil.move failed
+            self.assertRaises(PermissionError, shutil.move, TESTFN_SRC, TESTFN_DST)
+            self.assertFalse(TESTFN_DST in os.listdir())
+        finally:
+            if os.path.exists(TESTFN_SRC):
+                os.lchflags(TESTFN_SRC, stat.UF_OPAQUE)
+                os_helper.rmtree(TESTFN_SRC)
+            if os.path.exists(TESTFN_DST):
+                os.lchflags(TESTFN_DST, stat.UF_OPAQUE)
+                os_helper.rmtree(TESTFN_DST)
+
+
 class TestCopyFile(unittest.TestCase):
 
     class Faux(object):
@@ -2184,11 +2277,11 @@
 
     @classmethod
     def tearDownClass(cls):
-        support.unlink(TESTFN)
-        support.unlink(TESTFN2)
+        os_helper.unlink(TESTFN)
+        os_helper.unlink(TESTFN2)
 
     def tearDown(self):
-        support.unlink(TESTFN2)
+        os_helper.unlink(TESTFN2)
 
     @contextlib.contextmanager
     def get_files(self):
@@ -2233,7 +2326,7 @@
         with tempfile.NamedTemporaryFile(dir=os.getcwd(), delete=False) as f:
             f.write(b'foo')
         fname = f.name
-        self.addCleanup(support.unlink, fname)
+        self.addCleanup(os_helper.unlink, fname)
         with unittest.mock.patch("shutil._copyfileobj_readinto") as m:
             shutil.copyfile(fname, TESTFN2)
         self.assertEqual(m.call_args[0][2], 3)
@@ -2242,7 +2335,7 @@
         with tempfile.NamedTemporaryFile(dir=os.getcwd(), delete=False) as f:
             pass
         fname = f.name
-        self.addCleanup(support.unlink, fname)
+        self.addCleanup(os_helper.unlink, fname)
         with unittest.mock.patch("shutil._copyfileobj_readinto") as m:
             shutil.copyfile(fname, TESTFN2)
         assert not m.called
@@ -2264,10 +2357,10 @@
 
     @classmethod
     def tearDownClass(cls):
-        support.unlink(TESTFN)
+        os_helper.unlink(TESTFN)
 
     def tearDown(self):
-        support.unlink(TESTFN2)
+        os_helper.unlink(TESTFN2)
 
     @contextlib.contextmanager
     def get_files(self):
@@ -2313,8 +2406,8 @@
     def test_empty_file(self):
         srcname = TESTFN + 'src'
         dstname = TESTFN + 'dst'
-        self.addCleanup(lambda: support.unlink(srcname))
-        self.addCleanup(lambda: support.unlink(dstname))
+        self.addCleanup(lambda: os_helper.unlink(srcname))
+        self.addCleanup(lambda: os_helper.unlink(dstname))
         with open(srcname, "wb"):
             pass
 
@@ -2438,9 +2531,9 @@
             # sendfile() are the same.
             self.assertEqual(blocksize, os.path.getsize(TESTFN))
             # ...unless we're dealing with a small file.
-            support.unlink(TESTFN2)
+            os_helper.unlink(TESTFN2)
             write_file(TESTFN2, b"hello", binary=True)
-            self.addCleanup(support.unlink, TESTFN2 + '3')
+            self.addCleanup(os_helper.unlink, TESTFN2 + '3')
             self.assertRaises(ZeroDivisionError,
                               shutil.copyfile, TESTFN2, TESTFN2 + '3')
             blocksize = m.call_args[0][3]
@@ -2490,20 +2583,20 @@
     def test_os_environ_first(self):
         "Check if environment variables have precedence"
 
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env['COLUMNS'] = '777'
             del env['LINES']
             size = shutil.get_terminal_size()
         self.assertEqual(size.columns, 777)
 
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             del env['COLUMNS']
             env['LINES'] = '888'
             size = shutil.get_terminal_size()
         self.assertEqual(size.lines, 888)
 
     def test_bad_environ(self):
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env['COLUMNS'] = 'xxx'
             env['LINES'] = 'yyy'
             size = shutil.get_terminal_size()
@@ -2527,7 +2620,7 @@
             self.skipTest("stty invocation failed")
         expected = (int(size[1]), int(size[0])) # reversed order
 
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             del env['LINES']
             del env['COLUMNS']
             actual = shutil.get_terminal_size()
@@ -2535,7 +2628,7 @@
         self.assertEqual(expected, actual)
 
     def test_fallback(self):
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             del env['LINES']
             del env['COLUMNS']
 
@@ -2547,7 +2640,7 @@
 
             # sys.__stdout__ is not a terminal on Unix
             # or fileno() not in (0, 1, 2) on Windows
-            with open(os.devnull, 'w') as f, \
+            with open(os.devnull, 'w', encoding='utf-8') as f, \
                  support.swap_attr(sys, '__stdout__', f):
                 size = shutil.get_terminal_size(fallback=(30, 40))
             self.assertEqual(size.columns, 30)
diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py
index 45553a6..c2b5861 100644
--- a/Lib/test/test_signal.py
+++ b/Lib/test/test_signal.py
@@ -1,4 +1,5 @@
 import errno
+import inspect
 import os
 import random
 import signal
@@ -6,9 +7,11 @@
 import statistics
 import subprocess
 import sys
+import threading
 import time
 import unittest
 from test import support
+from test.support import os_helper
 from test.support.script_helper import assert_python_ok, spawn_python
 try:
     import _testcapi
@@ -31,6 +34,14 @@
                 self.assertIsInstance(sig, signal.Signals)
                 self.assertEqual(sys.platform, "win32")
 
+    def test_functions_module_attr(self):
+        # Issue #27718: If __all__ is not defined all non-builtin functions
+        # should have correct __module__ to be displayed by pydoc.
+        for name in dir(signal):
+            value = getattr(signal, name)
+            if inspect.isroutine(value) and not inspect.isbuiltin(value):
+                self.assertEqual(value.__module__, 'signal')
+
 
 @unittest.skipIf(sys.platform == "win32", "Not valid on Windows")
 class PosixTests(unittest.TestCase):
@@ -154,7 +165,7 @@
             signal.set_wakeup_fd(signal.SIGINT, False)
 
     def test_invalid_fd(self):
-        fd = support.make_bad_fd()
+        fd = os_helper.make_bad_fd()
         self.assertRaises((ValueError, OSError),
                           signal.set_wakeup_fd, fd)
 
@@ -518,16 +529,20 @@
         else:
             write.setblocking(False)
 
-        # Start with large chunk size to reduce the
-        # number of send needed to fill the buffer.
         written = 0
-        for chunk_size in (2 ** 16, 2 ** 8, 1):
+        if sys.platform == "vxworks":
+            CHUNK_SIZES = (1,)
+        else:
+            # Start with large chunk size to reduce the
+            # number of send needed to fill the buffer.
+            CHUNK_SIZES = (2 ** 16, 2 ** 8, 1)
+        for chunk_size in CHUNK_SIZES:
             chunk = b"x" * chunk_size
             try:
                 while True:
                     write.send(chunk)
                     written += chunk_size
-            except (BlockingIOError, socket.timeout):
+            except (BlockingIOError, TimeoutError):
                 pass
 
         print(f"%s bytes written into the socketpair" % written, flush=True)
@@ -594,6 +609,7 @@
 
 
 @unittest.skipIf(sys.platform == "win32", "Not valid on Windows")
+@unittest.skipUnless(hasattr(signal, 'siginterrupt'), "needs signal.siginterrupt()")
 class SiginterruptTest(unittest.TestCase):
 
     def readpipe_interrupted(self, interrupt):
@@ -679,6 +695,8 @@
 
 
 @unittest.skipIf(sys.platform == "win32", "Not valid on Windows")
+@unittest.skipUnless(hasattr(signal, 'getitimer') and hasattr(signal, 'setitimer'),
+                         "needs signal.getitimer() and signal.setitimer()")
 class ItimerTest(unittest.TestCase):
     def setUp(self):
         self.hndl_called = False
@@ -1243,6 +1261,65 @@
         # Python handler
         self.assertEqual(len(sigs), N, "Some signals were lost")
 
+    @unittest.skipUnless(hasattr(signal, "SIGUSR1"),
+                         "test needs SIGUSR1")
+    def test_stress_modifying_handlers(self):
+        # bpo-43406: race condition between trip_signal() and signal.signal
+        signum = signal.SIGUSR1
+        num_sent_signals = 0
+        num_received_signals = 0
+        do_stop = False
+
+        def custom_handler(signum, frame):
+            nonlocal num_received_signals
+            num_received_signals += 1
+
+        def set_interrupts():
+            nonlocal num_sent_signals
+            while not do_stop:
+                signal.raise_signal(signum)
+                num_sent_signals += 1
+
+        def cycle_handlers():
+            while num_sent_signals < 100:
+                for i in range(20000):
+                    # Cycle between a Python-defined and a non-Python handler
+                    for handler in [custom_handler, signal.SIG_IGN]:
+                        signal.signal(signum, handler)
+
+        old_handler = signal.signal(signum, custom_handler)
+        self.addCleanup(signal.signal, signum, old_handler)
+
+        t = threading.Thread(target=set_interrupts)
+        try:
+            ignored = False
+            with support.catch_unraisable_exception() as cm:
+                t.start()
+                cycle_handlers()
+                do_stop = True
+                t.join()
+
+                if cm.unraisable is not None:
+                    # An unraisable exception may be printed out when
+                    # a signal is ignored due to the aforementioned
+                    # race condition, check it.
+                    self.assertIsInstance(cm.unraisable.exc_value, OSError)
+                    self.assertIn(
+                        f"Signal {signum:d} ignored due to race condition",
+                        str(cm.unraisable.exc_value))
+                    ignored = True
+
+            # bpo-43406: Even if it is unlikely, it's technically possible that
+            # all signals were ignored because of race conditions.
+            if not ignored:
+                # Sanity check that some signals were received, but not all
+                self.assertGreater(num_received_signals, 0)
+            self.assertLess(num_received_signals, num_sent_signals)
+        finally:
+            do_stop = True
+            t.join()
+
+
 class RaiseSignalTest(unittest.TestCase):
 
     def test_sigint(self):
diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py
index ffba139..fa74e77 100644
--- a/Lib/test/test_site.py
+++ b/Lib/test/test_site.py
@@ -7,12 +7,14 @@
 import unittest
 import test.support
 from test import support
+from test.support import os_helper
 from test.support import socket_helper
-from test.support import (captured_stderr, TESTFN, EnvironmentVarGuard,
-                          change_cwd)
+from test.support import captured_stderr
+from test.support.os_helper import TESTFN, EnvironmentVarGuard, change_cwd
 import builtins
 import encodings
 import glob
+import io
 import os
 import re
 import shutil
@@ -34,6 +36,7 @@
 import site
 
 
+HAS_USER_SITE = (site.USER_SITE is not None)
 OLD_SYS_PATH = None
 
 
@@ -76,8 +79,10 @@
         site.USER_SITE = self.old_site
         site.PREFIXES = self.old_prefixes
         sysconfig._CONFIG_VARS = self.original_vars
-        sysconfig._CONFIG_VARS.clear()
-        sysconfig._CONFIG_VARS.update(self.old_vars)
+        # _CONFIG_VARS is None before get_config_vars() is called
+        if sysconfig._CONFIG_VARS is not None:
+            sysconfig._CONFIG_VARS.clear()
+            sysconfig._CONFIG_VARS.update(self.old_vars)
 
     def test_makepath(self):
         # Test makepath() have an absolute path for its first return value
@@ -159,11 +164,18 @@
         self.assertRegex(err_out.getvalue(), 'Traceback')
         self.assertRegex(err_out.getvalue(), 'ModuleNotFoundError')
 
+    def test_addpackage_empty_lines(self):
+        # Issue 33689
+        pth_dir, pth_fn = self.make_pth("\n\n  \n\n")
+        known_paths = site.addpackage(pth_dir, pth_fn, set())
+        self.assertEqual(known_paths, set())
+
     def test_addpackage_import_bad_pth_file(self):
         # Issue 5258
         pth_dir, pth_fn = self.make_pth("abc\x00def\n")
         with captured_stderr() as err_out:
             self.assertFalse(site.addpackage(pth_dir, pth_fn, set()))
+        self.maxDiff = None
         self.assertEqual(err_out.getvalue(), "")
         for path in sys.path:
             if isinstance(path, str):
@@ -187,6 +199,7 @@
     def test__getuserbase(self):
         self.assertEqual(site._getuserbase(), sysconfig._getuserbase())
 
+    @unittest.skipUnless(HAS_USER_SITE, 'need user site')
     def test_get_path(self):
         if sys.platform == 'darwin' and sys._framework:
             scheme = 'osx_framework_user'
@@ -236,6 +249,7 @@
         self.assertEqual(rc, 1,
                         "User base not set by PYTHONUSERBASE")
 
+    @unittest.skipUnless(HAS_USER_SITE, 'need user site')
     def test_getuserbase(self):
         site.USER_BASE = None
         user_base = site.getuserbase()
@@ -253,6 +267,7 @@
             self.assertTrue(site.getuserbase().startswith('xoxo'),
                             site.getuserbase())
 
+    @unittest.skipUnless(HAS_USER_SITE, 'need user site')
     def test_getusersitepackages(self):
         site.USER_SITE = None
         site.USER_BASE = None
@@ -287,6 +302,7 @@
             wanted = os.path.join('xoxo', 'lib', 'site-packages')
             self.assertEqual(dirs[1], wanted)
 
+    @unittest.skipUnless(HAS_USER_SITE, 'need user site')
     def test_no_home_directory(self):
         # bpo-10496: getuserbase() and getusersitepackages() must not fail if
         # the current user has no home directory (if expanduser() returns the
@@ -320,6 +336,14 @@
             mock_addsitedir.assert_not_called()
             self.assertFalse(known_paths)
 
+    def test_trace(self):
+        message = "bla-bla-bla"
+        for verbose, out in (True, message + "\n"), (False, ""):
+            with mock.patch('sys.flags', mock.Mock(verbose=verbose)), \
+                    mock.patch('sys.stderr', io.StringIO()):
+                site._trace(message)
+                self.assertEqual(sys.stderr.getvalue(), out)
+
 
 class PthFile(object):
     """Helper class for handling testing of .pth files"""
@@ -387,55 +411,6 @@
         """Restore sys.path"""
         sys.path[:] = self.sys_path
 
-    def test_abs_paths(self):
-        # Make sure all imported modules have their __file__ and __cached__
-        # attributes as absolute paths.  Arranging to put the Lib directory on
-        # PYTHONPATH would cause the os module to have a relative path for
-        # __file__ if abs_paths() does not get run.  sys and builtins (the
-        # only other modules imported before site.py runs) do not have
-        # __file__ or __cached__ because they are built-in.
-        try:
-            parent = os.path.relpath(os.path.dirname(os.__file__))
-            cwd = os.getcwd()
-        except ValueError:
-            # Failure to get relpath probably means we need to chdir
-            # to the same drive.
-            cwd, parent = os.path.split(os.path.dirname(os.__file__))
-        with change_cwd(cwd):
-            env = os.environ.copy()
-            env['PYTHONPATH'] = parent
-            code = ('import os, sys',
-                # use ASCII to avoid locale issues with non-ASCII directories
-                'os_file = os.__file__.encode("ascii", "backslashreplace")',
-                r'sys.stdout.buffer.write(os_file + b"\n")',
-                'os_cached = os.__cached__.encode("ascii", "backslashreplace")',
-                r'sys.stdout.buffer.write(os_cached + b"\n")')
-            command = '\n'.join(code)
-            # First, prove that with -S (no 'import site'), the paths are
-            # relative.
-            proc = subprocess.Popen([sys.executable, '-S', '-c', command],
-                                    env=env,
-                                    stdout=subprocess.PIPE)
-            stdout, stderr = proc.communicate()
-
-            self.assertEqual(proc.returncode, 0)
-            os__file__, os__cached__ = stdout.splitlines()[:2]
-            self.assertFalse(os.path.isabs(os__file__))
-            self.assertFalse(os.path.isabs(os__cached__))
-            # Now, with 'import site', it works.
-            proc = subprocess.Popen([sys.executable, '-c', command],
-                                    env=env,
-                                    stdout=subprocess.PIPE)
-            stdout, stderr = proc.communicate()
-            self.assertEqual(proc.returncode, 0)
-            os__file__, os__cached__ = stdout.splitlines()[:2]
-            self.assertTrue(os.path.isabs(os__file__),
-                            "expected absolute path, got {}"
-                            .format(os__file__.decode('ascii')))
-            self.assertTrue(os.path.isabs(os__cached__),
-                            "expected absolute path, got {}"
-                            .format(os__cached__.decode('ascii')))
-
     def test_abs_paths_cached_None(self):
         """Test for __cached__ is None.
 
@@ -585,14 +560,13 @@
             'import site, sys; site.enablerlcompleter(); sys.exit(hasattr(sys, "__interactivehook__"))']).wait()
         self.assertTrue(r, "'__interactivehook__' not added by enablerlcompleter()")
 
-
 @unittest.skipUnless(sys.platform == 'win32', "only supported on Windows")
 class _pthFileTests(unittest.TestCase):
 
     def _create_underpth_exe(self, lines, exe_pth=True):
         import _winapi
         temp_dir = tempfile.mkdtemp()
-        self.addCleanup(test.support.rmtree, temp_dir)
+        self.addCleanup(os_helper.rmtree, temp_dir)
         exe_file = os.path.join(temp_dir, os.path.split(sys.executable)[1])
         dll_src_file = _winapi.GetModuleFileName(sys.dllhandle)
         dll_file = os.path.join(temp_dir, os.path.split(dll_src_file)[1])
diff --git a/Lib/test/test_smtpd.py b/Lib/test/test_smtpd.py
index 3be7739..d2e150d 100644
--- a/Lib/test/test_smtpd.py
+++ b/Lib/test/test_smtpd.py
@@ -2,10 +2,15 @@
 import textwrap
 from test import support, mock_socket
 from test.support import socket_helper
+from test.support import warnings_helper
 import socket
 import io
-import smtpd
-import asyncore
+
+import warnings
+with warnings.catch_warnings():
+    warnings.simplefilter('ignore', DeprecationWarning)
+    import smtpd
+    import asyncore
 
 
 class DummyServer(smtpd.SMTPServer):
@@ -714,49 +719,49 @@
                          b'recognized\r\n')
 
     def test_attribute_deprecations(self):
-        with support.check_warnings(('', DeprecationWarning)):
+        with warnings_helper.check_warnings(('', DeprecationWarning)):
             spam = self.channel._SMTPChannel__server
-        with support.check_warnings(('', DeprecationWarning)):
+        with warnings_helper.check_warnings(('', DeprecationWarning)):
             self.channel._SMTPChannel__server = 'spam'
-        with support.check_warnings(('', DeprecationWarning)):
+        with warnings_helper.check_warnings(('', DeprecationWarning)):
             spam = self.channel._SMTPChannel__line
-        with support.check_warnings(('', DeprecationWarning)):
+        with warnings_helper.check_warnings(('', DeprecationWarning)):
             self.channel._SMTPChannel__line = 'spam'
-        with support.check_warnings(('', DeprecationWarning)):
+        with warnings_helper.check_warnings(('', DeprecationWarning)):
             spam = self.channel._SMTPChannel__state
-        with support.check_warnings(('', DeprecationWarning)):
+        with warnings_helper.check_warnings(('', DeprecationWarning)):
             self.channel._SMTPChannel__state = 'spam'
-        with support.check_warnings(('', DeprecationWarning)):
+        with warnings_helper.check_warnings(('', DeprecationWarning)):
             spam = self.channel._SMTPChannel__greeting
-        with support.check_warnings(('', DeprecationWarning)):
+        with warnings_helper.check_warnings(('', DeprecationWarning)):
             self.channel._SMTPChannel__greeting = 'spam'
-        with support.check_warnings(('', DeprecationWarning)):
+        with warnings_helper.check_warnings(('', DeprecationWarning)):
             spam = self.channel._SMTPChannel__mailfrom
-        with support.check_warnings(('', DeprecationWarning)):
+        with warnings_helper.check_warnings(('', DeprecationWarning)):
             self.channel._SMTPChannel__mailfrom = 'spam'
-        with support.check_warnings(('', DeprecationWarning)):
+        with warnings_helper.check_warnings(('', DeprecationWarning)):
             spam = self.channel._SMTPChannel__rcpttos
-        with support.check_warnings(('', DeprecationWarning)):
+        with warnings_helper.check_warnings(('', DeprecationWarning)):
             self.channel._SMTPChannel__rcpttos = 'spam'
-        with support.check_warnings(('', DeprecationWarning)):
+        with warnings_helper.check_warnings(('', DeprecationWarning)):
             spam = self.channel._SMTPChannel__data
-        with support.check_warnings(('', DeprecationWarning)):
+        with warnings_helper.check_warnings(('', DeprecationWarning)):
             self.channel._SMTPChannel__data = 'spam'
-        with support.check_warnings(('', DeprecationWarning)):
+        with warnings_helper.check_warnings(('', DeprecationWarning)):
             spam = self.channel._SMTPChannel__fqdn
-        with support.check_warnings(('', DeprecationWarning)):
+        with warnings_helper.check_warnings(('', DeprecationWarning)):
             self.channel._SMTPChannel__fqdn = 'spam'
-        with support.check_warnings(('', DeprecationWarning)):
+        with warnings_helper.check_warnings(('', DeprecationWarning)):
             spam = self.channel._SMTPChannel__peer
-        with support.check_warnings(('', DeprecationWarning)):
+        with warnings_helper.check_warnings(('', DeprecationWarning)):
             self.channel._SMTPChannel__peer = 'spam'
-        with support.check_warnings(('', DeprecationWarning)):
+        with warnings_helper.check_warnings(('', DeprecationWarning)):
             spam = self.channel._SMTPChannel__conn
-        with support.check_warnings(('', DeprecationWarning)):
+        with warnings_helper.check_warnings(('', DeprecationWarning)):
             self.channel._SMTPChannel__conn = 'spam'
-        with support.check_warnings(('', DeprecationWarning)):
+        with warnings_helper.check_warnings(('', DeprecationWarning)):
             spam = self.channel._SMTPChannel__addr
-        with support.check_warnings(('', DeprecationWarning)):
+        with warnings_helper.check_warnings(('', DeprecationWarning)):
             self.channel._SMTPChannel__addr = 'spam'
 
 @unittest.skipUnless(socket_helper.IPV6_ENABLED, "IPv6 not enabled")
@@ -1002,12 +1007,11 @@
 
 class MiscTestCase(unittest.TestCase):
     def test__all__(self):
-        blacklist = {
+        not_exported = {
             "program", "Devnull", "DEBUGSTREAM", "NEWLINE", "COMMASPACE",
             "DATA_SIZE_DEFAULT", "usage", "Options", "parseargs",
-
         }
-        support.check__all__(self, smtpd, blacklist=blacklist)
+        support.check__all__(self, smtpd, not_exported=not_exported)
 
 
 if __name__ == "__main__":
diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py
index 5762999..1a60fef 100644
--- a/Lib/test/test_smtplib.py
+++ b/Lib/test/test_smtplib.py
@@ -1,4 +1,3 @@
-import asyncore
 import base64
 import email.mime.text
 from email.message import EmailMessage
@@ -7,7 +6,6 @@
 import hashlib
 import hmac
 import socket
-import smtpd
 import smtplib
 import io
 import re
@@ -22,9 +20,15 @@
 from test import support, mock_socket
 from test.support import hashlib_helper
 from test.support import socket_helper
-from test.support import threading_setup, threading_cleanup, join_thread
+from test.support import threading_helper
 from unittest.mock import Mock
 
+import warnings
+with warnings.catch_warnings():
+    warnings.simplefilter('ignore', DeprecationWarning)
+    import asyncore
+    import smtpd
+
 HOST = socket_helper.HOST
 
 if sys.platform == 'darwin':
@@ -40,7 +44,7 @@
     evt.set()
     try:
         conn, addr = serv.accept()
-    except socket.timeout:
+    except TimeoutError:
         pass
     else:
         n = 500
@@ -165,6 +169,17 @@
 
     client = smtplib.LMTP
 
+    @unittest.skipUnless(hasattr(socket, 'AF_UNIX'), "test requires Unix domain socket")
+    def testUnixDomainSocketTimeoutDefault(self):
+        local_host = '/some/local/lmtp/delivery/program'
+        mock_socket.reply_with(b"220 Hello world")
+        try:
+            client = self.client(local_host, self.port)
+        finally:
+            mock_socket.setdefaulttimeout(None)
+        self.assertIsNone(client.sock.gettimeout())
+        client.close()
+
     def testTimeoutZero(self):
         super().testTimeoutZero()
         local_host = '/some/local/lmtp/delivery/program'
@@ -193,7 +208,7 @@
 
             n -= 1
 
-    except socket.timeout:
+    except TimeoutError:
         pass
     finally:
         if not client_evt.is_set():
@@ -217,7 +232,7 @@
     maxDiff = None
 
     def setUp(self):
-        self.thread_key = threading_setup()
+        self.thread_key = threading_helper.threading_setup()
         self.real_getfqdn = socket.getfqdn
         socket.getfqdn = mock_socket.getfqdn
         # temporarily replace sys.stdout to capture DebuggingServer output
@@ -249,7 +264,7 @@
         self.client_evt.set()
         # wait for the server thread to terminate
         self.serv_evt.wait()
-        join_thread(self.thread)
+        threading_helper.join_thread(self.thread)
         # restore sys.stdout
         sys.stdout = self.old_stdout
         # restore DEBUGSTREAM
@@ -257,7 +272,7 @@
         smtpd.DEBUGSTREAM = self.old_DEBUGSTREAM
         del self.thread
         self.doCleanups()
-        threading_cleanup(*self.thread_key)
+        threading_helper.threading_cleanup(*self.thread_key)
 
     def get_output_without_xpeer(self):
         test_output = self.output.getvalue()
@@ -321,6 +336,16 @@
         self.assertEqual(smtp.getreply(), expected)
         smtp.quit()
 
+    def test_issue43124_putcmd_escapes_newline(self):
+        # see: https://bugs.python.org/issue43124
+        smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost',
+                            timeout=support.LOOPBACK_TIMEOUT)
+        self.addCleanup(smtp.close)
+        with self.assertRaises(ValueError) as exc:
+            smtp.putcmd('helo\nX-INJECTED')
+        self.assertIn("prohibited newline characters", str(exc.exception))
+        smtp.quit()
+
     def testVRFY(self):
         smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost',
                             timeout=support.LOOPBACK_TIMEOUT)
@@ -402,6 +427,51 @@
         mexpect = '%s%s\n%s' % (MSG_BEGIN, m, MSG_END)
         self.assertEqual(self.output.getvalue(), mexpect)
 
+    def test_issue43124_escape_localhostname(self):
+        # see: https://bugs.python.org/issue43124
+        # connect and send mail
+        m = 'wazzuuup\nlinetwo'
+        smtp = smtplib.SMTP(HOST, self.port, local_hostname='hi\nX-INJECTED',
+                            timeout=support.LOOPBACK_TIMEOUT)
+        self.addCleanup(smtp.close)
+        with self.assertRaises(ValueError) as exc:
+            smtp.sendmail("hi@me.com", "you@me.com", m)
+        self.assertIn(
+            "prohibited newline characters: ehlo hi\\nX-INJECTED",
+            str(exc.exception),
+        )
+        # XXX (see comment in testSend)
+        time.sleep(0.01)
+        smtp.quit()
+
+        debugout = smtpd.DEBUGSTREAM.getvalue()
+        self.assertNotIn("X-INJECTED", debugout)
+
+    def test_issue43124_escape_options(self):
+        # see: https://bugs.python.org/issue43124
+        # connect and send mail
+        m = 'wazzuuup\nlinetwo'
+        smtp = smtplib.SMTP(
+            HOST, self.port, local_hostname='localhost',
+            timeout=support.LOOPBACK_TIMEOUT)
+
+        self.addCleanup(smtp.close)
+        smtp.sendmail("hi@me.com", "you@me.com", m)
+        with self.assertRaises(ValueError) as exc:
+            smtp.mail("hi@me.com", ["X-OPTION\nX-INJECTED-1", "X-OPTION2\nX-INJECTED-2"])
+        msg = str(exc.exception)
+        self.assertIn("prohibited newline characters", msg)
+        self.assertIn("X-OPTION\\nX-INJECTED-1 X-OPTION2\\nX-INJECTED-2", msg)
+        # XXX (see comment in testSend)
+        time.sleep(0.01)
+        smtp.quit()
+
+        debugout = smtpd.DEBUGSTREAM.getvalue()
+        self.assertNotIn("X-OPTION", debugout)
+        self.assertNotIn("X-OPTION2", debugout)
+        self.assertNotIn("X-INJECTED-1", debugout)
+        self.assertNotIn("X-INJECTED-2", debugout)
+
     def testSendNullSender(self):
         m = 'A test message'
         smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost',
@@ -704,7 +774,7 @@
     respdata = b'250 OK' + (b'.' * smtplib._MAXLINE * 2) + b'\n'
 
     def setUp(self):
-        self.thread_key = threading_setup()
+        self.thread_key = threading_helper.threading_setup()
         self.old_stdout = sys.stdout
         self.output = io.StringIO()
         sys.stdout = self.output
@@ -722,10 +792,10 @@
     def tearDown(self):
         self.evt.wait()
         sys.stdout = self.old_stdout
-        join_thread(self.thread)
+        threading_helper.join_thread(self.thread)
         del self.thread
         self.doCleanups()
-        threading_cleanup(*self.thread_key)
+        threading_helper.threading_cleanup(*self.thread_key)
 
     def testLineTooLong(self):
         self.assertRaises(smtplib.SMTPResponseException, smtplib.SMTP,
@@ -774,7 +844,7 @@
             except ResponseException as e:
                 self.smtp_state = self.COMMAND
                 self.push('%s %s' % (e.smtp_code, e.smtp_error))
-                return
+            return
         super().found_terminator()
 
 
@@ -840,6 +910,11 @@
             self._authenticated(self._auth_login_user, password == sim_auth[1])
             del self._auth_login_user
 
+    def _auth_buggy(self, arg=None):
+        # This AUTH mechanism will 'trap' client in a neverending 334
+        # base64 encoded 'BuGgYbUgGy'
+        self.push('334 QnVHZ1liVWdHeQ==')
+
     def _auth_cram_md5(self, arg=None):
         if arg is None:
             self.push('334 {}'.format(sim_cram_md5_challenge))
@@ -955,7 +1030,7 @@
 class SMTPSimTests(unittest.TestCase):
 
     def setUp(self):
-        self.thread_key = threading_setup()
+        self.thread_key = threading_helper.threading_setup()
         self.real_getfqdn = socket.getfqdn
         socket.getfqdn = mock_socket.getfqdn
         self.serv_evt = threading.Event()
@@ -978,10 +1053,10 @@
         self.client_evt.set()
         # wait for the server thread to terminate
         self.serv_evt.wait()
-        join_thread(self.thread)
+        threading_helper.join_thread(self.thread)
         del self.thread
         self.doCleanups()
-        threading_cleanup(*self.thread_key)
+        threading_helper.threading_cleanup(*self.thread_key)
 
     def testBasic(self):
         # smoke test
@@ -1058,7 +1133,45 @@
         self.assertEqual(resp, (235, b'Authentication Succeeded'))
         smtp.close()
 
-    @hashlib_helper.requires_hashdigest('md5')
+    def testAUTH_LOGIN_initial_response_ok(self):
+        self.serv.add_feature("AUTH LOGIN")
+        with smtplib.SMTP(HOST, self.port, local_hostname='localhost',
+                          timeout=support.LOOPBACK_TIMEOUT) as smtp:
+            smtp.user, smtp.password = sim_auth
+            smtp.ehlo("test_auth_login")
+            resp = smtp.auth("LOGIN", smtp.auth_login, initial_response_ok=True)
+            self.assertEqual(resp, (235, b'Authentication Succeeded'))
+
+    def testAUTH_LOGIN_initial_response_notok(self):
+        self.serv.add_feature("AUTH LOGIN")
+        with smtplib.SMTP(HOST, self.port, local_hostname='localhost',
+                          timeout=support.LOOPBACK_TIMEOUT) as smtp:
+            smtp.user, smtp.password = sim_auth
+            smtp.ehlo("test_auth_login")
+            resp = smtp.auth("LOGIN", smtp.auth_login, initial_response_ok=False)
+            self.assertEqual(resp, (235, b'Authentication Succeeded'))
+
+    def testAUTH_BUGGY(self):
+        self.serv.add_feature("AUTH BUGGY")
+
+        def auth_buggy(challenge=None):
+            self.assertEqual(b"BuGgYbUgGy", challenge)
+            return "\0"
+
+        smtp = smtplib.SMTP(
+            HOST, self.port, local_hostname='localhost',
+            timeout=support.LOOPBACK_TIMEOUT
+        )
+        try:
+            smtp.user, smtp.password = sim_auth
+            smtp.ehlo("test_auth_buggy")
+            expect = r"^Server AUTH mechanism infinite loop.*"
+            with self.assertRaisesRegex(smtplib.SMTPException, expect) as cm:
+                smtp.auth("BUGGY", auth_buggy, initial_response_ok=False)
+        finally:
+            smtp.close()
+
+    @hashlib_helper.requires_hashdigest('md5', openssl=True)
     def testAUTH_CRAM_MD5(self):
         self.serv.add_feature("AUTH CRAM-MD5")
         smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost',
@@ -1067,7 +1180,7 @@
         self.assertEqual(resp, (235, b'Authentication Succeeded'))
         smtp.close()
 
-    @hashlib_helper.requires_hashdigest('md5')
+    @hashlib_helper.requires_hashdigest('md5', openssl=True)
     def testAUTH_multiple(self):
         # Test that multiple authentication methods are tried.
         self.serv.add_feature("AUTH BOGUS PLAIN LOGIN CRAM-MD5")
@@ -1268,7 +1381,7 @@
     maxDiff = None
 
     def setUp(self):
-        self.thread_key = threading_setup()
+        self.thread_key = threading_helper.threading_setup()
         self.real_getfqdn = socket.getfqdn
         socket.getfqdn = mock_socket.getfqdn
         self.serv_evt = threading.Event()
@@ -1293,10 +1406,10 @@
         self.client_evt.set()
         # wait for the server thread to terminate
         self.serv_evt.wait()
-        join_thread(self.thread)
+        threading_helper.join_thread(self.thread)
         del self.thread
         self.doCleanups()
-        threading_cleanup(*self.thread_key)
+        threading_helper.threading_cleanup(*self.thread_key)
 
     def test_test_server_supports_extensions(self):
         smtp = smtplib.SMTP(
@@ -1397,7 +1510,7 @@
 
 class SMTPAUTHInitialResponseSimTests(unittest.TestCase):
     def setUp(self):
-        self.thread_key = threading_setup()
+        self.thread_key = threading_helper.threading_setup()
         self.real_getfqdn = socket.getfqdn
         socket.getfqdn = mock_socket.getfqdn
         self.serv_evt = threading.Event()
@@ -1421,10 +1534,10 @@
         self.client_evt.set()
         # wait for the server thread to terminate
         self.serv_evt.wait()
-        join_thread(self.thread)
+        threading_helper.join_thread(self.thread)
         del self.thread
         self.doCleanups()
-        threading_cleanup(*self.thread_key)
+        threading_helper.threading_cleanup(*self.thread_key)
 
     def testAUTH_PLAIN_initial_response_login(self):
         self.serv.add_feature('AUTH PLAIN')
diff --git a/Lib/test/test_smtpnet.py b/Lib/test/test_smtpnet.py
index 74a00a9..72f51cd 100644
--- a/Lib/test/test_smtpnet.py
+++ b/Lib/test/test_smtpnet.py
@@ -1,10 +1,11 @@
 import unittest
 from test import support
+from test.support import import_helper
 from test.support import socket_helper
 import smtplib
 import socket
 
-ssl = support.import_module("ssl")
+ssl = import_helper.import_module("ssl")
 
 support.requires("network")
 
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index aefba4f..5c15648 100755
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -1,6 +1,8 @@
 import unittest
 from test import support
+from test.support import os_helper
 from test.support import socket_helper
+from test.support import threading_helper
 
 import errno
 import io
@@ -197,7 +199,7 @@
         self.serv = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDPLITE)
         self.port = socket_helper.bind_port(self.serv)
 
-class ThreadSafeCleanupTestCase(unittest.TestCase):
+class ThreadSafeCleanupTestCase:
     """Subclass of unittest.TestCase with thread-safe cleanup methods.
 
     This subclass protects the addCleanup() and doCleanups() methods
@@ -222,7 +224,7 @@
     the following commands:
     # modprobe vcan
     # ip link add dev vcan0 type vcan
-    # ifconfig vcan0 up
+    # ip link set up vcan0
     """
     interface = 'vcan0'
     bufsize = 128
@@ -324,9 +326,7 @@
     def __init__(self):
         # Swap the true setup function
         self.__setUp = self.setUp
-        self.__tearDown = self.tearDown
         self.setUp = self._setUp
-        self.tearDown = self._tearDown
 
     def serverExplicitReady(self):
         """This method allows the server to explicitly indicate that
@@ -336,8 +336,9 @@
         self.server_ready.set()
 
     def _setUp(self):
-        self.wait_threads = support.wait_threads_exit()
+        self.wait_threads = threading_helper.wait_threads_exit()
         self.wait_threads.__enter__()
+        self.addCleanup(self.wait_threads.__exit__, None, None, None)
 
         self.server_ready = threading.Event()
         self.client_ready = threading.Event()
@@ -345,6 +346,11 @@
         self.queue = queue.Queue(1)
         self.server_crashed = False
 
+        def raise_queued_exception():
+            if self.queue.qsize():
+                raise self.queue.get()
+        self.addCleanup(raise_queued_exception)
+
         # Do some munging to start the client test.
         methodname = self.id()
         i = methodname.rfind('.')
@@ -361,15 +367,7 @@
         finally:
             self.server_ready.set()
         self.client_ready.wait()
-
-    def _tearDown(self):
-        self.__tearDown()
-        self.done.wait()
-        self.wait_threads.__exit__(None, None, None)
-
-        if self.queue.qsize():
-            exc = self.queue.get()
-            raise exc
+        self.addCleanup(self.done.wait)
 
     def clientRun(self, test_func):
         self.server_ready.wait()
@@ -696,7 +694,7 @@
     def bindSock(self, sock):
         path = tempfile.mktemp(dir=self.dir_path)
         socket_helper.bind_unix_socket(sock, path)
-        self.addCleanup(support.unlink, path)
+        self.addCleanup(os_helper.unlink, path)
 
 class UnixStreamBase(UnixSocketTestBase):
     """Base class for Unix-domain SOCK_STREAM tests."""
@@ -868,6 +866,7 @@
             p = proxy(s)
             self.assertEqual(p.fileno(), s.fileno())
         s = None
+        support.gc_collect()  # For PyPy or other GCs.
         try:
             p.fileno()
         except ReferenceError:
@@ -917,10 +916,8 @@
         self.assertIn('not NoneType', str(cm.exception))
         with self.assertRaises(TypeError) as cm:
             s.sendto(b'foo', 'bar', sockname)
-        self.assertIn('an integer is required', str(cm.exception))
         with self.assertRaises(TypeError) as cm:
             s.sendto(b'foo', None, None)
-        self.assertIn('an integer is required', str(cm.exception))
         # wrong number of args
         with self.assertRaises(TypeError) as cm:
             s.sendto(b'foo')
@@ -1121,9 +1118,11 @@
         s_good_values = [0, 1, 2, 0xffff]
         l_good_values = s_good_values + [0xffffffff]
         l_bad_values = [-1, -2, 1<<32, 1<<1000]
-        s_bad_values = l_bad_values + [_testcapi.INT_MIN - 1,
-                                       _testcapi.INT_MAX + 1]
-        s_deprecated_values = [1<<16, _testcapi.INT_MAX]
+        s_bad_values = (
+            l_bad_values +
+            [_testcapi.INT_MIN-1, _testcapi.INT_MAX+1] +
+            [1 << 16, _testcapi.INT_MAX]
+        )
         for k in s_good_values:
             socket.ntohs(k)
             socket.htons(k)
@@ -1136,9 +1135,6 @@
         for k in l_bad_values:
             self.assertRaises(OverflowError, socket.ntohl, k)
             self.assertRaises(OverflowError, socket.htonl, k)
-        for k in s_deprecated_values:
-            self.assertWarns(DeprecationWarning, socket.ntohs, k)
-            self.assertWarns(DeprecationWarning, socket.htons, k)
 
     def testGetServBy(self):
         eq = self.assertEqual
@@ -1611,7 +1607,7 @@
             if with_timeout:
                 signal.signal(signal.SIGALRM, ok_handler)
                 signal.alarm(1)
-                self.assertRaises(socket.timeout, c.sendall,
+                self.assertRaises(TimeoutError, c.sendall,
                                   b"x" * support.SOCK_MAX_SIZE)
         finally:
             signal.alarm(0)
@@ -1679,7 +1675,8 @@
         for mode in 'r', 'rb', 'rw', 'w', 'wb':
             with self.subTest(mode=mode):
                 with socket.socket() as sock:
-                    with sock.makefile(mode) as fp:
+                    encoding = None if "b" in mode else "utf-8"
+                    with sock.makefile(mode, encoding=encoding) as fp:
                         self.assertEqual(fp.mode, mode)
 
     def test_makefile_invalid_mode(self):
@@ -1738,6 +1735,7 @@
     @unittest.skipUnless(socket_helper.IPV6_ENABLED, 'IPv6 required for this test.')
     @unittest.skipIf(sys.platform == 'win32', 'does not work on Windows')
     @unittest.skipIf(AIX, 'Symbolic scope id does not work')
+    @unittest.skipUnless(hasattr(socket, 'if_nameindex'), "test needs socket.if_nameindex()")
     def test_getaddrinfo_ipv6_scopeid_symbolic(self):
         # Just pick up any network interface (Linux, Mac OS X)
         (ifindex, test_interface) = socket.if_nameindex()[0]
@@ -1770,6 +1768,7 @@
     @unittest.skipUnless(socket_helper.IPV6_ENABLED, 'IPv6 required for this test.')
     @unittest.skipIf(sys.platform == 'win32', 'does not work on Windows')
     @unittest.skipIf(AIX, 'Symbolic scope id does not work')
+    @unittest.skipUnless(hasattr(socket, 'if_nameindex'), "test needs socket.if_nameindex()")
     def test_getnameinfo_ipv6_scopeid_symbolic(self):
         # Just pick up any network interface.
         (ifindex, test_interface) = socket.if_nameindex()[0]
@@ -1899,11 +1898,11 @@
                                          socket.SOCK_STREAM)
 
     def test_socket_fileno_rejects_float(self):
-        with self.assertRaisesRegex(TypeError, "integer argument expected"):
+        with self.assertRaises(TypeError):
             socket.socket(socket.AF_INET, socket.SOCK_STREAM, fileno=42.5)
 
     def test_socket_fileno_rejects_other_types(self):
-        with self.assertRaisesRegex(TypeError, "integer is required"):
+        with self.assertRaises(TypeError):
             socket.socket(socket.AF_INET, socket.SOCK_STREAM, fileno="foo")
 
     def test_socket_fileno_rejects_invalid_socket(self):
@@ -1918,14 +1917,14 @@
     def test_socket_fileno_requires_valid_fd(self):
         WSAENOTSOCK = 10038
         with self.assertRaises(OSError) as cm:
-            socket.socket(fileno=support.make_bad_fd())
+            socket.socket(fileno=os_helper.make_bad_fd())
         self.assertIn(cm.exception.errno, (errno.EBADF, WSAENOTSOCK))
 
         with self.assertRaises(OSError) as cm:
             socket.socket(
                 socket.AF_INET,
                 socket.SOCK_STREAM,
-                fileno=support.make_bad_fd())
+                fileno=os_helper.make_bad_fd())
         self.assertIn(cm.exception.errno, (errno.EBADF, WSAENOTSOCK))
 
     def test_socket_fileno_requires_socket_fd(self):
@@ -2048,7 +2047,6 @@
         cf, addr = self.s.recvfrom(self.bufsize)
         self.assertEqual(self.cf, cf)
         self.assertEqual(addr[0], self.interface)
-        self.assertEqual(addr[1], socket.AF_CAN)
 
     def _testSendFrame(self):
         self.cf = self.build_can_frame(0x00, b'\x01\x02\x03\x04\x05')
@@ -2966,7 +2964,7 @@
             try:
                 while True:
                     self.sendmsgToServer([b"a"*512])
-            except socket.timeout:
+            except TimeoutError:
                 pass
             except OSError as exc:
                 if exc.errno != errno.ENOMEM:
@@ -2974,7 +2972,7 @@
                 # bpo-33937 the test randomly fails on Travis CI with
                 # "OSError: [Errno 12] Cannot allocate memory"
             else:
-                self.fail("socket.timeout not raised")
+                self.fail("TimeoutError not raised")
         finally:
             self.misc_event.set()
 
@@ -3109,7 +3107,7 @@
         # Check that timeout works.
         try:
             self.serv_sock.settimeout(0.03)
-            self.assertRaises(socket.timeout,
+            self.assertRaises(TimeoutError,
                               self.doRecvmsg, self.serv_sock, len(MSG))
         finally:
             self.misc_event.set()
@@ -4129,7 +4127,7 @@
 
     @requireAttrs(socket, "CMSG_SPACE", "IPV6_RECVHOPLIMIT", "IPV6_HOPLIMIT",
                   "IPV6_RECVTCLASS", "IPV6_TCLASS")
-    def testSecomdCmsgTruncInData(self):
+    def testSecondCmsgTruncInData(self):
         # Test truncation of the second of two control messages inside
         # its associated data.
         self.serv_sock.setsockopt(socket.IPPROTO_IPV6,
@@ -4164,8 +4162,8 @@
 
         self.assertEqual(ancdata, [])
 
-    @testSecomdCmsgTruncInData.client_skip
-    def _testSecomdCmsgTruncInData(self):
+    @testSecondCmsgTruncInData.client_skip
+    def _testSecondCmsgTruncInData(self):
         self.assertTrue(self.misc_event.wait(timeout=self.fail_timeout))
         self.sendToServer(MSG)
 
@@ -4415,7 +4413,7 @@
 # threads alive during the test so that the OS cannot deliver the
 # signal to the wrong one.
 
-class InterruptedTimeoutBase(unittest.TestCase):
+class InterruptedTimeoutBase:
     # Base class for interrupted send/receive tests.  Installs an
     # empty handler for SIGALRM and removes it on teardown, along with
     # any scheduled alarms.
@@ -4827,7 +4825,7 @@
         self.cli_conn.settimeout(1)
         self.read_file.read(3)
         # First read raises a timeout
-        self.assertRaises(socket.timeout, self.read_file.read, 1)
+        self.assertRaises(TimeoutError, self.read_file.read, 1)
         # Second read is disallowed
         with self.assertRaises(OSError) as ctx:
             self.read_file.read(1)
@@ -5092,7 +5090,7 @@
 
     class MockSocket(socket.socket):
         def connect(self, *args):
-            raise socket.timeout('timed out')
+            raise TimeoutError('timed out')
 
     @contextlib.contextmanager
     def mocked_socket_module(self):
@@ -5142,13 +5140,13 @@
         with self.mocked_socket_module():
             try:
                 socket.create_connection((HOST, 1234))
-            except socket.timeout:
+            except TimeoutError:
                 pass
             except OSError as exc:
                 if socket_helper.IPV6_ENABLED or exc.errno != errno.EAFNOSUPPORT:
                     raise
             else:
-                self.fail('socket.timeout not raised')
+                self.fail('TimeoutError not raised')
 
 
 class NetworkConnectionAttributesTest(SocketTCPTest, ThreadableTest):
@@ -5250,7 +5248,7 @@
 
     def _testOutsideTimeout(self):
         self.cli = sock = socket.create_connection((HOST, self.port), timeout=1)
-        self.assertRaises(socket.timeout, lambda: sock.recv(5))
+        self.assertRaises(TimeoutError, lambda: sock.recv(5))
 
 
 class TCPTimeoutTest(SocketTCPTest):
@@ -5259,7 +5257,7 @@
         def raise_timeout(*args, **kwargs):
             self.serv.settimeout(1.0)
             self.serv.accept()
-        self.assertRaises(socket.timeout, raise_timeout,
+        self.assertRaises(TimeoutError, raise_timeout,
                               "Error generating a timeout exception (TCP)")
 
     def testTimeoutZero(self):
@@ -5267,7 +5265,7 @@
         try:
             self.serv.settimeout(0.0)
             foo = self.serv.accept()
-        except socket.timeout:
+        except TimeoutError:
             self.fail("caught timeout instead of error (TCP)")
         except OSError:
             ok = True
@@ -5292,7 +5290,7 @@
             try:
                 signal.alarm(2)    # POSIX allows alarm to be up to 1 second early
                 foo = self.serv.accept()
-            except socket.timeout:
+            except TimeoutError:
                 self.fail("caught timeout instead of Alarm")
             except Alarm:
                 pass
@@ -5316,7 +5314,7 @@
         def raise_timeout(*args, **kwargs):
             self.serv.settimeout(1.0)
             self.serv.recv(1024)
-        self.assertRaises(socket.timeout, raise_timeout,
+        self.assertRaises(TimeoutError, raise_timeout,
                               "Error generating a timeout exception (UDP)")
 
     def testTimeoutZero(self):
@@ -5324,7 +5322,7 @@
         try:
             self.serv.settimeout(0.0)
             foo = self.serv.recv(1024)
-        except socket.timeout:
+        except TimeoutError:
             self.fail("caught timeout instead of error (UDP)")
         except OSError:
             ok = True
@@ -5341,7 +5339,7 @@
         def raise_timeout(*args, **kwargs):
             self.serv.settimeout(1.0)
             self.serv.recv(1024)
-        self.assertRaises(socket.timeout, raise_timeout,
+        self.assertRaises(TimeoutError, raise_timeout,
                               "Error generating a timeout exception (UDPLITE)")
 
     def testTimeoutZero(self):
@@ -5349,7 +5347,7 @@
         try:
             self.serv.settimeout(0.0)
             foo = self.serv.recv(1024)
-        except socket.timeout:
+        except TimeoutError:
             self.fail("caught timeout instead of error (UDPLITE)")
         except OSError:
             ok = True
@@ -5365,6 +5363,8 @@
         self.assertTrue(issubclass(socket.herror, OSError))
         self.assertTrue(issubclass(socket.gaierror, OSError))
         self.assertTrue(issubclass(socket.timeout, OSError))
+        self.assertIs(socket.error, OSError)
+        self.assertIs(socket.timeout, TimeoutError)
 
     def test_setblocking_invalidfd(self):
         # Regression test for issue #28471
@@ -5459,35 +5459,35 @@
 
     def testStrAddr(self):
         # Test binding to and retrieving a normal string pathname.
-        path = os.path.abspath(support.TESTFN)
+        path = os.path.abspath(os_helper.TESTFN)
         self.bind(self.sock, path)
-        self.addCleanup(support.unlink, path)
+        self.addCleanup(os_helper.unlink, path)
         self.assertEqual(self.sock.getsockname(), path)
 
     def testBytesAddr(self):
         # Test binding to a bytes pathname.
-        path = os.path.abspath(support.TESTFN)
+        path = os.path.abspath(os_helper.TESTFN)
         self.bind(self.sock, self.encoded(path))
-        self.addCleanup(support.unlink, path)
+        self.addCleanup(os_helper.unlink, path)
         self.assertEqual(self.sock.getsockname(), path)
 
     def testSurrogateescapeBind(self):
         # Test binding to a valid non-ASCII pathname, with the
         # non-ASCII bytes supplied using surrogateescape encoding.
-        path = os.path.abspath(support.TESTFN_UNICODE)
+        path = os.path.abspath(os_helper.TESTFN_UNICODE)
         b = self.encoded(path)
         self.bind(self.sock, b.decode("ascii", "surrogateescape"))
-        self.addCleanup(support.unlink, path)
+        self.addCleanup(os_helper.unlink, path)
         self.assertEqual(self.sock.getsockname(), path)
 
     def testUnencodableAddr(self):
         # Test binding to a pathname that cannot be encoded in the
         # file system encoding.
-        if support.TESTFN_UNENCODABLE is None:
+        if os_helper.TESTFN_UNENCODABLE is None:
             self.skipTest("No unencodable filename available")
-        path = os.path.abspath(support.TESTFN_UNENCODABLE)
+        path = os.path.abspath(os_helper.TESTFN_UNENCODABLE)
         self.bind(self.sock, path)
-        self.addCleanup(support.unlink, path)
+        self.addCleanup(os_helper.unlink, path)
         self.assertEqual(self.sock.getsockname(), path)
 
 
@@ -5587,7 +5587,7 @@
     if not hasattr(socket, "AF_TIPC"):
         return False
     try:
-        f = open("/proc/modules")
+        f = open("/proc/modules", encoding="utf-8")
     except (FileNotFoundError, IsADirectoryError, PermissionError):
         # It's ok if the file does not exist, is a directory or if we
         # have not the permission to read it.
@@ -5961,16 +5961,16 @@
 
         chunk = b"".join([random.choice(string.ascii_letters).encode()
                           for i in range(cls.BUFSIZE)])
-        with open(support.TESTFN, 'wb') as f:
+        with open(os_helper.TESTFN, 'wb') as f:
             for csize in chunks(cls.FILESIZE, cls.BUFSIZE):
                 f.write(chunk)
-        with open(support.TESTFN, 'rb') as f:
+        with open(os_helper.TESTFN, 'rb') as f:
             cls.FILEDATA = f.read()
             assert len(cls.FILEDATA) == cls.FILESIZE
 
     @classmethod
     def tearDownClass(cls):
-        support.unlink(support.TESTFN)
+        os_helper.unlink(os_helper.TESTFN)
 
     def accept_conn(self):
         self.serv.settimeout(support.LONG_TIMEOUT)
@@ -5997,7 +5997,7 @@
 
     def _testRegularFile(self):
         address = self.serv.getsockname()
-        file = open(support.TESTFN, 'rb')
+        file = open(os_helper.TESTFN, 'rb')
         with socket.create_connection(address) as sock, file as file:
             meth = self.meth_from_sock(sock)
             sent = meth(file)
@@ -6032,9 +6032,9 @@
 
     def _testEmptyFileSend(self):
         address = self.serv.getsockname()
-        filename = support.TESTFN + "2"
+        filename = os_helper.TESTFN + "2"
         with open(filename, 'wb'):
-            self.addCleanup(support.unlink, filename)
+            self.addCleanup(os_helper.unlink, filename)
         file = open(filename, 'rb')
         with socket.create_connection(address) as sock, file as file:
             meth = self.meth_from_sock(sock)
@@ -6051,7 +6051,7 @@
 
     def _testOffset(self):
         address = self.serv.getsockname()
-        file = open(support.TESTFN, 'rb')
+        file = open(os_helper.TESTFN, 'rb')
         with socket.create_connection(address) as sock, file as file:
             meth = self.meth_from_sock(sock)
             sent = meth(file, offset=5000)
@@ -6068,7 +6068,7 @@
 
     def _testCount(self):
         address = self.serv.getsockname()
-        file = open(support.TESTFN, 'rb')
+        file = open(os_helper.TESTFN, 'rb')
         sock = socket.create_connection(address,
                                         timeout=support.LOOPBACK_TIMEOUT)
         with sock, file:
@@ -6089,7 +6089,7 @@
 
     def _testCountSmall(self):
         address = self.serv.getsockname()
-        file = open(support.TESTFN, 'rb')
+        file = open(os_helper.TESTFN, 'rb')
         sock = socket.create_connection(address,
                                         timeout=support.LOOPBACK_TIMEOUT)
         with sock, file:
@@ -6110,7 +6110,7 @@
 
     def _testCountWithOffset(self):
         address = self.serv.getsockname()
-        file = open(support.TESTFN, 'rb')
+        file = open(os_helper.TESTFN, 'rb')
         with socket.create_connection(address, timeout=2) as sock, file as file:
             count = 100007
             meth = self.meth_from_sock(sock)
@@ -6129,7 +6129,7 @@
 
     def _testNonBlocking(self):
         address = self.serv.getsockname()
-        file = open(support.TESTFN, 'rb')
+        file = open(os_helper.TESTFN, 'rb')
         with socket.create_connection(address) as sock, file as file:
             sock.setblocking(False)
             meth = self.meth_from_sock(sock)
@@ -6145,7 +6145,7 @@
 
     def _testWithTimeout(self):
         address = self.serv.getsockname()
-        file = open(support.TESTFN, 'rb')
+        file = open(os_helper.TESTFN, 'rb')
         sock = socket.create_connection(address,
                                         timeout=support.LOOPBACK_TIMEOUT)
         with sock, file:
@@ -6163,15 +6163,16 @@
 
     def _testWithTimeoutTriggeredSend(self):
         address = self.serv.getsockname()
-        with open(support.TESTFN, 'rb') as file:
+        with open(os_helper.TESTFN, 'rb') as file:
             with socket.create_connection(address) as sock:
                 sock.settimeout(0.01)
                 meth = self.meth_from_sock(sock)
-                self.assertRaises(socket.timeout, meth, file)
+                self.assertRaises(TimeoutError, meth, file)
 
     def testWithTimeoutTriggeredSend(self):
         conn = self.accept_conn()
         conn.recv(88192)
+        time.sleep(1)
 
     # errors
 
@@ -6179,17 +6180,17 @@
         pass
 
     def test_errors(self):
-        with open(support.TESTFN, 'rb') as file:
+        with open(os_helper.TESTFN, 'rb') as file:
             with socket.socket(type=socket.SOCK_DGRAM) as s:
                 meth = self.meth_from_sock(s)
                 self.assertRaisesRegex(
                     ValueError, "SOCK_STREAM", meth, file)
-        with open(support.TESTFN, 'rt') as file:
+        with open(os_helper.TESTFN, encoding="utf-8") as file:
             with socket.socket() as s:
                 meth = self.meth_from_sock(s)
                 self.assertRaisesRegex(
                     ValueError, "binary mode", meth, file)
-        with open(support.TESTFN, 'rb') as file:
+        with open(os_helper.TESTFN, 'rb') as file:
             with socket.socket() as s:
                 meth = self.meth_from_sock(s)
                 self.assertRaisesRegex(TypeError, "positive integer",
@@ -6408,6 +6409,12 @@
             sock.bind(("type", "n" * 64))
 
 
+@unittest.skipUnless(sys.platform == 'darwin', 'macOS specific test')
+class TestMacOSTCPFlags(unittest.TestCase):
+    def test_tcp_keepalive(self):
+        self.assertTrue(socket.TCP_KEEPALIVE)
+
+
 @unittest.skipUnless(sys.platform.startswith("win"), "requires Windows")
 class TestMSWindowsTCPFlags(unittest.TestCase):
     knownTCPFlags = {
@@ -6485,13 +6492,6 @@
 class CreateServerFunctionalTest(unittest.TestCase):
     timeout = support.LOOPBACK_TIMEOUT
 
-    def setUp(self):
-        self.thread = None
-
-    def tearDown(self):
-        if self.thread is not None:
-            self.thread.join(self.timeout)
-
     def echo_server(self, sock):
         def run(sock):
             with sock:
@@ -6505,8 +6505,9 @@
 
         event = threading.Event()
         sock.settimeout(self.timeout)
-        self.thread = threading.Thread(target=run, args=(sock, ))
-        self.thread.start()
+        thread = threading.Thread(target=run, args=(sock, ))
+        thread.start()
+        self.addCleanup(thread.join, self.timeout)
         event.set()
 
     def echo_client(self, addr, family):
@@ -6594,83 +6595,10 @@
             self.assertEqual(data,  str(index).encode())
 
 
-def test_main():
-    tests = [GeneralModuleTests, BasicTCPTest, TCPCloserTest, TCPTimeoutTest,
-             TestExceptions, BufferIOTest, BasicTCPTest2, BasicUDPTest,
-             UDPTimeoutTest, CreateServerTest, CreateServerFunctionalTest,
-             SendRecvFdsTests]
-
-    tests.extend([
-        NonBlockingTCPTests,
-        FileObjectClassTestCase,
-        UnbufferedFileObjectClassTestCase,
-        LineBufferedFileObjectClassTestCase,
-        SmallBufferedFileObjectClassTestCase,
-        UnicodeReadFileObjectClassTestCase,
-        UnicodeWriteFileObjectClassTestCase,
-        UnicodeReadWriteFileObjectClassTestCase,
-        NetworkConnectionNoServer,
-        NetworkConnectionAttributesTest,
-        NetworkConnectionBehaviourTest,
-        ContextManagersTest,
-        InheritanceTest,
-        NonblockConstantTest
-    ])
-    tests.append(BasicSocketPairTest)
-    tests.append(TestUnixDomain)
-    tests.append(TestLinuxAbstractNamespace)
-    tests.extend([TIPCTest, TIPCThreadableTest])
-    tests.extend([BasicCANTest, CANTest])
-    tests.extend([BasicRDSTest, RDSTest])
-    tests.append(LinuxKernelCryptoAPI)
-    tests.append(BasicQIPCRTRTest)
-    tests.extend([
-        BasicVSOCKTest,
-        ThreadedVSOCKSocketStreamTest,
-    ])
-    tests.append(BasicBluetoothTest)
-    tests.extend([
-        CmsgMacroTests,
-        SendmsgUDPTest,
-        RecvmsgUDPTest,
-        RecvmsgIntoUDPTest,
-        SendmsgUDP6Test,
-        RecvmsgUDP6Test,
-        RecvmsgRFC3542AncillaryUDP6Test,
-        RecvmsgIntoRFC3542AncillaryUDP6Test,
-        RecvmsgIntoUDP6Test,
-        SendmsgUDPLITETest,
-        RecvmsgUDPLITETest,
-        RecvmsgIntoUDPLITETest,
-        SendmsgUDPLITE6Test,
-        RecvmsgUDPLITE6Test,
-        RecvmsgRFC3542AncillaryUDPLITE6Test,
-        RecvmsgIntoRFC3542AncillaryUDPLITE6Test,
-        RecvmsgIntoUDPLITE6Test,
-        SendmsgTCPTest,
-        RecvmsgTCPTest,
-        RecvmsgIntoTCPTest,
-        SendmsgSCTPStreamTest,
-        RecvmsgSCTPStreamTest,
-        RecvmsgIntoSCTPStreamTest,
-        SendmsgUnixStreamTest,
-        RecvmsgUnixStreamTest,
-        RecvmsgIntoUnixStreamTest,
-        RecvmsgSCMRightsStreamTest,
-        RecvmsgIntoSCMRightsStreamTest,
-        # These are slow when setitimer() is not available
-        InterruptedRecvTimeoutTest,
-        InterruptedSendTimeoutTest,
-        TestSocketSharing,
-        SendfileUsingSendTest,
-        SendfileUsingSendfileTest,
-    ])
-    tests.append(TestMSWindowsTCPFlags)
-
-    thread_info = support.threading_setup()
-    support.run_unittest(*tests)
-    support.threading_cleanup(*thread_info)
+def setUpModule():
+    thread_info = threading_helper.threading_setup()
+    unittest.addModuleCleanup(threading_helper.threading_cleanup, *thread_info)
 
 
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_socketserver.py b/Lib/test/test_socketserver.py
index c663cc9..211321f 100644
--- a/Lib/test/test_socketserver.py
+++ b/Lib/test/test_socketserver.py
@@ -14,8 +14,10 @@
 import socketserver
 
 import test.support
-from test.support import reap_children, reap_threads, verbose
+from test.support import reap_children, verbose
+from test.support import os_helper
 from test.support import socket_helper
+from test.support import threading_helper
 
 
 test.support.requires("network")
@@ -120,7 +122,7 @@
         self.assertEqual(server.server_address, server.socket.getsockname())
         return server
 
-    @reap_threads
+    @threading_helper.reap_threads
     def run_server(self, svrcls, hdlrbase, testfunc):
         server = self.make_server(self.pickaddr(svrcls.address_family),
                                   svrcls, hdlrbase)
@@ -249,7 +251,7 @@
                         socketserver.DatagramRequestHandler,
                         self.dgram_examine)
 
-    @reap_threads
+    @threading_helper.reap_threads
     def test_shutdown(self):
         # Issue #2302: shutdown() should always succeed in making an
         # other thread leave serve_forever().
@@ -275,6 +277,13 @@
             t.join()
             s.server_close()
 
+    def test_close_immediately(self):
+        class MyServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
+            pass
+
+        server = MyServer((HOST, 0), lambda: None)
+        server.server_close()
+
     def test_tcpserver_bind_leak(self):
         # Issue #22435: the server socket wouldn't be closed if bind()/listen()
         # failed.
@@ -298,7 +307,7 @@
     KeyboardInterrupt are not passed."""
 
     def tearDown(self):
-        test.support.unlink(test.support.TESTFN)
+        os_helper.unlink(os_helper.TESTFN)
 
     def test_sync_handled(self):
         BaseErrorTestServer(ValueError)
@@ -314,8 +323,11 @@
         self.check_result(handled=True)
 
     def test_threading_not_handled(self):
-        ThreadingErrorTestServer(SystemExit)
-        self.check_result(handled=False)
+        with threading_helper.catch_threading_exception() as cm:
+            ThreadingErrorTestServer(SystemExit)
+            self.check_result(handled=False)
+
+            self.assertIs(cm.exc_type, SystemExit)
 
     @requires_forking
     def test_forking_handled(self):
@@ -328,7 +340,7 @@
         self.check_result(handled=False)
 
     def check_result(self, handled):
-        with open(test.support.TESTFN) as log:
+        with open(os_helper.TESTFN) as log:
             expected = 'Handler called\n' + 'Error handled\n' * handled
             self.assertEqual(log.read(), expected)
 
@@ -346,7 +358,7 @@
         self.wait_done()
 
     def handle_error(self, request, client_address):
-        with open(test.support.TESTFN, 'a') as log:
+        with open(os_helper.TESTFN, 'a') as log:
             log.write('Error handled\n')
 
     def wait_done(self):
@@ -355,7 +367,7 @@
 
 class BadHandler(socketserver.BaseRequestHandler):
     def handle(self):
-        with open(test.support.TESTFN, 'a') as log:
+        with open(os_helper.TESTFN, 'a') as log:
             log.write('Handler called\n')
         raise self.server.exception('Test error')
 
@@ -489,6 +501,22 @@
         self.assertEqual(server.shutdown_called, 1)
         server.server_close()
 
+    def test_threads_reaped(self):
+        """
+        In #37193, users reported a memory leak
+        due to the saving of every request thread. Ensure that
+        not all threads are kept forever.
+        """
+        class MyServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
+            pass
+
+        server = MyServer((HOST, 0), socketserver.StreamRequestHandler)
+        for n in range(10):
+            with socket.create_connection(server.server_address):
+                server.handle_request()
+        self.assertLess(len(server._threads), 10)
+        server.server_close()
+
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/Lib/test/test_source_encoding.py b/Lib/test/test_source_encoding.py
index 5ca4346..a0cb605 100644
--- a/Lib/test/test_source_encoding.py
+++ b/Lib/test/test_source_encoding.py
@@ -1,7 +1,9 @@
 # -*- coding: koi8-r -*-
 
 import unittest
-from test.support import TESTFN, unlink, unload, rmtree, script_helper, captured_stdout
+from test.support import script_helper, captured_stdout
+from test.support.os_helper import TESTFN, unlink, rmtree
+from test.support.import_helper import unload
 import importlib
 import os
 import sys
@@ -203,6 +205,23 @@
                b'print(ascii("\xc3\xa4"))\n')
         self.check_script_output(src, br"'\xe4'")
 
+    def test_crlf(self):
+        src = (b'print(ascii("""\r\n"""))\n')
+        out = self.check_script_output(src, br"'\n'")
+
+    def test_crcrlf(self):
+        src = (b'print(ascii("""\r\r\n"""))\n')
+        out = self.check_script_output(src, br"'\n\n'")
+
+    def test_crcrcrlf(self):
+        src = (b'print(ascii("""\r\r\r\n"""))\n')
+        out = self.check_script_output(src, br"'\n\n\n'")
+
+    def test_crcrcrlf2(self):
+        src = (b'#coding:iso-8859-1\n'
+               b'print(ascii("""\r\r\r\n"""))\n')
+        out = self.check_script_output(src, br"'\n\n\n'")
+
 
 class BytesSourceEncodingTest(AbstractSourceEncodingTest, unittest.TestCase):
 
diff --git a/Lib/test/test_spwd.py b/Lib/test/test_spwd.py
index 07793c8..a143acc 100644
--- a/Lib/test/test_spwd.py
+++ b/Lib/test/test_spwd.py
@@ -1,8 +1,9 @@
 import os
 import unittest
-from test import support
+from test.support import import_helper
 
-spwd = support.import_module('spwd')
+
+spwd = import_helper.import_module('spwd')
 
 
 @unittest.skipUnless(hasattr(os, 'geteuid') and os.geteuid() == 0,
diff --git a/Lib/test/test_sqlite.py b/Lib/test/test_sqlite.py
index 9564da3..73002f2 100644
--- a/Lib/test/test_sqlite.py
+++ b/Lib/test/test_sqlite.py
@@ -1,7 +1,8 @@
 import test.support
+from test.support import import_helper
 
 # Skip test if _sqlite3 module not installed
-test.support.import_module('_sqlite3')
+import_helper.import_module('_sqlite3')
 
 import unittest
 import sqlite3
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index 27cb884..873db64 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -4,7 +4,11 @@
 import unittest
 import unittest.mock
 from test import support
+from test.support import import_helper
+from test.support import os_helper
 from test.support import socket_helper
+from test.support import threading_helper
+from test.support import warnings_helper
 import socket
 import select
 import time
@@ -16,7 +20,6 @@
 import urllib.request
 import threading
 import traceback
-import asyncore
 import weakref
 import platform
 import sysconfig
@@ -26,18 +29,22 @@
 except ImportError:
     ctypes = None
 
-ssl = support.import_module("ssl")
+import warnings
+with warnings.catch_warnings():
+    warnings.simplefilter('ignore', DeprecationWarning)
+    import asyncore
 
-from ssl import TLSVersion, _TLSContentType, _TLSMessageType
+ssl = import_helper.import_module("ssl")
+import _ssl
+
+from ssl import TLSVersion, _TLSContentType, _TLSMessageType, _TLSAlertType
 
 Py_DEBUG = hasattr(sys, 'gettotalrefcount')
 Py_DEBUG_WIN32 = Py_DEBUG and sys.platform == 'win32'
 
 PROTOCOLS = sorted(ssl._PROTOCOL_NAMES)
 HOST = socket_helper.HOST
-IS_LIBRESSL = ssl.OPENSSL_VERSION.startswith('LibreSSL')
-IS_OPENSSL_1_1_0 = not IS_LIBRESSL and ssl.OPENSSL_VERSION_INFO >= (1, 1, 0)
-IS_OPENSSL_1_1_1 = not IS_LIBRESSL and ssl.OPENSSL_VERSION_INFO >= (1, 1, 1)
+IS_OPENSSL_3_0_0 = ssl.OPENSSL_VERSION_INFO >= (3, 0, 0)
 PY_SSL_DEFAULT_CIPHERS = sysconfig.get_config_var('PY_SSL_DEFAULT_CIPHERS')
 
 PROTOCOL_TO_TLS_VERSION = {}
@@ -58,7 +65,7 @@
 
 # The custom key and certificate files used in test_ssl are generated
 # using Lib/test/make_ssl_certs.py.
-# Other certificates are simply fetched from the Internet servers they
+# Other certificates are simply fetched from the internet servers they
 # are meant to authenticate.
 
 CERTFILE = data_file("keycert.pem")
@@ -105,7 +112,7 @@
     'issuer': ((('countryName', 'XY'),),
             (('organizationName', 'Python Software Foundation CA'),),
             (('commonName', 'our-ca-server'),)),
-    'notAfter': 'Jul  7 14:23:16 2028 GMT',
+    'notAfter': 'Oct 28 14:23:16 2037 GMT',
     'notBefore': 'Aug 29 14:23:16 2018 GMT',
     'serialNumber': 'CB2D80995A69525C',
     'subject': ((('countryName', 'XY'),),
@@ -126,6 +133,8 @@
 # cert with all kinds of subject alt names
 ALLSANFILE = data_file("allsans.pem")
 IDNSANSFILE = data_file("idnsans.pem")
+NOSANFILE = data_file("nosan.pem")
+NOSAN_HOSTNAME = 'localhost'
 
 REMOTE_HOST = "self-signed.pythontest.net"
 
@@ -146,6 +155,31 @@
 OP_SINGLE_ECDH_USE = getattr(ssl, "OP_SINGLE_ECDH_USE", 0)
 OP_CIPHER_SERVER_PREFERENCE = getattr(ssl, "OP_CIPHER_SERVER_PREFERENCE", 0)
 OP_ENABLE_MIDDLEBOX_COMPAT = getattr(ssl, "OP_ENABLE_MIDDLEBOX_COMPAT", 0)
+OP_IGNORE_UNEXPECTED_EOF = getattr(ssl, "OP_IGNORE_UNEXPECTED_EOF", 0)
+
+# Ubuntu has patched OpenSSL and changed behavior of security level 2
+# see https://bugs.python.org/issue41561#msg389003
+def is_ubuntu():
+    try:
+        # Assume that any references of "ubuntu" implies Ubuntu-like distro
+        # The workaround is not required for 18.04, but doesn't hurt either.
+        with open("/etc/os-release", encoding="utf-8") as f:
+            return "ubuntu" in f.read()
+    except FileNotFoundError:
+        return False
+
+if is_ubuntu():
+    def seclevel_workaround(*ctxs):
+        """"Lower security level to '1' and allow all ciphers for TLS 1.0/1"""
+        for ctx in ctxs:
+            if (
+                hasattr(ctx, "minimum_version") and
+                ctx.minimum_version <= ssl.TLSVersion.TLSv1_1
+            ):
+                ctx.set_ciphers("@SECLEVEL=1:ALL")
+else:
+    def seclevel_workaround(*ctxs):
+        pass
 
 
 def has_tls_protocol(protocol):
@@ -187,9 +221,13 @@
     if not getattr(ssl, f'HAS_{version.name}'):
         return False
 
+    if IS_OPENSSL_3_0_0 and version < ssl.TLSVersion.TLSv1_2:
+        # bpo43791: 3.0.0-alpha14 fails with TLSV1_ALERT_INTERNAL_ERROR
+        return False
+
     # check runtime and dynamic crypto policy settings. A TLS version may
     # be compiled in but disabled by a policy or config option.
-    ctx = ssl.SSLContext()
+    ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
     if (
             hasattr(ctx, 'minimum_version') and
             ctx.minimum_version != ssl.TLSVersion.MINIMUM_SUPPORTED and
@@ -223,43 +261,11 @@
     return decorator
 
 
-requires_minimum_version = unittest.skipUnless(
-    hasattr(ssl.SSLContext, 'minimum_version'),
-    "required OpenSSL >= 1.1.0g"
-)
-
-
 def handle_error(prefix):
     exc_format = ' '.join(traceback.format_exception(*sys.exc_info()))
     if support.verbose:
         sys.stdout.write(prefix + exc_format)
 
-def can_clear_options():
-    # 0.9.8m or higher
-    return ssl._OPENSSL_API_VERSION >= (0, 9, 8, 13, 15)
-
-def no_sslv2_implies_sslv3_hello():
-    # 0.9.7h or higher
-    return ssl.OPENSSL_VERSION_INFO >= (0, 9, 7, 8, 15)
-
-def have_verify_flags():
-    # 0.9.8 or higher
-    return ssl.OPENSSL_VERSION_INFO >= (0, 9, 8, 0, 15)
-
-def _have_secp_curves():
-    if not ssl.HAS_ECDH:
-        return False
-    ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
-    try:
-        ctx.set_ecdh_curve("secp384r1")
-    except ValueError:
-        return False
-    else:
-        return True
-
-
-HAVE_SECP_CURVES = _have_secp_curves()
-
 
 def utc_offset(): #NOTE: ignore issues like #1647654
     # local time = utc time + utc offset
@@ -267,28 +273,21 @@
         return -time.altzone  # seconds
     return -time.timezone
 
-def asn1time(cert_time):
-    # Some versions of OpenSSL ignore seconds, see #18207
-    # 0.9.8.i
-    if ssl._OPENSSL_API_VERSION == (0, 9, 8, 9, 15):
-        fmt = "%b %d %H:%M:%S %Y GMT"
-        dt = datetime.datetime.strptime(cert_time, fmt)
-        dt = dt.replace(second=0)
-        cert_time = dt.strftime(fmt)
-        # %d adds leading zero but ASN1_TIME_print() uses leading space
-        if cert_time[4] == "0":
-            cert_time = cert_time[:4] + " " + cert_time[5:]
 
-    return cert_time
-
-needs_sni = unittest.skipUnless(ssl.HAS_SNI, "SNI support needed for this test")
+ignore_deprecation = warnings_helper.ignore_warnings(
+    category=DeprecationWarning
+)
 
 
-def test_wrap_socket(sock, ssl_version=ssl.PROTOCOL_TLS, *,
+def test_wrap_socket(sock, *,
                      cert_reqs=ssl.CERT_NONE, ca_certs=None,
                      ciphers=None, certfile=None, keyfile=None,
                      **kwargs):
-    context = ssl.SSLContext(ssl_version)
+    if not kwargs.get("server_side"):
+        kwargs["server_hostname"] = SIGNED_CERTFILE_HOSTNAME
+        context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
+    else:
+        context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
     if cert_reqs is not None:
         if cert_reqs == ssl.CERT_NONE:
             context.check_hostname = False
@@ -302,7 +301,7 @@
     return context.wrap_socket(sock, **kwargs)
 
 
-def testing_context(server_cert=SIGNED_CERTFILE):
+def testing_context(server_cert=SIGNED_CERTFILE, *, server_chain=True):
     """Create context
 
     client_context, server_context, hostname = testing_context()
@@ -311,6 +310,8 @@
         hostname = SIGNED_CERTFILE_HOSTNAME
     elif server_cert == SIGNED_CERTFILE2:
         hostname = SIGNED_CERTFILE2_HOSTNAME
+    elif server_cert == NOSANFILE:
+        hostname = NOSAN_HOSTNAME
     else:
         raise ValueError(server_cert)
 
@@ -319,7 +320,8 @@
 
     server_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
     server_context.load_cert_chain(server_cert)
-    server_context.load_verify_locations(SIGNING_CA)
+    if server_chain:
+        server_context.load_verify_locations(SIGNING_CA)
 
     return client_context, server_context, hostname
 
@@ -332,21 +334,35 @@
         ssl.CERT_REQUIRED
         ssl.OP_CIPHER_SERVER_PREFERENCE
         ssl.OP_SINGLE_DH_USE
-        if ssl.HAS_ECDH:
-            ssl.OP_SINGLE_ECDH_USE
-        if ssl.OPENSSL_VERSION_INFO >= (1, 0):
-            ssl.OP_NO_COMPRESSION
-        self.assertIn(ssl.HAS_SNI, {True, False})
-        self.assertIn(ssl.HAS_ECDH, {True, False})
+        ssl.OP_SINGLE_ECDH_USE
+        ssl.OP_NO_COMPRESSION
+        self.assertEqual(ssl.HAS_SNI, True)
+        self.assertEqual(ssl.HAS_ECDH, True)
+        self.assertEqual(ssl.HAS_TLSv1_2, True)
+        self.assertEqual(ssl.HAS_TLSv1_3, True)
         ssl.OP_NO_SSLv2
         ssl.OP_NO_SSLv3
         ssl.OP_NO_TLSv1
         ssl.OP_NO_TLSv1_3
-        if ssl.OPENSSL_VERSION_INFO >= (1, 0, 1):
-            ssl.OP_NO_TLSv1_1
-            ssl.OP_NO_TLSv1_2
+        ssl.OP_NO_TLSv1_1
+        ssl.OP_NO_TLSv1_2
         self.assertEqual(ssl.PROTOCOL_TLS, ssl.PROTOCOL_SSLv23)
 
+    def test_ssl_types(self):
+        ssl_types = [
+            _ssl._SSLContext,
+            _ssl._SSLSocket,
+            _ssl.MemoryBIO,
+            _ssl.Certificate,
+            _ssl.SSLSession,
+            _ssl.SSLError,
+        ]
+        for ssl_type in ssl_types:
+            with self.subTest(ssl_type=ssl_type):
+                with self.assertRaisesRegex(TypeError, "immutable type"):
+                    ssl_type.value = None
+        support.check_disallow_instantiation(self, _ssl.Certificate)
+
     def test_private_init(self):
         with self.assertRaisesRegex(TypeError, "public constructor"):
             with socket.socket() as s:
@@ -355,8 +371,8 @@
     def test_str_for_enums(self):
         # Make sure that the PROTOCOL_* constants have enum-like string
         # reprs.
-        proto = ssl.PROTOCOL_TLS
-        self.assertEqual(str(proto), '_SSLMethod.PROTOCOL_TLS')
+        proto = ssl.PROTOCOL_TLS_CLIENT
+        self.assertEqual(str(proto), '_SSLMethod.PROTOCOL_TLS_CLIENT')
         ctx = ssl.SSLContext(proto)
         self.assertIs(ctx.protocol, proto)
 
@@ -367,7 +383,8 @@
                              % (v, (v and "sufficient randomness") or
                                 "insufficient randomness"))
 
-        data, is_cryptographic = ssl.RAND_pseudo_bytes(16)
+        with warnings_helper.check_warnings():
+            data, is_cryptographic = ssl.RAND_pseudo_bytes(16)
         self.assertEqual(len(data), 16)
         self.assertEqual(is_cryptographic, v == 1)
         if v:
@@ -378,48 +395,13 @@
 
         # negative num is invalid
         self.assertRaises(ValueError, ssl.RAND_bytes, -5)
-        self.assertRaises(ValueError, ssl.RAND_pseudo_bytes, -5)
+        with warnings_helper.check_warnings():
+            self.assertRaises(ValueError, ssl.RAND_pseudo_bytes, -5)
 
-        if hasattr(ssl, 'RAND_egd'):
-            self.assertRaises(TypeError, ssl.RAND_egd, 1)
-            self.assertRaises(TypeError, ssl.RAND_egd, 'foo', 1)
         ssl.RAND_add("this is a random string", 75.0)
         ssl.RAND_add(b"this is a random bytes object", 75.0)
         ssl.RAND_add(bytearray(b"this is a random bytearray object"), 75.0)
 
-    @unittest.skipUnless(os.name == 'posix', 'requires posix')
-    def test_random_fork(self):
-        status = ssl.RAND_status()
-        if not status:
-            self.fail("OpenSSL's PRNG has insufficient randomness")
-
-        rfd, wfd = os.pipe()
-        pid = os.fork()
-        if pid == 0:
-            try:
-                os.close(rfd)
-                child_random = ssl.RAND_pseudo_bytes(16)[0]
-                self.assertEqual(len(child_random), 16)
-                os.write(wfd, child_random)
-                os.close(wfd)
-            except BaseException:
-                os._exit(1)
-            else:
-                os._exit(0)
-        else:
-            os.close(wfd)
-            self.addCleanup(os.close, rfd)
-            support.wait_process(pid, exitcode=0)
-
-            child_random = os.read(rfd, 16)
-            self.assertEqual(len(child_random), 16)
-            parent_random = ssl.RAND_pseudo_bytes(16)[0]
-            self.assertEqual(len(parent_random), 16)
-
-            self.assertNotEqual(child_random, parent_random)
-
-    maxDiff = None
-
     def test_parse_cert(self):
         # note that this uses an 'unofficial' function in _ssl.c,
         # provided solely for this test, to exercise the certificate
@@ -540,8 +522,8 @@
         self.assertIsInstance(t, tuple)
         self.assertIsInstance(s, str)
         # Some sanity checks follow
-        # >= 0.9
-        self.assertGreaterEqual(n, 0x900000)
+        # >= 1.1.1
+        self.assertGreaterEqual(n, 0x10101000)
         # < 4.0
         self.assertLess(n, 0x40000000)
         major, minor, fix, patch, status = t
@@ -555,13 +537,17 @@
         self.assertLessEqual(patch, 63)
         self.assertGreaterEqual(status, 0)
         self.assertLessEqual(status, 15)
-        # Version string as returned by {Open,Libre}SSL, the format might change
-        if IS_LIBRESSL:
-            self.assertTrue(s.startswith("LibreSSL {:d}".format(major)),
-                            (s, t, hex(n)))
+
+        libressl_ver = f"LibreSSL {major:d}"
+        if major >= 3:
+            # 3.x uses 0xMNN00PP0L
+            openssl_ver = f"OpenSSL {major:d}.{minor:d}.{patch:d}"
         else:
-            self.assertTrue(s.startswith("OpenSSL {:d}.{:d}.{:d}".format(major, minor, fix)),
-                            (s, t, hex(n)))
+            openssl_ver = f"OpenSSL {major:d}.{minor:d}.{fix:d}"
+        self.assertTrue(
+            s.startswith((openssl_ver, libressl_ver)),
+            (s, t, hex(n))
+        )
 
     @support.cpython_only
     def test_refcycle(self):
@@ -570,7 +556,7 @@
         s = socket.socket(socket.AF_INET)
         ss = test_wrap_socket(s)
         wr = weakref.ref(ss)
-        with support.check_warnings(("", ResourceWarning)):
+        with warnings_helper.check_warnings(("", ResourceWarning)):
             del ss
         self.assertEqual(wr(), None)
 
@@ -601,6 +587,55 @@
             with test_wrap_socket(s) as ss:
                 self.assertEqual(timeout, ss.gettimeout())
 
+    def test_openssl111_deprecations(self):
+        options = [
+            ssl.OP_NO_TLSv1,
+            ssl.OP_NO_TLSv1_1,
+            ssl.OP_NO_TLSv1_2,
+            ssl.OP_NO_TLSv1_3
+        ]
+        protocols = [
+            ssl.PROTOCOL_TLSv1,
+            ssl.PROTOCOL_TLSv1_1,
+            ssl.PROTOCOL_TLSv1_2,
+            ssl.PROTOCOL_TLS
+        ]
+        versions = [
+            ssl.TLSVersion.SSLv3,
+            ssl.TLSVersion.TLSv1,
+            ssl.TLSVersion.TLSv1_1,
+        ]
+
+        for option in options:
+            with self.subTest(option=option):
+                ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
+                with self.assertWarns(DeprecationWarning) as cm:
+                    ctx.options |= option
+                self.assertEqual(
+                    'ssl.OP_NO_SSL*/ssl.OP_NO_TLS* options are deprecated',
+                    str(cm.warning)
+                )
+
+        for protocol in protocols:
+            with self.subTest(protocol=protocol):
+                with self.assertWarns(DeprecationWarning) as cm:
+                    ssl.SSLContext(protocol)
+                self.assertEqual(
+                    f'ssl.{protocol.name} is deprecated',
+                    str(cm.warning)
+                )
+
+        for version in versions:
+            with self.subTest(version=version):
+                ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
+                with self.assertWarns(DeprecationWarning) as cm:
+                    ctx.minimum_version = version
+                self.assertEqual(
+                    f'ssl.{version!s} is deprecated',
+                    str(cm.warning)
+                )
+
+    @ignore_deprecation
     def test_errors_sslwrap(self):
         sock = socket.socket()
         self.assertRaisesRegex(ValueError,
@@ -652,6 +687,7 @@
         """Wrapping with a badly formatted key (syntax error)"""
         self.bad_cert_test("badkey.pem")
 
+    @ignore_deprecation
     def test_match_hostname(self):
         def ok(cert, hostname):
             ssl.match_hostname(cert, hostname)
@@ -892,7 +928,7 @@
         self.assertEqual(len(paths), 6)
         self.assertIsInstance(paths, ssl.DefaultVerifyPaths)
 
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env["SSL_CERT_DIR"] = CAPATH
             env["SSL_CERT_FILE"] = CERTFILE
             paths = ssl.get_default_verify_paths()
@@ -1087,22 +1123,31 @@
         )
         self.assertIn(rc, errors)
 
+    def test_read_write_zero(self):
+        # empty reads and writes now work, bpo-42854, bpo-31711
+        client_context, server_context, hostname = testing_context()
+        server = ThreadedEchoServer(context=server_context)
+        with server:
+            with client_context.wrap_socket(socket.socket(),
+                                            server_hostname=hostname) as s:
+                s.connect((HOST, server.port))
+                self.assertEqual(s.recv(0), b"")
+                self.assertEqual(s.send(b""), 0)
+
 
 class ContextTests(unittest.TestCase):
 
     def test_constructor(self):
         for protocol in PROTOCOLS:
-            ssl.SSLContext(protocol)
-        ctx = ssl.SSLContext()
+            with warnings_helper.check_warnings():
+                ctx = ssl.SSLContext(protocol)
+            self.assertEqual(ctx.protocol, protocol)
+        with warnings_helper.check_warnings():
+            ctx = ssl.SSLContext()
         self.assertEqual(ctx.protocol, ssl.PROTOCOL_TLS)
         self.assertRaises(ValueError, ssl.SSLContext, -1)
         self.assertRaises(ValueError, ssl.SSLContext, 42)
 
-    def test_protocol(self):
-        for proto in PROTOCOLS:
-            ctx = ssl.SSLContext(proto)
-            self.assertEqual(ctx.protocol, proto)
-
     def test_ciphers(self):
         ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
         ctx.set_ciphers("ALL")
@@ -1123,7 +1168,6 @@
             self.assertNotIn("RC4", name)
             self.assertNotIn("3DES", name)
 
-    @unittest.skipIf(ssl.OPENSSL_VERSION_INFO < (1, 0, 2, 0, 0), 'OpenSSL too old')
     def test_get_ciphers(self):
         ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
         ctx.set_ciphers('AESGCM')
@@ -1138,22 +1182,22 @@
         # SSLContext also enables these by default
         default |= (OP_NO_COMPRESSION | OP_CIPHER_SERVER_PREFERENCE |
                     OP_SINGLE_DH_USE | OP_SINGLE_ECDH_USE |
-                    OP_ENABLE_MIDDLEBOX_COMPAT)
+                    OP_ENABLE_MIDDLEBOX_COMPAT |
+                    OP_IGNORE_UNEXPECTED_EOF)
         self.assertEqual(default, ctx.options)
-        ctx.options |= ssl.OP_NO_TLSv1
+        with warnings_helper.check_warnings():
+            ctx.options |= ssl.OP_NO_TLSv1
         self.assertEqual(default | ssl.OP_NO_TLSv1, ctx.options)
-        if can_clear_options():
+        with warnings_helper.check_warnings():
             ctx.options = (ctx.options & ~ssl.OP_NO_TLSv1)
-            self.assertEqual(default, ctx.options)
-            ctx.options = 0
-            # Ubuntu has OP_NO_SSLv3 forced on by default
-            self.assertEqual(0, ctx.options & ~ssl.OP_NO_SSLv3)
-        else:
-            with self.assertRaises(ValueError):
-                ctx.options = 0
+        self.assertEqual(default, ctx.options)
+        ctx.options = 0
+        # Ubuntu has OP_NO_SSLv3 forced on by default
+        self.assertEqual(0, ctx.options & ~ssl.OP_NO_SSLv3)
 
     def test_verify_mode_protocol(self):
-        ctx = ssl.SSLContext(ssl.PROTOCOL_TLS)
+        with warnings_helper.check_warnings():
+            ctx = ssl.SSLContext(ssl.PROTOCOL_TLS)
         # Default value
         self.assertEqual(ctx.verify_mode, ssl.CERT_NONE)
         ctx.verify_mode = ssl.CERT_OPTIONAL
@@ -1189,8 +1233,7 @@
             with self.assertRaises(AttributeError):
                 ctx.hostname_checks_common_name = True
 
-    @requires_minimum_version
-    @unittest.skipIf(IS_LIBRESSL, "see bpo-34001")
+    @ignore_deprecation
     def test_min_max_version(self):
         ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
         # OpenSSL default is MINIMUM_SUPPORTED, however some vendors like
@@ -1269,8 +1312,25 @@
             ctx.maximum_version = ssl.TLSVersion.TLSv1
 
 
-    @unittest.skipUnless(have_verify_flags(),
-                         "verify_flags need OpenSSL > 0.9.8")
+    @unittest.skipUnless(
+        hasattr(ssl.SSLContext, 'security_level'),
+        "requires OpenSSL >= 1.1.0"
+    )
+    def test_security_level(self):
+        ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
+        # The default security callback allows for levels between 0-5
+        # with OpenSSL defaulting to 1, however some vendors override the
+        # default value (e.g. Debian defaults to 2)
+        security_level_range = {
+            0,
+            1, # OpenSSL default
+            2, # Debian
+            3,
+            4,
+            5,
+        }
+        self.assertIn(ctx.security_level, security_level_range)
+
     def test_verify_flags(self):
         ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
         # default value
@@ -1282,6 +1342,8 @@
         self.assertEqual(ctx.verify_flags, ssl.VERIFY_CRL_CHECK_CHAIN)
         ctx.verify_flags = ssl.VERIFY_DEFAULT
         self.assertEqual(ctx.verify_flags, ssl.VERIFY_DEFAULT)
+        ctx.verify_flags = ssl.VERIFY_ALLOW_PROXY_CERTS
+        self.assertEqual(ctx.verify_flags, ssl.VERIFY_ALLOW_PROXY_CERTS)
         # supports any value
         ctx.verify_flags = ssl.VERIFY_CRL_CHECK_LEAF | ssl.VERIFY_X509_STRICT
         self.assertEqual(ctx.verify_flags,
@@ -1443,12 +1505,17 @@
         ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
         self.assertRaises(TypeError, ctx.load_verify_locations, cadata=object)
 
-        with self.assertRaisesRegex(ssl.SSLError, "no start line"):
+        with self.assertRaisesRegex(
+            ssl.SSLError,
+            "no start line: cadata does not contain a certificate"
+        ):
             ctx.load_verify_locations(cadata="broken")
-        with self.assertRaisesRegex(ssl.SSLError, "not enough data"):
+        with self.assertRaisesRegex(
+            ssl.SSLError,
+            "not enough data: cadata does not contain a certificate"
+        ):
             ctx.load_verify_locations(cadata=b"broken")
 
-
     @unittest.skipIf(Py_DEBUG_WIN32, "Avoid mixing debug/release CRT on Windows")
     def test_load_dh_params(self):
         ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
@@ -1464,7 +1531,7 @@
             ctx.load_dh_params(CERTFILE)
 
     def test_session_stats(self):
-        for proto in PROTOCOLS:
+        for proto in {ssl.PROTOCOL_TLS_CLIENT, ssl.PROTOCOL_TLS_SERVER}:
             ctx = ssl.SSLContext(proto)
             self.assertEqual(ctx.session_stats(), {
                 'number': 0,
@@ -1496,7 +1563,6 @@
         self.assertRaises(ValueError, ctx.set_ecdh_curve, "foo")
         self.assertRaises(ValueError, ctx.set_ecdh_curve, b"foo")
 
-    @needs_sni
     def test_sni_callback(self):
         ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
 
@@ -1511,7 +1577,6 @@
         ctx.set_servername_callback(None)
         ctx.set_servername_callback(dummycallback)
 
-    @needs_sni
     def test_sni_callback_refcycle(self):
         # Reference cycles through the servername callback are detected
         # and cleared.
@@ -1551,8 +1616,8 @@
                          (('organizationalUnitName', 'http://www.cacert.org'),),
                          (('commonName', 'CA Cert Signing Authority'),),
                          (('emailAddress', 'support@cacert.org'),)),
-              'notAfter': asn1time('Mar 29 12:29:49 2033 GMT'),
-              'notBefore': asn1time('Mar 30 12:29:49 2003 GMT'),
+              'notAfter': 'Mar 29 12:29:49 2033 GMT',
+              'notBefore': 'Mar 30 12:29:49 2003 GMT',
               'serialNumber': '00',
               'crlDistributionPoints': ('https://www.cacert.org/revoke.crl',),
               'subject': ((('organizationName', 'Root CA'),),
@@ -1582,10 +1647,9 @@
         self.assertRaises(TypeError, ctx.load_default_certs, 'SERVER_AUTH')
 
     @unittest.skipIf(sys.platform == "win32", "not-Windows specific")
-    @unittest.skipIf(IS_LIBRESSL, "LibreSSL doesn't support env vars")
     def test_load_default_certs_env(self):
         ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env["SSL_CERT_DIR"] = CAPATH
             env["SSL_CERT_FILE"] = CERTFILE
             ctx.load_default_certs()
@@ -1599,7 +1663,7 @@
         stats = ctx.cert_store_stats()
 
         ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env["SSL_CERT_DIR"] = CAPATH
             env["SSL_CERT_FILE"] = CERTFILE
             ctx.load_default_certs()
@@ -1624,7 +1688,7 @@
     def test_create_default_context(self):
         ctx = ssl.create_default_context()
 
-        self.assertEqual(ctx.protocol, ssl.PROTOCOL_TLS)
+        self.assertEqual(ctx.protocol, ssl.PROTOCOL_TLS_CLIENT)
         self.assertEqual(ctx.verify_mode, ssl.CERT_REQUIRED)
         self.assertTrue(ctx.check_hostname)
         self._assert_context_options(ctx)
@@ -1633,42 +1697,49 @@
             cadata = f.read()
         ctx = ssl.create_default_context(cafile=SIGNING_CA, capath=CAPATH,
                                          cadata=cadata)
-        self.assertEqual(ctx.protocol, ssl.PROTOCOL_TLS)
+        self.assertEqual(ctx.protocol, ssl.PROTOCOL_TLS_CLIENT)
         self.assertEqual(ctx.verify_mode, ssl.CERT_REQUIRED)
         self._assert_context_options(ctx)
 
         ctx = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
-        self.assertEqual(ctx.protocol, ssl.PROTOCOL_TLS)
+        self.assertEqual(ctx.protocol, ssl.PROTOCOL_TLS_SERVER)
         self.assertEqual(ctx.verify_mode, ssl.CERT_NONE)
         self._assert_context_options(ctx)
 
+
+
     def test__create_stdlib_context(self):
         ctx = ssl._create_stdlib_context()
-        self.assertEqual(ctx.protocol, ssl.PROTOCOL_TLS)
+        self.assertEqual(ctx.protocol, ssl.PROTOCOL_TLS_CLIENT)
         self.assertEqual(ctx.verify_mode, ssl.CERT_NONE)
         self.assertFalse(ctx.check_hostname)
         self._assert_context_options(ctx)
 
-        ctx = ssl._create_stdlib_context(ssl.PROTOCOL_TLSv1)
+        with warnings_helper.check_warnings():
+            ctx = ssl._create_stdlib_context(ssl.PROTOCOL_TLSv1)
         self.assertEqual(ctx.protocol, ssl.PROTOCOL_TLSv1)
         self.assertEqual(ctx.verify_mode, ssl.CERT_NONE)
         self._assert_context_options(ctx)
 
-        ctx = ssl._create_stdlib_context(ssl.PROTOCOL_TLSv1,
-                                         cert_reqs=ssl.CERT_REQUIRED,
-                                         check_hostname=True)
-        self.assertEqual(ctx.protocol, ssl.PROTOCOL_TLSv1)
+        with warnings_helper.check_warnings():
+            ctx = ssl._create_stdlib_context(
+                ssl.PROTOCOL_TLSv1_2,
+                cert_reqs=ssl.CERT_REQUIRED,
+                check_hostname=True
+            )
+        self.assertEqual(ctx.protocol, ssl.PROTOCOL_TLSv1_2)
         self.assertEqual(ctx.verify_mode, ssl.CERT_REQUIRED)
         self.assertTrue(ctx.check_hostname)
         self._assert_context_options(ctx)
 
         ctx = ssl._create_stdlib_context(purpose=ssl.Purpose.CLIENT_AUTH)
-        self.assertEqual(ctx.protocol, ssl.PROTOCOL_TLS)
+        self.assertEqual(ctx.protocol, ssl.PROTOCOL_TLS_SERVER)
         self.assertEqual(ctx.verify_mode, ssl.CERT_NONE)
         self._assert_context_options(ctx)
 
     def test_check_hostname(self):
-        ctx = ssl.SSLContext(ssl.PROTOCOL_TLS)
+        with warnings_helper.check_warnings():
+            ctx = ssl.SSLContext(ssl.PROTOCOL_TLS)
         self.assertFalse(ctx.check_hostname)
         self.assertEqual(ctx.verify_mode, ssl.CERT_NONE)
 
@@ -1734,10 +1805,9 @@
 
         with ctx.wrap_socket(socket.socket(), server_side=True) as sock:
             self.assertIsInstance(sock, MySSLSocket)
-        obj = ctx.wrap_bio(ssl.MemoryBIO(), ssl.MemoryBIO())
+        obj = ctx.wrap_bio(ssl.MemoryBIO(), ssl.MemoryBIO(), server_side=True)
         self.assertIsInstance(obj, MySSLObject)
 
-    @unittest.skipUnless(IS_OPENSSL_1_1_1, "Test requires OpenSSL 1.1.1")
     def test_num_tickest(self):
         ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
         self.assertEqual(ctx.num_tickets, 2)
@@ -1925,7 +1995,9 @@
     """Tests that connect to a simple server running in the background"""
 
     def setUp(self):
-        server = ThreadedEchoServer(SIGNED_CERTFILE)
+        self.server_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
+        self.server_context.load_cert_chain(SIGNED_CERTFILE)
+        server = ThreadedEchoServer(context=self.server_context)
         self.server_addr = (HOST, server.port)
         server.__enter__()
         self.addCleanup(server.__exit__, None, None, None)
@@ -1992,7 +2064,9 @@
 
     def test_connect_with_context(self):
         # Same as test_connect, but with a separately created context
-        ctx = ssl.SSLContext(ssl.PROTOCOL_TLS)
+        ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
+        ctx.check_hostname = False
+        ctx.verify_mode = ssl.CERT_NONE
         with ctx.wrap_socket(socket.socket(socket.AF_INET)) as s:
             s.connect(self.server_addr)
             self.assertEqual({}, s.getpeercert())
@@ -2012,9 +2086,11 @@
         # This should fail because we have no verification certs. Connection
         # failure crashes ThreadedEchoServer, so run this in an independent
         # test method.
-        ctx = ssl.SSLContext(ssl.PROTOCOL_TLS)
-        ctx.verify_mode = ssl.CERT_REQUIRED
-        s = ctx.wrap_socket(socket.socket(socket.AF_INET))
+        ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
+        s = ctx.wrap_socket(
+            socket.socket(socket.AF_INET),
+            server_hostname=SIGNED_CERTFILE_HOSTNAME
+        )
         self.addCleanup(s.close)
         self.assertRaisesRegex(ssl.SSLError, "certificate verify failed",
                                 s.connect, self.server_addr)
@@ -2025,19 +2101,19 @@
         # OpenSSL 0.9.8n and 1.0.0, as a result the capath directory must
         # contain both versions of each certificate (same content, different
         # filename) for this test to be portable across OpenSSL releases.
-        ctx = ssl.SSLContext(ssl.PROTOCOL_TLS)
-        ctx.verify_mode = ssl.CERT_REQUIRED
+        ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
         ctx.load_verify_locations(capath=CAPATH)
-        with ctx.wrap_socket(socket.socket(socket.AF_INET)) as s:
+        with ctx.wrap_socket(socket.socket(socket.AF_INET),
+                             server_hostname=SIGNED_CERTFILE_HOSTNAME) as s:
             s.connect(self.server_addr)
             cert = s.getpeercert()
             self.assertTrue(cert)
 
         # Same with a bytes `capath` argument
-        ctx = ssl.SSLContext(ssl.PROTOCOL_TLS)
-        ctx.verify_mode = ssl.CERT_REQUIRED
+        ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
         ctx.load_verify_locations(capath=BYTES_CAPATH)
-        with ctx.wrap_socket(socket.socket(socket.AF_INET)) as s:
+        with ctx.wrap_socket(socket.socket(socket.AF_INET),
+                             server_hostname=SIGNED_CERTFILE_HOSTNAME) as s:
             s.connect(self.server_addr)
             cert = s.getpeercert()
             self.assertTrue(cert)
@@ -2046,19 +2122,19 @@
         with open(SIGNING_CA) as f:
             pem = f.read()
         der = ssl.PEM_cert_to_DER_cert(pem)
-        ctx = ssl.SSLContext(ssl.PROTOCOL_TLS)
-        ctx.verify_mode = ssl.CERT_REQUIRED
+        ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
         ctx.load_verify_locations(cadata=pem)
-        with ctx.wrap_socket(socket.socket(socket.AF_INET)) as s:
+        with ctx.wrap_socket(socket.socket(socket.AF_INET),
+                             server_hostname=SIGNED_CERTFILE_HOSTNAME) as s:
             s.connect(self.server_addr)
             cert = s.getpeercert()
             self.assertTrue(cert)
 
         # same with DER
-        ctx = ssl.SSLContext(ssl.PROTOCOL_TLS)
-        ctx.verify_mode = ssl.CERT_REQUIRED
+        ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
         ctx.load_verify_locations(cadata=der)
-        with ctx.wrap_socket(socket.socket(socket.AF_INET)) as s:
+        with ctx.wrap_socket(socket.socket(socket.AF_INET),
+                             server_hostname=SIGNED_CERTFILE_HOSTNAME) as s:
             s.connect(self.server_addr)
             cert = s.getpeercert()
             self.assertTrue(cert)
@@ -2106,11 +2182,41 @@
     def test_get_server_certificate(self):
         _test_get_server_certificate(self, *self.server_addr, cert=SIGNING_CA)
 
+    def test_get_server_certificate_sni(self):
+        host, port = self.server_addr
+        server_names = []
+
+        # We store servername_cb arguments to make sure they match the host
+        def servername_cb(ssl_sock, server_name, initial_context):
+            server_names.append(server_name)
+        self.server_context.set_servername_callback(servername_cb)
+
+        pem = ssl.get_server_certificate((host, port))
+        if not pem:
+            self.fail("No server certificate on %s:%s!" % (host, port))
+
+        pem = ssl.get_server_certificate((host, port), ca_certs=SIGNING_CA)
+        if not pem:
+            self.fail("No server certificate on %s:%s!" % (host, port))
+        if support.verbose:
+            sys.stdout.write("\nVerified certificate for %s:%s is\n%s\n" % (host, port, pem))
+
+        self.assertEqual(server_names, [host, host])
+
     def test_get_server_certificate_fail(self):
         # Connection failure crashes ThreadedEchoServer, so run this in an
         # independent test method
         _test_get_server_certificate_fail(self, *self.server_addr)
 
+    def test_get_server_certificate_timeout(self):
+        def servername_cb(ssl_sock, server_name, initial_context):
+            time.sleep(0.2)
+        self.server_context.set_servername_callback(servername_cb)
+
+        with self.assertRaises(socket.timeout):
+            ssl.get_server_certificate(self.server_addr, ca_certs=SIGNING_CA,
+                                       timeout=0.1)
+
     def test_ciphers(self):
         with test_wrap_socket(socket.socket(socket.AF_INET),
                              cert_reqs=ssl.CERT_NONE, ciphers="ALL") as s:
@@ -2137,7 +2243,6 @@
             self.assertTrue(cert)
         self.assertEqual(len(ctx.get_ca_certs()), 1)
 
-    @needs_sni
     def test_context_setget(self):
         # Check that the context of a connected socket can be replaced.
         ctx1 = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
@@ -2230,7 +2335,8 @@
         sock.connect(self.server_addr)
         incoming = ssl.MemoryBIO()
         outgoing = ssl.MemoryBIO()
-        ctx = ssl.SSLContext(ssl.PROTOCOL_TLS)
+        ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
+        ctx.check_hostname = False
         ctx.verify_mode = ssl.CERT_NONE
         sslobj = ctx.wrap_bio(incoming, outgoing, False)
         self.ssl_io_loop(sock, incoming, outgoing, sslobj.do_handshake)
@@ -2241,6 +2347,7 @@
         self.ssl_io_loop(sock, incoming, outgoing, sslobj.unwrap)
 
 
+@support.requires_resource('network')
 class NetworkedTests(unittest.TestCase):
 
     def test_timeout_connect_ex(self):
@@ -2255,6 +2362,8 @@
             rc = s.connect_ex((REMOTE_HOST, 443))
             if rc == 0:
                 self.skipTest("REMOTE_HOST responded too quickly")
+            elif rc == errno.ENETUNREACH:
+                self.skipTest("Network unreachable.")
             self.assertIn(rc, (errno.EAGAIN, errno.EWOULDBLOCK))
 
     @unittest.skipUnless(socket_helper.IPV6_ENABLED, 'Needs IPv6')
@@ -2310,7 +2419,6 @@
             try:
                 self.sslconn = self.server.context.wrap_socket(
                     self.sock, server_side=True)
-                self.server.selected_npn_protocols.append(self.sslconn.selected_npn_protocol())
                 self.server.selected_alpn_protocols.append(self.sslconn.selected_alpn_protocol())
             except (ConnectionResetError, BrokenPipeError, ConnectionAbortedError) as e:
                 # We treat ConnectionResetError as though it were an
@@ -2343,9 +2451,14 @@
                 self.server.conn_errors.append(str(e))
                 if self.server.chatty:
                     handle_error("\n server:  bad connection attempt from " + repr(self.addr) + ":\n")
-                self.running = False
-                self.server.stop()
-                self.close()
+
+                # bpo-44229, bpo-43855, bpo-44237, and bpo-33450:
+                # Ignore spurious EPROTOTYPE returned by write() on macOS.
+                # See also http://erickt.github.io/blog/2014/11/19/adventures-in-debugging-a-potential-osx-kernel-bug/
+                if e.errno != errno.EPROTOTYPE and sys.platform != "darwin":
+                    self.running = False
+                    self.server.stop()
+                    self.close()
                 return False
             else:
                 self.server.shared_ciphers.append(self.sslconn.shared_ciphers())
@@ -2355,12 +2468,13 @@
                         sys.stdout.write(" client cert is " + pprint.pformat(cert) + "\n")
                     cert_binary = self.sslconn.getpeercert(True)
                     if support.verbose and self.server.chatty:
-                        sys.stdout.write(" cert binary is " + str(len(cert_binary)) + " bytes\n")
+                        if cert_binary is None:
+                            sys.stdout.write(" client did not provide a cert\n")
+                        else:
+                            sys.stdout.write(f" cert binary is {len(cert_binary)}b\n")
                 cipher = self.sslconn.cipher()
                 if support.verbose and self.server.chatty:
                     sys.stdout.write(" server: connection cipher is now " + str(cipher) + "\n")
-                    sys.stdout.write(" server: selected protocol is now "
-                            + str(self.sslconn.selected_npn_protocol()) + "\n")
                 return True
 
         def read(self):
@@ -2446,6 +2560,12 @@
                     elif stripped == b'GETCERT':
                         cert = self.sslconn.getpeercert()
                         self.write(repr(cert).encode("us-ascii") + b"\n")
+                    elif stripped == b'VERIFIEDCHAIN':
+                        certs = self.sslconn._sslobj.get_verified_chain()
+                        self.write(len(certs).to_bytes(1, "big") + b"\n")
+                    elif stripped == b'UNVERIFIEDCHAIN':
+                        certs = self.sslconn._sslobj.get_unverified_chain()
+                        self.write(len(certs).to_bytes(1, "big") + b"\n")
                     else:
                         if (support.verbose and
                             self.server.connectionchatty):
@@ -2453,31 +2573,22 @@
                             sys.stdout.write(" server: read %r (%s), sending back %r (%s)...\n"
                                              % (msg, ctype, msg.lower(), ctype))
                         self.write(msg.lower())
-                except (ConnectionResetError, ConnectionAbortedError):
-                    # XXX: OpenSSL 1.1.1 sometimes raises ConnectionResetError
-                    # when connection is not shut down gracefully.
+                except OSError as e:
+                    # handles SSLError and socket errors
                     if self.server.chatty and support.verbose:
-                        sys.stdout.write(
-                            " Connection reset by peer: {}\n".format(
-                                self.addr)
-                        )
-                    self.close()
-                    self.running = False
-                except ssl.SSLError as err:
-                    # On Windows sometimes test_pha_required_nocert receives the
-                    # PEER_DID_NOT_RETURN_A_CERTIFICATE exception
-                    # before the 'tlsv13 alert certificate required' exception.
-                    # If the server is stopped when PEER_DID_NOT_RETURN_A_CERTIFICATE
-                    # is received test_pha_required_nocert fails with ConnectionResetError
-                    # because the underlying socket is closed
-                    if 'PEER_DID_NOT_RETURN_A_CERTIFICATE' == err.reason:
-                        if self.server.chatty and support.verbose:
-                            sys.stdout.write(err.args[1])
-                        # test_pha_required_nocert is expecting this exception
-                        raise ssl.SSLError('tlsv13 alert certificate required')
-                except OSError:
-                    if self.server.chatty:
-                        handle_error("Test server failure:\n")
+                        if isinstance(e, ConnectionError):
+                            # OpenSSL 1.1.1 sometimes raises
+                            # ConnectionResetError when connection is not
+                            # shut down gracefully.
+                            print(
+                                f" Connection reset by peer: {self.addr}"
+                            )
+                        else:
+                            handle_error("Test server failure:\n")
+                    try:
+                        self.write(b"ERROR\n")
+                    except OSError:
+                        pass
                     self.close()
                     self.running = False
 
@@ -2488,7 +2599,7 @@
     def __init__(self, certificate=None, ssl_version=None,
                  certreqs=None, cacerts=None,
                  chatty=True, connectionchatty=False, starttls_server=False,
-                 npn_protocols=None, alpn_protocols=None,
+                 alpn_protocols=None,
                  ciphers=None, context=None):
         if context:
             self.context = context
@@ -2502,8 +2613,6 @@
                 self.context.load_verify_locations(cacerts)
             if certificate:
                 self.context.load_cert_chain(certificate)
-            if npn_protocols:
-                self.context.set_npn_protocols(npn_protocols)
             if alpn_protocols:
                 self.context.set_alpn_protocols(alpn_protocols)
             if ciphers:
@@ -2515,7 +2624,6 @@
         self.port = socket_helper.bind_port(self.sock)
         self.flag = None
         self.active = False
-        self.selected_npn_protocols = []
         self.selected_alpn_protocols = []
         self.shared_ciphers = []
         self.conn_errors = []
@@ -2536,8 +2644,8 @@
         threading.Thread.start(self)
 
     def run(self):
-        self.sock.settimeout(0.05)
-        self.sock.listen()
+        self.sock.settimeout(1.0)
+        self.sock.listen(5)
         self.active = True
         if self.flag:
             # signal an event
@@ -2551,8 +2659,9 @@
                 handler = self.ConnectionHandler(self, newconn, connaddr)
                 handler.start()
                 handler.join()
-            except socket.timeout:
-                pass
+            except TimeoutError as e:
+                if support.verbose:
+                    sys.stdout.write(f' connection timeout {e!r}\n')
             except KeyboardInterrupt:
                 self.stop()
             except BaseException as e:
@@ -2560,7 +2669,12 @@
                     sys.stdout.write(
                         ' connection handling failed: ' + repr(e) + '\n')
 
-        self.sock.close()
+        self.close()
+
+    def close(self):
+        if self.sock is not None:
+            self.sock.close()
+            self.sock = None
 
     def stop(self):
         self.active = False
@@ -2722,14 +2836,12 @@
                 'cipher': s.cipher(),
                 'peercert': s.getpeercert(),
                 'client_alpn_protocol': s.selected_alpn_protocol(),
-                'client_npn_protocol': s.selected_npn_protocol(),
                 'version': s.version(),
                 'session_reused': s.session_reused,
                 'session': s.session,
             })
             s.close()
         stats['server_alpn_protocols'] = server.selected_alpn_protocols
-        stats['server_npn_protocols'] = server.selected_npn_protocols
         stats['server_shared_ciphers'] = server.shared_ciphers
     return stats
 
@@ -2755,21 +2867,26 @@
                          (ssl.get_protocol_name(client_protocol),
                           ssl.get_protocol_name(server_protocol),
                           certtype))
-    client_context = ssl.SSLContext(client_protocol)
-    client_context.options |= client_options
-    server_context = ssl.SSLContext(server_protocol)
-    server_context.options |= server_options
+
+    with warnings_helper.check_warnings():
+        # ignore Deprecation warnings
+        client_context = ssl.SSLContext(client_protocol)
+        client_context.options |= client_options
+        server_context = ssl.SSLContext(server_protocol)
+        server_context.options |= server_options
 
     min_version = PROTOCOL_TO_TLS_VERSION.get(client_protocol, None)
     if (min_version is not None
-    # SSLContext.minimum_version is only available on recent OpenSSL
-    # (setter added in OpenSSL 1.1.0, getter added in OpenSSL 1.1.1)
-    and hasattr(server_context, 'minimum_version')
-    and server_protocol == ssl.PROTOCOL_TLS
-    and server_context.minimum_version > min_version):
+        # SSLContext.minimum_version is only available on recent OpenSSL
+        # (setter added in OpenSSL 1.1.0, getter added in OpenSSL 1.1.1)
+        and hasattr(server_context, 'minimum_version')
+        and server_protocol == ssl.PROTOCOL_TLS
+        and server_context.minimum_version > min_version
+    ):
         # If OpenSSL configuration is strict and requires more recent TLS
         # version, we have to change the minimum to test old TLS versions.
-        server_context.minimum_version = min_version
+        with warnings_helper.check_warnings():
+            server_context.minimum_version = min_version
 
     # NOTE: we must enable "ALL" ciphers on the client, otherwise an
     # SSLv23 client will send an SSLv3 hello (rather than SSLv2)
@@ -2777,6 +2894,8 @@
     if client_context.protocol == ssl.PROTOCOL_TLS:
         client_context.set_ciphers("ALL")
 
+    seclevel_workaround(server_context, client_context)
+
     for ctx in (client_context, server_context):
         ctx.verify_mode = certsreqs
         ctx.load_cert_chain(SIGNED_CERTFILE)
@@ -2810,16 +2929,6 @@
         """Basic test of an SSL client connecting to a server"""
         if support.verbose:
             sys.stdout.write("\n")
-        for protocol in PROTOCOLS:
-            if protocol in {ssl.PROTOCOL_TLS_CLIENT, ssl.PROTOCOL_TLS_SERVER}:
-                continue
-            if not has_tls_protocol(protocol):
-                continue
-            with self.subTest(protocol=ssl._PROTOCOL_NAMES[protocol]):
-                context = ssl.SSLContext(protocol)
-                context.load_cert_chain(CERTFILE)
-                server_params_test(context, context,
-                                   chatty=True, connectionchatty=True)
 
         client_context, server_context, hostname = testing_context()
 
@@ -2836,24 +2945,29 @@
                                    server_context=client_context,
                                    chatty=True, connectionchatty=True,
                                    sni_name=hostname)
-            self.assertIn('called a function you should not call',
-                          str(e.exception))
+            self.assertIn(
+                'Cannot create a client socket with a PROTOCOL_TLS_SERVER context',
+                str(e.exception)
+            )
 
         with self.subTest(client=ssl.PROTOCOL_TLS_SERVER, server=ssl.PROTOCOL_TLS_SERVER):
             with self.assertRaises(ssl.SSLError) as e:
                 server_params_test(client_context=server_context,
                                    server_context=server_context,
                                    chatty=True, connectionchatty=True)
-            self.assertIn('called a function you should not call',
-                          str(e.exception))
+            self.assertIn(
+                'Cannot create a client socket with a PROTOCOL_TLS_SERVER context',
+                str(e.exception)
+            )
 
         with self.subTest(client=ssl.PROTOCOL_TLS_CLIENT, server=ssl.PROTOCOL_TLS_CLIENT):
             with self.assertRaises(ssl.SSLError) as e:
                 server_params_test(client_context=server_context,
                                    server_context=client_context,
                                    chatty=True, connectionchatty=True)
-            self.assertIn('called a function you should not call',
-                          str(e.exception))
+            self.assertIn(
+                'Cannot create a client socket with a PROTOCOL_TLS_SERVER context',
+                str(e.exception))
 
     def test_getpeercert(self):
         if support.verbose:
@@ -2891,8 +3005,6 @@
                 after = ssl.cert_time_to_seconds(cert['notAfter'])
                 self.assertLess(before, after)
 
-    @unittest.skipUnless(have_verify_flags(),
-                        "verify_flags need OpenSSL > 0.9.8")
     def test_crl_check(self):
         if support.verbose:
             sys.stdout.write("\n")
@@ -2966,6 +3078,30 @@
                                             "check_hostname requires server_hostname"):
                     client_context.wrap_socket(s)
 
+    @unittest.skipUnless(
+        ssl.HAS_NEVER_CHECK_COMMON_NAME, "test requires hostname_checks_common_name"
+    )
+    def test_hostname_checks_common_name(self):
+        client_context, server_context, hostname = testing_context()
+        assert client_context.hostname_checks_common_name
+        client_context.hostname_checks_common_name = False
+
+        # default cert has a SAN
+        server = ThreadedEchoServer(context=server_context, chatty=True)
+        with server:
+            with client_context.wrap_socket(socket.socket(),
+                                            server_hostname=hostname) as s:
+                s.connect((HOST, server.port))
+
+        client_context, server_context, hostname = testing_context(NOSANFILE)
+        client_context.hostname_checks_common_name = False
+        server = ThreadedEchoServer(context=server_context, chatty=True)
+        with server:
+            with client_context.wrap_socket(socket.socket(),
+                                            server_hostname=hostname) as s:
+                with self.assertRaises(ssl.SSLCertVerificationError):
+                    s.connect((HOST, server.port))
+
     def test_ecc_cert(self):
         client_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
         client_context.load_verify_locations(SIGNING_CA)
@@ -2992,7 +3128,7 @@
         client_context.load_verify_locations(SIGNING_CA)
         # TODO: fix TLSv1.3 once SSLContext can restrict signature
         #       algorithms.
-        client_context.options |= ssl.OP_NO_TLSv1_3
+        client_context.maximum_version = ssl.TLSVersion.TLSv1_2
         # only ECDSA certs
         client_context.set_ciphers('ECDHE:ECDSA:!NULL:!aRSA')
         hostname = SIGNED_CERTFILE_ECC_HOSTNAME
@@ -3120,12 +3256,15 @@
         )
         with server, \
              client_context.wrap_socket(socket.socket(),
-                                        server_hostname=hostname) as s:
+                                        server_hostname=hostname,
+                                        suppress_ragged_eofs=False) as s:
             # TLS 1.3 perform client cert exchange after handshake
             s.connect((HOST, server.port))
             try:
                 s.write(b'data')
-                s.read(4)
+                s.read(1000)
+                s.write(b'should have failed already')
+                s.read(1000)
             except ssl.SSLError as e:
                 if support.verbose:
                     sys.stdout.write("\nSSLError is %r\n" % e)
@@ -3214,10 +3353,6 @@
             try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv3, False)
         try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_TLSv1, False)
         # SSLv23 client with specific SSL options
-        if no_sslv2_implies_sslv3_hello():
-            # No SSLv2 => client will use an SSLv3 hello on recent OpenSSLs
-            try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_TLS, False,
-                               client_options=ssl.OP_NO_SSLv2)
         try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_TLS, False,
                            client_options=ssl.OP_NO_SSLv3)
         try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_TLS, False,
@@ -3278,10 +3413,6 @@
         try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_TLS, False,
                            client_options=ssl.OP_NO_SSLv3)
         try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_TLSv1, False)
-        if no_sslv2_implies_sslv3_hello():
-            # No SSLv2 => client will use an SSLv3 hello on recent OpenSSLs
-            try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_TLS,
-                               False, client_options=ssl.OP_NO_SSLv2)
 
     @requires_tls_version('TLSv1')
     def test_protocol_tlsv1(self):
@@ -3466,8 +3597,7 @@
                                 server_side=False,
                                 certfile=CERTFILE,
                                 ca_certs=CERTFILE,
-                                cert_reqs=ssl.CERT_NONE,
-                                ssl_version=ssl.PROTOCOL_TLS_CLIENT)
+                                cert_reqs=ssl.CERT_NONE)
             s.connect((HOST, server.port))
             # helper methods for standardising recv* method signatures
             def _recv_into():
@@ -3619,8 +3749,7 @@
                                 server_side=False,
                                 certfile=CERTFILE,
                                 ca_certs=CERTFILE,
-                                cert_reqs=ssl.CERT_NONE,
-                                ssl_version=ssl.PROTOCOL_TLS_CLIENT)
+                                cert_reqs=ssl.CERT_NONE)
             s.connect((HOST, server.port))
             s.setblocking(False)
 
@@ -3668,7 +3797,7 @@
                 c.settimeout(0.2)
                 c.connect((host, port))
                 # Will attempt handshake and time out
-                self.assertRaisesRegex(socket.timeout, "timed out",
+                self.assertRaisesRegex(TimeoutError, "timed out",
                                        test_wrap_socket, c)
             finally:
                 c.close()
@@ -3677,7 +3806,7 @@
                 c = test_wrap_socket(c)
                 c.settimeout(0.2)
                 # Will attempt handshake and time out
-                self.assertRaisesRegex(socket.timeout, "timed out",
+                self.assertRaisesRegex(TimeoutError, "timed out",
                                        c.connect, (host, port))
             finally:
                 c.close()
@@ -3689,14 +3818,11 @@
     def test_server_accept(self):
         # Issue #16357: accept() on a SSLSocket created through
         # SSLContext.wrap_socket().
-        context = ssl.SSLContext(ssl.PROTOCOL_TLS)
-        context.verify_mode = ssl.CERT_REQUIRED
-        context.load_verify_locations(SIGNING_CA)
-        context.load_cert_chain(SIGNED_CERTFILE)
+        client_ctx, server_ctx, hostname = testing_context()
         server = socket.socket(socket.AF_INET)
         host = "127.0.0.1"
         port = socket_helper.bind_port(server)
-        server = context.wrap_socket(server, server_side=True)
+        server = server_ctx.wrap_socket(server, server_side=True)
         self.assertTrue(server.server_side)
 
         evt = threading.Event()
@@ -3714,8 +3840,10 @@
         t.start()
         # Client wait until server setup and perform a connect.
         evt.wait()
-        client = context.wrap_socket(socket.socket())
-        client.connect((host, port))
+        client = client_ctx.wrap_socket(
+            socket.socket(), server_hostname=hostname
+        )
+        client.connect((hostname, port))
         client.send(b'data')
         client.recv()
         client_addr = client.getsockname()
@@ -3728,14 +3856,16 @@
         self.assertEqual(peer, client_addr)
 
     def test_getpeercert_enotconn(self):
-        context = ssl.SSLContext(ssl.PROTOCOL_TLS)
+        context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
+        context.check_hostname = False
         with context.wrap_socket(socket.socket()) as sock:
             with self.assertRaises(OSError) as cm:
                 sock.getpeercert()
             self.assertEqual(cm.exception.errno, errno.ENOTCONN)
 
     def test_do_handshake_enotconn(self):
-        context = ssl.SSLContext(ssl.PROTOCOL_TLS)
+        context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
+        context.check_hostname = False
         with context.wrap_socket(socket.socket()) as sock:
             with self.assertRaises(OSError) as cm:
                 sock.do_handshake()
@@ -3744,7 +3874,7 @@
     def test_no_shared_ciphers(self):
         client_context, server_context, hostname = testing_context()
         # OpenSSL enables all TLS 1.3 ciphers, enforce TLS 1.2 for test
-        client_context.options |= ssl.OP_NO_TLSv1_3
+        client_context.maximum_version = ssl.TLSVersion.TLSv1_2
         # Force different suites on client and server
         client_context.set_ciphers("AES128")
         server_context.set_ciphers("AES256")
@@ -3770,24 +3900,17 @@
                 self.assertIs(s.version(), None)
                 self.assertIs(s._sslobj, None)
                 s.connect((HOST, server.port))
-                if IS_OPENSSL_1_1_1 and has_tls_version('TLSv1_3'):
-                    self.assertEqual(s.version(), 'TLSv1.3')
-                elif ssl.OPENSSL_VERSION_INFO >= (1, 0, 2):
-                    self.assertEqual(s.version(), 'TLSv1.2')
-                else:  # 0.9.8 to 1.0.1
-                    self.assertIn(s.version(), ('TLSv1', 'TLSv1.2'))
+                self.assertEqual(s.version(), 'TLSv1.3')
             self.assertIs(s._sslobj, None)
             self.assertIs(s.version(), None)
 
     @requires_tls_version('TLSv1_3')
     def test_tls1_3(self):
-        context = ssl.SSLContext(ssl.PROTOCOL_TLS)
-        context.load_cert_chain(CERTFILE)
-        context.options |= (
-            ssl.OP_NO_TLSv1 | ssl.OP_NO_TLSv1_1 | ssl.OP_NO_TLSv1_2
-        )
-        with ThreadedEchoServer(context=context) as server:
-            with context.wrap_socket(socket.socket()) as s:
+        client_context, server_context, hostname = testing_context()
+        client_context.minimum_version = ssl.TLSVersion.TLSv1_3
+        with ThreadedEchoServer(context=server_context) as server:
+            with client_context.wrap_socket(socket.socket(),
+                                            server_hostname=hostname) as s:
                 s.connect((HOST, server.port))
                 self.assertIn(s.cipher()[0], {
                     'TLS_AES_256_GCM_SHA384',
@@ -3796,8 +3919,9 @@
                 })
                 self.assertEqual(s.version(), 'TLSv1.3')
 
-    @requires_minimum_version
     @requires_tls_version('TLSv1_2')
+    @requires_tls_version('TLSv1')
+    @ignore_deprecation
     def test_min_max_version_tlsv1_2(self):
         client_context, server_context, hostname = testing_context()
         # client TLSv1.0 to 1.2
@@ -3813,8 +3937,8 @@
                 s.connect((HOST, server.port))
                 self.assertEqual(s.version(), 'TLSv1.2')
 
-    @requires_minimum_version
     @requires_tls_version('TLSv1_1')
+    @ignore_deprecation
     def test_min_max_version_tlsv1_1(self):
         client_context, server_context, hostname = testing_context()
         # client 1.0 to 1.2, server 1.0 to 1.1
@@ -3822,6 +3946,7 @@
         client_context.maximum_version = ssl.TLSVersion.TLSv1_2
         server_context.minimum_version = ssl.TLSVersion.TLSv1
         server_context.maximum_version = ssl.TLSVersion.TLSv1_1
+        seclevel_workaround(client_context, server_context)
 
         with ThreadedEchoServer(context=server_context) as server:
             with client_context.wrap_socket(socket.socket(),
@@ -3829,9 +3954,9 @@
                 s.connect((HOST, server.port))
                 self.assertEqual(s.version(), 'TLSv1.1')
 
-    @requires_minimum_version
     @requires_tls_version('TLSv1_2')
     @requires_tls_version('TLSv1')
+    @ignore_deprecation
     def test_min_max_version_mismatch(self):
         client_context, server_context, hostname = testing_context()
         # client 1.0, server 1.2 (mismatch)
@@ -3839,6 +3964,8 @@
         server_context.minimum_version = ssl.TLSVersion.TLSv1_2
         client_context.maximum_version = ssl.TLSVersion.TLSv1
         client_context.minimum_version = ssl.TLSVersion.TLSv1
+        seclevel_workaround(client_context, server_context)
+
         with ThreadedEchoServer(context=server_context) as server:
             with client_context.wrap_socket(socket.socket(),
                                             server_hostname=hostname) as s:
@@ -3846,36 +3973,34 @@
                     s.connect((HOST, server.port))
                 self.assertIn("alert", str(e.exception))
 
-    @requires_minimum_version
     @requires_tls_version('SSLv3')
     def test_min_max_version_sslv3(self):
         client_context, server_context, hostname = testing_context()
         server_context.minimum_version = ssl.TLSVersion.SSLv3
         client_context.minimum_version = ssl.TLSVersion.SSLv3
         client_context.maximum_version = ssl.TLSVersion.SSLv3
+        seclevel_workaround(client_context, server_context)
+
         with ThreadedEchoServer(context=server_context) as server:
             with client_context.wrap_socket(socket.socket(),
                                             server_hostname=hostname) as s:
                 s.connect((HOST, server.port))
                 self.assertEqual(s.version(), 'SSLv3')
 
-    @unittest.skipUnless(ssl.HAS_ECDH, "test requires ECDH-enabled OpenSSL")
     def test_default_ecdh_curve(self):
         # Issue #21015: elliptic curve-based Diffie Hellman key exchange
         # should be enabled by default on SSL contexts.
-        context = ssl.SSLContext(ssl.PROTOCOL_TLS)
-        context.load_cert_chain(CERTFILE)
+        client_context, server_context, hostname = testing_context()
         # TLSv1.3 defaults to PFS key agreement and no longer has KEA in
         # cipher name.
-        context.options |= ssl.OP_NO_TLSv1_3
+        client_context.maximum_version = ssl.TLSVersion.TLSv1_2
         # Prior to OpenSSL 1.0.0, ECDH ciphers have to be enabled
         # explicitly using the 'ECCdraft' cipher alias.  Otherwise,
         # our default cipher list should prefer ECDH-based ciphers
         # automatically.
-        if ssl.OPENSSL_VERSION_INFO < (1, 0, 0):
-            context.set_ciphers("ECCdraft:ECDH")
-        with ThreadedEchoServer(context=context) as server:
-            with context.wrap_socket(socket.socket()) as s:
+        with ThreadedEchoServer(context=server_context) as server:
+            with client_context.wrap_socket(socket.socket(),
+                                            server_hostname=hostname) as s:
                 s.connect((HOST, server.port))
                 self.assertIn("ECDH", s.cipher()[0])
 
@@ -3964,10 +4089,10 @@
         # Check we can get a connection with ephemeral Diffie-Hellman
         client_context, server_context, hostname = testing_context()
         # test scenario needs TLS <= 1.2
-        client_context.options |= ssl.OP_NO_TLSv1_3
+        client_context.maximum_version = ssl.TLSVersion.TLSv1_2
         server_context.load_dh_params(DHFILE)
         server_context.set_ciphers("kEDH")
-        server_context.options |= ssl.OP_NO_TLSv1_3
+        server_context.maximum_version = ssl.TLSVersion.TLSv1_2
         stats = server_params_test(client_context, server_context,
                                    chatty=True, connectionchatty=True,
                                    sni_name=hostname)
@@ -3976,15 +4101,13 @@
         if "ADH" not in parts and "EDH" not in parts and "DHE" not in parts:
             self.fail("Non-DH cipher: " + cipher[0])
 
-    @unittest.skipUnless(HAVE_SECP_CURVES, "needs secp384r1 curve support")
-    @unittest.skipIf(IS_OPENSSL_1_1_1, "TODO: Test doesn't work on 1.1.1")
     def test_ecdh_curve(self):
         # server secp384r1, client auto
         client_context, server_context, hostname = testing_context()
 
         server_context.set_ecdh_curve("secp384r1")
         server_context.set_ciphers("ECDHE:!eNULL:!aNULL")
-        server_context.options |= ssl.OP_NO_TLSv1 | ssl.OP_NO_TLSv1_1
+        server_context.minimum_version = ssl.TLSVersion.TLSv1_2
         stats = server_params_test(client_context, server_context,
                                    chatty=True, connectionchatty=True,
                                    sni_name=hostname)
@@ -3993,7 +4116,7 @@
         client_context, server_context, hostname = testing_context()
         client_context.set_ecdh_curve("secp384r1")
         server_context.set_ciphers("ECDHE:!eNULL:!aNULL")
-        server_context.options |= ssl.OP_NO_TLSv1 | ssl.OP_NO_TLSv1_1
+        server_context.minimum_version = ssl.TLSVersion.TLSv1_2
         stats = server_params_test(client_context, server_context,
                                    chatty=True, connectionchatty=True,
                                    sni_name=hostname)
@@ -4003,17 +4126,11 @@
         client_context.set_ecdh_curve("prime256v1")
         server_context.set_ecdh_curve("secp384r1")
         server_context.set_ciphers("ECDHE:!eNULL:!aNULL")
-        server_context.options |= ssl.OP_NO_TLSv1 | ssl.OP_NO_TLSv1_1
-        try:
-            stats = server_params_test(client_context, server_context,
-                                       chatty=True, connectionchatty=True,
-                                       sni_name=hostname)
-        except ssl.SSLError:
-            pass
-        else:
-            # OpenSSL 1.0.2 does not fail although it should.
-            if IS_OPENSSL_1_1_0:
-                self.fail("mismatch curve did not fail")
+        server_context.minimum_version = ssl.TLSVersion.TLSv1_2
+        with self.assertRaises(ssl.SSLError):
+            server_params_test(client_context, server_context,
+                               chatty=True, connectionchatty=True,
+                               sni_name=hostname)
 
     def test_selected_alpn_protocol(self):
         # selected_alpn_protocol() is None unless ALPN is used.
@@ -4023,7 +4140,6 @@
                                    sni_name=hostname)
         self.assertIs(stats['client_alpn_protocol'], None)
 
-    @unittest.skipUnless(ssl.HAS_ALPN, "ALPN support required")
     def test_selected_alpn_protocol_if_server_uses_alpn(self):
         # selected_alpn_protocol() is None unless ALPN is used by the client.
         client_context, server_context, hostname = testing_context()
@@ -4033,7 +4149,6 @@
                                    sni_name=hostname)
         self.assertIs(stats['client_alpn_protocol'], None)
 
-    @unittest.skipUnless(ssl.HAS_ALPN, "ALPN support needed for this test")
     def test_alpn_protocols(self):
         server_protocols = ['foo', 'bar', 'milkshake']
         protocol_tests = [
@@ -4056,56 +4171,20 @@
             except ssl.SSLError as e:
                 stats = e
 
-            if (expected is None and IS_OPENSSL_1_1_0
-                    and ssl.OPENSSL_VERSION_INFO < (1, 1, 0, 6)):
-                # OpenSSL 1.1.0 to 1.1.0e raises handshake error
-                self.assertIsInstance(stats, ssl.SSLError)
-            else:
-                msg = "failed trying %s (s) and %s (c).\n" \
-                    "was expecting %s, but got %%s from the %%s" \
-                        % (str(server_protocols), str(client_protocols),
-                            str(expected))
-                client_result = stats['client_alpn_protocol']
-                self.assertEqual(client_result, expected,
-                                 msg % (client_result, "client"))
-                server_result = stats['server_alpn_protocols'][-1] \
-                    if len(stats['server_alpn_protocols']) else 'nothing'
-                self.assertEqual(server_result, expected,
-                                 msg % (server_result, "server"))
-
-    def test_selected_npn_protocol(self):
-        # selected_npn_protocol() is None unless NPN is used
-        client_context, server_context, hostname = testing_context()
-        stats = server_params_test(client_context, server_context,
-                                   chatty=True, connectionchatty=True,
-                                   sni_name=hostname)
-        self.assertIs(stats['client_npn_protocol'], None)
-
-    @unittest.skipUnless(ssl.HAS_NPN, "NPN support needed for this test")
-    def test_npn_protocols(self):
-        server_protocols = ['http/1.1', 'spdy/2']
-        protocol_tests = [
-            (['http/1.1', 'spdy/2'], 'http/1.1'),
-            (['spdy/2', 'http/1.1'], 'http/1.1'),
-            (['spdy/2', 'test'], 'spdy/2'),
-            (['abc', 'def'], 'abc')
-        ]
-        for client_protocols, expected in protocol_tests:
-            client_context, server_context, hostname = testing_context()
-            server_context.set_npn_protocols(server_protocols)
-            client_context.set_npn_protocols(client_protocols)
-            stats = server_params_test(client_context, server_context,
-                                       chatty=True, connectionchatty=True,
-                                       sni_name=hostname)
             msg = "failed trying %s (s) and %s (c).\n" \
-                  "was expecting %s, but got %%s from the %%s" \
-                      % (str(server_protocols), str(client_protocols),
-                         str(expected))
-            client_result = stats['client_npn_protocol']
-            self.assertEqual(client_result, expected, msg % (client_result, "client"))
-            server_result = stats['server_npn_protocols'][-1] \
-                if len(stats['server_npn_protocols']) else 'nothing'
-            self.assertEqual(server_result, expected, msg % (server_result, "server"))
+                "was expecting %s, but got %%s from the %%s" \
+                    % (str(server_protocols), str(client_protocols),
+                        str(expected))
+            client_result = stats['client_alpn_protocol']
+            self.assertEqual(client_result, expected,
+                             msg % (client_result, "client"))
+            server_result = stats['server_alpn_protocols'][-1] \
+                if len(stats['server_alpn_protocols']) else 'nothing'
+            self.assertEqual(server_result, expected,
+                             msg % (server_result, "server"))
+
+    def test_npn_protocols(self):
+        assert not ssl.HAS_NPN
 
     def sni_contexts(self):
         server_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
@@ -4120,7 +4199,6 @@
         cert = stats['peercert']
         self.assertIn((('commonName', name),), cert['subject'])
 
-    @needs_sni
     def test_sni_callback(self):
         calls = []
         server_context, other_context, client_context = self.sni_contexts()
@@ -4161,7 +4239,6 @@
         self.check_common_name(stats, SIGNED_CERTFILE_HOSTNAME)
         self.assertEqual(calls, [])
 
-    @needs_sni
     def test_sni_callback_alert(self):
         # Returning a TLS alert is reflected to the connecting client
         server_context, other_context, client_context = self.sni_contexts()
@@ -4175,7 +4252,6 @@
                                        sni_name='supermessage')
         self.assertEqual(cm.exception.reason, 'TLSV1_ALERT_ACCESS_DENIED')
 
-    @needs_sni
     def test_sni_callback_raising(self):
         # Raising fails the connection with a TLS handshake failure alert.
         server_context, other_context, client_context = self.sni_contexts()
@@ -4194,7 +4270,6 @@
                              'SSLV3_ALERT_HANDSHAKE_FAILURE')
             self.assertEqual(catch.unraisable.exc_type, ZeroDivisionError)
 
-    @needs_sni
     def test_sni_callback_wrong_return_type(self):
         # Returning the wrong return type terminates the TLS connection
         # with an internal error alert.
@@ -4247,25 +4322,23 @@
 
     def test_sendfile(self):
         TEST_DATA = b"x" * 512
-        with open(support.TESTFN, 'wb') as f:
+        with open(os_helper.TESTFN, 'wb') as f:
             f.write(TEST_DATA)
-        self.addCleanup(support.unlink, support.TESTFN)
-        context = ssl.SSLContext(ssl.PROTOCOL_TLS)
-        context.verify_mode = ssl.CERT_REQUIRED
-        context.load_verify_locations(SIGNING_CA)
-        context.load_cert_chain(SIGNED_CERTFILE)
-        server = ThreadedEchoServer(context=context, chatty=False)
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
+        client_context, server_context, hostname = testing_context()
+        server = ThreadedEchoServer(context=server_context, chatty=False)
         with server:
-            with context.wrap_socket(socket.socket()) as s:
+            with client_context.wrap_socket(socket.socket(),
+                                            server_hostname=hostname) as s:
                 s.connect((HOST, server.port))
-                with open(support.TESTFN, 'rb') as file:
+                with open(os_helper.TESTFN, 'rb') as file:
                     s.sendfile(file)
                     self.assertEqual(s.recv(1024), TEST_DATA)
 
     def test_session(self):
         client_context, server_context, hostname = testing_context()
         # TODO: sessions aren't compatible with TLSv1.3 yet
-        client_context.options |= ssl.OP_NO_TLSv1_3
+        client_context.maximum_version = ssl.TLSVersion.TLSv1_2
 
         # first connection without session
         stats = server_params_test(client_context, server_context,
@@ -4275,8 +4348,7 @@
         self.assertGreater(session.time, 0)
         self.assertGreater(session.timeout, 0)
         self.assertTrue(session.has_ticket)
-        if ssl.OPENSSL_VERSION_INFO > (1, 0, 1):
-            self.assertGreater(session.ticket_lifetime_hint, 0)
+        self.assertGreater(session.ticket_lifetime_hint, 0)
         self.assertFalse(stats['session_reused'])
         sess_stat = server_context.session_stats()
         self.assertEqual(sess_stat['accept'], 1)
@@ -4325,8 +4397,8 @@
         client_context2, _, _ = testing_context()
 
         # TODO: session reuse does not work with TLSv1.3
-        client_context.options |= ssl.OP_NO_TLSv1_3
-        client_context2.options |= ssl.OP_NO_TLSv1_3
+        client_context.maximum_version = ssl.TLSVersion.TLSv1_2
+        client_context2.maximum_version = ssl.TLSVersion.TLSv1_2
 
         server = ThreadedEchoServer(context=server_context, chatty=False)
         with server:
@@ -4375,7 +4447,7 @@
 class TestPostHandshakeAuth(unittest.TestCase):
     def test_pha_setter(self):
         protocols = [
-            ssl.PROTOCOL_TLS, ssl.PROTOCOL_TLS_SERVER, ssl.PROTOCOL_TLS_CLIENT
+            ssl.PROTOCOL_TLS_SERVER, ssl.PROTOCOL_TLS_CLIENT
         ]
         for protocol in protocols:
             ctx = ssl.SSLContext(protocol)
@@ -4428,24 +4500,36 @@
         server_context.verify_mode = ssl.CERT_REQUIRED
         client_context.post_handshake_auth = True
 
-        # Ignore expected SSLError in ConnectionHandler of ThreadedEchoServer
-        # (it is only raised sometimes on Windows)
-        with support.catch_threading_exception() as cm:
-            server = ThreadedEchoServer(context=server_context, chatty=False)
-            with server:
-                with client_context.wrap_socket(socket.socket(),
-                                                server_hostname=hostname) as s:
-                    s.connect((HOST, server.port))
-                    s.write(b'PHA')
+        def msg_cb(conn, direction, version, content_type, msg_type, data):
+            if support.verbose and content_type == _TLSContentType.ALERT:
+                info = (conn, direction, version, content_type, msg_type, data)
+                sys.stdout.write(f"TLS: {info!r}\n")
+
+        server_context._msg_callback = msg_cb
+        client_context._msg_callback = msg_cb
+
+        server = ThreadedEchoServer(context=server_context, chatty=True)
+        with server:
+            with client_context.wrap_socket(socket.socket(),
+                                            server_hostname=hostname,
+                                            suppress_ragged_eofs=False) as s:
+                s.connect((HOST, server.port))
+                s.write(b'PHA')
+                # test sometimes fails with EOF error. Test passes as long as
+                # server aborts connection with an error.
+                with self.assertRaisesRegex(
+                    ssl.SSLError,
+                    '(certificate required|EOF occurred)'
+                ):
                     # receive CertificateRequest
-                    self.assertEqual(s.recv(1024), b'OK\n')
+                    data = s.recv(1024)
+                    self.assertEqual(data, b'OK\n')
+
                     # send empty Certificate + Finish
                     s.write(b'HASCERT')
+
                     # receive alert
-                    with self.assertRaisesRegex(
-                            ssl.SSLError,
-                            'tlsv13 alert certificate required'):
-                        s.recv(1024)
+                    s.recv(1024)
 
     def test_pha_optional(self):
         if support.verbose:
@@ -4577,6 +4661,63 @@
                 # server cert has not been validated
                 self.assertEqual(s.getpeercert(), {})
 
+    def test_internal_chain_client(self):
+        client_context, server_context, hostname = testing_context(
+            server_chain=False
+        )
+        server = ThreadedEchoServer(context=server_context, chatty=False)
+        with server:
+            with client_context.wrap_socket(
+                socket.socket(),
+                server_hostname=hostname
+            ) as s:
+                s.connect((HOST, server.port))
+                vc = s._sslobj.get_verified_chain()
+                self.assertEqual(len(vc), 2)
+                ee, ca = vc
+                uvc = s._sslobj.get_unverified_chain()
+                self.assertEqual(len(uvc), 1)
+
+                self.assertEqual(ee, uvc[0])
+                self.assertEqual(hash(ee), hash(uvc[0]))
+                self.assertEqual(repr(ee), repr(uvc[0]))
+
+                self.assertNotEqual(ee, ca)
+                self.assertNotEqual(hash(ee), hash(ca))
+                self.assertNotEqual(repr(ee), repr(ca))
+                self.assertNotEqual(ee.get_info(), ca.get_info())
+                self.assertIn("CN=localhost", repr(ee))
+                self.assertIn("CN=our-ca-server", repr(ca))
+
+                pem = ee.public_bytes(_ssl.ENCODING_PEM)
+                der = ee.public_bytes(_ssl.ENCODING_DER)
+                self.assertIsInstance(pem, str)
+                self.assertIn("-----BEGIN CERTIFICATE-----", pem)
+                self.assertIsInstance(der, bytes)
+                self.assertEqual(
+                    ssl.PEM_cert_to_DER_cert(pem), der
+                )
+
+    def test_internal_chain_server(self):
+        client_context, server_context, hostname = testing_context()
+        client_context.load_cert_chain(SIGNED_CERTFILE)
+        server_context.verify_mode = ssl.CERT_REQUIRED
+        server_context.maximum_version = ssl.TLSVersion.TLSv1_2
+
+        server = ThreadedEchoServer(context=server_context, chatty=False)
+        with server:
+            with client_context.wrap_socket(
+                socket.socket(),
+                server_hostname=hostname
+            ) as s:
+                s.connect((HOST, server.port))
+                s.write(b'VERIFIEDCHAIN\n')
+                res = s.recv(1024)
+                self.assertEqual(res, b'\x02\n')
+                s.write(b'UNVERIFIEDCHAIN\n')
+                res = s.recv(1024)
+                self.assertEqual(res, b'\x02\n')
+
 
 HAS_KEYLOG = hasattr(ssl.SSLContext, 'keylog_filename')
 requires_keylog = unittest.skipUnless(
@@ -4584,21 +4725,21 @@
 
 class TestSSLDebug(unittest.TestCase):
 
-    def keylog_lines(self, fname=support.TESTFN):
+    def keylog_lines(self, fname=os_helper.TESTFN):
         with open(fname) as f:
             return len(list(f))
 
     @requires_keylog
     @unittest.skipIf(Py_DEBUG_WIN32, "Avoid mixing debug/release CRT on Windows")
     def test_keylog_defaults(self):
-        self.addCleanup(support.unlink, support.TESTFN)
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
         ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
         self.assertEqual(ctx.keylog_filename, None)
 
-        self.assertFalse(os.path.isfile(support.TESTFN))
-        ctx.keylog_filename = support.TESTFN
-        self.assertEqual(ctx.keylog_filename, support.TESTFN)
-        self.assertTrue(os.path.isfile(support.TESTFN))
+        self.assertFalse(os.path.isfile(os_helper.TESTFN))
+        ctx.keylog_filename = os_helper.TESTFN
+        self.assertEqual(ctx.keylog_filename, os_helper.TESTFN)
+        self.assertTrue(os.path.isfile(os_helper.TESTFN))
         self.assertEqual(self.keylog_lines(), 1)
 
         ctx.keylog_filename = None
@@ -4607,7 +4748,7 @@
         with self.assertRaises((IsADirectoryError, PermissionError)):
             # Windows raises PermissionError
             ctx.keylog_filename = os.path.dirname(
-                os.path.abspath(support.TESTFN))
+                os.path.abspath(os_helper.TESTFN))
 
         with self.assertRaises(TypeError):
             ctx.keylog_filename = 1
@@ -4615,10 +4756,10 @@
     @requires_keylog
     @unittest.skipIf(Py_DEBUG_WIN32, "Avoid mixing debug/release CRT on Windows")
     def test_keylog_filename(self):
-        self.addCleanup(support.unlink, support.TESTFN)
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
         client_context, server_context, hostname = testing_context()
 
-        client_context.keylog_filename = support.TESTFN
+        client_context.keylog_filename = os_helper.TESTFN
         server = ThreadedEchoServer(context=server_context, chatty=False)
         with server:
             with client_context.wrap_socket(socket.socket(),
@@ -4628,7 +4769,7 @@
         self.assertEqual(self.keylog_lines(), 6)
 
         client_context.keylog_filename = None
-        server_context.keylog_filename = support.TESTFN
+        server_context.keylog_filename = os_helper.TESTFN
         server = ThreadedEchoServer(context=server_context, chatty=False)
         with server:
             with client_context.wrap_socket(socket.socket(),
@@ -4636,8 +4777,8 @@
                 s.connect((HOST, server.port))
         self.assertGreaterEqual(self.keylog_lines(), 11)
 
-        client_context.keylog_filename = support.TESTFN
-        server_context.keylog_filename = support.TESTFN
+        client_context.keylog_filename = os_helper.TESTFN
+        server_context.keylog_filename = os_helper.TESTFN
         server = ThreadedEchoServer(context=server_context, chatty=False)
         with server:
             with client_context.wrap_socket(socket.socket(),
@@ -4653,19 +4794,19 @@
                      "test is not compatible with ignore_environment")
     @unittest.skipIf(Py_DEBUG_WIN32, "Avoid mixing debug/release CRT on Windows")
     def test_keylog_env(self):
-        self.addCleanup(support.unlink, support.TESTFN)
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
         with unittest.mock.patch.dict(os.environ):
-            os.environ['SSLKEYLOGFILE'] = support.TESTFN
-            self.assertEqual(os.environ['SSLKEYLOGFILE'], support.TESTFN)
+            os.environ['SSLKEYLOGFILE'] = os_helper.TESTFN
+            self.assertEqual(os.environ['SSLKEYLOGFILE'], os_helper.TESTFN)
 
             ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
             self.assertEqual(ctx.keylog_filename, None)
 
             ctx = ssl.create_default_context()
-            self.assertEqual(ctx.keylog_filename, support.TESTFN)
+            self.assertEqual(ctx.keylog_filename, os_helper.TESTFN)
 
             ctx = ssl._create_stdlib_context()
-            self.assertEqual(ctx.keylog_filename, support.TESTFN)
+            self.assertEqual(ctx.keylog_filename, os_helper.TESTFN)
 
     def test_msg_callback(self):
         client_context, server_context, hostname = testing_context()
@@ -4681,7 +4822,7 @@
 
     def test_msg_callback_tls12(self):
         client_context, server_context, hostname = testing_context()
-        client_context.options |= ssl.OP_NO_TLSv1_3
+        client_context.maximum_version = ssl.TLSVersion.TLSv1_2
 
         msg = []
 
@@ -4710,8 +4851,30 @@
             msg
         )
 
+    def test_msg_callback_deadlock_bpo43577(self):
+        client_context, server_context, hostname = testing_context()
+        server_context2 = testing_context()[1]
 
-def test_main(verbose=False):
+        def msg_cb(conn, direction, version, content_type, msg_type, data):
+            pass
+
+        def sni_cb(sock, servername, ctx):
+            sock.context = server_context2
+
+        server_context._msg_callback = msg_cb
+        server_context.sni_callback = sni_cb
+
+        server = ThreadedEchoServer(context=server_context, chatty=False)
+        with server:
+            with client_context.wrap_socket(socket.socket(),
+                                            server_hostname=hostname) as s:
+                s.connect((HOST, server.port))
+            with client_context.wrap_socket(socket.socket(),
+                                            server_hostname=hostname) as s:
+                s.connect((HOST, server.port))
+
+
+def setUpModule():
     if support.verbose:
         plats = {
             'Mac': platform.mac_ver,
@@ -4742,20 +4905,9 @@
         if not os.path.exists(filename):
             raise support.TestFailed("Can't read certificate file %r" % filename)
 
-    tests = [
-        ContextTests, BasicSocketTests, SSLErrorTests, MemoryBIOTests,
-        SSLObjectTests, SimpleBackgroundTests, ThreadedTests,
-        TestPostHandshakeAuth, TestSSLDebug
-    ]
+    thread_info = threading_helper.threading_setup()
+    unittest.addModuleCleanup(threading_helper.threading_cleanup, *thread_info)
 
-    if support.is_resource_enabled('network'):
-        tests.append(NetworkedTests)
-
-    thread_info = support.threading_setup()
-    try:
-        support.run_unittest(*tests)
-    finally:
-        support.threading_cleanup(*thread_info)
 
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_startfile.py b/Lib/test/test_startfile.py
index 1a26a80..8c64299 100644
--- a/Lib/test/test_startfile.py
+++ b/Lib/test/test_startfile.py
@@ -9,6 +9,7 @@
 
 import unittest
 from test import support
+from test.support import os_helper
 import os
 import platform
 import sys
@@ -17,20 +18,28 @@
 startfile = support.get_attribute(os, 'startfile')
 
 
+@unittest.skipIf(platform.win32_is_iot(), "starting files is not supported on Windows IoT Core or nanoserver")
 class TestCase(unittest.TestCase):
     def test_nonexisting(self):
         self.assertRaises(OSError, startfile, "nonexisting.vbs")
 
-    @unittest.skipIf(platform.win32_is_iot(), "starting files is not supported on Windows IoT Core or nanoserver")
     def test_empty(self):
         # We need to make sure the child process starts in a directory
         # we're not about to delete. If we're running under -j, that
         # means the test harness provided directory isn't a safe option.
         # See http://bugs.python.org/issue15526 for more details
-        with support.change_cwd(path.dirname(sys.executable)):
+        with os_helper.change_cwd(path.dirname(sys.executable)):
             empty = path.join(path.dirname(__file__), "empty.vbs")
             startfile(empty)
             startfile(empty, "open")
+        startfile(empty, cwd=path.dirname(sys.executable))
+
+    def test_python(self):
+        # Passing "-V" ensures that it closes quickly, though still not
+        # quickly enough that we can run in the test directory
+        cwd, name = path.split(sys.executable)
+        startfile(name, arguments="-V", cwd=cwd)
+        startfile(name, arguments="-V", cwd=cwd, show_cmd=0)
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/Lib/test/test_stat.py b/Lib/test/test_stat.py
index d9e4ffd..2e1e2c3 100644
--- a/Lib/test/test_stat.py
+++ b/Lib/test/test_stat.py
@@ -2,8 +2,11 @@
 import os
 import socket
 import sys
+from test.support import os_helper
 from test.support import socket_helper
-from test.support import TESTFN, import_fresh_module
+from test.support.import_helper import import_fresh_module
+from test.support.os_helper import TESTFN
+
 
 c_stat = import_fresh_module('stat', fresh=['_stat'])
 py_stat = import_fresh_module('stat', blocked=['_stat'])
@@ -171,11 +174,16 @@
 
     @unittest.skipUnless(hasattr(os, 'mkfifo'), 'os.mkfifo not available')
     def test_fifo(self):
+        if sys.platform == "vxworks":
+            fifo_path = os.path.join("/fifos/", TESTFN)
+        else:
+            fifo_path = TESTFN
+        self.addCleanup(os_helper.unlink, fifo_path)
         try:
-            os.mkfifo(TESTFN, 0o700)
+            os.mkfifo(fifo_path, 0o700)
         except PermissionError as e:
             self.skipTest('os.mkfifo(): %s' % e)
-        st_mode, modestr = self.get_mode()
+        st_mode, modestr = self.get_mode(fifo_path)
         self.assertEqual(modestr, 'prwx------')
         self.assertS_IS("FIFO", st_mode)
 
diff --git a/Lib/test/test_statistics.py b/Lib/test/test_statistics.py
index bf415dd..2853b1b 100644
--- a/Lib/test/test_statistics.py
+++ b/Lib/test/test_statistics.py
@@ -15,10 +15,10 @@
 import sys
 import unittest
 from test import support
+from test.support import import_helper
 
 from decimal import Decimal
 from fractions import Fraction
-from test import support
 
 
 # Module to be tested.
@@ -179,8 +179,10 @@
 # We prefer this for testing numeric values that may not be exactly equal,
 # and avoid using TestCase.assertAlmostEqual, because it sucks :-)
 
-py_statistics = support.import_fresh_module('statistics', blocked=['_statistics'])
-c_statistics = support.import_fresh_module('statistics', fresh=['_statistics'])
+py_statistics = import_helper.import_fresh_module('statistics',
+                                                  blocked=['_statistics'])
+c_statistics = import_helper.import_fresh_module('statistics',
+                                                 fresh=['_statistics'])
 
 
 class TestModules(unittest.TestCase):
@@ -1245,20 +1247,14 @@
         # Override test for empty data.
         for data in ([], (), iter([])):
             self.assertEqual(self.func(data), (int, Fraction(0), 0))
-            self.assertEqual(self.func(data, 23), (int, Fraction(23), 0))
-            self.assertEqual(self.func(data, 2.3), (float, Fraction(2.3), 0))
 
     def test_ints(self):
         self.assertEqual(self.func([1, 5, 3, -4, -8, 20, 42, 1]),
                          (int, Fraction(60), 8))
-        self.assertEqual(self.func([4, 2, 3, -8, 7], 1000),
-                         (int, Fraction(1008), 5))
 
     def test_floats(self):
         self.assertEqual(self.func([0.25]*20),
                          (float, Fraction(5.0), 20))
-        self.assertEqual(self.func([0.125, 0.25, 0.5, 0.75], 1.5),
-                         (float, Fraction(3.125), 4))
 
     def test_fractions(self):
         self.assertEqual(self.func([Fraction(1, 1000)]*500),
@@ -1279,14 +1275,6 @@
         data = [random.uniform(-100, 1000) for _ in range(1000)]
         self.assertApproxEqual(float(self.func(data)[1]), math.fsum(data), rel=2e-16)
 
-    def test_start_argument(self):
-        # Test that the optional start argument works correctly.
-        data = [random.uniform(1, 1000) for _ in range(100)]
-        t = self.func(data)[1]
-        self.assertEqual(t+42, self.func(data, 42)[1])
-        self.assertEqual(t-23, self.func(data, -23)[1])
-        self.assertEqual(t+Fraction(1e20), self.func(data, 1e20)[1])
-
     def test_strings_fail(self):
         # Sum of strings should fail.
         self.assertRaises(TypeError, self.func, [1, 2, 3], '999')
@@ -1597,6 +1585,27 @@
         actual = self.func(data*2)
         self.assertApproxEqual(actual, expected)
 
+    def test_with_weights(self):
+        self.assertEqual(self.func([40, 60], [5, 30]), 56.0)  # common case
+        self.assertEqual(self.func([40, 60],
+                                   weights=[5, 30]), 56.0)    # keyword argument
+        self.assertEqual(self.func(iter([40, 60]),
+                                   iter([5, 30])), 56.0)      # iterator inputs
+        self.assertEqual(
+            self.func([Fraction(10, 3), Fraction(23, 5), Fraction(7, 2)], [5, 2, 10]),
+            self.func([Fraction(10, 3)] * 5 +
+                      [Fraction(23, 5)] * 2 +
+                      [Fraction(7, 2)] * 10))
+        self.assertEqual(self.func([10], [7]), 10)            # n=1 fast path
+        with self.assertRaises(TypeError):
+            self.func([1, 2, 3], [1, (), 3])                  # non-numeric weight
+        with self.assertRaises(statistics.StatisticsError):
+            self.func([1, 2, 3], [1, 2])                      # wrong number of weights
+        with self.assertRaises(statistics.StatisticsError):
+            self.func([10], [0])                              # no non-zero weights
+        with self.assertRaises(statistics.StatisticsError):
+            self.func([10, 20], [0, 0])                       # no non-zero weights
+
 
 class TestMedian(NumericTestCase, AverageMixin):
     # Common tests for median and all median.* functions.
@@ -1888,10 +1897,13 @@
 
     def test_counter_data(self):
         # Test that a Counter is treated like any other iterable.
-        data = collections.Counter([1, 1, 1, 2])
-        # Since the keys of the counter are treated as data points, not the
-        # counts, this should return the first mode encountered, 1
-        self.assertEqual(self.func(data), 1)
+        # We're making sure mode() first calls iter() on its input.
+        # The concern is that a Counter of a Counter returns the original
+        # unchanged rather than counting its keys.
+        c = collections.Counter(a=1, b=2)
+        # If iter() is called, mode(c) loops over the keys, ['a', 'b'],
+        # all the counts will be 1, and the first encountered mode is 'a'.
+        self.assertEqual(self.func(c), 'a')
 
 
 class TestMultiMode(unittest.TestCase):
@@ -2054,6 +2066,13 @@
         self.assertEqual(result, exact)
         self.assertIsInstance(result, Decimal)
 
+    def test_accuracy_bug_20499(self):
+        data = [0, 0, 1]
+        exact = 2 / 9
+        result = self.func(data)
+        self.assertEqual(result, exact)
+        self.assertIsInstance(result, float)
+
 
 class TestVariance(VarianceStdevMixin, NumericTestCase, UnivariateTypeMixin):
     # Tests for sample variance.
@@ -2094,6 +2113,13 @@
         self.assertEqual(self.func(data), 0.5)
         self.assertEqual(self.func(data, xbar=2.0), 1.0)
 
+    def test_accuracy_bug_20499(self):
+        data = [0, 0, 2]
+        exact = 4 / 3
+        result = self.func(data)
+        self.assertEqual(result, exact)
+        self.assertIsInstance(result, float)
+
 class TestPStdev(VarianceStdevMixin, NumericTestCase):
     # Tests for population standard deviation.
     def setUp(self):
@@ -2384,6 +2410,84 @@
             quantiles([10, None, 30], n=4)      # data is non-numeric
 
 
+class TestBivariateStatistics(unittest.TestCase):
+
+    def test_unequal_size_error(self):
+        for x, y in [
+            ([1, 2, 3], [1, 2]),
+            ([1, 2], [1, 2, 3]),
+        ]:
+            with self.assertRaises(statistics.StatisticsError):
+                statistics.covariance(x, y)
+            with self.assertRaises(statistics.StatisticsError):
+                statistics.correlation(x, y)
+            with self.assertRaises(statistics.StatisticsError):
+                statistics.linear_regression(x, y)
+
+    def test_small_sample_error(self):
+        for x, y in [
+            ([], []),
+            ([], [1, 2,]),
+            ([1, 2,], []),
+            ([1,], [1,]),
+            ([1,], [1, 2,]),
+            ([1, 2,], [1,]),
+        ]:
+            with self.assertRaises(statistics.StatisticsError):
+                statistics.covariance(x, y)
+            with self.assertRaises(statistics.StatisticsError):
+                statistics.correlation(x, y)
+            with self.assertRaises(statistics.StatisticsError):
+                statistics.linear_regression(x, y)
+
+
+class TestCorrelationAndCovariance(unittest.TestCase):
+
+    def test_results(self):
+        for x, y, result in [
+            ([1, 2, 3], [1, 2, 3], 1),
+            ([1, 2, 3], [-1, -2, -3], -1),
+            ([1, 2, 3], [3, 2, 1], -1),
+            ([1, 2, 3], [1, 2, 1], 0),
+            ([1, 2, 3], [1, 3, 2], 0.5),
+        ]:
+            self.assertAlmostEqual(statistics.correlation(x, y), result)
+            self.assertAlmostEqual(statistics.covariance(x, y), result)
+
+    def test_different_scales(self):
+        x = [1, 2, 3]
+        y = [10, 30, 20]
+        self.assertAlmostEqual(statistics.correlation(x, y), 0.5)
+        self.assertAlmostEqual(statistics.covariance(x, y), 5)
+
+        y = [.1, .2, .3]
+        self.assertAlmostEqual(statistics.correlation(x, y), 1)
+        self.assertAlmostEqual(statistics.covariance(x, y), 0.1)
+
+
+class TestLinearRegression(unittest.TestCase):
+
+    def test_constant_input_error(self):
+        x = [1, 1, 1,]
+        y = [1, 2, 3,]
+        with self.assertRaises(statistics.StatisticsError):
+            statistics.linear_regression(x, y)
+
+    def test_results(self):
+        for x, y, true_intercept, true_slope in [
+            ([1, 2, 3], [0, 0, 0], 0, 0),
+            ([1, 2, 3], [1, 2, 3], 0, 1),
+            ([1, 2, 3], [100, 100, 100], 100, 0),
+            ([1, 2, 3], [12, 14, 16], 10, 2),
+            ([1, 2, 3], [-1, -2, -3], 0, -1),
+            ([1, 2, 3], [21, 22, 23], 20, 1),
+            ([1, 2, 3], [5.1, 5.2, 5.3], 5, 0.1),
+        ]:
+            slope, intercept = statistics.linear_regression(x, y)
+            self.assertAlmostEqual(intercept, true_intercept)
+            self.assertAlmostEqual(slope, true_slope)
+
+
 class TestNormalDist:
 
     # General note on precision: The pdf(), cdf(), and overlap() methods
diff --git a/Lib/test/test_strftime.py b/Lib/test/test_strftime.py
index ec305e5..be43c49 100644
--- a/Lib/test/test_strftime.py
+++ b/Lib/test/test_strftime.py
@@ -114,7 +114,7 @@
         )
 
         for e in expectations:
-            # musn't raise a value error
+            # mustn't raise a value error
             try:
                 result = time.strftime(e[0], now)
             except ValueError as error:
diff --git a/Lib/test/test_string_literals.py b/Lib/test/test_string_literals.py
index 9565ee2..7231970 100644
--- a/Lib/test/test_string_literals.py
+++ b/Lib/test/test_string_literals.py
@@ -33,7 +33,6 @@
 import tempfile
 import unittest
 import warnings
-from test.support import use_old_parser
 
 
 TEMPLATE = r"""# coding: %s
@@ -168,8 +167,7 @@
             eval("b'''\n\\z'''")
         self.assertEqual(len(w), 1)
         self.assertEqual(w[0].filename, '<string>')
-        if use_old_parser():
-            self.assertEqual(w[0].lineno, 1)
+        self.assertEqual(w[0].lineno, 1)
 
         with warnings.catch_warnings(record=True) as w:
             warnings.simplefilter('error', category=DeprecationWarning)
@@ -178,8 +176,7 @@
             exc = cm.exception
         self.assertEqual(w, [])
         self.assertEqual(exc.filename, '<string>')
-        if use_old_parser():
-            self.assertEqual(exc.lineno, 1)
+        self.assertEqual(exc.lineno, 1)
 
     def test_eval_bytes_raw(self):
         self.assertEqual(eval(""" br'x' """), b'x')
diff --git a/Lib/test/test_structmembers.py b/Lib/test/test_structmembers.py
index 57ec45f..07d2f62 100644
--- a/Lib/test/test_structmembers.py
+++ b/Lib/test/test_structmembers.py
@@ -1,8 +1,9 @@
 import unittest
-from test import support
+from test.support import import_helper
+from test.support import warnings_helper
 
 # Skip this test if the _testcapi module isn't available.
-support.import_module('_testcapi')
+import_helper.import_module('_testcapi')
 from _testcapi import _test_structmembersType, \
     CHAR_MAX, CHAR_MIN, UCHAR_MAX, \
     SHRT_MAX, SHRT_MIN, USHRT_MAX, \
@@ -116,27 +117,27 @@
 class TestWarnings(unittest.TestCase):
 
     def test_byte_max(self):
-        with support.check_warnings(('', RuntimeWarning)):
+        with warnings_helper.check_warnings(('', RuntimeWarning)):
             ts.T_BYTE = CHAR_MAX+1
 
     def test_byte_min(self):
-        with support.check_warnings(('', RuntimeWarning)):
+        with warnings_helper.check_warnings(('', RuntimeWarning)):
             ts.T_BYTE = CHAR_MIN-1
 
     def test_ubyte_max(self):
-        with support.check_warnings(('', RuntimeWarning)):
+        with warnings_helper.check_warnings(('', RuntimeWarning)):
             ts.T_UBYTE = UCHAR_MAX+1
 
     def test_short_max(self):
-        with support.check_warnings(('', RuntimeWarning)):
+        with warnings_helper.check_warnings(('', RuntimeWarning)):
             ts.T_SHORT = SHRT_MAX+1
 
     def test_short_min(self):
-        with support.check_warnings(('', RuntimeWarning)):
+        with warnings_helper.check_warnings(('', RuntimeWarning)):
             ts.T_SHORT = SHRT_MIN-1
 
     def test_ushort_max(self):
-        with support.check_warnings(('', RuntimeWarning)):
+        with warnings_helper.check_warnings(('', RuntimeWarning)):
             ts.T_USHORT = USHRT_MAX+1
 
 
diff --git a/Lib/test/test_structseq.py b/Lib/test/test_structseq.py
index 36630a1..a9fe193 100644
--- a/Lib/test/test_structseq.py
+++ b/Lib/test/test_structseq.py
@@ -122,5 +122,17 @@
                     self.assertEqual(list(t[start:stop:step]),
                                      L[start:stop:step])
 
+    def test_match_args(self):
+        expected_args = ('tm_year', 'tm_mon', 'tm_mday', 'tm_hour', 'tm_min',
+                         'tm_sec', 'tm_wday', 'tm_yday', 'tm_isdst')
+        self.assertEqual(time.struct_time.__match_args__, expected_args)
+
+    def test_match_args_with_unnamed_fields(self):
+        expected_args = ('st_mode', 'st_ino', 'st_dev', 'st_nlink', 'st_uid',
+                         'st_gid', 'st_size')
+        self.assertEqual(os.stat_result.n_unnamed_fields, 3)
+        self.assertEqual(os.stat_result.__match_args__, expected_args)
+
+
 if __name__ == "__main__":
     unittest.main()
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
index 7373fe2..7bb0492 100644
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -1,6 +1,9 @@
 import unittest
 from unittest import mock
 from test import support
+from test.support import import_helper
+from test.support import os_helper
+from test.support import warnings_helper
 import subprocess
 import sys
 import signal
@@ -20,7 +23,8 @@
 import gc
 import textwrap
 import json
-from test.support import FakePath
+import pathlib
+from test.support.os_helper import FakePath
 
 try:
     import _testcapi
@@ -36,6 +40,11 @@
 except ImportError:
     grp = None
 
+try:
+    import fcntl
+except:
+    fcntl = None
+
 if support.PGO:
     raise unittest.SkipTest("test is not helpful for PGO")
 
@@ -196,6 +205,28 @@
                 input=b'pear')
         self.assertIn(b'PEAR', output)
 
+    def test_check_output_input_none(self):
+        """input=None has a legacy meaning of input='' on check_output."""
+        output = subprocess.check_output(
+                [sys.executable, "-c",
+                 "import sys; print('XX' if sys.stdin.read() else '')"],
+                input=None)
+        self.assertNotIn(b'XX', output)
+
+    def test_check_output_input_none_text(self):
+        output = subprocess.check_output(
+                [sys.executable, "-c",
+                 "import sys; print('XX' if sys.stdin.read() else '')"],
+                input=None, text=True)
+        self.assertNotIn('XX', output)
+
+    def test_check_output_input_none_universal_newlines(self):
+        output = subprocess.check_output(
+                [sys.executable, "-c",
+                 "import sys; print('XX' if sys.stdin.read() else '')"],
+                input=None, universal_newlines=True)
+        self.assertNotIn('XX', output)
+
     def test_check_output_stdout_arg(self):
         # check_output() refuses to accept 'stdout' argument
         with self.assertRaises(ValueError) as c:
@@ -357,7 +388,7 @@
         # Normalize an expected cwd (for Tru64 support).
         # We can't use os.path.realpath since it doesn't expand Tru64 {memb}
         # strings.  See bug #1063571.
-        with support.change_cwd(cwd):
+        with os_helper.change_cwd(cwd):
             return os.getcwd()
 
     # For use in the test_cwd* tests below.
@@ -408,7 +439,7 @@
         # is relative.
         python_dir, python_base = self._split_python_path()
         rel_python = os.path.join(os.curdir, python_base)
-        with support.temp_cwd() as wrong_dir:
+        with os_helper.temp_cwd() as wrong_dir:
             # Before calling with the correct cwd, confirm that the call fails
             # without cwd and with the wrong cwd.
             self.assertRaises(FileNotFoundError, subprocess.Popen,
@@ -425,7 +456,7 @@
         python_dir, python_base = self._split_python_path()
         rel_python = os.path.join(os.curdir, python_base)
         doesntexist = "somethingyoudonthave"
-        with support.temp_cwd() as wrong_dir:
+        with os_helper.temp_cwd() as wrong_dir:
             # Before calling with the correct cwd, confirm that the call fails
             # without cwd and with the wrong cwd.
             self.assertRaises(FileNotFoundError, subprocess.Popen,
@@ -443,7 +474,7 @@
         python_dir, python_base = self._split_python_path()
         abs_python = os.path.join(python_dir, python_base)
         rel_python = os.path.join(os.curdir, python_base)
-        with support.temp_dir() as wrong_dir:
+        with os_helper.temp_dir() as wrong_dir:
             # Before calling with an absolute path, confirm that using a
             # relative path fails.
             self.assertRaises(FileNotFoundError, subprocess.Popen,
@@ -658,6 +689,67 @@
         p.wait()
         self.assertEqual(p.stdin, None)
 
+    @unittest.skipUnless(fcntl and hasattr(fcntl, 'F_GETPIPE_SZ'),
+                         'fcntl.F_GETPIPE_SZ required for test.')
+    def test_pipesizes(self):
+        test_pipe_r, test_pipe_w = os.pipe()
+        try:
+            # Get the default pipesize with F_GETPIPE_SZ
+            pipesize_default = fcntl.fcntl(test_pipe_w, fcntl.F_GETPIPE_SZ)
+        finally:
+            os.close(test_pipe_r)
+            os.close(test_pipe_w)
+        pipesize = pipesize_default // 2
+        if pipesize < 512:  # the POSIX minimum
+            raise unittest.SkitTest(
+                'default pipesize too small to perform test.')
+        p = subprocess.Popen(
+            [sys.executable, "-c",
+             'import sys; sys.stdin.read(); sys.stdout.write("out"); '
+             'sys.stderr.write("error!")'],
+            stdin=subprocess.PIPE, stdout=subprocess.PIPE,
+            stderr=subprocess.PIPE, pipesize=pipesize)
+        try:
+            for fifo in [p.stdin, p.stdout, p.stderr]:
+                self.assertEqual(
+                    fcntl.fcntl(fifo.fileno(), fcntl.F_GETPIPE_SZ),
+                    pipesize)
+            # Windows pipe size can be acquired via GetNamedPipeInfoFunction
+            # https://docs.microsoft.com/en-us/windows/win32/api/namedpipeapi/nf-namedpipeapi-getnamedpipeinfo
+            # However, this function is not yet in _winapi.
+            p.stdin.write(b"pear")
+            p.stdin.close()
+        finally:
+            p.kill()
+            p.wait()
+
+    @unittest.skipUnless(fcntl and hasattr(fcntl, 'F_GETPIPE_SZ'),
+                         'fcntl.F_GETPIPE_SZ required for test.')
+    def test_pipesize_default(self):
+        p = subprocess.Popen(
+            [sys.executable, "-c",
+             'import sys; sys.stdin.read(); sys.stdout.write("out"); '
+             'sys.stderr.write("error!")'],
+            stdin=subprocess.PIPE, stdout=subprocess.PIPE,
+            stderr=subprocess.PIPE, pipesize=-1)
+        try:
+            fp_r, fp_w = os.pipe()
+            try:
+                default_pipesize = fcntl.fcntl(fp_w, fcntl.F_GETPIPE_SZ)
+                for fifo in [p.stdin, p.stdout, p.stderr]:
+                    self.assertEqual(
+                        fcntl.fcntl(fifo.fileno(), fcntl.F_GETPIPE_SZ),
+                        default_pipesize)
+            finally:
+                os.close(fp_r)
+                os.close(fp_w)
+            # On other platforms we cannot test the pipe size (yet). But above
+            # code using pipesize=-1 should not crash.
+            p.stdin.close()
+        finally:
+            p.kill()
+            p.wait()
+
     def test_env(self):
         newenv = os.environ.copy()
         newenv["FRUIT"] = "orange"
@@ -1054,7 +1146,7 @@
         try:
             for i in range(max_handles):
                 try:
-                    tmpfile = os.path.join(tmpdir, support.TESTFN)
+                    tmpfile = os.path.join(tmpdir, os_helper.TESTFN)
                     handles.append(os.open(tmpfile, os.O_WRONLY|os.O_CREAT))
                 except OSError as e:
                     if e.errno != errno.EMFILE:
@@ -1351,28 +1443,23 @@
         p.communicate(b"x" * 2**20)
 
     def test_repr(self):
-        # Run a command that waits for user input, to check the repr() of
-        # a Proc object while and after the sub-process runs.
-        code = 'import sys; input(); sys.exit(57)'
-        cmd = [sys.executable, '-c', code]
-        result = "<Popen: returncode: {}"
+        path_cmd = pathlib.Path("my-tool.py")
+        pathlib_cls = path_cmd.__class__.__name__
 
-        with subprocess.Popen(
-                cmd, stdin=subprocess.PIPE, universal_newlines=True) as proc:
-            self.assertIsNone(proc.returncode)
-            self.assertTrue(
-                repr(proc).startswith(result.format(proc.returncode)) and
-                repr(proc).endswith('>')
-            )
-
-            proc.communicate(input='exit...\n')
-            proc.wait()
-
-            self.assertIsNotNone(proc.returncode)
-            self.assertTrue(
-                repr(proc).startswith(result.format(proc.returncode)) and
-                repr(proc).endswith('>')
-            )
+        cases = [
+            ("ls", True, 123, "<Popen: returncode: 123 args: 'ls'>"),
+            ('a' * 100, True, 0,
+             "<Popen: returncode: 0 args: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...>"),
+            (["ls"], False, None, "<Popen: returncode: None args: ['ls']>"),
+            (["ls", '--my-opts', 'a' * 100], False, None,
+             "<Popen: returncode: None args: ['ls', '--my-opts', 'aaaaaaaaaaaaaaaaaaaaaaaa...>"),
+            (path_cmd, False, 7, f"<Popen: returncode: 7 args: {pathlib_cls}('my-tool.py')>")
+        ]
+        with unittest.mock.patch.object(subprocess.Popen, '_execute_child'):
+            for cmd, shell, code, sx in cases:
+                p = subprocess.Popen(cmd, shell=shell)
+                p.returncode = code
+                self.assertEqual(repr(p), sx)
 
     def test_communicate_epipe_only_stdin(self):
         # Issue 10963: communicate() should hide EPIPE
@@ -2060,11 +2147,7 @@
     def test_preexec_gc_module_failure(self):
         # This tests the code that disables garbage collection if the child
         # process will execute any Python.
-        def raise_runtime_error():
-            raise RuntimeError("this shouldn't escape")
         enabled = gc.isenabled()
-        orig_gc_disable = gc.disable
-        orig_gc_isenabled = gc.isenabled
         try:
             gc.disable()
             self.assertFalse(gc.isenabled())
@@ -2078,19 +2161,7 @@
             subprocess.call([sys.executable, '-c', ''],
                             preexec_fn=lambda: None)
             self.assertTrue(gc.isenabled(), "Popen left gc disabled.")
-
-            gc.disable = raise_runtime_error
-            self.assertRaises(RuntimeError, subprocess.Popen,
-                              [sys.executable, '-c', ''],
-                              preexec_fn=lambda: None)
-
-            del gc.isenabled  # force an AttributeError
-            self.assertRaises(AttributeError, subprocess.Popen,
-                              [sys.executable, '-c', ''],
-                              preexec_fn=lambda: None)
         finally:
-            gc.disable = orig_gc_disable
-            gc.isenabled = orig_gc_isenabled
             if not enabled:
                 gc.disable()
 
@@ -2896,7 +2967,7 @@
     def test_select_unbuffered(self):
         # Issue #11459: bufsize=0 should really set the pipes as
         # unbuffered (and therefore let select() work properly).
-        select = support.import_module("select")
+        select = import_helper.import_module("select")
         p = subprocess.Popen([sys.executable, "-c",
                               'import sys;'
                               'sys.stdout.write("apple")'],
@@ -2924,7 +2995,7 @@
         self.addCleanup(p.stderr.close)
         ident = id(p)
         pid = p.pid
-        with support.check_warnings(('', ResourceWarning)):
+        with warnings_helper.check_warnings(('', ResourceWarning)):
             p = None
 
         if mswindows:
@@ -2949,8 +3020,9 @@
         self.addCleanup(p.stderr.close)
         ident = id(p)
         pid = p.pid
-        with support.check_warnings(('', ResourceWarning)):
+        with warnings_helper.check_warnings(('', ResourceWarning)):
             p = None
+            support.gc_collect()  # For PyPy or other GCs.
 
         os.kill(pid, signal.SIGKILL)
         if mswindows:
@@ -3316,7 +3388,8 @@
         self.assertIn(b"OSError", stderr)
 
         # Check for a warning due to using handle_list and close_fds=False
-        with support.check_warnings((".*overriding close_fds", RuntimeWarning)):
+        with warnings_helper.check_warnings((".*overriding close_fds",
+                                             RuntimeWarning)):
             startupinfo = subprocess.STARTUPINFO()
             startupinfo.lpAttributeList = {"handle_list": handles[:]}
             p = subprocess.Popen([sys.executable, "-c",
@@ -3525,7 +3598,7 @@
 
     def test__all__(self):
         """Ensure that __all__ is populated properly."""
-        intentionally_excluded = {"list2cmdline", "Handle", "pwd", "grp"}
+        intentionally_excluded = {"list2cmdline", "Handle", "pwd", "grp", "fcntl"}
         exported = set(subprocess.__all__)
         possible_exports = set()
         import types
diff --git a/Lib/test/test_sundry.py b/Lib/test/test_sundry.py
index 2accad1..007d688 100644
--- a/Lib/test/test_sundry.py
+++ b/Lib/test/test_sundry.py
@@ -3,15 +3,17 @@
 import platform
 import sys
 from test import support
+from test.support import import_helper
+from test.support import warnings_helper
 import unittest
 
 class TestUntestedModules(unittest.TestCase):
     def test_untested_modules_can_be_imported(self):
-        untested = ('encodings', 'formatter')
-        with support.check_warnings(quiet=True):
+        untested = ('encodings',)
+        with warnings_helper.check_warnings(quiet=True):
             for name in untested:
                 try:
-                    support.import_module('test.test_{}'.format(name))
+                    import_helper.import_module('test.test_{}'.format(name))
                 except unittest.SkipTest:
                     importlib.import_module(name)
                 else:
@@ -30,7 +32,6 @@
                 import distutils.command.bdist_msi
             import distutils.command.bdist
             import distutils.command.bdist_rpm
-            import distutils.command.bdist_wininst
             import distutils.command.build_clib
             import distutils.command.build_ext
             import distutils.command.build
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py
index b5a16f9..7929098 100644
--- a/Lib/test/test_support.py
+++ b/Lib/test/test_support.py
@@ -11,21 +11,54 @@
 import textwrap
 import time
 import unittest
+import warnings
+
 from test import support
+from test.support import import_helper
+from test.support import os_helper
 from test.support import script_helper
 from test.support import socket_helper
+from test.support import warnings_helper
 
-TESTFN = support.TESTFN
+TESTFN = os_helper.TESTFN
 
 
 class TestSupport(unittest.TestCase):
+    @classmethod
+    def setUpClass(cls):
+        orig_filter_len = len(warnings.filters)
+        cls._warnings_helper_token = support.ignore_deprecations_from(
+            "test.support.warnings_helper", like=".*used in test_support.*"
+        )
+        cls._test_support_token = support.ignore_deprecations_from(
+            "test.test_support", like=".*You should NOT be seeing this.*"
+        )
+        assert len(warnings.filters) == orig_filter_len + 2
+
+    @classmethod
+    def tearDownClass(cls):
+        orig_filter_len = len(warnings.filters)
+        support.clear_ignored_deprecations(
+            cls._warnings_helper_token,
+            cls._test_support_token,
+        )
+        assert len(warnings.filters) == orig_filter_len - 2
+
+    def test_ignored_deprecations_are_silent(self):
+        """Test support.ignore_deprecations_from() silences warnings"""
+        with warnings.catch_warnings(record=True) as warning_objs:
+            warnings_helper._warn_about_deprecation()
+            warnings.warn("You should NOT be seeing this.", DeprecationWarning)
+            messages = [str(w.message) for w in warning_objs]
+        self.assertEqual(len(messages), 0, messages)
 
     def test_import_module(self):
-        support.import_module("ftplib")
-        self.assertRaises(unittest.SkipTest, support.import_module, "foo")
+        import_helper.import_module("ftplib")
+        self.assertRaises(unittest.SkipTest,
+                          import_helper.import_module, "foo")
 
     def test_import_fresh_module(self):
-        support.import_fresh_module("ftplib")
+        import_helper.import_fresh_module("ftplib")
 
     def test_get_attribute(self):
         self.assertEqual(support.get_attribute(self, "test_get_attribute"),
@@ -39,43 +72,43 @@
     def test_unload(self):
         import sched
         self.assertIn("sched", sys.modules)
-        support.unload("sched")
+        import_helper.unload("sched")
         self.assertNotIn("sched", sys.modules)
 
     def test_unlink(self):
-        with open(TESTFN, "w") as f:
+        with open(TESTFN, "w", encoding="utf-8") as f:
             pass
-        support.unlink(TESTFN)
+        os_helper.unlink(TESTFN)
         self.assertFalse(os.path.exists(TESTFN))
-        support.unlink(TESTFN)
+        os_helper.unlink(TESTFN)
 
     def test_rmtree(self):
-        dirpath = support.TESTFN + 'd'
+        dirpath = os_helper.TESTFN + 'd'
         subdirpath = os.path.join(dirpath, 'subdir')
         os.mkdir(dirpath)
         os.mkdir(subdirpath)
-        support.rmtree(dirpath)
+        os_helper.rmtree(dirpath)
         self.assertFalse(os.path.exists(dirpath))
         with support.swap_attr(support, 'verbose', 0):
-            support.rmtree(dirpath)
+            os_helper.rmtree(dirpath)
 
         os.mkdir(dirpath)
         os.mkdir(subdirpath)
         os.chmod(dirpath, stat.S_IRUSR|stat.S_IXUSR)
         with support.swap_attr(support, 'verbose', 0):
-            support.rmtree(dirpath)
+            os_helper.rmtree(dirpath)
         self.assertFalse(os.path.exists(dirpath))
 
         os.mkdir(dirpath)
         os.mkdir(subdirpath)
         os.chmod(dirpath, 0)
         with support.swap_attr(support, 'verbose', 0):
-            support.rmtree(dirpath)
+            os_helper.rmtree(dirpath)
         self.assertFalse(os.path.exists(dirpath))
 
     def test_forget(self):
         mod_filename = TESTFN + '.py'
-        with open(mod_filename, 'w') as f:
+        with open(mod_filename, 'w', encoding="utf-8") as f:
             print('foo = 1', file=f)
         sys.path.insert(0, os.curdir)
         importlib.invalidate_caches()
@@ -83,12 +116,12 @@
             mod = __import__(TESTFN)
             self.assertIn(TESTFN, sys.modules)
 
-            support.forget(TESTFN)
+            import_helper.forget(TESTFN)
             self.assertNotIn(TESTFN, sys.modules)
         finally:
             del sys.path[0]
-            support.unlink(mod_filename)
-            support.rmtree('__pycache__')
+            os_helper.unlink(mod_filename)
+            os_helper.rmtree('__pycache__')
 
     def test_HOST(self):
         s = socket.create_server((socket_helper.HOST, 0))
@@ -115,23 +148,23 @@
         try:
             path = os.path.join(parent_dir, 'temp')
             self.assertFalse(os.path.isdir(path))
-            with support.temp_dir(path) as temp_path:
+            with os_helper.temp_dir(path) as temp_path:
                 self.assertEqual(temp_path, path)
                 self.assertTrue(os.path.isdir(path))
             self.assertFalse(os.path.isdir(path))
         finally:
-            support.rmtree(parent_dir)
+            os_helper.rmtree(parent_dir)
 
     def test_temp_dir__path_none(self):
         """Test passing no path."""
-        with support.temp_dir() as temp_path:
+        with os_helper.temp_dir() as temp_path:
             self.assertTrue(os.path.isdir(temp_path))
         self.assertFalse(os.path.isdir(temp_path))
 
     def test_temp_dir__existing_dir__quiet_default(self):
         """Test passing a directory that already exists."""
         def call_temp_dir(path):
-            with support.temp_dir(path) as temp_path:
+            with os_helper.temp_dir(path) as temp_path:
                 raise Exception("should not get here")
 
         path = tempfile.mkdtemp()
@@ -150,8 +183,8 @@
         path = os.path.realpath(path)
 
         try:
-            with support.check_warnings() as recorder:
-                with support.temp_dir(path, quiet=True) as temp_path:
+            with warnings_helper.check_warnings() as recorder:
+                with os_helper.temp_dir(path, quiet=True) as temp_path:
                     self.assertEqual(path, temp_path)
                 warnings = [str(w.message) for w in recorder.warnings]
             # Make sure temp_dir did not delete the original directory.
@@ -173,7 +206,8 @@
         script_helper.assert_python_ok("-c", textwrap.dedent("""
             import os
             from test import support
-            with support.temp_cwd() as temp_path:
+            from test.support import os_helper
+            with os_helper.temp_cwd() as temp_path:
                 pid = os.fork()
                 if pid != 0:
                     # parent process
@@ -194,8 +228,8 @@
     def test_change_cwd(self):
         original_cwd = os.getcwd()
 
-        with support.temp_dir() as temp_path:
-            with support.change_cwd(temp_path) as new_cwd:
+        with os_helper.temp_dir() as temp_path:
+            with os_helper.change_cwd(temp_path) as new_cwd:
                 self.assertEqual(new_cwd, temp_path)
                 self.assertEqual(os.getcwd(), new_cwd)
 
@@ -206,10 +240,10 @@
         original_cwd = os.getcwd()
 
         def call_change_cwd(path):
-            with support.change_cwd(path) as new_cwd:
+            with os_helper.change_cwd(path) as new_cwd:
                 raise Exception("should not get here")
 
-        with support.temp_dir() as parent_dir:
+        with os_helper.temp_dir() as parent_dir:
             non_existent_dir = os.path.join(parent_dir, 'does_not_exist')
             self.assertRaises(FileNotFoundError, call_change_cwd,
                               non_existent_dir)
@@ -220,10 +254,10 @@
         """Test passing a non-existent directory with quiet=True."""
         original_cwd = os.getcwd()
 
-        with support.temp_dir() as parent_dir:
+        with os_helper.temp_dir() as parent_dir:
             bad_dir = os.path.join(parent_dir, 'does_not_exist')
-            with support.check_warnings() as recorder:
-                with support.change_cwd(bad_dir, quiet=True) as new_cwd:
+            with warnings_helper.check_warnings() as recorder:
+                with os_helper.change_cwd(bad_dir, quiet=True) as new_cwd:
                     self.assertEqual(new_cwd, original_cwd)
                     self.assertEqual(os.getcwd(), new_cwd)
                 warnings = [str(w.message) for w in recorder.warnings]
@@ -240,8 +274,8 @@
     def test_change_cwd__chdir_warning(self):
         """Check the warning message when os.chdir() fails."""
         path = TESTFN + '_does_not_exist'
-        with support.check_warnings() as recorder:
-            with support.change_cwd(path=path, quiet=True):
+        with warnings_helper.check_warnings() as recorder:
+            with os_helper.change_cwd(path=path, quiet=True):
                 pass
             messages = [str(w.message) for w in recorder.warnings]
 
@@ -256,7 +290,7 @@
 
     def test_temp_cwd(self):
         here = os.getcwd()
-        with support.temp_cwd(name=TESTFN):
+        with os_helper.temp_cwd(name=TESTFN):
             self.assertEqual(os.path.basename(os.getcwd()), TESTFN)
         self.assertFalse(os.path.exists(TESTFN))
         self.assertEqual(os.getcwd(), here)
@@ -265,7 +299,7 @@
     def test_temp_cwd__name_none(self):
         """Test passing None to temp_cwd()."""
         original_cwd = os.getcwd()
-        with support.temp_cwd(name=None) as new_cwd:
+        with os_helper.temp_cwd(name=None) as new_cwd:
             self.assertNotEqual(new_cwd, original_cwd)
             self.assertTrue(os.path.isdir(new_cwd))
             self.assertEqual(os.getcwd(), new_cwd)
@@ -275,7 +309,7 @@
         self.assertEqual(support.sortdict({3:3, 2:2, 1:1}), "{1: 1, 2: 2, 3: 3}")
 
     def test_make_bad_fd(self):
-        fd = support.make_bad_fd()
+        fd = os_helper.make_bad_fd()
         with self.assertRaises(OSError) as cm:
             os.write(fd, b"foo")
         self.assertEqual(cm.exception.errno, errno.EBADF)
@@ -287,11 +321,11 @@
 
     def test_CleanImport(self):
         import importlib
-        with support.CleanImport("asyncore"):
-            importlib.import_module("asyncore")
+        with import_helper.CleanImport("pprint"):
+            importlib.import_module("pprint")
 
     def test_DirsOnSysPath(self):
-        with support.DirsOnSysPath('foo', 'bar'):
+        with import_helper.DirsOnSysPath('foo', 'bar'):
             self.assertIn("foo", sys.path)
             self.assertIn("bar", sys.path)
         self.assertNotIn("foo", sys.path)
@@ -386,14 +420,14 @@
 
     def test_check__all__(self):
         extra = {'tempdir'}
-        blacklist = {'template'}
+        not_exported = {'template'}
         support.check__all__(self,
                              tempfile,
                              extra=extra,
-                             blacklist=blacklist)
+                             not_exported=not_exported)
 
         extra = {'TextTestResult', 'installHandler'}
-        blacklist = {'load_tests', "TestProgram", "BaseTestSuite"}
+        not_exported = {'load_tests', "TestProgram", "BaseTestSuite"}
 
         support.check__all__(self,
                              unittest,
@@ -402,7 +436,7 @@
                               "unittest.main", "unittest.runner",
                               "unittest.signals", "unittest.async_case"),
                              extra=extra,
-                             blacklist=blacklist)
+                             not_exported=not_exported)
 
         self.assertRaises(AssertionError, support.check__all__, self, unittest)
 
@@ -625,10 +659,10 @@
         # We cannot test the absolute value of fd_count(): on old Linux
         # kernel or glibc versions, os.urandom() keeps a FD open on
         # /dev/urandom device and Python has 4 FD opens instead of 3.
-        start = support.fd_count()
+        start = os_helper.fd_count()
         fd = os.open(__file__, os.O_RDONLY)
         try:
-            more = support.fd_count()
+            more = os_helper.fd_count()
         finally:
             os.close(fd)
         self.assertEqual(more - start, 1)
@@ -660,7 +694,6 @@
     # findfile
     # check_warnings
     # EnvironmentVarGuard
-    # TransientResource
     # transient_internet
     # run_with_locale
     # set_memlimit
@@ -676,9 +709,5 @@
     # SuppressCrashReport
 
 
-def test_main():
-    tests = [TestSupport]
-    support.run_unittest(*tests)
-
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_symbol.py b/Lib/test/test_symbol.py
deleted file mode 100644
index 645d8f4..0000000
--- a/Lib/test/test_symbol.py
+++ /dev/null
@@ -1,58 +0,0 @@
-import unittest
-from test import support
-import os
-import sys
-import sysconfig
-import subprocess
-
-
-SYMBOL_FILE              = support.findfile('symbol.py')
-GEN_SYMBOL_FILE          = os.path.join(os.path.dirname(__file__),
-                                        '..', '..', 'Tools', 'scripts',
-                                        'generate_symbol_py.py')
-GRAMMAR_FILE             = os.path.join(os.path.dirname(__file__),
-                                        '..', '..', 'Include', 'graminit.h')
-TEST_PY_FILE             = 'symbol_test.py'
-
-
-class TestSymbolGeneration(unittest.TestCase):
-
-    def _copy_file_without_generated_symbols(self, source_file, dest_file):
-        with open(source_file) as fp:
-            lines = fp.readlines()
-        with open(dest_file, 'w') as fp:
-            fp.writelines(lines[:lines.index("#--start constants--\n") + 1])
-            fp.writelines(lines[lines.index("#--end constants--\n"):])
-
-    def _generate_symbols(self, grammar_file, target_symbol_py_file):
-        proc = subprocess.Popen([sys.executable,
-                                 GEN_SYMBOL_FILE,
-                                 grammar_file,
-                                 target_symbol_py_file], stderr=subprocess.PIPE)
-        stderr = proc.communicate()[1]
-        return proc.returncode, stderr
-
-    def compare_files(self, file1, file2):
-        with open(file1) as fp:
-            lines1 = fp.readlines()
-        with open(file2) as fp:
-            lines2 = fp.readlines()
-        self.assertEqual(lines1, lines2)
-
-    @unittest.skipUnless(sysconfig.is_python_build(),
-                         'test only works from source build directory')
-    def test_real_grammar_and_symbol_file(self):
-        output = support.TESTFN
-        self.addCleanup(support.unlink, output)
-
-        self._copy_file_without_generated_symbols(SYMBOL_FILE, output)
-
-        exitcode, stderr = self._generate_symbols(GRAMMAR_FILE, output)
-        self.assertEqual(b'', stderr)
-        self.assertEqual(0, exitcode)
-
-        self.compare_files(SYMBOL_FILE, output)
-
-
-if __name__ == "__main__":
-    unittest.main()
diff --git a/Lib/test/test_symtable.py b/Lib/test/test_symtable.py
index 6585071..a30e534 100644
--- a/Lib/test/test_symtable.py
+++ b/Lib/test/test_symtable.py
@@ -67,6 +67,13 @@
         self.assertEqual(self.spam.get_type(), "function")
         self.assertEqual(self.internal.get_type(), "function")
 
+    def test_id(self):
+        self.assertGreater(self.top.get_id(), 0)
+        self.assertGreater(self.Mine.get_id(), 0)
+        self.assertGreater(self.a_method.get_id(), 0)
+        self.assertGreater(self.spam.get_id(), 0)
+        self.assertGreater(self.internal.get_id(), 0)
+
     def test_optimized(self):
         self.assertFalse(self.top.is_optimized())
 
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py
index f0c9c98..09c0d56 100644
--- a/Lib/test/test_syntax.py
+++ b/Lib/test/test_syntax.py
@@ -59,9 +59,17 @@
 Traceback (most recent call last):
 SyntaxError: cannot assign to __debug__
 
+>>> del __debug__
+Traceback (most recent call last):
+SyntaxError: cannot delete __debug__
+
 >>> f() = 1
 Traceback (most recent call last):
-SyntaxError: cannot assign to function call
+SyntaxError: cannot assign to function call here. Maybe you meant '==' instead of '='?
+
+>>> yield = 1
+Traceback (most recent call last):
+SyntaxError: assignment to yield expression not possible
 
 >>> del f()
 Traceback (most recent call last):
@@ -69,7 +77,7 @@
 
 >>> a + 1 = 2
 Traceback (most recent call last):
-SyntaxError: cannot assign to operator
+SyntaxError: cannot assign to expression here. Maybe you meant '==' instead of '='?
 
 >>> (x for x in x) = 1
 Traceback (most recent call last):
@@ -77,19 +85,19 @@
 
 >>> 1 = 1
 Traceback (most recent call last):
-SyntaxError: cannot assign to literal
+SyntaxError: cannot assign to literal here. Maybe you meant '==' instead of '='?
 
 >>> "abc" = 1
 Traceback (most recent call last):
-SyntaxError: cannot assign to literal
+SyntaxError: cannot assign to literal here. Maybe you meant '==' instead of '='?
 
 >>> b"" = 1
 Traceback (most recent call last):
-SyntaxError: cannot assign to literal
+SyntaxError: cannot assign to literal here. Maybe you meant '==' instead of '='?
 
 >>> ... = 1
 Traceback (most recent call last):
-SyntaxError: cannot assign to Ellipsis
+SyntaxError: cannot assign to ellipsis here. Maybe you meant '==' instead of '='?
 
 >>> `1` = 1
 Traceback (most recent call last):
@@ -122,20 +130,40 @@
 
 >>> [a, b, c + 1] = [1, 2, 3]
 Traceback (most recent call last):
-SyntaxError: cannot assign to operator
+SyntaxError: cannot assign to expression
 
 >>> [a, b[1], c + 1] = [1, 2, 3]
 Traceback (most recent call last):
-SyntaxError: cannot assign to operator
+SyntaxError: cannot assign to expression
 
 >>> [a, b.c.d, c + 1] = [1, 2, 3]
 Traceback (most recent call last):
-SyntaxError: cannot assign to operator
+SyntaxError: cannot assign to expression
 
 >>> a if 1 else b = 1
 Traceback (most recent call last):
 SyntaxError: cannot assign to conditional expression
 
+>>> a = 42 if True
+Traceback (most recent call last):
+SyntaxError: expected 'else' after 'if' expression
+
+>>> a = (42 if True)
+Traceback (most recent call last):
+SyntaxError: expected 'else' after 'if' expression
+
+>>> a = [1, 42 if True, 4]
+Traceback (most recent call last):
+SyntaxError: expected 'else' after 'if' expression
+
+>>> if True:
+...     print("Hello"
+...
+... if 2:
+...    print(123))
+Traceback (most recent call last):
+SyntaxError: invalid syntax
+
 >>> True = True = 3
 Traceback (most recent call last):
 SyntaxError: cannot assign to True
@@ -177,7 +205,7 @@
 
 >>> for (*a, b, c+1) in b: pass
 Traceback (most recent call last):
-SyntaxError: cannot assign to operator
+SyntaxError: cannot assign to expression
 
 >>> for (x, *(y, z.d())) in b: pass
 Traceback (most recent call last):
@@ -187,6 +215,10 @@
 Traceback (most recent call last):
 SyntaxError: cannot assign to function call
 
+>>> for a, b, (c + 1, d()): pass
+Traceback (most recent call last):
+SyntaxError: cannot assign to expression
+
 >>> for i < (): pass
 Traceback (most recent call last):
 SyntaxError: invalid syntax
@@ -209,7 +241,7 @@
 
 >>> with a as (*b, c, d+1): pass
 Traceback (most recent call last):
-SyntaxError: cannot assign to operator
+SyntaxError: cannot assign to expression
 
 >>> with a as (x, *(y, z.d())): pass
 Traceback (most recent call last):
@@ -221,12 +253,75 @@
 
 >>> with a as b
 Traceback (most recent call last):
-SyntaxError: invalid syntax
+SyntaxError: expected ':'
 
 >>> p = p =
 Traceback (most recent call last):
 SyntaxError: invalid syntax
 
+Comprehensions creating tuples without parentheses
+should produce a specialized error message:
+
+>>> [x,y for x,y in range(100)]
+Traceback (most recent call last):
+SyntaxError: did you forget parentheses around the comprehension target?
+
+>>> {x,y for x,y in range(100)}
+Traceback (most recent call last):
+SyntaxError: did you forget parentheses around the comprehension target?
+
+# Missing commas in literals collections should not
+# produce special error messages regarding missing
+# parentheses, but about missing commas instead
+
+>>> [1, 2 3]
+Traceback (most recent call last):
+SyntaxError: invalid syntax. Perhaps you forgot a comma?
+
+>>> {1, 2 3}
+Traceback (most recent call last):
+SyntaxError: invalid syntax. Perhaps you forgot a comma?
+
+>>> {1:2, 2:5 3:12}
+Traceback (most recent call last):
+SyntaxError: invalid syntax. Perhaps you forgot a comma?
+
+>>> (1, 2 3)
+Traceback (most recent call last):
+SyntaxError: invalid syntax. Perhaps you forgot a comma?
+
+# Make sure soft keywords constructs don't raise specialized
+# errors regarding missing commas or other spezialiced errors
+
+>>> match x:
+...     y = 3
+Traceback (most recent call last):
+SyntaxError: invalid syntax
+
+>>> match x:
+...     case y:
+...        3 $ 3
+Traceback (most recent call last):
+SyntaxError: invalid syntax
+
+>>> match x:
+...     case $:
+...        ...
+Traceback (most recent call last):
+SyntaxError: invalid syntax
+
+>>> match ...:
+...     case {**rest, "key": value}:
+...        ...
+Traceback (most recent call last):
+SyntaxError: invalid syntax
+
+>>> match ...:
+...     case {**_}:
+...        ...
+Traceback (most recent call last):
+SyntaxError: invalid syntax
+
 From compiler_complex_args():
 
 >>> def f(None=1):
@@ -308,7 +403,7 @@
 >>> class C(x for x in L):
 ...     pass
 Traceback (most recent call last):
-SyntaxError: invalid syntax
+SyntaxError: expected ':'
 
 >>> def g(*args, **kwargs):
 ...     print(args, sorted(kwargs.items()))
@@ -405,28 +500,39 @@
 ...   290, 291, 292, 293, 294, 295, 296, 297, 298, 299)  # doctest: +ELLIPSIS
 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ..., 297, 298, 299)
 
-# >>> f(lambda x: x[0] = 3)
-# Traceback (most recent call last):
-# SyntaxError: expression cannot contain assignment, perhaps you meant "=="?
+>>> f(lambda x: x[0] = 3)
+Traceback (most recent call last):
+SyntaxError: expression cannot contain assignment, perhaps you meant "=="?
+
+# Check that this error doesn't trigger for names:
+>>> f(a={x: for x in {}})
+Traceback (most recent call last):
+SyntaxError: invalid syntax
 
 The grammar accepts any test (basically, any expression) in the
 keyword slot of a call site.  Test a few different options.
 
-# >>> f(x()=2)
-# Traceback (most recent call last):
-# SyntaxError: expression cannot contain assignment, perhaps you meant "=="?
-# >>> f(a or b=1)
-# Traceback (most recent call last):
-# SyntaxError: expression cannot contain assignment, perhaps you meant "=="?
-# >>> f(x.y=1)
-# Traceback (most recent call last):
-# SyntaxError: expression cannot contain assignment, perhaps you meant "=="?
-# >>> f((x)=2)
-# Traceback (most recent call last):
-# SyntaxError: expression cannot contain assignment, perhaps you meant "=="?
-# >>> f(True=2)
-# Traceback (most recent call last):
-# SyntaxError: cannot assign to True
+>>> f(x()=2)
+Traceback (most recent call last):
+SyntaxError: expression cannot contain assignment, perhaps you meant "=="?
+>>> f(a or b=1)
+Traceback (most recent call last):
+SyntaxError: expression cannot contain assignment, perhaps you meant "=="?
+>>> f(x.y=1)
+Traceback (most recent call last):
+SyntaxError: expression cannot contain assignment, perhaps you meant "=="?
+>>> f((x)=2)
+Traceback (most recent call last):
+SyntaxError: expression cannot contain assignment, perhaps you meant "=="?
+>>> f(True=1)
+Traceback (most recent call last):
+SyntaxError: cannot assign to True
+>>> f(False=1)
+Traceback (most recent call last):
+SyntaxError: cannot assign to False
+>>> f(None=1)
+Traceback (most recent call last):
+SyntaxError: cannot assign to None
 >>> f(__debug__=1)
 Traceback (most recent call last):
 SyntaxError: cannot assign to __debug__
@@ -529,38 +635,6 @@
      ...
    SyntaxError: 'break' outside loop
 
-This raises a SyntaxError, it used to raise a SystemError.
-Context for this change can be found on issue #27514
-
-In 2.5 there was a missing exception and an assert was triggered in a debug
-build.  The number of blocks must be greater than CO_MAXBLOCKS.  SF #1565514
-
-   >>> while 1:
-   ...  while 2:
-   ...   while 3:
-   ...    while 4:
-   ...     while 5:
-   ...      while 6:
-   ...       while 8:
-   ...        while 9:
-   ...         while 10:
-   ...          while 11:
-   ...           while 12:
-   ...            while 13:
-   ...             while 14:
-   ...              while 15:
-   ...               while 16:
-   ...                while 17:
-   ...                 while 18:
-   ...                  while 19:
-   ...                   while 20:
-   ...                    while 21:
-   ...                     while 22:
-   ...                      break
-   Traceback (most recent call last):
-     ...
-   SyntaxError: too many statically nested blocks
-
 Misuse of the nonlocal and global statement can lead to a few unique syntax errors.
 
    >>> def f():
@@ -645,7 +719,7 @@
    ...   pass
    Traceback (most recent call last):
      ...
-   SyntaxError: cannot assign to function call
+   SyntaxError: cannot assign to function call here. Maybe you meant '==' instead of '='?
 
    >>> if 1:
    ...   pass
@@ -653,7 +727,7 @@
    ...   x() = 1
    Traceback (most recent call last):
      ...
-   SyntaxError: cannot assign to function call
+   SyntaxError: cannot assign to function call here. Maybe you meant '==' instead of '='?
 
    >>> if 1:
    ...   x() = 1
@@ -663,7 +737,7 @@
    ...   pass
    Traceback (most recent call last):
      ...
-   SyntaxError: cannot assign to function call
+   SyntaxError: cannot assign to function call here. Maybe you meant '==' instead of '='?
 
    >>> if 1:
    ...   pass
@@ -673,7 +747,7 @@
    ...   pass
    Traceback (most recent call last):
      ...
-   SyntaxError: cannot assign to function call
+   SyntaxError: cannot assign to function call here. Maybe you meant '==' instead of '='?
 
    >>> if 1:
    ...   pass
@@ -683,7 +757,335 @@
    ...   x() = 1
    Traceback (most recent call last):
      ...
-   SyntaxError: cannot assign to function call
+   SyntaxError: cannot assign to function call here. Maybe you meant '==' instead of '='?
+
+    Missing ':' before suites:
+
+    >>> def f()
+    ...     pass
+    Traceback (most recent call last):
+    SyntaxError: expected ':'
+
+    >>> class A
+    ...     pass
+    Traceback (most recent call last):
+    SyntaxError: expected ':'
+
+   >>> if 1
+   ...   pass
+   ... elif 1:
+   ...   pass
+   ... else:
+   ...   x() = 1
+   Traceback (most recent call last):
+   SyntaxError: expected ':'
+
+   >>> if 1:
+   ...   pass
+   ... elif 1
+   ...   pass
+   ... else:
+   ...   x() = 1
+   Traceback (most recent call last):
+   SyntaxError: expected ':'
+
+   >>> if 1:
+   ...   pass
+   ... elif 1:
+   ...   pass
+   ... else
+   ...   x() = 1
+   Traceback (most recent call last):
+   SyntaxError: expected ':'
+
+   >>> for x in range(10)
+   ...   pass
+   Traceback (most recent call last):
+   SyntaxError: expected ':'
+
+   >>> while True
+   ...   pass
+   Traceback (most recent call last):
+   SyntaxError: expected ':'
+
+   >>> with blech as something
+   ...   pass
+   Traceback (most recent call last):
+   SyntaxError: expected ':'
+
+   >>> with blech
+   ...   pass
+   Traceback (most recent call last):
+   SyntaxError: expected ':'
+
+   >>> with blech, block as something
+   ...   pass
+   Traceback (most recent call last):
+   SyntaxError: expected ':'
+
+   >>> with blech, block as something, bluch
+   ...   pass
+   Traceback (most recent call last):
+   SyntaxError: expected ':'
+
+   >>> with (blech as something)
+   ...   pass
+   Traceback (most recent call last):
+   SyntaxError: expected ':'
+
+   >>> with (blech)
+   ...   pass
+   Traceback (most recent call last):
+   SyntaxError: expected ':'
+
+   >>> with (blech, block as something)
+   ...   pass
+   Traceback (most recent call last):
+   SyntaxError: expected ':'
+
+   >>> with (blech, block as something, bluch)
+   ...   pass
+   Traceback (most recent call last):
+   SyntaxError: expected ':'
+
+   >>> try
+   ...   pass
+   Traceback (most recent call last):
+   SyntaxError: expected ':'
+
+   >>> try:
+   ...   pass
+   ... except
+   ...   pass
+   Traceback (most recent call last):
+   SyntaxError: expected ':'
+
+   >>> match x
+   ...   case list():
+   ...       pass
+   Traceback (most recent call last):
+   SyntaxError: expected ':'
+
+   >>> match x:
+   ...   case list()
+   ...       pass
+   Traceback (most recent call last):
+   SyntaxError: expected ':'
+
+   >>> match x:
+   ...   case [y] if y > 0
+   ...       pass
+   Traceback (most recent call last):
+   SyntaxError: expected ':'
+
+   >>> if x = 3:
+   ...    pass
+   Traceback (most recent call last):
+   SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
+
+   >>> while x = 3:
+   ...    pass
+   Traceback (most recent call last):
+   SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
+
+   >>> if x.a = 3:
+   ...    pass
+   Traceback (most recent call last):
+   SyntaxError: cannot assign to attribute here. Maybe you meant '==' instead of '='?
+
+   >>> while x.a = 3:
+   ...    pass
+   Traceback (most recent call last):
+   SyntaxError: cannot assign to attribute here. Maybe you meant '==' instead of '='?
+
+Custom error messages for try blocks that are not followed by except/finally
+
+   >>> try:
+   ...    x = 34
+   ...
+   Traceback (most recent call last):
+   SyntaxError: expected 'except' or 'finally' block
+
+Ensure that early = are not matched by the parser as invalid comparisons
+   >>> f(2, 4, x=34); 1 $ 2
+   Traceback (most recent call last):
+   SyntaxError: invalid syntax
+
+   >>> dict(x=34); x $ y
+   Traceback (most recent call last):
+   SyntaxError: invalid syntax
+
+   >>> dict(x=34, (x for x in range 10), 1); x $ y
+   Traceback (most recent call last):
+   SyntaxError: invalid syntax
+
+   >>> dict(x=34, x=1, y=2); x $ y
+   Traceback (most recent call last):
+   SyntaxError: invalid syntax
+
+Incomplete dictionary literals
+
+   >>> {1:2, 3:4, 5}
+   Traceback (most recent call last):
+   SyntaxError: ':' expected after dictionary key
+
+   >>> {1:2, 3:4, 5:}
+   Traceback (most recent call last):
+   SyntaxError: expression expected after dictionary key and ':'
+
+   >>> {1: *12+1, 23: 1}
+   Traceback (most recent call last):
+   SyntaxError: cannot use a starred expression in a dictionary value
+
+   >>> {1: *12+1}
+   Traceback (most recent call last):
+   SyntaxError: cannot use a starred expression in a dictionary value
+
+   >>> {1: 23, 1: *12+1}
+   Traceback (most recent call last):
+   SyntaxError: cannot use a starred expression in a dictionary value
+
+   >>> {1:}
+   Traceback (most recent call last):
+   SyntaxError: expression expected after dictionary key and ':'
+
+   # Ensure that the error is not raise for syntax errors that happen after sets
+
+   >>> {1} $
+   Traceback (most recent call last):
+   SyntaxError: invalid syntax
+
+Specialized indentation errors:
+
+   >>> while condition:
+   ... pass
+   Traceback (most recent call last):
+   IndentationError: expected an indented block after 'while' statement on line 1
+
+   >>> for x in range(10):
+   ... pass
+   Traceback (most recent call last):
+   IndentationError: expected an indented block after 'for' statement on line 1
+
+   >>> for x in range(10):
+   ...     pass
+   ... else:
+   ... pass
+   Traceback (most recent call last):
+   IndentationError: expected an indented block after 'else' statement on line 3
+
+   >>> async for x in range(10):
+   ... pass
+   Traceback (most recent call last):
+   IndentationError: expected an indented block after 'for' statement on line 1
+
+   >>> async for x in range(10):
+   ...     pass
+   ... else:
+   ... pass
+   Traceback (most recent call last):
+   IndentationError: expected an indented block after 'else' statement on line 3
+
+   >>> if something:
+   ... pass
+   Traceback (most recent call last):
+   IndentationError: expected an indented block after 'if' statement on line 1
+
+   >>> if something:
+   ...     pass
+   ... elif something_else:
+   ... pass
+   Traceback (most recent call last):
+   IndentationError: expected an indented block after 'elif' statement on line 3
+
+   >>> if something:
+   ...     pass
+   ... elif something_else:
+   ...     pass
+   ... else:
+   ... pass
+   Traceback (most recent call last):
+   IndentationError: expected an indented block after 'else' statement on line 5
+
+   >>> try:
+   ... pass
+   Traceback (most recent call last):
+   IndentationError: expected an indented block after 'try' statement on line 1
+
+   >>> try:
+   ...     something()
+   ... except A:
+   ... pass
+   Traceback (most recent call last):
+   IndentationError: expected an indented block after 'except' statement on line 3
+
+   >>> try:
+   ...     something()
+   ... except A:
+   ...     pass
+   ... finally:
+   ... pass
+   Traceback (most recent call last):
+   IndentationError: expected an indented block after 'finally' statement on line 5
+
+   >>> with A:
+   ... pass
+   Traceback (most recent call last):
+   IndentationError: expected an indented block after 'with' statement on line 1
+
+   >>> with A as a, B as b:
+   ... pass
+   Traceback (most recent call last):
+   IndentationError: expected an indented block after 'with' statement on line 1
+
+   >>> with (A as a, B as b):
+   ... pass
+   Traceback (most recent call last):
+   IndentationError: expected an indented block after 'with' statement on line 1
+
+   >>> async with A:
+   ... pass
+   Traceback (most recent call last):
+   IndentationError: expected an indented block after 'with' statement on line 1
+
+   >>> async with A as a, B as b:
+   ... pass
+   Traceback (most recent call last):
+   IndentationError: expected an indented block after 'with' statement on line 1
+
+   >>> async with (A as a, B as b):
+   ... pass
+   Traceback (most recent call last):
+   IndentationError: expected an indented block after 'with' statement on line 1
+
+   >>> def foo(x, /, y, *, z=2):
+   ... pass
+   Traceback (most recent call last):
+   IndentationError: expected an indented block after function definition on line 1
+
+   >>> class Blech(A):
+   ... pass
+   Traceback (most recent call last):
+   IndentationError: expected an indented block after class definition on line 1
+
+   >>> match something:
+   ... pass
+   Traceback (most recent call last):
+   IndentationError: expected an indented block after 'match' statement on line 1
+
+   >>> match something:
+   ...     case []:
+   ... pass
+   Traceback (most recent call last):
+   IndentationError: expected an indented block after 'case' statement on line 2
+
+   >>> match something:
+   ...     case []:
+   ...         ...
+   ...     case {}:
+   ... pass
+   Traceback (most recent call last):
+   IndentationError: expected an indented block after 'case' statement on line 4
 
 Make sure that the old "raise X, Y[, Z]" form is gone:
    >>> raise X, Y
@@ -695,6 +1097,39 @@
      ...
    SyntaxError: invalid syntax
 
+Check that an multiple exception types with missing parentheses
+raise a custom exception
+
+   >>> try:
+   ...   pass
+   ... except A, B:
+   ...   pass
+   Traceback (most recent call last):
+   SyntaxError: multiple exception types must be parenthesized
+
+   >>> try:
+   ...   pass
+   ... except A, B, C:
+   ...   pass
+   Traceback (most recent call last):
+   SyntaxError: multiple exception types must be parenthesized
+
+   >>> try:
+   ...   pass
+   ... except A, B, C as blech:
+   ...   pass
+   Traceback (most recent call last):
+   SyntaxError: multiple exception types must be parenthesized
+
+   >>> try:
+   ...   pass
+   ... except A, B, C as blech:
+   ...   pass
+   ... finally:
+   ...   pass
+   Traceback (most recent call last):
+   SyntaxError: multiple exception types must be parenthesized
+
 
 >>> f(a=23, a=234)
 Traceback (most recent call last):
@@ -703,19 +1138,39 @@
 
 >>> {1, 2, 3} = 42
 Traceback (most recent call last):
-SyntaxError: cannot assign to set display
+SyntaxError: cannot assign to set display here. Maybe you meant '==' instead of '='?
 
 >>> {1: 2, 3: 4} = 42
 Traceback (most recent call last):
-SyntaxError: cannot assign to dict display
+SyntaxError: cannot assign to dict literal here. Maybe you meant '==' instead of '='?
 
 >>> f'{x}' = 42
 Traceback (most recent call last):
-SyntaxError: cannot assign to f-string expression
+SyntaxError: cannot assign to f-string expression here. Maybe you meant '==' instead of '='?
 
 >>> f'{x}-{y}' = 42
 Traceback (most recent call last):
-SyntaxError: cannot assign to f-string expression
+SyntaxError: cannot assign to f-string expression here. Maybe you meant '==' instead of '='?
+
+>>> (x, y, z=3, d, e)
+Traceback (most recent call last):
+SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
+
+>>> [x, y, z=3, d, e]
+Traceback (most recent call last):
+SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
+
+>>> [z=3]
+Traceback (most recent call last):
+SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
+
+>>> {x, y, z=3, d, e}
+Traceback (most recent call last):
+SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
+
+>>> {z=3}
+Traceback (most recent call last):
+SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
 
 >>> from t import x,
 Traceback (most recent call last):
@@ -725,6 +1180,13 @@
 Traceback (most recent call last):
 SyntaxError: trailing comma not allowed without surrounding parentheses
 
+# Check that we dont raise the "trailing comma" error if there is more
+# input to the left of the valid part that we parsed.
+
+>>> from t import x,y, and 3
+Traceback (most recent call last):
+SyntaxError: invalid syntax
+
 >>> (): int
 Traceback (most recent call last):
 SyntaxError: only single target (not tuple) can be annotated
@@ -769,6 +1231,44 @@
     >>> import ä £
     Traceback (most recent call last):
     SyntaxError: invalid character '£' (U+00A3)
+
+  Invalid pattern matching constructs:
+
+    >>> match ...:
+    ...   case 42 as _:
+    ...     ...
+    Traceback (most recent call last):
+    SyntaxError: cannot use '_' as a target
+
+    >>> match ...:
+    ...   case 42 as 1+2+4:
+    ...     ...
+    Traceback (most recent call last):
+    SyntaxError: invalid pattern target
+
+    >>> match ...:
+    ...   case Foo(z=1, y=2, x):
+    ...     ...
+    Traceback (most recent call last):
+    SyntaxError: positional patterns follow keyword patterns
+
+    >>> match ...:
+    ...   case Foo(a, z=1, y=2, x):
+    ...     ...
+    Traceback (most recent call last):
+    SyntaxError: positional patterns follow keyword patterns
+
+    >>> match ...:
+    ...   case Foo(z=1, x, y=2):
+    ...     ...
+    Traceback (most recent call last):
+    SyntaxError: positional patterns follow keyword patterns
+
+    >>> match ...:
+    ...   case C(a=b, c, d=e, f, g=h, i, j=k, ...):
+    ...     ...
+    Traceback (most recent call last):
+    SyntaxError: positional patterns follow keyword patterns
 """
 
 import re
@@ -779,7 +1279,8 @@
 class SyntaxTestCase(unittest.TestCase):
 
     def _check_error(self, code, errtext,
-                     filename="<testcase>", mode="exec", subclass=None, lineno=None, offset=None):
+                     filename="<testcase>", mode="exec", subclass=None,
+                     lineno=None, offset=None, end_lineno=None, end_offset=None):
         """Check that compiling code raises SyntaxError with errtext.
 
         errtest is a regular expression that must be present in the
@@ -799,43 +1300,54 @@
                 self.assertEqual(err.lineno, lineno)
             if offset is not None:
                 self.assertEqual(err.offset, offset)
+            if end_lineno is not None:
+                self.assertEqual(err.end_lineno, end_lineno)
+            if end_offset is not None:
+                self.assertEqual(err.end_offset, end_offset)
+
         else:
             self.fail("compile() did not raise SyntaxError")
 
+    def test_expression_with_assignment(self):
+        self._check_error(
+            "print(end1 + end2 = ' ')",
+            'expression cannot contain assignment, perhaps you meant "=="?',
+            offset=7
+        )
+
     def test_curly_brace_after_primary_raises_immediately(self):
-        self._check_error("f{", "invalid syntax", mode="single")
+        self._check_error("f{}", "invalid syntax", mode="single")
 
     def test_assign_call(self):
         self._check_error("f() = 1", "assign")
 
-    @unittest.skipIf(support.use_old_parser(), "The old parser cannot generate these error messages")
     def test_assign_del(self):
         self._check_error("del (,)", "invalid syntax")
-        self._check_error("del 1", "delete literal")
-        self._check_error("del (1, 2)", "delete literal")
-        self._check_error("del None", "delete None")
-        self._check_error("del *x", "delete starred")
-        self._check_error("del (*x)", "use starred expression")
-        self._check_error("del (*x,)", "delete starred")
-        self._check_error("del [*x,]", "delete starred")
-        self._check_error("del f()", "delete function call")
-        self._check_error("del f(a, b)", "delete function call")
-        self._check_error("del o.f()", "delete function call")
-        self._check_error("del a[0]()", "delete function call")
-        self._check_error("del x, f()", "delete function call")
-        self._check_error("del f(), x", "delete function call")
-        self._check_error("del [a, b, ((c), (d,), e.f())]", "delete function call")
-        self._check_error("del (a if True else b)", "delete conditional")
-        self._check_error("del +a", "delete operator")
-        self._check_error("del a, +b", "delete operator")
-        self._check_error("del a + b", "delete operator")
-        self._check_error("del (a + b, c)", "delete operator")
-        self._check_error("del (c[0], a + b)", "delete operator")
-        self._check_error("del a.b.c + 2", "delete operator")
-        self._check_error("del a.b.c[0] + 2", "delete operator")
-        self._check_error("del (a, b, (c, d.e.f + 2))", "delete operator")
-        self._check_error("del [a, b, (c, d.e.f[0] + 2)]", "delete operator")
-        self._check_error("del (a := 5)", "delete named expression")
+        self._check_error("del 1", "cannot delete literal")
+        self._check_error("del (1, 2)", "cannot delete literal")
+        self._check_error("del None", "cannot delete None")
+        self._check_error("del *x", "cannot delete starred")
+        self._check_error("del (*x)", "cannot use starred expression")
+        self._check_error("del (*x,)", "cannot delete starred")
+        self._check_error("del [*x,]", "cannot delete starred")
+        self._check_error("del f()", "cannot delete function call")
+        self._check_error("del f(a, b)", "cannot delete function call")
+        self._check_error("del o.f()", "cannot delete function call")
+        self._check_error("del a[0]()", "cannot delete function call")
+        self._check_error("del x, f()", "cannot delete function call")
+        self._check_error("del f(), x", "cannot delete function call")
+        self._check_error("del [a, b, ((c), (d,), e.f())]", "cannot delete function call")
+        self._check_error("del (a if True else b)", "cannot delete conditional")
+        self._check_error("del +a", "cannot delete expression")
+        self._check_error("del a, +b", "cannot delete expression")
+        self._check_error("del a + b", "cannot delete expression")
+        self._check_error("del (a + b, c)", "cannot delete expression")
+        self._check_error("del (c[0], a + b)", "cannot delete expression")
+        self._check_error("del a.b.c + 2", "cannot delete expression")
+        self._check_error("del a.b.c[0] + 2", "cannot delete expression")
+        self._check_error("del (a, b, (c, d.e.f + 2))", "cannot delete expression")
+        self._check_error("del [a, b, (c, d.e.f[0] + 2)]", "cannot delete expression")
+        self._check_error("del (a := 5)", "cannot delete named expression")
         # We don't have a special message for this, but make sure we don't
         # report "cannot delete name"
         self._check_error("del a += b", "invalid syntax")
@@ -933,6 +1445,11 @@
                           "iterable argument unpacking follows "
                           "keyword argument unpacking")
 
+    def test_generator_in_function_call(self):
+        self._check_error("foo(x,    y for y in range(3) for z in range(2) if z    , p)",
+                          "Generator expression must be parenthesized",
+                          lineno=1, end_lineno=1, offset=11, end_offset=53)
+
     def test_empty_line_after_linecont(self):
         # See issue-40847
         s = r"""\
@@ -946,6 +1463,36 @@
         except SyntaxError:
             self.fail("Empty line after a line continuation character is valid.")
 
+        # See issue-46091
+        s1 = r"""\
+def fib(n):
+    \
+'''Print a Fibonacci series up to n.'''
+    \
+a, b = 0, 1
+"""
+        s2 = r"""\
+def fib(n):
+    '''Print a Fibonacci series up to n.'''
+    a, b = 0, 1
+"""
+        try:
+            self.assertEqual(compile(s1, '<string>', 'exec'), compile(s2, '<string>', 'exec'))
+        except SyntaxError:
+            self.fail("Indented statement over multiple lines is valid")
+    
+    def test_continuation_bad_indentation(self): 
+        # Check that code that breaks indentation across multiple lines raises a syntax error
+
+        code = r"""\
+if x:
+    y = 1
+  \
+  foo = 1
+        """
+
+        self.assertRaises(IndentationError, exec, code)
+
     @support.cpython_only
     def test_nested_named_except_blocks(self):
         code = ""
@@ -971,7 +1518,18 @@
     finally:
         pass
 """
-        self._check_error(code, "invalid syntax")
+        self._check_error(code, "expected ':'")
+
+    def test_invalid_line_continuation_error_position(self):
+        self._check_error(r"a = 3 \ 4",
+                          "unexpected character after line continuation character",
+                          lineno=1, offset=8)
+        self._check_error('1,\\#\n2',
+                          "unexpected character after line continuation character",
+                          lineno=1, offset=4)
+        self._check_error('\nfgdfgf\n1,\\#\n2\n',
+                          "unexpected character after line continuation character",
+                          lineno=3, offset=4)
 
     def test_invalid_line_continuation_left_recursive(self):
         # Check bpo-42218: SyntaxErrors following left-recursive rules
@@ -981,6 +1539,93 @@
         self._check_error("A.\u03bc\\\n",
                           "unexpected EOF while parsing")
 
+    def test_error_parenthesis(self):
+        for paren in "([{":
+            self._check_error(paren + "1 + 2", f"\\{paren}' was never closed")
+
+        for paren in "([{":
+            self._check_error(f"a = {paren} 1, 2, 3\nb=3", f"\\{paren}' was never closed")
+
+        for paren in ")]}":
+            self._check_error(paren + "1 + 2", f"unmatched '\\{paren}'")
+
+    def test_match_call_does_not_raise_syntax_error(self):
+        code = """
+def match(x):
+    return 1+1
+
+match(34)
+"""
+        compile(code, "<string>", "exec")
+
+    def test_case_call_does_not_raise_syntax_error(self):
+        code = """
+def case(x):
+    return 1+1
+
+case(34)
+"""
+        compile(code, "<string>", "exec")
+
+    def test_multiline_compiler_error_points_to_the_end(self):
+        self._check_error(
+            "call(\na=1,\na=1\n)",
+            "keyword argument repeated",
+            lineno=3
+        )
+
+    @support.cpython_only
+    def test_syntax_error_on_deeply_nested_blocks(self):
+        # This raises a SyntaxError, it used to raise a SystemError. Context
+        # for this change can be found on issue #27514
+
+        # In 2.5 there was a missing exception and an assert was triggered in a
+        # debug build.  The number of blocks must be greater than CO_MAXBLOCKS.
+        # SF #1565514
+
+        source = """
+while 1:
+ while 2:
+  while 3:
+   while 4:
+    while 5:
+     while 6:
+      while 8:
+       while 9:
+        while 10:
+         while 11:
+          while 12:
+           while 13:
+            while 14:
+             while 15:
+              while 16:
+               while 17:
+                while 18:
+                 while 19:
+                  while 20:
+                   while 21:
+                    while 22:
+                     break
+"""
+        self._check_error(source, "too many statically nested blocks")
+
+    @support.cpython_only
+    def test_error_on_parser_stack_overflow(self):
+        source = "-" * 100000 + "4"
+        for mode in ["exec", "eval", "single"]:
+            with self.subTest(mode=mode):
+                with self.assertRaises(MemoryError):
+                    compile(source, "<string>", mode)
+
+    @support.cpython_only
+    def test_deep_invalid_rule(self):
+        # Check that a very deep invalid rule in the PEG
+        # parser doesn't have exponential backtracking.
+        source = "d{{{{{{{{{{{{{{{{{{{{{{{{{```{{{{{{{ef f():y"
+        with self.assertRaises(SyntaxError):
+            compile(source, "<string>", "exec")
+
+
 def test_main():
     support.run_unittest(SyntaxTestCase)
     from test import test_syntax
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index d791513..35da72c 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -1,5 +1,3 @@
-from test import support
-from test.support.script_helper import assert_python_ok, assert_python_failure
 import builtins
 import codecs
 import gc
@@ -11,6 +9,10 @@
 import sys
 import sysconfig
 import test.support
+from test import support
+from test.support import os_helper
+from test.support.script_helper import assert_python_ok, assert_python_failure
+from test.support import threading_helper
 import textwrap
 import unittest
 import warnings
@@ -219,7 +221,7 @@
         def f():
             f()
         try:
-            for depth in (10, 25, 50, 75, 100, 250, 1000):
+            for depth in (50, 75, 100, 250, 1000):
                 try:
                     sys.setrecursionlimit(depth)
                 except RecursionError:
@@ -229,17 +231,17 @@
 
                 # Issue #5392: test stack overflow after hitting recursion
                 # limit twice
-                self.assertRaises(RecursionError, f)
-                self.assertRaises(RecursionError, f)
+                with self.assertRaises(RecursionError):
+                    f()
+                with self.assertRaises(RecursionError):
+                    f()
         finally:
             sys.setrecursionlimit(oldlimit)
 
     @test.support.cpython_only
     def test_setrecursionlimit_recursion_depth(self):
         # Issue #25274: Setting a low recursion limit must be blocked if the
-        # current recursion depth is already higher than the "lower-water
-        # mark". Otherwise, it may not be possible anymore to
-        # reset the overflowed flag to 0.
+        # current recursion depth is already higher than limit.
 
         from _testinternalcapi import get_recursion_depth
 
@@ -260,42 +262,10 @@
             sys.setrecursionlimit(1000)
 
             for limit in (10, 25, 50, 75, 100, 150, 200):
-                # formula extracted from _Py_RecursionLimitLowerWaterMark()
-                if limit > 200:
-                    depth = limit - 50
-                else:
-                    depth = limit * 3 // 4
-                set_recursion_limit_at_depth(depth, limit)
+                set_recursion_limit_at_depth(limit, limit)
         finally:
             sys.setrecursionlimit(oldlimit)
 
-    # The error message is specific to CPython
-    @test.support.cpython_only
-    def test_recursionlimit_fatalerror(self):
-        # A fatal error occurs if a second recursion limit is hit when recovering
-        # from a first one.
-        code = textwrap.dedent("""
-            import sys
-
-            def f():
-                try:
-                    f()
-                except RecursionError:
-                    f()
-
-            sys.setrecursionlimit(%d)
-            f()""")
-        with test.support.SuppressCrashReport():
-            for i in (50, 1000):
-                sub = subprocess.Popen([sys.executable, '-c', code % i],
-                    stderr=subprocess.PIPE)
-                err = sub.communicate()[1]
-                self.assertTrue(sub.returncode, sub.returncode)
-                self.assertIn(
-                    b"Fatal Python error: _Py_CheckRecursiveCall: "
-                    b"Cannot recover from stack overflow",
-                    err)
-
     def test_getwindowsversion(self):
         # Raise SkipTest if sys doesn't have getwindowsversion attribute
         test.support.get_attribute(sys, "getwindowsversion")
@@ -365,7 +335,7 @@
         )
 
     # sys._current_frames() is a CPython-only gimmick.
-    @test.support.reap_threads
+    @threading_helper.reap_threads
     def test_current_frames(self):
         import threading
         import traceback
@@ -409,7 +379,7 @@
         self.assertTrue(frame is sys._getframe())
 
         # Verify that the captured thread frame is blocked in g456, called
-        # from f123.  This is a litte tricky, since various bits of
+        # from f123.  This is a little tricky, since various bits of
         # threading.py are also in the thread's call stack.
         frame = d.pop(thread_id)
         stack = traceback.extract_stack(frame)
@@ -430,9 +400,81 @@
         leave_g.set()
         t.join()
 
+    @threading_helper.reap_threads
+    def test_current_exceptions(self):
+        import threading
+        import traceback
+
+        # Spawn a thread that blocks at a known place.  Then the main
+        # thread does sys._current_frames(), and verifies that the frames
+        # returned make sense.
+        entered_g = threading.Event()
+        leave_g = threading.Event()
+        thread_info = []  # the thread's id
+
+        def f123():
+            g456()
+
+        def g456():
+            thread_info.append(threading.get_ident())
+            entered_g.set()
+            while True:
+                try:
+                    raise ValueError("oops")
+                except ValueError:
+                    if leave_g.wait(timeout=support.LONG_TIMEOUT):
+                        break
+
+        t = threading.Thread(target=f123)
+        t.start()
+        entered_g.wait()
+
+        # At this point, t has finished its entered_g.set(), although it's
+        # impossible to guess whether it's still on that line or has moved on
+        # to its leave_g.wait().
+        self.assertEqual(len(thread_info), 1)
+        thread_id = thread_info[0]
+
+        d = sys._current_exceptions()
+        for tid in d:
+            self.assertIsInstance(tid, int)
+            self.assertGreater(tid, 0)
+
+        main_id = threading.get_ident()
+        self.assertIn(main_id, d)
+        self.assertIn(thread_id, d)
+        self.assertEqual((None, None, None), d.pop(main_id))
+
+        # Verify that the captured thread frame is blocked in g456, called
+        # from f123.  This is a little tricky, since various bits of
+        # threading.py are also in the thread's call stack.
+        exc_type, exc_value, exc_tb = d.pop(thread_id)
+        stack = traceback.extract_stack(exc_tb.tb_frame)
+        for i, (filename, lineno, funcname, sourceline) in enumerate(stack):
+            if funcname == "f123":
+                break
+        else:
+            self.fail("didn't find f123() on thread's call stack")
+
+        self.assertEqual(sourceline, "g456()")
+
+        # And the next record must be for g456().
+        filename, lineno, funcname, sourceline = stack[i+1]
+        self.assertEqual(funcname, "g456")
+        self.assertTrue(sourceline.startswith("if leave_g.wait("))
+
+        # Reap the spawned thread.
+        leave_g.set()
+        t.join()
+
     def test_attributes(self):
         self.assertIsInstance(sys.api_version, int)
         self.assertIsInstance(sys.argv, list)
+        for arg in sys.argv:
+            self.assertIsInstance(arg, str)
+        self.assertIsInstance(sys.orig_argv, list)
+        for arg in sys.orig_argv:
+            self.assertIsInstance(arg, str)
         self.assertIn(sys.byteorder, ("little", "big"))
         self.assertIsInstance(sys.builtin_module_names, tuple)
         self.assertIsInstance(sys.copyright, str)
@@ -549,7 +591,8 @@
                  "inspect", "interactive", "optimize",
                  "dont_write_bytecode", "no_user_site", "no_site",
                  "ignore_environment", "verbose", "bytes_warning", "quiet",
-                 "hash_randomization", "isolated", "dev_mode", "utf8_mode")
+                 "hash_randomization", "isolated", "dev_mode", "utf8_mode",
+                 "warn_default_encoding")
         for attr in attrs:
             self.assertTrue(hasattr(sys.flags, attr), attr)
             attr_type = bool if attr == "dev_mode" else int
@@ -562,11 +605,12 @@
     def assert_raise_on_new_sys_type(self, sys_attr):
         # Users are intentionally prevented from creating new instances of
         # sys.flags, sys.version_info, and sys.getwindowsversion.
+        arg = sys_attr
         attr_type = type(sys_attr)
         with self.assertRaises(TypeError):
-            attr_type()
+            attr_type(arg)
         with self.assertRaises(TypeError):
-            attr_type.__new__(attr_type)
+            attr_type.__new__(attr_type, arg)
 
     def test_sys_flags_no_instantiation(self):
         self.assert_raise_on_new_sys_type(sys.flags)
@@ -626,7 +670,7 @@
         out = p.communicate()[0].strip()
         self.assertEqual(out, b'\xbd')
 
-    @unittest.skipUnless(test.support.FS_NONASCII,
+    @unittest.skipUnless(os_helper.FS_NONASCII,
                          'requires OS support of non-ASCII encodings')
     @unittest.skipUnless(sys.getfilesystemencoding() == locale.getpreferredencoding(False),
                          'requires FS encoding to match locale')
@@ -635,10 +679,10 @@
 
         env["PYTHONIOENCODING"] = ""
         p = subprocess.Popen([sys.executable, "-c",
-                                'print(%a)' % test.support.FS_NONASCII],
+                                'print(%a)' % os_helper.FS_NONASCII],
                                 stdout=subprocess.PIPE, env=env)
         out = p.communicate()[0].strip()
-        self.assertEqual(out, os.fsencode(test.support.FS_NONASCII))
+        self.assertEqual(out, os.fsencode(os_helper.FS_NONASCII))
 
     @unittest.skipIf(sys.base_prefix != sys.prefix,
                      'Test is not venv-compatible')
@@ -929,6 +973,26 @@
         out = out.decode('ascii', 'replace').rstrip()
         self.assertEqual(out, 'mbcs replace')
 
+    def test_orig_argv(self):
+        code = textwrap.dedent('''
+            import sys
+            print(sys.argv)
+            print(sys.orig_argv)
+        ''')
+        args = [sys.executable, '-I', '-X', 'utf8', '-c', code, 'arg']
+        proc = subprocess.run(args, check=True, capture_output=True, text=True)
+        expected = [
+            repr(['-c', 'arg']),  # sys.argv
+            repr(args),  # sys.orig_argv
+        ]
+        self.assertEqual(proc.stdout.rstrip().splitlines(), expected,
+                         proc)
+
+    def test_module_names(self):
+        self.assertIsInstance(sys.stdlib_module_names, frozenset)
+        for name in sys.stdlib_module_names:
+            self.assertIsInstance(name, str)
+
 
 @test.support.cpython_only
 class UnraisableHookTest(unittest.TestCase):
@@ -1005,6 +1069,20 @@
                     self.assertIn("del is broken", report)
                 self.assertTrue(report.endswith("\n"))
 
+    def test_original_unraisablehook_exception_qualname(self):
+        class A:
+            class B:
+                class X(Exception):
+                    pass
+
+        with test.support.captured_stderr() as stderr, \
+             test.support.swap_attr(sys, 'unraisablehook',
+                                    sys.__unraisablehook__):
+                 expected = self.write_unraisable_exc(
+                     A.B.X(), "msg", "obj");
+        report = stderr.getvalue()
+        testName = 'test_original_unraisablehook_exception_qualname'
+        self.assertIn(f"{testName}.<locals>.A.B.X", report)
 
     def test_original_unraisablehook_wrong_type(self):
         exc = ValueError(42)
@@ -1215,10 +1293,10 @@
         nfrees = len(x.f_code.co_freevars)
         extras = x.f_code.co_stacksize + x.f_code.co_nlocals +\
                   ncells + nfrees - 1
-        check(x, vsize('5P2c4P3ic' + CO_MAXBLOCKS*'3i' + 'P' + extras*'P'))
+        check(x, vsize('4Pi2c4P3ic' + CO_MAXBLOCKS*'3i' + 'P' + extras*'P'))
         # function
         def func(): pass
-        check(func, size('13P'))
+        check(func, size('14P'))
         class c():
             @staticmethod
             def foo():
@@ -1232,7 +1310,7 @@
             check(bar, size('PP'))
         # generator
         def get_gen(): yield 1
-        check(get_gen(), size('Pb2PPP4P'))
+        check(get_gen(), size('P2PPP4P'))
         # iterator
         check(iter('abc'), size('lP'))
         # callable-iterator
@@ -1272,7 +1350,7 @@
             def setx(self, value): self.__x = value
             def delx(self): del self.__x
             x = property(getx, setx, delx, "")
-            check(x, size('4Pi'))
+            check(x, size('5Pi'))
         # PyCapsule
         # XXX
         # rangeiterator
@@ -1318,7 +1396,7 @@
         check(int, s)
         # class
         s = vsize(fmt +                 # PyTypeObject
-                  '3P'                  # PyAsyncMethods
+                  '4P'                  # PyAsyncMethods
                   '36P'                 # PyNumberMethods
                   '3P'                  # PyMappingMethods
                   '10P'                 # PySequenceMethods
@@ -1449,6 +1527,21 @@
         self.assertIsNone(cur.firstiter)
         self.assertIsNone(cur.finalizer)
 
+    def test_changing_sys_stderr_and_removing_reference(self):
+        # If the default displayhook doesn't take a strong reference
+        # to sys.stderr the following code can crash. See bpo-43660
+        # for more details.
+        code = textwrap.dedent('''
+            import sys
+            class MyStderr:
+                def write(self, s):
+                    sys.stderr = None
+            sys.stderr = MyStderr()
+            1/0
+        ''')
+        rc, out, err = assert_python_failure('-c', code)
+        self.assertEqual(out, b"")
+        self.assertEqual(err, b"")
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/Lib/test/test_sys_settrace.py b/Lib/test/test_sys_settrace.py
index 482e918..4f13bbd 100644
--- a/Lib/test/test_sys_settrace.py
+++ b/Lib/test/test_sys_settrace.py
@@ -53,9 +53,8 @@
 # following that clause?
 
 
-# Some constructs like "while 0:", "if 0:" or "if 1:...else:..." are optimized
-# away.  No code # exists for them, so the line numbers skip directly from
-# "del x" to "x = 1".
+# Some constructs like "while 0:", "if 0:" or "if 1:...else:..." could be optimized
+# away.  Make sure that those lines aren't skipped.
 def arigo_example0():
     x = 1
     del x
@@ -66,6 +65,7 @@
 arigo_example0.events = [(0, 'call'),
                         (1, 'line'),
                         (2, 'line'),
+                        (3, 'line'),
                         (5, 'line'),
                         (5, 'return')]
 
@@ -79,6 +79,7 @@
 arigo_example1.events = [(0, 'call'),
                         (1, 'line'),
                         (2, 'line'),
+                        (3, 'line'),
                         (5, 'line'),
                         (5, 'return')]
 
@@ -94,6 +95,7 @@
 arigo_example2.events = [(0, 'call'),
                         (1, 'line'),
                         (2, 'line'),
+                        (3, 'line'),
                         (4, 'line'),
                         (7, 'line'),
                         (7, 'return')]
@@ -220,8 +222,7 @@
                           (2, 'line'),
                           (3, 'line'),
                           (4, 'line'),
-                          (6, 'line'),
-                          (6, 'return')]
+                          (4, 'return')]
 
 # Tight loop with while(1) example (SF #765624)
 def tightloop_example():
@@ -237,9 +238,13 @@
                             (1, 'line'),
                             (2, 'line'),
                             (3, 'line'),
+                            (4, 'line'),
                             (5, 'line'),
+                            (4, 'line'),
                             (5, 'line'),
+                            (4, 'line'),
                             (5, 'line'),
+                            (4, 'line'),
                             (5, 'line'),
                             (5, 'exception'),
                             (6, 'line'),
@@ -602,6 +607,536 @@
         self.compare_events(doit_async.__code__.co_firstlineno,
                             tracer.events, events)
 
+    def test_21_repeated_pass(self):
+        def func():
+            pass
+            pass
+
+        self.run_and_compare(func,
+            [(0, 'call'),
+             (1, 'line'),
+             (2, 'line'),
+             (2, 'return')])
+
+    def test_loop_in_try_except(self):
+        # https://bugs.python.org/issue41670
+
+        def func():
+            try:
+                for i in []: pass
+                return 1
+            except:
+                return 2
+
+        self.run_and_compare(func,
+            [(0, 'call'),
+             (1, 'line'),
+             (2, 'line'),
+             (3, 'line'),
+             (3, 'return')])
+
+    def test_try_except_no_exception(self):
+
+        def func():
+            try:
+                2
+            except:
+                4
+            finally:
+                6
+
+        self.run_and_compare(func,
+            [(0, 'call'),
+             (1, 'line'),
+             (2, 'line'),
+             (6, 'line'),
+             (6, 'return')])
+
+    def test_nested_loops(self):
+
+        def func():
+            for i in range(2):
+                for j in range(2):
+                    a = i + j
+            return a == 1
+
+        self.run_and_compare(func,
+            [(0, 'call'),
+             (1, 'line'),
+             (2, 'line'),
+             (3, 'line'),
+             (2, 'line'),
+             (3, 'line'),
+             (2, 'line'),
+             (1, 'line'),
+             (2, 'line'),
+             (3, 'line'),
+             (2, 'line'),
+             (3, 'line'),
+             (2, 'line'),
+             (1, 'line'),
+             (4, 'line'),
+             (4, 'return')])
+
+    def test_if_break(self):
+
+        def func():
+            seq = [1, 0]
+            while seq:
+                n = seq.pop()
+                if n:
+                    break   # line 5
+            else:
+                n = 99
+            return n        # line 8
+
+        self.run_and_compare(func,
+            [(0, 'call'),
+             (1, 'line'),
+             (2, 'line'),
+             (3, 'line'),
+             (4, 'line'),
+             (2, 'line'),
+             (3, 'line'),
+             (4, 'line'),
+             (5, 'line'),
+             (8, 'line'),
+             (8, 'return')])
+
+    def test_break_through_finally(self):
+
+        def func():
+            a, c, d, i = 1, 1, 1, 99
+            try:
+                for i in range(3):
+                    try:
+                        a = 5
+                        if i > 0:
+                            break                   # line 7
+                        a = 8
+                    finally:
+                        c = 10
+            except:
+                d = 12                              # line 12
+            assert a == 5 and c == 10 and d == 1    # line 13
+
+        self.run_and_compare(func,
+            [(0, 'call'),
+             (1, 'line'),
+             (2, 'line'),
+             (3, 'line'),
+             (4, 'line'),
+             (5, 'line'),
+             (6, 'line'),
+             (8, 'line'),
+             (10, 'line'),
+             (3, 'line'),
+             (4, 'line'),
+             (5, 'line'),
+             (6, 'line'),
+             (7, 'line'),
+             (10, 'line'),
+             (13, 'line'),
+             (13, 'return')])
+
+    def test_continue_through_finally(self):
+
+        def func():
+            a, b, c, d, i = 1, 1, 1, 1, 99
+            try:
+                for i in range(2):
+                    try:
+                        a = 5
+                        if i > 0:
+                            continue                # line 7
+                        b = 8
+                    finally:
+                        c = 10
+            except:
+                d = 12                              # line 12
+            assert (a, b, c, d) == (5, 8, 10, 1)    # line 13
+
+        self.run_and_compare(func,
+            [(0, 'call'),
+             (1, 'line'),
+             (2, 'line'),
+             (3, 'line'),
+             (4, 'line'),
+             (5, 'line'),
+             (6, 'line'),
+             (8, 'line'),
+             (10, 'line'),
+             (3, 'line'),
+             (4, 'line'),
+             (5, 'line'),
+             (6, 'line'),
+             (7, 'line'),
+             (10, 'line'),
+             (3, 'line'),
+             (13, 'line'),
+             (13, 'return')])
+
+    def test_return_through_finally(self):
+
+        def func():
+            try:
+                return 2
+            finally:
+                4
+
+        self.run_and_compare(func,
+            [(0, 'call'),
+             (1, 'line'),
+             (2, 'line'),
+             (4, 'line'),
+             (4, 'return')])
+
+    def test_try_except_with_wrong_type(self):
+
+        def func():
+            try:
+                2/0
+            except IndexError:
+                4
+            finally:
+                return 6
+
+        self.run_and_compare(func,
+            [(0, 'call'),
+             (1, 'line'),
+             (2, 'line'),
+             (2, 'exception'),
+             (3, 'line'),
+             (6, 'line'),
+             (6, 'return')])
+
+    def test_break_to_continue1(self):
+
+        def func():
+            TRUE = 1
+            x = [1]
+            while x:
+                x.pop()
+                while TRUE:
+                    break
+                continue
+
+        self.run_and_compare(func,
+            [(0, 'call'),
+             (1, 'line'),
+             (2, 'line'),
+             (3, 'line'),
+             (4, 'line'),
+             (5, 'line'),
+             (6, 'line'),
+             (7, 'line'),
+             (3, 'line'),
+             (3, 'return')])
+
+    def test_break_to_continue2(self):
+
+        def func():
+            TRUE = 1
+            x = [1]
+            while x:
+                x.pop()
+                while TRUE:
+                    break
+                else:
+                    continue
+
+        self.run_and_compare(func,
+            [(0, 'call'),
+             (1, 'line'),
+             (2, 'line'),
+             (3, 'line'),
+             (4, 'line'),
+             (5, 'line'),
+             (6, 'line'),
+             (3, 'line'),
+             (3, 'return')])
+
+    def test_break_to_break(self):
+
+        def func():
+            TRUE = 1
+            while TRUE:
+                while TRUE:
+                    break
+                break
+
+        self.run_and_compare(func,
+            [(0, 'call'),
+             (1, 'line'),
+             (2, 'line'),
+             (3, 'line'),
+             (4, 'line'),
+             (5, 'line'),
+             (5, 'return')])
+
+    def test_nested_ifs(self):
+
+        def func():
+            a = b = 1
+            if a == 1:
+                if b == 1:
+                    x = 4
+                else:
+                    y = 6
+            else:
+                z = 8
+
+        self.run_and_compare(func,
+            [(0, 'call'),
+             (1, 'line'),
+             (2, 'line'),
+             (3, 'line'),
+             (4, 'line'),
+             (4, 'return')])
+
+    def test_nested_ifs_with_and(self):
+
+        def func():
+            if A:
+                if B:
+                    if C:
+                        if D:
+                            return False
+                else:
+                    return False
+            elif E and F:
+                return True
+
+        A = B = True
+        C = False
+
+        self.run_and_compare(func,
+            [(0, 'call'),
+             (1, 'line'),
+             (2, 'line'),
+             (3, 'line'),
+             (3, 'return')])
+
+    def test_nested_try_if(self):
+
+        def func():
+            x = "hello"
+            try:
+                3/0
+            except ZeroDivisionError:
+                if x == 'raise':
+                    raise ValueError()   # line 6
+            f = 7
+
+        self.run_and_compare(func,
+            [(0, 'call'),
+             (1, 'line'),
+             (2, 'line'),
+             (3, 'line'),
+             (3, 'exception'),
+             (4, 'line'),
+             (5, 'line'),
+             (7, 'line'),
+             (7, 'return')])
+
+    def test_if_false_in_with(self):
+
+        class C:
+            def __enter__(self):
+                return self
+            def __exit__(*args):
+                pass
+
+        def func():
+            with C():
+                if False:
+                    pass
+
+        self.run_and_compare(func,
+            [(0, 'call'),
+             (1, 'line'),
+             (-5, 'call'),
+             (-4, 'line'),
+             (-4, 'return'),
+             (2, 'line'),
+             (1, 'line'),
+             (-3, 'call'),
+             (-2, 'line'),
+             (-2, 'return'),
+             (1, 'return')])
+
+    def test_if_false_in_try_except(self):
+
+        def func():
+            try:
+                if False:
+                    pass
+            except Exception:
+                X
+
+        self.run_and_compare(func,
+            [(0, 'call'),
+             (1, 'line'),
+             (2, 'line'),
+             (2, 'return')])
+
+    def test_implicit_return_in_class(self):
+
+        def func():
+            class A:
+                if 3 < 9:
+                    a = 1
+                else:
+                    a = 2
+
+        self.run_and_compare(func,
+            [(0, 'call'),
+             (1, 'line'),
+             (1, 'call'),
+             (1, 'line'),
+             (2, 'line'),
+             (3, 'line'),
+             (3, 'return'),
+             (1, 'return')])
+
+    def test_try_in_try(self):
+        def func():
+            try:
+                try:
+                    pass
+                except Exception as ex:
+                    pass
+            except Exception:
+                pass
+
+        self.run_and_compare(func,
+            [(0, 'call'),
+             (1, 'line'),
+             (2, 'line'),
+             (3, 'line'),
+             (3, 'return')])
+
+    def test_if_in_if_in_if(self):
+        def func(a=0, p=1, z=1):
+            if p:
+                if a:
+                    if z:
+                        pass
+                    else:
+                        pass
+            else:
+                pass
+
+        self.run_and_compare(func,
+            [(0, 'call'),
+             (1, 'line'),
+             (2, 'line'),
+             (2, 'return')])
+
+    def test_early_exit_with(self):
+
+        class C:
+            def __enter__(self):
+                return self
+            def __exit__(*args):
+                pass
+
+        def func_break():
+            for i in (1,2):
+                with C():
+                    break
+            pass
+
+        def func_return():
+            with C():
+                return
+
+        self.run_and_compare(func_break,
+            [(0, 'call'),
+             (1, 'line'),
+             (2, 'line'),
+             (-5, 'call'),
+             (-4, 'line'),
+             (-4, 'return'),
+             (3, 'line'),
+             (2, 'line'),
+             (-3, 'call'),
+             (-2, 'line'),
+             (-2, 'return'),
+             (4, 'line'),
+             (4, 'return')])
+
+        self.run_and_compare(func_return,
+            [(0, 'call'),
+             (1, 'line'),
+             (-11, 'call'),
+             (-10, 'line'),
+             (-10, 'return'),
+             (2, 'line'),
+             (1, 'line'),
+             (-9, 'call'),
+             (-8, 'line'),
+             (-8, 'return'),
+             (1, 'return')])
+
+    def test_flow_converges_on_same_line(self):
+
+        def foo(x):
+            if x:
+                try:
+                    1/(x - 1)
+                except ZeroDivisionError:
+                    pass
+            return x
+
+        def func():
+            for i in range(2):
+                foo(i)
+
+        self.run_and_compare(func,
+            [(0, 'call'),
+             (1, 'line'),
+             (2, 'line'),
+             (-8, 'call'),
+             (-7, 'line'),
+             (-2, 'line'),
+             (-2, 'return'),
+             (1, 'line'),
+             (2, 'line'),
+             (-8, 'call'),
+             (-7, 'line'),
+             (-6, 'line'),
+             (-5, 'line'),
+             (-5, 'exception'),
+             (-4, 'line'),
+             (-3, 'line'),
+             (-2, 'line'),
+             (-2, 'return'),
+             (1, 'line'),
+             (1, 'return')])
+
+    def test_no_tracing_of_named_except_cleanup(self):
+
+        def func():
+            x = 0
+            try:
+                1/x
+            except ZeroDivisionError as error:
+                if x:
+                    raise
+            return "done"
+
+        self.run_and_compare(func,
+        [(0, 'call'),
+            (1, 'line'),
+            (2, 'line'),
+            (3, 'line'),
+            (3, 'exception'),
+            (4, 'line'),
+            (5, 'line'),
+            (7, 'line'),
+            (7, 'return')])
+
 
 class SkipLineEventsTraceTestCase(TraceTestCase):
     """Repeat the trace tests, but with per-line events skipped"""
@@ -749,7 +1284,7 @@
         if (self.firstLine is None and frame.f_code == self.code and
                 event == 'line'):
             self.firstLine = frame.f_lineno - 1
-        if (event == self.event and self.firstLine and
+        if (event == self.event and self.firstLine is not None and
                 frame.f_lineno == self.firstLine + self.jumpFrom):
             f = frame
             while f is not None and f.f_code != self.code:
@@ -948,7 +1483,7 @@
             output.append(11)
         output.append(12)
 
-    @jump_test(5, 11, [2, 4], (ValueError, 'unreachable'))
+    @jump_test(5, 11, [2, 4], (ValueError, 'after'))
     def test_no_jump_over_return_try_finally_in_finally_block(output):
         try:
             output.append(2)
@@ -963,7 +1498,7 @@
             pass
         output.append(12)
 
-    @jump_test(3, 4, [1], (ValueError, 'unreachable'))
+    @jump_test(3, 4, [1], (ValueError, 'after'))
     def test_no_jump_infinite_while_loop(output):
         output.append(1)
         while True:
@@ -1274,6 +1809,7 @@
         output.append(1)
         async for i in asynciter([1, 2]):
             output.append(3)
+        pass
 
     @jump_test(3, 2, [2, 2], (ValueError, 'into'))
     def test_no_jump_backwards_into_for_block(output):
@@ -1457,7 +1993,7 @@
         async with asynctracecontext(output, 4):
             output.append(5)
 
-    @jump_test(5, 7, [2, 4], (ValueError, "unreachable"))
+    @jump_test(5, 7, [2, 4], (ValueError, "after"))
     def test_no_jump_over_return_out_of_finally_block(output):
         try:
             output.append(2)
@@ -1523,7 +2059,7 @@
 """, "<fake module>", "exec")
         class fake_function:
             __code__ = code
-        tracer = JumpTracer(fake_function, 2, 0)
+        tracer = JumpTracer(fake_function, 4, 1)
         sys.settrace(tracer.trace)
         namespace = {"output": []}
         exec(code, namespace)
diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py
index 44e44bf..9408657 100644
--- a/Lib/test/test_sysconfig.py
+++ b/Lib/test/test_sysconfig.py
@@ -5,17 +5,23 @@
 import shutil
 from copy import copy
 
-from test.support import (import_module, TESTFN, unlink, check_warnings,
-                          captured_stdout, skip_unless_symlink, change_cwd,
-                          PythonSymlink)
+from test.support import (captured_stdout, PythonSymlink)
+from test.support.import_helper import import_module
+from test.support.os_helper import (TESTFN, unlink, skip_unless_symlink,
+                                    change_cwd)
+from test.support.warnings_helper import check_warnings
 
 import sysconfig
 from sysconfig import (get_paths, get_platform, get_config_vars,
                        get_path, get_path_names, _INSTALL_SCHEMES,
-                       _get_default_scheme, _expand_vars,
-                       get_scheme_names, get_config_var, _main)
+                       get_default_scheme, get_scheme_names, get_config_var,
+                       _expand_vars, _get_preferred_schemes, _main)
 import _osx_support
 
+
+HAS_USER_BASE = sysconfig._HAS_USER_BASE
+
+
 class TestSysConfig(unittest.TestCase):
 
     def setUp(self):
@@ -88,17 +94,46 @@
 
     def test_get_paths(self):
         scheme = get_paths()
-        default_scheme = _get_default_scheme()
+        default_scheme = get_default_scheme()
         wanted = _expand_vars(default_scheme, None)
         wanted = sorted(wanted.items())
         scheme = sorted(scheme.items())
         self.assertEqual(scheme, wanted)
 
     def test_get_path(self):
-        # XXX make real tests here
+        config_vars = get_config_vars()
         for scheme in _INSTALL_SCHEMES:
             for name in _INSTALL_SCHEMES[scheme]:
-                res = get_path(name, scheme)
+                expected = _INSTALL_SCHEMES[scheme][name].format(**config_vars)
+                self.assertEqual(
+                    os.path.normpath(get_path(name, scheme)),
+                    os.path.normpath(expected),
+                )
+
+    def test_get_default_scheme(self):
+        self.assertIn(get_default_scheme(), _INSTALL_SCHEMES)
+
+    def test_get_preferred_schemes(self):
+        expected_schemes = {'prefix', 'home', 'user'}
+
+        # Windows.
+        os.name = 'nt'
+        schemes = _get_preferred_schemes()
+        self.assertIsInstance(schemes, dict)
+        self.assertEqual(set(schemes), expected_schemes)
+
+        # Mac and Linux, shared library build.
+        os.name = 'posix'
+        schemes = _get_preferred_schemes()
+        self.assertIsInstance(schemes, dict)
+        self.assertEqual(set(schemes), expected_schemes)
+
+        # Mac, framework build.
+        os.name = 'posix'
+        sys.platform = 'darwin'
+        sys._framework = True
+        self.assertIsInstance(schemes, dict)
+        self.assertEqual(set(schemes), expected_schemes)
 
     def test_get_config_vars(self):
         cvars = get_config_vars()
@@ -228,9 +263,10 @@
         self.assertTrue(os.path.isfile(config_h), config_h)
 
     def test_get_scheme_names(self):
-        wanted = ('nt', 'nt_user', 'osx_framework_user',
-                  'posix_home', 'posix_prefix', 'posix_user')
-        self.assertEqual(get_scheme_names(), wanted)
+        wanted = ['nt', 'posix_home', 'posix_prefix']
+        if HAS_USER_BASE:
+            wanted.extend(['nt_user', 'osx_framework_user', 'posix_user'])
+        self.assertEqual(get_scheme_names(), tuple(sorted(wanted)))
 
     @skip_unless_symlink
     def test_symlink(self): # Issue 7880
@@ -242,7 +278,8 @@
         # Issue #8759: make sure the posix scheme for the users
         # is similar to the global posix_prefix one
         base = get_config_var('base')
-        user = get_config_var('userbase')
+        if HAS_USER_BASE:
+            user = get_config_var('userbase')
         # the global scheme mirrors the distinction between prefix and
         # exec-prefix but not the user scheme, so we have to adapt the paths
         # before comparing (issue #9100)
@@ -257,8 +294,19 @@
                 # before comparing
                 global_path = global_path.replace(sys.base_prefix, sys.prefix)
                 base = base.replace(sys.base_prefix, sys.prefix)
-            user_path = get_path(name, 'posix_user')
-            self.assertEqual(user_path, global_path.replace(base, user, 1))
+            if HAS_USER_BASE:
+                user_path = get_path(name, 'posix_user')
+                expected = global_path.replace(base, user, 1)
+                # bpo-44860: platlib of posix_user doesn't use sys.platlibdir,
+                # whereas posix_prefix does.
+                if name == 'platlib':
+                    # Replace "/lib64/python3.11/site-packages" suffix
+                    # with "/lib/python3.11/site-packages".
+                    py_version_short = sysconfig.get_python_version()
+                    suffix = f'python{py_version_short}/site-packages'
+                    expected = expected.replace(f'/{sys.platlibdir}/{suffix}',
+                                                f'/lib/{suffix}')
+                self.assertEqual(user_path, expected)
 
     def test_main(self):
         # just making sure _main() runs and returns things in the stdout
@@ -358,10 +406,12 @@
 
     @unittest.skipIf(sysconfig.get_config_var('EXT_SUFFIX') is None,
                      'EXT_SUFFIX required for this test')
-    def test_SO_in_vars(self):
+    def test_EXT_SUFFIX_in_vars(self):
+        import _imp
         vars = sysconfig.get_config_vars()
         self.assertIsNotNone(vars['SO'])
         self.assertEqual(vars['SO'], vars['EXT_SUFFIX'])
+        self.assertEqual(vars['EXT_SUFFIX'], _imp.extension_suffixes()[0])
 
     @unittest.skipUnless(sys.platform == 'linux' and
                          hasattr(sys.implementation, '_multiarch'),
diff --git a/Lib/test/test_syslog.py b/Lib/test/test_syslog.py
index 6f902f1..fe09bd3 100644
--- a/Lib/test/test_syslog.py
+++ b/Lib/test/test_syslog.py
@@ -1,6 +1,5 @@
-
-from test import support
-syslog = support.import_module("syslog") #skip if not supported
+from test.support import import_helper
+syslog = import_helper.import_module("syslog") #skip if not supported
 import unittest
 
 # XXX(nnorwitz): This test sucks.  I don't know of a platform independent way
diff --git a/Lib/test/test_tabnanny.py b/Lib/test/test_tabnanny.py
index 95840d6..e0a82e9 100644
--- a/Lib/test/test_tabnanny.py
+++ b/Lib/test/test_tabnanny.py
@@ -4,7 +4,6 @@
     * errored    : Whitespace related problems present in file.
 """
 from unittest import TestCase, mock
-from unittest import mock
 import errno
 import os
 import tabnanny
@@ -12,7 +11,8 @@
 import tempfile
 import textwrap
 from test.support import (captured_stderr, captured_stdout, script_helper,
-                          findfile, unlink)
+                          findfile)
+from test.support.os_helper import unlink
 
 
 SOURCE_CODES = {
@@ -292,8 +292,8 @@
         _, out, err = script_helper.assert_python_ok('-m', 'tabnanny', *args)
         # Note: The `splitlines()` will solve the problem of CRLF(\r) added
         # by OS Windows.
-        out = out.decode('ascii')
-        err = err.decode('ascii')
+        out = os.fsdecode(out)
+        err = os.fsdecode(err)
         if partial:
             for std, output in ((stdout, out), (stderr, err)):
                 _output = output.splitlines()
diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py
index 29cde91..4bf1ba3 100644
--- a/Lib/test/test_tarfile.py
+++ b/Lib/test/test_tarfile.py
@@ -11,6 +11,7 @@
 import tarfile
 
 from test import support
+from test.support import os_helper
 from test.support import script_helper
 
 # Check for our compression modules.
@@ -19,6 +20,10 @@
 except ImportError:
     gzip = None
 try:
+    import zlib
+except ImportError:
+    zlib = None
+try:
     import bz2
 except ImportError:
     bz2 = None
@@ -30,7 +35,7 @@
 def sha256sum(data):
     return sha256(data).hexdigest()
 
-TEMPDIR = os.path.abspath(support.TESTFN) + "-tardir"
+TEMPDIR = os.path.abspath(os_helper.TESTFN) + "-tardir"
 tarextdir = TEMPDIR + '-extract-test'
 tarname = support.findfile("testtar.tar")
 gzipname = os.path.join(TEMPDIR, "testtar.tar.gz")
@@ -215,6 +220,25 @@
     def test_issue14160(self):
         self._test_fileobj_link("symtype2", "ustar/regtype")
 
+    def test_add_dir_getmember(self):
+        # bpo-21987
+        self.add_dir_and_getmember('bar')
+        self.add_dir_and_getmember('a'*101)
+
+    def add_dir_and_getmember(self, name):
+        with os_helper.temp_cwd():
+            with tarfile.open(tmpname, 'w') as tar:
+                try:
+                    os.mkdir(name)
+                    tar.add(name)
+                finally:
+                    os.rmdir(name)
+            with tarfile.open(tmpname) as tar:
+                self.assertEqual(
+                    tar.getmember(name),
+                    tar.getmember(name + '/')
+                )
+
 class GzipUstarReadTest(GzipTest, UstarReadTest):
     pass
 
@@ -575,21 +599,21 @@
 
     @unittest.skipUnless(hasattr(os, "link"),
                          "Missing hardlink implementation")
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_extract_hardlink(self):
         # Test hardlink extraction (e.g. bug #857297).
         with tarfile.open(tarname, errorlevel=1, encoding="iso8859-1") as tar:
             tar.extract("ustar/regtype", TEMPDIR)
-            self.addCleanup(support.unlink, os.path.join(TEMPDIR, "ustar/regtype"))
+            self.addCleanup(os_helper.unlink, os.path.join(TEMPDIR, "ustar/regtype"))
 
             tar.extract("ustar/lnktype", TEMPDIR)
-            self.addCleanup(support.unlink, os.path.join(TEMPDIR, "ustar/lnktype"))
+            self.addCleanup(os_helper.unlink, os.path.join(TEMPDIR, "ustar/lnktype"))
             with open(os.path.join(TEMPDIR, "ustar/lnktype"), "rb") as f:
                 data = f.read()
             self.assertEqual(sha256sum(data), sha256_regtype)
 
             tar.extract("ustar/symtype", TEMPDIR)
-            self.addCleanup(support.unlink, os.path.join(TEMPDIR, "ustar/symtype"))
+            self.addCleanup(os_helper.unlink, os.path.join(TEMPDIR, "ustar/symtype"))
             with open(os.path.join(TEMPDIR, "ustar/symtype"), "rb") as f:
                 data = f.read()
             self.assertEqual(sha256sum(data), sha256_regtype)
@@ -622,7 +646,7 @@
                 self.assertEqual(tarinfo.mtime, file_mtime, errmsg)
         finally:
             tar.close()
-            support.rmtree(DIR)
+            os_helper.rmtree(DIR)
 
     def test_extract_directory(self):
         dirtype = "ustar/dirtype"
@@ -637,11 +661,11 @@
                 if sys.platform != "win32":
                     self.assertEqual(os.stat(extracted).st_mode & 0o777, 0o755)
         finally:
-            support.rmtree(DIR)
+            os_helper.rmtree(DIR)
 
     def test_extractall_pathlike_name(self):
         DIR = pathlib.Path(TEMPDIR) / "extractall"
-        with support.temp_dir(DIR), \
+        with os_helper.temp_dir(DIR), \
              tarfile.open(tarname, encoding="iso8859-1") as tar:
             directories = [t for t in tar if t.isdir()]
             tar.extractall(DIR, directories)
@@ -652,7 +676,7 @@
     def test_extract_pathlike_name(self):
         dirtype = "ustar/dirtype"
         DIR = pathlib.Path(TEMPDIR) / "extractall"
-        with support.temp_dir(DIR), \
+        with os_helper.temp_dir(DIR), \
              tarfile.open(tarname, encoding="iso8859-1") as tar:
             tarinfo = tar.getmember(dirtype)
             tar.extract(tarinfo, path=DIR)
@@ -676,7 +700,7 @@
             else:
                 self.fail("ReadError not raised")
         finally:
-            support.unlink(empty)
+            os_helper.unlink(empty)
 
     def test_parallel_iteration(self):
         # Issue #16601: Restarting iteration over tarfile continued
@@ -686,6 +710,16 @@
                 self.assertEqual(m1.offset, m2.offset)
                 self.assertEqual(m1.get_info(), m2.get_info())
 
+    @unittest.skipIf(zlib is None, "requires zlib")
+    def test_zlib_error_does_not_leak(self):
+        # bpo-39039: tarfile.open allowed zlib exceptions to bubble up when
+        # parsing certain types of invalid data
+        with unittest.mock.patch("tarfile.TarInfo.fromtarfile") as mock:
+            mock.side_effect = zlib.error
+            with self.assertRaises(tarfile.ReadError):
+                tarfile.open(self.tarname)
+
+
 class MiscReadTest(MiscReadTestBase, unittest.TestCase):
     test_fail_comp = None
 
@@ -1026,7 +1060,7 @@
                 fobj.write(b'x' * 4096)
                 fobj.truncate()
             s = os.stat(name)
-            support.unlink(name)
+            os_helper.unlink(name)
             return (s.st_blocks * 512 < s.st_size)
         else:
             return False
@@ -1171,7 +1205,7 @@
             finally:
                 tar.close()
         finally:
-            support.rmdir(path)
+            os_helper.rmdir(path)
 
     # mock the following:
     #  os.listdir: so we know that files are in the wrong order
@@ -1193,9 +1227,9 @@
             finally:
                 tar.close()
         finally:
-            support.unlink(os.path.join(path, "1"))
-            support.unlink(os.path.join(path, "2"))
-            support.rmdir(path)
+            os_helper.unlink(os.path.join(path, "1"))
+            os_helper.unlink(os.path.join(path, "2"))
+            os_helper.rmdir(path)
 
     def test_gettarinfo_pathlike_name(self):
         with tarfile.open(tmpname, self.mode) as tar:
@@ -1229,10 +1263,10 @@
             finally:
                 tar.close()
         finally:
-            support.unlink(target)
-            support.unlink(link)
+            os_helper.unlink(target)
+            os_helper.unlink(link)
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_symlink_size(self):
         path = os.path.join(TEMPDIR, "symlink")
         os.symlink("link_target", path)
@@ -1244,7 +1278,7 @@
             finally:
                 tar.close()
         finally:
-            support.unlink(path)
+            os_helper.unlink(path)
 
     def test_add_self(self):
         # Test for #1257255.
@@ -1257,7 +1291,7 @@
             self.assertEqual(tar.getnames(), [],
                     "added the archive to itself")
 
-            with support.change_cwd(TEMPDIR):
+            with os_helper.change_cwd(TEMPDIR):
                 tar.add(dstname)
             self.assertEqual(tar.getnames(), [],
                     "added the archive to itself")
@@ -1270,7 +1304,7 @@
         try:
             for name in ("foo", "bar", "baz"):
                 name = os.path.join(tempdir, name)
-                support.create_empty_file(name)
+                os_helper.create_empty_file(name)
 
             def filter(tarinfo):
                 if os.path.basename(tarinfo.name) == "bar":
@@ -1298,7 +1332,7 @@
             finally:
                 tar.close()
         finally:
-            support.rmtree(tempdir)
+            os_helper.rmtree(tempdir)
 
     # Guarantee that stored pathnames are not modified. Don't
     # remove ./ or ../ or double slashes. Still make absolute
@@ -1309,7 +1343,7 @@
         # and compare the stored name with the original.
         foo = os.path.join(TEMPDIR, "foo")
         if not dir:
-            support.create_empty_file(foo)
+            os_helper.create_empty_file(foo)
         else:
             os.mkdir(foo)
 
@@ -1326,14 +1360,14 @@
             tar.close()
 
         if not dir:
-            support.unlink(foo)
+            os_helper.unlink(foo)
         else:
-            support.rmdir(foo)
+            os_helper.rmdir(foo)
 
         self.assertEqual(t.name, cmp_path or path.replace(os.sep, "/"))
 
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_extractall_symlinks(self):
         # Test if extractall works properly when tarfile contains symlinks
         tempdir = os.path.join(TEMPDIR, "testsymlinks")
@@ -1356,8 +1390,8 @@
                 except OSError:
                     self.fail("extractall failed with symlinked files")
         finally:
-            support.unlink(temparchive)
-            support.rmtree(tempdir)
+            os_helper.unlink(temparchive)
+            os_helper.rmtree(tempdir)
 
     def test_pathnames(self):
         self._test_pathname("foo")
@@ -1385,7 +1419,7 @@
 
     def test_cwd(self):
         # Test adding the current working directory.
-        with support.change_cwd(TEMPDIR):
+        with os_helper.change_cwd(TEMPDIR):
             tar = tarfile.open(tmpname, self.mode)
             try:
                 tar.add(".")
@@ -1456,7 +1490,7 @@
         # Test for issue #8464: Create files with correct
         # permissions.
         if os.path.exists(tmpname):
-            support.unlink(tmpname)
+            os_helper.unlink(tmpname)
 
         original_umask = os.umask(0o022)
         try:
@@ -1611,7 +1645,7 @@
             self.assertEqual(buf_blk[device_headers], b"0000000\0" * 2)
             self.assertEqual(buf_reg[device_headers], b"\0" * 16)
         finally:
-            support.rmtree(tempdir)
+            os_helper.rmtree(tempdir)
 
 
 class CreateTest(WriteTestBase, unittest.TestCase):
@@ -1621,7 +1655,7 @@
     file_path = os.path.join(TEMPDIR, "spameggs42")
 
     def setUp(self):
-        support.unlink(tmpname)
+        os_helper.unlink(tmpname)
 
     @classmethod
     def setUpClass(cls):
@@ -1630,7 +1664,7 @@
 
     @classmethod
     def tearDownClass(cls):
-        support.unlink(cls.file_path)
+        os_helper.unlink(cls.file_path)
 
     def test_create(self):
         with tarfile.open(tmpname, self.mode) as tobj:
@@ -1705,15 +1739,30 @@
 
 
 class GzipCreateTest(GzipTest, CreateTest):
-    pass
+
+    def test_create_with_compresslevel(self):
+        with tarfile.open(tmpname, self.mode, compresslevel=1) as tobj:
+            tobj.add(self.file_path)
+        with tarfile.open(tmpname, 'r:gz', compresslevel=1) as tobj:
+            pass
 
 
 class Bz2CreateTest(Bz2Test, CreateTest):
-    pass
+
+    def test_create_with_compresslevel(self):
+        with tarfile.open(tmpname, self.mode, compresslevel=1) as tobj:
+            tobj.add(self.file_path)
+        with tarfile.open(tmpname, 'r:bz2', compresslevel=1) as tobj:
+            pass
 
 
 class LzmaCreateTest(LzmaTest, CreateTest):
-    pass
+
+    # Unlike gz and bz2, xz uses the preset keyword instead of compresslevel.
+    # It does not allow for preset to be specified when reading.
+    def test_create_with_preset(self):
+        with tarfile.open(tmpname, self.mode, preset=1) as tobj:
+            tobj.add(self.file_path)
 
 
 class CreateWithXModeTest(CreateTest):
@@ -1745,8 +1794,8 @@
 
     def tearDown(self):
         self.tar.close()
-        support.unlink(self.foo)
-        support.unlink(self.bar)
+        os_helper.unlink(self.foo)
+        os_helper.unlink(self.bar)
 
     def test_add_twice(self):
         # The same name will be added as a REGTYPE every
@@ -1850,6 +1899,61 @@
         finally:
             tar.close()
 
+    def test_create_pax_header(self):
+        # The ustar header should contain values that can be
+        # represented reasonably, even if a better (e.g. higher
+        # precision) version is set in the pax header.
+        # Issue #45863
+
+        # values that should be kept
+        t = tarfile.TarInfo()
+        t.name = "foo"
+        t.mtime = 1000.1
+        t.size = 100
+        t.uid = 123
+        t.gid = 124
+        info = t.get_info()
+        header = t.create_pax_header(info, encoding="iso8859-1")
+        self.assertEqual(info['name'], "foo")
+        # mtime should be rounded to nearest second
+        self.assertIsInstance(info['mtime'], int)
+        self.assertEqual(info['mtime'], 1000)
+        self.assertEqual(info['size'], 100)
+        self.assertEqual(info['uid'], 123)
+        self.assertEqual(info['gid'], 124)
+        self.assertEqual(header,
+            b'././@PaxHeader' + bytes(86) \
+            + b'0000000\x000000000\x000000000\x0000000000020\x0000000000000\x00010205\x00 x' \
+            + bytes(100) + b'ustar\x0000'+ bytes(247) \
+            + b'16 mtime=1000.1\n' + bytes(496) + b'foo' + bytes(97) \
+            + b'0000644\x000000173\x000000174\x0000000000144\x0000000001750\x00006516\x00 0' \
+            + bytes(100) + b'ustar\x0000' + bytes(247))
+
+        # values that should be changed
+        t = tarfile.TarInfo()
+        t.name = "foo\u3374" # can't be represented in ascii
+        t.mtime = 10**10 # too big
+        t.size = 10**10 # too big
+        t.uid = 8**8 # too big
+        t.gid = 8**8+1 # too big
+        info = t.get_info()
+        header = t.create_pax_header(info, encoding="iso8859-1")
+        # name is kept as-is in info but should be added to pax header
+        self.assertEqual(info['name'], "foo\u3374")
+        self.assertEqual(info['mtime'], 0)
+        self.assertEqual(info['size'], 0)
+        self.assertEqual(info['uid'], 0)
+        self.assertEqual(info['gid'], 0)
+        self.assertEqual(header,
+            b'././@PaxHeader' + bytes(86) \
+            + b'0000000\x000000000\x000000000\x0000000000130\x0000000000000\x00010207\x00 x' \
+            + bytes(100) + b'ustar\x0000' + bytes(247) \
+            + b'15 path=foo\xe3\x8d\xb4\n16 uid=16777216\n' \
+            + b'16 gid=16777217\n20 size=10000000000\n' \
+            + b'21 mtime=10000000000\n'+ bytes(424) + b'foo?' + bytes(96) \
+            + b'0000644\x000000000\x000000000\x0000000000000\x0000000000000\x00006540\x00 0' \
+            + bytes(100) + b'ustar\x0000' + bytes(247))
+
 
 class UnicodeTest:
 
@@ -2055,7 +2159,7 @@
     def setUp(self):
         self.tarname = tmpname
         if os.path.exists(self.tarname):
-            support.unlink(self.tarname)
+            os_helper.unlink(self.tarname)
 
     def _create_testtar(self, mode="w:"):
         with tarfile.open(tarname, encoding="iso8859-1") as src:
@@ -2268,22 +2372,31 @@
             tarfile.itn(0x10000000000, 6, tarfile.GNU_FORMAT)
 
     def test__all__(self):
-        blacklist = {'version', 'grp', 'pwd', 'symlink_exception',
-                     'NUL', 'BLOCKSIZE', 'RECORDSIZE', 'GNU_MAGIC',
-                     'POSIX_MAGIC', 'LENGTH_NAME', 'LENGTH_LINK',
-                     'LENGTH_PREFIX', 'REGTYPE', 'AREGTYPE', 'LNKTYPE',
-                     'SYMTYPE', 'CHRTYPE', 'BLKTYPE', 'DIRTYPE', 'FIFOTYPE',
-                     'CONTTYPE', 'GNUTYPE_LONGNAME', 'GNUTYPE_LONGLINK',
-                     'GNUTYPE_SPARSE', 'XHDTYPE', 'XGLTYPE', 'SOLARIS_XHDTYPE',
-                     'SUPPORTED_TYPES', 'REGULAR_TYPES', 'GNU_TYPES',
-                     'PAX_FIELDS', 'PAX_NAME_FIELDS', 'PAX_NUMBER_FIELDS',
-                     'stn', 'nts', 'nti', 'itn', 'calc_chksums', 'copyfileobj',
-                     'filemode',
-                     'EmptyHeaderError', 'TruncatedHeaderError',
-                     'EOFHeaderError', 'InvalidHeaderError',
-                     'SubsequentHeaderError', 'ExFileObject',
-                     'main'}
-        support.check__all__(self, tarfile, blacklist=blacklist)
+        not_exported = {
+            'version', 'grp', 'pwd', 'symlink_exception', 'NUL', 'BLOCKSIZE',
+            'RECORDSIZE', 'GNU_MAGIC', 'POSIX_MAGIC', 'LENGTH_NAME',
+            'LENGTH_LINK', 'LENGTH_PREFIX', 'REGTYPE', 'AREGTYPE', 'LNKTYPE',
+            'SYMTYPE', 'CHRTYPE', 'BLKTYPE', 'DIRTYPE', 'FIFOTYPE', 'CONTTYPE',
+            'GNUTYPE_LONGNAME', 'GNUTYPE_LONGLINK', 'GNUTYPE_SPARSE',
+            'XHDTYPE', 'XGLTYPE', 'SOLARIS_XHDTYPE', 'SUPPORTED_TYPES',
+            'REGULAR_TYPES', 'GNU_TYPES', 'PAX_FIELDS', 'PAX_NAME_FIELDS',
+            'PAX_NUMBER_FIELDS', 'stn', 'nts', 'nti', 'itn', 'calc_chksums',
+            'copyfileobj', 'filemode', 'EmptyHeaderError',
+            'TruncatedHeaderError', 'EOFHeaderError', 'InvalidHeaderError',
+            'SubsequentHeaderError', 'ExFileObject', 'main'}
+        support.check__all__(self, tarfile, not_exported=not_exported)
+
+    def test_useful_error_message_when_modules_missing(self):
+        fname = os.path.join(os.path.dirname(__file__), 'testtar.tar.xz')
+        with self.assertRaises(tarfile.ReadError) as excinfo:
+            error = tarfile.CompressionError('lzma module is not available'),
+            with unittest.mock.patch.object(tarfile.TarFile, 'xzopen', side_effect=error):
+                tarfile.open(fname)
+
+        self.assertIn(
+            "\n- method xz: CompressionError('lzma module is not available')\n",
+            str(excinfo.exception),
+        )
 
 
 class CommandLineTest(unittest.TestCase):
@@ -2300,7 +2413,7 @@
         files = [support.findfile('tokenize_tests.txt'),
                  support.findfile('tokenize_tests-no-coding-cookie-'
                                   'and-utf8-bom-sig-only.txt')]
-        self.addCleanup(support.unlink, tar_name)
+        self.addCleanup(os_helper.unlink, tar_name)
         with tarfile.open(tar_name, 'w') as tf:
             for tardata in files:
                 tf.add(tardata, arcname=os.path.basename(tardata))
@@ -2346,7 +2459,7 @@
                     self.assertEqual(out, b'')
                     self.assertEqual(rc, 1)
                 finally:
-                    support.unlink(tmpname)
+                    os_helper.unlink(tmpname)
 
     def test_list_command(self):
         for tar_name in testtarnames:
@@ -2388,7 +2501,7 @@
                 with tarfile.open(tmpname) as tar:
                     tar.getmembers()
             finally:
-                support.unlink(tmpname)
+                os_helper.unlink(tmpname)
 
     def test_create_command_verbose(self):
         files = [support.findfile('tokenize_tests.txt'),
@@ -2402,7 +2515,7 @@
                 with tarfile.open(tmpname) as tar:
                     tar.getmembers()
             finally:
-                support.unlink(tmpname)
+                os_helper.unlink(tmpname)
 
     def test_create_command_dotless_filename(self):
         files = [support.findfile('tokenize_tests.txt')]
@@ -2412,7 +2525,7 @@
             with tarfile.open(dotlessname) as tar:
                 tar.getmembers()
         finally:
-            support.unlink(dotlessname)
+            os_helper.unlink(dotlessname)
 
     def test_create_command_dot_started_filename(self):
         tar_name = os.path.join(TEMPDIR, ".testtar")
@@ -2423,7 +2536,7 @@
             with tarfile.open(tar_name) as tar:
                 tar.getmembers()
         finally:
-            support.unlink(tar_name)
+            os_helper.unlink(tar_name)
 
     def test_create_command_compressed(self):
         files = [support.findfile('tokenize_tests.txt'),
@@ -2438,41 +2551,41 @@
                 with filetype.taropen(tar_name) as tar:
                     tar.getmembers()
             finally:
-                support.unlink(tar_name)
+                os_helper.unlink(tar_name)
 
     def test_extract_command(self):
         self.make_simple_tarfile(tmpname)
         for opt in '-e', '--extract':
             try:
-                with support.temp_cwd(tarextdir):
+                with os_helper.temp_cwd(tarextdir):
                     out = self.tarfilecmd(opt, tmpname)
                 self.assertEqual(out, b'')
             finally:
-                support.rmtree(tarextdir)
+                os_helper.rmtree(tarextdir)
 
     def test_extract_command_verbose(self):
         self.make_simple_tarfile(tmpname)
         for opt in '-v', '--verbose':
             try:
-                with support.temp_cwd(tarextdir):
+                with os_helper.temp_cwd(tarextdir):
                     out = self.tarfilecmd(opt, '-e', tmpname,
                                           PYTHONIOENCODING='utf-8')
                 self.assertIn(b' file is extracted.', out)
             finally:
-                support.rmtree(tarextdir)
+                os_helper.rmtree(tarextdir)
 
     def test_extract_command_different_directory(self):
         self.make_simple_tarfile(tmpname)
         try:
-            with support.temp_cwd(tarextdir):
+            with os_helper.temp_cwd(tarextdir):
                 out = self.tarfilecmd('-e', tmpname, 'spamdir')
             self.assertEqual(out, b'')
         finally:
-            support.rmtree(tarextdir)
+            os_helper.rmtree(tarextdir)
 
     def test_extract_command_invalid_file(self):
         zipname = support.findfile('zipdir.zip')
-        with support.temp_cwd(tarextdir):
+        with os_helper.temp_cwd(tarextdir):
             rc, out, err = self.tarfilecmd_failure('-e', zipname)
         self.assertIn(b' is not a tar archive.', err)
         self.assertEqual(out, b'')
@@ -2735,7 +2848,7 @@
 
 
 def setUpModule():
-    support.unlink(TEMPDIR)
+    os_helper.unlink(TEMPDIR)
     os.makedirs(TEMPDIR)
 
     global testtarnames
@@ -2746,14 +2859,14 @@
     # Create compressed tarfiles.
     for c in GzipTest, Bz2Test, LzmaTest:
         if c.open:
-            support.unlink(c.tarname)
+            os_helper.unlink(c.tarname)
             testtarnames.append(c.tarname)
             with c.open(c.tarname, "wb") as tar:
                 tar.write(data)
 
 def tearDownModule():
     if os.path.exists(TEMPDIR):
-        support.rmtree(TEMPDIR)
+        os_helper.rmtree(TEMPDIR)
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/Lib/test/test_tcl.py b/Lib/test/test_tcl.py
index 1c5b9cf..30f0431 100644
--- a/Lib/test/test_tcl.py
+++ b/Lib/test/test_tcl.py
@@ -1,13 +1,16 @@
 import unittest
+import locale
 import re
 import subprocess
 import sys
 import os
 import warnings
 from test import support
+from test.support import import_helper
+from test.support import os_helper
 
 # Skip this test if the _tkinter module wasn't built.
-_tkinter = support.import_module('_tkinter')
+_tkinter = import_helper.import_module('_tkinter')
 
 import tkinter
 from tkinter import Tcl
@@ -40,8 +43,14 @@
 class TkinterTest(unittest.TestCase):
 
     def testFlattenLen(self):
-        # flatten(<object with no length>)
+        # Object without length.
         self.assertRaises(TypeError, _tkinter._flatten, True)
+        # Object with length, but not sequence.
+        self.assertRaises(TypeError, _tkinter._flatten, {})
+        # Sequence or set, but not tuple or list.
+        # (issue44608: there were leaks in the following cases)
+        self.assertRaises(TypeError, _tkinter._flatten, 'string')
+        self.assertRaises(TypeError, _tkinter._flatten, {'set'})
 
 
 class TclTest(unittest.TestCase):
@@ -59,6 +68,10 @@
         tcl = self.interp
         self.assertEqual(tcl.eval('set a "a\\0b"'), 'a\x00b')
 
+    def test_eval_surrogates_in_result(self):
+        tcl = self.interp
+        self.assertIn(tcl.eval(r'set a "<\ud83d\udcbb>"'), '<\U0001f4bb>')
+
     def testEvalException(self):
         tcl = self.interp
         self.assertRaises(TclError,tcl.eval,'set a')
@@ -131,10 +144,14 @@
 
     def get_integers(self):
         integers = (0, 1, -1, 2**31-1, -2**31, 2**31, -2**31-1, 2**63-1, -2**63)
-        # bignum was added in Tcl 8.5, but its support is able only since 8.5.8
-        if (get_tk_patchlevel() >= (8, 6, 0, 'final') or
-            (8, 5, 8) <= get_tk_patchlevel() < (8, 6)):
-            integers += (2**63, -2**63-1, 2**1000, -2**1000)
+        # bignum was added in Tcl 8.5, but its support is able only since 8.5.8.
+        # Actually it is determined at compile time, so using get_tk_patchlevel()
+        # is not reliable.
+        # TODO: expose full static version.
+        if tcl_version >= (8, 5):
+            v = get_tk_patchlevel()
+            if v >= (8, 6, 0, 'final') or (8, 5, 8) <= v < (8, 6):
+                integers += (2**63, -2**63-1, 2**1000, -2**1000)
         return integers
 
     def test_getint(self):
@@ -191,29 +208,48 @@
 
     def testEvalFile(self):
         tcl = self.interp
-        with open(support.TESTFN, 'w') as f:
-            self.addCleanup(support.unlink, support.TESTFN)
+        filename = os_helper.TESTFN_ASCII
+        self.addCleanup(os_helper.unlink, filename)
+        with open(filename, 'w') as f:
             f.write("""set a 1
             set b 2
             set c [ expr $a + $b ]
             """)
-        tcl.evalfile(support.TESTFN)
+        tcl.evalfile(filename)
         self.assertEqual(tcl.eval('set a'),'1')
         self.assertEqual(tcl.eval('set b'),'2')
         self.assertEqual(tcl.eval('set c'),'3')
 
     def test_evalfile_null_in_result(self):
         tcl = self.interp
-        with open(support.TESTFN, 'w') as f:
-            self.addCleanup(support.unlink, support.TESTFN)
+        filename = os_helper.TESTFN_ASCII
+        self.addCleanup(os_helper.unlink, filename)
+        with open(filename, 'w') as f:
             f.write("""
             set a "a\0b"
             set b "a\\0b"
             """)
-        tcl.evalfile(support.TESTFN)
+        tcl.evalfile(filename)
         self.assertEqual(tcl.eval('set a'), 'a\x00b')
         self.assertEqual(tcl.eval('set b'), 'a\x00b')
 
+    def test_evalfile_surrogates_in_result(self):
+        tcl = self.interp
+        encoding = tcl.call('encoding', 'system')
+        self.addCleanup(tcl.call, 'encoding', 'system', encoding)
+        tcl.call('encoding', 'system', 'utf-8')
+
+        filename = os_helper.TESTFN_ASCII
+        self.addCleanup(os_helper.unlink, filename)
+        with open(filename, 'wb') as f:
+            f.write(b"""
+            set a "<\xed\xa0\xbd\xed\xb2\xbb>"
+            set b "<\\ud83d\\udcbb>"
+            """)
+        tcl.evalfile(filename)
+        self.assertEqual(tcl.eval('set a'), '<\U0001f4bb>')
+        self.assertEqual(tcl.eval('set b'), '<\U0001f4bb>')
+
     def testEvalFileException(self):
         tcl = self.interp
         filename = "doesnotexists"
@@ -242,7 +278,7 @@
         if not os.path.exists(unc_name):
             raise unittest.SkipTest('Cannot connect to UNC Path')
 
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env.unset("TCL_LIBRARY")
             stdout = subprocess.check_output(
                     [unc_name, '-c', 'import tkinter; print(tkinter)'])
@@ -419,7 +455,7 @@
             else:
                 self.assertEqual(result, str(i))
                 self.assertIsInstance(result, str)
-        if tcl_version < (8, 5):  # bignum was added in Tcl 8.5
+        if get_tk_patchlevel() < (8, 5):  # bignum was added in Tcl 8.5
             self.assertRaises(TclError, tcl.call, 'expr', str(2**1000))
 
     def test_passing_values(self):
@@ -436,6 +472,11 @@
         self.assertEqual(passValue('str\x00ing\u20ac'), 'str\x00ing\u20ac')
         self.assertEqual(passValue('str\x00ing\U0001f4bb'),
                          'str\x00ing\U0001f4bb')
+        if sys.platform != 'win32':
+            self.assertEqual(passValue('<\udce2\udc82\udcac>'),
+                             '<\u20ac>')
+            self.assertEqual(passValue('<\udced\udca0\udcbd\udced\udcb2\udcbb>'),
+                             '<\U0001f4bb>')
         self.assertEqual(passValue(b'str\x00ing'),
                          b'str\x00ing' if self.wantobjects else 'str\x00ing')
         self.assertEqual(passValue(b'str\xc0\x80ing'),
@@ -495,6 +536,9 @@
         check('string\xbd')
         check('string\u20ac')
         check('string\U0001f4bb')
+        if sys.platform != 'win32':
+            check('<\udce2\udc82\udcac>', '<\u20ac>')
+            check('<\udced\udca0\udcbd\udced\udcb2\udcbb>', '<\U0001f4bb>')
         check('')
         check(b'string', 'string')
         check(b'string\xe2\x82\xac', 'string\xe2\x82\xac')
@@ -538,6 +582,8 @@
             ('a \u20ac', ('a', '\u20ac')),
             ('a \U0001f4bb', ('a', '\U0001f4bb')),
             (b'a \xe2\x82\xac', ('a', '\u20ac')),
+            (b'a \xf0\x9f\x92\xbb', ('a', '\U0001f4bb')),
+            (b'a \xed\xa0\xbd\xed\xb2\xbb', ('a', '\U0001f4bb')),
             (b'a\xc0\x80b c\xc0\x80d', ('a\x00b', 'c\x00d')),
             ('a {b c}', ('a', 'b c')),
             (r'a b\ c', ('a', 'b c')),
@@ -696,8 +742,11 @@
         check('{\n')
         check('}\n')
 
+    @support.cpython_only
     def test_new_tcl_obj(self):
-        self.assertRaises(TypeError, _tkinter.Tcl_Obj)
+        support.check_disallow_instantiation(self, _tkinter.Tcl_Obj)
+        support.check_disallow_instantiation(self, _tkinter.TkttType)
+        support.check_disallow_instantiation(self, _tkinter.TkappType)
 
 class BigmemTclTest(unittest.TestCase):
 
@@ -755,8 +804,5 @@
         print('patchlevel =', tcl.call('info', 'patchlevel'))
 
 
-def test_main():
-    support.run_unittest(TclTest, TkinterTest, BigmemTclTest)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_telnetlib.py b/Lib/test/test_telnetlib.py
index 7633901..41c4fcd 100644
--- a/Lib/test/test_telnetlib.py
+++ b/Lib/test/test_telnetlib.py
@@ -16,7 +16,7 @@
     try:
         conn, addr = serv.accept()
         conn.close()
-    except socket.timeout:
+    except TimeoutError:
         pass
     finally:
         serv.close()
@@ -29,7 +29,7 @@
         self.sock.settimeout(60)  # Safety net. Look issue 11812
         self.port = socket_helper.bind_port(self.sock)
         self.thread = threading.Thread(target=server, args=(self.evt,self.sock))
-        self.thread.setDaemon(True)
+        self.thread.daemon = True
         self.thread.start()
         self.evt.wait()
 
diff --git a/Lib/test/test_tempfile.py b/Lib/test/test_tempfile.py
index fcc706e..2b0ec46 100644
--- a/Lib/test/test_tempfile.py
+++ b/Lib/test/test_tempfile.py
@@ -15,7 +15,9 @@
 
 import unittest
 from test import support
+from test.support import os_helper
 from test.support import script_helper
+from test.support import warnings_helper
 
 
 has_textmode = (tempfile._text_openflags != tempfile._bin_openflags)
@@ -60,6 +62,25 @@
     def test_infer_return_type_pathlib(self):
         self.assertIs(str, tempfile._infer_return_type(pathlib.Path('/')))
 
+    def test_infer_return_type_pathlike(self):
+        class Path:
+            def __init__(self, path):
+                self.path = path
+
+            def __fspath__(self):
+                return self.path
+
+        self.assertIs(str, tempfile._infer_return_type(Path('/')))
+        self.assertIs(bytes, tempfile._infer_return_type(Path(b'/')))
+        self.assertIs(str, tempfile._infer_return_type('', Path('')))
+        self.assertIs(bytes, tempfile._infer_return_type(b'', Path(b'')))
+        self.assertIs(bytes, tempfile._infer_return_type(None, Path(b'')))
+        self.assertIs(str, tempfile._infer_return_type(None, Path('')))
+
+        with self.assertRaises(TypeError):
+            tempfile._infer_return_type('', Path(b''))
+        with self.assertRaises(TypeError):
+            tempfile._infer_return_type(b'', Path(''))
 
 # Common functionality.
 
@@ -69,7 +90,7 @@
     b_check = re.compile(br"^[a-z0-9_-]{8}$")
 
     def setUp(self):
-        self._warnings_manager = support.check_warnings()
+        self._warnings_manager = warnings_helper.check_warnings()
         self._warnings_manager.__enter__()
         warnings.filterwarnings("ignore", category=RuntimeWarning,
                                 message="mktemp", module=__name__)
@@ -151,8 +172,8 @@
         self.r = tempfile._RandomNameSequence()
         super().setUp()
 
-    def test_get_six_char_str(self):
-        # _RandomNameSequence returns a six-character string
+    def test_get_eight_char_str(self):
+        # _RandomNameSequence returns a eight-character string
         s = next(self.r)
         self.nameCheck(s, '', '', '')
 
@@ -224,7 +245,7 @@
         # _candidate_tempdir_list contains the expected directories
 
         # Make sure the interesting environment variables are all set.
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             for envname in 'TMPDIR', 'TEMP', 'TMP':
                 dirname = os.getenv(envname)
                 if not dirname:
@@ -310,7 +331,7 @@
         with support.swap_attr(tempfile, 'tempdir', dir):
             yield
     finally:
-        support.rmtree(dir)
+        os_helper.rmtree(dir)
 
 
 def _mock_candidate_names(*names):
@@ -428,6 +449,7 @@
             self.do_create(dir=dir).write(b"blat")
             self.do_create(dir=pathlib.Path(dir)).write(b"blat")
         finally:
+            support.gc_collect()  # For PyPy or other GCs.
             os.rmdir(dir)
 
     def test_file_mode(self):
@@ -594,13 +616,13 @@
         case_sensitive_tempdir = tempfile.mkdtemp("-Temp")
         _tempdir, tempfile.tempdir = tempfile.tempdir, None
         try:
-            with support.EnvironmentVarGuard() as env:
+            with os_helper.EnvironmentVarGuard() as env:
                 # Fake the first env var which is checked as a candidate
                 env["TMPDIR"] = case_sensitive_tempdir
                 self.assertEqual(tempfile.gettempdir(), case_sensitive_tempdir)
         finally:
             tempfile.tempdir = _tempdir
-            support.rmdir(case_sensitive_tempdir)
+            os_helper.rmdir(case_sensitive_tempdir)
 
 
 class TestMkstemp(BaseTestCase):
@@ -665,6 +687,37 @@
         finally:
             os.rmdir(dir)
 
+    def test_for_tempdir_is_bytes_issue40701_api_warts(self):
+        orig_tempdir = tempfile.tempdir
+        self.assertIsInstance(tempfile.tempdir, (str, type(None)))
+        try:
+            fd, path = tempfile.mkstemp()
+            os.close(fd)
+            os.unlink(path)
+            self.assertIsInstance(path, str)
+            tempfile.tempdir = tempfile.gettempdirb()
+            self.assertIsInstance(tempfile.tempdir, bytes)
+            self.assertIsInstance(tempfile.gettempdir(), str)
+            self.assertIsInstance(tempfile.gettempdirb(), bytes)
+            fd, path = tempfile.mkstemp()
+            os.close(fd)
+            os.unlink(path)
+            self.assertIsInstance(path, bytes)
+            fd, path = tempfile.mkstemp(suffix='.txt')
+            os.close(fd)
+            os.unlink(path)
+            self.assertIsInstance(path, str)
+            fd, path = tempfile.mkstemp(prefix='test-temp-')
+            os.close(fd)
+            os.unlink(path)
+            self.assertIsInstance(path, str)
+            fd, path = tempfile.mkstemp(dir=tempfile.gettempdir())
+            os.close(fd)
+            os.unlink(path)
+            self.assertIsInstance(path, str)
+        finally:
+            tempfile.tempdir = orig_tempdir
+
 
 class TestMkdtemp(TestBadTempdir, BaseTestCase):
     """Test mkdtemp()."""
@@ -773,6 +826,32 @@
             dir2 = tempfile.mkdtemp()
             self.assertTrue(dir2.endswith('bbb'))
 
+    def test_for_tempdir_is_bytes_issue40701_api_warts(self):
+        orig_tempdir = tempfile.tempdir
+        self.assertIsInstance(tempfile.tempdir, (str, type(None)))
+        try:
+            path = tempfile.mkdtemp()
+            os.rmdir(path)
+            self.assertIsInstance(path, str)
+            tempfile.tempdir = tempfile.gettempdirb()
+            self.assertIsInstance(tempfile.tempdir, bytes)
+            self.assertIsInstance(tempfile.gettempdir(), str)
+            self.assertIsInstance(tempfile.gettempdirb(), bytes)
+            path = tempfile.mkdtemp()
+            os.rmdir(path)
+            self.assertIsInstance(path, bytes)
+            path = tempfile.mkdtemp(suffix='-dir')
+            os.rmdir(path)
+            self.assertIsInstance(path, str)
+            path = tempfile.mkdtemp(prefix='test-mkdtemp-')
+            os.rmdir(path)
+            self.assertIsInstance(path, str)
+            path = tempfile.mkdtemp(dir=tempfile.gettempdir())
+            os.rmdir(path)
+            self.assertIsInstance(path, str)
+        finally:
+            tempfile.tempdir = orig_tempdir
+
 
 class TestMktemp(BaseTestCase):
     """Test mktemp()."""
@@ -821,6 +900,8 @@
         extant = list(range(TEST_FILES))
         for i in extant:
             extant[i] = self.do_create(pre="aa")
+        del extant
+        support.gc_collect()  # For PyPy or other GCs.
 
 ##     def test_warning(self):
 ##         # mktemp issues a warning when used
@@ -950,7 +1031,7 @@
 
     def test_bad_mode(self):
         dir = tempfile.mkdtemp()
-        self.addCleanup(support.rmtree, dir)
+        self.addCleanup(os_helper.rmtree, dir)
         with self.assertRaises(ValueError):
             tempfile.NamedTemporaryFile(mode='wr', dir=dir)
         with self.assertRaises(TypeError):
@@ -1306,13 +1387,17 @@
             d.clear()
             d.update(c)
 
+
 class TestTemporaryDirectory(BaseTestCase):
     """Test TemporaryDirectory()."""
 
-    def do_create(self, dir=None, pre="", suf="", recurse=1, dirs=1, files=1):
+    def do_create(self, dir=None, pre="", suf="", recurse=1, dirs=1, files=1,
+                  ignore_cleanup_errors=False):
         if dir is None:
             dir = tempfile.gettempdir()
-        tmp = tempfile.TemporaryDirectory(dir=dir, prefix=pre, suffix=suf)
+        tmp = tempfile.TemporaryDirectory(
+            dir=dir, prefix=pre, suffix=suf,
+            ignore_cleanup_errors=ignore_cleanup_errors)
         self.nameCheck(tmp.name, dir, pre, suf)
         self.do_create2(tmp.name, recurse, dirs, files)
         return tmp
@@ -1351,7 +1436,31 @@
         finally:
             os.rmdir(dir)
 
-    @support.skip_unless_symlink
+    def test_explict_cleanup_ignore_errors(self):
+        """Test that cleanup doesn't return an error when ignoring them."""
+        with tempfile.TemporaryDirectory() as working_dir:
+            temp_dir = self.do_create(
+                dir=working_dir, ignore_cleanup_errors=True)
+            temp_path = pathlib.Path(temp_dir.name)
+            self.assertTrue(temp_path.exists(),
+                            f"TemporaryDirectory {temp_path!s} does not exist")
+            with open(temp_path / "a_file.txt", "w+t") as open_file:
+                open_file.write("Hello world!\n")
+                temp_dir.cleanup()
+            self.assertEqual(len(list(temp_path.glob("*"))),
+                             int(sys.platform.startswith("win")),
+                             "Unexpected number of files in "
+                             f"TemporaryDirectory {temp_path!s}")
+            self.assertEqual(
+                temp_path.exists(),
+                sys.platform.startswith("win"),
+                f"TemporaryDirectory {temp_path!s} existence state unexpected")
+            temp_dir.cleanup()
+            self.assertFalse(
+                temp_path.exists(),
+                f"TemporaryDirectory {temp_path!s} exists after cleanup")
+
+    @os_helper.skip_unless_symlink
     def test_cleanup_with_symlink_to_a_directory(self):
         # cleanup() should not follow symlinks to directories (issue #12464)
         d1 = self.do_create()
@@ -1385,6 +1494,27 @@
         finally:
             os.rmdir(dir)
 
+    @support.cpython_only
+    def test_del_on_collection_ignore_errors(self):
+        """Test that ignoring errors works when TemporaryDirectory is gced."""
+        with tempfile.TemporaryDirectory() as working_dir:
+            temp_dir = self.do_create(
+                dir=working_dir, ignore_cleanup_errors=True)
+            temp_path = pathlib.Path(temp_dir.name)
+            self.assertTrue(temp_path.exists(),
+                            f"TemporaryDirectory {temp_path!s} does not exist")
+            with open(temp_path / "a_file.txt", "w+t") as open_file:
+                open_file.write("Hello world!\n")
+                del temp_dir
+            self.assertEqual(len(list(temp_path.glob("*"))),
+                             int(sys.platform.startswith("win")),
+                             "Unexpected number of files in "
+                             f"TemporaryDirectory {temp_path!s}")
+            self.assertEqual(
+                temp_path.exists(),
+                sys.platform.startswith("win"),
+                f"TemporaryDirectory {temp_path!s} existence state unexpected")
+
     def test_del_on_shutdown(self):
         # A TemporaryDirectory may be cleaned up during shutdown
         with self.do_create() as dir:
@@ -1417,6 +1547,43 @@
                 self.assertNotIn("Exception ", err)
                 self.assertIn("ResourceWarning: Implicitly cleaning up", err)
 
+    def test_del_on_shutdown_ignore_errors(self):
+        """Test ignoring errors works when a tempdir is gc'ed on shutdown."""
+        with tempfile.TemporaryDirectory() as working_dir:
+            code = """if True:
+                import pathlib
+                import sys
+                import tempfile
+                import warnings
+
+                temp_dir = tempfile.TemporaryDirectory(
+                    dir={working_dir!r}, ignore_cleanup_errors=True)
+                sys.stdout.buffer.write(temp_dir.name.encode())
+
+                temp_dir_2 = pathlib.Path(temp_dir.name) / "test_dir"
+                temp_dir_2.mkdir()
+                with open(temp_dir_2 / "test0.txt", "w") as test_file:
+                    test_file.write("Hello world!")
+                open_file = open(temp_dir_2 / "open_file.txt", "w")
+                open_file.write("Hello world!")
+
+                warnings.filterwarnings("always", category=ResourceWarning)
+                """.format(working_dir=working_dir)
+            __, out, err = script_helper.assert_python_ok("-c", code)
+            temp_path = pathlib.Path(out.decode().strip())
+            self.assertEqual(len(list(temp_path.glob("*"))),
+                             int(sys.platform.startswith("win")),
+                             "Unexpected number of files in "
+                             f"TemporaryDirectory {temp_path!s}")
+            self.assertEqual(
+                temp_path.exists(),
+                sys.platform.startswith("win"),
+                f"TemporaryDirectory {temp_path!s} existence state unexpected")
+            err = err.decode('utf-8', 'backslashreplace')
+            self.assertNotIn("Exception", err)
+            self.assertNotIn("Error", err)
+            self.assertIn("ResourceWarning: Implicitly cleaning up", err)
+
     def test_exit_on_shutdown(self):
         # Issue #22427
         with self.do_create() as dir:
@@ -1448,7 +1615,9 @@
             name = d.name
 
             # Check for the resource warning
-            with support.check_warnings(('Implicitly', ResourceWarning), quiet=False):
+            with warnings_helper.check_warnings(('Implicitly',
+                                                 ResourceWarning),
+                                                quiet=False):
                 warnings.filterwarnings("always", category=ResourceWarning)
                 del d
                 support.gc_collect()
diff --git a/Lib/test/test_textwrap.py b/Lib/test/test_textwrap.py
index ed97f70..dfbc2b9 100644
--- a/Lib/test/test_textwrap.py
+++ b/Lib/test/test_textwrap.py
@@ -640,6 +640,78 @@
                         max_lines=4)
 
 
+class LongWordWithHyphensTestCase(BaseTestCase):
+    def setUp(self):
+        self.wrapper = TextWrapper()
+        self.text1 = '''\
+We used enyzme 2-succinyl-6-hydroxy-2,4-cyclohexadiene-1-carboxylate synthase.
+'''
+        self.text2 = '''\
+1234567890-1234567890--this_is_a_very_long_option_indeed-good-bye"
+'''
+
+    def test_break_long_words_on_hyphen(self):
+        expected = ['We used enyzme 2-succinyl-6-hydroxy-2,4-',
+                    'cyclohexadiene-1-carboxylate synthase.']
+        self.check_wrap(self.text1, 50, expected)
+
+        expected = ['We used', 'enyzme 2-', 'succinyl-', '6-hydroxy-', '2,4-',
+                    'cyclohexad', 'iene-1-', 'carboxylat', 'e', 'synthase.']
+        self.check_wrap(self.text1, 10, expected)
+
+        expected = ['1234567890',  '-123456789', '0--this_is', '_a_very_lo',
+                    'ng_option_', 'indeed-', 'good-bye"']
+        self.check_wrap(self.text2, 10, expected)
+
+    def test_break_long_words_not_on_hyphen(self):
+        expected = ['We used enyzme 2-succinyl-6-hydroxy-2,4-cyclohexad',
+                    'iene-1-carboxylate synthase.']
+        self.check_wrap(self.text1, 50, expected, break_on_hyphens=False)
+
+        expected = ['We used', 'enyzme 2-s', 'uccinyl-6-', 'hydroxy-2,',
+                    '4-cyclohex', 'adiene-1-c', 'arboxylate', 'synthase.']
+        self.check_wrap(self.text1, 10, expected, break_on_hyphens=False)
+
+        expected = ['1234567890',  '-123456789', '0--this_is', '_a_very_lo',
+                    'ng_option_', 'indeed-', 'good-bye"']
+        self.check_wrap(self.text2, 10, expected)
+
+    def test_break_on_hyphen_but_not_long_words(self):
+        expected = ['We used enyzme',
+                    '2-succinyl-6-hydroxy-2,4-cyclohexadiene-1-carboxylate',
+                    'synthase.']
+
+        self.check_wrap(self.text1, 50, expected, break_long_words=False)
+
+        expected = ['We used', 'enyzme',
+                    '2-succinyl-6-hydroxy-2,4-cyclohexadiene-1-carboxylate',
+                    'synthase.']
+        self.check_wrap(self.text1, 10, expected, break_long_words=False)
+
+        expected = ['1234567890',  '-123456789', '0--this_is', '_a_very_lo',
+                    'ng_option_', 'indeed-', 'good-bye"']
+        self.check_wrap(self.text2, 10, expected)
+
+
+    def test_do_not_break_long_words_or_on_hyphens(self):
+        expected = ['We used enyzme',
+                    '2-succinyl-6-hydroxy-2,4-cyclohexadiene-1-carboxylate',
+                    'synthase.']
+        self.check_wrap(self.text1, 50, expected,
+                        break_long_words=False,
+                        break_on_hyphens=False)
+
+        expected = ['We used', 'enyzme',
+                    '2-succinyl-6-hydroxy-2,4-cyclohexadiene-1-carboxylate',
+                    'synthase.']
+        self.check_wrap(self.text1, 10, expected,
+                        break_long_words=False,
+                        break_on_hyphens=False)
+
+        expected = ['1234567890',  '-123456789', '0--this_is', '_a_very_lo',
+                    'ng_option_', 'indeed-', 'good-bye"']
+        self.check_wrap(self.text2, 10, expected)
+
 class IndentTestCases(BaseTestCase):
 
     # called before each test method
diff --git a/Lib/test/test_thread.py b/Lib/test/test_thread.py
index 77e46f2..4ae8a83 100644
--- a/Lib/test/test_thread.py
+++ b/Lib/test/test_thread.py
@@ -2,6 +2,7 @@
 import unittest
 import random
 from test import support
+from test.support import threading_helper
 import _thread as thread
 import time
 import weakref
@@ -32,8 +33,8 @@
         self.running = 0
         self.next_ident = 0
 
-        key = support.threading_setup()
-        self.addCleanup(support.threading_cleanup, *key)
+        key = threading_helper.threading_setup()
+        self.addCleanup(threading_helper.threading_cleanup, *key)
 
 
 class ThreadRunningTests(BasicThreadTest):
@@ -58,7 +59,7 @@
                 self.done_mutex.release()
 
     def test_starting_threads(self):
-        with support.wait_threads_exit():
+        with threading_helper.wait_threads_exit():
             # Basic test for thread creation.
             for i in range(NUMTASKS):
                 self.newtask()
@@ -94,7 +95,7 @@
             verbose_print("trying stack_size = (%d)" % tss)
             self.next_ident = 0
             self.created = 0
-            with support.wait_threads_exit():
+            with threading_helper.wait_threads_exit():
                 for i in range(NUMTASKS):
                     self.newtask()
 
@@ -116,7 +117,7 @@
             mut.acquire()
             mut.release()
 
-        with support.wait_threads_exit():
+        with threading_helper.wait_threads_exit():
             thread.start_new_thread(task, ())
             while not started:
                 time.sleep(POLL_SLEEP)
@@ -131,6 +132,7 @@
             del task
             while not done:
                 time.sleep(POLL_SLEEP)
+                support.gc_collect()  # For PyPy or other GCs.
             self.assertEqual(thread._count(), orig)
 
     def test_unraisable_exception(self):
@@ -140,7 +142,7 @@
 
         started = thread.allocate_lock()
         with support.catch_unraisable_exception() as cm:
-            with support.wait_threads_exit():
+            with threading_helper.wait_threads_exit():
                 started.acquire()
                 thread.start_new_thread(task, ())
                 started.acquire()
@@ -180,7 +182,7 @@
 class BarrierTest(BasicThreadTest):
 
     def test_barrier(self):
-        with support.wait_threads_exit():
+        with threading_helper.wait_threads_exit():
             self.bar = Barrier(NUMTASKS)
             self.running = NUMTASKS
             for i in range(NUMTASKS):
@@ -223,7 +225,7 @@
         self.read_fd, self.write_fd = os.pipe()
 
     @unittest.skipUnless(hasattr(os, 'fork'), 'need os.fork')
-    @support.reap_threads
+    @threading_helper.reap_threads
     def test_forkinthread(self):
         pid = None
 
@@ -243,7 +245,7 @@
             finally:
                 os._exit(0)
 
-        with support.wait_threads_exit():
+        with threading_helper.wait_threads_exit():
             thread.start_new_thread(fork_thread, (self.read_fd, self.write_fd))
             self.assertEqual(os.read(self.read_fd, 2), b"OK")
             os.close(self.write_fd)
diff --git a/Lib/test/test_threadedtempfile.py b/Lib/test/test_threadedtempfile.py
index e1d7a10..fe63c9e 100644
--- a/Lib/test/test_threadedtempfile.py
+++ b/Lib/test/test_threadedtempfile.py
@@ -15,7 +15,7 @@
 
 import tempfile
 
-from test.support import start_threads
+from test.support import threading_helper
 import unittest
 import io
 import threading
@@ -50,7 +50,7 @@
 class ThreadedTempFileTest(unittest.TestCase):
     def test_main(self):
         threads = [TempFileGreedy() for i in range(NUM_THREADS)]
-        with start_threads(threads, startEvent.set):
+        with threading_helper.start_threads(threads, startEvent.set):
             pass
         ok = sum(t.ok_count for t in threads)
         errors = [str(t.name) + str(t.errors.getvalue())
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
index c21cdf8..c54806e 100644
--- a/Lib/test/test_threading.py
+++ b/Lib/test/test_threading.py
@@ -3,7 +3,9 @@
 """
 
 import test.support
-from test.support import verbose, import_module, cpython_only
+from test.support import threading_helper
+from test.support import verbose, cpython_only, os_helper
+from test.support.import_helper import import_module
 from test.support.script_helper import assert_python_ok, assert_python_failure
 
 import random
@@ -17,7 +19,9 @@
 import subprocess
 import signal
 import textwrap
+import traceback
 
+from unittest import mock
 from test import lock_tests
 from test import support
 
@@ -28,6 +32,14 @@
 # on platforms known to behave badly.
 platforms_to_skip = ('netbsd5', 'hp-ux11')
 
+# Is Python built with Py_DEBUG macro defined?
+Py_DEBUG = hasattr(sys, 'gettotalrefcount')
+
+
+def restore_default_excepthook(testcase):
+    testcase.addCleanup(setattr, threading, 'excepthook', threading.excepthook)
+    threading.excepthook = threading.__excepthook__
+
 
 # A trivial mutable counter.
 class Counter(object):
@@ -75,15 +87,48 @@
 
 class BaseTestCase(unittest.TestCase):
     def setUp(self):
-        self._threads = test.support.threading_setup()
+        self._threads = threading_helper.threading_setup()
 
     def tearDown(self):
-        test.support.threading_cleanup(*self._threads)
+        threading_helper.threading_cleanup(*self._threads)
         test.support.reap_children()
 
 
 class ThreadTests(BaseTestCase):
 
+    @cpython_only
+    def test_name(self):
+        def func(): pass
+
+        thread = threading.Thread(name="myname1")
+        self.assertEqual(thread.name, "myname1")
+
+        # Convert int name to str
+        thread = threading.Thread(name=123)
+        self.assertEqual(thread.name, "123")
+
+        # target name is ignored if name is specified
+        thread = threading.Thread(target=func, name="myname2")
+        self.assertEqual(thread.name, "myname2")
+
+        with mock.patch.object(threading, '_counter', return_value=2):
+            thread = threading.Thread(name="")
+            self.assertEqual(thread.name, "Thread-2")
+
+        with mock.patch.object(threading, '_counter', return_value=3):
+            thread = threading.Thread()
+            self.assertEqual(thread.name, "Thread-3")
+
+        with mock.patch.object(threading, '_counter', return_value=5):
+            thread = threading.Thread(target=func)
+            self.assertEqual(thread.name, "Thread-5 (func)")
+
+    @cpython_only
+    def test_disallow_instantiation(self):
+        # Ensure that the type disallows instantiation (bpo-43916)
+        lock = threading.Lock()
+        test.support.check_disallow_instantiation(self, type(lock))
+
     # Create a bunch of threads, let each do some work, wait until all are
     # done.
     def test_various_ops(self):
@@ -124,13 +169,13 @@
 
     def test_ident_of_no_threading_threads(self):
         # The ident still must work for the main thread and dummy threads.
-        self.assertIsNotNone(threading.currentThread().ident)
+        self.assertIsNotNone(threading.current_thread().ident)
         def f():
-            ident.append(threading.currentThread().ident)
+            ident.append(threading.current_thread().ident)
             done.set()
         done = threading.Event()
         ident = []
-        with support.wait_threads_exit():
+        with threading_helper.wait_threads_exit():
             tid = _thread.start_new_thread(f, ())
             done.wait()
             self.assertEqual(ident[0], tid)
@@ -171,7 +216,7 @@
 
         mutex = threading.Lock()
         mutex.acquire()
-        with support.wait_threads_exit():
+        with threading_helper.wait_threads_exit():
             tid = _thread.start_new_thread(f, (mutex,))
             # Wait for the thread to finish.
             mutex.acquire()
@@ -397,6 +442,8 @@
                 if self.should_raise:
                     raise SystemExit
 
+        restore_default_excepthook(self)
+
         cyclic_object = RunSelfFunction(should_raise=False)
         weak_cyclic_object = weakref.ref(cyclic_object)
         cyclic_object.thread.join()
@@ -417,13 +464,32 @@
         # Just a quick sanity check to make sure the old method names are
         # still present
         t = threading.Thread()
-        t.isDaemon()
-        t.setDaemon(True)
-        t.getName()
-        t.setName("name")
+        with self.assertWarnsRegex(DeprecationWarning,
+                                   r'get the daemon attribute'):
+            t.isDaemon()
+        with self.assertWarnsRegex(DeprecationWarning,
+                                   r'set the daemon attribute'):
+            t.setDaemon(True)
+        with self.assertWarnsRegex(DeprecationWarning,
+                                   r'get the name attribute'):
+            t.getName()
+        with self.assertWarnsRegex(DeprecationWarning,
+                                   r'set the name attribute'):
+            t.setName("name")
+
         e = threading.Event()
-        e.isSet()
-        threading.activeCount()
+        with self.assertWarnsRegex(DeprecationWarning, 'use is_set()'):
+            e.isSet()
+
+        cond = threading.Condition()
+        cond.acquire()
+        with self.assertWarnsRegex(DeprecationWarning, 'use notify_all()'):
+            cond.notifyAll()
+
+        with self.assertWarnsRegex(DeprecationWarning, 'use active_count()'):
+            threading.activeCount()
+        with self.assertWarnsRegex(DeprecationWarning, 'use current_thread()'):
+            threading.currentThread()
 
     def test_repr_daemon(self):
         t = threading.Thread()
@@ -457,7 +523,6 @@
                 if not pid:
                     print("child process ok", file=sys.stderr, flush=True)
                     # child process
-                    sys.exit()
                 else:
                     wait_process(pid, exitcode=0)
 
@@ -558,7 +623,7 @@
             import os, threading, sys
             from test import support
 
-            def f():
+            def func():
                 pid = os.fork()
                 if pid == 0:
                     main = threading.main_thread()
@@ -571,14 +636,14 @@
                 else:
                     support.wait_process(pid, exitcode=0)
 
-            th = threading.Thread(target=f)
+            th = threading.Thread(target=func)
             th.start()
             th.join()
         """
         _, out, err = assert_python_ok("-c", code)
         data = out.decode().replace('\r', '')
         self.assertEqual(err, b"")
-        self.assertEqual(data, "Thread-1\nTrue\nTrue\n")
+        self.assertEqual(data, "Thread-1 (func)\nTrue\nTrue\n")
 
     def test_main_thread_during_shutdown(self):
         # bpo-31516: current_thread() should still point to the main thread
@@ -764,6 +829,27 @@
         finally:
             sys.settrace(old_trace)
 
+    def test_gettrace(self):
+        def noop_trace(frame, event, arg):
+            # no operation
+            return noop_trace
+        old_trace = threading.gettrace()
+        try:
+            threading.settrace(noop_trace)
+            trace_func = threading.gettrace()
+            self.assertEqual(noop_trace,trace_func)
+        finally:
+            threading.settrace(old_trace)
+
+    def test_getprofile(self):
+        def fn(*args): pass
+        old_profile = threading.getprofile()
+        try:
+            threading.setprofile(fn)
+            self.assertEqual(fn, threading.getprofile())
+        finally:
+            threading.setprofile(old_profile)
+
     @cpython_only
     def test_shutdown_locks(self):
         for daemon in (False, True):
@@ -805,6 +891,76 @@
         """)
         self.assertEqual(out.rstrip(), b"thread_dict.atexit = 'value'")
 
+    def test_boolean_target(self):
+        # bpo-41149: A thread that had a boolean value of False would not
+        # run, regardless of whether it was callable. The correct behaviour
+        # is for a thread to do nothing if its target is None, and to call
+        # the target otherwise.
+        class BooleanTarget(object):
+            def __init__(self):
+                self.ran = False
+            def __bool__(self):
+                return False
+            def __call__(self):
+                self.ran = True
+
+        target = BooleanTarget()
+        thread = threading.Thread(target=target)
+        thread.start()
+        thread.join()
+        self.assertTrue(target.ran)
+
+    def test_leak_without_join(self):
+        # bpo-37788: Test that a thread which is not joined explicitly
+        # does not leak. Test written for reference leak checks.
+        def noop(): pass
+        with threading_helper.wait_threads_exit():
+            threading.Thread(target=noop).start()
+            # Thread.join() is not called
+
+    @unittest.skipUnless(Py_DEBUG, 'need debug build (Py_DEBUG)')
+    def test_debug_deprecation(self):
+        # bpo-44584: The PYTHONTHREADDEBUG environment variable is deprecated
+        rc, out, err = assert_python_ok("-Wdefault", "-c", "pass",
+                                        PYTHONTHREADDEBUG="1")
+        msg = (b'DeprecationWarning: The threading debug '
+               b'(PYTHONTHREADDEBUG environment variable) '
+               b'is deprecated and will be removed in Python 3.12')
+        self.assertIn(msg, err)
+
+    def test_import_from_another_thread(self):
+        # bpo-1596321: If the threading module is first import from a thread
+        # different than the main thread, threading._shutdown() must handle
+        # this case without logging an error at Python exit.
+        code = textwrap.dedent('''
+            import _thread
+            import sys
+
+            event = _thread.allocate_lock()
+            event.acquire()
+
+            def import_threading():
+                import threading
+                event.release()
+
+            if 'threading' in sys.modules:
+                raise Exception('threading is already imported')
+
+            _thread.start_new_thread(import_threading, ())
+
+            # wait until the threading module is imported
+            event.acquire()
+            event.release()
+
+            if 'threading' not in sys.modules:
+                raise Exception('threading is not imported')
+
+            # don't wait until the thread completes
+        ''')
+        rc, out, err = assert_python_ok("-c", code)
+        self.assertEqual(out, b'')
+        self.assertEqual(err, b'')
+
 
 class ThreadJoinOnShutdown(BaseTestCase):
 
@@ -1235,6 +1391,22 @@
         # explicitly break the reference cycle to not leak a dangling thread
         thread.exc = None
 
+    def test_multithread_modify_file_noerror(self):
+        # See issue25872
+        def modify_file():
+            with open(os_helper.TESTFN, 'w', encoding='utf-8') as fp:
+                fp.write(' ')
+                traceback.format_stack()
+
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
+        threads = [
+            threading.Thread(target=modify_file)
+            for i in range(100)
+        ]
+        for t in threads:
+            t.start()
+            t.join()
+
 
 class ThreadRunFail(threading.Thread):
     def run(self):
@@ -1242,6 +1414,10 @@
 
 
 class ExceptHookTests(BaseTestCase):
+    def setUp(self):
+        restore_default_excepthook(self)
+        super().setUp()
+
     def test_excepthook(self):
         with support.captured_output("stderr") as stderr:
             thread = ThreadRunFail(name="excepthook thread")
@@ -1330,6 +1506,27 @@
                          'Exception in threading.excepthook:\n')
         self.assertEqual(err_str, 'threading_hook failed')
 
+    def test_original_excepthook(self):
+        def run_thread():
+            with support.captured_output("stderr") as output:
+                thread = ThreadRunFail(name="excepthook thread")
+                thread.start()
+                thread.join()
+            return output.getvalue()
+
+        def threading_hook(args):
+            print("Running a thread failed", file=sys.stderr)
+
+        default_output = run_thread()
+        with support.swap_attr(threading, 'excepthook', threading_hook):
+            custom_hook_output = run_thread()
+            threading.excepthook = threading.__excepthook__
+            recovered_output = run_thread()
+
+        self.assertEqual(default_output, recovered_output)
+        self.assertNotEqual(default_output, custom_hook_output)
+        self.assertEqual(custom_hook_output, "Running a thread failed\n")
+
 
 class TimerTests(BaseTestCase):
 
@@ -1391,13 +1588,38 @@
 
 class MiscTestCase(unittest.TestCase):
     def test__all__(self):
+        restore_default_excepthook(self)
+
         extra = {"ThreadError"}
-        blacklist = {'currentThread', 'activeCount'}
+        not_exported = {'currentThread', 'activeCount'}
         support.check__all__(self, threading, ('threading', '_thread'),
-                             extra=extra, blacklist=blacklist)
+                             extra=extra, not_exported=not_exported)
 
 
 class InterruptMainTests(unittest.TestCase):
+    def check_interrupt_main_with_signal_handler(self, signum):
+        def handler(signum, frame):
+            1/0
+
+        old_handler = signal.signal(signum, handler)
+        self.addCleanup(signal.signal, signum, old_handler)
+
+        with self.assertRaises(ZeroDivisionError):
+            _thread.interrupt_main()
+
+    def check_interrupt_main_noerror(self, signum):
+        handler = signal.getsignal(signum)
+        try:
+            # No exception should arise.
+            signal.signal(signum, signal.SIG_IGN)
+            _thread.interrupt_main(signum)
+
+            signal.signal(signum, signal.SIG_DFL)
+            _thread.interrupt_main(signum)
+        finally:
+            # Restore original handler
+            signal.signal(signum, handler)
+
     def test_interrupt_main_subthread(self):
         # Calling start_new_thread with a function that executes interrupt_main
         # should raise KeyboardInterrupt upon completion.
@@ -1415,18 +1637,43 @@
         with self.assertRaises(KeyboardInterrupt):
             _thread.interrupt_main()
 
-    def test_interrupt_main_noerror(self):
-        handler = signal.getsignal(signal.SIGINT)
-        try:
-            # No exception should arise.
-            signal.signal(signal.SIGINT, signal.SIG_IGN)
-            _thread.interrupt_main()
+    def test_interrupt_main_with_signal_handler(self):
+        self.check_interrupt_main_with_signal_handler(signal.SIGINT)
+        self.check_interrupt_main_with_signal_handler(signal.SIGTERM)
 
-            signal.signal(signal.SIGINT, signal.SIG_DFL)
-            _thread.interrupt_main()
-        finally:
-            # Restore original handler
-            signal.signal(signal.SIGINT, handler)
+    def test_interrupt_main_noerror(self):
+        self.check_interrupt_main_noerror(signal.SIGINT)
+        self.check_interrupt_main_noerror(signal.SIGTERM)
+
+    def test_interrupt_main_invalid_signal(self):
+        self.assertRaises(ValueError, _thread.interrupt_main, -1)
+        self.assertRaises(ValueError, _thread.interrupt_main, signal.NSIG)
+        self.assertRaises(ValueError, _thread.interrupt_main, 1000000)
+
+    @threading_helper.reap_threads
+    def test_can_interrupt_tight_loops(self):
+        cont = [True]
+        started = [False]
+        interrupted = [False]
+
+        def worker(started, cont, interrupted):
+            iterations = 100_000_000
+            started[0] = True
+            while cont[0]:
+                if iterations:
+                    iterations -= 1
+                else:
+                    return
+                pass
+            interrupted[0] = True
+
+        t = threading.Thread(target=worker,args=(started, cont, interrupted))
+        t.start()
+        while not started[0]:
+            pass
+        cont[0] = False
+        t.join()
+        self.assertTrue(interrupted[0])
 
 
 class AtexitTests(unittest.TestCase):
diff --git a/Lib/test/test_threading_local.py b/Lib/test/test_threading_local.py
index 2fd14ae..13facb5 100644
--- a/Lib/test/test_threading_local.py
+++ b/Lib/test/test_threading_local.py
@@ -2,6 +2,7 @@
 import unittest
 from doctest import DocTestSuite
 from test import support
+from test.support import threading_helper
 import weakref
 import gc
 
@@ -36,7 +37,7 @@
             t.join()
         del t
 
-        gc.collect()
+        support.gc_collect()  # For PyPy or other GCs.
         self.assertEqual(len(weaklist), n)
 
         # XXX _threading_local keeps the local of the last stopped thread alive.
@@ -45,7 +46,7 @@
 
         # Assignment to the same thread local frees it sometimes (!)
         local.someothervar = None
-        gc.collect()
+        support.gc_collect()  # For PyPy or other GCs.
         deadlist = [weak for weak in weaklist if weak() is None]
         self.assertIn(len(deadlist), (n-1, n), (n, len(deadlist)))
 
@@ -65,8 +66,8 @@
             # Simply check that the variable is correctly set
             self.assertEqual(local.x, i)
 
-        with support.start_threads(threading.Thread(target=f, args=(i,))
-                                   for i in range(10)):
+        with threading_helper.start_threads(threading.Thread(target=f, args=(i,))
+                                            for i in range(10)):
             pass
 
     def test_derived_cycle_dealloc(self):
@@ -88,7 +89,7 @@
             # 2) GC the cycle (triggers threadmodule.c::local_clear
             # before local_dealloc)
             del cycle
-            gc.collect()
+            support.gc_collect()  # For PyPy or other GCs.
             e1.set()
             e2.wait()
 
@@ -189,7 +190,7 @@
         x.local.x = x
         wr = weakref.ref(x)
         del x
-        gc.collect()
+        support.gc_collect()  # For PyPy or other GCs.
         self.assertIsNone(wr())
 
 
diff --git a/Lib/test/test_threadsignals.py b/Lib/test/test_threadsignals.py
index eeacd36..bac82b8 100644
--- a/Lib/test/test_threadsignals.py
+++ b/Lib/test/test_threadsignals.py
@@ -4,7 +4,7 @@
 import signal
 import os
 import sys
-from test import support
+from test.support import threading_helper
 import _thread as thread
 import time
 
@@ -39,7 +39,7 @@
 class ThreadSignals(unittest.TestCase):
 
     def test_signals(self):
-        with support.wait_threads_exit():
+        with threading_helper.wait_threads_exit():
             # Test signal handling semantics of threads.
             # We spawn a thread, have the thread send two signals, and
             # wait for it to finish. Check that we got both signals
@@ -129,7 +129,7 @@
             def other_thread():
                 rlock.acquire()
 
-            with support.wait_threads_exit():
+            with threading_helper.wait_threads_exit():
                 thread.start_new_thread(other_thread, ())
                 # Wait until we can't acquire it without blocking...
                 while rlock.acquire(blocking=False):
@@ -165,7 +165,7 @@
                 time.sleep(0.5)
                 lock.release()
 
-            with support.wait_threads_exit():
+            with threading_helper.wait_threads_exit():
                 thread.start_new_thread(other_thread, ())
                 # Wait until we can't acquire it without blocking...
                 while lock.acquire(blocking=False):
@@ -212,7 +212,7 @@
                     os.kill(process_pid, signal.SIGUSR1)
                 done.release()
 
-            with support.wait_threads_exit():
+            with threading_helper.wait_threads_exit():
                 # Send the signals from the non-main thread, since the main thread
                 # is the only one that can process signals.
                 thread.start_new_thread(send_signals, ())
@@ -230,7 +230,7 @@
             signal.signal(signal.SIGUSR1, old_handler)
 
 
-def test_main():
+def setUpModule():
     global signal_blackboard
 
     signal_blackboard = { signal.SIGUSR1 : {'tripped': 0, 'tripped_by': 0 },
@@ -238,10 +238,8 @@
                           signal.SIGALRM : {'tripped': 0, 'tripped_by': 0 } }
 
     oldsigs = registerSignals(handle_signals, handle_signals, handle_signals)
-    try:
-        support.run_unittest(ThreadSignals)
-    finally:
-        registerSignals(*oldsigs)
+    unittest.addModuleCleanup(registerSignals, *oldsigs)
+
 
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py
index 6674edc..7f76898 100644
--- a/Lib/test/test_time.py
+++ b/Lib/test/test_time.py
@@ -1,4 +1,5 @@
 from test import support
+from test.support import warnings_helper
 import decimal
 import enum
 import locale
@@ -112,12 +113,13 @@
         clk_id = time.pthread_getcpuclockid(threading.get_ident())
         self.assertTrue(type(clk_id) is int)
         # when in 32-bit mode AIX only returns the predefined constant
-        if not platform.system() == "AIX":
-            self.assertNotEqual(clk_id, time.CLOCK_THREAD_CPUTIME_ID)
-        elif (sys.maxsize.bit_length() > 32):
-            self.assertNotEqual(clk_id, time.CLOCK_THREAD_CPUTIME_ID)
-        else:
+        if platform.system() == "AIX" and (sys.maxsize.bit_length() <= 32):
             self.assertEqual(clk_id, time.CLOCK_THREAD_CPUTIME_ID)
+        # Solaris returns CLOCK_THREAD_CPUTIME_ID when current thread is given
+        elif sys.platform.startswith("sunos"):
+            self.assertEqual(clk_id, time.CLOCK_THREAD_CPUTIME_ID)
+        else:
+            self.assertNotEqual(clk_id, time.CLOCK_THREAD_CPUTIME_ID)
         t1 = time.clock_gettime(clk_id)
         t2 = time.clock_gettime(clk_id)
         self.assertLessEqual(t1, t2)
@@ -247,7 +249,7 @@
         # not change output based on its value and no test for year
         # because systems vary in their support for year 0.
         expected = "2000 01 01 00 00 00 1 001"
-        with support.check_warnings():
+        with warnings_helper.check_warnings():
             result = time.strftime("%Y %m %d %H %M %S %w %j", (2000,)+(0,)*8)
         self.assertEqual(expected, result)
 
@@ -435,8 +437,8 @@
     @unittest.skipUnless(platform.libc_ver()[0] != 'glibc',
                          "disabled because of a bug in glibc. Issue #13309")
     def test_mktime_error(self):
-        # It may not be possible to reliably make mktime return error
-        # on all platfom.  This will make sure that no other exception
+        # It may not be possible to reliably make mktime return an error
+        # on all platforms.  This will make sure that no other exception
         # than OverflowError is raised for an extreme value.
         tt = time.gmtime(self.t)
         tzname = time.strftime('%Z', tt)
@@ -543,20 +545,26 @@
         self.assertRaises(ValueError, time.ctime, float("nan"))
 
     def test_get_clock_info(self):
-        clocks = ['monotonic', 'perf_counter', 'process_time', 'time']
+        clocks = [
+            'monotonic',
+            'perf_counter',
+            'process_time',
+            'time',
+            'thread_time',
+        ]
 
         for name in clocks:
-            info = time.get_clock_info(name)
+            with self.subTest(name=name):
+                info = time.get_clock_info(name)
 
-            #self.assertIsInstance(info, dict)
-            self.assertIsInstance(info.implementation, str)
-            self.assertNotEqual(info.implementation, '')
-            self.assertIsInstance(info.monotonic, bool)
-            self.assertIsInstance(info.resolution, float)
-            # 0.0 < resolution <= 1.0
-            self.assertGreater(info.resolution, 0.0)
-            self.assertLessEqual(info.resolution, 1.0)
-            self.assertIsInstance(info.adjustable, bool)
+                self.assertIsInstance(info.implementation, str)
+                self.assertNotEqual(info.implementation, '')
+                self.assertIsInstance(info.monotonic, bool)
+                self.assertIsInstance(info.resolution, float)
+                # 0.0 < resolution <= 1.0
+                self.assertGreater(info.resolution, 0.0)
+                self.assertLessEqual(info.resolution, 1.0)
+                self.assertIsInstance(info.adjustable, bool)
 
         self.assertRaises(ValueError, time.get_clock_info, 'xxx')
 
diff --git a/Lib/test/test_timeit.py b/Lib/test/test_timeit.py
index e02d4a7..72a104f 100644
--- a/Lib/test/test_timeit.py
+++ b/Lib/test/test_timeit.py
@@ -77,6 +77,9 @@
         self.assertRaises(SyntaxError, timeit.Timer, stmt='break')
         self.assertRaises(SyntaxError, timeit.Timer, stmt='continue')
         self.assertRaises(SyntaxError, timeit.Timer, stmt='from timeit import *')
+        self.assertRaises(SyntaxError, timeit.Timer, stmt='  pass')
+        self.assertRaises(SyntaxError, timeit.Timer,
+                          setup='while False:\n  pass', stmt='  break')
 
     def test_timer_invalid_setup(self):
         self.assertRaises(ValueError, timeit.Timer, setup=None)
@@ -86,6 +89,12 @@
         self.assertRaises(SyntaxError, timeit.Timer, setup='break')
         self.assertRaises(SyntaxError, timeit.Timer, setup='continue')
         self.assertRaises(SyntaxError, timeit.Timer, setup='from timeit import *')
+        self.assertRaises(SyntaxError, timeit.Timer, setup='  pass')
+
+    def test_timer_empty_stmt(self):
+        timeit.Timer(stmt='')
+        timeit.Timer(stmt=' \n\t\f')
+        timeit.Timer(stmt='# comment')
 
     fake_setup = "import timeit\ntimeit._fake_timer.setup()"
     fake_stmt = "import timeit\ntimeit._fake_timer.inc()"
diff --git a/Lib/test/test_timeout.py b/Lib/test/test_timeout.py
index ac803f5..70a0175 100644
--- a/Lib/test/test_timeout.py
+++ b/Lib/test/test_timeout.py
@@ -122,7 +122,7 @@
         """
         Test the specified socket method.
 
-        The method is run at most `count` times and must raise a socket.timeout
+        The method is run at most `count` times and must raise a TimeoutError
         within `timeout` + self.fuzz seconds.
         """
         self.sock.settimeout(timeout)
@@ -131,11 +131,11 @@
             t1 = time.monotonic()
             try:
                 method(*args)
-            except socket.timeout as e:
+            except TimeoutError as e:
                 delta = time.monotonic() - t1
                 break
         else:
-            self.fail('socket.timeout was not raised')
+            self.fail('TimeoutError was not raised')
         # These checks should account for timing unprecision
         self.assertLess(delta, timeout + self.fuzz)
         self.assertGreater(delta, timeout - 1.0)
@@ -204,7 +204,7 @@
         sock.settimeout(timeout)
         try:
             sock.connect((whitehole))
-        except socket.timeout:
+        except TimeoutError:
             pass
         except OSError as err:
             if err.errno == errno.ECONNREFUSED:
@@ -290,13 +290,9 @@
         self._sock_operation(1, 1.5, 'recvfrom', 1024)
 
 
-def test_main():
+def setUpModule():
     support.requires('network')
-    support.run_unittest(
-        CreationTestCase,
-        TCPTimeoutTestCase,
-        UDPTimeoutTestCase,
-    )
+
 
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_tix.py b/Lib/test/test_tix.py
index e6ea3d0..454baeb 100644
--- a/Lib/test/test_tix.py
+++ b/Lib/test/test_tix.py
@@ -1,14 +1,22 @@
+import sys
 import unittest
 from test import support
-import sys
+from test.support import import_helper
+from test.support import check_sanitizer
+
+if check_sanitizer(address=True, memory=True):
+    raise unittest.SkipTest("Tests involvin libX11 can SEGFAULT on ASAN/MSAN builds")
+
 
 # Skip this test if the _tkinter module wasn't built.
-_tkinter = support.import_module('_tkinter')
+_tkinter = import_helper.import_module('_tkinter')
 
 # Skip test if tk cannot be initialized.
 support.requires('gui')
 
-from tkinter import tix, TclError
+# Suppress the deprecation warning
+tix = import_helper.import_module('tkinter.tix', deprecated=True)
+from tkinter import TclError
 
 
 class TestTix(unittest.TestCase):
diff --git a/Lib/test/test_tk.py b/Lib/test/test_tk.py
index 48cefd9..8f90cba 100644
--- a/Lib/test/test_tk.py
+++ b/Lib/test/test_tk.py
@@ -1,15 +1,20 @@
+import unittest
 from test import support
+from test.support import import_helper
+from test.support import check_sanitizer
+
+if check_sanitizer(address=True, memory=True):
+    raise unittest.SkipTest("Tests involvin libX11 can SEGFAULT on ASAN/MSAN builds")
+
 # Skip test if _tkinter wasn't built.
-support.import_module('_tkinter')
+import_helper.import_module('_tkinter')
 
 # Skip test if tk cannot be initialized.
 support.requires('gui')
 
-from tkinter.test import runtktests
+def load_tests(loader, tests, pattern):
+    return loader.discover('tkinter.test.test_tkinter')
 
-def test_main():
-    support.run_unittest(
-            *runtktests.get_tests(text=False, packages=['test_tkinter']))
 
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_tokenize.py b/Lib/test/test_tokenize.py
index 6de7aa8..127f0a1 100644
--- a/Lib/test/test_tokenize.py
+++ b/Lib/test/test_tokenize.py
@@ -1,10 +1,12 @@
 from test import support
+from test.support import os_helper
 from tokenize import (tokenize, _tokenize, untokenize, NUMBER, NAME, OP,
                      STRING, ENDMARKER, ENCODING, tok_name, detect_encoding,
                      open as tokenize_open, Untokenizer, generate_tokens,
                      NEWLINE)
 from io import BytesIO, StringIO
 import unittest
+from textwrap import dedent
 from unittest import TestCase, mock
 from test.test_grammar import (VALID_UNDERSCORE_LITERALS,
                                INVALID_UNDERSCORE_LITERALS)
@@ -44,7 +46,6 @@
         # The ENDMARKER and final NEWLINE are omitted.
         f = BytesIO(s.encode('utf-8'))
         result = stringify_tokens_from_source(tokenize(f.readline), s)
-
         self.assertEqual(result,
                          ["    ENCODING   'utf-8'       (0, 0) (0, 0)"] +
                          expected.rstrip().splitlines())
@@ -1265,8 +1266,8 @@
         self.assertEqual(consumed_lines, [b'print("#coding=fake")'])
 
     def test_open(self):
-        filename = support.TESTFN + '.py'
-        self.addCleanup(support.unlink, filename)
+        filename = os_helper.TESTFN + '.py'
+        self.addCleanup(os_helper.unlink, filename)
 
         # test coding cookie
         for encoding in ('iso-8859-15', 'utf-8'):
@@ -1457,6 +1458,16 @@
         # See http://bugs.python.org/issue16152
         self.assertExactTypeEqual('@          ', token.AT)
 
+    def test_comment_at_the_end_of_the_source_without_newline(self):
+        # See http://bugs.python.org/issue44667
+        source = 'b = 1\n\n#test'
+        expected_tokens = [token.NAME, token.EQUAL, token.NUMBER, token.NEWLINE, token.NL, token.COMMENT]
+
+        tokens = list(tokenize(BytesIO(source.encode('utf-8')).readline))
+        self.assertEqual(tok_name[tokens[0].exact_type], tok_name[ENCODING])
+        for i in range(6):
+            self.assertEqual(tok_name[tokens[i + 1].exact_type], tok_name[expected_tokens[i]])
+        self.assertEqual(tok_name[tokens[-1].exact_type], tok_name[token.ENDMARKER])
 
 class UntokenizeTest(TestCase):
 
diff --git a/Lib/test/test_tools/__init__.py b/Lib/test/test_tools/__init__.py
index eb9acad..34b0d3b 100644
--- a/Lib/test/test_tools/__init__.py
+++ b/Lib/test/test_tools/__init__.py
@@ -4,6 +4,14 @@
 import os.path
 import unittest
 from test import support
+from test.support import import_helper
+
+
+if support.check_sanitizer(address=True, memory=True):
+    # bpo-46633: Skip the test because it is too slow when Python is built
+    # with ASAN/MSAN: between 5 and 20 minutes on GitHub Actions.
+    raise unittest.SkipTest("test too slow on ASAN/MSAN build")
+
 
 basepath = os.path.normpath(
         os.path.dirname(                 # <src/install dir>
@@ -26,11 +34,11 @@
 @contextlib.contextmanager
 def imports_under_tool(name, *subdirs):
     tooldir = os.path.join(toolsdir, name, *subdirs)
-    with support.DirsOnSysPath(tooldir) as cm:
+    with import_helper.DirsOnSysPath(tooldir) as cm:
         yield cm
 
 def import_tool(toolname):
-    with support.DirsOnSysPath(scriptsdir):
+    with import_helper.DirsOnSysPath(scriptsdir):
         return importlib.import_module(toolname)
 
 def load_tests(*args):
diff --git a/Lib/test/test_tools/test_c_analyzer/__init__.py b/Lib/test/test_tools/test_c_analyzer/__init__.py
deleted file mode 100644
index d0b4c04..0000000
--- a/Lib/test/test_tools/test_c_analyzer/__init__.py
+++ /dev/null
@@ -1,15 +0,0 @@
-import contextlib
-import os.path
-import test.test_tools
-from test.support import load_package_tests
-
-
-@contextlib.contextmanager
-def tool_imports_for_tests():
-    test.test_tools.skip_if_missing('c-analyzer')
-    with test.test_tools.imports_under_tool('c-analyzer'):
-        yield
-
-
-def load_tests(*args):
-    return load_package_tests(os.path.dirname(__file__), *args)
diff --git a/Lib/test/test_tools/test_c_analyzer/__main__.py b/Lib/test/test_tools/test_c_analyzer/__main__.py
deleted file mode 100644
index b5b017d..0000000
--- a/Lib/test/test_tools/test_c_analyzer/__main__.py
+++ /dev/null
@@ -1,5 +0,0 @@
-from . import load_tests
-import unittest
-
-
-unittest.main()
diff --git a/Lib/test/test_tools/test_c_analyzer/test_common/__init__.py b/Lib/test/test_tools/test_c_analyzer/test_common/__init__.py
deleted file mode 100644
index bc502ef..0000000
--- a/Lib/test/test_tools/test_c_analyzer/test_common/__init__.py
+++ /dev/null
@@ -1,6 +0,0 @@
-import os.path
-from test.support import load_package_tests
-
-
-def load_tests(*args):
-    return load_package_tests(os.path.dirname(__file__), *args)
diff --git a/Lib/test/test_tools/test_c_analyzer/test_common/test_files.py b/Lib/test/test_tools/test_c_analyzer/test_common/test_files.py
deleted file mode 100644
index 0c97d2a..0000000
--- a/Lib/test/test_tools/test_c_analyzer/test_common/test_files.py
+++ /dev/null
@@ -1,470 +0,0 @@
-import os.path
-import unittest
-
-from .. import tool_imports_for_tests
-with tool_imports_for_tests():
-    from c_analyzer.common.files import (
-            iter_files, _walk_tree, glob_tree,
-            )
-
-
-def fixpath(filename):
-    return filename.replace('/', os.path.sep)
-
-
-class IterFilesTests(unittest.TestCase):
-
-    maxDiff = None
-
-    _return_walk = None
-
-    @property
-    def calls(self):
-        try:
-            return self._calls
-        except AttributeError:
-            self._calls = []
-            return self._calls
-
-    def set_files(self, *filesperroot):
-        roots = []
-        result = []
-        for root, files in filesperroot:
-            root = fixpath(root)
-            roots.append(root)
-            result.append([os.path.join(root, fixpath(f))
-                           for f in files])
-        self._return_walk = result
-        return roots
-
-    def _walk(self, root, *, suffix=None, walk=None):
-        self.calls.append(('_walk', (root, suffix, walk)))
-        return iter(self._return_walk.pop(0))
-
-    def _glob(self, root, *, suffix=None):
-        self.calls.append(('_glob', (root, suffix)))
-        return iter(self._return_walk.pop(0))
-
-    def test_typical(self):
-        dirnames = self.set_files(
-            ('spam', ['file1.c', 'file2.c']),
-            ('eggs', ['ham/file3.h']),
-            )
-        suffixes = ('.c', '.h')
-
-        files = list(iter_files(dirnames, suffixes,
-                                _glob=self._glob,
-                                _walk=self._walk))
-
-        self.assertEqual(files, [
-            fixpath('spam/file1.c'),
-            fixpath('spam/file2.c'),
-            fixpath('eggs/ham/file3.h'),
-            ])
-        self.assertEqual(self.calls, [
-            ('_walk', ('spam', None, _walk_tree)),
-            ('_walk', ('eggs', None, _walk_tree)),
-            ])
-
-    def test_single_root(self):
-        self._return_walk = [
-                [fixpath('spam/file1.c'), fixpath('spam/file2.c')],
-                ]
-
-        files = list(iter_files('spam', '.c',
-                                _glob=self._glob,
-                                _walk=self._walk))
-
-        self.assertEqual(files, [
-            fixpath('spam/file1.c'),
-            fixpath('spam/file2.c'),
-            ])
-        self.assertEqual(self.calls, [
-            ('_walk', ('spam', '.c', _walk_tree)),
-            ])
-
-    def test_one_root(self):
-        self._return_walk = [
-                [fixpath('spam/file1.c'), fixpath('spam/file2.c')],
-                ]
-
-        files = list(iter_files(['spam'], '.c',
-                                _glob=self._glob,
-                                _walk=self._walk))
-
-        self.assertEqual(files, [
-            fixpath('spam/file1.c'),
-            fixpath('spam/file2.c'),
-            ])
-        self.assertEqual(self.calls, [
-            ('_walk', ('spam', '.c', _walk_tree)),
-            ])
-
-    def test_multiple_roots(self):
-        dirnames = self.set_files(
-            ('spam', ['file1.c', 'file2.c']),
-            ('eggs', ['ham/file3.c']),
-            )
-
-        files = list(iter_files(dirnames, '.c',
-                                _glob=self._glob,
-                                _walk=self._walk))
-
-        self.assertEqual(files, [
-            fixpath('spam/file1.c'),
-            fixpath('spam/file2.c'),
-            fixpath('eggs/ham/file3.c'),
-            ])
-        self.assertEqual(self.calls, [
-            ('_walk', ('spam', '.c', _walk_tree)),
-            ('_walk', ('eggs', '.c', _walk_tree)),
-            ])
-
-    def test_no_roots(self):
-        files = list(iter_files([], '.c',
-                                _glob=self._glob,
-                                _walk=self._walk))
-
-        self.assertEqual(files, [])
-        self.assertEqual(self.calls, [])
-
-    def test_single_suffix(self):
-        self._return_walk = [
-                [fixpath('spam/file1.c'),
-                 fixpath('spam/eggs/file3.c'),
-                 ],
-                ]
-
-        files = list(iter_files('spam', '.c',
-                                _glob=self._glob,
-                                _walk=self._walk))
-
-        self.assertEqual(files, [
-            fixpath('spam/file1.c'),
-            fixpath('spam/eggs/file3.c'),
-            ])
-        self.assertEqual(self.calls, [
-            ('_walk', ('spam', '.c', _walk_tree)),
-            ])
-
-    def test_one_suffix(self):
-        self._return_walk = [
-                [fixpath('spam/file1.c'),
-                 fixpath('spam/file1.h'),
-                 fixpath('spam/file1.o'),
-                 fixpath('spam/eggs/file3.c'),
-                 ],
-                ]
-
-        files = list(iter_files('spam', ['.c'],
-                                _glob=self._glob,
-                                _walk=self._walk))
-
-        self.assertEqual(files, [
-            fixpath('spam/file1.c'),
-            fixpath('spam/eggs/file3.c'),
-            ])
-        self.assertEqual(self.calls, [
-            ('_walk', ('spam', None, _walk_tree)),
-            ])
-
-    def test_multiple_suffixes(self):
-        self._return_walk = [
-                [fixpath('spam/file1.c'),
-                 fixpath('spam/file1.h'),
-                 fixpath('spam/file1.o'),
-                 fixpath('spam/eggs/file3.c'),
-                 ],
-                ]
-
-        files = list(iter_files('spam', ('.c', '.h'),
-                                _glob=self._glob,
-                                _walk=self._walk))
-
-        self.assertEqual(files, [
-            fixpath('spam/file1.c'),
-            fixpath('spam/file1.h'),
-            fixpath('spam/eggs/file3.c'),
-            ])
-        self.assertEqual(self.calls, [
-            ('_walk', ('spam', None, _walk_tree)),
-            ])
-
-    def test_no_suffix(self):
-        expected = [fixpath('spam/file1.c'),
-                    fixpath('spam/file1.h'),
-                    fixpath('spam/file1.o'),
-                    fixpath('spam/eggs/file3.c'),
-                    ]
-        for suffix in (None, '', ()):
-            with self.subTest(suffix):
-                self.calls.clear()
-                self._return_walk = [list(expected)]
-
-                files = list(iter_files('spam', suffix,
-                                        _glob=self._glob,
-                                        _walk=self._walk))
-
-                self.assertEqual(files, expected)
-                self.assertEqual(self.calls, [
-                    ('_walk', ('spam', suffix, _walk_tree)),
-                    ])
-
-    def test_relparent(self):
-        dirnames = self.set_files(
-            ('/x/y/z/spam', ['file1.c', 'file2.c']),
-            ('/x/y/z/eggs', ['ham/file3.c']),
-            )
-
-        files = list(iter_files(dirnames, '.c', fixpath('/x/y'),
-                                _glob=self._glob,
-                                _walk=self._walk))
-
-        self.assertEqual(files, [
-            fixpath('z/spam/file1.c'),
-            fixpath('z/spam/file2.c'),
-            fixpath('z/eggs/ham/file3.c'),
-            ])
-        self.assertEqual(self.calls, [
-            ('_walk', (fixpath('/x/y/z/spam'), '.c', _walk_tree)),
-            ('_walk', (fixpath('/x/y/z/eggs'), '.c', _walk_tree)),
-            ])
-
-    def test_glob(self):
-        dirnames = self.set_files(
-            ('spam', ['file1.c', 'file2.c']),
-            ('eggs', ['ham/file3.c']),
-            )
-
-        files = list(iter_files(dirnames, '.c',
-                                get_files=glob_tree,
-                                _walk=self._walk,
-                                _glob=self._glob))
-
-        self.assertEqual(files, [
-            fixpath('spam/file1.c'),
-            fixpath('spam/file2.c'),
-            fixpath('eggs/ham/file3.c'),
-            ])
-        self.assertEqual(self.calls, [
-            ('_glob', ('spam', '.c')),
-            ('_glob', ('eggs', '.c')),
-            ])
-
-
-    def test_alt_walk_func(self):
-        dirnames = self.set_files(
-            ('spam', ['file1.c', 'file2.c']),
-            ('eggs', ['ham/file3.c']),
-            )
-        def get_files(root):
-            return None
-
-        files = list(iter_files(dirnames, '.c',
-                                get_files=get_files,
-                                _walk=self._walk,
-                                _glob=self._glob))
-
-        self.assertEqual(files, [
-            fixpath('spam/file1.c'),
-            fixpath('spam/file2.c'),
-            fixpath('eggs/ham/file3.c'),
-            ])
-        self.assertEqual(self.calls, [
-            ('_walk', ('spam', '.c', get_files)),
-            ('_walk', ('eggs', '.c', get_files)),
-            ])
-
-
-
-
-
-
-#    def test_no_dirnames(self):
-#        dirnames = []
-#        filter_by_name = None
-#
-#        files = list(iter_files(dirnames, filter_by_name,
-#                                _walk=self._walk))
-#
-#        self.assertEqual(files, [])
-#        self.assertEqual(self.calls, [])
-#
-#    def test_no_filter(self):
-#        self._return_walk = [
-#                [('spam', (), ('file1', 'file2.c', 'file3.h', 'file4.o')),
-#                 ],
-#                ]
-#        dirnames = [
-#                'spam',
-#                ]
-#        filter_by_name = None
-#
-#        files = list(iter_files(dirnames, filter_by_name,
-#                                _walk=self._walk))
-#
-#        self.assertEqual(files, [
-#            fixpath('spam/file1'),
-#            fixpath('spam/file2.c'),
-#            fixpath('spam/file3.h'),
-#            fixpath('spam/file4.o'),
-#            ])
-#        self.assertEqual(self.calls, [
-#            ('_walk', ('spam',)),
-#            ])
-#
-#    def test_no_files(self):
-#        self._return_walk = [
-#                [('spam', (), ()),
-#                 ],
-#                [(fixpath('eggs/ham'), (), ()),
-#                 ],
-#                ]
-#        dirnames = [
-#                'spam',
-#                fixpath('eggs/ham'),
-#                ]
-#        filter_by_name = None
-#
-#        files = list(iter_files(dirnames, filter_by_name,
-#                                _walk=self._walk))
-#
-#        self.assertEqual(files, [])
-#        self.assertEqual(self.calls, [
-#            ('_walk', ('spam',)),
-#            ('_walk', (fixpath('eggs/ham'),)),
-#            ])
-#
-#    def test_tree(self):
-#        self._return_walk = [
-#                [('spam', ('sub1', 'sub2', 'sub3'), ('file1',)),
-#                 (fixpath('spam/sub1'), ('sub1sub1',), ('file2', 'file3')),
-#                 (fixpath('spam/sub1/sub1sub1'), (), ('file4',)),
-#                 (fixpath('spam/sub2'), (), ()),
-#                 (fixpath('spam/sub3'), (), ('file5',)),
-#                 ],
-#                [(fixpath('eggs/ham'), (), ('file6',)),
-#                 ],
-#                ]
-#        dirnames = [
-#                'spam',
-#                fixpath('eggs/ham'),
-#                ]
-#        filter_by_name = None
-#
-#        files = list(iter_files(dirnames, filter_by_name,
-#                                _walk=self._walk))
-#
-#        self.assertEqual(files, [
-#            fixpath('spam/file1'),
-#            fixpath('spam/sub1/file2'),
-#            fixpath('spam/sub1/file3'),
-#            fixpath('spam/sub1/sub1sub1/file4'),
-#            fixpath('spam/sub3/file5'),
-#            fixpath('eggs/ham/file6'),
-#            ])
-#        self.assertEqual(self.calls, [
-#            ('_walk', ('spam',)),
-#            ('_walk', (fixpath('eggs/ham'),)),
-#            ])
-#
-#    def test_filter_suffixes(self):
-#        self._return_walk = [
-#                [('spam', (), ('file1', 'file2.c', 'file3.h', 'file4.o')),
-#                 ],
-#                ]
-#        dirnames = [
-#                'spam',
-#                ]
-#        filter_by_name = ('.c', '.h')
-#
-#        files = list(iter_files(dirnames, filter_by_name,
-#                                _walk=self._walk))
-#
-#        self.assertEqual(files, [
-#            fixpath('spam/file2.c'),
-#            fixpath('spam/file3.h'),
-#            ])
-#        self.assertEqual(self.calls, [
-#            ('_walk', ('spam',)),
-#            ])
-#
-#    def test_some_filtered(self):
-#        self._return_walk = [
-#                [('spam', (), ('file1', 'file2', 'file3', 'file4')),
-#                 ],
-#                ]
-#        dirnames = [
-#                'spam',
-#                ]
-#        def filter_by_name(filename, results=[False, True, False, True]):
-#            self.calls.append(('filter_by_name', (filename,)))
-#            return results.pop(0)
-#
-#        files = list(iter_files(dirnames, filter_by_name,
-#                                _walk=self._walk))
-#
-#        self.assertEqual(files, [
-#            fixpath('spam/file2'),
-#            fixpath('spam/file4'),
-#            ])
-#        self.assertEqual(self.calls, [
-#            ('_walk', ('spam',)),
-#            ('filter_by_name', ('file1',)),
-#            ('filter_by_name', ('file2',)),
-#            ('filter_by_name', ('file3',)),
-#            ('filter_by_name', ('file4',)),
-#            ])
-#
-#    def test_none_filtered(self):
-#        self._return_walk = [
-#                [('spam', (), ('file1', 'file2', 'file3', 'file4')),
-#                 ],
-#                ]
-#        dirnames = [
-#                'spam',
-#                ]
-#        def filter_by_name(filename, results=[True, True, True, True]):
-#            self.calls.append(('filter_by_name', (filename,)))
-#            return results.pop(0)
-#
-#        files = list(iter_files(dirnames, filter_by_name,
-#                                _walk=self._walk))
-#
-#        self.assertEqual(files, [
-#            fixpath('spam/file1'),
-#            fixpath('spam/file2'),
-#            fixpath('spam/file3'),
-#            fixpath('spam/file4'),
-#            ])
-#        self.assertEqual(self.calls, [
-#            ('_walk', ('spam',)),
-#            ('filter_by_name', ('file1',)),
-#            ('filter_by_name', ('file2',)),
-#            ('filter_by_name', ('file3',)),
-#            ('filter_by_name', ('file4',)),
-#            ])
-#
-#    def test_all_filtered(self):
-#        self._return_walk = [
-#                [('spam', (), ('file1', 'file2', 'file3', 'file4')),
-#                 ],
-#                ]
-#        dirnames = [
-#                'spam',
-#                ]
-#        def filter_by_name(filename, results=[False, False, False, False]):
-#            self.calls.append(('filter_by_name', (filename,)))
-#            return results.pop(0)
-#
-#        files = list(iter_files(dirnames, filter_by_name,
-#                                _walk=self._walk))
-#
-#        self.assertEqual(files, [])
-#        self.assertEqual(self.calls, [
-#            ('_walk', ('spam',)),
-#            ('filter_by_name', ('file1',)),
-#            ('filter_by_name', ('file2',)),
-#            ('filter_by_name', ('file3',)),
-#            ('filter_by_name', ('file4',)),
-#            ])
diff --git a/Lib/test/test_tools/test_c_analyzer/test_common/test_info.py b/Lib/test/test_tools/test_c_analyzer/test_common/test_info.py
deleted file mode 100644
index 69dbb58..0000000
--- a/Lib/test/test_tools/test_c_analyzer/test_common/test_info.py
+++ /dev/null
@@ -1,197 +0,0 @@
-import string
-import unittest
-
-from ..util import PseudoStr, StrProxy, Object
-from .. import tool_imports_for_tests
-with tool_imports_for_tests():
-    from c_analyzer.common.info import (
-            UNKNOWN,
-            ID,
-            )
-
-
-class IDTests(unittest.TestCase):
-
-    VALID_ARGS = (
-            'x/y/z/spam.c',
-            'func',
-            'eggs',
-            )
-    VALID_KWARGS = dict(zip(ID._fields, VALID_ARGS))
-    VALID_EXPECTED = VALID_ARGS
-
-    def test_from_raw(self):
-        tests = [
-            ('', None),
-            (None, None),
-            ('spam', (None, None, 'spam')),
-            (('spam',), (None, None, 'spam')),
-            (('x/y/z/spam.c', 'spam'), ('x/y/z/spam.c', None, 'spam')),
-            (self.VALID_ARGS, self.VALID_EXPECTED),
-            (self.VALID_KWARGS, self.VALID_EXPECTED),
-            ]
-        for raw, expected in tests:
-            with self.subTest(raw):
-                id = ID.from_raw(raw)
-
-                self.assertEqual(id, expected)
-
-    def test_minimal(self):
-        id = ID(
-                filename=None,
-                funcname=None,
-                name='eggs',
-                )
-
-        self.assertEqual(id, (
-                None,
-                None,
-                'eggs',
-                ))
-
-    def test_init_typical_global(self):
-        id = ID(
-                filename='x/y/z/spam.c',
-                funcname=None,
-                name='eggs',
-                )
-
-        self.assertEqual(id, (
-                'x/y/z/spam.c',
-                None,
-                'eggs',
-                ))
-
-    def test_init_typical_local(self):
-        id = ID(
-                filename='x/y/z/spam.c',
-                funcname='func',
-                name='eggs',
-                )
-
-        self.assertEqual(id, (
-                'x/y/z/spam.c',
-                'func',
-                'eggs',
-                ))
-
-    def test_init_all_missing(self):
-        for value in ('', None):
-            with self.subTest(repr(value)):
-                id = ID(
-                        filename=value,
-                        funcname=value,
-                        name=value,
-                        )
-
-                self.assertEqual(id, (
-                        None,
-                        None,
-                        None,
-                        ))
-
-    def test_init_all_coerced(self):
-        tests = [
-            ('str subclass',
-             dict(
-                 filename=PseudoStr('x/y/z/spam.c'),
-                 funcname=PseudoStr('func'),
-                 name=PseudoStr('eggs'),
-                 ),
-             ('x/y/z/spam.c',
-              'func',
-              'eggs',
-              )),
-            ('non-str',
-             dict(
-                 filename=StrProxy('x/y/z/spam.c'),
-                 funcname=Object(),
-                 name=('a', 'b', 'c'),
-                 ),
-             ('x/y/z/spam.c',
-              '<object>',
-              "('a', 'b', 'c')",
-              )),
-            ]
-        for summary, kwargs, expected in tests:
-            with self.subTest(summary):
-                id = ID(**kwargs)
-
-                for field in ID._fields:
-                    value = getattr(id, field)
-                    self.assertIs(type(value), str)
-                self.assertEqual(tuple(id), expected)
-
-    def test_iterable(self):
-        id = ID(**self.VALID_KWARGS)
-
-        filename, funcname, name = id
-
-        values = (filename, funcname, name)
-        for value, expected in zip(values, self.VALID_EXPECTED):
-            self.assertEqual(value, expected)
-
-    def test_fields(self):
-        id = ID('a', 'b', 'z')
-
-        self.assertEqual(id.filename, 'a')
-        self.assertEqual(id.funcname, 'b')
-        self.assertEqual(id.name, 'z')
-
-    def test_validate_typical(self):
-        id = ID(
-                filename='x/y/z/spam.c',
-                funcname='func',
-                name='eggs',
-                )
-
-        id.validate()  # This does not fail.
-
-    def test_validate_missing_field(self):
-        for field in ID._fields:
-            with self.subTest(field):
-                id = ID(**self.VALID_KWARGS)
-                id = id._replace(**{field: None})
-
-                if field == 'funcname':
-                    id.validate()  # The field can be missing (not set).
-                    id = id._replace(filename=None)
-                    id.validate()  # Both fields can be missing (not set).
-                    continue
-
-                with self.assertRaises(TypeError):
-                    id.validate()
-
-    def test_validate_bad_field(self):
-        badch = tuple(c for c in string.punctuation + string.digits)
-        notnames = (
-                '1a',
-                'a.b',
-                'a-b',
-                '&a',
-                'a++',
-                ) + badch
-        tests = [
-            ('filename', ()),  # Any non-empty str is okay.
-            ('funcname', notnames),
-            ('name', notnames),
-            ]
-        seen = set()
-        for field, invalid in tests:
-            for value in invalid:
-                seen.add(value)
-                with self.subTest(f'{field}={value!r}'):
-                    id = ID(**self.VALID_KWARGS)
-                    id = id._replace(**{field: value})
-
-                    with self.assertRaises(ValueError):
-                        id.validate()
-
-        for field, invalid in tests:
-            valid = seen - set(invalid)
-            for value in valid:
-                with self.subTest(f'{field}={value!r}'):
-                    id = ID(**self.VALID_KWARGS)
-                    id = id._replace(**{field: value})
-
-                    id.validate()  # This does not fail.
diff --git a/Lib/test/test_tools/test_c_analyzer/test_common/test_show.py b/Lib/test/test_tools/test_c_analyzer/test_common/test_show.py
deleted file mode 100644
index 91ca2f3..0000000
--- a/Lib/test/test_tools/test_c_analyzer/test_common/test_show.py
+++ /dev/null
@@ -1,54 +0,0 @@
-import unittest
-
-from .. import tool_imports_for_tests
-with tool_imports_for_tests():
-    from c_analyzer.variables import info
-    from c_analyzer.common.show import (
-            basic,
-            )
-
-
-TYPICAL = [
-        info.Variable.from_parts('src1/spam.c', None, 'var1', 'static const char *'),
-        info.Variable.from_parts('src1/spam.c', 'ham', 'initialized', 'static int'),
-        info.Variable.from_parts('src1/spam.c', None, 'var2', 'static PyObject *'),
-        info.Variable.from_parts('src1/eggs.c', 'tofu', 'ready', 'static int'),
-        info.Variable.from_parts('src1/spam.c', None, 'freelist', 'static (PyTupleObject *)[10]'),
-        info.Variable.from_parts('src1/sub/ham.c', None, 'var1', 'static const char const *'),
-        info.Variable.from_parts('src2/jam.c', None, 'var1', 'static int'),
-        info.Variable.from_parts('src2/jam.c', None, 'var2', 'static MyObject *'),
-        info.Variable.from_parts('Include/spam.h', None, 'data', 'static const int'),
-        ]
-
-
-class BasicTests(unittest.TestCase):
-
-    maxDiff = None
-
-    def setUp(self):
-        self.lines = []
-
-    def print(self, line):
-        self.lines.append(line)
-
-    def test_typical(self):
-        basic(TYPICAL,
-              _print=self.print)
-
-        self.assertEqual(self.lines, [
-            'src1/spam.c:var1                                                 static const char *',
-            'src1/spam.c:ham():initialized                                    static int',
-            'src1/spam.c:var2                                                 static PyObject *',
-            'src1/eggs.c:tofu():ready                                         static int',
-            'src1/spam.c:freelist                                             static (PyTupleObject *)[10]',
-            'src1/sub/ham.c:var1                                              static const char const *',
-            'src2/jam.c:var1                                                  static int',
-            'src2/jam.c:var2                                                  static MyObject *',
-            'Include/spam.h:data                                              static const int',
-            ])
-
-    def test_no_rows(self):
-        basic([],
-              _print=self.print)
-
-        self.assertEqual(self.lines, [])
diff --git a/Lib/test/test_tools/test_c_analyzer/test_cpython/__init__.py b/Lib/test/test_tools/test_c_analyzer/test_cpython/__init__.py
deleted file mode 100644
index bc502ef..0000000
--- a/Lib/test/test_tools/test_c_analyzer/test_cpython/__init__.py
+++ /dev/null
@@ -1,6 +0,0 @@
-import os.path
-from test.support import load_package_tests
-
-
-def load_tests(*args):
-    return load_package_tests(os.path.dirname(__file__), *args)
diff --git a/Lib/test/test_tools/test_c_analyzer/test_cpython/test___main__.py b/Lib/test/test_tools/test_c_analyzer/test_cpython/test___main__.py
deleted file mode 100644
index 6d69ed7..0000000
--- a/Lib/test/test_tools/test_c_analyzer/test_cpython/test___main__.py
+++ /dev/null
@@ -1,296 +0,0 @@
-import sys
-import unittest
-
-from .. import tool_imports_for_tests
-with tool_imports_for_tests():
-    from c_analyzer.variables import info
-    from cpython import SOURCE_DIRS
-    from cpython.supported import IGNORED_FILE
-    from cpython.known import DATA_FILE as KNOWN_FILE
-    from cpython.__main__ import (
-            cmd_check, cmd_show, parse_args, main,
-            )
-
-
-TYPICAL = [
-        (info.Variable.from_parts('src1/spam.c', None, 'var1', 'const char *'),
-         True,
-         ),
-        (info.Variable.from_parts('src1/spam.c', 'ham', 'initialized', 'int'),
-         True,
-         ),
-        (info.Variable.from_parts('src1/spam.c', None, 'var2', 'PyObject *'),
-         False,
-         ),
-        (info.Variable.from_parts('src1/eggs.c', 'tofu', 'ready', 'int'),
-         True,
-         ),
-        (info.Variable.from_parts('src1/spam.c', None, 'freelist', '(PyTupleObject *)[10]'),
-         False,
-         ),
-        (info.Variable.from_parts('src1/sub/ham.c', None, 'var1', 'const char const *'),
-         True,
-         ),
-        (info.Variable.from_parts('src2/jam.c', None, 'var1', 'int'),
-         True,
-         ),
-        (info.Variable.from_parts('src2/jam.c', None, 'var2', 'MyObject *'),
-         False,
-         ),
-        (info.Variable.from_parts('Include/spam.h', None, 'data', 'const int'),
-         True,
-         ),
-        ]
-
-
-class CMDBase(unittest.TestCase):
-
-    maxDiff = None
-
-#    _return_known_from_file = None
-#    _return_ignored_from_file = None
-    _return_find = ()
-
-    @property
-    def calls(self):
-        try:
-            return self._calls
-        except AttributeError:
-            self._calls = []
-            return self._calls
-
-#    def _known_from_file(self, *args):
-#        self.calls.append(('_known_from_file', args))
-#        return self._return_known_from_file or {}
-#
-#    def _ignored_from_file(self, *args):
-#        self.calls.append(('_ignored_from_file', args))
-#        return self._return_ignored_from_file or {}
-
-    def _find(self, known, ignored, skip_objects=False):
-        self.calls.append(('_find', (known, ignored, skip_objects)))
-        return self._return_find
-
-    def _show(self, *args):
-        self.calls.append(('_show', args))
-
-    def _print(self, *args):
-        self.calls.append(('_print', args))
-
-
-class CheckTests(CMDBase):
-
-    def test_defaults(self):
-        self._return_find = []
-
-        cmd_check('check',
-                  _find=self._find,
-                  _show=self._show,
-                  _print=self._print,
-                  )
-
-        self.assertEqual(
-                self.calls[0],
-                ('_find', (KNOWN_FILE, IGNORED_FILE, False)),
-                )
-
-    def test_all_supported(self):
-        self._return_find = [(v, s) for v, s in TYPICAL if s]
-        dirs = ['src1', 'src2', 'Include']
-
-        cmd_check('check',
-                  known='known.tsv',
-                  ignored='ignored.tsv',
-                  _find=self._find,
-                  _show=self._show,
-                  _print=self._print,
-                  )
-
-        self.assertEqual(self.calls, [
-            ('_find', ('known.tsv', 'ignored.tsv', False)),
-            #('_print', ('okay',)),
-            ])
-
-    def test_some_unsupported(self):
-        self._return_find = TYPICAL
-
-        with self.assertRaises(SystemExit) as cm:
-            cmd_check('check',
-                      known='known.tsv',
-                      ignored='ignored.tsv',
-                      _find=self._find,
-                      _show=self._show,
-                      _print=self._print,
-                      )
-
-        unsupported = [v for v, s in TYPICAL if not s]
-        self.assertEqual(self.calls, [
-            ('_find', ('known.tsv', 'ignored.tsv', False)),
-            ('_print', ('ERROR: found unsupported global variables',)),
-            ('_print', ()),
-            ('_show', (sorted(unsupported),)),
-            ('_print', (' (3 total)',)),
-            ])
-        self.assertEqual(cm.exception.code, 1)
-
-
-class ShowTests(CMDBase):
-
-    def test_defaults(self):
-        self._return_find = []
-
-        cmd_show('show',
-                 _find=self._find,
-                 _show=self._show,
-                 _print=self._print,
-                 )
-
-        self.assertEqual(
-                self.calls[0],
-                ('_find', (KNOWN_FILE, IGNORED_FILE, False)),
-                )
-
-    def test_typical(self):
-        self._return_find = TYPICAL
-
-        cmd_show('show',
-                 known='known.tsv',
-                 ignored='ignored.tsv',
-                 _find=self._find,
-                 _show=self._show,
-                 _print=self._print,
-                 )
-
-        supported = [v for v, s in TYPICAL if s]
-        unsupported = [v for v, s in TYPICAL if not s]
-        self.assertEqual(self.calls, [
-            ('_find', ('known.tsv', 'ignored.tsv', False)),
-            ('_print', ('supported:',)),
-            ('_print', ('----------',)),
-            ('_show', (sorted(supported),)),
-            ('_print', (' (6 total)',)),
-            ('_print', ()),
-            ('_print', ('unsupported:',)),
-            ('_print', ('------------',)),
-            ('_show', (sorted(unsupported),)),
-            ('_print', (' (3 total)',)),
-            ])
-
-
-class ParseArgsTests(unittest.TestCase):
-
-    maxDiff = None
-
-    def test_no_args(self):
-        self.errmsg = None
-        def fail(msg):
-            self.errmsg = msg
-            sys.exit(msg)
-
-        with self.assertRaises(SystemExit):
-            parse_args('cg', [], _fail=fail)
-
-        self.assertEqual(self.errmsg, 'missing command')
-
-    def test_check_no_args(self):
-        cmd, cmdkwargs = parse_args('cg', [
-            'check',
-            ])
-
-        self.assertEqual(cmd, 'check')
-        self.assertEqual(cmdkwargs, {
-            'ignored': IGNORED_FILE,
-            'known': KNOWN_FILE,
-            #'dirs': SOURCE_DIRS,
-            })
-
-    def test_check_full_args(self):
-        cmd, cmdkwargs = parse_args('cg', [
-            'check',
-            '--ignored', 'spam.tsv',
-            '--known', 'eggs.tsv',
-            #'dir1',
-            #'dir2',
-            #'dir3',
-            ])
-
-        self.assertEqual(cmd, 'check')
-        self.assertEqual(cmdkwargs, {
-            'ignored': 'spam.tsv',
-            'known': 'eggs.tsv',
-            #'dirs': ['dir1', 'dir2', 'dir3']
-            })
-
-    def test_show_no_args(self):
-        cmd, cmdkwargs = parse_args('cg', [
-            'show',
-            ])
-
-        self.assertEqual(cmd, 'show')
-        self.assertEqual(cmdkwargs, {
-            'ignored': IGNORED_FILE,
-            'known': KNOWN_FILE,
-            #'dirs': SOURCE_DIRS,
-            'skip_objects': False,
-            })
-
-    def test_show_full_args(self):
-        cmd, cmdkwargs = parse_args('cg', [
-            'show',
-            '--ignored', 'spam.tsv',
-            '--known', 'eggs.tsv',
-            #'dir1',
-            #'dir2',
-            #'dir3',
-            ])
-
-        self.assertEqual(cmd, 'show')
-        self.assertEqual(cmdkwargs, {
-            'ignored': 'spam.tsv',
-            'known': 'eggs.tsv',
-            #'dirs': ['dir1', 'dir2', 'dir3'],
-            'skip_objects': False,
-            })
-
-
-def new_stub_commands(*names):
-    calls = []
-    def cmdfunc(cmd, **kwargs):
-        calls.append((cmd, kwargs))
-    commands = {name: cmdfunc for name in names}
-    return commands, calls
-
-
-class MainTests(unittest.TestCase):
-
-    def test_no_command(self):
-        with self.assertRaises(ValueError):
-            main(None, {})
-
-    def test_check(self):
-        commands, calls = new_stub_commands('check', 'show')
-
-        cmdkwargs = {
-            'ignored': 'spam.tsv',
-            'known': 'eggs.tsv',
-            'dirs': ['dir1', 'dir2', 'dir3'],
-            }
-        main('check', cmdkwargs, _COMMANDS=commands)
-
-        self.assertEqual(calls, [
-            ('check', cmdkwargs),
-            ])
-
-    def test_show(self):
-        commands, calls = new_stub_commands('check', 'show')
-
-        cmdkwargs = {
-            'ignored': 'spam.tsv',
-            'known': 'eggs.tsv',
-            'dirs': ['dir1', 'dir2', 'dir3'],
-            }
-        main('show', cmdkwargs, _COMMANDS=commands)
-
-        self.assertEqual(calls, [
-            ('show', cmdkwargs),
-            ])
diff --git a/Lib/test/test_tools/test_c_analyzer/test_cpython/test_functional.py b/Lib/test/test_tools/test_c_analyzer/test_cpython/test_functional.py
deleted file mode 100644
index 9279790..0000000
--- a/Lib/test/test_tools/test_c_analyzer/test_cpython/test_functional.py
+++ /dev/null
@@ -1,34 +0,0 @@
-import unittest
-
-from .. import tool_imports_for_tests
-with tool_imports_for_tests():
-    pass
-
-
-class SelfCheckTests(unittest.TestCase):
-
-    @unittest.expectedFailure
-    def test_known(self):
-        # Make sure known macros & vartypes aren't hiding unknown local types.
-        # XXX finish!
-        raise NotImplementedError
-
-    @unittest.expectedFailure
-    def test_compare_nm_results(self):
-        # Make sure the "show" results match the statics found by "nm" command.
-        # XXX Skip if "nm" is not available.
-        # XXX finish!
-        raise NotImplementedError
-
-
-class DummySourceTests(unittest.TestCase):
-
-    @unittest.expectedFailure
-    def test_check(self):
-        # XXX finish!
-        raise NotImplementedError
-
-    @unittest.expectedFailure
-    def test_show(self):
-        # XXX finish!
-        raise NotImplementedError
diff --git a/Lib/test/test_tools/test_c_analyzer/test_cpython/test_supported.py b/Lib/test/test_tools/test_c_analyzer/test_cpython/test_supported.py
deleted file mode 100644
index a244b97..0000000
--- a/Lib/test/test_tools/test_c_analyzer/test_cpython/test_supported.py
+++ /dev/null
@@ -1,98 +0,0 @@
-import re
-import textwrap
-import unittest
-
-from .. import tool_imports_for_tests
-with tool_imports_for_tests():
-    from c_analyzer.common.info import ID
-    from c_analyzer.variables.info import Variable
-    from cpython.supported import (
-            is_supported, ignored_from_file,
-            )
-
-
-class IsSupportedTests(unittest.TestCase):
-
-    @unittest.expectedFailure
-    def test_supported(self):
-        statics = [
-                Variable('src1/spam.c', None, 'var1', 'const char *'),
-                Variable('src1/spam.c', None, 'var1', 'int'),
-                ]
-        for static in statics:
-            with self.subTest(static):
-                result = is_supported(static)
-
-                self.assertTrue(result)
-
-    @unittest.expectedFailure
-    def test_not_supported(self):
-        statics = [
-                Variable('src1/spam.c', None, 'var1', 'PyObject *'),
-                Variable('src1/spam.c', None, 'var1', 'PyObject[10]'),
-                ]
-        for static in statics:
-            with self.subTest(static):
-                result = is_supported(static)
-
-                self.assertFalse(result)
-
-
-class IgnoredFromFileTests(unittest.TestCase):
-
-    maxDiff = None
-
-    _return_read_tsv = ()
-
-    @property
-    def calls(self):
-        try:
-            return self._calls
-        except AttributeError:
-            self._calls = []
-            return self._calls
-
-    def _read_tsv(self, *args):
-        self.calls.append(('_read_tsv', args))
-        return self._return_read_tsv
-
-    def test_typical(self):
-        lines = textwrap.dedent('''
-            filename    funcname        name    kind    reason
-            file1.c     -       var1    variable        ...
-            file1.c     func1   local1  variable        |
-            file1.c     -       var2    variable        ???
-            file1.c     func2   local2  variable           |
-            file2.c     -       var1    variable        reasons
-            ''').strip().splitlines()
-        lines = [re.sub(r'\s{1,8}', '\t', line, 4).replace('|', '')
-                 for line in lines]
-        self._return_read_tsv = [tuple(v.strip() for v in line.split('\t'))
-                                 for line in lines[1:]]
-
-        ignored = ignored_from_file('spam.c', _read_tsv=self._read_tsv)
-
-        self.assertEqual(ignored, {
-            'variables': {
-                ID('file1.c', '', 'var1'): '...',
-                ID('file1.c', 'func1', 'local1'): '',
-                ID('file1.c', '', 'var2'): '???',
-                ID('file1.c', 'func2', 'local2'): '',
-                ID('file2.c', '', 'var1'): 'reasons',
-                },
-            })
-        self.assertEqual(self.calls, [
-            ('_read_tsv', ('spam.c', 'filename\tfuncname\tname\tkind\treason')),
-            ])
-
-    def test_empty(self):
-        self._return_read_tsv = []
-
-        ignored = ignored_from_file('spam.c', _read_tsv=self._read_tsv)
-
-        self.assertEqual(ignored, {
-            'variables': {},
-            })
-        self.assertEqual(self.calls, [
-            ('_read_tsv', ('spam.c', 'filename\tfuncname\tname\tkind\treason')),
-            ])
diff --git a/Lib/test/test_tools/test_c_analyzer/test_parser/__init__.py b/Lib/test/test_tools/test_c_analyzer/test_parser/__init__.py
deleted file mode 100644
index bc502ef..0000000
--- a/Lib/test/test_tools/test_c_analyzer/test_parser/__init__.py
+++ /dev/null
@@ -1,6 +0,0 @@
-import os.path
-from test.support import load_package_tests
-
-
-def load_tests(*args):
-    return load_package_tests(os.path.dirname(__file__), *args)
diff --git a/Lib/test/test_tools/test_c_analyzer/test_parser/test_declarations.py b/Lib/test/test_tools/test_c_analyzer/test_parser/test_declarations.py
deleted file mode 100644
index 674fcb1..0000000
--- a/Lib/test/test_tools/test_c_analyzer/test_parser/test_declarations.py
+++ /dev/null
@@ -1,795 +0,0 @@
-import textwrap
-import unittest
-
-from .. import tool_imports_for_tests
-with tool_imports_for_tests():
-    from c_analyzer.parser.declarations import (
-        iter_global_declarations, iter_local_statements,
-        parse_func, _parse_var, parse_compound,
-        iter_variables,
-        )
-
-
-class TestCaseBase(unittest.TestCase):
-
-    maxDiff = None
-
-    @property
-    def calls(self):
-        try:
-            return self._calls
-        except AttributeError:
-            self._calls = []
-            return self._calls
-
-
-class IterGlobalDeclarationsTests(TestCaseBase):
-
-    def test_functions(self):
-        tests = [
-            (textwrap.dedent('''
-                void func1() {
-                    return;
-                }
-                '''),
-             textwrap.dedent('''
-                void func1() {
-                return;
-                }
-                ''').strip(),
-             ),
-            (textwrap.dedent('''
-                static unsigned int * _func1(
-                    const char *arg1,
-                    int *arg2
-                    long long arg3
-                    )
-                {
-                    return _do_something(arg1, arg2, arg3);
-                }
-                '''),
-             textwrap.dedent('''
-                static unsigned int * _func1( const char *arg1, int *arg2 long long arg3 ) {
-                return _do_something(arg1, arg2, arg3);
-                }
-                ''').strip(),
-             ),
-            (textwrap.dedent('''
-                static PyObject *
-                _func1(const char *arg1, PyObject *arg2)
-                {
-                    static int initialized = 0;
-                    if (!initialized) {
-                        initialized = 1;
-                        _init(arg1);
-                    }
-
-                    PyObject *result = _do_something(arg1, arg2);
-                    Py_INCREF(result);
-                    return result;
-                }
-                '''),
-             textwrap.dedent('''
-                static PyObject * _func1(const char *arg1, PyObject *arg2) {
-                static int initialized = 0;
-                if (!initialized) {
-                initialized = 1;
-                _init(arg1);
-                }
-                PyObject *result = _do_something(arg1, arg2);
-                Py_INCREF(result);
-                return result;
-                }
-                ''').strip(),
-             ),
-            ]
-        for lines, expected in tests:
-            body = textwrap.dedent(
-                    expected.partition('{')[2].rpartition('}')[0]
-                    ).strip()
-            expected = (expected, body)
-            with self.subTest(lines):
-                lines = lines.splitlines()
-
-                stmts = list(iter_global_declarations(lines))
-
-                self.assertEqual(stmts, [expected])
-
-    @unittest.expectedFailure
-    def test_declarations(self):
-        tests = [
-            'int spam;',
-            'long long spam;',
-            'static const int const *spam;',
-            'int spam;',
-            'typedef int myint;',
-            'typedef PyObject * (*unaryfunc)(PyObject *);',
-            # typedef struct
-            # inline struct
-            # enum
-            # inline enum
-            ]
-        for text in tests:
-            expected = (text,
-                        ' '.join(l.strip() for l in text.splitlines()))
-            with self.subTest(lines):
-                lines = lines.splitlines()
-
-                stmts = list(iter_global_declarations(lines))
-
-                self.assertEqual(stmts, [expected])
-
-    @unittest.expectedFailure
-    def test_declaration_multiple_vars(self):
-        lines = ['static const int const *spam, *ham=NULL, eggs = 3;']
-
-        stmts = list(iter_global_declarations(lines))
-
-        self.assertEqual(stmts, [
-            ('static const int const *spam;', None),
-            ('static const int *ham=NULL;', None),
-            ('static const int eggs = 3;', None),
-            ])
-
-    def test_mixed(self):
-        lines = textwrap.dedent('''
-           int spam;
-           static const char const *eggs;
-
-           PyObject * start(void) {
-               static int initialized = 0;
-               if (initialized) {
-                   initialized = 1;
-                   init();
-               }
-               return _start();
-           }
-
-           char* ham;
-
-           static int stop(char *reason) {
-               ham = reason;
-               return _stop();
-           }
-           ''').splitlines()
-        expected = [
-            (textwrap.dedent('''
-                PyObject * start(void) {
-                static int initialized = 0;
-                if (initialized) {
-                initialized = 1;
-                init();
-                }
-                return _start();
-                }
-                ''').strip(),
-             textwrap.dedent('''
-                static int initialized = 0;
-                if (initialized) {
-                initialized = 1;
-                init();
-                }
-                return _start();
-                ''').strip(),
-             ),
-            (textwrap.dedent('''
-                static int stop(char *reason) {
-                ham = reason;
-                return _stop();
-                }
-                ''').strip(),
-             textwrap.dedent('''
-                ham = reason;
-                return _stop();
-                ''').strip(),
-             ),
-            ]
-
-        stmts = list(iter_global_declarations(lines))
-
-        self.assertEqual(stmts, expected)
-        #self.assertEqual([stmt for stmt, _ in stmts],
-        #                 [stmt for stmt, _ in expected])
-        #self.assertEqual([body for _, body in stmts],
-        #                 [body for _, body in expected])
-
-    def test_no_statements(self):
-        lines = []
-
-        stmts = list(iter_global_declarations(lines))
-
-        self.assertEqual(stmts, [])
-
-    def test_bogus(self):
-        tests = [
-                (textwrap.dedent('''
-                    int spam;
-                    static const char const *eggs;
-
-                    PyObject * start(void) {
-                        static int initialized = 0;
-                        if (initialized) {
-                            initialized = 1;
-                            init();
-                        }
-                        return _start();
-                    }
-
-                    char* ham;
-
-                    static int _stop(void) {
-                    // missing closing bracket
-
-                    static int stop(char *reason) {
-                        ham = reason;
-                        return _stop();
-                    }
-                    '''),
-                 [(textwrap.dedent('''
-                    PyObject * start(void) {
-                    static int initialized = 0;
-                    if (initialized) {
-                    initialized = 1;
-                    init();
-                    }
-                    return _start();
-                    }
-                    ''').strip(),
-                   textwrap.dedent('''
-                    static int initialized = 0;
-                    if (initialized) {
-                    initialized = 1;
-                    init();
-                    }
-                    return _start();
-                    ''').strip(),
-                   ),
-                   # Neither "stop()" nor "_stop()" are here.
-                  ],
-                 ),
-                ]
-        for lines, expected in tests:
-            with self.subTest(lines):
-                lines = lines.splitlines()
-
-                stmts = list(iter_global_declarations(lines))
-
-                self.assertEqual(stmts, expected)
-                #self.assertEqual([stmt for stmt, _ in stmts],
-                #                 [stmt for stmt, _ in expected])
-                #self.assertEqual([body for _, body in stmts],
-                #                 [body for _, body in expected])
-
-    def test_ignore_comments(self):
-        tests = [
-            ('// msg', None),
-            ('// int stmt;', None),
-            ('    // ...    ', None),
-            ('// /*', None),
-            ('/* int stmt; */', None),
-            ("""
-             /**
-              * ...
-              * int stmt;
-              */
-             """, None),
-            ]
-        for lines, expected in tests:
-            with self.subTest(lines):
-                lines = lines.splitlines()
-
-                stmts = list(iter_global_declarations(lines))
-
-                self.assertEqual(stmts, [expected] if expected else [])
-
-
-class IterLocalStatementsTests(TestCaseBase):
-
-    def test_vars(self):
-        tests = [
-            # POTS
-            'int spam;',
-            'unsigned int spam;',
-            'char spam;',
-            'float spam;',
-
-            # typedefs
-            'uint spam;',
-            'MyType spam;',
-
-            # complex
-            'struct myspam spam;',
-            'union choice spam;',
-            # inline struct
-            # inline union
-            # enum?
-            ]
-        # pointers
-        tests.extend([
-            # POTS
-            'int * spam;',
-            'unsigned int * spam;',
-            'char *spam;',
-            'char const *spam = "spamspamspam...";',
-            # typedefs
-            'MyType *spam;',
-            # complex
-            'struct myspam *spam;',
-            'union choice *spam;',
-            # packed with details
-            'const char const *spam;',
-            # void pointer
-            'void *data = NULL;',
-            # function pointers
-            'int (* func)(char *arg1);',
-            'char * (* func)(void);',
-            ])
-        # storage class
-        tests.extend([
-            'static int spam;',
-            'extern int spam;',
-            'static unsigned int spam;',
-            'static struct myspam spam;',
-            ])
-        # type qualifier
-        tests.extend([
-            'const int spam;',
-            'const unsigned int spam;',
-            'const struct myspam spam;',
-            ])
-        # combined
-        tests.extend([
-            'const char *spam = eggs;',
-            'static const char const *spam = "spamspamspam...";',
-            'extern const char const *spam;',
-            'static void *data = NULL;',
-            'static int (const * func)(char *arg1) = func1;',
-            'static char * (* func)(void);',
-            ])
-        for line in tests:
-            expected = line
-            with self.subTest(line):
-                stmts = list(iter_local_statements([line]))
-
-                self.assertEqual(stmts, [(expected, None)])
-
-    @unittest.expectedFailure
-    def test_vars_multiline_var(self):
-        lines = textwrap.dedent('''
-            PyObject *
-            spam
-            = NULL;
-            ''').splitlines()
-        expected = 'PyObject * spam = NULL;'
-
-        stmts = list(iter_local_statements(lines))
-
-        self.assertEqual(stmts, [(expected, None)])
-
-    @unittest.expectedFailure
-    def test_declaration_multiple_vars(self):
-        lines = ['static const int const *spam, *ham=NULL, ham2[]={1, 2, 3}, ham3[2]={1, 2}, eggs = 3;']
-
-        stmts = list(iter_global_declarations(lines))
-
-        self.assertEqual(stmts, [
-            ('static const int const *spam;', None),
-            ('static const int *ham=NULL;', None),
-            ('static const int ham[]={1, 2, 3};', None),
-            ('static const int ham[2]={1, 2};', None),
-            ('static const int eggs = 3;', None),
-            ])
-
-    @unittest.expectedFailure
-    def test_other_simple(self):
-        raise NotImplementedError
-
-    @unittest.expectedFailure
-    def test_compound(self):
-        raise NotImplementedError
-
-    @unittest.expectedFailure
-    def test_mixed(self):
-        raise NotImplementedError
-
-    def test_no_statements(self):
-        lines = []
-
-        stmts = list(iter_local_statements(lines))
-
-        self.assertEqual(stmts, [])
-
-    @unittest.expectedFailure
-    def test_bogus(self):
-        raise NotImplementedError
-
-    def test_ignore_comments(self):
-        tests = [
-            ('// msg', None),
-            ('// int stmt;', None),
-            ('    // ...    ', None),
-            ('// /*', None),
-            ('/* int stmt; */', None),
-            ("""
-             /**
-              * ...
-              * int stmt;
-              */
-             """, None),
-            # mixed with statements
-            ('int stmt; // ...', ('int stmt;', None)),
-            ( 'int stmt; /* ...  */', ('int stmt;', None)),
-            ( '/* ...  */ int stmt;', ('int stmt;', None)),
-            ]
-        for lines, expected in tests:
-            with self.subTest(lines):
-                lines = lines.splitlines()
-
-                stmts = list(iter_local_statements(lines))
-
-                self.assertEqual(stmts, [expected] if expected else [])
-
-
-class ParseFuncTests(TestCaseBase):
-
-    def test_typical(self):
-        tests = [
-            ('PyObject *\nspam(char *a)\n{\nreturn _spam(a);\n}',
-             'return _spam(a);',
-             ('spam', 'PyObject * spam(char *a)'),
-             ),
-            ]
-        for stmt, body, expected in tests:
-            with self.subTest(stmt):
-                name, signature = parse_func(stmt, body)
-
-                self.assertEqual((name, signature), expected)
-
-
-class ParseVarTests(TestCaseBase):
-
-    def test_typical(self):
-        tests = [
-            # POTS
-            ('int spam;', ('spam', 'int')),
-            ('unsigned int spam;', ('spam', 'unsigned int')),
-            ('char spam;', ('spam', 'char')),
-            ('float spam;', ('spam', 'float')),
-
-            # typedefs
-            ('uint spam;', ('spam', 'uint')),
-            ('MyType spam;', ('spam', 'MyType')),
-
-            # complex
-            ('struct myspam spam;', ('spam', 'struct myspam')),
-            ('union choice spam;', ('spam', 'union choice')),
-            # inline struct
-            # inline union
-            # enum?
-            ]
-        # pointers
-        tests.extend([
-            # POTS
-            ('int * spam;', ('spam', 'int *')),
-            ('unsigned int * spam;', ('spam', 'unsigned int *')),
-            ('char *spam;', ('spam', 'char *')),
-            ('char const *spam = "spamspamspam...";', ('spam', 'char const *')),
-            # typedefs
-            ('MyType *spam;', ('spam', 'MyType *')),
-            # complex
-            ('struct myspam *spam;', ('spam', 'struct myspam *')),
-            ('union choice *spam;', ('spam', 'union choice *')),
-            # packed with details
-            ('const char const *spam;', ('spam', 'const char const *')),
-            # void pointer
-            ('void *data = NULL;', ('data', 'void *')),
-            # function pointers
-            ('int (* func)(char *);', ('func', 'int (*)(char *)')),
-            ('char * (* func)(void);', ('func', 'char * (*)(void)')),
-            ])
-        # storage class
-        tests.extend([
-            ('static int spam;', ('spam', 'static int')),
-            ('extern int spam;', ('spam', 'extern int')),
-            ('static unsigned int spam;', ('spam', 'static unsigned int')),
-            ('static struct myspam spam;', ('spam', 'static struct myspam')),
-            ])
-        # type qualifier
-        tests.extend([
-            ('const int spam;', ('spam', 'const int')),
-            ('const unsigned int spam;', ('spam', 'const unsigned int')),
-            ('const struct myspam spam;', ('spam', 'const struct myspam')),
-            ])
-        # combined
-        tests.extend([
-            ('const char *spam = eggs;', ('spam', 'const char *')),
-            ('static const char const *spam = "spamspamspam...";',
-             ('spam', 'static const char const *')),
-            ('extern const char const *spam;',
-             ('spam', 'extern const char const *')),
-            ('static void *data = NULL;', ('data', 'static void *')),
-            ('static int (const * func)(char *) = func1;',
-             ('func', 'static int (const *)(char *)')),
-            ('static char * (* func)(void);',
-             ('func', 'static char * (*)(void)')),
-            ])
-        for stmt, expected in tests:
-            with self.subTest(stmt):
-                name, vartype = _parse_var(stmt)
-
-                self.assertEqual((name, vartype), expected)
-
-
-@unittest.skip('not finished')
-class ParseCompoundTests(TestCaseBase):
-
-    def test_typical(self):
-        headers, bodies = parse_compound(stmt, blocks)
-        ...
-
-
-class IterVariablesTests(TestCaseBase):
-
-    _return_iter_source_lines = None
-    _return_iter_global = None
-    _return_iter_local = None
-    _return_parse_func = None
-    _return_parse_var = None
-    _return_parse_compound = None
-
-    def _iter_source_lines(self, filename):
-        self.calls.append(
-                ('_iter_source_lines', (filename,)))
-        return self._return_iter_source_lines.splitlines()
-
-    def _iter_global(self, lines):
-        self.calls.append(
-                ('_iter_global', (lines,)))
-        try:
-            return self._return_iter_global.pop(0)
-        except IndexError:
-            return ('???', None)
-
-    def _iter_local(self, lines):
-        self.calls.append(
-                ('_iter_local', (lines,)))
-        try:
-            return self._return_iter_local.pop(0)
-        except IndexError:
-            return ('???', None)
-
-    def _parse_func(self, stmt, body):
-        self.calls.append(
-                ('_parse_func', (stmt, body)))
-        try:
-            return self._return_parse_func.pop(0)
-        except IndexError:
-            return ('???', '???')
-
-    def _parse_var(self, lines):
-        self.calls.append(
-                ('_parse_var', (lines,)))
-        try:
-            return self._return_parse_var.pop(0)
-        except IndexError:
-            return ('???', '???')
-
-    def _parse_compound(self, stmt, blocks):
-        self.calls.append(
-                ('_parse_compound', (stmt, blocks)))
-        try:
-            return self._return_parse_compound.pop(0)
-        except IndexError:
-            return (['???'], ['???'])
-
-    def test_empty_file(self):
-        self._return_iter_source_lines = ''
-        self._return_iter_global = [
-            [],
-            ]
-        self._return_parse_func = None
-        self._return_parse_var = None
-        self._return_parse_compound = None
-
-        srcvars = list(iter_variables('spam.c',
-                                      _iter_source_lines=self._iter_source_lines,
-                                      _iter_global=self._iter_global,
-                                      _iter_local=self._iter_local,
-                                      _parse_func=self._parse_func,
-                                      _parse_var=self._parse_var,
-                                      _parse_compound=self._parse_compound,
-                                      ))
-
-        self.assertEqual(srcvars, [])
-        self.assertEqual(self.calls, [
-            ('_iter_source_lines', ('spam.c',)),
-            ('_iter_global', ([],)),
-            ])
-
-    def test_no_statements(self):
-        content = textwrap.dedent('''
-        ...
-        ''')
-        self._return_iter_source_lines = content
-        self._return_iter_global = [
-            [],
-            ]
-        self._return_parse_func = None
-        self._return_parse_var = None
-        self._return_parse_compound = None
-
-        srcvars = list(iter_variables('spam.c',
-                                      _iter_source_lines=self._iter_source_lines,
-                                      _iter_global=self._iter_global,
-                                      _iter_local=self._iter_local,
-                                      _parse_func=self._parse_func,
-                                      _parse_var=self._parse_var,
-                                      _parse_compound=self._parse_compound,
-                                      ))
-
-        self.assertEqual(srcvars, [])
-        self.assertEqual(self.calls, [
-            ('_iter_source_lines', ('spam.c',)),
-            ('_iter_global', (content.splitlines(),)),
-            ])
-
-    def test_typical(self):
-        content = textwrap.dedent('''
-        ...
-        ''')
-        self._return_iter_source_lines = content
-        self._return_iter_global = [
-            [('<lines 1>', None),  # var1
-             ('<lines 2>', None),  # non-var
-             ('<lines 3>', None),  # var2
-             ('<lines 4>', '<body 1>'),  # func1
-             ('<lines 9>', None),  # var4
-             ],
-            ]
-        self._return_iter_local = [
-            # func1
-            [('<lines 5>', None),  # var3
-             ('<lines 6>', [('<header 1>', '<block 1>')]),  # if
-             ('<lines 8>', None),  # non-var
-             ],
-            # if
-            [('<lines 7>', None),  # var2 ("collision" with global var)
-             ],
-            ]
-        self._return_parse_func = [
-            ('func1', '<sig 1>'),
-            ]
-        self._return_parse_var = [
-            ('var1', '<vartype 1>'),
-            (None, None),
-            ('var2', '<vartype 2>'),
-            ('var3', '<vartype 3>'),
-            ('var2', '<vartype 2b>'),
-            ('var4', '<vartype 4>'),
-            (None, None),
-            (None, None),
-            (None, None),
-            ('var5', '<vartype 5>'),
-            ]
-        self._return_parse_compound = [
-            ([[
-                'if (',
-                '<simple>',
-                ')',
-                ],
-              ],
-             ['<block 1>']),
-            ]
-
-        srcvars = list(iter_variables('spam.c',
-                                      _iter_source_lines=self._iter_source_lines,
-                                      _iter_global=self._iter_global,
-                                      _iter_local=self._iter_local,
-                                      _parse_func=self._parse_func,
-                                      _parse_var=self._parse_var,
-                                      _parse_compound=self._parse_compound,
-                                      ))
-
-        self.assertEqual(srcvars, [
-            (None, 'var1', '<vartype 1>'),
-            (None, 'var2', '<vartype 2>'),
-            ('func1', 'var3', '<vartype 3>'),
-            ('func1', 'var2', '<vartype 2b>'),
-            ('func1', 'var4', '<vartype 4>'),
-            (None, 'var5', '<vartype 5>'),
-            ])
-        self.assertEqual(self.calls, [
-            ('_iter_source_lines', ('spam.c',)),
-            ('_iter_global', (content.splitlines(),)),
-            ('_parse_var', ('<lines 1>',)),
-            ('_parse_var', ('<lines 2>',)),
-            ('_parse_var', ('<lines 3>',)),
-            ('_parse_func', ('<lines 4>', '<body 1>')),
-            ('_iter_local', (['<body 1>'],)),
-            ('_parse_var', ('<lines 5>',)),
-            ('_parse_compound', ('<lines 6>', [('<header 1>', '<block 1>')])),
-            ('_parse_var', ('if (',)),
-            ('_parse_var', ('<simple>',)),
-            ('_parse_var', (')',)),
-            ('_parse_var', ('<lines 8>',)),
-            ('_iter_local', (['<block 1>'],)),
-            ('_parse_var', ('<lines 7>',)),
-            ('_parse_var', ('<lines 9>',)),
-            ])
-
-    def test_no_locals(self):
-        content = textwrap.dedent('''
-        ...
-        ''')
-        self._return_iter_source_lines = content
-        self._return_iter_global = [
-            [('<lines 1>', None),  # var1
-             ('<lines 2>', None),  # non-var
-             ('<lines 3>', None),  # var2
-             ('<lines 4>', '<body 1>'),  # func1
-             ],
-            ]
-        self._return_iter_local = [
-            # func1
-            [('<lines 5>', None),  # non-var
-             ('<lines 6>', [('<header 1>', '<block 1>')]),  # if
-             ('<lines 8>', None),  # non-var
-             ],
-            # if
-            [('<lines 7>', None),  # non-var
-             ],
-            ]
-        self._return_parse_func = [
-            ('func1', '<sig 1>'),
-            ]
-        self._return_parse_var = [
-            ('var1', '<vartype 1>'),
-            (None, None),
-            ('var2', '<vartype 2>'),
-            (None, None),
-            (None, None),
-            (None, None),
-            (None, None),
-            (None, None),
-            (None, None),
-            ]
-        self._return_parse_compound = [
-            ([[
-                'if (',
-                '<simple>',
-                ')',
-                ],
-              ],
-             ['<block 1>']),
-            ]
-
-        srcvars = list(iter_variables('spam.c',
-                                      _iter_source_lines=self._iter_source_lines,
-                                      _iter_global=self._iter_global,
-                                      _iter_local=self._iter_local,
-                                      _parse_func=self._parse_func,
-                                      _parse_var=self._parse_var,
-                                      _parse_compound=self._parse_compound,
-                                      ))
-
-        self.assertEqual(srcvars, [
-            (None, 'var1', '<vartype 1>'),
-            (None, 'var2', '<vartype 2>'),
-            ])
-        self.assertEqual(self.calls, [
-            ('_iter_source_lines', ('spam.c',)),
-            ('_iter_global', (content.splitlines(),)),
-            ('_parse_var', ('<lines 1>',)),
-            ('_parse_var', ('<lines 2>',)),
-            ('_parse_var', ('<lines 3>',)),
-            ('_parse_func', ('<lines 4>', '<body 1>')),
-            ('_iter_local', (['<body 1>'],)),
-            ('_parse_var', ('<lines 5>',)),
-            ('_parse_compound', ('<lines 6>', [('<header 1>', '<block 1>')])),
-            ('_parse_var', ('if (',)),
-            ('_parse_var', ('<simple>',)),
-            ('_parse_var', (')',)),
-            ('_parse_var', ('<lines 8>',)),
-            ('_iter_local', (['<block 1>'],)),
-            ('_parse_var', ('<lines 7>',)),
-            ])
diff --git a/Lib/test/test_tools/test_c_analyzer/test_parser/test_preprocessor.py b/Lib/test/test_tools/test_c_analyzer/test_parser/test_preprocessor.py
deleted file mode 100644
index b7f950f..0000000
--- a/Lib/test/test_tools/test_c_analyzer/test_parser/test_preprocessor.py
+++ /dev/null
@@ -1,1561 +0,0 @@
-import textwrap
-import unittest
-import sys
-
-from ..util import wrapped_arg_combos, StrProxy
-from .. import tool_imports_for_tests
-with tool_imports_for_tests():
-    from c_analyzer.parser.preprocessor import (
-        iter_lines,
-        # directives
-        parse_directive, PreprocessorDirective,
-        Constant, Macro, IfDirective, Include, OtherDirective,
-        )
-
-
-class TestCaseBase(unittest.TestCase):
-
-    maxDiff = None
-
-    def reset(self):
-        self._calls = []
-        self.errors = None
-
-    @property
-    def calls(self):
-        try:
-            return self._calls
-        except AttributeError:
-            self._calls = []
-            return self._calls
-
-    errors = None
-
-    def try_next_exc(self):
-        if not self.errors:
-            return
-        if exc := self.errors.pop(0):
-            raise exc
-
-    def check_calls(self, *expected):
-        self.assertEqual(self.calls, list(expected))
-        self.assertEqual(self.errors or [], [])
-
-
-class IterLinesTests(TestCaseBase):
-
-    parsed = None
-
-    def check_calls(self, *expected):
-        super().check_calls(*expected)
-        self.assertEqual(self.parsed or [], [])
-
-    def _parse_directive(self, line):
-        self.calls.append(
-                ('_parse_directive', line))
-        self.try_next_exc()
-        return self.parsed.pop(0)
-
-    def test_no_lines(self):
-        lines = []
-
-        results = list(
-                iter_lines(lines, _parse_directive=self._parse_directive))
-
-        self.assertEqual(results, [])
-        self.check_calls()
-
-    def test_no_directives(self):
-        lines = textwrap.dedent('''
-
-            // xyz
-            typedef enum {
-                SPAM
-                EGGS
-            } kind;
-
-            struct info {
-                kind kind;
-                int status;
-            };
-
-            typedef struct spam {
-                struct info info;
-            } myspam;
-
-            static int spam = 0;
-
-            /**
-             * ...
-             */
-            static char *
-            get_name(int arg,
-                     char *default,
-                     )
-            {
-                return default
-            }
-
-            int check(void) {
-                return 0;
-            }
-
-            ''')[1:-1].splitlines()
-        expected = [(lno, line, None, ())
-                    for lno, line in enumerate(lines, 1)]
-        expected[1] = (2, ' ', None, ())
-        expected[20] = (21, ' ', None, ())
-        del expected[19]
-        del expected[18]
-
-        results = list(
-                iter_lines(lines, _parse_directive=self._parse_directive))
-
-        self.assertEqual(results, expected)
-        self.check_calls()
-
-    def test_single_directives(self):
-        tests = [
-            ('#include <stdio>', Include('<stdio>')),
-            ('#define SPAM 1', Constant('SPAM', '1')),
-            ('#define SPAM() 1', Macro('SPAM', (), '1')),
-            ('#define SPAM(a, b) a = b;', Macro('SPAM', ('a', 'b'), 'a = b;')),
-            ('#if defined(SPAM)', IfDirective('if', 'defined(SPAM)')),
-            ('#ifdef SPAM', IfDirective('ifdef', 'SPAM')),
-            ('#ifndef SPAM', IfDirective('ifndef', 'SPAM')),
-            ('#elseif defined(SPAM)', IfDirective('elseif', 'defined(SPAM)')),
-            ('#else', OtherDirective('else', None)),
-            ('#endif', OtherDirective('endif', None)),
-            ('#error ...', OtherDirective('error', '...')),
-            ('#warning ...', OtherDirective('warning', '...')),
-            ('#__FILE__ ...', OtherDirective('__FILE__', '...')),
-            ('#__LINE__ ...', OtherDirective('__LINE__', '...')),
-            ('#__DATE__ ...', OtherDirective('__DATE__', '...')),
-            ('#__TIME__ ...', OtherDirective('__TIME__', '...')),
-            ('#__TIMESTAMP__ ...', OtherDirective('__TIMESTAMP__', '...')),
-            ]
-        for line, directive in tests:
-            with self.subTest(line):
-                self.reset()
-                self.parsed = [
-                    directive,
-                    ]
-                text = textwrap.dedent('''
-                    static int spam = 0;
-                    {}
-                    static char buffer[256];
-                    ''').strip().format(line)
-                lines = text.strip().splitlines()
-
-                results = list(
-                        iter_lines(lines, _parse_directive=self._parse_directive))
-
-                self.assertEqual(results, [
-                    (1, 'static int spam = 0;', None, ()),
-                    (2, line, directive, ()),
-                    ((3, 'static char buffer[256];', None, ('defined(SPAM)',))
-                     if directive.kind in ('if', 'ifdef', 'elseif')
-                     else (3, 'static char buffer[256];', None, ('! defined(SPAM)',))
-                     if directive.kind == 'ifndef'
-                     else (3, 'static char buffer[256];', None, ())),
-                    ])
-                self.check_calls(
-                        ('_parse_directive', line),
-                        )
-
-    def test_directive_whitespace(self):
-        line = ' # define  eggs  (  a  ,  b  )  {  a  =  b  ;  }  '
-        directive = Macro('eggs', ('a', 'b'), '{ a = b; }')
-        self.parsed = [
-            directive,
-            ]
-        lines = [line]
-
-        results = list(
-                iter_lines(lines, _parse_directive=self._parse_directive))
-
-        self.assertEqual(results, [
-            (1, line, directive, ()),
-            ])
-        self.check_calls(
-                ('_parse_directive', '#define eggs ( a , b ) { a = b ; }'),
-                )
-
-    @unittest.skipIf(sys.platform == 'win32', 'needs fix under Windows')
-    def test_split_lines(self):
-        directive = Macro('eggs', ('a', 'b'), '{ a = b; }')
-        self.parsed = [
-            directive,
-            ]
-        text = textwrap.dedent(r'''
-            static int spam = 0;
-            #define eggs(a, b) \
-                { \
-                    a = b; \
-                }
-            static char buffer[256];
-            ''').strip()
-        lines = [line + '\n' for line in text.splitlines()]
-        lines[-1] = lines[-1][:-1]
-
-        results = list(
-                iter_lines(lines, _parse_directive=self._parse_directive))
-
-        self.assertEqual(results, [
-            (1, 'static int spam = 0;\n', None, ()),
-            (5, '#define eggs(a, b)      {          a = b;      }\n', directive, ()),
-            (6, 'static char buffer[256];', None, ()),
-            ])
-        self.check_calls(
-                ('_parse_directive', '#define eggs(a, b) { a = b; }'),
-                )
-
-    def test_nested_conditions(self):
-        directives = [
-            IfDirective('ifdef', 'SPAM'),
-            IfDirective('if', 'SPAM == 1'),
-            IfDirective('elseif', 'SPAM == 2'),
-            OtherDirective('else', None),
-            OtherDirective('endif', None),
-            OtherDirective('endif', None),
-            ]
-        self.parsed = list(directives)
-        text = textwrap.dedent(r'''
-            static int spam = 0;
-
-            #ifdef SPAM
-            static int start = 0;
-            #  if SPAM == 1
-            static char buffer[10];
-            #  elif SPAM == 2
-            static char buffer[100];
-            #  else
-            static char buffer[256];
-            #  endif
-            static int end = 0;
-            #endif
-
-            static int eggs = 0;
-            ''').strip()
-        lines = [line for line in text.splitlines() if line.strip()]
-
-        results = list(
-                iter_lines(lines, _parse_directive=self._parse_directive))
-
-        self.assertEqual(results, [
-            (1, 'static int spam = 0;', None, ()),
-            (2, '#ifdef SPAM', directives[0], ()),
-            (3, 'static int start = 0;', None, ('defined(SPAM)',)),
-            (4, '#  if SPAM == 1', directives[1], ('defined(SPAM)',)),
-            (5, 'static char buffer[10];', None, ('defined(SPAM)', 'SPAM == 1')),
-            (6, '#  elif SPAM == 2', directives[2], ('defined(SPAM)', 'SPAM == 1')),
-            (7, 'static char buffer[100];', None, ('defined(SPAM)', '! (SPAM == 1)', 'SPAM == 2')),
-            (8, '#  else', directives[3], ('defined(SPAM)', '! (SPAM == 1)', 'SPAM == 2')),
-            (9, 'static char buffer[256];', None, ('defined(SPAM)', '! (SPAM == 1)', '! (SPAM == 2)')),
-            (10, '#  endif', directives[4], ('defined(SPAM)', '! (SPAM == 1)', '! (SPAM == 2)')),
-            (11, 'static int end = 0;', None, ('defined(SPAM)',)),
-            (12, '#endif', directives[5], ('defined(SPAM)',)),
-            (13, 'static int eggs = 0;', None, ()),
-            ])
-        self.check_calls(
-                ('_parse_directive', '#ifdef SPAM'),
-                ('_parse_directive', '#if SPAM == 1'),
-                ('_parse_directive', '#elif SPAM == 2'),
-                ('_parse_directive', '#else'),
-                ('_parse_directive', '#endif'),
-                ('_parse_directive', '#endif'),
-                )
-
-    def test_split_blocks(self):
-        directives = [
-            IfDirective('ifdef', 'SPAM'),
-            OtherDirective('else', None),
-            OtherDirective('endif', None),
-            ]
-        self.parsed = list(directives)
-        text = textwrap.dedent(r'''
-            void str_copy(char *buffer, *orig);
-
-            int init(char *name) {
-                static int initialized = 0;
-                if (initialized) {
-                    return 0;
-                }
-            #ifdef SPAM
-                static char buffer[10];
-                str_copy(buffer, char);
-            }
-
-            void copy(char *buffer, *orig) {
-                strncpy(buffer, orig, 9);
-                buffer[9] = 0;
-            }
-
-            #else
-                static char buffer[256];
-                str_copy(buffer, char);
-            }
-
-            void copy(char *buffer, *orig) {
-                strcpy(buffer, orig);
-            }
-
-            #endif
-            ''').strip()
-        lines = [line for line in text.splitlines() if line.strip()]
-
-        results = list(
-                iter_lines(lines, _parse_directive=self._parse_directive))
-
-        self.assertEqual(results, [
-            (1, 'void str_copy(char *buffer, *orig);', None, ()),
-            (2, 'int init(char *name) {', None, ()),
-            (3, '    static int initialized = 0;', None, ()),
-            (4, '    if (initialized) {', None, ()),
-            (5, '        return 0;', None, ()),
-            (6, '    }', None, ()),
-
-            (7, '#ifdef SPAM', directives[0], ()),
-
-            (8, '    static char buffer[10];', None, ('defined(SPAM)',)),
-            (9, '    str_copy(buffer, char);', None, ('defined(SPAM)',)),
-            (10, '}', None, ('defined(SPAM)',)),
-            (11, 'void copy(char *buffer, *orig) {', None, ('defined(SPAM)',)),
-            (12, '    strncpy(buffer, orig, 9);', None, ('defined(SPAM)',)),
-            (13, '    buffer[9] = 0;', None, ('defined(SPAM)',)),
-            (14, '}', None, ('defined(SPAM)',)),
-
-            (15, '#else', directives[1], ('defined(SPAM)',)),
-
-            (16, '    static char buffer[256];', None, ('! (defined(SPAM))',)),
-            (17, '    str_copy(buffer, char);', None, ('! (defined(SPAM))',)),
-            (18, '}', None, ('! (defined(SPAM))',)),
-            (19, 'void copy(char *buffer, *orig) {', None, ('! (defined(SPAM))',)),
-            (20, '    strcpy(buffer, orig);', None, ('! (defined(SPAM))',)),
-            (21, '}', None, ('! (defined(SPAM))',)),
-
-            (22, '#endif', directives[2], ('! (defined(SPAM))',)),
-            ])
-        self.check_calls(
-                ('_parse_directive', '#ifdef SPAM'),
-                ('_parse_directive', '#else'),
-                ('_parse_directive', '#endif'),
-                )
-
-    @unittest.skipIf(sys.platform == 'win32', 'needs fix under Windows')
-    def test_basic(self):
-        directives = [
-            Include('<stdio.h>'),
-            IfDirective('ifdef', 'SPAM'),
-            IfDirective('if', '! defined(HAM) || !HAM'),
-            Constant('HAM', '0'),
-            IfDirective('elseif', 'HAM < 0'),
-            Constant('HAM', '-1'),
-            OtherDirective('else', None),
-            OtherDirective('endif', None),
-            OtherDirective('endif', None),
-            IfDirective('if', 'defined(HAM) && (HAM < 0 || ! HAM)'),
-            OtherDirective('undef', 'HAM'),
-            OtherDirective('endif', None),
-            IfDirective('ifndef', 'HAM'),
-            OtherDirective('endif', None),
-            ]
-        self.parsed = list(directives)
-        text = textwrap.dedent(r'''
-            #include <stdio.h>
-            print("begin");
-            #ifdef SPAM
-               print("spam");
-               #if ! defined(HAM) || !HAM
-            #      DEFINE HAM 0
-               #elseif HAM < 0
-            #      DEFINE HAM -1
-               #else
-                   print("ham HAM");
-               #endif
-            #endif
-
-            #if defined(HAM) && \
-                (HAM < 0 || ! HAM)
-              print("ham?");
-              #undef HAM
-            # endif
-
-            #ifndef HAM
-               print("no ham");
-            #endif
-            print("end");
-            ''')[1:-1]
-        lines = [line + '\n' for line in text.splitlines()]
-        lines[-1] = lines[-1][:-1]
-
-        results = list(
-                iter_lines(lines, _parse_directive=self._parse_directive))
-
-        self.assertEqual(results, [
-            (1, '#include <stdio.h>\n', Include('<stdio.h>'), ()),
-            (2, 'print("begin");\n', None, ()),
-            #
-            (3, '#ifdef SPAM\n',
-                IfDirective('ifdef', 'SPAM'),
-                ()),
-            (4, '   print("spam");\n',
-                None,
-                ('defined(SPAM)',)),
-            (5, '   #if ! defined(HAM) || !HAM\n',
-                IfDirective('if', '! defined(HAM) || !HAM'),
-                ('defined(SPAM)',)),
-            (6, '#      DEFINE HAM 0\n',
-                Constant('HAM', '0'),
-                ('defined(SPAM)', '! defined(HAM) || !HAM')),
-            (7, '   #elseif HAM < 0\n',
-                IfDirective('elseif', 'HAM < 0'),
-                ('defined(SPAM)', '! defined(HAM) || !HAM')),
-            (8, '#      DEFINE HAM -1\n',
-                Constant('HAM', '-1'),
-                ('defined(SPAM)', '! (! defined(HAM) || !HAM)', 'HAM < 0')),
-            (9, '   #else\n',
-                OtherDirective('else', None),
-                ('defined(SPAM)', '! (! defined(HAM) || !HAM)', 'HAM < 0')),
-            (10, '       print("ham HAM");\n',
-                None,
-                ('defined(SPAM)', '! (! defined(HAM) || !HAM)', '! (HAM < 0)')),
-            (11, '   #endif\n',
-                OtherDirective('endif', None),
-                ('defined(SPAM)', '! (! defined(HAM) || !HAM)', '! (HAM < 0)')),
-            (12, '#endif\n',
-                OtherDirective('endif', None),
-                ('defined(SPAM)',)),
-            #
-            (13, '\n', None, ()),
-            #
-            (15, '#if defined(HAM) &&      (HAM < 0 || ! HAM)\n',
-                IfDirective('if', 'defined(HAM) && (HAM < 0 || ! HAM)'),
-                ()),
-            (16, '  print("ham?");\n',
-                None,
-                ('defined(HAM) && (HAM < 0 || ! HAM)',)),
-            (17, '  #undef HAM\n',
-                OtherDirective('undef', 'HAM'),
-                ('defined(HAM) && (HAM < 0 || ! HAM)',)),
-            (18, '# endif\n',
-                OtherDirective('endif', None),
-                ('defined(HAM) && (HAM < 0 || ! HAM)',)),
-            #
-            (19, '\n', None, ()),
-            #
-            (20, '#ifndef HAM\n',
-                IfDirective('ifndef', 'HAM'),
-                ()),
-            (21, '   print("no ham");\n',
-                None,
-                ('! defined(HAM)',)),
-            (22, '#endif\n',
-                OtherDirective('endif', None),
-                ('! defined(HAM)',)),
-            #
-            (23, 'print("end");', None, ()),
-            ])
-
-    @unittest.skipIf(sys.platform == 'win32', 'needs fix under Windows')
-    def test_typical(self):
-        # We use Include/compile.h from commit 66c4f3f38b86.  It has
-        # a good enough mix of code without being too large.
-        directives = [
-            IfDirective('ifndef', 'Py_COMPILE_H'),
-            Constant('Py_COMPILE_H', None),
-
-            IfDirective('ifndef', 'Py_LIMITED_API'),
-
-            Include('"code.h"'),
-
-            IfDirective('ifdef', '__cplusplus'),
-            OtherDirective('endif', None),
-
-            Constant('PyCF_MASK', '(CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_WITH_STATEMENT | CO_FUTURE_PRINT_FUNCTION | CO_FUTURE_UNICODE_LITERALS | CO_FUTURE_BARRY_AS_BDFL | CO_FUTURE_GENERATOR_STOP | CO_FUTURE_ANNOTATIONS)'),
-            Constant('PyCF_MASK_OBSOLETE', '(CO_NESTED)'),
-            Constant('PyCF_SOURCE_IS_UTF8', ' 0x0100'),
-            Constant('PyCF_DONT_IMPLY_DEDENT', '0x0200'),
-            Constant('PyCF_ONLY_AST', '0x0400'),
-            Constant('PyCF_IGNORE_COOKIE', '0x0800'),
-            Constant('PyCF_TYPE_COMMENTS', '0x1000'),
-            Constant('PyCF_ALLOW_TOP_LEVEL_AWAIT', '0x2000'),
-
-            IfDirective('ifndef', 'Py_LIMITED_API'),
-            OtherDirective('endif', None),
-
-            Constant('FUTURE_NESTED_SCOPES', '"nested_scopes"'),
-            Constant('FUTURE_GENERATORS', '"generators"'),
-            Constant('FUTURE_DIVISION', '"division"'),
-            Constant('FUTURE_ABSOLUTE_IMPORT', '"absolute_import"'),
-            Constant('FUTURE_WITH_STATEMENT', '"with_statement"'),
-            Constant('FUTURE_PRINT_FUNCTION', '"print_function"'),
-            Constant('FUTURE_UNICODE_LITERALS', '"unicode_literals"'),
-            Constant('FUTURE_BARRY_AS_BDFL', '"barry_as_FLUFL"'),
-            Constant('FUTURE_GENERATOR_STOP', '"generator_stop"'),
-            Constant('FUTURE_ANNOTATIONS', '"annotations"'),
-
-            Macro('PyAST_Compile', ('mod', 's', 'f', 'ar'), 'PyAST_CompileEx(mod, s, f, -1, ar)'),
-
-            Constant('PY_INVALID_STACK_EFFECT', 'INT_MAX'),
-
-            IfDirective('ifdef', '__cplusplus'),
-            OtherDirective('endif', None),
-
-            OtherDirective('endif', None),  # ifndef Py_LIMITED_API
-
-            Constant('Py_single_input', '256'),
-            Constant('Py_file_input', '257'),
-            Constant('Py_eval_input', '258'),
-            Constant('Py_func_type_input', '345'),
-
-            OtherDirective('endif', None),  # ifndef Py_COMPILE_H
-            ]
-        self.parsed = list(directives)
-        text = textwrap.dedent(r'''
-            #ifndef Py_COMPILE_H
-            #define Py_COMPILE_H
-
-            #ifndef Py_LIMITED_API
-            #include "code.h"
-
-            #ifdef __cplusplus
-            extern "C" {
-            #endif
-
-            /* Public interface */
-            struct _node; /* Declare the existence of this type */
-            PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, const char *);
-            /* XXX (ncoghlan): Unprefixed type name in a public API! */
-
-            #define PyCF_MASK (CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | \
-                               CO_FUTURE_WITH_STATEMENT | CO_FUTURE_PRINT_FUNCTION | \
-                               CO_FUTURE_UNICODE_LITERALS | CO_FUTURE_BARRY_AS_BDFL | \
-                               CO_FUTURE_GENERATOR_STOP | CO_FUTURE_ANNOTATIONS)
-            #define PyCF_MASK_OBSOLETE (CO_NESTED)
-            #define PyCF_SOURCE_IS_UTF8  0x0100
-            #define PyCF_DONT_IMPLY_DEDENT 0x0200
-            #define PyCF_ONLY_AST 0x0400
-            #define PyCF_IGNORE_COOKIE 0x0800
-            #define PyCF_TYPE_COMMENTS 0x1000
-            #define PyCF_ALLOW_TOP_LEVEL_AWAIT 0x2000
-
-            #ifndef Py_LIMITED_API
-            typedef struct {
-                int cf_flags;  /* bitmask of CO_xxx flags relevant to future */
-                int cf_feature_version;  /* minor Python version (PyCF_ONLY_AST) */
-            } PyCompilerFlags;
-            #endif
-
-            /* Future feature support */
-
-            typedef struct {
-                int ff_features;      /* flags set by future statements */
-                int ff_lineno;        /* line number of last future statement */
-            } PyFutureFeatures;
-
-            #define FUTURE_NESTED_SCOPES "nested_scopes"
-            #define FUTURE_GENERATORS "generators"
-            #define FUTURE_DIVISION "division"
-            #define FUTURE_ABSOLUTE_IMPORT "absolute_import"
-            #define FUTURE_WITH_STATEMENT "with_statement"
-            #define FUTURE_PRINT_FUNCTION "print_function"
-            #define FUTURE_UNICODE_LITERALS "unicode_literals"
-            #define FUTURE_BARRY_AS_BDFL "barry_as_FLUFL"
-            #define FUTURE_GENERATOR_STOP "generator_stop"
-            #define FUTURE_ANNOTATIONS "annotations"
-
-            struct _mod; /* Declare the existence of this type */
-            #define PyAST_Compile(mod, s, f, ar) PyAST_CompileEx(mod, s, f, -1, ar)
-            PyAPI_FUNC(PyCodeObject *) PyAST_CompileEx(
-                struct _mod *mod,
-                const char *filename,       /* decoded from the filesystem encoding */
-                PyCompilerFlags *flags,
-                int optimize,
-                PyArena *arena);
-            PyAPI_FUNC(PyCodeObject *) PyAST_CompileObject(
-                struct _mod *mod,
-                PyObject *filename,
-                PyCompilerFlags *flags,
-                int optimize,
-                PyArena *arena);
-            PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromAST(
-                struct _mod * mod,
-                const char *filename        /* decoded from the filesystem encoding */
-                );
-            PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromASTObject(
-                struct _mod * mod,
-                PyObject *filename
-                );
-
-            /* _Py_Mangle is defined in compile.c */
-            PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name);
-
-            #define PY_INVALID_STACK_EFFECT INT_MAX
-            PyAPI_FUNC(int) PyCompile_OpcodeStackEffect(int opcode, int oparg);
-            PyAPI_FUNC(int) PyCompile_OpcodeStackEffectWithJump(int opcode, int oparg, int jump);
-
-            PyAPI_FUNC(int) _PyAST_Optimize(struct _mod *, PyArena *arena, int optimize);
-
-            #ifdef __cplusplus
-            }
-            #endif
-
-            #endif /* !Py_LIMITED_API */
-
-            /* These definitions must match corresponding definitions in graminit.h. */
-            #define Py_single_input 256
-            #define Py_file_input 257
-            #define Py_eval_input 258
-            #define Py_func_type_input 345
-
-            #endif /* !Py_COMPILE_H */
-            ''').strip()
-        lines = [line + '\n' for line in text.splitlines()]
-        lines[-1] = lines[-1][:-1]
-
-        results = list(
-                iter_lines(lines, _parse_directive=self._parse_directive))
-
-        self.assertEqual(results, [
-            (1, '#ifndef Py_COMPILE_H\n',
-                IfDirective('ifndef', 'Py_COMPILE_H'),
-                ()),
-            (2, '#define Py_COMPILE_H\n',
-                Constant('Py_COMPILE_H', None),
-                ('! defined(Py_COMPILE_H)',)),
-            (3, '\n',
-                None,
-                ('! defined(Py_COMPILE_H)',)),
-            (4, '#ifndef Py_LIMITED_API\n',
-                IfDirective('ifndef', 'Py_LIMITED_API'),
-                ('! defined(Py_COMPILE_H)',)),
-            (5, '#include "code.h"\n',
-                Include('"code.h"'),
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (6, '\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (7, '#ifdef __cplusplus\n',
-                IfDirective('ifdef', '__cplusplus'),
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (8, 'extern "C" {\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)', 'defined(__cplusplus)')),
-            (9, '#endif\n',
-                OtherDirective('endif', None),
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)', 'defined(__cplusplus)')),
-            (10, '\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (11, ' \n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (12, 'struct _node;  \n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (13, 'PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, const char *);\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (14, ' \n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (15, '\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (19, '#define PyCF_MASK (CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT |                     CO_FUTURE_WITH_STATEMENT | CO_FUTURE_PRINT_FUNCTION |                     CO_FUTURE_UNICODE_LITERALS | CO_FUTURE_BARRY_AS_BDFL |                     CO_FUTURE_GENERATOR_STOP | CO_FUTURE_ANNOTATIONS)\n',
-                Constant('PyCF_MASK', '(CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_WITH_STATEMENT | CO_FUTURE_PRINT_FUNCTION | CO_FUTURE_UNICODE_LITERALS | CO_FUTURE_BARRY_AS_BDFL | CO_FUTURE_GENERATOR_STOP | CO_FUTURE_ANNOTATIONS)'),
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (20, '#define PyCF_MASK_OBSOLETE (CO_NESTED)\n',
-                Constant('PyCF_MASK_OBSOLETE', '(CO_NESTED)'),
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (21, '#define PyCF_SOURCE_IS_UTF8  0x0100\n',
-                Constant('PyCF_SOURCE_IS_UTF8', ' 0x0100'),
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (22, '#define PyCF_DONT_IMPLY_DEDENT 0x0200\n',
-                Constant('PyCF_DONT_IMPLY_DEDENT', '0x0200'),
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (23, '#define PyCF_ONLY_AST 0x0400\n',
-                Constant('PyCF_ONLY_AST', '0x0400'),
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (24, '#define PyCF_IGNORE_COOKIE 0x0800\n',
-                Constant('PyCF_IGNORE_COOKIE', '0x0800'),
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (25, '#define PyCF_TYPE_COMMENTS 0x1000\n',
-                Constant('PyCF_TYPE_COMMENTS', '0x1000'),
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (26, '#define PyCF_ALLOW_TOP_LEVEL_AWAIT 0x2000\n',
-                Constant('PyCF_ALLOW_TOP_LEVEL_AWAIT', '0x2000'),
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (27, '\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (28, '#ifndef Py_LIMITED_API\n',
-                IfDirective('ifndef', 'Py_LIMITED_API'),
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (29, 'typedef struct {\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)', '! defined(Py_LIMITED_API)')),
-            (30, '    int cf_flags;   \n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)', '! defined(Py_LIMITED_API)')),
-            (31, '    int cf_feature_version;   \n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)', '! defined(Py_LIMITED_API)')),
-            (32, '} PyCompilerFlags;\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)', '! defined(Py_LIMITED_API)')),
-            (33, '#endif\n',
-                OtherDirective('endif', None),
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)', '! defined(Py_LIMITED_API)')),
-            (34, '\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (35, ' \n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (36, '\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (37, 'typedef struct {\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (38, '    int ff_features;       \n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (39, '    int ff_lineno;         \n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (40, '} PyFutureFeatures;\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (41, '\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (42, '#define FUTURE_NESTED_SCOPES "nested_scopes"\n',
-                Constant('FUTURE_NESTED_SCOPES', '"nested_scopes"'),
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (43, '#define FUTURE_GENERATORS "generators"\n',
-                Constant('FUTURE_GENERATORS', '"generators"'),
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (44, '#define FUTURE_DIVISION "division"\n',
-                Constant('FUTURE_DIVISION', '"division"'),
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (45, '#define FUTURE_ABSOLUTE_IMPORT "absolute_import"\n',
-                Constant('FUTURE_ABSOLUTE_IMPORT', '"absolute_import"'),
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (46, '#define FUTURE_WITH_STATEMENT "with_statement"\n',
-                Constant('FUTURE_WITH_STATEMENT', '"with_statement"'),
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (47, '#define FUTURE_PRINT_FUNCTION "print_function"\n',
-                Constant('FUTURE_PRINT_FUNCTION', '"print_function"'),
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (48, '#define FUTURE_UNICODE_LITERALS "unicode_literals"\n',
-                Constant('FUTURE_UNICODE_LITERALS', '"unicode_literals"'),
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (49, '#define FUTURE_BARRY_AS_BDFL "barry_as_FLUFL"\n',
-                Constant('FUTURE_BARRY_AS_BDFL', '"barry_as_FLUFL"'),
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (50, '#define FUTURE_GENERATOR_STOP "generator_stop"\n',
-                Constant('FUTURE_GENERATOR_STOP', '"generator_stop"'),
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (51, '#define FUTURE_ANNOTATIONS "annotations"\n',
-                Constant('FUTURE_ANNOTATIONS', '"annotations"'),
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (52, '\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (53, 'struct _mod;  \n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (54, '#define PyAST_Compile(mod, s, f, ar) PyAST_CompileEx(mod, s, f, -1, ar)\n',
-                Macro('PyAST_Compile', ('mod', 's', 'f', 'ar'), 'PyAST_CompileEx(mod, s, f, -1, ar)'),
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (55, 'PyAPI_FUNC(PyCodeObject *) PyAST_CompileEx(\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (56, '    struct _mod *mod,\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (57, '    const char *filename,        \n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (58, '    PyCompilerFlags *flags,\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (59, '    int optimize,\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (60, '    PyArena *arena);\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (61, 'PyAPI_FUNC(PyCodeObject *) PyAST_CompileObject(\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (62, '    struct _mod *mod,\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (63, '    PyObject *filename,\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (64, '    PyCompilerFlags *flags,\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (65, '    int optimize,\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (66, '    PyArena *arena);\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (67, 'PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromAST(\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (68, '    struct _mod * mod,\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (69, '    const char *filename         \n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (70, '    );\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (71, 'PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromASTObject(\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (72, '    struct _mod * mod,\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (73, '    PyObject *filename\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (74, '    );\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (75, '\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (76, ' \n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (77, 'PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name);\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (78, '\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (79, '#define PY_INVALID_STACK_EFFECT INT_MAX\n',
-                Constant('PY_INVALID_STACK_EFFECT', 'INT_MAX'),
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (80, 'PyAPI_FUNC(int) PyCompile_OpcodeStackEffect(int opcode, int oparg);\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (81, 'PyAPI_FUNC(int) PyCompile_OpcodeStackEffectWithJump(int opcode, int oparg, int jump);\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (82, '\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (83, 'PyAPI_FUNC(int) _PyAST_Optimize(struct _mod *, PyArena *arena, int optimize);\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (84, '\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (85, '#ifdef __cplusplus\n',
-                IfDirective('ifdef', '__cplusplus'),
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (86, '}\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)', 'defined(__cplusplus)')),
-            (87, '#endif\n',
-                OtherDirective('endif', None),
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)', 'defined(__cplusplus)')),
-            (88, '\n',
-                None,
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (89, '#endif  \n',
-                OtherDirective('endif', None),
-                ('! defined(Py_COMPILE_H)', '! defined(Py_LIMITED_API)')),
-            (90, '\n',
-                None,
-                ('! defined(Py_COMPILE_H)',)),
-            (91, ' \n',
-                None,
-                ('! defined(Py_COMPILE_H)',)),
-            (92, '#define Py_single_input 256\n',
-                Constant('Py_single_input', '256'),
-                ('! defined(Py_COMPILE_H)',)),
-            (93, '#define Py_file_input 257\n',
-                Constant('Py_file_input', '257'),
-                ('! defined(Py_COMPILE_H)',)),
-            (94, '#define Py_eval_input 258\n',
-                Constant('Py_eval_input', '258'),
-                ('! defined(Py_COMPILE_H)',)),
-            (95, '#define Py_func_type_input 345\n',
-                Constant('Py_func_type_input', '345'),
-                ('! defined(Py_COMPILE_H)',)),
-            (96, '\n',
-                None,
-                ('! defined(Py_COMPILE_H)',)),
-            (97, '#endif  ',
-                OtherDirective('endif', None),
-                ('! defined(Py_COMPILE_H)',)),
-            ])
-        self.check_calls(
-                ('_parse_directive', '#ifndef Py_COMPILE_H'),
-                ('_parse_directive', '#define Py_COMPILE_H'),
-                ('_parse_directive', '#ifndef Py_LIMITED_API'),
-                ('_parse_directive', '#include "code.h"'),
-                ('_parse_directive', '#ifdef __cplusplus'),
-                ('_parse_directive', '#endif'),
-                ('_parse_directive', '#define PyCF_MASK (CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | CO_FUTURE_WITH_STATEMENT | CO_FUTURE_PRINT_FUNCTION | CO_FUTURE_UNICODE_LITERALS | CO_FUTURE_BARRY_AS_BDFL | CO_FUTURE_GENERATOR_STOP | CO_FUTURE_ANNOTATIONS)'),
-                ('_parse_directive', '#define PyCF_MASK_OBSOLETE (CO_NESTED)'),
-                ('_parse_directive', '#define PyCF_SOURCE_IS_UTF8 0x0100'),
-                ('_parse_directive', '#define PyCF_DONT_IMPLY_DEDENT 0x0200'),
-                ('_parse_directive', '#define PyCF_ONLY_AST 0x0400'),
-                ('_parse_directive', '#define PyCF_IGNORE_COOKIE 0x0800'),
-                ('_parse_directive', '#define PyCF_TYPE_COMMENTS 0x1000'),
-                ('_parse_directive', '#define PyCF_ALLOW_TOP_LEVEL_AWAIT 0x2000'),
-                ('_parse_directive', '#ifndef Py_LIMITED_API'),
-                ('_parse_directive', '#endif'),
-                ('_parse_directive', '#define FUTURE_NESTED_SCOPES "nested_scopes"'),
-                ('_parse_directive', '#define FUTURE_GENERATORS "generators"'),
-                ('_parse_directive', '#define FUTURE_DIVISION "division"'),
-                ('_parse_directive', '#define FUTURE_ABSOLUTE_IMPORT "absolute_import"'),
-                ('_parse_directive', '#define FUTURE_WITH_STATEMENT "with_statement"'),
-                ('_parse_directive', '#define FUTURE_PRINT_FUNCTION "print_function"'),
-                ('_parse_directive', '#define FUTURE_UNICODE_LITERALS "unicode_literals"'),
-                ('_parse_directive', '#define FUTURE_BARRY_AS_BDFL "barry_as_FLUFL"'),
-                ('_parse_directive', '#define FUTURE_GENERATOR_STOP "generator_stop"'),
-                ('_parse_directive', '#define FUTURE_ANNOTATIONS "annotations"'),
-                ('_parse_directive', '#define PyAST_Compile(mod, s, f, ar) PyAST_CompileEx(mod, s, f, -1, ar)'),
-                ('_parse_directive', '#define PY_INVALID_STACK_EFFECT INT_MAX'),
-                ('_parse_directive', '#ifdef __cplusplus'),
-                ('_parse_directive', '#endif'),
-                ('_parse_directive', '#endif'),
-                ('_parse_directive', '#define Py_single_input 256'),
-                ('_parse_directive', '#define Py_file_input 257'),
-                ('_parse_directive', '#define Py_eval_input 258'),
-                ('_parse_directive', '#define Py_func_type_input 345'),
-                ('_parse_directive', '#endif'),
-                )
-
-
-class ParseDirectiveTests(unittest.TestCase):
-
-    def test_directives(self):
-        tests = [
-            # includes
-            ('#include "internal/pycore_pystate.h"', Include('"internal/pycore_pystate.h"')),
-            ('#include <stdio>', Include('<stdio>')),
-
-            # defines
-            ('#define SPAM int', Constant('SPAM', 'int')),
-            ('#define SPAM', Constant('SPAM', '')),
-            ('#define SPAM(x, y) run(x, y)', Macro('SPAM', ('x', 'y'), 'run(x, y)')),
-            ('#undef SPAM', None),
-
-            # conditionals
-            ('#if SPAM', IfDirective('if', 'SPAM')),
-            # XXX complex conditionls
-            ('#ifdef SPAM', IfDirective('ifdef', 'SPAM')),
-            ('#ifndef SPAM', IfDirective('ifndef', 'SPAM')),
-            ('#elseif SPAM', IfDirective('elseif', 'SPAM')),
-            # XXX complex conditionls
-            ('#else', OtherDirective('else', '')),
-            ('#endif', OtherDirective('endif', '')),
-
-            # other
-            ('#error oops!', None),
-            ('#warning oops!', None),
-            ('#pragma ...', None),
-            ('#__FILE__ ...', None),
-            ('#__LINE__ ...', None),
-            ('#__DATE__ ...', None),
-            ('#__TIME__ ...', None),
-            ('#__TIMESTAMP__ ...', None),
-
-            # extra whitespace
-            (' # include  <stdio> ', Include('<stdio>')),
-            ('#else  ', OtherDirective('else', '')),
-            ('#endif  ', OtherDirective('endif', '')),
-            ('#define SPAM int  ', Constant('SPAM', 'int')),
-            ('#define SPAM  ', Constant('SPAM', '')),
-            ]
-        for line, expected in tests:
-            if expected is None:
-                kind, _, text = line[1:].partition(' ')
-                expected = OtherDirective(kind, text)
-            with self.subTest(line):
-                directive = parse_directive(line)
-
-                self.assertEqual(directive, expected)
-
-    def test_bad_directives(self):
-        tests = [
-            # valid directives with bad text
-            '#define 123',
-            '#else spam',
-            '#endif spam',
-            ]
-        for kind in PreprocessorDirective.KINDS:
-            # missing leading "#"
-            tests.append(kind)
-            if kind in ('else', 'endif'):
-                continue
-            # valid directives with missing text
-            tests.append('#' + kind)
-            tests.append('#' + kind + ' ')
-        for line in tests:
-            with self.subTest(line):
-                with self.assertRaises(ValueError):
-                    parse_directive(line)
-
-    def test_not_directives(self):
-        tests = [
-            '',
-            ' ',
-            'directive',
-            'directive?',
-            '???',
-            ]
-        for line in tests:
-            with self.subTest(line):
-                with self.assertRaises(ValueError):
-                    parse_directive(line)
-
-
-class ConstantTests(unittest.TestCase):
-
-    def test_type(self):
-        directive = Constant('SPAM', '123')
-
-        self.assertIs(type(directive), Constant)
-        self.assertIsInstance(directive, PreprocessorDirective)
-
-    def test_attrs(self):
-        d = Constant('SPAM', '123')
-        kind, name, value = d.kind, d.name, d.value
-
-        self.assertEqual(kind, 'define')
-        self.assertEqual(name, 'SPAM')
-        self.assertEqual(value, '123')
-
-    def test_text(self):
-        tests = [
-            (('SPAM', '123'), 'SPAM 123'),
-            (('SPAM',), 'SPAM'),
-            ]
-        for args, expected in tests:
-            with self.subTest(args):
-                d = Constant(*args)
-                text = d.text
-
-                self.assertEqual(text, expected)
-
-    def test_iter(self):
-        kind, name, value = Constant('SPAM', '123')
-
-        self.assertEqual(kind, 'define')
-        self.assertEqual(name, 'SPAM')
-        self.assertEqual(value, '123')
-
-    def test_defaults(self):
-        kind, name, value = Constant('SPAM')
-
-        self.assertEqual(kind, 'define')
-        self.assertEqual(name, 'SPAM')
-        self.assertIs(value, None)
-
-    def test_coerce(self):
-        tests = []
-        # coerced name, value
-        for args in wrapped_arg_combos('SPAM', '123'):
-            tests.append((args, ('SPAM', '123')))
-        # missing name, value
-        for name in ('', ' ', None, StrProxy(' '), ()):
-            for value in ('', ' ', None, StrProxy(' '), ()):
-                tests.append(
-                        ((name, value), (None, None)))
-        # whitespace
-        tests.extend([
-            ((' SPAM ', ' 123 '), ('SPAM', '123')),
-            ])
-
-        for args, expected in tests:
-            with self.subTest(args):
-                d = Constant(*args)
-
-                self.assertEqual(d[1:], expected)
-                for i, exp in enumerate(expected, start=1):
-                    if exp is not None:
-                        self.assertIs(type(d[i]), str)
-
-    def test_valid(self):
-        tests = [
-            ('SPAM', '123'),
-            # unusual name
-            ('_SPAM_', '123'),
-            ('X_1', '123'),
-            # unusual value
-            ('SPAM', None),
-            ]
-        for args in tests:
-            with self.subTest(args):
-                directive = Constant(*args)
-
-                directive.validate()
-
-    def test_invalid(self):
-        tests = [
-            # invalid name
-            ((None, '123'), TypeError),
-            (('_', '123'), ValueError),
-            (('1', '123'), ValueError),
-            (('_1_', '123'), ValueError),
-            # There is no invalid value (including None).
-            ]
-        for args, exctype in tests:
-            with self.subTest(args):
-                directive = Constant(*args)
-
-                with self.assertRaises(exctype):
-                    directive.validate()
-
-
-class MacroTests(unittest.TestCase):
-
-    def test_type(self):
-        directive = Macro('SPAM', ('x', 'y'), '123')
-
-        self.assertIs(type(directive), Macro)
-        self.assertIsInstance(directive, PreprocessorDirective)
-
-    def test_attrs(self):
-        d = Macro('SPAM', ('x', 'y'), '123')
-        kind, name, args, body = d.kind, d.name, d.args, d.body
-
-        self.assertEqual(kind, 'define')
-        self.assertEqual(name, 'SPAM')
-        self.assertEqual(args, ('x', 'y'))
-        self.assertEqual(body, '123')
-
-    def test_text(self):
-        tests = [
-            (('SPAM', ('x', 'y'), '123'), 'SPAM(x, y) 123'),
-            (('SPAM', ('x', 'y'),), 'SPAM(x, y)'),
-            ]
-        for args, expected in tests:
-            with self.subTest(args):
-                d = Macro(*args)
-                text = d.text
-
-                self.assertEqual(text, expected)
-
-    def test_iter(self):
-        kind, name, args, body = Macro('SPAM', ('x', 'y'), '123')
-
-        self.assertEqual(kind, 'define')
-        self.assertEqual(name, 'SPAM')
-        self.assertEqual(args, ('x', 'y'))
-        self.assertEqual(body, '123')
-
-    def test_defaults(self):
-        kind, name, args, body = Macro('SPAM', ('x', 'y'))
-
-        self.assertEqual(kind, 'define')
-        self.assertEqual(name, 'SPAM')
-        self.assertEqual(args, ('x', 'y'))
-        self.assertIs(body, None)
-
-    def test_coerce(self):
-        tests = []
-        # coerce name and body
-        for args in wrapped_arg_combos('SPAM', ('x', 'y'), '123'):
-            tests.append(
-                    (args, ('SPAM', ('x', 'y'), '123')))
-        # coerce args
-        tests.extend([
-            (('SPAM', 'x', '123'),
-             ('SPAM', ('x',), '123')),
-            (('SPAM', 'x,y', '123'),
-             ('SPAM', ('x', 'y'), '123')),
-            ])
-        # coerce arg names
-        for argnames in wrapped_arg_combos('x', 'y'):
-            tests.append(
-                    (('SPAM', argnames, '123'),
-                     ('SPAM', ('x', 'y'), '123')))
-        # missing name, body
-        for name in ('', ' ', None, StrProxy(' '), ()):
-            for argnames in (None, ()):
-                for body in ('', ' ', None, StrProxy(' '), ()):
-                    tests.append(
-                            ((name, argnames, body),
-                             (None, (), None)))
-        # missing args
-        tests.extend([
-            (('SPAM', None, '123'),
-             ('SPAM', (), '123')),
-            (('SPAM', (), '123'),
-             ('SPAM', (), '123')),
-            ])
-        # missing arg names
-        for arg in ('', ' ', None, StrProxy(' '), ()):
-            tests.append(
-                    (('SPAM', (arg,), '123'),
-                     ('SPAM', (None,), '123')))
-        tests.extend([
-            (('SPAM', ('x', '', 'z'), '123'),
-             ('SPAM', ('x', None, 'z'), '123')),
-            ])
-        # whitespace
-        tests.extend([
-            ((' SPAM ', (' x ', ' y '), ' 123 '),
-             ('SPAM', ('x', 'y'), '123')),
-            (('SPAM', 'x, y', '123'),
-             ('SPAM', ('x', 'y'), '123')),
-            ])
-
-        for args, expected in tests:
-            with self.subTest(args):
-                d = Macro(*args)
-
-                self.assertEqual(d[1:], expected)
-                for i, exp in enumerate(expected, start=1):
-                    if i == 2:
-                        self.assertIs(type(d[i]), tuple)
-                    elif exp is not None:
-                        self.assertIs(type(d[i]), str)
-
-    def test_init_bad_args(self):
-        tests = [
-            ('SPAM', StrProxy('x'), '123'),
-            ('SPAM', object(), '123'),
-            ]
-        for args in tests:
-            with self.subTest(args):
-                with self.assertRaises(TypeError):
-                    Macro(*args)
-
-    def test_valid(self):
-        tests = [
-            # unusual name
-            ('SPAM', ('x', 'y'), 'run(x, y)'),
-            ('_SPAM_', ('x', 'y'), 'run(x, y)'),
-            ('X_1', ('x', 'y'), 'run(x, y)'),
-            # unusual args
-            ('SPAM', (), 'run(x, y)'),
-            ('SPAM', ('_x_', 'y_1'), 'run(x, y)'),
-            ('SPAM', 'x', 'run(x, y)'),
-            ('SPAM', 'x, y', 'run(x, y)'),
-            # unusual body
-            ('SPAM', ('x', 'y'), None),
-            ]
-        for args in tests:
-            with self.subTest(args):
-                directive = Macro(*args)
-
-                directive.validate()
-
-    def test_invalid(self):
-        tests = [
-            # invalid name
-            ((None, ('x', 'y'), '123'), TypeError),
-            (('_', ('x', 'y'), '123'), ValueError),
-            (('1', ('x', 'y'), '123'), ValueError),
-            (('_1', ('x', 'y'), '123'), ValueError),
-            # invalid args
-            (('SPAM', (None, 'y'), '123'), ValueError),
-            (('SPAM', ('x', '_'), '123'), ValueError),
-            (('SPAM', ('x', '1'), '123'), ValueError),
-            (('SPAM', ('x', '_1_'), '123'), ValueError),
-            # There is no invalid body (including None).
-            ]
-        for args, exctype in tests:
-            with self.subTest(args):
-                directive = Macro(*args)
-
-                with self.assertRaises(exctype):
-                    directive.validate()
-
-
-class IfDirectiveTests(unittest.TestCase):
-
-    def test_type(self):
-        directive = IfDirective('if', '1')
-
-        self.assertIs(type(directive), IfDirective)
-        self.assertIsInstance(directive, PreprocessorDirective)
-
-    def test_attrs(self):
-        d = IfDirective('if', '1')
-        kind, condition = d.kind, d.condition
-
-        self.assertEqual(kind, 'if')
-        self.assertEqual(condition, '1')
-        #self.assertEqual(condition, (ArithmeticCondition('1'),))
-
-    def test_text(self):
-        tests = [
-            (('if', 'defined(SPAM) && 1 || (EGGS > 3 && defined(HAM))'),
-             'defined(SPAM) && 1 || (EGGS > 3 && defined(HAM))'),
-            ]
-        for kind in IfDirective.KINDS:
-            tests.append(
-                    ((kind, 'SPAM'), 'SPAM'))
-        for args, expected in tests:
-            with self.subTest(args):
-                d = IfDirective(*args)
-                text = d.text
-
-                self.assertEqual(text, expected)
-
-    def test_iter(self):
-        kind, condition = IfDirective('if', '1')
-
-        self.assertEqual(kind, 'if')
-        self.assertEqual(condition, '1')
-        #self.assertEqual(condition, (ArithmeticCondition('1'),))
-
-    #def test_complex_conditions(self):
-    #    ...
-
-    def test_coerce(self):
-        tests = []
-        for kind in IfDirective.KINDS:
-            if kind == 'ifdef':
-                cond = 'defined(SPAM)'
-            elif kind == 'ifndef':
-                cond = '! defined(SPAM)'
-            else:
-                cond = 'SPAM'
-            for args in wrapped_arg_combos(kind, 'SPAM'):
-                tests.append((args, (kind, cond)))
-            tests.extend([
-                ((' ' + kind + ' ', ' SPAM '), (kind, cond)),
-                ])
-            for raw in ('', ' ', None, StrProxy(' '), ()):
-                tests.append(((kind, raw), (kind, None)))
-        for kind in ('', ' ', None, StrProxy(' '), ()):
-            tests.append(((kind, 'SPAM'), (None, 'SPAM')))
-        for args, expected in tests:
-            with self.subTest(args):
-                d = IfDirective(*args)
-
-                self.assertEqual(tuple(d), expected)
-                for i, exp in enumerate(expected):
-                    if exp is not None:
-                        self.assertIs(type(d[i]), str)
-
-    def test_valid(self):
-        tests = []
-        for kind in IfDirective.KINDS:
-            tests.extend([
-                (kind, 'SPAM'),
-                (kind, '_SPAM_'),
-                (kind, 'X_1'),
-                (kind, '()'),
-                (kind, '--'),
-                (kind, '???'),
-                ])
-        for args in tests:
-            with self.subTest(args):
-                directive = IfDirective(*args)
-
-                directive.validate()
-
-    def test_invalid(self):
-        tests = []
-        # kind
-        tests.extend([
-            ((None, 'SPAM'), TypeError),
-            (('_', 'SPAM'), ValueError),
-            (('-', 'SPAM'), ValueError),
-            (('spam', 'SPAM'), ValueError),
-            ])
-        for kind in PreprocessorDirective.KINDS:
-            if kind in IfDirective.KINDS:
-                continue
-            tests.append(
-                ((kind, 'SPAM'), ValueError))
-        # condition
-        for kind in IfDirective.KINDS:
-            tests.extend([
-                ((kind, None), TypeError),
-                # Any other condition is valid.
-                ])
-        for args, exctype in tests:
-            with self.subTest(args):
-                directive = IfDirective(*args)
-
-                with self.assertRaises(exctype):
-                    directive.validate()
-
-
-class IncludeTests(unittest.TestCase):
-
-    def test_type(self):
-        directive = Include('<stdio>')
-
-        self.assertIs(type(directive), Include)
-        self.assertIsInstance(directive, PreprocessorDirective)
-
-    def test_attrs(self):
-        d = Include('<stdio>')
-        kind, file, text = d.kind, d.file, d.text
-
-        self.assertEqual(kind, 'include')
-        self.assertEqual(file, '<stdio>')
-        self.assertEqual(text, '<stdio>')
-
-    def test_iter(self):
-        kind, file = Include('<stdio>')
-
-        self.assertEqual(kind, 'include')
-        self.assertEqual(file, '<stdio>')
-
-    def test_coerce(self):
-        tests = []
-        for arg, in wrapped_arg_combos('<stdio>'):
-            tests.append((arg, '<stdio>'))
-        tests.extend([
-            (' <stdio> ', '<stdio>'),
-            ])
-        for arg in ('', ' ', None, StrProxy(' '), ()):
-            tests.append((arg, None ))
-        for arg, expected in tests:
-            with self.subTest(arg):
-                _, file = Include(arg)
-
-                self.assertEqual(file, expected)
-                if expected is not None:
-                    self.assertIs(type(file), str)
-
-    def test_valid(self):
-        tests = [
-            '<stdio>',
-            '"spam.h"',
-            '"internal/pycore_pystate.h"',
-            ]
-        for arg in tests:
-            with self.subTest(arg):
-                directive = Include(arg)
-
-                directive.validate()
-
-    def test_invalid(self):
-        tests = [
-            (None, TypeError),
-            # We currently don't check the file.
-            ]
-        for arg, exctype in tests:
-            with self.subTest(arg):
-                directive = Include(arg)
-
-                with self.assertRaises(exctype):
-                    directive.validate()
-
-
-class OtherDirectiveTests(unittest.TestCase):
-
-    def test_type(self):
-        directive = OtherDirective('undef', 'SPAM')
-
-        self.assertIs(type(directive), OtherDirective)
-        self.assertIsInstance(directive, PreprocessorDirective)
-
-    def test_attrs(self):
-        d = OtherDirective('undef', 'SPAM')
-        kind, text = d.kind, d.text
-
-        self.assertEqual(kind, 'undef')
-        self.assertEqual(text, 'SPAM')
-
-    def test_iter(self):
-        kind, text = OtherDirective('undef', 'SPAM')
-
-        self.assertEqual(kind, 'undef')
-        self.assertEqual(text, 'SPAM')
-
-    def test_coerce(self):
-        tests = []
-        for kind in OtherDirective.KINDS:
-            if kind in ('else', 'endif'):
-                continue
-            for args in wrapped_arg_combos(kind, '...'):
-                tests.append((args, (kind, '...')))
-            tests.extend([
-                ((' ' + kind + ' ', ' ... '), (kind, '...')),
-                ])
-            for raw in ('', ' ', None, StrProxy(' '), ()):
-                tests.append(((kind, raw), (kind, None)))
-        for kind in ('else', 'endif'):
-            for args in wrapped_arg_combos(kind, None):
-                tests.append((args, (kind, None)))
-            tests.extend([
-                ((' ' + kind + ' ', None), (kind, None)),
-                ])
-        for kind in ('', ' ', None, StrProxy(' '), ()):
-            tests.append(((kind, '...'), (None, '...')))
-        for args, expected in tests:
-            with self.subTest(args):
-                d = OtherDirective(*args)
-
-                self.assertEqual(tuple(d), expected)
-                for i, exp in enumerate(expected):
-                    if exp is not None:
-                        self.assertIs(type(d[i]), str)
-
-    def test_valid(self):
-        tests = []
-        for kind in OtherDirective.KINDS:
-            if kind in ('else', 'endif'):
-                continue
-            tests.extend([
-                (kind, '...'),
-                (kind, '???'),
-                (kind, 'SPAM'),
-                (kind, '1 + 1'),
-                ])
-        for kind in ('else', 'endif'):
-            tests.append((kind, None))
-        for args in tests:
-            with self.subTest(args):
-                directive = OtherDirective(*args)
-
-                directive.validate()
-
-    def test_invalid(self):
-        tests = []
-        # kind
-        tests.extend([
-            ((None, '...'), TypeError),
-            (('_', '...'), ValueError),
-            (('-', '...'), ValueError),
-            (('spam', '...'), ValueError),
-            ])
-        for kind in PreprocessorDirective.KINDS:
-            if kind in OtherDirective.KINDS:
-                continue
-            tests.append(
-                ((kind, None), ValueError))
-        # text
-        for kind in OtherDirective.KINDS:
-            if kind in ('else', 'endif'):
-                tests.extend([
-                    # Any text is invalid.
-                    ((kind, 'SPAM'), ValueError),
-                    ((kind, '...'), ValueError),
-                    ])
-            else:
-                tests.extend([
-                    ((kind, None), TypeError),
-                    # Any other text is valid.
-                    ])
-        for args, exctype in tests:
-            with self.subTest(args):
-                directive = OtherDirective(*args)
-
-                with self.assertRaises(exctype):
-                    directive.validate()
diff --git a/Lib/test/test_tools/test_c_analyzer/test_symbols/__init__.py b/Lib/test/test_tools/test_c_analyzer/test_symbols/__init__.py
deleted file mode 100644
index bc502ef..0000000
--- a/Lib/test/test_tools/test_c_analyzer/test_symbols/__init__.py
+++ /dev/null
@@ -1,6 +0,0 @@
-import os.path
-from test.support import load_package_tests
-
-
-def load_tests(*args):
-    return load_package_tests(os.path.dirname(__file__), *args)
diff --git a/Lib/test/test_tools/test_c_analyzer/test_symbols/test_info.py b/Lib/test/test_tools/test_c_analyzer/test_symbols/test_info.py
deleted file mode 100644
index 1282a89..0000000
--- a/Lib/test/test_tools/test_c_analyzer/test_symbols/test_info.py
+++ /dev/null
@@ -1,192 +0,0 @@
-import string
-import unittest
-
-from ..util import PseudoStr, StrProxy, Object
-from .. import tool_imports_for_tests
-with tool_imports_for_tests():
-    from c_analyzer.common.info import ID
-    from c_analyzer.symbols.info import Symbol
-
-
-class SymbolTests(unittest.TestCase):
-
-    VALID_ARGS = (
-            ID('x/y/z/spam.c', 'func', 'eggs'),
-            Symbol.KIND.VARIABLE,
-            False,
-            )
-    VALID_KWARGS = dict(zip(Symbol._fields, VALID_ARGS))
-    VALID_EXPECTED = VALID_ARGS
-
-    def test_init_typical_binary_local(self):
-        id = ID(None, None, 'spam')
-        symbol = Symbol(
-                id=id,
-                kind=Symbol.KIND.VARIABLE,
-                external=False,
-                )
-
-        self.assertEqual(symbol, (
-            id,
-            Symbol.KIND.VARIABLE,
-            False,
-            ))
-
-    def test_init_typical_binary_global(self):
-        id = ID('Python/ceval.c', None, 'spam')
-        symbol = Symbol(
-                id=id,
-                kind=Symbol.KIND.VARIABLE,
-                external=False,
-                )
-
-        self.assertEqual(symbol, (
-            id,
-            Symbol.KIND.VARIABLE,
-            False,
-            ))
-
-    def test_init_coercion(self):
-        tests = [
-            ('str subclass',
-             dict(
-                 id=PseudoStr('eggs'),
-                 kind=PseudoStr('variable'),
-                 external=0,
-                 ),
-             (ID(None, None, 'eggs'),
-              Symbol.KIND.VARIABLE,
-              False,
-              )),
-            ('with filename',
-             dict(
-                 id=('x/y/z/spam.c', 'eggs'),
-                 kind=PseudoStr('variable'),
-                 external=0,
-                 ),
-             (ID('x/y/z/spam.c', None, 'eggs'),
-              Symbol.KIND.VARIABLE,
-              False,
-              )),
-            ('non-str 1',
-             dict(
-                 id=('a', 'b', 'c'),
-                 kind=StrProxy('variable'),
-                 external=0,
-                 ),
-             (ID('a', 'b', 'c'),
-              Symbol.KIND.VARIABLE,
-              False,
-              )),
-            ('non-str 2',
-             dict(
-                 id=('a', 'b', 'c'),
-                 kind=Object(),
-                 external=0,
-                 ),
-             (ID('a', 'b', 'c'),
-              '<object>',
-              False,
-              )),
-            ]
-        for summary, kwargs, expected in tests:
-            with self.subTest(summary):
-                symbol = Symbol(**kwargs)
-
-                for field in Symbol._fields:
-                    value = getattr(symbol, field)
-                    if field == 'external':
-                        self.assertIs(type(value), bool)
-                    elif field == 'id':
-                        self.assertIs(type(value), ID)
-                    else:
-                        self.assertIs(type(value), str)
-                self.assertEqual(tuple(symbol), expected)
-
-    def test_init_all_missing(self):
-        id = ID(None, None, 'spam')
-
-        symbol = Symbol(id)
-
-        self.assertEqual(symbol, (
-            id,
-            Symbol.KIND.VARIABLE,
-            None,
-            ))
-
-    def test_fields(self):
-        id = ID('z', 'x', 'a')
-
-        symbol = Symbol(id, 'b', False)
-
-        self.assertEqual(symbol.id, id)
-        self.assertEqual(symbol.kind, 'b')
-        self.assertIs(symbol.external, False)
-
-    def test___getattr__(self):
-        id = ID('z', 'x', 'a')
-        symbol = Symbol(id, 'b', False)
-
-        filename = symbol.filename
-        funcname = symbol.funcname
-        name = symbol.name
-
-        self.assertEqual(filename, 'z')
-        self.assertEqual(funcname, 'x')
-        self.assertEqual(name, 'a')
-
-    def test_validate_typical(self):
-        id = ID('z', 'x', 'a')
-
-        symbol = Symbol(
-                id=id,
-                kind=Symbol.KIND.VARIABLE,
-                external=False,
-                )
-
-        symbol.validate()  # This does not fail.
-
-    def test_validate_missing_field(self):
-        for field in Symbol._fields:
-            with self.subTest(field):
-                symbol = Symbol(**self.VALID_KWARGS)
-                symbol = symbol._replace(**{field: None})
-
-                with self.assertRaises(TypeError):
-                    symbol.validate()
-
-    def test_validate_bad_field(self):
-        badch = tuple(c for c in string.punctuation + string.digits)
-        notnames = (
-                '1a',
-                'a.b',
-                'a-b',
-                '&a',
-                'a++',
-                ) + badch
-        tests = [
-            ('id', notnames),
-            ('kind', ('bogus',)),
-            ]
-        seen = set()
-        for field, invalid in tests:
-            for value in invalid:
-                if field != 'kind':
-                    seen.add(value)
-                with self.subTest(f'{field}={value!r}'):
-                    symbol = Symbol(**self.VALID_KWARGS)
-                    symbol = symbol._replace(**{field: value})
-
-                    with self.assertRaises(ValueError):
-                        symbol.validate()
-
-        for field, invalid in tests:
-            if field == 'kind':
-                continue
-            valid = seen - set(invalid)
-            for value in valid:
-                with self.subTest(f'{field}={value!r}'):
-                    symbol = Symbol(**self.VALID_KWARGS)
-                    symbol = symbol._replace(**{field: value})
-
-                    symbol.validate()  # This does not fail.
diff --git a/Lib/test/test_tools/test_c_analyzer/test_variables/__init__.py b/Lib/test/test_tools/test_c_analyzer/test_variables/__init__.py
deleted file mode 100644
index bc502ef..0000000
--- a/Lib/test/test_tools/test_c_analyzer/test_variables/__init__.py
+++ /dev/null
@@ -1,6 +0,0 @@
-import os.path
-from test.support import load_package_tests
-
-
-def load_tests(*args):
-    return load_package_tests(os.path.dirname(__file__), *args)
diff --git a/Lib/test/test_tools/test_c_analyzer/test_variables/test_find.py b/Lib/test/test_tools/test_c_analyzer/test_variables/test_find.py
deleted file mode 100644
index 7a13cf3..0000000
--- a/Lib/test/test_tools/test_c_analyzer/test_variables/test_find.py
+++ /dev/null
@@ -1,124 +0,0 @@
-import unittest
-
-from .. import tool_imports_for_tests
-with tool_imports_for_tests():
-    from c_analyzer.variables import info
-    from c_analyzer.variables.find import (
-            vars_from_binary,
-            )
-
-
-class _Base(unittest.TestCase):
-
-    maxDiff = None
-
-    @property
-    def calls(self):
-        try:
-            return self._calls
-        except AttributeError:
-            self._calls = []
-            return self._calls
-
-
-class VarsFromBinaryTests(_Base):
-
-    _return_iter_vars = ()
-    _return_get_symbol_resolver = None
-
-    def setUp(self):
-        super().setUp()
-
-        self.kwargs = dict(
-                _iter_vars=self._iter_vars,
-                _get_symbol_resolver=self._get_symbol_resolver,
-                )
-
-    def _iter_vars(self, binfile, resolve, handle_id):
-        self.calls.append(('_iter_vars', (binfile, resolve, handle_id)))
-        return [(v, v.id) for v in self._return_iter_vars]
-
-    def _get_symbol_resolver(self, known=None, dirnames=(), *,
-                             handle_var,
-                             filenames=None,
-                             check_filename=None,
-                             perfilecache=None,
-                             ):
-        self.calls.append(('_get_symbol_resolver',
-                           (known, dirnames, handle_var, filenames,
-                            check_filename, perfilecache)))
-        return self._return_get_symbol_resolver
-
-    def test_typical(self):
-        resolver = self._return_get_symbol_resolver = object()
-        variables = self._return_iter_vars = [
-            info.Variable.from_parts('dir1/spam.c', None, 'var1', 'int'),
-            info.Variable.from_parts('dir1/spam.c', None, 'var2', 'static int'),
-            info.Variable.from_parts('dir1/spam.c', None, 'var3', 'char *'),
-            info.Variable.from_parts('dir1/spam.c', 'func2', 'var4', 'const char *'),
-            info.Variable.from_parts('dir1/eggs.c', None, 'var1', 'static int'),
-            info.Variable.from_parts('dir1/eggs.c', 'func1', 'var2', 'static char *'),
-            ]
-        known = object()
-        filenames = object()
-
-        found = list(vars_from_binary('python',
-                                      known=known,
-                                      filenames=filenames,
-                                      **self.kwargs))
-
-        self.assertEqual(found, [
-            info.Variable.from_parts('dir1/spam.c', None, 'var1', 'int'),
-            info.Variable.from_parts('dir1/spam.c', None, 'var2', 'static int'),
-            info.Variable.from_parts('dir1/spam.c', None, 'var3', 'char *'),
-            info.Variable.from_parts('dir1/spam.c', 'func2', 'var4', 'const char *'),
-            info.Variable.from_parts('dir1/eggs.c', None, 'var1', 'static int'),
-            info.Variable.from_parts('dir1/eggs.c', 'func1', 'var2', 'static char *'),
-            ])
-        self.assertEqual(self.calls, [
-            ('_get_symbol_resolver', (filenames, known, info.Variable.from_id, None, None, {})),
-            ('_iter_vars', ('python', resolver, None)),
-            ])
-
-#        self._return_iter_symbols = [
-#                s_info.Symbol(('dir1/spam.c', None, 'var1'), 'variable', False),
-#                s_info.Symbol(('dir1/spam.c', None, 'var2'), 'variable', False),
-#                s_info.Symbol(('dir1/spam.c', None, 'func1'), 'function', False),
-#                s_info.Symbol(('dir1/spam.c', None, 'func2'), 'function', True),
-#                s_info.Symbol(('dir1/spam.c', None, 'var3'), 'variable', False),
-#                s_info.Symbol(('dir1/spam.c', 'func2', 'var4'), 'variable', False),
-#                s_info.Symbol(('dir1/ham.c', None, 'var1'), 'variable', True),
-#                s_info.Symbol(('dir1/eggs.c', None, 'var1'), 'variable', False),
-#                s_info.Symbol(('dir1/eggs.c', None, 'xyz'), 'other', False),
-#                s_info.Symbol(('dir1/eggs.c', '???', 'var2'), 'variable', False),
-#                s_info.Symbol(('???', None, 'var_x'), 'variable', False),
-#                s_info.Symbol(('???', '???', 'var_y'), 'variable', False),
-#                s_info.Symbol((None, None, '???'), 'other', False),
-#                ]
-#        known = object()
-#
-#        vars_from_binary('python', knownvars=known, **this.kwargs)
-#        found = list(globals_from_symbols(['dir1'], self.iter_symbols))
-#
-#        self.assertEqual(found, [
-#            info.Variable.from_parts('dir1/spam.c', None, 'var1', '???'),
-#            info.Variable.from_parts('dir1/spam.c', None, 'var2', '???'),
-#            info.Variable.from_parts('dir1/spam.c', None, 'var3', '???'),
-#            info.Variable.from_parts('dir1/spam.c', 'func2', 'var4', '???'),
-#            info.Variable.from_parts('dir1/eggs.c', None, 'var1', '???'),
-#            ])
-#        self.assertEqual(self.calls, [
-#            ('iter_symbols', (['dir1'],)),
-#            ])
-#
-#    def test_no_symbols(self):
-#        self._return_iter_symbols = []
-#
-#        found = list(globals_from_symbols(['dir1'], self.iter_symbols))
-#
-#        self.assertEqual(found, [])
-#        self.assertEqual(self.calls, [
-#            ('iter_symbols', (['dir1'],)),
-#            ])
-
-    # XXX need functional test
diff --git a/Lib/test/test_tools/test_c_analyzer/test_variables/test_info.py b/Lib/test/test_tools/test_c_analyzer/test_variables/test_info.py
deleted file mode 100644
index d424d8e..0000000
--- a/Lib/test/test_tools/test_c_analyzer/test_variables/test_info.py
+++ /dev/null
@@ -1,244 +0,0 @@
-import string
-import unittest
-
-from ..util import PseudoStr, StrProxy, Object
-from .. import tool_imports_for_tests
-with tool_imports_for_tests():
-    from c_analyzer.common.info import UNKNOWN, ID
-    from c_analyzer.variables.info import (
-            normalize_vartype, Variable
-            )
-
-
-class NormalizeVartypeTests(unittest.TestCase):
-
-    def test_basic(self):
-        tests = [
-                (None, None),
-                ('', ''),
-                ('int', 'int'),
-                (PseudoStr('int'), 'int'),
-                (StrProxy('int'), 'int'),
-                ]
-        for vartype, expected in tests:
-            with self.subTest(vartype):
-                normalized = normalize_vartype(vartype)
-
-                self.assertEqual(normalized, expected)
-
-
-class VariableTests(unittest.TestCase):
-
-    VALID_ARGS = (
-            ('x/y/z/spam.c', 'func', 'eggs'),
-            'static',
-            'int',
-            )
-    VALID_KWARGS = dict(zip(Variable._fields, VALID_ARGS))
-    VALID_EXPECTED = VALID_ARGS
-
-    def test_init_typical_global(self):
-        for storage in ('static', 'extern', 'implicit'):
-            with self.subTest(storage):
-                static = Variable(
-                        id=ID(
-                            filename='x/y/z/spam.c',
-                            funcname=None,
-                            name='eggs',
-                            ),
-                        storage=storage,
-                        vartype='int',
-                        )
-
-                self.assertEqual(static, (
-                        ('x/y/z/spam.c', None, 'eggs'),
-                        storage,
-                        'int',
-                        ))
-
-    def test_init_typical_local(self):
-        for storage in ('static', 'local'):
-            with self.subTest(storage):
-                static = Variable(
-                        id=ID(
-                            filename='x/y/z/spam.c',
-                            funcname='func',
-                            name='eggs',
-                            ),
-                        storage=storage,
-                        vartype='int',
-                        )
-
-        self.assertEqual(static, (
-                ('x/y/z/spam.c', 'func', 'eggs'),
-                storage,
-                'int',
-                ))
-
-    def test_init_all_missing(self):
-        for value in ('', None):
-            with self.subTest(repr(value)):
-                static = Variable(
-                        id=value,
-                        storage=value,
-                        vartype=value,
-                        )
-
-                self.assertEqual(static, (
-                        None,
-                        None,
-                        None,
-                        ))
-
-    def test_init_all_coerced(self):
-        id = ID('x/y/z/spam.c', 'func', 'spam')
-        tests = [
-            ('str subclass',
-             dict(
-                 id=(
-                    PseudoStr('x/y/z/spam.c'),
-                    PseudoStr('func'),
-                    PseudoStr('spam'),
-                    ),
-                 storage=PseudoStr('static'),
-                 vartype=PseudoStr('int'),
-                 ),
-             (id,
-              'static',
-              'int',
-              )),
-            ('non-str 1',
-             dict(
-                 id=id,
-                 storage=Object(),
-                 vartype=Object(),
-                 ),
-             (id,
-              '<object>',
-              '<object>',
-              )),
-            ('non-str 2',
-             dict(
-                 id=id,
-                 storage=StrProxy('static'),
-                 vartype=StrProxy('variable'),
-                 ),
-             (id,
-              'static',
-              'variable',
-              )),
-            ('non-str',
-             dict(
-                 id=id,
-                 storage=('a', 'b', 'c'),
-                 vartype=('x', 'y', 'z'),
-                 ),
-             (id,
-              "('a', 'b', 'c')",
-              "('x', 'y', 'z')",
-              )),
-            ]
-        for summary, kwargs, expected in tests:
-            with self.subTest(summary):
-                static = Variable(**kwargs)
-
-                for field in Variable._fields:
-                    value = getattr(static, field)
-                    if field == 'id':
-                        self.assertIs(type(value), ID)
-                    else:
-                        self.assertIs(type(value), str)
-                self.assertEqual(tuple(static), expected)
-
-    def test_iterable(self):
-        static = Variable(**self.VALID_KWARGS)
-
-        id, storage, vartype = static
-
-        values = (id, storage, vartype)
-        for value, expected in zip(values, self.VALID_EXPECTED):
-            self.assertEqual(value, expected)
-
-    def test_fields(self):
-        static = Variable(('a', 'b', 'z'), 'x', 'y')
-
-        self.assertEqual(static.id, ('a', 'b', 'z'))
-        self.assertEqual(static.storage, 'x')
-        self.assertEqual(static.vartype, 'y')
-
-    def test___getattr__(self):
-        static = Variable(('a', 'b', 'z'), 'x', 'y')
-
-        self.assertEqual(static.filename, 'a')
-        self.assertEqual(static.funcname, 'b')
-        self.assertEqual(static.name, 'z')
-
-    def test_validate_typical(self):
-        validstorage = ('static', 'extern', 'implicit', 'local')
-        self.assertEqual(set(validstorage), set(Variable.STORAGE))
-
-        for storage in validstorage:
-            with self.subTest(storage):
-                static = Variable(
-                        id=ID(
-                            filename='x/y/z/spam.c',
-                            funcname='func',
-                            name='eggs',
-                            ),
-                        storage=storage,
-                        vartype='int',
-                        )
-
-                static.validate()  # This does not fail.
-
-    def test_validate_missing_field(self):
-        for field in Variable._fields:
-            with self.subTest(field):
-                static = Variable(**self.VALID_KWARGS)
-                static = static._replace(**{field: None})
-
-                with self.assertRaises(TypeError):
-                    static.validate()
-        for field in ('storage', 'vartype'):
-            with self.subTest(field):
-                static = Variable(**self.VALID_KWARGS)
-                static = static._replace(**{field: UNKNOWN})
-
-                with self.assertRaises(TypeError):
-                    static.validate()
-
-    def test_validate_bad_field(self):
-        badch = tuple(c for c in string.punctuation + string.digits)
-        notnames = (
-                '1a',
-                'a.b',
-                'a-b',
-                '&a',
-                'a++',
-                ) + badch
-        tests = [
-            ('id', ()),  # Any non-empty str is okay.
-            ('storage', ('external', 'global') + notnames),
-            ('vartype', ()),  # Any non-empty str is okay.
-            ]
-        seen = set()
-        for field, invalid in tests:
-            for value in invalid:
-                seen.add(value)
-                with self.subTest(f'{field}={value!r}'):
-                    static = Variable(**self.VALID_KWARGS)
-                    static = static._replace(**{field: value})
-
-                    with self.assertRaises(ValueError):
-                        static.validate()
-
-        for field, invalid in tests:
-            if field == 'id':
-                continue
-            valid = seen - set(invalid)
-            for value in valid:
-                with self.subTest(f'{field}={value!r}'):
-                    static = Variable(**self.VALID_KWARGS)
-                    static = static._replace(**{field: value})
-
-                    static.validate()  # This does not fail.
diff --git a/Lib/test/test_tools/test_c_analyzer/test_variables/test_known.py b/Lib/test/test_tools/test_c_analyzer/test_variables/test_known.py
deleted file mode 100644
index 49ff45c..0000000
--- a/Lib/test/test_tools/test_c_analyzer/test_variables/test_known.py
+++ /dev/null
@@ -1,139 +0,0 @@
-import re
-import textwrap
-import unittest
-
-from .. import tool_imports_for_tests
-with tool_imports_for_tests():
-    from c_analyzer.common.info import ID
-    from c_analyzer.variables.info import Variable
-    from c_analyzer.variables.known import (
-            read_file,
-            from_file,
-            )
-
-class _BaseTests(unittest.TestCase):
-
-    maxDiff = None
-
-    @property
-    def calls(self):
-        try:
-            return self._calls
-        except AttributeError:
-            self._calls = []
-            return self._calls
-
-
-class ReadFileTests(_BaseTests):
-
-    _return_read_tsv = ()
-
-    def _read_tsv(self, *args):
-        self.calls.append(('_read_tsv', args))
-        return self._return_read_tsv
-
-    def test_typical(self):
-        lines = textwrap.dedent('''
-            filename    funcname        name    kind    declaration
-            file1.c     -       var1    variable        static int
-            file1.c     func1   local1  variable        static int
-            file1.c     -       var2    variable        int
-            file1.c     func2   local2  variable        char *
-            file2.c     -       var1    variable        char *
-            ''').strip().splitlines()
-        lines = [re.sub(r'\s+', '\t', line, 4) for line in lines]
-        self._return_read_tsv = [tuple(v.strip() for v in line.split('\t'))
-                                 for line in lines[1:]]
-
-        known = list(read_file('known.tsv', _read_tsv=self._read_tsv))
-
-        self.assertEqual(known, [
-            ('variable', ID('file1.c', '', 'var1'), 'static int'),
-            ('variable', ID('file1.c', 'func1', 'local1'), 'static int'),
-            ('variable', ID('file1.c', '', 'var2'), 'int'),
-            ('variable', ID('file1.c', 'func2', 'local2'), 'char *'),
-            ('variable', ID('file2.c', '', 'var1'), 'char *'),
-            ])
-        self.assertEqual(self.calls, [
-            ('_read_tsv',
-             ('known.tsv', 'filename\tfuncname\tname\tkind\tdeclaration')),
-            ])
-
-    def test_empty(self):
-        self._return_read_tsv = []
-
-        known = list(read_file('known.tsv', _read_tsv=self._read_tsv))
-
-        self.assertEqual(known, [])
-        self.assertEqual(self.calls, [
-            ('_read_tsv', ('known.tsv', 'filename\tfuncname\tname\tkind\tdeclaration')),
-            ])
-
-
-class FromFileTests(_BaseTests):
-
-    _return_read_file = ()
-    _return_handle_var = ()
-
-    def _read_file(self, infile):
-        self.calls.append(('_read_file', (infile,)))
-        return iter(self._return_read_file)
-
-    def _handle_var(self, varid, decl):
-        self.calls.append(('_handle_var', (varid, decl)))
-        var = self._return_handle_var.pop(0)
-        return var
-
-    def test_typical(self):
-        expected = [
-            Variable.from_parts('file1.c', '', 'var1', 'static int'),
-            Variable.from_parts('file1.c', 'func1', 'local1', 'static int'),
-            Variable.from_parts('file1.c', '', 'var2', 'int'),
-            Variable.from_parts('file1.c', 'func2', 'local2', 'char *'),
-            Variable.from_parts('file2.c', '', 'var1', 'char *'),
-            ]
-        self._return_read_file = [('variable', v.id, v.vartype)
-                                  for v in expected]
-#            ('variable', ID('file1.c', '', 'var1'), 'static int'),
-#            ('variable', ID('file1.c', 'func1', 'local1'), 'static int'),
-#            ('variable', ID('file1.c', '', 'var2'), 'int'),
-#            ('variable', ID('file1.c', 'func2', 'local2'), 'char *'),
-#            ('variable', ID('file2.c', '', 'var1'), 'char *'),
-#            ]
-        self._return_handle_var = list(expected)  # a copy
-
-        known = from_file('known.tsv',
-                          handle_var=self._handle_var,
-                          _read_file=self._read_file,
-                          )
-
-        self.assertEqual(known, {
-            'variables': {v.id: v for v in expected},
-            })
-#                Variable.from_parts('file1.c', '', 'var1', 'static int'),
-#                Variable.from_parts('file1.c', 'func1', 'local1', 'static int'),
-#                Variable.from_parts('file1.c', '', 'var2', 'int'),
-#                Variable.from_parts('file1.c', 'func2', 'local2', 'char *'),
-#                Variable.from_parts('file2.c', '', 'var1', 'char *'),
-#                ]},
-#            })
-        self.assertEqual(self.calls, [
-            ('_read_file', ('known.tsv',)),
-            *[('_handle_var', (v.id, v.vartype))
-              for v in expected],
-            ])
-
-    def test_empty(self):
-        self._return_read_file = []
-
-        known = from_file('known.tsv',
-                          handle_var=self._handle_var,
-                          _read_file=self._read_file,
-                          )
-
-        self.assertEqual(known, {
-            'variables': {},
-            })
-        self.assertEqual(self.calls, [
-            ('_read_file', ('known.tsv',)),
-            ])
diff --git a/Lib/test/test_tools/test_c_analyzer/util.py b/Lib/test/test_tools/test_c_analyzer/util.py
deleted file mode 100644
index ba73b0a..0000000
--- a/Lib/test/test_tools/test_c_analyzer/util.py
+++ /dev/null
@@ -1,60 +0,0 @@
-import itertools
-
-
-class PseudoStr(str):
-    pass
-
-
-class StrProxy:
-    def __init__(self, value):
-        self.value = value
-    def __str__(self):
-        return self.value
-    def __bool__(self):
-        return bool(self.value)
-
-
-class Object:
-    def __repr__(self):
-        return '<object>'
-
-
-def wrapped_arg_combos(*args,
-                       wrappers=(PseudoStr, StrProxy),
-                       skip=(lambda w, i, v: not isinstance(v, str)),
-                       ):
-    """Yield every possible combination of wrapped items for the given args.
-
-    Effectively, the wrappers are applied to the args according to the
-    powerset of the args indicies.  So the result includes the args
-    completely unwrapped.
-
-    If "skip" is supplied (default is to skip all non-str values) and
-    it returns True for a given arg index/value then that arg will
-    remain unwrapped,
-
-    Only unique results are returned.  If an arg was skipped for one
-    of the combinations then it could end up matching one of the other
-    combinations.  In that case only one of them will be yielded.
-    """
-    if not args:
-        return
-    indices = list(range(len(args)))
-    # The powerset (from recipe in the itertools docs).
-    combos = itertools.chain.from_iterable(itertools.combinations(indices, r)
-                                           for r in range(len(indices)+1))
-    seen = set()
-    for combo in combos:
-        for wrap in wrappers:
-            indexes = []
-            applied = list(args)
-            for i in combo:
-                arg = args[i]
-                if skip and skip(wrap, i, arg):
-                    continue
-                indexes.append(i)
-                applied[i] = wrap(arg)
-            key = (wrap, tuple(indexes))
-            if key not in seen:
-                yield tuple(applied)
-                seen.add(key)
diff --git a/Lib/test/test_tools/test_fixcid.py b/Lib/test/test_tools/test_fixcid.py
index bce029b..3df1368 100644
--- a/Lib/test/test_tools/test_fixcid.py
+++ b/Lib/test/test_tools/test_fixcid.py
@@ -5,6 +5,7 @@
 import runpy
 import sys
 from test import support
+from test.support import os_helper
 from test.test_tools import skip_if_missing, scriptsdir
 import unittest
 
@@ -57,15 +58,15 @@
         )
 
     def test_directory(self):
-        os.mkdir(support.TESTFN)
-        self.addCleanup(support.rmtree, support.TESTFN)
-        c_filename = os.path.join(support.TESTFN, "file.c")
+        os.mkdir(os_helper.TESTFN)
+        self.addCleanup(os_helper.rmtree, os_helper.TESTFN)
+        c_filename = os.path.join(os_helper.TESTFN, "file.c")
         with open(c_filename, "w") as file:
             file.write("int xx;\n")
-        with open(os.path.join(support.TESTFN, "file.py"), "w") as file:
+        with open(os.path.join(os_helper.TESTFN, "file.py"), "w") as file:
             file.write("xx = 'unaltered'\n")
         script = os.path.join(scriptsdir, "fixcid.py")
-        output = self.run_script(args=(support.TESTFN,))
+        output = self.run_script(args=(os_helper.TESTFN,))
         self.assertMultiLineEqual(output,
             "{}:\n"
             "1\n"
@@ -74,10 +75,10 @@
         )
 
     def run_script(self, input="", *, args=("-",), substfile="xx yy\n"):
-        substfilename = support.TESTFN + ".subst"
+        substfilename = os_helper.TESTFN + ".subst"
         with open(substfilename, "w") as file:
             file.write(substfile)
-        self.addCleanup(support.unlink, substfilename)
+        self.addCleanup(os_helper.unlink, substfilename)
 
         argv = ["fixcid.py", "-s", substfilename] + list(args)
         script = os.path.join(scriptsdir, "fixcid.py")
diff --git a/Lib/test/test_tools/test_i18n.py b/Lib/test/test_tools/test_i18n.py
index 42e20f8..12f778d 100644
--- a/Lib/test/test_tools/test_i18n.py
+++ b/Lib/test/test_tools/test_i18n.py
@@ -7,7 +7,7 @@
 
 from test.support.script_helper import assert_python_ok
 from test.test_tools import skip_if_missing, toolsdir
-from test.support import temp_cwd, temp_dir
+from test.support.os_helper import temp_cwd, temp_dir
 
 
 skip_if_missing()
@@ -220,6 +220,76 @@
         '''))
         self.assertIn('doc', msgids)
 
+    def test_calls_in_fstrings(self):
+        msgids = self.extract_docstrings_from_str(dedent('''\
+        f"{_('foo bar')}"
+        '''))
+        self.assertIn('foo bar', msgids)
+
+    def test_calls_in_fstrings_raw(self):
+        msgids = self.extract_docstrings_from_str(dedent('''\
+        rf"{_('foo bar')}"
+        '''))
+        self.assertIn('foo bar', msgids)
+
+    def test_calls_in_fstrings_nested(self):
+        msgids = self.extract_docstrings_from_str(dedent('''\
+        f"""{f'{_("foo bar")}'}"""
+        '''))
+        self.assertIn('foo bar', msgids)
+
+    def test_calls_in_fstrings_attribute(self):
+        msgids = self.extract_docstrings_from_str(dedent('''\
+        f"{obj._('foo bar')}"
+        '''))
+        self.assertIn('foo bar', msgids)
+
+    def test_calls_in_fstrings_with_call_on_call(self):
+        msgids = self.extract_docstrings_from_str(dedent('''\
+        f"{type(str)('foo bar')}"
+        '''))
+        self.assertNotIn('foo bar', msgids)
+
+    def test_calls_in_fstrings_with_format(self):
+        msgids = self.extract_docstrings_from_str(dedent('''\
+        f"{_('foo {bar}').format(bar='baz')}"
+        '''))
+        self.assertIn('foo {bar}', msgids)
+
+    def test_calls_in_fstrings_with_wrong_input_1(self):
+        msgids = self.extract_docstrings_from_str(dedent('''\
+        f"{_(f'foo {bar}')}"
+        '''))
+        self.assertFalse([msgid for msgid in msgids if 'foo {bar}' in msgid])
+
+    def test_calls_in_fstrings_with_wrong_input_2(self):
+        msgids = self.extract_docstrings_from_str(dedent('''\
+        f"{_(1)}"
+        '''))
+        self.assertNotIn(1, msgids)
+
+    def test_calls_in_fstring_with_multiple_args(self):
+        msgids = self.extract_docstrings_from_str(dedent('''\
+        f"{_('foo', 'bar')}"
+        '''))
+        self.assertNotIn('foo', msgids)
+        self.assertNotIn('bar', msgids)
+
+    def test_calls_in_fstring_with_keyword_args(self):
+        msgids = self.extract_docstrings_from_str(dedent('''\
+        f"{_('foo', bar='baz')}"
+        '''))
+        self.assertNotIn('foo', msgids)
+        self.assertNotIn('bar', msgids)
+        self.assertNotIn('baz', msgids)
+
+    def test_calls_in_fstring_with_partially_wrong_expression(self):
+        msgids = self.extract_docstrings_from_str(dedent('''\
+        f"{_(f'foo') + _('bar')}"
+        '''))
+        self.assertNotIn('foo', msgids)
+        self.assertIn('bar', msgids)
+
     def test_files_list(self):
         """Make sure the directories are inspected for source files
            bpo-31920
diff --git a/Lib/test/test_tools/test_lll.py b/Lib/test/test_tools/test_lll.py
index 568cbfb..ec0c973 100644
--- a/Lib/test/test_tools/test_lll.py
+++ b/Lib/test/test_tools/test_lll.py
@@ -3,6 +3,7 @@
 import os
 import tempfile
 from test import support
+from test.support import os_helper
 from test.test_tools import skip_if_missing, import_tool
 import unittest
 
@@ -14,7 +15,7 @@
     def setUp(self):
         self.lll = import_tool('lll')
 
-    @support.skip_unless_symlink
+    @os_helper.skip_unless_symlink
     def test_lll_multiple_dirs(self):
         with tempfile.TemporaryDirectory() as dir1, \
              tempfile.TemporaryDirectory() as dir2:
diff --git a/Lib/test/test_tools/test_md5sum.py b/Lib/test/test_tools/test_md5sum.py
index 321bc4b..c5a230e 100644
--- a/Lib/test/test_tools/test_md5sum.py
+++ b/Lib/test/test_tools/test_md5sum.py
@@ -1,8 +1,9 @@
 """Tests for the md5sum script in the Tools directory."""
 
+import sys
 import os
 import unittest
-from test import support
+from test.support import os_helper
 from test.support import hashlib_helper
 from test.support.script_helper import assert_python_ok, assert_python_failure
 
@@ -10,13 +11,13 @@
 
 skip_if_missing()
 
-@hashlib_helper.requires_hashdigest('md5')
+@hashlib_helper.requires_hashdigest('md5', openssl=True)
 class MD5SumTests(unittest.TestCase):
     @classmethod
     def setUpClass(cls):
         cls.script = os.path.join(scriptsdir, 'md5sum.py')
-        os.mkdir(support.TESTFN)
-        cls.fodder = os.path.join(support.TESTFN, 'md5sum.fodder')
+        os.mkdir(os_helper.TESTFN_ASCII)
+        cls.fodder = os.path.join(os_helper.TESTFN_ASCII, 'md5sum.fodder')
         with open(cls.fodder, 'wb') as f:
             f.write(b'md5sum\r\ntest file\r\n')
         cls.fodder_md5 = b'd38dae2eb1ab346a292ef6850f9e1a0d'
@@ -24,7 +25,7 @@
 
     @classmethod
     def tearDownClass(cls):
-        support.rmtree(support.TESTFN)
+        os_helper.rmtree(os_helper.TESTFN_ASCII)
 
     def test_noargs(self):
         rc, out, err = assert_python_ok(self.script)
diff --git a/Lib/test/test_tools/test_pathfix.py b/Lib/test/test_tools/test_pathfix.py
index 03ed29d..ff61935 100644
--- a/Lib/test/test_tools/test_pathfix.py
+++ b/Lib/test/test_tools/test_pathfix.py
@@ -3,6 +3,7 @@
 import sys
 import unittest
 from test import support
+from test.support import os_helper
 from test.test_tools import scriptsdir, skip_if_missing
 
 
@@ -14,7 +15,7 @@
     script = os.path.join(scriptsdir, 'pathfix.py')
 
     def setUp(self):
-        self.addCleanup(support.unlink, support.TESTFN)
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
 
     def pathfix(self, shebang, pathfix_flags, exitcode=0, stdout='', stderr='',
                 directory=''):
@@ -24,7 +25,7 @@
             filename = os.path.join(directory, 'script-A_1.py')
             pathfix_arg = directory
         else:
-            filename = support.TESTFN
+            filename = os_helper.TESTFN
             pathfix_arg = filename
 
         with open(filename, 'w', encoding='utf8') as f:
@@ -56,8 +57,8 @@
         return new_shebang
 
     def test_recursive(self):
-        tmpdir = support.TESTFN + '.d'
-        self.addCleanup(support.rmtree, tmpdir)
+        tmpdir = os_helper.TESTFN + '.d'
+        self.addCleanup(os_helper.rmtree, tmpdir)
         os.mkdir(tmpdir)
         expected_stderr = f"recursedown('{os.path.basename(tmpdir)}')\n"
         self.assertEqual(
diff --git a/Lib/test/test_tools/test_pindent.py b/Lib/test/test_tools/test_pindent.py
index e293bc8..e7a547a 100644
--- a/Lib/test/test_tools/test_pindent.py
+++ b/Lib/test/test_tools/test_pindent.py
@@ -6,6 +6,7 @@
 import subprocess
 import textwrap
 from test import support
+from test.support import os_helper
 from test.support.script_helper import assert_python_ok
 
 from test.test_tools import scriptsdir, skip_if_missing
@@ -34,7 +35,7 @@
 
     def test_selftest(self):
         self.maxDiff = None
-        with support.temp_dir() as directory:
+        with os_helper.temp_dir() as directory:
             data_path = os.path.join(directory, '_test.py')
             with open(self.script) as f:
                 closed = f.read()
diff --git a/Lib/test/test_tools/test_sundry.py b/Lib/test/test_tools/test_sundry.py
index 10eb694..52369ec 100644
--- a/Lib/test/test_tools/test_sundry.py
+++ b/Lib/test/test_tools/test_sundry.py
@@ -8,7 +8,7 @@
 import os
 import sys
 import unittest
-from test import support
+from test.support import import_helper
 
 from test.test_tools import scriptsdir, import_tool, skip_if_missing
 
@@ -16,21 +16,21 @@
 
 class TestSundryScripts(unittest.TestCase):
     # At least make sure the rest don't have syntax errors.  When tests are
-    # added for a script it should be added to the whitelist below.
+    # added for a script it should be added to the allowlist below.
 
     # scripts that have independent tests.
-    whitelist = ['reindent', 'pdeps', 'gprof2html', 'md5sum']
+    allowlist = ['reindent', 'pdeps', 'gprof2html', 'md5sum']
     # scripts that can't be imported without running
-    blacklist = ['make_ctype']
+    denylist = ['make_ctype']
     # scripts that use windows-only modules
     windows_only = ['win_add2path']
-    # blacklisted for other reasons
+    # denylisted for other reasons
     other = ['analyze_dxp', '2to3']
 
-    skiplist = blacklist + whitelist + windows_only + other
+    skiplist = denylist + allowlist + windows_only + other
 
     def test_sundry(self):
-        old_modules = support.modules_setup()
+        old_modules = import_helper.modules_setup()
         try:
             for fn in os.listdir(scriptsdir):
                 if not fn.endswith('.py'):
@@ -43,7 +43,7 @@
                 import_tool(name)
         finally:
             # Unload all modules loaded in this test
-            support.modules_cleanup(*old_modules)
+            import_helper.modules_cleanup(*old_modules)
 
     @unittest.skipIf(sys.platform != "win32", "Windows-only test")
     def test_sundry_windows(self):
diff --git a/Lib/test/test_trace.py b/Lib/test/test_trace.py
index c03982b..7547855 100644
--- a/Lib/test/test_trace.py
+++ b/Lib/test/test_trace.py
@@ -1,6 +1,7 @@
 import os
 import sys
-from test.support import TESTFN, TESTFN_UNICODE, FS_NONASCII, rmtree, unlink, captured_stdout
+from test.support import captured_stdout
+from test.support.os_helper import (TESTFN, rmtree, unlink)
 from test.support.script_helper import assert_python_ok, assert_python_failure
 import textwrap
 import unittest
diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py
index 8549ba2..18cd4ab 100644
--- a/Lib/test/test_traceback.py
+++ b/Lib/test/test_traceback.py
@@ -4,10 +4,12 @@
 from io import StringIO
 import linecache
 import sys
+import inspect
 import unittest
 import re
 from test import support
-from test.support import TESTFN, Error, captured_output, unlink, cpython_only, ALWAYS_EQ
+from test.support import Error, captured_output, cpython_only, ALWAYS_EQ
+from test.support.os_helper import TESTFN, unlink
 from test.support.script_helper import assert_python_ok
 import textwrap
 
@@ -37,6 +39,9 @@
     def syntax_error_with_caret_2(self):
         compile("1 +\n", "?", "exec")
 
+    def syntax_error_with_caret_range(self):
+        compile("f(x, y for y in range(30), z)", "?", "exec")
+
     def syntax_error_bad_indentation(self):
         compile("def spam():\n  print(1)\n print(2)", "?", "exec")
 
@@ -46,6 +51,9 @@
     def syntax_error_bad_indentation2(self):
         compile(" print(2)", "?", "exec")
 
+    def tokenizer_error_with_caret_range(self):
+        compile("blech  (  ", "?", "exec")
+
     def test_caret(self):
         err = self.get_exception_format(self.syntax_error_with_caret,
                                         SyntaxError)
@@ -53,18 +61,35 @@
         self.assertTrue(err[1].strip() == "return x!")
         self.assertIn("^", err[2]) # third line has caret
         self.assertEqual(err[1].find("!"), err[2].find("^")) # in the right place
+        self.assertEqual(err[2].count("^"), 1)
 
         err = self.get_exception_format(self.syntax_error_with_caret_2,
                                         SyntaxError)
         self.assertIn("^", err[2]) # third line has caret
         self.assertEqual(err[2].count('\n'), 1)   # and no additional newline
         self.assertEqual(err[1].find("+") + 1, err[2].find("^"))  # in the right place
+        self.assertEqual(err[2].count("^"), 1)
 
         err = self.get_exception_format(self.syntax_error_with_caret_non_ascii,
                                         SyntaxError)
         self.assertIn("^", err[2]) # third line has caret
         self.assertEqual(err[2].count('\n'), 1)   # and no additional newline
         self.assertEqual(err[1].find("+") + 1, err[2].find("^"))  # in the right place
+        self.assertEqual(err[2].count("^"), 1)
+
+        err = self.get_exception_format(self.syntax_error_with_caret_range,
+                                        SyntaxError)
+        self.assertIn("^", err[2]) # third line has caret
+        self.assertEqual(err[2].count('\n'), 1)   # and no additional newline
+        self.assertEqual(err[1].find("y"), err[2].find("^"))  # in the right place
+        self.assertEqual(err[2].count("^"), len("y for y in range(30)"))
+
+        err = self.get_exception_format(self.tokenizer_error_with_caret_range,
+                                        SyntaxError)
+        self.assertIn("^", err[2]) # third line has caret
+        self.assertEqual(err[2].count('\n'), 1)   # and no additional newline
+        self.assertEqual(err[1].find("("), err[2].find("^"))  # in the right place
+        self.assertEqual(err[2].count("^"), 1)
 
     def test_nocaret(self):
         exc = SyntaxError("error", ("x.py", 23, None, "bad syntax"))
@@ -211,6 +236,64 @@
         )
         self.assertEqual(output.getvalue(), "Exception: projector\n")
 
+    def test_print_exception_exc(self):
+        output = StringIO()
+        traceback.print_exception(Exception("projector"), file=output)
+        self.assertEqual(output.getvalue(), "Exception: projector\n")
+
+    def test_format_exception_exc(self):
+        e = Exception("projector")
+        output = traceback.format_exception(e)
+        self.assertEqual(output, ["Exception: projector\n"])
+        with self.assertRaisesRegex(ValueError, 'Both or neither'):
+            traceback.format_exception(e.__class__, e)
+        with self.assertRaisesRegex(ValueError, 'Both or neither'):
+            traceback.format_exception(e.__class__, tb=e.__traceback__)
+        with self.assertRaisesRegex(TypeError, 'positional-only'):
+            traceback.format_exception(exc=e)
+
+    def test_format_exception_only_exc(self):
+        output = traceback.format_exception_only(Exception("projector"))
+        self.assertEqual(output, ["Exception: projector\n"])
+
+    def test_exception_is_None(self):
+        NONE_EXC_STRING = 'NoneType: None\n'
+        excfile = StringIO()
+        traceback.print_exception(None, file=excfile)
+        self.assertEqual(excfile.getvalue(), NONE_EXC_STRING)
+
+        excfile = StringIO()
+        traceback.print_exception(None, None, None, file=excfile)
+        self.assertEqual(excfile.getvalue(), NONE_EXC_STRING)
+
+        excfile = StringIO()
+        traceback.print_exc(None, file=excfile)
+        self.assertEqual(excfile.getvalue(), NONE_EXC_STRING)
+
+        self.assertEqual(traceback.format_exc(None), NONE_EXC_STRING)
+        self.assertEqual(traceback.format_exception(None), [NONE_EXC_STRING])
+        self.assertEqual(
+            traceback.format_exception(None, None, None), [NONE_EXC_STRING])
+        self.assertEqual(
+            traceback.format_exception_only(None), [NONE_EXC_STRING])
+        self.assertEqual(
+            traceback.format_exception_only(None, None), [NONE_EXC_STRING])
+
+    def test_signatures(self):
+        self.assertEqual(
+            str(inspect.signature(traceback.print_exception)),
+            ('(exc, /, value=<implicit>, tb=<implicit>, '
+             'limit=None, file=None, chain=True)'))
+
+        self.assertEqual(
+            str(inspect.signature(traceback.format_exception)),
+            ('(exc, /, value=<implicit>, tb=<implicit>, limit=None, '
+             'chain=True)'))
+
+        self.assertEqual(
+            str(inspect.signature(traceback.format_exception_only)),
+            '(exc, /, value=<implicit>)')
+
 
 class TracebackFormatTests(unittest.TestCase):
 
@@ -655,7 +738,6 @@
         self.assertIn('inner_raise() # Marker', blocks[2])
         self.check_zero_div(blocks[2])
 
-    @unittest.skipIf(support.use_old_parser(), "Pegen is arguably better here, so no need to fix this")
     def test_syntax_error_offset_at_eol(self):
         # See #10186.
         def e():
@@ -667,6 +749,31 @@
         msg = self.get_report(e).splitlines()
         self.assertEqual(msg[-2], '               ^')
 
+    def test_syntax_error_no_lineno(self):
+        # See #34463.
+
+        # Without filename
+        e = SyntaxError('bad syntax')
+        msg = self.get_report(e).splitlines()
+        self.assertEqual(msg,
+            ['SyntaxError: bad syntax'])
+        e.lineno = 100
+        msg = self.get_report(e).splitlines()
+        self.assertEqual(msg,
+            ['  File "<string>", line 100', 'SyntaxError: bad syntax'])
+
+        # With filename
+        e = SyntaxError('bad syntax')
+        e.filename = 'myfile.py'
+
+        msg = self.get_report(e).splitlines()
+        self.assertEqual(msg,
+            ['SyntaxError: bad syntax (myfile.py)'])
+        e.lineno = 100
+        msg = self.get_report(e).splitlines()
+        self.assertEqual(msg,
+            ['  File "myfile.py", line 100', 'SyntaxError: bad syntax'])
+
     def test_message_none(self):
         # A message that looks like "None" should not be treated specially
         err = self.get_report(Exception(None))
@@ -678,6 +785,17 @@
         err = self.get_report(Exception(''))
         self.assertIn('Exception\n', err)
 
+    def test_exception_modulename_not_unicode(self):
+        class X(Exception):
+            def __str__(self):
+                return "I am X"
+
+        X.__module__ = 42
+
+        err = self.get_report(X())
+        exp = f'<unknown>.{X.__qualname__}: I am X\n'
+        self.assertEqual(exp, err)
+
     def test_syntax_error_various_offsets(self):
         for offset in range(-5, 10):
             for add in [0, 2]:
@@ -697,6 +815,19 @@
                 exp = "\n".join(expected)
                 self.assertEqual(exp, err)
 
+    def test_format_exception_only_qualname(self):
+        class A:
+            class B:
+                class X(Exception):
+                    def __str__(self):
+                        return "I am X"
+                    pass
+        err = self.get_report(A.B.X())
+        str_value = 'I am X'
+        str_name = '.'.join([A.B.X.__module__, A.B.X.__qualname__])
+        exp = "%s: %s\n" % (str_name, str_value)
+        self.assertEqual(exp, err)
+
 
 class PyExcReportingTests(BaseExceptionReportingTests, unittest.TestCase):
     #
@@ -917,6 +1048,10 @@
             '"""Test cases for traceback module"""',
             f.line)
 
+    def test_no_line(self):
+        f = traceback.FrameSummary("f", None, "dummy")
+        self.assertEqual(f.line, None)
+
     def test_explicit_line(self):
         f = traceback.FrameSummary("f", 1, "dummy", line="line")
         self.assertEqual("line", f.line)
@@ -1103,6 +1238,71 @@
         self.assertEqual(exc_info[0], exc.exc_type)
         self.assertEqual(str(exc_info[1]), str(exc))
 
+    def test_long_context_chain(self):
+        def f():
+            try:
+                1/0
+            except:
+                f()
+
+        try:
+            f()
+        except RecursionError:
+            exc_info = sys.exc_info()
+        else:
+            self.fail("Exception not raised")
+
+        te = traceback.TracebackException(*exc_info)
+        res = list(te.format())
+
+        # many ZeroDiv errors followed by the RecursionError
+        self.assertGreater(len(res), sys.getrecursionlimit())
+        self.assertGreater(
+            len([l for l in res if 'ZeroDivisionError:' in l]),
+            sys.getrecursionlimit() * 0.5)
+        self.assertIn(
+            "RecursionError: maximum recursion depth exceeded", res[-1])
+
+    def test_compact_with_cause(self):
+        try:
+            try:
+                1/0
+            finally:
+                cause = Exception("cause")
+                raise Exception("uh oh") from cause
+        except Exception:
+            exc_info = sys.exc_info()
+            exc = traceback.TracebackException(*exc_info, compact=True)
+            expected_stack = traceback.StackSummary.extract(
+                traceback.walk_tb(exc_info[2]))
+        exc_cause = traceback.TracebackException(Exception, cause, None)
+        self.assertEqual(exc_cause, exc.__cause__)
+        self.assertEqual(None, exc.__context__)
+        self.assertEqual(True, exc.__suppress_context__)
+        self.assertEqual(expected_stack, exc.stack)
+        self.assertEqual(exc_info[0], exc.exc_type)
+        self.assertEqual(str(exc_info[1]), str(exc))
+
+    def test_compact_no_cause(self):
+        try:
+            try:
+                1/0
+            finally:
+                exc_info_context = sys.exc_info()
+                exc_context = traceback.TracebackException(*exc_info_context)
+                raise Exception("uh oh")
+        except Exception:
+            exc_info = sys.exc_info()
+            exc = traceback.TracebackException(*exc_info, compact=True)
+            expected_stack = traceback.StackSummary.extract(
+                traceback.walk_tb(exc_info[2]))
+        self.assertEqual(None, exc.__cause__)
+        self.assertEqual(exc_context, exc.__context__)
+        self.assertEqual(False, exc.__suppress_context__)
+        self.assertEqual(expected_stack, exc.stack)
+        self.assertEqual(exc_info[0], exc.exc_type)
+        self.assertEqual(str(exc_info[1]), str(exc))
+
     def test_no_refs_to_exception_and_traceback_objects(self):
         try:
             1/0
@@ -1250,9 +1450,9 @@
 
     def test_all(self):
         expected = set()
-        blacklist = {'print_list'}
+        denylist = {'print_list'}
         for name in dir(traceback):
-            if name.startswith('_') or name in blacklist:
+            if name.startswith('_') or name in denylist:
                 continue
             module_object = getattr(traceback, name)
             if getattr(module_object, '__module__', None) == 'traceback':
diff --git a/Lib/test/test_tracemalloc.py b/Lib/test/test_tracemalloc.py
index c5ae4e6..82be98d 100644
--- a/Lib/test/test_tracemalloc.py
+++ b/Lib/test/test_tracemalloc.py
@@ -7,6 +7,7 @@
 from test.support.script_helper import (assert_python_ok, assert_python_failure,
                                         interpreter_requires_environment)
 from test import support
+from test.support import os_helper
 
 try:
     import _testcapi
@@ -84,6 +85,25 @@
     return traceback_lineno(filename, 0)
 
 
+class TestTraceback(unittest.TestCase):
+    def test_repr(self):
+        def get_repr(*args) -> str:
+            return repr(tracemalloc.Traceback(*args))
+
+        self.assertEqual(get_repr(()), "<Traceback ()>")
+        self.assertEqual(get_repr((), 0), "<Traceback () total_nframe=0>")
+
+        frames = (("f1", 1), ("f2", 2))
+        exp_repr_frames = (
+            "(<Frame filename='f2' lineno=2>,"
+            " <Frame filename='f1' lineno=1>)"
+        )
+        self.assertEqual(get_repr(frames),
+                         f"<Traceback {exp_repr_frames}>")
+        self.assertEqual(get_repr(frames, 2),
+                         f"<Traceback {exp_repr_frames} total_nframe=2>")
+
+
 class TestTracemallocEnabled(unittest.TestCase):
     def setUp(self):
         if tracemalloc.is_tracing():
@@ -287,11 +307,11 @@
         self.assertGreater(snapshot.traces[1].traceback.total_nframe, 10)
 
         # write on disk
-        snapshot.dump(support.TESTFN)
-        self.addCleanup(support.unlink, support.TESTFN)
+        snapshot.dump(os_helper.TESTFN)
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
 
         # load from disk
-        snapshot2 = tracemalloc.Snapshot.load(support.TESTFN)
+        snapshot2 = tracemalloc.Snapshot.load(os_helper.TESTFN)
         self.assertEqual(snapshot2.traces, snapshot.traces)
 
         # tracemalloc must be tracing memory allocations to take a snapshot
@@ -306,11 +326,11 @@
         # take a snapshot with a new attribute
         snapshot = tracemalloc.take_snapshot()
         snapshot.test_attr = "new"
-        snapshot.dump(support.TESTFN)
-        self.addCleanup(support.unlink, support.TESTFN)
+        snapshot.dump(os_helper.TESTFN)
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
 
         # load() should recreate the attribute
-        snapshot2 = tracemalloc.Snapshot.load(support.TESTFN)
+        snapshot2 = tracemalloc.Snapshot.load(os_helper.TESTFN)
         self.assertEqual(snapshot2.test_attr, "new")
 
     def fork_child(self):
@@ -1062,14 +1082,5 @@
             self.untrack()
 
 
-def test_main():
-    support.run_unittest(
-        TestTracemallocEnabled,
-        TestSnapshot,
-        TestFilters,
-        TestCommandLine,
-        TestCAPI,
-    )
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_ttk_guionly.py b/Lib/test/test_ttk_guionly.py
index 462665d..c491904 100644
--- a/Lib/test/test_ttk_guionly.py
+++ b/Lib/test/test_ttk_guionly.py
@@ -1,8 +1,13 @@
 import unittest
 from test import support
+from test.support import import_helper
+from test.support import check_sanitizer
+
+if check_sanitizer(address=True, memory=True):
+    raise unittest.SkipTest("Tests involvin libX11 can SEGFAULT on ASAN/MSAN builds")
 
 # Skip this test if _tkinter wasn't built.
-support.import_module('_tkinter')
+import_helper.import_module('_tkinter')
 
 # Skip test if tk cannot be initialized.
 support.requires('gui')
@@ -10,25 +15,26 @@
 import tkinter
 from _tkinter import TclError
 from tkinter import ttk
-from tkinter.test import runtktests
 
-root = None
-try:
-    root = tkinter.Tk()
-    button = ttk.Button(root)
-    button.destroy()
-    del button
-except TclError as msg:
-    # assuming ttk is not available
-    raise unittest.SkipTest("ttk not available: %s" % msg)
-finally:
-    if root is not None:
-        root.destroy()
-    del root
 
-def test_main():
-    support.run_unittest(
-            *runtktests.get_tests(text=False, packages=['test_ttk']))
+def setUpModule():
+    root = None
+    try:
+        root = tkinter.Tk()
+        button = ttk.Button(root)
+        button.destroy()
+        del button
+    except TclError as msg:
+        # assuming ttk is not available
+        raise unittest.SkipTest("ttk not available: %s" % msg)
+    finally:
+        if root is not None:
+            root.destroy()
+        del root
+
+def load_tests(loader, tests, pattern):
+    return loader.discover('tkinter.test.test_ttk')
+
 
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_ttk_textonly.py b/Lib/test/test_ttk_textonly.py
index 7540a43..96dc179 100644
--- a/Lib/test/test_ttk_textonly.py
+++ b/Lib/test/test_ttk_textonly.py
@@ -1,13 +1,463 @@
-from test import support
+from test.support import import_helper
 
 # Skip this test if _tkinter does not exist.
-support.import_module('_tkinter')
+import_helper.import_module('_tkinter')
 
-from tkinter.test import runtktests
+import unittest
+from tkinter import ttk
 
-def test_main():
-    support.run_unittest(
-            *runtktests.get_tests(gui=False, packages=['test_ttk']))
+
+class MockTkApp:
+
+    def splitlist(self, arg):
+        if isinstance(arg, tuple):
+            return arg
+        return arg.split(':')
+
+    def wantobjects(self):
+        return True
+
+
+class MockTclObj(object):
+    typename = 'test'
+
+    def __init__(self, val):
+        self.val = val
+
+    def __str__(self):
+        return str(self.val)
+
+
+class MockStateSpec(object):
+    typename = 'StateSpec'
+
+    def __init__(self, *args):
+        self.val = args
+
+    def __str__(self):
+        return ' '.join(self.val)
+
+
+class InternalFunctionsTest(unittest.TestCase):
+
+    def test_format_optdict(self):
+        def check_against(fmt_opts, result):
+            for i in range(0, len(fmt_opts), 2):
+                self.assertEqual(result.pop(fmt_opts[i]), fmt_opts[i + 1])
+            if result:
+                self.fail("result still got elements: %s" % result)
+
+        # passing an empty dict should return an empty object (tuple here)
+        self.assertFalse(ttk._format_optdict({}))
+
+        # check list formatting
+        check_against(
+            ttk._format_optdict({'fg': 'blue', 'padding': [1, 2, 3, 4]}),
+            {'-fg': 'blue', '-padding': '1 2 3 4'})
+
+        # check tuple formatting (same as list)
+        check_against(
+            ttk._format_optdict({'test': (1, 2, '', 0)}),
+            {'-test': '1 2 {} 0'})
+
+        # check untouched values
+        check_against(
+            ttk._format_optdict({'test': {'left': 'as is'}}),
+            {'-test': {'left': 'as is'}})
+
+        # check script formatting
+        check_against(
+            ttk._format_optdict(
+                {'test': [1, -1, '', '2m', 0], 'test2': 3,
+                 'test3': '', 'test4': 'abc def',
+                 'test5': '"abc"', 'test6': '{}',
+                 'test7': '} -spam {'}, script=True),
+            {'-test': '{1 -1 {} 2m 0}', '-test2': '3',
+             '-test3': '{}', '-test4': '{abc def}',
+             '-test5': '{"abc"}', '-test6': r'\{\}',
+             '-test7': r'\}\ -spam\ \{'})
+
+        opts = {'αβγ': True, 'á': False}
+        orig_opts = opts.copy()
+        # check if giving unicode keys is fine
+        check_against(ttk._format_optdict(opts), {'-αβγ': True, '-á': False})
+        # opts should remain unchanged
+        self.assertEqual(opts, orig_opts)
+
+        # passing values with spaces inside a tuple/list
+        check_against(
+            ttk._format_optdict(
+                {'option': ('one two', 'three')}),
+            {'-option': '{one two} three'})
+        check_against(
+            ttk._format_optdict(
+                {'option': ('one\ttwo', 'three')}),
+            {'-option': '{one\ttwo} three'})
+
+        # passing empty strings inside a tuple/list
+        check_against(
+            ttk._format_optdict(
+                {'option': ('', 'one')}),
+            {'-option': '{} one'})
+
+        # passing values with braces inside a tuple/list
+        check_against(
+            ttk._format_optdict(
+                {'option': ('one} {two', 'three')}),
+            {'-option': r'one\}\ \{two three'})
+
+        # passing quoted strings inside a tuple/list
+        check_against(
+            ttk._format_optdict(
+                {'option': ('"one"', 'two')}),
+            {'-option': '{"one"} two'})
+        check_against(
+            ttk._format_optdict(
+                {'option': ('{one}', 'two')}),
+            {'-option': r'\{one\} two'})
+
+        # ignore an option
+        amount_opts = len(ttk._format_optdict(opts, ignore=('á'))) / 2
+        self.assertEqual(amount_opts, len(opts) - 1)
+
+        # ignore non-existing options
+        amount_opts = len(ttk._format_optdict(opts, ignore=('á', 'b'))) / 2
+        self.assertEqual(amount_opts, len(opts) - 1)
+
+        # ignore every option
+        self.assertFalse(ttk._format_optdict(opts, ignore=list(opts.keys())))
+
+
+    def test_format_mapdict(self):
+        opts = {'a': [('b', 'c', 'val'), ('d', 'otherval'), ('', 'single')]}
+        result = ttk._format_mapdict(opts)
+        self.assertEqual(len(result), len(list(opts.keys())) * 2)
+        self.assertEqual(result, ('-a', '{b c} val d otherval {} single'))
+        self.assertEqual(ttk._format_mapdict(opts, script=True),
+            ('-a', '{{b c} val d otherval {} single}'))
+
+        self.assertEqual(ttk._format_mapdict({2: []}), ('-2', ''))
+
+        opts = {'üñíćódè': [('á', 'vãl')]}
+        result = ttk._format_mapdict(opts)
+        self.assertEqual(result, ('-üñíćódè', 'á vãl'))
+
+        self.assertEqual(ttk._format_mapdict({'opt': [('value',)]}),
+                         ('-opt', '{} value'))
+
+        # empty states
+        valid = {'opt': [('', '', 'hi')]}
+        self.assertEqual(ttk._format_mapdict(valid), ('-opt', '{ } hi'))
+
+        # when passing multiple states, they all must be strings
+        invalid = {'opt': [(1, 2, 'valid val')]}
+        self.assertRaises(TypeError, ttk._format_mapdict, invalid)
+        invalid = {'opt': [([1], '2', 'valid val')]}
+        self.assertRaises(TypeError, ttk._format_mapdict, invalid)
+        # but when passing a single state, it can be anything
+        valid = {'opt': [[1, 'value']]}
+        self.assertEqual(ttk._format_mapdict(valid), ('-opt', '1 value'))
+        # special attention to single states which evaluate to False
+        for stateval in (None, 0, False, '', set()): # just some samples
+            valid = {'opt': [(stateval, 'value')]}
+            self.assertEqual(ttk._format_mapdict(valid),
+                ('-opt', '{} value'))
+
+        # values must be iterable
+        opts = {'a': None}
+        self.assertRaises(TypeError, ttk._format_mapdict, opts)
+
+
+    def test_format_elemcreate(self):
+        self.assertTrue(ttk._format_elemcreate(None), (None, ()))
+
+        ## Testing type = image
+        # image type expects at least an image name, so this should raise
+        # IndexError since it tries to access the index 0 of an empty tuple
+        self.assertRaises(IndexError, ttk._format_elemcreate, 'image')
+
+        # don't format returned values as a tcl script
+        # minimum acceptable for image type
+        self.assertEqual(ttk._format_elemcreate('image', False, 'test'),
+            ("test ", ()))
+        # specifying a state spec
+        self.assertEqual(ttk._format_elemcreate('image', False, 'test',
+            ('', 'a')), ("test {} a", ()))
+        # state spec with multiple states
+        self.assertEqual(ttk._format_elemcreate('image', False, 'test',
+            ('a', 'b', 'c')), ("test {a b} c", ()))
+        # state spec and options
+        self.assertEqual(ttk._format_elemcreate('image', False, 'test',
+            ('a', 'b'), a='x'), ("test a b", ("-a", "x")))
+        # format returned values as a tcl script
+        # state spec with multiple states and an option with a multivalue
+        self.assertEqual(ttk._format_elemcreate('image', True, 'test',
+            ('a', 'b', 'c', 'd'), x=[2, 3]), ("{test {a b c} d}", "-x {2 3}"))
+
+        ## Testing type = vsapi
+        # vsapi type expects at least a class name and a part_id, so this
+        # should raise a ValueError since it tries to get two elements from
+        # an empty tuple
+        self.assertRaises(ValueError, ttk._format_elemcreate, 'vsapi')
+
+        # don't format returned values as a tcl script
+        # minimum acceptable for vsapi
+        self.assertEqual(ttk._format_elemcreate('vsapi', False, 'a', 'b'),
+            ("a b ", ()))
+        # now with a state spec with multiple states
+        self.assertEqual(ttk._format_elemcreate('vsapi', False, 'a', 'b',
+            ('a', 'b', 'c')), ("a b {a b} c", ()))
+        # state spec and option
+        self.assertEqual(ttk._format_elemcreate('vsapi', False, 'a', 'b',
+            ('a', 'b'), opt='x'), ("a b a b", ("-opt", "x")))
+        # format returned values as a tcl script
+        # state spec with a multivalue and an option
+        self.assertEqual(ttk._format_elemcreate('vsapi', True, 'a', 'b',
+            ('a', 'b', [1, 2]), opt='x'), ("{a b {a b} {1 2}}", "-opt x"))
+
+        # Testing type = from
+        # from type expects at least a type name
+        self.assertRaises(IndexError, ttk._format_elemcreate, 'from')
+
+        self.assertEqual(ttk._format_elemcreate('from', False, 'a'),
+            ('a', ()))
+        self.assertEqual(ttk._format_elemcreate('from', False, 'a', 'b'),
+            ('a', ('b', )))
+        self.assertEqual(ttk._format_elemcreate('from', True, 'a', 'b'),
+            ('{a}', 'b'))
+
+
+    def test_format_layoutlist(self):
+        def sample(indent=0, indent_size=2):
+            return ttk._format_layoutlist(
+            [('a', {'other': [1, 2, 3], 'children':
+                [('b', {'children':
+                    [('c', {'children':
+                        [('d', {'nice': 'opt'})], 'something': (1, 2)
+                    })]
+                })]
+            })], indent=indent, indent_size=indent_size)[0]
+
+        def sample_expected(indent=0, indent_size=2):
+            spaces = lambda amount=0: ' ' * (amount + indent)
+            return (
+                "%sa -other {1 2 3} -children {\n"
+                "%sb -children {\n"
+                "%sc -something {1 2} -children {\n"
+                "%sd -nice opt\n"
+                "%s}\n"
+                "%s}\n"
+                "%s}" % (spaces(), spaces(indent_size),
+                    spaces(2 * indent_size), spaces(3 * indent_size),
+                    spaces(2 * indent_size), spaces(indent_size), spaces()))
+
+        # empty layout
+        self.assertEqual(ttk._format_layoutlist([])[0], '')
+
+        # _format_layoutlist always expects the second item (in every item)
+        # to act like a dict (except when the value evaluates to False).
+        self.assertRaises(AttributeError,
+            ttk._format_layoutlist, [('a', 'b')])
+
+        smallest = ttk._format_layoutlist([('a', None)], indent=0)
+        self.assertEqual(smallest,
+            ttk._format_layoutlist([('a', '')], indent=0))
+        self.assertEqual(smallest[0], 'a')
+
+        # testing indentation levels
+        self.assertEqual(sample(), sample_expected())
+        for i in range(4):
+            self.assertEqual(sample(i), sample_expected(i))
+            self.assertEqual(sample(i, i), sample_expected(i, i))
+
+        # invalid layout format, different kind of exceptions will be
+        # raised by internal functions
+
+        # plain wrong format
+        self.assertRaises(ValueError, ttk._format_layoutlist,
+            ['bad', 'format'])
+        # will try to use iteritems in the 'bad' string
+        self.assertRaises(AttributeError, ttk._format_layoutlist,
+           [('name', 'bad')])
+        # bad children formatting
+        self.assertRaises(ValueError, ttk._format_layoutlist,
+            [('name', {'children': {'a': None}})])
+
+
+    def test_script_from_settings(self):
+        # empty options
+        self.assertFalse(ttk._script_from_settings({'name':
+            {'configure': None, 'map': None, 'element create': None}}))
+
+        # empty layout
+        self.assertEqual(
+            ttk._script_from_settings({'name': {'layout': None}}),
+            "ttk::style layout name {\nnull\n}")
+
+        configdict = {'αβγ': True, 'á': False}
+        self.assertTrue(
+            ttk._script_from_settings({'name': {'configure': configdict}}))
+
+        mapdict = {'üñíćódè': [('á', 'vãl')]}
+        self.assertTrue(
+            ttk._script_from_settings({'name': {'map': mapdict}}))
+
+        # invalid image element
+        self.assertRaises(IndexError,
+            ttk._script_from_settings, {'name': {'element create': ['image']}})
+
+        # minimal valid image
+        self.assertTrue(ttk._script_from_settings({'name':
+            {'element create': ['image', 'name']}}))
+
+        image = {'thing': {'element create':
+            ['image', 'name', ('state1', 'state2', 'val')]}}
+        self.assertEqual(ttk._script_from_settings(image),
+            "ttk::style element create thing image {name {state1 state2} val} ")
+
+        image['thing']['element create'].append({'opt': 30})
+        self.assertEqual(ttk._script_from_settings(image),
+            "ttk::style element create thing image {name {state1 state2} val} "
+            "-opt 30")
+
+        image['thing']['element create'][-1]['opt'] = [MockTclObj(3),
+            MockTclObj('2m')]
+        self.assertEqual(ttk._script_from_settings(image),
+            "ttk::style element create thing image {name {state1 state2} val} "
+            "-opt {3 2m}")
+
+
+    def test_tclobj_to_py(self):
+        self.assertEqual(
+            ttk._tclobj_to_py((MockStateSpec('a', 'b'), 'val')),
+            [('a', 'b', 'val')])
+        self.assertEqual(
+            ttk._tclobj_to_py([MockTclObj('1'), 2, MockTclObj('3m')]),
+            [1, 2, '3m'])
+
+
+    def test_list_from_statespec(self):
+        def test_it(sspec, value, res_value, states):
+            self.assertEqual(ttk._list_from_statespec(
+                (sspec, value)), [states + (res_value, )])
+
+        states_even = tuple('state%d' % i for i in range(6))
+        statespec = MockStateSpec(*states_even)
+        test_it(statespec, 'val', 'val', states_even)
+        test_it(statespec, MockTclObj('val'), 'val', states_even)
+
+        states_odd = tuple('state%d' % i for i in range(5))
+        statespec = MockStateSpec(*states_odd)
+        test_it(statespec, 'val', 'val', states_odd)
+
+        test_it(('a', 'b', 'c'), MockTclObj('val'), 'val', ('a', 'b', 'c'))
+
+
+    def test_list_from_layouttuple(self):
+        tk = MockTkApp()
+
+        # empty layout tuple
+        self.assertFalse(ttk._list_from_layouttuple(tk, ()))
+
+        # shortest layout tuple
+        self.assertEqual(ttk._list_from_layouttuple(tk, ('name', )),
+            [('name', {})])
+
+        # not so interesting ltuple
+        sample_ltuple = ('name', '-option', 'value')
+        self.assertEqual(ttk._list_from_layouttuple(tk, sample_ltuple),
+            [('name', {'option': 'value'})])
+
+        # empty children
+        self.assertEqual(ttk._list_from_layouttuple(tk,
+            ('something', '-children', ())),
+            [('something', {'children': []})]
+        )
+
+        # more interesting ltuple
+        ltuple = (
+            'name', '-option', 'niceone', '-children', (
+                ('otherone', '-children', (
+                    ('child', )), '-otheropt', 'othervalue'
+                )
+            )
+        )
+        self.assertEqual(ttk._list_from_layouttuple(tk, ltuple),
+            [('name', {'option': 'niceone', 'children':
+                [('otherone', {'otheropt': 'othervalue', 'children':
+                    [('child', {})]
+                })]
+            })]
+        )
+
+        # bad tuples
+        self.assertRaises(ValueError, ttk._list_from_layouttuple, tk,
+            ('name', 'no_minus'))
+        self.assertRaises(ValueError, ttk._list_from_layouttuple, tk,
+            ('name', 'no_minus', 'value'))
+        self.assertRaises(ValueError, ttk._list_from_layouttuple, tk,
+            ('something', '-children')) # no children
+
+
+    def test_val_or_dict(self):
+        def func(res, opt=None, val=None):
+            if opt is None:
+                return res
+            if val is None:
+                return "test val"
+            return (opt, val)
+
+        tk = MockTkApp()
+        tk.call = func
+
+        self.assertEqual(ttk._val_or_dict(tk, {}, '-test:3'),
+                         {'test': '3'})
+        self.assertEqual(ttk._val_or_dict(tk, {}, ('-test', 3)),
+                         {'test': 3})
+
+        self.assertEqual(ttk._val_or_dict(tk, {'test': None}, 'x:y'),
+                         'test val')
+
+        self.assertEqual(ttk._val_or_dict(tk, {'test': 3}, 'x:y'),
+                         {'test': 3})
+
+
+    def test_convert_stringval(self):
+        tests = (
+            (0, 0), ('09', 9), ('a', 'a'), ('áÚ', 'áÚ'), ([], '[]'),
+            (None, 'None')
+        )
+        for orig, expected in tests:
+            self.assertEqual(ttk._convert_stringval(orig), expected)
+
+
+class TclObjsToPyTest(unittest.TestCase):
+
+    def test_unicode(self):
+        adict = {'opt': 'välúè'}
+        self.assertEqual(ttk.tclobjs_to_py(adict), {'opt': 'välúè'})
+
+        adict['opt'] = MockTclObj(adict['opt'])
+        self.assertEqual(ttk.tclobjs_to_py(adict), {'opt': 'välúè'})
+
+    def test_multivalues(self):
+        adict = {'opt': [1, 2, 3, 4]}
+        self.assertEqual(ttk.tclobjs_to_py(adict), {'opt': [1, 2, 3, 4]})
+
+        adict['opt'] = [1, 'xm', 3]
+        self.assertEqual(ttk.tclobjs_to_py(adict), {'opt': [1, 'xm', 3]})
+
+        adict['opt'] = (MockStateSpec('a', 'b'), 'válũè')
+        self.assertEqual(ttk.tclobjs_to_py(adict),
+            {'opt': [('a', 'b', 'válũè')]})
+
+        self.assertEqual(ttk.tclobjs_to_py({'x': ['y z']}),
+            {'x': ['y z']})
+
+    def test_nosplit(self):
+        self.assertEqual(ttk.tclobjs_to_py({'text': 'some text'}),
+            {'text': 'some text'})
+
 
 if __name__ == '__main__':
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_turtle.py b/Lib/test/test_turtle.py
index 5d5f057..95af84e 100644
--- a/Lib/test/test_turtle.py
+++ b/Lib/test/test_turtle.py
@@ -1,8 +1,11 @@
 import pickle
 import unittest
 from test import support
+from test.support import import_helper
+from test.support import os_helper
 
-turtle = support.import_module('turtle')
+
+turtle = import_helper.import_module('turtle')
 Vec2D = turtle.Vec2D
 
 test_config = """\
@@ -50,10 +53,10 @@
 class TurtleConfigTest(unittest.TestCase):
 
     def get_cfg_file(self, cfg_str):
-        self.addCleanup(support.unlink, support.TESTFN)
-        with open(support.TESTFN, 'w') as f:
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
+        with open(os_helper.TESTFN, 'w') as f:
             f.write(cfg_str)
-        return support.TESTFN
+        return os_helper.TESTFN
 
     def test_config_dict(self):
 
@@ -232,17 +235,9 @@
         self.assertVectorsAlmostEqual(-vec, expected)
 
     def test_distance(self):
-        vec = Vec2D(6, 8)
-        expected = 10
-        self.assertEqual(abs(vec), expected)
-
-        vec = Vec2D(0, 0)
-        expected = 0
-        self.assertEqual(abs(vec), expected)
-
-        vec = Vec2D(2.5, 6)
-        expected = 6.5
-        self.assertEqual(abs(vec), expected)
+        self.assertAlmostEqual(abs(Vec2D(6, 8)), 10)
+        self.assertEqual(abs(Vec2D(0, 0)), 0)
+        self.assertAlmostEqual(abs(Vec2D(2.5, 6)), 6.5)
 
     def test_rotate(self):
 
diff --git a/Lib/test/test_type_annotations.py b/Lib/test/test_type_annotations.py
new file mode 100644
index 0000000..87f46c2c
--- /dev/null
+++ b/Lib/test/test_type_annotations.py
@@ -0,0 +1,103 @@
+import unittest
+
+class TypeAnnotationTests(unittest.TestCase):
+
+    def test_lazy_create_annotations(self):
+        # type objects lazy create their __annotations__ dict on demand.
+        # the annotations dict is stored in type.__dict__.
+        # a freshly created type shouldn't have an annotations dict yet.
+        foo = type("Foo", (), {})
+        for i in range(3):
+            self.assertFalse("__annotations__" in foo.__dict__)
+            d = foo.__annotations__
+            self.assertTrue("__annotations__" in foo.__dict__)
+            self.assertEqual(foo.__annotations__, d)
+            self.assertEqual(foo.__dict__['__annotations__'], d)
+            del foo.__annotations__
+
+    def test_setting_annotations(self):
+        foo = type("Foo", (), {})
+        for i in range(3):
+            self.assertFalse("__annotations__" in foo.__dict__)
+            d = {'a': int}
+            foo.__annotations__ = d
+            self.assertTrue("__annotations__" in foo.__dict__)
+            self.assertEqual(foo.__annotations__, d)
+            self.assertEqual(foo.__dict__['__annotations__'], d)
+            del foo.__annotations__
+
+    def test_annotations_getset_raises(self):
+        # builtin types don't have __annotations__ (yet!)
+        with self.assertRaises(AttributeError):
+            print(float.__annotations__)
+        with self.assertRaises(TypeError):
+            float.__annotations__ = {}
+        with self.assertRaises(TypeError):
+            del float.__annotations__
+
+        # double delete
+        foo = type("Foo", (), {})
+        foo.__annotations__ = {}
+        del foo.__annotations__
+        with self.assertRaises(AttributeError):
+            del foo.__annotations__
+
+    def test_annotations_are_created_correctly(self):
+        class C:
+            a:int=3
+            b:str=4
+        self.assertTrue("__annotations__" in C.__dict__)
+        del C.__annotations__
+        self.assertFalse("__annotations__" in C.__dict__)
+
+    def test_descriptor_still_works(self):
+        class C:
+            def __init__(self, name=None, bases=None, d=None):
+                self.my_annotations = None
+
+            @property
+            def __annotations__(self):
+                if not hasattr(self, 'my_annotations'):
+                    self.my_annotations = {}
+                if not isinstance(self.my_annotations, dict):
+                    self.my_annotations = {}
+                return self.my_annotations
+
+            @__annotations__.setter
+            def __annotations__(self, value):
+                if not isinstance(value, dict):
+                    raise ValueError("can only set __annotations__ to a dict")
+                self.my_annotations = value
+
+            @__annotations__.deleter
+            def __annotations__(self):
+                if getattr(self, 'my_annotations', False) is None:
+                    raise AttributeError('__annotations__')
+                self.my_annotations = None
+
+        c = C()
+        self.assertEqual(c.__annotations__, {})
+        d = {'a':'int'}
+        c.__annotations__ = d
+        self.assertEqual(c.__annotations__, d)
+        with self.assertRaises(ValueError):
+            c.__annotations__ = 123
+        del c.__annotations__
+        with self.assertRaises(AttributeError):
+            del c.__annotations__
+        self.assertEqual(c.__annotations__, {})
+
+
+        class D(metaclass=C):
+            pass
+
+        self.assertEqual(D.__annotations__, {})
+        d = {'a':'int'}
+        D.__annotations__ = d
+        self.assertEqual(D.__annotations__, d)
+        with self.assertRaises(ValueError):
+            D.__annotations__ = 123
+        del D.__annotations__
+        with self.assertRaises(AttributeError):
+            del D.__annotations__
+        self.assertEqual(D.__annotations__, {})
diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py
index 49dc5bf..725d80d 100644
--- a/Lib/test/test_types.py
+++ b/Lib/test/test_types.py
@@ -1,7 +1,10 @@
 # Python test set -- part 6, built-in types
 
-from test.support import run_with_locale
+from test.support import run_with_locale, cpython_only
 import collections.abc
+from collections import namedtuple
+import copy
+import gc
 import inspect
 import pickle
 import locale
@@ -9,6 +12,20 @@
 import types
 import unittest.mock
 import weakref
+import typing
+
+
+T = typing.TypeVar("T")
+
+class Example:
+    pass
+
+class Forward: ...
+
+def clear_typing_caches():
+    for f in typing._cleanups:
+        f()
+
 
 class TypesTests(unittest.TestCase):
 
@@ -598,6 +615,377 @@
         self.assertIsInstance(int.from_bytes, types.BuiltinMethodType)
         self.assertIsInstance(int.__new__, types.BuiltinMethodType)
 
+    def test_ellipsis_type(self):
+        self.assertIsInstance(Ellipsis, types.EllipsisType)
+
+    def test_notimplemented_type(self):
+        self.assertIsInstance(NotImplemented, types.NotImplementedType)
+
+    def test_none_type(self):
+        self.assertIsInstance(None, types.NoneType)
+
+
+class UnionTests(unittest.TestCase):
+
+    def test_or_types_operator(self):
+        self.assertEqual(int | str, typing.Union[int, str])
+        self.assertNotEqual(int | list, typing.Union[int, str])
+        self.assertEqual(str | int, typing.Union[int, str])
+        self.assertEqual(int | None, typing.Union[int, None])
+        self.assertEqual(None | int, typing.Union[int, None])
+        self.assertEqual(int | type(None), int | None)
+        self.assertEqual(type(None) | int, None | int)
+        self.assertEqual(int | str | list, typing.Union[int, str, list])
+        self.assertEqual(int | (str | list), typing.Union[int, str, list])
+        self.assertEqual(str | (int | list), typing.Union[int, str, list])
+        self.assertEqual(typing.List | typing.Tuple, typing.Union[typing.List, typing.Tuple])
+        self.assertEqual(typing.List[int] | typing.Tuple[int], typing.Union[typing.List[int], typing.Tuple[int]])
+        self.assertEqual(typing.List[int] | None, typing.Union[typing.List[int], None])
+        self.assertEqual(None | typing.List[int], typing.Union[None, typing.List[int]])
+        self.assertEqual(str | float | int | complex | int, (int | str) | (float | complex))
+        self.assertEqual(typing.Union[str, int, typing.List[int]], str | int | typing.List[int])
+        self.assertIs(int | int, int)
+        self.assertEqual(
+            BaseException |
+            bool |
+            bytes |
+            complex |
+            float |
+            int |
+            list |
+            map |
+            set,
+            typing.Union[
+                BaseException,
+                bool,
+                bytes,
+                complex,
+                float,
+                int,
+                list,
+                map,
+                set,
+            ])
+        with self.assertRaises(TypeError):
+            int | 3
+        with self.assertRaises(TypeError):
+            3 | int
+        with self.assertRaises(TypeError):
+            Example() | int
+        x = int | str
+        self.assertEqual(x, int | str)
+        self.assertEqual(x, str | int)
+        self.assertNotEqual(x, {})  # should not raise exception
+        with self.assertRaises(TypeError):
+            x < x
+        with self.assertRaises(TypeError):
+            x <= x
+        y = typing.Union[str, int]
+        with self.assertRaises(TypeError):
+            x < y
+        y = int | bool
+        with self.assertRaises(TypeError):
+            x < y
+        # Check that we don't crash if typing.Union does not have a tuple in __args__
+        y = typing.Union[str, int]
+        y.__args__ = [str, int]
+        self.assertEqual(x, y)
+
+    def test_hash(self):
+        self.assertEqual(hash(int | str), hash(str | int))
+        self.assertEqual(hash(int | str), hash(typing.Union[int, str]))
+
+    def test_instancecheck_and_subclasscheck(self):
+        for x in (int | str, typing.Union[int, str]):
+            with self.subTest(x=x):
+                self.assertIsInstance(1, x)
+                self.assertIsInstance(True, x)
+                self.assertIsInstance('a', x)
+                self.assertNotIsInstance(None, x)
+                self.assertTrue(issubclass(int, x))
+                self.assertTrue(issubclass(bool, x))
+                self.assertTrue(issubclass(str, x))
+                self.assertFalse(issubclass(type(None), x))
+
+        for x in (int | None, typing.Union[int, None]):
+            with self.subTest(x=x):
+                self.assertIsInstance(None, x)
+                self.assertTrue(issubclass(type(None), x))
+
+        for x in (
+            int | collections.abc.Mapping,
+            typing.Union[int, collections.abc.Mapping],
+        ):
+            with self.subTest(x=x):
+                self.assertIsInstance({}, x)
+                self.assertNotIsInstance((), x)
+                self.assertTrue(issubclass(dict, x))
+                self.assertFalse(issubclass(list, x))
+
+    def test_instancecheck_and_subclasscheck_order(self):
+        T = typing.TypeVar('T')
+
+        will_resolve = (
+            int | T,
+            typing.Union[int, T],
+        )
+        for x in will_resolve:
+            with self.subTest(x=x):
+                self.assertIsInstance(1, x)
+                self.assertTrue(issubclass(int, x))
+
+        wont_resolve = (
+            T | int,
+            typing.Union[T, int],
+        )
+        for x in wont_resolve:
+            with self.subTest(x=x):
+                with self.assertRaises(TypeError):
+                    issubclass(int, x)
+                with self.assertRaises(TypeError):
+                    isinstance(1, x)
+
+        for x in (*will_resolve, *wont_resolve):
+            with self.subTest(x=x):
+                with self.assertRaises(TypeError):
+                    issubclass(object, x)
+                with self.assertRaises(TypeError):
+                    isinstance(object(), x)
+
+    def test_bad_instancecheck(self):
+        class BadMeta(type):
+            def __instancecheck__(cls, inst):
+                1/0
+        x = int | BadMeta('A', (), {})
+        self.assertTrue(isinstance(1, x))
+        self.assertRaises(ZeroDivisionError, isinstance, [], x)
+
+    def test_bad_subclasscheck(self):
+        class BadMeta(type):
+            def __subclasscheck__(cls, sub):
+                1/0
+        x = int | BadMeta('A', (), {})
+        self.assertTrue(issubclass(int, x))
+        self.assertRaises(ZeroDivisionError, issubclass, list, x)
+
+    def test_or_type_operator_with_TypeVar(self):
+        TV = typing.TypeVar('T')
+        assert TV | str == typing.Union[TV, str]
+        assert str | TV == typing.Union[str, TV]
+        self.assertIs((int | TV)[int], int)
+        self.assertIs((TV | int)[int], int)
+
+    def test_union_args(self):
+        def check(arg, expected):
+            clear_typing_caches()
+            self.assertEqual(arg.__args__, expected)
+
+        check(int | str, (int, str))
+        check((int | str) | list, (int, str, list))
+        check(int | (str | list), (int, str, list))
+        check((int | str) | int, (int, str))
+        check(int | (str | int), (int, str))
+        check((int | str) | (str | int), (int, str))
+        check(typing.Union[int, str] | list, (int, str, list))
+        check(int | typing.Union[str, list], (int, str, list))
+        check((int | str) | (list | int), (int, str, list))
+        check((int | str) | typing.Union[list, int], (int, str, list))
+        check(typing.Union[int, str] | (list | int), (int, str, list))
+        check((str | int) | (int | list), (str, int, list))
+        check((str | int) | typing.Union[int, list], (str, int, list))
+        check(typing.Union[str, int] | (int | list), (str, int, list))
+        check(int | type(None), (int, type(None)))
+        check(type(None) | int, (type(None), int))
+
+        args = (int, list[int], typing.List[int],
+                typing.Tuple[int, int], typing.Callable[[int], int],
+                typing.Hashable, typing.TypeVar('T'))
+        for x in args:
+            with self.subTest(x):
+                check(x | None, (x, type(None)))
+                check(None | x, (type(None), x))
+
+    def test_union_parameter_chaining(self):
+        T = typing.TypeVar("T")
+        S = typing.TypeVar("S")
+
+        self.assertEqual((float | list[T])[int], float | list[int])
+        self.assertEqual(list[int | list[T]].__parameters__, (T,))
+        self.assertEqual(list[int | list[T]][str], list[int | list[str]])
+        self.assertEqual((list[T] | list[S]).__parameters__, (T, S))
+        self.assertEqual((list[T] | list[S])[int, T], list[int] | list[T])
+        self.assertEqual((list[T] | list[S])[int, int], list[int])
+
+    def test_union_parameter_substitution(self):
+        def eq(actual, expected, typed=True):
+            self.assertEqual(actual, expected)
+            if typed:
+                self.assertIs(type(actual), type(expected))
+
+        T = typing.TypeVar('T')
+        S = typing.TypeVar('S')
+        NT = typing.NewType('NT', str)
+        x = int | T | bytes
+
+        eq(x[str], int | str | bytes, typed=False)
+        eq(x[list[int]], int | list[int] | bytes, typed=False)
+        eq(x[typing.List], int | typing.List | bytes)
+        eq(x[typing.List[int]], int | typing.List[int] | bytes)
+        eq(x[typing.Hashable], int | typing.Hashable | bytes)
+        eq(x[collections.abc.Hashable],
+           int | collections.abc.Hashable | bytes, typed=False)
+        eq(x[typing.Callable[[int], str]],
+           int | typing.Callable[[int], str] | bytes)
+        eq(x[collections.abc.Callable[[int], str]],
+           int | collections.abc.Callable[[int], str] | bytes, typed=False)
+        eq(x[typing.Tuple[int, str]], int | typing.Tuple[int, str] | bytes)
+        eq(x[typing.Literal['none']], int | typing.Literal['none'] | bytes)
+        eq(x[str | list], int | str | list | bytes, typed=False)
+        eq(x[typing.Union[str, list]], typing.Union[int, str, list, bytes])
+        eq(x[str | int], int | str | bytes, typed=False)
+        eq(x[typing.Union[str, int]], typing.Union[int, str, bytes])
+        eq(x[NT], int | NT | bytes)
+        eq(x[S], int | S | bytes)
+
+    def test_union_pickle(self):
+        orig = list[T] | int
+        for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+            s = pickle.dumps(orig, proto)
+            loaded = pickle.loads(s)
+            self.assertEqual(loaded, orig)
+            self.assertEqual(loaded.__args__, orig.__args__)
+            self.assertEqual(loaded.__parameters__, orig.__parameters__)
+
+    def test_union_copy(self):
+        orig = list[T] | int
+        for copied in (copy.copy(orig), copy.deepcopy(orig)):
+            self.assertEqual(copied, orig)
+            self.assertEqual(copied.__args__, orig.__args__)
+            self.assertEqual(copied.__parameters__, orig.__parameters__)
+
+    def test_union_parameter_substitution_errors(self):
+        T = typing.TypeVar("T")
+        x = int | T
+        with self.assertRaises(TypeError):
+            x[42]
+
+    def test_or_type_operator_with_forward(self):
+        T = typing.TypeVar('T')
+        ForwardAfter = T | 'Forward'
+        ForwardBefore = 'Forward' | T
+        def forward_after(x: ForwardAfter[int]) -> None: ...
+        def forward_before(x: ForwardBefore[int]) -> None: ...
+        assert typing.get_args(typing.get_type_hints(forward_after)['x']) == (int, Forward)
+        assert typing.get_args(typing.get_type_hints(forward_before)['x']) == (int, Forward)
+
+    def test_or_type_operator_with_Protocol(self):
+        class Proto(typing.Protocol):
+            def meth(self) -> int:
+                ...
+        assert Proto | str == typing.Union[Proto, str]
+
+    def test_or_type_operator_with_Alias(self):
+        assert list | str == typing.Union[list, str]
+        assert typing.List | str == typing.Union[typing.List, str]
+
+    def test_or_type_operator_with_NamedTuple(self):
+        NT=namedtuple('A', ['B', 'C', 'D'])
+        assert NT | str == typing.Union[NT,str]
+
+    def test_or_type_operator_with_TypedDict(self):
+        class Point2D(typing.TypedDict):
+            x: int
+            y: int
+            label: str
+        assert Point2D | str == typing.Union[Point2D, str]
+
+    def test_or_type_operator_with_NewType(self):
+        UserId = typing.NewType('UserId', int)
+        assert UserId | str == typing.Union[UserId, str]
+
+    def test_or_type_operator_with_IO(self):
+        assert typing.IO | str == typing.Union[typing.IO, str]
+
+    def test_or_type_operator_with_SpecialForm(self):
+        assert typing.Any | str == typing.Union[typing.Any, str]
+        assert typing.NoReturn | str == typing.Union[typing.NoReturn, str]
+        assert typing.Optional[int] | str == typing.Union[typing.Optional[int], str]
+        assert typing.Optional[int] | str == typing.Union[int, str, None]
+        assert typing.Union[int, bool] | str == typing.Union[int, bool, str]
+
+    def test_or_type_repr(self):
+        assert repr(int | str) == "int | str"
+        assert repr((int | str) | list) == "int | str | list"
+        assert repr(int | (str | list)) == "int | str | list"
+        assert repr(int | None) == "int | None"
+        assert repr(int | type(None)) == "int | None"
+        assert repr(int | typing.GenericAlias(list, int)) == "int | list[int]"
+
+    def test_or_type_operator_with_genericalias(self):
+        a = list[int]
+        b = list[str]
+        c = dict[float, str]
+        class SubClass(types.GenericAlias): ...
+        d = SubClass(list, float)
+        # equivalence with typing.Union
+        self.assertEqual(a | b | c | d, typing.Union[a, b, c, d])
+        # de-duplicate
+        self.assertEqual(a | c | b | b | a | c | d | d, a | b | c | d)
+        # order shouldn't matter
+        self.assertEqual(a | b | d, b | a | d)
+        self.assertEqual(repr(a | b | c | d),
+                         "list[int] | list[str] | dict[float, str] | list[float]")
+
+        class BadType(type):
+            def __eq__(self, other):
+                return 1 / 0
+
+        bt = BadType('bt', (), {})
+        # Comparison should fail and errors should propagate out for bad types.
+        with self.assertRaises(ZeroDivisionError):
+            list[int] | list[bt]
+
+        union_ga = (int | list[str], int | collections.abc.Callable[..., str],
+                    int | d)
+        # Raise error when isinstance(type, type | genericalias)
+        for type_ in union_ga:
+            with self.subTest(f"check isinstance/issubclass is invalid for {type_}"):
+                with self.assertRaises(TypeError):
+                    isinstance(1, type_)
+                with self.assertRaises(TypeError):
+                    issubclass(int, type_)
+
+    def test_or_type_operator_with_bad_module(self):
+        class BadMeta(type):
+            __qualname__ = 'TypeVar'
+            @property
+            def __module__(self):
+                1 / 0
+        TypeVar = BadMeta('TypeVar', (), {})
+        _SpecialForm = BadMeta('_SpecialForm', (), {})
+        # Crashes in Issue44483
+        with self.assertRaises((TypeError, ZeroDivisionError)):
+            str | TypeVar()
+        with self.assertRaises((TypeError, ZeroDivisionError)):
+            str | _SpecialForm()
+
+    @cpython_only
+    def test_or_type_operator_reference_cycle(self):
+        if not hasattr(sys, 'gettotalrefcount'):
+            self.skipTest('Cannot get total reference count.')
+        gc.collect()
+        before = sys.gettotalrefcount()
+        for _ in range(30):
+            T = typing.TypeVar('T')
+            U = int | list[T]
+            T.blah = U
+            del T
+            del U
+        gc.collect()
+        leeway = 15
+        self.assertLessEqual(sys.gettotalrefcount() - before, leeway,
+                             msg='Check for union reference leak.')
+
 
 class MappingProxyTests(unittest.TestCase):
     mappingproxy = types.MappingProxyType
@@ -888,6 +1276,17 @@
         self.assertEqual(D.__orig_bases__, (c,))
         self.assertEqual(D.__mro__, (D, A, object))
 
+    def test_new_class_with_mro_entry_genericalias(self):
+        L1 = types.new_class('L1', (typing.List[int],), {})
+        self.assertEqual(L1.__bases__, (list, typing.Generic))
+        self.assertEqual(L1.__orig_bases__, (typing.List[int],))
+        self.assertEqual(L1.__mro__, (L1, list, typing.Generic, object))
+
+        L2 = types.new_class('L2', (list[int],), {})
+        self.assertEqual(L2.__bases__, (list,))
+        self.assertEqual(L2.__orig_bases__, (list[int],))
+        self.assertEqual(L2.__mro__, (L2, list, object))
+
     def test_new_class_with_mro_entry_none(self):
         class A: pass
         class B: pass
@@ -1003,6 +1402,11 @@
         for bases in [x, y, z, t]:
             self.assertIs(types.resolve_bases(bases), bases)
 
+    def test_resolve_bases_with_mro_entry(self):
+        self.assertEqual(types.resolve_bases((typing.List[int],)),
+                         (list, typing.Generic))
+        self.assertEqual(types.resolve_bases((list[int],)), (list,))
+
     def test_metaclass_derivation(self):
         # issue1294232: correct metaclass calculation
         new_calls = []  # to check the order of __new__ calls
@@ -1176,6 +1580,24 @@
             N(5)
         self.assertEqual(str(cm.exception), expected_message)
 
+    def test_metaclass_new_error(self):
+        # bpo-44232: The C function type_new() must properly report the
+        # exception when a metaclass constructor raises an exception and the
+        # winner class is not the metaclass.
+        class ModelBase(type):
+            def __new__(cls, name, bases, attrs):
+                super_new = super().__new__
+                new_class = super_new(cls, name, bases, {})
+                if name != "Model":
+                    raise RuntimeWarning(f"{name=}")
+                return new_class
+
+        class Model(metaclass=ModelBase):
+            pass
+
+        with self.assertRaises(RuntimeWarning):
+            type("SouthPonies", (Model,), {})
+
 
 class SimpleNamespaceTests(unittest.TestCase):
 
diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py
index 13cf20e..779e175 100644
--- a/Lib/test/test_typing.py
+++ b/Lib/test/test_typing.py
@@ -16,6 +16,7 @@
 from typing import cast, runtime_checkable
 from typing import get_type_hints
 from typing import get_origin, get_args
+from typing import is_typeddict
 from typing import no_type_check, no_type_check_decorator
 from typing import Type
 from typing import NewType
@@ -23,12 +24,16 @@
 from typing import IO, TextIO, BinaryIO
 from typing import Pattern, Match
 from typing import Annotated, ForwardRef
+from typing import TypeAlias
+from typing import ParamSpec, Concatenate, ParamSpecArgs, ParamSpecKwargs
+from typing import TypeGuard
 import abc
 import typing
 import weakref
 import types
 
 from test import mod_generics_cache
+from test import _typed_dict_helper
 
 
 class BaseTestCase(TestCase):
@@ -183,6 +188,16 @@
         self.assertEqual(Union[X, int].__parameters__, (X,))
         self.assertIs(Union[X, int].__origin__, Union)
 
+    def test_or(self):
+        X = TypeVar('X')
+        # use a string because str doesn't implement
+        # __or__/__ror__ itself
+        self.assertEqual(X | "x", Union[X, "x"])
+        self.assertEqual("x" | X, Union["x", X])
+        # make sure the order is correct
+        self.assertEqual(get_args(X | "x"), (X, ForwardRef("x")))
+        self.assertEqual(get_args("x" | X), (ForwardRef("x"), X))
+
     def test_union_constrained(self):
         A = TypeVar('A', str, bytes)
         self.assertNotEqual(Union[A, str], Union[A])
@@ -232,6 +247,15 @@
         with self.assertRaises(ValueError):
             TypeVar('T', covariant=True, contravariant=True)
 
+    def test_bad_var_substitution(self):
+        T = TypeVar('T')
+        for arg in (), (int, str):
+            with self.subTest(arg=arg):
+                with self.assertRaises(TypeError):
+                    List[T][arg]
+                with self.assertRaises(TypeError):
+                    list[T][arg]
+
 
 class UnionTests(BaseTestCase):
 
@@ -245,8 +269,6 @@
         with self.assertRaises(TypeError):
             issubclass(Union, int)
         with self.assertRaises(TypeError):
-            issubclass(int, Union[int, str])
-        with self.assertRaises(TypeError):
             issubclass(Union[int, str], int)
 
     def test_union_any(self):
@@ -302,6 +324,17 @@
         self.assertEqual(repr(u), 'typing.Union[typing.List[int], int]')
         u = Union[list[int], dict[str, float]]
         self.assertEqual(repr(u), 'typing.Union[list[int], dict[str, float]]')
+        u = Union[int | float]
+        self.assertEqual(repr(u), 'typing.Union[int, float]')
+
+        u = Union[None, str]
+        self.assertEqual(repr(u), 'typing.Optional[str]')
+        u = Union[str, None]
+        self.assertEqual(repr(u), 'typing.Optional[str]')
+        u = Union[None, str, int]
+        self.assertEqual(repr(u), 'typing.Union[NoneType, str, int]')
+        u = Optional[str]
+        self.assertEqual(repr(u), 'typing.Optional[str]')
 
     def test_cannot_subclass(self):
         with self.assertRaises(TypeError):
@@ -349,10 +382,6 @@
         with self.assertRaises(TypeError):
             Union[()]
 
-    def test_union_instance_type_error(self):
-        with self.assertRaises(TypeError):
-            isinstance(42, Union[int, str])
-
     def test_no_eval_union(self):
         u = Union[int, str]
         def f(x: u): ...
@@ -389,8 +418,8 @@
             issubclass(tuple, Tuple[int, str])
 
         class TP(tuple): ...
-        self.assertTrue(issubclass(tuple, Tuple))
-        self.assertTrue(issubclass(TP, Tuple))
+        self.assertIsSubclass(tuple, Tuple)
+        self.assertIsSubclass(TP, Tuple)
 
     def test_equality(self):
         self.assertEqual(Tuple[int], Tuple[int])
@@ -401,7 +430,9 @@
     def test_tuple_subclass(self):
         class MyTuple(tuple):
             pass
-        self.assertTrue(issubclass(MyTuple, Tuple))
+        self.assertIsSubclass(MyTuple, Tuple)
+        self.assertIsSubclass(Tuple, Tuple)
+        self.assertIsSubclass(tuple, Tuple)
 
     def test_tuple_instance_type_error(self):
         with self.assertRaises(TypeError):
@@ -422,23 +453,29 @@
             issubclass(42, Tuple[int])
 
 
-class CallableTests(BaseTestCase):
+class BaseCallableTests:
 
     def test_self_subclass(self):
+        Callable = self.Callable
         with self.assertRaises(TypeError):
-            self.assertTrue(issubclass(type(lambda x: x), Callable[[int], int]))
-        self.assertTrue(issubclass(type(lambda x: x), Callable))
+            issubclass(types.FunctionType, Callable[[int], int])
+        self.assertIsSubclass(types.FunctionType, Callable)
+        self.assertIsSubclass(Callable, Callable)
 
     def test_eq_hash(self):
-        self.assertEqual(Callable[[int], int], Callable[[int], int])
-        self.assertEqual(len({Callable[[int], int], Callable[[int], int]}), 1)
-        self.assertNotEqual(Callable[[int], int], Callable[[int], str])
-        self.assertNotEqual(Callable[[int], int], Callable[[str], int])
-        self.assertNotEqual(Callable[[int], int], Callable[[int, int], int])
-        self.assertNotEqual(Callable[[int], int], Callable[[], int])
-        self.assertNotEqual(Callable[[int], int], Callable)
+        Callable = self.Callable
+        C = Callable[[int], int]
+        self.assertEqual(C, Callable[[int], int])
+        self.assertEqual(len({C, Callable[[int], int]}), 1)
+        self.assertNotEqual(C, Callable[[int], str])
+        self.assertNotEqual(C, Callable[[str], int])
+        self.assertNotEqual(C, Callable[[int, int], int])
+        self.assertNotEqual(C, Callable[[], int])
+        self.assertNotEqual(C, Callable[..., int])
+        self.assertNotEqual(C, Callable)
 
     def test_cannot_instantiate(self):
+        Callable = self.Callable
         with self.assertRaises(TypeError):
             Callable()
         with self.assertRaises(TypeError):
@@ -450,24 +487,19 @@
             type(c)()
 
     def test_callable_wrong_forms(self):
-        with self.assertRaises(TypeError):
-            Callable[[...], int]
-        with self.assertRaises(TypeError):
-            Callable[(), int]
-        with self.assertRaises(TypeError):
-            Callable[[()], int]
-        with self.assertRaises(TypeError):
-            Callable[[int, 1], 2]
+        Callable = self.Callable
         with self.assertRaises(TypeError):
             Callable[int]
 
     def test_callable_instance_works(self):
+        Callable = self.Callable
         def f():
             pass
         self.assertIsInstance(f, Callable)
         self.assertNotIsInstance(None, Callable)
 
     def test_callable_instance_type_error(self):
+        Callable = self.Callable
         def f():
             pass
         with self.assertRaises(TypeError):
@@ -480,17 +512,19 @@
             self.assertNotIsInstance(None, Callable[[], Any])
 
     def test_repr(self):
+        Callable = self.Callable
+        fullname = f'{Callable.__module__}.Callable'
         ct0 = Callable[[], bool]
-        self.assertEqual(repr(ct0), 'typing.Callable[[], bool]')
+        self.assertEqual(repr(ct0), f'{fullname}[[], bool]')
         ct2 = Callable[[str, float], int]
-        self.assertEqual(repr(ct2), 'typing.Callable[[str, float], int]')
+        self.assertEqual(repr(ct2), f'{fullname}[[str, float], int]')
         ctv = Callable[..., str]
-        self.assertEqual(repr(ctv), 'typing.Callable[..., str]')
+        self.assertEqual(repr(ctv), f'{fullname}[..., str]')
         ct3 = Callable[[str, float], list[int]]
-        self.assertEqual(repr(ct3), 'typing.Callable[[str, float], list[int]]')
+        self.assertEqual(repr(ct3), f'{fullname}[[str, float], list[int]]')
 
     def test_callable_with_ellipsis(self):
-
+        Callable = self.Callable
         def foo(a: Callable[..., T]):
             pass
 
@@ -498,9 +532,163 @@
                          {'a': Callable[..., T]})
 
     def test_ellipsis_in_generic(self):
+        Callable = self.Callable
         # Shouldn't crash; see https://github.com/python/typing/issues/259
         typing.List[Callable[..., str]]
 
+    def test_or_and_ror(self):
+        Callable = self.Callable
+        self.assertEqual(Callable | Tuple, Union[Callable, Tuple])
+        self.assertEqual(Tuple | Callable, Union[Tuple, Callable])
+
+    def test_basic(self):
+        Callable = self.Callable
+        alias = Callable[[int, str], float]
+        if Callable is collections.abc.Callable:
+            self.assertIsInstance(alias, types.GenericAlias)
+        self.assertIs(alias.__origin__, collections.abc.Callable)
+        self.assertEqual(alias.__args__, (int, str, float))
+        self.assertEqual(alias.__parameters__, ())
+
+    def test_weakref(self):
+        Callable = self.Callable
+        alias = Callable[[int, str], float]
+        self.assertEqual(weakref.ref(alias)(), alias)
+
+    def test_pickle(self):
+        Callable = self.Callable
+        alias = Callable[[int, str], float]
+        for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+            s = pickle.dumps(alias, proto)
+            loaded = pickle.loads(s)
+            self.assertEqual(alias.__origin__, loaded.__origin__)
+            self.assertEqual(alias.__args__, loaded.__args__)
+            self.assertEqual(alias.__parameters__, loaded.__parameters__)
+
+    def test_var_substitution(self):
+        Callable = self.Callable
+        fullname = f"{Callable.__module__}.Callable"
+        C1 = Callable[[int, T], T]
+        C2 = Callable[[KT, T], VT]
+        C3 = Callable[..., T]
+        self.assertEqual(C1[str], Callable[[int, str], str])
+        if Callable is typing.Callable:
+            self.assertEqual(C1[None], Callable[[int, type(None)], type(None)])
+        self.assertEqual(C2[int, float, str], Callable[[int, float], str])
+        self.assertEqual(C3[int], Callable[..., int])
+        self.assertEqual(C3[NoReturn], Callable[..., NoReturn])
+
+        # multi chaining
+        C4 = C2[int, VT, str]
+        self.assertEqual(repr(C4), f"{fullname}[[int, ~VT], str]")
+        self.assertEqual(repr(C4[dict]), f"{fullname}[[int, dict], str]")
+        self.assertEqual(C4[dict], Callable[[int, dict], str])
+
+        # substitute a nested GenericAlias (both typing and the builtin
+        # version)
+        C5 = Callable[[typing.List[T], tuple[KT, T], VT], int]
+        self.assertEqual(C5[int, str, float],
+                         Callable[[typing.List[int], tuple[str, int], float], int])
+
+    def test_type_erasure(self):
+        Callable = self.Callable
+        class C1(Callable):
+            def __call__(self):
+                return None
+        a = C1[[int], T]
+        self.assertIs(a().__class__, C1)
+        self.assertEqual(a().__orig_class__, C1[[int], T])
+
+    def test_paramspec(self):
+        Callable = self.Callable
+        fullname = f"{Callable.__module__}.Callable"
+        P = ParamSpec('P')
+        P2 = ParamSpec('P2')
+        C1 = Callable[P, T]
+        # substitution
+        self.assertEqual(C1[[int], str], Callable[[int], str])
+        self.assertEqual(C1[[int, str], str], Callable[[int, str], str])
+        self.assertEqual(C1[[], str], Callable[[], str])
+        self.assertEqual(C1[..., str], Callable[..., str])
+        self.assertEqual(C1[P2, str], Callable[P2, str])
+        self.assertEqual(C1[Concatenate[int, P2], str],
+                         Callable[Concatenate[int, P2], str])
+        self.assertEqual(repr(C1), f"{fullname}[~P, ~T]")
+        self.assertEqual(repr(C1[[int, str], str]), f"{fullname}[[int, str], str]")
+        with self.assertRaises(TypeError):
+            C1[int, str]
+
+        C2 = Callable[P, int]
+        self.assertEqual(C2[[int]], Callable[[int], int])
+        self.assertEqual(C2[[int, str]], Callable[[int, str], int])
+        self.assertEqual(C2[[]], Callable[[], int])
+        self.assertEqual(C2[...], Callable[..., int])
+        self.assertEqual(C2[P2], Callable[P2, int])
+        self.assertEqual(C2[Concatenate[int, P2]],
+                         Callable[Concatenate[int, P2], int])
+        # special case in PEP 612 where
+        # X[int, str, float] == X[[int, str, float]]
+        self.assertEqual(C2[int], Callable[[int], int])
+        self.assertEqual(C2[int, str], Callable[[int, str], int])
+        self.assertEqual(repr(C2), f"{fullname}[~P, int]")
+        self.assertEqual(repr(C2[int, str]), f"{fullname}[[int, str], int]")
+
+    def test_concatenate(self):
+        Callable = self.Callable
+        fullname = f"{Callable.__module__}.Callable"
+        T = TypeVar('T')
+        P = ParamSpec('P')
+        P2 = ParamSpec('P2')
+        C = Callable[Concatenate[int, P], T]
+        self.assertEqual(repr(C),
+                         f"{fullname}[typing.Concatenate[int, ~P], ~T]")
+        self.assertEqual(C[P2, int], Callable[Concatenate[int, P2], int])
+        self.assertEqual(C[[str, float], int], Callable[[int, str, float], int])
+        self.assertEqual(C[[], int], Callable[[int], int])
+        self.assertEqual(C[Concatenate[str, P2], int],
+                         Callable[Concatenate[int, str, P2], int])
+        with self.assertRaises(TypeError):
+            C[..., int]
+
+        C = Callable[Concatenate[int, P], int]
+        self.assertEqual(repr(C),
+                         f"{fullname}[typing.Concatenate[int, ~P], int]")
+        self.assertEqual(C[P2], Callable[Concatenate[int, P2], int])
+        self.assertEqual(C[[str, float]], Callable[[int, str, float], int])
+        self.assertEqual(C[str, float], Callable[[int, str, float], int])
+        self.assertEqual(C[[]], Callable[[int], int])
+        self.assertEqual(C[Concatenate[str, P2]],
+                         Callable[Concatenate[int, str, P2], int])
+        with self.assertRaises(TypeError):
+            C[...]
+
+    def test_errors(self):
+        Callable = self.Callable
+        alias = Callable[[int, str], float]
+        with self.assertRaisesRegex(TypeError, "is not a generic class"):
+            alias[int]
+        P = ParamSpec('P')
+        C1 = Callable[P, T]
+        with self.assertRaisesRegex(TypeError, "many arguments for"):
+            C1[int, str, str]
+        with self.assertRaisesRegex(TypeError, "few arguments for"):
+            C1[int]
+
+class TypingCallableTests(BaseCallableTests, BaseTestCase):
+    Callable = typing.Callable
+
+    def test_consistency(self):
+        # bpo-42195
+        # Testing collections.abc.Callable's consistency with typing.Callable
+        c1 = typing.Callable[[int, str], dict]
+        c2 = collections.abc.Callable[[int, str], dict]
+        self.assertEqual(c1.__args__, c2.__args__)
+        self.assertEqual(hash(c1.__args__), hash(c2.__args__))
+
+
+class CollectionsCallableTests(BaseCallableTests, BaseTestCase):
+    Callable = collections.abc.Callable
+
 
 class LiteralTests(BaseTestCase):
     def test_basics(self):
@@ -569,6 +757,8 @@
         self.assertNotEqual(Literal[True], Literal[1])
         self.assertNotEqual(Literal[1], Literal[2])
         self.assertNotEqual(Literal[1, True], Literal[1])
+        self.assertNotEqual(Literal[1, True], Literal[1, 1])
+        self.assertNotEqual(Literal[1, 2], Literal[True, 2])
         self.assertEqual(Literal[1], Literal[1])
         self.assertEqual(Literal[1, 2], Literal[2, 1])
         self.assertEqual(Literal[1, 2, 3], Literal[1, 2, 3, 3])
@@ -752,6 +942,9 @@
         class C(P): pass
 
         self.assertIsInstance(C(), C)
+        with self.assertRaises(TypeError):
+            C(42)
+
         T = TypeVar('T')
 
         class PG(Protocol[T]): pass
@@ -766,6 +959,8 @@
         class CG(PG[T]): pass
 
         self.assertIsInstance(CG[int](), CG)
+        with self.assertRaises(TypeError):
+            CG[int](42)
 
     def test_cannot_instantiate_abstract(self):
         @runtime_checkable
@@ -1142,10 +1337,6 @@
             PR[int]
         with self.assertRaises(TypeError):
             P[int, str]
-        with self.assertRaises(TypeError):
-            PR[int, 1]
-        with self.assertRaises(TypeError):
-            PR[int, ClassVar]
 
         class C(PR[int, T]): pass
 
@@ -1167,8 +1358,6 @@
         self.assertIsSubclass(P, PR)
         with self.assertRaises(TypeError):
             PR[int]
-        with self.assertRaises(TypeError):
-            PR[int, 1]
 
         class P1(Protocol, Generic[T]):
             def bar(self, x: T) -> str: ...
@@ -1187,8 +1376,6 @@
                 return x
 
         self.assertIsInstance(Test(), PSub)
-        with self.assertRaises(TypeError):
-            PR[int, ClassVar]
 
     def test_init_called(self):
         T = TypeVar('T')
@@ -1201,6 +1388,37 @@
 
         self.assertEqual(C[int]().test, 'OK')
 
+        class B:
+            def __init__(self):
+                self.test = 'OK'
+
+        class D1(B, P[T]):
+            pass
+
+        self.assertEqual(D1[int]().test, 'OK')
+
+        class D2(P[T], B):
+            pass
+
+        self.assertEqual(D2[int]().test, 'OK')
+
+    def test_new_called(self):
+        T = TypeVar('T')
+
+        class P(Protocol[T]): pass
+
+        class C(P[T]):
+            def __new__(cls, *args):
+                self = super().__new__(cls, *args)
+                self.test = 'OK'
+                return self
+
+        self.assertEqual(C[int]().test, 'OK')
+        with self.assertRaises(TypeError):
+            C[int](42)
+        with self.assertRaises(TypeError):
+            C[int](a=42)
+
     def test_protocols_bad_subscripts(self):
         T = TypeVar('T')
         S = TypeVar('S')
@@ -1422,7 +1640,7 @@
         self.assertIsSubclass(B, Custom)
         self.assertNotIsSubclass(A, Custom)
 
-    def test_builtin_protocol_whitelist(self):
+    def test_builtin_protocol_allowlist(self):
         with self.assertRaises(TypeError):
             class CustomProtocol(TestCase, Protocol):
                 pass
@@ -1430,6 +1648,24 @@
         class CustomContextManager(typing.ContextManager, Protocol):
             pass
 
+    def test_non_runtime_protocol_isinstance_check(self):
+        class P(Protocol):
+            x: int
+
+        with self.assertRaisesRegex(TypeError, "@runtime_checkable"):
+            isinstance(1, P)
+
+    def test_super_call_init(self):
+        class P(Protocol):
+            x: int
+
+        class Foo(P):
+            def __init__(self):
+                super().__init__()
+
+        Foo()  # Previously triggered RecursionError
+
+
 class GenericTests(BaseTestCase):
 
     def test_basics(self):
@@ -1448,6 +1684,8 @@
         with self.assertRaises(TypeError):
             issubclass(SM1, SimpleMapping)
         self.assertIsInstance(SM1(), SimpleMapping)
+        T = TypeVar("T")
+        self.assertEqual(List[list[T] | float].__parameters__, (T,))
 
     def test_generic_errors(self):
         T = TypeVar('T')
@@ -1758,8 +1996,6 @@
         self.assertEqual(typing.Iterable[Tuple[T, T]][T], typing.Iterable[Tuple[T, T]])
         with self.assertRaises(TypeError):
             Tuple[T, int][()]
-        with self.assertRaises(TypeError):
-            Tuple[T, U][T, ...]
 
         self.assertEqual(Union[T, int][int], int)
         self.assertEqual(Union[T, U][int, Union[int, str]], Union[int, str])
@@ -1771,10 +2007,6 @@
 
         self.assertEqual(Callable[[T], T][KT], Callable[[KT], KT])
         self.assertEqual(Callable[..., List[T]][int], Callable[..., List[int]])
-        with self.assertRaises(TypeError):
-            Callable[[T], U][..., int]
-        with self.assertRaises(TypeError):
-            Callable[[T], U][[], int]
 
     def test_extended_generic_rules_repr(self):
         T = TypeVar('T')
@@ -1790,6 +2022,7 @@
     def test_generic_forward_ref(self):
         def foobar(x: List[List['CC']]): ...
         def foobar2(x: list[list[ForwardRef('CC')]]): ...
+        def foobar3(x: list[ForwardRef('CC | int')] | int): ...
         class CC: ...
         self.assertEqual(
             get_type_hints(foobar, globals(), locals()),
@@ -1799,6 +2032,10 @@
             get_type_hints(foobar2, globals(), locals()),
             {'x': list[list[CC]]}
         )
+        self.assertEqual(
+            get_type_hints(foobar3, globals(), locals()),
+            {'x': list[CC | int] | int}
+        )
 
         T = TypeVar('T')
         AT = Tuple[T, ...]
@@ -1811,10 +2048,9 @@
     def test_extended_generic_rules_subclassing(self):
         class T1(Tuple[T, KT]): ...
         class T2(Tuple[T, ...]): ...
-        class C1(Callable[[T], T]): ...
-        class C2(Callable[..., int]):
-            def __call__(self):
-                return None
+        class C1(typing.Container[T]):
+            def __contains__(self, item):
+                return False
 
         self.assertEqual(T1.__parameters__, (T, KT))
         self.assertEqual(T1[int, str].__args__, (int, str))
@@ -1828,10 +2064,9 @@
         ##     T2[int, str]
 
         self.assertEqual(repr(C1[int]).split('.')[-1], 'C1[int]')
-        self.assertEqual(C2.__parameters__, ())
-        self.assertIsInstance(C2(), collections.abc.Callable)
-        self.assertIsSubclass(C2, collections.abc.Callable)
-        self.assertIsSubclass(C1, collections.abc.Callable)
+        self.assertEqual(C1.__parameters__, (T,))
+        self.assertIsInstance(C1(), collections.abc.Container)
+        self.assertIsSubclass(C1, collections.abc.Container)
         self.assertIsInstance(T1(), tuple)
         self.assertIsSubclass(T2, tuple)
         with self.assertRaises(TypeError):
@@ -1865,10 +2100,6 @@
         class MyTup(Tuple[T, T]): ...
         self.assertIs(MyTup[int]().__class__, MyTup)
         self.assertEqual(MyTup[int]().__orig_class__, MyTup[int])
-        class MyCall(Callable[..., T]):
-            def __call__(self): return None
-        self.assertIs(MyCall[T]().__class__, MyCall)
-        self.assertEqual(MyCall[T]().__orig_class__, MyCall[T])
         class MyDict(typing.Dict[T, T]): ...
         self.assertIs(MyDict[int]().__class__, MyDict)
         self.assertEqual(MyDict[int]().__orig_class__, MyDict[int])
@@ -2248,6 +2479,22 @@
         self.assertEqual(c.from_b, 'b')
         self.assertEqual(c.from_c, 'c')
 
+    def test_subclass_special_form(self):
+        for obj in (
+            ClassVar[int],
+            Final[int],
+            Union[int, float],
+            Optional[int],
+            Literal[1, 2],
+            Concatenate[int, ParamSpec("P")],
+            TypeGuard[int],
+        ):
+            with self.subTest(msg=obj):
+                with self.assertRaisesRegex(
+                        TypeError, f'^{re.escape(f"Cannot subclass {obj!r}")}$'
+                ):
+                    class Foo(obj):
+                        pass
 
 class ClassVarTests(BaseTestCase):
 
@@ -2288,7 +2535,6 @@
         with self.assertRaises(TypeError):
             issubclass(int, ClassVar)
 
-
 class FinalTests(BaseTestCase):
 
     def test_basics(self):
@@ -2404,10 +2650,18 @@
         with self.assertRaises(TypeError):
             issubclass(int, fr)
 
+    def test_forwardref_only_str_arg(self):
+        with self.assertRaises(TypeError):
+            typing.ForwardRef(1)  # only `str` type is allowed
+
     def test_forward_equality(self):
         fr = typing.ForwardRef('int')
         self.assertEqual(fr, typing.ForwardRef('int'))
         self.assertNotEqual(List['int'], List[int])
+        self.assertNotEqual(fr, typing.ForwardRef('int', module=__name__))
+        frm = typing.ForwardRef('int', module=__name__)
+        self.assertEqual(frm, typing.ForwardRef('int', module=__name__))
+        self.assertNotEqual(frm, typing.ForwardRef('int', module='__other_name__'))
 
     def test_forward_equality_gth(self):
         c1 = typing.ForwardRef('C')
@@ -2444,6 +2698,14 @@
         self.assertEqual(hash(c1_gth), hash(c2_gth))
         self.assertEqual(hash(c1), hash(c1_gth))
 
+        c3 = typing.ForwardRef('int', module=__name__)
+        c4 = typing.ForwardRef('int', module='__other_name__')
+
+        self.assertNotEqual(hash(c3), hash(c1))
+        self.assertNotEqual(hash(c3), hash(c1_gth))
+        self.assertNotEqual(hash(c3), hash(c4))
+        self.assertEqual(hash(c3), hash(typing.ForwardRef('int', module=__name__)))
+
     def test_forward_equality_namespace(self):
         class A:
             pass
@@ -2479,6 +2741,12 @@
         self.assertEqual(get_type_hints(foo, globals(), locals()),
                          {'a': Union[T]})
 
+        def foo(a: tuple[ForwardRef('T')] | int):
+            pass
+
+        self.assertEqual(get_type_hints(foo, globals(), locals()),
+                         {'a': tuple[T] | int})
+
     def test_tuple_forward(self):
 
         def foo(a: Tuple['T']):
@@ -2572,6 +2840,20 @@
         self.assertEqual(get_type_hints(foo, globals(), locals()),
                          {'a': Callable[..., T]})
 
+    def test_special_forms_forward(self):
+
+        class C:
+            a: Annotated['ClassVar[int]', (3, 5)] = 4
+            b: Annotated['Final[int]', "const"] = 4
+
+        class CF:
+            b: List['Final[int]'] = 4
+
+        self.assertEqual(get_type_hints(C, globals())['a'], ClassVar[int])
+        self.assertEqual(get_type_hints(C, globals())['b'], Final[int])
+        with self.assertRaises(TypeError):
+            get_type_hints(CF, globals()),
+
     def test_syntax_error(self):
 
         with self.assertRaises(SyntaxError):
@@ -2768,7 +3050,7 @@
 
 # Definitions needed for features introduced in Python 3.6
 
-from test import ann_module, ann_module2, ann_module3
+from test import ann_module, ann_module2, ann_module3, ann_module5, ann_module6
 from typing import AsyncContextManager
 
 class A:
@@ -2816,6 +3098,9 @@
     x: int
     y: int
 
+class Bar(_typed_dict_helper.Foo, total=False):
+    b: int
+
 class LabelPoint2D(Point2D, Label): ...
 
 class Options(TypedDict, total=False):
@@ -2860,7 +3145,7 @@
             gth(None)
 
     def test_get_type_hints_modules(self):
-        ann_module_type_hints = {1: 2, 'f': Tuple[int, int], 'x': int, 'y': str}
+        ann_module_type_hints = {1: 2, 'f': Tuple[int, int], 'x': int, 'y': str, 'u': int | float}
         self.assertEqual(gth(ann_module), ann_module_type_hints)
         self.assertEqual(gth(ann_module2), {})
         self.assertEqual(gth(ann_module3), {})
@@ -2898,6 +3183,12 @@
                           'my_inner_a2': mod_generics_cache.B.A,
                           'my_outer_a': mod_generics_cache.A})
 
+    def test_get_type_hints_classes_no_implicit_optional(self):
+        class WithNoneDefault:
+            field: int = None  # most type-checkers won't be happy with it
+
+        self.assertEqual(gth(WithNoneDefault), {'field': int})
+
     def test_respect_no_type_check(self):
         @no_type_check
         class NoTpCheck:
@@ -3003,6 +3294,25 @@
             get_type_hints(barfoo3, globals(), locals(), include_extras=True)["x"],
             BA2
         )
+        BA3 = typing.Annotated[int | float, "const"]
+        def barfoo4(x: BA3): ...
+        self.assertEqual(
+            get_type_hints(barfoo4, globals(), locals()),
+            {"x": int | float}
+        )
+        self.assertEqual(
+            get_type_hints(barfoo4, globals(), locals(), include_extras=True),
+            {"x": typing.Annotated[int | float, "const"]}
+        )
+
+    def test_get_type_hints_annotated_in_union(self):  # bpo-46603
+        def with_union(x: int | list[Annotated[str, 'meta']]): ...
+
+        self.assertEqual(get_type_hints(with_union), {'x': int | list[str]})
+        self.assertEqual(
+            get_type_hints(with_union, include_extras=True),
+            {'x': int | list[Annotated[str, 'meta']]},
+        )
 
     def test_get_type_hints_annotated_refs(self):
 
@@ -3031,10 +3341,36 @@
             {'other': MySet[T], 'return': MySet[T]}
         )
 
+    def test_get_type_hints_classes_str_annotations(self):
+        class Foo:
+            y = str
+            x: 'y'
+        # This previously raised an error under PEP 563.
+        self.assertEqual(get_type_hints(Foo), {'x': str})
+
+    def test_get_type_hints_bad_module(self):
+        # bpo-41515
+        class BadModule:
+            pass
+        BadModule.__module__ = 'bad' # Something not in sys.modules
+        self.assertNotIn('bad', sys.modules)
+        self.assertEqual(get_type_hints(BadModule), {})
+
+    def test_get_type_hints_annotated_bad_module(self):
+        # See https://bugs.python.org/issue44468
+        class BadBase:
+            foo: tuple
+        class BadType(BadBase):
+            bar: list
+        BadType.__module__ = BadBase.__module__ = 'bad'
+        self.assertNotIn('bad', sys.modules)
+        self.assertEqual(get_type_hints(BadType), {'foo': tuple, 'bar': list})
+
 
 class GetUtilitiesTestCase(TestCase):
     def test_get_origin(self):
         T = TypeVar('T')
+        P = ParamSpec('P')
         class C(Generic[T]): pass
         self.assertIs(get_origin(C[int]), C)
         self.assertIs(get_origin(C[T]), C)
@@ -3052,6 +3388,9 @@
         self.assertIs(get_origin(Callable), collections.abc.Callable)
         self.assertIs(get_origin(list[int]), list)
         self.assertIs(get_origin(list), None)
+        self.assertIs(get_origin(list | str), types.UnionType)
+        self.assertIs(get_origin(P.args), P)
+        self.assertIs(get_origin(P.kwargs), P)
 
     def test_get_args(self):
         T = TypeVar('T')
@@ -3079,6 +3418,32 @@
         self.assertEqual(get_args(Callable), ())
         self.assertEqual(get_args(list[int]), (int,))
         self.assertEqual(get_args(list), ())
+        self.assertEqual(get_args(collections.abc.Callable[[int], str]), ([int], str))
+        self.assertEqual(get_args(collections.abc.Callable[..., str]), (..., str))
+        self.assertEqual(get_args(collections.abc.Callable[[], str]), ([], str))
+        self.assertEqual(get_args(collections.abc.Callable[[int], str]),
+                         get_args(Callable[[int], str]))
+        P = ParamSpec('P')
+        self.assertEqual(get_args(Callable[P, int]), (P, int))
+        self.assertEqual(get_args(Callable[Concatenate[int, P], int]),
+                         (Concatenate[int, P], int))
+        self.assertEqual(get_args(list | str), (list, str))
+
+    def test_forward_ref_and_final(self):
+        # https://bugs.python.org/issue45166
+        hints = get_type_hints(ann_module5)
+        self.assertEqual(hints, {'name': Final[str]})
+
+        hints = get_type_hints(ann_module5.MyClass)
+        self.assertEqual(hints, {'value': Final})
+
+    def test_top_level_class_var(self):
+        # https://bugs.python.org/issue45166
+        with self.assertRaisesRegex(
+            TypeError,
+            r'typing.ClassVar\[int\] is not valid as type argument',
+        ):
+            get_type_hints(ann_module6)
 
 
 class CollectionsAbcTests(BaseTestCase):
@@ -3158,11 +3523,10 @@
         self.assertNotIsInstance(42, typing.Container)
 
     def test_collection(self):
-        if hasattr(typing, 'Collection'):
-            self.assertIsInstance(tuple(), typing.Collection)
-            self.assertIsInstance(frozenset(), typing.Collection)
-            self.assertIsSubclass(dict, typing.Collection)
-            self.assertNotIsInstance(42, typing.Collection)
+        self.assertIsInstance(tuple(), typing.Collection)
+        self.assertIsInstance(frozenset(), typing.Collection)
+        self.assertIsSubclass(dict, typing.Collection)
+        self.assertNotIsInstance(42, typing.Collection)
 
     def test_abstractset(self):
         self.assertIsInstance(set(), typing.AbstractSet)
@@ -3557,6 +3921,10 @@
         A.register(B)
         self.assertIsSubclass(B, typing.Mapping)
 
+    def test_or_and_ror(self):
+        self.assertEqual(typing.Sized | typing.Awaitable, Union[typing.Sized, typing.Awaitable])
+        self.assertEqual(typing.Coroutine | typing.Hashable, Union[typing.Coroutine, typing.Hashable])
+
 
 class OtherABCTests(BaseTestCase):
 
@@ -3628,23 +3996,81 @@
 
 
 class NewTypeTests(BaseTestCase):
+    @classmethod
+    def setUpClass(cls):
+        global UserId
+        UserId = NewType('UserId', int)
+        cls.UserName = NewType(cls.__qualname__ + '.UserName', str)
+
+    @classmethod
+    def tearDownClass(cls):
+        global UserId
+        del UserId
+        del cls.UserName
+
+    def tearDown(self):
+        self.clear_caches()
 
     def test_basic(self):
-        UserId = NewType('UserId', int)
-        UserName = NewType('UserName', str)
         self.assertIsInstance(UserId(5), int)
-        self.assertIsInstance(UserName('Joe'), str)
+        self.assertIsInstance(self.UserName('Joe'), str)
         self.assertEqual(UserId(5) + 1, 6)
 
     def test_errors(self):
-        UserId = NewType('UserId', int)
-        UserName = NewType('UserName', str)
         with self.assertRaises(TypeError):
             issubclass(UserId, int)
         with self.assertRaises(TypeError):
-            class D(UserName):
+            class D(UserId):
                 pass
 
+    def test_or(self):
+        for cls in (int, self.UserName):
+            with self.subTest(cls=cls):
+                self.assertEqual(UserId | cls, Union[UserId, cls])
+                self.assertEqual(cls | UserId, Union[cls, UserId])
+
+                self.assertEqual(get_args(UserId | cls), (UserId, cls))
+                self.assertEqual(get_args(cls | UserId), (cls, UserId))
+
+    def test_special_attrs(self):
+        self.assertEqual(UserId.__name__, 'UserId')
+        self.assertEqual(UserId.__qualname__, 'UserId')
+        self.assertEqual(UserId.__module__, __name__)
+        self.assertEqual(UserId.__supertype__, int)
+
+        UserName = self.UserName
+        self.assertEqual(UserName.__name__, 'UserName')
+        self.assertEqual(UserName.__qualname__,
+                         self.__class__.__qualname__ + '.UserName')
+        self.assertEqual(UserName.__module__, __name__)
+        self.assertEqual(UserName.__supertype__, str)
+
+    def test_repr(self):
+        self.assertEqual(repr(UserId), f'{__name__}.UserId')
+        self.assertEqual(repr(self.UserName),
+                         f'{__name__}.{self.__class__.__qualname__}.UserName')
+
+    def test_pickle(self):
+        UserAge = NewType('UserAge', float)
+        for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+            with self.subTest(proto=proto):
+                pickled = pickle.dumps(UserId, proto)
+                loaded = pickle.loads(pickled)
+                self.assertIs(loaded, UserId)
+
+                pickled = pickle.dumps(self.UserName, proto)
+                loaded = pickle.loads(pickled)
+                self.assertIs(loaded, self.UserName)
+
+                with self.assertRaises(pickle.PicklingError):
+                    pickle.dumps(UserAge, proto)
+
+    def test_missing__name__(self):
+        code = ("import typing\n"
+                "NT = typing.NewType('NT', int)\n"
+                )
+        exec(code, {})
+
 
 class NamedTupleTests(BaseTestCase):
     class NestedEmployee(NamedTuple):
@@ -3754,6 +4180,19 @@
         self.assertEqual(a.typename, 'foo')
         self.assertEqual(a.fields, [('bar', tuple)])
 
+    def test_empty_namedtuple(self):
+        NT = NamedTuple('NT')
+
+        class CNT(NamedTuple):
+            pass  # empty body
+
+        for struct in [NT, CNT]:
+            with self.subTest(struct=struct):
+                self.assertEqual(struct._fields, ())
+                self.assertEqual(struct._field_defaults, {})
+                self.assertEqual(struct.__annotations__, {})
+                self.assertIsInstance(struct(), struct)
+
     def test_namedtuple_errors(self):
         with self.assertRaises(TypeError):
             NamedTuple.__new__()
@@ -3899,10 +4338,14 @@
         self.assertEqual(D(), {})
         self.assertEqual(D(x=1), {'x': 1})
         self.assertEqual(D.__total__, False)
+        self.assertEqual(D.__required_keys__, frozenset())
+        self.assertEqual(D.__optional_keys__, {'x'})
 
         self.assertEqual(Options(), {})
         self.assertEqual(Options(log_level=2), {'log_level': 2})
         self.assertEqual(Options.__total__, False)
+        self.assertEqual(Options.__required_keys__, frozenset())
+        self.assertEqual(Options.__optional_keys__, {'log_level', 'log_path'})
 
     def test_optional_keys(self):
         class Point2Dor3D(Point2D, total=False):
@@ -3943,6 +4386,105 @@
             'voice': str,
         }
 
+    def test_multiple_inheritance(self):
+        class One(TypedDict):
+            one: int
+        class Two(TypedDict):
+            two: str
+        class Untotal(TypedDict, total=False):
+            untotal: str
+        Inline = TypedDict('Inline', {'inline': bool})
+        class Regular:
+            pass
+
+        class Child(One, Two):
+            child: bool
+        self.assertEqual(
+            Child.__required_keys__,
+            frozenset(['one', 'two', 'child']),
+        )
+        self.assertEqual(
+            Child.__optional_keys__,
+            frozenset([]),
+        )
+        self.assertEqual(
+            Child.__annotations__,
+            {'one': int, 'two': str, 'child': bool},
+        )
+
+        class ChildWithOptional(One, Untotal):
+            child: bool
+        self.assertEqual(
+            ChildWithOptional.__required_keys__,
+            frozenset(['one', 'child']),
+        )
+        self.assertEqual(
+            ChildWithOptional.__optional_keys__,
+            frozenset(['untotal']),
+        )
+        self.assertEqual(
+            ChildWithOptional.__annotations__,
+            {'one': int, 'untotal': str, 'child': bool},
+        )
+
+        class ChildWithTotalFalse(One, Untotal, total=False):
+            child: bool
+        self.assertEqual(
+            ChildWithTotalFalse.__required_keys__,
+            frozenset(['one']),
+        )
+        self.assertEqual(
+            ChildWithTotalFalse.__optional_keys__,
+            frozenset(['untotal', 'child']),
+        )
+        self.assertEqual(
+            ChildWithTotalFalse.__annotations__,
+            {'one': int, 'untotal': str, 'child': bool},
+        )
+
+        class ChildWithInlineAndOptional(Untotal, Inline):
+            child: bool
+        self.assertEqual(
+            ChildWithInlineAndOptional.__required_keys__,
+            frozenset(['inline', 'child']),
+        )
+        self.assertEqual(
+            ChildWithInlineAndOptional.__optional_keys__,
+            frozenset(['untotal']),
+        )
+        self.assertEqual(
+            ChildWithInlineAndOptional.__annotations__,
+            {'inline': bool, 'untotal': str, 'child': bool},
+        )
+
+        wrong_bases = [
+            (One, Regular),
+            (Regular, One),
+            (One, Two, Regular),
+            (Inline, Regular),
+            (Untotal, Regular),
+        ]
+        for bases in wrong_bases:
+            with self.subTest(bases=bases):
+                with self.assertRaisesRegex(
+                    TypeError,
+                    'cannot inherit from both a TypedDict type and a non-TypedDict',
+                ):
+                    class Wrong(*bases):
+                        pass
+
+    def test_is_typeddict(self):
+        assert is_typeddict(Point2D) is True
+        assert is_typeddict(Union[str, int]) is False
+        # classes, not instances
+        assert is_typeddict(Point2D()) is False
+
+    def test_get_type_hints(self):
+        self.assertEqual(
+            get_type_hints(Bar),
+            {'a': typing.Optional[int], 'b': int}
+        )
+
 
 class IOTests(BaseTestCase):
 
@@ -4041,6 +4583,13 @@
 
 class AnnotatedTests(BaseTestCase):
 
+    def test_new(self):
+        with self.assertRaisesRegex(
+            TypeError,
+            'Type Annotated cannot be instantiated',
+        ):
+            Annotated()
+
     def test_repr(self):
         self.assertEqual(
             repr(Annotated[int, 4, 5]),
@@ -4125,6 +4674,14 @@
         A.x = 5
         self.assertEqual(C.x, 5)
 
+    def test_special_form_containment(self):
+        class C:
+            classvar: Annotated[ClassVar[int], "a decoration"] = 4
+            const: Annotated[Final[int], "Const"] = 4
+
+        self.assertEqual(get_type_hints(C, globals())['classvar'], ClassVar[int])
+        self.assertEqual(get_type_hints(C, globals())['const'], Final[int])
+
     def test_hash_eq(self):
         self.assertEqual(len({Annotated[int, 4, 5], Annotated[int, 4, 5]}), 1)
         self.assertNotEqual(Annotated[int, 4, 5], Annotated[int, 5, 4])
@@ -4148,6 +4705,10 @@
         with self.assertRaises(TypeError):
             issubclass(int, Annotated[int, "positive"])
 
+    def test_too_few_type_args(self):
+        with self.assertRaisesRegex(TypeError, 'at least two arguments'):
+            Annotated[int]
+
     def test_pickle(self):
         samples = [typing.Any, typing.Union[int, str],
                    typing.Optional[str], Tuple[int, ...],
@@ -4211,6 +4772,523 @@
         X = List[Annotated[T, 5]]
         self.assertEqual(X[int], List[Annotated[int, 5]])
 
+    def test_annotated_mro(self):
+        class X(Annotated[int, (1, 10)]): ...
+        self.assertEqual(X.__mro__, (X, int, object),
+                         "Annotated should be transparent.")
+
+
+class TypeAliasTests(BaseTestCase):
+    def test_canonical_usage_with_variable_annotation(self):
+        Alias: TypeAlias = Employee
+
+    def test_canonical_usage_with_type_comment(self):
+        Alias = Employee  # type: TypeAlias
+
+    def test_cannot_instantiate(self):
+        with self.assertRaises(TypeError):
+            TypeAlias()
+
+    def test_no_isinstance(self):
+        with self.assertRaises(TypeError):
+            isinstance(42, TypeAlias)
+
+    def test_stringized_usage(self):
+        class A:
+            a: "TypeAlias"
+        self.assertEqual(get_type_hints(A), {'a': TypeAlias})
+
+    def test_no_issubclass(self):
+        with self.assertRaises(TypeError):
+            issubclass(Employee, TypeAlias)
+
+        with self.assertRaises(TypeError):
+            issubclass(TypeAlias, Employee)
+
+    def test_cannot_subclass(self):
+        with self.assertRaises(TypeError):
+            class C(TypeAlias):
+                pass
+
+        with self.assertRaises(TypeError):
+            class C(type(TypeAlias)):
+                pass
+
+    def test_repr(self):
+        self.assertEqual(repr(TypeAlias), 'typing.TypeAlias')
+
+    def test_cannot_subscript(self):
+        with self.assertRaises(TypeError):
+            TypeAlias[int]
+
+
+class ParamSpecTests(BaseTestCase):
+
+    def test_basic_plain(self):
+        P = ParamSpec('P')
+        self.assertEqual(P, P)
+        self.assertIsInstance(P, ParamSpec)
+
+    def test_valid_uses(self):
+        P = ParamSpec('P')
+        T = TypeVar('T')
+        C1 = Callable[P, int]
+        self.assertEqual(C1.__args__, (P, int))
+        self.assertEqual(C1.__parameters__, (P,))
+        C2 = Callable[P, T]
+        self.assertEqual(C2.__args__, (P, T))
+        self.assertEqual(C2.__parameters__, (P, T))
+        # Test collections.abc.Callable too.
+        C3 = collections.abc.Callable[P, int]
+        self.assertEqual(C3.__args__, (P, int))
+        self.assertEqual(C3.__parameters__, (P,))
+        C4 = collections.abc.Callable[P, T]
+        self.assertEqual(C4.__args__, (P, T))
+        self.assertEqual(C4.__parameters__, (P, T))
+
+    def test_args_kwargs(self):
+        P = ParamSpec('P')
+        P_2 = ParamSpec('P_2')
+        self.assertIn('args', dir(P))
+        self.assertIn('kwargs', dir(P))
+        self.assertIsInstance(P.args, ParamSpecArgs)
+        self.assertIsInstance(P.kwargs, ParamSpecKwargs)
+        self.assertIs(P.args.__origin__, P)
+        self.assertIs(P.kwargs.__origin__, P)
+        self.assertEqual(P.args, P.args)
+        self.assertEqual(P.kwargs, P.kwargs)
+        self.assertNotEqual(P.args, P_2.args)
+        self.assertNotEqual(P.kwargs, P_2.kwargs)
+        self.assertNotEqual(P.args, P.kwargs)
+        self.assertNotEqual(P.kwargs, P.args)
+        self.assertNotEqual(P.args, P_2.kwargs)
+        self.assertEqual(repr(P.args), "P.args")
+        self.assertEqual(repr(P.kwargs), "P.kwargs")
+
+    def test_stringized(self):
+        P = ParamSpec('P')
+        class C(Generic[P]):
+            func: Callable["P", int]
+            def foo(self, *args: "P.args", **kwargs: "P.kwargs"):
+                pass
+
+        self.assertEqual(gth(C, globals(), locals()), {"func": Callable[P, int]})
+        self.assertEqual(
+            gth(C.foo, globals(), locals()), {"args": P.args, "kwargs": P.kwargs}
+        )
+
+    def test_user_generics(self):
+        T = TypeVar("T")
+        P = ParamSpec("P")
+        P_2 = ParamSpec("P_2")
+
+        class X(Generic[T, P]):
+            f: Callable[P, int]
+            x: T
+        G1 = X[int, P_2]
+        self.assertEqual(G1.__args__, (int, P_2))
+        self.assertEqual(G1.__parameters__, (P_2,))
+        with self.assertRaisesRegex(TypeError, "few arguments for"):
+            X[int]
+        with self.assertRaisesRegex(TypeError, "many arguments for"):
+            X[int, P_2, str]
+
+        G2 = X[int, Concatenate[int, P_2]]
+        self.assertEqual(G2.__args__, (int, Concatenate[int, P_2]))
+        self.assertEqual(G2.__parameters__, (P_2,))
+
+        G3 = X[int, [int, bool]]
+        self.assertEqual(G3.__args__, (int, (int, bool)))
+        self.assertEqual(G3.__parameters__, ())
+
+        G4 = X[int, ...]
+        self.assertEqual(G4.__args__, (int, Ellipsis))
+        self.assertEqual(G4.__parameters__, ())
+
+        class Z(Generic[P]):
+            f: Callable[P, int]
+
+        G5 = Z[[int, str, bool]]
+        self.assertEqual(G5.__args__, ((int, str, bool),))
+        self.assertEqual(G5.__parameters__, ())
+
+        G6 = Z[int, str, bool]
+        self.assertEqual(G6.__args__, ((int, str, bool),))
+        self.assertEqual(G6.__parameters__, ())
+
+        # G5 and G6 should be equivalent according to the PEP
+        self.assertEqual(G5.__args__, G6.__args__)
+        self.assertEqual(G5.__origin__, G6.__origin__)
+        self.assertEqual(G5.__parameters__, G6.__parameters__)
+        self.assertEqual(G5, G6)
+
+        G7 = Z[int]
+        self.assertEqual(G7.__args__, ((int,),))
+        self.assertEqual(G7.__parameters__, ())
+
+        with self.assertRaisesRegex(TypeError, "many arguments for"):
+            Z[[int, str], bool]
+        with self.assertRaisesRegex(TypeError, "many arguments for"):
+            Z[P_2, bool]
+
+    def test_multiple_paramspecs_in_user_generics(self):
+        P = ParamSpec("P")
+        P2 = ParamSpec("P2")
+
+        class X(Generic[P, P2]):
+            f: Callable[P, int]
+            g: Callable[P2, str]
+
+        G1 = X[[int, str], [bytes]]
+        G2 = X[[int], [str, bytes]]
+        self.assertNotEqual(G1, G2)
+        self.assertEqual(G1.__args__, ((int, str), (bytes,)))
+        self.assertEqual(G2.__args__, ((int,), (str, bytes)))
+
+    def test_bad_var_substitution(self):
+        T = TypeVar('T')
+        P = ParamSpec('P')
+        bad_args = (42, int, None, T, int|str, Union[int, str])
+        for arg in bad_args:
+            with self.subTest(arg=arg):
+                with self.assertRaises(TypeError):
+                    typing.Callable[P, T][arg, str]
+                with self.assertRaises(TypeError):
+                    collections.abc.Callable[P, T][arg, str]
+
+    def test_no_paramspec_in__parameters__(self):
+        # ParamSpec should not be found in __parameters__
+        # of generics. Usages outside Callable, Concatenate
+        # and Generic are invalid.
+        T = TypeVar("T")
+        P = ParamSpec("P")
+        self.assertNotIn(P, List[P].__parameters__)
+        self.assertIn(T, Tuple[T, P].__parameters__)
+
+        # Test for consistency with builtin generics.
+        self.assertNotIn(P, list[P].__parameters__)
+        self.assertIn(T, tuple[T, P].__parameters__)
+
+        self.assertNotIn(P, (list[P] | int).__parameters__)
+        self.assertIn(T, (tuple[T, P] | int).__parameters__)
+
+    def test_paramspec_in_nested_generics(self):
+        # Although ParamSpec should not be found in __parameters__ of most
+        # generics, they probably should be found when nested in
+        # a valid location.
+        T = TypeVar("T")
+        P = ParamSpec("P")
+        C1 = Callable[P, T]
+        G1 = List[C1]
+        G2 = list[C1]
+        G3 = list[C1] | int
+        self.assertEqual(G1.__parameters__, (P, T))
+        self.assertEqual(G2.__parameters__, (P, T))
+        self.assertEqual(G3.__parameters__, (P, T))
+        C = Callable[[int, str], float]
+        self.assertEqual(G1[[int, str], float], List[C])
+        self.assertEqual(G2[[int, str], float], list[C])
+        self.assertEqual(G3[[int, str], float], list[C] | int)
+
+    def test_paramspec_gets_copied(self):
+        # bpo-46581
+        P = ParamSpec('P')
+        P2 = ParamSpec('P2')
+        C1 = Callable[P, int]
+        self.assertEqual(C1.__parameters__, (P,))
+        self.assertEqual(C1[P2].__parameters__, (P2,))
+        self.assertEqual(C1[str].__parameters__, ())
+        self.assertEqual(C1[str, T].__parameters__, (T,))
+        self.assertEqual(C1[Concatenate[str, P2]].__parameters__, (P2,))
+        self.assertEqual(C1[Concatenate[T, P2]].__parameters__, (T, P2))
+        self.assertEqual(C1[...].__parameters__, ())
+
+        C2 = Callable[Concatenate[str, P], int]
+        self.assertEqual(C2.__parameters__, (P,))
+        self.assertEqual(C2[P2].__parameters__, (P2,))
+        self.assertEqual(C2[str].__parameters__, ())
+        self.assertEqual(C2[str, T].__parameters__, (T,))
+        self.assertEqual(C2[Concatenate[str, P2]].__parameters__, (P2,))
+        self.assertEqual(C2[Concatenate[T, P2]].__parameters__, (T, P2))
+
+
+class ConcatenateTests(BaseTestCase):
+    def test_basics(self):
+        P = ParamSpec('P')
+        class MyClass: ...
+        c = Concatenate[MyClass, P]
+        self.assertNotEqual(c, Concatenate)
+
+    def test_valid_uses(self):
+        P = ParamSpec('P')
+        T = TypeVar('T')
+        C1 = Callable[Concatenate[int, P], int]
+        self.assertEqual(C1.__args__, (Concatenate[int, P], int))
+        self.assertEqual(C1.__parameters__, (P,))
+        C2 = Callable[Concatenate[int, T, P], T]
+        self.assertEqual(C2.__args__, (Concatenate[int, T, P], T))
+        self.assertEqual(C2.__parameters__, (T, P))
+
+        # Test collections.abc.Callable too.
+        C3 = collections.abc.Callable[Concatenate[int, P], int]
+        self.assertEqual(C3.__args__, (Concatenate[int, P], int))
+        self.assertEqual(C3.__parameters__, (P,))
+        C4 = collections.abc.Callable[Concatenate[int, T, P], T]
+        self.assertEqual(C4.__args__, (Concatenate[int, T, P], T))
+        self.assertEqual(C4.__parameters__, (T, P))
+
+    def test_var_substitution(self):
+        T = TypeVar('T')
+        P = ParamSpec('P')
+        P2 = ParamSpec('P2')
+        C = Concatenate[T, P]
+        self.assertEqual(C[int, P2], Concatenate[int, P2])
+        self.assertEqual(C[int, [str, float]], (int, str, float))
+        self.assertEqual(C[int, []], (int,))
+        self.assertEqual(C[int, Concatenate[str, P2]],
+                         Concatenate[int, str, P2])
+        with self.assertRaises(TypeError):
+            C[int, ...]
+
+        C = Concatenate[int, P]
+        self.assertEqual(C[P2], Concatenate[int, P2])
+        self.assertEqual(C[[str, float]], (int, str, float))
+        self.assertEqual(C[str, float], (int, str, float))
+        self.assertEqual(C[[]], (int,))
+        self.assertEqual(C[Concatenate[str, P2]], Concatenate[int, str, P2])
+        with self.assertRaises(TypeError):
+            C[...]
+
+class TypeGuardTests(BaseTestCase):
+    def test_basics(self):
+        TypeGuard[int]  # OK
+
+        def foo(arg) -> TypeGuard[int]: ...
+        self.assertEqual(gth(foo), {'return': TypeGuard[int]})
+
+    def test_repr(self):
+        self.assertEqual(repr(TypeGuard), 'typing.TypeGuard')
+        cv = TypeGuard[int]
+        self.assertEqual(repr(cv), 'typing.TypeGuard[int]')
+        cv = TypeGuard[Employee]
+        self.assertEqual(repr(cv), 'typing.TypeGuard[%s.Employee]' % __name__)
+        cv = TypeGuard[tuple[int]]
+        self.assertEqual(repr(cv), 'typing.TypeGuard[tuple[int]]')
+
+    def test_cannot_subclass(self):
+        with self.assertRaises(TypeError):
+            class C(type(TypeGuard)):
+                pass
+        with self.assertRaises(TypeError):
+            class C(type(TypeGuard[int])):
+                pass
+
+    def test_cannot_init(self):
+        with self.assertRaises(TypeError):
+            TypeGuard()
+        with self.assertRaises(TypeError):
+            type(TypeGuard)()
+        with self.assertRaises(TypeError):
+            type(TypeGuard[Optional[int]])()
+
+    def test_no_isinstance(self):
+        with self.assertRaises(TypeError):
+            isinstance(1, TypeGuard[int])
+        with self.assertRaises(TypeError):
+            issubclass(int, TypeGuard)
+
+
+SpecialAttrsP = typing.ParamSpec('SpecialAttrsP')
+SpecialAttrsT = typing.TypeVar('SpecialAttrsT', int, float, complex)
+
+
+class SpecialAttrsTests(BaseTestCase):
+
+    def test_special_attrs(self):
+        cls_to_check = {
+            # ABC classes
+            typing.AbstractSet: 'AbstractSet',
+            typing.AsyncContextManager: 'AsyncContextManager',
+            typing.AsyncGenerator: 'AsyncGenerator',
+            typing.AsyncIterable: 'AsyncIterable',
+            typing.AsyncIterator: 'AsyncIterator',
+            typing.Awaitable: 'Awaitable',
+            typing.ByteString: 'ByteString',
+            typing.Callable: 'Callable',
+            typing.ChainMap: 'ChainMap',
+            typing.Collection: 'Collection',
+            typing.Container: 'Container',
+            typing.ContextManager: 'ContextManager',
+            typing.Coroutine: 'Coroutine',
+            typing.Counter: 'Counter',
+            typing.DefaultDict: 'DefaultDict',
+            typing.Deque: 'Deque',
+            typing.Dict: 'Dict',
+            typing.FrozenSet: 'FrozenSet',
+            typing.Generator: 'Generator',
+            typing.Hashable: 'Hashable',
+            typing.ItemsView: 'ItemsView',
+            typing.Iterable: 'Iterable',
+            typing.Iterator: 'Iterator',
+            typing.KeysView: 'KeysView',
+            typing.List: 'List',
+            typing.Mapping: 'Mapping',
+            typing.MappingView: 'MappingView',
+            typing.MutableMapping: 'MutableMapping',
+            typing.MutableSequence: 'MutableSequence',
+            typing.MutableSet: 'MutableSet',
+            typing.OrderedDict: 'OrderedDict',
+            typing.Reversible: 'Reversible',
+            typing.Sequence: 'Sequence',
+            typing.Set: 'Set',
+            typing.Sized: 'Sized',
+            typing.Tuple: 'Tuple',
+            typing.Type: 'Type',
+            typing.ValuesView: 'ValuesView',
+            # Subscribed ABC classes
+            typing.AbstractSet[Any]: 'AbstractSet',
+            typing.AsyncContextManager[Any]: 'AsyncContextManager',
+            typing.AsyncGenerator[Any, Any]: 'AsyncGenerator',
+            typing.AsyncIterable[Any]: 'AsyncIterable',
+            typing.AsyncIterator[Any]: 'AsyncIterator',
+            typing.Awaitable[Any]: 'Awaitable',
+            typing.Callable[[], Any]: 'Callable',
+            typing.Callable[..., Any]: 'Callable',
+            typing.ChainMap[Any, Any]: 'ChainMap',
+            typing.Collection[Any]: 'Collection',
+            typing.Container[Any]: 'Container',
+            typing.ContextManager[Any]: 'ContextManager',
+            typing.Coroutine[Any, Any, Any]: 'Coroutine',
+            typing.Counter[Any]: 'Counter',
+            typing.DefaultDict[Any, Any]: 'DefaultDict',
+            typing.Deque[Any]: 'Deque',
+            typing.Dict[Any, Any]: 'Dict',
+            typing.FrozenSet[Any]: 'FrozenSet',
+            typing.Generator[Any, Any, Any]: 'Generator',
+            typing.ItemsView[Any, Any]: 'ItemsView',
+            typing.Iterable[Any]: 'Iterable',
+            typing.Iterator[Any]: 'Iterator',
+            typing.KeysView[Any]: 'KeysView',
+            typing.List[Any]: 'List',
+            typing.Mapping[Any, Any]: 'Mapping',
+            typing.MappingView[Any]: 'MappingView',
+            typing.MutableMapping[Any, Any]: 'MutableMapping',
+            typing.MutableSequence[Any]: 'MutableSequence',
+            typing.MutableSet[Any]: 'MutableSet',
+            typing.OrderedDict[Any, Any]: 'OrderedDict',
+            typing.Reversible[Any]: 'Reversible',
+            typing.Sequence[Any]: 'Sequence',
+            typing.Set[Any]: 'Set',
+            typing.Tuple[Any]: 'Tuple',
+            typing.Tuple[Any, ...]: 'Tuple',
+            typing.Type[Any]: 'Type',
+            typing.ValuesView[Any]: 'ValuesView',
+            # Special Forms
+            typing.Annotated: 'Annotated',
+            typing.Any: 'Any',
+            typing.ClassVar: 'ClassVar',
+            typing.Concatenate: 'Concatenate',
+            typing.Final: 'Final',
+            typing.ForwardRef: 'ForwardRef',
+            typing.Literal: 'Literal',
+            typing.NewType: 'NewType',
+            typing.NoReturn: 'NoReturn',
+            typing.Optional: 'Optional',
+            typing.TypeAlias: 'TypeAlias',
+            typing.TypeGuard: 'TypeGuard',
+            typing.TypeVar: 'TypeVar',
+            typing.Union: 'Union',
+            # Subscribed special forms
+            typing.Annotated[Any, "Annotation"]: 'Annotated',
+            typing.ClassVar[Any]: 'ClassVar',
+            typing.Concatenate[Any, SpecialAttrsP]: 'Concatenate',
+            typing.Final[Any]: 'Final',
+            typing.Literal[Any]: 'Literal',
+            typing.Literal[1, 2]: 'Literal',
+            typing.Literal[True, 2]: 'Literal',
+            typing.Optional[Any]: 'Optional',
+            typing.TypeGuard[Any]: 'TypeGuard',
+            typing.Union[Any]: 'Any',
+            typing.Union[int, float]: 'Union',
+            # Incompatible special forms (tested in test_special_attrs2)
+            # - typing.ForwardRef('set[Any]')
+            # - typing.NewType('TypeName', Any)
+            # - typing.ParamSpec('SpecialAttrsP')
+            # - typing.TypeVar('T')
+        }
+
+        for cls, name in cls_to_check.items():
+            with self.subTest(cls=cls):
+                self.assertEqual(cls.__name__, name, str(cls))
+                self.assertEqual(cls.__qualname__, name, str(cls))
+                self.assertEqual(cls.__module__, 'typing', str(cls))
+                for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+                    s = pickle.dumps(cls, proto)
+                    loaded = pickle.loads(s)
+                    self.assertIs(cls, loaded)
+
+    TypeName = typing.NewType('SpecialAttrsTests.TypeName', Any)
+
+    def test_special_attrs2(self):
+        # Forward refs provide a different introspection API. __name__ and
+        # __qualname__ make little sense for forward refs as they can store
+        # complex typing expressions.
+        fr = typing.ForwardRef('set[Any]')
+        self.assertFalse(hasattr(fr, '__name__'))
+        self.assertFalse(hasattr(fr, '__qualname__'))
+        self.assertEqual(fr.__module__, 'typing')
+        # Forward refs are currently unpicklable.
+        for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+            with self.assertRaises(TypeError) as exc:
+                pickle.dumps(fr, proto)
+
+        self.assertEqual(SpecialAttrsTests.TypeName.__name__, 'TypeName')
+        self.assertEqual(
+            SpecialAttrsTests.TypeName.__qualname__,
+            'SpecialAttrsTests.TypeName',
+        )
+        self.assertEqual(
+            SpecialAttrsTests.TypeName.__module__,
+            __name__,
+        )
+        # NewTypes are picklable assuming correct qualname information.
+        for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+            s = pickle.dumps(SpecialAttrsTests.TypeName, proto)
+            loaded = pickle.loads(s)
+            self.assertIs(SpecialAttrsTests.TypeName, loaded)
+
+        # Type variables don't support non-global instantiation per PEP 484
+        # restriction that "The argument to TypeVar() must be a string equal
+        # to the variable name to which it is assigned".  Thus, providing
+        # __qualname__ is unnecessary.
+        self.assertEqual(SpecialAttrsT.__name__, 'SpecialAttrsT')
+        self.assertFalse(hasattr(SpecialAttrsT, '__qualname__'))
+        self.assertEqual(SpecialAttrsT.__module__, __name__)
+        # Module-level type variables are picklable.
+        for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+            s = pickle.dumps(SpecialAttrsT, proto)
+            loaded = pickle.loads(s)
+            self.assertIs(SpecialAttrsT, loaded)
+
+        self.assertEqual(SpecialAttrsP.__name__, 'SpecialAttrsP')
+        self.assertFalse(hasattr(SpecialAttrsP, '__qualname__'))
+        self.assertEqual(SpecialAttrsP.__module__, __name__)
+        # Module-level ParamSpecs are picklable.
+        for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+            s = pickle.dumps(SpecialAttrsP, proto)
+            loaded = pickle.loads(s)
+            self.assertIs(SpecialAttrsP, loaded)
+
+    def test_genericalias_dir(self):
+        class Foo(Generic[T]):
+            def bar(self):
+                pass
+            baz = 3
+        # The class attributes of the original class should be visible even
+        # in dir() of the GenericAlias. See bpo-45755.
+        self.assertIn('bar', dir(Foo[int]))
+        self.assertIn('baz', dir(Foo[int]))
+
 
 class AllTests(BaseTestCase):
     """Tests for __all__."""
@@ -4222,8 +5300,9 @@
         self.assertIn('ValuesView', a)
         self.assertIn('cast', a)
         self.assertIn('overload', a)
-        if hasattr(contextlib, 'AbstractContextManager'):
-            self.assertIn('ContextManager', a)
+        # Context managers.
+        self.assertIn('ContextManager', a)
+        self.assertIn('AsyncContextManager', a)
         # Check that io and re are not exported.
         self.assertNotIn('io', a)
         self.assertNotIn('re', a)
@@ -4237,8 +5316,6 @@
         self.assertIn('SupportsComplex', a)
 
     def test_all_exported_names(self):
-        import typing
-
         actual_all = set(typing.__all__)
         computed_all = {
             k for k, v in vars(typing).items()
diff --git a/Lib/test/test_ucn.py b/Lib/test/test_ucn.py
index e95f911..cbfd5af 100644
--- a/Lib/test/test_ucn.py
+++ b/Lib/test/test_ucn.py
@@ -7,6 +7,7 @@
 
 """#"
 
+import ast
 import unittest
 import unicodedata
 
@@ -24,7 +25,7 @@
         # Helper that put all \N escapes inside eval'd raw strings,
         # to make sure this script runs even if the compiler
         # chokes on \N escapes
-        res = eval(r'"\N{%s}"' % name)
+        res = ast.literal_eval(r'"\N{%s}"' % name)
         self.assertEqual(res, code)
         return res
 
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py
index 23508c5..dd14287 100644
--- a/Lib/test/test_unicode.py
+++ b/Lib/test/test_unicode.py
@@ -15,6 +15,8 @@
 import unicodedata
 import unittest
 import warnings
+from test.support import import_helper
+from test.support import warnings_helper
 from test import support, string_tests
 from test.support.script_helper import assert_python_failure
 
@@ -34,7 +36,6 @@
         return (encode2, decode2, None, None)
     else:
         return None
-codecs.register(search_function)
 
 def duplicate_string(text):
     """
@@ -56,6 +57,10 @@
 
     type2test = str
 
+    def setUp(self):
+        codecs.register(search_function)
+        self.addCleanup(codecs.unregister, search_function)
+
     def checkequalnofix(self, result, object, methodname, *args):
         method = getattr(object, methodname)
         realresult = method(*args)
@@ -503,8 +508,30 @@
         text = 'abc def'
         self.assertIs(text.replace(pattern, pattern), text)
 
+    def test_repeat_id_preserving(self):
+        a = '123abc1@'
+        b = '456zyx-+'
+        self.assertEqual(id(a), id(a))
+        self.assertNotEqual(id(a), id(b))
+        self.assertNotEqual(id(a), id(a * -4))
+        self.assertNotEqual(id(a), id(a * 0))
+        self.assertEqual(id(a), id(a * 1))
+        self.assertEqual(id(a), id(1 * a))
+        self.assertNotEqual(id(a), id(a * 2))
+
+        class SubStr(str):
+            pass
+
+        s = SubStr('qwerty()')
+        self.assertEqual(id(s), id(s))
+        self.assertNotEqual(id(s), id(s * -4))
+        self.assertNotEqual(id(s), id(s * 0))
+        self.assertNotEqual(id(s), id(s * 1))
+        self.assertNotEqual(id(s), id(1 * s))
+        self.assertNotEqual(id(s), id(s * 2))
+
     def test_bytes_comparison(self):
-        with support.check_warnings():
+        with warnings_helper.check_warnings():
             warnings.simplefilter('ignore', BytesWarning)
             self.assertEqual('abc' == b'abc', False)
             self.assertEqual('abc' != b'abc', True)
@@ -721,11 +748,14 @@
         self.assertFalse("0".isidentifier())
 
     @support.cpython_only
+    @support.requires_legacy_unicode_capi
     def test_isidentifier_legacy(self):
         import _testcapi
         u = '𝖀𝖓𝖎𝖈𝖔𝖉𝖊'
         self.assertTrue(u.isidentifier())
-        self.assertTrue(_testcapi.unicode_legacy_string(u).isidentifier())
+        with warnings_helper.check_warnings():
+            warnings.simplefilter('ignore', DeprecationWarning)
+            self.assertTrue(_testcapi.unicode_legacy_string(u).isidentifier())
 
     def test_isprintable(self):
         self.assertTrue("".isprintable())
@@ -1090,6 +1120,12 @@
         self.assertEqual('{0:^8s}'.format('result'), ' result ')
         self.assertEqual('{0:^9s}'.format('result'), ' result  ')
         self.assertEqual('{0:^10s}'.format('result'), '  result  ')
+        self.assertEqual('{0:8s}'.format('result'), 'result  ')
+        self.assertEqual('{0:0s}'.format('result'), 'result')
+        self.assertEqual('{0:08s}'.format('result'), 'result00')
+        self.assertEqual('{0:<08s}'.format('result'), 'result00')
+        self.assertEqual('{0:>08s}'.format('result'), '00result')
+        self.assertEqual('{0:^08s}'.format('result'), '0result0')
         self.assertEqual('{0:10000}'.format('a'), 'a' + ' ' * 9999)
         self.assertEqual('{0:10000}'.format(''), ' ' * 10000)
         self.assertEqual('{0:10000000}'.format(''), ' ' * 10000000)
@@ -1217,8 +1253,11 @@
                           0, 1, 2, 3, 4, 5, 6, 7)
 
         # string format spec errors
-        self.assertRaises(ValueError, "{0:-s}".format, '')
-        self.assertRaises(ValueError, format, "", "-")
+        sign_msg = "Sign not allowed in string format specifier"
+        self.assertRaisesRegex(ValueError, sign_msg, "{0:-s}".format, '')
+        self.assertRaisesRegex(ValueError, sign_msg, format, "", "-")
+        space_msg = "Space not allowed in string format specifier"
+        self.assertRaisesRegex(ValueError, space_msg, "{: }".format, '')
         self.assertRaises(ValueError, "{0:=s}".format, '')
 
         # Alternate formatting is not supported
@@ -2215,22 +2254,6 @@
         self.assertEqual(("abc" "def" "ghi"), "abcdefghi")
         self.assertEqual(("abc" "def" "ghi"), "abcdefghi")
 
-    def test_printing(self):
-        class BitBucket:
-            def write(self, text):
-                pass
-
-        out = BitBucket()
-        print('abc', file=out)
-        print('abc', 'def', file=out)
-        print('abc', 'def', file=out)
-        print('abc', 'def', file=out)
-        print('abc\n', file=out)
-        print('abc\n', end=' ', file=out)
-        print('abc\n', end=' ', file=out)
-        print('def\n', file=out)
-        print('def\n', file=out)
-
     def test_ucs4(self):
         x = '\U00100000'
         y = x.encode("raw-unicode-escape").decode("raw-unicode-escape")
@@ -2362,6 +2385,7 @@
         self.assertEqual(len(args), 1)
 
     @support.cpython_only
+    @support.requires_legacy_unicode_capi
     def test_resize(self):
         from _testcapi import getargs_u
         for length in range(1, 100, 7):
@@ -2369,12 +2393,14 @@
             text = 'a' * length + 'b'
 
             # fill wstr internal field
-            abc = getargs_u(text)
+            with self.assertWarns(DeprecationWarning):
+                abc = getargs_u(text)
             self.assertEqual(abc, text)
 
             # resize text: wstr field must be cleared and then recomputed
             text += 'c'
-            abcdef = getargs_u(text)
+            with self.assertWarns(DeprecationWarning):
+                abcdef = getargs_u(text)
             self.assertNotEqual(abc, abcdef)
             self.assertEqual(abcdef, text)
 
@@ -2521,7 +2547,7 @@
 
     # Test PyUnicode_FromFormat()
     def test_from_format(self):
-        support.import_module('ctypes')
+        import_helper.import_module('ctypes')
         from ctypes import (
             c_char_p,
             pythonapi, py_object, sizeof,
@@ -2764,7 +2790,7 @@
     @support.cpython_only
     def test_aswidechar(self):
         from _testcapi import unicode_aswidechar
-        support.import_module('ctypes')
+        import_helper.import_module('ctypes')
         from ctypes import c_wchar, sizeof
 
         wchar, size = unicode_aswidechar('abcdef', 2)
@@ -2802,7 +2828,7 @@
     @support.cpython_only
     def test_aswidecharstring(self):
         from _testcapi import unicode_aswidecharstring
-        support.import_module('ctypes')
+        import_helper.import_module('ctypes')
         from ctypes import c_wchar, sizeof
 
         wchar, size = unicode_aswidecharstring('abc')
@@ -2934,32 +2960,38 @@
         self.assertRaises(SystemError, unicode_copycharacters, s, 0, b'', 0, 0)
 
     @support.cpython_only
+    @support.requires_legacy_unicode_capi
     def test_encode_decimal(self):
         from _testcapi import unicode_encodedecimal
-        self.assertEqual(unicode_encodedecimal('123'),
-                         b'123')
-        self.assertEqual(unicode_encodedecimal('\u0663.\u0661\u0664'),
-                         b'3.14')
-        self.assertEqual(unicode_encodedecimal("\N{EM SPACE}3.14\N{EN SPACE}"),
-                         b' 3.14 ')
-        self.assertRaises(UnicodeEncodeError,
-                          unicode_encodedecimal, "123\u20ac", "strict")
-        self.assertRaisesRegex(
-            ValueError,
-            "^'decimal' codec can't encode character",
-            unicode_encodedecimal, "123\u20ac", "replace")
+        with warnings_helper.check_warnings():
+            warnings.simplefilter('ignore', DeprecationWarning)
+            self.assertEqual(unicode_encodedecimal('123'),
+                             b'123')
+            self.assertEqual(unicode_encodedecimal('\u0663.\u0661\u0664'),
+                             b'3.14')
+            self.assertEqual(unicode_encodedecimal(
+                             "\N{EM SPACE}3.14\N{EN SPACE}"), b' 3.14 ')
+            self.assertRaises(UnicodeEncodeError,
+                              unicode_encodedecimal, "123\u20ac", "strict")
+            self.assertRaisesRegex(
+                ValueError,
+                "^'decimal' codec can't encode character",
+                unicode_encodedecimal, "123\u20ac", "replace")
 
     @support.cpython_only
+    @support.requires_legacy_unicode_capi
     def test_transform_decimal(self):
         from _testcapi import unicode_transformdecimaltoascii as transform_decimal
-        self.assertEqual(transform_decimal('123'),
-                         '123')
-        self.assertEqual(transform_decimal('\u0663.\u0661\u0664'),
-                         '3.14')
-        self.assertEqual(transform_decimal("\N{EM SPACE}3.14\N{EN SPACE}"),
-                         "\N{EM SPACE}3.14\N{EN SPACE}")
-        self.assertEqual(transform_decimal('123\u20ac'),
-                         '123\u20ac')
+        with warnings_helper.check_warnings():
+            warnings.simplefilter('ignore', DeprecationWarning)
+            self.assertEqual(transform_decimal('123'),
+                             '123')
+            self.assertEqual(transform_decimal('\u0663.\u0661\u0664'),
+                             '3.14')
+            self.assertEqual(transform_decimal("\N{EM SPACE}3.14\N{EN SPACE}"),
+                             "\N{EM SPACE}3.14\N{EN SPACE}")
+            self.assertEqual(transform_decimal('123\u20ac'),
+                             '123\u20ac')
 
     @support.cpython_only
     def test_pep393_utf8_caching_bug(self):
diff --git a/Lib/test/test_unicode_file.py b/Lib/test/test_unicode_file.py
index e8feb42..80c22c6 100644
--- a/Lib/test/test_unicode_file.py
+++ b/Lib/test/test_unicode_file.py
@@ -2,15 +2,17 @@
 # We don't test many operations on files other than
 # that their names can be used with Unicode characters.
 import os, glob, time, shutil
+import sys
 import unicodedata
 
 import unittest
-from test.support import (run_unittest, rmtree, change_cwd,
-    TESTFN_ENCODING, TESTFN_UNICODE, TESTFN_UNENCODABLE, create_empty_file)
+from test.support.os_helper import (rmtree, change_cwd, TESTFN_UNICODE,
+    TESTFN_UNENCODABLE, create_empty_file)
+
 
 if not os.path.supports_unicode_filenames:
     try:
-        TESTFN_UNICODE.encode(TESTFN_ENCODING)
+        TESTFN_UNICODE.encode(sys.getfilesystemencoding())
     except (UnicodeError, TypeError):
         # Either the file system encoding is None, or the file name
         # cannot be encoded in the file system encoding.
@@ -133,8 +135,6 @@
             self._do_directory(TESTFN_UNENCODABLE+ext,
                                TESTFN_UNENCODABLE+ext)
 
-def test_main():
-    run_unittest(__name__)
 
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_unicode_file_functions.py b/Lib/test/test_unicode_file_functions.py
index 1cd0d62..54916dec4 100644
--- a/Lib/test/test_unicode_file_functions.py
+++ b/Lib/test/test_unicode_file_functions.py
@@ -5,7 +5,8 @@
 import unittest
 import warnings
 from unicodedata import normalize
-from test import support
+from test.support import os_helper
+
 
 filenames = [
     '1_abc',
@@ -62,14 +63,14 @@
 
     def setUp(self):
         try:
-            os.mkdir(support.TESTFN)
+            os.mkdir(os_helper.TESTFN)
         except FileExistsError:
             pass
-        self.addCleanup(support.rmtree, support.TESTFN)
+        self.addCleanup(os_helper.rmtree, os_helper.TESTFN)
 
         files = set()
         for name in self.files:
-            name = os.path.join(support.TESTFN, self.norm(name))
+            name = os.path.join(os_helper.TESTFN, self.norm(name))
             with open(name, 'wb') as f:
                 f.write((name+'\n').encode("utf-8"))
             os.stat(name)
@@ -144,9 +145,10 @@
         sf0 = set(self.files)
         with warnings.catch_warnings():
             warnings.simplefilter("ignore", DeprecationWarning)
-            f1 = os.listdir(support.TESTFN.encode(sys.getfilesystemencoding()))
-        f2 = os.listdir(support.TESTFN)
-        sf2 = set(os.path.join(support.TESTFN, f) for f in f2)
+            f1 = os.listdir(os_helper.TESTFN.encode(
+                            sys.getfilesystemencoding()))
+        f2 = os.listdir(os_helper.TESTFN)
+        sf2 = set(os.path.join(os_helper.TESTFN, f) for f in f2)
         self.assertEqual(sf0, sf2, "%a != %a" % (sf0, sf2))
         self.assertEqual(len(f1), len(f2))
 
@@ -156,9 +158,10 @@
             os.rename("tmp", name)
 
     def test_directory(self):
-        dirname = os.path.join(support.TESTFN, 'Gr\xfc\xdf-\u66e8\u66e9\u66eb')
+        dirname = os.path.join(os_helper.TESTFN,
+                               'Gr\xfc\xdf-\u66e8\u66e9\u66eb')
         filename = '\xdf-\u66e8\u66e9\u66eb'
-        with support.temp_cwd(dirname):
+        with os_helper.temp_cwd(dirname):
             with open(filename, 'wb') as f:
                 f.write((filename + '\n').encode("utf-8"))
             os.access(filename,os.R_OK)
@@ -181,15 +184,5 @@
     normal_form = 'NFKD'
 
 
-def test_main():
-    support.run_unittest(
-        UnicodeFileTests,
-        UnicodeNFCFileTests,
-        UnicodeNFDFileTests,
-        UnicodeNFKCFileTests,
-        UnicodeNFKDFileTests,
-    )
-
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_unicodedata.py b/Lib/test/test_unicodedata.py
index b552d2b..213b3cf 100644
--- a/Lib/test/test_unicodedata.py
+++ b/Lib/test/test_unicodedata.py
@@ -11,7 +11,8 @@
 import sys
 import unicodedata
 import unittest
-from test.support import open_urlresource, requires_resource, script_helper
+from test.support import (open_urlresource, requires_resource, script_helper,
+                          cpython_only, check_disallow_instantiation)
 
 
 class UnicodeMethodsTest(unittest.TestCase):
@@ -225,6 +226,11 @@
 
 class UnicodeMiscTest(UnicodeDatabaseTest):
 
+    @cpython_only
+    def test_disallow_instantiation(self):
+        # Ensure that the type disallows instantiation (bpo-43916)
+        check_disallow_instantiation(self, unicodedata.UCD)
+
     def test_failed_import_during_compiling(self):
         # Issue 4367
         # Decoding \N escapes requires the unicodedata module. If it can't be
@@ -320,6 +326,7 @@
         data = [int(x, 16) for x in data.split(" ")]
         return "".join([chr(x) for x in data])
 
+    @requires_resource('network')
     def test_normalization(self):
         TESTDATAFILE = "NormalizationTest.txt"
         TESTDATAURL = f"http://www.pythontest.net/unicode/{unicodedata.unidata_version}/{TESTDATAFILE}"
diff --git a/Lib/test/test_unittest.py b/Lib/test/test_unittest.py
index bfc3ded..1079c7d 100644
--- a/Lib/test/test_unittest.py
+++ b/Lib/test/test_unittest.py
@@ -3,14 +3,14 @@
 from test import support
 
 
-def test_main():
-    # used by regrtest
-    support.run_unittest(unittest.test.suite())
-    support.reap_children()
-
 def load_tests(*_):
     # used by unittest
     return unittest.test.suite()
 
+
+def tearDownModule():
+    support.reap_children()
+
+
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_univnewlines.py b/Lib/test/test_univnewlines.py
index fd07539..b905491 100644
--- a/Lib/test/test_univnewlines.py
+++ b/Lib/test/test_univnewlines.py
@@ -5,6 +5,8 @@
 import os
 import sys
 from test import support
+from test.support import os_helper
+
 
 if not hasattr(sys.stdin, 'newlines'):
     raise unittest.SkipTest(
@@ -46,29 +48,29 @@
         data = self.DATA
         if "b" in self.WRITEMODE:
             data = data.encode("ascii")
-        with self.open(support.TESTFN, self.WRITEMODE) as fp:
+        with self.open(os_helper.TESTFN, self.WRITEMODE) as fp:
             fp.write(data)
 
     def tearDown(self):
         try:
-            os.unlink(support.TESTFN)
+            os.unlink(os_helper.TESTFN)
         except:
             pass
 
     def test_read(self):
-        with self.open(support.TESTFN, self.READMODE) as fp:
+        with self.open(os_helper.TESTFN, self.READMODE) as fp:
             data = fp.read()
         self.assertEqual(data, DATA_LF)
         self.assertEqual(repr(fp.newlines), repr(self.NEWLINE))
 
     def test_readlines(self):
-        with self.open(support.TESTFN, self.READMODE) as fp:
+        with self.open(os_helper.TESTFN, self.READMODE) as fp:
             data = fp.readlines()
         self.assertEqual(data, DATA_SPLIT)
         self.assertEqual(repr(fp.newlines), repr(self.NEWLINE))
 
     def test_readline(self):
-        with self.open(support.TESTFN, self.READMODE) as fp:
+        with self.open(os_helper.TESTFN, self.READMODE) as fp:
             data = []
             d = fp.readline()
             while d:
@@ -78,7 +80,7 @@
         self.assertEqual(repr(fp.newlines), repr(self.NEWLINE))
 
     def test_seek(self):
-        with self.open(support.TESTFN, self.READMODE) as fp:
+        with self.open(os_helper.TESTFN, self.READMODE) as fp:
             fp.readline()
             pos = fp.tell()
             data = fp.readlines()
@@ -105,7 +107,7 @@
     DATA = DATA_CRLF
 
     def test_tell(self):
-        with self.open(support.TESTFN, self.READMODE) as fp:
+        with self.open(os_helper.TESTFN, self.READMODE) as fp:
             self.assertEqual(repr(fp.newlines), repr(None))
             data = fp.readline()
             pos = fp.tell()
diff --git a/Lib/test/test_unpack_ex.py b/Lib/test/test_unpack_ex.py
index fcc9382..bd79421 100644
--- a/Lib/test/test_unpack_ex.py
+++ b/Lib/test/test_unpack_ex.py
@@ -346,6 +346,31 @@
       ...
     SyntaxError: can't use starred expression here
 
+    >>> (*x),y = 1, 2 # doctest:+ELLIPSIS
+    Traceback (most recent call last):
+      ...
+    SyntaxError: cannot use starred expression here
+
+    >>> (((*x))),y = 1, 2 # doctest:+ELLIPSIS
+    Traceback (most recent call last):
+      ...
+    SyntaxError: cannot use starred expression here
+
+    >>> z,(*x),y = 1, 2, 4 # doctest:+ELLIPSIS
+    Traceback (most recent call last):
+      ...
+    SyntaxError: cannot use starred expression here
+
+    >>> z,(*x) = 1, 2 # doctest:+ELLIPSIS
+    Traceback (most recent call last):
+      ...
+    SyntaxError: cannot use starred expression here
+
+    >>> ((*x),y) = 1, 2 # doctest:+ELLIPSIS
+    Traceback (most recent call last):
+      ...
+    SyntaxError: cannot use starred expression here
+
 Some size constraints (all fail.)
 
     >>> s = ", ".join("a%d" % i for i in range(1<<8)) + ", *rest = range(1<<8 + 1)"
diff --git a/Lib/test/test_unparse.py b/Lib/test/test_unparse.py
index c7c8613..33e1149 100644
--- a/Lib/test/test_unparse.py
+++ b/Lib/test/test_unparse.py
@@ -199,6 +199,12 @@
         self.check_ast_roundtrip("1e1000j")
         self.check_ast_roundtrip("-1e1000j")
 
+    def test_nan(self):
+        self.assertASTEqual(
+            ast.parse(ast.unparse(ast.Constant(value=float('nan')))),
+            ast.parse('1e1000 - 1e1000')
+        )
+
     def test_min_int(self):
         self.check_ast_roundtrip(str(-(2 ** 31)))
         self.check_ast_roundtrip(str(-(2 ** 63)))
@@ -252,6 +258,12 @@
     def test_set_literal(self):
         self.check_ast_roundtrip("{'a', 'b', 'c'}")
 
+    def test_empty_set(self):
+        self.assertASTEqual(
+            ast.parse(ast.unparse(ast.Set(elts=[]))),
+            ast.parse('{*()}')
+        )
+
     def test_set_comprehension(self):
         self.check_ast_roundtrip("{x for x in range(5)}")
 
@@ -326,9 +338,6 @@
     def test_invalid_fstring_backslash(self):
         self.check_invalid(ast.FormattedValue(value=ast.Constant(value="\\\\")))
 
-    def test_invalid_set(self):
-        self.check_invalid(ast.Set(elts=[]))
-
     def test_invalid_yield_from(self):
         self.check_invalid(ast.YieldFrom(value=None))
 
@@ -399,7 +408,7 @@
 
 
 class CosmeticTestCase(ASTTestCase):
-    """Test if there are cosmetic issues caused by unnecesary additions"""
+    """Test if there are cosmetic issues caused by unnecessary additions"""
 
     def test_simple_expressions_parens(self):
         self.check_src_roundtrip("(a := b)")
@@ -509,7 +518,8 @@
     lib_dir = pathlib.Path(__file__).parent / ".."
     test_directories = (lib_dir, lib_dir / "test")
     run_always_files = {"test_grammar.py", "test_syntax.py", "test_compile.py",
-                        "test_ast.py", "test_asdl_parser.py", "test_fstring.py"}
+                        "test_ast.py", "test_asdl_parser.py", "test_fstring.py",
+                        "test_patma.py"}
 
     _files_to_test = None
 
diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py
index 68bb49e..82f1d9d 100644
--- a/Lib/test/test_urllib.py
+++ b/Lib/test/test_urllib.py
@@ -9,6 +9,8 @@
 import unittest
 from unittest.mock import patch
 from test import support
+from test.support import os_helper
+from test.support import warnings_helper
 import os
 try:
     import ssl
@@ -50,7 +52,7 @@
 
 
 def FancyURLopener():
-    with support.check_warnings(
+    with warnings_helper.check_warnings(
             ('FancyURLopener style of invoking requests is deprecated.',
             DeprecationWarning)):
         return urllib.request.FancyURLopener()
@@ -145,19 +147,19 @@
         # Create a temp file to use for testing
         self.text = bytes("test_urllib: %s\n" % self.__class__.__name__,
                           "ascii")
-        f = open(support.TESTFN, 'wb')
+        f = open(os_helper.TESTFN, 'wb')
         try:
             f.write(self.text)
         finally:
             f.close()
-        self.pathname = support.TESTFN
+        self.pathname = os_helper.TESTFN
         self.quoted_pathname = urllib.parse.quote(self.pathname)
         self.returned_obj = urlopen("file:%s" % self.quoted_pathname)
 
     def tearDown(self):
         """Shut down the open object"""
         self.returned_obj.close()
-        os.remove(support.TESTFN)
+        os.remove(os_helper.TESTFN)
 
     def test_interface(self):
         # Make sure object returned by urlopen() has the specified methods
@@ -230,7 +232,7 @@
 
     def setUp(self):
         # Records changes to env vars
-        self.env = support.EnvironmentVarGuard()
+        self.env = os_helper.EnvironmentVarGuard()
         # Delete all proxy related env vars
         for k in list(os.environ):
             if 'proxy' in k.lower():
@@ -592,13 +594,13 @@
             self.unfakehttp()
 
     def test_URLopener_deprecation(self):
-        with support.check_warnings(('',DeprecationWarning)):
+        with warnings_helper.check_warnings(('',DeprecationWarning)):
             urllib.request.URLopener()
 
     @unittest.skipUnless(ssl, "ssl module required")
     def test_cafile_and_context(self):
         context = ssl.create_default_context()
-        with support.check_warnings(('', DeprecationWarning)):
+        with warnings_helper.check_warnings(('', DeprecationWarning)):
             with self.assertRaises(ValueError):
                 urllib.request.urlopen(
                     "https://localhost", cafile="/nonexistent/path", context=context
@@ -699,10 +701,10 @@
         self.tempFiles = []
 
         # Create a temporary file.
-        self.registerFileForCleanUp(support.TESTFN)
+        self.registerFileForCleanUp(os_helper.TESTFN)
         self.text = b'testing urllib.urlretrieve'
         try:
-            FILE = open(support.TESTFN, 'wb')
+            FILE = open(os_helper.TESTFN, 'wb')
             FILE.write(self.text)
             FILE.close()
         finally:
@@ -745,18 +747,18 @@
     def test_basic(self):
         # Make sure that a local file just gets its own location returned and
         # a headers value is returned.
-        result = urllib.request.urlretrieve("file:%s" % support.TESTFN)
-        self.assertEqual(result[0], support.TESTFN)
+        result = urllib.request.urlretrieve("file:%s" % os_helper.TESTFN)
+        self.assertEqual(result[0], os_helper.TESTFN)
         self.assertIsInstance(result[1], email.message.Message,
                               "did not get an email.message.Message instance "
                               "as second returned value")
 
     def test_copy(self):
         # Test that setting the filename argument works.
-        second_temp = "%s.2" % support.TESTFN
+        second_temp = "%s.2" % os_helper.TESTFN
         self.registerFileForCleanUp(second_temp)
         result = urllib.request.urlretrieve(self.constructLocalFileUrl(
-            support.TESTFN), second_temp)
+            os_helper.TESTFN), second_temp)
         self.assertEqual(second_temp, result[0])
         self.assertTrue(os.path.exists(second_temp), "copy of the file was not "
                                                   "made")
@@ -777,10 +779,10 @@
             self.assertIsInstance(file_size, int)
             self.assertEqual(block_count, count_holder[0])
             count_holder[0] = count_holder[0] + 1
-        second_temp = "%s.2" % support.TESTFN
+        second_temp = "%s.2" % os_helper.TESTFN
         self.registerFileForCleanUp(second_temp)
         urllib.request.urlretrieve(
-            self.constructLocalFileUrl(support.TESTFN),
+            self.constructLocalFileUrl(os_helper.TESTFN),
             second_temp, hooktester)
 
     def test_reporthook_0_bytes(self):
@@ -790,7 +792,7 @@
             _report.append((block_count, block_read_size, file_size))
         srcFileName = self.createNewTempFile()
         urllib.request.urlretrieve(self.constructLocalFileUrl(srcFileName),
-            support.TESTFN, hooktester)
+            os_helper.TESTFN, hooktester)
         self.assertEqual(len(report), 1)
         self.assertEqual(report[0][2], 0)
 
@@ -803,7 +805,7 @@
             _report.append((block_count, block_read_size, file_size))
         srcFileName = self.createNewTempFile(b"x" * 5)
         urllib.request.urlretrieve(self.constructLocalFileUrl(srcFileName),
-            support.TESTFN, hooktester)
+            os_helper.TESTFN, hooktester)
         self.assertEqual(len(report), 2)
         self.assertEqual(report[0][2], 5)
         self.assertEqual(report[1][2], 5)
@@ -817,7 +819,7 @@
             _report.append((block_count, block_read_size, file_size))
         srcFileName = self.createNewTempFile(b"x" * 8193)
         urllib.request.urlretrieve(self.constructLocalFileUrl(srcFileName),
-            support.TESTFN, hooktester)
+            os_helper.TESTFN, hooktester)
         self.assertEqual(len(report), 3)
         self.assertEqual(report[0][2], 8193)
         self.assertEqual(report[0][1], 8192)
@@ -1525,6 +1527,24 @@
                          (expect, result))
 
     @unittest.skipUnless(sys.platform == 'win32',
+                         'test specific to the nturl2path functions.')
+    def test_prefixes(self):
+        # Test special prefixes are correctly handled in pathname2url()
+        given = '\\\\?\\C:\\dir'
+        expect = '///C:/dir'
+        result = urllib.request.pathname2url(given)
+        self.assertEqual(expect, result,
+                         "pathname2url() failed; %s != %s" %
+                         (expect, result))
+        given = '\\\\?\\unc\\server\\share\\dir'
+        expect = '/server/share/dir'
+        result = urllib.request.pathname2url(given)
+        self.assertEqual(expect, result,
+                         "pathname2url() failed; %s != %s" %
+                         (expect, result))
+
+
+    @unittest.skipUnless(sys.platform == 'win32',
                          'test specific to the urllib.url2path function.')
     def test_ntpath(self):
         given = ('/C:/', '///C:/', '/C|//')
@@ -1556,7 +1576,7 @@
         class DummyURLopener(urllib.request.URLopener):
             def open_spam(self, url):
                 return url
-        with support.check_warnings(
+        with warnings_helper.check_warnings(
                 ('DummyURLopener style of invoking requests is deprecated.',
                 DeprecationWarning)):
             self.assertEqual(DummyURLopener().open(
@@ -1567,9 +1587,9 @@
                 "spam://c:|windows%/:=&?~#+!$,;'@()*[]|/path/"),
                 "//c:|windows%/:=&?~#+!$,;'@()*[]|/path/")
 
-    @support.ignore_warnings(category=DeprecationWarning)
+    @warnings_helper.ignore_warnings(category=DeprecationWarning)
     def test_urlopener_retrieve_file(self):
-        with support.temp_dir() as tmpdir:
+        with os_helper.temp_dir() as tmpdir:
             fd, tmpfile = tempfile.mkstemp(dir=tmpdir)
             os.close(fd)
             fileurl = "file:" + urllib.request.pathname2url(tmpfile)
@@ -1577,7 +1597,7 @@
             # Some buildbots have TEMP folder that uses a lowercase drive letter.
             self.assertEqual(os.path.normcase(filename), os.path.normcase(tmpfile))
 
-    @support.ignore_warnings(category=DeprecationWarning)
+    @warnings_helper.ignore_warnings(category=DeprecationWarning)
     def test_urlopener_retrieve_remote(self):
         url = "http://www.python.org/file.txt"
         self.fakehttp(b"HTTP/1.1 200 OK\r\n\r\nHello!")
@@ -1585,7 +1605,7 @@
         filename, _ = urllib.request.URLopener().retrieve(url)
         self.assertEqual(os.path.splitext(filename)[1], ".txt")
 
-    @support.ignore_warnings(category=DeprecationWarning)
+    @warnings_helper.ignore_warnings(category=DeprecationWarning)
     def test_local_file_open(self):
         # bpo-35907, CVE-2019-9948: urllib must reject local_file:// scheme
         class DummyURLopener(urllib.request.URLopener):
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py
index b71be54..399c942 100644
--- a/Lib/test/test_urllib2.py
+++ b/Lib/test/test_urllib2.py
@@ -1,6 +1,8 @@
 import unittest
 from test import support
+from test.support import os_helper
 from test.support import socket_helper
+from test.support import warnings_helper
 from test import test_urllib
 
 import os
@@ -162,7 +164,6 @@
         self.assertEqual(find_user_pass("Some Realm",
                                         "http://example.com/spam"),
                          ('joe', 'password'))
-
         self.assertEqual(find_user_pass("Some Realm",
                                         "http://example.com/spam/spam"),
                          ('joe', 'password'))
@@ -171,12 +172,29 @@
 
         add("c", "http://example.com/foo", "foo", "ni")
         add("c", "http://example.com/bar", "bar", "nini")
+        add("c", "http://example.com/foo/bar", "foobar", "nibar")
 
         self.assertEqual(find_user_pass("c", "http://example.com/foo"),
                          ('foo', 'ni'))
-
         self.assertEqual(find_user_pass("c", "http://example.com/bar"),
                          ('bar', 'nini'))
+        self.assertEqual(find_user_pass("c", "http://example.com/foo/"),
+                         ('foo', 'ni'))
+        self.assertEqual(find_user_pass("c", "http://example.com/foo/bar"),
+                         ('foo', 'ni'))
+        self.assertEqual(find_user_pass("c", "http://example.com/foo/baz"),
+                         ('foo', 'ni'))
+        self.assertEqual(find_user_pass("c", "http://example.com/foobar"),
+                         (None, None))
+
+        add("c", "http://example.com/baz/", "baz", "ninini")
+
+        self.assertEqual(find_user_pass("c", "http://example.com/baz"),
+                         (None, None))
+        self.assertEqual(find_user_pass("c", "http://example.com/baz/"),
+                         ('baz', 'ninini'))
+        self.assertEqual(find_user_pass("c", "http://example.com/baz/bar"),
+                         ('baz', 'ninini'))
 
         # For the same path, newer password should be considered.
 
@@ -765,7 +783,7 @@
         h = urllib.request.FileHandler()
         o = h.parent = MockOpener()
 
-        TESTFN = support.TESTFN
+        TESTFN = os_helper.TESTFN
         urlpath = sanepathname2url(os.path.abspath(TESTFN))
         towrite = b"hello, world\n"
         urls = [
@@ -1502,7 +1520,7 @@
             self.check_basic_auth(headers, realm)
 
         # no quote: expect a warning
-        with support.check_warnings(("Basic Auth Realm was unquoted",
+        with warnings_helper.check_warnings(("Basic Auth Realm was unquoted",
                                      UserWarning)):
             headers = [f'WWW-Authenticate: Basic realm={realm}']
             self.check_basic_auth(headers, realm)
@@ -1656,8 +1674,9 @@
         auth_prior_handler.add_password(
             None, request_url, user, password, is_authenticated=True)
 
-        is_auth = pwd_manager.is_authenticated(request_url)
-        self.assertTrue(is_auth)
+        self.assertTrue(pwd_manager.is_authenticated(request_url))
+        self.assertTrue(pwd_manager.is_authenticated(request_url + '/nested'))
+        self.assertFalse(pwd_manager.is_authenticated(request_url + 'plain'))
 
         opener = OpenerDirector()
         opener.add_handler(auth_prior_handler)
@@ -1786,22 +1805,6 @@
         self.opener_has_handler(o, MyHTTPHandler)
         self.opener_has_handler(o, MyOtherHTTPHandler)
 
-    @unittest.skipUnless(support.is_resource_enabled('network'),
-                         'test requires network access')
-    def test_issue16464(self):
-        with socket_helper.transient_internet("http://www.example.com/"):
-            opener = urllib.request.build_opener()
-            request = urllib.request.Request("http://www.example.com/")
-            self.assertEqual(None, request.data)
-
-            opener.open(request, "1".encode("us-ascii"))
-            self.assertEqual(b"1", request.data)
-            self.assertEqual("1", request.get_header("Content-length"))
-
-            opener.open(request, "1234567890".encode("us-ascii"))
-            self.assertEqual(b"1234567890", request.data)
-            self.assertEqual("10", request.get_header("Content-length"))
-
     def test_HTTPError_interface(self):
         """
         Issue 13211 reveals that HTTPError didn't implement the URLError
@@ -1849,9 +1852,17 @@
              ('ftp', 'joe', 'password', 'proxy.example.com')),
             # Test for no trailing '/' case
             ('http://joe:password@proxy.example.com',
-             ('http', 'joe', 'password', 'proxy.example.com'))
+             ('http', 'joe', 'password', 'proxy.example.com')),
+            # Testcases with '/' character in username, password
+            ('http://user/name:password@localhost:22',
+             ('http', 'user/name', 'password', 'localhost:22')),
+            ('http://username:pass/word@localhost:22',
+             ('http', 'username', 'pass/word', 'localhost:22')),
+            ('http://user/name:pass/word@localhost:22',
+             ('http', 'user/name', 'pass/word', 'localhost:22')),
         ]
 
+
         for tc, expected in parse_proxy_test_cases:
             self.assertEqual(_parse_proxy(tc), expected)
 
diff --git a/Lib/test/test_urllib2_localnet.py b/Lib/test/test_urllib2_localnet.py
index ed426b0..1b2baf2 100644
--- a/Lib/test/test_urllib2_localnet.py
+++ b/Lib/test/test_urllib2_localnet.py
@@ -8,8 +8,9 @@
 import unittest
 import hashlib
 
-from test import support
 from test.support import hashlib_helper
+from test.support import threading_helper
+from test.support import warnings_helper
 
 try:
     import ssl
@@ -316,7 +317,7 @@
         self.assertRaises(urllib.error.HTTPError, urllib.request.urlopen, self.server_url)
 
 
-@hashlib_helper.requires_hashdigest("md5")
+@hashlib_helper.requires_hashdigest("md5", openssl=True)
 class ProxyAuthTests(unittest.TestCase):
     URL = "http://localhost"
 
@@ -566,7 +567,7 @@
 
     def test_https_with_cafile(self):
         handler = self.start_https_server(certfile=CERT_localhost)
-        with support.check_warnings(('', DeprecationWarning)):
+        with warnings_helper.check_warnings(('', DeprecationWarning)):
             # Good cert
             data = self.urlopen("https://localhost:%s/bizarre" % handler.port,
                                 cafile=CERT_localhost)
@@ -584,7 +585,7 @@
     def test_https_with_cadefault(self):
         handler = self.start_https_server(certfile=CERT_localhost)
         # Self-signed cert should fail verification with system certificate store
-        with support.check_warnings(('', DeprecationWarning)):
+        with warnings_helper.check_warnings(('', DeprecationWarning)):
             with self.assertRaises(urllib.error.URLError) as cm:
                 self.urlopen("https://localhost:%s/bizarre" % handler.port,
                              cadefault=True)
@@ -659,18 +660,29 @@
                              (index, len(lines[index]), len(line)))
         self.assertEqual(index + 1, len(lines))
 
+    def test_issue16464(self):
+        # See https://bugs.python.org/issue16464
+        # and https://bugs.python.org/issue46648
+        handler = self.start_server([
+            (200, [], b'any'),
+            (200, [], b'any'),
+        ])
+        opener = urllib.request.build_opener()
+        request = urllib.request.Request("http://localhost:%s" % handler.port)
+        self.assertEqual(None, request.data)
 
-threads_key = None
+        opener.open(request, "1".encode("us-ascii"))
+        self.assertEqual(b"1", request.data)
+        self.assertEqual("1", request.get_header("Content-length"))
+
+        opener.open(request, "1234567890".encode("us-ascii"))
+        self.assertEqual(b"1234567890", request.data)
+        self.assertEqual("10", request.get_header("Content-length"))
 
 def setUpModule():
-    # Store the threading_setup in a key and ensure that it is cleaned up
-    # in the tearDown
-    global threads_key
-    threads_key = support.threading_setup()
+    thread_info = threading_helper.threading_setup()
+    unittest.addModuleCleanup(threading_helper.threading_cleanup, *thread_info)
 
-def tearDownModule():
-    if threads_key:
-        support.threading_cleanup(*threads_key)
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/Lib/test/test_urllib2net.py b/Lib/test/test_urllib2net.py
index ba4c500..aa41811 100644
--- a/Lib/test/test_urllib2net.py
+++ b/Lib/test/test_urllib2net.py
@@ -1,5 +1,7 @@
+import errno
 import unittest
 from test import support
+from test.support import os_helper
 from test.support import socket_helper
 from test.test_urllib2 import sanepathname2url
 
@@ -39,6 +41,39 @@
                                               urllib.error.URLError)
 
 
+class TransientResource(object):
+
+    """Raise ResourceDenied if an exception is raised while the context manager
+    is in effect that matches the specified exception and attributes."""
+
+    def __init__(self, exc, **kwargs):
+        self.exc = exc
+        self.attrs = kwargs
+
+    def __enter__(self):
+        return self
+
+    def __exit__(self, type_=None, value=None, traceback=None):
+        """If type_ is a subclass of self.exc and value has attributes matching
+        self.attrs, raise ResourceDenied.  Otherwise let the exception
+        propagate (if any)."""
+        if type_ is not None and issubclass(self.exc, type_):
+            for attr, attr_value in self.attrs.items():
+                if not hasattr(value, attr):
+                    break
+                if getattr(value, attr) != attr_value:
+                    break
+            else:
+                raise ResourceDenied("an optional resource is not available")
+
+# Context managers that raise ResourceDenied when various issues
+# with the internet connection manifest themselves as exceptions.
+# XXX deprecate these and use transient_internet() instead
+time_out = TransientResource(OSError, errno=errno.ETIMEDOUT)
+socket_peer_reset = TransientResource(OSError, errno=errno.ECONNRESET)
+ioerror_peer_reset = TransientResource(OSError, errno=errno.ECONNRESET)
+
+
 class AuthTests(unittest.TestCase):
     """Tests urllib2 authentication features."""
 
@@ -114,7 +149,7 @@
         self._test_urls(urls, self._extra_handlers())
 
     def test_file(self):
-        TESTFN = support.TESTFN
+        TESTFN = os_helper.TESTFN
         f = open(TESTFN, 'w')
         try:
             f.write('hi there\n')
@@ -237,12 +272,12 @@
                             raise
                     else:
                         try:
-                            with support.time_out, \
-                                 support.socket_peer_reset, \
-                                 support.ioerror_peer_reset:
+                            with time_out, \
+                                 socket_peer_reset, \
+                                 ioerror_peer_reset:
                                 buf = f.read()
                                 debug("read %d bytes" % len(buf))
-                        except socket.timeout:
+                        except TimeoutError:
                             print("<timeout: %s>" % url, file=sys.stderr)
                         f.close()
                 time.sleep(0.1)
diff --git a/Lib/test/test_urllibnet.py b/Lib/test/test_urllibnet.py
index 28680aa..773101c 100644
--- a/Lib/test/test_urllibnet.py
+++ b/Lib/test/test_urllibnet.py
@@ -1,5 +1,6 @@
 import unittest
 from test import support
+from test.support import os_helper
 from test.support import socket_helper
 
 import contextlib
@@ -162,7 +163,7 @@
             try:
                 yield file_location, info
             finally:
-                support.unlink(file_location)
+                os_helper.unlink(file_location)
 
     def test_basic(self):
         # Test basic functionality.
@@ -176,8 +177,8 @@
     def test_specified_path(self):
         # Make sure that specifying the location of the file to write to works.
         with self.urlretrieve(self.logo,
-                              support.TESTFN) as (file_location, info):
-            self.assertEqual(file_location, support.TESTFN)
+                              os_helper.TESTFN) as (file_location, info):
+            self.assertEqual(file_location, os_helper.TESTFN)
             self.assertTrue(os.path.exists(file_location))
             with open(file_location, 'rb') as f:
                 self.assertTrue(f.read(), "reading from temporary file failed")
diff --git a/Lib/test/test_urlparse.py b/Lib/test/test_urlparse.py
index 7625007..31943f3 100644
--- a/Lib/test/test_urlparse.py
+++ b/Lib/test/test_urlparse.py
@@ -32,16 +32,10 @@
     (b"&a=b", [(b'a', b'b')]),
     (b"a=a+b&b=b+c", [(b'a', b'a b'), (b'b', b'b c')]),
     (b"a=1&a=2", [(b'a', b'1'), (b'a', b'2')]),
-    (";", []),
-    (";;", []),
-    (";a=b", [('a', 'b')]),
-    ("a=a+b;b=b+c", [('a', 'a b'), ('b', 'b c')]),
-    ("a=1;a=2", [('a', '1'), ('a', '2')]),
-    (b";", []),
-    (b";;", []),
-    (b";a=b", [(b'a', b'b')]),
-    (b"a=a+b;b=b+c", [(b'a', b'a b'), (b'b', b'b c')]),
-    (b"a=1;a=2", [(b'a', b'1'), (b'a', b'2')]),
+    (";a=b", [(';a', 'b')]),
+    ("a=a+b;b=b+c", [('a', 'a b;b=b c')]),
+    (b";a=b", [(b';a', b'b')]),
+    (b"a=a+b;b=b+c", [(b'a', b'a b;b=b c')]),
 ]
 
 # Each parse_qs testcase is a two-tuple that contains
@@ -68,16 +62,10 @@
     (b"&a=b", {b'a': [b'b']}),
     (b"a=a+b&b=b+c", {b'a': [b'a b'], b'b': [b'b c']}),
     (b"a=1&a=2", {b'a': [b'1', b'2']}),
-    (";", {}),
-    (";;", {}),
-    (";a=b", {'a': ['b']}),
-    ("a=a+b;b=b+c", {'a': ['a b'], 'b': ['b c']}),
-    ("a=1;a=2", {'a': ['1', '2']}),
-    (b";", {}),
-    (b";;", {}),
-    (b";a=b", {b'a': [b'b']}),
-    (b"a=a+b;b=b+c", {b'a': [b'a b'], b'b': [b'b c']}),
-    (b"a=1;a=2", {b'a': [b'1', b'2']}),
+    (";a=b", {';a': ['b']}),
+    ("a=a+b;b=b+c", {'a': ['a b;b=b c']}),
+    (b";a=b", {b';a': [b'b']}),
+    (b"a=a+b;b=b+c", {b'a':[ b'a b;b=b c']}),
 ]
 
 class UrlParseTestCase(unittest.TestCase):
@@ -624,6 +612,43 @@
         with self.assertRaisesRegex(ValueError, "out of range"):
             p.port
 
+    def test_urlsplit_remove_unsafe_bytes(self):
+        # Remove ASCII tabs and newlines from input
+        url = "http\t://www.python\n.org\t/java\nscript:\talert('msg\r\n')/?query\n=\tsomething#frag\nment"
+        p = urllib.parse.urlsplit(url)
+        self.assertEqual(p.scheme, "http")
+        self.assertEqual(p.netloc, "www.python.org")
+        self.assertEqual(p.path, "/javascript:alert('msg')/")
+        self.assertEqual(p.query, "query=something")
+        self.assertEqual(p.fragment, "fragment")
+        self.assertEqual(p.username, None)
+        self.assertEqual(p.password, None)
+        self.assertEqual(p.hostname, "www.python.org")
+        self.assertEqual(p.port, None)
+        self.assertEqual(p.geturl(), "http://www.python.org/javascript:alert('msg')/?query=something#fragment")
+
+        # Remove ASCII tabs and newlines from input as bytes.
+        url = b"http\t://www.python\n.org\t/java\nscript:\talert('msg\r\n')/?query\n=\tsomething#frag\nment"
+        p = urllib.parse.urlsplit(url)
+        self.assertEqual(p.scheme, b"http")
+        self.assertEqual(p.netloc, b"www.python.org")
+        self.assertEqual(p.path, b"/javascript:alert('msg')/")
+        self.assertEqual(p.query, b"query=something")
+        self.assertEqual(p.fragment, b"fragment")
+        self.assertEqual(p.username, None)
+        self.assertEqual(p.password, None)
+        self.assertEqual(p.hostname, b"www.python.org")
+        self.assertEqual(p.port, None)
+        self.assertEqual(p.geturl(), b"http://www.python.org/javascript:alert('msg')/?query=something#fragment")
+
+        # with scheme as cache-key
+        url = "http://www.python.org/java\nscript:\talert('msg\r\n')/?query\n=\tsomething#frag\nment"
+        scheme = "ht\ntp"
+        for _ in range(2):
+            p = urllib.parse.urlsplit(url, scheme=scheme)
+            self.assertEqual(p.scheme, "http")
+            self.assertEqual(p.geturl(), "http://www.python.org/javascript:alert('msg')/?query=something#fragment")
+
     def test_attributes_bad_port(self):
         """Check handling of invalid ports."""
         for bytes in (False, True):
@@ -886,10 +911,50 @@
     def test_parse_qsl_max_num_fields(self):
         with self.assertRaises(ValueError):
             urllib.parse.parse_qs('&'.join(['a=a']*11), max_num_fields=10)
-        with self.assertRaises(ValueError):
-            urllib.parse.parse_qs(';'.join(['a=a']*11), max_num_fields=10)
         urllib.parse.parse_qs('&'.join(['a=a']*10), max_num_fields=10)
 
+    def test_parse_qs_separator(self):
+        parse_qs_semicolon_cases = [
+            (";", {}),
+            (";;", {}),
+            (";a=b", {'a': ['b']}),
+            ("a=a+b;b=b+c", {'a': ['a b'], 'b': ['b c']}),
+            ("a=1;a=2", {'a': ['1', '2']}),
+            (b";", {}),
+            (b";;", {}),
+            (b";a=b", {b'a': [b'b']}),
+            (b"a=a+b;b=b+c", {b'a': [b'a b'], b'b': [b'b c']}),
+            (b"a=1;a=2", {b'a': [b'1', b'2']}),
+        ]
+        for orig, expect in parse_qs_semicolon_cases:
+            with self.subTest(f"Original: {orig!r}, Expected: {expect!r}"):
+                result = urllib.parse.parse_qs(orig, separator=';')
+                self.assertEqual(result, expect, "Error parsing %r" % orig)
+                result_bytes = urllib.parse.parse_qs(orig, separator=b';')
+                self.assertEqual(result_bytes, expect, "Error parsing %r" % orig)
+
+
+    def test_parse_qsl_separator(self):
+        parse_qsl_semicolon_cases = [
+            (";", []),
+            (";;", []),
+            (";a=b", [('a', 'b')]),
+            ("a=a+b;b=b+c", [('a', 'a b'), ('b', 'b c')]),
+            ("a=1;a=2", [('a', '1'), ('a', '2')]),
+            (b";", []),
+            (b";;", []),
+            (b";a=b", [(b'a', b'b')]),
+            (b"a=a+b;b=b+c", [(b'a', b'a b'), (b'b', b'b c')]),
+            (b"a=1;a=2", [(b'a', b'1'), (b'a', b'2')]),
+        ]
+        for orig, expect in parse_qsl_semicolon_cases:
+            with self.subTest(f"Original: {orig!r}, Expected: {expect!r}"):
+                result = urllib.parse.parse_qsl(orig, separator=';')
+                self.assertEqual(result, expect, "Error parsing %r" % orig)
+                result_bytes = urllib.parse.parse_qsl(orig, separator=b';')
+                self.assertEqual(result_bytes, expect, "Error parsing %r" % orig)
+
+
     def test_urlencode_sequences(self):
         # Other tests incidentally urlencode things; test non-covered cases:
         # Sequence and object values.
diff --git a/Lib/test/test_utf8_mode.py b/Lib/test/test_utf8_mode.py
index bdb9345..8b6332e 100644
--- a/Lib/test/test_utf8_mode.py
+++ b/Lib/test/test_utf8_mode.py
@@ -3,11 +3,13 @@
 """
 
 import locale
+import subprocess
 import sys
 import textwrap
 import unittest
 from test import support
 from test.support.script_helper import assert_python_ok, assert_python_failure
+from test.support import os_helper
 
 
 MS_WINDOWS = (sys.platform == 'win32')
@@ -250,6 +252,31 @@
         out = self.get_output('-X', 'utf8', '-E', '-c', code)
         self.assertEqual(out, '1')
 
+    @unittest.skipIf(MS_WINDOWS,
+                     "os.device_encoding() doesn't implement "
+                     "the UTF-8 Mode on Windows")
+    def test_device_encoding(self):
+        # Use stdout as TTY
+        if not sys.stdout.isatty():
+            self.skipTest("sys.stdout is not a TTY")
+
+        filename = 'out.txt'
+        self.addCleanup(os_helper.unlink, filename)
+
+        code = (f'import os, sys; fd = sys.stdout.fileno(); '
+                f'out = open({filename!r}, "w", encoding="utf-8"); '
+                f'print(os.isatty(fd), os.device_encoding(fd), file=out); '
+                f'out.close()')
+        cmd = [sys.executable, '-X', 'utf8', '-c', code]
+        # The stdout TTY is inherited to the child process
+        proc = subprocess.run(cmd, text=True)
+        self.assertEqual(proc.returncode, 0, proc)
+
+        # In UTF-8 Mode, device_encoding(fd) returns "UTF-8" if fd is a TTY
+        with open(filename, encoding="utf8") as fp:
+            out = fp.read().rstrip()
+        self.assertEqual(out, 'True UTF-8')
+
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/Lib/test/test_uu.py b/Lib/test/test_uu.py
index 4c639b7..753b31e 100644
--- a/Lib/test/test_uu.py
+++ b/Lib/test/test_uu.py
@@ -4,7 +4,7 @@
 """
 
 import unittest
-from test import support
+from test.support import os_helper
 
 import os
 import stat
@@ -174,10 +174,11 @@
 class UUFileTest(unittest.TestCase):
 
     def setUp(self):
-        self.tmpin  = support.TESTFN_ASCII + "i"
-        self.tmpout = support.TESTFN_ASCII + "o"
-        self.addCleanup(support.unlink, self.tmpin)
-        self.addCleanup(support.unlink, self.tmpout)
+        # uu.encode() supports only ASCII file names
+        self.tmpin  = os_helper.TESTFN_ASCII + "i"
+        self.tmpout = os_helper.TESTFN_ASCII + "o"
+        self.addCleanup(os_helper.unlink, self.tmpin)
+        self.addCleanup(os_helper.unlink, self.tmpout)
 
     def test_encode(self):
         with open(self.tmpin, 'wb') as fin:
diff --git a/Lib/test/test_uuid.py b/Lib/test/test_uuid.py
old mode 100644
new mode 100755
index b1c9242..d6a8333
--- a/Lib/test/test_uuid.py
+++ b/Lib/test/test_uuid.py
@@ -1,5 +1,6 @@
 import unittest
 from test import support
+from test.support import import_helper
 import builtins
 import contextlib
 import copy
@@ -10,8 +11,8 @@
 import weakref
 from unittest import mock
 
-py_uuid = support.import_fresh_module('uuid', blocked=['_uuid'])
-c_uuid = support.import_fresh_module('uuid', fresh=['_uuid'])
+py_uuid = import_helper.import_fresh_module('uuid', blocked=['_uuid'])
+c_uuid = import_helper.import_fresh_module('uuid', fresh=['_uuid'])
 
 def importable(name):
     try:
@@ -638,7 +639,7 @@
             equal(u, self.uuid.UUID(v))
             equal(str(u), v)
 
-    @unittest.skipUnless(os.name == 'posix', 'requires Posix')
+    @unittest.skipUnless(hasattr(os, 'fork'), 'need os.fork')
     def testIssue8621(self):
         # On at least some versions of OSX self.uuid.uuid4 generates
         # the same sequence of UUIDs in the parent and any
diff --git a/Lib/test/test_venv.py b/Lib/test/test_venv.py
index ca003d5..94d6265 100644
--- a/Lib/test/test_venv.py
+++ b/Lib/test/test_venv.py
@@ -15,9 +15,8 @@
 import sys
 import tempfile
 from test.support import (captured_stdout, captured_stderr, requires_zlib,
-                          can_symlink, EnvironmentVarGuard, rmtree,
-                          import_module,
                           skip_if_broken_multiprocessing_synchronize)
+from test.support.os_helper import (can_symlink, EnvironmentVarGuard, rmtree)
 import unittest
 import venv
 from unittest.mock import patch
@@ -151,14 +150,20 @@
     def test_upgrade_dependencies(self):
         builder = venv.EnvBuilder()
         bin_path = 'Scripts' if sys.platform == 'win32' else 'bin'
-        python_exe = 'python.exe' if sys.platform == 'win32' else 'python'
+        python_exe = os.path.split(sys.executable)[1]
         with tempfile.TemporaryDirectory() as fake_env_dir:
+            expect_exe = os.path.normcase(
+                os.path.join(fake_env_dir, bin_path, python_exe)
+            )
+            if sys.platform == 'win32':
+                expect_exe = os.path.normcase(os.path.realpath(expect_exe))
 
             def pip_cmd_checker(cmd):
+                cmd[0] = os.path.normcase(cmd[0])
                 self.assertEqual(
                     cmd,
                     [
-                        os.path.join(fake_env_dir, bin_path, python_exe),
+                        expect_exe,
                         '-m',
                         'pip',
                         'install',
@@ -447,7 +452,7 @@
             # pip's cross-version compatibility may trigger deprecation
             # warnings in current versions of Python. Ensure related
             # environment settings don't cause venv to fail.
-            envvars["PYTHONWARNINGS"] = "e"
+            envvars["PYTHONWARNINGS"] = "ignore"
             # ensurepip is different enough from a normal pip invocation
             # that we want to ensure it ignores the normal pip environment
             # variable settings. We set PIP_NO_INSTALL here specifically
@@ -486,7 +491,8 @@
         # Ensure pip is available in the virtual environment
         envpy = os.path.join(os.path.realpath(self.env_dir), self.bindir, self.exe)
         # Ignore DeprecationWarning since pip code is not part of Python
-        out, err = check_output([envpy, '-W', 'ignore::DeprecationWarning', '-I',
+        out, err = check_output([envpy, '-W', 'ignore::DeprecationWarning',
+               '-W', 'ignore::ImportWarning', '-I',
                '-m', 'pip', '--version'])
         # We force everything to text, so unittest gives the detailed diff
         # if we get unexpected results
@@ -502,8 +508,12 @@
         # Check the private uninstall command provided for the Windows
         # installers works (at least in a virtual environment)
         with EnvironmentVarGuard() as envvars:
+            # It seems ensurepip._uninstall calls subprocesses which do not
+            # inherit the interpreter settings.
+            envvars["PYTHONWARNINGS"] = "ignore"
             out, err = check_output([envpy,
-                '-W', 'ignore::DeprecationWarning', '-I',
+                '-W', 'ignore::DeprecationWarning',
+                '-W', 'ignore::ImportWarning', '-I',
                 '-m', 'ensurepip._uninstall'])
         # We force everything to text, so unittest gives the detailed diff
         # if we get unexpected results
diff --git a/Lib/test/test_warnings/__init__.py b/Lib/test/test_warnings/__init__.py
index dcc0ea8..4b1b4e1 100644
--- a/Lib/test/test_warnings/__init__.py
+++ b/Lib/test/test_warnings/__init__.py
@@ -7,14 +7,20 @@
 import textwrap
 import unittest
 from test import support
+from test.support import import_helper
+from test.support import os_helper
+from test.support import warnings_helper
 from test.support.script_helper import assert_python_ok, assert_python_failure
 
 from test.test_warnings.data import stacklevel as warning_tests
 
 import warnings as original_warnings
 
-py_warnings = support.import_fresh_module('warnings', blocked=['_warnings'])
-c_warnings = support.import_fresh_module('warnings', fresh=['_warnings'])
+
+py_warnings = import_helper.import_fresh_module('warnings',
+                                                blocked=['_warnings'])
+c_warnings = import_helper.import_fresh_module('warnings',
+                                               fresh=['_warnings'])
 
 Py_DEBUG = hasattr(sys, 'gettotalrefcount')
 
@@ -440,7 +446,7 @@
 
     def test_stacklevel_import(self):
         # Issue #24305: With stacklevel=2, module-level warnings should work.
-        support.unload('test.test_warnings.data.import_warning')
+        import_helper.unload('test.test_warnings.data.import_warning')
         with warnings_state(self.module):
             with original_warnings.catch_warnings(record=True,
                     module=self.module) as w:
@@ -543,7 +549,7 @@
     module = c_warnings
 
     # As an early adopter, we sanity check the
-    # test.support.import_fresh_module utility function
+    # test.import_helper.import_fresh_module utility function
     def test_accelerated(self):
         self.assertIsNot(original_warnings, self.module)
         self.assertFalse(hasattr(self.module.warn, '__code__'))
@@ -552,7 +558,7 @@
     module = py_warnings
 
     # As an early adopter, we sanity check the
-    # test.support.import_fresh_module utility function
+    # test.import_helper.import_fresh_module utility function
     def test_pure_python(self):
         self.assertIsNot(original_warnings, self.module)
         self.assertTrue(hasattr(self.module.warn, '__code__'))
@@ -927,12 +933,12 @@
     module = py_warnings
 
     def test_tracemalloc(self):
-        self.addCleanup(support.unlink, support.TESTFN)
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
 
-        with open(support.TESTFN, 'w') as fp:
+        with open(os_helper.TESTFN, 'w', encoding="utf-8") as fp:
             fp.write(textwrap.dedent("""
                 def func():
-                    f = open(__file__)
+                    f = open(__file__, "rb")
                     # Emit ResourceWarning
                     f = None
 
@@ -949,8 +955,8 @@
             return stderr
 
         # tracemalloc disabled
-        filename = os.path.abspath(support.TESTFN)
-        stderr = run('-Wd', support.TESTFN)
+        filename = os.path.abspath(os_helper.TESTFN)
+        stderr = run('-Wd', os_helper.TESTFN)
         expected = textwrap.dedent(f'''
             {filename}:5: ResourceWarning: unclosed file <...>
               f = None
@@ -959,7 +965,7 @@
         self.assertEqual(stderr, expected)
 
         # tracemalloc enabled
-        stderr = run('-Wd', '-X', 'tracemalloc=2', support.TESTFN)
+        stderr = run('-Wd', '-X', 'tracemalloc=2', os_helper.TESTFN)
         expected = textwrap.dedent(f'''
             {filename}:5: ResourceWarning: unclosed file <...>
               f = None
@@ -967,7 +973,7 @@
               File "{filename}", lineno 7
                 func()
               File "{filename}", lineno 3
-                f = open(__file__)
+                f = open(__file__, "rb")
         ''').strip()
         self.assertEqual(stderr, expected)
 
@@ -1093,7 +1099,7 @@
         wmod = self.module
         if wmod is not sys.modules['warnings']:
             self.skipTest('module to test is not loaded warnings module')
-        with support.check_warnings(quiet=False) as w:
+        with warnings_helper.check_warnings(quiet=False) as w:
             self.assertEqual(w.warnings, [])
             wmod.simplefilter("always")
             wmod.warn("foo")
@@ -1105,18 +1111,18 @@
             w.reset()
             self.assertEqual(w.warnings, [])
 
-        with support.check_warnings():
+        with warnings_helper.check_warnings():
             # defaults to quiet=True without argument
             pass
-        with support.check_warnings(('foo', UserWarning)):
+        with warnings_helper.check_warnings(('foo', UserWarning)):
             wmod.warn("foo")
 
         with self.assertRaises(AssertionError):
-            with support.check_warnings(('', RuntimeWarning)):
+            with warnings_helper.check_warnings(('', RuntimeWarning)):
                 # defaults to quiet=False with argument
                 pass
         with self.assertRaises(AssertionError):
-            with support.check_warnings(('foo', RuntimeWarning)):
+            with warnings_helper.check_warnings(('foo', RuntimeWarning)):
                 wmod.warn("foo")
 
 class CCatchWarningTests(CatchWarningTests, unittest.TestCase):
@@ -1198,7 +1204,7 @@
     @unittest.skipUnless(sys.getfilesystemencoding() != 'ascii',
                          'requires non-ascii filesystemencoding')
     def test_nonascii(self):
-        PYTHONWARNINGS="ignore:DeprecationWarning" + support.FS_NONASCII
+        PYTHONWARNINGS="ignore:DeprecationWarning" + os_helper.FS_NONASCII
         rc, stdout, stderr = assert_python_ok("-c",
             "import sys; sys.stdout.write(str(sys.warnoptions))",
             PYTHONIOENCODING="utf-8",
@@ -1218,7 +1224,7 @@
         # "import encodings" emits a warning whereas the warnings is not loaded
         # or not completely loaded (warnings imports indirectly encodings by
         # importing linecache) yet
-        with support.temp_cwd() as cwd, support.temp_cwd('encodings'):
+        with os_helper.temp_cwd() as cwd, os_helper.temp_cwd('encodings'):
             # encodings loaded by initfsencoding()
             assert_python_ok('-c', 'pass', PYTHONPATH=cwd)
 
diff --git a/Lib/test/test_wave.py b/Lib/test/test_wave.py
index eb231cb..f85e40b 100644
--- a/Lib/test/test_wave.py
+++ b/Lib/test/test_wave.py
@@ -107,8 +107,7 @@
 
 class MiscTestCase(unittest.TestCase):
     def test__all__(self):
-        blacklist = {'WAVE_FORMAT_PCM'}
-        support.check__all__(self, wave, blacklist=blacklist)
+        support.check__all__(self, wave, not_exported={'WAVE_FORMAT_PCM'})
 
 
 class WaveLowLevelTest(unittest.TestCase):
diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py
index 56a42f0..096833d 100644
--- a/Lib/test/test_weakref.py
+++ b/Lib/test/test_weakref.py
@@ -12,6 +12,7 @@
 
 from test import support
 from test.support import script_helper, ALWAYS_EQ
+from test.support import gc_collect
 
 # Used in ReferencesTestCase.test_ref_created_during_del() .
 ref_from_del = None
@@ -135,6 +136,7 @@
         ref1 = weakref.ref(o, self.callback)
         ref2 = weakref.ref(o, self.callback)
         del o
+        gc_collect()  # For PyPy or other GCs.
         self.assertIsNone(ref1(), "expected reference to be invalidated")
         self.assertIsNone(ref2(), "expected reference to be invalidated")
         self.assertEqual(self.cbcalled, 2,
@@ -168,13 +170,16 @@
         ref1 = weakref.proxy(o, self.callback)
         ref2 = weakref.proxy(o, self.callback)
         del o
+        gc_collect()  # For PyPy or other GCs.
 
         def check(proxy):
             proxy.bar
 
         self.assertRaises(ReferenceError, check, ref1)
         self.assertRaises(ReferenceError, check, ref2)
-        self.assertRaises(ReferenceError, bool, weakref.proxy(C()))
+        ref3 = weakref.proxy(C())
+        gc_collect()  # For PyPy or other GCs.
+        self.assertRaises(ReferenceError, bool, ref3)
         self.assertEqual(self.cbcalled, 2)
 
     def check_basic_ref(self, factory):
@@ -191,6 +196,7 @@
         o = factory()
         ref = weakref.ref(o, self.callback)
         del o
+        gc_collect()  # For PyPy or other GCs.
         self.assertEqual(self.cbcalled, 1,
                      "callback did not properly set 'cbcalled'")
         self.assertIsNone(ref(),
@@ -215,6 +221,7 @@
         self.assertEqual(weakref.getweakrefcount(o), 2,
                      "wrong weak ref count for object")
         del proxy
+        gc_collect()  # For PyPy or other GCs.
         self.assertEqual(weakref.getweakrefcount(o), 1,
                      "wrong weak ref count for object after deleting proxy")
 
@@ -411,6 +418,36 @@
             # can be killed in the middle of the call
             "blech" in p
 
+    def test_proxy_next(self):
+        arr = [4, 5, 6]
+        def iterator_func():
+            yield from arr
+        it = iterator_func()
+
+        class IteratesWeakly:
+            def __iter__(self):
+                return weakref.proxy(it)
+
+        weak_it = IteratesWeakly()
+
+        # Calls proxy.__next__
+        self.assertEqual(list(weak_it), [4, 5, 6])
+
+    def test_proxy_bad_next(self):
+        # bpo-44720: PyIter_Next() shouldn't be called if the reference
+        # isn't an iterator.
+
+        not_an_iterator = lambda: 0
+
+        class A:
+            def __iter__(self):
+                return weakref.proxy(not_an_iterator)
+        a = A()
+
+        msg = "Weakref proxy referenced a non-iterator"
+        with self.assertRaisesRegex(TypeError, msg):
+            list(a)
+
     def test_proxy_reversed(self):
         class MyObj:
             def __len__(self):
@@ -422,14 +459,20 @@
         self.assertEqual("".join(reversed(weakref.proxy(obj))), "cba")
 
     def test_proxy_hash(self):
-        cool_hash = 299_792_458
-
         class MyObj:
             def __hash__(self):
-                return cool_hash
+                return 42
 
         obj = MyObj()
-        self.assertEqual(hash(weakref.proxy(obj)), cool_hash)
+        with self.assertRaises(TypeError):
+            hash(weakref.proxy(obj))
+
+        class MyObj:
+            __hash__ = None
+
+        obj = MyObj()
+        with self.assertRaises(TypeError):
+            hash(weakref.proxy(obj))
 
     def test_getweakrefcount(self):
         o = C()
@@ -444,6 +487,7 @@
                      "got wrong number of weak reference objects")
 
         del ref1, ref2, proxy1, proxy2
+        gc_collect()  # For PyPy or other GCs.
         self.assertEqual(weakref.getweakrefcount(o), 0,
                      "weak reference objects not unlinked from"
                      " referent when discarded.")
@@ -457,6 +501,7 @@
         ref1 = weakref.ref(o, self.callback)
         ref2 = weakref.ref(o, self.callback)
         del ref1
+        gc_collect()  # For PyPy or other GCs.
         self.assertEqual(weakref.getweakrefs(o), [ref2],
                      "list of refs does not match")
 
@@ -464,10 +509,12 @@
         ref1 = weakref.ref(o, self.callback)
         ref2 = weakref.ref(o, self.callback)
         del ref2
+        gc_collect()  # For PyPy or other GCs.
         self.assertEqual(weakref.getweakrefs(o), [ref1],
                      "list of refs does not match")
 
         del ref1
+        gc_collect()  # For PyPy or other GCs.
         self.assertEqual(weakref.getweakrefs(o), [],
                      "list of refs not cleared")
 
@@ -953,6 +1000,7 @@
         self.assertTrue(mr.called)
         self.assertEqual(mr.value, 24)
         del o
+        gc_collect()  # For PyPy or other GCs.
         self.assertIsNone(mr())
         self.assertTrue(mr.called)
 
@@ -1255,15 +1303,18 @@
         del items1, items2
         self.assertEqual(len(dict), self.COUNT)
         del objects[0]
+        gc_collect()  # For PyPy or other GCs.
         self.assertEqual(len(dict), self.COUNT - 1,
                      "deleting object did not cause dictionary update")
         del objects, o
+        gc_collect()  # For PyPy or other GCs.
         self.assertEqual(len(dict), 0,
                      "deleting the values did not clear the dictionary")
         # regression on SF bug #447152:
         dict = weakref.WeakValueDictionary()
         self.assertRaises(KeyError, dict.__getitem__, 1)
         dict[2] = C()
+        gc_collect()  # For PyPy or other GCs.
         self.assertRaises(KeyError, dict.__getitem__, 2)
 
     def test_weak_keys(self):
@@ -1284,9 +1335,11 @@
         del items1, items2
         self.assertEqual(len(dict), self.COUNT)
         del objects[0]
+        gc_collect()  # For PyPy or other GCs.
         self.assertEqual(len(dict), (self.COUNT - 1),
                      "deleting object did not cause dictionary update")
         del objects, o
+        gc_collect()  # For PyPy or other GCs.
         self.assertEqual(len(dict), 0,
                      "deleting the keys did not clear the dictionary")
         o = Object(42)
@@ -1419,7 +1472,7 @@
         o = Object(123456)
         with testcontext():
             n = len(dict)
-            # Since underlaying dict is ordered, first item is popped
+            # Since underlying dict is ordered, first item is popped
             dict.pop(next(dict.keys()))
             self.assertEqual(len(dict), n - 1)
             dict[o] = o
@@ -1785,6 +1838,7 @@
         for o in objs:
             count += 1
             del d[o]
+        gc_collect()  # For PyPy or other GCs.
         self.assertEqual(len(d), 0)
         self.assertEqual(count, 2)
 
@@ -2093,6 +2147,7 @@
 
 libreftest = """ Doctest for examples in the library reference: weakref.rst
 
+>>> from test.support import gc_collect
 >>> import weakref
 >>> class Dict(dict):
 ...     pass
@@ -2112,6 +2167,7 @@
 >>> o is o2
 True
 >>> del o, o2
+>>> gc_collect()  # For PyPy or other GCs.
 >>> print(r())
 None
 
@@ -2164,6 +2220,7 @@
 >>> id2obj(a_id) is a
 True
 >>> del a
+>>> gc_collect()  # For PyPy or other GCs.
 >>> try:
 ...     id2obj(a_id)
 ... except KeyError:
diff --git a/Lib/test/test_weakset.py b/Lib/test/test_weakset.py
index 49a9b5c..9b31d5f 100644
--- a/Lib/test/test_weakset.py
+++ b/Lib/test/test_weakset.py
@@ -5,6 +5,7 @@
 from collections.abc import Set, MutableSet
 import gc
 import contextlib
+from test import support
 
 
 class Foo:
@@ -48,6 +49,7 @@
         self.assertEqual(len(self.s), len(self.d))
         self.assertEqual(len(self.fs), 1)
         del self.obj
+        support.gc_collect()  # For PyPy or other GCs.
         self.assertEqual(len(self.fs), 0)
 
     def test_contains(self):
@@ -57,6 +59,7 @@
         self.assertNotIn(1, self.s)
         self.assertIn(self.obj, self.fs)
         del self.obj
+        support.gc_collect()  # For PyPy or other GCs.
         self.assertNotIn(ustr('F'), self.fs)
 
     def test_union(self):
@@ -215,6 +218,7 @@
         self.assertEqual(self.s, dup)
         self.assertRaises(TypeError, self.s.add, [])
         self.fs.add(Foo())
+        support.gc_collect()  # For PyPy or other GCs.
         self.assertTrue(len(self.fs) == 1)
         self.fs.add(self.obj)
         self.assertTrue(len(self.fs) == 1)
@@ -406,6 +410,7 @@
         n1 = len(s)
         del it
         gc.collect()
+        gc.collect()  # For PyPy or other GCs.
         n2 = len(s)
         # one item may be kept alive inside the iterator
         self.assertIn(n1, (0, 1))
diff --git a/Lib/test/test_webbrowser.py b/Lib/test/test_webbrowser.py
index 519a943..673cc99 100644
--- a/Lib/test/test_webbrowser.py
+++ b/Lib/test/test_webbrowser.py
@@ -5,6 +5,8 @@
 import subprocess
 from unittest import mock
 from test import support
+from test.support import import_helper
+from test.support import os_helper
 
 
 URL = 'http://www.example.com'
@@ -270,7 +272,7 @@
 
 class ImportTest(unittest.TestCase):
     def test_register(self):
-        webbrowser = support.import_fresh_module('webbrowser')
+        webbrowser = import_helper.import_fresh_module('webbrowser')
         self.assertIsNone(webbrowser._tryorder)
         self.assertFalse(webbrowser._browsers)
 
@@ -284,7 +286,7 @@
         self.assertEqual(webbrowser._browsers['example1'], [ExampleBrowser, None])
 
     def test_get(self):
-        webbrowser = support.import_fresh_module('webbrowser')
+        webbrowser = import_helper.import_fresh_module('webbrowser')
         self.assertIsNone(webbrowser._tryorder)
         self.assertFalse(webbrowser._browsers)
 
@@ -293,38 +295,38 @@
         self.assertIsNotNone(webbrowser._tryorder)
 
     def test_synthesize(self):
-        webbrowser = support.import_fresh_module('webbrowser')
+        webbrowser = import_helper.import_fresh_module('webbrowser')
         name = os.path.basename(sys.executable).lower()
         webbrowser.register(name, None, webbrowser.GenericBrowser(name))
         webbrowser.get(sys.executable)
 
     def test_environment(self):
-        webbrowser = support.import_fresh_module('webbrowser')
+        webbrowser = import_helper.import_fresh_module('webbrowser')
         try:
             browser = webbrowser.get().name
         except (webbrowser.Error, AttributeError) as err:
             self.skipTest(str(err))
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env["BROWSER"] = browser
-            webbrowser = support.import_fresh_module('webbrowser')
+            webbrowser = import_helper.import_fresh_module('webbrowser')
             webbrowser.get()
 
     def test_environment_preferred(self):
-        webbrowser = support.import_fresh_module('webbrowser')
+        webbrowser = import_helper.import_fresh_module('webbrowser')
         try:
             webbrowser.get()
             least_preferred_browser = webbrowser.get(webbrowser._tryorder[-1]).name
         except (webbrowser.Error, AttributeError, IndexError) as err:
             self.skipTest(str(err))
 
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env["BROWSER"] = least_preferred_browser
-            webbrowser = support.import_fresh_module('webbrowser')
+            webbrowser = import_helper.import_fresh_module('webbrowser')
             self.assertEqual(webbrowser.get().name, least_preferred_browser)
 
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env["BROWSER"] = sys.executable
-            webbrowser = support.import_fresh_module('webbrowser')
+            webbrowser = import_helper.import_fresh_module('webbrowser')
             self.assertEqual(webbrowser.get().name, sys.executable)
 
 
diff --git a/Lib/test/test_winconsoleio.py b/Lib/test/test_winconsoleio.py
index a44f7bb..70a8555 100644
--- a/Lib/test/test_winconsoleio.py
+++ b/Lib/test/test_winconsoleio.py
@@ -6,7 +6,7 @@
 import sys
 import tempfile
 import unittest
-from test import support
+from test.support import os_helper
 
 if sys.platform != 'win32':
     raise unittest.SkipTest("test only relevant on win32")
@@ -92,9 +92,11 @@
         f.close()
         f.close()
 
-        f = open('C:/con', 'rb', buffering=0)
-        self.assertIsInstance(f, ConIO)
-        f.close()
+        # bpo-45354: Windows 11 changed MS-DOS device name handling
+        if sys.getwindowsversion()[:3] < (10, 0, 22000):
+            f = open('C:/con', 'rb', buffering=0)
+            self.assertIsInstance(f, ConIO)
+            f.close()
 
     @unittest.skipIf(sys.getwindowsversion()[:2] <= (6, 1),
         "test does not work on Windows 7 and earlier")
@@ -109,12 +111,13 @@
 
     def test_conout_path(self):
         temp_path = tempfile.mkdtemp()
-        self.addCleanup(support.rmtree, temp_path)
+        self.addCleanup(os_helper.rmtree, temp_path)
 
         conout_path = os.path.join(temp_path, 'CONOUT$')
 
         with open(conout_path, 'wb', buffering=0) as f:
-            if sys.getwindowsversion()[:2] > (6, 1):
+            # bpo-45354: Windows 11 changed MS-DOS device name handling
+            if (6, 1) < sys.getwindowsversion()[:3] < (10, 0, 22000):
                 self.assertIsInstance(f, ConIO)
             else:
                 self.assertNotIsInstance(f, ConIO)
diff --git a/Lib/test/test_winreg.py b/Lib/test/test_winreg.py
index 5c25ec8..8157c2d 100644
--- a/Lib/test/test_winreg.py
+++ b/Lib/test/test_winreg.py
@@ -3,12 +3,12 @@
 
 import os, sys, errno
 import unittest
-from test import support
+from test.support import import_helper
 import threading
 from platform import machine, win32_edition
 
 # Do this first so test will be skipped if module doesn't exist
-support.import_module('winreg', required_on=['win'])
+import_helper.import_module('winreg', required_on=['win'])
 # Now import everything
 from winreg import *
 
@@ -45,7 +45,7 @@
     ("Raw Data",      b"binary\x00data",                       REG_BINARY),
     ("Big String",    "x"*(2**14-1),                           REG_SZ),
     ("Big Binary",    b"x"*(2**14),                            REG_BINARY),
-    # Two and three kanjis, meaning: "Japan" and "Japanese")
+    # Two and three kanjis, meaning: "Japan" and "Japanese".
     ("Japanese 日本", "日本語", REG_SZ),
 ]
 
@@ -489,12 +489,9 @@
         with self.assertRaises(FileNotFoundError) as ctx:
             QueryValue(HKEY_CLASSES_ROOT, 'some_value_that_does_not_exist')
 
-def test_main():
-    support.run_unittest(LocalWinregTests, RemoteWinregTests,
-                         Win64WinregTests)
 
 if __name__ == "__main__":
     if not REMOTE_NAME:
         print("Remote registry calls can be tested using",
               "'test_winreg.py --remote \\\\machine_name'")
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_winsound.py b/Lib/test/test_winsound.py
index dca77cb..3c3359b 100644
--- a/Lib/test/test_winsound.py
+++ b/Lib/test/test_winsound.py
@@ -5,9 +5,11 @@
 import unittest
 
 from test import support
+from test.support import import_helper
+
 
 support.requires('audio')
-winsound = support.import_module('winsound')
+winsound = import_helper.import_module('winsound')
 
 
 # Unless we actually have an ear in the room, we have no idea whether a sound
diff --git a/Lib/test/test_wsgiref.py b/Lib/test/test_wsgiref.py
index 4bf5d39..42094f4 100644
--- a/Lib/test/test_wsgiref.py
+++ b/Lib/test/test_wsgiref.py
@@ -1,6 +1,7 @@
 from unittest import mock
 from test import support
 from test.support import socket_helper
+from test.support import warnings_helper
 from test.test_httpservers import NoLogRequestHandler
 from unittest import TestCase
 from wsgiref.util import setup_testing_defaults
@@ -339,7 +340,7 @@
         util.setup_testing_defaults(kw)
         self.assertEqual(util.request_uri(kw,query),uri)
 
-    @support.ignore_warnings(category=DeprecationWarning)
+    @warnings_helper.ignore_warnings(category=DeprecationWarning)
     def checkFW(self,text,size,match):
 
         def make_it(text=text,size=size):
@@ -579,7 +580,7 @@
         # Test handler.environ as a dict
         expected = {}
         setup_testing_defaults(expected)
-        # Handler inherits os_environ variables which are not overriden
+        # Handler inherits os_environ variables which are not overridden
         # by SimpleHandler.add_cgi_vars() (SimpleHandler.base_env)
         for key, value in os_environ.items():
             if key not in expected:
diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py
index 5632b8b..5a34d84 100644
--- a/Lib/test/test_xml_etree.py
+++ b/Lib/test/test_xml_etree.py
@@ -24,7 +24,12 @@
 from functools import partial
 from itertools import product, islice
 from test import support
-from test.support import TESTFN, findfile, import_fresh_module, gc_collect, swap_attr
+from test.support import os_helper
+from test.support import warnings_helper
+from test.support import findfile, gc_collect, swap_attr, swap_item
+from test.support.import_helper import import_fresh_module
+from test.support.os_helper import TESTFN
+
 
 # pyET is the pure-Python implementation.
 #
@@ -103,10 +108,23 @@
 <document>&entity;</document>
 """
 
+ATTLIST_XML = """\
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE Foo [
+<!ELEMENT foo (bar*)>
+<!ELEMENT bar (#PCDATA)*>
+<!ATTLIST bar xml:lang CDATA "eng">
+<!ENTITY qux "quux">
+]>
+<foo>
+<bar>&qux;</bar>
+</foo>
+"""
+
 def checkwarnings(*filters, quiet=False):
     def decorator(test):
         def newtest(*args, **kwargs):
-            with support.check_warnings(*filters, quiet=quiet):
+            with warnings_helper.check_warnings(*filters, quiet=quiet):
                 test(*args, **kwargs)
         functools.update_wrapper(newtest, test)
         return newtest
@@ -123,7 +141,7 @@
 
     def test_all(self):
         names = ("xml.etree.ElementTree", "_elementtree")
-        support.check__all__(self, ET, names, blacklist=("HTML_EMPTY",))
+        support.check__all__(self, ET, names, not_exported=("HTML_EMPTY",))
 
 
 def serialize(elem, to_string=True, encoding='unicode', **options):
@@ -149,12 +167,11 @@
         cls.modules = {pyET, ET}
 
     def pickleRoundTrip(self, obj, name, dumper, loader, proto):
-        save_m = sys.modules[name]
         try:
-            sys.modules[name] = dumper
-            temp = pickle.dumps(obj, proto)
-            sys.modules[name] = loader
-            result = pickle.loads(temp)
+            with swap_item(sys.modules, name, dumper):
+                temp = pickle.dumps(obj, proto)
+            with swap_item(sys.modules, name, loader):
+                result = pickle.loads(temp)
         except pickle.PicklingError as pe:
             # pyET must be second, because pyET may be (equal to) ET.
             human = dict([(ET, "cET"), (pyET, "pyET")])
@@ -162,8 +179,6 @@
                                      % (obj,
                                         human.get(dumper, dumper),
                                         human.get(loader, loader))) from pe
-        finally:
-            sys.modules[name] = save_m
         return result
 
     def assertEqualElements(self, alice, bob):
@@ -312,6 +327,9 @@
         elem.extend([e])
         self.serialize_check(elem, '<body><tag /><tag2 /></body>')
         elem.remove(e)
+        elem.extend(iter([e]))
+        self.serialize_check(elem, '<body><tag /><tag2 /></body>')
+        elem.remove(e)
 
         element = ET.Element("tag", key="value")
         self.serialize_check(element, '<tag key="value" />') # 1
@@ -601,7 +619,7 @@
             self.assertFalse(f.closed)
         self.assertEqual(str(cm.exception), "unknown event 'bogus'")
 
-        with support.check_no_resource_warning(self):
+        with warnings_helper.check_no_resource_warning(self):
             with self.assertRaises(ValueError) as cm:
                 iterparse(SIMPLE_XMLFILE, events)
             self.assertEqual(str(cm.exception), "unknown event 'bogus'")
@@ -627,19 +645,27 @@
         self.assertEqual(str(cm.exception),
                 'junk after document element: line 1, column 12')
 
-        self.addCleanup(support.unlink, TESTFN)
+        self.addCleanup(os_helper.unlink, TESTFN)
         with open(TESTFN, "wb") as f:
             f.write(b"<document />junk")
         it = iterparse(TESTFN)
         action, elem = next(it)
         self.assertEqual((action, elem.tag), ('end', 'document'))
-        with support.check_no_resource_warning(self):
+        with warnings_helper.check_no_resource_warning(self):
             with self.assertRaises(ET.ParseError) as cm:
                 next(it)
             self.assertEqual(str(cm.exception),
                     'junk after document element: line 1, column 12')
             del cm, it
 
+        # Not exhausting the iterator still closes the resource (bpo-43292)
+        with warnings_helper.check_no_resource_warning(self):
+            it = iterparse(TESTFN)
+            del it
+
+        with self.assertRaises(FileNotFoundError):
+            iterparse("nonexistent")
+
     def test_writefile(self):
         elem = ET.Element("tag")
         elem.text = "text"
@@ -740,6 +766,15 @@
                 ('end-ns', ''),
             ])
 
+    def test_initialize_parser_without_target(self):
+        # Explicit None
+        parser = ET.XMLParser(target=None)
+        self.assertIsInstance(parser.target, ET.TreeBuilder)
+
+        # Implicit None
+        parser2 = ET.XMLParser()
+        self.assertIsInstance(parser2.target, ET.TreeBuilder)
+
     def test_children(self):
         # Test Element children iteration
 
@@ -1349,6 +1384,12 @@
         self.assertEqual(serialize(root, method='html'),
                 '<cirriculum status="public" company="example"></cirriculum>')
 
+    def test_attlist_default(self):
+        # Test default attribute values; See BPO 42151.
+        root = ET.fromstring(ATTLIST_XML)
+        self.assertEqual(root[0].attrib,
+                         {'{http://www.w3.org/XML/1998/namespace}lang': 'eng'})
+
 
 class XMLPullParserTest(unittest.TestCase):
 
@@ -2159,12 +2200,6 @@
                 b"<?xml version='1.0' encoding='ascii'?>\n"
                 b'<body>t&#227;g</body>')
 
-    def test_issue3151(self):
-        e = ET.XML('<prefix:localname xmlns:prefix="${stuff}"/>')
-        self.assertEqual(e.tag, '{${stuff}}localname')
-        t = ET.ElementTree(e)
-        self.assertEqual(ET.tostring(e), b'<ns0:localname xmlns:ns0="${stuff}" />')
-
     def test_issue6565(self):
         elem = ET.XML("<body><tag/></body>")
         self.assertEqual(summarize_list(elem), ['tag'])
@@ -2453,6 +2488,7 @@
         wref = weakref.ref(e, wref_cb)
         self.assertEqual(wref().tag, 'e')
         del e
+        gc_collect()  # For PyPy or other GCs.
         self.assertEqual(flag, True)
         self.assertEqual(wref(), None)
 
@@ -2847,8 +2883,12 @@
             ['tag'] * 3)
         self.assertEqual(summarize_list(e.findall('.//tag[@class="a"]')),
             ['tag'])
+        self.assertEqual(summarize_list(e.findall('.//tag[@class!="a"]')),
+            ['tag'] * 2)
         self.assertEqual(summarize_list(e.findall('.//tag[@class="b"]')),
             ['tag'] * 2)
+        self.assertEqual(summarize_list(e.findall('.//tag[@class!="b"]')),
+            ['tag'])
         self.assertEqual(summarize_list(e.findall('.//tag[@id]')),
             ['tag'])
         self.assertEqual(summarize_list(e.findall('.//section[tag]')),
@@ -2870,6 +2910,19 @@
         self.assertEqual(summarize_list(e.findall(".//section[ tag = 'subtext' ]")),
             ['section'])
 
+        # Negations of above tests. They match nothing because the sole section
+        # tag has subtext.
+        self.assertEqual(summarize_list(e.findall(".//section[tag!='subtext']")),
+            [])
+        self.assertEqual(summarize_list(e.findall(".//section[tag !='subtext']")),
+            [])
+        self.assertEqual(summarize_list(e.findall(".//section[tag!= 'subtext']")),
+            [])
+        self.assertEqual(summarize_list(e.findall(".//section[tag != 'subtext']")),
+            [])
+        self.assertEqual(summarize_list(e.findall(".//section[ tag != 'subtext' ]")),
+            [])
+
         self.assertEqual(summarize_list(e.findall(".//tag[.='subtext']")),
                          ['tag'])
         self.assertEqual(summarize_list(e.findall(".//tag[. ='subtext']")),
@@ -2885,6 +2938,24 @@
         self.assertEqual(summarize_list(e.findall(".//tag[.= ' subtext']")),
                          [])
 
+        # Negations of above tests.
+        #   Matches everything but the tag containing subtext
+        self.assertEqual(summarize_list(e.findall(".//tag[.!='subtext']")),
+                         ['tag'] * 3)
+        self.assertEqual(summarize_list(e.findall(".//tag[. !='subtext']")),
+                         ['tag'] * 3)
+        self.assertEqual(summarize_list(e.findall('.//tag[.!= "subtext"]')),
+                         ['tag'] * 3)
+        self.assertEqual(summarize_list(e.findall('.//tag[ . != "subtext" ]')),
+                         ['tag'] * 3)
+        self.assertEqual(summarize_list(e.findall(".//tag[. != 'subtext']")),
+                         ['tag'] * 3)
+        # Matches all tags.
+        self.assertEqual(summarize_list(e.findall(".//tag[. != 'subtext ']")),
+                         ['tag'] * 4)
+        self.assertEqual(summarize_list(e.findall(".//tag[.!= ' subtext']")),
+                         ['tag'] * 4)
+
         # duplicate section => 2x tag matches
         e[1] = e[2]
         self.assertEqual(summarize_list(e.findall(".//section[tag = 'subtext']")),
@@ -3271,7 +3342,7 @@
         self._check_element_factory_class(MyElement)
 
     def test_element_factory_pure_python_subclass(self):
-        # Mimick SimpleTAL's behaviour (issue #16089): both versions of
+        # Mimic SimpleTAL's behaviour (issue #16089): both versions of
         # TreeBuilder should be able to cope with a subclass of the
         # pure Python Element class.
         base = ET._Element_Py
@@ -3641,14 +3712,14 @@
                      "<tag key=\"åöö&lt;&gt;\" />" % enc).encode(enc))
 
     def test_write_to_filename(self):
-        self.addCleanup(support.unlink, TESTFN)
+        self.addCleanup(os_helper.unlink, TESTFN)
         tree = ET.ElementTree(ET.XML('''<site />'''))
         tree.write(TESTFN)
         with open(TESTFN, 'rb') as f:
             self.assertEqual(f.read(), b'''<site />''')
 
     def test_write_to_text_file(self):
-        self.addCleanup(support.unlink, TESTFN)
+        self.addCleanup(os_helper.unlink, TESTFN)
         tree = ET.ElementTree(ET.XML('''<site />'''))
         with open(TESTFN, 'w', encoding='utf-8') as f:
             tree.write(f, encoding='unicode')
@@ -3657,7 +3728,7 @@
             self.assertEqual(f.read(), b'''<site />''')
 
     def test_write_to_binary_file(self):
-        self.addCleanup(support.unlink, TESTFN)
+        self.addCleanup(os_helper.unlink, TESTFN)
         tree = ET.ElementTree(ET.XML('''<site />'''))
         with open(TESTFN, 'wb') as f:
             tree.write(f)
@@ -3666,7 +3737,7 @@
             self.assertEqual(f.read(), b'''<site />''')
 
     def test_write_to_binary_file_with_bom(self):
-        self.addCleanup(support.unlink, TESTFN)
+        self.addCleanup(os_helper.unlink, TESTFN)
         tree = ET.ElementTree(ET.XML('''<site />'''))
         # test BOM writing to buffered file
         with open(TESTFN, 'wb') as f:
diff --git a/Lib/test/test_xml_etree_c.py b/Lib/test/test_xml_etree_c.py
index e26e171..bec8208 100644
--- a/Lib/test/test_xml_etree_c.py
+++ b/Lib/test/test_xml_etree_c.py
@@ -2,7 +2,7 @@
 import io
 import struct
 from test import support
-from test.support import import_fresh_module
+from test.support.import_helper import import_fresh_module
 import types
 import unittest
 
@@ -169,6 +169,18 @@
         del parser
         support.gc_collect()
 
+    def test_dict_disappearing_during_get_item(self):
+        # test fix for seg fault reported in issue 27946
+        class X:
+            def __hash__(self):
+                e.attrib = {} # this frees e->extra->attrib
+                [{i: i} for i in range(1000)] # exhaust the dict keys cache
+                return 13
+
+        e = cET.Element("elem", {1: 2})
+        r = e.get(X())
+        self.assertIsNone(r)
+
 
 @unittest.skipUnless(cET, 'requires _elementtree')
 class TestAliasWorking(unittest.TestCase):
diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py
index f68af52..1f06f5f 100644
--- a/Lib/test/test_xmlrpc.py
+++ b/Lib/test/test_xmlrpc.py
@@ -15,7 +15,9 @@
 import io
 import contextlib
 from test import support
+from test.support import os_helper
 from test.support import socket_helper
+from test.support import threading_helper
 from test.support import ALWAYS_EQ, LARGEST, SMALLEST
 
 try:
@@ -559,7 +561,7 @@
 
 class BinaryTestCase(unittest.TestCase):
 
-    # XXX What should str(Binary(b"\xff")) return?  I'm chosing "\xff"
+    # XXX What should str(Binary(b"\xff")) return?  I'm choosing "\xff"
     # for now (i.e. interpreting the binary data as Latin-1-encoded
     # text).  But this feels very unsatisfactory.  Perhaps we should
     # only define repr(), and return r"Binary(b'\xff')" instead?
@@ -646,7 +648,7 @@
             serv.handle_request()
             numrequests -= 1
 
-    except socket.timeout:
+    except TimeoutError:
         pass
     finally:
         serv.socket.close()
@@ -696,11 +698,16 @@
         #on AF_INET only.
         URL = "http://%s:%d"%(ADDR, PORT)
         serv.server_activate()
-        paths = ["/foo", "/foo/bar"]
+        paths = [
+            "/foo", "/foo/bar",
+            "/foo?k=v", "/foo#frag", "/foo?k=v#frag",
+            "", "/", "/RPC2", "?k=v", "#frag",
+        ]
         for path in paths:
             d = serv.add_dispatcher(path, xmlrpc.server.SimpleXMLRPCDispatcher())
             d.register_introspection_functions()
             d.register_multicall_functions()
+            d.register_function(lambda p=path: p, 'test')
         serv.get_dispatcher(paths[0]).register_function(pow)
         serv.get_dispatcher(paths[1]).register_function(lambda x,y: x+y, 'add')
         serv.add_dispatcher("/is/broken", BrokenDispatcher())
@@ -711,7 +718,7 @@
             serv.handle_request()
             numrequests -= 1
 
-    except socket.timeout:
+    except TimeoutError:
         pass
     finally:
         serv.socket.close()
@@ -1016,6 +1023,39 @@
         p = xmlrpclib.ServerProxy(URL+"/is/broken")
         self.assertRaises(xmlrpclib.Fault, p.add, 6, 8)
 
+    def test_invalid_path(self):
+        p = xmlrpclib.ServerProxy(URL+"/invalid")
+        self.assertRaises(xmlrpclib.Fault, p.add, 6, 8)
+
+    def test_path_query_fragment(self):
+        p = xmlrpclib.ServerProxy(URL+"/foo?k=v#frag")
+        self.assertEqual(p.test(), "/foo?k=v#frag")
+
+    def test_path_fragment(self):
+        p = xmlrpclib.ServerProxy(URL+"/foo#frag")
+        self.assertEqual(p.test(), "/foo#frag")
+
+    def test_path_query(self):
+        p = xmlrpclib.ServerProxy(URL+"/foo?k=v")
+        self.assertEqual(p.test(), "/foo?k=v")
+
+    def test_empty_path(self):
+        p = xmlrpclib.ServerProxy(URL)
+        self.assertEqual(p.test(), "/RPC2")
+
+    def test_root_path(self):
+        p = xmlrpclib.ServerProxy(URL + "/")
+        self.assertEqual(p.test(), "/")
+
+    def test_empty_path_query(self):
+        p = xmlrpclib.ServerProxy(URL + "?k=v")
+        self.assertEqual(p.test(), "?k=v")
+
+    def test_empty_path_fragment(self):
+        p = xmlrpclib.ServerProxy(URL + "#frag")
+        self.assertEqual(p.test(), "#frag")
+
+
 #A test case that verifies that a server using the HTTP/1.1 keep-alive mechanism
 #does indeed serve subsequent requests on the same connection
 class BaseKeepaliveServerTestCase(BaseServerTestCase):
@@ -1371,7 +1411,7 @@
         self.cgi = None
 
     def test_cgi_get(self):
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env['REQUEST_METHOD'] = 'GET'
             # if the method is GET and no request_text is given, it runs handle_get
             # get sysout output
@@ -1403,7 +1443,7 @@
         </methodCall>
         """
 
-        with support.EnvironmentVarGuard() as env, \
+        with os_helper.EnvironmentVarGuard() as env, \
              captured_stdout(encoding=self.cgi.encoding) as data_out, \
              support.captured_stdin() as data_in:
             data_in.write(data)
@@ -1464,16 +1504,10 @@
         self.assertTrue(server.use_builtin_types)
 
 
-@support.reap_threads
-def test_main():
-    support.run_unittest(XMLRPCTestCase, HelperTestCase, DateTimeTestCase,
-            BinaryTestCase, FaultTestCase, UseBuiltinTypesTestCase,
-            SimpleServerTestCase, SimpleServerEncodingTestCase,
-            KeepaliveServerTestCase1, KeepaliveServerTestCase2,
-            GzipServerTestCase, GzipUtilTestCase, HeadersServerTestCase,
-            MultiPathServerTestCase, ServerProxyTestCase, FailingServerTestCase,
-            CGIHandlerTestCase, SimpleXMLRPCDispatcherTestCase)
+def setUpModule():
+    thread_info = threading_helper.threading_setup()
+    unittest.addModuleCleanup(threading_helper.threading_cleanup, *thread_info)
 
 
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_xmlrpc_net.py b/Lib/test/test_xmlrpc_net.py
index f3652b8..51167b2 100644
--- a/Lib/test/test_xmlrpc_net.py
+++ b/Lib/test/test_xmlrpc_net.py
@@ -5,6 +5,9 @@
 import xmlrpc.client as xmlrpclib
 
 
+support.requires("network")
+
+
 @unittest.skip('XXX: buildbot.python.org/all/xmlrpc/ is gone')
 class PythonBuildersTest(unittest.TestCase):
 
@@ -24,9 +27,5 @@
         self.assertTrue([x for x in builders if "3.x" in x], builders)
 
 
-def test_main():
-    support.requires("network")
-    support.run_unittest(PythonBuildersTest)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_xxlimited.py b/Lib/test/test_xxlimited.py
new file mode 100644
index 0000000..e3f521d
--- /dev/null
+++ b/Lib/test/test_xxlimited.py
@@ -0,0 +1,79 @@
+import unittest
+from test.support import import_helper
+import types
+
+xxlimited = import_helper.import_module('xxlimited')
+xxlimited_35 = import_helper.import_module('xxlimited_35')
+
+
+class CommonTests:
+    module: types.ModuleType
+
+    def test_xxo_new(self):
+        xxo = self.module.Xxo()
+
+    def test_xxo_attributes(self):
+        xxo = self.module.Xxo()
+        with self.assertRaises(AttributeError):
+            xxo.foo
+        with self.assertRaises(AttributeError):
+            del xxo.foo
+
+        xxo.foo = 1234
+        self.assertEqual(xxo.foo, 1234)
+
+        del xxo.foo
+        with self.assertRaises(AttributeError):
+            xxo.foo
+
+    def test_foo(self):
+        # the foo function adds 2 numbers
+        self.assertEqual(self.module.foo(1, 2), 3)
+
+    def test_str(self):
+        self.assertTrue(issubclass(self.module.Str, str))
+        self.assertIsNot(self.module.Str, str)
+
+        custom_string = self.module.Str("abcd")
+        self.assertEqual(custom_string, "abcd")
+        self.assertEqual(custom_string.upper(), "ABCD")
+
+    def test_new(self):
+        xxo = self.module.new()
+        self.assertEqual(xxo.demo("abc"), "abc")
+
+
+class TestXXLimited(CommonTests, unittest.TestCase):
+    module = xxlimited
+
+    def test_xxo_demo(self):
+        xxo = self.module.Xxo()
+        other = self.module.Xxo()
+        self.assertEqual(xxo.demo("abc"), "abc")
+        self.assertEqual(xxo.demo(xxo), xxo)
+        self.assertEqual(xxo.demo(other), other)
+        self.assertEqual(xxo.demo(0), None)
+
+    def test_error(self):
+        with self.assertRaises(self.module.Error):
+            raise self.module.Error
+
+
+class TestXXLimited35(CommonTests, unittest.TestCase):
+    module = xxlimited_35
+
+    def test_xxo_demo(self):
+        xxo = self.module.Xxo()
+        other = self.module.Xxo()
+        self.assertEqual(xxo.demo("abc"), "abc")
+        self.assertEqual(xxo.demo(0), None)
+
+    def test_roj(self):
+        # the roj function always fails
+        with self.assertRaises(SystemError):
+            self.module.roj(0)
+
+    def test_null(self):
+        null1 = self.module.Null()
+        null2 = self.module.Null()
+        self.assertNotEqual(null1, null2)
diff --git a/Lib/test/test_xxtestfuzz.py b/Lib/test/test_xxtestfuzz.py
index 15924aa..3304c6e 100644
--- a/Lib/test/test_xxtestfuzz.py
+++ b/Lib/test/test_xxtestfuzz.py
@@ -1,8 +1,8 @@
 import faulthandler
-import test.support
+from test.support import import_helper
 import unittest
 
-_xxtestfuzz = test.support.import_module('_xxtestfuzz')
+_xxtestfuzz = import_helper.import_module('_xxtestfuzz')
 
 
 class TestFuzzer(unittest.TestCase):
diff --git a/Lib/test/test_yield_from.py b/Lib/test/test_yield_from.py
index 4735ef4..d105d8c 100644
--- a/Lib/test/test_yield_from.py
+++ b/Lib/test/test_yield_from.py
@@ -938,6 +938,9 @@
                 res.append(g1.throw(MyErr))
         except StopIteration:
             pass
+        except:
+            self.assertEqual(res, [0, 1, 2, 3])
+            raise
         # Check with close
         class MyIt(object):
             def __iter__(self):
diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py
index 999197a..6e06ee6 100644
--- a/Lib/test/test_zipfile.py
+++ b/Lib/test/test_zipfile.py
@@ -1,3 +1,4 @@
+import array
 import contextlib
 import importlib.util
 import io
@@ -13,15 +14,17 @@
 import unittest
 import unittest.mock as mock
 import zipfile
+import functools
 
 
 from tempfile import TemporaryFile
 from random import randint, random, randbytes
 
 from test.support import script_helper
-from test.support import (TESTFN, findfile, unlink, rmtree, temp_dir, temp_cwd,
-                          requires_zlib, requires_bz2, requires_lzma,
-                          captured_stdout)
+from test.support import (findfile, requires_zlib, requires_bz2,
+                          requires_lzma, captured_stdout)
+from test.support.os_helper import TESTFN, unlink, rmtree, temp_dir, temp_cwd
+
 
 TESTFN2 = TESTFN + "2"
 TESTFNDIR = TESTFN + "d"
@@ -546,7 +549,7 @@
     def test_ignores_newline_at_end(self):
         with zipfile.ZipFile(TESTFN2, "w", zipfile.ZIP_STORED) as zipfp:
             zipfp.write(TESTFN, TESTFN)
-        with open(TESTFN2, 'a') as f:
+        with open(TESTFN2, 'a', encoding='utf-8') as f:
             f.write("\r\n\00\00\00")
         with zipfile.ZipFile(TESTFN2, "r") as zipfp:
             self.assertIsInstance(zipfp, zipfile.ZipFile)
@@ -555,7 +558,7 @@
         with zipfile.ZipFile(TESTFN2, "w", zipfile.ZIP_STORED) as zipfp:
             zipfp.comment = b"this is a comment"
             zipfp.write(TESTFN, TESTFN)
-        with open(TESTFN2, 'a') as f:
+        with open(TESTFN2, 'a', encoding='utf-8') as f:
             f.write("abcdef\r\n")
         with zipfile.ZipFile(TESTFN2, "r") as zipfp:
             self.assertIsInstance(zipfp, zipfile.ZipFile)
@@ -1117,6 +1120,14 @@
             self.assertRaises(ValueError, w.write, b'')
             self.assertEqual(zipf.read('test'), data)
 
+    def test_issue44439(self):
+        q = array.array('Q', [1, 2, 3, 4, 5])
+        LENGTH = len(q) * q.itemsize
+        with zipfile.ZipFile(io.BytesIO(), 'w', self.compression) as zip:
+            with zip.open('data', 'w') as data:
+                self.assertEqual(data.write(q), LENGTH)
+            self.assertEqual(zip.getinfo('data').file_size, LENGTH)
+
 class StoredWriterTests(AbstractWriterTests, unittest.TestCase):
     compression = zipfile.ZIP_STORED
 
@@ -1243,13 +1254,13 @@
     def test_write_python_directory(self):
         os.mkdir(TESTFN2)
         try:
-            with open(os.path.join(TESTFN2, "mod1.py"), "w") as fp:
+            with open(os.path.join(TESTFN2, "mod1.py"), "w", encoding='utf-8') as fp:
                 fp.write("print(42)\n")
 
-            with open(os.path.join(TESTFN2, "mod2.py"), "w") as fp:
+            with open(os.path.join(TESTFN2, "mod2.py"), "w", encoding='utf-8') as fp:
                 fp.write("print(42 * 42)\n")
 
-            with open(os.path.join(TESTFN2, "mod2.txt"), "w") as fp:
+            with open(os.path.join(TESTFN2, "mod2.txt"), "w", encoding='utf-8') as fp:
                 fp.write("bla bla bla\n")
 
             with TemporaryFile() as t, zipfile.PyZipFile(t, "w") as zipfp:
@@ -1266,10 +1277,10 @@
     def test_write_python_directory_filtered(self):
         os.mkdir(TESTFN2)
         try:
-            with open(os.path.join(TESTFN2, "mod1.py"), "w") as fp:
+            with open(os.path.join(TESTFN2, "mod1.py"), "w", encoding='utf-8') as fp:
                 fp.write("print(42)\n")
 
-            with open(os.path.join(TESTFN2, "mod2.py"), "w") as fp:
+            with open(os.path.join(TESTFN2, "mod2.py"), "w", encoding='utf-8') as fp:
                 fp.write("print(42 * 42)\n")
 
             with TemporaryFile() as t, zipfile.PyZipFile(t, "w") as zipfp:
@@ -1285,7 +1296,7 @@
 
     def test_write_non_pyfile(self):
         with TemporaryFile() as t, zipfile.PyZipFile(t, "w") as zipfp:
-            with open(TESTFN, 'w') as f:
+            with open(TESTFN, 'w', encoding='utf-8') as f:
                 f.write('most definitely not a python file')
             self.assertRaises(RuntimeError, zipfp.writepy, TESTFN)
             unlink(TESTFN)
@@ -1293,7 +1304,7 @@
     def test_write_pyfile_bad_syntax(self):
         os.mkdir(TESTFN2)
         try:
-            with open(os.path.join(TESTFN2, "mod1.py"), "w") as fp:
+            with open(os.path.join(TESTFN2, "mod1.py"), "w", encoding='utf-8') as fp:
                 fp.write("Bad syntax in python file\n")
 
             with TemporaryFile() as t, zipfile.PyZipFile(t, "w") as zipfp:
@@ -1315,7 +1326,7 @@
     def test_write_pathlike(self):
         os.mkdir(TESTFN2)
         try:
-            with open(os.path.join(TESTFN2, "mod1.py"), "w") as fp:
+            with open(os.path.join(TESTFN2, "mod1.py"), "w", encoding='utf-8') as fp:
                 fp.write("print(42)\n")
 
             with TemporaryFile() as t, zipfile.PyZipFile(t, "w") as zipfp:
@@ -1644,7 +1655,7 @@
         # On Windows, this causes the os.unlink() call to fail because the
         # underlying file is still open.  This is SF bug #412214.
         #
-        with open(TESTFN, "w") as fp:
+        with open(TESTFN, "w", encoding="utf-8") as fp:
             fp.write("this is not a legal zip file\n")
         try:
             zf = zipfile.ZipFile(TESTFN)
@@ -1654,7 +1665,7 @@
     def test_is_zip_erroneous_file(self):
         """Check that is_zipfile() correctly identifies non-zip files."""
         # - passing a filename
-        with open(TESTFN, "w") as fp:
+        with open(TESTFN, "w", encoding='utf-8') as fp:
             fp.write("this is not a legal zip file\n")
         self.assertFalse(zipfile.is_zipfile(TESTFN))
         # - passing a path-like object
@@ -1717,11 +1728,11 @@
         self.assertRaises(OSError, zipfile.ZipFile, TESTFN)
 
     def test_empty_file_raises_BadZipFile(self):
-        f = open(TESTFN, 'w')
+        f = open(TESTFN, 'w', encoding='utf-8')
         f.close()
         self.assertRaises(zipfile.BadZipFile, zipfile.ZipFile, TESTFN)
 
-        with open(TESTFN, 'w') as fp:
+        with open(TESTFN, 'w', encoding='utf-8') as fp:
             fp.write("short file")
         self.assertRaises(zipfile.BadZipFile, zipfile.ZipFile, TESTFN)
 
@@ -1739,7 +1750,7 @@
         self.assertRaises(ValueError, zipf.open, "foo.txt")
         self.assertRaises(ValueError, zipf.testzip)
         self.assertRaises(ValueError, zipf.writestr, "bogus.txt", "bogus")
-        with open(TESTFN, 'w') as f:
+        with open(TESTFN, 'w', encoding='utf-8') as f:
             f.write('zipfile test data')
         self.assertRaises(ValueError, zipf.write, TESTFN)
 
@@ -1909,7 +1920,7 @@
         # Issue 1710703: Check that opening a file with less than 22 bytes
         # raises a BadZipFile exception (rather than the previously unhelpful
         # OSError)
-        f = open(TESTFN, 'w')
+        f = open(TESTFN, 'w', encoding='utf-8')
         f.close()
         self.assertRaises(zipfile.BadZipFile, zipfile.ZipFile, TESTFN, 'r')
 
@@ -2530,7 +2541,7 @@
                 zipf.read('ones')
                 with zipf.open('ones') as zopen1:
                     pass
-        with open(os.devnull) as f:
+        with open(os.devnull, "rb") as f:
             self.assertLess(f.fileno(), 100)
 
     def test_write_while_reading(self):
@@ -2693,11 +2704,11 @@
     @requires_zlib()
     def test_create_command(self):
         self.addCleanup(unlink, TESTFN)
-        with open(TESTFN, 'w') as f:
+        with open(TESTFN, 'w', encoding='utf-8') as f:
             f.write('test 1')
         os.mkdir(TESTFNDIR)
         self.addCleanup(rmtree, TESTFNDIR)
-        with open(os.path.join(TESTFNDIR, 'file.txt'), 'w') as f:
+        with open(os.path.join(TESTFNDIR, 'file.txt'), 'w', encoding='utf-8') as f:
             f.write('test 2')
         files = [TESTFN, TESTFNDIR]
         namelist = [TESTFN, TESTFNDIR + '/', TESTFNDIR + '/file.txt']
@@ -2835,6 +2846,20 @@
     return zf
 
 
+def pass_alpharep(meth):
+    """
+    Given a method, wrap it in a for loop that invokes method
+    with each subtest.
+    """
+
+    @functools.wraps(meth)
+    def wrapper(self):
+        for alpharep in self.zipfile_alpharep():
+            meth(self, alpharep=alpharep)
+
+    return wrapper
+
+
 class TestPath(unittest.TestCase):
     def setUp(self):
         self.fixtures = contextlib.ExitStack()
@@ -2846,117 +2871,181 @@
         with self.subTest():
             yield add_dirs(build_alpharep_fixture())
 
-    def zipfile_ondisk(self):
+    def zipfile_ondisk(self, alpharep):
         tmpdir = pathlib.Path(self.fixtures.enter_context(temp_dir()))
-        for alpharep in self.zipfile_alpharep():
-            buffer = alpharep.fp
-            alpharep.close()
-            path = tmpdir / alpharep.filename
-            with path.open("wb") as strm:
-                strm.write(buffer.getvalue())
-            yield path
+        buffer = alpharep.fp
+        alpharep.close()
+        path = tmpdir / alpharep.filename
+        with path.open("wb") as strm:
+            strm.write(buffer.getvalue())
+        return path
 
-    def test_iterdir_and_types(self):
-        for alpharep in self.zipfile_alpharep():
-            root = zipfile.Path(alpharep)
-            assert root.is_dir()
-            a, b, g = root.iterdir()
-            assert a.is_file()
-            assert b.is_dir()
-            assert g.is_dir()
-            c, f, d = b.iterdir()
-            assert c.is_file() and f.is_file()
-            e, = d.iterdir()
-            assert e.is_file()
-            h, = g.iterdir()
-            i, = h.iterdir()
-            assert i.is_file()
+    @pass_alpharep
+    def test_iterdir_and_types(self, alpharep):
+        root = zipfile.Path(alpharep)
+        assert root.is_dir()
+        a, b, g = root.iterdir()
+        assert a.is_file()
+        assert b.is_dir()
+        assert g.is_dir()
+        c, f, d = b.iterdir()
+        assert c.is_file() and f.is_file()
+        (e,) = d.iterdir()
+        assert e.is_file()
+        (h,) = g.iterdir()
+        (i,) = h.iterdir()
+        assert i.is_file()
 
-    def test_subdir_is_dir(self):
-        for alpharep in self.zipfile_alpharep():
-            root = zipfile.Path(alpharep)
-            assert (root / 'b').is_dir()
-            assert (root / 'b/').is_dir()
-            assert (root / 'g').is_dir()
-            assert (root / 'g/').is_dir()
+    @pass_alpharep
+    def test_is_file_missing(self, alpharep):
+        root = zipfile.Path(alpharep)
+        assert not root.joinpath('missing.txt').is_file()
 
-    def test_open(self):
-        for alpharep in self.zipfile_alpharep():
-            root = zipfile.Path(alpharep)
-            a, b, g = root.iterdir()
-            with a.open() as strm:
-                data = strm.read()
-            assert data == "content of a"
+    @pass_alpharep
+    def test_iterdir_on_file(self, alpharep):
+        root = zipfile.Path(alpharep)
+        a, b, g = root.iterdir()
+        with self.assertRaises(ValueError):
+            a.iterdir()
 
-    def test_read(self):
-        for alpharep in self.zipfile_alpharep():
-            root = zipfile.Path(alpharep)
-            a, b, g = root.iterdir()
-            assert a.read_text() == "content of a"
-            assert a.read_bytes() == b"content of a"
+    @pass_alpharep
+    def test_subdir_is_dir(self, alpharep):
+        root = zipfile.Path(alpharep)
+        assert (root / 'b').is_dir()
+        assert (root / 'b/').is_dir()
+        assert (root / 'g').is_dir()
+        assert (root / 'g/').is_dir()
 
-    def test_joinpath(self):
-        for alpharep in self.zipfile_alpharep():
-            root = zipfile.Path(alpharep)
-            a = root.joinpath("a")
-            assert a.is_file()
-            e = root.joinpath("b").joinpath("d").joinpath("e.txt")
-            assert e.read_text() == "content of e"
+    @pass_alpharep
+    def test_open(self, alpharep):
+        root = zipfile.Path(alpharep)
+        a, b, g = root.iterdir()
+        with a.open(encoding="utf-8") as strm:
+            data = strm.read()
+        assert data == "content of a"
 
-    def test_traverse_truediv(self):
-        for alpharep in self.zipfile_alpharep():
-            root = zipfile.Path(alpharep)
-            a = root / "a"
-            assert a.is_file()
-            e = root / "b" / "d" / "e.txt"
-            assert e.read_text() == "content of e"
+    def test_open_write(self):
+        """
+        If the zipfile is open for write, it should be possible to
+        write bytes or text to it.
+        """
+        zf = zipfile.Path(zipfile.ZipFile(io.BytesIO(), mode='w'))
+        with zf.joinpath('file.bin').open('wb') as strm:
+            strm.write(b'binary contents')
+        with zf.joinpath('file.txt').open('w', encoding="utf-8") as strm:
+            strm.write('text file')
 
-    def test_pathlike_construction(self):
+    def test_open_extant_directory(self):
+        """
+        Attempting to open a directory raises IsADirectoryError.
+        """
+        zf = zipfile.Path(add_dirs(build_alpharep_fixture()))
+        with self.assertRaises(IsADirectoryError):
+            zf.joinpath('b').open()
+
+    @pass_alpharep
+    def test_open_binary_invalid_args(self, alpharep):
+        root = zipfile.Path(alpharep)
+        with self.assertRaises(ValueError):
+            root.joinpath('a.txt').open('rb', encoding='utf-8')
+        with self.assertRaises(ValueError):
+            root.joinpath('a.txt').open('rb', 'utf-8')
+
+    def test_open_missing_directory(self):
+        """
+        Attempting to open a missing directory raises FileNotFoundError.
+        """
+        zf = zipfile.Path(add_dirs(build_alpharep_fixture()))
+        with self.assertRaises(FileNotFoundError):
+            zf.joinpath('z').open()
+
+    @pass_alpharep
+    def test_read(self, alpharep):
+        root = zipfile.Path(alpharep)
+        a, b, g = root.iterdir()
+        assert a.read_text(encoding="utf-8") == "content of a"
+        assert a.read_bytes() == b"content of a"
+
+    @pass_alpharep
+    def test_joinpath(self, alpharep):
+        root = zipfile.Path(alpharep)
+        a = root.joinpath("a.txt")
+        assert a.is_file()
+        e = root.joinpath("b").joinpath("d").joinpath("e.txt")
+        assert e.read_text(encoding="utf-8") == "content of e"
+
+    @pass_alpharep
+    def test_joinpath_multiple(self, alpharep):
+        root = zipfile.Path(alpharep)
+        e = root.joinpath("b", "d", "e.txt")
+        assert e.read_text(encoding="utf-8") == "content of e"
+
+    @pass_alpharep
+    def test_traverse_truediv(self, alpharep):
+        root = zipfile.Path(alpharep)
+        a = root / "a.txt"
+        assert a.is_file()
+        e = root / "b" / "d" / "e.txt"
+        assert e.read_text(encoding="utf-8") == "content of e"
+
+    @pass_alpharep
+    def test_traverse_simplediv(self, alpharep):
+        """
+        Disable the __future__.division when testing traversal.
+        """
+        code = compile(
+            source="zipfile.Path(alpharep) / 'a'",
+            filename="(test)",
+            mode="eval",
+            dont_inherit=True,
+        )
+        eval(code)
+
+    @pass_alpharep
+    def test_pathlike_construction(self, alpharep):
         """
         zipfile.Path should be constructable from a path-like object
         """
-        for zipfile_ondisk in self.zipfile_ondisk():
-            pathlike = pathlib.Path(str(zipfile_ondisk))
-            zipfile.Path(pathlike)
+        zipfile_ondisk = self.zipfile_ondisk(alpharep)
+        pathlike = pathlib.Path(str(zipfile_ondisk))
+        zipfile.Path(pathlike)
 
-    def test_traverse_pathlike(self):
-        for alpharep in self.zipfile_alpharep():
-            root = zipfile.Path(alpharep)
-            root / pathlib.Path("a")
+    @pass_alpharep
+    def test_traverse_pathlike(self, alpharep):
+        root = zipfile.Path(alpharep)
+        root / pathlib.Path("a")
 
-    def test_parent(self):
-        for alpharep in self.zipfile_alpharep():
-            root = zipfile.Path(alpharep)
-            assert (root / 'a').parent.at == ''
-            assert (root / 'a' / 'b').parent.at == 'a/'
+    @pass_alpharep
+    def test_parent(self, alpharep):
+        root = zipfile.Path(alpharep)
+        assert (root / 'a').parent.at == ''
+        assert (root / 'a' / 'b').parent.at == 'a/'
 
-    def test_dir_parent(self):
-        for alpharep in self.zipfile_alpharep():
-            root = zipfile.Path(alpharep)
-            assert (root / 'b').parent.at == ''
-            assert (root / 'b/').parent.at == ''
+    @pass_alpharep
+    def test_dir_parent(self, alpharep):
+        root = zipfile.Path(alpharep)
+        assert (root / 'b').parent.at == ''
+        assert (root / 'b/').parent.at == ''
 
-    def test_missing_dir_parent(self):
-        for alpharep in self.zipfile_alpharep():
-            root = zipfile.Path(alpharep)
-            assert (root / 'missing dir/').parent.at == ''
+    @pass_alpharep
+    def test_missing_dir_parent(self, alpharep):
+        root = zipfile.Path(alpharep)
+        assert (root / 'missing dir/').parent.at == ''
 
-    def test_mutability(self):
+    @pass_alpharep
+    def test_mutability(self, alpharep):
         """
         If the underlying zipfile is changed, the Path object should
         reflect that change.
         """
-        for alpharep in self.zipfile_alpharep():
-            root = zipfile.Path(alpharep)
-            a, b, g = root.iterdir()
-            alpharep.writestr('foo.txt', 'foo')
-            alpharep.writestr('bar/baz.txt', 'baz')
-            assert any(
-                child.name == 'foo.txt'
-                for child in root.iterdir())
-            assert (root / 'foo.txt').read_text() == 'foo'
-            baz, = (root / 'bar').iterdir()
-            assert baz.read_text() == 'baz'
+        root = zipfile.Path(alpharep)
+        a, b, g = root.iterdir()
+        alpharep.writestr('foo.txt', 'foo')
+        alpharep.writestr('bar/baz.txt', 'baz')
+        assert any(child.name == 'foo.txt' for child in root.iterdir())
+        assert (root / 'foo.txt').read_text(encoding="utf-8") == 'foo'
+        (baz,) = (root / 'bar').iterdir()
+        assert baz.read_text(encoding="utf-8") == 'baz'
 
     HUGE_ZIPFILE_NUM_ENTRIES = 2 ** 13
 
@@ -2985,6 +3074,66 @@
         data = ['/'.join(string.ascii_lowercase + str(n)) for n in range(10000)]
         zipfile.CompleteDirs._implied_dirs(data)
 
+    @pass_alpharep
+    def test_read_does_not_close(self, alpharep):
+        alpharep = self.zipfile_ondisk(alpharep)
+        with zipfile.ZipFile(alpharep) as file:
+            for rep in range(2):
+                zipfile.Path(file, 'a.txt').read_text(encoding="utf-8")
+
+    @pass_alpharep
+    def test_subclass(self, alpharep):
+        class Subclass(zipfile.Path):
+            pass
+
+        root = Subclass(alpharep)
+        assert isinstance(root / 'b', Subclass)
+
+    @pass_alpharep
+    def test_filename(self, alpharep):
+        root = zipfile.Path(alpharep)
+        assert root.filename == pathlib.Path('alpharep.zip')
+
+    @pass_alpharep
+    def test_root_name(self, alpharep):
+        """
+        The name of the root should be the name of the zipfile
+        """
+        root = zipfile.Path(alpharep)
+        assert root.name == 'alpharep.zip' == root.filename.name
+
+    @pass_alpharep
+    def test_root_parent(self, alpharep):
+        root = zipfile.Path(alpharep)
+        assert root.parent == pathlib.Path('.')
+        root.root.filename = 'foo/bar.zip'
+        assert root.parent == pathlib.Path('foo')
+
+    @pass_alpharep
+    def test_root_unnamed(self, alpharep):
+        """
+        It is an error to attempt to get the name
+        or parent of an unnamed zipfile.
+        """
+        alpharep.filename = None
+        root = zipfile.Path(alpharep)
+        with self.assertRaises(TypeError):
+            root.name
+        with self.assertRaises(TypeError):
+            root.parent
+
+        # .name and .parent should still work on subs
+        sub = root / "b"
+        assert sub.name == "b"
+        assert sub.parent
+
+    @pass_alpharep
+    def test_inheritance(self, alpharep):
+        cls = type('PathChild', (zipfile.Path,), {})
+        for alpharep in self.zipfile_alpharep():
+            file = cls(alpharep).joinpath('some dir').parent
+            assert isinstance(file, cls)
+
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/Lib/test/test_zipfile64.py b/Lib/test/test_zipfile64.py
index 3a788de..0947013a 100644
--- a/Lib/test/test_zipfile64.py
+++ b/Lib/test/test_zipfile64.py
@@ -17,8 +17,10 @@
 
 from tempfile import TemporaryFile
 
-from test.support import TESTFN, requires_zlib
+from test.support import os_helper
+from test.support import requires_zlib
 
+TESTFN = os_helper.TESTFN
 TESTFN2 = TESTFN + "2"
 
 # How much time in seconds can pass before we print a 'Still working' message.
@@ -138,8 +140,8 @@
                 self.assertEqual(content, "%d" % (i**3 % 57))
 
     def tearDown(self):
-        support.unlink(TESTFN)
-        support.unlink(TESTFN2)
+        os_helper.unlink(TESTFN)
+        os_helper.unlink(TESTFN2)
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/Lib/test/test_zipimport.py b/Lib/test/test_zipimport.py
index 5602860..b291d53 100644
--- a/Lib/test/test_zipimport.py
+++ b/Lib/test/test_zipimport.py
@@ -7,8 +7,11 @@
 import time
 import unittest
 import unittest.mock
+import warnings
 
 from test import support
+from test.support import import_helper
+from test.support import os_helper
 
 from zipfile import ZipFile, ZipInfo, ZIP_STORED, ZIP_DEFLATED
 
@@ -34,14 +37,9 @@
 
 def make_pyc(co, mtime, size):
     data = marshal.dumps(co)
-    if type(mtime) is type(0.0):
-        # Mac mtimes need a bit of special casing
-        if mtime < 0x7fffffff:
-            mtime = int(mtime)
-        else:
-            mtime = int(-0x100000000 + int(mtime))
     pyc = (importlib.util.MAGIC_NUMBER +
-        struct.pack("<iii", 0, int(mtime), size & 0xFFFFFFFF) + data)
+        struct.pack("<iLL", 0,
+                    int(mtime) & 0xFFFF_FFFF, size & 0xFFFF_FFFF) + data)
     return pyc
 
 def module_path_to_dotted_name(path):
@@ -68,14 +66,14 @@
         self.meta_path = sys.meta_path[:]
         self.path_hooks = sys.path_hooks[:]
         sys.path_importer_cache.clear()
-        self.modules_before = support.modules_setup()
+        self.modules_before = import_helper.modules_setup()
 
     def tearDown(self):
         sys.path[:] = self.path
         sys.meta_path[:] = self.meta_path
         sys.path_hooks[:] = self.path_hooks
         sys.path_importer_cache.clear()
-        support.modules_cleanup(*self.modules_before)
+        import_helper.modules_cleanup(*self.modules_before)
 
 
 class UncompressedZipImportTestCase(ImportHooksBaseTestCase):
@@ -92,7 +90,7 @@
     def makeTree(self, files, dirName=TEMP_DIR):
         # Create a filesystem based set of modules/packages
         # defined by files under the directory dirName.
-        self.addCleanup(support.rmtree, dirName)
+        self.addCleanup(os_helper.rmtree, dirName)
 
         for name, (mtime, data) in files.items():
             path = os.path.join(dirName, name)
@@ -110,7 +108,7 @@
         # Create a zip archive based set of modules/packages
         # defined by files in the zip file zipName.  If the
         # key 'stuff' exists in kw it is prepended to the archive.
-        self.addCleanup(support.unlink, zipName)
+        self.addCleanup(os_helper.unlink, zipName)
 
         with ZipFile(zipName, "w") as z:
             for name, (mtime, data) in files.items():
@@ -239,10 +237,10 @@
         files = {TESTMOD + pyc_ext: (NOW, badmagic_pyc)}
         try:
             self.doTest(".py", files, TESTMOD)
-        except ImportError:
-            pass
-        else:
-            self.fail("expected ImportError; import from bad pyc")
+            self.fail("This should not be reached")
+        except zipimport.ZipImportError as exc:
+            self.assertIsInstance(exc.__cause__, ImportError)
+            self.assertIn("magic number", exc.__cause__.msg)
 
     def testBadMTime(self):
         badtime_pyc = bytearray(test_pyc)
@@ -253,6 +251,14 @@
                  TESTMOD + pyc_ext: (NOW, badtime_pyc)}
         self.doTest(".py", files, TESTMOD)
 
+    def test2038MTime(self):
+        # Make sure we can handle mtimes larger than what a 32-bit signed number
+        # can hold.
+        twenty_thirty_eight_pyc = make_pyc(test_co, 2**32 - 1, len(test_src))
+        files = {TESTMOD + ".py": (NOW, test_src),
+                 TESTMOD + pyc_ext: (NOW, twenty_thirty_eight_pyc)}
+        self.doTest(".py", files, TESTMOD)
+
     def testPackage(self):
         packdir = TESTPACK + os.sep
         files = {packdir + "__init__" + pyc_ext: (NOW, test_pyc),
@@ -438,7 +444,7 @@
                  packdir2 + TESTMOD + pyc_ext: (NOW, test_pyc),
                  "spam" + pyc_ext: (NOW, test_pyc)}
 
-        self.addCleanup(support.unlink, TEMP_ZIP)
+        self.addCleanup(os_helper.unlink, TEMP_ZIP)
         with ZipFile(TEMP_ZIP, "w") as z:
             for name, (mtime, data) in files.items():
                 zinfo = ZipInfo(name, time.localtime(mtime))
@@ -448,37 +454,54 @@
 
         zi = zipimport.zipimporter(TEMP_ZIP)
         self.assertEqual(zi.archive, TEMP_ZIP)
-        self.assertEqual(zi.is_package(TESTPACK), True)
+        self.assertTrue(zi.is_package(TESTPACK))
 
-        find_mod = zi.find_module('spam')
-        self.assertIsNotNone(find_mod)
-        self.assertIsInstance(find_mod, zipimport.zipimporter)
-        self.assertFalse(find_mod.is_package('spam'))
-        load_mod = find_mod.load_module('spam')
-        self.assertEqual(find_mod.get_filename('spam'), load_mod.__file__)
+        # PEP 302
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", DeprecationWarning)
+            find_mod = zi.find_module('spam')
+            self.assertIsNotNone(find_mod)
+            self.assertIsInstance(find_mod, zipimport.zipimporter)
+            self.assertFalse(find_mod.is_package('spam'))
+            load_mod = find_mod.load_module('spam')
+            self.assertEqual(find_mod.get_filename('spam'), load_mod.__file__)
 
-        mod = zi.load_module(TESTPACK)
+            mod = zi.load_module(TESTPACK)
+            self.assertEqual(zi.get_filename(TESTPACK), mod.__file__)
+
+        # PEP 451
+        spec = zi.find_spec('spam')
+        self.assertIsNotNone(spec)
+        self.assertIsInstance(spec.loader, zipimport.zipimporter)
+        self.assertFalse(spec.loader.is_package('spam'))
+        exec_mod = importlib.util.module_from_spec(spec)
+        spec.loader.exec_module(exec_mod)
+        self.assertEqual(spec.loader.get_filename('spam'), exec_mod.__file__)
+
+        spec = zi.find_spec(TESTPACK)
+        mod = importlib.util.module_from_spec(spec)
+        spec.loader.exec_module(mod)
         self.assertEqual(zi.get_filename(TESTPACK), mod.__file__)
 
         existing_pack_path = importlib.import_module(TESTPACK).__path__[0]
         expected_path_path = os.path.join(TEMP_ZIP, TESTPACK)
         self.assertEqual(existing_pack_path, expected_path_path)
 
-        self.assertEqual(zi.is_package(packdir + '__init__'), False)
-        self.assertEqual(zi.is_package(packdir + TESTPACK2), True)
-        self.assertEqual(zi.is_package(packdir2 + TESTMOD), False)
+        self.assertFalse(zi.is_package(packdir + '__init__'))
+        self.assertTrue(zi.is_package(packdir + TESTPACK2))
+        self.assertFalse(zi.is_package(packdir2 + TESTMOD))
 
         mod_path = packdir2 + TESTMOD
         mod_name = module_path_to_dotted_name(mod_path)
         mod = importlib.import_module(mod_name)
         self.assertTrue(mod_name in sys.modules)
-        self.assertEqual(zi.get_source(TESTPACK), None)
-        self.assertEqual(zi.get_source(mod_path), None)
+        self.assertIsNone(zi.get_source(TESTPACK))
+        self.assertIsNone(zi.get_source(mod_path))
         self.assertEqual(zi.get_filename(mod_path), mod.__file__)
         # To pass in the module name instead of the path, we must use the
         # right importer
-        loader = mod.__loader__
-        self.assertEqual(loader.get_source(mod_name), None)
+        loader = mod.__spec__.loader
+        self.assertIsNone(loader.get_source(mod_name))
         self.assertEqual(loader.get_filename(mod_name), mod.__file__)
 
         # test prefix and archivepath members
@@ -486,13 +509,55 @@
         self.assertEqual(zi2.archive, TEMP_ZIP)
         self.assertEqual(zi2.prefix, TESTPACK + os.sep)
 
+    def testInvalidateCaches(self):
+        packdir = TESTPACK + os.sep
+        packdir2 = packdir + TESTPACK2 + os.sep
+        files = {packdir + "__init__" + pyc_ext: (NOW, test_pyc),
+                 packdir2 + "__init__" + pyc_ext: (NOW, test_pyc),
+                 packdir2 + TESTMOD + pyc_ext: (NOW, test_pyc),
+                 "spam" + pyc_ext: (NOW, test_pyc)}
+        self.addCleanup(os_helper.unlink, TEMP_ZIP)
+        with ZipFile(TEMP_ZIP, "w") as z:
+            for name, (mtime, data) in files.items():
+                zinfo = ZipInfo(name, time.localtime(mtime))
+                zinfo.compress_type = self.compression
+                zinfo.comment = b"spam"
+                z.writestr(zinfo, data)
+
+        zi = zipimport.zipimporter(TEMP_ZIP)
+        self.assertEqual(zi._files.keys(), files.keys())
+        # Check that the file information remains accurate after reloading
+        zi.invalidate_caches()
+        self.assertEqual(zi._files.keys(), files.keys())
+        # Add a new file to the ZIP archive
+        newfile = {"spam2" + pyc_ext: (NOW, test_pyc)}
+        files.update(newfile)
+        with ZipFile(TEMP_ZIP, "a") as z:
+            for name, (mtime, data) in newfile.items():
+                zinfo = ZipInfo(name, time.localtime(mtime))
+                zinfo.compress_type = self.compression
+                zinfo.comment = b"spam"
+                z.writestr(zinfo, data)
+        # Check that we can detect the new file after invalidating the cache
+        zi.invalidate_caches()
+        self.assertEqual(zi._files.keys(), files.keys())
+        spec = zi.find_spec('spam2')
+        self.assertIsNotNone(spec)
+        self.assertIsInstance(spec.loader, zipimport.zipimporter)
+        # Check that the cached data is removed if the file is deleted
+        os.remove(TEMP_ZIP)
+        zi.invalidate_caches()
+        self.assertFalse(zi._files)
+        self.assertIsNone(zipimport._zip_directory_cache.get(zi.archive))
+        self.assertIsNone(zi.find_spec("name_does_not_matter"))
+
     def testZipImporterMethodsInSubDirectory(self):
         packdir = TESTPACK + os.sep
         packdir2 = packdir + TESTPACK2 + os.sep
         files = {packdir2 + "__init__" + pyc_ext: (NOW, test_pyc),
                  packdir2 + TESTMOD + pyc_ext: (NOW, test_pyc)}
 
-        self.addCleanup(support.unlink, TEMP_ZIP)
+        self.addCleanup(os_helper.unlink, TEMP_ZIP)
         with ZipFile(TEMP_ZIP, "w") as z:
             for name, (mtime, data) in files.items():
                 zinfo = ZipInfo(name, time.localtime(mtime))
@@ -503,40 +568,59 @@
         zi = zipimport.zipimporter(TEMP_ZIP + os.sep + packdir)
         self.assertEqual(zi.archive, TEMP_ZIP)
         self.assertEqual(zi.prefix, packdir)
-        self.assertEqual(zi.is_package(TESTPACK2), True)
-        mod = zi.load_module(TESTPACK2)
-        self.assertEqual(zi.get_filename(TESTPACK2), mod.__file__)
+        self.assertTrue(zi.is_package(TESTPACK2))
+        # PEP 302
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", DeprecationWarning)
+            mod = zi.load_module(TESTPACK2)
+            self.assertEqual(zi.get_filename(TESTPACK2), mod.__file__)
+        # PEP 451
+        spec = zi.find_spec(TESTPACK2)
+        mod = importlib.util.module_from_spec(spec)
+        spec.loader.exec_module(mod)
+        self.assertEqual(spec.loader.get_filename(TESTPACK2), mod.__file__)
 
-        self.assertEqual(
-            zi.is_package(TESTPACK2 + os.sep + '__init__'), False)
-        self.assertEqual(
-            zi.is_package(TESTPACK2 + os.sep + TESTMOD), False)
+        self.assertFalse(zi.is_package(TESTPACK2 + os.sep + '__init__'))
+        self.assertFalse(zi.is_package(TESTPACK2 + os.sep + TESTMOD))
 
         pkg_path = TEMP_ZIP + os.sep + packdir + TESTPACK2
         zi2 = zipimport.zipimporter(pkg_path)
-        find_mod_dotted = zi2.find_module(TESTMOD)
-        self.assertIsNotNone(find_mod_dotted)
-        self.assertIsInstance(find_mod_dotted, zipimport.zipimporter)
-        self.assertFalse(zi2.is_package(TESTMOD))
-        load_mod = find_mod_dotted.load_module(TESTMOD)
+        # PEP 302
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", DeprecationWarning)
+            find_mod_dotted = zi2.find_module(TESTMOD)
+            self.assertIsNotNone(find_mod_dotted)
+            self.assertIsInstance(find_mod_dotted, zipimport.zipimporter)
+            self.assertFalse(zi2.is_package(TESTMOD))
+            load_mod = find_mod_dotted.load_module(TESTMOD)
+            self.assertEqual(
+                find_mod_dotted.get_filename(TESTMOD), load_mod.__file__)
+
+        # PEP 451
+        spec = zi2.find_spec(TESTMOD)
+        self.assertIsNotNone(spec)
+        self.assertIsInstance(spec.loader, zipimport.zipimporter)
+        self.assertFalse(spec.loader.is_package(TESTMOD))
+        load_mod = importlib.util.module_from_spec(spec)
+        spec.loader.exec_module(load_mod)
         self.assertEqual(
-            find_mod_dotted.get_filename(TESTMOD), load_mod.__file__)
+            spec.loader.get_filename(TESTMOD), load_mod.__file__)
 
         mod_path = TESTPACK2 + os.sep + TESTMOD
         mod_name = module_path_to_dotted_name(mod_path)
         mod = importlib.import_module(mod_name)
         self.assertTrue(mod_name in sys.modules)
-        self.assertEqual(zi.get_source(TESTPACK2), None)
-        self.assertEqual(zi.get_source(mod_path), None)
+        self.assertIsNone(zi.get_source(TESTPACK2))
+        self.assertIsNone(zi.get_source(mod_path))
         self.assertEqual(zi.get_filename(mod_path), mod.__file__)
         # To pass in the module name instead of the path, we must use the
         # right importer.
         loader = mod.__loader__
-        self.assertEqual(loader.get_source(mod_name), None)
+        self.assertIsNone(loader.get_source(mod_name))
         self.assertEqual(loader.get_filename(mod_name), mod.__file__)
 
     def testGetData(self):
-        self.addCleanup(support.unlink, TEMP_ZIP)
+        self.addCleanup(os_helper.unlink, TEMP_ZIP)
         with ZipFile(TEMP_ZIP, "w") as z:
             z.compression = self.compression
             name = "testdata.dat"
@@ -625,8 +709,8 @@
     def doTraceback(self, module):
         try:
             module.do_raise()
-        except:
-            tb = sys.exc_info()[2].tb_next
+        except Exception as e:
+            tb = e.__traceback__.tb_next
 
             f,lno,n,line = extract_tb(tb, 1)[0]
             self.assertEqual(line, raise_src.strip())
@@ -644,20 +728,22 @@
         files = {TESTMOD + ".py": (NOW, raise_src)}
         self.doTest(None, files, TESTMOD, call=self.doTraceback)
 
-    @unittest.skipIf(support.TESTFN_UNENCODABLE is None,
+    @unittest.skipIf(os_helper.TESTFN_UNENCODABLE is None,
                      "need an unencodable filename")
     def testUnencodable(self):
-        filename = support.TESTFN_UNENCODABLE + ".zip"
-        self.addCleanup(support.unlink, filename)
+        filename = os_helper.TESTFN_UNENCODABLE + ".zip"
+        self.addCleanup(os_helper.unlink, filename)
         with ZipFile(filename, "w") as z:
             zinfo = ZipInfo(TESTMOD + ".py", time.localtime(NOW))
             zinfo.compress_type = self.compression
             z.writestr(zinfo, test_src)
-        zipimport.zipimporter(filename).load_module(TESTMOD)
+        spec = zipimport.zipimporter(filename).find_spec(TESTMOD)
+        mod = importlib.util.module_from_spec(spec)
+        spec.loader.exec_module(mod)
 
     def testBytesPath(self):
-        filename = support.TESTFN + ".zip"
-        self.addCleanup(support.unlink, filename)
+        filename = os_helper.TESTFN + ".zip"
+        self.addCleanup(os_helper.unlink, filename)
         with ZipFile(filename, "w") as z:
             zinfo = ZipInfo(TESTMOD + ".py", time.localtime(NOW))
             zinfo.compress_type = self.compression
@@ -709,12 +795,12 @@
         self.assertZipFailure('A' * 33000)
 
     def testEmptyFile(self):
-        support.unlink(TESTMOD)
-        support.create_empty_file(TESTMOD)
+        os_helper.unlink(TESTMOD)
+        os_helper.create_empty_file(TESTMOD)
         self.assertZipFailure(TESTMOD)
 
     def testFileUnreadable(self):
-        support.unlink(TESTMOD)
+        os_helper.unlink(TESTMOD)
         fd = os.open(TESTMOD, os.O_CREAT, 000)
         try:
             os.close(fd)
@@ -725,10 +811,10 @@
             # If we leave "the read-only bit" set on Windows, nothing can
             # delete TESTMOD, and later tests suffer bogus failures.
             os.chmod(TESTMOD, 0o666)
-            support.unlink(TESTMOD)
+            os_helper.unlink(TESTMOD)
 
     def testNotZipFile(self):
-        support.unlink(TESTMOD)
+        os_helper.unlink(TESTMOD)
         fp = open(TESTMOD, 'w+')
         fp.write('a' * 22)
         fp.close()
@@ -736,7 +822,7 @@
 
     # XXX: disabled until this works on Big-endian machines
     def _testBogusZipFile(self):
-        support.unlink(TESTMOD)
+        os_helper.unlink(TESTMOD)
         fp = open(TESTMOD, 'w+')
         fp.write(struct.pack('=I', 0x06054B50))
         fp.write('a' * 18)
@@ -744,17 +830,24 @@
         z = zipimport.zipimporter(TESTMOD)
 
         try:
+            with warnings.catch_warnings():
+                warnings.simplefilter("ignore", DeprecationWarning)
+                self.assertRaises(TypeError, z.load_module, None)
             self.assertRaises(TypeError, z.find_module, None)
-            self.assertRaises(TypeError, z.load_module, None)
+            self.assertRaises(TypeError, z.find_spec, None)
+            self.assertRaises(TypeError, z.exec_module, None)
             self.assertRaises(TypeError, z.is_package, None)
             self.assertRaises(TypeError, z.get_code, None)
             self.assertRaises(TypeError, z.get_data, None)
             self.assertRaises(TypeError, z.get_source, None)
 
             error = zipimport.ZipImportError
-            self.assertEqual(z.find_module('abc'), None)
+            self.assertIsNone(z.find_module('abc'))
+            self.assertIsNone(z.find_spec('abc'))
 
-            self.assertRaises(error, z.load_module, 'abc')
+            with warnings.catch_warnings():
+                warnings.simplefilter("ignore", DeprecationWarning)
+                self.assertRaises(error, z.load_module, 'abc')
             self.assertRaises(error, z.get_code, 'abc')
             self.assertRaises(OSError, z.get_data, 'abc')
             self.assertRaises(error, z.get_source, 'abc')
@@ -763,15 +856,9 @@
             zipimport._zip_directory_cache.clear()
 
 
-def test_main():
-    try:
-        support.run_unittest(
-              UncompressedZipImportTestCase,
-              CompressedZipImportTestCase,
-              BadFileZipImportTestCase,
-            )
-    finally:
-        support.unlink(TESTMOD)
+def tearDownModule():
+    os_helper.unlink(TESTMOD)
+
 
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
diff --git a/Lib/test/test_zipimport_support.py b/Lib/test/test_zipimport_support.py
index 8856101..7bf50a3 100644
--- a/Lib/test/test_zipimport_support.py
+++ b/Lib/test/test_zipimport_support.py
@@ -13,6 +13,7 @@
 import inspect
 import linecache
 import unittest
+from test.support import os_helper
 from test.support.script_helper import (spawn_python, kill_python, assert_python_ok,
                                         make_script, make_zip_script)
 
@@ -77,7 +78,7 @@
 
     def test_inspect_getsource_issue4223(self):
         test_src = "def foo(): pass\n"
-        with test.support.temp_dir() as d:
+        with os_helper.temp_dir() as d:
             init_name = make_script(d, '__init__', test_src)
             name_in_zip = os.path.join('zip_pkg',
                                        os.path.basename(init_name))
@@ -117,7 +118,7 @@
             mod_name = mod_name.replace("sample_", "sample_zipped_")
             sample_sources[mod_name] = src
 
-        with test.support.temp_dir() as d:
+        with os_helper.temp_dir() as d:
             script_name = make_script(d, 'test_zipped_doctest',
                                             test_src)
             zip_name, run_name = make_zip_script(d, 'test_zip',
@@ -192,7 +193,7 @@
                     doctest.testmod()
                     """)
         pattern = 'File "%s", line 2, in %s'
-        with test.support.temp_dir() as d:
+        with os_helper.temp_dir() as d:
             script_name = make_script(d, 'script', test_src)
             rc, out, err = assert_python_ok(script_name)
             expected = pattern % (script_name, "__main__.Test")
@@ -219,7 +220,7 @@
                     import pdb
                     pdb.Pdb(nosigint=True).runcall(f)
                     """)
-        with test.support.temp_dir() as d:
+        with os_helper.temp_dir() as d:
             script_name = make_script(d, 'script', test_src)
             p = spawn_python(script_name)
             p.stdin.write(b'l\n')
diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py
index 02509cd..cb06108 100644
--- a/Lib/test/test_zlib.py
+++ b/Lib/test/test_zlib.py
@@ -1,5 +1,6 @@
 import unittest
 from test import support
+from test.support import import_helper
 import binascii
 import copy
 import pickle
@@ -7,7 +8,8 @@
 import sys
 from test.support import bigmemtest, _1G, _4G
 
-zlib = support.import_module('zlib')
+
+zlib = import_helper.import_module('zlib')
 
 requires_Compress_copy = unittest.skipUnless(
         hasattr(zlib.compressobj(), "copy"),
@@ -127,6 +129,12 @@
         with self.assertRaisesRegex(OverflowError, 'int too large'):
             zlib.decompressobj().flush(sys.maxsize + 1)
 
+    @support.cpython_only
+    def test_disallow_instantiation(self):
+        # Ensure that the type disallows instantiation (bpo-43916)
+        support.check_disallow_instantiation(self, type(zlib.compressobj()))
+        support.check_disallow_instantiation(self, type(zlib.decompressobj()))
+
 
 class BaseCompressTestCase(object):
     def check_big_compress_buffer(self, size, compress_func):
diff --git a/Lib/test/test_zoneinfo/_support.py b/Lib/test/test_zoneinfo/_support.py
index 0fe162c..5a76c16 100644
--- a/Lib/test/test_zoneinfo/_support.py
+++ b/Lib/test/test_zoneinfo/_support.py
@@ -3,7 +3,7 @@
 import sys
 import threading
 import unittest
-from test.support import import_fresh_module
+from test.support.import_helper import import_fresh_module
 
 OS_ENV_LOCK = threading.Lock()
 TZPATH_LOCK = threading.Lock()
diff --git a/Lib/test/test_zoneinfo/test_zoneinfo.py b/Lib/test/test_zoneinfo/test_zoneinfo.py
index d4704b7..59b35ef 100644
--- a/Lib/test/test_zoneinfo/test_zoneinfo.py
+++ b/Lib/test/test_zoneinfo/test_zoneinfo.py
@@ -19,7 +19,7 @@
 
 from . import _support as test_support
 from ._support import OS_ENV_LOCK, TZPATH_TEST_LOCK, ZoneInfoTestBase
-from test.support import import_module
+from test.support.import_helper import import_module
 
 lzma = import_module('lzma')
 py_zoneinfo, c_zoneinfo = test_support.get_modules()
@@ -1403,44 +1403,50 @@
         return [self.zoneinfo_data.tzpath]
 
     def test_cache_hit(self):
-        zi_in = self.klass("Europe/Dublin")
-        pkl = pickle.dumps(zi_in)
-        zi_rt = pickle.loads(pkl)
+        for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+            with self.subTest(proto=proto):
+                zi_in = self.klass("Europe/Dublin")
+                pkl = pickle.dumps(zi_in, protocol=proto)
+                zi_rt = pickle.loads(pkl)
 
-        with self.subTest(test="Is non-pickled ZoneInfo"):
-            self.assertIs(zi_in, zi_rt)
+                with self.subTest(test="Is non-pickled ZoneInfo"):
+                    self.assertIs(zi_in, zi_rt)
 
-        zi_rt2 = pickle.loads(pkl)
-        with self.subTest(test="Is unpickled ZoneInfo"):
-            self.assertIs(zi_rt, zi_rt2)
+                zi_rt2 = pickle.loads(pkl)
+                with self.subTest(test="Is unpickled ZoneInfo"):
+                    self.assertIs(zi_rt, zi_rt2)
 
     def test_cache_miss(self):
-        zi_in = self.klass("Europe/Dublin")
-        pkl = pickle.dumps(zi_in)
+        for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+            with self.subTest(proto=proto):
+                zi_in = self.klass("Europe/Dublin")
+                pkl = pickle.dumps(zi_in, protocol=proto)
 
-        del zi_in
-        self.klass.clear_cache()  # Induce a cache miss
-        zi_rt = pickle.loads(pkl)
-        zi_rt2 = pickle.loads(pkl)
+                del zi_in
+                self.klass.clear_cache()  # Induce a cache miss
+                zi_rt = pickle.loads(pkl)
+                zi_rt2 = pickle.loads(pkl)
 
-        self.assertIs(zi_rt, zi_rt2)
+                self.assertIs(zi_rt, zi_rt2)
 
     def test_no_cache(self):
-        zi_no_cache = self.klass.no_cache("Europe/Dublin")
+        for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+            with self.subTest(proto=proto):
+                zi_no_cache = self.klass.no_cache("Europe/Dublin")
 
-        pkl = pickle.dumps(zi_no_cache)
-        zi_rt = pickle.loads(pkl)
+                pkl = pickle.dumps(zi_no_cache, protocol=proto)
+                zi_rt = pickle.loads(pkl)
 
-        with self.subTest(test="Not the pickled object"):
-            self.assertIsNot(zi_rt, zi_no_cache)
+                with self.subTest(test="Not the pickled object"):
+                    self.assertIsNot(zi_rt, zi_no_cache)
 
-        zi_rt2 = pickle.loads(pkl)
-        with self.subTest(test="Not a second unpickled object"):
-            self.assertIsNot(zi_rt, zi_rt2)
+                zi_rt2 = pickle.loads(pkl)
+                with self.subTest(test="Not a second unpickled object"):
+                    self.assertIsNot(zi_rt, zi_rt2)
 
-        zi_cache = self.klass("Europe/Dublin")
-        with self.subTest(test="Not a cached object"):
-            self.assertIsNot(zi_rt, zi_cache)
+                zi_cache = self.klass("Europe/Dublin")
+                with self.subTest(test="Not a cached object"):
+                    self.assertIsNot(zi_rt, zi_cache)
 
     def test_from_file(self):
         key = "Europe/Dublin"
@@ -1456,35 +1462,38 @@
         ]
 
         for zi, test_name in test_cases:
-            with self.subTest(test_name=test_name):
-                with self.assertRaises(pickle.PicklingError):
-                    pickle.dumps(zi)
+            for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+                with self.subTest(test_name=test_name, proto=proto):
+                    with self.assertRaises(pickle.PicklingError):
+                        pickle.dumps(zi, protocol=proto)
 
     def test_pickle_after_from_file(self):
         # This may be a bit of paranoia, but this test is to ensure that no
         # global state is maintained in order to handle the pickle cache and
         # from_file behavior, and that it is possible to interweave the
         # constructors of each of these and pickling/unpickling without issues.
-        key = "Europe/Dublin"
-        zi = self.klass(key)
+        for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+            with self.subTest(proto=proto):
+                key = "Europe/Dublin"
+                zi = self.klass(key)
 
-        pkl_0 = pickle.dumps(zi)
-        zi_rt_0 = pickle.loads(pkl_0)
-        self.assertIs(zi, zi_rt_0)
+                pkl_0 = pickle.dumps(zi, protocol=proto)
+                zi_rt_0 = pickle.loads(pkl_0)
+                self.assertIs(zi, zi_rt_0)
 
-        with open(self.zoneinfo_data.path_from_key(key), "rb") as f:
-            zi_ff = self.klass.from_file(f, key=key)
+                with open(self.zoneinfo_data.path_from_key(key), "rb") as f:
+                    zi_ff = self.klass.from_file(f, key=key)
 
-        pkl_1 = pickle.dumps(zi)
-        zi_rt_1 = pickle.loads(pkl_1)
-        self.assertIs(zi, zi_rt_1)
+                pkl_1 = pickle.dumps(zi, protocol=proto)
+                zi_rt_1 = pickle.loads(pkl_1)
+                self.assertIs(zi, zi_rt_1)
 
-        with self.assertRaises(pickle.PicklingError):
-            pickle.dumps(zi_ff)
+                with self.assertRaises(pickle.PicklingError):
+                    pickle.dumps(zi_ff, protocol=proto)
 
-        pkl_2 = pickle.dumps(zi)
-        zi_rt_2 = pickle.loads(pkl_2)
-        self.assertIs(zi, zi_rt_2)
+                pkl_2 = pickle.dumps(zi, protocol=proto)
+                zi_rt_2 = pickle.loads(pkl_2)
+                self.assertIs(zi, zi_rt_2)
 
 
 class CZoneInfoPickleTest(ZoneInfoPickleTest):
diff --git a/Lib/test/testtar.tar.xz b/Lib/test/testtar.tar.xz
new file mode 100644
index 0000000..512fa14
--- /dev/null
+++ b/Lib/test/testtar.tar.xz
Binary files differ
diff --git a/Lib/textwrap.py b/Lib/textwrap.py
index 30e693c..841de9b 100644
--- a/Lib/textwrap.py
+++ b/Lib/textwrap.py
@@ -215,8 +215,16 @@
         # If we're allowed to break long words, then do so: put as much
         # of the next chunk onto the current line as will fit.
         if self.break_long_words:
-            cur_line.append(reversed_chunks[-1][:space_left])
-            reversed_chunks[-1] = reversed_chunks[-1][space_left:]
+            end = space_left
+            chunk = reversed_chunks[-1]
+            if self.break_on_hyphens and len(chunk) > space_left:
+                # break after last hyphen, but only if there are
+                # non-hyphens before it
+                hyphen = chunk.rfind('-', 0, space_left)
+                if hyphen > 0 and any(c != '-' for c in chunk[:hyphen]):
+                    end = hyphen + 1
+            cur_line.append(chunk[:end])
+            reversed_chunks[-1] = chunk[end:]
 
         # Otherwise, we have to preserve the long word intact.  Only add
         # it to the current line if there's nothing already there --
diff --git a/Lib/threading.py b/Lib/threading.py
index d96d99a..2d89742 100644
--- a/Lib/threading.py
+++ b/Lib/threading.py
@@ -28,7 +28,7 @@
            'Event', 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Thread',
            'Barrier', 'BrokenBarrierError', 'Timer', 'ThreadError',
            'setprofile', 'settrace', 'local', 'stack_size',
-           'excepthook', 'ExceptHookArgs']
+           'excepthook', 'ExceptHookArgs', 'gettrace', 'getprofile']
 
 # Rename some stuff so "from threading import *" is safe
 _start_new_thread = _thread.start_new_thread
@@ -65,6 +65,10 @@
     global _profile_hook
     _profile_hook = func
 
+def getprofile():
+    """Get the profiler function as set by threading.setprofile()."""
+    return _profile_hook
+
 def settrace(func):
     """Set a trace function for all threads started from the threading module.
 
@@ -75,6 +79,10 @@
     global _trace_hook
     _trace_hook = func
 
+def gettrace():
+    """Get the trace function as set by threading.settrace()."""
+    return _trace_hook
+
 # Synchronization classes
 
 Lock = _allocate_lock
@@ -380,7 +388,16 @@
         """
         self.notify(len(self._waiters))
 
-    notifyAll = notify_all
+    def notifyAll(self):
+        """Wake up all threads waiting on this condition.
+
+        This method is deprecated, use notify_all() instead.
+
+        """
+        import warnings
+        warnings.warn('notifyAll() is deprecated, use notify_all() instead',
+                      DeprecationWarning, stacklevel=2)
+        self.notify_all()
 
 
 class Semaphore:
@@ -530,7 +547,16 @@
         """Return true if and only if the internal flag is true."""
         return self._flag
 
-    isSet = is_set
+    def isSet(self):
+        """Return true if and only if the internal flag is true.
+
+        This method is deprecated, use notify_all() instead.
+
+        """
+        import warnings
+        warnings.warn('isSet() is deprecated, use is_set() instead',
+                      DeprecationWarning, stacklevel=2)
+        return self.is_set()
 
     def set(self):
         """Set the internal flag to true.
@@ -608,7 +634,7 @@
         self._action = action
         self._timeout = timeout
         self._parties = parties
-        self._state = 0 #0 filling, 1, draining, -1 resetting, -2 broken
+        self._state = 0  # 0 filling, 1 draining, -1 resetting, -2 broken
         self._count = 0
 
     def wait(self, timeout=None):
@@ -745,22 +771,39 @@
 
 
 # Helper to generate new thread names
-_counter = _count().__next__
-_counter() # Consume 0 so first non-main thread has id 1.
-def _newname(template="Thread-%d"):
-    return template % _counter()
+_counter = _count(1).__next__
+def _newname(name_template):
+    return name_template % _counter()
 
-# Active thread administration
-_active_limbo_lock = _allocate_lock()
+# Active thread administration.
+#
+# bpo-44422: Use a reentrant lock to allow reentrant calls to functions like
+# threading.enumerate().
+_active_limbo_lock = RLock()
 _active = {}    # maps thread id to Thread object
 _limbo = {}
 _dangling = WeakSet()
+
 # Set of Thread._tstate_lock locks of non-daemon threads used by _shutdown()
 # to wait until all Python thread states get deleted:
 # see Thread._set_tstate_lock().
 _shutdown_locks_lock = _allocate_lock()
 _shutdown_locks = set()
 
+def _maintain_shutdown_locks():
+    """
+    Drop any shutdown locks that don't correspond to running threads anymore.
+
+    Calling this from time to time avoids an ever-growing _shutdown_locks
+    set when Thread objects are not joined explicitly. See bpo-37788.
+
+    This must be called with _shutdown_locks_lock acquired.
+    """
+    # If a lock was released, the corresponding thread has exited
+    to_remove = [lock for lock in _shutdown_locks if not lock.locked()]
+    _shutdown_locks.difference_update(to_remove)
+
+
 # Main class for threads
 
 class Thread:
@@ -800,8 +843,19 @@
         assert group is None, "group argument must be None for now"
         if kwargs is None:
             kwargs = {}
+        if name:
+            name = str(name)
+        else:
+            name = _newname("Thread-%d")
+            if target is not None:
+                try:
+                    target_name = target.__name__
+                    name += f" ({target_name})"
+                except AttributeError:
+                    pass
+
         self._target = target
-        self._name = str(name or _newname())
+        self._name = name
         self._args = args
         self._kwargs = kwargs
         if daemon is not None:
@@ -888,7 +942,7 @@
 
         """
         try:
-            if self._target:
+            if self._target is not None:
                 self._target(*self._args, **self._kwargs)
         finally:
             # Avoid a refcycle if the thread is running a function with
@@ -932,6 +986,7 @@
 
         if not self.daemon:
             with _shutdown_locks_lock:
+                _maintain_shutdown_locks()
                 _shutdown_locks.add(self._tstate_lock)
 
     def _bootstrap_inner(self):
@@ -987,7 +1042,8 @@
         self._tstate_lock = None
         if not self.daemon:
             with _shutdown_locks_lock:
-                _shutdown_locks.discard(lock)
+                # Remove our lock and other released locks from _shutdown_locks
+                _maintain_shutdown_locks()
 
     def _delete(self):
         "Remove current thread from the dict of currently running threads."
@@ -1044,11 +1100,24 @@
         # If the lock is acquired, the C code is done, and self._stop() is
         # called.  That sets ._is_stopped to True, and ._tstate_lock to None.
         lock = self._tstate_lock
-        if lock is None:  # already determined that the C code is done
+        if lock is None:
+            # already determined that the C code is done
             assert self._is_stopped
-        elif lock.acquire(block, timeout):
-            lock.release()
-            self._stop()
+            return
+
+        try:
+            if lock.acquire(block, timeout):
+                lock.release()
+                self._stop()
+        except:
+            if lock.locked():
+                # bpo-45274: lock.acquire() acquired the lock, but the function
+                # was interrupted with an exception before reaching the
+                # lock.release(). It can happen if a signal handler raises an
+                # exception, like CTRL+C which raises KeyboardInterrupt.
+                lock.release()
+                self._stop()
+            raise
 
     @property
     def name(self):
@@ -1094,8 +1163,8 @@
         """Return whether the thread is alive.
 
         This method returns True just before the run() method starts until just
-        after the run() method terminates. The module function enumerate()
-        returns a list of all alive threads.
+        after the run() method terminates. See also the module function
+        enumerate().
 
         """
         assert self._initialized, "Thread.__init__() not called"
@@ -1128,15 +1197,47 @@
         self._daemonic = daemonic
 
     def isDaemon(self):
+        """Return whether this thread is a daemon.
+
+        This method is deprecated, use the daemon attribute instead.
+
+        """
+        import warnings
+        warnings.warn('isDaemon() is deprecated, get the daemon attribute instead',
+                      DeprecationWarning, stacklevel=2)
         return self.daemon
 
     def setDaemon(self, daemonic):
+        """Set whether this thread is a daemon.
+
+        This method is deprecated, use the .daemon property instead.
+
+        """
+        import warnings
+        warnings.warn('setDaemon() is deprecated, set the daemon attribute instead',
+                      DeprecationWarning, stacklevel=2)
         self.daemon = daemonic
 
     def getName(self):
+        """Return a string used for identification purposes only.
+
+        This method is deprecated, use the name attribute instead.
+
+        """
+        import warnings
+        warnings.warn('getName() is deprecated, get the name attribute instead',
+                      DeprecationWarning, stacklevel=2)
         return self.name
 
     def setName(self, name):
+        """Set the name string for this thread.
+
+        This method is deprecated, use the name attribute instead.
+
+        """
+        import warnings
+        warnings.warn('setName() is deprecated, set the name attribute instead',
+                      DeprecationWarning, stacklevel=2)
         self.name = name
 
 
@@ -1186,6 +1287,10 @@
         stderr.flush()
 
 
+# Original value of threading.excepthook
+__excepthook__ = excepthook
+
+
 def _make_invoke_excepthook():
     # Create a local namespace to ensure that variables remain alive
     # when _invoke_excepthook() is called, even if it is called late during
@@ -1327,7 +1432,16 @@
     except KeyError:
         return _DummyThread()
 
-currentThread = current_thread
+def currentThread():
+    """Return the current Thread object, corresponding to the caller's thread of control.
+
+    This function is deprecated, use current_thread() instead.
+
+    """
+    import warnings
+    warnings.warn('currentThread() is deprecated, use current_thread() instead',
+                  DeprecationWarning, stacklevel=2)
+    return current_thread()
 
 def active_count():
     """Return the number of Thread objects currently alive.
@@ -1339,7 +1453,16 @@
     with _active_limbo_lock:
         return len(_active) + len(_limbo)
 
-activeCount = active_count
+def activeCount():
+    """Return the number of Thread objects currently alive.
+
+    This function is deprecated, use active_count() instead.
+
+    """
+    import warnings
+    warnings.warn('activeCount() is deprecated, use active_count() instead',
+                  DeprecationWarning, stacklevel=2)
+    return active_count()
 
 def _enumerate():
     # Same as enumerate(), but without the lock. Internal use only.
@@ -1400,20 +1523,29 @@
 
     global _SHUTTING_DOWN
     _SHUTTING_DOWN = True
-    # Main thread
-    tlock = _main_thread._tstate_lock
-    # The main thread isn't finished yet, so its thread state lock can't have
-    # been released.
-    assert tlock is not None
-    assert tlock.locked()
-    tlock.release()
-    _main_thread._stop()
 
     # Call registered threading atexit functions before threads are joined.
     # Order is reversed, similar to atexit.
     for atexit_call in reversed(_threading_atexits):
         atexit_call()
 
+    # Main thread
+    if _main_thread.ident == get_ident():
+        tlock = _main_thread._tstate_lock
+        # The main thread isn't finished yet, so its thread state lock can't
+        # have been released.
+        assert tlock is not None
+        assert tlock.locked()
+        tlock.release()
+        _main_thread._stop()
+    else:
+        # bpo-1596321: _shutdown() must be called in the main thread.
+        # If the threading module was not imported by the main thread,
+        # _main_thread is the thread which imported the threading module.
+        # In this case, ignore _main_thread, similar behavior than for threads
+        # spawned by C libraries or using _thread.start_new_thread().
+        pass
+
     # Join all non-deamon threads
     while True:
         with _shutdown_locks_lock:
@@ -1424,7 +1556,7 @@
             break
 
         for lock in locks:
-            # mimick Thread.join()
+            # mimic Thread.join()
             lock.acquire()
             lock.release()
 
@@ -1457,7 +1589,7 @@
     # by another (non-forked) thread.  http://bugs.python.org/issue874900
     global _active_limbo_lock, _main_thread
     global _shutdown_locks_lock, _shutdown_locks
-    _active_limbo_lock = _allocate_lock()
+    _active_limbo_lock = RLock()
 
     # fork() only copied the current thread; clear references to others.
     new_active = {}
diff --git a/Lib/timeit.py b/Lib/timeit.py
index 6c3ec01..9dfd454 100755
--- a/Lib/timeit.py
+++ b/Lib/timeit.py
@@ -72,6 +72,7 @@
     _t0 = _timer()
     for _i in _it:
         {stmt}
+        pass
     _t1 = _timer()
     return _t1 - _t0
 """
diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py
index 2175afc..fa88448 100644
--- a/Lib/tkinter/__init__.py
+++ b/Lib/tkinter/__init__.py
@@ -270,7 +270,7 @@
         )
 
 
-_support_default_root = 1
+_support_default_root = True
 _default_root = None
 
 
@@ -280,13 +280,51 @@
     Call this function to inhibit that the first instance of
     Tk is used for windows without an explicit parent window.
     """
-    global _support_default_root
-    _support_default_root = 0
-    global _default_root
+    global _support_default_root, _default_root
+    _support_default_root = False
+    # Delete, so any use of _default_root will immediately raise an exception.
+    # Rebind before deletion, so repeated calls will not fail.
     _default_root = None
     del _default_root
 
 
+def _get_default_root(what=None):
+    if not _support_default_root:
+        raise RuntimeError("No master specified and tkinter is "
+                           "configured to not support default root")
+    if _default_root is None:
+        if what:
+            raise RuntimeError(f"Too early to {what}: no default root window")
+        root = Tk()
+        assert _default_root is root
+    return _default_root
+
+
+def _get_temp_root():
+    global _support_default_root
+    if not _support_default_root:
+        raise RuntimeError("No master specified and tkinter is "
+                           "configured to not support default root")
+    root = _default_root
+    if root is None:
+        assert _support_default_root
+        _support_default_root = False
+        root = Tk()
+        _support_default_root = True
+        assert _default_root is None
+        root.withdraw()
+        root._temporary = True
+    return root
+
+
+def _destroy_temp_root(master):
+    if getattr(master, '_temporary', False):
+        try:
+            master.destroy()
+        except TclError:
+            pass
+
+
 def _tkerror(err):
     """Internal function."""
     pass
@@ -329,8 +367,8 @@
         if name is not None and not isinstance(name, str):
             raise TypeError("name must be a string")
         global _varnum
-        if not master:
-            master = _default_root
+        if master is None:
+            master = _get_default_root('create variable')
         self._root = master._root()
         self._tk = master.tk
         if name:
@@ -478,15 +516,11 @@
             self._tk.call("trace", "vinfo", self._name))]
 
     def __eq__(self, other):
-        """Comparison for equality (==).
-
-        Note: if the Variable's master matters to behavior
-        also compare self._master == other._master
-        """
         if not isinstance(other, Variable):
             return NotImplemented
-        return self.__class__.__name__ == other.__class__.__name__ \
-            and self._name == other._name
+        return (self._name == other._name
+                and self.__class__.__name__ == other.__class__.__name__
+                and self._tk == other._tk)
 
 
 class StringVar(Variable):
@@ -591,7 +625,7 @@
 
 def mainloop(n=0):
     """Run the main loop of Tcl."""
-    _default_root.tk.mainloop(n)
+    _get_default_root('run the main loop').tk.mainloop(n)
 
 
 getint = int
@@ -600,9 +634,9 @@
 
 
 def getboolean(s):
-    """Convert true and false to integer values 1 and 0."""
+    """Convert Tcl object to True or False."""
     try:
-        return _default_root.tk.getboolean(s)
+        return _get_default_root('use getboolean()').tk.getboolean(s)
     except TclError:
         raise ValueError("invalid literal for getboolean()")
 
@@ -795,7 +829,7 @@
         function which shall be called. Additional parameters
         are given as parameters to the function call.  Return
         identifier to cancel scheduling with after_cancel."""
-        if not func:
+        if func is None:
             # I'd rather use time.sleep(ms*0.001)
             self.tk.call('after', ms)
             return None
@@ -808,7 +842,11 @@
                         self.deletecommand(name)
                     except TclError:
                         pass
-            callit.__name__ = func.__name__
+            try:
+                callit.__name__ = func.__name__
+            except AttributeError:
+                # Required for callable classes (bpo-44404)
+                callit.__name__ = type(func).__name__
             name = self._register(callit)
             return self.tk.call('after', ms, name)
 
@@ -1151,8 +1189,7 @@
             self.tk.call('winfo', 'reqwidth', self._w))
 
     def winfo_rgb(self, color):
-        """Return tuple of decimal values for red, green, blue for
-        COLOR in this widget."""
+        """Return a tuple of integer RGB values in range(65536) for color in this widget."""
         return self._getints(
             self.tk.call('winfo', 'rgb', self._w, color))
 
@@ -1529,7 +1566,7 @@
     def _root(self):
         """Internal function."""
         w = self
-        while w.master: w = w.master
+        while w.master is not None: w = w.master
         return w
     _subst_format = ('%#', '%b', '%f', '%h', '%k',
              '%s', '%t', '%w', '%x', '%y',
@@ -2248,7 +2285,7 @@
         is the name of the widget class."""
         self.master = None
         self.children = {}
-        self._tkloaded = 0
+        self._tkloaded = False
         # to avoid recursions in the getattr code in case of failure, we
         # ensure that self.tk is always _something_.
         self.tk = None
@@ -2272,7 +2309,7 @@
             self._loadtk()
 
     def _loadtk(self):
-        self._tkloaded = 1
+        self._tkloaded = True
         global _default_root
         # Version sanity checks
         tk_version = self.tk.getvar('tk_version')
@@ -2293,7 +2330,7 @@
         self.tk.createcommand('exit', _exit)
         self._tclCommands.append('tkerror')
         self._tclCommands.append('exit')
-        if _support_default_root and not _default_root:
+        if _support_default_root and _default_root is None:
             _default_root = self
         self.protocol("WM_DELETE_WINDOW", self.destroy)
 
@@ -2521,12 +2558,8 @@
 
     def _setup(self, master, cnf):
         """Internal function. Sets up information about children."""
-        if _support_default_root:
-            global _default_root
-            if not master:
-                if not _default_root:
-                    _default_root = Tk()
-                master = _default_root
+        if master is None:
+            master = _get_default_root()
         self.master = master
         self.tk = master.tk
         name = None
@@ -2703,7 +2736,7 @@
         """Add tag NEWTAG to item which is closest to pixel at X, Y.
         If several match take the top-most.
         All items closer than HALO are considered overlapping (all are
-        closests). If START is specified the next below this tag is taken."""
+        closest). If START is specified the next below this tag is taken."""
         self.addtag(newtag, 'closest', x, y, halo, start)
 
     def addtag_enclosed(self, newtag, x1, y1, x2, y2):
@@ -3298,7 +3331,7 @@
         self.add('command', cnf or kw)
 
     def add_radiobutton(self, cnf={}, **kw):
-        """Addd radio menu item."""
+        """Add radio menu item."""
         self.add('radiobutton', cnf or kw)
 
     def add_separator(self, cnf={}, **kw):
@@ -3323,7 +3356,7 @@
         self.insert(index, 'command', cnf or kw)
 
     def insert_radiobutton(self, index, cnf={}, **kw):
-        """Addd radio menu item at INDEX."""
+        """Add radio menu item at INDEX."""
         self.insert(index, 'radiobutton', cnf or kw)
 
     def insert_separator(self, index, cnf={}, **kw):
@@ -3940,7 +3973,7 @@
 
     def __call__(self, *args):
         self.__var.set(self.__value)
-        if self.__callback:
+        if self.__callback is not None:
             self.__callback(self.__value, *args)
 
 
@@ -3989,10 +4022,8 @@
 
     def __init__(self, imgtype, name=None, cnf={}, master=None, **kw):
         self.name = None
-        if not master:
-            master = _default_root
-            if not master:
-                raise RuntimeError('Too early to create image')
+        if master is None:
+            master = _get_default_root('create image')
         self.tk = getattr(master, 'tk', master)
         if not name:
             Image._last_id += 1
@@ -4146,11 +4177,13 @@
 
 
 def image_names():
-    return _default_root.tk.splitlist(_default_root.tk.call('image', 'names'))
+    tk = _get_default_root('use image_names()').tk
+    return tk.splitlist(tk.call('image', 'names'))
 
 
 def image_types():
-    return _default_root.tk.splitlist(_default_root.tk.call('image', 'types'))
+    tk = _get_default_root('use image_types()').tk
+    return tk.splitlist(tk.call('image', 'types'))
 
 
 class Spinbox(Widget, XView):
diff --git a/Lib/tkinter/colorchooser.py b/Lib/tkinter/colorchooser.py
index 3cfc06f..e2fb69d 100644
--- a/Lib/tkinter/colorchooser.py
+++ b/Lib/tkinter/colorchooser.py
@@ -8,57 +8,69 @@
 # fixed initialcolor handling in August 1998
 #
 
-#
-# options (all have default values):
-#
-# - initialcolor: color to mark as selected when dialog is displayed
-#   (given as an RGB triplet or a Tk color string)
-#
-# - parent: which window to place the dialog on top of
-#
-# - title: dialog title
-#
 
 from tkinter.commondialog import Dialog
 
 __all__ = ["Chooser", "askcolor"]
 
 
-#
-# color chooser class
-
 class Chooser(Dialog):
-    "Ask for a color"
+    """Create a dialog for the tk_chooseColor command.
+
+    Args:
+        master: The master widget for this dialog.  If not provided,
+            defaults to options['parent'] (if defined).
+        options: Dictionary of options for the tk_chooseColor call.
+            initialcolor: Specifies the selected color when the
+                dialog is first displayed.  This can be a tk color
+                string or a 3-tuple of ints in the range (0, 255)
+                for an RGB triplet.
+            parent: The parent window of the color dialog.  The
+                color dialog is displayed on top of this.
+            title: A string for the title of the dialog box.
+    """
 
     command = "tk_chooseColor"
 
     def _fixoptions(self):
+        """Ensure initialcolor is a tk color string.
+
+        Convert initialcolor from a RGB triplet to a color string.
+        """
         try:
-            # make sure initialcolor is a tk color string
             color = self.options["initialcolor"]
             if isinstance(color, tuple):
-                # assume an RGB triplet
+                # Assume an RGB triplet.
                 self.options["initialcolor"] = "#%02x%02x%02x" % color
         except KeyError:
             pass
 
     def _fixresult(self, widget, result):
-        # result can be somethings: an empty tuple, an empty string or
-        # a Tcl_Obj, so this somewhat weird check handles that
-        if not result or not str(result):
-            return None, None # canceled
+        """Adjust result returned from call to tk_chooseColor.
 
-        # to simplify application code, the color chooser returns
-        # an RGB tuple together with the Tk color string
+        Return both an RGB tuple of ints in the range (0, 255) and the
+        tk color string in the form #rrggbb.
+        """
+        # Result can be many things: an empty tuple, an empty string, or
+        # a _tkinter.Tcl_Obj, so this somewhat weird check handles that.
+        if not result or not str(result):
+            return None, None  # canceled
+
+        # To simplify application code, the color chooser returns
+        # an RGB tuple together with the Tk color string.
         r, g, b = widget.winfo_rgb(result)
-        return (r/256, g/256, b/256), str(result)
+        return (r//256, g//256, b//256), str(result)
 
 
 #
 # convenience stuff
 
-def askcolor(color = None, **options):
-    "Ask for a color"
+def askcolor(color=None, **options):
+    """Display dialog window for selection of a color.
+
+    Convenience wrapper for the Chooser class.  Displays the color
+    chooser dialog with color as the initial value.
+    """
 
     if color:
         options = options.copy()
diff --git a/Lib/tkinter/commondialog.py b/Lib/tkinter/commondialog.py
index e56b5ba..e595c99 100644
--- a/Lib/tkinter/commondialog.py
+++ b/Lib/tkinter/commondialog.py
@@ -10,7 +10,7 @@
 
 __all__ = ["Dialog"]
 
-from tkinter import Frame
+from tkinter import Frame, _get_temp_root, _destroy_temp_root
 
 
 class Dialog:
@@ -18,10 +18,10 @@
     command = None
 
     def __init__(self, master=None, **options):
+        if master is None:
+            master = options.get('parent')
         self.master = master
         self.options = options
-        if not master and options.get('parent'):
-            self.master = options['parent']
 
     def _fixoptions(self):
         pass # hook
@@ -37,22 +37,17 @@
 
         self._fixoptions()
 
-        # we need a dummy widget to properly process the options
-        # (at least as long as we use Tkinter 1.63)
-        w = Frame(self.master)
-
+        master = self.master
+        if master is None:
+            master = _get_temp_root()
         try:
-
-            s = w.tk.call(self.command, *w._options(self.options))
-
-            s = self._fixresult(w, s)
-
+            self._test_callback(master)  # The function below is replaced for some tests.
+            s = master.tk.call(self.command, *master._options(self.options))
+            s = self._fixresult(master, s)
         finally:
-
-            try:
-                # get rid of the widget
-                w.destroy()
-            except:
-                pass
+            _destroy_temp_root(master)
 
         return s
+
+    def _test_callback(self, master):
+        pass
diff --git a/Lib/tkinter/dnd.py b/Lib/tkinter/dnd.py
index 3120ff3..acec61b 100644
--- a/Lib/tkinter/dnd.py
+++ b/Lib/tkinter/dnd.py
@@ -108,7 +108,7 @@
 
 def dnd_start(source, event):
     h = DndHandler(source, event)
-    if h.root:
+    if h.root is not None:
         return h
     else:
         return None
@@ -143,7 +143,7 @@
     def __del__(self):
         root = self.root
         self.root = None
-        if root:
+        if root is not None:
             try:
                 del root.__dnd
             except AttributeError:
@@ -154,25 +154,25 @@
         target_widget = self.initial_widget.winfo_containing(x, y)
         source = self.source
         new_target = None
-        while target_widget:
+        while target_widget is not None:
             try:
                 attr = target_widget.dnd_accept
             except AttributeError:
                 pass
             else:
                 new_target = attr(source, event)
-                if new_target:
+                if new_target is not None:
                     break
             target_widget = target_widget.master
         old_target = self.target
         if old_target is new_target:
-            if old_target:
+            if old_target is not None:
                 old_target.dnd_motion(source, event)
         else:
-            if old_target:
+            if old_target is not None:
                 self.target = None
                 old_target.dnd_leave(source, event)
-            if new_target:
+            if new_target is not None:
                 new_target.dnd_enter(source, event)
                 self.target = new_target
 
@@ -193,7 +193,7 @@
             self.initial_widget.unbind("<Motion>")
             widget['cursor'] = self.save_cursor
             self.target = self.source = self.initial_widget = self.root = None
-            if target:
+            if target is not None:
                 if commit:
                     target.dnd_commit(source, event)
                 else:
@@ -215,9 +215,9 @@
         if canvas is self.canvas:
             self.canvas.coords(self.id, x, y)
             return
-        if self.canvas:
+        if self.canvas is not None:
             self.detach()
-        if not canvas:
+        if canvas is None:
             return
         label = tkinter.Label(canvas, text=self.name,
                               borderwidth=2, relief="raised")
@@ -229,7 +229,7 @@
 
     def detach(self):
         canvas = self.canvas
-        if not canvas:
+        if canvas is None:
             return
         id = self.id
         label = self.label
diff --git a/Lib/tkinter/filedialog.py b/Lib/tkinter/filedialog.py
index 3ed93eb..600d0bd 100644
--- a/Lib/tkinter/filedialog.py
+++ b/Lib/tkinter/filedialog.py
@@ -24,6 +24,7 @@
 )
 from tkinter.dialog import Dialog
 from tkinter import commondialog
+from tkinter.simpledialog import _setup_dialog
 
 
 dialogstates = {}
@@ -62,6 +63,7 @@
         self.top = Toplevel(master)
         self.top.title(title)
         self.top.iconname(title)
+        _setup_dialog(self.top)
 
         self.botframe = Frame(self.top)
         self.botframe.pack(side=BOTTOM, fill=X)
diff --git a/Lib/tkinter/font.py b/Lib/tkinter/font.py
index 15ad7ab..3e24e28 100644
--- a/Lib/tkinter/font.py
+++ b/Lib/tkinter/font.py
@@ -17,10 +17,10 @@
 ITALIC = "italic"
 
 
-def nametofont(name):
+def nametofont(name, root=None):
     """Given the name of a tk named font, returns a Font representation.
     """
-    return Font(name=name, exists=True)
+    return Font(name=name, exists=True, root=root)
 
 
 class Font:
@@ -68,8 +68,8 @@
 
     def __init__(self, root=None, font=None, name=None, exists=False,
                  **options):
-        if not root:
-            root = tkinter._default_root
+        if root is None:
+            root = tkinter._get_default_root('use font')
         tk = getattr(root, 'tk', root)
         if font:
             # get actual settings corresponding to the given font
@@ -100,10 +100,14 @@
     def __str__(self):
         return self.name
 
+    def __repr__(self):
+        return f"<{self.__class__.__module__}.{self.__class__.__qualname__}" \
+               f" object {self.name!r}>"
+
     def __eq__(self, other):
         if not isinstance(other, Font):
             return NotImplemented
-        return self.name == other.name
+        return self.name == other.name and self._tk == other._tk
 
     def __getitem__(self, key):
         return self.cget(key)
@@ -179,8 +183,8 @@
 
 def families(root=None, displayof=None):
     "Get font families (as a tuple)"
-    if not root:
-        root = tkinter._default_root
+    if root is None:
+        root = tkinter._get_default_root('use font.families()')
     args = ()
     if displayof:
         args = ('-displayof', displayof)
@@ -189,8 +193,8 @@
 
 def names(root=None):
     "Get names of defined fonts (as a tuple)"
-    if not root:
-        root = tkinter._default_root
+    if root is None:
+        root = tkinter._get_default_root('use font.names()')
     return root.tk.splitlist(root.tk.call("font", "names"))
 
 
diff --git a/Lib/tkinter/simpledialog.py b/Lib/tkinter/simpledialog.py
index 8524417..538bbfc 100644
--- a/Lib/tkinter/simpledialog.py
+++ b/Lib/tkinter/simpledialog.py
@@ -24,10 +24,9 @@
 """
 
 from tkinter import *
+from tkinter import _get_temp_root, _destroy_temp_root
 from tkinter import messagebox
 
-import tkinter # used at _QueryDialog for tkinter._default_root
-
 
 class SimpleDialog:
 
@@ -41,6 +40,9 @@
         if title:
             self.root.title(title)
             self.root.iconname(title)
+
+        _setup_dialog(self.root)
+
         self.message = Message(self.root, text=text, aspect=400)
         self.message.pack(expand=1, fill=BOTH)
         self.frame = Frame(self.root)
@@ -57,36 +59,8 @@
                 b.config(relief=RIDGE, borderwidth=8)
             b.pack(side=LEFT, fill=BOTH, expand=1)
         self.root.protocol('WM_DELETE_WINDOW', self.wm_delete_window)
-        self._set_transient(master)
-
-    def _set_transient(self, master, relx=0.5, rely=0.3):
-        widget = self.root
-        widget.withdraw() # Remain invisible while we figure out the geometry
-        widget.transient(master)
-        widget.update_idletasks() # Actualize geometry information
-        if master.winfo_ismapped():
-            m_width = master.winfo_width()
-            m_height = master.winfo_height()
-            m_x = master.winfo_rootx()
-            m_y = master.winfo_rooty()
-        else:
-            m_width = master.winfo_screenwidth()
-            m_height = master.winfo_screenheight()
-            m_x = m_y = 0
-        w_width = widget.winfo_reqwidth()
-        w_height = widget.winfo_reqheight()
-        x = m_x + (m_width - w_width) * relx
-        y = m_y + (m_height - w_height) * rely
-        if x+w_width > master.winfo_screenwidth():
-            x = master.winfo_screenwidth() - w_width
-        elif x < 0:
-            x = 0
-        if y+w_height > master.winfo_screenheight():
-            y = master.winfo_screenheight() - w_height
-        elif y < 0:
-            y = 0
-        widget.geometry("+%d+%d" % (x, y))
-        widget.deiconify() # Become visible at the desired location
+        self.root.transient(master)
+        _place_window(self.root, master)
 
     def go(self):
         self.root.wait_visibility()
@@ -128,18 +102,24 @@
 
             title -- the dialog title
         '''
-        Toplevel.__init__(self, parent)
+        master = parent
+        if master is None:
+            master = _get_temp_root()
+
+        Toplevel.__init__(self, master)
 
         self.withdraw() # remain invisible for now
-        # If the master is not viewable, don't
+        # If the parent is not viewable, don't
         # make the child transient, or else it
         # would be opened withdrawn
-        if parent.winfo_viewable():
+        if parent is not None and parent.winfo_viewable():
             self.transient(parent)
 
         if title:
             self.title(title)
 
+        _setup_dialog(self)
+
         self.parent = parent
 
         self.result = None
@@ -150,16 +130,12 @@
 
         self.buttonbox()
 
-        if not self.initial_focus:
+        if self.initial_focus is None:
             self.initial_focus = self
 
         self.protocol("WM_DELETE_WINDOW", self.cancel)
 
-        if self.parent is not None:
-            self.geometry("+%d+%d" % (parent.winfo_rootx()+50,
-                                      parent.winfo_rooty()+50))
-
-        self.deiconify() # become visible now
+        _place_window(self, parent)
 
         self.initial_focus.focus_set()
 
@@ -172,6 +148,7 @@
         '''Destroy the window'''
         self.initial_focus = None
         Toplevel.destroy(self)
+        _destroy_temp_root(self.master)
 
     #
     # construction hooks
@@ -249,6 +226,44 @@
         pass # override
 
 
+# Place a toplevel window at the center of parent or screen
+# It is a Python implementation of ::tk::PlaceWindow.
+def _place_window(w, parent=None):
+    w.wm_withdraw() # Remain invisible while we figure out the geometry
+    w.update_idletasks() # Actualize geometry information
+
+    minwidth = w.winfo_reqwidth()
+    minheight = w.winfo_reqheight()
+    maxwidth = w.winfo_vrootwidth()
+    maxheight = w.winfo_vrootheight()
+    if parent is not None and parent.winfo_ismapped():
+        x = parent.winfo_rootx() + (parent.winfo_width() - minwidth) // 2
+        y = parent.winfo_rooty() + (parent.winfo_height() - minheight) // 2
+        vrootx = w.winfo_vrootx()
+        vrooty = w.winfo_vrooty()
+        x = min(x, vrootx + maxwidth - minwidth)
+        x = max(x, vrootx)
+        y = min(y, vrooty + maxheight - minheight)
+        y = max(y, vrooty)
+        if w._windowingsystem == 'aqua':
+            # Avoid the native menu bar which sits on top of everything.
+            y = max(y, 22)
+    else:
+        x = (w.winfo_screenwidth() - minwidth) // 2
+        y = (w.winfo_screenheight() - minheight) // 2
+
+    w.wm_maxsize(maxwidth, maxheight)
+    w.wm_geometry('+%d+%d' % (x, y))
+    w.wm_deiconify() # Become visible at the desired location
+
+
+def _setup_dialog(w):
+    if w._windowingsystem == "aqua":
+        w.tk.call("::tk::unsupported::MacWindowStyle", "style",
+                  w, "moveableModal", "")
+    elif w._windowingsystem == "x11":
+        w.wm_attributes("-type", "dialog")
+
 # --------------------------------------------------------------------
 # convenience dialogues
 
@@ -259,9 +274,6 @@
                  minvalue = None, maxvalue = None,
                  parent = None):
 
-        if not parent:
-            parent = tkinter._default_root
-
         self.prompt   = prompt
         self.minvalue = minvalue
         self.maxvalue = maxvalue
diff --git a/Lib/tkinter/test/runtktests.py b/Lib/tkinter/test/runtktests.py
deleted file mode 100644
index 33dc54a..0000000
--- a/Lib/tkinter/test/runtktests.py
+++ /dev/null
@@ -1,69 +0,0 @@
-"""
-Use this module to get and run all tk tests.
-
-tkinter tests should live in a package inside the directory where this file
-lives, like test_tkinter.
-Extensions also should live in packages following the same rule as above.
-"""
-
-import os
-import importlib
-import test.support
-
-this_dir_path = os.path.abspath(os.path.dirname(__file__))
-
-def is_package(path):
-    for name in os.listdir(path):
-        if name in ('__init__.py', '__init__.pyc'):
-            return True
-    return False
-
-def get_tests_modules(basepath=this_dir_path, gui=True, packages=None):
-    """This will import and yield modules whose names start with test_
-    and are inside packages found in the path starting at basepath.
-
-    If packages is specified it should contain package names that
-    want their tests collected.
-    """
-    py_ext = '.py'
-
-    for dirpath, dirnames, filenames in os.walk(basepath):
-        for dirname in list(dirnames):
-            if dirname[0] == '.':
-                dirnames.remove(dirname)
-
-        if is_package(dirpath) and filenames:
-            pkg_name = dirpath[len(basepath) + len(os.sep):].replace('/', '.')
-            if packages and pkg_name not in packages:
-                continue
-
-            filenames = filter(
-                    lambda x: x.startswith('test_') and x.endswith(py_ext),
-                    filenames)
-
-            for name in filenames:
-                try:
-                    yield importlib.import_module(
-                        ".%s.%s" % (pkg_name, name[:-len(py_ext)]),
-                        "tkinter.test")
-                except test.support.ResourceDenied:
-                    if gui:
-                        raise
-
-def get_tests(text=True, gui=True, packages=None):
-    """Yield all the tests in the modules found by get_tests_modules.
-
-    If nogui is True, only tests that do not require a GUI will be
-    returned."""
-    attrs = []
-    if text:
-        attrs.append('tests_nogui')
-    if gui:
-        attrs.append('tests_gui')
-    for module in get_tests_modules(gui=gui, packages=packages):
-        for attr in attrs:
-            for test in getattr(module, attr, ()):
-                yield test
-
-if __name__ == "__main__":
-    test.support.run_unittest(*get_tests())
diff --git a/Lib/tkinter/test/support.py b/Lib/tkinter/test/support.py
index 467a0b6..dbc47a8 100644
--- a/Lib/tkinter/test/support.py
+++ b/Lib/tkinter/test/support.py
@@ -36,6 +36,33 @@
             w.destroy()
         self.root.withdraw()
 
+
+class AbstractDefaultRootTest:
+
+    def setUp(self):
+        self._old_support_default_root = tkinter._support_default_root
+        destroy_default_root()
+        tkinter._support_default_root = True
+        self.wantobjects = tkinter.wantobjects
+
+    def tearDown(self):
+        destroy_default_root()
+        tkinter._default_root = None
+        tkinter._support_default_root = self._old_support_default_root
+
+    def _test_widget(self, constructor):
+        # no master passing
+        x = constructor()
+        self.assertIsNotNone(tkinter._default_root)
+        self.assertIs(x.master, tkinter._default_root)
+        self.assertIs(x.tk, tkinter._default_root.tk)
+        x.destroy()
+        destroy_default_root()
+        tkinter.NoDefaultRoot()
+        self.assertRaises(RuntimeError, constructor)
+        self.assertFalse(hasattr(tkinter, '_default_root'))
+
+
 def destroy_default_root():
     if getattr(tkinter, '_default_root', None):
         tkinter._default_root.update_idletasks()
diff --git a/Lib/tkinter/test/test_tkinter/test_colorchooser.py b/Lib/tkinter/test/test_tkinter/test_colorchooser.py
new file mode 100644
index 0000000..488162f
--- /dev/null
+++ b/Lib/tkinter/test/test_tkinter/test_colorchooser.py
@@ -0,0 +1,68 @@
+import unittest
+import tkinter
+from test.support import requires, swap_attr
+from tkinter.test.support import AbstractDefaultRootTest, AbstractTkTest
+from tkinter import colorchooser
+from tkinter.colorchooser import askcolor
+from tkinter.commondialog import Dialog
+
+requires('gui')
+
+
+class ChooserTest(AbstractTkTest, unittest.TestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        AbstractTkTest.setUpClass.__func__(cls)
+        cls.cc = colorchooser.Chooser(initialcolor='dark blue slate')
+
+    def test_fixoptions(self):
+        cc = self.cc
+        cc._fixoptions()
+        self.assertEqual(cc.options['initialcolor'], 'dark blue slate')
+
+        cc.options['initialcolor'] = '#D2D269691E1E'
+        cc._fixoptions()
+        self.assertEqual(cc.options['initialcolor'], '#D2D269691E1E')
+
+        cc.options['initialcolor'] = (210, 105, 30)
+        cc._fixoptions()
+        self.assertEqual(cc.options['initialcolor'], '#d2691e')
+
+    def test_fixresult(self):
+        cc = self.cc
+        self.assertEqual(cc._fixresult(self.root, ()), (None, None))
+        self.assertEqual(cc._fixresult(self.root, ''), (None, None))
+        self.assertEqual(cc._fixresult(self.root, 'chocolate'),
+                         ((210, 105, 30), 'chocolate'))
+        self.assertEqual(cc._fixresult(self.root, '#4a3c8c'),
+                         ((74, 60, 140), '#4a3c8c'))
+
+
+class DefaultRootTest(AbstractDefaultRootTest, unittest.TestCase):
+
+    def test_askcolor(self):
+        def test_callback(dialog, master):
+            nonlocal ismapped
+            master.update()
+            ismapped = master.winfo_ismapped()
+            raise ZeroDivisionError
+
+        with swap_attr(Dialog, '_test_callback', test_callback):
+            ismapped = None
+            self.assertRaises(ZeroDivisionError, askcolor)
+            #askcolor()
+            self.assertEqual(ismapped, False)
+
+            root = tkinter.Tk()
+            ismapped = None
+            self.assertRaises(ZeroDivisionError, askcolor)
+            self.assertEqual(ismapped, True)
+            root.destroy()
+
+            tkinter.NoDefaultRoot()
+            self.assertRaises(RuntimeError, askcolor)
+
+
+if __name__ == "__main__":
+    unittest.main()
diff --git a/Lib/tkinter/test/test_tkinter/test_font.py b/Lib/tkinter/test/test_tkinter/test_font.py
index a021ea3..058c53a 100644
--- a/Lib/tkinter/test/test_tkinter/test_font.py
+++ b/Lib/tkinter/test/test_tkinter/test_font.py
@@ -1,8 +1,8 @@
 import unittest
 import tkinter
 from tkinter import font
-from test.support import requires, run_unittest, gc_collect, ALWAYS_EQ
-from tkinter.test.support import AbstractTkTest
+from test.support import requires, gc_collect, ALWAYS_EQ
+from tkinter.test.support import AbstractTkTest, AbstractDefaultRootTest
 
 requires('gui')
 
@@ -63,15 +63,22 @@
         self.assertEqual(self.font.name, fontname)
         self.assertEqual(str(self.font), fontname)
 
-    def test_eq(self):
+    def test_equality(self):
         font1 = font.Font(root=self.root, name=fontname, exists=True)
         font2 = font.Font(root=self.root, name=fontname, exists=True)
         self.assertIsNot(font1, font2)
         self.assertEqual(font1, font2)
         self.assertNotEqual(font1, font1.copy())
+
         self.assertNotEqual(font1, 0)
         self.assertEqual(font1, ALWAYS_EQ)
 
+        root2 = tkinter.Tk()
+        self.addCleanup(root2.destroy)
+        font3 = font.Font(root=root2, name=fontname, exists=True)
+        self.assertEqual(str(font1), str(font3))
+        self.assertNotEqual(font1, font3)
+
     def test_measure(self):
         self.assertIsInstance(self.font.measure('abc'), int)
 
@@ -101,7 +108,56 @@
             self.assertTrue(name)
         self.assertIn(fontname, names)
 
-tests_gui = (FontTest, )
+    def test_nametofont(self):
+        testfont = font.nametofont(fontname, root=self.root)
+        self.assertIsInstance(testfont, font.Font)
+        self.assertEqual(testfont.name, fontname)
+
+    def test_repr(self):
+        self.assertEqual(
+            repr(self.font), f'<tkinter.font.Font object {fontname!r}>'
+        )
+
+
+class DefaultRootTest(AbstractDefaultRootTest, unittest.TestCase):
+
+    def test_families(self):
+        self.assertRaises(RuntimeError, font.families)
+        root = tkinter.Tk()
+        families = font.families()
+        self.assertIsInstance(families, tuple)
+        self.assertTrue(families)
+        for family in families:
+            self.assertIsInstance(family, str)
+            self.assertTrue(family)
+        root.destroy()
+        tkinter.NoDefaultRoot()
+        self.assertRaises(RuntimeError, font.families)
+
+    def test_names(self):
+        self.assertRaises(RuntimeError, font.names)
+        root = tkinter.Tk()
+        names = font.names()
+        self.assertIsInstance(names, tuple)
+        self.assertTrue(names)
+        for name in names:
+            self.assertIsInstance(name, str)
+            self.assertTrue(name)
+        self.assertIn(fontname, names)
+        root.destroy()
+        tkinter.NoDefaultRoot()
+        self.assertRaises(RuntimeError, font.names)
+
+    def test_nametofont(self):
+        self.assertRaises(RuntimeError, font.nametofont, fontname)
+        root = tkinter.Tk()
+        testfont = font.nametofont(fontname)
+        self.assertIsInstance(testfont, font.Font)
+        self.assertEqual(testfont.name, fontname)
+        root.destroy()
+        tkinter.NoDefaultRoot()
+        self.assertRaises(RuntimeError, font.nametofont, fontname)
+
 
 if __name__ == "__main__":
-    run_unittest(*tests_gui)
+    unittest.main()
diff --git a/Lib/tkinter/test/test_tkinter/test_images.py b/Lib/tkinter/test/test_tkinter/test_images.py
index 2805d35..cc69cca 100644
--- a/Lib/tkinter/test/test_tkinter/test_images.py
+++ b/Lib/tkinter/test/test_tkinter/test_images.py
@@ -1,7 +1,8 @@
 import unittest
 import tkinter
 from test import support
-from tkinter.test.support import AbstractTkTest, requires_tcl
+from test.support import os_helper
+from tkinter.test.support import AbstractTkTest, AbstractDefaultRootTest, requires_tcl
 
 support.requires('gui')
 
@@ -19,6 +20,47 @@
         self.assertIsInstance(image_names, tuple)
 
 
+class DefaultRootTest(AbstractDefaultRootTest, unittest.TestCase):
+
+    def test_image_types(self):
+        self.assertRaises(RuntimeError, tkinter.image_types)
+        root = tkinter.Tk()
+        image_types = tkinter.image_types()
+        self.assertIsInstance(image_types, tuple)
+        self.assertIn('photo', image_types)
+        self.assertIn('bitmap', image_types)
+        root.destroy()
+        tkinter.NoDefaultRoot()
+        self.assertRaises(RuntimeError, tkinter.image_types)
+
+    def test_image_names(self):
+        self.assertRaises(RuntimeError, tkinter.image_names)
+        root = tkinter.Tk()
+        image_names = tkinter.image_names()
+        self.assertIsInstance(image_names, tuple)
+        root.destroy()
+        tkinter.NoDefaultRoot()
+        self.assertRaises(RuntimeError, tkinter.image_names)
+
+    def test_image_create_bitmap(self):
+        self.assertRaises(RuntimeError, tkinter.BitmapImage)
+        root = tkinter.Tk()
+        image = tkinter.BitmapImage()
+        self.assertIn(image.name, tkinter.image_names())
+        root.destroy()
+        tkinter.NoDefaultRoot()
+        self.assertRaises(RuntimeError, tkinter.BitmapImage)
+
+    def test_image_create_photo(self):
+        self.assertRaises(RuntimeError, tkinter.PhotoImage)
+        root = tkinter.Tk()
+        image = tkinter.PhotoImage()
+        self.assertIn(image.name, tkinter.image_names())
+        root.destroy()
+        tkinter.NoDefaultRoot()
+        self.assertRaises(RuntimeError, tkinter.PhotoImage)
+
+
 class BitmapImageTest(AbstractTkTest, unittest.TestCase):
 
     @classmethod
@@ -36,6 +78,7 @@
         self.assertEqual(image.height(), 16)
         self.assertIn('::img::test', self.root.image_names())
         del image
+        support.gc_collect()  # For PyPy or other GCs.
         self.assertNotIn('::img::test', self.root.image_names())
 
     def test_create_from_data(self):
@@ -50,6 +93,7 @@
         self.assertEqual(image.height(), 16)
         self.assertIn('::img::test', self.root.image_names())
         del image
+        support.gc_collect()  # For PyPy or other GCs.
         self.assertNotIn('::img::test', self.root.image_names())
 
     def assertEqualStrList(self, actual, expected):
@@ -130,6 +174,7 @@
         self.assertEqual(image['file'], testfile)
         self.assertIn('::img::test', self.root.image_names())
         del image
+        support.gc_collect()  # For PyPy or other GCs.
         self.assertNotIn('::img::test', self.root.image_names())
 
     def check_create_from_data(self, ext):
@@ -147,6 +192,7 @@
         self.assertEqual(image['file'], '')
         self.assertIn('::img::test', self.root.image_names())
         del image
+        support.gc_collect()  # For PyPy or other GCs.
         self.assertNotIn('::img::test', self.root.image_names())
 
     def test_create_from_ppm_file(self):
@@ -296,12 +342,12 @@
 
     def test_write(self):
         image = self.create()
-        self.addCleanup(support.unlink, support.TESTFN)
+        self.addCleanup(os_helper.unlink, os_helper.TESTFN)
 
-        image.write(support.TESTFN)
+        image.write(os_helper.TESTFN)
         image2 = tkinter.PhotoImage('::img::test2', master=self.root,
                                     format='ppm',
-                                    file=support.TESTFN)
+                                    file=os_helper.TESTFN)
         self.assertEqual(str(image2), '::img::test2')
         self.assertEqual(image2.type(), 'photo')
         self.assertEqual(image2.width(), 16)
@@ -309,10 +355,10 @@
         self.assertEqual(image2.get(0, 0), image.get(0, 0))
         self.assertEqual(image2.get(15, 8), image.get(15, 8))
 
-        image.write(support.TESTFN, format='gif', from_coords=(4, 6, 6, 9))
+        image.write(os_helper.TESTFN, format='gif', from_coords=(4, 6, 6, 9))
         image3 = tkinter.PhotoImage('::img::test3', master=self.root,
                                     format='gif',
-                                    file=support.TESTFN)
+                                    file=os_helper.TESTFN)
         self.assertEqual(str(image3), '::img::test3')
         self.assertEqual(image3.type(), 'photo')
         self.assertEqual(image3.width(), 2)
@@ -330,7 +376,5 @@
         self.assertEqual(image.transparency_get(4, 6), False)
 
 
-tests_gui = (MiscTest, BitmapImageTest, PhotoImageTest,)
-
 if __name__ == "__main__":
-    support.run_unittest(*tests_gui)
+    unittest.main()
diff --git a/Lib/tkinter/test/test_tkinter/test_loadtk.py b/Lib/tkinter/test/test_tkinter/test_loadtk.py
index bab7bcd..61b0eda 100644
--- a/Lib/tkinter/test/test_tkinter/test_loadtk.py
+++ b/Lib/tkinter/test/test_tkinter/test_loadtk.py
@@ -2,6 +2,7 @@
 import sys
 import unittest
 import test.support as test_support
+from test.support import os_helper
 from tkinter import Tcl, TclError
 
 test_support.requires('gui')
@@ -24,7 +25,7 @@
             # XXX Maybe on tk older than 8.4.13 it would be possible,
             # see tkinter.h.
             return
-        with test_support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             if 'DISPLAY' in os.environ:
                 del env['DISPLAY']
                 # on some platforms, deleting environment variables
@@ -40,7 +41,6 @@
             self.assertRaises(TclError, tcl.winfo_geometry)
             self.assertRaises(TclError, tcl.loadtk)
 
-tests_gui = (TkLoadTest, )
 
 if __name__ == "__main__":
-    test_support.run_unittest(*tests_gui)
+    unittest.main()
diff --git a/Lib/tkinter/test/test_tkinter/test_messagebox.py b/Lib/tkinter/test/test_tkinter/test_messagebox.py
new file mode 100644
index 0000000..d38541a
--- /dev/null
+++ b/Lib/tkinter/test/test_tkinter/test_messagebox.py
@@ -0,0 +1,36 @@
+import unittest
+import tkinter
+from test.support import requires, swap_attr
+from tkinter.test.support import AbstractDefaultRootTest
+from tkinter.commondialog import Dialog
+from tkinter.messagebox import showinfo
+
+requires('gui')
+
+
+class DefaultRootTest(AbstractDefaultRootTest, unittest.TestCase):
+
+    def test_showinfo(self):
+        def test_callback(dialog, master):
+            nonlocal ismapped
+            master.update()
+            ismapped = master.winfo_ismapped()
+            raise ZeroDivisionError
+
+        with swap_attr(Dialog, '_test_callback', test_callback):
+            ismapped = None
+            self.assertRaises(ZeroDivisionError, showinfo, "Spam", "Egg Information")
+            self.assertEqual(ismapped, False)
+
+            root = tkinter.Tk()
+            ismapped = None
+            self.assertRaises(ZeroDivisionError, showinfo, "Spam", "Egg Information")
+            self.assertEqual(ismapped, True)
+            root.destroy()
+
+            tkinter.NoDefaultRoot()
+            self.assertRaises(RuntimeError, showinfo, "Spam", "Egg Information")
+
+
+if __name__ == "__main__":
+    unittest.main()
diff --git a/Lib/tkinter/test/test_tkinter/test_misc.py b/Lib/tkinter/test/test_tkinter/test_misc.py
index b8eea25..8898a74 100644
--- a/Lib/tkinter/test/test_tkinter/test_misc.py
+++ b/Lib/tkinter/test/test_tkinter/test_misc.py
@@ -1,7 +1,8 @@
+import functools
 import unittest
 import tkinter
 from test import support
-from tkinter.test.support import AbstractTkTest
+from tkinter.test.support import AbstractTkTest, AbstractDefaultRootTest
 
 support.requires('gui')
 
@@ -97,6 +98,12 @@
         with self.assertRaises(tkinter.TclError):
             root.tk.call(script)
 
+        # Call with a callable class
+        count = 0
+        timer1 = root.after(0, functools.partial(callback, 42, 11))
+        root.update()  # Process all pending events.
+        self.assertEqual(count, 53)
+
     def test_after_idle(self):
         root = self.root
 
@@ -192,6 +199,33 @@
         with self.assertRaises(tkinter.TclError):
             root.clipboard_get()
 
+    def test_winfo_rgb(self):
+
+        def assertApprox(col1, col2):
+            # A small amount of flexibility is required (bpo-45496)
+            # 33 is ~0.05% of 65535, which is a reasonable margin
+            for col1_channel, col2_channel in zip(col1, col2):
+                self.assertAlmostEqual(col1_channel, col2_channel, delta=33)
+
+        root = self.root
+        rgb = root.winfo_rgb
+
+        # Color name.
+        self.assertEqual(rgb('red'), (65535, 0, 0))
+        self.assertEqual(rgb('dark slate blue'), (18504, 15677, 35723))
+        # #RGB - extends each 4-bit hex value to be 16-bit.
+        self.assertEqual(rgb('#F0F'), (0xFFFF, 0x0000, 0xFFFF))
+        # #RRGGBB - extends each 8-bit hex value to be 16-bit.
+        assertApprox(rgb('#4a3c8c'), (0x4a4a, 0x3c3c, 0x8c8c))
+        # #RRRRGGGGBBBB
+        assertApprox(rgb('#dede14143939'), (0xdede, 0x1414, 0x3939))
+        # Invalid string.
+        with self.assertRaises(tkinter.TclError):
+            rgb('#123456789a')
+        # RGB triplet is invalid input.
+        with self.assertRaises(tkinter.TclError):
+            rgb((111, 78, 55))
+
     def test_event_repr_defaults(self):
         e = tkinter.Event()
         e.serial = 12345
@@ -241,7 +275,83 @@
                          " num=3 delta=-1 focus=True"
                          " x=10 y=20 width=300 height=200>")
 
-tests_gui = (MiscTest, )
+    def test_getboolean(self):
+        for v in 'true', 'yes', 'on', '1', 't', 'y', 1, True:
+            self.assertIs(self.root.getboolean(v), True)
+        for v in 'false', 'no', 'off', '0', 'f', 'n', 0, False:
+            self.assertIs(self.root.getboolean(v), False)
+        self.assertRaises(ValueError, self.root.getboolean, 'yea')
+        self.assertRaises(ValueError, self.root.getboolean, '')
+        self.assertRaises(TypeError, self.root.getboolean, None)
+        self.assertRaises(TypeError, self.root.getboolean, ())
+
+    def test_mainloop(self):
+        log = []
+        def callback():
+            log.append(1)
+            self.root.after(100, self.root.quit)
+        self.root.after(100, callback)
+        self.root.mainloop(1)
+        self.assertEqual(log, [])
+        self.root.mainloop(0)
+        self.assertEqual(log, [1])
+        self.assertTrue(self.root.winfo_exists())
+
+
+class DefaultRootTest(AbstractDefaultRootTest, unittest.TestCase):
+
+    def test_default_root(self):
+        self.assertIs(tkinter._support_default_root, True)
+        self.assertIsNone(tkinter._default_root)
+        root = tkinter.Tk()
+        root2 = tkinter.Tk()
+        root3 = tkinter.Tk()
+        self.assertIs(tkinter._default_root, root)
+        root2.destroy()
+        self.assertIs(tkinter._default_root, root)
+        root.destroy()
+        self.assertIsNone(tkinter._default_root)
+        root3.destroy()
+        self.assertIsNone(tkinter._default_root)
+
+    def test_no_default_root(self):
+        self.assertIs(tkinter._support_default_root, True)
+        self.assertIsNone(tkinter._default_root)
+        root = tkinter.Tk()
+        self.assertIs(tkinter._default_root, root)
+        tkinter.NoDefaultRoot()
+        self.assertIs(tkinter._support_default_root, False)
+        self.assertFalse(hasattr(tkinter, '_default_root'))
+        # repeated call is no-op
+        tkinter.NoDefaultRoot()
+        self.assertIs(tkinter._support_default_root, False)
+        self.assertFalse(hasattr(tkinter, '_default_root'))
+        root.destroy()
+        self.assertIs(tkinter._support_default_root, False)
+        self.assertFalse(hasattr(tkinter, '_default_root'))
+        root = tkinter.Tk()
+        self.assertIs(tkinter._support_default_root, False)
+        self.assertFalse(hasattr(tkinter, '_default_root'))
+        root.destroy()
+
+    def test_getboolean(self):
+        self.assertRaises(RuntimeError, tkinter.getboolean, '1')
+        root = tkinter.Tk()
+        self.assertIs(tkinter.getboolean('1'), True)
+        self.assertRaises(ValueError, tkinter.getboolean, 'yea')
+        root.destroy()
+        tkinter.NoDefaultRoot()
+        self.assertRaises(RuntimeError, tkinter.getboolean, '1')
+
+    def test_mainloop(self):
+        self.assertRaises(RuntimeError, tkinter.mainloop)
+        root = tkinter.Tk()
+        root.after_idle(root.quit)
+        tkinter.mainloop()
+        root.destroy()
+        tkinter.NoDefaultRoot()
+        self.assertRaises(RuntimeError, tkinter.mainloop)
+
 
 if __name__ == "__main__":
-    support.run_unittest(*tests_gui)
+    unittest.main()
diff --git a/Lib/tkinter/test/test_tkinter/test_simpledialog.py b/Lib/tkinter/test/test_tkinter/test_simpledialog.py
new file mode 100644
index 0000000..18cd271
--- /dev/null
+++ b/Lib/tkinter/test/test_tkinter/test_simpledialog.py
@@ -0,0 +1,35 @@
+import unittest
+import tkinter
+from test.support import requires, swap_attr
+from tkinter.test.support import AbstractDefaultRootTest
+from tkinter.simpledialog import Dialog, askinteger
+
+requires('gui')
+
+
+class DefaultRootTest(AbstractDefaultRootTest, unittest.TestCase):
+
+    def test_askinteger(self):
+        @staticmethod
+        def mock_wait_window(w):
+            nonlocal ismapped
+            ismapped = w.master.winfo_ismapped()
+            w.destroy()
+
+        with swap_attr(Dialog, 'wait_window', mock_wait_window):
+            ismapped = None
+            askinteger("Go To Line", "Line number")
+            self.assertEqual(ismapped, False)
+
+            root = tkinter.Tk()
+            ismapped = None
+            askinteger("Go To Line", "Line number")
+            self.assertEqual(ismapped, True)
+            root.destroy()
+
+            tkinter.NoDefaultRoot()
+            self.assertRaises(RuntimeError, askinteger, "Go To Line", "Line number")
+
+
+if __name__ == "__main__":
+    unittest.main()
diff --git a/Lib/tkinter/test/test_tkinter/test_text.py b/Lib/tkinter/test/test_tkinter/test_text.py
index 13b7c56..482f150 100644
--- a/Lib/tkinter/test/test_tkinter/test_text.py
+++ b/Lib/tkinter/test/test_tkinter/test_text.py
@@ -1,6 +1,6 @@
 import unittest
 import tkinter
-from test.support import requires, run_unittest
+from test.support import requires
 from tkinter.test.support import AbstractTkTest
 
 requires('gui')
@@ -41,7 +41,5 @@
         self.assertEqual(text.search('test', '1.0', 'end'), '1.3')
 
 
-tests_gui = (TextTest, )
-
 if __name__ == "__main__":
-    run_unittest(*tests_gui)
+    unittest.main()
diff --git a/Lib/tkinter/test/test_tkinter/test_variables.py b/Lib/tkinter/test/test_tkinter/test_variables.py
index 08b7ded..427e168 100644
--- a/Lib/tkinter/test/test_tkinter/test_variables.py
+++ b/Lib/tkinter/test/test_tkinter/test_variables.py
@@ -1,8 +1,12 @@
 import unittest
+from test import support
+
 import gc
+import tkinter
 from tkinter import (Variable, StringVar, IntVar, DoubleVar, BooleanVar, Tcl,
                      TclError)
 from test.support import ALWAYS_EQ
+from tkinter.test.support import AbstractDefaultRootTest
 
 
 class Var(Variable):
@@ -44,6 +48,7 @@
         v = Variable(self.root, "sample string", "varname")
         self.assertTrue(self.info_exists("varname"))
         del v
+        support.gc_collect()  # For PyPy or other GCs.
         self.assertFalse(self.info_exists("varname"))
 
     def test_dont_unset_not_existing(self):
@@ -51,27 +56,39 @@
         v1 = Variable(self.root, name="name")
         v2 = Variable(self.root, name="name")
         del v1
+        support.gc_collect()  # For PyPy or other GCs.
         self.assertFalse(self.info_exists("name"))
         # shouldn't raise exception
         del v2
+        support.gc_collect()  # For PyPy or other GCs.
         self.assertFalse(self.info_exists("name"))
 
-    def test___eq__(self):
+    def test_equality(self):
         # values doesn't matter, only class and name are checked
         v1 = Variable(self.root, name="abc")
         v2 = Variable(self.root, name="abc")
         self.assertIsNot(v1, v2)
         self.assertEqual(v1, v2)
 
-        v3 = StringVar(self.root, name="abc")
+        v3 = Variable(self.root, name="cba")
         self.assertNotEqual(v1, v3)
 
+        v4 = StringVar(self.root, name="abc")
+        self.assertEqual(str(v1), str(v4))
+        self.assertNotEqual(v1, v4)
+
         V = type('Variable', (), {})
         self.assertNotEqual(v1, V())
 
         self.assertNotEqual(v1, object())
         self.assertEqual(v1, ALWAYS_EQ)
 
+        root2 = tkinter.Tk()
+        self.addCleanup(root2.destroy)
+        v5 = Variable(root2, name="abc")
+        self.assertEqual(str(v1), str(v5))
+        self.assertNotEqual(v1, v5)
+
     def test_invalid_name(self):
         with self.assertRaises(TypeError):
             Variable(self.root, name=123)
@@ -308,10 +325,18 @@
             v.get()
 
 
-tests_gui = (TestVariable, TestStringVar, TestIntVar,
-             TestDoubleVar, TestBooleanVar)
+class DefaultRootTest(AbstractDefaultRootTest, unittest.TestCase):
+
+    def test_variable(self):
+        self.assertRaises(RuntimeError, Variable)
+        root = tkinter.Tk()
+        v = Variable()
+        v.set("value")
+        self.assertEqual(v.get(), "value")
+        root.destroy()
+        tkinter.NoDefaultRoot()
+        self.assertRaises(RuntimeError, Variable)
 
 
 if __name__ == "__main__":
-    from test.support import run_unittest
-    run_unittest(*tests_gui)
+    unittest.main()
diff --git a/Lib/tkinter/test/test_tkinter/test_widgets.py b/Lib/tkinter/test/test_tkinter/test_widgets.py
index b6f792d..cc227e5 100644
--- a/Lib/tkinter/test/test_tkinter/test_widgets.py
+++ b/Lib/tkinter/test/test_tkinter/test_widgets.py
@@ -2,11 +2,11 @@
 import tkinter
 from tkinter import TclError
 import os
-import sys
 from test.support import requires
 
 from tkinter.test.support import (tcl_version, requires_tcl,
-                                  get_tk_patchlevel, widget_eq)
+                                  get_tk_patchlevel, widget_eq,
+                                  AbstractDefaultRootTest)
 from tkinter.test.widget_tests import (
     add_standard_options, noconv, pixels_round,
     AbstractWidgetTest, StandardOptionsTests, IntegerSizeTests, PixelSizeTests,
@@ -22,7 +22,7 @@
 class AbstractToplevelTest(AbstractWidgetTest, PixelSizeTests):
     _conv_pad_pixels = noconv
 
-    def test_class(self):
+    def test_configure_class(self):
         widget = self.create()
         self.assertEqual(widget['class'],
                          widget.__class__.__name__.title())
@@ -31,7 +31,7 @@
         widget2 = self.create(class_='Foo')
         self.assertEqual(widget2['class'], 'Foo')
 
-    def test_colormap(self):
+    def test_configure_colormap(self):
         widget = self.create()
         self.assertEqual(widget['colormap'], '')
         self.checkInvalidParam(widget, 'colormap', 'new',
@@ -39,7 +39,7 @@
         widget2 = self.create(colormap='new')
         self.assertEqual(widget2['colormap'], 'new')
 
-    def test_container(self):
+    def test_configure_container(self):
         widget = self.create()
         self.assertEqual(widget['container'], 0 if self.wantobjects else '0')
         self.checkInvalidParam(widget, 'container', 1,
@@ -47,7 +47,7 @@
         widget2 = self.create(container=True)
         self.assertEqual(widget2['container'], 1 if self.wantobjects else '1')
 
-    def test_visual(self):
+    def test_configure_visual(self):
         widget = self.create()
         self.assertEqual(widget['visual'], '')
         self.checkInvalidParam(widget, 'visual', 'default',
@@ -69,13 +69,13 @@
     def create(self, **kwargs):
         return tkinter.Toplevel(self.root, **kwargs)
 
-    def test_menu(self):
+    def test_configure_menu(self):
         widget = self.create()
         menu = tkinter.Menu(self.root)
         self.checkParam(widget, 'menu', menu, eq=widget_eq)
         self.checkParam(widget, 'menu', '')
 
-    def test_screen(self):
+    def test_configure_screen(self):
         widget = self.create()
         self.assertEqual(widget['screen'], '')
         try:
@@ -87,7 +87,7 @@
         widget2 = self.create(screen=display)
         self.assertEqual(widget2['screen'], display)
 
-    def test_use(self):
+    def test_configure_use(self):
         widget = self.create()
         self.assertEqual(widget['use'], '')
         parent = self.create(container=True)
@@ -124,14 +124,14 @@
     def create(self, **kwargs):
         return tkinter.LabelFrame(self.root, **kwargs)
 
-    def test_labelanchor(self):
+    def test_configure_labelanchor(self):
         widget = self.create()
         self.checkEnumParam(widget, 'labelanchor',
                             'e', 'en', 'es', 'n', 'ne', 'nw',
                             's', 'se', 'sw', 'w', 'wn', 'ws')
         self.checkInvalidParam(widget, 'labelanchor', 'center')
 
-    def test_labelwidget(self):
+    def test_configure_labelwidget(self):
         widget = self.create()
         label = tkinter.Label(self.root, text='Mupp', name='foo')
         self.checkParam(widget, 'labelwidget', label, expected='.foo')
@@ -141,7 +141,7 @@
 class AbstractLabelTest(AbstractWidgetTest, IntegerSizeTests):
     _conv_pixels = noconv
 
-    def test_highlightthickness(self):
+    def test_configure_highlightthickness(self):
         widget = self.create()
         self.checkPixelsParam(widget, 'highlightthickness',
                               0, 1.3, 2.6, 6, -2, '10p')
@@ -179,7 +179,7 @@
     def create(self, **kwargs):
         return tkinter.Button(self.root, **kwargs)
 
-    def test_default(self):
+    def test_configure_default(self):
         widget = self.create()
         self.checkEnumParam(widget, 'default', 'active', 'disabled', 'normal')
 
@@ -204,11 +204,11 @@
         return tkinter.Checkbutton(self.root, **kwargs)
 
 
-    def test_offvalue(self):
+    def test_configure_offvalue(self):
         widget = self.create()
         self.checkParams(widget, 'offvalue', 1, 2.3, '', 'any string')
 
-    def test_onvalue(self):
+    def test_configure_onvalue(self):
         widget = self.create()
         self.checkParams(widget, 'onvalue', 1, 2.3, '', 'any string')
 
@@ -231,7 +231,7 @@
     def create(self, **kwargs):
         return tkinter.Radiobutton(self.root, **kwargs)
 
-    def test_value(self):
+    def test_configure_value(self):
         widget = self.create()
         self.checkParams(widget, 'value', 1, 2.3, '', 'any string')
 
@@ -254,20 +254,19 @@
     def create(self, **kwargs):
         return tkinter.Menubutton(self.root, **kwargs)
 
-    def test_direction(self):
+    def test_configure_direction(self):
         widget = self.create()
         self.checkEnumParam(widget, 'direction',
                 'above', 'below', 'flush', 'left', 'right')
 
-    def test_height(self):
+    def test_configure_height(self):
         widget = self.create()
         self.checkIntegerParam(widget, 'height', 100, -100, 0, conv=str)
 
-    test_highlightthickness = StandardOptionsTests.test_highlightthickness
+    test_configure_highlightthickness = \
+        StandardOptionsTests.test_configure_highlightthickness
 
-    @unittest.skipIf(sys.platform == 'darwin',
-                     'crashes with Cocoa Tk (issue19733)')
-    def test_image(self):
+    def test_configure_image(self):
         widget = self.create()
         image = tkinter.PhotoImage(master=self.root, name='image1')
         self.checkParam(widget, 'image', image, conv=str)
@@ -281,23 +280,23 @@
         if errmsg is not None:
             self.assertEqual(str(cm.exception), errmsg)
 
-    def test_menu(self):
+    def test_configure_menu(self):
         widget = self.create()
         menu = tkinter.Menu(widget, name='menu')
         self.checkParam(widget, 'menu', menu, eq=widget_eq)
         menu.destroy()
 
-    def test_padx(self):
+    def test_configure_padx(self):
         widget = self.create()
         self.checkPixelsParam(widget, 'padx', 3, 4.4, 5.6, '12m')
         self.checkParam(widget, 'padx', -2, expected=0)
 
-    def test_pady(self):
+    def test_configure_pady(self):
         widget = self.create()
         self.checkPixelsParam(widget, 'pady', 3, 4.4, 5.6, '12m')
         self.checkParam(widget, 'pady', -2, expected=0)
 
-    def test_width(self):
+    def test_configure_width(self):
         widget = self.create()
         self.checkIntegerParam(widget, 'width', 402, -402, 0, conv=str)
 
@@ -330,18 +329,18 @@
     def create(self, **kwargs):
         return tkinter.Entry(self.root, **kwargs)
 
-    def test_disabledbackground(self):
+    def test_configure_disabledbackground(self):
         widget = self.create()
         self.checkColorParam(widget, 'disabledbackground')
 
-    def test_insertborderwidth(self):
+    def test_configure_insertborderwidth(self):
         widget = self.create(insertwidth=100)
         self.checkPixelsParam(widget, 'insertborderwidth',
                               0, 1.3, 2.6, 6, -2, '10p')
         # insertborderwidth is bounded above by a half of insertwidth.
         self.checkParam(widget, 'insertborderwidth', 60, expected=100//2)
 
-    def test_insertwidth(self):
+    def test_configure_insertwidth(self):
         widget = self.create()
         self.checkPixelsParam(widget, 'insertwidth', 1.3, 3.6, '10p')
         self.checkParam(widget, 'insertwidth', 0.1, expected=2)
@@ -351,32 +350,32 @@
         else:
             self.checkParam(widget, 'insertwidth', 0.9, expected=1)
 
-    def test_invalidcommand(self):
+    def test_configure_invalidcommand(self):
         widget = self.create()
         self.checkCommandParam(widget, 'invalidcommand')
         self.checkCommandParam(widget, 'invcmd')
 
-    def test_readonlybackground(self):
+    def test_configure_readonlybackground(self):
         widget = self.create()
         self.checkColorParam(widget, 'readonlybackground')
 
-    def test_show(self):
+    def test_configure_show(self):
         widget = self.create()
         self.checkParam(widget, 'show', '*')
         self.checkParam(widget, 'show', '')
         self.checkParam(widget, 'show', ' ')
 
-    def test_state(self):
+    def test_configure_state(self):
         widget = self.create()
         self.checkEnumParam(widget, 'state',
                             'disabled', 'normal', 'readonly')
 
-    def test_validate(self):
+    def test_configure_validate(self):
         widget = self.create()
         self.checkEnumParam(widget, 'validate',
                 'all', 'key', 'focus', 'focusin', 'focusout', 'none')
 
-    def test_validatecommand(self):
+    def test_configure_validatecommand(self):
         widget = self.create()
         self.checkCommandParam(widget, 'validatecommand')
         self.checkCommandParam(widget, 'vcmd')
@@ -429,25 +428,25 @@
     def create(self, **kwargs):
         return tkinter.Spinbox(self.root, **kwargs)
 
-    test_show = None
+    test_configure_show = None
 
-    def test_buttonbackground(self):
+    def test_configure_buttonbackground(self):
         widget = self.create()
         self.checkColorParam(widget, 'buttonbackground')
 
-    def test_buttoncursor(self):
+    def test_configure_buttoncursor(self):
         widget = self.create()
         self.checkCursorParam(widget, 'buttoncursor')
 
-    def test_buttondownrelief(self):
+    def test_configure_buttondownrelief(self):
         widget = self.create()
         self.checkReliefParam(widget, 'buttondownrelief')
 
-    def test_buttonuprelief(self):
+    def test_configure_buttonuprelief(self):
         widget = self.create()
         self.checkReliefParam(widget, 'buttonuprelief')
 
-    def test_format(self):
+    def test_configure_format(self):
         widget = self.create()
         self.checkParam(widget, 'format', '%2f')
         self.checkParam(widget, 'format', '%2.2f')
@@ -462,25 +461,25 @@
         self.checkParam(widget, 'format', '%09.200f')
         self.checkInvalidParam(widget, 'format', '%d')
 
-    def test_from(self):
+    def test_configure_from(self):
         widget = self.create()
         self.checkParam(widget, 'to', 100.0)
         self.checkFloatParam(widget, 'from', -10, 10.2, 11.7)
         self.checkInvalidParam(widget, 'from', 200,
                 errmsg='-to value must be greater than -from value')
 
-    def test_increment(self):
+    def test_configure_increment(self):
         widget = self.create()
         self.checkFloatParam(widget, 'increment', -1, 1, 10.2, 12.8, 0)
 
-    def test_to(self):
+    def test_configure_to(self):
         widget = self.create()
         self.checkParam(widget, 'from', -100.0)
         self.checkFloatParam(widget, 'to', -10, 10.2, 11.7)
         self.checkInvalidParam(widget, 'to', -200,
                 errmsg='-to value must be greater than -from value')
 
-    def test_values(self):
+    def test_configure_values(self):
         # XXX
         widget = self.create()
         self.assertEqual(widget['values'], '')
@@ -491,7 +490,7 @@
                         expected='42 3.14 {} {any string}')
         self.checkParam(widget, 'values', '')
 
-    def test_wrap(self):
+    def test_configure_wrap(self):
         widget = self.create()
         self.checkBooleanParam(widget, 'wrap')
 
@@ -557,17 +556,17 @@
     def create(self, **kwargs):
         return tkinter.Text(self.root, **kwargs)
 
-    def test_autoseparators(self):
+    def test_configure_autoseparators(self):
         widget = self.create()
         self.checkBooleanParam(widget, 'autoseparators')
 
     @requires_tcl(8, 5)
-    def test_blockcursor(self):
+    def test_configure_blockcursor(self):
         widget = self.create()
         self.checkBooleanParam(widget, 'blockcursor')
 
     @requires_tcl(8, 5)
-    def test_endline(self):
+    def test_configure_endline(self):
         widget = self.create()
         text = '\n'.join('Line %d' for i in range(100))
         widget.insert('end', text)
@@ -580,50 +579,50 @@
         self.checkInvalidParam(widget, 'endline', 10,
                 errmsg='-startline must be less than or equal to -endline')
 
-    def test_height(self):
+    def test_configure_height(self):
         widget = self.create()
         self.checkPixelsParam(widget, 'height', 100, 101.2, 102.6, '3c')
         self.checkParam(widget, 'height', -100, expected=1)
         self.checkParam(widget, 'height', 0, expected=1)
 
-    def test_maxundo(self):
+    def test_configure_maxundo(self):
         widget = self.create()
         self.checkIntegerParam(widget, 'maxundo', 0, 5, -1)
 
     @requires_tcl(8, 5)
-    def test_inactiveselectbackground(self):
+    def test_configure_inactiveselectbackground(self):
         widget = self.create()
         self.checkColorParam(widget, 'inactiveselectbackground')
 
     @requires_tcl(8, 6)
-    def test_insertunfocussed(self):
+    def test_configure_insertunfocussed(self):
         widget = self.create()
         self.checkEnumParam(widget, 'insertunfocussed',
                             'hollow', 'none', 'solid')
 
-    def test_selectborderwidth(self):
+    def test_configure_selectborderwidth(self):
         widget = self.create()
         self.checkPixelsParam(widget, 'selectborderwidth',
                               1.3, 2.6, -2, '10p', conv=noconv,
                               keep_orig=tcl_version >= (8, 5))
 
-    def test_spacing1(self):
+    def test_configure_spacing1(self):
         widget = self.create()
         self.checkPixelsParam(widget, 'spacing1', 20, 21.4, 22.6, '0.5c')
         self.checkParam(widget, 'spacing1', -5, expected=0)
 
-    def test_spacing2(self):
+    def test_configure_spacing2(self):
         widget = self.create()
         self.checkPixelsParam(widget, 'spacing2', 5, 6.4, 7.6, '0.1c')
         self.checkParam(widget, 'spacing2', -1, expected=0)
 
-    def test_spacing3(self):
+    def test_configure_spacing3(self):
         widget = self.create()
         self.checkPixelsParam(widget, 'spacing3', 20, 21.4, 22.6, '0.5c')
         self.checkParam(widget, 'spacing3', -10, expected=0)
 
     @requires_tcl(8, 5)
-    def test_startline(self):
+    def test_configure_startline(self):
         widget = self.create()
         text = '\n'.join('Line %d' for i in range(100))
         widget.insert('end', text)
@@ -636,14 +635,14 @@
         self.checkInvalidParam(widget, 'startline', 70,
                 errmsg='-startline must be less than or equal to -endline')
 
-    def test_state(self):
+    def test_configure_state(self):
         widget = self.create()
         if tcl_version < (8, 5):
             self.checkParams(widget, 'state', 'disabled', 'normal')
         else:
             self.checkEnumParam(widget, 'state', 'disabled', 'normal')
 
-    def test_tabs(self):
+    def test_configure_tabs(self):
         widget = self.create()
         if get_tk_patchlevel() < (8, 5, 11):
             self.checkParam(widget, 'tabs', (10.2, 20.7, '1i', '2i'),
@@ -659,21 +658,21 @@
                                keep_orig=tcl_version >= (8, 5))
 
     @requires_tcl(8, 5)
-    def test_tabstyle(self):
+    def test_configure_tabstyle(self):
         widget = self.create()
         self.checkEnumParam(widget, 'tabstyle', 'tabular', 'wordprocessor')
 
-    def test_undo(self):
+    def test_configure_undo(self):
         widget = self.create()
         self.checkBooleanParam(widget, 'undo')
 
-    def test_width(self):
+    def test_configure_width(self):
         widget = self.create()
         self.checkIntegerParam(widget, 'width', 402)
         self.checkParam(widget, 'width', -402, expected=1)
         self.checkParam(widget, 'width', 0, expected=1)
 
-    def test_wrap(self):
+    def test_configure_wrap(self):
         widget = self.create()
         if tcl_version < (8, 5):
             self.checkParams(widget, 'wrap', 'char', 'none', 'word')
@@ -711,16 +710,16 @@
     def create(self, **kwargs):
         return tkinter.Canvas(self.root, **kwargs)
 
-    def test_closeenough(self):
+    def test_configure_closeenough(self):
         widget = self.create()
         self.checkFloatParam(widget, 'closeenough', 24, 2.4, 3.6, -3,
                              conv=float)
 
-    def test_confine(self):
+    def test_configure_confine(self):
         widget = self.create()
         self.checkBooleanParam(widget, 'confine')
 
-    def test_offset(self):
+    def test_configure_offset(self):
         widget = self.create()
         self.assertEqual(widget['offset'], '0,0')
         self.checkParams(widget, 'offset',
@@ -729,7 +728,7 @@
         self.checkParam(widget, 'offset', '#5,6')
         self.checkInvalidParam(widget, 'offset', 'spam')
 
-    def test_scrollregion(self):
+    def test_configure_scrollregion(self):
         widget = self.create()
         self.checkParam(widget, 'scrollregion', '0 0 200 150')
         self.checkParam(widget, 'scrollregion', (0, 0, 200, 150),
@@ -741,17 +740,17 @@
         self.checkInvalidParam(widget, 'scrollregion', (0, 0, 200))
         self.checkInvalidParam(widget, 'scrollregion', (0, 0, 200, 150, 0))
 
-    def test_state(self):
+    def test_configure_state(self):
         widget = self.create()
         self.checkEnumParam(widget, 'state', 'disabled', 'normal',
                 errmsg='bad state value "{}": must be normal or disabled')
 
-    def test_xscrollincrement(self):
+    def test_configure_xscrollincrement(self):
         widget = self.create()
         self.checkPixelsParam(widget, 'xscrollincrement',
                               40, 0, 41.2, 43.6, -40, '0.5i')
 
-    def test_yscrollincrement(self):
+    def test_configure_yscrollincrement(self):
         widget = self.create()
         self.checkPixelsParam(widget, 'yscrollincrement',
                               10, 0, 11.2, 13.6, -10, '0.1i')
@@ -796,26 +795,26 @@
     def create(self, **kwargs):
         return tkinter.Listbox(self.root, **kwargs)
 
-    def test_activestyle(self):
+    def test_configure_activestyle(self):
         widget = self.create()
         self.checkEnumParam(widget, 'activestyle',
                             'dotbox', 'none', 'underline')
 
-    test_justify = requires_tcl(8, 6, 5)(StandardOptionsTests.test_justify)
+    test_justify = requires_tcl(8, 6, 5)(StandardOptionsTests.test_configure_justify)
 
-    def test_listvariable(self):
+    def test_configure_listvariable(self):
         widget = self.create()
         var = tkinter.DoubleVar(self.root)
         self.checkVariableParam(widget, 'listvariable', var)
 
-    def test_selectmode(self):
+    def test_configure_selectmode(self):
         widget = self.create()
         self.checkParam(widget, 'selectmode', 'single')
         self.checkParam(widget, 'selectmode', 'browse')
         self.checkParam(widget, 'selectmode', 'multiple')
         self.checkParam(widget, 'selectmode', 'extended')
 
-    def test_state(self):
+    def test_configure_state(self):
         widget = self.create()
         self.checkEnumParam(widget, 'state', 'disabled', 'normal')
 
@@ -930,53 +929,53 @@
     def create(self, **kwargs):
         return tkinter.Scale(self.root, **kwargs)
 
-    def test_bigincrement(self):
+    def test_configure_bigincrement(self):
         widget = self.create()
         self.checkFloatParam(widget, 'bigincrement', 12.4, 23.6, -5)
 
-    def test_digits(self):
+    def test_configure_digits(self):
         widget = self.create()
         self.checkIntegerParam(widget, 'digits', 5, 0)
 
-    def test_from(self):
+    def test_configure_from(self):
         widget = self.create()
         conv = False if get_tk_patchlevel() >= (8, 6, 10) else float_round
         self.checkFloatParam(widget, 'from', 100, 14.9, 15.1, conv=conv)
 
-    def test_label(self):
+    def test_configure_label(self):
         widget = self.create()
         self.checkParam(widget, 'label', 'any string')
         self.checkParam(widget, 'label', '')
 
-    def test_length(self):
+    def test_configure_length(self):
         widget = self.create()
         self.checkPixelsParam(widget, 'length', 130, 131.2, 135.6, '5i')
 
-    def test_resolution(self):
+    def test_configure_resolution(self):
         widget = self.create()
         self.checkFloatParam(widget, 'resolution', 4.2, 0, 6.7, -2)
 
-    def test_showvalue(self):
+    def test_configure_showvalue(self):
         widget = self.create()
         self.checkBooleanParam(widget, 'showvalue')
 
-    def test_sliderlength(self):
+    def test_configure_sliderlength(self):
         widget = self.create()
         self.checkPixelsParam(widget, 'sliderlength',
                               10, 11.2, 15.6, -3, '3m')
 
-    def test_sliderrelief(self):
+    def test_configure_sliderrelief(self):
         widget = self.create()
         self.checkReliefParam(widget, 'sliderrelief')
 
-    def test_tickinterval(self):
+    def test_configure_tickinterval(self):
         widget = self.create()
         self.checkFloatParam(widget, 'tickinterval', 1, 4.3, 7.6, 0,
                              conv=float_round)
         self.checkParam(widget, 'tickinterval', -2, expected=2,
                         conv=float_round)
 
-    def test_to(self):
+    def test_configure_to(self):
         widget = self.create()
         self.checkFloatParam(widget, 'to', 300, 14.9, 15.1, -10,
                              conv=float_round)
@@ -1000,15 +999,15 @@
     def create(self, **kwargs):
         return tkinter.Scrollbar(self.root, **kwargs)
 
-    def test_activerelief(self):
+    def test_configure_activerelief(self):
         widget = self.create()
         self.checkReliefParam(widget, 'activerelief')
 
-    def test_elementborderwidth(self):
+    def test_configure_elementborderwidth(self):
         widget = self.create()
         self.checkPixelsParam(widget, 'elementborderwidth', 4.3, 5.6, -2, '1m')
 
-    def test_orient(self):
+    def test_configure_orient(self):
         widget = self.create()
         self.checkEnumParam(widget, 'orient', 'vertical', 'horizontal',
                 errmsg='bad orientation "{}": must be vertical or horizontal')
@@ -1049,63 +1048,63 @@
     def create(self, **kwargs):
         return tkinter.PanedWindow(self.root, **kwargs)
 
-    def test_handlepad(self):
+    def test_configure_handlepad(self):
         widget = self.create()
         self.checkPixelsParam(widget, 'handlepad', 5, 6.4, 7.6, -3, '1m')
 
-    def test_handlesize(self):
+    def test_configure_handlesize(self):
         widget = self.create()
         self.checkPixelsParam(widget, 'handlesize', 8, 9.4, 10.6, -3, '2m',
                               conv=noconv)
 
-    def test_height(self):
+    def test_configure_height(self):
         widget = self.create()
         self.checkPixelsParam(widget, 'height', 100, 101.2, 102.6, -100, 0, '1i',
                               conv=noconv)
 
-    def test_opaqueresize(self):
+    def test_configure_opaqueresize(self):
         widget = self.create()
         self.checkBooleanParam(widget, 'opaqueresize')
 
     @requires_tcl(8, 6, 5)
-    def test_proxybackground(self):
+    def test_configure_proxybackground(self):
         widget = self.create()
         self.checkColorParam(widget, 'proxybackground')
 
     @requires_tcl(8, 6, 5)
-    def test_proxyborderwidth(self):
+    def test_configure_proxyborderwidth(self):
         widget = self.create()
         self.checkPixelsParam(widget, 'proxyborderwidth',
                               0, 1.3, 2.9, 6, -2, '10p',
                               conv=noconv)
 
     @requires_tcl(8, 6, 5)
-    def test_proxyrelief(self):
+    def test_configure_proxyrelief(self):
         widget = self.create()
         self.checkReliefParam(widget, 'proxyrelief')
 
-    def test_sashcursor(self):
+    def test_configure_sashcursor(self):
         widget = self.create()
         self.checkCursorParam(widget, 'sashcursor')
 
-    def test_sashpad(self):
+    def test_configure_sashpad(self):
         widget = self.create()
         self.checkPixelsParam(widget, 'sashpad', 8, 1.3, 2.6, -2, '2m')
 
-    def test_sashrelief(self):
+    def test_configure_sashrelief(self):
         widget = self.create()
         self.checkReliefParam(widget, 'sashrelief')
 
-    def test_sashwidth(self):
+    def test_configure_sashwidth(self):
         widget = self.create()
         self.checkPixelsParam(widget, 'sashwidth', 10, 11.1, 15.6, -3, '1m',
                               conv=noconv)
 
-    def test_showhandle(self):
+    def test_configure_showhandle(self):
         widget = self.create()
         self.checkBooleanParam(widget, 'showhandle')
 
-    def test_width(self):
+    def test_configure_width(self):
         widget = self.create()
         self.checkPixelsParam(widget, 'width', 402, 403.4, 404.6, -402, 0, '5i',
                               conv=noconv)
@@ -1224,26 +1223,29 @@
     def create(self, **kwargs):
         return tkinter.Menu(self.root, **kwargs)
 
-    def test_postcommand(self):
+    def test_configure_postcommand(self):
         widget = self.create()
         self.checkCommandParam(widget, 'postcommand')
 
-    def test_tearoff(self):
+    def test_configure_tearoff(self):
         widget = self.create()
         self.checkBooleanParam(widget, 'tearoff')
 
-    def test_tearoffcommand(self):
+    def test_configure_tearoffcommand(self):
         widget = self.create()
         self.checkCommandParam(widget, 'tearoffcommand')
 
-    def test_title(self):
+    def test_configure_title(self):
         widget = self.create()
         self.checkParam(widget, 'title', 'any string')
 
-    def test_type(self):
+    def test_configure_type(self):
         widget = self.create()
-        self.checkEnumParam(widget, 'type',
-                'normal', 'tearoff', 'menubar')
+        self.checkEnumParam(
+            widget, 'type',
+            'normal', 'tearoff', 'menubar',
+            errmsg='bad type "{}": must be normal, tearoff, or menubar',
+            )
 
     def test_entryconfigure(self):
         m1 = self.create()
@@ -1293,17 +1295,26 @@
     def create(self, **kwargs):
         return tkinter.Message(self.root, **kwargs)
 
-    def test_aspect(self):
+    def test_configure_aspect(self):
         widget = self.create()
         self.checkIntegerParam(widget, 'aspect', 250, 0, -300)
 
 
+class DefaultRootTest(AbstractDefaultRootTest, unittest.TestCase):
+
+    def test_frame(self):
+        self._test_widget(tkinter.Frame)
+
+    def test_label(self):
+        self._test_widget(tkinter.Label)
+
+
 tests_gui = (
         ButtonTest, CanvasTest, CheckbuttonTest, EntryTest,
         FrameTest, LabelFrameTest,LabelTest, ListboxTest,
         MenubuttonTest, MenuTest, MessageTest, OptionMenuTest,
         PanedWindowTest, RadiobuttonTest, ScaleTest, ScrollbarTest,
-        SpinboxTest, TextTest, ToplevelTest,
+        SpinboxTest, TextTest, ToplevelTest, DefaultRootTest,
 )
 
 if __name__ == '__main__':
diff --git a/Lib/tkinter/test/test_ttk/test_extensions.py b/Lib/tkinter/test/test_ttk/test_extensions.py
index 6937ba1..1220c48 100644
--- a/Lib/tkinter/test/test_ttk/test_extensions.py
+++ b/Lib/tkinter/test/test_ttk/test_extensions.py
@@ -2,8 +2,8 @@
 import unittest
 import tkinter
 from tkinter import ttk
-from test.support import requires, run_unittest, swap_attr
-from tkinter.test.support import AbstractTkTest, destroy_default_root
+from test.support import requires, gc_collect
+from tkinter.test.support import AbstractTkTest, AbstractDefaultRootTest
 
 requires('gui')
 
@@ -18,6 +18,7 @@
         x = ttk.LabeledScale(self.root)
         var = x._variable._name
         x.destroy()
+        gc_collect()  # For PyPy or other GCs.
         self.assertRaises(tkinter.TclError, x.tk.globalgetvar, var)
 
         # manually created variable
@@ -30,6 +31,7 @@
         else:
             self.assertEqual(float(x.tk.globalgetvar(name)), myvar.get())
         del myvar
+        gc_collect()  # For PyPy or other GCs.
         self.assertRaises(tkinter.TclError, x.tk.globalgetvar, name)
 
         # checking that the tracing callback is properly removed
@@ -46,20 +48,6 @@
         if hasattr(sys, 'last_type'):
             self.assertNotEqual(sys.last_type, tkinter.TclError)
 
-
-    def test_initialization_no_master(self):
-        # no master passing
-        with swap_attr(tkinter, '_default_root', None), \
-             swap_attr(tkinter, '_support_default_root', True):
-            try:
-                x = ttk.LabeledScale()
-                self.assertIsNotNone(tkinter._default_root)
-                self.assertEqual(x.master, tkinter._default_root)
-                self.assertEqual(x.tk, tkinter._default_root.tk)
-                x.destroy()
-            finally:
-                destroy_default_root()
-
     def test_initialization(self):
         # master passing
         master = tkinter.Frame(self.root)
@@ -185,6 +173,7 @@
     def test_resize(self):
         x = ttk.LabeledScale(self.root)
         x.pack(expand=True, fill='both')
+        gc_collect()  # For PyPy or other GCs.
         x.update()
 
         width, height = x.master.winfo_width(), x.master.winfo_height()
@@ -220,6 +209,7 @@
         optmenu.destroy()
         self.assertEqual(optmenu.tk.globalgetvar(name), var.get())
         del var
+        gc_collect()  # For PyPy or other GCs.
         self.assertRaises(tkinter.TclError, optmenu.tk.globalgetvar, name)
 
 
@@ -265,6 +255,7 @@
 
         # check that variable is updated correctly
         optmenu.pack()
+        gc_collect()  # For PyPy or other GCs.
         optmenu['menu'].invoke(0)
         self.assertEqual(optmenu._variable.get(), items[0])
 
@@ -310,8 +301,28 @@
         optmenu.destroy()
         optmenu2.destroy()
 
+    def test_trace_variable(self):
+        # prior to bpo45160, tracing a variable would cause the callback to be made twice
+        success = []
+        items = ('a', 'b', 'c')
+        textvar = tkinter.StringVar(self.root)
+        def cb_test(*args):
+            success.append(textvar.get())
+        optmenu = ttk.OptionMenu(self.root, textvar, "a", *items)
+        optmenu.pack()
+        cb_name = textvar.trace_add("write", cb_test)
+        optmenu['menu'].invoke(1)
+        self.assertEqual(success, ['b'])
+        self.assertEqual(textvar.get(), 'b')
+        textvar.trace_remove("write", cb_name)
+        optmenu.destroy()
 
-tests_gui = (LabeledScaleTest, OptionMenuTest)
+
+class DefaultRootTest(AbstractDefaultRootTest, unittest.TestCase):
+
+    def test_labeledscale(self):
+        self._test_widget(ttk.LabeledScale)
+
 
 if __name__ == "__main__":
-    run_unittest(*tests_gui)
+    unittest.main()
diff --git a/Lib/tkinter/test/test_ttk/test_functions.py b/Lib/tkinter/test/test_ttk/test_functions.py
deleted file mode 100644
index 5c23d6f..0000000
--- a/Lib/tkinter/test/test_ttk/test_functions.py
+++ /dev/null
@@ -1,460 +0,0 @@
-# -*- encoding: utf-8 -*-
-import unittest
-from tkinter import ttk
-
-class MockTkApp:
-
-    def splitlist(self, arg):
-        if isinstance(arg, tuple):
-            return arg
-        return arg.split(':')
-
-    def wantobjects(self):
-        return True
-
-
-class MockTclObj(object):
-    typename = 'test'
-
-    def __init__(self, val):
-        self.val = val
-
-    def __str__(self):
-        return str(self.val)
-
-
-class MockStateSpec(object):
-    typename = 'StateSpec'
-
-    def __init__(self, *args):
-        self.val = args
-
-    def __str__(self):
-        return ' '.join(self.val)
-
-
-class InternalFunctionsTest(unittest.TestCase):
-
-    def test_format_optdict(self):
-        def check_against(fmt_opts, result):
-            for i in range(0, len(fmt_opts), 2):
-                self.assertEqual(result.pop(fmt_opts[i]), fmt_opts[i + 1])
-            if result:
-                self.fail("result still got elements: %s" % result)
-
-        # passing an empty dict should return an empty object (tuple here)
-        self.assertFalse(ttk._format_optdict({}))
-
-        # check list formatting
-        check_against(
-            ttk._format_optdict({'fg': 'blue', 'padding': [1, 2, 3, 4]}),
-            {'-fg': 'blue', '-padding': '1 2 3 4'})
-
-        # check tuple formatting (same as list)
-        check_against(
-            ttk._format_optdict({'test': (1, 2, '', 0)}),
-            {'-test': '1 2 {} 0'})
-
-        # check untouched values
-        check_against(
-            ttk._format_optdict({'test': {'left': 'as is'}}),
-            {'-test': {'left': 'as is'}})
-
-        # check script formatting
-        check_against(
-            ttk._format_optdict(
-                {'test': [1, -1, '', '2m', 0], 'test2': 3,
-                 'test3': '', 'test4': 'abc def',
-                 'test5': '"abc"', 'test6': '{}',
-                 'test7': '} -spam {'}, script=True),
-            {'-test': '{1 -1 {} 2m 0}', '-test2': '3',
-             '-test3': '{}', '-test4': '{abc def}',
-             '-test5': '{"abc"}', '-test6': r'\{\}',
-             '-test7': r'\}\ -spam\ \{'})
-
-        opts = {'αβγ': True, 'á': False}
-        orig_opts = opts.copy()
-        # check if giving unicode keys is fine
-        check_against(ttk._format_optdict(opts), {'-αβγ': True, '-á': False})
-        # opts should remain unchanged
-        self.assertEqual(opts, orig_opts)
-
-        # passing values with spaces inside a tuple/list
-        check_against(
-            ttk._format_optdict(
-                {'option': ('one two', 'three')}),
-            {'-option': '{one two} three'})
-        check_against(
-            ttk._format_optdict(
-                {'option': ('one\ttwo', 'three')}),
-            {'-option': '{one\ttwo} three'})
-
-        # passing empty strings inside a tuple/list
-        check_against(
-            ttk._format_optdict(
-                {'option': ('', 'one')}),
-            {'-option': '{} one'})
-
-        # passing values with braces inside a tuple/list
-        check_against(
-            ttk._format_optdict(
-                {'option': ('one} {two', 'three')}),
-            {'-option': r'one\}\ \{two three'})
-
-        # passing quoted strings inside a tuple/list
-        check_against(
-            ttk._format_optdict(
-                {'option': ('"one"', 'two')}),
-            {'-option': '{"one"} two'})
-        check_against(
-            ttk._format_optdict(
-                {'option': ('{one}', 'two')}),
-            {'-option': r'\{one\} two'})
-
-        # ignore an option
-        amount_opts = len(ttk._format_optdict(opts, ignore=('á'))) / 2
-        self.assertEqual(amount_opts, len(opts) - 1)
-
-        # ignore non-existing options
-        amount_opts = len(ttk._format_optdict(opts, ignore=('á', 'b'))) / 2
-        self.assertEqual(amount_opts, len(opts) - 1)
-
-        # ignore every option
-        self.assertFalse(ttk._format_optdict(opts, ignore=list(opts.keys())))
-
-
-    def test_format_mapdict(self):
-        opts = {'a': [('b', 'c', 'val'), ('d', 'otherval'), ('', 'single')]}
-        result = ttk._format_mapdict(opts)
-        self.assertEqual(len(result), len(list(opts.keys())) * 2)
-        self.assertEqual(result, ('-a', '{b c} val d otherval {} single'))
-        self.assertEqual(ttk._format_mapdict(opts, script=True),
-            ('-a', '{{b c} val d otherval {} single}'))
-
-        self.assertEqual(ttk._format_mapdict({2: []}), ('-2', ''))
-
-        opts = {'üñíćódè': [('á', 'vãl')]}
-        result = ttk._format_mapdict(opts)
-        self.assertEqual(result, ('-üñíćódè', 'á vãl'))
-
-        self.assertEqual(ttk._format_mapdict({'opt': [('value',)]}),
-                         ('-opt', '{} value'))
-
-        # empty states
-        valid = {'opt': [('', '', 'hi')]}
-        self.assertEqual(ttk._format_mapdict(valid), ('-opt', '{ } hi'))
-
-        # when passing multiple states, they all must be strings
-        invalid = {'opt': [(1, 2, 'valid val')]}
-        self.assertRaises(TypeError, ttk._format_mapdict, invalid)
-        invalid = {'opt': [([1], '2', 'valid val')]}
-        self.assertRaises(TypeError, ttk._format_mapdict, invalid)
-        # but when passing a single state, it can be anything
-        valid = {'opt': [[1, 'value']]}
-        self.assertEqual(ttk._format_mapdict(valid), ('-opt', '1 value'))
-        # special attention to single states which evaluate to False
-        for stateval in (None, 0, False, '', set()): # just some samples
-            valid = {'opt': [(stateval, 'value')]}
-            self.assertEqual(ttk._format_mapdict(valid),
-                ('-opt', '{} value'))
-
-        # values must be iterable
-        opts = {'a': None}
-        self.assertRaises(TypeError, ttk._format_mapdict, opts)
-
-
-    def test_format_elemcreate(self):
-        self.assertTrue(ttk._format_elemcreate(None), (None, ()))
-
-        ## Testing type = image
-        # image type expects at least an image name, so this should raise
-        # IndexError since it tries to access the index 0 of an empty tuple
-        self.assertRaises(IndexError, ttk._format_elemcreate, 'image')
-
-        # don't format returned values as a tcl script
-        # minimum acceptable for image type
-        self.assertEqual(ttk._format_elemcreate('image', False, 'test'),
-            ("test ", ()))
-        # specifying a state spec
-        self.assertEqual(ttk._format_elemcreate('image', False, 'test',
-            ('', 'a')), ("test {} a", ()))
-        # state spec with multiple states
-        self.assertEqual(ttk._format_elemcreate('image', False, 'test',
-            ('a', 'b', 'c')), ("test {a b} c", ()))
-        # state spec and options
-        self.assertEqual(ttk._format_elemcreate('image', False, 'test',
-            ('a', 'b'), a='x'), ("test a b", ("-a", "x")))
-        # format returned values as a tcl script
-        # state spec with multiple states and an option with a multivalue
-        self.assertEqual(ttk._format_elemcreate('image', True, 'test',
-            ('a', 'b', 'c', 'd'), x=[2, 3]), ("{test {a b c} d}", "-x {2 3}"))
-
-        ## Testing type = vsapi
-        # vsapi type expects at least a class name and a part_id, so this
-        # should raise a ValueError since it tries to get two elements from
-        # an empty tuple
-        self.assertRaises(ValueError, ttk._format_elemcreate, 'vsapi')
-
-        # don't format returned values as a tcl script
-        # minimum acceptable for vsapi
-        self.assertEqual(ttk._format_elemcreate('vsapi', False, 'a', 'b'),
-            ("a b ", ()))
-        # now with a state spec with multiple states
-        self.assertEqual(ttk._format_elemcreate('vsapi', False, 'a', 'b',
-            ('a', 'b', 'c')), ("a b {a b} c", ()))
-        # state spec and option
-        self.assertEqual(ttk._format_elemcreate('vsapi', False, 'a', 'b',
-            ('a', 'b'), opt='x'), ("a b a b", ("-opt", "x")))
-        # format returned values as a tcl script
-        # state spec with a multivalue and an option
-        self.assertEqual(ttk._format_elemcreate('vsapi', True, 'a', 'b',
-            ('a', 'b', [1, 2]), opt='x'), ("{a b {a b} {1 2}}", "-opt x"))
-
-        # Testing type = from
-        # from type expects at least a type name
-        self.assertRaises(IndexError, ttk._format_elemcreate, 'from')
-
-        self.assertEqual(ttk._format_elemcreate('from', False, 'a'),
-            ('a', ()))
-        self.assertEqual(ttk._format_elemcreate('from', False, 'a', 'b'),
-            ('a', ('b', )))
-        self.assertEqual(ttk._format_elemcreate('from', True, 'a', 'b'),
-            ('{a}', 'b'))
-
-
-    def test_format_layoutlist(self):
-        def sample(indent=0, indent_size=2):
-            return ttk._format_layoutlist(
-            [('a', {'other': [1, 2, 3], 'children':
-                [('b', {'children':
-                    [('c', {'children':
-                        [('d', {'nice': 'opt'})], 'something': (1, 2)
-                    })]
-                })]
-            })], indent=indent, indent_size=indent_size)[0]
-
-        def sample_expected(indent=0, indent_size=2):
-            spaces = lambda amount=0: ' ' * (amount + indent)
-            return (
-                "%sa -other {1 2 3} -children {\n"
-                "%sb -children {\n"
-                "%sc -something {1 2} -children {\n"
-                "%sd -nice opt\n"
-                "%s}\n"
-                "%s}\n"
-                "%s}" % (spaces(), spaces(indent_size),
-                    spaces(2 * indent_size), spaces(3 * indent_size),
-                    spaces(2 * indent_size), spaces(indent_size), spaces()))
-
-        # empty layout
-        self.assertEqual(ttk._format_layoutlist([])[0], '')
-
-        # _format_layoutlist always expects the second item (in every item)
-        # to act like a dict (except when the value evaluates to False).
-        self.assertRaises(AttributeError,
-            ttk._format_layoutlist, [('a', 'b')])
-
-        smallest = ttk._format_layoutlist([('a', None)], indent=0)
-        self.assertEqual(smallest,
-            ttk._format_layoutlist([('a', '')], indent=0))
-        self.assertEqual(smallest[0], 'a')
-
-        # testing indentation levels
-        self.assertEqual(sample(), sample_expected())
-        for i in range(4):
-            self.assertEqual(sample(i), sample_expected(i))
-            self.assertEqual(sample(i, i), sample_expected(i, i))
-
-        # invalid layout format, different kind of exceptions will be
-        # raised by internal functions
-
-        # plain wrong format
-        self.assertRaises(ValueError, ttk._format_layoutlist,
-            ['bad', 'format'])
-        # will try to use iteritems in the 'bad' string
-        self.assertRaises(AttributeError, ttk._format_layoutlist,
-           [('name', 'bad')])
-        # bad children formatting
-        self.assertRaises(ValueError, ttk._format_layoutlist,
-            [('name', {'children': {'a': None}})])
-
-
-    def test_script_from_settings(self):
-        # empty options
-        self.assertFalse(ttk._script_from_settings({'name':
-            {'configure': None, 'map': None, 'element create': None}}))
-
-        # empty layout
-        self.assertEqual(
-            ttk._script_from_settings({'name': {'layout': None}}),
-            "ttk::style layout name {\nnull\n}")
-
-        configdict = {'αβγ': True, 'á': False}
-        self.assertTrue(
-            ttk._script_from_settings({'name': {'configure': configdict}}))
-
-        mapdict = {'üñíćódè': [('á', 'vãl')]}
-        self.assertTrue(
-            ttk._script_from_settings({'name': {'map': mapdict}}))
-
-        # invalid image element
-        self.assertRaises(IndexError,
-            ttk._script_from_settings, {'name': {'element create': ['image']}})
-
-        # minimal valid image
-        self.assertTrue(ttk._script_from_settings({'name':
-            {'element create': ['image', 'name']}}))
-
-        image = {'thing': {'element create':
-            ['image', 'name', ('state1', 'state2', 'val')]}}
-        self.assertEqual(ttk._script_from_settings(image),
-            "ttk::style element create thing image {name {state1 state2} val} ")
-
-        image['thing']['element create'].append({'opt': 30})
-        self.assertEqual(ttk._script_from_settings(image),
-            "ttk::style element create thing image {name {state1 state2} val} "
-            "-opt 30")
-
-        image['thing']['element create'][-1]['opt'] = [MockTclObj(3),
-            MockTclObj('2m')]
-        self.assertEqual(ttk._script_from_settings(image),
-            "ttk::style element create thing image {name {state1 state2} val} "
-            "-opt {3 2m}")
-
-
-    def test_tclobj_to_py(self):
-        self.assertEqual(
-            ttk._tclobj_to_py((MockStateSpec('a', 'b'), 'val')),
-            [('a', 'b', 'val')])
-        self.assertEqual(
-            ttk._tclobj_to_py([MockTclObj('1'), 2, MockTclObj('3m')]),
-            [1, 2, '3m'])
-
-
-    def test_list_from_statespec(self):
-        def test_it(sspec, value, res_value, states):
-            self.assertEqual(ttk._list_from_statespec(
-                (sspec, value)), [states + (res_value, )])
-
-        states_even = tuple('state%d' % i for i in range(6))
-        statespec = MockStateSpec(*states_even)
-        test_it(statespec, 'val', 'val', states_even)
-        test_it(statespec, MockTclObj('val'), 'val', states_even)
-
-        states_odd = tuple('state%d' % i for i in range(5))
-        statespec = MockStateSpec(*states_odd)
-        test_it(statespec, 'val', 'val', states_odd)
-
-        test_it(('a', 'b', 'c'), MockTclObj('val'), 'val', ('a', 'b', 'c'))
-
-
-    def test_list_from_layouttuple(self):
-        tk = MockTkApp()
-
-        # empty layout tuple
-        self.assertFalse(ttk._list_from_layouttuple(tk, ()))
-
-        # shortest layout tuple
-        self.assertEqual(ttk._list_from_layouttuple(tk, ('name', )),
-            [('name', {})])
-
-        # not so interesting ltuple
-        sample_ltuple = ('name', '-option', 'value')
-        self.assertEqual(ttk._list_from_layouttuple(tk, sample_ltuple),
-            [('name', {'option': 'value'})])
-
-        # empty children
-        self.assertEqual(ttk._list_from_layouttuple(tk,
-            ('something', '-children', ())),
-            [('something', {'children': []})]
-        )
-
-        # more interesting ltuple
-        ltuple = (
-            'name', '-option', 'niceone', '-children', (
-                ('otherone', '-children', (
-                    ('child', )), '-otheropt', 'othervalue'
-                )
-            )
-        )
-        self.assertEqual(ttk._list_from_layouttuple(tk, ltuple),
-            [('name', {'option': 'niceone', 'children':
-                [('otherone', {'otheropt': 'othervalue', 'children':
-                    [('child', {})]
-                })]
-            })]
-        )
-
-        # bad tuples
-        self.assertRaises(ValueError, ttk._list_from_layouttuple, tk,
-            ('name', 'no_minus'))
-        self.assertRaises(ValueError, ttk._list_from_layouttuple, tk,
-            ('name', 'no_minus', 'value'))
-        self.assertRaises(ValueError, ttk._list_from_layouttuple, tk,
-            ('something', '-children')) # no children
-
-
-    def test_val_or_dict(self):
-        def func(res, opt=None, val=None):
-            if opt is None:
-                return res
-            if val is None:
-                return "test val"
-            return (opt, val)
-
-        tk = MockTkApp()
-        tk.call = func
-
-        self.assertEqual(ttk._val_or_dict(tk, {}, '-test:3'),
-                         {'test': '3'})
-        self.assertEqual(ttk._val_or_dict(tk, {}, ('-test', 3)),
-                         {'test': 3})
-
-        self.assertEqual(ttk._val_or_dict(tk, {'test': None}, 'x:y'),
-                         'test val')
-
-        self.assertEqual(ttk._val_or_dict(tk, {'test': 3}, 'x:y'),
-                         {'test': 3})
-
-
-    def test_convert_stringval(self):
-        tests = (
-            (0, 0), ('09', 9), ('a', 'a'), ('áÚ', 'áÚ'), ([], '[]'),
-            (None, 'None')
-        )
-        for orig, expected in tests:
-            self.assertEqual(ttk._convert_stringval(orig), expected)
-
-
-class TclObjsToPyTest(unittest.TestCase):
-
-    def test_unicode(self):
-        adict = {'opt': 'välúè'}
-        self.assertEqual(ttk.tclobjs_to_py(adict), {'opt': 'välúè'})
-
-        adict['opt'] = MockTclObj(adict['opt'])
-        self.assertEqual(ttk.tclobjs_to_py(adict), {'opt': 'välúè'})
-
-    def test_multivalues(self):
-        adict = {'opt': [1, 2, 3, 4]}
-        self.assertEqual(ttk.tclobjs_to_py(adict), {'opt': [1, 2, 3, 4]})
-
-        adict['opt'] = [1, 'xm', 3]
-        self.assertEqual(ttk.tclobjs_to_py(adict), {'opt': [1, 'xm', 3]})
-
-        adict['opt'] = (MockStateSpec('a', 'b'), 'válũè')
-        self.assertEqual(ttk.tclobjs_to_py(adict),
-            {'opt': [('a', 'b', 'válũè')]})
-
-        self.assertEqual(ttk.tclobjs_to_py({'x': ['y z']}),
-            {'x': ['y z']})
-
-    def test_nosplit(self):
-        self.assertEqual(ttk.tclobjs_to_py({'text': 'some text'}),
-            {'text': 'some text'})
-
-tests_nogui = (InternalFunctionsTest, TclObjsToPyTest)
-
-if __name__ == "__main__":
-    from test.support import run_unittest
-    run_unittest(*tests_nogui)
diff --git a/Lib/tkinter/test/test_ttk/test_style.py b/Lib/tkinter/test/test_ttk/test_style.py
index 38d70d7..a33c24a 100644
--- a/Lib/tkinter/test/test_ttk/test_style.py
+++ b/Lib/tkinter/test/test_ttk/test_style.py
@@ -3,7 +3,7 @@
 import tkinter
 from tkinter import ttk
 from test import support
-from test.support import requires, run_unittest
+from test.support import requires
 from tkinter.test.support import AbstractTkTest
 
 requires('gui')
@@ -175,7 +175,5 @@
                         self.assertEqual(style.map(newname, key), value)
 
 
-tests_gui = (StyleTest, )
-
 if __name__ == "__main__":
-    run_unittest(*tests_gui)
+    unittest.main()
diff --git a/Lib/tkinter/test/test_ttk/test_widgets.py b/Lib/tkinter/test/test_ttk/test_widgets.py
index 157ef0e..1cb7e74 100644
--- a/Lib/tkinter/test/test_ttk/test_widgets.py
+++ b/Lib/tkinter/test/test_ttk/test_widgets.py
@@ -1,12 +1,12 @@
 import unittest
 import tkinter
 from tkinter import ttk, TclError
-from test.support import requires
+from test.support import requires, gc_collect
 import sys
 
-from tkinter.test.test_ttk.test_functions import MockTclObj
+from test.test_ttk_textonly import MockTclObj
 from tkinter.test.support import (AbstractTkTest, tcl_version, get_tk_patchlevel,
-                                  simulate_mouse_click)
+                                  simulate_mouse_click, AbstractDefaultRootTest)
 from tkinter.test.widget_tests import (add_standard_options, noconv,
     AbstractWidgetTest, StandardOptionsTests, IntegerSizeTests, PixelSizeTests,
     setUpModule)
@@ -16,7 +16,7 @@
 
 class StandardTtkOptionsTests(StandardOptionsTests):
 
-    def test_class(self):
+    def test_configure_class(self):
         widget = self.create()
         self.assertEqual(widget['class'], '')
         errmsg='attempt to change read-only option'
@@ -26,7 +26,7 @@
         widget2 = self.create(class_='Foo')
         self.assertEqual(widget2['class'], 'Foo')
 
-    def test_padding(self):
+    def test_configure_padding(self):
         widget = self.create()
         self.checkParam(widget, 'padding', 0, expected=('0',))
         self.checkParam(widget, 'padding', 5, expected=('5',))
@@ -38,7 +38,7 @@
         self.checkParam(widget, 'padding', ('5p', '6p', '7p', '8p'))
         self.checkParam(widget, 'padding', (), expected='')
 
-    def test_style(self):
+    def test_configure_style(self):
         widget = self.create()
         self.assertEqual(widget['style'], '')
         errmsg = 'Layout Foo not found'
@@ -61,7 +61,6 @@
         self.widget = ttk.Button(self.root, width=0, text="Text")
         self.widget.pack()
 
-
     def test_identify(self):
         self.widget.update()
         self.assertEqual(self.widget.identify(
@@ -74,7 +73,6 @@
         self.assertRaises(tkinter.TclError, self.widget.identify, 5, None)
         self.assertRaises(tkinter.TclError, self.widget.identify, 5, '')
 
-
     def test_widget_state(self):
         # XXX not sure about the portability of all these tests
         self.assertEqual(self.widget.state(), ())
@@ -139,14 +137,14 @@
     def create(self, **kwargs):
         return ttk.LabelFrame(self.root, **kwargs)
 
-    def test_labelanchor(self):
+    def test_configure_labelanchor(self):
         widget = self.create()
         self.checkEnumParam(widget, 'labelanchor',
                 'e', 'en', 'es', 'n', 'ne', 'nw', 's', 'se', 'sw', 'w', 'wn', 'ws',
                 errmsg='Bad label anchor specification {}')
         self.checkInvalidParam(widget, 'labelanchor', 'center')
 
-    def test_labelwidget(self):
+    def test_configure_labelwidget(self):
         widget = self.create()
         label = ttk.Label(self.root, text='Mupp', name='foo')
         self.checkParam(widget, 'labelwidget', label, expected='.foo')
@@ -168,17 +166,20 @@
         self.checkInvalidParam(widget, name, 'spam',
                 errmsg='image "spam" doesn\'t exist')
 
-    def test_compound(self):
+    def test_configure_compound(self):
+        options = 'none text image center top bottom left right'.split()
+        errmsg = (
+            'bad compound "{}": must be'
+            f' {", ".join(options[:-1])}, or {options[-1]}'
+            )
         widget = self.create()
-        self.checkEnumParam(widget, 'compound',
-                'none', 'text', 'image', 'center',
-                'top', 'bottom', 'left', 'right')
+        self.checkEnumParam(widget, 'compound', *options, errmsg=errmsg)
 
-    def test_state(self):
+    def test_configure_state(self):
         widget = self.create()
         self.checkParams(widget, 'state', 'active', 'disabled', 'normal')
 
-    def test_width(self):
+    def test_configure_width(self):
         widget = self.create()
         self.checkParams(widget, 'width', 402, -402, 0)
 
@@ -197,7 +198,7 @@
     def create(self, **kwargs):
         return ttk.Label(self.root, **kwargs)
 
-    def test_font(self):
+    def test_configure_font(self):
         widget = self.create()
         self.checkParam(widget, 'font',
                         '-Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*')
@@ -215,7 +216,7 @@
     def create(self, **kwargs):
         return ttk.Button(self.root, **kwargs)
 
-    def test_default(self):
+    def test_configure_default(self):
         widget = self.create()
         self.checkEnumParam(widget, 'default', 'normal', 'active', 'disabled')
 
@@ -240,11 +241,11 @@
     def create(self, **kwargs):
         return ttk.Checkbutton(self.root, **kwargs)
 
-    def test_offvalue(self):
+    def test_configure_offvalue(self):
         widget = self.create()
         self.checkParams(widget, 'offvalue', 1, 2.3, '', 'any string')
 
-    def test_onvalue(self):
+    def test_configure_onvalue(self):
         widget = self.create()
         self.checkParams(widget, 'onvalue', 1, 2.3, '', 'any string')
 
@@ -284,6 +285,7 @@
         'show', 'state', 'style', 'takefocus', 'textvariable',
         'validate', 'validatecommand', 'width', 'xscrollcommand',
     )
+    IDENTIFY_AS = 'Entry.field' if sys.platform == 'darwin' else 'textarea'
 
     def setUp(self):
         super().setUp()
@@ -292,54 +294,47 @@
     def create(self, **kwargs):
         return ttk.Entry(self.root, **kwargs)
 
-    def test_invalidcommand(self):
+    def test_configure_invalidcommand(self):
         widget = self.create()
         self.checkCommandParam(widget, 'invalidcommand')
 
-    def test_show(self):
+    def test_configure_show(self):
         widget = self.create()
         self.checkParam(widget, 'show', '*')
         self.checkParam(widget, 'show', '')
         self.checkParam(widget, 'show', ' ')
 
-    def test_state(self):
+    def test_configure_state(self):
         widget = self.create()
         self.checkParams(widget, 'state',
                          'disabled', 'normal', 'readonly')
 
-    def test_validate(self):
+    def test_configure_validate(self):
         widget = self.create()
         self.checkEnumParam(widget, 'validate',
                 'all', 'key', 'focus', 'focusin', 'focusout', 'none')
 
-    def test_validatecommand(self):
+    def test_configure_validatecommand(self):
         widget = self.create()
         self.checkCommandParam(widget, 'validatecommand')
 
-
     def test_bbox(self):
         self.assertIsBoundingBox(self.entry.bbox(0))
         self.assertRaises(tkinter.TclError, self.entry.bbox, 'noindex')
         self.assertRaises(tkinter.TclError, self.entry.bbox, None)
 
-
     def test_identify(self):
         self.entry.pack()
         self.entry.update()
 
         # bpo-27313: macOS Cocoa widget differs from X, allow either
-        if sys.platform == 'darwin':
-            self.assertIn(self.entry.identify(5, 5),
-                ("textarea", "Combobox.button") )
-        else:
-            self.assertEqual(self.entry.identify(5, 5), "textarea")
+        self.assertEqual(self.entry.identify(5, 5), self.IDENTIFY_AS)
         self.assertEqual(self.entry.identify(-1, -1), "")
 
         self.assertRaises(tkinter.TclError, self.entry.identify, None, 5)
         self.assertRaises(tkinter.TclError, self.entry.identify, 5, None)
         self.assertRaises(tkinter.TclError, self.entry.identify, 5, '')
 
-
     def test_validation_options(self):
         success = []
         test_invalid = lambda: success.append(True)
@@ -367,7 +362,6 @@
         self.entry['validatecommand'] = True
         self.assertRaises(tkinter.TclError, self.entry.validate)
 
-
     def test_validation(self):
         validation = []
         def validate(to_insert):
@@ -385,7 +379,6 @@
         self.assertEqual(validation, [False, True])
         self.assertEqual(self.entry.get(), 'a')
 
-
     def test_revalidation(self):
         def validate(content):
             for letter in content:
@@ -421,6 +414,7 @@
         'validate', 'validatecommand', 'values',
         'width', 'xscrollcommand',
     )
+    IDENTIFY_AS = 'Combobox.button' if sys.platform == 'darwin' else 'textarea'
 
     def setUp(self):
         super().setUp()
@@ -429,14 +423,15 @@
     def create(self, **kwargs):
         return ttk.Combobox(self.root, **kwargs)
 
-    def test_height(self):
+    def test_configure_height(self):
         widget = self.create()
         self.checkParams(widget, 'height', 100, 101.2, 102.6, -100, 0, '1i')
 
     def _show_drop_down_listbox(self):
         width = self.combo.winfo_width()
         x, y = width - 5, 5
-        self.assertRegex(self.combo.identify(x, y), r'.*downarrow\Z')
+        if sys.platform != 'darwin':  # there's no down arrow on macOS
+            self.assertRegex(self.combo.identify(x, y), r'.*downarrow\Z')
         self.combo.event_generate('<ButtonPress-1>', x=x, y=y)
         self.combo.event_generate('<ButtonRelease-1>', x=x, y=y)
         self.combo.update_idletasks()
@@ -458,8 +453,7 @@
 
         self.assertTrue(success)
 
-
-    def test_postcommand(self):
+    def test_configure_postcommand(self):
         success = []
 
         self.combo['postcommand'] = lambda: success.append(True)
@@ -474,8 +468,7 @@
         self._show_drop_down_listbox()
         self.assertEqual(len(success), 1)
 
-
-    def test_values(self):
+    def test_configure_values(self):
         def check_get_current(getval, currval):
             self.assertEqual(self.combo.get(), getval)
             self.assertEqual(self.combo.current(), currval)
@@ -551,7 +544,7 @@
     def create(self, **kwargs):
         return ttk.PanedWindow(self.root, **kwargs)
 
-    def test_orient(self):
+    def test_configure_orient(self):
         widget = self.create()
         self.assertEqual(str(widget['orient']), 'vertical')
         errmsg='attempt to change read-only option'
@@ -589,7 +582,6 @@
         other_child.destroy()
         self.assertRaises(tkinter.TclError, self.paned.pane, 0)
 
-
     def test_forget(self):
         self.assertRaises(tkinter.TclError, self.paned.forget, None)
         self.assertRaises(tkinter.TclError, self.paned.forget, 0)
@@ -598,7 +590,6 @@
         self.paned.forget(0)
         self.assertRaises(tkinter.TclError, self.paned.forget, 0)
 
-
     def test_insert(self):
         self.assertRaises(tkinter.TclError, self.paned.insert, None, 0)
         self.assertRaises(tkinter.TclError, self.paned.insert, 0, None)
@@ -633,7 +624,6 @@
         self.assertEqual(self.paned.panes(),
             (str(child3), str(child2), str(child)))
 
-
     def test_pane(self):
         self.assertRaises(tkinter.TclError, self.paned.pane, 0)
 
@@ -650,7 +640,6 @@
         self.assertRaises(tkinter.TclError, self.paned.pane, 0,
             badoption='somevalue')
 
-
     def test_sashpos(self):
         self.assertRaises(tkinter.TclError, self.paned.sashpos, None)
         self.assertRaises(tkinter.TclError, self.paned.sashpos, '')
@@ -684,11 +673,11 @@
     def create(self, **kwargs):
         return ttk.Radiobutton(self.root, **kwargs)
 
-    def test_value(self):
+    def test_configure_value(self):
         widget = self.create()
         self.checkParams(widget, 'value', 1, 2.3, '', 'any string')
 
-    def test_invoke(self):
+    def test_configure_invoke(self):
         success = []
         def cb_test():
             success.append(1)
@@ -739,7 +728,7 @@
         self.checkEnumParam(widget, 'direction',
                 'above', 'below', 'left', 'right', 'flush')
 
-    def test_menu(self):
+    def test_configure_menu(self):
         widget = self.create()
         menu = tkinter.Menu(widget, name='menu')
         self.checkParam(widget, 'menu', menu, conv=str)
@@ -764,19 +753,19 @@
     def create(self, **kwargs):
         return ttk.Scale(self.root, **kwargs)
 
-    def test_from(self):
+    def test_configure_from(self):
         widget = self.create()
         self.checkFloatParam(widget, 'from', 100, 14.9, 15.1, conv=False)
 
-    def test_length(self):
+    def test_configure_length(self):
         widget = self.create()
         self.checkPixelsParam(widget, 'length', 130, 131.2, 135.6, '5i')
 
-    def test_to(self):
+    def test_configure_to(self):
         widget = self.create()
         self.checkFloatParam(widget, 'to', 300, 14.9, 15.1, -10, conv=False)
 
-    def test_value(self):
+    def test_configure_value(self):
         widget = self.create()
         self.checkFloatParam(widget, 'value', 300, 14.9, 15.1, -10, conv=False)
 
@@ -798,7 +787,6 @@
 
         self.assertFalse(failure)
 
-
     def test_get(self):
         if self.wantobjects:
             conv = lambda x: x
@@ -816,7 +804,6 @@
         self.assertRaises(tkinter.TclError, self.scale.get, '', 0)
         self.assertRaises(tkinter.TclError, self.scale.get, 0, '')
 
-
     def test_set(self):
         if self.wantobjects:
             conv = lambda x: x
@@ -839,6 +826,7 @@
         self.assertEqual(conv(self.scale.get()), var.get())
         self.assertEqual(conv(self.scale.get()), max + 5)
         del var
+        gc_collect()  # For PyPy or other GCs.
 
         # the same happens with the value option
         self.scale['value'] = max + 10
@@ -866,23 +854,23 @@
     def create(self, **kwargs):
         return ttk.Progressbar(self.root, **kwargs)
 
-    def test_length(self):
+    def test_configure_length(self):
         widget = self.create()
         self.checkPixelsParam(widget, 'length', 100.1, 56.7, '2i')
 
-    def test_maximum(self):
+    def test_configure_maximum(self):
         widget = self.create()
         self.checkFloatParam(widget, 'maximum', 150.2, 77.7, 0, -10, conv=False)
 
-    def test_mode(self):
+    def test_configure_mode(self):
         widget = self.create()
         self.checkEnumParam(widget, 'mode', 'determinate', 'indeterminate')
 
-    def test_phase(self):
+    def test_configure_phase(self):
         # XXX
         pass
 
-    def test_value(self):
+    def test_configure_value(self):
         widget = self.create()
         self.checkFloatParam(widget, 'value', 150.2, 77.7, 0, -10,
                              conv=False)
@@ -948,7 +936,6 @@
         else:
             self.fail("Tab with text 'a' not found")
 
-
     def test_add_and_hidden(self):
         self.assertRaises(tkinter.TclError, self.nb.hide, -1)
         self.assertRaises(tkinter.TclError, self.nb.hide, 'hi')
@@ -967,7 +954,7 @@
         tabs = self.nb.tabs()
 
         curr = self.nb.index('current')
-        # verify that the tab gets readded at its previous position
+        # verify that the tab gets re-added at its previous position
         child2_index = self.nb.index(self.child2)
         self.nb.hide(self.child2)
         self.nb.add(self.child2)
@@ -977,7 +964,6 @@
         # but the tab next to it (not hidden) is the one selected now
         self.assertEqual(self.nb.index('current'), curr + 1)
 
-
     def test_forget(self):
         self.assertRaises(tkinter.TclError, self.nb.forget, -1)
         self.assertRaises(tkinter.TclError, self.nb.forget, 'hi')
@@ -993,7 +979,6 @@
         self.assertEqual(self.nb.index(self.child1), 1)
         self.assertNotEqual(child1_index, self.nb.index(self.child1))
 
-
     def test_index(self):
         self.assertRaises(tkinter.TclError, self.nb.index, -1)
         self.assertRaises(tkinter.TclError, self.nb.index, None)
@@ -1003,7 +988,6 @@
         self.assertEqual(self.nb.index(self.child2), 1)
         self.assertEqual(self.nb.index('end'), 2)
 
-
     def test_insert(self):
         # moving tabs
         tabs = self.nb.tabs()
@@ -1036,7 +1020,6 @@
         self.assertRaises(tkinter.TclError, self.nb.insert, None, 0)
         self.assertRaises(tkinter.TclError, self.nb.insert, None, None)
 
-
     def test_select(self):
         self.nb.pack()
         self.nb.update()
@@ -1056,7 +1039,6 @@
         self.nb.update()
         self.assertTrue(tab_changed)
 
-
     def test_tab(self):
         self.assertRaises(tkinter.TclError, self.nb.tab, -1)
         self.assertRaises(tkinter.TclError, self.nb.tab, 'notab')
@@ -1070,8 +1052,7 @@
         self.assertEqual(self.nb.tab(self.child1, text=None), 'abc')
         self.assertEqual(self.nb.tab(self.child1, 'text'), 'abc')
 
-
-    def test_tabs(self):
+    def test_configure_tabs(self):
         self.assertEqual(len(self.nb.tabs()), 2)
 
         self.nb.forget(self.child1)
@@ -1079,14 +1060,14 @@
 
         self.assertEqual(self.nb.tabs(), ())
 
-
     def test_traversal(self):
         self.nb.pack()
         self.nb.update()
 
         self.nb.select(0)
 
-        self.assertEqual(self.nb.identify(5, 5), 'focus')
+        focus_identify_as = 'focus' if sys.platform != 'darwin' else ''
+        self.assertEqual(self.nb.identify(5, 5), focus_identify_as)
         simulate_mouse_click(self.nb, 5, 5)
         self.nb.focus_force()
         self.nb.event_generate('<Control-Tab>')
@@ -1099,15 +1080,24 @@
         self.assertEqual(self.nb.select(), str(self.child2))
 
         self.nb.tab(self.child1, text='a', underline=0)
+        self.nb.tab(self.child2, text='e', underline=0)
         self.nb.enable_traversal()
         self.nb.focus_force()
-        self.assertEqual(self.nb.identify(5, 5), 'focus')
+        self.assertEqual(self.nb.identify(5, 5), focus_identify_as)
         simulate_mouse_click(self.nb, 5, 5)
+        # on macOS Emacs-style keyboard shortcuts are region-dependent;
+        # let's use the regular arrow keys instead
         if sys.platform == 'darwin':
-            self.nb.event_generate('<Option-a>')
+            begin = '<Left>'
+            end = '<Right>'
         else:
-            self.nb.event_generate('<Alt-a>')
+            begin = '<Alt-a>'
+            end = '<Alt-e>'
+        self.nb.event_generate(begin)
         self.assertEqual(self.nb.select(), str(self.child1))
+        self.nb.event_generate(end)
+        self.assertEqual(self.nb.select(), str(self.child2))
+
 
 @add_standard_options(IntegerSizeTests, StandardTtkOptionsTests)
 class SpinboxTest(EntryTest, unittest.TestCase):
@@ -1118,6 +1108,7 @@
         'takefocus', 'textvariable', 'to', 'validate', 'validatecommand',
         'values', 'width', 'wrap', 'xscrollcommand',
     )
+    IDENTIFY_AS = 'Spinbox.field' if sys.platform == 'darwin' else 'textarea'
 
     def setUp(self):
         super().setUp()
@@ -1147,7 +1138,7 @@
         self.spin.event_generate('<ButtonRelease-1>', x=x, y=y)
         self.spin.update_idletasks()
 
-    def test_command(self):
+    def test_configure_command(self):
         success = []
 
         self.spin['command'] = lambda: success.append(True)
@@ -1167,7 +1158,7 @@
         self.spin.update()
         self.assertEqual(len(success), 2)
 
-    def test_to(self):
+    def test_configure_to(self):
         self.spin['from'] = 0
         self.spin['to'] = 5
         self.spin.set(4)
@@ -1179,7 +1170,7 @@
         self._click_increment_arrow()  # 5
         self.assertEqual(self.spin.get(), '5')
 
-    def test_from(self):
+    def test_configure_from(self):
         self.spin['from'] = 1
         self.spin['to'] = 10
         self.spin.set(2)
@@ -1189,7 +1180,7 @@
         self._click_decrement_arrow()  # 1
         self.assertEqual(self.spin.get(), '1')
 
-    def test_increment(self):
+    def test_configure_increment(self):
         self.spin['from'] = 0
         self.spin['to'] = 10
         self.spin['increment'] = 4
@@ -1203,7 +1194,7 @@
         self._click_decrement_arrow()  # 3
         self.assertEqual(self.spin.get(), '3')
 
-    def test_format(self):
+    def test_configure_format(self):
         self.spin.set(1)
         self.spin['format'] = '%10.3f'
         self.spin.update()
@@ -1220,7 +1211,7 @@
         self.assertTrue('.' not in value)
         self.assertEqual(len(value), 1)
 
-    def test_wrap(self):
+    def test_configure_wrap(self):
         self.spin['to'] = 10
         self.spin['from'] = 1
         self.spin.set(1)
@@ -1239,7 +1230,7 @@
         self._click_decrement_arrow()
         self.assertEqual(self.spin.get(), '1')
 
-    def test_values(self):
+    def test_configure_values(self):
         self.assertEqual(self.spin['values'],
                          () if tcl_version < (8, 5) else '')
         self.checkParam(self.spin, 'values', 'mon tue wed thur',
@@ -1299,14 +1290,14 @@
     def create(self, **kwargs):
         return ttk.Treeview(self.root, **kwargs)
 
-    def test_columns(self):
+    def test_configure_columns(self):
         widget = self.create()
         self.checkParam(widget, 'columns', 'a b c',
                         expected=('a', 'b', 'c'))
         self.checkParam(widget, 'columns', ('a', 'b', 'c'))
         self.checkParam(widget, 'columns', '')
 
-    def test_displaycolumns(self):
+    def test_configure_displaycolumns(self):
         widget = self.create()
         widget['columns'] = ('a', 'b', 'c')
         self.checkParam(widget, 'displaycolumns', 'b a c',
@@ -1322,17 +1313,17 @@
         self.checkInvalidParam(widget, 'displaycolumns', (1, -2),
                                errmsg='Column index -2 out of bounds')
 
-    def test_height(self):
+    def test_configure_height(self):
         widget = self.create()
         self.checkPixelsParam(widget, 'height', 100, -100, 0, '3c', conv=False)
         self.checkPixelsParam(widget, 'height', 101.2, 102.6, conv=noconv)
 
-    def test_selectmode(self):
+    def test_configure_selectmode(self):
         widget = self.create()
         self.checkEnumParam(widget, 'selectmode',
                             'none', 'browse', 'extended')
 
-    def test_show(self):
+    def test_configure_show(self):
         widget = self.create()
         self.checkParam(widget, 'show', 'tree headings',
                         expected=('tree', 'headings'))
@@ -1366,7 +1357,6 @@
         child1 = self.tv.insert(item_id, 'end')
         self.assertEqual(self.tv.bbox(child1), '')
 
-
     def test_children(self):
         # no children yet, should get an empty tuple
         self.assertEqual(self.tv.get_children(), ())
@@ -1394,7 +1384,6 @@
         self.tv.set_children('')
         self.assertEqual(self.tv.get_children(), ())
 
-
     def test_column(self):
         # return a dict with all options/values
         self.assertIsInstance(self.tv.column('#0'), dict)
@@ -1420,7 +1409,6 @@
             self.assertRaises(tkinter.TclError, self.tv.column, '#0',
                 **kw)
 
-
     def test_delete(self):
         self.assertRaises(tkinter.TclError, self.tv.delete, '#0')
 
@@ -1444,7 +1432,6 @@
         self.tv.delete(item1, item2)
         self.assertFalse(self.tv.get_children())
 
-
     def test_detach_reattach(self):
         item_id = self.tv.insert('', 'end')
         item2 = self.tv.insert(item_id, 'end')
@@ -1486,7 +1473,6 @@
         self.assertEqual(self.tv.get_children(), ())
         self.assertEqual(self.tv.get_children(item_id), ())
 
-
     def test_exists(self):
         self.assertEqual(self.tv.exists('something'), False)
         self.assertEqual(self.tv.exists(''), True)
@@ -1497,7 +1483,6 @@
         # in the tcl interpreter since tk requires an item.
         self.assertRaises(tkinter.TclError, self.tv.exists, None)
 
-
     def test_focus(self):
         # nothing is focused right now
         self.assertEqual(self.tv.focus(), '')
@@ -1512,7 +1497,6 @@
         # try focusing inexistent item
         self.assertRaises(tkinter.TclError, self.tv.focus, 'hi')
 
-
     def test_heading(self):
         # check a dict is returned
         self.assertIsInstance(self.tv.heading('#0'), dict)
@@ -1564,7 +1548,6 @@
         #self.tv.heading('#0', command='I dont exist')
         #simulate_heading_click(5, 5)
 
-
     def test_index(self):
         # item 'what' doesn't exist
         self.assertRaises(tkinter.TclError, self.tv.index, 'what')
@@ -1595,7 +1578,6 @@
         self.tv.delete(item1)
         self.assertRaises(tkinter.TclError, self.tv.index, c2)
 
-
     def test_insert_item(self):
         # parent 'none' doesn't exist
         self.assertRaises(tkinter.TclError, self.tv.insert, 'none', 'end')
@@ -1672,7 +1654,6 @@
         self.assertRaises(tkinter.TclError, self.tv.insert, '', 'end', False)
         self.assertRaises(tkinter.TclError, self.tv.insert, '', 'end', '')
 
-
     def test_selection(self):
         self.assertRaises(TypeError, self.tv.selection, 'spam')
         # item 'none' doesn't exist
@@ -1743,7 +1724,6 @@
         self.tv.selection_toggle((c1, c3))
         self.assertEqual(self.tv.selection(), (c3, item2))
 
-
     def test_set(self):
         self.tv['columns'] = ['A', 'B']
         item = self.tv.insert('', 'end', values=['a', 'b'])
@@ -1776,7 +1756,6 @@
         # inexistent item
         self.assertRaises(tkinter.TclError, self.tv.set, 'notme')
 
-
     def test_tag_bind(self):
         events = []
         item1 = self.tv.insert('', 'end', tags=['call'])
@@ -1809,7 +1788,6 @@
         for evt in zip(events[::2], events[1::2]):
             self.assertEqual(evt, (1, 2))
 
-
     def test_tag_configure(self):
         # Just testing parameter passing for now
         self.assertRaises(TypeError, self.tv.tag_configure)
@@ -1860,12 +1838,22 @@
     def create(self, **kwargs):
         return ttk.Sizegrip(self.root, **kwargs)
 
+
+class DefaultRootTest(AbstractDefaultRootTest, unittest.TestCase):
+
+    def test_frame(self):
+        self._test_widget(ttk.Frame)
+
+    def test_label(self):
+        self._test_widget(ttk.Label)
+
+
 tests_gui = (
         ButtonTest, CheckbuttonTest, ComboboxTest, EntryTest,
         FrameTest, LabelFrameTest, LabelTest, MenubuttonTest,
         NotebookTest, PanedWindowTest, ProgressbarTest,
         RadiobuttonTest, ScaleTest, ScrollbarTest, SeparatorTest,
-        SizegripTest, SpinboxTest, TreeviewTest, WidgetTest,
+        SizegripTest, SpinboxTest, TreeviewTest, WidgetTest, DefaultRootTest,
         )
 
 if __name__ == "__main__":
diff --git a/Lib/tkinter/test/widget_tests.py b/Lib/tkinter/test/widget_tests.py
index b42ff52..9702ff4 100644
--- a/Lib/tkinter/test/widget_tests.py
+++ b/Lib/tkinter/test/widget_tests.py
@@ -1,7 +1,6 @@
 # Common tests for test_tkinter/test_widgets.py and test_ttk/test_widgets.py
 
 import unittest
-import sys
 import tkinter
 from tkinter.test.support import (AbstractTkTest, tcl_version, requires_tcl,
                                   get_tk_patchlevel, pixels_conv, tcl_obj_eq)
@@ -243,31 +242,31 @@
         'underline', 'wraplength', 'xscrollcommand', 'yscrollcommand',
     )
 
-    def test_activebackground(self):
+    def test_configure_activebackground(self):
         widget = self.create()
         self.checkColorParam(widget, 'activebackground')
 
-    def test_activeborderwidth(self):
+    def test_configure_activeborderwidth(self):
         widget = self.create()
         self.checkPixelsParam(widget, 'activeborderwidth',
                               0, 1.3, 2.9, 6, -2, '10p')
 
-    def test_activeforeground(self):
+    def test_configure_activeforeground(self):
         widget = self.create()
         self.checkColorParam(widget, 'activeforeground')
 
-    def test_anchor(self):
+    def test_configure_anchor(self):
         widget = self.create()
         self.checkEnumParam(widget, 'anchor',
                 'n', 'ne', 'e', 'se', 's', 'sw', 'w', 'nw', 'center')
 
-    def test_background(self):
+    def test_configure_background(self):
         widget = self.create()
         self.checkColorParam(widget, 'background')
         if 'bg' in self.OPTIONS:
             self.checkColorParam(widget, 'bg')
 
-    def test_bitmap(self):
+    def test_configure_bitmap(self):
         widget = self.create()
         self.checkParam(widget, 'bitmap', 'questhead')
         self.checkParam(widget, 'bitmap', 'gray50')
@@ -280,90 +279,88 @@
             self.checkInvalidParam(widget, 'bitmap', 'spam',
                     errmsg='bitmap "spam" not defined')
 
-    def test_borderwidth(self):
+    def test_configure_borderwidth(self):
         widget = self.create()
         self.checkPixelsParam(widget, 'borderwidth',
                               0, 1.3, 2.6, 6, -2, '10p')
         if 'bd' in self.OPTIONS:
             self.checkPixelsParam(widget, 'bd', 0, 1.3, 2.6, 6, -2, '10p')
 
-    def test_compound(self):
+    def test_configure_compound(self):
         widget = self.create()
         self.checkEnumParam(widget, 'compound',
                 'bottom', 'center', 'left', 'none', 'right', 'top')
 
-    def test_cursor(self):
+    def test_configure_cursor(self):
         widget = self.create()
         self.checkCursorParam(widget, 'cursor')
 
-    def test_disabledforeground(self):
+    def test_configure_disabledforeground(self):
         widget = self.create()
         self.checkColorParam(widget, 'disabledforeground')
 
-    def test_exportselection(self):
+    def test_configure_exportselection(self):
         widget = self.create()
         self.checkBooleanParam(widget, 'exportselection')
 
-    def test_font(self):
+    def test_configure_font(self):
         widget = self.create()
         self.checkParam(widget, 'font',
                         '-Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*')
         self.checkInvalidParam(widget, 'font', '',
                                errmsg='font "" doesn\'t exist')
 
-    def test_foreground(self):
+    def test_configure_foreground(self):
         widget = self.create()
         self.checkColorParam(widget, 'foreground')
         if 'fg' in self.OPTIONS:
             self.checkColorParam(widget, 'fg')
 
-    def test_highlightbackground(self):
+    def test_configure_highlightbackground(self):
         widget = self.create()
         self.checkColorParam(widget, 'highlightbackground')
 
-    def test_highlightcolor(self):
+    def test_configure_highlightcolor(self):
         widget = self.create()
         self.checkColorParam(widget, 'highlightcolor')
 
-    def test_highlightthickness(self):
+    def test_configure_highlightthickness(self):
         widget = self.create()
         self.checkPixelsParam(widget, 'highlightthickness',
                               0, 1.3, 2.6, 6, '10p')
         self.checkParam(widget, 'highlightthickness', -2, expected=0,
                         conv=self._conv_pixels)
 
-    @unittest.skipIf(sys.platform == 'darwin',
-                     'crashes with Cocoa Tk (issue19733)')
-    def test_image(self):
+    def test_configure_image(self):
         widget = self.create()
         self.checkImageParam(widget, 'image')
 
-    def test_insertbackground(self):
+    def test_configure_insertbackground(self):
         widget = self.create()
         self.checkColorParam(widget, 'insertbackground')
 
-    def test_insertborderwidth(self):
+    def test_configure_insertborderwidth(self):
         widget = self.create()
         self.checkPixelsParam(widget, 'insertborderwidth',
                               0, 1.3, 2.6, 6, -2, '10p')
 
-    def test_insertofftime(self):
+    def test_configure_insertofftime(self):
         widget = self.create()
         self.checkIntegerParam(widget, 'insertofftime', 100)
 
-    def test_insertontime(self):
+    def test_configure_insertontime(self):
         widget = self.create()
         self.checkIntegerParam(widget, 'insertontime', 100)
 
-    def test_insertwidth(self):
+    def test_configure_insertwidth(self):
         widget = self.create()
         self.checkPixelsParam(widget, 'insertwidth', 1.3, 2.6, -2, '10p')
 
-    def test_jump(self):
+    def test_configure_jump(self):
         widget = self.create()
         self.checkBooleanParam(widget, 'jump')
 
-    def test_justify(self):
+    def test_configure_justify(self):
         widget = self.create()
         self.checkEnumParam(widget, 'justify', 'left', 'right', 'center',
                 errmsg='bad justification "{}": must be '
@@ -372,154 +369,155 @@
                 errmsg='ambiguous justification "": must be '
                        'left, right, or center')
 
-    def test_orient(self):
+    def test_configure_orient(self):
         widget = self.create()
         self.assertEqual(str(widget['orient']), self.default_orient)
         self.checkEnumParam(widget, 'orient', 'horizontal', 'vertical')
 
-    def test_padx(self):
+    def test_configure_padx(self):
         widget = self.create()
         self.checkPixelsParam(widget, 'padx', 3, 4.4, 5.6, -2, '12m',
                               conv=self._conv_pad_pixels)
 
-    def test_pady(self):
+    def test_configure_pady(self):
         widget = self.create()
         self.checkPixelsParam(widget, 'pady', 3, 4.4, 5.6, -2, '12m',
                               conv=self._conv_pad_pixels)
 
-    def test_relief(self):
+    def test_configure_relief(self):
         widget = self.create()
         self.checkReliefParam(widget, 'relief')
 
-    def test_repeatdelay(self):
+    def test_configure_repeatdelay(self):
         widget = self.create()
         self.checkIntegerParam(widget, 'repeatdelay', -500, 500)
 
-    def test_repeatinterval(self):
+    def test_configure_repeatinterval(self):
         widget = self.create()
         self.checkIntegerParam(widget, 'repeatinterval', -500, 500)
 
-    def test_selectbackground(self):
+    def test_configure_selectbackground(self):
         widget = self.create()
         self.checkColorParam(widget, 'selectbackground')
 
-    def test_selectborderwidth(self):
+    def test_configure_selectborderwidth(self):
         widget = self.create()
         self.checkPixelsParam(widget, 'selectborderwidth', 1.3, 2.6, -2, '10p')
 
-    def test_selectforeground(self):
+    def test_configure_selectforeground(self):
         widget = self.create()
         self.checkColorParam(widget, 'selectforeground')
 
-    def test_setgrid(self):
+    def test_configure_setgrid(self):
         widget = self.create()
         self.checkBooleanParam(widget, 'setgrid')
 
-    def test_state(self):
+    def test_configure_state(self):
         widget = self.create()
         self.checkEnumParam(widget, 'state', 'active', 'disabled', 'normal')
 
-    def test_takefocus(self):
+    def test_configure_takefocus(self):
         widget = self.create()
         self.checkParams(widget, 'takefocus', '0', '1', '')
 
-    def test_text(self):
+    def test_configure_text(self):
         widget = self.create()
         self.checkParams(widget, 'text', '', 'any string')
 
-    def test_textvariable(self):
+    def test_configure_textvariable(self):
         widget = self.create()
         var = tkinter.StringVar(self.root)
         self.checkVariableParam(widget, 'textvariable', var)
 
-    def test_troughcolor(self):
+    def test_configure_troughcolor(self):
         widget = self.create()
         self.checkColorParam(widget, 'troughcolor')
 
-    def test_underline(self):
+    def test_configure_underline(self):
         widget = self.create()
         self.checkIntegerParam(widget, 'underline', 0, 1, 10)
 
-    def test_wraplength(self):
+    def test_configure_wraplength(self):
         widget = self.create()
         self.checkPixelsParam(widget, 'wraplength', 100)
 
-    def test_xscrollcommand(self):
+    def test_configure_xscrollcommand(self):
         widget = self.create()
         self.checkCommandParam(widget, 'xscrollcommand')
 
-    def test_yscrollcommand(self):
+    def test_configure_yscrollcommand(self):
         widget = self.create()
         self.checkCommandParam(widget, 'yscrollcommand')
 
     # non-standard but common options
 
-    def test_command(self):
+    def test_configure_command(self):
         widget = self.create()
         self.checkCommandParam(widget, 'command')
 
-    def test_indicatoron(self):
+    def test_configure_indicatoron(self):
         widget = self.create()
         self.checkBooleanParam(widget, 'indicatoron')
 
-    def test_offrelief(self):
+    def test_configure_offrelief(self):
         widget = self.create()
         self.checkReliefParam(widget, 'offrelief')
 
-    def test_overrelief(self):
+    def test_configure_overrelief(self):
         widget = self.create()
         self.checkReliefParam(widget, 'overrelief')
 
-    def test_selectcolor(self):
+    def test_configure_selectcolor(self):
         widget = self.create()
         self.checkColorParam(widget, 'selectcolor')
 
-    def test_selectimage(self):
+    def test_configure_selectimage(self):
         widget = self.create()
         self.checkImageParam(widget, 'selectimage')
 
     @requires_tcl(8, 5)
-    def test_tristateimage(self):
+    def test_configure_tristateimage(self):
         widget = self.create()
         self.checkImageParam(widget, 'tristateimage')
 
     @requires_tcl(8, 5)
-    def test_tristatevalue(self):
+    def test_configure_tristatevalue(self):
         widget = self.create()
         self.checkParam(widget, 'tristatevalue', 'unknowable')
 
-    def test_variable(self):
+    def test_configure_variable(self):
         widget = self.create()
         var = tkinter.DoubleVar(self.root)
         self.checkVariableParam(widget, 'variable', var)
 
 
 class IntegerSizeTests:
-    def test_height(self):
+    def test_configure_height(self):
         widget = self.create()
         self.checkIntegerParam(widget, 'height', 100, -100, 0)
 
-    def test_width(self):
+    def test_configure_width(self):
         widget = self.create()
         self.checkIntegerParam(widget, 'width', 402, -402, 0)
 
 
 class PixelSizeTests:
-    def test_height(self):
+    def test_configure_height(self):
         widget = self.create()
         self.checkPixelsParam(widget, 'height', 100, 101.2, 102.6, -100, 0, '3c')
 
-    def test_width(self):
+    def test_configure_width(self):
         widget = self.create()
         self.checkPixelsParam(widget, 'width', 402, 403.4, 404.6, -402, 0, '5i')
 
 
 def add_standard_options(*source_classes):
-    # This decorator adds test_xxx methods from source classes for every xxx
-    # option in the OPTIONS class attribute if they are not defined explicitly.
+    # This decorator adds test_configure_xxx methods from source classes for
+    # every xxx option in the OPTIONS class attribute if they are not defined
+    # explicitly.
     def decorator(cls):
         for option in cls.OPTIONS:
-            methodname = 'test_' + option
+            methodname = 'test_configure_' + option
             if not hasattr(cls, methodname):
                 for source_class in source_classes:
                     if hasattr(source_class, methodname):
diff --git a/Lib/tkinter/tix.py b/Lib/tkinter/tix.py
index ac54550..44ecae1 100644
--- a/Lib/tkinter/tix.py
+++ b/Lib/tkinter/tix.py
@@ -21,13 +21,20 @@
 # Compare the demo tixwidgets.py to the original Tcl program and you will
 # appreciate the advantages.
 #
+# NOTE: This module is deprecated since Python 3.6.
 
 import os
+import warnings
 import tkinter
 from tkinter import *
 from tkinter import _cnfmerge
 
-import _tkinter # If this fails your Python may not be configured for Tk
+warnings.warn(
+    'The Tix Tk extension is unmaintained, and the tkinter.tix wrapper module'
+    ' is deprecated in favor of tkinter.ttk',
+    DeprecationWarning,
+    stacklevel=2,
+    )
 
 # Some more constants (for consistency with Tkinter)
 WINDOW = 'window'
@@ -386,10 +393,8 @@
             self.tk.call(name, 'configure', '-' + option, value)
     # These are missing from Tkinter
     def image_create(self, imgtype, cnf={}, master=None, **kw):
-        if not master:
-            master = tkinter._default_root
-            if not master:
-                raise RuntimeError('Too early to create image')
+        if master is None:
+            master = self
         if kw and cnf: cnf = _cnfmerge((cnf, kw))
         elif kw: cnf = kw
         options = ()
@@ -469,16 +474,13 @@
     (multiple) Display Items"""
 
     def __init__(self, itemtype, cnf={}, *, master=None, **kw):
-        if not master:
+        if master is None:
             if 'refwindow' in kw:
                 master = kw['refwindow']
             elif 'refwindow' in cnf:
                 master = cnf['refwindow']
             else:
-                master = tkinter._default_root
-                if not master:
-                    raise RuntimeError("Too early to create display style: "
-                                       "no root window")
+                master = tkinter._get_default_root('create display style')
         self.tk = master.tk
         self.stylename = self.tk.call('tixDisplayStyle', itemtype,
                             *self._options(cnf,kw) )
@@ -867,7 +869,7 @@
         return self.tk.call(self._w, 'add', entry, *self._options(cnf, kw))
 
     def add_child(self, parent=None, cnf={}, **kw):
-        if not parent:
+        if parent is None:
             parent = ''
         return self.tk.call(
                      self._w, 'addchild', parent, *self._options(cnf, kw))
diff --git a/Lib/tkinter/ttk.py b/Lib/tkinter/ttk.py
index 968fd54..acdd565 100644
--- a/Lib/tkinter/ttk.py
+++ b/Lib/tkinter/ttk.py
@@ -349,12 +349,7 @@
     If it is not allowed to use the default root and master is None,
     RuntimeError is raised."""
     if master is None:
-        if tkinter._support_default_root:
-            master = tkinter._default_root or tkinter.Tk()
-        else:
-            raise RuntimeError(
-                    "No master specified and tkinter is "
-                    "configured to not support default root")
+        master = tkinter._get_default_root()
     return master
 
 
@@ -574,7 +569,7 @@
         matches statespec. statespec is expected to be a sequence."""
         ret = self.tk.getboolean(
                 self.tk.call(self._w, "instate", ' '.join(statespec)))
-        if ret and callback:
+        if ret and callback is not None:
             return callback(*args, **kw)
 
         return ret
@@ -1538,7 +1533,10 @@
         scale_side = 'bottom' if self._label_top else 'top'
         label_side = 'top' if scale_side == 'bottom' else 'bottom'
         self.scale.pack(side=scale_side, fill='x')
-        tmp = Label(self).pack(side=label_side) # place holder
+        # Dummy required to make frame correct height
+        dummy = Label(self)
+        dummy.pack(side=label_side)
+        dummy.lower()
         self.label.place(anchor='n' if label_side == 'top' else 's')
 
         # update the label as scale or variable changes
@@ -1645,7 +1643,10 @@
         menu.delete(0, 'end')
         for val in values:
             menu.add_radiobutton(label=val,
-                command=tkinter._setit(self._variable, val, self._callback),
+                command=(
+                    None if self._callback is None
+                    else lambda val=val: self._callback(val)
+                ),
                 variable=self._variable)
 
         if default:
diff --git a/Lib/token.py b/Lib/token.py
index 493bf04..9d0c0bf 100644
--- a/Lib/token.py
+++ b/Lib/token.py
@@ -62,12 +62,13 @@
 ASYNC = 56
 TYPE_IGNORE = 57
 TYPE_COMMENT = 58
+SOFT_KEYWORD = 59
 # These aren't used by the C tokenizer but are needed for tokenize.py
-ERRORTOKEN = 59
-COMMENT = 60
-NL = 61
-ENCODING = 62
-N_TOKENS = 63
+ERRORTOKEN = 60
+COMMENT = 61
+NL = 62
+ENCODING = 63
+N_TOKENS = 64
 # Special definitions for cooperation with parser
 NT_OFFSET = 256
 
diff --git a/Lib/tokenize.py b/Lib/tokenize.py
index 1aee21b..7d7736f 100644
--- a/Lib/tokenize.py
+++ b/Lib/tokenize.py
@@ -27,6 +27,7 @@
 from builtins import open as _builtin_open
 from codecs import lookup, BOM_UTF8
 import collections
+import functools
 from io import TextIOWrapper
 import itertools as _itertools
 import re
@@ -95,6 +96,7 @@
                 result.add(''.join(u))
     return result
 
+@functools.lru_cache
 def _compile(expr):
     return re.compile(expr, re.UNICODE)
 
@@ -602,7 +604,7 @@
                 pos += 1
 
     # Add an implicit NEWLINE if the input doesn't end in one
-    if last_line and last_line[-1] not in '\r\n':
+    if last_line and last_line[-1] not in '\r\n' and not last_line.strip().startswith("#"):
         yield TokenInfo(NEWLINE, '', (lnum - 1, len(last_line)), (lnum - 1, len(last_line) + 1), '')
     for indent in indents[1:]:                 # pop remaining indent levels
         yield TokenInfo(DEDENT, '', (lnum, 0), (lnum, 0), '')
diff --git a/Lib/trace.py b/Lib/trace.py
index c505d8b..2cf3643 100755
--- a/Lib/trace.py
+++ b/Lib/trace.py
@@ -116,7 +116,7 @@
         return 0
 
 def _modname(path):
-    """Return a plausible module name for the patch."""
+    """Return a plausible module name for the path."""
 
     base = os.path.basename(path)
     filename, ext = os.path.splitext(base)
diff --git a/Lib/traceback.py b/Lib/traceback.py
index fb34de9..d6a010f 100644
--- a/Lib/traceback.py
+++ b/Lib/traceback.py
@@ -84,7 +84,25 @@
     "another exception occurred:\n\n")
 
 
-def print_exception(etype, value, tb, limit=None, file=None, chain=True):
+class _Sentinel:
+    def __repr__(self):
+        return "<implicit>"
+
+_sentinel = _Sentinel()
+
+def _parse_value_tb(exc, value, tb):
+    if (value is _sentinel) != (tb is _sentinel):
+        raise ValueError("Both or neither of value and tb must be given")
+    if value is tb is _sentinel:
+        if exc is not None:
+            return exc, exc.__traceback__
+        else:
+            return None, None
+    return value, tb
+
+
+def print_exception(exc, /, value=_sentinel, tb=_sentinel, limit=None, \
+                    file=None, chain=True):
     """Print exception up to 'limit' stack trace entries from 'tb' to 'file'.
 
     This differs from print_tb() in the following ways: (1) if
@@ -95,17 +113,16 @@
     occurred with a caret on the next line indicating the approximate
     position of the error.
     """
-    # format_exception has ignored etype for some time, and code such as cgitb
-    # passes in bogus values as a result. For compatibility with such code we
-    # ignore it here (rather than in the new TracebackException API).
+    value, tb = _parse_value_tb(exc, value, tb)
     if file is None:
         file = sys.stderr
-    for line in TracebackException(
-            type(value), value, tb, limit=limit).format(chain=chain):
+    te = TracebackException(type(value), value, tb, limit=limit, compact=True)
+    for line in te.format(chain=chain):
         print(line, file=file, end="")
 
 
-def format_exception(etype, value, tb, limit=None, chain=True):
+def format_exception(exc, /, value=_sentinel, tb=_sentinel, limit=None, \
+                     chain=True):
     """Format a stack trace and the exception information.
 
     The arguments have the same meaning as the corresponding arguments
@@ -114,19 +131,15 @@
     these lines are concatenated and printed, exactly the same text is
     printed as does print_exception().
     """
-    # format_exception has ignored etype for some time, and code such as cgitb
-    # passes in bogus values as a result. For compatibility with such code we
-    # ignore it here (rather than in the new TracebackException API).
-    return list(TracebackException(
-        type(value), value, tb, limit=limit).format(chain=chain))
+    value, tb = _parse_value_tb(exc, value, tb)
+    te = TracebackException(type(value), value, tb, limit=limit, compact=True)
+    return list(te.format(chain=chain))
 
 
-def format_exception_only(etype, value):
+def format_exception_only(exc, /, value=_sentinel):
     """Format the exception part of a traceback.
 
-    The arguments are the exception type and value such as given by
-    sys.last_type and sys.last_value. The return value is a list of
-    strings, each ending in a newline.
+    The return value is a list of strings, each ending in a newline.
 
     Normally, the list contains a single string; however, for
     SyntaxError exceptions, it contains several lines that (when
@@ -137,7 +150,10 @@
     string in the list.
 
     """
-    return list(TracebackException(etype, value, None).format_exception_only())
+    if value is _sentinel:
+        value = exc
+    te = TracebackException(type(value), value, None, compact=True)
+    return list(te.format_exception_only())
 
 
 # -- not official API but folk probably use these two functions.
@@ -285,9 +301,10 @@
     @property
     def line(self):
         if self._line is None:
-            self._line = linecache.getline(self.filename, self.lineno).strip()
-        return self._line
-
+            if self.lineno is None:
+                return None
+            self._line = linecache.getline(self.filename, self.lineno)
+        return self._line.strip()
 
 def walk_stack(f):
     """Walk a stack yielding the frame and line number for each frame.
@@ -458,52 +475,29 @@
       occurred.
     - :attr:`lineno` For syntax errors - the linenumber where the error
       occurred.
+    - :attr:`end_lineno` For syntax errors - the end linenumber where the error
+      occurred. Can be `None` if not present.
     - :attr:`text` For syntax errors - the text where the error
       occurred.
     - :attr:`offset` For syntax errors - the offset into the text where the
       error occurred.
+    - :attr:`end_offset` For syntax errors - the offset into the text where the
+      error occurred. Can be `None` if not present.
     - :attr:`msg` For syntax errors - the compiler error message.
     """
 
     def __init__(self, exc_type, exc_value, exc_traceback, *, limit=None,
-            lookup_lines=True, capture_locals=False, _seen=None):
+            lookup_lines=True, capture_locals=False, compact=False,
+            _seen=None):
         # NB: we need to accept exc_traceback, exc_value, exc_traceback to
         # permit backwards compat with the existing API, otherwise we
         # need stub thunk objects just to glue it together.
         # Handle loops in __cause__ or __context__.
+        is_recursive_call = _seen is not None
         if _seen is None:
             _seen = set()
         _seen.add(id(exc_value))
-        # Gracefully handle (the way Python 2.4 and earlier did) the case of
-        # being called with no type or value (None, None, None).
-        if (exc_value and exc_value.__cause__ is not None
-            and id(exc_value.__cause__) not in _seen):
-            cause = TracebackException(
-                type(exc_value.__cause__),
-                exc_value.__cause__,
-                exc_value.__cause__.__traceback__,
-                limit=limit,
-                lookup_lines=False,
-                capture_locals=capture_locals,
-                _seen=_seen)
-        else:
-            cause = None
-        if (exc_value and exc_value.__context__ is not None
-            and id(exc_value.__context__) not in _seen):
-            context = TracebackException(
-                type(exc_value.__context__),
-                exc_value.__context__,
-                exc_value.__context__.__traceback__,
-                limit=limit,
-                lookup_lines=False,
-                capture_locals=capture_locals,
-                _seen=_seen)
-        else:
-            context = None
-        self.__cause__ = cause
-        self.__context__ = context
-        self.__suppress_context__ = \
-            exc_value.__suppress_context__ if exc_value else False
+
         # TODO: locals.
         self.stack = StackSummary.extract(
             walk_tb(exc_traceback), limit=limit, lookup_lines=lookup_lines,
@@ -515,12 +509,62 @@
         if exc_type and issubclass(exc_type, SyntaxError):
             # Handle SyntaxError's specially
             self.filename = exc_value.filename
-            self.lineno = str(exc_value.lineno)
+            lno = exc_value.lineno
+            self.lineno = str(lno) if lno is not None else None
+            end_lno = exc_value.end_lineno
+            self.end_lineno = str(end_lno) if end_lno is not None else None
             self.text = exc_value.text
             self.offset = exc_value.offset
+            self.end_offset = exc_value.end_offset
             self.msg = exc_value.msg
         if lookup_lines:
             self._load_lines()
+        self.__suppress_context__ = \
+            exc_value.__suppress_context__ if exc_value is not None else False
+
+        # Convert __cause__ and __context__ to `TracebackExceptions`s, use a
+        # queue to avoid recursion (only the top-level call gets _seen == None)
+        if not is_recursive_call:
+            queue = [(self, exc_value)]
+            while queue:
+                te, e = queue.pop()
+                if (e and e.__cause__ is not None
+                    and id(e.__cause__) not in _seen):
+                    cause = TracebackException(
+                        type(e.__cause__),
+                        e.__cause__,
+                        e.__cause__.__traceback__,
+                        limit=limit,
+                        lookup_lines=lookup_lines,
+                        capture_locals=capture_locals,
+                        _seen=_seen)
+                else:
+                    cause = None
+
+                if compact:
+                    need_context = (cause is None and
+                                    e is not None and
+                                    not e.__suppress_context__)
+                else:
+                    need_context = True
+                if (e and e.__context__ is not None
+                    and need_context and id(e.__context__) not in _seen):
+                    context = TracebackException(
+                        type(e.__context__),
+                        e.__context__,
+                        e.__context__.__traceback__,
+                        limit=limit,
+                        lookup_lines=lookup_lines,
+                        capture_locals=capture_locals,
+                        _seen=_seen)
+                else:
+                    context = None
+                te.__cause__ = cause
+                te.__context__ = context
+                if cause:
+                    queue.append((te.__cause__, e.__cause__))
+                if context:
+                    queue.append((te.__context__, e.__context__))
 
     @classmethod
     def from_exception(cls, exc, *args, **kwargs):
@@ -531,10 +575,6 @@
         """Private API. force all lines in the stack to be loaded."""
         for frame in self.stack:
             frame.line
-        if self.__context__:
-            self.__context__._load_lines()
-        if self.__cause__:
-            self.__cause__._load_lines()
 
     def __eq__(self, other):
         if isinstance(other, TracebackException):
@@ -564,6 +604,8 @@
         stype = self.exc_type.__qualname__
         smod = self.exc_type.__module__
         if smod not in ("__main__", "builtins"):
+            if not isinstance(smod, str):
+                smod = "<unknown>"
             stype = smod + '.' + stype
 
         if not issubclass(self.exc_type, SyntaxError):
@@ -574,9 +616,12 @@
     def _format_syntax_error(self, stype):
         """Format SyntaxError exceptions (internal helper)."""
         # Show exactly where the problem was found.
-        filename = self.filename or "<string>"
-        lineno = str(self.lineno) or '?'
-        yield '  File "{}", line {}\n'.format(filename, lineno)
+        filename_suffix = ''
+        if self.lineno is not None:
+            yield '  File "{}", line {}\n'.format(
+                self.filename or "<string>", self.lineno)
+        elif self.filename is not None:
+            filename_suffix = ' ({})'.format(self.filename)
 
         text = self.text
         if text is not None:
@@ -587,14 +632,22 @@
             ltext = rtext.lstrip(' \n\f')
             spaces = len(rtext) - len(ltext)
             yield '    {}\n'.format(ltext)
-            # Convert 1-based column offset to 0-based index into stripped text
-            caret = (self.offset or 0) - 1 - spaces
-            if caret >= 0:
-                # non-space whitespace (likes tabs) must be kept for alignment
-                caretspace = ((c if c.isspace() else ' ') for c in ltext[:caret])
-                yield '    {}^\n'.format(''.join(caretspace))
+
+            if self.offset is not None:
+                offset = self.offset
+                end_offset = self.end_offset if self.end_offset not in {None, 0} else offset
+                if offset == end_offset or end_offset == -1:
+                    end_offset = offset + 1
+
+                # Convert 1-based column offset to 0-based index into stripped text
+                colno = offset - 1 - spaces
+                end_colno = end_offset - 1 - spaces
+                if colno >= 0:
+                    # non-space whitespace (likes tabs) must be kept for alignment
+                    caretspace = ((c if c.isspace() else ' ') for c in ltext[:colno])
+                    yield '    {}{}'.format("".join(caretspace), ('^' * (end_colno - colno) + "\n"))
         msg = self.msg or "<no detail available>"
-        yield "{}: {}\n".format(stype, msg)
+        yield "{}: {}{}\n".format(stype, msg, filename_suffix)
 
     def format(self, *, chain=True):
         """Format the exception.
@@ -608,15 +661,32 @@
         The message indicating which exception occurred is always the last
         string in the output.
         """
-        if chain:
-            if self.__cause__ is not None:
-                yield from self.__cause__.format(chain=chain)
-                yield _cause_message
-            elif (self.__context__ is not None and
-                not self.__suppress_context__):
-                yield from self.__context__.format(chain=chain)
-                yield _context_message
-        if self.stack:
-            yield 'Traceback (most recent call last):\n'
-            yield from self.stack.format()
-        yield from self.format_exception_only()
+
+        output = []
+        exc = self
+        while exc:
+            if chain:
+                if exc.__cause__ is not None:
+                    chained_msg = _cause_message
+                    chained_exc = exc.__cause__
+                elif (exc.__context__  is not None and
+                      not exc.__suppress_context__):
+                    chained_msg = _context_message
+                    chained_exc = exc.__context__
+                else:
+                    chained_msg = None
+                    chained_exc = None
+
+                output.append((chained_msg, exc))
+                exc = chained_exc
+            else:
+                output.append((None, exc))
+                exc = None
+
+        for msg, exc in reversed(output):
+            if msg is not None:
+                yield msg
+            if exc.stack:
+                yield 'Traceback (most recent call last):\n'
+                yield from exc.stack.format()
+            yield from exc.format_exception_only()
diff --git a/Lib/tracemalloc.py b/Lib/tracemalloc.py
index 69b4170..cec99c5 100644
--- a/Lib/tracemalloc.py
+++ b/Lib/tracemalloc.py
@@ -226,7 +226,7 @@
         return str(self[0])
 
     def __repr__(self):
-        s = "<Traceback %r" % tuple(self)
+        s = f"<Traceback {tuple(self)}"
         if self._total_nframe is None:
             s += ">"
         else:
diff --git a/Lib/turtle.py b/Lib/turtle.py
index ba8288d..f3b320b 100644
--- a/Lib/turtle.py
+++ b/Lib/turtle.py
@@ -38,7 +38,7 @@
 ----- turtle.py
 
 This module is an extended reimplementation of turtle.py from the
-Python standard distribution up to Python 2.5. (See: http://www.python.org)
+Python standard distribution up to Python 2.5. (See: https://www.python.org)
 
 It tries to keep the merits of turtle.py and to be (nearly) 100%
 compatible with it. This means in the first place to enable the
@@ -264,12 +264,12 @@
     def __neg__(self):
         return Vec2D(-self[0], -self[1])
     def __abs__(self):
-        return (self[0]**2 + self[1]**2)**0.5
+        return math.hypot(*self)
     def rotate(self, angle):
         """rotate self counterclockwise by angle
         """
         perp = Vec2D(-self[1], self[0])
-        angle = angle * math.pi / 180.0
+        angle = math.radians(angle)
         c, s = math.cos(angle), math.sin(angle)
         return Vec2D(self[0]*c+perp[0]*s, self[1]*c+perp[1]*s)
     def __getnewargs__(self):
@@ -464,20 +464,18 @@
        a corresponding TurtleScreenBase class has to be implemented.
     """
 
-    @staticmethod
-    def _blankimage():
+    def _blankimage(self):
         """return a blank image object
         """
-        img = TK.PhotoImage(width=1, height=1)
+        img = TK.PhotoImage(width=1, height=1, master=self.cv)
         img.blank()
         return img
 
-    @staticmethod
-    def _image(filename):
+    def _image(self, filename):
         """return an image object containing the
         imagedata from a gif-file named filename.
         """
-        return TK.PhotoImage(file=filename)
+        return TK.PhotoImage(file=filename, master=self.cv)
 
     def __init__(self, cv):
         self.cv = cv
@@ -811,7 +809,7 @@
         >>> screen.mainloop()
 
         """
-        TK.mainloop()
+        self.cv.tk.mainloop()
 
     def textinput(self, title, prompt):
         """Pop up a dialog window for input of a string.
@@ -826,7 +824,7 @@
         >>> screen.textinput("NIM", "Name of first player:")
 
         """
-        return simpledialog.askstring(title, prompt)
+        return simpledialog.askstring(title, prompt, parent=self.cv)
 
     def numinput(self, title, prompt, default=None, minval=None, maxval=None):
         """Pop up a dialog window for input of a number.
@@ -847,7 +845,8 @@
 
         """
         return simpledialog.askfloat(title, prompt, initialvalue=default,
-                                     minvalue=minval, maxvalue=maxval)
+                                     minvalue=minval, maxvalue=maxval,
+                                     parent=self.cv)
 
 
 ##############################################################################
@@ -965,6 +964,8 @@
 
     def __init__(self, cv, mode=_CFG["mode"],
                  colormode=_CFG["colormode"], delay=_CFG["delay"]):
+        TurtleScreenBase.__init__(self, cv)
+
         self._shapes = {
                    "arrow" : Shape("polygon", ((-10,0), (10,0), (0,10))),
                   "turtle" : Shape("polygon", ((0,16), (-2,14), (-1,10), (-4,7),
@@ -988,7 +989,6 @@
 
         self._bgpics = {"nopic" : ""}
 
-        TurtleScreenBase.__init__(self, cv)
         self._mode = mode
         self._delayvalue = delay
         self._colormode = _CFG["colormode"]
@@ -1598,7 +1598,7 @@
         >>> turtle.heading()
         1.5707963267948966
         """
-        self._setDegreesPerAU(2*math.pi)
+        self._setDegreesPerAU(math.tau)
 
     def _go(self, distance):
         """move turtle forward by specified distance"""
@@ -1645,7 +1645,7 @@
         Argument:
         distance -- a number
 
-        Move the turtle backward by distance ,opposite to the direction the
+        Move the turtle backward by distance, opposite to the direction the
         turtle is headed. Do not change the turtle's heading.
 
         Example (for a Turtle instance named turtle):
@@ -1889,7 +1889,7 @@
         elif isinstance(x, TNavigator):
             pos = x._position
         x, y = pos - self._position
-        result = round(math.atan2(y, x)*180.0/math.pi, 10) % 360.0
+        result = round(math.degrees(math.atan2(y, x)), 10) % 360.0
         result /= self._degreesPerAU
         return (self._angleOffset + self._angleOrient*result) % self._fullcircle
 
@@ -1904,7 +1904,7 @@
         67.0
         """
         x, y = self._orient
-        result = round(math.atan2(y, x)*180.0/math.pi, 10) % 360.0
+        result = round(math.degrees(math.atan2(y, x)), 10) % 360.0
         result /= self._degreesPerAU
         return (self._angleOffset + self._angleOrient*result) % self._fullcircle
 
@@ -1977,7 +1977,7 @@
             steps = 1+int(min(11+abs(radius)/6.0, 59.0)*frac)
         w = 1.0 * extent / steps
         w2 = 0.5 * w
-        l = 2.0 * radius * math.sin(w2*math.pi/180.0*self._degreesPerAU)
+        l = 2.0 * radius * math.sin(math.radians(w2)*self._degreesPerAU)
         if radius < 0:
             l, w, w2 = -l, -w, -w2
         tr = self._tracer()
@@ -2862,7 +2862,7 @@
         >>> turtle.fd(50)
         """
         tilt = -angle * self._degreesPerAU * self._angleOrient
-        tilt = (tilt * math.pi / 180.0) % (2*math.pi)
+        tilt = math.radians(tilt) % math.tau
         self.pen(resizemode="user", tilt=tilt)
 
     def tiltangle(self, angle=None):
@@ -2877,7 +2877,8 @@
         between the orientation of the turtleshape and the heading of the
         turtle (its direction of movement).
 
-        Deprecated since Python 3.1
+        (Incorrectly marked as deprecated since Python 3.1, it is really
+        settiltangle that is deprecated.)
 
         Examples (for a Turtle instance named turtle):
         >>> turtle.shape("circle")
@@ -2886,7 +2887,7 @@
         >>> turtle.tiltangle()
         """
         if angle is None:
-            tilt = -self._tilt * (180.0/math.pi) * self._angleOrient
+            tilt = -math.degrees(self._tilt) * self._angleOrient
             return (tilt / self._degreesPerAU) % self._fullcircle
         else:
             self.settiltangle(angle)
@@ -2940,7 +2941,7 @@
         if t11 * t22 - t12 * t21 == 0:
             raise TurtleGraphicsError("Bad shape transform matrix: must not be singular")
         self._shapetrafo = (m11, m12, m21, m22)
-        alfa = math.atan2(-m21, m11) % (2 * math.pi)
+        alfa = math.atan2(-m21, m11) % math.tau
         sa, ca = math.sin(alfa), math.cos(alfa)
         a11, a12, a21, a22 = (ca*m11 - sa*m21, ca*m12 - sa*m22,
                               sa*m11 + ca*m21, sa*m12 + ca*m22)
diff --git a/Lib/turtledemo/__main__.py b/Lib/turtledemo/__main__.py
index 12be509..caea022 100755
--- a/Lib/turtledemo/__main__.py
+++ b/Lib/turtledemo/__main__.py
@@ -124,7 +124,6 @@
     )
 
 
-
 class DemoWindow(object):
 
     def __init__(self, filename=None):
@@ -171,15 +170,23 @@
         self.output_lbl = Label(root, height= 1, text=" --- ", bg="#ddf",
                                 font=("Arial", 16, 'normal'), borderwidth=2,
                                 relief=RIDGE)
-        self.start_btn = Button(root, text=" START ", font=btnfont,
-                                fg="white", disabledforeground = "#fed",
-                                command=self.startDemo)
-        self.stop_btn = Button(root, text=" STOP ", font=btnfont,
-                               fg="white", disabledforeground = "#fed",
-                               command=self.stopIt)
-        self.clear_btn = Button(root, text=" CLEAR ", font=btnfont,
-                                fg="white", disabledforeground="#fed",
-                                command = self.clearCanvas)
+        if darwin:  # Leave Mac button colors alone - #44254.
+            self.start_btn = Button(root, text=" START ", font=btnfont,
+                                    fg='#00cc22', command=self.startDemo)
+            self.stop_btn = Button(root, text=" STOP ", font=btnfont,
+                                   fg='#00cc22', command=self.stopIt)
+            self.clear_btn = Button(root, text=" CLEAR ", font=btnfont,
+                                    fg='#00cc22', command = self.clearCanvas)
+        else:
+            self.start_btn = Button(root, text=" START ", font=btnfont,
+                                    fg="white", disabledforeground = "#fed",
+                                    command=self.startDemo)
+            self.stop_btn = Button(root, text=" STOP ", font=btnfont,
+                                   fg="white", disabledforeground = "#fed",
+                                   command=self.stopIt)
+            self.clear_btn = Button(root, text=" CLEAR ", font=btnfont,
+                                    fg="white", disabledforeground="#fed",
+                                    command = self.clearCanvas)
         self.output_lbl.grid(row=1, column=0, sticky='news', padx=(0,5))
         self.start_btn.grid(row=1, column=1, sticky='ew')
         self.stop_btn.grid(row=1, column=2, sticky='ew')
@@ -267,12 +274,17 @@
             return self.increase_size()
 
     def configGUI(self, start, stop, clear, txt="", color="blue"):
-        self.start_btn.config(state=start,
-                              bg="#d00" if start == NORMAL else "#fca")
-        self.stop_btn.config(state=stop,
-                             bg="#d00" if stop == NORMAL else "#fca")
-        self.clear_btn.config(state=clear,
-                              bg="#d00" if clear == NORMAL else "#fca")
+        if darwin:  # Leave Mac button colors alone - #44254.
+            self.start_btn.config(state=start)
+            self.stop_btn.config(state=stop)
+            self.clear_btn.config(state=clear)
+        else:
+            self.start_btn.config(state=start,
+                                  bg="#d00" if start == NORMAL else "#fca")
+            self.stop_btn.config(state=stop,
+                                 bg="#d00" if stop == NORMAL else "#fca")
+            self.clear_btn.config(state=clear,
+                                  bg="#d00" if clear == NORMAL else "#fca")
         self.output_lbl.config(text=txt, fg=color)
 
     def makeLoadDemoMenu(self, master):
diff --git a/Lib/turtledemo/two_canvases.py b/Lib/turtledemo/two_canvases.py
index d579876..f360258 100644
--- a/Lib/turtledemo/two_canvases.py
+++ b/Lib/turtledemo/two_canvases.py
@@ -1,7 +1,7 @@
 """turtledemo.two_canvases
 
 Use TurtleScreen and RawTurtle to draw on two
-distinct canvases in a separate windows. The
+distinct canvases in a separate window. The
 new window must be separately closed in
 addition to pressing the STOP button.
 """
diff --git a/Lib/types.py b/Lib/types.py
index ad2020e..62122a9 100644
--- a/Lib/types.py
+++ b/Lib/types.py
@@ -82,7 +82,7 @@
     updated = False
     shift = 0
     for i, base in enumerate(bases):
-        if isinstance(base, type):
+        if isinstance(base, type) and not isinstance(base, GenericAlias):
             continue
         if not hasattr(base, "__mro_entries__"):
             continue
@@ -155,7 +155,12 @@
     class's __getattr__ method; this is done by raising AttributeError.
 
     This allows one to have properties active on an instance, and have virtual
-    attributes on the class with the same name (see Enum for an example).
+    attributes on the class with the same name.  (Enum used this between Python
+    versions 3.4 - 3.9 .)
+
+    Subclass from this to use a different method of accessing virtual atributes
+    and still be treated properly by the inspect module. (Enum uses this since
+    Python 3.10 .)
 
     """
     def __init__(self, fget=None, fset=None, fdel=None, doc=None):
@@ -292,8 +297,11 @@
 
     return wrapped
 
-
 GenericAlias = type(list[int])
+UnionType = type(int | str)
 
+EllipsisType = type(Ellipsis)
+NoneType = type(None)
+NotImplementedType = type(NotImplemented)
 
 __all__ = [n for n in globals() if n[:1] != '_']
diff --git a/Lib/typing.py b/Lib/typing.py
index f5316ab..086d0f3 100644
--- a/Lib/typing.py
+++ b/Lib/typing.py
@@ -4,8 +4,10 @@
 At large scale, the structure of the module is following:
 * Imports and exports, all public names should be explicitly added to __all__.
 * Internal helper functions: these should never be used in code outside this module.
-* _SpecialForm and its instances (special forms): Any, NoReturn, ClassVar, Union, Optional
-* Two classes whose instances can be type arguments in addition to types: ForwardRef and TypeVar
+* _SpecialForm and its instances (special forms):
+  Any, NoReturn, ClassVar, Union, Optional, Concatenate
+* Classes whose instances can be type arguments in addition to types:
+  ForwardRef, TypeVar and ParamSpec
 * The core of internal generics API: _GenericAlias and _VariadicGenericAlias, the latter is
   currently only used by Tuple and Callable. All subscripted types like X[int], Union[int, str],
   etc., are instances of either of these classes.
@@ -35,11 +37,13 @@
     'Any',
     'Callable',
     'ClassVar',
+    'Concatenate',
     'Final',
     'ForwardRef',
     'Generic',
     'Literal',
     'Optional',
+    'ParamSpec',
     'Protocol',
     'Tuple',
     'Type',
@@ -96,6 +100,13 @@
     'TypedDict',  # Not really a type.
     'Generator',
 
+    # Other concrete types.
+    'BinaryIO',
+    'IO',
+    'Match',
+    'Pattern',
+    'TextIO',
+
     # One-off things.
     'AnyStr',
     'cast',
@@ -103,14 +114,19 @@
     'get_args',
     'get_origin',
     'get_type_hints',
+    'is_typeddict',
     'NewType',
     'no_type_check',
     'no_type_check_decorator',
     'NoReturn',
     'overload',
+    'ParamSpecArgs',
+    'ParamSpecKwargs',
     'runtime_checkable',
     'Text',
     'TYPE_CHECKING',
+    'TypeAlias',
+    'TypeGuard',
 ]
 
 # The pseudo-submodules 're' and 'io' are part of the public
@@ -118,7 +134,16 @@
 # legitimate imports of those modules.
 
 
-def _type_check(arg, msg, is_argument=True):
+def _type_convert(arg, module=None, *, allow_special_forms=False):
+    """For converting None to type(None), and strings to ForwardRef."""
+    if arg is None:
+        return type(None)
+    if isinstance(arg, str):
+        return ForwardRef(arg, module=module, is_class=allow_special_forms)
+    return arg
+
+
+def _type_check(arg, msg, is_argument=True, module=None, *, allow_special_forms=False):
     """Check that the argument is a type, and return it (internal helper).
 
     As a special case, accept None and return type(None) instead. Also wrap strings
@@ -131,27 +156,32 @@
     We append the repr() of the actual value (truncated to 100 chars).
     """
     invalid_generic_forms = (Generic, Protocol)
-    if is_argument:
-        invalid_generic_forms = invalid_generic_forms + (ClassVar, Final)
+    if not allow_special_forms:
+        invalid_generic_forms += (ClassVar,)
+        if is_argument:
+            invalid_generic_forms += (Final,)
 
-    if arg is None:
-        return type(None)
-    if isinstance(arg, str):
-        return ForwardRef(arg)
+    arg = _type_convert(arg, module=module, allow_special_forms=allow_special_forms)
     if (isinstance(arg, _GenericAlias) and
             arg.__origin__ in invalid_generic_forms):
         raise TypeError(f"{arg} is not valid as type argument")
-    if arg in (Any, NoReturn):
+    if arg in (Any, NoReturn, Final, TypeAlias):
         return arg
     if isinstance(arg, _SpecialForm) or arg in (Generic, Protocol):
         raise TypeError(f"Plain {arg} is not valid as type argument")
-    if isinstance(arg, (type, TypeVar, ForwardRef)):
+    if isinstance(arg, (type, TypeVar, ForwardRef, types.UnionType, ParamSpec,
+                        ParamSpecArgs, ParamSpecKwargs)):
         return arg
     if not callable(arg):
         raise TypeError(f"{msg} Got {arg!r:.100}.")
     return arg
 
 
+def _is_param_expr(arg):
+    return arg is ... or isinstance(arg,
+            (tuple, list, ParamSpec, _ConcatenateGenericAlias))
+
+
 def _type_repr(obj):
     """Return the repr() of an object, special-casing types (internal helper).
 
@@ -173,17 +203,19 @@
     return repr(obj)
 
 
-def _collect_type_vars(types):
-    """Collect all type variable contained in types in order of
-    first appearance (lexicographic order). For example::
+def _collect_type_vars(types_, typevar_types=None):
+    """Collect all type variable contained
+    in types in order of first appearance (lexicographic order). For example::
 
         _collect_type_vars((T, List[S, T])) == (T, S)
     """
+    if typevar_types is None:
+        typevar_types = TypeVar
     tvars = []
-    for t in types:
-        if isinstance(t, TypeVar) and t not in tvars:
+    for t in types_:
+        if isinstance(t, typevar_types) and t not in tvars:
             tvars.append(t)
-        if isinstance(t, (_GenericAlias, GenericAlias)):
+        if isinstance(t, (_GenericAlias, GenericAlias, types.UnionType)):
             tvars.extend([t for t in t.__parameters__ if t not in tvars])
     return tuple(tvars)
 
@@ -196,9 +228,27 @@
         raise TypeError(f"{cls} is not a generic class")
     alen = len(parameters)
     if alen != elen:
-        raise TypeError(f"Too {'many' if alen > elen else 'few'} parameters for {cls};"
+        raise TypeError(f"Too {'many' if alen > elen else 'few'} arguments for {cls};"
                         f" actual {alen}, expected {elen}")
 
+def _prepare_paramspec_params(cls, params):
+    """Prepares the parameters for a Generic containing ParamSpec
+    variables (internal helper).
+    """
+    # Special case where Z[[int, str, bool]] == Z[int, str, bool] in PEP 612.
+    if (len(cls.__parameters__) == 1
+            and params and not _is_param_expr(params[0])):
+        assert isinstance(cls.__parameters__[0], ParamSpec)
+        return (params,)
+    else:
+        _check_generic(cls, params, len(cls.__parameters__))
+        _params = []
+        # Convert lists to tuples to help other libraries cache the results.
+        for p, tvar in zip(params, cls.__parameters__):
+            if isinstance(tvar, ParamSpec) and isinstance(p, list):
+                p = tuple(p)
+            _params.append(p)
+        return tuple(_params)
 
 def _deduplicate(params):
     # Weed out strict duplicates, preserving the first of each occurrence.
@@ -221,7 +271,7 @@
     # Flatten out Union[Union[...], ...].
     params = []
     for p in parameters:
-        if isinstance(p, _UnionGenericAlias):
+        if isinstance(p, (_UnionGenericAlias, types.UnionType)):
             params.extend(p.__args__)
         elif isinstance(p, tuple) and len(p) > 0 and p[0] is Union:
             params.extend(p[1:])
@@ -270,17 +320,19 @@
 def _eval_type(t, globalns, localns, recursive_guard=frozenset()):
     """Evaluate all forward references in the given type t.
     For use of globalns and localns see the docstring for get_type_hints().
-    recursive_guard is used to prevent prevent infinite recursion
-    with recursive ForwardRef.
+    recursive_guard is used to prevent infinite recursion with a recursive
+    ForwardRef.
     """
     if isinstance(t, ForwardRef):
         return t._evaluate(globalns, localns, recursive_guard)
-    if isinstance(t, (_GenericAlias, GenericAlias)):
+    if isinstance(t, (_GenericAlias, GenericAlias, types.UnionType)):
         ev_args = tuple(_eval_type(a, globalns, localns, recursive_guard) for a in t.__args__)
         if ev_args == t.__args__:
             return t
         if isinstance(t, GenericAlias):
             return GenericAlias(t.__origin__, ev_args)
+        if isinstance(t, types.UnionType):
+            return functools.reduce(operator.or_, ev_args)
         else:
             return t.copy_with(ev_args)
     return t
@@ -316,6 +368,12 @@
         self._name = getitem.__name__
         self.__doc__ = getitem.__doc__
 
+    def __getattr__(self, item):
+        if item in {'__name__', '__qualname__'}:
+            return self._name
+
+        raise AttributeError(item)
+
     def __mro_entries__(self, bases):
         raise TypeError(f"Cannot subclass {self!r}")
 
@@ -328,6 +386,12 @@
     def __call__(self, *args, **kwds):
         raise TypeError(f"Cannot instantiate {self!r}")
 
+    def __or__(self, other):
+        return Union[self, other]
+
+    def __ror__(self, other):
+        return Union[other, self]
+
     def __instancecheck__(self, obj):
         raise TypeError(f"{self} cannot be used with isinstance()")
 
@@ -340,9 +404,10 @@
 
 
 class _LiteralSpecialForm(_SpecialForm, _root=True):
-    @_tp_cache(typed=True)
     def __getitem__(self, parameters):
-        return self._getitem(self, parameters)
+        if not isinstance(parameters, tuple):
+            parameters = (parameters,)
+        return self._getitem(self, *parameters)
 
 
 @_SpecialForm
@@ -451,6 +516,8 @@
     parameters = _remove_dups_flatten(parameters)
     if len(parameters) == 1:
         return parameters[0]
+    if len(parameters) == 2 and type(None) in parameters:
+        return _UnionGenericAlias(self, parameters, name="Optional")
     return _UnionGenericAlias(self, parameters)
 
 @_SpecialForm
@@ -463,7 +530,8 @@
     return Union[arg, type(None)]
 
 @_LiteralSpecialForm
-def Literal(self, parameters):
+@_tp_cache(typed=True)
+def Literal(self, *parameters):
     """Special typing form to define literal types (a.k.a. value types).
 
     This form can be used to indicate to type checkers that the corresponding
@@ -486,9 +554,6 @@
     """
     # There is no '_type_check' call because arguments to Literal[...] are
     # values, not types.
-    if not isinstance(parameters, tuple):
-        parameters = (parameters,)
-
     parameters = _flatten_literal_params(parameters)
 
     try:
@@ -499,14 +564,104 @@
     return _LiteralGenericAlias(self, parameters)
 
 
+@_SpecialForm
+def TypeAlias(self, parameters):
+    """Special marker indicating that an assignment should
+    be recognized as a proper type alias definition by type
+    checkers.
+
+    For example::
+
+        Predicate: TypeAlias = Callable[..., bool]
+
+    It's invalid when used anywhere except as in the example above.
+    """
+    raise TypeError(f"{self} is not subscriptable")
+
+
+@_SpecialForm
+def Concatenate(self, parameters):
+    """Used in conjunction with ``ParamSpec`` and ``Callable`` to represent a
+    higher order function which adds, removes or transforms parameters of a
+    callable.
+
+    For example::
+
+       Callable[Concatenate[int, P], int]
+
+    See PEP 612 for detailed information.
+    """
+    if parameters == ():
+        raise TypeError("Cannot take a Concatenate of no types.")
+    if not isinstance(parameters, tuple):
+        parameters = (parameters,)
+    if not isinstance(parameters[-1], ParamSpec):
+        raise TypeError("The last parameter to Concatenate should be a "
+                        "ParamSpec variable.")
+    msg = "Concatenate[arg, ...]: each arg must be a type."
+    parameters = (*(_type_check(p, msg) for p in parameters[:-1]), parameters[-1])
+    return _ConcatenateGenericAlias(self, parameters,
+                                    _typevar_types=(TypeVar, ParamSpec),
+                                    _paramspec_tvars=True)
+
+
+@_SpecialForm
+def TypeGuard(self, parameters):
+    """Special typing form used to annotate the return type of a user-defined
+    type guard function.  ``TypeGuard`` only accepts a single type argument.
+    At runtime, functions marked this way should return a boolean.
+
+    ``TypeGuard`` aims to benefit *type narrowing* -- a technique used by static
+    type checkers to determine a more precise type of an expression within a
+    program's code flow.  Usually type narrowing is done by analyzing
+    conditional code flow and applying the narrowing to a block of code.  The
+    conditional expression here is sometimes referred to as a "type guard".
+
+    Sometimes it would be convenient to use a user-defined boolean function
+    as a type guard.  Such a function should use ``TypeGuard[...]`` as its
+    return type to alert static type checkers to this intention.
+
+    Using  ``-> TypeGuard`` tells the static type checker that for a given
+    function:
+
+    1. The return value is a boolean.
+    2. If the return value is ``True``, the type of its argument
+       is the type inside ``TypeGuard``.
+
+       For example::
+
+          def is_str(val: Union[str, float]):
+              # "isinstance" type guard
+              if isinstance(val, str):
+                  # Type of ``val`` is narrowed to ``str``
+                  ...
+              else:
+                  # Else, type of ``val`` is narrowed to ``float``.
+                  ...
+
+    Strict type narrowing is not enforced -- ``TypeB`` need not be a narrower
+    form of ``TypeA`` (it can even be a wider form) and this may lead to
+    type-unsafe results.  The main reason is to allow for things like
+    narrowing ``List[object]`` to ``List[str]`` even though the latter is not
+    a subtype of the former, since ``List`` is invariant.  The responsibility of
+    writing type-safe type guards is left to the user.
+
+    ``TypeGuard`` also works with type variables.  For more information, see
+    PEP 647 (User-Defined Type Guards).
+    """
+    item = _type_check(parameters, f'{self} accepts only single type.')
+    return _GenericAlias(self, (item,))
+
+
 class ForwardRef(_Final, _root=True):
     """Internal wrapper to hold a forward reference."""
 
     __slots__ = ('__forward_arg__', '__forward_code__',
                  '__forward_evaluated__', '__forward_value__',
-                 '__forward_is_argument__')
+                 '__forward_is_argument__', '__forward_is_class__',
+                 '__forward_module__')
 
-    def __init__(self, arg, is_argument=True):
+    def __init__(self, arg, is_argument=True, module=None, *, is_class=False):
         if not isinstance(arg, str):
             raise TypeError(f"Forward reference must be a string -- got {arg!r}")
         try:
@@ -518,6 +673,8 @@
         self.__forward_evaluated__ = False
         self.__forward_value__ = None
         self.__forward_is_argument__ = is_argument
+        self.__forward_is_class__ = is_class
+        self.__forward_module__ = module
 
     def _evaluate(self, globalns, localns, recursive_guard):
         if self.__forward_arg__ in recursive_guard:
@@ -529,10 +686,15 @@
                 globalns = localns
             elif localns is None:
                 localns = globalns
-            type_ =_type_check(
+            if self.__forward_module__ is not None:
+                globalns = getattr(
+                    sys.modules.get(self.__forward_module__, None), '__dict__', globalns
+                )
+            type_ = _type_check(
                 eval(self.__forward_code__, globalns, localns),
                 "Forward references must evaluate to types.",
                 is_argument=self.__forward_is_argument__,
+                allow_special_forms=self.__forward_is_class__,
             )
             self.__forward_value__ = _eval_type(
                 type_, globalns, localns, recursive_guard | {self.__forward_arg__}
@@ -546,16 +708,50 @@
         if self.__forward_evaluated__ and other.__forward_evaluated__:
             return (self.__forward_arg__ == other.__forward_arg__ and
                     self.__forward_value__ == other.__forward_value__)
-        return self.__forward_arg__ == other.__forward_arg__
+        return (self.__forward_arg__ == other.__forward_arg__ and
+                self.__forward_module__ == other.__forward_module__)
 
     def __hash__(self):
-        return hash(self.__forward_arg__)
+        return hash((self.__forward_arg__, self.__forward_module__))
 
     def __repr__(self):
         return f'ForwardRef({self.__forward_arg__!r})'
 
+class _TypeVarLike:
+    """Mixin for TypeVar-like types (TypeVar and ParamSpec)."""
+    def __init__(self, bound, covariant, contravariant):
+        """Used to setup TypeVars and ParamSpec's bound, covariant and
+        contravariant attributes.
+        """
+        if covariant and contravariant:
+            raise ValueError("Bivariant types are not supported.")
+        self.__covariant__ = bool(covariant)
+        self.__contravariant__ = bool(contravariant)
+        if bound:
+            self.__bound__ = _type_check(bound, "Bound must be a type.")
+        else:
+            self.__bound__ = None
 
-class TypeVar(_Final, _Immutable, _root=True):
+    def __or__(self, right):
+        return Union[self, right]
+
+    def __ror__(self, left):
+        return Union[left, self]
+
+    def __repr__(self):
+        if self.__covariant__:
+            prefix = '+'
+        elif self.__contravariant__:
+            prefix = '-'
+        else:
+            prefix = '~'
+        return prefix + self.__name__
+
+    def __reduce__(self):
+        return self.__name__
+
+
+class TypeVar( _Final, _Immutable, _TypeVarLike, _root=True):
     """Type variable.
 
     Usage::
@@ -605,20 +801,13 @@
     def __init__(self, name, *constraints, bound=None,
                  covariant=False, contravariant=False):
         self.__name__ = name
-        if covariant and contravariant:
-            raise ValueError("Bivariant types are not supported.")
-        self.__covariant__ = bool(covariant)
-        self.__contravariant__ = bool(contravariant)
+        super().__init__(bound, covariant, contravariant)
         if constraints and bound is not None:
             raise TypeError("Constraints cannot be combined with bound=...")
         if constraints and len(constraints) == 1:
             raise TypeError("A single constraint is not allowed")
         msg = "TypeVar(name, constraint, ...): constraints must be types."
         self.__constraints__ = tuple(_type_check(t, msg) for t in constraints)
-        if bound:
-            self.__bound__ = _type_check(bound, "Bound must be a type.")
-        else:
-            self.__bound__ = None
         try:
             def_mod = sys._getframe(1).f_globals.get('__name__', '__main__')  # for pickling
         except (AttributeError, ValueError):
@@ -626,17 +815,121 @@
         if def_mod != 'typing':
             self.__module__ = def_mod
 
-    def __repr__(self):
-        if self.__covariant__:
-            prefix = '+'
-        elif self.__contravariant__:
-            prefix = '-'
-        else:
-            prefix = '~'
-        return prefix + self.__name__
 
-    def __reduce__(self):
-        return self.__name__
+class ParamSpecArgs(_Final, _Immutable, _root=True):
+    """The args for a ParamSpec object.
+
+    Given a ParamSpec object P, P.args is an instance of ParamSpecArgs.
+
+    ParamSpecArgs objects have a reference back to their ParamSpec:
+
+       P.args.__origin__ is P
+
+    This type is meant for runtime introspection and has no special meaning to
+    static type checkers.
+    """
+    def __init__(self, origin):
+        self.__origin__ = origin
+
+    def __repr__(self):
+        return f"{self.__origin__.__name__}.args"
+
+    def __eq__(self, other):
+        if not isinstance(other, ParamSpecArgs):
+            return NotImplemented
+        return self.__origin__ == other.__origin__
+
+
+class ParamSpecKwargs(_Final, _Immutable, _root=True):
+    """The kwargs for a ParamSpec object.
+
+    Given a ParamSpec object P, P.kwargs is an instance of ParamSpecKwargs.
+
+    ParamSpecKwargs objects have a reference back to their ParamSpec:
+
+       P.kwargs.__origin__ is P
+
+    This type is meant for runtime introspection and has no special meaning to
+    static type checkers.
+    """
+    def __init__(self, origin):
+        self.__origin__ = origin
+
+    def __repr__(self):
+        return f"{self.__origin__.__name__}.kwargs"
+
+    def __eq__(self, other):
+        if not isinstance(other, ParamSpecKwargs):
+            return NotImplemented
+        return self.__origin__ == other.__origin__
+
+
+class ParamSpec(_Final, _Immutable, _TypeVarLike, _root=True):
+    """Parameter specification variable.
+
+    Usage::
+
+       P = ParamSpec('P')
+
+    Parameter specification variables exist primarily for the benefit of static
+    type checkers.  They are used to forward the parameter types of one
+    callable to another callable, a pattern commonly found in higher order
+    functions and decorators.  They are only valid when used in ``Concatenate``,
+    or as the first argument to ``Callable``, or as parameters for user-defined
+    Generics.  See class Generic for more information on generic types.  An
+    example for annotating a decorator::
+
+       T = TypeVar('T')
+       P = ParamSpec('P')
+
+       def add_logging(f: Callable[P, T]) -> Callable[P, T]:
+           '''A type-safe decorator to add logging to a function.'''
+           def inner(*args: P.args, **kwargs: P.kwargs) -> T:
+               logging.info(f'{f.__name__} was called')
+               return f(*args, **kwargs)
+           return inner
+
+       @add_logging
+       def add_two(x: float, y: float) -> float:
+           '''Add two numbers together.'''
+           return x + y
+
+    Parameter specification variables defined with covariant=True or
+    contravariant=True can be used to declare covariant or contravariant
+    generic types.  These keyword arguments are valid, but their actual semantics
+    are yet to be decided.  See PEP 612 for details.
+
+    Parameter specification variables can be introspected. e.g.:
+
+       P.__name__ == 'T'
+       P.__bound__ == None
+       P.__covariant__ == False
+       P.__contravariant__ == False
+
+    Note that only parameter specification variables defined in global scope can
+    be pickled.
+    """
+
+    __slots__ = ('__name__', '__bound__', '__covariant__', '__contravariant__',
+                 '__dict__')
+
+    @property
+    def args(self):
+        return ParamSpecArgs(self)
+
+    @property
+    def kwargs(self):
+        return ParamSpecKwargs(self)
+
+    def __init__(self, name, *, bound=None, covariant=False, contravariant=False):
+        self.__name__ = name
+        super().__init__(bound, covariant, contravariant)
+        try:
+            def_mod = sys._getframe(1).f_globals.get('__name__', '__main__')
+        except (AttributeError, ValueError):
+            def_mod = None
+        if def_mod != 'typing':
+            self.__module__ = def_mod
 
 
 def _is_dunder(attr):
@@ -681,14 +974,18 @@
         return tuple(res)
 
     def __getattr__(self, attr):
+        if attr in {'__name__', '__qualname__'}:
+            return self._name or self.__origin__.__name__
+
         # We are careful for copy and pickle.
-        # Also for simplicity we just don't relay all dunder names
+        # Also for simplicity we don't relay any dunder names
         if '__origin__' in self.__dict__ and not _is_dunder(attr):
             return getattr(self.__origin__, attr)
         raise AttributeError(attr)
 
     def __setattr__(self, attr, val):
-        if _is_dunder(attr) or attr in ('_name', '_inst', '_nparams'):
+        if _is_dunder(attr) or attr in {'_name', '_inst', '_nparams',
+                                        '_typevar_types', '_paramspec_tvars'}:
             super().__setattr__(attr, val)
         else:
             setattr(self.__origin__, attr, val)
@@ -700,6 +997,9 @@
         raise TypeError("Subscripted generics cannot be used with"
                         " class and instance checks")
 
+    def __dir__(self):
+        return list(set(super().__dir__()
+                + [attr for attr in dir(self.__origin__) if not _is_dunder(attr)]))
 
 # Special typing constructs Union, Optional, Generic, Callable and Tuple
 # use three special attributes for internal bookkeeping of generic types:
@@ -713,14 +1013,18 @@
 
 
 class _GenericAlias(_BaseGenericAlias, _root=True):
-    def __init__(self, origin, params, *, inst=True, name=None):
+    def __init__(self, origin, params, *, inst=True, name=None,
+                 _typevar_types=TypeVar,
+                 _paramspec_tvars=False):
         super().__init__(origin, inst=inst, name=name)
         if not isinstance(params, tuple):
             params = (params,)
         self.__args__ = tuple(... if a is _TypingEllipsis else
                               () if a is _TypingEmpty else
                               a for a in params)
-        self.__parameters__ = _collect_type_vars(params)
+        self.__parameters__ = _collect_type_vars(params, typevar_types=_typevar_types)
+        self._typevar_types = _typevar_types
+        self._paramspec_tvars = _paramspec_tvars
         if not name:
             self.__module__ = origin.__module__
 
@@ -733,6 +1037,12 @@
     def __hash__(self):
         return hash((self.__origin__, self.__args__))
 
+    def __or__(self, right):
+        return Union[self, right]
+
+    def __ror__(self, left):
+        return Union[left, self]
+
     @_tp_cache
     def __getitem__(self, params):
         if self.__origin__ in (Generic, Protocol):
@@ -740,25 +1050,40 @@
             raise TypeError(f"Cannot subscript already-subscripted {self}")
         if not isinstance(params, tuple):
             params = (params,)
-        msg = "Parameters to generic types must be types."
-        params = tuple(_type_check(p, msg) for p in params)
-        _check_generic(self, params, len(self.__parameters__))
+        params = tuple(_type_convert(p) for p in params)
+        if (self._paramspec_tvars
+                and any(isinstance(t, ParamSpec) for t in self.__parameters__)):
+            params = _prepare_paramspec_params(self, params)
+        else:
+            _check_generic(self, params, len(self.__parameters__))
 
         subst = dict(zip(self.__parameters__, params))
         new_args = []
         for arg in self.__args__:
-            if isinstance(arg, TypeVar):
-                arg = subst[arg]
-            elif isinstance(arg, (_GenericAlias, GenericAlias)):
+            if isinstance(arg, self._typevar_types):
+                if isinstance(arg, ParamSpec):
+                    arg = subst[arg]
+                    if not _is_param_expr(arg):
+                        raise TypeError(f"Expected a list of types, an ellipsis, "
+                                        f"ParamSpec, or Concatenate. Got {arg}")
+                else:
+                    arg = subst[arg]
+            elif isinstance(arg, (_GenericAlias, GenericAlias, types.UnionType)):
                 subparams = arg.__parameters__
                 if subparams:
                     subargs = tuple(subst[x] for x in subparams)
                     arg = arg[subargs]
-            new_args.append(arg)
+            # Required to flatten out the args for CallableGenericAlias
+            if self.__origin__ == collections.abc.Callable and isinstance(arg, tuple):
+                new_args.extend(arg)
+            else:
+                new_args.append(arg)
         return self.copy_with(tuple(new_args))
 
     def copy_with(self, params):
-        return self.__class__(self.__origin__, params, name=self._name, inst=self._inst)
+        return self.__class__(self.__origin__, params, name=self._name, inst=self._inst,
+                              _typevar_types=self._typevar_types,
+                              _paramspec_tvars=self._paramspec_tvars)
 
     def __repr__(self):
         if self._name:
@@ -779,6 +1104,9 @@
         return operator.getitem, (origin, args)
 
     def __mro_entries__(self, bases):
+        if isinstance(self.__origin__, _SpecialForm):
+            raise TypeError(f"Cannot subclass {self!r}")
+
         if self._name:  # generic version of an ABC or built-in class
             return super().__mro_entries__(bases)
         if self.__origin__ is Generic:
@@ -832,19 +1160,25 @@
     def __reduce__(self):
         return self._name
 
+    def __or__(self, right):
+        return Union[self, right]
+
+    def __ror__(self, left):
+        return Union[left, self]
 
 class _CallableGenericAlias(_GenericAlias, _root=True):
     def __repr__(self):
         assert self._name == 'Callable'
-        if len(self.__args__) == 2 and self.__args__[0] is Ellipsis:
+        args = self.__args__
+        if len(args) == 2 and _is_param_expr(args[0]):
             return super().__repr__()
         return (f'typing.Callable'
-                f'[[{", ".join([_type_repr(a) for a in self.__args__[:-1]])}], '
-                f'{_type_repr(self.__args__[-1])}]')
+                f'[[{", ".join([_type_repr(a) for a in args[:-1]])}], '
+                f'{_type_repr(args[-1])}]')
 
     def __reduce__(self):
         args = self.__args__
-        if not (len(args) == 2 and args[0] is ...):
+        if not (len(args) == 2 and _is_param_expr(args[0])):
             args = list(args[:-1]), args[-1]
         return operator.getitem, (Callable, args)
 
@@ -852,20 +1186,22 @@
 class _CallableType(_SpecialGenericAlias, _root=True):
     def copy_with(self, params):
         return _CallableGenericAlias(self.__origin__, params,
-                                     name=self._name, inst=self._inst)
+                                     name=self._name, inst=self._inst,
+                                     _typevar_types=(TypeVar, ParamSpec),
+                                     _paramspec_tvars=True)
 
     def __getitem__(self, params):
         if not isinstance(params, tuple) or len(params) != 2:
             raise TypeError("Callable must be used as "
                             "Callable[[arg, ...], result].")
         args, result = params
-        if args is Ellipsis:
-            params = (Ellipsis, result)
-        else:
-            if not isinstance(args, list):
-                raise TypeError(f"Callable[args, result]: args must be a list."
-                                f" Got {args}")
+        # This relaxes what args can be on purpose to allow things like
+        # PEP 612 ParamSpec.  Responsibility for whether a user is using
+        # Callable[...] properly is deferred to static type checkers.
+        if isinstance(args, list):
             params = (tuple(args), result)
+        else:
+            params = (args, result)
         return self.__getitem_inner__(params)
 
     @_tp_cache
@@ -875,8 +1211,9 @@
         result = _type_check(result, msg)
         if args is Ellipsis:
             return self.copy_with((_TypingEllipsis, result))
-        msg = "Callable[[arg, ...], result]: each arg must be a type."
-        args = tuple(_type_check(arg, msg) for arg in args)
+        if not isinstance(args, tuple):
+            args = (args,)
+        args = tuple(_type_convert(arg) for arg in args)
         params = args + (result,)
         return self.copy_with(params)
 
@@ -902,7 +1239,7 @@
         return Union[params]
 
     def __eq__(self, other):
-        if not isinstance(other, _UnionGenericAlias):
+        if not isinstance(other, (_UnionGenericAlias, types.UnionType)):
             return NotImplemented
         return set(self.__args__) == set(other.__args__)
 
@@ -918,6 +1255,18 @@
                 return f'typing.Optional[{_type_repr(args[0])}]'
         return super().__repr__()
 
+    def __instancecheck__(self, obj):
+        return self.__subclasscheck__(type(obj))
+
+    def __subclasscheck__(self, cls):
+        for arg in self.__args__:
+            if issubclass(cls, arg):
+                return True
+
+    def __reduce__(self):
+        func, (origin, args) = super().__reduce__()
+        return func, (Union, args)
+
 
 def _value_and_type_iter(parameters):
     return ((p, type(p)) for p in parameters)
@@ -935,6 +1284,18 @@
         return hash(frozenset(_value_and_type_iter(self.__args__)))
 
 
+class _ConcatenateGenericAlias(_GenericAlias, _root=True):
+    def copy_with(self, params):
+        if isinstance(params[-1], (list, tuple)):
+            return (*params[:-1], *params[-1])
+        if isinstance(params[-1], _ConcatenateGenericAlias):
+            params = (*params[:-1], *params[-1].__args__)
+        elif not isinstance(params[-1], ParamSpec):
+            raise TypeError("The last parameter to Concatenate should be a "
+                            "ParamSpec variable.")
+        return super().copy_with(params)
+
+
 class Generic:
     """Abstract base class for generic types.
 
@@ -965,20 +1326,25 @@
         if not params and cls is not Tuple:
             raise TypeError(
                 f"Parameter list to {cls.__qualname__}[...] cannot be empty")
-        msg = "Parameters to generic types must be types."
-        params = tuple(_type_check(p, msg) for p in params)
+        params = tuple(_type_convert(p) for p in params)
         if cls in (Generic, Protocol):
             # Generic and Protocol can only be subscripted with unique type variables.
-            if not all(isinstance(p, TypeVar) for p in params):
+            if not all(isinstance(p, (TypeVar, ParamSpec)) for p in params):
                 raise TypeError(
-                    f"Parameters to {cls.__name__}[...] must all be type variables")
+                    f"Parameters to {cls.__name__}[...] must all be type variables "
+                    f"or parameter specification variables.")
             if len(set(params)) != len(params):
                 raise TypeError(
                     f"Parameters to {cls.__name__}[...] must all be unique")
         else:
             # Subscripting a regular Generic subclass.
-            _check_generic(cls, params, len(cls.__parameters__))
-        return _GenericAlias(cls, params)
+            if any(isinstance(t, ParamSpec) for t in cls.__parameters__):
+                params = _prepare_paramspec_params(cls, params)
+            else:
+                _check_generic(cls, params, len(cls.__parameters__))
+        return _GenericAlias(cls, params,
+                             _typevar_types=(TypeVar, ParamSpec),
+                             _paramspec_tvars=True)
 
     def __init_subclass__(cls, *args, **kwargs):
         super().__init_subclass__(*args, **kwargs)
@@ -990,7 +1356,7 @@
         if error:
             raise TypeError("Cannot inherit from plain Generic")
         if '__orig_bases__' in cls.__dict__:
-            tvars = _collect_type_vars(cls.__orig_bases__)
+            tvars = _collect_type_vars(cls.__orig_bases__, (TypeVar, ParamSpec))
             # Look for Generic[T1, ..., Tn].
             # If found, tvars must be a subset of it.
             # If not found, tvars is it.
@@ -1060,24 +1426,55 @@
     return all(callable(getattr(cls, attr, None)) for attr in _get_protocol_attrs(cls))
 
 
-def _no_init(self, *args, **kwargs):
-    if type(self)._is_protocol:
+def _no_init_or_replace_init(self, *args, **kwargs):
+    cls = type(self)
+
+    if cls._is_protocol:
         raise TypeError('Protocols cannot be instantiated')
 
+    # Already using a custom `__init__`. No need to calculate correct
+    # `__init__` to call. This can lead to RecursionError. See bpo-45121.
+    if cls.__init__ is not _no_init_or_replace_init:
+        return
 
-def _allow_reckless_class_cheks():
+    # Initially, `__init__` of a protocol subclass is set to `_no_init_or_replace_init`.
+    # The first instantiation of the subclass will call `_no_init_or_replace_init` which
+    # searches for a proper new `__init__` in the MRO. The new `__init__`
+    # replaces the subclass' old `__init__` (ie `_no_init_or_replace_init`). Subsequent
+    # instantiation of the protocol subclass will thus use the new
+    # `__init__` and no longer call `_no_init_or_replace_init`.
+    for base in cls.__mro__:
+        init = base.__dict__.get('__init__', _no_init_or_replace_init)
+        if init is not _no_init_or_replace_init:
+            cls.__init__ = init
+            break
+    else:
+        # should not happen
+        cls.__init__ = object.__init__
+
+    cls.__init__(self, *args, **kwargs)
+
+
+def _caller(depth=1, default='__main__'):
+    try:
+        return sys._getframe(depth + 1).f_globals.get('__name__', default)
+    except (AttributeError, ValueError):  # For platforms without _getframe()
+        return None
+
+
+def _allow_reckless_class_checks(depth=3):
     """Allow instance and class checks for special stdlib modules.
 
     The abc and functools modules indiscriminately call isinstance() and
     issubclass() on the whole MRO of a user class, which may contain protocols.
     """
     try:
-        return sys._getframe(3).f_globals['__name__'] in ['abc', 'functools']
+        return sys._getframe(depth).f_globals['__name__'] in ['abc', 'functools']
     except (AttributeError, ValueError):  # For platforms without _getframe().
         return True
 
 
-_PROTO_WHITELIST = {
+_PROTO_ALLOWLIST = {
     'collections.abc': [
         'Callable', 'Awaitable', 'Iterable', 'Iterator', 'AsyncIterable',
         'Hashable', 'Sized', 'Container', 'Collection', 'Reversible',
@@ -1092,6 +1489,14 @@
     def __instancecheck__(cls, instance):
         # We need this method for situations where attributes are
         # assigned in __init__.
+        if (
+            getattr(cls, '_is_protocol', False) and
+            not getattr(cls, '_is_runtime_protocol', False) and
+            not _allow_reckless_class_checks(depth=2)
+        ):
+            raise TypeError("Instance and class checks can only be used with"
+                            " @runtime_checkable protocols")
+
         if ((not getattr(cls, '_is_protocol', False) or
                 _is_callable_members_only(cls)) and
                 issubclass(instance.__class__, cls)):
@@ -1154,12 +1559,12 @@
 
             # First, perform various sanity checks.
             if not getattr(cls, '_is_runtime_protocol', False):
-                if _allow_reckless_class_cheks():
+                if _allow_reckless_class_checks():
                     return NotImplemented
                 raise TypeError("Instance and class checks can only be used with"
                                 " @runtime_checkable protocols")
             if not _is_callable_members_only(cls):
-                if _allow_reckless_class_cheks():
+                if _allow_reckless_class_checks():
                     return NotImplemented
                 raise TypeError("Protocols with non-method members"
                                 " don't support issubclass()")
@@ -1196,12 +1601,12 @@
         # ... otherwise check consistency of bases, and prohibit instantiation.
         for base in cls.__bases__:
             if not (base in (object, Generic) or
-                    base.__module__ in _PROTO_WHITELIST and
-                    base.__name__ in _PROTO_WHITELIST[base.__module__] or
+                    base.__module__ in _PROTO_ALLOWLIST and
+                    base.__name__ in _PROTO_ALLOWLIST[base.__module__] or
                     issubclass(base, Generic) and base._is_protocol):
                 raise TypeError('Protocols can only inherit from other'
                                 ' protocols, got %r' % base)
-        cls.__init__ = _no_init
+        cls.__init__ = _no_init_or_replace_init
 
 
 class _AnnotatedAlias(_GenericAlias, _root=True):
@@ -1244,6 +1649,11 @@
     def __hash__(self):
         return hash((self.__origin__, self.__metadata__))
 
+    def __getattr__(self, attr):
+        if attr in {'__name__', '__qualname__'}:
+            return 'Annotated'
+        return super().__getattr__(attr)
+
 
 class Annotated:
     """Add context specific metadata to a type.
@@ -1288,7 +1698,7 @@
                             "with at least two arguments (a type and an "
                             "annotation).")
         msg = "Annotated[t, ...]: t must be a type."
-        origin = _type_check(params[0], msg)
+        origin = _type_check(params[0], msg, allow_special_forms=True)
         metadata = tuple(params[1:])
         return _AnnotatedAlias(origin, metadata)
 
@@ -1382,7 +1792,8 @@
     - If no dict arguments are passed, an attempt is made to use the
       globals from obj (or the respective module's globals for classes),
       and these are also used as the locals.  If the object does not appear
-      to have globals, an empty dictionary is used.
+      to have globals, an empty dictionary is used.  For classes, the search
+      order is globals first then locals.
 
     - If one dict argument is passed, it is used for both globals and
       locals.
@@ -1398,16 +1809,27 @@
         hints = {}
         for base in reversed(obj.__mro__):
             if globalns is None:
-                base_globals = sys.modules[base.__module__].__dict__
+                base_globals = getattr(sys.modules.get(base.__module__, None), '__dict__', {})
             else:
                 base_globals = globalns
             ann = base.__dict__.get('__annotations__', {})
+            if isinstance(ann, types.GetSetDescriptorType):
+                ann = {}
+            base_locals = dict(vars(base)) if localns is None else localns
+            if localns is None and globalns is None:
+                # This is surprising, but required.  Before Python 3.10,
+                # get_type_hints only evaluated the globalns of
+                # a class.  To maintain backwards compatibility, we reverse
+                # the globalns and localns order so that eval() looks into
+                # *base_globals* first rather than *base_locals*.
+                # This only affects ForwardRefs.
+                base_globals, base_locals = base_locals, base_globals
             for name, value in ann.items():
                 if value is None:
                     value = type(None)
                 if isinstance(value, str):
-                    value = ForwardRef(value, is_argument=False)
-                value = _eval_type(value, base_globals, localns)
+                    value = ForwardRef(value, is_argument=False, is_class=True)
+                value = _eval_type(value, base_globals, base_locals)
                 hints[name] = value
         return hints if include_extras else {k: _strip_annotations(t) for k, t in hints.items()}
 
@@ -1438,7 +1860,13 @@
         if value is None:
             value = type(None)
         if isinstance(value, str):
-            value = ForwardRef(value)
+            # class-level forward refs were handled above, this must be either
+            # a module-level annotation or a function argument annotation
+            value = ForwardRef(
+                value,
+                is_argument=not isinstance(obj, types.ModuleType),
+                is_class=False,
+            )
         value = _eval_type(value, globalns, localns)
         if name in defaults and defaults[name] is None:
             value = Optional[value]
@@ -1461,6 +1889,12 @@
         if stripped_args == t.__args__:
             return t
         return GenericAlias(t.__origin__, stripped_args)
+    if isinstance(t, types.UnionType):
+        stripped_args = tuple(_strip_annotations(a) for a in t.__args__)
+        if stripped_args == t.__args__:
+            return t
+        return functools.reduce(operator.or_, stripped_args)
+
     return t
 
 
@@ -1477,13 +1911,17 @@
         get_origin(Generic[T]) is Generic
         get_origin(Union[T, int]) is Union
         get_origin(List[Tuple[T, T]][int]) == list
+        get_origin(P.args) is P
     """
     if isinstance(tp, _AnnotatedAlias):
         return Annotated
-    if isinstance(tp, (_BaseGenericAlias, GenericAlias)):
+    if isinstance(tp, (_BaseGenericAlias, GenericAlias,
+                       ParamSpecArgs, ParamSpecKwargs)):
         return tp.__origin__
     if tp is Generic:
         return Generic
+    if isinstance(tp, types.UnionType):
+        return types.UnionType
     return None
 
 
@@ -1500,16 +1938,31 @@
     """
     if isinstance(tp, _AnnotatedAlias):
         return (tp.__origin__,) + tp.__metadata__
-    if isinstance(tp, _GenericAlias):
+    if isinstance(tp, (_GenericAlias, GenericAlias)):
         res = tp.__args__
-        if tp.__origin__ is collections.abc.Callable and res[0] is not Ellipsis:
+        if (tp.__origin__ is collections.abc.Callable
+                and not (len(res) == 2 and _is_param_expr(res[0]))):
             res = (list(res[:-1]), res[-1])
         return res
-    if isinstance(tp, GenericAlias):
+    if isinstance(tp, types.UnionType):
         return tp.__args__
     return ()
 
 
+def is_typeddict(tp):
+    """Check if an annotation is a TypedDict class
+
+    For example::
+        class Film(TypedDict):
+            title: str
+            year: int
+
+        is_typeddict(Film)  # => True
+        is_typeddict(Union[list, str])  # => False
+    """
+    return isinstance(tp, _TypedDictMeta)
+
+
 def no_type_check(arg):
     """Decorator to indicate that annotations are not type hints.
 
@@ -1900,7 +2353,8 @@
         own_annotation_keys = set(own_annotations.keys())
         msg = "TypedDict('Name', {f0: t0, f1: t1, ...}); each t must be a type"
         own_annotations = {
-            n: _type_check(tp, msg) for n, tp in own_annotations.items()
+            n: _type_check(tp, msg, module=tp_dict.__module__)
+            for n, tp in own_annotations.items()
         }
         required_keys = set()
         optional_keys = set()
@@ -1980,24 +2434,24 @@
         raise TypeError("TypedDict takes either a dict or keyword arguments,"
                         " but not both")
 
-    ns = {'__annotations__': dict(fields), '__total__': total}
+    ns = {'__annotations__': dict(fields)}
     try:
         # Setting correct module is necessary to make typed dict classes pickleable.
         ns['__module__'] = sys._getframe(1).f_globals.get('__name__', '__main__')
     except (AttributeError, ValueError):
         pass
 
-    return _TypedDictMeta(typename, (), ns)
+    return _TypedDictMeta(typename, (), ns, total=total)
 
 _TypedDict = type.__new__(_TypedDictMeta, 'TypedDict', (), {})
 TypedDict.__mro_entries__ = lambda bases: (_TypedDict,)
 
 
-def NewType(name, tp):
+class NewType:
     """NewType creates simple unique types with almost zero
     runtime overhead. NewType(name, tp) is considered a subtype of tp
     by static type checkers. At runtime, NewType(name, tp) returns
-    a dummy function that simply returns its argument. Usage::
+    a dummy callable that simply returns its argument. Usage::
 
         UserId = NewType('UserId', int)
 
@@ -2012,12 +2466,30 @@
         num = UserId(5) + 1     # type: int
     """
 
-    def new_type(x):
+    def __init__(self, name, tp):
+        self.__qualname__ = name
+        if '.' in name:
+            name = name.rpartition('.')[-1]
+        self.__name__ = name
+        self.__supertype__ = tp
+        def_mod = _caller()
+        if def_mod != 'typing':
+            self.__module__ = def_mod
+
+    def __repr__(self):
+        return f'{self.__module__}.{self.__qualname__}'
+
+    def __call__(self, x):
         return x
 
-    new_type.__name__ = name
-    new_type.__supertype__ = tp
-    return new_type
+    def __reduce__(self):
+        return self.__qualname__
+
+    def __or__(self, other):
+        return Union[self, other]
+
+    def __ror__(self, other):
+        return Union[other, self]
 
 
 # Python-version-specific alias (Python 2: unicode; Python 3: str)
diff --git a/Lib/unittest/_log.py b/Lib/unittest/_log.py
index 94e7e75..94868e5 100644
--- a/Lib/unittest/_log.py
+++ b/Lib/unittest/_log.py
@@ -26,11 +26,11 @@
 
 
 class _AssertLogsContext(_BaseTestCaseContext):
-    """A context manager used to implement TestCase.assertLogs()."""
+    """A context manager for assertLogs() and assertNoLogs() """
 
     LOGGING_FORMAT = "%(levelname)s:%(name)s:%(message)s"
 
-    def __init__(self, test_case, logger_name, level):
+    def __init__(self, test_case, logger_name, level, no_logs):
         _BaseTestCaseContext.__init__(self, test_case)
         self.logger_name = logger_name
         if level:
@@ -38,6 +38,7 @@
         else:
             self.level = logging.INFO
         self.msg = None
+        self.no_logs = no_logs
 
     def __enter__(self):
         if isinstance(self.logger_name, logging.Logger):
@@ -46,6 +47,7 @@
             logger = self.logger = logging.getLogger(self.logger_name)
         formatter = logging.Formatter(self.LOGGING_FORMAT)
         handler = _CapturingHandler()
+        handler.setLevel(self.level)
         handler.setFormatter(formatter)
         self.watcher = handler.watcher
         self.old_handlers = logger.handlers[:]
@@ -54,16 +56,31 @@
         logger.handlers = [handler]
         logger.setLevel(self.level)
         logger.propagate = False
+        if self.no_logs:
+            return
         return handler.watcher
 
     def __exit__(self, exc_type, exc_value, tb):
         self.logger.handlers = self.old_handlers
         self.logger.propagate = self.old_propagate
         self.logger.setLevel(self.old_level)
+
         if exc_type is not None:
             # let unexpected exceptions pass through
             return False
-        if len(self.watcher.records) == 0:
-            self._raiseFailure(
-                "no logs of level {} or higher triggered on {}"
-                .format(logging.getLevelName(self.level), self.logger.name))
+
+        if self.no_logs:
+            # assertNoLogs
+            if len(self.watcher.records) > 0:
+                self._raiseFailure(
+                    "Unexpected logs found: {!r}".format(
+                        self.watcher.output
+                    )
+                )
+
+        else:
+            # assertLogs
+            if len(self.watcher.records) == 0:
+                self._raiseFailure(
+                    "no logs of level {} or higher triggered on {}"
+                    .format(logging.getLevelName(self.level), self.logger.name))
diff --git a/Lib/unittest/async_case.py b/Lib/unittest/async_case.py
index 1bc1312..2323119 100644
--- a/Lib/unittest/async_case.py
+++ b/Lib/unittest/async_case.py
@@ -4,7 +4,6 @@
 from .case import TestCase
 
 
-
 class IsolatedAsyncioTestCase(TestCase):
     # Names intentionally have a long prefix
     # to reduce a chance of clashing with user-defined attributes
@@ -52,7 +51,7 @@
         # We intentionally don't add inspect.iscoroutinefunction() check
         # for func argument because there is no way
         # to check for async function reliably:
-        # 1. It can be "async def func()" iself
+        # 1. It can be "async def func()" itself
         # 2. Class can implement "async def __call__()" method
         # 3. Regular "def func()" that returns awaitable object
         self.addCleanup(*(func, *args), **kwargs)
@@ -72,15 +71,15 @@
         self._callMaybeAsync(function, *args, **kwargs)
 
     def _callAsync(self, func, /, *args, **kwargs):
-        assert self._asyncioTestLoop is not None
+        assert self._asyncioTestLoop is not None, 'asyncio test loop is not initialized'
         ret = func(*args, **kwargs)
-        assert inspect.isawaitable(ret)
+        assert inspect.isawaitable(ret), f'{func!r} returned non-awaitable'
         fut = self._asyncioTestLoop.create_future()
         self._asyncioCallsQueue.put_nowait((fut, ret))
         return self._asyncioTestLoop.run_until_complete(fut)
 
     def _callMaybeAsync(self, func, /, *args, **kwargs):
-        assert self._asyncioTestLoop is not None
+        assert self._asyncioTestLoop is not None, 'asyncio test loop is not initialized'
         ret = func(*args, **kwargs)
         if inspect.isawaitable(ret):
             fut = self._asyncioTestLoop.create_future()
@@ -102,14 +101,14 @@
                 ret = await awaitable
                 if not fut.cancelled():
                     fut.set_result(ret)
-            except asyncio.CancelledError:
+            except (SystemExit, KeyboardInterrupt):
                 raise
-            except Exception as ex:
+            except (BaseException, asyncio.CancelledError) as ex:
                 if not fut.cancelled():
                     fut.set_exception(ex)
 
     def _setupAsyncioLoop(self):
-        assert self._asyncioTestLoop is None
+        assert self._asyncioTestLoop is None, 'asyncio test loop already initialized'
         loop = asyncio.new_event_loop()
         asyncio.set_event_loop(loop)
         loop.set_debug(True)
@@ -119,7 +118,7 @@
         loop.run_until_complete(fut)
 
     def _tearDownAsyncioLoop(self):
-        assert self._asyncioTestLoop is not None
+        assert self._asyncioTestLoop is not None, 'asyncio test loop is not initialized'
         loop = self._asyncioTestLoop
         self._asyncioTestLoop = None
         self._asyncioCallsQueue.put_nowait(None)
@@ -135,7 +134,7 @@
                 task.cancel()
 
             loop.run_until_complete(
-                asyncio.gather(*to_cancel, loop=loop, return_exceptions=True))
+                asyncio.gather(*to_cancel, return_exceptions=True))
 
             for task in to_cancel:
                 if task.cancelled():
@@ -158,3 +157,12 @@
             return super().run(result)
         finally:
             self._tearDownAsyncioLoop()
+
+    def debug(self):
+        self._setupAsyncioLoop()
+        super().debug()
+        self._tearDownAsyncioLoop()
+
+    def __del__(self):
+        if self._asyncioTestLoop is not None:
+            self._tearDownAsyncioLoop()
diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py
index f8bc865..61003d0 100644
--- a/Lib/unittest/case.py
+++ b/Lib/unittest/case.py
@@ -252,7 +252,7 @@
     def __enter__(self):
         # The __warningregistry__'s need to be in a pristine state for tests
         # to work properly.
-        for v in sys.modules.values():
+        for v in list(sys.modules.values()):
             if getattr(v, '__warningregistry__', None):
                 v.__warningregistry__ = {}
         self.warnings_manager = warnings.catch_warnings(record=True)
@@ -295,7 +295,6 @@
             self._raiseFailure("{} not triggered".format(exc_name))
 
 
-
 class _OrderedChainMap(collections.ChainMap):
     def __iter__(self):
         seen = set()
@@ -556,73 +555,71 @@
         function(*args, **kwargs)
 
     def run(self, result=None):
-        orig_result = result
         if result is None:
             result = self.defaultTestResult()
             startTestRun = getattr(result, 'startTestRun', None)
+            stopTestRun = getattr(result, 'stopTestRun', None)
             if startTestRun is not None:
                 startTestRun()
+        else:
+            stopTestRun = None
 
         result.startTest(self)
-
-        testMethod = getattr(self, self._testMethodName)
-        if (getattr(self.__class__, "__unittest_skip__", False) or
-            getattr(testMethod, "__unittest_skip__", False)):
-            # If the class or method was skipped.
-            try:
+        try:
+            testMethod = getattr(self, self._testMethodName)
+            if (getattr(self.__class__, "__unittest_skip__", False) or
+                getattr(testMethod, "__unittest_skip__", False)):
+                # If the class or method was skipped.
                 skip_why = (getattr(self.__class__, '__unittest_skip_why__', '')
                             or getattr(testMethod, '__unittest_skip_why__', ''))
                 self._addSkip(result, self, skip_why)
-            finally:
-                result.stopTest(self)
-            return
-        expecting_failure_method = getattr(testMethod,
-                                           "__unittest_expecting_failure__", False)
-        expecting_failure_class = getattr(self,
-                                          "__unittest_expecting_failure__", False)
-        expecting_failure = expecting_failure_class or expecting_failure_method
-        outcome = _Outcome(result)
-        try:
-            self._outcome = outcome
+                return result
 
-            with outcome.testPartExecutor(self):
-                self._callSetUp()
-            if outcome.success:
-                outcome.expecting_failure = expecting_failure
-                with outcome.testPartExecutor(self, isTest=True):
-                    self._callTestMethod(testMethod)
-                outcome.expecting_failure = False
+            expecting_failure = (
+                getattr(self, "__unittest_expecting_failure__", False) or
+                getattr(testMethod, "__unittest_expecting_failure__", False)
+            )
+            outcome = _Outcome(result)
+            try:
+                self._outcome = outcome
+
                 with outcome.testPartExecutor(self):
-                    self._callTearDown()
+                    self._callSetUp()
+                if outcome.success:
+                    outcome.expecting_failure = expecting_failure
+                    with outcome.testPartExecutor(self, isTest=True):
+                        self._callTestMethod(testMethod)
+                    outcome.expecting_failure = False
+                    with outcome.testPartExecutor(self):
+                        self._callTearDown()
 
-            self.doCleanups()
-            for test, reason in outcome.skipped:
-                self._addSkip(result, test, reason)
-            self._feedErrorsToResult(result, outcome.errors)
-            if outcome.success:
-                if expecting_failure:
-                    if outcome.expectedFailure:
-                        self._addExpectedFailure(result, outcome.expectedFailure)
+                self.doCleanups()
+                for test, reason in outcome.skipped:
+                    self._addSkip(result, test, reason)
+                self._feedErrorsToResult(result, outcome.errors)
+                if outcome.success:
+                    if expecting_failure:
+                        if outcome.expectedFailure:
+                            self._addExpectedFailure(result, outcome.expectedFailure)
+                        else:
+                            self._addUnexpectedSuccess(result)
                     else:
-                        self._addUnexpectedSuccess(result)
-                else:
-                    result.addSuccess(self)
-            return result
+                        result.addSuccess(self)
+                return result
+            finally:
+                # explicitly break reference cycles:
+                # outcome.errors -> frame -> outcome -> outcome.errors
+                # outcome.expectedFailure -> frame -> outcome -> outcome.expectedFailure
+                outcome.errors.clear()
+                outcome.expectedFailure = None
+
+                # clear the outcome, no more needed
+                self._outcome = None
+
         finally:
             result.stopTest(self)
-            if orig_result is None:
-                stopTestRun = getattr(result, 'stopTestRun', None)
-                if stopTestRun is not None:
-                    stopTestRun()
-
-            # explicitly break reference cycles:
-            # outcome.errors -> frame -> outcome -> outcome.errors
-            # outcome.expectedFailure -> frame -> outcome -> outcome.expectedFailure
-            outcome.errors.clear()
-            outcome.expectedFailure = None
-
-            # clear the outcome, no more needed
-            self._outcome = None
+            if stopTestRun is not None:
+                stopTestRun()
 
     def doCleanups(self):
         """Execute all cleanup functions. Normally called for you after
@@ -654,12 +651,20 @@
 
     def debug(self):
         """Run the test without collecting errors in a TestResult"""
-        self.setUp()
-        getattr(self, self._testMethodName)()
-        self.tearDown()
+        testMethod = getattr(self, self._testMethodName)
+        if (getattr(self.__class__, "__unittest_skip__", False) or
+            getattr(testMethod, "__unittest_skip__", False)):
+            # If the class or method was skipped.
+            skip_why = (getattr(self.__class__, '__unittest_skip_why__', '')
+                        or getattr(testMethod, '__unittest_skip_why__', ''))
+            raise SkipTest(skip_why)
+
+        self._callSetUp()
+        self._callTestMethod(testMethod)
+        self._callTearDown()
         while self._cleanups:
-            function, args, kwargs = self._cleanups.pop(-1)
-            function(*args, **kwargs)
+            function, args, kwargs = self._cleanups.pop()
+            self._callCleanup(function, *args, **kwargs)
 
     def skipTest(self, reason):
         """Skip this test."""
@@ -788,7 +793,16 @@
         """
         # Lazy import to avoid importing logging if it is not needed.
         from ._log import _AssertLogsContext
-        return _AssertLogsContext(self, logger, level)
+        return _AssertLogsContext(self, logger, level, no_logs=False)
+
+    def assertNoLogs(self, logger=None, level=None):
+        """ Fail unless no log messages of level *level* or higher are emitted
+        on *logger_name* or its children.
+
+        This method must be used as a context manager.
+        """
+        from ._log import _AssertLogsContext
+        return _AssertLogsContext(self, logger, level, no_logs=True)
 
     def _getAssertEqualityFunc(self, first, second):
         """Get a detailed comparison function for the types of the two args.
@@ -1132,7 +1146,8 @@
     def assertDictContainsSubset(self, subset, dictionary, msg=None):
         """Checks whether dictionary is a superset of subset."""
         warnings.warn('assertDictContainsSubset is deprecated',
-                      DeprecationWarning)
+                      DeprecationWarning,
+                      stacklevel=2)
         missing = []
         mismatched = []
         for key, value in subset.items():
diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py
index b495a5f..7152f86 100644
--- a/Lib/unittest/mock.py
+++ b/Lib/unittest/mock.py
@@ -36,6 +36,10 @@
 from functools import wraps, partial
 
 
+class InvalidSpecError(Exception):
+    """Indicates that an invalid value was used as a mock spec."""
+
+
 _builtins = {name for name in dir(builtins) if not name.startswith('_')}
 
 FILTER_DIR = True
@@ -406,7 +410,7 @@
             # Check if spec is an async object or function
             bound_args = _MOCK_SIG.bind_partial(cls, *args, **kw).arguments
             spec_arg = bound_args.get('spec_set', bound_args.get('spec'))
-            if spec_arg and _is_async_obj(spec_arg):
+            if spec_arg is not None and _is_async_obj(spec_arg):
                 bases = (AsyncMockMixin, cls)
         new = type(cls.__name__, bases, {'__doc__': cls.__doc__})
         instance = _safe_super(NonCallableMock, cls).__new__(new)
@@ -631,9 +635,10 @@
         elif _is_magic(name):
             raise AttributeError(name)
         if not self._mock_unsafe:
-            if name.startswith(('assert', 'assret')):
-                raise AttributeError("Attributes cannot start with 'assert' "
-                                     "or 'assret'")
+            if name.startswith(('assert', 'assret', 'asert', 'aseert', 'assrt')):
+                raise AttributeError(
+                    f"{name!r} is not a valid assertion. Use a spec "
+                    f"for the mock if {name!r} is meant to be an attribute.")
 
         result = self._mock_children.get(name)
         if result is _deleted:
@@ -652,10 +657,17 @@
             self._mock_children[name]  = result
 
         elif isinstance(result, _SpecState):
-            result = create_autospec(
-                result.spec, result.spec_set, result.instance,
-                result.parent, result.name
-            )
+            try:
+                result = create_autospec(
+                    result.spec, result.spec_set, result.instance,
+                    result.parent, result.name
+                )
+            except InvalidSpecError:
+                target_name = self.__dict__['_mock_name'] or self
+                raise InvalidSpecError(
+                    f'Cannot autospec attr {name!r} from target '
+                    f'{target_name!r} as it has already been mocked out. '
+                    f'[target={self!r}, attr={result.spec!r}]')
             self._mock_children[name]  = result
 
         return result
@@ -992,6 +1004,11 @@
         if _new_name in self.__dict__['_spec_asyncs']:
             return AsyncMock(**kw)
 
+        if self._mock_sealed:
+            attribute = f".{kw['name']}" if "name" in kw else "()"
+            mock_name = self._extract_mock_name() + attribute
+            raise AttributeError(mock_name)
+
         _type = type(self)
         if issubclass(_type, MagicMock) and _new_name in _async_method_magics:
             # Any asynchronous magic becomes an AsyncMock
@@ -1010,12 +1027,6 @@
                 klass = Mock
         else:
             klass = _type.__mro__[1]
-
-        if self._mock_sealed:
-            attribute = "." + kw["name"] if "name" in kw else "()"
-            mock_name = self._extract_mock_name() + attribute
-            raise AttributeError(mock_name)
-
         return klass(**kw)
 
 
@@ -1241,6 +1252,17 @@
     return thing
 
 
+# _check_spec_arg_typos takes kwargs from commands like patch and checks that
+# they don't contain common misspellings of arguments related to autospeccing.
+def _check_spec_arg_typos(kwargs_to_check):
+    typos = ("autospect", "auto_spec", "set_spec")
+    for typo in typos:
+        if typo in kwargs_to_check:
+            raise RuntimeError(
+                f"{typo!r} might be a typo; use unsafe=True if this is intended"
+            )
+
+
 class _patch(object):
 
     attribute_name = None
@@ -1248,7 +1270,7 @@
 
     def __init__(
             self, getter, attribute, new, spec, create,
-            spec_set, autospec, new_callable, kwargs
+            spec_set, autospec, new_callable, kwargs, *, unsafe=False
         ):
         if new_callable is not None:
             if new is not DEFAULT:
@@ -1259,6 +1281,16 @@
                 raise ValueError(
                     "Cannot use 'autospec' and 'new_callable' together"
                 )
+        if not unsafe:
+            _check_spec_arg_typos(kwargs)
+        if _is_instance_mock(spec):
+            raise InvalidSpecError(
+                f'Cannot spec attr {attribute!r} as the spec '
+                f'has already been mocked out. [spec={spec!r}]')
+        if _is_instance_mock(spec_set):
+            raise InvalidSpecError(
+                f'Cannot spec attr {attribute!r} as the spec_set '
+                f'target has already been mocked out. [spec_set={spec_set!r}]')
 
         self.getter = getter
         self.attribute = attribute
@@ -1486,6 +1518,18 @@
             if autospec is True:
                 autospec = original
 
+            if _is_instance_mock(self.target):
+                raise InvalidSpecError(
+                    f'Cannot autospec attr {self.attribute!r} as the patch '
+                    f'target has already been mocked out. '
+                    f'[target={self.target!r}, attr={autospec!r}]')
+            if _is_instance_mock(autospec):
+                target_name = getattr(self.target, '__name__', self.target)
+                raise InvalidSpecError(
+                    f'Cannot autospec attr {self.attribute!r} from target '
+                    f'{target_name!r} as it has already been mocked out. '
+                    f'[target={self.target!r}, attr={autospec!r}]')
+
             new = create_autospec(autospec, spec_set=spec_set,
                                   _name=self.attribute, **kwargs)
         elif kwargs:
@@ -1558,9 +1602,9 @@
 def _get_target(target):
     try:
         target, attribute = target.rsplit('.', 1)
-    except (TypeError, ValueError):
-        raise TypeError("Need a valid target to patch. You supplied: %r" %
-                        (target,))
+    except (TypeError, ValueError, AttributeError):
+        raise TypeError(
+            f"Need a valid target to patch. You supplied: {target!r}")
     getter = lambda: _importer(target)
     return getter, attribute
 
@@ -1568,7 +1612,7 @@
 def _patch_object(
         target, attribute, new=DEFAULT, spec=None,
         create=False, spec_set=None, autospec=None,
-        new_callable=None, **kwargs
+        new_callable=None, *, unsafe=False, **kwargs
     ):
     """
     patch the named member (`attribute`) on an object (`target`) with a mock
@@ -1590,7 +1634,7 @@
     getter = lambda: target
     return _patch(
         getter, attribute, new, spec, create,
-        spec_set, autospec, new_callable, kwargs
+        spec_set, autospec, new_callable, kwargs, unsafe=unsafe
     )
 
 
@@ -1645,7 +1689,7 @@
 
 def patch(
         target, new=DEFAULT, spec=None, create=False,
-        spec_set=None, autospec=None, new_callable=None, **kwargs
+        spec_set=None, autospec=None, new_callable=None, *, unsafe=False, **kwargs
     ):
     """
     `patch` acts as a function decorator, class decorator or a context
@@ -1707,6 +1751,10 @@
     use "as" then the patched object will be bound to the name after the
     "as"; very useful if `patch` is creating a mock object for you.
 
+    Patch will raise a `RuntimeError` if passed some common misspellings of
+    the arguments autospec and spec_set. Pass the argument `unsafe` with the
+    value True to disable that check.
+
     `patch` takes arbitrary keyword arguments. These will be passed to
     `AsyncMock` if the patched object is asynchronous, to `MagicMock`
     otherwise or to `new_callable` if specified.
@@ -1717,7 +1765,7 @@
     getter, attribute = _get_target(target)
     return _patch(
         getter, attribute, new, spec, create,
-        spec_set, autospec, new_callable, kwargs
+        spec_set, autospec, new_callable, kwargs, unsafe=unsafe
     )
 
 
@@ -2567,7 +2615,7 @@
 
 
 def create_autospec(spec, spec_set=False, instance=False, _parent=None,
-                    _name=None, **kwargs):
+                    _name=None, *, unsafe=False, **kwargs):
     """Create a mock object using another object as a spec. Attributes on the
     mock will use the corresponding attribute on the `spec` object as their
     spec.
@@ -2583,6 +2631,10 @@
     spec for an instance object by passing `instance=True`. The returned mock
     will only be callable if instances of the mock are callable.
 
+    `create_autospec` will raise a `RuntimeError` if passed some common
+    misspellings of the arguments autospec and spec_set. Pass the argument
+    `unsafe` with the value True to disable that check.
+
     `create_autospec` also takes arbitrary keyword arguments that are passed to
     the constructor of the created mock."""
     if _is_list(spec):
@@ -2591,6 +2643,9 @@
         spec = type(spec)
 
     is_type = isinstance(spec, type)
+    if _is_instance_mock(spec):
+        raise InvalidSpecError(f'Cannot autospec a Mock object. '
+                               f'[object={spec!r}]')
     is_async_func = _is_async_func(spec)
     _kwargs = {'spec': spec}
     if spec_set:
@@ -2600,6 +2655,8 @@
         _kwargs = {}
     if _kwargs and instance:
         _kwargs['_spec_as_instance'] = True
+    if not unsafe:
+        _check_spec_arg_typos(kwargs)
 
     _kwargs.update(kwargs)
 
@@ -2869,6 +2926,8 @@
             continue
         if not isinstance(m, NonCallableMock):
             continue
+        if isinstance(m._mock_children.get(attr), _SpecState):
+            continue
         if m._mock_new_parent is mock:
             seal(m)
 
diff --git a/Lib/unittest/result.py b/Lib/unittest/result.py
index 111317b..3da7005 100644
--- a/Lib/unittest/result.py
+++ b/Lib/unittest/result.py
@@ -173,17 +173,10 @@
     def _exc_info_to_string(self, err, test):
         """Converts a sys.exc_info()-style tuple of values into a string."""
         exctype, value, tb = err
-        # Skip test runner traceback levels
-        while tb and self._is_relevant_tb_level(tb):
-            tb = tb.tb_next
-
-        if exctype is test.failureException:
-            # Skip assert*() traceback levels
-            length = self._count_relevant_tb_levels(tb)
-        else:
-            length = None
+        tb = self._clean_tracebacks(exctype, value, tb, test)
         tb_e = traceback.TracebackException(
-            exctype, value, tb, limit=length, capture_locals=self.tb_locals)
+            exctype, value, tb,
+            capture_locals=self.tb_locals, compact=True)
         msgLines = list(tb_e.format())
 
         if self.buffer:
@@ -199,16 +192,49 @@
                 msgLines.append(STDERR_LINE % error)
         return ''.join(msgLines)
 
+    def _clean_tracebacks(self, exctype, value, tb, test):
+        ret = None
+        first = True
+        excs = [(exctype, value, tb)]
+        while excs:
+            (exctype, value, tb) = excs.pop()
+            # Skip test runner traceback levels
+            while tb and self._is_relevant_tb_level(tb):
+                tb = tb.tb_next
+
+            # Skip assert*() traceback levels
+            if exctype is test.failureException:
+                self._remove_unittest_tb_frames(tb)
+
+            if first:
+                ret = tb
+                first = False
+            else:
+                value.__traceback__ = tb
+
+            if value is not None:
+                for c in (value.__cause__, value.__context__):
+                    if c is not None:
+                        excs.append((type(c), c, c.__traceback__))
+        return ret
 
     def _is_relevant_tb_level(self, tb):
         return '__unittest' in tb.tb_frame.f_globals
 
-    def _count_relevant_tb_levels(self, tb):
-        length = 0
+    def _remove_unittest_tb_frames(self, tb):
+        '''Truncates usercode tb at the first unittest frame.
+
+        If the first frame of the traceback is in user code,
+        the prefix up to the first unittest frame is returned.
+        If the first frame is already in the unittest module,
+        the traceback is not modified.
+        '''
+        prev = None
         while tb and not self._is_relevant_tb_level(tb):
-            length += 1
+            prev = tb
             tb = tb.tb_next
-        return length
+        if prev is not None:
+            prev.tb_next = None
 
     def __repr__(self):
         return ("<%s run=%i errors=%i failures=%i>" %
diff --git a/Lib/unittest/runner.py b/Lib/unittest/runner.py
index 45e7e4c..caf1590 100644
--- a/Lib/unittest/runner.py
+++ b/Lib/unittest/runner.py
@@ -59,6 +59,7 @@
         super(TextTestResult, self).addSuccess(test)
         if self.showAll:
             self.stream.writeln("ok")
+            self.stream.flush()
         elif self.dots:
             self.stream.write('.')
             self.stream.flush()
@@ -67,6 +68,7 @@
         super(TextTestResult, self).addError(test, err)
         if self.showAll:
             self.stream.writeln("ERROR")
+            self.stream.flush()
         elif self.dots:
             self.stream.write('E')
             self.stream.flush()
@@ -75,6 +77,7 @@
         super(TextTestResult, self).addFailure(test, err)
         if self.showAll:
             self.stream.writeln("FAIL")
+            self.stream.flush()
         elif self.dots:
             self.stream.write('F')
             self.stream.flush()
@@ -83,6 +86,7 @@
         super(TextTestResult, self).addSkip(test, reason)
         if self.showAll:
             self.stream.writeln("skipped {0!r}".format(reason))
+            self.stream.flush()
         elif self.dots:
             self.stream.write("s")
             self.stream.flush()
@@ -91,6 +95,7 @@
         super(TextTestResult, self).addExpectedFailure(test, err)
         if self.showAll:
             self.stream.writeln("expected failure")
+            self.stream.flush()
         elif self.dots:
             self.stream.write("x")
             self.stream.flush()
@@ -99,6 +104,7 @@
         super(TextTestResult, self).addUnexpectedSuccess(test)
         if self.showAll:
             self.stream.writeln("unexpected success")
+            self.stream.flush()
         elif self.dots:
             self.stream.write("u")
             self.stream.flush()
@@ -106,6 +112,7 @@
     def printErrors(self):
         if self.dots or self.showAll:
             self.stream.writeln()
+            self.stream.flush()
         self.printErrorList('ERROR', self.errors)
         self.printErrorList('FAIL', self.failures)
 
@@ -115,6 +122,7 @@
             self.stream.writeln("%s: %s" % (flavour,self.getDescription(test)))
             self.stream.writeln(self.separator2)
             self.stream.writeln("%s" % err)
+            self.stream.flush()
 
 
 class TextTestRunner(object):
@@ -218,4 +226,5 @@
             self.stream.writeln(" (%s)" % (", ".join(infos),))
         else:
             self.stream.write("\n")
+        self.stream.flush()
         return result
diff --git a/Lib/unittest/suite.py b/Lib/unittest/suite.py
index 41993f9..6f45b6f 100644
--- a/Lib/unittest/suite.py
+++ b/Lib/unittest/suite.py
@@ -149,6 +149,7 @@
         if getattr(currentClass, "__unittest_skip__", False):
             return
 
+        failed = False
         try:
             currentClass._classSetupFailed = False
         except TypeError:
@@ -157,27 +158,32 @@
             pass
 
         setUpClass = getattr(currentClass, 'setUpClass', None)
+        doClassCleanups = getattr(currentClass, 'doClassCleanups', None)
         if setUpClass is not None:
             _call_if_exists(result, '_setupStdout')
             try:
-                setUpClass()
-            except Exception as e:
-                if isinstance(result, _DebugResult):
-                    raise
-                currentClass._classSetupFailed = True
-                className = util.strclass(currentClass)
-                self._createClassOrModuleLevelException(result, e,
-                                                        'setUpClass',
-                                                        className)
+                try:
+                    setUpClass()
+                except Exception as e:
+                    if isinstance(result, _DebugResult):
+                        raise
+                    failed = True
+                    try:
+                        currentClass._classSetupFailed = True
+                    except TypeError:
+                        pass
+                    className = util.strclass(currentClass)
+                    self._createClassOrModuleLevelException(result, e,
+                                                            'setUpClass',
+                                                            className)
+                if failed and doClassCleanups is not None:
+                    doClassCleanups()
+                    for exc_info in currentClass.tearDown_exceptions:
+                        self._createClassOrModuleLevelException(
+                                result, exc_info[1], 'setUpClass', className,
+                                info=exc_info)
             finally:
                 _call_if_exists(result, '_restoreStdout')
-                if currentClass._classSetupFailed is True:
-                    currentClass.doClassCleanups()
-                    if len(currentClass.tearDown_exceptions) > 0:
-                        for exc in currentClass.tearDown_exceptions:
-                            self._createClassOrModuleLevelException(
-                                    result, exc[1], 'setUpClass', className,
-                                    info=exc)
 
     def _get_previous_module(self, result):
         previousModule = None
@@ -205,20 +211,22 @@
         if setUpModule is not None:
             _call_if_exists(result, '_setupStdout')
             try:
-                setUpModule()
-            except Exception as e:
                 try:
-                    case.doModuleCleanups()
-                except Exception as exc:
-                    self._createClassOrModuleLevelException(result, exc,
+                    setUpModule()
+                except Exception as e:
+                    if isinstance(result, _DebugResult):
+                        raise
+                    result._moduleSetUpFailed = True
+                    self._createClassOrModuleLevelException(result, e,
                                                             'setUpModule',
                                                             currentModule)
-                if isinstance(result, _DebugResult):
-                    raise
-                result._moduleSetUpFailed = True
-                self._createClassOrModuleLevelException(result, e,
-                                                        'setUpModule',
-                                                        currentModule)
+                if result._moduleSetUpFailed:
+                    try:
+                        case.doModuleCleanups()
+                    except Exception as e:
+                        self._createClassOrModuleLevelException(result, e,
+                                                                'setUpModule',
+                                                                currentModule)
             finally:
                 _call_if_exists(result, '_restoreStdout')
 
@@ -251,30 +259,33 @@
         except KeyError:
             return
 
-        tearDownModule = getattr(module, 'tearDownModule', None)
-        if tearDownModule is not None:
-            _call_if_exists(result, '_setupStdout')
+        _call_if_exists(result, '_setupStdout')
+        try:
+            tearDownModule = getattr(module, 'tearDownModule', None)
+            if tearDownModule is not None:
+                try:
+                    tearDownModule()
+                except Exception as e:
+                    if isinstance(result, _DebugResult):
+                        raise
+                    self._createClassOrModuleLevelException(result, e,
+                                                            'tearDownModule',
+                                                            previousModule)
             try:
-                tearDownModule()
+                case.doModuleCleanups()
             except Exception as e:
                 if isinstance(result, _DebugResult):
                     raise
                 self._createClassOrModuleLevelException(result, e,
                                                         'tearDownModule',
                                                         previousModule)
-            finally:
-                _call_if_exists(result, '_restoreStdout')
-                try:
-                    case.doModuleCleanups()
-                except Exception as e:
-                    self._createClassOrModuleLevelException(result, e,
-                                                            'tearDownModule',
-                                                            previousModule)
+        finally:
+            _call_if_exists(result, '_restoreStdout')
 
     def _tearDownPreviousClass(self, test, result):
         previousClass = getattr(result, '_previousTestClass', None)
         currentClass = test.__class__
-        if currentClass == previousClass:
+        if currentClass == previousClass or previousClass is None:
             return
         if getattr(previousClass, '_classSetupFailed', False):
             return
@@ -284,27 +295,34 @@
             return
 
         tearDownClass = getattr(previousClass, 'tearDownClass', None)
-        if tearDownClass is not None:
-            _call_if_exists(result, '_setupStdout')
-            try:
-                tearDownClass()
-            except Exception as e:
-                if isinstance(result, _DebugResult):
-                    raise
-                className = util.strclass(previousClass)
-                self._createClassOrModuleLevelException(result, e,
-                                                        'tearDownClass',
-                                                        className)
-            finally:
-                _call_if_exists(result, '_restoreStdout')
-                previousClass.doClassCleanups()
-                if len(previousClass.tearDown_exceptions) > 0:
-                    for exc in previousClass.tearDown_exceptions:
-                        className = util.strclass(previousClass)
-                        self._createClassOrModuleLevelException(result, exc[1],
-                                                                'tearDownClass',
-                                                                className,
-                                                                info=exc)
+        doClassCleanups = getattr(previousClass, 'doClassCleanups', None)
+        if tearDownClass is None and doClassCleanups is None:
+            return
+
+        _call_if_exists(result, '_setupStdout')
+        try:
+            if tearDownClass is not None:
+                try:
+                    tearDownClass()
+                except Exception as e:
+                    if isinstance(result, _DebugResult):
+                        raise
+                    className = util.strclass(previousClass)
+                    self._createClassOrModuleLevelException(result, e,
+                                                            'tearDownClass',
+                                                            className)
+            if doClassCleanups is not None:
+                doClassCleanups()
+                for exc_info in previousClass.tearDown_exceptions:
+                    if isinstance(result, _DebugResult):
+                        raise exc_info[1]
+                    className = util.strclass(previousClass)
+                    self._createClassOrModuleLevelException(result, exc_info[1],
+                                                            'tearDownClass',
+                                                            className,
+                                                            info=exc_info)
+        finally:
+            _call_if_exists(result, '_restoreStdout')
 
 
 class _ErrorHolder(object):
diff --git a/Lib/unittest/test/test_assertions.py b/Lib/unittest/test/test_assertions.py
index f5e64d6..a0db3423 100644
--- a/Lib/unittest/test/test_assertions.py
+++ b/Lib/unittest/test/test_assertions.py
@@ -2,6 +2,7 @@
 import warnings
 import weakref
 import unittest
+from test.support import gc_collect
 from itertools import product
 
 
@@ -124,8 +125,10 @@
                     self.foo()
 
         Foo("test_functional").run()
+        gc_collect()  # For PyPy or other GCs.
         self.assertIsNone(wr())
         Foo("test_with").run()
+        gc_collect()  # For PyPy or other GCs.
         self.assertIsNone(wr())
 
     def testAssertNotRegex(self):
diff --git a/Lib/unittest/test/test_async_case.py b/Lib/unittest/test/test_async_case.py
index 2db441d..e46b99f 100644
--- a/Lib/unittest/test/test_async_case.py
+++ b/Lib/unittest/test/test_async_case.py
@@ -1,5 +1,10 @@
 import asyncio
 import unittest
+from test import support
+
+
+class MyException(Exception):
+    pass
 
 
 def tearDownModule():
@@ -7,9 +12,14 @@
 
 
 class TestAsyncCase(unittest.TestCase):
-    def test_full_cycle(self):
-        events = []
+    maxDiff = None
 
+    def tearDown(self):
+        # Ensure that IsolatedAsyncioTestCase instances are destroyed before
+        # starting a new event loop
+        support.gc_collect()
+
+    def test_full_cycle(self):
         class Test(unittest.IsolatedAsyncioTestCase):
             def setUp(self):
                 self.assertEqual(events, [])
@@ -18,12 +28,13 @@
             async def asyncSetUp(self):
                 self.assertEqual(events, ['setUp'])
                 events.append('asyncSetUp')
+                self.addAsyncCleanup(self.on_cleanup1)
 
             async def test_func(self):
                 self.assertEqual(events, ['setUp',
                                           'asyncSetUp'])
                 events.append('test')
-                self.addAsyncCleanup(self.on_cleanup)
+                self.addAsyncCleanup(self.on_cleanup2)
 
             async def asyncTearDown(self):
                 self.assertEqual(events, ['setUp',
@@ -38,34 +49,48 @@
                                           'asyncTearDown'])
                 events.append('tearDown')
 
-            async def on_cleanup(self):
+            async def on_cleanup1(self):
+                self.assertEqual(events, ['setUp',
+                                          'asyncSetUp',
+                                          'test',
+                                          'asyncTearDown',
+                                          'tearDown',
+                                          'cleanup2'])
+                events.append('cleanup1')
+
+            async def on_cleanup2(self):
                 self.assertEqual(events, ['setUp',
                                           'asyncSetUp',
                                           'test',
                                           'asyncTearDown',
                                           'tearDown'])
-                events.append('cleanup')
+                events.append('cleanup2')
 
+        events = []
         test = Test("test_func")
-        test.run()
-        self.assertEqual(events, ['setUp',
-                                  'asyncSetUp',
-                                  'test',
-                                  'asyncTearDown',
-                                  'tearDown',
-                                  'cleanup'])
+        result = test.run()
+        self.assertEqual(result.errors, [])
+        self.assertEqual(result.failures, [])
+        expected = ['setUp', 'asyncSetUp', 'test',
+                    'asyncTearDown', 'tearDown', 'cleanup2', 'cleanup1']
+        self.assertEqual(events, expected)
+
+        events = []
+        test = Test("test_func")
+        test.debug()
+        self.assertEqual(events, expected)
+        test.doCleanups()
+        self.assertEqual(events, expected)
 
     def test_exception_in_setup(self):
-        events = []
-
         class Test(unittest.IsolatedAsyncioTestCase):
             async def asyncSetUp(self):
                 events.append('asyncSetUp')
-                raise Exception()
+                self.addAsyncCleanup(self.on_cleanup)
+                raise MyException()
 
             async def test_func(self):
                 events.append('test')
-                self.addAsyncCleanup(self.on_cleanup)
 
             async def asyncTearDown(self):
                 events.append('asyncTearDown')
@@ -74,35 +99,26 @@
                 events.append('cleanup')
 
 
+        events = []
         test = Test("test_func")
-        test.run()
+        result = test.run()
+        self.assertEqual(events, ['asyncSetUp', 'cleanup'])
+        self.assertIs(result.errors[0][0], test)
+        self.assertIn('MyException', result.errors[0][1])
+
+        events = []
+        test = Test("test_func")
+        try:
+            test.debug()
+        except MyException:
+            pass
+        else:
+            self.fail('Expected a MyException exception')
         self.assertEqual(events, ['asyncSetUp'])
+        test.doCleanups()
+        self.assertEqual(events, ['asyncSetUp', 'cleanup'])
 
     def test_exception_in_test(self):
-        events = []
-
-        class Test(unittest.IsolatedAsyncioTestCase):
-            async def asyncSetUp(self):
-                events.append('asyncSetUp')
-
-            async def test_func(self):
-                events.append('test')
-                raise Exception()
-                self.addAsyncCleanup(self.on_cleanup)
-
-            async def asyncTearDown(self):
-                events.append('asyncTearDown')
-
-            async def on_cleanup(self):
-                events.append('cleanup')
-
-        test = Test("test_func")
-        test.run()
-        self.assertEqual(events, ['asyncSetUp', 'test', 'asyncTearDown'])
-
-    def test_exception_in_test_after_adding_cleanup(self):
-        events = []
-
         class Test(unittest.IsolatedAsyncioTestCase):
             async def asyncSetUp(self):
                 events.append('asyncSetUp')
@@ -110,7 +126,7 @@
             async def test_func(self):
                 events.append('test')
                 self.addAsyncCleanup(self.on_cleanup)
-                raise Exception()
+                raise MyException()
 
             async def asyncTearDown(self):
                 events.append('asyncTearDown')
@@ -118,13 +134,26 @@
             async def on_cleanup(self):
                 events.append('cleanup')
 
+        events = []
         test = Test("test_func")
-        test.run()
+        result = test.run()
         self.assertEqual(events, ['asyncSetUp', 'test', 'asyncTearDown', 'cleanup'])
+        self.assertIs(result.errors[0][0], test)
+        self.assertIn('MyException', result.errors[0][1])
+
+        events = []
+        test = Test("test_func")
+        try:
+            test.debug()
+        except MyException:
+            pass
+        else:
+            self.fail('Expected a MyException exception')
+        self.assertEqual(events, ['asyncSetUp', 'test'])
+        test.doCleanups()
+        self.assertEqual(events, ['asyncSetUp', 'test', 'cleanup'])
 
     def test_exception_in_tear_down(self):
-        events = []
-
         class Test(unittest.IsolatedAsyncioTestCase):
             async def asyncSetUp(self):
                 events.append('asyncSetUp')
@@ -135,37 +164,70 @@
 
             async def asyncTearDown(self):
                 events.append('asyncTearDown')
-                raise Exception()
+                raise MyException()
 
             async def on_cleanup(self):
                 events.append('cleanup')
 
+        events = []
         test = Test("test_func")
-        test.run()
+        result = test.run()
         self.assertEqual(events, ['asyncSetUp', 'test', 'asyncTearDown', 'cleanup'])
+        self.assertIs(result.errors[0][0], test)
+        self.assertIn('MyException', result.errors[0][1])
 
+        events = []
+        test = Test("test_func")
+        try:
+            test.debug()
+        except MyException:
+            pass
+        else:
+            self.fail('Expected a MyException exception')
+        self.assertEqual(events, ['asyncSetUp', 'test', 'asyncTearDown'])
+        test.doCleanups()
+        self.assertEqual(events, ['asyncSetUp', 'test', 'asyncTearDown', 'cleanup'])
 
     def test_exception_in_tear_clean_up(self):
-        events = []
-
         class Test(unittest.IsolatedAsyncioTestCase):
             async def asyncSetUp(self):
                 events.append('asyncSetUp')
 
             async def test_func(self):
                 events.append('test')
-                self.addAsyncCleanup(self.on_cleanup)
+                self.addAsyncCleanup(self.on_cleanup1)
+                self.addAsyncCleanup(self.on_cleanup2)
 
             async def asyncTearDown(self):
                 events.append('asyncTearDown')
 
-            async def on_cleanup(self):
-                events.append('cleanup')
-                raise Exception()
+            async def on_cleanup1(self):
+                events.append('cleanup1')
+                raise MyException('some error')
 
+            async def on_cleanup2(self):
+                events.append('cleanup2')
+                raise MyException('other error')
+
+        events = []
         test = Test("test_func")
-        test.run()
-        self.assertEqual(events, ['asyncSetUp', 'test', 'asyncTearDown', 'cleanup'])
+        result = test.run()
+        self.assertEqual(events, ['asyncSetUp', 'test', 'asyncTearDown', 'cleanup2', 'cleanup1'])
+        self.assertIs(result.errors[0][0], test)
+        self.assertIn('MyException: other error', result.errors[0][1])
+        self.assertIn('MyException: some error', result.errors[1][1])
+
+        events = []
+        test = Test("test_func")
+        try:
+            test.debug()
+        except MyException:
+            pass
+        else:
+            self.fail('Expected a MyException exception')
+        self.assertEqual(events, ['asyncSetUp', 'test', 'asyncTearDown', 'cleanup2'])
+        test.doCleanups()
+        self.assertEqual(events, ['asyncSetUp', 'test', 'asyncTearDown', 'cleanup2', 'cleanup1'])
 
     def test_cleanups_interleave_order(self):
         events = []
@@ -190,6 +252,95 @@
                                   'async_cleanup 2',
                                   'sync_cleanup 1'])
 
+    def test_base_exception_from_async_method(self):
+        events = []
+        class Test(unittest.IsolatedAsyncioTestCase):
+            async def test_base(self):
+                events.append("test_base")
+                raise BaseException()
+                events.append("not it")
+
+            async def test_no_err(self):
+                events.append("test_no_err")
+
+            async def test_cancel(self):
+                raise asyncio.CancelledError()
+
+        test = Test("test_base")
+        output = test.run()
+        self.assertFalse(output.wasSuccessful())
+
+        test = Test("test_no_err")
+        test.run()
+        self.assertEqual(events, ['test_base', 'test_no_err'])
+
+        test = Test("test_cancel")
+        output = test.run()
+        self.assertFalse(output.wasSuccessful())
+
+    def test_cancellation_hanging_tasks(self):
+        cancelled = False
+        class Test(unittest.IsolatedAsyncioTestCase):
+            async def test_leaking_task(self):
+                async def coro():
+                    nonlocal cancelled
+                    try:
+                        await asyncio.sleep(1)
+                    except asyncio.CancelledError:
+                        cancelled = True
+                        raise
+
+                # Leave this running in the background
+                asyncio.create_task(coro())
+
+        test = Test("test_leaking_task")
+        output = test.run()
+        self.assertTrue(cancelled)
+
+    def test_debug_cleanup_same_loop(self):
+        class Test(unittest.IsolatedAsyncioTestCase):
+            async def asyncSetUp(self):
+                async def coro():
+                    await asyncio.sleep(0)
+                fut = asyncio.ensure_future(coro())
+                self.addAsyncCleanup(self.cleanup, fut)
+                events.append('asyncSetUp')
+
+            async def test_func(self):
+                events.append('test')
+                raise MyException()
+
+            async def asyncTearDown(self):
+                events.append('asyncTearDown')
+
+            async def cleanup(self, fut):
+                try:
+                    # Raises an exception if in different loop
+                    await asyncio.wait([fut])
+                    events.append('cleanup')
+                except:
+                    import traceback
+                    traceback.print_exc()
+                    raise
+
+        events = []
+        test = Test("test_func")
+        result = test.run()
+        self.assertEqual(events, ['asyncSetUp', 'test', 'asyncTearDown', 'cleanup'])
+        self.assertIn('MyException', result.errors[0][1])
+
+        events = []
+        test = Test("test_func")
+        try:
+            test.debug()
+        except MyException:
+            pass
+        else:
+            self.fail('Expected a MyException exception')
+        self.assertEqual(events, ['asyncSetUp', 'test'])
+        test.doCleanups()
+        self.assertEqual(events, ['asyncSetUp', 'test', 'cleanup'])
+
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/Lib/unittest/test/test_case.py b/Lib/unittest/test/test_case.py
index f855c4d..9b3a598 100644
--- a/Lib/unittest/test/test_case.py
+++ b/Lib/unittest/test/test_case.py
@@ -8,6 +8,7 @@
 import warnings
 import weakref
 import inspect
+import types
 
 from copy import deepcopy
 from test import support
@@ -18,7 +19,7 @@
     TestEquality, TestHashing, LoggingResult, LegacyLoggingResult,
     ResultWithNoStartTestRunStopTestRun
 )
-from test.support import captured_stderr
+from test.support import captured_stderr, gc_collect
 
 
 log_foo = logging.getLogger('foo')
@@ -610,6 +611,8 @@
                  'Tests shortDescription() for a method with a longer '
                  'docstring.')
 
+    @unittest.skipIf(sys.flags.optimize >= 2,
+                     "Docstrings are omitted with -O2 and above")
     def testShortDescriptionWhitespaceTrimming(self):
         """
             Tests shortDescription() whitespace is trimmed, so that the first
@@ -705,6 +708,10 @@
             with self.assertRaises(self.failureException):
                 self.assertDictContainsSubset({'foo': one}, {'foo': '\uFFFD'})
 
+        with self.assertWarns(DeprecationWarning) as warninfo:
+            self.assertDictContainsSubset({}, {})
+        self.assertEqual(warninfo.warnings[0].filename, __file__)
+
     def testAssertEqual(self):
         equal_pairs = [
                 ((), ()),
@@ -1350,6 +1357,20 @@
             pass
         self.assertRaises(TypeError, self.assertWarnsRegex, MyWarn, lambda: True)
 
+    def testAssertWarnsModifySysModules(self):
+        # bpo-29620: handle modified sys.modules during iteration
+        class Foo(types.ModuleType):
+            @property
+            def __warningregistry__(self):
+                sys.modules['@bar@'] = 'bar'
+
+        sys.modules['@foo@'] = Foo('foo')
+        try:
+            self.assertWarns(UserWarning, warnings.warn, 'expected')
+        finally:
+            del sys.modules['@foo@']
+            del sys.modules['@bar@']
+
     def testAssertRaisesRegexMismatch(self):
         def Stub():
             raise Exception('Unexpected')
@@ -1658,6 +1679,18 @@
                 with self.assertLogs(level='WARNING'):
                     log_foo.info("1")
 
+    def testAssertLogsFailureLevelTooHigh_FilterInRootLogger(self):
+        # Failure due to level too high - message propagated to root
+        with self.assertNoStderr():
+            oldLevel = log_foo.level
+            log_foo.setLevel(logging.INFO)
+            try:
+                with self.assertRaises(self.failureException):
+                    with self.assertLogs(level='WARNING'):
+                        log_foo.info("1")
+            finally:
+                log_foo.setLevel(oldLevel)
+
     def testAssertLogsFailureMismatchingLogger(self):
         # Failure due to mismatching logger (and the logged message is
         # passed through)
@@ -1666,6 +1699,81 @@
                 with self.assertLogs('foo'):
                     log_quux.error("1")
 
+    def testAssertLogsUnexpectedException(self):
+        # Check unexpected exception will go through.
+        with self.assertRaises(ZeroDivisionError):
+            with self.assertLogs():
+                raise ZeroDivisionError("Unexpected")
+
+    def testAssertNoLogsDefault(self):
+        with self.assertRaises(self.failureException) as cm:
+            with self.assertNoLogs():
+                log_foo.info("1")
+                log_foobar.debug("2")
+        self.assertEqual(
+            str(cm.exception),
+            "Unexpected logs found: ['INFO:foo:1']",
+        )
+
+    def testAssertNoLogsFailureFoundLogs(self):
+        with self.assertRaises(self.failureException) as cm:
+            with self.assertNoLogs():
+                log_quux.error("1")
+                log_foo.error("foo")
+
+        self.assertEqual(
+            str(cm.exception),
+            "Unexpected logs found: ['ERROR:quux:1', 'ERROR:foo:foo']",
+        )
+
+    def testAssertNoLogsPerLogger(self):
+        with self.assertNoStderr():
+            with self.assertLogs(log_quux):
+                with self.assertNoLogs(logger=log_foo):
+                    log_quux.error("1")
+
+    def testAssertNoLogsFailurePerLogger(self):
+        # Failure due to unexpected logs for the given logger or its
+        # children.
+        with self.assertRaises(self.failureException) as cm:
+            with self.assertLogs(log_quux):
+                with self.assertNoLogs(logger=log_foo):
+                    log_quux.error("1")
+                    log_foobar.info("2")
+        self.assertEqual(
+            str(cm.exception),
+            "Unexpected logs found: ['INFO:foo.bar:2']",
+        )
+
+    def testAssertNoLogsPerLevel(self):
+        # Check per-level filtering
+        with self.assertNoStderr():
+            with self.assertNoLogs(level="ERROR"):
+                log_foo.info("foo")
+                log_quux.debug("1")
+
+    def testAssertNoLogsFailurePerLevel(self):
+        # Failure due to unexpected logs at the specified level.
+        with self.assertRaises(self.failureException) as cm:
+            with self.assertNoLogs(level="DEBUG"):
+                log_foo.debug("foo")
+                log_quux.debug("1")
+        self.assertEqual(
+            str(cm.exception),
+            "Unexpected logs found: ['DEBUG:foo:foo', 'DEBUG:quux:1']",
+        )
+
+    def testAssertNoLogsUnexpectedException(self):
+        # Check unexpected exception will go through.
+        with self.assertRaises(ZeroDivisionError):
+            with self.assertNoLogs():
+                raise ZeroDivisionError("Unexpected")
+
+    def testAssertNoLogsYieldsNone(self):
+        with self.assertNoLogs() as value:
+            pass
+        self.assertIsNone(value)
+
     def testDeprecatedMethodNames(self):
         """
         Test that the deprecated methods raise a DeprecationWarning. See #9424.
@@ -1845,6 +1953,7 @@
         for method_name in ('test1', 'test2'):
             testcase = TestCase(method_name)
             testcase.run()
+            gc_collect()  # For PyPy or other GCs.
             self.assertEqual(MyException.ninstance, 0)
 
 
diff --git a/Lib/unittest/test/test_discovery.py b/Lib/unittest/test/test_discovery.py
index 16e081e..9d502c5 100644
--- a/Lib/unittest/test/test_discovery.py
+++ b/Lib/unittest/test/test_discovery.py
@@ -5,6 +5,7 @@
 import types
 import pickle
 from test import support
+from test.support import import_helper
 import test.test_importlib.util
 
 import unittest
@@ -848,7 +849,7 @@
 
         with unittest.mock.patch('builtins.__import__', _import):
             # Since loader.discover() can modify sys.path, restore it when done.
-            with support.DirsOnSysPath():
+            with import_helper.DirsOnSysPath():
                 # Make sure to remove 'package' from sys.modules when done.
                 with test.test_importlib.util.uncache('package'):
                     suite = loader.discover('package')
@@ -865,7 +866,7 @@
 
         with unittest.mock.patch('builtins.__import__', _import):
             # Since loader.discover() can modify sys.path, restore it when done.
-            with support.DirsOnSysPath():
+            with import_helper.DirsOnSysPath():
                 # Make sure to remove 'package' from sys.modules when done.
                 with test.test_importlib.util.uncache('package'):
                     with self.assertRaises(TypeError) as cm:
diff --git a/Lib/unittest/test/test_program.py b/Lib/unittest/test/test_program.py
index eef82ff..b7fbbc1 100644
--- a/Lib/unittest/test/test_program.py
+++ b/Lib/unittest/test/test_program.py
@@ -6,6 +6,7 @@
 from test import support
 import unittest
 import unittest.test
+from unittest.test.test_result import BufferedWriter
 
 
 class Test_TestProgram(unittest.TestCase):
@@ -57,9 +58,9 @@
 
     class FooBar(unittest.TestCase):
         def testPass(self):
-            assert True
+            pass
         def testFail(self):
-            assert False
+            raise AssertionError
 
     class FooBarLoader(unittest.TestLoader):
         """Test loader that returns a suite containing FooBar."""
@@ -104,30 +105,39 @@
                           program.testNames)
 
     def test_NonExit(self):
+        stream = BufferedWriter()
         program = unittest.main(exit=False,
                                 argv=["foobar"],
-                                testRunner=unittest.TextTestRunner(stream=io.StringIO()),
+                                testRunner=unittest.TextTestRunner(stream=stream),
                                 testLoader=self.FooBarLoader())
         self.assertTrue(hasattr(program, 'result'))
+        self.assertIn('\nFAIL: testFail ', stream.getvalue())
+        self.assertTrue(stream.getvalue().endswith('\n\nFAILED (failures=1)\n'))
 
 
     def test_Exit(self):
+        stream = BufferedWriter()
         self.assertRaises(
             SystemExit,
             unittest.main,
             argv=["foobar"],
-            testRunner=unittest.TextTestRunner(stream=io.StringIO()),
+            testRunner=unittest.TextTestRunner(stream=stream),
             exit=True,
             testLoader=self.FooBarLoader())
+        self.assertIn('\nFAIL: testFail ', stream.getvalue())
+        self.assertTrue(stream.getvalue().endswith('\n\nFAILED (failures=1)\n'))
 
 
     def test_ExitAsDefault(self):
+        stream = BufferedWriter()
         self.assertRaises(
             SystemExit,
             unittest.main,
             argv=["foobar"],
-            testRunner=unittest.TextTestRunner(stream=io.StringIO()),
+            testRunner=unittest.TextTestRunner(stream=stream),
             testLoader=self.FooBarLoader())
+        self.assertIn('\nFAIL: testFail ', stream.getvalue())
+        self.assertTrue(stream.getvalue().endswith('\n\nFAILED (failures=1)\n'))
 
 
 class InitialisableProgram(unittest.TestProgram):
diff --git a/Lib/unittest/test/test_result.py b/Lib/unittest/test/test_result.py
index 0ffb87b..c5aaba0 100644
--- a/Lib/unittest/test/test_result.py
+++ b/Lib/unittest/test/test_result.py
@@ -2,10 +2,11 @@
 import sys
 import textwrap
 
-from test import support
+from test.support import warnings_helper, captured_stdout, captured_stderr
 
 import traceback
 import unittest
+from unittest.util import strclass
 
 
 class MockTraceback(object):
@@ -22,6 +23,32 @@
     unittest.result.traceback = traceback
 
 
+def bad_cleanup1():
+    print('do cleanup1')
+    raise TypeError('bad cleanup1')
+
+
+def bad_cleanup2():
+    print('do cleanup2')
+    raise ValueError('bad cleanup2')
+
+
+class BufferedWriter:
+    def __init__(self):
+        self.result = ''
+        self.buffer = ''
+
+    def write(self, arg):
+        self.buffer += arg
+
+    def flush(self):
+        self.result += self.buffer
+        self.buffer = ''
+
+    def getvalue(self):
+        return self.result
+
+
 class Test_TestResult(unittest.TestCase):
     # Note: there are not separate tests for TestResult.wasSuccessful(),
     # TestResult.errors, TestResult.failures, TestResult.testsRun or
@@ -193,6 +220,61 @@
         self.assertIs(test_case, test)
         self.assertIsInstance(formatted_exc, str)
 
+    def test_addFailure_filter_traceback_frames(self):
+        class Foo(unittest.TestCase):
+            def test_1(self):
+                pass
+
+        test = Foo('test_1')
+        def get_exc_info():
+            try:
+                test.fail("foo")
+            except:
+                return sys.exc_info()
+
+        exc_info_tuple = get_exc_info()
+
+        full_exc = traceback.format_exception(*exc_info_tuple)
+
+        result = unittest.TestResult()
+        result.startTest(test)
+        result.addFailure(test, exc_info_tuple)
+        result.stopTest(test)
+
+        formatted_exc = result.failures[0][1]
+        dropped = [l for l in full_exc if l not in formatted_exc]
+        self.assertEqual(len(dropped), 1)
+        self.assertIn("raise self.failureException(msg)", dropped[0])
+
+    def test_addFailure_filter_traceback_frames_context(self):
+        class Foo(unittest.TestCase):
+            def test_1(self):
+                pass
+
+        test = Foo('test_1')
+        def get_exc_info():
+            try:
+                try:
+                    test.fail("foo")
+                except:
+                    raise ValueError(42)
+            except:
+                return sys.exc_info()
+
+        exc_info_tuple = get_exc_info()
+
+        full_exc = traceback.format_exception(*exc_info_tuple)
+
+        result = unittest.TestResult()
+        result.startTest(test)
+        result.addFailure(test, exc_info_tuple)
+        result.stopTest(test)
+
+        formatted_exc = result.failures[0][1]
+        dropped = [l for l in full_exc if l not in formatted_exc]
+        self.assertEqual(len(dropped), 1)
+        self.assertIn("raise self.failureException(msg)", dropped[0])
+
     # "addError(test, err)"
     # ...
     # "Called when the test case test raises an unexpected exception err
@@ -433,10 +515,13 @@
         self.assertTrue(result.shouldStop)
 
     def testFailFastSetByRunner(self):
-        runner = unittest.TextTestRunner(stream=io.StringIO(), failfast=True)
+        stream = BufferedWriter()
+        runner = unittest.TextTestRunner(stream=stream, failfast=True)
         def test(result):
             self.assertTrue(result.failfast)
         result = runner.run(test)
+        stream.flush()
+        self.assertTrue(stream.getvalue().endswith('\n\nOK\n'))
 
 
 classDict = dict(unittest.TestResult.__dict__)
@@ -458,8 +543,8 @@
 class Test_OldTestResult(unittest.TestCase):
 
     def assertOldResultWarning(self, test, failures):
-        with support.check_warnings(("TestResult has no add.+ method,",
-                                     RuntimeWarning)):
+        with warnings_helper.check_warnings(
+                ("TestResult has no add.+ method,", RuntimeWarning)):
             result = OldResult()
             test.run(result)
             self.assertEqual(len(result.failures), failures)
@@ -633,36 +718,320 @@
             self.assertEqual(result._original_stderr.getvalue(), expectedErrMessage)
             self.assertMultiLineEqual(message, expectedFullMessage)
 
+    def testBufferSetUp(self):
+        with captured_stdout() as stdout:
+            result = unittest.TestResult()
+        result.buffer = True
+
+        class Foo(unittest.TestCase):
+            def setUp(self):
+                print('set up')
+                1/0
+            def test_foo(self):
+                pass
+        suite = unittest.TestSuite([Foo('test_foo')])
+        suite(result)
+        expected_out = '\nStdout:\nset up\n'
+        self.assertEqual(stdout.getvalue(), expected_out)
+        self.assertEqual(len(result.errors), 1)
+        description = f'test_foo ({strclass(Foo)})'
+        test_case, formatted_exc = result.errors[0]
+        self.assertEqual(str(test_case), description)
+        self.assertIn('ZeroDivisionError: division by zero', formatted_exc)
+        self.assertIn(expected_out, formatted_exc)
+
+    def testBufferTearDown(self):
+        with captured_stdout() as stdout:
+            result = unittest.TestResult()
+        result.buffer = True
+
+        class Foo(unittest.TestCase):
+            def tearDown(self):
+                print('tear down')
+                1/0
+            def test_foo(self):
+                pass
+        suite = unittest.TestSuite([Foo('test_foo')])
+        suite(result)
+        expected_out = '\nStdout:\ntear down\n'
+        self.assertEqual(stdout.getvalue(), expected_out)
+        self.assertEqual(len(result.errors), 1)
+        description = f'test_foo ({strclass(Foo)})'
+        test_case, formatted_exc = result.errors[0]
+        self.assertEqual(str(test_case), description)
+        self.assertIn('ZeroDivisionError: division by zero', formatted_exc)
+        self.assertIn(expected_out, formatted_exc)
+
+    def testBufferDoCleanups(self):
+        with captured_stdout() as stdout:
+            result = unittest.TestResult()
+        result.buffer = True
+
+        class Foo(unittest.TestCase):
+            def setUp(self):
+                print('set up')
+                self.addCleanup(bad_cleanup1)
+                self.addCleanup(bad_cleanup2)
+            def test_foo(self):
+                pass
+        suite = unittest.TestSuite([Foo('test_foo')])
+        suite(result)
+        expected_out = '\nStdout:\nset up\ndo cleanup2\ndo cleanup1\n'
+        self.assertEqual(stdout.getvalue(), expected_out)
+        self.assertEqual(len(result.errors), 2)
+        description = f'test_foo ({strclass(Foo)})'
+        test_case, formatted_exc = result.errors[0]
+        self.assertEqual(str(test_case), description)
+        self.assertIn('ValueError: bad cleanup2', formatted_exc)
+        self.assertNotIn('TypeError', formatted_exc)
+        self.assertIn(expected_out, formatted_exc)
+        test_case, formatted_exc = result.errors[1]
+        self.assertEqual(str(test_case), description)
+        self.assertIn('TypeError: bad cleanup1', formatted_exc)
+        self.assertNotIn('ValueError', formatted_exc)
+        self.assertIn(expected_out, formatted_exc)
+
+    def testBufferSetUp_DoCleanups(self):
+        with captured_stdout() as stdout:
+            result = unittest.TestResult()
+        result.buffer = True
+
+        class Foo(unittest.TestCase):
+            def setUp(self):
+                print('set up')
+                self.addCleanup(bad_cleanup1)
+                self.addCleanup(bad_cleanup2)
+                1/0
+            def test_foo(self):
+                pass
+        suite = unittest.TestSuite([Foo('test_foo')])
+        suite(result)
+        expected_out = '\nStdout:\nset up\ndo cleanup2\ndo cleanup1\n'
+        self.assertEqual(stdout.getvalue(), expected_out)
+        self.assertEqual(len(result.errors), 3)
+        description = f'test_foo ({strclass(Foo)})'
+        test_case, formatted_exc = result.errors[0]
+        self.assertEqual(str(test_case), description)
+        self.assertIn('ZeroDivisionError: division by zero', formatted_exc)
+        self.assertNotIn('ValueError', formatted_exc)
+        self.assertNotIn('TypeError', formatted_exc)
+        self.assertIn(expected_out, formatted_exc)
+        test_case, formatted_exc = result.errors[1]
+        self.assertEqual(str(test_case), description)
+        self.assertIn('ValueError: bad cleanup2', formatted_exc)
+        self.assertNotIn('ZeroDivisionError', formatted_exc)
+        self.assertNotIn('TypeError', formatted_exc)
+        self.assertIn(expected_out, formatted_exc)
+        test_case, formatted_exc = result.errors[2]
+        self.assertEqual(str(test_case), description)
+        self.assertIn('TypeError: bad cleanup1', formatted_exc)
+        self.assertNotIn('ZeroDivisionError', formatted_exc)
+        self.assertNotIn('ValueError', formatted_exc)
+        self.assertIn(expected_out, formatted_exc)
+
+    def testBufferTearDown_DoCleanups(self):
+        with captured_stdout() as stdout:
+            result = unittest.TestResult()
+        result.buffer = True
+
+        class Foo(unittest.TestCase):
+            def setUp(self):
+                print('set up')
+                self.addCleanup(bad_cleanup1)
+                self.addCleanup(bad_cleanup2)
+            def tearDown(self):
+                print('tear down')
+                1/0
+            def test_foo(self):
+                pass
+        suite = unittest.TestSuite([Foo('test_foo')])
+        suite(result)
+        expected_out = '\nStdout:\nset up\ntear down\ndo cleanup2\ndo cleanup1\n'
+        self.assertEqual(stdout.getvalue(), expected_out)
+        self.assertEqual(len(result.errors), 3)
+        description = f'test_foo ({strclass(Foo)})'
+        test_case, formatted_exc = result.errors[0]
+        self.assertEqual(str(test_case), description)
+        self.assertIn('ZeroDivisionError: division by zero', formatted_exc)
+        self.assertNotIn('ValueError', formatted_exc)
+        self.assertNotIn('TypeError', formatted_exc)
+        self.assertIn(expected_out, formatted_exc)
+        test_case, formatted_exc = result.errors[1]
+        self.assertEqual(str(test_case), description)
+        self.assertIn('ValueError: bad cleanup2', formatted_exc)
+        self.assertNotIn('ZeroDivisionError', formatted_exc)
+        self.assertNotIn('TypeError', formatted_exc)
+        self.assertIn(expected_out, formatted_exc)
+        test_case, formatted_exc = result.errors[2]
+        self.assertEqual(str(test_case), description)
+        self.assertIn('TypeError: bad cleanup1', formatted_exc)
+        self.assertNotIn('ZeroDivisionError', formatted_exc)
+        self.assertNotIn('ValueError', formatted_exc)
+        self.assertIn(expected_out, formatted_exc)
+
     def testBufferSetupClass(self):
-        result = unittest.TestResult()
+        with captured_stdout() as stdout:
+            result = unittest.TestResult()
         result.buffer = True
 
         class Foo(unittest.TestCase):
             @classmethod
             def setUpClass(cls):
+                print('set up class')
                 1/0
             def test_foo(self):
                 pass
         suite = unittest.TestSuite([Foo('test_foo')])
         suite(result)
+        expected_out = '\nStdout:\nset up class\n'
+        self.assertEqual(stdout.getvalue(), expected_out)
         self.assertEqual(len(result.errors), 1)
+        description = f'setUpClass ({strclass(Foo)})'
+        test_case, formatted_exc = result.errors[0]
+        self.assertEqual(test_case.description, description)
+        self.assertIn('ZeroDivisionError: division by zero', formatted_exc)
+        self.assertIn(expected_out, formatted_exc)
 
     def testBufferTearDownClass(self):
-        result = unittest.TestResult()
+        with captured_stdout() as stdout:
+            result = unittest.TestResult()
         result.buffer = True
 
         class Foo(unittest.TestCase):
             @classmethod
             def tearDownClass(cls):
+                print('tear down class')
                 1/0
             def test_foo(self):
                 pass
         suite = unittest.TestSuite([Foo('test_foo')])
         suite(result)
+        expected_out = '\nStdout:\ntear down class\n'
+        self.assertEqual(stdout.getvalue(), expected_out)
         self.assertEqual(len(result.errors), 1)
+        description = f'tearDownClass ({strclass(Foo)})'
+        test_case, formatted_exc = result.errors[0]
+        self.assertEqual(test_case.description, description)
+        self.assertIn('ZeroDivisionError: division by zero', formatted_exc)
+        self.assertIn(expected_out, formatted_exc)
+
+    def testBufferDoClassCleanups(self):
+        with captured_stdout() as stdout:
+            result = unittest.TestResult()
+        result.buffer = True
+
+        class Foo(unittest.TestCase):
+            @classmethod
+            def setUpClass(cls):
+                print('set up class')
+                cls.addClassCleanup(bad_cleanup1)
+                cls.addClassCleanup(bad_cleanup2)
+            @classmethod
+            def tearDownClass(cls):
+                print('tear down class')
+            def test_foo(self):
+                pass
+        suite = unittest.TestSuite([Foo('test_foo')])
+        suite(result)
+        expected_out = '\nStdout:\ntear down class\ndo cleanup2\ndo cleanup1\n'
+        self.assertEqual(stdout.getvalue(), expected_out)
+        self.assertEqual(len(result.errors), 2)
+        description = f'tearDownClass ({strclass(Foo)})'
+        test_case, formatted_exc = result.errors[0]
+        self.assertEqual(test_case.description, description)
+        self.assertIn('ValueError: bad cleanup2', formatted_exc)
+        self.assertNotIn('TypeError', formatted_exc)
+        self.assertIn(expected_out, formatted_exc)
+        test_case, formatted_exc = result.errors[1]
+        self.assertEqual(test_case.description, description)
+        self.assertIn('TypeError: bad cleanup1', formatted_exc)
+        self.assertNotIn('ValueError', formatted_exc)
+        self.assertIn(expected_out, formatted_exc)
+
+    def testBufferSetupClass_DoClassCleanups(self):
+        with captured_stdout() as stdout:
+            result = unittest.TestResult()
+        result.buffer = True
+
+        class Foo(unittest.TestCase):
+            @classmethod
+            def setUpClass(cls):
+                print('set up class')
+                cls.addClassCleanup(bad_cleanup1)
+                cls.addClassCleanup(bad_cleanup2)
+                1/0
+            def test_foo(self):
+                pass
+        suite = unittest.TestSuite([Foo('test_foo')])
+        suite(result)
+        expected_out = '\nStdout:\nset up class\ndo cleanup2\ndo cleanup1\n'
+        self.assertEqual(stdout.getvalue(), expected_out)
+        self.assertEqual(len(result.errors), 3)
+        description = f'setUpClass ({strclass(Foo)})'
+        test_case, formatted_exc = result.errors[0]
+        self.assertEqual(test_case.description, description)
+        self.assertIn('ZeroDivisionError: division by zero', formatted_exc)
+        self.assertNotIn('ValueError', formatted_exc)
+        self.assertNotIn('TypeError', formatted_exc)
+        self.assertIn('\nStdout:\nset up class\n', formatted_exc)
+        test_case, formatted_exc = result.errors[1]
+        self.assertEqual(test_case.description, description)
+        self.assertIn('ValueError: bad cleanup2', formatted_exc)
+        self.assertNotIn('ZeroDivisionError', formatted_exc)
+        self.assertNotIn('TypeError', formatted_exc)
+        self.assertIn(expected_out, formatted_exc)
+        test_case, formatted_exc = result.errors[2]
+        self.assertEqual(test_case.description, description)
+        self.assertIn('TypeError: bad cleanup1', formatted_exc)
+        self.assertNotIn('ZeroDivisionError', formatted_exc)
+        self.assertNotIn('ValueError', formatted_exc)
+        self.assertIn(expected_out, formatted_exc)
+
+    def testBufferTearDownClass_DoClassCleanups(self):
+        with captured_stdout() as stdout:
+            result = unittest.TestResult()
+        result.buffer = True
+
+        class Foo(unittest.TestCase):
+            @classmethod
+            def setUpClass(cls):
+                print('set up class')
+                cls.addClassCleanup(bad_cleanup1)
+                cls.addClassCleanup(bad_cleanup2)
+            @classmethod
+            def tearDownClass(cls):
+                print('tear down class')
+                1/0
+            def test_foo(self):
+                pass
+        suite = unittest.TestSuite([Foo('test_foo')])
+        suite(result)
+        expected_out = '\nStdout:\ntear down class\ndo cleanup2\ndo cleanup1\n'
+        self.assertEqual(stdout.getvalue(), expected_out)
+        self.assertEqual(len(result.errors), 3)
+        description = f'tearDownClass ({strclass(Foo)})'
+        test_case, formatted_exc = result.errors[0]
+        self.assertEqual(test_case.description, description)
+        self.assertIn('ZeroDivisionError: division by zero', formatted_exc)
+        self.assertNotIn('ValueError', formatted_exc)
+        self.assertNotIn('TypeError', formatted_exc)
+        self.assertIn('\nStdout:\ntear down class\n', formatted_exc)
+        test_case, formatted_exc = result.errors[1]
+        self.assertEqual(test_case.description, description)
+        self.assertIn('ValueError: bad cleanup2', formatted_exc)
+        self.assertNotIn('ZeroDivisionError', formatted_exc)
+        self.assertNotIn('TypeError', formatted_exc)
+        self.assertIn(expected_out, formatted_exc)
+        test_case, formatted_exc = result.errors[2]
+        self.assertEqual(test_case.description, description)
+        self.assertIn('TypeError: bad cleanup1', formatted_exc)
+        self.assertNotIn('ZeroDivisionError', formatted_exc)
+        self.assertNotIn('ValueError', formatted_exc)
+        self.assertIn(expected_out, formatted_exc)
 
     def testBufferSetUpModule(self):
-        result = unittest.TestResult()
+        with captured_stdout() as stdout:
+            result = unittest.TestResult()
         result.buffer = True
 
         class Foo(unittest.TestCase):
@@ -671,6 +1040,7 @@
         class Module(object):
             @staticmethod
             def setUpModule():
+                print('set up module')
                 1/0
 
         Foo.__module__ = 'Module'
@@ -678,10 +1048,18 @@
         self.addCleanup(sys.modules.pop, 'Module')
         suite = unittest.TestSuite([Foo('test_foo')])
         suite(result)
+        expected_out = '\nStdout:\nset up module\n'
+        self.assertEqual(stdout.getvalue(), expected_out)
         self.assertEqual(len(result.errors), 1)
+        description = 'setUpModule (Module)'
+        test_case, formatted_exc = result.errors[0]
+        self.assertEqual(test_case.description, description)
+        self.assertIn('ZeroDivisionError: division by zero', formatted_exc)
+        self.assertIn(expected_out, formatted_exc)
 
     def testBufferTearDownModule(self):
-        result = unittest.TestResult()
+        with captured_stdout() as stdout:
+            result = unittest.TestResult()
         result.buffer = True
 
         class Foo(unittest.TestCase):
@@ -690,6 +1068,7 @@
         class Module(object):
             @staticmethod
             def tearDownModule():
+                print('tear down module')
                 1/0
 
         Foo.__module__ = 'Module'
@@ -697,7 +1076,124 @@
         self.addCleanup(sys.modules.pop, 'Module')
         suite = unittest.TestSuite([Foo('test_foo')])
         suite(result)
+        expected_out = '\nStdout:\ntear down module\n'
+        self.assertEqual(stdout.getvalue(), expected_out)
         self.assertEqual(len(result.errors), 1)
+        description = 'tearDownModule (Module)'
+        test_case, formatted_exc = result.errors[0]
+        self.assertEqual(test_case.description, description)
+        self.assertIn('ZeroDivisionError: division by zero', formatted_exc)
+        self.assertIn(expected_out, formatted_exc)
+
+    def testBufferDoModuleCleanups(self):
+        with captured_stdout() as stdout:
+            result = unittest.TestResult()
+        result.buffer = True
+
+        class Foo(unittest.TestCase):
+            def test_foo(self):
+                pass
+        class Module(object):
+            @staticmethod
+            def setUpModule():
+                print('set up module')
+                unittest.addModuleCleanup(bad_cleanup1)
+                unittest.addModuleCleanup(bad_cleanup2)
+
+        Foo.__module__ = 'Module'
+        sys.modules['Module'] = Module
+        self.addCleanup(sys.modules.pop, 'Module')
+        suite = unittest.TestSuite([Foo('test_foo')])
+        suite(result)
+        expected_out = '\nStdout:\ndo cleanup2\ndo cleanup1\n'
+        self.assertEqual(stdout.getvalue(), expected_out)
+        self.assertEqual(len(result.errors), 1)
+        description = 'tearDownModule (Module)'
+        test_case, formatted_exc = result.errors[0]
+        self.assertEqual(test_case.description, description)
+        self.assertIn('ValueError: bad cleanup2', formatted_exc)
+        self.assertNotIn('TypeError', formatted_exc)
+        self.assertIn(expected_out, formatted_exc)
+
+    def testBufferSetUpModule_DoModuleCleanups(self):
+        with captured_stdout() as stdout:
+            result = unittest.TestResult()
+        result.buffer = True
+
+        class Foo(unittest.TestCase):
+            def test_foo(self):
+                pass
+        class Module(object):
+            @staticmethod
+            def setUpModule():
+                print('set up module')
+                unittest.addModuleCleanup(bad_cleanup1)
+                unittest.addModuleCleanup(bad_cleanup2)
+                1/0
+
+        Foo.__module__ = 'Module'
+        sys.modules['Module'] = Module
+        self.addCleanup(sys.modules.pop, 'Module')
+        suite = unittest.TestSuite([Foo('test_foo')])
+        suite(result)
+        expected_out = '\nStdout:\nset up module\ndo cleanup2\ndo cleanup1\n'
+        self.assertEqual(stdout.getvalue(), expected_out)
+        self.assertEqual(len(result.errors), 2)
+        description = 'setUpModule (Module)'
+        test_case, formatted_exc = result.errors[0]
+        self.assertEqual(test_case.description, description)
+        self.assertIn('ZeroDivisionError: division by zero', formatted_exc)
+        self.assertNotIn('ValueError', formatted_exc)
+        self.assertNotIn('TypeError', formatted_exc)
+        self.assertIn('\nStdout:\nset up module\n', formatted_exc)
+        test_case, formatted_exc = result.errors[1]
+        self.assertIn(expected_out, formatted_exc)
+        self.assertEqual(test_case.description, description)
+        self.assertIn('ValueError: bad cleanup2', formatted_exc)
+        self.assertNotIn('ZeroDivisionError', formatted_exc)
+        self.assertNotIn('TypeError', formatted_exc)
+        self.assertIn(expected_out, formatted_exc)
+
+    def testBufferTearDownModule_DoModuleCleanups(self):
+        with captured_stdout() as stdout:
+            result = unittest.TestResult()
+        result.buffer = True
+
+        class Foo(unittest.TestCase):
+            def test_foo(self):
+                pass
+        class Module(object):
+            @staticmethod
+            def setUpModule():
+                print('set up module')
+                unittest.addModuleCleanup(bad_cleanup1)
+                unittest.addModuleCleanup(bad_cleanup2)
+            @staticmethod
+            def tearDownModule():
+                print('tear down module')
+                1/0
+
+        Foo.__module__ = 'Module'
+        sys.modules['Module'] = Module
+        self.addCleanup(sys.modules.pop, 'Module')
+        suite = unittest.TestSuite([Foo('test_foo')])
+        suite(result)
+        expected_out = '\nStdout:\ntear down module\ndo cleanup2\ndo cleanup1\n'
+        self.assertEqual(stdout.getvalue(), expected_out)
+        self.assertEqual(len(result.errors), 2)
+        description = 'tearDownModule (Module)'
+        test_case, formatted_exc = result.errors[0]
+        self.assertEqual(test_case.description, description)
+        self.assertIn('ZeroDivisionError: division by zero', formatted_exc)
+        self.assertNotIn('ValueError', formatted_exc)
+        self.assertNotIn('TypeError', formatted_exc)
+        self.assertIn('\nStdout:\ntear down module\n', formatted_exc)
+        test_case, formatted_exc = result.errors[1]
+        self.assertEqual(test_case.description, description)
+        self.assertIn('ValueError: bad cleanup2', formatted_exc)
+        self.assertNotIn('ZeroDivisionError', formatted_exc)
+        self.assertNotIn('TypeError', formatted_exc)
+        self.assertIn(expected_out, formatted_exc)
 
 
 if __name__ == '__main__':
diff --git a/Lib/unittest/test/test_runner.py b/Lib/unittest/test/test_runner.py
index dd9a1b6..453e6c3 100644
--- a/Lib/unittest/test/test_runner.py
+++ b/Lib/unittest/test/test_runner.py
@@ -222,14 +222,42 @@
         self.assertEqual(ordering,
                          ['setUpClass', 'test', 'tearDownClass', 'cleanup_good'])
 
-    def test_debug_executes_classCleanUp(self):
+    def test_run_class_cleanUp_without_tearDownClass(self):
         ordering = []
+        blowUp = True
 
         class TestableTest(unittest.TestCase):
             @classmethod
             def setUpClass(cls):
                 ordering.append('setUpClass')
                 cls.addClassCleanup(cleanup, ordering)
+                if blowUp:
+                    raise Exception()
+            def testNothing(self):
+                ordering.append('test')
+            @classmethod
+            @property
+            def tearDownClass(cls):
+                raise AttributeError
+
+        runTests(TestableTest)
+        self.assertEqual(ordering, ['setUpClass', 'cleanup_good'])
+
+        ordering = []
+        blowUp = False
+        runTests(TestableTest)
+        self.assertEqual(ordering,
+                         ['setUpClass', 'test', 'cleanup_good'])
+
+    def test_debug_executes_classCleanUp(self):
+        ordering = []
+        blowUp = False
+
+        class TestableTest(unittest.TestCase):
+            @classmethod
+            def setUpClass(cls):
+                ordering.append('setUpClass')
+                cls.addClassCleanup(cleanup, ordering, blowUp=blowUp)
             def testNothing(self):
                 ordering.append('test')
             @classmethod
@@ -241,6 +269,48 @@
         self.assertEqual(ordering,
                          ['setUpClass', 'test', 'tearDownClass', 'cleanup_good'])
 
+        ordering = []
+        blowUp = True
+        suite = unittest.defaultTestLoader.loadTestsFromTestCase(TestableTest)
+        with self.assertRaises(Exception) as cm:
+            suite.debug()
+        self.assertEqual(str(cm.exception), 'CleanUpExc')
+        self.assertEqual(ordering,
+                         ['setUpClass', 'test', 'tearDownClass', 'cleanup_exc'])
+
+    def test_debug_executes_classCleanUp_when_teardown_exception(self):
+        ordering = []
+        blowUp = False
+
+        class TestableTest(unittest.TestCase):
+            @classmethod
+            def setUpClass(cls):
+                ordering.append('setUpClass')
+                cls.addClassCleanup(cleanup, ordering, blowUp=blowUp)
+            def testNothing(self):
+                ordering.append('test')
+            @classmethod
+            def tearDownClass(cls):
+                raise Exception('TearDownClassExc')
+
+        suite = unittest.defaultTestLoader.loadTestsFromTestCase(TestableTest)
+        with self.assertRaises(Exception) as cm:
+            suite.debug()
+        self.assertEqual(str(cm.exception), 'TearDownClassExc')
+        self.assertEqual(ordering, ['setUpClass', 'test'])
+        self.assertTrue(TestableTest._class_cleanups)
+        TestableTest._class_cleanups.clear()
+
+        ordering = []
+        blowUp = True
+        suite = unittest.defaultTestLoader.loadTestsFromTestCase(TestableTest)
+        with self.assertRaises(Exception) as cm:
+            suite.debug()
+        self.assertEqual(str(cm.exception), 'TearDownClassExc')
+        self.assertEqual(ordering, ['setUpClass', 'test'])
+        self.assertTrue(TestableTest._class_cleanups)
+        TestableTest._class_cleanups.clear()
+
     def test_doClassCleanups_with_errors_addClassCleanUp(self):
         class TestableTest(unittest.TestCase):
             def testNothing(self):
@@ -332,6 +402,7 @@
         self.assertEqual(ordering,
                          ['setUpClass', 'setUp', 'test',
                           'tearDownClass', 'cleanup_exc'])
+
         ordering = []
         class_blow_up = True
         method_blow_up = False
@@ -355,6 +426,26 @@
                          ['setUpClass', 'setUp', 'tearDownClass',
                           'cleanup_exc'])
 
+    def test_with_errors_in_tearDownClass(self):
+        ordering = []
+        class TestableTest(unittest.TestCase):
+            @classmethod
+            def setUpClass(cls):
+                ordering.append('setUpClass')
+                cls.addClassCleanup(cleanup, ordering)
+            def testNothing(self):
+                ordering.append('test')
+            @classmethod
+            def tearDownClass(cls):
+                ordering.append('tearDownClass')
+                raise Exception('TearDownExc')
+
+        result = runTests(TestableTest)
+        self.assertEqual(result.errors[0][1].splitlines()[-1],
+                         'Exception: TearDownExc')
+        self.assertEqual(ordering,
+                         ['setUpClass', 'test', 'tearDownClass', 'cleanup_good'])
+
 
 class TestModuleCleanUp(unittest.TestCase):
     def test_add_and_do_ModuleCleanup(self):
@@ -532,13 +623,69 @@
                           'tearDownModule2', 'cleanup_good'])
         self.assertEqual(unittest.case._module_cleanups, [])
 
-    def test_debug_module_executes_cleanUp(self):
+    def test_run_module_cleanUp_without_teardown(self):
         ordering = []
         class Module(object):
             @staticmethod
             def setUpModule():
                 ordering.append('setUpModule')
                 unittest.addModuleCleanup(cleanup, ordering)
+
+        class TestableTest(unittest.TestCase):
+            @classmethod
+            def setUpClass(cls):
+                ordering.append('setUpClass')
+            def testNothing(self):
+                ordering.append('test')
+            @classmethod
+            def tearDownClass(cls):
+                ordering.append('tearDownClass')
+
+        TestableTest.__module__ = 'Module'
+        sys.modules['Module'] = Module
+        runTests(TestableTest)
+        self.assertEqual(ordering, ['setUpModule', 'setUpClass', 'test',
+                                    'tearDownClass', 'cleanup_good'])
+        self.assertEqual(unittest.case._module_cleanups, [])
+
+    def test_run_module_cleanUp_when_teardown_exception(self):
+        ordering = []
+        class Module(object):
+            @staticmethod
+            def setUpModule():
+                ordering.append('setUpModule')
+                unittest.addModuleCleanup(cleanup, ordering)
+            @staticmethod
+            def tearDownModule():
+                raise Exception('CleanUpExc')
+
+        class TestableTest(unittest.TestCase):
+            @classmethod
+            def setUpClass(cls):
+                ordering.append('setUpClass')
+            def testNothing(self):
+                ordering.append('test')
+            @classmethod
+            def tearDownClass(cls):
+                ordering.append('tearDownClass')
+
+        TestableTest.__module__ = 'Module'
+        sys.modules['Module'] = Module
+        result = runTests(TestableTest)
+        self.assertEqual(result.errors[0][1].splitlines()[-1],
+                         'Exception: CleanUpExc')
+        self.assertEqual(ordering, ['setUpModule', 'setUpClass', 'test',
+                                    'tearDownClass', 'cleanup_good'])
+        self.assertEqual(unittest.case._module_cleanups, [])
+
+    def test_debug_module_executes_cleanUp(self):
+        ordering = []
+        blowUp = False
+        class Module(object):
+            @staticmethod
+            def setUpModule():
+                ordering.append('setUpModule')
+                unittest.addModuleCleanup(cleanup, ordering, blowUp=blowUp)
             @staticmethod
             def tearDownModule():
                 ordering.append('tearDownModule')
@@ -562,6 +709,60 @@
                           'tearDownModule', 'cleanup_good'])
         self.assertEqual(unittest.case._module_cleanups, [])
 
+        ordering = []
+        blowUp = True
+        suite = unittest.defaultTestLoader.loadTestsFromTestCase(TestableTest)
+        with self.assertRaises(Exception) as cm:
+            suite.debug()
+        self.assertEqual(str(cm.exception), 'CleanUpExc')
+        self.assertEqual(ordering, ['setUpModule', 'setUpClass', 'test',
+                                    'tearDownClass', 'tearDownModule', 'cleanup_exc'])
+        self.assertEqual(unittest.case._module_cleanups, [])
+
+    def test_debug_module_cleanUp_when_teardown_exception(self):
+        ordering = []
+        blowUp = False
+        class Module(object):
+            @staticmethod
+            def setUpModule():
+                ordering.append('setUpModule')
+                unittest.addModuleCleanup(cleanup, ordering, blowUp=blowUp)
+            @staticmethod
+            def tearDownModule():
+                raise Exception('TearDownModuleExc')
+
+        class TestableTest(unittest.TestCase):
+            @classmethod
+            def setUpClass(cls):
+                ordering.append('setUpClass')
+            def testNothing(self):
+                ordering.append('test')
+            @classmethod
+            def tearDownClass(cls):
+                ordering.append('tearDownClass')
+
+        TestableTest.__module__ = 'Module'
+        sys.modules['Module'] = Module
+        suite = unittest.defaultTestLoader.loadTestsFromTestCase(TestableTest)
+        with self.assertRaises(Exception) as cm:
+            suite.debug()
+        self.assertEqual(str(cm.exception), 'TearDownModuleExc')
+        self.assertEqual(ordering, ['setUpModule', 'setUpClass', 'test',
+                                    'tearDownClass'])
+        self.assertTrue(unittest.case._module_cleanups)
+        unittest.case._module_cleanups.clear()
+
+        ordering = []
+        blowUp = True
+        suite = unittest.defaultTestLoader.loadTestsFromTestCase(TestableTest)
+        with self.assertRaises(Exception) as cm:
+            suite.debug()
+        self.assertEqual(str(cm.exception), 'TearDownModuleExc')
+        self.assertEqual(ordering, ['setUpModule', 'setUpClass', 'test',
+                                    'tearDownClass'])
+        self.assertTrue(unittest.case._module_cleanups)
+        unittest.case._module_cleanups.clear()
+
     def test_addClassCleanup_arg_errors(self):
         cleanups = []
         def cleanup(*args, **kwargs):
@@ -717,9 +918,9 @@
         method_blow_up = False
         result = runTests(TestableTest)
         self.assertEqual(result.errors[0][1].splitlines()[-1],
-                         'Exception: CleanUpExc')
-        self.assertEqual(result.errors[1][1].splitlines()[-1],
                          'Exception: ModuleExc')
+        self.assertEqual(result.errors[1][1].splitlines()[-1],
+                         'Exception: CleanUpExc')
         self.assertEqual(ordering, ['setUpModule', 'cleanup_exc'])
 
         ordering = []
diff --git a/Lib/unittest/test/test_skipping.py b/Lib/unittest/test/test_skipping.py
index 1c178a9..7cb9d33 100644
--- a/Lib/unittest/test/test_skipping.py
+++ b/Lib/unittest/test/test_skipping.py
@@ -7,30 +7,50 @@
 
     def test_skipping(self):
         class Foo(unittest.TestCase):
+            def defaultTestResult(self):
+                return LoggingResult(events)
             def test_skip_me(self):
                 self.skipTest("skip")
         events = []
         result = LoggingResult(events)
         test = Foo("test_skip_me")
-        test.run(result)
+        self.assertIs(test.run(result), result)
         self.assertEqual(events, ['startTest', 'addSkip', 'stopTest'])
         self.assertEqual(result.skipped, [(test, "skip")])
 
+        events = []
+        result = test.run()
+        self.assertEqual(events, ['startTestRun', 'startTest', 'addSkip',
+                                  'stopTest', 'stopTestRun'])
+        self.assertEqual(result.skipped, [(test, "skip")])
+        self.assertEqual(result.testsRun, 1)
+
         # Try letting setUp skip the test now.
         class Foo(unittest.TestCase):
+            def defaultTestResult(self):
+                return LoggingResult(events)
             def setUp(self):
                 self.skipTest("testing")
             def test_nothing(self): pass
         events = []
         result = LoggingResult(events)
         test = Foo("test_nothing")
-        test.run(result)
+        self.assertIs(test.run(result), result)
         self.assertEqual(events, ['startTest', 'addSkip', 'stopTest'])
         self.assertEqual(result.skipped, [(test, "testing")])
         self.assertEqual(result.testsRun, 1)
 
+        events = []
+        result = test.run()
+        self.assertEqual(events, ['startTestRun', 'startTest', 'addSkip',
+                                  'stopTest', 'stopTestRun'])
+        self.assertEqual(result.skipped, [(test, "testing")])
+        self.assertEqual(result.testsRun, 1)
+
     def test_skipping_subtests(self):
         class Foo(unittest.TestCase):
+            def defaultTestResult(self):
+                return LoggingResult(events)
             def test_skip_me(self):
                 with self.subTest(a=1):
                     with self.subTest(b=2):
@@ -40,7 +60,7 @@
         events = []
         result = LoggingResult(events)
         test = Foo("test_skip_me")
-        test.run(result)
+        self.assertIs(test.run(result), result)
         self.assertEqual(events, ['startTest', 'addSkip', 'addSkip',
                                   'addSkip', 'stopTest'])
         self.assertEqual(len(result.skipped), 3)
@@ -54,11 +74,22 @@
         self.assertIsNot(subtest, test)
         self.assertEqual(result.skipped[2], (test, "skip 3"))
 
+        events = []
+        result = test.run()
+        self.assertEqual(events,
+                         ['startTestRun', 'startTest', 'addSkip', 'addSkip',
+                          'addSkip', 'stopTest', 'stopTestRun'])
+        self.assertEqual([msg for subtest, msg in result.skipped],
+                         ['skip 1', 'skip 2', 'skip 3'])
+
     def test_skipping_decorators(self):
         op_table = ((unittest.skipUnless, False, True),
                     (unittest.skipIf, True, False))
         for deco, do_skip, dont_skip in op_table:
             class Foo(unittest.TestCase):
+                def defaultTestResult(self):
+                    return LoggingResult(events)
+
                 @deco(do_skip, "testing")
                 def test_skip(self): pass
 
@@ -66,10 +97,11 @@
                 def test_dont_skip(self): pass
             test_do_skip = Foo("test_skip")
             test_dont_skip = Foo("test_dont_skip")
+
             suite = unittest.TestSuite([test_do_skip, test_dont_skip])
             events = []
             result = LoggingResult(events)
-            suite.run(result)
+            self.assertIs(suite.run(result), result)
             self.assertEqual(len(result.skipped), 1)
             expected = ['startTest', 'addSkip', 'stopTest',
                         'startTest', 'addSuccess', 'stopTest']
@@ -78,16 +110,39 @@
             self.assertEqual(result.skipped, [(test_do_skip, "testing")])
             self.assertTrue(result.wasSuccessful())
 
+            events = []
+            result = test_do_skip.run()
+            self.assertEqual(events, ['startTestRun', 'startTest', 'addSkip',
+                                      'stopTest', 'stopTestRun'])
+            self.assertEqual(result.skipped, [(test_do_skip, "testing")])
+
+            events = []
+            result = test_dont_skip.run()
+            self.assertEqual(events, ['startTestRun', 'startTest', 'addSuccess',
+                                      'stopTest', 'stopTestRun'])
+            self.assertEqual(result.skipped, [])
+
     def test_skip_class(self):
         @unittest.skip("testing")
         class Foo(unittest.TestCase):
+            def defaultTestResult(self):
+                return LoggingResult(events)
             def test_1(self):
                 record.append(1)
+        events = []
         record = []
-        result = unittest.TestResult()
+        result = LoggingResult(events)
         test = Foo("test_1")
         suite = unittest.TestSuite([test])
-        suite.run(result)
+        self.assertIs(suite.run(result), result)
+        self.assertEqual(events, ['startTest', 'addSkip', 'stopTest'])
+        self.assertEqual(result.skipped, [(test, "testing")])
+        self.assertEqual(record, [])
+
+        events = []
+        result = test.run()
+        self.assertEqual(events, ['startTestRun', 'startTest', 'addSkip',
+                                  'stopTest', 'stopTestRun'])
         self.assertEqual(result.skipped, [(test, "testing")])
         self.assertEqual(record, [])
 
@@ -102,10 +157,62 @@
         result = unittest.TestResult()
         test = Foo("test_1")
         suite = unittest.TestSuite([test])
-        suite.run(result)
+        self.assertIs(suite.run(result), result)
         self.assertEqual(result.skipped, [(test, "testing")])
         self.assertEqual(record, [])
 
+    def test_skip_in_setup(self):
+        class Foo(unittest.TestCase):
+            def setUp(self):
+                self.skipTest("skip")
+            def test_skip_me(self):
+                self.fail("shouldn't come here")
+        events = []
+        result = LoggingResult(events)
+        test = Foo("test_skip_me")
+        self.assertIs(test.run(result), result)
+        self.assertEqual(events, ['startTest', 'addSkip', 'stopTest'])
+        self.assertEqual(result.skipped, [(test, "skip")])
+
+    def test_skip_in_cleanup(self):
+        class Foo(unittest.TestCase):
+            def test_skip_me(self):
+                pass
+            def tearDown(self):
+                self.skipTest("skip")
+        events = []
+        result = LoggingResult(events)
+        test = Foo("test_skip_me")
+        self.assertIs(test.run(result), result)
+        self.assertEqual(events, ['startTest', 'addSkip', 'stopTest'])
+        self.assertEqual(result.skipped, [(test, "skip")])
+
+    def test_failure_and_skip_in_cleanup(self):
+        class Foo(unittest.TestCase):
+            def test_skip_me(self):
+                self.fail("fail")
+            def tearDown(self):
+                self.skipTest("skip")
+        events = []
+        result = LoggingResult(events)
+        test = Foo("test_skip_me")
+        self.assertIs(test.run(result), result)
+        self.assertEqual(events, ['startTest', 'addSkip', 'addFailure', 'stopTest'])
+        self.assertEqual(result.skipped, [(test, "skip")])
+
+    def test_skipping_and_fail_in_cleanup(self):
+        class Foo(unittest.TestCase):
+            def test_skip_me(self):
+                self.skipTest("skip")
+            def tearDown(self):
+                self.fail("fail")
+        events = []
+        result = LoggingResult(events)
+        test = Foo("test_skip_me")
+        self.assertIs(test.run(result), result)
+        self.assertEqual(events, ['startTest', 'addSkip', 'addFailure', 'stopTest'])
+        self.assertEqual(result.skipped, [(test, "skip")])
+
     def test_expected_failure(self):
         class Foo(unittest.TestCase):
             @unittest.expectedFailure
@@ -114,10 +221,12 @@
         events = []
         result = LoggingResult(events)
         test = Foo("test_die")
-        test.run(result)
+        self.assertIs(test.run(result), result)
         self.assertEqual(events,
                          ['startTest', 'addExpectedFailure', 'stopTest'])
+        self.assertFalse(result.failures)
         self.assertEqual(result.expectedFailures[0][0], test)
+        self.assertFalse(result.unexpectedSuccesses)
         self.assertTrue(result.wasSuccessful())
 
     def test_expected_failure_with_wrapped_class(self):
@@ -129,10 +238,12 @@
         events = []
         result = LoggingResult(events)
         test = Foo("test_1")
-        test.run(result)
+        self.assertIs(test.run(result), result)
         self.assertEqual(events,
                          ['startTest', 'addExpectedFailure', 'stopTest'])
+        self.assertFalse(result.failures)
         self.assertEqual(result.expectedFailures[0][0], test)
+        self.assertFalse(result.unexpectedSuccesses)
         self.assertTrue(result.wasSuccessful())
 
     def test_expected_failure_with_wrapped_subclass(self):
@@ -147,10 +258,12 @@
         events = []
         result = LoggingResult(events)
         test = Bar("test_1")
-        test.run(result)
+        self.assertIs(test.run(result), result)
         self.assertEqual(events,
                          ['startTest', 'addExpectedFailure', 'stopTest'])
+        self.assertFalse(result.failures)
         self.assertEqual(result.expectedFailures[0][0], test)
+        self.assertFalse(result.unexpectedSuccesses)
         self.assertTrue(result.wasSuccessful())
 
     def test_expected_failure_subtests(self):
@@ -170,12 +283,52 @@
         events = []
         result = LoggingResult(events)
         test = Foo("test_die")
-        test.run(result)
+        self.assertIs(test.run(result), result)
         self.assertEqual(events,
                          ['startTest', 'addSubTestSuccess',
                           'addExpectedFailure', 'stopTest'])
+        self.assertFalse(result.failures)
         self.assertEqual(len(result.expectedFailures), 1)
         self.assertIs(result.expectedFailures[0][0], test)
+        self.assertFalse(result.unexpectedSuccesses)
+        self.assertTrue(result.wasSuccessful())
+
+    def test_expected_failure_and_fail_in_cleanup(self):
+        class Foo(unittest.TestCase):
+            @unittest.expectedFailure
+            def test_die(self):
+                self.fail("help me!")
+            def tearDown(self):
+                self.fail("bad tearDown")
+        events = []
+        result = LoggingResult(events)
+        test = Foo("test_die")
+        self.assertIs(test.run(result), result)
+        self.assertEqual(events,
+                         ['startTest', 'addFailure', 'stopTest'])
+        self.assertEqual(len(result.failures), 1)
+        self.assertIn('AssertionError: bad tearDown', result.failures[0][1])
+        self.assertFalse(result.expectedFailures)
+        self.assertFalse(result.unexpectedSuccesses)
+        self.assertFalse(result.wasSuccessful())
+
+    def test_expected_failure_and_skip_in_cleanup(self):
+        class Foo(unittest.TestCase):
+            @unittest.expectedFailure
+            def test_die(self):
+                self.fail("help me!")
+            def tearDown(self):
+                self.skipTest("skip")
+        events = []
+        result = LoggingResult(events)
+        test = Foo("test_die")
+        self.assertIs(test.run(result), result)
+        self.assertEqual(events,
+                         ['startTest', 'addSkip', 'stopTest'])
+        self.assertFalse(result.failures)
+        self.assertFalse(result.expectedFailures)
+        self.assertFalse(result.unexpectedSuccesses)
+        self.assertEqual(result.skipped, [(test, "skip")])
         self.assertTrue(result.wasSuccessful())
 
     def test_unexpected_success(self):
@@ -186,10 +339,11 @@
         events = []
         result = LoggingResult(events)
         test = Foo("test_die")
-        test.run(result)
+        self.assertIs(test.run(result), result)
         self.assertEqual(events,
                          ['startTest', 'addUnexpectedSuccess', 'stopTest'])
         self.assertFalse(result.failures)
+        self.assertFalse(result.expectedFailures)
         self.assertEqual(result.unexpectedSuccesses, [test])
         self.assertFalse(result.wasSuccessful())
 
@@ -208,15 +362,54 @@
         events = []
         result = LoggingResult(events)
         test = Foo("test_die")
-        test.run(result)
+        self.assertIs(test.run(result), result)
         self.assertEqual(events,
                          ['startTest',
                           'addSubTestSuccess', 'addSubTestSuccess',
                           'addUnexpectedSuccess', 'stopTest'])
         self.assertFalse(result.failures)
+        self.assertFalse(result.expectedFailures)
         self.assertEqual(result.unexpectedSuccesses, [test])
         self.assertFalse(result.wasSuccessful())
 
+    def test_unexpected_success_and_fail_in_cleanup(self):
+        class Foo(unittest.TestCase):
+            @unittest.expectedFailure
+            def test_die(self):
+                pass
+            def tearDown(self):
+                self.fail("bad tearDown")
+        events = []
+        result = LoggingResult(events)
+        test = Foo("test_die")
+        self.assertIs(test.run(result), result)
+        self.assertEqual(events,
+                         ['startTest', 'addFailure', 'stopTest'])
+        self.assertEqual(len(result.failures), 1)
+        self.assertIn('AssertionError: bad tearDown', result.failures[0][1])
+        self.assertFalse(result.expectedFailures)
+        self.assertFalse(result.unexpectedSuccesses)
+        self.assertFalse(result.wasSuccessful())
+
+    def test_unexpected_success_and_skip_in_cleanup(self):
+        class Foo(unittest.TestCase):
+            @unittest.expectedFailure
+            def test_die(self):
+                pass
+            def tearDown(self):
+                self.skipTest("skip")
+        events = []
+        result = LoggingResult(events)
+        test = Foo("test_die")
+        self.assertIs(test.run(result), result)
+        self.assertEqual(events,
+                         ['startTest', 'addSkip', 'stopTest'])
+        self.assertFalse(result.failures)
+        self.assertFalse(result.expectedFailures)
+        self.assertFalse(result.unexpectedSuccesses)
+        self.assertEqual(result.skipped, [(test, "skip")])
+        self.assertTrue(result.wasSuccessful())
+
     def test_skip_doesnt_run_setup(self):
         class Foo(unittest.TestCase):
             wasSetUp = False
@@ -232,7 +425,7 @@
         result = unittest.TestResult()
         test = Foo("test_1")
         suite = unittest.TestSuite([test])
-        suite.run(result)
+        self.assertIs(suite.run(result), result)
         self.assertEqual(result.skipped, [(test, "testing")])
         self.assertFalse(Foo.wasSetUp)
         self.assertFalse(Foo.wasTornDown)
@@ -252,7 +445,7 @@
         result = unittest.TestResult()
         test = Foo("test_1")
         suite = unittest.TestSuite([test])
-        suite.run(result)
+        self.assertIs(suite.run(result), result)
         self.assertEqual(result.skipped, [(test, "testing")])
 
     def test_skip_without_reason(self):
@@ -264,8 +457,74 @@
         result = unittest.TestResult()
         test = Foo("test_1")
         suite = unittest.TestSuite([test])
-        suite.run(result)
+        self.assertIs(suite.run(result), result)
         self.assertEqual(result.skipped, [(test, "")])
 
+    def test_debug_skipping(self):
+        class Foo(unittest.TestCase):
+            def setUp(self):
+                events.append("setUp")
+            def tearDown(self):
+                events.append("tearDown")
+            def test1(self):
+                self.skipTest('skipping exception')
+                events.append("test1")
+            @unittest.skip("skipping decorator")
+            def test2(self):
+                events.append("test2")
+
+        events = []
+        test = Foo("test1")
+        with self.assertRaises(unittest.SkipTest) as cm:
+            test.debug()
+        self.assertIn("skipping exception", str(cm.exception))
+        self.assertEqual(events, ["setUp"])
+
+        events = []
+        test = Foo("test2")
+        with self.assertRaises(unittest.SkipTest) as cm:
+            test.debug()
+        self.assertIn("skipping decorator", str(cm.exception))
+        self.assertEqual(events, [])
+
+    def test_debug_skipping_class(self):
+        @unittest.skip("testing")
+        class Foo(unittest.TestCase):
+            def setUp(self):
+                events.append("setUp")
+            def tearDown(self):
+                events.append("tearDown")
+            def test(self):
+                events.append("test")
+
+        events = []
+        test = Foo("test")
+        with self.assertRaises(unittest.SkipTest) as cm:
+            test.debug()
+        self.assertIn("testing", str(cm.exception))
+        self.assertEqual(events, [])
+
+    def test_debug_skipping_subtests(self):
+        class Foo(unittest.TestCase):
+            def setUp(self):
+                events.append("setUp")
+            def tearDown(self):
+                events.append("tearDown")
+            def test(self):
+                with self.subTest(a=1):
+                    events.append('subtest')
+                    self.skipTest("skip subtest")
+                    events.append('end subtest')
+                events.append('end test')
+
+        events = []
+        result = LoggingResult(events)
+        test = Foo("test")
+        with self.assertRaises(unittest.SkipTest) as cm:
+            test.debug()
+        self.assertIn("skip subtest", str(cm.exception))
+        self.assertEqual(events, ['setUp', 'subtest'])
+
+
 if __name__ == "__main__":
     unittest.main()
diff --git a/Lib/unittest/test/testmock/testasync.py b/Lib/unittest/test/testmock/testasync.py
index 690ca4f..e1866a3 100644
--- a/Lib/unittest/test/testmock/testasync.py
+++ b/Lib/unittest/test/testmock/testasync.py
@@ -199,9 +199,9 @@
         with self.assertRaises(RuntimeError):
             create_autospec(async_func, instance=True)
 
+    @unittest.skip('Broken test from https://bugs.python.org/issue37251')
     def test_create_autospec_awaitable_class(self):
-        awaitable_mock = create_autospec(spec=AwaitableClass())
-        self.assertIsInstance(create_autospec(awaitable_mock), AsyncMock)
+        self.assertIsInstance(create_autospec(AwaitableClass), AsyncMock)
 
     def test_create_autospec(self):
         spec = create_autospec(async_func_args)
diff --git a/Lib/unittest/test/testmock/testmock.py b/Lib/unittest/test/testmock/testmock.py
index ce674e7..fdba543 100644
--- a/Lib/unittest/test/testmock/testmock.py
+++ b/Lib/unittest/test/testmock/testmock.py
@@ -11,7 +11,7 @@
     call, DEFAULT, patch, sentinel,
     MagicMock, Mock, NonCallableMock,
     NonCallableMagicMock, AsyncMock, _Call, _CallList,
-    create_autospec
+    create_autospec, InvalidSpecError
 )
 
 
@@ -38,6 +38,12 @@
     def smeth(a, b, c, d=None): pass
 
 
+class Typos():
+    autospect = None
+    auto_spec = None
+    set_spec = None
+
+
 def something(a): pass
 
 
@@ -199,6 +205,28 @@
         self.assertRaisesRegex(ValueError, 'Bazinga!', mock)
 
 
+    def test_autospec_mock(self):
+        class A(object):
+            class B(object):
+                C = None
+
+        with mock.patch.object(A, 'B'):
+            with self.assertRaisesRegex(InvalidSpecError,
+                                        "Cannot autospec attr 'B' from target <MagicMock spec='A'"):
+                create_autospec(A).B
+            with self.assertRaisesRegex(InvalidSpecError,
+                                        "Cannot autospec attr 'B' from target 'A'"):
+                mock.patch.object(A, 'B', autospec=True).start()
+            with self.assertRaisesRegex(InvalidSpecError,
+                                        "Cannot autospec attr 'C' as the patch target "):
+                mock.patch.object(A.B, 'C', autospec=True).start()
+            with self.assertRaisesRegex(InvalidSpecError,
+                                        "Cannot spec attr 'B' as the spec "):
+                mock.patch.object(A, 'B', spec=A.B).start()
+            with self.assertRaisesRegex(InvalidSpecError,
+                                        "Cannot spec attr 'B' as the spec_set "):
+                mock.patch.object(A, 'B', spec_set=A.B).start()
+
     def test_reset_mock(self):
         parent = Mock()
         spec = ["something"]
@@ -1598,14 +1626,23 @@
     #Issue21238
     def test_mock_unsafe(self):
         m = Mock()
-        msg = "Attributes cannot start with 'assert' or 'assret'"
+        msg = "is not a valid assertion. Use a spec for the mock"
         with self.assertRaisesRegex(AttributeError, msg):
             m.assert_foo_call()
         with self.assertRaisesRegex(AttributeError, msg):
             m.assret_foo_call()
+        with self.assertRaisesRegex(AttributeError, msg):
+            m.asert_foo_call()
+        with self.assertRaisesRegex(AttributeError, msg):
+            m.aseert_foo_call()
+        with self.assertRaisesRegex(AttributeError, msg):
+            m.assrt_foo_call()
         m = Mock(unsafe=True)
         m.assert_foo_call()
         m.assret_foo_call()
+        m.asert_foo_call()
+        m.aseert_foo_call()
+        m.assrt_foo_call()
 
     #Issue21262
     def test_assert_not_called(self):
@@ -2156,6 +2193,62 @@
                 obj = mock(spec=Something)
                 self.assertIsInstance(obj, Something)
 
+    def test_bool_not_called_when_passing_spec_arg(self):
+        class Something:
+            def __init__(self):
+                self.obj_with_bool_func = unittest.mock.MagicMock()
+
+        obj = Something()
+        with unittest.mock.patch.object(obj, 'obj_with_bool_func', spec=object): pass
+
+        self.assertEqual(obj.obj_with_bool_func.__bool__.call_count, 0)
+
+    def test_misspelled_arguments(self):
+        class Foo():
+            one = 'one'
+        # patch, patch.object and create_autospec need to check for misspelled
+        # arguments explicitly and throw a RuntimError if found.
+        with self.assertRaises(RuntimeError):
+            with patch(f'{__name__}.Something.meth', autospect=True): pass
+        with self.assertRaises(RuntimeError):
+            with patch.object(Foo, 'one', autospect=True): pass
+        with self.assertRaises(RuntimeError):
+            with patch(f'{__name__}.Something.meth', auto_spec=True): pass
+        with self.assertRaises(RuntimeError):
+            with patch.object(Foo, 'one', auto_spec=True): pass
+        with self.assertRaises(RuntimeError):
+            with patch(f'{__name__}.Something.meth', set_spec=True): pass
+        with self.assertRaises(RuntimeError):
+            with patch.object(Foo, 'one', set_spec=True): pass
+        with self.assertRaises(RuntimeError):
+            m = create_autospec(Foo, set_spec=True)
+        # patch.multiple, on the other hand, should flag misspelled arguments
+        # through an AttributeError, when trying to find the keys from kwargs
+        # as attributes on the target.
+        with self.assertRaises(AttributeError):
+            with patch.multiple(
+                f'{__name__}.Something', meth=DEFAULT, autospect=True): pass
+        with self.assertRaises(AttributeError):
+            with patch.multiple(
+                f'{__name__}.Something', meth=DEFAULT, auto_spec=True): pass
+        with self.assertRaises(AttributeError):
+            with patch.multiple(
+                f'{__name__}.Something', meth=DEFAULT, set_spec=True): pass
+
+        with patch(f'{__name__}.Something.meth', unsafe=True, autospect=True):
+            pass
+        with patch.object(Foo, 'one', unsafe=True, autospect=True): pass
+        with patch(f'{__name__}.Something.meth', unsafe=True, auto_spec=True):
+            pass
+        with patch.object(Foo, 'one', unsafe=True, auto_spec=True): pass
+        with patch(f'{__name__}.Something.meth', unsafe=True, set_spec=True):
+            pass
+        with patch.object(Foo, 'one', unsafe=True, set_spec=True): pass
+        m = create_autospec(Foo, set_spec=True, unsafe=True)
+        with patch.multiple(
+            f'{__name__}.Typos', autospect=True, set_spec=True, auto_spec=True):
+            pass
+
 
 if __name__ == '__main__':
     unittest.main()
diff --git a/Lib/unittest/test/testmock/testpatch.py b/Lib/unittest/test/testmock/testpatch.py
index d8c1515..8ab63a1 100644
--- a/Lib/unittest/test/testmock/testpatch.py
+++ b/Lib/unittest/test/testmock/testpatch.py
@@ -1875,9 +1875,10 @@
             self.assertEqual(foo(), 1)
         self.assertEqual(foo(), 0)
 
+        orig_doc = foo.__doc__
         with patch.object(foo, '__doc__', "FUN"):
             self.assertEqual(foo.__doc__, "FUN")
-        self.assertEqual(foo.__doc__, "TEST")
+        self.assertEqual(foo.__doc__, orig_doc)
 
         with patch.object(foo, '__module__', "testpatch2"):
             self.assertEqual(foo.__module__, "testpatch2")
@@ -1932,8 +1933,13 @@
 
 
     def test_invalid_target(self):
-        with self.assertRaises(TypeError):
-            patch('')
+        class Foo:
+            pass
+
+        for target in ['', 12, Foo()]:
+            with self.subTest(target=target):
+                with self.assertRaises(TypeError):
+                    patch(target)
 
 
     def test_cant_set_kwargs_when_passing_a_mock(self):
diff --git a/Lib/unittest/test/testmock/testsealable.py b/Lib/unittest/test/testmock/testsealable.py
index 59f5233..daba2b4 100644
--- a/Lib/unittest/test/testmock/testsealable.py
+++ b/Lib/unittest/test/testmock/testsealable.py
@@ -128,7 +128,7 @@
             m.attr_sample2
 
     def test_integration_with_spec_method_definition(self):
-        """You need to defin the methods, even if they are in the spec"""
+        """You need to define the methods, even if they are in the spec"""
         m = mock.Mock(SampleObject)
 
         m.method_sample1.return_value = 1
@@ -171,6 +171,67 @@
             m.test1().test2.test3().test4()
         self.assertIn("mock.test1().test2.test3().test4", str(cm.exception))
 
+    def test_seal_with_autospec(self):
+        # https://bugs.python.org/issue45156
+        class Foo:
+            foo = 0
+            def bar1(self):
+                return 1
+            def bar2(self):
+                return 2
+
+            class Baz:
+                baz = 3
+                def ban(self):
+                    return 4
+
+        for spec_set in (True, False):
+            with self.subTest(spec_set=spec_set):
+                foo = mock.create_autospec(Foo, spec_set=spec_set)
+                foo.bar1.return_value = 'a'
+                foo.Baz.ban.return_value = 'b'
+
+                mock.seal(foo)
+
+                self.assertIsInstance(foo.foo, mock.NonCallableMagicMock)
+                self.assertIsInstance(foo.bar1, mock.MagicMock)
+                self.assertIsInstance(foo.bar2, mock.MagicMock)
+                self.assertIsInstance(foo.Baz, mock.MagicMock)
+                self.assertIsInstance(foo.Baz.baz, mock.NonCallableMagicMock)
+                self.assertIsInstance(foo.Baz.ban, mock.MagicMock)
+
+                self.assertEqual(foo.bar1(), 'a')
+                foo.bar1.return_value = 'new_a'
+                self.assertEqual(foo.bar1(), 'new_a')
+                self.assertEqual(foo.Baz.ban(), 'b')
+                foo.Baz.ban.return_value = 'new_b'
+                self.assertEqual(foo.Baz.ban(), 'new_b')
+
+                with self.assertRaises(TypeError):
+                    foo.foo()
+                with self.assertRaises(AttributeError):
+                    foo.bar = 1
+                with self.assertRaises(AttributeError):
+                    foo.bar2()
+
+                foo.bar2.return_value = 'bar2'
+                self.assertEqual(foo.bar2(), 'bar2')
+
+                with self.assertRaises(AttributeError):
+                    foo.missing_attr
+                with self.assertRaises(AttributeError):
+                    foo.missing_attr = 1
+                with self.assertRaises(AttributeError):
+                    foo.missing_method()
+                with self.assertRaises(TypeError):
+                    foo.Baz.baz()
+                with self.assertRaises(AttributeError):
+                    foo.Baz.missing_attr
+                with self.assertRaises(AttributeError):
+                    foo.Baz.missing_attr = 1
+                with self.assertRaises(AttributeError):
+                    foo.Baz.missing_method()
+
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py
index ea897c3..b35997b 100644
--- a/Lib/urllib/parse.py
+++ b/Lib/urllib/parse.py
@@ -78,6 +78,9 @@
                 '0123456789'
                 '+-.')
 
+# Unsafe bytes to be removed per WHATWG spec
+_UNSAFE_URL_BYTES_TO_REMOVE = ['\t', '\r', '\n']
+
 # XXX: Consider replacing with functools.lru_cache
 MAX_CACHE_SIZE = 20
 _parse_cache = {}
@@ -453,6 +456,11 @@
     """
 
     url, scheme, _coerce_result = _coerce_args(url, scheme)
+
+    for b in _UNSAFE_URL_BYTES_TO_REMOVE:
+        url = url.replace(b, "")
+        scheme = scheme.replace(b, "")
+
     allow_fragments = bool(allow_fragments)
     key = url, scheme, allow_fragments, type(url), type(scheme)
     cached = _parse_cache.get(key, None)
@@ -662,7 +670,7 @@
 
 
 def parse_qs(qs, keep_blank_values=False, strict_parsing=False,
-             encoding='utf-8', errors='replace', max_num_fields=None):
+             encoding='utf-8', errors='replace', max_num_fields=None, separator='&'):
     """Parse a query given as a string argument.
 
         Arguments:
@@ -686,12 +694,15 @@
         max_num_fields: int. If set, then throws a ValueError if there
             are more than n fields read by parse_qsl().
 
+        separator: str. The symbol to use for separating the query arguments.
+            Defaults to &.
+
         Returns a dictionary.
     """
     parsed_result = {}
     pairs = parse_qsl(qs, keep_blank_values, strict_parsing,
                       encoding=encoding, errors=errors,
-                      max_num_fields=max_num_fields)
+                      max_num_fields=max_num_fields, separator=separator)
     for name, value in pairs:
         if name in parsed_result:
             parsed_result[name].append(value)
@@ -701,7 +712,7 @@
 
 
 def parse_qsl(qs, keep_blank_values=False, strict_parsing=False,
-              encoding='utf-8', errors='replace', max_num_fields=None):
+              encoding='utf-8', errors='replace', max_num_fields=None, separator='&'):
     """Parse a query given as a string argument.
 
         Arguments:
@@ -724,21 +735,27 @@
         max_num_fields: int. If set, then throws a ValueError
             if there are more than n fields read by parse_qsl().
 
+        separator: str. The symbol to use for separating the query arguments.
+            Defaults to &.
+
         Returns a list, as G-d intended.
     """
     qs, _coerce_result = _coerce_args(qs)
+    separator, _ = _coerce_args(separator)
+
+    if not separator or (not isinstance(separator, (str, bytes))):
+        raise ValueError("Separator must be of type string or bytes.")
 
     # If max_num_fields is defined then check that the number of fields
     # is less than max_num_fields. This prevents a memory exhaustion DOS
     # attack via post bodies with many fields.
     if max_num_fields is not None:
-        num_fields = 1 + qs.count('&') + qs.count(';')
+        num_fields = 1 + qs.count(separator)
         if max_num_fields < num_fields:
             raise ValueError('Max number of fields exceeded')
 
-    pairs = [s2 for s1 in qs.split('&') for s2 in s1.split(';')]
     r = []
-    for name_value in pairs:
+    for name_value in qs.split(separator):
         if not name_value and not strict_parsing:
             continue
         nv = name_value.split('=', 1)
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
index a8c870b..34b1b0b 100644
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -64,7 +64,7 @@
 # install it
 urllib.request.install_opener(opener)
 
-f = urllib.request.urlopen('http://www.python.org/')
+f = urllib.request.urlopen('https://www.python.org/')
 """
 
 # XXX issues:
@@ -202,6 +202,8 @@
         context = ssl.create_default_context(ssl.Purpose.SERVER_AUTH,
                                              cafile=cafile,
                                              capath=capath)
+        # send ALPN extension to indicate HTTP/1.1 protocol
+        context.set_alpn_protocols(['http/1.1'])
         https_handler = HTTPSHandler(context=context)
         opener = build_opener(https_handler)
     elif context:
@@ -771,7 +773,11 @@
             raise ValueError("proxy URL with no authority: %r" % proxy)
         # We have an authority, so for RFC 3986-compliant URLs (by ss 3.
         # and 3.3.), path is empty or starts with '/'
-        end = r_scheme.find("/", 2)
+        if '@' in r_scheme:
+            host_separator = r_scheme.find('@')
+            end = r_scheme.find("/", host_separator)
+        else:
+            end = r_scheme.find("/", 2)
         if end == -1:
             end = None
         authority = r_scheme[2:end]
@@ -883,10 +889,10 @@
             return True
         if base[0] != test[0]:
             return False
-        common = posixpath.commonprefix((base[1], test[1]))
-        if len(common) == len(base[1]):
-            return True
-        return False
+        prefix = base[1]
+        if prefix[-1:] != '/':
+            prefix += '/'
+        return test[1].startswith(prefix)
 
 
 class HTTPPasswordMgrWithDefaultRealm(HTTPPasswordMgr):
@@ -939,7 +945,7 @@
     # (single quotes are a violation of the RFC, but appear in the wild)
     rx = re.compile('(?:^|,)'   # start of the string or ','
                     '[ \t]*'    # optional whitespaces
-                    '([^ \t]+)' # scheme like "Basic"
+                    '([^ \t,]+)' # scheme like "Basic"
                     '[ \t]+'    # mandatory whitespaces
                     # realm=xxx
                     # realm='xxx'
diff --git a/Lib/venv/__init__.py b/Lib/venv/__init__.py
index 8009deb..6f1af29 100644
--- a/Lib/venv/__init__.py
+++ b/Lib/venv/__init__.py
@@ -142,6 +142,20 @@
         context.bin_name = binname
         context.env_exe = os.path.join(binpath, exename)
         create_if_needed(binpath)
+        # Assign and update the command to use when launching the newly created
+        # environment, in case it isn't simply the executable script (e.g. bpo-45337)
+        context.env_exec_cmd = context.env_exe
+        if sys.platform == 'win32':
+            # bpo-45337: Fix up env_exec_cmd to account for file system redirections.
+            # Some redirects only apply to CreateFile and not CreateProcess
+            real_env_exe = os.path.realpath(context.env_exe)
+            if os.path.normcase(real_env_exe) != os.path.normcase(context.env_exe):
+                logger.warning('Actual environment location may have moved due to '
+                               'redirects, links or junctions.\n'
+                               '  Requested location: "%s"\n'
+                               '  Actual location:    "%s"',
+                               context.env_exe, real_env_exe)
+                context.env_exec_cmd = real_env_exe
         return context
 
     def create_configuration(self, context):
@@ -267,8 +281,9 @@
                         os.path.normcase(f).startswith(('python', 'vcruntime'))
                     ]
             else:
-                suffixes = ['python.exe', 'python_d.exe', 'pythonw.exe',
-                            'pythonw_d.exe']
+                suffixes = {'python.exe', 'python_d.exe', 'pythonw.exe', 'pythonw_d.exe'}
+                base_exe = os.path.basename(context.env_exe)
+                suffixes.add(base_exe)
 
             for suffix in suffixes:
                 src = os.path.join(dirname, suffix)
@@ -293,8 +308,8 @@
         # We run ensurepip in isolated mode to avoid side effects from
         # environment vars, the current directory and anything else
         # intended for the global Python environment
-        cmd = [context.env_exe, '-Im', 'ensurepip', '--upgrade',
-                                                    '--default-pip']
+        cmd = [context.env_exec_cmd, '-Im', 'ensurepip', '--upgrade',
+                                                         '--default-pip']
         subprocess.check_output(cmd, stderr=subprocess.STDOUT)
 
     def setup_scripts(self, context):
@@ -394,11 +409,7 @@
         logger.debug(
             f'Upgrading {CORE_VENV_DEPS} packages in {context.bin_path}'
         )
-        if sys.platform == 'win32':
-            python_exe = os.path.join(context.bin_path, 'python.exe')
-        else:
-            python_exe = os.path.join(context.bin_path, 'python')
-        cmd = [python_exe, '-m', 'pip', 'install', '--upgrade']
+        cmd = [context.env_exec_cmd, '-m', 'pip', 'install', '--upgrade']
         cmd.extend(CORE_VENV_DEPS)
         subprocess.check_call(cmd)
 
diff --git a/Lib/venv/scripts/common/Activate.ps1 b/Lib/venv/scripts/common/Activate.ps1
index a3bc6fb..eeea358 100644
--- a/Lib/venv/scripts/common/Activate.ps1
+++ b/Lib/venv/scripts/common/Activate.ps1
@@ -96,6 +96,11 @@
         Remove-Item -Path env:VIRTUAL_ENV
     }
 
+    # Just remove VIRTUAL_ENV_PROMPT altogether.
+    if (Test-Path -Path Env:VIRTUAL_ENV_PROMPT) {
+        Remove-Item -Path env:VIRTUAL_ENV_PROMPT
+    }
+
     # Just remove the _PYTHON_VENV_PROMPT_PREFIX altogether:
     if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) {
         Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force
@@ -197,7 +202,7 @@
         $Prompt = $pyvenvCfg['prompt'];
     }
     else {
-        Write-Verbose "  Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virutal environment)"
+        Write-Verbose "  Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virtual environment)"
         Write-Verbose "  Got leaf-name of $VenvDir='$(Split-Path -Path $venvDir -Leaf)'"
         $Prompt = Split-Path -Path $venvDir -Leaf
     }
@@ -228,6 +233,7 @@
         Write-Host -NoNewline -ForegroundColor Green "($_PYTHON_VENV_PROMPT_PREFIX) "
         _OLD_VIRTUAL_PROMPT
     }
+    $env:VIRTUAL_ENV_PROMPT = $Prompt
 }
 
 # Clear PYTHONHOME
diff --git a/Lib/venv/scripts/common/activate b/Lib/venv/scripts/common/activate
index 45af353..6fbc2b8 100644
--- a/Lib/venv/scripts/common/activate
+++ b/Lib/venv/scripts/common/activate
@@ -28,6 +28,7 @@
     fi
 
     unset VIRTUAL_ENV
+    unset VIRTUAL_ENV_PROMPT
     if [ ! "${1:-}" = "nondestructive" ] ; then
     # Self destruct!
         unset -f deactivate
@@ -56,6 +57,8 @@
     _OLD_VIRTUAL_PS1="${PS1:-}"
     PS1="__VENV_PROMPT__${PS1:-}"
     export PS1
+    VIRTUAL_ENV_PROMPT="__VENV_PROMPT__"
+    export VIRTUAL_ENV_PROMPT
 fi
 
 # This should detect bash and zsh, which have a hash command that must
diff --git a/Lib/venv/scripts/nt/activate.bat b/Lib/venv/scripts/nt/activate.bat
index af4c7e0..c1c3c82 100644
--- a/Lib/venv/scripts/nt/activate.bat
+++ b/Lib/venv/scripts/nt/activate.bat
@@ -25,6 +25,7 @@
 if not defined _OLD_VIRTUAL_PATH set _OLD_VIRTUAL_PATH=%PATH%
 
 set PATH=%VIRTUAL_ENV%\__VENV_BIN_NAME__;%PATH%
+set VIRTUAL_ENV_PROMPT=__VENV_PROMPT__
 
 :END
 if defined _OLD_CODEPAGE (
diff --git a/Lib/venv/scripts/nt/deactivate.bat b/Lib/venv/scripts/nt/deactivate.bat
index 1205c61..62a39a7 100644
--- a/Lib/venv/scripts/nt/deactivate.bat
+++ b/Lib/venv/scripts/nt/deactivate.bat
@@ -17,5 +17,6 @@
 set _OLD_VIRTUAL_PATH=
 
 set VIRTUAL_ENV=
+set VIRTUAL_ENV_PROMPT=
 
 :END
diff --git a/Lib/venv/scripts/posix/activate.csh b/Lib/venv/scripts/posix/activate.csh
index 68a0dc7..d6f697c 100644
--- a/Lib/venv/scripts/posix/activate.csh
+++ b/Lib/venv/scripts/posix/activate.csh
@@ -3,7 +3,7 @@
 # Created by Davide Di Blasi <davidedb@gmail.com>.
 # Ported to Python 3.3 venv by Andrew Svetlov <andrew.svetlov@gmail.com>
 
-alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; test "\!:*" != "nondestructive" && unalias deactivate'
+alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; unsetenv VIRTUAL_ENV_PROMPT; test "\!:*" != "nondestructive" && unalias deactivate'
 
 # Unset irrelevant variables.
 deactivate nondestructive
@@ -18,6 +18,7 @@
 
 if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then
     set prompt = "__VENV_PROMPT__$prompt"
+    setenv VIRTUAL_ENV_PROMPT "__VENV_PROMPT__"
 endif
 
 alias pydoc python -m pydoc
diff --git a/Lib/venv/scripts/posix/activate.fish b/Lib/venv/scripts/posix/activate.fish
index 54b9ea5..e40a1d7 100644
--- a/Lib/venv/scripts/posix/activate.fish
+++ b/Lib/venv/scripts/posix/activate.fish
@@ -20,6 +20,7 @@
     end
 
     set -e VIRTUAL_ENV
+    set -e VIRTUAL_ENV_PROMPT
     if test "$argv[1]" != "nondestructive"
         # Self-destruct!
         functions -e deactivate
@@ -61,4 +62,5 @@
     end
 
     set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
+    set -gx VIRTUAL_ENV_PROMPT "__VENV_PROMPT__"
 end
diff --git a/Lib/weakref.py b/Lib/weakref.py
index 5fa851d..994ea8a 100644
--- a/Lib/weakref.py
+++ b/Lib/weakref.py
@@ -2,7 +2,7 @@
 
 This module is an implementation of PEP 205:
 
-http://www.python.org/dev/peps/pep-0205/
+https://www.python.org/dev/peps/pep-0205/
 """
 
 # Naming convention: Variables named "wr" are weak reference objects;
@@ -119,14 +119,17 @@
         self.data = {}
         self.update(other, **kw)
 
-    def _commit_removals(self):
-        l = self._pending_removals
+    def _commit_removals(self, _atomic_removal=_remove_dead_weakref):
+        pop = self._pending_removals.pop
         d = self.data
         # We shouldn't encounter any KeyError, because this method should
         # always be called *before* mutating the dict.
-        while l:
-            key = l.pop()
-            _remove_dead_weakref(d, key)
+        while True:
+            try:
+                key = pop()
+            except IndexError:
+                return
+            _atomic_removal(d, key)
 
     def __getitem__(self, key):
         if self._pending_removals:
@@ -370,7 +373,10 @@
                 if self._iterating:
                     self._pending_removals.append(k)
                 else:
-                    del self.data[k]
+                    try:
+                        del self.data[k]
+                    except KeyError:
+                        pass
         self._remove = remove
         # A list of dead weakrefs (keys to be removed)
         self._pending_removals = []
@@ -384,11 +390,16 @@
         # because a dead weakref never compares equal to a live weakref,
         # even if they happened to refer to equal objects.
         # However, it means keys may already have been removed.
-        l = self._pending_removals
+        pop = self._pending_removals.pop
         d = self.data
-        while l:
+        while True:
             try:
-                del d[l.pop()]
+                key = pop()
+            except IndexError:
+                return
+
+            try:
+                del d[key]
             except KeyError:
                 pass
 
diff --git a/Lib/webbrowser.py b/Lib/webbrowser.py
index 6023c1e..ec3cece 100755
--- a/Lib/webbrowser.py
+++ b/Lib/webbrowser.py
@@ -1,5 +1,5 @@
 #! /usr/bin/env python3
-"""Interfaces for launching and remotely controlling Web browsers."""
+"""Interfaces for launching and remotely controlling web browsers."""
 # Maintained by Georg Brandl.
 
 import os
@@ -532,6 +532,10 @@
         # OS X can use below Unix support (but we prefer using the OS X
         # specific stuff)
 
+    if sys.platform == "serenityos":
+        # SerenityOS webbrowser, simply called "Browser".
+        register("Browser", None, BackgroundBrowser("Browser"))
+
     if sys.platform[:3] == "win":
         # First try to use the default Windows browser
         register("windows-default", WindowsDefault)
diff --git a/Lib/wsgiref/validate.py b/Lib/wsgiref/validate.py
index 48ac007..6e16578 100644
--- a/Lib/wsgiref/validate.py
+++ b/Lib/wsgiref/validate.py
@@ -137,7 +137,7 @@
 
     """
     When applied between a WSGI server and a WSGI application, this
-    middleware will check for WSGI compliancy on a number of levels.
+    middleware will check for WSGI compliance on a number of levels.
     This middleware does not modify the request or response in any
     way, but will raise an AssertionError if anything seems off
     (except for a failure to close the application iterator, which
diff --git a/Lib/xml/etree/ElementInclude.py b/Lib/xml/etree/ElementInclude.py
index 5303062..40a9b22 100644
--- a/Lib/xml/etree/ElementInclude.py
+++ b/Lib/xml/etree/ElementInclude.py
@@ -42,7 +42,7 @@
 # --------------------------------------------------------------------
 
 # Licensed to PSF under a Contributor Agreement.
-# See http://www.python.org/psf/license for licensing details.
+# See https://www.python.org/psf/license for licensing details.
 
 ##
 # Limited XInclude support for the ElementTree package.
diff --git a/Lib/xml/etree/ElementPath.py b/Lib/xml/etree/ElementPath.py
index d318e65..a1170b5 100644
--- a/Lib/xml/etree/ElementPath.py
+++ b/Lib/xml/etree/ElementPath.py
@@ -48,7 +48,7 @@
 # --------------------------------------------------------------------
 
 # Licensed to PSF under a Contributor Agreement.
-# See http://www.python.org/psf/license for licensing details.
+# See https://www.python.org/psf/license for licensing details.
 
 ##
 # Implementation module for XPath support.  There's usually no reason
@@ -65,8 +65,9 @@
     r"//?|"
     r"\.\.|"
     r"\(\)|"
+    r"!=|"
     r"[/.*:\[\]\(\)@=])|"
-    r"((?:\{[^}]+\})?[^/\[\]\(\)@=\s]+)|"
+    r"((?:\{[^}]+\})?[^/\[\]\(\)@!=\s]+)|"
     r"\s+"
     )
 
@@ -253,15 +254,19 @@
                 if elem.get(key) is not None:
                     yield elem
         return select
-    if signature == "@-='":
-        # [@attribute='value']
+    if signature == "@-='" or signature == "@-!='":
+        # [@attribute='value'] or [@attribute!='value']
         key = predicate[1]
         value = predicate[-1]
         def select(context, result):
             for elem in result:
                 if elem.get(key) == value:
                     yield elem
-        return select
+        def select_negated(context, result):
+            for elem in result:
+                if (attr_value := elem.get(key)) is not None and attr_value != value:
+                    yield elem
+        return select_negated if '!=' in signature else select
     if signature == "-" and not re.match(r"\-?\d+$", predicate[0]):
         # [tag]
         tag = predicate[0]
@@ -270,8 +275,10 @@
                 if elem.find(tag) is not None:
                     yield elem
         return select
-    if signature == ".='" or (signature == "-='" and not re.match(r"\-?\d+$", predicate[0])):
-        # [.='value'] or [tag='value']
+    if signature == ".='" or signature == ".!='" or (
+            (signature == "-='" or signature == "-!='")
+            and not re.match(r"\-?\d+$", predicate[0])):
+        # [.='value'] or [tag='value'] or [.!='value'] or [tag!='value']
         tag = predicate[0]
         value = predicate[-1]
         if tag:
@@ -281,12 +288,22 @@
                         if "".join(e.itertext()) == value:
                             yield elem
                             break
+            def select_negated(context, result):
+                for elem in result:
+                    for e in elem.iterfind(tag):
+                        if "".join(e.itertext()) != value:
+                            yield elem
+                            break
         else:
             def select(context, result):
                 for elem in result:
                     if "".join(elem.itertext()) == value:
                         yield elem
-        return select
+            def select_negated(context, result):
+                for elem in result:
+                    if "".join(elem.itertext()) != value:
+                        yield elem
+        return select_negated if '!=' in signature else select
     if signature == "-" or signature == "-()" or signature == "-()-":
         # [index] or [last()] or [last()-index]
         if signature == "-":
diff --git a/Lib/xml/etree/ElementTree.py b/Lib/xml/etree/ElementTree.py
index 7a26900..07be860 100644
--- a/Lib/xml/etree/ElementTree.py
+++ b/Lib/xml/etree/ElementTree.py
@@ -35,7 +35,7 @@
 
 #---------------------------------------------------------------------
 # Licensed to PSF under a Contributor Agreement.
-# See http://www.python.org/psf/license for licensing details.
+# See https://www.python.org/psf/license for licensing details.
 #
 # ElementTree
 # Copyright (c) 1999-2008 by Fredrik Lundh.  All rights reserved.
@@ -252,7 +252,7 @@
         """
         for element in elements:
             self._assert_is_element(element)
-        self._children.extend(elements)
+            self._children.append(element)
 
     def insert(self, index, subelement):
         """Insert *subelement* at position *index*."""
@@ -1248,8 +1248,14 @@
     # Use the internal, undocumented _parser argument for now; When the
     # parser argument of iterparse is removed, this can be killed.
     pullparser = XMLPullParser(events=events, _parser=parser)
-    def iterator():
+
+    def iterator(source):
+        close_source = False
         try:
+            if not hasattr(source, "read"):
+                source = open(source, "rb")
+                close_source = True
+            yield None
             while True:
                 yield from pullparser.read_events()
                 # load event buffer
@@ -1265,16 +1271,12 @@
                 source.close()
 
     class IterParseIterator(collections.abc.Iterator):
-        __next__ = iterator().__next__
+        __next__ = iterator(source).__next__
     it = IterParseIterator()
     it.root = None
     del iterator, IterParseIterator
 
-    close_source = False
-    if not hasattr(source, "read"):
-        source = open(source, "rb")
-        close_source = True
-
+    next(it)
     return it
 
 
@@ -1283,7 +1285,7 @@
     def __init__(self, events=None, *, _parser=None):
         # The _parser argument is for internal use only and must not be relied
         # upon in user code. It will be removed in a future release.
-        # See http://bugs.python.org/issue17741 for more details.
+        # See https://bugs.python.org/issue17741 for more details.
 
         self._events_queue = collections.deque()
         self._parser = _parser or XMLParser(target=TreeBuilder())
@@ -1560,7 +1562,6 @@
         # Configure pyexpat: buffering, new-style attribute handling.
         parser.buffer_text = 1
         parser.ordered_attributes = 1
-        parser.specified_attributes = 1
         self._doctype = None
         self.entity = {}
         try:
@@ -1580,7 +1581,6 @@
         for event_name in events_to_report:
             if event_name == "start":
                 parser.ordered_attributes = 1
-                parser.specified_attributes = 1
                 def handler(tag, attrib_in, event=event_name, append=append,
                             start=self._start):
                     append((event, start(tag, attrib_in)))
diff --git a/Lib/xml/etree/__init__.py b/Lib/xml/etree/__init__.py
index 27fd8f6..e2ec534 100644
--- a/Lib/xml/etree/__init__.py
+++ b/Lib/xml/etree/__init__.py
@@ -30,4 +30,4 @@
 # --------------------------------------------------------------------
 
 # Licensed to PSF under a Contributor Agreement.
-# See http://www.python.org/psf/license for licensing details.
+# See https://www.python.org/psf/license for licensing details.
diff --git a/Lib/xml/sax/handler.py b/Lib/xml/sax/handler.py
index 481733d..e8d417e 100644
--- a/Lib/xml/sax/handler.py
+++ b/Lib/xml/sax/handler.py
@@ -340,3 +340,48 @@
                   property_xml_string,
                   property_encoding,
                   property_interning_dict]
+
+
+class LexicalHandler:
+    """Optional SAX2 handler for lexical events.
+
+    This handler is used to obtain lexical information about an XML
+    document, that is, information about how the document was encoded
+    (as opposed to what it contains, which is reported to the
+    ContentHandler), such as comments and CDATA marked section
+    boundaries.
+
+    To set the LexicalHandler of an XMLReader, use the setProperty
+    method with the property identifier
+    'http://xml.org/sax/properties/lexical-handler'."""
+
+    def comment(self, content):
+        """Reports a comment anywhere in the document (including the
+        DTD and outside the document element).
+
+        content is a string that holds the contents of the comment."""
+
+    def startDTD(self, name, public_id, system_id):
+        """Report the start of the DTD declarations, if the document
+        has an associated DTD.
+
+        A startEntity event will be reported before declaration events
+        from the external DTD subset are reported, and this can be
+        used to infer from which subset DTD declarations derive.
+
+        name is the name of the document element type, public_id the
+        public identifier of the DTD (or None if none were supplied)
+        and system_id the system identfier of the external subset (or
+        None if none were supplied)."""
+
+    def endDTD(self):
+        """Signals the end of DTD declarations."""
+
+    def startCDATA(self):
+        """Reports the beginning of a CDATA marked section.
+
+        The contents of the CDATA marked section will be reported
+        through the characters event."""
+
+    def endCDATA(self):
+        """Reports the end of a CDATA marked section."""
diff --git a/Lib/xmlrpc/client.py b/Lib/xmlrpc/client.py
index d15d60d..a614cef 100644
--- a/Lib/xmlrpc/client.py
+++ b/Lib/xmlrpc/client.py
@@ -264,16 +264,22 @@
 
 # Issue #13305: different format codes across platforms
 _day0 = datetime(1, 1, 1)
-if _day0.strftime('%Y') == '0001':      # Mac OS X
+def _try(fmt):
+    try:
+        return _day0.strftime(fmt) == '0001'
+    except ValueError:
+        return False
+if _try('%Y'):      # Mac OS X
     def _iso8601_format(value):
         return value.strftime("%Y%m%dT%H:%M:%S")
-elif _day0.strftime('%4Y') == '0001':   # Linux
+elif _try('%4Y'):   # Linux
     def _iso8601_format(value):
         return value.strftime("%4Y%m%dT%H:%M:%S")
 else:
     def _iso8601_format(value):
         return value.strftime("%Y%m%dT%H:%M:%S").zfill(17)
 del _day0
+del _try
 
 
 def _strftime(value):
@@ -1421,11 +1427,13 @@
         # establish a "logical" server connection
 
         # get the url
-        p = urllib.parse.urlparse(uri)
+        p = urllib.parse.urlsplit(uri)
         if p.scheme not in ("http", "https"):
             raise OSError("unsupported XML-RPC protocol")
         self.__host = p.netloc
-        self.__handler = p.path or "/RPC2"
+        self.__handler = urllib.parse.urlunsplit(["", "", *p[2:]])
+        if not self.__handler:
+            self.__handler = "/RPC2"
 
         if transport is None:
             if p.scheme == "https":
diff --git a/Lib/xmlrpc/server.py b/Lib/xmlrpc/server.py
index 287e324..69a260f 100644
--- a/Lib/xmlrpc/server.py
+++ b/Lib/xmlrpc/server.py
@@ -750,7 +750,7 @@
                 url = 'http://www.rfc-editor.org/rfc/rfc%d.txt' % int(rfc)
                 results.append('<a href="%s">%s</a>' % (url, escape(all)))
             elif pep:
-                url = 'http://www.python.org/dev/peps/pep-%04d/' % int(pep)
+                url = 'https://www.python.org/dev/peps/pep-%04d/' % int(pep)
                 results.append('<a href="%s">%s</a>' % (url, escape(all)))
             elif text[end:end+1] == '(':
                 results.append(self.namelink(name, methods, funcs, classes))
diff --git a/Lib/zipfile.py b/Lib/zipfile.py
index 816f858..67cfdfb 100644
--- a/Lib/zipfile.py
+++ b/Lib/zipfile.py
@@ -16,6 +16,7 @@
 import threading
 import time
 import contextlib
+import pathlib
 
 try:
     import zlib # We may need its compression method
@@ -1120,8 +1121,15 @@
     def write(self, data):
         if self.closed:
             raise ValueError('I/O operation on closed file.')
-        nbytes = len(data)
+
+        # Accept any data that supports the buffer protocol
+        if isinstance(data, (bytes, bytearray)):
+            nbytes = len(data)
+        else:
+            data = memoryview(data)
+            nbytes = data.nbytes
         self._file_size += nbytes
+
         self._crc = crc32(data, self._crc)
         if self._compressor:
             data = self._compressor.compress(data)
@@ -2197,13 +2205,12 @@
         if not isinstance(source, ZipFile):
             return cls(source)
 
-        # Only allow for FastPath when supplied zipfile is read-only
+        # Only allow for FastLookup when supplied zipfile is read-only
         if 'r' not in source.mode:
             cls = CompleteDirs
 
-        res = cls.__new__(cls)
-        vars(res).update(vars(source))
-        return res
+        source.__class__ = cls
+        return source
 
 
 class FastLookup(CompleteDirs):
@@ -2211,6 +2218,7 @@
     ZipFile subclass to ensure implicit
     dirs exist and are resolved rapidly.
     """
+
     def namelist(self):
         with contextlib.suppress(AttributeError):
             return self.__names
@@ -2242,7 +2250,7 @@
     >>> zf.writestr('a.txt', 'content of a')
     >>> zf.writestr('b/c.txt', 'content of c')
     >>> zf.writestr('b/d/e.txt', 'content of e')
-    >>> zf.filename = 'abcde.zip'
+    >>> zf.filename = 'mem/abcde.zip'
 
     Path accepts the zipfile object itself or a filename
 
@@ -2254,9 +2262,9 @@
 
     >>> a, b = root.iterdir()
     >>> a
-    Path('abcde.zip', 'a.txt')
+    Path('mem/abcde.zip', 'a.txt')
     >>> b
-    Path('abcde.zip', 'b/')
+    Path('mem/abcde.zip', 'b/')
 
     name property:
 
@@ -2267,7 +2275,7 @@
 
     >>> c = b / 'c.txt'
     >>> c
-    Path('abcde.zip', 'b/c.txt')
+    Path('mem/abcde.zip', 'b/c.txt')
     >>> c.name
     'c.txt'
 
@@ -2285,36 +2293,68 @@
 
     Coercion to string:
 
-    >>> str(c)
-    'abcde.zip/b/c.txt'
+    >>> import os
+    >>> str(c).replace(os.sep, posixpath.sep)
+    'mem/abcde.zip/b/c.txt'
+
+    At the root, ``name``, ``filename``, and ``parent``
+    resolve to the zipfile. Note these attributes are not
+    valid and will raise a ``ValueError`` if the zipfile
+    has no filename.
+
+    >>> root.name
+    'abcde.zip'
+    >>> str(root.filename).replace(os.sep, posixpath.sep)
+    'mem/abcde.zip'
+    >>> str(root.parent)
+    'mem'
     """
 
     __repr = "{self.__class__.__name__}({self.root.filename!r}, {self.at!r})"
 
     def __init__(self, root, at=""):
+        """
+        Construct a Path from a ZipFile or filename.
+
+        Note: When the source is an existing ZipFile object,
+        its type (__class__) will be mutated to a
+        specialized type. If the caller wishes to retain the
+        original type, the caller should either create a
+        separate ZipFile object or pass a filename.
+        """
         self.root = FastLookup.make(root)
         self.at = at
 
-    def open(self, mode='r', *args, **kwargs):
+    def open(self, mode='r', *args, pwd=None, **kwargs):
         """
         Open this entry as text or binary following the semantics
         of ``pathlib.Path.open()`` by passing arguments through
         to io.TextIOWrapper().
         """
-        pwd = kwargs.pop('pwd', None)
+        if self.is_dir():
+            raise IsADirectoryError(self)
         zip_mode = mode[0]
+        if not self.exists() and zip_mode == 'r':
+            raise FileNotFoundError(self)
         stream = self.root.open(self.at, zip_mode, pwd=pwd)
         if 'b' in mode:
             if args or kwargs:
                 raise ValueError("encoding args invalid for binary operation")
             return stream
+        else:
+            kwargs["encoding"] = io.text_encoding(kwargs.get("encoding"))
         return io.TextIOWrapper(stream, *args, **kwargs)
 
     @property
     def name(self):
-        return posixpath.basename(self.at.rstrip("/"))
+        return pathlib.Path(self.at).name or self.filename.name
+
+    @property
+    def filename(self):
+        return pathlib.Path(self.root.filename).joinpath(self.at)
 
     def read_text(self, *args, **kwargs):
+        kwargs["encoding"] = io.text_encoding(kwargs.get("encoding"))
         with self.open('r', *args, **kwargs) as strm:
             return strm.read()
 
@@ -2326,13 +2366,13 @@
         return posixpath.dirname(path.at.rstrip("/")) == self.at.rstrip("/")
 
     def _next(self, at):
-        return Path(self.root, at)
+        return self.__class__(self.root, at)
 
     def is_dir(self):
         return not self.at or self.at.endswith("/")
 
     def is_file(self):
-        return not self.is_dir()
+        return self.exists() and not self.is_dir()
 
     def exists(self):
         return self.at in self.root._name_set()
@@ -2349,14 +2389,16 @@
     def __repr__(self):
         return self.__repr.format(self=self)
 
-    def joinpath(self, add):
-        next = posixpath.join(self.at, add)
+    def joinpath(self, *other):
+        next = posixpath.join(self.at, *other)
         return self._next(self.root.resolve_dir(next))
 
     __truediv__ = joinpath
 
     @property
     def parent(self):
+        if not self.at:
+            return self.filename.parent
         parent_at = posixpath.dirname(self.at.rstrip('/'))
         if parent_at:
             parent_at += '/'
diff --git a/Lib/zipimport.py b/Lib/zipimport.py
index 5ef0a17..25eaee9 100644
--- a/Lib/zipimport.py
+++ b/Lib/zipimport.py
@@ -22,6 +22,7 @@
 import marshal  # for loads
 import sys  # for modules
 import time  # for mktime
+import _warnings  # For warn()
 
 __all__ = ['ZipImportError', 'zipimporter']
 
@@ -42,7 +43,7 @@
 STRING_END_ARCHIVE = b'PK\x05\x06'
 MAX_COMMENT_LEN = (1 << 16) - 1
 
-class zipimporter:
+class zipimporter(_bootstrap_external._LoaderBasics):
     """zipimporter(archivepath) -> zipimporter object
 
     Create a new zipimporter instance. 'archivepath' must be a path to
@@ -115,7 +116,12 @@
         full path name if it's possibly a portion of a namespace package,
         or None otherwise. The optional 'path' argument is ignored -- it's
         there for compatibility with the importer protocol.
+
+        Deprecated since Python 3.10. Use find_spec() instead.
         """
+        _warnings.warn("zipimporter.find_loader() is deprecated and slated for "
+                       "removal in Python 3.12; use find_spec() instead",
+                       DeprecationWarning)
         mi = _get_module_info(self, fullname)
         if mi is not None:
             # This is a module or package.
@@ -146,15 +152,46 @@
         instance itself if the module was found, or None if it wasn't.
         The optional 'path' argument is ignored -- it's there for compatibility
         with the importer protocol.
+
+        Deprecated since Python 3.10. Use find_spec() instead.
         """
+        _warnings.warn("zipimporter.find_module() is deprecated and slated for "
+                       "removal in Python 3.12; use find_spec() instead",
+                       DeprecationWarning)
         return self.find_loader(fullname, path)[0]
 
+    def find_spec(self, fullname, target=None):
+        """Create a ModuleSpec for the specified module.
+
+        Returns None if the module cannot be found.
+        """
+        module_info = _get_module_info(self, fullname)
+        if module_info is not None:
+            return _bootstrap.spec_from_loader(fullname, self, is_package=module_info)
+        else:
+            # Not a module or regular package. See if this is a directory, and
+            # therefore possibly a portion of a namespace package.
+
+            # We're only interested in the last path component of fullname
+            # earlier components are recorded in self.prefix.
+            modpath = _get_module_path(self, fullname)
+            if _is_dir(self, modpath):
+                # This is possibly a portion of a namespace
+                # package. Return the string representing its path,
+                # without a trailing separator.
+                path = f'{self.archive}{path_sep}{modpath}'
+                spec = _bootstrap.ModuleSpec(name=fullname, loader=None,
+                                             is_package=True)
+                spec.submodule_search_locations.append(path)
+                return spec
+            else:
+                return None
 
     def get_code(self, fullname):
         """get_code(fullname) -> code object.
 
         Return the code object for the specified module. Raise ZipImportError
-        if the module couldn't be found.
+        if the module couldn't be imported.
         """
         code, ispackage, modpath = _get_module_code(self, fullname)
         return code
@@ -184,7 +221,8 @@
     def get_filename(self, fullname):
         """get_filename(fullname) -> filename string.
 
-        Return the filename for the specified module.
+        Return the filename for the specified module or raise ZipImportError
+        if it couldn't be imported.
         """
         # Deciding the filename requires working out where the code
         # would come from if the module was actually loaded
@@ -236,8 +274,13 @@
 
         Load the module specified by 'fullname'. 'fullname' must be the
         fully qualified (dotted) module name. It returns the imported
-        module, or raises ZipImportError if it wasn't found.
+        module, or raises ZipImportError if it could not be imported.
+
+        Deprecated since Python 3.10. Use exec_module() instead.
         """
+        msg = ("zipimport.zipimporter.load_module() is deprecated and slated for "
+               "removal in Python 3.12; use exec_module() instead")
+        _warnings.warn(msg, DeprecationWarning)
         code, ispackage, modpath = _get_module_code(self, fullname)
         mod = sys.modules.get(fullname)
         if mod is None or not isinstance(mod, _module_type):
@@ -280,11 +323,18 @@
                 return None
         except ZipImportError:
             return None
-        if not _ZipImportResourceReader._registered:
-            from importlib.abc import ResourceReader
-            ResourceReader.register(_ZipImportResourceReader)
-            _ZipImportResourceReader._registered = True
-        return _ZipImportResourceReader(self, fullname)
+        from importlib.readers import ZipReader
+        return ZipReader(self, fullname)
+
+
+    def invalidate_caches(self):
+        """Reload the file data of the archive path."""
+        try:
+            self._files = _read_directory(self.archive)
+            _zip_directory_cache[self.archive] = self._files
+        except ZipImportError:
+            _zip_directory_cache.pop(self.archive, None)
+            self._files = {}
 
 
     def __repr__(self):
@@ -580,20 +630,15 @@
 
 
 # Given the contents of a .py[co] file, unmarshal the data
-# and return the code object. Return None if it the magic word doesn't
-# match, or if the recorded .py[co] metadata does not match the source,
-# (we do this instead of raising an exception as we fall back
-# to .py if available and we don't want to mask other errors).
+# and return the code object. Raises ImportError it the magic word doesn't
+# match, or if the recorded .py[co] metadata does not match the source.
 def _unmarshal_code(self, pathname, fullpath, fullname, data):
     exc_details = {
         'name': fullname,
         'path': fullpath,
     }
 
-    try:
-        flags = _bootstrap_external._classify_pyc(data, fullname, exc_details)
-    except ImportError:
-        return None
+    flags = _bootstrap_external._classify_pyc(data, fullname, exc_details)
 
     hash_based = flags & 0b1 != 0
     if hash_based:
@@ -607,11 +652,8 @@
                     source_bytes,
                 )
 
-                try:
-                    _bootstrap_external._validate_hash_pyc(
-                        data, source_hash, fullname, exc_details)
-                except ImportError:
-                    return None
+                _bootstrap_external._validate_hash_pyc(
+                    data, source_hash, fullname, exc_details)
     else:
         source_mtime, source_size = \
             _get_mtime_and_size_of_source(self, fullpath)
@@ -697,6 +739,7 @@
 # 'fullname'.
 def _get_module_code(self, fullname):
     path = _get_module_path(self, fullname)
+    import_error = None
     for suffix, isbytecode, ispackage in _zip_searchorder:
         fullpath = path + suffix
         _bootstrap._verbose_message('trying {}{}{}', self.archive, path_sep, fullpath, verbosity=2)
@@ -707,8 +750,12 @@
         else:
             modpath = toc_entry[0]
             data = _get_data(self.archive, toc_entry)
+            code = None
             if isbytecode:
-                code = _unmarshal_code(self, modpath, fullpath, fullname, data)
+                try:
+                    code = _unmarshal_code(self, modpath, fullpath, fullname, data)
+                except ImportError as exc:
+                    import_error = exc
             else:
                 code = _compile_source(modpath, data)
             if code is None:
@@ -718,75 +765,8 @@
             modpath = toc_entry[0]
             return code, ispackage, modpath
     else:
-        raise ZipImportError(f"can't find module {fullname!r}", name=fullname)
-
-
-class _ZipImportResourceReader:
-    """Private class used to support ZipImport.get_resource_reader().
-
-    This class is allowed to reference all the innards and private parts of
-    the zipimporter.
-    """
-    _registered = False
-
-    def __init__(self, zipimporter, fullname):
-        self.zipimporter = zipimporter
-        self.fullname = fullname
-
-    def open_resource(self, resource):
-        fullname_as_path = self.fullname.replace('.', '/')
-        path = f'{fullname_as_path}/{resource}'
-        from io import BytesIO
-        try:
-            return BytesIO(self.zipimporter.get_data(path))
-        except OSError:
-            raise FileNotFoundError(path)
-
-    def resource_path(self, resource):
-        # All resources are in the zip file, so there is no path to the file.
-        # Raising FileNotFoundError tells the higher level API to extract the
-        # binary data and create a temporary file.
-        raise FileNotFoundError
-
-    def is_resource(self, name):
-        # Maybe we could do better, but if we can get the data, it's a
-        # resource.  Otherwise it isn't.
-        fullname_as_path = self.fullname.replace('.', '/')
-        path = f'{fullname_as_path}/{name}'
-        try:
-            self.zipimporter.get_data(path)
-        except OSError:
-            return False
-        return True
-
-    def contents(self):
-        # This is a bit convoluted, because fullname will be a module path,
-        # but _files is a list of file names relative to the top of the
-        # archive's namespace.  We want to compare file paths to find all the
-        # names of things inside the module represented by fullname.  So we
-        # turn the module path of fullname into a file path relative to the
-        # top of the archive, and then we iterate through _files looking for
-        # names inside that "directory".
-        from pathlib import Path
-        fullname_path = Path(self.zipimporter.get_filename(self.fullname))
-        relative_path = fullname_path.relative_to(self.zipimporter.archive)
-        # Don't forget that fullname names a package, so its path will include
-        # __init__.py, which we want to ignore.
-        assert relative_path.name == '__init__.py'
-        package_path = relative_path.parent
-        subdirs_seen = set()
-        for filename in self.zipimporter._files:
-            try:
-                relative = Path(filename).relative_to(package_path)
-            except ValueError:
-                continue
-            # If the path of the file (which is relative to the top of the zip
-            # namespace), relative to the package given when the resource
-            # reader was created, has a parent, then it's a name in a
-            # subdirectory and thus we skip it.
-            parent_name = relative.parent.name
-            if len(parent_name) == 0:
-                yield relative.name
-            elif parent_name not in subdirs_seen:
-                subdirs_seen.add(parent_name)
-                yield parent_name
+        if import_error:
+            msg = f"module load failed: {import_error}"
+            raise ZipImportError(msg, name=fullname) from import_error
+        else:
+            raise ZipImportError(f"can't find module {fullname!r}", name=fullname)
diff --git a/Lib/zoneinfo/_common.py b/Lib/zoneinfo/_common.py
index 41c898f..4c24f01 100644
--- a/Lib/zoneinfo/_common.py
+++ b/Lib/zoneinfo/_common.py
@@ -136,8 +136,7 @@
     ]
 
     def __init__(self, *args):
-        assert len(self.__slots__) == len(args)
-        for attr, val in zip(self.__slots__, args):
+        for attr, val in zip(self.__slots__, args, strict=True):
             setattr(self, attr, val)
 
     @classmethod
diff --git a/Lib/zoneinfo/_tzpath.py b/Lib/zoneinfo/_tzpath.py
index 9513611..672560b 100644
--- a/Lib/zoneinfo/_tzpath.py
+++ b/Lib/zoneinfo/_tzpath.py
@@ -42,7 +42,7 @@
         msg = _get_invalid_paths_message(raw_tzpath)
 
         warnings.warn(
-            "Invalid paths specified in PYTHONTZPATH environment variable."
+            "Invalid paths specified in PYTHONTZPATH environment variable. "
             + msg,
             InvalidTZPathWarning,
         )
diff --git a/Lib/zoneinfo/_zoneinfo.py b/Lib/zoneinfo/_zoneinfo.py
index 9810637..de68380 100644
--- a/Lib/zoneinfo/_zoneinfo.py
+++ b/Lib/zoneinfo/_zoneinfo.py
@@ -338,7 +338,7 @@
                 comp_idx = trans_idx[i + 1]
 
                 # If the following transition is also DST and we couldn't
-                # find the DST offset by this point, we're going ot have to
+                # find the DST offset by this point, we're going to have to
                 # skip it and hope this transition gets assigned later
                 if isdsts[comp_idx]:
                     continue
diff --git a/METADATA b/METADATA
index 8b18b70..6e0a990 100644
--- a/METADATA
+++ b/METADATA
@@ -9,12 +9,12 @@
     type: GIT
     value: "https://github.com/python/cpython"
   }
-  version: "v3.9.1"
+  version: "v3.10.3"
   license_type: NOTICE
   last_upgrade_date {
-    year: 2021
-    month: 1
-    day: 13
+    year: 2022
+    month: 3
+    day: 22
   }
 }
 
diff --git a/Mac/BuildScript/README.rst b/Mac/BuildScript/README.rst
index 94a6bb2..4f74e7d 100644
--- a/Mac/BuildScript/README.rst
+++ b/Mac/BuildScript/README.rst
@@ -19,33 +19,87 @@
 that installer packages are submitted to and pass Apple's automated
 notarization service using the altool command.  To pass notarization,
 the binaries included in the package must be built with at least
-the macOS 10.9 SDK, mout now be signed with the codesign utility
+the macOS 10.9 SDK, must now be signed with the codesign utility,
 and executables must opt in to the hardened run time option with
 any necessary entitlements.  Details of these processes are
 available in the on-line Apple Developer Documentation and man pages.
 
-As of 3.8.0 and 3.7.7, PSF practice is to build one installer variants
-for each release.  Note that as of this writing, no Pythons support
-building on a newer version of macOS that will run on older versions
-by setting MACOSX_DEPLOYMENT_TARGET. This is because the various
-Python C modules do not yet support runtime testing of macOS
-feature availability (for example, by using macOS AvailabilityMacros.h
-and weak-linking).  To build a Python that is to be used on a
-range of macOS releases, always build on the oldest release to be
-supported; the necessary shared libraries for that release will
-normally also be available on later systems, with the occasional
-exception such as the removal of 32-bit libraries in macOS 10.15.
+A goal of PSF-provided (python.org) Python binaries for macOS is to
+support a wide-range of operating system releases with one set of
+binaries.  Currently, the oldest release supported by python.org
+binaries is macOS 10.9; it is still possible to build Python and
+Python installers on older versions of macOS but we not regularly
+test on those systems nor provide binaries for them.
 
-build-installer requires Apple Developer tools, either from the
+Prior to Python 3.9.1, no Python releases supported building on a
+newer version of macOS that will run on older versions
+by setting MACOSX_DEPLOYMENT_TARGET. This is because the various
+Python C modules did not yet support runtime testing of macOS
+feature availability (for example, by using macOS AvailabilityMacros.h
+and weak-linking). To build a Python that is to be used on a
+range of macOS releases, it was necessary to always build on the
+oldest release to be supported; the necessary shared libraries for
+that release will normally also be available on later systems,
+with the occasional exception such as the removal of 32-bit
+libraries in macOS 10.15. For 3.9.x and recent earlier systems,
+PSF practice was to provide a "macOS 64-bit Intel installer" variant
+that was built on 10.9 that would run on macOS 10.9 and later.
+
+Starting with 3.9.1, Python fully supports macOS "weaklinking",
+meaning it is now possible to build a Python on a current macOS version
+with a deployment target of an earlier macOS system. For 3.9.1 and
+later systems, we provide a "macOS 64-bit universal2 installer"
+variant, currently build on macOS 11 Big Sur with fat binaries
+natively supporting both Apple Silicon (arm64) and Intel-64
+(x86_64) Macs running macOS 10.9 or later.
+
+The legacy "macOS 64-bit Intel installer" variant is expected to
+be retired prior to the end of 3.9.x support.
+
+build-installer.py requires Apple Developer tools, either from the
 Command Line Tools package or from a full Xcode installation.
 You should use the most recent version of either for the operating
 system version in use.  (One notable exception: on macOS 10.6,
 Snow Leopard, use Xcode 3, not Xcode 4 which was released later
-in the 10.6 support cycle.)
+in the 10.6 support cycle.) build-installer.py also must be run
+with recent versions of Python 3.x or 2.7. On older systems,
+due to changes in TLS practices, it may be easier to manually
+download and cache third-party source distributions used by
+build-installer.py rather than have it attempt to automatically
+download them.
 
-1.  64-bit, x86_64, for OS X 10.9 (and later)::
+1.  universal2, arm64 and x86_64, for OS X 10.9 (and later)::
 
-        /path/to/bootstrap/python2.7 build-installer.py \
+        /path/to/bootstrap/python3 build-installer.py \
+            --universal-archs=universal2 \
+            --dep-target=10.9
+
+    - builds the following third-party libraries
+
+        * OpenSSL 1.1.1
+        * Tcl/Tk 8.6
+        * NCurses
+        * SQLite
+        * XZ
+        * libffi
+
+    - uses system-supplied versions of third-party libraries
+
+        * readline module links with Apple BSD editline (libedit)
+        * zlib
+        * bz2
+
+    - recommended build environment:
+
+        * Mac OS X 11 or later
+        * Xcode Command Line Tools 12.5 or later
+        * current default macOS SDK
+        * ``MACOSX_DEPLOYMENT_TARGET=10.9``
+        * Apple ``clang``
+
+2.  legacy Intel 64-bit, x86_64, for OS X 10.9 (and later)::
+
+        /path/to/bootstrap/python3 build-installer.py \
             --universal-archs=intel-64 \
             --dep-target=10.9
 
diff --git a/Mac/BuildScript/build-installer.py b/Mac/BuildScript/build-installer.py
index 16816d1..4308a20 100755
--- a/Mac/BuildScript/build-installer.py
+++ b/Mac/BuildScript/build-installer.py
@@ -2,6 +2,10 @@
 """
 This script is used to build "official" universal installers on macOS.
 
+NEW for 3.10 and backports:
+- support universal2 variant with arm64 and x86_64 archs
+- enable clang optimizations when building on 10.15+
+
 NEW for 3.9.0 and backports:
 - 2.7 end-of-life issues:
     - Python 3 installs now update the Current version link
@@ -161,8 +165,10 @@
         '10.4': ('gcc-4.0', 'g++-4.0'),
         '10.5': ('gcc', 'g++'),
         '10.6': ('gcc', 'g++'),
+        '10.7': ('gcc', 'g++'),
+        '10.8': ('gcc', 'g++'),
     }
-    return target_cc_map.get(DEPTARGET, ('gcc', 'g++') )
+    return target_cc_map.get(DEPTARGET, ('clang', 'clang++') )
 
 CC, CXX = getTargetCompilers()
 
@@ -234,23 +240,18 @@
 def library_recipes():
     result = []
 
-    LT_10_5 = bool(getDeptargetTuple() < (10, 5))
-
     # Since Apple removed the header files for the deprecated system
     # OpenSSL as of the Xcode 7 release (for OS X 10.10+), we do not
     # have much choice but to build our own copy here, too.
 
     result.extend([
           dict(
-              name="OpenSSL 1.1.1g",
-              url="https://www.openssl.org/source/openssl-1.1.1g.tar.gz",
-              checksum='76766e98997660138cdaf13a187bd234',
+              name="OpenSSL 1.1.1n",
+              url="https://www.openssl.org/source/openssl-1.1.1n.tar.gz",
+              checksum='2aad5635f9bb338bc2c6b7d19cbc9676',
               buildrecipe=build_universal_openssl,
               configure=None,
               install=None,
-              patches=[
-                  "openssl-mac-arm64.patch",
-                   ],
           ),
     ])
 
@@ -263,10 +264,10 @@
             tk_patches = ['tk868_on_10_8_10_9.patch']
 
         else:
-            tcl_tk_ver='8.6.10'
-            tcl_checksum='97c55573f8520bcab74e21bfd8d0aadc'
+            tcl_tk_ver='8.6.12'
+            tcl_checksum='87ea890821d2221f2ab5157bc5eb885f'
 
-            tk_checksum='602a47ad9ecac7bf655ada729d140a94'
+            tk_checksum='1d6dcf6120356e3d211e056dff5e462a'
             tk_patches = [ ]
 
 
@@ -357,17 +358,18 @@
                   ),
           ),
           dict(
-              name="SQLite 3.33.0",
-              url="https://sqlite.org/2020/sqlite-autoconf-3330000.tar.gz",
-              checksum='842a8a100d7b01b09e543deb2b7951dd',
+              name="SQLite 3.37.2",
+              url="https://sqlite.org/2022/sqlite-autoconf-3370200.tar.gz",
+              checksum='683cc5312ee74e71079c14d24b7a6d27',
               extra_cflags=('-Os '
                             '-DSQLITE_ENABLE_FTS5 '
                             '-DSQLITE_ENABLE_FTS4 '
                             '-DSQLITE_ENABLE_FTS3_PARENTHESIS '
                             '-DSQLITE_ENABLE_JSON1 '
                             '-DSQLITE_ENABLE_RTREE '
+                            '-DSQLITE_OMIT_AUTOINIT '
                             '-DSQLITE_TCL=0 '
-                 '%s' % ('','-DSQLITE_WITHOUT_ZONEMALLOC ')[LT_10_5]),
+                            ),
               configure_pre=[
                   '--enable-threadsafe',
                   '--enable-shared=no',
@@ -378,47 +380,6 @@
           ),
         ])
 
-    if getDeptargetTuple() < (10, 5):
-        result.extend([
-          dict(
-              name="Bzip2 1.0.6",
-              url="http://bzip.org/1.0.6/bzip2-1.0.6.tar.gz",
-              checksum='00b516f4704d4a7cb50a1d97e6e8e15b',
-              configure=None,
-              install='make install CC=%s CXX=%s, PREFIX=%s/usr/local/ CFLAGS="-arch %s"'%(
-                  CC, CXX,
-                  shellQuote(os.path.join(WORKDIR, 'libraries')),
-                  ' -arch '.join(ARCHLIST),
-              ),
-          ),
-          dict(
-              name="ZLib 1.2.3",
-              url="http://www.gzip.org/zlib/zlib-1.2.3.tar.gz",
-              checksum='debc62758716a169df9f62e6ab2bc634',
-              configure=None,
-              install='make install CC=%s CXX=%s, prefix=%s/usr/local/ CFLAGS="-arch %s"'%(
-                  CC, CXX,
-                  shellQuote(os.path.join(WORKDIR, 'libraries')),
-                  ' -arch '.join(ARCHLIST),
-              ),
-          ),
-          dict(
-              # Note that GNU readline is GPL'd software
-              name="GNU Readline 6.1.2",
-              url="http://ftp.gnu.org/pub/gnu/readline/readline-6.1.tar.gz" ,
-              checksum='fc2f7e714fe792db1ce6ddc4c9fb4ef3',
-              patchlevel='0',
-              patches=[
-                  # The readline maintainers don't do actual micro releases, but
-                  # just ship a set of patches.
-                  ('http://ftp.gnu.org/pub/gnu/readline/readline-6.1-patches/readline61-001',
-                   'c642f2e84d820884b0bf9fd176bc6c3f'),
-                  ('http://ftp.gnu.org/pub/gnu/readline/readline-6.1-patches/readline61-002',
-                   '1a76781a1ea734e831588285db7ec9b1'),
-              ]
-          ),
-        ])
-
     if not PYTHON_3:
         result.extend([
           dict(
@@ -435,6 +396,14 @@
 
     return result
 
+def compilerCanOptimize():
+    """
+    Return True iff the default Xcode version can use PGO and LTO
+    """
+    # bpo-42235: The version check is pretty conservative, can be
+    # adjusted after testing
+    mac_ver = tuple(map(int, platform.mac_ver()[0].split('.')))
+    return mac_ver >= (10, 15)
 
 # Instructions for building packages inside the .mpkg.
 def pkg_recipes():
@@ -484,7 +453,7 @@
             source="/pydocs",
             readme="""\
                 This package installs the python documentation at a location
-                that is useable for pydoc and IDLE.
+                that is usable for pydoc and IDLE.
                 """,
             postflight="scripts/postflight.documentation",
             required=False,
@@ -1138,7 +1107,6 @@
     if not os.path.exists(htmlDir):
         # Create virtual environment for docs builds with blurb and sphinx
         runCommand('make venv')
-        runCommand('venv/bin/python3 -m pip install -U Sphinx==2.3.1')
         runCommand('make html PYTHON=venv/bin/python')
     os.rename(htmlDir, docdir)
     os.chdir(curDir)
@@ -1176,6 +1144,7 @@
                "%s "
                "%s "
                "%s "
+               "%s "
                "LDFLAGS='-g -L%s/libraries/usr/local/lib' "
                "CFLAGS='-g -I%s/libraries/usr/local/include' 2>&1"%(
         shellQuote(os.path.join(SRCDIR, 'configure')),
@@ -1188,6 +1157,7 @@
                             shellQuote(WORKDIR)[1:-1],))[internalTk()],
         (' ', "--with-tcltk-libs='-L%s/libraries/usr/local/lib -ltcl8.6 -ltk8.6'"%(
                             shellQuote(WORKDIR)[1:-1],))[internalTk()],
+        (' ', "--enable-optimizations --with-lto")[compilerCanOptimize()],
         shellQuote(WORKDIR)[1:-1],
         shellQuote(WORKDIR)[1:-1]))
 
@@ -1615,17 +1585,39 @@
     if os.path.exists(outdir):
         shutil.rmtree(outdir)
 
-    # We used to use the deployment target as the last characters of the 
+    # We used to use the deployment target as the last characters of the
     # installer file name. With the introduction of weaklinked installer
     # variants, we may have two variants with the same file name, i.e.
     # both ending in '10.9'.  To avoid this, we now use the major/minor
-    # version numbers of the macOS version we are building on, i.e.
-    # '10.9' as before for 10.9+ variant, '11.0' for universal2 11.0-.
-    # it's not ideal but should cause the least disruption to packaging
-    # workflows.
-    build_system_version = '.'.join(platform.mac_ver()[0].split('.')[0:2])
+    # version numbers of the macOS version we are building on.
+    # Also, as of macOS 11, operating system version numbering has
+    # changed from three components to two, i.e.
+    #   10.14.1, 10.14.2, ...
+    #   10.15.1, 10.15.2, ...
+    #   11.1, 11.2, ...
+    #   12.1, 12.2, ...
+    # (A further twist is that, when running on macOS 11, binaries built
+    # on older systems may be shown an operating system version of 10.16
+    # instead of 11.  We should not run into that situation here.)
+    # Also we should use "macos" instead of "macosx" going forward.
+    #
+    # To maintain compatibility for legacy variants, the file name for
+    # builds on macOS 10.15 and earlier remains:
+    #   python-3.x.y-macosx10.z.{dmg->pkg}
+    #   e.g. python-3.9.4-macosx10.9.{dmg->pkg}
+    # and for builds on macOS 11+:
+    #   python-3.x.y-macosz.{dmg->pkg}
+    #   e.g. python-3.9.4-macos11.{dmg->pkg}
+
+    build_tuple = getBuildTuple()
+    if build_tuple[0] < 11:
+        os_name = 'macosx'
+        build_system_version = '%s.%s' % build_tuple
+    else:
+        os_name = 'macos'
+        build_system_version = str(build_tuple[0])
     imagepath = os.path.join(outdir,
-                    'python-%s-macosx%s'%(getFullVersion(),build_system_version))
+                    'python-%s-%s%s'%(getFullVersion(),os_name,build_system_version))
     if INCLUDE_TIMESTAMP:
         imagepath = imagepath + '-%04d-%02d-%02d'%(time.localtime()[:3])
     imagepath = imagepath + '.dmg'
diff --git a/Mac/BuildScript/openssl-mac-arm64.patch b/Mac/BuildScript/openssl-mac-arm64.patch
deleted file mode 100644
index 11267fb..0000000
--- a/Mac/BuildScript/openssl-mac-arm64.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-diff -ur openssl-1.1.1g-orig/Configurations/10-main.conf openssl-1.1.1g/Configurations/10-main.conf
---- openssl-1.1.1g-orig/Configurations/10-main.conf	2020-04-21 14:22:39.000000000 +0200
-+++ openssl-1.1.1g/Configurations/10-main.conf	2020-07-26 12:21:32.000000000 +0200
-@@ -1557,6 +1557,14 @@
-         bn_ops           => "SIXTY_FOUR_BIT_LONG",
-         perlasm_scheme   => "macosx",
-     },
-+    "darwin64-arm64-cc" => {
-+        inherit_from     => [ "darwin-common", asm("aarch64_asm") ],
-+        CFLAGS           => add("-Wall"),
-+        cflags           => add("-arch arm64"),
-+        lib_cppflags     => add("-DL_ENDIAN"),
-+        bn_ops           => "SIXTY_FOUR_BIT_LONG",
-+        perlasm_scheme   => "ios64",
-+    },
- 
- ##### GNU Hurd
-     "hurd-x86" => {
-diff -ur openssl-1.1.1g-orig/config openssl-1.1.1g/config
---- openssl-1.1.1g-orig/config	2020-04-21 14:22:39.000000000 +0200
-+++ openssl-1.1.1g/config	2020-07-26 12:21:59.000000000 +0200
-@@ -255,6 +255,9 @@
- 		;;
- 	    x86_64)
- 		echo "x86_64-apple-darwin${VERSION}"
-+                ;;
-+	    arm64)
-+		echo "arm64-apple-darwin${VERSION}"
- 		;;
- 	    *)
- 		echo "i686-apple-darwin${VERSION}"
-@@ -497,6 +500,9 @@
- 	else
- 	    OUT="darwin64-x86_64-cc"
- 	fi ;;
-+  x86_64-apple-darwin*)
-+	OUT="darwin64-arm64-cc"
-+        ;;
-   armv6+7-*-iphoneos)
- 	__CNF_CFLAGS="$__CNF_CFLAGS -arch armv6 -arch armv7"
- 	__CNF_CXXFLAGS="$__CNF_CXXFLAGS -arch armv6 -arch armv7"
diff --git a/Mac/BuildScript/resources/License.rtf b/Mac/BuildScript/resources/License.rtf
index 1dfdc1e..7fe7e66 100644
--- a/Mac/BuildScript/resources/License.rtf
+++ b/Mac/BuildScript/resources/License.rtf
@@ -16,7 +16,7 @@
 \
 In 1995, Guido continued his work on Python at the Corporation for National Research Initiatives (CNRI, see http://www.cnri.reston.va.us) in Reston, Virginia where he released several versions of the software.\
 \
-In May 2000, Guido and the Python core development team moved to BeOpen.com to form the BeOpen PythonLabs team. In October of the same year, the PythonLabs team moved to Digital Creations (now Zope Corporation, see http://www.zope.org). In 2001, the Python Software Foundation (PSF, see http://www.python.org/psf/) was formed, a non-profit organization created specifically to own Python-related Intellectual Property. Zope Corporation is a sponsoring member of the PSF.\
+In May 2000, Guido and the Python core development team moved to BeOpen.com to form the BeOpen PythonLabs team. In October of the same year, the PythonLabs team moved to Digital Creations (now Zope Corporation, see http://www.zope.org). In 2001, the Python Software Foundation (PSF, see https://www.python.org/psf/) was formed, a non-profit organization created specifically to own Python-related Intellectual Property. Zope Corporation is a sponsoring member of the PSF.\
 \
 All Python releases are Open Source (see http://www.opensource.org for the Open Source Definition). Historically, most, but not all, Python releases have also been GPL-compatible; the table below summarizes the various releases.\
 \
@@ -106,7 +106,7 @@
 \f1\b0 \
 1. This LICENSE AGREEMENT is between the Corporation for National Research Initiatives, having an office at 1895 Preston White Drive, Reston, VA 20191 ("CNRI"), and the Individual or Organization ("Licensee") accessing and otherwise using Python 1.6.1 software in source or binary form and its associated documentation.\
 \
-2. Subject to the terms and conditions of this License Agreement, CNRI hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python 1.6.1 alone or in any derivative version, provided, however, that CNRI's License Agreement and CNRI's notice of copyright, i.e., "Copyright (c) 1995-2001 Corporation for National Research Initiatives; All Rights Reserved" are retained in Python 1.6.1 alone or in any derivative version prepared by Licensee. Alternately, in lieu of CNRI's License Agreement, Licensee may substitute the following text (omitting the quotes): "Python 1.6.1 is made available subject to the terms and conditions in CNRI's License Agreement. This Agreement together with Python 1.6.1 may be located on the Internet using the following unique, persistent identifier (known as a handle): 1895.22/1013. This Agreement may also be obtained from a proxy server on the Internet using the following URL: http://hdl.handle.net/1895.22/1013".\
+2. Subject to the terms and conditions of this License Agreement, CNRI hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python 1.6.1 alone or in any derivative version, provided, however, that CNRI's License Agreement and CNRI's notice of copyright, i.e., "Copyright (c) 1995-2001 Corporation for National Research Initiatives; All Rights Reserved" are retained in Python 1.6.1 alone or in any derivative version prepared by Licensee. Alternately, in lieu of CNRI's License Agreement, Licensee may substitute the following text (omitting the quotes): "Python 1.6.1 is made available subject to the terms and conditions in CNRI's License Agreement. This Agreement together with Python 1.6.1 may be located on the internet using the following unique, persistent identifier (known as a handle): 1895.22/1013. This Agreement may also be obtained from a proxy server on the internet using the following URL: http://hdl.handle.net/1895.22/1013".\
 \
 3. In the event Licensee prepares a derivative work that is based on or incorporates Python 1.6.1 or any part thereof, and wants to make the derivative work available to others as provided herein, then Licensee hereby agrees to include in any such work a brief summary of the changes made to Python 1.6.1.\
 \
@@ -161,4 +161,4 @@
 \
 \
 \
-}
\ No newline at end of file
+}
diff --git a/Mac/BuildScript/resources/ReadMe.rtf b/Mac/BuildScript/resources/ReadMe.rtf
index 2c0c3d5..4edfa5f 100644
--- a/Mac/BuildScript/resources/ReadMe.rtf
+++ b/Mac/BuildScript/resources/ReadMe.rtf
@@ -1,6 +1,6 @@
-{\rtf1\ansi\ansicpg1252\cocoartf2513
+{\rtf1\ansi\ansicpg1252\cocoartf2580
 \cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fswiss\fcharset0 Helvetica-Bold;\f2\fswiss\fcharset0 Helvetica-Oblique;
-\f3\fmodern\fcharset0 CourierNewPSMT;}
+\f3\fmodern\fcharset0 CourierNewPSMT;\f4\fmodern\fcharset0 Courier;}
 {\colortbl;\red255\green255\blue255;}
 {\*\expandedcolortbl;;}
 \margl1440\margr1440\vieww13380\viewh14580\viewkind0
@@ -20,7 +20,7 @@
 \f0\i0  command line utility are not used as defaults by the Python 
 \f3 ssl
 \f0  module.  A sample command script is included in 
-\f3 /Applications/Python 3.9
+\f3 /Applications/Python 3.10
 \f0  to install a curated bundle of default root certificates from the third-party 
 \f3 certifi
 \f0  package ({\field{\*\fldinst{HYPERLINK "https://pypi.org/project/certifi/"}}{\fldrslt https://pypi.org/project/certifi/}}).  Double-click on 
@@ -32,6 +32,16 @@
 \f0  has its own default certificate store for verifying download connections.\
 \
 
+\f1\b \ul Install Options\
+
+\f0\b0 \ulnone \
+You can control some aspects of what is installed by this package. To see the options, click on the 
+\f4 Customize
+\f0  button in the 
+\f4 Installation Type
+\f0  step of the macOS installer app.  Click on a package name in the list shown to see more information about that option,\
+  \
+
 \f1\b \ul Using IDLE or other Tk applications 
 \f0\b0 \ulnone \
 \
@@ -50,18 +60,22 @@
 \f0\b0  button to proceed.\
 \
 
-\f1\b \ul macOS 11.0 (Big Sur) and Apple Silicon Mac support [new in 3.9.1]\
+\f1\b \ul macOS 11 (Big Sur) and Apple Silicon Mac support\
 
 \f0\b0 \ulnone \
-As of 2020-11, macOS 11.0 (Big Sur) is the latest release of macOS and one of its major features is the support of new Apple Silicon Macs that are based on the ARM64 CPU architecture specification rather than the Intel 64 (x86_64) architecture used previously. There are other changes in Big Sur that affect Python operation regardless of CPU architecture. As of 3.9.1, Python binaries from python.org fully support Big Sur. \
+For Python 3.10 releases, we provide a new 
+\f4 universal2
+\f0  installer variant that provides universal binaries for both 
+\f4 ARM64
+\f0  and 
+\f4 Intel 64
+\f0  architectures and is also supported on all Macs that support macOS 10.9 or later.  Some of the advantages of the new installer variant: native ARM64 code on Apple Silicon Macs should run significantly faster than Rosetta2-emulated code; some operating system functions and options introduced in macOS releases since 10.9 are now exposed when available (primarily in the os module); and the new installer variant includes Tcl/Tk 8.6.11 rather than 8.6.8.\
 \
-python.org binaries for macOS have been provided via a downloadable installer that supports the Intel 64 architecture on macOS 10.9 and newer.  This installer variant remains the default download for 3.9.1;  it will install and run on all Macs that run macOS 10.9 or later, including 11.0 (Big Sur). This variant should run transparently on new Apple Silicon Macs using Apple's Rosetta 2 emulation. \
-\
-Beginning with 3.9.1, we also provide a new "universal2" installer variant that provides universal binaries for both ARM64 and Intel 64 architectures and is also supported on all Macs that support macOS 10.9 or later.  Some of the advantages of the new installer variant: native ARM64 code on Apple Silicon Macs should run significantly faster than Rosetta2-emulated code; some operating system functions and options introduced in macOS releases since 10.9 are now exposed when available (primarily in the os module); binary wheels built for use with the current 10.9 variant *should* also work with the new variant; the new installer variant includes Tcl/Tk 8.6.10 rather than 8.6.8.\
-\
-Because of the scope of changes needed to fully support 11.0 and Apple Silicon Macs, the new "universal2" variant should be considered 
-\f2\i experimental
-\f0\i0  in the 3.9.1 release. You may need to upgrade third-party components, like pip, to later versions once they are released. You may experience differences in behavior in IDLE and other Tk-based applications due to using the newer version of Tk.  As always, if you encounter problems when using this installer variant, please check {\field{\*\fldinst{HYPERLINK "https://bugs.python.org"}}{\fldrslt https://bugs.python.org}} for existing reports and for opening new issues.\
+On Apple Silicon Macs, it is possible to run Python either with native ARM64 code or under Intel 64 emulation using Rosetta2. This option might be useful for testing or if binary wheels are not yet available with native ARM64 binaries.  To  easily force Python to run in emulation mode, invoke it from a command line shell with the 
+\f4 python3-intel64
+\f0  command instead of just 
+\f4 python3
+\f0 .\
 
 \f1\b \ul \
 Other changes\
diff --git a/Mac/BuildScript/resources/Welcome.rtf b/Mac/BuildScript/resources/Welcome.rtf
index 407c225..57ffdb5 100644
--- a/Mac/BuildScript/resources/Welcome.rtf
+++ b/Mac/BuildScript/resources/Welcome.rtf
@@ -1,9 +1,9 @@
-{\rtf1\ansi\ansicpg1252\cocoartf2513
+{\rtf1\ansi\ansicpg1252\cocoartf2580
 \cocoascreenfonts1\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fswiss\fcharset0 Helvetica-Bold;\f2\fmodern\fcharset0 CourierNewPSMT;
 }
 {\colortbl;\red255\green255\blue255;}
 {\*\expandedcolortbl;;}
-\paperw11905\paperh16837\margl1440\margr1440\vieww12200\viewh10880\viewkind0
+\paperw11900\paperh16840\margl1440\margr1440\vieww12200\viewh10880\viewkind0
 \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\partightenfactor0
 
 \f0\fs24 \cf0 This package will install 
diff --git a/Mac/BuildScript/scripts/postflight.patch-profile b/Mac/BuildScript/scripts/postflight.patch-profile
index 0a62e32..68b8e4b 100755
--- a/Mac/BuildScript/scripts/postflight.patch-profile
+++ b/Mac/BuildScript/scripts/postflight.patch-profile
@@ -20,7 +20,7 @@
 # Make sure the directory ${PYTHON_ROOT}/bin is on the users PATH.
 BSH="`basename "${theShell}"`"
 case "${BSH}" in
-bash|ksh|sh|*csh|zsh)
+bash|ksh|sh|*csh|zsh|fish)
 	if [ `id -ur` = 0 ]; then
 		P=`su - ${USER} -c 'echo A-X-4-X@@$PATH@@X-4-X-A' | grep 'A-X-4-X@@.*@@X-4-X-A' | sed -e 's/^A-X-4-X@@//g' -e 's/@@X-4-X-A$//g'`
 	else
@@ -76,6 +76,22 @@
 		PR="${HOME}/.bash_profile"
 	fi
 	;;
+fish)
+	CONFIG_DIR="${HOME}/.config/fish"
+	RC="${CONFIG_DIR}/config.fish"
+	mkdir -p "$CONFIG_DIR"
+	if [ -f "${RC}" ]; then
+		cp -fp "${RC}" "${RC}.pysave"
+	fi
+	echo "" >> "${RC}"
+	echo "# Setting PATH for Python ${PYVER}" >> "${RC}"
+	echo "# The original version is saved in ${RC}.pysave" >> "${RC}"
+	echo "set -x PATH \"${PYTHON_ROOT}/bin\" \"\$PATH\"" >> "${RC}"
+	if [ `id -ur` = 0 ]; then
+		chown "${USER}" "${RC}"
+	fi
+	exit 0
+	;;
 zsh)
         PR="${HOME}/.zprofile"
         ;;
diff --git a/Mac/IDLE/IDLE.app/Contents/Info.plist b/Mac/IDLE/IDLE.app/Contents/Info.plist
index dcc48ab..d197c77 100644
--- a/Mac/IDLE/IDLE.app/Contents/Info.plist
+++ b/Mac/IDLE/IDLE.app/Contents/Info.plist
@@ -36,7 +36,7 @@
 	<key>CFBundleExecutable</key>
 	<string>IDLE</string>
 	<key>CFBundleGetInfoString</key>
-	<string>%version%, © 2001-2020 Python Software Foundation</string>
+	<string>%version%, © 2001-2022 Python Software Foundation</string>
 	<key>CFBundleIconFile</key>
 	<string>IDLE.icns</string>
 	<key>CFBundleIdentifier</key>
diff --git a/Mac/IDLE/IDLE.app/Contents/Resources/idlemain.py b/Mac/IDLE/IDLE.app/Contents/Resources/idlemain.py
index 5994c18..ccc18d4 100644
--- a/Mac/IDLE/IDLE.app/Contents/Resources/idlemain.py
+++ b/Mac/IDLE/IDLE.app/Contents/Resources/idlemain.py
@@ -35,7 +35,7 @@
 #       idlemain.py running under the symlinked python.
 #       This is the magic step.
 # 4. During interpreter initialization, because PYTHONEXECUTABLE is defined,
-#    sys.executable may get set to an unuseful value.
+#    sys.executable may get set to an useless value.
 #
 # (Note that the IDLE script and the setting of PYTHONEXECUTABLE is
 #  generated automatically by bundlebuilder in the Python 2.x build.
diff --git a/Mac/Makefile.in b/Mac/Makefile.in
index 0b32673..f969128 100644
--- a/Mac/Makefile.in
+++ b/Mac/Makefile.in
@@ -20,6 +20,7 @@
 PYTHONFRAMEWORK=@PYTHONFRAMEWORK@
 PYTHONFRAMEWORKIDENTIFIER=@PYTHONFRAMEWORKIDENTIFIER@
 LIPO_32BIT_FLAGS=@LIPO_32BIT_FLAGS@
+LIPO_INTEL64_FLAGS=@LIPO_INTEL64_FLAGS@
 CC=@CC@
 MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
 export MACOSX_DEPLOYMENT_TARGET
@@ -92,6 +93,16 @@
 			$(LN) -s $(BINDIR)/$${fn} $${fn} ;\
 		done ;\
 	fi
+	-if test "x$(LIPO_INTEL64_FLAGS)" != "x"; then \
+		cd "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" && \
+		for fn in \
+				python3-intel64 \
+				; \
+		do \
+			rm -f $${fn} ;\
+			$(LN) -s $(BINDIR)/$${fn} $${fn} ;\
+		done ;\
+	fi
 	-if test "x$(ENSUREPIP)" != "xno"  ; then \
 		cd "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" && \
 		for fn in \
@@ -142,6 +153,16 @@
 			$(LN) -s $(BINDIR)/$${fn} $${fn} ;\
 		done ;\
 	fi
+	-if test "x$(LIPO_INTEL64_FLAGS)" != "x"; then \
+		cd "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" && \
+		for fn in \
+				python$(VERSION)-intel64 \
+				; \
+		do \
+			rm -f $${fn} ;\
+			$(LN) -s $(BINDIR)/$${fn} $${fn} ;\
+		done ;\
+	fi
 	-if test "x$(ENSUREPIP)" != "xno"  ; then \
 		cd "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" && \
 		for fn in \
diff --git a/Mac/PythonLauncher/Info.plist.in b/Mac/PythonLauncher/Info.plist.in
index 21a0515..dec0a2e 100644
--- a/Mac/PythonLauncher/Info.plist.in
+++ b/Mac/PythonLauncher/Info.plist.in
@@ -3,7 +3,7 @@
 <plist version="1.0">
 <dict>
 	<key>CFBundleDevelopmentRegion</key>
-	<string>English</string>
+	<string>en</string>
 	<key>CFBundleDocumentTypes</key>
 	<array>
 		<dict>
@@ -39,8 +39,10 @@
 	</array>
 	<key>CFBundleExecutable</key>
 	<string>Python Launcher</string>
+	<key>NSHumanReadableCopyright</key>
+	<string>Copyright © 2001-2022 Python Software Foundation</string>
 	<key>CFBundleGetInfoString</key>
-	<string>%VERSION%, © 2001-2020 Python Software Foundation</string>
+	<string>%VERSION%, © 2001-2022 Python Software Foundation</string>
 	<key>CFBundleIconFile</key>
 	<string>PythonLauncher.icns</string>
 	<key>CFBundleIdentifier</key>
@@ -61,5 +63,7 @@
 	<string>MainMenu</string>
 	<key>NSPrincipalClass</key>
 	<string>NSApplication</string>
+	<key>NSAppleEventsUsageDescription</key>
+	<string>Python Launcher uses Apple events to launch your Python script in a Terminal window.</string>
 </dict>
 </plist>
diff --git a/Mac/PythonLauncher/MyAppDelegate.m b/Mac/PythonLauncher/MyAppDelegate.m
index 25779a2..9cc2aa0 100644
--- a/Mac/PythonLauncher/MyAppDelegate.m
+++ b/Mac/PythonLauncher/MyAppDelegate.m
@@ -22,7 +22,7 @@
 {
     // Test that the file mappings are correct
     [self testFileTypeBinding];
-    // If we were opened because of a file drag or doubleclick
+    // If we were opened because of a file drag or double-click
     // we've set initial_action_done in shouldShowUI
     // Otherwise we open a preferences dialog.
     if (!initial_action_done) {
diff --git a/Mac/PythonLauncher/doscript.m b/Mac/PythonLauncher/doscript.m
index cbb783b..f07326b 100644
--- a/Mac/PythonLauncher/doscript.m
+++ b/Mac/PythonLauncher/doscript.m
@@ -19,7 +19,7 @@
     AEDesc desc;
     OSStatus err;
 
-    [[NSWorkspace sharedWorkspace] launchApplication:@"/Applications/Utilities/Terminal.app/"];
+    [[NSWorkspace sharedWorkspace] launchApplication:@"Terminal.app"];
 
     // Build event
     err = AEBuildAppleEvent(kAECoreSuite, kAEDoScript,
diff --git a/Mac/README.rst b/Mac/README.rst
index f3638aa..8f2f153 100644
--- a/Mac/README.rst
+++ b/Mac/README.rst
@@ -162,6 +162,9 @@
 The makefile for a framework build will also install ``python3.x-32``
 binaries when the universal architecture includes at least one 32-bit
 architecture (that is, for all flavors but ``64-bit`` and ``intel-64``).
+It will also install ``python3.x-intel64`` binaries in the ``universal2``
+case to allow easy execution with the Rosetta 2 Intel emulator on Apple
+Silicon Macs.
 
 Running a specific architecture
 ...............................
@@ -181,6 +184,9 @@
 a ``python3.x-32`` binary and use the value of ``sys.executable`` as the
 ``subprocess`` ``Popen`` executable value.
 
+Likewise, use ``python3.x-intel64`` to force execution in ``x86_64`` mode
+with ``universal2`` binaries.
+
 Building and using a framework-based Python on macOS
 ====================================================
 
@@ -220,7 +226,7 @@
 aware, though, that the Cocoa-based AquaTk's supplied starting with macOS
 10.6 have proven to be unstable.  If possible, you should consider
 installing a newer version before building on macOS 10.6 or later, such as
-the ActiveTcl 8.6.  See http://www.python.org/download/mac/tcltk/.  If you
+the ActiveTcl 8.6.  See https://www.python.org/download/mac/tcltk/.  If you
 are building with an SDK, ensure that the newer Tcl and Tk frameworks are
 seen in the SDK's ``Library/Frameworks`` directory; you may need to
 manually create symlinks to their installed location, ``/Library/Frameworks``.
@@ -287,10 +293,10 @@
 How do I create a binary distribution?
 ======================================
 
-Download and unpack the source release from http://www.python.org/download/.
+Download and unpack the source release from https://www.python.org/download/.
 Go to the directory ``Mac/BuildScript``. There you will find a script
 ``build-installer.py`` that does all the work. This will download and build
-a number of 3rd-party libaries, configures and builds a framework Python,
+a number of 3rd-party libraries, configures and builds a framework Python,
 installs it, creates the installer package files and then packs this in a
 DMG image.  The script also builds an HTML copy of the current Python
 documentation set for this release for inclusion in the framework.  The
@@ -328,9 +334,9 @@
    configure: WARNING: libintl.h:     section "Present But Cannot Be Compiled"
    configure: WARNING: libintl.h: proceeding with the preprocessor's result
    configure: WARNING: libintl.h: in the future, the compiler will take precedence
-   configure: WARNING:     ## -------------------------------------- ##
-   configure: WARNING:     ## Report this to http://bugs.python.org/ ##
-   configure: WARNING:     ## -------------------------------------- ##
+   configure: WARNING:     ## --------------------------------------- ##
+   configure: WARNING:     ## Report this to https://bugs.python.org/ ##
+   configure: WARNING:     ## --------------------------------------- ##
 
 This almost always means you are trying to build a universal binary for
 Python and have libraries in ``/usr/local`` that don't contain the required
@@ -359,7 +365,7 @@
 Weak linking support
 ====================
 
-The CPython sources support building with the latest SDK while targetting deployment
+The CPython sources support building with the latest SDK while targeting deployment
 to macOS 10.9. This is done through weak linking of symbols introduced in macOS
 10.10 or later and checking for their availability at runtime.
 
@@ -393,8 +399,8 @@
 Resources
 =========
 
-  *  http://www.python.org/download/mac/
+  *  https://www.python.org/downloads/macos/
 
-  *  http://www.python.org/community/sigs/current/pythonmac-sig/
+  *  https://www.python.org/community/sigs/current/pythonmac-sig/
 
   *  https://devguide.python.org/
diff --git a/Mac/Resources/app/Info.plist.in b/Mac/Resources/app/Info.plist.in
index 1d62498..84843b7 100644
--- a/Mac/Resources/app/Info.plist.in
+++ b/Mac/Resources/app/Info.plist.in
@@ -37,7 +37,7 @@
 	<key>CFBundleInfoDictionaryVersion</key>
 	<string>6.0</string>
 	<key>CFBundleLongVersionString</key>
-	<string>%version%, (c) 2001-2020 Python Software Foundation.</string>
+	<string>%version%, (c) 2001-2022 Python Software Foundation.</string>
 	<key>CFBundleName</key>
 	<string>Python</string>
 	<key>CFBundlePackageType</key>
diff --git a/Mac/Resources/framework/Info.plist.in b/Mac/Resources/framework/Info.plist.in
index 0dc2e17..863b452 100644
--- a/Mac/Resources/framework/Info.plist.in
+++ b/Mac/Resources/framework/Info.plist.in
@@ -17,9 +17,9 @@
 	<key>CFBundlePackageType</key>
 	<string>FMWK</string>
 	<key>CFBundleShortVersionString</key>
-	<string>%VERSION%, (c) 2001-2019 Python Software Foundation.</string>
+	<string>%VERSION%, (c) 2001-2021 Python Software Foundation.</string>
 	<key>CFBundleLongVersionString</key>
-	<string>%VERSION%, (c) 2001-2019 Python Software Foundation.</string>
+	<string>%VERSION%, (c) 2001-2021 Python Software Foundation.</string>
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<key>CFBundleVersion</key>
diff --git a/Makefile.pre.in b/Makefile.pre.in
index f128444..ee85f35 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -103,7 +103,6 @@
 PY_LDFLAGS=	$(CONFIGURE_LDFLAGS) $(LDFLAGS)
 PY_LDFLAGS_NODIST=$(CONFIGURE_LDFLAGS_NODIST) $(LDFLAGS_NODIST)
 NO_AS_NEEDED=	@NO_AS_NEEDED@
-SGI_ABI=	@SGI_ABI@
 CCSHARED=	@CCSHARED@
 # LINKFORSHARED are the flags passed to the $(CC) command that links
 # the python executable -- this is only needed for a few systems
@@ -146,6 +145,8 @@
 PLATLIBDIR=	@PLATLIBDIR@
 SCRIPTDIR=	$(prefix)/$(PLATLIBDIR)
 ABIFLAGS=	@ABIFLAGS@
+# Variable used by ensurepip
+WHEEL_PKG_DIR=	@WHEEL_PKG_DIR@
 
 # Detailed destination directories
 BINLIBDEST=	@BINLIBDEST@
@@ -187,6 +188,9 @@
 # Flags to lipo to produce a 32-bit-only universal executable
 LIPO_32BIT_FLAGS=@LIPO_32BIT_FLAGS@
 
+# Flags to lipo to produce an intel-64-only universal executable
+LIPO_INTEL64_FLAGS=@LIPO_INTEL64_FLAGS@
+
 # Options to enable prebinding (for fast startup prior to Mac OS X 10.3)
 OTHER_LIBTOOL_OPT=@OTHER_LIBTOOL_OPT@
 
@@ -200,6 +204,7 @@
 OPENSSL_INCLUDES=@OPENSSL_INCLUDES@
 OPENSSL_LIBS=@OPENSSL_LIBS@
 OPENSSL_LDFLAGS=@OPENSSL_LDFLAGS@
+OPENSSL_RPATH=@OPENSSL_RPATH@
 
 # Default zoneinfo.TZPATH. Added here to expose it in sysconfig.get_config_var
 TZPATH=@TZPATH@
@@ -234,6 +239,9 @@
 DLLLIBRARY=	@DLLLIBRARY@
 LDLIBRARYDIR=   @LDLIBRARYDIR@
 INSTSONAME=	@INSTSONAME@
+LIBRARY_DEPS=	@LIBRARY_DEPS@
+PY_ENABLE_SHARED=	@PY_ENABLE_SHARED@
+STATIC_LIBPYTHON=	@STATIC_LIBPYTHON@
 
 
 LIBS=		@LIBS@
@@ -252,7 +260,7 @@
 BUILDPYTHON=	python$(BUILDEXE)
 
 PYTHON_FOR_REGEN?=@PYTHON_FOR_REGEN@
-UPDATE_FILE=@PYTHON_FOR_REGEN@ $(srcdir)/Tools/scripts/update_file.py
+UPDATE_FILE=$(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/update_file.py
 PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@
 _PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@
 BUILD_GNU_TYPE=	@build@
@@ -304,32 +312,24 @@
 # Parser
 
 PEGEN_OBJS=		\
-		Parser/pegen/pegen.o \
-		Parser/pegen/parse.o \
-		Parser/pegen/parse_string.o \
-		Parser/pegen/peg_api.o
+		Parser/pegen.o \
+		Parser/parser.o \
+		Parser/string_parser.o \
+		Parser/peg_api.o
 
 
 PEGEN_HEADERS= \
-		$(srcdir)/Include/internal/pegen_interface.h \
-		$(srcdir)/Parser/pegen/pegen.h \
-		$(srcdir)/Parser/pegen/parse_string.h
+		$(srcdir)/Include/internal/pycore_parser.h \
+		$(srcdir)/Parser/pegen.h \
+		$(srcdir)/Parser/string_parser.h
 
 POBJS=		\
-		Parser/acceler.o \
-		Parser/grammar1.o \
-		Parser/listnode.o \
-		Parser/node.o \
-		Parser/parser.o \
 		Parser/token.o \
 
-PARSER_OBJS=	$(POBJS) $(PEGEN_OBJS) Parser/myreadline.o Parser/parsetok.o Parser/tokenizer.o
+PARSER_OBJS=	$(POBJS) $(PEGEN_OBJS) Parser/myreadline.o Parser/tokenizer.o
 
 PARSER_HEADERS= \
 		$(PEGEN_HEADERS) \
-		$(srcdir)/Include/grammar.h \
-		$(srcdir)/Include/parsetok.h \
-		$(srcdir)/Parser/parser.h \
 		$(srcdir)/Parser/tokenizer.h
 
 ##########################################################################
@@ -356,7 +356,6 @@
 		Python/getcopyright.o \
 		Python/getplatform.o \
 		Python/getversion.o \
-		Python/graminit.o \
 		Python/hamt.o \
 		Python/hashtable.o \
 		Python/import.o \
@@ -367,7 +366,6 @@
 		Python/mysnprintf.o \
 		Python/mystrtoul.o \
 		Python/pathconfig.o \
-		Python/peephole.o \
 		Python/preconfig.o \
 		Python/pyarena.o \
 		Python/pyctype.o \
@@ -391,6 +389,7 @@
 		Python/dtoa.o \
 		Python/formatter_unicode.o \
 		Python/fileutils.o \
+		Python/suggestions.o \
 		Python/$(DYNLOADFILE) \
 		$(LIBOBJS) \
 		$(MACHDEP_OBJS) \
@@ -442,6 +441,7 @@
 		Objects/typeobject.o \
 		Objects/unicodeobject.o \
 		Objects/unicodectype.o \
+		Objects/unionobject.o \
 		Objects/weakrefobject.o
 
 ##########################################################################
@@ -558,7 +558,6 @@
 	    '*/Modules/zlib/*' \
 	    '*/Include/*' \
 	    '*/Modules/xx*.c' \
-	    '*/Parser/listnode.c' \
 	    '*/Python/pyfpe.c' \
 	    '*/Python/pystrcmp.c' \
 	    '/usr/include/*' \
@@ -572,7 +571,7 @@
 	@echo
 
 # Force regeneration of parser and importlib
-coverage-report: regen-grammar regen-token regen-importlib
+coverage-report: regen-token regen-importlib
 	@ # build with coverage info
 	$(MAKE) coverage
 	@ # run tests, ignore failures
@@ -586,7 +585,7 @@
 	$(PYTHON_FOR_REGEN) $(srcdir)/Tools/clinic/clinic.py --make --srcdir $(srcdir)
 
 # Build the interpreter
-$(BUILDPYTHON):	Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) $(EXPORTSYMS)
+$(BUILDPYTHON):	Programs/python.o $(LIBRARY_DEPS)
 	$(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS)
 
 platform: $(BUILDPYTHON) pybuilddir.txt
@@ -721,7 +720,7 @@
 	@echo "The Makefile was updated, you may need to re-run make."
 
 
-Programs/_testembed: Programs/_testembed.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) $(EXPORTSYMS)
+Programs/_testembed: Programs/_testembed.o $(LIBRARY_DEPS)
 	$(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/_testembed.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS)
 
 ############################################################################
@@ -753,13 +752,26 @@
 	    $(srcdir)/Python/importlib_zipimport.h.new
 	$(UPDATE_FILE) $(srcdir)/Python/importlib_zipimport.h $(srcdir)/Python/importlib_zipimport.h.new
 
+regen-abidump: all
+	@$(MKDIR_P) $(srcdir)/Doc/data/
+	abidw "libpython$(LDVERSION).so" --no-architecture --out-file $(srcdir)/Doc/data/python$(LDVERSION).abi.new
+	@$(UPDATE_FILE) $(srcdir)/Doc/data/python$(LDVERSION).abi $(srcdir)/Doc/data/python$(LDVERSION).abi.new
+
+check-abidump: all
+		abidiff $(srcdir)/Doc/data/python$(LDVERSION).abi "libpython$(LDVERSION).so" --drop-private-types --no-architecture --no-added-syms
+
+regen-limited-abi: all
+	$(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/stable_abi.py --generate-all $(srcdir)/Misc/stable_abi.txt
+
 
 ############################################################################
 # Regenerate all generated files
 
-regen-all: regen-opcode regen-opcode-targets regen-typeslots regen-grammar \
-	regen-token regen-keyword regen-symbol regen-ast regen-importlib clinic \
-	regen-pegen-metaparser regen-pegen
+regen-all: regen-opcode regen-opcode-targets regen-typeslots \
+	regen-token regen-ast regen-keyword regen-importlib clinic \
+	regen-pegen-metaparser regen-pegen regen-frozen
+	@echo
+	@echo "Note: make regen-stdlib-module-names and autoconf should be run manually"
 
 ############################################################################
 # Special rules for object files
@@ -824,18 +836,6 @@
 
 $(IO_OBJS): $(IO_H)
 
-.PHONY: regen-grammar
-regen-grammar: regen-token
-	# Regenerate Include/graminit.h and Python/graminit.c
-	# from Grammar/Grammar using pgen
-	@$(MKDIR_P) Include
-	PYTHONPATH=$(srcdir) $(PYTHON_FOR_REGEN) -m Parser.pgen $(srcdir)/Grammar/Grammar \
-		$(srcdir)/Grammar/Tokens \
-		$(srcdir)/Include/graminit.h.new \
-		$(srcdir)/Python/graminit.c.new
-	$(UPDATE_FILE) $(srcdir)/Include/graminit.h $(srcdir)/Include/graminit.h.new
-	$(UPDATE_FILE) $(srcdir)/Python/graminit.c $(srcdir)/Python/graminit.c.new
-
 .PHONY: regen-pegen-metaparser
 regen-pegen-metaparser:
 	@$(MKDIR_P) $(srcdir)/Tools/peg_generator/pegen
@@ -847,24 +847,29 @@
 
 .PHONY: regen-pegen
 regen-pegen:
-	@$(MKDIR_P) $(srcdir)/Parser/pegen
+	@$(MKDIR_P) $(srcdir)/Parser
 	PYTHONPATH=$(srcdir)/Tools/peg_generator $(PYTHON_FOR_REGEN) -m pegen -q c \
 		$(srcdir)/Grammar/python.gram \
 		$(srcdir)/Grammar/Tokens \
-		-o $(srcdir)/Parser/pegen/parse.new.c
-	$(UPDATE_FILE) $(srcdir)/Parser/pegen/parse.c $(srcdir)/Parser/pegen/parse.new.c
+		-o $(srcdir)/Parser/parser.new.c
+	$(UPDATE_FILE) $(srcdir)/Parser/parser.c $(srcdir)/Parser/parser.new.c
 
 .PHONY=regen-ast
 regen-ast:
-	# Regenerate Include/Python-ast.h and Python/Python-ast.c using Parser/asdl_c.py
+	# Regenerate 3 files using using Parser/asdl_c.py:
+	# - Include/internal/pycore_ast.h
+	# - Include/internal/pycore_ast_state.h
+	# - Python/Python-ast.c
 	$(MKDIR_P) $(srcdir)/Include
 	$(MKDIR_P) $(srcdir)/Python
 	$(PYTHON_FOR_REGEN) $(srcdir)/Parser/asdl_c.py \
 		$(srcdir)/Parser/Python.asdl \
-		-H $(srcdir)/Include/Python-ast.h.new \
+		-H $(srcdir)/Include/internal/pycore_ast.h.new \
+		-I $(srcdir)/Include/internal/pycore_ast_state.h.new \
 		-C $(srcdir)/Python/Python-ast.c.new
 
-	$(UPDATE_FILE) $(srcdir)/Include/Python-ast.h $(srcdir)/Include/Python-ast.h.new
+	$(UPDATE_FILE) $(srcdir)/Include/internal/pycore_ast.h $(srcdir)/Include/internal/pycore_ast.h.new
+	$(UPDATE_FILE) $(srcdir)/Include/internal/pycore_ast_state.h $(srcdir)/Include/internal/pycore_ast_state.h.new
 	$(UPDATE_FILE) $(srcdir)/Python/Python-ast.c $(srcdir)/Python/Python-ast.c.new
 
 .PHONY: regen-opcode
@@ -876,6 +881,15 @@
 		$(srcdir)/Include/opcode.h.new
 	$(UPDATE_FILE) $(srcdir)/Include/opcode.h $(srcdir)/Include/opcode.h.new
 
+.PHONY: regen-frozen
+regen-frozen: Programs/_freeze_importlib
+	# Regenerate code for frozen module "__hello__".
+	./Programs/_freeze_importlib hello \
+		$(srcdir)/Tools/freeze/flag.py \
+		$(srcdir)/Python/frozen_hello.h.new
+	$(UPDATE_FILE) $(srcdir)/Python/frozen_hello.h \
+		$(srcdir)/Python/frozen_hello.h.new
+
 .PHONY: regen-token
 regen-token:
 	# Regenerate Doc/library/token-list.inc from Grammar/Tokens
@@ -909,15 +923,16 @@
 		$(srcdir)/Lib/keyword.py.new
 	$(UPDATE_FILE) $(srcdir)/Lib/keyword.py $(srcdir)/Lib/keyword.py.new
 
-.PHONY: regen-symbol
-regen-symbol: $(srcdir)/Include/graminit.h
-	# Regenerate Lib/symbol.py from Include/graminit.h
-	# using Tools/scripts/generate_symbol_py.py
-	$(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/generate_symbol_py.py \
-		$(srcdir)/Include/graminit.h \
-		$(srcdir)/Lib/symbol.py
+.PHONY: regen-stdlib-module-names
+regen-stdlib-module-names: build_all Programs/_testembed
+	# Regenerate Python/stdlib_module_names.h
+	# using Tools/scripts/generate_stdlib_module_names.py
+	$(RUNSHARED) ./$(BUILDPYTHON) \
+		$(srcdir)/Tools/scripts/generate_stdlib_module_names.py \
+		> $(srcdir)/Python/stdlib_module_names.h.new
+	$(UPDATE_FILE) $(srcdir)/Python/stdlib_module_names.h $(srcdir)/Python/stdlib_module_names.h.new
 
-Python/compile.o Python/symtable.o Python/ast_unparse.o Python/ast.o Python/future.o Parser/parsetok.o: $(srcdir)/Include/graminit.h $(srcdir)/Include/Python-ast.h
+Python/compile.o Python/symtable.o Python/ast_unparse.o Python/ast.o Python/future.o: $(srcdir)/Include/internal/pycore_ast.h
 
 Python/getplatform.o: $(srcdir)/Python/getplatform.c
 		$(CC) -c $(PY_CORE_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
@@ -979,7 +994,7 @@
 		$(srcdir)/Python/condvar.h
 
 Python/frozen.o: $(srcdir)/Python/importlib.h $(srcdir)/Python/importlib_external.h \
-		$(srcdir)/Python/importlib_zipimport.h
+		$(srcdir)/Python/importlib_zipimport.h $(srcdir)/Python/frozen_hello.h
 
 # Generate DTrace probe macros, then rename them (PYTHON_ -> PyDTrace_) to
 # follow our naming conventions. dtrace(1) uses the output filename to generate
@@ -1015,9 +1030,6 @@
 PYTHON_HEADERS= \
 		$(srcdir)/Include/Python.h \
 		$(srcdir)/Include/abstract.h \
-		$(srcdir)/Include/asdl.h \
-		$(srcdir)/Include/ast.h \
-		$(srcdir)/Include/bitset.h \
 		$(srcdir)/Include/bltinmodule.h \
 		$(srcdir)/Include/boolobject.h \
 		$(srcdir)/Include/bytearrayobject.h \
@@ -1055,22 +1067,15 @@
 		$(srcdir)/Include/modsupport.h \
 		$(srcdir)/Include/moduleobject.h \
 		$(srcdir)/Include/namespaceobject.h \
-		$(srcdir)/Include/node.h \
 		$(srcdir)/Include/object.h \
 		$(srcdir)/Include/objimpl.h \
-		$(srcdir)/Include/odictobject.h \
 		$(srcdir)/Include/opcode.h \
 		$(srcdir)/Include/osdefs.h \
 		$(srcdir)/Include/osmodule.h \
 		$(srcdir)/Include/patchlevel.h \
-		$(srcdir)/Include/picklebufobject.h \
-		$(srcdir)/Include/pyarena.h \
 		$(srcdir)/Include/pycapsule.h \
-		$(srcdir)/Include/pyctype.h \
-		$(srcdir)/Include/pydebug.h \
 		$(srcdir)/Include/pydtrace.h \
 		$(srcdir)/Include/pyerrors.h \
-		$(srcdir)/Include/pyfpe.h \
 		$(srcdir)/Include/pyframe.h \
 		$(srcdir)/Include/pyhash.h \
 		$(srcdir)/Include/pylifecycle.h \
@@ -1085,32 +1090,29 @@
 		$(srcdir)/Include/pystrtod.h \
 		$(srcdir)/Include/pythonrun.h \
 		$(srcdir)/Include/pythread.h \
-		$(srcdir)/Include/pytime.h \
 		$(srcdir)/Include/rangeobject.h \
 		$(srcdir)/Include/setobject.h \
 		$(srcdir)/Include/sliceobject.h \
 		$(srcdir)/Include/structmember.h \
 		$(srcdir)/Include/structseq.h \
-		$(srcdir)/Include/symtable.h \
 		$(srcdir)/Include/sysmodule.h \
 		$(srcdir)/Include/token.h \
 		$(srcdir)/Include/traceback.h \
 		$(srcdir)/Include/tracemalloc.h \
 		$(srcdir)/Include/tupleobject.h \
-		$(srcdir)/Include/ucnhash.h \
 		$(srcdir)/Include/unicodeobject.h \
 		$(srcdir)/Include/warnings.h \
 		$(srcdir)/Include/weakrefobject.h \
 		\
 		pyconfig.h \
 		$(PARSER_HEADERS) \
-		$(srcdir)/Include/Python-ast.h \
 		\
 		$(srcdir)/Include/cpython/abstract.h \
 		$(srcdir)/Include/cpython/bytearrayobject.h \
 		$(srcdir)/Include/cpython/bytesobject.h \
 		$(srcdir)/Include/cpython/ceval.h \
 		$(srcdir)/Include/cpython/code.h \
+		$(srcdir)/Include/cpython/compile.h \
 		$(srcdir)/Include/cpython/dictobject.h \
 		$(srcdir)/Include/cpython/fileobject.h \
 		$(srcdir)/Include/cpython/fileutils.h \
@@ -1122,10 +1124,17 @@
 		$(srcdir)/Include/cpython/methodobject.h \
 		$(srcdir)/Include/cpython/object.h \
 		$(srcdir)/Include/cpython/objimpl.h \
+		$(srcdir)/Include/cpython/odictobject.h \
+		$(srcdir)/Include/cpython/picklebufobject.h \
+		$(srcdir)/Include/cpython/pyctype.h \
+		$(srcdir)/Include/cpython/pydebug.h \
 		$(srcdir)/Include/cpython/pyerrors.h \
+		$(srcdir)/Include/cpython/pyfpe.h \
 		$(srcdir)/Include/cpython/pylifecycle.h \
 		$(srcdir)/Include/cpython/pymem.h \
 		$(srcdir)/Include/cpython/pystate.h \
+		$(srcdir)/Include/cpython/pythonrun.h \
+		$(srcdir)/Include/cpython/pytime.h \
 		$(srcdir)/Include/cpython/sysmodule.h \
 		$(srcdir)/Include/cpython/traceback.h \
 		$(srcdir)/Include/cpython/tupleobject.h \
@@ -1133,16 +1142,22 @@
 		\
 		$(srcdir)/Include/internal/pycore_abstract.h \
 		$(srcdir)/Include/internal/pycore_accu.h \
+		$(srcdir)/Include/internal/pycore_asdl.h \
+		$(srcdir)/Include/internal/pycore_ast.h \
+		$(srcdir)/Include/internal/pycore_ast_state.h \
 		$(srcdir)/Include/internal/pycore_atomic.h \
-		$(srcdir)/Include/internal/pycore_byteswap.h \
+		$(srcdir)/Include/internal/pycore_atomic_funcs.h \
+		$(srcdir)/Include/internal/pycore_bitutils.h \
 		$(srcdir)/Include/internal/pycore_bytes_methods.h \
 		$(srcdir)/Include/internal/pycore_call.h \
 		$(srcdir)/Include/internal/pycore_ceval.h \
 		$(srcdir)/Include/internal/pycore_code.h \
+		$(srcdir)/Include/internal/pycore_compile.h \
 		$(srcdir)/Include/internal/pycore_condvar.h \
 		$(srcdir)/Include/internal/pycore_context.h \
 		$(srcdir)/Include/internal/pycore_dtoa.h \
 		$(srcdir)/Include/internal/pycore_fileutils.h \
+		$(srcdir)/Include/internal/pycore_format.h \
 		$(srcdir)/Include/internal/pycore_getopt.h \
 		$(srcdir)/Include/internal/pycore_gil.h \
 		$(srcdir)/Include/internal/pycore_hamt.h \
@@ -1150,19 +1165,29 @@
 		$(srcdir)/Include/internal/pycore_import.h \
 		$(srcdir)/Include/internal/pycore_initconfig.h \
 		$(srcdir)/Include/internal/pycore_interp.h \
+		$(srcdir)/Include/internal/pycore_list.h \
+		$(srcdir)/Include/internal/pycore_long.h \
+		$(srcdir)/Include/internal/pycore_moduleobject.h \
 		$(srcdir)/Include/internal/pycore_object.h \
 		$(srcdir)/Include/internal/pycore_pathconfig.h \
+		$(srcdir)/Include/internal/pycore_pyarena.h \
 		$(srcdir)/Include/internal/pycore_pyerrors.h \
 		$(srcdir)/Include/internal/pycore_pyhash.h \
 		$(srcdir)/Include/internal/pycore_pylifecycle.h \
 		$(srcdir)/Include/internal/pycore_pymem.h \
 		$(srcdir)/Include/internal/pycore_pystate.h \
 		$(srcdir)/Include/internal/pycore_runtime.h \
+		$(srcdir)/Include/internal/pycore_structseq.h \
+		$(srcdir)/Include/internal/pycore_symtable.h \
 		$(srcdir)/Include/internal/pycore_sysmodule.h \
 		$(srcdir)/Include/internal/pycore_traceback.h \
-		$(srcdir)/Include/internal/pycore_tupleobject.h \
+		$(srcdir)/Include/internal/pycore_tuple.h \
+		$(srcdir)/Include/internal/pycore_ucnhash.h \
+		$(srcdir)/Include/internal/pycore_unionobject.h \
 		$(srcdir)/Include/internal/pycore_warnings.h \
-		$(DTRACE_HEADERS)
+		$(DTRACE_HEADERS) \
+		\
+		$(srcdir)/Python/stdlib_module_names.h
 
 $(LIBRARY_OBJS) $(MODOBJS) Programs/python.o: $(PYTHON_HEADERS)
 
@@ -1234,10 +1259,10 @@
 # SSL tests
 .PHONY: multisslcompile multissltest
 multisslcompile: build_all
-	$(RUNSHARED) ./$(BUILDPYTHON) Tools/ssl/multissltests.py --steps=modules
+	$(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/ssl/multissltests.py --steps=modules
 
 multissltest: build_all
-	$(RUNSHARED) ./$(BUILDPYTHON) Tools/ssl/multissltests.py
+	$(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/ssl/multissltests.py
 
 install: @FRAMEWORKINSTALLFIRST@ commoninstall bininstall maninstall @FRAMEWORKINSTALLLAST@
 	if test "x$(ENSUREPIP)" != "xno"  ; then \
@@ -1307,19 +1332,21 @@
 		fi; \
 		(cd $(DESTDIR)$(BINDIR); $(LN) python$(LDVERSION)$(EXE) python$(VERSION)$(EXE)); \
 	fi
-	if test -f $(LDLIBRARY) && test "$(PYTHONFRAMEWORKDIR)" = "no-framework" ; then \
-		if test -n "$(DLLLIBRARY)" ; then \
-			$(INSTALL_SHARED) $(DLLLIBRARY) $(DESTDIR)$(BINDIR); \
-		else \
-			$(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
-			if test $(LDLIBRARY) != $(INSTSONAME); then \
-				(cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) $(LDLIBRARY)) \
-			fi \
+	@if test "$(PY_ENABLE_SHARED)" = 1 -o "$(STATIC_LIBPYTHON)" = 1; then \
+		if test -f $(LDLIBRARY) && test "$(PYTHONFRAMEWORKDIR)" = "no-framework" ; then \
+			if test -n "$(DLLLIBRARY)" ; then \
+				$(INSTALL_SHARED) $(DLLLIBRARY) $(DESTDIR)$(BINDIR); \
+			else \
+				$(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
+				if test $(LDLIBRARY) != $(INSTSONAME); then \
+					(cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) $(LDLIBRARY)) \
+				fi \
+			fi; \
+			if test -n "$(PY3LIBRARY)"; then \
+				$(INSTALL_SHARED) $(PY3LIBRARY) $(DESTDIR)$(LIBDIR)/$(PY3LIBRARY); \
+			fi; \
+		else	true; \
 		fi; \
-		if test -n "$(PY3LIBRARY)"; then \
-			$(INSTALL_SHARED) $(PY3LIBRARY) $(DESTDIR)$(LIBDIR)/$(PY3LIBRARY); \
-		fi; \
-	else	true; \
 	fi
 	if test "x$(LIPO_32BIT_FLAGS)" != "x" ; then \
 		rm -f $(DESTDIR)$(BINDIR)python$(VERSION)-32$(EXE); \
@@ -1327,6 +1354,12 @@
 			-output $(DESTDIR)$(BINDIR)/python$(VERSION)-32$(EXE) \
 			$(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE); \
 	fi
+	if test "x$(LIPO_INTEL64_FLAGS)" != "x" ; then \
+		rm -f $(DESTDIR)$(BINDIR)python$(VERSION)-intel64$(EXE); \
+		lipo $(LIPO_INTEL64_FLAGS) \
+			-output $(DESTDIR)$(BINDIR)/python$(VERSION)-intel64$(EXE) \
+			$(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE); \
+	fi
 
 bininstall: altbininstall
 	if test ! -d $(DESTDIR)$(LIBPC); then \
@@ -1362,6 +1395,10 @@
 		rm -f $(DESTDIR)$(BINDIR)/python3-32$(EXE); \
 		(cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-32$(EXE) python3-32$(EXE)) \
 	fi
+	if test "x$(LIPO_INTEL64_FLAGS)" != "x" ; then \
+		rm -f $(DESTDIR)$(BINDIR)/python3-intel64$(EXE); \
+		(cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-intel64$(EXE) python3-intel64$(EXE)) \
+	fi
 
 # Install the versioned manual page
 altmaninstall:
@@ -1383,18 +1420,54 @@
 
 # Install the library
 XMLLIBSUBDIRS=  xml xml/dom xml/etree xml/parsers xml/sax
-LIBSUBDIRS=	tkinter tkinter/test tkinter/test/test_tkinter \
-		tkinter/test/test_ttk site-packages test \
-		test/audiodata \
-		test/capath test/data \
-		test/cjkencodings test/decimaltestdata \
-		test/xmltestdata test/xmltestdata/c14n-20 \
-		test/dtracedata \
-		test/eintrdata \
-		test/imghdrdata \
-		test/libregrtest \
-		test/subprocessdata test/sndhdrdata test/support \
-		test/tracedmodules test/encoded_modules \
+LIBSUBDIRS=	asyncio \
+		collections \
+		concurrent concurrent/futures \
+		csv \
+		ctypes ctypes/macholib \
+		curses \
+		dbm \
+		distutils distutils/command \
+		email email/mime \
+		encodings \
+		ensurepip ensurepip/_bundled \
+		html \
+		http \
+		idlelib idlelib/Icons \
+		importlib importlib/metadata \
+		json \
+		lib2to3 lib2to3/fixes lib2to3/pgen2 \
+		logging \
+		multiprocessing multiprocessing/dummy \
+		pydoc_data \
+		site-packages \
+		sqlite3 \
+		tkinter \
+		turtledemo \
+		unittest \
+		urllib \
+		venv venv/scripts venv/scripts/common venv/scripts/posix \
+		wsgiref \
+		$(XMLLIBSUBDIRS) \
+		xmlrpc \
+		zoneinfo
+TESTSUBDIRS=	ctypes/test \
+		distutils/tests \
+		idlelib/idle_test \
+		lib2to3/tests \
+		lib2to3/tests/data \
+		lib2to3/tests/data/fixers \
+		lib2to3/tests/data/fixers/myfixes \
+		sqlite3/test \
+		test test/audiodata \
+		test/capath test/cjkencodings \
+		test/data test/decimaltestdata \
+		test/dtracedata test/eintrdata \
+		test/encoded_modules test/imghdrdata \
+		test/libregrtest test/sndhdrdata \
+		test/subprocessdata test/support \
+		test/test_asyncio \
+		test/test_email test/test_email/data \
 		test/test_import \
 		test/test_import/data \
 		test/test_import/data/circular_imports \
@@ -1402,8 +1475,6 @@
 		test/test_import/data/package \
 		test/test_import/data/package2 \
 		test/test_import/data/unwritable \
-		importlib \
-		importlib/metadata \
 		test/test_importlib \
 		test/test_importlib/builtin \
 		test/test_importlib/data \
@@ -1439,33 +1510,24 @@
 		test/test_importlib/namespace_pkgs/project3 \
 		test/test_importlib/namespace_pkgs/project3/parent \
 		test/test_importlib/namespace_pkgs/project3/parent/child \
+		test/test_importlib/namespacedata01 \
+		test/test_importlib/partial \
 		test/test_importlib/source \
 		test/test_importlib/zipdata01 \
 		test/test_importlib/zipdata02 \
-		test/test_zoneinfo test/test_zoneinfo/data \
-		test/ziptestdata \
-		asyncio \
-		test/test_asyncio \
-		collections concurrent concurrent/futures encodings \
-		email email/mime test/test_email test/test_email/data \
-		ensurepip ensurepip/_bundled \
-		html json test/test_json http dbm xmlrpc \
-		sqlite3 sqlite3/test \
-		logging csv wsgiref urllib \
-		lib2to3 lib2to3/fixes lib2to3/pgen2 lib2to3/tests \
-		lib2to3/tests/data lib2to3/tests/data/fixers \
-		lib2to3/tests/data/fixers/myfixes \
-		ctypes ctypes/test ctypes/macholib \
-		idlelib idlelib/Icons idlelib/idle_test \
-		distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \
+		test/test_json \
 		test/test_peg_generator \
-		test/test_tools test/test_warnings test/test_warnings/data \
-		turtledemo \
-		multiprocessing multiprocessing/dummy \
-		unittest unittest/test unittest/test/testmock \
-		venv venv/scripts venv/scripts/common venv/scripts/posix \
-		curses pydoc_data \
-		zoneinfo
+		test/test_tools \
+		test/test_warnings test/test_warnings/data \
+		test/test_zoneinfo test/test_zoneinfo/data \
+		test/tracedmodules \
+		test/xmltestdata test/xmltestdata/c14n-20 \
+		test/ziptestdata \
+		tkinter/test tkinter/test/test_tkinter \
+		tkinter/test/test_ttk \
+		unittest/test unittest/test/testmock
+
+TEST_MODULES=@TEST_MODULES@
 libinstall:	build_all $(srcdir)/Modules/xxmodule.c
 	@for i in $(SCRIPTDIR) $(LIBDEST); \
 	do \
@@ -1475,7 +1537,12 @@
 		else	true; \
 		fi; \
 	done
-	@for d in $(LIBSUBDIRS); \
+	@if test "$(TEST_MODULES)" = yes; then \
+		subdirs="$(LIBSUBDIRS) $(TESTSUBDIRS)"; \
+	else \
+		subdirs="$(LIBSUBDIRS)"; \
+	fi; \
+	for d in $$subdirs; \
 	do \
 		a=$(srcdir)/Lib/$$d; \
 		if test ! -d $$a; then continue; else true; fi; \
@@ -1496,7 +1563,12 @@
 			echo $(INSTALL_DATA) $$i $(LIBDEST); \
 		fi; \
 	done
-	@for d in $(LIBSUBDIRS); \
+	@if test "$(TEST_MODULES)" = yes; then \
+		subdirs="$(LIBSUBDIRS) $(TESTSUBDIRS)"; \
+	else \
+		subdirs="$(LIBSUBDIRS)"; \
+	fi; \
+	for d in $$subdirs; \
 	do \
 		a=$(srcdir)/Lib/$$d; \
 		if test ! -d $$a; then continue; else true; fi; \
@@ -1508,7 +1580,6 @@
 			*CVS) ;; \
 			*.py[co]) ;; \
 			*.orig) ;; \
-			*wininst-*.exe) ;; \
 			*~) ;; \
 			*) \
 				if test -d $$i; then continue; fi; \
@@ -1623,7 +1694,7 @@
 LIBPC=		$(LIBDIR)/pkgconfig
 
 libainstall:	@DEF_MAKE_RULE@ python-config
-	@for i in $(LIBDIR) $(LIBPL) $(LIBPC); \
+	@for i in $(LIBDIR) $(LIBPL) $(LIBPC) $(BINDIR); \
 	do \
 		if test ! -d $(DESTDIR)$$i; then \
 			echo "Creating directory $$i"; \
@@ -1631,19 +1702,21 @@
 		else	true; \
 		fi; \
 	done
-	@if test -d $(LIBRARY); then :; else \
-		if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
-			if test "$(SHLIB_SUFFIX)" = .dll; then \
-				$(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
+	@if test "$(STATIC_LIBPYTHON)" = 1; then \
+		if test -d $(LIBRARY); then :; else \
+			if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
+				if test "$(SHLIB_SUFFIX)" = .dll; then \
+					$(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
+				else \
+					$(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
+				fi; \
 			else \
-				$(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
+				echo Skip install of $(LIBRARY) - use make frameworkinstall; \
 			fi; \
-		else \
-			echo Skip install of $(LIBRARY) - use make frameworkinstall; \
 		fi; \
+		$(INSTALL_DATA) Programs/python.o $(DESTDIR)$(LIBPL)/python.o; \
 	fi
 	$(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
-	$(INSTALL_DATA) Programs/python.o $(DESTDIR)$(LIBPL)/python.o
 	$(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
 	$(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
 	$(INSTALL_DATA) $(srcdir)/Modules/Setup $(DESTDIR)$(LIBPL)/Setup
@@ -1666,7 +1739,7 @@
 		$(INSTALL_SCRIPT) Modules/ld_so_aix	\
 				$(DESTDIR)$(LIBPL)/ld_so_aix;		\
 		echo "$(LIBPL)/ld_so_aix";			\
-		echo; echo "See Misc/AIX-NOTES for details.";	\
+		echo; echo "See Misc/README.AIX for details.";	\
 	else true; \
 	fi
 
@@ -1889,7 +1962,7 @@
 
 # Check that all symbols exported by libpython start with "Py" or "_Py"
 smelly: @DEF_MAKE_RULE@
-	$(RUNSHARED) ./$(BUILDPYTHON) Tools/scripts/smelly.py
+	$(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/smelly.py
 
 # Find files with funny names
 funny:
@@ -1926,6 +1999,15 @@
 patchcheck: @DEF_MAKE_RULE@
 	$(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py
 
+check-limited-abi: all
+	$(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/stable_abi.py --all $(srcdir)/Misc/stable_abi.txt
+
+.PHONY: update-config
+update-config:
+	curl -sL -o config.guess 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD'
+	curl -sL -o config.sub 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD'
+	chmod +x config.guess config.sub
+
 # Dependencies
 
 Python/thread.o: @THREADHEADERS@ $(srcdir)/Python/condvar.h
diff --git a/Misc/ACKS b/Misc/ACKS
index 12a5ac1..7668caf 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -33,6 +33,7 @@
 Akira
 Yaniv Aknin
 Jyrki Alakuijala
+Tatiana Al-Chueyr
 Steve Alexander
 Fred Allen
 Jeff Allen
@@ -135,11 +136,14 @@
 Torsten Becker
 Bill Bedford
 Michał Bednarski
+Bas van Beek
 Ian Beer
 Stefan Behnel
 Reimer Behrends
+Maxime Bélanger
 Ben Bell
 Thomas Bellman
+John Belmonte
 Alexander “Саша” Belopolsky
 Eli Bendersky
 Nikhil Benesch
@@ -154,6 +158,7 @@
 Julian Berman
 Brice Berna
 Olivier Bernard
+Vivien Bernet-Rollande
 Maxwell Bernstein
 Eric Beser
 Steven Bethard
@@ -185,6 +190,7 @@
 Matthew Boedicker
 Robin Boerdijk
 Andra Bogildea
+Matt Bogosian
 Nikolay Bogoychev
 David Bolen
 Wouter Bolsterlee
@@ -192,6 +198,7 @@
 Carl Friedrich Bolz-Tereick
 Forest Bond
 Gregory Bond
+Angelin Booz
 Médéric Boquien
 Matias Bordese
 Jonas Borgström
@@ -202,6 +209,7 @@
 Thierry Bousch
 Sebastian Boving
 Michal Bozon
+Arseny Boykov
 Jeff Bradberry
 Chris Bradbury
 Aaron Brancotti
@@ -220,6 +228,7 @@
 Anthony Briggs
 Keith Briggs
 Tobias Brink
+Miguel Brito
 Dillon Brock
 Richard Brodie
 Michael Broghton
@@ -268,6 +277,7 @@
 Tony Campbell
 Giovanni Cappellotto
 Brett Cannon
+Joshua Cannon
 Tristan Carel
 Mike Carlton
 Pierre Carrier
@@ -307,6 +317,7 @@
 Adal Chiriliuc
 Matt Chisholm
 Lita Cho
+Kit Yan Choi
 Sayan Chowdhury
 Yuan-Chao Chou
 Anders Chrigström
@@ -354,6 +365,7 @@
 David Costanzo
 Scott Cotton
 Greg Couch
+FX Coudert
 David Cournapeau
 Julien Courteau
 Steve Cousins
@@ -364,6 +376,7 @@
 Christopher A. Craig
 Jeremy Craven
 Laura Creighton
+Nick Crews
 Tyler Crompton
 Simon Cross
 Felipe Cruz
@@ -379,7 +392,7 @@
 Jason Curtis
 Hakan Celik
 Paul Dagnelie
-Florian Dahlitz 
+Florian Dahlitz
 Lisandro Dalcin
 Darren Dale
 Andrew Dalke
@@ -387,6 +400,7 @@
 Evan Dandrea
 Eric Daniel
 Scott David Daniels
+Lawrence D'Anna
 Ben Darnell
 Kushal Das
 Jonathan Dasteel
@@ -414,6 +428,7 @@
 Catherine Devlin
 Scott Dial
 Alon Diamant
+Lital Natan
 Toby Dickenson
 Mark Dickinson
 Jack Diederich
@@ -610,6 +625,7 @@
 Tim Golden
 Yonatan Goldschmidt
 Mark Gollahon
+Mikhail Golubev
 Guilherme Gonçalves
 Tiago Gonçalves
 Chris Gonnerman
@@ -628,6 +644,7 @@
 Duncan Grisby
 Olivier Grisel
 Fabian Groffen
+Linus Groh
 Eric Groo
 Daniel Andrade Groppe
 Dag Gruneau
@@ -637,6 +654,7 @@
 Thomas Guettler
 Yuyang Guo
 Anuj Gupta
+Om Gupta
 Michael Guravage
 Lars Gustäbel
 Thomas Güttler
@@ -661,6 +679,7 @@
 Mark Hammond
 Harald Hanche-Olsen
 Manus Hand
+Andreas Hangauer
 Milton L. Hankins
 Carl Bordum Hansen
 Stephen Hansen
@@ -683,6 +702,7 @@
 Janko Hauser
 Flavian Hautbois
 Rycharde Hawkes
+Yahor Harunovich
 Ben Hayden
 Jochen Hayek
 Tim Heaney
@@ -711,6 +731,7 @@
 Wouter van Heyst
 Kelsey Hightower
 Jason Hildebrand
+Ryan Hileman
 Aaron Hill
 Joel Hillacre
 Richie Hindle
@@ -719,6 +740,7 @@
 Tim Hochberg
 Benjamin Hodgson
 Joerg-Cyril Hoehle
+Douwe Hoekstra
 Gregor Hoffleit
 Chris Hoffman
 Tim Hoffmann
@@ -738,6 +760,7 @@
 Craig Holmquist
 Philip Homburg
 Naofumi Honda
+Weipeng Hong
 Jeffrey Honig
 Rob Hooft
 Michiel de Hoon
@@ -753,6 +776,7 @@
 Brad Howes
 Mike Hoy
 Ben Hoyt
+Tomáš Hrnčiar
 Miro Hrončok
 Chiu-Hsiang Hsu
 Chih-Hao Huang
@@ -760,6 +784,7 @@
 Benoît Hudson
 Lawrence Hudson
 Michael Hudson
+Roberto Hueso Gomez
 Jim Hugunin
 Greg Humphreys
 Chris Hunt
@@ -773,6 +798,7 @@
 Florian Höch
 Oleg Höfling
 Robert Hölzl
+Stefan Hölzl
 Catalin Iacob
 Mihai Ibanescu
 Ali Ikinci
@@ -803,6 +829,7 @@
 Jack Jansen
 Hans-Peter Jansen
 Bill Janssen
+Hans Petter Jansson
 Jon Janzen
 Thomas Jarosch
 Juhana Jauhiainen
@@ -861,6 +888,7 @@
 Anton Kasyanov
 Lou Kates
 Makoto Kato
+Irit Katriel
 Hiroaki Kawai
 Dmitry Kazakov
 Brian Kearns
@@ -888,7 +916,9 @@
 Tomohiko Kinebuchi
 James King
 W. Trevor King
+Jeffrey Kintscher
 Paul Kippes
+Sergey B Kirpichev
 Steve Kirsch
 Sebastian Kirsche
 Kamil Kisiel
@@ -942,8 +972,10 @@
 Anselm Kruis
 Steven Kryskalla
 Andrew Kuchling
+Jakub Kuczys
 Dave Kuhlman
 Jon Kuhn
+Andrei Kulakov
 Ilya Kulakov
 Upendra Kumar
 Toshio Kuratomi
@@ -1086,6 +1118,7 @@
 David Marek
 Doug Marien
 Sven Marnach
+John Marshall
 Alex Martelli
 Dennis Mårtensson
 Anthony Martin
@@ -1254,6 +1287,7 @@
 Furkan Onder
 Koray Oner
 Ethan Onstott
+Ken Jin Ooi
 Piet van Oostrum
 Tomas Oppelstrup
 Jason Orendorff
@@ -1270,8 +1304,11 @@
 Michael Otteneder
 Richard Oudkerk
 Russel Owen
+Noah Oxer
 Joonas Paalasmaa
+Yaroslav Pankovych
 Martin Packman
+Elisha Paine
 Shriphani Palakodety
 Julien Palard
 Aviv Palivoda
@@ -1347,6 +1384,7 @@
 Antoine Pitrou
 Jean-François Piéronne
 Oleg Plakhotnyuk
+Anatoliy Platonov
 Marcel Plch
 Remi Pointel
 Jon Poler
@@ -1362,6 +1400,7 @@
 Davin Potts
 Guillaume Pratte
 Florian Preinstorfer
+Alex Prengère
 Amrit Prem
 Paul Prescod
 Donovan Preston
@@ -1428,6 +1467,7 @@
 Wes Rishel
 Daniel Riti
 Juan M. Bello Rivas
+Llandy Riveron Del Risco
 Mohd Sanad Zaki Rizvi
 Davide Rizzo
 Anthony Roach
@@ -1443,6 +1483,7 @@
 Kevin Rodgers
 Sean Rodman
 Giampaolo Rodola
+Dustin Rodrigues
 Mauro S. M. Rodrigues
 Elson Rodriguez
 Adi Roiban
@@ -1483,6 +1524,7 @@
 Rusty Russell
 Nick Russo
 James Rutherford
+Eli Rykoff
 Chris Ryland
 Bernt Røskar Brenna
 Constantina S.
@@ -1570,6 +1612,8 @@
 Akash Shende
 Charlie Shepherd
 Bruce Sherwood
+Gregory Shevchenko
+Hai Shi
 Alexander Shigin
 Pete Shinners
 Michael Shiplett
@@ -1581,6 +1625,7 @@
 Jaysinh Shukla
 Terrel Shumway
 Eric Siegerman
+Reilly Tucker Siemens
 Paul Sijben
 SilentGhost
 Tim Silk
@@ -1606,6 +1651,7 @@
 Michael Sloan
 Nick Sloan
 Václav Šmilauer
+Casper W. Smet
 Allen W. Smith
 Christopher Smith
 Eric V. Smith
@@ -1625,6 +1671,7 @@
 Cody Somerville
 Anthony Sottile
 Edoardo Spadolini
+Tom Sparrow
 Geoffrey Spear
 Clay Spence
 Stefan Sperling
@@ -1638,8 +1685,10 @@
 Tage Stabell-Kulo
 Quentin Stafford-Fraser
 Frank Stajano
+Manolis Stamatogiannakis
 Joel Stanley
 Kyle Stanley
+Brandon Stansbury
 Anthony Starks
 David Steele
 Oliver Steele
@@ -1684,6 +1733,7 @@
 John Szakmeister
 Piotr Szczepaniak
 Amir Szekely
+David Szotten
 Maciej Szulik
 Joel Taddei
 Arfrever Frehtes Taifersar Arahesis
@@ -1769,16 +1819,19 @@
 Utkarsh Upadhyay
 Roger Upole
 Daniel Urban
+Matthias Urlichs
 Michael Urman
 Hector Urtubia
 Elizabeth Uselton
 Lukas Vacek
+Juho Vähä-Herttua
 Ville Vainio
 Yann Vaginay
 Andi Vajda
 Case Van Horsen
 John Mark Vandenberg
 Kyle VanderBeek
+Wm. Keith van der Meulen
 Eric N. Vander Weele
 Andrew Vant
 Atul Varma
@@ -1807,6 +1860,7 @@
 Michael Vogt
 Radu Voicilas
 Alex Volkov
+Ruben Vorderman
 Guido Vranken
 Martijn Vries
 Sjoerd de Vries
@@ -1817,6 +1871,7 @@
 Charles Waldman
 Richard Walker
 Larry Wall
+Jacob Walls
 Kevin Walzer
 Rodrigo Steinmuller Wanderley
 Dingyuan Wang
@@ -1828,8 +1883,10 @@
 Barry Warsaw
 Steve Waterbury
 Bob Watson
+Colin Watson
 David Watson
 Aaron Watters
+Alex Waygood
 Henrik Weber
 Leon Weber
 Steve Weber
@@ -1892,6 +1949,7 @@
 Klaus-Juergen Wolf
 Dan Wolfe
 Richard Wolff
+Tymoteusz Wołodźko
 Adam Woodbeck
 William Woodruff
 Steven Work
diff --git a/Misc/HISTORY b/Misc/HISTORY
index 32b2a37..32d814c 100644
--- a/Misc/HISTORY
+++ b/Misc/HISTORY
@@ -1429,7 +1429,7 @@
   by Devin Cook.
 
 - Lax cookie parsing in http.cookies could be a security issue when combined
-  with non-standard cookie handling in some Web browsers.  Reported by
+  with non-standard cookie handling in some web browsers.  Reported by
   Sergey Bobrov.
 
 - Issue #22384: An exception in Tkinter callback no longer crashes the program
@@ -10380,7 +10380,7 @@
 
 - Avoid failing in test_robotparser when mueblesmoraleda.com is flaky and
   an overzealous DNS service (e.g. OpenDNS) redirects to a placeholder
-  Web site.
+  web site.
 
 - Avoid failing in test_urllibnet.test_bad_address when some overzealous
   DNS service (e.g. OpenDNS) resolves a non-existent domain name.  The test
@@ -11273,7 +11273,7 @@
 
 - Issue #10549: Fix pydoc traceback when text-documenting certain classes.
 
-- Issue #2001: New HTML server with enhanced Web page features.  Patch by Ron
+- Issue #2001: New HTML server with enhanced web page features.  Patch by Ron
   Adam.
 
 - Issue #10360: In WeakSet, do not raise TypeErrors when testing for membership
@@ -21043,7 +21043,7 @@
   own when any program opens a socket.  IDLE does use sockets, talking
   on the computer's internal loopback interface.  This connection is not
   visible on any external interface and no data is sent to or received
-  from the Internet.  So, if you get such a dialog when opening IDLE,
+  from the internet.  So, if you get such a dialog when opening IDLE,
   asking whether to let pythonw.exe talk to address 127.0.0.1, say yes,
   and rest assured no communication external to your machine is taking
   place.  If you don't allow it, IDLE won't be able to start.
@@ -32325,7 +32325,7 @@
 of that chapter.)
 
 
-Changes to the WWW and Internet tools
+Changes to the WWW and internet tools
 =====================================
 
 The "htmllib" module has been rewritten in an incompatible fashion.
@@ -32485,7 +32485,7 @@
 
 - The Library Reference has been restructured, and many new and
 existing modules are now documented, in particular the debugger and
-the profiler, as well as the persistency and the WWW/Internet support
+the profiler, as well as the persistency and the WWW/internet support
 modules.
 
 - All known bugs have been fixed.  For example the pow(2,2,3L) bug on
@@ -32720,7 +32720,7 @@
 
     - types.py defines standard names for built-in types, e.g. StringType
 
-    - urlparse.py parses URLs according to the latest Internet draft
+    - urlparse.py parses URLs according to the latest internet draft
 
     - uu.py does uuencode/uudecode (not the fastest in the world, but
     quicker than installing uuencode on a non-UNIX machine :-)
diff --git a/Misc/NEWS.d/3.10.0.rst b/Misc/NEWS.d/3.10.0.rst
new file mode 100644
index 0000000..9911344
--- /dev/null
+++ b/Misc/NEWS.d/3.10.0.rst
@@ -0,0 +1,95 @@
+.. bpo: 45121
+.. date: 2021-09-07-17-10-16
+.. nonce: iG-Hsf
+.. release date: 2021-10-04
+.. section: Core and Builtins
+
+Fix issue where ``Protocol.__init__`` raises ``RecursionError`` when it's
+called directly or via ``super()``. Patch provided by Yurii Karabas.
+
+..
+
+.. bpo: 45234
+.. date: 2021-09-17-11-20-55
+.. nonce: qUcTVt
+.. section: Library
+
+Fixed a regression in :func:`~shutil.copyfile`, :func:`~shutil.copy`,
+:func:`~shutil.copy2` raising :exc:`FileNotFoundError` when source is a
+directory, which should raise :exc:`IsADirectoryError`
+
+..
+
+.. bpo: 45216
+.. date: 2021-09-18-13-45-19
+.. nonce: o56nyt
+.. section: Documentation
+
+Remove extra documentation listing methods in ``difflib``. It was rendering
+twice in pydoc and was outdated in some places.
+
+..
+
+.. bpo: 45024
+.. date: 2021-09-08-17-20-19
+.. nonce: dkNPNi
+.. section: Documentation
+
+:mod:`collections.abc` documentation has been expanded to explicitly cover
+how instance and subclass checks work, with additional doctest examples and
+an exhaustive list of ABCs which test membership purely by presence of the
+right :term:`special method`\s. Patch by Raymond Hettinger.
+
+..
+
+.. bpo: 45128
+.. date: 2021-09-16-17-22-35
+.. nonce: Jz6fl2
+.. section: Tests
+
+Fix ``test_multiprocessing_fork`` failure due to ``test_logging`` and
+``sys.modules`` manipulation.
+
+..
+
+.. bpo: 44860
+.. date: 2021-09-08-13-01-37
+.. nonce: qXd0kx
+.. section: Tests
+
+Update ``test_sysconfig.test_user_similar()`` for the posix_user scheme:
+``platlib`` doesn't use :data:`sys.platlibdir`. Patch by Victor Stinner.
+
+..
+
+.. bpo: 45067
+.. date: 2021-09-09-16-45-26
+.. nonce: mFmY92
+.. section: Build
+
+The ncurses function extended_color_content was introduced in 2017
+
+(https://invisible-island.net/ncurses/NEWS.html#index-t20170401).  The
+
+ncurses-devel package in CentOS 7 had a older version ncurses resulted in
+compilation error.  For compiling ncurses with extended color support, we
+verify the version of the ncurses library >= 20170401.
+
+..
+
+.. bpo: 45193
+.. date: 2021-09-15-03-20-06
+.. nonce: G61_GV
+.. section: IDLE
+
+Make completion boxes appear on Ubuntu again.
+
+..
+
+.. bpo: 45307
+.. date: 2021-09-28-12-00-55
+.. nonce: 3ETFfX
+.. section: C API
+
+Restore the private C API function :func:`_PyImport_FindExtensionObject`. It
+will be removed in Python 3.11.
diff --git a/Misc/NEWS.d/3.10.0a1.rst b/Misc/NEWS.d/3.10.0a1.rst
new file mode 100644
index 0000000..1c1c2d5
--- /dev/null
+++ b/Misc/NEWS.d/3.10.0a1.rst
@@ -0,0 +1,3509 @@
+.. bpo: 41304
+.. date: 2020-07-15-20-15-08
+.. nonce: vNEeYA
+.. release date: 2020-10-05
+.. section: Security
+
+Fixes `python3x._pth` being ignored on Windows, caused by the fix for
+:issue:`29778` (CVE-2020-15801).
+
+..
+
+.. bpo: 41162
+.. date: 2020-07-03-20-41-29
+.. nonce: tb8pVj
+.. section: Security
+
+Audit hooks are now cleared later during finalization to avoid missing
+events.
+
+..
+
+.. bpo: 29778
+.. date: 2020-07-03-17-21-37
+.. nonce: cR_fGS
+.. section: Security
+
+Ensure :file:`python3.dll` is loaded from correct locations when Python is
+embedded (CVE-2020-15523).
+
+..
+
+.. bpo: 41004
+.. date: 2020-06-29-16-02-29
+.. nonce: ovF0KZ
+.. section: Security
+
+The __hash__() methods of  ipaddress.IPv4Interface and
+ipaddress.IPv6Interface incorrectly generated constant hash values of 32 and
+128 respectively. This resulted in always causing hash collisions. The fix
+uses hash() to generate hash values for the tuple of (address, mask length,
+network address).
+
+..
+
+.. bpo: 39603
+.. date: 2020-02-12-14-17-39
+.. nonce: Gt3RSg
+.. section: Security
+
+Prevent http header injection by rejecting control characters in
+http.client.putrequest(...).
+
+..
+
+.. bpo: 41909
+.. date: 2020-10-04-10-55-12
+.. nonce: BqHPcm
+.. section: Core and Builtins
+
+Fixed stack overflow in :func:`issubclass` and :func:`isinstance` when
+getting the ``__bases__`` attribute leads to infinite recursion.
+
+..
+
+.. bpo: 41922
+.. date: 2020-10-04-01-02-58
+.. nonce: kHGT8I
+.. section: Core and Builtins
+
+Speed up calls to ``reversed()`` by using the :pep:`590` ``vectorcall``
+calling convention. Patch by Dong-hee Na.
+
+..
+
+.. bpo: 41873
+.. date: 2020-09-28-08-58-28
+.. nonce: VzEDhA
+.. section: Core and Builtins
+
+Calls to ``float()`` are now faster due to the ``vectorcall`` calling
+convention. Patch by Dennis Sweeney.
+
+..
+
+.. bpo: 41870
+.. date: 2020-09-27-22-23-14
+.. nonce: 2v6_v4
+.. section: Core and Builtins
+
+Speed up calls to ``bool()`` by using the :pep:`590` ``vectorcall`` calling
+convention. Patch by Dong-hee Na.
+
+..
+
+.. bpo: 1635741
+.. date: 2020-09-26-14-43-30
+.. nonce: aJS9B3
+.. section: Core and Builtins
+
+Port the :mod:`_bisect` module to the multi-phase initialization API
+(:pep:`489`).
+
+..
+
+.. bpo: 39934
+.. date: 2020-09-24-12-15-45
+.. nonce: YVHTCF
+.. section: Core and Builtins
+
+Correctly count control blocks in 'except' in compiler. Ensures that a
+syntax error, rather a fatal error, occurs for deeply nested, named
+exception handlers.
+
+..
+
+.. bpo: 41780
+.. date: 2020-09-15-23-29-49
+.. nonce: bOBUIH
+.. section: Core and Builtins
+
+Fix :meth:`__dir__` of :class:`types.GenericAlias`. Patch by Batuhan
+Taskaya.
+
+..
+
+.. bpo: 1635741
+.. date: 2020-09-12-18-34-34
+.. nonce: lh335O
+.. section: Core and Builtins
+
+Port the :mod:`_lsprof` extension module to multi-phase initialization
+(:pep:`489`).
+
+..
+
+.. bpo: 1635741
+.. date: 2020-09-08-21-58-47
+.. nonce: vdjSLH
+.. section: Core and Builtins
+
+Port the :mod:`cmath` extension module to multi-phase initialization
+(:pep:`489`).
+
+..
+
+.. bpo: 1635741
+.. date: 2020-09-08-20-39-43
+.. nonce: jiXmyT
+.. section: Core and Builtins
+
+Port the :mod:`_scproxy` extension module to multi-phase initialization
+(:pep:`489`).
+
+..
+
+.. bpo: 1635741
+.. date: 2020-09-07-11-35-02
+.. nonce: rvIexb
+.. section: Core and Builtins
+
+Port the :mod:`termios` extension module to multi-phase initialization
+(:pep:`489`).
+
+..
+
+.. bpo: 1635741
+.. date: 2020-09-07-09-45-47
+.. nonce: QuDIut
+.. section: Core and Builtins
+
+Convert the :mod:`_sha256` extension module types to heap types.
+
+..
+
+.. bpo: 41690
+.. date: 2020-09-02-12-00-57
+.. nonce: Ny-Sfy
+.. section: Core and Builtins
+
+Fix a possible stack overflow in the parser when parsing functions and
+classes with a huge amount of arguments. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 1635741
+.. date: 2020-09-01-17-22-35
+.. nonce: CnRME3
+.. section: Core and Builtins
+
+Port the :mod:`_overlapped` extension module to multi-phase initialization
+(:pep:`489`).
+
+..
+
+.. bpo: 1635741
+.. date: 2020-09-01-17-08-07
+.. nonce: X9CZgo
+.. section: Core and Builtins
+
+Port the :mod:`_curses_panel` extension module to multi-phase initialization
+(:pep:`489`).
+
+..
+
+.. bpo: 1635741
+.. date: 2020-09-01-17-06-02
+.. nonce: 5jZymK
+.. section: Core and Builtins
+
+Port the :mod:`_opcode` extension module to multi-phase initialization
+(:pep:`489`).
+
+..
+
+.. bpo: 41681
+.. date: 2020-08-31-17-49-02
+.. nonce: 3-VJiH
+.. section: Core and Builtins
+
+Fixes the wrong error description in the error raised by using 2 `,` in
+format string in f-string and :meth:`str.format`.
+
+..
+
+.. bpo: 41675
+.. date: 2020-08-31-14-53-17
+.. nonce: VSoqWU
+.. section: Core and Builtins
+
+The implementation of :func:`signal.siginterrupt` now uses
+:c:func:`sigaction` (if it is available in the system) instead of the
+deprecated :c:func:`siginterrupt`. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 41670
+.. date: 2020-08-31-11-37-59
+.. nonce: vmRJRx
+.. section: Core and Builtins
+
+Prevent line trace being skipped on platforms not compiled with
+``USE_COMPUTED_GOTOS``. Fixes issue where some lines nested within a
+try-except block were not being traced on Windows.
+
+..
+
+.. bpo: 41654
+.. date: 2020-08-30-20-38-33
+.. nonce: HtnhAM
+.. section: Core and Builtins
+
+Fix a crash that occurred when destroying subclasses of
+:class:`MemoryError`. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 1635741
+.. date: 2020-08-28-20-54-04
+.. nonce: 7ijlcI
+.. section: Core and Builtins
+
+Port the :mod:`zlib` extension module to multi-phase initialization
+(:pep:`489`).
+
+..
+
+.. bpo: 41631
+.. date: 2020-08-26-11-23-31
+.. nonce: 3jZcd9
+.. section: Core and Builtins
+
+The ``_ast`` module uses again a global state. Using a module state per
+module instance is causing subtle practical problems. For example, the
+Mercurial project replaces the ``__import__()`` function to implement lazy
+import, whereas Python expected that ``import _ast`` always return a fully
+initialized ``_ast`` module.
+
+..
+
+.. bpo: 40077
+.. date: 2020-08-25-22-43-33
+.. nonce: vcxSUa
+.. section: Core and Builtins
+
+Convert :mod:`_operator` to use :c:func:`PyType_FromSpec`.
+
+..
+
+.. bpo: 1653741
+.. date: 2020-08-13-07-19-21
+.. nonce: fubBkb
+.. section: Core and Builtins
+
+Port :mod:`_sha3` to multi-phase init.  Convert static types to heap types.
+
+..
+
+.. bpo: 1635741
+.. date: 2020-08-13-07-18-05
+.. nonce: FC13e7
+.. section: Core and Builtins
+
+Port the :mod:`_blake2` extension module to the multi-phase initialization
+API (:pep:`489`).
+
+..
+
+.. bpo: 41533
+.. date: 2020-08-12-20-29-57
+.. nonce: 4pcVAc
+.. section: Core and Builtins
+
+Free the stack allocated in ``va_build_stack`` if ``do_mkstack`` fails and
+the stack is not a ``small_stack``.
+
+..
+
+.. bpo: 41531
+.. date: 2020-08-12-19-32-15
+.. nonce: WgPzjT
+.. section: Core and Builtins
+
+Fix a bug that was dropping keys when compiling dict literals with more than
+0xFFFF elements. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 41525
+.. date: 2020-08-12-07-35-07
+.. nonce: d9q3XL
+.. section: Core and Builtins
+
+The output of ``python --help`` contains now only ASCII characters.
+
+..
+
+.. bpo: 1635741
+.. date: 2020-08-10-16-11-32
+.. nonce: O0d3ym
+.. section: Core and Builtins
+
+Port the :mod:`_sha1`, :mod:`_sha512`, and :mod:`_md5` extension modules to
+multi-phase initialization API (:pep:`489`).
+
+..
+
+.. bpo: 41431
+.. date: 2020-08-02-15-53-12
+.. nonce: TblUBT
+.. section: Core and Builtins
+
+Optimize ``dict_merge()`` for copying dict (e.g. ``dict(d)`` and
+``{}.update(d)``).
+
+..
+
+.. bpo: 41428
+.. date: 2020-07-28-22-43-27
+.. nonce: FM6xsI
+.. section: Core and Builtins
+
+Implement PEP 604. This supports (int | str) etc. in place of Union[str,
+int].
+
+..
+
+.. bpo: 41340
+.. date: 2020-07-27-01-50-06
+.. nonce: pZXfcF
+.. section: Core and Builtins
+
+Removed fallback implementation for ``strdup``.
+
+..
+
+.. bpo: 38156
+.. date: 2020-07-20-17-01-17
+.. nonce: ptcdRy
+.. section: Core and Builtins
+
+Handle interrupts that come after EOF correctly in ``PyOS_StdioReadline``.
+
+..
+
+.. bpo: 41342
+.. date: 2020-07-19-15-40-52
+.. nonce: RRk_m_
+.. section: Core and Builtins
+
+:func:`round` with integer argument is now faster (9--60%).
+
+..
+
+.. bpo: 41334
+.. date: 2020-07-18-18-01-10
+.. nonce: t5xMGp
+.. section: Core and Builtins
+
+Constructors :func:`str`, :func:`bytes` and :func:`bytearray` are now faster
+(around 30--40% for small objects).
+
+..
+
+.. bpo: 41295
+.. date: 2020-07-18-08-15-32
+.. nonce: pu8Ezo
+.. section: Core and Builtins
+
+Resolve a regression in CPython 3.8.4 where defining "__setattr__" in a
+multi-inheritance setup and calling up the hierarchy chain could fail if
+builtins/extension types were involved in the base types.
+
+..
+
+.. bpo: 41323
+.. date: 2020-07-17-11-31-54
+.. nonce: ChbZHh
+.. section: Core and Builtins
+
+Bytecode optimizations are performed directly on the control flow graph.
+This will result in slightly more compact code objects in some
+circumstances.
+
+..
+
+.. bpo: 41247
+.. date: 2020-07-08-22-03-54
+.. nonce: PndYIk
+.. section: Core and Builtins
+
+Always cache the running loop holder when running
+``asyncio.set_running_loop``.
+
+..
+
+.. bpo: 41252
+.. date: 2020-07-08-21-55-23
+.. nonce: nBWL-Y
+.. section: Core and Builtins
+
+Fix incorrect refcounting in _ssl.c's ``_servername_callback()``.
+
+..
+
+.. bpo: 1635741
+.. date: 2020-07-07-16-10-52
+.. nonce: zU-H_n
+.. section: Core and Builtins
+
+Port :mod:`multiprocessing` to multi-phase initialization
+
+..
+
+.. bpo: 1635741
+.. date: 2020-07-06-20-43-19
+.. nonce: LYhsni
+.. section: Core and Builtins
+
+Port :mod:`winapi` to multiphase initialization
+
+..
+
+.. bpo: 41215
+.. date: 2020-07-06-18-36-33
+.. nonce: vFGFIz
+.. section: Core and Builtins
+
+Use non-NULL default values in the PEG parser keyword list to overcome a bug
+that was preventing Python from being properly compiled when using the XLC
+compiler. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 41218
+.. date: 2020-07-06-13-35-17
+.. nonce: oKnSr2
+.. section: Core and Builtins
+
+Python 3.8.3 had a regression where compiling with
+ast.PyCF_ALLOW_TOP_LEVEL_AWAIT would aggressively mark list comprehension
+with CO_COROUTINE. Now only list comprehension making use of async/await
+will tagged as so.
+
+..
+
+.. bpo: 1635741
+.. date: 2020-07-03-23-10-02
+.. nonce: F5coWe
+.. section: Core and Builtins
+
+Port :mod:`faulthandler` to multiphase initialization.
+
+..
+
+.. bpo: 1635741
+.. date: 2020-07-01-20-17-38
+.. nonce: -AtPYu
+.. section: Core and Builtins
+
+Port :mod:`sha256` to multiphase initialization
+
+..
+
+.. bpo: 41175
+.. date: 2020-06-30-20-17-31
+.. nonce: acJoXB
+.. section: Core and Builtins
+
+Guard against a NULL pointer dereference within bytearrayobject triggered by
+the ``bytearray() + bytearray()`` operation.
+
+..
+
+.. bpo: 41100
+.. date: 2020-06-30-04-44-29
+.. nonce: PJwA6F
+.. section: Core and Builtins
+
+add arm64 to the allowable Mac OS arches in mpdecimal.h
+
+..
+
+.. bpo: 41094
+.. date: 2020-06-23-23-26-42
+.. nonce: zEIJse
+.. section: Core and Builtins
+
+Fix decoding errors with audit when open files with non-ASCII names on
+non-UTF-8 locale.
+
+..
+
+.. bpo: 39960
+.. date: 2020-06-23-18-32-41
+.. nonce: Kez3fP
+.. section: Core and Builtins
+
+The "hackcheck" that prevents sneaking around a type's __setattr__() by
+calling the superclass method was rewritten to allow C implemented heap
+types.
+
+..
+
+.. bpo: 41084
+.. date: 2020-06-23-15-10-19
+.. nonce: pt3y7F
+.. section: Core and Builtins
+
+Prefix the error message with 'f-string: ', when parsing an f-string
+expression which throws a :exc:`SyntaxError`.
+
+..
+
+.. bpo: 40521
+.. date: 2020-06-23-07-35-11
+.. nonce: dMNA6k
+.. section: Core and Builtins
+
+Empty frozensets are no longer singletons.
+
+..
+
+.. bpo: 41076
+.. date: 2020-06-22-13-22-30
+.. nonce: eWYw2N
+.. section: Core and Builtins
+
+Pre-feed the parser with the location of the f-string expression, not the
+f-string itself, which allows us to skip the shifting of the AST node
+locations after the parsing is completed.
+
+..
+
+.. bpo: 41056
+.. date: 2020-06-21-19-53-33
+.. nonce: IDu_EK
+.. section: Core and Builtins
+
+Fixes a reference to deallocated stack space during startup when
+constructing sys.path involving a relative symlink when code was supplied
+via -c.  (discovered via Coverity)
+
+..
+
+.. bpo: 41061
+.. date: 2020-06-21-10-54-02
+.. nonce: AHf9MU
+.. section: Core and Builtins
+
+Fix incorrect expressions and asserts in hashtable code and tests.
+
+..
+
+.. bpo: 41052
+.. date: 2020-06-20-22-46-18
+.. nonce: 46MPeF
+.. section: Core and Builtins
+
+Opt out serialization/deserialization for _random.Random
+
+..
+
+.. bpo: 40939
+.. date: 2020-06-20-19-27-47
+.. nonce: jxJ4yn
+.. section: Core and Builtins
+
+Rename `PyPegen*` functions to `PyParser*`, so that we can remove the old
+set of `PyParser*` functions that were using the old parser, but keep
+everything backwards-compatible.
+
+..
+
+.. bpo: 35975
+.. date: 2020-06-20-17-00-44
+.. nonce: UDHCHp
+.. section: Core and Builtins
+
+Stefan Behnel reported that cf_feature_version is used even when
+PyCF_ONLY_AST is not set. This is against the intention and against the
+documented behavior, so it's been fixed.
+
+..
+
+.. bpo: 40939
+.. date: 2020-06-20-16-59-02
+.. nonce: 6810Ak
+.. section: Core and Builtins
+
+Remove the remaining files from the old parser and the :mod:`symbol` module.
+
+..
+
+.. bpo: 40077
+.. date: 2020-06-18-19-04-30
+.. nonce: _yI-ax
+.. section: Core and Builtins
+
+Convert :mod:`_bz2` to use :c:func:`PyType_FromSpec`.
+
+..
+
+.. bpo: 41006
+.. date: 2020-06-18-00-07-09
+.. nonce: H-wN-d
+.. section: Core and Builtins
+
+The ``encodings.latin_1`` module is no longer imported at startup. Now it is
+only imported when it is the filesystem encoding or the stdio encoding.
+
+..
+
+.. bpo: 40636
+.. date: 2020-06-17-10-27-17
+.. nonce: MYaCIe
+.. section: Core and Builtins
+
+:func:`zip` now supports :pep:`618`'s ``strict`` parameter, which raises a
+:exc:`ValueError` if the arguments are exhausted at different lengths. Patch
+by Brandt Bucher.
+
+..
+
+.. bpo: 1635741
+.. date: 2020-06-17-00-52-21
+.. nonce: 61iyYh
+.. section: Core and Builtins
+
+Port :mod:`_gdbm` to multiphase initialization.
+
+..
+
+.. bpo: 40985
+.. date: 2020-06-15-16-29-55
+.. nonce: IIN_xX
+.. section: Core and Builtins
+
+Fix a bug that caused the :exc:`SyntaxError` text to be empty when a file
+ends with a line ending in a line continuation character (i.e. backslash).
+The error text should contain the text of the last line.
+
+..
+
+.. bpo: 40958
+.. date: 2020-06-15-01-20-44
+.. nonce: 7O2Wh1
+.. section: Core and Builtins
+
+Fix a possible buffer overflow in the PEG parser when gathering information
+for emitting syntax errors. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 1635741
+.. date: 2020-06-12-22-56-17
+.. nonce: mmlp3Q
+.. section: Core and Builtins
+
+Port :mod:`_dbm` to multiphase initialization.
+
+..
+
+.. bpo: 40957
+.. date: 2020-06-12-12-21-54
+.. nonce: Z8n6I6
+.. section: Core and Builtins
+
+Fix refleak in _Py_fopen_obj() when PySys_Audit() fails
+
+..
+
+.. bpo: 40950
+.. date: 2020-06-12-00-12-28
+.. nonce: tzMy7m
+.. section: Core and Builtins
+
+Add a state to the :mod:`nis` module (:pep:`3121`) and apply the multiphase
+initialization. Patch by Dong-hee Na.
+
+..
+
+.. bpo: 40947
+.. date: 2020-06-11-16-06-49
+.. nonce: 72cZcR
+.. section: Core and Builtins
+
+The Python :ref:`Path Configuration <init-path-config>` now takes
+:c:member:`PyConfig.platlibdir` in account.
+
+..
+
+.. bpo: 40939
+.. date: 2020-06-10-11-27-15
+.. nonce: DO-wAI
+.. section: Core and Builtins
+
+Remove the old parser, the :mod:`parser` module and all associated support
+code, command-line options and environment variables. Patch by Pablo
+Galindo.
+
+..
+
+.. bpo: 40847
+.. date: 2020-06-09-23-52-32
+.. nonce: 4XAACw
+.. section: Core and Builtins
+
+Fix a bug where a line with only a line continuation character is not
+considered a blank line at tokenizer level. In such cases, more than a
+single `NEWLINE` token was emitted. The old parser was working around the
+issue, but the new parser threw a :exc:`SyntaxError` for valid input due to
+this. For example, an empty line following a line continuation character was
+interpreted as a :exc:`SyntaxError`.
+
+..
+
+.. bpo: 40890
+.. date: 2020-06-09-00-20-13
+.. nonce: LoRV-g
+.. section: Core and Builtins
+
+Each dictionary view now has a ``mapping`` attribute that provides a
+:class:`types.MappingProxyType` wrapping the original dictionary.  Patch
+contributed by Dennis Sweeney.
+
+..
+
+.. bpo: 40889
+.. date: 2020-06-08-22-46-33
+.. nonce: vIBl-W
+.. section: Core and Builtins
+
+Improved the performance of symmetric difference operations on dictionary
+item views.  Patch by Dennis Sweeney.
+
+..
+
+.. bpo: 40904
+.. date: 2020-06-08-01-08-57
+.. nonce: 76qQzo
+.. section: Core and Builtins
+
+Fix possible segfault in the new PEG parser when parsing f-string containing
+yield statements with no value (:code:`f"{yield}"`). Patch by Pablo Galindo
+
+..
+
+.. bpo: 40903
+.. date: 2020-06-07-22-50-10
+.. nonce: 7dWejS
+.. section: Core and Builtins
+
+Fixed a possible segfault in the new PEG parser when producing error
+messages for invalid assignments of the form :code:`p=p=`. Patch by Pablo
+Galindo
+
+..
+
+.. bpo: 40880
+.. date: 2020-06-06-00-23-19
+.. nonce: fjdzSh
+.. section: Core and Builtins
+
+Fix invalid memory read in the new parser when checking newlines in string
+literals. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 40883
+.. date: 2020-06-05-23-25-00
+.. nonce: M6sQ-Q
+.. section: Core and Builtins
+
+Fix memory leak in when parsing f-strings in the new parser. Patch by Pablo
+Galindo
+
+..
+
+.. bpo: 40870
+.. date: 2020-06-05-12-48-28
+.. nonce: 9cd2sk
+.. section: Core and Builtins
+
+Raise :exc:`ValueError` when validating custom AST's where the constants
+``True``, ``False`` and ``None`` are used within a :class:`ast.Name` node.
+
+..
+
+.. bpo: 40854
+.. date: 2020-06-03-13-53-24
+.. nonce: O6vfQU
+.. section: Core and Builtins
+
+Allow overriding :data:`sys.platlibdir` via a new :envvar:`PYTHONPLATLIBDIR`
+environment variable.
+
+..
+
+.. bpo: 40826
+.. date: 2020-06-01-20-31-07
+.. nonce: XCI4M2
+.. section: Core and Builtins
+
+Fix GIL usage in :c:func:`PyOS_Readline`: lock the GIL to set an exception
+and pass the Python thread state when checking if there is a pending signal.
+
+..
+
+.. bpo: 1635741
+.. date: 2020-05-30-23-23-35
+.. nonce: 0D-laM
+.. section: Core and Builtins
+
+Port :mod:`fcntl` to multiphase initialization.
+
+..
+
+.. bpo: 19468
+.. date: 2020-05-30-23-18-35
+.. nonce: S-TA7p
+.. section: Core and Builtins
+
+Delete unnecessary instance check in importlib.reload(). Patch by Furkan
+Önder.
+
+..
+
+.. bpo: 40824
+.. date: 2020-05-30-14-37-18
+.. nonce: XR3V5s
+.. section: Core and Builtins
+
+Unexpected errors in calling the ``__iter__`` method are no longer masked by
+``TypeError`` in the :keyword:`in` operator and functions
+:func:`~operator.contains`, :func:`~operator.indexOf` and
+:func:`~operator.countOf` of the :mod:`operator` module.
+
+..
+
+.. bpo: 40792
+.. date: 2020-05-27-22-37-58
+.. nonce: WEDqqU
+.. section: Core and Builtins
+
+Attributes ``start``, ``stop`` and ``step`` of the :class:`range` object now
+always has exact type :class:`int`.  Previously, they could have been an
+instance of a subclass of ``int``.
+
+..
+
+.. bpo: 40780
+.. date: 2020-05-26-17-43-58
+.. nonce: 3Ckdgm
+.. section: Core and Builtins
+
+Fix a corner case where g-style string formatting of a float failed to
+remove trailing zeros.
+
+..
+
+.. bpo: 38964
+.. date: 2020-05-25-21-49-11
+.. nonce: lrml90
+.. section: Core and Builtins
+
+When there's a :exc:`SyntaxError` in the expression part of an fstring, the
+filename attribute of the :exc:`SyntaxError` gets correctly set to the name
+of the file the fstring resides in.
+
+..
+
+.. bpo: 40750
+.. date: 2020-05-24-02-42-26
+.. nonce: ZmO9Ev
+.. section: Core and Builtins
+
+Support the "-d" debug flag in the new PEG parser. Patch by Pablo Galindo
+
+..
+
+.. bpo: 40217
+.. date: 2020-05-23-01-15-51
+.. nonce: jZsHTc
+.. section: Core and Builtins
+
+Instances of types created with :c:func:`PyType_FromSpecWithBases` will no
+longer automatically visit their class object when traversing references in
+the garbage collector. The user is expected to manually visit the object's
+class. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 39573
+.. date: 2020-05-22-00-34-34
+.. nonce: QO2QHj
+.. section: Core and Builtins
+
+:c:func:`Py_TYPE()` is changed to the inline static function. Patch by
+Dong-hee Na.
+
+..
+
+.. bpo: 40696
+.. date: 2020-05-21-01-54-00
+.. nonce: u3n8Wx
+.. section: Core and Builtins
+
+Fix a hang that can arise after :meth:`generator.throw` due to a cycle in
+the exception context chain.
+
+..
+
+.. bpo: 40521
+.. date: 2020-05-20-01-17-34
+.. nonce: wvAehI
+.. section: Core and Builtins
+
+Each interpreter now its has own free lists, singletons and caches:
+
+* Free lists: float, tuple, list, dict, frame, context,
+  asynchronous generator, MemoryError.
+* Singletons: empty tuple, empty bytes string, empty Unicode string,
+  single byte character, single Unicode (latin1) character.
+* Slice cache.
+
+They are no longer shared by all interpreters.
+
+..
+
+.. bpo: 40679
+.. date: 2020-05-19-19-39-49
+.. nonce: SVzz9p
+.. section: Core and Builtins
+
+Certain :exc:`TypeError` messages about missing or extra arguments now
+include the function's :term:`qualified name`.  Patch by Dennis Sweeney.
+
+..
+
+.. bpo: 29590
+.. date: 2020-05-03-22-26-00
+.. nonce: aRz3l7
+.. section: Core and Builtins
+
+Make the stack trace correct after calling :meth:`generator.throw` on a
+generator that has yielded from a ``yield from``.
+
+..
+
+.. bpo: 4022
+.. date: 2020-04-11-13-07-49
+.. nonce: Ctpn_F
+.. section: Core and Builtins
+
+Improve performance of generators by not raising internal StopIteration.
+
+..
+
+.. bpo: 1635741
+.. date: 2020-04-10-23-54-57
+.. nonce: ZURqoN
+.. section: Core and Builtins
+
+Port :mod:`mmap` to multiphase initialization.
+
+..
+
+.. bpo: 1635741
+.. date: 2020-04-05-02-35-08
+.. nonce: Kfe9fT
+.. section: Core and Builtins
+
+Port :mod:`_lzma` to multiphase initialization.
+
+..
+
+.. bpo: 37999
+.. date: 2019-09-01-14-26-02
+.. nonce: XPl6dn
+.. section: Core and Builtins
+
+Builtin and extension functions that take integer arguments no longer accept
+:class:`~decimal.Decimal`\ s, :class:`~fractions.Fraction`\ s and other
+objects that can be converted to integers only with a loss (e.g. that have
+the :meth:`~object.__int__` method but do not have the
+:meth:`~object.__index__` method).
+
+..
+
+.. bpo: 29882
+.. date: 2019-06-02-11-29-15
+.. nonce: AkRzjb
+.. section: Core and Builtins
+
+Add :meth:`int.bit_count()`, counting the number of ones in the binary
+representation of an integer. Patch by Niklas Fiekas.
+
+..
+
+.. bpo: 36982
+.. date: 2019-05-25-05-27-39
+.. nonce: 0UHgfB
+.. section: Core and Builtins
+
+Use ncurses extended color functions when available to support terminals
+with 256 colors, and add the new function
+:func:`curses.has_extended_color_support` to indicate whether extended color
+support is provided by the underlying ncurses library.
+
+..
+
+.. bpo: 19569
+.. date: 2018-08-29-15-57-07
+.. nonce: RGu2Kb
+.. section: Core and Builtins
+
+Add the private macros ``_Py_COMP_DIAG_PUSH``,
+``_Py_COMP_DIAG_IGNORE_DEPR_DECLS``, and ``_Py_COMP_DIAG_POP``.
+
+..
+
+.. bpo: 26680
+.. date: 2018-03-15-11-51-36
+.. nonce: wOWYps
+.. section: Core and Builtins
+
+The int type now supports the x.is_integer() method for compatibility with
+float.
+
+..
+
+.. bpo: 41900
+.. date: 2020-10-01-10-50-12
+.. nonce: Cho7oh
+.. section: Library
+
+C14N 2.0 serialisation in xml.etree.ElementTree failed for unprefixed
+attributes when a default namespace was defined.
+
+..
+
+.. bpo: 41887
+.. date: 2020-09-30-23-49-42
+.. nonce: -ee2S-
+.. section: Library
+
+Strip leading spaces and tabs on :func:`ast.literal_eval`. Also document
+stripping of spaces and tabs for :func:`eval`.
+
+..
+
+.. bpo: 41773
+.. date: 2020-09-28-23-22-25
+.. nonce: oKkus0
+.. section: Library
+
+Note in documentation that :func:`random.choices` doesn't support non-finite
+weights, raise :exc:`ValueError` when given non-finite weights.
+
+..
+
+.. bpo: 41840
+.. date: 2020-09-23-23-17-59
+.. nonce: QRFr4L
+.. section: Library
+
+Fix a bug in the :mod:`symtable` module that was causing module-scope global
+variables to not be reported as both local and global. Patch by Pablo
+Galindo.
+
+..
+
+.. bpo: 41842
+.. date: 2020-09-23-22-52-24
+.. nonce: lIuhC9
+.. section: Library
+
+Add :func:`codecs.unregister` function to unregister a codec search
+function.
+
+..
+
+.. bpo: 40564
+.. date: 2020-09-23-03-33-37
+.. nonce: iXQqMq
+.. section: Library
+
+In ``zipfile.Path``, mutate the passed ZipFile object type instead of making
+a copy. Prevents issues when both the local copy and the caller’s copy
+attempt to close the same file handle.
+
+..
+
+.. bpo: 40670
+.. date: 2020-09-22-14-55-34
+.. nonce: R5sm68
+.. section: Library
+
+More reliable validation of statements in :class:`timeit.Timer`. It now
+accepts "empty" statements (only whitespaces and comments) and rejects
+misindentent statements.
+
+..
+
+.. bpo: 41833
+.. date: 2020-09-22-13-51-14
+.. nonce: 6HVDjT
+.. section: Library
+
+The :class:`threading.Thread` constructor now uses the target name if the
+*target* argument is specified but the *name* argument is omitted.
+
+..
+
+.. bpo: 41817
+.. date: 2020-09-22-00-23-30
+.. nonce: bnh-VG
+.. section: Library
+
+fix `tkinter.EventType` Enum so all members are strings, and none are tuples
+
+..
+
+.. bpo: 41810
+.. date: 2020-09-20-15-14-05
+.. nonce: 7l8lyV
+.. section: Library
+
+:data:`types.EllipsisType`, :data:`types.NotImplementedType` and
+:data:`types.NoneType` have been reintroduced, providing a new set of types
+readily interpretable by static type checkers.
+
+..
+
+.. bpo: 41815
+.. date: 2020-09-19-23-14-54
+.. nonce: RNpuX3
+.. section: Library
+
+Fix SQLite3 segfault when backing up closed database. Patch contributed by
+Peter David McCormick.
+
+..
+
+.. bpo: 41816
+.. date: 2020-09-19-12-22-08
+.. nonce: ynynXJ
+.. section: Library
+
+StrEnum added: it ensures that all members are already strings or string
+candidates
+
+..
+
+.. bpo: 41517
+.. date: 2020-09-15-22-43-30
+.. nonce: sLBH7g
+.. section: Library
+
+fix bug allowing Enums to be extended via multiple inheritance
+
+..
+
+.. bpo: 39587
+.. date: 2020-09-15-14-56-13
+.. nonce: 69xzuh
+.. section: Library
+
+use the correct mix-in data type when constructing Enums
+
+..
+
+.. bpo: 41792
+.. date: 2020-09-15-07-55-35
+.. nonce: qMpSlU
+.. section: Library
+
+Add is_typeddict function to typing.py to check if a type is a TypedDict
+class
+
+Previously there was no way to check that without using private API. See the
+`relevant issue in python/typing
+<https://github.com/python/typing/issues/751>`
+
+..
+
+.. bpo: 41789
+.. date: 2020-09-14-19-27-46
+.. nonce: pI_uZQ
+.. section: Library
+
+Honor `object` overrides in `Enum` class creation (specifically, `__str__`,
+`__repr__`, `__format__`, and `__reduce_ex__`).
+
+..
+
+.. bpo: 32218
+.. date: 2020-09-12-16-18-42
+.. nonce: IpYkEe
+.. section: Library
+
+`enum.Flag` and `enum.IntFlag` members are now iterable
+
+..
+
+.. bpo: 39651
+.. date: 2020-09-11-12-38-55
+.. nonce: JMp9l2
+.. section: Library
+
+Fix a race condition in the ``call_soon_threadsafe()`` method of
+``asyncio.ProactorEventLoop``: do nothing if the self-pipe socket has been
+closed.
+
+..
+
+.. bpo: 1635741
+.. date: 2020-09-08-13-55-34
+.. nonce: 56MLP-
+.. section: Library
+
+Port the ``mashal`` extension module to the multi-phase initialization API
+(:pep:`489`).
+
+..
+
+.. bpo: 1635741
+.. date: 2020-09-08-13-51-16
+.. nonce: wkPeoT
+.. section: Library
+
+Port the ``_string`` extension module to the multi-phase initialization API
+(:pep:`489`).
+
+..
+
+.. bpo: 41732
+.. date: 2020-09-06-20-27-10
+.. nonce: 1SKv26
+.. section: Library
+
+Added an :term:`iterator` to :class:`memoryview`.
+
+..
+
+.. bpo: 41720
+.. date: 2020-09-04-20-45-38
+.. nonce: PW9MzZ
+.. section: Library
+
+Fixed :meth:`turtle.Vec2D.__rmul__` for arguments which are not int or
+float.
+
+..
+
+.. bpo: 41696
+.. date: 2020-09-03-01-35-32
+.. nonce: zkYGre
+.. section: Library
+
+Fix handling of debug mode in :func:`asyncio.run`. This allows setting
+``PYTHONASYNCIODEBUG`` or ``-X dev`` to enable asyncio debug mode when using
+:func:`asyncio.run`.
+
+..
+
+.. bpo: 41687
+.. date: 2020-09-01-15-57-51
+.. nonce: m1b1KA
+.. section: Library
+
+Fix implementation of sendfile to be compatible with Solaris.
+
+..
+
+.. bpo: 41662
+.. date: 2020-08-30-21-38-57
+.. nonce: 6e9iZn
+.. section: Library
+
+No longer override exceptions raised in ``__len__()`` of a sequence of
+parameters in :mod:`sqlite3` with :exc:`~sqlite3.ProgrammingError`.
+
+..
+
+.. bpo: 39010
+.. date: 2020-08-30-10-24-26
+.. nonce: _mzXJW
+.. section: Library
+
+Restarting a ``ProactorEventLoop`` on Windows no longer logs spurious
+``ConnectionResetErrors``.
+
+..
+
+.. bpo: 41638
+.. date: 2020-08-29-16-45-12
+.. nonce: iZfW5N
+.. section: Library
+
+:exc:`~sqlite3.ProgrammingError` message for absent parameter in
+:mod:`sqlite3` contains now the name of the parameter instead of its index
+when parameters are supplied as a dict.
+
+..
+
+.. bpo: 41662
+.. date: 2020-08-29-16-07-36
+.. nonce: Mn79zh
+.. section: Library
+
+Fixed crash when mutate list of parameters during iteration in
+:mod:`sqlite3`.
+
+..
+
+.. bpo: 41513
+.. date: 2020-08-23-14-23-18
+.. nonce: DGqc_I
+.. section: Library
+
+Improved the accuracy of math.hypot().  Internally, each step is computed
+with extra precision so that the result is now almost always correctly
+rounded.
+
+..
+
+.. bpo: 41609
+.. date: 2020-08-21-15-51-15
+.. nonce: JmiUKG
+.. section: Library
+
+The pdb whatis command correctly reports instance methods as 'Method' rather
+than 'Function'.
+
+..
+
+.. bpo: 39994
+.. date: 2020-08-15-18-17-21
+.. nonce: dOgPOh
+.. section: Library
+
+Fixed pprint's handling of dict subclasses that override __repr__.
+
+..
+
+.. bpo: 32751
+.. date: 2020-08-15-15-50-12
+.. nonce: 85je5X
+.. section: Library
+
+When cancelling the task due to a timeout, :meth:`asyncio.wait_for` will now
+wait until the cancellation is complete also in the case when *timeout* is
+<= 0, like it does with positive timeouts.
+
+..
+
+.. bpo: 37658
+.. date: 2020-08-15-15-21-40
+.. nonce: f9nivB
+.. section: Library
+
+:meth:`asyncio.wait_for` now properly handles races between cancellation of
+itself and the completion of the wrapped awaitable.
+
+..
+
+.. bpo: 40782
+.. date: 2020-08-13-08-07-25
+.. nonce: aGZqmB
+.. section: Library
+
+Change the method asyncio.AbstractEventLoop.run_in_executor to not be a
+coroutine.
+
+..
+
+.. bpo: 41520
+.. date: 2020-08-12-13-25-16
+.. nonce: BEUWa4
+.. section: Library
+
+Fix :mod:`codeop` regression that prevented turning compile warnings into
+errors.
+
+..
+
+.. bpo: 41528
+.. date: 2020-08-12-07-43-31
+.. nonce: bu83oD
+.. section: Library
+
+turtle uses math module functions to convert degrees to radians and vice
+versa and to calculate vector norm
+
+..
+
+.. bpo: 41513
+.. date: 2020-08-09-18-16-05
+.. nonce: e6K6EK
+.. section: Library
+
+Minor algorithmic improvement to math.hypot() and math.dist() giving small
+gains in speed and accuracy.
+
+..
+
+.. bpo: 41503
+.. date: 2020-08-07-15-18-16
+.. nonce: IYftcu
+.. section: Library
+
+Fixed a race between setTarget and flush in logging.handlers.MemoryHandler.
+
+..
+
+.. bpo: 41497
+.. date: 2020-08-07-06-06-29
+.. nonce: aBtsWz
+.. section: Library
+
+Fix potential UnicodeDecodeError in dis module.
+
+..
+
+.. bpo: 41467
+.. date: 2020-08-04-00-20-30
+.. nonce: Z8DgTL
+.. section: Library
+
+On Windows, fix asyncio ``recv_into()`` return value when the socket/pipe is
+closed (:exc:`BrokenPipeError`): return ``0`` rather than an empty byte
+string (``b''``).
+
+..
+
+.. bpo: 41425
+.. date: 2020-08-03-01-59-48
+.. nonce: KJo6zF
+.. section: Library
+
+Make tkinter doc example runnable.
+
+..
+
+.. bpo: 41421
+.. date: 2020-08-01-00-51-15
+.. nonce: dHKRVB
+.. section: Library
+
+Make an algebraic simplification to random.paretovariate().  It now is
+slightly less subject to round-off error and is slightly faster. Inputs that
+used to cause ZeroDivisionError now cause an OverflowError instead.
+
+..
+
+.. bpo: 41440
+.. date: 2020-07-30-14-56-58
+.. nonce: rju34k
+.. section: Library
+
+Add :func:`os.cpu_count()` support for VxWorks RTOS.
+
+..
+
+.. bpo: 41316
+.. date: 2020-07-28-12-08-58
+.. nonce: bSCbK4
+.. section: Library
+
+Fix the :mod:`tarfile` module to write only basename of TAR file to GZIP
+compression header.
+
+..
+
+.. bpo: 41384
+.. date: 2020-07-26-21-18-43
+.. nonce: MlzIgV
+.. section: Library
+
+Raise TclError instead of TypeError when an unknown option is passed to
+tkinter.OptionMenu.
+
+..
+
+.. bpo: 41317
+.. date: 2020-07-23-01-18-34
+.. nonce: O17Z6x
+.. section: Library
+
+Use add_done_callback() in asyncio.loop.sock_accept() to unsubscribe reader
+early on cancellation.
+
+..
+
+.. bpo: 41364
+.. date: 2020-07-21-21-45-55
+.. nonce: 5O-k7A
+.. section: Library
+
+Reduce import overhead of :mod:`uuid`.
+
+..
+
+.. bpo: 35328
+.. date: 2020-07-21-16-20-55
+.. nonce: jXovHb
+.. section: Library
+
+Set the environment variable ``VIRTUAL_ENV_PROMPT`` at :mod:`venv`
+activation.
+
+..
+
+.. bpo: 41341
+.. date: 2020-07-20-19-13-17
+.. nonce: wqrj8C
+.. section: Library
+
+Recursive evaluation of `typing.ForwardRef` in `get_type_hints`.
+
+..
+
+.. bpo: 41344
+.. date: 2020-07-20-13-27-48
+.. nonce: iKipNd
+.. section: Library
+
+Prevent creating :class:`shared_memory.SharedMemory` objects with
+:code:`size=0`.
+
+..
+
+.. bpo: 41333
+.. date: 2020-07-18-18-07-40
+.. nonce: upkHIm
+.. section: Library
+
+:meth:`collections.OrderedDict.pop` is now 2 times faster.
+
+..
+
+.. bpo: 41288
+.. date: 2020-07-13-15-06-35
+.. nonce: 8mn5P-
+.. section: Library
+
+Unpickling invalid NEWOBJ_EX opcode with the C implementation raises now
+UnpicklingError instead of crashing.
+
+..
+
+.. bpo: 39017
+.. date: 2020-07-12-22-16-58
+.. nonce: x3Cg-9
+.. section: Library
+
+Avoid infinite loop when reading specially crafted TAR files using the
+tarfile module (CVE-2019-20907).
+
+..
+
+.. bpo: 41273
+.. date: 2020-07-11-00-15-01
+.. nonce: SVrsJh
+.. section: Library
+
+Speed up any transport using ``_ProactorReadPipeTransport`` by calling
+``recv_into`` instead of ``recv``, thus not creating a new buffer for each
+``recv`` call in the transport's read loop.
+
+..
+
+.. bpo: 41235
+.. date: 2020-07-07-21-56-26
+.. nonce: H2csMU
+.. section: Library
+
+Fix the error handling in :meth:`ssl.SSLContext.load_dh_params`.
+
+..
+
+.. bpo: 41207
+.. date: 2020-07-06-16-58-53
+.. nonce: Emw7Nk
+.. section: Library
+
+In distutils.spawn, restore expectation that DistutilsExecError is raised
+when the command is not found.
+
+..
+
+.. bpo: 29727
+.. date: 2020-07-05-19-16-02
+.. nonce: Q6Z2rg
+.. section: Library
+
+Register :class:`array.array` as a
+:class:`~collections.abc.MutableSequence`. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 39168
+.. date: 2020-07-04-21-56-46
+.. nonce: DQWsXj
+.. section: Library
+
+Remove the ``__new__`` method of :class:`typing.Generic`.
+
+..
+
+.. bpo: 41194
+.. date: 2020-07-03-13-15-08
+.. nonce: djrKjs
+.. section: Library
+
+Fix a crash in the ``_ast`` module: it can no longer be loaded more than
+once. It now uses a global state rather than a module state.
+
+..
+
+.. bpo: 41195
+.. date: 2020-07-02-15-03-04
+.. nonce: cEnpO3
+.. section: Library
+
+Add read-only ssl.SSLContext.security_level attribute to retrieve the
+context's security level.
+
+..
+
+.. bpo: 41193
+.. date: 2020-07-02-11-53-45
+.. nonce: 8-Tnql
+.. section: Library
+
+The ``write_history()`` atexit function of the readline completer now
+ignores any :exc:`OSError` to ignore error if the filesystem is read-only,
+instead of only ignoring :exc:`FileNotFoundError` and
+:exc:`PermissionError`.
+
+..
+
+.. bpo: 41182
+.. date: 2020-07-01-17-33-50
+.. nonce: FPFI0N
+.. section: Library
+
+selector: use DefaultSelector based upon implementation
+
+..
+
+.. bpo: 41161
+.. date: 2020-06-30-20-50-51
+.. nonce: QTdJjz
+.. section: Library
+
+The decimal module now requires libmpdec-2.5.0. Users of
+--with-system-libmpdec should update their system library.
+
+..
+
+.. bpo: 40874
+.. date: 2020-06-28-21-16-51
+.. nonce: YImvzA
+.. section: Library
+
+The decimal module now requires libmpdec-2.5.0.
+
+..
+
+.. bpo: 41138
+.. date: 2020-06-27-13-51-36
+.. nonce: bIpf7g
+.. section: Library
+
+Fixed the :mod:`trace` module CLI for Python source files with non-UTF-8
+encoding.
+
+..
+
+.. bpo: 31082
+.. date: 2020-06-25-10-11-47
+.. nonce: HsgDkx
+.. section: Library
+
+Use the term "iterable" in the docstring for :func:`functools.reduce`.
+
+..
+
+.. bpo: 40521
+.. date: 2020-06-23-06-09-59
+.. nonce: HUfxP7
+.. section: Library
+
+Remove freelist from collections.deque().
+
+..
+
+.. bpo: 31938
+.. date: 2020-06-22-20-08-40
+.. nonce: EVuko9
+.. section: Library
+
+Fix default-value signatures of several functions in the :mod:`select`
+module - by Anthony Sottile.
+
+..
+
+.. bpo: 41068
+.. date: 2020-06-22-10-25-39
+.. nonce: _bX2BW
+.. section: Library
+
+Fixed reading files with non-ASCII names from ZIP archive directly after
+writing them.
+
+..
+
+.. bpo: 41058
+.. date: 2020-06-20-21-03-55
+.. nonce: gztdZy
+.. section: Library
+
+:func:`pdb.find_function` now correctly determines the source file encoding.
+
+..
+
+.. bpo: 41056
+.. date: 2020-06-20-18-37-29
+.. nonce: d9v_uL
+.. section: Library
+
+Invalid file descriptor values are now prevented from being passed to
+os.fpathconf. (discovered by Coverity)
+
+..
+
+.. bpo: 41056
+.. date: 2020-06-20-18-35-43
+.. nonce: Garcle
+.. section: Library
+
+Fix a NULL pointer dereference within the ssl module during a MemoryError in
+the keylog callback. (discovered by Coverity)
+
+..
+
+.. bpo: 41056
+.. date: 2020-06-20-18-33-03
+.. nonce: gTH4Bq
+.. section: Library
+
+Fixed an instance where a MemoryError within the zoneinfo module might not
+be reported or not reported at its source. (found by Coverity)
+
+..
+
+.. bpo: 41048
+.. date: 2020-06-20-10-16-57
+.. nonce: hEXB-B
+.. section: Library
+
+:func:`mimetypes.read_mime_types` function reads the rule file using UTF-8
+encoding, not the locale encoding. Patch by Srinivas Reddy Thatiparthy.
+
+..
+
+.. bpo: 41043
+.. date: 2020-06-20-00-19-30
+.. nonce: p-Pk-H
+.. section: Library
+
+Fixed the use of :func:`~glob.glob` in the stdlib: literal part of the path
+is now always correctly escaped.
+
+..
+
+.. bpo: 41025
+.. date: 2020-06-18-10-34-59
+.. nonce: elf_nz
+.. section: Library
+
+Fixed an issue preventing the C implementation of :class:`zoneinfo.ZoneInfo`
+from being subclassed.
+
+..
+
+.. bpo: 35018
+.. date: 2020-06-17-23-49-45
+.. nonce: NP5_Qk
+.. section: Library
+
+Add the :class:`xml.sax.handler.LexicalHandler` class that is present in
+other SAX XML implementations.
+
+..
+
+.. bpo: 41002
+.. date: 2020-06-17-17-26-24
+.. nonce: NPBItE
+.. section: Library
+
+Improve performance of HTTPResponse.read with a given amount. Patch by Bruce
+Merry.
+
+..
+
+.. bpo: 40448
+.. date: 2020-06-15-12-22-53
+.. nonce: 1dk8Bu
+.. section: Library
+
+:mod:`ensurepip` now disables the use of `pip` cache when installing the
+bundled versions of `pip` and `setuptools`.  Patch by Krzysztof Konopko.
+
+..
+
+.. bpo: 40967
+.. date: 2020-06-15-00-13-57
+.. nonce: _dx3OO
+.. section: Library
+
+Removed :meth:`asyncio.Task.current_task` and
+:meth:`asyncio.Task.all_tasks`. Patch contributed by Rémi Lapeyre.
+
+..
+
+.. bpo: 40924
+.. date: 2020-06-13-12-04-50
+.. nonce: SM_luS
+.. section: Library
+
+Ensure ``importlib.resources.path`` returns an extant path for the
+SourceFileLoader's resource reader. Avoids the regression identified in
+master while a long-term solution is devised.
+
+..
+
+.. bpo: 40955
+.. date: 2020-06-12-11-55-30
+.. nonce: huixCg
+.. section: Library
+
+Fix a minor memory leak in :mod:`subprocess` module when extra_groups was
+specified.
+
+..
+
+.. bpo: 40855
+.. date: 2020-06-12-10-44-15
+.. nonce: jSot83
+.. section: Library
+
+The standard deviation and variance functions in the statistics module were
+ignoring their mu and xbar arguments.
+
+..
+
+.. bpo: 40939
+.. date: 2020-06-11-11-07-10
+.. nonce: -D5Asl
+.. section: Library
+
+Use the new PEG parser when generating the stdlib :mod:`keyword` module.
+
+..
+
+.. bpo: 23427
+.. date: 2020-06-08-18-59-16
+.. nonce: ilg1Cz
+.. section: Library
+
+Add :data:`sys.orig_argv` attribute: the list of the original command line
+arguments passed to the Python executable.
+
+..
+
+.. bpo: 33689
+.. date: 2020-06-06-14-09-55
+.. nonce: EFUDH7
+.. section: Library
+
+Ignore empty or whitespace-only lines in .pth files. This matches the
+documentated behavior. Before, empty lines caused the site-packages dir to
+appear multiple times in sys.path. By Ido Michael, contributors Malcolm
+Smith and Tal Einat.
+
+..
+
+.. bpo: 40884
+.. date: 2020-06-06-02-42-26
+.. nonce: n7fOwS
+.. section: Library
+
+Added a `defaults` parameter to :class:`logging.Formatter`, to allow
+specifying default values for custom fields. Patch by Asaf Alon and Bar
+Harel.
+
+..
+
+.. bpo: 40876
+.. date: 2020-06-05-20-00-18
+.. nonce: zDhiZj
+.. section: Library
+
+Clarify error message in the :mod:`csv` module.
+
+..
+
+.. bpo: 39791
+.. date: 2020-06-05-19-29-10
+.. nonce: _CcO3d
+.. section: Library
+
+Refresh importlib.metadata from importlib_metadata 1.6.1.
+
+..
+
+.. bpo: 40807
+.. date: 2020-06-04-16-25-15
+.. nonce: yYyLWx
+.. section: Library
+
+Stop codeop._maybe_compile, used by code.InteractiveInterpreter (and IDLE).
+from emitting each warning three times.
+
+..
+
+.. bpo: 32604
+.. date: 2020-06-02-23-49-07
+.. nonce: ZN4V4l
+.. section: Library
+
+Fix reference leak in the :mod:`select` module when the module is imported
+in a subinterpreter.
+
+..
+
+.. bpo: 39791
+.. date: 2020-06-02-02-16-02
+.. nonce: StCJlA
+.. section: Library
+
+Built-in loaders (SourceFileLoader and ZipImporter) now supply
+``TraversableResources`` implementations for ``ResourceReader``, and the
+fallback function has been removed.
+
+..
+
+.. bpo: 39314
+.. date: 2020-06-01-02-16-29
+.. nonce: 0T9hlA
+.. section: Library
+
+:class:`rlcompleter.Completer` and the standard Python shell now close the
+parenthesis for functions that take no arguments. Patch contributed by Rémi
+Lapeyre.
+
+..
+
+.. bpo: 17005
+.. date: 2020-05-31-23-32-36
+.. nonce: JlRUGB
+.. section: Library
+
+The topological sort functionality that was introduced initially in the
+:mod:`functools` module has been moved to a new :mod:`graphlib` module to
+better accommodate the new tools and keep the original scope of the
+:mod:`functools` module. Patch by Pablo Galindo
+
+..
+
+.. bpo: 40834
+.. date: 2020-05-31-15-52-18
+.. nonce: MO9_hb
+.. section: Library
+
+Fix truncate when sending str object with_xxsubinterpreters.channel_send.
+
+..
+
+.. bpo: 40755
+.. date: 2020-05-30-18-48-58
+.. nonce: IyOe2J
+.. section: Library
+
+Add rich comparisons to collections.Counter().
+
+..
+
+.. bpo: 26407
+.. date: 2020-05-30-14-19-47
+.. nonce: MjWLO1
+.. section: Library
+
+Unexpected errors in calling the ``__iter__`` method are no longer masked by
+``TypeError`` in :func:`csv.reader`, :func:`csv.writer.writerow` and
+:meth:`csv.writer.writerows`.
+
+..
+
+.. bpo: 39384
+.. date: 2020-05-30-12-44-29
+.. nonce: Iqxy3q
+.. section: Library
+
+Fixed email.contentmanager to allow set_content() to set a null string.
+
+..
+
+.. bpo: 40744
+.. date: 2020-05-30-08-10-23
+.. nonce: jKURVV
+.. section: Library
+
+The :mod:`sqlite3` module uses SQLite API functions that require SQLite
+v3.7.3 or higher.  This patch removes support for older SQLite versions, and
+explicitly requires SQLite 3.7.3 both at build, compile and runtime.  Patch
+by Sergey Fedoseev and Erlend E. Aasland.
+
+..
+
+.. bpo: 40777
+.. date: 2020-05-28-17-32-29
+.. nonce: 1kJU6N
+.. section: Library
+
+Initialize PyDateTime_IsoCalendarDateType.tp_base at run-time to avoid
+errors on some compilers.
+
+..
+
+.. bpo: 38488
+.. date: 2020-05-28-16-51-00
+.. nonce: hFQNgA
+.. section: Library
+
+Update ensurepip to install pip 20.1.1 and setuptools 47.1.0.
+
+..
+
+.. bpo: 40792
+.. date: 2020-05-27-22-19-42
+.. nonce: 87Yx01
+.. section: Library
+
+The result of :func:`operator.index` now always has exact type :class:`int`.
+Previously, the result could have been an instance of a subclass of ``int``.
+
+..
+
+.. bpo: 40767
+.. date: 2020-05-27-21-27-01
+.. nonce: L5MnVV
+.. section: Library
+
+:mod:`webbrowser` now properly finds the default browser in pure Wayland
+systems by checking the WAYLAND_DISPLAY environment variable. Patch
+contributed by Jérémy Attali.
+
+..
+
+.. bpo: 40791
+.. date: 2020-05-27-18-04-52
+.. nonce: IzpNor
+.. section: Library
+
+:func:`hashlib.compare_digest` uses OpenSSL's ``CRYPTO_memcmp()`` function
+when OpenSSL is available.
+
+..
+
+.. bpo: 40795
+.. date: 2020-05-27-17-00-18
+.. nonce: eZSnHA
+.. section: Library
+
+:mod:`ctypes` module: If ctypes fails to convert the result of a callback or
+if a ctypes callback function raises an exception, sys.unraisablehook is now
+called with an exception set. Previously, the error was logged into stderr
+by :c:func:`PyErr_Print`.
+
+..
+
+.. bpo: 16995
+.. date: 2020-05-27-00-09-52
+.. nonce: 4niOT7
+.. section: Library
+
+Add :func:`base64.b32hexencode` and :func:`base64.b32hexdecode` to support
+the Base32 Encoding with Extended Hex Alphabet.
+
+..
+
+.. bpo: 30008
+.. date: 2020-05-25-22-18-38
+.. nonce: CKC3td
+.. section: Library
+
+Fix :mod:`ssl` code to be compatible with OpenSSL 1.1.x builds that use
+``no-deprecated`` and ``--api=1.1.0``.
+
+..
+
+.. bpo: 30064
+.. date: 2020-05-25-11-52-23
+.. nonce: 6CICsH
+.. section: Library
+
+Fix asyncio ``loop.sock_*`` race condition issue
+
+..
+
+.. bpo: 40759
+.. date: 2020-05-24-23-52-35
+.. nonce: DdZdaw
+.. section: Library
+
+Deprecate the :mod:`symbol` module.
+
+..
+
+.. bpo: 40756
+.. date: 2020-05-24-11-06-37
+.. nonce: 7ZH83z
+.. section: Library
+
+The second argument (extra) of ``LoggerAdapter.__init__`` now defaults to
+None.
+
+..
+
+.. bpo: 37129
+.. date: 2020-05-23-04-18-00
+.. nonce: YoYoYo
+.. section: Library
+
+Add a new :data:`os.RWF_APPEND` flag for :func:`os.pwritev`.
+
+..
+
+.. bpo: 40737
+.. date: 2020-05-23-00-22-11
+.. nonce: iph-CM
+.. section: Library
+
+Fix possible reference leak for :mod:`sqlite3` initialization.
+
+..
+
+.. bpo: 40726
+.. date: 2020-05-22-12-45-58
+.. nonce: 7oBdMw
+.. section: Library
+
+Handle cases where the ``end_lineno`` is ``None`` on
+:func:`ast.increment_lineno`.
+
+..
+
+.. bpo: 40698
+.. date: 2020-05-20-14-38-04
+.. nonce: zwl5Hc
+.. section: Library
+
+:mod:`distutils` upload creates SHA2-256 and Blake2b-256 digests. MD5
+digests is skipped if platform blocks MD5.
+
+..
+
+.. bpo: 40695
+.. date: 2020-05-20-13-03-28
+.. nonce: lr4aIS
+.. section: Library
+
+:mod:`hashlib` no longer falls back to builtin hash implementations when
+OpenSSL provides a hash digest and the algorithm is blocked by security
+policy.
+
+..
+
+.. bpo: 9216
+.. date: 2020-05-20-12-53-20
+.. nonce: ps7Yf1
+.. section: Library
+
+func:`hashlib.new` passed ``usedforsecurity`` to OpenSSL EVP constructor
+``_hashlib.new()``. test_hashlib and test_smtplib handle strict security
+policy better.
+
+..
+
+.. bpo: 40614
+.. date: 2020-05-18-22-41-02
+.. nonce: 8j3kmq
+.. section: Library
+
+:func:`ast.parse` will not parse self documenting expressions in f-strings
+when passed ``feature_version`` is less than ``(3, 8)``.
+
+..
+
+.. bpo: 40626
+.. date: 2020-05-18-17-29-30
+.. nonce: NeZufF
+.. section: Library
+
+Add h5 file extension as MIME Type application/x-hdf5, as per HDF Group
+recommendation for HDF5 formatted data files. Patch contributed by Mark
+Schwab.
+
+..
+
+.. bpo: 25920
+.. date: 2020-05-18-15-38-25
+.. nonce: PxrLY8
+.. section: Library
+
+On macOS, when building Python for macOS 10.4 and older, which wasn't the
+case for python.org macOS installer, :func:`socket.getaddrinfo` no longer
+uses an internal lock to prevent race conditions when calling
+``getaddrinfo()`` which is thread-safe since macOS 10.5. Python 3.9 requires
+macOS 10.6 or newer. The internal lock caused random hang on fork when
+another thread was calling :func:`socket.getaddrinfo`. The lock was also
+used on FreeBSD older than 5.3, OpenBSD older than 201311 and NetBSD older
+than 4.
+
+..
+
+.. bpo: 40671
+.. date: 2020-05-18-15-26-31
+.. nonce: NeZ9Cy
+.. section: Library
+
+Prepare ``_hashlib`` for :pep:`489` and use :c:func:`PyModule_AddType`.
+
+..
+
+.. bpo: 32309
+.. date: 2020-05-17-02-03-09
+.. nonce: KM9psl
+.. section: Library
+
+Added a new :term:`coroutine` :func:`asyncio.to_thread`. It is mainly used
+for running IO-bound functions in a separate thread to avoid blocking the
+event loop, and essentially works as a high-level version of
+:meth:`~asyncio.loop.run_in_executor` that can directly take keyword
+arguments.
+
+..
+
+.. bpo: 36543
+.. date: 2020-05-15-21-14-45
+.. nonce: Jt-eSX
+.. section: Library
+
+Restored the deprecated :mod:`xml.etree.cElementTree` module.
+
+..
+
+.. bpo: 40611
+.. date: 2020-05-13-16-28-33
+.. nonce: ZCk0_c
+.. section: Library
+
+:data:`~mmap.MAP_POPULATE` constant has now been added to the list of
+exported :mod:`mmap` module flags.
+
+..
+
+.. bpo: 39881
+.. date: 2020-05-07-22-00-12
+.. nonce: E1xsNv
+.. section: Library
+
+PEP 554 for use in the test suite. (Patch By Joannah Nanjekye)
+
+..
+
+.. bpo: 13097
+.. date: 2020-05-06-02-01-25
+.. nonce: Wh5xSK
+.. section: Library
+
+``ctypes`` now raises an ``ArgumentError`` when a callback is invoked with
+more than 1024 arguments.
+
+..
+
+.. bpo: 39385
+.. date: 2020-04-23-18-21-19
+.. nonce: MIAyS7
+.. section: Library
+
+A new test assertion context-manager, :func:`unittest.assertNoLogs` will
+ensure a given block of code emits no log messages using the logging module.
+Contributed by Kit Yan Choi.
+
+..
+
+.. bpo: 23082
+.. date: 2020-04-20-22-08-36
+.. nonce: iX90Id
+.. section: Library
+
+Updated the error message and docs of PurePath.relative_to() to better
+reflect the function behaviour.
+
+..
+
+.. bpo: 40318
+.. date: 2020-04-18-14-16-02
+.. nonce: K2UdRx
+.. section: Library
+
+Use SQLite3 trace v2 API, if it is available.
+
+..
+
+.. bpo: 40105
+.. date: 2020-04-03-16-13-59
+.. nonce: hfM2c0
+.. section: Library
+
+ZipFile truncates files to avoid corruption when a shorter comment is
+provided in append ("a") mode. Patch by Jan Mazur.
+
+..
+
+.. bpo: 40084
+.. date: 2020-03-29-21-32-00
+.. nonce: MCYwcv
+.. section: Library
+
+Fix ``Enum.__dir__``: dir(Enum.member) now includes attributes as well as
+methods.
+
+..
+
+.. bpo: 31122
+.. date: 2020-03-11-07-44-06
+.. nonce: zIQ80l
+.. section: Library
+
+ssl.wrap_socket() now raises ssl.SSLEOFError rather than OSError when peer
+closes connection during TLS negotiation
+
+..
+
+.. bpo: 39728
+.. date: 2020-02-24-10-58-34
+.. nonce: kOOaHn
+.. section: Library
+
+fix default `_missing_` so a duplicate `ValueError` is not set as the
+`__context__` of the original `ValueError`
+
+..
+
+.. bpo: 39244
+.. date: 2020-02-23-15-09-47
+.. nonce: aBK5IM
+.. section: Library
+
+Fixed :class:`multiprocessing.context.get_all_start_methods` to properly
+return the default method first on macOS.
+
+..
+
+.. bpo: 39040
+.. date: 2019-12-15-18-47-20
+.. nonce: tKa0Qs
+.. section: Library
+
+Fix parsing of invalid mime headers parameters by collapsing whitespace
+between encoded words in a bare-quote-string.
+
+..
+
+.. bpo: 38731
+.. date: 2019-11-13-07-37-11
+.. nonce: 9qmcSx
+.. section: Library
+
+Add ``--quiet`` option to command-line interface of :mod:`py_compile`. Patch
+by Gregory Schevchenko.
+
+..
+
+.. bpo: 35714
+.. date: 2019-10-25-23-45-49
+.. nonce: fw3xb7
+.. section: Library
+
+:exc:`struct.error` is now raised if there is a null character in a
+:mod:`struct` format string.
+
+..
+
+.. bpo: 38144
+.. date: 2019-09-12-21-34-03
+.. nonce: 8uQCdd
+.. section: Library
+
+Added the *root_dir* and *dir_fd* parameters in :func:`glob.glob`.
+
+..
+
+.. bpo: 26543
+.. date: 2019-08-11-16-28-03
+.. nonce: X-TJZO
+.. section: Library
+
+Fix :meth:`IMAP4.noop()` when debug mode is enabled (ex: ``imaplib.Debug =
+3``).
+
+..
+
+.. bpo: 12178
+.. date: 2019-05-31-23-54-28
+.. nonce: N6FLCZ
+.. section: Library
+
+:func:`csv.writer` now correctly escapes *escapechar* when input contains
+*escapechar*.  Patch by Catalin Iacob, Berker Peksag, and Itay Elbirt.
+
+..
+
+.. bpo: 36290
+.. date: 2019-03-17-19-01-53
+.. nonce: 7VXo_K
+.. section: Library
+
+AST nodes are now raising :exc:`TypeError` on conflicting keyword arguments.
+Patch contributed by Rémi Lapeyre.
+
+..
+
+.. bpo: 33944
+.. date: 2019-03-01-01-56-23
+.. nonce: -82Pkt
+.. section: Library
+
+Added site.py site-packages tracing in verbose mode.
+
+..
+
+.. bpo: 35078
+.. date: 2018-10-27-09-37-03
+.. nonce: kweA3R
+.. section: Library
+
+Refactor formatweekday, formatmonthname methods in LocaleHTMLCalendar and
+LocaleTextCalendar classes in calendar module to call the base class
+methods.This enables customizable CSS classes for LocaleHTMLCalendar. Patch
+by Srinivas Reddy Thatiparthy
+
+..
+
+.. bpo: 29620
+.. date: 2018-08-21-16-20-33
+.. nonce: xxx666
+.. section: Library
+
+:func:`~unittest.TestCase.assertWarns` no longer raises a
+``RuntimeException`` when accessing a module's ``__warningregistry__``
+causes importation of a new module, or when a new module is imported in
+another thread. Patch by Kernc.
+
+..
+
+.. bpo: 31844
+.. date: 2018-07-30-12-48-17
+.. nonce: 0_GKsD
+.. section: Library
+
+Remove ``ParserBase.error()`` method from the private and undocumented
+``_markupbase`` module.  :class:`html.parser.HTMLParser` is the only
+subclass of ``ParserBase`` and its ``error()`` implementation was deprecated
+in Python 3.4 and removed in Python 3.5.
+
+..
+
+.. bpo: 34226
+.. date: 2018-07-29-12-14-54
+.. nonce: BE7zbu
+.. section: Library
+
+Fix `cgi.parse_multipart` without content_length. Patch by Roger Duran
+
+..
+
+.. bpo: 33660
+.. date: 2018-06-12-23-30-41
+.. nonce: AdDn5Z
+.. section: Library
+
+Fix pathlib.PosixPath to resolve a relative path located on the root
+directory properly.
+
+..
+
+.. bpo: 28557
+.. date: 2018-06-07-22-04-01
+.. nonce: ViNJnK
+.. section: Library
+
+Improve the error message for a misbehaving ``rawio.readinto``
+
+..
+
+.. bpo: 26680
+.. date: 2018-03-15-11-56-48
+.. nonce: Udkhn4
+.. section: Library
+
+The d.is_integer() method is added to the Decimal type, for compatibility
+with other number types.
+
+..
+
+.. bpo: 26680
+.. date: 2018-03-15-11-55-04
+.. nonce: eKAi85
+.. section: Library
+
+The x.is_integer() method is incorporated into the abstract types of the
+numeric tower, Real, Rational and Integral, with appropriate default
+implementations.
+
+..
+
+.. bpo: 41428
+.. date: 2020-10-03-18-20-46
+.. nonce: _ju1NE
+.. section: Documentation
+
+Add documentation for :pep:`604` (Allow writing union types as ``X | Y``).
+
+..
+
+.. bpo: 41774
+.. date: 2020-09-24-15-35-13
+.. nonce: 5IqdGP
+.. section: Documentation
+
+In Programming FAQ "Sequences (Tuples/Lists)" section, add "How do you
+remove multiple items from a list".
+
+..
+
+.. bpo: 35293
+.. date: 2020-09-12-17-37-13
+.. nonce: _cOwPD
+.. section: Documentation
+
+Fix RemovedInSphinx40Warning when building the documentation. Patch by
+Dong-hee Na.
+
+..
+
+.. bpo: 37149
+.. date: 2020-09-10-07-48-02
+.. nonce: VD0rCv
+.. section: Documentation
+
+Change Shipman tkinter doc link from archive.org to TkDocs. (The doc has
+been removed from the NMT server.)  The new link responds much faster and
+includes a short explanatory note.
+
+..
+
+.. bpo: 41726
+.. date: 2020-09-08-16-57-09
+.. nonce: g0UXrn
+.. section: Documentation
+
+Update the refcounts info of ``PyType_FromModuleAndSpec``.
+
+..
+
+.. bpo: 41624
+.. date: 2020-08-25-15-11-23
+.. nonce: ddjJlN
+.. section: Documentation
+
+Fix the signature of :class:`typing.Coroutine`.
+
+..
+
+.. bpo: 40204
+.. date: 2020-08-12-18-35-40
+.. nonce: C8A_pe
+.. section: Documentation
+
+Enable Sphinx 3.2 ``c_allow_pre_v3`` option and disable
+``c_warn_on_allowed_pre_v3`` option to make the documentation compatible
+with Sphinx 2 and Sphinx 3.
+
+..
+
+.. bpo: 41045
+.. date: 2020-07-27-20-46-17
+.. nonce: GFF6Ul
+.. section: Documentation
+
+Add documentation for debug feature of f-strings.
+
+..
+
+.. bpo: 41314
+.. date: 2020-07-25-14-20-00
+.. nonce: yrjko0
+.. section: Documentation
+
+Changed the release when ``from __future__ import annotations`` becomes the
+default from ``4.0`` to ``3.10`` (following a change in PEP 563).
+
+..
+
+.. bpo: 40979
+.. date: 2020-07-21-15-23-30
+.. nonce: pLA8rO
+.. section: Documentation
+
+Refactored typing.rst, arranging more than 70 classes, functions, and
+decorators into new sub-sections.
+
+..
+
+.. bpo: 40552
+.. date: 2020-05-09-12-10-31
+.. nonce: _0uB73
+.. section: Documentation
+
+Fix in tutorial section 4.2. Code snippet is now correct.
+
+..
+
+.. bpo: 39883
+.. date: 2020-03-07-03-53-39
+.. nonce: 1tnb4-
+.. section: Documentation
+
+Make code, examples, and recipes in the Python documentation be licensed
+under the more permissive BSD0 license in addition to the existing Python
+2.0 license.
+
+..
+
+.. bpo: 37703
+.. date: 2019-08-16-20-25-42
+.. nonce: Qm_l_H
+.. section: Documentation
+
+Updated Documentation to comprehensively elaborate on the behaviour of
+gather.cancel()
+
+..
+
+.. bpo: 41939
+.. date: 2020-10-05-09-37-43
+.. nonce: P4OlbA
+.. section: Tests
+
+Fix test_site.test_license_exists_at_url(): call
+``urllib.request.urlcleanup()`` to reset the global
+``urllib.request._opener``. Patch by Victor Stinner.
+
+..
+
+.. bpo: 41731
+.. date: 2020-09-11-19-12-31
+.. nonce: Ivxh4U
+.. section: Tests
+
+Make test_cmd_line_script pass with option '-vv'.
+
+..
+
+.. bpo: 41602
+.. date: 2020-08-25-19-25-36
+.. nonce: Z64s0I
+.. section: Tests
+
+Add tests for SIGINT handling in the runpy module.
+
+..
+
+.. bpo: 41521
+.. date: 2020-08-11-14-59-13
+.. nonce: w2UYK7
+.. section: Tests
+
+:mod:`test.support`: Rename ``blacklist`` parameter of
+:func:`~test.support.check__all__` to ``not_exported``.
+
+..
+
+.. bpo: 41477
+.. date: 2020-08-07-17-28-49
+.. nonce: GrFexU
+.. section: Tests
+
+Make ctypes optional in test_genericalias.
+
+..
+
+.. bpo: 41085
+.. date: 2020-06-23-12-02-45
+.. nonce: JZKsyz
+.. section: Tests
+
+Fix integer overflow in the :meth:`array.array.index` method on 64-bit
+Windows for index larger than ``2**31``.
+
+..
+
+.. bpo: 41069
+.. date: 2020-06-22-00-21-12
+.. nonce: bLZkX-
+.. section: Tests
+
+:data:`test.support.TESTFN` and the current directory for tests when run via
+``test.regrtest`` contain now non-ascii characters if possible.
+
+..
+
+.. bpo: 38377
+.. date: 2020-06-17-18-00-21
+.. nonce: jfg4TH
+.. section: Tests
+
+On Linux, skip tests using multiprocessing if the current user cannot create
+a file in ``/dev/shm/`` directory. Add the
+:func:`~test.support.skip_if_broken_multiprocessing_synchronize` function to
+the :mod:`test.support` module.
+
+..
+
+.. bpo: 41009
+.. date: 2020-06-17-17-27-07
+.. nonce: Rvn6OQ
+.. section: Tests
+
+Fix use of ``support.require_{linux|mac|freebsd}_version()`` decorators as
+class decorator.
+
+..
+
+.. bpo: 41003
+.. date: 2020-06-17-15-07-14
+.. nonce: tiH_Fy
+.. section: Tests
+
+Fix ``test_copyreg`` when ``numpy`` is installed: ``test.pickletester`` now
+saves/restores warnings filters when importing ``numpy``, to ignore filters
+installed by ``numpy``.
+
+..
+
+.. bpo: 40964
+.. date: 2020-06-12-20-46-23
+.. nonce: OBzf2c
+.. section: Tests
+
+Disable remote :mod:`imaplib` tests, host cyrus.andrew.cmu.edu is blocking
+incoming connections.
+
+..
+
+.. bpo: 40927
+.. date: 2020-06-09-18-48-18
+.. nonce: 67ylLg
+.. section: Tests
+
+Fix test_binhex when run twice: it now uses import_fresh_module() to ensure
+that it raises DeprecationWarning each time.
+
+..
+
+.. bpo: 17258
+.. date: 2020-05-26-07-53-31
+.. nonce: X_IKTQ
+.. section: Tests
+
+Skip some :mod:`multiprocessing` tests when MD5 hash digest is blocked.
+
+..
+
+.. bpo: 31904
+.. date: 2020-04-09-15-40-03
+.. nonce: TJ4k3d
+.. section: Tests
+
+Increase LOOPBACK_TIMEOUT to 10 for VxWorks RTOS.
+
+..
+
+.. bpo: 38169
+.. date: 2019-09-14-13-20-27
+.. nonce: hurq4B
+.. section: Tests
+
+Increase code coverage for SharedMemory and ShareableList
+
+..
+
+.. bpo: 34401
+.. date: 2018-08-20-09-38-52
+.. nonce: eGxMPm
+.. section: Tests
+
+Make test_gdb properly run on HP-UX. Patch by Michael Osipov.
+
+..
+
+.. bpo: 38249
+.. date: 2020-09-28-21-56-51
+.. nonce: uzMCaZ
+.. section: Build
+
+Update :c:macro:`Py_UNREACHABLE` to use __builtin_unreachable() if only the
+compiler is able to use it. Patch by Dong-hee Na.
+
+..
+
+.. bpo: 41617
+.. date: 2020-08-24-18-34-01
+.. nonce: sKKXz7
+.. section: Build
+
+Fix ``pycore_bitutils.h`` header file to support old clang versions:
+``__builtin_bswap16()`` is not available in LLVM clang 3.0.
+
+..
+
+.. bpo: 40204
+.. date: 2020-06-25-06-59-13
+.. nonce: GpD04D
+.. section: Build
+
+Pin Sphinx version to 2.3.1 in ``Doc/Makefile``.
+
+..
+
+.. bpo: 36020
+.. date: 2020-06-15-22-14-25
+.. nonce: wbiv0P
+.. section: Build
+
+The C99 functions :c:func:`snprintf` and :c:func:`vsnprintf` are now
+required to build Python.
+
+..
+
+.. bpo: 40684
+.. date: 2020-06-08-19-57-05
+.. nonce: WIY2-i
+.. section: Build
+
+``make install`` now uses the ``PLATLIBDIR`` variable for the destination
+``lib-dynload/`` directory when ``./configure --with-platlibdir`` is used.
+
+..
+
+.. bpo: 40683
+.. date: 2020-05-19-10-54-08
+.. nonce: W8JHrr
+.. section: Build
+
+Fixed an issue where the :mod:`zoneinfo` module and its tests were not
+included when Python is installed with ``make``.
+
+..
+
+.. bpo: 41744
+.. date: 2020-09-11-17-59-33
+.. nonce: e_ugDQ
+.. section: Windows
+
+Fixes automatic import of props file when using the Nuget package.
+
+..
+
+.. bpo: 41627
+.. date: 2020-09-04-21-35-28
+.. nonce: sx2KN1
+.. section: Windows
+
+The user site directory for 32-bit now includes a ``-32`` suffix to
+distinguish it from the 64-bit interpreter's directory.
+
+..
+
+.. bpo: 41526
+.. date: 2020-08-13-22-40-58
+.. nonce: -i2bwb
+.. section: Windows
+
+Fixed layout of final page of the installer by removing the special thanks
+to Mark Hammond (with his permission).
+
+..
+
+.. bpo: 41492
+.. date: 2020-08-06-16-59-10
+.. nonce: 2FQ9cM
+.. section: Windows
+
+Fixes the description that appears in UAC prompts.
+
+..
+
+.. bpo: 40948
+.. date: 2020-07-28-12-39-32
+.. nonce: ISUFO6
+.. section: Windows
+
+Improve post-install message to direct people to the "py" command.
+
+..
+
+.. bpo: 41412
+.. date: 2020-07-28-11-55-43
+.. nonce: ME20KB
+.. section: Windows
+
+The installer will now fail to install on Windows 7 and Windows 8. Further,
+the UCRT dependency is now always downloaded on demand.
+
+..
+
+.. bpo: 40741
+.. date: 2020-07-20-23-26-26
+.. nonce: C9sc_d
+.. section: Windows
+
+Update Windows release to include SQLite 3.32.3.
+
+..
+
+.. bpo: 41142
+.. date: 2020-06-28-12-40-41
+.. nonce: jpZzzh
+.. section: Windows
+
+:mod:`msilib` now supports creating CAB files with non-ASCII file path and
+adding files with non-ASCII file path to them.
+
+..
+
+.. bpo: 41074
+.. date: 2020-06-24-21-30-42
+.. nonce: gaQc3C
+.. section: Windows
+
+Fixed support of non-ASCII names in functions :func:`msilib.OpenDatabase`
+and :func:`msilib.init_database` and non-ASCII SQL in method
+:meth:`msilib.Database.OpenView`.
+
+..
+
+.. bpo: 41039
+.. date: 2020-06-23-03-12-57
+.. nonce: 0hgd0s
+.. section: Windows
+
+Stable ABI redirection DLL (python3.dll) now uses ``#pragma
+comment(linker)`` for re-exporting.
+
+..
+
+.. bpo: 40164
+.. date: 2020-06-12-13-13-44
+.. nonce: SPrSn5
+.. section: Windows
+
+Updates Windows OpenSSL to 1.1.1g
+
+..
+
+.. bpo: 39631
+.. date: 2020-05-19-14-43-33
+.. nonce: Z5yXam
+.. section: Windows
+
+Changes the registered MIME type for ``.py`` files on Windows to
+``text/x-python`` instead of ``text/plain``.
+
+..
+
+.. bpo: 40677
+.. date: 2020-05-19-04-11-12
+.. nonce: qQbLW8
+.. section: Windows
+
+Manually define IO_REPARSE_TAG_APPEXECLINK in case some old Windows SDK
+doesn't have it.
+
+..
+
+.. bpo: 37556
+.. date: 2019-07-11-06-11-09
+.. nonce: sygMUU
+.. section: Windows
+
+Extend py.exe help to mention overrides via venv, shebang, environmental
+variables & ini files.
+
+..
+
+.. bpo: 41557
+.. date: 2020-08-26-09-31-37
+.. nonce: mcQ75z
+.. section: macOS
+
+Update macOS installer to use SQLite 3.33.0.
+
+..
+
+.. bpo: 39580
+.. date: 2020-06-25-06-09-00
+.. nonce: N_vJ9h
+.. section: macOS
+
+Avoid opening Finder window if running installer from the command line.
+Patch contributed by Rick Heil.
+
+..
+
+.. bpo: 41100
+.. date: 2020-06-24-13-51-57
+.. nonce: mcHdc5
+.. section: macOS
+
+Fix configure error when building on macOS 11. Note that the current Python
+release was released shortly after the first developer preview of macOS 11
+(Big Sur); there are other known issues with building and running on the
+developer preview. Big Sur is expected to be fully supported in a future
+bugfix release of Python 3.8.x and with 3.9.0.
+
+..
+
+.. bpo: 40741
+.. date: 2020-06-19-14-19-08
+.. nonce: L7yTbm
+.. section: macOS
+
+Update macOS installer to use SQLite 3.32.3.
+
+..
+
+.. bpo: 41005
+.. date: 2020-06-17-13-45-15
+.. nonce: zZegdV
+.. section: macOS
+
+fixed an XDG settings issue not allowing macos to open browser in
+webbrowser.py
+
+..
+
+.. bpo: 40741
+.. date: 2020-06-07-20-10-56
+.. nonce: 80A2BW
+.. section: macOS
+
+Update macOS installer to use SQLite 3.32.2.
+
+..
+
+.. bpo: 41775
+.. date: 2020-09-24-14-31-16
+.. nonce: sB8Vre
+.. section: IDLE
+
+Use 'IDLE Shell' as shell title
+
+..
+
+.. bpo: 35764
+.. date: 2020-09-22-11-13-45
+.. nonce: VoNa8y
+.. section: IDLE
+
+Rewrite the Calltips doc section.
+
+..
+
+.. bpo: 40181
+.. date: 2020-09-22-00-45-40
+.. nonce: hhQi3z
+.. section: IDLE
+
+In calltips, stop reminding that '/' marks the end of positional-only
+arguments.
+
+..
+
+.. bpo: 41468
+.. date: 2020-08-09-13-42-55
+.. nonce: zkP0_Y
+.. section: IDLE
+
+Improve IDLE run crash error message (which users should never see).
+
+..
+
+.. bpo: 41373
+.. date: 2020-07-24-17-49-58
+.. nonce: YQIPu_
+.. section: IDLE
+
+Save files loaded with no line ending, as when blank, or different line
+endings, by setting its line ending to the system default. Fix regression in
+3.8.4 and 3.9.0b4.
+
+..
+
+.. bpo: 41300
+.. date: 2020-07-16-17-39-06
+.. nonce: wRixNb
+.. section: IDLE
+
+Save files with non-ascii chars. Fix regression released in 3.9.0b4 and
+3.8.4.
+
+..
+
+.. bpo: 37765
+.. date: 2020-07-07-18-44-30
+.. nonce: umc1o8
+.. section: IDLE
+
+Add keywords to module name completion list.  Rewrite Completions section of
+IDLE doc.
+
+..
+
+.. bpo: 41152
+.. date: 2020-06-29-14-51-15
+.. nonce: d6mV0C
+.. section: IDLE
+
+The encoding of ``stdin``, ``stdout`` and ``stderr`` in IDLE is now always
+UTF-8.
+
+..
+
+.. bpo: 41144
+.. date: 2020-06-27-17-02-00
+.. nonce: JoFGIX
+.. section: IDLE
+
+Make Open Module open a special module such as os.path.
+
+..
+
+.. bpo: 39885
+.. date: 2020-05-29-18-21-58
+.. nonce: zB_-bN
+.. section: IDLE
+
+Make context menu Cut and Copy work again when right-clicking within a
+selection.
+
+..
+
+.. bpo: 40723
+.. date: 2020-05-24-06-19-43
+.. nonce: AJLd4U
+.. section: IDLE
+
+Make test_idle pass when run after import.
+
+..
+
+.. bpo: 41936
+.. date: 2020-10-05-01-25-23
+.. nonce: 1gb5ra
+.. section: C API
+
+Removed undocumented macros ``Py_ALLOW_RECURSION`` and
+``Py_END_ALLOW_RECURSION`` and the ``recursion_critical`` field of the
+:c:type:`PyInterpreterState` structure.
+
+..
+
+.. bpo: 41692
+.. date: 2020-10-02-00-57-34
+.. nonce: fDScsF
+.. section: C API
+
+The ``PyUnicode_InternImmortal()`` function is now deprecated and will be
+removed in Python 3.12: use :c:func:`PyUnicode_InternInPlace` instead. Patch
+by Victor Stinner.
+
+..
+
+.. bpo: 41842
+.. date: 2020-09-27-20-43-16
+.. nonce: bCakAj
+.. section: C API
+
+Add :c:func:`PyCodec_Unregister` function to unregister a codec search
+function.
+
+..
+
+.. bpo: 41834
+.. date: 2020-09-22-14-47-12
+.. nonce: nrOrDU
+.. section: C API
+
+Remove the ``_Py_CheckRecursionLimit`` variable: it has been replaced by
+``ceval.recursion_limit`` of the :c:type:`PyInterpreterState` structure.
+Patch by Victor Stinner.
+
+..
+
+.. bpo: 41689
+.. date: 2020-09-01-23-39-45
+.. nonce: zxHbLB
+.. section: C API
+
+Types created with :c:func:`PyType_FromSpec` now make any signature in their
+``tp_doc`` slot accessible from ``__text_signature__``.
+
+..
+
+.. bpo: 41524
+.. date: 2020-08-12-17-09-06
+.. nonce: u6Xfr2
+.. section: C API
+
+Fix bug in PyOS_mystrnicmp and PyOS_mystricmp that incremented pointers
+beyond the end of a string.
+
+..
+
+.. bpo: 41324
+.. date: 2020-08-10-16-05-08
+.. nonce: waZD35
+.. section: C API
+
+Add a minimal decimal capsule API.  The API supports fast conversions
+between Decimals up to 38 digits and their triple representation as a C
+struct.
+
+..
+
+.. bpo: 30155
+.. date: 2020-07-26-19-39-45
+.. nonce: rHZRJ_
+.. section: C API
+
+Add :c:func:`PyDateTime_DATE_GET_TZINFO` and
+:c:func:`PyDateTime_TIME_GET_TZINFO` macros for accessing the ``tzinfo``
+attributes of :class:`datetime.datetime` and :class:`datetime.time` objects.
+
+..
+
+.. bpo: 40170
+.. date: 2020-07-08-10-14-52
+.. nonce: N6Qx1i
+.. section: C API
+
+Revert :c:func:`PyType_HasFeature` change: it reads again directly the
+:c:member:`PyTypeObject.tp_flags` member when the limited C API is not used,
+rather than always calling :c:func:`PyType_GetFlags` which hides
+implementation details.
+
+..
+
+.. bpo: 41123
+.. date: 2020-06-29-15-49-36
+.. nonce: wYY4E1
+.. section: C API
+
+Remove ``PyUnicode_AsUnicodeCopy``.
+
+..
+
+.. bpo: 41123
+.. date: 2020-06-29-11-33-49
+.. nonce: qFevek
+.. section: C API
+
+Removed ``PyLong_FromUnicode()``.
+
+..
+
+.. bpo: 41123
+.. date: 2020-06-28-11-39-22
+.. nonce: sjJWjQ
+.. section: C API
+
+Removed ``PyUnicode_GetMax()``.
+
+..
+
+.. bpo: 41123
+.. date: 2020-06-26-13-29-25
+.. nonce: bRa1oy
+.. section: C API
+
+Removed ``Py_UNICODE_str*`` functions manipulating ``Py_UNICODE*`` strings.
+
+..
+
+.. bpo: 41103
+.. date: 2020-06-24-22-57-07
+.. nonce: doojgE
+.. section: C API
+
+``PyObject_AsCharBuffer()``, ``PyObject_AsReadBuffer()``,
+``PyObject_CheckReadBuffer()``, and ``PyObject_AsWriteBuffer()`` are
+removed. Please migrate to new buffer protocol; :c:func:`PyObject_GetBuffer`
+and :c:func:`PyBuffer_Release`.
+
+..
+
+.. bpo: 36346
+.. date: 2020-06-17-20-31-12
+.. nonce: mwIyxi
+.. section: C API
+
+Raises DeprecationWarning for ``PyUnicode_FromUnicode(NULL, size)`` and
+``PyUnicode_FromStringAndSize(NULL, size)`` with ``size > 0``.
+
+..
+
+.. bpo: 36346
+.. date: 2020-06-17-11-24-00
+.. nonce: fTMr3S
+.. section: C API
+
+Mark ``Py_UNICODE_COPY``, ``Py_UNICODE_FILL``, ``PyUnicode_WSTR_LENGTH``,
+``PyUnicode_FromUnicode``, ``PyUnicode_AsUnicode``, and
+``PyUnicode_AsUnicodeAndSize`` as deprecated in C. Remove
+``Py_UNICODE_MATCH`` which was deprecated and broken since Python 3.3.
+
+..
+
+.. bpo: 40989
+.. date: 2020-06-15-23-17-51
+.. nonce: tlzG3r
+.. section: C API
+
+The :c:func:`PyObject_INIT` and :c:func:`PyObject_INIT_VAR` macros become
+aliases to, respectively, :c:func:`PyObject_Init` and
+:c:func:`PyObject_InitVar` functions.
+
+..
+
+.. bpo: 36020
+.. date: 2020-06-15-16-46-01
+.. nonce: djI6jw
+.. section: C API
+
+On Windows, ``#include "pyerrors.h"`` no longer defines ``snprintf`` and
+``vsnprintf`` macros.
+
+..
+
+.. bpo: 40943
+.. date: 2020-06-10-18-37-26
+.. nonce: i4q7rK
+.. section: C API
+
+The ``PY_SSIZE_T_CLEAN`` macro must now be defined to use
+:c:func:`PyArg_ParseTuple` and :c:func:`Py_BuildValue` formats which use
+``#``: ``es#``, ``et#``, ``s#``, ``u#``, ``y#``, ``z#``, ``U#`` and ``Z#``.
+See :ref:`Parsing arguments and building values <arg-parsing>` and the
+:pep:`353`.
+
+..
+
+.. bpo: 40910
+.. date: 2020-06-08-15-59-06
+.. nonce: L56oI0
+.. section: C API
+
+Export explicitly the :c:func:`Py_GetArgcArgv` function to the C API and
+document the function. Previously, it was exported implicitly which no
+longer works since Python is built with ``-fvisibility=hidden``.
+
+..
+
+.. bpo: 40724
+.. date: 2020-06-04-08-01-23
+.. nonce: qIIdSi
+.. section: C API
+
+Allow defining buffer slots in type specs.
+
+..
+
+.. bpo: 40679
+.. date: 2020-06-03-17-48-13
+.. nonce: 3sgWma
+.. section: C API
+
+Fix a ``_PyEval_EvalCode()`` crash if *qualname* argument is NULL.
+
+..
+
+.. bpo: 40839
+.. date: 2020-06-01-20-47-49
+.. nonce: bAi52Z
+.. section: C API
+
+Calling :c:func:`PyDict_GetItem` without :term:`GIL` held had been allowed
+for historical reason. It is no longer allowed.
+
+..
+
+.. bpo: 40826
+.. date: 2020-06-01-16-12-37
+.. nonce: zQzFoK
+.. section: C API
+
+:c:func:`PyOS_InterruptOccurred` now fails with a fatal error if it is
+called with the GIL released.
+
+..
+
+.. bpo: 40792
+.. date: 2020-05-27-11-02-15
+.. nonce: pBw2Bb
+.. section: C API
+
+The result of :c:func:`PyNumber_Index` now always has exact type
+:class:`int`. Previously, the result could have been an instance of a
+subclass of ``int``.
+
+..
+
+.. bpo: 39573
+.. date: 2020-05-26-16-21-47
+.. nonce: depAgq
+.. section: C API
+
+Convert :c:func:`Py_REFCNT` and :c:func:`Py_SIZE` macros to static inline
+functions. They cannot be used as l-value anymore: use
+:c:func:`Py_SET_REFCNT` and :c:func:`Py_SET_SIZE` to set an object reference
+count and size. This change is backward incompatible on purpose, to prepare
+the C API for an opaque :c:type:`PyObject` structure.
+
+..
+
+.. bpo: 40703
+.. date: 2020-05-20-19-11-12
+.. nonce: qQXfW8
+.. section: C API
+
+The PyType_FromSpec*() functions no longer overwrite the type's "__module__"
+attribute if it is set via "Py_tp_members" or "Py_tp_getset".
+
+..
+
+.. bpo: 39583
+.. date: 2020-02-08-08-01-35
+.. nonce: qURKSl
+.. section: C API
+
+Remove superfluous "extern C" declarations from ``Include/cpython/*.h``.
diff --git a/Misc/NEWS.d/3.10.0a2.rst b/Misc/NEWS.d/3.10.0a2.rst
new file mode 100644
index 0000000..61a2919
--- /dev/null
+++ b/Misc/NEWS.d/3.10.0a2.rst
@@ -0,0 +1,912 @@
+.. bpo: 42103
+.. date: 2020-10-23-19-19-30
+.. nonce: cILT66
+.. release date: 2020-11-03
+.. section: Security
+
+Prevented potential DoS attack via CPU and RAM exhaustion when processing
+malformed Apple Property List files in binary format.
+
+..
+
+.. bpo: 42051
+.. date: 2020-10-19-10-56-27
+.. nonce: EU_B7u
+.. section: Security
+
+The :mod:`plistlib` module no longer accepts entity declarations in XML
+plist files to avoid XML vulnerabilities. This should not affect users as
+entity declarations are not used in regular plist files.
+
+..
+
+.. bpo: 42236
+.. date: 2020-11-01-21-21-38
+.. nonce: MPx-NK
+.. section: Core and Builtins
+
+If the ``nl_langinfo(CODESET)`` function returns an empty string, Python now
+uses UTF-8 as the filesystem encoding. Patch by Victor Stinner.
+
+..
+
+.. bpo: 42218
+.. date: 2020-10-31-17-50-23
+.. nonce: Dp_Z3v
+.. section: Core and Builtins
+
+Fixed a bug in the PEG parser that was causing crashes in debug mode. Now
+errors are checked in left-recursive rules to avoid cases where such errors
+do not get handled in time and appear as long-distance crashes in other
+places.
+
+..
+
+.. bpo: 42214
+.. date: 2020-10-30-22-16-30
+.. nonce: lXskM_
+.. section: Core and Builtins
+
+Fixed a possible crash in the PEG parser when checking for the '!=' token in
+the ``barry_as_flufl`` rule. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 42206
+.. date: 2020-10-30-13-11-01
+.. nonce: xxssR8
+.. section: Core and Builtins
+
+Propagate and raise the errors caused by :c:func:`PyAST_Validate` in the
+parser.
+
+..
+
+.. bpo: 41796
+.. date: 2020-10-29-12-49-08
+.. nonce: tkGdHq
+.. section: Core and Builtins
+
+The :mod:`ast` module internal state is now per interpreter. Patch by Victor
+Stinner.
+
+..
+
+.. bpo: 42143
+.. date: 2020-10-27-21-34-05
+.. nonce: N6KXUO
+.. section: Core and Builtins
+
+Fix handling of errors during creation of ``PyFunctionObject``, which
+resulted in operations on uninitialized memory. Patch by Yonatan
+Goldschmidt.
+
+..
+
+.. bpo: 41659
+.. date: 2020-10-27-18-32-49
+.. nonce: d4a-8o
+.. section: Core and Builtins
+
+Fix a bug in the parser, where a curly brace following a `primary` didn't
+fail immediately. This led to invalid expressions like `a {b}` to throw a
+:exc:`SyntaxError` with a wrong offset, or invalid expressions ending with a
+curly brace like `a {` to not fail immediately in the REPL.
+
+..
+
+.. bpo: 42150
+.. date: 2020-10-25-21-14-18
+.. nonce: b70u_T
+.. section: Core and Builtins
+
+Fix possible buffer overflow in the new parser when checking for
+continuation lines. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 42123
+.. date: 2020-10-23-02-43-24
+.. nonce: 64gJWC
+.. section: Core and Builtins
+
+Run the parser two times. On the first run, disable all the rules that only
+generate better error messages to gain performance. If there's a parse
+failure, run the parser a second time with those enabled.
+
+..
+
+.. bpo: 42093
+.. date: 2020-10-20-04-24-07
+.. nonce: ooZZNh
+.. section: Core and Builtins
+
+The ``LOAD_ATTR`` instruction now uses new "per opcode cache" mechanism and
+it is about 36% faster now. Patch by Pablo Galindo and Yury Selivanov.
+
+..
+
+.. bpo: 42030
+.. date: 2020-10-15-21-55-32
+.. nonce: PmU2CA
+.. section: Core and Builtins
+
+Support for the legacy AIX-specific shared library loading support has been
+removed. All versions of AIX since 4.3 have supported and defaulted to using
+the common Unix mechanism instead.
+
+..
+
+.. bpo: 41984
+.. date: 2020-10-14-16-19-43
+.. nonce: SEtKMr
+.. section: Core and Builtins
+
+The garbage collector now tracks all user-defined classes. Patch by Brandt
+Bucher.
+
+..
+
+.. bpo: 41993
+.. date: 2020-10-10-13-53-52
+.. nonce: YMzixQ
+.. section: Core and Builtins
+
+Fixed potential issues with removing not completely initialized module from
+``sys.modules`` when import fails.
+
+..
+
+.. bpo: 41979
+.. date: 2020-10-09-10-55-50
+.. nonce: ImXIk2
+.. section: Core and Builtins
+
+Star-unpacking is now allowed for with item's targets in the PEG parser.
+
+..
+
+.. bpo: 41974
+.. date: 2020-10-08-09-58-19
+.. nonce: 8B-q8O
+.. section: Core and Builtins
+
+Removed special methods ``__int__``, ``__float__``, ``__floordiv__``,
+``__mod__``, ``__divmod__``, ``__rfloordiv__``, ``__rmod__`` and
+``__rdivmod__`` of the :class:`complex` class.  They always raised a
+:exc:`TypeError`.
+
+..
+
+.. bpo: 41902
+.. date: 2020-10-02-13-32-05
+.. nonce: ZKTxzW
+.. section: Core and Builtins
+
+Micro optimization when compute :c:member:`~PySequenceMethods.sq_item` and
+:c:member:`~PyMappingMethods.mp_subscript` of :class:`range`. Patch by
+Dong-hee Na.
+
+..
+
+.. bpo: 41894
+.. date: 2020-10-02-11-35-33
+.. nonce: ffmtOt
+.. section: Core and Builtins
+
+When loading a native module and a load failure occurs, prevent a possible
+UnicodeDecodeError when not running in a UTF-8 locale by decoding the load
+error message using the current locale's encoding.
+
+..
+
+.. bpo: 41902
+.. date: 2020-10-01-22-44-23
+.. nonce: iLoMVF
+.. section: Core and Builtins
+
+Micro optimization for range.index if step is 1. Patch by Dong-hee Na.
+
+..
+
+.. bpo: 41435
+.. date: 2020-08-07-13-42-48
+.. nonce: qPWjJA
+.. section: Core and Builtins
+
+Add `sys._current_exceptions()` function to retrieve a dictionary mapping
+each thread's identifier to the topmost exception currently active in that
+thread at the time the function is called.
+
+..
+
+.. bpo: 38605
+.. date: 2020-05-27-16-08-16
+.. nonce: rcs2uK
+.. section: Core and Builtins
+
+Enable ``from __future__ import annotations`` (:pep:`563`) by default. The
+values found in :attr:`__annotations__` dicts are now strings, e.g. ``{"x":
+"int"}`` instead of ``{"x": int}``.
+
+..
+
+.. bpo: 35455
+.. date: 2020-11-02-14-10-48
+.. nonce: Q1xTIo
+.. section: Library
+
+On Solaris, :func:`~time.thread_time` is now implemented with
+``gethrvtime()`` because ``clock_gettime(CLOCK_THREAD_CPUTIME_ID)`` is not
+always available. Patch by Jakub Kulik.
+
+..
+
+.. bpo: 42233
+.. date: 2020-11-02-01-31-15
+.. nonce: YxRj-h
+.. section: Library
+
+The :func:`repr` of :mod:`typing` types containing :ref:`Generic Alias Types
+<types-genericalias>` previously did not show the parameterized types in the
+``GenericAlias``.  They have now been changed to do so.
+
+..
+
+.. bpo: 29566
+.. date: 2020-10-31-13-28-36
+.. nonce: 6aDbty
+.. section: Library
+
+``binhex.binhex()`` consistently writes macOS 9 line endings.
+
+..
+
+.. bpo: 26789
+.. date: 2020-10-31-01-16-49
+.. nonce: 9BdNAt
+.. section: Library
+
+The :class:`logging.FileHandler` class now keeps a reference to the builtin
+:func:`open` function to be able to open or reopen the file during Python
+finalization. Fix errors like: ``NameError: name 'open' is not defined``.
+Patch by Victor Stinner.
+
+..
+
+.. bpo: 42157
+.. date: 2020-10-26-23-29-16
+.. nonce: 4wuwTe
+.. section: Library
+
+Removed the ``unicodedata.ucnhash_CAPI`` attribute which was an internal
+PyCapsule object. The related private ``_PyUnicode_Name_CAPI`` structure was
+moved to the internal C API. Patch by Victor Stinner.
+
+..
+
+.. bpo: 42157
+.. date: 2020-10-26-19-08-07
+.. nonce: Bdpa04
+.. section: Library
+
+Convert the :mod:`unicodedata` extension module to the multiphase
+initialization API (:pep:`489`) and convert the ``unicodedata.UCD`` static
+type to a heap type. Patch by Mohamed Koubaa and Victor Stinner.
+
+..
+
+.. bpo: 42146
+.. date: 2020-10-25-19-25-02
+.. nonce: 6A8uvS
+.. section: Library
+
+Fix memory leak in :func:`subprocess.Popen` in case an uid (gid) specified
+in `user` (`group`, `extra_groups`) overflows `uid_t` (`gid_t`).
+
+..
+
+.. bpo: 42103
+.. date: 2020-10-23-19-20-14
+.. nonce: C5obK2
+.. section: Library
+
+:exc:`~plistlib.InvalidFileException` and :exc:`RecursionError` are now the
+only errors caused by loading malformed binary Plist file (previously
+ValueError and TypeError could be raised in some specific cases).
+
+..
+
+.. bpo: 41490
+.. date: 2020-10-23-08-54-47
+.. nonce: -Yk6OD
+.. section: Library
+
+In ``importlib.resources``, ``.path`` method is more aggressive about
+releasing handles to zipfile objects early, enabling use-cases like certifi
+to leave the context open but delete the underlying zip file.
+
+..
+
+.. bpo: 41052
+.. date: 2020-10-21-23-45-02
+.. nonce: 3N7J2J
+.. section: Library
+
+Pickling heap types implemented in C with protocols 0 and 1 raises now an
+error instead of producing incorrect data.
+
+..
+
+.. bpo: 42089
+.. date: 2020-10-19-16-53-19
+.. nonce: R1dthW
+.. section: Library
+
+In ``importlib.metadata.PackageNotFoundError``, make reference to the
+package metadata being missing to improve the user experience.
+
+..
+
+.. bpo: 41491
+.. date: 2020-10-19-14-02-09
+.. nonce: d1BUWH
+.. section: Library
+
+plistlib: fix parsing XML plists with hexadecimal integer values
+
+..
+
+.. bpo: 42065
+.. date: 2020-10-17-23-17-18
+.. nonce: 85BsRA
+.. section: Library
+
+Fix an incorrectly formatted error from :meth:`_codecs.charmap_decode` when
+called with a mapped value outside the range of valid Unicode code points.
+PR by Max Bernstein.
+
+..
+
+.. bpo: 41966
+.. date: 2020-10-17-07-52-53
+.. nonce: gwEQRZ
+.. section: Library
+
+Fix pickling pure Python :class:`datetime.time` subclasses. Patch by Dean
+Inwood.
+
+..
+
+.. bpo: 19270
+.. date: 2020-10-16-22-48-01
+.. nonce: jd_gkA
+.. section: Library
+
+:meth:`sched.scheduler.cancel()` will now cancel the correct event, if two
+events with same priority are scheduled for the same time. Patch by Bar
+Harel.
+
+..
+
+.. bpo: 28660
+.. date: 2020-10-16-16-08-04
+.. nonce: eX9pvD
+.. section: Library
+
+:func:`textwrap.wrap` now attempts to break long words after hyphens when
+``break_long_words=True`` and ``break_on_hyphens=True``.
+
+..
+
+.. bpo: 35823
+.. date: 2020-10-16-07-45-35
+.. nonce: SNQo56
+.. section: Library
+
+Use ``vfork()`` instead of ``fork()`` for :func:`subprocess.Popen` on Linux
+to improve performance in cases where it is deemed safe.
+
+..
+
+.. bpo: 42043
+.. date: 2020-10-15-17-20-37
+.. nonce: OS0p_v
+.. section: Library
+
+Add support for ``zipfile.Path`` inheritance. ``zipfile.Path.is_file()`` now
+returns False for non-existent names. ``zipfile.Path`` objects now expose a
+``.filename`` attribute and rely on that to resolve ``.name`` and
+``.parent`` when the ``Path`` object is at the root of the zipfile.
+
+..
+
+.. bpo: 42021
+.. date: 2020-10-12-21-21-24
+.. nonce: 8yv_8-
+.. section: Library
+
+Fix possible ref leaks in :mod:`sqlite3` module init.
+
+..
+
+.. bpo: 39101
+.. date: 2020-10-11-21-43-03
+.. nonce: -I49Pm
+.. section: Library
+
+Fixed tests using IsolatedAsyncioTestCase from hanging on BaseExceptions.
+
+..
+
+.. bpo: 41976
+.. date: 2020-10-08-18-22-28
+.. nonce: Svm0wb
+.. section: Library
+
+Fixed a bug that was causing :func:`ctypes.util.find_library` to return
+``None`` when triying to locate a library in an environment when gcc>=9 is
+available and ``ldconfig`` is not. Patch by Pablo Galindo
+
+..
+
+.. bpo: 41943
+.. date: 2020-10-07-18-36-03
+.. nonce: Pt55fT
+.. section: Library
+
+Fix bug where TestCase.assertLogs doesn't correctly filter messages by
+level.
+
+..
+
+.. bpo: 41923
+.. date: 2020-10-03-23-14-50
+.. nonce: Buonw9
+.. section: Library
+
+Implement :pep:`613`, introducing :data:`typing.TypeAlias` annotation.
+
+..
+
+.. bpo: 41905
+.. date: 2020-10-01-21-11-03
+.. nonce: _JpjR4
+.. section: Library
+
+A new function in abc: *update_abstractmethods* to re-calculate an abstract
+class's abstract status. In addition, *dataclass* has been changed to call
+this function.
+
+..
+
+.. bpo: 23706
+.. date: 2020-09-30-11-05-11
+.. nonce: dHTGjF
+.. section: Library
+
+Added *newline* parameter to ``pathlib.Path.write_text()``.
+
+..
+
+.. bpo: 41876
+.. date: 2020-09-29-16-23-54
+.. nonce: QicdDU
+.. section: Library
+
+Tkinter font class repr uses font name
+
+..
+
+.. bpo: 41831
+.. date: 2020-09-22-11-07-50
+.. nonce: k-Eop_
+.. section: Library
+
+``str()`` for the ``type`` attribute of the ``tkinter.Event`` object always
+returns now the numeric code returned by Tk instead of the name of the event
+type.
+
+..
+
+.. bpo: 39337
+.. date: 2020-09-13-02-02-18
+.. nonce: L3NXTt
+.. section: Library
+
+:func:`encodings.normalize_encoding` now ignores non-ASCII characters.
+
+..
+
+.. bpo: 41747
+.. date: 2020-09-08-23-41-29
+.. nonce: M6wLKv
+.. section: Library
+
+Ensure all methods that generated from :func:`dataclasses.dataclass` objects
+now have the proper ``__qualname__`` attribute referring to the class they
+belong to. Patch by Batuhan Taskaya.
+
+..
+
+.. bpo: 30681
+.. date: 2020-09-04-17-33-04
+.. nonce: LR4fnY
+.. section: Library
+
+Handle exceptions caused by unparsable date headers when using email
+"default" policy.  Patch by Tim Bell, Georges Toth
+
+..
+
+.. bpo: 41586
+.. date: 2020-08-19-08-32-13
+.. nonce: IYjmjK
+.. section: Library
+
+Add F_SETPIPE_SZ and F_GETPIPE_SZ to fcntl module. Allow setting pipesize on
+subprocess.Popen.
+
+..
+
+.. bpo: 41229
+.. date: 2020-07-19-20-10-41
+.. nonce: p8rJa2
+.. section: Library
+
+Add ``contextlib.aclosing`` for deterministic cleanup of async generators
+which is analogous to ``contextlib.closing`` for non-async generators. Patch
+by Joongi Kim and John Belmonte.
+
+..
+
+.. bpo: 16396
+.. date: 2020-07-08-09-45-00
+.. nonce: z8o8Pn
+.. section: Library
+
+Allow ``ctypes.wintypes`` to be imported on non-Windows systems.
+
+..
+
+.. bpo: 4356
+.. date: 2020-05-31-10-48-47
+.. nonce: P8kXqp
+.. section: Library
+
+Add a key function to the bisect module.
+
+..
+
+.. bpo: 40592
+.. date: 2020-05-14-16-01-34
+.. nonce: Cmk855
+.. section: Library
+
+:func:`shutil.which` now ignores empty entries in :envvar:`PATHEXT` instead
+of treating them as a match.
+
+..
+
+.. bpo: 40492
+.. date: 2020-05-04-12-16-00
+.. nonce: ONk9Na
+.. section: Library
+
+Fix ``--outfile`` for :mod:`cProfile` / :mod:`profile` not writing the
+output file in the original directory when the program being profiled
+changes the working directory.  PR by Anthony Sottile.
+
+..
+
+.. bpo: 34204
+.. date: 2020-04-21-17-18-33
+.. nonce: 9wXTtY
+.. section: Library
+
+The :mod:`shelve` module now uses :data:`pickle.DEFAULT_PROTOCOL` by default
+instead of :mod:`pickle` protocol ``3``.
+
+..
+
+.. bpo: 27321
+.. date: 2020-01-19-18-40-26
+.. nonce: 8e6SpM
+.. section: Library
+
+Fixed KeyError exception when flattening an email to a string attempts to
+replace a non-existent Content-Transfer-Encoding header.
+
+..
+
+.. bpo: 38976
+.. date: 2019-12-05-05-22-49
+.. nonce: 5MG7Uu
+.. section: Library
+
+The :mod:`http.cookiejar` module now supports the parsing of cookies in
+CURL-style cookiejar files through MozillaCookieJar on all platforms.
+Previously, such cookie entries would be silently ignored when loading a
+cookiejar with such entries.
+
+Additionally, the HTTP Only attribute is persisted in the object, and will
+be correctly written to file if the MozillaCookieJar object is subsequently
+dumped.
+
+..
+
+.. bpo: 42061
+.. date: 2020-10-28-21-39-45
+.. nonce: _x-0sg
+.. section: Documentation
+
+Document __format__ functionality for IP addresses.
+
+..
+
+.. bpo: 41910
+.. date: 2020-10-21-14-40-54
+.. nonce: CzBMit
+.. section: Documentation
+
+Document the default implementation of `object.__eq__`.
+
+..
+
+.. bpo: 42010
+.. date: 2020-10-21-02-21-14
+.. nonce: 76vJ0u
+.. section: Documentation
+
+Clarify that subscription expressions are also valid for certain
+:term:`classes <class>` and :term:`types <type>` in the standard library,
+and for user-defined classes and types if the classmethod
+:meth:`__class_getitem__` is provided.
+
+..
+
+.. bpo: 41805
+.. date: 2020-10-10-01-36-37
+.. nonce: l-CGv5
+.. section: Documentation
+
+Documented :ref:`generic alias type <types-genericalias>` and
+:data:`types.GenericAlias`. Also added an entry in glossary for
+:term:`generic types <generic type>`.
+
+..
+
+.. bpo: 39693
+.. date: 2020-02-24-09-02-05
+.. nonce: QXw0Fm
+.. section: Documentation
+
+Fix tarfile's extractfile documentation
+
+..
+
+.. bpo: 39416
+.. date: 2020-01-22-05-14-53
+.. nonce: uYjhEm
+.. section: Documentation
+
+Document some restrictions on the default string representations of numeric
+classes.
+
+..
+
+.. bpo: 41739
+.. date: 2020-10-12-00-11-47
+.. nonce: wSCc4K
+.. section: Tests
+
+Fix test_logging.test_race_between_set_target_and_flush(): the test now
+waits until all threads complete to avoid leaking running threads.
+
+..
+
+.. bpo: 41970
+.. date: 2020-10-08-14-00-17
+.. nonce: aZ8QFf
+.. section: Tests
+
+Avoid a test failure in ``test_lib2to3`` if the module has already imported
+at the time the test executes. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 41944
+.. date: 2020-10-05-17-43-46
+.. nonce: rf1dYb
+.. section: Tests
+
+Tests for CJK codecs no longer call ``eval()`` on content received via HTTP.
+
+..
+
+.. bpo: 41306
+.. date: 2020-08-03-13-44-37
+.. nonce: VDoWXI
+.. section: Tests
+
+Fixed a failure in ``test_tk.test_widgets.ScaleTest`` happening when
+executing the test with Tk 8.6.10.
+
+..
+
+.. bpo: 38980
+.. date: 2020-10-21-18-31-54
+.. nonce: xz7BNd
+.. section: Build
+
+Add ``-fno-semantic-interposition`` to both the compile and link line when
+building with ``--enable-optimizations``. Patch by Victor Stinner and Pablo
+Galindo.
+
+..
+
+.. bpo: 38439
+.. date: 2020-10-20-13-19-42
+.. nonce: eMLi-t
+.. section: Windows
+
+Updates the icons for IDLE in the Windows Store package.
+
+..
+
+.. bpo: 38252
+.. date: 2020-10-18-18-43-45
+.. nonce: 7Nlepg
+.. section: Windows
+
+Use 8-byte step to detect ASCII sequence in 64-bit Windows build.
+
+..
+
+.. bpo: 39107
+.. date: 2020-09-24-23-09-40
+.. nonce: GbUZvD
+.. section: Windows
+
+Update Tcl and Tk to 8.6.10 in Windows installer.
+
+..
+
+.. bpo: 41557
+.. date: 2020-08-26-09-35-06
+.. nonce: vt00cQ
+.. section: Windows
+
+Update Windows installer to use SQLite 3.33.0.
+
+..
+
+.. bpo: 38324
+.. date: 2020-05-30-02-46-43
+.. nonce: 476M-5
+.. section: Windows
+
+Avoid Unicode errors when accessing certain locale data on Windows.
+
+..
+
+.. bpo: 41471
+.. date: 2020-10-19-12-25-19
+.. nonce: gwA7un
+.. section: macOS
+
+Ignore invalid prefix lengths in system proxy excludes.
+
+..
+
+.. bpo: 33987
+.. date: 2020-10-24-21-27-37
+.. nonce: fIh9JL
+.. section: IDLE
+
+Mostly finish using ttk widgets, mainly for editor, settings, and searches.
+Some patches by Mark Roseman.
+
+..
+
+.. bpo: 40511
+.. date: 2020-06-16-12-16-13
+.. nonce: XkihpM
+.. section: IDLE
+
+Typing opening and closing parentheses inside the parentheses of a function
+call will no longer cause unnecessary "flashing" off and on of an existing
+open call-tip, e.g. when typed in a string literal.
+
+..
+
+.. bpo: 38439
+.. date: 2020-04-22-09-37-40
+.. nonce: ieXL-c
+.. section: IDLE
+
+Add a 256×256 pixel IDLE icon to the Windows .ico file. Created by Andrew
+Clover. Remove the low-color gif variations from the .ico file.
+
+..
+
+.. bpo: 42157
+.. date: 2020-10-16-10-47-17
+.. nonce: e3BcPM
+.. section: C API
+
+The private ``_PyUnicode_Name_CAPI`` structure of the PyCapsule API
+``unicodedata.ucnhash_CAPI`` has been moved to the internal C API. Patch by
+Victor Stinner.
+
+..
+
+.. bpo: 42015
+.. date: 2020-10-12-20-13-58
+.. nonce: X4H2_V
+.. section: C API
+
+Fix potential crash in deallocating method objects when dynamically
+allocated `PyMethodDef`'s lifetime is managed through the ``self`` argument
+of a `PyCFunction`.
+
+..
+
+.. bpo: 40423
+.. date: 2020-10-11-19-17-44
+.. nonce: GsmgEj
+.. section: C API
+
+The :mod:`subprocess` module and ``os.closerange`` will now use the
+``close_range(low, high, flags)`` syscall when it is available for more
+efficient closing of ranges of descriptors.
+
+..
+
+.. bpo: 41845
+.. date: 2020-10-11-05-05-53
+.. nonce: ZFvuQM
+.. section: C API
+
+:c:func:`PyObject_GenericGetDict` is available again in the limited API when
+targeting 3.10 or later.
+
+..
+
+.. bpo: 40422
+.. date: 2020-10-10-14-05-24
+.. nonce: sh8IDY
+.. section: C API
+
+Add `_Py_closerange` function to provide performant closing of a range of
+file descriptors.
+
+..
+
+.. bpo: 41986
+.. date: 2020-10-09-22-50-46
+.. nonce: JUPE59
+.. section: C API
+
+:c:data:`Py_FileSystemDefaultEncodeErrors` and :c:data:`Py_UTF8Mode` are
+available again in limited API.
+
+..
+
+.. bpo: 41756
+.. date: 2020-09-28-14-31-07
+.. nonce: ZZ5wJG
+.. section: C API
+
+Add `PyIter_Send` function to allow sending value into
+generator/coroutine/iterator without raising StopIteration exception to
+signal return.
+
+..
+
+.. bpo: 41784
+.. date: 2020-09-14-10-17-00
+.. nonce: Yl4gI2
+.. section: C API
+
+Added ``PyUnicode_AsUTF8AndSize`` to the limited C API.
diff --git a/Misc/NEWS.d/3.10.0a3.rst b/Misc/NEWS.d/3.10.0a3.rst
new file mode 100644
index 0000000..4f182e8
--- /dev/null
+++ b/Misc/NEWS.d/3.10.0a3.rst
@@ -0,0 +1,1504 @@
+.. bpo: 40791
+.. date: 2020-05-28-06-06-47
+.. nonce: QGZClX
+.. release date: 2020-12-07
+.. section: Security
+
+Add ``volatile`` to the accumulator variable in ``hmac.compare_digest``,
+making constant-time-defeating optimizations less likely.
+
+..
+
+.. bpo: 42576
+.. date: 2020-12-05-22-34-47
+.. nonce: lEeEl7
+.. section: Core and Builtins
+
+``types.GenericAlias`` will now raise a ``TypeError`` when attempting to
+initialize with a keyword argument.  Previously, this would cause the
+interpreter to crash if the interpreter was compiled with debug symbols.
+This does not affect interpreters compiled for release.  Patch by Ken Jin.
+
+..
+
+.. bpo: 42536
+.. date: 2020-12-02-20-23-31
+.. nonce: Kx3ZOu
+.. section: Core and Builtins
+
+Several built-in and standard library types now ensure that their internal
+result tuples are always tracked by the :term:`garbage collector <garbage
+collection>`:
+
+- :meth:`collections.OrderedDict.items() <collections.OrderedDict>`
+
+- :meth:`dict.items`
+
+- :func:`enumerate`
+
+- :func:`functools.reduce`
+
+- :func:`itertools.combinations`
+
+- :func:`itertools.combinations_with_replacement`
+
+- :func:`itertools.permutations`
+
+- :func:`itertools.product`
+
+- :func:`itertools.zip_longest`
+
+- :func:`zip`
+
+Previously, they could have become untracked by a prior garbage collection.
+Patch by Brandt Bucher.
+
+..
+
+.. bpo: 42500
+.. date: 2020-11-30-14-27-29
+.. nonce: excVKU
+.. section: Core and Builtins
+
+Improve handling of exceptions near recursion limit. Converts a number of
+Fatal Errors in RecursionErrors.
+
+..
+
+.. bpo: 42246
+.. date: 2020-11-24-14-01-43
+.. nonce: c9k9hj
+.. section: Core and Builtins
+
+PEP 626: After a return, the f_lineno attribute of a frame is always the
+last line executed.
+
+..
+
+.. bpo: 42435
+.. date: 2020-11-22-14-34-55
+.. nonce: uwlB2W
+.. section: Core and Builtins
+
+Speed up comparison of bytes objects with non-bytes objects when option
+:option:`-b` is specified. Speed up comparison of bytarray objects with
+non-buffer object.
+
+..
+
+.. bpo: 1635741
+.. date: 2020-11-18-23-46-31
+.. nonce: GVOQ-m
+.. section: Core and Builtins
+
+Port the ``_warnings`` extension module to the multi-phase initialization
+API (:pep:`489`). Patch by Victor Stinner.
+
+..
+
+.. bpo: 41686
+.. date: 2020-11-17-16-25-50
+.. nonce: hX77kL
+.. section: Core and Builtins
+
+On Windows, the ``SIGINT`` event, ``_PyOS_SigintEvent()``, is now created
+even if Python is configured to not install signal handlers (if
+:c:member:`PyConfig.install_signal_handlers` equals to 0, or
+``Py_InitializeEx(0)``).
+
+..
+
+.. bpo: 42381
+.. date: 2020-11-16-23-45-56
+.. nonce: G4AWxL
+.. section: Core and Builtins
+
+Allow assignment expressions in set literals and set comprehensions as per
+PEP 572. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 42202
+.. date: 2020-11-16-18-13-07
+.. nonce: ZxenYD
+.. section: Core and Builtins
+
+Change function parameters annotations internal representation to tuple of
+strings. Patch provided by Yurii Karabas.
+
+..
+
+.. bpo: 42374
+.. date: 2020-11-16-17-57-09
+.. nonce: t7np1E
+.. section: Core and Builtins
+
+Fix a regression introduced by the new parser, where an unparenthesized
+walrus operator was not allowed within generator expressions.
+
+..
+
+.. bpo: 42316
+.. date: 2020-11-16-17-30-03
+.. nonce: _DdmpQ
+.. section: Core and Builtins
+
+Allow an unparenthesized walrus in subscript indexes.
+
+..
+
+.. bpo: 42349
+.. date: 2020-11-13-17-25-44
+.. nonce: JdWxez
+.. section: Core and Builtins
+
+Make sure that the compiler front-end produces a well-formed control flow
+graph. Be be more aggressive in the compiler back-end, as it is now safe to
+do so.
+
+..
+
+.. bpo: 42296
+.. date: 2020-11-13-13-53-11
+.. nonce: DuGrLJ
+.. section: Core and Builtins
+
+On Windows, fix a regression in signal handling which prevented to interrupt
+a program using CTRL+C. The signal handler can be run in a thread different
+than the Python thread, in which case the test deciding if the thread can
+handle signals is wrong.
+
+..
+
+.. bpo: 42332
+.. date: 2020-11-12-23-16-14
+.. nonce: fEQIdk
+.. section: Core and Builtins
+
+:class:`types.GenericAlias` objects can now be the targets of weakrefs.
+
+..
+
+.. bpo: 42282
+.. date: 2020-11-07-21-02-05
+.. nonce: M1W4Wj
+.. section: Core and Builtins
+
+Optimise constant subexpressions that appear as part of named expressions
+(previously the AST optimiser did not descend into named expressions). Patch
+by Nick Coghlan.
+
+..
+
+.. bpo: 42266
+.. date: 2020-11-04-23-03-25
+.. nonce: G4hGDe
+.. section: Core and Builtins
+
+Fixed a bug with the LOAD_ATTR opcode cache that was not respecting
+monkey-patching a class-level attribute to make it a descriptor. Patch by
+Pablo Galindo.
+
+..
+
+.. bpo: 40077
+.. date: 2020-11-03-21-58-27
+.. nonce: a9qM1j
+.. section: Core and Builtins
+
+Convert :mod:`queue` to use heap types.
+
+..
+
+.. bpo: 42246
+.. date: 2020-11-02-15-48-17
+.. nonce: 3CNQEX
+.. section: Core and Builtins
+
+Improved accuracy of line tracing events and f_lineno attribute of Frame
+objects. See PEP 626 for details.
+
+..
+
+.. bpo: 40077
+.. date: 2020-11-02-14-39-48
+.. nonce: grY9TG
+.. section: Core and Builtins
+
+Convert :mod:`mmap` to use heap types.
+
+..
+
+.. bpo: 42233
+.. date: 2020-11-01-23-34-56
+.. nonce: zOSzja
+.. section: Core and Builtins
+
+Allow ``GenericAlias`` objects to use :ref:`union type expressions
+<types-union>`. This allows expressions like ``list[int] | dict[float,
+str]`` where previously a ``TypeError`` would have been thrown.  This also
+fixes union type expressions not de-duplicating ``GenericAlias`` objects.
+(Contributed by Ken Jin in :issue:`42233`.)
+
+..
+
+.. bpo: 26131
+.. date: 2020-10-22-17-27-08
+.. nonce: B-Veg7
+.. section: Core and Builtins
+
+The import system triggers a `ImportWarning` when it falls back to using
+`load_module()`.
+
+..
+
+.. bpo: 5054
+.. date: 2020-12-04-03-51-12
+.. nonce: 53StYZ
+.. section: Library
+
+CGIHTTPRequestHandler.run_cgi() HTTP_ACCEPT improperly parsed. Replace the
+special purpose getallmatchingheaders with generic get_all method and add
+relevant tests.
+
+Original Patch by Martin Panter. Modified by Senthil Kumaran.
+
+..
+
+.. bpo: 42562
+.. date: 2020-12-03-22-42-03
+.. nonce: 2hPmhi
+.. section: Library
+
+Fix issue when dis failed to parse function that has no line numbers. Patch
+provided by Yurii Karabas.
+
+..
+
+.. bpo: 17735
+.. date: 2020-12-03-22-22-24
+.. nonce: Qsaaue
+.. section: Library
+
+:func:`inspect.findsource` now raises :exc:`OSError` instead of
+:exc:`IndexError` when :attr:`co_lineno` of a code object is greater than
+the file length. This can happen, for example, when a file is edited after
+it was imported.  PR by Irit Katriel.
+
+..
+
+.. bpo: 42116
+.. date: 2020-12-03-15-42-32
+.. nonce: yIwroP
+.. section: Library
+
+Fix handling of trailing comments by :func:`inspect.getsource`.
+
+..
+
+.. bpo: 42532
+.. date: 2020-12-02-07-37-59
+.. nonce: ObNep_
+.. section: Library
+
+Remove unexpected call of ``__bool__`` when passing a ``spec_arg`` argument
+to a Mock.
+
+..
+
+.. bpo: 38200
+.. date: 2020-11-28-22-52-57
+.. nonce: DuWGlW
+.. section: Library
+
+Added itertools.pairwise()
+
+..
+
+.. bpo: 41818
+.. date: 2020-11-28-06-34-53
+.. nonce: mFSMc2
+.. section: Library
+
+Fix test_master_read() so that it succeeds on all platforms that either
+raise OSError or return b"" upon reading from master.
+
+..
+
+.. bpo: 42487
+.. date: 2020-11-28-04-31-20
+.. nonce: iqtC4L
+.. section: Library
+
+ChainMap.__iter__ no longer calls __getitem__ on underlying maps
+
+..
+
+.. bpo: 42482
+.. date: 2020-11-27-16-46-58
+.. nonce: EJC3sd
+.. section: Library
+
+:class:`~traceback.TracebackException` no longer holds a reference to the
+exception's traceback object. Consequently, instances of TracebackException
+for equivalent but non-equal exceptions now compare as equal.
+
+..
+
+.. bpo: 41818
+.. date: 2020-11-27-09-19-43
+.. nonce: KWYUbL
+.. section: Library
+
+Make test_openpty() avoid unexpected success due to number of rows and/or
+number of columns being == 0.
+
+..
+
+.. bpo: 42392
+.. date: 2020-11-26-12-40-16
+.. nonce: GbmdHE
+.. section: Library
+
+Remove loop parameter from ``asyncio.subprocess`` and ``asyncio.tasks``
+functions. Patch provided by Yurii Karabas.
+
+..
+
+.. bpo: 42392
+.. date: 2020-11-25-22-44-59
+.. nonce: T_DAEl
+.. section: Library
+
+Remove loop parameter from ``asyncio.open_connection`` and
+``asyncio.start_server`` functions. Patch provided by Yurii Karabas.
+
+..
+
+.. bpo: 28468
+.. date: 2020-11-24-13-18-05
+.. nonce: 8Gh2d4
+.. section: Library
+
+Add :func:`platform.freedesktop_os_release` function to parse
+freedesktop.org ``os-release`` files.
+
+..
+
+.. bpo: 42299
+.. date: 2020-11-23-23-42-08
+.. nonce: Fdn4Wf
+.. section: Library
+
+Removed the ``formatter`` module, which was deprecated in Python 3.4. It is
+somewhat obsolete, little used, and not tested. It was originally scheduled
+to be removed in Python 3.6, but such removals were delayed until after
+Python 2.7 EOL. Existing users should copy whatever classes they use into
+their code. Patch by Dong-hee Na and and Terry J. Reedy.
+
+..
+
+.. bpo: 26131
+.. date: 2020-11-22-12-30-26
+.. nonce: -HsFPG
+.. section: Library
+
+Deprecate zipimport.zipimporter.load_module() in favour of exec_module().
+
+..
+
+.. bpo: 41818
+.. date: 2020-11-20-14-44-07
+.. nonce: 33soAw
+.. section: Library
+
+Updated tests for the pty library. test_basic() has been changed to
+test_openpty(); this additionally checks if slave termios and slave winsize
+are being set properly by pty.openpty(). In order to add support for
+FreeBSD, NetBSD, OpenBSD, and Darwin, this also adds test_master_read(),
+which demonstrates that pty.spawn() should not depend on an OSError to exit
+from its copy loop.
+
+..
+
+.. bpo: 42392
+.. date: 2020-11-20-14-01-29
+.. nonce: -OUzvl
+.. section: Library
+
+Remove loop parameter from ``__init__`` in all ``asyncio.locks`` and
+``asyncio.Queue`` classes. Patch provided by Yurii Karabas.
+
+..
+
+.. bpo: 15450
+.. date: 2020-11-20-10-38-34
+.. nonce: E-y9PA
+.. section: Library
+
+Make :class:`filecmp.dircmp` respect subclassing. Now the
+:attr:`filecmp.dircmp.subdirs` behaves as expected when subclassing dircmp.
+
+..
+
+.. bpo: 42413
+.. date: 2020-11-19-20-27-51
+.. nonce: fjHrHx
+.. section: Library
+
+The exception :exc:`socket.timeout` is now an alias of :exc:`TimeoutError`.
+
+..
+
+.. bpo: 31904
+.. date: 2020-11-19-16-14-36
+.. nonce: 83kf9d
+.. section: Library
+
+Support signal module on VxWorks.
+
+..
+
+.. bpo: 42406
+.. date: 2020-11-19-10-44-41
+.. nonce: r9rNCj
+.. section: Library
+
+We fixed an issue in `pickle.whichmodule` in which importing
+`multiprocessing` could change the how pickle identifies which module an
+object belongs to, potentially breaking the unpickling of those objects.
+
+..
+
+.. bpo: 42403
+.. date: 2020-11-19-10-12-39
+.. nonce: t7q5AX
+.. section: Library
+
+Simplify the :mod:`importlib` external bootstrap code:
+``importlib._bootstrap_external`` now uses regular imports to import builtin
+modules. When it is imported, the builtin :func:`__import__()` function is
+already fully working and so can be used to import builtin modules like
+:mod:`sys`. Patch by Victor Stinner.
+
+..
+
+.. bpo: 1635741
+.. date: 2020-11-19-09-59-07
+.. nonce: 7cMypH
+.. section: Library
+
+Convert _sre module types to heap types (PEP 384). Patch by Erlend E.
+Aasland.
+
+..
+
+.. bpo: 42375
+.. date: 2020-11-19-04-13-53
+.. nonce: U8bp4s
+.. section: Library
+
+subprocess module update for DragonFlyBSD support.
+
+..
+
+.. bpo: 41713
+.. date: 2020-11-17-23-00-27
+.. nonce: -Us0tf
+.. section: Library
+
+Port the ``_signal`` extension module to the multi-phase initialization API
+(:pep:`489`). Patch by Victor Stinner and Mohamed Koubaa.
+
+..
+
+.. bpo: 37205
+.. date: 2020-11-16-15-08-12
+.. nonce: Wh5svI
+.. section: Library
+
+:func:`time.time()`, :func:`time.perf_counter()` and
+:func:`time.monotonic()` functions can no longer fail with a Python fatal
+error, instead raise a regular Python exception on failure.
+
+..
+
+.. bpo: 42328
+.. date: 2020-11-15-17-02-00
+.. nonce: bqpPlR
+.. section: Library
+
+Fixed :meth:`tkinter.ttk.Style.map`. The function accepts now the
+representation of the default state as empty sequence (as returned by
+``Style.map()``). The structure of the result is now the same on all
+platform and does not depend on the value of ``wantobjects``.
+
+..
+
+.. bpo: 42345
+.. date: 2020-11-15-15-23-34
+.. nonce: hiIR7x
+.. section: Library
+
+Fix various issues with ``typing.Literal`` parameter handling (flatten,
+deduplicate, use type to cache key). Patch provided by Yurii Karabas.
+
+..
+
+.. bpo: 37205
+.. date: 2020-11-14-14-34-32
+.. nonce: iDbHrw
+.. section: Library
+
+:func:`time.perf_counter()` on Windows and :func:`time.monotonic()` on macOS
+are now system-wide. Previously, they used an offset computed at startup to
+reduce the precision loss caused by the float type. Use
+:func:`time.perf_counter_ns()` and :func:`time.monotonic_ns()` added in
+Python 3.7 to avoid this precision loss.
+
+..
+
+.. bpo: 42318
+.. date: 2020-11-14-13-46-27
+.. nonce: wYAcBD
+.. section: Library
+
+Fixed support of non-BMP characters in :mod:`tkinter` on macOS.
+
+..
+
+.. bpo: 42350
+.. date: 2020-11-13-18-53-50
+.. nonce: rsql7V
+.. section: Library
+
+Fix the :class:`threading.Thread` class at fork: do nothing if the thread is
+already stopped (ex: fork called at Python exit). Previously, an error was
+logged in the child process.
+
+..
+
+.. bpo: 42333
+.. date: 2020-11-12-18-21-15
+.. nonce: J9vFmV
+.. section: Library
+
+Port _ssl extension module to heap types.
+
+..
+
+.. bpo: 42014
+.. date: 2020-11-10-15-40-56
+.. nonce: ShM37l
+.. section: Library
+
+The ``onerror`` callback from ``shutil.rmtree`` now receives correct
+function when ``os.open`` fails.
+
+..
+
+.. bpo: 42237
+.. date: 2020-11-10-14-27-49
+.. nonce: F363jO
+.. section: Library
+
+Fix `os.sendfile()` on illumos.
+
+..
+
+.. bpo: 42308
+.. date: 2020-11-10-12-09-13
+.. nonce: yaJHH9
+.. section: Library
+
+Add :data:`threading.__excepthook__` to allow retrieving the original value
+of :func:`threading.excepthook` in case it is set to a broken or a different
+value. Patch by Mario Corchero.
+
+..
+
+.. bpo: 42131
+.. date: 2020-11-06-18-20-47
+.. nonce: l2rjjG
+.. section: Library
+
+Implement PEP 451/spec methods on zipimport.zipimporter: find_spec(),
+create_module(), and exec_module().
+
+This also allows for the documented deprecation of find_loader(),
+find_module(), and load_module().
+
+..
+
+.. bpo: 41877
+.. date: 2020-11-05-16-00-03
+.. nonce: FHbngM
+.. section: Library
+
+Mock objects which are not unsafe will now raise an AttributeError if an
+attribute with the prefix asert, aseert, or assrt is accessed, in addition
+to this already happening for the prefixes assert or assret.
+
+..
+
+.. bpo: 42264
+.. date: 2020-11-05-13-32-41
+.. nonce: r4KYUU
+.. section: Library
+
+``sqlite3.OptimizedUnicode`` has been undocumented and obsolete since Python
+3.3, when it was made an alias to :class:`str`.  It is now deprecated,
+scheduled for removal in Python 3.12.
+
+..
+
+.. bpo: 42251
+.. date: 2020-11-03-14-15-35
+.. nonce: 6TC32V
+.. section: Library
+
+Added :func:`threading.gettrace` and :func:`threading.getprofile` to
+retrieve the functions set by :func:`threading.settrace` and
+:func:`threading.setprofile` respectively. Patch by Mario Corchero.
+
+..
+
+.. bpo: 42249
+.. date: 2020-11-03-09-22-56
+.. nonce: vfNO2u
+.. section: Library
+
+Fixed writing binary Plist files larger than 4 GiB.
+
+..
+
+.. bpo: 42236
+.. date: 2020-11-02-23-05-17
+.. nonce: aJ6ZBR
+.. section: Library
+
+On Unix, the :func:`os.device_encoding` function now returns ``'UTF-8'``
+rather than the device encoding if the :ref:`Python UTF-8 Mode <utf8-mode>`
+is enabled.
+
+..
+
+.. bpo: 41754
+.. date: 2020-11-01-15-07-20
+.. nonce: DraSZh
+.. section: Library
+
+webbrowser: Ignore *NotADirectoryError* when calling ``xdg-settings``.
+
+..
+
+.. bpo: 42183
+.. date: 2020-10-29-11-17-35
+.. nonce: 50ZcIi
+.. section: Library
+
+Fix a stack overflow error for asyncio Task or Future repr().
+
+The overflow occurs under some circumstances when a Task or Future
+recursively returns itself.
+
+..
+
+.. bpo: 42140
+.. date: 2020-10-24-04-02-36
+.. nonce: miLqvb
+.. section: Library
+
+Improve asyncio.wait function to create the futures set just one time.
+
+..
+
+.. bpo: 42133
+.. date: 2020-10-23-15-47-47
+.. nonce: BzizYV
+.. section: Library
+
+Update various modules in the stdlib to fall back on `__spec__.loader` when
+`__loader__` isn't defined on a module.
+
+..
+
+.. bpo: 26131
+.. date: 2020-10-22-17-26-35
+.. nonce: CAsI3O
+.. section: Library
+
+The `load_module()` methods found in importlib now trigger a
+DeprecationWarning.
+
+..
+
+.. bpo: 39825
+.. date: 2020-10-20-08-28-26
+.. nonce: n6KnG0
+.. section: Library
+
+Windows: Change ``sysconfig.get_config_var('EXT_SUFFIX')`` to the expected
+full ``platform_tag.extension`` format. Previously it was hard-coded to
+``.pyd``, now it is compatible with ``distutils.sysconfig`` and will result
+in something like ``.cp38-win_amd64.pyd``. This brings windows into
+conformance with the other platforms.
+
+..
+
+.. bpo: 26389
+.. date: 2020-10-08-23-51-55
+.. nonce: uga44e
+.. section: Library
+
+The :func:`traceback.format_exception`,
+:func:`traceback.format_exception_only`, and
+:func:`traceback.print_exception` functions can now take an exception object
+as a positional-only argument.
+
+..
+
+.. bpo: 41889
+.. date: 2020-10-01-16-17-11
+.. nonce: qLkNh8
+.. section: Library
+
+Enum: fix regression involving inheriting a multiply-inherited enum
+
+..
+
+.. bpo: 41861
+.. date: 2020-10-01-15-44-52
+.. nonce: YTqJ7z
+.. section: Library
+
+Convert :mod:`sqlite3` to use heap types (PEP 384). Patch by Erlend E.
+Aasland.
+
+..
+
+.. bpo: 40624
+.. date: 2020-09-08-03-19-04
+.. nonce: 0-gYfx
+.. section: Library
+
+Added support for the XPath ``!=`` operator in xml.etree
+
+..
+
+.. bpo: 28850
+.. date: 2020-09-06-21-55-44
+.. nonce: HJNggD
+.. section: Library
+
+Fix :meth:`pprint.PrettyPrinter.format` overrides being ignored for contents
+of small containers. The :func:`pprint._safe_repr` function was removed.
+
+..
+
+.. bpo: 41625
+.. date: 2020-08-24-16-59-04
+.. nonce: Cc967V
+.. section: Library
+
+Expose the :c:func:`splice` as :func:`os.splice` in the :mod:`os` module.
+Patch by Pablo Galindo
+
+..
+
+.. bpo: 34215
+.. date: 2020-08-19-20-17-51
+.. nonce: _Cv8c-
+.. section: Library
+
+Clarify the error message for :exc:`asyncio.IncompleteReadError` when
+``expected`` is ``None``.
+
+..
+
+.. bpo: 41543
+.. date: 2020-08-14-00-39-04
+.. nonce: RpcRjb
+.. section: Library
+
+Add async context manager support for contextlib.nullcontext.
+
+..
+
+.. bpo: 21041
+.. date: 2020-08-10-15-06-55
+.. nonce: cYz1eL
+.. section: Library
+
+:attr:`pathlib.PurePath.parents` now supports negative indexing. Patch
+contributed by Yaroslav Pankovych.
+
+..
+
+.. bpo: 41332
+.. date: 2020-07-18-17-39-28
+.. nonce: QRGmA5
+.. section: Library
+
+Added missing connect_accepted_socket() method to
+``asyncio.AbstractEventLoop``.
+
+..
+
+.. bpo: 12800
+.. date: 2020-07-09-11-32-28
+.. nonce: fNgWwx
+.. section: Library
+
+Extracting a symlink from a tarball should succeed and overwrite the symlink
+if it already exists. The fix is to remove the existing file or symlink
+before extraction. Based on patch by Chris AtLee, Jeffrey Kintscher, and
+Senthil Kumaran.
+
+..
+
+.. bpo: 40968
+.. date: 2020-06-18-11-35-16
+.. nonce: R8Edbv
+.. section: Library
+
+:mod:`urllib.request` and :mod:`http.client` now send ``http/1.1`` ALPN
+extension during TLS handshake when no custom context is supplied.
+
+..
+
+.. bpo: 41001
+.. date: 2020-06-17-12-24-26
+.. nonce: 5mi7b0
+.. section: Library
+
+Add func:`os.eventfd` to provide a low level interface for Linux's event
+notification file descriptor.
+
+..
+
+.. bpo: 40816
+.. date: 2020-05-29-15-25-41
+.. nonce: w61Pob
+.. section: Library
+
+Add AsyncContextDecorator to contextlib to support async context manager as
+a decorator.
+
+..
+
+.. bpo: 40550
+.. date: 2020-05-08-21-30-54
+.. nonce: i7GWkb
+.. section: Library
+
+Fix time-of-check/time-of-action issue in subprocess.Popen.send_signal.
+
+..
+
+.. bpo: 39411
+.. date: 2020-01-21-16-38-25
+.. nonce: 9uHFqT
+.. section: Library
+
+Add an ``is_async`` identifier to :mod:`pyclbr`'s ``Function`` objects.
+Patch by Batuhan Taskaya
+
+..
+
+.. bpo: 35498
+.. date: 2018-12-14-13-29-17
+.. nonce: LEJHl7
+.. section: Library
+
+Add slice support to :attr:`pathlib.PurePath.parents`.
+
+..
+
+.. bpo: 42238
+.. date: 2020-11-24-22-54-49
+.. nonce: 62EOTu
+.. section: Documentation
+
+Tentative to deprecate ``make suspicious`` by first removing it from the CI
+and documentation builds, but keeping it around for manual uses.
+
+..
+
+.. bpo: 42153
+.. date: 2020-11-15-13-46-31
+.. nonce: KjBhx3
+.. section: Documentation
+
+Fix the URL for the IMAP protocol documents.
+
+..
+
+.. bpo: 41028
+.. date: 2020-06-18-23-37-03
+.. nonce: vM8bC8
+.. section: Documentation
+
+Language and version switchers, previously maintained in every cpython
+branches, are now handled by docsbuild-script.
+
+..
+
+.. bpo: 41473
+.. date: 2020-12-04-11-47-09
+.. nonce: W_updK
+.. section: Tests
+
+Re-enable test_gdb on gdb 9.2 and newer:
+https://bugzilla.redhat.com/show_bug.cgi?id=1866884 bug is fixed in gdb
+10.1.
+
+..
+
+.. bpo: 42553
+.. date: 2020-12-03-13-32-44
+.. nonce: 2TRE2N
+.. section: Tests
+
+Fix ``test_asyncio.test_call_later()`` race condition: don't measure asyncio
+performance in the ``call_later()`` unit test. The test failed randomly on
+the CI.
+
+..
+
+.. bpo: 31904
+.. date: 2020-12-01-15-51-19
+.. nonce: iwetj4
+.. section: Tests
+
+Fix test_netrc on VxWorks: create temporary directories using temp_cwd().
+
+..
+
+.. bpo: 31904
+.. date: 2020-11-26-11-13-13
+.. nonce: ay4g89
+.. section: Tests
+
+skip test_getaddrinfo_ipv6_scopeid_symbolic and
+test_getnameinfo_ipv6_scopeid_symbolic on VxWorks
+
+..
+
+.. bpo: 31904
+.. date: 2020-11-25-17-00-53
+.. nonce: ue4hd9
+.. section: Tests
+
+skip test_test of test_mailcap on VxWorks
+
+..
+
+.. bpo: 31904
+.. date: 2020-11-24-17-26-41
+.. nonce: eug834
+.. section: Tests
+
+add shell requirement for test_pipes
+
+..
+
+.. bpo: 31904
+.. date: 2020-11-23-11-11-29
+.. nonce: V3sUZk
+.. section: Tests
+
+skip some tests related to fifo on VxWorks
+
+..
+
+.. bpo: 31904
+.. date: 2020-11-20-15-07-18
+.. nonce: EBJXjJ
+.. section: Tests
+
+Fix test_doctest.py failures for VxWorks.
+
+..
+
+.. bpo: 40754
+.. date: 2020-11-13-21-51-34
+.. nonce: Ekoxkg
+.. section: Tests
+
+Include ``_testinternalcapi`` module in Windows installer for test suite
+
+..
+
+.. bpo: 41561
+.. date: 2020-09-18-16-14-03
+.. nonce: uPnwrW
+.. section: Tests
+
+test_ssl: skip test_min_max_version_mismatch when TLS 1.0 is not available
+
+..
+
+.. bpo: 31904
+.. date: 2020-05-20-17-28-46
+.. nonce: yt83Ge
+.. section: Tests
+
+Fix os module failures for VxWorks RTOS.
+
+..
+
+.. bpo: 31904
+.. date: 2020-05-20-14-28-48
+.. nonce: yJik6k
+.. section: Tests
+
+Fix fifo test cases for VxWorks RTOS.
+
+..
+
+.. bpo: 31904
+.. date: 2020-11-19-17-01-50
+.. nonce: 894dk2
+.. section: Build
+
+remove libnet dependency from detect_socket() for VxWorks
+
+..
+
+.. bpo: 42398
+.. date: 2020-11-18-11-58-44
+.. nonce: Yt5wO8
+.. section: Build
+
+Fix a race condition in "make regen-all" when make -jN option is used to run
+jobs in parallel. The clinic.py script now only use atomic write to write
+files. Moveover, generated files are now left unchanged if the content does
+not change, to not change the file modification time.
+
+..
+
+.. bpo: 41617
+.. date: 2020-11-13-15-04-53
+.. nonce: 98_oaE
+.. section: Build
+
+Fix building ``pycore_bitutils.h`` internal header on old clang version
+without ``__builtin_bswap16()`` (ex: Xcode 4.6.3 on Mac OS X 10.7). Patch by
+Joshua Root and Victor Stinner.
+
+..
+
+.. bpo: 38823
+.. date: 2020-11-12-13-45-15
+.. nonce: C0z_Fe
+.. section: Build
+
+It is no longer possible to build the ``_ctypes`` extension module without
+:c:type:`wchar_t` type: remove ``CTYPES_UNICODE`` macro. Anyway, the
+:c:type:`wchar_t` type is required to build Python. Patch by Victor Stinner.
+
+..
+
+.. bpo: 42087
+.. date: 2020-10-19-15-41-05
+.. nonce: 2AhRFP
+.. section: Build
+
+Support was removed for AIX 5.3 and below. See :issue:`40680`.
+
+..
+
+.. bpo: 40998
+.. date: 2020-06-17-09-05-02
+.. nonce: sgqmg9
+.. section: Build
+
+Addressed three compiler warnings found by undefined behavior sanitizer
+(ubsan).
+
+..
+
+.. bpo: 42120
+.. date: 2020-11-16-22-41-02
+.. nonce: 9scgko
+.. section: Windows
+
+Remove macro definition of ``copysign`` (to ``_copysign``) in headers.
+
+..
+
+.. bpo: 38506
+.. date: 2020-11-15-23-01-14
+.. nonce: hhdnuP
+.. section: Windows
+
+The Windows launcher now properly handles Python 3.10 when listing installed
+Python versions.
+
+..
+
+.. bpo: 42504
+.. date: 2020-12-02-15-48-40
+.. nonce: RQmMOR
+.. section: macOS
+
+Fix build on macOS Big Sur when MACOSX_DEPLOYMENT_TARGET=11
+
+..
+
+.. bpo: 41116
+.. date: 2020-11-15-16-43-45
+.. nonce: oCkbrF
+.. section: macOS
+
+Ensure distutils.unixxcompiler.find_library_file can find system provided
+libraries on macOS 11.
+
+..
+
+.. bpo: 41100
+.. date: 2020-11-01-16-40-23
+.. nonce: BApztP
+.. section: macOS
+
+Add support for macOS 11 and Apple Silicon systems.
+
+It is now possible to build "Universal 2" binaries using
+"--enable-universalsdk --with-universal-archs=universal2".
+
+Binaries build on later macOS versions can be deployed back to older
+versions (tested up to macOS 10.9), when using the correct deployment
+target. This is tested using Xcode 11 and later.
+
+..
+
+.. bpo: 42232
+.. date: 2020-11-01-15-10-28
+.. nonce: 2zI1GN
+.. section: macOS
+
+Added Darwin specific madvise options to mmap module.
+
+..
+
+.. bpo: 38443
+.. date: 2020-10-23-10-26-53
+.. nonce: vu64tl
+.. section: macOS
+
+The ``--enable-universalsdk`` and ``--with-universal-archs`` options for the
+configure script now check that the specified architectures can be used.
+
+..
+
+.. bpo: 42508
+.. date: 2020-11-30-19-46-05
+.. nonce: fE7w4M
+.. section: IDLE
+
+Keep IDLE running on macOS.  Remove obsolete workaround that prevented
+running files with shortcuts when using new universal2 installers built on
+macOS 11.
+
+..
+
+.. bpo: 42426
+.. date: 2020-11-21-17-21-21
+.. nonce: kNnPoC
+.. section: IDLE
+
+Fix reporting offset of the RE error in searchengine.
+
+..
+
+.. bpo: 42415
+.. date: 2020-11-20-01-30-27
+.. nonce: CyD-va
+.. section: IDLE
+
+Get docstrings for IDLE calltips more often by using inspect.getdoc.
+
+..
+
+.. bpo: 42212
+.. date: 2020-11-20-15-11-05
+.. nonce: sjzgOf
+.. section: Tools/Demos
+
+The smelly.py script now also checks the Python dynamic library and
+extension modules, not only the Python static library. Make also the script
+more verbose: explain what it does.
+
+..
+
+.. bpo: 36310
+.. date: 2020-05-03-01-30-46
+.. nonce: xDxxwY
+.. section: Tools/Demos
+
+Allow :file:`Tools/i18n/pygettext.py` to detect calls to ``gettext`` in
+f-strings.
+
+..
+
+.. bpo: 42423
+.. date: 2020-11-21-12-27-19
+.. nonce: ByJHhY
+.. section: C API
+
+The :c:func:`PyType_FromSpecWithBases` and
+:c:func:`PyType_FromModuleAndSpec` functions now accept a single class as
+the *bases* argument.
+
+..
+
+.. bpo: 1635741
+.. date: 2020-11-19-17-44-36
+.. nonce: qBZc3o
+.. section: C API
+
+Port :mod:`select` extension module to multiphase initialization
+(:pep:`489`).
+
+..
+
+.. bpo: 1635741
+.. date: 2020-11-19-16-54-16
+.. nonce: 9tVsZt
+.. section: C API
+
+Port _posixsubprocess extension module to multiphase initialization
+(:pep:`489`).
+
+..
+
+.. bpo: 1635741
+.. date: 2020-11-19-15-33-42
+.. nonce: 9tVsZt
+.. section: C API
+
+Port _posixshmem extension module to multiphase initialization (:pep:`489`)
+
+..
+
+.. bpo: 1635741
+.. date: 2020-11-19-12-06-43
+.. nonce: KEfZpn
+.. section: C API
+
+Port _struct extension module to multiphase initialization (:pep:`489`)
+
+..
+
+.. bpo: 1635741
+.. date: 2020-11-19-09-17-01
+.. nonce: 6F9o6L
+.. section: C API
+
+Port :mod:`spwd` extension module to multiphase initialization (:pep:`489`)
+
+..
+
+.. bpo: 1635741
+.. date: 2020-11-18-20-33-35
+.. nonce: B4ztSk
+.. section: C API
+
+Port :mod:`gc` extension module to multiphase initialization (:pep:`489`)
+
+..
+
+.. bpo: 1635741
+.. date: 2020-11-18-20-11-13
+.. nonce: fe3iRb
+.. section: C API
+
+Port _queue extension module to multiphase initialization (:pep:`489`)
+
+..
+
+.. bpo: 39573
+.. date: 2020-11-18-15-21-59
+.. nonce: VB3G2y
+.. section: C API
+
+Convert :c:func:`Py_TYPE` and :c:func:`Py_SIZE` back to macros to allow
+using them as an l-value. Many third party C extension modules rely on the
+ability of using Py_TYPE() and Py_SIZE() to set an object type and size:
+``Py_TYPE(obj) = type;`` and ``Py_SIZE(obj) = size;``.
+
+..
+
+.. bpo: 1635741
+.. date: 2020-11-18-10-52-38
+.. nonce: FrWAwJ
+.. section: C API
+
+Port :mod:`symtable` extension module to multiphase initialization
+(:pep:`489`)
+
+..
+
+.. bpo: 1635741
+.. date: 2020-11-18-09-46-35
+.. nonce: SH8OIT
+.. section: C API
+
+Port :mod:`grp` and :mod:`pwd` extension modules to multiphase
+initialization (:pep:`489`)
+
+..
+
+.. bpo: 1635741
+.. date: 2020-11-18-09-16-23
+.. nonce: gkoI7Y
+.. section: C API
+
+Port _random extension module to multiphase initialization (:pep:`489`)
+
+..
+
+.. bpo: 1635741
+.. date: 2020-11-18-08-45-36
+.. nonce: VLZfiY
+.. section: C API
+
+Port _hashlib extension module to multiphase initialization (:pep:`489`)
+
+..
+
+.. bpo: 41713
+.. date: 2020-11-17-15-39-10
+.. nonce: Rq99Vc
+.. section: C API
+
+Removed the undocumented ``PyOS_InitInterrupts()`` function. Initializing
+Python already implicitly installs signal handlers: see
+:c:member:`PyConfig.install_signal_handlers`. Patch by Victor Stinner.
+
+..
+
+.. bpo: 40170
+.. date: 2020-11-13-01-40-28
+.. nonce: uh8lEf
+.. section: C API
+
+The ``Py_TRASHCAN_BEGIN`` macro no longer accesses PyTypeObject attributes,
+but now can get the condition by calling the new private
+:c:func:`_PyTrash_cond()` function which hides implementation details.
+
+..
+
+.. bpo: 42260
+.. date: 2020-11-10-14-27-39
+.. nonce: -Br3Co
+.. section: C API
+
+:c:func:`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`,
+:c:func:`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome` and
+:c:func:`Py_GetProgramName` functions now return ``NULL`` if called before
+:c:func:`Py_Initialize` (before Python is initialized). Use the new
+:ref:`Python Initialization Configuration API <init-config>` to get the
+:ref:`Python Path Configuration.  <init-path-config>`. Patch by Victor
+Stinner.
+
+..
+
+.. bpo: 42260
+.. date: 2020-11-05-18-02-07
+.. nonce: pAeaNR
+.. section: C API
+
+The :c:func:`PyConfig_Read` function now only parses
+:c:member:`PyConfig.argv` arguments once: :c:member:`PyConfig.parse_argv` is
+set to ``2`` after arguments are parsed. Since Python arguments are
+strippped from :c:member:`PyConfig.argv`, parsing arguments twice would
+parse the application options as Python options.
+
+..
+
+.. bpo: 42262
+.. date: 2020-11-04-17-22-36
+.. nonce: fCWzBb
+.. section: C API
+
+Added :c:func:`Py_NewRef` and :c:func:`Py_XNewRef` functions to increment
+the reference count of an object and return the object. Patch by Victor
+Stinner.
+
+..
+
+.. bpo: 42260
+.. date: 2020-11-04-16-31-55
+.. nonce: CmgHtF
+.. section: C API
+
+When :c:func:`Py_Initialize` is called twice, the second call now updates
+more :mod:`sys` attributes for the configuration, rather than only
+:data:`sys.argv`. Patch by Victor Stinner.
+
+..
+
+.. bpo: 41832
+.. date: 2020-11-03-19-47-06
+.. nonce: dL1VJJ
+.. section: C API
+
+The :c:func:`PyType_FromModuleAndSpec` function now accepts NULL ``tp_doc``
+slot.
+
+..
+
+.. bpo: 1635741
+.. date: 2020-11-03-11-52-27
+.. nonce: aDYJKB
+.. section: C API
+
+Added :c:func:`PyModule_AddObjectRef` function: similar to
+:c:func:`PyModule_AddObject` but don't steal a reference to the value on
+success. Patch by Victor Stinner.
+
+..
+
+.. bpo: 42171
+.. date: 2020-10-27-21-10-14
+.. nonce: S3FWTP
+.. section: C API
+
+The :c:data:`METH_FASTCALL` calling convention is added to the limited API.
+The functions  :c:func:`PyModule_AddType`,
+:c:func:`PyType_FromModuleAndSpec`, :c:func:`PyType_GetModule` and
+:c:func:`PyType_GetModuleState` are added to the limited API on Windows.
+
+..
+
+.. bpo: 42085
+.. date: 2020-10-19-15-58-16
+.. nonce: NhEf3W
+.. section: C API
+
+Add dedicated entry to PyAsyncMethods for sending values
+
+..
+
+.. bpo: 41073
+.. date: 2020-07-08-21-01-49
+.. nonce: VqQZON
+.. section: C API
+
+:c:func:`PyType_GetSlot()` can now accept static types.
+
+..
+
+.. bpo: 30459
+.. date: 2020-05-06-23-54-57
+.. nonce: N9_Jai
+.. section: C API
+
+:c:func:`PyList_SET_ITEM`, :c:func:`PyTuple_SET_ITEM` and
+:c:func:`PyCell_SET` macros can no longer be used as l-value or r-value. For
+example, ``x = PyList_SET_ITEM(a, b, c)`` and ``PyList_SET_ITEM(a, b, c) =
+x`` now fail with a compiler error. It prevents bugs like ``if
+(PyList_SET_ITEM (a, b, c) < 0) ...`` test. Patch by Zackery Spytz and
+Victor Stinner.
diff --git a/Misc/NEWS.d/3.10.0a4.rst b/Misc/NEWS.d/3.10.0a4.rst
new file mode 100644
index 0000000..214f9e5
--- /dev/null
+++ b/Misc/NEWS.d/3.10.0a4.rst
@@ -0,0 +1,995 @@
+.. bpo: 42814
+.. date: 2021-01-03-04-41-25
+.. nonce: sDvVbb
+.. release date: 2021-01-04
+.. section: Core and Builtins
+
+Fix undefined behavior in ``Objects/genericaliasobject.c``.
+
+..
+
+.. bpo: 42806
+.. date: 2021-01-03-00-20-38
+.. nonce: mLAobJ
+.. section: Core and Builtins
+
+Fix the column offsets for f-strings :mod:`ast` nodes surrounded by
+parentheses and for nodes that spawn multiple lines. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 40631
+.. date: 2020-12-31-20-58-22
+.. nonce: deRMCx
+.. section: Core and Builtins
+
+Fix regression where a single parenthesized starred expression was a valid
+assignment target.
+
+..
+
+.. bpo: 27794
+.. date: 2020-12-27-18-07-43
+.. nonce: sxgfGi
+.. section: Core and Builtins
+
+Improve the error message for failed writes/deletes to property objects.
+When possible, the attribute name is now shown. Patch provided by Yurii
+Karabas.
+
+..
+
+.. bpo: 42745
+.. date: 2020-12-25-23-30-58
+.. nonce: XsFoHS
+.. section: Core and Builtins
+
+Make the type attribute lookup cache per-interpreter. Patch by Victor
+Stinner.
+
+..
+
+.. bpo: 42246
+.. date: 2020-12-22-20-30-11
+.. nonce: 7BrPLg
+.. section: Core and Builtins
+
+Jumps to jumps are not eliminated when it would break PEP 626.
+
+..
+
+.. bpo: 42246
+.. date: 2020-12-16-14-44-21
+.. nonce: RtIEY7
+.. section: Core and Builtins
+
+Make sure that the ``f_lasti`` and ``f_lineno`` attributes of a frame are
+set correctly when an exception is raised or re-raised. Required for PEP
+626.
+
+..
+
+.. bpo: 32381
+.. date: 2020-12-15-18-43-43
+.. nonce: 3tIofL
+.. section: Core and Builtins
+
+The coding cookie (ex: ``# coding: latin1``) is now ignored in the command
+passed to the :option:`-c` command line option. Patch by Victor Stinner.
+
+..
+
+.. bpo: 30858
+.. date: 2020-12-13-15-23-09
+.. nonce: -f9G4z
+.. section: Core and Builtins
+
+Improve error location in expressions that contain assignments. Patch by
+Pablo Galindo and Lysandros Nikolaou.
+
+..
+
+.. bpo: 42615
+.. date: 2020-12-10-17-06-52
+.. nonce: Je6Q-r
+.. section: Core and Builtins
+
+Remove jump commands made redundant by the deletion of unreachable bytecode
+blocks
+
+..
+
+.. bpo: 42639
+.. date: 2020-12-09-01-55-10
+.. nonce: 5pI5HG
+.. section: Core and Builtins
+
+Make the :mod:`atexit` module state per-interpreter. It is now safe have
+more than one :mod:`atexit` module instance. Patch by Dong-hee Na and Victor
+Stinner.
+
+..
+
+.. bpo: 32381
+.. date: 2020-12-04-17-17-44
+.. nonce: NY5t2S
+.. section: Core and Builtins
+
+Fix encoding name when running a ``.pyc`` file on Windows:
+:c:func:`PyRun_SimpleFileExFlags()` now uses the correct encoding to decode
+the filename.
+
+..
+
+.. bpo: 42195
+.. date: 2020-11-20-00-57-47
+.. nonce: HeqcpS
+.. section: Core and Builtins
+
+The ``__args__`` of the parameterized generics for :data:`typing.Callable`
+and :class:`collections.abc.Callable` are now consistent.  The ``__args__``
+for :class:`collections.abc.Callable` are now flattened while
+:data:`typing.Callable`'s have not changed.  To allow this change,
+:class:`types.GenericAlias` can now be subclassed and
+``collections.abc.Callable``'s ``__class_getitem__`` will now return a
+subclass of ``types.GenericAlias``.  Tests for typing were also updated to
+not subclass things like ``Callable[..., T]`` as that is not a valid base
+class.  Finally, both ``Callable``\ s no longer validate their ``argtypes``,
+in ``Callable[[argtypes], resulttype]`` to prepare for :pep:`612`.  Patch by
+Ken Jin.
+
+..
+
+.. bpo: 40137
+.. date: 2020-11-19-23-12-57
+.. nonce: bihl9O
+.. section: Core and Builtins
+
+Convert functools module to use :c:func:`PyType_FromModuleAndSpec`.
+
+..
+
+.. bpo: 40077
+.. date: 2020-11-03-13-46-10
+.. nonce: NfAIdj
+.. section: Core and Builtins
+
+Convert :mod:`array` to use heap types, and establish module state for
+these.
+
+..
+
+.. bpo: 42008
+.. date: 2020-10-12-14-51-59
+.. nonce: ijWw2I
+.. section: Core and Builtins
+
+Fix _random.Random() seeding.
+
+..
+
+.. bpo: 1635741
+.. date: 2020-09-12-19-21-52
+.. nonce: F2kDrU
+.. section: Core and Builtins
+
+Port the :mod:`pyexpat` extension module to multi-phase initialization
+(:pep:`489`).
+
+..
+
+.. bpo: 40521
+.. date: 2020-05-14-02-55-39
+.. nonce: dIlXsZ
+.. section: Core and Builtins
+
+Make the Unicode dictionary of interned strings compatible with
+subinterpreters. Patch by Victor Stinner.
+
+..
+
+.. bpo: 39465
+.. date: 2020-05-13-18-50-27
+.. nonce: j7nl6A
+.. section: Core and Builtins
+
+Make :c:func:`_PyUnicode_FromId` function compatible with subinterpreters.
+Each interpreter now has an array of identifier objects (interned strings
+decoded from UTF-8). Patch by Victor Stinner.
+
+..
+
+.. bpo: 42257
+.. date: 2020-12-31-23-05-53
+.. nonce: ALQy7B
+.. section: Library
+
+Handle empty string in variable executable in platform.libc_ver()
+
+..
+
+.. bpo: 42772
+.. date: 2020-12-30-17-16-43
+.. nonce: Xe7WFV
+.. section: Library
+
+randrange() now raises a TypeError when step is specified without a stop
+argument.  Formerly, it silently ignored the step argument.
+
+..
+
+.. bpo: 42759
+.. date: 2020-12-27-22-19-26
+.. nonce: lGi_03
+.. section: Library
+
+Fixed equality comparison of :class:`tkinter.Variable` and
+:class:`tkinter.font.Font`. Objects which belong to different Tcl
+interpreters are now always different, even if they have the same name.
+
+..
+
+.. bpo: 42756
+.. date: 2020-12-27-21-22-01
+.. nonce: dHMPJ9
+.. section: Library
+
+Configure LMTP Unix-domain socket to use socket global default timeout when
+a timeout is not explicitly provided.
+
+..
+
+.. bpo: 23328
+.. date: 2020-12-27-18-47-01
+.. nonce: _xqepZ
+.. section: Library
+
+Allow / character in username, password fields on _PROXY envars.
+
+..
+
+.. bpo: 42740
+.. date: 2020-12-25-23-23-11
+.. nonce: F0rQ_E
+.. section: Library
+
+:func:`typing.get_args` and :func:`typing.get_origin` now support :pep:`604`
+union types and :pep:`612` additions to ``Callable``.
+
+..
+
+.. bpo: 42655
+.. date: 2020-12-25-12-32-47
+.. nonce: W5ytpV
+.. section: Library
+
+:mod:`subprocess` *extra_groups* is now correctly passed into setgroups()
+system call.
+
+..
+
+.. bpo: 42727
+.. date: 2020-12-23-19-43-06
+.. nonce: WH3ODh
+.. section: Library
+
+``EnumMeta.__prepare__`` now accepts ``**kwds`` to properly support
+``__init_subclass__``
+
+..
+
+.. bpo: 38308
+.. date: 2020-12-23-15-16-12
+.. nonce: lB4Sv0
+.. section: Library
+
+Add optional *weights* to *statistics.harmonic_mean()*.
+
+..
+
+.. bpo: 42721
+.. date: 2020-12-22-22-47-22
+.. nonce: I5Ai5L
+.. section: Library
+
+When simple query dialogs (:mod:`tkinter.simpledialog`), message boxes
+(:mod:`tkinter.messagebox`) or color choose dialog
+(:mod:`tkinter.colorchooser`) are created without arguments *master* and
+*parent*, and the default root window is not yet created, and
+:func:`~tkinter.NoDefaultRoot` was not called, a new temporal hidden root
+window will be created automatically. It will not be set as the default root
+window and will be destroyed right after closing the dialog window. It will
+help to use these simple dialog windows in programs which do not need other
+GUI.
+
+..
+
+.. bpo: 25246
+.. date: 2020-12-22-13-16-43
+.. nonce: GhhCTl
+.. section: Library
+
+Optimized :meth:`collections.deque.remove`.
+
+..
+
+.. bpo: 35728
+.. date: 2020-12-21-23-34-57
+.. nonce: 9m-azF
+.. section: Library
+
+Added a root parameter to :func:`tkinter.font.nametofont`.
+
+..
+
+.. bpo: 15303
+.. date: 2020-12-21-22-59-26
+.. nonce: zozVrq
+.. section: Library
+
+:mod:`tkinter` supports now widgets with boolean value False.
+
+..
+
+.. bpo: 42681
+.. date: 2020-12-20-22-50-15
+.. nonce: lDO6jb
+.. section: Library
+
+Fixed range checks for color and pair numbers in :mod:`curses`.
+
+..
+
+.. bpo: 42685
+.. date: 2020-12-19-17-32-43
+.. nonce: kwZlwp
+.. section: Library
+
+Improved placing of simple query windows in Tkinter (such as
+:func:`tkinter.simpledialog.askinteger`). They are now centered at the
+center of the parent window if it is specified and shown, otherwise at the
+center of the screen.
+
+..
+
+.. bpo: 9694
+.. date: 2020-12-19-12-33-38
+.. nonce: CkKK9V
+.. section: Library
+
+Argparse help no longer uses the confusing phrase, "optional arguments". It
+uses "options" instead.
+
+..
+
+.. bpo: 1635741
+.. date: 2020-12-16-23-28-52
+.. nonce: Quy3zn
+.. section: Library
+
+Port the :mod:`_thread` extension module to the multiphase initialization
+API (:pep:`489`) and convert its static types to heap types.
+
+..
+
+.. bpo: 37961
+.. date: 2020-12-16-16-16-33
+.. nonce: jrESEq
+.. section: Library
+
+Fix crash in :func:`tracemalloc.Traceback.__repr__` (regressed in Python
+3.9).
+
+..
+
+.. bpo: 42630
+.. date: 2020-12-15-17-51-27
+.. nonce: jf4jBl
+.. section: Library
+
+:mod:`tkinter` functions and constructors which need a default root window
+raise now :exc:`RuntimeError` with descriptive message instead of obscure
+:exc:`AttributeError` or :exc:`NameError` if it is not created yet or cannot
+be created automatically.
+
+..
+
+.. bpo: 42639
+.. date: 2020-12-15-15-14-29
+.. nonce: uJ3h8I
+.. section: Library
+
+:func:`atexit._run_exitfuncs` now logs callback exceptions using
+:data:`sys.unraisablehook`, rather than logging them directly into
+:data:`sys.stderr` and raise the last exception.
+
+..
+
+.. bpo: 42644
+.. date: 2020-12-15-10-00-04
+.. nonce: XgLCNx
+.. section: Library
+
+``logging.disable`` will now validate the types and value of its parameter.
+It also now accepts strings representing the levels (as does
+``loging.setLevel``) instead of only the numerical values.
+
+..
+
+.. bpo: 42639
+.. date: 2020-12-14-22-31-22
+.. nonce: 5Z3iWX
+.. section: Library
+
+At Python exit, if a callback registered with :func:`atexit.register` fails,
+its exception is now logged. Previously, only some exceptions were logged,
+and the last exception was always silently ignored.
+
+..
+
+.. bpo: 36541
+.. date: 2020-12-14-08-23-57
+.. nonce: qdEtZv
+.. section: Library
+
+Fixed lib2to3.pgen2 to be able to parse PEP-570 positional only argument
+syntax.
+
+..
+
+.. bpo: 42382
+.. date: 2020-12-13-22-05-35
+.. nonce: 2YtKo5
+.. section: Library
+
+In ``importlib.metadata``: -  ``EntryPoint`` objects now expose a ``.dist``
+object referencing the ``Distribution`` when constructed from a
+``Distribution``. - Add support for package discovery under package
+normalization rules. - The object returned by ``metadata()`` now has a
+formally-defined protocol called ``PackageMetadata`` with declared support
+for the ``.get_all()`` method. - Synced with importlib_metadata 3.3.
+
+..
+
+.. bpo: 41877
+.. date: 2020-12-10-19-49-52
+.. nonce: wiVlPc
+.. section: Library
+
+A check is added against misspellings of autospect, auto_spec and set_spec
+being passed as arguments to patch, patch.object and create_autospec.
+
+..
+
+.. bpo: 39717
+.. date: 2020-12-10-18-36-52
+.. nonce: sK2u0w
+.. section: Library
+
+[tarfile] update nested exception raising to use ``from None`` or ``from e``
+
+..
+
+.. bpo: 41877
+.. date: 2020-12-10-09-24-44
+.. nonce: iJSCvM
+.. section: Library
+
+AttributeError for suspected misspellings of assertions on mocks are now
+pointing out that the cause are misspelled assertions and also what to do if
+the misspelling is actually an intended attribute name. The unittest.mock
+document is also updated to reflect the current set of recognised
+misspellings.
+
+..
+
+.. bpo: 41559
+.. date: 2020-12-10-00-09-40
+.. nonce: 1l4yjP
+.. section: Library
+
+Implemented :pep:`612`: added ``ParamSpec`` and ``Concatenate`` to
+:mod:`typing`.  Patch by Ken Jin.
+
+..
+
+.. bpo: 42385
+.. date: 2020-12-09-19-45-32
+.. nonce: boGbjo
+.. section: Library
+
+StrEnum: fix _generate_next_value_ to return a str
+
+..
+
+.. bpo: 31904
+.. date: 2020-12-09-15-23-28
+.. nonce: g3k5k3
+.. section: Library
+
+Define THREAD_STACK_SIZE for VxWorks.
+
+..
+
+.. bpo: 34750
+.. date: 2020-12-09-14-15-48
+.. nonce: x8TASR
+.. section: Library
+
+[Enum] `_EnumDict.update()` is now supported
+
+..
+
+.. bpo: 42517
+.. date: 2020-12-09-10-59-16
+.. nonce: FKEVcZ
+.. section: Library
+
+Enum: private names do not become members / do not generate errors -- they
+remain normal attributes
+
+..
+
+.. bpo: 42678
+.. date: 2020-12-08-22-43-35
+.. nonce: ba9ktU
+.. section: Library
+
+``Enum``: call ``__init_subclass__`` after members have been added
+
+..
+
+.. bpo: 28964
+.. date: 2020-12-07-13-21-00
+.. nonce: UTQikc
+.. section: Library
+
+:func:`ast.literal_eval` adds line number information (if available) in
+error message for malformed nodes.
+
+..
+
+.. bpo: 42470
+.. date: 2020-12-06-12-00-00
+.. nonce: iqtC4L
+.. section: Library
+
+:func:`random.sample` no longer warns on a sequence which is also a set.
+
+..
+
+.. bpo: 31904
+.. date: 2020-11-27-18-09-59
+.. nonce: g8k43d
+.. section: Library
+
+:func:`posixpath.expanduser` returns the input *path* unchanged if user home
+directory is None on VxWorks.
+
+..
+
+.. bpo: 42388
+.. date: 2020-11-22-11-22-28
+.. nonce: LMgM6B
+.. section: Library
+
+Fix subprocess.check_output(..., input=None) behavior when text=True to be
+consistent with that of the documentation and universal_newlines=True.
+
+..
+
+.. bpo: 34463
+.. date: 2020-11-20-19-00-27
+.. nonce: aJcm56
+.. section: Library
+
+Fixed discrepancy between :mod:`traceback` and the interpreter in formatting
+of SyntaxError with lineno not set (:mod:`traceback` was changed to match
+interpreter).
+
+..
+
+.. bpo: 42393
+.. date: 2020-11-17-22-06-15
+.. nonce: BB0oXc
+.. section: Library
+
+Raise :exc:`OverflowError` instead of silent truncation in
+:meth:`socket.ntohs` and :meth:`socket.htons`.  Silent truncation was
+deprecated in Python 3.7. Patch by Erlend E. Aasland
+
+..
+
+.. bpo: 42222
+.. date: 2020-10-31-10-28-32
+.. nonce: Cfl1eR
+.. section: Library
+
+Harmonized :func:`random.randrange` argument handling to match :func:`range`.
+
+* The integer test and conversion in ``randrange()`` now uses
+  :func:`operator.index`.
+* Non-integer arguments to ``randrange()`` are deprecated.
+* The ``ValueError`` is deprecated in favor of a ``TypeError``.
+* It now runs a little faster than before.
+
+(Contributed by Raymond Hettinger and Serhiy Storchaka.)
+
+..
+
+.. bpo: 42163
+.. date: 2020-10-29-09-22-56
+.. nonce: O4VcCY
+.. section: Library
+
+Restore compatibility for ``uname_result`` around deepcopy and _replace.
+
+..
+
+.. bpo: 42090
+.. date: 2020-10-25-14-48-57
+.. nonce: Ubuc0j
+.. section: Library
+
+``zipfile.Path.joinpath`` now accepts arbitrary arguments, same as
+``pathlib.Path.joinpath``.
+
+..
+
+.. bpo: 1635741
+.. date: 2020-10-20-23-28-55
+.. nonce: Iyka3r
+.. section: Library
+
+Port the _csv module to the multi-phase initialization API (:pep:`489`).
+
+..
+
+.. bpo: 42059
+.. date: 2020-10-17-12-42-08
+.. nonce: ZGMZ3D
+.. section: Library
+
+:class:`typing.TypedDict` types created using the alternative call-style
+syntax now correctly respect the ``total`` keyword argument when setting
+their ``__required_keys__`` and ``__optional_keys__`` class attributes.
+
+..
+
+.. bpo: 41960
+.. date: 2020-10-06-23-59-20
+.. nonce: icQ7Xd
+.. section: Library
+
+Add ``globalns`` and ``localns`` parameters to the :func:`inspect.signature`
+and :meth:`inspect.Signature.from_callable`.
+
+..
+
+.. bpo: 41907
+.. date: 2020-10-02-10-19-49
+.. nonce: wiIEsz
+.. section: Library
+
+fix ``format()`` behavior for ``IntFlag``
+
+..
+
+.. bpo: 41891
+.. date: 2020-09-30-13-35-29
+.. nonce: pNAeYI
+.. section: Library
+
+Ensure asyncio.wait_for waits for task completion
+
+..
+
+.. bpo: 24792
+.. date: 2020-09-11-16-07-00
+.. nonce: Z-ARra
+.. section: Library
+
+Fixed bug where :mod:`zipimporter` sometimes reports an incorrect cause of
+import errors.
+
+..
+
+.. bpo: 31904
+.. date: 2020-08-11-17-44-07
+.. nonce: cb13ea
+.. section: Library
+
+Fix site and sysconfig modules for VxWorks RTOS which has no home
+directories.
+
+..
+
+.. bpo: 41462
+.. date: 2020-08-03-17-54-32
+.. nonce: ek38d_
+.. section: Library
+
+Add :func:`os.set_blocking()` support for VxWorks RTOS.
+
+..
+
+.. bpo: 40219
+.. date: 2020-07-13-19-43-11
+.. nonce: MUoJEP
+.. section: Library
+
+Lowered :class:`tkinter.ttk.LabeledScale` dummy widget to prevent hiding
+part of the content label.
+
+..
+
+.. bpo: 37193
+.. date: 2020-06-12-21-23-20
+.. nonce: wJximU
+.. section: Library
+
+Fixed memory leak in ``socketserver.ThreadingMixIn`` introduced in Python
+3.7.
+
+..
+
+.. bpo: 39068
+.. date: 2019-12-16-17-55-31
+.. nonce: Ti3f9P
+.. section: Library
+
+Fix initialization race condition in :func:`a85encode` and :func:`b85encode`
+in :mod:`base64`. Patch by Brandon Stansbury.
+
+..
+
+.. bpo: 17140
+.. date: 2020-12-16-21-06-16
+.. nonce: 1leSEg
+.. section: Documentation
+
+Add documentation for the :class:`multiprocessing.pool.ThreadPool` class.
+
+..
+
+.. bpo: 34398
+.. date: 2019-03-04-18-51-21
+.. nonce: YedUqW
+.. section: Documentation
+
+Prominently feature listings from the glossary in documentation search
+results. Patch by Ammar Askar.
+
+..
+
+.. bpo: 42794
+.. date: 2021-01-01-08-52-36
+.. nonce: -7-XGz
+.. section: Tests
+
+Update test_nntplib to use official group name of news.aioe.org for testing.
+Patch by Dong-hee Na.
+
+..
+
+.. bpo: 31904
+.. date: 2020-12-17-15-42-44
+.. nonce: d8g3l0d5
+.. section: Tests
+
+Skip some asyncio tests on VxWorks.
+
+..
+
+.. bpo: 42641
+.. date: 2020-12-15-17-38-04
+.. nonce: uzwlF_
+.. section: Tests
+
+Enhance ``test_select.test_select()``: it now takes 500 ms rather than 10
+seconds. Use Python rather than a shell to make the test more portable.
+
+..
+
+.. bpo: 31904
+.. date: 2020-12-09-15-23-28
+.. nonce: ghj38d
+.. section: Tests
+
+Skip some tests in _test_all_chown_common() on VxWorks.
+
+..
+
+.. bpo: 42199
+.. date: 2020-10-29-21-26-46
+.. nonce: KksGCV
+.. section: Tests
+
+Fix bytecode helper assertNotInBytecode.
+
+..
+
+.. bpo: 41443
+.. date: 2020-07-30-18-43-05
+.. nonce: 834gyg
+.. section: Tests
+
+Add more attribute checking in test_posix.py
+
+..
+
+.. bpo: 31904
+.. date: 2020-07-30-18-06-15
+.. nonce: y3d8dk
+.. section: Tests
+
+Disable os.popen and impacted tests on VxWorks
+
+..
+
+.. bpo: 41439
+.. date: 2020-07-30-14-08-58
+.. nonce: yhteoi
+.. section: Tests
+
+Port test_ssl and test_uuid to VxWorks RTOS.
+
+..
+
+.. bpo: 42692
+.. date: 2021-01-04-05-07-30
+.. nonce: OO11SN
+.. section: Build
+
+Fix __builtin_available check on older compilers. Patch by Joshua Root.
+
+..
+
+.. bpo: 27640
+.. date: 2020-12-22-17-57-04
+.. nonce: j3a8r0
+.. section: Build
+
+Added ``--disable-test-modules`` option to the ``configure`` script: don't
+build nor install test modules. Patch by Xavier de Gaye, Thomas Petazzoni
+and Peixing Xin.
+
+..
+
+.. bpo: 42604
+.. date: 2020-12-20-02-35-28
+.. nonce: gRd89w
+.. section: Build
+
+Now all platforms use a value for the "EXT_SUFFIX" build variable derived
+from SOABI (for instance in freeBSD, "EXT_SUFFIX" is now ".cpython-310d.so"
+instead of ".so"). Previously only Linux, Mac and VxWorks were using a value
+for "EXT_SUFFIX" that included "SOABI".
+
+..
+
+.. bpo: 42598
+.. date: 2020-12-13-14-43-10
+.. nonce: 7ipr5H
+.. section: Build
+
+Fix implicit function declarations in configure which could have resulted in
+incorrect configuration checks.  Patch contributed by Joshua Root.
+
+..
+
+.. bpo: 31904
+.. date: 2020-12-11-18-04-38
+.. nonce: j3j6d8
+.. section: Build
+
+Enable libpython3.so for VxWorks.
+
+..
+
+.. bpo: 29076
+.. date: 2020-02-28-14-33-15
+.. nonce: Gtixi5
+.. section: Build
+
+Add fish shell support to macOS installer.
+
+..
+
+.. bpo: 42361
+.. date: 2021-01-04-01-17-17
+.. nonce: eolZAi
+.. section: macOS
+
+Update macOS installer build to use Tcl/Tk 8.6.11 (rc2, expected to be final
+release).
+
+..
+
+.. bpo: 41837
+.. date: 2021-01-04-00-48-08
+.. nonce: dX-unJ
+.. section: macOS
+
+Update macOS installer build to use OpenSSL 1.1.1i.
+
+..
+
+.. bpo: 42584
+.. date: 2020-12-07-11-37-35
+.. nonce: LygmqQ
+.. section: macOS
+
+Update macOS installer to use SQLite 3.34.0.
+
+..
+
+.. bpo: 42726
+.. date: 2020-12-23-19-42-11
+.. nonce: a5EkTv
+.. section: Tools/Demos
+
+Fixed Python 3 compatibility issue with gdb/libpython.py handling of
+attribute dictionaries.
+
+..
+
+.. bpo: 42613
+.. date: 2020-12-16-09-10-32
+.. nonce: J-jnm5
+.. section: Tools/Demos
+
+Fix ``freeze.py`` tool to use the prope config and library directories.
+Patch by Victor Stinner.
+
+..
+
+.. bpo: 42591
+.. date: 2020-12-10-10-43-03
+.. nonce: CXNY8G
+.. section: C API
+
+Export the :c:func:`Py_FrozenMain` function: fix a Python 3.9.0 regression.
+Python 3.9 uses ``-fvisibility=hidden`` and the function was not exported
+explicitly and so not exported.
+
+..
+
+.. bpo: 32381
+.. date: 2020-12-09-00-35-25
+.. nonce: Je08Ny
+.. section: C API
+
+Remove the private :c:func:`_Py_fopen` function which is no longer needed.
+Use :c:func:`_Py_wfopen` or :c:func:`_Py_fopen_obj` instead. Patch by Victor
+Stinner.
+
+..
+
+.. bpo: 1635741
+.. date: 2020-11-22-13-46-06
+.. nonce: -fJLzA
+.. section: C API
+
+Port :mod:`resource` extension module to module state
+
+..
+
+.. bpo: 42111
+.. date: 2020-10-21-18-43-06
+.. nonce: 9pvtrc
+.. section: C API
+
+Update the ``xxlimited`` module to be a better example of how to use the
+limited C API.
+
+..
+
+.. bpo: 40052
+.. date: 2020-03-24-09-27-10
+.. nonce: 27P2KG
+.. section: C API
+
+Fix an alignment build warning/error in function
+``PyVectorcall_Function()``. Patch by Andreas Schneider, Antoine Pitrou and
+Petr Viktorin.
diff --git a/Misc/NEWS.d/3.10.0a5.rst b/Misc/NEWS.d/3.10.0a5.rst
new file mode 100644
index 0000000..1c7c744
--- /dev/null
+++ b/Misc/NEWS.d/3.10.0a5.rst
@@ -0,0 +1,670 @@
+.. bpo: 42938
+.. date: 2021-01-18-09-27-31
+.. nonce: 4Zn4Mp
+.. release date: 2021-02-02
+.. section: Security
+
+Avoid static buffers when computing the repr of :class:`ctypes.c_double` and
+:class:`ctypes.c_longdouble` values.
+
+..
+
+.. bpo: 42990
+.. date: 2021-01-30-11-31-44
+.. nonce: 69h_zK
+.. section: Core and Builtins
+
+Refactor the ``PyEval_`` family of functions.
+
+* An new function ``_PyEval_Vector`` is added to simplify calls to Python from C.
+* ``_PyEval_EvalCodeWithName`` is removed
+* ``PyEval_EvalCodeEx`` is retained as part of the API, but is not used internally
+
+..
+
+.. bpo: 38631
+.. date: 2021-01-29-17-48-44
+.. nonce: jR-3kC
+.. section: Core and Builtins
+
+Replace :c:func:`Py_FatalError` calls in the compiler with regular
+:exc:`SystemError` exceptions. Patch by Victor Stinner.
+
+..
+
+.. bpo: 42997
+.. date: 2021-01-24-20-19-55
+.. nonce: QUOPgP
+.. section: Core and Builtins
+
+Improve error message for missing ":" before blocks. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 43017
+.. date: 2021-01-24-18-02-05
+.. nonce: emEcXX
+.. section: Core and Builtins
+
+Improve error message in the parser when using un-parenthesised tuples in
+comprehensions. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 42986
+.. date: 2021-01-20-23-44-15
+.. nonce: sWoaGf
+.. section: Core and Builtins
+
+Fix parser crash when reporting syntax errors in f-string with newlines.
+Patch by Pablo Galindo.
+
+..
+
+.. bpo: 40176
+.. date: 2021-01-20-22-31-01
+.. nonce: anjyWw
+.. section: Core and Builtins
+
+Syntax errors for unterminated string literals now point to the start of the
+string instead of reporting EOF/EOL.
+
+..
+
+.. bpo: 42927
+.. date: 2021-01-15-20-05-56
+.. nonce: GI-l-7
+.. section: Core and Builtins
+
+The inline cache for ``LOAD_ATTR`` now also optimizes access to attributes
+defined by ``__slots__``. This makes reading such attribute up to 30%
+faster.
+
+..
+
+.. bpo: 42864
+.. date: 2021-01-14-23-15-34
+.. nonce: QgOAQ1
+.. section: Core and Builtins
+
+Improve error messages in the parser when parentheses are not closed. Patch
+by Pablo Galindo.
+
+..
+
+.. bpo: 42924
+.. date: 2021-01-13-14-06-01
+.. nonce: _WS1Ok
+.. section: Core and Builtins
+
+Fix ``bytearray`` repetition incorrectly copying data from the start of the
+buffer, even if the data is offset within the buffer (e.g. after reassigning
+a slice at the start of the ``bytearray`` to a shorter byte string).
+
+..
+
+.. bpo: 42882
+.. date: 2021-01-11-17-58-52
+.. nonce: WfTdfg
+.. section: Core and Builtins
+
+Fix the :c:func:`_PyUnicode_FromId` function (_Py_IDENTIFIER(var) API) when
+:c:func:`Py_Initialize` / :c:func:`Py_Finalize` is called multiple times:
+preserve ``_PyRuntime.unicode_ids.next_index`` value.
+
+..
+
+.. bpo: 42827
+.. date: 2021-01-06-17-06-37
+.. nonce: jtRR0D
+.. section: Core and Builtins
+
+Fix a crash when working out the error line of a :exc:`SyntaxError` in some
+multi-line expressions.
+
+..
+
+.. bpo: 42823
+.. date: 2021-01-04-18-17-07
+.. nonce: dcSynu
+.. section: Core and Builtins
+
+frame.f_lineno is correct even if frame.f_trace is set to True
+
+..
+
+.. bpo: 37324
+.. date: 2020-12-12-20-09-12
+.. nonce: jB-9_U
+.. section: Core and Builtins
+
+Remove deprecated aliases to :ref:`collections-abstract-base-classes` from
+the :mod:`collections` module.
+
+..
+
+.. bpo: 41994
+.. date: 2020-10-10-14-16-03
+.. nonce: Xop8sV
+.. section: Core and Builtins
+
+Fixed possible leak in ``import`` when ``sys.modules`` is not a ``dict``.
+
+..
+
+.. bpo: 27772
+.. date: 2018-12-20-23-59-23
+.. nonce: idHEcj
+.. section: Core and Builtins
+
+In string formatting, preceding the *width* field by ``'0'`` no longer
+affects the default alignment for strings.
+
+..
+
+.. bpo: 43108
+.. date: 2021-02-02-20-23-31
+.. nonce: lqcCZ6
+.. section: Library
+
+Fixed a reference leak in the :mod:`curses` module. Patch by Pablo Galindo
+
+..
+
+.. bpo: 43077
+.. date: 2021-01-30-15-20-06
+.. nonce: Owk61z
+.. section: Library
+
+Update the bundled pip to 21.0.1 and setuptools to 52.0.0.
+
+..
+
+.. bpo: 41282
+.. date: 2021-01-27-20-49-32
+.. nonce: SEPdV0
+.. section: Library
+
+Deprecate ``distutils`` in documentation and add warning on import.
+
+..
+
+.. bpo: 43014
+.. date: 2021-01-24-00-37-40
+.. nonce: BVPhEr
+.. section: Library
+
+Improve performance of :mod:`tokenize` by 20-30%.  Patch by Anthony Sottile.
+
+..
+
+.. bpo: 42323
+.. date: 2021-01-20-12-10-47
+.. nonce: PONB8e
+.. section: Library
+
+Fix :func:`math.nextafter` for NaN on AIX.
+
+..
+
+.. bpo: 42955
+.. date: 2021-01-18-11-59-46
+.. nonce: CSWLC9
+.. section: Library
+
+Add :data:`sys.stdlib_module_names`, containing the list of the standard
+library module names. Patch by Victor Stinner.
+
+..
+
+.. bpo: 42944
+.. date: 2021-01-18-10-41-44
+.. nonce: RrONvy
+.. section: Library
+
+Fix ``random.Random.sample`` when ``counts`` argument is not ``None``.
+
+..
+
+.. bpo: 42934
+.. date: 2021-01-15-11-48-00
+.. nonce: ILKoOI
+.. section: Library
+
+Use :class:`~traceback.TracebackException`'s new ``compact`` param in
+:class:`~unittest.TestResult` to reduce time and memory consumed by
+traceback formatting.
+
+..
+
+.. bpo: 42931
+.. date: 2021-01-15-00-23-50
+.. nonce: QD6U2B
+.. section: Library
+
+Add :func:`randbytes` to ``random.__all__``.
+
+..
+
+.. bpo: 38250
+.. date: 2021-01-14-15-07-16
+.. nonce: 1fvhOk
+.. section: Library
+
+[Enum] Flags consisting of a single bit are now considered canonical, and
+will be the only flags returned from listing and iterating over a Flag class
+or a Flag member.  Multi-bit flags are considered aliases; they will be
+returned from lookups and operations that result in their value. Iteration
+for both Flag and Flag members is in definition order.
+
+..
+
+.. bpo: 42877
+.. date: 2021-01-13-12-55-41
+.. nonce: Fi1zEG
+.. section: Library
+
+Added the ``compact`` parameter to the constructor of
+:class:`traceback.TracebackException` to reduce time and memory for use
+cases that only need to call :func:`TracebackException.format` and
+:func:`TracebackException.format_exception_only`.
+
+..
+
+.. bpo: 42923
+.. date: 2021-01-13-12-15-13
+.. nonce: zBiNls
+.. section: Library
+
+The :c:func:`Py_FatalError` function and the :mod:`faulthandler` module now
+dump the list of extension modules on a fatal error.
+
+..
+
+.. bpo: 42848
+.. date: 2021-01-12-19-34-06
+.. nonce: 5G8oBl
+.. section: Library
+
+Removed recursion from :class:`~traceback.TracebackException` to allow it to
+handle long exception chains.
+
+..
+
+.. bpo: 42901
+.. date: 2021-01-11-17-36-59
+.. nonce: gFd-ta
+.. section: Library
+
+[Enum] move member creation from ``EnumMeta.__new__`` to
+``_proto_member.__set_name__``, allowing members to be created and visible
+in ``__init_subclass__``.
+
+..
+
+.. bpo: 42780
+.. date: 2021-01-08-15-49-20
+.. nonce: rtqi6B
+.. section: Library
+
+Fix os.set_inheritable() for O_PATH file descriptors on Linux.
+
+..
+
+.. bpo: 42866
+.. date: 2021-01-08-10-57-21
+.. nonce: Y1DnrO
+.. section: Library
+
+Fix a reference leak in the ``getcodec()`` function of CJK codecs. Patch by
+Victor Stinner.
+
+..
+
+.. bpo: 42846
+.. date: 2021-01-07-23-31-17
+.. nonce: kukDjw
+.. section: Library
+
+Convert the 6 CJK codec extension modules (_codecs_cn, _codecs_hk,
+_codecs_iso2022, _codecs_jp, _codecs_kr and _codecs_tw) to the multiphase
+initialization API (:pep:`489`). Patch by Victor Stinner.
+
+..
+
+.. bpo: 42851
+.. date: 2021-01-07-11-44-22
+.. nonce: uyQFyd
+.. section: Library
+
+remove __init_subclass__ support for Enum members
+
+..
+
+.. bpo: 42834
+.. date: 2021-01-05-23-55-24
+.. nonce: LxRnZC
+.. section: Library
+
+Make internal caches of the ``_json`` module compatible with
+subinterpreters.
+
+..
+
+.. bpo: 41748
+.. date: 2021-01-05-21-26-29
+.. nonce: KdC0w3
+.. section: Library
+
+Fix HTMLParser parsing rules for element attributes containing commas with
+spaces. Patch by Karl Dubost.
+
+..
+
+.. bpo: 40810
+.. date: 2021-01-05-00-52-30
+.. nonce: JxQqPe
+.. section: Library
+
+Require SQLite 3.7.15 or newer. Patch by Erlend E. Aasland.
+
+..
+
+.. bpo: 1635741
+.. date: 2021-01-04-15-05-40
+.. nonce: EOCfZY
+.. section: Library
+
+Convert the _multibytecodec extension module (CJK codecs) to multi-phase
+initialization (:pep:`489`).  Patch by Erlend E. Aasland.
+
+..
+
+.. bpo: 42802
+.. date: 2021-01-01-15-29-16
+.. nonce: Lw-bzl
+.. section: Library
+
+The distutils ``bdist_wininst`` command deprecated in Python 3.8 has been
+removed. The distutils ``bdist_wheel`` command is now recommended to
+distribute binary packages on Windows.
+
+..
+
+.. bpo: 24464
+.. date: 2020-12-30-14-56-25
+.. nonce: vbNVHe
+.. section: Library
+
+The undocumented built-in function ``sqlite3.enable_shared_cache`` is now
+deprecated, scheduled for removal in Python 3.12.  Its use is strongly
+discouraged by the SQLite3 documentation.  Patch by Erlend E. Aasland.
+
+..
+
+.. bpo: 42384
+.. date: 2020-11-17-14-32-39
+.. nonce: 1ZnQSn
+.. section: Library
+
+Make pdb populate sys.path[0] exactly the same as regular python execution.
+
+..
+
+.. bpo: 42383
+.. date: 2020-11-17-14-30-12
+.. nonce: ubl0Y_
+.. section: Library
+
+Fix pdb: previously pdb would fail to restart the debugging target if it was
+specified using a relative path and the current directory changed.
+
+..
+
+.. bpo: 42005
+.. date: 2020-10-11-13-48-03
+.. nonce: Jq6Az-
+.. section: Library
+
+Fix CLI of :mod:`cProfile` and :mod:`profile` to catch
+:exc:`BrokenPipeError`.
+
+..
+
+.. bpo: 41604
+.. date: 2020-08-21-15-24-14
+.. nonce: rTXleO
+.. section: Library
+
+Don't decrement the reference count of the previous user_ptr when
+set_panel_userptr fails.
+
+..
+
+.. bpo: 41149
+.. date: 2020-06-28-16-13-02
+.. nonce: jiZWtJ
+.. section: Library
+
+Allow executing callables that have a boolean value of ``False`` when passed
+to :class:`Threading.thread` as the target. Patch contributed by Barney
+Stratford.
+
+..
+
+.. bpo: 38307
+.. date: 2020-03-16-03-03-21
+.. nonce: 2cmw2i
+.. section: Library
+
+Add an 'end_lineno' attribute to the Class and Function objects that appear
+in the tree returned by pyclbr functions.  This and the existing 'lineno'
+attribute define the extent of class and def statements.  Patch by Aviral
+Srivastava.
+
+..
+
+.. bpo: 39273
+.. date: 2020-01-13-23-37-58
+.. nonce: m5hzxV
+.. section: Library
+
+The ``BUTTON5_*`` constants are now exposed in the :mod:`curses` module if
+available.
+
+..
+
+.. bpo: 33289
+.. date: 2018-04-23-13-44-10
+.. nonce: anBnUr
+.. section: Library
+
+Correct call to :mod:`tkinter.colorchooser` to return RGB triplet of ints
+instead of floats.  Patch by Cheryl Sabella.
+
+..
+
+.. bpo: 40304
+.. date: 2021-01-20-23-03-49
+.. nonce: -LK7Ps
+.. section: Documentation
+
+Fix doc for type(name, bases, dict).  Patch by Boris Verkhovskiy and Éric
+Araujo.
+
+..
+
+.. bpo: 42811
+.. date: 2021-01-04-22-14-22
+.. nonce: HY2beA
+.. section: Documentation
+
+Updated importlib.utils.resolve_name() doc to use __spec__.parent instead of
+__package__. (Thanks Yair Frid.)
+
+..
+
+.. bpo: 40823
+.. date: 2020-05-30-13-39-22
+.. nonce: yB7K5w
+.. section: Tests
+
+Use :meth:`unittest.TestLoader().loadTestsFromTestCase` instead of
+:meth:`unittest.makeSuite` in :mod:`sqlite3` tests. Patch by Erlend E.
+Aasland.
+
+..
+
+.. bpo: 40810
+.. date: 2020-05-30-10-56-38
+.. nonce: LPqDLQ
+.. section: Tests
+
+In :mod:`sqlite3`, fix ``CheckTraceCallbackContent`` for SQLite pre 3.7.15.
+
+..
+
+.. bpo: 43031
+.. date: 2021-01-26-14-48-40
+.. nonce: 44nK9U
+.. section: Build
+
+Pass ``--timeout=$(TESTTIMEOUT)`` option to the default profile task
+``./python -m test --pgo`` command.
+
+..
+
+.. bpo: 36143
+.. date: 2021-01-18-20-52-06
+.. nonce: kgnIYo
+.. section: Build
+
+``make regen-all`` now also runs ``regen-keyword``. Patch by Victor Stinner.
+
+..
+
+.. bpo: 42874
+.. date: 2021-01-12-10-06-50
+.. nonce: XKK61g
+.. section: Build
+
+Removed the grep -q and -E flags in the tzpath validation section of the
+configure script to better accommodate users of some platforms (specifically
+Solaris 10).
+
+..
+
+.. bpo: 31904
+.. date: 2021-01-11-23-26-00
+.. nonce: ty8f3h
+.. section: Build
+
+Add library search path by wr-cc in add_cross_compiling_paths() for VxWorks.
+
+..
+
+.. bpo: 42856
+.. date: 2021-01-07-12-51-38
+.. nonce: n3cMHV
+.. section: Build
+
+Add ``--with-wheel-pkg-dir=PATH`` option to the ``./configure`` script. If
+specified, the :mod:`ensurepip` module looks for ``setuptools`` and ``pip``
+wheel packages in this directory: if both are present, these wheel packages
+are used instead of ensurepip bundled wheel packages.
+
+Some Linux distribution packaging policies recommend against bundling
+dependencies. For example, Fedora installs wheel packages in the
+``/usr/share/python-wheels/`` directory and don't install the
+``ensurepip._bundled`` package.
+
+..
+
+.. bpo: 41837
+.. date: 2021-01-05-20-36-40
+.. nonce: bmS7vB
+.. section: Windows
+
+Updated Windows installer to include OpenSSL 1.1.1i
+
+..
+
+.. bpo: 42584
+.. date: 2020-12-07-11-40-52
+.. nonce: AsYnVX
+.. section: Windows
+
+Upgrade Windows installer to use SQLite 3.34.0.
+
+..
+
+.. bpo: 42504
+.. date: 2021-01-26-14-36-11
+.. nonce: ZxWt71
+.. section: macOS
+
+Ensure that the value of
+sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') is always a string,
+even in when the value is parsable as an integer.
+
+..
+
+.. bpo: 43008
+.. date: 2021-01-26-18-12-17
+.. nonce: mbQUc7
+.. section: IDLE
+
+Make IDLE invoke :func:`sys.excepthook` in normal, 2-process mode. Patch by
+Ken Hilton.
+
+..
+
+.. bpo: 33065
+.. date: 2021-01-10-01-25-43
+.. nonce: zmyHYJ
+.. section: IDLE
+
+Fix problem debugging user classes with __repr__ method.
+
+..
+
+.. bpo: 23544
+.. date: 2019-11-14-23-41-07
+.. nonce: 3etemb
+.. section: IDLE
+
+Disable Debug=>Stack Viewer when user code is running or Debugger is active,
+to prevent hang or crash.  Patch by Zackery Spytz.
+
+..
+
+.. bpo: 32631
+.. date: 2019-06-30-20-31-09
+.. nonce: e7_4BG
+.. section: IDLE
+
+Finish zzdummy example extension module: make menu entries work; add
+docstrings and tests with 100% coverage.
+
+..
+
+.. bpo: 42979
+.. date: 2021-01-28-01-11-59
+.. nonce: JrGkrm
+.. section: C API
+
+When Python is built in debug mode (with C assertions), calling a type slot
+like ``sq_length`` (``__len__()`` in Python) now fails with a fatal error if
+the slot succeeded with an exception set, or failed with no exception set.
+The error message contains the slot, the type name, and the current
+exception (if an exception is set). Patch by Victor Stinner.
+
+..
+
+.. bpo: 43030
+.. date: 2021-01-27-10-27-47
+.. nonce: loDcD_
+.. section: C API
+
+Fixed a compiler warning in :c:func:`Py_UNICODE_ISSPACE()` on platforms with
+signed ``wchar_t``.
diff --git a/Misc/NEWS.d/3.10.0a6.rst b/Misc/NEWS.d/3.10.0a6.rst
new file mode 100644
index 0000000..a4ee9ae
--- /dev/null
+++ b/Misc/NEWS.d/3.10.0a6.rst
@@ -0,0 +1,538 @@
+.. bpo: 42967
+.. date: 2021-02-14-15-59-16
+.. nonce: YApqDS
+.. release date: 2021-03-01
+.. section: Security
+
+Fix web cache poisoning vulnerability by defaulting the query args separator
+to ``&``, and allowing the user to choose a custom separator.
+
+..
+
+.. bpo: 43321
+.. date: 2021-02-26-13-17-52
+.. nonce: TCS3ph
+.. section: Core and Builtins
+
+Fix ``SystemError`` raised when ``PyArg_Parse*()`` is used with ``#`` but
+without ``PY_SSIZE_T_CLEAN`` defined.
+
+..
+
+.. bpo: 36346
+.. date: 2021-02-22-19-00-00
+.. nonce: uAoni0
+.. section: Core and Builtins
+
+``PyArg_Parse*()`` functions now emits ``DeprecationWarning`` when ``u`` or
+``Z`` format is used. See :pep:`623` for detail.
+
+..
+
+.. bpo: 43277
+.. date: 2021-02-20-16-50-22
+.. nonce: FXkRXk
+.. section: Core and Builtins
+
+Add a new :c:func:`PySet_CheckExact` function to the C-API to check if an
+object is an instance of :class:`set` but not an instance of a subtype.
+Patch by Pablo Galindo.
+
+..
+
+.. bpo: 42990
+.. date: 2021-02-18-15-12-30
+.. nonce: toAqBH
+.. section: Core and Builtins
+
+The :data:`types.FunctionType` constructor now inherits the current builtins
+if the *globals* dictionary has no ``"__builtins__"`` key, rather than using
+``{"None": None}`` as builtins: same behavior as :func:`eval` and
+:func:`exec` functions. Defining a function with ``def function(...): ...``
+in Python is not affected, globals cannot be overridden with this syntax: it
+also inherits the current builtins. Patch by Victor Stinner.
+
+..
+
+.. bpo: 42990
+.. date: 2021-02-17-19-02-21
+.. nonce: SKXHiI
+.. section: Core and Builtins
+
+Functions have a new ``__builtins__`` attribute which is used to look for
+builtin symbols when a function is executed, instead of looking into
+``__globals__['__builtins__']``. Patch by Mark Shannon and Victor Stinner.
+
+..
+
+.. bpo: 43149
+.. date: 2021-02-07-03-27-14
+.. nonce: 0umPKD
+.. section: Core and Builtins
+
+Improve the error message in the parser for exception groups without
+parentheses. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 43121
+.. date: 2021-02-03-22-33-05
+.. nonce: jqcViq
+.. section: Core and Builtins
+
+Fixed an incorrect :exc:`SyntaxError` message for missing comma in literals.
+Patch by Pablo Galindo.
+
+..
+
+.. bpo: 42819
+.. date: 2021-01-04-23-54-34
+.. nonce: 4KO6wU
+.. section: Core and Builtins
+
+:mod:`readline`: Explicitly disable bracketed paste in the interactive
+interpreter, even if it's set in the inputrc, is enabled by default (eg GNU
+Readline 8.1), or a user calls ``readline.read_init_file()``. The Python
+REPL has not implemented bracketed paste support. Also, bracketed mode
+writes the ``"\x1b[?2004h"`` escape sequence into stdout which causes test
+failures in applications that don't support it. It can still be explicitly
+enabled by calling ``readline.parse_and_bind("set enable-bracketed-paste
+on")``. Patch by Dustin Rodrigues.
+
+..
+
+.. bpo: 42808
+.. date: 2021-01-02-05-10-58
+.. nonce: AOxgxl
+.. section: Core and Builtins
+
+Simple calls to ``type(object)`` are now faster due to the ``vectorcall``
+calling convention. Patch by Dennis Sweeney.
+
+..
+
+.. bpo: 42217
+.. date: 2020-10-31-16-54-00
+.. nonce: GdcHe5
+.. section: Core and Builtins
+
+Make the compiler merges same co_code and co_linetable objects in a module
+like already did for co_consts.
+
+..
+
+.. bpo: 41972
+.. date: 2020-10-23-23-17-23
+.. nonce: kbAwg4
+.. section: Core and Builtins
+
+Substring search functions such as ``str1 in str2`` and ``str2.find(str1)``
+now sometimes use the "Two-Way" string comparison algorithm to avoid
+quadratic behavior on long strings.
+
+..
+
+.. bpo: 42128
+.. date: 2020-10-23-08-54-04
+.. nonce: SWmVEm
+.. section: Core and Builtins
+
+Implement :pep:`634` (structural pattern matching). Patch by Brandt Bucher.
+
+..
+
+.. bpo: 40692
+.. date: 2020-05-19-22-10-05
+.. nonce: ajEhrR
+.. section: Core and Builtins
+
+In the :class:`concurrent.futures.ProcessPoolExecutor`, validate that
+:func:`multiprocess.synchronize` is available on a given platform and rely
+on that check in the :mod:`concurrent.futures` test suite so we can run
+tests that are unrelated to :class:`ProcessPoolExecutor` on those platforms.
+
+..
+
+.. bpo: 38302
+.. date: 2019-09-28-12-23-23
+.. nonce: hsCNgX
+.. section: Core and Builtins
+
+If :func:`object.__ipow__` returns :const:`NotImplemented`, the operator
+will correctly fall back to :func:`object.__pow__` and
+:func:`object.__rpow__` as expected.
+
+..
+
+.. bpo: 43316
+.. date: 2021-02-25-09-44-36
+.. nonce: k9Gyqn
+.. section: Library
+
+The ``python -m gzip`` command line application now properly fails when
+detecting an unsupported extension. It exits with a non-zero exit code and
+prints an error message to stderr.
+
+..
+
+.. bpo: 43317
+.. date: 2021-02-25-09-08-55
+.. nonce: qrOOpB
+.. section: Library
+
+Set the chunk size for the ``gzip`` module main function to
+io.DEFAULT_BUFFER_SIZE. This is slightly faster than the 1024 bytes constant
+that was used previously.
+
+..
+
+.. bpo: 43146
+.. date: 2021-02-23-17-20-16
+.. nonce: JAFplg
+.. section: Library
+
+Handle None in single-arg versions of :func:`~traceback.print_exception` and
+:func:`~traceback.format_exception`.
+
+..
+
+.. bpo: 43260
+.. date: 2021-02-20-12-15-29
+.. nonce: 6znAas
+.. section: Library
+
+Fix TextIOWrapper can not flush internal buffer forever after very large
+text is written.
+
+..
+
+.. bpo: 43258
+.. date: 2021-02-18-23-30-52
+.. nonce: LeU-q8
+.. section: Library
+
+Prevent needless allocation of :mod:`sqlite3` aggregate function context
+when no rows match an aggregate query. Patch by Erlend E. Aasland.
+
+..
+
+.. bpo: 43251
+.. date: 2021-02-18-14-24-42
+.. nonce: n6WZDw
+.. section: Library
+
+Improve :mod:`sqlite3` error handling: ``sqlite3_column_name()`` failures
+now result in :exc:`MemoryError`. Patch by Erlend E. Aasland.
+
+..
+
+.. bpo: 40956
+.. date: 2021-02-10-23-29-50
+.. nonce: LcAbwG
+.. section: Library
+
+Fix segfault in :meth:`sqlite3.Connection.backup` if no argument was
+provided. The regression was introduced by GH-23838. Patch by Erlend E.
+Aasland.
+
+..
+
+.. bpo: 43172
+.. date: 2021-02-10-06-00-53
+.. nonce: ZMCJni
+.. section: Library
+
+The readline module now passes its tests when built directly against
+libedit. Existing irreconcilable API differences remain in
+:func:`readline.get_begidx` and :func:`readline.get_endidx` behavior based
+on libreadline vs libedit use.
+
+..
+
+.. bpo: 43163
+.. date: 2021-02-08-21-13-51
+.. nonce: E2MgzH
+.. section: Library
+
+Fix a bug in :mod:`codeop` that was causing it to not ask for more input
+when multi-line snippets have unclosed parentheses. Patch by Pablo Galindo
+
+..
+
+.. bpo: 43162
+.. date: 2021-02-08-16-27-00
+.. nonce: t-W7h3
+.. section: Library
+
+deprecate unsupported ability to access enum members as attributes of other
+enum members
+
+..
+
+.. bpo: 43146
+.. date: 2021-02-06-21-21-35
+.. nonce: MHtb2v
+.. section: Library
+
+Fix recent regression in None argument handling in :mod:`~traceback` module
+functions.
+
+..
+
+.. bpo: 43102
+.. date: 2021-02-03-22-55-27
+.. nonce: TSlZ6J
+.. section: Library
+
+The namedtuple __new__ method had its __builtins__ set to None instead of an
+actual dictionary.  This created problems for introspection tools.
+
+..
+
+.. bpo: 43106
+.. date: 2021-02-03-17-06-38
+.. nonce: SwcSuU
+.. section: Library
+
+Added :data:`~os.O_EVTONLY`, :data:`~os.O_FSYNC`, :data:`~os.O_SYMLINK` and
+:data:`~os.O_NOFOLLOW_ANY` for macOS. Patch by Dong-hee Na.
+
+..
+
+.. bpo: 42960
+.. date: 2021-01-18-21-07-20
+.. nonce: a7Dote
+.. section: Library
+
+Adds :data:`resource.RLIMIT_KQUEUES` constant from FreeBSD to the
+:mod:`resource` module.
+
+..
+
+.. bpo: 42151
+.. date: 2020-10-26-18-01-09
+.. nonce: et5f7s
+.. section: Library
+
+Make the pure Python implementation of :mod:`xml.etree.ElementTree` behave
+the same as the C implementation (:mod:`_elementree`) regarding default
+attribute values (by not setting ``specified_attributes=1``).
+
+..
+
+.. bpo: 29753
+.. date: 2020-05-02-01-01-30
+.. nonce: n2M-AF
+.. section: Library
+
+In ctypes, now packed bitfields are calculated properly and the first item
+of packed bitfields is now shrank correctly.
+
+..
+
+.. bpo: 27646
+.. date: 2021-02-20-00-09-13
+.. nonce: HRsmo-
+.. section: Documentation
+
+Clarify that 'yield from <expr>' works with any iterable, not just
+iterators.
+
+..
+
+.. bpo: 36346
+.. date: 2020-06-15-10-45-45
+.. nonce: H0sS_i
+.. section: Documentation
+
+Update some deprecated unicode APIs which are documented as "will be removed
+in 4.0" to "3.12". See :pep:`623` for detail.
+
+..
+
+.. bpo: 43288
+.. date: 2021-02-21-11-11-53
+.. nonce: LfTvL-
+.. section: Tests
+
+Fix test_importlib to correctly skip Unicode file tests if the filesystem
+does not support them.
+
+..
+
+.. bpo: 43174
+.. date: 2021-02-10-14-11-53
+.. nonce: F9zwXQ
+.. section: Build
+
+Windows build now uses ``/utf-8`` compiler option.
+
+..
+
+.. bpo: 43103
+.. date: 2021-02-02-16-26-44
+.. nonce: VWeyP_
+.. section: Build
+
+Add a new configure ``--without-static-libpython`` option to not build the
+``libpythonMAJOR.MINOR.a`` static library and not install the ``python.o``
+object file.
+
+..
+
+.. bpo: 13501
+.. date: 2021-01-10-22-25-23
+.. nonce: g4L-6R
+.. section: Build
+
+The configure script can now use *libedit* instead of *readline* with the
+command line option ``--with-readline=editline``.
+
+..
+
+.. bpo: 42603
+.. date: 2020-12-08-19-25-20
+.. nonce: mXs2dB
+.. section: Build
+
+Make configure script use pkg-config to detect the location of Tcl/Tk
+headers and libraries, used to build tkinter.
+
+On macOS, a Tcl/Tk configuration provided by pkg-config will be preferred
+over Tcl/Tk frameworks installed in ``/{System/,}Library/Frameworks``. If
+both exist and the latter is preferred, the appropriate ``--with-tcltk-*``
+configuration options need to be explicitly set.
+
+..
+
+.. bpo: 39448
+.. date: 2020-01-24-12-54-22
+.. nonce: k4pv14
+.. section: Build
+
+Add the "regen-frozen" makefile target that regenerates the code for the
+frozen ``__hello__`` module.
+
+..
+
+.. bpo: 43155
+.. date: 2021-02-10-04-16-51
+.. nonce: O1tURk
+.. section: Windows
+
+:c:func:`PyCMethod_New` is now present in ``python3.lib``.
+
+..
+
+.. bpo: 41837
+.. date: 2021-02-28-22-49-46
+.. nonce: 9fqyXC
+.. section: macOS
+
+Update macOS installer build to use OpenSSL 1.1.1j.
+
+..
+
+.. bpo: 43283
+.. date: 2021-02-21-16-30-10
+.. nonce: DLBwYn
+.. section: IDLE
+
+Document why printing to IDLE's Shell is often slower than printing to a
+system terminal and that it can be made faster by pre-formatting a single
+string before printing.
+
+..
+
+.. bpo: 43278
+.. date: 2021-02-21-15-30-38
+.. nonce: DMPaWH
+.. section: C API
+
+Always put compiler and system information on the first line of the REPL
+welcome message.
+
+..
+
+.. bpo: 43270
+.. date: 2021-02-19-14-28-26
+.. nonce: UKx4XN
+.. section: C API
+
+Remove the private ``_PyErr_OCCURRED()`` macro: use the public
+:c:func:`PyErr_Occurred` function instead.
+
+..
+
+.. bpo: 35134
+.. date: 2021-02-18-18-46-42
+.. nonce: dFpEDT
+.. section: C API
+
+Move odictobject.h, parser_interface.h, picklebufobject.h, pydebug.h, and
+pyfpe.h into the cpython/ directory. They must not be included directly, as
+they are already included by Python.h: :ref:`Include Files <api-includes>`.
+
+..
+
+.. bpo: 35134
+.. date: 2021-02-17-18-51-26
+.. nonce: YoQdk8
+.. section: C API
+
+Move pyarena.h, pyctype.h, and pytime.h into the cpython/ directory. They
+must not be included directly, as they are already included by Python.h:
+:ref:`Include Files <api-includes>`.
+
+..
+
+.. bpo: 40170
+.. date: 2021-02-16-22-29-39
+.. nonce: ahHmOo
+.. section: C API
+
+:c:func:`PyExceptionClass_Name` is now always declared as a function, in
+order to hide implementation details. The macro accessed
+:c:member:`PyTypeObject.tp_name` directly.  Patch by Erlend E. Aasland.
+
+..
+
+.. bpo: 43239
+.. date: 2021-02-16-17-30-16
+.. nonce: FQqOGz
+.. section: C API
+
+The :c:func:`PyCFunction_New` function is now exported in the ABI when
+compiled with ``-fvisibility=hidden``.
+
+..
+
+.. bpo: 40170
+.. date: 2021-02-15-15-06-43
+.. nonce: ZYeSii
+.. section: C API
+
+:c:func:`PyIter_Check` is now always declared as a function, in order to
+hide implementation details. The macro accessed
+:c:member:`PyTypeObject.tp_iternext` directly. Patch by Erlend E. Aasland.
+
+..
+
+.. bpo: 40170
+.. date: 2021-02-15-13-41-14
+.. nonce: r2FAtl
+.. section: C API
+
+Convert :c:func:`PyDescr_IsData` macro to a function to hide implementation
+details: The macro accessed :c:member:`PyTypeObject.tp_descr_set` directly.
+Patch by Erlend E. Aasland.
+
+..
+
+.. bpo: 43181
+.. date: 2021-02-11-11-37-14
+.. nonce: ydv33S
+.. section: C API
+
+Convert :c:func:`PyObject_TypeCheck` macro to a static inline function.
+Patch by Erlend E. Aasland.
diff --git a/Misc/NEWS.d/3.10.0a7.rst b/Misc/NEWS.d/3.10.0a7.rst
new file mode 100644
index 0000000..f62be49
--- /dev/null
+++ b/Misc/NEWS.d/3.10.0a7.rst
@@ -0,0 +1,983 @@
+.. bpo: 42988
+.. date: 2021-03-24-14-16-56
+.. nonce: P2aNco
+.. release date: 2021-04-05
+.. section: Security
+
+CVE-2021-3426: Remove the ``getfile`` feature of the :mod:`pydoc` module
+which could be abused to read arbitrary files on the disk (directory
+traversal vulnerability). Moreover, even source code of Python modules can
+contain sensitive data like passwords. Vulnerability reported by David
+Schwörer.
+
+..
+
+.. bpo: 43285
+.. date: 2021-03-13-03-48-14
+.. nonce: g-Hah3
+.. section: Security
+
+:mod:`ftplib` no longer trusts the IP address value returned from the server
+in response to the PASV command by default.  This prevents a malicious FTP
+server from using the response to probe IPv4 address and port combinations
+on the client network.
+
+Code that requires the former vulnerable behavior may set a
+``trust_server_pasv_ipv4_address`` attribute on their :class:`ftplib.FTP`
+instances to ``True`` to re-enable it.
+
+..
+
+.. bpo: 43439
+.. date: 2021-03-08-23-06-07
+.. nonce: 5U3lXm
+.. section: Security
+
+Add audit hooks for :func:`gc.get_objects`, :func:`gc.get_referrers` and
+:func:`gc.get_referents`. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 27129
+.. date: 2021-04-03-22-04-46
+.. nonce: u_ehHb
+.. section: Core and Builtins
+
+Update CPython bytecode magic number.
+
+..
+
+.. bpo: 43672
+.. date: 2021-03-31-09-12-54
+.. nonce: jTT5uG
+.. section: Core and Builtins
+
+Raise ImportWarning when calling find_loader().
+
+..
+
+.. bpo: 43660
+.. date: 2021-03-29-19-50-34
+.. nonce: scTgag
+.. section: Core and Builtins
+
+Fix crash that happens when replacing ``sys.stderr`` with a callable that
+can remove the object while an exception is being printed. Patch by Pablo
+Galindo.
+
+..
+
+.. bpo: 27129
+.. date: 2021-03-29-16-20-29
+.. nonce: BF03A5
+.. section: Core and Builtins
+
+The bytecode interpreter uses instruction, rather byte, offsets internally.
+This reduces the number of EXTENDED_ARG instructions needed and streamlines
+instruction dispatch a bit.
+
+..
+
+.. bpo: 40645
+.. date: 2021-03-29-11-55-06
+.. nonce: PhaT-B
+.. section: Core and Builtins
+
+Fix reference leak in the :mod:`_hashopenssl` extension. Patch by Pablo
+Galindo.
+
+..
+
+.. bpo: 42134
+.. date: 2021-03-26-17-30-19
+.. nonce: G4Sjxg
+.. section: Core and Builtins
+
+Calls to find_module() by the import system now raise ImportWarning.
+
+..
+
+.. bpo: 41064
+.. date: 2021-03-24-00-32-20
+.. nonce: _H0K_g
+.. section: Core and Builtins
+
+Improve the syntax error for invalid usage of double starred elements ('**')
+in f-strings. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 43575
+.. date: 2021-03-21-12-26-32
+.. nonce: pl-nSg
+.. section: Core and Builtins
+
+Speed up calls to ``map()`` by using the :pep:`590` ``vectorcall`` calling
+convention. Patch by Dong-hee Na.
+
+..
+
+.. bpo: 42137
+.. date: 2021-03-20-19-54-47
+.. nonce: A8aQvj
+.. section: Core and Builtins
+
+The import system now prefers using ``__spec__`` for ``ModuleType.__repr__``
+over ``module_repr()``.
+
+..
+
+.. bpo: 43452
+.. date: 2021-03-20-01-21-37
+.. nonce: tDVJkc
+.. section: Core and Builtins
+
+Added micro-optimizations to ``_PyType_Lookup()`` to improve cache lookup
+performance in the common case of cache hits.
+
+..
+
+.. bpo: 43555
+.. date: 2021-03-19-22-49-40
+.. nonce: ZmhYSA
+.. section: Core and Builtins
+
+Report the column offset for :exc:`SyntaxError` for invalid line
+continuation characters. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 43517
+.. date: 2021-03-16-17-12-54
+.. nonce: zAo6Ws
+.. section: Core and Builtins
+
+Fix misdetection of circular imports when using ``from pkg.mod import
+attr``, which caused false positives in non-trivial multi-threaded code.
+
+..
+
+.. bpo: 43497
+.. date: 2021-03-15-07-50-30
+.. nonce: Uc5ZCJ
+.. section: Core and Builtins
+
+Emit SyntaxWarnings for assertions with tuple constants, this is a
+regression introduced in python3.7
+
+..
+
+.. bpo: 39316
+.. date: 2021-03-14-16-44-50
+.. nonce: Ns3a_F
+.. section: Core and Builtins
+
+Tracing now has correct line numbers for attribute accesses when the the
+attribute is on a different line from the object. Improves debugging and
+profiling for multi-line method chains.
+
+..
+
+.. bpo: 35883
+.. date: 2021-03-13-13-57-21
+.. nonce: UyGpdG
+.. section: Core and Builtins
+
+Python no longer fails at startup with a fatal error if a command line
+argument contains an invalid Unicode character. The
+:c:func:`Py_DecodeLocale` function now escapes byte sequences which would be
+decoded as Unicode characters outside the [U+0000; U+10ffff] range.
+
+..
+
+.. bpo: 43410
+.. date: 2021-03-05-17-23-36
+.. nonce: lCzIg0
+.. section: Core and Builtins
+
+Fix a bug that was causing the parser to crash when emitting syntax errors
+when reading input from stdin. Patch by Pablo Galindo
+
+..
+
+.. bpo: 43406
+.. date: 2021-03-04-22-53-10
+.. nonce: Na_VpA
+.. section: Core and Builtins
+
+Fix a possible race condition where ``PyErr_CheckSignals`` tries to execute
+a non-Python signal handler.
+
+..
+
+.. bpo: 42128
+.. date: 2021-03-03-19-04-23
+.. nonce: VouZjn
+.. section: Core and Builtins
+
+Add ``__match_args__`` to :c:type:`structsequence` based classes. Patch by
+Pablo Galindo.
+
+..
+
+.. bpo: 43390
+.. date: 2021-03-03-17-58-49
+.. nonce: epPpwV
+.. section: Core and Builtins
+
+CPython now sets the ``SA_ONSTACK`` flag in ``PyOS_setsig`` for the VM's
+default signal handlers.  This is friendlier to other in-process code that
+an extension module or embedding use could pull in (such as Golang's cgo)
+where tiny thread stacks are the norm and ``sigaltstack()`` has been used to
+provide for signal handlers.  This is a no-op change for the vast majority
+of processes that don't use sigaltstack.
+
+..
+
+.. bpo: 43287
+.. date: 2021-02-22-03-01-02
+.. nonce: aTs6fO
+.. section: Core and Builtins
+
+Speed up calls to ``filter()`` by using the :pep:`590` ``vectorcall``
+calling convention. Patch by Dong-hee Na.
+
+..
+
+.. bpo: 37448
+.. date: 2021-02-21-14-19-35
+.. nonce: btl7vO
+.. section: Core and Builtins
+
+Add a radix tree based memory map to track in-use obmalloc arenas. Use to
+replace the old implementation of address_in_range(). The radix tree
+approach makes it easy to increase pool sizes beyond the OS page size.
+Boosting the pool and arena size allows obmalloc to handle a significantly
+higher percentage of requests from its ultra-fast paths.
+
+It also has the advantage of eliminating the memory unsanitary behavior of
+the previous address_in_range(). The old address_in_range() was marked with
+the annotations _Py_NO_SANITIZE_ADDRESS, _Py_NO_SANITIZE_THREAD, and
+_Py_NO_SANITIZE_MEMORY. Those annotations are no longer needed.
+
+To disable the radix tree map, set a preprocessor flag as follows:
+`-DWITH_PYMALLOC_RADIX_TREE=0`.
+
+Co-authored-by: Tim Peters <tim.peters@gmail.com>
+
+..
+
+.. bpo: 29988
+.. date: 2020-02-03-13-23-10
+.. nonce: 8_UB5w
+.. section: Core and Builtins
+
+Only handle asynchronous exceptions and requests to drop the GIL when
+returning from a call or on the back edges of loops. Makes sure that
+:meth:`__exit__` is always called in with statements, even for interrupts.
+
+..
+
+.. bpo: 43720
+.. date: 2021-04-03-13-45-51
+.. nonce: FDZ5cZ
+.. section: Library
+
+Document various stdlib deprecations in imp, pkgutil, and importlib.util for
+removal in Python 3.12.
+
+..
+
+.. bpo: 43433
+.. date: 2021-03-28-23-50-20
+.. nonce: so9j5G
+.. section: Library
+
+:class:`xmlrpc.client.ServerProxy` no longer ignores query and fragment in
+the URL of the server.
+
+..
+
+.. bpo: 31956
+.. date: 2021-03-28-16-53-25
+.. nonce: Lt_67U
+.. section: Library
+
+The :meth:`~array.array.index` method of :class:`array.array` now has
+optional *start* and *stop* parameters.
+
+..
+
+.. bpo: 40066
+.. date: 2021-03-25-21-26-30
+.. nonce: 7EBQ3_
+.. section: Library
+
+Enum: adjust ``repr()`` to show only enum and member name (not value, nor
+angle brackets) and ``str()`` to show only member name.  Update and improve
+documentation to match.
+
+..
+
+.. bpo: 42136
+.. date: 2021-03-25-08-44-26
+.. nonce: rRY9e1
+.. section: Library
+
+Deprecate all module_repr() methods found in importlib as their use is being
+phased out by Python 3.12.
+
+..
+
+.. bpo: 35930
+.. date: 2021-03-23-17-18-56
+.. nonce: RZ51pM
+.. section: Library
+
+Raising an exception raised in a "future" instance will create reference
+cycles.
+
+..
+
+.. bpo: 41369
+.. date: 2021-03-21-17-50-42
+.. nonce: -fpmYZ
+.. section: Library
+
+Finish updating the vendored libmpdec to version 2.5.1.  Patch by Stefan
+Krah.
+
+..
+
+.. bpo: 43422
+.. date: 2021-03-21-17-02-52
+.. nonce: POk6cU
+.. section: Library
+
+Revert the _decimal C API which was added in bpo-41324.
+
+..
+
+.. bpo: 43577
+.. date: 2021-03-21-10-13-17
+.. nonce: m7JnAV
+.. section: Library
+
+Fix deadlock when using :class:`ssl.SSLContext` debug callback with
+:meth:`ssl.SSLContext.sni_callback`.
+
+..
+
+.. bpo: 43571
+.. date: 2021-03-20-17-40-35
+.. nonce: acAL0W
+.. section: Library
+
+It's now possible to create MPTCP sockets with IPPROTO_MPTCP
+
+..
+
+.. bpo: 43542
+.. date: 2021-03-20-15-43-25
+.. nonce: 6bt2F6
+.. section: Library
+
+``image/heic`` and ``image/heif`` were added to :mod:`mimetypes`.
+
+..
+
+.. bpo: 40645
+.. date: 2021-03-19-10-22-17
+.. nonce: 5pXhb-
+.. section: Library
+
+The :mod:`hmac` module now uses OpenSSL's HMAC implementation when digestmod
+argument is a hash name or builtin hash function.
+
+..
+
+.. bpo: 43510
+.. date: 2021-03-16-17-20-33
+.. nonce: -BeQH_
+.. section: Library
+
+Implement :pep:`597`: Add ``EncodingWarning`` warning, ``-X
+warn_default_encoding`` option, :envvar:`PYTHONWARNDEFAULTENCODING`
+environment variable and ``encoding="locale"`` argument value.
+
+..
+
+.. bpo: 43521
+.. date: 2021-03-16-16-05-02
+.. nonce: mRT6fh
+.. section: Library
+
+``ast.unparse`` can now render NaNs and empty sets.
+
+..
+
+.. bpo: 42914
+.. date: 2021-03-14-21-47-28
+.. nonce: 9U1o33
+.. section: Library
+
+:func:`pprint.pprint` gains a new boolean ``underscore_numbers`` optional
+argument to emit integers with thousands separated by an underscore
+character for improved readability (for example ``1_000_000`` instead of
+``1000000``).
+
+..
+
+.. bpo: 41361
+.. date: 2021-03-13-08-18-01
+.. nonce: lXDIlr
+.. section: Library
+
+:meth:`~collections.deque.rotate` calls are now slightly faster due to
+faster argument parsing.
+
+..
+
+.. bpo: 43423
+.. date: 2021-03-11-15-44-18
+.. nonce: rRomRD
+.. section: Library
+
+:func:`subprocess.communicate` no longer raises an IndexError when there is
+an empty stdout or stderr IO buffer during a timeout on Windows.
+
+..
+
+.. bpo: 27820
+.. date: 2021-03-10-14-07-44
+.. nonce: Wwdy-r
+.. section: Library
+
+Fixed long-standing bug of smtplib.SMTP where doing AUTH LOGIN with
+initial_response_ok=False will fail.
+
+The cause is that SMTP.auth_login _always_ returns a password if provided
+with a challenge string, thus non-compliant with the standard for AUTH
+LOGIN.
+
+Also fixes bug with the test for smtpd.
+
+..
+
+.. bpo: 43445
+.. date: 2021-03-09-11-36-19
+.. nonce: jnj-UB
+.. section: Library
+
+Add frozen modules to :data:`sys.stdlib_module_names`. For example, add
+``"_frozen_importlib"`` and ``"_frozen_importlib_external"`` names.
+
+..
+
+.. bpo: 43245
+.. date: 2021-03-08-22-14-37
+.. nonce: nXL-MC
+.. section: Library
+
+Add keyword arguments support to ``ChainMap.new_child()``.
+
+..
+
+.. bpo: 29982
+.. date: 2021-03-07-23-23-03
+.. nonce: Q9iszT
+.. section: Library
+
+Add optional parameter *ignore_cleanup_errors* to
+:func:`tempfile.TemporaryDirectory` and allow multiple :func:`cleanup`
+attempts. Contributed by C.A.M. Gerlach.
+
+..
+
+.. bpo: 43428
+.. date: 2021-03-07-18-54-39
+.. nonce: br0XmX
+.. section: Library
+
+Include changes from `importlib_metadata 3.7
+<https://importlib-metadata.readthedocs.io/en/latest/history.html#v3-7-0>`_:
+
+Performance enhancements to distribution discovery.
+
+``entry_points`` only returns unique distributions.
+
+Introduces new ``EntryPoints`` object for containing a set of entry points
+with convenience methods for selecting entry points by group or name.
+``entry_points`` now returns this object if selection parameters are
+supplied but continues to return a dict object for compatibility. Users are
+encouraged to rely on the selection interface. The dict object result is
+likely to be deprecated in the future.
+
+Added packages_distributions function to return a mapping of packages to the
+distributions that provide them.
+
+..
+
+.. bpo: 43332
+.. date: 2021-03-07-11-23-20
+.. nonce: weatsh
+.. section: Library
+
+Improves the networking efficiency of :mod:`http.client` when using a proxy
+via :meth:`~HTTPConnection.set_tunnel`.  Fewer small send calls are made
+during connection setup.
+
+..
+
+.. bpo: 43420
+.. date: 2021-03-07-08-03-31
+.. nonce: cee_X5
+.. section: Library
+
+Improve performance of :class:`fractions.Fraction` arithmetics for large
+components.  Contributed by Sergey B. Kirpichev.
+
+..
+
+.. bpo: 43356
+.. date: 2021-03-04-21-51-20
+.. nonce: X7IGBM
+.. section: Library
+
+Allow passing a signal number to ``_thread.interrupt_main()``.
+
+..
+
+.. bpo: 43399
+.. date: 2021-03-04-17-53-46
+.. nonce: Wn95u-
+.. section: Library
+
+Fix ``ElementTree.extend`` not working on iterators when using the Python
+implementation
+
+..
+
+.. bpo: 43369
+.. date: 2021-03-02-15-25-28
+.. nonce: F4knlQ
+.. section: Library
+
+Improve :mod:`sqlite3` error handling: If ``sqlite3_column_text()`` and
+``sqlite3_column_blob()`` set ``SQLITE_NOMEM``, :exc:`MemoryError` is now
+raised. Patch by Erlend E. Aasland.
+
+..
+
+.. bpo: 43368
+.. date: 2021-03-02-13-45-05
+.. nonce: t9XEkQ
+.. section: Library
+
+Fix a regression introduced in GH-24562, where an empty bytestring was
+fetched as ``None`` instead of ``b''`` in :mod:`sqlite3`. Patch by Mariusz
+Felisiak.
+
+..
+
+.. bpo: 41282
+.. date: 2021-03-02-09-54-22
+.. nonce: xL4h94
+.. section: Library
+
+Fixed stacklevel of ``DeprecationWarning`` emitted from ``import
+distutils``.
+
+..
+
+.. bpo: 42129
+.. date: 2021-02-28-04-21-35
+.. nonce: V0KifQ
+.. section: Library
+
+``importlib.resources`` now honors namespace packages, merging resources
+from each location in the namespace as introduced in ``importlib_resources``
+3.2 and including incidental changes through 5.0.3.
+
+..
+
+.. bpo: 43295
+.. date: 2021-02-22-22-54-40
+.. nonce: h_ffu7
+.. section: Library
+
+:meth:`datetime.datetime.strptime` now raises ``ValueError`` instead of
+``IndexError`` when matching ``'z'`` with the ``%z`` format specifier.
+
+..
+
+.. bpo: 43125
+.. date: 2021-02-07-19-13-30
+.. nonce: AqNoMa
+.. section: Library
+
+Return empty string if base64mime.body_encode receive empty bytes
+
+..
+
+.. bpo: 43084
+.. date: 2021-01-31-17-31-13
+.. nonce: i8nLpK
+.. section: Library
+
+:func:`curses.window.enclose` returns now ``True`` or ``False`` (as was
+documented) instead of ``1`` or ``0``.
+
+..
+
+.. bpo: 42994
+.. date: 2021-01-21-16-58-34
+.. nonce: El0Ksp
+.. section: Library
+
+Add MIME types for opus, AAC, 3gpp and 3gpp2
+
+..
+
+.. bpo: 14678
+.. date: 2021-01-07-21-25-49
+.. nonce: 1zniCH
+.. section: Library
+
+Add an invalidate_caches() method to the zipimport.zipimporter class to
+support importlib.invalidate_caches(). Patch by Desmond Cheong.
+
+..
+
+.. bpo: 42782
+.. date: 2020-12-29-13-46-57
+.. nonce: 3r0HFY
+.. section: Library
+
+Fail fast in :func:`shutil.move()` to avoid creating destination directories
+on failure.
+
+..
+
+.. bpo: 40066
+.. date: 2020-09-23-21-58-34
+.. nonce: f1dr_5
+.. section: Library
+
+Enum's `repr()` and `str()` have changed: `repr()` is now
+*EnumClass.MemberName* and `str()` is *MemberName*.  Additionally, stdlib
+Enum's whose contents are available as module attributes, such as
+`RegexFlag.IGNORECASE`, have their `repr()` as *module.name*, e.g.
+`re.IGNORECASE`.
+
+..
+
+.. bpo: 26053
+.. date: 2020-09-01-10-12-13
+.. nonce: hXikw_
+.. section: Library
+
+Fixed bug where the :mod:`pdb` interactive run command echoed the args from
+the shell command line, even if those have been overridden at the pdb
+prompt.
+
+..
+
+.. bpo: 24160
+.. date: 2020-08-28-23-07-53
+.. nonce: MSGnKr
+.. section: Library
+
+Fixed bug where breakpoints did not persist across multiple debugger
+sessions in :mod:`pdb`'s interactive mode.
+
+..
+
+.. bpo: 40701
+.. date: 2020-05-27-05-42-39
+.. nonce: PBIgW1
+.. section: Library
+
+When the :data:`tempfile.tempdir` global variable is set to a value of type
+bytes, it is now handled consistently.  Previously exceptions could be
+raised from some tempfile APIs when the directory did not already exist in
+this situation.  Also ensures that the :func:`tempfile.gettempdir()` and
+:func:`tempfile.gettempdirb()` functions *always* return ``str`` and
+``bytes`` respectively.
+
+..
+
+.. bpo: 39342
+.. date: 2020-01-15-11-15-35
+.. nonce: S8PuJO
+.. section: Library
+
+Expose ``X509_V_FLAG_ALLOW_PROXY_CERTS`` as
+:data:`~ssl.VERIFY_ALLOW_PROXY_CERTS` to allow proxy certificate validation
+as explained in
+https://www.openssl.org/docs/man1.1.1/man7/proxy-certificates.html.
+
+..
+
+.. bpo: 31861
+.. date: 2018-08-24-01-08-09
+.. nonce: -q9RKJ
+.. section: Library
+
+Add builtins.aiter and builtins.anext. Patch by Joshua Bronson (@jab),
+Daniel Pope (@lordmauve), and Justin Wang (@justin39).
+
+..
+
+.. bpo: 43199
+.. date: 2021-03-13-18-43-54
+.. nonce: ZWA6KX
+.. section: Documentation
+
+Answer "Why is there no goto?" in the Design and History FAQ.
+
+..
+
+.. bpo: 43407
+.. date: 2021-03-04-22-53-03
+.. nonce: x570l5
+.. section: Documentation
+
+Clarified that a result from :func:`time.monotonic`,
+:func:`time.perf_counter`, :func:`time.process_time`, or
+:func:`time.thread_time` can be compared with the result from any following
+call to the same function - not just the next immediate call.
+
+..
+
+.. bpo: 43354
+.. date: 2021-03-02-12-55-34
+.. nonce: ezZYkx
+.. section: Documentation
+
+Fix type documentation for ``Fault.faultCode``; the type has to be ``int``
+instead of ``str``.
+
+..
+
+.. bpo: 41933
+.. date: 2020-10-05-20-04-43
+.. nonce: Pff94-
+.. section: Documentation
+
+Clarified wording of s * n in the Common Sequence Operations
+
+..
+
+.. bpo: 37945
+.. date: 2021-03-31-11-38-42
+.. nonce: HTUYhv
+.. section: Tests
+
+Fix test_getsetlocale_issue1813() of test_locale: skip the test if
+``setlocale()`` fails. Patch by Victor Stinner.
+
+..
+
+.. bpo: 41561
+.. date: 2021-03-18-10-34-42
+.. nonce: pDg4w-
+.. section: Tests
+
+Add workaround for Ubuntu's custom OpenSSL security level policy.
+
+..
+
+.. bpo: 43179
+.. date: 2021-03-31-12-20-23
+.. nonce: Qbe1OD
+.. section: Build
+
+Introduce and correctly use ALIGNOF_X in place of SIZEOF_X for
+alignment-related code in optimized string routines. Patch by Jessica
+Clarke.
+
+..
+
+.. bpo: 43631
+.. date: 2021-03-26-09-16-34
+.. nonce: msJyPi
+.. section: Build
+
+Update macOS, Windows, and CI to OpenSSL 1.1.1k.
+
+..
+
+.. bpo: 43617
+.. date: 2021-03-24-16-55-55
+.. nonce: d69KAv
+.. section: Build
+
+Improve configure.ac: Check for presence of autoconf-archive package and
+remove our copies of M4 macros.
+
+..
+
+.. bpo: 43466
+.. date: 2021-03-11-00-14-47
+.. nonce: N861Z5
+.. section: Build
+
+The ``configure`` script now supports ``--with-openssl-rpath`` option.
+
+..
+
+.. bpo: 43372
+.. date: 2021-03-04-17-13-57
+.. nonce: FfqDVL
+.. section: Build
+
+Use ``_freeze_importlib`` to generate code for the ``__hello__`` module.
+This approach ensures the code matches the interpreter version.  Previously,
+PYTHON_FOR_REGEN was used to generate the code, which might be wrong.  The
+marshal format for code objects has changed with bpo-42246, commit 877df851.
+Update the code and the expected code sizes in ctypes test_frozentable.
+
+..
+
+.. bpo: 43440
+.. date: 2021-03-09-11-15-41
+.. nonce: igy2Mn
+.. section: Windows
+
+Build :mod:`sqlite3` with the ``R*Tree`` module enabled. Patch by Erlend E.
+Aasland.
+
+..
+
+.. bpo: 42225
+.. date: 2021-03-29-16-22-27
+.. nonce: iIeiLg
+.. section: IDLE
+
+Document that IDLE can fail on Unix either from misconfigured IP masquerade
+rules or failure displaying complex colored (non-ascii) characters.
+
+..
+
+.. bpo: 43688
+.. date: 2021-04-01-09-10-42
+.. nonce: G4gs6k
+.. section: C API
+
+The limited C API is now supported if Python is built in debug mode (if the
+``Py_DEBUG`` macro is defined). In the limited C API, the
+:c:func:`Py_INCREF` and :c:func:`Py_DECREF` functions are now implemented as
+opaque function calls, rather than accessing directly the
+:c:member:`PyObject.ob_refcnt` member, if Python is built in debug mode and
+the ``Py_LIMITED_API`` macro targets Python 3.10 or newer. It became
+possible to support the limited C API in debug mode because the
+:c:type:`PyObject` structure is the same in release and debug mode since
+Python 3.8 (see :issue:`36465`).
+
+The limited C API is still not supported in the ``--with-trace-refs``
+special build (``Py_TRACE_REFS`` macro).
+
+Patch by Victor Stinner.
+
+..
+
+.. bpo: 43244
+.. date: 2021-03-24-01-22-14
+.. nonce: 31-97x
+.. section: C API
+
+Remove the ``pyarena.h`` header file with functions:
+
+* ``PyArena_New()``
+* ``PyArena_Free()``
+* ``PyArena_Malloc()``
+* ``PyArena_AddPyObject()``
+
+These functions were undocumented, excluded from the limited C API, and were
+only used internally by the compiler. Patch by Victor Stinner.
+
+..
+
+.. bpo: 43244
+.. date: 2021-03-23-20-53-41
+.. nonce: VK3sLH
+.. section: C API
+
+Remove the compiler and parser functions using ``struct _mod`` type, because
+the public AST C API was removed:
+
+* ``PyAST_Compile()``
+* ``PyAST_CompileEx()``
+* ``PyAST_CompileObject()``
+* ``PyFuture_FromAST()``
+* ``PyFuture_FromASTObject()``
+* ``PyParser_ASTFromFile()``
+* ``PyParser_ASTFromFileObject()``
+* ``PyParser_ASTFromFilename()``
+* ``PyParser_ASTFromString()``
+* ``PyParser_ASTFromStringObject()``
+
+These functions were undocumented and excluded from the limited C API. Patch
+by Victor Stinner.
+
+..
+
+.. bpo: 43244
+.. date: 2021-03-19-12-56-11
+.. nonce: VuIyOD
+.. section: C API
+
+Remove ``ast.h``, ``asdl.h``, and ``Python-ast.h`` header files. These
+functions were undocumented and excluded from the limited C API. Most names
+defined by these header files were not prefixed by ``Py`` and so could
+create names conflicts. For example, ``Python-ast.h`` defined a ``Yield``
+macro which was conflict with the ``Yield`` name used by the Windows
+``<winbase.h>`` header. Use the Python :mod:`ast` module instead. Patch by
+Victor Stinner.
+
+..
+
+.. bpo: 43541
+.. date: 2021-03-18-12-44-33
+.. nonce: ICigzd
+.. section: C API
+
+Fix a ``PyEval_EvalCodeEx()`` regression: fix reference counting on
+builtins. Patch by Victor Stinner.
+
+..
+
+.. bpo: 43244
+.. date: 2021-03-17-23-53-14
+.. nonce: kfPqA_
+.. section: C API
+
+Remove the ``symtable.h`` header file and the undocumented functions:
+
+* ``PyST_GetScope()``
+* ``PySymtable_Build()``
+* ``PySymtable_BuildObject()``
+* ``PySymtable_Free()``
+* ``Py_SymtableString()``
+* ``Py_SymtableStringObject()``
+
+The ``Py_SymtableString()`` function was part the stable ABI by mistake but
+it could not be used, because the ``symtable.h`` header file was excluded
+from the limited C API.
+
+The Python :mod:`symtable` module remains available and is unchanged.
+
+Patch by Victor Stinner.
+
+..
+
+.. bpo: 43244
+.. date: 2021-03-17-23-20-07
+.. nonce: diyn2C
+.. section: C API
+
+Remove the ``PyAST_Validate()`` function. It is no longer possible to build
+a AST object (``mod_ty`` type) with the public C API. The function was
+already excluded from the limited C API (:pep:`384`). Patch by Victor
+Stinner.
diff --git a/Misc/NEWS.d/3.10.0b1.rst b/Misc/NEWS.d/3.10.0b1.rst
new file mode 100644
index 0000000..4731dca
--- /dev/null
+++ b/Misc/NEWS.d/3.10.0b1.rst
@@ -0,0 +1,1808 @@
+.. bpo: 43434
+.. date: 2021-05-02-17-50-23
+.. nonce: cy7xz6
+.. release date: 2021-05-03
+.. section: Security
+
+Creating :class:`sqlite3.Connection` objects now also produces
+``sqlite3.connect`` and ``sqlite3.connect/handle`` :ref:`auditing events
+<auditing>`. Previously these events were only produced by
+:func:`sqlite3.connect` calls. Patch by Erlend E. Aasland.
+
+..
+
+.. bpo: 43998
+.. date: 2021-05-01-13-13-40
+.. nonce: xhmWD7
+.. section: Security
+
+The :mod:`ssl` module sets more secure cipher suites defaults. Ciphers
+without forward secrecy and with SHA-1 MAC are disabled by default. Security
+level 2 prohibits weak RSA, DH, and ECC keys with less than 112 bits of
+security. :class:`~ssl.SSLContext` defaults to minimum protocol version TLS
+1.2. Settings are based on Hynek Schlawack's research.
+
+..
+
+.. bpo: 43882
+.. date: 2021-04-25-07-46-37
+.. nonce: Jpwx85
+.. section: Security
+
+The presence of newline or tab characters in parts of a URL could allow some
+forms of attacks.
+
+Following the controlling specification for URLs defined by WHATWG
+:func:`urllib.parse` now removes ASCII newlines and tabs from URLs,
+preventing such attacks.
+
+..
+
+.. bpo: 43472
+.. date: 2021-04-21-22-53-31
+.. nonce: gjLBTb
+.. section: Security
+
+Ensures interpreter-level audit hooks receive the
+``cpython.PyInterpreterState_New`` event when called through the
+``_xxsubinterpreters`` module.
+
+..
+
+.. bpo: 43362
+.. date: 2021-04-18-00-56-44
+.. nonce: __5aiP
+.. section: Security
+
+Fix invalid free in _sha3 module. The issue was introduced in 3.10.0a1.
+Python 3.9 and earlier are not affected.
+
+..
+
+.. bpo: 43762
+.. date: 2021-04-07-12-57-41
+.. nonce: 7lMtpT
+.. section: Security
+
+Add audit events for :func:`sqlite3.connect/handle`,
+:meth:`sqlite3.Connection.enable_load_extension`, and
+:meth:`sqlite3.Connection.load_extension`. Patch by Erlend E. Aasland.
+
+..
+
+.. bpo: 43756
+.. date: 2021-04-06-18-07-48
+.. nonce: DLBNqQ
+.. section: Security
+
+Add new audit event ``glob.glob/2`` to incorporate the new *root_dir* and
+*dir_fd* arguments added to :func:`glob.glob` and :func:`glob.iglob`.
+
+..
+
+.. bpo: 36384
+.. date: 2021-03-30-16-29-51
+.. nonce: sCAmLs
+.. section: Security
+
+:mod:`ipaddress` module no longer accepts any leading zeros in IPv4 address
+strings. Leading zeros are ambiguous and interpreted as octal notation by
+some libraries. For example the legacy function :func:`socket.inet_aton`
+treats leading zeros as octal notatation. glibc implementation of modern
+:func:`~socket.inet_pton` does not accept any leading zeros. For a while the
+:mod:`ipaddress` module used to accept ambiguous leading zeros.
+
+..
+
+.. bpo: 43075
+.. date: 2021-01-31-05-28-14
+.. nonce: DoAXqO
+.. section: Security
+
+Fix Regular Expression Denial of Service (ReDoS) vulnerability in
+:class:`urllib.request.AbstractBasicAuthHandler`.  The ReDoS-vulnerable
+regex has quadratic worst-case complexity and it allows cause a denial of
+service when identifying crafted invalid RFCs. This ReDoS issue is on the
+client side and needs remote attackers to control the HTTP server.
+
+..
+
+.. bpo: 42800
+.. date: 2021-01-09-17-07-36
+.. nonce: _dtZvW
+.. section: Security
+
+Audit hooks are now fired for frame.f_code, traceback.tb_frame, and
+generator code/frame attribute access.
+
+..
+
+.. bpo: 37363
+.. date: 2020-07-04-22-14-46
+.. nonce: NDjHNw
+.. section: Security
+
+Add audit events to the :mod:`http.client` module.
+
+..
+
+.. bpo: 43977
+.. date: 2021-05-02-11-59-00
+.. nonce: R0hSDo
+.. section: Core and Builtins
+
+Prevent classes being both a sequence and a mapping when pattern matching.
+
+..
+
+.. bpo: 43977
+.. date: 2021-04-29-17-40-25
+.. nonce: FrQhge
+.. section: Core and Builtins
+
+Use :c:member:`~PyTypeObject.tp_flags` on the class object to determine if
+the subject is a sequence or mapping when pattern matching. Avoids the need
+to import :mod:`collections.abc` when pattern matching.
+
+..
+
+.. bpo: 43892
+.. date: 2021-04-29-16-00-28
+.. nonce: WXIehI
+.. section: Core and Builtins
+
+Restore proper validation of complex literal value patterns when parsing
+:keyword:`!match` blocks.
+
+..
+
+.. bpo: 43933
+.. date: 2021-04-29-13-49-57
+.. nonce: TueFdQ
+.. section: Core and Builtins
+
+Set frame.f_lineno to the line number of the 'with' kweyword when executing
+the call to ``__exit__``.
+
+..
+
+.. bpo: 43933
+.. date: 2021-04-29-13-11-44
+.. nonce: mvoV6O
+.. section: Core and Builtins
+
+If the current position in a frame has no line number then set the f_lineno
+attribute to None, instead of -1, to conform to PEP 626. This should not
+normally be possible, but might occur in some unusual circumstances.
+
+..
+
+.. bpo: 43963
+.. date: 2021-04-28-01-23-38
+.. nonce: u5Y6bS
+.. section: Core and Builtins
+
+Importing the :mod:`_signal` module in a subinterpreter has no longer side
+effects.
+
+..
+
+.. bpo: 42739
+.. date: 2021-04-27-10-59-10
+.. nonce: PrVkKM
+.. section: Core and Builtins
+
+The internal representation of line number tables is changed to not use
+sentinels, and an explicit length parameter is added to the out of process
+API function ``PyLineTable_InitAddressRange``. This makes the handling of
+line number tables more robust in some circumstances.
+
+..
+
+.. bpo: 43908
+.. date: 2021-04-26-21-20-41
+.. nonce: 2L51nO
+.. section: Core and Builtins
+
+Make :mod:`re` types immutable. Patch by Erlend E. Aasland.
+
+..
+
+.. bpo: 43908
+.. date: 2021-04-26-20-59-17
+.. nonce: -COW4-
+.. section: Core and Builtins
+
+Make the :class:`array.array` type immutable. Patch by Erlend E. Aasland.
+
+..
+
+.. bpo: 43901
+.. date: 2021-04-25-22-50-47
+.. nonce: oKjG5E
+.. section: Core and Builtins
+
+Change class and module objects to lazy-create empty annotations dicts on
+demand.  The annotations dicts are stored in the object's __dict__ for
+backwards compatibility.
+
+..
+
+.. bpo: 43892
+.. date: 2021-04-25-08-35-11
+.. nonce: hr5Ke2
+.. section: Core and Builtins
+
+Match patterns now use new dedicated AST nodes (``MatchValue``,
+``MatchSingleton``, ``MatchSequence``, ``MatchStar``, ``MatchMapping``,
+``MatchClass``) rather than reusing expression AST nodes. ``MatchAs`` and
+``MatchOr`` are now defined as pattern nodes rather than as expression
+nodes. Patch by Nick Coghlan.
+
+..
+
+.. bpo: 42725
+.. date: 2021-04-25-05-40-51
+.. nonce: WGloYm
+.. section: Core and Builtins
+
+Usage of ``await``/``yield``/``yield from`` and named expressions within an
+annotation is now forbidden when PEP 563 is activated.
+
+..
+
+.. bpo: 43754
+.. date: 2021-04-24-16-40-23
+.. nonce: 9SzHWG
+.. section: Core and Builtins
+
+When performing structural pattern matching (:pep:`634`), captured names are
+now left unbound until the *entire* pattern has matched successfully.
+
+..
+
+.. bpo: 42737
+.. date: 2021-04-22-22-48-30
+.. nonce: lsJ7pD
+.. section: Core and Builtins
+
+Annotations for complex targets (everything beside simple names) no longer
+cause any runtime effects with ``from __future__ import annotations``.
+
+..
+
+.. bpo: 43914
+.. date: 2021-04-22-19-09-58
+.. nonce: 0Ik1AM
+.. section: Core and Builtins
+
+:exc:`SyntaxError` exceptions raised by the interpreter will highlight the
+full error range of the expression that consistutes the syntax error itself,
+instead of just where the problem is detected. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 38605
+.. date: 2021-04-20-22-17-47
+.. nonce: 9eeCNZ
+.. section: Core and Builtins
+
+Revert making ``from __future__ import annotations`` the default. This
+follows the Steering Council decision to postpone PEP 563 changes to at
+least Python 3.11. See the original email for more information regarding the
+decision:
+https://mail.python.org/archives/list/python-dev@python.org/thread/CLVXXPQ2T2LQ5MP2Y53VVQFCXYWQJHKZ/.
+Patch by Pablo Galindo.
+
+..
+
+.. bpo: 43475
+.. date: 2021-04-20-20-10-46
+.. nonce: oV8Mbs
+.. section: Core and Builtins
+
+Hashes of NaN values now depend on object identity.  Formerly, they always
+hashed to 0 even though NaN values are not equal to one another.  Having the
+same hash for unequal values caused pile-ups in hash tables.
+
+..
+
+.. bpo: 43859
+.. date: 2021-04-16-01-26-57
+.. nonce: QfqjFL
+.. section: Core and Builtins
+
+Improve the error message for :exc:`IndentationError` exceptions. Patch by
+Pablo Galindo
+
+..
+
+.. bpo: 41323
+.. date: 2021-04-15-10-19-59
+.. nonce: nsvpSg
+.. section: Core and Builtins
+
+Constant tuple folding in bytecode optimizer now reuses tuple in constant
+table.
+
+..
+
+.. bpo: 43846
+.. date: 2021-04-14-13-53-08
+.. nonce: 2jO97c
+.. section: Core and Builtins
+
+Data stack usage is much reduced for large literal and call expressions.
+
+..
+
+.. bpo: 38530
+.. date: 2021-04-14-03-53-06
+.. nonce: rNI_G1
+.. section: Core and Builtins
+
+When printing :exc:`NameError` raised by the interpreter,
+:c:func:`PyErr_Display` will offer suggestions of similar variable names in
+the function that the exception was raised from. Patch by Pablo Galindo
+
+..
+
+.. bpo: 43823
+.. date: 2021-04-13-03-06-09
+.. nonce: xpuHBi
+.. section: Core and Builtins
+
+Improve syntax errors for invalid dictionary literals. Patch by Pablo
+Galindo.
+
+..
+
+.. bpo: 43822
+.. date: 2021-04-13-02-32-18
+.. nonce: lej0OO
+.. section: Core and Builtins
+
+Improve syntax errors in the parser for missing commas between expressions.
+Patch by Pablo Galindo.
+
+..
+
+.. bpo: 43798
+.. date: 2021-04-10-00-01-43
+.. nonce: p_nJFM
+.. section: Core and Builtins
+
+:class:`ast.alias` nodes now include source location metadata attributes
+e.g. lineno, col_offset.
+
+..
+
+.. bpo: 43797
+.. date: 2021-04-09-19-12-48
+.. nonce: HfRqNP
+.. section: Core and Builtins
+
+Improve ``SyntaxError`` error messages for invalid comparisons. Patch by
+Pablo Galindo.
+
+..
+
+.. bpo: 43760
+.. date: 2021-04-08-12-20-29
+.. nonce: tBIsD8
+.. section: Core and Builtins
+
+Move the flag for checking whether tracing is enabled to the C stack, from
+the heap. Should speed up dispatch in the interpreter.
+
+..
+
+.. bpo: 43682
+.. date: 2021-04-08-01-06-22
+.. nonce: eUn4p5
+.. section: Core and Builtins
+
+Static methods (:func:`@staticmethod <staticmethod>`) and class methods
+(:func:`@classmethod <classmethod>`) now inherit the method attributes
+(``__module__``, ``__name__``, ``__qualname__``, ``__doc__``,
+``__annotations__``) and have a new ``__wrapped__`` attribute. Patch by
+Victor Stinner.
+
+..
+
+.. bpo: 43751
+.. date: 2021-04-07-18-00-05
+.. nonce: 8fHsqQ
+.. section: Core and Builtins
+
+Fixed a bug where ``anext(ait, default)`` would erroneously return None.
+
+..
+
+.. bpo: 42128
+.. date: 2021-04-05-17-38-08
+.. nonce: 1uVeGK
+.. section: Core and Builtins
+
+:data:`~object.__match_args__` is no longer allowed to be a list.
+
+..
+
+.. bpo: 43683
+.. date: 2021-04-01-12-30-30
+.. nonce: AjxOx2
+.. section: Core and Builtins
+
+Add GEN_START opcode. Marks start of generator, including async, or
+coroutine and handles sending values to a newly created generator or
+coroutine.
+
+..
+
+.. bpo: 43105
+.. date: 2021-03-31-20-35-11
+.. nonce: PBVmHm
+.. section: Core and Builtins
+
+Importlib now resolves relative paths when creating module spec objects from
+file locations.
+
+..
+
+.. bpo: 43682
+.. date: 2021-03-31-16-32-57
+.. nonce: VSF3vg
+.. section: Core and Builtins
+
+Static methods (:func:`@staticmethod <staticmethod>`) are now callable as
+regular functions. Patch by Victor Stinner.
+
+..
+
+.. bpo: 42609
+.. date: 2020-12-12-14-28-31
+.. nonce: Qcd54b
+.. section: Core and Builtins
+
+Prevented crashes in the AST validator and optimizer when compiling some
+absurdly long expressions like ``"+0"*1000000``. :exc:`RecursionError` is
+now raised instead.
+
+..
+
+.. bpo: 38530
+.. date: 2019-10-27-20-20-07
+.. nonce: ZyoDNn
+.. section: Core and Builtins
+
+When printing :exc:`AttributeError`, :c:func:`PyErr_Display` will offer
+suggestions of similar attribute names in the object that the exception was
+raised from. Patch by Pablo Galindo
+
+..
+
+.. bpo: 44015
+.. date: 2021-05-03-03-03-49
+.. nonce: V5936k
+.. section: Library
+
+In @dataclass(), raise a TypeError if KW_ONLY is specified more than once.
+
+..
+
+.. bpo: 25478
+.. date: 2021-05-02-19-17-20
+.. nonce: AwlwdA
+.. section: Library
+
+Added a *total()* method to collections.Counter() to compute the sum of the
+counts.
+
+..
+
+.. bpo: 43733
+.. date: 2021-05-01-22-59-20
+.. nonce: gJWwEQ
+.. section: Library
+
+Change :class:`netrc.netrc` to use UTF-8 encoding before using locale
+encoding.
+
+..
+
+.. bpo: 43979
+.. date: 2021-05-01-01-36-51
+.. nonce: 43oJ9L
+.. section: Library
+
+Removed an unnecessary list comprehension before looping from
+:func:`urllib.parse.parse_qsl`.  Patch by Christoph Zwerschke and Dong-hee
+Na.
+
+..
+
+.. bpo: 43993
+.. date: 2021-04-30-19-23-45
+.. nonce: T7_yoq
+.. section: Library
+
+Update bundled pip to 21.1.1.
+
+..
+
+.. bpo: 43957
+.. date: 2021-04-27-12-13-51
+.. nonce: 6EaPD-
+.. section: Library
+
+[Enum] Deprecate ``TypeError`` when non-member is used in a containment
+check; In 3.12 ``True`` or ``False`` will be returned instead, and
+containment will return ``True`` if the value is either a member of that
+enum or one of its members' value.
+
+..
+
+.. bpo: 42904
+.. date: 2021-04-26-23-39-47
+.. nonce: ejjsyR
+.. section: Library
+
+For backwards compatibility with previous minor versions of Python, if
+:func:`typing.get_type_hints` receives no namespace dictionary arguments,
+:func:`typing.get_type_hints` will search through the global then local
+namespaces during evaluation of stringized type annotations (string forward
+references) inside a class.
+
+..
+
+.. bpo: 43945
+.. date: 2021-04-26-20-52-16
+.. nonce: NgERXO
+.. section: Library
+
+[Enum] Deprecate non-standard mixin format() behavior: in 3.12 the enum
+member, not the member's value, will be used for format() calls.
+
+..
+
+.. bpo: 41139
+.. date: 2021-04-26-17-47-48
+.. nonce: ROhn1k
+.. section: Library
+
+Deprecate undocumented ``cgi.log()`` API.
+
+..
+
+.. bpo: 43937
+.. date: 2021-04-25-13-34-13
+.. nonce: isx95l
+.. section: Library
+
+Fixed the :mod:`turtle` module working with non-default root window.
+
+..
+
+.. bpo: 43930
+.. date: 2021-04-24-14-23-07
+.. nonce: R7ah0m
+.. section: Library
+
+Update bundled pip to 21.1 and setuptools to 56.0.0
+
+..
+
+.. bpo: 43907
+.. date: 2021-04-23-20-57-20
+.. nonce: 3RJEjv
+.. section: Library
+
+Fix a bug in the pure-Python pickle implementation when using protocol 5,
+where bytearray instances that occur several time in the pickled object
+graph would incorrectly unpickle into repeated copies of the bytearray
+object.
+
+..
+
+.. bpo: 43926
+.. date: 2021-04-23-17-48-55
+.. nonce: HMUlGU
+.. section: Library
+
+In ``importlib.metadata``, provide a uniform interface to ``Description``,
+allow for any field to be encoded with multiline values, remove continuation
+lines from multiline values, and add a ``.json`` property for easy access to
+the PEP 566 JSON-compatible form. Sync with ``importlib_metadata 4.0``.
+
+..
+
+.. bpo: 43920
+.. date: 2021-04-23-11-54-38
+.. nonce: cJMQ2D
+.. section: Library
+
+OpenSSL 3.0.0: :meth:`~ssl.SSLContext.load_verify_locations` now returns a
+consistent error message when cadata contains no valid certificate.
+
+..
+
+.. bpo: 43607
+.. date: 2021-04-22-22-39-58
+.. nonce: 7IYDkG
+.. section: Library
+
+:mod:`urllib` can now convert Windows paths with ``\\?\`` prefixes into URL
+paths.
+
+..
+
+.. bpo: 43817
+.. date: 2021-04-22-04-12-13
+.. nonce: FQ-XlH
+.. section: Library
+
+Add :func:`inspect.get_annotations`, which safely computes the annotations
+defined on an object.  It works around the quirks of accessing the
+annotations from various types of objects, and makes very few assumptions
+about the object passed in. :func:`inspect.get_annotations` can also
+correctly un-stringize stringized annotations.
+
+:func:`inspect.signature`, :func:`inspect.from_callable`, and
+:func:`inspect.from_function` now call :func:`inspect.get_annotations` to
+retrieve annotations.  This means :func:`inspect.signature` and
+:func:`inspect.from_callable` can now un-stringize stringized annotations,
+too.
+
+..
+
+.. bpo: 43284
+.. date: 2021-04-21-14-50-57
+.. nonce: 2QZn2T
+.. section: Library
+
+platform.win32_ver derives the windows version from
+sys.getwindowsversion().platform_version which in turn derives the version
+from kernel32.dll (which can be of a different version than Windows itself).
+Therefore change the platform.win32_ver to determine the version using the
+platform module's _syscmd_ver private function to return an accurate
+version.
+
+..
+
+.. bpo: 42854
+.. date: 2021-04-19-03-54-29
+.. nonce: Y4M7Tv
+.. section: Library
+
+The :mod:`ssl` module now uses ``SSL_read_ex`` and ``SSL_write_ex``
+internally. The functions support reading and writing of data larger than 2
+GB. Writing zero-length data no longer fails with a protocol violation
+error.
+
+..
+
+.. bpo: 42333
+.. date: 2021-04-17-19-31-17
+.. nonce: cgbtZO
+.. section: Library
+
+Port ``_ssl`` extension module to multiphase initialization.
+
+..
+
+.. bpo: 43880
+.. date: 2021-04-17-13-53-33
+.. nonce: -fC2JD
+.. section: Library
+
+:mod:`ssl` now raises DeprecationWarning for OP_NO_SSL/TLS* options, old TLS
+versions, old protocols, and other features that have been deprecated since
+Python 3.6, 3.7, or OpenSSL 1.1.0.
+
+..
+
+.. bpo: 41559
+.. date: 2021-04-17-10-49-57
+.. nonce: caIwt9
+.. section: Library
+
+:pep:`612` is now implemented purely in Python; builtin
+``types.GenericAlias`` objects no longer include ``typing.ParamSpec`` in
+``__parameters__`` (with the exception of ``collections.abc.Callable``\ 's
+``GenericAlias``). This means previously invalid uses of ``ParamSpec`` (such
+as ``list[P]``) which worked in earlier versions of Python 3.10 alpha, will
+now raise ``TypeError`` during substitution.
+
+..
+
+.. bpo: 43867
+.. date: 2021-04-16-16-46-44
+.. nonce: xT9QjF
+.. section: Library
+
+The :mod:`multiprocessing` ``Server`` class now explicitly catches
+:exc:`SystemExit` and closes the client connection in this case. It happens
+when the ``Server.serve_client()`` method reaches the end of file (EOF).
+
+..
+
+.. bpo: 40443
+.. date: 2021-04-16-02-03-00
+.. nonce: Io6FHL
+.. section: Library
+
+Remove unused imports: pyclbr no longer uses copy, and typing no longer uses
+ast. Patch by Victor Stinner.
+
+..
+
+.. bpo: 43820
+.. date: 2021-04-12-18-01-10
+.. nonce: YkqYW4
+.. section: Library
+
+Remove an unneeded copy of the namespace passed to
+dataclasses.make_dataclass().
+
+..
+
+.. bpo: 43787
+.. date: 2021-04-12-15-15-50
+.. nonce: wCy_Wd
+.. section: Library
+
+Add ``__iter__()`` method to :class:`bz2.BZ2File`, :class:`gzip.GzipFile`,
+and :class:`lzma.LZMAFile`. It makes iterating them about 2x faster. Patch
+by Inada Naoki.
+
+..
+
+.. bpo: 43680
+.. date: 2021-04-12-11-20-34
+.. nonce: SR0Epv
+.. section: Library
+
+Deprecate io.OpenWrapper and _pyio.OpenWrapper: use io.open and _pyio.open
+instead. Until Python 3.9, _pyio.open was not a static method and
+builtins.open was set to OpenWrapper to not become a bound method when set
+to a class variable. _io.open is a built-in function whereas _pyio.open is a
+Python function. In Python 3.10, _pyio.open() is now a static method, and
+builtins.open() is now io.open().
+
+..
+
+.. bpo: 43680
+.. date: 2021-04-12-09-57-37
+.. nonce: o1zEk_
+.. section: Library
+
+The Python :func:`_pyio.open` function becomes a static method to behave as
+:func:`io.open` built-in function: don't become a bound method when stored
+as a class variable. It becomes possible since static methods are now
+callable in Python 3.10. Moreover, :func:`_pyio.OpenWrapper` becomes a
+simple alias to :func:`_pyio.open`. Patch by Victor Stinner.
+
+..
+
+.. bpo: 41515
+.. date: 2021-04-12-06-01-10
+.. nonce: YaVReb
+.. section: Library
+
+Fix :exc:`KeyError` raised in :func:`typing.get_type_hints` due to synthetic
+modules that don't appear in ``sys.modules``.
+
+..
+
+.. bpo: 43776
+.. date: 2021-04-12-00-00-00
+.. nonce: p14y7a
+.. section: Library
+
+When :class:`subprocess.Popen` args are provided as a string or as
+:class:`pathlib.Path`, the Popen instance repr now shows the right thing.
+
+..
+
+.. bpo: 42248
+.. date: 2021-04-11-21-10-57
+.. nonce: pedB1E
+.. section: Library
+
+[Enum] ensure exceptions raised in ``_missing__`` are released
+
+..
+
+.. bpo: 43744
+.. date: 2021-04-11-20-52-32
+.. nonce: uf0E68
+.. section: Library
+
+fix issue with enum member name matching the start of a private variable
+name
+
+..
+
+.. bpo: 43772
+.. date: 2021-04-10-19-14-49
+.. nonce: Bxq0zQ
+.. section: Library
+
+Fixed the return value of ``TypeVar.__ror__``. Patch by Jelle Zijlstra.
+
+..
+
+.. bpo: 43764
+.. date: 2021-04-10-18-23-09
+.. nonce: Le5KJp
+.. section: Library
+
+Add match_args parameter to @dataclass decorator to allow suppression of
+__match_args__ generation.
+
+..
+
+.. bpo: 43799
+.. date: 2021-04-10-11-35-50
+.. nonce: 1iV4pX
+.. section: Library
+
+OpenSSL 3.0.0: define ``OPENSSL_API_COMPAT`` 1.1.1 to suppress deprecation
+warnings. Python requires OpenSSL 1.1.1 APIs.
+
+..
+
+.. bpo: 43478
+.. date: 2021-04-10-03-30-36
+.. nonce: iZcBTq
+.. section: Library
+
+Mocks can no longer be used as the specs for other Mocks. As a result, an
+already-mocked object cannot have an attribute mocked using
+``autospec=True`` or be the subject of a ``create_autospec(...)`` call. This
+can uncover bugs in tests since these Mock-derived Mocks will always pass
+certain tests (e.g. :func:`isinstance`) and builtin assert functions (e.g.
+assert_called_once_with) will unconditionally pass.
+
+..
+
+.. bpo: 43794
+.. date: 2021-04-09-16-14-22
+.. nonce: -1XPDH
+.. section: Library
+
+Add :data:`ssl.OP_IGNORE_UNEXPECTED_EOF` constants (OpenSSL 3.0.0)
+
+..
+
+.. bpo: 43785
+.. date: 2021-04-09-14-51-58
+.. nonce: 1mM5xE
+.. section: Library
+
+Improve ``bz2.BZ2File`` performance by removing the RLock from BZ2File. This
+makes BZ2File thread unsafe in the face of multiple simultaneous readers or
+writers, just like its equivalent classes in :mod:`gzip` and :mod:`lzma`
+have always been.  Patch by Inada Naoki.
+
+..
+
+.. bpo: 43789
+.. date: 2021-04-09-14-08-03
+.. nonce: eaHlAm
+.. section: Library
+
+OpenSSL 3.0.0: Don't call the password callback function a second time when
+first call has signaled an error condition.
+
+..
+
+.. bpo: 43788
+.. date: 2021-04-09-12-08-01
+.. nonce: YsvInM
+.. section: Library
+
+The header files for :mod:`ssl` error codes are now OpenSSL
+version-specific. Exceptions will now show correct reason and library codes.
+The ``make_ssl_data.py`` script has been rewritten to use OpenSSL's text
+file with error codes.
+
+..
+
+.. bpo: 43766
+.. date: 2021-04-09-00-16-22
+.. nonce: nYNQP0
+.. section: Library
+
+Implement :pep:`647` in the :mod:`typing` module by adding
+:data:`TypeGuard`.
+
+..
+
+.. bpo: 25264
+.. date: 2021-04-08-22-11-27
+.. nonce: b33fa0
+.. section: Library
+
+:func:`os.path.realpath` now accepts a *strict* keyword-only argument. When
+set to ``True``, :exc:`OSError` is raised if a path doesn't exist or a
+symlink loop is encountered.
+
+..
+
+.. bpo: 43780
+.. date: 2021-04-08-20-04-46
+.. nonce: hUOgCh
+.. section: Library
+
+In ``importlib.metadata``, incorporate changes from importlib_metadata 3.10:
+Add mtime-based caching during distribution discovery. Flagged use of dict
+result from ``entry_points()`` as deprecated.
+
+..
+
+.. bpo: 47383
+.. date: 2021-04-08-19-32-26
+.. nonce: YI1hdL
+.. section: Library
+
+The ``P.args`` and ``P.kwargs`` attributes of :class:`typing.ParamSpec` are
+now instances of the new classes :class:`typing.ParamSpecArgs` and
+:class:`typing.ParamSpecKwargs`, which enables a more useful ``repr()``.
+Patch by Jelle Zijlstra.
+
+..
+
+.. bpo: 43731
+.. date: 2021-04-08-15-19-20
+.. nonce: nnVd3h
+.. section: Library
+
+Add an ``encoding`` parameter :func:`logging.fileConfig()`.
+
+..
+
+.. bpo: 43712
+.. date: 2021-04-08-12-25-08
+.. nonce: f8WXCX
+.. section: Library
+
+Add ``encoding`` and ``errors`` parameters to :func:`fileinput.input` and
+:class:`fileinput.FileInput`.
+
+..
+
+.. bpo: 38659
+.. date: 2021-04-08-11-47-31
+.. nonce: r_HFnU
+.. section: Library
+
+A ``simple_enum`` decorator is added to the ``enum`` module to convert a
+normal class into an Enum. ``test_simple_enum`` added to test simple enums
+against a corresponding normal Enum.  Standard library modules updated to
+use ``simple_enum``.
+
+..
+
+.. bpo: 43764
+.. date: 2021-04-08-09-59-20
+.. nonce: tHjO60
+.. section: Library
+
+Fix an issue where :data:`~object.__match_args__` generation could fail for
+some :mod:`dataclasses`.
+
+..
+
+.. bpo: 43752
+.. date: 2021-04-06-21-18-29
+.. nonce: K7qmAF
+.. section: Library
+
+Fix :mod:`sqlite3` regression for zero-sized blobs with converters, where
+``b""`` was returned instead of ``None``. The regression was introduced by
+GH-24723. Patch by Erlend E. Aasland.
+
+..
+
+.. bpo: 43655
+.. date: 2021-04-04-20-51-19
+.. nonce: LwGy8R
+.. section: Library
+
+:mod:`tkinter` dialog windows are now recognized as dialogs by window
+managers on macOS and X Window.
+
+..
+
+.. bpo: 43723
+.. date: 2021-04-03-18-03-44
+.. nonce: uBhBZS
+.. section: Library
+
+The following ``threading`` methods are now deprecated and should be
+replaced:
+
+- ``currentThread`` => :func:`threading.current_thread`
+
+- ``activeCount`` => :func:`threading.active_count`
+
+- ``Condition.notifyAll`` => :meth:`threading.Condition.notify_all`
+
+- ``Event.isSet`` => :meth:`threading.Event.is_set`
+
+- ``Thread.setName`` => :attr:`threading.Thread.name`
+
+- ``thread.getName`` => :attr:`threading.Thread.name`
+
+- ``Thread.isDaemon`` => :attr:`threading.Thread.daemon`
+
+- ``Thread.setDaemon`` => :attr:`threading.Thread.daemon`
+
+Patch by Jelle Zijlstra.
+
+..
+
+.. bpo: 2135
+.. date: 2021-04-03-15-24-59
+.. nonce: xmDAYJ
+.. section: Library
+
+Deprecate find_module() and find_loader() implementations in importlib and
+zipimport.
+
+..
+
+.. bpo: 43534
+.. date: 2021-03-18-15-46-08
+.. nonce: vPE9Us
+.. section: Library
+
+:func:`turtle.textinput` and :func:`turtle.numinput` create now a transient
+window working on behalf of the canvas window.
+
+..
+
+.. bpo: 43532
+.. date: 2021-03-17-19-06-45
+.. nonce: W2Ntnm
+.. section: Library
+
+Add the ability to specify keyword-only fields to dataclasses.  These fields
+will become keyword-only arguments to the generated __init__.
+
+..
+
+.. bpo: 43522
+.. date: 2021-03-16-22-37-32
+.. nonce: dhNwOu
+.. section: Library
+
+Fix problem with :attr:`~ssl.SSLContext.hostname_checks_common_name`.
+OpenSSL does not copy hostflags from *struct SSL_CTX* to *struct SSL*.
+
+..
+
+.. bpo: 8978
+.. date: 2021-03-13-14-02-07
+.. nonce: CRxG-O
+.. section: Library
+
+Improve error message for :func:`tarfile.open` when :mod:`lzma` / :mod:`bz2`
+are unavailable.  Patch by Anthony Sottile.
+
+..
+
+.. bpo: 42967
+.. date: 2021-03-11-00-31-41
+.. nonce: 2PeQRw
+.. section: Library
+
+Allow :class:`bytes` ``separator`` argument in ``urllib.parse.parse_qs`` and
+``urllib.parse.parse_qsl`` when parsing :class:`str` query strings.
+Previously, this raised a ``TypeError``.
+
+..
+
+.. bpo: 43296
+.. date: 2021-03-01-13-01-33
+.. nonce: p_gU6T
+.. section: Library
+
+Improve :mod:`sqlite3` error handling: ``sqlite3_value_blob()`` errors that
+set ``SQLITE_NOMEM`` now raise :exc:`MemoryError`. Patch by Erlend E.
+Aasland.
+
+..
+
+.. bpo: 43312
+.. date: 2021-02-25-14-43-59
+.. nonce: 6dg9_2
+.. section: Library
+
+New functions :func:`sysconfig.get_preferred_scheme` and
+:func:`sysconfig.get_default_scheme` are added to query a platform for its
+preferred "user", "home", and "prefix" (default) scheme names.
+
+..
+
+.. bpo: 43265
+.. date: 2021-02-19-22-24-33
+.. nonce: MyAzCH
+.. section: Library
+
+Improve :meth:`sqlite3.Connection.backup` error handling. The error message
+for non-existent target database names is now ``unknown database <database
+name>`` instead of ``SQL logic error``. Patch by Erlend E. Aasland.
+
+..
+
+.. bpo: 41282
+.. date: 2021-02-16-13-18-38
+.. nonce: GK9a0l
+.. section: Library
+
+Install schemes in :mod:`distutils.command.install` are now loaded from
+:mod:`sysconfig`.
+
+..
+
+.. bpo: 41282
+.. date: 2021-02-15-12-52-23
+.. nonce: SenEje
+.. section: Library
+
+:mod:`distutils.sysconfig` has been merged to :mod:`sysconfig`.
+
+..
+
+.. bpo: 43176
+.. date: 2021-02-09-07-24-29
+.. nonce: bocNQn
+.. section: Library
+
+Fixed processing of a dataclass that inherits from a frozen dataclass with
+no fields.  It is now correctly detected as an error.
+
+..
+
+.. bpo: 43080
+.. date: 2021-01-31-00-23-13
+.. nonce: -fDg4Q
+.. section: Library
+
+:mod:`pprint` now has support for :class:`dataclasses.dataclass`. Patch by
+Lewis Gaul.
+
+..
+
+.. bpo: 39950
+.. date: 2021-01-22-00-15-37
+.. nonce: NzLVaR
+.. section: Library
+
+Add `pathlib.Path.hardlink_to()` method that supersedes `link_to()`. The new
+method has the same argument order as `symlink_to()`.
+
+..
+
+.. bpo: 42904
+.. date: 2021-01-12-23-17-02
+.. nonce: -4qkTD
+.. section: Library
+
+:func:`typing.get_type_hints` now checks the local namespace of a class when
+evaluating :pep:`563` annotations inside said class.
+
+..
+
+.. bpo: 42269
+.. date: 2021-01-08-22-32-13
+.. nonce: W5v8z4
+.. section: Library
+
+Add ``slots`` parameter to ``dataclasses.dataclass`` decorator to
+automatically generate ``__slots__`` for class. Patch provided by Yurii
+Karabas.
+
+..
+
+.. bpo: 39529
+.. date: 2020-12-06-20-21-16
+.. nonce: 9Zrg43
+.. section: Library
+
+Deprecated use of :func:`asyncio.get_event_loop` without running event loop.
+Emit deprecation warning for :mod:`asyncio` functions which implicitly
+create a :class:`~asyncio.Future` or :class:`~asyncio.Task` objects if there
+is no running event loop and no explicit *loop* argument is passed:
+:func:`~asyncio.ensure_future`, :func:`~asyncio.wrap_future`,
+:func:`~asyncio.gather`, :func:`~asyncio.shield`,
+:func:`~asyncio.as_completed` and constructors of :class:`~asyncio.Future`,
+:class:`~asyncio.Task`, :class:`~asyncio.StreamReader`,
+:class:`~asyncio.StreamReaderProtocol`.
+
+..
+
+.. bpo: 18369
+.. date: 2020-11-19-09-52-24
+.. nonce: qzvYH2
+.. section: Library
+
+Certificate and PrivateKey classes were added to the ssl module.
+Certificates and keys can now be loaded from memory buffer, too.
+
+..
+
+.. bpo: 41486
+.. date: 2020-10-16-15-34-30
+.. nonce: Mu9Iit
+.. section: Library
+
+Use a new output buffer management code for :mod:`bz2` / :mod:`lzma` /
+:mod:`zlib` modules, and add ``.readall()`` function to
+``_compression.DecompressReader`` class. These bring some performance
+improvements. Patch by Ma Lin.
+
+..
+
+.. bpo: 31870
+.. date: 2020-09-15-23-44-07
+.. nonce: nVwd38
+.. section: Library
+
+The :func:`ssl.get_server_certificate` function now has a *timeout*
+parameter.
+
+..
+
+.. bpo: 41735
+.. date: 2020-09-07-11-15-15
+.. nonce: NKqGKy
+.. section: Library
+
+Fix thread locks in zlib module may go wrong in rare case. Patch by Ma Lin.
+
+..
+
+.. bpo: 36470
+.. date: 2020-06-13-23-33-32
+.. nonce: oi6Kdb
+.. section: Library
+
+Fix dataclasses with ``InitVar``\s and :func:`~dataclasses.replace()`. Patch
+by Claudiu Popa.
+
+..
+
+.. bpo: 40849
+.. date: 2020-06-02-21-32-33
+.. nonce: zpeKx3
+.. section: Library
+
+Expose X509_V_FLAG_PARTIAL_CHAIN ssl flag
+
+..
+
+.. bpo: 35114
+.. date: 2020-05-17-14-10-24
+.. nonce: uLIHfn
+.. section: Library
+
+:func:`ssl.RAND_status` now returns a boolean value (as documented) instead
+of ``1`` or ``0``.
+
+..
+
+.. bpo: 39906
+.. date: 2020-03-30-00-13-27
+.. nonce: eaR3fN
+.. section: Library
+
+:meth:`pathlib.Path.stat` and :meth:`~pathlib.Path.chmod` now accept a
+*follow_symlinks* keyword-only argument for consistency with corresponding
+functions in the :mod:`os` module.
+
+..
+
+.. bpo: 39899
+.. date: 2020-03-09-20-36-07
+.. nonce: 9adF3E
+.. section: Library
+
+:func:`os.path.expanduser()` now refuses to guess Windows home directories
+if the basename of current user's home directory does not match their
+username.
+
+:meth:`pathlib.Path.expanduser()` and :meth:`~pathlib.Path.home()` now
+consistently raise :exc:`RuntimeError` exception when a home directory
+cannot be resolved. Previously a :exc:`KeyError` exception could be raised
+on Windows when the ``"USERNAME"``  environment variable was unset.
+
+..
+
+.. bpo: 36076
+.. date: 2019-10-16-17-21-53
+.. nonce: FGeQQT
+.. section: Library
+
+Added SNI support to :func:`ssl.get_server_certificate`.
+
+..
+
+.. bpo: 38490
+.. date: 2019-10-16-08-08-14
+.. nonce: QbDXEF
+.. section: Library
+
+Covariance, Pearson's correlation, and simple linear regression
+functionality was added to statistics module. Patch by Tymoteusz Wołodźko.
+
+..
+
+.. bpo: 33731
+.. date: 2019-08-14-13-19-50
+.. nonce: 9esS0d
+.. section: Library
+
+Provide a locale.localize() function, which converts a normalized number
+string into a locale format.
+
+..
+
+.. bpo: 32745
+.. date: 2018-08-09-23-47-10
+.. nonce: iQi9hI
+.. section: Library
+
+Fix a regression in the handling of ctypes' :data:`ctypes.c_wchar_p` type:
+embedded null characters would cause a :exc:`ValueError` to be raised. Patch
+by Zackery Spytz.
+
+..
+
+.. bpo: 43987
+.. date: 2021-04-30-04-27-02
+.. nonce: 1DftVa
+.. section: Documentation
+
+Add "Annotations Best Practices" document as a new HOWTO.
+
+..
+
+.. bpo: 43977
+.. date: 2021-04-29-15-06-03
+.. nonce: K5aSl1
+.. section: Documentation
+
+Document the new :const:`Py_TPFLAGS_MAPPING` and
+:const:`Py_TPFLAGS_SEQUENCE` type flags.
+
+..
+
+.. bpo: 43959
+.. date: 2021-04-27-22-22-22
+.. nonce: n2261q
+.. section: Documentation
+
+The documentation on the PyContextVar C-API was clarified.
+
+..
+
+.. bpo: 43938
+.. date: 2021-04-25-22-44-27
+.. nonce: nC660q
+.. section: Documentation
+
+Update dataclasses documentation to express that FrozenInstanceError is
+derived from AttributeError.
+
+..
+
+.. bpo: 43778
+.. date: 2021-04-08-22-42-02
+.. nonce: MszRnY
+.. section: Documentation
+
+Fix the Sphinx glossary_search extension: create the _static/ sub-directory
+if it doesn't exist.
+
+..
+
+.. bpo: 43755
+.. date: 2021-04-06-14-55-45
+.. nonce: 1m0fGq
+.. section: Documentation
+
+Update documentation to reflect that unparenthesized lambda expressions can
+no longer be the expression part in an ``if`` clause in comprehensions and
+generator expressions since Python 3.9.
+
+..
+
+.. bpo: 43739
+.. date: 2021-04-06-07-05-49
+.. nonce: L4HjiX
+.. section: Documentation
+
+Fixing the example code in Doc/extending/extending.rst to declare and
+initialize the pmodule variable to be of the right type.
+
+..
+
+.. bpo: 43961
+.. date: 2021-04-28-13-21-52
+.. nonce: gNchls
+.. section: Tests
+
+Fix test_logging.test_namer_rotator_inheritance() on Windows: use
+:func:`os.replace` rather than :func:`os.rename`. Patch by Victor Stinner.
+
+..
+
+.. bpo: 43842
+.. date: 2021-04-16-14-07-40
+.. nonce: w60GAH
+.. section: Tests
+
+Fix a race condition in the SMTP test of test_logging. Don't close a file
+descriptor (socket) from a different thread while asyncore.loop() is polling
+the file descriptor. Patch by Victor Stinner.
+
+..
+
+.. bpo: 43843
+.. date: 2021-04-14-13-22-44
+.. nonce: ruIQKD
+.. section: Tests
+
+:mod:`test.libregrtest` now marks a test as ENV_CHANGED (altered the
+execution environment) if a thread raises an exception but does not catch
+it. It sets a hook on :func:`threading.excepthook`. Use
+``--fail-env-changed`` option to mark the test as failed. Patch by Victor
+Stinner.
+
+..
+
+.. bpo: 43811
+.. date: 2021-04-12-11-14-28
+.. nonce: vGNbnD
+.. section: Tests
+
+Tests multiple OpenSSL versions on GitHub Actions. Use ccache to speed up
+testing.
+
+..
+
+.. bpo: 43791
+.. date: 2021-04-09-15-10-38
+.. nonce: 4KxiXK
+.. section: Tests
+
+OpenSSL 3.0.0: Disable testing of legacy protocols TLS 1.0 and 1.1. Tests
+are failing with TLSV1_ALERT_INTERNAL_ERROR.
+
+..
+
+.. bpo: 43567
+.. date: 2021-03-31-19-50-01
+.. nonce: vd0a-p
+.. section: Build
+
+Improved generated code refresh (AST/tokens/opcodes/keywords) on Windows.
+
+..
+
+.. bpo: 43669
+.. date: 2021-03-30-14-19-39
+.. nonce: lWMUYx
+.. section: Build
+
+Implement :pep:`644`. Python now requires OpenSSL 1.1.1 or newer.
+
+..
+
+.. bpo: 35306
+.. date: 2021-04-22-21-37-41
+.. nonce: 10kSR-
+.. section: Windows
+
+Adds additional arguments to :func:`os.startfile` function.
+
+..
+
+.. bpo: 43538
+.. date: 2021-04-22-20-39-49
+.. nonce: F0Cg6X
+.. section: Windows
+
+Avoid raising errors from :meth:`pathlib.Path.exists()` when passed an
+invalid filename.
+
+..
+
+.. bpo: 38822
+.. date: 2021-04-22-19-49-20
+.. nonce: jgdPmq
+.. section: Windows
+
+Fixed :func:`os.stat` failing on inaccessible directories with a trailing
+slash, rather than falling back to the parent directory's metadata. This
+implicitly affected :func:`os.path.exists` and :func:`os.path.isdir`.
+
+..
+
+.. bpo: 26227
+.. date: 2021-04-21-23-37-34
+.. nonce: QMY_eA
+.. section: Windows
+
+Fixed decoding of host names in :func:`socket.gethostbyaddr` and
+:func:`socket.gethostbyname_ex`.
+
+..
+
+.. bpo: 40432
+.. date: 2021-04-20-23-07-22
+.. nonce: 9OFpoq
+.. section: Windows
+
+Updated pegen regeneration script on Windows to find and use Python 3.8 or
+higher.  Prior to this, pegen regeneration already required 3.8 or higher,
+but the script may have used lower versions of Python.
+
+..
+
+.. bpo: 43745
+.. date: 2021-04-06-12-27-33
+.. nonce: rdKNda
+.. section: Windows
+
+Actually updates Windows release to OpenSSL 1.1.1k. Earlier releases were
+mislabelled and actually included 1.1.1i again.
+
+..
+
+.. bpo: 43652
+.. date: 2021-04-03-18-54-31
+.. nonce: gNmfVN
+.. section: Windows
+
+Update Tcl and Tk to 8.6.11 in Windows installer.
+
+..
+
+.. bpo: 43492
+.. date: 2021-03-15-11-34-33
+.. nonce: AsYnVX
+.. section: Windows
+
+Upgrade Windows installer to use SQLite 3.35.5.
+
+..
+
+.. bpo: 30555
+.. date: 2017-12-16-12-23-51
+.. nonce: 3ybjly
+.. section: Windows
+
+Fix ``WindowsConsoleIO`` errors in the presence of fd redirection. Patch by
+Segev Finer.
+
+..
+
+.. bpo: 42119
+.. date: 2021-05-02-21-03-27
+.. nonce: Y7BSX_
+.. section: macOS
+
+Fix check for macOS SDK paths when building Python. Narrow search to match
+contents of SDKs, namely only files in ``/System/Library``,
+``/System/IOSSupport``, and ``/usr`` other than ``/usr/local``. Previously,
+anything under ``/System`` was assumed to be in an SDK which causes problems
+with the new file system layout in 10.15+ where user file systems may appear
+to be mounted under ``/System``.  Paths in ``/Library`` were also
+incorrectly treated as SDK locations.
+
+..
+
+.. bpo: 43568
+.. date: 2021-05-02-19-50-52
+.. nonce: AeLNBd
+.. section: macOS
+
+Drop support for MACOSX_DEPLOYMENT_TARGET < 10.3
+
+..
+
+.. bpo: 44009
+.. date: 2021-05-02-03-45-30
+.. nonce: uvhmlh
+.. section: macOS
+
+Provide "python3.x-intel64" executable to allow reliably forcing macOS
+universal2 framework builds to run under Rosetta 2 Intel-64 emulation on
+Apple Silicon Macs.  This can be useful for testing or when universal2
+wheels are not yet available.
+
+..
+
+.. bpo: 43851
+.. date: 2021-04-15-01-20-45
+.. nonce: sDI60Y
+.. section: macOS
+
+Build SQLite with ``SQLITE_OMIT_AUTOINIT`` on macOS. Patch by Erlend E.
+Aasland.
+
+..
+
+.. bpo: 43492
+.. date: 2021-03-15-11-32-23
+.. nonce: 1ZRcV9
+.. section: macOS
+
+Update macOS installer to use SQLite 3.35.4.
+
+..
+
+.. bpo: 42235
+.. date: 2020-11-01-17-37-16
+.. nonce: A97_BN
+.. section: macOS
+
+``Mac/BuildScript/build-installer.py`` will now use "--enable-optimizations"
+and ``--with-lto`` when building on macOS 10.15 or later.
+
+..
+
+.. bpo: 37903
+.. date: 2021-05-02-20-25-53
+.. nonce: VQ6VTU
+.. section: IDLE
+
+Add mouse actions to the shell sidebar.  Left click and optional drag
+selects one or more lines, as with the editor line number sidebar.  Right
+click after selecting raises a context menu with 'copy with prompts'.  This
+zips together prompts from the sidebar with lines from the selected text.
+
+..
+
+.. bpo: 43981
+.. date: 2021-04-30-17-59-56
+.. nonce: 3EFl1H
+.. section: IDLE
+
+Fix reference leak in test_sidebar and test_squeezer.
+Patches by Terry Jan Reedy and Pablo Galindo
+
+..
+
+.. bpo: 37892
+.. date: 2021-04-29-02-40-41
+.. nonce: bgW2fk
+.. section: IDLE
+
+Indent IDLE Shell input with spaces instead of tabs
+
+..
+
+.. bpo: 43655
+.. date: 2021-04-04-20-52-07
+.. nonce: HSyaKH
+.. section: IDLE
+
+IDLE dialog windows are now recognized as dialogs by window managers on
+macOS and X Window.
+
+..
+
+.. bpo: 37903
+.. date: 2019-08-24-23-49-36
+.. nonce: 4xjast
+.. section: IDLE
+
+IDLE's shell now shows prompts in a separate side-bar.
+
+..
+
+.. bpo: 43916
+.. date: 2021-04-29-17-35-48
+.. nonce: wvWt23
+.. section: C API
+
+Add a new :c:data:`Py_TPFLAGS_DISALLOW_INSTANTIATION` type flag to disallow
+creating type instances. Patch by Victor Stinner.
+
+..
+
+.. bpo: 43774
+.. date: 2021-04-29-10-17-21
+.. nonce: 5MGfgN
+.. section: C API
+
+Remove the now unused ``PYMALLOC_DEBUG`` macro. Debug hooks on memory
+allocators are now installed by default if Python is built in debug mode (if
+``Py_DEBUG`` macro is defined). Moreover, they can now be used on Python
+build in release mode (ex: using ``PYTHONMALLOC=debug`` environment
+variable).
+
+..
+
+.. bpo: 43962
+.. date: 2021-04-28-13-13-07
+.. nonce: 9Jzs5X
+.. section: C API
+
+_PyInterpreterState_IDIncref() now calls _PyInterpreterState_IDInitref() and
+always increments id_refcount. Previously, calling
+_xxsubinterpreters.get_current() could create an id_refcount inconsistency
+when a _xxsubinterpreters.InterpreterID object was deallocated. Patch by
+Victor Stinner.
+
+..
+
+.. bpo: 28254
+.. date: 2021-04-28-12-33-44
+.. nonce: a2561e
+.. section: C API
+
+Add new C-API functions to control the state of the garbage collector:
+:c:func:`PyGC_Enable()`, :c:func:`PyGC_Disable()`,
+:c:func:`PyGC_IsEnabled()`, corresponding to the functions in the :mod:`gc`
+module.
+
+..
+
+.. bpo: 43908
+.. date: 2021-04-22-10-46-40
+.. nonce: Co3YhZ
+.. section: C API
+
+Introduce :const:`Py_TPFLAGS_IMMUTABLETYPE` flag for immutable type objects,
+and modify :c:func:`PyType_Ready` to set it for static types. Patch by
+Erlend E. Aasland.
+
+..
+
+.. bpo: 43795
+.. date: 2021-04-20-15-06-29
+.. nonce: y0IP4c
+.. section: C API
+
+:c:func:`PyMem_Calloc` is now available in the limited C API
+(``Py_LIMITED_API``).
+
+..
+
+.. bpo: 43868
+.. date: 2021-04-16-18-15-56
+.. nonce: twQ7KH
+.. section: C API
+
+:c:func:`PyOS_ReadlineFunctionPointer` is no longer exported by limited C
+API headers and by ``python3.dll`` on Windows. Like any function that takes
+``FILE*``, it is not part of the stable ABI.
+
+..
+
+.. bpo: 43795
+.. date: 2021-04-09-18-19-07
+.. nonce: l0yobT
+.. section: C API
+
+Stable ABI and limited API definitions are generated from a central manifest
+(:pep:`652`).
+
+..
+
+.. bpo: 43753
+.. date: 2021-04-06-20-52-44
+.. nonce: xUsHp1
+.. section: C API
+
+Add the :c:func:`Py_Is(x, y) <Py_Is>` function to test if the *x* object is
+the *y* object, the same as ``x is y`` in Python. Add also the
+:c:func:`Py_IsNone`, :c:func:`Py_IsTrue`, :c:func:`Py_IsFalse` functions to
+test if an object is, respectively, the ``None`` singleton, the ``True``
+singleton or the ``False`` singleton. Patch by Victor Stinner.
diff --git a/Misc/NEWS.d/3.10.0b2.rst b/Misc/NEWS.d/3.10.0b2.rst
new file mode 100644
index 0000000..bda05d49
--- /dev/null
+++ b/Misc/NEWS.d/3.10.0b2.rst
@@ -0,0 +1,524 @@
+.. bpo: 44022
+.. date: 2021-05-05-17-37-04
+.. nonce: bS3XJ9
+.. release date: 2021-05-31
+.. section: Security
+
+mod:`http.client` now avoids infinitely reading potential HTTP headers after
+a ``100 Continue`` status response from the server.
+
+..
+
+.. bpo: 43667
+.. date: 2021-05-27-17-34-29
+.. nonce: ND9jP3
+.. section: Core and Builtins
+
+Improve Unicode support in non-UTF locales on Oracle Solaris. This issue
+does not affect other Solaris systems.
+
+..
+
+.. bpo: 44232
+.. date: 2021-05-25-18-20-10
+.. nonce: DMcCCf
+.. section: Core and Builtins
+
+Fix a regression in :func:`type` when a metaclass raises an exception. The C
+function :c:func:`type_new` must properly report the exception when a
+metaclass constructor raises an exception and the winner class is not the
+metaclass. Patch by Victor Stinner.
+
+..
+
+.. bpo: 44201
+.. date: 2021-05-21-21-16-03
+.. nonce: bGaSjt
+.. section: Core and Builtins
+
+Avoid side effects of checking for specialized syntax errors in the REPL
+that was causing it to ask for extra tokens after a syntax error had been
+detected. Patch by Pablo Galindo
+
+..
+
+.. bpo: 44184
+.. date: 2021-05-21-01-42-45
+.. nonce: 9qOptC
+.. section: Core and Builtins
+
+Fix a crash at Python exit when a deallocator function removes the last
+strong reference to a heap type. Patch by Victor Stinner.
+
+..
+
+.. bpo: 44180
+.. date: 2021-05-19-20-33-36
+.. nonce: mQVaAs
+.. section: Core and Builtins
+
+The parser doesn't report generic syntax errors that happen in a position
+further away that the one it reached in the first pass. Patch by Pablo
+Galindo
+
+..
+
+.. bpo: 44168
+.. date: 2021-05-18-11-27-02
+.. nonce: mgB-rt
+.. section: Core and Builtins
+
+Fix error message in the parser involving keyword arguments with invalid
+expressions. Patch by Pablo Galindo
+
+..
+
+.. bpo: 44143
+.. date: 2021-05-15-17-30-57
+.. nonce: 7UTS6H
+.. section: Core and Builtins
+
+Fixed a crash in the parser that manifest when raising tokenizer errors when
+an existing exception was present. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 44114
+.. date: 2021-05-12-14-26-16
+.. nonce: p-WfAE
+.. section: Core and Builtins
+
+Fix incorrect dictkeys_reversed and dictitems_reversed function signatures
+in C code, which broke webassembly builds.
+
+..
+
+.. bpo: 43149
+.. date: 2021-05-08-17-18-37
+.. nonce: Kp5FxD
+.. section: Core and Builtins
+
+Corrent the syntax error message regarding multiple exception types to not
+refer to "exception groups". Patch by Pablo Galindo
+
+..
+
+.. bpo: 44056
+.. date: 2021-05-06-12-43-04
+.. nonce: 4LWcJW
+.. section: Core and Builtins
+
+Syntax errors when default ``except`` is not the last ``except``  are
+reported with the correct location. Patch by Mark Shannon.
+
+..
+
+.. bpo: 43822
+.. date: 2021-05-04-01-01-04
+.. nonce: 9VeCg0
+.. section: Core and Builtins
+
+The parser will prioritize tokenizer errors over custom syntax errors when
+raising exceptions. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 28146
+.. date: 2021-01-13-19-34-41
+.. nonce: AZBBkH
+.. section: Core and Builtins
+
+Fix a confusing error message in :func:`str.format`.
+
+..
+
+.. bpo: 44254
+.. date: 2021-05-29-01-05-43
+.. nonce: f06xDm
+.. section: Library
+
+On Mac, give turtledemo button text a color that works on both light or dark
+background.  Programmers cannot control the latter.
+
+..
+
+.. bpo: 38693
+.. date: 2021-05-26-14-50-06
+.. nonce: NkMacJ
+.. section: Library
+
+Prefer f-strings to ``.format`` in importlib.resources.
+
+..
+
+.. bpo: 33693
+.. date: 2021-05-26-13-34-37
+.. nonce: 3okzdo
+.. section: Library
+
+Importlib.metadata now prefers f-strings to .format.
+
+..
+
+.. bpo: 44241
+.. date: 2021-05-26-13-15-51
+.. nonce: TBqej8
+.. section: Library
+
+Incorporate minor tweaks from importlib_metadata 4.1: SimplePath protocol,
+support for Metadata 2.2.
+
+..
+
+.. bpo: 44210
+.. date: 2021-05-21-21-23-43
+.. nonce: 5afQ3K
+.. section: Library
+
+Make importlib.metadata._meta.PackageMetadata public.
+
+..
+
+.. bpo: 43643
+.. date: 2021-05-21-12-12-35
+.. nonce: GWnmcF
+.. section: Library
+
+Declare readers.MultiplexedPath.name as a property per the spec.
+
+..
+
+.. bpo: 33433
+.. date: 2021-05-16-17-48-24
+.. nonce: MyzO71
+.. section: Library
+
+For IPv4 mapped IPv6 addresses (:rfc:`4291` Section 2.5.5.2), the
+:mod:`ipaddress.IPv6Address.is_private` check is deferred to the mapped IPv4
+address. This solves a bug where public mapped IPv4 addresses were
+considered private by the IPv6 check.
+
+..
+
+.. bpo: 44145
+.. date: 2021-05-16-00-00-38
+.. nonce: ko5SJ7
+.. section: Library
+
+:mod:`hmac` computations were not releasing the GIL while calling the
+OpenSSL ``HMAC_Update`` C API (a new feature in 3.9).  This unintentionally
+prevented parallel computation as other :mod:`hashlib` algorithms support.
+
+..
+
+.. bpo: 37788
+.. date: 2021-05-13-19-07-28
+.. nonce: adeFcf
+.. section: Library
+
+Fix a reference leak when a Thread object is never joined.
+
+..
+
+.. bpo: 38908
+.. date: 2021-05-12-16-43-21
+.. nonce: nM2_rO
+.. section: Library
+
+Subclasses of ``typing.Protocol`` which only have data variables declared
+will now raise a ``TypeError`` when checked with ``isinstance`` unless they
+are decorated with :func:`runtime_checkable`.  Previously, these checks
+passed silently. Patch provided by Yurii Karabas.
+
+..
+
+.. bpo: 44098
+.. date: 2021-05-10-17-45-00
+.. nonce: _MoxuZ
+.. section: Library
+
+``typing.ParamSpec`` will no longer be found in the ``__parameters__`` of
+most :mod:`typing` generics except in valid use locations specified by
+:pep:`612`. This prevents incorrect usage like ``typing.List[P][int]``. This
+change means incorrect usage which may have passed silently in 3.10 beta 1
+and earlier will now error.
+
+..
+
+.. bpo: 44089
+.. date: 2021-05-09-22-52-34
+.. nonce: IoANsN
+.. section: Library
+
+Allow subclassing ``csv.Error`` in 3.10 (it was allowed in 3.9 and earlier
+but was disallowed in early versions of 3.10).
+
+..
+
+.. bpo: 44059
+.. date: 2021-05-06-16-01-55
+.. nonce: GF5r6O
+.. section: Library
+
+Register the SerenityOS Browser in the :mod:`webbrowser` module.
+
+..
+
+.. bpo: 36515
+.. date: 2021-05-05-11-44-49
+.. nonce: uOSa3q
+.. section: Library
+
+The :mod:`hashlib` module no longer does unaligned memory accesses when
+compiled for ARM platforms.
+
+..
+
+.. bpo: 44018
+.. date: 2021-05-03-10-07-43
+.. nonce: VDyW8f
+.. section: Library
+
+random.seed() no longer mutates bytearray inputs.
+
+..
+
+.. bpo: 38352
+.. date: 2021-05-02-13-54-25
+.. nonce: N9MlhV
+.. section: Library
+
+Add ``IO``, ``BinaryIO``, ``TextIO``, ``Match``, and ``Pattern`` to
+``typing.__all__``. Patch by Jelle Zijlstra.
+
+..
+
+.. bpo: 43972
+.. date: 2021-04-30-16-58-24
+.. nonce: Y2r9lg
+.. section: Library
+
+When :class:`http.server.SimpleHTTPRequestHandler` sends a ``301 (Moved
+Permanently)`` for a directory path not ending with `/`, add a
+``Content-Length: 0`` header. This improves the behavior for certain
+clients.
+
+..
+
+.. bpo: 28528
+.. date: 2021-04-29-00-48-00
+.. nonce: JLAVWj
+.. section: Library
+
+Fix a bug in :mod:`pdb` where :meth:`~pdb.Pdb.checkline` raises
+:exc:`AttributeError` if it is called after :meth:`~pdb.Pdb.reset`.
+
+..
+
+.. bpo: 43650
+.. date: 2021-03-29-00-23-30
+.. nonce: v01tic
+.. section: Library
+
+Fix :exc:`MemoryError` in :func:`shutil.unpack_archive` which fails inside
+:func:`shutil._unpack_zipfile` on large files. Patch by Igor Bolshakov.
+
+..
+
+.. bpo: 41730
+.. date: 2020-09-10-07-23-24
+.. nonce: DyKFi9
+.. section: Library
+
+``DeprecationWarning`` is now raised when importing :mod:`tkinter.tix`,
+which has been deprecated in documentation since Python 3.6.
+
+..
+
+.. bpo: 42392
+.. date: 2021-05-26-11-16-33
+.. nonce: oxRx6E
+.. section: Documentation
+
+Document the deprecation and removal of the ``loop`` parameter for many
+functions and classes in :mod:`asyncio`.
+
+..
+
+.. bpo: 44195
+.. date: 2021-05-23-09-11-28
+.. nonce: 1bqkOs
+.. section: Documentation
+
+Corrected references to ``TraversableResources`` in docs. There is no
+``TraversableReader``.
+
+..
+
+.. bpo: 41963
+.. date: 2021-05-17-20-03-47
+.. nonce: eUz9_o
+.. section: Documentation
+
+Document that ``ConfigParser`` strips off comments when reading
+configuration files.
+
+..
+
+.. bpo: 44072
+.. date: 2021-05-08-09-48-05
+.. nonce: fb2x5I
+.. section: Documentation
+
+Correct where in the numeric ABC hierarchy ``**`` support is added, i.e., in
+numbers.Complex, not numbers.Integral.
+
+..
+
+.. bpo: 43558
+.. date: 2021-05-07-12-27-09
+.. nonce: UGhA8R
+.. section: Documentation
+
+Add the remark to :mod:`dataclasses` documentation that the :meth:`__init__`
+of any base class has to be called in :meth:`__post_init__`, along with a
+code example.
+
+..
+
+.. bpo: 44025
+.. date: 2021-05-03-22-08-08
+.. nonce: gcB7iP
+.. section: Documentation
+
+Clarify when '_' in match statements is a keyword, and when not.
+
+..
+
+.. bpo: 31904
+.. date: 2021-05-07-15-46-04
+.. nonce: 8dk3la
+.. section: Tests
+
+Ignore error string case in test_py_compile ``test_file_not_exists()``.
+
+..
+
+.. bpo: 42083
+.. date: 2021-05-04-18-10-57
+.. nonce: EMS2TK
+.. section: Tests
+
+Add test to check that ``PyStructSequence_NewType`` accepts a
+``PyStructSequence_Desc`` with ``doc`` field set to ``NULL``.
+
+..
+
+.. bpo: 35753
+.. date: 2020-10-25-19-20-26
+.. nonce: 2LT-hO
+.. section: Tests
+
+Fix crash in doctest when doctest parses modules that include unwrappable
+functions by skipping those functions.
+
+..
+
+.. bpo: 41282
+.. date: 2021-05-24-03-31-17
+.. nonce: L8nP44
+.. section: Build
+
+Fix broken ``make install`` that caused standard library extension modules
+to be unnecessarily and incorrectly rebuilt during the install phase of
+cpython.
+
+..
+
+.. bpo: 42686
+.. date: 2021-01-01-21-21-03
+.. nonce: G_f-TC
+.. section: Windows
+
+Build :mod:`sqlite3` with math functions enabled. Patch by Erlend E.
+Aasland.
+
+..
+
+.. bpo: 43109
+.. date: 2021-05-24-21-15-41
+.. nonce: npKJ9c
+.. section: macOS
+
+Allow --with-lto configure option to work with Apple-supplied Xcode or
+Command Line Tools.
+
+..
+
+.. bpo: 41611
+.. date: 2021-05-27-18-22-46
+.. nonce: jOKpfc
+.. section: IDLE
+
+Avoid uncaught exceptions in ``AutoCompleteWindow.winconfig_event()``.
+
+..
+
+.. bpo: 41611
+.. date: 2021-05-27-13-39-43
+.. nonce: liNQqj
+.. section: IDLE
+
+Fix IDLE sometimes freezing upon tab-completion on macOS.
+
+..
+
+.. bpo: 44010
+.. date: 2021-05-09-09-02-09
+.. nonce: TaLe9x
+.. section: IDLE
+
+Highlight the new :ref:`match <match>` statement's :ref:`soft keywords
+<soft-keywords>`: :keyword:`match`, :keyword:`case <match>`, and :keyword:`_
+<wildcard-patterns>`. However, this highlighting is not perfect and will be
+incorrect in some rare cases, including some ``_``-s in ``case`` patterns.
+
+..
+
+.. bpo: 44026
+.. date: 2021-05-05-09-45-24
+.. nonce: m2Z0zR
+.. section: IDLE
+
+Include interpreter's typo fix suggestions in message line for NameErrors
+and AttributeErrors.  Patch by E. Paine.
+
+..
+
+.. bpo: 44074
+.. date: 2021-05-08-13-57-00
+.. nonce: F09kCK
+.. section: Tools/Demos
+
+Make patchcheck automatically detect the correct base branch name
+(previously it was hardcoded to 'master')
+
+..
+
+.. bpo: 43795
+.. date: 2021-05-19-15-09-47
+.. nonce: WAHRxt
+.. section: C API
+
+The undocumented function :c:func:`Py_FrozenMain` is removed from the
+Limited API.
+
+..
+
+.. bpo: 43795
+.. date: 2021-05-05-19-04-50
+.. nonce: 9Ojj73
+.. section: C API
+
+:c:func:`PyCodec_Unregister` is now properly exported as a function in the
+Windows Stable ABI DLL.
diff --git a/Misc/NEWS.d/3.10.0b3.rst b/Misc/NEWS.d/3.10.0b3.rst
new file mode 100644
index 0000000..5f399ad
--- /dev/null
+++ b/Misc/NEWS.d/3.10.0b3.rst
@@ -0,0 +1,346 @@
+.. bpo: 44409
+.. date: 2021-06-13-23-12-18
+.. nonce: eW4LS-
+.. release date: 2021-06-17
+.. section: Core and Builtins
+
+Fix error location information for tokenizer errors raised on initialization
+of the tokenizer. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 44396
+.. date: 2021-06-11-18-17-42
+.. nonce: Z9EKim
+.. section: Core and Builtins
+
+Fix a possible crash in the tokenizer when raising syntax errors for
+unclosed strings. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 44349
+.. date: 2021-06-08-22-49-06
+.. nonce: xgEgeA
+.. section: Core and Builtins
+
+Fix an edge case when displaying text from files with encoding in syntax
+errors. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 44335
+.. date: 2021-06-08-01-13-47
+.. nonce: GQTTkl
+.. section: Core and Builtins
+
+Fix a regression when identifying incorrect characters in syntax errors.
+Patch by Pablo Galindo
+
+..
+
+.. bpo: 44304
+.. date: 2021-06-05-02-34-57
+.. nonce: _MAoPc
+.. section: Core and Builtins
+
+Fix a crash in the :mod:`sqlite3` module that happened when the garbage
+collector clears :class:`sqlite.Statement` objects. Patch by Pablo Galindo
+
+..
+
+.. bpo: 44305
+.. date: 2021-06-03-22-51-50
+.. nonce: 66dVDG
+.. section: Core and Builtins
+
+Improve error message for ``try`` blocks without ``except`` or ``finally``
+blocks. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 43833
+.. date: 2021-04-18-18-07-33
+.. nonce: oChkCi
+.. section: Core and Builtins
+
+Emit a deprecation warning if the numeric literal is immediately followed by
+one of keywords: and, else, for, if, in, is, or. Raise a syntax error with
+more informative message if it is immediately followed by other keyword or
+identifier.
+
+..
+
+.. bpo: 11105
+.. date: 2020-06-02-13-21-14
+.. nonce: wceryW
+.. section: Core and Builtins
+
+When compiling :class:`ast.AST` objects with recursive references through
+:func:`compile`, the interpreter doesn't crash anymore instead it raises a
+:exc:`RecursionError`.
+
+..
+
+.. bpo: 42972
+.. date: 2021-06-15-13-51-25
+.. nonce: UnyYo1
+.. section: Library
+
+The _thread.RLock type now fully implement the GC protocol: add a traverse
+function and the :const:`Py_TPFLAGS_HAVE_GC` flag. Patch by Victor Stinner.
+
+..
+
+.. bpo: 44422
+.. date: 2021-06-14-23-28-17
+.. nonce: BlWOgv
+.. section: Library
+
+The :func:`threading.enumerate` function now uses a reentrant lock to
+prevent a hang on reentrant call. Patch by Victor Stinner.
+
+..
+
+.. bpo: 44389
+.. date: 2021-06-12-22-58-20
+.. nonce: WTRnoC
+.. section: Library
+
+Fix deprecation of :data:`ssl.OP_NO_TLSv1_3`
+
+..
+
+.. bpo: 44362
+.. date: 2021-06-10-20-07-32
+.. nonce: oVOMfd
+.. section: Library
+
+Improve :mod:`ssl` module's deprecation messages, error reporting, and
+documentation for deprecations.
+
+..
+
+.. bpo: 44342
+.. date: 2021-06-10-15-06-47
+.. nonce: qqkGlj
+.. section: Library
+
+[Enum] Change pickling from by-value to by-name.
+
+..
+
+.. bpo: 44356
+.. date: 2021-06-10-08-35-38
+.. nonce: 6oDFhO
+.. section: Library
+
+[Enum] Allow multiple data-type mixins if they are all the same.
+
+..
+
+.. bpo: 44351
+.. date: 2021-06-10-07-26-12
+.. nonce: rvyf2v
+.. section: Library
+
+Restore back :func:`parse_makefile` in :mod:`distutils.sysconfig` because it
+behaves differently than the similar implementation in :mod:`sysconfig`.
+
+..
+
+.. bpo: 44242
+.. date: 2021-06-07-10-26-14
+.. nonce: MKeMCQ
+.. section: Library
+
+Remove missing flag check from Enum creation and move into a ``verify``
+decorator.
+
+..
+
+.. bpo: 44246
+.. date: 2021-05-31-11-34-56
+.. nonce: yHAkF0
+.. section: Library
+
+In ``importlib.metadata``, restore compatibility in the result from
+``Distribution.entry_points`` (``EntryPoints``) to honor expectations in
+older implementations and issuing deprecation warnings for these cases: A.
+``EntryPoints`` objects are once again mutable, allowing   for ``sort()``
+and other list-based mutation operations.   Avoid deprecation warnings by
+casting to a   mutable sequence (e.g.   ``list(dist.entry_points).sort()``).
+B. ``EntryPoints`` results once again allow   for access by index. To avoid
+deprecation warnings,   cast the result to a Sequence first   (e.g.
+``tuple(dist.entry_points)[0]``).
+
+..
+
+.. bpo: 44246
+.. date: 2021-05-31-11-28-03
+.. nonce: nhmt-v
+.. section: Library
+
+In importlib.metadata.entry_points, de-duplication of distributions no
+longer requires loading the full metadata for PathDistribution objects,
+improving entry point loading performance by ~10x.
+
+..
+
+.. bpo: 43853
+.. date: 2021-04-15-12-02-17
+.. nonce: XXCVAp
+.. section: Library
+
+Improved string handling for :mod:`sqlite3` user-defined functions and
+aggregates:
+
+* It is now possible to pass strings with embedded null characters to UDFs
+* Conversion failures now correctly raise :exc:`MemoryError`
+
+Patch by Erlend E. Aasland.
+
+..
+
+.. bpo: 43318
+.. date: 2021-02-25-08-32-06
+.. nonce: bZJw6V
+.. section: Library
+
+Fix a bug where :mod:`pdb` does not always echo cleared breakpoints.
+
+..
+
+.. bpo: 37022
+.. date: 2020-01-25-12-58-20
+.. nonce: FUZI25
+.. section: Library
+
+:mod:`pdb` now displays exceptions from ``repr()`` with its ``p`` and ``pp``
+commands.
+
+..
+
+.. bpo: 44392
+.. date: 2021-06-16-18-09-49
+.. nonce: 6RF1Sc
+.. section: Documentation
+
+Added a new section in the C API documentation for types used in type
+hinting.  Documented ``Py_GenericAlias`` and ``Py_GenericAliasType``.
+
+..
+
+.. bpo: 38291
+.. date: 2021-06-14-09-20-37
+.. nonce: VMYa_Q
+.. section: Documentation
+
+Mark ``typing.io`` and ``typing.re`` as deprecated since Python 3.8 in the
+documentation. They were never properly supported by type checkers.
+
+..
+
+.. bpo: 44322
+.. date: 2021-06-06-14-12-00
+.. nonce: K0PHfE
+.. section: Documentation
+
+Document that SyntaxError args have a details tuple and that details are
+adjusted for errors in f-string field replacement expressions.
+
+..
+
+.. bpo: 44363
+.. date: 2021-06-10-11-19-43
+.. nonce: -K9jD0
+.. section: Tests
+
+Account for address sanitizer in test_capi. test_capi now passes when run
+GCC address sanitizer.
+
+..
+
+.. bpo: 43921
+.. date: 2021-06-03-03-29-34
+.. nonce: nwH1FS
+.. section: Tests
+
+Fix test_ssl.test_wrong_cert_tls13(): use ``suppress_ragged_eofs=False``,
+since ``read()`` can raise :exc:`ssl.SSLEOFError` on Windows. Patch by
+Victor Stinner.
+
+..
+
+.. bpo: 43921
+.. date: 2021-06-02-17-41-42
+.. nonce: xP7yZ4
+.. section: Tests
+
+Fix test_pha_required_nocert() of test_ssl: catch two more EOF cases (when
+the ``recv()`` method returns an empty string). Patch by Victor Stinner.
+
+..
+
+.. bpo: 44381
+.. date: 2021-06-10-18-08-44
+.. nonce: Xpc1iX
+.. section: Build
+
+The Windows build now accepts :envvar:`EnableControlFlowGuard` set to
+``guard`` to enable CFG.
+
+..
+
+.. bpo: 40128
+.. date: 2021-06-11-17-43-39
+.. nonce: 7vDN3U
+.. section: IDLE
+
+Mostly fix completions on macOS when not using tcl/tk 8.6.11 (as with 3.9).
+The added update_idletask call should be harmless and possibly helpful
+otherwise.
+
+..
+
+.. bpo: 33962
+.. date: 2021-06-10-00-50-02
+.. nonce: ikAUNg
+.. section: IDLE
+
+Move the indent space setting from the Font tab to the new Windows tab.
+Patch by Mark Roseman and Terry Jan Reedy.
+
+..
+
+.. bpo: 40468
+.. date: 2021-06-08-03-04-51
+.. nonce: tUCGUb
+.. section: IDLE
+
+Split the settings dialog General tab into Windows and Shell/ED tabs. Move
+help sources, which extend the Help menu, to the Extensions tab. Make space
+for new options and shorten the dialog. The latter makes the dialog better
+fit small screens.
+
+..
+
+.. bpo: 43795
+.. date: 2021-06-15-16-28-18
+.. nonce: fy0AXK
+.. section: C API
+
+The list in :ref:`stable-abi-list` now shows the public name
+:c:struct:`PyFrameObject` rather than ``_frame``. The non-existing entry
+``_node`` no longer appears in the list.
+
+..
+
+.. bpo: 44378
+.. date: 2021-06-10-15-22-31
+.. nonce: jGYakF
+.. section: C API
+
+:c:func:`Py_IS_TYPE` no longer uses :c:func:`Py_TYPE` to avoid a compiler
+warning: no longer cast ``const PyObject*`` to ``PyObject*``. Patch by
+Victor Stinner.
diff --git a/Misc/NEWS.d/3.10.0b4.rst b/Misc/NEWS.d/3.10.0b4.rst
new file mode 100644
index 0000000..417bd36
--- /dev/null
+++ b/Misc/NEWS.d/3.10.0b4.rst
@@ -0,0 +1,437 @@
+.. bpo: 41180
+.. date: 2021-06-29-23-40-22
+.. nonce: uTWHv_
+.. release date: 2021-07-10
+.. section: Security
+
+Add auditing events to the :mod:`marshal` module, and stop raising
+``code.__init__`` events for every unmarshalled code object. Directly
+instantiated code objects will continue to raise an event, and audit event
+handlers should inspect or collect the raw marshal data. This reduces a
+significant performance overhead when loading from ``.pyc`` files.
+
+..
+
+.. bpo: 44562
+.. date: 2021-07-04-23-38-51
+.. nonce: QdeRQo
+.. section: Core and Builtins
+
+Remove uses of :c:func:`PyObject_GC_Del` in error path when initializing
+:class:`types.GenericAlias`.
+
+..
+
+.. bpo: 41486
+.. date: 2021-07-04-17-41-47
+.. nonce: DiM24a
+.. section: Core and Builtins
+
+Fix a memory consumption and copying performance regression in earlier 3.10
+beta releases if someone used an output buffer larger than 4GiB with
+zlib.decompress on input data that expands that large.
+
+..
+
+.. bpo: 44553
+.. date: 2021-07-02-22-54-41
+.. nonce: l9YqGg
+.. section: Core and Builtins
+
+Implement GC methods for ``types.Union`` to break reference cycles and
+prevent memory leaks.
+
+..
+
+.. bpo: 44523
+.. date: 2021-06-29-11-49-29
+.. nonce: 67-ZIP
+.. section: Core and Builtins
+
+Remove the pass-through for :func:`hash` of :class:`weakref.proxy` objects
+to prevent unintended consequences when the original referred object dies
+while the proxy is part of a hashable object. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 44483
+.. date: 2021-06-22-19-08-19
+.. nonce: eq2f7T
+.. section: Core and Builtins
+
+Fix a crash in ``types.Union`` objects when creating a union of an object
+with bad ``__module__`` field.
+
+..
+
+.. bpo: 44297
+.. date: 2021-06-19-12-41-13
+.. nonce: F53vHj
+.. section: Core and Builtins
+
+Make sure that the line number is set when entering a comprehension scope.
+Ensures that backtraces inclusing generator expressions show the correct
+line number.
+
+..
+
+.. bpo: 44456
+.. date: 2021-06-18-22-08-25
+.. nonce: L0Rhko
+.. section: Core and Builtins
+
+Improve the syntax error when mixing positional and keyword patterns. Patch
+by Pablo Galindo.
+
+..
+
+.. bpo: 44368
+.. date: 2021-06-09-22-56-59
+.. nonce: vgT0Cx
+.. section: Core and Builtins
+
+Improve syntax errors for invalid "as" targets. Patch by Pablo Galindo
+
+..
+
+.. bpo: 44317
+.. date: 2021-06-06-00-29-14
+.. nonce: xPPhcZ
+.. section: Core and Builtins
+
+Improve tokenizer error with improved locations. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 43667
+.. date: 2021-05-27-17-34-29
+.. nonce: ND9jP3
+.. section: Core and Builtins
+
+Improve Unicode support in non-UTF locales on Oracle Solaris. This issue
+does not affect other Solaris systems.
+
+..
+
+.. bpo: 44558
+.. date: 2021-07-04-21-16-53
+.. nonce: cm7Slv
+.. section: Library
+
+Make the implementation consistency of :func:`~operator.indexOf` between C
+and Python versions. Patch by Dong-hee Na.
+
+..
+
+.. bpo: 34798
+.. date: 2021-06-30-13-29-49
+.. nonce: t7FCa0
+.. section: Library
+
+Break up paragraph about :class:`pprint.PrettyPrinter` construction
+parameters to make it easier to read.
+
+..
+
+.. bpo: 44516
+.. date: 2021-06-26-12-27-14
+.. nonce: BVyX_y
+.. section: Library
+
+Update vendored pip to 21.1.3
+
+..
+
+.. bpo: 44468
+.. date: 2021-06-23-19-02-00
+.. nonce: -klV5-
+.. section: Library
+
+:func:`typing.get_type_hints` now finds annotations in classes and base
+classes with unexpected ``__module__``. Previously, it skipped those MRO
+elements.
+
+..
+
+.. bpo: 43977
+.. date: 2021-06-22-16-45-48
+.. nonce: bamAGF
+.. section: Library
+
+Set the proper :const:`Py_TPFLAGS_MAPPING` and :const:`Py_TPFLAGS_SEQUENCE`
+flags for subclasses created before a parent has been registered as a
+:class:`collections.abc.Mapping` or :class:`collections.abc.Sequence`.
+
+..
+
+.. bpo: 44482
+.. date: 2021-06-22-08-43-04
+.. nonce: U9GznK
+.. section: Library
+
+Fix very unlikely resource leak in :mod:`glob` in alternate Python
+implementations.
+
+..
+
+.. bpo: 44466
+.. date: 2021-06-21-12-43-04
+.. nonce: NSm6mv
+.. section: Library
+
+The :mod:`faulthandler` module now detects if a fatal error occurs during a
+garbage collector collection. Patch by Victor Stinner.
+
+..
+
+.. bpo: 44404
+.. date: 2021-06-20-19-01-11
+.. nonce: McfrYB
+.. section: Library
+
+:mod:`tkinter`'s ``after()`` method now supports callables without the
+``__name__`` attribute.
+
+..
+
+.. bpo: 44458
+.. date: 2021-06-20-07-14-46
+.. nonce: myqCQ0
+.. section: Library
+
+``BUFFER_BLOCK_SIZE`` is now declared static, to avoid linking collisions
+when bz2, lmza or zlib are statically linked.
+
+..
+
+.. bpo: 44464
+.. date: 2021-06-19-21-52-27
+.. nonce: U2oa-a
+.. section: Library
+
+Remove exception for flake8 in deprecated importlib.metadata interfaces.
+Sync with importlib_metadata 4.6.
+
+..
+
+.. bpo: 44446
+.. date: 2021-06-17-22-39-34
+.. nonce: qwdRic
+.. section: Library
+
+Take into account that ``lineno`` might be ``None`` in
+:class:`traceback.FrameSummary`.
+
+..
+
+.. bpo: 44439
+.. date: 2021-06-17-15-01-51
+.. nonce: 1S7QhT
+.. section: Library
+
+Fix in :meth:`bz2.BZ2File.write` / :meth:`lzma.LZMAFile.write` methods, when
+the input data is an object that supports the buffer protocol, the file
+length may be wrong.
+
+..
+
+.. bpo: 44434
+.. date: 2021-06-16-16-52-14
+.. nonce: SQS4Pg
+.. section: Library
+
+_thread.start_new_thread() no longer calls PyThread_exit_thread() explicitly
+at the thread exit, the call was redundant. On Linux with the glibc,
+pthread_exit() aborts the whole process if dlopen() fails to open
+libgcc_s.so file (ex: EMFILE error). Patch by Victor Stinner.
+
+..
+
+.. bpo: 44395
+.. date: 2021-06-12-10-08-14
+.. nonce: PcW6Sx
+.. section: Library
+
+Fix :meth:`~email.message.MIMEPart.as_string` to pass unixfrom properly.
+Patch by Dong-hee Na.
+
+..
+
+.. bpo: 34266
+.. date: 2021-06-10-21-53-46
+.. nonce: k3fxnm
+.. section: Library
+
+Handle exceptions from parsing the arg of :mod:`pdb`'s run/restart command.
+
+..
+
+.. bpo: 44077
+.. date: 2021-05-13-19-44-38
+.. nonce: 04b2a4
+.. section: Library
+
+It's now possible to receive the type of service (ToS), a.k.a.
+differentiated services (DS), a.k.a. differenciated services code point
+(DSCP) and excplicit congestion notification (ECN) IP header fields with
+``socket.IP_RECVTOS``.
+
+..
+
+.. bpo: 43024
+.. date: 2021-01-25-21-24-55
+.. nonce: vAUrIi
+.. section: Library
+
+Improve the help signature of :func:`traceback.print_exception`,
+:func:`traceback.format_exception` and
+:func:`traceback.format_exception_only`.
+
+..
+
+.. bpo: 30256
+.. date: 2019-09-25-13-54-41
+.. nonce: wBkzox
+.. section: Library
+
+Pass multiprocessing BaseProxy argument ``manager_owned`` through AutoProxy.
+
+..
+
+.. bpo: 44558
+.. date: 2021-07-03-18-25-17
+.. nonce: 0pTknl
+.. section: Documentation
+
+Match the docstring and python implementation of :func:`~operator.countOf`
+to the behavior of its c implementation.
+
+..
+
+.. bpo: 38062
+.. date: 2021-06-28-12-13-48
+.. nonce: 9Ehp9O
+.. section: Documentation
+
+Clarify that atexit uses equality comparisons internally.
+
+..
+
+.. bpo: 40620
+.. date: 2021-06-26-17-41-06
+.. nonce: PAYDrB
+.. section: Documentation
+
+Convert examples in tutorial controlflow.rst section 4.3 to be
+interpreter-demo style.
+
+..
+
+.. bpo: 13814
+.. date: 2021-06-21-15-46-32
+.. nonce: LDcslu
+.. section: Documentation
+
+In the Design FAQ, answer "Why don't generators support the with statement?"
+
+..
+
+.. bpo: 41621
+.. date: 2020-08-24-13-35-04
+.. nonce: nqaw9G
+.. section: Documentation
+
+Document that :class:`collections.defaultdict` parameter ``default_factory``
+defaults to None and is positional-only.
+
+..
+
+.. bpo: 44287
+.. date: 2021-06-21-17-53-41
+.. nonce: YON57s
+.. section: Tests
+
+Fix asyncio test_popen() of test_windows_utils by using a longer timeout.
+Use military grade battle-tested :data:`test.support.SHORT_TIMEOUT` timeout
+rather than a hardcoded timeout of 10 seconds: it's 30 seconds by default,
+but it is made longer on slow buildbots. Patch by Victor Stinner.
+
+..
+
+.. bpo: 44451
+.. date: 2021-06-18-15-19-35
+.. nonce: aj5pqE
+.. section: Tests
+
+Reset ``DeprecationWarning`` filters in
+``test.test_importlib.test_metadata_api.APITests.test_entry_points_by_index``
+to avoid ``StopIteration`` error if ``DeprecationWarnings`` are ignored.
+
+..
+
+.. bpo: 30256
+.. date: 2019-09-25-18-10-10
+.. nonce: A5i76Q
+.. section: Tests
+
+Add test for nested queues when using ``multiprocessing`` shared objects
+``AutoProxy[Queue]`` inside ``ListProxy`` and ``DictProxy``
+
+..
+
+.. bpo: 44535
+.. date: 2021-06-30-02-32-46
+.. nonce: M9iN4-
+.. section: Build
+
+Enable building using a Visual Studio 2022 install on Windows.
+
+..
+
+.. bpo: 43298
+.. date: 2021-06-19-11-50-03
+.. nonce: 9ircMb
+.. section: Build
+
+Improved error message when building without a Windows SDK installed.
+
+..
+
+.. bpo: 44582
+.. date: 2021-07-07-21-07-18
+.. nonce: 4Mm6Hh
+.. section: Windows
+
+Accelerate speed of :mod:`mimetypes` initialization using a native
+implementation of the registry scan.
+
+..
+
+.. bpo: 41299
+.. date: 2021-06-06-16-36-13
+.. nonce: Rg-vb_
+.. section: Windows
+
+Fix 16ms jitter when using timeouts in :mod:`threading`, such as with
+:meth:`threading.Lock.acquire` or :meth:`threading.Condition.wait`.
+
+..
+
+.. bpo: 44441
+.. date: 2021-06-23-12-12-04
+.. nonce: 3p14JB
+.. section: C API
+
+:c:func:`Py_RunMain` now resets :c:data:`PyImport_Inittab` to its initial
+value at exit. It must be possible to call :c:func:`PyImport_AppendInittab`
+or :c:func:`PyImport_ExtendInittab` at each Python initialization. Patch by
+Victor Stinner.
+
+..
+
+.. bpo: 40939
+.. date: 2021-06-22-17-00-06
+.. nonce: CGB0I5
+.. section: C API
+
+Removed documentation for the removed ``PyParser_*`` C API.
diff --git a/Misc/NEWS.d/3.10.0rc1.rst b/Misc/NEWS.d/3.10.0rc1.rst
new file mode 100644
index 0000000..67f31b8
--- /dev/null
+++ b/Misc/NEWS.d/3.10.0rc1.rst
@@ -0,0 +1,645 @@
+.. bpo: 44600
+.. date: 2021-07-25-20-04-54
+.. nonce: 0WMldg
+.. release date: 2021-08-02
+.. section: Security
+
+Fix incorrect line numbers while tracing some failed patterns in :ref:`match
+<match>` statements. Patch by Charles Burkland.
+
+..
+
+.. bpo: 44792
+.. date: 2021-07-31-12-12-57
+.. nonce: mOReTW
+.. section: Core and Builtins
+
+Improve syntax errors for if expressions. Patch by Miguel Brito
+
+..
+
+.. bpo: 34013
+.. date: 2021-07-27-11-14-22
+.. nonce: SjLFe-
+.. section: Core and Builtins
+
+Generalize the invalid legacy statement custom error message (like the one
+generated when "print" is called without parentheses) to include more
+generic expressions. Patch by Pablo Galindo
+
+..
+
+.. bpo: 44732
+.. date: 2021-07-26-15-27-03
+.. nonce: IxObt3
+.. section: Core and Builtins
+
+Rename ``types.Union`` to ``types.UnionType``.
+
+..
+
+.. bpo: 44698
+.. date: 2021-07-21-15-26-56
+.. nonce: DA4_0o
+.. section: Core and Builtins
+
+Fix undefined behaviour in complex object exponentiation.
+
+..
+
+.. bpo: 44653
+.. date: 2021-07-19-20-49-06
+.. nonce: WcqGyI
+.. section: Core and Builtins
+
+Support :mod:`typing` types in parameter substitution in the union type.
+
+..
+
+.. bpo: 44676
+.. date: 2021-07-19-19-53-46
+.. nonce: WgIMvh
+.. section: Core and Builtins
+
+Add ability to serialise ``types.Union`` objects. Patch provided by Yurii
+Karabas.
+
+..
+
+.. bpo: 44633
+.. date: 2021-07-17-21-04-04
+.. nonce: 5-zKeI
+.. section: Core and Builtins
+
+Parameter substitution of the union type with wrong types now raises
+``TypeError`` instead of returning ``NotImplemented``.
+
+..
+
+.. bpo: 44662
+.. date: 2021-07-17-13-41-58
+.. nonce: q22kWR
+.. section: Core and Builtins
+
+Add ``__module__`` to ``types.Union``. This also fixes ``types.Union``
+issues with ``typing.Annotated``. Patch provided by Yurii Karabas.
+
+..
+
+.. bpo: 44655
+.. date: 2021-07-16-21-35-14
+.. nonce: 95I7M6
+.. section: Core and Builtins
+
+Include the name of the type in unset __slots__ attribute errors. Patch by
+Pablo Galindo
+
+..
+
+.. bpo: 44655
+.. date: 2021-07-16-20-25-37
+.. nonce: I3wRjL
+.. section: Core and Builtins
+
+Don't include a missing attribute with the same name as the failing one when
+offering suggestions for missing attributes. Patch by Pablo Galindo
+
+..
+
+.. bpo: 44646
+.. date: 2021-07-16-09-59-13
+.. nonce: Yb6s05
+.. section: Core and Builtins
+
+Fix the hash of the union type: it no longer depends on the order of
+arguments.
+
+..
+
+.. bpo: 44636
+.. date: 2021-07-16-09-36-12
+.. nonce: ZWebi8
+.. section: Core and Builtins
+
+Collapse union of equal types. E.g. the result of ``int | int`` is now
+``int``. Fix comparison of the union type with non-hashable objects. E.g.
+``int | str == {}`` no longer raises a TypeError.
+
+..
+
+.. bpo: 44635
+.. date: 2021-07-14-13-54-07
+.. nonce: 7ZMAdB
+.. section: Core and Builtins
+
+Convert ``None`` to ``type(None)`` in the union type constructor.
+
+..
+
+.. bpo: 44589
+.. date: 2021-07-13-23-19-41
+.. nonce: 59OH8T
+.. section: Core and Builtins
+
+Mapping patterns in ``match`` statements with two or more equal literal keys
+will now raise a :exc:`SyntaxError` at compile-time.
+
+..
+
+.. bpo: 44606
+.. date: 2021-07-13-20-22-12
+.. nonce: S3Bv2w
+.. section: Core and Builtins
+
+Fix ``__instancecheck__`` and ``__subclasscheck__`` for the union type.
+
+..
+
+.. bpo: 42073
+.. date: 2021-07-13-17-47-32
+.. nonce: 9wopiC
+.. section: Core and Builtins
+
+The ``@classmethod`` decorator can now wrap other classmethod-like
+descriptors.
+
+..
+
+.. bpo: 44490
+.. date: 2021-07-06-22-22-15
+.. nonce: BJxPbZ
+.. section: Core and Builtins
+
+:mod:`typing` now searches for type parameters in ``types.Union`` objects.
+``get_type_hints`` will also properly resolve annotations with nested
+``types.Union`` objects. Patch provided by Yurii Karabas.
+
+..
+
+.. bpo: 44490
+.. date: 2021-07-01-11-59-34
+.. nonce: xY80VR
+.. section: Core and Builtins
+
+Add ``__parameters__`` attribute and ``__getitem__`` operator to
+``types.Union``. Patch provided by Yurii Karabas.
+
+..
+
+.. bpo: 44472
+.. date: 2021-06-21-11-19-54
+.. nonce: Vvm1yn
+.. section: Core and Builtins
+
+Fix ltrace functionality when exceptions are raised. Patch by Pablo Galindo
+
+..
+
+.. bpo: 44806
+.. date: 2021-08-02-14-37-32
+.. nonce: wOW_Qn
+.. section: Library
+
+Non-protocol subclasses of :class:`typing.Protocol` ignore now the
+``__init__`` method inherited from protocol base classes.
+
+..
+
+.. bpo: 44793
+.. date: 2021-07-31-20-28-20
+.. nonce: woaQSg
+.. section: Library
+
+Fix checking the number of arguments when subscribe a generic type with
+``ParamSpec`` parameter.
+
+..
+
+.. bpo: 44784
+.. date: 2021-07-31-08-45-31
+.. nonce: fIMIDS
+.. section: Library
+
+In importlib.metadata tests, override warnings behavior under expected
+DeprecationWarnings (importlib_metadata 4.6.3).
+
+..
+
+.. bpo: 44667
+.. date: 2021-07-30-23-27-30
+.. nonce: tu0Xrv
+.. section: Library
+
+The :func:`tokenize.tokenize` doesn't incorrectly generate a ``NEWLINE``
+token if the source doesn't end with a new line character but the last line
+is a comment, as the function is already generating a ``NL`` token. Patch by
+Pablo Galindo
+
+..
+
+.. bpo: 44752
+.. date: 2021-07-27-22-11-29
+.. nonce: _bvbrZ
+.. section: Library
+
+:mod:`rcompleter` does not call :func:`getattr` on :class:`property` objects
+to avoid the side-effect of  evaluating the corresponding method.
+
+..
+
+.. bpo: 44720
+.. date: 2021-07-24-02-17-59
+.. nonce: shU5Qm
+.. section: Library
+
+``weakref.proxy`` objects referencing non-iterators now raise ``TypeError``
+rather than dereferencing the null ``tp_iternext`` slot and crashing.
+
+..
+
+.. bpo: 44704
+.. date: 2021-07-21-23-16-30
+.. nonce: iqHLxQ
+.. section: Library
+
+The implementation of ``collections.abc.Set._hash()`` now matches that of
+``frozenset.__hash__()``.
+
+..
+
+.. bpo: 44666
+.. date: 2021-07-21-10-43-22
+.. nonce: CEThkv
+.. section: Library
+
+Fixed issue in :func:`compileall.compile_file` when ``sys.stdout`` is
+redirected. Patch by Stefan Hölzl.
+
+..
+
+.. bpo: 42854
+.. date: 2021-07-20-21-51-35
+.. nonce: ThuDMI
+.. section: Library
+
+Fixed a bug in the :mod:`_ssl` module that was throwing :exc:`OverflowError`
+when using :meth:`_ssl._SSLSocket.write` and :meth:`_ssl._SSLSocket.read`
+for a big value of the ``len`` parameter. Patch by Pablo Galindo
+
+..
+
+.. bpo: 44353
+.. date: 2021-07-19-22-43-15
+.. nonce: HF81_Q
+.. section: Library
+
+Refactor ``typing.NewType`` from function into callable class. Patch
+provided by Yurii Karabas.
+
+..
+
+.. bpo: 44524
+.. date: 2021-07-19-14-04-42
+.. nonce: Nbf2JC
+.. section: Library
+
+Add missing ``__name__`` and ``__qualname__`` attributes to ``typing``
+module classes. Patch provided by Yurii Karabas.
+
+..
+
+.. bpo: 40897
+.. date: 2021-07-16-13-40-31
+.. nonce: aveAre
+.. section: Library
+
+Give priority to using the current class constructor in
+:func:`inspect.signature`. Patch by Weipeng Hong.
+
+..
+
+.. bpo: 44648
+.. date: 2021-07-15-16-51-32
+.. nonce: 2o49TB
+.. section: Library
+
+Fixed wrong error being thrown by :func:`inspect.getsource` when examining a
+class in the interactive session. Instead of :exc:`TypeError`, it should be
+:exc:`OSError` with appropriate error message.
+
+..
+
+.. bpo: 44608
+.. date: 2021-07-13-09-01-33
+.. nonce: R3IcM1
+.. section: Library
+
+Fix memory leak in :func:`_tkinter._flatten` if it is called with a sequence
+or set, but not list or tuple.
+
+..
+
+.. bpo: 44559
+.. date: 2021-07-12-10-43-31
+.. nonce: YunVKY
+.. section: Library
+
+[Enum] module reverted to 3.9; 3.10 changes pushed until 3.11
+
+..
+
+.. bpo: 41928
+.. date: 2021-07-09-07-14-37
+.. nonce: Q1jMrr
+.. section: Library
+
+Update :func:`shutil.copyfile` to raise :exc:`FileNotFoundError` instead of
+confusing :exc:`IsADirectoryError` when a path ending with a
+:const:`os.path.sep` does not exist; :func:`shutil.copy` and
+:func:`shutil.copy2` are also affected.
+
+..
+
+.. bpo: 44566
+.. date: 2021-07-05-18-13-25
+.. nonce: o51Bd1
+.. section: Library
+
+handle StopIteration subclass raised from @contextlib.contextmanager
+generator
+
+..
+
+.. bpo: 41249
+.. date: 2021-07-04-11-33-34
+.. nonce: sHdwBE
+.. section: Library
+
+Fixes ``TypedDict`` to work with ``typing.get_type_hints()`` and postponed
+evaluation of annotations across modules.
+
+..
+
+.. bpo: 44461
+.. date: 2021-06-29-21-17-17
+.. nonce: acqRnV
+.. section: Library
+
+Fix bug with :mod:`pdb`'s handling of import error due to a package which
+does not have a ``__main__`` module
+
+..
+
+.. bpo: 43625
+.. date: 2021-06-29-07-27-08
+.. nonce: ZlAxhp
+.. section: Library
+
+Fix a bug in the detection of CSV file headers by
+:meth:`csv.Sniffer.has_header` and improve documentation of same.
+
+..
+
+.. bpo: 42892
+.. date: 2021-06-24-19-16-20
+.. nonce: qvRNhI
+.. section: Library
+
+Fixed an exception thrown while parsing a malformed multipart email by
+:class:`email.message.EmailMessage`.
+
+..
+
+.. bpo: 27827
+.. date: 2021-06-12-21-25-35
+.. nonce: TMWh1i
+.. section: Library
+
+:meth:`pathlib.PureWindowsPath.is_reserved` now identifies a greater range
+of reserved filenames, including those with trailing spaces or colons.
+
+..
+
+.. bpo: 38741
+.. date: 2019-11-12-18-59-33
+.. nonce: W7IYkq
+.. section: Library
+
+:mod:`configparser`: using ']' inside a section header will no longer cut
+the section name short at the ']'
+
+..
+
+.. bpo: 27513
+.. date: 2019-06-03-23-53-25
+.. nonce: qITN7d
+.. section: Library
+
+:func:`email.utils.getaddresses` now accepts :class:`email.header.Header`
+objects along with string values. Patch by Zackery Spytz.
+
+..
+
+.. bpo: 29298
+.. date: 2017-09-20-14-43-03
+.. nonce: _78CSN
+.. section: Library
+
+Fix ``TypeError`` when required subparsers without ``dest`` do not receive
+arguments. Patch by Anthony Sottile.
+
+..
+
+.. bpo: 44740
+.. date: 2021-07-26-23-48-31
+.. nonce: zMFGMV
+.. section: Documentation
+
+Replaced occurences of uppercase "Web" and "Internet" with lowercase
+versions per the 2016 revised Associated Press Style Book.
+
+..
+
+.. bpo: 44693
+.. date: 2021-07-25-23-04-15
+.. nonce: JuCbNq
+.. section: Documentation
+
+Update the definition of __future__ in the glossary by replacing the
+confusing word "pseudo-module" with a more accurate description.
+
+..
+
+.. bpo: 35183
+.. date: 2021-07-22-08-28-03
+.. nonce: p9BWTB
+.. section: Documentation
+
+Add typical examples to os.path.splitext docs
+
+..
+
+.. bpo: 30511
+.. date: 2021-07-20-21-03-18
+.. nonce: eMFkRi
+.. section: Documentation
+
+Clarify that :func:`shutil.make_archive` is not thread-safe due to reliance
+on changing the current working directory.
+
+..
+
+.. bpo: 44561
+.. date: 2021-07-18-22-43-14
+.. nonce: T7HpWm
+.. section: Documentation
+
+Update of three expired hyperlinks in Doc/distributing/index.rst: "Project
+structure", "Building and packaging the project", and "Uploading the project
+to the Python Packaging Index".
+
+..
+
+.. bpo: 44613
+.. date: 2021-07-12-11-39-20
+.. nonce: DIXNzc
+.. section: Documentation
+
+importlib.metadata is no longer provisional.
+
+..
+
+.. bpo: 44544
+.. date: 2021-07-02-14-02-29
+.. nonce: _5_aCz
+.. section: Documentation
+
+List all kwargs for :func:`textwrap.wrap`, :func:`textwrap.fill`, and
+:func:`textwrap.shorten`. Now, there are nav links to attributes of
+:class:`TextWrap`, which makes navigation much easier while minimizing
+duplication in the documentation.
+
+..
+
+.. bpo: 44453
+.. date: 2021-06-18-06-44-45
+.. nonce: 3PIkj2
+.. section: Documentation
+
+Fix documentation for the return type of :func:`sysconfig.get_path`.
+
+..
+
+.. bpo: 44734
+.. date: 2021-07-24-20-09-15
+.. nonce: KKsNOV
+.. section: Tests
+
+Fixed floating point precision issue in turtle tests.
+
+..
+
+.. bpo: 44708
+.. date: 2021-07-22-16-38-39
+.. nonce: SYNaac
+.. section: Tests
+
+Regression tests, when run with -w, are now re-running only the affected
+test methods instead of re-running the entire test file.
+
+..
+
+.. bpo: 44647
+.. date: 2021-07-16-14-02-33
+.. nonce: 5LzqIy
+.. section: Tests
+
+Added a permanent Unicode-valued environment variable to regression tests to
+ensure they handle this use case in the future. If your test environment
+breaks because of that, report a bug to us, and temporarily set
+PYTHONREGRTEST_UNICODE_GUARD=0 in your test environment.
+
+..
+
+.. bpo: 44515
+.. date: 2021-06-26-18-37-36
+.. nonce: e9fO6f
+.. section: Tests
+
+Adjust recently added contextlib tests to avoid assuming the use of a
+refcounted GC
+
+..
+
+.. bpo: 44572
+.. date: 2021-07-13-15-32-49
+.. nonce: gXvhDc
+.. section: Windows
+
+Avoid consuming standard input in the :mod:`platform` module
+
+..
+
+.. bpo: 40263
+.. date: 2020-04-13-15-20-28
+.. nonce: 1KKEbu
+.. section: Windows
+
+This is a follow-on bug from https://bugs.python.org/issue26903. Once that
+is applied we run into an off-by-one assertion problem. The assert was not
+correct.
+
+..
+
+.. bpo: 41972
+.. date: 2021-07-12-15-42-02
+.. nonce: yUjE8j
+.. section: macOS
+
+The framework build's user header path in sysconfig is changed to add a
+'pythonX.Y' component to match distutils's behavior.
+
+..
+
+.. bpo: 34932
+.. date: 2021-03-29-21-11-23
+.. nonce: f3Hdyd
+.. section: macOS
+
+Add socket.TCP_KEEPALIVE support for macOS. Patch by Shane Harvey.
+
+..
+
+.. bpo: 44756
+.. date: 2021-07-28-00-51-55
+.. nonce: pvAajB
+.. section: Tools/Demos
+
+In the Makefile for documentation (:file:`Doc/Makefile`), the ``build`` rule
+is dependent on the ``venv`` rule. Therefore, ``html``, ``latex``, and other
+build-dependent rules are also now dependent on ``venv``. The ``venv`` rule
+only performs an action if ``$(VENVDIR)`` does not exist.
+:file:`Doc/README.rst` was updated; most users now only need to type ``make
+html``.
+
+..
+
+.. bpo: 41103
+.. date: 2021-07-29-16-04-28
+.. nonce: hiKKcF
+.. section: C API
+
+Reverts removal of the old buffer protocol because they are part of stable
+ABI.
+
+..
+
+.. bpo: 42747
+.. date: 2021-07-20-16-21-06
+.. nonce: rRxjUY
+.. section: C API
+
+The ``Py_TPFLAGS_HAVE_VERSION_TAG`` type flag now does nothing. The
+``Py_TPFLAGS_HAVE_AM_SEND`` flag (which was added in 3.10) is removed. Both
+were unnecessary because it is not possible to have type objects with the
+relevant fields missing.
diff --git a/Misc/NEWS.d/3.10.0rc2.rst b/Misc/NEWS.d/3.10.0rc2.rst
new file mode 100644
index 0000000..92e2e7b
--- /dev/null
+++ b/Misc/NEWS.d/3.10.0rc2.rst
@@ -0,0 +1,685 @@
+.. bpo: 42278
+.. date: 2021-08-29-12-39-44
+.. nonce: jvmQz_
+.. release date: 2021-09-07
+.. section: Security
+
+Replaced usage of :func:`tempfile.mktemp` with
+:class:`~tempfile.TemporaryDirectory` to avoid a potential race condition.
+
+..
+
+.. bpo: 44394
+.. date: 2021-06-29-02-45-53
+.. nonce: A220N1
+.. section: Security
+
+Update the vendored copy of libexpat to 2.4.1 (from 2.2.8) to get the fix
+for the CVE-2013-0340 "Billion Laughs" vulnerability. This copy is most used
+on Windows and macOS.
+
+..
+
+.. bpo: 43124
+.. date: 2021-05-08-11-50-46
+.. nonce: 2CTM6M
+.. section: Security
+
+Made the internal ``putcmd`` function in :mod:`smtplib` sanitize input for
+presence of ``\r`` and ``\n`` characters to avoid (unlikely) command
+injection.
+
+..
+
+.. bpo: 45123
+.. date: 2021-09-06-21-52-45
+.. nonce: 8Eh9iI
+.. section: Core and Builtins
+
+Fix PyAiter_Check to only check for the __anext__ presence (not for
+__aiter__). Rename PyAiter_Check to PyAIter_Check, PyObject_GetAiter ->
+PyObject_GetAIter.
+
+..
+
+.. bpo: 45018
+.. date: 2021-08-26-18-44-03
+.. nonce: pu8H9L
+.. section: Core and Builtins
+
+Fixed pickling of range iterators that iterated for over 2**32 times.
+
+..
+
+.. bpo: 45000
+.. date: 2021-08-25-23-17-32
+.. nonce: XjmyLl
+.. section: Core and Builtins
+
+A :exc:`SyntaxError` is now raised when trying to delete :const:`__debug__`.
+Patch by Dong-hee Na.
+
+..
+
+.. bpo: 44963
+.. date: 2021-08-25-23-07-10
+.. nonce: 5EET8y
+.. section: Core and Builtins
+
+Implement ``send()`` and ``throw()`` methods for ``anext_awaitable``
+objects. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 44962
+.. date: 2021-08-23-19-55-08
+.. nonce: J00ftt
+.. section: Core and Builtins
+
+Fix a race in WeakKeyDictionary, WeakValueDictionary and WeakSet when two
+threads attempt to commit the last pending removal. This fixes
+asyncio.create_task and fixes a data loss in asyncio.run where
+shutdown_asyncgens is not run
+
+..
+
+.. bpo: 44954
+.. date: 2021-08-19-14-43-24
+.. nonce: dLn3lg
+.. section: Core and Builtins
+
+Fixed a corner case bug where the result of ``float.fromhex('0x.8p-1074')``
+was rounded the wrong way.
+
+..
+
+.. bpo: 44947
+.. date: 2021-08-18-19-09-28
+.. nonce: mcvGdS
+.. section: Core and Builtins
+
+Refine the syntax error for trailing commas in import statements. Patch by
+Pablo Galindo.
+
+..
+
+.. bpo: 44698
+.. date: 2021-08-15-10-39-06
+.. nonce: lITKNc
+.. section: Core and Builtins
+
+Restore behaviour of complex exponentiation with integer-valued exponent of
+type :class:`float` or :class:`complex`.
+
+..
+
+.. bpo: 44885
+.. date: 2021-08-11-15-39-57
+.. nonce: i4noUO
+.. section: Core and Builtins
+
+Correct the ast locations of f-strings with format specs and repeated
+expressions. Patch by Pablo Galindo
+
+..
+
+.. bpo: 44872
+.. date: 2021-08-09-16-16-03
+.. nonce: OKRlhK
+.. section: Core and Builtins
+
+Use new trashcan macros (Py_TRASHCAN_BEGIN/END) in frameobject.c instead of
+the old ones (Py_TRASHCAN_SAFE_BEGIN/END).
+
+..
+
+.. bpo: 33930
+.. date: 2021-08-09-14-29-52
+.. nonce: --5LQ-
+.. section: Core and Builtins
+
+Fix segmentation fault with deep recursion when cleaning method objects.
+Patch by Augusto Goulart and Pablo Galindo.
+
+..
+
+.. bpo: 25782
+.. date: 2021-08-07-21-39-19
+.. nonce: B22lMx
+.. section: Core and Builtins
+
+Fix bug where ``PyErr_SetObject`` hangs when the current exception has a
+cycle in its context chain.
+
+..
+
+.. bpo: 44856
+.. date: 2021-08-07-01-26-12
+.. nonce: 9rk3li
+.. section: Core and Builtins
+
+Fix reference leaks in the error paths of ``update_bases()`` and
+``__build_class__``. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 44838
+.. date: 2021-08-05-17-42-03
+.. nonce: r_Lkj_
+.. section: Core and Builtins
+
+Fixed a bug that was causing the parser to raise an incorrect custom
+:exc:`SyntaxError` for invalid 'if' expressions. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 44584
+.. date: 2021-07-08-12-18-56
+.. nonce: qKnSqV
+.. section: Core and Builtins
+
+The threading debug (:envvar:`PYTHONTHREADDEBUG` environment variable) is
+deprecated in Python 3.10 and will be removed in Python 3.12. This feature
+requires a debug build of Python. Patch by Victor Stinner.
+
+..
+
+.. bpo: 39091
+.. date: 2019-12-21-14-18-32
+.. nonce: dOexgQ
+.. section: Core and Builtins
+
+Fix crash when using passing a non-exception to a generator's ``throw()``
+method. Patch by Noah Oxer
+
+..
+
+.. bpo: 45081
+.. date: 2021-09-02-12-42-25
+.. nonce: tOjJ1k
+.. section: Library
+
+Fix issue when dataclasses that inherit from ``typing.Protocol`` subclasses
+have wrong ``__init__``. Patch provided by Yurii Karabas.
+
+..
+
+.. bpo: 41620
+.. date: 2021-08-29-14-49-22
+.. nonce: WJ6PFL
+.. section: Library
+
+:meth:`~unittest.TestCase.run` now always return a
+:class:`~unittest.TestResult` instance. Previously it returned ``None`` if
+the test class or method was decorated with a skipping decorator.
+
+..
+
+.. bpo: 43913
+.. date: 2021-08-27-23-40-51
+.. nonce: Uo1Gt5
+.. section: Library
+
+Fix bugs in cleaning up classes and modules in :mod:`unittest`:
+
+* Functions registered with :func:`~unittest.addModuleCleanup` were not called unless the user defines ``tearDownModule()`` in their test module.
+* Functions registered with :meth:`~unittest.TestCase.addClassCleanup` were not called if ``tearDownClass`` is set to ``None``.
+* Buffering in :class:`~unittest.TestResult` did not work with functions registered with ``addClassCleanup()`` and ``addModuleCleanup()``.
+* Errors in functions registered with ``addClassCleanup()`` and ``addModuleCleanup()`` were not handled correctly in buffered and debug modes.
+* Errors in ``setUpModule()`` and functions registered with ``addModuleCleanup()`` were reported in wrong order.
+* And several lesser bugs.
+
+..
+
+.. bpo: 45030
+.. date: 2021-08-27-19-01-23
+.. nonce: tAmBbY
+.. section: Library
+
+Fix integer overflow in pickling and copying the range iterator.
+
+..
+
+.. bpo: 45001
+.. date: 2021-08-26-16-25-48
+.. nonce: tn_dKp
+.. section: Library
+
+Made email date parsing more robust against malformed input, namely a
+whitespace-only ``Date:`` header. Patch by Wouter Bolsterlee.
+
+..
+
+.. bpo: 44449
+.. date: 2021-08-20-11-30-52
+.. nonce: 1r2-lS
+.. section: Library
+
+Fix a crash in the signal handler of the :mod:`faulthandler` module: no
+longer modify the reference count of frame objects. Patch by Victor Stinner.
+
+..
+
+.. bpo: 44955
+.. date: 2021-08-19-15-03-54
+.. nonce: 1mxFQS
+.. section: Library
+
+Method :meth:`~unittest.TestResult.stopTestRun` is now always called in pair
+with method :meth:`~unittest.TestResult.startTestRun` for
+:class:`~unittest.TestResult` objects implicitly created in
+:meth:`~unittest.TestCase.run`. Previously it was not called for test
+methods and classes decorated with a skipping decorator.
+
+..
+
+.. bpo: 44935
+.. date: 2021-08-17-16-01-44
+.. nonce: roUl0G
+.. section: Library
+
+:mod:`subprocess` on Solaris now also uses :func:`os.posix_spawn()` for
+better performance.
+
+..
+
+.. bpo: 44911
+.. date: 2021-08-14-00-55-16
+.. nonce: uk3hYk
+.. section: Library
+
+:class:`~unittest.IsolatedAsyncioTestCase` will no longer throw an exception
+while cancelling leaked tasks. Patch by Bar Harel.
+
+..
+
+.. bpo: 44524
+.. date: 2021-08-10-16-57-10
+.. nonce: dk9QX4
+.. section: Library
+
+Make exception message more useful when subclass from typing special form
+alias. Patch provided by Yurii Karabas.
+
+..
+
+.. bpo: 38956
+.. date: 2021-08-09-13-17-10
+.. nonce: owWLNv
+.. section: Library
+
+:class:`argparse.BooleanOptionalAction`'s default value is no longer printed
+twice when used with :class:`argparse.ArgumentDefaultsHelpFormatter`.
+
+..
+
+.. bpo: 44860
+.. date: 2021-08-07-22-51-32
+.. nonce: PTvRrU
+.. section: Library
+
+Fix the ``posix_user`` scheme in :mod:`sysconfig` to not depend on
+:data:`sys.platlibdir`.
+
+..
+
+.. bpo: 44581
+.. date: 2021-08-06-19-15-52
+.. nonce: oFDBTB
+.. section: Library
+
+Upgrade bundled pip to 21.2.3 and setuptools to 57.4.0
+
+..
+
+.. bpo: 44849
+.. date: 2021-08-06-13-00-28
+.. nonce: O78F_f
+.. section: Library
+
+Fix the :func:`os.set_inheritable` function on FreeBSD 14 for file
+descriptor opened with the :data:`~os.O_PATH` flag: ignore the
+:data:`~errno.EBADF` error on ``ioctl()``, fallback on the ``fcntl()``
+implementation. Patch by Victor Stinner.
+
+..
+
+.. bpo: 44605
+.. date: 2021-08-06-09-43-50
+.. nonce: q4YSBZ
+.. section: Library
+
+The @functools.total_ordering() decorator now works with metaclasses.
+
+..
+
+.. bpo: 44524
+.. date: 2021-08-05-18-20-17
+.. nonce: 9T1tfe
+.. section: Library
+
+Fixed an issue wherein the ``__name__`` and ``__qualname__`` attributes of
+subscribed specialforms could be ``None``.
+
+..
+
+.. bpo: 44822
+.. date: 2021-08-04-12-29-00
+.. nonce: zePNXA
+.. section: Library
+
+:mod:`sqlite3` user-defined functions and aggregators returning
+:class:`strings <str>` with embedded NUL characters are no longer truncated.
+Patch by Erlend E. Aasland.
+
+..
+
+.. bpo: 44801
+.. date: 2021-08-03-20-37-45
+.. nonce: i49Aug
+.. section: Library
+
+Ensure that the :class:`~typing.ParamSpec` variable in Callable can only be
+substituted with a parameters expression (a list of types, an ellipsis,
+ParamSpec or Concatenate).
+
+..
+
+.. bpo: 27334
+.. date: 2021-05-18-00-17-21
+.. nonce: 32EJZi
+.. section: Library
+
+The :mod:`sqlite3` context manager now performs a rollback (thus releasing
+the database lock) if commit failed.  Patch by Luca Citi and Erlend E.
+Aasland.
+
+..
+
+.. bpo: 41402
+.. date: 2020-07-26-18-17-30
+.. nonce: YRkVkp
+.. section: Library
+
+Fix :meth:`email.message.EmailMessage.set_content` when called with binary
+data and ``7bit`` content transfer encoding.
+
+..
+
+.. bpo: 32695
+.. date: 2020-07-13-23-46-59
+.. nonce: tTqqXe
+.. section: Library
+
+The *compresslevel* and *preset* keyword arguments of :func:`tarfile.open`
+are now both documented and tested.
+
+..
+
+.. bpo: 34990
+.. date: 2020-04-24-20-39-38
+.. nonce: 3SmL9M
+.. section: Library
+
+Fixed a Y2k38 bug in the compileall module where it would fail to compile
+files with a modification time after the year 2038.
+
+..
+
+.. bpo: 38840
+.. date: 2020-01-16-23-41-16
+.. nonce: VzzYZz
+.. section: Library
+
+Fix ``test___all__`` on platforms lacking a shared memory implementation.
+
+..
+
+.. bpo: 26228
+.. date: 2019-02-26-09-31-59
+.. nonce: wyrHKc
+.. section: Library
+
+pty.spawn no longer hangs on FreeBSD, macOS, and Solaris.
+
+..
+
+.. bpo: 33349
+.. date: 2018-04-24-14-25-07
+.. nonce: Y_0LIr
+.. section: Library
+
+lib2to3 now recognizes async generators everywhere.
+
+..
+
+.. bpo: 44957
+.. date: 2021-08-19-15-53-08
+.. nonce: imqrh3
+.. section: Documentation
+
+Promote PEP 604 union syntax by using it where possible. Also, mention ``X |
+Y`` more prominently in section about ``Union`` and mention ``X | None`` at
+all in section about ``Optional``.
+
+..
+
+.. bpo: 44903
+.. date: 2021-08-13-19-08-03
+.. nonce: aJuvQF
+.. section: Documentation
+
+Removed the othergui.rst file, any references to it, and the list of GUI
+frameworks in the FAQ. In their place I've added links to the Python Wiki
+`page on GUI frameworks <https://wiki.python.org/moin/GuiProgramming>`.
+
+..
+
+.. bpo: 33479
+.. date: 2021-08-11-18-02-06
+.. nonce: rCe4c5
+.. section: Documentation
+
+Tkinter documentation has been greatly expanded with new "Architecture" and
+"Threading model" sections.
+
+..
+
+.. bpo: 36700
+.. date: 2021-08-09-19-58-45
+.. nonce: WPNW5f
+.. section: Documentation
+
+:mod:`base64` RFC references were updated to point to :rfc:`4648`; a section
+was added to point users to the new "security considerations" section of the
+RFC.
+
+..
+
+.. bpo: 44756
+.. date: 2021-08-06-19-36-21
+.. nonce: 1Ngzon
+.. section: Documentation
+
+Reverted automated virtual environment creation on ``make html`` when
+building documentation. It turned out to be disruptive for downstream
+distributors.
+
+..
+
+.. bpo: 42958
+.. date: 2021-07-15-11-19-03
+.. nonce: gC5IHM
+.. section: Documentation
+
+Updated the docstring and docs of :func:`filecmp.cmp` to be more accurate
+and less confusing especially in respect to *shallow* arg.
+
+..
+
+.. bpo: 43066
+.. date: 2021-06-24-14-37-16
+.. nonce: Ti7ahX
+.. section: Documentation
+
+Added a warning to :mod:`zipfile` docs: filename arg with a leading slash
+may cause archive to be un-openable on Windows systems.
+
+..
+
+.. bpo: 39452
+.. date: 2021-06-23-15-21-36
+.. nonce: o_I-6d
+.. section: Documentation
+
+Rewrote ``Doc/library/__main__.rst``. Broadened scope of the document to
+explicitly discuss and differentiate between ``__main__.py`` in packages
+versus the ``__name__ == '__main__'`` expression (and the idioms that
+surround it).
+
+..
+
+.. bpo: 27752
+.. date: 2021-06-18-18-04-53
+.. nonce: NEByNk
+.. section: Documentation
+
+Documentation of csv.Dialect is more descriptive.
+
+..
+
+.. bpo: 41576
+.. date: 2020-08-21-22-59-37
+.. nonce: 7a6CQR
+.. section: Documentation
+
+document BaseException in favor of bare except
+
+..
+
+.. bpo: 39498
+.. date: 2020-01-30-05-18-48
+.. nonce: Nu3sFL
+.. section: Documentation
+
+Add a "Security Considerations" index which links to standard library
+modules that have explicitly documented security considerations.
+
+..
+
+.. bpo: 33479
+.. date: 2018-05-19-15-59-29
+.. nonce: 4cLlxo
+.. section: Documentation
+
+Remove the unqualified claim that tkinter is threadsafe. It has not been
+true for several years and likely never was. An explanation of what is true
+may be added later, after more discussion, and possibly after patching
+_tkinter.c,
+
+..
+
+.. bpo: 45052
+.. date: 2021-09-06-19-00-29
+.. nonce: yrOK3J
+.. section: Tests
+
+``WithProcessesTestSharedMemory.test_shared_memory_basics`` test was
+ignored, because ``self.assertEqual(sms.size, sms2.size)`` line was failing.
+It is now removed and test is unskipped.
+
+The main motivation for this line to be removed from the test is that the
+``size`` of ``SharedMemory`` is not ever guaranteed to be the same. It is
+decided by the platform.
+
+..
+
+.. bpo: 45042
+.. date: 2021-08-30-11-54-14
+.. nonce: QMz3X8
+.. section: Tests
+
+Fixes that test classes decorated with
+``@hashlib_helper.requires_hashdigest`` were skipped all the time.
+
+..
+
+.. bpo: 45011
+.. date: 2021-08-26-14-20-44
+.. nonce: mQZdXU
+.. section: Tests
+
+Made tests relying on the :mod:`_asyncio` C extension module optional to
+allow running on alternative Python implementations. Patch by Serhiy
+Storchaka.
+
+..
+
+.. bpo: 44949
+.. date: 2021-08-18-18-30-12
+.. nonce: VE5ENv
+.. section: Tests
+
+Fix auto history tests of test_readline: sometimes, the newline character is
+not written at the end, so don't expect it in the output.
+
+..
+
+.. bpo: 44891
+.. date: 2021-08-13-12-11-06
+.. nonce: T9_mBT
+.. section: Tests
+
+Tests were added to clarify :func:`id` is preserved when ``obj * 1`` is used
+on :class:`str` and :class:`bytes` objects. Patch by Nikita Sobolev.
+
+..
+
+.. bpo: 44852
+.. date: 2021-08-06-18-36-04
+.. nonce: sUL8YX
+.. section: Tests
+
+Add ability to wholesale silence DeprecationWarnings while running the
+regression test suite.
+
+..
+
+.. bpo: 40928
+.. date: 2021-08-06-00-07-15
+.. nonce: aIwb6G
+.. section: Tests
+
+Notify users running test_decimal regression tests on macOS of potential
+harmless "malloc can't allocate region" messages spewed by test_decimal.
+
+..
+
+.. bpo: 45007
+.. date: 2021-08-27-23-50-02
+.. nonce: NIBlVG
+.. section: Windows
+
+Update to OpenSSL 1.1.1l in Windows build
+
+..
+
+.. bpo: 45007
+.. date: 2021-08-30-00-04-10
+.. nonce: pixqUB
+.. section: macOS
+
+Update macOS installer builds to use OpenSSL 1.1.1l.
+
+..
+
+.. bpo: 44689
+.. date: 2021-07-20-22-27-01
+.. nonce: mmT_xH
+.. section: macOS
+
+:meth:`ctypes.util.find_library` now works correctly on macOS 11 Big Sur
+even if Python is built on an older version of macOS.  Previously, when
+built on older macOS systems, ``find_library`` was not able to find  macOS
+system libraries when running on Big Sur due to changes in  how system
+libraries are stored.
diff --git a/Misc/NEWS.d/3.10.1.rst b/Misc/NEWS.d/3.10.1.rst
new file mode 100644
index 0000000..0f8938a
--- /dev/null
+++ b/Misc/NEWS.d/3.10.1.rst
@@ -0,0 +1,1530 @@
+.. bpo: 42268
+.. date: 2021-11-26-22-31-22
+.. nonce: 3wl-09
+.. release date: 2021-12-06
+.. section: Core and Builtins
+
+Fail the configure step if the selected compiler doesn't support memory
+sanitizer. Patch by Pablo Galindo
+
+..
+
+.. bpo: 45727
+.. date: 2021-11-24-18-24-49
+.. nonce: _xVbbo
+.. section: Core and Builtins
+
+Refine the custom syntax error that suggests that a comma may be missing to
+trigger only when the expressions are detected between parentheses or
+brackets. Patch by Pablo Galindo
+
+..
+
+.. bpo: 45614
+.. date: 2021-11-23-12-06-41
+.. nonce: fIekgI
+.. section: Core and Builtins
+
+Fix :mod:`traceback` display for exceptions with invalid module name.
+
+..
+
+.. bpo: 45848
+.. date: 2021-11-19-22-57-42
+.. nonce: HgVBJ5
+.. section: Core and Builtins
+
+Allow the parser to obtain error lines directly from encoded files. Patch by
+Pablo Galindo
+
+..
+
+.. bpo: 45826
+.. date: 2021-11-17-08-05-27
+.. nonce: OERoTm
+.. section: Core and Builtins
+
+Fixed a crash when calling ``.with_traceback(None)`` on ``NameError``. This
+occurs internally in ``unittest.TestCase.assertRaises()``.
+
+..
+
+.. bpo: 45822
+.. date: 2021-11-16-19-41-04
+.. nonce: OT6ueS
+.. section: Core and Builtins
+
+Fixed a bug in the parser that was causing it to not respect :pep:`263`
+coding cookies when no flags are provided. Patch by Pablo Galindo
+
+..
+
+.. bpo: 45820
+.. date: 2021-11-16-19-00-27
+.. nonce: 2X6Psr
+.. section: Core and Builtins
+
+Fix a segfault when the parser fails without reading any input. Patch by
+Pablo Galindo
+
+..
+
+.. bpo: 42540
+.. date: 2021-11-15-12-08-27
+.. nonce: V2w107
+.. section: Core and Builtins
+
+Fix crash when :func:`os.fork` is called with an active non-default memory
+allocator.
+
+..
+
+.. bpo: 45738
+.. date: 2021-11-14-00-14-45
+.. nonce: e0cgKd
+.. section: Core and Builtins
+
+Fix computation of error location for invalid continuation characters in the
+parser. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 45773
+.. date: 2021-11-09-13-01-35
+.. nonce: POU8A4
+.. section: Core and Builtins
+
+Fix a compiler hang when attempting to optimize certain jump patterns.
+
+..
+
+.. bpo: 45716
+.. date: 2021-11-04-20-19-07
+.. nonce: 5C0pA1
+.. section: Core and Builtins
+
+Improve the :exc:`SyntaxError` message when using ``True``, ``None`` or
+``False`` as keywords in a function call. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 45688
+.. date: 2021-11-02-09-27-46
+.. nonce: v5Der1
+.. section: Core and Builtins
+
+:data:`sys.stdlib_module_names` now contains the macOS-specific module
+:mod:`_scproxy`.
+
+..
+
+.. bpo: 30570
+.. date: 2021-10-19-01-04-08
+.. nonce: _G30Ms
+.. section: Core and Builtins
+
+Fixed a crash in ``issubclass()`` from infinite recursion when searching
+pathological ``__bases__`` tuples.
+
+..
+
+.. bpo: 45521
+.. date: 2021-10-18-22-40-33
+.. nonce: GdMiuW
+.. section: Core and Builtins
+
+Fix a bug in the obmalloc radix tree code.  On 64-bit machines, the bug
+causes the tree to hold 46-bits of virtual addresses, rather than the
+intended 48-bits.
+
+..
+
+.. bpo: 45494
+.. date: 2021-10-16-17-27-48
+.. nonce: vMt1g4
+.. section: Core and Builtins
+
+Fix parser crash when reporting errors involving invalid continuation
+characters. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 45408
+.. date: 2021-10-07-21-26-44
+.. nonce: qUqzcd
+.. section: Core and Builtins
+
+Fix a crash in the parser when reporting tokenizer errors that occur at the
+same time unclosed parentheses are detected. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 45385
+.. date: 2021-10-06-21-20-11
+.. nonce: CTUT8s
+.. section: Core and Builtins
+
+Fix reference leak from descr_check. Patch by Dong-hee Na.
+
+..
+
+.. bpo: 45167
+.. date: 2021-09-14-09-23-59
+.. nonce: CPSSoV
+.. section: Core and Builtins
+
+Fix deepcopying of :class:`types.GenericAlias` objects.
+
+..
+
+.. bpo: 44219
+.. date: 2021-09-09-10-32-33
+.. nonce: WiYyjz
+.. section: Core and Builtins
+
+Release the GIL while performing ``isatty`` system calls on arbitrary file
+descriptors. In particular, this affects :func:`os.isatty`,
+:func:`os.device_encoding` and :class:`io.TextIOWrapper`. By extension,
+:func:`io.open` in text mode is also affected. This change solves a deadlock
+in :func:`os.isatty`. Patch by Vincent Michel in :issue:`44219`.
+
+..
+
+.. bpo: 44959
+.. date: 2021-09-08-08-29-41
+.. nonce: OSwwPf
+.. section: Core and Builtins
+
+Added fallback to extension modules with '.sl' suffix on HP-UX
+
+..
+
+.. bpo: 44050
+.. date: 2021-09-08-00-30-09
+.. nonce: mFI15u
+.. section: Core and Builtins
+
+Extensions that indicate they use global state (by setting ``m_size`` to -1)
+can again be used in multiple interpreters. This reverts to behavior of
+Python 3.8.
+
+..
+
+.. bpo: 45121
+.. date: 2021-09-07-17-10-16
+.. nonce: iG-Hsf
+.. section: Core and Builtins
+
+Fix issue where ``Protocol.__init__`` raises ``RecursionError`` when it's
+called directly or via ``super()``. Patch provided by Yurii Karabas.
+
+..
+
+.. bpo: 45083
+.. date: 2021-09-01-23-55-49
+.. nonce: cLi9G3
+.. section: Core and Builtins
+
+When the interpreter renders an exception, its name now has a complete
+qualname. Previously only the class name was concatenated to the module
+name, which sometimes resulted in an incorrect full name being displayed.
+
+(This issue impacted only the C code exception rendering, the
+:mod:`traceback` module was using qualname already).
+
+..
+
+.. bpo: 45056
+.. date: 2021-09-01-16-55-43
+.. nonce: 7AK2d9
+.. section: Core and Builtins
+
+Compiler now removes trailing unused constants from co_consts.
+
+..
+
+.. bpo: 27946
+.. date: 2021-12-04-20-08-42
+.. nonce: -Vuarf
+.. section: Library
+
+Fix possible crash when getting an attribute of
+class:`xml.etree.ElementTree.Element` simultaneously with replacing the
+``attrib`` dict.
+
+..
+
+.. bpo: 37658
+.. date: 2021-11-28-15-30-34
+.. nonce: 8Hno7d
+.. section: Library
+
+Fix issue when on certain conditions ``asyncio.wait_for()`` may allow a
+coroutine to complete successfully, but fail to return the result,
+potentially causing memory leaks or other issues.
+
+..
+
+.. bpo: 44649
+.. date: 2021-11-21-20-50-42
+.. nonce: E8M936
+.. section: Library
+
+Handle dataclass(slots=True) with a field that has default a default value,
+but for which init=False.
+
+..
+
+.. bpo: 45803
+.. date: 2021-11-20-17-04-25
+.. nonce: wSgFOy
+.. section: Library
+
+Added missing kw_only parameter to dataclasses.make_dataclass().
+
+..
+
+.. bpo: 45831
+.. date: 2021-11-17-19-25-37
+.. nonce: 9-TojK
+.. section: Library
+
+:mod:`faulthandler` can now write ASCII-only strings (like filenames and
+function names) with a single write() syscall when dumping a traceback. It
+reduces the risk of getting an unreadable dump when two threads or two
+processes dump a traceback to the same file (like stderr) at the same time.
+Patch by Victor Stinner.
+
+..
+
+.. bpo: 41735
+.. date: 2021-11-16-18-13-49
+.. nonce: D72UY1
+.. section: Library
+
+Fix thread lock in ``zlib.Decompress.flush()`` method before
+``PyObject_GetBuffer``.
+
+..
+
+.. bpo: 45235
+.. date: 2021-11-11-13-03-17
+.. nonce: 8ZbkHa
+.. section: Library
+
+Reverted an argparse bugfix that caused regression in the handling of
+default arguments for subparsers.  This prevented leaf level arguments from
+taking precedence over root level arguments.
+
+..
+
+.. bpo: 45765
+.. date: 2021-11-09-09-04-19
+.. nonce: JVobxK
+.. section: Library
+
+In importlib.metadata, fix distribution discovery for an empty path.
+
+..
+
+.. bpo: 45757
+.. date: 2021-11-08-23-22-14
+.. nonce: MHZHt3
+.. section: Library
+
+Fix bug where :mod:`dis` produced an incorrect oparg when
+:opcode:`EXTENDED_ARG` is followed by an opcode that does not use its
+argument.
+
+..
+
+.. bpo: 45644
+.. date: 2021-11-06-17-47-46
+.. nonce: ZMqHD_
+.. section: Library
+
+In-place JSON file formatting using ``python3 -m json.tool infile infile``
+now works correctly, previously it left the file empty.  Patch by Chris
+Wesseling.
+
+..
+
+.. bpo: 45679
+.. date: 2021-10-30-21-11-37
+.. nonce: Dq8Cpu
+.. section: Library
+
+Fix caching of multi-value :data:`typing.Literal`. ``Literal[True, 2]`` is
+no longer equal to ``Literal[1, 2]``.
+
+..
+
+.. bpo: 45664
+.. date: 2021-10-28-23-40-54
+.. nonce: 7dqtxQ
+.. section: Library
+
+Fix :func:`types.resolve_bases` and :func:`types.new_class` for
+:class:`types.GenericAlias` instance as a base.
+
+..
+
+.. bpo: 45663
+.. date: 2021-10-28-23-11-59
+.. nonce: J90N5R
+.. section: Library
+
+Fix :func:`dataclasses.is_dataclass` for dataclasses which are subclasses of
+:class:`types.GenericAlias`.
+
+..
+
+.. bpo: 45662
+.. date: 2021-10-28-22-58-14
+.. nonce: sJd7Ir
+.. section: Library
+
+Fix the repr of :data:`dataclasses.InitVar` with a type alias to the
+built-in class, e.g. ``InitVar[list[int]]``.
+
+..
+
+.. bpo: 45438
+.. date: 2021-10-27-10-05-39
+.. nonce: Xz5lGU
+.. section: Library
+
+Fix typing.Signature string representation for generic builtin types.
+
+..
+
+.. bpo: 45574
+.. date: 2021-10-22-23-06-33
+.. nonce: svqA84
+.. section: Library
+
+Fix warning about ``print_escape`` being unused.
+
+..
+
+.. bpo: 45581
+.. date: 2021-10-22-21-57-02
+.. nonce: rlH6ay
+.. section: Library
+
+:meth:`sqlite3.connect` now correctly raises :exc:`MemoryError` if the
+underlying SQLite API signals memory error. Patch by Erlend E. Aasland.
+
+..
+
+.. bpo: 45557
+.. date: 2021-10-21-16-18-51
+.. nonce: 4MQt4r
+.. section: Library
+
+pprint.pprint() now handles underscore_numbers correctly. Previously it was
+always setting it to False.
+
+..
+
+.. bpo: 45515
+.. date: 2021-10-18-14-52-48
+.. nonce: aXdvm_
+.. section: Library
+
+Add references to :mod:`zoneinfo` in the :mod:`datetime` documentation,
+mostly replacing outdated references to ``dateutil.tz``. Change by Paul
+Ganssle.
+
+..
+
+.. bpo: 45475
+.. date: 2021-10-18-10-46-47
+.. nonce: sb9KDF
+.. section: Library
+
+Reverted optimization of iterating :class:`gzip.GzipFile`,
+:class:`bz2.BZ2File`, and :class:`lzma.LZMAFile` (see bpo-43787) because it
+caused regression when user iterate them without having reference of them.
+Patch by Inada Naoki.
+
+..
+
+.. bpo: 45428
+.. date: 2021-10-14-18-04-17
+.. nonce: mM2War
+.. section: Library
+
+Fix a regression in py_compile when reading filenames from standard input.
+
+..
+
+.. bpo: 45467
+.. date: 2021-10-14-13-31-19
+.. nonce: Q7Ma6A
+.. section: Library
+
+Fix incremental decoder and stream reader in the "raw-unicode-escape" codec.
+Previously they failed if the escape sequence was split.
+
+..
+
+.. bpo: 45461
+.. date: 2021-10-14-00-19-02
+.. nonce: 4LB_tJ
+.. section: Library
+
+Fix incremental decoder and stream reader in the "unicode-escape" codec.
+Previously they failed if the escape sequence was split.
+
+..
+
+.. bpo: 45239
+.. date: 2021-10-13-17-52-48
+.. nonce: 7li1_0
+.. section: Library
+
+Fixed :func:`email.utils.parsedate_tz` crashing with
+:exc:`UnboundLocalError` on certain invalid input instead of returning
+``None``. Patch by Ben Hoyt.
+
+..
+
+.. bpo: 45249
+.. date: 2021-10-10-16-14-33
+.. nonce: xqLliz
+.. section: Library
+
+Fix the behaviour of :func:`traceback.print_exc` when displaying the caret
+when the ``end_offset`` in the exception is set to 0. Patch by Pablo Galindo
+
+..
+
+.. bpo: 45416
+.. date: 2021-10-10-09-42-34
+.. nonce: n35O0_
+.. section: Library
+
+Fix use of :class:`asyncio.Condition` with explicit :class:`asyncio.Lock`
+objects, which was a regression due to removal of explicit loop arguments.
+Patch by Joongi Kim.
+
+..
+
+.. bpo: 45419
+.. date: 2021-10-09-20-53-13
+.. nonce: CauCgt
+.. section: Library
+
+Correct interfaces on DegenerateFiles.Path.
+
+..
+
+.. bpo: 44904
+.. date: 2021-10-09-18-42-27
+.. nonce: RlW5h8
+.. section: Library
+
+Fix bug in the :mod:`doctest` module that caused it to fail if a docstring
+included an example with a ``classmethod`` ``property``. Patch by Alex
+Waygood.
+
+..
+
+.. bpo: 45406
+.. date: 2021-10-08-19-24-48
+.. nonce: Qh_Mz4
+.. section: Library
+
+Make :func:`inspect.getmodule` catch ``FileNotFoundError`` raised by
+:'func:`inspect.getabsfile`, and return ``None`` to indicate that the module
+could not be determined.
+
+..
+
+.. bpo: 45262
+.. date: 2021-10-07-14-04-10
+.. nonce: HqF71Z
+.. section: Library
+
+Prevent use-after-free in asyncio. Make sure the cached running loop holder
+gets cleared on dealloc to prevent use-after-free in get_running_loop
+
+..
+
+.. bpo: 45386
+.. date: 2021-10-07-00-05-05
+.. nonce: q9ORpA
+.. section: Library
+
+Make :mod:`xmlrpc.client` more robust to C runtimes where the underlying C
+``strftime`` function results in a ``ValueError`` when testing for year
+formatting options.
+
+..
+
+.. bpo: 45371
+.. date: 2021-10-05-11-03-48
+.. nonce: NOwcDJ
+.. section: Library
+
+Fix clang rpath issue in :mod:`distutils`. The UnixCCompiler now uses
+correct clang option to add a runtime library directory (rpath) to a shared
+library.
+
+..
+
+.. bpo: 20028
+.. date: 2021-10-03-21-14-37
+.. nonce: zBA4RK
+.. section: Library
+
+Improve error message of :class:`csv.Dialect` when initializing. Patch by
+Vajrasky Kok and Dong-hee Na.
+
+..
+
+.. bpo: 45343
+.. date: 2021-10-01-23-07-02
+.. nonce: ixmctD
+.. section: Library
+
+Update bundled pip to 21.2.4 and setuptools to 58.1.0
+
+..
+
+.. bpo: 45329
+.. date: 2021-10-01-13-09-53
+.. nonce: 9iMYaO
+.. section: Library
+
+Fix freed memory access in :class:`pyexpat.xmlparser` when building it with
+an installed expat library <= 2.2.0.
+
+..
+
+.. bpo: 41710
+.. date: 2021-09-30-23-00-18
+.. nonce: svuloZ
+.. section: Library
+
+On Unix, if the ``sem_clockwait()`` function is available in the C library
+(glibc 2.30 and newer), the :meth:`threading.Lock.acquire` method now uses
+the monotonic clock (:data:`time.CLOCK_MONOTONIC`) for the timeout, rather
+than using the system clock (:data:`time.CLOCK_REALTIME`), to not be
+affected by system clock changes. Patch by Victor Stinner.
+
+..
+
+.. bpo: 45328
+.. date: 2021-09-30-08-22-44
+.. nonce: 8Z-Q0B
+.. section: Library
+
+Fixed :class:`http.client.HTTPConnection` to work properly in OSs that don't
+support the ``TCP_NODELAY`` socket option.
+
+..
+
+.. bpo: 1596321
+.. date: 2021-09-24-17-20-23
+.. nonce: 3nhPUk
+.. section: Library
+
+Fix the :func:`threading._shutdown` function when the :mod:`threading`
+module was imported first from a thread different than the main thread: no
+longer log an error at Python exit.
+
+..
+
+.. bpo: 45274
+.. date: 2021-09-23-22-17-26
+.. nonce: gPpa4E
+.. section: Library
+
+Fix a race condition in the :meth:`Thread.join() <threading.Thread.join>`
+method of the :mod:`threading` module. If the function is interrupted by a
+signal and the signal handler raises an exception, make sure that the thread
+remains in a consistent state to prevent a deadlock. Patch by Victor
+Stinner.
+
+..
+
+.. bpo: 45238
+.. date: 2021-09-18-16-56-33
+.. nonce: Hng_9V
+.. section: Library
+
+Fix :meth:`unittest.IsolatedAsyncioTestCase.debug`: it runs now asynchronous
+methods and callbacks.
+
+..
+
+.. bpo: 36674
+.. date: 2021-09-18-13-14-57
+.. nonce: a2k5Zb
+.. section: Library
+
+:meth:`unittest.TestCase.debug` raises now a :class:`unittest.SkipTest` if
+the class or the test method are decorated with the skipping decorator.
+
+..
+
+.. bpo: 45235
+.. date: 2021-09-17-16-55-37
+.. nonce: sXnmPA
+.. section: Library
+
+Fix an issue where argparse would not preserve values in a provided
+namespace when using a subparser with defaults.
+
+..
+
+.. bpo: 45183
+.. date: 2021-09-17-15-58-53
+.. nonce: Vv_vch
+.. section: Library
+
+Have zipimport.zipimporter.find_spec() not raise an exception when the
+underlying zip file has been deleted and the internal cache has been reset
+via invalidate_cache().
+
+..
+
+.. bpo: 45234
+.. date: 2021-09-17-11-20-55
+.. nonce: qUcTVt
+.. section: Library
+
+Fixed a regression in :func:`~shutil.copyfile`, :func:`~shutil.copy`,
+:func:`~shutil.copy2` raising :exc:`FileNotFoundError` when source is a
+directory, which should raise :exc:`IsADirectoryError`
+
+..
+
+.. bpo: 45228
+.. date: 2021-09-17-09-59-33
+.. nonce: WV1dcT
+.. section: Library
+
+Fix stack buffer overflow in parsing J1939 network address.
+
+..
+
+.. bpo: 45192
+.. date: 2021-09-14-15-52-47
+.. nonce: DjA-BI
+.. section: Library
+
+Fix the ``tempfile._infer_return_type`` function so that the ``dir``
+argument of the :mod:`tempfile` functions accepts an object implementing the
+``os.PathLike`` protocol.
+
+Patch by Kyungmin Lee.
+
+..
+
+.. bpo: 42135
+.. date: 2021-09-13-19-32-58
+.. nonce: 1ZAHqR
+.. section: Library
+
+Fix typo: ``importlib.find_loader`` is really slated for removal in Python
+3.12 not 3.10, like the others in GH-25169.
+
+Patch by Hugo van Kemenade.
+
+..
+
+.. bpo: 45160
+.. date: 2021-09-11-14-47-05
+.. nonce: VzMXbW
+.. section: Library
+
+When tracing a tkinter variable used by a ttk OptionMenu, callbacks are no
+longer made twice.
+
+..
+
+.. bpo: 35474
+.. date: 2021-09-11-10-45-12
+.. nonce: tEY3SD
+.. section: Library
+
+Calling :func:`mimetypes.guess_all_extensions` with ``strict=False`` no
+longer affects the result of the following call with ``strict=True``. Also,
+mutating the returned list no longer affects the global state.
+
+..
+
+.. bpo: 45166
+.. date: 2021-09-10-21-35-53
+.. nonce: UHipXF
+.. section: Library
+
+:func:`typing.get_type_hints` now works with :data:`~typing.Final` wrapped
+in :class:`~typing.ForwardRef`.
+
+..
+
+.. bpo: 20499
+.. date: 2021-09-08-01-19-31
+.. nonce: tSxx8Y
+.. section: Library
+
+Improve the speed and accuracy of statistics.pvariance().
+
+..
+
+.. bpo: 24444
+.. date: 2021-08-30-00-19-23
+.. nonce: Ki4bgz
+.. section: Library
+
+Fixed an error raised in :mod:`argparse` help display when help for an
+option is set to 1+ blank spaces or when *choices* arg is an empty
+container.
+
+..
+
+.. bpo: 45021
+.. date: 2021-08-28-13-00-12
+.. nonce: rReeaj
+.. section: Library
+
+Fix a potential deadlock at shutdown of forked children when using
+:mod:`concurrent.futures` module
+
+..
+
+.. bpo: 39039
+.. date: 2021-08-18-10-36-14
+.. nonce: A63LYh
+.. section: Library
+
+tarfile.open raises :exc:`~tarfile.ReadError` when a zlib error occurs
+during file extraction.
+
+..
+
+.. bpo: 44594
+.. date: 2021-07-12-10-32-48
+.. nonce: eEa5zi
+.. section: Library
+
+Fix an edge case of :class:`ExitStack` and :class:`AsyncExitStack` exception
+chaining.  They will now match ``with`` block behavior when ``__context__``
+is explicitly set to ``None`` when the exception is in flight.
+
+..
+
+.. bpo: 44295
+.. date: 2021-06-02-16-39-42
+.. nonce: erg01m
+.. section: Library
+
+Ensure deprecation warning from :func:`assertDictContainsSubset` points at
+calling code - by Anthony Sottile.
+
+..
+
+.. bpo: 43498
+.. date: 2021-04-20-14-14-16
+.. nonce: L_Hq-8
+.. section: Library
+
+Avoid a possible *"RuntimeError: dictionary changed size during iteration"*
+when adjusting the process count of :class:`ProcessPoolExecutor`.
+
+..
+
+.. bpo: 45640
+.. date: 2021-11-18-16-44-12
+.. nonce: lSpc2A
+.. section: Documentation
+
+Properly marked-up grammar tokens in the documentation are now clickable and
+take you to the definition of a given piece of grammar.  Patch by Arthur
+Milchior.
+
+..
+
+.. bpo: 45788
+.. date: 2021-11-18-00-07-40
+.. nonce: qibUoB
+.. section: Documentation
+
+Link doc for sys.prefix to sysconfig doc on installation paths.
+
+..
+
+.. bpo: 45772
+.. date: 2021-11-09-13-10-55
+.. nonce: EdrM3t
+.. section: Documentation
+
+``socket.socket`` documentation is corrected to a class from a function.
+
+..
+
+.. bpo: 45392
+.. date: 2021-11-06-10-54-17
+.. nonce: JZnVOz
+.. section: Documentation
+
+Update the docstring of the :class:`type` built-in to remove a redundant
+line and to mention keyword arguments for the constructor.
+
+..
+
+.. bpo: 45726
+.. date: 2021-11-05-12-15-24
+.. nonce: GwRr7e
+.. section: Documentation
+
+Improve documentation for :func:`functools.singledispatch` and
+:class:`functools.singledispatchmethod`.
+
+..
+
+.. bpo: 45680
+.. date: 2021-11-03-14-51-03
+.. nonce: 9_NTFU
+.. section: Documentation
+
+Amend the docs on ``GenericAlias`` objects to clarify that non-container
+classes can also implement ``__class_getitem__``. Patch contributed by Alex
+Waygood.
+
+..
+
+.. bpo: 45655
+.. date: 2021-10-28-19-22-55
+.. nonce: aPYGaS
+.. section: Documentation
+
+Add a new "relevant PEPs" section to the top of the documentation for the
+``typing`` module. Patch by Alex Waygood.
+
+..
+
+.. bpo: 45604
+.. date: 2021-10-26-10-00-45
+.. nonce: Dm-YhV
+.. section: Documentation
+
+Add ``level`` argument to ``multiprocessing.log_to_stderr`` function docs.
+
+..
+
+.. bpo: 45250
+.. date: 2021-10-22-12-09-18
+.. nonce: Iit5-Y
+.. section: Documentation
+
+Update the documentation to note that CPython does not consistently require
+iterators to define ``__iter__``.
+
+..
+
+.. bpo: 45464
+.. date: 2021-10-20-16-26-53
+.. nonce: mOISBs
+.. section: Documentation
+
+Mention in the documentation of :ref:`Built-in Exceptions
+<bltin-exceptions>` that inheriting from multiple exception types in a
+single subclass is not recommended due to possible memory layout
+incompatibility.
+
+..
+
+.. bpo: 45449
+.. date: 2021-10-19-01-41-40
+.. nonce: fjHZJc
+.. section: Documentation
+
+Add note about :pep:`585` in :mod:`collections.abc`.
+
+..
+
+.. bpo: 45516
+.. date: 2021-10-18-20-12-18
+.. nonce: EJh4K8
+.. section: Documentation
+
+Add protocol description to the :class:`importlib.abc.Traversable`
+documentation.
+
+..
+
+.. bpo: 20692
+.. date: 2021-10-13-00-42-54
+.. nonce: K5rGtP
+.. section: Documentation
+
+Add Programming FAQ entry explaining that int literal attribute access
+requires either a space after or parentheses around the literal.
+
+..
+
+.. bpo: 45216
+.. date: 2021-09-18-13-45-19
+.. nonce: o56nyt
+.. section: Documentation
+
+Remove extra documentation listing methods in ``difflib``. It was rendering
+twice in pydoc and was outdated in some places.
+
+..
+
+.. bpo: 45024
+.. date: 2021-09-08-17-20-19
+.. nonce: dkNPNi
+.. section: Documentation
+
+:mod:`collections.abc` documentation has been expanded to explicitly cover
+how instance and subclass checks work, with additional doctest examples and
+an exhaustive list of ABCs which test membership purely by presence of the
+right :term:`special method`\s. Patch by Raymond Hettinger.
+
+..
+
+.. bpo: 25381
+.. date: 2021-06-21-17-51-51
+.. nonce: 7Kn-_H
+.. section: Documentation
+
+In the extending chapter of the extending doc, update a paragraph about the
+global variables containing exception information.
+
+..
+
+.. bpo: 43905
+.. date: 2021-05-24-05-00-12
+.. nonce: tBIndE
+.. section: Documentation
+
+Expanded :func:`~dataclasses.astuple` and :func:`~dataclasses.asdict` docs,
+warning about deepcopy being applied and providing a workaround.
+
+..
+
+.. bpo: 19460
+.. date: 2021-11-28-15-25-02
+.. nonce: lr0aWs
+.. section: Tests
+
+Add new Test for :class:`email.mime.nonmultipart.MIMENonMultipart`.
+
+..
+
+.. bpo: 45835
+.. date: 2021-11-17-14-28-08
+.. nonce: Mgyhjx
+.. section: Tests
+
+Fix race condition in test_queue tests with multiple "feeder" threads.
+
+..
+
+.. bpo: 45678
+.. date: 2021-11-04-20-03-32
+.. nonce: 1xNMjN
+.. section: Tests
+
+Add tests for scenarios in which :class:`functools.singledispatchmethod` is
+stacked on top of a method that has already been wrapped by two other
+decorators. Patch by Alex Waygood.
+
+..
+
+.. bpo: 45578
+.. date: 2021-10-30-19-00-25
+.. nonce: bvu6X2
+.. section: Tests
+
+Add tests for :func:`dis.distb`
+
+..
+
+.. bpo: 45678
+.. date: 2021-10-30-13-12-20
+.. nonce: bKrYeS
+.. section: Tests
+
+Add tests to ensure that ``functools.singledispatchmethod`` correctly wraps
+the attributes of the target function.
+
+..
+
+.. bpo: 45577
+.. date: 2021-10-22-19-44-13
+.. nonce: dSaNvK
+.. section: Tests
+
+Add subtests for all ``pickle`` protocols in ``test_zoneinfo``.
+
+..
+
+.. bpo: 45566
+.. date: 2021-10-22-12-05-21
+.. nonce: 2gQ3ZB
+.. section: Tests
+
+Fix ``test_frozen_pickle`` in ``test_dataclasses`` to check all ``pickle``
+versions.
+
+..
+
+.. bpo: 43592
+.. date: 2021-10-21-17-22-26
+.. nonce: kHRsra
+.. section: Tests
+
+:mod:`test.libregrtest` now raises the soft resource limit for the maximum
+number of file descriptors when the default is too low for our test suite as
+was often the case on macOS.
+
+..
+
+.. bpo: 39679
+.. date: 2021-10-18-16-18-41
+.. nonce: F18qcE
+.. section: Tests
+
+Add more test cases for `@functools.singledispatchmethod` when combined with
+`@classmethod` or `@staticmethod`.
+
+..
+
+.. bpo: 45400
+.. date: 2021-10-07-13-11-45
+.. nonce: h3iT7V
+.. section: Tests
+
+Fix test_name_error_suggestions_do_not_trigger_for_too_many_locals() of
+test_exceptions if a directory name contains "a1" (like "Python-3.11.0a1"):
+use a stricter regular expression. Patch by Victor Stinner.
+
+..
+
+.. bpo: 40173
+.. date: 2021-09-30-16-54-39
+.. nonce: J_slCw
+.. section: Tests
+
+Fix :func:`test.support.import_helper.import_fresh_module`.
+
+..
+
+.. bpo: 45280
+.. date: 2021-09-25-11-05-31
+.. nonce: 3MA6lC
+.. section: Tests
+
+Add a test case for empty :class:`typing.NamedTuple`.
+
+..
+
+.. bpo: 45269
+.. date: 2021-09-24-10-41-49
+.. nonce: 8jKEr8
+.. section: Tests
+
+Cover case when invalid ``markers`` type is supplied to ``c_make_encoder``.
+
+..
+
+.. bpo: 45128
+.. date: 2021-09-16-17-22-35
+.. nonce: Jz6fl2
+.. section: Tests
+
+Fix ``test_multiprocessing_fork`` failure due to ``test_logging`` and
+``sys.modules`` manipulation.
+
+..
+
+.. bpo: 45209
+.. date: 2021-09-15-23-32-39
+.. nonce: 55ntL5
+.. section: Tests
+
+Fix ``UserWarning: resource_tracker`` warning in
+``_test_multiprocessing._TestSharedMemory.test_shared_memory_cleaned_after_process_termination``
+
+..
+
+.. bpo: 45195
+.. date: 2021-09-14-13-16-18
+.. nonce: EyQR1G
+.. section: Tests
+
+Fix test_readline.test_nonascii(): sometimes, the newline character is not
+written at the end, so don't expect it in the output. Patch by Victor
+Stinner.
+
+..
+
+.. bpo: 45156
+.. date: 2021-09-13-00-28-17
+.. nonce: 8oomV3
+.. section: Tests
+
+Fixes infinite loop on :func:`unittest.mock.seal` of mocks created by
+:func:`~unittest.create_autospec`.
+
+..
+
+.. bpo: 45125
+.. date: 2021-09-11-22-08-18
+.. nonce: FVSzs2
+.. section: Tests
+
+Improves pickling tests and docs of ``SharedMemory`` and ``SharableList``
+objects.
+
+..
+
+.. bpo: 44860
+.. date: 2021-09-08-13-01-37
+.. nonce: qXd0kx
+.. section: Tests
+
+Update ``test_sysconfig.test_user_similar()`` for the posix_user scheme:
+``platlib`` doesn't use :data:`sys.platlibdir`. Patch by Victor Stinner.
+
+..
+
+.. bpo: 25130
+.. date: 2021-08-27-22-37-19
+.. nonce: ig4oJe
+.. section: Tests
+
+Add calls of :func:`gc.collect` in tests to support PyPy.
+
+..
+
+.. bpo: 44035
+.. date: 2021-12-06-09-31-27
+.. nonce: BiO4XC
+.. section: Build
+
+CI now verifies that autoconf files have been regenerated with a current and
+unpatched autoconf package.
+
+..
+
+.. bpo: 33393
+.. date: 2021-11-25-20-26-06
+.. nonce: 24YNtM
+.. section: Build
+
+Update ``config.guess`` to 2021-06-03 and ``config.sub`` to 2021-08-14.
+``Makefile`` now has an ``update-config`` target to make updating more
+convenient.
+
+..
+
+.. bpo: 45866
+.. date: 2021-11-25-13-53-36
+.. nonce: ZH1W8N
+.. section: Build
+
+``make regen-all`` now produces the same output when run from a directory
+other than the source tree: when building Python out of the source tree.
+pegen now strips directory of the "generated by pygen from <FILENAME>"
+header Patch by Victor Stinner.
+
+..
+
+.. bpo: 41498
+.. date: 2021-11-25-09-15-04
+.. nonce: qAk5eo
+.. section: Build
+
+Python now compiles on platforms without ``sigset_t``. Several functions in
+:mod:`signal` are not available when ``sigset_t`` is missing.
+
+Based on patch by Roman Yurchak for pyodide.
+
+..
+
+.. bpo: 45881
+.. date: 2021-11-24-17-14-06
+.. nonce: GTXXLk
+.. section: Build
+
+``setup.py`` now uses ``CC`` from environment first to discover multiarch
+and cross compile paths.
+
+..
+
+.. bpo: 43158
+.. date: 2021-11-01-12-51-46
+.. nonce: fghS6w
+.. section: Build
+
+``setup.py`` now uses values from configure script to build the ``_uuid``
+extension module. Configure now detects util-linux's ``libuuid``, too.
+
+..
+
+.. bpo: 45571
+.. date: 2021-10-22-15-28-29
+.. nonce: yY8NsJ
+.. section: Build
+
+``Modules/Setup`` now use ``PY_CFLAGS_NODIST`` instead of ``PY_CFLAGS`` to
+compile shared modules.
+
+..
+
+.. bpo: 45561
+.. date: 2021-10-21-14-38-30
+.. nonce: PVqhZE
+.. section: Build
+
+Run smelly.py tool from $(srcdir).
+
+..
+
+.. bpo: 45532
+.. date: 2021-10-20-16-07-39
+.. nonce: kyhvis
+.. section: Build
+
+Update :data:`sys.version` to use ``main`` as fallback information. Patch by
+Jeong YunWon.
+
+..
+
+.. bpo: 45536
+.. date: 2021-10-20-12-42-39
+.. nonce: oQNYHB
+.. section: Build
+
+The ``configure`` script now checks whether OpenSSL headers and libraries
+provide required APIs. Most common APIs are verified. The check detects
+outdated or missing OpenSSL. Failures do not stop configure.
+
+..
+
+.. bpo: 45221
+.. date: 2021-10-18-10-25-56
+.. nonce: rnulhf
+.. section: Build
+
+Fixed regression in handling of ``LDFLAGS`` and ``CPPFLAGS`` options where
+:meth:`argparse.parse_known_args` could interpret an option as one of the
+built-in command line argument, for example ``-h`` for help.
+
+..
+
+.. bpo: 45405
+.. date: 2021-10-11-16-27-38
+.. nonce: iSfdW5
+.. section: Build
+
+Prevent ``internal configure error`` when running ``configure`` with recent
+versions of non-Apple clang.  Patch by David Bohman.
+
+..
+
+.. bpo: 45220
+.. date: 2021-09-16-18-00-43
+.. nonce: TgbkvW
+.. section: Build
+
+Avoid building with the Windows 11 SDK previews automatically. This may be
+overridden by setting the ``DefaultWindowsSDKVersion`` environment variable
+before building.
+
+..
+
+.. bpo: 45067
+.. date: 2021-09-09-16-45-26
+.. nonce: mFmY92
+.. section: Build
+
+The ncurses function extended_color_content was introduced in 2017
+
+(https://invisible-island.net/ncurses/NEWS.html#index-t20170401).  The
+
+ncurses-devel package in CentOS 7 had a older version ncurses resulted in
+compilation error.  For compiling ncurses with extended color support, we
+verify the version of the ncurses library >= 20170401.
+
+..
+
+.. bpo: 45901
+.. date: 2021-11-26-18-17-41
+.. nonce: c5IBqM
+.. section: Windows
+
+When installed through the Microsoft Store and set as the default app for
+:file:`*.py` files, command line arguments will now be passed to Python when
+invoking a script without explicitly launching Python (that is, ``script.py
+args`` rather than ``python script.py args``).
+
+..
+
+.. bpo: 45616
+.. date: 2021-11-23-11-44-42
+.. nonce: K52PLZ
+.. section: Windows
+
+Fix Python Launcher's ability to distinguish between versions 3.1 and 3.10
+when either one is explicitly requested.  Previously, 3.1 would be used if
+3.10 was requested but not installed, and 3.10 would be used if 3.1 was
+requested but 3.10 was installed.
+
+..
+
+.. bpo: 45732
+.. date: 2021-11-08-21-53-11
+.. nonce: idl5kx
+.. section: Windows
+
+Updates bundled Tcl/Tk to 8.6.12.
+
+..
+
+.. bpo: 45720
+.. date: 2021-11-05-01-05-46
+.. nonce: 47Nc5I
+.. section: Windows
+
+Internal reference to :file:`shlwapi.dll` was dropped to help improve
+startup time. This DLL will no longer be loaded at the start of every Python
+process.
+
+..
+
+.. bpo: 43652
+.. date: 2021-11-04-00-41-50
+.. nonce: RnqV7I
+.. section: Windows
+
+Update Tcl/Tk to 8.6.11, actually this time. The previous update incorrectly
+included 8.6.10.
+
+..
+
+.. bpo: 45337
+.. date: 2021-09-30-23-17-27
+.. nonce: qg7U_h
+.. section: Windows
+
+venv now warns when the created environment may need to be accessed at a
+different path, due to redirections, links or junctions. It also now
+correctly installs or upgrades components when the alternate path is
+required.
+
+..
+
+.. bpo: 45732
+.. date: 2021-12-05-23-52-03
+.. nonce: -BWrnh
+.. section: macOS
+
+Update python.org macOS installer to use Tcl/Tk 8.6.12.
+
+..
+
+.. bpo: 44828
+.. date: 2021-10-25-02-02-21
+.. nonce: XBdXlJ
+.. section: macOS
+
+Avoid tkinter file dialog failure on macOS 12 Monterey when using the Tk
+8.6.11 provided by python.org macOS installers. Patch by Marc Culler of the
+Tk project.
+
+..
+
+.. bpo: 34602
+.. date: 2021-08-27-16-55-10
+.. nonce: ZjHsYJ
+.. section: macOS
+
+When building CPython on macOS with ``./configure
+--with-undefined-behavior-sanitizer --with-pydebug``, the stack size is now
+quadrupled to allow for the entire test suite to pass.
+
+..
+
+.. bpo: 45495
+.. date: 2021-10-16-17-20-32
+.. nonce: ST8RFt
+.. section: IDLE
+
+Add context keywords 'case' and 'match' to completions list.
+
+..
+
+.. bpo: 45296
+.. date: 2021-09-27-01-21-59
+.. nonce: 9H8rdY
+.. section: IDLE
+
+On Windows, change exit/quit message to suggest Ctrl-D, which works, instead
+of <Ctrl-Z Return>, which does not work in IDLE.
+
+..
+
+.. bpo: 45193
+.. date: 2021-09-15-03-20-06
+.. nonce: G61_GV
+.. section: IDLE
+
+Make completion boxes appear on Ubuntu again.
+
+..
+
+.. bpo: 44786
+.. date: 2021-09-14-11-44-26
+.. nonce: DU0LC0
+.. section: Tools/Demos
+
+Fix a warning in regular expression in the c-analyzer script.
+
+..
+
+.. bpo: 39026
+.. date: 2021-11-09-15-42-11
+.. nonce: sUnYWn
+.. section: C API
+
+Fix Python.h to build C extensions with Xcode: remove a relative include
+from ``Include/cpython/pystate.h``.
+
+..
+
+.. bpo: 45307
+.. date: 2021-09-28-12-00-55
+.. nonce: 3ETFfX
+.. section: C API
+
+Restore the private C API function :func:`_PyImport_FindExtensionObject`. It
+will be removed in Python 3.11.
+
+..
+
+.. bpo: 44687
+.. date: 2021-09-19-17-18-25
+.. nonce: 3fqDRC
+.. section: C API
+
+:meth:`BufferedReader.peek` no longer raises :exc:`ValueError` when the
+entire file has already been buffered.
+
+..
+
+.. bpo: 44751
+.. date: 2021-07-27-17-29-12
+.. nonce: 4qmbDG
+.. section: C API
+
+Remove ``crypt.h`` include from the public ``Python.h`` header.
diff --git a/Misc/NEWS.d/3.10.2.rst b/Misc/NEWS.d/3.10.2.rst
new file mode 100644
index 0000000..c0fc751
--- /dev/null
+++ b/Misc/NEWS.d/3.10.2.rst
@@ -0,0 +1,393 @@
+.. bpo: 46347
+.. date: 2022-01-11-13-57-00
+.. nonce: Gd8M-S
+.. release date: 2022-01-13
+.. section: Core and Builtins
+
+Fix memory leak in PyEval_EvalCodeEx.
+
+..
+
+.. bpo: 46289
+.. date: 2022-01-07-23-32-03
+.. nonce: NnjpVc
+.. section: Core and Builtins
+
+ASDL declaration of ``FormattedValue`` has changed to reflect ``conversion``
+field is not optional.
+
+..
+
+.. bpo: 46237
+.. date: 2022-01-07-19-33-05
+.. nonce: 9A6Hpq
+.. section: Core and Builtins
+
+Fix the line number of tokenizer errors inside f-strings. Patch by Pablo
+Galindo.
+
+..
+
+.. bpo: 46006
+.. date: 2022-01-05-17-13-47
+.. nonce: hdH5Vn
+.. section: Core and Builtins
+
+Fix a regression when a type method like ``__init__()`` is modified in a
+subinterpreter. Fix a regression in ``_PyUnicode_EqualToASCIIId()`` and type
+``update_slot()``. Revert the change which made the Unicode dictionary of
+interned strings compatible with subinterpreters: the internal interned
+dictionary is shared again by all interpreters. Patch by Victor Stinner.
+
+..
+
+.. bpo: 46085
+.. date: 2021-12-30-00-23-41
+.. nonce: bDuJqu
+.. section: Core and Builtins
+
+Fix iterator cache mechanism of :class:`OrderedDict`.
+
+..
+
+.. bpo: 46110
+.. date: 2021-12-18-02-37-07
+.. nonce: B6hAfu
+.. section: Core and Builtins
+
+Add a maximum recursion check to the PEG parser to avoid stack overflow.
+Patch by Pablo Galindo
+
+..
+
+.. bpo: 46054
+.. date: 2021-12-12-05-30-21
+.. nonce: 2P-foG
+.. section: Core and Builtins
+
+Fix parser error when parsing non-utf8 characters in source files. Patch by
+Pablo Galindo.
+
+..
+
+.. bpo: 46042
+.. date: 2021-12-11-17-40-34
+.. nonce: aqYxku
+.. section: Core and Builtins
+
+Improve the location of the caret in :exc:`SyntaxError` exceptions emitted
+by the symbol table. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 46025
+.. date: 2021-12-09-11-41-35
+.. nonce: pkEvW9
+.. section: Core and Builtins
+
+Fix a crash in the :mod:`atexit` module involving functions that unregister
+themselves before raising exceptions. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 46009
+.. date: 2021-12-08-11-06-53
+.. nonce: cL8pH0
+.. section: Core and Builtins
+
+Restore behavior from 3.9 and earlier when sending non-None to newly started
+generator. In 3.9 this did not affect the state of the generator. In 3.10.0
+and 3.10.1 ``gen_func().send(0)`` is equivalent to
+``gen_func().throw(TypeError(...)`` which exhausts the generator. In 3.10.2
+onward, the behavior has been reverted to that of 3.9.
+
+..
+
+.. bpo: 46000
+.. date: 2021-12-07-11-42-44
+.. nonce: v_ru3k
+.. section: Core and Builtins
+
+Improve compatibility of the :mod:`curses` module with NetBSD curses.
+
+..
+
+.. bpo: 46004
+.. date: 2021-12-07-11-24-24
+.. nonce: TTEU1p
+.. section: Core and Builtins
+
+Fix the :exc:`SyntaxError` location for errors involving for loops with
+invalid targets. Patch by Pablo Galindo
+
+..
+
+.. bpo: 42918
+.. date: 2021-12-06-15-32-12
+.. nonce: Czpgtg
+.. section: Core and Builtins
+
+Fix bug where the built-in :func:`compile` function did not always raise a
+:exc:`SyntaxError` when passed multiple statements in 'single' mode. Patch
+by Weipeng Hong.
+
+..
+
+.. bpo: 40479
+.. date: 2022-01-07-15-20-19
+.. nonce: EKfr3F
+.. section: Library
+
+Fix :mod:`hashlib` *usedforsecurity* option to work correctly with OpenSSL
+3.0.0 in FIPS mode.
+
+..
+
+.. bpo: 46070
+.. date: 2022-01-07-13-51-22
+.. nonce: -axLUW
+.. section: Library
+
+Fix possible segfault when importing the :mod:`asyncio` module from
+different sub-interpreters in parallel. Patch by Erlend E. Aasland.
+
+..
+
+.. bpo: 46278
+.. date: 2022-01-06-13-38-00
+.. nonce: wILA80
+.. section: Library
+
+Reflect ``context`` argument in ``AbstractEventLoop.call_*()`` methods. Loop
+implementations already support it.
+
+..
+
+.. bpo: 46239
+.. date: 2022-01-03-12-59-20
+.. nonce: ySVSEy
+.. section: Library
+
+Improve error message when importing :mod:`asyncio.windows_events` on
+non-Windows.
+
+..
+
+.. bpo: 20369
+.. date: 2021-12-17-12-06-40
+.. nonce: zzLuBz
+.. section: Library
+
+:func:`concurrent.futures.wait` no longer blocks forever when given
+duplicate Futures. Patch by Kumar Aditya.
+
+..
+
+.. bpo: 46105
+.. date: 2021-12-16-14-30-36
+.. nonce: pprB1K
+.. section: Library
+
+Honor spec when generating requirement specs with urls and extras
+(importlib_metadata 4.8.3).
+
+..
+
+.. bpo: 26952
+.. date: 2021-12-14-13-18-45
+.. nonce: hjhISq
+.. section: Library
+
+:mod:`argparse` raises :exc:`ValueError` with clear message when trying to
+render usage for an empty mutually-exclusive group. Previously it raised a
+cryptic :exc:`IndexError`.
+
+..
+
+.. bpo: 27718
+.. date: 2021-12-11-22-51-30
+.. nonce: MgQiGl
+.. section: Library
+
+Fix help for the :mod:`signal` module. Some functions (e.g. ``signal()`` and
+``getsignal()``) were omitted.
+
+..
+
+.. bpo: 46032
+.. date: 2021-12-11-15-45-07
+.. nonce: HmciLT
+.. section: Library
+
+The ``registry()`` method of :func:`functools.singledispatch` functions
+checks now the first argument or the first parameter annotation and raises a
+TypeError if it is not supported. Previously unsupported "types" were
+ignored (e.g. ``typing.List[int]``) or caused an error at calling time (e.g.
+``list[int]``).
+
+..
+
+.. bpo: 46018
+.. date: 2021-12-09-00-44-42
+.. nonce: hkTI7v
+.. section: Library
+
+Ensure that :func:`math.expm1` does not raise on underflow.
+
+..
+
+.. bpo: 45755
+.. date: 2021-12-07-21-55-22
+.. nonce: bRqKGa
+.. section: Library
+
+:mod:`typing` generic aliases now reveal the class attributes of the
+original generic class when passed to ``dir()``. This was the behavior up to
+Python 3.6, but was changed in 3.7-3.9.
+
+..
+
+.. bpo: 13236
+.. date: 2021-11-30-13-52-02
+.. nonce: FmJIkO
+.. section: Library
+
+:class:`unittest.TextTestResult` and :class:`unittest.TextTestRunner` flush
+now the output stream more often.
+
+..
+
+.. bpo: 42378
+.. date: 2021-07-25-08-17-55
+.. nonce: WIhUZK
+.. section: Library
+
+Fixes the issue with log file being overwritten when
+:class:`logging.FileHandler` is used in :mod:`atexit` with *filemode* set to
+``'w'``. Note this will cause the message in *atexit* not being logged if
+the log stream is already closed due to shutdown of logging.
+
+..
+
+.. bpo: 46120
+.. date: 2021-12-21-12-45-57
+.. nonce: PE0DmJ
+.. section: Documentation
+
+State that ``|`` is preferred for readability over ``Union`` in the
+:mod:`typing` docs.
+
+..
+
+.. bpo: 46040
+.. date: 2021-12-11-20-03-09
+.. nonce: qrsG0C
+.. section: Documentation
+
+Fix removal Python version for ``@asyncio.coroutine``, the correct value is
+3.11.
+
+..
+
+.. bpo: 19737
+.. date: 2021-11-28-22-43-21
+.. nonce: cOOubB
+.. section: Documentation
+
+Update the documentation for the :func:`globals` function.
+
+..
+
+.. bpo: 45840
+.. date: 2021-11-19-02-02-32
+.. nonce: A51B2S
+.. section: Documentation
+
+Improve cross-references in the documentation for the data model.
+
+..
+
+.. bpo: 46205
+.. date: 2022-01-07-14-06-12
+.. nonce: dnc2OC
+.. section: Tests
+
+Fix hang in runtest_mp due to race condition
+
+..
+
+.. bpo: 46263
+.. date: 2022-01-06-15-45-34
+.. nonce: bJXek6
+.. section: Tests
+
+Fix test_capi on FreeBSD 14-dev: instruct jemalloc to not fill freed memory
+with junk byte.
+
+..
+
+.. bpo: 46150
+.. date: 2021-12-23-13-42-15
+.. nonce: RhtADs
+.. section: Tests
+
+Now ``fakename`` in ``test_pathlib.PosixPathTest.test_expanduser`` is
+checked to be non-existent.
+
+..
+
+.. bpo: 46129
+.. date: 2021-12-19-12-20-57
+.. nonce: I3MunH
+.. section: Tests
+
+Rewrite ``asyncio.locks`` tests with
+:class:`unittest.IsolatedAsyncioTestCase` usage.
+
+..
+
+.. bpo: 46114
+.. date: 2021-12-17-14-46-19
+.. nonce: 9iyZ_9
+.. section: Tests
+
+Fix test case for OpenSSL 3.0.1 version. OpenSSL 3.0 uses ``0xMNN00PP0L``.
+
+..
+
+.. bpo: 46263
+.. date: 2022-01-05-02-58-10
+.. nonce: xiv8NU
+.. section: Build
+
+``configure`` no longer sets ``MULTIARCH`` on FreeBSD platforms.
+
+..
+
+.. bpo: 46106
+.. date: 2021-12-20-07-10-41
+.. nonce: 5qcv3L
+.. section: Build
+
+Updated OpenSSL to 1.1.1m in Windows builds, macOS installer builds, and CI.
+Patch by Kumar Aditya.
+
+..
+
+.. bpo: 40477
+.. date: 2022-01-02-21-56-53
+.. nonce: W3nnM6
+.. section: macOS
+
+The Python Launcher app for macOS now properly launches scripts and, if
+necessary, the Terminal app when running on recent macOS releases.
+
+..
+
+.. bpo: 46236
+.. date: 2022-01-05-10-16-16
+.. nonce: pcmVQw
+.. section: C API
+
+Fix a bug in :c:func:`PyFunction_GetAnnotations` that caused it to return a
+``tuple`` instead of a ``dict``.
diff --git a/Misc/NEWS.d/3.10.3.rst b/Misc/NEWS.d/3.10.3.rst
new file mode 100644
index 0000000..eeaeda9
--- /dev/null
+++ b/Misc/NEWS.d/3.10.3.rst
@@ -0,0 +1,945 @@
+.. bpo: 46940
+.. date: 2022-03-06-20-16-13
+.. nonce: _X47Hx
+.. release date: 2022-03-16
+.. section: Core and Builtins
+
+Avoid overriding :exc:`AttributeError` metadata information for nested
+attribute access calls. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 46852
+.. date: 2022-02-25-02-01-42
+.. nonce: _3zg8D
+.. section: Core and Builtins
+
+Rename the private undocumented ``float.__set_format__()`` method to
+``float.__setformat__()`` to fix a typo introduced in Python 3.7. The method
+is only used by test_float. Patch by Victor Stinner.
+
+..
+
+.. bpo: 46794
+.. date: 2022-02-22-12-07-53
+.. nonce: 6WvJ9o
+.. section: Core and Builtins
+
+Bump up the libexpat version into 2.4.6
+
+..
+
+.. bpo: 46820
+.. date: 2022-02-21-21-55-23
+.. nonce: 4RfUZh
+.. section: Core and Builtins
+
+Fix parsing a numeric literal immediately (without spaces) followed by "not
+in" keywords, like in ``1not in x``. Now the parser only emits a warning,
+not a syntax error.
+
+..
+
+.. bpo: 46762
+.. date: 2022-02-15-20-26-46
+.. nonce: 1H7vab
+.. section: Core and Builtins
+
+Fix an assert failure in debug builds when a '<', '>', or '=' is the last
+character in an f-string that's missing a closing right brace.
+
+..
+
+.. bpo: 46724
+.. date: 2022-02-14-14-44-06
+.. nonce: jym_K6
+.. section: Core and Builtins
+
+Make sure that all backwards jumps use the ``JUMP_ABSOLUTE`` instruction,
+rather than ``JUMP_FORWARD`` with an argument of ``(2**32)+offset``.
+
+..
+
+.. bpo: 46732
+.. date: 2022-02-12-11-16-40
+.. nonce: 3Z_qxd
+.. section: Core and Builtins
+
+Correct the docstring for the :meth:`__bool__` method. Patch by Jelle
+Zijlstra.
+
+..
+
+.. bpo: 46707
+.. date: 2022-02-10-03-13-18
+.. nonce: xeSEh0
+.. section: Core and Builtins
+
+Avoid potential exponential backtracking when producing some syntax errors
+involving lots of brackets. Patch by Pablo Galindo.
+
+..
+
+.. bpo: 40479
+.. date: 2022-02-06-23-08-30
+.. nonce: zED3Zu
+.. section: Core and Builtins
+
+Add a missing call to ``va_end()`` in ``Modules/_hashopenssl.c``.
+
+..
+
+.. bpo: 46615
+.. date: 2022-02-04-04-33-18
+.. nonce: puArY9
+.. section: Core and Builtins
+
+When iterating over sets internally in ``setobject.c``, acquire strong
+references to the resulting items from the set.  This prevents crashes in
+corner-cases of various set operations where the set gets mutated.
+
+..
+
+.. bpo: 45773
+.. date: 2022-02-01-14-30-56
+.. nonce: Up77LD
+.. section: Core and Builtins
+
+Remove two invalid "peephole" optimizations from the bytecode compiler.
+
+..
+
+.. bpo: 43721
+.. date: 2022-02-01-10-05-27
+.. nonce: -1XAIo
+.. section: Core and Builtins
+
+Fix docstrings of :attr:`~property.getter`, :attr:`~property.setter`, and
+:attr:`~property.deleter` to clarify that they create a new copy of the
+property.
+
+..
+
+.. bpo: 46503
+.. date: 2022-01-24-21-24-41
+.. nonce: 4UrPsE
+.. section: Core and Builtins
+
+Fix an assert when parsing some invalid \N escape sequences in f-strings.
+
+..
+
+.. bpo: 46417
+.. date: 2022-01-22-14-39-23
+.. nonce: 3U5SfN
+.. section: Core and Builtins
+
+Fix a race condition on setting a type ``__bases__`` attribute: the internal
+function ``add_subclass()`` now gets the ``PyTypeObject.tp_subclasses``
+member after calling :c:func:`PyWeakref_NewRef` which can trigger a garbage
+collection which can indirectly modify ``PyTypeObject.tp_subclasses``. Patch
+by Victor Stinner.
+
+..
+
+.. bpo: 46383
+.. date: 2022-01-14-20-55-34
+.. nonce: v8MTl4
+.. section: Core and Builtins
+
+Fix invalid signature of ``_zoneinfo``'s ``module_free`` function to resolve
+a crash on wasm32-emscripten platform.
+
+..
+
+.. bpo: 46070
+.. date: 2022-01-13-17-58-56
+.. nonce: q8IGth
+.. section: Core and Builtins
+
+:c:func:`Py_EndInterpreter` now explicitly untracks all objects currently
+tracked by the GC. Previously, if an object was used later by another
+interpreter, calling :c:func:`PyObject_GC_UnTrack` on the object crashed if
+the previous or the next object of the :c:type:`PyGC_Head` structure became
+a dangling pointer. Patch by Victor Stinner.
+
+..
+
+.. bpo: 46339
+.. date: 2022-01-11-11-50-19
+.. nonce: OVumDZ
+.. section: Core and Builtins
+
+Fix a crash in the parser when retrieving the error text for multi-line
+f-strings expressions that do not start in the first line of the string.
+Patch by Pablo Galindo
+
+..
+
+.. bpo: 46240
+.. date: 2022-01-03-23-31-25
+.. nonce: 8lGjeK
+.. section: Core and Builtins
+
+Correct the error message for unclosed parentheses when the tokenizer
+doesn't reach the end of the source when the error is reported. Patch by
+Pablo Galindo
+
+..
+
+.. bpo: 46091
+.. date: 2021-12-16-00-24-00
+.. nonce: rJ_e_e
+.. section: Core and Builtins
+
+Correctly calculate indentation levels for lines with whitespace character
+that are ended by line continuation characters. Patch by Pablo Galindo
+
+..
+
+.. bpo: 43253
+.. date: 2022-03-15-07-53-45
+.. nonce: rjdLFj
+.. section: Library
+
+Fix a crash when closing transports where the underlying socket handle is
+already invalid on the Proactor event loop.
+
+..
+
+.. bpo: 47004
+.. date: 2022-03-13-15-04-05
+.. nonce: SyYpxd
+.. section: Library
+
+Apply bugfixes from importlib_metadata 4.11.3, including bugfix for
+EntryPoint.extras, which was returning match objects and not the extras
+strings.
+
+..
+
+.. bpo: 46985
+.. date: 2022-03-11-13-34-16
+.. nonce: BgoMr2
+.. section: Library
+
+Upgrade pip wheel bundled with ensurepip (pip 22.0.4)
+
+..
+
+.. bpo: 46968
+.. date: 2022-03-10-14-51-11
+.. nonce: ym2QxL
+.. section: Library
+
+:mod:`faulthandler`: On Linux 5.14 and newer, dynamically determine size of
+signal handler stack size CPython allocates using
+``getauxval(AT_MINSIGSTKSZ)``. This changes allows for Python extension's
+request to Linux kernel to use AMX_TILE instruction set on Sapphire Rapids
+Xeon processor to succeed, unblocking use of the ISA in frameworks.
+
+..
+
+.. bpo: 46955
+.. date: 2022-03-08-22-41-59
+.. nonce: IOoonN
+.. section: Library
+
+Expose :class:`asyncio.base_events.Server` as :class:`asyncio.Server`. Patch
+by Stefan Zabka.
+
+..
+
+.. bpo: 23325
+.. date: 2022-03-08-11-34-06
+.. nonce: 3VQnfo
+.. section: Library
+
+The :mod:`signal` module no longer assumes that :const:`~signal.SIG_IGN` and
+:const:`~signal.SIG_DFL` are small int singletons.
+
+..
+
+.. bpo: 46932
+.. date: 2022-03-07-20-20-34
+.. nonce: xbarAs
+.. section: Library
+
+Update bundled libexpat to 2.4.7
+
+..
+
+.. bpo: 25707
+.. date: 2022-03-05-09-43-53
+.. nonce: gTlclP
+.. section: Library
+
+Fixed a file leak in :func:`xml.etree.ElementTree.iterparse` when the
+iterator is not exhausted. Patch by Jacob Walls.
+
+..
+
+.. bpo: 44886
+.. date: 2022-02-23-00-55-59
+.. nonce: I40Mbr
+.. section: Library
+
+Inherit asyncio proactor datagram transport from
+:class:`asyncio.DatagramTransport`.
+
+..
+
+.. bpo: 46827
+.. date: 2022-02-22-15-08-30
+.. nonce: hvj38S
+.. section: Library
+
+Support UDP sockets in  :meth:`asyncio.loop.sock_connect` for selector-based
+event loops.  Patch by Thomas Grainger.
+
+..
+
+.. bpo: 46811
+.. date: 2022-02-20-21-03-31
+.. nonce: 8BxgdQ
+.. section: Library
+
+Make test suite support Expat >=2.4.5
+
+..
+
+.. bpo: 46252
+.. date: 2022-02-20-12-59-46
+.. nonce: KG1SqA
+.. section: Library
+
+Raise :exc:`TypeError` if :class:`ssl.SSLSocket` is passed to
+transport-based APIs.
+
+..
+
+.. bpo: 46784
+.. date: 2022-02-18-22-10-30
+.. nonce: SVOQJx
+.. section: Library
+
+Fix libexpat symbols collisions with user dynamically loaded or statically
+linked libexpat in embedded Python.
+
+..
+
+.. bpo: 39327
+.. date: 2022-02-17-13-10-50
+.. nonce: ytIT7Z
+.. section: Library
+
+:func:`shutil.rmtree` can now work with VirtualBox shared  folders when
+running from the guest operating-system.
+
+..
+
+.. bpo: 46756
+.. date: 2022-02-15-11-57-53
+.. nonce: AigSPi
+.. section: Library
+
+Fix a bug in :meth:`urllib.request.HTTPPasswordMgr.find_user_password` and
+:meth:`urllib.request.HTTPPasswordMgrWithPriorAuth.is_authenticated` which
+allowed to bypass authorization. For example, access to URI
+``example.org/foobar`` was allowed if the user was authorized for URI
+``example.org/foo``.
+
+..
+
+.. bpo: 46643
+.. date: 2022-02-09-22-40-11
+.. nonce: aBlIx1
+.. section: Library
+
+In :func:`typing.get_type_hints`, support evaluating stringified
+``ParamSpecArgs`` and ``ParamSpecKwargs`` annotations. Patch by Gregory
+Beauregard.
+
+..
+
+.. bpo: 45863
+.. date: 2022-02-09-00-53-23
+.. nonce: zqQXVv
+.. section: Library
+
+When the :mod:`tarfile` module creates a pax format archive, it will put an
+integer representation of timestamps in the ustar header (if possible) for
+the benefit of older unarchivers, in addition to the existing full-precision
+timestamps in the pax extended header.
+
+..
+
+.. bpo: 46676
+.. date: 2022-02-07-19-20-42
+.. nonce: 3Aws1o
+.. section: Library
+
+Make :data:`typing.ParamSpec` args and kwargs equal to themselves. Patch by
+Gregory Beauregard.
+
+..
+
+.. bpo: 46672
+.. date: 2022-02-07-13-15-16
+.. nonce: 4swIjx
+.. section: Library
+
+Fix ``NameError`` in :func:`asyncio.gather` when initial type check fails.
+
+..
+
+.. bpo: 46655
+.. date: 2022-02-06-08-54-03
+.. nonce: DiLzYv
+.. section: Library
+
+In :func:`typing.get_type_hints`, support evaluating bare stringified
+``TypeAlias`` annotations. Patch by Gregory Beauregard.
+
+..
+
+.. bpo: 45948
+.. date: 2022-02-05-18-22-05
+.. nonce: w4mCnE
+.. section: Library
+
+Fixed a discrepancy in the C implementation of the
+:mod:`xml.etree.ElementTree` module. Now, instantiating an
+:class:`xml.etree.ElementTree.XMLParser` with a ``target=None`` keyword
+provides a default :class:`xml.etree.ElementTree.TreeBuilder` target as the
+Python implementation does.
+
+..
+
+.. bpo: 46521
+.. date: 2022-02-01-19-34-28
+.. nonce: IMUIrs
+.. section: Library
+
+Fix a bug in the :mod:`codeop` module that was incorrectly identifying
+invalid code involving string quotes as valid code.
+
+..
+
+.. bpo: 46581
+.. date: 2022-02-01-11-32-47
+.. nonce: t7Zw65
+.. section: Library
+
+Brings :class:`ParamSpec` propagation for :class:`GenericAlias` in line with
+:class:`Concatenate` (and others).
+
+..
+
+.. bpo: 46591
+.. date: 2022-01-31-15-40-38
+.. nonce: prBD1M
+.. section: Library
+
+Make the IDLE doc URL on the About IDLE dialog clickable.
+
+..
+
+.. bpo: 46400
+.. date: 2022-01-30-15-16-12
+.. nonce: vweUiO
+.. section: Library
+
+expat: Update libexpat from 2.4.1 to 2.4.4
+
+..
+
+.. bpo: 46487
+.. date: 2022-01-27-12-24-38
+.. nonce: UDkN2z
+.. section: Library
+
+Add the ``get_write_buffer_limits`` method to
+:class:`asyncio.transports.WriteTransport` and to the SSL transport.
+
+..
+
+.. bpo: 45173
+.. date: 2022-01-27-11-16-59
+.. nonce: wreRF2
+.. section: Library
+
+Note the configparser deprecations will be removed in Python 3.12.
+
+..
+
+.. bpo: 46539
+.. date: 2022-01-26-20-36-30
+.. nonce: 23iW1d
+.. section: Library
+
+In :func:`typing.get_type_hints`, support evaluating stringified
+``ClassVar`` and ``Final`` annotations inside ``Annotated``. Patch by
+Gregory Beauregard.
+
+..
+
+.. bpo: 46491
+.. date: 2022-01-24-23-55-30
+.. nonce: jmIKHo
+.. section: Library
+
+Allow :data:`typing.Annotated` to wrap :data:`typing.Final` and
+:data:`typing.ClassVar`. Patch by Gregory Beauregard.
+
+..
+
+.. bpo: 46436
+.. date: 2022-01-23-19-37-00
+.. nonce: Biz1p9
+.. section: Library
+
+Fix command-line option ``-d``/``--directory`` in module :mod:`http.server`
+which is ignored when combined with command-line option ``--cgi``. Patch by
+Géry Ogam.
+
+..
+
+.. bpo: 41403
+.. date: 2022-01-23-18-04-45
+.. nonce: SgoHqV
+.. section: Library
+
+Make :meth:`mock.patch` raise a :exc:`TypeError` with a relevant error
+message on invalid arg. Previously it allowed a cryptic
+:exc:`AttributeError` to escape.
+
+..
+
+.. bpo: 46474
+.. date: 2022-01-22-14-49-10
+.. nonce: eKQhvx
+.. section: Library
+
+In ``importlib.metadata.EntryPoint.pattern``, avoid potential REDoS by
+limiting ambiguity in consecutive whitespace.
+
+..
+
+.. bpo: 46469
+.. date: 2022-01-22-05-05-08
+.. nonce: plUab5
+.. section: Library
+
+:mod:`asyncio` generic classes now return :class:`types.GenericAlias` in
+``__class_getitem__`` instead of the same class.
+
+..
+
+.. bpo: 46434
+.. date: 2022-01-20-10-35-10
+.. nonce: geS-aP
+.. section: Library
+
+:mod:`pdb` now gracefully handles ``help`` when :attr:`__doc__` is missing,
+for example when run with pregenerated optimized ``.pyc`` files.
+
+..
+
+.. bpo: 46333
+.. date: 2022-01-11-15-54-15
+.. nonce: B1faiF
+.. section: Library
+
+The :meth:`__eq__` and :meth:`__hash__` methods of
+:class:`typing.ForwardRef` now honor the ``module`` parameter of
+:class:`typing.ForwardRef`. Forward references from different modules are
+now differentiated.
+
+..
+
+.. bpo: 46246
+.. date: 2022-01-07-13-27-53
+.. nonce: CTLx32
+.. section: Library
+
+Add missing ``__slots__`` to ``importlib.metadata.DeprecatedList``. Patch by
+Arie Bovenberg.
+
+..
+
+.. bpo: 46266
+.. date: 2022-01-05-12-48-18
+.. nonce: ACQCgX
+.. section: Library
+
+Improve day constants in :mod:`calendar`.
+
+Now all constants (`MONDAY` ... `SUNDAY`) are documented, tested, and added
+to ``__all__``.
+
+..
+
+.. bpo: 46232
+.. date: 2022-01-03-09-46-44
+.. nonce: s0KlyI
+.. section: Library
+
+The :mod:`ssl` module now handles certificates with bit strings in DN
+correctly.
+
+..
+
+.. bpo: 43118
+.. date: 2021-12-29-14-42-09
+.. nonce: BoVi_5
+.. section: Library
+
+Fix a bug in :func:`inspect.signature` that was causing it to fail on some
+subclasses of classes with a ``__text_signature__`` referencing module
+globals. Patch by Weipeng Hong.
+
+..
+
+.. bpo: 26552
+.. date: 2021-12-29-13-42-55
+.. nonce: 1BqeAn
+.. section: Library
+
+Fixed case where failing :func:`asyncio.ensure_future` did not close the
+coroutine. Patch by Kumar Aditya.
+
+..
+
+.. bpo: 21987
+.. date: 2021-12-28-11-55-10
+.. nonce: avBK-p
+.. section: Library
+
+Fix an issue with :meth:`tarfile.TarFile.getmember` getting a directory name
+with a trailing slash.
+
+..
+
+.. bpo: 20392
+.. date: 2021-12-22-12-02-27
+.. nonce: CLAFIp
+.. section: Library
+
+Fix inconsistency with uppercase file extensions in
+:meth:`MimeTypes.guess_type`. Patch by Kumar Aditya.
+
+..
+
+.. bpo: 46080
+.. date: 2021-12-15-06-29-00
+.. nonce: AuQpLt
+.. section: Library
+
+Fix exception in argparse help text generation if a
+:class:`argparse.BooleanOptionalAction` argument's default is
+``argparse.SUPPRESS`` and it has ``help`` specified.  Patch by Felix
+Fontein.
+
+..
+
+.. bpo: 44439
+.. date: 2021-11-08-20-27-41
+.. nonce: I_8qro
+.. section: Library
+
+Fix ``.write()`` method of a member file in ``ZipFile``, when the input data
+is an object that supports the buffer protocol, the file length may be
+wrong.
+
+..
+
+.. bpo: 45703
+.. date: 2021-11-03-13-41-49
+.. nonce: 35AagL
+.. section: Library
+
+When a namespace package is imported before another module from the same
+namespace is created/installed in a different :data:`sys.path` location
+while the program is running, calling the
+:func:`importlib.invalidate_caches` function will now also guarantee the new
+module is noticed.
+
+..
+
+.. bpo: 24959
+.. date: 2021-09-06-15-46-53
+.. nonce: UVFgiO
+.. section: Library
+
+Fix bug where :mod:`unittest` sometimes drops frames from tracebacks of
+exceptions raised in tests.
+
+..
+
+.. bpo: 44791
+.. date: 2021-07-31-23-18-50
+.. nonce: 4jFdpO
+.. section: Library
+
+Fix substitution of :class:`~typing.ParamSpec` in
+:data:`~typing.Concatenate` with different parameter expressions.
+Substitution with a list of types returns now a tuple of types. Substitution
+with ``Concatenate`` returns now a ``Concatenate`` with concatenated lists
+of arguments.
+
+..
+
+.. bpo: 14156
+.. date: 2019-05-07-14-25-45
+.. nonce: 0FaHXE
+.. section: Library
+
+argparse.FileType now supports an argument of '-' in binary mode, returning
+the .buffer attribute of sys.stdin/sys.stdout as appropriate. Modes
+including 'x' and 'a' are treated equivalently to 'w' when argument is '-'.
+Patch contributed by Josh Rosenberg
+
+..
+
+.. bpo: 46463
+.. date: 2022-01-21-21-33-48
+.. nonce: fBbdTG
+.. section: Documentation
+
+Fixes :file:`escape4chm.py` script used when building the CHM documentation
+file
+
+..
+
+.. bpo: 46913
+.. date: 2022-03-03-17-36-24
+.. nonce: vxETIE
+.. section: Tests
+
+Fix test_faulthandler.test_sigfpe() if Python is built with undefined
+behavior sanitizer (UBSAN): disable UBSAN on the faulthandler_sigfpe()
+function. Patch by Victor Stinner.
+
+..
+
+.. bpo: 46708
+.. date: 2022-02-10-14-33-47
+.. nonce: avLfCb
+.. section: Tests
+
+Prevent default asyncio event loop policy modification warning after
+``test_asyncio`` execution.
+
+..
+
+.. bpo: 46678
+.. date: 2022-02-07-12-40-45
+.. nonce: zfOrgL
+.. section: Tests
+
+The function ``make_legacy_pyc`` in ``Lib/test/support/import_helper.py`` no
+longer fails when ``PYTHONPYCACHEPREFIX`` is set to a directory on a
+different device from where tempfiles are stored.
+
+..
+
+.. bpo: 46616
+.. date: 2022-02-02-18-14-38
+.. nonce: URvBtE
+.. section: Tests
+
+Ensures ``test_importlib.test_windows`` cleans up registry keys after
+completion.
+
+..
+
+.. bpo: 44359
+.. date: 2022-02-02-02-24-04
+.. nonce: kPPSmN
+.. section: Tests
+
+test_ftplib now silently ignores socket errors to prevent logging unhandled
+threading exceptions. Patch by Victor Stinner.
+
+..
+
+.. bpo: 46542
+.. date: 2022-01-31-17-34-13
+.. nonce: RTMm1T
+.. section: Tests
+
+Fix a Python crash in test_lib2to3 when using Python built in debug mode:
+limit the recursion limit. Patch by Victor Stinner.
+
+..
+
+.. bpo: 46576
+.. date: 2022-01-29-12-37-53
+.. nonce: -prRaV
+.. section: Tests
+
+test_peg_generator now disables compiler optimization when testing
+compilation of its own C extensions to significantly speed up the testing on
+non-debug builds of CPython.
+
+..
+
+.. bpo: 46542
+.. date: 2022-01-28-01-17-10
+.. nonce: xRLTdj
+.. section: Tests
+
+Fix ``test_json`` tests checking for :exc:`RecursionError`: modify these
+tests to use ``support.infinite_recursion()``. Patch by Victor Stinner.
+
+..
+
+.. bpo: 13886
+.. date: 2022-01-17-13-10-04
+.. nonce: 5mZH4b
+.. section: Tests
+
+Skip test_builtin PTY tests on non-ASCII characters if the readline module
+is loaded. The readline module changes input() behavior, but test_builtin is
+not intented to test the readline module. Patch by Victor Stinner.
+
+..
+
+.. bpo: 47032
+.. date: 2022-03-16-00-37-40
+.. nonce: tsS9KE
+.. section: Build
+
+Ensure Windows install builds fail correctly with a non-zero exit code when
+part of the build fails.
+
+..
+
+.. bpo: 47024
+.. date: 2022-03-15-09-28-55
+.. nonce: t7-dcu
+.. section: Build
+
+Update OpenSSL to 1.1.1n for macOS installers and all Windows builds.
+
+..
+
+.. bpo: 38472
+.. date: 2022-01-26-22-59-12
+.. nonce: RxfLho
+.. section: Build
+
+Fix GCC detection in setup.py when cross-compiling. The C compiler is now
+run with LC_ALL=C. Previously, the detection failed with a German locale.
+
+..
+
+.. bpo: 46513
+.. date: 2022-01-25-12-32-37
+.. nonce: mPm9B4
+.. section: Build
+
+:program:`configure` no longer uses ``AC_C_CHAR_UNSIGNED`` macro and
+``pyconfig.h`` no longer defines reserved symbol ``__CHAR_UNSIGNED__``.
+
+..
+
+.. bpo: 45925
+.. date: 2022-01-08-12-43-31
+.. nonce: 38F3NO
+.. section: Build
+
+Update Windows installer to use SQLite 3.37.2.
+
+..
+
+.. bpo: 44549
+.. date: 2022-03-07-17-46-40
+.. nonce: SPrGS9
+.. section: Windows
+
+Update bzip2 to 1.0.8 in Windows builds to mitigate CVE-2016-3189 and
+CVE-2019-12900
+
+..
+
+.. bpo: 46948
+.. date: 2022-03-07-16-34-11
+.. nonce: Ufd4tG
+.. section: Windows
+
+Prevent CVE-2022-26488 by ensuring the Add to PATH option in the Windows
+installer uses the correct path when being repaired.
+
+..
+
+.. bpo: 46638
+.. date: 2022-02-04-18-02-33
+.. nonce: mSJOSX
+.. section: Windows
+
+Ensures registry virtualization is consistently disabled. For 3.10 and
+earlier, it remains enabled (some registry writes are protected), while for
+3.11 and later it is disabled (registry modifications affect all
+applications).
+
+..
+
+.. bpo: 45925
+.. date: 2022-01-26-12-04-09
+.. nonce: yBSiYO
+.. section: macOS
+
+Update macOS installer to SQLite 3.37.2.
+
+..
+
+.. bpo: 46630
+.. date: 2022-02-03-15-47-53
+.. nonce: tREOjo
+.. section: IDLE
+
+Make query dialogs on Windows start with a cursor in the entry box.
+
+..
+
+.. bpo: 45296
+.. date: 2022-01-26-19-33-55
+.. nonce: LzZKdU
+.. section: IDLE
+
+Clarify close, quit, and exit in IDLE.  In the File menu, 'Close' and 'Exit'
+are now 'Close Window' (the current one) and 'Exit' is now 'Exit IDLE' (by
+closing all windows).  In Shell, 'quit()' and 'exit()' mean 'close Shell'.
+If there are no other windows, this also exits IDLE.
+
+..
+
+.. bpo: 45447
+.. date: 2021-10-14-16-55-03
+.. nonce: FhiH5P
+.. section: IDLE
+
+Apply IDLE syntax highlighting to `.pyi` files. Patch by Alex Waygood and
+Terry Jan Reedy.
+
+..
+
+.. bpo: 46433
+.. date: 2022-01-19-16-51-54
+.. nonce: Er9ApS
+.. section: C API
+
+The internal function _PyType_GetModuleByDef now correctly handles
+inheritance patterns involving static types.
+
+..
+
+.. bpo: 14916
+.. date: 2020-09-11-02-50-41
+.. nonce: QN1Y03
+.. section: C API
+
+Fixed bug in the tokenizer that prevented ``PyRun_InteractiveOne`` from
+parsing from the provided FD.
diff --git a/Misc/NEWS.d/3.5.0a1.rst b/Misc/NEWS.d/3.5.0a1.rst
index 56d0d33..97bdef6 100644
--- a/Misc/NEWS.d/3.5.0a1.rst
+++ b/Misc/NEWS.d/3.5.0a1.rst
@@ -2234,7 +2234,7 @@
 .. section: Library
 
 Lax cookie parsing in http.cookies could be a security issue when combined
-with non-standard cookie handling in some Web browsers.  Reported by Sergey
+with non-standard cookie handling in some web browsers.  Reported by Sergey
 Bobrov.
 
 ..
@@ -2648,7 +2648,7 @@
 .. nonce: THJSYB
 .. section: Library
 
-Changed FeedParser feed() to avoid O(N**2) behavior when parsing long line.
+Changed FeedParser feed() to avoid O(N\ :sup:`2`) behavior when parsing long line.
 Original patch by Raymond Hettinger.
 
 ..
diff --git a/Misc/NEWS.d/3.6.4rc1.rst b/Misc/NEWS.d/3.6.4rc1.rst
index 36dfadd..dc9ab7a 100644
--- a/Misc/NEWS.d/3.6.4rc1.rst
+++ b/Misc/NEWS.d/3.6.4rc1.rst
@@ -22,7 +22,7 @@
 Setting sys.tracebacklimit to None now causes using the default limit.
 Setting sys.tracebacklimit to an integer larger than LONG_MAX now means using
 the limit LONG_MAX rather than the default limit.
-Fixed integer overflows in the case of more than 2**31 traceback items on
+Fixed integer overflows in the case of more than ``2**31`` traceback items on
 Windows.
 Fixed output errors handling.
 
diff --git a/Misc/NEWS.d/3.7.0a3.rst b/Misc/NEWS.d/3.7.0a3.rst
index 8ef7a51..067720e 100644
--- a/Misc/NEWS.d/3.7.0a3.rst
+++ b/Misc/NEWS.d/3.7.0a3.rst
@@ -100,7 +100,7 @@
 Setting sys.tracebacklimit to None now causes using the default limit.
 Setting sys.tracebacklimit to an integer larger than LONG_MAX now means using
 the limit LONG_MAX rather than the default limit.
-Fixed integer overflows in the case of more than 2**31 traceback items on
+Fixed integer overflows in the case of more than ``2**31`` traceback items on
 Windows.
 Fixed output errors handling.
 
diff --git a/Misc/NEWS.d/3.8.0a1.rst b/Misc/NEWS.d/3.8.0a1.rst
index b7164a5..5cd3fa3 100644
--- a/Misc/NEWS.d/3.8.0a1.rst
+++ b/Misc/NEWS.d/3.8.0a1.rst
@@ -1784,7 +1784,7 @@
 .. nonce: Q0ktFC
 .. section: Library
 
-An ExitStack is now used internally within subprocess.POpen to clean up pipe
+An ExitStack is now used internally within subprocess.Popen to clean up pipe
 file handles. No behavior change in normal operation. But if closing one
 handle were ever to cause an exception, the others will now be closed
 instead of leaked.  (patch by Giampaolo Rodola)
@@ -3355,7 +3355,7 @@
 
 On Windows, fix multiprocessing.Connection for very large read: fix
 _winapi.PeekNamedPipe() and _winapi.ReadFile() for read larger than INT_MAX
-(usually 2^31-1).
+(usually ``2**31-1``).
 
 ..
 
diff --git a/Misc/NEWS.d/3.8.0b1.rst b/Misc/NEWS.d/3.8.0b1.rst
index 5400c07..5285770 100644
--- a/Misc/NEWS.d/3.8.0b1.rst
+++ b/Misc/NEWS.d/3.8.0b1.rst
@@ -568,7 +568,7 @@
 .. section: Library
 
 Change default *max_workers* of ``ThreadPoolExecutor`` from ``cpu_count() *
-5`` to ``min(32, cpu_count() + 4))``.  Previous value was unreasonably large
+5`` to ``min(32, cpu_count() + 4)``.  Previous value was unreasonably large
 on many cores machines.
 
 ..
diff --git a/Misc/NEWS.d/3.9.0.rst b/Misc/NEWS.d/3.9.0.rst
deleted file mode 100644
index 5358b01..0000000
--- a/Misc/NEWS.d/3.9.0.rst
+++ /dev/null
@@ -1,57 +0,0 @@
-.. bpo: 41815
-.. date: 2020-09-19-23-14-54
-.. nonce: RNpuX3
-.. release date: 2020-10-04
-.. section: Library
-
-Fix SQLite3 segfault when backing up closed database. Patch contributed by
-Peter David McCormick.
-
-..
-
-.. bpo: 41662
-.. date: 2020-08-30-21-38-57
-.. nonce: 6e9iZn
-.. section: Library
-
-No longer override exceptions raised in ``__len__()`` of a sequence of
-parameters in :mod:`sqlite3` with :exc:`~sqlite3.ProgrammingError`.
-
-..
-
-.. bpo: 41662
-.. date: 2020-08-29-16-07-36
-.. nonce: Mn79zh
-.. section: Library
-
-Fixed crash when mutate list of parameters during iteration in
-:mod:`sqlite3`.
-
-..
-
-.. bpo: 39728
-.. date: 2020-02-24-10-58-34
-.. nonce: kOOaHn
-.. section: Library
-
-fix default `_missing_` so a duplicate `ValueError` is not set as the
-`__context__` of the original `ValueError`
-
-..
-
-.. bpo: 41602
-.. date: 2020-08-25-19-25-36
-.. nonce: Z64s0I
-.. section: Tests
-
-Add tests for SIGINT handling in the runpy module.
-
-..
-
-.. bpo: 38249
-.. date: 2020-09-28-21-56-51
-.. nonce: uzMCaZ
-.. section: Build
-
-Update :c:macro:`Py_UNREACHABLE` to use __builtin_unreachable() if only the
-compiler is able to use it. Patch by Dong-hee Na.
diff --git a/Misc/NEWS.d/3.9.0a1.rst b/Misc/NEWS.d/3.9.0a1.rst
index fe9fc58..a9b6694 100644
--- a/Misc/NEWS.d/3.9.0a1.rst
+++ b/Misc/NEWS.d/3.9.0a1.rst
@@ -213,7 +213,7 @@
 .. section: Core and Builtins
 
 :class:`bytearray`, :class:`~array.array` and :class:`~mmap.mmap` objects
-allow now to export more than 2**31 buffers at a time.
+allow now to export more than ``2**31`` buffers at a time.
 
 ..
 
@@ -279,7 +279,7 @@
 .. nonce: Xgc6F_
 .. section: Core and Builtins
 
-Remove unecessary intersection and update set operation in dictview with
+Remove unnecessary intersection and update set operation in dictview with
 empty set. (Contributed by Dong-hee Na in :issue:`38210`.)
 
 ..
@@ -868,7 +868,7 @@
 .. nonce: WJkgKV
 .. section: Core and Builtins
 
-Remove an unnecssary Py_XINCREF in classobject.c.
+Remove an unnecessary Py_XINCREF in classobject.c.
 
 ..
 
@@ -1224,7 +1224,7 @@
 .. nonce: cyq5nr
 .. section: Library
 
-Now :func:`~logging.config.fileConfig` correcty sets the .name of handlers
+Now :func:`~logging.config.fileConfig` correctly sets the .name of handlers
 loaded.
 
 ..
@@ -1637,7 +1637,7 @@
 .. nonce: nHAbuJ
 .. section: Library
 
-Names of hashing algorithms frome OpenSSL are now normalized to follow
+Names of hashing algorithms from OpenSSL are now normalized to follow
 Python's naming conventions. For example OpenSSL uses sha3-512 instead of
 sha3_512 or blake2b512 instead of blake2b.
 
@@ -2403,7 +2403,7 @@
 .. nonce: 7UV5d0
 .. section: Library
 
-Syncronize ``importlib.metadata`` with `importlib_metadata 0.19
+Synchronize ``importlib.metadata`` with `importlib_metadata 0.19
 <https://gitlab.com/python-devs/importlib_metadata/-/milestones/20>`_,
 improving handling of EGG-INFO files and fixing a crash when entry point
 names contained colons.
@@ -3002,7 +3002,7 @@
 
 In a subinterpreter, spawning a daemon thread now raises an exception.
 Daemon threads were never supported in subinterpreters. Previously, the
-subinterpreter finalization crashed with a Pyton fatal error if a daemon
+subinterpreter finalization crashed with a Python fatal error if a daemon
 thread was still running.
 
 ..
@@ -3065,7 +3065,7 @@
 .. section: Library
 
 :class:`_pyio.IOBase` destructor now does nothing if getting the ``closed``
-attribute fails to better mimick :class:`_io.IOBase` finalizer.
+attribute fails to better mimic :class:`_io.IOBase` finalizer.
 
 ..
 
@@ -4038,7 +4038,7 @@
 .. nonce: _x-9uH
 .. section: Tests
 
-test.support now has a helper function to check for availibility of a hash
+test.support now has a helper function to check for availability of a hash
 digest function. Several tests are refactored avoid MD5 and use SHA256
 instead. Other tests are marked to use MD5 and skipped when MD5 is disabled.
 
diff --git a/Misc/NEWS.d/3.9.0a3.rst b/Misc/NEWS.d/3.9.0a3.rst
index 6c71d7e..77ccc74 100644
--- a/Misc/NEWS.d/3.9.0a3.rst
+++ b/Misc/NEWS.d/3.9.0a3.rst
@@ -178,7 +178,7 @@
 .. nonce: WG9alt
 .. section: Core and Builtins
 
-Fix incorrent line execution reporting in trace functions when tracing
+Fix incorrect line execution reporting in trace functions when tracing
 exception handlers with name binding. Patch by Pablo Galindo.
 
 ..
@@ -685,7 +685,7 @@
 .. section: Library
 
 Fixed __subclasshook__ of :class:`os.PathLike` to return a correct result
-upon inheritence. Patch by Bar Harel.
+upon inheritance. Patch by Bar Harel.
 
 ..
 
diff --git a/Misc/NEWS.d/3.9.0a4.rst b/Misc/NEWS.d/3.9.0a4.rst
index e91135d..2aef8b2 100644
--- a/Misc/NEWS.d/3.9.0a4.rst
+++ b/Misc/NEWS.d/3.9.0a4.rst
@@ -640,7 +640,7 @@
 .. nonce: CCtzy1
 .. section: Documentation
 
-Updated documentation of ``total`` flag of TypeDict.
+Updated documentation of ``total`` flag of ``TypedDict``.
 
 ..
 
diff --git a/Misc/NEWS.d/3.9.0a5.rst b/Misc/NEWS.d/3.9.0a5.rst
index ede281b..49a118a 100644
--- a/Misc/NEWS.d/3.9.0a5.rst
+++ b/Misc/NEWS.d/3.9.0a5.rst
@@ -175,8 +175,8 @@
 .. nonce: FE9S21
 .. section: Core and Builtins
 
-Chaged list overallocation strategy. It no longer overallocates if the new
-size is closer to overalocated size than to the old size and adds padding.
+Changed list overallocation strategy. It no longer overallocates if the new
+size is closer to overallocated size than to the old size and adds padding.
 
 ..
 
diff --git a/Misc/NEWS.d/3.9.0b2.rst b/Misc/NEWS.d/3.9.0b2.rst
deleted file mode 100644
index 2aa6de3..0000000
--- a/Misc/NEWS.d/3.9.0b2.rst
+++ /dev/null
@@ -1,485 +0,0 @@
-.. bpo: 40904
-.. date: 2020-06-08-01-08-57
-.. nonce: 76qQzo
-.. release date: 2020-06-08
-.. section: Core and Builtins
-
-Fix possible segfault in the new PEG parser when parsing f-string containing
-yield statements with no value (:code:`f"{yield}"`). Patch by Pablo Galindo
-
-..
-
-.. bpo: 40903
-.. date: 2020-06-07-22-50-10
-.. nonce: 7dWejS
-.. section: Core and Builtins
-
-Fixed a possible segfault in the new PEG parser when producing error
-messages for invalid assignments of the form :code:`p=p=`. Patch by Pablo
-Galindo
-
-..
-
-.. bpo: 40880
-.. date: 2020-06-06-00-23-19
-.. nonce: fjdzSh
-.. section: Core and Builtins
-
-Fix invalid memory read in the new parser when checking newlines in string
-literals. Patch by Pablo Galindo.
-
-..
-
-.. bpo: 40883
-.. date: 2020-06-05-23-25-00
-.. nonce: M6sQ-Q
-.. section: Core and Builtins
-
-Fix memory leak in when parsing f-strings in the new parser. Patch by Pablo
-Galindo
-
-..
-
-.. bpo: 40870
-.. date: 2020-06-05-12-48-28
-.. nonce: 9cd2sk
-.. section: Core and Builtins
-
-Raise :exc:`ValueError` when validating custom AST's where the constants
-``True``, ``False`` and ``None`` are used within a :class:`ast.Name` node.
-
-..
-
-.. bpo: 40854
-.. date: 2020-06-03-13-53-24
-.. nonce: O6vfQU
-.. section: Core and Builtins
-
-Allow overriding :data:`sys.platlibdir` via a new :envvar:`PYTHONPLATLIBDIR`
-environment variable.
-
-..
-
-.. bpo: 40826
-.. date: 2020-06-01-20-31-07
-.. nonce: XCI4M2
-.. section: Core and Builtins
-
-Fix GIL usage in :c:func:`PyOS_Readline`: lock the GIL to set an exception
-and pass the Python thread state when checking if there is a pending signal.
-
-..
-
-.. bpo: 40780
-.. date: 2020-05-26-17-43-58
-.. nonce: 3Ckdgm
-.. section: Core and Builtins
-
-Fix a corner case where g-style string formatting of a float failed to
-remove trailing zeros.
-
-..
-
-.. bpo: 38964
-.. date: 2020-05-25-21-49-11
-.. nonce: lrml90
-.. section: Core and Builtins
-
-When there's a :exc:`SyntaxError` in the expression part of an fstring, the
-filename attribute of the :exc:`SyntaxError` gets correctly set to the name
-of the file the fstring resides in.
-
-..
-
-.. bpo: 40750
-.. date: 2020-05-24-02-42-26
-.. nonce: ZmO9Ev
-.. section: Core and Builtins
-
-Support the "-d" debug flag in the new PEG parser. Patch by Pablo Galindo
-
-..
-
-.. bpo: 40217
-.. date: 2020-05-23-01-15-51
-.. nonce: jZsHTc
-.. section: Core and Builtins
-
-Instances of types created with :c:func:`PyType_FromSpecWithBases` will no
-longer automatically visit their class object when traversing references in
-the garbage collector. The user is expected to manually visit the object's
-class. Patch by Pablo Galindo.
-
-..
-
-.. bpo: 40696
-.. date: 2020-05-21-01-54-00
-.. nonce: u3n8Wx
-.. section: Core and Builtins
-
-Fix a hang that can arise after :meth:`generator.throw` due to a cycle in
-the exception context chain.
-
-..
-
-.. bpo: 39791
-.. date: 2020-06-05-19-29-10
-.. nonce: _CcO3d
-.. section: Library
-
-Refresh importlib.metadata from importlib_metadata 1.6.1.
-
-..
-
-.. bpo: 40807
-.. date: 2020-06-04-16-25-15
-.. nonce: yYyLWx
-.. section: Library
-
-Stop codeop._maybe_compile, used by code.InteractiveInterpreter (and IDLE).
-from from emitting each warning three times.
-
-..
-
-.. bpo: 39791
-.. date: 2020-06-02-02-16-02
-.. nonce: StCJlA
-.. section: Library
-
-Built-in loaders (SourceFileLoader and ZipImporter) now supply
-``TraversableResources`` implementations for ``ResourceReader``, and the
-fallback function has been removed.
-
-..
-
-.. bpo: 17005
-.. date: 2020-05-31-23-32-36
-.. nonce: JlRUGB
-.. section: Library
-
-The topological sort functionality that was introduced initially in the
-:mod:`functools` module has been moved to a new :mod:`graphlib` module to
-better accommodate the new tools and keep the original scope of the
-:mod:`functools` module. Patch by Pablo Galindo
-
-..
-
-.. bpo: 40777
-.. date: 2020-05-28-17-32-29
-.. nonce: 1kJU6N
-.. section: Library
-
-Initialize PyDateTime_IsoCalendarDateType.tp_base at run-time to avoid
-errors on some compilers.
-
-..
-
-.. bpo: 40767
-.. date: 2020-05-27-21-27-01
-.. nonce: L5MnVV
-.. section: Library
-
-:mod:`webbrowser` now properly finds the default browser in pure Wayland
-systems by checking the WAYLAND_DISPLAY environment variable. Patch
-contributed by Jérémy Attali.
-
-..
-
-.. bpo: 40791
-.. date: 2020-05-27-18-04-52
-.. nonce: IzpNor
-.. section: Library
-
-:func:`hashlib.compare_digest` uses OpenSSL's ``CRYPTO_memcmp()`` function
-when OpenSSL is available.
-
-..
-
-.. bpo: 40795
-.. date: 2020-05-27-17-00-18
-.. nonce: eZSnHA
-.. section: Library
-
-:mod:`ctypes` module: If ctypes fails to convert the result of a callback or
-if a ctypes callback function raises an exception, sys.unraisablehook is now
-called with an exception set. Previously, the error was logged into stderr
-by :c:func:`PyErr_Print`.
-
-..
-
-.. bpo: 30008
-.. date: 2020-05-25-22-18-38
-.. nonce: CKC3td
-.. section: Library
-
-Fix :mod:`ssl` code to be compatible with OpenSSL 1.1.x builds that use
-``no-deprecated`` and ``--api=1.1.0``.
-
-..
-
-.. bpo: 30064
-.. date: 2020-05-25-11-52-23
-.. nonce: 6CICsH
-.. section: Library
-
-Fix asyncio ``loop.sock_*`` race condition issue
-
-..
-
-.. bpo: 40759
-.. date: 2020-05-24-23-52-35
-.. nonce: DdZdaw
-.. section: Library
-
-Deprecate the :mod:`symbol` module.
-
-..
-
-.. bpo: 40737
-.. date: 2020-05-23-00-22-11
-.. nonce: iph-CM
-.. section: Library
-
-Fix possible reference leak for :mod:`sqlite3` initialization.
-
-..
-
-.. bpo: 40698
-.. date: 2020-05-20-14-38-04
-.. nonce: zwl5Hc
-.. section: Library
-
-:mod:`distutils` upload creates SHA2-256 and Blake2b-256 digests. MD5
-digests is skipped if platform blocks MD5.
-
-..
-
-.. bpo: 40695
-.. date: 2020-05-20-13-03-28
-.. nonce: lr4aIS
-.. section: Library
-
-:mod:`hashlib` no longer falls back to builtin hash implementations when
-OpenSSL provides a hash digest and the algorithm is blocked by security
-policy.
-
-..
-
-.. bpo: 9216
-.. date: 2020-05-20-12-53-20
-.. nonce: ps7Yf1
-.. section: Library
-
-func:`hashlib.new` passed ``usedforsecurity`` to OpenSSL EVP constructor
-``_hashlib.new()``. test_hashlib and test_smtplib handle strict security
-policy better.
-
-..
-
-.. bpo: 40614
-.. date: 2020-05-18-22-41-02
-.. nonce: 8j3kmq
-.. section: Library
-
-:func:`ast.parse` will not parse self documenting expressions in f-strings
-when passed ``feature_version`` is less than ``(3, 8)``.
-
-..
-
-.. bpo: 40671
-.. date: 2020-05-18-15-26-31
-.. nonce: NeZ9Cy
-.. section: Library
-
-Prepare ``_hashlib`` for :pep:`489` and use :c:func:`PyModule_AddType`.
-
-..
-
-.. bpo: 32309
-.. date: 2020-05-17-02-03-09
-.. nonce: KM9psl
-.. section: Library
-
-Added a new :term:`coroutine` :func:`asyncio.to_thread`. It is mainly used
-for running IO-bound functions in a separate thread to avoid blocking the
-event loop, and essentially works as a high-level version of
-:meth:`~asyncio.loop.run_in_executor` that can directly take keyword
-arguments.
-
-..
-
-.. bpo: 40630
-.. date: 2020-05-15-13-40-15
-.. nonce: YXEX_M
-.. section: Library
-
-Added :func:`tracemalloc.reset_peak` to set the peak size of traced memory
-blocks to the current size, to measure the peak of specific pieces of code.
-
-..
-
-.. bpo: 13097
-.. date: 2020-05-06-02-01-25
-.. nonce: Wh5xSK
-.. section: Library
-
-``ctypes`` now raises an ``ArgumentError`` when a callback is invoked with
-more than 1024 arguments.
-
-..
-
-.. bpo: 23082
-.. date: 2020-04-20-22-08-36
-.. nonce: iX90Id
-.. section: Library
-
-Updated the error message and docs of PurePath.relative_to() to better
-reflect the function behaviour.
-
-..
-
-.. bpo: 39244
-.. date: 2020-02-23-15-09-47
-.. nonce: aBK5IM
-.. section: Library
-
-Fixed :class:`multiprocessing.context.get_all_start_methods` to properly
-return the default method first on macOS.
-
-..
-
-.. bpo: 39040
-.. date: 2019-12-15-18-47-20
-.. nonce: tKa0Qs
-.. section: Library
-
-Fix parsing of invalid mime headers parameters by collapsing whitespace
-between encoded words in a bare-quote-string.
-
-..
-
-.. bpo: 35714
-.. date: 2019-10-25-23-45-49
-.. nonce: fw3xb7
-.. section: Library
-
-:exc:`struct.error` is now raised if there is a null character in a
-:mod:`struct` format string.
-
-..
-
-.. bpo: 36290
-.. date: 2019-03-17-19-01-53
-.. nonce: 7VXo_K
-.. section: Library
-
-AST nodes are now raising :exc:`TypeError` on conflicting keyword arguments.
-Patch contributed by Rémi Lapeyre.
-
-..
-
-.. bpo: 17258
-.. date: 2020-05-26-07-53-31
-.. nonce: X_IKTQ
-.. section: Tests
-
-Skip some :mod:`multiprocessing` tests when MD5 hash digest is blocked.
-
-..
-
-.. bpo: 40514
-.. date: 2020-05-19-17-43-38
-.. nonce: gW-66U
-.. section: Build
-
-Remove ``--with-experimental-isolated-subinterpreters`` configure option in
-Python 3.9: the experiment continues in the master branch, but it's no
-longer needed in 3.9.
-
-..
-
-.. bpo: 40683
-.. date: 2020-05-19-10-54-08
-.. nonce: W8JHrr
-.. section: Build
-
-Fixed an issue where the :mod:`zoneinfo` module and its tests were not
-included when Python is installed with ``make``.
-
-..
-
-.. bpo: 39631
-.. date: 2020-05-19-14-43-33
-.. nonce: Z5yXam
-.. section: Windows
-
-Changes the registered MIME type for ``.py`` files on Windows to
-``text/x-python`` instead of ``text/plain``.
-
-..
-
-.. bpo: 40677
-.. date: 2020-05-19-04-11-12
-.. nonce: qQbLW8
-.. section: Windows
-
-Manually define IO_REPARSE_TAG_APPEXECLINK in case some old Windows SDK
-doesn't have it.
-
-..
-
-.. bpo: 40741
-.. date: 2020-06-07-20-10-56
-.. nonce: 80A2BW
-.. section: macOS
-
-Update macOS installer to use SQLite 3.32.2.
-
-..
-
-.. bpo: 39885
-.. date: 2020-05-29-18-21-58
-.. nonce: zB_-bN
-.. section: IDLE
-
-Make context menu Cut and Copy work again when right-clicking within a
-selection.
-
-..
-
-.. bpo: 40723
-.. date: 2020-05-24-06-19-43
-.. nonce: AJLd4U
-.. section: IDLE
-
-Make test_idle pass when run after import.
-
-..
-
-.. bpo: 40910
-.. date: 2020-06-08-15-59-06
-.. nonce: L56oI0
-.. section: C API
-
-Export explicitly the :c:func:`Py_GetArgcArgv` function to the C API and
-document the function. Previously, it was exported implicitly which no
-longer works since Python is built with ``-fvisibility=hidden``.
-
-..
-
-.. bpo: 40724
-.. date: 2020-06-04-08-01-23
-.. nonce: qIIdSi
-.. section: C API
-
-Allow defining buffer slots in type specs.
-
-..
-
-.. bpo: 40826
-.. date: 2020-06-01-16-12-37
-.. nonce: zQzFoK
-.. section: C API
-
-:c:func:`PyOS_InterruptOccurred` now fails with a fatal error if it is
-called with the GIL released.
diff --git a/Misc/NEWS.d/3.9.0b3.rst b/Misc/NEWS.d/3.9.0b3.rst
deleted file mode 100644
index f43243e..0000000
--- a/Misc/NEWS.d/3.9.0b3.rst
+++ /dev/null
@@ -1,20 +0,0 @@
-.. bpo: 40924
-.. date: 2020-06-09-18-59-34
-.. nonce: qR_YYG
-.. release date: 2020-06-09
-.. section: Library
-
-`importlib.resources`: Reverted ``TraversableResources`` implementations
-from the built-in loaders (SourceFileLoader and ZipImporter) as it was an
-incompatible change introduced in 3.9.0 beta 2 causing through a chain of
-events for root TLS certificates to be missing.
-
-..
-
-.. bpo: 40684
-.. date: 2020-06-08-19-57-05
-.. nonce: WIY2-i
-.. section: Build
-
-``make install`` now uses the ``PLATLIBDIR`` variable for the destination
-``lib-dynload/`` directory when ``./configure --with-platlibdir`` is used.
diff --git a/Misc/NEWS.d/3.9.0b4.rst b/Misc/NEWS.d/3.9.0b4.rst
deleted file mode 100644
index 95367a0..0000000
--- a/Misc/NEWS.d/3.9.0b4.rst
+++ /dev/null
@@ -1,600 +0,0 @@
-.. bpo: 41004
-.. date: 2020-06-29-16-02-29
-.. nonce: ovF0KZ
-.. release date: 2020-07-02
-.. section: Security
-
-The __hash__() methods of  ipaddress.IPv4Interface and
-ipaddress.IPv6Interface incorrectly generated constant hash values of 32 and
-128 respectively. This resulted in always causing hash collisions. The fix
-uses hash() to generate hash values for the tuple of (address, mask length,
-network address).
-
-..
-
-.. bpo: 41094
-.. date: 2020-06-23-23-26-42
-.. nonce: zEIJse
-.. section: Core and Builtins
-
-Fix decoding errors with audit when open files with non-ASCII names on
-non-UTF-8 locale.
-
-..
-
-.. bpo: 41084
-.. date: 2020-06-23-15-10-19
-.. nonce: pt3y7F
-.. section: Core and Builtins
-
-Prefix the error message with 'f-string: ', when parsing an f-string
-expression which throws a :exc:`SyntaxError`.
-
-..
-
-.. bpo: 41076
-.. date: 2020-06-22-13-22-30
-.. nonce: eWYw2N
-.. section: Core and Builtins
-
-Pre-feed the parser with the location of the f-string expression, not the
-f-string itself, which allows us to skip the shifting of the AST node
-locations after the parsing is completed.
-
-..
-
-.. bpo: 40939
-.. date: 2020-06-21-23-48-12
-.. nonce: RjLl6C
-.. section: Core and Builtins
-
-Deprecate :c:func:`PyNode_Compile`.
-
-..
-
-.. bpo: 41056
-.. date: 2020-06-21-19-53-33
-.. nonce: IDu_EK
-.. section: Core and Builtins
-
-Fixes a reference to deallocated stack space during startup when
-constructing sys.path involving a relative symlink when code was supplied
-via -c.  (discovered via Coverity)
-
-..
-
-.. bpo: 41061
-.. date: 2020-06-21-10-54-02
-.. nonce: AHf9MU
-.. section: Core and Builtins
-
-Fix incorrect expressions and asserts in hashtable code and tests.
-
-..
-
-.. bpo: 41052
-.. date: 2020-06-20-22-46-18
-.. nonce: 46MPeF
-.. section: Core and Builtins
-
-Opt out serialization/deserialization for _random.Random
-
-..
-
-.. bpo: 40939
-.. date: 2020-06-20-18-36-05
-.. nonce: V3eiAZ
-.. section: Core and Builtins
-
-Deprecate :c:func:`PyParser_SimpleParseStringFlags`,
-:c:func:`PyParser_SimpleParseStringFlagsFilename` and
-:c:func:`PyParser_SimpleParseFileFlags`.
-
-..
-
-.. bpo: 35975
-.. date: 2020-06-20-17-16-25
-.. nonce: UDHCHp
-.. section: Core and Builtins
-
-Stefan Behnel reported that cf_feature_version is used even when
-PyCF_ONLY_AST is not set. This is against the intention and against the
-documented behavior, so it's been fixed.
-
-..
-
-.. bpo: 40985
-.. date: 2020-06-15-16-29-55
-.. nonce: IIN_xX
-.. section: Core and Builtins
-
-Fix a bug that caused the :exc:`SyntaxError` text to be empty when a file
-ends with a line ending in a line continuation character (i.e. backslash).
-The error text should contain the text of the last line.
-
-..
-
-.. bpo: 40958
-.. date: 2020-06-15-01-20-44
-.. nonce: 7O2Wh1
-.. section: Core and Builtins
-
-Fix a possible buffer overflow in the PEG parser when gathering information
-for emitting syntax errors. Patch by Pablo Galindo.
-
-..
-
-.. bpo: 40957
-.. date: 2020-06-12-12-21-54
-.. nonce: Z8n6I6
-.. section: Core and Builtins
-
-Fix refleak in _Py_fopen_obj() when PySys_Audit() fails
-
-..
-
-.. bpo: 40947
-.. date: 2020-06-11-16-06-49
-.. nonce: 72cZcR
-.. section: Core and Builtins
-
-The Python :ref:`Path Configuration <init-path-config>` now takes
-:c:member:`PyConfig.platlibdir` in account.
-
-..
-
-.. bpo: 40847
-.. date: 2020-06-09-23-52-32
-.. nonce: 4XAACw
-.. section: Core and Builtins
-
-Fix a bug where a line with only a line continuation character is not
-considered a blank line at tokenizer level. In such cases, more than a
-single `NEWLINE` token was emitted. The old parser was working around the
-issue, but the new parser threw a :exc:`SyntaxError` for valid input due to
-this. For example, an empty line following a line continuation character was
-interpreted as a :exc:`SyntaxError`.
-
-..
-
-.. bpo: 40824
-.. date: 2020-05-30-14-37-18
-.. nonce: XR3V5s
-.. section: Core and Builtins
-
-Unexpected errors in calling the ``__iter__`` method are no longer masked by
-``TypeError`` in the :keyword:`in` operator and functions
-:func:`~operator.contains`, :func:`~operator.indexOf` and
-:func:`~operator.countOf` of the :mod:`operator` module.
-
-..
-
-.. bpo: 19569
-.. date: 2018-08-29-15-57-07
-.. nonce: RGu2Kb
-.. section: Core and Builtins
-
-Add the private macros ``_Py_COMP_DIAG_PUSH``,
-``_Py_COMP_DIAG_IGNORE_DEPR_DECLS``, and ``_Py_COMP_DIAG_POP``.
-
-..
-
-.. bpo: 41193
-.. date: 2020-07-02-11-53-45
-.. nonce: 8-Tnql
-.. section: Library
-
-The ``write_history()`` atexit function of the readline completer now
-ignores any :exc:`OSError` to ignore error if the filesystem is read-only,
-instead of only ignoring :exc:`FileNotFoundError` and
-:exc:`PermissionError`.
-
-..
-
-.. bpo: 41161
-.. date: 2020-06-30-20-50-51
-.. nonce: QTdJjz
-.. section: Library
-
-The decimal module now requires libmpdec-2.5.0. Users of
---with-system-libmpdec should update their system library.
-
-..
-
-.. bpo: 40874
-.. date: 2020-06-28-21-16-51
-.. nonce: YImvzA
-.. section: Library
-
-The decimal module now requires libmpdec-2.5.0.
-
-..
-
-.. bpo: 41138
-.. date: 2020-06-27-13-51-36
-.. nonce: bIpf7g
-.. section: Library
-
-Fixed the :mod:`trace` module CLI for Python source files with non-UTF-8
-encoding.
-
-..
-
-.. bpo: 31938
-.. date: 2020-06-22-20-08-40
-.. nonce: EVuko9
-.. section: Library
-
-Fix default-value signatures of several functions in the :mod:`select`
-module - by Anthony Sottile.
-
-..
-
-.. bpo: 41068
-.. date: 2020-06-22-10-25-39
-.. nonce: _bX2BW
-.. section: Library
-
-Fixed reading files with non-ASCII names from ZIP archive directly after
-writing them.
-
-..
-
-.. bpo: 41058
-.. date: 2020-06-20-21-03-55
-.. nonce: gztdZy
-.. section: Library
-
-:func:`pdb.find_function` now correctly determines the source file encoding.
-
-..
-
-.. bpo: 41056
-.. date: 2020-06-20-18-35-43
-.. nonce: Garcle
-.. section: Library
-
-Fix a NULL pointer dereference within the ssl module during a MemoryError in
-the keylog callback. (discovered by Coverity)
-
-..
-
-.. bpo: 41056
-.. date: 2020-06-20-18-33-03
-.. nonce: gTH4Bq
-.. section: Library
-
-Fixed an instance where a MemoryError within the zoneinfo module might not
-be reported or not reported at its source. (found by Coverity)
-
-..
-
-.. bpo: 41048
-.. date: 2020-06-20-10-16-57
-.. nonce: hEXB-B
-.. section: Library
-
-:func:`mimetypes.read_mime_types` function reads the rule file using UTF-8
-encoding, not the locale encoding. Patch by Srinivas Reddy Thatiparthy.
-
-..
-
-.. bpo: 41043
-.. date: 2020-06-20-00-19-30
-.. nonce: p-Pk-H
-.. section: Library
-
-Fixed the use of :func:`~glob.glob` in the stdlib: literal part of the path
-is now always correctly escaped.
-
-..
-
-.. bpo: 40448
-.. date: 2020-06-15-12-22-53
-.. nonce: 1dk8Bu
-.. section: Library
-
-:mod:`ensurepip` now disables the use of `pip` cache when installing the
-bundled versions of `pip` and `setuptools`.  Patch by Krzysztof Konopko.
-
-..
-
-.. bpo: 40967
-.. date: 2020-06-15-00-13-57
-.. nonce: _dx3OO
-.. section: Library
-
-Removed :meth:`asyncio.Task.current_task` and
-:meth:`asyncio.Task.all_tasks`. Patch contributed by Rémi Lapeyre.
-
-..
-
-.. bpo: 40955
-.. date: 2020-06-12-11-55-30
-.. nonce: huixCg
-.. section: Library
-
-Fix a minor memory leak in :mod:`subprocess` module when extra_groups was
-specified.
-
-..
-
-.. bpo: 40855
-.. date: 2020-06-12-10-44-15
-.. nonce: jSot83
-.. section: Library
-
-The standard deviation and variance functions in the statistics module were
-ignoring their mu and xbar arguments.
-
-..
-
-.. bpo: 40924
-.. date: 2020-06-11-23-41-50
-.. nonce: m17Fkm
-.. section: Library
-
-Removed support for loaders implementing .files and supplying
-TraversableResources.
-
-..
-
-.. bpo: 40939
-.. date: 2020-06-11-11-07-10
-.. nonce: -D5Asl
-.. section: Library
-
-Use the new PEG parser when generating the stdlib :mod:`keyword` module.
-
-..
-
-.. bpo: 40834
-.. date: 2020-05-31-15-52-18
-.. nonce: MO9_hb
-.. section: Library
-
-Fix truncate when sending str object with_xxsubinterpreters.channel_send.
-
-..
-
-.. bpo: 26407
-.. date: 2020-05-30-14-19-47
-.. nonce: MjWLO1
-.. section: Library
-
-Unexpected errors in calling the ``__iter__`` method are no longer masked by
-``TypeError`` in :func:`csv.reader`, :func:`csv.writer.writerow` and
-:meth:`csv.writer.writerows`.
-
-..
-
-.. bpo: 38488
-.. date: 2020-05-28-16-51-00
-.. nonce: hFQNgA
-.. section: Library
-
-Update ensurepip to install pip 20.1.1 and setuptools 47.1.0.
-
-..
-
-.. bpo: 36543
-.. date: 2020-05-15-21-14-45
-.. nonce: Jt-eSX
-.. section: Library
-
-Restored the deprecated :mod:`xml.etree.cElementTree` module.
-
-..
-
-.. bpo: 34226
-.. date: 2018-07-29-12-14-54
-.. nonce: BE7zbu
-.. section: Library
-
-Fix `cgi.parse_multipart` without content_length. Patch by Roger Duran
-
-..
-
-.. bpo: 41085
-.. date: 2020-06-23-12-02-45
-.. nonce: JZKsyz
-.. section: Tests
-
-Fix integer overflow in the :meth:`array.array.index` method on 64-bit
-Windows for index larger than ``2**31``.
-
-..
-
-.. bpo: 41069
-.. date: 2020-06-22-00-21-12
-.. nonce: bLZkX-
-.. section: Tests
-
-:data:`test.support.TESTFN` and the current directory for tests when run via
-``test.regrtest`` contain now non-ascii characters if possible.
-
-..
-
-.. bpo: 38377
-.. date: 2020-06-17-18-00-21
-.. nonce: jfg4TH
-.. section: Tests
-
-On Linux, skip tests using multiprocessing if the current user cannot create
-a file in ``/dev/shm/`` directory. Add the
-:func:`~test.support.skip_if_broken_multiprocessing_synchronize` function to
-the :mod:`test.support` module.
-
-..
-
-.. bpo: 41009
-.. date: 2020-06-17-17-27-07
-.. nonce: Rvn6OQ
-.. section: Tests
-
-Fix use of ``support.require_{linux|mac|freebsd}_version()`` decorators as
-class decorator.
-
-..
-
-.. bpo: 41003
-.. date: 2020-06-17-15-07-14
-.. nonce: tiH_Fy
-.. section: Tests
-
-Fix ``test_copyreg`` when ``numpy`` is installed: ``test.pickletester`` now
-saves/restores warnings filters when importing ``numpy``, to ignore filters
-installed by ``numpy``.
-
-..
-
-.. bpo: 40964
-.. date: 2020-06-12-20-46-23
-.. nonce: OBzf2c
-.. section: Tests
-
-Disable remote :mod:`imaplib` tests, host cyrus.andrew.cmu.edu is blocking
-incoming connections.
-
-..
-
-.. bpo: 40927
-.. date: 2020-06-09-18-48-18
-.. nonce: 67ylLg
-.. section: Tests
-
-Fix test_binhex when run twice: it now uses import_fresh_module() to ensure
-that it raises DeprecationWarning each time.
-
-..
-
-.. bpo: 34401
-.. date: 2018-08-20-09-38-52
-.. nonce: eGxMPm
-.. section: Tests
-
-Make test_gdb properly run on HP-UX. Patch by Michael Osipov.
-
-..
-
-.. bpo: 40204
-.. date: 2020-06-25-06-59-13
-.. nonce: GpD04D
-.. section: Build
-
-Pin Sphinx version to 2.3.1 in ``Doc/Makefile``.
-
-..
-
-.. bpo: 41074
-.. date: 2020-06-24-21-30-42
-.. nonce: gaQc3C
-.. section: Windows
-
-Fixed support of non-ASCII names in functions :func:`msilib.OpenDatabase`
-and :func:`msilib.init_database` and non-ASCII SQL in method
-:meth:`msilib.Database.OpenView`.
-
-..
-
-.. bpo: 40164
-.. date: 2020-06-12-13-13-44
-.. nonce: SPrSn5
-.. section: Windows
-
-Updates Windows OpenSSL to 1.1.1g
-
-..
-
-.. bpo: 37556
-.. date: 2019-07-11-06-11-09
-.. nonce: sygMUU
-.. section: Windows
-
-Extend py.exe help to mention overrides via venv, shebang, environmental
-variables & ini files.
-
-..
-
-.. bpo: 39580
-.. date: 2020-06-25-06-09-00
-.. nonce: N_vJ9h
-.. section: macOS
-
-Avoid opening Finder window if running installer from the command line.
-Patch contributed by Rick Heil.
-
-..
-
-.. bpo: 41100
-.. date: 2020-06-24-13-51-57
-.. nonce: mcHdc5
-.. section: macOS
-
-Fix configure error when building on macOS 11. Note that the current Python
-release was released shortly after the first developer preview of macOS 11
-(Big Sur); there are other known issues with building and running on the
-developer preview. Big Sur is expected to be fully supported in a future
-bugfix release of Python 3.8.x and with 3.9.0.
-
-..
-
-.. bpo: 41005
-.. date: 2020-06-17-13-45-15
-.. nonce: zZegdV
-.. section: macOS
-
-fixed an XDG settings issue not allowing macos to open browser in
-webbrowser.py
-
-..
-
-.. bpo: 41152
-.. date: 2020-06-29-14-51-15
-.. nonce: d6mV0C
-.. section: IDLE
-
-The encoding of ``stdin``, ``stdout`` and ``stderr`` in IDLE is now always
-UTF-8.
-
-..
-
-.. bpo: 41144
-.. date: 2020-06-27-17-02-00
-.. nonce: JoFGIX
-.. section: IDLE
-
-Make Open Module open a special module such as os.path.
-
-..
-
-.. bpo: 36346
-.. date: 2020-06-17-11-24-00
-.. nonce: fTMr3S
-.. section: C API
-
-Mark ``Py_UNICODE_COPY``, ``Py_UNICODE_FILL``, ``PyUnicode_WSTR_LENGTH``,
-``PyUnicode_FromUnicode``, ``PyUnicode_AsUnicode``,
-``_PyUnicode_AsUnicode``, and ``PyUnicode_AsUnicodeAndSize`` as deprecated
-in C. Remove ``Py_UNICODE_MATCH`` which was deprecated and broken since
-Python 3.3.
-
-..
-
-.. bpo: 36020
-.. date: 2020-06-15-16-46-01
-.. nonce: djI6jw
-.. section: C API
-
-On Windows, ``#include "pyerrors.h"`` no longer defines ``snprintf`` and
-``vsnprintf`` macros.
-
-..
-
-.. bpo: 40703
-.. date: 2020-05-20-19-11-12
-.. nonce: qQXfW8
-.. section: C API
-
-The PyType_FromSpec*() functions no longer overwrite the type's "__module__"
-attribute if it is set via "Py_tp_members" or "Py_tp_getset".
diff --git a/Misc/NEWS.d/3.9.0b5.rst b/Misc/NEWS.d/3.9.0b5.rst
deleted file mode 100644
index f870d83..0000000
--- a/Misc/NEWS.d/3.9.0b5.rst
+++ /dev/null
@@ -1,230 +0,0 @@
-.. bpo: 41304
-.. date: 2020-07-15-20-15-08
-.. nonce: vNEeYA
-.. release date: 2020-07-20
-.. section: Security
-
-Fixes `python3x._pth` being ignored on Windows, caused by the fix for
-:issue:`29778` (CVE-2020-15801).
-
-..
-
-.. bpo: 41162
-.. date: 2020-07-03-20-41-29
-.. nonce: tb8pVj
-.. section: Security
-
-Audit hooks are now cleared later during finalization to avoid missing
-events.
-
-..
-
-.. bpo: 29778
-.. date: 2020-07-03-17-21-37
-.. nonce: cR_fGS
-.. section: Security
-
-Ensure :file:`python3.dll` is loaded from correct locations when Python is
-embedded (CVE-2020-15523).
-
-..
-
-.. bpo: 39603
-.. date: 2020-02-12-14-17-39
-.. nonce: Gt3RSg
-.. section: Security
-
-Prevent http header injection by rejecting control characters in
-http.client.putrequest(...).
-
-..
-
-.. bpo: 41295
-.. date: 2020-07-18-08-15-32
-.. nonce: pu8Ezo
-.. section: Core and Builtins
-
-Resolve a regression in CPython 3.8.4 where defining "__setattr__" in a
-multi-inheritance setup and calling up the hierarchy chain could fail if
-builtins/extension types were involved in the base types.
-
-..
-
-.. bpo: 41247
-.. date: 2020-07-08-22-03-54
-.. nonce: PndYIk
-.. section: Core and Builtins
-
-Always cache the running loop holder when running
-``asyncio.set_running_loop``.
-
-..
-
-.. bpo: 41252
-.. date: 2020-07-08-21-55-23
-.. nonce: nBWL-Y
-.. section: Core and Builtins
-
-Fix incorrect refcounting in _ssl.c's ``_servername_callback()``.
-
-..
-
-.. bpo: 41215
-.. date: 2020-07-06-18-36-33
-.. nonce: vFGFIz
-.. section: Core and Builtins
-
-Use non-NULL default values in the PEG parser keyword list to overcome a bug
-that was preventing Python from being properly compiled when using the XLC
-compiler. Patch by Pablo Galindo.
-
-..
-
-.. bpo: 41218
-.. date: 2020-07-06-13-35-17
-.. nonce: oKnSr2
-.. section: Core and Builtins
-
-Python 3.8.3 had a regression where compiling with
-ast.PyCF_ALLOW_TOP_LEVEL_AWAIT would aggressively mark list comprehension
-with CO_COROUTINE. Now only list comprehension making use of async/await
-will tagged as so.
-
-..
-
-.. bpo: 41175
-.. date: 2020-06-30-20-17-31
-.. nonce: acJoXB
-.. section: Core and Builtins
-
-Guard against a NULL pointer dereference within bytearrayobject triggered by
-the ``bytearray() + bytearray()`` operation.
-
-..
-
-.. bpo: 39960
-.. date: 2020-06-23-18-32-41
-.. nonce: Kez3fP
-.. section: Core and Builtins
-
-The "hackcheck" that prevents sneaking around a type's __setattr__() by
-calling the superclass method was rewritten to allow C implemented heap
-types.
-
-..
-
-.. bpo: 41288
-.. date: 2020-07-13-15-06-35
-.. nonce: 8mn5P-
-.. section: Library
-
-Unpickling invalid NEWOBJ_EX opcode with the C implementation raises now
-UnpicklingError instead of crashing.
-
-..
-
-.. bpo: 39017
-.. date: 2020-07-12-22-16-58
-.. nonce: x3Cg-9
-.. section: Library
-
-Avoid infinite loop when reading specially crafted TAR files using the
-tarfile module (CVE-2019-20907).
-
-..
-
-.. bpo: 41235
-.. date: 2020-07-07-21-56-26
-.. nonce: H2csMU
-.. section: Library
-
-Fix the error handling in :meth:`ssl.SSLContext.load_dh_params`.
-
-..
-
-.. bpo: 41207
-.. date: 2020-07-06-16-58-53
-.. nonce: Emw7Nk
-.. section: Library
-
-In distutils.spawn, restore expectation that DistutilsExecError is raised
-when the command is not found.
-
-..
-
-.. bpo: 39168
-.. date: 2020-07-04-21-56-46
-.. nonce: DQWsXj
-.. section: Library
-
-Remove the ``__new__`` method of :class:`typing.Generic`.
-
-..
-
-.. bpo: 41194
-.. date: 2020-07-03-13-15-08
-.. nonce: djrKjs
-.. section: Library
-
-Fix a crash in the ``_ast`` module: it can no longer be loaded more than
-once. It now uses a global state rather than a module state.
-
-..
-
-.. bpo: 39384
-.. date: 2020-05-30-12-44-29
-.. nonce: Iqxy3q
-.. section: Library
-
-Fixed email.contentmanager to allow set_content() to set a null string.
-
-..
-
-.. bpo: 37703
-.. date: 2019-08-16-20-25-42
-.. nonce: Qm_l_H
-.. section: Documentation
-
-Updated Documentation to comprehensively elaborate on the behaviour of
-gather.cancel()
-
-..
-
-.. bpo: 40741
-.. date: 2020-06-19-14-19-08
-.. nonce: L7yTbm
-.. section: macOS
-
-Update macOS installer to use SQLite 3.32.3.
-
-..
-
-.. bpo: 41300
-.. date: 2020-07-16-17-39-06
-.. nonce: wRixNb
-.. section: IDLE
-
-Save files with non-ascii chars. Fix regression released in 3.9.0b4 and
-3.8.4.
-
-..
-
-.. bpo: 37765
-.. date: 2020-07-07-18-44-30
-.. nonce: umc1o8
-.. section: IDLE
-
-Add keywords to module name completion list.  Rewrite Completions section of
-IDLE doc.
-
-..
-
-.. bpo: 40170
-.. date: 2020-07-08-10-14-52
-.. nonce: N6Qx1i
-.. section: C API
-
-Revert :c:func:`PyType_HasFeature` change: it reads again directly the
-:c:member:`PyTypeObject.tp_flags` member when the limited C API is not used,
-rather than always calling :c:func:`PyType_GetFlags` which hides
-implementation details.
diff --git a/Misc/NEWS.d/3.9.0rc1.rst b/Misc/NEWS.d/3.9.0rc1.rst
deleted file mode 100644
index 667a6f9..0000000
--- a/Misc/NEWS.d/3.9.0rc1.rst
+++ /dev/null
@@ -1,187 +0,0 @@
-.. bpo: 38156
-.. date: 2020-07-20-17-01-17
-.. nonce: ptcdRy
-.. release date: 2020-08-11
-.. section: Core and Builtins
-
-Handle interrupts that come after EOF correctly in ``PyOS_StdioReadline``.
-
-..
-
-.. bpo: 41497
-.. date: 2020-08-07-06-06-29
-.. nonce: aBtsWz
-.. section: Library
-
-Fix potential UnicodeDecodeError in dis module.
-
-..
-
-.. bpo: 41490
-.. date: 2020-08-05-23-16-39
-.. nonce: 6z47A_
-.. section: Library
-
-Update :mod:`ensurepip` to install pip 20.2.1 and setuptools 49.2.1.
-
-..
-
-.. bpo: 41467
-.. date: 2020-08-04-00-20-30
-.. nonce: Z8DgTL
-.. section: Library
-
-On Windows, fix asyncio ``recv_into()`` return value when the socket/pipe is
-closed (:exc:`BrokenPipeError`): return ``0`` rather than an empty byte
-string (``b''``).
-
-..
-
-.. bpo: 41425
-.. date: 2020-08-03-01-59-48
-.. nonce: KJo6zF
-.. section: Library
-
-Make tkinter doc example runnable.
-
-..
-
-.. bpo: 41384
-.. date: 2020-07-26-21-18-43
-.. nonce: MlzIgV
-.. section: Library
-
-Raise TclError instead of TypeError when an unknown option is passed to
-tkinter.OptionMenu.
-
-..
-
-.. bpo: 38731
-.. date: 2020-07-25-23-18-51
-.. nonce: Am4wp2
-.. section: Library
-
-Fix :exc:`NameError` in command-line interface of :mod:`py_compile`.
-
-..
-
-.. bpo: 41317
-.. date: 2020-07-23-01-18-34
-.. nonce: O17Z6x
-.. section: Library
-
-Use add_done_callback() in asyncio.loop.sock_accept() to unsubscribe reader
-early on cancellation.
-
-..
-
-.. bpo: 41364
-.. date: 2020-07-21-21-45-55
-.. nonce: 5O-k7A
-.. section: Library
-
-Reduce import overhead of :mod:`uuid`.
-
-..
-
-.. bpo: 41341
-.. date: 2020-07-20-19-13-17
-.. nonce: wqrj8C
-.. section: Library
-
-Recursive evaluation of `typing.ForwardRef` in `get_type_hints`.
-
-..
-
-.. bpo: 41182
-.. date: 2020-07-01-17-33-50
-.. nonce: FPFI0N
-.. section: Library
-
-selector: use DefaultSelector based upon implementation
-
-..
-
-.. bpo: 40726
-.. date: 2020-05-22-12-45-58
-.. nonce: 7oBdMw
-.. section: Library
-
-Handle cases where the ``end_lineno`` is ``None`` on
-:func:`ast.increment_lineno`.
-
-..
-
-.. bpo: 41045
-.. date: 2020-07-27-20-46-17
-.. nonce: GFF6Ul
-.. section: Documentation
-
-Add documentation for debug feature of f-strings.
-
-..
-
-.. bpo: 41314
-.. date: 2020-07-25-14-20-00
-.. nonce: yrjko0
-.. section: Documentation
-
-Changed the release when ``from __future__ import annotations`` becomes the
-default from ``4.0`` to ``3.10`` (following a change in PEP 563).
-
-..
-
-.. bpo: 41492
-.. date: 2020-08-06-16-59-10
-.. nonce: 2FQ9cM
-.. section: Windows
-
-Fixes the description that appears in UAC prompts.
-
-..
-
-.. bpo: 40948
-.. date: 2020-07-28-12-39-32
-.. nonce: ISUFO6
-.. section: Windows
-
-Improve post-install message to direct people to the "py" command.
-
-..
-
-.. bpo: 41412
-.. date: 2020-07-28-11-55-43
-.. nonce: ME20KB
-.. section: Windows
-
-The installer will now fail to install on Windows 7 and Windows 8. Further,
-the UCRT dependency is now always downloaded on demand.
-
-..
-
-.. bpo: 40741
-.. date: 2020-07-20-23-26-26
-.. nonce: C9sc_d
-.. section: Windows
-
-Update Windows release to include SQLite 3.32.3.
-
-..
-
-.. bpo: 41468
-.. date: 2020-08-09-13-42-55
-.. nonce: zkP0_Y
-.. section: IDLE
-
-Improve IDLE run crash error message (which users should never see).
-
-..
-
-.. bpo: 41373
-.. date: 2020-07-24-17-49-58
-.. nonce: YQIPu_
-.. section: IDLE
-
-Save files loaded with no line ending, as when blank, or different line
-endings, by setting its line ending to the system default. Fix regression in
-3.8.4 and 3.9.0b4.
diff --git a/Misc/NEWS.d/3.9.0rc2.rst b/Misc/NEWS.d/3.9.0rc2.rst
deleted file mode 100644
index 3da8441..0000000
--- a/Misc/NEWS.d/3.9.0rc2.rst
+++ /dev/null
@@ -1,360 +0,0 @@
-.. bpo: 41780
-.. date: 2020-09-15-23-29-49
-.. nonce: bOBUIH
-.. release date: 2020-09-16
-.. section: Core and Builtins
-
-Fix :meth:`__dir__` of :class:`types.GenericAlias`. Patch by Batuhan
-Taskaya.
-
-..
-
-.. bpo: 41690
-.. date: 2020-09-02-12-00-57
-.. nonce: Ny-Sfy
-.. section: Core and Builtins
-
-Fix a possible stack overflow in the parser when parsing functions and
-classes with a huge ammount of arguments. Patch by Pablo Galindo.
-
-..
-
-.. bpo: 41681
-.. date: 2020-08-31-17-49-02
-.. nonce: 3-VJiH
-.. section: Core and Builtins
-
-Fixes the wrong error description in the error raised by using 2 `,` in
-format string in f-string and :meth:`str.format`.
-
-..
-
-.. bpo: 41654
-.. date: 2020-08-30-20-38-33
-.. nonce: HtnhAM
-.. section: Core and Builtins
-
-Fix a crash that occurred when destroying subclasses of
-:class:`MemoryError`. Patch by Pablo Galindo.
-
-..
-
-.. bpo: 41631
-.. date: 2020-08-26-11-23-31
-.. nonce: 3jZcd9
-.. section: Core and Builtins
-
-The ``_ast`` module uses again a global state. Using a module state per
-module instance is causing subtle practical problems. For example, the
-Mercurial project replaces the ``__import__()`` function to implement lazy
-import, whereas Python expected that ``import _ast`` always return a fully
-initialized ``_ast`` module.
-
-..
-
-.. bpo: 41533
-.. date: 2020-08-12-20-29-57
-.. nonce: 4pcVAc
-.. section: Core and Builtins
-
-Free the stack allocated in ``va_build_stack`` if ``do_mkstack`` fails and
-the stack is not a ``small_stack``.
-
-..
-
-.. bpo: 41531
-.. date: 2020-08-12-19-32-15
-.. nonce: WgPzjT
-.. section: Core and Builtins
-
-Fix a bug that was dropping keys when compiling dict literals with more than
-0xFFFF elements. Patch by Pablo Galindo.
-
-..
-
-.. bpo: 41525
-.. date: 2020-08-12-07-35-07
-.. nonce: d9q3XL
-.. section: Core and Builtins
-
-The output of ``python --help`` contains now only ASCII characters.
-
-..
-
-.. bpo: 29590
-.. date: 2020-05-03-22-26-00
-.. nonce: aRz3l7
-.. section: Core and Builtins
-
-Make the stack trace correct after calling :meth:`generator.throw` on a
-generator that has yielded from a ``yield from``.
-
-..
-
-.. bpo: 41517
-.. date: 2020-09-15-22-43-30
-.. nonce: sLBH7g
-.. section: Library
-
-fix bug allowing Enums to be extended via multiple inheritance
-
-..
-
-.. bpo: 39587
-.. date: 2020-09-15-14-56-13
-.. nonce: 69xzuh
-.. section: Library
-
-use the correct mix-in data type when constructing Enums
-
-..
-
-.. bpo: 41789
-.. date: 2020-09-14-19-27-46
-.. nonce: pI_uZQ
-.. section: Library
-
-Honor `object` overrides in `Enum` class creation (specifically, `__str__`,
-`__repr__`, `__format__`, and `__reduce_ex__`).
-
-..
-
-.. bpo: 39651
-.. date: 2020-09-11-12-38-55
-.. nonce: JMp9l2
-.. section: Library
-
-Fix a race condition in the ``call_soon_threadsafe()`` method of
-``asyncio.ProactorEventLoop``: do nothing if the self-pipe socket has been
-closed.
-
-..
-
-.. bpo: 41720
-.. date: 2020-09-04-20-45-38
-.. nonce: PW9MzZ
-.. section: Library
-
-Fixed :meth:`turtle.Vec2D.__rmul__` for arguments which are not int or
-float.
-
-..
-
-.. bpo: 41696
-.. date: 2020-09-03-01-35-32
-.. nonce: zkYGre
-.. section: Library
-
-Fix handling of debug mode in :func:`asyncio.run`. This allows setting
-``PYTHONASYNCIODEBUG`` or ``-X dev`` to enable asyncio debug mode when using
-:func:`asyncio.run`.
-
-..
-
-.. bpo: 41687
-.. date: 2020-09-01-15-57-51
-.. nonce: m1b1KA
-.. section: Library
-
-Fix implementation of sendfile to be compatible with Solaris.
-
-..
-
-.. bpo: 39010
-.. date: 2020-08-30-10-24-26
-.. nonce: _mzXJW
-.. section: Library
-
-Restarting a ``ProactorEventLoop`` on Windows no longer logs spurious
-``ConnectionResetErrors``.
-
-..
-
-.. bpo: 41609
-.. date: 2020-08-21-15-51-15
-.. nonce: JmiUKG
-.. section: Library
-
-The pdb whatis command correctly reports instance methods as 'Method' rather
-than 'Function'.
-
-..
-
-.. bpo: 32751
-.. date: 2020-08-15-15-50-12
-.. nonce: 85je5X
-.. section: Library
-
-When cancelling the task due to a timeout, :meth:`asyncio.wait_for` will now
-wait until the cancellation is complete also in the case when *timeout* is
-<= 0, like it does with positive timeouts.
-
-..
-
-.. bpo: 37658
-.. date: 2020-08-15-15-21-40
-.. nonce: f9nivB
-.. section: Library
-
-:meth:`asyncio.wait_for` now properly handles races between cancellation of
-itself and the completion of the wrapped awaitable.
-
-..
-
-.. bpo: 40782
-.. date: 2020-08-13-08-07-25
-.. nonce: aGZqmB
-.. section: Library
-
-Change the method asyncio.AbstractEventLoop.run_in_executor to not be a
-coroutine.
-
-..
-
-.. bpo: 41520
-.. date: 2020-08-12-13-25-16
-.. nonce: BEUWa4
-.. section: Library
-
-Fix :mod:`codeop` regression that prevented turning compile warnings into
-errors.
-
-..
-
-.. bpo: 41503
-.. date: 2020-08-07-15-18-16
-.. nonce: IYftcu
-.. section: Library
-
-Fixed a race between setTarget and flush in logging.handlers.MemoryHandler.
-
-..
-
-.. bpo: 41344
-.. date: 2020-07-20-13-27-48
-.. nonce: iKipNd
-.. section: Library
-
-Prevent creating :class:`shared_memory.SharedMemory` objects with
-:code:`size=0`.
-
-..
-
-.. bpo: 41025
-.. date: 2020-06-18-10-34-59
-.. nonce: elf_nz
-.. section: Library
-
-Fixed an issue preventing the C implementation of :class:`zoneinfo.ZoneInfo`
-from being subclassed.
-
-..
-
-.. bpo: 31122
-.. date: 2020-03-11-07-44-06
-.. nonce: zIQ80l
-.. section: Library
-
-ssl.wrap_socket() now raises ssl.SSLEOFError rather than OSError when peer
-closes connection during TLS negotiation
-
-..
-
-.. bpo: 33660
-.. date: 2018-06-12-23-30-41
-.. nonce: AdDn5Z
-.. section: Library
-
-Fix pathlib.PosixPath to resolve a relative path located on the root
-directory properly.
-
-..
-
-.. bpo: 37149
-.. date: 2020-09-10-07-48-02
-.. nonce: VD0rCv
-.. section: Documentation
-
-Change Shipman tkinter doc link from archive.org to TkDocs. (The doc has
-been removed from the NMT server.)  The new link responds much faster and
-includes a short explanatory note.
-
-..
-
-.. bpo: 41624
-.. date: 2020-08-25-15-11-23
-.. nonce: ddjJlN
-.. section: Documentation
-
-Fix the signature of :class:`typing.Coroutine`.
-
-..
-
-.. bpo: 40204
-.. date: 2020-08-12-18-35-40
-.. nonce: C8A_pe
-.. section: Documentation
-
-Enable Sphinx 3.2 ``c_allow_pre_v3`` option and disable
-``c_warn_on_allowed_pre_v3`` option to make the documentation compatible
-with Sphinx 2 and Sphinx 3.
-
-..
-
-.. bpo: 40979
-.. date: 2020-07-21-15-23-30
-.. nonce: pLA8rO
-.. section: Documentation
-
-Refactored typing.rst, arranging more than 70 classes, functions, and
-decorators into new sub-sections.
-
-..
-
-.. bpo: 39883
-.. date: 2020-03-07-03-53-39
-.. nonce: 1tnb4-
-.. section: Documentation
-
-Make code, examples, and recipes in the Python documentation be licensed
-under the more permissive BSD0 license in addition to the existing Python
-2.0 license.
-
-..
-
-.. bpo: 41731
-.. date: 2020-09-11-19-12-31
-.. nonce: Ivxh4U
-.. section: Tests
-
-Make test_cmd_line_script pass with option '-vv'.
-
-..
-
-.. bpo: 41617
-.. date: 2020-08-24-18-34-01
-.. nonce: sKKXz7
-.. section: Build
-
-Fix ``pycore_byteswap.h`` header file to support old clang versions:
-``__builtin_bswap16()`` is not available in LLVM clang 3.0.
-
-..
-
-.. bpo: 41526
-.. date: 2020-08-13-22-40-58
-.. nonce: -i2bwb
-.. section: Windows
-
-Fixed layout of final page of the installer by removing the special thanks
-to Mark Hammond (with his permission).
-
-..
-
-.. bpo: 41524
-.. date: 2020-08-12-17-09-06
-.. nonce: u6Xfr2
-.. section: C API
-
-Fix bug in PyOS_mystrnicmp and PyOS_mystricmp that incremented pointers
-beyond the end of a string.
diff --git a/Misc/NEWS.d/3.9.1.rst b/Misc/NEWS.d/3.9.1.rst
deleted file mode 100644
index 3942753..0000000
--- a/Misc/NEWS.d/3.9.1.rst
+++ /dev/null
@@ -1,150 +0,0 @@
-.. bpo: 42576
-.. date: 2020-12-05-22-34-47
-.. nonce: lEeEl7
-.. release date: 2020-12-07
-.. section: Core and Builtins
-
-``types.GenericAlias`` will now raise a ``TypeError`` when attempting to
-initialize with a keyword argument.  Previously, this would cause the
-interpreter to crash if the interpreter was compiled with debug symbols.
-This does not affect interpreters compiled for release.  Patch by Ken Jin.
-
-..
-
-.. bpo: 5054
-.. date: 2020-12-04-03-51-12
-.. nonce: 53StYZ
-.. section: Library
-
-CGIHTTPRequestHandler.run_cgi() HTTP_ACCEPT improperly parsed. Replace the
-special purpose getallmatchingheaders with generic get_all method and add
-relevant tests.
-
-Original Patch by Martin Panter. Modified by Senthil Kumaran.
-
-..
-
-.. bpo: 17735
-.. date: 2020-12-03-22-22-24
-.. nonce: Qsaaue
-.. section: Library
-
-:func:`inspect.findsource` now raises :exc:`OSError` instead of
-:exc:`IndexError` when :attr:`co_lineno` of a code object is greater than
-the file length. This can happen, for example, when a file is edited after
-it was imported.  PR by Irit Katriel.
-
-..
-
-.. bpo: 42116
-.. date: 2020-12-03-15-42-32
-.. nonce: yIwroP
-.. section: Library
-
-Fix handling of trailing comments by :func:`inspect.getsource`.
-
-..
-
-.. bpo: 42487
-.. date: 2020-11-28-04-31-20
-.. nonce: iqtC4L
-.. section: Library
-
-ChainMap.__iter__ no longer calls __getitem__ on underlying maps
-
-..
-
-.. bpo: 42482
-.. date: 2020-11-27-16-46-58
-.. nonce: EJC3sd
-.. section: Library
-
-:class:`~traceback.TracebackException` no longer holds a reference to the
-exception's traceback object. Consequently, instances of TracebackException
-for equivalent but non-equal exceptions now compare as equal.
-
-..
-
-.. bpo: 42406
-.. date: 2020-11-19-10-44-41
-.. nonce: r9rNCj
-.. section: Library
-
-We fixed an issue in `pickle.whichmodule` in which importing
-`multiprocessing` could change the how pickle identifies which module an
-object belongs to, potentially breaking the unpickling of those objects.
-
-..
-
-.. bpo: 34215
-.. date: 2020-08-19-20-17-51
-.. nonce: _Cv8c-
-.. section: Library
-
-Clarify the error message for :exc:`asyncio.IncompleteReadError` when
-``expected`` is ``None``.
-
-..
-
-.. bpo: 12800
-.. date: 2020-07-09-11-32-28
-.. nonce: fNgWwx
-.. section: Library
-
-Extracting a symlink from a tarball should succeed and overwrite the symlink
-if it already exists. The fix is to remove the existing file or symlink
-before extraction. Based on patch by Chris AtLee, Jeffrey Kintscher, and
-Senthil Kumaran.
-
-..
-
-.. bpo: 41473
-.. date: 2020-12-04-11-47-09
-.. nonce: W_updK
-.. section: Tests
-
-Reenable test_gdb on gdb 9.2 and newer:
-https://bugzilla.redhat.com/show_bug.cgi?id=1866884 bug is fixed in gdb
-10.1.
-
-..
-
-.. bpo: 42553
-.. date: 2020-12-03-13-32-44
-.. nonce: 2TRE2N
-.. section: Tests
-
-Fix ``test_asyncio.test_call_later()`` race condition: don't measure asyncio
-performance in the ``call_later()`` unit test. The test failed randomly on
-the CI.
-
-..
-
-.. bpo: 41116
-.. date: 2020-12-04-23-09-11
-.. nonce: mSbXyV
-.. section: macOS
-
-If no explicit macOS SDK was specified, setup.py should check for Tcl and TK
-frameworks in /Library/Frameworks; the previous commit inadvertently broke
-that test.
-
-..
-
-.. bpo: 42504
-.. date: 2020-12-02-15-48-40
-.. nonce: RQmMOR
-.. section: macOS
-
-Fix build on macOS Big Sur when MACOSX_DEPLOYMENT_TARGET=11
-
-..
-
-.. bpo: 42508
-.. date: 2020-11-30-19-46-05
-.. nonce: fE7w4M
-.. section: IDLE
-
-Keep IDLE running on macOS.  Remove obsolete workaround that prevented
-running files with shortcuts when using new universal2 installers built on
-macOS 11.
diff --git a/Misc/NEWS.d/3.9.1rc1.rst b/Misc/NEWS.d/3.9.1rc1.rst
deleted file mode 100644
index 0524f85..0000000
--- a/Misc/NEWS.d/3.9.1rc1.rst
+++ /dev/null
@@ -1,948 +0,0 @@
-.. bpo: 42103
-.. date: 2020-10-23-19-19-30
-.. nonce: cILT66
-.. release date: 2020-11-24
-.. section: Security
-
-Prevented potential DoS attack via CPU and RAM exhaustion when processing
-malformed Apple Property List files in binary format.
-
-..
-
-.. bpo: 42051
-.. date: 2020-10-19-10-56-27
-.. nonce: EU_B7u
-.. section: Security
-
-The :mod:`plistlib` module no longer accepts entity declarations in XML
-plist files to avoid XML vulnerabilities. This should not affect users as
-entity declarations are not used in regular plist files.
-
-..
-
-.. bpo: 40791
-.. date: 2020-05-28-06-06-47
-.. nonce: QGZClX
-.. section: Security
-
-Add ``volatile`` to the accumulator variable in ``hmac.compare_digest``,
-making constant-time-defeating optimizations less likely.
-
-..
-
-.. bpo: 41686
-.. date: 2020-11-17-16-25-50
-.. nonce: hX77kL
-.. section: Core and Builtins
-
-On Windows, the ``SIGINT`` event, ``_PyOS_SigintEvent()``, is now created
-even if Python is configured to not install signal handlers (if
-:c:member:`PyConfig.install_signal_handlers` equals to 0, or
-``Py_InitializeEx(0)``).
-
-..
-
-.. bpo: 42381
-.. date: 2020-11-16-23-45-56
-.. nonce: G4AWxL
-.. section: Core and Builtins
-
-Allow assignment expressions in set literals and set comprehensions as per
-PEP 572. Patch by Pablo Galindo.
-
-..
-
-.. bpo: 42374
-.. date: 2020-11-16-17-57-09
-.. nonce: t7np1E
-.. section: Core and Builtins
-
-Fix a regression introduced by the new parser, where an unparenthesized
-walrus operator was not allowed within generator expressions.
-
-..
-
-.. bpo: 42296
-.. date: 2020-11-13-13-53-11
-.. nonce: DuGrLJ
-.. section: Core and Builtins
-
-On Windows, fix a regression in signal handling which prevented to interrupt
-a program using CTRL+C. The signal handler can be run in a thread different
-than the Python thread, in which case the test deciding if the thread can
-handle signals is wrong.
-
-..
-
-.. bpo: 42332
-.. date: 2020-11-12-23-16-14
-.. nonce: fEQIdk
-.. section: Core and Builtins
-
-:class:`types.GenericAlias` objects can now be the targets of weakrefs.
-
-..
-
-.. bpo: 42218
-.. date: 2020-10-31-17-50-23
-.. nonce: Dp_Z3v
-.. section: Core and Builtins
-
-Fixed a bug in the PEG parser that was causing crashes in debug mode. Now
-errors are checked in left-recursive rules to avoid cases where such errors
-do not get handled in time and appear as long-distance crashes in other
-places.
-
-..
-
-.. bpo: 42214
-.. date: 2020-10-30-22-16-30
-.. nonce: lXskM_
-.. section: Core and Builtins
-
-Fixed a possible crash in the PEG parser when checking for the '!=' token in
-the ``barry_as_flufl`` rule. Patch by Pablo Galindo.
-
-..
-
-.. bpo: 42143
-.. date: 2020-10-27-21-34-05
-.. nonce: N6KXUO
-.. section: Core and Builtins
-
-Fix handling of errors during creation of ``PyFunctionObject``, which
-resulted in operations on uninitialized memory. Patch by Yonatan
-Goldschmidt.
-
-..
-
-.. bpo: 41659
-.. date: 2020-10-27-18-32-49
-.. nonce: d4a-8o
-.. section: Core and Builtins
-
-Fix a bug in the parser, where a curly brace following a `primary` didn't
-fail immediately. This led to invalid expressions like `a {b}` to throw a
-:exc:`SyntaxError` with a wrong offset, or invalid expressions ending with a
-curly brace like `a {` to not fail immediately in the REPL.
-
-..
-
-.. bpo: 42150
-.. date: 2020-10-25-21-14-18
-.. nonce: b70u_T
-.. section: Core and Builtins
-
-Fix possible buffer overflow in the new parser when checking for
-continuation lines. Patch by Pablo Galindo.
-
-..
-
-.. bpo: 42123
-.. date: 2020-10-23-02-43-24
-.. nonce: 64gJWC
-.. section: Core and Builtins
-
-Run the parser two times. On the first run, disable all the rules that only
-generate better error messages to gain performance. If there's a parse
-failure, run the parser a second time with those enabled.
-
-..
-
-.. bpo: 41910
-.. date: 2020-10-21-14-40-54
-.. nonce: CzBMit
-.. section: Core and Builtins
-
-Document the default implementation of `object.__eq__`.
-
-..
-
-.. bpo: 42057
-.. date: 2020-10-20-11-36-14
-.. nonce: BI-OoV
-.. section: Core and Builtins
-
-Fix peephole optimizer misoptimize conditional jump + JUMP_IF_NOT_EXC_MATCH
-pair.
-
-..
-
-.. bpo: 41984
-.. date: 2020-10-14-16-19-43
-.. nonce: SEtKMr
-.. section: Core and Builtins
-
-The garbage collector now tracks all user-defined classes. Patch by Brandt
-Bucher.
-
-..
-
-.. bpo: 41993
-.. date: 2020-10-10-13-53-52
-.. nonce: YMzixQ
-.. section: Core and Builtins
-
-Fixed potential issues with removing not completely initialized module from
-``sys.modules`` when import fails.
-
-..
-
-.. bpo: 41979
-.. date: 2020-10-09-10-55-50
-.. nonce: ImXIk2
-.. section: Core and Builtins
-
-Star-unpacking is now allowed for with item's targets in the PEG parser.
-
-..
-
-.. bpo: 41909
-.. date: 2020-10-04-10-55-12
-.. nonce: BqHPcm
-.. section: Core and Builtins
-
-Fixed stack overflow in :func:`issubclass` and :func:`isinstance` when
-getting the ``__bases__`` attribute leads to infinite recursion.
-
-..
-
-.. bpo: 41894
-.. date: 2020-10-02-11-35-33
-.. nonce: ffmtOt
-.. section: Core and Builtins
-
-When loading a native module and a load failure occurs, prevent a possible
-UnicodeDecodeError when not running in a UTF-8 locale by decoding the load
-error message using the current locale's encoding.
-
-..
-
-.. bpo: 39934
-.. date: 2020-09-24-12-15-45
-.. nonce: YVHTCF
-.. section: Core and Builtins
-
-Correctly count control blocks in 'except' in compiler. Ensures that a
-syntax error, rather a fatal error, occurs for deeply nested, named
-exception handlers.
-
-..
-
-.. bpo: 42328
-.. date: 2020-11-15-17-02-00
-.. nonce: bqpPlR
-.. section: Library
-
-Fixed :meth:`tkinter.ttk.Style.map`. The function accepts now the
-representation of the default state as empty sequence (as returned by
-``Style.map()``). The structure of the result is now the same on all
-platform and does not depend on the value of ``wantobjects``.
-
-..
-
-.. bpo: 42345
-.. date: 2020-11-15-15-23-34
-.. nonce: hiIR7x
-.. section: Library
-
-Fix various issues with ``typing.Literal`` parameter handling (flatten,
-deduplicate, use type to cache key). Patch provided by Yurii Karabas.
-
-..
-
-.. bpo: 42350
-.. date: 2020-11-13-18-53-50
-.. nonce: rsql7V
-.. section: Library
-
-Fix the :class:`threading.Thread` class at fork: do nothing if the thread is
-already stopped (ex: fork called at Python exit). Previously, an error was
-logged in the child process.
-
-..
-
-.. bpo: 42014
-.. date: 2020-11-10-15-40-56
-.. nonce: ShM37l
-.. section: Library
-
-The ``onerror`` callback from ``shutil.rmtree`` now receives correct
-function when ``os.open`` fails.
-
-..
-
-.. bpo: 42237
-.. date: 2020-11-10-14-27-49
-.. nonce: F363jO
-.. section: Library
-
-Fix `os.sendfile()` on illumos.
-
-..
-
-.. bpo: 42249
-.. date: 2020-11-03-09-22-56
-.. nonce: vfNO2u
-.. section: Library
-
-Fixed writing binary Plist files larger than 4 GiB.
-
-..
-
-.. bpo: 35455
-.. date: 2020-11-02-14-10-48
-.. nonce: Q1xTIo
-.. section: Library
-
-On Solaris, :func:`~time.thread_time` is now implemented with
-``gethrvtime()`` because ``clock_gettime(CLOCK_THREAD_CPUTIME_ID)`` is not
-always available. Patch by Jakub Kulik.
-
-..
-
-.. bpo: 42233
-.. date: 2020-11-02-01-31-15
-.. nonce: YxRj-h
-.. section: Library
-
-The :func:`repr` of :mod:`typing` types containing :ref:`Generic Alias Types
-<types-genericalias>` previously did not show the parameterized types in the
-``GenericAlias``.  They have now been changed to do so.
-
-..
-
-.. bpo: 41754
-.. date: 2020-11-01-15-07-20
-.. nonce: DraSZh
-.. section: Library
-
-webbrowser: Ignore *NotADirectoryError* when calling ``xdg-settings``.
-
-..
-
-.. bpo: 29566
-.. date: 2020-10-31-13-28-36
-.. nonce: 6aDbty
-.. section: Library
-
-``binhex.binhex()`` consisently writes macOS 9 line endings.
-
-..
-
-.. bpo: 42183
-.. date: 2020-10-29-11-17-35
-.. nonce: 50ZcIi
-.. section: Library
-
-Fix a stack overflow error for asyncio Task or Future repr().
-
-The overflow occurs under some circumstances when a Task or Future
-recursively returns itself.
-
-..
-
-.. bpo: 42146
-.. date: 2020-10-25-19-25-02
-.. nonce: 6A8uvS
-.. section: Library
-
-Fix memory leak in :func:`subprocess.Popen` in case an uid (gid) specified
-in `user` (`group`, `extra_groups`) overflows `uid_t` (`gid_t`).
-
-..
-
-.. bpo: 42140
-.. date: 2020-10-24-04-02-36
-.. nonce: miLqvb
-.. section: Library
-
-Improve asyncio.wait function to create the futures set just one time.
-
-..
-
-.. bpo: 42103
-.. date: 2020-10-23-19-20-14
-.. nonce: C5obK2
-.. section: Library
-
-:exc:`~plistlib.InvalidFileException` and :exc:`RecursionError` are now the
-only errors caused by loading malformed binary Plist file (previously
-ValueError and TypeError could be raised in some specific cases).
-
-..
-
-.. bpo: 41052
-.. date: 2020-10-21-23-45-02
-.. nonce: 3N7J2J
-.. section: Library
-
-Pickling heap types implemented in C with protocols 0 and 1 raises now an
-error instead of producing incorrect data.
-
-..
-
-.. bpo: 41491
-.. date: 2020-10-19-14-02-09
-.. nonce: d1BUWH
-.. section: Library
-
-plistlib: fix parsing XML plists with hexadecimal integer values
-
-..
-
-.. bpo: 42065
-.. date: 2020-10-17-23-17-18
-.. nonce: 85BsRA
-.. section: Library
-
-Fix an incorrectly formatted error from :meth:`_codecs.charmap_decode` when
-called with a mapped value outside the range of valid Unicode code points.
-PR by Max Bernstein.
-
-..
-
-.. bpo: 41966
-.. date: 2020-10-17-07-52-53
-.. nonce: gwEQRZ
-.. section: Library
-
-Fix pickling pure Python :class:`datetime.time` subclasses. Patch by Dean
-Inwood.
-
-..
-
-.. bpo: 41976
-.. date: 2020-10-08-18-22-28
-.. nonce: Svm0wb
-.. section: Library
-
-Fixed a bug that was causing :func:`ctypes.util.find_library` to return
-``None`` when triying to locate a library in an environment when gcc>=9 is
-available and ``ldconfig`` is not. Patch by Pablo Galindo
-
-..
-
-.. bpo: 41900
-.. date: 2020-10-01-10-50-12
-.. nonce: Cho7oh
-.. section: Library
-
-C14N 2.0 serialisation in xml.etree.ElementTree failed for unprefixed
-attributes when a default namespace was defined.
-
-..
-
-.. bpo: 41840
-.. date: 2020-09-23-23-17-59
-.. nonce: QRFr4L
-.. section: Library
-
-Fix a bug in the :mod:`symtable` module that was causing module-scope global
-variables to not be reported as both local and global. Patch by Pablo
-Galindo.
-
-..
-
-.. bpo: 41831
-.. date: 2020-09-22-11-07-50
-.. nonce: k-Eop_
-.. section: Library
-
-``str()`` for the ``type`` attribute of the ``tkinter.Event`` object always
-returns now the numeric code returned by Tk instead of the name of the event
-type.
-
-..
-
-.. bpo: 41817
-.. date: 2020-09-22-00-23-30
-.. nonce: bnh-VG
-.. section: Library
-
-fix `tkinter.EventType` Enum so all members are strings, and none are tuples
-
-..
-
-.. bpo: 41815
-.. date: 2020-09-19-23-14-54
-.. nonce: RNpuX3
-.. section: Library
-
-Fix SQLite3 segfault when backing up closed database. Patch contributed by
-Peter David McCormick.
-
-..
-
-.. bpo: 41316
-.. date: 2020-07-28-12-08-58
-.. nonce: bSCbK4
-.. section: Library
-
-Fix the :mod:`tarfile` module to write only basename of TAR file to GZIP
-compression header.
-
-..
-
-.. bpo: 16936
-.. date: 2020-07-08-09-45-00
-.. nonce: z8o8Pn
-.. section: Library
-
-Allow ``ctypes.wintypes`` to be imported on non-Windows systems.
-
-..
-
-.. bpo: 40592
-.. date: 2020-05-14-16-01-34
-.. nonce: Cmk855
-.. section: Library
-
-:func:`shutil.which` now ignores empty entries in :envvar:`PATHEXT` instead
-of treating them as a match.
-
-..
-
-.. bpo: 40550
-.. date: 2020-05-08-21-30-54
-.. nonce: i7GWkb
-.. section: Library
-
-Fix time-of-check/time-of-action issue in subprocess.Popen.send_signal.
-
-..
-
-.. bpo: 40492
-.. date: 2020-05-04-12-16-00
-.. nonce: ONk9Na
-.. section: Library
-
-Fix ``--outfile`` for :mod:`cProfile` / :mod:`profile` not writing the
-output file in the original directory when the program being profiled
-changes the working directory.  PR by Anthony Sottile.
-
-..
-
-.. bpo: 40105
-.. date: 2020-04-03-16-13-59
-.. nonce: hfM2c0
-.. section: Library
-
-ZipFile truncates files to avoid corruption when a shorter comment is
-provided in append ("a") mode. Patch by Jan Mazur.
-
-..
-
-.. bpo: 27321
-.. date: 2020-01-19-18-40-26
-.. nonce: 8e6SpM
-.. section: Library
-
-Fixed KeyError exception when flattening an email to a string attempts to
-replace a non-existent Content-Transfer-Encoding header.
-
-..
-
-.. bpo: 42153
-.. date: 2020-11-15-13-46-31
-.. nonce: KjBhx3
-.. section: Documentation
-
-Fix the URL for the IMAP protocol documents.
-
-..
-
-.. bpo: 42061
-.. date: 2020-10-28-21-39-45
-.. nonce: _x-0sg
-.. section: Documentation
-
-Document __format__ functionality for IP addresses.
-
-..
-
-.. bpo: 42010
-.. date: 2020-10-21-02-21-14
-.. nonce: 76vJ0u
-.. section: Documentation
-
-Clarify that subscription expressions are also valid for certain
-:term:`classes <class>` and :term:`types <type>` in the standard library,
-and for user-defined classes and types if the classmethod
-:meth:`__class_getitem__` is provided.
-
-..
-
-.. bpo: 41805
-.. date: 2020-10-10-01-36-37
-.. nonce: l-CGv5
-.. section: Documentation
-
-Documented :ref:`generic alias type <types-genericalias>` and
-:data:`types.GenericAlias`. Also added an entry in glossary for
-:term:`generic types <generic type>`.
-
-..
-
-.. bpo: 41774
-.. date: 2020-09-24-15-35-13
-.. nonce: 5IqdGP
-.. section: Documentation
-
-In Programming FAQ "Sequences (Tuples/Lists)" section, add "How do you
-remove multiple items from a list".
-
-..
-
-.. bpo: 35293
-.. date: 2020-09-12-17-37-13
-.. nonce: _cOwPD
-.. section: Documentation
-
-Fix RemovedInSphinx40Warning when building the documentation. Patch by
-Dong-hee Na.
-
-..
-
-.. bpo: 41726
-.. date: 2020-09-08-16-57-09
-.. nonce: g0UXrn
-.. section: Documentation
-
-Update the refcounts info of ``PyType_FromModuleAndSpec``.
-
-..
-
-.. bpo: 39693
-.. date: 2020-02-24-09-02-05
-.. nonce: QXw0Fm
-.. section: Documentation
-
-Fix tarfile's extractfile documentation
-
-..
-
-.. bpo: 39416
-.. date: 2020-01-22-05-14-53
-.. nonce: uYjhEm
-.. section: Documentation
-
-Document some restrictions on the default string representations of numeric
-classes.
-
-..
-
-.. bpo: 40754
-.. date: 2020-11-13-21-51-34
-.. nonce: Ekoxkg
-.. section: Tests
-
-Include ``_testinternalcapi`` module in Windows installer for test suite
-
-..
-
-.. bpo: 41739
-.. date: 2020-10-12-00-11-47
-.. nonce: wSCc4K
-.. section: Tests
-
-Fix test_logging.test_race_between_set_target_and_flush(): the test now
-waits until all threads complete to avoid leaking running threads.
-
-..
-
-.. bpo: 41970
-.. date: 2020-10-08-14-00-17
-.. nonce: aZ8QFf
-.. section: Tests
-
-Avoid a test failure in ``test_lib2to3`` if the module has already imported
-at the time the test executes. Patch by Pablo Galindo.
-
-..
-
-.. bpo: 41944
-.. date: 2020-10-05-17-43-46
-.. nonce: rf1dYb
-.. section: Tests
-
-Tests for CJK codecs no longer call ``eval()`` on content received via HTTP.
-
-..
-
-.. bpo: 41939
-.. date: 2020-10-05-09-37-43
-.. nonce: P4OlbA
-.. section: Tests
-
-Fix test_site.test_license_exists_at_url(): call
-``urllib.request.urlcleanup()`` to reset the global
-``urllib.request._opener``. Patch by Victor Stinner.
-
-..
-
-.. bpo: 41561
-.. date: 2020-09-18-16-14-03
-.. nonce: uPnwrW
-.. section: Tests
-
-test_ssl: skip test_min_max_version_mismatch when TLS 1.0 is not available
-
-..
-
-.. bpo: 41602
-.. date: 2020-08-25-19-25-36
-.. nonce: Z64s0I
-.. section: Tests
-
-Add tests for SIGINT handling in the runpy module.
-
-..
-
-.. bpo: 41306
-.. date: 2020-08-03-13-44-37
-.. nonce: VDoWXI
-.. section: Tests
-
-Fixed a failure in ``test_tk.test_widgets.ScaleTest`` happening when
-executing the test with Tk 8.6.10.
-
-..
-
-.. bpo: 42398
-.. date: 2020-11-18-11-58-44
-.. nonce: Yt5wO8
-.. section: Build
-
-Fix a race condition in "make regen-all" when make -jN option is used to run
-jobs in parallel. The clinic.py script now only use atomic write to write
-files. Moveover, generated files are now left unchanged if the content does
-not change, to not change the file modification time.
-
-..
-
-.. bpo: 41617
-.. date: 2020-11-13-15-04-53
-.. nonce: 98_oaE
-.. section: Build
-
-Fix building ``pycore_bitutils.h`` internal header on old clang version
-without ``__builtin_bswap16()`` (ex: Xcode 4.6.3 on Mac OS X 10.7). Patch by
-Joshua Root and Victor Stinner.
-
-..
-
-.. bpo: 38249
-.. date: 2020-09-28-21-56-51
-.. nonce: uzMCaZ
-.. section: Build
-
-Update :c:macro:`Py_UNREACHABLE` to use __builtin_unreachable() if only the
-compiler is able to use it. Patch by Dong-hee Na.
-
-..
-
-.. bpo: 40998
-.. date: 2020-06-17-09-05-02
-.. nonce: sgqmg9
-.. section: Build
-
-Addressed three compiler warnings found by undefined behavior sanitizer
-(ubsan).
-
-..
-
-.. bpo: 42120
-.. date: 2020-11-16-22-41-02
-.. nonce: 9scgko
-.. section: Windows
-
-Remove macro definition of ``copysign`` (to ``_copysign``) in headers.
-
-..
-
-.. bpo: 38439
-.. date: 2020-10-20-13-19-42
-.. nonce: eMLi-t
-.. section: Windows
-
-Updates the icons for IDLE in the Windows Store package.
-
-..
-
-.. bpo: 41744
-.. date: 2020-09-11-17-59-33
-.. nonce: e_ugDQ
-.. section: Windows
-
-Fixes automatic import of props file when using the Nuget package.
-
-..
-
-.. bpo: 41557
-.. date: 2020-08-26-09-35-06
-.. nonce: vt00cQ
-.. section: Windows
-
-Update Windows installer to use SQLite 3.33.0.
-
-..
-
-.. bpo: 38324
-.. date: 2020-05-30-02-46-43
-.. nonce: 476M-5
-.. section: Windows
-
-Avoid Unicode errors when accessing certain locale data on Windows.
-
-..
-
-.. bpo: 41116
-.. date: 2020-11-15-16-43-45
-.. nonce: oCkbrF
-.. section: macOS
-
-Ensure distutils.unixxcompiler.find_library_file can find system provided
-libraries on macOS 11.
-
-..
-
-.. bpo: 41100
-.. date: 2020-11-01-16-40-23
-.. nonce: BApztP
-.. section: macOS
-
-Add support for macOS 11 and Apple Silicon systems.
-
-It is now possible to build "Universal 2" binaries using
-"--enable-universalsdk --with-universal-archs=universal2".
-
-Binaries build on later macOS versions can be deployed back to older
-versions (tested up to macOS 10.9), when using the correct deployment
-target. This is tested using Xcode 11 and later.
-
-..
-
-.. bpo: 38443
-.. date: 2020-10-23-10-26-53
-.. nonce: vu64tl
-.. section: macOS
-
-The ``--enable-universalsdk`` and ``--with-universal-archs`` options for the
-configure script now check that the specified architectures can be used.
-
-..
-
-.. bpo: 41471
-.. date: 2020-10-19-12-25-19
-.. nonce: gwA7un
-.. section: macOS
-
-Ignore invalid prefix lengths in system proxy excludes.
-
-..
-
-.. bpo: 41557
-.. date: 2020-08-26-09-31-37
-.. nonce: mcQ75z
-.. section: macOS
-
-Update macOS installer to use SQLite 3.33.0.
-
-..
-
-.. bpo: 42426
-.. date: 2020-11-21-17-21-21
-.. nonce: kNnPoC
-.. section: IDLE
-
-Fix reporting offset of the RE error in searchengine.
-
-..
-
-.. bpo: 42415
-.. date: 2020-11-20-01-30-27
-.. nonce: CyD-va
-.. section: IDLE
-
-Get docstrings for IDLE calltips more often by using inspect.getdoc.
-
-..
-
-.. bpo: 33987
-.. date: 2020-10-24-21-27-37
-.. nonce: fIh9JL
-.. section: IDLE
-
-Mostly finish using ttk widgets, mainly for editor, settings, and searches.
-Some patches by Mark Roseman.
-
-..
-
-.. bpo: 41775
-.. date: 2020-09-24-14-31-16
-.. nonce: sB8Vre
-.. section: IDLE
-
-Use 'IDLE Shell' as shell title
-
-..
-
-.. bpo: 35764
-.. date: 2020-09-22-11-13-45
-.. nonce: VoNa8y
-.. section: IDLE
-
-Rewrite the Calltips doc section.
-
-..
-
-.. bpo: 40181
-.. date: 2020-09-22-00-45-40
-.. nonce: hhQi3z
-.. section: IDLE
-
-In calltips, stop reminding that '/' marks the end of positional-only
-arguments.
-
-..
-
-.. bpo: 40511
-.. date: 2020-06-16-12-16-13
-.. nonce: XkihpM
-.. section: IDLE
-
-Typing opening and closing parentheses inside the parentheses of a function
-call will no longer cause unnecessary "flashing" off and on of an existing
-open call-tip, e.g. when typed in a string literal.
-
-..
-
-.. bpo: 38439
-.. date: 2020-04-22-09-37-40
-.. nonce: ieXL-c
-.. section: IDLE
-
-Add a 256×256 pixel IDLE icon to the Windows .ico file. Created by Andrew
-Clover. Remove the low-color gif variations from the .ico file.
-
-..
-
-.. bpo: 42015
-.. date: 2020-10-12-20-13-58
-.. nonce: X4H2_V
-.. section: C API
-
-Fix potential crash in deallocating method objects when dynamically
-allocated `PyMethodDef`'s lifetime is managed through the ``self`` argument
-of a `PyCFunction`.
-
-..
-
-.. bpo: 41986
-.. date: 2020-10-09-22-50-46
-.. nonce: JUPE59
-.. section: C API
-
-:c:data:`Py_FileSystemDefaultEncodeErrors` and :c:data:`Py_UTF8Mode` are
-available again in limited API.
diff --git a/Misc/README.AIX b/Misc/README.AIX
index 92ad029..6903a81 100644
--- a/Misc/README.AIX
+++ b/Misc/README.AIX
@@ -37,11 +37,6 @@
 CC=xlc_r OPT="-O2 -qmaxmem=70000" ./configure --without-computed-gotos --enable-shared
 make
 
-Note:
-On AIX 5.3 and earlier, you will also need to specify the
-"--disable-ipv6" flag to configure. This has been corrected in AIX
-6.1.
-
 
 ======================================================================
 			  Memory Limitations
diff --git a/Misc/README.valgrind b/Misc/README.valgrind
index b483b2e..ee9bfdf 100644
--- a/Misc/README.valgrind
+++ b/Misc/README.valgrind
@@ -12,12 +12,9 @@
 If you don't want to read about the details of using Valgrind, there
 are still two things you must do to suppress the warnings.  First,
 you must use a suppressions file.  One is supplied in
-Misc/valgrind-python.supp.  Second, you must do one of the following:
-
-  * Uncomment Py_USING_MEMORY_DEBUGGER in Objects/obmalloc.c,
-    then rebuild Python
-  * Uncomment the lines in Misc/valgrind-python.supp that
-    suppress the warnings for PyObject_Free and PyObject_Realloc
+Misc/valgrind-python.supp.  Second, you must uncomment the lines in 
+Misc/valgrind-python.supp that suppress the warnings for PyObject_Free and
+PyObject_Realloc.
 
 If you want to use Valgrind more effectively and catch even more
 memory leaks, you will need to configure python --without-pymalloc.
diff --git a/Misc/SpecialBuilds.txt b/Misc/SpecialBuilds.txt
index 27369ab..a7cee80 100644
--- a/Misc/SpecialBuilds.txt
+++ b/Misc/SpecialBuilds.txt
@@ -77,90 +77,14 @@
     combinerefs.py, were new in Python 2.3b1.
 
 
-PYMALLOC_DEBUG
---------------
-
-When pymalloc is enabled (WITH_PYMALLOC is defined), calls to the PyObject_
-memory routines are handled by Python's own small-object allocator, while calls
-to the PyMem_ memory routines are directed to the system malloc/ realloc/free.
-If PYMALLOC_DEBUG is also defined, calls to both PyObject_ and PyMem_ memory
-routines are directed to a special debugging mode of Python's small-object
-allocator.
-
-This mode fills dynamically allocated memory blocks with special, recognizable
-bit patterns, and adds debugging info on each end of dynamically allocated
-memory blocks.  The special bit patterns are:
-
-#define CLEANBYTE     0xCB   /* clean (newly allocated) memory */
-#define DEADBYTE      0xDB   /* dead (newly freed) memory */
-#define FORBIDDENBYTE 0xFB   /* forbidden -- untouchable bytes */
-
-Strings of these bytes are unlikely to be valid addresses, floats, or 7-bit
-ASCII strings.
-
-Let S = sizeof(size_t). 2*S bytes are added at each end of each block of N bytes
-requested.  The memory layout is like so, where p represents the address
-returned by a malloc-like or realloc-like function (p[i:j] means the slice of
-bytes from *(p+i) inclusive up to *(p+j) exclusive; note that the treatment of
-negative indices differs from a Python slice):
-
-p[-2*S:-S]
-    Number of bytes originally asked for.  This is a size_t, big-endian (easier
-    to read in a memory dump).
-p[-S]
-    API ID.  See PEP 445.  This is a character, but seems undocumented.
-p[-S+1:0]
-    Copies of FORBIDDENBYTE.  Used to catch under- writes and reads.
-p[0:N]
-    The requested memory, filled with copies of CLEANBYTE, used to catch
-    reference to uninitialized memory.  When a realloc-like function is called
-    requesting a larger memory block, the new excess bytes are also filled with
-    CLEANBYTE.  When a free-like function is called, these are overwritten with
-    DEADBYTE, to catch reference to freed memory.  When a realloc- like function
-    is called requesting a smaller memory block, the excess old bytes are also
-    filled with DEADBYTE.
-p[N:N+S]
-    Copies of FORBIDDENBYTE.  Used to catch over- writes and reads.
-p[N+S:N+2*S]
-    A serial number, incremented by 1 on each call to a malloc-like or
-    realloc-like function.  Big-endian size_t.  If "bad memory" is detected
-    later, the serial number gives an excellent way to set a breakpoint on the
-    next run, to capture the instant at which this block was passed out.  The
-    static function bumpserialno() in obmalloc.c is the only place the serial
-    number is incremented, and exists so you can set such a breakpoint easily.
-
-A realloc-like or free-like function first checks that the FORBIDDENBYTEs at
-each end are intact.  If they've been altered, diagnostic output is written to
-stderr, and the program is aborted via Py_FatalError().  The other main failure
-mode is provoking a memory error when a program reads up one of the special bit
-patterns and tries to use it as an address.  If you get in a debugger then and
-look at the object, you're likely to see that it's entirely filled with 0xDB
-(meaning freed memory is getting used) or 0xCB (meaning uninitialized memory is
-getting used).
-
-Note that PYMALLOC_DEBUG requires WITH_PYMALLOC. Py_DEBUG implies
-PYMALLOC_DEBUG (if WITH_PYMALLOC is enabled).
-
-Special gimmicks:
-
-envvar PYTHONMALLOCSTATS
-    If this envvar exists, a report of pymalloc summary statistics is printed to
-    stderr whenever a new arena is allocated, and also by Py_FinalizeEx().
-
-Changed in 2.5:  The number of extra bytes allocated is 4*sizeof(size_t).
-Before it was 16 on all boxes, reflecting that Python couldn't make use of
-allocations >= 2**32 bytes even on 64-bit boxes before 2.5.
-
-
 Py_DEBUG
 --------
 
 This is what is generally meant by "a debug build" of Python.
 
-Py_DEBUG implies LLTRACE, Py_REF_DEBUG, and PYMALLOC_DEBUG (if
-WITH_PYMALLOC is enabled).  In addition, C assert()s are enabled (via the C way:
-by not defining NDEBUG), and some routines do additional sanity checks inside
-"#ifdef Py_DEBUG" blocks.
+Py_DEBUG implies LLTRACE and Py_REF_DEBUG. In addition, C assert()s are enabled
+(via the C way: by not defining NDEBUG), and some routines do additional sanity
+checks inside "#ifdef Py_DEBUG" blocks.
 
 
 LLTRACE
diff --git a/Misc/python.man b/Misc/python.man
index 2253765..45a4927 100644
--- a/Misc/python.man
+++ b/Misc/python.man
@@ -165,7 +165,8 @@
 .I sys.path
 for the named module and runs the corresponding
 .I .py
-file as a script.
+file as a script. This terminates the option list (following options
+are passed as arguments to the module).
 .TP
 .B \-O
 Remove assert statements and any code conditional on the value of
@@ -206,71 +207,76 @@
 .B \-V ", " \-\-version
 Prints the Python version number of the executable and exits.  When given
 twice, print more information about the build.
+
 .TP
 .BI "\-W " argument
-Warning control.  Python sometimes prints warning message to
+Warning control. Python's warning machinery by default prints warning messages
+to
 .IR sys.stderr .
-A typical warning message has the following form:
-.IB file ":" line ": " category ": " message.
-By default, each warning is printed once for each source line where it
-occurs.  This option controls how often warnings are printed.
-Multiple
-.B \-W
-options may be given; when a warning matches more than one
-option, the action for the last matching option is performed.
-Invalid
-.B \-W
-options are ignored (a warning message is printed about invalid
-options when the first warning is issued).  Warnings can also be
-controlled from within a Python program using the
-.I warnings
-module.
 
-The simplest form of
-.I argument
-is one of the following
-.I action
-strings (or a unique abbreviation):
-.B ignore
-to ignore all warnings;
-.B default
-to explicitly request the default behavior (printing each warning once
-per source line);
-.B all
-to print a warning each time it occurs (this may generate many
-messages if a warning is triggered repeatedly for the same source
-line, such as inside a loop);
-.B module
-to print each warning only the first time it occurs in each
-module;
-.B once
-to print each warning only the first time it occurs in the program; or
-.B error
-to raise an exception instead of printing a warning message.
+The simplest settings apply a particular action unconditionally to all warnings
+emitted by a process (even those that are otherwise ignored by default):
 
-The full form of
-.I argument
-is
-.IB action : message : category : module : line.
-Here,
+  -Wdefault  # Warn once per call location
+  -Werror    # Convert to exceptions
+  -Walways   # Warn every time
+  -Wmodule   # Warn once per calling module
+  -Wonce     # Warn once per Python process
+  -Wignore   # Never warn
+
+The action names can be abbreviated as desired and the interpreter will resolve
+them to the appropriate action name. For example,
+.B -Wi
+is the same as
+.B -Wignore .
+
+The full form of argument is:
+.IB action:message:category:module:lineno
+
+Empty fields match all values; trailing empty fields may be omitted. For
+example
+.B -W ignore::DeprecationWarning
+ignores all DeprecationWarning warnings.
+
+The
 .I action
-is as explained above but only applies to messages that match the
-remaining fields.  Empty fields match all values; trailing empty
-fields may be omitted.  The
+field is as explained above but only applies to warnings that match
+the remaining fields.
+
+The
 .I message
-field matches the start of the warning message printed; this match is
-case-insensitive.  The
+field must match the whole printed warning message; this match is
+case-insensitive.
+
+The
 .I category
-field matches the warning category.  This must be a class name; the
-match test whether the actual warning category of the message is a
-subclass of the specified warning category.  The full class name must
-be given.  The
+field matches the warning category (ex: "DeprecationWarning"). This must be a
+class name; the match test whether the actual warning category of the message
+is a subclass of the specified warning category.
+
+The
 .I module
-field matches the (fully-qualified) module name; this match is
-case-sensitive.  The
-.I line
-field matches the line number, where zero matches all line numbers and
-is thus equivalent to an omitted line number.
+field matches the (fully-qualified) module name; this match is case-sensitive.
+
+The
+.I lineno
+field matches the line number, where zero matches all line numbers and is thus
+equivalent to an omitted line number.
+
+Multiple
+.B -W
+options can be given; when a warning matches more than one option, the action
+for the last matching option is performed. Invalid
+.B -W
+options are ignored (though, a warning message is printed about invalid options
+when the first warning is issued).
+
+Warnings can also be controlled using the
+.B PYTHONWARNINGS
+environment variable and from within a Python program using the warnings
+module.  For example, the warnings.filterwarnings() function can be used to use
+a regular expression on the warning message.
+
 .TP
 .BI "\-X " option
 Set implementation specific option. The following options are available:
@@ -544,6 +550,7 @@
 \fB\--with-pydebug\fP build option.
 .IP PYTHONTHREADDEBUG
 If this environment variable is set, Python will print threading debug info.
+The feature is deprecated in Python 3.10 and will be removed in Python 3.12.
 .IP PYTHONDUMPREFS
 If this environment variable is set, Python will dump objects and reference
 counts still alive after shutting down the interpreter.
diff --git a/Misc/requirements-test.txt b/Misc/requirements-test.txt
index 6e46c12..60e7ed2 100644
--- a/Misc/requirements-test.txt
+++ b/Misc/requirements-test.txt
@@ -1 +1 @@
-tzdata==2020.1rc0
+tzdata==2020.3
diff --git a/Misc/stable_abi.txt b/Misc/stable_abi.txt
new file mode 100644
index 0000000..4a2ee18
--- /dev/null
+++ b/Misc/stable_abi.txt
@@ -0,0 +1,2160 @@
+# This file lists the contents of the Limited API and Stable ABI.
+# Please append new items at the end.
+
+# The syntax of this file is not fixed.
+# It is designed to be read only by Tools/stable_abi.py, which can change
+# without notice.
+
+# For the history of the stable ABI prior to this file,
+# see the history of PC/python3dll.c and before that, PC/python3.def,
+# and PC/pythonXYstub.def
+
+
+# Mentioned in PEP 384:
+
+struct PyObject
+    added 3.2
+struct PyVarObject
+    added 3.2
+struct PyMethodDef
+    added 3.2
+struct PyMemberDef
+    added 3.2
+struct PyGetSetDef
+    added 3.2
+struct PyModuleDef_Base
+    added 3.2
+struct PyModuleDef
+    added 3.2
+struct PyStructSequence_Field
+    added 3.2
+struct PyStructSequence_Desc
+    added 3.2
+struct PyType_Slot
+    added 3.2
+struct PyType_Spec
+    added 3.2
+struct PyThreadState
+    added 3.2
+struct PyInterpreterState
+    added 3.2
+struct PyFrameObject
+    added 3.2
+struct symtable
+    added 3.2
+struct PyWeakReference
+    added 3.2
+struct PyLongObject
+    added 3.2
+struct PyTypeObject
+    added 3.2
+
+function PyType_FromSpec
+    added 3.2
+
+const Py_tp_dealloc
+    added 3.2
+const Py_tp_getattr
+    added 3.2
+const Py_tp_setattr
+    added 3.2
+const Py_tp_repr
+    added 3.2
+const Py_tp_hash
+    added 3.2
+const Py_tp_call
+    added 3.2
+const Py_tp_str
+    added 3.2
+const Py_tp_getattro
+    added 3.2
+const Py_tp_setattro
+    added 3.2
+const Py_tp_doc
+    added 3.2
+const Py_tp_traverse
+    added 3.2
+const Py_tp_clear
+    added 3.2
+const Py_tp_richcompare
+    added 3.2
+const Py_tp_iter
+    added 3.2
+const Py_tp_iternext
+    added 3.2
+const Py_tp_methods
+    added 3.2
+const Py_tp_base
+    added 3.2
+const Py_tp_descr_get
+    added 3.2
+const Py_tp_descr_set
+    added 3.2
+const Py_tp_init
+    added 3.2
+const Py_tp_alloc
+    added 3.2
+const Py_tp_new
+    added 3.2
+const Py_tp_members
+    added 3.2
+const Py_tp_getset
+    added 3.2
+const Py_tp_free
+    added 3.2
+const Py_tp_is_gc
+    added 3.2
+const Py_tp_bases
+    added 3.2
+const Py_tp_del
+    added 3.2
+const Py_nb_add
+    added 3.2
+const Py_nb_subtract
+    added 3.2
+const Py_nb_multiply
+    added 3.2
+const Py_nb_remainder
+    added 3.2
+const Py_nb_divmod
+    added 3.2
+const Py_nb_power
+    added 3.2
+const Py_nb_negative
+    added 3.2
+const Py_nb_positive
+    added 3.2
+const Py_nb_absolute
+    added 3.2
+const Py_nb_bool
+    added 3.2
+const Py_nb_invert
+    added 3.2
+const Py_nb_lshift
+    added 3.2
+const Py_nb_rshift
+    added 3.2
+const Py_nb_and
+    added 3.2
+const Py_nb_xor
+    added 3.2
+const Py_nb_or
+    added 3.2
+const Py_nb_int
+    added 3.2
+const Py_nb_float
+    added 3.2
+const Py_nb_inplace_add
+    added 3.2
+const Py_nb_inplace_subtract
+    added 3.2
+const Py_nb_inplace_multiply
+    added 3.2
+const Py_nb_inplace_remainder
+    added 3.2
+const Py_nb_inplace_power
+    added 3.2
+const Py_nb_inplace_lshift
+    added 3.2
+const Py_nb_inplace_rshift
+    added 3.2
+const Py_nb_inplace_and
+    added 3.2
+const Py_nb_inplace_xor
+    added 3.2
+const Py_nb_inplace_or
+    added 3.2
+const Py_nb_floor_divide
+    added 3.2
+const Py_nb_true_divide
+    added 3.2
+const Py_nb_inplace_floor_divide
+    added 3.2
+const Py_nb_inplace_true_divide
+    added 3.2
+const Py_nb_index
+    added 3.2
+const Py_sq_length
+    added 3.2
+const Py_sq_concat
+    added 3.2
+const Py_sq_repeat
+    added 3.2
+const Py_sq_item
+    added 3.2
+const Py_sq_ass_item
+    added 3.2
+const Py_sq_contains
+    added 3.2
+const Py_sq_inplace_concat
+    added 3.2
+const Py_sq_inplace_repeat
+    added 3.2
+const Py_mp_length
+    added 3.2
+const Py_mp_subscript
+    added 3.2
+const Py_mp_ass_subscript
+    added 3.2
+
+typedef Py_uintptr_t
+    added 3.2
+typedef Py_intptr_t
+    added 3.2
+typedef Py_ssize_t
+    added 3.2
+typedef unaryfunc
+    added 3.2
+typedef binaryfunc
+    added 3.2
+typedef ternaryfunc
+    added 3.2
+typedef inquiry
+    added 3.2
+typedef lenfunc
+    added 3.2
+typedef ssizeargfunc
+    added 3.2
+typedef ssizessizeargfunc
+    added 3.2
+typedef ssizeobjargproc
+    added 3.2
+typedef ssizessizeobjargproc
+    added 3.2
+typedef objobjargproc
+    added 3.2
+typedef objobjproc
+    added 3.2
+typedef visitproc
+    added 3.2
+typedef traverseproc
+    added 3.2
+typedef destructor
+    added 3.2
+typedef getattrfunc
+    added 3.2
+typedef getattrofunc
+    added 3.2
+typedef setattrfunc
+    added 3.2
+typedef setattrofunc
+    added 3.2
+typedef reprfunc
+    added 3.2
+typedef hashfunc
+    added 3.2
+typedef richcmpfunc
+    added 3.2
+typedef getiterfunc
+    added 3.2
+typedef iternextfunc
+    added 3.2
+typedef descrgetfunc
+    added 3.2
+typedef descrsetfunc
+    added 3.2
+typedef initproc
+    added 3.2
+typedef newfunc
+    added 3.2
+typedef allocfunc
+    added 3.2
+struct PyCFunction
+    added 3.2
+struct PyCFunctionWithKeywords
+    added 3.2
+struct PyCapsule_Destructor
+    added 3.2
+typedef getter
+    added 3.2
+typedef setter
+    added 3.2
+typedef PyOS_sighandler_t
+    added 3.2
+typedef PyGILState_STATE
+    added 3.2
+typedef Py_UCS4
+    added 3.2
+
+macro Py_BEGIN_ALLOW_THREADS
+    added 3.2
+macro Py_BLOCK_THREADS
+    added 3.2
+macro Py_UNBLOCK_THREADS
+    added 3.2
+macro Py_END_ALLOW_THREADS
+    added 3.2
+
+# The following were added in PC/python3.def in the initial stable ABI commit,
+# 4d0d471a8031de90a2b1ce99c4ac4780e60b3bc9,
+# and later amendments in 3.2:
+# 0d012f284be829c6217f60523db0e1671b7db9d9
+# c83bc3c1fbed14d27a5de3032e24d2cf006a7c4b
+
+function PyArg_Parse
+    added 3.2
+function PyArg_ParseTuple
+    added 3.2
+function PyArg_ParseTupleAndKeywords
+    added 3.2
+function PyArg_UnpackTuple
+    added 3.2
+function PyArg_VaParse
+    added 3.2
+function PyArg_VaParseTupleAndKeywords
+    added 3.2
+function PyArg_ValidateKeywordArguments
+    added 3.2
+data PyBaseObject_Type
+    added 3.2
+function PyBool_FromLong
+    added 3.2
+data PyBool_Type
+    added 3.2
+data PyByteArrayIter_Type
+    added 3.2
+function PyByteArray_AsString
+    added 3.2
+function PyByteArray_Concat
+    added 3.2
+function PyByteArray_FromObject
+    added 3.2
+function PyByteArray_FromStringAndSize
+    added 3.2
+function PyByteArray_Resize
+    added 3.2
+function PyByteArray_Size
+    added 3.2
+data PyByteArray_Type
+    added 3.2
+data PyBytesIter_Type
+    added 3.2
+function PyBytes_AsString
+    added 3.2
+function PyBytes_AsStringAndSize
+    added 3.2
+function PyBytes_Concat
+    added 3.2
+function PyBytes_ConcatAndDel
+    added 3.2
+function PyBytes_DecodeEscape
+    added 3.2
+function PyBytes_FromFormat
+    added 3.2
+function PyBytes_FromFormatV
+    added 3.2
+function PyBytes_FromObject
+    added 3.2
+function PyBytes_FromString
+    added 3.2
+function PyBytes_FromStringAndSize
+    added 3.2
+function PyBytes_Repr
+    added 3.2
+function PyBytes_Size
+    added 3.2
+data PyBytes_Type
+    added 3.2
+function PyCFunction_Call
+    added 3.2
+function PyCFunction_GetFlags
+    added 3.2
+function PyCFunction_GetFunction
+    added 3.2
+function PyCFunction_GetSelf
+    added 3.2
+function PyCFunction_NewEx
+    added 3.2
+data PyCFunction_Type
+    added 3.2
+function PyCallIter_New
+    added 3.2
+data PyCallIter_Type
+    added 3.2
+function PyCallable_Check
+    added 3.2
+function PyCapsule_GetContext
+    added 3.2
+function PyCapsule_GetDestructor
+    added 3.2
+function PyCapsule_GetName
+    added 3.2
+function PyCapsule_GetPointer
+    added 3.2
+function PyCapsule_Import
+    added 3.2
+function PyCapsule_IsValid
+    added 3.2
+function PyCapsule_New
+    added 3.2
+function PyCapsule_SetContext
+    added 3.2
+function PyCapsule_SetDestructor
+    added 3.2
+function PyCapsule_SetName
+    added 3.2
+function PyCapsule_SetPointer
+    added 3.2
+data PyCapsule_Type
+    added 3.2
+data PyClassMethodDescr_Type
+    added 3.2
+function PyCodec_BackslashReplaceErrors
+    added 3.2
+function PyCodec_Decode
+    added 3.2
+function PyCodec_Decoder
+    added 3.2
+function PyCodec_Encode
+    added 3.2
+function PyCodec_Encoder
+    added 3.2
+function PyCodec_IgnoreErrors
+    added 3.2
+function PyCodec_IncrementalDecoder
+    added 3.2
+function PyCodec_IncrementalEncoder
+    added 3.2
+function PyCodec_KnownEncoding
+    added 3.2
+function PyCodec_LookupError
+    added 3.2
+function PyCodec_Register
+    added 3.2
+function PyCodec_RegisterError
+    added 3.2
+function PyCodec_ReplaceErrors
+    added 3.2
+function PyCodec_StreamReader
+    added 3.2
+function PyCodec_StreamWriter
+    added 3.2
+function PyCodec_StrictErrors
+    added 3.2
+function PyCodec_XMLCharRefReplaceErrors
+    added 3.2
+function PyComplex_FromDoubles
+    added 3.2
+function PyComplex_ImagAsDouble
+    added 3.2
+function PyComplex_RealAsDouble
+    added 3.2
+data PyComplex_Type
+    added 3.2
+function PyDescr_NewClassMethod
+    added 3.2
+function PyDescr_NewGetSet
+    added 3.2
+function PyDescr_NewMember
+    added 3.2
+function PyDescr_NewMethod
+    added 3.2
+data PyDictItems_Type
+    added 3.2
+data PyDictIterItem_Type
+    added 3.2
+data PyDictIterKey_Type
+    added 3.2
+data PyDictIterValue_Type
+    added 3.2
+data PyDictKeys_Type
+    added 3.2
+function PyDictProxy_New
+    added 3.2
+data PyDictProxy_Type
+    added 3.2
+data PyDictValues_Type
+    added 3.2
+function PyDict_Clear
+    added 3.2
+function PyDict_Contains
+    added 3.2
+function PyDict_Copy
+    added 3.2
+function PyDict_DelItem
+    added 3.2
+function PyDict_DelItemString
+    added 3.2
+function PyDict_GetItem
+    added 3.2
+function PyDict_GetItemString
+    added 3.2
+function PyDict_GetItemWithError
+    added 3.2
+function PyDict_Items
+    added 3.2
+function PyDict_Keys
+    added 3.2
+function PyDict_Merge
+    added 3.2
+function PyDict_MergeFromSeq2
+    added 3.2
+function PyDict_New
+    added 3.2
+function PyDict_Next
+    added 3.2
+function PyDict_SetItem
+    added 3.2
+function PyDict_SetItemString
+    added 3.2
+function PyDict_Size
+    added 3.2
+data PyDict_Type
+    added 3.2
+function PyDict_Update
+    added 3.2
+function PyDict_Values
+    added 3.2
+data PyEllipsis_Type
+    added 3.2
+data PyEnum_Type
+    added 3.2
+function PyErr_BadArgument
+    added 3.2
+function PyErr_BadInternalCall
+    added 3.2
+function PyErr_CheckSignals
+    added 3.2
+function PyErr_Clear
+    added 3.2
+function PyErr_Display
+    added 3.2
+function PyErr_ExceptionMatches
+    added 3.2
+function PyErr_Fetch
+    added 3.2
+function PyErr_Format
+    added 3.2
+function PyErr_GivenExceptionMatches
+    added 3.2
+function PyErr_NewException
+    added 3.2
+function PyErr_NewExceptionWithDoc
+    added 3.2
+function PyErr_NoMemory
+    added 3.2
+function PyErr_NormalizeException
+    added 3.2
+function PyErr_Occurred
+    added 3.2
+function PyErr_Print
+    added 3.2
+function PyErr_PrintEx
+    added 3.2
+function PyErr_ProgramText
+    added 3.2
+function PyErr_Restore
+    added 3.2
+function PyErr_SetFromErrno
+    added 3.2
+function PyErr_SetFromErrnoWithFilename
+    added 3.2
+function PyErr_SetFromErrnoWithFilenameObject
+    added 3.2
+function PyErr_SetInterrupt
+    added 3.2
+function PyErr_SetNone
+    added 3.2
+function PyErr_SetObject
+    added 3.2
+function PyErr_SetString
+    added 3.2
+function PyErr_SyntaxLocation
+    added 3.2
+function PyErr_WarnEx
+    added 3.2
+function PyErr_WarnExplicit
+    added 3.2
+function PyErr_WarnFormat
+    added 3.2
+function PyErr_WriteUnraisable
+    added 3.2
+function PyEval_AcquireLock
+    added 3.2
+function PyEval_AcquireThread
+    added 3.2
+function PyEval_CallFunction
+    added 3.2
+function PyEval_CallMethod
+    added 3.2
+function PyEval_CallObjectWithKeywords
+    added 3.2
+function PyEval_EvalCode
+    added 3.2
+function PyEval_EvalCodeEx
+    added 3.2
+function PyEval_EvalFrame
+    added 3.2
+function PyEval_EvalFrameEx
+    added 3.2
+function PyEval_GetBuiltins
+    added 3.2
+function PyEval_GetFrame
+    added 3.2
+function PyEval_GetFuncDesc
+    added 3.2
+function PyEval_GetFuncName
+    added 3.2
+function PyEval_GetGlobals
+    added 3.2
+function PyEval_GetLocals
+    added 3.2
+function PyEval_InitThreads
+    added 3.2
+function PyEval_ReleaseLock
+    added 3.2
+function PyEval_ReleaseThread
+    added 3.2
+function PyEval_RestoreThread
+    added 3.2
+function PyEval_SaveThread
+    added 3.2
+function PyEval_ThreadsInitialized
+    added 3.2
+data PyExc_ArithmeticError
+    added 3.2
+data PyExc_AssertionError
+    added 3.2
+data PyExc_AttributeError
+    added 3.2
+data PyExc_BaseException
+    added 3.2
+data PyExc_BufferError
+    added 3.2
+data PyExc_BytesWarning
+    added 3.2
+data PyExc_DeprecationWarning
+    added 3.2
+data PyExc_EOFError
+    added 3.2
+data PyExc_EnvironmentError
+    added 3.2
+data PyExc_Exception
+    added 3.2
+data PyExc_FloatingPointError
+    added 3.2
+data PyExc_FutureWarning
+    added 3.2
+data PyExc_GeneratorExit
+    added 3.2
+data PyExc_IOError
+    added 3.2
+data PyExc_ImportError
+    added 3.2
+data PyExc_ImportWarning
+    added 3.2
+data PyExc_IndentationError
+    added 3.2
+data PyExc_IndexError
+    added 3.2
+data PyExc_KeyError
+    added 3.2
+data PyExc_KeyboardInterrupt
+    added 3.2
+data PyExc_LookupError
+    added 3.2
+data PyExc_MemoryError
+    added 3.2
+data PyExc_NameError
+    added 3.2
+data PyExc_NotImplementedError
+    added 3.2
+data PyExc_OSError
+    added 3.2
+data PyExc_OverflowError
+    added 3.2
+data PyExc_PendingDeprecationWarning
+    added 3.2
+data PyExc_ReferenceError
+    added 3.2
+data PyExc_RuntimeError
+    added 3.2
+data PyExc_RuntimeWarning
+    added 3.2
+data PyExc_StopIteration
+    added 3.2
+data PyExc_SyntaxError
+    added 3.2
+data PyExc_SyntaxWarning
+    added 3.2
+data PyExc_SystemError
+    added 3.2
+data PyExc_SystemExit
+    added 3.2
+data PyExc_TabError
+    added 3.2
+data PyExc_TypeError
+    added 3.2
+data PyExc_UnboundLocalError
+    added 3.2
+data PyExc_UnicodeDecodeError
+    added 3.2
+data PyExc_UnicodeEncodeError
+    added 3.2
+data PyExc_UnicodeError
+    added 3.2
+data PyExc_UnicodeTranslateError
+    added 3.2
+data PyExc_UnicodeWarning
+    added 3.2
+data PyExc_UserWarning
+    added 3.2
+data PyExc_ValueError
+    added 3.2
+data PyExc_Warning
+    added 3.2
+data PyExc_ZeroDivisionError
+    added 3.2
+function PyException_GetCause
+    added 3.2
+function PyException_GetContext
+    added 3.2
+function PyException_GetTraceback
+    added 3.2
+function PyException_SetCause
+    added 3.2
+function PyException_SetContext
+    added 3.2
+function PyException_SetTraceback
+    added 3.2
+function PyFile_FromFd
+    added 3.2
+function PyFile_GetLine
+    added 3.2
+function PyFile_WriteObject
+    added 3.2
+function PyFile_WriteString
+    added 3.2
+data PyFilter_Type
+    added 3.2
+function PyFloat_AsDouble
+    added 3.2
+function PyFloat_FromDouble
+    added 3.2
+function PyFloat_FromString
+    added 3.2
+function PyFloat_GetInfo
+    added 3.2
+function PyFloat_GetMax
+    added 3.2
+function PyFloat_GetMin
+    added 3.2
+data PyFloat_Type
+    added 3.2
+function PyFrozenSet_New
+    added 3.2
+data PyFrozenSet_Type
+    added 3.2
+function PyGC_Collect
+    added 3.2
+function PyGILState_Ensure
+    added 3.2
+function PyGILState_GetThisThreadState
+    added 3.2
+function PyGILState_Release
+    added 3.2
+data PyGetSetDescr_Type
+    added 3.2
+function PyImport_AddModule
+    added 3.2
+function PyImport_AppendInittab
+    added 3.2
+function PyImport_ExecCodeModule
+    added 3.2
+function PyImport_ExecCodeModuleEx
+    added 3.2
+function PyImport_ExecCodeModuleWithPathnames
+    added 3.2
+function PyImport_GetImporter
+    added 3.2
+function PyImport_GetMagicNumber
+    added 3.2
+function PyImport_GetMagicTag
+    added 3.2
+function PyImport_GetModuleDict
+    added 3.2
+function PyImport_Import
+    added 3.2
+function PyImport_ImportFrozenModule
+    added 3.2
+function PyImport_ImportModule
+    added 3.2
+function PyImport_ImportModuleLevel
+    added 3.2
+function PyImport_ImportModuleNoBlock
+    added 3.2
+function PyImport_ReloadModule
+    added 3.2
+function PyInterpreterState_Clear
+    added 3.2
+function PyInterpreterState_Delete
+    added 3.2
+function PyInterpreterState_New
+    added 3.2
+function PyIter_Next
+    added 3.2
+data PyListIter_Type
+    added 3.2
+data PyListRevIter_Type
+    added 3.2
+function PyList_Append
+    added 3.2
+function PyList_AsTuple
+    added 3.2
+function PyList_GetItem
+    added 3.2
+function PyList_GetSlice
+    added 3.2
+function PyList_Insert
+    added 3.2
+function PyList_New
+    added 3.2
+function PyList_Reverse
+    added 3.2
+function PyList_SetItem
+    added 3.2
+function PyList_SetSlice
+    added 3.2
+function PyList_Size
+    added 3.2
+function PyList_Sort
+    added 3.2
+data PyList_Type
+    added 3.2
+data PyLongRangeIter_Type
+    added 3.2
+function PyLong_AsDouble
+    added 3.2
+function PyLong_AsLong
+    added 3.2
+function PyLong_AsLongAndOverflow
+    added 3.2
+function PyLong_AsLongLong
+    added 3.2
+function PyLong_AsLongLongAndOverflow
+    added 3.2
+function PyLong_AsSize_t
+    added 3.2
+function PyLong_AsSsize_t
+    added 3.2
+function PyLong_AsUnsignedLong
+    added 3.2
+function PyLong_AsUnsignedLongLong
+    added 3.2
+function PyLong_AsUnsignedLongLongMask
+    added 3.2
+function PyLong_AsUnsignedLongMask
+    added 3.2
+function PyLong_AsVoidPtr
+    added 3.2
+function PyLong_FromDouble
+    added 3.2
+function PyLong_FromLong
+    added 3.2
+function PyLong_FromLongLong
+    added 3.2
+function PyLong_FromSize_t
+    added 3.2
+function PyLong_FromSsize_t
+    added 3.2
+function PyLong_FromString
+    added 3.2
+function PyLong_FromUnsignedLong
+    added 3.2
+function PyLong_FromUnsignedLongLong
+    added 3.2
+function PyLong_FromVoidPtr
+    added 3.2
+function PyLong_GetInfo
+    added 3.2
+data PyLong_Type
+    added 3.2
+data PyMap_Type
+    added 3.2
+function PyMapping_Check
+    added 3.2
+function PyMapping_GetItemString
+    added 3.2
+function PyMapping_HasKey
+    added 3.2
+function PyMapping_HasKeyString
+    added 3.2
+function PyMapping_Items
+    added 3.2
+function PyMapping_Keys
+    added 3.2
+function PyMapping_Length
+    added 3.2
+function PyMapping_SetItemString
+    added 3.2
+function PyMapping_Size
+    added 3.2
+function PyMapping_Values
+    added 3.2
+function PyMem_Free
+    added 3.2
+function PyMem_Malloc
+    added 3.2
+function PyMem_Realloc
+    added 3.2
+data PyMemberDescr_Type
+    added 3.2
+function PyMemoryView_FromObject
+    added 3.2
+function PyMemoryView_GetContiguous
+    added 3.2
+data PyMemoryView_Type
+    added 3.2
+data PyMethodDescr_Type
+    added 3.2
+function PyModule_AddIntConstant
+    added 3.2
+function PyModule_AddObject
+    added 3.2
+function PyModule_AddStringConstant
+    added 3.2
+function PyModule_Create2
+    added 3.2
+function PyModule_GetDef
+    added 3.2
+function PyModule_GetDict
+    added 3.2
+function PyModule_GetFilename
+    added 3.2
+function PyModule_GetFilenameObject
+    added 3.2
+function PyModule_GetName
+    added 3.2
+function PyModule_GetState
+    added 3.2
+function PyModule_New
+    added 3.2
+data PyModule_Type
+    added 3.2
+function PyNumber_Absolute
+    added 3.2
+function PyNumber_Add
+    added 3.2
+function PyNumber_And
+    added 3.2
+function PyNumber_AsSsize_t
+    added 3.2
+function PyNumber_Check
+    added 3.2
+function PyNumber_Divmod
+    added 3.2
+function PyNumber_Float
+    added 3.2
+function PyNumber_FloorDivide
+    added 3.2
+function PyNumber_InPlaceAdd
+    added 3.2
+function PyNumber_InPlaceAnd
+    added 3.2
+function PyNumber_InPlaceFloorDivide
+    added 3.2
+function PyNumber_InPlaceLshift
+    added 3.2
+function PyNumber_InPlaceMultiply
+    added 3.2
+function PyNumber_InPlaceOr
+    added 3.2
+function PyNumber_InPlacePower
+    added 3.2
+function PyNumber_InPlaceRemainder
+    added 3.2
+function PyNumber_InPlaceRshift
+    added 3.2
+function PyNumber_InPlaceSubtract
+    added 3.2
+function PyNumber_InPlaceTrueDivide
+    added 3.2
+function PyNumber_InPlaceXor
+    added 3.2
+function PyNumber_Index
+    added 3.2
+function PyNumber_Invert
+    added 3.2
+function PyNumber_Long
+    added 3.2
+function PyNumber_Lshift
+    added 3.2
+function PyNumber_Multiply
+    added 3.2
+function PyNumber_Negative
+    added 3.2
+function PyNumber_Or
+    added 3.2
+function PyNumber_Positive
+    added 3.2
+function PyNumber_Power
+    added 3.2
+function PyNumber_Remainder
+    added 3.2
+function PyNumber_Rshift
+    added 3.2
+function PyNumber_Subtract
+    added 3.2
+function PyNumber_ToBase
+    added 3.2
+function PyNumber_TrueDivide
+    added 3.2
+function PyNumber_Xor
+    added 3.2
+function PyOS_AfterFork
+    added 3.2
+    ifdef HAVE_FORK
+data PyOS_InputHook
+    added 3.2
+function PyOS_InterruptOccurred
+    added 3.2
+function PyOS_double_to_string
+    added 3.2
+function PyOS_getsig
+    added 3.2
+function PyOS_mystricmp
+    added 3.2
+function PyOS_mystrnicmp
+    added 3.2
+function PyOS_setsig
+    added 3.2
+function PyOS_snprintf
+    added 3.2
+function PyOS_string_to_double
+    added 3.2
+function PyOS_strtol
+    added 3.2
+function PyOS_strtoul
+    added 3.2
+function PyOS_vsnprintf
+    added 3.2
+function PyObject_ASCII
+    added 3.2
+function PyObject_AsFileDescriptor
+    added 3.2
+function PyObject_Bytes
+    added 3.2
+function PyObject_Call
+    added 3.2
+function PyObject_CallFunction
+    added 3.2
+function PyObject_CallFunctionObjArgs
+    added 3.2
+function PyObject_CallMethod
+    added 3.2
+function PyObject_CallMethodObjArgs
+    added 3.2
+function PyObject_CallObject
+    added 3.2
+function PyObject_ClearWeakRefs
+    added 3.2
+function PyObject_DelItem
+    added 3.2
+function PyObject_DelItemString
+    added 3.2
+function PyObject_Dir
+    added 3.2
+function PyObject_Format
+    added 3.2
+function PyObject_Free
+    added 3.2
+function PyObject_GC_Del
+    added 3.2
+function PyObject_GC_Track
+    added 3.2
+function PyObject_GC_UnTrack
+    added 3.2
+function PyObject_GenericGetAttr
+    added 3.2
+function PyObject_GenericSetAttr
+    added 3.2
+function PyObject_GetAttr
+    added 3.2
+function PyObject_GetAttrString
+    added 3.2
+function PyObject_GetItem
+    added 3.2
+function PyObject_GetIter
+    added 3.2
+function PyObject_HasAttr
+    added 3.2
+function PyObject_HasAttrString
+    added 3.2
+function PyObject_Hash
+    added 3.2
+function PyObject_HashNotImplemented
+    added 3.2
+function PyObject_Init
+    added 3.2
+function PyObject_InitVar
+    added 3.2
+function PyObject_IsInstance
+    added 3.2
+function PyObject_IsSubclass
+    added 3.2
+function PyObject_IsTrue
+    added 3.2
+function PyObject_Length
+    added 3.2
+function PyObject_Malloc
+    added 3.2
+function PyObject_Not
+    added 3.2
+function PyObject_Realloc
+    added 3.2
+function PyObject_Repr
+    added 3.2
+function PyObject_RichCompare
+    added 3.2
+function PyObject_RichCompareBool
+    added 3.2
+function PyObject_SelfIter
+    added 3.2
+function PyObject_SetAttr
+    added 3.2
+function PyObject_SetAttrString
+    added 3.2
+function PyObject_SetItem
+    added 3.2
+function PyObject_Size
+    added 3.2
+function PyObject_Str
+    added 3.2
+function PyObject_Type
+    added 3.2
+data PyProperty_Type
+    added 3.2
+data PyRangeIter_Type
+    added 3.2
+data PyRange_Type
+    added 3.2
+data PyReversed_Type
+    added 3.2
+function PySeqIter_New
+    added 3.2
+data PySeqIter_Type
+    added 3.2
+function PySequence_Check
+    added 3.2
+function PySequence_Concat
+    added 3.2
+function PySequence_Contains
+    added 3.2
+function PySequence_Count
+    added 3.2
+function PySequence_DelItem
+    added 3.2
+function PySequence_DelSlice
+    added 3.2
+function PySequence_Fast
+    added 3.2
+function PySequence_GetItem
+    added 3.2
+function PySequence_GetSlice
+    added 3.2
+function PySequence_In
+    added 3.2
+function PySequence_InPlaceConcat
+    added 3.2
+function PySequence_InPlaceRepeat
+    added 3.2
+function PySequence_Index
+    added 3.2
+function PySequence_Length
+    added 3.2
+function PySequence_List
+    added 3.2
+function PySequence_Repeat
+    added 3.2
+function PySequence_SetItem
+    added 3.2
+function PySequence_SetSlice
+    added 3.2
+function PySequence_Size
+    added 3.2
+function PySequence_Tuple
+    added 3.2
+data PySetIter_Type
+    added 3.2
+function PySet_Add
+    added 3.2
+function PySet_Clear
+    added 3.2
+function PySet_Contains
+    added 3.2
+function PySet_Discard
+    added 3.2
+function PySet_New
+    added 3.2
+function PySet_Pop
+    added 3.2
+function PySet_Size
+    added 3.2
+data PySet_Type
+    added 3.2
+function PySlice_GetIndices
+    added 3.2
+function PySlice_GetIndicesEx
+    added 3.2
+function PySlice_New
+    added 3.2
+data PySlice_Type
+    added 3.2
+function PyState_FindModule
+    added 3.2
+function PyStructSequence_GetItem
+    added 3.2
+function PyStructSequence_New
+    added 3.2
+function PyStructSequence_NewType
+    added 3.2
+function PyStructSequence_SetItem
+    added 3.2
+data PySuper_Type
+    added 3.2
+function PySys_AddWarnOption
+    added 3.2
+function PySys_AddWarnOptionUnicode
+    added 3.2
+function PySys_FormatStderr
+    added 3.2
+function PySys_FormatStdout
+    added 3.2
+function PySys_GetObject
+    added 3.2
+function PySys_HasWarnOptions
+    added 3.2
+function PySys_ResetWarnOptions
+    added 3.2
+function PySys_SetArgv
+    added 3.2
+function PySys_SetArgvEx
+    added 3.2
+function PySys_SetObject
+    added 3.2
+function PySys_SetPath
+    added 3.2
+function PySys_WriteStderr
+    added 3.2
+function PySys_WriteStdout
+    added 3.2
+function PyThreadState_Clear
+    added 3.2
+function PyThreadState_Delete
+    added 3.2
+function PyThreadState_DeleteCurrent
+    added 3.2
+    abi_only
+function PyThreadState_Get
+    added 3.2
+function PyThreadState_GetDict
+    added 3.2
+function PyThreadState_New
+    added 3.2
+function PyThreadState_SetAsyncExc
+    added 3.2
+function PyThreadState_Swap
+    added 3.2
+function PyTraceBack_Here
+    added 3.2
+function PyTraceBack_Print
+    added 3.2
+data PyTraceBack_Type
+    added 3.2
+data PyTupleIter_Type
+    added 3.2
+function PyTuple_GetItem
+    added 3.2
+function PyTuple_GetSlice
+    added 3.2
+function PyTuple_New
+    added 3.2
+function PyTuple_Pack
+    added 3.2
+function PyTuple_SetItem
+    added 3.2
+function PyTuple_Size
+    added 3.2
+data PyTuple_Type
+    added 3.2
+function PyType_ClearCache
+    added 3.2
+function PyType_GenericAlloc
+    added 3.2
+function PyType_GenericNew
+    added 3.2
+function PyType_GetFlags
+    added 3.2
+function PyType_IsSubtype
+    added 3.2
+function PyType_Modified
+    added 3.2
+function PyType_Ready
+    added 3.2
+data PyType_Type
+    added 3.2
+function PyUnicodeDecodeError_Create
+    added 3.2
+function PyUnicodeDecodeError_GetEncoding
+    added 3.2
+function PyUnicodeDecodeError_GetEnd
+    added 3.2
+function PyUnicodeDecodeError_GetObject
+    added 3.2
+function PyUnicodeDecodeError_GetReason
+    added 3.2
+function PyUnicodeDecodeError_GetStart
+    added 3.2
+function PyUnicodeDecodeError_SetEnd
+    added 3.2
+function PyUnicodeDecodeError_SetReason
+    added 3.2
+function PyUnicodeDecodeError_SetStart
+    added 3.2
+function PyUnicodeEncodeError_GetEncoding
+    added 3.2
+function PyUnicodeEncodeError_GetEnd
+    added 3.2
+function PyUnicodeEncodeError_GetObject
+    added 3.2
+function PyUnicodeEncodeError_GetReason
+    added 3.2
+function PyUnicodeEncodeError_GetStart
+    added 3.2
+function PyUnicodeEncodeError_SetEnd
+    added 3.2
+function PyUnicodeEncodeError_SetReason
+    added 3.2
+function PyUnicodeEncodeError_SetStart
+    added 3.2
+data PyUnicodeIter_Type
+    added 3.2
+function PyUnicodeTranslateError_GetEnd
+    added 3.2
+function PyUnicodeTranslateError_GetObject
+    added 3.2
+function PyUnicodeTranslateError_GetReason
+    added 3.2
+function PyUnicodeTranslateError_GetStart
+    added 3.2
+function PyUnicodeTranslateError_SetEnd
+    added 3.2
+function PyUnicodeTranslateError_SetReason
+    added 3.2
+function PyUnicodeTranslateError_SetStart
+    added 3.2
+function PyUnicode_Append
+    added 3.2
+function PyUnicode_AppendAndDel
+    added 3.2
+function PyUnicode_AsASCIIString
+    added 3.2
+function PyUnicode_AsCharmapString
+    added 3.2
+function PyUnicode_AsDecodedObject
+    added 3.2
+function PyUnicode_AsDecodedUnicode
+    added 3.2
+function PyUnicode_AsEncodedObject
+    added 3.2
+function PyUnicode_AsEncodedString
+    added 3.2
+function PyUnicode_AsEncodedUnicode
+    added 3.2
+function PyUnicode_AsLatin1String
+    added 3.2
+function PyUnicode_AsRawUnicodeEscapeString
+    added 3.2
+function PyUnicode_AsUTF16String
+    added 3.2
+function PyUnicode_AsUTF32String
+    added 3.2
+function PyUnicode_AsUTF8String
+    added 3.2
+function PyUnicode_AsUnicodeEscapeString
+    added 3.2
+function PyUnicode_AsWideChar
+    added 3.2
+function PyUnicode_Compare
+    added 3.2
+function PyUnicode_Concat
+    added 3.2
+function PyUnicode_Contains
+    added 3.2
+function PyUnicode_Count
+    added 3.2
+function PyUnicode_Decode
+    added 3.2
+function PyUnicode_DecodeASCII
+    added 3.2
+function PyUnicode_DecodeCharmap
+    added 3.2
+function PyUnicode_DecodeFSDefault
+    added 3.2
+function PyUnicode_DecodeFSDefaultAndSize
+    added 3.2
+function PyUnicode_DecodeLatin1
+    added 3.2
+function PyUnicode_DecodeRawUnicodeEscape
+    added 3.2
+function PyUnicode_DecodeUTF16
+    added 3.2
+function PyUnicode_DecodeUTF16Stateful
+    added 3.2
+function PyUnicode_DecodeUTF32
+    added 3.2
+function PyUnicode_DecodeUTF32Stateful
+    added 3.2
+function PyUnicode_DecodeUTF8
+    added 3.2
+function PyUnicode_DecodeUTF8Stateful
+    added 3.2
+function PyUnicode_DecodeUnicodeEscape
+    added 3.2
+function PyUnicode_FSConverter
+    added 3.2
+function PyUnicode_FSDecoder
+    added 3.2
+function PyUnicode_Find
+    added 3.2
+function PyUnicode_Format
+    added 3.2
+function PyUnicode_FromEncodedObject
+    added 3.2
+function PyUnicode_FromFormat
+    added 3.2
+function PyUnicode_FromFormatV
+    added 3.2
+function PyUnicode_FromObject
+    added 3.2
+function PyUnicode_FromOrdinal
+    added 3.2
+function PyUnicode_FromString
+    added 3.2
+function PyUnicode_FromStringAndSize
+    added 3.2
+function PyUnicode_FromWideChar
+    added 3.2
+function PyUnicode_GetDefaultEncoding
+    added 3.2
+function PyUnicode_GetSize
+    added 3.2
+function PyUnicode_IsIdentifier
+    added 3.2
+function PyUnicode_Join
+    added 3.2
+function PyUnicode_Partition
+    added 3.2
+function PyUnicode_RPartition
+    added 3.2
+function PyUnicode_RSplit
+    added 3.2
+function PyUnicode_Replace
+    added 3.2
+function PyUnicode_Resize
+    added 3.2
+function PyUnicode_RichCompare
+    added 3.2
+function PyUnicode_Split
+    added 3.2
+function PyUnicode_Splitlines
+    added 3.2
+function PyUnicode_Tailmatch
+    added 3.2
+function PyUnicode_Translate
+    added 3.2
+function PyUnicode_BuildEncodingMap
+    added 3.2
+function PyUnicode_CompareWithASCIIString
+    added 3.2
+function PyUnicode_DecodeUTF7
+    added 3.2
+function PyUnicode_DecodeUTF7Stateful
+    added 3.2
+function PyUnicode_EncodeFSDefault
+    added 3.2
+function PyUnicode_InternFromString
+    added 3.2
+function PyUnicode_InternImmortal
+    added 3.2
+function PyUnicode_InternInPlace
+    added 3.2
+data PyUnicode_Type
+    added 3.2
+function PyWeakref_GetObject
+    added 3.2
+function PyWeakref_NewProxy
+    added 3.2
+function PyWeakref_NewRef
+    added 3.2
+data PyWrapperDescr_Type
+    added 3.2
+function PyWrapper_New
+    added 3.2
+data PyZip_Type
+    added 3.2
+function Py_AddPendingCall
+    added 3.2
+function Py_AtExit
+    added 3.2
+function Py_BuildValue
+    added 3.2
+function Py_CompileString
+    added 3.2
+function Py_DecRef
+    added 3.2
+function Py_EndInterpreter
+    added 3.2
+function Py_Exit
+    added 3.2
+function Py_FatalError
+    added 3.2
+data Py_FileSystemDefaultEncoding
+    added 3.2
+function Py_Finalize
+    added 3.2
+function Py_GetBuildInfo
+    added 3.2
+function Py_GetCompiler
+    added 3.2
+function Py_GetCopyright
+    added 3.2
+function Py_GetExecPrefix
+    added 3.2
+function Py_GetPath
+    added 3.2
+function Py_GetPlatform
+    added 3.2
+function Py_GetPrefix
+    added 3.2
+function Py_GetProgramFullPath
+    added 3.2
+function Py_GetProgramName
+    added 3.2
+function Py_GetPythonHome
+    added 3.2
+function Py_GetRecursionLimit
+    added 3.2
+function Py_GetVersion
+    added 3.2
+data Py_HasFileSystemDefaultEncoding
+    added 3.2
+function Py_IncRef
+    added 3.2
+function Py_Initialize
+    added 3.2
+function Py_InitializeEx
+    added 3.2
+function Py_IsInitialized
+    added 3.2
+function Py_Main
+    added 3.2
+function Py_MakePendingCalls
+    added 3.2
+function Py_NewInterpreter
+    added 3.2
+function Py_ReprEnter
+    added 3.2
+function Py_ReprLeave
+    added 3.2
+function Py_SetProgramName
+    added 3.2
+function Py_SetPythonHome
+    added 3.2
+function Py_SetRecursionLimit
+    added 3.2
+function Py_VaBuildValue
+    added 3.2
+
+function _PyErr_BadInternalCall
+    added 3.2
+    abi_only
+function _PyObject_CallFunction_SizeT
+    added 3.2
+    abi_only
+function _PyObject_CallMethod_SizeT
+    added 3.2
+    abi_only
+function _PyObject_GC_Malloc
+    added 3.2
+    abi_only
+function _PyObject_GC_New
+    added 3.2
+    abi_only
+function _PyObject_GC_NewVar
+    added 3.2
+    abi_only
+function _PyObject_GC_Resize
+    added 3.2
+    abi_only
+function _PyObject_New
+    added 3.2
+    abi_only
+function _PyObject_NewVar
+    added 3.2
+    abi_only
+function _PyState_AddModule
+    added 3.2
+    abi_only
+function _PyThreadState_Init
+    added 3.2
+    abi_only
+function _PyThreadState_Prealloc
+    added 3.2
+    abi_only
+function _PyTrash_deposit_object
+    added 3.2
+    abi_only
+function _PyTrash_destroy_chain
+    added 3.2
+    abi_only
+data _PyWeakref_CallableProxyType
+    added 3.2
+    abi_only
+data _PyWeakref_ProxyType
+    added 3.2
+    abi_only
+data _PyWeakref_RefType
+    added 3.2
+    abi_only
+function _Py_BuildValue_SizeT
+    added 3.2
+    abi_only
+function _Py_CheckRecursiveCall
+    added 3.2
+    abi_only
+function _Py_Dealloc
+    added 3.2
+    abi_only
+data _Py_EllipsisObject
+    added 3.2
+    abi_only
+data _Py_FalseStruct
+    added 3.2
+    abi_only
+data _Py_NoneStruct
+    added 3.2
+    abi_only
+data _Py_NotImplementedStruct
+    added 3.2
+    abi_only
+data _Py_SwappedOp
+    added 3.2
+    abi_only
+data _Py_TrueStruct
+    added 3.2
+    abi_only
+function _Py_VaBuildValue_SizeT
+    added 3.2
+    abi_only
+
+# Old buffer protocol support (deprecated)
+
+function PyObject_AsCharBuffer
+    added 3.2
+function PyObject_AsReadBuffer
+    added 3.2
+function PyObject_AsWriteBuffer
+    added 3.2
+function PyObject_CheckReadBuffer
+    added 3.2
+
+# Flags are implicitly part of the ABI:
+
+const Py_TPFLAGS_DEFAULT
+    added 3.2
+const Py_TPFLAGS_BASETYPE
+    added 3.2
+const Py_TPFLAGS_HAVE_GC
+    added 3.2
+
+const METH_VARARGS
+    added 3.2
+const METH_NOARGS
+    added 3.2
+const METH_O
+    added 3.2
+const METH_CLASS
+    added 3.2
+const METH_STATIC
+    added 3.2
+const METH_COEXIST
+    added 3.2
+# METH_STACKLESS is undocumented
+# METH_FASTCALL is not part of limited API.
+
+# The following are defined in private headers, but historically
+# they were exported as part of the stable ABI.
+function PyMarshal_ReadObjectFromString
+    added 3.2
+    abi_only
+function PyMarshal_WriteObjectToString
+    added 3.2
+    abi_only
+function PyMember_GetOne
+    added 3.2
+    abi_only
+function PyMember_SetOne
+    added 3.2
+    abi_only
+
+# TLS api is deprecated; superseded by TSS API
+
+function PyThread_ReInitTLS
+    added 3.2
+function PyThread_create_key
+    added 3.2
+function PyThread_delete_key
+    added 3.2
+function PyThread_set_key_value
+    added 3.2
+function PyThread_get_key_value
+    added 3.2
+function PyThread_delete_key_value
+    added 3.2
+function PyThread_acquire_lock
+    added 3.2
+function PyThread_acquire_lock_timed
+    added 3.2
+function PyThread_allocate_lock
+    added 3.2
+function PyThread_exit_thread
+    added 3.2
+function PyThread_free_lock
+    added 3.2
+function PyThread_get_stacksize
+    added 3.2
+function PyThread_get_thread_ident
+    added 3.2
+function PyThread_get_thread_native_id
+    added 3.2
+function PyThread_init_thread
+    added 3.2
+function PyThread_release_lock
+    added 3.2
+function PyThread_set_stacksize
+    added 3.2
+function PyThread_start_new_thread
+    added 3.2
+
+# The following were added in PC/python3.def in Python 3.3:
+# 7800f75827b1be557be16f3b18f5170fbf9fae08
+# 9c56409d3353b8cd4cfc19e0467bbe23fd34fc92
+# 75aeaa9b18667219bbacbc58ba6efecccef9dfbd
+
+function PyState_AddModule
+    added 3.3
+function PyState_RemoveModule
+    added 3.3
+function PyType_FromSpecWithBases
+    added 3.3
+function _PyArg_Parse_SizeT
+    added 3.3
+    abi_only
+function _PyArg_ParseTuple_SizeT
+    added 3.3
+    abi_only
+function _PyArg_ParseTupleAndKeywords_SizeT
+    added 3.3
+    abi_only
+function _PyArg_VaParse_SizeT
+    added 3.3
+    abi_only
+function _PyArg_VaParseTupleAndKeywords_SizeT
+    added 3.3
+    abi_only
+function PyThread_GetInfo
+    added 3.3
+
+# The following were added in PC/python3.def in Python 3.4:
+# 3ba3a3ee56c142e93d6bbe20ff6bf939212a30f0
+
+function PyCFunction_New
+    added 3.4
+function PyType_GetSlot
+    added 3.4
+
+# The following were added in PC/python3.def in Python 3.5:
+# 11d7b1423fc44d764eba7065ea5eba58ed748b21
+# f3b73ad51da3097d7915796fdc62608b1ab90c0a
+
+function PyErr_FormatV
+    added 3.5
+function PyModuleDef_Init
+    added 3.5
+data PyModuleDef_Type
+    added 3.5
+
+# New slots in 3.5:
+# d51374ed78a3e3145911a16cdf3b9b84b3ba7d15 - Matrix multiplication (PEP 465)
+# 7544508f0245173bff5866aa1598c8f6cce1fc5f - Async iterators (PEP 492)
+# 0969a9f8abcf98bb43ea77b1dd050426adcfb4f7 - tp_finalize
+
+const Py_nb_matrix_multiply
+    added 3.5
+const Py_nb_inplace_matrix_multiply
+    added 3.5
+const Py_am_await
+    added 3.5
+const Py_am_aiter
+    added 3.5
+const Py_am_anext
+    added 3.5
+const Py_tp_finalize
+    added 3.5
+
+# The following were added in PC/python3.def in Python 3.6:
+
+function Py_FinalizeEx
+    added 3.6
+
+function PyOS_FSPath
+    added 3.6
+function PyErr_ResourceWarning
+    added 3.6
+function PyErr_SetImportErrorSubclass
+    added 3.6
+data PyExc_ModuleNotFoundError
+    added 3.6
+
+# The following were added in PC/python3.def in Python 3.6.1 and 3.5.3/3.5.4:
+
+function PyCodec_NameReplaceErrors
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function PyErr_GetExcInfo
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function PyErr_SetExcInfo
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function PyErr_SetFromErrnoWithFilenameObjects
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function PyErr_SetImportError
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function PyErr_SyntaxLocationEx
+    added 3.7  # (and 3.6.1 and 3.5.3)
+data PyExc_BlockingIOError
+    added 3.7  # (and 3.6.1 and 3.5.3)
+data PyExc_BrokenPipeError
+    added 3.7  # (and 3.6.1 and 3.5.3)
+data PyExc_ChildProcessError
+    added 3.7  # (and 3.6.1 and 3.5.3)
+data PyExc_ConnectionAbortedError
+    added 3.7  # (and 3.6.1 and 3.5.3)
+data PyExc_ConnectionError
+    added 3.7  # (and 3.6.1 and 3.5.3)
+data PyExc_ConnectionRefusedError
+    added 3.7  # (and 3.6.1 and 3.5.3)
+data PyExc_ConnectionResetError
+    added 3.7  # (and 3.6.1 and 3.5.3)
+data PyExc_FileExistsError
+    added 3.7  # (and 3.6.1 and 3.5.3)
+data PyExc_FileNotFoundError
+    added 3.7  # (and 3.6.1 and 3.5.3)
+data PyExc_InterruptedError
+    added 3.7  # (and 3.6.1 and 3.5.3)
+data PyExc_IsADirectoryError
+    added 3.7  # (and 3.6.1 and 3.5.3)
+data PyExc_NotADirectoryError
+    added 3.7  # (and 3.6.1 and 3.5.3)
+data PyExc_PermissionError
+    added 3.7  # (and 3.6.1 and 3.5.3)
+data PyExc_ProcessLookupError
+    added 3.7  # (and 3.6.1 and 3.5.3)
+data PyExc_RecursionError
+    added 3.7  # (and 3.6.1 and 3.5.3)
+data PyExc_ResourceWarning
+    added 3.7  # (and 3.6.1 and 3.5.3)
+data PyExc_StopAsyncIteration
+    added 3.7  # (and 3.6.1 and 3.5.3)
+data PyExc_TimeoutError
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function PyImport_AddModuleObject
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function PyImport_ExecCodeModuleObject
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function PyImport_ImportFrozenModuleObject
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function PyImport_ImportModuleLevelObject
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function PyMem_Calloc
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function PyMemoryView_FromMemory
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function PyModule_AddFunctions
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function PyModule_ExecDef
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function PyModule_FromDefAndSpec2
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function PyModule_GetNameObject
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function PyModule_NewObject
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function PyModule_SetDocString
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function PyNumber_InPlaceMatrixMultiply
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function PyNumber_MatrixMultiply
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function PyObject_Calloc
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function PyObject_GenericSetDict
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function PySys_AddXOption
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function PySys_GetXOptions
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function PyUnicode_AsUCS4
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function PyUnicode_AsUCS4Copy
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function PyUnicode_AsWideCharString
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function PyUnicode_DecodeLocale
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function PyUnicode_DecodeLocaleAndSize
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function PyUnicode_EncodeLocale
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function PyUnicode_FindChar
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function PyUnicode_GetLength
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function PyUnicode_ReadChar
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function PyUnicode_Substring
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function PyUnicode_WriteChar
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function Py_DecodeLocale
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function Py_EncodeLocale
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function Py_SetPath
+    added 3.7  # (and 3.6.1 and 3.5.3)
+function _PyTrash_thread_deposit_object
+    added 3.7  # (and 3.6.1 and 3.5.3)
+    abi_only
+function _PyTrash_thread_destroy_chain
+    added 3.7  # (and 3.6.1 and 3.5.3)
+    abi_only
+function PyErr_SetExcFromWindowsErr
+    added 3.7  # (and 3.6.1 and 3.5.3)
+    ifdef MS_WINDOWS
+function PyErr_SetExcFromWindowsErrWithFilename
+    added 3.7  # (and 3.6.1 and 3.5.3)
+    ifdef MS_WINDOWS
+function PyErr_SetExcFromWindowsErrWithFilenameObject
+    added 3.7  # (and 3.6.1 and 3.5.3)
+    ifdef MS_WINDOWS
+function PyErr_SetExcFromWindowsErrWithFilenameObjects
+    added 3.7  # (and 3.6.1 and 3.5.3)
+    ifdef MS_WINDOWS
+function PyErr_SetFromWindowsErr
+    added 3.7  # (and 3.6.1 and 3.5.3)
+    ifdef MS_WINDOWS
+function PyErr_SetFromWindowsErrWithFilename
+    added 3.7  # (and 3.6.1 and 3.5.3)
+    ifdef MS_WINDOWS
+data PyExc_WindowsError
+    added 3.7  # (and 3.6.1 and 3.5.3)
+    ifdef MS_WINDOWS
+function PyOS_CheckStack
+    added 3.7  # (and 3.6.1 and 3.5.3)
+    ifdef USE_STACKCHECK
+function PyUnicode_AsMBCSString
+    added 3.7  # (and 3.6.1 and 3.5.3)
+    ifdef MS_WINDOWS
+function PyUnicode_DecodeCodePageStateful
+    added 3.7  # (and 3.6.1 and 3.5.3)
+    ifdef MS_WINDOWS
+function PyUnicode_DecodeMBCS
+    added 3.7  # (and 3.6.1 and 3.5.3)
+    ifdef MS_WINDOWS
+function PyUnicode_DecodeMBCSStateful
+    added 3.7  # (and 3.6.1 and 3.5.3)
+    ifdef MS_WINDOWS
+function PyUnicode_EncodeCodePage
+    added 3.7  # (and 3.6.1 and 3.5.3)
+    ifdef MS_WINDOWS
+
+# 3.5.4:
+function PySlice_AdjustIndices
+    added 3.7  # (and 3.6.1 and 3.5.4)
+function PySlice_Unpack
+    added 3.7  # (and 3.6.1 and 3.5.4)
+
+# The following were added in PC/python3.def in Python 3.7:
+
+function PyInterpreterState_GetID
+    added 3.7
+function PyThread_tss_alloc
+    added 3.7
+function PyThread_tss_create
+    added 3.7
+function PyThread_tss_delete
+    added 3.7
+function PyThread_tss_free
+    added 3.7
+function PyThread_tss_get
+    added 3.7
+function PyThread_tss_is_created
+    added 3.7
+function PyThread_tss_set
+    added 3.7
+function PyOS_BeforeFork
+    added 3.7
+    ifdef HAVE_FORK
+function PyOS_AfterFork_Parent
+    added 3.7
+    ifdef HAVE_FORK
+function PyOS_AfterFork_Child
+    added 3.7
+    ifdef HAVE_FORK
+
+# New method flags in 3.7 (PEP 590):
+
+const METH_FASTCALL
+    added 3.7
+const METH_METHOD
+    added 3.7
+
+# The following were added in PC/python3.def in Python 3.8:
+
+function PyImport_GetModule
+    added 3.8
+data Py_UTF8Mode
+    added 3.8
+function PyExceptionClass_Name
+    added 3.8
+function PyIndex_Check
+    added 3.8
+function PyIter_Check
+    added 3.8
+data PyDictRevIterItem_Type
+    added 3.8
+data PyDictRevIterKey_Type
+    added 3.8
+data PyDictRevIterValue_Type
+    added 3.8
+function PyInterpreterState_GetDict
+    added 3.8
+function Py_BytesMain
+    added 3.8
+
+# New type flag (PEP 590):
+
+const Py_TPFLAGS_METHOD_DESCRIPTOR
+    added 3.8
+
+# The following were added in PC/python3.def in Python 3.9:
+
+function Py_EnterRecursiveCall
+    added 3.9
+function Py_LeaveRecursiveCall
+    added 3.9
+function Py_GenericAlias
+    added 3.9
+data Py_GenericAliasType
+    added 3.9
+function PyCMethod_New
+    added 3.9  # Windows: 3.10 & 3.9.2 -- https://bugs.python.org/issue43155
+function PyInterpreterState_Get
+    added 3.9
+function PyObject_GC_IsFinalized
+    added 3.9
+function PyObject_GC_IsTracked
+    added 3.9
+
+# The following were added in PC/python3.def in Python 3.10:
+
+function Py_GetArgcArgv
+    added 3.10
+    abi_only
+function PyIter_Send
+    added 3.10
+function PyUnicode_AsUTF8AndSize
+    added 3.10
+function PyObject_GenericGetDict
+    added 3.10
+function Py_NewRef
+    added 3.10
+function Py_XNewRef
+    added 3.10
+function PyModule_AddType
+    added 3.10
+function PyType_FromModuleAndSpec
+    added 3.10
+function PyType_GetModule
+    added 3.10
+function PyType_GetModuleState
+    added 3.10
+function PyFrame_GetLineNumber
+    added 3.10
+function PyFrame_GetCode
+    added 3.10
+function PyObject_CallNoArgs
+    added 3.10
+function PyThreadState_GetFrame
+    added 3.10
+function PyThreadState_GetID
+    added 3.10
+function PyThreadState_GetInterpreter
+    added 3.10
+function PyModule_AddObjectRef
+    added 3.10
+data Py_FileSystemDefaultEncodeErrors
+    added 3.10
+function PyCodec_Unregister
+    added 3.10
+function PyErr_SetInterruptEx
+    added 3.10
+function Py_Is
+    added 3.10
+function Py_IsTrue
+    added 3.10
+function Py_IsFalse
+    added 3.10
+function Py_IsNone
+    added 3.10
+function _Py_IncRef
+    added 3.10
+    abi_only
+function _Py_DecRef
+    added 3.10
+    abi_only
+function PyAIter_Check
+    added 3.10
+function PyObject_GetAIter
+    added 3.10
+data PyExc_EncodingWarning
+    added 3.10
+
+# Support for Stable ABI in debug builds
+
+data _Py_RefTotal
+    added 3.10
+    abi_only
+    ifdef Py_REF_DEBUG
+function _Py_NegativeRefcount
+    added 3.10
+    abi_only
+    ifdef Py_REF_DEBUG
+
+# New slots in 3.10:
+
+const Py_am_send
+    added 3.10
+
+
+# New GC control functions in Py3.10 (https://bugs.python.org/issue28254)
+
+function PyGC_Disable
+    added 3.10
+function PyGC_Enable
+    added 3.10
+function PyGC_IsEnabled
+    added 3.10
+
+
+# (Detailed comments aren't really needed for further entries: from here on
+#  we can use version control logs.)
diff --git a/Modules/Setup b/Modules/Setup
index 02cfb67..87c6a15 100644
--- a/Modules/Setup
+++ b/Modules/Setup
@@ -105,13 +105,13 @@
 errno errnomodule.c			# posix (UNIX) errno values
 pwd pwdmodule.c				# this is needed to find out the user's home dir
 					# if $HOME is not set
-_sre _sre.c				# Fredrik Lundh's new regular expressions
+_sre -DPy_BUILD_CORE_BUILTIN _sre.c	# Fredrik Lundh's new regular expressions
 _codecs _codecsmodule.c			# access to the builtin codecs and codec registry
 _weakref _weakref.c			# weak references
 _functools -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal _functoolsmodule.c   # Tools for working with functions and callable objects
-_operator _operator.c	        	# operator.add() and similar goodies
+_operator -DPy_BUILD_CORE_BUILTIN _operator.c	        	# operator.add() and similar goodies
 _collections _collectionsmodule.c	# Container types
-_abc _abc.c				# Abstract base classes
+_abc -DPy_BUILD_CORE_BUILTIN _abc.c	# Abstract base classes
 itertools itertoolsmodule.c		# Functions creating iterators for efficient looping
 atexit atexitmodule.c			# Register functions to be run at interpreter-shutdown
 _signal -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal signalmodule.c
@@ -134,9 +134,6 @@
 # can call _PyTraceMalloc_NewReference().
 _tracemalloc _tracemalloc.c
 
-# PEG-based parser module -- slated to be *the* parser
-_peg_parser _peg_parser.c
-
 # The rest of the modules listed in this file are all commented out by
 # default.  Usually they can be detected and built as dynamically
 # loaded modules by the new setup.py script added in Python 2.1.  If
@@ -169,26 +166,26 @@
 
 # Modules that should always be present (non UNIX dependent):
 
-#array arraymodule.c	# array objects
+#array -DPy_BUILD_CORE_MODULE arraymodule.c	# array objects
 #cmath cmathmodule.c _math.c -DPy_BUILD_CORE_MODULE # -lm # complex math library functions
 #math mathmodule.c _math.c -DPy_BUILD_CORE_MODULE # -lm # math library functions, e.g. sin()
 #_contextvars _contextvarsmodule.c  # Context Variables
-#_struct _struct.c	# binary structure packing/unpacking
+#_struct -DPy_BUILD_CORE_MODULE _struct.c	# binary structure packing/unpacking
 #_weakref _weakref.c	# basic weak reference support
 #_testcapi _testcapimodule.c    # Python C API test module
 #_testinternalcapi _testinternalcapi.c -I$(srcdir)/Include/internal -DPy_BUILD_CORE_MODULE  # Python internal C API test module
 #_random _randommodule.c -DPy_BUILD_CORE_MODULE	# Random number generator
 #_elementtree -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI _elementtree.c	# elementtree accelerator
-#_pickle _pickle.c	# pickle accelerator
+#_pickle -DPy_BUILD_CORE_MODULE _pickle.c	# pickle accelerator
 #_datetime _datetimemodule.c	# datetime accelerator
-#_zoneinfo _zoneinfo.c	# zoneinfo accelerator
+#_zoneinfo _zoneinfo.c -DPy_BUILD_CORE_MODULE	# zoneinfo accelerator
 #_bisect _bisectmodule.c	# Bisection algorithms
-#_heapq _heapqmodule.c	# Heap queue algorithm
+#_heapq _heapqmodule.c -DPy_BUILD_CORE_MODULE	# Heap queue algorithm
 #_asyncio _asynciomodule.c  # Fast asyncio Future
 #_json -I$(srcdir)/Include/internal -DPy_BUILD_CORE_BUILTIN _json.c	# _json speedups
 #_statistics _statisticsmodule.c # statistics accelerator
 
-#unicodedata unicodedata.c    # static Unicode character database
+#unicodedata unicodedata.c -DPy_BUILD_CORE_BUILTIN   # static Unicode character database
 
 
 # Modules with some UNIX dependencies -- on by default:
@@ -210,11 +207,23 @@
 #_socket socketmodule.c
 
 # Socket module helper for SSL support; you must comment out the other
-# socket line above, and possibly edit the SSL variable:
-#SSL=/usr/local/ssl
-#_ssl _ssl.c \
-#	-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
-#	-L$(SSL)/lib -lssl -lcrypto
+# socket line above, and edit the OPENSSL variable:
+# OPENSSL=/path/to/openssl/directory
+# _ssl _ssl.c \
+#     -I$(OPENSSL)/include -L$(OPENSSL)/lib \
+#     -lssl -lcrypto
+#_hashlib _hashopenssl.c \
+#     -I$(OPENSSL)/include -L$(OPENSSL)/lib \
+#     -lcrypto
+
+# To statically link OpenSSL:
+# _ssl _ssl.c \
+#     -I$(OPENSSL)/include -L$(OPENSSL)/lib \
+#     -l:libssl.a -Wl,--exclude-libs,libssl.a \
+#     -l:libcrypto.a -Wl,--exclude-libs,libcrypto.a
+#_hashlib _hashopenssl.c \
+#     -I$(OPENSSL)/include -L$(OPENSSL)/lib \
+#     -l:libcrypto.a -Wl,--exclude-libs,libcrypto.a
 
 # The crypt module is now disabled by default because it breaks builds
 # on many systems (where -lcrypt is needed), e.g. Linux (I believe).
@@ -229,7 +238,7 @@
 #termios termios.c	# Steen Lumholt's termios module
 #resource resource.c	# Jeremy Hylton's rlimit interface
 
-#_posixsubprocess _posixsubprocess.c  # POSIX subprocess module helper
+#_posixsubprocess  -DPy_BUILD_CORE_BUILTIN _posixsubprocess.c  # POSIX subprocess module helper
 
 # Multimedia modules -- off by default.
 # These don't work for 64-bit platforms!!!
@@ -309,7 +318,7 @@
 # provided by the ncurses library.  e.g. on Linux, link with -lncurses
 # instead of -lcurses).
 
-#_curses _cursesmodule.c -lcurses -ltermcap
+#_curses _cursesmodule.c -lcurses -ltermcap -DPy_BUILD_CORE_MODULE
 # Wrapper for the panel library that's part of ncurses and SYSV curses.
 #_curses_panel _curses_panel.c -lpanel -lncurses
 
@@ -331,10 +340,6 @@
 # Helper module for various ascii-encoders
 #binascii binascii.c
 
-# Fred Drake's interface to the Python parser
-#parser parsermodule.c
-
-
 # Andrew Kuchling's zlib module.
 # This require zlib 1.1.3 (or later).
 # See http://www.gzip.org/zlib/
diff --git a/Modules/_abc.c b/Modules/_abc.c
index 709b52f..8aa6835 100644
--- a/Modules/_abc.c
+++ b/Modules/_abc.c
@@ -1,6 +1,7 @@
 /* ABCMeta implementation */
 
 #include "Python.h"
+#include "pycore_moduleobject.h"  // _PyModule_GetState()
 #include "clinic/_abc.c.h"
 
 /*[clinic input]
@@ -14,6 +15,7 @@
 _Py_IDENTIFIER(__abstractmethods__);
 _Py_IDENTIFIER(__class__);
 _Py_IDENTIFIER(__dict__);
+_Py_IDENTIFIER(__abc_tpflags__);
 _Py_IDENTIFIER(__bases__);
 _Py_IDENTIFIER(_abc_impl);
 _Py_IDENTIFIER(__subclasscheck__);
@@ -27,7 +29,7 @@
 static inline _abcmodule_state*
 get_abc_state(PyObject *module)
 {
-    void *state = PyModule_GetState(module);
+    void *state = _PyModule_GetState(module);
     assert(state != NULL);
     return (_abcmodule_state *)state;
 }
@@ -416,6 +418,8 @@
     return ret;
 }
 
+#define COLLECTION_FLAGS (Py_TPFLAGS_SEQUENCE | Py_TPFLAGS_MAPPING)
+
 /*[clinic input]
 _abc._abc_init
 
@@ -445,9 +449,64 @@
         return NULL;
     }
     Py_DECREF(data);
+    /* If __abc_tpflags__ & COLLECTION_FLAGS is set, then set the corresponding bit(s)
+     * in the new class.
+     * Used by collections.abc.Sequence and collections.abc.Mapping to indicate
+     * their special status w.r.t. pattern matching. */
+    if (PyType_Check(self)) {
+        PyTypeObject *cls = (PyTypeObject *)self;
+        PyObject *flags = _PyDict_GetItemIdWithError(cls->tp_dict, &PyId___abc_tpflags__);
+        if (flags == NULL) {
+            if (PyErr_Occurred()) {
+                return NULL;
+            }
+        }
+        else {
+            if (PyLong_CheckExact(flags)) {
+                long val = PyLong_AsLong(flags);
+                if (val == -1 && PyErr_Occurred()) {
+                    return NULL;
+                }
+                if ((val & COLLECTION_FLAGS) == COLLECTION_FLAGS) {
+                    PyErr_SetString(PyExc_TypeError, "__abc_tpflags__ cannot be both Py_TPFLAGS_SEQUENCE and Py_TPFLAGS_MAPPING");
+                    return NULL;
+                }
+                ((PyTypeObject *)self)->tp_flags |= (val & COLLECTION_FLAGS);
+            }
+            if (_PyDict_DelItemId(cls->tp_dict, &PyId___abc_tpflags__) < 0) {
+                return NULL;
+            }
+        }
+    }
     Py_RETURN_NONE;
 }
 
+static void
+set_collection_flag_recursive(PyTypeObject *child, unsigned long flag)
+{
+    assert(flag == Py_TPFLAGS_MAPPING || flag == Py_TPFLAGS_SEQUENCE);
+    if (PyType_HasFeature(child, Py_TPFLAGS_IMMUTABLETYPE) ||
+        (child->tp_flags & COLLECTION_FLAGS) == flag)
+    {
+        return;
+    }
+    child->tp_flags &= ~COLLECTION_FLAGS;
+    child->tp_flags |= flag;
+    PyObject *grandchildren = child->tp_subclasses;
+    if (grandchildren == NULL) {
+        return;
+    }
+    assert(PyDict_CheckExact(grandchildren));
+    Py_ssize_t i = 0;
+    while (PyDict_Next(grandchildren, &i, NULL, &grandchildren)) {
+        assert(PyWeakref_CheckRef(grandchildren));
+        PyObject *grandchild = PyWeakref_GET_OBJECT(grandchildren);
+        if (PyType_Check(grandchild)) {
+            set_collection_flag_recursive((PyTypeObject *)grandchild, flag);
+        }
+    }
+}
+
 /*[clinic input]
 _abc._abc_register
 
@@ -498,6 +557,13 @@
     /* Invalidate negative cache */
     get_abc_state(module)->abc_invalidation_counter++;
 
+    /* Set Py_TPFLAGS_SEQUENCE  or Py_TPFLAGS_MAPPING flag */
+    if (PyType_Check(self)) {
+        unsigned long collection_flag = ((PyTypeObject *)self)->tp_flags & COLLECTION_FLAGS;
+        if (collection_flag) {
+            set_collection_flag_recursive((PyTypeObject *)subclass, collection_flag);
+        }
+    }
     Py_INCREF(subclass);
     return subclass;
 }
@@ -891,14 +957,14 @@
 
 static struct PyModuleDef _abcmodule = {
     PyModuleDef_HEAD_INIT,
-    "_abc",
-    _abc__doc__,
-    sizeof(_abcmodule_state),
-    _abcmodule_methods,
-    _abcmodule_slots,
-    _abcmodule_traverse,
-    _abcmodule_clear,
-    _abcmodule_free,
+    .m_name = "_abc",
+    .m_doc = _abc__doc__,
+    .m_size = sizeof(_abcmodule_state),
+    .m_methods = _abcmodule_methods,
+    .m_slots = _abcmodule_slots,
+    .m_traverse = _abcmodule_traverse,
+    .m_clear = _abcmodule_clear,
+    .m_free = _abcmodule_free,
 };
 
 PyMODINIT_FUNC
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c
index b615c48..392e0e7 100644
--- a/Modules/_asynciomodule.c
+++ b/Modules/_asynciomodule.c
@@ -16,7 +16,6 @@
 _Py_IDENTIFIER(call_soon);
 _Py_IDENTIFIER(cancel);
 _Py_IDENTIFIER(get_event_loop);
-_Py_IDENTIFIER(send);
 _Py_IDENTIFIER(throw);
 
 
@@ -96,11 +95,6 @@
 
 typedef struct {
     PyObject_HEAD
-    TaskObj *ww_task;
-} TaskWakeupMethWrapper;
-
-typedef struct {
-    PyObject_HEAD
     PyObject *rl_loop;
 #if defined(HAVE_GETPID) && !defined(MS_WINDOWS)
     pid_t rl_pid;
@@ -325,7 +319,7 @@
 
 
 static PyObject *
-get_event_loop(void)
+get_event_loop(int stacklevel)
 {
     PyObject *loop;
     PyObject *policy;
@@ -337,6 +331,13 @@
         return loop;
     }
 
+    if (PyErr_WarnEx(PyExc_DeprecationWarning,
+                     "There is no current event loop",
+                     stacklevel))
+    {
+        return NULL;
+    }
+
     policy = PyObject_CallNoArgs(asyncio_get_event_loop_policy);
     if (policy == NULL) {
         return NULL;
@@ -495,7 +496,7 @@
     fut->fut_blocking = 0;
 
     if (loop == Py_None) {
-        loop = get_event_loop();
+        loop = get_event_loop(1);
         if (loop == NULL) {
             return -1;
         }
@@ -714,6 +715,7 @@
             else {
                 fut->fut_callbacks = PyList_New(1);
                 if (fut->fut_callbacks == NULL) {
+                    Py_DECREF(tup);
                     return NULL;
                 }
 
@@ -1474,17 +1476,11 @@
     PyErr_Restore(error_type, error_value, error_traceback);
 }
 
-static PyObject *
-future_cls_getitem(PyObject *cls, PyObject *type)
-{
-    Py_INCREF(cls);
-    return cls;
-}
-
 static PyAsyncMethods FutureType_as_async = {
     (unaryfunc)future_new_iter,         /* am_await */
     0,                                  /* am_aiter */
-    0                                   /* am_anext */
+    0,                                  /* am_anext */
+    0,                                  /* am_send  */
 };
 
 static PyMethodDef FutureType_methods[] = {
@@ -1500,7 +1496,7 @@
     _ASYNCIO_FUTURE_GET_LOOP_METHODDEF
     _ASYNCIO_FUTURE__MAKE_CANCELLED_ERROR_METHODDEF
     _ASYNCIO_FUTURE__REPR_INFO_METHODDEF
-    {"__class_getitem__", future_cls_getitem, METH_O|METH_CLASS, NULL},
+    {"__class_getitem__", Py_GenericAlias, METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
     {NULL, NULL}        /* Sentinel */
 };
 
@@ -1602,37 +1598,61 @@
     }
 }
 
-static PyObject *
-FutureIter_iternext(futureiterobject *it)
+static PySendResult
+FutureIter_am_send(futureiterobject *it,
+                   PyObject *Py_UNUSED(arg),
+                   PyObject **result)
 {
+    /* arg is unused, see the comment on FutureIter_send for clarification */
+
     PyObject *res;
     FutureObj *fut = it->future;
 
+    *result = NULL;
     if (fut == NULL) {
-        return NULL;
+        return PYGEN_ERROR;
     }
 
     if (fut->fut_state == STATE_PENDING) {
         if (!fut->fut_blocking) {
             fut->fut_blocking = 1;
             Py_INCREF(fut);
-            return (PyObject *)fut;
+            *result = (PyObject *)fut;
+            return PYGEN_NEXT;
         }
         PyErr_SetString(PyExc_RuntimeError,
                         "await wasn't used with future");
-        return NULL;
+        return PYGEN_ERROR;
     }
 
     it->future = NULL;
     res = _asyncio_Future_result_impl(fut);
     if (res != NULL) {
-        /* The result of the Future is not an exception. */
-        (void)_PyGen_SetStopIterationValue(res);
-        Py_DECREF(res);
+        Py_DECREF(fut);
+        *result = res;
+        return PYGEN_RETURN;
     }
 
     Py_DECREF(fut);
-    return NULL;
+    return PYGEN_ERROR;
+}
+
+static PyObject *
+FutureIter_iternext(futureiterobject *it)
+{
+    PyObject *result;
+    switch (FutureIter_am_send(it, Py_None, &result)) {
+        case PYGEN_RETURN:
+            (void)_PyGen_SetStopIterationValue(result);
+            Py_DECREF(result);
+            return NULL;
+        case PYGEN_NEXT:
+            return result;
+        case PYGEN_ERROR:
+            return NULL;
+        default:
+            Py_UNREACHABLE();
+    }
 }
 
 static PyObject *
@@ -1721,12 +1741,21 @@
     {NULL, NULL}        /* Sentinel */
 };
 
+static PyAsyncMethods FutureIterType_as_async = {
+    0,                                  /* am_await */
+    0,                                  /* am_aiter */
+    0,                                  /* am_anext */
+    (sendfunc)FutureIter_am_send,       /* am_send  */
+};
+
+
 static PyTypeObject FutureIterType = {
     PyVarObject_HEAD_INIT(NULL, 0)
     "_asyncio.FutureIter",
     .tp_basicsize = sizeof(futureiterobject),
     .tp_itemsize = 0,
     .tp_dealloc = (destructor)FutureIter_dealloc,
+    .tp_as_async = &FutureIterType_as_async,
     .tp_getattro = PyObject_GenericGetAttr,
     .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
     .tp_traverse = (traverseproc)FutureIter_traverse,
@@ -1870,93 +1899,15 @@
     return (PyObject*) o;
 }
 
-/* ----- Task._wakeup wrapper */
+/* ----- Task._wakeup implementation */
 
-static PyObject *
-TaskWakeupMethWrapper_call(TaskWakeupMethWrapper *o,
-                           PyObject *args, PyObject *kwds)
-{
-    PyObject *fut;
-
-    if (kwds != NULL && PyDict_GET_SIZE(kwds) != 0) {
-        PyErr_SetString(PyExc_TypeError, "function takes no keyword arguments");
-        return NULL;
-    }
-    if (!PyArg_ParseTuple(args, "O", &fut)) {
-        return NULL;
-    }
-
-    return task_wakeup(o->ww_task, fut);
-}
-
-static int
-TaskWakeupMethWrapper_clear(TaskWakeupMethWrapper *o)
-{
-    Py_CLEAR(o->ww_task);
-    return 0;
-}
-
-static int
-TaskWakeupMethWrapper_traverse(TaskWakeupMethWrapper *o,
-                               visitproc visit, void *arg)
-{
-    Py_VISIT(o->ww_task);
-    return 0;
-}
-
-static void
-TaskWakeupMethWrapper_dealloc(TaskWakeupMethWrapper *o)
-{
-    PyObject_GC_UnTrack(o);
-    (void)TaskWakeupMethWrapper_clear(o);
-    Py_TYPE(o)->tp_free(o);
-}
-
-static PyObject *
-TaskWakeupMethWrapper_get___self__(TaskWakeupMethWrapper *o, void *Py_UNUSED(ignored))
-{
-    if (o->ww_task) {
-        Py_INCREF(o->ww_task);
-        return (PyObject*)o->ww_task;
-    }
-    Py_RETURN_NONE;
-}
-
-static PyGetSetDef TaskWakeupMethWrapper_getsetlist[] = {
-    {"__self__", (getter)TaskWakeupMethWrapper_get___self__, NULL, NULL},
-    {NULL} /* Sentinel */
+static  PyMethodDef TaskWakeupDef = {
+    "task_wakeup",
+    (PyCFunction)task_wakeup,
+    METH_O,
+    NULL
 };
 
-static PyTypeObject TaskWakeupMethWrapper_Type = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "TaskWakeupMethWrapper",
-    .tp_basicsize = sizeof(TaskWakeupMethWrapper),
-    .tp_itemsize = 0,
-    .tp_dealloc = (destructor)TaskWakeupMethWrapper_dealloc,
-    .tp_call = (ternaryfunc)TaskWakeupMethWrapper_call,
-    .tp_getattro = PyObject_GenericGetAttr,
-    .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
-    .tp_traverse = (traverseproc)TaskWakeupMethWrapper_traverse,
-    .tp_clear = (inquiry)TaskWakeupMethWrapper_clear,
-    .tp_getset = TaskWakeupMethWrapper_getsetlist,
-};
-
-static PyObject *
-TaskWakeupMethWrapper_new(TaskObj *task)
-{
-    TaskWakeupMethWrapper *o;
-    o = PyObject_GC_New(TaskWakeupMethWrapper, &TaskWakeupMethWrapper_Type);
-    if (o == NULL) {
-        return NULL;
-    }
-
-    Py_INCREF(task);
-    o->ww_task = task;
-
-    PyObject_GC_Track(o);
-    return (PyObject*) o;
-}
-
 /* ----- Task introspection helpers */
 
 static int
@@ -2487,13 +2438,6 @@
     FutureObj_finalize((FutureObj*)task);
 }
 
-static PyObject *
-task_cls_getitem(PyObject *cls, PyObject *type)
-{
-    Py_INCREF(cls);
-    return cls;
-}
-
 static void TaskObj_dealloc(PyObject *);  /* Needs Task_CheckExact */
 
 static PyMethodDef TaskType_methods[] = {
@@ -2513,7 +2457,7 @@
     _ASYNCIO_TASK_GET_NAME_METHODDEF
     _ASYNCIO_TASK_SET_NAME_METHODDEF
     _ASYNCIO_TASK_GET_CORO_METHODDEF
-    {"__class_getitem__", task_cls_getitem, METH_O|METH_CLASS, NULL},
+    {"__class_getitem__", Py_GenericAlias, METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
     {NULL, NULL}        /* Sentinel */
 };
 
@@ -2620,6 +2564,20 @@
     Py_RETURN_NONE;
 }
 
+static inline int
+gen_status_from_result(PyObject **result)
+{
+    if (*result != NULL) {
+        return PYGEN_NEXT;
+    }
+    if (_PyGen_FetchStopIterationValue(result) == 0) {
+        return PYGEN_RETURN;
+    }
+
+    assert(PyErr_Occurred());
+    return PYGEN_ERROR;
+}
+
 static PyObject *
 task_step_impl(TaskObj *task, PyObject *exc)
 {
@@ -2678,26 +2636,23 @@
         return NULL;
     }
 
+    int gen_status = PYGEN_ERROR;
     if (exc == NULL) {
-        if (PyGen_CheckExact(coro) || PyCoro_CheckExact(coro)) {
-            result = _PyGen_Send((PyGenObject*)coro, Py_None);
-        }
-        else {
-            result = _PyObject_CallMethodIdOneArg(coro, &PyId_send, Py_None);
-        }
+        gen_status = PyIter_Send(coro, Py_None, &result);
     }
     else {
         result = _PyObject_CallMethodIdOneArg(coro, &PyId_throw, exc);
+        gen_status = gen_status_from_result(&result);
         if (clear_exc) {
             /* We created 'exc' during this call */
             Py_DECREF(exc);
         }
     }
 
-    if (result == NULL) {
+    if (gen_status == PYGEN_RETURN || gen_status == PYGEN_ERROR) {
         PyObject *et, *ev, *tb;
 
-        if (_PyGen_FetchStopIterationValue(&o) == 0) {
+        if (result != NULL) {
             /* The error is StopIteration and that means that
                the underlying coroutine has resolved */
 
@@ -2708,10 +2663,10 @@
                 res = future_cancel((FutureObj*)task, task->task_cancel_msg);
             }
             else {
-                res = future_set_result((FutureObj*)task, o);
+                res = future_set_result((FutureObj*)task, result);
             }
 
-            Py_DECREF(o);
+            Py_DECREF(result);
 
             if (res == NULL) {
                 return NULL;
@@ -2792,7 +2747,7 @@
         fut->fut_blocking = 0;
 
         /* result.add_done_callback(task._wakeup) */
-        wrapper = TaskWakeupMethWrapper_new(task);
+        wrapper = PyCFunction_New(&TaskWakeupDef, (PyObject *)task);
         if (wrapper == NULL) {
             goto fail;
         }
@@ -2873,7 +2828,7 @@
             goto fail;
         }
 
-        wrapper = TaskWakeupMethWrapper_new(task);
+        wrapper = PyCFunction_New(&TaskWakeupDef, (PyObject *)task);
         if (wrapper == NULL) {
             goto fail;
         }
@@ -3115,7 +3070,19 @@
 _asyncio_get_event_loop_impl(PyObject *module)
 /*[clinic end generated code: output=2a2d8b2f824c648b input=9364bf2916c8655d]*/
 {
-    return get_event_loop();
+    return get_event_loop(1);
+}
+
+/*[clinic input]
+_asyncio._get_event_loop
+    stacklevel: int = 3
+[clinic start generated code]*/
+
+static PyObject *
+_asyncio__get_event_loop_impl(PyObject *module, int stacklevel)
+/*[clinic end generated code: output=9c1d6d3c802e67c9 input=d17aebbd686f711d]*/
+{
+    return get_event_loop(stacklevel-1);
 }
 
 /*[clinic input]
@@ -3258,6 +3225,9 @@
 static void
 PyRunningLoopHolder_tp_dealloc(PyRunningLoopHolder *rl)
 {
+    if (cached_running_holder == (PyObject *)rl) {
+        cached_running_holder = NULL;
+    }
     Py_CLEAR(rl->rl_loop);
     PyObject_Free(rl);
 }
@@ -3325,17 +3295,14 @@
 module_init(void)
 {
     PyObject *module = NULL;
+    if (module_initialized) {
+        return 0;
+    }
 
     asyncio_mod = PyImport_ImportModule("asyncio");
     if (asyncio_mod == NULL) {
         goto fail;
     }
-    if (module_initialized != 0) {
-        return 0;
-    }
-    else {
-        module_initialized = 1;
-    }
 
     current_tasks = PyDict_New();
     if (current_tasks == NULL) {
@@ -3396,6 +3363,7 @@
         goto fail;
     }
 
+    module_initialized = 1;
     Py_DECREF(module);
     return 0;
 
@@ -3412,6 +3380,7 @@
 
 static PyMethodDef asyncio_methods[] = {
     _ASYNCIO_GET_EVENT_LOOP_METHODDEF
+    _ASYNCIO__GET_EVENT_LOOP_METHODDEF
     _ASYNCIO_GET_RUNNING_LOOP_METHODDEF
     _ASYNCIO__GET_RUNNING_LOOP_METHODDEF
     _ASYNCIO__SET_RUNNING_LOOP_METHODDEF
@@ -3447,9 +3416,6 @@
     if (PyType_Ready(&TaskStepMethWrapper_Type) < 0) {
         return NULL;
     }
-    if (PyType_Ready(&TaskWakeupMethWrapper_Type) < 0) {
-        return NULL;
-    }
     if (PyType_Ready(&PyRunningLoopHolder_Type) < 0) {
         return NULL;
     }
diff --git a/Modules/_bisectmodule.c b/Modules/_bisectmodule.c
index 82d800d..26c4b9b 100644
--- a/Modules/_bisectmodule.c
+++ b/Modules/_bisectmodule.c
@@ -16,7 +16,8 @@
 _Py_IDENTIFIER(insert);
 
 static inline Py_ssize_t
-internal_bisect_right(PyObject *list, PyObject *item, Py_ssize_t lo, Py_ssize_t hi)
+internal_bisect_right(PyObject *list, PyObject *item, Py_ssize_t lo, Py_ssize_t hi,
+                      PyObject* key)
 {
     PyObject *litem;
     Py_ssize_t mid;
@@ -39,6 +40,14 @@
         litem = PySequence_GetItem(list, mid);
         if (litem == NULL)
             return -1;
+        if (key != Py_None) {
+            PyObject *newitem = PyObject_CallOneArg(key, litem);
+            if (newitem == NULL) {
+                Py_DECREF(litem);
+                return -1;
+            }
+            Py_SETREF(litem, newitem);
+        }
         res = PyObject_RichCompareBool(item, litem, Py_LT);
         Py_DECREF(litem);
         if (res < 0)
@@ -58,12 +67,14 @@
     x: object
     lo: Py_ssize_t = 0
     hi: Py_ssize_t(c_default='-1', accept={int, NoneType}) = None
+    *
+    key: object = None
 
 Return the index where to insert item x in list a, assuming a is sorted.
 
 The return value i is such that all e in a[:i] have e <= x, and all e in
-a[i:] have e > x.  So if x already appears in the list, i points just
-beyond the rightmost x already there
+a[i:] have e > x.  So if x already appears in the list, a.insert(i, x) will
+insert just after the rightmost x already there.
 
 Optional args lo (default 0) and hi (default len(a)) bound the
 slice of a to be searched.
@@ -71,10 +82,10 @@
 
 static Py_ssize_t
 _bisect_bisect_right_impl(PyObject *module, PyObject *a, PyObject *x,
-                          Py_ssize_t lo, Py_ssize_t hi)
-/*[clinic end generated code: output=419e150cf1d2a235 input=e72212b282c83375]*/
+                          Py_ssize_t lo, Py_ssize_t hi, PyObject *key)
+/*[clinic end generated code: output=3a4bc09cc7c8a73d input=40fcc5afa06ae593]*/
 {
-    return internal_bisect_right(a, x, lo, hi);
+    return internal_bisect_right(a, x, lo, hi, key);
 }
 
 /*[clinic input]
@@ -84,6 +95,8 @@
     x: object
     lo: Py_ssize_t = 0
     hi: Py_ssize_t(c_default='-1', accept={int, NoneType}) = None
+    *
+    key: object = None
 
 Insert item x in list a, and keep it sorted assuming a is sorted.
 
@@ -95,11 +108,22 @@
 
 static PyObject *
 _bisect_insort_right_impl(PyObject *module, PyObject *a, PyObject *x,
-                          Py_ssize_t lo, Py_ssize_t hi)
-/*[clinic end generated code: output=c2caa3d4cd02035a input=d1c45bfa68182669]*/
+                          Py_ssize_t lo, Py_ssize_t hi, PyObject *key)
+/*[clinic end generated code: output=ac3bf26d07aedda2 input=44e1708e26b7b802]*/
 {
-    PyObject *result;
-    Py_ssize_t index = internal_bisect_right(a, x, lo, hi);
+    PyObject *result, *key_x;
+    Py_ssize_t index;
+
+    if (key == Py_None) {
+        index = internal_bisect_right(a, x, lo, hi, key);
+    } else {
+        key_x = PyObject_CallOneArg(key, x);
+        if (x == NULL) {
+            return NULL;
+        }
+        index = internal_bisect_right(a, key_x, lo, hi, key);
+        Py_DECREF(key_x);
+    }
     if (index < 0)
         return NULL;
     if (PyList_CheckExact(a)) {
@@ -117,7 +141,8 @@
 }
 
 static inline Py_ssize_t
-internal_bisect_left(PyObject *list, PyObject *item, Py_ssize_t lo, Py_ssize_t hi)
+internal_bisect_left(PyObject *list, PyObject *item, Py_ssize_t lo, Py_ssize_t hi,
+                     PyObject *key)
 {
     PyObject *litem;
     Py_ssize_t mid;
@@ -140,6 +165,14 @@
         litem = PySequence_GetItem(list, mid);
         if (litem == NULL)
             return -1;
+        if (key != Py_None) {
+            PyObject *newitem = PyObject_CallOneArg(key, litem);
+            if (newitem == NULL) {
+                Py_DECREF(litem);
+                return -1;
+            }
+            Py_SETREF(litem, newitem);
+        }
         res = PyObject_RichCompareBool(litem, item, Py_LT);
         Py_DECREF(litem);
         if (res < 0)
@@ -160,12 +193,14 @@
     x: object
     lo: Py_ssize_t = 0
     hi: Py_ssize_t(c_default='-1', accept={int, NoneType}) = None
+    *
+    key: object = None
 
 Return the index where to insert item x in list a, assuming a is sorted.
 
 The return value i is such that all e in a[:i] have e < x, and all e in
-a[i:] have e >= x.  So if x already appears in the list, i points just
-before the leftmost x already there.
+a[i:] have e >= x.  So if x already appears in the list, a.insert(i, x) will
+insert just before the leftmost x already there.
 
 Optional args lo (default 0) and hi (default len(a)) bound the
 slice of a to be searched.
@@ -173,10 +208,10 @@
 
 static Py_ssize_t
 _bisect_bisect_left_impl(PyObject *module, PyObject *a, PyObject *x,
-                         Py_ssize_t lo, Py_ssize_t hi)
-/*[clinic end generated code: output=af82168bc2856f24 input=2bd90f34afe5609f]*/
+                         Py_ssize_t lo, Py_ssize_t hi, PyObject *key)
+/*[clinic end generated code: output=70749d6e5cae9284 input=90dd35b50ceb05e3]*/
 {
-    return internal_bisect_left(a, x, lo, hi);
+    return internal_bisect_left(a, x, lo, hi, key);
 }
 
 
@@ -187,6 +222,8 @@
     x: object
     lo: Py_ssize_t = 0
     hi: Py_ssize_t(c_default='-1', accept={int, NoneType}) = None
+    *
+    key: object = None
 
 Insert item x in list a, and keep it sorted assuming a is sorted.
 
@@ -198,11 +235,22 @@
 
 static PyObject *
 _bisect_insort_left_impl(PyObject *module, PyObject *a, PyObject *x,
-                         Py_ssize_t lo, Py_ssize_t hi)
-/*[clinic end generated code: output=9e8356c0844a182b input=bc4583308bce00cc]*/
+                         Py_ssize_t lo, Py_ssize_t hi, PyObject *key)
+/*[clinic end generated code: output=b1d33e5e7ffff11e input=3ab65d8784f585b1]*/
 {
-    PyObject *result;
-    Py_ssize_t index = internal_bisect_left(a, x, lo, hi);
+    PyObject *result, *key_x;
+    Py_ssize_t index;
+
+    if (key == Py_None) {
+        index = internal_bisect_left(a, x, lo, hi, key);
+    } else {
+        key_x = PyObject_CallOneArg(key, x);
+        if (x == NULL) {
+            return NULL;
+        }
+        index = internal_bisect_left(a, key_x, lo, hi, key);
+        Py_DECREF(key_x);
+    }
     if (index < 0)
         return NULL;
     if (PyList_CheckExact(a)) {
@@ -237,18 +285,14 @@
 
 static struct PyModuleDef _bisectmodule = {
     PyModuleDef_HEAD_INIT,
-    "_bisect",
-    module_doc,
-    -1,
-    bisect_methods,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    .m_name = "_bisect",
+    .m_doc = module_doc,
+    .m_methods = bisect_methods,
+    .m_size = 0
 };
 
 PyMODINIT_FUNC
 PyInit__bisect(void)
 {
-    return PyModule_Create(&_bisectmodule);
+    return PyModuleDef_Init(&_bisectmodule);
 }
diff --git a/Modules/_blake2/blake2b_impl.c b/Modules/_blake2/blake2b_impl.c
index 7fb1296..8b0d60d 100644
--- a/Modules/_blake2/blake2b_impl.c
+++ b/Modules/_blake2/blake2b_impl.c
@@ -34,7 +34,7 @@
 #endif
 
 
-extern PyTypeObject PyBlake2_BLAKE2bType;
+extern PyType_Spec blake2b_type_spec;
 
 typedef struct {
     PyObject_HEAD
@@ -391,47 +391,24 @@
         PyThread_free_lock(obj->lock);
         obj->lock = NULL;
     }
-    PyObject_Del(self);
+
+    PyTypeObject *type = Py_TYPE(self);
+    PyObject_Free(self);
+    Py_DECREF(type);
 }
 
+static PyType_Slot blake2b_type_slots[] = {
+    {Py_tp_dealloc, py_blake2b_dealloc},
+    {Py_tp_doc, (char *)py_blake2b_new__doc__},
+    {Py_tp_methods, py_blake2b_methods},
+    {Py_tp_getset, py_blake2b_getsetters},
+    {Py_tp_new, py_blake2b_new},
+    {0,0}
+};
 
-PyTypeObject PyBlake2_BLAKE2bType = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "_blake2.blake2b",        /* tp_name            */
-    sizeof(BLAKE2bObject),    /* tp_basicsize       */
-    0,                        /* tp_itemsize        */
-    py_blake2b_dealloc,       /* tp_dealloc         */
-    0,                        /*tp_vectorcall_offset*/
-    0,                        /* tp_getattr         */
-    0,                        /* tp_setattr         */
-    0,                        /* tp_as_async        */
-    0,                        /* tp_repr            */
-    0,                        /* tp_as_number       */
-    0,                        /* tp_as_sequence     */
-    0,                        /* tp_as_mapping      */
-    0,                        /* tp_hash            */
-    0,                        /* tp_call            */
-    0,                        /* tp_str             */
-    0,                        /* tp_getattro        */
-    0,                        /* tp_setattro        */
-    0,                        /* tp_as_buffer       */
-    Py_TPFLAGS_DEFAULT,       /* tp_flags           */
-    py_blake2b_new__doc__,    /* tp_doc             */
-    0,                        /* tp_traverse        */
-    0,                        /* tp_clear           */
-    0,                        /* tp_richcompare     */
-    0,                        /* tp_weaklistoffset  */
-    0,                        /* tp_iter            */
-    0,                        /* tp_iternext        */
-    py_blake2b_methods,       /* tp_methods         */
-    0,                        /* tp_members         */
-    py_blake2b_getsetters,    /* tp_getset          */
-    0,                        /* tp_base            */
-    0,                        /* tp_dict            */
-    0,                        /* tp_descr_get       */
-    0,                        /* tp_descr_set       */
-    0,                        /* tp_dictoffset      */
-    0,                        /* tp_init            */
-    0,                        /* tp_alloc           */
-    py_blake2b_new,           /* tp_new             */
+PyType_Spec blake2b_type_spec = {
+    .name = "_blake2.blake2b",
+    .basicsize =  sizeof(BLAKE2bObject),
+    .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE,
+    .slots = blake2b_type_slots
 };
diff --git a/Modules/_blake2/blake2module.c b/Modules/_blake2/blake2module.c
index ff142c9..631de2c 100644
--- a/Modules/_blake2/blake2module.c
+++ b/Modules/_blake2/blake2module.c
@@ -12,62 +12,81 @@
 
 #include "impl/blake2.h"
 
-extern PyTypeObject PyBlake2_BLAKE2bType;
-extern PyTypeObject PyBlake2_BLAKE2sType;
-
+extern PyType_Spec blake2b_type_spec;
+extern PyType_Spec blake2s_type_spec;
 
 PyDoc_STRVAR(blake2mod__doc__,
 "_blake2b provides BLAKE2b for hashlib\n"
 );
 
+typedef struct {
+    PyTypeObject* blake2b_type;
+    PyTypeObject* blake2s_type;
+} Blake2State;
+
+static inline Blake2State*
+blake2_get_state(PyObject *module)
+{
+    void *state = PyModule_GetState(module);
+    assert(state != NULL);
+    return (Blake2State *)state;
+}
 
 static struct PyMethodDef blake2mod_functions[] = {
     {NULL, NULL}
 };
 
-static struct PyModuleDef blake2_module = {
-    PyModuleDef_HEAD_INIT,
-    "_blake2",
-    blake2mod__doc__,
-    -1,
-    blake2mod_functions,
-    NULL,
-    NULL,
-    NULL,
-    NULL
-};
+static int
+_blake2_traverse(PyObject *module, visitproc visit, void *arg)
+{
+    Blake2State *state = blake2_get_state(module);
+    Py_VISIT(state->blake2b_type);
+    Py_VISIT(state->blake2s_type);
+    return 0;
+}
+
+static int
+_blake2_clear(PyObject *module)
+{
+    Blake2State *state = blake2_get_state(module);
+    Py_CLEAR(state->blake2b_type);
+    Py_CLEAR(state->blake2s_type);
+    return 0;
+}
+
+static void
+_blake2_free(void *module)
+{
+    _blake2_clear((PyObject *)module);
+}
 
 #define ADD_INT(d, name, value) do { \
     PyObject *x = PyLong_FromLong(value); \
-    if (!x) { \
-        Py_DECREF(m); \
-        return NULL; \
-    } \
+    if (!x) \
+        return -1; \
     if (PyDict_SetItemString(d, name, x) < 0) { \
-        Py_DECREF(m); \
-        return NULL; \
+        Py_DECREF(x); \
+        return -1; \
     } \
     Py_DECREF(x); \
 } while(0)
 
-
-PyMODINIT_FUNC
-PyInit__blake2(void)
+static int
+blake2_exec(PyObject *m)
 {
-    PyObject *m;
-    PyObject *d;
+    Blake2State* st = blake2_get_state(m);
 
-    m = PyModule_Create(&blake2_module);
-    if (m == NULL)
-        return NULL;
+    st->blake2b_type = (PyTypeObject *)PyType_FromModuleAndSpec(
+        m, &blake2b_type_spec, NULL);
 
+    if (NULL == st->blake2b_type)
+        return -1;
     /* BLAKE2b */
-    Py_SET_TYPE(&PyBlake2_BLAKE2bType, &PyType_Type);
-    if (PyModule_AddType(m, &PyBlake2_BLAKE2bType) < 0) {
-        return NULL;
+    if (PyModule_AddType(m, st->blake2b_type) < 0) {
+        return -1;
     }
 
-    d = PyBlake2_BLAKE2bType.tp_dict;
+    PyObject *d = st->blake2b_type->tp_dict;
     ADD_INT(d, "SALT_SIZE", BLAKE2B_SALTBYTES);
     ADD_INT(d, "PERSON_SIZE", BLAKE2B_PERSONALBYTES);
     ADD_INT(d, "MAX_KEY_SIZE", BLAKE2B_KEYBYTES);
@@ -79,12 +98,17 @@
     PyModule_AddIntConstant(m, "BLAKE2B_MAX_DIGEST_SIZE", BLAKE2B_OUTBYTES);
 
     /* BLAKE2s */
-    Py_SET_TYPE(&PyBlake2_BLAKE2sType, &PyType_Type);
-    if (PyModule_AddType(m, &PyBlake2_BLAKE2sType) < 0) {
-        return NULL;
+    st->blake2s_type = (PyTypeObject *)PyType_FromModuleAndSpec(
+        m, &blake2s_type_spec, NULL);
+
+    if (NULL == st->blake2s_type)
+        return -1;
+
+    if (PyModule_AddType(m, st->blake2s_type) < 0) {
+        return -1;
     }
 
-    d = PyBlake2_BLAKE2sType.tp_dict;
+    d = st->blake2s_type->tp_dict;
     ADD_INT(d, "SALT_SIZE", BLAKE2S_SALTBYTES);
     ADD_INT(d, "PERSON_SIZE", BLAKE2S_PERSONALBYTES);
     ADD_INT(d, "MAX_KEY_SIZE", BLAKE2S_KEYBYTES);
@@ -95,5 +119,28 @@
     PyModule_AddIntConstant(m, "BLAKE2S_MAX_KEY_SIZE", BLAKE2S_KEYBYTES);
     PyModule_AddIntConstant(m, "BLAKE2S_MAX_DIGEST_SIZE", BLAKE2S_OUTBYTES);
 
-    return m;
+    return 0;
 }
+
+static PyModuleDef_Slot _blake2_slots[] = {
+    {Py_mod_exec, blake2_exec},
+    {0, NULL}
+};
+
+static struct PyModuleDef blake2_module = {
+    PyModuleDef_HEAD_INIT,
+    "_blake2",
+    .m_doc = blake2mod__doc__,
+    .m_size = sizeof(Blake2State),
+    .m_methods = blake2mod_functions,
+    .m_slots = _blake2_slots,
+    .m_traverse = _blake2_traverse,
+    .m_clear = _blake2_clear,
+    .m_free = _blake2_free,
+};
+
+PyMODINIT_FUNC
+PyInit__blake2(void)
+{
+    return PyModuleDef_Init(&blake2_module);
+}
\ No newline at end of file
diff --git a/Modules/_blake2/blake2s_impl.c b/Modules/_blake2/blake2s_impl.c
index e3e90d0..7ab3917 100644
--- a/Modules/_blake2/blake2s_impl.c
+++ b/Modules/_blake2/blake2s_impl.c
@@ -33,8 +33,7 @@
 #include "impl/blake2s-ref.c"
 #endif
 
-
-extern PyTypeObject PyBlake2_BLAKE2sType;
+extern PyType_Spec blake2s_type_spec;
 
 typedef struct {
     PyObject_HEAD
@@ -391,47 +390,24 @@
         PyThread_free_lock(obj->lock);
         obj->lock = NULL;
     }
-    PyObject_Del(self);
+
+    PyTypeObject *type = Py_TYPE(self);
+    PyObject_Free(self);
+    Py_DECREF(type);
 }
 
+static PyType_Slot blake2s_type_slots[] = {
+    {Py_tp_dealloc, py_blake2s_dealloc},
+    {Py_tp_doc, (char *)py_blake2s_new__doc__},
+    {Py_tp_methods, py_blake2s_methods},
+    {Py_tp_getset, py_blake2s_getsetters},
+    {Py_tp_new, py_blake2s_new},
+    {0,0}
+};
 
-PyTypeObject PyBlake2_BLAKE2sType = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "_blake2.blake2s",        /* tp_name            */
-    sizeof(BLAKE2sObject),    /* tp_basicsize       */
-    0,                        /* tp_itemsize        */
-    py_blake2s_dealloc,       /* tp_dealloc         */
-    0,                        /*tp_vectorcall_offset*/
-    0,                        /* tp_getattr         */
-    0,                        /* tp_setattr         */
-    0,                        /* tp_as_async        */
-    0,                        /* tp_repr            */
-    0,                        /* tp_as_number       */
-    0,                        /* tp_as_sequence     */
-    0,                        /* tp_as_mapping      */
-    0,                        /* tp_hash            */
-    0,                        /* tp_call            */
-    0,                        /* tp_str             */
-    0,                        /* tp_getattro        */
-    0,                        /* tp_setattro        */
-    0,                        /* tp_as_buffer       */
-    Py_TPFLAGS_DEFAULT,       /* tp_flags           */
-    py_blake2s_new__doc__,    /* tp_doc             */
-    0,                        /* tp_traverse        */
-    0,                        /* tp_clear           */
-    0,                        /* tp_richcompare     */
-    0,                        /* tp_weaklistoffset  */
-    0,                        /* tp_iter            */
-    0,                        /* tp_iternext        */
-    py_blake2s_methods,       /* tp_methods         */
-    0,                        /* tp_members         */
-    py_blake2s_getsetters,    /* tp_getset          */
-    0,                        /* tp_base            */
-    0,                        /* tp_dict            */
-    0,                        /* tp_descr_get       */
-    0,                        /* tp_descr_set       */
-    0,                        /* tp_dictoffset      */
-    0,                        /* tp_init            */
-    0,                        /* tp_alloc           */
-    py_blake2s_new,           /* tp_new             */
+PyType_Spec blake2s_type_spec = {
+    .name = "_blake2.blake2s",
+    .basicsize =  sizeof(BLAKE2sObject),
+    .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE,
+    .slots = blake2s_type_slots
 };
diff --git a/Modules/_blake2/clinic/blake2b_impl.c.h b/Modules/_blake2/clinic/blake2b_impl.c.h
index 07258c3..4e74e08 100644
--- a/Modules/_blake2/clinic/blake2b_impl.c.h
+++ b/Modules/_blake2/clinic/blake2b_impl.c.h
@@ -56,11 +56,6 @@
         goto skip_optional_kwonly;
     }
     if (fastargs[1]) {
-        if (PyFloat_Check(fastargs[1])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         digest_size = _PyLong_AsInt(fastargs[1]);
         if (digest_size == -1 && PyErr_Occurred()) {
             goto exit;
@@ -106,11 +101,6 @@
         }
     }
     if (fastargs[5]) {
-        if (PyFloat_Check(fastargs[5])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         fanout = _PyLong_AsInt(fastargs[5]);
         if (fanout == -1 && PyErr_Occurred()) {
             goto exit;
@@ -120,11 +110,6 @@
         }
     }
     if (fastargs[6]) {
-        if (PyFloat_Check(fastargs[6])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         depth = _PyLong_AsInt(fastargs[6]);
         if (depth == -1 && PyErr_Occurred()) {
             goto exit;
@@ -150,11 +135,6 @@
         }
     }
     if (fastargs[9]) {
-        if (PyFloat_Check(fastargs[9])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         node_depth = _PyLong_AsInt(fastargs[9]);
         if (node_depth == -1 && PyErr_Occurred()) {
             goto exit;
@@ -164,11 +144,6 @@
         }
     }
     if (fastargs[10]) {
-        if (PyFloat_Check(fastargs[10])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         inner_size = _PyLong_AsInt(fastargs[10]);
         if (inner_size == -1 && PyErr_Occurred()) {
             goto exit;
@@ -272,4 +247,4 @@
 {
     return _blake2_blake2b_hexdigest_impl(self);
 }
-/*[clinic end generated code: output=2d6d0fe9aa42a42a input=a9049054013a1b77]*/
+/*[clinic end generated code: output=10eb47aba77f192d input=a9049054013a1b77]*/
diff --git a/Modules/_blake2/clinic/blake2s_impl.c.h b/Modules/_blake2/clinic/blake2s_impl.c.h
index 71c5706..0f0d983 100644
--- a/Modules/_blake2/clinic/blake2s_impl.c.h
+++ b/Modules/_blake2/clinic/blake2s_impl.c.h
@@ -56,11 +56,6 @@
         goto skip_optional_kwonly;
     }
     if (fastargs[1]) {
-        if (PyFloat_Check(fastargs[1])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         digest_size = _PyLong_AsInt(fastargs[1]);
         if (digest_size == -1 && PyErr_Occurred()) {
             goto exit;
@@ -106,11 +101,6 @@
         }
     }
     if (fastargs[5]) {
-        if (PyFloat_Check(fastargs[5])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         fanout = _PyLong_AsInt(fastargs[5]);
         if (fanout == -1 && PyErr_Occurred()) {
             goto exit;
@@ -120,11 +110,6 @@
         }
     }
     if (fastargs[6]) {
-        if (PyFloat_Check(fastargs[6])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         depth = _PyLong_AsInt(fastargs[6]);
         if (depth == -1 && PyErr_Occurred()) {
             goto exit;
@@ -150,11 +135,6 @@
         }
     }
     if (fastargs[9]) {
-        if (PyFloat_Check(fastargs[9])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         node_depth = _PyLong_AsInt(fastargs[9]);
         if (node_depth == -1 && PyErr_Occurred()) {
             goto exit;
@@ -164,11 +144,6 @@
         }
     }
     if (fastargs[10]) {
-        if (PyFloat_Check(fastargs[10])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         inner_size = _PyLong_AsInt(fastargs[10]);
         if (inner_size == -1 && PyErr_Occurred()) {
             goto exit;
@@ -272,4 +247,4 @@
 {
     return _blake2_blake2s_hexdigest_impl(self);
 }
-/*[clinic end generated code: output=c80d8d06ce40a192 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=f7ee8092ed67e9c7 input=a9049054013a1b77]*/
diff --git a/Modules/_blake2/impl/blake2b-ref.c b/Modules/_blake2/impl/blake2b-ref.c
index 699f1a1..e58c436 100644
--- a/Modules/_blake2/impl/blake2b-ref.c
+++ b/Modules/_blake2/impl/blake2b-ref.c
@@ -333,7 +333,7 @@
     blake2b_increment_counter( S, BLAKE2B_BLOCKBYTES );
     blake2b_compress( S, S->buf );
     S->buflen -= BLAKE2B_BLOCKBYTES;
-    memcpy( S->buf, S->buf + BLAKE2B_BLOCKBYTES, S->buflen );
+    memmove( S->buf, S->buf + BLAKE2B_BLOCKBYTES, S->buflen );
   }
 
   blake2b_increment_counter( S, S->buflen );
diff --git a/Modules/_blake2/impl/blake2b.c b/Modules/_blake2/impl/blake2b.c
index 3d3e465..c1068e8 100644
--- a/Modules/_blake2/impl/blake2b.c
+++ b/Modules/_blake2/impl/blake2b.c
@@ -388,7 +388,7 @@
     blake2b_increment_counter( S, BLAKE2B_BLOCKBYTES );
     blake2b_compress( S, S->buf );
     S->buflen -= BLAKE2B_BLOCKBYTES;
-    memcpy( S->buf, S->buf + BLAKE2B_BLOCKBYTES, S->buflen );
+    memmove( S->buf, S->buf + BLAKE2B_BLOCKBYTES, S->buflen );
   }
 
   blake2b_increment_counter( S, S->buflen );
diff --git a/Modules/_blake2/impl/blake2s-ref.c b/Modules/_blake2/impl/blake2s-ref.c
index baf0b58..ab86cc1 100644
--- a/Modules/_blake2/impl/blake2s-ref.c
+++ b/Modules/_blake2/impl/blake2s-ref.c
@@ -323,7 +323,7 @@
     blake2s_increment_counter( S, BLAKE2S_BLOCKBYTES );
     blake2s_compress( S, S->buf );
     S->buflen -= BLAKE2S_BLOCKBYTES;
-    memcpy( S->buf, S->buf + BLAKE2S_BLOCKBYTES, S->buflen );
+    memmove( S->buf, S->buf + BLAKE2S_BLOCKBYTES, S->buflen );
   }
 
   blake2s_increment_counter( S, ( uint32_t )S->buflen );
diff --git a/Modules/_blake2/impl/blake2s.c b/Modules/_blake2/impl/blake2s.c
index 3a04328..4751468 100644
--- a/Modules/_blake2/impl/blake2s.c
+++ b/Modules/_blake2/impl/blake2s.c
@@ -363,7 +363,7 @@
     blake2s_increment_counter( S, BLAKE2S_BLOCKBYTES );
     blake2s_compress( S, S->buf );
     S->buflen -= BLAKE2S_BLOCKBYTES;
-    memcpy( S->buf, S->buf + BLAKE2S_BLOCKBYTES, S->buflen );
+    memmove( S->buf, S->buf + BLAKE2S_BLOCKBYTES, S->buflen );
   }
 
   blake2s_increment_counter( S, ( uint32_t )S->buflen );
diff --git a/Modules/_bz2module.c b/Modules/_bz2module.c
index 880632c..798e9ef 100644
--- a/Modules/_bz2module.c
+++ b/Modules/_bz2module.c
@@ -8,6 +8,59 @@
 #include <bzlib.h>
 #include <stdio.h>
 
+// Blocks output buffer wrappers
+#include "pycore_blocks_output_buffer.h"
+
+#if OUTPUT_BUFFER_MAX_BLOCK_SIZE > UINT32_MAX
+    #error "The maximum block size accepted by libbzip2 is UINT32_MAX."
+#endif
+
+/* On success, return value >= 0
+   On failure, return -1 */
+static inline Py_ssize_t
+OutputBuffer_InitAndGrow(_BlocksOutputBuffer *buffer, Py_ssize_t max_length,
+                         char **next_out, uint32_t *avail_out)
+{
+    Py_ssize_t allocated;
+
+    allocated = _BlocksOutputBuffer_InitAndGrow(
+                    buffer, max_length, (void**) next_out);
+    *avail_out = (uint32_t) allocated;
+    return allocated;
+}
+
+/* On success, return value >= 0
+   On failure, return -1 */
+static inline Py_ssize_t
+OutputBuffer_Grow(_BlocksOutputBuffer *buffer,
+                  char **next_out, uint32_t *avail_out)
+{
+    Py_ssize_t allocated;
+
+    allocated = _BlocksOutputBuffer_Grow(
+                    buffer, (void**) next_out, (Py_ssize_t) *avail_out);
+    *avail_out = (uint32_t) allocated;
+    return allocated;
+}
+
+static inline Py_ssize_t
+OutputBuffer_GetDataSize(_BlocksOutputBuffer *buffer, uint32_t avail_out)
+{
+    return _BlocksOutputBuffer_GetDataSize(buffer, (Py_ssize_t) avail_out);
+}
+
+static inline PyObject *
+OutputBuffer_Finish(_BlocksOutputBuffer *buffer, uint32_t avail_out)
+{
+    return _BlocksOutputBuffer_Finish(buffer, (Py_ssize_t) avail_out);
+}
+
+static inline void
+OutputBuffer_OnError(_BlocksOutputBuffer *buffer)
+{
+    _BlocksOutputBuffer_OnError(buffer);
+}
+
 
 #ifndef BZ_CONFIG_ERROR
 #define BZ2_bzCompress bzCompress
@@ -29,6 +82,19 @@
 
 
 typedef struct {
+    PyTypeObject *bz2_compressor_type;
+    PyTypeObject *bz2_decompressor_type;
+} _bz2_state;
+
+static inline _bz2_state*
+get_bz2_state(PyObject *module)
+{
+    void *state = PyModule_GetState(module);
+    assert(state != NULL);
+    return (_bz2_state *)state;
+}
+
+typedef struct {
     PyObject_HEAD
     bz_stream bzs;
     int flushed;
@@ -51,9 +117,6 @@
     PyThread_type_lock lock;
 } BZ2Decompressor;
 
-static PyTypeObject BZ2Compressor_Type;
-static PyTypeObject BZ2Decompressor_Type;
-
 /* Helper functions. */
 
 static int
@@ -105,52 +168,22 @@
     }
 }
 
-#if BUFSIZ < 8192
-#define INITIAL_BUFFER_SIZE 8192
-#else
-#define INITIAL_BUFFER_SIZE BUFSIZ
-#endif
-
-static int
-grow_buffer(PyObject **buf, Py_ssize_t max_length)
-{
-    /* Expand the buffer by an amount proportional to the current size,
-       giving us amortized linear-time behavior. Use a less-than-double
-       growth factor to avoid excessive allocation. */
-    size_t size = PyBytes_GET_SIZE(*buf);
-    size_t new_size = size + (size >> 3) + 6;
-
-    if (max_length > 0 && new_size > (size_t) max_length)
-        new_size = (size_t) max_length;
-
-    if (new_size > size) {
-        return _PyBytes_Resize(buf, new_size);
-    } else {  /* overflow */
-        PyErr_SetString(PyExc_OverflowError,
-                        "Unable to allocate buffer - output too large");
-        return -1;
-    }
-}
-
 
 /* BZ2Compressor class. */
 
 static PyObject *
 compress(BZ2Compressor *c, char *data, size_t len, int action)
 {
-    size_t data_size = 0;
     PyObject *result;
+    _BlocksOutputBuffer buffer = {.list = NULL};
 
-    result = PyBytes_FromStringAndSize(NULL, INITIAL_BUFFER_SIZE);
-    if (result == NULL)
-        return NULL;
-
+    if (OutputBuffer_InitAndGrow(&buffer, -1, &c->bzs.next_out, &c->bzs.avail_out) < 0) {
+        goto error;
+    }
     c->bzs.next_in = data;
     c->bzs.avail_in = 0;
-    c->bzs.next_out = PyBytes_AS_STRING(result);
-    c->bzs.avail_out = INITIAL_BUFFER_SIZE;
+
     for (;;) {
-        char *this_out;
         int bzerror;
 
         /* On a 64-bit system, len might not fit in avail_in (an unsigned int).
@@ -165,21 +198,15 @@
             break;
 
         if (c->bzs.avail_out == 0) {
-            size_t buffer_left = PyBytes_GET_SIZE(result) - data_size;
-            if (buffer_left == 0) {
-                if (grow_buffer(&result, -1) < 0)
-                    goto error;
-                c->bzs.next_out = PyBytes_AS_STRING(result) + data_size;
-                buffer_left = PyBytes_GET_SIZE(result) - data_size;
+            if (OutputBuffer_Grow(&buffer, &c->bzs.next_out, &c->bzs.avail_out) < 0) {
+                goto error;
             }
-            c->bzs.avail_out = (unsigned int)Py_MIN(buffer_left, UINT_MAX);
         }
 
         Py_BEGIN_ALLOW_THREADS
-        this_out = c->bzs.next_out;
         bzerror = BZ2_bzCompress(&c->bzs, action);
-        data_size += c->bzs.next_out - this_out;
         Py_END_ALLOW_THREADS
+
         if (catch_bz2_error(bzerror))
             goto error;
 
@@ -187,13 +214,14 @@
         if (action == BZ_FINISH && bzerror == BZ_STREAM_END)
             break;
     }
-    if (data_size != (size_t)PyBytes_GET_SIZE(result))
-        if (_PyBytes_Resize(&result, data_size) < 0)
-            goto error;
-    return result;
+
+    result = OutputBuffer_Finish(&buffer, c->bzs.avail_out);
+    if (result != NULL) {
+        return result;
+    }
 
 error:
-    Py_XDECREF(result);
+    OutputBuffer_OnError(&buffer);
     return NULL;
 }
 
@@ -280,21 +308,11 @@
     PyMem_RawFree(ptr);
 }
 
-/*[clinic input]
-_bz2.BZ2Compressor.__init__
 
-    compresslevel: int = 9
-        Compression level, as a number between 1 and 9.
-    /
-
-Create a compressor object for compressing data incrementally.
-
-For one-shot compression, use the compress() function instead.
-[clinic start generated code]*/
-
+/* Argument Clinic is not used since the Argument Clinic always want to
+   check the type which would be wrong here */
 static int
 _bz2_BZ2Compressor___init___impl(BZ2Compressor *self, int compresslevel)
-/*[clinic end generated code: output=c4e6adfd02963827 input=4e1ff7b8394b6e9a]*/
 {
     int bzerror;
 
@@ -325,13 +343,60 @@
     return -1;
 }
 
+PyDoc_STRVAR(_bz2_BZ2Compressor___init____doc__,
+"BZ2Compressor(compresslevel=9, /)\n"
+"--\n"
+"\n"
+"Create a compressor object for compressing data incrementally.\n"
+"\n"
+"  compresslevel\n"
+"    Compression level, as a number between 1 and 9.\n"
+"\n"
+"For one-shot compression, use the compress() function instead.");
+
+static int
+_bz2_BZ2Compressor___init__(PyObject *self, PyObject *args, PyObject *kwargs)
+{
+    int return_value = -1;
+    int compresslevel = 9;
+
+    if (!_PyArg_NoKeywords("BZ2Compressor", kwargs)) {
+        goto exit;
+    }
+    if (!_PyArg_CheckPositional("BZ2Compressor", PyTuple_GET_SIZE(args), 0, 1)) {
+        goto exit;
+    }
+    if (PyTuple_GET_SIZE(args) < 1) {
+        goto skip_optional;
+    }
+    compresslevel = _PyLong_AsInt(PyTuple_GET_ITEM(args, 0));
+    if (compresslevel == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+skip_optional:
+    return_value = _bz2_BZ2Compressor___init___impl((BZ2Compressor *)self, compresslevel);
+
+exit:
+    return return_value;
+}
+
 static void
 BZ2Compressor_dealloc(BZ2Compressor *self)
 {
     BZ2_bzCompressEnd(&self->bzs);
-    if (self->lock != NULL)
+    if (self->lock != NULL) {
         PyThread_free_lock(self->lock);
-    Py_TYPE(self)->tp_free((PyObject *)self);
+    }
+    PyTypeObject *tp = Py_TYPE(self);
+    tp->tp_free((PyObject *)self);
+    Py_DECREF(tp);
+}
+
+static int
+BZ2Compressor_traverse(BZ2Compressor *self, visitproc visit, void *arg)
+{
+    Py_VISIT(Py_TYPE(self));
+    return 0;
 }
 
 static PyMethodDef BZ2Compressor_methods[] = {
@@ -340,48 +405,26 @@
     {NULL}
 };
 
-
-static PyTypeObject BZ2Compressor_Type = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "_bz2.BZ2Compressor",               /* tp_name */
-    sizeof(BZ2Compressor),              /* tp_basicsize */
-    0,                                  /* tp_itemsize */
-    (destructor)BZ2Compressor_dealloc,  /* tp_dealloc */
-    0,                                  /* tp_vectorcall_offset */
-    0,                                  /* tp_getattr */
-    0,                                  /* tp_setattr */
-    0,                                  /* tp_as_async */
-    0,                                  /* tp_repr */
-    0,                                  /* tp_as_number */
-    0,                                  /* tp_as_sequence */
-    0,                                  /* tp_as_mapping */
-    0,                                  /* tp_hash  */
-    0,                                  /* tp_call */
-    0,                                  /* tp_str */
-    0,                                  /* tp_getattro */
-    0,                                  /* tp_setattro */
-    0,                                  /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT,                 /* tp_flags */
-    _bz2_BZ2Compressor___init____doc__,  /* tp_doc */
-    0,                                  /* tp_traverse */
-    0,                                  /* tp_clear */
-    0,                                  /* tp_richcompare */
-    0,                                  /* tp_weaklistoffset */
-    0,                                  /* tp_iter */
-    0,                                  /* tp_iternext */
-    BZ2Compressor_methods,              /* tp_methods */
-    0,                                  /* tp_members */
-    0,                                  /* tp_getset */
-    0,                                  /* tp_base */
-    0,                                  /* tp_dict */
-    0,                                  /* tp_descr_get */
-    0,                                  /* tp_descr_set */
-    0,                                  /* tp_dictoffset */
-    _bz2_BZ2Compressor___init__,        /* tp_init */
-    0,                                  /* tp_alloc */
-    PyType_GenericNew,                  /* tp_new */
+static PyType_Slot bz2_compressor_type_slots[] = {
+    {Py_tp_dealloc, BZ2Compressor_dealloc},
+    {Py_tp_methods, BZ2Compressor_methods},
+    {Py_tp_init, _bz2_BZ2Compressor___init__},
+    {Py_tp_new, PyType_GenericNew},
+    {Py_tp_doc, (char *)_bz2_BZ2Compressor___init____doc__},
+    {Py_tp_traverse, BZ2Compressor_traverse},
+    {0, 0}
 };
 
+static PyType_Spec bz2_compressor_type_spec = {
+    .name = "_bz2.BZ2Compressor",
+    .basicsize = sizeof(BZ2Compressor),
+    // Calling PyType_GetModuleState() on a subclass is not safe.
+    // bz2_compressor_type_spec does not have Py_TPFLAGS_BASETYPE flag
+    // which prevents to create a subclass.
+    // So calling PyType_GetModuleState() in this file is always safe.
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = bz2_compressor_type_slots,
+};
 
 /* BZ2Decompressor class. */
 
@@ -395,36 +438,29 @@
     /* data_size is strictly positive, but because we repeatedly have to
        compare against max_length and PyBytes_GET_SIZE we declare it as
        signed */
-    Py_ssize_t data_size = 0;
     PyObject *result;
+    _BlocksOutputBuffer buffer = {.list = NULL};
     bz_stream *bzs = &d->bzs;
 
-    if (max_length < 0 || max_length >= INITIAL_BUFFER_SIZE)
-        result = PyBytes_FromStringAndSize(NULL, INITIAL_BUFFER_SIZE);
-    else
-        result = PyBytes_FromStringAndSize(NULL, max_length);
-    if (result == NULL)
-        return NULL;
+    if (OutputBuffer_InitAndGrow(&buffer, max_length, &bzs->next_out, &bzs->avail_out) < 0) {
+        goto error;
+    }
 
-    bzs->next_out = PyBytes_AS_STRING(result);
     for (;;) {
         int bzret;
-        size_t avail;
-
         /* On a 64-bit system, buffer length might not fit in avail_out, so we
            do decompression in chunks of no more than UINT_MAX bytes
            each. Note that the expression for `avail` is guaranteed to be
            positive, so the cast is safe. */
-        avail = (size_t) (PyBytes_GET_SIZE(result) - data_size);
-        bzs->avail_out = (unsigned int)Py_MIN(avail, UINT_MAX);
         bzs->avail_in = (unsigned int)Py_MIN(d->bzs_avail_in_real, UINT_MAX);
         d->bzs_avail_in_real -= bzs->avail_in;
 
         Py_BEGIN_ALLOW_THREADS
         bzret = BZ2_bzDecompress(bzs);
-        data_size = bzs->next_out - PyBytes_AS_STRING(result);
-        d->bzs_avail_in_real += bzs->avail_in;
         Py_END_ALLOW_THREADS
+
+        d->bzs_avail_in_real += bzs->avail_in;
+
         if (catch_bz2_error(bzret))
             goto error;
         if (bzret == BZ_STREAM_END) {
@@ -433,22 +469,22 @@
         } else if (d->bzs_avail_in_real == 0) {
             break;
         } else if (bzs->avail_out == 0) {
-            if (data_size == max_length)
+            if (OutputBuffer_GetDataSize(&buffer, bzs->avail_out) == max_length) {
                 break;
-            if (data_size == PyBytes_GET_SIZE(result) &&
-                grow_buffer(&result, max_length) == -1)
+            }
+            if (OutputBuffer_Grow(&buffer, &bzs->next_out, &bzs->avail_out) < 0) {
                 goto error;
-            bzs->next_out = PyBytes_AS_STRING(result) + data_size;
+            }
         }
     }
-    if (data_size != PyBytes_GET_SIZE(result))
-        if (_PyBytes_Resize(&result, data_size) == -1)
-            goto error;
 
-    return result;
+    result = OutputBuffer_Finish(&buffer, bzs->avail_out);
+    if (result != NULL) {
+        return result;
+    }
 
 error:
-    Py_XDECREF(result);
+    OutputBuffer_OnError(&buffer);
     return NULL;
 }
 
@@ -601,17 +637,10 @@
     return result;
 }
 
-/*[clinic input]
-_bz2.BZ2Decompressor.__init__
-
-Create a decompressor object for decompressing data incrementally.
-
-For one-shot decompression, use the decompress() function instead.
-[clinic start generated code]*/
-
+/* Argument Clinic is not used since the Argument Clinic always want to
+   check the type which would be wrong here */
 static int
 _bz2_BZ2Decompressor___init___impl(BZ2Decompressor *self)
-/*[clinic end generated code: output=e4d2b9bb866ab8f1 input=95f6500dcda60088]*/
 {
     int bzerror;
 
@@ -646,16 +675,53 @@
     return -1;
 }
 
+static int
+_bz2_BZ2Decompressor___init__(PyObject *self, PyObject *args, PyObject *kwargs)
+{
+    int return_value = -1;
+
+    if (!_PyArg_NoPositional("BZ2Decompressor", args)) {
+        goto exit;
+    }
+    if (!_PyArg_NoKeywords("BZ2Decompressor", kwargs)) {
+        goto exit;
+    }
+    return_value = _bz2_BZ2Decompressor___init___impl((BZ2Decompressor *)self);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_bz2_BZ2Decompressor___init____doc__,
+"BZ2Decompressor()\n"
+"--\n"
+"\n"
+"Create a decompressor object for decompressing data incrementally.\n"
+"\n"
+"For one-shot decompression, use the decompress() function instead.");
+
 static void
 BZ2Decompressor_dealloc(BZ2Decompressor *self)
 {
-    if(self->input_buffer != NULL)
+    if(self->input_buffer != NULL) {
         PyMem_Free(self->input_buffer);
+    }
     BZ2_bzDecompressEnd(&self->bzs);
     Py_CLEAR(self->unused_data);
-    if (self->lock != NULL)
+    if (self->lock != NULL) {
         PyThread_free_lock(self->lock);
-    Py_TYPE(self)->tp_free((PyObject *)self);
+    }
+
+    PyTypeObject *tp = Py_TYPE(self);
+    tp->tp_free((PyObject *)self);
+    Py_DECREF(tp);
+}
+
+static int
+BZ2Decompressor_traverse(BZ2Decompressor *self, visitproc visit, void *arg)
+{
+    Py_VISIT(Py_TYPE(self));
+    return 0;
 }
 
 static PyMethodDef BZ2Decompressor_methods[] = {
@@ -682,64 +748,81 @@
     {NULL}
 };
 
-static PyTypeObject BZ2Decompressor_Type = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "_bz2.BZ2Decompressor",             /* tp_name */
-    sizeof(BZ2Decompressor),            /* tp_basicsize */
-    0,                                  /* tp_itemsize */
-    (destructor)BZ2Decompressor_dealloc,/* tp_dealloc */
-    0,                                  /* tp_vectorcall_offset */
-    0,                                  /* tp_getattr */
-    0,                                  /* tp_setattr */
-    0,                                  /* tp_as_async */
-    0,                                  /* tp_repr */
-    0,                                  /* tp_as_number */
-    0,                                  /* tp_as_sequence */
-    0,                                  /* tp_as_mapping */
-    0,                                  /* tp_hash  */
-    0,                                  /* tp_call */
-    0,                                  /* tp_str */
-    0,                                  /* tp_getattro */
-    0,                                  /* tp_setattro */
-    0,                                  /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT,                 /* tp_flags */
-    _bz2_BZ2Decompressor___init____doc__,  /* tp_doc */
-    0,                                  /* tp_traverse */
-    0,                                  /* tp_clear */
-    0,                                  /* tp_richcompare */
-    0,                                  /* tp_weaklistoffset */
-    0,                                  /* tp_iter */
-    0,                                  /* tp_iternext */
-    BZ2Decompressor_methods,            /* tp_methods */
-    BZ2Decompressor_members,            /* tp_members */
-    0,                                  /* tp_getset */
-    0,                                  /* tp_base */
-    0,                                  /* tp_dict */
-    0,                                  /* tp_descr_get */
-    0,                                  /* tp_descr_set */
-    0,                                  /* tp_dictoffset */
-    _bz2_BZ2Decompressor___init__,      /* tp_init */
-    0,                                  /* tp_alloc */
-    PyType_GenericNew,                  /* tp_new */
+static PyType_Slot bz2_decompressor_type_slots[] = {
+    {Py_tp_dealloc, BZ2Decompressor_dealloc},
+    {Py_tp_methods, BZ2Decompressor_methods},
+    {Py_tp_init, _bz2_BZ2Decompressor___init__},
+    {Py_tp_doc, (char *)_bz2_BZ2Decompressor___init____doc__},
+    {Py_tp_members, BZ2Decompressor_members},
+    {Py_tp_new, PyType_GenericNew},
+    {Py_tp_traverse, BZ2Decompressor_traverse},
+    {0, 0}
 };
 
+static PyType_Spec bz2_decompressor_type_spec = {
+    .name = "_bz2.BZ2Decompressor",
+    .basicsize = sizeof(BZ2Decompressor),
+    // Calling PyType_GetModuleState() on a subclass is not safe.
+    // bz2_decompressor_type_spec does not have Py_TPFLAGS_BASETYPE flag
+    // which prevents to create a subclass.
+    // So calling PyType_GetModuleState() in this file is always safe.
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = bz2_decompressor_type_slots,
+};
 
 /* Module initialization. */
 
 static int
 _bz2_exec(PyObject *module)
 {
-    if (PyModule_AddType(module, &BZ2Compressor_Type) < 0) {
+    _bz2_state *state = get_bz2_state(module);
+    state->bz2_compressor_type = (PyTypeObject *)PyType_FromModuleAndSpec(module,
+                                                            &bz2_compressor_type_spec, NULL);
+    if (state->bz2_compressor_type == NULL) {
         return -1;
     }
 
-    if (PyModule_AddType(module, &BZ2Decompressor_Type) < 0) {
+    if (PyModule_AddType(module, state->bz2_compressor_type) < 0) {
+        return -1;
+    }
+
+    state->bz2_decompressor_type = (PyTypeObject *)PyType_FromModuleAndSpec(module,
+                                                         &bz2_decompressor_type_spec, NULL);
+    if (state->bz2_decompressor_type == NULL) {
+        return -1;
+    }
+
+    if (PyModule_AddType(module, state->bz2_decompressor_type) < 0) {
         return -1;
     }
 
     return 0;
 }
 
+static int
+_bz2_traverse(PyObject *module, visitproc visit, void *arg)
+{
+    _bz2_state *state = get_bz2_state(module);
+    Py_VISIT(state->bz2_compressor_type);
+    Py_VISIT(state->bz2_decompressor_type);
+    return 0;
+}
+
+static int
+_bz2_clear(PyObject *module)
+{
+    _bz2_state *state = get_bz2_state(module);
+    Py_CLEAR(state->bz2_compressor_type);
+    Py_CLEAR(state->bz2_decompressor_type);
+    return 0;
+}
+
+static void
+_bz2_free(void *module)
+{
+    _bz2_clear((PyObject *)module);
+}
+
 static struct PyModuleDef_Slot _bz2_slots[] = {
     {Py_mod_exec, _bz2_exec},
     {0, NULL}
@@ -747,14 +830,12 @@
 
 static struct PyModuleDef _bz2module = {
     PyModuleDef_HEAD_INIT,
-    "_bz2",
-    NULL,
-    0,
-    NULL,
-    _bz2_slots,
-    NULL,
-    NULL,
-    NULL
+    .m_name = "_bz2",
+    .m_size = sizeof(_bz2_state),
+    .m_slots = _bz2_slots,
+    .m_traverse = _bz2_traverse,
+    .m_clear = _bz2_clear,
+    .m_free = _bz2_free,
 };
 
 PyMODINIT_FUNC
diff --git a/Modules/_codecsmodule.c b/Modules/_codecsmodule.c
index 9520721..50afc09 100644
--- a/Modules/_codecsmodule.c
+++ b/Modules/_codecsmodule.c
@@ -69,6 +69,27 @@
 }
 
 /*[clinic input]
+_codecs.unregister
+    search_function: object
+    /
+
+Unregister a codec search function and clear the registry's cache.
+
+If the search function is not registered, do nothing.
+[clinic start generated code]*/
+
+static PyObject *
+_codecs_unregister(PyObject *module, PyObject *search_function)
+/*[clinic end generated code: output=1f0edee9cf246399 input=dd7c004c652d345e]*/
+{
+    if (PyCodec_Unregister(search_function) < 0) {
+        return NULL;
+    }
+
+    Py_RETURN_NONE;
+}
+
+/*[clinic input]
 _codecs.lookup
     encoding: str
     /
@@ -139,25 +160,6 @@
 
 /* --- Helpers ------------------------------------------------------------ */
 
-/*[clinic input]
-_codecs._forget_codec
-
-    encoding: str
-    /
-
-Purge the named codec from the internal codec lookup cache
-[clinic start generated code]*/
-
-static PyObject *
-_codecs__forget_codec_impl(PyObject *module, const char *encoding)
-/*[clinic end generated code: output=0bde9f0a5b084aa2 input=18d5d92d0e386c38]*/
-{
-    if (_PyCodec_Forget(encoding) < 0) {
-        return NULL;
-    };
-    Py_RETURN_NONE;
-}
-
 static
 PyObject *codec_tuple(PyObject *decoded,
                       Py_ssize_t len)
@@ -487,34 +489,40 @@
 _codecs.unicode_escape_decode
     data: Py_buffer(accept={str, buffer})
     errors: str(accept={str, NoneType}) = None
+    final: bool(accept={int}) = True
     /
 [clinic start generated code]*/
 
 static PyObject *
 _codecs_unicode_escape_decode_impl(PyObject *module, Py_buffer *data,
-                                   const char *errors)
-/*[clinic end generated code: output=3ca3c917176b82ab input=8328081a3a569bd6]*/
+                                   const char *errors, int final)
+/*[clinic end generated code: output=b284f97b12c635ee input=6154f039a9f7c639]*/
 {
-    PyObject *decoded = PyUnicode_DecodeUnicodeEscape(data->buf, data->len,
-                                                      errors);
-    return codec_tuple(decoded, data->len);
+    Py_ssize_t consumed = data->len;
+    PyObject *decoded = _PyUnicode_DecodeUnicodeEscapeStateful(data->buf, data->len,
+                                                               errors,
+                                                               final ? NULL : &consumed);
+    return codec_tuple(decoded, consumed);
 }
 
 /*[clinic input]
 _codecs.raw_unicode_escape_decode
     data: Py_buffer(accept={str, buffer})
     errors: str(accept={str, NoneType}) = None
+    final: bool(accept={int}) = True
     /
 [clinic start generated code]*/
 
 static PyObject *
 _codecs_raw_unicode_escape_decode_impl(PyObject *module, Py_buffer *data,
-                                       const char *errors)
-/*[clinic end generated code: output=c98eeb56028070a6 input=d2f5159ce3b3392f]*/
+                                       const char *errors, int final)
+/*[clinic end generated code: output=11dbd96301e2879e input=2d166191beb3235a]*/
 {
-    PyObject *decoded = PyUnicode_DecodeRawUnicodeEscape(data->buf, data->len,
-                                                         errors);
-    return codec_tuple(decoded, data->len);
+    Py_ssize_t consumed = data->len;
+    PyObject *decoded = _PyUnicode_DecodeRawUnicodeEscapeStateful(data->buf, data->len,
+                                                                  errors,
+                                                                  final ? NULL : &consumed);
+    return codec_tuple(decoded, consumed);
 }
 
 /*[clinic input]
@@ -992,6 +1000,7 @@
 
 static PyMethodDef _codecs_functions[] = {
     _CODECS_REGISTER_METHODDEF
+    _CODECS_UNREGISTER_METHODDEF
     _CODECS_LOOKUP_METHODDEF
     _CODECS_ENCODE_METHODDEF
     _CODECS_DECODE_METHODDEF
@@ -1035,7 +1044,6 @@
     _CODECS_CODE_PAGE_DECODE_METHODDEF
     _CODECS_REGISTER_ERROR_METHODDEF
     _CODECS_LOOKUP_ERROR_METHODDEF
-    _CODECS__FORGET_CODEC_METHODDEF
     {NULL, NULL}                /* sentinel */
 };
 
diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c
index 7120e4d..eff03c7 100644
--- a/Modules/_collectionsmodule.c
+++ b/Modules/_collectionsmodule.c
@@ -1,4 +1,5 @@
 #include "Python.h"
+#include "pycore_long.h"          // _PyLong_GetZero()
 #include "structmember.h"         // PyMemberDef
 
 #ifdef STDC_HEADERS
@@ -898,9 +899,20 @@
 {
     Py_ssize_t n=1;
 
-    if (!_PyArg_ParseStack(args, nargs, "|n:rotate", &n)) {
+    if (!_PyArg_CheckPositional("deque.rotate", nargs, 0, 1)) {
         return NULL;
     }
+    if (nargs) {
+        PyObject *index = _PyNumber_Index(args[0]);
+        if (index == NULL) {
+            return NULL;
+        }
+        n = PyLong_AsSsize_t(index);
+        Py_DECREF(index);
+        if (n == -1 && PyErr_Occurred()) {
+            return NULL;
+        }
+    }
 
     if (!_deque_rotate(deque, n))
         Py_RETURN_NONE;
@@ -1146,38 +1158,6 @@
 PyDoc_STRVAR(insert_doc,
 "D.insert(index, object) -- insert object before index");
 
-static PyObject *
-deque_remove(dequeobject *deque, PyObject *value)
-{
-    Py_ssize_t i, n=Py_SIZE(deque);
-
-    for (i=0 ; i<n ; i++) {
-        PyObject *item = deque->leftblock->data[deque->leftindex];
-        int cmp = PyObject_RichCompareBool(item, value, Py_EQ);
-
-        if (Py_SIZE(deque) != n) {
-            PyErr_SetString(PyExc_IndexError,
-                "deque mutated during remove().");
-            return NULL;
-        }
-        if (cmp > 0) {
-            PyObject *tgt = deque_popleft(deque, NULL);
-            assert (tgt != NULL);
-            if (_deque_rotate(deque, i))
-                return NULL;
-            Py_DECREF(tgt);
-            Py_RETURN_NONE;
-        }
-        else if (cmp < 0) {
-            _deque_rotate(deque, i);
-            return NULL;
-        }
-        _deque_rotate(deque, -1);
-    }
-    PyErr_SetString(PyExc_ValueError, "deque.remove(x): x not in deque");
-    return NULL;
-}
-
 PyDoc_STRVAR(remove_doc,
 "D.remove(value) -- remove first occurrence of value.");
 
@@ -1245,6 +1225,48 @@
     return rv;
 }
 
+static PyObject *
+deque_remove(dequeobject *deque, PyObject *value)
+{
+    PyObject *item;
+    block *b = deque->leftblock;
+    Py_ssize_t i, n = Py_SIZE(deque), index = deque->leftindex;
+    size_t start_state = deque->state;
+    int cmp, rv;
+
+    for (i = 0 ; i < n; i++) {
+        item = b->data[index];
+        Py_INCREF(item);
+        cmp = PyObject_RichCompareBool(item, value, Py_EQ);
+        Py_DECREF(item);
+        if (cmp < 0) {
+            return NULL;
+        }
+        if (start_state != deque->state) {
+            PyErr_SetString(PyExc_IndexError,
+                            "deque mutated during iteration");
+            return NULL;
+        }
+        if (cmp > 0) {
+            break;
+        }
+        index++;
+        if (index == BLOCKLEN) {
+            b = b->rightlink;
+            index = 0;
+        }
+    }
+    if (i == n) {
+        PyErr_Format(PyExc_ValueError, "%R is not in deque", value);
+        return NULL;
+    }
+    rv = deque_del_item(deque, i);
+    if (rv == -1) {
+        return NULL;
+    }
+    Py_RETURN_NONE;
+}
+
 static int
 deque_ass_item(dequeobject *deque, Py_ssize_t i, PyObject *v)
 {
@@ -1640,7 +1662,8 @@
     PyObject_GenericGetAttr,            /* tp_getattro */
     0,                                  /* tp_setattro */
     0,                                  /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC,
+    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
+    Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_SEQUENCE,
                                         /* tp_flags */
     deque_doc,                          /* tp_doc */
     (traverseproc)deque_traverse,       /* tp_traverse */
@@ -2213,7 +2236,7 @@
 }
 
 PyDoc_STRVAR(defdict_doc,
-"defaultdict(default_factory[, ...]) --> dict with default factory\n\
+"defaultdict(default_factory=None, /, [...]) --> dict with default factory\n\
 \n\
 The default factory is called without arguments to produce\n\
 a new value when a key is not present, in __getitem__ only.\n\
@@ -2296,6 +2319,7 @@
     PyObject *dict_get;
     PyObject *mapping_setitem;
     PyObject *dict_setitem;
+    PyObject *one = _PyLong_GetOne();  // borrowed reference
 
     it = PyObject_GetIter(iterable);
     if (it == NULL)
@@ -2342,10 +2366,10 @@
             if (oldval == NULL) {
                 if (PyErr_Occurred())
                     goto done;
-                if (_PyDict_SetItem_KnownHash(mapping, key, _PyLong_One, hash) < 0)
+                if (_PyDict_SetItem_KnownHash(mapping, key, one, hash) < 0)
                     goto done;
             } else {
-                newval = PyNumber_Add(oldval, _PyLong_One);
+                newval = PyNumber_Add(oldval, one);
                 if (newval == NULL)
                     goto done;
                 if (_PyDict_SetItem_KnownHash(mapping, key, newval, hash) < 0)
@@ -2354,19 +2378,21 @@
             }
             Py_DECREF(key);
         }
-    } else {
+    }
+    else {
         bound_get = _PyObject_GetAttrId(mapping, &PyId_get);
         if (bound_get == NULL)
             goto done;
 
+        PyObject *zero = _PyLong_GetZero();  // borrowed reference
         while (1) {
             key = PyIter_Next(it);
             if (key == NULL)
                 break;
-            oldval = PyObject_CallFunctionObjArgs(bound_get, key, _PyLong_Zero, NULL);
+            oldval = PyObject_CallFunctionObjArgs(bound_get, key, zero, NULL);
             if (oldval == NULL)
                 break;
-            newval = PyNumber_Add(oldval, _PyLong_One);
+            newval = PyNumber_Add(oldval, one);
             Py_DECREF(oldval);
             if (newval == NULL)
                 break;
diff --git a/Modules/_contextvarsmodule.c b/Modules/_contextvarsmodule.c
index d6d7f37..d13b596 100644
--- a/Modules/_contextvarsmodule.c
+++ b/Modules/_contextvarsmodule.c
@@ -30,30 +30,15 @@
 static int
 _contextvars_exec(PyObject *m)
 {
-    Py_INCREF(&PyContext_Type);
-    if (PyModule_AddObject(m, "Context",
-                           (PyObject *)&PyContext_Type) < 0)
-    {
-        Py_DECREF(&PyContext_Type);
+    if (PyModule_AddType(m, &PyContext_Type) < 0) {
         return -1;
     }
-
-    Py_INCREF(&PyContextVar_Type);
-    if (PyModule_AddObject(m, "ContextVar",
-                           (PyObject *)&PyContextVar_Type) < 0)
-    {
-        Py_DECREF(&PyContextVar_Type);
+    if (PyModule_AddType(m, &PyContextVar_Type) < 0) {
         return -1;
     }
-
-    Py_INCREF(&PyContextToken_Type);
-    if (PyModule_AddObject(m, "Token",
-                           (PyObject *)&PyContextToken_Type) < 0)
-    {
-        Py_DECREF(&PyContextToken_Type);
+    if (PyModule_AddType(m, &PyContextToken_Type) < 0) {
         return -1;
     }
-
     return 0;
 }
 
diff --git a/Modules/_cryptmodule.c b/Modules/_cryptmodule.c
index a95f55a..72a4f44 100644
--- a/Modules/_cryptmodule.c
+++ b/Modules/_cryptmodule.c
@@ -4,6 +4,9 @@
 #include "Python.h"
 
 #include <sys/types.h>
+#ifdef HAVE_CRYPT_H
+#include <crypt.h>
+#endif
 
 /* Module crypt */
 
diff --git a/Modules/_csv.c b/Modules/_csv.c
index 59109b0..72f0791 100644
--- a/Modules/_csv.c
+++ b/Modules/_csv.c
@@ -18,9 +18,14 @@
 typedef struct {
     PyObject *error_obj;   /* CSV exception */
     PyObject *dialects;   /* Dialect registry */
+    PyTypeObject *dialect_type;
+    PyTypeObject *reader_type;
+    PyTypeObject *writer_type;
     long field_limit;   /* max parsed field size */
 } _csvstate;
 
+static struct PyModuleDef _csvmodule;
+
 static inline _csvstate*
 get_csv_state(PyObject *module)
 {
@@ -30,31 +35,35 @@
 }
 
 static int
-_csv_clear(PyObject *m)
+_csv_clear(PyObject *module)
 {
-    Py_CLEAR(get_csv_state(m)->error_obj);
-    Py_CLEAR(get_csv_state(m)->dialects);
+    _csvstate *module_state = PyModule_GetState(module);
+    Py_CLEAR(module_state->error_obj);
+    Py_CLEAR(module_state->dialects);
+    Py_CLEAR(module_state->dialect_type);
+    Py_CLEAR(module_state->reader_type);
+    Py_CLEAR(module_state->writer_type);
     return 0;
 }
 
 static int
-_csv_traverse(PyObject *m, visitproc visit, void *arg)
+_csv_traverse(PyObject *module, visitproc visit, void *arg)
 {
-    Py_VISIT(get_csv_state(m)->error_obj);
-    Py_VISIT(get_csv_state(m)->dialects);
+    _csvstate *module_state = PyModule_GetState(module);
+    Py_VISIT(module_state->error_obj);
+    Py_VISIT(module_state->dialects);
+    Py_VISIT(module_state->dialect_type);
+    Py_VISIT(module_state->reader_type);
+    Py_VISIT(module_state->writer_type);
     return 0;
 }
 
 static void
-_csv_free(void *m)
+_csv_free(void *module)
 {
-   _csv_clear((PyObject *)m);
+   _csv_clear((PyObject *)module);
 }
 
-static struct PyModuleDef _csvmodule;
-
-#define _csvstate_global ((_csvstate *)PyModule_GetState(PyState_FindModule(&_csvmodule)))
-
 typedef enum {
     START_RECORD, START_FIELD, ESCAPED_CHAR, IN_FIELD,
     IN_QUOTED_FIELD, ESCAPE_IN_QUOTED_FIELD, QUOTE_IN_QUOTED_FIELD,
@@ -92,8 +101,6 @@
 
 } DialectObj;
 
-static PyTypeObject Dialect_Type;
-
 typedef struct {
     PyObject_HEAD
 
@@ -110,10 +117,6 @@
     unsigned long line_num;     /* Source-file line number */
 } ReaderObj;
 
-static PyTypeObject Reader_Type;
-
-#define ReaderObject_Check(v)   Py_IS_TYPE(v, &Reader_Type)
-
 typedef struct {
     PyObject_HEAD
 
@@ -125,34 +128,28 @@
     Py_ssize_t rec_size;        /* size of allocated record */
     Py_ssize_t rec_len;         /* length of record */
     int num_fields;             /* number of fields in record */
-} WriterObj;
 
-static PyTypeObject Writer_Type;
+    PyObject *error_obj;       /* cached error object */
+} WriterObj;
 
 /*
  * DIALECT class
  */
 
 static PyObject *
-get_dialect_from_registry(PyObject * name_obj)
+get_dialect_from_registry(PyObject *name_obj, _csvstate *module_state)
 {
     PyObject *dialect_obj;
 
-    dialect_obj = PyDict_GetItemWithError(_csvstate_global->dialects, name_obj);
+    dialect_obj = PyDict_GetItemWithError(module_state->dialects, name_obj);
     if (dialect_obj == NULL) {
         if (!PyErr_Occurred())
-            PyErr_Format(_csvstate_global->error_obj, "unknown dialect");
+            PyErr_Format(module_state->error_obj, "unknown dialect");
     }
     else
         Py_INCREF(dialect_obj);
-    return dialect_obj;
-}
 
-static PyObject *
-get_string(PyObject *str)
-{
-    Py_XINCREF(str);
-    return str;
+    return dialect_obj;
 }
 
 static PyObject *
@@ -168,7 +165,8 @@
 static PyObject *
 Dialect_get_lineterminator(DialectObj *self, void *Py_UNUSED(ignored))
 {
-    return get_string(self->lineterminator);
+    Py_XINCREF(self->lineterminator);
+    return self->lineterminator;
 }
 
 static PyObject *
@@ -231,21 +229,24 @@
 }
 
 static int
-_set_char(const char *name, Py_UCS4 *target, PyObject *src, Py_UCS4 dflt)
+_set_char_or_none(const char *name, Py_UCS4 *target, PyObject *src, Py_UCS4 dflt)
 {
-    if (src == NULL)
+    if (src == NULL) {
         *target = dflt;
+    }
     else {
         *target = '\0';
         if (src != Py_None) {
-            Py_ssize_t len;
             if (!PyUnicode_Check(src)) {
                 PyErr_Format(PyExc_TypeError,
-                    "\"%s\" must be string, not %.200s", name,
+                    "\"%s\" must be string or None, not %.200s", name,
                     Py_TYPE(src)->tp_name);
                 return -1;
             }
-            len = PyUnicode_GetLength(src);
+            Py_ssize_t len = PyUnicode_GetLength(src);
+            if (len < 0) {
+                return -1;
+            }
             if (len > 1) {
                 PyErr_Format(PyExc_TypeError,
                     "\"%s\" must be a 1-character string",
@@ -253,8 +254,41 @@
                 return -1;
             }
             /* PyUnicode_READY() is called in PyUnicode_GetLength() */
-            if (len > 0)
+            else {
                 *target = PyUnicode_READ_CHAR(src, 0);
+            }
+        }
+    }
+    return 0;
+}
+
+static int
+_set_char(const char *name, Py_UCS4 *target, PyObject *src, Py_UCS4 dflt)
+{
+    if (src == NULL) {
+        *target = dflt;
+    }
+    else {
+        *target = '\0';
+        if (!PyUnicode_Check(src)) {
+            PyErr_Format(PyExc_TypeError,
+                         "\"%s\" must be string, not %.200s", name,
+                         Py_TYPE(src)->tp_name);
+                return -1;
+        }
+        Py_ssize_t len = PyUnicode_GetLength(src);
+        if (len < 0) {
+            return -1;
+        }
+        if (len > 1) {
+            PyErr_Format(PyExc_TypeError,
+                         "\"%s\" must be a 1-character string",
+                         name);
+            return -1;
+        }
+        /* PyUnicode_READY() is called in PyUnicode_GetLength() */
+        else {
+            *target = PyUnicode_READ_CHAR(src, 0);
         }
     }
     return 0;
@@ -317,8 +351,11 @@
 static void
 Dialect_dealloc(DialectObj *self)
 {
-    Py_XDECREF(self->lineterminator);
-    Py_TYPE(self)->tp_free((PyObject *)self);
+    PyTypeObject *tp = Py_TYPE(self);
+    PyObject_GC_UnTrack(self);
+    tp->tp_clear((PyObject *)self);
+    PyObject_GC_Del(self);
+    Py_DECREF(tp);
 }
 
 static char *dialect_kws[] = {
@@ -334,6 +371,22 @@
     NULL
 };
 
+static _csvstate *
+_csv_state_from_type(PyTypeObject *type, const char *name)
+{
+    PyObject *module = _PyType_GetModuleByDef(type, &_csvmodule);
+    if (module == NULL) {
+        return NULL;
+    }
+    _csvstate *module_state = PyModule_GetState(module);
+    if (module_state == NULL) {
+        PyErr_Format(PyExc_SystemError,
+                     "%s: No _csv module state found", name);
+        return NULL;
+    }
+    return module_state;
+}
+
 static PyObject *
 dialect_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
 {
@@ -362,16 +415,21 @@
                                      &strict))
         return NULL;
 
+    _csvstate *module_state = _csv_state_from_type(type, "dialect_new");
+    if (module_state == NULL) {
+        return NULL;
+    }
+
     if (dialect != NULL) {
         if (PyUnicode_Check(dialect)) {
-            dialect = get_dialect_from_registry(dialect);
+            dialect = get_dialect_from_registry(dialect, module_state);
             if (dialect == NULL)
                 return NULL;
         }
         else
             Py_INCREF(dialect);
         /* Can we reuse this instance? */
-        if (PyObject_TypeCheck(dialect, &Dialect_Type) &&
+        if (PyObject_TypeCheck(dialect, module_state->dialect_type) &&
             delimiter == NULL &&
             doublequote == NULL &&
             escapechar == NULL &&
@@ -385,7 +443,7 @@
 
     self = (DialectObj *)type->tp_alloc(type, 0);
     if (self == NULL) {
-        Py_XDECREF(dialect);
+        Py_CLEAR(dialect);
         return NULL;
     }
     self->lineterminator = NULL;
@@ -399,9 +457,14 @@
     Py_XINCREF(skipinitialspace);
     Py_XINCREF(strict);
     if (dialect != NULL) {
-#define DIALECT_GETATTR(v, n) \
-        if (v == NULL) \
-            v = PyObject_GetAttrString(dialect, n)
+#define DIALECT_GETATTR(v, n)                            \
+        do {                                             \
+            if (v == NULL) {                             \
+                v = PyObject_GetAttrString(dialect, n);  \
+                if (v == NULL)                           \
+                    PyErr_Clear();                       \
+            }                                            \
+        } while (0)
         DIALECT_GETATTR(delimiter, "delimiter");
         DIALECT_GETATTR(doublequote, "doublequote");
         DIALECT_GETATTR(escapechar, "escapechar");
@@ -410,7 +473,6 @@
         DIALECT_GETATTR(quoting, "quoting");
         DIALECT_GETATTR(skipinitialspace, "skipinitialspace");
         DIALECT_GETATTR(strict, "strict");
-        PyErr_Clear();
     }
 
     /* check types and convert to C values */
@@ -419,9 +481,9 @@
         goto err
     DIASET(_set_char, "delimiter", &self->delimiter, delimiter, ',');
     DIASET(_set_bool, "doublequote", &self->doublequote, doublequote, true);
-    DIASET(_set_char, "escapechar", &self->escapechar, escapechar, 0);
+    DIASET(_set_char_or_none, "escapechar", &self->escapechar, escapechar, 0);
     DIASET(_set_str, "lineterminator", &self->lineterminator, lineterminator, "\r\n");
-    DIASET(_set_char, "quotechar", &self->quotechar, quotechar, '"');
+    DIASET(_set_char_or_none, "quotechar", &self->quotechar, quotechar, '"');
     DIASET(_set_int, "quoting", &self->quoting, quoting, QUOTE_MINIMAL);
     DIASET(_set_bool, "skipinitialspace", &self->skipinitialspace, skipinitialspace, false);
     DIASET(_set_bool, "strict", &self->strict, strict, false);
@@ -449,76 +511,86 @@
     ret = (PyObject *)self;
     Py_INCREF(self);
 err:
-    Py_XDECREF(self);
-    Py_XDECREF(dialect);
-    Py_XDECREF(delimiter);
-    Py_XDECREF(doublequote);
-    Py_XDECREF(escapechar);
-    Py_XDECREF(lineterminator);
-    Py_XDECREF(quotechar);
-    Py_XDECREF(quoting);
-    Py_XDECREF(skipinitialspace);
-    Py_XDECREF(strict);
+    Py_CLEAR(self);
+    Py_CLEAR(dialect);
+    Py_CLEAR(delimiter);
+    Py_CLEAR(doublequote);
+    Py_CLEAR(escapechar);
+    Py_CLEAR(lineterminator);
+    Py_CLEAR(quotechar);
+    Py_CLEAR(quoting);
+    Py_CLEAR(skipinitialspace);
+    Py_CLEAR(strict);
     return ret;
 }
 
+/* Since dialect is now a heap type, it inherits pickling method for
+ * protocol 0 and 1 from object, therefore it needs to be overridden */
+
+PyDoc_STRVAR(dialect_reduce_doc, "raises an exception to avoid pickling");
+
+static PyObject *
+Dialect_reduce(PyObject *self, PyObject *args) {
+    PyErr_Format(PyExc_TypeError,
+        "cannot pickle '%.100s' instances", _PyType_Name(Py_TYPE(self)));
+    return NULL;
+}
+
+static struct PyMethodDef dialect_methods[] = {
+    {"__reduce__", Dialect_reduce, METH_VARARGS, dialect_reduce_doc},
+    {"__reduce_ex__", Dialect_reduce, METH_VARARGS, dialect_reduce_doc},
+    {NULL, NULL}
+};
 
 PyDoc_STRVAR(Dialect_Type_doc,
 "CSV dialect\n"
 "\n"
 "The Dialect type records CSV parsing and generation options.\n");
 
-static PyTypeObject Dialect_Type = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "_csv.Dialect",                         /* tp_name */
-    sizeof(DialectObj),                     /* tp_basicsize */
-    0,                                      /* tp_itemsize */
-    /*  methods  */
-    (destructor)Dialect_dealloc,            /* tp_dealloc */
-    0,                                      /* tp_vectorcall_offset */
-    (getattrfunc)0,                         /* tp_getattr */
-    (setattrfunc)0,                         /* tp_setattr */
-    0,                                      /* tp_as_async */
-    (reprfunc)0,                            /* tp_repr */
-    0,                                      /* tp_as_number */
-    0,                                      /* tp_as_sequence */
-    0,                                      /* tp_as_mapping */
-    (hashfunc)0,                            /* tp_hash */
-    (ternaryfunc)0,                         /* tp_call */
-    (reprfunc)0,                                /* tp_str */
-    0,                                      /* tp_getattro */
-    0,                                      /* tp_setattro */
-    0,                                      /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
-    Dialect_Type_doc,                       /* tp_doc */
-    0,                                      /* tp_traverse */
-    0,                                      /* tp_clear */
-    0,                                      /* tp_richcompare */
-    0,                                      /* tp_weaklistoffset */
-    0,                                      /* tp_iter */
-    0,                                      /* tp_iternext */
-    0,                                          /* tp_methods */
-    Dialect_memberlist,                     /* tp_members */
-    Dialect_getsetlist,                     /* tp_getset */
-    0,                                          /* tp_base */
-    0,                                          /* tp_dict */
-    0,                                          /* tp_descr_get */
-    0,                                          /* tp_descr_set */
-    0,                                          /* tp_dictoffset */
-    0,                                          /* tp_init */
-    0,                                          /* tp_alloc */
-    dialect_new,                                /* tp_new */
-    0,                                          /* tp_free */
+static int
+Dialect_clear(DialectObj *self)
+{
+    Py_CLEAR(self->lineterminator);
+    return 0;
+}
+
+static int
+Dialect_traverse(DialectObj *self, visitproc visit, void *arg)
+{
+    Py_VISIT(self->lineterminator);
+    Py_VISIT(Py_TYPE(self));
+    return 0;
+}
+
+static PyType_Slot Dialect_Type_slots[] = {
+    {Py_tp_doc, (char*)Dialect_Type_doc},
+    {Py_tp_members, Dialect_memberlist},
+    {Py_tp_getset, Dialect_getsetlist},
+    {Py_tp_new, dialect_new},
+    {Py_tp_methods, dialect_methods},
+    {Py_tp_dealloc, Dialect_dealloc},
+    {Py_tp_clear, Dialect_clear},
+    {Py_tp_traverse, Dialect_traverse},
+    {0, NULL}
 };
 
+PyType_Spec Dialect_Type_spec = {
+    .name = "_csv.Dialect",
+    .basicsize = sizeof(DialectObj),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC |
+              Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = Dialect_Type_slots,
+};
+
+
 /*
  * Return an instance of the dialect type, given a Python instance or kwarg
  * description of the dialect
  */
 static PyObject *
-_call_dialect(PyObject *dialect_inst, PyObject *kwargs)
+_call_dialect(_csvstate *module_state, PyObject *dialect_inst, PyObject *kwargs)
 {
-    PyObject *type = (PyObject *)&Dialect_Type;
+    PyObject *type = (PyObject *)module_state->dialect_type;
     if (dialect_inst) {
         return PyObject_VectorcallDict(type, &dialect_inst, 1, kwargs);
     }
@@ -576,11 +648,12 @@
 }
 
 static int
-parse_add_char(ReaderObj *self, Py_UCS4 c)
+parse_add_char(ReaderObj *self, _csvstate *module_state, Py_UCS4 c)
 {
-    if (self->field_len >= _csvstate_global->field_limit) {
-        PyErr_Format(_csvstate_global->error_obj, "field larger than field limit (%ld)",
-                     _csvstate_global->field_limit);
+    if (self->field_len >= module_state->field_limit) {
+        PyErr_Format(module_state->error_obj,
+                     "field larger than field limit (%ld)",
+                     module_state->field_limit);
         return -1;
     }
     if (self->field_len == self->field_size && !parse_grow_buff(self))
@@ -590,7 +663,7 @@
 }
 
 static int
-parse_process_char(ReaderObj *self, Py_UCS4 c)
+parse_process_char(ReaderObj *self, _csvstate *module_state, Py_UCS4 c)
 {
     DialectObj *dialect = self->dialect;
 
@@ -636,7 +709,7 @@
             /* begin new unquoted field */
             if (dialect->quoting == QUOTE_NONNUMERIC)
                 self->numeric_field = 1;
-            if (parse_add_char(self, c) < 0)
+            if (parse_add_char(self, module_state, c) < 0)
                 return -1;
             self->state = IN_FIELD;
         }
@@ -644,14 +717,14 @@
 
     case ESCAPED_CHAR:
         if (c == '\n' || c=='\r') {
-            if (parse_add_char(self, c) < 0)
+            if (parse_add_char(self, module_state, c) < 0)
                 return -1;
             self->state = AFTER_ESCAPED_CRNL;
             break;
         }
         if (c == '\0')
             c = '\n';
-        if (parse_add_char(self, c) < 0)
+        if (parse_add_char(self, module_state, c) < 0)
             return -1;
         self->state = IN_FIELD;
         break;
@@ -681,7 +754,7 @@
         }
         else {
             /* normal character - save in field */
-            if (parse_add_char(self, c) < 0)
+            if (parse_add_char(self, module_state, c) < 0)
                 return -1;
         }
         break;
@@ -707,7 +780,7 @@
         }
         else {
             /* normal character - save in field */
-            if (parse_add_char(self, c) < 0)
+            if (parse_add_char(self, module_state, c) < 0)
                 return -1;
         }
         break;
@@ -715,7 +788,7 @@
     case ESCAPE_IN_QUOTED_FIELD:
         if (c == '\0')
             c = '\n';
-        if (parse_add_char(self, c) < 0)
+        if (parse_add_char(self, module_state, c) < 0)
             return -1;
         self->state = IN_QUOTED_FIELD;
         break;
@@ -725,7 +798,7 @@
         if (dialect->quoting != QUOTE_NONE &&
             c == dialect->quotechar) {
             /* save "" as " */
-            if (parse_add_char(self, c) < 0)
+            if (parse_add_char(self, module_state, c) < 0)
                 return -1;
             self->state = IN_QUOTED_FIELD;
         }
@@ -742,13 +815,13 @@
             self->state = (c == '\0' ? START_RECORD : EAT_CRNL);
         }
         else if (!dialect->strict) {
-            if (parse_add_char(self, c) < 0)
+            if (parse_add_char(self, module_state, c) < 0)
                 return -1;
             self->state = IN_FIELD;
         }
         else {
             /* illegal */
-            PyErr_Format(_csvstate_global->error_obj, "'%c' expected after '%c'",
+            PyErr_Format(module_state->error_obj, "'%c' expected after '%c'",
                             dialect->delimiter,
                             dialect->quotechar);
             return -1;
@@ -761,7 +834,8 @@
         else if (c == '\0')
             self->state = START_RECORD;
         else {
-            PyErr_Format(_csvstate_global->error_obj, "new-line character seen in unquoted field - do you need to open the file in universal-newline mode?");
+            PyErr_Format(module_state->error_obj,
+                         "new-line character seen in unquoted field - do you need to open the file in universal-newline mode?");
             return -1;
         }
         break;
@@ -792,6 +866,12 @@
     const void *data;
     PyObject *lineobj;
 
+    _csvstate *module_state = _csv_state_from_type(Py_TYPE(self),
+                                                   "Reader.__next__");
+    if (module_state == NULL) {
+        return NULL;
+    }
+
     if (parse_reset(self) < 0)
         return NULL;
     do {
@@ -801,7 +881,7 @@
             if (!PyErr_Occurred() && (self->field_len != 0 ||
                                       self->state == IN_QUOTED_FIELD)) {
                 if (self->dialect->strict)
-                    PyErr_SetString(_csvstate_global->error_obj,
+                    PyErr_SetString(module_state->error_obj,
                                     "unexpected end of data");
                 else if (parse_save_field(self) >= 0)
                     break;
@@ -809,10 +889,10 @@
             return NULL;
         }
         if (!PyUnicode_Check(lineobj)) {
-            PyErr_Format(_csvstate_global->error_obj,
+            PyErr_Format(module_state->error_obj,
                          "iterator should return strings, "
                          "not %.200s "
-                         "(did you open the file in text mode?)",
+                         "(the file should be opened in text mode)",
                          Py_TYPE(lineobj)->tp_name
                 );
             Py_DECREF(lineobj);
@@ -831,18 +911,18 @@
             c = PyUnicode_READ(kind, data, pos);
             if (c == '\0') {
                 Py_DECREF(lineobj);
-                PyErr_Format(_csvstate_global->error_obj,
+                PyErr_Format(module_state->error_obj,
                              "line contains NUL");
                 goto err;
             }
-            if (parse_process_char(self, c) < 0) {
+            if (parse_process_char(self, module_state, c) < 0) {
                 Py_DECREF(lineobj);
                 goto err;
             }
             pos++;
         }
         Py_DECREF(lineobj);
-        if (parse_process_char(self, 0) < 0)
+        if (parse_process_char(self, module_state, 0) < 0)
             goto err;
     } while (self->state != START_RECORD);
 
@@ -855,13 +935,15 @@
 static void
 Reader_dealloc(ReaderObj *self)
 {
+    PyTypeObject *tp = Py_TYPE(self);
     PyObject_GC_UnTrack(self);
-    Py_XDECREF(self->dialect);
-    Py_XDECREF(self->input_iter);
-    Py_XDECREF(self->fields);
-    if (self->field != NULL)
+    tp->tp_clear((PyObject *)self);
+    if (self->field != NULL) {
         PyMem_Free(self->field);
+        self->field = NULL;
+    }
     PyObject_GC_Del(self);
+    Py_DECREF(tp);
 }
 
 static int
@@ -870,6 +952,7 @@
     Py_VISIT(self->dialect);
     Py_VISIT(self->input_iter);
     Py_VISIT(self->fields);
+    Py_VISIT(Py_TYPE(self));
     return 0;
 }
 
@@ -901,47 +984,35 @@
 };
 
 
-static PyTypeObject Reader_Type = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "_csv.reader",                          /*tp_name*/
-    sizeof(ReaderObj),                      /*tp_basicsize*/
-    0,                                      /*tp_itemsize*/
-    /* methods */
-    (destructor)Reader_dealloc,             /*tp_dealloc*/
-    0,                                      /*tp_vectorcall_offset*/
-    (getattrfunc)0,                         /*tp_getattr*/
-    (setattrfunc)0,                         /*tp_setattr*/
-    0,                                      /*tp_as_async*/
-    (reprfunc)0,                            /*tp_repr*/
-    0,                                      /*tp_as_number*/
-    0,                                      /*tp_as_sequence*/
-    0,                                      /*tp_as_mapping*/
-    (hashfunc)0,                            /*tp_hash*/
-    (ternaryfunc)0,                         /*tp_call*/
-    (reprfunc)0,                                /*tp_str*/
-    0,                                      /*tp_getattro*/
-    0,                                      /*tp_setattro*/
-    0,                                      /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
-        Py_TPFLAGS_HAVE_GC,                     /*tp_flags*/
-    Reader_Type_doc,                        /*tp_doc*/
-    (traverseproc)Reader_traverse,          /*tp_traverse*/
-    (inquiry)Reader_clear,                  /*tp_clear*/
-    0,                                      /*tp_richcompare*/
-    0,                                      /*tp_weaklistoffset*/
-    PyObject_SelfIter,                          /*tp_iter*/
-    (getiterfunc)Reader_iternext,           /*tp_iternext*/
-    Reader_methods,                         /*tp_methods*/
-    Reader_memberlist,                      /*tp_members*/
-    0,                                      /*tp_getset*/
-
+static PyType_Slot Reader_Type_slots[] = {
+    {Py_tp_doc, (char*)Reader_Type_doc},
+    {Py_tp_traverse, Reader_traverse},
+    {Py_tp_iter, PyObject_SelfIter},
+    {Py_tp_iternext, Reader_iternext},
+    {Py_tp_methods, Reader_methods},
+    {Py_tp_members, Reader_memberlist},
+    {Py_tp_clear, Reader_clear},
+    {Py_tp_dealloc, Reader_dealloc},
+    {0, NULL}
 };
 
+PyType_Spec Reader_Type_spec = {
+    .name = "_csv.reader",
+    .basicsize = sizeof(ReaderObj),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC |
+              Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = Reader_Type_slots
+};
+
+
 static PyObject *
 csv_reader(PyObject *module, PyObject *args, PyObject *keyword_args)
 {
     PyObject * iterator, * dialect = NULL;
-    ReaderObj * self = PyObject_GC_New(ReaderObj, &Reader_Type);
+    _csvstate *module_state = get_csv_state(module);
+    ReaderObj * self = PyObject_GC_New(
+        ReaderObj,
+        module_state->reader_type);
 
     if (!self)
         return NULL;
@@ -967,7 +1038,8 @@
         Py_DECREF(self);
         return NULL;
     }
-    self->dialect = (DialectObj *)_call_dialect(dialect, keyword_args);
+    self->dialect = (DialectObj *)_call_dialect(module_state, dialect,
+                                                keyword_args);
     if (self->dialect == NULL) {
         Py_DECREF(self);
         return NULL;
@@ -1048,12 +1120,15 @@
                     else
                         want_escape = 1;
                 }
+                else if (c == dialect->escapechar) {
+                    want_escape = 1;
+                }
                 if (!want_escape)
                     *quoted = 1;
             }
             if (want_escape) {
                 if (!dialect->escapechar) {
-                    PyErr_Format(_csvstate_global->error_obj,
+                    PyErr_Format(self->error_obj,
                                  "need to escape, but no escapechar set");
                     return -1;
                 }
@@ -1171,7 +1246,7 @@
     iter = PyObject_GetIter(seq);
     if (iter == NULL) {
         if (PyErr_ExceptionMatches(PyExc_TypeError)) {
-            PyErr_Format(_csvstate_global->error_obj,
+            PyErr_Format(self->error_obj,
                          "iterable expected, not %.200s",
                          Py_TYPE(seq)->tp_name);
         }
@@ -1228,7 +1303,7 @@
 
     if (self->num_fields > 0 && self->rec_len == 0) {
         if (dialect->quoting == QUOTE_NONE) {
-            PyErr_Format(_csvstate_global->error_obj,
+            PyErr_Format(self->error_obj,
                 "single empty field record must be quoted");
             return NULL;
         }
@@ -1297,22 +1372,13 @@
     { NULL }
 };
 
-static void
-Writer_dealloc(WriterObj *self)
-{
-    PyObject_GC_UnTrack(self);
-    Py_XDECREF(self->dialect);
-    Py_XDECREF(self->write);
-    if (self->rec != NULL)
-        PyMem_Free(self->rec);
-    PyObject_GC_Del(self);
-}
-
 static int
 Writer_traverse(WriterObj *self, visitproc visit, void *arg)
 {
     Py_VISIT(self->dialect);
     Py_VISIT(self->write);
+    Py_VISIT(self->error_obj);
+    Py_VISIT(Py_TYPE(self));
     return 0;
 }
 
@@ -1321,9 +1387,23 @@
 {
     Py_CLEAR(self->dialect);
     Py_CLEAR(self->write);
+    Py_CLEAR(self->error_obj);
     return 0;
 }
 
+static void
+Writer_dealloc(WriterObj *self)
+{
+    PyTypeObject *tp = Py_TYPE(self);
+    PyObject_GC_UnTrack(self);
+    tp->tp_clear((PyObject *)self);
+    if (self->rec != NULL) {
+        PyMem_Free(self->rec);
+    }
+    PyObject_GC_Del(self);
+    Py_DECREF(tp);
+}
+
 PyDoc_STRVAR(Writer_Type_doc,
 "CSV writer\n"
 "\n"
@@ -1331,46 +1411,31 @@
 "in CSV format from sequence input.\n"
 );
 
-static PyTypeObject Writer_Type = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "_csv.writer",                          /*tp_name*/
-    sizeof(WriterObj),                      /*tp_basicsize*/
-    0,                                      /*tp_itemsize*/
-    /* methods */
-    (destructor)Writer_dealloc,             /*tp_dealloc*/
-    0,                                      /*tp_vectorcall_offset*/
-    (getattrfunc)0,                         /*tp_getattr*/
-    (setattrfunc)0,                         /*tp_setattr*/
-    0,                                      /*tp_as_async*/
-    (reprfunc)0,                            /*tp_repr*/
-    0,                                      /*tp_as_number*/
-    0,                                      /*tp_as_sequence*/
-    0,                                      /*tp_as_mapping*/
-    (hashfunc)0,                            /*tp_hash*/
-    (ternaryfunc)0,                         /*tp_call*/
-    (reprfunc)0,                            /*tp_str*/
-    0,                                      /*tp_getattro*/
-    0,                                      /*tp_setattro*/
-    0,                                      /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
-        Py_TPFLAGS_HAVE_GC,                     /*tp_flags*/
-    Writer_Type_doc,
-    (traverseproc)Writer_traverse,          /*tp_traverse*/
-    (inquiry)Writer_clear,                  /*tp_clear*/
-    0,                                      /*tp_richcompare*/
-    0,                                      /*tp_weaklistoffset*/
-    (getiterfunc)0,                         /*tp_iter*/
-    (getiterfunc)0,                         /*tp_iternext*/
-    Writer_methods,                         /*tp_methods*/
-    Writer_memberlist,                      /*tp_members*/
-    0,                                      /*tp_getset*/
+static PyType_Slot Writer_Type_slots[] = {
+    {Py_tp_doc, (char*)Writer_Type_doc},
+    {Py_tp_traverse, Writer_traverse},
+    {Py_tp_clear, Writer_clear},
+    {Py_tp_dealloc, Writer_dealloc},
+    {Py_tp_methods, Writer_methods},
+    {Py_tp_members, Writer_memberlist},
+    {0, NULL}
 };
 
+PyType_Spec Writer_Type_spec = {
+    .name = "_csv.writer",
+    .basicsize = sizeof(WriterObj),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC |
+              Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = Writer_Type_slots,
+};
+
+
 static PyObject *
 csv_writer(PyObject *module, PyObject *args, PyObject *keyword_args)
 {
     PyObject * output_file, * dialect = NULL;
-    WriterObj * self = PyObject_GC_New(WriterObj, &Writer_Type);
+    _csvstate *module_state = get_csv_state(module);
+    WriterObj * self = PyObject_GC_New(WriterObj, module_state->writer_type);
     _Py_IDENTIFIER(write);
 
     if (!self)
@@ -1384,6 +1449,8 @@
     self->rec_len = 0;
     self->num_fields = 0;
 
+    self->error_obj = Py_NewRef(module_state->error_obj);
+
     if (!PyArg_UnpackTuple(args, "", 1, 2, &output_file, &dialect)) {
         Py_DECREF(self);
         return NULL;
@@ -1398,7 +1465,8 @@
         Py_DECREF(self);
         return NULL;
     }
-    self->dialect = (DialectObj *)_call_dialect(dialect, keyword_args);
+    self->dialect = (DialectObj *)_call_dialect(module_state, dialect,
+                                                keyword_args);
     if (self->dialect == NULL) {
         Py_DECREF(self);
         return NULL;
@@ -1413,13 +1481,14 @@
 static PyObject *
 csv_list_dialects(PyObject *module, PyObject *args)
 {
-    return PyDict_Keys(_csvstate_global->dialects);
+    return PyDict_Keys(get_csv_state(module)->dialects);
 }
 
 static PyObject *
 csv_register_dialect(PyObject *module, PyObject *args, PyObject *kwargs)
 {
     PyObject *name_obj, *dialect_obj = NULL;
+    _csvstate *module_state = get_csv_state(module);
     PyObject *dialect;
 
     if (!PyArg_UnpackTuple(args, "", 1, 2, &name_obj, &dialect_obj))
@@ -1431,10 +1500,10 @@
     }
     if (PyUnicode_READY(name_obj) == -1)
         return NULL;
-    dialect = _call_dialect(dialect_obj, kwargs);
+    dialect = _call_dialect(module_state, dialect_obj, kwargs);
     if (dialect == NULL)
         return NULL;
-    if (PyDict_SetItem(_csvstate_global->dialects, name_obj, dialect) < 0) {
+    if (PyDict_SetItem(module_state->dialects, name_obj, dialect) < 0) {
         Py_DECREF(dialect);
         return NULL;
     }
@@ -1445,9 +1514,10 @@
 static PyObject *
 csv_unregister_dialect(PyObject *module, PyObject *name_obj)
 {
-    if (PyDict_DelItem(_csvstate_global->dialects, name_obj) < 0) {
+    _csvstate *module_state = get_csv_state(module);
+    if (PyDict_DelItem(module_state->dialects, name_obj) < 0) {
         if (PyErr_ExceptionMatches(PyExc_KeyError)) {
-            PyErr_Format(_csvstate_global->error_obj, "unknown dialect");
+            PyErr_Format(module_state->error_obj, "unknown dialect");
         }
         return NULL;
     }
@@ -1457,14 +1527,15 @@
 static PyObject *
 csv_get_dialect(PyObject *module, PyObject *name_obj)
 {
-    return get_dialect_from_registry(name_obj);
+    return get_dialect_from_registry(name_obj, get_csv_state(module));
 }
 
 static PyObject *
 csv_field_size_limit(PyObject *module, PyObject *args)
 {
     PyObject *new_limit = NULL;
-    long old_limit = _csvstate_global->field_limit;
+    _csvstate *module_state = get_csv_state(module);
+    long old_limit = module_state->field_limit;
 
     if (!PyArg_UnpackTuple(args, "field_size_limit", 0, 1, &new_limit))
         return NULL;
@@ -1474,15 +1545,25 @@
                          "limit must be an integer");
             return NULL;
         }
-        _csvstate_global->field_limit = PyLong_AsLong(new_limit);
-        if (_csvstate_global->field_limit == -1 && PyErr_Occurred()) {
-            _csvstate_global->field_limit = old_limit;
+        module_state->field_limit = PyLong_AsLong(new_limit);
+        if (module_state->field_limit == -1 && PyErr_Occurred()) {
+            module_state->field_limit = old_limit;
             return NULL;
         }
     }
     return PyLong_FromLong(old_limit);
 }
 
+static PyType_Slot error_slots[] = {
+    {0, NULL},
+};
+
+PyType_Spec error_spec = {
+    .name = "_csv.Error",
+    .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+    .slots = error_slots,
+};
+
 /*
  * MODULE
  */
@@ -1615,13 +1696,82 @@
     { NULL, NULL }
 };
 
+static int
+csv_exec(PyObject *module) {
+    const StyleDesc *style;
+    PyObject *temp;
+    _csvstate *module_state = get_csv_state(module);
+
+    temp = PyType_FromModuleAndSpec(module, &Dialect_Type_spec, NULL);
+    module_state->dialect_type = (PyTypeObject *)temp;
+    if (PyModule_AddObjectRef(module, "Dialect", temp) < 0) {
+        return -1;
+    }
+
+    temp = PyType_FromModuleAndSpec(module, &Reader_Type_spec, NULL);
+    module_state->reader_type = (PyTypeObject *)temp;
+    if (PyModule_AddObjectRef(module, "Reader", temp) < 0) {
+        return -1;
+    }
+
+    temp = PyType_FromModuleAndSpec(module, &Writer_Type_spec, NULL);
+    module_state->writer_type = (PyTypeObject *)temp;
+    if (PyModule_AddObjectRef(module, "Writer", temp) < 0) {
+        return -1;
+    }
+
+    /* Add version to the module. */
+    if (PyModule_AddStringConstant(module, "__version__",
+                                   MODULE_VERSION) == -1) {
+        return -1;
+    }
+
+    /* Set the field limit */
+    module_state->field_limit = 128 * 1024;
+
+    /* Add _dialects dictionary */
+    module_state->dialects = PyDict_New();
+    if (PyModule_AddObjectRef(module, "_dialects", module_state->dialects) < 0) {
+        return -1;
+    }
+
+    /* Add quote styles into dictionary */
+    for (style = quote_styles; style->name; style++) {
+        if (PyModule_AddIntConstant(module, style->name,
+                                    style->style) == -1)
+            return -1;
+    }
+
+    /* Add the CSV exception object to the module. */
+    PyObject *bases = PyTuple_Pack(1, PyExc_Exception);
+    if (bases == NULL) {
+        return -1;
+    }
+    module_state->error_obj = PyType_FromModuleAndSpec(module, &error_spec,
+                                                       bases);
+    Py_DECREF(bases);
+    if (module_state->error_obj == NULL) {
+        return -1;
+    }
+    if (PyModule_AddType(module, (PyTypeObject *)module_state->error_obj) != 0) {
+        return -1;
+    }
+
+    return 0;
+}
+
+static PyModuleDef_Slot csv_slots[] = {
+    {Py_mod_exec, csv_exec},
+    {0, NULL}
+};
+
 static struct PyModuleDef _csvmodule = {
     PyModuleDef_HEAD_INIT,
     "_csv",
     csv_module_doc,
     sizeof(_csvstate),
     csv_methods,
-    NULL,
+    csv_slots,
     _csv_traverse,
     _csv_clear,
     _csv_free
@@ -1630,53 +1780,5 @@
 PyMODINIT_FUNC
 PyInit__csv(void)
 {
-    PyObject *module;
-    const StyleDesc *style;
-
-    if (PyType_Ready(&Reader_Type) < 0)
-        return NULL;
-
-    if (PyType_Ready(&Writer_Type) < 0)
-        return NULL;
-
-    /* Create the module and add the functions */
-    module = PyModule_Create(&_csvmodule);
-    if (module == NULL)
-        return NULL;
-
-    /* Add version to the module. */
-    if (PyModule_AddStringConstant(module, "__version__",
-                                   MODULE_VERSION) == -1)
-        return NULL;
-
-    /* Set the field limit */
-    get_csv_state(module)->field_limit = 128 * 1024;
-    /* Do I still need to add this var to the Module Dict? */
-
-    /* Add _dialects dictionary */
-    get_csv_state(module)->dialects = PyDict_New();
-    if (get_csv_state(module)->dialects == NULL)
-        return NULL;
-    Py_INCREF(get_csv_state(module)->dialects);
-    if (PyModule_AddObject(module, "_dialects", get_csv_state(module)->dialects))
-        return NULL;
-
-    /* Add quote styles into dictionary */
-    for (style = quote_styles; style->name; style++) {
-        if (PyModule_AddIntConstant(module, style->name,
-                                    style->style) == -1)
-            return NULL;
-    }
-
-    if (PyModule_AddType(module, &Dialect_Type)) {
-        return NULL;
-    }
-
-    /* Add the CSV exception object to the module. */
-    get_csv_state(module)->error_obj = PyErr_NewException("_csv.Error", NULL, NULL);
-    if (get_csv_state(module)->error_obj == NULL)
-        return NULL;
-    Py_INCREF(get_csv_state(module)->error_obj);
-    PyModule_AddObject(module, "Error", get_csv_state(module)->error_obj);
-    return module;
+    return PyModuleDef_Init(&_csvmodule);
 }
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index ceae67e..5f8a723 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -116,6 +116,8 @@
 #endif
 #include "ctypes.h"
 
+#include "pycore_long.h"          // _PyLong_GetZero()
+
 PyObject *PyExc_ArgError = NULL;
 
 /* This dict maps ctypes types to POINTER types */
@@ -123,9 +125,13 @@
 
 static PyTypeObject Simple_Type;
 
-/* a callable object used for unpickling */
+/* a callable object used for unpickling:
+   strong reference to _ctypes._unpickle() function */
 static PyObject *_unpickle;
 
+#ifdef MS_WIN32
+PyObject *ComError;  // Borrowed reference to: &PyComError_Type
+#endif
 
 
 /****************************************************************/
@@ -492,9 +498,10 @@
         return NULL;
 
     /* keep this for bw compatibility */
-    if (_PyDict_GetItemIdWithError(result->tp_dict, &PyId__abstract_))
+    int r = _PyDict_ContainsId(result->tp_dict, &PyId__abstract_);
+    if (r > 0)
         return (PyObject *)result;
-    if (PyErr_Occurred()) {
+    if (r < 0) {
         Py_DECREF(result);
         return NULL;
     }
@@ -1351,7 +1358,6 @@
     { NULL, NULL }
 };
 
-#ifdef CTYPES_UNICODE
 static PyObject *
 WCharArray_get_value(CDataObject *self, void *Py_UNUSED(ignored))
 {
@@ -1366,8 +1372,6 @@
 static int
 WCharArray_set_value(CDataObject *self, PyObject *value, void *Py_UNUSED(ignored))
 {
-    Py_ssize_t result = 0;
-
     if (value == NULL) {
         PyErr_SetString(PyExc_TypeError,
                         "can't delete attribute");
@@ -1378,29 +1382,24 @@
                         "unicode string expected instead of %s instance",
                         Py_TYPE(value)->tp_name);
         return -1;
-    } else
-        Py_INCREF(value);
+    }
 
+    Py_ssize_t size = self->b_size / sizeof(wchar_t);
     Py_ssize_t len = PyUnicode_AsWideChar(value, NULL, 0);
     if (len < 0) {
         return -1;
     }
     // PyUnicode_AsWideChar() returns number of wchars including trailing null byte,
     // when it is called with NULL.
-    if (((size_t)len-1) > self->b_size/sizeof(wchar_t)) {
+    assert(len > 0);
+    if (len - 1 > size) {
         PyErr_SetString(PyExc_ValueError, "string too long");
-        result = -1;
-        goto done;
+        return -1;
     }
-    result = PyUnicode_AsWideChar(value,
-                                  (wchar_t *)self->b_ptr,
-                                  self->b_size/sizeof(wchar_t));
-    if (result >= 0 && (size_t)result < self->b_size/sizeof(wchar_t))
-        ((wchar_t *)self->b_ptr)[result] = (wchar_t)0;
-  done:
-    Py_DECREF(value);
-
-    return result >= 0 ? 0 : -1;
+    if (PyUnicode_AsWideChar(value, (wchar_t *)self->b_ptr, size) < 0) {
+        return -1;
+    }
+    return 0;
 }
 
 static PyGetSetDef WCharArray_getsets[] = {
@@ -1408,7 +1407,6 @@
       "string value"},
     { NULL, NULL }
 };
-#endif
 
 /*
   The next three functions copied from Python's typeobject.c.
@@ -1615,11 +1613,10 @@
     if (itemdict->getfunc == _ctypes_get_fielddesc("c")->getfunc) {
         if (-1 == add_getset(result, CharArray_getsets))
             goto error;
-#ifdef CTYPES_UNICODE
-    } else if (itemdict->getfunc == _ctypes_get_fielddesc("u")->getfunc) {
+    }
+    else if (itemdict->getfunc == _ctypes_get_fielddesc("u")->getfunc) {
         if (-1 == add_getset(result, WCharArray_getsets))
             goto error;
-#endif
     }
 
     return (PyObject *)result;
@@ -3484,10 +3481,12 @@
     for (i = 0; i < len; ++i) {
         PyObject *item = PyTuple_GET_ITEM(paramflags, i);
         int flag;
-        char *name;
+        PyObject *name = Py_None;
         PyObject *defval;
         PyObject *typ;
-        if (!PyArg_ParseTuple(item, "i|ZO", &flag, &name, &defval)) {
+        if (!PyArg_ParseTuple(item, "i|OO", &flag, &name, &defval) ||
+            !(name == Py_None || PyUnicode_Check(name)))
+        {
             PyErr_SetString(PyExc_TypeError,
                    "paramflags must be a sequence of (int [,string [,value]]) tuples");
             return 0;
@@ -3933,8 +3932,9 @@
         case PARAMFLAG_FIN | PARAMFLAG_FLCID:
             /* ['in', 'lcid'] parameter.  Always taken from defval,
              if given, else the integer 0. */
-            if (defval == NULL)
-                defval = _PyLong_Zero;
+            if (defval == NULL) {
+                defval = _PyLong_GetZero();
+            }
             Py_INCREF(defval);
             PyTuple_SET_ITEM(callargs, i, defval);
             break;
@@ -4308,7 +4308,7 @@
 
 PyTypeObject PyCFuncPtr_Type = {
     PyVarObject_HEAD_INIT(NULL, 0)
-    "_ctypes.PyCFuncPtr",
+    "_ctypes.CFuncPtr",
     sizeof(PyCFuncPtrObject),                           /* tp_basicsize */
     0,                                          /* tp_itemsize */
     (destructor)PyCFuncPtr_dealloc,             /* tp_dealloc */
@@ -4402,15 +4402,13 @@
         }
         val = PyTuple_GET_ITEM(args, i + index);
         if (kwds) {
-            if (PyDict_GetItemWithError(kwds, name)) {
-                PyErr_Format(PyExc_TypeError,
-                            "duplicate values for field %R",
-                            name);
-                Py_DECREF(pair);
-                Py_DECREF(name);
-                return -1;
-            }
-            else if (PyErr_Occurred()) {
+            res = PyDict_Contains(kwds, name);
+            if (res != 0) {
+                if (res > 0) {
+                    PyErr_Format(PyExc_TypeError,
+                                 "duplicate values for field %R",
+                                 name);
+                }
                 Py_DECREF(pair);
                 Py_DECREF(name);
                 return -1;
@@ -4653,7 +4651,6 @@
             PyMem_Free(dest);
             return np;
         }
-#ifdef CTYPES_UNICODE
         if (itemdict->getfunc == _ctypes_get_fielddesc("u")->getfunc) {
             wchar_t *ptr = (wchar_t *)self->b_ptr;
             wchar_t *dest;
@@ -4680,7 +4677,6 @@
             PyMem_Free(dest);
             return np;
         }
-#endif
 
         np = PyList_New(slicelen);
         if (np == NULL)
@@ -5349,7 +5345,6 @@
             PyMem_Free(dest);
             return np;
         }
-#ifdef CTYPES_UNICODE
         if (itemdict->getfunc == _ctypes_get_fielddesc("u")->getfunc) {
             wchar_t *ptr = *(wchar_t **)self->b_ptr;
             wchar_t *dest;
@@ -5370,7 +5365,6 @@
             PyMem_Free(dest);
             return np;
         }
-#endif
 
         np = PyList_New(len);
         if (np == NULL)
@@ -5558,20 +5552,7 @@
     0,                          /* tp_alloc */
     0,                          /* tp_new */
 };
-
-
-static int
-create_comerror(void)
-{
-    PyComError_Type.tp_base = (PyTypeObject*)PyExc_Exception;
-    if (PyType_Ready(&PyComError_Type) < 0)
-        return -1;
-    Py_INCREF(&PyComError_Type);
-    ComError = (PyObject*)&PyComError_Type;
-    return 0;
-}
-
-#endif
+#endif  // MS_WIN32
 
 static PyObject *
 string_at(const char *ptr, int size)
@@ -5665,7 +5646,7 @@
     return NULL;
 }
 
-#ifdef CTYPES_UNICODE
+
 static PyObject *
 wstring_at(const wchar_t *ptr, int size)
 {
@@ -5677,133 +5658,74 @@
         ssize = wcslen(ptr);
     return PyUnicode_FromWideChar(ptr, ssize);
 }
-#endif
 
 
 static struct PyModuleDef _ctypesmodule = {
     PyModuleDef_HEAD_INIT,
-    "_ctypes",
-    module_docs,
-    -1,
-    _ctypes_module_methods,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    .m_name = "_ctypes",
+    .m_doc = module_docs,
+    .m_size = -1,
+    .m_methods = _ctypes_module_methods,
 };
 
-PyMODINIT_FUNC
-PyInit__ctypes(void)
+
+static int
+_ctypes_add_types(PyObject *mod)
 {
-    PyObject *m;
+#define TYPE_READY(TYPE) \
+    if (PyType_Ready(TYPE) < 0) { \
+        return -1; \
+    }
 
-/* Note:
-   ob_type is the metatype (the 'type'), defaults to PyType_Type,
-   tp_base is the base type, defaults to 'object' aka PyBaseObject_Type.
-*/
-    m = PyModule_Create(&_ctypesmodule);
-    if (!m)
-        return NULL;
+#define TYPE_READY_BASE(TYPE_EXPR, TP_BASE) \
+    do { \
+        PyTypeObject *type = (TYPE_EXPR); \
+        type->tp_base = (TP_BASE); \
+        TYPE_READY(type); \
+    } while (0)
 
-    _ctypes_ptrtype_cache = PyDict_New();
-    if (_ctypes_ptrtype_cache == NULL)
-        return NULL;
+#define MOD_ADD_TYPE(TYPE_EXPR, TP_TYPE, TP_BASE) \
+    do { \
+        PyTypeObject *type = (TYPE_EXPR); \
+        Py_SET_TYPE(type, TP_TYPE); \
+        type->tp_base = TP_BASE; \
+        if (PyModule_AddType(mod, type) < 0) { \
+            return -1; \
+        } \
+    } while (0)
 
-    PyModule_AddObject(m, "_pointer_type_cache", (PyObject *)_ctypes_ptrtype_cache);
-
-    _unpickle = PyObject_GetAttrString(m, "_unpickle");
-    if (_unpickle == NULL)
-        return NULL;
-
-    if (PyType_Ready(&PyCArg_Type) < 0)
-        return NULL;
-
-    if (PyType_Ready(&PyCThunk_Type) < 0)
-        return NULL;
-
+    /* Note:
+       ob_type is the metatype (the 'type'), defaults to PyType_Type,
+       tp_base is the base type, defaults to 'object' aka PyBaseObject_Type.
+    */
+    TYPE_READY(&PyCArg_Type);
+    TYPE_READY(&PyCThunk_Type);
+    TYPE_READY(&PyCData_Type);
     /* StgDict is derived from PyDict_Type */
-    PyCStgDict_Type.tp_base = &PyDict_Type;
-    if (PyType_Ready(&PyCStgDict_Type) < 0)
-        return NULL;
+    TYPE_READY_BASE(&PyCStgDict_Type, &PyDict_Type);
 
     /*************************************************
      *
      * Metaclasses
      */
-
-    PyCStructType_Type.tp_base = &PyType_Type;
-    if (PyType_Ready(&PyCStructType_Type) < 0)
-        return NULL;
-
-    UnionType_Type.tp_base = &PyType_Type;
-    if (PyType_Ready(&UnionType_Type) < 0)
-        return NULL;
-
-    PyCPointerType_Type.tp_base = &PyType_Type;
-    if (PyType_Ready(&PyCPointerType_Type) < 0)
-        return NULL;
-
-    PyCArrayType_Type.tp_base = &PyType_Type;
-    if (PyType_Ready(&PyCArrayType_Type) < 0)
-        return NULL;
-
-    PyCSimpleType_Type.tp_base = &PyType_Type;
-    if (PyType_Ready(&PyCSimpleType_Type) < 0)
-        return NULL;
-
-    PyCFuncPtrType_Type.tp_base = &PyType_Type;
-    if (PyType_Ready(&PyCFuncPtrType_Type) < 0)
-        return NULL;
+    TYPE_READY_BASE(&PyCStructType_Type, &PyType_Type);
+    TYPE_READY_BASE(&UnionType_Type, &PyType_Type);
+    TYPE_READY_BASE(&PyCPointerType_Type, &PyType_Type);
+    TYPE_READY_BASE(&PyCArrayType_Type, &PyType_Type);
+    TYPE_READY_BASE(&PyCSimpleType_Type, &PyType_Type);
+    TYPE_READY_BASE(&PyCFuncPtrType_Type, &PyType_Type);
 
     /*************************************************
      *
      * Classes using a custom metaclass
      */
 
-    if (PyType_Ready(&PyCData_Type) < 0)
-        return NULL;
-
-    Py_SET_TYPE(&Struct_Type, &PyCStructType_Type);
-    Struct_Type.tp_base = &PyCData_Type;
-    if (PyType_Ready(&Struct_Type) < 0)
-        return NULL;
-    Py_INCREF(&Struct_Type);
-    PyModule_AddObject(m, "Structure", (PyObject *)&Struct_Type);
-
-    Py_SET_TYPE(&Union_Type, &UnionType_Type);
-    Union_Type.tp_base = &PyCData_Type;
-    if (PyType_Ready(&Union_Type) < 0)
-        return NULL;
-    Py_INCREF(&Union_Type);
-    PyModule_AddObject(m, "Union", (PyObject *)&Union_Type);
-
-    Py_SET_TYPE(&PyCPointer_Type, &PyCPointerType_Type);
-    PyCPointer_Type.tp_base = &PyCData_Type;
-    if (PyType_Ready(&PyCPointer_Type) < 0)
-        return NULL;
-    Py_INCREF(&PyCPointer_Type);
-    PyModule_AddObject(m, "_Pointer", (PyObject *)&PyCPointer_Type);
-
-    Py_SET_TYPE(&PyCArray_Type, &PyCArrayType_Type);
-    PyCArray_Type.tp_base = &PyCData_Type;
-    if (PyType_Ready(&PyCArray_Type) < 0)
-        return NULL;
-    Py_INCREF(&PyCArray_Type);
-    PyModule_AddObject(m, "Array", (PyObject *)&PyCArray_Type);
-
-    Py_SET_TYPE(&Simple_Type, &PyCSimpleType_Type);
-    Simple_Type.tp_base = &PyCData_Type;
-    if (PyType_Ready(&Simple_Type) < 0)
-        return NULL;
-    Py_INCREF(&Simple_Type);
-    PyModule_AddObject(m, "_SimpleCData", (PyObject *)&Simple_Type);
-
-    Py_SET_TYPE(&PyCFuncPtr_Type, &PyCFuncPtrType_Type);
-    PyCFuncPtr_Type.tp_base = &PyCData_Type;
-    if (PyType_Ready(&PyCFuncPtr_Type) < 0)
-        return NULL;
-    Py_INCREF(&PyCFuncPtr_Type);
-    PyModule_AddObject(m, "CFuncPtr", (PyObject *)&PyCFuncPtr_Type);
+    MOD_ADD_TYPE(&Struct_Type, &PyCStructType_Type, &PyCData_Type);
+    MOD_ADD_TYPE(&Union_Type, &UnionType_Type, &PyCData_Type);
+    MOD_ADD_TYPE(&PyCPointer_Type, &PyCPointerType_Type, &PyCData_Type);
+    MOD_ADD_TYPE(&PyCArray_Type, &PyCArrayType_Type, &PyCData_Type);
+    MOD_ADD_TYPE(&Simple_Type, &PyCSimpleType_Type, &PyCData_Type);
+    MOD_ADD_TYPE(&PyCFuncPtr_Type, &PyCFuncPtrType_Type, &PyCData_Type);
 
     /*************************************************
      *
@@ -5811,8 +5733,7 @@
      */
 
     /* PyCField_Type is derived from PyBaseObject_Type */
-    if (PyType_Ready(&PyCField_Type) < 0)
-        return NULL;
+    TYPE_READY(&PyCField_Type);
 
     /*************************************************
      *
@@ -5820,56 +5741,118 @@
      */
 
     DictRemover_Type.tp_new = PyType_GenericNew;
-    if (PyType_Ready(&DictRemover_Type) < 0)
-        return NULL;
-
-    if (PyType_Ready(&StructParam_Type) < 0) {
-        return NULL;
-    }
+    TYPE_READY(&DictRemover_Type);
+    TYPE_READY(&StructParam_Type);
 
 #ifdef MS_WIN32
-    if (create_comerror() < 0)
-        return NULL;
-    PyModule_AddObject(m, "COMError", ComError);
-
-    PyModule_AddObject(m, "FUNCFLAG_HRESULT", PyLong_FromLong(FUNCFLAG_HRESULT));
-    PyModule_AddObject(m, "FUNCFLAG_STDCALL", PyLong_FromLong(FUNCFLAG_STDCALL));
+    TYPE_READY_BASE(&PyComError_Type, (PyTypeObject*)PyExc_Exception);
 #endif
-    PyModule_AddObject(m, "FUNCFLAG_CDECL", PyLong_FromLong(FUNCFLAG_CDECL));
-    PyModule_AddObject(m, "FUNCFLAG_USE_ERRNO", PyLong_FromLong(FUNCFLAG_USE_ERRNO));
-    PyModule_AddObject(m, "FUNCFLAG_USE_LASTERROR", PyLong_FromLong(FUNCFLAG_USE_LASTERROR));
-    PyModule_AddObject(m, "FUNCFLAG_PYTHONAPI", PyLong_FromLong(FUNCFLAG_PYTHONAPI));
-    PyModule_AddStringConstant(m, "__version__", "1.1.0");
 
-    PyModule_AddObject(m, "_memmove_addr", PyLong_FromVoidPtr(memmove));
-    PyModule_AddObject(m, "_memset_addr", PyLong_FromVoidPtr(memset));
-    PyModule_AddObject(m, "_string_at_addr", PyLong_FromVoidPtr(string_at));
-    PyModule_AddObject(m, "_cast_addr", PyLong_FromVoidPtr(cast));
-#ifdef CTYPES_UNICODE
-    PyModule_AddObject(m, "_wstring_at_addr", PyLong_FromVoidPtr(wstring_at));
+#undef TYPE_READY
+#undef TYPE_READY_BASE
+#undef MOD_ADD_TYPE
+    return 0;
+}
+
+
+static int
+_ctypes_add_objects(PyObject *mod)
+{
+#define MOD_ADD(name, expr) \
+    do { \
+        PyObject *obj = (expr); \
+        if (obj == NULL) { \
+            return -1; \
+        } \
+        if (PyModule_AddObjectRef(mod, name, obj) < 0) { \
+            Py_DECREF(obj); \
+            return -1; \
+        } \
+        Py_DECREF(obj); \
+    } while (0)
+
+    MOD_ADD("_pointer_type_cache", Py_NewRef(_ctypes_ptrtype_cache));
+
+#ifdef MS_WIN32
+    MOD_ADD("COMError", Py_NewRef(ComError));
+    MOD_ADD("FUNCFLAG_HRESULT", PyLong_FromLong(FUNCFLAG_HRESULT));
+    MOD_ADD("FUNCFLAG_STDCALL", PyLong_FromLong(FUNCFLAG_STDCALL));
 #endif
+    MOD_ADD("FUNCFLAG_CDECL", PyLong_FromLong(FUNCFLAG_CDECL));
+    MOD_ADD("FUNCFLAG_USE_ERRNO", PyLong_FromLong(FUNCFLAG_USE_ERRNO));
+    MOD_ADD("FUNCFLAG_USE_LASTERROR", PyLong_FromLong(FUNCFLAG_USE_LASTERROR));
+    MOD_ADD("FUNCFLAG_PYTHONAPI", PyLong_FromLong(FUNCFLAG_PYTHONAPI));
+    MOD_ADD("__version__", PyUnicode_FromString("1.1.0"));
+
+    MOD_ADD("_memmove_addr", PyLong_FromVoidPtr(memmove));
+    MOD_ADD("_memset_addr", PyLong_FromVoidPtr(memset));
+    MOD_ADD("_string_at_addr", PyLong_FromVoidPtr(string_at));
+    MOD_ADD("_cast_addr", PyLong_FromVoidPtr(cast));
+    MOD_ADD("_wstring_at_addr", PyLong_FromVoidPtr(wstring_at));
 
 /* If RTLD_LOCAL is not defined (Windows!), set it to zero. */
 #if !HAVE_DECL_RTLD_LOCAL
-#define RTLD_LOCAL 0
+#  define RTLD_LOCAL 0
 #endif
 
 /* If RTLD_GLOBAL is not defined (cygwin), set it to the same value as
-   RTLD_LOCAL.
-*/
+   RTLD_LOCAL. */
 #if !HAVE_DECL_RTLD_GLOBAL
-#define RTLD_GLOBAL RTLD_LOCAL
+#  define RTLD_GLOBAL RTLD_LOCAL
 #endif
+    MOD_ADD("RTLD_LOCAL", PyLong_FromLong(RTLD_LOCAL));
+    MOD_ADD("RTLD_GLOBAL", PyLong_FromLong(RTLD_GLOBAL));
+    MOD_ADD("ArgumentError", Py_NewRef(PyExc_ArgError));
+    return 0;
+#undef MOD_ADD
+}
 
-    PyModule_AddObject(m, "RTLD_LOCAL", PyLong_FromLong(RTLD_LOCAL));
-    PyModule_AddObject(m, "RTLD_GLOBAL", PyLong_FromLong(RTLD_GLOBAL));
+
+static int
+_ctypes_mod_exec(PyObject *mod)
+{
+    _unpickle = PyObject_GetAttrString(mod, "_unpickle");
+    if (_unpickle == NULL) {
+        return -1;
+    }
+
+    _ctypes_ptrtype_cache = PyDict_New();
+    if (_ctypes_ptrtype_cache == NULL) {
+        return -1;
+    }
 
     PyExc_ArgError = PyErr_NewException("ctypes.ArgumentError", NULL, NULL);
-    if (PyExc_ArgError) {
-        Py_INCREF(PyExc_ArgError);
-        PyModule_AddObject(m, "ArgumentError", PyExc_ArgError);
+    if (!PyExc_ArgError) {
+        return -1;
     }
-    return m;
+
+    if (_ctypes_add_types(mod) < 0) {
+        return -1;
+    }
+#ifdef MS_WIN32
+    ComError = (PyObject*)&PyComError_Type;
+#endif
+
+    if (_ctypes_add_objects(mod) < 0) {
+        return -1;
+    }
+    return 0;
+}
+
+
+PyMODINIT_FUNC
+PyInit__ctypes(void)
+{
+    PyObject *mod = PyModule_Create(&_ctypesmodule);
+    if (!mod) {
+        return NULL;
+    }
+
+    if (_ctypes_mod_exec(mod) < 0) {
+        Py_DECREF(mod);
+        return NULL;
+    }
+    return mod;
 }
 
 /*
diff --git a/Modules/_ctypes/_ctypes_test.c b/Modules/_ctypes/_ctypes_test.c
index 1ccad8e..a33d15d 100644
--- a/Modules/_ctypes/_ctypes_test.c
+++ b/Modules/_ctypes/_ctypes_test.c
@@ -1034,7 +1034,7 @@
 
 static struct PyModuleDef_Slot _ctypes_test_slots[] = {
     {0, NULL}
-}; 
+};
 
 static struct PyModuleDef _ctypes_testmodule = {
     PyModuleDef_HEAD_INIT,
diff --git a/Modules/_ctypes/callbacks.c b/Modules/_ctypes/callbacks.c
index 19c77f4..5a4d1c5 100644
--- a/Modules/_ctypes/callbacks.c
+++ b/Modules/_ctypes/callbacks.c
@@ -111,8 +111,9 @@
     IUnknown *punk;
     _Py_IDENTIFIER(_needs_com_addref_);
 
-    if (!_PyDict_GetItemIdWithError((PyObject *)dict, &PyId__needs_com_addref_)) {
-        if (PyErr_Occurred()) {
+    int r = _PyDict_ContainsId((PyObject *)dict, &PyId__needs_com_addref_);
+    if (r <= 0) {
+        if (r < 0) {
             PrintError("getting _needs_com_addref_");
         }
         return;
@@ -430,7 +431,7 @@
         #pragma clang diagnostic push
         #pragma clang diagnostic ignored "-Wdeprecated-declarations"
 #endif
-#if defined(__GNUC__)
+#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5)))
         #pragma GCC diagnostic push
         #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 #endif
@@ -439,7 +440,7 @@
 #if defined(__clang__) || defined(MACOSX)
         #pragma clang diagnostic pop
 #endif
-#if defined(__GNUC__)
+#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5)))
         #pragma GCC diagnostic pop
 #endif
 
diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c
index b0a36a3..ddf289e 100644
--- a/Modules/_ctypes/callproc.c
+++ b/Modules/_ctypes/callproc.c
@@ -254,8 +254,6 @@
     return set_error_internal(self, args, 1);
 }
 
-PyObject *ComError;
-
 static WCHAR *FormatError(DWORD code)
 {
     WCHAR *lpMsgBuf;
@@ -477,7 +475,7 @@
 PyCArg_dealloc(PyCArgObject *self)
 {
     Py_XDECREF(self->obj);
-    PyObject_Del(self);
+    PyObject_Free(self);
 }
 
 static int
@@ -489,58 +487,47 @@
 static PyObject *
 PyCArg_repr(PyCArgObject *self)
 {
-    char buffer[256];
     switch(self->tag) {
     case 'b':
     case 'B':
-        sprintf(buffer, "<cparam '%c' (%d)>",
+        return PyUnicode_FromFormat("<cparam '%c' (%d)>",
             self->tag, self->value.b);
-        break;
     case 'h':
     case 'H':
-        sprintf(buffer, "<cparam '%c' (%d)>",
+        return PyUnicode_FromFormat("<cparam '%c' (%d)>",
             self->tag, self->value.h);
-        break;
     case 'i':
     case 'I':
-        sprintf(buffer, "<cparam '%c' (%d)>",
+        return PyUnicode_FromFormat("<cparam '%c' (%d)>",
             self->tag, self->value.i);
-        break;
     case 'l':
     case 'L':
-        sprintf(buffer, "<cparam '%c' (%ld)>",
+        return PyUnicode_FromFormat("<cparam '%c' (%ld)>",
             self->tag, self->value.l);
-        break;
 
     case 'q':
     case 'Q':
-        sprintf(buffer,
-#ifdef MS_WIN32
-            "<cparam '%c' (%I64d)>",
-#else
-            "<cparam '%c' (%lld)>",
-#endif
+        return PyUnicode_FromFormat("<cparam '%c' (%lld)>",
             self->tag, self->value.q);
-        break;
     case 'd':
-        sprintf(buffer, "<cparam '%c' (%f)>",
-            self->tag, self->value.d);
-        break;
-    case 'f':
-        sprintf(buffer, "<cparam '%c' (%f)>",
-            self->tag, self->value.f);
-        break;
-
+    case 'f': {
+        PyObject *f = PyFloat_FromDouble((self->tag == 'f') ? self->value.f : self->value.d);
+        if (f == NULL) {
+            return NULL;
+        }
+        PyObject *result = PyUnicode_FromFormat("<cparam '%c' (%R)>", self->tag, f);
+        Py_DECREF(f);
+        return result;
+    }
     case 'c':
         if (is_literal_char((unsigned char)self->value.c)) {
-            sprintf(buffer, "<cparam '%c' ('%c')>",
+            return PyUnicode_FromFormat("<cparam '%c' ('%c')>",
                 self->tag, self->value.c);
         }
         else {
-            sprintf(buffer, "<cparam '%c' ('\\x%02x')>",
+            return PyUnicode_FromFormat("<cparam '%c' ('\\x%02x')>",
                 self->tag, (unsigned char)self->value.c);
         }
-        break;
 
 /* Hm, are these 'z' and 'Z' codes useful at all?
    Shouldn't they be replaced by the functionality of c_string
@@ -549,22 +536,20 @@
     case 'z':
     case 'Z':
     case 'P':
-        sprintf(buffer, "<cparam '%c' (%p)>",
+        return PyUnicode_FromFormat("<cparam '%c' (%p)>",
             self->tag, self->value.p);
         break;
 
     default:
         if (is_literal_char((unsigned char)self->tag)) {
-            sprintf(buffer, "<cparam '%c' at %p>",
+            return PyUnicode_FromFormat("<cparam '%c' at %p>",
                 (unsigned char)self->tag, (void *)self);
         }
         else {
-            sprintf(buffer, "<cparam 0x%02x at %p>",
+            return PyUnicode_FromFormat("<cparam 0x%02x at %p>",
                 (unsigned char)self->tag, (void *)self);
         }
-        break;
     }
-    return PyUnicode_FromString(buffer);
 }
 
 static PyMemberDef PyCArgType_members[] = {
@@ -715,7 +700,6 @@
         return 0;
     }
 
-#ifdef CTYPES_UNICODE
     if (PyUnicode_Check(obj)) {
         pa->ffi_type = &ffi_type_pointer;
         pa->value.p = PyUnicode_AsWideCharString(obj, NULL);
@@ -728,7 +712,6 @@
         }
         return 0;
     }
-#endif
 
     {
         _Py_IDENTIFIER(_as_parameter_);
@@ -851,7 +834,7 @@
 #      define HAVE_FFI_PREP_CIF_VAR_RUNTIME false
 #   endif
 
-    /* Even on Apple-arm64 the calling convention for variadic functions conincides
+    /* Even on Apple-arm64 the calling convention for variadic functions coincides
      * with the standard calling convention in the case that the function called
      * only with its fixed arguments.   Thus, we do not need a special flag to be
      * set on variadic functions.   We treat a function as variadic if it is called
@@ -1362,7 +1345,6 @@
 Windows API.\n";
 static PyObject *load_library(PyObject *self, PyObject *args)
 {
-    const WCHAR *name;
     PyObject *nameobj;
     int load_flags = 0;
     HMODULE hMod;
@@ -1371,14 +1353,14 @@
     if (!PyArg_ParseTuple(args, "U|i:LoadLibrary", &nameobj, &load_flags))
         return NULL;
 
-    name = _PyUnicode_AsUnicode(nameobj);
-    if (!name)
-        return NULL;
-
     if (PySys_Audit("ctypes.dlopen", "O", nameobj) < 0) {
         return NULL;
     }
 
+    WCHAR *name = PyUnicode_AsWideCharString(nameobj, NULL);
+    if (!name)
+        return NULL;
+
     Py_BEGIN_ALLOW_THREADS
     /* bpo-36085: Limit DLL search directories to avoid pre-loading
      * attacks and enable use of the AddDllDirectory function.
@@ -1387,6 +1369,7 @@
     err = hMod ? 0 : GetLastError();
     Py_END_ALLOW_THREADS
 
+    PyMem_Free(name);
     if (err == ERROR_MOD_NOT_FOUND) {
         PyErr_Format(PyExc_FileNotFoundError,
                      ("Could not find module '%.500S' (or one of its "
@@ -1459,26 +1442,49 @@
     return r;
 }
 #else
-
+#ifdef __APPLE__
 #ifdef HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH
+#define HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH_RUNTIME \
+    __builtin_available(macOS 11.0, iOS 14.0, tvOS 14.0, watchOS 7.0, *)
+#else
+// Support the deprecated case of compiling on an older macOS version
+static void *libsystem_b_handle;
+static bool (*_dyld_shared_cache_contains_path)(const char *path);
+
+__attribute__((constructor)) void load_dyld_shared_cache_contains_path(void) {
+    libsystem_b_handle = dlopen("/usr/lib/libSystem.B.dylib", RTLD_LAZY);
+    if (libsystem_b_handle != NULL) {
+        _dyld_shared_cache_contains_path = dlsym(libsystem_b_handle, "_dyld_shared_cache_contains_path");
+    }
+}
+
+__attribute__((destructor)) void unload_dyld_shared_cache_contains_path(void) {
+    if (libsystem_b_handle != NULL) {
+        dlclose(libsystem_b_handle);
+    }
+}
+#define HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH_RUNTIME \
+    _dyld_shared_cache_contains_path != NULL
+#endif
+
 static PyObject *py_dyld_shared_cache_contains_path(PyObject *self, PyObject *args)
 {
      PyObject *name, *name2;
      char *name_str;
 
-     if (__builtin_available(macOS 11.0, iOS 14.0, tvOS 14.0, watchOS 7.0, *)) {
+     if (HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH_RUNTIME) {
          int r;
 
          if (!PyArg_ParseTuple(args, "O", &name))
              return NULL;
-    
+
          if (name == Py_None)
              Py_RETURN_FALSE;
-    
+
          if (PyUnicode_FSConverter(name, &name2) == 0)
              return NULL;
          name_str = PyBytes_AS_STRING(name2);
-    
+
          r = _dyld_shared_cache_contains_path(name_str);
          Py_DECREF(name2);
 
@@ -2009,7 +2015,7 @@
     {"dlclose", py_dl_close, METH_VARARGS, "dlclose a library"},
     {"dlsym", py_dl_sym, METH_VARARGS, "find symbol in shared library"},
 #endif
-#ifdef HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH
+#ifdef __APPLE__
      {"_dyld_shared_cache_contains_path", py_dyld_shared_cache_contains_path, METH_VARARGS, "check if path is in the shared cache"},
 #endif
     {"alignment", align_func, METH_O, alignment_doc},
diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c
index 2261a59..ec6feca 100644
--- a/Modules/_ctypes/cfield.c
+++ b/Modules/_ctypes/cfield.c
@@ -1,5 +1,5 @@
 #include "Python.h"
-#include "pycore_byteswap.h"      // _Py_bswap32()
+#include "pycore_bitutils.h"      // _Py_bswap32()
 
 #include <ffi.h>
 #ifdef MS_WIN32
@@ -35,7 +35,7 @@
  * Expects the size, index and offset for the current field in *psize and
  * *poffset, stores the total size so far in *psize, the offset for the next
  * field in *poffset, the alignment requirements for the current field in
- * *palign, and returns a field desriptor for this field.
+ * *palign, and returns a field descriptor for this field.
  */
 /*
  * bitfields extension:
@@ -125,13 +125,11 @@
                 getfunc = fd->getfunc;
                 setfunc = fd->setfunc;
             }
-#ifdef CTYPES_UNICODE
             if (idict->getfunc == _ctypes_get_fielddesc("u")->getfunc) {
                 struct fielddesc *fd = _ctypes_get_fielddesc("U");
                 getfunc = fd->getfunc;
                 setfunc = fd->setfunc;
             }
-#endif
         }
     }
 
@@ -354,14 +352,7 @@
 static int
 get_long(PyObject *v, long *p)
 {
-    long x;
-
-    if (PyFloat_Check(v)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "int expected instead of float");
-        return -1;
-    }
-    x = PyLong_AsUnsignedLongMask(v);
+    long x = PyLong_AsUnsignedLongMask(v);
     if (x == -1 && PyErr_Occurred())
         return -1;
     *p = x;
@@ -373,14 +364,7 @@
 static int
 get_ulong(PyObject *v, unsigned long *p)
 {
-    unsigned long x;
-
-    if (PyFloat_Check(v)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "int expected instead of float");
-        return -1;
-    }
-    x = PyLong_AsUnsignedLongMask(v);
+    unsigned long x = PyLong_AsUnsignedLongMask(v);
     if (x == (unsigned long)-1 && PyErr_Occurred())
         return -1;
     *p = x;
@@ -392,13 +376,7 @@
 static int
 get_longlong(PyObject *v, long long *p)
 {
-    long long x;
-    if (PyFloat_Check(v)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "int expected instead of float");
-        return -1;
-    }
-    x = PyLong_AsUnsignedLongLongMask(v);
+    long long x = PyLong_AsUnsignedLongLongMask(v);
     if (x == -1 && PyErr_Occurred())
         return -1;
     *p = x;
@@ -410,13 +388,7 @@
 static int
 get_ulonglong(PyObject *v, unsigned long long *p)
 {
-    unsigned long long x;
-    if (PyFloat_Check(v)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "int expected instead of float");
-        return -1;
-    }
-    x = PyLong_AsUnsignedLongLongMask(v);
+    unsigned long long x = PyLong_AsUnsignedLongLongMask(v);
     if (x == (unsigned long long)-1 && PyErr_Occurred())
         return -1;
     *p = x;
@@ -1163,7 +1135,6 @@
     return PyBytes_FromStringAndSize((char *)ptr, 1);
 }
 
-#ifdef CTYPES_UNICODE
 /* u - a single wchar_t character */
 static PyObject *
 u_set(void *ptr, PyObject *value, Py_ssize_t size)
@@ -1249,11 +1220,8 @@
                      "string too long (%zd, maximum length %zd)",
                      size, length);
         return NULL;
-    } else if (size < length-1)
-        /* copy terminating NUL character if there is space */
-        size += 1;
-
-    if (PyUnicode_AsWideChar(value, (wchar_t *)ptr, size) == -1) {
+    }
+    if (PyUnicode_AsWideChar(value, (wchar_t *)ptr, length) == -1) {
         return NULL;
     }
 
@@ -1261,7 +1229,6 @@
     return value;
 }
 
-#endif
 
 static PyObject *
 s_get(void *ptr, Py_ssize_t size)
@@ -1292,7 +1259,9 @@
     }
 
     data = PyBytes_AS_STRING(value);
-    size = strlen(data); /* XXX Why not Py_SIZE(value)? */
+    // bpo-39593: Use strlen() to truncate the string at the first null character.
+    size = strlen(data);
+
     if (size < length) {
         /* This will copy the terminating NUL character
          * if there is space for it.
@@ -1348,12 +1317,12 @@
     }
 }
 
-#ifdef CTYPES_UNICODE
 static PyObject *
 Z_set(void *ptr, PyObject *value, Py_ssize_t size)
 {
     PyObject *keep;
     wchar_t *buffer;
+    Py_ssize_t bsize;
 
     if (value == Py_None) {
         *(wchar_t **)ptr = NULL;
@@ -1377,7 +1346,7 @@
 
     /* We must create a wchar_t* buffer from the unicode object,
        and keep it alive */
-    buffer = PyUnicode_AsWideCharString(value, NULL);
+    buffer = PyUnicode_AsWideCharString(value, &bsize);
     if (!buffer)
         return NULL;
     keep = PyCapsule_New(buffer, CTYPES_CFIELD_CAPSULE_NAME_PYMEM, pymem_destructor);
@@ -1400,7 +1369,7 @@
         Py_RETURN_NONE;
     }
 }
-#endif
+
 
 #ifdef MS_WIN32
 static PyObject *
@@ -1534,11 +1503,9 @@
 #endif
     { 'P', P_set, P_get, &ffi_type_pointer},
     { 'z', z_set, z_get, &ffi_type_pointer},
-#ifdef CTYPES_UNICODE
     { 'u', u_set, u_get, NULL}, /* ffi_type set later */
     { 'U', U_set, U_get, &ffi_type_pointer},
     { 'Z', Z_set, Z_get, &ffi_type_pointer},
-#endif
 #ifdef MS_WIN32
     { 'X', BSTR_set, BSTR_get, &ffi_type_pointer},
 #endif
@@ -1571,14 +1538,12 @@
 
     if (!initialized) {
         initialized = 1;
-#ifdef CTYPES_UNICODE
         if (sizeof(wchar_t) == sizeof(short))
             _ctypes_get_fielddesc("u")->pffi_type = &ffi_type_sshort;
         else if (sizeof(wchar_t) == sizeof(int))
             _ctypes_get_fielddesc("u")->pffi_type = &ffi_type_sint;
         else if (sizeof(wchar_t) == sizeof(long))
             _ctypes_get_fielddesc("u")->pffi_type = &ffi_type_slong;
-#endif
     }
 
     for (; table->code; ++table) {
diff --git a/Modules/_ctypes/ctypes.h b/Modules/_ctypes/ctypes.h
index 3f20031..9600ddc 100644
--- a/Modules/_ctypes/ctypes.h
+++ b/Modules/_ctypes/ctypes.h
@@ -208,7 +208,7 @@
     PyObject *checker;
     int flags;                  /* calling convention and such */
 
-    /* pep3118 fields, pointers neeed PyMem_Free */
+    /* pep3118 fields, pointers need PyMem_Free */
     char *format;
     int ndim;
     Py_ssize_t *shape;
@@ -343,10 +343,6 @@
 extern char *_ctypes_conversion_encoding;
 extern char *_ctypes_conversion_errors;
 
-#if defined(HAVE_WCHAR_H)
-#  define CTYPES_UNICODE
-#endif
-
 
 extern void _ctypes_free_closure(void *);
 extern void *_ctypes_alloc_closure(void);
diff --git a/Modules/_ctypes/malloc_closure.c b/Modules/_ctypes/malloc_closure.c
index 4f220e4..788bae6 100644
--- a/Modules/_ctypes/malloc_closure.c
+++ b/Modules/_ctypes/malloc_closure.c
@@ -91,12 +91,16 @@
 /* put the item back into the free list */
 void Py_ffi_closure_free(void *p)
 {
-#if USING_APPLE_OS_LIBFFI && HAVE_FFI_CLOSURE_ALLOC
+#if HAVE_FFI_CLOSURE_ALLOC
+#if USING_APPLE_OS_LIBFFI
     if (__builtin_available(macos 10.15, ios 13, watchos 6, tvos 13, *)) {
+#endif
         ffi_closure_free(p);
         return;
+#if USING_APPLE_OS_LIBFFI
     }
 #endif
+#endif
     ITEM *item = (ITEM *)p;
     item->next = free_list;
     free_list = item;
@@ -105,11 +109,15 @@
 /* return one item from the free list, allocating more if needed */
 void *Py_ffi_closure_alloc(size_t size, void** codeloc)
 {
-#if USING_APPLE_OS_LIBFFI && HAVE_FFI_CLOSURE_ALLOC
+#if HAVE_FFI_CLOSURE_ALLOC
+#if USING_APPLE_OS_LIBFFI
     if (__builtin_available(macos 10.15, ios 13, watchos 6, tvos 13, *)) {
+#endif
         return ffi_closure_alloc(size, codeloc);
+#if USING_APPLE_OS_LIBFFI
     }
 #endif
+#endif
     ITEM *item;
     if (!free_list)
         more_core();
diff --git a/Modules/_ctypes/stgdict.c b/Modules/_ctypes/stgdict.c
index 443951a..747339d 100644
--- a/Modules/_ctypes/stgdict.c
+++ b/Modules/_ctypes/stgdict.c
@@ -538,9 +538,7 @@
             case FFI_TYPE_SINT16:
             case FFI_TYPE_SINT32:
                 if (dict->getfunc != _ctypes_get_fielddesc("c")->getfunc
-#ifdef CTYPES_UNICODE
                     && dict->getfunc != _ctypes_get_fielddesc("u")->getfunc
-#endif
                     )
                     break;
                 /* else fall through */
diff --git a/Modules/_curses_panel.c b/Modules/_curses_panel.c
index f124803..0b328f9 100644
--- a/Modules/_curses_panel.c
+++ b/Modules/_curses_panel.c
@@ -18,43 +18,42 @@
 
 typedef struct {
     PyObject *PyCursesError;
-    PyObject *PyCursesPanel_Type;
-} _curses_panelstate;
+    PyTypeObject *PyCursesPanel_Type;
+} _curses_panel_state;
 
-static inline _curses_panelstate*
-get_curses_panelstate(PyObject *module)
+static inline _curses_panel_state *
+get_curses_panel_state(PyObject *module)
 {
     void *state = PyModule_GetState(module);
     assert(state != NULL);
-    return (_curses_panelstate *)state;
+    return (_curses_panel_state *)state;
 }
 
 static int
-_curses_panel_clear(PyObject *m)
+_curses_panel_clear(PyObject *mod)
 {
-    Py_CLEAR(get_curses_panelstate(m)->PyCursesError);
+    _curses_panel_state *state = get_curses_panel_state(mod);
+    Py_CLEAR(state->PyCursesError);
+    Py_CLEAR(state->PyCursesPanel_Type);
     return 0;
 }
 
 static int
-_curses_panel_traverse(PyObject *m, visitproc visit, void *arg)
+_curses_panel_traverse(PyObject *mod, visitproc visit, void *arg)
 {
-    Py_VISIT(Py_TYPE(m));
-    Py_VISIT(get_curses_panelstate(m)->PyCursesError);
+    Py_VISIT(Py_TYPE(mod));
+    _curses_panel_state *state = get_curses_panel_state(mod);
+    Py_VISIT(state->PyCursesError);
+    Py_VISIT(state->PyCursesPanel_Type);
     return 0;
 }
 
 static void
-_curses_panel_free(void *m)
+_curses_panel_free(void *mod)
 {
-    _curses_panel_clear((PyObject *) m);
+    _curses_panel_clear((PyObject *) mod);
 }
 
-static struct PyModuleDef _curses_panelmodule;
-
-#define _curses_panelstate_global \
-((_curses_panelstate *) PyModule_GetState(PyState_FindModule(&_curses_panelmodule)))
-
 /* Utility Functions */
 
 /*
@@ -63,15 +62,17 @@
  */
 
 static PyObject *
-PyCursesCheckERR(int code, const char *fname)
+PyCursesCheckERR(_curses_panel_state *state, int code, const char *fname)
 {
     if (code != ERR) {
         Py_RETURN_NONE;
-    } else {
+    }
+    else {
         if (fname == NULL) {
-            PyErr_SetString(_curses_panelstate_global->PyCursesError, catchall_ERR);
-        } else {
-            PyErr_Format(_curses_panelstate_global->PyCursesError, "%s() returned ERR", fname);
+            PyErr_SetString(state->PyCursesError, catchall_ERR);
+        }
+        else {
+            PyErr_Format(state->PyCursesError, "%s() returned ERR", fname);
         }
         return NULL;
     }
@@ -89,9 +90,6 @@
     PyCursesWindowObject *wo;   /* for reference counts */
 } PyCursesPanelObject;
 
-#define PyCursesPanel_Check(v)  \
- Py_IS_TYPE(v, _curses_panelstate_global->PyCursesPanel_Type)
-
 /* Some helper functions. The problem is that there's always a window
    associated with a panel. To ensure that Python's GC doesn't pull
    this window from under our feet we need to keep track of references
@@ -182,67 +180,81 @@
 /*[clinic input]
 _curses_panel.panel.bottom
 
+    cls: defining_class
+
 Push the panel to the bottom of the stack.
 [clinic start generated code]*/
 
 static PyObject *
-_curses_panel_panel_bottom_impl(PyCursesPanelObject *self)
-/*[clinic end generated code: output=7aa7d14d7e1d1ce6 input=b6c920c071b61e2e]*/
+_curses_panel_panel_bottom_impl(PyCursesPanelObject *self, PyTypeObject *cls)
+/*[clinic end generated code: output=8ec7fbbc08554021 input=6b7d2c0578b5a1c4]*/
 {
-    return PyCursesCheckERR(bottom_panel(self->pan), "bottom");
+    _curses_panel_state *state = PyType_GetModuleState(cls);
+    return PyCursesCheckERR(state, bottom_panel(self->pan), "bottom");
 }
 
 /*[clinic input]
 _curses_panel.panel.hide
 
+    cls: defining_class
+
 Hide the panel.
 
 This does not delete the object, it just makes the window on screen invisible.
 [clinic start generated code]*/
 
 static PyObject *
-_curses_panel_panel_hide_impl(PyCursesPanelObject *self)
-/*[clinic end generated code: output=a7bbbd523e1eab49 input=f6ab884e99386118]*/
+_curses_panel_panel_hide_impl(PyCursesPanelObject *self, PyTypeObject *cls)
+/*[clinic end generated code: output=cc6ab7203cdc1450 input=1bfc741f473e6055]*/
 {
-    return PyCursesCheckERR(hide_panel(self->pan), "hide");
+    _curses_panel_state *state = PyType_GetModuleState(cls);
+    return PyCursesCheckERR(state, hide_panel(self->pan), "hide");
 }
 
 /*[clinic input]
 _curses_panel.panel.show
 
+    cls: defining_class
+
 Display the panel (which might have been hidden).
 [clinic start generated code]*/
 
 static PyObject *
-_curses_panel_panel_show_impl(PyCursesPanelObject *self)
-/*[clinic end generated code: output=6b4553ab45c97769 input=57b167bbefaa3755]*/
+_curses_panel_panel_show_impl(PyCursesPanelObject *self, PyTypeObject *cls)
+/*[clinic end generated code: output=dc3421de375f0409 input=8122e80151cb4379]*/
 {
-    return PyCursesCheckERR(show_panel(self->pan), "show");
+    _curses_panel_state *state = PyType_GetModuleState(cls);
+    return PyCursesCheckERR(state, show_panel(self->pan), "show");
 }
 
 /*[clinic input]
 _curses_panel.panel.top
 
+    cls: defining_class
+
 Push panel to the top of the stack.
 [clinic start generated code]*/
 
 static PyObject *
-_curses_panel_panel_top_impl(PyCursesPanelObject *self)
-/*[clinic end generated code: output=0f5f2f8cdd2d1777 input=be33975ec3ca0e9a]*/
+_curses_panel_panel_top_impl(PyCursesPanelObject *self, PyTypeObject *cls)
+/*[clinic end generated code: output=10a072e511e873f7 input=1f372d597dda3379]*/
 {
-    return PyCursesCheckERR(top_panel(self->pan), "top");
+    _curses_panel_state *state = PyType_GetModuleState(cls);
+    return PyCursesCheckERR(state, top_panel(self->pan), "top");
 }
 
 /* Allocation and deallocation of Panel Objects */
 
 static PyObject *
-PyCursesPanel_New(PANEL *pan, PyCursesWindowObject *wo)
+PyCursesPanel_New(_curses_panel_state *state, PANEL *pan,
+                  PyCursesWindowObject *wo)
 {
-    PyCursesPanelObject *po;
+    PyCursesPanelObject *po = PyObject_New(PyCursesPanelObject,
+                                           state->PyCursesPanel_Type);
+    if (po == NULL) {
+        return NULL;
+    }
 
-    po = PyObject_New(PyCursesPanelObject,
-                      (PyTypeObject *)(_curses_panelstate_global)->PyCursesPanel_Type);
-    if (po == NULL) return NULL;
     po->pan = pan;
     if (insert_lop(po) < 0) {
         po->wo = NULL;
@@ -270,7 +282,7 @@
         Py_DECREF(po->wo);
         remove_lop(po);
     }
-    PyObject_DEL(po);
+    PyObject_Free(po);
     Py_DECREF(tp);
 }
 
@@ -355,6 +367,7 @@
 /*[clinic input]
 _curses_panel.panel.move
 
+    cls: defining_class
     y: int
     x: int
     /
@@ -363,10 +376,12 @@
 [clinic start generated code]*/
 
 static PyObject *
-_curses_panel_panel_move_impl(PyCursesPanelObject *self, int y, int x)
-/*[clinic end generated code: output=d867535a89777415 input=e0b36b78acc03fba]*/
+_curses_panel_panel_move_impl(PyCursesPanelObject *self, PyTypeObject *cls,
+                              int y, int x)
+/*[clinic end generated code: output=ce546c93e56867da input=60a0e7912ff99849]*/
 {
-    return PyCursesCheckERR(move_panel(self->pan, y, x), "move_panel");
+    _curses_panel_state *state = PyType_GetModuleState(cls);
+    return PyCursesCheckERR(state, move_panel(self->pan, y, x), "move_panel");
 }
 
 /*[clinic input]
@@ -386,6 +401,7 @@
 /*[clinic input]
 _curses_panel.panel.replace
 
+    cls: defining_class
     win: object(type="PyCursesWindowObject *", subclass_of="&PyCursesWindow_Type")
     /
 
@@ -394,22 +410,22 @@
 
 static PyObject *
 _curses_panel_panel_replace_impl(PyCursesPanelObject *self,
+                                 PyTypeObject *cls,
                                  PyCursesWindowObject *win)
-/*[clinic end generated code: output=2253a95f7b287255 input=4b1c4283987d9dfa]*/
+/*[clinic end generated code: output=c71f95c212d58ae7 input=dbec7180ece41ff5]*/
 {
-    PyCursesPanelObject *po;
-    int rtn;
+    _curses_panel_state *state = PyType_GetModuleState(cls);
 
-    po = find_po(self->pan);
+    PyCursesPanelObject *po = find_po(self->pan);
     if (po == NULL) {
         PyErr_SetString(PyExc_RuntimeError,
                         "replace_panel: can't find Panel Object");
         return NULL;
     }
 
-    rtn = replace_panel(self->pan, win->win);
+    int rtn = replace_panel(self->pan, win->win);
     if (rtn == ERR) {
-        PyErr_SetString(_curses_panelstate_global->PyCursesError, "replace_panel() returned ERR");
+        PyErr_SetString(state->PyCursesError, "replace_panel() returned ERR");
         return NULL;
     }
     Py_INCREF(win);
@@ -420,6 +436,7 @@
 /*[clinic input]
 _curses_panel.panel.set_userptr
 
+    cls: defining_class
     obj: object
     /
 
@@ -427,38 +444,45 @@
 [clinic start generated code]*/
 
 static PyObject *
-_curses_panel_panel_set_userptr(PyCursesPanelObject *self, PyObject *obj)
-/*[clinic end generated code: output=6fb145b3af88cf4a input=d2c6a9dbefabbf39]*/
+_curses_panel_panel_set_userptr_impl(PyCursesPanelObject *self,
+                                     PyTypeObject *cls, PyObject *obj)
+/*[clinic end generated code: output=db74f3db07b28080 input=e3fee2ff7b1b8e48]*/
 {
-    PyObject *oldobj;
-    int rc;
     PyCursesInitialised;
     Py_INCREF(obj);
-    oldobj = (PyObject *) panel_userptr(self->pan);
-    rc = set_panel_userptr(self->pan, (void*)obj);
+    PyObject *oldobj = (PyObject *) panel_userptr(self->pan);
+    int rc = set_panel_userptr(self->pan, (void*)obj);
     if (rc == ERR) {
         /* In case of an ncurses error, decref the new object again */
         Py_DECREF(obj);
     }
-    Py_XDECREF(oldobj);
-    return PyCursesCheckERR(rc, "set_panel_userptr");
+    else {
+        Py_XDECREF(oldobj);
+    }
+
+    _curses_panel_state *state = PyType_GetModuleState(cls);
+    return PyCursesCheckERR(state, rc, "set_panel_userptr");
 }
 
 /*[clinic input]
 _curses_panel.panel.userptr
 
+    cls: defining_class
+
 Return the user pointer for the panel.
 [clinic start generated code]*/
 
 static PyObject *
-_curses_panel_panel_userptr_impl(PyCursesPanelObject *self)
-/*[clinic end generated code: output=e849c307b5dc9237 input=f78b7a47aef0fd50]*/
+_curses_panel_panel_userptr_impl(PyCursesPanelObject *self,
+                                 PyTypeObject *cls)
+/*[clinic end generated code: output=eea6e6f39ffc0179 input=f22ca4f115e30a80]*/
 {
-    PyObject *obj;
+    _curses_panel_state *state = PyType_GetModuleState(cls);
+
     PyCursesInitialised;
-    obj = (PyObject *) panel_userptr(self->pan);
+    PyObject *obj = (PyObject *) panel_userptr(self->pan);
     if (obj == NULL) {
-        PyErr_SetString(_curses_panelstate_global->PyCursesError, "no userptr set");
+        PyErr_SetString(state->PyCursesError, "no userptr set");
         return NULL;
     }
 
@@ -494,11 +518,10 @@
 };
 
 static PyType_Spec PyCursesPanel_Type_spec = {
-    "_curses_panel.panel",
-    sizeof(PyCursesPanelObject),
-    0,
-    Py_TPFLAGS_DEFAULT,
-    PyCursesPanel_Type_slots
+    .name = "_curses_panel.panel",
+    .basicsize = sizeof(PyCursesPanelObject),
+    .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION,
+    .slots = PyCursesPanel_Type_slots
 };
 
 /* Wrapper for panel_above(NULL). This function returns the bottom
@@ -549,12 +572,14 @@
 _curses_panel_new_panel_impl(PyObject *module, PyCursesWindowObject *win)
 /*[clinic end generated code: output=45e948e0176a9bd2 input=74d4754e0ebe4800]*/
 {
+    _curses_panel_state *state = get_curses_panel_state(module);
+
     PANEL *pan = new_panel(win->win);
     if (pan == NULL) {
-        PyErr_SetString(_curses_panelstate_global->PyCursesError, catchall_NULL);
+        PyErr_SetString(state->PyCursesError, catchall_NULL);
         return NULL;
     }
-    return (PyObject *)PyCursesPanel_New(pan, win);
+    return (PyObject *)PyCursesPanel_New(state, pan, win);
 }
 
 
@@ -610,7 +635,6 @@
     Py_RETURN_NONE;
 }
 
-
 /* List of functions defined in the module */
 
 static PyMethodDef PyCurses_methods[] = {
@@ -622,57 +646,75 @@
 };
 
 /* Initialization function for the module */
+static int
+_curses_panel_exec(PyObject *mod)
+{
+    _curses_panel_state *state = get_curses_panel_state(mod);
+    /* Initialize object type */
+    state->PyCursesPanel_Type = (PyTypeObject *)PyType_FromModuleAndSpec(
+        mod, &PyCursesPanel_Type_spec, NULL);
+    if (state->PyCursesPanel_Type == NULL) {
+        return -1;
+    }
 
+    if (PyModule_AddType(mod, state->PyCursesPanel_Type) < 0) {
+        return -1;
+    }
+
+    import_curses();
+    if (PyErr_Occurred()) {
+        return -1;
+    }
+
+    /* For exception _curses_panel.error */
+    state->PyCursesError = PyErr_NewException(
+        "_curses_panel.error", NULL, NULL);
+
+    Py_INCREF(state->PyCursesError);
+    if (PyModule_AddObject(mod, "error", state->PyCursesError) < 0) {
+        Py_DECREF(state->PyCursesError);
+        return -1;
+    }
+
+    /* Make the version available */
+    PyObject *v = PyUnicode_FromString(PyCursesVersion);
+    if (v == NULL) {
+        return -1;
+    }
+
+    PyObject *d = PyModule_GetDict(mod);
+    if (PyDict_SetItemString(d, "version", v) < 0) {
+        Py_DECREF(v);
+        return -1;
+    }
+    if (PyDict_SetItemString(d, "__version__", v) < 0) {
+        Py_DECREF(v);
+        return -1;
+    }
+
+    Py_DECREF(v);
+
+    return 0;
+}
+
+static PyModuleDef_Slot _curses_slots[] = {
+    {Py_mod_exec, _curses_panel_exec},
+    {0, NULL}
+};
 
 static struct PyModuleDef _curses_panelmodule = {
-        PyModuleDef_HEAD_INIT,
-        "_curses_panel",
-        NULL,
-        sizeof(_curses_panelstate),
-        PyCurses_methods,
-        NULL,
-        _curses_panel_traverse,
-        _curses_panel_clear,
-        _curses_panel_free
+    PyModuleDef_HEAD_INIT,
+    .m_name = "_curses_panel",
+    .m_size = sizeof(_curses_panel_state),
+    .m_methods = PyCurses_methods,
+    .m_slots = _curses_slots,
+    .m_traverse = _curses_panel_traverse,
+    .m_clear = _curses_panel_clear,
+    .m_free = _curses_panel_free
 };
 
 PyMODINIT_FUNC
 PyInit__curses_panel(void)
 {
-    PyObject *m, *d, *v;
-
-    /* Create the module and add the functions */
-    m = PyModule_Create(&_curses_panelmodule);
-    if (m == NULL)
-        goto fail;
-    d = PyModule_GetDict(m);
-
-    /* Initialize object type */
-    v = PyType_FromSpec(&PyCursesPanel_Type_spec);
-    if (v == NULL)
-        goto fail;
-    ((PyTypeObject *)v)->tp_new = NULL;
-    get_curses_panelstate(m)->PyCursesPanel_Type = v;
-
-    import_curses();
-    if (PyErr_Occurred())
-        goto fail;
-
-    /* For exception _curses_panel.error */
-    get_curses_panelstate(m)->PyCursesError = PyErr_NewException("_curses_panel.error", NULL, NULL);
-    PyDict_SetItemString(d, "error", get_curses_panelstate(m)->PyCursesError);
-
-    /* Make the version available */
-    v = PyUnicode_FromString(PyCursesVersion);
-    PyDict_SetItemString(d, "version", v);
-    PyDict_SetItemString(d, "__version__", v);
-    Py_DECREF(v);
-
-    Py_INCREF(get_curses_panelstate(m)->PyCursesPanel_Type);
-    PyModule_AddObject(m, "panel",
-                       (PyObject *)get_curses_panelstate(m)->PyCursesPanel_Type);
-    return m;
-  fail:
-    Py_XDECREF(m);
-    return NULL;
+    return PyModuleDef_Init(&_curses_panelmodule);
 }
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
index c70b0e2..a1de435 100644
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -35,7 +35,7 @@
 
   A number of SysV or ncurses functions don't have wrappers yet; if you
   need a given function, add it and send a patch.  See
-  http://www.python.org/dev/patches/ for instructions on how to submit
+  https://www.python.org/dev/patches/ for instructions on how to submit
   patches to Python.
 
   Here's a list of currently unsupported functions:
@@ -103,7 +103,8 @@
 #define PY_SSIZE_T_CLEAN
 
 #include "Python.h"
-
+#include "pycore_long.h"          // _PyLong_GetZero()
+#include "pycore_structseq.h"     // PyStructSequence_InitType()
 
 #ifdef __hpux
 #define STRICT_SYSV_CURSES
@@ -134,6 +135,28 @@
 #define STRICT_SYSV_CURSES
 #endif
 
+#if NCURSES_EXT_FUNCS+0 >= 20170401 && NCURSES_EXT_COLORS+0 >= 20170401
+#define _NCURSES_EXTENDED_COLOR_FUNCS   1
+#else
+#define _NCURSES_EXTENDED_COLOR_FUNCS   0
+#endif
+
+#if _NCURSES_EXTENDED_COLOR_FUNCS
+#define _CURSES_COLOR_VAL_TYPE          int
+#define _CURSES_COLOR_NUM_TYPE          int
+#define _CURSES_INIT_COLOR_FUNC         init_extended_color
+#define _CURSES_INIT_PAIR_FUNC          init_extended_pair
+#define _COLOR_CONTENT_FUNC             extended_color_content
+#define _CURSES_PAIR_CONTENT_FUNC       extended_pair_content
+#else
+#define _CURSES_COLOR_VAL_TYPE          short
+#define _CURSES_COLOR_NUM_TYPE          short
+#define _CURSES_INIT_COLOR_FUNC         init_color
+#define _CURSES_INIT_PAIR_FUNC          init_pair
+#define _COLOR_CONTENT_FUNC             color_content
+#define _CURSES_PAIR_CONTENT_FUNC       pair_content
+#endif  /* _NCURSES_EXTENDED_COLOR_FUNCS */
+
 /*[clinic input]
 module _curses
 class _curses.window "PyCursesWindowObject *" "&PyCursesWindow_Type"
@@ -176,18 +199,6 @@
 
 /* Utility Functions */
 
-static inline int
-color_pair_to_attr(short color_number)
-{
-    return ((int)color_number << 8);
-}
-
-static inline short
-attr_to_color_pair(int attr)
-{
-    return (short)((attr & A_COLOR) >> 8);
-}
-
 /*
  * Check the return code from a curses function and return None
  * or raise an exception as appropriate.  These are exported using the
@@ -377,6 +388,7 @@
         *bytes = obj;
         /* check for embedded null bytes */
         if (PyBytes_AsStringAndSize(*bytes, &str, NULL) < 0) {
+            Py_DECREF(obj);
             return 0;
         }
         return 1;
@@ -387,6 +399,132 @@
     return 0;
 }
 
+static int
+color_allow_default_converter(PyObject *arg, void *ptr)
+{
+    long color_number;
+    int overflow;
+
+    color_number = PyLong_AsLongAndOverflow(arg, &overflow);
+    if (color_number == -1 && PyErr_Occurred())
+        return 0;
+
+    if (overflow > 0 || color_number >= COLORS) {
+        PyErr_Format(PyExc_ValueError,
+                     "Color number is greater than COLORS-1 (%d).",
+                     COLORS - 1);
+        return 0;
+    }
+    else if (overflow < 0 || color_number < 0) {
+        color_number = -1;
+    }
+
+    *(int *)ptr = (int)color_number;
+    return 1;
+}
+
+static int
+color_converter(PyObject *arg, void *ptr)
+{
+    if (!color_allow_default_converter(arg, ptr)) {
+        return 0;
+    }
+    if (*(int *)ptr < 0) {
+        PyErr_SetString(PyExc_ValueError,
+                        "Color number is less than 0.");
+        return 0;
+    }
+    return 1;
+}
+
+/*[python input]
+class color_converter(CConverter):
+    type = 'int'
+    converter = 'color_converter'
+[python start generated code]*/
+/*[python end generated code: output=da39a3ee5e6b4b0d input=4260d2b6e66b3709]*/
+
+/*[python input]
+class color_allow_default_converter(CConverter):
+    type = 'int'
+    converter = 'color_allow_default_converter'
+[python start generated code]*/
+/*[python end generated code: output=da39a3ee5e6b4b0d input=975602bc058a872d]*/
+
+static int
+pair_converter(PyObject *arg, void *ptr)
+{
+    long pair_number;
+    int overflow;
+
+    pair_number = PyLong_AsLongAndOverflow(arg, &overflow);
+    if (pair_number == -1 && PyErr_Occurred())
+        return 0;
+
+#if _NCURSES_EXTENDED_COLOR_FUNCS
+    if (overflow > 0 || pair_number > INT_MAX) {
+        PyErr_Format(PyExc_ValueError,
+                     "Color pair is greater than maximum (%d).",
+                     INT_MAX);
+        return 0;
+    }
+#else
+    if (overflow > 0 || pair_number >= COLOR_PAIRS) {
+        PyErr_Format(PyExc_ValueError,
+                     "Color pair is greater than COLOR_PAIRS-1 (%d).",
+                     COLOR_PAIRS - 1);
+        return 0;
+    }
+#endif
+    else if (overflow < 0 || pair_number < 0) {
+        PyErr_SetString(PyExc_ValueError,
+                        "Color pair is less than 0.");
+        return 0;
+    }
+
+    *(int *)ptr = (int)pair_number;
+    return 1;
+}
+
+/*[python input]
+class pair_converter(CConverter):
+    type = 'int'
+    converter = 'pair_converter'
+[python start generated code]*/
+/*[python end generated code: output=da39a3ee5e6b4b0d input=1a918ae6a1b32af7]*/
+
+static int
+component_converter(PyObject *arg, void *ptr)
+{
+    long component;
+    int overflow;
+
+    component = PyLong_AsLongAndOverflow(arg, &overflow);
+    if (component == -1 && PyErr_Occurred())
+        return 0;
+
+    if (overflow > 0 || component > 1000) {
+        PyErr_SetString(PyExc_ValueError,
+                        "Color component is greater than 1000");
+        return 0;
+    }
+    else if (overflow < 0 || component < 0) {
+        PyErr_SetString(PyExc_ValueError,
+                        "Color component is less than 0");
+        return 0;
+    }
+
+    *(short *)ptr = (short)component;
+    return 1;
+}
+
+/*[python input]
+class component_converter(CConverter):
+    type = 'short'
+    converter = 'component_converter'
+[python start generated code]*/
+/*[python end generated code: output=da39a3ee5e6b4b0d input=38e9be01d33927fb]*/
+
 /* Function versions of the 3 functions for testing whether curses has been
    initialised or not. */
 
@@ -565,7 +703,7 @@
     if (wo->win != stdscr) delwin(wo->win);
     if (wo->encoding != NULL)
         PyMem_Free(wo->encoding);
-    PyObject_DEL(wo);
+    PyObject_Free(wo);
 }
 
 /* Addch, Addstr, Addnstr */
@@ -618,7 +756,7 @@
     if (type == 2) {
         funcname = "add_wch";
         wstr[1] = L'\0';
-        setcchar(&wcval, wstr, attr, attr_to_color_pair(attr), NULL);
+        setcchar(&wcval, wstr, attr, PAIR_NUMBER(attr), NULL);
         if (coordinates_group)
             rtn = mvwadd_wch(self->win,y,x, &wcval);
         else {
@@ -691,8 +829,9 @@
 #else
     strtype = PyCurses_ConvertToString(self, str, &bytesobj, NULL);
 #endif
-    if (strtype == 0)
+    if (strtype == 0) {
         return NULL;
+    }
     if (use_attr) {
         attr_old = getattrs(self->win);
         (void)wattrset(self->win,attr);
@@ -971,9 +1110,9 @@
 _curses.window.box
 
     [
-    verch: object(c_default="_PyLong_Zero") = 0
+    verch: object(c_default="_PyLong_GetZero()") = 0
         Left and right side.
-    horch: object(c_default="_PyLong_Zero") = 0
+    horch: object(c_default="_PyLong_GetZero()") = 0
         Top and bottom side.
     ]
     /
@@ -987,7 +1126,7 @@
 static PyObject *
 _curses_window_box_impl(PyCursesWindowObject *self, int group_right_1,
                         PyObject *verch, PyObject *horch)
-/*[clinic end generated code: output=f3fcb038bb287192 input=465a121741c1efdf]*/
+/*[clinic end generated code: output=f3fcb038bb287192 input=f00435f9c8c98f60]*/
 {
     chtype ch1 = 0, ch2 = 0;
     if (group_right_1) {
@@ -1087,8 +1226,8 @@
         return NULL;
     }
 
-    color = (short)((attr >> 8) & 0xff);
-    attr = attr - (color << 8);
+    color = (short) PAIR_NUMBER(attr);
+    attr = attr & A_ATTRIBUTES;
 
     if (use_xy) {
         rtn = mvwchgat(self->win,y,x,num,attr,color,NULL);
@@ -1204,7 +1343,7 @@
 
 #ifdef NCURSES_MOUSE_VERSION
 /*[clinic input]
-_curses.window.enclose -> long
+_curses.window.enclose
 
     y: int
         Y-coordinate.
@@ -1215,11 +1354,11 @@
 Return True if the screen-relative coordinates are enclosed by the window.
 [clinic start generated code]*/
 
-static long
+static PyObject *
 _curses_window_enclose_impl(PyCursesWindowObject *self, int y, int x)
-/*[clinic end generated code: output=5251c961cbe3df63 input=dfe1d9d4d05d8642]*/
+/*[clinic end generated code: output=8679beef50502648 input=4fd3355d723f7bc9]*/
 {
-    return wenclose(self->win, y, x);
+    return PyBool_FromLong(wenclose(self->win, y, x));
 }
 #endif
 
@@ -2585,8 +2724,8 @@
 /*[clinic input]
 _curses.color_content
 
-    color_number: short
-        The number of the color (0 - COLORS).
+    color_number: color
+        The number of the color (0 - (COLORS-1)).
     /
 
 Return the red, green, and blue (RGB) components of the specified color.
@@ -2596,28 +2735,28 @@
 [clinic start generated code]*/
 
 static PyObject *
-_curses_color_content_impl(PyObject *module, short color_number)
-/*[clinic end generated code: output=cb15cf3120d4bfc1 input=5555abb1c11e11b7]*/
+_curses_color_content_impl(PyObject *module, int color_number)
+/*[clinic end generated code: output=17b466df7054e0de input=03b5ed0472662aea]*/
 {
-    short r,g,b;
+    _CURSES_COLOR_VAL_TYPE r,g,b;
 
     PyCursesInitialised;
     PyCursesInitialisedColor;
 
-    if (color_content(color_number, &r, &g, &b) != ERR)
-        return Py_BuildValue("(iii)", r, g, b);
-    else {
-        PyErr_SetString(PyCursesError,
-                        "Argument 1 was out of range. Check value of COLORS.");
+    if (_COLOR_CONTENT_FUNC(color_number, &r, &g, &b) == ERR) {
+        PyErr_Format(PyCursesError, "%s() returned ERR",
+                        Py_STRINGIFY(_COLOR_CONTENT_FUNC));
         return NULL;
     }
+
+    return Py_BuildValue("(iii)", r, g, b);
 }
 
 /*[clinic input]
 _curses.color_pair
 
-    color_number: short
-        The number of the color (0 - COLORS).
+    pair_number: int
+        The number of the color pair.
     /
 
 Return the attribute value for displaying text in the specified color.
@@ -2627,13 +2766,13 @@
 [clinic start generated code]*/
 
 static PyObject *
-_curses_color_pair_impl(PyObject *module, short color_number)
-/*[clinic end generated code: output=6a84cb6b29ecaf9a input=a9d3eb6f50e4dc12]*/
+_curses_color_pair_impl(PyObject *module, int pair_number)
+/*[clinic end generated code: output=60718abb10ce9feb input=6034e9146f343802]*/
 {
     PyCursesInitialised;
     PyCursesInitialisedColor;
 
-    return  PyLong_FromLong(color_pair_to_attr(color_number));
+    return  PyLong_FromLong(COLOR_PAIR(pair_number));
 }
 
 /*[clinic input]
@@ -3027,13 +3166,13 @@
 /*[clinic input]
 _curses.init_color
 
-    color_number: short
-        The number of the color to be changed (0 - COLORS).
-    r: short
+    color_number: color
+        The number of the color to be changed (0 - (COLORS-1)).
+    r: component
         Red component (0 - 1000).
-    g: short
+    g: component
         Green component (0 - 1000).
-    b: short
+    b: component
         Blue component (0 - 1000).
     /
 
@@ -3041,29 +3180,30 @@
 
 When init_color() is used, all occurrences of that color on the screen
 immediately change to the new definition.  This function is a no-op on
-most terminals; it is active only if can_change_color() returns 1.
+most terminals; it is active only if can_change_color() returns true.
 [clinic start generated code]*/
 
 static PyObject *
-_curses_init_color_impl(PyObject *module, short color_number, short r,
-                        short g, short b)
-/*[clinic end generated code: output=280236f5efe9776a input=f3a05bd38f619175]*/
+_curses_init_color_impl(PyObject *module, int color_number, short r, short g,
+                        short b)
+/*[clinic end generated code: output=d7ed71b2d818cdf2 input=ae2b8bea0f152c80]*/
 {
     PyCursesInitialised;
     PyCursesInitialisedColor;
 
-    return PyCursesCheckERR(init_color(color_number, r, g, b), "init_color");
+    return PyCursesCheckERR(_CURSES_INIT_COLOR_FUNC(color_number, r, g, b),
+                            Py_STRINGIFY(_CURSES_INIT_COLOR_FUNC));
 }
 
 /*[clinic input]
 _curses.init_pair
 
-    pair_number: short
+    pair_number: pair
         The number of the color-pair to be changed (1 - (COLOR_PAIRS-1)).
-    fg: short
-        Foreground color number (0 - COLORS).
-    bg: short
-        Background color number (0 - COLORS).
+    fg: color_allow_default
+        Foreground color number (-1 - (COLORS-1)).
+    bg: color_allow_default
+        Background color number (-1 - (COLORS-1)).
     /
 
 Change the definition of a color-pair.
@@ -3073,14 +3213,26 @@
 [clinic start generated code]*/
 
 static PyObject *
-_curses_init_pair_impl(PyObject *module, short pair_number, short fg,
-                       short bg)
-/*[clinic end generated code: output=9c2ce39c22f376b6 input=c9f0b11b17a2ac6d]*/
+_curses_init_pair_impl(PyObject *module, int pair_number, int fg, int bg)
+/*[clinic end generated code: output=a0bba03d2bbc3ee6 input=54b421b44c12c389]*/
 {
     PyCursesInitialised;
     PyCursesInitialisedColor;
 
-    return PyCursesCheckERR(init_pair(pair_number, fg, bg), "init_pair");
+    if (_CURSES_INIT_PAIR_FUNC(pair_number, fg, bg) == ERR) {
+        if (pair_number >= COLOR_PAIRS) {
+            PyErr_Format(PyExc_ValueError,
+                         "Color pair is greater than COLOR_PAIRS-1 (%d).",
+                         COLOR_PAIRS - 1);
+        }
+        else {
+            PyErr_Format(PyCursesError, "%s() returned ERR",
+                         Py_STRINGIFY(_CURSES_INIT_PAIR_FUNC));
+        }
+        return NULL;
+    }
+
+    Py_RETURN_NONE;
 }
 
 static PyObject *ModDict;
@@ -3697,25 +3849,32 @@
 /*[clinic input]
 _curses.pair_content
 
-    pair_number: short
-        The number of the color pair (1 - (COLOR_PAIRS-1)).
+    pair_number: pair
+        The number of the color pair (0 - (COLOR_PAIRS-1)).
     /
 
 Return a tuple (fg, bg) containing the colors for the requested color pair.
 [clinic start generated code]*/
 
 static PyObject *
-_curses_pair_content_impl(PyObject *module, short pair_number)
-/*[clinic end generated code: output=5a72aa1a28bbacf3 input=f4d7fec5643b976b]*/
+_curses_pair_content_impl(PyObject *module, int pair_number)
+/*[clinic end generated code: output=4a726dd0e6885f3f input=03970f840fc7b739]*/
 {
-    short f, b;
+    _CURSES_COLOR_NUM_TYPE f, b;
 
     PyCursesInitialised;
     PyCursesInitialisedColor;
 
-    if (pair_content(pair_number, &f, &b)==ERR) {
-        PyErr_SetString(PyCursesError,
-                        "Argument 1 was out of range. (1..COLOR_PAIRS-1)");
+    if (_CURSES_PAIR_CONTENT_FUNC(pair_number, &f, &b) == ERR) {
+        if (pair_number >= COLOR_PAIRS) {
+            PyErr_Format(PyExc_ValueError,
+                         "Color pair is greater than COLOR_PAIRS-1 (%d).",
+                         COLOR_PAIRS - 1);
+        }
+        else {
+            PyErr_Format(PyCursesError, "%s() returned ERR",
+                         Py_STRINGIFY(_CURSES_PAIR_CONTENT_FUNC));
+        }
         return NULL;
     }
 
@@ -3740,7 +3899,7 @@
     PyCursesInitialised;
     PyCursesInitialisedColor;
 
-    return PyLong_FromLong(attr_to_color_pair(attr));
+    return PyLong_FromLong(PAIR_NUMBER(attr));
 }
 
 /*[clinic input]
@@ -4450,6 +4609,21 @@
 
 #endif /* NCURSES_VERSION */
 
+/*[clinic input]
+_curses.has_extended_color_support
+
+Return True if the module supports extended colors; otherwise, return False.
+
+Extended color support allows more than 256 color-pairs for terminals
+that support more than 16 colors (e.g. xterm-256color).
+[clinic start generated code]*/
+
+static PyObject *
+_curses_has_extended_color_support_impl(PyObject *module)
+/*[clinic end generated code: output=68f1be2b57d92e22 input=4b905f046e35ee9f]*/
+{
+    return PyBool_FromLong(_NCURSES_EXTENDED_COLOR_FUNCS);
+}
 
 /* List of functions defined in the module */
 
@@ -4476,6 +4650,7 @@
     _CURSES_GETSYX_METHODDEF
     _CURSES_GETWIN_METHODDEF
     _CURSES_HAS_COLORS_METHODDEF
+    _CURSES_HAS_EXTENDED_COLOR_SUPPORT_METHODDEF
     _CURSES_HAS_IC_METHODDEF
     _CURSES_HAS_IL_METHODDEF
     _CURSES_HAS_KEY_METHODDEF
@@ -4552,22 +4727,23 @@
     NULL
 };
 
+static void
+curses_destructor(PyObject *op)
+{
+    void *ptr = PyCapsule_GetPointer(op, PyCurses_CAPSULE_NAME);
+    Py_DECREF(*(void **)ptr);
+    PyMem_Free(ptr);
+}
+
 PyMODINIT_FUNC
 PyInit__curses(void)
 {
     PyObject *m, *d, *v, *c_api_object;
-    static void *PyCurses_API[PyCurses_API_pointers];
 
     /* Initialize object type */
     if (PyType_Ready(&PyCursesWindow_Type) < 0)
         return NULL;
 
-    /* Initialize the C API pointer array */
-    PyCurses_API[0] = (void *)&PyCursesWindow_Type;
-    PyCurses_API[1] = (void *)func_PyCursesSetupTermCalled;
-    PyCurses_API[2] = (void *)func_PyCursesInitialised;
-    PyCurses_API[3] = (void *)func_PyCursesInitialisedColor;
-
     /* Create the module and add the functions */
     m = PyModule_Create(&_cursesmodule);
     if (m == NULL)
@@ -4579,9 +4755,29 @@
         return NULL;
     ModDict = d; /* For PyCurses_InitScr to use later */
 
+    void **PyCurses_API = PyMem_Calloc(PyCurses_API_pointers, sizeof(void *));
+    if (PyCurses_API == NULL) {
+        PyErr_NoMemory();
+        return NULL;
+    }
+    /* Initialize the C API pointer array */
+    PyCurses_API[0] = (void *)Py_NewRef(&PyCursesWindow_Type);
+    PyCurses_API[1] = (void *)func_PyCursesSetupTermCalled;
+    PyCurses_API[2] = (void *)func_PyCursesInitialised;
+    PyCurses_API[3] = (void *)func_PyCursesInitialisedColor;
+
     /* Add a capsule for the C API */
-    c_api_object = PyCapsule_New(PyCurses_API, PyCurses_CAPSULE_NAME, NULL);
-    PyDict_SetItemString(d, "_C_API", c_api_object);
+    c_api_object = PyCapsule_New(PyCurses_API, PyCurses_CAPSULE_NAME,
+                                 curses_destructor);
+    if (c_api_object == NULL) {
+        Py_DECREF(PyCurses_API[0]);
+        PyMem_Free(PyCurses_API);
+        return NULL;
+    }
+    if (PyDict_SetItemString(d, "_C_API", c_api_object) < 0) {
+        Py_DECREF(c_api_object);
+        return NULL;
+    }
     Py_DECREF(c_api_object);
 
     /* For exception curses.error */
@@ -4597,9 +4793,11 @@
 #ifdef NCURSES_VERSION
     /* ncurses_version */
     if (NcursesVersionType.tp_name == NULL) {
-        if (PyStructSequence_InitType2(&NcursesVersionType,
-                                       &ncurses_version_desc) < 0)
+        if (_PyStructSequence_InitType(&NcursesVersionType,
+                                       &ncurses_version_desc,
+                                       Py_TPFLAGS_DISALLOW_INSTANTIATION) < 0) {
             return NULL;
+        }
     }
     v = make_ncurses_version();
     if (v == NULL) {
@@ -4607,15 +4805,6 @@
     }
     PyDict_SetItemString(d, "ncurses_version", v);
     Py_DECREF(v);
-
-    /* prevent user from creating new instances */
-    NcursesVersionType.tp_init = NULL;
-    NcursesVersionType.tp_new = NULL;
-    if (PyDict_DelItemString(NcursesVersionType.tp_dict, "__new__") < 0 &&
-        PyErr_ExceptionMatches(PyExc_KeyError))
-    {
-        PyErr_Clear();
-    }
 #endif /* NCURSES_VERSION */
 
     SetDictInt("ERR", ERR);
@@ -4697,6 +4886,14 @@
     SetDictInt("BUTTON4_DOUBLE_CLICKED",   BUTTON4_DOUBLE_CLICKED);
     SetDictInt("BUTTON4_TRIPLE_CLICKED",   BUTTON4_TRIPLE_CLICKED);
 
+#if NCURSES_MOUSE_VERSION > 1
+    SetDictInt("BUTTON5_PRESSED",          BUTTON5_PRESSED);
+    SetDictInt("BUTTON5_RELEASED",         BUTTON5_RELEASED);
+    SetDictInt("BUTTON5_CLICKED",          BUTTON5_CLICKED);
+    SetDictInt("BUTTON5_DOUBLE_CLICKED",   BUTTON5_DOUBLE_CLICKED);
+    SetDictInt("BUTTON5_TRIPLE_CLICKED",   BUTTON5_TRIPLE_CLICKED);
+#endif
+
     SetDictInt("BUTTON_SHIFT",             BUTTON_SHIFT);
     SetDictInt("BUTTON_CTRL",              BUTTON_CTRL);
     SetDictInt("BUTTON_ALT",               BUTTON_ALT);
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c
index 4e0c378..e54a01b 100644
--- a/Modules/_datetimemodule.c
+++ b/Modules/_datetimemodule.c
@@ -8,6 +8,8 @@
 #define _PY_DATETIME_IMPL
 
 #include "Python.h"
+#include "pycore_long.h"          // _PyLong_GetOne()
+#include "pycore_object.h"        // _PyObject_Init()
 #include "datetime.h"
 #include "structmember.h"         // PyMemberDef
 
@@ -114,14 +116,9 @@
 #define SET_TD_SECONDS(o, v)    ((o)->seconds = (v))
 #define SET_TD_MICROSECONDS(o, v) ((o)->microseconds = (v))
 
-/* p is a pointer to a time or a datetime object; HASTZINFO(p) returns
- * p->hastzinfo.
- */
-#define HASTZINFO(p) (((_PyDateTime_BaseTZInfo *)(p))->hastzinfo)
-#define GET_TIME_TZINFO(p) (HASTZINFO(p) ? \
-                            ((PyDateTime_Time *)(p))->tzinfo : Py_None)
-#define GET_DT_TZINFO(p) (HASTZINFO(p) ? \
-                          ((PyDateTime_DateTime *)(p))->tzinfo : Py_None)
+#define HASTZINFO               _PyDateTime_HAS_TZINFO
+#define GET_TIME_TZINFO         PyDateTime_TIME_GET_TZINFO
+#define GET_DT_TZINFO           PyDateTime_DATE_GET_TZINFO
 /* M is a char or int claiming to be a valid month.  The macro is equivalent
  * to the two-sided Python test
  *      1 <= M <= 12
@@ -638,30 +635,24 @@
 static PyObject *
 time_alloc(PyTypeObject *type, Py_ssize_t aware)
 {
-    PyObject *self;
-
-    self = (PyObject *)
-        PyObject_MALLOC(aware ?
-                        sizeof(PyDateTime_Time) :
-                sizeof(_PyDateTime_BaseTime));
-    if (self == NULL)
-        return (PyObject *)PyErr_NoMemory();
-    (void)PyObject_INIT(self, type);
+    size_t size = aware ? sizeof(PyDateTime_Time) : sizeof(_PyDateTime_BaseTime);
+    PyObject *self = (PyObject *)PyObject_Malloc(size);
+    if (self == NULL) {
+        return PyErr_NoMemory();
+    }
+    _PyObject_Init(self, type);
     return self;
 }
 
 static PyObject *
 datetime_alloc(PyTypeObject *type, Py_ssize_t aware)
 {
-    PyObject *self;
-
-    self = (PyObject *)
-        PyObject_MALLOC(aware ?
-                        sizeof(PyDateTime_DateTime) :
-                sizeof(_PyDateTime_BaseDateTime));
-    if (self == NULL)
-        return (PyObject *)PyErr_NoMemory();
-    (void)PyObject_INIT(self, type);
+    size_t size = aware ? sizeof(PyDateTime_DateTime) : sizeof(_PyDateTime_BaseDateTime);
+    PyObject *self = (PyObject *)PyObject_Malloc(size);
+    if (self == NULL) {
+        return PyErr_NoMemory();
+    }
+    _PyObject_Init(self, type);
     return self;
 }
 
@@ -1022,7 +1013,7 @@
  * true.  Passing false is a speed optimization, if you know for sure
  * that seconds and microseconds are already in their proper ranges.  In any
  * case, raises OverflowError and returns NULL if the normalized days is out
- * of range).
+ * of range.
  */
 static PyObject *
 new_delta_ex(int days, int seconds, int microseconds, int normalize,
@@ -2458,7 +2449,7 @@
         goto Done
 
     if (us) {
-        y = accum("microseconds", x, us, _PyLong_One, &leftover_us);
+        y = accum("microseconds", x, us, _PyLong_GetOne(), &leftover_us);
         CLEANUP;
     }
     if (ms) {
@@ -2497,7 +2488,7 @@
              * is odd. Note that x is odd when it's last bit is 1. The
              * code below uses bitwise and operation to check the last
              * bit. */
-            temp = PyNumber_And(x, _PyLong_One);  /* temp <- x & 1 */
+            temp = PyNumber_And(x, _PyLong_GetOne());  /* temp <- x & 1 */
             if (temp == NULL) {
                 Py_DECREF(x);
                 goto Done;
@@ -6482,53 +6473,48 @@
     {NULL, NULL}
 };
 
-/* C API.  Clients get at this via PyDateTime_IMPORT, defined in
- * datetime.h.
+/* Get a new C API by calling this function.
+ * Clients get at C API via PyDateTime_IMPORT, defined in datetime.h.
  */
-static PyDateTime_CAPI CAPI = {
-    &PyDateTime_DateType,
-    &PyDateTime_DateTimeType,
-    &PyDateTime_TimeType,
-    &PyDateTime_DeltaType,
-    &PyDateTime_TZInfoType,
-    NULL,                       // PyDatetime_TimeZone_UTC not initialized yet
-    new_date_ex,
-    new_datetime_ex,
-    new_time_ex,
-    new_delta_ex,
-    new_timezone,
-    datetime_fromtimestamp,
-    datetime_date_fromtimestamp_capi,
-    new_datetime_ex2,
-    new_time_ex2
-};
-
-
-
-static struct PyModuleDef datetimemodule = {
-    PyModuleDef_HEAD_INIT,
-    "_datetime",
-    "Fast implementation of the datetime type.",
-    -1,
-    module_methods,
-    NULL,
-    NULL,
-    NULL,
-    NULL
-};
-
-PyMODINIT_FUNC
-PyInit__datetime(void)
+static inline PyDateTime_CAPI *
+get_datetime_capi(void)
 {
-    PyObject *m;        /* a module object */
-    PyObject *d;        /* its dict */
-    PyObject *x;
-    PyObject *delta;
-
-    m = PyModule_Create(&datetimemodule);
-    if (m == NULL)
+    PyDateTime_CAPI *capi = PyMem_Malloc(sizeof(PyDateTime_CAPI));
+    if (capi == NULL) {
+        PyErr_NoMemory();
         return NULL;
+    }
+    capi->DateType = &PyDateTime_DateType;
+    capi->DateTimeType = &PyDateTime_DateTimeType;
+    capi->TimeType = &PyDateTime_TimeType;
+    capi->DeltaType = &PyDateTime_DeltaType;
+    capi->TZInfoType = &PyDateTime_TZInfoType;
+    capi->Date_FromDate = new_date_ex;
+    capi->DateTime_FromDateAndTime = new_datetime_ex;
+    capi->Time_FromTime = new_time_ex;
+    capi->Delta_FromDelta = new_delta_ex;
+    capi->TimeZone_FromTimeZone = new_timezone;
+    capi->DateTime_FromTimestamp = datetime_fromtimestamp;
+    capi->Date_FromTimestamp = datetime_date_fromtimestamp_capi;
+    capi->DateTime_FromDateAndTimeAndFold = new_datetime_ex2;
+    capi->Time_FromTimeAndFold = new_time_ex2;
+    // Make sure this function is called after PyDateTime_TimeZone_UTC has
+    // been initialized.
+    assert(PyDateTime_TimeZone_UTC != NULL);
+    capi->TimeZone_UTC = PyDateTime_TimeZone_UTC; // borrowed ref
+    return capi;
+}
 
+static void
+datetime_destructor(PyObject *op)
+{
+    void *ptr = PyCapsule_GetPointer(op, PyDateTime_CAPSULE_NAME);
+    PyMem_Free(ptr);
+}
+
+static int
+_datetime_exec(PyObject *module)
+{
     // `&...` is not a constant expression according to a strict reading
     // of C standards. Fill tp_base at run-time rather than statically.
     // See https://bugs.python.org/issue40777
@@ -6546,136 +6532,124 @@
     };
 
     for (size_t i = 0; i < Py_ARRAY_LENGTH(types); i++) {
-        if (PyModule_AddType(m, types[i]) < 0) {
-            return NULL;
+        if (PyModule_AddType(module, types[i]) < 0) {
+            return -1;
         }
     }
 
     if (PyType_Ready(&PyDateTime_IsoCalendarDateType) < 0) {
-        return NULL;
+        return -1;
     }
-    Py_INCREF(&PyDateTime_IsoCalendarDateType);
+
+#define DATETIME_ADD_MACRO(dict, c, value_expr)         \
+    do {                                                \
+        PyObject *value = (value_expr);                 \
+        if (value == NULL) {                            \
+            return -1;                                  \
+        }                                               \
+        if (PyDict_SetItemString(dict, c, value) < 0) { \
+            Py_DECREF(value);                           \
+            return -1;                                  \
+        }                                               \
+        Py_DECREF(value);                               \
+    } while(0)
 
     /* timedelta values */
-    d = PyDateTime_DeltaType.tp_dict;
-
-    x = new_delta(0, 0, 1, 0);
-    if (x == NULL || PyDict_SetItemString(d, "resolution", x) < 0)
-        return NULL;
-    Py_DECREF(x);
-
-    x = new_delta(-MAX_DELTA_DAYS, 0, 0, 0);
-    if (x == NULL || PyDict_SetItemString(d, "min", x) < 0)
-        return NULL;
-    Py_DECREF(x);
-
-    x = new_delta(MAX_DELTA_DAYS, 24*3600-1, 1000000-1, 0);
-    if (x == NULL || PyDict_SetItemString(d, "max", x) < 0)
-        return NULL;
-    Py_DECREF(x);
+    PyObject *d = PyDateTime_DeltaType.tp_dict;
+    DATETIME_ADD_MACRO(d, "resolution", new_delta(0, 0, 1, 0));
+    DATETIME_ADD_MACRO(d, "min", new_delta(-MAX_DELTA_DAYS, 0, 0, 0));
+    DATETIME_ADD_MACRO(d, "max",
+                       new_delta(MAX_DELTA_DAYS, 24*3600-1, 1000000-1, 0));
 
     /* date values */
     d = PyDateTime_DateType.tp_dict;
-
-    x = new_date(1, 1, 1);
-    if (x == NULL || PyDict_SetItemString(d, "min", x) < 0)
-        return NULL;
-    Py_DECREF(x);
-
-    x = new_date(MAXYEAR, 12, 31);
-    if (x == NULL || PyDict_SetItemString(d, "max", x) < 0)
-        return NULL;
-    Py_DECREF(x);
-
-    x = new_delta(1, 0, 0, 0);
-    if (x == NULL || PyDict_SetItemString(d, "resolution", x) < 0)
-        return NULL;
-    Py_DECREF(x);
+    DATETIME_ADD_MACRO(d, "min", new_date(1, 1, 1));
+    DATETIME_ADD_MACRO(d, "max", new_date(MAXYEAR, 12, 31));
+    DATETIME_ADD_MACRO(d, "resolution", new_delta(1, 0, 0, 0));
 
     /* time values */
     d = PyDateTime_TimeType.tp_dict;
-
-    x = new_time(0, 0, 0, 0, Py_None, 0);
-    if (x == NULL || PyDict_SetItemString(d, "min", x) < 0)
-        return NULL;
-    Py_DECREF(x);
-
-    x = new_time(23, 59, 59, 999999, Py_None, 0);
-    if (x == NULL || PyDict_SetItemString(d, "max", x) < 0)
-        return NULL;
-    Py_DECREF(x);
-
-    x = new_delta(0, 0, 1, 0);
-    if (x == NULL || PyDict_SetItemString(d, "resolution", x) < 0)
-        return NULL;
-    Py_DECREF(x);
+    DATETIME_ADD_MACRO(d, "min", new_time(0, 0, 0, 0, Py_None, 0));
+    DATETIME_ADD_MACRO(d, "max", new_time(23, 59, 59, 999999, Py_None, 0));
+    DATETIME_ADD_MACRO(d, "resolution", new_delta(0, 0, 1, 0));
 
     /* datetime values */
     d = PyDateTime_DateTimeType.tp_dict;
-
-    x = new_datetime(1, 1, 1, 0, 0, 0, 0, Py_None, 0);
-    if (x == NULL || PyDict_SetItemString(d, "min", x) < 0)
-        return NULL;
-    Py_DECREF(x);
-
-    x = new_datetime(MAXYEAR, 12, 31, 23, 59, 59, 999999, Py_None, 0);
-    if (x == NULL || PyDict_SetItemString(d, "max", x) < 0)
-        return NULL;
-    Py_DECREF(x);
-
-    x = new_delta(0, 0, 1, 0);
-    if (x == NULL || PyDict_SetItemString(d, "resolution", x) < 0)
-        return NULL;
-    Py_DECREF(x);
+    DATETIME_ADD_MACRO(d, "min",
+                       new_datetime(1, 1, 1, 0, 0, 0, 0, Py_None, 0));
+    DATETIME_ADD_MACRO(d, "max", new_datetime(MAXYEAR, 12, 31, 23, 59, 59,
+                                              999999, Py_None, 0));
+    DATETIME_ADD_MACRO(d, "resolution", new_delta(0, 0, 1, 0));
 
     /* timezone values */
     d = PyDateTime_TimeZoneType.tp_dict;
+    PyObject *delta = new_delta(0, 0, 0, 0);
+    if (delta == NULL) {
+        return -1;
+    }
 
-    delta = new_delta(0, 0, 0, 0);
-    if (delta == NULL)
-        return NULL;
-    x = create_timezone(delta, NULL);
+    PyObject *x = create_timezone(delta, NULL);
     Py_DECREF(delta);
-    if (x == NULL || PyDict_SetItemString(d, "utc", x) < 0)
-        return NULL;
+    if (x == NULL) {
+        return -1;
+    }
+    if (PyDict_SetItemString(d, "utc", x) < 0) {
+        Py_DECREF(x);
+        return -1;
+    }
+
     PyDateTime_TimeZone_UTC = x;
-    CAPI.TimeZone_UTC = PyDateTime_TimeZone_UTC;
 
     /* bpo-37642: These attributes are rounded to the nearest minute for backwards
      * compatibility, even though the constructor will accept a wider range of
      * values. This may change in the future.*/
     delta = new_delta(-1, 60, 0, 1); /* -23:59 */
-    if (delta == NULL)
-        return NULL;
+    if (delta == NULL) {
+        return -1;
+    }
+
     x = create_timezone(delta, NULL);
     Py_DECREF(delta);
-    if (x == NULL || PyDict_SetItemString(d, "min", x) < 0)
-        return NULL;
-    Py_DECREF(x);
+    DATETIME_ADD_MACRO(d, "min", x);
 
     delta = new_delta(0, (23 * 60 + 59) * 60, 0, 0); /* +23:59 */
-    if (delta == NULL)
-        return NULL;
+    if (delta == NULL) {
+        return -1;
+    }
+
     x = create_timezone(delta, NULL);
     Py_DECREF(delta);
-    if (x == NULL || PyDict_SetItemString(d, "max", x) < 0)
-        return NULL;
-    Py_DECREF(x);
+    DATETIME_ADD_MACRO(d, "max", x);
 
     /* Epoch */
     PyDateTime_Epoch = new_datetime(1970, 1, 1, 0, 0, 0, 0,
                                     PyDateTime_TimeZone_UTC, 0);
-    if (PyDateTime_Epoch == NULL)
-      return NULL;
+    if (PyDateTime_Epoch == NULL) {
+        return -1;
+    }
 
     /* module initialization */
-    PyModule_AddIntMacro(m, MINYEAR);
-    PyModule_AddIntMacro(m, MAXYEAR);
+    if (PyModule_AddIntMacro(module, MINYEAR) < 0) {
+        return -1;
+    }
+    if (PyModule_AddIntMacro(module, MAXYEAR) < 0) {
+        return -1;
+    }
 
-    x = PyCapsule_New(&CAPI, PyDateTime_CAPSULE_NAME, NULL);
-    if (x == NULL)
-        return NULL;
-    PyModule_AddObject(m, "datetime_CAPI", x);
+    PyDateTime_CAPI *capi = get_datetime_capi();
+    if (capi == NULL) {
+        return -1;
+    }
+    x = PyCapsule_New(capi, PyDateTime_CAPSULE_NAME, datetime_destructor);
+    if (x == NULL) {
+        PyMem_Free(capi);
+        return -1;
+    }
+
+    if (PyModule_AddObject(module, "datetime_CAPI", x) < 0) {
+        Py_DECREF(x);
+        return -1;
+    }
 
     /* A 4-year cycle has an extra leap day over what we'd get from
      * pasting together 4 single years.
@@ -6700,8 +6674,9 @@
     us_per_minute = PyLong_FromLong(60000000);
     seconds_per_day = PyLong_FromLong(24 * 3600);
     if (us_per_ms == NULL || us_per_second == NULL ||
-        us_per_minute == NULL || seconds_per_day == NULL)
-        return NULL;
+        us_per_minute == NULL || seconds_per_day == NULL) {
+        return -1;
+    }
 
     /* The rest are too big for 32-bit ints, but even
      * us_per_week fits in 40 bits, so doubles should be exact.
@@ -6709,9 +6684,33 @@
     us_per_hour = PyLong_FromDouble(3600000000.0);
     us_per_day = PyLong_FromDouble(86400000000.0);
     us_per_week = PyLong_FromDouble(604800000000.0);
-    if (us_per_hour == NULL || us_per_day == NULL || us_per_week == NULL)
+    if (us_per_hour == NULL || us_per_day == NULL || us_per_week == NULL) {
+        return -1;
+    }
+    return 0;
+}
+
+static struct PyModuleDef datetimemodule = {
+    PyModuleDef_HEAD_INIT,
+    .m_name = "_datetime",
+    .m_doc = "Fast implementation of the datetime type.",
+    .m_size = -1,
+    .m_methods = module_methods,
+};
+
+PyMODINIT_FUNC
+PyInit__datetime(void)
+{
+    PyObject *mod = PyModule_Create(&datetimemodule);
+    if (mod == NULL)
         return NULL;
-    return m;
+
+    if (_datetime_exec(mod) < 0) {
+        Py_DECREF(mod);
+        return NULL;
+    }
+
+    return mod;
 }
 
 /* ---------------------------------------------------------------------------
diff --git a/Modules/_dbmmodule.c b/Modules/_dbmmodule.c
index 80a0503..5733bb4 100644
--- a/Modules/_dbmmodule.c
+++ b/Modules/_dbmmodule.c
@@ -28,6 +28,19 @@
 #error "No ndbm.h available!"
 #endif
 
+typedef struct {
+    PyTypeObject *dbm_type;
+    PyObject *dbm_error;
+} _dbm_state;
+
+static inline _dbm_state*
+get_dbm_state(PyObject *module)
+{
+    void *state = PyModule_GetState(module);
+    assert(state != NULL);
+    return (_dbm_state *)state;
+}
+
 /*[clinic input]
 module _dbm
 class _dbm.dbm "dbmobject *" "&Dbmtype"
@@ -43,28 +56,26 @@
 
 #include "clinic/_dbmmodule.c.h"
 
-static PyTypeObject Dbmtype;
-
-#define is_dbmobject(v) Py_IS_TYPE(v, &Dbmtype)
-#define check_dbmobject_open(v) if ((v)->di_dbm == NULL) \
-               { PyErr_SetString(DbmError, "DBM object has already been closed"); \
-                 return NULL; }
-
-static PyObject *DbmError;
+#define check_dbmobject_open(v, err)                                \
+    if ((v)->di_dbm == NULL) {                                      \
+        PyErr_SetString(err, "DBM object has already been closed"); \
+        return NULL;                                                \
+    }
 
 static PyObject *
-newdbmobject(const char *file, int flags, int mode)
+newdbmobject(_dbm_state *state, const char *file, int flags, int mode)
 {
-    dbmobject *dp;
-
-    dp = PyObject_New(dbmobject, &Dbmtype);
-    if (dp == NULL)
+    dbmobject *dp = PyObject_GC_New(dbmobject, state->dbm_type);
+    if (dp == NULL) {
         return NULL;
+    }
     dp->di_size = -1;
     dp->flags = flags;
+    PyObject_GC_Track(dp);
+
     /* See issue #19296 */
     if ( (dp->di_dbm = dbm_open((char *)file, flags, mode)) == 0 ) {
-        PyErr_SetFromErrnoWithFilename(DbmError, file);
+        PyErr_SetFromErrnoWithFilename(state->dbm_error, file);
         Py_DECREF(dp);
         return NULL;
     }
@@ -72,20 +83,32 @@
 }
 
 /* Methods */
+static int
+dbm_traverse(dbmobject *dp, visitproc visit, void *arg)
+{
+    Py_VISIT(Py_TYPE(dp));
+    return 0;
+}
 
 static void
 dbm_dealloc(dbmobject *dp)
 {
-    if ( dp->di_dbm )
+    PyObject_GC_UnTrack(dp);
+    if (dp->di_dbm) {
         dbm_close(dp->di_dbm);
-    PyObject_Del(dp);
+    }
+    PyTypeObject *tp = Py_TYPE(dp);
+    tp->tp_free(dp);
+    Py_DECREF(tp);
 }
 
 static Py_ssize_t
 dbm_length(dbmobject *dp)
 {
+    _dbm_state *state = PyType_GetModuleState(Py_TYPE(dp));
+    assert(state != NULL);
     if (dp->di_dbm == NULL) {
-             PyErr_SetString(DbmError, "DBM object has already been closed");
+             PyErr_SetString(state->dbm_error, "DBM object has already been closed");
              return -1;
     }
     if ( dp->di_size < 0 ) {
@@ -106,12 +129,14 @@
 {
     datum drec, krec;
     Py_ssize_t tmp_size;
-
-    if (!PyArg_Parse(key, "s#", &krec.dptr, &tmp_size) )
+    _dbm_state *state = PyType_GetModuleState(Py_TYPE(dp));
+    assert(state != NULL);
+    if (!PyArg_Parse(key, "s#", &krec.dptr, &tmp_size)) {
         return NULL;
+    }
 
     krec.dsize = tmp_size;
-    check_dbmobject_open(dp);
+    check_dbmobject_open(dp, state->dbm_error);
     drec = dbm_fetch(dp->di_dbm, krec);
     if ( drec.dptr == 0 ) {
         PyErr_SetObject(PyExc_KeyError, key);
@@ -119,7 +144,7 @@
     }
     if ( dbm_error(dp->di_dbm) ) {
         dbm_clearerr(dp->di_dbm);
-        PyErr_SetString(DbmError, "");
+        PyErr_SetString(state->dbm_error, "");
         return NULL;
     }
     return PyBytes_FromStringAndSize(drec.dptr, drec.dsize);
@@ -136,9 +161,11 @@
                         "dbm mappings have bytes or string keys only");
         return -1;
     }
+    _dbm_state *state = PyType_GetModuleState(Py_TYPE(dp));
+    assert(state != NULL);
     krec.dsize = tmp_size;
     if (dp->di_dbm == NULL) {
-             PyErr_SetString(DbmError, "DBM object has already been closed");
+             PyErr_SetString(state->dbm_error, "DBM object has already been closed");
              return -1;
     }
     dp->di_size = -1;
@@ -151,7 +178,7 @@
                 PyErr_SetObject(PyExc_KeyError, v);
             }
             else {
-                PyErr_SetString(DbmError, "cannot delete item from database");
+                PyErr_SetString(state->dbm_error, "cannot delete item from database");
             }
             return -1;
         }
@@ -164,25 +191,19 @@
         drec.dsize = tmp_size;
         if ( dbm_store(dp->di_dbm, krec, drec, DBM_REPLACE) < 0 ) {
             dbm_clearerr(dp->di_dbm);
-            PyErr_SetString(DbmError,
+            PyErr_SetString(state->dbm_error,
                             "cannot add item to database");
             return -1;
         }
     }
     if ( dbm_error(dp->di_dbm) ) {
         dbm_clearerr(dp->di_dbm);
-        PyErr_SetString(DbmError, "");
+        PyErr_SetString(state->dbm_error, "");
         return -1;
     }
     return 0;
 }
 
-static PyMappingMethods dbm_as_mapping = {
-    (lenfunc)dbm_length,                /*mp_length*/
-    (binaryfunc)dbm_subscript,          /*mp_subscript*/
-    (objobjargproc)dbm_ass_sub,         /*mp_ass_subscript*/
-};
-
 /*[clinic input]
 _dbm.dbm.close
 
@@ -193,8 +214,9 @@
 _dbm_dbm_close_impl(dbmobject *self)
 /*[clinic end generated code: output=c8dc5b6709600b86 input=046db72377d51be8]*/
 {
-    if (self->di_dbm)
+    if (self->di_dbm) {
         dbm_close(self->di_dbm);
+    }
     self->di_dbm = NULL;
     Py_RETURN_NONE;
 }
@@ -202,21 +224,26 @@
 /*[clinic input]
 _dbm.dbm.keys
 
+    cls: defining_class
+
 Return a list of all keys in the database.
 [clinic start generated code]*/
 
 static PyObject *
-_dbm_dbm_keys_impl(dbmobject *self)
-/*[clinic end generated code: output=434549f7c121b33c input=d210ba778cd9c68a]*/
+_dbm_dbm_keys_impl(dbmobject *self, PyTypeObject *cls)
+/*[clinic end generated code: output=f2a593b3038e5996 input=d3706a28fc051097]*/
 {
     PyObject *v, *item;
     datum key;
     int err;
 
-    check_dbmobject_open(self);
+    _dbm_state *state = PyType_GetModuleState(cls);
+    assert(state != NULL);
+    check_dbmobject_open(self, state->dbm_error);
     v = PyList_New(0);
-    if (v == NULL)
+    if (v == NULL) {
         return NULL;
+    }
     for (key = dbm_firstkey(self->di_dbm); key.dptr;
          key = dbm_nextkey(self->di_dbm)) {
         item = PyBytes_FromStringAndSize(key.dptr, key.dsize);
@@ -241,8 +268,10 @@
     datum key, val;
     Py_ssize_t size;
 
+    _dbm_state *state = PyType_GetModuleState(Py_TYPE(dp));
+    assert(state != NULL);
     if ((dp)->di_dbm == NULL) {
-        PyErr_SetString(DbmError,
+        PyErr_SetString(state->dbm_error,
                         "DBM object has already been closed");
          return -1;
     }
@@ -266,22 +295,9 @@
     return val.dptr != NULL;
 }
 
-static PySequenceMethods dbm_as_sequence = {
-    0,                          /* sq_length */
-    0,                          /* sq_concat */
-    0,                          /* sq_repeat */
-    0,                          /* sq_item */
-    0,                          /* sq_slice */
-    0,                          /* sq_ass_item */
-    0,                          /* sq_ass_slice */
-    dbm_contains,               /* sq_contains */
-    0,                          /* sq_inplace_concat */
-    0,                          /* sq_inplace_repeat */
-};
-
 /*[clinic input]
 _dbm.dbm.get
-
+    cls: defining_class
     key: str(accept={str, robuffer}, zeroes=True)
     default: object = None
     /
@@ -290,19 +306,20 @@
 [clinic start generated code]*/
 
 static PyObject *
-_dbm_dbm_get_impl(dbmobject *self, const char *key,
+_dbm_dbm_get_impl(dbmobject *self, PyTypeObject *cls, const char *key,
                   Py_ssize_clean_t key_length, PyObject *default_value)
-/*[clinic end generated code: output=b44f95eba8203d93 input=b788eba0ffad2e91]*/
-/*[clinic end generated code: output=4f5c0e523eaf1251 input=9402c0af8582dc69]*/
+/*[clinic end generated code: output=34851b5dc1c664dc input=66b993b8349fa8c1]*/
 {
     datum dbm_key, val;
-
+    _dbm_state *state = PyType_GetModuleState(cls);
+    assert(state != NULL);
     dbm_key.dptr = (char *)key;
     dbm_key.dsize = key_length;
-    check_dbmobject_open(self);
+    check_dbmobject_open(self, state->dbm_error);
     val = dbm_fetch(self->di_dbm, dbm_key);
-    if (val.dptr != NULL)
+    if (val.dptr != NULL) {
         return PyBytes_FromStringAndSize(val.dptr, val.dsize);
+    }
 
     Py_INCREF(default_value);
     return default_value;
@@ -310,6 +327,7 @@
 
 /*[clinic input]
 _dbm.dbm.setdefault
+    cls: defining_class
     key: str(accept={str, robuffer}, zeroes=True)
     default: object(c_default="NULL") = b''
     /
@@ -320,24 +338,27 @@
 [clinic start generated code]*/
 
 static PyObject *
-_dbm_dbm_setdefault_impl(dbmobject *self, const char *key,
+_dbm_dbm_setdefault_impl(dbmobject *self, PyTypeObject *cls, const char *key,
                          Py_ssize_clean_t key_length,
                          PyObject *default_value)
-/*[clinic end generated code: output=52545886cf272161 input=bf40c48edaca01d6]*/
+/*[clinic end generated code: output=d5c68fe673886767 input=126a3ff15c5f8232]*/
 {
     datum dbm_key, val;
     Py_ssize_t tmp_size;
-
+    _dbm_state *state = PyType_GetModuleState(cls);
+    assert(state != NULL);
     dbm_key.dptr = (char *)key;
     dbm_key.dsize = key_length;
-    check_dbmobject_open(self);
+    check_dbmobject_open(self, state->dbm_error);
     val = dbm_fetch(self->di_dbm, dbm_key);
-    if (val.dptr != NULL)
+    if (val.dptr != NULL) {
         return PyBytes_FromStringAndSize(val.dptr, val.dsize);
+    }
     if (default_value == NULL) {
         default_value = PyBytes_FromStringAndSize(NULL, 0);
-        if (default_value == NULL)
+        if (default_value == NULL) {
             return NULL;
+        }
         val.dptr = NULL;
         val.dsize = 0;
     }
@@ -352,7 +373,7 @@
     }
     if (dbm_store(self->di_dbm, dbm_key, val, DBM_INSERT) < 0) {
         dbm_clearerr(self->di_dbm);
-        PyErr_SetString(DbmError, "cannot add item to database");
+        PyErr_SetString(state->dbm_error, "cannot add item to database");
         Py_DECREF(default_value);
         return NULL;
     }
@@ -373,7 +394,6 @@
     return _PyObject_CallMethodIdNoArgs(self, &PyId_close);
 }
 
-
 static PyMethodDef dbm_methods[] = {
     _DBM_DBM_CLOSE_METHODDEF
     _DBM_DBM_KEYS_METHODDEF
@@ -381,38 +401,31 @@
     _DBM_DBM_SETDEFAULT_METHODDEF
     {"__enter__", dbm__enter__, METH_NOARGS, NULL},
     {"__exit__",  dbm__exit__, METH_VARARGS, NULL},
-    {NULL,              NULL}           /* sentinel */
+    {NULL,  NULL}           /* sentinel */
 };
 
-static PyTypeObject Dbmtype = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "_dbm.dbm",
-    sizeof(dbmobject),
-    0,
-    (destructor)dbm_dealloc,  /*tp_dealloc*/
-    0,                            /*tp_vectorcall_offset*/
-    0,                        /*tp_getattr*/
-    0,                            /*tp_setattr*/
-    0,                            /*tp_as_async*/
-    0,                            /*tp_repr*/
-    0,                            /*tp_as_number*/
-    &dbm_as_sequence,             /*tp_as_sequence*/
-    &dbm_as_mapping,              /*tp_as_mapping*/
-    0,                    /*tp_hash*/
-    0,                    /*tp_call*/
-    0,                    /*tp_str*/
-    0,                    /*tp_getattro*/
-    0,                    /*tp_setattro*/
-    0,                    /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT,   /*tp_flags*/
-    0,                        /*tp_doc*/
-    0,                        /*tp_traverse*/
-    0,                        /*tp_clear*/
-    0,                        /*tp_richcompare*/
-    0,                        /*tp_weaklistoffset*/
-    0,                        /*tp_iter*/
-    0,                        /*tp_iternext*/
-    dbm_methods,          /*tp_methods*/
+static PyType_Slot dbmtype_spec_slots[] = {
+    {Py_tp_dealloc, dbm_dealloc},
+    {Py_tp_traverse, dbm_traverse},
+    {Py_tp_methods, dbm_methods},
+    {Py_sq_contains, dbm_contains},
+    {Py_mp_length, dbm_length},
+    {Py_mp_subscript, dbm_subscript},
+    {Py_mp_ass_subscript, dbm_ass_sub},
+    {0, 0}
+};
+
+
+static PyType_Spec dbmtype_spec = {
+    .name = "_dbm.dbm",
+    .basicsize = sizeof(dbmobject),
+    // Calling PyType_GetModuleState() on a subclass is not safe.
+    // dbmtype_spec does not have Py_TPFLAGS_BASETYPE flag
+    // which prevents to create a subclass.
+    // So calling PyType_GetModuleState() in this file is always safe.
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION |
+              Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = dbmtype_spec_slots,
 };
 
 /* ----------------------------------------------------------------- */
@@ -443,19 +456,26 @@
 /*[clinic end generated code: output=9527750f5df90764 input=376a9d903a50df59]*/
 {
     int iflags;
-
-    if ( strcmp(flags, "r") == 0 )
+    _dbm_state *state =  get_dbm_state(module);
+    assert(state != NULL);
+    if (strcmp(flags, "r") == 0) {
         iflags = O_RDONLY;
-    else if ( strcmp(flags, "w") == 0 )
+    }
+    else if (strcmp(flags, "w") == 0) {
         iflags = O_RDWR;
-    else if ( strcmp(flags, "rw") == 0 ) /* B/W compat */
+    }
+    else if (strcmp(flags, "rw") == 0) {
+        /* Backward compatibility */
         iflags = O_RDWR|O_CREAT;
-    else if ( strcmp(flags, "c") == 0 )
+    }
+    else if (strcmp(flags, "c") == 0) {
         iflags = O_RDWR|O_CREAT;
-    else if ( strcmp(flags, "n") == 0 )
+    }
+    else if (strcmp(flags, "n") == 0) {
         iflags = O_RDWR|O_CREAT|O_TRUNC;
+    }
     else {
-        PyErr_SetString(DbmError,
+        PyErr_SetString(state->dbm_error,
                         "arg 2 to open should be 'r', 'w', 'c', or 'n'");
         return NULL;
     }
@@ -470,7 +490,7 @@
         PyErr_SetString(PyExc_ValueError, "embedded null character");
         return NULL;
     }
-    PyObject *self = newdbmobject(name, iflags, mode);
+    PyObject *self = newdbmobject(state, name, iflags, mode);
     Py_DECREF(filenamebytes);
     return self;
 }
@@ -480,42 +500,70 @@
     { 0, 0 },
 };
 
+static int
+_dbm_exec(PyObject *module)
+{
+    _dbm_state *state = get_dbm_state(module);
+    state->dbm_type = (PyTypeObject *)PyType_FromModuleAndSpec(module,
+                                                        &dbmtype_spec, NULL);
+    if (state->dbm_type == NULL) {
+        return -1;
+    }
+    state->dbm_error = PyErr_NewException("_dbm.error", PyExc_OSError, NULL);
+    if (state->dbm_error == NULL) {
+        return -1;
+    }
+    if (PyModule_AddStringConstant(module, "library", which_dbm) < 0) {
+        return -1;
+    }
+    if (PyModule_AddType(module, (PyTypeObject *)state->dbm_error) < 0) {
+        return -1;
+    }
+    return 0;
+}
+
+static int
+_dbm_module_traverse(PyObject *module, visitproc visit, void *arg)
+{
+    _dbm_state *state = get_dbm_state(module);
+    Py_VISIT(state->dbm_error);
+    Py_VISIT(state->dbm_type);
+    return 0;
+}
+
+static int
+_dbm_module_clear(PyObject *module)
+{
+    _dbm_state *state = get_dbm_state(module);
+    Py_CLEAR(state->dbm_error);
+    Py_CLEAR(state->dbm_type);
+    return 0;
+}
+
+static void
+_dbm_module_free(void *module)
+{
+    _dbm_module_clear((PyObject *)module);
+}
+
+static PyModuleDef_Slot _dbmmodule_slots[] = {
+    {Py_mod_exec, _dbm_exec},
+    {0, NULL}
+};
 
 static struct PyModuleDef _dbmmodule = {
     PyModuleDef_HEAD_INIT,
-    "_dbm",
-    NULL,
-    -1,
-    dbmmodule_methods,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    .m_name = "_dbm",
+    .m_size = sizeof(_dbm_state),
+    .m_methods = dbmmodule_methods,
+    .m_slots = _dbmmodule_slots,
+    .m_traverse = _dbm_module_traverse,
+    .m_clear = _dbm_module_clear,
+    .m_free = _dbm_module_free,
 };
 
 PyMODINIT_FUNC
-PyInit__dbm(void) {
-    PyObject *m, *d, *s;
-
-    if (PyType_Ready(&Dbmtype) < 0)
-        return NULL;
-    m = PyModule_Create(&_dbmmodule);
-    if (m == NULL)
-        return NULL;
-    d = PyModule_GetDict(m);
-    if (DbmError == NULL)
-        DbmError = PyErr_NewException("_dbm.error",
-                                      PyExc_OSError, NULL);
-    s = PyUnicode_FromString(which_dbm);
-    if (s != NULL) {
-        PyDict_SetItemString(d, "library", s);
-        Py_DECREF(s);
-    }
-    if (DbmError != NULL)
-        PyDict_SetItemString(d, "error", DbmError);
-    if (PyErr_Occurred()) {
-        Py_DECREF(m);
-        m = NULL;
-    }
-    return m;
+PyInit__dbm(void)
+{
+    return PyModuleDef_Init(&_dbmmodule);
 }
diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c
index fb4e020..e2979a5 100644
--- a/Modules/_decimal/_decimal.c
+++ b/Modules/_decimal/_decimal.c
@@ -696,8 +696,7 @@
     PyObject_GenericGetAttr,                  /* tp_getattro */
     (setattrofunc) 0,                         /* tp_setattro */
     (PyBufferProcs *) 0,                      /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|
-    Py_TPFLAGS_HAVE_GC,                       /* tp_flags */
+    Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,   /* tp_flags */
     0,                                        /* tp_doc */
     0,                                        /* tp_traverse */
     0,                                        /* tp_clear */
@@ -1763,7 +1762,7 @@
 {
     Py_XDECREF(self->local);
     Py_XDECREF(self->global);
-    PyObject_Del(self);
+    PyObject_Free(self);
 }
 
 static PyObject *
@@ -3184,6 +3183,31 @@
     return utf8;
 }
 
+static int
+dict_get_item_string(PyObject *dict, const char *key, PyObject **valueobj, const char **valuestr)
+{
+    *valueobj = NULL;
+    PyObject *keyobj = PyUnicode_FromString(key);
+    if (keyobj == NULL) {
+        return -1;
+    }
+    PyObject *value = PyDict_GetItemWithError(dict, keyobj);
+    Py_DECREF(keyobj);
+    if (value == NULL) {
+        if (PyErr_Occurred()) {
+            return -1;
+        }
+        return 0;
+    }
+    value = PyUnicode_AsUTF8String(value);
+    if (value == NULL) {
+        return -1;
+    }
+    *valueobj = value;
+    *valuestr = PyBytes_AS_STRING(value);
+    return 0;
+}
+
 /* Formatted representation of a PyDecObject. */
 static PyObject *
 dec_format(PyObject *dec, PyObject *args)
@@ -3254,23 +3278,11 @@
                 "optional argument must be a dict");
             goto finish;
         }
-        if ((dot = PyDict_GetItemString(override, "decimal_point"))) {
-            if ((dot = PyUnicode_AsUTF8String(dot)) == NULL) {
-                goto finish;
-            }
-            spec.dot = PyBytes_AS_STRING(dot);
-        }
-        if ((sep = PyDict_GetItemString(override, "thousands_sep"))) {
-            if ((sep = PyUnicode_AsUTF8String(sep)) == NULL) {
-                goto finish;
-            }
-            spec.sep = PyBytes_AS_STRING(sep);
-        }
-        if ((grouping = PyDict_GetItemString(override, "grouping"))) {
-            if ((grouping = PyUnicode_AsUTF8String(grouping)) == NULL) {
-                goto finish;
-            }
-            spec.grouping = PyBytes_AS_STRING(grouping);
+        if (dict_get_item_string(override, "decimal_point", &dot, &spec.dot) ||
+            dict_get_item_string(override, "thousands_sep", &sep, &spec.sep) ||
+            dict_get_item_string(override, "grouping", &grouping, &spec.grouping))
+        {
+            goto finish;
         }
         if (mpd_validate_lconv(&spec) < 0) {
             PyErr_SetString(PyExc_ValueError,
@@ -3280,7 +3292,7 @@
     }
     else {
         size_t n = strlen(spec.dot);
-        if (n > 1 || (n == 1 && !isascii((uchar)spec.dot[0]))) {
+        if (n > 1 || (n == 1 && !isascii((unsigned char)spec.dot[0]))) {
             /* fix locale dependent non-ascii characters */
             dot = dotsep_as_utf8(spec.dot);
             if (dot == NULL) {
@@ -3289,7 +3301,7 @@
             spec.dot = PyBytes_AS_STRING(dot);
         }
         n = strlen(spec.sep);
-        if (n > 1 || (n == 1 && !isascii((uchar)spec.sep[0]))) {
+        if (n > 1 || (n == 1 && !isascii((unsigned char)spec.sep[0]))) {
             /* fix locale dependent non-ascii characters */
             sep = dotsep_as_utf8(spec.sep);
             if (sep == NULL) {
@@ -4523,7 +4535,6 @@
     #error "No valid combination of CONFIG_64, CONFIG_32 and _PyHASH_BITS"
 #endif
     const Py_hash_t py_hash_inf = 314159;
-    const Py_hash_t py_hash_nan = 0;
     mpd_uint_t ten_data[1] = {10};
     mpd_t ten = {MPD_POS|MPD_STATIC|MPD_CONST_DATA,
                  0, 2, 1, 1, ten_data};
@@ -4542,7 +4553,7 @@
             return -1;
         }
         else if (mpd_isnan(MPD(v))) {
-            return py_hash_nan;
+            return _Py_HashPointer(v);
         }
         else {
             return py_hash_inf * mpd_arith_sign(MPD(v));
@@ -5926,5 +5937,3 @@
 
     return NULL; /* GCOV_NOT_REACHED */
 }
-
-
diff --git a/Modules/_decimal/libmpdec/README.txt b/Modules/_decimal/libmpdec/README.txt
index dc97820..c1d481d 100644
--- a/Modules/_decimal/libmpdec/README.txt
+++ b/Modules/_decimal/libmpdec/README.txt
@@ -29,7 +29,6 @@
 
     Visual Studio only:
     ~~~~~~~~~~~~~~~~~~~
-      vccompat.h    ->  snprintf <==> sprintf_s and similar things.
       vcdiv64.asm   ->  Double word division used in typearith.h. VS 2008 does
                         not allow inline asm for x64. Also, it does not provide
                         an intrinsic for double word division.
diff --git a/Modules/_decimal/libmpdec/bench.c b/Modules/_decimal/libmpdec/bench.c
new file mode 100644
index 0000000..09138f4
--- /dev/null
+++ b/Modules/_decimal/libmpdec/bench.c
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2008-2020 Stefan Krah. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+
+#include "mpdecimal.h"
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+
+
+static void
+err_exit(const char *msg)
+{
+    fprintf(stderr, "%s\n", msg);
+    exit(1);
+}
+
+static mpd_t *
+new_mpd(void)
+{
+    mpd_t *x = mpd_qnew();
+    if (x == NULL) {
+        err_exit("out of memory");
+    }
+
+    return x;
+}
+
+/* Nonsense version of escape-time algorithm for calculating a mandelbrot
+ * set. Just for benchmarking. */
+static void
+color_point(mpd_t *x0, mpd_t *y0, long maxiter, mpd_context_t *ctx)
+{
+    mpd_t *x, *y, *sq_x, *sq_y;
+    mpd_t *two;
+
+    x = new_mpd();
+    y = new_mpd();
+    mpd_set_u32(x, 0, ctx);
+    mpd_set_u32(y, 0, ctx);
+
+    sq_x = new_mpd();
+    sq_y = new_mpd();
+    mpd_set_u32(sq_x, 0, ctx);
+    mpd_set_u32(sq_y, 0, ctx);
+
+    two = new_mpd();
+    mpd_set_u32(two, 2, ctx);
+
+    for (long i = 0; i < maxiter; i++) {
+        mpd_mul(y, x, y, ctx);
+        mpd_mul(y, y, two, ctx);
+        mpd_add(y, y, y0, ctx);
+
+        mpd_sub(x, sq_x, sq_y, ctx);
+        mpd_add(x, x, x0, ctx);
+
+        mpd_mul(sq_x, x, x, ctx);
+        mpd_mul(sq_y, y, y, ctx);
+    }
+
+    mpd_copy(x0, x, ctx);
+
+    mpd_del(two);
+    mpd_del(sq_y);
+    mpd_del(sq_x);
+    mpd_del(y);
+    mpd_del(x);
+}
+
+
+int
+main(int argc, char **argv)
+{
+    mpd_context_t ctx;
+    mpd_t *x0, *y0;
+    uint32_t prec = 19;
+    long iter = 10000000;
+    clock_t start_clock, end_clock;
+
+    if (argc != 3) {
+        err_exit("usage: bench prec iter\n");
+    }
+    prec = strtoul(argv[1], NULL, 10);
+    iter = strtol(argv[2], NULL, 10);
+
+    mpd_init(&ctx, prec);
+    /* no more MPD_MINALLOC changes after here */
+
+    x0 = new_mpd();
+    y0 = new_mpd();
+    mpd_set_string(x0, "0.222", &ctx);
+    mpd_set_string(y0, "0.333", &ctx);
+    if (ctx.status & MPD_Errors) {
+        mpd_del(y0);
+        mpd_del(x0);
+        err_exit("unexpected error during conversion");
+    }
+
+    start_clock = clock();
+    color_point(x0, y0, iter, &ctx);
+    end_clock = clock();
+
+    mpd_print(x0);
+    fprintf(stderr, "time: %f\n\n", (double)(end_clock-start_clock)/(double)CLOCKS_PER_SEC);
+
+    mpd_del(y0);
+    mpd_del(x0);
+
+    return 0;
+}
diff --git a/Modules/_decimal/libmpdec/bench_full.c b/Modules/_decimal/libmpdec/bench_full.c
new file mode 100644
index 0000000..6ab7391
--- /dev/null
+++ b/Modules/_decimal/libmpdec/bench_full.c
@@ -0,0 +1,193 @@
+/*
+ * Copyright (c) 2008-2020 Stefan Krah. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+
+#include "mpdecimal.h"
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+
+
+static void
+err_exit(const char *msg)
+{
+    fprintf(stderr, "%s\n", msg);
+    exit(1);
+}
+
+static mpd_t *
+new_mpd(void)
+{
+    mpd_t *x = mpd_qnew();
+    if (x == NULL) {
+        err_exit("out of memory");
+    }
+
+    return x;
+}
+
+/*
+ * Example from: http://en.wikipedia.org/wiki/Mandelbrot_set
+ *
+ * Escape time algorithm for drawing the set:
+ *
+ * Point x0, y0 is deemed to be in the Mandelbrot set if the return
+ * value is maxiter. Lower return values indicate how quickly points
+ * escaped and can be used for coloring.
+ */
+static int
+color_point(const mpd_t *x0, const mpd_t *y0, const long maxiter, mpd_context_t *ctx)
+{
+    mpd_t *x, *y, *sq_x, *sq_y;
+    mpd_t *two, *four, *c;
+    long i;
+
+    x = new_mpd();
+    y = new_mpd();
+    mpd_set_u32(x, 0, ctx);
+    mpd_set_u32(y, 0, ctx);
+
+    sq_x = new_mpd();
+    sq_y = new_mpd();
+    mpd_set_u32(sq_x, 0, ctx);
+    mpd_set_u32(sq_y, 0, ctx);
+
+    two = new_mpd();
+    four = new_mpd();
+    mpd_set_u32(two, 2, ctx);
+    mpd_set_u32(four, 4, ctx);
+
+    c = new_mpd();
+    mpd_set_u32(c, 0, ctx);
+
+    for (i = 0; i < maxiter && mpd_cmp(c, four, ctx) <= 0; i++) {
+        mpd_mul(y, x, y, ctx);
+        mpd_mul(y, y, two, ctx);
+        mpd_add(y, y, y0, ctx);
+
+        mpd_sub(x, sq_x, sq_y, ctx);
+        mpd_add(x, x, x0, ctx);
+
+        mpd_mul(sq_x, x, x, ctx);
+        mpd_mul(sq_y, y, y, ctx);
+        mpd_add(c, sq_x, sq_y, ctx);
+    }
+
+    mpd_del(c);
+    mpd_del(four);
+    mpd_del(two);
+    mpd_del(sq_y);
+    mpd_del(sq_x);
+    mpd_del(y);
+    mpd_del(x);
+
+    return i;
+}
+
+int
+main(int argc, char **argv)
+{
+    mpd_context_t ctx;
+    mpd_t *x0, *y0;
+    mpd_t *sqrt_2, *xstep, *ystep;
+    mpd_ssize_t prec = 19;
+
+    long iter = 1000;
+    int points[40][80];
+    int i, j;
+    clock_t start_clock, end_clock;
+
+
+    if (argc != 3) {
+        fprintf(stderr, "usage: ./bench prec iter\n");
+        exit(1);
+    }
+    prec = strtoll(argv[1], NULL, 10);
+    iter = strtol(argv[2], NULL, 10);
+
+    mpd_init(&ctx, prec);
+    /* no more MPD_MINALLOC changes after here */
+
+    sqrt_2 = new_mpd();
+    xstep = new_mpd();
+    ystep = new_mpd();
+    x0 = new_mpd();
+    y0 = new_mpd();
+
+    mpd_set_u32(sqrt_2, 2, &ctx);
+    mpd_sqrt(sqrt_2, sqrt_2, &ctx);
+    mpd_div_u32(xstep, sqrt_2, 40, &ctx);
+    mpd_div_u32(ystep, sqrt_2, 20, &ctx);
+
+    start_clock = clock();
+    mpd_copy(y0, sqrt_2, &ctx);
+    for (i = 0; i < 40; i++) {
+        mpd_copy(x0, sqrt_2, &ctx);
+        mpd_set_negative(x0);
+        for (j = 0; j < 80; j++) {
+            points[i][j] = color_point(x0, y0, iter, &ctx);
+            mpd_add(x0, x0, xstep, &ctx);
+        }
+        mpd_sub(y0, y0, ystep, &ctx);
+    }
+    end_clock = clock();
+
+#ifdef BENCH_VERBOSE
+    for (i = 0; i < 40; i++) {
+        for (j = 0; j < 80; j++) {
+            if (points[i][j] == iter) {
+                putchar('*');
+            }
+            else if (points[i][j] >= 10) {
+                putchar('+');
+            }
+            else if (points[i][j] >= 5) {
+                putchar('.');
+            }
+            else {
+                putchar(' ');
+            }
+        }
+        putchar('\n');
+    }
+    putchar('\n');
+#else
+    (void)points; /* suppress gcc warning */
+#endif
+
+    printf("time: %f\n\n", (double)(end_clock-start_clock)/(double)CLOCKS_PER_SEC);
+
+    mpd_del(y0);
+    mpd_del(x0);
+    mpd_del(ystep);
+    mpd_del(xstep);
+    mpd_del(sqrt_2);
+
+    return 0;
+}
diff --git a/Modules/_decimal/libmpdec/constants.c b/Modules/_decimal/libmpdec/constants.c
index 4c4de62..ed074fa 100644
--- a/Modules/_decimal/libmpdec/constants.c
+++ b/Modules/_decimal/libmpdec/constants.c
@@ -27,6 +27,7 @@
 
 
 #include "mpdecimal.h"
+#include "basearith.h"
 #include "constants.h"
 
 
@@ -111,7 +112,7 @@
   #error "CONFIG_64 or CONFIG_32 must be defined."
 #endif
 
-const char *mpd_round_string[MPD_ROUND_GUARD] = {
+const char * const mpd_round_string[MPD_ROUND_GUARD] = {
     "ROUND_UP",          /* round away from 0               */
     "ROUND_DOWN",        /* round toward 0 (truncate)       */
     "ROUND_CEILING",     /* round toward +infinity          */
@@ -123,7 +124,7 @@
     "ROUND_TRUNC",       /* truncate, but set infinity      */
 };
 
-const char *mpd_clamp_string[MPD_CLAMP_GUARD] = {
+const char * const mpd_clamp_string[MPD_CLAMP_GUARD] = {
     "CLAMP_DEFAULT",
     "CLAMP_IEEE_754"
 };
diff --git a/Modules/_decimal/libmpdec/context.c b/Modules/_decimal/libmpdec/context.c
index 9cbc205..172794b 100644
--- a/Modules/_decimal/libmpdec/context.c
+++ b/Modules/_decimal/libmpdec/context.c
@@ -235,12 +235,12 @@
 }
 
 int
-mpd_qsettraps(mpd_context_t *ctx, uint32_t traps)
+mpd_qsettraps(mpd_context_t *ctx, uint32_t flags)
 {
-    if (traps > MPD_Max_status) {
+    if (flags > MPD_Max_status) {
         return 0;
     }
-    ctx->traps = traps;
+    ctx->traps = flags;
     return 1;
 }
 
diff --git a/Modules/_decimal/libmpdec/crt.c b/Modules/_decimal/libmpdec/crt.c
index 613274e..babcce4 100644
--- a/Modules/_decimal/libmpdec/crt.c
+++ b/Modules/_decimal/libmpdec/crt.c
@@ -33,8 +33,8 @@
 #include "constants.h"
 #include "crt.h"
 #include "numbertheory.h"
-#include "umodarith.h"
 #include "typearith.h"
+#include "umodarith.h"
 
 
 /* Bignum: Chinese Remainder Theorem, extends the maximum transform length. */
@@ -62,17 +62,17 @@
 _crt_add3(mpd_uint_t w[3], mpd_uint_t v[3])
 {
     mpd_uint_t carry;
-    mpd_uint_t s;
 
-    s = w[0] + v[0];
-    carry = (s < w[0]);
-    w[0] = s;
+    w[0] = w[0] + v[0];
+    carry = (w[0] < v[0]);
 
-    s = w[1] + (v[1] + carry);
-    carry = (s < w[1]);
-    w[1] = s;
+    w[1] = w[1] + v[1];
+    if (w[1] < v[1]) w[2]++;
 
-    w[2] = w[2] + (v[2] + carry);
+    w[1] = w[1] + carry;
+    if (w[1] < carry) w[2]++;
+
+    w[2] += v[2];
 }
 
 /* Divide 3 words in u by v, store result in w, return remainder. */
diff --git a/Modules/_decimal/libmpdec/crt.h b/Modules/_decimal/libmpdec/crt.h
index 15a347d..ed66753 100644
--- a/Modules/_decimal/libmpdec/crt.h
+++ b/Modules/_decimal/libmpdec/crt.h
@@ -37,7 +37,7 @@
 MPD_PRAGMA(MPD_HIDE_SYMBOLS_START)
 
 
-void crt3(mpd_uint_t *x1, mpd_uint_t *x2, mpd_uint_t *x3, mpd_size_t nmemb);
+void crt3(mpd_uint_t *x1, mpd_uint_t *x2, mpd_uint_t *x3, mpd_size_t rsize);
 
 
 MPD_PRAGMA(MPD_HIDE_SYMBOLS_END) /* restore previous scope rules */
diff --git a/Modules/_decimal/libmpdec/examples/README.txt b/Modules/_decimal/libmpdec/examples/README.txt
new file mode 100644
index 0000000..69615b4
--- /dev/null
+++ b/Modules/_decimal/libmpdec/examples/README.txt
@@ -0,0 +1,8 @@
+
+
+This directory contains a number of examples. In order to compile, run
+(for example):
+
+gcc -Wall -W -O2 -o powmod powmod.c -lmpdec -lm
+
+
diff --git a/Modules/_decimal/libmpdec/examples/compare.c b/Modules/_decimal/libmpdec/examples/compare.c
new file mode 100644
index 0000000..9051773
--- /dev/null
+++ b/Modules/_decimal/libmpdec/examples/compare.c
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2008-2020 Stefan Krah. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <mpdecimal.h>
+
+
+int
+main(int argc, char **argv)
+{
+	mpd_context_t ctx;
+	mpd_t *a, *b;
+	mpd_t *result;
+	char *rstring;
+	char status_str[MPD_MAX_FLAG_STRING];
+	clock_t start_clock, end_clock;
+
+	if (argc != 3) {
+		fprintf(stderr, "compare: usage: ./compare x y\n");
+		exit(1);
+	}
+
+	mpd_init(&ctx, 38);
+	ctx.traps = 0;
+
+	result = mpd_new(&ctx);
+	a = mpd_new(&ctx);
+	b = mpd_new(&ctx);
+	mpd_set_string(a, argv[1], &ctx);
+	mpd_set_string(b, argv[2], &ctx);
+
+	start_clock = clock();
+	mpd_compare(result, a, b, &ctx);
+	end_clock = clock();
+	fprintf(stderr, "time: %f\n\n",
+	           (double)(end_clock-start_clock)/(double)CLOCKS_PER_SEC);
+
+	rstring = mpd_to_sci(result, 1);
+	mpd_snprint_flags(status_str, MPD_MAX_FLAG_STRING, ctx.status);
+	printf("%s  %s\n", rstring, status_str);
+
+	mpd_del(a);
+	mpd_del(b);
+	mpd_del(result);
+	mpd_free(rstring);
+
+	return 0;
+}
+
+
diff --git a/Modules/_decimal/libmpdec/examples/div.c b/Modules/_decimal/libmpdec/examples/div.c
new file mode 100644
index 0000000..b76037d
--- /dev/null
+++ b/Modules/_decimal/libmpdec/examples/div.c
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2008-2020 Stefan Krah. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <mpdecimal.h>
+
+
+int
+main(int argc, char **argv)
+{
+	mpd_context_t ctx;
+	mpd_t *a, *b;
+	mpd_t *result;
+	char *rstring;
+	char status_str[MPD_MAX_FLAG_STRING];
+	clock_t start_clock, end_clock;
+
+	if (argc != 3) {
+		fprintf(stderr, "div: usage: ./div x y\n");
+		exit(1);
+	}
+
+	mpd_init(&ctx, 38);
+	ctx.traps = 0;
+
+	result = mpd_new(&ctx);
+	a = mpd_new(&ctx);
+	b = mpd_new(&ctx);
+	mpd_set_string(a, argv[1], &ctx);
+	mpd_set_string(b, argv[2], &ctx);
+
+	start_clock = clock();
+	mpd_div(result, a, b, &ctx);
+	end_clock = clock();
+	fprintf(stderr, "time: %f\n\n",
+	           (double)(end_clock-start_clock)/(double)CLOCKS_PER_SEC);
+
+	rstring = mpd_to_sci(result, 1);
+	mpd_snprint_flags(status_str, MPD_MAX_FLAG_STRING, ctx.status);
+	printf("%s  %s\n", rstring, status_str);
+
+	mpd_del(a);
+	mpd_del(b);
+	mpd_del(result);
+	mpd_free(rstring);
+
+	return 0;
+}
+
+
diff --git a/Modules/_decimal/libmpdec/examples/divmod.c b/Modules/_decimal/libmpdec/examples/divmod.c
new file mode 100644
index 0000000..1f2b483
--- /dev/null
+++ b/Modules/_decimal/libmpdec/examples/divmod.c
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2008-2020 Stefan Krah. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <mpdecimal.h>
+
+
+int
+main(int argc, char **argv)
+{
+	mpd_context_t ctx;
+	mpd_t *a, *b;
+	mpd_t *q, *r;
+	char *qs, *rs;
+	char status_str[MPD_MAX_FLAG_STRING];
+	clock_t start_clock, end_clock;
+
+	if (argc != 3) {
+		fprintf(stderr, "divmod: usage: ./divmod x y\n");
+		exit(1);
+	}
+
+	mpd_init(&ctx, 38);
+	ctx.traps = 0;
+
+	q = mpd_new(&ctx);
+	r = mpd_new(&ctx);
+	a = mpd_new(&ctx);
+	b = mpd_new(&ctx);
+	mpd_set_string(a, argv[1], &ctx);
+	mpd_set_string(b, argv[2], &ctx);
+
+	start_clock = clock();
+	mpd_divmod(q, r, a, b, &ctx);
+	end_clock = clock();
+	fprintf(stderr, "time: %f\n\n",
+	           (double)(end_clock-start_clock)/(double)CLOCKS_PER_SEC);
+
+	qs = mpd_to_sci(q, 1);
+	rs = mpd_to_sci(r, 1);
+
+	mpd_snprint_flags(status_str, MPD_MAX_FLAG_STRING, ctx.status);
+	printf("%s  %s  %s\n", qs, rs, status_str);
+
+	mpd_del(q);
+	mpd_del(r);
+	mpd_del(a);
+	mpd_del(b);
+	mpd_free(qs);
+	mpd_free(rs);
+
+	return 0;
+}
+
+
diff --git a/Modules/_decimal/libmpdec/examples/multiply.c b/Modules/_decimal/libmpdec/examples/multiply.c
new file mode 100644
index 0000000..7f2687d
--- /dev/null
+++ b/Modules/_decimal/libmpdec/examples/multiply.c
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2008-2020 Stefan Krah. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <mpdecimal.h>
+
+
+int
+main(int argc, char **argv)
+{
+	mpd_context_t ctx;
+	mpd_t *a, *b;
+	mpd_t *result;
+	char *rstring;
+	char status_str[MPD_MAX_FLAG_STRING];
+	clock_t start_clock, end_clock;
+
+	if (argc != 3) {
+		fprintf(stderr, "multiply: usage: ./multiply x y\n");
+		exit(1);
+	}
+
+	mpd_init(&ctx, 38);
+	ctx.traps = 0;
+
+	result = mpd_new(&ctx);
+	a = mpd_new(&ctx);
+	b = mpd_new(&ctx);
+	mpd_set_string(a, argv[1], &ctx);
+	mpd_set_string(b, argv[2], &ctx);
+
+	start_clock = clock();
+	mpd_mul(result, a, b, &ctx);
+	end_clock = clock();
+	fprintf(stderr, "time: %f\n\n",
+	           (double)(end_clock-start_clock)/(double)CLOCKS_PER_SEC);
+
+	rstring = mpd_to_sci(result, 1);
+	mpd_snprint_flags(status_str, MPD_MAX_FLAG_STRING, ctx.status);
+	printf("%s  %s\n", rstring, status_str);
+
+	mpd_del(a);
+	mpd_del(b);
+	mpd_del(result);
+	mpd_free(rstring);
+
+	return 0;
+}
+
+
diff --git a/Modules/_decimal/libmpdec/examples/pow.c b/Modules/_decimal/libmpdec/examples/pow.c
new file mode 100644
index 0000000..628c143
--- /dev/null
+++ b/Modules/_decimal/libmpdec/examples/pow.c
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2008-2020 Stefan Krah. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <mpdecimal.h>
+
+
+int
+main(int argc, char **argv)
+{
+	mpd_context_t ctx;
+	mpd_t *a, *b;
+	mpd_t *result;
+	char *rstring;
+	char status_str[MPD_MAX_FLAG_STRING];
+	clock_t start_clock, end_clock;
+
+	if (argc != 3) {
+		fprintf(stderr, "pow: usage: ./pow x y\n");
+		exit(1);
+	}
+
+	mpd_init(&ctx, 38);
+	ctx.traps = 0;
+
+	result = mpd_new(&ctx);
+	a = mpd_new(&ctx);
+	b = mpd_new(&ctx);
+	mpd_set_string(a, argv[1], &ctx);
+	mpd_set_string(b, argv[2], &ctx);
+
+	start_clock = clock();
+	mpd_pow(result, a, b, &ctx);
+	end_clock = clock();
+	fprintf(stderr, "time: %f\n\n",
+	           (double)(end_clock-start_clock)/(double)CLOCKS_PER_SEC);
+
+	rstring = mpd_to_sci(result, 1);
+	mpd_snprint_flags(status_str, MPD_MAX_FLAG_STRING, ctx.status);
+	printf("%s  %s\n", rstring, status_str);
+
+	mpd_del(a);
+	mpd_del(b);
+	mpd_del(result);
+	mpd_free(rstring);
+
+	return 0;
+}
+
+
diff --git a/Modules/_decimal/libmpdec/examples/powmod.c b/Modules/_decimal/libmpdec/examples/powmod.c
new file mode 100644
index 0000000..b422fdb
--- /dev/null
+++ b/Modules/_decimal/libmpdec/examples/powmod.c
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2008-2020 Stefan Krah. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <mpdecimal.h>
+
+
+int
+main(int argc, char **argv)
+{
+	mpd_context_t ctx;
+	mpd_t *a, *b, *c;
+	mpd_t *result;
+	char *rstring;
+	char status_str[MPD_MAX_FLAG_STRING];
+	clock_t start_clock, end_clock;
+
+	if (argc != 4) {
+		fprintf(stderr, "powmod: usage: ./powmod x y z\n");
+		exit(1);
+	}
+
+	mpd_init(&ctx, 38);
+	ctx.traps = 0;
+
+	result = mpd_new(&ctx);
+	a = mpd_new(&ctx);
+	b = mpd_new(&ctx);
+	c = mpd_new(&ctx);
+	mpd_set_string(a, argv[1], &ctx);
+	mpd_set_string(b, argv[2], &ctx);
+	mpd_set_string(c, argv[3], &ctx);
+
+	start_clock = clock();
+	mpd_powmod(result, a, b, c, &ctx);
+	end_clock = clock();
+	fprintf(stderr, "time: %f\n\n",
+	           (double)(end_clock-start_clock)/(double)CLOCKS_PER_SEC);
+
+	rstring = mpd_to_sci(result, 1);
+	mpd_snprint_flags(status_str, MPD_MAX_FLAG_STRING, ctx.status);
+	printf("%s  %s\n", rstring, status_str);
+
+	mpd_del(a);
+	mpd_del(b);
+	mpd_del(c);
+	mpd_del(result);
+	mpd_free(rstring);
+
+	return 0;
+}
+
+
diff --git a/Modules/_decimal/libmpdec/examples/shift.c b/Modules/_decimal/libmpdec/examples/shift.c
new file mode 100644
index 0000000..6d54e10
--- /dev/null
+++ b/Modules/_decimal/libmpdec/examples/shift.c
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2008-2020 Stefan Krah. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <mpdecimal.h>
+
+
+int
+main(int argc, char **argv)
+{
+	mpd_context_t ctx;
+	mpd_t *a, *b;
+	mpd_t *result;
+	char *rstring;
+	char status_str[MPD_MAX_FLAG_STRING];
+	clock_t start_clock, end_clock;
+
+	if (argc != 3) {
+		fprintf(stderr, "shift: usage: ./shift x y\n");
+		exit(1);
+	}
+
+	mpd_init(&ctx, 38);
+	ctx.traps = 0;
+
+	result = mpd_new(&ctx);
+	a = mpd_new(&ctx);
+	b = mpd_new(&ctx);
+	mpd_set_string(a, argv[1], &ctx);
+	mpd_set_string(b, argv[2], &ctx);
+
+	start_clock = clock();
+	mpd_shift(result, a, b, &ctx);
+	end_clock = clock();
+	fprintf(stderr, "time: %f\n\n",
+	           (double)(end_clock-start_clock)/(double)CLOCKS_PER_SEC);
+
+	rstring = mpd_to_sci(result, 1);
+	mpd_snprint_flags(status_str, MPD_MAX_FLAG_STRING, ctx.status);
+	printf("%s  %s\n", rstring, status_str);
+
+	mpd_del(a);
+	mpd_del(b);
+	mpd_del(result);
+	mpd_free(rstring);
+
+	return 0;
+}
+
+
diff --git a/Modules/_decimal/libmpdec/vccompat.h b/Modules/_decimal/libmpdec/examples/sqrt.c
similarity index 61%
rename from Modules/_decimal/libmpdec/vccompat.h
rename to Modules/_decimal/libmpdec/examples/sqrt.c
index e2e1c42..d827278 100644
--- a/Modules/_decimal/libmpdec/vccompat.h
+++ b/Modules/_decimal/libmpdec/examples/sqrt.c
@@ -26,31 +26,49 @@
  */
 
 
-#ifndef LIBMPDEC_VCCOMPAT_H_
-#define LIBMPDEC_VCCOMPAT_H_
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <mpdecimal.h>
 
 
-/* Visual C fixes: no snprintf ... */
-#ifdef _MSC_VER
-  #ifndef __cplusplus
-    #undef inline
-    #define inline __inline
-  #endif
-  #undef random
-  #define random rand
-  #undef srandom
-  #define srandom srand
-  #undef snprintf
-  #define snprintf sprintf_s
-  #define HAVE_SNPRINTF
-  #undef strncasecmp
-  #define strncasecmp _strnicmp
-  #undef strcasecmp
-  #define strcasecmp _stricmp
-  #undef strtoll
-  #define strtoll _strtoi64
-  #define strdup _strdup
-#endif
+int
+main(int argc, char **argv)
+{
+	mpd_context_t ctx;
+	mpd_t *a;
+	mpd_t *result;
+	char *rstring;
+	char status_str[MPD_MAX_FLAG_STRING];
+	clock_t start_clock, end_clock;
+
+	if (argc != 2) {
+		fprintf(stderr, "sqrt: usage: ./sqrt x\n");
+		exit(1);
+	}
+
+	mpd_init(&ctx, 38);
+	ctx.traps = 0;
+
+	result = mpd_new(&ctx);
+	a = mpd_new(&ctx);
+	mpd_set_string(a, argv[1], &ctx);
+
+	start_clock = clock();
+	mpd_sqrt(result, a, &ctx);
+	end_clock = clock();
+	fprintf(stderr, "time: %f\n\n",
+	           (double)(end_clock-start_clock)/(double)CLOCKS_PER_SEC);
+
+	rstring = mpd_to_sci(result, 1);
+	mpd_snprint_flags(status_str, MPD_MAX_FLAG_STRING, ctx.status);
+	printf("%s  %s\n", rstring, status_str);
+
+	mpd_del(a);
+	mpd_del(result);
+	mpd_free(rstring);
+
+	return 0;
+}
 
 
-#endif /* LIBMPDEC_VCCOMPAT_H_ */
diff --git a/Modules/_decimal/libmpdec/io.c b/Modules/_decimal/libmpdec/io.c
index 9513a68..e7bd6ae 100644
--- a/Modules/_decimal/libmpdec/io.c
+++ b/Modules/_decimal/libmpdec/io.c
@@ -37,17 +37,17 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "typearith.h"
 #include "io.h"
+#include "typearith.h"
 
 
 /* This file contains functions for decimal <-> string conversions, including
    PEP-3101 formatting for numeric types. */
 
 
-/* Disable warning that is part of -Wextra since gcc 7.0. */
 #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && __GNUC__ >= 7
   #pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
+  #pragma GCC diagnostic ignored "-Wmisleading-indentation"
 #endif
 
 
@@ -155,13 +155,13 @@
                 s++;
             break;
         default:
-            if (!isdigit((uchar)*s))
+            if (!isdigit((unsigned char)*s))
                 return NULL;
             if (coeff == NULL && *exp == NULL) {
                 if (*s == '0') {
-                    if (!isdigit((uchar)*(s+1)))
+                    if (!isdigit((unsigned char)*(s+1)))
                         if (!(*(s+1) == '.' &&
-                              isdigit((uchar)*(s+2))))
+                              isdigit((unsigned char)*(s+2))))
                             coeff = s;
                 }
                 else {
@@ -187,7 +187,7 @@
         s++;
     coeff = s;
 
-    while (isdigit((uchar)*s))
+    while (isdigit((unsigned char)*s))
         s++;
     *end = s;
 
@@ -689,8 +689,8 @@
 static int
 _mpd_copy_utf8(char dest[5], const char *s)
 {
-    const uchar *cp = (const uchar *)s;
-    uchar lb, ub;
+    const unsigned char *cp = (const unsigned char *)s;
+    unsigned char lb, ub;
     int count, i;
 
 
@@ -843,7 +843,7 @@
     }
 
     /* minimum width */
-    if (isdigit((uchar)*cp)) {
+    if (isdigit((unsigned char)*cp)) {
         if (*cp == '0') {
             return 0;
         }
@@ -865,7 +865,7 @@
     /* fraction digits or significant digits */
     if (*cp == '.') {
         cp++;
-        if (!isdigit((uchar)*cp)) {
+        if (!isdigit((unsigned char)*cp)) {
             return 0;
         }
         errno = 0;
@@ -1105,9 +1105,9 @@
         sign = dp++;
     }
     /* integer part */
-    assert(isdigit((uchar)*dp));
+    assert(isdigit((unsigned char)*dp));
     intpart = dp++;
-    while (isdigit((uchar)*dp)) {
+    while (isdigit((unsigned char)*dp)) {
         dp++;
     }
     n_int = (mpd_ssize_t)(dp-intpart);
@@ -1262,8 +1262,8 @@
         return NULL;
     }
 
-    if (isupper((uchar)type)) {
-        type = (char)tolower((uchar)type);
+    if (isupper((unsigned char)type)) {
+        type = (char)tolower((unsigned char)type);
         flags |= MPD_FMT_UPPER;
     }
     if (spec->sign == ' ') {
diff --git a/Modules/_decimal/libmpdec/mpalloc.c b/Modules/_decimal/libmpdec/mpalloc.c
index eb5ee7a..5871d5c 100644
--- a/Modules/_decimal/libmpdec/mpalloc.c
+++ b/Modules/_decimal/libmpdec/mpalloc.c
@@ -61,13 +61,6 @@
     size_t req;
     mpd_size_t overflow;
 
-#if MPD_SIZE_MAX < SIZE_MAX
-    /* full_coverage test only */
-    if (nmemb > MPD_SIZE_MAX || size > MPD_SIZE_MAX) {
-        return NULL;
-    }
-#endif
-
     req = mul_size_t_overflow((mpd_size_t)nmemb, (mpd_size_t)size,
                               &overflow);
     if (overflow) {
diff --git a/Modules/_decimal/libmpdec/mpalloc.h b/Modules/_decimal/libmpdec/mpalloc.h
index 1868084..2265004 100644
--- a/Modules/_decimal/libmpdec/mpalloc.h
+++ b/Modules/_decimal/libmpdec/mpalloc.h
@@ -39,12 +39,12 @@
 MPD_PRAGMA(MPD_HIDE_SYMBOLS_START)
 
 
-int mpd_switch_to_dyn(mpd_t *result, mpd_ssize_t size, uint32_t *status);
-int mpd_switch_to_dyn_zero(mpd_t *result, mpd_ssize_t size, uint32_t *status);
-int mpd_realloc_dyn(mpd_t *result, mpd_ssize_t size, uint32_t *status);
+int mpd_switch_to_dyn(mpd_t *result, mpd_ssize_t nwords, uint32_t *status);
+int mpd_switch_to_dyn_zero(mpd_t *result, mpd_ssize_t nwords, uint32_t *status);
+int mpd_realloc_dyn(mpd_t *result, mpd_ssize_t nwords, uint32_t *status);
 
-int mpd_switch_to_dyn_cxx(mpd_t *result, mpd_ssize_t size);
-int mpd_realloc_dyn_cxx(mpd_t *result, mpd_ssize_t size);
+int mpd_switch_to_dyn_cxx(mpd_t *result, mpd_ssize_t nwords);
+int mpd_realloc_dyn_cxx(mpd_t *result, mpd_ssize_t nwords);
 
 
 MPD_PRAGMA(MPD_HIDE_SYMBOLS_END) /* restore previous scope rules */
diff --git a/Modules/_decimal/libmpdec/mpdecimal.c b/Modules/_decimal/libmpdec/mpdecimal.c
index 28b639c..f1626df 100644
--- a/Modules/_decimal/libmpdec/mpdecimal.c
+++ b/Modules/_decimal/libmpdec/mpdecimal.c
@@ -64,7 +64,7 @@
 
 #if defined(_MSC_VER)
   #define ALWAYS_INLINE __forceinline
-#elif defined(__IBMC__) || defined(LEGACY_COMPILER)
+#elif defined (__IBMC__) || defined(LEGACY_COMPILER)
   #define ALWAYS_INLINE
   #undef inline
   #define inline
@@ -4843,7 +4843,7 @@
          uint32_t *status)
 {
     mpd_context_t varcontext, maxcontext;
-    mpd_t *z = (mpd_t *) result;
+    mpd_t *z = result;
     MPD_NEW_STATIC(v,0,0,0,0);
     MPD_NEW_STATIC(vtmp,0,0,0,0);
     MPD_NEW_STATIC(tmp,0,0,0,0);
@@ -6368,7 +6368,7 @@
     mpd_context_t workctx;
     MPD_NEW_STATIC(tbase,0,0,0,0);
     MPD_NEW_STATIC(texp,0,0,0,0);
-    mpd_ssize_t n;
+    mpd_uint_t n;
 
 
     mpd_workcontext(&workctx, ctx);
@@ -8090,7 +8090,6 @@
     }
 
     digits = a->digits+a->exp;
-    assert(digits > 0);
 
 #ifdef CONFIG_64
     /* ceil(2711437152599294 / log10(2)) + 4 == 2**53 */
@@ -8656,3 +8655,355 @@
     mpd_qresize(result, result->len, status);
     mpd_qfinalize(result, ctx, status);
 }
+
+
+/******************************************************************************/
+/*                                From triple                                 */
+/******************************************************************************/
+
+#if defined(CONFIG_64) && defined(__SIZEOF_INT128__)
+static mpd_ssize_t
+_set_coeff(uint64_t data[3], uint64_t hi, uint64_t lo)
+{
+    __uint128_t d = ((__uint128_t)hi << 64) + lo;
+    __uint128_t q, r;
+
+    q = d / MPD_RADIX;
+    r = d % MPD_RADIX;
+    data[0] = (uint64_t)r;
+    d = q;
+
+    q = d / MPD_RADIX;
+    r = d % MPD_RADIX;
+    data[1] = (uint64_t)r;
+    d = q;
+
+    q = d / MPD_RADIX;
+    r = d % MPD_RADIX;
+    data[2] = (uint64_t)r;
+
+    if (q != 0) {
+        abort(); /* GCOV_NOT_REACHED */
+    }
+
+    return data[2] != 0 ? 3 : (data[1] != 0 ? 2 : 1);
+}
+#else
+static size_t
+_uint_from_u16(mpd_uint_t *w, mpd_ssize_t wlen, const uint16_t *u, size_t ulen)
+{
+    const mpd_uint_t ubase = 1U<<16;
+    mpd_ssize_t n = 0;
+    mpd_uint_t carry;
+
+    assert(wlen > 0 && ulen > 0);
+
+    w[n++] = u[--ulen];
+    while (--ulen != SIZE_MAX) {
+        carry = _mpd_shortmul_c(w, w, n, ubase);
+        if (carry) {
+            if (n >= wlen) {
+                abort();  /* GCOV_NOT_REACHED */
+            }
+            w[n++] = carry;
+        }
+        carry = _mpd_shortadd(w, n, u[ulen]);
+        if (carry) {
+            if (n >= wlen) {
+                abort();  /* GCOV_NOT_REACHED */
+            }
+            w[n++] = carry;
+        }
+    }
+
+    return n;
+}
+
+static mpd_ssize_t
+_set_coeff(mpd_uint_t *data, mpd_ssize_t len, uint64_t hi, uint64_t lo)
+{
+    uint16_t u16[8] = {0};
+
+    u16[7] = (uint16_t)((hi & 0xFFFF000000000000ULL) >> 48);
+    u16[6] = (uint16_t)((hi & 0x0000FFFF00000000ULL) >> 32);
+    u16[5] = (uint16_t)((hi & 0x00000000FFFF0000ULL) >> 16);
+    u16[4] = (uint16_t) (hi & 0x000000000000FFFFULL);
+
+    u16[3] = (uint16_t)((lo & 0xFFFF000000000000ULL) >> 48);
+    u16[2] = (uint16_t)((lo & 0x0000FFFF00000000ULL) >> 32);
+    u16[1] = (uint16_t)((lo & 0x00000000FFFF0000ULL) >> 16);
+    u16[0] = (uint16_t) (lo & 0x000000000000FFFFULL);
+
+    return (mpd_ssize_t)_uint_from_u16(data, len, u16, 8);
+}
+#endif
+
+static int
+_set_uint128_coeff_exp(mpd_t *result, uint64_t hi, uint64_t lo, mpd_ssize_t exp)
+{
+    mpd_uint_t data[5] = {0};
+    uint32_t status = 0;
+    mpd_ssize_t len;
+
+#if defined(CONFIG_64) && defined(__SIZEOF_INT128__)
+    len = _set_coeff(data, hi, lo);
+#else
+    len = _set_coeff(data, 5, hi, lo);
+#endif
+
+    if (!mpd_qresize(result, len, &status)) {
+        return -1;
+    }
+
+    for (mpd_ssize_t i = 0; i < len; i++) {
+        result->data[i] = data[i];
+    }
+
+    result->exp = exp;
+    result->len = len;
+    mpd_setdigits(result);
+
+    return 0;
+}
+
+int
+mpd_from_uint128_triple(mpd_t *result, const mpd_uint128_triple_t *triple, uint32_t *status)
+{
+    static const mpd_context_t maxcontext = {
+     .prec=MPD_MAX_PREC,
+     .emax=MPD_MAX_EMAX,
+     .emin=MPD_MIN_EMIN,
+     .round=MPD_ROUND_HALF_EVEN,
+     .traps=MPD_Traps,
+     .status=0,
+     .newtrap=0,
+     .clamp=0,
+     .allcr=1,
+    };
+    const enum mpd_triple_class tag = triple->tag;
+    const uint8_t sign = triple->sign;
+    const uint64_t hi = triple->hi;
+    const uint64_t lo = triple->lo;
+    mpd_ssize_t exp;
+
+#ifdef CONFIG_32
+    if (triple->exp < MPD_SSIZE_MIN || triple->exp > MPD_SSIZE_MAX) {
+        goto conversion_error;
+    }
+#endif
+    exp = (mpd_ssize_t)triple->exp;
+
+    switch (tag) {
+    case MPD_TRIPLE_QNAN: case MPD_TRIPLE_SNAN: {
+        if (sign > 1 || exp != 0) {
+            goto conversion_error;
+        }
+
+        const uint8_t flags = tag == MPD_TRIPLE_QNAN ? MPD_NAN : MPD_SNAN;
+        mpd_setspecial(result, sign, flags);
+
+        if (hi == 0 && lo == 0) {  /* no payload */
+            return 0;
+        }
+
+        if (_set_uint128_coeff_exp(result, hi, lo, exp) < 0) {
+            goto malloc_error;
+        }
+
+        return 0;
+    }
+
+    case MPD_TRIPLE_INF: {
+        if (sign > 1 || hi != 0 || lo != 0 || exp != 0) {
+            goto conversion_error;
+        }
+
+        mpd_setspecial(result, sign, MPD_INF);
+
+        return 0;
+    }
+
+    case MPD_TRIPLE_NORMAL: {
+        if (sign > 1) {
+            goto conversion_error;
+        }
+
+        const uint8_t flags = sign ? MPD_NEG : MPD_POS;
+        mpd_set_flags(result, flags);
+
+        if (exp > MPD_EXP_INF) {
+            exp = MPD_EXP_INF;
+        }
+        if (exp == MPD_SSIZE_MIN) {
+            exp = MPD_SSIZE_MIN+1;
+        }
+
+        if (_set_uint128_coeff_exp(result, hi, lo, exp) < 0) {
+            goto malloc_error;
+        }
+
+        uint32_t workstatus = 0;
+        mpd_qfinalize(result, &maxcontext, &workstatus);
+        if (workstatus & (MPD_Inexact|MPD_Rounded|MPD_Clamped)) {
+            goto conversion_error;
+        }
+
+        return 0;
+    }
+
+    default:
+        goto conversion_error;
+    }
+
+conversion_error:
+    mpd_seterror(result, MPD_Conversion_syntax, status);
+    return -1;
+
+malloc_error:
+    mpd_seterror(result, MPD_Malloc_error, status);
+    return -1;
+}
+
+
+/******************************************************************************/
+/*                                  As triple                                 */
+/******************************************************************************/
+
+#if defined(CONFIG_64) && defined(__SIZEOF_INT128__)
+static void
+_get_coeff(uint64_t *hi, uint64_t *lo, const mpd_t *a)
+{
+    __uint128_t u128 = 0;
+
+    switch (a->len) {
+    case 3:
+        u128 = a->data[2]; /* fall through */
+    case 2:
+        u128 = u128 * MPD_RADIX + a->data[1]; /* fall through */
+    case 1:
+        u128 = u128 * MPD_RADIX + a->data[0];
+        break;
+    default:
+        abort(); /* GCOV_NOT_REACHED */
+    }
+
+    *hi = u128 >> 64;
+    *lo = (uint64_t)u128;
+}
+#else
+static size_t
+_uint_to_u16(uint16_t w[8], mpd_uint_t *u, mpd_ssize_t ulen)
+{
+    const mpd_uint_t wbase = 1U<<16;
+    size_t n = 0;
+
+    assert(ulen > 0);
+
+    do {
+        if (n >= 8) {
+            abort();  /* GCOV_NOT_REACHED */
+        }
+        w[n++] = (uint16_t)_mpd_shortdiv(u, u, ulen, wbase);
+        /* ulen is at least 1. u[ulen-1] can only be zero if ulen == 1. */
+        ulen = _mpd_real_size(u, ulen);
+
+    } while (u[ulen-1] != 0);
+
+    return n;
+}
+
+static void
+_get_coeff(uint64_t *hi, uint64_t *lo, const mpd_t *a)
+{
+    uint16_t u16[8] = {0};
+    mpd_uint_t data[5] = {0};
+
+    switch (a->len) {
+    case 5:
+        data[4] = a->data[4]; /* fall through */
+    case 4:
+        data[3] = a->data[3]; /* fall through */
+    case 3:
+        data[2] = a->data[2]; /* fall through */
+    case 2:
+        data[1] = a->data[1]; /* fall through */
+    case 1:
+        data[0] = a->data[0];
+        break;
+    default:
+        abort();  /* GCOV_NOT_REACHED */
+    }
+
+    _uint_to_u16(u16, data, a->len);
+
+    *hi = (uint64_t)u16[7] << 48;
+    *hi |= (uint64_t)u16[6] << 32;
+    *hi |= (uint64_t)u16[5] << 16;
+    *hi |= (uint64_t)u16[4];
+
+    *lo = (uint64_t)u16[3] << 48;
+    *lo |= (uint64_t)u16[2] << 32;
+    *lo |= (uint64_t)u16[1] << 16;
+    *lo |= (uint64_t)u16[0];
+}
+#endif
+
+static enum mpd_triple_class
+_coeff_as_uint128(uint64_t *hi, uint64_t *lo, const mpd_t *a)
+{
+#ifdef CONFIG_64
+    static mpd_uint_t uint128_max_data[3] = { 3374607431768211455ULL, 4028236692093846346ULL, 3ULL };
+    static const mpd_t uint128_max = { MPD_STATIC|MPD_CONST_DATA, 0, 39, 3, 3, uint128_max_data };
+#else
+    static mpd_uint_t uint128_max_data[5] = { 768211455U, 374607431U, 938463463U, 282366920U, 340U };
+    static const mpd_t uint128_max = { MPD_STATIC|MPD_CONST_DATA, 0, 39, 5, 5, uint128_max_data };
+#endif
+    enum mpd_triple_class ret = MPD_TRIPLE_NORMAL;
+    uint32_t status = 0;
+    mpd_t coeff;
+
+    *hi = *lo = 0ULL;
+
+    if (mpd_isspecial(a)) {
+        if (mpd_isinfinite(a)) {
+            return MPD_TRIPLE_INF;
+        }
+
+        ret = mpd_isqnan(a) ? MPD_TRIPLE_QNAN : MPD_TRIPLE_SNAN;
+        if (a->len == 0) { /* no payload */
+            return ret;
+        }
+    }
+    else if (mpd_iszero(a)) {
+        return ret;
+    }
+
+    _mpd_copy_shared(&coeff, a);
+    mpd_set_flags(&coeff, 0);
+    coeff.exp = 0;
+
+    if (mpd_qcmp(&coeff, &uint128_max, &status) > 0) {
+        return MPD_TRIPLE_ERROR;
+    }
+
+    _get_coeff(hi, lo, &coeff);
+    return ret;
+}
+
+mpd_uint128_triple_t
+mpd_as_uint128_triple(const mpd_t *a)
+{
+    mpd_uint128_triple_t triple = { MPD_TRIPLE_ERROR, 0, 0, 0, 0 };
+
+    triple.tag = _coeff_as_uint128(&triple.hi, &triple.lo, a);
+    if (triple.tag == MPD_TRIPLE_ERROR) {
+        return triple;
+    }
+
+    triple.sign = !!mpd_isnegative(a);
+    if (triple.tag == MPD_TRIPLE_NORMAL) {
+        triple.exp = a->exp;
+    }
+
+    return triple;
+}
diff --git a/Modules/_decimal/libmpdec/mpdecimal.h b/Modules/_decimal/libmpdec/mpdecimal.h
index 5a24396..24c280b 100644
--- a/Modules/_decimal/libmpdec/mpdecimal.h
+++ b/Modules/_decimal/libmpdec/mpdecimal.h
@@ -40,6 +40,7 @@
   #include <cstdint>
   #include <cstdio>
   #include <cstdlib>
+  #define MPD_UINT8_C(x) (static_cast<uint8_t>(x))
 extern "C" {
 #else
   #include <inttypes.h>
@@ -47,6 +48,7 @@
   #include <stdint.h>
   #include <stdio.h>
   #include <stdlib.h>
+  #define MPD_UINT8_C(x) ((uint8_t)x)
 #endif
 
 
@@ -62,7 +64,6 @@
 #endif
 
 #if defined(_MSC_VER)
-  #include "vccompat.h"
   #define EXTINLINE extern inline
 #else
   #define EXTINLINE
@@ -74,25 +75,15 @@
 MPD_PRAGMA(MPD_HIDE_SYMBOLS_START)
 
 
-#if !defined(LEGACY_COMPILER)
-  #if !defined(UINT64_MAX)
-    /* The following #error is just a warning. If the compiler indeed does
-     * not have uint64_t, it is perfectly safe to comment out the #error. */
-    #error "Warning: Compiler without uint64_t. Comment out this line."
-    #define LEGACY_COMPILER
-  #endif
-#endif
-
-
 /******************************************************************************/
 /*                                  Version                                   */
 /******************************************************************************/
 
 #define MPD_MAJOR_VERSION 2
 #define MPD_MINOR_VERSION 5
-#define MPD_MICRO_VERSION 0
+#define MPD_MICRO_VERSION 1
 
-#define MPD_VERSION "2.5.0"
+#define MPD_VERSION "2.5.1"
 
 #define MPD_VERSION_HEX ((MPD_MAJOR_VERSION << 24) | \
                          (MPD_MINOR_VERSION << 16) | \
@@ -162,6 +153,7 @@
 #define MPD_EXP_INF 2000000000000000001LL
 #define MPD_EXP_CLAMP (-4000000000000000001LL)
 #define MPD_MAXIMPORT 105263157894736842L /* ceil((2*MPD_MAX_PREC)/MPD_RDIGITS) */
+#define MPD_IEEE_CONTEXT_MAX_BITS 512     /* 16*(log2(MPD_MAX_EMAX / 3)-3) */
 
 /* conversion specifiers */
 #define PRI_mpd_uint_t PRIu64
@@ -203,9 +195,10 @@
 #define MPD_MAX_EMAX 425000000L        /* ELIMIT-1 */
 #define MPD_MIN_EMIN (-425000000L)     /* -EMAX */
 #define MPD_MIN_ETINY (MPD_MIN_EMIN-(MPD_MAX_PREC-1))
-#define MPD_EXP_INF 1000000001L      /* allows for emax=999999999 in the tests */
-#define MPD_EXP_CLAMP (-2000000001L) /* allows for emin=-999999999 in the tests */
-#define MPD_MAXIMPORT 94444445L      /* ceil((2*MPD_MAX_PREC)/MPD_RDIGITS) */
+#define MPD_EXP_INF 1000000001L       /* allows for emax=999999999 in the tests */
+#define MPD_EXP_CLAMP (-2000000001L)  /* allows for emin=-999999999 in the tests */
+#define MPD_MAXIMPORT 94444445L       /* ceil((2*MPD_MAX_PREC)/MPD_RDIGITS) */
+#define MPD_IEEE_CONTEXT_MAX_BITS 256 /* 16*(log2(MPD_MAX_EMAX / 3)-3) */
 
 /* conversion specifiers */
 #define PRI_mpd_uint_t PRIu32
@@ -242,8 +235,8 @@
 
 enum { MPD_CLAMP_DEFAULT, MPD_CLAMP_IEEE_754, MPD_CLAMP_GUARD };
 
-extern const char *mpd_round_string[MPD_ROUND_GUARD];
-extern const char *mpd_clamp_string[MPD_CLAMP_GUARD];
+extern const char * const mpd_round_string[MPD_ROUND_GUARD];
+extern const char * const mpd_clamp_string[MPD_CLAMP_GUARD];
 
 
 typedef struct mpd_context_t {
@@ -300,7 +293,6 @@
 #define MPD_Insufficient_storage MPD_Malloc_error
 
 /* IEEE 754 interchange format contexts */
-#define MPD_IEEE_CONTEXT_MAX_BITS 512 /* 16*(log2(MPD_MAX_EMAX / 3)-3) */
 #define MPD_DECIMAL32 32
 #define MPD_DECIMAL64 64
 #define MPD_DECIMAL128 128
@@ -345,16 +337,16 @@
 /******************************************************************************/
 
 /* mpd_t flags */
-#define MPD_POS                 ((uint8_t)0)
-#define MPD_NEG                 ((uint8_t)1)
-#define MPD_INF                 ((uint8_t)2)
-#define MPD_NAN                 ((uint8_t)4)
-#define MPD_SNAN                ((uint8_t)8)
+#define MPD_POS                 MPD_UINT8_C(0)
+#define MPD_NEG                 MPD_UINT8_C(1)
+#define MPD_INF                 MPD_UINT8_C(2)
+#define MPD_NAN                 MPD_UINT8_C(4)
+#define MPD_SNAN                MPD_UINT8_C(8)
 #define MPD_SPECIAL (MPD_INF|MPD_NAN|MPD_SNAN)
-#define MPD_STATIC              ((uint8_t)16)
-#define MPD_STATIC_DATA         ((uint8_t)32)
-#define MPD_SHARED_DATA         ((uint8_t)64)
-#define MPD_CONST_DATA          ((uint8_t)128)
+#define MPD_STATIC              MPD_UINT8_C(16)
+#define MPD_STATIC_DATA         MPD_UINT8_C(32)
+#define MPD_SHARED_DATA         MPD_UINT8_C(64)
+#define MPD_CONST_DATA          MPD_UINT8_C(128)
 #define MPD_DATAFLAGS (MPD_STATIC_DATA|MPD_SHARED_DATA|MPD_CONST_DATA)
 
 /* mpd_t */
@@ -368,7 +360,29 @@
 } mpd_t;
 
 
-typedef unsigned char uchar;
+/******************************************************************************/
+/*                                    Triple                                  */
+/******************************************************************************/
+
+/* status cases for getting a triple */
+enum mpd_triple_class {
+  MPD_TRIPLE_NORMAL,
+  MPD_TRIPLE_INF,
+  MPD_TRIPLE_QNAN,
+  MPD_TRIPLE_SNAN,
+  MPD_TRIPLE_ERROR,
+};
+
+typedef struct {
+  enum mpd_triple_class tag;
+  uint8_t sign;
+  uint64_t hi;
+  uint64_t lo;
+  int64_t exp;
+} mpd_uint128_triple_t;
+
+int mpd_from_uint128_triple(mpd_t *result, const mpd_uint128_triple_t *triple, uint32_t *status);
+mpd_uint128_triple_t mpd_as_uint128_triple(const mpd_t *a);
 
 
 /******************************************************************************/
@@ -417,7 +431,7 @@
 /* set to NaN with error flags */
 void mpd_seterror(mpd_t *result, uint32_t flags, uint32_t *status);
 /* set a special with sign and type */
-void mpd_setspecial(mpd_t *dec, uint8_t sign, uint8_t type);
+void mpd_setspecial(mpd_t *result, uint8_t sign, uint8_t type);
 /* set coefficient to zero or all nines */
 void mpd_zerocoeff(mpd_t *result);
 void mpd_qmaxcoeff(mpd_t *result, const mpd_context_t *ctx, uint32_t *status);
@@ -810,16 +824,16 @@
 
 mpd_t *mpd_qnew(void);
 mpd_t *mpd_new(mpd_context_t *ctx);
-mpd_t *mpd_qnew_size(mpd_ssize_t size);
+mpd_t *mpd_qnew_size(mpd_ssize_t nwords);
 EXTINLINE void mpd_del(mpd_t *dec);
 
 EXTINLINE void mpd_uint_zero(mpd_uint_t *dest, mpd_size_t len);
-EXTINLINE int mpd_qresize(mpd_t *result, mpd_ssize_t size, uint32_t *status);
-EXTINLINE int mpd_qresize_zero(mpd_t *result, mpd_ssize_t size, uint32_t *status);
+EXTINLINE int mpd_qresize(mpd_t *result, mpd_ssize_t nwords, uint32_t *status);
+EXTINLINE int mpd_qresize_zero(mpd_t *result, mpd_ssize_t nwords, uint32_t *status);
 EXTINLINE void mpd_minalloc(mpd_t *result);
 
-int mpd_resize(mpd_t *result, mpd_ssize_t size, mpd_context_t *ctx);
-int mpd_resize_zero(mpd_t *result, mpd_ssize_t size, mpd_context_t *ctx);
+int mpd_resize(mpd_t *result, mpd_ssize_t nwords, mpd_context_t *ctx);
+int mpd_resize_zero(mpd_t *result, mpd_ssize_t nwords, mpd_context_t *ctx);
 
 
 MPD_PRAGMA(MPD_HIDE_SYMBOLS_END) /* restore previous scope rules */
diff --git a/Modules/_decimal/libmpdec/mpsignal.c b/Modules/_decimal/libmpdec/mpsignal.c
new file mode 100644
index 0000000..fc2af48
--- /dev/null
+++ b/Modules/_decimal/libmpdec/mpsignal.c
@@ -0,0 +1,967 @@
+/*
+ * Copyright (c) 2008-2020 Stefan Krah. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+
+#include "mpdecimal.h"
+
+#include <stddef.h>
+#include <stdint.h>
+
+
+/* Signaling wrappers for the quiet functions in mpdecimal.c. */
+
+
+char *
+mpd_format(const mpd_t *dec, const char *fmt, mpd_context_t *ctx)
+{
+    char *ret;
+    uint32_t status = 0;
+    ret = mpd_qformat(dec, fmt, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+    return ret;
+}
+
+void
+mpd_import_u16(mpd_t *result, const uint16_t *srcdata, size_t srclen,
+               uint8_t srcsign, uint32_t base, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qimport_u16(result, srcdata, srclen, srcsign, base, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_import_u32(mpd_t *result, const uint32_t *srcdata, size_t srclen,
+               uint8_t srcsign, uint32_t base, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qimport_u32(result, srcdata, srclen, srcsign, base, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+size_t
+mpd_export_u16(uint16_t **rdata, size_t rlen, uint32_t base, const mpd_t *src,
+               mpd_context_t *ctx)
+{
+    size_t n;
+    uint32_t status = 0;
+    n = mpd_qexport_u16(rdata, rlen, base, src, &status);
+    mpd_addstatus_raise(ctx, status);
+    return n;
+}
+
+size_t
+mpd_export_u32(uint32_t **rdata, size_t rlen, uint32_t base, const mpd_t *src,
+               mpd_context_t *ctx)
+{
+    size_t n;
+    uint32_t status = 0;
+    n = mpd_qexport_u32(rdata, rlen, base, src, &status);
+    mpd_addstatus_raise(ctx, status);
+    return n;
+}
+
+void
+mpd_finalize(mpd_t *result, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qfinalize(result, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+int
+mpd_check_nan(mpd_t *result, const mpd_t *a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    if (mpd_qcheck_nan(result, a, ctx, &status)) {
+        mpd_addstatus_raise(ctx, status);
+        return 1;
+    }
+    return 0;
+}
+
+int
+mpd_check_nans(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    if (mpd_qcheck_nans(result, a, b, ctx, &status)) {
+        mpd_addstatus_raise(ctx, status);
+        return 1;
+    }
+    return 0;
+}
+
+void
+mpd_set_string(mpd_t *result, const char *s, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qset_string(result, s, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_maxcoeff(mpd_t *result, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qmaxcoeff(result, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+/* set static mpd from signed integer */
+void
+mpd_sset_ssize(mpd_t *result, mpd_ssize_t a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qsset_ssize(result, a, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_sset_i32(mpd_t *result, int32_t a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qsset_i32(result, a, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+#ifdef CONFIG_64
+void
+mpd_sset_i64(mpd_t *result, int64_t a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qsset_i64(result, a, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+#endif
+
+/* set static mpd from unsigned integer */
+void
+mpd_sset_uint(mpd_t *result, mpd_uint_t a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qsset_uint(result, a, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_sset_u32(mpd_t *result, uint32_t a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qsset_u32(result, a, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+#ifdef CONFIG_64
+void
+mpd_sset_u64(mpd_t *result, uint64_t a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qsset_u64(result, a, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+#endif
+
+/* set mpd from signed integer */
+void
+mpd_set_ssize(mpd_t *result, mpd_ssize_t a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qset_ssize(result, a, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_set_i32(mpd_t *result, int32_t a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qset_i32(result, a, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+#ifndef LEGACY_COMPILER
+void
+mpd_set_i64(mpd_t *result, int64_t a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qset_i64(result, a, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+#endif
+
+/* set mpd from unsigned integer */
+void
+mpd_set_uint(mpd_t *result, mpd_uint_t a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qset_uint(result, a, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_set_u32(mpd_t *result, uint32_t a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qset_u32(result, a, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+#ifndef LEGACY_COMPILER
+void
+mpd_set_u64(mpd_t *result, uint64_t a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qset_u64(result, a, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+#endif
+
+/* convert mpd to signed integer */
+mpd_ssize_t
+mpd_get_ssize(const mpd_t *a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_ssize_t ret;
+
+    ret = mpd_qget_ssize(a, &status);
+    mpd_addstatus_raise(ctx, status);
+    return ret;
+}
+
+int32_t
+mpd_get_i32(const mpd_t *a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    int32_t ret;
+
+    ret = mpd_qget_i32(a, &status);
+    mpd_addstatus_raise(ctx, status);
+    return ret;
+}
+
+#ifndef LEGACY_COMPILER
+int64_t
+mpd_get_i64(const mpd_t *a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    int64_t ret;
+
+    ret = mpd_qget_i64(a, &status);
+    mpd_addstatus_raise(ctx, status);
+    return ret;
+}
+#endif
+
+mpd_uint_t
+mpd_get_uint(const mpd_t *a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_uint_t ret;
+
+    ret = mpd_qget_uint(a, &status);
+    mpd_addstatus_raise(ctx, status);
+    return ret;
+}
+
+mpd_uint_t
+mpd_abs_uint(const mpd_t *a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_uint_t ret;
+
+    ret = mpd_qabs_uint(a, &status);
+    mpd_addstatus_raise(ctx, status);
+    return ret;
+}
+
+uint32_t
+mpd_get_u32(const mpd_t *a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    uint32_t ret;
+
+    ret = mpd_qget_u32(a, &status);
+    mpd_addstatus_raise(ctx, status);
+    return ret;
+}
+
+#ifndef LEGACY_COMPILER
+uint64_t
+mpd_get_u64(const mpd_t *a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    uint64_t ret;
+
+    ret = mpd_qget_u64(a, &status);
+    mpd_addstatus_raise(ctx, status);
+    return ret;
+}
+#endif
+
+void
+mpd_and(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qand(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_copy(mpd_t *result, const mpd_t *a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    if (!mpd_qcopy(result, a, &status)) {
+        mpd_addstatus_raise(ctx, status);
+    }
+}
+
+void
+mpd_canonical(mpd_t *result, const mpd_t *a, mpd_context_t *ctx)
+{
+    mpd_copy(result, a, ctx);
+}
+
+void
+mpd_copy_abs(mpd_t *result, const mpd_t *a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    if (!mpd_qcopy_abs(result, a, &status)) {
+        mpd_addstatus_raise(ctx, status);
+    }
+}
+
+void
+mpd_copy_negate(mpd_t *result, const mpd_t *a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    if (!mpd_qcopy_negate(result, a, &status)) {
+        mpd_addstatus_raise(ctx, status);
+    }
+}
+
+void
+mpd_copy_sign(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    if (!mpd_qcopy_sign(result, a, b, &status)) {
+        mpd_addstatus_raise(ctx, status);
+    }
+}
+
+void
+mpd_invert(mpd_t *result, const mpd_t *a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qinvert(result, a, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_logb(mpd_t *result, const mpd_t *a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qlogb(result, a, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_or(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qor(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_rotate(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qrotate(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_scaleb(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qscaleb(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_shiftl(mpd_t *result, const mpd_t *a, mpd_ssize_t n, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qshiftl(result, a, n, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+mpd_uint_t
+mpd_shiftr(mpd_t *result, const mpd_t *a, mpd_ssize_t n, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_uint_t rnd;
+
+    rnd = mpd_qshiftr(result, a, n, &status);
+    mpd_addstatus_raise(ctx, status);
+    return rnd;
+}
+
+void
+mpd_shiftn(mpd_t *result, const mpd_t *a, mpd_ssize_t n, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qshiftn(result, a, n, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_shift(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qshift(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_xor(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qxor(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_abs(mpd_t *result, const mpd_t *a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qabs(result, a, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+int
+mpd_cmp(const mpd_t *a, const mpd_t *b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    int c;
+    c = mpd_qcmp(a, b, &status);
+    mpd_addstatus_raise(ctx, status);
+    return c;
+}
+
+int
+mpd_compare(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    int c;
+    c = mpd_qcompare(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+    return c;
+}
+
+int
+mpd_compare_signal(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    int c;
+    c = mpd_qcompare_signal(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+    return c;
+}
+
+void
+mpd_add(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qadd(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_sub(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qsub(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_add_ssize(mpd_t *result, const mpd_t *a, mpd_ssize_t b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qadd_ssize(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_add_i32(mpd_t *result, const mpd_t *a, int32_t b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qadd_i32(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+#ifndef LEGACY_COMPILER
+void
+mpd_add_i64(mpd_t *result, const mpd_t *a, int64_t b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qadd_i64(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+#endif
+
+void
+mpd_add_uint(mpd_t *result, const mpd_t *a, mpd_uint_t b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qadd_uint(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_add_u32(mpd_t *result, const mpd_t *a, uint32_t b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qadd_u32(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+#ifndef LEGACY_COMPILER
+void
+mpd_add_u64(mpd_t *result, const mpd_t *a, uint64_t b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qadd_u64(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+#endif
+
+void
+mpd_sub_ssize(mpd_t *result, const mpd_t *a, mpd_ssize_t b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qsub_ssize(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_sub_i32(mpd_t *result, const mpd_t *a, int32_t b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qsub_i32(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+#ifndef LEGACY_COMPILER
+void
+mpd_sub_i64(mpd_t *result, const mpd_t *a, int64_t b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qsub_i64(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+#endif
+
+void
+mpd_sub_uint(mpd_t *result, const mpd_t *a, mpd_uint_t b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qsub_uint(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_sub_u32(mpd_t *result, const mpd_t *a, uint32_t b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qsub_u32(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+#ifndef LEGACY_COMPILER
+void
+mpd_sub_u64(mpd_t *result, const mpd_t *a, uint64_t b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qsub_u64(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+#endif
+
+void
+mpd_div(mpd_t *q, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qdiv(q, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_div_ssize(mpd_t *result, const mpd_t *a, mpd_ssize_t b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qdiv_ssize(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_div_i32(mpd_t *result, const mpd_t *a, int32_t b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qdiv_i32(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+#ifndef LEGACY_COMPILER
+void
+mpd_div_i64(mpd_t *result, const mpd_t *a, int64_t b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qdiv_i64(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+#endif
+
+void
+mpd_div_uint(mpd_t *result, const mpd_t *a, mpd_uint_t b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qdiv_uint(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_div_u32(mpd_t *result, const mpd_t *a, uint32_t b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qdiv_u32(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+#ifndef LEGACY_COMPILER
+void
+mpd_div_u64(mpd_t *result, const mpd_t *a, uint64_t b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qdiv_u64(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+#endif
+
+void
+mpd_divmod(mpd_t *q, mpd_t *r, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qdivmod(q, r, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_divint(mpd_t *q, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qdivint(q, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_exp(mpd_t *result, const mpd_t *a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qexp(result, a, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_fma(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_t *c,
+        mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qfma(result, a, b, c, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_ln(mpd_t *result, const mpd_t *a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qln(result, a, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_log10(mpd_t *result, const mpd_t *a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qlog10(result, a, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_max(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qmax(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_max_mag(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qmax_mag(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_min(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qmin(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_min_mag(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qmin_mag(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_minus(mpd_t *result, const mpd_t *a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qminus(result, a, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_mul(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qmul(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_mul_ssize(mpd_t *result, const mpd_t *a, mpd_ssize_t b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qmul_ssize(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_mul_i32(mpd_t *result, const mpd_t *a, int32_t b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qmul_i32(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+#ifndef LEGACY_COMPILER
+void
+mpd_mul_i64(mpd_t *result, const mpd_t *a, int64_t b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qmul_i64(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+#endif
+
+void
+mpd_mul_uint(mpd_t *result, const mpd_t *a, mpd_uint_t b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qmul_uint(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_mul_u32(mpd_t *result, const mpd_t *a, uint32_t b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qmul_u32(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+#ifndef LEGACY_COMPILER
+void
+mpd_mul_u64(mpd_t *result, const mpd_t *a, uint64_t b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qmul_u64(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+#endif
+
+void
+mpd_next_minus(mpd_t *result, const mpd_t *a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qnext_minus(result, a, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_next_plus(mpd_t *result, const mpd_t *a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qnext_plus(result, a, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_next_toward(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qnext_toward(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_plus(mpd_t *result, const mpd_t *a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qplus(result, a, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_pow(mpd_t *result, const mpd_t *base, const mpd_t *exp, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qpow(result, base, exp, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_powmod(mpd_t *result, const mpd_t *base, const mpd_t *exp, const mpd_t *mod,
+           mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qpowmod(result, base, exp, mod, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_quantize(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qquantize(result, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_rescale(mpd_t *result, const mpd_t *a, mpd_ssize_t exp, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qrescale(result, a, exp, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_reduce(mpd_t *result, const mpd_t *a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qreduce(result, a, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_rem(mpd_t *r, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qrem(r, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_rem_near(mpd_t *r, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qrem_near(r, a, b, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_round_to_intx(mpd_t *result, const mpd_t *a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qround_to_intx(result, a, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_round_to_int(mpd_t *result, const mpd_t *a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qround_to_int(result, a, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_trunc(mpd_t *result, const mpd_t *a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qtrunc(result, a, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_floor(mpd_t *result, const mpd_t *a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qfloor(result, a, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_ceil(mpd_t *result, const mpd_t *a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qceil(result, a, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_sqrt(mpd_t *result, const mpd_t *a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qsqrt(result, a, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
+
+void
+mpd_invroot(mpd_t *result, const mpd_t *a, mpd_context_t *ctx)
+{
+    uint32_t status = 0;
+    mpd_qinvroot(result, a, ctx, &status);
+    mpd_addstatus_raise(ctx, status);
+}
diff --git a/Modules/_decimal/libmpdec/typearith.h b/Modules/_decimal/libmpdec/typearith.h
index 4796178..dd37764 100644
--- a/Modules/_decimal/libmpdec/typearith.h
+++ b/Modules/_decimal/libmpdec/typearith.h
@@ -638,10 +638,10 @@
 static inline mpd_size_t
 mul_size_t_overflow(mpd_size_t a, mpd_size_t b, mpd_size_t *overflow)
 {
-    mpd_uint_t lo;
+    mpd_uint_t hi, lo;
 
-    _mpd_mul_words((mpd_uint_t *)overflow, &lo, (mpd_uint_t)a,
-                   (mpd_uint_t)b);
+    _mpd_mul_words(&hi, &lo, (mpd_uint_t)a, (mpd_uint_t)b);
+    *overflow = (mpd_size_t)hi;
     return lo;
 }
 
diff --git a/Modules/_decimal/tests/bench.py b/Modules/_decimal/tests/bench.py
index 3726db1..24e091b 100644
--- a/Modules/_decimal/tests/bench.py
+++ b/Modules/_decimal/tests/bench.py
@@ -7,10 +7,7 @@
 
 
 import time
-try:
-    from test.support import import_fresh_module
-except ImportError:
-    from test.test_support import import_fresh_module
+from test.support.import_helper import import_fresh_module
 
 C = import_fresh_module('decimal', fresh=['_decimal'])
 P = import_fresh_module('decimal', blocked=['_decimal'])
diff --git a/Modules/_decimal/tests/deccheck.py b/Modules/_decimal/tests/deccheck.py
index 5d9179e..edf753f 100644
--- a/Modules/_decimal/tests/deccheck.py
+++ b/Modules/_decimal/tests/deccheck.py
@@ -30,10 +30,14 @@
 #
 
 
+import random
+import time
+
+RANDSEED = int(time.time())
+random.seed(RANDSEED)
+
 import sys
 import os
-import time
-import random
 from copy import copy
 from collections import defaultdict
 
@@ -43,7 +47,7 @@
 from queue import Queue, Empty
 from threading import Thread, Event, Lock
 
-from test.support import import_fresh_module
+from test.support.import_helper import import_fresh_module
 from randdec import randfloat, all_unary, all_binary, all_ternary
 from randdec import unary_optarg, binary_optarg, ternary_optarg
 from formathelper import rand_format, rand_locale
@@ -1160,10 +1164,6 @@
         args.single = args.single[0]
 
 
-    randseed = int(time.time())
-    random.seed(randseed)
-
-
     # Set up the testspecs list. A testspec is simply a dictionary
     # that determines the amount of different contexts that 'test_method'
     # will generate.
@@ -1231,9 +1231,9 @@
     if args.multicore:
         q = Queue()
     elif args.single:
-        log("Random seed: %d", randseed)
+        log("Random seed: %d", RANDSEED)
     else:
-        log("\n\nRandom seed: %d\n\n", randseed)
+        log("\n\nRandom seed: %d\n\n", RANDSEED)
 
 
     FOUND_METHOD = False
diff --git a/Modules/_decimal/tests/formathelper.py b/Modules/_decimal/tests/formathelper.py
index 19b2aad..c3daacf 100644
--- a/Modules/_decimal/tests/formathelper.py
+++ b/Modules/_decimal/tests/formathelper.py
@@ -31,7 +31,7 @@
 
 import os, sys, locale, random
 import platform, subprocess
-from test.support import import_fresh_module
+from test.support.import_helper import import_fresh_module
 from distutils.spawn import find_executable
 
 C = import_fresh_module('decimal', fresh=['_decimal'])
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
index 2c92a8a..8637bae 100644
--- a/Modules/_elementtree.c
+++ b/Modules/_elementtree.c
@@ -1,6 +1,6 @@
 /*--------------------------------------------------------------------
  * Licensed to PSF under a Contributor Agreement.
- * See http://www.python.org/psf/license for licensing details.
+ * See https://www.python.org/psf/license for licensing details.
  *
  * _elementtree - C accelerator for xml.etree.ElementTree
  * Copyright (c) 1999-2009 by Secret Labs AB.  All rights reserved.
@@ -1393,22 +1393,19 @@
                               PyObject *default_value)
 /*[clinic end generated code: output=523c614142595d75 input=ee153bbf8cdb246e]*/
 {
-    PyObject* value;
-
-    if (!self->extra || !self->extra->attrib)
-        value = default_value;
-    else {
-        value = PyDict_GetItemWithError(self->extra->attrib, key);
-        if (!value) {
-            if (PyErr_Occurred()) {
-                return NULL;
-            }
-            value = default_value;
+    if (self->extra && self->extra->attrib) {
+        PyObject *attrib = self->extra->attrib;
+        Py_INCREF(attrib);
+        PyObject *value = PyDict_GetItemWithError(attrib, key);
+        Py_XINCREF(value);
+        Py_DECREF(attrib);
+        if (value != NULL || PyErr_Occurred()) {
+            return value;
         }
     }
 
-    Py_INCREF(value);
-    return value;
+    Py_INCREF(default_value);
+    return default_value;
 }
 
 static PyObject *
@@ -2040,7 +2037,7 @@
     if (!PyDict_Check(value)) {
         PyErr_Format(PyExc_TypeError,
                      "attrib must be dict, not %.200s",
-                     value->ob_type->tp_name);
+                     Py_TYPE(value)->tp_name);
         return -1;
     }
     if (!self->extra) {
@@ -3639,7 +3636,7 @@
 _elementtree.XMLParser.__init__
 
     *
-    target: object = NULL
+    target: object = None
     encoding: str(accept={str, NoneType}) = None
 
 [clinic start generated code]*/
@@ -3647,7 +3644,7 @@
 static int
 _elementtree_XMLParser___init___impl(XMLParserObject *self, PyObject *target,
                                      const char *encoding)
-/*[clinic end generated code: output=3ae45ec6cdf344e4 input=53e35a829ae043e8]*/
+/*[clinic end generated code: output=3ae45ec6cdf344e4 input=7e716dd6e4f3e439]*/
 {
     self->entity = PyDict_New();
     if (!self->entity)
@@ -3672,7 +3669,7 @@
                            (unsigned long)_Py_HashSecret.expat.hashsalt);
     }
 
-    if (target) {
+    if (target != Py_None) {
         Py_INCREF(target);
     } else {
         target = treebuilder_new(&TreeBuilder_Type, NULL, NULL);
diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c
index d158d3b..fa14521 100644
--- a/Modules/_functoolsmodule.c
+++ b/Modules/_functoolsmodule.c
@@ -1,6 +1,9 @@
 #include "Python.h"
+#include "pycore_long.h"          // _PyLong_GetZero()
+#include "pycore_moduleobject.h"  // _PyModule_GetState()
+#include "pycore_object.h"        // _PyObject_GC_TRACK
 #include "pycore_pystate.h"       // _PyThreadState_GET()
-#include "pycore_tupleobject.h"
+#include "pycore_tuple.h"         // _PyTuple_ITEMS()
 #include "structmember.h"         // PyMemberDef
 
 /* _functools module written and maintained
@@ -10,6 +13,23 @@
    All rights reserved.
 */
 
+typedef struct _functools_state {
+    /* this object is used delimit args and keywords in the cache keys */
+    PyObject *kwd_mark;
+    PyTypeObject *partial_type;
+    PyTypeObject *keyobject_type;
+    PyTypeObject *lru_list_elem_type;
+} _functools_state;
+
+static inline _functools_state *
+get_functools_state(PyObject *module)
+{
+    void *state = _PyModule_GetState(module);
+    assert(state != NULL);
+    return (_functools_state *)state;
+}
+
+
 /* partial object **********************************************************/
 
 typedef struct {
@@ -22,9 +42,20 @@
     vectorcallfunc vectorcall;
 } partialobject;
 
-static PyTypeObject partial_type;
-
 static void partial_setvectorcall(partialobject *pto);
+static struct PyModuleDef _functools_module;
+static PyObject *
+partial_call(partialobject *pto, PyObject *args, PyObject *kwargs);
+
+static inline _functools_state *
+get_functools_state_by_type(PyTypeObject *type)
+{
+    PyObject *module = _PyType_GetModuleByDef(type, &_functools_module);
+    if (module == NULL) {
+        return NULL;
+    }
+    return get_functools_state(module);
+}
 
 static PyObject *
 partial_new(PyTypeObject *type, PyObject *args, PyObject *kw)
@@ -40,7 +71,11 @@
 
     pargs = pkw = NULL;
     func = PyTuple_GET_ITEM(args, 0);
-    if (Py_IS_TYPE(func, &partial_type) && type == &partial_type) {
+    if (Py_TYPE(func)->tp_call == (ternaryfunc)partial_call) {
+        // The type of "func" might not be exactly the same type object
+        // as "type", but if it is called using partial_call, it must have the
+        // same memory layout (fn, args and kw members).
+        // We can use its underlying function directly and merge the arguments.
         partialobject *part = (partialobject *)func;
         if (part->dict == NULL) {
             pargs = part->args;
@@ -112,18 +147,39 @@
     return (PyObject *)pto;
 }
 
+static int
+partial_clear(partialobject *pto)
+{
+    Py_CLEAR(pto->fn);
+    Py_CLEAR(pto->args);
+    Py_CLEAR(pto->kw);
+    Py_CLEAR(pto->dict);
+    return 0;
+}
+
+static int
+partial_traverse(partialobject *pto, visitproc visit, void *arg)
+{
+    Py_VISIT(Py_TYPE(pto));
+    Py_VISIT(pto->fn);
+    Py_VISIT(pto->args);
+    Py_VISIT(pto->kw);
+    Py_VISIT(pto->dict);
+    return 0;
+}
+
 static void
 partial_dealloc(partialobject *pto)
 {
+    PyTypeObject *tp = Py_TYPE(pto);
     /* bpo-31095: UnTrack is needed before calling any callbacks */
     PyObject_GC_UnTrack(pto);
-    if (pto->weakreflist != NULL)
+    if (pto->weakreflist != NULL) {
         PyObject_ClearWeakRefs((PyObject *) pto);
-    Py_XDECREF(pto->fn);
-    Py_XDECREF(pto->args);
-    Py_XDECREF(pto->kw);
-    Py_XDECREF(pto->dict);
-    Py_TYPE(pto)->tp_free(pto);
+    }
+    (void)partial_clear(pto);
+    tp->tp_free(pto);
+    Py_DECREF(tp);
 }
 
 
@@ -270,16 +326,6 @@
     return res;
 }
 
-static int
-partial_traverse(partialobject *pto, visitproc visit, void *arg)
-{
-    Py_VISIT(pto->fn);
-    Py_VISIT(pto->args);
-    Py_VISIT(pto->kw);
-    Py_VISIT(pto->dict);
-    return 0;
-}
-
 PyDoc_STRVAR(partial_doc,
 "partial(func, *args, **keywords) - new function with partial application\n\
     of the given arguments and keywords.\n");
@@ -292,6 +338,12 @@
      "tuple of arguments to future partial calls"},
     {"keywords",        T_OBJECT,       OFF(kw),        READONLY,
      "dictionary of keyword arguments to future partial calls"},
+    {"__weaklistoffset__", T_PYSSIZET,
+     offsetof(partialobject, weakreflist), READONLY},
+    {"__dictoffset__", T_PYSSIZET,
+     offsetof(partialobject, dict), READONLY},
+    {"__vectorcalloffset__", T_PYSSIZET,
+     offsetof(partialobject, vectorcall), READONLY},
     {NULL}  /* Sentinel */
 };
 
@@ -418,49 +470,30 @@
     {NULL,              NULL}           /* sentinel */
 };
 
-static PyTypeObject partial_type = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "functools.partial",                /* tp_name */
-    sizeof(partialobject),              /* tp_basicsize */
-    0,                                  /* tp_itemsize */
-    /* methods */
-    (destructor)partial_dealloc,        /* tp_dealloc */
-    offsetof(partialobject, vectorcall),/* tp_vectorcall_offset */
-    0,                                  /* tp_getattr */
-    0,                                  /* tp_setattr */
-    0,                                  /* tp_as_async */
-    (reprfunc)partial_repr,             /* tp_repr */
-    0,                                  /* tp_as_number */
-    0,                                  /* tp_as_sequence */
-    0,                                  /* tp_as_mapping */
-    0,                                  /* tp_hash */
-    (ternaryfunc)partial_call,          /* tp_call */
-    0,                                  /* tp_str */
-    PyObject_GenericGetAttr,            /* tp_getattro */
-    PyObject_GenericSetAttr,            /* tp_setattro */
-    0,                                  /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
-        Py_TPFLAGS_BASETYPE |
-        Py_TPFLAGS_HAVE_VECTORCALL,     /* tp_flags */
-    partial_doc,                        /* tp_doc */
-    (traverseproc)partial_traverse,     /* tp_traverse */
-    0,                                  /* tp_clear */
-    0,                                  /* tp_richcompare */
-    offsetof(partialobject, weakreflist),       /* tp_weaklistoffset */
-    0,                                  /* tp_iter */
-    0,                                  /* tp_iternext */
-    partial_methods,                    /* tp_methods */
-    partial_memberlist,                 /* tp_members */
-    partial_getsetlist,                 /* tp_getset */
-    0,                                  /* tp_base */
-    0,                                  /* tp_dict */
-    0,                                  /* tp_descr_get */
-    0,                                  /* tp_descr_set */
-    offsetof(partialobject, dict),      /* tp_dictoffset */
-    0,                                  /* tp_init */
-    0,                                  /* tp_alloc */
-    partial_new,                        /* tp_new */
-    PyObject_GC_Del,                    /* tp_free */
+static PyType_Slot partial_type_slots[] = {
+    {Py_tp_dealloc, partial_dealloc},
+    {Py_tp_repr, partial_repr},
+    {Py_tp_call, partial_call},
+    {Py_tp_getattro, PyObject_GenericGetAttr},
+    {Py_tp_setattro, PyObject_GenericSetAttr},
+    {Py_tp_doc, (void *)partial_doc},
+    {Py_tp_traverse, partial_traverse},
+    {Py_tp_clear, partial_clear},
+    {Py_tp_methods, partial_methods},
+    {Py_tp_members, partial_memberlist},
+    {Py_tp_getset, partial_getsetlist},
+    {Py_tp_new, partial_new},
+    {Py_tp_free, PyObject_GC_Del},
+    {0, 0}
+};
+
+static PyType_Spec partial_type_spec = {
+    .name = "functools.partial",
+    .basicsize = sizeof(partialobject),
+    .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
+             Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_VECTORCALL |
+             Py_TPFLAGS_IMMUTABLETYPE,
+    .slots = partial_type_slots
 };
 
 
@@ -472,29 +505,30 @@
     PyObject *object;
 } keyobject;
 
+static int
+keyobject_clear(keyobject *ko)
+{
+    Py_CLEAR(ko->cmp);
+    Py_CLEAR(ko->object);
+    return 0;
+}
+
 static void
 keyobject_dealloc(keyobject *ko)
 {
-    Py_DECREF(ko->cmp);
-    Py_XDECREF(ko->object);
-    PyObject_FREE(ko);
+    PyTypeObject *tp = Py_TYPE(ko);
+    PyObject_GC_UnTrack(ko);
+    (void)keyobject_clear(ko);
+    tp->tp_free(ko);
+    Py_DECREF(tp);
 }
 
 static int
 keyobject_traverse(keyobject *ko, visitproc visit, void *arg)
 {
+    Py_VISIT(Py_TYPE(ko));
     Py_VISIT(ko->cmp);
-    if (ko->object)
-        Py_VISIT(ko->object);
-    return 0;
-}
-
-static int
-keyobject_clear(keyobject *ko)
-{
-    Py_CLEAR(ko->cmp);
-    if (ko->object)
-        Py_CLEAR(ko->object);
+    Py_VISIT(ko->object);
     return 0;
 }
 
@@ -511,38 +545,23 @@
 static PyObject *
 keyobject_richcompare(PyObject *ko, PyObject *other, int op);
 
-static PyTypeObject keyobject_type = {
-    PyVarObject_HEAD_INIT(&PyType_Type, 0)
-    "functools.KeyWrapper",             /* tp_name */
-    sizeof(keyobject),                  /* tp_basicsize */
-    0,                                  /* tp_itemsize */
-    /* methods */
-    (destructor)keyobject_dealloc,      /* tp_dealloc */
-    0,                                  /* tp_vectorcall_offset */
-    0,                                  /* tp_getattr */
-    0,                                  /* tp_setattr */
-    0,                                  /* tp_as_async */
-    0,                                  /* tp_repr */
-    0,                                  /* tp_as_number */
-    0,                                  /* tp_as_sequence */
-    0,                                  /* tp_as_mapping */
-    0,                                  /* tp_hash */
-    (ternaryfunc)keyobject_call,        /* tp_call */
-    0,                                  /* tp_str */
-    PyObject_GenericGetAttr,            /* tp_getattro */
-    0,                                  /* tp_setattro */
-    0,                                  /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT,                 /* tp_flags */
-    0,                                  /* tp_doc */
-    (traverseproc)keyobject_traverse,   /* tp_traverse */
-    (inquiry)keyobject_clear,           /* tp_clear */
-    keyobject_richcompare,              /* tp_richcompare */
-    0,                                  /* tp_weaklistoffset */
-    0,                                  /* tp_iter */
-    0,                                  /* tp_iternext */
-    0,                                  /* tp_methods */
-    keyobject_members,                  /* tp_members */
-    0,                                  /* tp_getset */
+static PyType_Slot keyobject_type_slots[] = {
+    {Py_tp_dealloc, keyobject_dealloc},
+    {Py_tp_call, keyobject_call},
+    {Py_tp_getattro, PyObject_GenericGetAttr},
+    {Py_tp_traverse, keyobject_traverse},
+    {Py_tp_clear, keyobject_clear},
+    {Py_tp_richcompare, keyobject_richcompare},
+    {Py_tp_members, keyobject_members},
+    {0, 0}
+};
+
+static PyType_Spec keyobject_type_spec = {
+    .name = "functools.KeyWrapper",
+    .basicsize = sizeof(keyobject),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION |
+              Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = keyobject_type_slots
 };
 
 static PyObject *
@@ -554,13 +573,16 @@
 
     if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:K", kwargs, &object))
         return NULL;
-    result = PyObject_New(keyobject, &keyobject_type);
-    if (!result)
+
+    result = PyObject_GC_New(keyobject, Py_TYPE(ko));
+    if (result == NULL) {
         return NULL;
+    }
     Py_INCREF(ko->cmp);
     result->cmp = ko->cmp;
     Py_INCREF(object);
     result->object = object;
+    PyObject_GC_Track(result);
     return (PyObject *)result;
 }
 
@@ -574,7 +596,7 @@
     PyObject *answer;
     PyObject* stack[2];
 
-    if (!Py_IS_TYPE(other, &keyobject_type)) {
+    if (!Py_IS_TYPE(other, Py_TYPE(ko))) {
         PyErr_Format(PyExc_TypeError, "other argument must be K instance");
         return NULL;
     }
@@ -597,7 +619,7 @@
         return NULL;
     }
 
-    answer = PyObject_RichCompare(res, _PyLong_Zero, op);
+    answer = PyObject_RichCompare(res, _PyLong_GetZero(), op);
     Py_DECREF(res);
     return answer;
 }
@@ -608,15 +630,19 @@
     PyObject *cmp;
     static char *kwargs[] = {"mycmp", NULL};
     keyobject *object;
+    _functools_state *state;
 
     if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:cmp_to_key", kwargs, &cmp))
         return NULL;
-    object = PyObject_New(keyobject, &keyobject_type);
+
+    state = get_functools_state(self);
+    object = PyObject_GC_New(keyobject, state->keyobject_type);
     if (!object)
         return NULL;
     Py_INCREF(cmp);
     object->cmp = cmp;
     object->object = NULL;
+    PyObject_GC_Track(object);
     return (PyObject *)object;
 }
 
@@ -673,6 +699,11 @@
             if ((result = PyObject_Call(func, args, NULL)) == NULL) {
                 goto Fail;
             }
+            // bpo-42536: The GC may have untracked this args tuple. Since we're
+            // recycling it, make sure it's tracked again:
+            if (!_PyObject_GC_IS_TRACKED(args)) {
+                _PyObject_GC_TRACK(args);
+            }
         }
     }
 
@@ -680,7 +711,7 @@
 
     if (result == NULL)
         PyErr_SetString(PyExc_TypeError,
-                   "reduce() of empty sequence with no initial value");
+                   "reduce() of empty iterable with no initial value");
 
     Py_DECREF(it);
     return result;
@@ -693,14 +724,14 @@
 }
 
 PyDoc_STRVAR(functools_reduce_doc,
-"reduce(function, sequence[, initial]) -> value\n\
+"reduce(function, iterable[, initial]) -> value\n\
 \n\
-Apply a function of two arguments cumulatively to the items of a sequence,\n\
-from left to right, so as to reduce the sequence to a single value.\n\
-For example, reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]) calculates\n\
+Apply a function of two arguments cumulatively to the items of a sequence\n\
+or iterable, from left to right, so as to reduce the iterable to a single\n\
+value.  For example, reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]) calculates\n\
 ((((1+2)+3)+4)+5).  If initial is present, it is placed before the items\n\
-of the sequence in the calculation, and serves as a default when the\n\
-sequence is empty.");
+of the iterable in the calculation, and serves as a default when the\n\
+iterable is empty.");
 
 /* lru_cache object **********************************************************/
 
@@ -723,10 +754,6 @@
 
 */
 
-
-/* this object is used delimit args and keywords in the cache keys */
-static PyObject *kwd_mark = NULL;
-
 struct lru_list_elem;
 struct lru_cache_object;
 
@@ -740,33 +767,24 @@
 static void
 lru_list_elem_dealloc(lru_list_elem *link)
 {
+    PyTypeObject *tp = Py_TYPE(link);
     Py_XDECREF(link->key);
     Py_XDECREF(link->result);
-    PyObject_Del(link);
+    tp->tp_free(link);
+    Py_DECREF(tp);
 }
 
-static PyTypeObject lru_list_elem_type = {
-    PyVarObject_HEAD_INIT(&PyType_Type, 0)
-    "functools._lru_list_elem",         /* tp_name */
-    sizeof(lru_list_elem),              /* tp_basicsize */
-    0,                                  /* tp_itemsize */
-    /* methods */
-    (destructor)lru_list_elem_dealloc,  /* tp_dealloc */
-    0,                                  /* tp_vectorcall_offset */
-    0,                                  /* tp_getattr */
-    0,                                  /* tp_setattr */
-    0,                                  /* tp_as_async */
-    0,                                  /* tp_repr */
-    0,                                  /* tp_as_number */
-    0,                                  /* tp_as_sequence */
-    0,                                  /* tp_as_mapping */
-    0,                                  /* tp_hash */
-    0,                                  /* tp_call */
-    0,                                  /* tp_str */
-    0,                                  /* tp_getattro */
-    0,                                  /* tp_setattro */
-    0,                                  /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT,                 /* tp_flags */
+static PyType_Slot lru_list_elem_type_slots[] = {
+    {Py_tp_dealloc, lru_list_elem_dealloc},
+    {0, 0}
+};
+
+static PyType_Spec lru_list_elem_type_spec = {
+    .name = "functools._lru_list_elem",
+    .basicsize = sizeof(lru_list_elem),
+    .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION |
+             Py_TPFLAGS_IMMUTABLETYPE,
+    .slots = lru_list_elem_type_slots
 };
 
 
@@ -781,15 +799,17 @@
     PyObject *func;
     Py_ssize_t maxsize;
     Py_ssize_t misses;
+    /* the kwd_mark is used delimit args and keywords in the cache keys */
+    PyObject *kwd_mark;
+    PyTypeObject *lru_list_elem_type;
     PyObject *cache_info_type;
     PyObject *dict;
     PyObject *weakreflist;
 } lru_cache_object;
 
-static PyTypeObject lru_cache_type;
-
 static PyObject *
-lru_cache_make_key(PyObject *args, PyObject *kwds, int typed)
+lru_cache_make_key(PyObject *kwd_mark, PyObject *args,
+                   PyObject *kwds, int typed)
 {
     PyObject *key, *keyword, *value;
     Py_ssize_t key_size, pos, key_pos, kwds_size;
@@ -873,7 +893,7 @@
 {
     PyObject *result;
     Py_hash_t hash;
-    PyObject *key = lru_cache_make_key(args, kwds, self->typed);
+    PyObject *key = lru_cache_make_key(self->kwd_mark, args, kwds, self->typed);
     if (!key)
         return NULL;
     hash = PyObject_Hash(key);
@@ -974,7 +994,7 @@
     PyObject *key, *result, *testresult;
     Py_hash_t hash;
 
-    key = lru_cache_make_key(args, kwds, self->typed);
+    key = lru_cache_make_key(self->kwd_mark, args, kwds, self->typed);
     if (!key)
         return NULL;
     hash = PyObject_Hash(key);
@@ -1029,7 +1049,7 @@
     {
         /* Cache is not full, so put the result in a new link */
         link = (lru_list_elem *)PyObject_New(lru_list_elem,
-                                             &lru_list_elem_type);
+                                             self->lru_list_elem_type);
         if (link == NULL) {
             Py_DECREF(key);
             Py_DECREF(result);
@@ -1140,6 +1160,7 @@
     lru_cache_object *obj;
     Py_ssize_t maxsize;
     PyObject *(*wrapper)(lru_cache_object *, PyObject *, PyObject *);
+    _functools_state *state;
     static char *keywords[] = {"user_function", "maxsize", "typed",
                                "cache_info_type", NULL};
 
@@ -1155,6 +1176,11 @@
         return NULL;
     }
 
+    state = get_functools_state_by_type(type);
+    if (state == NULL) {
+        return NULL;
+    }
+
     /* select the caching function, and make/inc maxsize_O */
     if (maxsize_O == Py_None) {
         wrapper = infinite_lru_cache_wrapper;
@@ -1194,6 +1220,10 @@
     obj->func = func;
     obj->misses = obj->hits = 0;
     obj->maxsize = maxsize;
+    Py_INCREF(state->kwd_mark);
+    obj->kwd_mark = state->kwd_mark;
+    Py_INCREF(state->lru_list_elem_type);
+    obj->lru_list_elem_type = state->lru_list_elem_type;
     Py_INCREF(cache_info_type);
     obj->cache_info_type = cache_info_type;
     obj->dict = NULL;
@@ -1223,22 +1253,33 @@
     }
 }
 
+static int
+lru_cache_tp_clear(lru_cache_object *self)
+{
+    lru_list_elem *list = lru_cache_unlink_list(self);
+    Py_CLEAR(self->cache);
+    Py_CLEAR(self->func);
+    Py_CLEAR(self->kwd_mark);
+    Py_CLEAR(self->lru_list_elem_type);
+    Py_CLEAR(self->cache_info_type);
+    Py_CLEAR(self->dict);
+    lru_cache_clear_list(list);
+    return 0;
+}
+
 static void
 lru_cache_dealloc(lru_cache_object *obj)
 {
-    lru_list_elem *list;
+    PyTypeObject *tp = Py_TYPE(obj);
     /* bpo-31095: UnTrack is needed before calling any callbacks */
     PyObject_GC_UnTrack(obj);
-    if (obj->weakreflist != NULL)
+    if (obj->weakreflist != NULL) {
         PyObject_ClearWeakRefs((PyObject*)obj);
+    }
 
-    list = lru_cache_unlink_list(obj);
-    Py_XDECREF(obj->cache);
-    Py_XDECREF(obj->func);
-    Py_XDECREF(obj->cache_info_type);
-    Py_XDECREF(obj->dict);
-    lru_cache_clear_list(list);
-    Py_TYPE(obj)->tp_free(obj);
+    (void)lru_cache_tp_clear(obj);
+    tp->tp_free(obj);
+    Py_DECREF(tp);
 }
 
 static PyObject *
@@ -1303,32 +1344,24 @@
 static int
 lru_cache_tp_traverse(lru_cache_object *self, visitproc visit, void *arg)
 {
+    Py_VISIT(Py_TYPE(self));
     lru_list_elem *link = self->root.next;
     while (link != &self->root) {
         lru_list_elem *next = link->next;
         Py_VISIT(link->key);
         Py_VISIT(link->result);
+        Py_VISIT(Py_TYPE(link));
         link = next;
     }
-    Py_VISIT(self->func);
     Py_VISIT(self->cache);
+    Py_VISIT(self->func);
+    Py_VISIT(self->kwd_mark);
+    Py_VISIT(self->lru_list_elem_type);
     Py_VISIT(self->cache_info_type);
     Py_VISIT(self->dict);
     return 0;
 }
 
-static int
-lru_cache_tp_clear(lru_cache_object *self)
-{
-    lru_list_elem *list = lru_cache_unlink_list(self);
-    Py_CLEAR(self->func);
-    Py_CLEAR(self->cache);
-    Py_CLEAR(self->cache_info_type);
-    Py_CLEAR(self->dict);
-    lru_cache_clear_list(list);
-    return 0;
-}
-
 
 PyDoc_STRVAR(lru_cache_doc,
 "Create a cached callable that wraps another function.\n\
@@ -1360,51 +1393,37 @@
     {NULL}
 };
 
-static PyTypeObject lru_cache_type = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "functools._lru_cache_wrapper",     /* tp_name */
-    sizeof(lru_cache_object),           /* tp_basicsize */
-    0,                                  /* tp_itemsize */
-    /* methods */
-    (destructor)lru_cache_dealloc,      /* tp_dealloc */
-    0,                                  /* tp_vectorcall_offset */
-    0,                                  /* tp_getattr */
-    0,                                  /* tp_setattr */
-    0,                                  /* tp_as_async */
-    0,                                  /* tp_repr */
-    0,                                  /* tp_as_number */
-    0,                                  /* tp_as_sequence */
-    0,                                  /* tp_as_mapping */
-    0,                                  /* tp_hash */
-    (ternaryfunc)lru_cache_call,        /* tp_call */
-    0,                                  /* tp_str */
-    0,                                  /* tp_getattro */
-    0,                                  /* tp_setattro */
-    0,                                  /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
-    Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_METHOD_DESCRIPTOR,
-                                        /* tp_flags */
-    lru_cache_doc,                      /* tp_doc */
-    (traverseproc)lru_cache_tp_traverse,/* tp_traverse */
-    (inquiry)lru_cache_tp_clear,        /* tp_clear */
-    0,                                  /* tp_richcompare */
-    offsetof(lru_cache_object, weakreflist),
-                                        /* tp_weaklistoffset */
-    0,                                  /* tp_iter */
-    0,                                  /* tp_iternext */
-    lru_cache_methods,                  /* tp_methods */
-    0,                                  /* tp_members */
-    lru_cache_getsetlist,               /* tp_getset */
-    0,                                  /* tp_base */
-    0,                                  /* tp_dict */
-    lru_cache_descr_get,                /* tp_descr_get */
-    0,                                  /* tp_descr_set */
-    offsetof(lru_cache_object, dict),   /* tp_dictoffset */
-    0,                                  /* tp_init */
-    0,                                  /* tp_alloc */
-    lru_cache_new,                      /* tp_new */
+static PyMemberDef lru_cache_memberlist[] = {
+    {"__dictoffset__", T_PYSSIZET,
+     offsetof(lru_cache_object, dict), READONLY},
+    {"__weaklistoffset__", T_PYSSIZET,
+     offsetof(lru_cache_object, weakreflist), READONLY},
+    {NULL}  /* Sentinel */
 };
 
+static PyType_Slot lru_cache_type_slots[] = {
+    {Py_tp_dealloc, lru_cache_dealloc},
+    {Py_tp_call, lru_cache_call},
+    {Py_tp_doc, (void *)lru_cache_doc},
+    {Py_tp_traverse, lru_cache_tp_traverse},
+    {Py_tp_clear, lru_cache_tp_clear},
+    {Py_tp_methods, lru_cache_methods},
+    {Py_tp_members, lru_cache_memberlist},
+    {Py_tp_getset, lru_cache_getsetlist},
+    {Py_tp_descr_get, lru_cache_descr_get},
+    {Py_tp_new, lru_cache_new},
+    {0, 0}
+};
+
+static PyType_Spec lru_cache_type_spec = {
+    .name = "functools._lru_cache_wrapper",
+    .basicsize = sizeof(lru_cache_object),
+    .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
+             Py_TPFLAGS_METHOD_DESCRIPTOR | Py_TPFLAGS_IMMUTABLETYPE,
+    .slots = lru_cache_type_slots
+};
+
+
 /* module level code ********************************************************/
 
 PyDoc_STRVAR(_functools_doc,
@@ -1417,38 +1436,83 @@
     {NULL,              NULL}           /* sentinel */
 };
 
-static void
-_functools_free(void *m)
-{
-    // FIXME: Do not clear kwd_mark to avoid NULL pointer dereferencing if we have
-    //        other modules instances that could use it. Will fix when PEP-573 land
-    //        and we could move kwd_mark to a per-module state.
-    // Py_CLEAR(kwd_mark);
-}
-
 static int
 _functools_exec(PyObject *module)
 {
-    PyTypeObject *typelist[] = {
-        &partial_type,
-        &lru_cache_type
-    };
-
-    if (!kwd_mark) {
-        kwd_mark = _PyObject_CallNoArg((PyObject *)&PyBaseObject_Type);
-        if (!kwd_mark) {
-            return -1;
-        }
+    _functools_state *state = get_functools_state(module);
+    state->kwd_mark = _PyObject_CallNoArg((PyObject *)&PyBaseObject_Type);
+    if (state->kwd_mark == NULL) {
+        return -1;
     }
 
-    for (size_t i = 0; i < Py_ARRAY_LENGTH(typelist); i++) {
-        if (PyModule_AddType(module, typelist[i]) < 0) {
-            return -1;
-        }
+    state->partial_type = (PyTypeObject *)PyType_FromModuleAndSpec(module,
+        &partial_type_spec, NULL);
+    if (state->partial_type == NULL) {
+        return -1;
     }
+    if (PyModule_AddType(module, state->partial_type) < 0) {
+        return -1;
+    }
+
+    PyObject *lru_cache_type = PyType_FromModuleAndSpec(module,
+        &lru_cache_type_spec, NULL);
+    if (lru_cache_type == NULL) {
+        return -1;
+    }
+    if (PyModule_AddType(module, (PyTypeObject *)lru_cache_type) < 0) {
+        Py_DECREF(lru_cache_type);
+        return -1;
+    }
+    Py_DECREF(lru_cache_type);
+
+    state->keyobject_type = (PyTypeObject *)PyType_FromModuleAndSpec(module,
+        &keyobject_type_spec, NULL);
+    if (state->keyobject_type == NULL) {
+        return -1;
+    }
+    if (PyModule_AddType(module, state->keyobject_type) < 0) {
+        return -1;
+    }
+
+    state->lru_list_elem_type = (PyTypeObject *)PyType_FromModuleAndSpec(
+        module, &lru_list_elem_type_spec, NULL);
+    if (state->lru_list_elem_type == NULL) {
+        return -1;
+    }
+    // lru_list_elem is used only in _lru_cache_wrapper.
+    // So we don't expose it in module namespace.
+
     return 0;
 }
 
+static int
+_functools_traverse(PyObject *module, visitproc visit, void *arg)
+{
+    _functools_state *state = get_functools_state(module);
+    Py_VISIT(state->kwd_mark);
+    Py_VISIT(state->partial_type);
+    Py_VISIT(state->keyobject_type);
+    Py_VISIT(state->lru_list_elem_type);
+    return 0;
+}
+
+static int
+_functools_clear(PyObject *module)
+{
+    _functools_state *state = get_functools_state(module);
+    Py_CLEAR(state->kwd_mark);
+    Py_CLEAR(state->partial_type);
+    Py_CLEAR(state->keyobject_type);
+    Py_CLEAR(state->lru_list_elem_type);
+    return 0;
+}
+
+static void
+_functools_free(void *module)
+{
+    _functools_clear((PyObject *)module);
+}
+
 static struct PyModuleDef_Slot _functools_slots[] = {
     {Py_mod_exec, _functools_exec},
     {0, NULL}
@@ -1456,14 +1520,14 @@
 
 static struct PyModuleDef _functools_module = {
     PyModuleDef_HEAD_INIT,
-    "_functools",
-    _functools_doc,
-    0,
-    _functools_methods,
-    _functools_slots,
-    NULL,
-    NULL,
-    _functools_free,
+    .m_name = "_functools",
+    .m_doc = _functools_doc,
+    .m_size = sizeof(_functools_state),
+    .m_methods = _functools_methods,
+    .m_slots = _functools_slots,
+    .m_traverse = _functools_traverse,
+    .m_clear = _functools_clear,
+    .m_free = _functools_free,
 };
 
 PyMODINIT_FUNC
diff --git a/Modules/_gdbmmodule.c b/Modules/_gdbmmodule.c
index dd4c6b1..a7fb6a3 100644
--- a/Modules/_gdbmmodule.c
+++ b/Modules/_gdbmmodule.c
@@ -1,5 +1,5 @@
 
-/* DBM module using dictionary interface */
+/* GDBM module using dictionary interface */
 /* Author: Anthony Baxter, after dbmmodule.c */
 /* Doc strings: Mitch Chapman */
 
@@ -16,11 +16,24 @@
 extern const char * gdbm_strerror(gdbm_error);
 #endif
 
+typedef struct {
+    PyTypeObject *gdbm_type;
+    PyObject *gdbm_error;
+} _gdbm_state;
+
+static inline _gdbm_state*
+get_gdbm_state(PyObject *module)
+{
+    void *state = PyModule_GetState(module);
+    assert(state != NULL);
+    return (_gdbm_state *)state;
+}
+
 /*[clinic input]
 module _gdbm
-class _gdbm.gdbm "dbmobject *" "&Dbmtype"
+class _gdbm.gdbm "gdbmobject *" "&Gdbmtype"
 [clinic start generated code]*/
-/*[clinic end generated code: output=da39a3ee5e6b4b0d input=113927c6170729b2]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=38ae71cedfc7172b]*/
 
 PyDoc_STRVAR(gdbmmodule__doc__,
 "This module provides an interface to the GNU DBM (GDBM) library.\n\
@@ -38,20 +51,15 @@
     PyObject_HEAD
     Py_ssize_t di_size;        /* -1 means recompute */
     GDBM_FILE di_dbm;
-} dbmobject;
-
-static PyTypeObject Dbmtype;
+} gdbmobject;
 
 #include "clinic/_gdbmmodule.c.h"
 
-#define is_dbmobject(v) Py_IS_TYPE(v, &Dbmtype)
-#define check_dbmobject_open(v) if ((v)->di_dbm == NULL) \
-    { PyErr_SetString(DbmError, "GDBM object has already been closed"); \
-      return NULL; }
-
-
-
-static PyObject *DbmError;
+#define check_gdbmobject_open(v, err)                                 \
+    if ((v)->di_dbm == NULL) {                                       \
+        PyErr_SetString(err, "GDBM object has already been closed"); \
+        return NULL;                                                 \
+    }
 
 PyDoc_STRVAR(gdbm_object__doc__,
 "This object represents a GDBM database.\n\
@@ -64,20 +72,23 @@
 nextkey, reorganize, and sync.");
 
 static PyObject *
-newdbmobject(const char *file, int flags, int mode)
+newgdbmobject(_gdbm_state *state, const char *file, int flags, int mode)
 {
-    dbmobject *dp;
-
-    dp = PyObject_New(dbmobject, &Dbmtype);
-    if (dp == NULL)
+    gdbmobject *dp = PyObject_GC_New(gdbmobject, state->gdbm_type);
+    if (dp == NULL) {
         return NULL;
+    }
     dp->di_size = -1;
     errno = 0;
+    PyObject_GC_Track(dp);
+
     if ((dp->di_dbm = gdbm_open((char *)file, 0, flags, mode, NULL)) == 0) {
-        if (errno != 0)
-            PyErr_SetFromErrnoWithFilename(DbmError, file);
-        else
-            PyErr_SetString(DbmError, gdbm_strerror(gdbm_errno));
+        if (errno != 0) {
+            PyErr_SetFromErrnoWithFilename(state->gdbm_error, file);
+        }
+        else {
+            PyErr_SetString(state->gdbm_error, gdbm_strerror(gdbm_errno));
+        }
         Py_DECREF(dp);
         return NULL;
     }
@@ -85,20 +96,31 @@
 }
 
 /* Methods */
+static int
+gdbm_traverse(gdbmobject *dp, visitproc visit, void *arg)
+{
+    Py_VISIT(Py_TYPE(dp));
+    return 0;
+}
 
 static void
-dbm_dealloc(dbmobject *dp)
+gdbm_dealloc(gdbmobject *dp)
 {
-    if (dp->di_dbm)
+    PyObject_GC_UnTrack(dp);
+    if (dp->di_dbm) {
         gdbm_close(dp->di_dbm);
-    PyObject_Del(dp);
+    }
+    PyTypeObject *tp = Py_TYPE(dp);
+    tp->tp_free(dp);
+    Py_DECREF(tp);
 }
 
 static Py_ssize_t
-dbm_length(dbmobject *dp)
+gdbm_length(gdbmobject *dp)
 {
+    _gdbm_state *state = PyType_GetModuleState(Py_TYPE(dp));
     if (dp->di_dbm == NULL) {
-        PyErr_SetString(DbmError, "GDBM object has already been closed");
+        PyErr_SetString(state->gdbm_error, "GDBM object has already been closed");
         return -1;
     }
     if (dp->di_size < 0) {
@@ -107,10 +129,10 @@
         gdbm_count_t count;
         if (gdbm_count(dp->di_dbm, &count) == -1) {
             if (errno != 0) {
-                PyErr_SetFromErrno(DbmError);
+                PyErr_SetFromErrno(state->gdbm_error);
             }
             else {
-                PyErr_SetString(DbmError, gdbm_strerror(gdbm_errno));
+                PyErr_SetString(state->gdbm_error, gdbm_strerror(gdbm_errno));
             }
             return -1;
         }
@@ -161,16 +183,17 @@
 }
 
 static PyObject *
-dbm_subscript(dbmobject *dp, PyObject *key)
+gdbm_subscript(gdbmobject *dp, PyObject *key)
 {
     PyObject *v;
     datum drec, krec;
+    _gdbm_state *state = PyType_GetModuleState(Py_TYPE(dp));
 
     if (!parse_datum(key, &krec, NULL)) {
         return NULL;
     }
     if (dp->di_dbm == NULL) {
-        PyErr_SetString(DbmError,
+        PyErr_SetString(state->gdbm_error,
                         "GDBM object has already been closed");
         return NULL;
     }
@@ -195,12 +218,12 @@
 [clinic start generated code]*/
 
 static PyObject *
-_gdbm_gdbm_get_impl(dbmobject *self, PyObject *key, PyObject *default_value)
-/*[clinic end generated code: output=19b7c585ad4f554a input=a9c20423f34c17b6]*/
+_gdbm_gdbm_get_impl(gdbmobject *self, PyObject *key, PyObject *default_value)
+/*[clinic end generated code: output=92421838f3a852f4 input=a9c20423f34c17b6]*/
 {
     PyObject *res;
 
-    res = dbm_subscript(self, key);
+    res = gdbm_subscript(self, key);
     if (res == NULL && PyErr_ExceptionMatches(PyExc_KeyError)) {
         PyErr_Clear();
         Py_INCREF(default_value);
@@ -210,16 +233,17 @@
 }
 
 static int
-dbm_ass_sub(dbmobject *dp, PyObject *v, PyObject *w)
+gdbm_ass_sub(gdbmobject *dp, PyObject *v, PyObject *w)
 {
     datum krec, drec;
     const char *failmsg = "gdbm mappings have bytes or string indices only";
+    _gdbm_state *state = PyType_GetModuleState(Py_TYPE(dp));
 
     if (!parse_datum(v, &krec, failmsg)) {
         return -1;
     }
     if (dp->di_dbm == NULL) {
-        PyErr_SetString(DbmError,
+        PyErr_SetString(state->gdbm_error,
                         "GDBM object has already been closed");
         return -1;
     }
@@ -230,7 +254,7 @@
                 PyErr_SetObject(PyExc_KeyError, v);
             }
             else {
-                PyErr_SetString(DbmError, gdbm_strerror(gdbm_errno));
+                PyErr_SetString(state->gdbm_error, gdbm_strerror(gdbm_errno));
             }
             return -1;
         }
@@ -242,9 +266,9 @@
         errno = 0;
         if (gdbm_store(dp->di_dbm, krec, drec, GDBM_REPLACE) < 0) {
             if (errno != 0)
-                PyErr_SetFromErrno(DbmError);
+                PyErr_SetFromErrno(state->gdbm_error);
             else
-                PyErr_SetString(DbmError,
+                PyErr_SetString(state->gdbm_error,
                                 gdbm_strerror(gdbm_errno));
             return -1;
         }
@@ -263,28 +287,22 @@
 [clinic start generated code]*/
 
 static PyObject *
-_gdbm_gdbm_setdefault_impl(dbmobject *self, PyObject *key,
+_gdbm_gdbm_setdefault_impl(gdbmobject *self, PyObject *key,
                            PyObject *default_value)
-/*[clinic end generated code: output=88760ee520329012 input=0db46b69e9680171]*/
+/*[clinic end generated code: output=f3246e880509f142 input=0db46b69e9680171]*/
 {
     PyObject *res;
 
-    res = dbm_subscript(self, key);
+    res = gdbm_subscript(self, key);
     if (res == NULL && PyErr_ExceptionMatches(PyExc_KeyError)) {
         PyErr_Clear();
-        if (dbm_ass_sub(self, key, default_value) < 0)
+        if (gdbm_ass_sub(self, key, default_value) < 0)
             return NULL;
-        return dbm_subscript(self, key);
+        return gdbm_subscript(self, key);
     }
     return res;
 }
 
-static PyMappingMethods dbm_as_mapping = {
-    (lenfunc)dbm_length,                /*mp_length*/
-    (binaryfunc)dbm_subscript,          /*mp_subscript*/
-    (objobjargproc)dbm_ass_sub,         /*mp_ass_subscript*/
-};
-
 /*[clinic input]
 _gdbm.gdbm.close
 
@@ -292,11 +310,12 @@
 [clinic start generated code]*/
 
 static PyObject *
-_gdbm_gdbm_close_impl(dbmobject *self)
-/*[clinic end generated code: output=23512a594598b563 input=0a203447379b45fd]*/
+_gdbm_gdbm_close_impl(gdbmobject *self)
+/*[clinic end generated code: output=f5abb4d6bb9e52d5 input=0a203447379b45fd]*/
 {
-    if (self->di_dbm)
+    if (self->di_dbm) {
         gdbm_close(self->di_dbm);
+    }
     self->di_dbm = NULL;
     Py_RETURN_NONE;
 }
@@ -305,22 +324,27 @@
 /*[clinic input]
 _gdbm.gdbm.keys
 
+    cls: defining_class
+
 Get a list of all keys in the database.
 [clinic start generated code]*/
 
 static PyObject *
-_gdbm_gdbm_keys_impl(dbmobject *self)
-/*[clinic end generated code: output=cb4b1776c3645dcc input=1832ee0a3132cfaf]*/
+_gdbm_gdbm_keys_impl(gdbmobject *self, PyTypeObject *cls)
+/*[clinic end generated code: output=c24b824e81404755 input=1428b7c79703d7d5]*/
 {
     PyObject *v, *item;
     datum key, nextkey;
     int err;
 
-    if (self == NULL || !is_dbmobject(self)) {
+    _gdbm_state *state = PyType_GetModuleState(cls);
+    assert(state != NULL);
+
+    if (self == NULL || !Py_IS_TYPE(self, state->gdbm_type)) {
         PyErr_BadInternalCall();
         return NULL;
     }
-    check_dbmobject_open(self);
+    check_gdbmobject_open(self, state->gdbm_error);
 
     v = PyList_New(0);
     if (v == NULL)
@@ -349,14 +373,15 @@
 }
 
 static int
-dbm_contains(PyObject *self, PyObject *arg)
+gdbm_contains(PyObject *self, PyObject *arg)
 {
-    dbmobject *dp = (dbmobject *)self;
+    gdbmobject *dp = (gdbmobject *)self;
     datum key;
     Py_ssize_t size;
+    _gdbm_state *state = PyType_GetModuleState(Py_TYPE(dp));
 
     if ((dp)->di_dbm == NULL) {
-        PyErr_SetString(DbmError,
+        PyErr_SetString(state->gdbm_error,
                         "GDBM object has already been closed");
         return -1;
     }
@@ -379,22 +404,11 @@
     return gdbm_exists(dp->di_dbm, key);
 }
 
-static PySequenceMethods dbm_as_sequence = {
-        0,                      /* sq_length */
-        0,                      /* sq_concat */
-        0,                      /* sq_repeat */
-        0,                      /* sq_item */
-        0,                      /* sq_slice */
-        0,                      /* sq_ass_item */
-        0,                      /* sq_ass_slice */
-        dbm_contains,           /* sq_contains */
-        0,                      /* sq_inplace_concat */
-        0,                      /* sq_inplace_repeat */
-};
-
 /*[clinic input]
 _gdbm.gdbm.firstkey
 
+    cls: defining_class
+
 Return the starting key for the traversal.
 
 It's possible to loop over every key in the database using this method
@@ -403,13 +417,15 @@
 [clinic start generated code]*/
 
 static PyObject *
-_gdbm_gdbm_firstkey_impl(dbmobject *self)
-/*[clinic end generated code: output=9ff85628d84b65d2 input=0dbd6a335d69bba0]*/
+_gdbm_gdbm_firstkey_impl(gdbmobject *self, PyTypeObject *cls)
+/*[clinic end generated code: output=139275e9c8b60827 input=ed8782a029a5d299]*/
 {
     PyObject *v;
     datum key;
+    _gdbm_state *state = PyType_GetModuleState(cls);
+    assert(state != NULL);
 
-    check_dbmobject_open(self);
+    check_gdbmobject_open(self, state->gdbm_error);
     key = gdbm_firstkey(self->di_dbm);
     if (key.dptr) {
         v = PyBytes_FromStringAndSize(key.dptr, key.dsize);
@@ -424,6 +440,7 @@
 /*[clinic input]
 _gdbm.gdbm.nextkey
 
+    cls: defining_class
     key: str(accept={str, robuffer}, zeroes=True)
     /
 
@@ -433,22 +450,24 @@
 to create a list in memory that contains them all:
 
       k = db.firstkey()
-      while k != None:
+      while k is not None:
           print(k)
           k = db.nextkey(k)
 [clinic start generated code]*/
 
 static PyObject *
-_gdbm_gdbm_nextkey_impl(dbmobject *self, const char *key,
+_gdbm_gdbm_nextkey_impl(gdbmobject *self, PyTypeObject *cls, const char *key,
                         Py_ssize_clean_t key_length)
-/*[clinic end generated code: output=192ab892de6eb2f6 input=1f1606943614e36f]*/
+/*[clinic end generated code: output=204964441fdbaf02 input=365e297bc0b3db48]*/
 {
     PyObject *v;
     datum dbm_key, nextkey;
+    _gdbm_state *state = PyType_GetModuleState(cls);
+    assert(state != NULL);
 
     dbm_key.dptr = (char *)key;
     dbm_key.dsize = key_length;
-    check_dbmobject_open(self);
+    check_gdbmobject_open(self, state->gdbm_error);
     nextkey = gdbm_nextkey(self->di_dbm, dbm_key);
     if (nextkey.dptr) {
         v = PyBytes_FromStringAndSize(nextkey.dptr, nextkey.dsize);
@@ -463,6 +482,8 @@
 /*[clinic input]
 _gdbm.gdbm.reorganize
 
+    cls: defining_class
+
 Reorganize the database.
 
 If you have carried out a lot of deletions and would like to shrink
@@ -473,16 +494,18 @@
 [clinic start generated code]*/
 
 static PyObject *
-_gdbm_gdbm_reorganize_impl(dbmobject *self)
-/*[clinic end generated code: output=38d9624df92e961d input=f6bea85bcfd40dd2]*/
+_gdbm_gdbm_reorganize_impl(gdbmobject *self, PyTypeObject *cls)
+/*[clinic end generated code: output=d77c69e8e3dd644a input=e1359faeef844e46]*/
 {
-    check_dbmobject_open(self);
+    _gdbm_state *state = PyType_GetModuleState(cls);
+    assert(state != NULL);
+    check_gdbmobject_open(self, state->gdbm_error);
     errno = 0;
     if (gdbm_reorganize(self->di_dbm) < 0) {
         if (errno != 0)
-            PyErr_SetFromErrno(DbmError);
+            PyErr_SetFromErrno(state->gdbm_error);
         else
-            PyErr_SetString(DbmError, gdbm_strerror(gdbm_errno));
+            PyErr_SetString(state->gdbm_error, gdbm_strerror(gdbm_errno));
         return NULL;
     }
     Py_RETURN_NONE;
@@ -491,6 +514,8 @@
 /*[clinic input]
 _gdbm.gdbm.sync
 
+    cls: defining_class
+
 Flush the database to the disk file.
 
 When the database has been opened in fast mode, this method forces
@@ -498,29 +523,31 @@
 [clinic start generated code]*/
 
 static PyObject *
-_gdbm_gdbm_sync_impl(dbmobject *self)
-/*[clinic end generated code: output=488b15f47028f125 input=2a47d2c9e153ab8a]*/
+_gdbm_gdbm_sync_impl(gdbmobject *self, PyTypeObject *cls)
+/*[clinic end generated code: output=bb680a2035c3f592 input=3d749235f79b6f2a]*/
 {
-    check_dbmobject_open(self);
+    _gdbm_state *state = PyType_GetModuleState(cls);
+    assert(state != NULL);
+    check_gdbmobject_open(self, state->gdbm_error);
     gdbm_sync(self->di_dbm);
     Py_RETURN_NONE;
 }
 
 static PyObject *
-dbm__enter__(PyObject *self, PyObject *args)
+gdbm__enter__(PyObject *self, PyObject *args)
 {
     Py_INCREF(self);
     return self;
 }
 
 static PyObject *
-dbm__exit__(PyObject *self, PyObject *args)
+gdbm__exit__(PyObject *self, PyObject *args)
 {
     _Py_IDENTIFIER(close);
     return _PyObject_CallMethodIdNoArgs(self, &PyId_close);
 }
 
-static PyMethodDef dbm_methods[] = {
+static PyMethodDef gdbm_methods[] = {
     _GDBM_GDBM_CLOSE_METHODDEF
     _GDBM_GDBM_KEYS_METHODDEF
     _GDBM_GDBM_FIRSTKEY_METHODDEF
@@ -529,46 +556,40 @@
     _GDBM_GDBM_SYNC_METHODDEF
     _GDBM_GDBM_GET_METHODDEF
     _GDBM_GDBM_SETDEFAULT_METHODDEF
-    {"__enter__", dbm__enter__, METH_NOARGS, NULL},
-    {"__exit__",  dbm__exit__, METH_VARARGS, NULL},
+    {"__enter__", gdbm__enter__, METH_NOARGS, NULL},
+    {"__exit__",  gdbm__exit__, METH_VARARGS, NULL},
     {NULL,              NULL}           /* sentinel */
 };
 
-static PyTypeObject Dbmtype = {
-    PyVarObject_HEAD_INIT(0, 0)
-    "_gdbm.gdbm",
-    sizeof(dbmobject),
-    0,
-    (destructor)dbm_dealloc,            /*tp_dealloc*/
-    0,                                  /*tp_vectorcall_offset*/
-    0,                                  /*tp_getattr*/
-    0,                                  /*tp_setattr*/
-    0,                                  /*tp_as_async*/
-    0,                                  /*tp_repr*/
-    0,                                  /*tp_as_number*/
-    &dbm_as_sequence,                   /*tp_as_sequence*/
-    &dbm_as_mapping,                    /*tp_as_mapping*/
-    0,                                  /*tp_hash*/
-    0,                                  /*tp_call*/
-    0,                                  /*tp_str*/
-    0,                                  /*tp_getattro*/
-    0,                                  /*tp_setattro*/
-    0,                                  /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT,                 /*tp_xxx4*/
-    gdbm_object__doc__,                 /*tp_doc*/
-    0,                                  /*tp_traverse*/
-    0,                                  /*tp_clear*/
-    0,                                  /*tp_richcompare*/
-    0,                                  /*tp_weaklistoffset*/
-    0,                                  /*tp_iter*/
-    0,                                  /*tp_iternext*/
-    dbm_methods,                        /*tp_methods*/
+static PyType_Slot gdbmtype_spec_slots[] = {
+    {Py_tp_dealloc, gdbm_dealloc},
+    {Py_tp_traverse, gdbm_traverse},
+    {Py_tp_methods, gdbm_methods},
+    {Py_sq_contains, gdbm_contains},
+    {Py_mp_length, gdbm_length},
+    {Py_mp_subscript, gdbm_subscript},
+    {Py_mp_ass_subscript, gdbm_ass_sub},
+    {Py_tp_doc, (char*)gdbm_object__doc__},
+    {0, 0}
+};
+
+static PyType_Spec gdbmtype_spec = {
+    .name = "_gdbm.gdbm",
+    .basicsize = sizeof(gdbmobject),
+    // Calling PyType_GetModuleState() on a subclass is not safe.
+    // dbmtype_spec does not have Py_TPFLAGS_BASETYPE flag
+    // which prevents to create a subclass.
+    // So calling PyType_GetModuleState() in this file is always safe.
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION |
+              Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = gdbmtype_spec_slots,
 };
 
 /* ----------------------------------------------------------------- */
 
 /*[clinic input]
 _gdbm.open as dbmopen
+
     filename: unicode
     flags: str="r"
     mode: int(py_default="0o666") = 0o666
@@ -601,9 +622,11 @@
 static PyObject *
 dbmopen_impl(PyObject *module, PyObject *filename, const char *flags,
              int mode)
-/*[clinic end generated code: output=9527750f5df90764 input=3be0b0875974b928]*/
+/*[clinic end generated code: output=9527750f5df90764 input=812b7d74399ceb0e]*/
 {
     int iflags;
+    _gdbm_state *state = get_gdbm_state(module);
+    assert(state != NULL);
 
     switch (flags[0]) {
     case 'r':
@@ -619,7 +642,7 @@
         iflags = GDBM_NEWDB;
         break;
     default:
-        PyErr_SetString(DbmError,
+        PyErr_SetString(state->gdbm_error,
                         "First flag must be one of 'r', 'w', 'c' or 'n'");
         return NULL;
     }
@@ -644,7 +667,7 @@
             default:
                 PyOS_snprintf(buf, sizeof(buf), "Flag '%c' is not supported.",
                               *flags);
-                PyErr_SetString(DbmError, buf);
+                PyErr_SetString(state->gdbm_error, buf);
                 return NULL;
         }
     }
@@ -659,12 +682,12 @@
         PyErr_SetString(PyExc_ValueError, "embedded null character");
         return NULL;
     }
-    PyObject *self = newdbmobject(name, iflags, mode);
+    PyObject *self = newgdbmobject(state, name, iflags, mode);
     Py_DECREF(filenamebytes);
     return self;
 }
 
-static const char dbmmodule_open_flags[] = "rwcn"
+static const char gdbmmodule_open_flags[] = "rwcn"
 #ifdef GDBM_FAST
                                      "f"
 #endif
@@ -676,48 +699,30 @@
 #endif
                                      ;
 
-static PyMethodDef dbmmodule_methods[] = {
+static PyMethodDef _gdbm_module_methods[] = {
     DBMOPEN_METHODDEF
     { 0, 0 },
 };
 
-
-static struct PyModuleDef _gdbmmodule = {
-        PyModuleDef_HEAD_INIT,
-        "_gdbm",
-        gdbmmodule__doc__,
-        -1,
-        dbmmodule_methods,
-        NULL,
-        NULL,
-        NULL,
-        NULL
-};
-
-PyMODINIT_FUNC
-PyInit__gdbm(void) {
-    PyObject *m;
-
-    if (PyType_Ready(&Dbmtype) < 0)
-            return NULL;
-    m = PyModule_Create(&_gdbmmodule);
-    if (m == NULL) {
-        return NULL;
+static int
+_gdbm_exec(PyObject *module)
+{
+    _gdbm_state *state = get_gdbm_state(module);
+    state->gdbm_type = (PyTypeObject *)PyType_FromModuleAndSpec(module,
+                                                        &gdbmtype_spec, NULL);
+    if (state->gdbm_type == NULL) {
+        return -1;
     }
-
-    DbmError = PyErr_NewException("_gdbm.error", PyExc_OSError, NULL);
-    if (DbmError == NULL) {
-        goto error;
+    state->gdbm_error = PyErr_NewException("_gdbm.error", PyExc_OSError, NULL);
+    if (state->gdbm_error == NULL) {
+        return -1;
     }
-    Py_INCREF(DbmError);
-    if (PyModule_AddObject(m, "error", DbmError) < 0) {
-        Py_DECREF(DbmError);
-        goto error;
+    if (PyModule_AddType(module, (PyTypeObject *)state->gdbm_error) < 0) {
+        return -1;
     }
-
-    if (PyModule_AddStringConstant(m, "open_flags",
-                                   dbmmodule_open_flags) < 0) {
-        goto error;
+    if (PyModule_AddStringConstant(module, "open_flags",
+                                   gdbmmodule_open_flags) < 0) {
+        return -1;
     }
 
 #if defined(GDBM_VERSION_MAJOR) && defined(GDBM_VERSION_MINOR) && \
@@ -725,17 +730,59 @@
     PyObject *obj = Py_BuildValue("iii", GDBM_VERSION_MAJOR,
                                   GDBM_VERSION_MINOR, GDBM_VERSION_PATCH);
     if (obj == NULL) {
-        goto error;
+        return -1;
     }
-    if (PyModule_AddObject(m, "_GDBM_VERSION", obj) < 0) {
+    if (PyModule_AddObject(module, "_GDBM_VERSION", obj) < 0) {
         Py_DECREF(obj);
-        goto error;
+        return -1;
     }
 #endif
+    return 0;
+}
 
-    return m;
+static int
+_gdbm_module_traverse(PyObject *module, visitproc visit, void *arg)
+{
+    _gdbm_state *state = get_gdbm_state(module);
+    Py_VISIT(state->gdbm_error);
+    Py_VISIT(state->gdbm_type);
+    return 0;
+}
 
-error:
-    Py_DECREF(m);
-    return NULL;
+static int
+_gdbm_module_clear(PyObject *module)
+{
+    _gdbm_state *state = get_gdbm_state(module);
+    Py_CLEAR(state->gdbm_error);
+    Py_CLEAR(state->gdbm_type);
+    return 0;
+}
+
+static void
+_gdbm_module_free(void *module)
+{
+    _gdbm_module_clear((PyObject *)module);
+}
+
+static PyModuleDef_Slot _gdbm_module_slots[] = {
+    {Py_mod_exec, _gdbm_exec},
+    {0, NULL}
+};
+
+static struct PyModuleDef _gdbmmodule = {
+    PyModuleDef_HEAD_INIT,
+    .m_name = "_gdbm",
+    .m_doc = gdbmmodule__doc__,
+    .m_size = sizeof(_gdbm_state),
+    .m_methods = _gdbm_module_methods,
+    .m_slots = _gdbm_module_slots,
+    .m_traverse = _gdbm_module_traverse,
+    .m_clear = _gdbm_module_clear,
+    .m_free = _gdbm_module_free,
+};
+
+PyMODINIT_FUNC
+PyInit__gdbm(void)
+{
+    return PyModuleDef_Init(&_gdbmmodule);
 }
diff --git a/Modules/_hashopenssl.c b/Modules/_hashopenssl.c
index adc8653..65538f6 100644
--- a/Modules/_hashopenssl.c
+++ b/Modules/_hashopenssl.c
@@ -11,20 +11,31 @@
  *
  */
 
+/* Don't warn about deprecated functions, */
+#ifndef OPENSSL_API_COMPAT
+  // 0x10101000L == 1.1.1, 30000 == 3.0.0
+  #define OPENSSL_API_COMPAT 0x10101000L
+#endif
+#define OPENSSL_NO_DEPRECATED 1
+
+#ifndef Py_BUILD_CORE_BUILTIN
+#  define Py_BUILD_CORE_MODULE 1
+#endif
+
 #define PY_SSIZE_T_CLEAN
 
 #include "Python.h"
+#include "pycore_hashtable.h"
 #include "hashlib.h"
 #include "pystrhex.h"
 
-
 /* EVP is the preferred interface to hashing in OpenSSL */
 #include <openssl/evp.h>
 #include <openssl/hmac.h>
 #include <openssl/crypto.h>
 /* We use the object interface to discover what hashes OpenSSL supports. */
 #include <openssl/objects.h>
-#include "openssl/err.h"
+#include <openssl/err.h>
 
 #include <openssl/crypto.h>       // FIPS_mode()
 
@@ -32,52 +43,167 @@
 #  error "OPENSSL_THREADS is not defined, Python requires thread-safe OpenSSL"
 #endif
 
-#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER)
-/* OpenSSL < 1.1.0 */
-#define EVP_MD_CTX_new EVP_MD_CTX_create
-#define EVP_MD_CTX_free EVP_MD_CTX_destroy
-
-HMAC_CTX *
-HMAC_CTX_new(void)
-{
-    HMAC_CTX *ctx = OPENSSL_malloc(sizeof(HMAC_CTX));
-    if (ctx != NULL) {
-        memset(ctx, 0, sizeof(HMAC_CTX));
-        HMAC_CTX_init(ctx);
-    }
-    return ctx;
-}
-
-void
-HMAC_CTX_free(HMAC_CTX *ctx)
-{
-    if (ctx != NULL) {
-        HMAC_CTX_cleanup(ctx);
-        OPENSSL_free(ctx);
-    }
-}
-
-const EVP_MD *
-HMAC_CTX_get_md(const HMAC_CTX *ctx)
-{
-    return ctx->md;
-}
-#endif
-
 #define MUNCH_SIZE INT_MAX
 
-#ifdef NID_sha3_224
+#define PY_OPENSSL_HAS_SCRYPT 1
 #define PY_OPENSSL_HAS_SHA3 1
-#endif
-
-#if defined(EVP_MD_FLAG_XOF) && defined(NID_shake128)
 #define PY_OPENSSL_HAS_SHAKE 1
-#endif
-
-#if defined(NID_blake2b512) && !defined(OPENSSL_NO_BLAKE2)
 #define PY_OPENSSL_HAS_BLAKE2 1
+
+#if OPENSSL_VERSION_NUMBER >= 0x30000000L
+#define PY_EVP_MD EVP_MD
+#define PY_EVP_MD_fetch(algorithm, properties) EVP_MD_fetch(NULL, algorithm, properties)
+#define PY_EVP_MD_up_ref(md) EVP_MD_up_ref(md)
+#define PY_EVP_MD_free(md) EVP_MD_free(md)
+#else
+#define PY_EVP_MD const EVP_MD
+#define PY_EVP_MD_fetch(algorithm, properties) EVP_get_digestbyname(algorithm)
+#define PY_EVP_MD_up_ref(md) do {} while(0)
+#define PY_EVP_MD_free(md) do {} while(0)
 #endif
 
+/* hash alias map and fast lookup
+ *
+ * Map between Python's preferred names and OpenSSL internal names. Maintain
+ * cache of fetched EVP MD objects. The EVP_get_digestbyname() and
+ * EVP_MD_fetch() API calls have a performance impact.
+ *
+ * The py_hashentry_t items are stored in a _Py_hashtable_t with py_name and
+ * py_alias as keys.
+ */
+
+enum Py_hash_type {
+    Py_ht_evp,            // usedforsecurity=True / default
+    Py_ht_evp_nosecurity, // usedforsecurity=False
+    Py_ht_mac,            // HMAC
+    Py_ht_pbkdf2,         // PKBDF2
+};
+
+typedef struct {
+    const char *py_name;
+    const char *py_alias;
+    const char *ossl_name;
+    int ossl_nid;
+    int refcnt;
+    PY_EVP_MD *evp;
+    PY_EVP_MD *evp_nosecurity;
+} py_hashentry_t;
+
+#define Py_hash_md5 "md5"
+#define Py_hash_sha1 "sha1"
+#define Py_hash_sha224 "sha224"
+#define Py_hash_sha256 "sha256"
+#define Py_hash_sha384 "sha384"
+#define Py_hash_sha512 "sha512"
+#define Py_hash_sha512_224 "sha512_224"
+#define Py_hash_sha512_256 "sha512_256"
+#define Py_hash_sha3_224 "sha3_224"
+#define Py_hash_sha3_256 "sha3_256"
+#define Py_hash_sha3_384 "sha3_384"
+#define Py_hash_sha3_512 "sha3_512"
+#define Py_hash_shake_128 "shake_128"
+#define Py_hash_shake_256 "shake_256"
+#define Py_hash_blake2s "blake2s"
+#define Py_hash_blake2b "blake2b"
+
+#define PY_HASH_ENTRY(py_name, py_alias, ossl_name, ossl_nid) \
+    {py_name, py_alias, ossl_name, ossl_nid, 0, NULL, NULL}
+
+static const py_hashentry_t py_hashes[] = {
+    /* md5 */
+    PY_HASH_ENTRY(Py_hash_md5, "MD5", SN_md5, NID_md5),
+    /* sha1 */
+    PY_HASH_ENTRY(Py_hash_sha1, "SHA1", SN_sha1, NID_sha1),
+    /* sha2 family */
+    PY_HASH_ENTRY(Py_hash_sha224, "SHA224", SN_sha224, NID_sha224),
+    PY_HASH_ENTRY(Py_hash_sha256, "SHA256", SN_sha256, NID_sha256),
+    PY_HASH_ENTRY(Py_hash_sha384, "SHA384", SN_sha384, NID_sha384),
+    PY_HASH_ENTRY(Py_hash_sha512, "SHA512", SN_sha512, NID_sha512),
+    /* truncated sha2 */
+    PY_HASH_ENTRY(Py_hash_sha512_224, "SHA512_224", SN_sha512_224, NID_sha512_224),
+    PY_HASH_ENTRY(Py_hash_sha512_256, "SHA512_256", SN_sha512_256, NID_sha512_256),
+    /* sha3 */
+    PY_HASH_ENTRY(Py_hash_sha3_224, NULL, SN_sha3_224, NID_sha3_224),
+    PY_HASH_ENTRY(Py_hash_sha3_256, NULL, SN_sha3_256, NID_sha3_256),
+    PY_HASH_ENTRY(Py_hash_sha3_384, NULL, SN_sha3_384, NID_sha3_384),
+    PY_HASH_ENTRY(Py_hash_sha3_512, NULL, SN_sha3_512, NID_sha3_512),
+    /* sha3 shake */
+    PY_HASH_ENTRY(Py_hash_shake_128, NULL, SN_shake128, NID_shake128),
+    PY_HASH_ENTRY(Py_hash_shake_256, NULL, SN_shake256, NID_shake256),
+    /* blake2 digest */
+    PY_HASH_ENTRY(Py_hash_blake2s, "blake2s256", SN_blake2s256, NID_blake2s256),
+    PY_HASH_ENTRY(Py_hash_blake2b, "blake2b512", SN_blake2b512, NID_blake2b512),
+    PY_HASH_ENTRY(NULL, NULL, NULL, 0),
+};
+
+static Py_uhash_t
+py_hashentry_t_hash_name(const void *key) {
+    return _Py_HashBytes(key, strlen((const char *)key));
+}
+
+static int
+py_hashentry_t_compare_name(const void *key1, const void *key2) {
+    return strcmp((const char *)key1, (const char *)key2) == 0;
+}
+
+static void
+py_hashentry_t_destroy_value(void *entry) {
+    py_hashentry_t *h = (py_hashentry_t *)entry;
+    if (--(h->refcnt) == 0) {
+        if (h->evp != NULL) {
+            PY_EVP_MD_free(h->evp);
+            h->evp = NULL;
+        }
+        if (h->evp_nosecurity != NULL) {
+            PY_EVP_MD_free(h->evp_nosecurity);
+            h->evp_nosecurity = NULL;
+        }
+        PyMem_Free(entry);
+    }
+}
+
+static _Py_hashtable_t *
+py_hashentry_table_new(void) {
+    _Py_hashtable_t *ht = _Py_hashtable_new_full(
+        py_hashentry_t_hash_name,
+        py_hashentry_t_compare_name,
+        NULL,
+        py_hashentry_t_destroy_value,
+        NULL
+    );
+    if (ht == NULL) {
+        return NULL;
+    }
+
+    for (const py_hashentry_t *h = py_hashes; h->py_name != NULL; h++) {
+        py_hashentry_t *entry = (py_hashentry_t *)PyMem_Malloc(sizeof(py_hashentry_t));
+        if (entry == NULL) {
+            goto error;
+        }
+        memcpy(entry, h, sizeof(py_hashentry_t));
+
+        if (_Py_hashtable_set(ht, (const void*)entry->py_name, (void*)entry) < 0) {
+            PyMem_Free(entry);
+            goto error;
+        }
+        entry->refcnt = 1;
+
+        if (h->py_alias != NULL) {
+            if (_Py_hashtable_set(ht, (const void*)entry->py_alias, (void*)entry) < 0) {
+                PyMem_Free(entry);
+                goto error;
+            }
+            entry->refcnt++;
+        }
+    }
+
+    return ht;
+  error:
+    _Py_hashtable_destroy(ht);
+    return NULL;
+}
+
+/* Module state */
 static PyModuleDef _hashlibmodule;
 
 typedef struct {
@@ -86,6 +212,9 @@
 #ifdef PY_OPENSSL_HAS_SHAKE
     PyTypeObject *EVPXOFtype;
 #endif
+    PyObject *constructs;
+    PyObject *unsupported_digestmod_error;
+    _Py_hashtable_t *hashtable;
 } _hashlibstate;
 
 static inline _hashlibstate*
@@ -120,16 +249,27 @@
 
 /* LCOV_EXCL_START */
 static PyObject *
-_setException(PyObject *exc)
+_setException(PyObject *exc, const char* altmsg, ...)
 {
-    unsigned long errcode;
+    unsigned long errcode = ERR_peek_last_error();
     const char *lib, *func, *reason;
+    va_list vargs;
 
-    errcode = ERR_peek_last_error();
+#ifdef HAVE_STDARG_PROTOTYPES
+    va_start(vargs, altmsg);
+#else
+    va_start(vargs);
+#endif
     if (!errcode) {
-        PyErr_SetString(exc, "unknown reasons");
+        if (altmsg == NULL) {
+            PyErr_SetString(exc, "no reason supplied");
+        } else {
+            PyErr_FormatV(exc, altmsg, vargs);
+        }
+        va_end(vargs);
         return NULL;
     }
+    va_end(vargs);
     ERR_clear_error();
 
     lib = ERR_lib_error_string(errcode);
@@ -149,82 +289,20 @@
 }
 /* LCOV_EXCL_STOP */
 
-/* {Py_tp_new, NULL} doesn't block __new__ */
-static PyObject *
-_disabled_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
-{
-    PyErr_Format(PyExc_TypeError,
-        "cannot create '%.100s' instances", _PyType_Name(type));
-    return NULL;
-}
-
 static PyObject*
 py_digest_name(const EVP_MD *md)
 {
     int nid = EVP_MD_nid(md);
     const char *name = NULL;
+    const py_hashentry_t *h;
 
-    /* Hard-coded names for well-known hashing algorithms.
-     * OpenSSL uses slightly different names algorithms like SHA3.
-     */
-    switch (nid) {
-    case NID_md5:
-        name = "md5";
-        break;
-    case NID_sha1:
-        name = "sha1";
-        break;
-    case NID_sha224:
-        name ="sha224";
-        break;
-    case NID_sha256:
-        name ="sha256";
-        break;
-    case NID_sha384:
-        name ="sha384";
-        break;
-    case NID_sha512:
-        name ="sha512";
-        break;
-#ifdef NID_sha512_224
-    case NID_sha512_224:
-        name ="sha512_224";
-        break;
-    case NID_sha512_256:
-        name ="sha512_256";
-        break;
-#endif
-#ifdef PY_OPENSSL_HAS_SHA3
-    case NID_sha3_224:
-        name ="sha3_224";
-        break;
-    case NID_sha3_256:
-        name ="sha3_256";
-        break;
-    case NID_sha3_384:
-        name ="sha3_384";
-        break;
-    case NID_sha3_512:
-        name ="sha3_512";
-        break;
-#endif
-#ifdef PY_OPENSSL_HAS_SHAKE
-    case NID_shake128:
-        name ="shake_128";
-        break;
-    case NID_shake256:
-        name ="shake_256";
-        break;
-#endif
-#ifdef PY_OPENSSL_HAS_BLAKE2
-    case NID_blake2s256:
-        name ="blake2s";
-        break;
-    case NID_blake2b512:
-        name ="blake2b";
-        break;
-#endif
-    default:
+    for (h = py_hashes; h->py_name != NULL; h++) {
+        if (h->ossl_nid == nid) {
+            name = h->py_name;
+            break;
+        }
+    }
+    if (name == NULL) {
         /* Ignore aliased names and only use long, lowercase name. The aliases
          * pollute the list and OpenSSL appears to have its own definition of
          * alias as the resulting list still contains duplicate and alternate
@@ -233,63 +311,101 @@
         name = OBJ_nid2ln(nid);
         if (name == NULL)
             name = OBJ_nid2sn(nid);
-        break;
     }
 
     return PyUnicode_FromString(name);
 }
 
-static const EVP_MD*
-py_digest_by_name(const char *name)
+/* Get EVP_MD by HID and purpose */
+static PY_EVP_MD*
+py_digest_by_name(PyObject *module, const char *name, enum Py_hash_type py_ht)
 {
-    const EVP_MD *digest = EVP_get_digestbyname(name);
+    PY_EVP_MD *digest = NULL;
+    _hashlibstate *state = get_hashlib_state(module);
+    py_hashentry_t *entry = (py_hashentry_t *)_Py_hashtable_get(
+        state->hashtable, (const void*)name
+    );
 
-    /* OpenSSL uses dash instead of underscore in names of some algorithms
-     * like SHA3 and SHAKE. Detect different spellings. */
+    if (entry != NULL) {
+        switch (py_ht) {
+        case Py_ht_evp:
+        case Py_ht_mac:
+        case Py_ht_pbkdf2:
+            if (entry->evp == NULL) {
+                entry->evp = PY_EVP_MD_fetch(entry->ossl_name, NULL);
+            }
+            digest = entry->evp;
+            break;
+        case Py_ht_evp_nosecurity:
+            if (entry->evp_nosecurity == NULL) {
+                entry->evp_nosecurity = PY_EVP_MD_fetch(entry->ossl_name, "-fips");
+            }
+            digest = entry->evp_nosecurity;
+            break;
+        }
+        if (digest != NULL) {
+            PY_EVP_MD_up_ref(digest);
+        }
+    } else {
+        // Fall back for looking up an unindexed OpenSSL specific name.
+        switch (py_ht) {
+        case Py_ht_evp:
+        case Py_ht_mac:
+        case Py_ht_pbkdf2:
+            digest = PY_EVP_MD_fetch(name, NULL);
+            break;
+        case Py_ht_evp_nosecurity:
+            digest = PY_EVP_MD_fetch(name, "-fips");
+            break;
+        }
+    }
     if (digest == NULL) {
-        if (0) {}
-#ifdef NID_sha512_224
-        else if (!strcmp(name, "sha512_224") || !strcmp(name, "SHA512_224")) {
-            digest = EVP_sha512_224();
-        }
-        else if (!strcmp(name, "sha512_256") || !strcmp(name, "SHA512_256")) {
-            digest = EVP_sha512_256();
-        }
-#endif
-#ifdef PY_OPENSSL_HAS_SHA3
-        /* could be sha3_ or shake_, Python never defined upper case */
-        else if (!strcmp(name, "sha3_224")) {
-            digest = EVP_sha3_224();
-        }
-        else if (!strcmp(name, "sha3_256")) {
-            digest = EVP_sha3_256();
-        }
-        else if (!strcmp(name, "sha3_384")) {
-            digest = EVP_sha3_384();
-        }
-        else if (!strcmp(name, "sha3_512")) {
-            digest = EVP_sha3_512();
-        }
-#endif
-#ifdef PY_OPENSSL_HAS_SHAKE
-        else if (!strcmp(name, "shake_128")) {
-            digest = EVP_shake128();
-        }
-        else if (!strcmp(name, "shake_256")) {
-            digest = EVP_shake256();
-        }
-#endif
-#ifdef PY_OPENSSL_HAS_BLAKE2
-        else if (!strcmp(name, "blake2s256")) {
-            digest = EVP_blake2s256();
-        }
-        else if (!strcmp(name, "blake2b512")) {
-            digest = EVP_blake2b512();
-        }
-#endif
+        _setException(PyExc_ValueError, "unsupported hash type %s", name);
+        return NULL;
+    }
+    return digest;
+}
+
+/* Get digest EVP from object
+ *
+ * * string
+ * * _hashopenssl builtin function
+ *
+ * on error returns NULL with exception set.
+ */
+static PY_EVP_MD*
+py_digest_by_digestmod(PyObject *module, PyObject *digestmod, enum Py_hash_type py_ht) {
+    PY_EVP_MD* evp;
+    PyObject *name_obj = NULL;
+    const char *name;
+
+    if (PyUnicode_Check(digestmod)) {
+        name_obj = digestmod;
+    } else {
+        _hashlibstate *state = get_hashlib_state(module);
+        // borrowed ref
+        name_obj = PyDict_GetItem(state->constructs, digestmod);
+    }
+    if (name_obj == NULL) {
+        _hashlibstate *state = get_hashlib_state(module);
+        PyErr_Clear();
+        PyErr_Format(
+            state->unsupported_digestmod_error,
+            "Unsupported digestmod %R", digestmod);
+        return NULL;
     }
 
-    return digest;
+    name = PyUnicode_AsUTF8(name_obj);
+    if (name == NULL) {
+        return NULL;
+    }
+
+    evp = py_digest_by_name(module, name, py_ht);
+    if (evp == NULL) {
+        return NULL;
+    }
+
+    return evp;
 }
 
 static EVPobject *
@@ -323,7 +439,7 @@
         else
             process = Py_SAFE_DOWNCAST(len, Py_ssize_t, unsigned int);
         if (!EVP_DigestUpdate(self->ctx, (const void*)cp, process)) {
-            _setException(PyExc_ValueError);
+            _setException(PyExc_ValueError, NULL);
             return -1;
         }
         len -= process;
@@ -341,7 +457,7 @@
     if (self->lock != NULL)
         PyThread_free_lock(self->lock);
     EVP_MD_CTX_free(self->ctx);
-    PyObject_Del(self);
+    PyObject_Free(self);
     Py_DECREF(tp);
 }
 
@@ -374,7 +490,7 @@
 
     if (!locked_EVP_MD_CTX_copy(newobj->ctx, self)) {
         Py_DECREF(newobj);
-        return _setException(PyExc_ValueError);
+        return _setException(PyExc_ValueError, NULL);
     }
     return (PyObject *)newobj;
 }
@@ -401,11 +517,11 @@
     }
 
     if (!locked_EVP_MD_CTX_copy(temp_ctx, self)) {
-        return _setException(PyExc_ValueError);
+        return _setException(PyExc_ValueError, NULL);
     }
     digest_size = EVP_MD_CTX_size(temp_ctx);
     if (!EVP_DigestFinal(temp_ctx, digest, NULL)) {
-        _setException(PyExc_ValueError);
+        _setException(PyExc_ValueError, NULL);
         return NULL;
     }
 
@@ -436,11 +552,11 @@
 
     /* Get the raw (binary) digest value */
     if (!locked_EVP_MD_CTX_copy(temp_ctx, self)) {
-        return _setException(PyExc_ValueError);
+        return _setException(PyExc_ValueError, NULL);
     }
     digest_size = EVP_MD_CTX_size(temp_ctx);
     if (!EVP_DigestFinal(temp_ctx, digest, NULL)) {
-        _setException(PyExc_ValueError);
+        _setException(PyExc_ValueError, NULL);
         return NULL;
     }
 
@@ -574,7 +690,6 @@
     {Py_tp_doc, (char *)hashtype_doc},
     {Py_tp_methods, EVP_methods},
     {Py_tp_getset, EVP_getseters},
-    {Py_tp_new, _disabled_new},
     {0, 0},
 };
 
@@ -582,7 +697,7 @@
     "_hashlib.HASH",    /*tp_name*/
     sizeof(EVPobject),  /*tp_basicsize*/
     0,                  /*tp_itemsize*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION | Py_TPFLAGS_IMMUTABLETYPE,
     EVPtype_slots
 };
 
@@ -617,14 +732,14 @@
     if (!locked_EVP_MD_CTX_copy(temp_ctx, self)) {
         Py_DECREF(retval);
         EVP_MD_CTX_free(temp_ctx);
-        return _setException(PyExc_ValueError);
+        return _setException(PyExc_ValueError, NULL);
     }
     if (!EVP_DigestFinalXOF(temp_ctx,
                             (unsigned char*)PyBytes_AS_STRING(retval),
                             length)) {
         Py_DECREF(retval);
         EVP_MD_CTX_free(temp_ctx);
-        _setException(PyExc_ValueError);
+        _setException(PyExc_ValueError, NULL);
         return NULL;
     }
 
@@ -665,12 +780,12 @@
     if (!locked_EVP_MD_CTX_copy(temp_ctx, self)) {
         PyMem_Free(digest);
         EVP_MD_CTX_free(temp_ctx);
-        return _setException(PyExc_ValueError);
+        return _setException(PyExc_ValueError, NULL);
     }
     if (!EVP_DigestFinalXOF(temp_ctx, digest, length)) {
         PyMem_Free(digest);
         EVP_MD_CTX_free(temp_ctx);
-        _setException(PyExc_ValueError);
+        _setException(PyExc_ValueError, NULL);
         return NULL;
     }
 
@@ -724,7 +839,6 @@
     {Py_tp_doc, (char *)hashxoftype_doc},
     {Py_tp_methods, EVPXOF_methods},
     {Py_tp_getset, EVPXOF_getseters},
-    {Py_tp_new, _disabled_new},
     {0, 0},
 };
 
@@ -732,62 +846,81 @@
     "_hashlib.HASHXOF",    /*tp_name*/
     sizeof(EVPobject),  /*tp_basicsize*/
     0,                  /*tp_itemsize*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION | Py_TPFLAGS_IMMUTABLETYPE,
     EVPXOFtype_slots
 };
 
 
 #endif
 
-static PyObject *
-EVPnew(PyObject *module, const EVP_MD *digest,
-       const unsigned char *cp, Py_ssize_t len, int usedforsecurity)
+static PyObject*
+py_evp_fromname(PyObject *module, const char *digestname, PyObject *data_obj,
+                int usedforsecurity)
 {
-    int result = 0;
-    EVPobject *self;
-    PyTypeObject *type = get_hashlib_state(module)->EVPtype;
+    Py_buffer view = { 0 };
+    PY_EVP_MD *digest = NULL;
+    PyTypeObject *type;
+    EVPobject *self = NULL;
 
-    if (!digest) {
-        PyErr_SetString(PyExc_ValueError, "unsupported hash type");
-        return NULL;
+    if (data_obj != NULL) {
+        GET_BUFFER_VIEW_OR_ERROUT(data_obj, &view);
     }
 
-#ifdef PY_OPENSSL_HAS_SHAKE
+    digest = py_digest_by_name(
+        module, digestname, usedforsecurity ? Py_ht_evp : Py_ht_evp_nosecurity
+    );
+    if (digest == NULL) {
+        goto exit;
+    }
+
     if ((EVP_MD_flags(digest) & EVP_MD_FLAG_XOF) == EVP_MD_FLAG_XOF) {
         type = get_hashlib_state(module)->EVPXOFtype;
+    } else {
+        type = get_hashlib_state(module)->EVPtype;
     }
-#endif
 
-    if ((self = newEVPobject(type)) == NULL)
-        return NULL;
+    self = newEVPobject(type);
+    if (self == NULL) {
+        goto exit;
+    }
 
+#if defined(EVP_MD_CTX_FLAG_NON_FIPS_ALLOW) && OPENSSL_VERSION_NUMBER < 0x30000000L
+    // In OpenSSL 1.1.1 the non FIPS allowed flag is context specific while
+    // in 3.0.0 it is a different EVP_MD provider.
     if (!usedforsecurity) {
-#ifdef EVP_MD_CTX_FLAG_NON_FIPS_ALLOW
         EVP_MD_CTX_set_flags(self->ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
+    }
 #endif
+
+    int result = EVP_DigestInit_ex(self->ctx, digest, NULL);
+    if (!result) {
+        _setException(PyExc_ValueError, NULL);
+        Py_CLEAR(self);
+        goto exit;
     }
 
-
-    if (!EVP_DigestInit_ex(self->ctx, digest, NULL)) {
-        _setException(PyExc_ValueError);
-        Py_DECREF(self);
-        return NULL;
-    }
-
-    if (cp && len) {
-        if (len >= HASHLIB_GIL_MINSIZE) {
+    if (view.buf && view.len) {
+        if (view.len >= HASHLIB_GIL_MINSIZE) {
             Py_BEGIN_ALLOW_THREADS
-            result = EVP_hash(self, cp, len);
+            result = EVP_hash(self, view.buf, view.len);
             Py_END_ALLOW_THREADS
         } else {
-            result = EVP_hash(self, cp, len);
+            result = EVP_hash(self, view.buf, view.len);
         }
         if (result == -1) {
-            Py_DECREF(self);
-            return NULL;
+            Py_CLEAR(self);
+            goto exit;
         }
     }
 
+  exit:
+    if (data_obj != NULL) {
+        PyBuffer_Release(&view);
+    }
+    if (digest != NULL) {
+        PY_EVP_MD_free(digest);
+    }
+
     return (PyObject *)self;
 }
 
@@ -815,49 +948,14 @@
              int usedforsecurity)
 /*[clinic end generated code: output=ddd5053f92dffe90 input=c24554d0337be1b0]*/
 {
-    Py_buffer view = { 0 };
-    PyObject *ret_obj;
     char *name;
-    const EVP_MD *digest = NULL;
-
     if (!PyArg_Parse(name_obj, "s", &name)) {
         PyErr_SetString(PyExc_TypeError, "name must be a string");
         return NULL;
     }
-
-    if (data_obj)
-        GET_BUFFER_VIEW_OR_ERROUT(data_obj, &view);
-
-    digest = py_digest_by_name(name);
-
-    ret_obj = EVPnew(module, digest,
-                     (unsigned char*)view.buf, view.len,
-                     usedforsecurity);
-
-    if (data_obj)
-        PyBuffer_Release(&view);
-    return ret_obj;
+    return py_evp_fromname(module, name, data_obj, usedforsecurity);
 }
 
-static PyObject*
-EVP_fast_new(PyObject *module, PyObject *data_obj, const EVP_MD *digest,
-             int usedforsecurity)
-{
-    Py_buffer view = { 0 };
-    PyObject *ret_obj;
-
-    if (data_obj)
-        GET_BUFFER_VIEW_OR_ERROUT(data_obj, &view);
-
-    ret_obj = EVPnew(module, digest,
-                     (unsigned char*)view.buf, view.len,
-                     usedforsecurity);
-
-    if (data_obj)
-        PyBuffer_Release(&view);
-
-    return ret_obj;
-}
 
 /*[clinic input]
 _hashlib.openssl_md5
@@ -875,7 +973,7 @@
                           int usedforsecurity)
 /*[clinic end generated code: output=87b0186440a44f8c input=990e36d5e689b16e]*/
 {
-    return EVP_fast_new(module, data_obj, EVP_md5(), usedforsecurity);
+    return py_evp_fromname(module, Py_hash_md5, data_obj, usedforsecurity);
 }
 
 
@@ -895,7 +993,7 @@
                            int usedforsecurity)
 /*[clinic end generated code: output=6813024cf690670d input=948f2f4b6deabc10]*/
 {
-    return EVP_fast_new(module, data_obj, EVP_sha1(), usedforsecurity);
+    return py_evp_fromname(module, Py_hash_sha1, data_obj, usedforsecurity);
 }
 
 
@@ -915,7 +1013,7 @@
                              int usedforsecurity)
 /*[clinic end generated code: output=a2dfe7cc4eb14ebb input=f9272821fadca505]*/
 {
-    return EVP_fast_new(module, data_obj, EVP_sha224(), usedforsecurity);
+    return py_evp_fromname(module, Py_hash_sha224, data_obj, usedforsecurity);
 }
 
 
@@ -935,7 +1033,7 @@
                              int usedforsecurity)
 /*[clinic end generated code: output=1f874a34870f0a68 input=549fad9d2930d4c5]*/
 {
-    return EVP_fast_new(module, data_obj, EVP_sha256(), usedforsecurity);
+    return py_evp_fromname(module, Py_hash_sha256, data_obj, usedforsecurity);
 }
 
 
@@ -955,7 +1053,7 @@
                              int usedforsecurity)
 /*[clinic end generated code: output=58529eff9ca457b2 input=48601a6e3bf14ad7]*/
 {
-    return EVP_fast_new(module, data_obj, EVP_sha384(), usedforsecurity);
+    return py_evp_fromname(module, Py_hash_sha384, data_obj, usedforsecurity);
 }
 
 
@@ -975,7 +1073,7 @@
                              int usedforsecurity)
 /*[clinic end generated code: output=2c744c9e4a40d5f6 input=c5c46a2a817aa98f]*/
 {
-    return EVP_fast_new(module, data_obj, EVP_sha512(), usedforsecurity);
+    return py_evp_fromname(module, Py_hash_sha512, data_obj, usedforsecurity);
 }
 
 
@@ -997,7 +1095,7 @@
                                int usedforsecurity)
 /*[clinic end generated code: output=144641c1d144b974 input=e3a01b2888916157]*/
 {
-    return EVP_fast_new(module, data_obj, EVP_sha3_224(), usedforsecurity);
+    return py_evp_fromname(module, Py_hash_sha3_224, data_obj, usedforsecurity);
 }
 
 /*[clinic input]
@@ -1016,7 +1114,7 @@
                                int usedforsecurity)
 /*[clinic end generated code: output=c61f1ab772d06668 input=e2908126c1b6deed]*/
 {
-    return EVP_fast_new(module, data_obj, EVP_sha3_256(), usedforsecurity);
+    return py_evp_fromname(module, Py_hash_sha3_256, data_obj , usedforsecurity);
 }
 
 /*[clinic input]
@@ -1035,7 +1133,7 @@
                                int usedforsecurity)
 /*[clinic end generated code: output=f68e4846858cf0ee input=ec0edf5c792f8252]*/
 {
-    return EVP_fast_new(module, data_obj, EVP_sha3_384(), usedforsecurity);
+    return py_evp_fromname(module, Py_hash_sha3_384, data_obj , usedforsecurity);
 }
 
 /*[clinic input]
@@ -1054,7 +1152,7 @@
                                int usedforsecurity)
 /*[clinic end generated code: output=2eede478c159354a input=64e2cc0c094d56f4]*/
 {
-    return EVP_fast_new(module, data_obj, EVP_sha3_512(), usedforsecurity);
+    return py_evp_fromname(module, Py_hash_sha3_512, data_obj , usedforsecurity);
 }
 #endif /* PY_OPENSSL_HAS_SHA3 */
 
@@ -1075,7 +1173,7 @@
                                 int usedforsecurity)
 /*[clinic end generated code: output=bc49cdd8ada1fa97 input=6c9d67440eb33ec8]*/
 {
-    return EVP_fast_new(module, data_obj, EVP_shake128(), usedforsecurity);
+    return py_evp_fromname(module, Py_hash_shake_128, data_obj , usedforsecurity);
 }
 
 /*[clinic input]
@@ -1094,7 +1192,7 @@
                                 int usedforsecurity)
 /*[clinic end generated code: output=358d213be8852df7 input=479cbe9fefd4a9f8]*/
 {
-    return EVP_fast_new(module, data_obj, EVP_shake256(), usedforsecurity);
+    return py_evp_fromname(module, Py_hash_shake_256, data_obj , usedforsecurity);
 }
 #endif /* PY_OPENSSL_HAS_SHAKE */
 
@@ -1120,11 +1218,9 @@
     char *key;
     long dklen;
     int retval;
-    const EVP_MD *digest;
 
-    digest = py_digest_by_name(hash_name);
+    PY_EVP_MD *digest = py_digest_by_name(module, hash_name, Py_ht_pbkdf2);
     if (digest == NULL) {
-        PyErr_SetString(PyExc_ValueError, "unsupported hash type");
         goto end;
     }
 
@@ -1186,16 +1282,18 @@
 
     if (!retval) {
         Py_CLEAR(key_obj);
-        _setException(PyExc_ValueError);
+        _setException(PyExc_ValueError, NULL);
         goto end;
     }
 
   end:
+    if (digest != NULL) {
+        PY_EVP_MD_free(digest);
+    }
     return key_obj;
 }
 
-#if OPENSSL_VERSION_NUMBER > 0x10100000L && !defined(OPENSSL_NO_SCRYPT) && !defined(LIBRESSL_VERSION_NUMBER)
-#define PY_SCRYPT 1
+#ifdef PY_OPENSSL_HAS_SCRYPT
 
 /* XXX: Parameters salt, n, r and p should be required keyword-only parameters.
    They are optional in the Argument Clinic declaration only due to a
@@ -1290,9 +1388,7 @@
     /* let OpenSSL validate the rest */
     retval = EVP_PBE_scrypt(NULL, 0, NULL, 0, n, r, p, maxmem, NULL, 0);
     if (!retval) {
-        /* sorry, can't do much better */
-        PyErr_SetString(PyExc_ValueError,
-                        "Invalid parameter combination for n, r, p, maxmem.");
+        _setException(PyExc_ValueError, "Invalid parameter combination for n, r, p, maxmem.");
         return NULL;
    }
 
@@ -1313,12 +1409,12 @@
 
     if (!retval) {
         Py_CLEAR(key_obj);
-        _setException(PyExc_ValueError);
+        _setException(PyExc_ValueError, NULL);
         return NULL;
     }
     return key_obj;
 }
-#endif
+#endif  /* PY_OPENSSL_HAS_SCRYPT */
 
 /* Fast HMAC for hmac.digest()
  */
@@ -1328,26 +1424,21 @@
 
     key: Py_buffer
     msg: Py_buffer
-    digest: str
+    digest: object
 
 Single-shot HMAC.
 [clinic start generated code]*/
 
 static PyObject *
 _hashlib_hmac_singleshot_impl(PyObject *module, Py_buffer *key,
-                              Py_buffer *msg, const char *digest)
-/*[clinic end generated code: output=15658ede5ab98185 input=019dffc571909a46]*/
+                              Py_buffer *msg, PyObject *digest)
+/*[clinic end generated code: output=82f19965d12706ac input=0a0790cc3db45c2e]*/
 {
     unsigned char md[EVP_MAX_MD_SIZE] = {0};
     unsigned int md_len = 0;
     unsigned char *result;
-    const EVP_MD *evp;
+    PY_EVP_MD *evp;
 
-    evp = py_digest_by_name(digest);
-    if (evp == NULL) {
-        PyErr_SetString(PyExc_ValueError, "unsupported hash type");
-        return NULL;
-    }
     if (key->len > INT_MAX) {
         PyErr_SetString(PyExc_OverflowError,
                         "key is too long.");
@@ -1359,6 +1450,11 @@
         return NULL;
     }
 
+    evp = py_digest_by_digestmod(module, digest, Py_ht_mac);
+    if (evp == NULL) {
+        return NULL;
+    }
+
     Py_BEGIN_ALLOW_THREADS
     result = HMAC(
         evp,
@@ -1367,9 +1463,10 @@
         md, &md_len
     );
     Py_END_ALLOW_THREADS
+    PY_EVP_MD_free(evp);
 
     if (result == NULL) {
-        _setException(PyExc_ValueError);
+        _setException(PyExc_ValueError, NULL);
         return NULL;
     }
     return PyBytes_FromStringAndSize((const char*)md, md_len);
@@ -1385,18 +1482,18 @@
 
     key: Py_buffer
     msg as msg_obj: object(c_default="NULL") = b''
-    digestmod: str(c_default="NULL") = None
+    digestmod: object(c_default="NULL") = None
 
 Return a new hmac object.
 [clinic start generated code]*/
 
 static PyObject *
 _hashlib_hmac_new_impl(PyObject *module, Py_buffer *key, PyObject *msg_obj,
-                       const char *digestmod)
-/*[clinic end generated code: output=9a35673be0cbea1b input=a0878868eb190134]*/
+                       PyObject *digestmod)
+/*[clinic end generated code: output=c20d9e4d9ed6d219 input=5f4071dcc7f34362]*/
 {
     PyTypeObject *type = get_hashlib_state(module)->HMACtype;
-    const EVP_MD *digest;
+    PY_EVP_MD *digest;
     HMAC_CTX *ctx = NULL;
     HMACobject *self = NULL;
     int r;
@@ -1407,21 +1504,20 @@
         return NULL;
     }
 
-    if ((digestmod == NULL) || !strlen(digestmod)) {
+    if (digestmod == NULL) {
         PyErr_SetString(
             PyExc_TypeError, "Missing required parameter 'digestmod'.");
         return NULL;
     }
 
-    digest = py_digest_by_name(digestmod);
-    if (!digest) {
-        PyErr_SetString(PyExc_ValueError, "unknown hash function");
+    digest = py_digest_by_digestmod(module, digestmod, Py_ht_mac);
+    if (digest == NULL) {
         return NULL;
     }
 
     ctx = HMAC_CTX_new();
     if (ctx == NULL) {
-        _setException(PyExc_ValueError);
+        _setException(PyExc_ValueError, NULL);
         goto error;
     }
 
@@ -1431,8 +1527,9 @@
         (int)key->len,
         digest,
         NULL /*impl*/);
+    PY_EVP_MD_free(digest);
     if (r == 0) {
-        _setException(PyExc_ValueError);
+        _setException(PyExc_ValueError, NULL);
         goto error;
     }
 
@@ -1453,7 +1550,7 @@
 
 error:
     if (ctx) HMAC_CTX_free(ctx);
-    if (self) PyObject_Del(self);
+    if (self) PyObject_Free(self);
     return NULL;
 }
 
@@ -1490,9 +1587,11 @@
     }
 
     if (self->lock != NULL) {
-        ENTER_HASHLIB(self);
+        Py_BEGIN_ALLOW_THREADS
+        PyThread_acquire_lock(self->lock, 1);
         r = HMAC_Update(self->ctx, (const unsigned char*)view.buf, view.len);
-        LEAVE_HASHLIB(self);
+        PyThread_release_lock(self->lock);
+        Py_END_ALLOW_THREADS
     } else {
         r = HMAC_Update(self->ctx, (const unsigned char*)view.buf, view.len);
     }
@@ -1500,7 +1599,7 @@
     PyBuffer_Release(&view);
 
     if (r == 0) {
-        _setException(PyExc_ValueError);
+        _setException(PyExc_ValueError, NULL);
         return 0;
     }
     return 1;
@@ -1520,11 +1619,11 @@
 
     HMAC_CTX *ctx = HMAC_CTX_new();
     if (ctx == NULL) {
-        return _setException(PyExc_ValueError);
+        return _setException(PyExc_ValueError, NULL);
     }
     if (!locked_HMAC_CTX_copy(ctx, self)) {
         HMAC_CTX_free(ctx);
-        return _setException(PyExc_ValueError);
+        return _setException(PyExc_ValueError, NULL);
     }
 
     retval = (HMACobject *)PyObject_New(HMACobject, Py_TYPE(self));
@@ -1546,7 +1645,7 @@
         PyThread_free_lock(self->lock);
     }
     HMAC_CTX_free(self->ctx);
-    PyObject_Del(self);
+    PyObject_Free(self);
     Py_DECREF(tp);
 }
 
@@ -1590,13 +1689,13 @@
         return 0;
     }
     if (!locked_HMAC_CTX_copy(temp_ctx, self)) {
-        _setException(PyExc_ValueError);
+        _setException(PyExc_ValueError, NULL);
         return 0;
     }
     int r = HMAC_Final(temp_ctx, buf, &len);
     HMAC_CTX_free(temp_ctx);
     if (r == 0) {
-        _setException(PyExc_ValueError);
+        _setException(PyExc_ValueError, NULL);
         return 0;
     }
     return 1;
@@ -1614,7 +1713,7 @@
     unsigned char digest[EVP_MAX_MD_SIZE];
     unsigned int digest_size = _hmac_digest_size(self);
     if (digest_size == 0) {
-        return _setException(PyExc_ValueError);
+        return _setException(PyExc_ValueError, NULL);
     }
     int r = _hmac_digest(self, digest, digest_size);
     if (r == 0) {
@@ -1639,7 +1738,7 @@
     unsigned char digest[EVP_MAX_MD_SIZE];
     unsigned int digest_size = _hmac_digest_size(self);
     if (digest_size == 0) {
-        return _setException(PyExc_ValueError);
+        return _setException(PyExc_ValueError, NULL);
     }
     int r = _hmac_digest(self, digest, digest_size);
     if (r == 0) {
@@ -1653,7 +1752,7 @@
 {
     unsigned int digest_size = _hmac_digest_size(self);
     if (digest_size == 0) {
-        return _setException(PyExc_ValueError);
+        return _setException(PyExc_ValueError, NULL);
     }
     return PyLong_FromLong(digest_size);
 }
@@ -1663,7 +1762,7 @@
 {
     const EVP_MD *md = HMAC_CTX_get_md(self->ctx);
     if (md == NULL) {
-        return _setException(PyExc_ValueError);
+        return _setException(PyExc_ValueError, NULL);
     }
     return PyLong_FromLong(EVP_MD_block_size(md));
 }
@@ -1717,14 +1816,13 @@
     {Py_tp_dealloc,(destructor)_hmac_dealloc},
     {Py_tp_methods, HMAC_methods},
     {Py_tp_getset, HMAC_getset},
-    {Py_tp_new, _disabled_new},
     {0, NULL}
 };
 
 PyType_Spec HMACtype_spec = {
     "_hashlib.HMAC",    /* name */
     sizeof(HMACobject),     /* basicsize */
-    .flags = Py_TPFLAGS_DEFAULT,
+    .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION | Py_TPFLAGS_IMMUTABLETYPE,
     .slots = HMACtype_slots,
 };
 
@@ -1787,12 +1885,6 @@
     return 0;
 }
 
-/* LibreSSL doesn't support FIPS:
-   https://marc.info/?l=openbsd-misc&m=139819485423701&w=2
-
-   Ted Unangst wrote: "I figured I should mention our current libressl policy
-   wrt FIPS mode.  It's gone and it's not coming back." */
-#ifndef LIBRESSL_VERSION_NUMBER
 /*[clinic input]
 _hashlib.get_fips_mode -> int
 
@@ -1811,12 +1903,11 @@
 /*[clinic end generated code: output=87eece1bab4d3fa9 input=2db61538c41c6fef]*/
 
 {
-    int result;
 #if OPENSSL_VERSION_NUMBER >= 0x30000000L
-    result = EVP_default_properties_is_fips_enabled(NULL);
+    return EVP_default_properties_is_fips_enabled(NULL);
 #else
     ERR_clear_error();
-    result = FIPS_mode();
+    int result = FIPS_mode();
     if (result == 0) {
         // "If the library was built without support of the FIPS Object Module,
         // then the function will return 0 with an error code of
@@ -1824,14 +1915,13 @@
         // But 0 is also a valid result value.
         unsigned long errcode = ERR_peek_last_error();
         if (errcode) {
-            _setException(PyExc_ValueError);
+            _setException(PyExc_ValueError, NULL);
             return -1;
         }
     }
     return result;
 #endif
 }
-#endif  // !LIBRESSL_VERSION_NUMBER
 
 
 static int
@@ -1985,6 +2075,8 @@
 #ifdef PY_OPENSSL_HAS_SHAKE
     Py_VISIT(state->EVPXOFtype);
 #endif
+    Py_VISIT(state->constructs);
+    Py_VISIT(state->unsupported_digestmod_error);
     return 0;
 }
 
@@ -1997,6 +2089,14 @@
 #ifdef PY_OPENSSL_HAS_SHAKE
     Py_CLEAR(state->EVPXOFtype);
 #endif
+    Py_CLEAR(state->constructs);
+    Py_CLEAR(state->unsupported_digestmod_error);
+
+    if (state->hashtable != NULL) {
+        _Py_hashtable_destroy(state->hashtable);
+        state->hashtable = NULL;
+    }
+
     return 0;
 }
 
@@ -2008,13 +2108,15 @@
 
 /* Py_mod_exec functions */
 static int
-hashlib_openssl_legacy_init(PyObject *module)
+hashlib_init_hashtable(PyObject *module)
 {
-#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER)
-    /* Load all digest algorithms and initialize cpuid */
-    OPENSSL_add_all_algorithms_noconf();
-    ERR_load_crypto_strings();
-#endif
+    _hashlibstate *state = get_hashlib_state(module);
+
+    state->hashtable = py_hashentry_table_new();
+    if (state->hashtable == NULL) {
+        PyErr_NoMemory();
+        return -1;
+    }
     return 0;
 }
 
@@ -2038,21 +2140,14 @@
 {
 #ifdef PY_OPENSSL_HAS_SHAKE
     _hashlibstate *state = get_hashlib_state(module);
-    PyObject *bases;
 
     if (state->EVPtype == NULL) {
         return -1;
     }
 
-    bases = PyTuple_Pack(1, state->EVPtype);
-    if (bases == NULL) {
-        return -1;
-    }
-
     state->EVPXOFtype = (PyTypeObject *)PyType_FromSpecWithBases(
-        &EVPXOFtype_spec, bases
+        &EVPXOFtype_spec, (PyObject *)state->EVPtype
     );
-    Py_DECREF(bases);
     if (state->EVPXOFtype == NULL) {
         return -1;
     }
@@ -2078,17 +2173,89 @@
     return 0;
 }
 
-#if 0
+static int
+hashlib_init_constructors(PyObject *module)
+{
+    /* Create dict from builtin openssl_hash functions to name
+     * {_hashlib.openssl_sha256: "sha256", ...}
+     */
+    PyModuleDef *mdef;
+    PyMethodDef *fdef;
+    PyObject *proxy;
+    PyObject *func, *name_obj;
+    _hashlibstate *state = get_hashlib_state(module);
+
+    mdef = PyModule_GetDef(module);
+    if (mdef == NULL) {
+        return -1;
+    }
+
+    state->constructs = PyDict_New();
+    if (state->constructs == NULL) {
+        return -1;
+    }
+
+    for (fdef = mdef->m_methods; fdef->ml_name != NULL; fdef++) {
+        if (strncmp(fdef->ml_name, "openssl_", 8)) {
+            continue;
+        }
+        name_obj = PyUnicode_FromString(fdef->ml_name + 8);
+        if (name_obj == NULL) {
+            return -1;
+        }
+        func  = PyObject_GetAttrString(module, fdef->ml_name);
+        if (func == NULL) {
+            Py_DECREF(name_obj);
+            return -1;
+        }
+        int rc = PyDict_SetItem(state->constructs, func, name_obj);
+        Py_DECREF(func);
+        Py_DECREF(name_obj);
+        if (rc < 0) {
+            return -1;
+        }
+    }
+
+    proxy = PyDictProxy_New(state->constructs);
+    if (proxy == NULL) {
+        return -1;
+    }
+
+    int rc = PyModule_AddObjectRef(module, "_constructors", proxy);
+    Py_DECREF(proxy);
+    if (rc < 0) {
+        return -1;
+    }
+    return 0;
+}
+
+static int
+hashlib_exception(PyObject *module)
+{
+    _hashlibstate *state = get_hashlib_state(module);
+    state->unsupported_digestmod_error = PyErr_NewException(
+        "_hashlib.UnsupportedDigestmodError", PyExc_ValueError, NULL);
+    if (state->unsupported_digestmod_error == NULL) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(module, "UnsupportedDigestmodError",
+                              state->unsupported_digestmod_error) < 0) {
+        return -1;
+    }
+    return 0;
+}
+
+
 static PyModuleDef_Slot hashlib_slots[] = {
-    /* OpenSSL 1.0.2 and LibreSSL */
-    {Py_mod_exec, hashlib_openssl_legacy_init},
+    {Py_mod_exec, hashlib_init_hashtable},
     {Py_mod_exec, hashlib_init_evptype},
     {Py_mod_exec, hashlib_init_evpxoftype},
     {Py_mod_exec, hashlib_init_hmactype},
     {Py_mod_exec, hashlib_md_meth_names},
+    {Py_mod_exec, hashlib_init_constructors},
+    {Py_mod_exec, hashlib_exception},
     {0, NULL}
 };
-#endif
 
 static struct PyModuleDef _hashlibmodule = {
     PyModuleDef_HEAD_INIT,
@@ -2096,7 +2263,7 @@
     .m_doc = "OpenSSL interface for hashlib module",
     .m_size = sizeof(_hashlibstate),
     .m_methods = EVP_functions,
-    .m_slots = NULL,
+    .m_slots = hashlib_slots,
     .m_traverse = hashlib_traverse,
     .m_clear = hashlib_clear,
     .m_free = hashlib_free
@@ -2105,37 +2272,5 @@
 PyMODINIT_FUNC
 PyInit__hashlib(void)
 {
-    PyObject *m = PyState_FindModule(&_hashlibmodule);
-    if (m != NULL) {
-        Py_INCREF(m);
-        return m;
-    }
-
-    m = PyModule_Create(&_hashlibmodule);
-    if (m == NULL) {
-        return NULL;
-    }
-
-    if (hashlib_openssl_legacy_init(m) < 0) {
-        Py_DECREF(m);
-        return NULL;
-    }
-    if (hashlib_init_evptype(m) < 0) {
-        Py_DECREF(m);
-        return NULL;
-    }
-    if (hashlib_init_evpxoftype(m) < 0) {
-        Py_DECREF(m);
-        return NULL;
-    }
-    if (hashlib_init_hmactype(m) < 0) {
-        Py_DECREF(m);
-        return NULL;
-    }
-    if (hashlib_md_meth_names(m) == -1) {
-        Py_DECREF(m);
-        return NULL;
-    }
-
-    return m;
+    return PyModuleDef_Init(&_hashlibmodule);
 }
diff --git a/Modules/_heapqmodule.c b/Modules/_heapqmodule.c
index 4e85e04..20468c2 100644
--- a/Modules/_heapqmodule.c
+++ b/Modules/_heapqmodule.c
@@ -7,9 +7,11 @@
 */
 
 #include "Python.h"
+#include "pycore_list.h"          // _PyList_ITEMS()
 
 #include "clinic/_heapqmodule.c.h"
 
+
 /*[clinic input]
 module _heapq
 [clinic start generated code]*/
@@ -113,7 +115,7 @@
 /*[clinic input]
 _heapq.heappush
 
-    heap: object
+    heap: object(subclass_of='&PyList_Type')
     item: object
     /
 
@@ -122,13 +124,8 @@
 
 static PyObject *
 _heapq_heappush_impl(PyObject *module, PyObject *heap, PyObject *item)
-/*[clinic end generated code: output=912c094f47663935 input=7913545cb5118842]*/
+/*[clinic end generated code: output=912c094f47663935 input=7c69611f3698aceb]*/
 {
-    if (!PyList_Check(heap)) {
-        PyErr_SetString(PyExc_TypeError, "heap argument must be a list");
-        return NULL;
-    }
-
     if (PyList_Append(heap, item))
         return NULL;
 
@@ -143,11 +140,6 @@
     PyObject *lastelt, *returnitem;
     Py_ssize_t n;
 
-    if (!PyList_Check(heap)) {
-        PyErr_SetString(PyExc_TypeError, "heap argument must be a list");
-        return NULL;
-    }
-
     /* raises IndexError if the heap is empty */
     n = PyList_GET_SIZE(heap);
     if (n == 0) {
@@ -177,15 +169,15 @@
 /*[clinic input]
 _heapq.heappop
 
-    heap: object
+    heap: object(subclass_of='&PyList_Type')
     /
 
 Pop the smallest item off the heap, maintaining the heap invariant.
 [clinic start generated code]*/
 
 static PyObject *
-_heapq_heappop(PyObject *module, PyObject *heap)
-/*[clinic end generated code: output=e1bbbc9866bce179 input=9bd36317b806033d]*/
+_heapq_heappop_impl(PyObject *module, PyObject *heap)
+/*[clinic end generated code: output=96dfe82d37d9af76 input=91487987a583c856]*/
 {
     return heappop_internal(heap, siftup);
 }
@@ -195,11 +187,6 @@
 {
     PyObject *returnitem;
 
-    if (!PyList_Check(heap)) {
-        PyErr_SetString(PyExc_TypeError, "heap argument must be a list");
-        return NULL;
-    }
-
     if (PyList_GET_SIZE(heap) == 0) {
         PyErr_SetString(PyExc_IndexError, "index out of range");
         return NULL;
@@ -219,7 +206,7 @@
 /*[clinic input]
 _heapq.heapreplace
 
-    heap: object
+    heap: object(subclass_of='&PyList_Type')
     item: object
     /
 
@@ -236,7 +223,7 @@
 
 static PyObject *
 _heapq_heapreplace_impl(PyObject *module, PyObject *heap, PyObject *item)
-/*[clinic end generated code: output=82ea55be8fbe24b4 input=e57ae8f4ecfc88e3]*/
+/*[clinic end generated code: output=82ea55be8fbe24b4 input=719202ac02ba10c8]*/
 {
     return heapreplace_internal(heap, item, siftup);
 }
@@ -244,7 +231,7 @@
 /*[clinic input]
 _heapq.heappushpop
 
-    heap: object
+    heap: object(subclass_of='&PyList_Type')
     item: object
     /
 
@@ -256,16 +243,11 @@
 
 static PyObject *
 _heapq_heappushpop_impl(PyObject *module, PyObject *heap, PyObject *item)
-/*[clinic end generated code: output=67231dc98ed5774f input=eb48c90ba77b2214]*/
+/*[clinic end generated code: output=67231dc98ed5774f input=5dc701f1eb4a4aa7]*/
 {
     PyObject *returnitem;
     int cmp;
 
-    if (!PyList_Check(heap)) {
-        PyErr_SetString(PyExc_TypeError, "heap argument must be a list");
-        return NULL;
-    }
-
     if (PyList_GET_SIZE(heap) == 0) {
         Py_INCREF(item);
         return item;
@@ -367,11 +349,6 @@
 {
     Py_ssize_t i, n;
 
-    if (!PyList_Check(heap)) {
-        PyErr_SetString(PyExc_TypeError, "heap argument must be a list");
-        return NULL;
-    }
-
     /* For heaps likely to be bigger than L1 cache, we use the cache
        friendly heapify function.  For smaller heaps that fit entirely
        in cache, we prefer the simpler algorithm with less branching.
@@ -396,15 +373,15 @@
 /*[clinic input]
 _heapq.heapify
 
-    heap: object
+    heap: object(subclass_of='&PyList_Type')
     /
 
 Transform list into a heap, in-place, in O(len(heap)) time.
 [clinic start generated code]*/
 
 static PyObject *
-_heapq_heapify(PyObject *module, PyObject *heap)
-/*[clinic end generated code: output=11483f23627c4616 input=872c87504b8de970]*/
+_heapq_heapify_impl(PyObject *module, PyObject *heap)
+/*[clinic end generated code: output=e63a636fcf83d6d0 input=53bb7a2166febb73]*/
 {
     return heapify_internal(heap, siftup);
 }
@@ -508,15 +485,15 @@
 /*[clinic input]
 _heapq._heappop_max
 
-    heap: object
+    heap: object(subclass_of='&PyList_Type')
     /
 
 Maxheap variant of heappop.
 [clinic start generated code]*/
 
 static PyObject *
-_heapq__heappop_max(PyObject *module, PyObject *heap)
-/*[clinic end generated code: output=acd30acf6384b13c input=62ede3ba9117f541]*/
+_heapq__heappop_max_impl(PyObject *module, PyObject *heap)
+/*[clinic end generated code: output=9e77aadd4e6a8760 input=362c06e1c7484793]*/
 {
     return heappop_internal(heap, siftup_max);
 }
@@ -524,7 +501,7 @@
 /*[clinic input]
 _heapq._heapreplace_max
 
-    heap: object
+    heap: object(subclass_of='&PyList_Type')
     item: object
     /
 
@@ -534,7 +511,7 @@
 static PyObject *
 _heapq__heapreplace_max_impl(PyObject *module, PyObject *heap,
                              PyObject *item)
-/*[clinic end generated code: output=8ad7545e4a5e8adb input=6d8f25131e0f0e5f]*/
+/*[clinic end generated code: output=8ad7545e4a5e8adb input=f2dd27cbadb948d7]*/
 {
     return heapreplace_internal(heap, item, siftup_max);
 }
@@ -542,15 +519,15 @@
 /*[clinic input]
 _heapq._heapify_max
 
-    heap: object
+    heap: object(subclass_of='&PyList_Type')
     /
 
 Maxheap variant of heapify.
 [clinic start generated code]*/
 
 static PyObject *
-_heapq__heapify_max(PyObject *module, PyObject *heap)
-/*[clinic end generated code: output=1c6bb6b60d6a2133 input=cdfcc6835b14110d]*/
+_heapq__heapify_max_impl(PyObject *module, PyObject *heap)
+/*[clinic end generated code: output=2cb028beb4a8b65e input=c1f765ee69f124b8]*/
 {
     return heapify_internal(heap, siftup_max);
 }
diff --git a/Modules/_io/_iomodule.c b/Modules/_io/_iomodule.c
index d7cadac..170dea4 100644
--- a/Modules/_io/_iomodule.c
+++ b/Modules/_io/_iomodule.c
@@ -10,6 +10,7 @@
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
 #include "_iomodule.h"
+#include "pycore_pystate.h"       // _PyInterpreterState_GET()
 
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
@@ -33,6 +34,7 @@
 PyObject *_PyIO_str_flush = NULL;
 PyObject *_PyIO_str_getstate = NULL;
 PyObject *_PyIO_str_isatty = NULL;
+PyObject *_PyIO_str_locale = NULL;
 PyObject *_PyIO_str_newlines = NULL;
 PyObject *_PyIO_str_nl = NULL;
 PyObject *_PyIO_str_peek = NULL;
@@ -504,6 +506,45 @@
     return NULL;
 }
 
+
+/*[clinic input]
+_io.text_encoding
+    encoding: object
+    stacklevel: int = 2
+    /
+
+A helper function to choose the text encoding.
+
+When encoding is not None, just return it.
+Otherwise, return the default text encoding (i.e. "locale").
+
+This function emits an EncodingWarning if encoding is None and
+sys.flags.warn_default_encoding is true.
+
+This can be used in APIs with an encoding=None parameter.
+However, please consider using encoding="utf-8" for new APIs.
+[clinic start generated code]*/
+
+static PyObject *
+_io_text_encoding_impl(PyObject *module, PyObject *encoding, int stacklevel)
+/*[clinic end generated code: output=91b2cfea6934cc0c input=bf70231213e2a7b4]*/
+{
+    if (encoding == NULL || encoding == Py_None) {
+        PyInterpreterState *interp = _PyInterpreterState_GET();
+        if (_PyInterpreterState_GetConfig(interp)->warn_default_encoding) {
+            if (PyErr_WarnEx(PyExc_EncodingWarning,
+                             "'encoding' argument not specified", stacklevel)) {
+                return NULL;
+            }
+        }
+        Py_INCREF(_PyIO_str_locale);
+        return _PyIO_str_locale;
+    }
+    Py_INCREF(encoding);
+    return encoding;
+}
+
+
 /*[clinic input]
 _io.open_code
 
@@ -532,7 +573,7 @@
 {
     Py_off_t result;
     PyObject *runerr;
-    PyObject *value = PyNumber_Index(item);
+    PyObject *value = _PyNumber_Index(item);
     if (value == NULL)
         return -1;
 
@@ -593,39 +634,12 @@
     return state;
 }
 
-PyObject *
-_PyIO_get_locale_module(_PyIO_State *state)
-{
-    PyObject *mod;
-    if (state->locale_module != NULL) {
-        assert(PyWeakref_CheckRef(state->locale_module));
-        mod = PyWeakref_GET_OBJECT(state->locale_module);
-        if (mod != Py_None) {
-            Py_INCREF(mod);
-            return mod;
-        }
-        Py_CLEAR(state->locale_module);
-    }
-    mod = PyImport_ImportModule("_bootlocale");
-    if (mod == NULL)
-        return NULL;
-    state->locale_module = PyWeakref_NewRef(mod, NULL);
-    if (state->locale_module == NULL) {
-        Py_DECREF(mod);
-        return NULL;
-    }
-    return mod;
-}
-
-
 static int
 iomodule_traverse(PyObject *mod, visitproc visit, void *arg) {
     _PyIO_State *state = get_io_state(mod);
     if (!state->initialized)
         return 0;
-    if (state->locale_module != NULL) {
-        Py_VISIT(state->locale_module);
-    }
+    Py_VISIT(state->locale_module);
     Py_VISIT(state->unsupported_operation);
     return 0;
 }
@@ -656,6 +670,7 @@
 
 static PyMethodDef module_methods[] = {
     _IO_OPEN_METHODDEF
+    _IO_TEXT_ENCODING_METHODDEF
     _IO_OPEN_CODE_METHODDEF
     {NULL, NULL}
 };
@@ -774,6 +789,7 @@
     ADD_INTERNED(flush)
     ADD_INTERNED(getstate)
     ADD_INTERNED(isatty)
+    ADD_INTERNED(locale)
     ADD_INTERNED(newlines)
     ADD_INTERNED(peek)
     ADD_INTERNED(read)
diff --git a/Modules/_io/_iomodule.h b/Modules/_io/_iomodule.h
index a8f3951..638797f 100644
--- a/Modules/_io/_iomodule.h
+++ b/Modules/_io/_iomodule.h
@@ -150,7 +150,6 @@
 #define IO_STATE() _PyIO_get_module_state()
 
 extern _PyIO_State *_PyIO_get_module_state(void);
-extern PyObject *_PyIO_get_locale_module(_PyIO_State *);
 
 #ifdef MS_WINDOWS
 extern char _PyIO_get_console_type(PyObject *);
diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c
index f8e21f2..ba966f5 100644
--- a/Modules/_io/bufferedio.c
+++ b/Modules/_io/bufferedio.c
@@ -341,11 +341,10 @@
      : buffered_closed(self)))
 
 #define CHECK_CLOSED(self, error_msg) \
-    if (IS_CLOSED(self)) { \
+    if (IS_CLOSED(self) & (Py_SAFE_DOWNCAST(READAHEAD(self), Py_off_t, Py_ssize_t) == 0)) { \
         PyErr_SetString(PyExc_ValueError, error_msg); \
         return NULL; \
-    }
-
+    } \
 
 #define VALID_READ_BUFFER(self) \
     (self->readable && self->read_end != -1)
@@ -530,6 +529,9 @@
         Py_CLEAR(res);
     }
 
+    self->read_end = 0;
+    self->pos = 0;
+
 end:
     LEAVE_BUFFERED(self)
     return res;
@@ -1483,6 +1485,15 @@
     }
     n = PyNumber_AsSsize_t(res, PyExc_ValueError);
     Py_DECREF(res);
+
+    if (n == -1 && PyErr_Occurred()) {
+        _PyErr_FormatFromCause(
+            PyExc_OSError,
+            "raw readinto() failed"
+        );
+        return -1;
+    }
+
     if (n < 0 || n > len) {
         PyErr_Format(PyExc_OSError,
                      "raw readinto() returned invalid length %zd "
diff --git a/Modules/_io/clinic/_iomodule.c.h b/Modules/_io/clinic/_iomodule.c.h
index 1a9651d..91c55b1 100644
--- a/Modules/_io/clinic/_iomodule.c.h
+++ b/Modules/_io/clinic/_iomodule.c.h
@@ -178,11 +178,6 @@
         }
     }
     if (args[2]) {
-        if (PyFloat_Check(args[2])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         buffering = _PyLong_AsInt(args[2]);
         if (buffering == -1 && PyErr_Occurred()) {
             goto exit;
@@ -261,11 +256,6 @@
         }
     }
     if (args[6]) {
-        if (PyFloat_Check(args[6])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         closefd = _PyLong_AsInt(args[6]);
         if (closefd == -1 && PyErr_Occurred()) {
             goto exit;
@@ -282,6 +272,52 @@
     return return_value;
 }
 
+PyDoc_STRVAR(_io_text_encoding__doc__,
+"text_encoding($module, encoding, stacklevel=2, /)\n"
+"--\n"
+"\n"
+"A helper function to choose the text encoding.\n"
+"\n"
+"When encoding is not None, just return it.\n"
+"Otherwise, return the default text encoding (i.e. \"locale\").\n"
+"\n"
+"This function emits an EncodingWarning if encoding is None and\n"
+"sys.flags.warn_default_encoding is true.\n"
+"\n"
+"This can be used in APIs with an encoding=None parameter.\n"
+"However, please consider using encoding=\"utf-8\" for new APIs.");
+
+#define _IO_TEXT_ENCODING_METHODDEF    \
+    {"text_encoding", (PyCFunction)(void(*)(void))_io_text_encoding, METH_FASTCALL, _io_text_encoding__doc__},
+
+static PyObject *
+_io_text_encoding_impl(PyObject *module, PyObject *encoding, int stacklevel);
+
+static PyObject *
+_io_text_encoding(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    PyObject *encoding;
+    int stacklevel = 2;
+
+    if (!_PyArg_CheckPositional("text_encoding", nargs, 1, 2)) {
+        goto exit;
+    }
+    encoding = args[0];
+    if (nargs < 2) {
+        goto skip_optional;
+    }
+    stacklevel = _PyLong_AsInt(args[1]);
+    if (stacklevel == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+skip_optional:
+    return_value = _io_text_encoding_impl(module, encoding, stacklevel);
+
+exit:
+    return return_value;
+}
+
 PyDoc_STRVAR(_io_open_code__doc__,
 "open_code($module, /, path)\n"
 "--\n"
@@ -323,4 +359,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=3df6bc6d91697545 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=06e055d1d80b835d input=a9049054013a1b77]*/
diff --git a/Modules/_io/clinic/bufferedio.c.h b/Modules/_io/clinic/bufferedio.c.h
index 56d6332..19543fd 100644
--- a/Modules/_io/clinic/bufferedio.c.h
+++ b/Modules/_io/clinic/bufferedio.c.h
@@ -120,14 +120,9 @@
     if (nargs < 1) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[0]);
+        PyObject *iobj = _PyNumber_Index(args[0]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -200,14 +195,9 @@
     if (nargs < 1) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[0]);
+        PyObject *iobj = _PyNumber_Index(args[0]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -356,11 +346,6 @@
     if (nargs < 2) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     whence = _PyLong_AsInt(args[1]);
     if (whence == -1 && PyErr_Occurred()) {
         goto exit;
@@ -434,14 +419,9 @@
     if (!noptargs) {
         goto skip_optional_pos;
     }
-    if (PyFloat_Check(fastargs[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(fastargs[1]);
+        PyObject *iobj = _PyNumber_Index(fastargs[1]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -493,14 +473,9 @@
     if (!noptargs) {
         goto skip_optional_pos;
     }
-    if (PyFloat_Check(fastargs[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(fastargs[1]);
+        PyObject *iobj = _PyNumber_Index(fastargs[1]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -590,14 +565,9 @@
     if (PyTuple_GET_SIZE(args) < 3) {
         goto skip_optional;
     }
-    if (PyFloat_Check(PyTuple_GET_ITEM(args, 2))) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(PyTuple_GET_ITEM(args, 2));
+        PyObject *iobj = _PyNumber_Index(PyTuple_GET_ITEM(args, 2));
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -649,14 +619,9 @@
     if (!noptargs) {
         goto skip_optional_pos;
     }
-    if (PyFloat_Check(fastargs[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(fastargs[1]);
+        PyObject *iobj = _PyNumber_Index(fastargs[1]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -672,4 +637,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=7d9ad40c95bdd808 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=98ccf7610c0e82ba input=a9049054013a1b77]*/
diff --git a/Modules/_io/clinic/bytesio.c.h b/Modules/_io/clinic/bytesio.c.h
index 83cd490..5ea80ae 100644
--- a/Modules/_io/clinic/bytesio.c.h
+++ b/Modules/_io/clinic/bytesio.c.h
@@ -402,14 +402,9 @@
     if (!_PyArg_CheckPositional("seek", nargs, 1, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[0]);
+        PyObject *iobj = _PyNumber_Index(args[0]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -422,11 +417,6 @@
     if (nargs < 2) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     whence = _PyLong_AsInt(args[1]);
     if (whence == -1 && PyErr_Occurred()) {
         goto exit;
@@ -515,4 +505,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=4ec2506def9c8eb9 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=49a32140eb8c5555 input=a9049054013a1b77]*/
diff --git a/Modules/_io/clinic/fileio.c.h b/Modules/_io/clinic/fileio.c.h
index 53e7067..9b237c1 100644
--- a/Modules/_io/clinic/fileio.c.h
+++ b/Modules/_io/clinic/fileio.c.h
@@ -87,11 +87,6 @@
         }
     }
     if (fastargs[2]) {
-        if (PyFloat_Check(fastargs[2])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         closefd = _PyLong_AsInt(fastargs[2]);
         if (closefd == -1 && PyErr_Occurred()) {
             goto exit;
@@ -351,11 +346,6 @@
     if (nargs < 2) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     whence = _PyLong_AsInt(args[1]);
     if (whence == -1 && PyErr_Occurred()) {
         goto exit;
@@ -447,4 +437,4 @@
 #ifndef _IO_FILEIO_TRUNCATE_METHODDEF
     #define _IO_FILEIO_TRUNCATE_METHODDEF
 #endif /* !defined(_IO_FILEIO_TRUNCATE_METHODDEF) */
-/*[clinic end generated code: output=e7682d0a3264d284 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=3479912ec0f7e029 input=a9049054013a1b77]*/
diff --git a/Modules/_io/clinic/iobase.c.h b/Modules/_io/clinic/iobase.c.h
index ddaff7b..4fd6e18 100644
--- a/Modules/_io/clinic/iobase.c.h
+++ b/Modules/_io/clinic/iobase.c.h
@@ -274,14 +274,9 @@
     if (nargs < 1) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[0]);
+        PyObject *iobj = _PyNumber_Index(args[0]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -315,4 +310,4 @@
 {
     return _io__RawIOBase_readall_impl(self);
 }
-/*[clinic end generated code: output=61b6ea7153ef9940 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=83c1361a7a51ca84 input=a9049054013a1b77]*/
diff --git a/Modules/_io/clinic/stringio.c.h b/Modules/_io/clinic/stringio.c.h
index 77a720c..147ef66 100644
--- a/Modules/_io/clinic/stringio.c.h
+++ b/Modules/_io/clinic/stringio.c.h
@@ -177,14 +177,9 @@
     if (!_PyArg_CheckPositional("seek", nargs, 1, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[0]);
+        PyObject *iobj = _PyNumber_Index(args[0]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -197,11 +192,6 @@
     if (nargs < 2) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     whence = _PyLong_AsInt(args[1]);
     if (whence == -1 && PyErr_Occurred()) {
         goto exit;
@@ -348,4 +338,4 @@
 {
     return _io_StringIO_seekable_impl(self);
 }
-/*[clinic end generated code: output=7aad5ab2e64a25b8 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=eea93dcab10d0a97 input=a9049054013a1b77]*/
diff --git a/Modules/_io/clinic/textio.c.h b/Modules/_io/clinic/textio.c.h
index b8b5075..0b047ac 100644
--- a/Modules/_io/clinic/textio.c.h
+++ b/Modules/_io/clinic/textio.c.h
@@ -39,11 +39,6 @@
         goto exit;
     }
     decoder = fastargs[0];
-    if (PyFloat_Check(fastargs[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     translate = _PyLong_AsInt(fastargs[1]);
     if (translate == -1 && PyErr_Occurred()) {
         goto exit;
@@ -90,11 +85,6 @@
     if (!noptargs) {
         goto skip_optional_pos;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     final = _PyLong_AsInt(args[1]);
     if (final == -1 && PyErr_Occurred()) {
         goto exit;
@@ -266,11 +256,6 @@
         }
     }
     if (fastargs[4]) {
-        if (PyFloat_Check(fastargs[4])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         line_buffering = _PyLong_AsInt(fastargs[4]);
         if (line_buffering == -1 && PyErr_Occurred()) {
             goto exit;
@@ -279,11 +264,6 @@
             goto skip_optional_pos;
         }
     }
-    if (PyFloat_Check(fastargs[5])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     write_through = _PyLong_AsInt(fastargs[5]);
     if (write_through == -1 && PyErr_Occurred()) {
         goto exit;
@@ -470,14 +450,9 @@
     if (nargs < 1) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[0]);
+        PyObject *iobj = _PyNumber_Index(args[0]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -519,11 +494,6 @@
     if (nargs < 2) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     whence = _PyLong_AsInt(args[1]);
     if (whence == -1 && PyErr_Occurred()) {
         goto exit;
@@ -701,4 +671,4 @@
 {
     return _io_TextIOWrapper_close_impl(self);
 }
-/*[clinic end generated code: output=b1bae4f4cdf6019e input=a9049054013a1b77]*/
+/*[clinic end generated code: output=2604c8f3a45b9a03 input=a9049054013a1b77]*/
diff --git a/Modules/_io/clinic/winconsoleio.c.h b/Modules/_io/clinic/winconsoleio.c.h
index 3e501a5..84e73dc 100644
--- a/Modules/_io/clinic/winconsoleio.c.h
+++ b/Modules/_io/clinic/winconsoleio.c.h
@@ -8,10 +8,10 @@
 "close($self, /)\n"
 "--\n"
 "\n"
-"Close the handle.\n"
+"Close the console object.\n"
 "\n"
-"A closed handle cannot be used for further I/O operations.  close() may be\n"
-"called more than once without error.");
+"A closed console object cannot be used for further I/O operations.\n"
+"close() may be called more than once without error.");
 
 #define _IO__WINDOWSCONSOLEIO_CLOSE_METHODDEF    \
     {"close", (PyCFunction)_io__WindowsConsoleIO_close, METH_NOARGS, _io__WindowsConsoleIO_close__doc__},
@@ -86,11 +86,6 @@
         }
     }
     if (fastargs[2]) {
-        if (PyFloat_Check(fastargs[2])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         closefd = _PyLong_AsInt(fastargs[2]);
         if (closefd == -1 && PyErr_Occurred()) {
             goto exit;
@@ -115,10 +110,7 @@
 "fileno($self, /)\n"
 "--\n"
 "\n"
-"Return the underlying file descriptor (an integer).\n"
-"\n"
-"fileno is only set when a file descriptor is used to open\n"
-"one of the standard streams.");
+"Return the underlying file descriptor (an integer).");
 
 #define _IO__WINDOWSCONSOLEIO_FILENO_METHODDEF    \
     {"fileno", (PyCFunction)_io__WindowsConsoleIO_fileno, METH_NOARGS, _io__WindowsConsoleIO_fileno__doc__},
@@ -386,4 +378,4 @@
 #ifndef _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF
     #define _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF
 #endif /* !defined(_IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF) */
-/*[clinic end generated code: output=f5b8860a658a001a input=a9049054013a1b77]*/
+/*[clinic end generated code: output=48080572ffee22f5 input=a9049054013a1b77]*/
diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c
index caf91df..b9856b3 100644
--- a/Modules/_io/fileio.c
+++ b/Modules/_io/fileio.c
@@ -255,12 +255,6 @@
             self->fd = -1;
     }
 
-    if (PyFloat_Check(nameobj)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float");
-        return -1;
-    }
-
     fd = _PyLong_AsInt(nameobj);
     if (fd < 0) {
         if (!PyErr_Occurred()) {
@@ -276,7 +270,14 @@
         if (!PyUnicode_FSDecoder(nameobj, &stringobj)) {
             return -1;
         }
+#if USE_UNICODE_WCHAR_CACHE
+_Py_COMP_DIAG_PUSH
+_Py_COMP_DIAG_IGNORE_DEPR_DECLS
         widename = PyUnicode_AsUnicode(stringobj);
+_Py_COMP_DIAG_POP
+#else /* USE_UNICODE_WCHAR_CACHE */
+        widename = PyUnicode_AsWideCharString(stringobj, NULL);
+#endif /* USE_UNICODE_WCHAR_CACHE */
         if (widename == NULL)
             return -1;
 #else
@@ -497,6 +498,11 @@
         internal_close(self);
 
  done:
+#ifdef MS_WINDOWS
+#if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free(widename);
+#endif /* USE_UNICODE_WCHAR_CACHE */
+#endif
     Py_CLEAR(stringobj);
     return ret;
 }
@@ -895,10 +901,6 @@
         pos = 0;
     }
     else {
-        if(PyFloat_Check(posobj)) {
-            PyErr_SetString(PyExc_TypeError, "an integer is required");
-            return NULL;
-        }
 #if defined(HAVE_LARGEFILE_SUPPORT)
         pos = PyLong_AsLongLong(posobj);
 #else
diff --git a/Modules/_io/iobase.c b/Modules/_io/iobase.c
index a8e55c3..4c81bef 100644
--- a/Modules/_io/iobase.c
+++ b/Modules/_io/iobase.c
@@ -10,6 +10,7 @@
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
+#include "pycore_long.h"          // _PyLong_GetOne()
 #include "pycore_object.h"
 #include <stddef.h>               // offsetof()
 #include "_iomodule.h"
@@ -33,8 +34,7 @@
 } iobase;
 
 PyDoc_STRVAR(iobase_doc,
-    "The abstract base class for all I/O classes, acting on streams of\n"
-    "bytes. There is no public constructor.\n"
+    "The abstract base class for all I/O classes.\n"
     "\n"
     "This class provides dummy implementations for many methods that\n"
     "derived classes can override selectively; the default implementations\n"
@@ -349,8 +349,9 @@
     if (_PyIOBase_finalize((PyObject *) self) < 0) {
         /* When called from a heap type's dealloc, the type will be
            decref'ed on return (see e.g. subtype_dealloc in typeobject.c). */
-        if (PyType_HasFeature(Py_TYPE(self), Py_TPFLAGS_HEAPTYPE))
+        if (_PyType_HasFeature(Py_TYPE(self), Py_TPFLAGS_HEAPTYPE)) {
             Py_INCREF(Py_TYPE(self));
+        }
         return;
     }
     _PyObject_GC_UNTRACK(self);
@@ -555,7 +556,7 @@
         PyObject *b;
 
         if (peek != NULL) {
-            PyObject *readahead = PyObject_CallOneArg(peek, _PyLong_One);
+            PyObject *readahead = PyObject_CallOneArg(peek, _PyLong_GetOne());
             if (readahead == NULL) {
                 /* NOTE: PyErr_SetFromErrno() calls PyErr_CheckSignals()
                    when EINTR occurs so we needn't do it ourselves. */
diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c
index f2c72eb..e28dbaa 100644
--- a/Modules/_io/textio.c
+++ b/Modules/_io/textio.c
@@ -9,6 +9,8 @@
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
 #include "pycore_interp.h"        // PyInterpreterState.fs_codec
+#include "pycore_long.h"          // _PyLong_GetZero()
+#include "pycore_fileutils.h"     // _Py_GetLocaleEncoding()
 #include "pycore_object.h"
 #include "pycore_pystate.h"       // _PyInterpreterState_GET()
 #include "structmember.h"         // PyMemberDef
@@ -26,7 +28,6 @@
 _Py_IDENTIFIER(decode);
 _Py_IDENTIFIER(fileno);
 _Py_IDENTIFIER(flush);
-_Py_IDENTIFIER(getpreferredencoding);
 _Py_IDENTIFIER(isatty);
 _Py_IDENTIFIER(mode);
 _Py_IDENTIFIER(name);
@@ -49,7 +50,7 @@
     "\n"
     "This class provides a character and line based interface to stream\n"
     "I/O. There is no readinto method because Python's character strings\n"
-    "are immutable. There is no public constructor.\n"
+    "are immutable.\n"
     );
 
 static PyObject *
@@ -971,7 +972,7 @@
         return -1;
     }
 
-    int cmp = PyObject_RichCompareBool(cookieObj, _PyLong_Zero, Py_EQ);
+    int cmp = PyObject_RichCompareBool(cookieObj, _PyLong_GetZero(), Py_EQ);
     Py_DECREF(cookieObj);
     if (cmp < 0) {
         return -1;
@@ -980,7 +981,7 @@
     if (cmp == 0) {
         self->encoding_start_of_stream = 0;
         PyObject *res = PyObject_CallMethodOneArg(
-            self->encoder, _PyIO_str_setstate, _PyLong_Zero);
+            self->encoder, _PyIO_str_setstate, _PyLong_GetZero());
         if (res == NULL) {
             return -1;
         }
@@ -1084,6 +1085,19 @@
     self->ok = 0;
     self->detached = 0;
 
+    if (encoding == NULL) {
+        PyInterpreterState *interp = _PyInterpreterState_GET();
+        if (_PyInterpreterState_GetConfig(interp)->warn_default_encoding) {
+            if (PyErr_WarnEx(PyExc_EncodingWarning,
+                             "'encoding' argument not specified", 1)) {
+                return -1;
+            }
+        }
+    }
+    else if (strcmp(encoding, "locale") == 0) {
+        encoding = NULL;
+    }
+
     if (errors == Py_None) {
         errors = _PyUnicode_FromId(&PyId_strict); /* borrowed */
         if (errors == NULL) {
@@ -1154,29 +1168,11 @@
         }
     }
     if (encoding == NULL && self->encoding == NULL) {
-        PyObject *locale_module = _PyIO_get_locale_module(state);
-        if (locale_module == NULL)
-            goto catch_ImportError;
-        self->encoding = _PyObject_CallMethodIdOneArg(
-            locale_module, &PyId_getpreferredencoding, Py_False);
-        Py_DECREF(locale_module);
+        self->encoding = _Py_GetLocaleEncodingObject();
         if (self->encoding == NULL) {
-          catch_ImportError:
-            /*
-             Importing locale can raise an ImportError because of
-             _functools, and locale.getpreferredencoding can raise an
-             ImportError if _locale is not available.  These will happen
-             during module building.
-            */
-            if (PyErr_ExceptionMatches(PyExc_ImportError)) {
-                PyErr_Clear();
-                self->encoding = PyUnicode_FromString("ascii");
-            }
-            else
-                goto error;
+            goto error;
         }
-        else if (!PyUnicode_Check(self->encoding))
-            Py_CLEAR(self->encoding);
+        assert(PyUnicode_Check(self->encoding));
     }
     if (self->encoding != NULL) {
         encoding = PyUnicode_AsUTF8(self->encoding);
@@ -1602,6 +1598,8 @@
         ret = PyObject_CallMethodOneArg(self->buffer, _PyIO_str_write, b);
     } while (ret == NULL && _PyIO_trap_eintr());
     Py_DECREF(b);
+    // NOTE: We cleared buffer but we don't know how many bytes are actually written
+    // when an error occurred.
     if (ret == NULL)
         return -1;
     Py_DECREF(ret);
@@ -1659,7 +1657,10 @@
 
     /* XXX What if we were just reading? */
     if (self->encodefunc != NULL) {
-        if (PyUnicode_IS_ASCII(text) && is_asciicompat_encoding(self->encodefunc)) {
+        if (PyUnicode_IS_ASCII(text) &&
+                // See bpo-43260
+                PyUnicode_GET_LENGTH(text) <= self->chunk_size &&
+                is_asciicompat_encoding(self->encodefunc)) {
             b = text;
             Py_INCREF(b);
         }
@@ -1668,8 +1669,9 @@
         }
         self->encoding_start_of_stream = 0;
     }
-    else
+    else {
         b = PyObject_CallMethodOneArg(self->encoder, _PyIO_str_encode, text);
+    }
 
     Py_DECREF(text);
     if (b == NULL)
@@ -1694,6 +1696,14 @@
         self->pending_bytes_count = 0;
         self->pending_bytes = b;
     }
+    else if (self->pending_bytes_count + bytes_len > self->chunk_size) {
+        // Prevent to concatenate more than chunk_size data.
+        if (_textiowrapper_writeflush(self) < 0) {
+            Py_DECREF(b);
+            return NULL;
+        }
+        self->pending_bytes = b;
+    }
     else if (!PyList_CheckExact(self->pending_bytes)) {
         PyObject *list = PyList_New(2);
         if (list == NULL) {
@@ -1713,7 +1723,7 @@
     }
 
     self->pending_bytes_count += bytes_len;
-    if (self->pending_bytes_count > self->chunk_size || needflush ||
+    if (self->pending_bytes_count >= self->chunk_size || needflush ||
         text_needflush) {
         if (_textiowrapper_writeflush(self) < 0)
             return NULL;
@@ -2415,7 +2425,7 @@
     }
     else {
         res = PyObject_CallMethodOneArg(self->encoder, _PyIO_str_setstate,
-                                        _PyLong_Zero);
+                                        _PyLong_GetZero());
         self->encoding_start_of_stream = 0;
     }
     if (res == NULL)
@@ -2459,10 +2469,12 @@
         goto fail;
     }
 
+    PyObject *zero = _PyLong_GetZero();  // borrowed reference
+
     switch (whence) {
     case SEEK_CUR:
         /* seek relative to current position */
-        cmp = PyObject_RichCompareBool(cookieObj, _PyLong_Zero, Py_EQ);
+        cmp = PyObject_RichCompareBool(cookieObj, zero, Py_EQ);
         if (cmp < 0)
             goto fail;
 
@@ -2482,7 +2494,7 @@
 
     case SEEK_END:
         /* seek relative to end of file */
-        cmp = PyObject_RichCompareBool(cookieObj, _PyLong_Zero, Py_EQ);
+        cmp = PyObject_RichCompareBool(cookieObj, zero, Py_EQ);
         if (cmp < 0)
             goto fail;
 
@@ -2511,7 +2523,7 @@
             goto fail;
         if (self->encoder) {
             /* If seek() == 0, we are at the start of stream, otherwise not */
-            cmp = PyObject_RichCompareBool(res, _PyLong_Zero, Py_EQ);
+            cmp = PyObject_RichCompareBool(res, zero, Py_EQ);
             if (cmp < 0 || _textiowrapper_encoder_reset(self, cmp)) {
                 Py_DECREF(res);
                 goto fail;
@@ -2529,7 +2541,7 @@
         goto fail;
     }
 
-    cmp = PyObject_RichCompareBool(cookieObj, _PyLong_Zero, Py_LT);
+    cmp = PyObject_RichCompareBool(cookieObj, zero, Py_LT);
     if (cmp < 0)
         goto fail;
 
diff --git a/Modules/_io/winconsoleio.c b/Modules/_io/winconsoleio.c
index a83ef37..460f2d3 100644
--- a/Modules/_io/winconsoleio.c
+++ b/Modules/_io/winconsoleio.c
@@ -64,10 +64,7 @@
     int fd = PyLong_AsLong(path_or_fd);
     PyErr_Clear();
     if (fd >= 0) {
-        HANDLE handle;
-        _Py_BEGIN_SUPPRESS_IPH
-        handle = (HANDLE)_get_osfhandle(fd);
-        _Py_END_SUPPRESS_IPH
+        HANDLE handle = _Py_get_osfhandle_noraise(fd);
         if (handle == INVALID_HANDLE_VALUE)
             return '\0';
         return _get_console_type(handle);
@@ -143,12 +140,11 @@
 
 typedef struct {
     PyObject_HEAD
-    HANDLE handle;
     int fd;
     unsigned int created : 1;
     unsigned int readable : 1;
     unsigned int writable : 1;
-    unsigned int closehandle : 1;
+    unsigned int closefd : 1;
     char finalizing;
     unsigned int blksize;
     PyObject *weakreflist;
@@ -164,7 +160,7 @@
 int
 _PyWindowsConsoleIO_closed(PyObject *self)
 {
-    return ((winconsoleio *)self)->handle == INVALID_HANDLE_VALUE;
+    return ((winconsoleio *)self)->fd == -1;
 }
 
 
@@ -172,16 +168,12 @@
 static int
 internal_close(winconsoleio *self)
 {
-    if (self->handle != INVALID_HANDLE_VALUE) {
-        if (self->closehandle) {
-            if (self->fd >= 0) {
-                _Py_BEGIN_SUPPRESS_IPH
-                close(self->fd);
-                _Py_END_SUPPRESS_IPH
-            }
-            CloseHandle(self->handle);
+    if (self->fd != -1) {
+        if (self->closefd) {
+            _Py_BEGIN_SUPPRESS_IPH
+            close(self->fd);
+            _Py_END_SUPPRESS_IPH
         }
-        self->handle = INVALID_HANDLE_VALUE;
         self->fd = -1;
     }
     return 0;
@@ -190,15 +182,15 @@
 /*[clinic input]
 _io._WindowsConsoleIO.close
 
-Close the handle.
+Close the console object.
 
-A closed handle cannot be used for further I/O operations.  close() may be
-called more than once without error.
+A closed console object cannot be used for further I/O operations.
+close() may be called more than once without error.
 [clinic start generated code]*/
 
 static PyObject *
 _io__WindowsConsoleIO_close_impl(winconsoleio *self)
-/*[clinic end generated code: output=27ef95b66c29057b input=185617e349ae4c7b]*/
+/*[clinic end generated code: output=27ef95b66c29057b input=68c4e5754f8136c2]*/
 {
     PyObject *res;
     PyObject *exc, *val, *tb;
@@ -206,8 +198,8 @@
     _Py_IDENTIFIER(close);
     res = _PyObject_CallMethodIdOneArg((PyObject*)&PyRawIOBase_Type,
                                        &PyId_close, (PyObject*)self);
-    if (!self->closehandle) {
-        self->handle = INVALID_HANDLE_VALUE;
+    if (!self->closefd) {
+        self->fd = -1;
         return res;
     }
     if (res == NULL)
@@ -229,12 +221,11 @@
 
     self = (winconsoleio *) type->tp_alloc(type, 0);
     if (self != NULL) {
-        self->handle = INVALID_HANDLE_VALUE;
         self->fd = -1;
         self->created = 0;
         self->readable = 0;
         self->writable = 0;
-        self->closehandle = 0;
+        self->closefd = 0;
         self->blksize = 0;
         self->weakreflist = NULL;
     }
@@ -269,22 +260,17 @@
     int rwa = 0;
     int fd = -1;
     int fd_is_own = 0;
+    HANDLE handle = NULL;
 
     assert(PyWindowsConsoleIO_Check(self));
-    if (self->handle >= 0) {
-        if (self->closehandle) {
+    if (self->fd >= 0) {
+        if (self->closefd) {
             /* Have to close the existing file first. */
             if (internal_close(self) < 0)
                 return -1;
         }
         else
-            self->handle = INVALID_HANDLE_VALUE;
-    }
-
-    if (PyFloat_Check(nameobj)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float");
-        return -1;
+            self->fd = -1;
     }
 
     fd = _PyLong_AsInt(nameobj);
@@ -347,14 +333,12 @@
         goto bad_mode;
 
     if (fd >= 0) {
-        _Py_BEGIN_SUPPRESS_IPH
-        self->handle = (HANDLE)_get_osfhandle(fd);
-        _Py_END_SUPPRESS_IPH
-        self->closehandle = 0;
+        handle = _Py_get_osfhandle_noraise(fd);
+        self->closefd = 0;
     } else {
         DWORD access = GENERIC_READ;
 
-        self->closehandle = 1;
+        self->closefd = 1;
         if (!closefd) {
             PyErr_SetString(PyExc_ValueError,
                 "Cannot use closefd=False with file name");
@@ -369,21 +353,31 @@
            on the specific access. This is required for modern names
            CONIN$ and CONOUT$, which allow reading/writing state as
            well as reading/writing content. */
-        self->handle = CreateFileW(name, GENERIC_READ | GENERIC_WRITE,
+        handle = CreateFileW(name, GENERIC_READ | GENERIC_WRITE,
             FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
-        if (self->handle == INVALID_HANDLE_VALUE)
-            self->handle = CreateFileW(name, access,
+        if (handle == INVALID_HANDLE_VALUE)
+            handle = CreateFileW(name, access,
                 FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
         Py_END_ALLOW_THREADS
 
-        if (self->handle == INVALID_HANDLE_VALUE) {
+        if (handle == INVALID_HANDLE_VALUE) {
             PyErr_SetExcFromWindowsErrWithFilenameObject(PyExc_OSError, GetLastError(), nameobj);
             goto error;
         }
+
+        if (self->writable)
+            self->fd = _Py_open_osfhandle_noraise(handle, _O_WRONLY | _O_BINARY);
+        else
+            self->fd = _Py_open_osfhandle_noraise(handle, _O_RDONLY | _O_BINARY);
+        if (self->fd < 0) {
+            CloseHandle(handle);
+            PyErr_SetFromErrnoWithFilenameObject(PyExc_OSError, nameobj);
+            goto error;
+        }
     }
 
     if (console_type == '\0')
-        console_type = _get_console_type(self->handle);
+        console_type = _get_console_type(handle);
 
     if (self->writable && console_type != 'w') {
         PyErr_SetString(PyExc_ValueError,
@@ -466,25 +460,14 @@
 
 Return the underlying file descriptor (an integer).
 
-fileno is only set when a file descriptor is used to open
-one of the standard streams.
-
 [clinic start generated code]*/
 
 static PyObject *
 _io__WindowsConsoleIO_fileno_impl(winconsoleio *self)
-/*[clinic end generated code: output=006fa74ce3b5cfbf input=079adc330ddaabe6]*/
+/*[clinic end generated code: output=006fa74ce3b5cfbf input=845c47ebbc3a2f67]*/
 {
-    if (self->fd < 0 && self->handle != INVALID_HANDLE_VALUE) {
-        _Py_BEGIN_SUPPRESS_IPH
-        if (self->writable)
-            self->fd = _open_osfhandle((intptr_t)self->handle, _O_WRONLY | _O_BINARY);
-        else
-            self->fd = _open_osfhandle((intptr_t)self->handle, _O_RDONLY | _O_BINARY);
-        _Py_END_SUPPRESS_IPH
-    }
     if (self->fd < 0)
-        return err_mode("fileno");
+        return err_closed();
     return PyLong_FromLong(self->fd);
 }
 
@@ -498,7 +481,7 @@
 _io__WindowsConsoleIO_readable_impl(winconsoleio *self)
 /*[clinic end generated code: output=daf9cef2743becf0 input=6be9defb5302daae]*/
 {
-    if (self->handle == INVALID_HANDLE_VALUE)
+    if (self->fd == -1)
         return err_closed();
     return PyBool_FromLong((long) self->readable);
 }
@@ -513,7 +496,7 @@
 _io__WindowsConsoleIO_writable_impl(winconsoleio *self)
 /*[clinic end generated code: output=e0a2ad7eae5abf67 input=cefbd8abc24df6a0]*/
 {
-    if (self->handle == INVALID_HANDLE_VALUE)
+    if (self->fd == -1)
         return err_closed();
     return PyBool_FromLong((long) self->writable);
 }
@@ -648,7 +631,7 @@
 static Py_ssize_t
 readinto(winconsoleio *self, char *buf, Py_ssize_t len)
 {
-    if (self->handle == INVALID_HANDLE_VALUE) {
+    if (self->fd == -1) {
         err_closed();
         return -1;
     }
@@ -663,6 +646,10 @@
         return -1;
     }
 
+    HANDLE handle = _Py_get_osfhandle(self->fd);
+    if (handle == INVALID_HANDLE_VALUE)
+        return -1;
+
     /* Each character may take up to 4 bytes in the final buffer.
        This is highly conservative, but necessary to avoid
        failure for any given Unicode input (e.g. \U0010ffff).
@@ -684,7 +671,7 @@
         return read_len;
 
     DWORD n;
-    wchar_t *wbuf = read_console_w(self->handle, wlen, &n);
+    wchar_t *wbuf = read_console_w(handle, wlen, &n);
     if (wbuf == NULL)
         return -1;
     if (n == 0) {
@@ -790,10 +777,15 @@
     DWORD bufsize, n, len = 0;
     PyObject *bytes;
     DWORD bytes_size, rn;
+    HANDLE handle;
 
-    if (self->handle == INVALID_HANDLE_VALUE)
+    if (self->fd == -1)
         return err_closed();
 
+    handle = _Py_get_osfhandle(self->fd);
+    if (handle == INVALID_HANDLE_VALUE)
+        return NULL;
+
     bufsize = BUFSIZ;
 
     buf = (wchar_t*)PyMem_Malloc((bufsize + 1) * sizeof(wchar_t));
@@ -825,7 +817,7 @@
             buf = tmp;
         }
 
-        subbuf = read_console_w(self->handle, bufsize - len, &n);
+        subbuf = read_console_w(handle, bufsize - len, &n);
 
         if (subbuf == NULL) {
             PyMem_Free(buf);
@@ -915,7 +907,7 @@
     PyObject *bytes;
     Py_ssize_t bytes_size;
 
-    if (self->handle == INVALID_HANDLE_VALUE)
+    if (self->fd == -1)
         return err_closed();
     if (!self->readable)
         return err_mode("reading");
@@ -965,12 +957,17 @@
     BOOL res = TRUE;
     wchar_t *wbuf;
     DWORD len, wlen, n = 0;
+    HANDLE handle;
 
-    if (self->handle == INVALID_HANDLE_VALUE)
+    if (self->fd == -1)
         return err_closed();
     if (!self->writable)
         return err_mode("writing");
 
+    handle = _Py_get_osfhandle(self->fd);
+    if (handle == INVALID_HANDLE_VALUE)
+        return NULL;
+
     if (!b->len) {
         return PyLong_FromLong(0);
     }
@@ -1001,7 +998,7 @@
     Py_BEGIN_ALLOW_THREADS
     wlen = MultiByteToWideChar(CP_UTF8, 0, b->buf, len, wbuf, wlen);
     if (wlen) {
-        res = WriteConsoleW(self->handle, wbuf, wlen, &n, NULL);
+        res = WriteConsoleW(handle, wbuf, wlen, &n, NULL);
         if (res && n < wlen) {
             /* Wrote fewer characters than expected, which means our
              * len value may be wrong. So recalculate it from the
@@ -1033,15 +1030,15 @@
 static PyObject *
 winconsoleio_repr(winconsoleio *self)
 {
-    if (self->handle == INVALID_HANDLE_VALUE)
+    if (self->fd == -1)
         return PyUnicode_FromFormat("<_io._WindowsConsoleIO [closed]>");
 
     if (self->readable)
         return PyUnicode_FromFormat("<_io._WindowsConsoleIO mode='rb' closefd=%s>",
-            self->closehandle ? "True" : "False");
+            self->closefd ? "True" : "False");
     if (self->writable)
         return PyUnicode_FromFormat("<_io._WindowsConsoleIO mode='wb' closefd=%s>",
-            self->closehandle ? "True" : "False");
+            self->closefd ? "True" : "False");
 
     PyErr_SetString(PyExc_SystemError, "_WindowsConsoleIO has invalid mode");
     return NULL;
@@ -1057,7 +1054,7 @@
 _io__WindowsConsoleIO_isatty_impl(winconsoleio *self)
 /*[clinic end generated code: output=9eac09d287c11bd7 input=9b91591dbe356f86]*/
 {
-    if (self->handle == INVALID_HANDLE_VALUE)
+    if (self->fd == -1)
         return err_closed();
 
     Py_RETURN_TRUE;
@@ -1083,13 +1080,13 @@
 static PyObject *
 get_closed(winconsoleio *self, void *closure)
 {
-    return PyBool_FromLong((long)(self->handle == INVALID_HANDLE_VALUE));
+    return PyBool_FromLong((long)(self->fd == -1));
 }
 
 static PyObject *
 get_closefd(winconsoleio *self, void *closure)
 {
-    return PyBool_FromLong((long)(self->closehandle));
+    return PyBool_FromLong((long)(self->closefd));
 }
 
 static PyObject *
diff --git a/Modules/_json.c b/Modules/_json.c
index faa3944..6f68c1f 100644
--- a/Modules/_json.c
+++ b/Modules/_json.c
@@ -79,7 +79,6 @@
 ascii_escape_unicode(PyObject *pystr);
 static PyObject *
 py_encode_basestring_ascii(PyObject* Py_UNUSED(self), PyObject *pystr);
-void init_json(void);
 static PyObject *
 scan_once_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_t *next_idx_ptr);
 static PyObject *
@@ -317,18 +316,22 @@
 raise_errmsg(const char *msg, PyObject *s, Py_ssize_t end)
 {
     /* Use JSONDecodeError exception to raise a nice looking ValueError subclass */
-    static PyObject *JSONDecodeError = NULL;
-    PyObject *exc;
-    if (JSONDecodeError == NULL) {
-        PyObject *decoder = PyImport_ImportModule("json.decoder");
-        if (decoder == NULL)
-            return;
-        JSONDecodeError = PyObject_GetAttrString(decoder, "JSONDecodeError");
-        Py_DECREF(decoder);
-        if (JSONDecodeError == NULL)
-            return;
+    _Py_static_string(PyId_decoder, "json.decoder");
+    PyObject *decoder = _PyImport_GetModuleId(&PyId_decoder);
+    if (decoder == NULL) {
+        return;
     }
+
+    _Py_IDENTIFIER(JSONDecodeError);
+    PyObject *JSONDecodeError = _PyObject_GetAttrId(decoder, &PyId_JSONDecodeError);
+    Py_DECREF(decoder);
+    if (JSONDecodeError == NULL) {
+        return;
+    }
+
+    PyObject *exc;
     exc = PyObject_CallFunction(JSONDecodeError, "zOn", msg, s, end);
+    Py_DECREF(JSONDecodeError);
     if (exc) {
         PyErr_SetObject(JSONDecodeError, exc);
         Py_DECREF(exc);
@@ -1308,28 +1311,28 @@
 {
     /* Return the JSON string representation of None, True, False */
     if (obj == Py_None) {
-        static PyObject *s_null = NULL;
+        _Py_static_string(PyId_null, "null");
+        PyObject *s_null = _PyUnicode_FromId(&PyId_null);
         if (s_null == NULL) {
-            s_null = PyUnicode_InternFromString("null");
+            return NULL;
         }
-        Py_XINCREF(s_null);
-        return s_null;
+        return Py_NewRef(s_null);
     }
     else if (obj == Py_True) {
-        static PyObject *s_true = NULL;
+        _Py_static_string(PyId_true, "true");
+        PyObject *s_true = _PyUnicode_FromId(&PyId_true);
         if (s_true == NULL) {
-            s_true = PyUnicode_InternFromString("true");
+            return NULL;
         }
-        Py_XINCREF(s_true);
-        return s_true;
+        return Py_NewRef(s_true);
     }
     else if (obj == Py_False) {
-        static PyObject *s_false = NULL;
+        _Py_static_string(PyId_false, "false");
+        PyObject *s_false = _PyUnicode_FromId(&PyId_false);
         if (s_false == NULL) {
-            s_false = PyUnicode_InternFromString("false");
+            return NULL;
         }
-        Py_XINCREF(s_false);
-        return s_false;
+        return Py_NewRef(s_false);
     }
     else {
         PyErr_SetString(PyExc_ValueError, "not a const");
@@ -1493,9 +1496,12 @@
                         PyObject *dct, Py_ssize_t indent_level)
 {
     /* Encode Python dict dct a JSON term */
-    static PyObject *open_dict = NULL;
-    static PyObject *close_dict = NULL;
-    static PyObject *empty_dict = NULL;
+    _Py_static_string(PyId_open_dict, "{");
+    _Py_static_string(PyId_close_dict, "}");
+    _Py_static_string(PyId_empty_dict, "{}");
+    PyObject *open_dict = _PyUnicode_FromId(&PyId_open_dict);    // borrowed ref
+    PyObject *close_dict = _PyUnicode_FromId(&PyId_close_dict);  // borrowed ref
+    PyObject *empty_dict = _PyUnicode_FromId(&PyId_empty_dict);  // borrowed ref
     PyObject *kstr = NULL;
     PyObject *ident = NULL;
     PyObject *it = NULL;
@@ -1504,11 +1510,7 @@
     Py_ssize_t idx;
 
     if (open_dict == NULL || close_dict == NULL || empty_dict == NULL) {
-        open_dict = PyUnicode_InternFromString("{");
-        close_dict = PyUnicode_InternFromString("}");
-        empty_dict = PyUnicode_InternFromString("{}");
-        if (open_dict == NULL || close_dict == NULL || empty_dict == NULL)
-            return -1;
+        return -1;
     }
     if (PyDict_GET_SIZE(dct) == 0)  /* Fast path */
         return _PyAccu_Accumulate(acc, empty_dict);
@@ -1650,19 +1652,18 @@
                         PyObject *seq, Py_ssize_t indent_level)
 {
     /* Encode Python list seq to a JSON term */
-    static PyObject *open_array = NULL;
-    static PyObject *close_array = NULL;
-    static PyObject *empty_array = NULL;
+    _Py_static_string(PyId_open_array, "[");
+    _Py_static_string(PyId_close_array, "]");
+    _Py_static_string(PyId_empty_array, "[]");
+    PyObject *open_array = _PyUnicode_FromId(&PyId_open_array);   // borrowed ref
+    PyObject *close_array = _PyUnicode_FromId(&PyId_close_array); // borrowed ref
+    PyObject *empty_array = _PyUnicode_FromId(&PyId_empty_array); // borrowed ref
     PyObject *ident = NULL;
     PyObject *s_fast = NULL;
     Py_ssize_t i;
 
     if (open_array == NULL || close_array == NULL || empty_array == NULL) {
-        open_array = PyUnicode_InternFromString("[");
-        close_array = PyUnicode_InternFromString("]");
-        empty_array = PyUnicode_InternFromString("[]");
-        if (open_array == NULL || close_array == NULL || empty_array == NULL)
-            return -1;
+        return -1;
     }
     ident = NULL;
     s_fast = PySequence_Fast(seq, "_iterencode_list needs a sequence");
diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c
index 2e353bb..564f559 100644
--- a/Modules/_localemodule.c
+++ b/Modules/_localemodule.c
@@ -53,10 +53,14 @@
     return (_locale_state *)state;
 }
 
-/* support functions for formatting floating point numbers */
+#include "clinic/_localemodule.c.h"
 
-PyDoc_STRVAR(setlocale__doc__,
-"(integer,string=None) -> string. Activates/queries locale processing.");
+/*[clinic input]
+module _locale
+[clinic start generated code]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=ed98569b726feada]*/
+
+/* support functions for formatting floating point numbers */
 
 /* the grouping is terminated by either 0 or CHAR_MAX */
 static PyObject*
@@ -91,20 +95,27 @@
     return result;
 }
 
-static PyObject*
-PyLocale_setlocale(PyObject* self, PyObject* args)
-{
-    int category;
-    char *locale = NULL, *result;
-    PyObject *result_object;
+/*[clinic input]
+_locale.setlocale
 
-    if (!PyArg_ParseTuple(args, "i|z:setlocale", &category, &locale))
-        return NULL;
+    category: int
+    locale: str(accept={str, NoneType}) = NULL
+    /
+
+Activates/queries locale processing.
+[clinic start generated code]*/
+
+static PyObject *
+_locale_setlocale_impl(PyObject *module, int category, const char *locale)
+/*[clinic end generated code: output=a0e777ae5d2ff117 input=dbe18f1d66c57a6a]*/
+{
+    char *result;
+    PyObject *result_object;
 
 #if defined(MS_WINDOWS)
     if (category < LC_MIN || category > LC_MAX)
     {
-        PyErr_SetString(get_locale_state(self)->Error,
+        PyErr_SetString(get_locale_state(module)->Error,
                         "invalid locale category");
         return NULL;
     }
@@ -115,7 +126,7 @@
         result = setlocale(category, locale);
         if (!result) {
             /* operation failed, no setting was changed */
-            PyErr_SetString(get_locale_state(self)->Error,
+            PyErr_SetString(get_locale_state(module)->Error,
                             "unsupported locale setting");
             return NULL;
         }
@@ -126,7 +137,7 @@
         /* get locale */
         result = setlocale(category, NULL);
         if (!result) {
-            PyErr_SetString(get_locale_state(self)->Error,
+            PyErr_SetString(get_locale_state(module)->Error,
                             "locale query failed");
             return NULL;
         }
@@ -221,11 +232,15 @@
     return res;
 }
 
-PyDoc_STRVAR(localeconv__doc__,
-"() -> dict. Returns numeric and monetary locale-specific parameters.");
+/*[clinic input]
+_locale.localeconv
 
-static PyObject*
-PyLocale_localeconv(PyObject* self, PyObject *Py_UNUSED(ignored))
+Returns numeric and monetary locale-specific parameters.
+[clinic start generated code]*/
+
+static PyObject *
+_locale_localeconv_impl(PyObject *module)
+/*[clinic end generated code: output=43a54515e0a2aef5 input=f1132d15accf4444]*/
 {
     PyObject* result;
     struct lconv *lc;
@@ -326,17 +341,24 @@
 }
 
 #if defined(HAVE_WCSCOLL)
-PyDoc_STRVAR(strcoll__doc__,
-"string,string -> int. Compares two strings according to the locale.");
 
-static PyObject*
-PyLocale_strcoll(PyObject* self, PyObject* args)
+/*[clinic input]
+_locale.strcoll
+
+    os1: unicode
+    os2: unicode
+    /
+
+Compares two strings according to the locale.
+[clinic start generated code]*/
+
+static PyObject *
+_locale_strcoll_impl(PyObject *module, PyObject *os1, PyObject *os2)
+/*[clinic end generated code: output=82ddc6d62c76d618 input=693cd02bcbf38dd8]*/
 {
-    PyObject *os1, *os2, *result = NULL;
+    PyObject *result = NULL;
     wchar_t *ws1 = NULL, *ws2 = NULL;
 
-    if (!PyArg_ParseTuple(args, "UU:strcoll", &os1, &os2))
-        return NULL;
     /* Convert the unicode strings to wchar[]. */
     ws1 = PyUnicode_AsWideCharString(os1, NULL);
     if (ws1 == NULL)
@@ -348,30 +370,32 @@
     result = PyLong_FromLong(wcscoll(ws1, ws2));
   done:
     /* Deallocate everything. */
-    if (ws1) PyMem_FREE(ws1);
-    if (ws2) PyMem_FREE(ws2);
+    if (ws1) PyMem_Free(ws1);
+    if (ws2) PyMem_Free(ws2);
     return result;
 }
 #endif
 
 #ifdef HAVE_WCSXFRM
-PyDoc_STRVAR(strxfrm__doc__,
-"strxfrm(string) -> string.\n\
-\n\
-Return a string that can be used as a key for locale-aware comparisons.");
 
-static PyObject*
-PyLocale_strxfrm(PyObject* self, PyObject* args)
+/*[clinic input]
+_locale.strxfrm
+
+    string as str: unicode
+    /
+
+Return a string that can be used as a key for locale-aware comparisons.
+[clinic start generated code]*/
+
+static PyObject *
+_locale_strxfrm_impl(PyObject *module, PyObject *str)
+/*[clinic end generated code: output=3081866ebffc01af input=1378bbe6a88b4780]*/
 {
-    PyObject *str;
     Py_ssize_t n1;
     wchar_t *s = NULL, *buf = NULL;
     size_t n2;
     PyObject *result = NULL;
 
-    if (!PyArg_ParseTuple(args, "U:strxfrm", &str))
-        return NULL;
-
     s = PyUnicode_AsWideCharString(str, &n1);
     if (s == NULL)
         goto exit;
@@ -418,8 +442,15 @@
 #endif
 
 #if defined(MS_WINDOWS)
-static PyObject*
-PyLocale_getdefaultlocale(PyObject* self, PyObject *Py_UNUSED(ignored))
+
+/*[clinic input]
+_locale._getdefaultlocale
+
+[clinic start generated code]*/
+
+static PyObject *
+_locale__getdefaultlocale_impl(PyObject *module)
+/*[clinic end generated code: output=e6254088579534c2 input=003ea41acd17f7c7]*/
 {
     char encoding[20];
     char locale[100];
@@ -525,7 +556,6 @@
     LANGINFO(PM_STR),
 
     /* The following constants are available only with XPG4, but...
-       AIX 3.2. only has CODESET.
        OpenBSD doesn't have CODESET but has T_FMT_AMPM, and doesn't have
        a few of the others.
        Solution: ifdef-test them all. */
@@ -563,16 +593,20 @@
     {0, 0}
 };
 
-PyDoc_STRVAR(nl_langinfo__doc__,
-"nl_langinfo(key) -> string\n"
-"Return the value for the locale information associated with key.");
+/*[clinic input]
+_locale.nl_langinfo
 
-static PyObject*
-PyLocale_nl_langinfo(PyObject* self, PyObject* args)
+    key as item: int
+    /
+
+Return the value for the locale information associated with key.
+[clinic start generated code]*/
+
+static PyObject *
+_locale_nl_langinfo_impl(PyObject *module, int item)
+/*[clinic end generated code: output=6aea457b47e077a3 input=00798143eecfeddc]*/
 {
-    int item, i;
-    if (!PyArg_ParseTuple(args, "i:nl_langinfo", &item))
-        return NULL;
+    int i;
     /* Check whether this is a supported constant. GNU libc sometimes
        returns numeric values in the char* return value, which would
        crash PyUnicode_FromString.  */
@@ -591,56 +625,75 @@
 
 #ifdef HAVE_LIBINTL_H
 
-PyDoc_STRVAR(gettext__doc__,
-"gettext(msg) -> string\n"
-"Return translation of msg.");
+/*[clinic input]
+_locale.gettext
 
-static PyObject*
-PyIntl_gettext(PyObject* self, PyObject *args)
+    msg as in: str
+    /
+
+gettext(msg) -> string
+
+Return translation of msg.
+[clinic start generated code]*/
+
+static PyObject *
+_locale_gettext_impl(PyObject *module, const char *in)
+/*[clinic end generated code: output=493bb4b38a4704fe input=949fc8efc2bb3bc3]*/
 {
-    char *in;
-    if (!PyArg_ParseTuple(args, "s", &in))
-        return 0;
     return PyUnicode_DecodeLocale(gettext(in), NULL);
 }
 
-PyDoc_STRVAR(dgettext__doc__,
-"dgettext(domain, msg) -> string\n"
-"Return translation of msg in domain.");
+/*[clinic input]
+_locale.dgettext
 
-static PyObject*
-PyIntl_dgettext(PyObject* self, PyObject *args)
+    domain: str(accept={str, NoneType})
+    msg as in: str
+    /
+
+dgettext(domain, msg) -> string
+
+Return translation of msg in domain.
+[clinic start generated code]*/
+
+static PyObject *
+_locale_dgettext_impl(PyObject *module, const char *domain, const char *in)
+/*[clinic end generated code: output=3c0cd5287b972c8f input=a277388a635109d8]*/
 {
-    char *domain, *in;
-    if (!PyArg_ParseTuple(args, "zs", &domain, &in))
-        return 0;
     return PyUnicode_DecodeLocale(dgettext(domain, in), NULL);
 }
 
-PyDoc_STRVAR(dcgettext__doc__,
-"dcgettext(domain, msg, category) -> string\n"
-"Return translation of msg in domain and category.");
+/*[clinic input]
+_locale.dcgettext
 
-static PyObject*
-PyIntl_dcgettext(PyObject *self, PyObject *args)
+    domain: str(accept={str, NoneType})
+    msg as msgid: str
+    category: int
+    /
+
+Return translation of msg in domain and category.
+[clinic start generated code]*/
+
+static PyObject *
+_locale_dcgettext_impl(PyObject *module, const char *domain,
+                       const char *msgid, int category)
+/*[clinic end generated code: output=0f4cc4fce0aa283f input=ec5f8fed4336de67]*/
 {
-    char *domain, *msgid;
-    int category;
-    if (!PyArg_ParseTuple(args, "zsi", &domain, &msgid, &category))
-        return 0;
     return PyUnicode_DecodeLocale(dcgettext(domain,msgid,category), NULL);
 }
 
-PyDoc_STRVAR(textdomain__doc__,
-"textdomain(domain) -> string\n"
-"Set the C library's textdmain to domain, returning the new domain.");
+/*[clinic input]
+_locale.textdomain
 
-static PyObject*
-PyIntl_textdomain(PyObject* self, PyObject* args)
+    domain: str(accept={str, NoneType})
+    /
+
+Set the C library's textdmain to domain, returning the new domain.
+[clinic start generated code]*/
+
+static PyObject *
+_locale_textdomain_impl(PyObject *module, const char *domain)
+/*[clinic end generated code: output=7992df06aadec313 input=66359716f5eb1d38]*/
 {
-    char *domain;
-    if (!PyArg_ParseTuple(args, "z", &domain))
-        return 0;
     domain = textdomain(domain);
     if (!domain) {
         PyErr_SetFromErrno(PyExc_OSError);
@@ -649,20 +702,26 @@
     return PyUnicode_DecodeLocale(domain, NULL);
 }
 
-PyDoc_STRVAR(bindtextdomain__doc__,
-"bindtextdomain(domain, dir) -> string\n"
-"Bind the C library's domain to dir.");
+/*[clinic input]
+_locale.bindtextdomain
 
-static PyObject*
-PyIntl_bindtextdomain(PyObject* self, PyObject*args)
+    domain: str
+    dir as dirname_obj: object
+    /
+
+Bind the C library's domain to dir.
+[clinic start generated code]*/
+
+static PyObject *
+_locale_bindtextdomain_impl(PyObject *module, const char *domain,
+                            PyObject *dirname_obj)
+/*[clinic end generated code: output=6d6f3c7b345d785c input=c0dff085acfe272b]*/
 {
-    const char *domain, *dirname, *current_dirname;
-    PyObject *dirname_obj, *dirname_bytes = NULL, *result;
+    const char *dirname, *current_dirname;
+    PyObject *dirname_bytes = NULL, *result;
 
-    if (!PyArg_ParseTuple(args, "sO", &domain, &dirname_obj))
-        return 0;
     if (!strlen(domain)) {
-        PyErr_SetString(get_locale_state(self)->Error,
+        PyErr_SetString(get_locale_state(module)->Error,
                         "domain must be a non-empty string");
         return 0;
     }
@@ -686,61 +745,73 @@
 }
 
 #ifdef HAVE_BIND_TEXTDOMAIN_CODESET
-PyDoc_STRVAR(bind_textdomain_codeset__doc__,
-"bind_textdomain_codeset(domain, codeset) -> string\n"
-"Bind the C library's domain to codeset.");
 
-static PyObject*
-PyIntl_bind_textdomain_codeset(PyObject* self,PyObject*args)
+/*[clinic input]
+_locale.bind_textdomain_codeset
+
+    domain: str
+    codeset: str(accept={str, NoneType})
+    /
+
+Bind the C library's domain to codeset.
+[clinic start generated code]*/
+
+static PyObject *
+_locale_bind_textdomain_codeset_impl(PyObject *module, const char *domain,
+                                     const char *codeset)
+/*[clinic end generated code: output=fa452f9c8b1b9e89 input=23fbe3540400f259]*/
 {
-    char *domain,*codeset;
-    if (!PyArg_ParseTuple(args, "sz", &domain, &codeset))
-        return NULL;
     codeset = bind_textdomain_codeset(domain, codeset);
     if (codeset) {
         return PyUnicode_DecodeLocale(codeset, NULL);
     }
     Py_RETURN_NONE;
 }
-#endif
+#endif  // HAVE_BIND_TEXTDOMAIN_CODESET
 
-#endif
+#endif  // HAVE_LIBINTL_H
+
+
+/*[clinic input]
+_locale._get_locale_encoding
+
+Get the current locale encoding.
+[clinic start generated code]*/
+
+static PyObject *
+_locale__get_locale_encoding_impl(PyObject *module)
+/*[clinic end generated code: output=e8e2f6f6f184591a input=513d9961d2f45c76]*/
+{
+    return _Py_GetLocaleEncodingObject();
+}
+
 
 static struct PyMethodDef PyLocale_Methods[] = {
-  {"setlocale", (PyCFunction) PyLocale_setlocale,
-   METH_VARARGS, setlocale__doc__},
-  {"localeconv", PyLocale_localeconv, METH_NOARGS, localeconv__doc__},
+    _LOCALE_SETLOCALE_METHODDEF
+    _LOCALE_LOCALECONV_METHODDEF
 #ifdef HAVE_WCSCOLL
-  {"strcoll", (PyCFunction) PyLocale_strcoll,
-   METH_VARARGS, strcoll__doc__},
+    _LOCALE_STRCOLL_METHODDEF
 #endif
 #ifdef HAVE_WCSXFRM
-  {"strxfrm", (PyCFunction) PyLocale_strxfrm,
-   METH_VARARGS, strxfrm__doc__},
+    _LOCALE_STRXFRM_METHODDEF
 #endif
 #if defined(MS_WINDOWS)
-  {"_getdefaultlocale", PyLocale_getdefaultlocale, METH_NOARGS},
+    _LOCALE__GETDEFAULTLOCALE_METHODDEF
 #endif
 #ifdef HAVE_LANGINFO_H
-  {"nl_langinfo", (PyCFunction) PyLocale_nl_langinfo,
-   METH_VARARGS, nl_langinfo__doc__},
+    _LOCALE_NL_LANGINFO_METHODDEF
 #endif
 #ifdef HAVE_LIBINTL_H
-  {"gettext",(PyCFunction)PyIntl_gettext,METH_VARARGS,
-    gettext__doc__},
-  {"dgettext",(PyCFunction)PyIntl_dgettext,METH_VARARGS,
-   dgettext__doc__},
-  {"dcgettext",(PyCFunction)PyIntl_dcgettext,METH_VARARGS,
-    dcgettext__doc__},
-  {"textdomain",(PyCFunction)PyIntl_textdomain,METH_VARARGS,
-   textdomain__doc__},
-  {"bindtextdomain",(PyCFunction)PyIntl_bindtextdomain,METH_VARARGS,
-   bindtextdomain__doc__},
+    _LOCALE_GETTEXT_METHODDEF
+    _LOCALE_DGETTEXT_METHODDEF
+    _LOCALE_DCGETTEXT_METHODDEF
+    _LOCALE_TEXTDOMAIN_METHODDEF
+    _LOCALE_BINDTEXTDOMAIN_METHODDEF
 #ifdef HAVE_BIND_TEXTDOMAIN_CODESET
-  {"bind_textdomain_codeset",(PyCFunction)PyIntl_bind_textdomain_codeset,
-   METH_VARARGS, bind_textdomain_codeset__doc__},
+    _LOCALE_BIND_TEXTDOMAIN_CODESET_METHODDEF
 #endif
 #endif
+    _LOCALE__GET_LOCALE_ENCODING_METHODDEF
   {NULL, NULL}
 };
 
diff --git a/Modules/_lsprof.c b/Modules/_lsprof.c
index 5e53d83..703067c 100644
--- a/Modules/_lsprof.c
+++ b/Modules/_lsprof.c
@@ -50,10 +50,27 @@
 #define POF_BUILTINS    0x004
 #define POF_NOMEMORY    0x100
 
-static PyTypeObject PyProfiler_Type;
+/*[clinic input]
+module _lsprof
+class _lsprof.Profiler "ProfilerObject *" "&ProfilerType"
+[clinic start generated code]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=e349ac952152f336]*/
 
-#define PyProfiler_Check(op) PyObject_TypeCheck(op, &PyProfiler_Type)
-#define PyProfiler_CheckExact(op) Py_IS_TYPE(op, &PyProfiler_Type)
+#include "clinic/_lsprof.c.h"
+
+typedef struct {
+    PyTypeObject *profiler_type;
+    PyTypeObject *stats_entry_type;
+    PyTypeObject *stats_subentry_type;
+} _lsprof_state;
+
+static inline _lsprof_state*
+_lsprof_get_state(PyObject *module)
+{
+    void *state = PyModule_GetState(module);
+    assert(state != NULL);
+    return (_lsprof_state *)state;
+}
 
 /*** External Timers ***/
 
@@ -471,28 +488,24 @@
 };
 
 static PyStructSequence_Desc profiler_entry_desc = {
-    "_lsprof.profiler_entry", /* name */
-    NULL, /* doc */
-    profiler_entry_fields,
-    6
+    .name = "_lsprof.profiler_entry",
+    .fields = profiler_entry_fields,
+    .doc = NULL,
+    .n_in_sequence = 6
 };
 
 static PyStructSequence_Desc profiler_subentry_desc = {
-    "_lsprof.profiler_subentry", /* name */
-    NULL, /* doc */
-    profiler_subentry_fields,
-    5
+    .name = "_lsprof.profiler_subentry",
+    .fields = profiler_subentry_fields,
+    .doc = NULL,
+    .n_in_sequence = 5
 };
 
-static int initialized;
-static PyTypeObject StatsEntryType;
-static PyTypeObject StatsSubEntryType;
-
-
 typedef struct {
     PyObject *list;
     PyObject *sublist;
     double factor;
+    _lsprof_state *state;
 } statscollector_t;
 
 static int statsForSubEntry(rotating_node_t *node, void *arg)
@@ -502,7 +515,7 @@
     ProfilerEntry *entry = (ProfilerEntry*) sentry->header.key;
     int err;
     PyObject *sinfo;
-    sinfo = PyObject_CallFunction((PyObject*) &StatsSubEntryType,
+    sinfo = PyObject_CallFunction((PyObject*) collect->state->stats_subentry_type,
                                   "((Olldd))",
                                   entry->userObj,
                                   sentry->callcount,
@@ -540,7 +553,7 @@
         collect->sublist = Py_None;
     }
 
-    info = PyObject_CallFunction((PyObject*) &StatsEntryType,
+    info = PyObject_CallFunction((PyObject*) collect->state->stats_entry_type,
                                  "((OllddO))",
                                  entry->userObj,
                                  entry->callcount,
@@ -556,49 +569,57 @@
     return err;
 }
 
-PyDoc_STRVAR(getstats_doc, "\
-getstats() -> list of profiler_entry objects\n\
-\n\
-Return all information collected by the profiler.\n\
-Each profiler_entry is a tuple-like object with the\n\
-following attributes:\n\
-\n\
-    code          code object\n\
-    callcount     how many times this was called\n\
-    reccallcount  how many times called recursively\n\
-    totaltime     total time in this entry\n\
-    inlinetime    inline time in this entry (not in subcalls)\n\
-    calls         details of the calls\n\
-\n\
-The calls attribute is either None or a list of\n\
-profiler_subentry objects:\n\
-\n\
-    code          called code object\n\
-    callcount     how many times this is called\n\
-    reccallcount  how many times this is called recursively\n\
-    totaltime     total time spent in this call\n\
-    inlinetime    inline time (not in further subcalls)\n\
-");
+/*[clinic input]
+_lsprof.Profiler.getstats
 
-static PyObject*
-profiler_getstats(ProfilerObject *pObj, PyObject* noarg)
+    cls: defining_class
+
+list of profiler_entry objects.
+
+getstats() -> list of profiler_entry objects
+
+Return all information collected by the profiler.
+Each profiler_entry is a tuple-like object with the
+following attributes:
+
+    code          code object
+    callcount     how many times this was called
+    reccallcount  how many times called recursively
+    totaltime     total time in this entry
+    inlinetime    inline time in this entry (not in subcalls)
+    calls         details of the calls
+
+The calls attribute is either None or a list of
+profiler_subentry objects:
+
+    code          called code object
+    callcount     how many times this is called
+    reccallcount  how many times this is called recursively
+    totaltime     total time spent in this call
+    inlinetime    inline time (not in further subcalls)
+[clinic start generated code]*/
+
+static PyObject *
+_lsprof_Profiler_getstats_impl(ProfilerObject *self, PyTypeObject *cls)
+/*[clinic end generated code: output=1806ef720019ee03 input=445e193ef4522902]*/
 {
     statscollector_t collect;
-    if (pending_exception(pObj)) {
+    collect.state = PyType_GetModuleState(cls);
+    if (pending_exception(self)) {
         return NULL;
     }
-    if (!pObj->externalTimer || pObj->externalTimerUnit == 0.0) {
+    if (!self->externalTimer || self->externalTimerUnit == 0.0) {
         _PyTime_t onesec = _PyTime_FromSeconds(1);
         collect.factor = (double)1 / onesec;
     }
     else {
-        collect.factor = pObj->externalTimerUnit;
+        collect.factor = self->externalTimerUnit;
     }
 
     collect.list = PyList_New(0);
     if (collect.list == NULL)
         return NULL;
-    if (RotatingTree_Enum(pObj->profilerEntries, statsForEntry, &collect)
+    if (RotatingTree_Enum(self->profilerEntries, statsForEntry, &collect)
         != 0) {
         Py_DECREF(collect.list);
         return NULL;
@@ -710,6 +731,13 @@
     Py_RETURN_NONE;
 }
 
+static int
+profiler_traverse(ProfilerObject *op, visitproc visit, void *arg)
+{
+    Py_VISIT(Py_TYPE(op));
+    return 0;
+}
+
 static void
 profiler_dealloc(ProfilerObject *op)
 {
@@ -723,7 +751,9 @@
     flush_unmatched(op);
     clearEntries(op);
     Py_XDECREF(op->externalTimer);
-    Py_TYPE(op)->tp_free(op);
+    PyTypeObject *tp = Py_TYPE(op);
+    tp->tp_free(op);
+    Py_DECREF(tp);
 }
 
 static int
@@ -750,8 +780,7 @@
 }
 
 static PyMethodDef profiler_methods[] = {
-    {"getstats",    (PyCFunction)profiler_getstats,
-                    METH_NOARGS,                        getstats_doc},
+    _LSPROF_PROFILER_GETSTATS_METHODDEF
     {"enable",          (PyCFunction)(void(*)(void))profiler_enable,
                     METH_VARARGS | METH_KEYWORDS,       enable_doc},
     {"disable",         (PyCFunction)profiler_disable,
@@ -771,91 +800,106 @@
     is, in seconds).\n\
 ");
 
-static PyTypeObject PyProfiler_Type = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "_lsprof.Profiler",                     /* tp_name */
-    sizeof(ProfilerObject),                 /* tp_basicsize */
-    0,                                      /* tp_itemsize */
-    (destructor)profiler_dealloc,           /* tp_dealloc */
-    0,                                      /* tp_vectorcall_offset */
-    0,                                      /* tp_getattr */
-    0,                                      /* tp_setattr */
-    0,                                      /* tp_as_async */
-    0,                                      /* tp_repr */
-    0,                                      /* tp_as_number */
-    0,                                      /* tp_as_sequence */
-    0,                                      /* tp_as_mapping */
-    0,                                      /* tp_hash */
-    0,                                      /* tp_call */
-    0,                                      /* tp_str */
-    0,                                      /* tp_getattro */
-    0,                                      /* tp_setattro */
-    0,                                      /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
-    profiler_doc,                           /* tp_doc */
-    0,                                      /* tp_traverse */
-    0,                                      /* tp_clear */
-    0,                                      /* tp_richcompare */
-    0,                                      /* tp_weaklistoffset */
-    0,                                      /* tp_iter */
-    0,                                      /* tp_iternext */
-    profiler_methods,                       /* tp_methods */
-    0,                                      /* tp_members */
-    0,                                      /* tp_getset */
-    0,                                      /* tp_base */
-    0,                                      /* tp_dict */
-    0,                                      /* tp_descr_get */
-    0,                                      /* tp_descr_set */
-    0,                                      /* tp_dictoffset */
-    (initproc)profiler_init,                /* tp_init */
-    PyType_GenericAlloc,                    /* tp_alloc */
-    PyType_GenericNew,                      /* tp_new */
-    PyObject_Del,                           /* tp_free */
+static PyType_Slot _lsprof_profiler_type_spec_slots[] = {
+    {Py_tp_doc, (void *)profiler_doc},
+    {Py_tp_methods, profiler_methods},
+    {Py_tp_dealloc, profiler_dealloc},
+    {Py_tp_init, profiler_init},
+    {Py_tp_traverse, profiler_traverse},
+    {0, 0}
+};
+
+static PyType_Spec _lsprof_profiler_type_spec = {
+    .name = "_lsprof.Profiler",
+    .basicsize = sizeof(ProfilerObject),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
+              Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = _lsprof_profiler_type_spec_slots,
 };
 
 static PyMethodDef moduleMethods[] = {
     {NULL, NULL}
 };
 
+static int
+_lsprof_traverse(PyObject *module, visitproc visit, void *arg)
+{
+    _lsprof_state *state = _lsprof_get_state(module);
+    Py_VISIT(state->profiler_type);
+    Py_VISIT(state->stats_entry_type);
+    Py_VISIT(state->stats_subentry_type);
+    return 0;
+}
+
+static int
+_lsprof_clear(PyObject *module)
+{
+    _lsprof_state *state = _lsprof_get_state(module);
+    Py_CLEAR(state->profiler_type);
+    Py_CLEAR(state->stats_entry_type);
+    Py_CLEAR(state->stats_subentry_type);
+    return 0;
+}
+
+static void
+_lsprof_free(void *module)
+{
+    _lsprof_clear((PyObject *)module);
+}
+
+static int
+_lsprof_exec(PyObject *module)
+{
+    _lsprof_state *state = PyModule_GetState(module);
+
+    state->profiler_type = (PyTypeObject *)PyType_FromModuleAndSpec(
+        module, &_lsprof_profiler_type_spec, NULL);
+    if (state->profiler_type == NULL) {
+        return -1;
+    }
+
+    if (PyModule_AddType(module, state->profiler_type) < 0) {
+        return -1;
+    }
+
+    state->stats_entry_type = PyStructSequence_NewType(&profiler_entry_desc);
+    if (state->stats_entry_type == NULL) {
+        return -1;
+    }
+    if (PyModule_AddType(module, state->stats_entry_type) < 0) {
+        return -1;
+    }
+
+    state->stats_subentry_type = PyStructSequence_NewType(&profiler_subentry_desc);
+    if (state->stats_subentry_type == NULL) {
+        return -1;
+    }
+    if (PyModule_AddType(module, state->stats_subentry_type) < 0) {
+        return -1;
+    }
+
+    return 0;
+}
+
+static PyModuleDef_Slot _lsprofslots[] = {
+    {Py_mod_exec, _lsprof_exec},
+    {0, NULL}
+};
 
 static struct PyModuleDef _lsprofmodule = {
     PyModuleDef_HEAD_INIT,
-    "_lsprof",
-    "Fast profiler",
-    -1,
-    moduleMethods,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    .m_name = "_lsprof",
+    .m_doc = "Fast profiler",
+    .m_size = sizeof(_lsprof_state),
+    .m_methods = moduleMethods,
+    .m_slots = _lsprofslots,
+    .m_traverse = _lsprof_traverse,
+    .m_clear = _lsprof_clear,
+    .m_free = _lsprof_free
 };
 
 PyMODINIT_FUNC
 PyInit__lsprof(void)
 {
-    PyObject *module, *d;
-    module = PyModule_Create(&_lsprofmodule);
-    if (module == NULL)
-        return NULL;
-    d = PyModule_GetDict(module);
-    if (PyType_Ready(&PyProfiler_Type) < 0)
-        return NULL;
-    PyDict_SetItemString(d, "Profiler", (PyObject *)&PyProfiler_Type);
-
-    if (!initialized) {
-        if (PyStructSequence_InitType2(&StatsEntryType,
-                                       &profiler_entry_desc) < 0)
-            return NULL;
-        if (PyStructSequence_InitType2(&StatsSubEntryType,
-                                       &profiler_subentry_desc) < 0)
-            return NULL;
-    }
-    Py_INCREF((PyObject*) &StatsEntryType);
-    Py_INCREF((PyObject*) &StatsSubEntryType);
-    PyModule_AddObject(module, "profiler_entry",
-                       (PyObject*) &StatsEntryType);
-    PyModule_AddObject(module, "profiler_subentry",
-                       (PyObject*) &StatsSubEntryType);
-    initialized = 1;
-    return module;
+    return PyModuleDef_Init(&_lsprofmodule);
 }
diff --git a/Modules/_lzmamodule.c b/Modules/_lzmamodule.c
index 2a62a68..915c0c9 100644
--- a/Modules/_lzmamodule.c
+++ b/Modules/_lzmamodule.c
@@ -15,6 +15,60 @@
 
 #include <lzma.h>
 
+// Blocks output buffer wrappers
+#include "pycore_blocks_output_buffer.h"
+
+#if OUTPUT_BUFFER_MAX_BLOCK_SIZE > SIZE_MAX
+    #error "The maximum block size accepted by liblzma is SIZE_MAX."
+#endif
+
+/* On success, return value >= 0
+   On failure, return -1 */
+static inline Py_ssize_t
+OutputBuffer_InitAndGrow(_BlocksOutputBuffer *buffer, Py_ssize_t max_length,
+                         uint8_t **next_out, size_t *avail_out)
+{
+    Py_ssize_t allocated;
+
+    allocated = _BlocksOutputBuffer_InitAndGrow(
+                    buffer, max_length, (void**) next_out);
+    *avail_out = (size_t) allocated;
+    return allocated;
+}
+
+/* On success, return value >= 0
+   On failure, return -1 */
+static inline Py_ssize_t
+OutputBuffer_Grow(_BlocksOutputBuffer *buffer,
+                  uint8_t **next_out, size_t *avail_out)
+{
+    Py_ssize_t allocated;
+
+    allocated = _BlocksOutputBuffer_Grow(
+                    buffer, (void**) next_out, (Py_ssize_t) *avail_out);
+    *avail_out = (size_t) allocated;
+    return allocated;
+}
+
+static inline Py_ssize_t
+OutputBuffer_GetDataSize(_BlocksOutputBuffer *buffer, size_t avail_out)
+{
+    return _BlocksOutputBuffer_GetDataSize(buffer, (Py_ssize_t) avail_out);
+}
+
+static inline PyObject *
+OutputBuffer_Finish(_BlocksOutputBuffer *buffer, size_t avail_out)
+{
+    return _BlocksOutputBuffer_Finish(buffer, (Py_ssize_t) avail_out);
+}
+
+static inline void
+OutputBuffer_OnError(_BlocksOutputBuffer *buffer)
+{
+    _BlocksOutputBuffer_OnError(buffer);
+}
+
+
 #define ACQUIRE_LOCK(obj) do { \
     if (!PyThread_acquire_lock((obj)->lock, 0)) { \
         Py_BEGIN_ALLOW_THREADS \
@@ -23,6 +77,20 @@
     } } while (0)
 #define RELEASE_LOCK(obj) PyThread_release_lock((obj)->lock)
 
+typedef struct {
+    PyTypeObject *lzma_compressor_type;
+    PyTypeObject *lzma_decompressor_type;
+    PyObject *error;
+    PyObject *empty_tuple;
+} _lzma_state;
+
+static inline _lzma_state*
+get_lzma_state(PyObject *module)
+{
+    void *state = PyModule_GetState(module);
+    assert(state != NULL);
+    return (_lzma_state *)state;
+}
 
 /* Container formats: */
 enum {
@@ -56,17 +124,10 @@
     PyThread_type_lock lock;
 } Decompressor;
 
-/* LZMAError class object. */
-static PyObject *Error;
-
-/* An empty tuple, used by the filter specifier parsing code. */
-static PyObject *empty_tuple;
-
-
 /* Helper functions. */
 
 static int
-catch_lzma_error(lzma_ret lzret)
+catch_lzma_error(_lzma_state *state, lzma_ret lzret)
 {
     switch (lzret) {
         case LZMA_OK:
@@ -75,31 +136,31 @@
         case LZMA_STREAM_END:
             return 0;
         case LZMA_UNSUPPORTED_CHECK:
-            PyErr_SetString(Error, "Unsupported integrity check");
+            PyErr_SetString(state->error, "Unsupported integrity check");
             return 1;
         case LZMA_MEM_ERROR:
             PyErr_NoMemory();
             return 1;
         case LZMA_MEMLIMIT_ERROR:
-            PyErr_SetString(Error, "Memory usage limit exceeded");
+            PyErr_SetString(state->error, "Memory usage limit exceeded");
             return 1;
         case LZMA_FORMAT_ERROR:
-            PyErr_SetString(Error, "Input format not supported by decoder");
+            PyErr_SetString(state->error, "Input format not supported by decoder");
             return 1;
         case LZMA_OPTIONS_ERROR:
-            PyErr_SetString(Error, "Invalid or unsupported options");
+            PyErr_SetString(state->error, "Invalid or unsupported options");
             return 1;
         case LZMA_DATA_ERROR:
-            PyErr_SetString(Error, "Corrupt input data");
+            PyErr_SetString(state->error, "Corrupt input data");
             return 1;
         case LZMA_BUF_ERROR:
-            PyErr_SetString(Error, "Insufficient buffer space");
+            PyErr_SetString(state->error, "Insufficient buffer space");
             return 1;
         case LZMA_PROG_ERROR:
-            PyErr_SetString(Error, "Internal error");
+            PyErr_SetString(state->error, "Internal error");
             return 1;
         default:
-            PyErr_Format(Error, "Unrecognized error from liblzma: %d", lzret);
+            PyErr_Format(state->error, "Unrecognized error from liblzma: %d", lzret);
             return 1;
     }
 }
@@ -107,8 +168,9 @@
 static void*
 PyLzma_Malloc(void *opaque, size_t items, size_t size)
 {
-    if (size != 0 && items > (size_t)PY_SSIZE_T_MAX / size)
+    if (size != 0 && items > (size_t)PY_SSIZE_T_MAX / size) {
         return NULL;
+    }
     /* PyMem_Malloc() cannot be used:
        the GIL is not held when lzma_code() is called */
     return PyMem_RawMalloc(items * size);
@@ -120,24 +182,6 @@
     PyMem_RawFree(ptr);
 }
 
-#if BUFSIZ < 8192
-#define INITIAL_BUFFER_SIZE 8192
-#else
-#define INITIAL_BUFFER_SIZE BUFSIZ
-#endif
-
-static int
-grow_buffer(PyObject **buf, Py_ssize_t max_length)
-{
-    Py_ssize_t size = PyBytes_GET_SIZE(*buf);
-    Py_ssize_t newsize = size + (size >> 3) + 6;
-
-    if (max_length > 0 && newsize > max_length)
-        newsize = max_length;
-
-    return _PyBytes_Resize(buf, newsize);
-}
-
 
 /* Some custom type conversions for PyArg_ParseTupleAndKeywords(),
    since the predefined conversion specifiers do not suit our needs:
@@ -186,7 +230,7 @@
    the C lzma_filter structs expected by liblzma. */
 
 static void *
-parse_filter_spec_lzma(PyObject *spec)
+parse_filter_spec_lzma(_lzma_state *state, PyObject *spec)
 {
     static char *optnames[] = {"id", "preset", "dict_size", "lc", "lp",
                                "pb", "mode", "nice_len", "mf", "depth", NULL};
@@ -200,28 +244,32 @@
 
     preset_obj = PyMapping_GetItemString(spec, "preset");
     if (preset_obj == NULL) {
-        if (PyErr_ExceptionMatches(PyExc_KeyError))
+        if (PyErr_ExceptionMatches(PyExc_KeyError)) {
             PyErr_Clear();
-        else
+        }
+        else {
             return NULL;
+        }
     } else {
         int ok = uint32_converter(preset_obj, &preset);
         Py_DECREF(preset_obj);
-        if (!ok)
+        if (!ok) {
             return NULL;
+        }
     }
 
     options = (lzma_options_lzma *)PyMem_Calloc(1, sizeof *options);
-    if (options == NULL)
+    if (options == NULL) {
         return PyErr_NoMemory();
+    }
 
     if (lzma_lzma_preset(options, preset)) {
         PyMem_Free(options);
-        PyErr_Format(Error, "Invalid compression preset: %u", preset);
+        PyErr_Format(state->error, "Invalid compression preset: %u", preset);
         return NULL;
     }
 
-    if (!PyArg_ParseTupleAndKeywords(empty_tuple, spec,
+    if (!PyArg_ParseTupleAndKeywords(state->empty_tuple, spec,
                                      "|OOO&O&O&O&O&O&O&O&", optnames,
                                      &id, &preset_obj,
                                      uint32_converter, &options->dict_size,
@@ -235,20 +283,21 @@
         PyErr_SetString(PyExc_ValueError,
                         "Invalid filter specifier for LZMA filter");
         PyMem_Free(options);
-        options = NULL;
+        return NULL;
     }
+
     return options;
 }
 
 static void *
-parse_filter_spec_delta(PyObject *spec)
+parse_filter_spec_delta(_lzma_state *state, PyObject *spec)
 {
     static char *optnames[] = {"id", "dist", NULL};
     PyObject *id;
     uint32_t dist = 1;
     lzma_options_delta *options;
 
-    if (!PyArg_ParseTupleAndKeywords(empty_tuple, spec, "|OO&", optnames,
+    if (!PyArg_ParseTupleAndKeywords(state->empty_tuple, spec, "|OO&", optnames,
                                      &id, uint32_converter, &dist)) {
         PyErr_SetString(PyExc_ValueError,
                         "Invalid filter specifier for delta filter");
@@ -256,22 +305,23 @@
     }
 
     options = (lzma_options_delta *)PyMem_Calloc(1, sizeof *options);
-    if (options == NULL)
+    if (options == NULL) {
         return PyErr_NoMemory();
+    }
     options->type = LZMA_DELTA_TYPE_BYTE;
     options->dist = dist;
     return options;
 }
 
 static void *
-parse_filter_spec_bcj(PyObject *spec)
+parse_filter_spec_bcj(_lzma_state *state, PyObject *spec)
 {
     static char *optnames[] = {"id", "start_offset", NULL};
     PyObject *id;
     uint32_t start_offset = 0;
     lzma_options_bcj *options;
 
-    if (!PyArg_ParseTupleAndKeywords(empty_tuple, spec, "|OO&", optnames,
+    if (!PyArg_ParseTupleAndKeywords(state->empty_tuple, spec, "|OO&", optnames,
                                      &id, uint32_converter, &start_offset)) {
         PyErr_SetString(PyExc_ValueError,
                         "Invalid filter specifier for BCJ filter");
@@ -279,14 +329,15 @@
     }
 
     options = (lzma_options_bcj *)PyMem_Calloc(1, sizeof *options);
-    if (options == NULL)
+    if (options == NULL) {
         return PyErr_NoMemory();
+    }
     options->start_offset = start_offset;
     return options;
 }
 
 static int
-lzma_filter_converter(PyObject *spec, void *ptr)
+lzma_filter_converter(_lzma_state *state, PyObject *spec, void *ptr)
 {
     lzma_filter *f = (lzma_filter *)ptr;
     PyObject *id_obj;
@@ -305,16 +356,17 @@
     }
     f->id = PyLong_AsUnsignedLongLong(id_obj);
     Py_DECREF(id_obj);
-    if (PyErr_Occurred())
+    if (PyErr_Occurred()) {
         return 0;
+    }
 
     switch (f->id) {
         case LZMA_FILTER_LZMA1:
         case LZMA_FILTER_LZMA2:
-            f->options = parse_filter_spec_lzma(spec);
+            f->options = parse_filter_spec_lzma(state, spec);
             return f->options != NULL;
         case LZMA_FILTER_DELTA:
-            f->options = parse_filter_spec_delta(spec);
+            f->options = parse_filter_spec_delta(state, spec);
             return f->options != NULL;
         case LZMA_FILTER_X86:
         case LZMA_FILTER_POWERPC:
@@ -322,7 +374,7 @@
         case LZMA_FILTER_ARM:
         case LZMA_FILTER_ARMTHUMB:
         case LZMA_FILTER_SPARC:
-            f->options = parse_filter_spec_bcj(spec);
+            f->options = parse_filter_spec_bcj(state, spec);
             return f->options != NULL;
         default:
             PyErr_Format(PyExc_ValueError, "Invalid filter ID: %llu", f->id);
@@ -333,20 +385,20 @@
 static void
 free_filter_chain(lzma_filter filters[])
 {
-    int i;
-
-    for (i = 0; filters[i].id != LZMA_VLI_UNKNOWN; i++)
+    for (int i = 0; filters[i].id != LZMA_VLI_UNKNOWN; i++) {
         PyMem_Free(filters[i].options);
+    }
 }
 
 static int
-parse_filter_chain_spec(lzma_filter filters[], PyObject *filterspecs)
+parse_filter_chain_spec(_lzma_state *state, lzma_filter filters[], PyObject *filterspecs)
 {
     Py_ssize_t i, num_filters;
 
     num_filters = PySequence_Length(filterspecs);
-    if (num_filters == -1)
+    if (num_filters == -1) {
         return -1;
+    }
     if (num_filters > LZMA_FILTERS_MAX) {
         PyErr_Format(PyExc_ValueError,
                      "Too many filters - liblzma supports a maximum of %d",
@@ -357,8 +409,9 @@
     for (i = 0; i < num_filters; i++) {
         int ok = 1;
         PyObject *spec = PySequence_GetItem(filterspecs, i);
-        if (spec == NULL || !lzma_filter_converter(spec, &filters[i]))
+        if (spec == NULL || !lzma_filter_converter(state, spec, &filters[i])) {
             ok = 0;
+        }
         Py_XDECREF(spec);
         if (!ok) {
             filters[i].id = LZMA_VLI_UNKNOWN;
@@ -383,8 +436,9 @@
     PyObject *value_object;
 
     value_object = PyLong_FromUnsignedLongLong(value);
-    if (value_object == NULL)
+    if (value_object == NULL) {
         return -1;
+    }
 
     status = _PyDict_SetItemId(spec, key, value_object);
     Py_DECREF(value_object);
@@ -397,8 +451,9 @@
     PyObject *spec;
 
     spec = PyDict_New();
-    if (spec == NULL)
+    if (spec == NULL) {
         return NULL;
+    }
 
 #define ADD_FIELD(SOURCE, FIELD) \
     do { \
@@ -490,44 +545,47 @@
 static PyObject *
 compress(Compressor *c, uint8_t *data, size_t len, lzma_action action)
 {
-    Py_ssize_t data_size = 0;
     PyObject *result;
+    _BlocksOutputBuffer buffer = {.list = NULL};
+    _lzma_state *state = PyType_GetModuleState(Py_TYPE(c));
+    assert(state != NULL);
 
-    result = PyBytes_FromStringAndSize(NULL, INITIAL_BUFFER_SIZE);
-    if (result == NULL)
-        return NULL;
+    if (OutputBuffer_InitAndGrow(&buffer, -1, &c->lzs.next_out, &c->lzs.avail_out) < 0) {
+        goto error;
+    }
     c->lzs.next_in = data;
     c->lzs.avail_in = len;
-    c->lzs.next_out = (uint8_t *)PyBytes_AS_STRING(result);
-    c->lzs.avail_out = PyBytes_GET_SIZE(result);
+
     for (;;) {
         lzma_ret lzret;
 
         Py_BEGIN_ALLOW_THREADS
         lzret = lzma_code(&c->lzs, action);
-        data_size = (char *)c->lzs.next_out - PyBytes_AS_STRING(result);
-        if (lzret == LZMA_BUF_ERROR && len == 0 && c->lzs.avail_out > 0)
-            lzret = LZMA_OK; /* That wasn't a real error */
         Py_END_ALLOW_THREADS
-        if (catch_lzma_error(lzret))
+
+        if (lzret == LZMA_BUF_ERROR && len == 0 && c->lzs.avail_out > 0) {
+            lzret = LZMA_OK; /* That wasn't a real error */
+        }
+        if (catch_lzma_error(state, lzret)) {
             goto error;
+        }
         if ((action == LZMA_RUN && c->lzs.avail_in == 0) ||
             (action == LZMA_FINISH && lzret == LZMA_STREAM_END)) {
             break;
         } else if (c->lzs.avail_out == 0) {
-            if (grow_buffer(&result, -1) == -1)
+            if (OutputBuffer_Grow(&buffer, &c->lzs.next_out, &c->lzs.avail_out) < 0) {
                 goto error;
-            c->lzs.next_out = (uint8_t *)PyBytes_AS_STRING(result) + data_size;
-            c->lzs.avail_out = PyBytes_GET_SIZE(result) - data_size;
+            }
         }
     }
-    if (data_size != PyBytes_GET_SIZE(result))
-        if (_PyBytes_Resize(&result, data_size) == -1)
-            goto error;
-    return result;
+
+    result = OutputBuffer_Finish(&buffer, c->lzs.avail_out);
+    if (result != NULL) {
+        return result;
+    }
 
 error:
-    Py_XDECREF(result);
+    OutputBuffer_OnError(&buffer);
     return NULL;
 }
 
@@ -552,10 +610,12 @@
     PyObject *result = NULL;
 
     ACQUIRE_LOCK(self);
-    if (self->flushed)
+    if (self->flushed) {
         PyErr_SetString(PyExc_ValueError, "Compressor has been flushed");
-    else
+    }
+    else {
         result = compress(self, data->buf, data->len, LZMA_RUN);
+    }
     RELEASE_LOCK(self);
     return result;
 }
@@ -588,8 +648,8 @@
 }
 
 static int
-Compressor_init_xz(lzma_stream *lzs, int check, uint32_t preset,
-                   PyObject *filterspecs)
+Compressor_init_xz(_lzma_state *state, lzma_stream *lzs,
+                   int check, uint32_t preset, PyObject *filterspecs)
 {
     lzma_ret lzret;
 
@@ -598,19 +658,21 @@
     } else {
         lzma_filter filters[LZMA_FILTERS_MAX + 1];
 
-        if (parse_filter_chain_spec(filters, filterspecs) == -1)
+        if (parse_filter_chain_spec(state, filters, filterspecs) == -1)
             return -1;
         lzret = lzma_stream_encoder(lzs, filters, check);
         free_filter_chain(filters);
     }
-    if (catch_lzma_error(lzret))
+    if (catch_lzma_error(state, lzret)) {
         return -1;
-    else
+    }
+    else {
         return 0;
+    }
 }
 
 static int
-Compressor_init_alone(lzma_stream *lzs, uint32_t preset, PyObject *filterspecs)
+Compressor_init_alone(_lzma_state *state, lzma_stream *lzs, uint32_t preset, PyObject *filterspecs)
 {
     lzma_ret lzret;
 
@@ -618,14 +680,14 @@
         lzma_options_lzma options;
 
         if (lzma_lzma_preset(&options, preset)) {
-            PyErr_Format(Error, "Invalid compression preset: %u", preset);
+            PyErr_Format(state->error, "Invalid compression preset: %u", preset);
             return -1;
         }
         lzret = lzma_alone_encoder(lzs, &options);
     } else {
         lzma_filter filters[LZMA_FILTERS_MAX + 1];
 
-        if (parse_filter_chain_spec(filters, filterspecs) == -1)
+        if (parse_filter_chain_spec(state, filters, filterspecs) == -1)
             return -1;
         if (filters[0].id == LZMA_FILTER_LZMA1 &&
             filters[1].id == LZMA_VLI_UNKNOWN) {
@@ -638,14 +700,16 @@
         }
         free_filter_chain(filters);
     }
-    if (PyErr_Occurred() || catch_lzma_error(lzret))
+    if (PyErr_Occurred() || catch_lzma_error(state, lzret)) {
         return -1;
-    else
+    }
+    else {
         return 0;
+    }
 }
 
 static int
-Compressor_init_raw(lzma_stream *lzs, PyObject *filterspecs)
+Compressor_init_raw(_lzma_state *state, lzma_stream *lzs, PyObject *filterspecs)
 {
     lzma_filter filters[LZMA_FILTERS_MAX + 1];
     lzma_ret lzret;
@@ -655,14 +719,17 @@
                         "Must specify filters for FORMAT_RAW");
         return -1;
     }
-    if (parse_filter_chain_spec(filters, filterspecs) == -1)
+    if (parse_filter_chain_spec(state, filters, filterspecs) == -1) {
         return -1;
+    }
     lzret = lzma_raw_encoder(lzs, filters);
     free_filter_chain(filters);
-    if (catch_lzma_error(lzret))
+    if (catch_lzma_error(state, lzret)) {
         return -1;
-    else
+    }
+    else {
         return 0;
+    }
 }
 
 /*[-clinic input]
@@ -706,12 +773,14 @@
     uint32_t preset = LZMA_PRESET_DEFAULT;
     PyObject *preset_obj = Py_None;
     PyObject *filterspecs = Py_None;
-
+    _lzma_state *state = PyType_GetModuleState(Py_TYPE(self));
+    assert(state != NULL);
     if (!PyArg_ParseTupleAndKeywords(args, kwargs,
                                      "|iiOO:LZMACompressor", arg_names,
                                      &format, &check, &preset_obj,
-                                     &filterspecs))
+                                     &filterspecs)) {
         return -1;
+    }
 
     if (format != FORMAT_XZ && check != -1 && check != LZMA_CHECK_NONE) {
         PyErr_SetString(PyExc_ValueError,
@@ -725,9 +794,11 @@
         return -1;
     }
 
-    if (preset_obj != Py_None)
-        if (!uint32_converter(preset_obj, &preset))
+    if (preset_obj != Py_None) {
+        if (!uint32_converter(preset_obj, &preset)) {
             return -1;
+        }
+    }
 
     self->alloc.opaque = NULL;
     self->alloc.alloc = PyLzma_Malloc;
@@ -743,20 +814,24 @@
     self->flushed = 0;
     switch (format) {
         case FORMAT_XZ:
-            if (check == -1)
+            if (check == -1) {
                 check = LZMA_CHECK_CRC64;
-            if (Compressor_init_xz(&self->lzs, check, preset, filterspecs) != 0)
+            }
+            if (Compressor_init_xz(state, &self->lzs, check, preset, filterspecs) != 0) {
                 break;
+            }
             return 0;
 
         case FORMAT_ALONE:
-            if (Compressor_init_alone(&self->lzs, preset, filterspecs) != 0)
+            if (Compressor_init_alone(state, &self->lzs, preset, filterspecs) != 0) {
                 break;
+            }
             return 0;
 
         case FORMAT_RAW:
-            if (Compressor_init_raw(&self->lzs, filterspecs) != 0)
+            if (Compressor_init_raw(state, &self->lzs, filterspecs) != 0) {
                 break;
+            }
             return 0;
 
         default:
@@ -774,9 +849,12 @@
 Compressor_dealloc(Compressor *self)
 {
     lzma_end(&self->lzs);
-    if (self->lock != NULL)
+    if (self->lock != NULL) {
         PyThread_free_lock(self->lock);
-    Py_TYPE(self)->tp_free((PyObject *)self);
+    }
+    PyTypeObject *tp = Py_TYPE(self);
+    tp->tp_free((PyObject *)self);
+    Py_DECREF(tp);
 }
 
 static PyMethodDef Compressor_methods[] = {
@@ -785,6 +863,13 @@
     {NULL}
 };
 
+static int
+Compressor_traverse(Compressor *self, visitproc visit, void *arg)
+{
+    Py_VISIT(Py_TYPE(self));
+    return 0;
+}
+
 PyDoc_STRVAR(Compressor_doc,
 "LZMACompressor(format=FORMAT_XZ, check=-1, preset=None, filters=None)\n"
 "\n"
@@ -813,47 +898,26 @@
 "\n"
 "For one-shot compression, use the compress() function instead.\n");
 
-static PyTypeObject Compressor_type = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "_lzma.LZMACompressor",             /* tp_name */
-    sizeof(Compressor),                 /* tp_basicsize */
-    0,                                  /* tp_itemsize */
-    (destructor)Compressor_dealloc,     /* tp_dealloc */
-    0,                                  /* tp_vectorcall_offset */
-    0,                                  /* tp_getattr */
-    0,                                  /* tp_setattr */
-    0,                                  /* tp_as_async */
-    0,                                  /* tp_repr */
-    0,                                  /* tp_as_number */
-    0,                                  /* tp_as_sequence */
-    0,                                  /* tp_as_mapping */
-    0,                                  /* tp_hash */
-    0,                                  /* tp_call */
-    0,                                  /* tp_str */
-    0,                                  /* tp_getattro */
-    0,                                  /* tp_setattro */
-    0,                                  /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT,                 /* tp_flags */
-    Compressor_doc,                     /* tp_doc */
-    0,                                  /* tp_traverse */
-    0,                                  /* tp_clear */
-    0,                                  /* tp_richcompare */
-    0,                                  /* tp_weaklistoffset */
-    0,                                  /* tp_iter */
-    0,                                  /* tp_iternext */
-    Compressor_methods,                 /* tp_methods */
-    0,                                  /* tp_members */
-    0,                                  /* tp_getset */
-    0,                                  /* tp_base */
-    0,                                  /* tp_dict */
-    0,                                  /* tp_descr_get */
-    0,                                  /* tp_descr_set */
-    0,                                  /* tp_dictoffset */
-    (initproc)Compressor_init,          /* tp_init */
-    0,                                  /* tp_alloc */
-    PyType_GenericNew,                  /* tp_new */
+static PyType_Slot lzma_compressor_type_slots[] = {
+    {Py_tp_dealloc, Compressor_dealloc},
+    {Py_tp_methods, Compressor_methods},
+    {Py_tp_init, Compressor_init},
+    {Py_tp_new, PyType_GenericNew},
+    {Py_tp_doc, (char *)Compressor_doc},
+    {Py_tp_traverse, Compressor_traverse},
+    {0, 0}
 };
 
+static PyType_Spec lzma_compressor_type_spec = {
+    .name = "_lzma.LZMACompressor",
+    .basicsize = sizeof(Compressor),
+    // Calling PyType_GetModuleState() on a subclass is not safe.
+    // lzma_compressor_type_spec does not have Py_TPFLAGS_BASETYPE flag
+    // which prevents to create a subclass.
+    // So calling PyType_GetModuleState() in this file is always safe.
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = lzma_compressor_type_slots,
+};
 
 /* LZMADecompressor class. */
 
@@ -864,34 +928,32 @@
 static PyObject*
 decompress_buf(Decompressor *d, Py_ssize_t max_length)
 {
-    Py_ssize_t data_size = 0;
     PyObject *result;
     lzma_stream *lzs = &d->lzs;
+    _BlocksOutputBuffer buffer = {.list = NULL};
+    _lzma_state *state = PyType_GetModuleState(Py_TYPE(d));
+    assert(state != NULL);
 
-    if (max_length < 0 || max_length >= INITIAL_BUFFER_SIZE)
-        result = PyBytes_FromStringAndSize(NULL, INITIAL_BUFFER_SIZE);
-    else
-        result = PyBytes_FromStringAndSize(NULL, max_length);
-    if (result == NULL)
-        return NULL;
-
-    lzs->next_out = (uint8_t *)PyBytes_AS_STRING(result);
-    lzs->avail_out = PyBytes_GET_SIZE(result);
+    if (OutputBuffer_InitAndGrow(&buffer, max_length, &lzs->next_out, &lzs->avail_out) < 0) {
+        goto error;
+    }
 
     for (;;) {
         lzma_ret lzret;
 
         Py_BEGIN_ALLOW_THREADS
         lzret = lzma_code(lzs, LZMA_RUN);
-        data_size = (char *)lzs->next_out - PyBytes_AS_STRING(result);
-        if (lzret == LZMA_BUF_ERROR && lzs->avail_in == 0 && lzs->avail_out > 0)
-            lzret = LZMA_OK; /* That wasn't a real error */
         Py_END_ALLOW_THREADS
 
-        if (catch_lzma_error(lzret))
+        if (lzret == LZMA_BUF_ERROR && lzs->avail_in == 0 && lzs->avail_out > 0) {
+            lzret = LZMA_OK; /* That wasn't a real error */
+        }
+        if (catch_lzma_error(state, lzret)) {
             goto error;
-        if (lzret == LZMA_GET_CHECK || lzret == LZMA_NO_CHECK)
+        }
+        if (lzret == LZMA_GET_CHECK || lzret == LZMA_NO_CHECK) {
             d->check = lzma_get_check(&d->lzs);
+        }
         if (lzret == LZMA_STREAM_END) {
             d->eof = 1;
             break;
@@ -900,24 +962,24 @@
                Maybe lzs's internal state still have a few bytes
                can be output, grow the output buffer and continue
                if max_lengh < 0. */
-            if (data_size == max_length)
+            if (OutputBuffer_GetDataSize(&buffer, lzs->avail_out) == max_length) {
                 break;
-            if (grow_buffer(&result, max_length) == -1)
+            }
+            if (OutputBuffer_Grow(&buffer, &lzs->next_out, &lzs->avail_out) < 0) {
                 goto error;
-            lzs->next_out = (uint8_t *)PyBytes_AS_STRING(result) + data_size;
-            lzs->avail_out = PyBytes_GET_SIZE(result) - data_size;
+            }
         } else if (lzs->avail_in == 0) {
             break;
         }
     }
-    if (data_size != PyBytes_GET_SIZE(result))
-        if (_PyBytes_Resize(&result, data_size) == -1)
-            goto error;
 
-    return result;
+    result = OutputBuffer_Finish(&buffer, lzs->avail_out);
+    if (result != NULL) {
+        return result;
+    }
 
 error:
-    Py_XDECREF(result);
+    OutputBuffer_OnError(&buffer);
     return NULL;
 }
 
@@ -984,8 +1046,9 @@
         if (lzs->avail_in > 0) {
             Py_XSETREF(d->unused_data,
                       PyBytes_FromStringAndSize((char *)lzs->next_in, lzs->avail_in));
-            if (d->unused_data == NULL)
+            if (d->unused_data == NULL) {
                 goto error;
+            }
         }
     }
     else if (lzs->avail_in == 0) {
@@ -997,7 +1060,7 @@
                be output, try to output them next time. */
             d->needs_input = 0;
 
-            /* if max_length < 0, lzs->avail_out always > 0 */
+            /* If max_length < 0, lzs->avail_out always > 0 */
             assert(max_length >= 0);
         } else {
             /* Input buffer exhausted, output buffer has space. */
@@ -1082,19 +1145,22 @@
 }
 
 static int
-Decompressor_init_raw(lzma_stream *lzs, PyObject *filterspecs)
+Decompressor_init_raw(_lzma_state *state, lzma_stream *lzs, PyObject *filterspecs)
 {
     lzma_filter filters[LZMA_FILTERS_MAX + 1];
     lzma_ret lzret;
 
-    if (parse_filter_chain_spec(filters, filterspecs) == -1)
+    if (parse_filter_chain_spec(state, filters, filterspecs) == -1) {
         return -1;
+    }
     lzret = lzma_raw_decoder(lzs, filters);
     free_filter_chain(filters);
-    if (catch_lzma_error(lzret))
+    if (catch_lzma_error(state, lzret)) {
         return -1;
-    else
+    }
+    else {
         return 0;
+    }
 }
 
 /*[clinic input]
@@ -1130,6 +1196,8 @@
     const uint32_t decoder_flags = LZMA_TELL_ANY_CHECK | LZMA_TELL_NO_CHECK;
     uint64_t memlimit_ = UINT64_MAX;
     lzma_ret lzret;
+    _lzma_state *state = PyType_GetModuleState(Py_TYPE(self));
+    assert(state != NULL);
 
     if (memlimit != Py_None) {
         if (format == FORMAT_RAW) {
@@ -1138,8 +1206,9 @@
             return -1;
         }
         memlimit_ = PyLong_AsUnsignedLongLong(memlimit);
-        if (PyErr_Occurred())
+        if (PyErr_Occurred()) {
             return -1;
+        }
     }
 
     if (format == FORMAT_RAW && filters == Py_None) {
@@ -1173,33 +1242,38 @@
     self->input_buffer = NULL;
     self->input_buffer_size = 0;
     Py_XSETREF(self->unused_data, PyBytes_FromStringAndSize(NULL, 0));
-    if (self->unused_data == NULL)
+    if (self->unused_data == NULL) {
         goto error;
+    }
 
     switch (format) {
         case FORMAT_AUTO:
             lzret = lzma_auto_decoder(&self->lzs, memlimit_, decoder_flags);
-            if (catch_lzma_error(lzret))
+            if (catch_lzma_error(state, lzret)) {
                 break;
+            }
             return 0;
 
         case FORMAT_XZ:
             lzret = lzma_stream_decoder(&self->lzs, memlimit_, decoder_flags);
-            if (catch_lzma_error(lzret))
+            if (catch_lzma_error(state, lzret)) {
                 break;
+            }
             return 0;
 
         case FORMAT_ALONE:
             self->check = LZMA_CHECK_NONE;
             lzret = lzma_alone_decoder(&self->lzs, memlimit_);
-            if (catch_lzma_error(lzret))
+            if (catch_lzma_error(state, lzret)) {
                 break;
+            }
             return 0;
 
         case FORMAT_RAW:
             self->check = LZMA_CHECK_NONE;
-            if (Decompressor_init_raw(&self->lzs, filters) == -1)
+            if (Decompressor_init_raw(state, &self->lzs, filters) == -1) {
                 break;
+            }
             return 0;
 
         default:
@@ -1223,9 +1297,19 @@
 
     lzma_end(&self->lzs);
     Py_CLEAR(self->unused_data);
-    if (self->lock != NULL)
+    if (self->lock != NULL) {
         PyThread_free_lock(self->lock);
-    Py_TYPE(self)->tp_free((PyObject *)self);
+    }
+    PyTypeObject *tp = Py_TYPE(self);
+    tp->tp_free((PyObject *)self);
+    Py_DECREF(tp);
+}
+
+static int
+Decompressor_traverse(Decompressor *self, visitproc visit, void *arg)
+{
+    Py_VISIT(Py_TYPE(self));
+    return 0;
 }
 
 static PyMethodDef Decompressor_methods[] = {
@@ -1257,45 +1341,26 @@
     {NULL}
 };
 
-static PyTypeObject Decompressor_type = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "_lzma.LZMADecompressor",           /* tp_name */
-    sizeof(Decompressor),               /* tp_basicsize */
-    0,                                  /* tp_itemsize */
-    (destructor)Decompressor_dealloc,   /* tp_dealloc */
-    0,                                  /* tp_vectorcall_offset */
-    0,                                  /* tp_getattr */
-    0,                                  /* tp_setattr */
-    0,                                  /* tp_as_async */
-    0,                                  /* tp_repr */
-    0,                                  /* tp_as_number */
-    0,                                  /* tp_as_sequence */
-    0,                                  /* tp_as_mapping */
-    0,                                  /* tp_hash */
-    0,                                  /* tp_call */
-    0,                                  /* tp_str */
-    0,                                  /* tp_getattro */
-    0,                                  /* tp_setattro */
-    0,                                  /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT,                 /* tp_flags */
-    _lzma_LZMADecompressor___init____doc__,  /* tp_doc */
-    0,                                  /* tp_traverse */
-    0,                                  /* tp_clear */
-    0,                                  /* tp_richcompare */
-    0,                                  /* tp_weaklistoffset */
-    0,                                  /* tp_iter */
-    0,                                  /* tp_iternext */
-    Decompressor_methods,               /* tp_methods */
-    Decompressor_members,               /* tp_members */
-    0,                                  /* tp_getset */
-    0,                                  /* tp_base */
-    0,                                  /* tp_dict */
-    0,                                  /* tp_descr_get */
-    0,                                  /* tp_descr_set */
-    0,                                  /* tp_dictoffset */
-    _lzma_LZMADecompressor___init__,    /* tp_init */
-    0,                                  /* tp_alloc */
-    PyType_GenericNew,                  /* tp_new */
+static PyType_Slot lzma_decompressor_type_slots[] = {
+    {Py_tp_dealloc, Decompressor_dealloc},
+    {Py_tp_methods, Decompressor_methods},
+    {Py_tp_init, _lzma_LZMADecompressor___init__},
+    {Py_tp_new, PyType_GenericNew},
+    {Py_tp_doc, (char *)_lzma_LZMADecompressor___init____doc__},
+    {Py_tp_traverse, Decompressor_traverse},
+    {Py_tp_members, Decompressor_members},
+    {0, 0}
+};
+
+static PyType_Spec lzma_decompressor_type_spec = {
+    .name = "_lzma.LZMADecompressor",
+    .basicsize = sizeof(Decompressor),
+    // Calling PyType_GetModuleState() on a subclass is not safe.
+    // lzma_decompressor_type_spec does not have Py_TPFLAGS_BASETYPE flag
+    // which prevents to create a subclass.
+    // So calling PyType_GetModuleState() in this file is always safe.
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = lzma_decompressor_type_slots,
 };
 
 
@@ -1318,27 +1383,52 @@
     return PyBool_FromLong(lzma_check_is_supported(check_id));
 }
 
+PyDoc_STRVAR(_lzma__encode_filter_properties__doc__,
+"_encode_filter_properties($module, filter, /)\n"
+"--\n"
+"\n"
+"Return a bytes object encoding the options (properties) of the filter specified by *filter* (a dict).\n"
+"\n"
+"The result does not include the filter ID itself, only the options.");
 
-/*[clinic input]
-_lzma._encode_filter_properties
-    filter: lzma_filter(c_default="{LZMA_VLI_UNKNOWN, NULL}")
-    /
+#define _LZMA__ENCODE_FILTER_PROPERTIES_METHODDEF    \
+    {"_encode_filter_properties", (PyCFunction)_lzma__encode_filter_properties, METH_O, _lzma__encode_filter_properties__doc__},
 
-Return a bytes object encoding the options (properties) of the filter specified by *filter* (a dict).
+static PyObject *
+_lzma__encode_filter_properties_impl(PyObject *module, lzma_filter filter);
 
-The result does not include the filter ID itself, only the options.
-[clinic start generated code]*/
+static PyObject *
+_lzma__encode_filter_properties(PyObject *module, PyObject *arg)
+{
+    PyObject *return_value = NULL;
+    lzma_filter filter = {LZMA_VLI_UNKNOWN, NULL};
+    _lzma_state *state = get_lzma_state(module);
+    assert(state != NULL);
+    if (!lzma_filter_converter(state, arg, &filter)) {
+        goto exit;
+    }
+    return_value = _lzma__encode_filter_properties_impl(module, filter);
+
+exit:
+    /* Cleanup for filter */
+    if (filter.id != LZMA_VLI_UNKNOWN) {
+       PyMem_Free(filter.options);
+    }
+
+    return return_value;
+}
 
 static PyObject *
 _lzma__encode_filter_properties_impl(PyObject *module, lzma_filter filter)
-/*[clinic end generated code: output=5c93c8e14e7be5a8 input=d4c64f1b557c77d4]*/
 {
     lzma_ret lzret;
     uint32_t encoded_size;
     PyObject *result = NULL;
+    _lzma_state *state = get_lzma_state(module);
+    assert(state != NULL);
 
     lzret = lzma_properties_size(&encoded_size, &filter);
-    if (catch_lzma_error(lzret))
+    if (catch_lzma_error(state, lzret))
         goto error;
 
     result = PyBytes_FromStringAndSize(NULL, encoded_size);
@@ -1347,8 +1437,9 @@
 
     lzret = lzma_properties_encode(
             &filter, (uint8_t *)PyBytes_AS_STRING(result));
-    if (catch_lzma_error(lzret))
+    if (catch_lzma_error(state, lzret)) {
         goto error;
+    }
 
     return result;
 
@@ -1378,11 +1469,14 @@
     lzma_ret lzret;
     PyObject *result = NULL;
     filter.id = filter_id;
+    _lzma_state *state = get_lzma_state(module);
+    assert(state != NULL);
 
     lzret = lzma_properties_decode(
             &filter, NULL, encoded_props->buf, encoded_props->len);
-    if (catch_lzma_error(lzret))
+    if (catch_lzma_error(state, lzret)) {
         return NULL;
+    }
 
     result = build_filter_spec(&filter);
 
@@ -1392,103 +1486,162 @@
     return result;
 }
 
-
-/* Module initialization. */
-
-static PyMethodDef module_methods[] = {
-    _LZMA_IS_CHECK_SUPPORTED_METHODDEF
-    _LZMA__ENCODE_FILTER_PROPERTIES_METHODDEF
-    _LZMA__DECODE_FILTER_PROPERTIES_METHODDEF
-    {NULL}
-};
-
-static PyModuleDef _lzmamodule = {
-    PyModuleDef_HEAD_INIT,
-    "_lzma",
-    NULL,
-    -1,
-    module_methods,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-};
-
 /* Some of our constants are more than 32 bits wide, so PyModule_AddIntConstant
    would not work correctly on platforms with 32-bit longs. */
 static int
 module_add_int_constant(PyObject *m, const char *name, long long value)
 {
     PyObject *o = PyLong_FromLongLong(value);
-    if (o == NULL)
+    if (o == NULL) {
         return -1;
-    if (PyModule_AddObject(m, name, o) == 0)
+    }
+    if (PyModule_AddObject(m, name, o) == 0) {
         return 0;
+    }
     Py_DECREF(o);
     return -1;
 }
 
-#define ADD_INT_PREFIX_MACRO(m, macro) \
-    module_add_int_constant(m, #macro, LZMA_ ## macro)
+static int
+lzma_exec(PyObject *module)
+{
+#define ADD_INT_PREFIX_MACRO(module, macro)                                 \
+    do {                                                                    \
+        if (module_add_int_constant(module, #macro, LZMA_ ## macro) < 0) {  \
+            return -1;                                                      \
+        }                                                                   \
+    } while(0)
+
+#define ADD_INT_MACRO(module, macro)                                        \
+    do {                                                                    \
+        if (PyModule_AddIntMacro(module, macro) < 0) {                      \
+            return -1;                                                      \
+        }                                                                   \
+    } while (0)
+
+
+    _lzma_state *state = get_lzma_state(module);
+
+    state->empty_tuple = PyTuple_New(0);
+    if (state->empty_tuple == NULL) {
+        return -1;
+    }
+
+    ADD_INT_MACRO(module, FORMAT_AUTO);
+    ADD_INT_MACRO(module, FORMAT_XZ);
+    ADD_INT_MACRO(module, FORMAT_ALONE);
+    ADD_INT_MACRO(module, FORMAT_RAW);
+    ADD_INT_PREFIX_MACRO(module, CHECK_NONE);
+    ADD_INT_PREFIX_MACRO(module, CHECK_CRC32);
+    ADD_INT_PREFIX_MACRO(module, CHECK_CRC64);
+    ADD_INT_PREFIX_MACRO(module, CHECK_SHA256);
+    ADD_INT_PREFIX_MACRO(module, CHECK_ID_MAX);
+    ADD_INT_PREFIX_MACRO(module, CHECK_UNKNOWN);
+    ADD_INT_PREFIX_MACRO(module, FILTER_LZMA1);
+    ADD_INT_PREFIX_MACRO(module, FILTER_LZMA2);
+    ADD_INT_PREFIX_MACRO(module, FILTER_DELTA);
+    ADD_INT_PREFIX_MACRO(module, FILTER_X86);
+    ADD_INT_PREFIX_MACRO(module, FILTER_IA64);
+    ADD_INT_PREFIX_MACRO(module, FILTER_ARM);
+    ADD_INT_PREFIX_MACRO(module, FILTER_ARMTHUMB);
+    ADD_INT_PREFIX_MACRO(module, FILTER_SPARC);
+    ADD_INT_PREFIX_MACRO(module, FILTER_POWERPC);
+    ADD_INT_PREFIX_MACRO(module, MF_HC3);
+    ADD_INT_PREFIX_MACRO(module, MF_HC4);
+    ADD_INT_PREFIX_MACRO(module, MF_BT2);
+    ADD_INT_PREFIX_MACRO(module, MF_BT3);
+    ADD_INT_PREFIX_MACRO(module, MF_BT4);
+    ADD_INT_PREFIX_MACRO(module, MODE_FAST);
+    ADD_INT_PREFIX_MACRO(module, MODE_NORMAL);
+    ADD_INT_PREFIX_MACRO(module, PRESET_DEFAULT);
+    ADD_INT_PREFIX_MACRO(module, PRESET_EXTREME);
+
+    state->error = PyErr_NewExceptionWithDoc("_lzma.LZMAError", "Call to liblzma failed.", NULL, NULL);
+    if (state->error == NULL) {
+        return -1;
+    }
+
+    if (PyModule_AddType(module, (PyTypeObject *)state->error) < 0) {
+        return -1;
+    }
+
+
+    state->lzma_compressor_type = (PyTypeObject *)PyType_FromModuleAndSpec(module,
+                                                            &lzma_compressor_type_spec, NULL);
+    if (state->lzma_compressor_type == NULL) {
+        return -1;
+    }
+
+    if (PyModule_AddType(module, state->lzma_compressor_type) < 0) {
+        return -1;
+    }
+
+    state->lzma_decompressor_type = (PyTypeObject *)PyType_FromModuleAndSpec(module,
+                                                         &lzma_decompressor_type_spec, NULL);
+    if (state->lzma_decompressor_type == NULL) {
+        return -1;
+    }
+
+    if (PyModule_AddType(module, state->lzma_decompressor_type) < 0) {
+        return -1;
+    }
+
+    return 0;
+}
+
+static PyMethodDef lzma_methods[] = {
+    _LZMA_IS_CHECK_SUPPORTED_METHODDEF
+    _LZMA__ENCODE_FILTER_PROPERTIES_METHODDEF
+    _LZMA__DECODE_FILTER_PROPERTIES_METHODDEF
+    {NULL}
+};
+
+static PyModuleDef_Slot lzma_slots[] = {
+    {Py_mod_exec, lzma_exec},
+    {0, NULL}
+};
+
+static int
+lzma_traverse(PyObject *module, visitproc visit, void *arg)
+{
+    _lzma_state *state = get_lzma_state(module);
+    Py_VISIT(state->lzma_compressor_type);
+    Py_VISIT(state->lzma_decompressor_type);
+    Py_VISIT(state->error);
+    Py_VISIT(state->empty_tuple);
+    return 0;
+}
+
+static int
+lzma_clear(PyObject *module)
+{
+    _lzma_state *state = get_lzma_state(module);
+    Py_CLEAR(state->lzma_compressor_type);
+    Py_CLEAR(state->lzma_decompressor_type);
+    Py_CLEAR(state->error);
+    Py_CLEAR(state->empty_tuple);
+    return 0;
+}
+
+static void
+lzma_free(void *module)
+{
+    lzma_clear((PyObject *)module);
+}
+
+static PyModuleDef _lzmamodule = {
+    PyModuleDef_HEAD_INIT,
+    .m_name = "_lzma",
+    .m_size = sizeof(_lzma_state),
+    .m_methods = lzma_methods,
+    .m_slots = lzma_slots,
+    .m_traverse = lzma_traverse,
+    .m_clear = lzma_clear,
+    .m_free = lzma_free,
+};
 
 PyMODINIT_FUNC
 PyInit__lzma(void)
 {
-    PyObject *m;
-
-    empty_tuple = PyTuple_New(0);
-    if (empty_tuple == NULL)
-        return NULL;
-
-    m = PyModule_Create(&_lzmamodule);
-    if (m == NULL)
-        return NULL;
-
-    if (PyModule_AddIntMacro(m, FORMAT_AUTO) == -1 ||
-        PyModule_AddIntMacro(m, FORMAT_XZ) == -1 ||
-        PyModule_AddIntMacro(m, FORMAT_ALONE) == -1 ||
-        PyModule_AddIntMacro(m, FORMAT_RAW) == -1 ||
-        ADD_INT_PREFIX_MACRO(m, CHECK_NONE) == -1 ||
-        ADD_INT_PREFIX_MACRO(m, CHECK_CRC32) == -1 ||
-        ADD_INT_PREFIX_MACRO(m, CHECK_CRC64) == -1 ||
-        ADD_INT_PREFIX_MACRO(m, CHECK_SHA256) == -1 ||
-        ADD_INT_PREFIX_MACRO(m, CHECK_ID_MAX) == -1 ||
-        ADD_INT_PREFIX_MACRO(m, CHECK_UNKNOWN) == -1 ||
-        ADD_INT_PREFIX_MACRO(m, FILTER_LZMA1) == -1 ||
-        ADD_INT_PREFIX_MACRO(m, FILTER_LZMA2) == -1 ||
-        ADD_INT_PREFIX_MACRO(m, FILTER_DELTA) == -1 ||
-        ADD_INT_PREFIX_MACRO(m, FILTER_X86) == -1 ||
-        ADD_INT_PREFIX_MACRO(m, FILTER_IA64) == -1 ||
-        ADD_INT_PREFIX_MACRO(m, FILTER_ARM) == -1 ||
-        ADD_INT_PREFIX_MACRO(m, FILTER_ARMTHUMB) == -1 ||
-        ADD_INT_PREFIX_MACRO(m, FILTER_SPARC) == -1 ||
-        ADD_INT_PREFIX_MACRO(m, FILTER_POWERPC) == -1 ||
-        ADD_INT_PREFIX_MACRO(m, MF_HC3) == -1 ||
-        ADD_INT_PREFIX_MACRO(m, MF_HC4) == -1 ||
-        ADD_INT_PREFIX_MACRO(m, MF_BT2) == -1 ||
-        ADD_INT_PREFIX_MACRO(m, MF_BT3) == -1 ||
-        ADD_INT_PREFIX_MACRO(m, MF_BT4) == -1 ||
-        ADD_INT_PREFIX_MACRO(m, MODE_FAST) == -1 ||
-        ADD_INT_PREFIX_MACRO(m, MODE_NORMAL) == -1 ||
-        ADD_INT_PREFIX_MACRO(m, PRESET_DEFAULT) == -1 ||
-        ADD_INT_PREFIX_MACRO(m, PRESET_EXTREME) == -1)
-        return NULL;
-
-    Error = PyErr_NewExceptionWithDoc(
-            "_lzma.LZMAError", "Call to liblzma failed.", NULL, NULL);
-    if (Error == NULL)
-        return NULL;
-    Py_INCREF(Error);
-    if (PyModule_AddObject(m, "LZMAError", Error) == -1)
-        return NULL;
-
-    if (PyModule_AddType(m, &Compressor_type) < 0) {
-        return NULL;
-    }
-
-    if (PyModule_AddType(m, &Decompressor_type) < 0) {
-        return NULL;
-    }
-
-    return m;
+    return PyModuleDef_Init(&_lzmamodule);
 }
diff --git a/Modules/_math.c b/Modules/_math.c
index 02d8f1c..68e3a23 100644
--- a/Modules/_math.c
+++ b/Modules/_math.c
@@ -90,7 +90,7 @@
  *              asinh(x) = sign(x) * log [ |x| + sqrt(x*x+1) ]
  *      we have
  *      asinh(x) := x  if  1+x*x=1,
- *               := sign(x)*(log(x)+ln2)) for large |x|, else
+ *               := sign(x)*(log(x)+ln2) for large |x|, else
  *               := sign(x)*log(2|x|+1/(|x|+sqrt(x*x+1))) if|x|>2, else
  *               := sign(x)*log1p(|x| + x^2/(1 + sqrt(1+x^2)))
  */
diff --git a/Modules/_multiprocessing/clinic/multiprocessing.c.h b/Modules/_multiprocessing/clinic/multiprocessing.c.h
new file mode 100644
index 0000000..7096442
--- /dev/null
+++ b/Modules/_multiprocessing/clinic/multiprocessing.c.h
@@ -0,0 +1,151 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+#if defined(MS_WINDOWS)
+
+PyDoc_STRVAR(_multiprocessing_closesocket__doc__,
+"closesocket($module, handle, /)\n"
+"--\n"
+"\n");
+
+#define _MULTIPROCESSING_CLOSESOCKET_METHODDEF    \
+    {"closesocket", (PyCFunction)_multiprocessing_closesocket, METH_O, _multiprocessing_closesocket__doc__},
+
+static PyObject *
+_multiprocessing_closesocket_impl(PyObject *module, HANDLE handle);
+
+static PyObject *
+_multiprocessing_closesocket(PyObject *module, PyObject *arg)
+{
+    PyObject *return_value = NULL;
+    HANDLE handle;
+
+    if (!PyArg_Parse(arg, ""F_HANDLE":closesocket", &handle)) {
+        goto exit;
+    }
+    return_value = _multiprocessing_closesocket_impl(module, handle);
+
+exit:
+    return return_value;
+}
+
+#endif /* defined(MS_WINDOWS) */
+
+#if defined(MS_WINDOWS)
+
+PyDoc_STRVAR(_multiprocessing_recv__doc__,
+"recv($module, handle, size, /)\n"
+"--\n"
+"\n");
+
+#define _MULTIPROCESSING_RECV_METHODDEF    \
+    {"recv", (PyCFunction)(void(*)(void))_multiprocessing_recv, METH_FASTCALL, _multiprocessing_recv__doc__},
+
+static PyObject *
+_multiprocessing_recv_impl(PyObject *module, HANDLE handle, int size);
+
+static PyObject *
+_multiprocessing_recv(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    HANDLE handle;
+    int size;
+
+    if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"i:recv",
+        &handle, &size)) {
+        goto exit;
+    }
+    return_value = _multiprocessing_recv_impl(module, handle, size);
+
+exit:
+    return return_value;
+}
+
+#endif /* defined(MS_WINDOWS) */
+
+#if defined(MS_WINDOWS)
+
+PyDoc_STRVAR(_multiprocessing_send__doc__,
+"send($module, handle, buf, /)\n"
+"--\n"
+"\n");
+
+#define _MULTIPROCESSING_SEND_METHODDEF    \
+    {"send", (PyCFunction)(void(*)(void))_multiprocessing_send, METH_FASTCALL, _multiprocessing_send__doc__},
+
+static PyObject *
+_multiprocessing_send_impl(PyObject *module, HANDLE handle, Py_buffer *buf);
+
+static PyObject *
+_multiprocessing_send(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    HANDLE handle;
+    Py_buffer buf = {NULL, NULL};
+
+    if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"y*:send",
+        &handle, &buf)) {
+        goto exit;
+    }
+    return_value = _multiprocessing_send_impl(module, handle, &buf);
+
+exit:
+    /* Cleanup for buf */
+    if (buf.obj) {
+       PyBuffer_Release(&buf);
+    }
+
+    return return_value;
+}
+
+#endif /* defined(MS_WINDOWS) */
+
+PyDoc_STRVAR(_multiprocessing_sem_unlink__doc__,
+"sem_unlink($module, name, /)\n"
+"--\n"
+"\n");
+
+#define _MULTIPROCESSING_SEM_UNLINK_METHODDEF    \
+    {"sem_unlink", (PyCFunction)_multiprocessing_sem_unlink, METH_O, _multiprocessing_sem_unlink__doc__},
+
+static PyObject *
+_multiprocessing_sem_unlink_impl(PyObject *module, const char *name);
+
+static PyObject *
+_multiprocessing_sem_unlink(PyObject *module, PyObject *arg)
+{
+    PyObject *return_value = NULL;
+    const char *name;
+
+    if (!PyUnicode_Check(arg)) {
+        _PyArg_BadArgument("sem_unlink", "argument", "str", arg);
+        goto exit;
+    }
+    Py_ssize_t name_length;
+    name = PyUnicode_AsUTF8AndSize(arg, &name_length);
+    if (name == NULL) {
+        goto exit;
+    }
+    if (strlen(name) != (size_t)name_length) {
+        PyErr_SetString(PyExc_ValueError, "embedded null character");
+        goto exit;
+    }
+    return_value = _multiprocessing_sem_unlink_impl(module, name);
+
+exit:
+    return return_value;
+}
+
+#ifndef _MULTIPROCESSING_CLOSESOCKET_METHODDEF
+    #define _MULTIPROCESSING_CLOSESOCKET_METHODDEF
+#endif /* !defined(_MULTIPROCESSING_CLOSESOCKET_METHODDEF) */
+
+#ifndef _MULTIPROCESSING_RECV_METHODDEF
+    #define _MULTIPROCESSING_RECV_METHODDEF
+#endif /* !defined(_MULTIPROCESSING_RECV_METHODDEF) */
+
+#ifndef _MULTIPROCESSING_SEND_METHODDEF
+    #define _MULTIPROCESSING_SEND_METHODDEF
+#endif /* !defined(_MULTIPROCESSING_SEND_METHODDEF) */
+/*[clinic end generated code: output=418191c446cd5751 input=a9049054013a1b77]*/
diff --git a/Modules/_multiprocessing/clinic/posixshmem.c.h b/Modules/_multiprocessing/clinic/posixshmem.c.h
index a99f0d2..3424b10 100644
--- a/Modules/_multiprocessing/clinic/posixshmem.c.h
+++ b/Modules/_multiprocessing/clinic/posixshmem.c.h
@@ -42,11 +42,6 @@
         goto exit;
     }
     path = args[0];
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     flags = _PyLong_AsInt(args[1]);
     if (flags == -1 && PyErr_Occurred()) {
         goto exit;
@@ -54,11 +49,6 @@
     if (!noptargs) {
         goto skip_optional_pos;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     mode = _PyLong_AsInt(args[2]);
     if (mode == -1 && PyErr_Occurred()) {
         goto exit;
@@ -130,4 +120,4 @@
 #ifndef _POSIXSHMEM_SHM_UNLINK_METHODDEF
     #define _POSIXSHMEM_SHM_UNLINK_METHODDEF
 #endif /* !defined(_POSIXSHMEM_SHM_UNLINK_METHODDEF) */
-/*[clinic end generated code: output=9132861c61d8c2d8 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=bca8e78d0f43ef1a input=a9049054013a1b77]*/
diff --git a/Modules/_multiprocessing/clinic/semaphore.c.h b/Modules/_multiprocessing/clinic/semaphore.c.h
new file mode 100644
index 0000000..e1b9309
--- /dev/null
+++ b/Modules/_multiprocessing/clinic/semaphore.c.h
@@ -0,0 +1,402 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+#if defined(MS_WINDOWS)
+
+PyDoc_STRVAR(_multiprocessing_SemLock_acquire__doc__,
+"acquire($self, /, block=True, timeout=None)\n"
+"--\n"
+"\n"
+"Acquire the semaphore/lock.");
+
+#define _MULTIPROCESSING_SEMLOCK_ACQUIRE_METHODDEF    \
+    {"acquire", (PyCFunction)(void(*)(void))_multiprocessing_SemLock_acquire, METH_FASTCALL|METH_KEYWORDS, _multiprocessing_SemLock_acquire__doc__},
+
+static PyObject *
+_multiprocessing_SemLock_acquire_impl(SemLockObject *self, int blocking,
+                                      PyObject *timeout_obj);
+
+static PyObject *
+_multiprocessing_SemLock_acquire(SemLockObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"block", "timeout", NULL};
+    static _PyArg_Parser _parser = {NULL, _keywords, "acquire", 0};
+    PyObject *argsbuf[2];
+    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
+    int blocking = 1;
+    PyObject *timeout_obj = Py_None;
+
+    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 2, 0, argsbuf);
+    if (!args) {
+        goto exit;
+    }
+    if (!noptargs) {
+        goto skip_optional_pos;
+    }
+    if (args[0]) {
+        blocking = _PyLong_AsInt(args[0]);
+        if (blocking == -1 && PyErr_Occurred()) {
+            goto exit;
+        }
+        if (!--noptargs) {
+            goto skip_optional_pos;
+        }
+    }
+    timeout_obj = args[1];
+skip_optional_pos:
+    return_value = _multiprocessing_SemLock_acquire_impl(self, blocking, timeout_obj);
+
+exit:
+    return return_value;
+}
+
+#endif /* defined(MS_WINDOWS) */
+
+#if defined(MS_WINDOWS)
+
+PyDoc_STRVAR(_multiprocessing_SemLock_release__doc__,
+"release($self, /)\n"
+"--\n"
+"\n"
+"Release the semaphore/lock.");
+
+#define _MULTIPROCESSING_SEMLOCK_RELEASE_METHODDEF    \
+    {"release", (PyCFunction)_multiprocessing_SemLock_release, METH_NOARGS, _multiprocessing_SemLock_release__doc__},
+
+static PyObject *
+_multiprocessing_SemLock_release_impl(SemLockObject *self);
+
+static PyObject *
+_multiprocessing_SemLock_release(SemLockObject *self, PyObject *Py_UNUSED(ignored))
+{
+    return _multiprocessing_SemLock_release_impl(self);
+}
+
+#endif /* defined(MS_WINDOWS) */
+
+#if !defined(MS_WINDOWS)
+
+PyDoc_STRVAR(_multiprocessing_SemLock_acquire__doc__,
+"acquire($self, /, block=True, timeout=None)\n"
+"--\n"
+"\n"
+"Acquire the semaphore/lock.");
+
+#define _MULTIPROCESSING_SEMLOCK_ACQUIRE_METHODDEF    \
+    {"acquire", (PyCFunction)(void(*)(void))_multiprocessing_SemLock_acquire, METH_FASTCALL|METH_KEYWORDS, _multiprocessing_SemLock_acquire__doc__},
+
+static PyObject *
+_multiprocessing_SemLock_acquire_impl(SemLockObject *self, int blocking,
+                                      PyObject *timeout_obj);
+
+static PyObject *
+_multiprocessing_SemLock_acquire(SemLockObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"block", "timeout", NULL};
+    static _PyArg_Parser _parser = {NULL, _keywords, "acquire", 0};
+    PyObject *argsbuf[2];
+    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
+    int blocking = 1;
+    PyObject *timeout_obj = Py_None;
+
+    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 2, 0, argsbuf);
+    if (!args) {
+        goto exit;
+    }
+    if (!noptargs) {
+        goto skip_optional_pos;
+    }
+    if (args[0]) {
+        blocking = _PyLong_AsInt(args[0]);
+        if (blocking == -1 && PyErr_Occurred()) {
+            goto exit;
+        }
+        if (!--noptargs) {
+            goto skip_optional_pos;
+        }
+    }
+    timeout_obj = args[1];
+skip_optional_pos:
+    return_value = _multiprocessing_SemLock_acquire_impl(self, blocking, timeout_obj);
+
+exit:
+    return return_value;
+}
+
+#endif /* !defined(MS_WINDOWS) */
+
+#if !defined(MS_WINDOWS)
+
+PyDoc_STRVAR(_multiprocessing_SemLock_release__doc__,
+"release($self, /)\n"
+"--\n"
+"\n"
+"Release the semaphore/lock.");
+
+#define _MULTIPROCESSING_SEMLOCK_RELEASE_METHODDEF    \
+    {"release", (PyCFunction)_multiprocessing_SemLock_release, METH_NOARGS, _multiprocessing_SemLock_release__doc__},
+
+static PyObject *
+_multiprocessing_SemLock_release_impl(SemLockObject *self);
+
+static PyObject *
+_multiprocessing_SemLock_release(SemLockObject *self, PyObject *Py_UNUSED(ignored))
+{
+    return _multiprocessing_SemLock_release_impl(self);
+}
+
+#endif /* !defined(MS_WINDOWS) */
+
+static PyObject *
+_multiprocessing_SemLock_impl(PyTypeObject *type, int kind, int value,
+                              int maxvalue, const char *name, int unlink);
+
+static PyObject *
+_multiprocessing_SemLock(PyTypeObject *type, PyObject *args, PyObject *kwargs)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"kind", "value", "maxvalue", "name", "unlink", NULL};
+    static _PyArg_Parser _parser = {NULL, _keywords, "SemLock", 0};
+    PyObject *argsbuf[5];
+    PyObject * const *fastargs;
+    Py_ssize_t nargs = PyTuple_GET_SIZE(args);
+    int kind;
+    int value;
+    int maxvalue;
+    const char *name;
+    int unlink;
+
+    fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 5, 5, 0, argsbuf);
+    if (!fastargs) {
+        goto exit;
+    }
+    kind = _PyLong_AsInt(fastargs[0]);
+    if (kind == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    value = _PyLong_AsInt(fastargs[1]);
+    if (value == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    maxvalue = _PyLong_AsInt(fastargs[2]);
+    if (maxvalue == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    if (!PyUnicode_Check(fastargs[3])) {
+        _PyArg_BadArgument("SemLock", "argument 'name'", "str", fastargs[3]);
+        goto exit;
+    }
+    Py_ssize_t name_length;
+    name = PyUnicode_AsUTF8AndSize(fastargs[3], &name_length);
+    if (name == NULL) {
+        goto exit;
+    }
+    if (strlen(name) != (size_t)name_length) {
+        PyErr_SetString(PyExc_ValueError, "embedded null character");
+        goto exit;
+    }
+    unlink = _PyLong_AsInt(fastargs[4]);
+    if (unlink == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    return_value = _multiprocessing_SemLock_impl(type, kind, value, maxvalue, name, unlink);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_multiprocessing_SemLock__rebuild__doc__,
+"_rebuild($type, handle, kind, maxvalue, name, /)\n"
+"--\n"
+"\n");
+
+#define _MULTIPROCESSING_SEMLOCK__REBUILD_METHODDEF    \
+    {"_rebuild", (PyCFunction)(void(*)(void))_multiprocessing_SemLock__rebuild, METH_FASTCALL|METH_CLASS, _multiprocessing_SemLock__rebuild__doc__},
+
+static PyObject *
+_multiprocessing_SemLock__rebuild_impl(PyTypeObject *type, SEM_HANDLE handle,
+                                       int kind, int maxvalue,
+                                       const char *name);
+
+static PyObject *
+_multiprocessing_SemLock__rebuild(PyTypeObject *type, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    SEM_HANDLE handle;
+    int kind;
+    int maxvalue;
+    const char *name;
+
+    if (!_PyArg_ParseStack(args, nargs, ""F_SEM_HANDLE"iiz:_rebuild",
+        &handle, &kind, &maxvalue, &name)) {
+        goto exit;
+    }
+    return_value = _multiprocessing_SemLock__rebuild_impl(type, handle, kind, maxvalue, name);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_multiprocessing_SemLock__count__doc__,
+"_count($self, /)\n"
+"--\n"
+"\n"
+"Num of `acquire()`s minus num of `release()`s for this process.");
+
+#define _MULTIPROCESSING_SEMLOCK__COUNT_METHODDEF    \
+    {"_count", (PyCFunction)_multiprocessing_SemLock__count, METH_NOARGS, _multiprocessing_SemLock__count__doc__},
+
+static PyObject *
+_multiprocessing_SemLock__count_impl(SemLockObject *self);
+
+static PyObject *
+_multiprocessing_SemLock__count(SemLockObject *self, PyObject *Py_UNUSED(ignored))
+{
+    return _multiprocessing_SemLock__count_impl(self);
+}
+
+PyDoc_STRVAR(_multiprocessing_SemLock__is_mine__doc__,
+"_is_mine($self, /)\n"
+"--\n"
+"\n"
+"Whether the lock is owned by this thread.");
+
+#define _MULTIPROCESSING_SEMLOCK__IS_MINE_METHODDEF    \
+    {"_is_mine", (PyCFunction)_multiprocessing_SemLock__is_mine, METH_NOARGS, _multiprocessing_SemLock__is_mine__doc__},
+
+static PyObject *
+_multiprocessing_SemLock__is_mine_impl(SemLockObject *self);
+
+static PyObject *
+_multiprocessing_SemLock__is_mine(SemLockObject *self, PyObject *Py_UNUSED(ignored))
+{
+    return _multiprocessing_SemLock__is_mine_impl(self);
+}
+
+PyDoc_STRVAR(_multiprocessing_SemLock__get_value__doc__,
+"_get_value($self, /)\n"
+"--\n"
+"\n"
+"Get the value of the semaphore.");
+
+#define _MULTIPROCESSING_SEMLOCK__GET_VALUE_METHODDEF    \
+    {"_get_value", (PyCFunction)_multiprocessing_SemLock__get_value, METH_NOARGS, _multiprocessing_SemLock__get_value__doc__},
+
+static PyObject *
+_multiprocessing_SemLock__get_value_impl(SemLockObject *self);
+
+static PyObject *
+_multiprocessing_SemLock__get_value(SemLockObject *self, PyObject *Py_UNUSED(ignored))
+{
+    return _multiprocessing_SemLock__get_value_impl(self);
+}
+
+PyDoc_STRVAR(_multiprocessing_SemLock__is_zero__doc__,
+"_is_zero($self, /)\n"
+"--\n"
+"\n"
+"Return whether semaphore has value zero.");
+
+#define _MULTIPROCESSING_SEMLOCK__IS_ZERO_METHODDEF    \
+    {"_is_zero", (PyCFunction)_multiprocessing_SemLock__is_zero, METH_NOARGS, _multiprocessing_SemLock__is_zero__doc__},
+
+static PyObject *
+_multiprocessing_SemLock__is_zero_impl(SemLockObject *self);
+
+static PyObject *
+_multiprocessing_SemLock__is_zero(SemLockObject *self, PyObject *Py_UNUSED(ignored))
+{
+    return _multiprocessing_SemLock__is_zero_impl(self);
+}
+
+PyDoc_STRVAR(_multiprocessing_SemLock__after_fork__doc__,
+"_after_fork($self, /)\n"
+"--\n"
+"\n"
+"Rezero the net acquisition count after fork().");
+
+#define _MULTIPROCESSING_SEMLOCK__AFTER_FORK_METHODDEF    \
+    {"_after_fork", (PyCFunction)_multiprocessing_SemLock__after_fork, METH_NOARGS, _multiprocessing_SemLock__after_fork__doc__},
+
+static PyObject *
+_multiprocessing_SemLock__after_fork_impl(SemLockObject *self);
+
+static PyObject *
+_multiprocessing_SemLock__after_fork(SemLockObject *self, PyObject *Py_UNUSED(ignored))
+{
+    return _multiprocessing_SemLock__after_fork_impl(self);
+}
+
+PyDoc_STRVAR(_multiprocessing_SemLock___enter____doc__,
+"__enter__($self, /)\n"
+"--\n"
+"\n"
+"Enter the semaphore/lock.");
+
+#define _MULTIPROCESSING_SEMLOCK___ENTER___METHODDEF    \
+    {"__enter__", (PyCFunction)_multiprocessing_SemLock___enter__, METH_NOARGS, _multiprocessing_SemLock___enter____doc__},
+
+static PyObject *
+_multiprocessing_SemLock___enter___impl(SemLockObject *self);
+
+static PyObject *
+_multiprocessing_SemLock___enter__(SemLockObject *self, PyObject *Py_UNUSED(ignored))
+{
+    return _multiprocessing_SemLock___enter___impl(self);
+}
+
+PyDoc_STRVAR(_multiprocessing_SemLock___exit____doc__,
+"__exit__($self, exc_type=None, exc_value=None, exc_tb=None, /)\n"
+"--\n"
+"\n"
+"Exit the semaphore/lock.");
+
+#define _MULTIPROCESSING_SEMLOCK___EXIT___METHODDEF    \
+    {"__exit__", (PyCFunction)(void(*)(void))_multiprocessing_SemLock___exit__, METH_FASTCALL, _multiprocessing_SemLock___exit____doc__},
+
+static PyObject *
+_multiprocessing_SemLock___exit___impl(SemLockObject *self,
+                                       PyObject *exc_type,
+                                       PyObject *exc_value, PyObject *exc_tb);
+
+static PyObject *
+_multiprocessing_SemLock___exit__(SemLockObject *self, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    PyObject *exc_type = Py_None;
+    PyObject *exc_value = Py_None;
+    PyObject *exc_tb = Py_None;
+
+    if (!_PyArg_CheckPositional("__exit__", nargs, 0, 3)) {
+        goto exit;
+    }
+    if (nargs < 1) {
+        goto skip_optional;
+    }
+    exc_type = args[0];
+    if (nargs < 2) {
+        goto skip_optional;
+    }
+    exc_value = args[1];
+    if (nargs < 3) {
+        goto skip_optional;
+    }
+    exc_tb = args[2];
+skip_optional:
+    return_value = _multiprocessing_SemLock___exit___impl(self, exc_type, exc_value, exc_tb);
+
+exit:
+    return return_value;
+}
+
+#ifndef _MULTIPROCESSING_SEMLOCK_ACQUIRE_METHODDEF
+    #define _MULTIPROCESSING_SEMLOCK_ACQUIRE_METHODDEF
+#endif /* !defined(_MULTIPROCESSING_SEMLOCK_ACQUIRE_METHODDEF) */
+
+#ifndef _MULTIPROCESSING_SEMLOCK_RELEASE_METHODDEF
+    #define _MULTIPROCESSING_SEMLOCK_RELEASE_METHODDEF
+#endif /* !defined(_MULTIPROCESSING_SEMLOCK_RELEASE_METHODDEF) */
+/*[clinic end generated code: output=e7fd938150601fe5 input=a9049054013a1b77]*/
diff --git a/Modules/_multiprocessing/multiprocessing.c b/Modules/_multiprocessing/multiprocessing.c
index 806e638..bec2351 100644
--- a/Modules/_multiprocessing/multiprocessing.c
+++ b/Modules/_multiprocessing/multiprocessing.c
@@ -9,6 +9,20 @@
 
 #include "multiprocessing.h"
 
+/*[python input]
+class HANDLE_converter(CConverter):
+    type = "HANDLE"
+    format_unit = '"F_HANDLE"'
+
+[python start generated code]*/
+/*[python end generated code: output=da39a3ee5e6b4b0d input=9fad6080b79ace91]*/
+
+/*[clinic input]
+module _multiprocessing
+[clinic start generated code]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=01e0745f380ac6e3]*/
+
+#include "clinic/multiprocessing.c.h"
 
 /*
  * Function which raises exceptions based on error codes
@@ -50,14 +64,19 @@
 }
 
 #ifdef MS_WINDOWS
-static PyObject *
-multiprocessing_closesocket(PyObject *self, PyObject *args)
-{
-    HANDLE handle;
-    int ret;
+/*[clinic input]
+_multiprocessing.closesocket
 
-    if (!PyArg_ParseTuple(args, F_HANDLE ":closesocket" , &handle))
-        return NULL;
+    handle: HANDLE
+    /
+
+[clinic start generated code]*/
+
+static PyObject *
+_multiprocessing_closesocket_impl(PyObject *module, HANDLE handle)
+/*[clinic end generated code: output=214f359f900966f4 input=8a20706dd386c6cc]*/
+{
+    int ret;
 
     Py_BEGIN_ALLOW_THREADS
     ret = closesocket((SOCKET) handle);
@@ -68,15 +87,21 @@
     Py_RETURN_NONE;
 }
 
-static PyObject *
-multiprocessing_recv(PyObject *self, PyObject *args)
-{
-    HANDLE handle;
-    int size, nread;
-    PyObject *buf;
+/*[clinic input]
+_multiprocessing.recv
 
-    if (!PyArg_ParseTuple(args, F_HANDLE "i:recv" , &handle, &size))
-        return NULL;
+    handle: HANDLE
+    size: int
+    /
+
+[clinic start generated code]*/
+
+static PyObject *
+_multiprocessing_recv_impl(PyObject *module, HANDLE handle, int size)
+/*[clinic end generated code: output=92322781ba9ff598 input=6a5b0834372cee5b]*/
+{
+    int nread;
+    PyObject *buf;
 
     buf = PyBytes_FromStringAndSize(NULL, size);
     if (!buf)
@@ -94,23 +119,27 @@
     return buf;
 }
 
+/*[clinic input]
+_multiprocessing.send
+
+    handle: HANDLE
+    buf: Py_buffer
+    /
+
+[clinic start generated code]*/
+
 static PyObject *
-multiprocessing_send(PyObject *self, PyObject *args)
+_multiprocessing_send_impl(PyObject *module, HANDLE handle, Py_buffer *buf)
+/*[clinic end generated code: output=52d7df0519c596cb input=41dce742f98d2210]*/
 {
-    HANDLE handle;
-    Py_buffer buf;
     int ret, length;
 
-    if (!PyArg_ParseTuple(args, F_HANDLE "y*:send" , &handle, &buf))
-        return NULL;
-
-    length = (int)Py_MIN(buf.len, INT_MAX);
+    length = (int)Py_MIN(buf->len, INT_MAX);
 
     Py_BEGIN_ALLOW_THREADS
-    ret = send((SOCKET) handle, buf.buf, length, 0);
+    ret = send((SOCKET) handle, buf->buf, length, 0);
     Py_END_ALLOW_THREADS
 
-    PyBuffer_Release(&buf);
     if (ret < 0)
         return PyErr_SetExcFromWindowsErr(PyExc_OSError, WSAGetLastError());
     return PyLong_FromLong(ret);
@@ -118,18 +147,33 @@
 
 #endif
 
+/*[clinic input]
+_multiprocessing.sem_unlink
+
+    name: str
+    /
+
+[clinic start generated code]*/
+
+static PyObject *
+_multiprocessing_sem_unlink_impl(PyObject *module, const char *name)
+/*[clinic end generated code: output=fcbfeb1ed255e647 input=bf939aff9564f1d5]*/
+{
+    return _PyMp_sem_unlink(name);
+}
+
 /*
  * Function table
  */
 
 static PyMethodDef module_methods[] = {
 #ifdef MS_WINDOWS
-    {"closesocket", multiprocessing_closesocket, METH_VARARGS, ""},
-    {"recv", multiprocessing_recv, METH_VARARGS, ""},
-    {"send", multiprocessing_send, METH_VARARGS, ""},
+    _MULTIPROCESSING_CLOSESOCKET_METHODDEF
+    _MULTIPROCESSING_RECV_METHODDEF
+    _MULTIPROCESSING_SEND_METHODDEF
 #endif
 #if !defined(POSIX_SEMAPHORES_NOT_ENABLED) && !defined(__ANDROID__)
-    {"sem_unlink", _PyMp_sem_unlink, METH_VARARGS, ""},
+    _MULTIPROCESSING_SEM_UNLINK_METHODDEF
 #endif
     {NULL}
 };
@@ -139,35 +183,17 @@
  * Initialize
  */
 
-static struct PyModuleDef multiprocessing_module = {
-    PyModuleDef_HEAD_INIT,
-    "_multiprocessing",
-    NULL,
-    -1,
-    module_methods,
-    NULL,
-    NULL,
-    NULL,
-    NULL
-};
-
-
-PyMODINIT_FUNC
-PyInit__multiprocessing(void)
+static int
+multiprocessing_exec(PyObject *module)
 {
-    PyObject *module, *temp, *value = NULL;
-
-    /* Initialize module */
-    module = PyModule_Create(&multiprocessing_module);
-    if (!module)
-        return NULL;
-
 #if defined(MS_WINDOWS) ||                                              \
   (defined(HAVE_SEM_OPEN) && !defined(POSIX_SEMAPHORES_NOT_ENABLED))
+
     /* Add _PyMp_SemLock type to module */
-    if (PyType_Ready(&_PyMp_SemLockType) < 0)
-        return NULL;
-    Py_INCREF(&_PyMp_SemLockType);
+    if (PyModule_AddType(module, &_PyMp_SemLockType) < 0) {
+        return -1;
+    }
+
     {
         PyObject *py_sem_value_max;
         /* Some systems define SEM_VALUE_MAX as an unsigned value that
@@ -179,25 +205,40 @@
             py_sem_value_max = PyLong_FromLong(INT_MAX);
         else
             py_sem_value_max = PyLong_FromLong(SEM_VALUE_MAX);
-        if (py_sem_value_max == NULL)
-            return NULL;
-        PyDict_SetItemString(_PyMp_SemLockType.tp_dict, "SEM_VALUE_MAX",
-                             py_sem_value_max);
+
+        if (py_sem_value_max == NULL) {
+            return -1;
+        }
+        if (PyDict_SetItemString(_PyMp_SemLockType.tp_dict, "SEM_VALUE_MAX",
+                             py_sem_value_max) < 0) {
+            Py_DECREF(py_sem_value_max);
+            return -1;
+        }
+        Py_DECREF(py_sem_value_max);
     }
-    PyModule_AddObject(module, "SemLock", (PyObject*)&_PyMp_SemLockType);
+
 #endif
 
     /* Add configuration macros */
-    temp = PyDict_New();
-    if (!temp)
-        return NULL;
+    PyObject *flags = PyDict_New();
+    if (!flags) {
+        return -1;
+    }
 
-#define ADD_FLAG(name)                                            \
-    value = Py_BuildValue("i", name);                             \
-    if (value == NULL) { Py_DECREF(temp); return NULL; }          \
-    if (PyDict_SetItemString(temp, #name, value) < 0) {           \
-        Py_DECREF(temp); Py_DECREF(value); return NULL; }         \
-    Py_DECREF(value)
+#define ADD_FLAG(name)                                          \
+    do {                                                        \
+        PyObject *value = PyLong_FromLong(name);                \
+        if (value == NULL) {                                    \
+            Py_DECREF(flags);                                   \
+            return -1;                                          \
+        }                                                       \
+        if (PyDict_SetItemString(flags, #name, value) < 0) {    \
+            Py_DECREF(flags);                                   \
+            Py_DECREF(value);                                   \
+            return -1;                                          \
+        }                                                       \
+        Py_DECREF(value);                                       \
+    } while (0)
 
 #if defined(HAVE_SEM_OPEN) && !defined(POSIX_SEMAPHORES_NOT_ENABLED)
     ADD_FLAG(HAVE_SEM_OPEN);
@@ -212,8 +253,28 @@
     ADD_FLAG(HAVE_BROKEN_SEM_UNLINK);
 #endif
 
-    if (PyModule_AddObject(module, "flags", temp) < 0)
-        return NULL;
+    if (PyModule_AddObject(module, "flags", flags) < 0) {
+        Py_DECREF(flags);
+        return -1;
+    }
 
-    return module;
+    return 0;
+}
+
+static PyModuleDef_Slot multiprocessing_slots[] = {
+    {Py_mod_exec, multiprocessing_exec},
+    {0, NULL}
+};
+
+static struct PyModuleDef multiprocessing_module = {
+    PyModuleDef_HEAD_INIT,
+    .m_name = "_multiprocessing",
+    .m_methods = module_methods,
+    .m_slots = multiprocessing_slots,
+};
+
+PyMODINIT_FUNC
+PyInit__multiprocessing(void)
+{
+    return PyModuleDef_Init(&multiprocessing_module);
 }
diff --git a/Modules/_multiprocessing/multiprocessing.h b/Modules/_multiprocessing/multiprocessing.h
index fe78135..277963b 100644
--- a/Modules/_multiprocessing/multiprocessing.h
+++ b/Modules/_multiprocessing/multiprocessing.h
@@ -88,6 +88,6 @@
  */
 
 extern PyTypeObject _PyMp_SemLockType;
-extern PyObject *_PyMp_sem_unlink(PyObject *ignore, PyObject *args);
+extern PyObject *_PyMp_sem_unlink(const char *name);
 
 #endif /* MULTIPROCESSING_H */
diff --git a/Modules/_multiprocessing/posixshmem.c b/Modules/_multiprocessing/posixshmem.c
index 436ac6d..d64ded4 100644
--- a/Modules/_multiprocessing/posixshmem.c
+++ b/Modules/_multiprocessing/posixshmem.c
@@ -110,21 +110,17 @@
 };
 
 
-static struct PyModuleDef this_module = {
-    PyModuleDef_HEAD_INIT,  // m_base
-    "_posixshmem",          // m_name
-    "POSIX shared memory module",     // m_doc
-    -1,                     // m_size (space allocated for module globals)
-    module_methods,         // m_methods
+static struct PyModuleDef _posixshmemmodule = {
+    PyModuleDef_HEAD_INIT,
+    .m_name = "_posixshmem",
+    .m_doc = "POSIX shared memory module",
+    .m_size = 0,
+    .m_methods = module_methods,
 };
 
 /* Module init function */
 PyMODINIT_FUNC
-PyInit__posixshmem(void) {
-    PyObject *module;
-    module = PyModule_Create(&this_module);
-    if (!module) {
-        return NULL;
-    }
-    return module;
+PyInit__posixshmem(void)
+{
+    return PyModuleDef_Init(&_posixshmemmodule);
 }
diff --git a/Modules/_multiprocessing/semaphore.c b/Modules/_multiprocessing/semaphore.c
index ee49025..9a2d1f8 100644
--- a/Modules/_multiprocessing/semaphore.c
+++ b/Modules/_multiprocessing/semaphore.c
@@ -21,6 +21,22 @@
     char *name;
 } SemLockObject;
 
+/*[python input]
+class SEM_HANDLE_converter(CConverter):
+    type = "SEM_HANDLE"
+    format_unit = '"F_SEM_HANDLE"'
+
+[python start generated code]*/
+/*[python end generated code: output=da39a3ee5e6b4b0d input=3e0ad43e482d8716]*/
+
+/*[clinic input]
+module _multiprocessing
+class _multiprocessing.SemLock "SemLockObject *" "&_PyMp_SemLockType"
+[clinic start generated code]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=935fb41b7d032599]*/
+
+#include "clinic/semaphore.c.h"
+
 #define ISMINE(o) (o->count > 0 && PyThread_get_thread_ident() == o->last_tid)
 
 
@@ -58,21 +74,24 @@
     }
 }
 
+/*[clinic input]
+_multiprocessing.SemLock.acquire
+
+    block as blocking: bool(accept={int}) = True
+    timeout as timeout_obj: object = None
+
+Acquire the semaphore/lock.
+[clinic start generated code]*/
+
 static PyObject *
-semlock_acquire(SemLockObject *self, PyObject *args, PyObject *kwds)
+_multiprocessing_SemLock_acquire_impl(SemLockObject *self, int blocking,
+                                      PyObject *timeout_obj)
+/*[clinic end generated code: output=f9998f0b6b0b0872 input=86f05662cf753eb4]*/
 {
-    int blocking = 1;
     double timeout;
-    PyObject *timeout_obj = Py_None;
     DWORD res, full_msecs, nhandles;
     HANDLE handles[2], sigint_event;
 
-    static char *kwlist[] = {"block", "timeout", NULL};
-
-    if (!PyArg_ParseTupleAndKeywords(args, kwds, "|iO", kwlist,
-                                     &blocking, &timeout_obj))
-        return NULL;
-
     /* calculate timeout */
     if (!blocking) {
         full_msecs = 0;
@@ -146,8 +165,15 @@
     }
 }
 
+/*[clinic input]
+_multiprocessing.SemLock.release
+
+Release the semaphore/lock.
+[clinic start generated code]*/
+
 static PyObject *
-semlock_release(SemLockObject *self, PyObject *args)
+_multiprocessing_SemLock_release_impl(SemLockObject *self)
+/*[clinic end generated code: output=b22f53ba96b0d1db input=ba7e63a961885d3d]*/
 {
     if (self->kind == RECURSIVE_MUTEX) {
         if (!ISMINE(self)) {
@@ -264,19 +290,23 @@
 
 #endif /* !HAVE_SEM_TIMEDWAIT */
 
+/*[clinic input]
+_multiprocessing.SemLock.acquire
+
+    block as blocking: bool(accept={int}) = True
+    timeout as timeout_obj: object = None
+
+Acquire the semaphore/lock.
+[clinic start generated code]*/
+
 static PyObject *
-semlock_acquire(SemLockObject *self, PyObject *args, PyObject *kwds)
+_multiprocessing_SemLock_acquire_impl(SemLockObject *self, int blocking,
+                                      PyObject *timeout_obj)
+/*[clinic end generated code: output=f9998f0b6b0b0872 input=86f05662cf753eb4]*/
 {
-    int blocking = 1, res, err = 0;
-    PyObject *timeout_obj = Py_None;
+    int res, err = 0;
     struct timespec deadline = {0};
 
-    static char *kwlist[] = {"block", "timeout", NULL};
-
-    if (!PyArg_ParseTupleAndKeywords(args, kwds, "|iO", kwlist,
-                                     &blocking, &timeout_obj))
-        return NULL;
-
     if (self->kind == RECURSIVE_MUTEX && ISMINE(self)) {
         ++self->count;
         Py_RETURN_TRUE;
@@ -345,8 +375,15 @@
     Py_RETURN_TRUE;
 }
 
+/*[clinic input]
+_multiprocessing.SemLock.release
+
+Release the semaphore/lock.
+[clinic start generated code]*/
+
 static PyObject *
-semlock_release(SemLockObject *self, PyObject *args)
+_multiprocessing_SemLock_release_impl(SemLockObject *self)
+/*[clinic end generated code: output=b22f53ba96b0d1db input=ba7e63a961885d3d]*/
 {
     if (self->kind == RECURSIVE_MUTEX) {
         if (!ISMINE(self)) {
@@ -429,19 +466,26 @@
     return (PyObject*)self;
 }
 
+/*[clinic input]
+@classmethod
+_multiprocessing.SemLock.__new__
+
+    kind: int
+    value: int
+    maxvalue: int
+    name: str
+    unlink: bool(accept={int})
+
+[clinic start generated code]*/
+
 static PyObject *
-semlock_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+_multiprocessing_SemLock_impl(PyTypeObject *type, int kind, int value,
+                              int maxvalue, const char *name, int unlink)
+/*[clinic end generated code: output=30727e38f5f7577a input=b378c3ee27d3a0fa]*/
 {
     SEM_HANDLE handle = SEM_FAILED;
-    int kind, maxvalue, value, unlink;
     PyObject *result;
-    char *name, *name_copy = NULL;
-    static char *kwlist[] = {"kind", "value", "maxvalue", "name", "unlink",
-                             NULL};
-
-    if (!PyArg_ParseTupleAndKeywords(args, kwds, "iiisi", kwlist,
-                                     &kind, &value, &maxvalue, &name, &unlink))
-        return NULL;
+    char *name_copy = NULL;
 
     if (kind != RECURSIVE_MUTEX && kind != SEMAPHORE) {
         PyErr_SetString(PyExc_ValueError, "unrecognized kind");
@@ -481,16 +525,25 @@
     return NULL;
 }
 
-static PyObject *
-semlock_rebuild(PyTypeObject *type, PyObject *args)
-{
-    SEM_HANDLE handle;
-    int kind, maxvalue;
-    char *name, *name_copy = NULL;
+/*[clinic input]
+@classmethod
+_multiprocessing.SemLock._rebuild
 
-    if (!PyArg_ParseTuple(args, F_SEM_HANDLE "iiz",
-                          &handle, &kind, &maxvalue, &name))
-        return NULL;
+    handle: SEM_HANDLE
+    kind: int
+    maxvalue: int
+    name: str(accept={str, NoneType})
+    /
+
+[clinic start generated code]*/
+
+static PyObject *
+_multiprocessing_SemLock__rebuild_impl(PyTypeObject *type, SEM_HANDLE handle,
+                                       int kind, int maxvalue,
+                                       const char *name)
+/*[clinic end generated code: output=2aaee14f063f3bd9 input=f7040492ac6d9962]*/
+{
+    char *name_copy = NULL;
 
     if (name != NULL) {
         name_copy = PyMem_Malloc(strlen(name) + 1);
@@ -518,24 +571,45 @@
     if (self->handle != SEM_FAILED)
         SEM_CLOSE(self->handle);
     PyMem_Free(self->name);
-    PyObject_Del(self);
+    PyObject_Free(self);
 }
 
+/*[clinic input]
+_multiprocessing.SemLock._count
+
+Num of `acquire()`s minus num of `release()`s for this process.
+[clinic start generated code]*/
+
 static PyObject *
-semlock_count(SemLockObject *self, PyObject *Py_UNUSED(ignored))
+_multiprocessing_SemLock__count_impl(SemLockObject *self)
+/*[clinic end generated code: output=5ba8213900e517bb input=36fc59b1cd1025ab]*/
 {
     return PyLong_FromLong((long)self->count);
 }
 
+/*[clinic input]
+_multiprocessing.SemLock._is_mine
+
+Whether the lock is owned by this thread.
+[clinic start generated code]*/
+
 static PyObject *
-semlock_ismine(SemLockObject *self, PyObject *Py_UNUSED(ignored))
+_multiprocessing_SemLock__is_mine_impl(SemLockObject *self)
+/*[clinic end generated code: output=92dc98863f4303be input=a96664cb2f0093ba]*/
 {
     /* only makes sense for a lock */
     return PyBool_FromLong(ISMINE(self));
 }
 
+/*[clinic input]
+_multiprocessing.SemLock._get_value
+
+Get the value of the semaphore.
+[clinic start generated code]*/
+
 static PyObject *
-semlock_getvalue(SemLockObject *self, PyObject *Py_UNUSED(ignored))
+_multiprocessing_SemLock__get_value_impl(SemLockObject *self)
+/*[clinic end generated code: output=64bc1b89bda05e36 input=cb10f9a769836203]*/
 {
 #ifdef HAVE_BROKEN_SEM_GETVALUE
     PyErr_SetNone(PyExc_NotImplementedError);
@@ -552,8 +626,15 @@
 #endif
 }
 
+/*[clinic input]
+_multiprocessing.SemLock._is_zero
+
+Return whether semaphore has value zero.
+[clinic start generated code]*/
+
 static PyObject *
-semlock_iszero(SemLockObject *self, PyObject *Py_UNUSED(ignored))
+_multiprocessing_SemLock__is_zero_impl(SemLockObject *self)
+/*[clinic end generated code: output=815d4c878c806ed7 input=294a446418d31347]*/
 {
 #ifdef HAVE_BROKEN_SEM_GETVALUE
     if (sem_trywait(self->handle) < 0) {
@@ -573,38 +654,68 @@
 #endif
 }
 
+/*[clinic input]
+_multiprocessing.SemLock._after_fork
+
+Rezero the net acquisition count after fork().
+[clinic start generated code]*/
+
 static PyObject *
-semlock_afterfork(SemLockObject *self, PyObject *Py_UNUSED(ignored))
+_multiprocessing_SemLock__after_fork_impl(SemLockObject *self)
+/*[clinic end generated code: output=718bb27914c6a6c1 input=190991008a76621e]*/
 {
     self->count = 0;
     Py_RETURN_NONE;
 }
 
+/*[clinic input]
+_multiprocessing.SemLock.__enter__
+
+Enter the semaphore/lock.
+[clinic start generated code]*/
+
+static PyObject *
+_multiprocessing_SemLock___enter___impl(SemLockObject *self)
+/*[clinic end generated code: output=beeb2f07c858511f input=c5e27d594284690b]*/
+{
+    return _multiprocessing_SemLock_acquire_impl(self, 1, Py_None);
+}
+
+/*[clinic input]
+_multiprocessing.SemLock.__exit__
+
+    exc_type: object = None
+    exc_value: object = None
+    exc_tb: object = None
+    /
+
+Exit the semaphore/lock.
+[clinic start generated code]*/
+
+static PyObject *
+_multiprocessing_SemLock___exit___impl(SemLockObject *self,
+                                       PyObject *exc_type,
+                                       PyObject *exc_value, PyObject *exc_tb)
+/*[clinic end generated code: output=3b37c1a9f8b91a03 input=7d644b64a89903f8]*/
+{
+    return _multiprocessing_SemLock_release_impl(self);
+}
+
 /*
  * Semaphore methods
  */
 
 static PyMethodDef semlock_methods[] = {
-    {"acquire", (PyCFunction)(void(*)(void))semlock_acquire, METH_VARARGS | METH_KEYWORDS,
-     "acquire the semaphore/lock"},
-    {"release", (PyCFunction)semlock_release, METH_NOARGS,
-     "release the semaphore/lock"},
-    {"__enter__", (PyCFunction)(void(*)(void))semlock_acquire, METH_VARARGS | METH_KEYWORDS,
-     "enter the semaphore/lock"},
-    {"__exit__", (PyCFunction)semlock_release, METH_VARARGS,
-     "exit the semaphore/lock"},
-    {"_count", (PyCFunction)semlock_count, METH_NOARGS,
-     "num of `acquire()`s minus num of `release()`s for this process"},
-    {"_is_mine", (PyCFunction)semlock_ismine, METH_NOARGS,
-     "whether the lock is owned by this thread"},
-    {"_get_value", (PyCFunction)semlock_getvalue, METH_NOARGS,
-     "get the value of the semaphore"},
-    {"_is_zero", (PyCFunction)semlock_iszero, METH_NOARGS,
-     "returns whether semaphore has value zero"},
-    {"_rebuild", (PyCFunction)semlock_rebuild, METH_VARARGS | METH_CLASS,
-     ""},
-    {"_after_fork", (PyCFunction)semlock_afterfork, METH_NOARGS,
-     "rezero the net acquisition count after fork()"},
+    _MULTIPROCESSING_SEMLOCK_ACQUIRE_METHODDEF
+    _MULTIPROCESSING_SEMLOCK_RELEASE_METHODDEF
+    _MULTIPROCESSING_SEMLOCK___ENTER___METHODDEF
+    _MULTIPROCESSING_SEMLOCK___EXIT___METHODDEF
+    _MULTIPROCESSING_SEMLOCK__COUNT_METHODDEF
+    _MULTIPROCESSING_SEMLOCK__IS_MINE_METHODDEF
+    _MULTIPROCESSING_SEMLOCK__GET_VALUE_METHODDEF
+    _MULTIPROCESSING_SEMLOCK__IS_ZERO_METHODDEF
+    _MULTIPROCESSING_SEMLOCK__REBUILD_METHODDEF
+    _MULTIPROCESSING_SEMLOCK__AFTER_FORK_METHODDEF
     {NULL}
 };
 
@@ -666,7 +777,7 @@
     /* tp_dictoffset     */ 0,
     /* tp_init           */ 0,
     /* tp_alloc          */ 0,
-    /* tp_new            */ semlock_new,
+    /* tp_new            */ _multiprocessing_SemLock,
 };
 
 /*
@@ -674,13 +785,8 @@
  */
 
 PyObject *
-_PyMp_sem_unlink(PyObject *ignore, PyObject *args)
+_PyMp_sem_unlink(const char *name)
 {
-    char *name;
-
-    if (!PyArg_ParseTuple(args, "s", &name))
-        return NULL;
-
     if (SEM_UNLINK(name) < 0) {
         _PyMp_SetError(NULL, MP_STANDARD_ERROR);
         return NULL;
diff --git a/Modules/_opcode.c b/Modules/_opcode.c
index 42a8732..d8de076 100644
--- a/Modules/_opcode.c
+++ b/Modules/_opcode.c
@@ -36,8 +36,9 @@
             return -1;
         }
         oparg_int = (int)PyLong_AsLong(oparg);
-        if ((oparg_int == -1) && PyErr_Occurred())
+        if ((oparg_int == -1) && PyErr_Occurred()) {
             return -1;
+        }
     }
     else if (oparg != Py_None) {
         PyErr_SetString(PyExc_ValueError,
@@ -67,30 +68,22 @@
     return effect;
 }
 
-
-
-
 static PyMethodDef
 opcode_functions[] =  {
     _OPCODE_STACK_EFFECT_METHODDEF
     {NULL, NULL, 0, NULL}
 };
 
-
 static struct PyModuleDef opcodemodule = {
     PyModuleDef_HEAD_INIT,
-    "_opcode",
-    "Opcode support module.",
-    -1,
-    opcode_functions,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    .m_name = "_opcode",
+    .m_doc = "Opcode support module.",
+    .m_size = 0,
+    .m_methods = opcode_functions
 };
 
 PyMODINIT_FUNC
 PyInit__opcode(void)
 {
-    return PyModule_Create(&opcodemodule);
+    return PyModuleDef_Init(&opcodemodule);
 }
diff --git a/Modules/_operator.c b/Modules/_operator.c
index 6f8f68f..f051513 100644
--- a/Modules/_operator.c
+++ b/Modules/_operator.c
@@ -1,8 +1,21 @@
-
 #include "Python.h"
-
+#include "pycore_moduleobject.h"  // _PyModule_GetState()
 #include "clinic/_operator.c.h"
 
+typedef struct {
+    PyObject *itemgetter_type;
+    PyObject *attrgetter_type;
+    PyObject *methodcaller_type;
+} _operator_state;
+
+static inline _operator_state*
+get_operator_state(PyObject *module)
+{
+    void *state = _PyModule_GetState(module);
+    assert(state != NULL);
+    return (_operator_state *)state;
+}
+
 /*[clinic input]
 module _operator
 [clinic start generated code]*/
@@ -494,12 +507,12 @@
 /*[clinic input]
 _operator.countOf = _operator.indexOf
 
-Return the number of times b occurs in a.
+Return the number of items in a which are, or which equal, b.
 [clinic start generated code]*/
 
 static Py_ssize_t
 _operator_countOf_impl(PyObject *module, PyObject *a, PyObject *b)
-/*[clinic end generated code: output=9e1623197daf3382 input=0c3a2656add252db]*/
+/*[clinic end generated code: output=9e1623197daf3382 input=93ea57f170f3f0bb]*/
 {
     return PySequence_Count(a, b);
 }
@@ -942,8 +955,6 @@
     Py_ssize_t index; // -1 unless *item* is a single non-negative integer index
 } itemgetterobject;
 
-static PyTypeObject itemgetter_type;
-
 /* AC 3.5: treats first argument as an iterable, otherwise uses *args */
 static PyObject *
 itemgetter_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
@@ -960,13 +971,15 @@
     if (nitems <= 1) {
         if (!PyArg_UnpackTuple(args, "itemgetter", 1, 1, &item))
             return NULL;
-    } else
+    } else {
         item = args;
-
+    }
+    _operator_state *state = PyType_GetModuleState(type);
     /* create itemgetterobject structure */
-    ig = PyObject_GC_New(itemgetterobject, &itemgetter_type);
-    if (ig == NULL)
+    ig = PyObject_GC_New(itemgetterobject, (PyTypeObject *) state->itemgetter_type);
+    if (ig == NULL) {
         return NULL;
+    }
 
     Py_INCREF(item);
     ig->item = item;
@@ -991,17 +1004,27 @@
     return (PyObject *)ig;
 }
 
+static int
+itemgetter_clear(itemgetterobject *ig)
+{
+    Py_CLEAR(ig->item);
+    return 0;
+}
+
 static void
 itemgetter_dealloc(itemgetterobject *ig)
 {
+    PyTypeObject *tp = Py_TYPE(ig);
     PyObject_GC_UnTrack(ig);
-    Py_XDECREF(ig->item);
-    PyObject_GC_Del(ig);
+    (void)itemgetter_clear(ig);
+    tp->tp_free(ig);
+    Py_DECREF(tp);
 }
 
 static int
 itemgetter_traverse(itemgetterobject *ig, visitproc visit, void *arg)
 {
+    Py_VISIT(Py_TYPE(ig));
     Py_VISIT(ig->item);
     return 0;
 }
@@ -1093,49 +1116,27 @@
 After f = itemgetter(2), the call f(r) returns r[2].\n\
 After g = itemgetter(2, 5, 3), the call g(r) returns (r[2], r[5], r[3])");
 
-static PyTypeObject itemgetter_type = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "operator.itemgetter",              /* tp_name */
-    sizeof(itemgetterobject),           /* tp_basicsize */
-    0,                                  /* tp_itemsize */
-    /* methods */
-    (destructor)itemgetter_dealloc,     /* tp_dealloc */
-    0,                                  /* tp_vectorcall_offset */
-    0,                                  /* tp_getattr */
-    0,                                  /* tp_setattr */
-    0,                                  /* tp_as_async */
-    (reprfunc)itemgetter_repr,          /* tp_repr */
-    0,                                  /* tp_as_number */
-    0,                                  /* tp_as_sequence */
-    0,                                  /* tp_as_mapping */
-    0,                                  /* tp_hash */
-    (ternaryfunc)itemgetter_call,       /* tp_call */
-    0,                                  /* tp_str */
-    PyObject_GenericGetAttr,            /* tp_getattro */
-    0,                                  /* tp_setattro */
-    0,                                  /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,            /* tp_flags */
-    itemgetter_doc,                     /* tp_doc */
-    (traverseproc)itemgetter_traverse,          /* tp_traverse */
-    0,                                  /* tp_clear */
-    0,                                  /* tp_richcompare */
-    0,                                  /* tp_weaklistoffset */
-    0,                                  /* tp_iter */
-    0,                                  /* tp_iternext */
-    itemgetter_methods,                 /* tp_methods */
-    0,                                  /* tp_members */
-    0,                                  /* tp_getset */
-    0,                                  /* tp_base */
-    0,                                  /* tp_dict */
-    0,                                  /* tp_descr_get */
-    0,                                  /* tp_descr_set */
-    0,                                  /* tp_dictoffset */
-    0,                                  /* tp_init */
-    0,                                  /* tp_alloc */
-    itemgetter_new,                     /* tp_new */
-    0,                                  /* tp_free */
+static PyType_Slot itemgetter_type_slots[] = {
+    {Py_tp_doc, (void *)itemgetter_doc},
+    {Py_tp_dealloc, itemgetter_dealloc},
+    {Py_tp_call, itemgetter_call},
+    {Py_tp_traverse, itemgetter_traverse},
+    {Py_tp_clear, itemgetter_clear},
+    {Py_tp_methods, itemgetter_methods},
+    {Py_tp_new, itemgetter_new},
+    {Py_tp_getattro, PyObject_GenericGetAttr},
+    {Py_tp_repr, itemgetter_repr},
+    {0, 0}
 };
 
+static PyType_Spec itemgetter_type_spec = {
+    .name = "operator.itemgetter",
+    .basicsize = sizeof(itemgetterobject),
+    .itemsize = 0,
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
+              Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = itemgetter_type_slots,
+};
 
 /* attrgetter object **********************************************************/
 
@@ -1145,8 +1146,6 @@
     PyObject *attr;
 } attrgetterobject;
 
-static PyTypeObject attrgetter_type;
-
 /* AC 3.5: treats first argument as an iterable, otherwise uses *args */
 static PyObject *
 attrgetter_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
@@ -1246,8 +1245,9 @@
         }
     }
 
+    _operator_state *state = PyType_GetModuleState(type);
     /* create attrgetterobject structure */
-    ag = PyObject_GC_New(attrgetterobject, &attrgetter_type);
+    ag = PyObject_GC_New(attrgetterobject, (PyTypeObject *)state->attrgetter_type);
     if (ag == NULL) {
         Py_DECREF(attr);
         return NULL;
@@ -1260,18 +1260,28 @@
     return (PyObject *)ag;
 }
 
+static int
+attrgetter_clear(attrgetterobject *ag)
+{
+    Py_CLEAR(ag->attr);
+    return 0;
+}
+
 static void
 attrgetter_dealloc(attrgetterobject *ag)
 {
+    PyTypeObject *tp = Py_TYPE(ag);
     PyObject_GC_UnTrack(ag);
-    Py_XDECREF(ag->attr);
-    PyObject_GC_Del(ag);
+    (void)attrgetter_clear(ag);
+    tp->tp_free(ag);
+    Py_DECREF(tp);
 }
 
 static int
 attrgetter_traverse(attrgetterobject *ag, visitproc visit, void *arg)
 {
     Py_VISIT(ag->attr);
+    Py_VISIT(Py_TYPE(ag));
     return 0;
 }
 
@@ -1438,47 +1448,26 @@
 After h = attrgetter('name.first', 'name.last'), the call h(r) returns\n\
 (r.name.first, r.name.last).");
 
-static PyTypeObject attrgetter_type = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "operator.attrgetter",              /* tp_name */
-    sizeof(attrgetterobject),           /* tp_basicsize */
-    0,                                  /* tp_itemsize */
-    /* methods */
-    (destructor)attrgetter_dealloc,     /* tp_dealloc */
-    0,                                  /* tp_vectorcall_offset */
-    0,                                  /* tp_getattr */
-    0,                                  /* tp_setattr */
-    0,                                  /* tp_as_async */
-    (reprfunc)attrgetter_repr,          /* tp_repr */
-    0,                                  /* tp_as_number */
-    0,                                  /* tp_as_sequence */
-    0,                                  /* tp_as_mapping */
-    0,                                  /* tp_hash */
-    (ternaryfunc)attrgetter_call,       /* tp_call */
-    0,                                  /* tp_str */
-    PyObject_GenericGetAttr,            /* tp_getattro */
-    0,                                  /* tp_setattro */
-    0,                                  /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,            /* tp_flags */
-    attrgetter_doc,                     /* tp_doc */
-    (traverseproc)attrgetter_traverse,          /* tp_traverse */
-    0,                                  /* tp_clear */
-    0,                                  /* tp_richcompare */
-    0,                                  /* tp_weaklistoffset */
-    0,                                  /* tp_iter */
-    0,                                  /* tp_iternext */
-    attrgetter_methods,                 /* tp_methods */
-    0,                                  /* tp_members */
-    0,                                  /* tp_getset */
-    0,                                  /* tp_base */
-    0,                                  /* tp_dict */
-    0,                                  /* tp_descr_get */
-    0,                                  /* tp_descr_set */
-    0,                                  /* tp_dictoffset */
-    0,                                  /* tp_init */
-    0,                                  /* tp_alloc */
-    attrgetter_new,                     /* tp_new */
-    0,                                  /* tp_free */
+static PyType_Slot attrgetter_type_slots[] = {
+    {Py_tp_doc, (void *)attrgetter_doc},
+    {Py_tp_dealloc, attrgetter_dealloc},
+    {Py_tp_call, attrgetter_call},
+    {Py_tp_traverse, attrgetter_traverse},
+    {Py_tp_clear, attrgetter_clear},
+    {Py_tp_methods, attrgetter_methods},
+    {Py_tp_new, attrgetter_new},
+    {Py_tp_getattro, PyObject_GenericGetAttr},
+    {Py_tp_repr, attrgetter_repr},
+    {0, 0}
+};
+
+static PyType_Spec attrgetter_type_spec = {
+    .name = "operator.attrgetter",
+    .basicsize = sizeof(attrgetterobject),
+    .itemsize = 0,
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
+              Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = attrgetter_type_slots,
 };
 
 
@@ -1491,8 +1480,6 @@
     PyObject *kwds;
 } methodcallerobject;
 
-static PyTypeObject methodcaller_type;
-
 /* AC 3.5: variable number of arguments, not currently support by AC */
 static PyObject *
 methodcaller_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
@@ -1513,10 +1500,12 @@
         return NULL;
     }
 
+    _operator_state *state = PyType_GetModuleState(type);
     /* create methodcallerobject structure */
-    mc = PyObject_GC_New(methodcallerobject, &methodcaller_type);
-    if (mc == NULL)
+    mc = PyObject_GC_New(methodcallerobject, (PyTypeObject *)state->methodcaller_type);
+    if (mc == NULL) {
         return NULL;
+    }
 
     name = PyTuple_GET_ITEM(args, 0);
     Py_INCREF(name);
@@ -1536,21 +1525,32 @@
     return (PyObject *)mc;
 }
 
+static int
+methodcaller_clear(methodcallerobject *mc)
+{
+    Py_CLEAR(mc->name);
+    Py_CLEAR(mc->args);
+    Py_CLEAR(mc->kwds);
+    return 0;
+}
+
 static void
 methodcaller_dealloc(methodcallerobject *mc)
 {
+    PyTypeObject *tp = Py_TYPE(mc);
     PyObject_GC_UnTrack(mc);
-    Py_XDECREF(mc->name);
-    Py_XDECREF(mc->args);
-    Py_XDECREF(mc->kwds);
-    PyObject_GC_Del(mc);
+    (void)methodcaller_clear(mc);
+    tp->tp_free(mc);
+    Py_DECREF(tp);
 }
 
 static int
 methodcaller_traverse(methodcallerobject *mc, visitproc visit, void *arg)
 {
+    Py_VISIT(mc->name);
     Py_VISIT(mc->args);
     Py_VISIT(mc->kwds);
+    Py_VISIT(Py_TYPE(mc));
     return 0;
 }
 
@@ -1704,63 +1704,54 @@
 After g = methodcaller('name', 'date', foo=1), the call g(r) returns\n\
 r.name('date', foo=1).");
 
-static PyTypeObject methodcaller_type = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "operator.methodcaller",            /* tp_name */
-    sizeof(methodcallerobject),         /* tp_basicsize */
-    0,                                  /* tp_itemsize */
-    /* methods */
-    (destructor)methodcaller_dealloc, /* tp_dealloc */
-    0,                                  /* tp_vectorcall_offset */
-    0,                                  /* tp_getattr */
-    0,                                  /* tp_setattr */
-    0,                                  /* tp_as_async */
-    (reprfunc)methodcaller_repr,        /* tp_repr */
-    0,                                  /* tp_as_number */
-    0,                                  /* tp_as_sequence */
-    0,                                  /* tp_as_mapping */
-    0,                                  /* tp_hash */
-    (ternaryfunc)methodcaller_call,     /* tp_call */
-    0,                                  /* tp_str */
-    PyObject_GenericGetAttr,            /* tp_getattro */
-    0,                                  /* tp_setattro */
-    0,                                  /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */
-    methodcaller_doc,                           /* tp_doc */
-    (traverseproc)methodcaller_traverse,        /* tp_traverse */
-    0,                                  /* tp_clear */
-    0,                                  /* tp_richcompare */
-    0,                                  /* tp_weaklistoffset */
-    0,                                  /* tp_iter */
-    0,                                  /* tp_iternext */
-    methodcaller_methods,               /* tp_methods */
-    0,                                  /* tp_members */
-    0,                                  /* tp_getset */
-    0,                                  /* tp_base */
-    0,                                  /* tp_dict */
-    0,                                  /* tp_descr_get */
-    0,                                  /* tp_descr_set */
-    0,                                  /* tp_dictoffset */
-    0,                                  /* tp_init */
-    0,                                  /* tp_alloc */
-    methodcaller_new,                   /* tp_new */
-    0,                                  /* tp_free */
+static PyType_Slot methodcaller_type_slots[] = {
+    {Py_tp_doc, (void *)methodcaller_doc},
+    {Py_tp_dealloc, methodcaller_dealloc},
+    {Py_tp_call, methodcaller_call},
+    {Py_tp_traverse, methodcaller_traverse},
+    {Py_tp_clear, methodcaller_clear},
+    {Py_tp_methods, methodcaller_methods},
+    {Py_tp_new, methodcaller_new},
+    {Py_tp_getattro, PyObject_GenericGetAttr},
+    {Py_tp_repr, methodcaller_repr},
+    {0, 0}
 };
 
+static PyType_Spec methodcaller_type_spec = {
+    .name = "operator.methodcaller",
+    .basicsize = sizeof(methodcallerobject),
+    .itemsize = 0,
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
+              Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = methodcaller_type_slots,
+};
 
 static int
 operator_exec(PyObject *module)
 {
-    PyTypeObject *types[] = {
-        &itemgetter_type,
-        &attrgetter_type,
-        &methodcaller_type
-    };
+    _operator_state *state = get_operator_state(module);
+    state->attrgetter_type = PyType_FromModuleAndSpec(module, &attrgetter_type_spec, NULL);
+    if (state->attrgetter_type == NULL) {
+        return -1;
+    }
+    if (PyModule_AddType(module, (PyTypeObject *)state->attrgetter_type) < 0) {
+        return -1;
+    }
 
-    for (size_t i = 0; i < Py_ARRAY_LENGTH(types); i++) {
-        if (PyModule_AddType(module, types[i]) < 0) {
-            return -1;
-        }
+    state->itemgetter_type = PyType_FromModuleAndSpec(module, &itemgetter_type_spec, NULL);
+    if (state->itemgetter_type == NULL) {
+        return -1;
+    }
+    if (PyModule_AddType(module, (PyTypeObject *)state->itemgetter_type) < 0) {
+        return -1;
+    }
+
+    state->methodcaller_type = PyType_FromModuleAndSpec(module, &methodcaller_type_spec, NULL);
+    if (state->methodcaller_type == NULL) {
+        return -1;
+    }
+    if (PyModule_AddType(module, (PyTypeObject *)state->methodcaller_type) < 0) {
+        return -1;
     }
 
     return 0;
@@ -1772,17 +1763,42 @@
     {0, NULL}
 };
 
+static int
+operator_traverse(PyObject *module, visitproc visit, void *arg)
+{
+    _operator_state *state = get_operator_state(module);
+    Py_VISIT(state->attrgetter_type);
+    Py_VISIT(state->itemgetter_type);
+    Py_VISIT(state->methodcaller_type);
+    return 0;
+}
+
+static int
+operator_clear(PyObject *module)
+{
+    _operator_state *state = get_operator_state(module);
+    Py_CLEAR(state->attrgetter_type);
+    Py_CLEAR(state->itemgetter_type);
+    Py_CLEAR(state->methodcaller_type);
+    return 0;
+}
+
+static void
+operator_free(void *module)
+{
+    operator_clear((PyObject *)module);
+}
 
 static struct PyModuleDef operatormodule = {
     PyModuleDef_HEAD_INIT,
-    "_operator",
-    operator_doc,
-    0,
-    operator_methods,
-    operator_slots,
-    NULL,
-    NULL,
-    NULL
+    .m_name = "_operator",
+    .m_doc = operator_doc,
+    .m_size = sizeof(_operator_state),
+    .m_methods = operator_methods,
+    .m_slots = operator_slots,
+    .m_traverse = operator_traverse,
+    .m_clear = operator_clear,
+    .m_free = operator_free,
 };
 
 PyMODINIT_FUNC
diff --git a/Modules/_peg_parser.c b/Modules/_peg_parser.c
deleted file mode 100644
index ca2a3cf..0000000
--- a/Modules/_peg_parser.c
+++ /dev/null
@@ -1,153 +0,0 @@
-#include <Python.h>
-#include "pegen_interface.h"
-
-static int
-_mode_str_to_int(char *mode_str)
-{
-    int mode;
-    if (strcmp(mode_str, "exec") == 0) {
-        mode = Py_file_input;
-    }
-    else if (strcmp(mode_str, "eval") == 0) {
-        mode = Py_eval_input;
-    }
-    else if (strcmp(mode_str, "single") == 0) {
-        mode = Py_single_input;
-    }
-    else {
-        mode = -1;
-    }
-    return mode;
-}
-
-static mod_ty
-_run_parser(char *str, char *filename, int mode, PyCompilerFlags *flags, PyArena *arena, int oldparser)
-{
-    mod_ty mod;
-    if (!oldparser) {
-        mod = PyPegen_ASTFromString(str, filename, mode, flags, arena);
-    }
-    else {
-        mod = PyParser_ASTFromString(str, filename, mode, flags, arena);
-    }
-    return mod;
-}
-
-PyObject *
-_Py_compile_string(PyObject *self, PyObject *args, PyObject *kwds)
-{
-    static char *keywords[] = {"string", "filename", "mode", "oldparser", NULL};
-    char *the_string;
-    char *filename = "<string>";
-    char *mode_str = "exec";
-    int oldparser = 0;
-
-    if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|ssp", keywords,
-            &the_string, &filename, &mode_str, &oldparser)) {
-        return NULL;
-    }
-
-    int mode = _mode_str_to_int(mode_str);
-    if (mode == -1) {
-        return PyErr_Format(PyExc_ValueError, "mode must be either 'exec' or 'eval' or 'single'");
-    }
-
-    PyCompilerFlags flags = _PyCompilerFlags_INIT;
-    flags.cf_flags = PyCF_IGNORE_COOKIE;
-
-    PyArena *arena = PyArena_New();
-    if (arena == NULL) {
-        return NULL;
-    }
-
-    mod_ty mod = _run_parser(the_string, filename, mode, &flags, arena, oldparser);
-    if (mod == NULL) {
-        PyArena_Free(arena);
-        return NULL;
-    }
-
-    PyObject *filename_ob = PyUnicode_DecodeFSDefault(filename);
-    if (filename_ob == NULL) {
-        PyArena_Free(arena);
-        return NULL;
-    }
-    PyCodeObject *result = PyAST_CompileObject(mod, filename_ob, &flags, -1, arena);
-    Py_XDECREF(filename_ob);
-    PyArena_Free(arena);
-    return (PyObject *)result;
-}
-
-PyObject *
-_Py_parse_string(PyObject *self, PyObject *args, PyObject *kwds)
-{
-    static char *keywords[] = {"string", "filename", "mode", "oldparser", "ast", NULL};
-    char *the_string;
-    char *filename = "<string>";
-    char *mode_str = "exec";
-    int oldparser = 0;
-    int ast = 1;
-
-    if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|sspp", keywords,
-            &the_string, &filename, &mode_str, &oldparser, &ast)) {
-        return NULL;
-    }
-
-    int mode = _mode_str_to_int(mode_str);
-    if (mode == -1) {
-        return PyErr_Format(PyExc_ValueError, "mode must be either 'exec' or 'eval' or 'single'");
-    }
-
-    PyCompilerFlags flags = _PyCompilerFlags_INIT;
-    flags.cf_flags = PyCF_IGNORE_COOKIE;
-
-    PyArena *arena = PyArena_New();
-    if (arena == NULL) {
-        return NULL;
-    }
-
-    mod_ty mod = _run_parser(the_string, filename, mode, &flags, arena, oldparser);
-    if (mod == NULL) {
-        PyArena_Free(arena);
-        return NULL;
-    }
-
-    PyObject *result;
-    if (ast) {
-        result = PyAST_mod2obj(mod);
-    }
-    else {
-        Py_INCREF(Py_None);
-        result = Py_None;
-    }
-    PyArena_Free(arena);
-    return result;
-}
-
-static PyMethodDef ParseMethods[] = {
-    {
-        "parse_string",
-        (PyCFunction)(void (*)(void))_Py_parse_string,
-        METH_VARARGS|METH_KEYWORDS,
-        "Parse a string, return an AST."
-    },
-    {
-        "compile_string",
-        (PyCFunction)(void (*)(void))_Py_compile_string,
-        METH_VARARGS|METH_KEYWORDS,
-        "Compile a string, return a code object."
-    },
-    {NULL, NULL, 0, NULL} /* Sentinel */
-};
-
-static struct PyModuleDef parsemodule = {
-    PyModuleDef_HEAD_INIT,
-    .m_name = "peg_parser",
-    .m_doc = "A parser.",
-    .m_methods = ParseMethods,
-};
-
-PyMODINIT_FUNC
-PyInit__peg_parser(void)
-{
-    return PyModule_Create(&parsemodule);
-}
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index 8dea2c6..919490c 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -9,6 +9,7 @@
 #endif
 
 #include "Python.h"
+#include "pycore_moduleobject.h"  // _PyModule_GetState()
 #include "structmember.h"         // PyMemberDef
 
 PyDoc_STRVAR(pickle_module_doc,
@@ -182,7 +183,7 @@
 static PickleState *
 _Pickle_GetState(PyObject *module)
 {
-    return (PickleState *)PyModule_GetState(module);
+    return (PickleState *)_PyModule_GetState(module);
 }
 
 /* Find the module instance imported in the currently running sub-interpreter
@@ -442,8 +443,8 @@
     while (--i >= 0) {
         Py_DECREF(self->data[i]);
     }
-    PyMem_FREE(self->data);
-    PyObject_Del(self);
+    PyMem_Free(self->data);
+    PyObject_Free(self);
 }
 
 static PyTypeObject Pdata_Type = {
@@ -465,7 +466,7 @@
     self->mark_set = 0;
     self->fence = 0;
     self->allocated = 8;
-    self->data = PyMem_MALLOC(self->allocated * sizeof(PyObject *));
+    self->data = PyMem_Malloc(self->allocated * sizeof(PyObject *));
     if (self->data)
         return (PyObject *)self;
     Py_DECREF(self);
@@ -726,7 +727,7 @@
 static PyMemoTable *
 PyMemoTable_New(void)
 {
-    PyMemoTable *memo = PyMem_MALLOC(sizeof(PyMemoTable));
+    PyMemoTable *memo = PyMem_Malloc(sizeof(PyMemoTable));
     if (memo == NULL) {
         PyErr_NoMemory();
         return NULL;
@@ -735,9 +736,9 @@
     memo->mt_used = 0;
     memo->mt_allocated = MT_MINSIZE;
     memo->mt_mask = MT_MINSIZE - 1;
-    memo->mt_table = PyMem_MALLOC(MT_MINSIZE * sizeof(PyMemoEntry));
+    memo->mt_table = PyMem_Malloc(MT_MINSIZE * sizeof(PyMemoEntry));
     if (memo->mt_table == NULL) {
-        PyMem_FREE(memo);
+        PyMem_Free(memo);
         PyErr_NoMemory();
         return NULL;
     }
@@ -758,10 +759,10 @@
     new->mt_mask = self->mt_mask;
     /* The table we get from _New() is probably smaller than we wanted.
        Free it and allocate one that's the right size. */
-    PyMem_FREE(new->mt_table);
+    PyMem_Free(new->mt_table);
     new->mt_table = PyMem_NEW(PyMemoEntry, self->mt_allocated);
     if (new->mt_table == NULL) {
-        PyMem_FREE(new);
+        PyMem_Free(new);
         PyErr_NoMemory();
         return NULL;
     }
@@ -800,8 +801,8 @@
         return;
     PyMemoTable_Clear(self);
 
-    PyMem_FREE(self->mt_table);
-    PyMem_FREE(self);
+    PyMem_Free(self->mt_table);
+    PyMem_Free(self);
 }
 
 /* Since entries cannot be deleted from this hashtable, _PyMemoTable_Lookup()
@@ -880,7 +881,7 @@
     }
 
     /* Deallocate the old table. */
-    PyMem_FREE(oldtable);
+    PyMem_Free(oldtable);
     return 0;
 }
 
@@ -1582,7 +1583,7 @@
     while (--i >= 0) {
         Py_XDECREF(memo[i]);
     }
-    PyMem_FREE(memo);
+    PyMem_Free(memo);
 }
 
 static UnpicklerObject *
@@ -1715,7 +1716,7 @@
     if (!self->bin) {
         pdata[0] = GET;
         PyOS_snprintf(pdata + 1, sizeof(pdata) - 1,
-                      "%" PY_FORMAT_SIZE_T "d\n", *value);
+                      "%zd\n", *value);
         len = strlen(pdata);
     }
     else {
@@ -1772,7 +1773,7 @@
     else if (!self->bin) {
         pdata[0] = PUT;
         PyOS_snprintf(pdata + 1, sizeof(pdata) - 1,
-                      "%" PY_FORMAT_SIZE_T "d\n", idx);
+                      "%zd\n", idx);
         len = strlen(pdata);
     }
     else {
@@ -2004,26 +2005,21 @@
             self->fast_nesting = -1;
             return 0;
         }
-        if (PyDict_GetItemWithError(self->fast_memo, key)) {
-            Py_DECREF(key);
+        int r = PyDict_Contains(self->fast_memo, key);
+        if (r > 0) {
             PyErr_Format(PyExc_ValueError,
                          "fast mode: can't pickle cyclic objects "
                          "including object type %.200s at %p",
                          Py_TYPE(obj)->tp_name, obj);
-            self->fast_nesting = -1;
-            return 0;
         }
-        if (PyErr_Occurred()) {
-            Py_DECREF(key);
-            self->fast_nesting = -1;
-            return 0;
-        }
-        if (PyDict_SetItem(self->fast_memo, key, Py_None) < 0) {
-            Py_DECREF(key);
-            self->fast_nesting = -1;
-            return 0;
+        else if (r == 0) {
+            r = PyDict_SetItem(self->fast_memo, key, Py_None);
         }
         Py_DECREF(key);
+        if (r != 0) {
+            self->fast_nesting = -1;
+            return 0;
+        }
     }
     return 1;
 }
@@ -4531,7 +4527,7 @@
      * call when setting the reducer_override attribute of the Pickler instance
      * to a bound method of the same instance. This is important as the Pickler
      * instance holds a reference to each object it has pickled (through its
-     * memo): thus, these objects wont be garbage-collected as long as the
+     * memo): thus, these objects won't be garbage-collected as long as the
      * Pickler itself is not collected. */
     Py_CLEAR(self->reducer_override);
     return status;
@@ -5912,118 +5908,75 @@
     return 0;
 }
 
-static int
-load_newobj(UnpicklerObject *self)
+static void
+newobj_unpickling_error(const char * msg, int use_kwargs, PyObject *arg)
 {
-    PyObject *args = NULL;
-    PyObject *clsraw = NULL;
-    PyTypeObject *cls;          /* clsraw cast to its true type */
-    PyObject *obj;
     PickleState *st = _Pickle_GetGlobalState();
-
-    /* Stack is ... cls argtuple, and we want to call
-     * cls.__new__(cls, *argtuple).
-     */
-    PDATA_POP(self->stack, args);
-    if (args == NULL)
-        goto error;
-    if (!PyTuple_Check(args)) {
-        PyErr_SetString(st->UnpicklingError,
-                        "NEWOBJ expected an arg " "tuple.");
-        goto error;
-    }
-
-    PDATA_POP(self->stack, clsraw);
-    cls = (PyTypeObject *)clsraw;
-    if (cls == NULL)
-        goto error;
-    if (!PyType_Check(cls)) {
-        PyErr_SetString(st->UnpicklingError, "NEWOBJ class argument "
-                        "isn't a type object");
-        goto error;
-    }
-    if (cls->tp_new == NULL) {
-        PyErr_SetString(st->UnpicklingError, "NEWOBJ class argument "
-                        "has NULL tp_new");
-        goto error;
-    }
-
-    /* Call __new__. */
-    obj = cls->tp_new(cls, args, NULL);
-    if (obj == NULL)
-        goto error;
-
-    Py_DECREF(args);
-    Py_DECREF(clsraw);
-    PDATA_PUSH(self->stack, obj, -1);
-    return 0;
-
-  error:
-    Py_XDECREF(args);
-    Py_XDECREF(clsraw);
-    return -1;
+    PyErr_Format(st->UnpicklingError, msg,
+                 use_kwargs ? "NEWOBJ_EX" : "NEWOBJ",
+                 Py_TYPE(arg)->tp_name);
 }
 
 static int
-load_newobj_ex(UnpicklerObject *self)
+load_newobj(UnpicklerObject *self, int use_kwargs)
 {
-    PyObject *cls, *args, *kwargs;
+    PyObject *cls, *args, *kwargs = NULL;
     PyObject *obj;
-    PickleState *st = _Pickle_GetGlobalState();
 
-    PDATA_POP(self->stack, kwargs);
-    if (kwargs == NULL) {
-        return -1;
+    /* Stack is ... cls args [kwargs], and we want to call
+     * cls.__new__(cls, *args, **kwargs).
+     */
+    if (use_kwargs) {
+        PDATA_POP(self->stack, kwargs);
+        if (kwargs == NULL) {
+            return -1;
+        }
     }
     PDATA_POP(self->stack, args);
     if (args == NULL) {
-        Py_DECREF(kwargs);
+        Py_XDECREF(kwargs);
         return -1;
     }
     PDATA_POP(self->stack, cls);
     if (cls == NULL) {
-        Py_DECREF(kwargs);
+        Py_XDECREF(kwargs);
         Py_DECREF(args);
         return -1;
     }
 
     if (!PyType_Check(cls)) {
-        PyErr_Format(st->UnpicklingError,
-                     "NEWOBJ_EX class argument must be a type, not %.200s",
-                     Py_TYPE(cls)->tp_name);
+        newobj_unpickling_error("%s class argument must be a type, not %.200s",
+                                use_kwargs, cls);
         goto error;
     }
-
     if (((PyTypeObject *)cls)->tp_new == NULL) {
-        PyErr_SetString(st->UnpicklingError,
-                        "NEWOBJ_EX class argument doesn't have __new__");
+        newobj_unpickling_error("%s class argument '%.200s' doesn't have __new__",
+                                use_kwargs, cls);
         goto error;
     }
     if (!PyTuple_Check(args)) {
-        PyErr_Format(st->UnpicklingError,
-                     "NEWOBJ_EX args argument must be a tuple, not %.200s",
-                     Py_TYPE(args)->tp_name);
+        newobj_unpickling_error("%s args argument must be a tuple, not %.200s",
+                                use_kwargs, args);
         goto error;
     }
-    if (!PyDict_Check(kwargs)) {
-        PyErr_Format(st->UnpicklingError,
-                     "NEWOBJ_EX kwargs argument must be a dict, not %.200s",
-                     Py_TYPE(kwargs)->tp_name);
+    if (use_kwargs && !PyDict_Check(kwargs)) {
+        newobj_unpickling_error("%s kwargs argument must be a dict, not %.200s",
+                                use_kwargs, kwargs);
         goto error;
     }
 
     obj = ((PyTypeObject *)cls)->tp_new((PyTypeObject *)cls, args, kwargs);
-    Py_DECREF(kwargs);
+    if (obj == NULL) {
+        goto error;
+    }
+    Py_XDECREF(kwargs);
     Py_DECREF(args);
     Py_DECREF(cls);
-    if (obj == NULL) {
-        return -1;
-    }
     PDATA_PUSH(self->stack, obj, -1);
     return 0;
 
 error:
-    Py_DECREF(kwargs);
+    Py_XDECREF(kwargs);
     Py_DECREF(args);
     Py_DECREF(cls);
     return -1;
@@ -6587,7 +6540,7 @@
         return 0;
     if ((len - x) % 2 != 0) {
         PickleState *st = _Pickle_GetGlobalState();
-        /* Currupt or hostile pickle -- we never write one like this. */
+        /* Corrupt or hostile pickle -- we never write one like this. */
         PyErr_SetString(st->UnpicklingError,
                         "odd number of items for SETITEMS");
         return -1;
@@ -6956,8 +6909,8 @@
         OP(FROZENSET, load_frozenset)
         OP(OBJ, load_obj)
         OP(INST, load_inst)
-        OP(NEWOBJ, load_newobj)
-        OP(NEWOBJ_EX, load_newobj_ex)
+        OP_ARG(NEWOBJ, load_newobj, 0)
+        OP_ARG(NEWOBJ_EX, load_newobj, 1)
         OP(GLOBAL, load_global)
         OP(STACK_GLOBAL, load_stack_global)
         OP(APPEND, load_append)
@@ -7592,7 +7545,7 @@
         for (size_t i = new_memo_size - 1; i != SIZE_MAX; i--) {
             Py_XDECREF(new_memo[i]);
         }
-        PyMem_FREE(new_memo);
+        PyMem_Free(new_memo);
     }
     return -1;
 }
diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c
index 5356417..a58159a 100644
--- a/Modules/_posixsubprocess.c
+++ b/Modules/_posixsubprocess.c
@@ -1,5 +1,6 @@
 /* Authors: Gregory P. Smith & Jeffrey Yasskin */
 #include "Python.h"
+#include "pycore_fileutils.h"
 #if defined(HAVE_PIPE2) && !defined(_GNU_SOURCE)
 # define _GNU_SOURCE
 #endif
@@ -35,6 +36,14 @@
 # define SYS_getdents64  __NR_getdents64
 #endif
 
+#if defined(__linux__) && defined(HAVE_VFORK) && defined(HAVE_SIGNAL_H) && \
+    defined(HAVE_PTHREAD_SIGMASK) && !defined(HAVE_BROKEN_PTHREAD_SIGMASK)
+/* If this is ever expanded to non-Linux platforms, verify what calls are
+ * allowed after vfork(). Ex: setsid() may be disallowed on macOS? */
+# include <signal.h>
+# define VFORK_USABLE 1
+#endif
+
 #if defined(__sun) && defined(__SVR4)
 /* readdir64 is used to work around Solaris 9 bug 6395699. */
 # define readdir readdir64
@@ -46,7 +55,7 @@
 # endif
 #endif
 
-#if defined(__FreeBSD__) || (defined(__APPLE__) && defined(__MACH__))
+#if defined(__FreeBSD__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__DragonFly__)
 # define FD_DIR "/dev/fd"
 #else
 # define FD_DIR "/proc/self/fd"
@@ -60,47 +69,8 @@
 
 #define POSIX_CALL(call)   do { if ((call) == -1) goto error; } while (0)
 
-typedef struct {
-    PyObject* disable;
-    PyObject* enable;
-    PyObject* isenabled;
-} _posixsubprocessstate;
-
 static struct PyModuleDef _posixsubprocessmodule;
 
-static inline _posixsubprocessstate*
-get_posixsubprocess_state(PyObject *module)
-{
-    void *state = PyModule_GetState(module);
-    assert(state != NULL);
-    return (_posixsubprocessstate *)state;
-}
-
-#define _posixsubprocessstate_global get_posixsubprocess_state(PyState_FindModule(&_posixsubprocessmodule))
-
-/* If gc was disabled, call gc.enable().  Return 0 on success. */
-static int
-_enable_gc(int need_to_reenable_gc, PyObject *gc_module)
-{
-    PyObject *result;
-    PyObject *exctype, *val, *tb;
-
-    if (need_to_reenable_gc) {
-        PyErr_Fetch(&exctype, &val, &tb);
-        result = PyObject_CallMethodNoArgs(
-            gc_module, _posixsubprocessstate_global->enable);
-        if (exctype != NULL) {
-            PyErr_Restore(exctype, val, tb);
-        }
-        if (result == NULL) {
-            return 1;
-        }
-        Py_DECREF(result);
-    }
-    return 0;
-}
-
-
 /* Convert ASCII to a positive int, no libc call. no overflow. -1 on error. */
 static int
 _pos_int_from_ascii(const char *name)
@@ -116,9 +86,9 @@
 }
 
 
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__DragonFly__)
 /* When /dev/fd isn't mounted it is often a static directory populated
- * with 0 1 2 or entries for 0 .. 63 on FreeBSD, NetBSD and OpenBSD.
+ * with 0 1 2 or entries for 0 .. 63 on FreeBSD, NetBSD, OpenBSD and DragonFlyBSD.
  * NetBSD and OpenBSD have a /proc fs available (though not necessarily
  * mounted) and do not have fdescfs for /dev/fd.  MacOS X has a devfs
  * that properly supports /dev/fd.
@@ -250,7 +220,6 @@
     long end_fd = safe_get_max_fd();
     Py_ssize_t num_fds_to_keep = PyTuple_GET_SIZE(py_fds_to_keep);
     Py_ssize_t keep_seq_idx;
-    int fd_num;
     /* As py_fds_to_keep is sorted we can loop through the list closing
      * fds in between any in the keep list falling within our range. */
     for (keep_seq_idx = 0; keep_seq_idx < num_fds_to_keep; ++keep_seq_idx) {
@@ -258,21 +227,11 @@
         int keep_fd = PyLong_AsLong(py_keep_fd);
         if (keep_fd < start_fd)
             continue;
-        for (fd_num = start_fd; fd_num < keep_fd; ++fd_num) {
-            close(fd_num);
-        }
+        _Py_closerange(start_fd, keep_fd - 1);
         start_fd = keep_fd + 1;
     }
     if (start_fd <= end_fd) {
-#if defined(__FreeBSD__)
-        /* Any errors encountered while closing file descriptors are ignored */
-        closefrom(start_fd);
-#else
-        for (fd_num = start_fd; fd_num < end_fd; ++fd_num) {
-            /* Ignore errors */
-            (void)close(fd_num);
-        }
-#endif
+        _Py_closerange(start_fd, end_fd);
     }
 }
 
@@ -377,7 +336,7 @@
     ++start_fd;
 #endif
 
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__DragonFly__)
     if (!_is_fdescfs_mounted_on_dev_fd())
         proc_fd_dir = NULL;
     else
@@ -417,9 +376,53 @@
 #endif  /* else NOT (defined(__linux__) && defined(HAVE_SYS_SYSCALL_H)) */
 
 
+#ifdef VFORK_USABLE
+/* Reset dispositions for all signals to SIG_DFL except for ignored
+ * signals. This way we ensure that no signal handlers can run
+ * after we unblock signals in a child created by vfork().
+ */
+static void
+reset_signal_handlers(const sigset_t *child_sigmask)
+{
+    struct sigaction sa_dfl = {.sa_handler = SIG_DFL};
+    for (int sig = 1; sig < _NSIG; sig++) {
+        /* Dispositions for SIGKILL and SIGSTOP can't be changed. */
+        if (sig == SIGKILL || sig == SIGSTOP) {
+            continue;
+        }
+
+        /* There is no need to reset the disposition of signals that will
+         * remain blocked across execve() since the kernel will do it. */
+        if (sigismember(child_sigmask, sig) == 1) {
+            continue;
+        }
+
+        struct sigaction sa;
+        /* C libraries usually return EINVAL for signals used
+         * internally (e.g. for thread cancellation), so simply
+         * skip errors here. */
+        if (sigaction(sig, NULL, &sa) == -1) {
+            continue;
+        }
+
+        /* void *h works as these fields are both pointer types already. */
+        void *h = (sa.sa_flags & SA_SIGINFO ? (void *)sa.sa_sigaction :
+                                              (void *)sa.sa_handler);
+        if (h == SIG_IGN || h == SIG_DFL) {
+            continue;
+        }
+
+        /* This call can't reasonably fail, but if it does, terminating
+         * the child seems to be too harsh, so ignore errors. */
+        (void) sigaction(sig, &sa_dfl, NULL);
+    }
+}
+#endif /* VFORK_USABLE */
+
+
 /*
- * This function is code executed in the child process immediately after fork
- * to set things up and call exec().
+ * This function is code executed in the child process immediately after
+ * (v)fork to set things up and call exec().
  *
  * All of the code in this function must only use async-signal-safe functions,
  * listed at `man 7 signal` or
@@ -427,8 +430,28 @@
  *
  * This restriction is documented at
  * http://www.opengroup.org/onlinepubs/009695399/functions/fork.html.
+ *
+ * If this function is called after vfork(), even more care must be taken.
+ * The lack of preparations that C libraries normally take on fork(),
+ * as well as sharing the address space with the parent, might make even
+ * async-signal-safe functions vfork-unsafe. In particular, on Linux,
+ * set*id() and setgroups() library functions must not be called, since
+ * they have to interact with the library-level thread list and send
+ * library-internal signals to implement per-process credentials semantics
+ * required by POSIX but not supported natively on Linux. Another reason to
+ * avoid this family of functions is that sharing an address space between
+ * processes running with different privileges is inherently insecure.
+ * See bpo-35823 for further discussion and references.
+ *
+ * In some C libraries, setrlimit() has the same thread list/signalling
+ * behavior since resource limits were per-thread attributes before
+ * Linux 2.6.10. Musl, as of 1.2.1, is known to have this issue
+ * (https://www.openwall.com/lists/musl/2020/10/15/6).
+ *
+ * If vfork-unsafe functionality is desired after vfork(), consider using
+ * syscall() to obtain it.
  */
-static void
+_Py_NO_INLINE static void
 child_exec(char *const exec_array[],
            char *const argv[],
            char *const envp[],
@@ -442,6 +465,7 @@
            int call_setgid, gid_t gid,
            int call_setgroups, size_t groups_size, const gid_t *groups,
            int call_setuid, uid_t uid, int child_umask,
+           const void *child_sigmask,
            PyObject *py_fds_to_keep,
            PyObject *preexec_fn,
            PyObject *preexec_fn_args_tuple)
@@ -517,6 +541,15 @@
     if (restore_signals)
         _Py_RestoreSignals();
 
+#ifdef VFORK_USABLE
+    if (child_sigmask) {
+        reset_signal_handlers(child_sigmask);
+        if ((errno = pthread_sigmask(SIG_SETMASK, child_sigmask, NULL))) {
+            goto error;
+        }
+    }
+#endif
+
 #ifdef HAVE_SETSID
     if (call_setsid)
         POSIX_CALL(setsid());
@@ -609,8 +642,82 @@
 }
 
 
+/* The main purpose of this wrapper function is to isolate vfork() from both
+ * subprocess_fork_exec() and child_exec(). A child process created via
+ * vfork() executes on the same stack as the parent process while the latter is
+ * suspended, so this function should not be inlined to avoid compiler bugs
+ * that might clobber data needed by the parent later. Additionally,
+ * child_exec() should not be inlined to avoid spurious -Wclobber warnings from
+ * GCC (see bpo-35823).
+ */
+_Py_NO_INLINE static pid_t
+do_fork_exec(char *const exec_array[],
+             char *const argv[],
+             char *const envp[],
+             const char *cwd,
+             int p2cread, int p2cwrite,
+             int c2pread, int c2pwrite,
+             int errread, int errwrite,
+             int errpipe_read, int errpipe_write,
+             int close_fds, int restore_signals,
+             int call_setsid,
+             int call_setgid, gid_t gid,
+             int call_setgroups, size_t groups_size, const gid_t *groups,
+             int call_setuid, uid_t uid, int child_umask,
+             const void *child_sigmask,
+             PyObject *py_fds_to_keep,
+             PyObject *preexec_fn,
+             PyObject *preexec_fn_args_tuple)
+{
+
+    pid_t pid;
+
+#ifdef VFORK_USABLE
+    if (child_sigmask) {
+        /* These are checked by our caller; verify them in debug builds. */
+        assert(!call_setuid);
+        assert(!call_setgid);
+        assert(!call_setgroups);
+        assert(preexec_fn == Py_None);
+
+        pid = vfork();
+    } else
+#endif
+    {
+        pid = fork();
+    }
+
+    if (pid != 0) {
+        return pid;
+    }
+
+    /* Child process.
+     * See the comment above child_exec() for restrictions imposed on
+     * the code below.
+     */
+
+    if (preexec_fn != Py_None) {
+        /* We'll be calling back into Python later so we need to do this.
+         * This call may not be async-signal-safe but neither is calling
+         * back into Python.  The user asked us to use hope as a strategy
+         * to avoid deadlock... */
+        PyOS_AfterFork_Child();
+    }
+
+    child_exec(exec_array, argv, envp, cwd,
+               p2cread, p2cwrite, c2pread, c2pwrite,
+               errread, errwrite, errpipe_read, errpipe_write,
+               close_fds, restore_signals, call_setsid,
+               call_setgid, gid, call_setgroups, groups_size, groups,
+               call_setuid, uid, child_umask, child_sigmask,
+               py_fds_to_keep, preexec_fn, preexec_fn_args_tuple);
+    _exit(255);
+    return 0;  /* Dead code to avoid a potential compiler warning. */
+}
+
+
 static PyObject *
-subprocess_fork_exec(PyObject* self, PyObject *args)
+subprocess_fork_exec(PyObject *module, PyObject *args)
 {
     PyObject *gc_module = NULL;
     PyObject *executable_list, *py_fds_to_keep;
@@ -628,7 +735,7 @@
     int child_umask;
     PyObject *cwd_obj, *cwd_obj2 = NULL;
     const char *cwd;
-    pid_t pid;
+    pid_t pid = -1;
     int need_to_reenable_gc = 0;
     char *const *exec_array, *const *argv = NULL, *const *envp = NULL;
     Py_ssize_t arg_num, num_groups = 0;
@@ -673,30 +780,7 @@
 
     /* We need to call gc.disable() when we'll be calling preexec_fn */
     if (preexec_fn != Py_None) {
-        PyObject *result;
-
-        gc_module = PyImport_ImportModule("gc");
-        if (gc_module == NULL)
-            return NULL;
-        result = PyObject_CallMethodNoArgs(
-            gc_module, _posixsubprocessstate_global->isenabled);
-        if (result == NULL) {
-            Py_DECREF(gc_module);
-            return NULL;
-        }
-        need_to_reenable_gc = PyObject_IsTrue(result);
-        Py_DECREF(result);
-        if (need_to_reenable_gc == -1) {
-            Py_DECREF(gc_module);
-            return NULL;
-        }
-        result = PyObject_CallMethodNoArgs(
-            gc_module, _posixsubprocessstate_global->disable);
-        if (result == NULL) {
-            Py_DECREF(gc_module);
-            return NULL;
-        }
-        Py_DECREF(result);
+        need_to_reenable_gc = PyGC_Disable();
     }
 
     exec_array = _PySequence_BytesToCharpArray(executable_list);
@@ -753,7 +837,7 @@
     if (groups_list != Py_None) {
 #ifdef HAVE_SETGROUPS
         Py_ssize_t i;
-        unsigned long gid;
+        gid_t gid;
 
         if (!PyList_Check(groups_list)) {
             PyErr_SetString(PyExc_TypeError,
@@ -787,10 +871,6 @@
                 Py_DECREF(elem);
                 goto cleanup;
             } else {
-                /* In posixmodule.c UnsignedLong is used as a fallback value
-                * if the value provided does not fit in a Long. Since we are
-                * already doing the bounds checking on the Python side, we
-                * can go directly to an UnsignedLong here. */
                 if (!_Py_Gid_Converter(elem, &gid)) {
                     Py_DECREF(elem);
                     PyErr_SetString(PyExc_ValueError, "invalid group id");
@@ -845,83 +925,92 @@
         need_after_fork = 1;
     }
 
-    pid = fork();
-    if (pid == 0) {
-        /* Child process */
-        /*
-         * Code from here to _exit() must only use async-signal-safe functions,
-         * listed at `man 7 signal` or
-         * http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html.
+    /* NOTE: When old_sigmask is non-NULL, do_fork_exec() may use vfork(). */
+    const void *old_sigmask = NULL;
+#ifdef VFORK_USABLE
+    /* Use vfork() only if it's safe. See the comment above child_exec(). */
+    sigset_t old_sigs;
+    if (preexec_fn == Py_None &&
+        !call_setuid && !call_setgid && !call_setgroups) {
+        /* Block all signals to ensure that no signal handlers are run in the
+         * child process while it shares memory with us. Note that signals
+         * used internally by C libraries won't be blocked by
+         * pthread_sigmask(), but signal handlers installed by C libraries
+         * normally service only signals originating from *within the process*,
+         * so it should be sufficient to consider any library function that
+         * might send such a signal to be vfork-unsafe and do not call it in
+         * the child.
          */
-
-        if (preexec_fn != Py_None) {
-            /* We'll be calling back into Python later so we need to do this.
-             * This call may not be async-signal-safe but neither is calling
-             * back into Python.  The user asked us to use hope as a strategy
-             * to avoid deadlock... */
-            PyOS_AfterFork_Child();
+        sigset_t all_sigs;
+        sigfillset(&all_sigs);
+        if ((saved_errno = pthread_sigmask(SIG_BLOCK, &all_sigs, &old_sigs))) {
+            goto cleanup;
         }
-
-        child_exec(exec_array, argv, envp, cwd,
-                   p2cread, p2cwrite, c2pread, c2pwrite,
-                   errread, errwrite, errpipe_read, errpipe_write,
-                   close_fds, restore_signals, call_setsid,
-                   call_setgid, gid, call_setgroups, num_groups, groups,
-                   call_setuid, uid, child_umask,
-                   py_fds_to_keep, preexec_fn, preexec_fn_args_tuple);
-        _exit(255);
-        return NULL;  /* Dead code to avoid a potential compiler warning. */
+        old_sigmask = &old_sigs;
     }
+#endif
+
+    pid = do_fork_exec(exec_array, argv, envp, cwd,
+                       p2cread, p2cwrite, c2pread, c2pwrite,
+                       errread, errwrite, errpipe_read, errpipe_write,
+                       close_fds, restore_signals, call_setsid,
+                       call_setgid, gid, call_setgroups, num_groups, groups,
+                       call_setuid, uid, child_umask, old_sigmask,
+                       py_fds_to_keep, preexec_fn, preexec_fn_args_tuple);
+
     /* Parent (original) process */
     if (pid == -1) {
         /* Capture errno for the exception. */
         saved_errno = errno;
     }
 
-    Py_XDECREF(cwd_obj2);
+#ifdef VFORK_USABLE
+    if (old_sigmask) {
+        /* vfork() semantics guarantees that the parent is blocked
+         * until the child performs _exit() or execve(), so it is safe
+         * to unblock signals once we're here.
+         * Note that in environments where vfork() is implemented as fork(),
+         * such as QEMU user-mode emulation, the parent won't be blocked,
+         * but it won't share the address space with the child,
+         * so it's still safe to unblock the signals.
+         *
+         * We don't handle errors here because this call can't fail
+         * if valid arguments are given, and because there is no good
+         * way for the caller to deal with a failure to restore
+         * the thread signal mask. */
+        (void) pthread_sigmask(SIG_SETMASK, old_sigmask, NULL);
+    }
+#endif
 
     if (need_after_fork)
         PyOS_AfterFork_Parent();
-    if (envp)
-        _Py_FreeCharPArray(envp);
-    if (argv)
-        _Py_FreeCharPArray(argv);
-    _Py_FreeCharPArray(exec_array);
 
-    /* Reenable gc in the parent process (or if fork failed). */
-    if (_enable_gc(need_to_reenable_gc, gc_module)) {
-        pid = -1;
-    }
-    PyMem_RawFree(groups);
-    Py_XDECREF(preexec_fn_args_tuple);
-    Py_XDECREF(gc_module);
-
-    if (pid == -1) {
+cleanup:
+    if (saved_errno != 0) {
         errno = saved_errno;
         /* We can't call this above as PyOS_AfterFork_Parent() calls back
          * into Python code which would see the unreturned error. */
         PyErr_SetFromErrno(PyExc_OSError);
-        return NULL;  /* fork() failed. */
     }
 
-    return PyLong_FromPid(pid);
-
-cleanup:
+    Py_XDECREF(preexec_fn_args_tuple);
+    PyMem_RawFree(groups);
     Py_XDECREF(cwd_obj2);
     if (envp)
         _Py_FreeCharPArray(envp);
+    Py_XDECREF(converted_args);
+    Py_XDECREF(fast_args);
     if (argv)
         _Py_FreeCharPArray(argv);
     if (exec_array)
         _Py_FreeCharPArray(exec_array);
 
-    PyMem_RawFree(groups);
-    Py_XDECREF(converted_args);
-    Py_XDECREF(fast_args);
-    Py_XDECREF(preexec_fn_args_tuple);
-    _enable_gc(need_to_reenable_gc, gc_module);
+    if (need_to_reenable_gc) {
+        PyGC_Enable();
+    }
     Py_XDECREF(gc_module);
-    return NULL;
+
+    return pid == -1 ? NULL : PyLong_FromPid(pid);
 }
 
 
@@ -958,63 +1047,26 @@
 PyDoc_STRVAR(module_doc,
 "A POSIX helper for the subprocess module.");
 
-
 static PyMethodDef module_methods[] = {
     {"fork_exec", subprocess_fork_exec, METH_VARARGS, subprocess_fork_exec_doc},
     {NULL, NULL}  /* sentinel */
 };
 
-
-static int _posixsubprocess_traverse(PyObject *m, visitproc visit, void *arg) {
-    Py_VISIT(get_posixsubprocess_state(m)->disable);
-    Py_VISIT(get_posixsubprocess_state(m)->enable);
-    Py_VISIT(get_posixsubprocess_state(m)->isenabled);
-    return 0;
-}
-
-static int _posixsubprocess_clear(PyObject *m) {
-    Py_CLEAR(get_posixsubprocess_state(m)->disable);
-    Py_CLEAR(get_posixsubprocess_state(m)->enable);
-    Py_CLEAR(get_posixsubprocess_state(m)->isenabled);
-    return 0;
-}
-
-static void _posixsubprocess_free(void *m) {
-    _posixsubprocess_clear((PyObject *)m);
-}
+static PyModuleDef_Slot _posixsubprocess_slots[] = {
+    {0, NULL}
+};
 
 static struct PyModuleDef _posixsubprocessmodule = {
         PyModuleDef_HEAD_INIT,
-        "_posixsubprocess",
-        module_doc,
-        sizeof(_posixsubprocessstate),
-        module_methods,
-        NULL,
-        _posixsubprocess_traverse,
-        _posixsubprocess_clear,
-        _posixsubprocess_free,
+        .m_name = "_posixsubprocess",
+        .m_doc = module_doc,
+        .m_size = 0,
+        .m_methods = module_methods,
+        .m_slots = _posixsubprocess_slots,
 };
 
 PyMODINIT_FUNC
 PyInit__posixsubprocess(void)
 {
-    PyObject* m;
-
-    m = PyState_FindModule(&_posixsubprocessmodule);
-    if (m != NULL) {
-      Py_INCREF(m);
-      return m;
-    }
-
-    m = PyModule_Create(&_posixsubprocessmodule);
-    if (m == NULL) {
-      return NULL;
-    }
-
-    get_posixsubprocess_state(m)->disable = PyUnicode_InternFromString("disable");
-    get_posixsubprocess_state(m)->enable = PyUnicode_InternFromString("enable");
-    get_posixsubprocess_state(m)->isenabled = PyUnicode_InternFromString("isenabled");
-
-    PyState_AddModule(m, &_posixsubprocessmodule);
-    return m;
+    return PyModuleDef_Init(&_posixsubprocessmodule);
 }
diff --git a/Modules/_queuemodule.c b/Modules/_queuemodule.c
index b155ea9..a124255 100644
--- a/Modules/_queuemodule.c
+++ b/Modules/_queuemodule.c
@@ -1,16 +1,23 @@
 #include "Python.h"
+#include "pycore_moduleobject.h"  // _PyModule_GetState()
+#include "structmember.h"         // PyMemberDef
 #include <stddef.h>               // offsetof()
 
-/*[clinic input]
-module _queue
-class _queue.SimpleQueue "simplequeueobject *" "&PySimpleQueueType"
-[clinic start generated code]*/
-/*[clinic end generated code: output=da39a3ee5e6b4b0d input=cf49af81bcbbbea6]*/
+typedef struct {
+    PyTypeObject *SimpleQueueType;
+    PyObject *EmptyError;
+} simplequeue_state;
 
-static PyTypeObject PySimpleQueueType;  /* forward decl */
-
-static PyObject *EmptyError;
-
+static simplequeue_state *
+simplequeue_get_state(PyObject *module)
+{
+    simplequeue_state *state = _PyModule_GetState(module);
+    assert(state);
+    return state;
+}
+static struct PyModuleDef queuemodule;
+#define simplequeue_get_state_by_type(type) \
+    (simplequeue_get_state(_PyType_GetModuleByDef(type, &queuemodule)))
 
 typedef struct {
     PyObject_HEAD
@@ -21,10 +28,24 @@
     PyObject *weakreflist;
 } simplequeueobject;
 
+/*[clinic input]
+module _queue
+class _queue.SimpleQueue "simplequeueobject *" "simplequeue_get_state_by_type(type)->SimpleQueueType"
+[clinic start generated code]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=0a4023fe4d198c8d]*/
+
+static int
+simplequeue_clear(simplequeueobject *self)
+{
+    Py_CLEAR(self->lst);
+    return 0;
+}
 
 static void
 simplequeue_dealloc(simplequeueobject *self)
 {
+    PyTypeObject *tp = Py_TYPE(self);
+
     PyObject_GC_UnTrack(self);
     if (self->lock != NULL) {
         /* Unlock the lock so it's safe to free it */
@@ -32,16 +53,18 @@
             PyThread_release_lock(self->lock);
         PyThread_free_lock(self->lock);
     }
-    Py_XDECREF(self->lst);
+    (void)simplequeue_clear(self);
     if (self->weakreflist != NULL)
         PyObject_ClearWeakRefs((PyObject *) self);
     Py_TYPE(self)->tp_free(self);
+    Py_DECREF(tp);
 }
 
 static int
 simplequeue_traverse(simplequeueobject *self, visitproc visit, void *arg)
 {
     Py_VISIT(self->lst);
+    Py_VISIT(Py_TYPE(self));
     return 0;
 }
 
@@ -155,6 +178,9 @@
 
 /*[clinic input]
 _queue.SimpleQueue.get
+
+    cls: defining_class
+    /
     block: bool = True
     timeout: object = None
 
@@ -171,9 +197,9 @@
 [clinic start generated code]*/
 
 static PyObject *
-_queue_SimpleQueue_get_impl(simplequeueobject *self, int block,
-                            PyObject *timeout)
-/*[clinic end generated code: output=ec82a7157dcccd1a input=4bf691f9f01fa297]*/
+_queue_SimpleQueue_get_impl(simplequeueobject *self, PyTypeObject *cls,
+                            int block, PyObject *timeout)
+/*[clinic end generated code: output=1969aefa7db63666 input=5fc4d56b9a54757e]*/
 {
     _PyTime_t endtime = 0;
     _PyTime_t timeout_val;
@@ -225,8 +251,10 @@
             return NULL;
         }
         if (r == PY_LOCK_FAILURE) {
+            PyObject *module = PyType_GetModule(cls);
+            simplequeue_state *state = simplequeue_get_state(module);
             /* Timed out */
-            PyErr_SetNone(EmptyError);
+            PyErr_SetNone(state->EmptyError);
             return NULL;
         }
         self->locked = 1;
@@ -251,6 +279,9 @@
 /*[clinic input]
 _queue.SimpleQueue.get_nowait
 
+    cls: defining_class
+    /
+
 Remove and return an item from the queue without blocking.
 
 Only get an item if one is immediately available. Otherwise
@@ -258,10 +289,11 @@
 [clinic start generated code]*/
 
 static PyObject *
-_queue_SimpleQueue_get_nowait_impl(simplequeueobject *self)
-/*[clinic end generated code: output=a89731a75dbe4937 input=6fe5102db540a1b9]*/
+_queue_SimpleQueue_get_nowait_impl(simplequeueobject *self,
+                                   PyTypeObject *cls)
+/*[clinic end generated code: output=620c58e2750f8b8a input=842f732bf04216d3]*/
 {
-    return _queue_SimpleQueue_get_impl(self, 0, Py_None);
+    return _queue_SimpleQueue_get_impl(self, cls, 0, Py_None);
 }
 
 /*[clinic input]
@@ -290,6 +322,29 @@
     return PyList_GET_SIZE(self->lst) - self->lst_pos;
 }
 
+static int
+queue_traverse(PyObject *m, visitproc visit, void *arg)
+{
+    simplequeue_state *state = simplequeue_get_state(m);
+    Py_VISIT(state->SimpleQueueType);
+    Py_VISIT(state->EmptyError);
+    return 0;
+}
+
+static int
+queue_clear(PyObject *m)
+{
+    simplequeue_state *state = simplequeue_get_state(m);
+    Py_CLEAR(state->SimpleQueueType);
+    Py_CLEAR(state->EmptyError);
+    return 0;
+}
+
+static void
+queue_free(void *m)
+{
+    queue_clear((PyObject *)m);
+}
 
 #include "clinic/_queuemodule.c.h"
 
@@ -306,48 +361,28 @@
     {NULL,           NULL}              /* sentinel */
 };
 
+static struct PyMemberDef simplequeue_members[] = {
+    {"__weaklistoffset__", T_PYSSIZET, offsetof(simplequeueobject, weakreflist), READONLY},
+    {NULL},
+};
 
-static PyTypeObject PySimpleQueueType = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "_queue.SimpleQueue",               /*tp_name*/
-    sizeof(simplequeueobject),          /*tp_basicsize*/
-    0,                                  /*tp_itemsize*/
-    /* methods */
-    (destructor)simplequeue_dealloc,    /*tp_dealloc*/
-    0,                                  /*tp_vectorcall_offset*/
-    0,                                  /*tp_getattr*/
-    0,                                  /*tp_setattr*/
-    0,                                  /*tp_as_async*/
-    0,                                  /*tp_repr*/
-    0,                                  /*tp_as_number*/
-    0,                                  /*tp_as_sequence*/
-    0,                                  /*tp_as_mapping*/
-    0,                                  /*tp_hash*/
-    0,                                  /*tp_call*/
-    0,                                  /*tp_str*/
-    0,                                  /*tp_getattro*/
-    0,                                  /*tp_setattro*/
-    0,                                  /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE
-        | Py_TPFLAGS_HAVE_GC,           /* tp_flags */
-    simplequeue_new__doc__,             /*tp_doc*/
-    (traverseproc)simplequeue_traverse, /*tp_traverse*/
-    0,                                  /*tp_clear*/
-    0,                                  /*tp_richcompare*/
-    offsetof(simplequeueobject, weakreflist), /*tp_weaklistoffset*/
-    0,                                  /*tp_iter*/
-    0,                                  /*tp_iternext*/
-    simplequeue_methods,                /*tp_methods*/
-    0,                                  /* tp_members */
-    0,                                  /* tp_getset */
-    0,                                  /* tp_base */
-    0,                                  /* tp_dict */
-    0,                                  /* tp_descr_get */
-    0,                                  /* tp_descr_set */
-    0,                                  /* tp_dictoffset */
-    0,                                  /* tp_init */
-    0,                                  /* tp_alloc */
-    simplequeue_new                     /* tp_new */
+static PyType_Slot simplequeue_slots[] = {
+    {Py_tp_dealloc, simplequeue_dealloc},
+    {Py_tp_doc, (void *)simplequeue_new__doc__},
+    {Py_tp_traverse, simplequeue_traverse},
+    {Py_tp_clear, simplequeue_clear},
+    {Py_tp_members, simplequeue_members},
+    {Py_tp_methods, simplequeue_methods},
+    {Py_tp_new, simplequeue_new},
+    {0, NULL},
+};
+
+static PyType_Spec simplequeue_spec = {
+    .name = "_queue.SimpleQueue",
+    .basicsize = sizeof(simplequeueobject),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC |
+              Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = simplequeue_slots,
 };
 
 
@@ -357,43 +392,54 @@
 "C implementation of the Python queue module.\n\
 This module is an implementation detail, please do not use it directly.");
 
+static int
+queuemodule_exec(PyObject *module)
+{
+    simplequeue_state *state = simplequeue_get_state(module);
+
+    state->EmptyError = PyErr_NewExceptionWithDoc(
+        "_queue.Empty",
+        "Exception raised by Queue.get(block=0)/get_nowait().",
+        NULL, NULL);
+    if (state->EmptyError == NULL) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(module, "Empty", state->EmptyError) < 0) {
+        return -1;
+    }
+
+    state->SimpleQueueType = (PyTypeObject *)PyType_FromModuleAndSpec(
+        module, &simplequeue_spec, NULL);
+    if (state->SimpleQueueType == NULL) {
+        return -1;
+    }
+    if (PyModule_AddType(module, state->SimpleQueueType) < 0) {
+        return -1;
+    }
+
+    return 0;
+}
+
+static PyModuleDef_Slot queuemodule_slots[] = {
+    {Py_mod_exec, queuemodule_exec},
+    {0, NULL}
+};
+
+
 static struct PyModuleDef queuemodule = {
-    PyModuleDef_HEAD_INIT,
-    "_queue",
-    queue_module_doc,
-    -1,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    .m_base = PyModuleDef_HEAD_INIT,
+    .m_name = "_queue",
+    .m_doc = queue_module_doc,
+    .m_size = sizeof(simplequeue_state),
+    .m_slots = queuemodule_slots,
+    .m_traverse = queue_traverse,
+    .m_clear = queue_clear,
+    .m_free = queue_free,
 };
 
 
 PyMODINIT_FUNC
 PyInit__queue(void)
 {
-    PyObject *m;
-
-    /* Create the module */
-    m = PyModule_Create(&queuemodule);
-    if (m == NULL)
-        return NULL;
-
-    EmptyError = PyErr_NewExceptionWithDoc(
-        "_queue.Empty",
-        "Exception raised by Queue.get(block=0)/get_nowait().",
-        NULL, NULL);
-    if (EmptyError == NULL)
-        return NULL;
-
-    Py_INCREF(EmptyError);
-    if (PyModule_AddObject(m, "Empty", EmptyError) < 0)
-        return NULL;
-
-    if (PyModule_AddType(m, &PySimpleQueueType) < 0) {
-        return NULL;
-    }
-
-    return m;
+   return PyModuleDef_Init(&queuemodule);
 }
diff --git a/Modules/_randommodule.c b/Modules/_randommodule.c
index a402b93..0137e34 100644
--- a/Modules/_randommodule.c
+++ b/Modules/_randommodule.c
@@ -67,7 +67,7 @@
 /* ---------------------------------------------------------------*/
 
 #include "Python.h"
-#include "pycore_byteswap.h"      // _Py_bswap32()
+#include "pycore_moduleobject.h"  // _PyModule_GetState()
 #ifdef HAVE_PROCESS_H
 #  include <process.h>            // getpid()
 #endif
@@ -87,14 +87,15 @@
 static inline _randomstate*
 get_random_state(PyObject *module)
 {
-    void *state = PyModule_GetState(module);
+    void *state = _PyModule_GetState(module);
     assert(state != NULL);
     return (_randomstate *)state;
 }
 
 static struct PyModuleDef _randommodule;
 
-#define _randomstate_global get_random_state(PyState_FindModule(&_randommodule))
+#define _randomstate_type(type) \
+    (get_random_state(_PyType_GetModuleByDef(type, &_randommodule)))
 
 typedef struct {
     PyObject_HEAD
@@ -107,9 +108,9 @@
 
 /*[clinic input]
 module _random
-class _random.Random "RandomObject *" "&Random_Type"
+class _random.Random "RandomObject *" "_randomstate_type(type)->Random_Type"
 [clinic start generated code]*/
-/*[clinic end generated code: output=da39a3ee5e6b4b0d input=f79898ae7847c321]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=70a2c99619474983]*/
 
 /* Random methods */
 
@@ -291,7 +292,8 @@
     } else if (PyLong_Check(arg)) {
         /* Calling int.__abs__() prevents calling arg.__abs__(), which might
            return an invalid value. See issue #31478. */
-        n = PyObject_CallOneArg(_randomstate_global->Long___abs__, arg);
+        _randomstate *state = _randomstate_type(Py_TYPE(self));
+        n = PyObject_CallOneArg(state->Long___abs__, arg);
     }
     else {
         Py_hash_t hash = PyObject_Hash(arg);
@@ -518,8 +520,10 @@
 {
     RandomObject *self;
     PyObject *tmp;
+    PyObject *arg = NULL;
+    _randomstate *state = _randomstate_type(type);
 
-    if (type == (PyTypeObject*)_randomstate_global->Random_Type &&
+    if (type == (PyTypeObject*)state->Random_Type &&
         !_PyArg_NoKeywords("Random()", kwds)) {
         return NULL;
     }
@@ -527,12 +531,22 @@
     self = (RandomObject *)PyType_GenericAlloc(type, 0);
     if (self == NULL)
         return NULL;
-    tmp = random_seed(self, args);
+
+    if (PyTuple_GET_SIZE(args) > 1) {
+        PyErr_SetString(PyExc_TypeError, "Random() requires 0 or 1 argument");
+        return NULL;
+    }
+
+    if (PyTuple_GET_SIZE(args) == 1)
+        arg = PyTuple_GET_ITEM(args, 0);
+
+    tmp = random_seed(self, arg);
     if (tmp == NULL) {
         Py_DECREF(self);
         return NULL;
     }
     Py_DECREF(tmp);
+
     return (PyObject *)self;
 }
 
@@ -569,6 +583,45 @@
 "Module implements the Mersenne Twister random number generator.");
 
 static int
+_random_exec(PyObject *module)
+{
+    _randomstate *state = get_random_state(module);
+
+    state->Random_Type = PyType_FromModuleAndSpec(
+        module, &Random_Type_spec, NULL);
+    if (state->Random_Type == NULL) {
+        return -1;
+    }
+    if (PyModule_AddType(module, (PyTypeObject *)state->Random_Type) < 0) {
+        return -1;
+    }
+
+    /* Look up and save int.__abs__, which is needed in random_seed(). */
+    PyObject *longval = PyLong_FromLong(0);
+    if (longval == NULL) {
+        return -1;
+    }
+
+    PyObject *longtype = PyObject_Type(longval);
+    Py_DECREF(longval);
+    if (longtype == NULL) {
+        return -1;
+    }
+
+    state->Long___abs__ = PyObject_GetAttrString(longtype, "__abs__");
+    Py_DECREF(longtype);
+    if (state->Long___abs__ == NULL) {
+        return -1;
+    }
+    return 0;
+}
+
+static PyModuleDef_Slot _random_slots[] = {
+    {Py_mod_exec, _random_exec},
+    {0, NULL}
+};
+
+static int
 _random_traverse(PyObject *module, visitproc visit, void *arg)
 {
     Py_VISIT(get_random_state(module)->Random_Type);
@@ -595,7 +648,7 @@
     module_doc,
     sizeof(_randomstate),
     NULL,
-    NULL,
+    _random_slots,
     _random_traverse,
     _random_clear,
     _random_free,
@@ -604,43 +657,5 @@
 PyMODINIT_FUNC
 PyInit__random(void)
 {
-    PyObject *m;
-
-    PyObject *Random_Type = PyType_FromSpec(&Random_Type_spec);
-    if (Random_Type == NULL) {
-        return NULL;
-    }
-
-    m = PyModule_Create(&_randommodule);
-    if (m == NULL) {
-        Py_DECREF(Random_Type);
-        return NULL;
-    }
-    get_random_state(m)->Random_Type = Random_Type;
-
-    Py_INCREF(Random_Type);
-    PyModule_AddObject(m, "Random", Random_Type);
-
-    /* Look up and save int.__abs__, which is needed in random_seed(). */
-    PyObject *longval = NULL, *longtype = NULL;
-    longval = PyLong_FromLong(0);
-    if (longval == NULL) goto fail;
-
-    longtype = PyObject_Type(longval);
-    if (longtype == NULL) goto fail;
-
-    PyObject *abs = PyObject_GetAttrString(longtype, "__abs__");
-    if (abs == NULL) goto fail;
-
-    Py_DECREF(longtype);
-    Py_DECREF(longval);
-    get_random_state(m)->Long___abs__ = abs;
-
-    return m;
-
-fail:
-    Py_XDECREF(longtype);
-    Py_XDECREF(longval);
-    Py_DECREF(m);
-    return NULL;
+    return PyModuleDef_Init(&_randommodule);
 }
diff --git a/Modules/_scproxy.c b/Modules/_scproxy.c
index dbee3f7..4c1f1aa 100644
--- a/Modules/_scproxy.c
+++ b/Modules/_scproxy.c
@@ -231,20 +231,17 @@
     { 0, 0, 0, 0 }
 };
 
-
-
-static struct PyModuleDef mod_module = {
-    PyModuleDef_HEAD_INIT,
-    "_scproxy",
-    NULL,
-    -1,
-    mod_methods,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+static PyModuleDef_Slot _scproxy_slots[] = {
+    {0, NULL}
 };
 
+static struct PyModuleDef _scproxy_module = {
+    PyModuleDef_HEAD_INIT,
+    .m_name = "_scproxy",
+    .m_size = 0,
+    .m_methods = mod_methods,
+    .m_slots = _scproxy_slots,
+};
 
 #ifdef __cplusplus
 extern "C" {
@@ -253,10 +250,9 @@
 PyMODINIT_FUNC
 PyInit__scproxy(void)
 {
-    return PyModule_Create(&mod_module);
+    return PyModuleDef_Init(&_scproxy_module);
 }
 
 #ifdef __cplusplus
 }
 #endif
-
diff --git a/Modules/_sha3/sha3module.c b/Modules/_sha3/sha3module.c
index c826b42..3974e0b 100644
--- a/Modules/_sha3/sha3module.c
+++ b/Modules/_sha3/sha3module.c
@@ -64,6 +64,11 @@
 #define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
 #endif
 
+/* Prevent bus errors on platforms requiring aligned accesses such ARM. */
+#if HAVE_ALIGNED_REQUIRED && !defined(NO_MISALIGNED_ACCESSES)
+#define NO_MISALIGNED_ACCESSES
+#endif
+
 /* mangle names */
 #define KeccakF1600_FastLoop_Absorb _PySHA3_KeccakF1600_FastLoop_Absorb
 #define Keccak_HashFinal _PySHA3_Keccak_HashFinal
@@ -122,6 +127,28 @@
 #define SHA3_squeeze Keccak_HashSqueeze
 #define SHA3_copystate(dest, src) memcpy(&(dest), &(src), sizeof(SHA3_state))
 
+typedef struct {
+    PyTypeObject *sha3_224_type;
+    PyTypeObject *sha3_256_type;
+    PyTypeObject *sha3_384_type;
+    PyTypeObject *sha3_512_type;
+#ifdef PY_WITH_KECCAK
+    PyTypeObject *keccak_224_type;
+    PyTypeObject *keccak_256_type;
+    PyTypeObject *keccak_384_type;
+    PyTypeObject *keccak_512_type;
+#endif
+    PyTypeObject *shake_128_type;
+    PyTypeObject *shake_256_type;
+} SHA3State;
+
+static inline SHA3State*
+sha3_get_state(PyObject *module)
+{
+    void *state = PyModule_GetState(module);
+    assert(state != NULL);
+    return (SHA3State *)state;
+}
 
 /*[clinic input]
 module _sha3
@@ -142,19 +169,6 @@
     PyThread_type_lock lock;
 } SHA3object;
 
-static PyTypeObject SHA3_224type;
-static PyTypeObject SHA3_256type;
-static PyTypeObject SHA3_384type;
-static PyTypeObject SHA3_512type;
-#ifdef PY_WITH_KECCAK
-static PyTypeObject Keccak_224type;
-static PyTypeObject Keccak_256type;
-static PyTypeObject Keccak_384type;
-static PyTypeObject Keccak_512type;
-#endif
-static PyTypeObject SHAKE128type;
-static PyTypeObject SHAKE256type;
-
 #include "clinic/sha3module.c.h"
 
 static SHA3object *
@@ -184,42 +198,49 @@
 py_sha3_new_impl(PyTypeObject *type, PyObject *data, int usedforsecurity)
 /*[clinic end generated code: output=90409addc5d5e8b0 input=bcfcdf2e4368347a]*/
 {
-    SHA3object *self = NULL;
-    Py_buffer buf = {NULL, NULL};
     HashReturn res;
-
-    self = newSHA3object(type);
+    Py_buffer buf = {NULL, NULL};
+    SHA3State *state = PyType_GetModuleState(type);
+    SHA3object *self = newSHA3object(type);
     if (self == NULL) {
         goto error;
     }
 
-    if (type == &SHA3_224type) {
+    assert(state != NULL);
+
+    if (type == state->sha3_224_type) {
         res = Keccak_HashInitialize_SHA3_224(&self->hash_state);
-    } else if (type == &SHA3_256type) {
+    } else if (type == state->sha3_256_type) {
         res = Keccak_HashInitialize_SHA3_256(&self->hash_state);
-    } else if (type == &SHA3_384type) {
+    } else if (type == state->sha3_384_type) {
         res = Keccak_HashInitialize_SHA3_384(&self->hash_state);
-    } else if (type == &SHA3_512type) {
+    } else if (type == state->sha3_512_type) {
         res = Keccak_HashInitialize_SHA3_512(&self->hash_state);
 #ifdef PY_WITH_KECCAK
-    } else if (type == &Keccak_224type) {
+    } else if (type == state->keccak_224_type) {
         res = Keccak_HashInitialize(&self->hash_state, 1152, 448, 224, 0x01);
-    } else if (type == &Keccak_256type) {
+    } else if (type == state->keccak_256_type) {
         res = Keccak_HashInitialize(&self->hash_state, 1088, 512, 256, 0x01);
-    } else if (type == &Keccak_384type) {
+    } else if (type == state->keccak_384_type) {
         res = Keccak_HashInitialize(&self->hash_state, 832, 768, 384, 0x01);
-    } else if (type == &Keccak_512type) {
+    } else if (type == state->keccak_512_type) {
         res = Keccak_HashInitialize(&self->hash_state, 576, 1024, 512, 0x01);
 #endif
-    } else if (type == &SHAKE128type) {
+    } else if (type == state->shake_128_type) {
         res = Keccak_HashInitialize_SHAKE128(&self->hash_state);
-    } else if (type == &SHAKE256type) {
+    } else if (type == state->shake_256_type) {
         res = Keccak_HashInitialize_SHAKE256(&self->hash_state);
     } else {
         PyErr_BadInternalCall();
         goto error;
     }
 
+    if (res != SUCCESS) {
+        PyErr_SetString(PyExc_RuntimeError,
+                        "internal error in SHA3 initialize()");
+        goto error;
+    }
+
     if (data) {
         GET_BUFFER_VIEW_OR_ERROR(data, &buf, goto error);
         if (buf.len >= HASHLIB_GIL_MINSIZE) {
@@ -262,7 +283,10 @@
     if (self->lock) {
         PyThread_free_lock(self->lock);
     }
-    PyObject_Del(self);
+
+    PyTypeObject *tp = Py_TYPE(self);
+    PyObject_Free(self);
+    Py_DECREF(tp);
 }
 
 
@@ -416,27 +440,31 @@
 SHA3_get_name(SHA3object *self, void *closure)
 {
     PyTypeObject *type = Py_TYPE(self);
-    if (type == &SHA3_224type) {
+
+    SHA3State *state = PyType_GetModuleState(type);
+    assert(state != NULL);
+
+    if (type == state->sha3_224_type) {
         return PyUnicode_FromString("sha3_224");
-    } else if (type == &SHA3_256type) {
+    } else if (type == state->sha3_256_type) {
         return PyUnicode_FromString("sha3_256");
-    } else if (type == &SHA3_384type) {
+    } else if (type == state->sha3_384_type) {
         return PyUnicode_FromString("sha3_384");
-    } else if (type == &SHA3_512type) {
+    } else if (type == state->sha3_512_type) {
         return PyUnicode_FromString("sha3_512");
 #ifdef PY_WITH_KECCAK
-    } else if (type == &Keccak_224type) {
+    } else if (type == state->keccak_224_type) {
         return PyUnicode_FromString("keccak_224");
-    } else if (type == &Keccak_256type) {
+    } else if (type == state->keccak_256_type) {
         return PyUnicode_FromString("keccak_256");
-    } else if (type == &Keccak_384type) {
+    } else if (type == state->keccak_384_type) {
         return PyUnicode_FromString("keccak_384");
-    } else if (type == &Keccak_512type) {
+    } else if (type == state->keccak_512_type) {
         return PyUnicode_FromString("keccak_512");
 #endif
-    } else if (type == &SHAKE128type) {
+    } else if (type == state->shake_128_type) {
         return PyUnicode_FromString("shake_128");
-    } else if (type == &SHAKE256type) {
+    } else if (type == state->shake_256_type) {
         return PyUnicode_FromString("shake_256");
     } else {
         PyErr_BadInternalCall();
@@ -476,7 +504,6 @@
     return PyBytes_FromStringAndSize((const char *)suffix, 1);
 }
 
-
 static PyGetSetDef SHA3_getseters[] = {
     {"block_size", (getter)SHA3_get_block_size, NULL, NULL, NULL},
     {"name", (getter)SHA3_get_name, NULL, NULL, NULL},
@@ -487,48 +514,24 @@
     {NULL}  /* Sentinel */
 };
 
+#define SHA3_TYPE_SLOTS(type_slots_obj, type_doc, type_methods) \
+    static PyType_Slot type_slots_obj[] = { \
+        {Py_tp_dealloc, SHA3_dealloc}, \
+        {Py_tp_doc, (char*)type_doc}, \
+        {Py_tp_methods, type_methods}, \
+        {Py_tp_getset, SHA3_getseters}, \
+        {Py_tp_new, py_sha3_new}, \
+        {0,0} \
+    }
 
-#define SHA3_TYPE(type_obj, type_name, type_doc, type_methods) \
-    static PyTypeObject type_obj = { \
-        PyVarObject_HEAD_INIT(NULL, 0) \
-        type_name,          /* tp_name */ \
-        sizeof(SHA3object), /* tp_basicsize */ \
-        0,                  /* tp_itemsize */ \
-        /*  methods  */ \
-        (destructor)SHA3_dealloc, /* tp_dealloc */ \
-        0,                  /* tp_vectorcall_offset */ \
-        0,                  /* tp_getattr */ \
-        0,                  /* tp_setattr */ \
-        0,                  /* tp_as_async */ \
-        0,                  /* tp_repr */ \
-        0,                  /* tp_as_number */ \
-        0,                  /* tp_as_sequence */ \
-        0,                  /* tp_as_mapping */ \
-        0,                  /* tp_hash */ \
-        0,                  /* tp_call */ \
-        0,                  /* tp_str */ \
-        0,                  /* tp_getattro */ \
-        0,                  /* tp_setattro */ \
-        0,                  /* tp_as_buffer */ \
-        Py_TPFLAGS_DEFAULT, /* tp_flags */ \
-        type_doc,           /* tp_doc */ \
-        0,                  /* tp_traverse */ \
-        0,                  /* tp_clear */ \
-        0,                  /* tp_richcompare */ \
-        0,                  /* tp_weaklistoffset */ \
-        0,                  /* tp_iter */ \
-        0,                  /* tp_iternext */ \
-        type_methods,       /* tp_methods */ \
-        NULL,               /* tp_members */ \
-        SHA3_getseters,     /* tp_getset */ \
-        0,                  /* tp_base */ \
-        0,                  /* tp_dict */ \
-        0,                  /* tp_descr_get */ \
-        0,                  /* tp_descr_set */ \
-        0,                  /* tp_dictoffset */ \
-        0,                  /* tp_init */ \
-        0,                  /* tp_alloc */ \
-        py_sha3_new,        /* tp_new */ \
+// Using PyType_GetModuleState() on these types is safe since they
+// cannot be subclassed: it does not have the Py_TPFLAGS_BASETYPE flag.
+#define SHA3_TYPE_SPEC(type_spec_obj, type_name, type_slots) \
+    static PyType_Spec type_spec_obj = { \
+        .name = "_sha3." type_name, \
+        .basicsize = sizeof(SHA3object), \
+        .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE, \
+        .slots = type_slots \
     }
 
 PyDoc_STRVAR(sha3_224__doc__,
@@ -551,11 +554,6 @@
 \n\
 Return a new SHA3 hash object with a hashbit length of 64 bytes.");
 
-SHA3_TYPE(SHA3_224type, "_sha3.sha3_224", sha3_224__doc__, SHA3_methods);
-SHA3_TYPE(SHA3_256type, "_sha3.sha3_256", sha3_256__doc__, SHA3_methods);
-SHA3_TYPE(SHA3_384type, "_sha3.sha3_384", sha3_384__doc__, SHA3_methods);
-SHA3_TYPE(SHA3_512type, "_sha3.sha3_512", sha3_512__doc__, SHA3_methods);
-
 #ifdef PY_WITH_KECCAK
 PyDoc_STRVAR(keccak_224__doc__,
 "keccak_224([data], *, usedforsecurity=True) -> Keccak object\n\
@@ -577,10 +575,32 @@
 \n\
 Return a new Keccak hash object with a hashbit length of 64 bytes.");
 
-SHA3_TYPE(Keccak_224type, "_sha3.keccak_224", keccak_224__doc__, SHA3_methods);
-SHA3_TYPE(Keccak_256type, "_sha3.keccak_256", keccak_256__doc__, SHA3_methods);
-SHA3_TYPE(Keccak_384type, "_sha3.keccak_384", keccak_384__doc__, SHA3_methods);
-SHA3_TYPE(Keccak_512type, "_sha3.keccak_512", keccak_512__doc__, SHA3_methods);
+#endif
+
+SHA3_TYPE_SLOTS(sha3_224_slots, sha3_224__doc__, SHA3_methods);
+SHA3_TYPE_SPEC(sha3_224_spec, "sha3_224", sha3_224_slots);
+
+SHA3_TYPE_SLOTS(sha3_256_slots, sha3_256__doc__, SHA3_methods);
+SHA3_TYPE_SPEC(sha3_256_spec, "sha3_256", sha3_256_slots);
+
+SHA3_TYPE_SLOTS(sha3_384_slots, sha3_384__doc__, SHA3_methods);
+SHA3_TYPE_SPEC(sha3_384_spec, "sha3_384", sha3_384_slots);
+
+SHA3_TYPE_SLOTS(sha3_512_slots, sha3_512__doc__, SHA3_methods);
+SHA3_TYPE_SPEC(sha3_512_spec, "sha3_512", sha3_512_slots);
+
+#ifdef PY_WITH_KECCAK
+SHA3_TYPE_SLOTS(Keccak_224_slots, keccak_224__doc__, SHA3_methods);
+SHA3_TYPE_SPEC(Keccak_224_spec, "keccak_224", Keccak_224_slots);
+
+SHA3_TYPE_SLOTS(Keccak_256_slots, keccak_256__doc__, SHA3_methods);
+SHA3_TYPE_SPEC(Keccak_256_spec, "keccak_256", Keccak_256_slots);
+
+SHA3_TYPE_SLOTS(Keccak_384_slots, keccak_384__doc__, SHA3_methods);
+SHA3_TYPE_SPEC(Keccak_384_spec, "keccak_384", Keccak_384_slots);
+
+SHA3_TYPE_SLOTS(Keccak_512_slots, keccak_512__doc__, SHA3_methods);
+SHA3_TYPE_SPEC(Keccak_512_spec, "keccak_512", Keccak_512_slots);
 #endif
 
 
@@ -684,70 +704,118 @@
 \n\
 Return a new SHAKE hash object.");
 
-SHA3_TYPE(SHAKE128type, "_sha3.shake_128", shake_128__doc__, SHAKE_methods);
-SHA3_TYPE(SHAKE256type, "_sha3.shake_256", shake_256__doc__, SHAKE_methods);
+SHA3_TYPE_SLOTS(SHAKE128slots, shake_128__doc__, SHAKE_methods);
+SHA3_TYPE_SPEC(SHAKE128_spec, "shake_128", SHAKE128slots);
 
+SHA3_TYPE_SLOTS(SHAKE256slots, shake_256__doc__, SHAKE_methods);
+SHA3_TYPE_SPEC(SHAKE256_spec, "shake_256", SHAKE256slots);
+
+
+static int
+_sha3_traverse(PyObject *module, visitproc visit, void *arg)
+{
+    SHA3State *state = sha3_get_state(module);
+    Py_VISIT(state->sha3_224_type);
+    Py_VISIT(state->sha3_256_type);
+    Py_VISIT(state->sha3_384_type);
+    Py_VISIT(state->sha3_512_type);
+#ifdef PY_WITH_KECCAK
+    Py_VISIT(state->keccak_224_type);
+    Py_VISIT(state->keccak_256_type);
+    Py_VISIT(state->keccak_384_type);
+    Py_VISIT(state->keccak_512_type);
+#endif
+    Py_VISIT(state->shake_128_type);
+    Py_VISIT(state->shake_256_type);
+    return 0;
+}
+
+static int
+_sha3_clear(PyObject *module)
+{
+    SHA3State *state = sha3_get_state(module);
+    Py_CLEAR(state->sha3_224_type);
+    Py_CLEAR(state->sha3_256_type);
+    Py_CLEAR(state->sha3_384_type);
+    Py_CLEAR(state->sha3_512_type);
+#ifdef PY_WITH_KECCAK
+    Py_CLEAR(state->keccak_224_type);
+    Py_CLEAR(state->keccak_256_type);
+    Py_CLEAR(state->keccak_384_type);
+    Py_CLEAR(state->keccak_512_type);
+#endif
+    Py_CLEAR(state->shake_128_type);
+    Py_CLEAR(state->shake_256_type);
+    return 0;
+}
+
+static void
+_sha3_free(void *module)
+{
+    _sha3_clear((PyObject *)module);
+}
+
+static int
+_sha3_exec(PyObject *m)
+{
+    SHA3State *st = sha3_get_state(m);
+
+#define init_sha3type(type, typespec)                           \
+    do {                                                        \
+        st->type = (PyTypeObject *)PyType_FromModuleAndSpec(    \
+            m, &typespec, NULL);                                \
+        if (st->type == NULL) {                                 \
+            return -1;                                          \
+        }                                                       \
+        if (PyModule_AddType(m, st->type) < 0) {                \
+            return -1;                                          \
+        }                                                       \
+    } while(0)
+
+    init_sha3type(sha3_224_type, sha3_224_spec);
+    init_sha3type(sha3_256_type, sha3_256_spec);
+    init_sha3type(sha3_384_type, sha3_384_spec);
+    init_sha3type(sha3_512_type, sha3_512_spec);
+#ifdef PY_WITH_KECCAK
+    init_sha3type(keccak_224_type, Keccak_224_spec);
+    init_sha3type(keccak_256_type, Keccak_256_spec);
+    init_sha3type(keccak_384_type, Keccak_384_spec);
+    init_sha3type(keccak_512_type, Keccak_512_spec);
+#endif
+    init_sha3type(shake_128_type, SHAKE128_spec);
+    init_sha3type(shake_256_type, SHAKE256_spec);
+#undef init_sha3type
+
+    if (PyModule_AddIntConstant(m, "keccakopt", KeccakOpt) < 0) {
+        return -1;
+    }
+    if (PyModule_AddStringConstant(m, "implementation",
+                                   KeccakP1600_implementation) < 0) {
+        return -1;
+    }
+
+    return 0;
+}
+
+static PyModuleDef_Slot _sha3_slots[] = {
+    {Py_mod_exec, _sha3_exec},
+    {0, NULL}
+};
 
 /* Initialize this module. */
-static struct PyModuleDef _SHA3module = {
-        PyModuleDef_HEAD_INIT,
-        "_sha3",
-        NULL,
-        -1,
-        NULL,
-        NULL,
-        NULL,
-        NULL,
-        NULL
+static struct PyModuleDef _sha3module = {
+    PyModuleDef_HEAD_INIT,
+    .m_name = "_sha3",
+    .m_size = sizeof(SHA3State),
+    .m_slots = _sha3_slots,
+    .m_traverse = _sha3_traverse,
+    .m_clear = _sha3_clear,
+    .m_free = _sha3_free,
 };
 
 
 PyMODINIT_FUNC
 PyInit__sha3(void)
 {
-    PyObject *m = NULL;
-
-    if ((m = PyModule_Create(&_SHA3module)) == NULL) {
-        return NULL;
-    }
-
-#define init_sha3type(name, type)     \
-    do {                              \
-        Py_SET_TYPE(type, &PyType_Type); \
-        if (PyType_Ready(type) < 0) { \
-            goto error;               \
-        }                             \
-        Py_INCREF((PyObject *)type);  \
-        if (PyModule_AddObject(m, name, (PyObject *)type) < 0) { \
-            goto error;               \
-        }                             \
-    } while(0)
-
-    init_sha3type("sha3_224", &SHA3_224type);
-    init_sha3type("sha3_256", &SHA3_256type);
-    init_sha3type("sha3_384", &SHA3_384type);
-    init_sha3type("sha3_512", &SHA3_512type);
-#ifdef PY_WITH_KECCAK
-    init_sha3type("keccak_224", &Keccak_224type);
-    init_sha3type("keccak_256", &Keccak_256type);
-    init_sha3type("keccak_384", &Keccak_384type);
-    init_sha3type("keccak_512", &Keccak_512type);
-#endif
-    init_sha3type("shake_128", &SHAKE128type);
-    init_sha3type("shake_256", &SHAKE256type);
-
-#undef init_sha3type
-
-    if (PyModule_AddIntConstant(m, "keccakopt", KeccakOpt) < 0) {
-        goto error;
-    }
-    if (PyModule_AddStringConstant(m, "implementation",
-                                   KeccakP1600_implementation) < 0) {
-        goto error;
-    }
-
-    return m;
-  error:
-    Py_DECREF(m);
-    return NULL;
+    return PyModuleDef_Init(&_sha3module);
 }
diff --git a/Modules/_sqlite/cache.c b/Modules/_sqlite/cache.c
index 758fc02..fd4e619 100644
--- a/Modules/_sqlite/cache.c
+++ b/Modules/_sqlite/cache.c
@@ -25,20 +25,18 @@
 #include <limits.h>
 
 /* only used internally */
-pysqlite_Node* pysqlite_new_node(PyObject* key, PyObject* data)
+static pysqlite_Node *
+pysqlite_new_node(PyObject *key, PyObject *data)
 {
     pysqlite_Node* node;
 
-    node = (pysqlite_Node*) (pysqlite_NodeType.tp_alloc(&pysqlite_NodeType, 0));
+    node = (pysqlite_Node*) (pysqlite_NodeType->tp_alloc(pysqlite_NodeType, 0));
     if (!node) {
         return NULL;
     }
 
-    Py_INCREF(key);
-    node->key = key;
-
-    Py_INCREF(data);
-    node->data = data;
+    node->key = Py_NewRef(key);
+    node->data = Py_NewRef(data);
 
     node->prev = NULL;
     node->next = NULL;
@@ -46,15 +44,35 @@
     return node;
 }
 
-void pysqlite_node_dealloc(pysqlite_Node* self)
+static int
+node_traverse(pysqlite_Node *self, visitproc visit, void *arg)
 {
-    Py_DECREF(self->key);
-    Py_DECREF(self->data);
-
-    Py_TYPE(self)->tp_free((PyObject*)self);
+    Py_VISIT(Py_TYPE(self));
+    Py_VISIT(self->key);
+    Py_VISIT(self->data);
+    return 0;
 }
 
-int pysqlite_cache_init(pysqlite_Cache* self, PyObject* args, PyObject* kwargs)
+static int
+node_clear(pysqlite_Node *self)
+{
+    Py_CLEAR(self->key);
+    Py_CLEAR(self->data);
+    return 0;
+}
+
+static void
+pysqlite_node_dealloc(pysqlite_Node *self)
+{
+    PyTypeObject *tp = Py_TYPE(self);
+    PyObject_GC_UnTrack(self);
+    tp->tp_clear((PyObject *)self);
+    tp->tp_free(self);
+    Py_DECREF(tp);
+}
+
+static int
+pysqlite_cache_init(pysqlite_Cache *self, PyObject *args, PyObject *kwargs)
 {
     PyObject* factory;
     int size = 10;
@@ -78,38 +96,62 @@
         return -1;
     }
 
-    Py_INCREF(factory);
-    self->factory = factory;
+    self->factory = Py_NewRef(factory);
 
     self->decref_factory = 1;
 
     return 0;
 }
 
-void pysqlite_cache_dealloc(pysqlite_Cache* self)
+static int
+cache_traverse(pysqlite_Cache *self, visitproc visit, void *arg)
 {
-    pysqlite_Node* node;
-    pysqlite_Node* delete_node;
+    Py_VISIT(Py_TYPE(self));
+    Py_VISIT(self->mapping);
+    if (self->decref_factory) {
+        Py_VISIT(self->factory);
+    }
 
+    pysqlite_Node *node = self->first;
+    while (node) {
+        Py_VISIT(node);
+        node = node->next;
+    }
+    return 0;
+}
+
+static int
+cache_clear(pysqlite_Cache *self)
+{
+    Py_CLEAR(self->mapping);
+    if (self->decref_factory) {
+        Py_CLEAR(self->factory);
+    }
+
+    /* iterate over all nodes and deallocate them */
+    pysqlite_Node *node = self->first;
+    self->first = NULL;
+    while (node) {
+        pysqlite_Node *delete_node = node;
+        node = node->next;
+        Py_CLEAR(delete_node);
+    }
+    return 0;
+}
+
+static void
+pysqlite_cache_dealloc(pysqlite_Cache *self)
+{
     if (!self->factory) {
         /* constructor failed, just get out of here */
         return;
     }
 
-    /* iterate over all nodes and deallocate them */
-    node = self->first;
-    while (node) {
-        delete_node = node;
-        node = node->next;
-        Py_DECREF(delete_node);
-    }
-
-    if (self->decref_factory) {
-        Py_DECREF(self->factory);
-    }
-    Py_DECREF(self->mapping);
-
-    Py_TYPE(self)->tp_free((PyObject*)self);
+    PyObject_GC_UnTrack(self);
+    PyTypeObject *tp = Py_TYPE(self);
+    tp->tp_clear((PyObject *)self);
+    tp->tp_free(self);
+    Py_DECREF(tp);
 }
 
 PyObject* pysqlite_cache_get(pysqlite_Cache* self, PyObject* key)
@@ -213,11 +255,11 @@
         self->last = node;
     }
 
-    Py_INCREF(node->data);
-    return node->data;
+    return Py_NewRef(node->data);
 }
 
-PyObject* pysqlite_cache_display(pysqlite_Cache* self, PyObject* args)
+static PyObject *
+pysqlite_cache_display(pysqlite_Cache *self, PyObject *args)
 {
     pysqlite_Node* ptr;
     PyObject* prevkey;
@@ -253,6 +295,21 @@
     Py_RETURN_NONE;
 }
 
+static PyType_Slot node_slots[] = {
+    {Py_tp_dealloc, pysqlite_node_dealloc},
+    {Py_tp_traverse, node_traverse},
+    {Py_tp_clear, node_clear},
+    {0, NULL},
+};
+
+static PyType_Spec node_spec = {
+    .name = MODULE_NAME ".Node",
+    .basicsize = sizeof(pysqlite_Node),
+    .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC,
+    .slots = node_slots,
+};
+PyTypeObject *pysqlite_NodeType = NULL;
+
 static PyMethodDef cache_methods[] = {
     {"get", (PyCFunction)pysqlite_cache_get, METH_O,
         PyDoc_STR("Gets an entry from the cache or calls the factory function to produce one.")},
@@ -261,102 +318,34 @@
     {NULL, NULL}
 };
 
-PyTypeObject pysqlite_NodeType = {
-        PyVarObject_HEAD_INIT(NULL, 0)
-        MODULE_NAME "Node",                             /* tp_name */
-        sizeof(pysqlite_Node),                          /* tp_basicsize */
-        0,                                              /* tp_itemsize */
-        (destructor)pysqlite_node_dealloc,              /* tp_dealloc */
-        0,                                              /* tp_vectorcall_offset */
-        0,                                              /* tp_getattr */
-        0,                                              /* tp_setattr */
-        0,                                              /* tp_as_async */
-        0,                                              /* tp_repr */
-        0,                                              /* tp_as_number */
-        0,                                              /* tp_as_sequence */
-        0,                                              /* tp_as_mapping */
-        0,                                              /* tp_hash */
-        0,                                              /* tp_call */
-        0,                                              /* tp_str */
-        0,                                              /* tp_getattro */
-        0,                                              /* tp_setattro */
-        0,                                              /* tp_as_buffer */
-        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,         /* tp_flags */
-        0,                                              /* tp_doc */
-        0,                                              /* tp_traverse */
-        0,                                              /* tp_clear */
-        0,                                              /* tp_richcompare */
-        0,                                              /* tp_weaklistoffset */
-        0,                                              /* tp_iter */
-        0,                                              /* tp_iternext */
-        0,                                              /* tp_methods */
-        0,                                              /* tp_members */
-        0,                                              /* tp_getset */
-        0,                                              /* tp_base */
-        0,                                              /* tp_dict */
-        0,                                              /* tp_descr_get */
-        0,                                              /* tp_descr_set */
-        0,                                              /* tp_dictoffset */
-        (initproc)0,                                    /* tp_init */
-        0,                                              /* tp_alloc */
-        0,                                              /* tp_new */
-        0                                               /* tp_free */
+static PyType_Slot cache_slots[] = {
+    {Py_tp_dealloc, pysqlite_cache_dealloc},
+    {Py_tp_methods, cache_methods},
+    {Py_tp_init, pysqlite_cache_init},
+    {Py_tp_traverse, cache_traverse},
+    {Py_tp_clear, cache_clear},
+    {0, NULL},
 };
 
-PyTypeObject pysqlite_CacheType = {
-        PyVarObject_HEAD_INIT(NULL, 0)
-        MODULE_NAME ".Cache",                           /* tp_name */
-        sizeof(pysqlite_Cache),                         /* tp_basicsize */
-        0,                                              /* tp_itemsize */
-        (destructor)pysqlite_cache_dealloc,             /* tp_dealloc */
-        0,                                              /* tp_vectorcall_offset */
-        0,                                              /* tp_getattr */
-        0,                                              /* tp_setattr */
-        0,                                              /* tp_as_async */
-        0,                                              /* tp_repr */
-        0,                                              /* tp_as_number */
-        0,                                              /* tp_as_sequence */
-        0,                                              /* tp_as_mapping */
-        0,                                              /* tp_hash */
-        0,                                              /* tp_call */
-        0,                                              /* tp_str */
-        0,                                              /* tp_getattro */
-        0,                                              /* tp_setattro */
-        0,                                              /* tp_as_buffer */
-        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,         /* tp_flags */
-        0,                                              /* tp_doc */
-        0,                                              /* tp_traverse */
-        0,                                              /* tp_clear */
-        0,                                              /* tp_richcompare */
-        0,                                              /* tp_weaklistoffset */
-        0,                                              /* tp_iter */
-        0,                                              /* tp_iternext */
-        cache_methods,                                  /* tp_methods */
-        0,                                              /* tp_members */
-        0,                                              /* tp_getset */
-        0,                                              /* tp_base */
-        0,                                              /* tp_dict */
-        0,                                              /* tp_descr_get */
-        0,                                              /* tp_descr_set */
-        0,                                              /* tp_dictoffset */
-        (initproc)pysqlite_cache_init,                  /* tp_init */
-        0,                                              /* tp_alloc */
-        0,                                              /* tp_new */
-        0                                               /* tp_free */
+static PyType_Spec cache_spec = {
+    .name = MODULE_NAME ".Cache",
+    .basicsize = sizeof(pysqlite_Cache),
+    .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC,
+    .slots = cache_slots,
 };
+PyTypeObject *pysqlite_CacheType = NULL;
 
-extern int pysqlite_cache_setup_types(void)
+int
+pysqlite_cache_setup_types(PyObject *mod)
 {
-    int rc;
-
-    pysqlite_NodeType.tp_new = PyType_GenericNew;
-    pysqlite_CacheType.tp_new = PyType_GenericNew;
-
-    rc = PyType_Ready(&pysqlite_NodeType);
-    if (rc < 0) {
-        return rc;
+    pysqlite_NodeType = (PyTypeObject *)PyType_FromModuleAndSpec(mod, &node_spec, NULL);
+    if (pysqlite_NodeType == NULL) {
+        return -1;
     }
 
-    rc = PyType_Ready(&pysqlite_CacheType);
-    return rc;
+    pysqlite_CacheType = (PyTypeObject *)PyType_FromModuleAndSpec(mod, &cache_spec, NULL);
+    if (pysqlite_CacheType == NULL) {
+        return -1;
+    }
+    return 0;
 }
diff --git a/Modules/_sqlite/cache.h b/Modules/_sqlite/cache.h
index 5290109..083356f 100644
--- a/Modules/_sqlite/cache.h
+++ b/Modules/_sqlite/cache.h
@@ -23,8 +23,7 @@
 
 #ifndef PYSQLITE_CACHE_H
 #define PYSQLITE_CACHE_H
-#define PY_SSIZE_T_CLEAN
-#include "Python.h"
+#include "module.h"
 
 /* The LRU cache is implemented as a combination of a doubly-linked with a
  * dictionary. The list items are of type 'Node' and the dictionary has the
@@ -59,16 +58,11 @@
     int decref_factory;
 } pysqlite_Cache;
 
-extern PyTypeObject pysqlite_NodeType;
-extern PyTypeObject pysqlite_CacheType;
+extern PyTypeObject *pysqlite_NodeType;
+extern PyTypeObject *pysqlite_CacheType;
 
-int pysqlite_node_init(pysqlite_Node* self, PyObject* args, PyObject* kwargs);
-void pysqlite_node_dealloc(pysqlite_Node* self);
-
-int pysqlite_cache_init(pysqlite_Cache* self, PyObject* args, PyObject* kwargs);
-void pysqlite_cache_dealloc(pysqlite_Cache* self);
 PyObject* pysqlite_cache_get(pysqlite_Cache* self, PyObject* args);
 
-int pysqlite_cache_setup_types(void);
+int pysqlite_cache_setup_types(PyObject *module);
 
 #endif
diff --git a/Modules/_sqlite/clinic/connection.c.h b/Modules/_sqlite/clinic/connection.c.h
new file mode 100644
index 0000000..9ddce41
--- /dev/null
+++ b/Modules/_sqlite/clinic/connection.c.h
@@ -0,0 +1,709 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(pysqlite_connection_cursor__doc__,
+"cursor($self, /, factory=<unrepresentable>)\n"
+"--\n"
+"\n"
+"Return a cursor for the connection.");
+
+#define PYSQLITE_CONNECTION_CURSOR_METHODDEF    \
+    {"cursor", (PyCFunction)(void(*)(void))pysqlite_connection_cursor, METH_FASTCALL|METH_KEYWORDS, pysqlite_connection_cursor__doc__},
+
+static PyObject *
+pysqlite_connection_cursor_impl(pysqlite_Connection *self, PyObject *factory);
+
+static PyObject *
+pysqlite_connection_cursor(pysqlite_Connection *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"factory", NULL};
+    static _PyArg_Parser _parser = {NULL, _keywords, "cursor", 0};
+    PyObject *argsbuf[1];
+    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
+    PyObject *factory = NULL;
+
+    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
+    if (!args) {
+        goto exit;
+    }
+    if (!noptargs) {
+        goto skip_optional_pos;
+    }
+    factory = args[0];
+skip_optional_pos:
+    return_value = pysqlite_connection_cursor_impl(self, factory);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(pysqlite_connection_close__doc__,
+"close($self, /)\n"
+"--\n"
+"\n"
+"Closes the connection.");
+
+#define PYSQLITE_CONNECTION_CLOSE_METHODDEF    \
+    {"close", (PyCFunction)pysqlite_connection_close, METH_NOARGS, pysqlite_connection_close__doc__},
+
+static PyObject *
+pysqlite_connection_close_impl(pysqlite_Connection *self);
+
+static PyObject *
+pysqlite_connection_close(pysqlite_Connection *self, PyObject *Py_UNUSED(ignored))
+{
+    return pysqlite_connection_close_impl(self);
+}
+
+PyDoc_STRVAR(pysqlite_connection_commit__doc__,
+"commit($self, /)\n"
+"--\n"
+"\n"
+"Commit the current transaction.");
+
+#define PYSQLITE_CONNECTION_COMMIT_METHODDEF    \
+    {"commit", (PyCFunction)pysqlite_connection_commit, METH_NOARGS, pysqlite_connection_commit__doc__},
+
+static PyObject *
+pysqlite_connection_commit_impl(pysqlite_Connection *self);
+
+static PyObject *
+pysqlite_connection_commit(pysqlite_Connection *self, PyObject *Py_UNUSED(ignored))
+{
+    return pysqlite_connection_commit_impl(self);
+}
+
+PyDoc_STRVAR(pysqlite_connection_rollback__doc__,
+"rollback($self, /)\n"
+"--\n"
+"\n"
+"Roll back the current transaction.");
+
+#define PYSQLITE_CONNECTION_ROLLBACK_METHODDEF    \
+    {"rollback", (PyCFunction)pysqlite_connection_rollback, METH_NOARGS, pysqlite_connection_rollback__doc__},
+
+static PyObject *
+pysqlite_connection_rollback_impl(pysqlite_Connection *self);
+
+static PyObject *
+pysqlite_connection_rollback(pysqlite_Connection *self, PyObject *Py_UNUSED(ignored))
+{
+    return pysqlite_connection_rollback_impl(self);
+}
+
+PyDoc_STRVAR(pysqlite_connection_create_function__doc__,
+"create_function($self, /, name, narg, func, *, deterministic=False)\n"
+"--\n"
+"\n"
+"Creates a new function.");
+
+#define PYSQLITE_CONNECTION_CREATE_FUNCTION_METHODDEF    \
+    {"create_function", (PyCFunction)(void(*)(void))pysqlite_connection_create_function, METH_FASTCALL|METH_KEYWORDS, pysqlite_connection_create_function__doc__},
+
+static PyObject *
+pysqlite_connection_create_function_impl(pysqlite_Connection *self,
+                                         const char *name, int narg,
+                                         PyObject *func, int deterministic);
+
+static PyObject *
+pysqlite_connection_create_function(pysqlite_Connection *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"name", "narg", "func", "deterministic", NULL};
+    static _PyArg_Parser _parser = {NULL, _keywords, "create_function", 0};
+    PyObject *argsbuf[4];
+    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 3;
+    const char *name;
+    int narg;
+    PyObject *func;
+    int deterministic = 0;
+
+    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 3, 0, argsbuf);
+    if (!args) {
+        goto exit;
+    }
+    if (!PyUnicode_Check(args[0])) {
+        _PyArg_BadArgument("create_function", "argument 'name'", "str", args[0]);
+        goto exit;
+    }
+    Py_ssize_t name_length;
+    name = PyUnicode_AsUTF8AndSize(args[0], &name_length);
+    if (name == NULL) {
+        goto exit;
+    }
+    if (strlen(name) != (size_t)name_length) {
+        PyErr_SetString(PyExc_ValueError, "embedded null character");
+        goto exit;
+    }
+    narg = _PyLong_AsInt(args[1]);
+    if (narg == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    func = args[2];
+    if (!noptargs) {
+        goto skip_optional_kwonly;
+    }
+    deterministic = PyObject_IsTrue(args[3]);
+    if (deterministic < 0) {
+        goto exit;
+    }
+skip_optional_kwonly:
+    return_value = pysqlite_connection_create_function_impl(self, name, narg, func, deterministic);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(pysqlite_connection_create_aggregate__doc__,
+"create_aggregate($self, /, name, n_arg, aggregate_class)\n"
+"--\n"
+"\n"
+"Creates a new aggregate.");
+
+#define PYSQLITE_CONNECTION_CREATE_AGGREGATE_METHODDEF    \
+    {"create_aggregate", (PyCFunction)(void(*)(void))pysqlite_connection_create_aggregate, METH_FASTCALL|METH_KEYWORDS, pysqlite_connection_create_aggregate__doc__},
+
+static PyObject *
+pysqlite_connection_create_aggregate_impl(pysqlite_Connection *self,
+                                          const char *name, int n_arg,
+                                          PyObject *aggregate_class);
+
+static PyObject *
+pysqlite_connection_create_aggregate(pysqlite_Connection *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"name", "n_arg", "aggregate_class", NULL};
+    static _PyArg_Parser _parser = {NULL, _keywords, "create_aggregate", 0};
+    PyObject *argsbuf[3];
+    const char *name;
+    int n_arg;
+    PyObject *aggregate_class;
+
+    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 3, 0, argsbuf);
+    if (!args) {
+        goto exit;
+    }
+    if (!PyUnicode_Check(args[0])) {
+        _PyArg_BadArgument("create_aggregate", "argument 'name'", "str", args[0]);
+        goto exit;
+    }
+    Py_ssize_t name_length;
+    name = PyUnicode_AsUTF8AndSize(args[0], &name_length);
+    if (name == NULL) {
+        goto exit;
+    }
+    if (strlen(name) != (size_t)name_length) {
+        PyErr_SetString(PyExc_ValueError, "embedded null character");
+        goto exit;
+    }
+    n_arg = _PyLong_AsInt(args[1]);
+    if (n_arg == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    aggregate_class = args[2];
+    return_value = pysqlite_connection_create_aggregate_impl(self, name, n_arg, aggregate_class);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(pysqlite_connection_set_authorizer__doc__,
+"set_authorizer($self, /, authorizer_callback)\n"
+"--\n"
+"\n"
+"Sets authorizer callback.");
+
+#define PYSQLITE_CONNECTION_SET_AUTHORIZER_METHODDEF    \
+    {"set_authorizer", (PyCFunction)(void(*)(void))pysqlite_connection_set_authorizer, METH_FASTCALL|METH_KEYWORDS, pysqlite_connection_set_authorizer__doc__},
+
+static PyObject *
+pysqlite_connection_set_authorizer_impl(pysqlite_Connection *self,
+                                        PyObject *authorizer_cb);
+
+static PyObject *
+pysqlite_connection_set_authorizer(pysqlite_Connection *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"authorizer_callback", NULL};
+    static _PyArg_Parser _parser = {NULL, _keywords, "set_authorizer", 0};
+    PyObject *argsbuf[1];
+    PyObject *authorizer_cb;
+
+    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+    if (!args) {
+        goto exit;
+    }
+    authorizer_cb = args[0];
+    return_value = pysqlite_connection_set_authorizer_impl(self, authorizer_cb);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(pysqlite_connection_set_progress_handler__doc__,
+"set_progress_handler($self, /, progress_handler, n)\n"
+"--\n"
+"\n"
+"Sets progress handler callback.");
+
+#define PYSQLITE_CONNECTION_SET_PROGRESS_HANDLER_METHODDEF    \
+    {"set_progress_handler", (PyCFunction)(void(*)(void))pysqlite_connection_set_progress_handler, METH_FASTCALL|METH_KEYWORDS, pysqlite_connection_set_progress_handler__doc__},
+
+static PyObject *
+pysqlite_connection_set_progress_handler_impl(pysqlite_Connection *self,
+                                              PyObject *progress_handler,
+                                              int n);
+
+static PyObject *
+pysqlite_connection_set_progress_handler(pysqlite_Connection *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"progress_handler", "n", NULL};
+    static _PyArg_Parser _parser = {NULL, _keywords, "set_progress_handler", 0};
+    PyObject *argsbuf[2];
+    PyObject *progress_handler;
+    int n;
+
+    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
+    if (!args) {
+        goto exit;
+    }
+    progress_handler = args[0];
+    n = _PyLong_AsInt(args[1]);
+    if (n == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    return_value = pysqlite_connection_set_progress_handler_impl(self, progress_handler, n);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(pysqlite_connection_set_trace_callback__doc__,
+"set_trace_callback($self, /, trace_callback)\n"
+"--\n"
+"\n"
+"Sets a trace callback called for each SQL statement (passed as unicode).");
+
+#define PYSQLITE_CONNECTION_SET_TRACE_CALLBACK_METHODDEF    \
+    {"set_trace_callback", (PyCFunction)(void(*)(void))pysqlite_connection_set_trace_callback, METH_FASTCALL|METH_KEYWORDS, pysqlite_connection_set_trace_callback__doc__},
+
+static PyObject *
+pysqlite_connection_set_trace_callback_impl(pysqlite_Connection *self,
+                                            PyObject *trace_callback);
+
+static PyObject *
+pysqlite_connection_set_trace_callback(pysqlite_Connection *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"trace_callback", NULL};
+    static _PyArg_Parser _parser = {NULL, _keywords, "set_trace_callback", 0};
+    PyObject *argsbuf[1];
+    PyObject *trace_callback;
+
+    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+    if (!args) {
+        goto exit;
+    }
+    trace_callback = args[0];
+    return_value = pysqlite_connection_set_trace_callback_impl(self, trace_callback);
+
+exit:
+    return return_value;
+}
+
+#if !defined(SQLITE_OMIT_LOAD_EXTENSION)
+
+PyDoc_STRVAR(pysqlite_connection_enable_load_extension__doc__,
+"enable_load_extension($self, enable, /)\n"
+"--\n"
+"\n"
+"Enable dynamic loading of SQLite extension modules.");
+
+#define PYSQLITE_CONNECTION_ENABLE_LOAD_EXTENSION_METHODDEF    \
+    {"enable_load_extension", (PyCFunction)pysqlite_connection_enable_load_extension, METH_O, pysqlite_connection_enable_load_extension__doc__},
+
+static PyObject *
+pysqlite_connection_enable_load_extension_impl(pysqlite_Connection *self,
+                                               int onoff);
+
+static PyObject *
+pysqlite_connection_enable_load_extension(pysqlite_Connection *self, PyObject *arg)
+{
+    PyObject *return_value = NULL;
+    int onoff;
+
+    onoff = _PyLong_AsInt(arg);
+    if (onoff == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    return_value = pysqlite_connection_enable_load_extension_impl(self, onoff);
+
+exit:
+    return return_value;
+}
+
+#endif /* !defined(SQLITE_OMIT_LOAD_EXTENSION) */
+
+#if !defined(SQLITE_OMIT_LOAD_EXTENSION)
+
+PyDoc_STRVAR(pysqlite_connection_load_extension__doc__,
+"load_extension($self, name, /)\n"
+"--\n"
+"\n"
+"Load SQLite extension module.");
+
+#define PYSQLITE_CONNECTION_LOAD_EXTENSION_METHODDEF    \
+    {"load_extension", (PyCFunction)pysqlite_connection_load_extension, METH_O, pysqlite_connection_load_extension__doc__},
+
+static PyObject *
+pysqlite_connection_load_extension_impl(pysqlite_Connection *self,
+                                        const char *extension_name);
+
+static PyObject *
+pysqlite_connection_load_extension(pysqlite_Connection *self, PyObject *arg)
+{
+    PyObject *return_value = NULL;
+    const char *extension_name;
+
+    if (!PyUnicode_Check(arg)) {
+        _PyArg_BadArgument("load_extension", "argument", "str", arg);
+        goto exit;
+    }
+    Py_ssize_t extension_name_length;
+    extension_name = PyUnicode_AsUTF8AndSize(arg, &extension_name_length);
+    if (extension_name == NULL) {
+        goto exit;
+    }
+    if (strlen(extension_name) != (size_t)extension_name_length) {
+        PyErr_SetString(PyExc_ValueError, "embedded null character");
+        goto exit;
+    }
+    return_value = pysqlite_connection_load_extension_impl(self, extension_name);
+
+exit:
+    return return_value;
+}
+
+#endif /* !defined(SQLITE_OMIT_LOAD_EXTENSION) */
+
+PyDoc_STRVAR(pysqlite_connection_execute__doc__,
+"execute($self, sql, parameters=<unrepresentable>, /)\n"
+"--\n"
+"\n"
+"Executes an SQL statement.");
+
+#define PYSQLITE_CONNECTION_EXECUTE_METHODDEF    \
+    {"execute", (PyCFunction)(void(*)(void))pysqlite_connection_execute, METH_FASTCALL, pysqlite_connection_execute__doc__},
+
+static PyObject *
+pysqlite_connection_execute_impl(pysqlite_Connection *self, PyObject *sql,
+                                 PyObject *parameters);
+
+static PyObject *
+pysqlite_connection_execute(pysqlite_Connection *self, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    PyObject *sql;
+    PyObject *parameters = NULL;
+
+    if (!_PyArg_CheckPositional("execute", nargs, 1, 2)) {
+        goto exit;
+    }
+    if (!PyUnicode_Check(args[0])) {
+        _PyArg_BadArgument("execute", "argument 1", "str", args[0]);
+        goto exit;
+    }
+    if (PyUnicode_READY(args[0]) == -1) {
+        goto exit;
+    }
+    sql = args[0];
+    if (nargs < 2) {
+        goto skip_optional;
+    }
+    parameters = args[1];
+skip_optional:
+    return_value = pysqlite_connection_execute_impl(self, sql, parameters);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(pysqlite_connection_executemany__doc__,
+"executemany($self, sql, parameters, /)\n"
+"--\n"
+"\n"
+"Repeatedly executes an SQL statement.");
+
+#define PYSQLITE_CONNECTION_EXECUTEMANY_METHODDEF    \
+    {"executemany", (PyCFunction)(void(*)(void))pysqlite_connection_executemany, METH_FASTCALL, pysqlite_connection_executemany__doc__},
+
+static PyObject *
+pysqlite_connection_executemany_impl(pysqlite_Connection *self,
+                                     PyObject *sql, PyObject *parameters);
+
+static PyObject *
+pysqlite_connection_executemany(pysqlite_Connection *self, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    PyObject *sql;
+    PyObject *parameters;
+
+    if (!_PyArg_CheckPositional("executemany", nargs, 2, 2)) {
+        goto exit;
+    }
+    if (!PyUnicode_Check(args[0])) {
+        _PyArg_BadArgument("executemany", "argument 1", "str", args[0]);
+        goto exit;
+    }
+    if (PyUnicode_READY(args[0]) == -1) {
+        goto exit;
+    }
+    sql = args[0];
+    parameters = args[1];
+    return_value = pysqlite_connection_executemany_impl(self, sql, parameters);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(pysqlite_connection_executescript__doc__,
+"executescript($self, sql_script, /)\n"
+"--\n"
+"\n"
+"Executes multiple SQL statements at once.");
+
+#define PYSQLITE_CONNECTION_EXECUTESCRIPT_METHODDEF    \
+    {"executescript", (PyCFunction)pysqlite_connection_executescript, METH_O, pysqlite_connection_executescript__doc__},
+
+PyDoc_STRVAR(pysqlite_connection_interrupt__doc__,
+"interrupt($self, /)\n"
+"--\n"
+"\n"
+"Abort any pending database operation.");
+
+#define PYSQLITE_CONNECTION_INTERRUPT_METHODDEF    \
+    {"interrupt", (PyCFunction)pysqlite_connection_interrupt, METH_NOARGS, pysqlite_connection_interrupt__doc__},
+
+static PyObject *
+pysqlite_connection_interrupt_impl(pysqlite_Connection *self);
+
+static PyObject *
+pysqlite_connection_interrupt(pysqlite_Connection *self, PyObject *Py_UNUSED(ignored))
+{
+    return pysqlite_connection_interrupt_impl(self);
+}
+
+PyDoc_STRVAR(pysqlite_connection_iterdump__doc__,
+"iterdump($self, /)\n"
+"--\n"
+"\n"
+"Returns iterator to the dump of the database in an SQL text format.");
+
+#define PYSQLITE_CONNECTION_ITERDUMP_METHODDEF    \
+    {"iterdump", (PyCFunction)pysqlite_connection_iterdump, METH_NOARGS, pysqlite_connection_iterdump__doc__},
+
+static PyObject *
+pysqlite_connection_iterdump_impl(pysqlite_Connection *self);
+
+static PyObject *
+pysqlite_connection_iterdump(pysqlite_Connection *self, PyObject *Py_UNUSED(ignored))
+{
+    return pysqlite_connection_iterdump_impl(self);
+}
+
+PyDoc_STRVAR(pysqlite_connection_backup__doc__,
+"backup($self, /, target, *, pages=-1, progress=None, name=\'main\',\n"
+"       sleep=0.25)\n"
+"--\n"
+"\n"
+"Makes a backup of the database.");
+
+#define PYSQLITE_CONNECTION_BACKUP_METHODDEF    \
+    {"backup", (PyCFunction)(void(*)(void))pysqlite_connection_backup, METH_FASTCALL|METH_KEYWORDS, pysqlite_connection_backup__doc__},
+
+static PyObject *
+pysqlite_connection_backup_impl(pysqlite_Connection *self,
+                                pysqlite_Connection *target, int pages,
+                                PyObject *progress, const char *name,
+                                double sleep);
+
+static PyObject *
+pysqlite_connection_backup(pysqlite_Connection *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"target", "pages", "progress", "name", "sleep", NULL};
+    static _PyArg_Parser _parser = {NULL, _keywords, "backup", 0};
+    PyObject *argsbuf[5];
+    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
+    pysqlite_Connection *target;
+    int pages = -1;
+    PyObject *progress = Py_None;
+    const char *name = "main";
+    double sleep = 0.25;
+
+    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+    if (!args) {
+        goto exit;
+    }
+    if (!PyObject_TypeCheck(args[0], pysqlite_ConnectionType)) {
+        _PyArg_BadArgument("backup", "argument 'target'", (pysqlite_ConnectionType)->tp_name, args[0]);
+        goto exit;
+    }
+    target = (pysqlite_Connection *)args[0];
+    if (!noptargs) {
+        goto skip_optional_kwonly;
+    }
+    if (args[1]) {
+        pages = _PyLong_AsInt(args[1]);
+        if (pages == -1 && PyErr_Occurred()) {
+            goto exit;
+        }
+        if (!--noptargs) {
+            goto skip_optional_kwonly;
+        }
+    }
+    if (args[2]) {
+        progress = args[2];
+        if (!--noptargs) {
+            goto skip_optional_kwonly;
+        }
+    }
+    if (args[3]) {
+        if (!PyUnicode_Check(args[3])) {
+            _PyArg_BadArgument("backup", "argument 'name'", "str", args[3]);
+            goto exit;
+        }
+        Py_ssize_t name_length;
+        name = PyUnicode_AsUTF8AndSize(args[3], &name_length);
+        if (name == NULL) {
+            goto exit;
+        }
+        if (strlen(name) != (size_t)name_length) {
+            PyErr_SetString(PyExc_ValueError, "embedded null character");
+            goto exit;
+        }
+        if (!--noptargs) {
+            goto skip_optional_kwonly;
+        }
+    }
+    if (PyFloat_CheckExact(args[4])) {
+        sleep = PyFloat_AS_DOUBLE(args[4]);
+    }
+    else
+    {
+        sleep = PyFloat_AsDouble(args[4]);
+        if (sleep == -1.0 && PyErr_Occurred()) {
+            goto exit;
+        }
+    }
+skip_optional_kwonly:
+    return_value = pysqlite_connection_backup_impl(self, target, pages, progress, name, sleep);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(pysqlite_connection_create_collation__doc__,
+"create_collation($self, name, callback, /)\n"
+"--\n"
+"\n"
+"Creates a collation function.");
+
+#define PYSQLITE_CONNECTION_CREATE_COLLATION_METHODDEF    \
+    {"create_collation", (PyCFunction)(void(*)(void))pysqlite_connection_create_collation, METH_FASTCALL, pysqlite_connection_create_collation__doc__},
+
+static PyObject *
+pysqlite_connection_create_collation_impl(pysqlite_Connection *self,
+                                          PyObject *name, PyObject *callable);
+
+static PyObject *
+pysqlite_connection_create_collation(pysqlite_Connection *self, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    PyObject *name;
+    PyObject *callable;
+
+    if (!_PyArg_CheckPositional("create_collation", nargs, 2, 2)) {
+        goto exit;
+    }
+    if (!PyUnicode_Check(args[0])) {
+        _PyArg_BadArgument("create_collation", "argument 1", "str", args[0]);
+        goto exit;
+    }
+    if (PyUnicode_READY(args[0]) == -1) {
+        goto exit;
+    }
+    name = args[0];
+    callable = args[1];
+    return_value = pysqlite_connection_create_collation_impl(self, name, callable);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(pysqlite_connection_enter__doc__,
+"__enter__($self, /)\n"
+"--\n"
+"\n"
+"Called when the connection is used as a context manager.\n"
+"\n"
+"Returns itself as a convenience to the caller.");
+
+#define PYSQLITE_CONNECTION_ENTER_METHODDEF    \
+    {"__enter__", (PyCFunction)pysqlite_connection_enter, METH_NOARGS, pysqlite_connection_enter__doc__},
+
+static PyObject *
+pysqlite_connection_enter_impl(pysqlite_Connection *self);
+
+static PyObject *
+pysqlite_connection_enter(pysqlite_Connection *self, PyObject *Py_UNUSED(ignored))
+{
+    return pysqlite_connection_enter_impl(self);
+}
+
+PyDoc_STRVAR(pysqlite_connection_exit__doc__,
+"__exit__($self, type, value, traceback, /)\n"
+"--\n"
+"\n"
+"Called when the connection is used as a context manager.\n"
+"\n"
+"If there was any exception, a rollback takes place; otherwise we commit.");
+
+#define PYSQLITE_CONNECTION_EXIT_METHODDEF    \
+    {"__exit__", (PyCFunction)(void(*)(void))pysqlite_connection_exit, METH_FASTCALL, pysqlite_connection_exit__doc__},
+
+static PyObject *
+pysqlite_connection_exit_impl(pysqlite_Connection *self, PyObject *exc_type,
+                              PyObject *exc_value, PyObject *exc_tb);
+
+static PyObject *
+pysqlite_connection_exit(pysqlite_Connection *self, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    PyObject *exc_type;
+    PyObject *exc_value;
+    PyObject *exc_tb;
+
+    if (!_PyArg_CheckPositional("__exit__", nargs, 3, 3)) {
+        goto exit;
+    }
+    exc_type = args[0];
+    exc_value = args[1];
+    exc_tb = args[2];
+    return_value = pysqlite_connection_exit_impl(self, exc_type, exc_value, exc_tb);
+
+exit:
+    return return_value;
+}
+
+#ifndef PYSQLITE_CONNECTION_ENABLE_LOAD_EXTENSION_METHODDEF
+    #define PYSQLITE_CONNECTION_ENABLE_LOAD_EXTENSION_METHODDEF
+#endif /* !defined(PYSQLITE_CONNECTION_ENABLE_LOAD_EXTENSION_METHODDEF) */
+
+#ifndef PYSQLITE_CONNECTION_LOAD_EXTENSION_METHODDEF
+    #define PYSQLITE_CONNECTION_LOAD_EXTENSION_METHODDEF
+#endif /* !defined(PYSQLITE_CONNECTION_LOAD_EXTENSION_METHODDEF) */
+/*[clinic end generated code: output=2f3f3406ba6b4d2e input=a9049054013a1b77]*/
diff --git a/Modules/_sqlite/clinic/cursor.c.h b/Modules/_sqlite/clinic/cursor.c.h
new file mode 100644
index 0000000..c6e35a2
--- /dev/null
+++ b/Modules/_sqlite/clinic/cursor.c.h
@@ -0,0 +1,262 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+static int
+pysqlite_cursor_init_impl(pysqlite_Cursor *self,
+                          pysqlite_Connection *connection);
+
+static int
+pysqlite_cursor_init(PyObject *self, PyObject *args, PyObject *kwargs)
+{
+    int return_value = -1;
+    pysqlite_Connection *connection;
+
+    if (Py_IS_TYPE(self, pysqlite_CursorType) &&
+        !_PyArg_NoKeywords("Cursor", kwargs)) {
+        goto exit;
+    }
+    if (!_PyArg_CheckPositional("Cursor", PyTuple_GET_SIZE(args), 1, 1)) {
+        goto exit;
+    }
+    if (!PyObject_TypeCheck(PyTuple_GET_ITEM(args, 0), pysqlite_ConnectionType)) {
+        _PyArg_BadArgument("Cursor", "argument 1", (pysqlite_ConnectionType)->tp_name, PyTuple_GET_ITEM(args, 0));
+        goto exit;
+    }
+    connection = (pysqlite_Connection *)PyTuple_GET_ITEM(args, 0);
+    return_value = pysqlite_cursor_init_impl((pysqlite_Cursor *)self, connection);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(pysqlite_cursor_execute__doc__,
+"execute($self, sql, parameters=(), /)\n"
+"--\n"
+"\n"
+"Executes an SQL statement.");
+
+#define PYSQLITE_CURSOR_EXECUTE_METHODDEF    \
+    {"execute", (PyCFunction)(void(*)(void))pysqlite_cursor_execute, METH_FASTCALL, pysqlite_cursor_execute__doc__},
+
+static PyObject *
+pysqlite_cursor_execute_impl(pysqlite_Cursor *self, PyObject *sql,
+                             PyObject *parameters);
+
+static PyObject *
+pysqlite_cursor_execute(pysqlite_Cursor *self, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    PyObject *sql;
+    PyObject *parameters = NULL;
+
+    if (!_PyArg_CheckPositional("execute", nargs, 1, 2)) {
+        goto exit;
+    }
+    if (!PyUnicode_Check(args[0])) {
+        _PyArg_BadArgument("execute", "argument 1", "str", args[0]);
+        goto exit;
+    }
+    if (PyUnicode_READY(args[0]) == -1) {
+        goto exit;
+    }
+    sql = args[0];
+    if (nargs < 2) {
+        goto skip_optional;
+    }
+    parameters = args[1];
+skip_optional:
+    return_value = pysqlite_cursor_execute_impl(self, sql, parameters);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(pysqlite_cursor_executemany__doc__,
+"executemany($self, sql, seq_of_parameters, /)\n"
+"--\n"
+"\n"
+"Repeatedly executes an SQL statement.");
+
+#define PYSQLITE_CURSOR_EXECUTEMANY_METHODDEF    \
+    {"executemany", (PyCFunction)(void(*)(void))pysqlite_cursor_executemany, METH_FASTCALL, pysqlite_cursor_executemany__doc__},
+
+static PyObject *
+pysqlite_cursor_executemany_impl(pysqlite_Cursor *self, PyObject *sql,
+                                 PyObject *seq_of_parameters);
+
+static PyObject *
+pysqlite_cursor_executemany(pysqlite_Cursor *self, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    PyObject *sql;
+    PyObject *seq_of_parameters;
+
+    if (!_PyArg_CheckPositional("executemany", nargs, 2, 2)) {
+        goto exit;
+    }
+    if (!PyUnicode_Check(args[0])) {
+        _PyArg_BadArgument("executemany", "argument 1", "str", args[0]);
+        goto exit;
+    }
+    if (PyUnicode_READY(args[0]) == -1) {
+        goto exit;
+    }
+    sql = args[0];
+    seq_of_parameters = args[1];
+    return_value = pysqlite_cursor_executemany_impl(self, sql, seq_of_parameters);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(pysqlite_cursor_executescript__doc__,
+"executescript($self, sql_script, /)\n"
+"--\n"
+"\n"
+"Executes multiple SQL statements at once.");
+
+#define PYSQLITE_CURSOR_EXECUTESCRIPT_METHODDEF    \
+    {"executescript", (PyCFunction)pysqlite_cursor_executescript, METH_O, pysqlite_cursor_executescript__doc__},
+
+PyDoc_STRVAR(pysqlite_cursor_fetchone__doc__,
+"fetchone($self, /)\n"
+"--\n"
+"\n"
+"Fetches one row from the resultset.");
+
+#define PYSQLITE_CURSOR_FETCHONE_METHODDEF    \
+    {"fetchone", (PyCFunction)pysqlite_cursor_fetchone, METH_NOARGS, pysqlite_cursor_fetchone__doc__},
+
+static PyObject *
+pysqlite_cursor_fetchone_impl(pysqlite_Cursor *self);
+
+static PyObject *
+pysqlite_cursor_fetchone(pysqlite_Cursor *self, PyObject *Py_UNUSED(ignored))
+{
+    return pysqlite_cursor_fetchone_impl(self);
+}
+
+PyDoc_STRVAR(pysqlite_cursor_fetchmany__doc__,
+"fetchmany($self, /, size=1)\n"
+"--\n"
+"\n"
+"Fetches several rows from the resultset.\n"
+"\n"
+"  size\n"
+"    The default value is set by the Cursor.arraysize attribute.");
+
+#define PYSQLITE_CURSOR_FETCHMANY_METHODDEF    \
+    {"fetchmany", (PyCFunction)(void(*)(void))pysqlite_cursor_fetchmany, METH_FASTCALL|METH_KEYWORDS, pysqlite_cursor_fetchmany__doc__},
+
+static PyObject *
+pysqlite_cursor_fetchmany_impl(pysqlite_Cursor *self, int maxrows);
+
+static PyObject *
+pysqlite_cursor_fetchmany(pysqlite_Cursor *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"size", NULL};
+    static _PyArg_Parser _parser = {NULL, _keywords, "fetchmany", 0};
+    PyObject *argsbuf[1];
+    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
+    int maxrows = self->arraysize;
+
+    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
+    if (!args) {
+        goto exit;
+    }
+    if (!noptargs) {
+        goto skip_optional_pos;
+    }
+    maxrows = _PyLong_AsInt(args[0]);
+    if (maxrows == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+skip_optional_pos:
+    return_value = pysqlite_cursor_fetchmany_impl(self, maxrows);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(pysqlite_cursor_fetchall__doc__,
+"fetchall($self, /)\n"
+"--\n"
+"\n"
+"Fetches all rows from the resultset.");
+
+#define PYSQLITE_CURSOR_FETCHALL_METHODDEF    \
+    {"fetchall", (PyCFunction)pysqlite_cursor_fetchall, METH_NOARGS, pysqlite_cursor_fetchall__doc__},
+
+static PyObject *
+pysqlite_cursor_fetchall_impl(pysqlite_Cursor *self);
+
+static PyObject *
+pysqlite_cursor_fetchall(pysqlite_Cursor *self, PyObject *Py_UNUSED(ignored))
+{
+    return pysqlite_cursor_fetchall_impl(self);
+}
+
+PyDoc_STRVAR(pysqlite_cursor_setinputsizes__doc__,
+"setinputsizes($self, sizes, /)\n"
+"--\n"
+"\n"
+"Required by DB-API. Does nothing in sqlite3.");
+
+#define PYSQLITE_CURSOR_SETINPUTSIZES_METHODDEF    \
+    {"setinputsizes", (PyCFunction)pysqlite_cursor_setinputsizes, METH_O, pysqlite_cursor_setinputsizes__doc__},
+
+PyDoc_STRVAR(pysqlite_cursor_setoutputsize__doc__,
+"setoutputsize($self, size, column=None, /)\n"
+"--\n"
+"\n"
+"Required by DB-API. Does nothing in sqlite3.");
+
+#define PYSQLITE_CURSOR_SETOUTPUTSIZE_METHODDEF    \
+    {"setoutputsize", (PyCFunction)(void(*)(void))pysqlite_cursor_setoutputsize, METH_FASTCALL, pysqlite_cursor_setoutputsize__doc__},
+
+static PyObject *
+pysqlite_cursor_setoutputsize_impl(pysqlite_Cursor *self, PyObject *size,
+                                   PyObject *column);
+
+static PyObject *
+pysqlite_cursor_setoutputsize(pysqlite_Cursor *self, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    PyObject *size;
+    PyObject *column = Py_None;
+
+    if (!_PyArg_CheckPositional("setoutputsize", nargs, 1, 2)) {
+        goto exit;
+    }
+    size = args[0];
+    if (nargs < 2) {
+        goto skip_optional;
+    }
+    column = args[1];
+skip_optional:
+    return_value = pysqlite_cursor_setoutputsize_impl(self, size, column);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(pysqlite_cursor_close__doc__,
+"close($self, /)\n"
+"--\n"
+"\n"
+"Closes the cursor.");
+
+#define PYSQLITE_CURSOR_CLOSE_METHODDEF    \
+    {"close", (PyCFunction)pysqlite_cursor_close, METH_NOARGS, pysqlite_cursor_close__doc__},
+
+static PyObject *
+pysqlite_cursor_close_impl(pysqlite_Cursor *self);
+
+static PyObject *
+pysqlite_cursor_close(pysqlite_Cursor *self, PyObject *Py_UNUSED(ignored))
+{
+    return pysqlite_cursor_close_impl(self);
+}
+/*[clinic end generated code: output=9879e3a5d4ee3847 input=a9049054013a1b77]*/
diff --git a/Modules/_sqlite/clinic/module.c.h b/Modules/_sqlite/clinic/module.c.h
new file mode 100644
index 0000000..2118cb7
--- /dev/null
+++ b/Modules/_sqlite/clinic/module.c.h
@@ -0,0 +1,225 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(pysqlite_complete_statement__doc__,
+"complete_statement($module, /, statement)\n"
+"--\n"
+"\n"
+"Checks if a string contains a complete SQL statement.");
+
+#define PYSQLITE_COMPLETE_STATEMENT_METHODDEF    \
+    {"complete_statement", (PyCFunction)(void(*)(void))pysqlite_complete_statement, METH_FASTCALL|METH_KEYWORDS, pysqlite_complete_statement__doc__},
+
+static PyObject *
+pysqlite_complete_statement_impl(PyObject *module, const char *statement);
+
+static PyObject *
+pysqlite_complete_statement(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"statement", NULL};
+    static _PyArg_Parser _parser = {NULL, _keywords, "complete_statement", 0};
+    PyObject *argsbuf[1];
+    const char *statement;
+
+    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+    if (!args) {
+        goto exit;
+    }
+    if (!PyUnicode_Check(args[0])) {
+        _PyArg_BadArgument("complete_statement", "argument 'statement'", "str", args[0]);
+        goto exit;
+    }
+    Py_ssize_t statement_length;
+    statement = PyUnicode_AsUTF8AndSize(args[0], &statement_length);
+    if (statement == NULL) {
+        goto exit;
+    }
+    if (strlen(statement) != (size_t)statement_length) {
+        PyErr_SetString(PyExc_ValueError, "embedded null character");
+        goto exit;
+    }
+    return_value = pysqlite_complete_statement_impl(module, statement);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(pysqlite_enable_shared_cache__doc__,
+"enable_shared_cache($module, /, do_enable)\n"
+"--\n"
+"\n"
+"Enable or disable shared cache mode for the calling thread.\n"
+"\n"
+"This method is deprecated and will be removed in Python 3.12.\n"
+"Shared cache is strongly discouraged by the SQLite 3 documentation.\n"
+"If shared cache must be used, open the database in URI mode using\n"
+"the cache=shared query parameter.");
+
+#define PYSQLITE_ENABLE_SHARED_CACHE_METHODDEF    \
+    {"enable_shared_cache", (PyCFunction)(void(*)(void))pysqlite_enable_shared_cache, METH_FASTCALL|METH_KEYWORDS, pysqlite_enable_shared_cache__doc__},
+
+static PyObject *
+pysqlite_enable_shared_cache_impl(PyObject *module, int do_enable);
+
+static PyObject *
+pysqlite_enable_shared_cache(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"do_enable", NULL};
+    static _PyArg_Parser _parser = {NULL, _keywords, "enable_shared_cache", 0};
+    PyObject *argsbuf[1];
+    int do_enable;
+
+    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+    if (!args) {
+        goto exit;
+    }
+    do_enable = _PyLong_AsInt(args[0]);
+    if (do_enable == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    return_value = pysqlite_enable_shared_cache_impl(module, do_enable);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(pysqlite_register_adapter__doc__,
+"register_adapter($module, type, caster, /)\n"
+"--\n"
+"\n"
+"Registers an adapter with sqlite3\'s adapter registry.");
+
+#define PYSQLITE_REGISTER_ADAPTER_METHODDEF    \
+    {"register_adapter", (PyCFunction)(void(*)(void))pysqlite_register_adapter, METH_FASTCALL, pysqlite_register_adapter__doc__},
+
+static PyObject *
+pysqlite_register_adapter_impl(PyObject *module, PyTypeObject *type,
+                               PyObject *caster);
+
+static PyObject *
+pysqlite_register_adapter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    PyTypeObject *type;
+    PyObject *caster;
+
+    if (!_PyArg_CheckPositional("register_adapter", nargs, 2, 2)) {
+        goto exit;
+    }
+    type = (PyTypeObject *)args[0];
+    caster = args[1];
+    return_value = pysqlite_register_adapter_impl(module, type, caster);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(pysqlite_register_converter__doc__,
+"register_converter($module, name, converter, /)\n"
+"--\n"
+"\n"
+"Registers a converter with sqlite3.");
+
+#define PYSQLITE_REGISTER_CONVERTER_METHODDEF    \
+    {"register_converter", (PyCFunction)(void(*)(void))pysqlite_register_converter, METH_FASTCALL, pysqlite_register_converter__doc__},
+
+static PyObject *
+pysqlite_register_converter_impl(PyObject *module, PyObject *orig_name,
+                                 PyObject *callable);
+
+static PyObject *
+pysqlite_register_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    PyObject *orig_name;
+    PyObject *callable;
+
+    if (!_PyArg_CheckPositional("register_converter", nargs, 2, 2)) {
+        goto exit;
+    }
+    if (!PyUnicode_Check(args[0])) {
+        _PyArg_BadArgument("register_converter", "argument 1", "str", args[0]);
+        goto exit;
+    }
+    if (PyUnicode_READY(args[0]) == -1) {
+        goto exit;
+    }
+    orig_name = args[0];
+    callable = args[1];
+    return_value = pysqlite_register_converter_impl(module, orig_name, callable);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(pysqlite_enable_callback_trace__doc__,
+"enable_callback_tracebacks($module, enable, /)\n"
+"--\n"
+"\n"
+"Enable or disable callback functions throwing errors to stderr.");
+
+#define PYSQLITE_ENABLE_CALLBACK_TRACE_METHODDEF    \
+    {"enable_callback_tracebacks", (PyCFunction)pysqlite_enable_callback_trace, METH_O, pysqlite_enable_callback_trace__doc__},
+
+static PyObject *
+pysqlite_enable_callback_trace_impl(PyObject *module, int enable);
+
+static PyObject *
+pysqlite_enable_callback_trace(PyObject *module, PyObject *arg)
+{
+    PyObject *return_value = NULL;
+    int enable;
+
+    enable = _PyLong_AsInt(arg);
+    if (enable == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    return_value = pysqlite_enable_callback_trace_impl(module, enable);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(pysqlite_adapt__doc__,
+"adapt($module, obj, proto=PrepareProtocolType, alt=<unrepresentable>, /)\n"
+"--\n"
+"\n"
+"Adapt given object to given protocol.");
+
+#define PYSQLITE_ADAPT_METHODDEF    \
+    {"adapt", (PyCFunction)(void(*)(void))pysqlite_adapt, METH_FASTCALL, pysqlite_adapt__doc__},
+
+static PyObject *
+pysqlite_adapt_impl(PyObject *module, PyObject *obj, PyObject *proto,
+                    PyObject *alt);
+
+static PyObject *
+pysqlite_adapt(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    PyObject *obj;
+    PyObject *proto = (PyObject*)pysqlite_PrepareProtocolType;
+    PyObject *alt = NULL;
+
+    if (!_PyArg_CheckPositional("adapt", nargs, 1, 3)) {
+        goto exit;
+    }
+    obj = args[0];
+    if (nargs < 2) {
+        goto skip_optional;
+    }
+    proto = args[1];
+    if (nargs < 3) {
+        goto skip_optional;
+    }
+    alt = args[2];
+skip_optional:
+    return_value = pysqlite_adapt_impl(module, obj, proto, alt);
+
+exit:
+    return return_value;
+}
+/*[clinic end generated code: output=6939849a4371122d input=a9049054013a1b77]*/
diff --git a/Modules/_sqlite/clinic/row.c.h b/Modules/_sqlite/clinic/row.c.h
new file mode 100644
index 0000000..7ff1109
--- /dev/null
+++ b/Modules/_sqlite/clinic/row.c.h
@@ -0,0 +1,56 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+static PyObject *
+pysqlite_row_new_impl(PyTypeObject *type, pysqlite_Cursor *cursor,
+                      PyObject *data);
+
+static PyObject *
+pysqlite_row_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
+{
+    PyObject *return_value = NULL;
+    pysqlite_Cursor *cursor;
+    PyObject *data;
+
+    if ((type == pysqlite_RowType) &&
+        !_PyArg_NoKeywords("Row", kwargs)) {
+        goto exit;
+    }
+    if (!_PyArg_CheckPositional("Row", PyTuple_GET_SIZE(args), 2, 2)) {
+        goto exit;
+    }
+    if (!PyObject_TypeCheck(PyTuple_GET_ITEM(args, 0), pysqlite_CursorType)) {
+        _PyArg_BadArgument("Row", "argument 1", (pysqlite_CursorType)->tp_name, PyTuple_GET_ITEM(args, 0));
+        goto exit;
+    }
+    cursor = (pysqlite_Cursor *)PyTuple_GET_ITEM(args, 0);
+    if (!PyTuple_Check(PyTuple_GET_ITEM(args, 1))) {
+        _PyArg_BadArgument("Row", "argument 2", "tuple", PyTuple_GET_ITEM(args, 1));
+        goto exit;
+    }
+    data = PyTuple_GET_ITEM(args, 1);
+    return_value = pysqlite_row_new_impl(type, cursor, data);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(pysqlite_row_keys__doc__,
+"keys($self, /)\n"
+"--\n"
+"\n"
+"Returns the keys of the row.");
+
+#define PYSQLITE_ROW_KEYS_METHODDEF    \
+    {"keys", (PyCFunction)pysqlite_row_keys, METH_NOARGS, pysqlite_row_keys__doc__},
+
+static PyObject *
+pysqlite_row_keys_impl(pysqlite_Row *self);
+
+static PyObject *
+pysqlite_row_keys(pysqlite_Row *self, PyObject *Py_UNUSED(ignored))
+{
+    return pysqlite_row_keys_impl(self);
+}
+/*[clinic end generated code: output=8d29220b9cde035d input=a9049054013a1b77]*/
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c
index b800373..c9c10b4 100644
--- a/Modules/_sqlite/connection.c
+++ b/Modules/_sqlite/connection.c
@@ -33,15 +33,16 @@
 #define ACTION_FINALIZE 1
 #define ACTION_RESET 2
 
-#if SQLITE_VERSION_NUMBER >= 3003008
-#ifndef SQLITE_OMIT_LOAD_EXTENSION
-#define HAVE_LOAD_EXTENSION
-#endif
+#if SQLITE_VERSION_NUMBER >= 3014000
+#define HAVE_TRACE_V2
 #endif
 
-#if SQLITE_VERSION_NUMBER >= 3006011
-#define HAVE_BACKUP_API
-#endif
+#include "clinic/connection.c.h"
+/*[clinic input]
+module _sqlite3
+class _sqlite3.Connection "pysqlite_Connection *" "pysqlite_ConnectionType"
+[clinic start generated code]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=aa796073bd8f69db]*/
 
 _Py_IDENTIFIER(cursor);
 
@@ -56,20 +57,9 @@
 static int pysqlite_connection_set_isolation_level(pysqlite_Connection* self, PyObject* isolation_level, void *Py_UNUSED(ignored));
 static void _pysqlite_drop_unused_cursor_references(pysqlite_Connection* self);
 
-
-static void _sqlite3_result_error(sqlite3_context* ctx, const char* errmsg, int len)
-{
-    /* in older SQLite versions, calling sqlite3_result_error in callbacks
-     * triggers a bug in SQLite that leads either to irritating results or
-     * segfaults, depending on the SQLite version */
-#if SQLITE_VERSION_NUMBER >= 3003003
-    sqlite3_result_error(ctx, errmsg, len);
-#else
-    PyErr_SetString(pysqlite_OperationalError, errmsg);
-#endif
-}
-
-int pysqlite_connection_init(pysqlite_Connection* self, PyObject* args, PyObject* kwargs)
+static int
+pysqlite_connection_init(pysqlite_Connection *self, PyObject *args,
+                         PyObject *kwargs)
 {
     static char *kwlist[] = {
         "database", "timeout", "detect_types", "isolation_level",
@@ -96,9 +86,12 @@
         return -1;
     }
 
-    database = PyBytes_AsString(database_obj);
+    if (PySys_Audit("sqlite3.connect", "O", database_obj) < 0) {
+        Py_DECREF(database_obj);
+        return -1;
+    }
 
-    self->initialized = 1;
+    database = PyBytes_AsString(database_obj);
 
     self->begin_statement = NULL;
 
@@ -112,25 +105,18 @@
     Py_INCREF(&PyUnicode_Type);
     Py_XSETREF(self->text_factory, (PyObject*)&PyUnicode_Type);
 
-#ifdef SQLITE_OPEN_URI
     Py_BEGIN_ALLOW_THREADS
     rc = sqlite3_open_v2(database, &self->db,
                          SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE |
                          (uri ? SQLITE_OPEN_URI : 0), NULL);
-#else
-    if (uri) {
-        PyErr_SetString(pysqlite_NotSupportedError, "URIs not supported");
-        return -1;
-    }
-    Py_BEGIN_ALLOW_THREADS
-    /* No need to use sqlite3_open_v2 as sqlite3_open(filename, db) is the
-       same as sqlite3_open_v2(filename, db, SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE, NULL). */
-    rc = sqlite3_open(database, &self->db);
-#endif
     Py_END_ALLOW_THREADS
 
     Py_DECREF(database_obj);
 
+    if (self->db == NULL && rc == SQLITE_NOMEM) {
+        PyErr_NoMemory();
+        return -1;
+    }
     if (rc != SQLITE_OK) {
         _pysqlite_seterror(self->db, NULL);
         return -1;
@@ -145,13 +131,13 @@
         Py_INCREF(isolation_level);
     }
     Py_CLEAR(self->isolation_level);
-    if (pysqlite_connection_set_isolation_level(self, isolation_level, NULL) < 0) {
+    if (pysqlite_connection_set_isolation_level(self, isolation_level, NULL) != 0) {
         Py_DECREF(isolation_level);
         return -1;
     }
     Py_DECREF(isolation_level);
 
-    self->statement_cache = (pysqlite_Cache*)PyObject_CallFunction((PyObject*)&pysqlite_CacheType, "Oi", self, cached_statements);
+    self->statement_cache = (pysqlite_Cache*)PyObject_CallFunction((PyObject*)pysqlite_CacheType, "Oi", self, cached_statements);
     if (PyErr_Occurred()) {
         return -1;
     }
@@ -178,10 +164,6 @@
     self->timeout = timeout;
     (void)sqlite3_busy_timeout(self->db, (int)(timeout*1000));
     self->thread_ident = PyThread_get_thread_ident();
-    if (!check_same_thread && sqlite3_libversion_number() < 3003001) {
-        PyErr_SetString(pysqlite_NotSupportedError, "shared connections not available");
-        return -1;
-    }
     self->check_same_thread = check_same_thread;
 
     self->function_pinboard_trace_callback = NULL;
@@ -204,11 +186,19 @@
     self->ProgrammingError      = pysqlite_ProgrammingError;
     self->NotSupportedError     = pysqlite_NotSupportedError;
 
+    if (PySys_Audit("sqlite3.connect/handle", "O", self) < 0) {
+        return -1;
+    }
+
+    self->initialized = 1;
+
     return 0;
 }
 
 /* action in (ACTION_RESET, ACTION_FINALIZE) */
-void pysqlite_do_all_statements(pysqlite_Connection* self, int action, int reset_cursors)
+static void
+pysqlite_do_all_statements(pysqlite_Connection *self, int action,
+                           int reset_cursors)
 {
     int i;
     PyObject* weakref;
@@ -240,25 +230,53 @@
     }
 }
 
-void pysqlite_connection_dealloc(pysqlite_Connection* self)
+static int
+connection_traverse(pysqlite_Connection *self, visitproc visit, void *arg)
 {
-    Py_XDECREF(self->statement_cache);
+    Py_VISIT(Py_TYPE(self));
+    Py_VISIT(self->isolation_level);
+    Py_VISIT(self->statement_cache);
+    Py_VISIT(self->statements);
+    Py_VISIT(self->cursors);
+    Py_VISIT(self->row_factory);
+    Py_VISIT(self->text_factory);
+    Py_VISIT(self->function_pinboard_trace_callback);
+    Py_VISIT(self->function_pinboard_progress_handler);
+    Py_VISIT(self->function_pinboard_authorizer_cb);
+    Py_VISIT(self->collations);
+    return 0;
+}
+
+static int
+connection_clear(pysqlite_Connection *self)
+{
+    Py_CLEAR(self->isolation_level);
+    Py_CLEAR(self->statement_cache);
+    Py_CLEAR(self->statements);
+    Py_CLEAR(self->cursors);
+    Py_CLEAR(self->row_factory);
+    Py_CLEAR(self->text_factory);
+    Py_CLEAR(self->function_pinboard_trace_callback);
+    Py_CLEAR(self->function_pinboard_progress_handler);
+    Py_CLEAR(self->function_pinboard_authorizer_cb);
+    Py_CLEAR(self->collations);
+    return 0;
+}
+
+static void
+connection_dealloc(pysqlite_Connection *self)
+{
+    PyTypeObject *tp = Py_TYPE(self);
+    PyObject_GC_UnTrack(self);
+    tp->tp_clear((PyObject *)self);
 
     /* Clean up if user has not called .close() explicitly. */
     if (self->db) {
-        SQLITE3_CLOSE(self->db);
+        sqlite3_close_v2(self->db);
     }
 
-    Py_XDECREF(self->isolation_level);
-    Py_XDECREF(self->function_pinboard_trace_callback);
-    Py_XDECREF(self->function_pinboard_progress_handler);
-    Py_XDECREF(self->function_pinboard_authorizer_cb);
-    Py_XDECREF(self->row_factory);
-    Py_XDECREF(self->text_factory);
-    Py_XDECREF(self->collations);
-    Py_XDECREF(self->statements);
-    Py_XDECREF(self->cursors);
-    Py_TYPE(self)->tp_free((PyObject*)self);
+    tp->tp_free(self);
+    Py_DECREF(tp);
 }
 
 /*
@@ -287,29 +305,32 @@
     return 0;
 }
 
-PyObject* pysqlite_connection_cursor(pysqlite_Connection* self, PyObject* args, PyObject* kwargs)
-{
-    static char *kwlist[] = {"factory", NULL};
-    PyObject* factory = NULL;
-    PyObject* cursor;
+/*[clinic input]
+_sqlite3.Connection.cursor as pysqlite_connection_cursor
 
-    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O", kwlist,
-                                     &factory)) {
-        return NULL;
-    }
+    factory: object = NULL
+
+Return a cursor for the connection.
+[clinic start generated code]*/
+
+static PyObject *
+pysqlite_connection_cursor_impl(pysqlite_Connection *self, PyObject *factory)
+/*[clinic end generated code: output=562432a9e6af2aa1 input=4127345aa091b650]*/
+{
+    PyObject* cursor;
 
     if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
         return NULL;
     }
 
     if (factory == NULL) {
-        factory = (PyObject*)&pysqlite_CursorType;
+        factory = (PyObject*)pysqlite_CursorType;
     }
 
     cursor = PyObject_CallOneArg(factory, (PyObject *)self);
     if (cursor == NULL)
         return NULL;
-    if (!PyObject_TypeCheck(cursor, &pysqlite_CursorType)) {
+    if (!PyObject_TypeCheck(cursor, pysqlite_CursorType)) {
         PyErr_Format(PyExc_TypeError,
                      "factory must return a cursor, not %.100s",
                      Py_TYPE(cursor)->tp_name);
@@ -327,7 +348,15 @@
     return cursor;
 }
 
-PyObject* pysqlite_connection_close(pysqlite_Connection* self, PyObject* args)
+/*[clinic input]
+_sqlite3.Connection.close as pysqlite_connection_close
+
+Closes the connection.
+[clinic start generated code]*/
+
+static PyObject *
+pysqlite_connection_close_impl(pysqlite_Connection *self)
+/*[clinic end generated code: output=a546a0da212c9b97 input=3d58064bbffaa3d3]*/
 {
     int rc;
 
@@ -335,10 +364,16 @@
         return NULL;
     }
 
+    if (!self->initialized) {
+        PyErr_SetString(pysqlite_ProgrammingError,
+                        "Base Connection.__init__ not called.");
+        return NULL;
+    }
+
     pysqlite_do_all_statements(self, ACTION_FINALIZE, 1);
 
     if (self->db) {
-        rc = SQLITE3_CLOSE(self->db);
+        rc = sqlite3_close_v2(self->db);
 
         if (rc != SQLITE_OK) {
             _pysqlite_seterror(self->db, NULL);
@@ -374,11 +409,11 @@
 PyObject* _pysqlite_connection_begin(pysqlite_Connection* self)
 {
     int rc;
-    const char* tail;
     sqlite3_stmt* statement;
 
     Py_BEGIN_ALLOW_THREADS
-    rc = sqlite3_prepare_v2(self->db, self->begin_statement, -1, &statement, &tail);
+    rc = sqlite3_prepare_v2(self->db, self->begin_statement, -1, &statement,
+                            NULL);
     Py_END_ALLOW_THREADS
 
     if (rc != SQLITE_OK) {
@@ -407,10 +442,17 @@
     }
 }
 
-PyObject* pysqlite_connection_commit(pysqlite_Connection* self, PyObject* args)
+/*[clinic input]
+_sqlite3.Connection.commit as pysqlite_connection_commit
+
+Commit the current transaction.
+[clinic start generated code]*/
+
+static PyObject *
+pysqlite_connection_commit_impl(pysqlite_Connection *self)
+/*[clinic end generated code: output=3da45579e89407f2 input=39c12c04dda276a8]*/
 {
     int rc;
-    const char* tail;
     sqlite3_stmt* statement;
 
     if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
@@ -420,7 +462,7 @@
     if (!sqlite3_get_autocommit(self->db)) {
 
         Py_BEGIN_ALLOW_THREADS
-        rc = sqlite3_prepare_v2(self->db, "COMMIT", -1, &statement, &tail);
+        rc = sqlite3_prepare_v2(self->db, "COMMIT", -1, &statement, NULL);
         Py_END_ALLOW_THREADS
         if (rc != SQLITE_OK) {
             _pysqlite_seterror(self->db, NULL);
@@ -449,10 +491,17 @@
     }
 }
 
-PyObject* pysqlite_connection_rollback(pysqlite_Connection* self, PyObject* args)
+/*[clinic input]
+_sqlite3.Connection.rollback as pysqlite_connection_rollback
+
+Roll back the current transaction.
+[clinic start generated code]*/
+
+static PyObject *
+pysqlite_connection_rollback_impl(pysqlite_Connection *self)
+/*[clinic end generated code: output=b66fa0d43e7ef305 input=12d4e8d068942830]*/
 {
     int rc;
-    const char* tail;
     sqlite3_stmt* statement;
 
     if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
@@ -463,7 +512,7 @@
         pysqlite_do_all_statements(self, ACTION_RESET, 1);
 
         Py_BEGIN_ALLOW_THREADS
-        rc = sqlite3_prepare_v2(self->db, "ROLLBACK", -1, &statement, &tail);
+        rc = sqlite3_prepare_v2(self->db, "ROLLBACK", -1, &statement, NULL);
         Py_END_ALLOW_THREADS
         if (rc != SQLITE_OK) {
             _pysqlite_seterror(self->db, NULL);
@@ -503,12 +552,23 @@
             return -1;
         sqlite3_result_int64(context, value);
     } else if (PyFloat_Check(py_val)) {
-        sqlite3_result_double(context, PyFloat_AsDouble(py_val));
-    } else if (PyUnicode_Check(py_val)) {
-        const char *str = PyUnicode_AsUTF8(py_val);
-        if (str == NULL)
+        double value = PyFloat_AsDouble(py_val);
+        if (value == -1 && PyErr_Occurred()) {
             return -1;
-        sqlite3_result_text(context, str, -1, SQLITE_TRANSIENT);
+        }
+        sqlite3_result_double(context, value);
+    } else if (PyUnicode_Check(py_val)) {
+        Py_ssize_t sz;
+        const char *str = PyUnicode_AsUTF8AndSize(py_val, &sz);
+        if (str == NULL) {
+            return -1;
+        }
+        if (sz > INT_MAX) {
+            PyErr_SetString(PyExc_OverflowError,
+                            "string is longer than INT_MAX bytes");
+            return -1;
+        }
+        sqlite3_result_text(context, str, (int)sz, SQLITE_TRANSIENT);
     } else if (PyObject_CheckBuffer(py_val)) {
         Py_buffer view;
         if (PyObject_GetBuffer(py_val, &view, PyBUF_SIMPLE) != 0) {
@@ -530,14 +590,14 @@
     return 0;
 }
 
-PyObject* _pysqlite_build_py_params(sqlite3_context *context, int argc, sqlite3_value** argv)
+static PyObject *
+_pysqlite_build_py_params(sqlite3_context *context, int argc,
+                          sqlite3_value **argv)
 {
     PyObject* args;
     int i;
     sqlite3_value* cur_value;
     PyObject* cur_py_value;
-    const char* val_str;
-    Py_ssize_t buflen;
 
     args = PyTuple_New(argc);
     if (!args) {
@@ -553,40 +613,53 @@
             case SQLITE_FLOAT:
                 cur_py_value = PyFloat_FromDouble(sqlite3_value_double(cur_value));
                 break;
-            case SQLITE_TEXT:
-                val_str = (const char*)sqlite3_value_text(cur_value);
-                cur_py_value = PyUnicode_FromString(val_str);
-                /* TODO: have a way to show errors here */
-                if (!cur_py_value) {
-                    PyErr_Clear();
-                    Py_INCREF(Py_None);
-                    cur_py_value = Py_None;
+            case SQLITE_TEXT: {
+                sqlite3 *db = sqlite3_context_db_handle(context);
+                const char *text = (const char *)sqlite3_value_text(cur_value);
+
+                if (text == NULL && sqlite3_errcode(db) == SQLITE_NOMEM) {
+                    PyErr_NoMemory();
+                    goto error;
                 }
+
+                Py_ssize_t size = sqlite3_value_bytes(cur_value);
+                cur_py_value = PyUnicode_FromStringAndSize(text, size);
                 break;
-            case SQLITE_BLOB:
-                buflen = sqlite3_value_bytes(cur_value);
-                cur_py_value = PyBytes_FromStringAndSize(
-                    sqlite3_value_blob(cur_value), buflen);
+            }
+            case SQLITE_BLOB: {
+                sqlite3 *db = sqlite3_context_db_handle(context);
+                const void *blob = sqlite3_value_blob(cur_value);
+
+                if (blob == NULL && sqlite3_errcode(db) == SQLITE_NOMEM) {
+                    PyErr_NoMemory();
+                    goto error;
+                }
+
+                Py_ssize_t size = sqlite3_value_bytes(cur_value);
+                cur_py_value = PyBytes_FromStringAndSize(blob, size);
                 break;
+            }
             case SQLITE_NULL:
             default:
-                Py_INCREF(Py_None);
-                cur_py_value = Py_None;
+                cur_py_value = Py_NewRef(Py_None);
         }
 
         if (!cur_py_value) {
-            Py_DECREF(args);
-            return NULL;
+            goto error;
         }
 
-        PyTuple_SetItem(args, i, cur_py_value);
-
+        PyTuple_SET_ITEM(args, i, cur_py_value);
     }
 
     return args;
+
+error:
+    Py_DECREF(args);
+    return NULL;
 }
 
-void _pysqlite_func_callback(sqlite3_context* context, int argc, sqlite3_value** argv)
+static void
+_pysqlite_func_callback(sqlite3_context *context, int argc, sqlite3_value **argv)
 {
     PyObject* args;
     PyObject* py_func;
@@ -616,7 +689,7 @@
         } else {
             PyErr_Clear();
         }
-        _sqlite3_result_error(context, "user-defined function raised exception", -1);
+        sqlite3_result_error(context, "user-defined function raised exception", -1);
     }
 
     PyGILState_Release(threadstate);
@@ -648,7 +721,7 @@
             } else {
                 PyErr_Clear();
             }
-            _sqlite3_result_error(context, "user-defined aggregate's '__init__' method raised error", -1);
+            sqlite3_result_error(context, "user-defined aggregate's '__init__' method raised error", -1);
             goto error;
         }
     }
@@ -672,7 +745,7 @@
         } else {
             PyErr_Clear();
         }
-        _sqlite3_result_error(context, "user-defined aggregate's 'step' method raised error", -1);
+        sqlite3_result_error(context, "user-defined aggregate's 'step' method raised error", -1);
     }
 
 error:
@@ -682,21 +755,25 @@
     PyGILState_Release(threadstate);
 }
 
-void _pysqlite_final_callback(sqlite3_context* context)
+static void
+_pysqlite_final_callback(sqlite3_context *context)
 {
     PyObject* function_result;
     PyObject** aggregate_instance;
     _Py_IDENTIFIER(finalize);
     int ok;
     PyObject *exception, *value, *tb;
-    int restore;
 
     PyGILState_STATE threadstate;
 
     threadstate = PyGILState_Ensure();
 
-    aggregate_instance = (PyObject**)sqlite3_aggregate_context(context, sizeof(PyObject*));
-    if (!*aggregate_instance) {
+    aggregate_instance = (PyObject**)sqlite3_aggregate_context(context, 0);
+    if (aggregate_instance == NULL) {
+        /* No rows matched the query; the step handler was never called. */
+        goto error;
+    }
+    else if (!*aggregate_instance) {
         /* this branch is executed if there was an exception in the aggregate's
          * __init__ */
 
@@ -705,7 +782,6 @@
 
     /* Keep the exception (if any) of the last call to step() */
     PyErr_Fetch(&exception, &value, &tb);
-    restore = 1;
 
     function_result = _PyObject_CallMethodIdNoArgs(*aggregate_instance, &PyId_finalize);
 
@@ -722,19 +798,12 @@
         } else {
             PyErr_Clear();
         }
-        _sqlite3_result_error(context, "user-defined aggregate's 'finalize' method raised error", -1);
-#if SQLITE_VERSION_NUMBER < 3003003
-        /* with old SQLite versions, _sqlite3_result_error() sets a new Python
-           exception, so don't restore the previous exception */
-        restore = 0;
-#endif
+        sqlite3_result_error(context, "user-defined aggregate's 'finalize' method raised error", -1);
     }
 
-    if (restore) {
-        /* Restore the exception (if any) of the last call to step(),
-           but clear also the current exception if finalize() failed */
-        PyErr_Restore(exception, value, tb);
-    }
+    /* Restore the exception (if any) of the last call to step(),
+       but clear also the current exception if finalize() failed */
+    PyErr_Restore(exception, value, tb);
 
 error:
     PyGILState_Release(threadstate);
@@ -804,30 +873,39 @@
 
 static void _destructor(void* args)
 {
+    // This function may be called without the GIL held, so we need to ensure
+    // that we destroy 'args' with the GIL
+    PyGILState_STATE gstate;
+    gstate = PyGILState_Ensure();
     Py_DECREF((PyObject*)args);
+    PyGILState_Release(gstate);
 }
 
-PyObject* pysqlite_connection_create_function(pysqlite_Connection* self, PyObject* args, PyObject* kwargs)
-{
-    static char *kwlist[] = {"name", "narg", "func", "deterministic", NULL};
+/*[clinic input]
+_sqlite3.Connection.create_function as pysqlite_connection_create_function
 
-    PyObject* func;
-    char* name;
-    int narg;
+    name: str
+    narg: int
+    func: object
+    *
+    deterministic: bool = False
+
+Creates a new function.
+[clinic start generated code]*/
+
+static PyObject *
+pysqlite_connection_create_function_impl(pysqlite_Connection *self,
+                                         const char *name, int narg,
+                                         PyObject *func, int deterministic)
+/*[clinic end generated code: output=07d1877dd98c0308 input=17e16b285ee44819]*/
+{
     int rc;
-    int deterministic = 0;
     int flags = SQLITE_UTF8;
 
     if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
         return NULL;
     }
 
-    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "siO|$p", kwlist,
-                                     &name, &narg, &func, &deterministic))
-    {
-        return NULL;
-    }
-
     if (deterministic) {
 #if SQLITE_VERSION_NUMBER < 3008003
         PyErr_SetString(pysqlite_NotSupportedError,
@@ -842,12 +920,11 @@
         flags |= SQLITE_DETERMINISTIC;
 #endif
     }
-    Py_INCREF(func);
     rc = sqlite3_create_function_v2(self->db,
                                     name,
                                     narg,
                                     flags,
-                                    (void*)func,
+                                    (void*)Py_NewRef(func),
                                     _pysqlite_func_callback,
                                     NULL,
                                     NULL,
@@ -861,29 +938,33 @@
     Py_RETURN_NONE;
 }
 
-PyObject* pysqlite_connection_create_aggregate(pysqlite_Connection* self, PyObject* args, PyObject* kwargs)
-{
-    PyObject* aggregate_class;
+/*[clinic input]
+_sqlite3.Connection.create_aggregate as pysqlite_connection_create_aggregate
 
-    int n_arg;
-    char* name;
-    static char *kwlist[] = { "name", "n_arg", "aggregate_class", NULL };
+    name: str
+    n_arg: int
+    aggregate_class: object
+
+Creates a new aggregate.
+[clinic start generated code]*/
+
+static PyObject *
+pysqlite_connection_create_aggregate_impl(pysqlite_Connection *self,
+                                          const char *name, int n_arg,
+                                          PyObject *aggregate_class)
+/*[clinic end generated code: output=fbb2f858cfa4d8db input=a17afd1fcc930ecf]*/
+{
     int rc;
 
     if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
         return NULL;
     }
 
-    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "siO:create_aggregate",
-                                      kwlist, &name, &n_arg, &aggregate_class)) {
-        return NULL;
-    }
-    Py_INCREF(aggregate_class);
     rc = sqlite3_create_function_v2(self->db,
                                     name,
                                     n_arg,
                                     SQLITE_UTF8,
-                                    (void*)aggregate_class,
+                                    (void*)Py_NewRef(aggregate_class),
                                     0,
                                     &_pysqlite_step_callback,
                                     &_pysqlite_final_callback,
@@ -962,13 +1043,29 @@
     return rc;
 }
 
+#ifdef HAVE_TRACE_V2
+/*
+ * From https://sqlite.org/c3ref/trace_v2.html:
+ * The integer return value from the callback is currently ignored, though this
+ * may change in future releases. Callback implementations should return zero
+ * to ensure future compatibility.
+ */
+static int _trace_callback(unsigned int type, void* user_arg, void* prepared_statement, void* statement_string)
+#else
 static void _trace_callback(void* user_arg, const char* statement_string)
+#endif
 {
     PyObject *py_statement = NULL;
     PyObject *ret = NULL;
 
     PyGILState_STATE gilstate;
 
+#ifdef HAVE_TRACE_V2
+    if (type != SQLITE_TRACE_STMT) {
+        return 0;
+    }
+#endif
+
     gilstate = PyGILState_Ensure();
     py_statement = PyUnicode_DecodeUTF8(statement_string,
             strlen(statement_string), "replace");
@@ -988,24 +1085,30 @@
     }
 
     PyGILState_Release(gilstate);
+#ifdef HAVE_TRACE_V2
+    return 0;
+#endif
 }
 
-static PyObject* pysqlite_connection_set_authorizer(pysqlite_Connection* self, PyObject* args, PyObject* kwargs)
-{
-    PyObject* authorizer_cb;
+/*[clinic input]
+_sqlite3.Connection.set_authorizer as pysqlite_connection_set_authorizer
 
-    static char *kwlist[] = { "authorizer_callback", NULL };
+    authorizer_callback as authorizer_cb: object
+
+Sets authorizer callback.
+[clinic start generated code]*/
+
+static PyObject *
+pysqlite_connection_set_authorizer_impl(pysqlite_Connection *self,
+                                        PyObject *authorizer_cb)
+/*[clinic end generated code: output=f18ba575d788b35c input=446676a87c949d68]*/
+{
     int rc;
 
     if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
         return NULL;
     }
 
-    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:set_authorizer",
-                                      kwlist, &authorizer_cb)) {
-        return NULL;
-    }
-
     rc = sqlite3_set_authorizer(self->db, _authorizer_callback, (void*)authorizer_cb);
     if (rc != SQLITE_OK) {
         PyErr_SetString(pysqlite_OperationalError, "Error setting authorizer callback");
@@ -1018,22 +1121,25 @@
     Py_RETURN_NONE;
 }
 
-static PyObject* pysqlite_connection_set_progress_handler(pysqlite_Connection* self, PyObject* args, PyObject* kwargs)
+/*[clinic input]
+_sqlite3.Connection.set_progress_handler as pysqlite_connection_set_progress_handler
+
+    progress_handler: object
+    n: int
+
+Sets progress handler callback.
+[clinic start generated code]*/
+
+static PyObject *
+pysqlite_connection_set_progress_handler_impl(pysqlite_Connection *self,
+                                              PyObject *progress_handler,
+                                              int n)
+/*[clinic end generated code: output=35a7c10364cb1b04 input=d9379b629c7391c7]*/
 {
-    PyObject* progress_handler;
-    int n;
-
-    static char *kwlist[] = { "progress_handler", "n", NULL };
-
     if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
         return NULL;
     }
 
-    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Oi:set_progress_handler",
-                                      kwlist, &progress_handler, &n)) {
-        return NULL;
-    }
-
     if (progress_handler == Py_None) {
         /* None clears the progress handler previously set */
         sqlite3_progress_handler(self->db, 0, 0, (void*)0);
@@ -1046,27 +1152,43 @@
     Py_RETURN_NONE;
 }
 
-static PyObject* pysqlite_connection_set_trace_callback(pysqlite_Connection* self, PyObject* args, PyObject* kwargs)
+/*[clinic input]
+_sqlite3.Connection.set_trace_callback as pysqlite_connection_set_trace_callback
+
+    trace_callback: object
+
+Sets a trace callback called for each SQL statement (passed as unicode).
+[clinic start generated code]*/
+
+static PyObject *
+pysqlite_connection_set_trace_callback_impl(pysqlite_Connection *self,
+                                            PyObject *trace_callback)
+/*[clinic end generated code: output=fb0e307b9924d454 input=885e460ebbf79f0c]*/
 {
-    PyObject* trace_callback;
-
-    static char *kwlist[] = { "trace_callback", NULL };
-
     if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
         return NULL;
     }
 
-    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:set_trace_callback",
-                                      kwlist, &trace_callback)) {
-        return NULL;
-    }
-
     if (trace_callback == Py_None) {
-        /* None clears the trace callback previously set */
+        /*
+         * None clears the trace callback previously set
+         *
+         * Ref.
+         * - https://sqlite.org/c3ref/c_trace.html
+         * - https://sqlite.org/c3ref/trace_v2.html
+         */
+#ifdef HAVE_TRACE_V2
+        sqlite3_trace_v2(self->db, SQLITE_TRACE_STMT, 0, 0);
+#else
         sqlite3_trace(self->db, 0, (void*)0);
+#endif
         Py_XSETREF(self->function_pinboard_trace_callback, NULL);
     } else {
+#ifdef HAVE_TRACE_V2
+        sqlite3_trace_v2(self->db, SQLITE_TRACE_STMT, _trace_callback, trace_callback);
+#else
         sqlite3_trace(self->db, _trace_callback, trace_callback);
+#endif
         Py_INCREF(trace_callback);
         Py_XSETREF(self->function_pinboard_trace_callback, trace_callback);
     }
@@ -1074,17 +1196,29 @@
     Py_RETURN_NONE;
 }
 
-#ifdef HAVE_LOAD_EXTENSION
-static PyObject* pysqlite_enable_load_extension(pysqlite_Connection* self, PyObject* args)
+#ifndef SQLITE_OMIT_LOAD_EXTENSION
+/*[clinic input]
+_sqlite3.Connection.enable_load_extension as pysqlite_connection_enable_load_extension
+
+    enable as onoff: bool(accept={int})
+    /
+
+Enable dynamic loading of SQLite extension modules.
+[clinic start generated code]*/
+
+static PyObject *
+pysqlite_connection_enable_load_extension_impl(pysqlite_Connection *self,
+                                               int onoff)
+/*[clinic end generated code: output=9cac37190d388baf input=5f00e93f7a9d3540]*/
 {
     int rc;
-    int onoff;
 
-    if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
+    if (PySys_Audit("sqlite3.enable_load_extension",
+                    "OO", self, onoff ? Py_True : Py_False) < 0) {
         return NULL;
     }
 
-    if (!PyArg_ParseTuple(args, "i", &onoff)) {
+    if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
         return NULL;
     }
 
@@ -1098,17 +1232,28 @@
     }
 }
 
-static PyObject* pysqlite_load_extension(pysqlite_Connection* self, PyObject* args)
+/*[clinic input]
+_sqlite3.Connection.load_extension as pysqlite_connection_load_extension
+
+    name as extension_name: str
+    /
+
+Load SQLite extension module.
+[clinic start generated code]*/
+
+static PyObject *
+pysqlite_connection_load_extension_impl(pysqlite_Connection *self,
+                                        const char *extension_name)
+/*[clinic end generated code: output=47eb1d7312bc97a7 input=edd507389d89d621]*/
 {
     int rc;
-    char* extension_name;
     char* errmsg;
 
-    if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
+    if (PySys_Audit("sqlite3.load_extension", "Os", self, extension_name) < 0) {
         return NULL;
     }
 
-    if (!PyArg_ParseTuple(args, "s", &extension_name)) {
+    if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
         return NULL;
     }
 
@@ -1139,8 +1284,10 @@
 
 static PyObject* pysqlite_connection_get_isolation_level(pysqlite_Connection* self, void* unused)
 {
-    Py_INCREF(self->isolation_level);
-    return self->isolation_level;
+    if (!pysqlite_check_connection(self)) {
+        return NULL;
+    }
+    return Py_NewRef(self->isolation_level);
 }
 
 static PyObject* pysqlite_connection_get_total_changes(pysqlite_Connection* self, void* unused)
@@ -1171,11 +1318,17 @@
         return -1;
     }
     if (isolation_level == Py_None) {
-        PyObject *res = pysqlite_connection_commit(self, NULL);
-        if (!res) {
-            return -1;
+        /* We might get called during connection init, so we cannot use
+         * pysqlite_connection_commit() here. */
+        if (self->db && !sqlite3_get_autocommit(self->db)) {
+            int rc;
+            Py_BEGIN_ALLOW_THREADS
+            rc = sqlite3_exec(self->db, "COMMIT", NULL, NULL, NULL);
+            Py_END_ALLOW_THREADS
+            if (rc != SQLITE_OK) {
+                return _pysqlite_seterror(self->db, NULL);
+            }
         }
-        Py_DECREF(res);
 
         self->begin_statement = NULL;
     } else {
@@ -1214,12 +1367,13 @@
     return 0;
 }
 
-PyObject* pysqlite_connection_call(pysqlite_Connection* self, PyObject* args, PyObject* kwargs)
+static PyObject *
+pysqlite_connection_call(pysqlite_Connection *self, PyObject *args,
+                         PyObject *kwargs)
 {
     PyObject* sql;
     pysqlite_Statement* statement;
     PyObject* weakref;
-    int rc;
 
     if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
         return NULL;
@@ -1233,31 +1387,11 @@
 
     _pysqlite_drop_unused_statement_references(self);
 
-    statement = PyObject_New(pysqlite_Statement, &pysqlite_StatementType);
-    if (!statement) {
+    statement = pysqlite_statement_create(self, sql);
+    if (statement == NULL) {
         return NULL;
     }
 
-    statement->db = NULL;
-    statement->st = NULL;
-    statement->sql = NULL;
-    statement->in_use = 0;
-    statement->in_weakreflist = NULL;
-
-    rc = pysqlite_statement_create(statement, self, sql);
-    if (rc != SQLITE_OK) {
-        if (rc == PYSQLITE_TOO_MUCH_SQL) {
-            PyErr_SetString(pysqlite_Warning, "You can only execute one statement at a time.");
-        } else if (rc == PYSQLITE_SQL_WRONG_TYPE) {
-            if (PyErr_ExceptionMatches(PyExc_TypeError))
-                PyErr_SetString(pysqlite_Warning, "SQL is of wrong type. Must be string.");
-        } else {
-            (void)pysqlite_statement_reset(statement);
-            _pysqlite_seterror(self->db, NULL);
-        }
-        goto error;
-    }
-
     weakref = PyWeakref_NewRef((PyObject*)statement, NULL);
     if (weakref == NULL)
         goto error;
@@ -1274,89 +1408,108 @@
     return NULL;
 }
 
-PyObject* pysqlite_connection_execute(pysqlite_Connection* self, PyObject* args)
+/*[clinic input]
+_sqlite3.Connection.execute as pysqlite_connection_execute
+
+    sql: unicode
+    parameters: object = NULL
+    /
+
+Executes an SQL statement.
+[clinic start generated code]*/
+
+static PyObject *
+pysqlite_connection_execute_impl(pysqlite_Connection *self, PyObject *sql,
+                                 PyObject *parameters)
+/*[clinic end generated code: output=5be05ae01ee17ee4 input=27aa7792681ddba2]*/
 {
+    _Py_IDENTIFIER(execute);
     PyObject* cursor = 0;
     PyObject* result = 0;
-    PyObject* method = 0;
 
     cursor = _PyObject_CallMethodIdNoArgs((PyObject*)self, &PyId_cursor);
     if (!cursor) {
         goto error;
     }
 
-    method = PyObject_GetAttrString(cursor, "execute");
-    if (!method) {
-        Py_CLEAR(cursor);
-        goto error;
-    }
-
-    result = PyObject_CallObject(method, args);
+    result = _PyObject_CallMethodIdObjArgs(cursor, &PyId_execute, sql, parameters, NULL);
     if (!result) {
         Py_CLEAR(cursor);
     }
 
 error:
     Py_XDECREF(result);
-    Py_XDECREF(method);
 
     return cursor;
 }
 
-PyObject* pysqlite_connection_executemany(pysqlite_Connection* self, PyObject* args)
+/*[clinic input]
+_sqlite3.Connection.executemany as pysqlite_connection_executemany
+
+    sql: unicode
+    parameters: object
+    /
+
+Repeatedly executes an SQL statement.
+[clinic start generated code]*/
+
+static PyObject *
+pysqlite_connection_executemany_impl(pysqlite_Connection *self,
+                                     PyObject *sql, PyObject *parameters)
+/*[clinic end generated code: output=776cd2fd20bfe71f input=495be76551d525db]*/
 {
+    _Py_IDENTIFIER(executemany);
     PyObject* cursor = 0;
     PyObject* result = 0;
-    PyObject* method = 0;
 
     cursor = _PyObject_CallMethodIdNoArgs((PyObject*)self, &PyId_cursor);
     if (!cursor) {
         goto error;
     }
 
-    method = PyObject_GetAttrString(cursor, "executemany");
-    if (!method) {
-        Py_CLEAR(cursor);
-        goto error;
-    }
-
-    result = PyObject_CallObject(method, args);
+    result = _PyObject_CallMethodIdObjArgs(cursor, &PyId_executemany, sql,
+                                           parameters, NULL);
     if (!result) {
         Py_CLEAR(cursor);
     }
 
 error:
     Py_XDECREF(result);
-    Py_XDECREF(method);
 
     return cursor;
 }
 
-PyObject* pysqlite_connection_executescript(pysqlite_Connection* self, PyObject* args)
+/*[clinic input]
+_sqlite3.Connection.executescript as pysqlite_connection_executescript
+
+    sql_script as script_obj: object
+    /
+
+Executes multiple SQL statements at once.
+[clinic start generated code]*/
+
+static PyObject *
+pysqlite_connection_executescript(pysqlite_Connection *self,
+                                  PyObject *script_obj)
+/*[clinic end generated code: output=4c4f9d77aa0ae37d input=f6e5f1ccfa313db4]*/
 {
+    _Py_IDENTIFIER(executescript);
     PyObject* cursor = 0;
     PyObject* result = 0;
-    PyObject* method = 0;
 
     cursor = _PyObject_CallMethodIdNoArgs((PyObject*)self, &PyId_cursor);
     if (!cursor) {
         goto error;
     }
 
-    method = PyObject_GetAttrString(cursor, "executescript");
-    if (!method) {
-        Py_CLEAR(cursor);
-        goto error;
-    }
-
-    result = PyObject_CallObject(method, args);
+    result = _PyObject_CallMethodIdObjArgs(cursor, &PyId_executescript,
+                                           script_obj, NULL);
     if (!result) {
         Py_CLEAR(cursor);
     }
 
 error:
     Py_XDECREF(result);
-    Py_XDECREF(method);
 
     return cursor;
 }
@@ -1416,8 +1569,15 @@
     return result;
 }
 
+/*[clinic input]
+_sqlite3.Connection.interrupt as pysqlite_connection_interrupt
+
+Abort any pending database operation.
+[clinic start generated code]*/
+
 static PyObject *
-pysqlite_connection_interrupt(pysqlite_Connection* self, PyObject* args)
+pysqlite_connection_interrupt_impl(pysqlite_Connection *self)
+/*[clinic end generated code: output=f193204bc9e70b47 input=75ad03ade7012859]*/
 {
     PyObject* retval = NULL;
 
@@ -1427,8 +1587,7 @@
 
     sqlite3_interrupt(self->db);
 
-    Py_INCREF(Py_None);
-    retval = Py_None;
+    retval = Py_NewRef(Py_None);
 
 finally:
     return retval;
@@ -1438,8 +1597,15 @@
  * Class method of Connection to call the Python function _iterdump
  * of the sqlite3 module.
  */
+/*[clinic input]
+_sqlite3.Connection.iterdump as pysqlite_connection_iterdump
+
+Returns iterator to the dump of the database in an SQL text format.
+[clinic start generated code]*/
+
 static PyObject *
-pysqlite_connection_iterdump(pysqlite_Connection* self, PyObject* args)
+pysqlite_connection_iterdump_impl(pysqlite_Connection *self)
+/*[clinic end generated code: output=586997aaf9808768 input=1911ca756066da89]*/
 {
     _Py_IDENTIFIER(_iterdump);
     PyObject* retval = NULL;
@@ -1477,52 +1643,40 @@
     return retval;
 }
 
-#ifdef HAVE_BACKUP_API
+/*[clinic input]
+_sqlite3.Connection.backup as pysqlite_connection_backup
+
+    target: object(type='pysqlite_Connection *', subclass_of='pysqlite_ConnectionType')
+    *
+    pages: int = -1
+    progress: object = None
+    name: str = "main"
+    sleep: double = 0.250
+
+Makes a backup of the database.
+[clinic start generated code]*/
+
 static PyObject *
-pysqlite_connection_backup(pysqlite_Connection *self, PyObject *args, PyObject *kwds)
+pysqlite_connection_backup_impl(pysqlite_Connection *self,
+                                pysqlite_Connection *target, int pages,
+                                PyObject *progress, const char *name,
+                                double sleep)
+/*[clinic end generated code: output=306a3e6a38c36334 input=458a0b6997c4960b]*/
 {
-    PyObject *target = NULL;
-    int pages = -1;
-    PyObject *progress = Py_None;
-    const char *name = "main";
     int rc;
-    int callback_error = 0;
-    PyObject *sleep_obj = NULL;
-    int sleep_ms = 250;
+    int sleep_ms = (int)(sleep * 1000.0);
     sqlite3 *bck_conn;
     sqlite3_backup *bck_handle;
-    static char *keywords[] = {"target", "pages", "progress", "name", "sleep", NULL};
-
-    if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!|$iOsO:backup", keywords,
-                                     &pysqlite_ConnectionType, &target,
-                                     &pages, &progress, &name, &sleep_obj)) {
-        return NULL;
-    }
-
-    if (sleep_obj != NULL) {
-        _PyTime_t sleep_secs;
-        if (_PyTime_FromSecondsObject(&sleep_secs, sleep_obj,
-                                      _PyTime_ROUND_TIMEOUT)) {
-            return NULL;
-        }
-        _PyTime_t ms = _PyTime_AsMilliseconds(sleep_secs,
-                                              _PyTime_ROUND_TIMEOUT);
-        if (ms < INT_MIN || ms > INT_MAX) {
-            PyErr_SetString(PyExc_OverflowError, "sleep is too large");
-            return NULL;
-        }
-        sleep_ms = (int)ms;
-    }
 
     if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
         return NULL;
     }
 
-    if (!pysqlite_check_connection((pysqlite_Connection *)target)) {
+    if (!pysqlite_check_connection(target)) {
         return NULL;
     }
 
-    if ((pysqlite_Connection *)target == self) {
+    if (target == self) {
         PyErr_SetString(PyExc_ValueError, "target cannot be the same connection instance");
         return NULL;
     }
@@ -1530,7 +1684,7 @@
 #if SQLITE_VERSION_NUMBER < 3008008
     /* Since 3.8.8 this is already done, per commit
        https://www.sqlite.org/src/info/169b5505498c0a7e */
-    if (!sqlite3_get_autocommit(((pysqlite_Connection *)target)->db)) {
+    if (!sqlite3_get_autocommit(target->db)) {
         PyErr_SetString(pysqlite_OperationalError, "target is in transaction");
         return NULL;
     }
@@ -1545,102 +1699,74 @@
         pages = -1;
     }
 
-    bck_conn = ((pysqlite_Connection *)target)->db;
+    bck_conn = target->db;
 
     Py_BEGIN_ALLOW_THREADS
     bck_handle = sqlite3_backup_init(bck_conn, "main", self->db, name);
     Py_END_ALLOW_THREADS
 
-    if (bck_handle) {
-        do {
-            Py_BEGIN_ALLOW_THREADS
-            rc = sqlite3_backup_step(bck_handle, pages);
-            Py_END_ALLOW_THREADS
-
-            if (progress != Py_None) {
-                PyObject *res;
-
-                res = PyObject_CallFunction(progress, "iii", rc,
-                                            sqlite3_backup_remaining(bck_handle),
-                                            sqlite3_backup_pagecount(bck_handle));
-                if (res == NULL) {
-                    /* User's callback raised an error: interrupt the loop and
-                       propagate it. */
-                    callback_error = 1;
-                    rc = -1;
-                } else {
-                    Py_DECREF(res);
-                }
-            }
-
-            /* Sleep for a while if there are still further pages to copy and
-               the engine could not make any progress */
-            if (rc == SQLITE_BUSY || rc == SQLITE_LOCKED) {
-                Py_BEGIN_ALLOW_THREADS
-                sqlite3_sleep(sleep_ms);
-                Py_END_ALLOW_THREADS
-            }
-        } while (rc == SQLITE_OK || rc == SQLITE_BUSY || rc == SQLITE_LOCKED);
-
-        Py_BEGIN_ALLOW_THREADS
-        rc = sqlite3_backup_finish(bck_handle);
-        Py_END_ALLOW_THREADS
-    } else {
-        rc = _pysqlite_seterror(bck_conn, NULL);
-    }
-
-    if (!callback_error && rc != SQLITE_OK) {
-        /* We cannot use _pysqlite_seterror() here because the backup APIs do
-           not set the error status on the connection object, but rather on
-           the backup handle. */
-        if (rc == SQLITE_NOMEM) {
-            (void)PyErr_NoMemory();
-        } else {
-#if SQLITE_VERSION_NUMBER > 3007015
-            PyErr_SetString(pysqlite_OperationalError, sqlite3_errstr(rc));
-#else
-            switch (rc) {
-                case SQLITE_ERROR:
-                    /* Description of SQLITE_ERROR in SQLite 3.7.14 and older
-                       releases. */
-                    PyErr_SetString(pysqlite_OperationalError,
-                                    "SQL logic error or missing database");
-                    break;
-                case SQLITE_READONLY:
-                    PyErr_SetString(pysqlite_OperationalError,
-                                    "attempt to write a readonly database");
-                    break;
-                case SQLITE_BUSY:
-                    PyErr_SetString(pysqlite_OperationalError, "database is locked");
-                    break;
-                case SQLITE_LOCKED:
-                    PyErr_SetString(pysqlite_OperationalError,
-                                    "database table is locked");
-                    break;
-                default:
-                    PyErr_Format(pysqlite_OperationalError,
-                                 "unrecognized error code: %d", rc);
-                    break;
-            }
-#endif
-        }
-    }
-
-    if (!callback_error && rc == SQLITE_OK) {
-        Py_RETURN_NONE;
-    } else {
+    if (bck_handle == NULL) {
+        _pysqlite_seterror(bck_conn, NULL);
         return NULL;
     }
+
+    do {
+        Py_BEGIN_ALLOW_THREADS
+        rc = sqlite3_backup_step(bck_handle, pages);
+        Py_END_ALLOW_THREADS
+
+        if (progress != Py_None) {
+            int remaining = sqlite3_backup_remaining(bck_handle);
+            int pagecount = sqlite3_backup_pagecount(bck_handle);
+            PyObject *res = PyObject_CallFunction(progress, "iii", rc,
+                                                  remaining, pagecount);
+            if (res == NULL) {
+                /* Callback failed: abort backup and bail. */
+                Py_BEGIN_ALLOW_THREADS
+                sqlite3_backup_finish(bck_handle);
+                Py_END_ALLOW_THREADS
+                return NULL;
+            }
+            Py_DECREF(res);
+        }
+
+        /* Sleep for a while if there are still further pages to copy and
+           the engine could not make any progress */
+        if (rc == SQLITE_BUSY || rc == SQLITE_LOCKED) {
+            Py_BEGIN_ALLOW_THREADS
+            sqlite3_sleep(sleep_ms);
+            Py_END_ALLOW_THREADS
+        }
+    } while (rc == SQLITE_OK || rc == SQLITE_BUSY || rc == SQLITE_LOCKED);
+
+    Py_BEGIN_ALLOW_THREADS
+    rc = sqlite3_backup_finish(bck_handle);
+    Py_END_ALLOW_THREADS
+
+    if (rc != SQLITE_OK) {
+        _pysqlite_seterror(bck_conn, NULL);
+        return NULL;
+    }
+
+    Py_RETURN_NONE;
 }
-#endif
+
+/*[clinic input]
+_sqlite3.Connection.create_collation as pysqlite_connection_create_collation
+
+    name: unicode
+    callback as callable: object
+    /
+
+Creates a collation function.
+[clinic start generated code]*/
 
 static PyObject *
-pysqlite_connection_create_collation(pysqlite_Connection* self, PyObject* args)
+pysqlite_connection_create_collation_impl(pysqlite_Connection *self,
+                                          PyObject *name, PyObject *callable)
+/*[clinic end generated code: output=0f63b8995565ae22 input=eb2c4328dc493ee8]*/
 {
-    PyObject* callable;
     PyObject* uppercase_name = 0;
-    PyObject* name;
-    PyObject* retval;
     Py_ssize_t i, len;
     _Py_IDENTIFIER(upper);
     const char *uppercase_name_str;
@@ -1652,11 +1778,6 @@
         goto finally;
     }
 
-    if (!PyArg_ParseTuple(args, "UO:create_collation(name, callback)",
-                          &name, &callable)) {
-        goto finally;
-    }
-
     uppercase_name = _PyObject_CallMethodIdOneArg((PyObject *)&PyUnicode_Type,
                                                   &PyId_upper, name);
     if (!uppercase_name) {
@@ -1704,7 +1825,11 @@
                                   (callable != Py_None) ? callable : NULL,
                                   (callable != Py_None) ? pysqlite_collation_callback : NULL);
     if (rc != SQLITE_OK) {
-        PyDict_DelItem(self->collations, uppercase_name);
+        if (callable != Py_None) {
+            if (PyDict_DelItem(self->collations, uppercase_name) < 0) {
+                PyErr_Clear();
+            }
+        }
         _pysqlite_seterror(self->db, NULL);
         goto finally;
     }
@@ -1713,45 +1838,70 @@
     Py_XDECREF(uppercase_name);
 
     if (PyErr_Occurred()) {
-        retval = NULL;
-    } else {
-        Py_INCREF(Py_None);
-        retval = Py_None;
-    }
-
-    return retval;
-}
-
-/* Called when the connection is used as a context manager. Returns itself as a
- * convenience to the caller. */
-static PyObject *
-pysqlite_connection_enter(pysqlite_Connection* self, PyObject* args)
-{
-    Py_INCREF(self);
-    return (PyObject*)self;
-}
-
-/** Called when the connection is used as a context manager. If there was any
- * exception, a rollback takes place; otherwise we commit. */
-static PyObject *
-pysqlite_connection_exit(pysqlite_Connection* self, PyObject* args)
-{
-    PyObject* exc_type, *exc_value, *exc_tb;
-    const char* method_name;
-    PyObject* result;
-
-    if (!PyArg_ParseTuple(args, "OOO", &exc_type, &exc_value, &exc_tb)) {
         return NULL;
     }
+    return Py_NewRef(Py_None);
+}
+
+/*[clinic input]
+_sqlite3.Connection.__enter__ as pysqlite_connection_enter
+
+Called when the connection is used as a context manager.
+
+Returns itself as a convenience to the caller.
+[clinic start generated code]*/
+
+static PyObject *
+pysqlite_connection_enter_impl(pysqlite_Connection *self)
+/*[clinic end generated code: output=457b09726d3e9dcd input=127d7a4f17e86d8f]*/
+{
+    return Py_NewRef((PyObject *)self);
+}
+
+/*[clinic input]
+_sqlite3.Connection.__exit__ as pysqlite_connection_exit
+
+    type as exc_type: object
+    value as exc_value: object
+    traceback as exc_tb: object
+    /
+
+Called when the connection is used as a context manager.
+
+If there was any exception, a rollback takes place; otherwise we commit.
+[clinic start generated code]*/
+
+static PyObject *
+pysqlite_connection_exit_impl(pysqlite_Connection *self, PyObject *exc_type,
+                              PyObject *exc_value, PyObject *exc_tb)
+/*[clinic end generated code: output=0705200e9321202a input=bd66f1532c9c54a7]*/
+{
+    int commit = 0;
+    PyObject* result;
 
     if (exc_type == Py_None && exc_value == Py_None && exc_tb == Py_None) {
-        method_name = "commit";
-    } else {
-        method_name = "rollback";
+        commit = 1;
+        result = pysqlite_connection_commit_impl(self);
+    }
+    else {
+        result = pysqlite_connection_rollback_impl(self);
     }
 
-    result = PyObject_CallMethod((PyObject*)self, method_name, NULL);
-    if (!result) {
+    if (result == NULL) {
+        if (commit) {
+            /* Commit failed; try to rollback in order to unlock the database.
+             * If rollback also fails, chain the exceptions. */
+            PyObject *exc, *val, *tb;
+            PyErr_Fetch(&exc, &val, &tb);
+            result = pysqlite_connection_rollback_impl(self);
+            if (result == NULL) {
+                _PyErr_ChainExceptions(exc, val, tb);
+            }
+            else {
+                Py_DECREF(result);
+                PyErr_Restore(exc, val, tb);
+            }
+        }
         return NULL;
     }
     Py_DECREF(result);
@@ -1770,50 +1920,26 @@
 };
 
 static PyMethodDef connection_methods[] = {
-    {"cursor", (PyCFunction)(void(*)(void))pysqlite_connection_cursor, METH_VARARGS|METH_KEYWORDS,
-        PyDoc_STR("Return a cursor for the connection.")},
-    {"close", (PyCFunction)pysqlite_connection_close, METH_NOARGS,
-        PyDoc_STR("Closes the connection.")},
-    {"commit", (PyCFunction)pysqlite_connection_commit, METH_NOARGS,
-        PyDoc_STR("Commit the current transaction.")},
-    {"rollback", (PyCFunction)pysqlite_connection_rollback, METH_NOARGS,
-        PyDoc_STR("Roll back the current transaction.")},
-    {"create_function", (PyCFunction)(void(*)(void))pysqlite_connection_create_function, METH_VARARGS|METH_KEYWORDS,
-        PyDoc_STR("Creates a new function. Non-standard.")},
-    {"create_aggregate", (PyCFunction)(void(*)(void))pysqlite_connection_create_aggregate, METH_VARARGS|METH_KEYWORDS,
-        PyDoc_STR("Creates a new aggregate. Non-standard.")},
-    {"set_authorizer", (PyCFunction)(void(*)(void))pysqlite_connection_set_authorizer, METH_VARARGS|METH_KEYWORDS,
-        PyDoc_STR("Sets authorizer callback. Non-standard.")},
-    #ifdef HAVE_LOAD_EXTENSION
-    {"enable_load_extension", (PyCFunction)pysqlite_enable_load_extension, METH_VARARGS,
-        PyDoc_STR("Enable dynamic loading of SQLite extension modules. Non-standard.")},
-    {"load_extension", (PyCFunction)pysqlite_load_extension, METH_VARARGS,
-        PyDoc_STR("Load SQLite extension module. Non-standard.")},
-    #endif
-    {"set_progress_handler", (PyCFunction)(void(*)(void))pysqlite_connection_set_progress_handler, METH_VARARGS|METH_KEYWORDS,
-        PyDoc_STR("Sets progress handler callback. Non-standard.")},
-    {"set_trace_callback", (PyCFunction)(void(*)(void))pysqlite_connection_set_trace_callback, METH_VARARGS|METH_KEYWORDS,
-        PyDoc_STR("Sets a trace callback called for each SQL statement (passed as unicode). Non-standard.")},
-    {"execute", (PyCFunction)pysqlite_connection_execute, METH_VARARGS,
-        PyDoc_STR("Executes a SQL statement. Non-standard.")},
-    {"executemany", (PyCFunction)pysqlite_connection_executemany, METH_VARARGS,
-        PyDoc_STR("Repeatedly executes a SQL statement. Non-standard.")},
-    {"executescript", (PyCFunction)pysqlite_connection_executescript, METH_VARARGS,
-        PyDoc_STR("Executes a multiple SQL statements at once. Non-standard.")},
-    {"create_collation", (PyCFunction)pysqlite_connection_create_collation, METH_VARARGS,
-        PyDoc_STR("Creates a collation function. Non-standard.")},
-    {"interrupt", (PyCFunction)pysqlite_connection_interrupt, METH_NOARGS,
-        PyDoc_STR("Abort any pending database operation. Non-standard.")},
-    {"iterdump", (PyCFunction)pysqlite_connection_iterdump, METH_NOARGS,
-        PyDoc_STR("Returns iterator to the dump of the database in an SQL text format. Non-standard.")},
-    #ifdef HAVE_BACKUP_API
-    {"backup", (PyCFunction)(void(*)(void))pysqlite_connection_backup, METH_VARARGS | METH_KEYWORDS,
-        PyDoc_STR("Makes a backup of the database. Non-standard.")},
-    #endif
-    {"__enter__", (PyCFunction)pysqlite_connection_enter, METH_NOARGS,
-        PyDoc_STR("For context manager. Non-standard.")},
-    {"__exit__", (PyCFunction)pysqlite_connection_exit, METH_VARARGS,
-        PyDoc_STR("For context manager. Non-standard.")},
+    PYSQLITE_CONNECTION_BACKUP_METHODDEF
+    PYSQLITE_CONNECTION_CLOSE_METHODDEF
+    PYSQLITE_CONNECTION_COMMIT_METHODDEF
+    PYSQLITE_CONNECTION_CREATE_AGGREGATE_METHODDEF
+    PYSQLITE_CONNECTION_CREATE_COLLATION_METHODDEF
+    PYSQLITE_CONNECTION_CREATE_FUNCTION_METHODDEF
+    PYSQLITE_CONNECTION_CURSOR_METHODDEF
+    PYSQLITE_CONNECTION_ENABLE_LOAD_EXTENSION_METHODDEF
+    PYSQLITE_CONNECTION_ENTER_METHODDEF
+    PYSQLITE_CONNECTION_EXECUTEMANY_METHODDEF
+    PYSQLITE_CONNECTION_EXECUTESCRIPT_METHODDEF
+    PYSQLITE_CONNECTION_EXECUTE_METHODDEF
+    PYSQLITE_CONNECTION_EXIT_METHODDEF
+    PYSQLITE_CONNECTION_INTERRUPT_METHODDEF
+    PYSQLITE_CONNECTION_ITERDUMP_METHODDEF
+    PYSQLITE_CONNECTION_LOAD_EXTENSION_METHODDEF
+    PYSQLITE_CONNECTION_ROLLBACK_METHODDEF
+    PYSQLITE_CONNECTION_SET_AUTHORIZER_METHODDEF
+    PYSQLITE_CONNECTION_SET_PROGRESS_HANDLER_METHODDEF
+    PYSQLITE_CONNECTION_SET_TRACE_CALLBACK_METHODDEF
     {NULL, NULL}
 };
 
@@ -1834,50 +1960,35 @@
     {NULL}
 };
 
-PyTypeObject pysqlite_ConnectionType = {
-        PyVarObject_HEAD_INIT(NULL, 0)
-        MODULE_NAME ".Connection",                      /* tp_name */
-        sizeof(pysqlite_Connection),                    /* tp_basicsize */
-        0,                                              /* tp_itemsize */
-        (destructor)pysqlite_connection_dealloc,        /* tp_dealloc */
-        0,                                              /* tp_vectorcall_offset */
-        0,                                              /* tp_getattr */
-        0,                                              /* tp_setattr */
-        0,                                              /* tp_as_async */
-        0,                                              /* tp_repr */
-        0,                                              /* tp_as_number */
-        0,                                              /* tp_as_sequence */
-        0,                                              /* tp_as_mapping */
-        0,                                              /* tp_hash */
-        (ternaryfunc)pysqlite_connection_call,          /* tp_call */
-        0,                                              /* tp_str */
-        0,                                              /* tp_getattro */
-        0,                                              /* tp_setattro */
-        0,                                              /* tp_as_buffer */
-        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,         /* tp_flags */
-        connection_doc,                                 /* tp_doc */
-        0,                                              /* tp_traverse */
-        0,                                              /* tp_clear */
-        0,                                              /* tp_richcompare */
-        0,                                              /* tp_weaklistoffset */
-        0,                                              /* tp_iter */
-        0,                                              /* tp_iternext */
-        connection_methods,                             /* tp_methods */
-        connection_members,                             /* tp_members */
-        connection_getset,                              /* tp_getset */
-        0,                                              /* tp_base */
-        0,                                              /* tp_dict */
-        0,                                              /* tp_descr_get */
-        0,                                              /* tp_descr_set */
-        0,                                              /* tp_dictoffset */
-        (initproc)pysqlite_connection_init,             /* tp_init */
-        0,                                              /* tp_alloc */
-        0,                                              /* tp_new */
-        0                                               /* tp_free */
+static PyType_Slot connection_slots[] = {
+    {Py_tp_dealloc, connection_dealloc},
+    {Py_tp_doc, (void *)connection_doc},
+    {Py_tp_methods, connection_methods},
+    {Py_tp_members, connection_members},
+    {Py_tp_getset, connection_getset},
+    {Py_tp_init, pysqlite_connection_init},
+    {Py_tp_call, pysqlite_connection_call},
+    {Py_tp_traverse, connection_traverse},
+    {Py_tp_clear, connection_clear},
+    {0, NULL},
 };
 
-extern int pysqlite_connection_setup_types(void)
+static PyType_Spec connection_spec = {
+    .name = MODULE_NAME ".Connection",
+    .basicsize = sizeof(pysqlite_Connection),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
+              Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = connection_slots,
+};
+
+PyTypeObject *pysqlite_ConnectionType = NULL;
+
+int
+pysqlite_connection_setup_types(PyObject *module)
 {
-    pysqlite_ConnectionType.tp_new = PyType_GenericNew;
-    return PyType_Ready(&pysqlite_ConnectionType);
+    pysqlite_ConnectionType = (PyTypeObject *)PyType_FromModuleAndSpec(module, &connection_spec, NULL);
+    if (pysqlite_ConnectionType == NULL) {
+        return -1;
+    }
+    return 0;
 }
diff --git a/Modules/_sqlite/connection.h b/Modules/_sqlite/connection.h
index 206085e..8773c9e 100644
--- a/Modules/_sqlite/connection.h
+++ b/Modules/_sqlite/connection.h
@@ -93,7 +93,7 @@
     /* a dictionary of registered collation name => collation callable mappings */
     PyObject* collations;
 
-    /* Exception objects */
+    /* Exception objects: borrowed refs. */
     PyObject* Warning;
     PyObject* Error;
     PyObject* InterfaceError;
@@ -106,22 +106,14 @@
     PyObject* NotSupportedError;
 } pysqlite_Connection;
 
-extern PyTypeObject pysqlite_ConnectionType;
+extern PyTypeObject *pysqlite_ConnectionType;
 
-PyObject* pysqlite_connection_alloc(PyTypeObject* type, int aware);
-void pysqlite_connection_dealloc(pysqlite_Connection* self);
-PyObject* pysqlite_connection_cursor(pysqlite_Connection* self, PyObject* args, PyObject* kwargs);
-PyObject* pysqlite_connection_close(pysqlite_Connection* self, PyObject* args);
 PyObject* _pysqlite_connection_begin(pysqlite_Connection* self);
-PyObject* pysqlite_connection_commit(pysqlite_Connection* self, PyObject* args);
-PyObject* pysqlite_connection_rollback(pysqlite_Connection* self, PyObject* args);
-PyObject* pysqlite_connection_new(PyTypeObject* type, PyObject* args, PyObject* kw);
-int pysqlite_connection_init(pysqlite_Connection* self, PyObject* args, PyObject* kwargs);
 
 int pysqlite_connection_register_cursor(pysqlite_Connection* connection, PyObject* cursor);
 int pysqlite_check_thread(pysqlite_Connection* self);
 int pysqlite_check_connection(pysqlite_Connection* con);
 
-int pysqlite_connection_setup_types(void);
+int pysqlite_connection_setup_types(PyObject *module);
 
 #endif
diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c
index 5cfb4b9..85267cc 100644
--- a/Modules/_sqlite/cursor.c
+++ b/Modules/_sqlite/cursor.c
@@ -24,20 +24,29 @@
 #include "cursor.h"
 #include "module.h"
 #include "util.h"
+#include "clinic/cursor.c.h"
 
-PyObject* pysqlite_cursor_iternext(pysqlite_Cursor* self);
+/*[clinic input]
+module _sqlite3
+class _sqlite3.Cursor "pysqlite_Cursor *" "pysqlite_CursorType"
+[clinic start generated code]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=b2072d8db95411d5]*/
 
 static const char errmsg_fetch_across_rollback[] = "Cursor needed to be reset because of commit/rollback and can no longer be fetched from.";
 
-static int pysqlite_cursor_init(pysqlite_Cursor* self, PyObject* args, PyObject* kwargs)
+/*[clinic input]
+_sqlite3.Cursor.__init__ as pysqlite_cursor_init
+
+    connection: object(type='pysqlite_Connection *', subclass_of='pysqlite_ConnectionType')
+    /
+
+[clinic start generated code]*/
+
+static int
+pysqlite_cursor_init_impl(pysqlite_Cursor *self,
+                          pysqlite_Connection *connection)
+/*[clinic end generated code: output=ac59dce49a809ca8 input=a8a4f75ac90999b2]*/
 {
-    pysqlite_Connection* connection;
-
-    if (!PyArg_ParseTuple(args, "O!", &pysqlite_ConnectionType, &connection))
-    {
-        return -1;
-    }
-
     Py_INCREF(connection);
     Py_XSETREF(self->connection, connection);
     Py_CLEAR(self->statement);
@@ -72,26 +81,49 @@
     return 0;
 }
 
-static void pysqlite_cursor_dealloc(pysqlite_Cursor* self)
+static int
+cursor_traverse(pysqlite_Cursor *self, visitproc visit, void *arg)
 {
-    /* Reset the statement if the user has not closed the cursor */
+    Py_VISIT(Py_TYPE(self));
+    Py_VISIT(self->connection);
+    Py_VISIT(self->description);
+    Py_VISIT(self->row_cast_map);
+    Py_VISIT(self->lastrowid);
+    Py_VISIT(self->row_factory);
+    Py_VISIT(self->statement);
+    Py_VISIT(self->next_row);
+    return 0;
+}
+
+static int
+cursor_clear(pysqlite_Cursor *self)
+{
+    Py_CLEAR(self->connection);
+    Py_CLEAR(self->description);
+    Py_CLEAR(self->row_cast_map);
+    Py_CLEAR(self->lastrowid);
+    Py_CLEAR(self->row_factory);
     if (self->statement) {
+        /* Reset the statement if the user has not closed the cursor */
         pysqlite_statement_reset(self->statement);
-        Py_DECREF(self->statement);
+        Py_CLEAR(self->statement);
     }
+    Py_CLEAR(self->next_row);
 
-    Py_XDECREF(self->connection);
-    Py_XDECREF(self->row_cast_map);
-    Py_XDECREF(self->description);
-    Py_XDECREF(self->lastrowid);
-    Py_XDECREF(self->row_factory);
-    Py_XDECREF(self->next_row);
+    return 0;
+}
 
+static void
+cursor_dealloc(pysqlite_Cursor *self)
+{
+    PyTypeObject *tp = Py_TYPE(self);
+    PyObject_GC_UnTrack(self);
     if (self->in_weakreflist != NULL) {
         PyObject_ClearWeakRefs((PyObject*)self);
     }
-
-    Py_TYPE(self)->tp_free((PyObject*)self);
+    tp->tp_clear((PyObject *)self);
+    tp->tp_free(self);
+    Py_DECREF(tp);
 }
 
 static PyObject *
@@ -123,7 +155,6 @@
 {
     int i;
     const char* pos;
-    const char* colname;
     const char* decltype;
     PyObject* converter;
 
@@ -140,21 +171,24 @@
         converter = NULL;
 
         if (self->connection->detect_types & PARSE_COLNAMES) {
-            colname = sqlite3_column_name(self->statement->st, i);
-            if (colname) {
-                const char *type_start = NULL;
-                for (pos = colname; *pos != 0; pos++) {
-                    if (*pos == '[') {
-                        type_start = pos + 1;
+            const char *colname = sqlite3_column_name(self->statement->st, i);
+            if (colname == NULL) {
+                PyErr_NoMemory();
+                Py_CLEAR(self->row_cast_map);
+                return -1;
+            }
+            const char *type_start = NULL;
+            for (pos = colname; *pos != 0; pos++) {
+                if (*pos == '[') {
+                    type_start = pos + 1;
+                }
+                else if (*pos == ']' && type_start != NULL) {
+                    converter = _pysqlite_get_converter(type_start, pos - type_start);
+                    if (!converter && PyErr_Occurred()) {
+                        Py_CLEAR(self->row_cast_map);
+                        return -1;
                     }
-                    else if (*pos == ']' && type_start != NULL) {
-                        converter = _pysqlite_get_converter(type_start, pos - type_start);
-                        if (!converter && PyErr_Occurred()) {
-                            Py_CLEAR(self->row_cast_map);
-                            return -1;
-                        }
-                        break;
-                    }
+                    break;
                 }
             }
         }
@@ -198,10 +232,6 @@
     const char* pos;
     Py_ssize_t len;
 
-    if (!colname) {
-        Py_RETURN_NONE;
-    }
-
     if (self->connection->detect_types & PARSE_COLNAMES) {
         for (pos = colname; *pos; pos++) {
             if (*pos == '[') {
@@ -230,12 +260,10 @@
 {
     int i, numcols;
     PyObject* row;
-    PyObject* item = NULL;
     int coltype;
     PyObject* converter;
     PyObject* converted;
     Py_ssize_t nbytes;
-    const char* val_str;
     char buf[200];
     const char* colname;
     PyObject* error_msg;
@@ -253,6 +281,7 @@
     if (!row)
         return NULL;
 
+    sqlite3 *db = self->connection->db;
     for (i = 0; i < numcols; i++) {
         if (self->connection->detect_types
                 && self->row_cast_map != NULL
@@ -264,16 +293,27 @@
             converter = Py_None;
         }
 
+        /*
+         * Note, sqlite3_column_bytes() must come after sqlite3_column_blob()
+         * or sqlite3_column_text().
+         *
+         * See https://sqlite.org/c3ref/column_blob.html for details.
+         */
         if (converter != Py_None) {
-            nbytes = sqlite3_column_bytes(self->statement->st, i);
-            val_str = (const char*)sqlite3_column_blob(self->statement->st, i);
-            if (!val_str) {
-                Py_INCREF(Py_None);
-                converted = Py_None;
-            } else {
-                item = PyBytes_FromStringAndSize(val_str, nbytes);
-                if (!item)
+            const void *blob = sqlite3_column_blob(self->statement->st, i);
+            if (blob == NULL) {
+                if (sqlite3_errcode(db) == SQLITE_NOMEM) {
+                    PyErr_NoMemory();
                     goto error;
+                }
+                converted = Py_NewRef(Py_None);
+            }
+            else {
+                nbytes = sqlite3_column_bytes(self->statement->st, i);
+                PyObject *item = PyBytes_FromStringAndSize(blob, nbytes);
+                if (item == NULL) {
+                    goto error;
+                }
                 converted = PyObject_CallOneArg(converter, item);
                 Py_DECREF(item);
             }
@@ -282,25 +322,30 @@
             coltype = sqlite3_column_type(self->statement->st, i);
             Py_END_ALLOW_THREADS
             if (coltype == SQLITE_NULL) {
-                Py_INCREF(Py_None);
-                converted = Py_None;
+                converted = Py_NewRef(Py_None);
             } else if (coltype == SQLITE_INTEGER) {
                 converted = PyLong_FromLongLong(sqlite3_column_int64(self->statement->st, i));
             } else if (coltype == SQLITE_FLOAT) {
                 converted = PyFloat_FromDouble(sqlite3_column_double(self->statement->st, i));
             } else if (coltype == SQLITE_TEXT) {
-                val_str = (const char*)sqlite3_column_text(self->statement->st, i);
+                const char *text = (const char*)sqlite3_column_text(self->statement->st, i);
+                if (text == NULL && sqlite3_errcode(db) == SQLITE_NOMEM) {
+                    PyErr_NoMemory();
+                    goto error;
+                }
+
                 nbytes = sqlite3_column_bytes(self->statement->st, i);
                 if (self->connection->text_factory == (PyObject*)&PyUnicode_Type) {
-                    converted = PyUnicode_FromStringAndSize(val_str, nbytes);
+                    converted = PyUnicode_FromStringAndSize(text, nbytes);
                     if (!converted && PyErr_ExceptionMatches(PyExc_UnicodeDecodeError)) {
                         PyErr_Clear();
                         colname = sqlite3_column_name(self->statement->st, i);
-                        if (!colname) {
-                            colname = "<unknown column name>";
+                        if (colname == NULL) {
+                            PyErr_NoMemory();
+                            goto error;
                         }
                         PyOS_snprintf(buf, sizeof(buf) - 1, "Could not decode to UTF-8 column '%s' with text '%s'",
-                                     colname , val_str);
+                                     colname , text);
                         error_msg = PyUnicode_Decode(buf, strlen(buf), "ascii", "replace");
                         if (!error_msg) {
                             PyErr_SetString(pysqlite_OperationalError, "Could not decode to UTF-8");
@@ -310,24 +355,29 @@
                         }
                     }
                 } else if (self->connection->text_factory == (PyObject*)&PyBytes_Type) {
-                    converted = PyBytes_FromStringAndSize(val_str, nbytes);
+                    converted = PyBytes_FromStringAndSize(text, nbytes);
                 } else if (self->connection->text_factory == (PyObject*)&PyByteArray_Type) {
-                    converted = PyByteArray_FromStringAndSize(val_str, nbytes);
+                    converted = PyByteArray_FromStringAndSize(text, nbytes);
                 } else {
-                    converted = PyObject_CallFunction(self->connection->text_factory, "y#", val_str, nbytes);
+                    converted = PyObject_CallFunction(self->connection->text_factory, "y#", text, nbytes);
                 }
             } else {
                 /* coltype == SQLITE_BLOB */
+                const void *blob = sqlite3_column_blob(self->statement->st, i);
+                if (blob == NULL && sqlite3_errcode(db) == SQLITE_NOMEM) {
+                    PyErr_NoMemory();
+                    goto error;
+                }
+
                 nbytes = sqlite3_column_bytes(self->statement->st, i);
-                converted = PyBytes_FromStringAndSize(
-                    sqlite3_column_blob(self->statement->st, i), nbytes);
+                converted = PyBytes_FromStringAndSize(blob, nbytes);
             }
         }
 
         if (!converted) {
             goto error;
         }
-        PyTuple_SetItem(row, i, converted);
+        PyTuple_SET_ITEM(row, i, converted);
     }
 
     if (PyErr_Occurred())
@@ -366,9 +416,8 @@
 }
 
 static PyObject *
-_pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* args)
+_pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* operation, PyObject* second_argument)
 {
-    PyObject* operation;
     PyObject* parameters_list = NULL;
     PyObject* parameters_iter = NULL;
     PyObject* parameters = NULL;
@@ -377,9 +426,7 @@
     PyObject* func_args;
     PyObject* result;
     int numcols;
-    PyObject* descriptor;
     PyObject* column_name;
-    PyObject* second_argument = NULL;
     sqlite_int64 lastrowid;
 
     if (!check_cursor(self)) {
@@ -392,15 +439,9 @@
     Py_CLEAR(self->next_row);
 
     if (multiple) {
-        /* executemany() */
-        if (!PyArg_ParseTuple(args, "UO", &operation, &second_argument)) {
-            goto error;
-        }
-
         if (PyIter_Check(second_argument)) {
             /* iterator */
-            Py_INCREF(second_argument);
-            parameters_iter = second_argument;
+            parameters_iter = Py_NewRef(second_argument);
         } else {
             /* sequence */
             parameters_iter = PyObject_GetIter(second_argument);
@@ -409,11 +450,6 @@
             }
         }
     } else {
-        /* execute() */
-        if (!PyArg_ParseTuple(args, "U|O", &operation, &second_argument)) {
-            goto error;
-        }
-
         parameters_list = PyList_New(0);
         if (!parameters_list) {
             goto error;
@@ -453,8 +489,7 @@
     if (!func_args) {
         goto error;
     }
-    Py_INCREF(operation);
-    if (PyTuple_SetItem(func_args, 0, operation) != 0) {
+    if (PyTuple_SetItem(func_args, 0, Py_NewRef(operation)) != 0) {
         goto error;
     }
 
@@ -472,13 +507,8 @@
 
     if (self->statement->in_use) {
         Py_SETREF(self->statement,
-                  PyObject_New(pysqlite_Statement, &pysqlite_StatementType));
-        if (!self->statement) {
-            goto error;
-        }
-        rc = pysqlite_statement_create(self->statement, self->connection, operation);
-        if (rc != SQLITE_OK) {
-            Py_CLEAR(self->statement);
+                  pysqlite_statement_create(self->connection, operation));
+        if (self->statement == NULL) {
             goto error;
         }
     }
@@ -541,24 +571,24 @@
                 goto error;
             }
             for (i = 0; i < numcols; i++) {
-                descriptor = PyTuple_New(7);
-                if (!descriptor) {
+                const char *colname;
+                colname = sqlite3_column_name(self->statement->st, i);
+                if (colname == NULL) {
+                    PyErr_NoMemory();
                     goto error;
                 }
-                column_name = _pysqlite_build_column_name(self,
-                                sqlite3_column_name(self->statement->st, i));
-                if (!column_name) {
-                    Py_DECREF(descriptor);
+                column_name = _pysqlite_build_column_name(self, colname);
+                if (column_name == NULL) {
                     goto error;
                 }
-                PyTuple_SetItem(descriptor, 0, column_name);
-                Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 1, Py_None);
-                Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 2, Py_None);
-                Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 3, Py_None);
-                Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 4, Py_None);
-                Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 5, Py_None);
-                Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 6, Py_None);
-                PyTuple_SetItem(self->description, i, descriptor);
+                PyObject *descriptor = PyTuple_Pack(7, column_name,
+                                                    Py_None, Py_None, Py_None,
+                                                    Py_None, Py_None, Py_None);
+                Py_DECREF(column_name);
+                if (descriptor == NULL) {
+                    goto error;
+                }
+                PyTuple_SET_ITEM(self->description, i, descriptor);
             }
         }
 
@@ -569,11 +599,13 @@
         }
 
         if (!multiple) {
-            Py_DECREF(self->lastrowid);
             Py_BEGIN_ALLOW_THREADS
             lastrowid = sqlite3_last_insert_rowid(self->connection->db);
             Py_END_ALLOW_THREADS
-            self->lastrowid = PyLong_FromLongLong(lastrowid);
+            Py_SETREF(self->lastrowid, PyLong_FromLongLong(lastrowid));
+            if (self->lastrowid == NULL) {
+                goto error;
+            }
         }
 
         if (rc == SQLITE_ROW) {
@@ -607,34 +639,65 @@
         self->rowcount = -1L;
         return NULL;
     } else {
-        Py_INCREF(self);
-        return (PyObject*)self;
+        return Py_NewRef((PyObject *)self);
     }
 }
 
-PyObject* pysqlite_cursor_execute(pysqlite_Cursor* self, PyObject* args)
-{
-    return _pysqlite_query_execute(self, 0, args);
-}
+/*[clinic input]
+_sqlite3.Cursor.execute as pysqlite_cursor_execute
 
-PyObject* pysqlite_cursor_executemany(pysqlite_Cursor* self, PyObject* args)
-{
-    return _pysqlite_query_execute(self, 1, args);
-}
+    sql: unicode
+    parameters: object(c_default = 'NULL') = ()
+    /
+
+Executes an SQL statement.
+[clinic start generated code]*/
 
 static PyObject *
-pysqlite_cursor_executescript(pysqlite_Cursor* self, PyObject* args)
+pysqlite_cursor_execute_impl(pysqlite_Cursor *self, PyObject *sql,
+                             PyObject *parameters)
+/*[clinic end generated code: output=d81b4655c7c0bbad input=a8e0200a11627f94]*/
 {
-    PyObject* script_obj;
+    return _pysqlite_query_execute(self, 0, sql, parameters);
+}
+
+/*[clinic input]
+_sqlite3.Cursor.executemany as pysqlite_cursor_executemany
+
+    sql: unicode
+    seq_of_parameters: object
+    /
+
+Repeatedly executes an SQL statement.
+[clinic start generated code]*/
+
+static PyObject *
+pysqlite_cursor_executemany_impl(pysqlite_Cursor *self, PyObject *sql,
+                                 PyObject *seq_of_parameters)
+/*[clinic end generated code: output=2c65a3c4733fb5d8 input=0d0a52e5eb7ccd35]*/
+{
+    return _pysqlite_query_execute(self, 1, sql, seq_of_parameters);
+}
+
+/*[clinic input]
+_sqlite3.Cursor.executescript as pysqlite_cursor_executescript
+
+    sql_script as script_obj: object
+    /
+
+Executes multiple SQL statements at once.
+[clinic start generated code]*/
+
+static PyObject *
+pysqlite_cursor_executescript(pysqlite_Cursor *self, PyObject *script_obj)
+/*[clinic end generated code: output=115a8132b0f200fe input=75270e5bcdb4d6aa]*/
+{
+    _Py_IDENTIFIER(commit);
     const char* script_cstr;
     sqlite3_stmt* statement;
     int rc;
     PyObject* result;
 
-    if (!PyArg_ParseTuple(args, "O", &script_obj)) {
-        return NULL;
-    }
-
     if (!check_cursor(self)) {
         return NULL;
     }
@@ -652,7 +715,7 @@
     }
 
     /* commit first */
-    result = pysqlite_connection_commit(self->connection, NULL);
+    result = _PyObject_CallMethodIdNoArgs((PyObject *)self->connection, &PyId_commit);
     if (!result) {
         goto error;
     }
@@ -672,14 +735,13 @@
         }
 
         /* execute statement, and ignore results of SELECT statements */
-        rc = SQLITE_ROW;
-        while (rc == SQLITE_ROW) {
+        do {
             rc = pysqlite_step(statement, self->connection);
             if (PyErr_Occurred()) {
                 (void)sqlite3_finalize(statement);
                 goto error;
             }
-        }
+        } while (rc == SQLITE_ROW);
 
         if (rc != SQLITE_DONE) {
             (void)sqlite3_finalize(statement);
@@ -702,12 +764,12 @@
     if (PyErr_Occurred()) {
         return NULL;
     } else {
-        Py_INCREF(self);
-        return (PyObject*)self;
+        return Py_NewRef((PyObject *)self);
     }
 }
 
-PyObject* pysqlite_cursor_iternext(pysqlite_Cursor *self)
+static PyObject *
+pysqlite_cursor_iternext(pysqlite_Cursor *self)
 {
     PyObject* next_row_tuple;
     PyObject* next_row;
@@ -771,7 +833,15 @@
     return next_row;
 }
 
-PyObject* pysqlite_cursor_fetchone(pysqlite_Cursor* self, PyObject* args)
+/*[clinic input]
+_sqlite3.Cursor.fetchone as pysqlite_cursor_fetchone
+
+Fetches one row from the resultset.
+[clinic start generated code]*/
+
+static PyObject *
+pysqlite_cursor_fetchone_impl(pysqlite_Cursor *self)
+/*[clinic end generated code: output=4bd2eabf5baaddb0 input=e78294ec5980fdba]*/
 {
     PyObject* row;
 
@@ -783,27 +853,34 @@
     return row;
 }
 
-PyObject* pysqlite_cursor_fetchmany(pysqlite_Cursor* self, PyObject* args, PyObject* kwargs)
-{
-    static char *kwlist[] = {"size", NULL};
+/*[clinic input]
+_sqlite3.Cursor.fetchmany as pysqlite_cursor_fetchmany
 
+    size as maxrows: int(c_default='self->arraysize') = 1
+        The default value is set by the Cursor.arraysize attribute.
+
+Fetches several rows from the resultset.
+[clinic start generated code]*/
+
+static PyObject *
+pysqlite_cursor_fetchmany_impl(pysqlite_Cursor *self, int maxrows)
+/*[clinic end generated code: output=a8ef31fea64d0906 input=c26e6ca3f34debd0]*/
+{
     PyObject* row;
     PyObject* list;
-    int maxrows = self->arraysize;
     int counter = 0;
 
-    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|i:fetchmany", kwlist, &maxrows)) {
-        return NULL;
-    }
-
     list = PyList_New(0);
     if (!list) {
         return NULL;
     }
 
     while ((row = pysqlite_cursor_iternext(self))) {
-        PyList_Append(list, row);
-        Py_XDECREF(row);
+        if (PyList_Append(list, row) < 0) {
+            Py_DECREF(row);
+            break;
+        }
+        Py_DECREF(row);
 
         if (++counter == maxrows) {
             break;
@@ -818,7 +895,15 @@
     }
 }
 
-PyObject* pysqlite_cursor_fetchall(pysqlite_Cursor* self, PyObject* args)
+/*[clinic input]
+_sqlite3.Cursor.fetchall as pysqlite_cursor_fetchall
+
+Fetches all rows from the resultset.
+[clinic start generated code]*/
+
+static PyObject *
+pysqlite_cursor_fetchall_impl(pysqlite_Cursor *self)
+/*[clinic end generated code: output=d5da12aca2da4b27 input=f5d401086a8df25a]*/
 {
     PyObject* row;
     PyObject* list;
@@ -829,8 +914,11 @@
     }
 
     while ((row = pysqlite_cursor_iternext(self))) {
-        PyList_Append(list, row);
-        Py_XDECREF(row);
+        if (PyList_Append(list, row) < 0) {
+            Py_DECREF(row);
+            break;
+        }
+        Py_DECREF(row);
     }
 
     if (PyErr_Occurred()) {
@@ -841,13 +929,49 @@
     }
 }
 
-PyObject* pysqlite_noop(pysqlite_Connection* self, PyObject* args)
+/*[clinic input]
+_sqlite3.Cursor.setinputsizes as pysqlite_cursor_setinputsizes
+
+    sizes: object
+    /
+
+Required by DB-API. Does nothing in sqlite3.
+[clinic start generated code]*/
+
+static PyObject *
+pysqlite_cursor_setinputsizes(pysqlite_Cursor *self, PyObject *sizes)
+/*[clinic end generated code: output=893c817afe9d08ad input=de7950a3aec79bdf]*/
 {
-    /* don't care, return None */
     Py_RETURN_NONE;
 }
 
-PyObject* pysqlite_cursor_close(pysqlite_Cursor* self, PyObject* args)
+/*[clinic input]
+_sqlite3.Cursor.setoutputsize as pysqlite_cursor_setoutputsize
+
+    size: object
+    column: object = None
+    /
+
+Required by DB-API. Does nothing in sqlite3.
+[clinic start generated code]*/
+
+static PyObject *
+pysqlite_cursor_setoutputsize_impl(pysqlite_Cursor *self, PyObject *size,
+                                   PyObject *column)
+/*[clinic end generated code: output=018d7e9129d45efe input=607a6bece8bbb273]*/
+{
+    Py_RETURN_NONE;
+}
+
+/*[clinic input]
+_sqlite3.Cursor.close as pysqlite_cursor_close
+
+Closes the cursor.
+[clinic start generated code]*/
+
+static PyObject *
+pysqlite_cursor_close_impl(pysqlite_Cursor *self)
+/*[clinic end generated code: output=b6055e4ec6fe63b6 input=08b36552dbb9a986]*/
 {
     if (!self->connection) {
         PyErr_SetString(pysqlite_ProgrammingError,
@@ -869,24 +993,15 @@
 }
 
 static PyMethodDef cursor_methods[] = {
-    {"execute", (PyCFunction)pysqlite_cursor_execute, METH_VARARGS,
-        PyDoc_STR("Executes a SQL statement.")},
-    {"executemany", (PyCFunction)pysqlite_cursor_executemany, METH_VARARGS,
-        PyDoc_STR("Repeatedly executes a SQL statement.")},
-    {"executescript", (PyCFunction)pysqlite_cursor_executescript, METH_VARARGS,
-        PyDoc_STR("Executes a multiple SQL statements at once. Non-standard.")},
-    {"fetchone", (PyCFunction)pysqlite_cursor_fetchone, METH_NOARGS,
-        PyDoc_STR("Fetches one row from the resultset.")},
-    {"fetchmany", (PyCFunction)(void(*)(void))pysqlite_cursor_fetchmany, METH_VARARGS|METH_KEYWORDS,
-        PyDoc_STR("Fetches several rows from the resultset.")},
-    {"fetchall", (PyCFunction)pysqlite_cursor_fetchall, METH_NOARGS,
-        PyDoc_STR("Fetches all rows from the resultset.")},
-    {"close", (PyCFunction)pysqlite_cursor_close, METH_NOARGS,
-        PyDoc_STR("Closes the cursor.")},
-    {"setinputsizes", (PyCFunction)pysqlite_noop, METH_VARARGS,
-        PyDoc_STR("Required by DB-API. Does nothing in pysqlite.")},
-    {"setoutputsize", (PyCFunction)pysqlite_noop, METH_VARARGS,
-        PyDoc_STR("Required by DB-API. Does nothing in pysqlite.")},
+    PYSQLITE_CURSOR_CLOSE_METHODDEF
+    PYSQLITE_CURSOR_EXECUTEMANY_METHODDEF
+    PYSQLITE_CURSOR_EXECUTESCRIPT_METHODDEF
+    PYSQLITE_CURSOR_EXECUTE_METHODDEF
+    PYSQLITE_CURSOR_FETCHALL_METHODDEF
+    PYSQLITE_CURSOR_FETCHMANY_METHODDEF
+    PYSQLITE_CURSOR_FETCHONE_METHODDEF
+    PYSQLITE_CURSOR_SETINPUTSIZES_METHODDEF
+    PYSQLITE_CURSOR_SETOUTPUTSIZE_METHODDEF
     {NULL, NULL}
 };
 
@@ -898,56 +1013,42 @@
     {"lastrowid", T_OBJECT, offsetof(pysqlite_Cursor, lastrowid), READONLY},
     {"rowcount", T_LONG, offsetof(pysqlite_Cursor, rowcount), READONLY},
     {"row_factory", T_OBJECT, offsetof(pysqlite_Cursor, row_factory), 0},
+    {"__weaklistoffset__", T_PYSSIZET, offsetof(pysqlite_Cursor, in_weakreflist), READONLY},
     {NULL}
 };
 
 static const char cursor_doc[] =
 PyDoc_STR("SQLite database cursor class.");
 
-PyTypeObject pysqlite_CursorType = {
-        PyVarObject_HEAD_INIT(NULL, 0)
-        MODULE_NAME ".Cursor",                          /* tp_name */
-        sizeof(pysqlite_Cursor),                        /* tp_basicsize */
-        0,                                              /* tp_itemsize */
-        (destructor)pysqlite_cursor_dealloc,            /* tp_dealloc */
-        0,                                              /* tp_vectorcall_offset */
-        0,                                              /* tp_getattr */
-        0,                                              /* tp_setattr */
-        0,                                              /* tp_as_async */
-        0,                                              /* tp_repr */
-        0,                                              /* tp_as_number */
-        0,                                              /* tp_as_sequence */
-        0,                                              /* tp_as_mapping */
-        0,                                              /* tp_hash */
-        0,                                              /* tp_call */
-        0,                                              /* tp_str */
-        0,                                              /* tp_getattro */
-        0,                                              /* tp_setattro */
-        0,                                              /* tp_as_buffer */
-        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
-        cursor_doc,                                     /* tp_doc */
-        0,                                              /* tp_traverse */
-        0,                                              /* tp_clear */
-        0,                                              /* tp_richcompare */
-        offsetof(pysqlite_Cursor, in_weakreflist),      /* tp_weaklistoffset */
-        PyObject_SelfIter,                              /* tp_iter */
-        (iternextfunc)pysqlite_cursor_iternext,         /* tp_iternext */
-        cursor_methods,                                 /* tp_methods */
-        cursor_members,                                 /* tp_members */
-        0,                                              /* tp_getset */
-        0,                                              /* tp_base */
-        0,                                              /* tp_dict */
-        0,                                              /* tp_descr_get */
-        0,                                              /* tp_descr_set */
-        0,                                              /* tp_dictoffset */
-        (initproc)pysqlite_cursor_init,                 /* tp_init */
-        0,                                              /* tp_alloc */
-        0,                                              /* tp_new */
-        0                                               /* tp_free */
+static PyType_Slot cursor_slots[] = {
+    {Py_tp_dealloc, cursor_dealloc},
+    {Py_tp_doc, (void *)cursor_doc},
+    {Py_tp_iter, PyObject_SelfIter},
+    {Py_tp_iternext, pysqlite_cursor_iternext},
+    {Py_tp_methods, cursor_methods},
+    {Py_tp_members, cursor_members},
+    {Py_tp_init, pysqlite_cursor_init},
+    {Py_tp_traverse, cursor_traverse},
+    {Py_tp_clear, cursor_clear},
+    {0, NULL},
 };
 
-extern int pysqlite_cursor_setup_types(void)
+static PyType_Spec cursor_spec = {
+    .name = MODULE_NAME ".Cursor",
+    .basicsize = sizeof(pysqlite_Cursor),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
+              Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = cursor_slots,
+};
+
+PyTypeObject *pysqlite_CursorType = NULL;
+
+int
+pysqlite_cursor_setup_types(PyObject *module)
 {
-    pysqlite_CursorType.tp_new = PyType_GenericNew;
-    return PyType_Ready(&pysqlite_CursorType);
+    pysqlite_CursorType = (PyTypeObject *)PyType_FromModuleAndSpec(module, &cursor_spec, NULL);
+    if (pysqlite_CursorType == NULL) {
+        return -1;
+    }
+    return 0;
 }
diff --git a/Modules/_sqlite/cursor.h b/Modules/_sqlite/cursor.h
index 4a20e75..b26b288 100644
--- a/Modules/_sqlite/cursor.h
+++ b/Modules/_sqlite/cursor.h
@@ -52,19 +52,9 @@
     PyObject* in_weakreflist; /* List of weak references */
 } pysqlite_Cursor;
 
-extern PyTypeObject pysqlite_CursorType;
+extern PyTypeObject *pysqlite_CursorType;
 
-PyObject* pysqlite_cursor_execute(pysqlite_Cursor* self, PyObject* args);
-PyObject* pysqlite_cursor_executemany(pysqlite_Cursor* self, PyObject* args);
-PyObject* pysqlite_cursor_getiter(pysqlite_Cursor *self);
-PyObject* pysqlite_cursor_iternext(pysqlite_Cursor *self);
-PyObject* pysqlite_cursor_fetchone(pysqlite_Cursor* self, PyObject* args);
-PyObject* pysqlite_cursor_fetchmany(pysqlite_Cursor* self, PyObject* args, PyObject* kwargs);
-PyObject* pysqlite_cursor_fetchall(pysqlite_Cursor* self, PyObject* args);
-PyObject* pysqlite_noop(pysqlite_Connection* self, PyObject* args);
-PyObject* pysqlite_cursor_close(pysqlite_Cursor* self, PyObject* args);
-
-int pysqlite_cursor_setup_types(void);
+int pysqlite_cursor_setup_types(PyObject *module);
 
 #define UNKNOWN (-1)
 #endif
diff --git a/Modules/_sqlite/microprotocols.c b/Modules/_sqlite/microprotocols.c
index 3b2d7f4..e219a72 100644
--- a/Modules/_sqlite/microprotocols.c
+++ b/Modules/_sqlite/microprotocols.c
@@ -29,7 +29,6 @@
 #include "microprotocols.h"
 #include "prepare_protocol.h"
 
-
 /** the adapters registry **/
 
 static PyObject *psyco_adapters = NULL;
@@ -37,14 +36,17 @@
 /* pysqlite_microprotocols_init - initialize the adapters dictionary */
 
 int
-pysqlite_microprotocols_init(PyObject *dict)
+pysqlite_microprotocols_init(PyObject *module)
 {
     /* create adapters dictionary and put it in module namespace */
     if ((psyco_adapters = PyDict_New()) == NULL) {
         return -1;
     }
 
-    return PyDict_SetItemString(dict, "adapters", psyco_adapters);
+    int res = PyModule_AddObjectRef(module, "adapters", psyco_adapters);
+    Py_DECREF(psyco_adapters);
+
+    return res;
 }
 
 
@@ -56,7 +58,7 @@
     PyObject* key;
     int rc;
 
-    if (proto == NULL) proto = (PyObject*)&pysqlite_PrepareProtocolType;
+    if (proto == NULL) proto = (PyObject*)pysqlite_PrepareProtocolType;
 
     key = Py_BuildValue("(OO)", (PyObject*)type, proto);
     if (!key) {
@@ -138,22 +140,9 @@
     }
 
     if (alt) {
-        Py_INCREF(alt);
-        return alt;
+        return Py_NewRef(alt);
     }
     /* else set the right exception and return NULL */
     PyErr_SetString(pysqlite_ProgrammingError, "can't adapt");
     return NULL;
 }
-
-/** module-level functions **/
-
-PyObject *
-pysqlite_adapt(pysqlite_Cursor *self, PyObject *args)
-{
-    PyObject *obj, *alt = NULL;
-    PyObject *proto = (PyObject*)&pysqlite_PrepareProtocolType;
-
-    if (!PyArg_ParseTuple(args, "O|OO", &obj, &proto, &alt)) return NULL;
-    return pysqlite_microprotocols_adapt(obj, proto, alt);
-}
diff --git a/Modules/_sqlite/microprotocols.h b/Modules/_sqlite/microprotocols.h
index 5418c2b..e9adef9 100644
--- a/Modules/_sqlite/microprotocols.h
+++ b/Modules/_sqlite/microprotocols.h
@@ -38,15 +38,10 @@
 /** exported functions **/
 
 /* used by module.c to init the microprotocols system */
-extern int pysqlite_microprotocols_init(PyObject *dict);
+extern int pysqlite_microprotocols_init(PyObject *module);
 extern int pysqlite_microprotocols_add(
     PyTypeObject *type, PyObject *proto, PyObject *cast);
 extern PyObject *pysqlite_microprotocols_adapt(
     PyObject *obj, PyObject *proto, PyObject *alt);
 
-extern PyObject *
-    pysqlite_adapt(pysqlite_Cursor* self, PyObject *args);
-#define pysqlite_adapt_doc \
-    "adapt(obj, protocol, alternate) -> adapt obj to given protocol. Non-standard."
-
 #endif /* !defined(PSYCOPG_MICROPROTOCOLS_H) */
diff --git a/Modules/_sqlite/module.c b/Modules/_sqlite/module.c
index 71d951e..8cff4e2 100644
--- a/Modules/_sqlite/module.c
+++ b/Modules/_sqlite/module.c
@@ -29,10 +29,16 @@
 #include "microprotocols.h"
 #include "row.h"
 
-#if SQLITE_VERSION_NUMBER >= 3003003
-#define HAVE_SHARED_CACHE
+#if SQLITE_VERSION_NUMBER < 3007015
+#error "SQLite 3.7.15 or higher required"
 #endif
 
+#include "clinic/module.c.h"
+/*[clinic input]
+module _sqlite3
+[clinic start generated code]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=81e330492d57488e]*/
+
 /* static objects at module-level */
 
 PyObject *pysqlite_Error = NULL;
@@ -71,8 +77,6 @@
     int uri = 0;
     double timeout = 5.0;
 
-    PyObject* result;
-
     if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|diOiOip", kwlist,
                                      &database, &timeout, &detect_types,
                                      &isolation_level, &check_same_thread,
@@ -82,16 +86,10 @@
     }
 
     if (factory == NULL) {
-        factory = (PyObject*)&pysqlite_ConnectionType;
+        factory = (PyObject*)pysqlite_ConnectionType;
     }
 
-    if (PySys_Audit("sqlite3.connect", "O", database) < 0) {
-        return NULL;
-    }
-
-    result = PyObject_Call(factory, args, kwargs);
-
-    return result;
+    return PyObject_Call(factory, args, kwargs);
 }
 
 PyDoc_STRVAR(module_connect_doc,
@@ -102,48 +100,44 @@
 \":memory:\" to open a database connection to a database that resides in\n\
 RAM instead of on disk.");
 
-static PyObject* module_complete(PyObject* self, PyObject* args, PyObject*
-        kwargs)
+/*[clinic input]
+_sqlite3.complete_statement as pysqlite_complete_statement
+
+    statement: str
+
+Checks if a string contains a complete SQL statement.
+[clinic start generated code]*/
+
+static PyObject *
+pysqlite_complete_statement_impl(PyObject *module, const char *statement)
+/*[clinic end generated code: output=e55f1ff1952df558 input=ac45d257375bb828]*/
 {
-    static char *kwlist[] = {"statement", NULL};
-    char* statement;
-
-    PyObject* result;
-
-    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s", kwlist, &statement))
-    {
-        return NULL;
-    }
-
     if (sqlite3_complete(statement)) {
-        result = Py_True;
+        return Py_NewRef(Py_True);
     } else {
-        result = Py_False;
+        return Py_NewRef(Py_False);
     }
-
-    Py_INCREF(result);
-
-    return result;
 }
 
-PyDoc_STRVAR(module_complete_doc,
-"complete_statement(sql)\n\
-\n\
-Checks if a string contains a complete SQL statement. Non-standard.");
+/*[clinic input]
+_sqlite3.enable_shared_cache as pysqlite_enable_shared_cache
 
-#ifdef HAVE_SHARED_CACHE
-static PyObject* module_enable_shared_cache(PyObject* self, PyObject* args, PyObject*
-        kwargs)
+    do_enable: int
+
+Enable or disable shared cache mode for the calling thread.
+
+This method is deprecated and will be removed in Python 3.12.
+Shared cache is strongly discouraged by the SQLite 3 documentation.
+If shared cache must be used, open the database in URI mode using
+the cache=shared query parameter.
+[clinic start generated code]*/
+
+static PyObject *
+pysqlite_enable_shared_cache_impl(PyObject *module, int do_enable)
+/*[clinic end generated code: output=259c74eedee1516b input=26e40d5971d3487d]*/
 {
-    static char *kwlist[] = {"do_enable", NULL};
-    int do_enable;
     int rc;
 
-    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i", kwlist, &do_enable))
-    {
-        return NULL;
-    }
-
     rc = sqlite3_enable_shared_cache(do_enable);
 
     if (rc != SQLITE_OK) {
@@ -154,23 +148,23 @@
     }
 }
 
-PyDoc_STRVAR(module_enable_shared_cache_doc,
-"enable_shared_cache(do_enable)\n\
-\n\
-Enable or disable shared cache mode for the calling thread.\n\
-Experimental/Non-standard.");
-#endif /* HAVE_SHARED_CACHE */
+/*[clinic input]
+_sqlite3.register_adapter as pysqlite_register_adapter
 
-static PyObject* module_register_adapter(PyObject* self, PyObject* args)
+    type: object(type='PyTypeObject *')
+    caster: object
+    /
+
+Registers an adapter with sqlite3's adapter registry.
+[clinic start generated code]*/
+
+static PyObject *
+pysqlite_register_adapter_impl(PyObject *module, PyTypeObject *type,
+                               PyObject *caster)
+/*[clinic end generated code: output=a287e8db18e8af23 input=b4bd87afcadc535d]*/
 {
-    PyTypeObject* type;
-    PyObject* caster;
     int rc;
 
-    if (!PyArg_ParseTuple(args, "OO", &type, &caster)) {
-        return NULL;
-    }
-
     /* a basic type is adapted; there's a performance optimization if that's not the case
      * (99 % of all usages) */
     if (type == &PyLong_Type || type == &PyFloat_Type
@@ -178,30 +172,32 @@
         pysqlite_BaseTypeAdapted = 1;
     }
 
-    rc = pysqlite_microprotocols_add(type, (PyObject*)&pysqlite_PrepareProtocolType, caster);
+    rc = pysqlite_microprotocols_add(type, (PyObject*)pysqlite_PrepareProtocolType, caster);
     if (rc == -1)
         return NULL;
 
     Py_RETURN_NONE;
 }
 
-PyDoc_STRVAR(module_register_adapter_doc,
-"register_adapter(type, callable)\n\
-\n\
-Registers an adapter with pysqlite's adapter registry. Non-standard.");
+/*[clinic input]
+_sqlite3.register_converter as pysqlite_register_converter
 
-static PyObject* module_register_converter(PyObject* self, PyObject* args)
+    name as orig_name: unicode
+    converter as callable: object
+    /
+
+Registers a converter with sqlite3.
+[clinic start generated code]*/
+
+static PyObject *
+pysqlite_register_converter_impl(PyObject *module, PyObject *orig_name,
+                                 PyObject *callable)
+/*[clinic end generated code: output=a2f2bfeed7230062 input=90f645419425d6c4]*/
 {
-    PyObject* orig_name;
     PyObject* name = NULL;
-    PyObject* callable;
     PyObject* retval = NULL;
     _Py_IDENTIFIER(upper);
 
-    if (!PyArg_ParseTuple(args, "UO", &orig_name, &callable)) {
-        return NULL;
-    }
-
     /* convert the name to upper case */
     name = _PyObject_CallMethodIdNoArgs(orig_name, &PyId_upper);
     if (!name) {
@@ -212,127 +208,127 @@
         goto error;
     }
 
-    Py_INCREF(Py_None);
-    retval = Py_None;
+    retval = Py_NewRef(Py_None);
 error:
     Py_XDECREF(name);
     return retval;
 }
 
-PyDoc_STRVAR(module_register_converter_doc,
-"register_converter(typename, callable)\n\
-\n\
-Registers a converter with pysqlite. Non-standard.");
+/*[clinic input]
+_sqlite3.enable_callback_tracebacks as pysqlite_enable_callback_trace
 
-static PyObject* enable_callback_tracebacks(PyObject* self, PyObject* args)
+    enable: int
+    /
+
+Enable or disable callback functions throwing errors to stderr.
+[clinic start generated code]*/
+
+static PyObject *
+pysqlite_enable_callback_trace_impl(PyObject *module, int enable)
+/*[clinic end generated code: output=4ff1d051c698f194 input=cb79d3581eb77c40]*/
 {
-    if (!PyArg_ParseTuple(args, "i", &_pysqlite_enable_callback_tracebacks)) {
-        return NULL;
-    }
+    _pysqlite_enable_callback_tracebacks = enable;
 
     Py_RETURN_NONE;
 }
 
-PyDoc_STRVAR(enable_callback_tracebacks_doc,
-"enable_callback_tracebacks(flag)\n\
-\n\
-Enable or disable callback functions throwing errors to stderr.");
+/*[clinic input]
+_sqlite3.adapt as pysqlite_adapt
 
-static void converters_init(PyObject* dict)
+    obj: object
+    proto: object(c_default='(PyObject*)pysqlite_PrepareProtocolType') = PrepareProtocolType
+    alt: object = NULL
+    /
+
+Adapt given object to given protocol.
+[clinic start generated code]*/
+
+static PyObject *
+pysqlite_adapt_impl(PyObject *module, PyObject *obj, PyObject *proto,
+                    PyObject *alt)
+/*[clinic end generated code: output=0c3927c5fcd23dd9 input=46ca9564710ba48a]*/
+{
+    return pysqlite_microprotocols_adapt(obj, proto, alt);
+}
+
+static int converters_init(PyObject* module)
 {
     _pysqlite_converters = PyDict_New();
     if (!_pysqlite_converters) {
-        return;
+        return -1;
     }
 
-    PyDict_SetItemString(dict, "converters", _pysqlite_converters);
+    int res = PyModule_AddObjectRef(module, "converters", _pysqlite_converters);
+    Py_DECREF(_pysqlite_converters);
+
+    return res;
 }
 
 static PyMethodDef module_methods[] = {
     {"connect",  (PyCFunction)(void(*)(void))module_connect,
      METH_VARARGS | METH_KEYWORDS, module_connect_doc},
-    {"complete_statement",  (PyCFunction)(void(*)(void))module_complete,
-     METH_VARARGS | METH_KEYWORDS, module_complete_doc},
-#ifdef HAVE_SHARED_CACHE
-    {"enable_shared_cache",  (PyCFunction)(void(*)(void))module_enable_shared_cache,
-     METH_VARARGS | METH_KEYWORDS, module_enable_shared_cache_doc},
-#endif
-    {"register_adapter", (PyCFunction)module_register_adapter,
-     METH_VARARGS, module_register_adapter_doc},
-    {"register_converter", (PyCFunction)module_register_converter,
-     METH_VARARGS, module_register_converter_doc},
-    {"adapt",  (PyCFunction)pysqlite_adapt, METH_VARARGS,
-     pysqlite_adapt_doc},
-    {"enable_callback_tracebacks",  (PyCFunction)enable_callback_tracebacks,
-     METH_VARARGS, enable_callback_tracebacks_doc},
+    PYSQLITE_ADAPT_METHODDEF
+    PYSQLITE_COMPLETE_STATEMENT_METHODDEF
+    PYSQLITE_ENABLE_CALLBACK_TRACE_METHODDEF
+    PYSQLITE_ENABLE_SHARED_CACHE_METHODDEF
+    PYSQLITE_REGISTER_ADAPTER_METHODDEF
+    PYSQLITE_REGISTER_CONVERTER_METHODDEF
     {NULL, NULL}
 };
 
-struct _IntConstantPair {
-    const char *constant_name;
-    int constant_value;
-};
+static int
+add_integer_constants(PyObject *module) {
+#define ADD_INT(ival)                                           \
+    do {                                                        \
+        if (PyModule_AddIntConstant(module, #ival, ival) < 0) { \
+            return -1;                                          \
+        }                                                       \
+    } while (0);                                                \
 
-typedef struct _IntConstantPair IntConstantPair;
-
-static const IntConstantPair _int_constants[] = {
-    {"PARSE_DECLTYPES", PARSE_DECLTYPES},
-    {"PARSE_COLNAMES", PARSE_COLNAMES},
-
-    {"SQLITE_OK", SQLITE_OK},
-    {"SQLITE_DENY", SQLITE_DENY},
-    {"SQLITE_IGNORE", SQLITE_IGNORE},
-    {"SQLITE_CREATE_INDEX", SQLITE_CREATE_INDEX},
-    {"SQLITE_CREATE_TABLE", SQLITE_CREATE_TABLE},
-    {"SQLITE_CREATE_TEMP_INDEX", SQLITE_CREATE_TEMP_INDEX},
-    {"SQLITE_CREATE_TEMP_TABLE", SQLITE_CREATE_TEMP_TABLE},
-    {"SQLITE_CREATE_TEMP_TRIGGER", SQLITE_CREATE_TEMP_TRIGGER},
-    {"SQLITE_CREATE_TEMP_VIEW", SQLITE_CREATE_TEMP_VIEW},
-    {"SQLITE_CREATE_TRIGGER", SQLITE_CREATE_TRIGGER},
-    {"SQLITE_CREATE_VIEW", SQLITE_CREATE_VIEW},
-    {"SQLITE_DELETE", SQLITE_DELETE},
-    {"SQLITE_DROP_INDEX", SQLITE_DROP_INDEX},
-    {"SQLITE_DROP_TABLE", SQLITE_DROP_TABLE},
-    {"SQLITE_DROP_TEMP_INDEX", SQLITE_DROP_TEMP_INDEX},
-    {"SQLITE_DROP_TEMP_TABLE", SQLITE_DROP_TEMP_TABLE},
-    {"SQLITE_DROP_TEMP_TRIGGER", SQLITE_DROP_TEMP_TRIGGER},
-    {"SQLITE_DROP_TEMP_VIEW", SQLITE_DROP_TEMP_VIEW},
-    {"SQLITE_DROP_TRIGGER", SQLITE_DROP_TRIGGER},
-    {"SQLITE_DROP_VIEW", SQLITE_DROP_VIEW},
-    {"SQLITE_INSERT", SQLITE_INSERT},
-    {"SQLITE_PRAGMA", SQLITE_PRAGMA},
-    {"SQLITE_READ", SQLITE_READ},
-    {"SQLITE_SELECT", SQLITE_SELECT},
-    {"SQLITE_TRANSACTION", SQLITE_TRANSACTION},
-    {"SQLITE_UPDATE", SQLITE_UPDATE},
-    {"SQLITE_ATTACH", SQLITE_ATTACH},
-    {"SQLITE_DETACH", SQLITE_DETACH},
-#if SQLITE_VERSION_NUMBER >= 3002001
-    {"SQLITE_ALTER_TABLE", SQLITE_ALTER_TABLE},
-    {"SQLITE_REINDEX", SQLITE_REINDEX},
-#endif
-#if SQLITE_VERSION_NUMBER >= 3003000
-    {"SQLITE_ANALYZE", SQLITE_ANALYZE},
-#endif
-#if SQLITE_VERSION_NUMBER >= 3003007
-    {"SQLITE_CREATE_VTABLE", SQLITE_CREATE_VTABLE},
-    {"SQLITE_DROP_VTABLE", SQLITE_DROP_VTABLE},
-#endif
-#if SQLITE_VERSION_NUMBER >= 3003008
-    {"SQLITE_FUNCTION", SQLITE_FUNCTION},
-#endif
-#if SQLITE_VERSION_NUMBER >= 3006008
-    {"SQLITE_SAVEPOINT", SQLITE_SAVEPOINT},
-#endif
+    ADD_INT(PARSE_DECLTYPES);
+    ADD_INT(PARSE_COLNAMES);
+    ADD_INT(SQLITE_OK);
+    ADD_INT(SQLITE_DENY);
+    ADD_INT(SQLITE_IGNORE);
+    ADD_INT(SQLITE_CREATE_INDEX);
+    ADD_INT(SQLITE_CREATE_TABLE);
+    ADD_INT(SQLITE_CREATE_TEMP_INDEX);
+    ADD_INT(SQLITE_CREATE_TEMP_TABLE);
+    ADD_INT(SQLITE_CREATE_TEMP_TRIGGER);
+    ADD_INT(SQLITE_CREATE_TEMP_VIEW);
+    ADD_INT(SQLITE_CREATE_TRIGGER);
+    ADD_INT(SQLITE_CREATE_VIEW);
+    ADD_INT(SQLITE_DELETE);
+    ADD_INT(SQLITE_DROP_INDEX);
+    ADD_INT(SQLITE_DROP_TABLE);
+    ADD_INT(SQLITE_DROP_TEMP_INDEX);
+    ADD_INT(SQLITE_DROP_TEMP_TABLE);
+    ADD_INT(SQLITE_DROP_TEMP_TRIGGER);
+    ADD_INT(SQLITE_DROP_TEMP_VIEW);
+    ADD_INT(SQLITE_DROP_TRIGGER);
+    ADD_INT(SQLITE_DROP_VIEW);
+    ADD_INT(SQLITE_INSERT);
+    ADD_INT(SQLITE_PRAGMA);
+    ADD_INT(SQLITE_READ);
+    ADD_INT(SQLITE_SELECT);
+    ADD_INT(SQLITE_TRANSACTION);
+    ADD_INT(SQLITE_UPDATE);
+    ADD_INT(SQLITE_ATTACH);
+    ADD_INT(SQLITE_DETACH);
+    ADD_INT(SQLITE_ALTER_TABLE);
+    ADD_INT(SQLITE_REINDEX);
+    ADD_INT(SQLITE_ANALYZE);
+    ADD_INT(SQLITE_CREATE_VTABLE);
+    ADD_INT(SQLITE_DROP_VTABLE);
+    ADD_INT(SQLITE_FUNCTION);
+    ADD_INT(SQLITE_SAVEPOINT);
 #if SQLITE_VERSION_NUMBER >= 3008003
-    {"SQLITE_RECURSIVE", SQLITE_RECURSIVE},
+    ADD_INT(SQLITE_RECURSIVE);
 #endif
-#if SQLITE_VERSION_NUMBER >= 3006011
-    {"SQLITE_DONE", SQLITE_DONE},
-#endif
-    {(char*)NULL, 0}
-};
-
+    ADD_INT(SQLITE_DONE);
+#undef ADD_INT
+    return 0;
+}
 
 static struct PyModuleDef _sqlite3module = {
         PyModuleDef_HEAD_INIT,
@@ -349,138 +345,100 @@
 #define ADD_TYPE(module, type)                 \
 do {                                           \
     if (PyModule_AddType(module, &type) < 0) { \
-        Py_DECREF(module);                     \
-        return NULL;                           \
+        goto error;                            \
     }                                          \
 } while (0)
 
+#define ADD_EXCEPTION(module, name, exc, base)                  \
+do {                                                            \
+    exc = PyErr_NewException(MODULE_NAME "." name, base, NULL); \
+    if (!exc) {                                                 \
+        goto error;                                             \
+    }                                                           \
+    int res = PyModule_AddObjectRef(module, name, exc);         \
+    Py_DECREF(exc);                                             \
+    if (res < 0) {                                              \
+        goto error;                                             \
+    }                                                           \
+} while (0)
+
 PyMODINIT_FUNC PyInit__sqlite3(void)
 {
-    PyObject *module, *dict;
-    PyObject *tmp_obj;
-    int i;
+    PyObject *module;
+
+    if (sqlite3_libversion_number() < 3007015) {
+        PyErr_SetString(PyExc_ImportError, MODULE_NAME ": SQLite 3.7.15 or higher required");
+        return NULL;
+    }
+
+    int rc = sqlite3_initialize();
+    if (rc != SQLITE_OK) {
+        PyErr_SetString(PyExc_ImportError, sqlite3_errstr(rc));
+        return NULL;
+    }
 
     module = PyModule_Create(&_sqlite3module);
 
     if (!module ||
-        (pysqlite_row_setup_types() < 0) ||
-        (pysqlite_cursor_setup_types() < 0) ||
-        (pysqlite_connection_setup_types() < 0) ||
-        (pysqlite_cache_setup_types() < 0) ||
-        (pysqlite_statement_setup_types() < 0) ||
-        (pysqlite_prepare_protocol_setup_types() < 0)
+        (pysqlite_row_setup_types(module) < 0) ||
+        (pysqlite_cursor_setup_types(module) < 0) ||
+        (pysqlite_connection_setup_types(module) < 0) ||
+        (pysqlite_cache_setup_types(module) < 0) ||
+        (pysqlite_statement_setup_types(module) < 0) ||
+        (pysqlite_prepare_protocol_setup_types(module) < 0)
        ) {
-        Py_XDECREF(module);
-        return NULL;
-    }
-
-    ADD_TYPE(module, pysqlite_ConnectionType);
-    ADD_TYPE(module, pysqlite_CursorType);
-    ADD_TYPE(module, pysqlite_PrepareProtocolType);
-    ADD_TYPE(module, pysqlite_RowType);
-
-    if (!(dict = PyModule_GetDict(module))) {
         goto error;
     }
 
+    ADD_TYPE(module, *pysqlite_ConnectionType);
+    ADD_TYPE(module, *pysqlite_CursorType);
+    ADD_TYPE(module, *pysqlite_PrepareProtocolType);
+    ADD_TYPE(module, *pysqlite_RowType);
+
     /*** Create DB-API Exception hierarchy */
-
-    if (!(pysqlite_Error = PyErr_NewException(MODULE_NAME ".Error", PyExc_Exception, NULL))) {
-        goto error;
-    }
-    PyDict_SetItemString(dict, "Error", pysqlite_Error);
-
-    if (!(pysqlite_Warning = PyErr_NewException(MODULE_NAME ".Warning", PyExc_Exception, NULL))) {
-        goto error;
-    }
-    PyDict_SetItemString(dict, "Warning", pysqlite_Warning);
+    ADD_EXCEPTION(module, "Error", pysqlite_Error, PyExc_Exception);
+    ADD_EXCEPTION(module, "Warning", pysqlite_Warning, PyExc_Exception);
 
     /* Error subclasses */
-
-    if (!(pysqlite_InterfaceError = PyErr_NewException(MODULE_NAME ".InterfaceError", pysqlite_Error, NULL))) {
-        goto error;
-    }
-    PyDict_SetItemString(dict, "InterfaceError", pysqlite_InterfaceError);
-
-    if (!(pysqlite_DatabaseError = PyErr_NewException(MODULE_NAME ".DatabaseError", pysqlite_Error, NULL))) {
-        goto error;
-    }
-    PyDict_SetItemString(dict, "DatabaseError", pysqlite_DatabaseError);
+    ADD_EXCEPTION(module, "InterfaceError", pysqlite_InterfaceError, pysqlite_Error);
+    ADD_EXCEPTION(module, "DatabaseError", pysqlite_DatabaseError, pysqlite_Error);
 
     /* pysqlite_DatabaseError subclasses */
-
-    if (!(pysqlite_InternalError = PyErr_NewException(MODULE_NAME ".InternalError", pysqlite_DatabaseError, NULL))) {
-        goto error;
-    }
-    PyDict_SetItemString(dict, "InternalError", pysqlite_InternalError);
-
-    if (!(pysqlite_OperationalError = PyErr_NewException(MODULE_NAME ".OperationalError", pysqlite_DatabaseError, NULL))) {
-        goto error;
-    }
-    PyDict_SetItemString(dict, "OperationalError", pysqlite_OperationalError);
-
-    if (!(pysqlite_ProgrammingError = PyErr_NewException(MODULE_NAME ".ProgrammingError", pysqlite_DatabaseError, NULL))) {
-        goto error;
-    }
-    PyDict_SetItemString(dict, "ProgrammingError", pysqlite_ProgrammingError);
-
-    if (!(pysqlite_IntegrityError = PyErr_NewException(MODULE_NAME ".IntegrityError", pysqlite_DatabaseError,NULL))) {
-        goto error;
-    }
-    PyDict_SetItemString(dict, "IntegrityError", pysqlite_IntegrityError);
-
-    if (!(pysqlite_DataError = PyErr_NewException(MODULE_NAME ".DataError", pysqlite_DatabaseError, NULL))) {
-        goto error;
-    }
-    PyDict_SetItemString(dict, "DataError", pysqlite_DataError);
-
-    if (!(pysqlite_NotSupportedError = PyErr_NewException(MODULE_NAME ".NotSupportedError", pysqlite_DatabaseError, NULL))) {
-        goto error;
-    }
-    PyDict_SetItemString(dict, "NotSupportedError", pysqlite_NotSupportedError);
-
-    /* In Python 2.x, setting Connection.text_factory to
-       OptimizedUnicode caused Unicode objects to be returned for
-       non-ASCII data and bytestrings to be returned for ASCII data.
-       Now OptimizedUnicode is an alias for str, so it has no
-       effect. */
-    Py_INCREF((PyObject*)&PyUnicode_Type);
-    PyDict_SetItemString(dict, "OptimizedUnicode", (PyObject*)&PyUnicode_Type);
+    ADD_EXCEPTION(module, "InternalError", pysqlite_InternalError, pysqlite_DatabaseError);
+    ADD_EXCEPTION(module, "OperationalError", pysqlite_OperationalError, pysqlite_DatabaseError);
+    ADD_EXCEPTION(module, "ProgrammingError", pysqlite_ProgrammingError, pysqlite_DatabaseError);
+    ADD_EXCEPTION(module, "IntegrityError", pysqlite_IntegrityError, pysqlite_DatabaseError);
+    ADD_EXCEPTION(module, "DataError", pysqlite_DataError, pysqlite_DatabaseError);
+    ADD_EXCEPTION(module, "NotSupportedError", pysqlite_NotSupportedError, pysqlite_DatabaseError);
 
     /* Set integer constants */
-    for (i = 0; _int_constants[i].constant_name != NULL; i++) {
-        tmp_obj = PyLong_FromLong(_int_constants[i].constant_value);
-        if (!tmp_obj) {
-            goto error;
-        }
-        PyDict_SetItemString(dict, _int_constants[i].constant_name, tmp_obj);
-        Py_DECREF(tmp_obj);
-    }
-
-    if (!(tmp_obj = PyUnicode_FromString(PYSQLITE_VERSION))) {
+    if (add_integer_constants(module) < 0) {
         goto error;
     }
-    PyDict_SetItemString(dict, "version", tmp_obj);
-    Py_DECREF(tmp_obj);
 
-    if (!(tmp_obj = PyUnicode_FromString(sqlite3_libversion()))) {
+    if (PyModule_AddStringConstant(module, "version", PYSQLITE_VERSION) < 0) {
         goto error;
     }
-    PyDict_SetItemString(dict, "sqlite_version", tmp_obj);
-    Py_DECREF(tmp_obj);
+
+    if (PyModule_AddStringConstant(module, "sqlite_version", sqlite3_libversion())) {
+        goto error;
+    }
 
     /* initialize microprotocols layer */
-    pysqlite_microprotocols_init(dict);
+    if (pysqlite_microprotocols_init(module) < 0) {
+        goto error;
+    }
 
     /* initialize the default converters */
-    converters_init(dict);
+    if (converters_init(module) < 0) {
+        goto error;
+    }
+
+    return module;
 
 error:
-    if (PyErr_Occurred())
-    {
-        PyErr_SetString(PyExc_ImportError, MODULE_NAME ": init failed");
-        Py_DECREF(module);
-        module = NULL;
-    }
-    return module;
+    sqlite3_shutdown();
+    PyErr_SetString(PyExc_ImportError, MODULE_NAME ": init failed");
+    Py_XDECREF(module);
+    return NULL;
 }
diff --git a/Modules/_sqlite/module.h b/Modules/_sqlite/module.h
index 3185ec9..9aede92 100644
--- a/Modules/_sqlite/module.h
+++ b/Modules/_sqlite/module.h
@@ -27,6 +27,7 @@
 #include "Python.h"
 
 #define PYSQLITE_VERSION "2.6.0"
+#define MODULE_NAME "sqlite3"
 
 extern PyObject* pysqlite_Error;
 extern PyObject* pysqlite_Warning;
diff --git a/Modules/_sqlite/prepare_protocol.c b/Modules/_sqlite/prepare_protocol.c
index 05a2ca5..800eef8 100644
--- a/Modules/_sqlite/prepare_protocol.c
+++ b/Modules/_sqlite/prepare_protocol.c
@@ -23,61 +23,52 @@
 
 #include "prepare_protocol.h"
 
-int pysqlite_prepare_protocol_init(pysqlite_PrepareProtocol* self, PyObject* args, PyObject* kwargs)
+static int
+pysqlite_prepare_protocol_init(pysqlite_PrepareProtocol *self, PyObject *args,
+                               PyObject *kwargs)
 {
     return 0;
 }
 
-void pysqlite_prepare_protocol_dealloc(pysqlite_PrepareProtocol* self)
+static int
+pysqlite_prepare_protocol_traverse(PyObject *self, visitproc visit, void *arg)
 {
-    Py_TYPE(self)->tp_free((PyObject*)self);
+    Py_VISIT(Py_TYPE(self));
+    return 0;
 }
 
-PyTypeObject pysqlite_PrepareProtocolType= {
-        PyVarObject_HEAD_INIT(NULL, 0)
-        MODULE_NAME ".PrepareProtocol",                 /* tp_name */
-        sizeof(pysqlite_PrepareProtocol),               /* tp_basicsize */
-        0,                                              /* tp_itemsize */
-        (destructor)pysqlite_prepare_protocol_dealloc,  /* tp_dealloc */
-        0,                                              /* tp_vectorcall_offset */
-        0,                                              /* tp_getattr */
-        0,                                              /* tp_setattr */
-        0,                                              /* tp_as_async */
-        0,                                              /* tp_repr */
-        0,                                              /* tp_as_number */
-        0,                                              /* tp_as_sequence */
-        0,                                              /* tp_as_mapping */
-        0,                                              /* tp_hash */
-        0,                                              /* tp_call */
-        0,                                              /* tp_str */
-        0,                                              /* tp_getattro */
-        0,                                              /* tp_setattro */
-        0,                                              /* tp_as_buffer */
-        Py_TPFLAGS_DEFAULT,                             /* tp_flags */
-        0,                                              /* tp_doc */
-        0,                                              /* tp_traverse */
-        0,                                              /* tp_clear */
-        0,                                              /* tp_richcompare */
-        0,                                              /* tp_weaklistoffset */
-        0,                                              /* tp_iter */
-        0,                                              /* tp_iternext */
-        0,                                              /* tp_methods */
-        0,                                              /* tp_members */
-        0,                                              /* tp_getset */
-        0,                                              /* tp_base */
-        0,                                              /* tp_dict */
-        0,                                              /* tp_descr_get */
-        0,                                              /* tp_descr_set */
-        0,                                              /* tp_dictoffset */
-        (initproc)pysqlite_prepare_protocol_init,       /* tp_init */
-        0,                                              /* tp_alloc */
-        0,                                              /* tp_new */
-        0                                               /* tp_free */
+static void
+pysqlite_prepare_protocol_dealloc(pysqlite_PrepareProtocol *self)
+{
+    PyTypeObject *tp = Py_TYPE(self);
+    PyObject_GC_UnTrack(self);
+    tp->tp_free(self);
+    Py_DECREF(tp);
+}
+
+static PyType_Slot type_slots[] = {
+    {Py_tp_dealloc, pysqlite_prepare_protocol_dealloc},
+    {Py_tp_init, pysqlite_prepare_protocol_init},
+    {Py_tp_traverse, pysqlite_prepare_protocol_traverse},
+    {0, NULL},
 };
 
-extern int pysqlite_prepare_protocol_setup_types(void)
+static PyType_Spec type_spec = {
+    .name = MODULE_NAME ".PrepareProtocol",
+    .basicsize = sizeof(pysqlite_PrepareProtocol),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
+              Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = type_slots,
+};
+
+PyTypeObject *pysqlite_PrepareProtocolType = NULL;
+
+int
+pysqlite_prepare_protocol_setup_types(PyObject *module)
 {
-    pysqlite_PrepareProtocolType.tp_new = PyType_GenericNew;
-    Py_SET_TYPE(&pysqlite_PrepareProtocolType, &PyType_Type);
-    return PyType_Ready(&pysqlite_PrepareProtocolType);
+    pysqlite_PrepareProtocolType = (PyTypeObject *)PyType_FromModuleAndSpec(module, &type_spec, NULL);
+    if (pysqlite_PrepareProtocolType == NULL) {
+        return -1;
+    }
+    return 0;
 }
diff --git a/Modules/_sqlite/prepare_protocol.h b/Modules/_sqlite/prepare_protocol.h
index 3998a55..5939613 100644
--- a/Modules/_sqlite/prepare_protocol.h
+++ b/Modules/_sqlite/prepare_protocol.h
@@ -23,20 +23,16 @@
 
 #ifndef PYSQLITE_PREPARE_PROTOCOL_H
 #define PYSQLITE_PREPARE_PROTOCOL_H
-#define PY_SSIZE_T_CLEAN
-#include "Python.h"
+#include "module.h"
 
 typedef struct
 {
     PyObject_HEAD
 } pysqlite_PrepareProtocol;
 
-extern PyTypeObject pysqlite_PrepareProtocolType;
+extern PyTypeObject *pysqlite_PrepareProtocolType;
 
-int pysqlite_prepare_protocol_init(pysqlite_PrepareProtocol* self, PyObject* args, PyObject* kwargs);
-void pysqlite_prepare_protocol_dealloc(pysqlite_PrepareProtocol* self);
-
-int pysqlite_prepare_protocol_setup_types(void);
+int pysqlite_prepare_protocol_setup_types(PyObject *module);
 
 #define UNKNOWN (-1)
 #endif
diff --git a/Modules/_sqlite/row.c b/Modules/_sqlite/row.c
index 4b47108..643194d 100644
--- a/Modules/_sqlite/row.c
+++ b/Modules/_sqlite/row.c
@@ -23,57 +23,74 @@
 
 #include "row.h"
 #include "cursor.h"
+#include "clinic/row.c.h"
 
-void pysqlite_row_dealloc(pysqlite_Row* self)
+/*[clinic input]
+module _sqlite3
+class _sqlite3.Row "pysqlite_Row *" "pysqlite_RowType"
+[clinic start generated code]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=384227da65f250fd]*/
+
+static int
+row_clear(pysqlite_Row *self)
 {
-    Py_XDECREF(self->data);
-    Py_XDECREF(self->description);
-
-    Py_TYPE(self)->tp_free((PyObject*)self);
+    Py_CLEAR(self->data);
+    Py_CLEAR(self->description);
+    return 0;
 }
 
+static int
+row_traverse(pysqlite_Row *self, visitproc visit, void *arg)
+{
+    Py_VISIT(Py_TYPE(self));
+    Py_VISIT(self->data);
+    Py_VISIT(self->description);
+    return 0;
+}
+
+static void
+pysqlite_row_dealloc(PyObject *self)
+{
+    PyTypeObject *tp = Py_TYPE(self);
+    PyObject_GC_UnTrack(self);
+    tp->tp_clear(self);
+    tp->tp_free(self);
+    Py_DECREF(tp);
+}
+
+/*[clinic input]
+@classmethod
+_sqlite3.Row.__new__ as pysqlite_row_new
+
+    cursor: object(type='pysqlite_Cursor *', subclass_of='pysqlite_CursorType')
+    data: object(subclass_of='&PyTuple_Type')
+    /
+
+[clinic start generated code]*/
+
 static PyObject *
-pysqlite_row_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
+pysqlite_row_new_impl(PyTypeObject *type, pysqlite_Cursor *cursor,
+                      PyObject *data)
+/*[clinic end generated code: output=10d58b09a819a4c1 input=f6cd7e6e0935828d]*/
 {
     pysqlite_Row *self;
-    PyObject* data;
-    pysqlite_Cursor* cursor;
 
     assert(type != NULL && type->tp_alloc != NULL);
 
-    if (!_PyArg_NoKeywords("Row", kwargs))
-        return NULL;
-    if (!PyArg_ParseTuple(args, "OO", &cursor, &data))
-        return NULL;
-
-    if (!PyObject_TypeCheck((PyObject*)cursor, &pysqlite_CursorType)) {
-        PyErr_SetString(PyExc_TypeError, "instance of cursor required for first argument");
-        return NULL;
-    }
-
-    if (!PyTuple_Check(data)) {
-        PyErr_SetString(PyExc_TypeError, "tuple required for second argument");
-        return NULL;
-    }
-
     self = (pysqlite_Row *) type->tp_alloc(type, 0);
     if (self == NULL)
         return NULL;
 
-    Py_INCREF(data);
-    self->data = data;
-
-    Py_INCREF(cursor->description);
-    self->description = cursor->description;
+    self->data = Py_NewRef(data);
+    self->description = Py_NewRef(cursor->description);
 
     return (PyObject *) self;
 }
 
 PyObject* pysqlite_row_item(pysqlite_Row* self, Py_ssize_t idx)
 {
-   PyObject* item = PyTuple_GetItem(self->data, idx);
-   Py_XINCREF(item);
-   return item;
+   PyObject *item = PyTuple_GetItem(self->data, idx);
+   return Py_XNewRef(item);
 }
 
 static int
@@ -104,11 +121,11 @@
     return 1;
 }
 
-PyObject* pysqlite_row_subscript(pysqlite_Row* self, PyObject* idx)
+static PyObject *
+pysqlite_row_subscript(pysqlite_Row *self, PyObject *idx)
 {
     Py_ssize_t _idx;
     Py_ssize_t nitems, i;
-    PyObject* item;
 
     if (PyLong_Check(idx)) {
         _idx = PyNumber_AsSsize_t(idx, PyExc_IndexError);
@@ -116,9 +133,9 @@
             return NULL;
         if (_idx < 0)
            _idx += PyTuple_GET_SIZE(self->data);
-        item = PyTuple_GetItem(self->data, _idx);
-        Py_XINCREF(item);
-        return item;
+
+        PyObject *item = PyTuple_GetItem(self->data, _idx);
+        return Py_XNewRef(item);
     } else if (PyUnicode_Check(idx)) {
         nitems = PyTuple_Size(self->description);
 
@@ -132,9 +149,8 @@
             }
             if (eq) {
                 /* found item */
-                item = PyTuple_GetItem(self->data, i);
-                Py_INCREF(item);
-                return item;
+                PyObject *item = PyTuple_GetItem(self->data, i);
+                return Py_XNewRef(item);
             }
         }
 
@@ -156,7 +172,15 @@
     return PyTuple_GET_SIZE(self->data);
 }
 
-PyObject* pysqlite_row_keys(pysqlite_Row* self, PyObject *Py_UNUSED(ignored))
+/*[clinic input]
+_sqlite3.Row.keys as pysqlite_row_keys
+
+Returns the keys of the row.
+[clinic start generated code]*/
+
+static PyObject *
+pysqlite_row_keys_impl(pysqlite_Row *self)
+/*[clinic end generated code: output=efe3dfb3af6edc07 input=7549a122827c5563]*/
 {
     PyObject* list;
     Py_ssize_t nitems, i;
@@ -192,7 +216,7 @@
     if (opid != Py_EQ && opid != Py_NE)
         Py_RETURN_NOTIMPLEMENTED;
 
-    if (PyObject_TypeCheck(_other, &pysqlite_RowType)) {
+    if (PyObject_TypeCheck(_other, pysqlite_RowType)) {
         pysqlite_Row *other = (pysqlite_Row *)_other;
         int eq = PyObject_RichCompareBool(self->description, other->description, Py_EQ);
         if (eq < 0) {
@@ -206,73 +230,43 @@
     Py_RETURN_NOTIMPLEMENTED;
 }
 
-PyMappingMethods pysqlite_row_as_mapping = {
-    /* mp_length        */ (lenfunc)pysqlite_row_length,
-    /* mp_subscript     */ (binaryfunc)pysqlite_row_subscript,
-    /* mp_ass_subscript */ (objobjargproc)0,
-};
-
-static PySequenceMethods pysqlite_row_as_sequence = {
-   /* sq_length */         (lenfunc)pysqlite_row_length,
-   /* sq_concat */         0,
-   /* sq_repeat */         0,
-   /* sq_item */           (ssizeargfunc)pysqlite_row_item,
-};
-
-
-static PyMethodDef pysqlite_row_methods[] = {
-    {"keys", (PyCFunction)pysqlite_row_keys, METH_NOARGS,
-        PyDoc_STR("Returns the keys of the row.")},
+static PyMethodDef row_methods[] = {
+    PYSQLITE_ROW_KEYS_METHODDEF
     {NULL, NULL}
 };
 
-
-PyTypeObject pysqlite_RowType = {
-        PyVarObject_HEAD_INIT(NULL, 0)
-        MODULE_NAME ".Row",                             /* tp_name */
-        sizeof(pysqlite_Row),                           /* tp_basicsize */
-        0,                                              /* tp_itemsize */
-        (destructor)pysqlite_row_dealloc,               /* tp_dealloc */
-        0,                                              /* tp_vectorcall_offset */
-        0,                                              /* tp_getattr */
-        0,                                              /* tp_setattr */
-        0,                                              /* tp_as_async */
-        0,                                              /* tp_repr */
-        0,                                              /* tp_as_number */
-        0,                                              /* tp_as_sequence */
-        0,                                              /* tp_as_mapping */
-        (hashfunc)pysqlite_row_hash,                    /* tp_hash */
-        0,                                              /* tp_call */
-        0,                                              /* tp_str */
-        0,                                              /* tp_getattro */
-        0,                                              /* tp_setattro */
-        0,                                              /* tp_as_buffer */
-        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,         /* tp_flags */
-        0,                                              /* tp_doc */
-        (traverseproc)0,                                /* tp_traverse */
-        0,                                              /* tp_clear */
-        (richcmpfunc)pysqlite_row_richcompare,          /* tp_richcompare */
-        0,                                              /* tp_weaklistoffset */
-        (getiterfunc)pysqlite_iter,                     /* tp_iter */
-        0,                                              /* tp_iternext */
-        pysqlite_row_methods,                           /* tp_methods */
-        0,                                              /* tp_members */
-        0,                                              /* tp_getset */
-        0,                                              /* tp_base */
-        0,                                              /* tp_dict */
-        0,                                              /* tp_descr_get */
-        0,                                              /* tp_descr_set */
-        0,                                              /* tp_dictoffset */
-        0,                                              /* tp_init */
-        0,                                              /* tp_alloc */
-        0,                                              /* tp_new */
-        0                                               /* tp_free */
+static PyType_Slot row_slots[] = {
+    {Py_tp_dealloc, pysqlite_row_dealloc},
+    {Py_tp_hash, pysqlite_row_hash},
+    {Py_tp_methods, row_methods},
+    {Py_tp_richcompare, pysqlite_row_richcompare},
+    {Py_tp_iter, pysqlite_iter},
+    {Py_mp_length, pysqlite_row_length},
+    {Py_mp_subscript, pysqlite_row_subscript},
+    {Py_sq_length, pysqlite_row_length},
+    {Py_sq_item, pysqlite_row_item},
+    {Py_tp_new, pysqlite_row_new},
+    {Py_tp_traverse, row_traverse},
+    {Py_tp_clear, row_clear},
+    {0, NULL},
 };
 
-extern int pysqlite_row_setup_types(void)
+static PyType_Spec row_spec = {
+    .name = MODULE_NAME ".Row",
+    .basicsize = sizeof(pysqlite_Row),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
+              Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = row_slots,
+};
+
+PyTypeObject *pysqlite_RowType = NULL;
+
+int
+pysqlite_row_setup_types(PyObject *module)
 {
-    pysqlite_RowType.tp_new = pysqlite_row_new;
-    pysqlite_RowType.tp_as_mapping = &pysqlite_row_as_mapping;
-    pysqlite_RowType.tp_as_sequence = &pysqlite_row_as_sequence;
-    return PyType_Ready(&pysqlite_RowType);
+    pysqlite_RowType = (PyTypeObject *)PyType_FromModuleAndSpec(module, &row_spec, NULL);
+    if (pysqlite_RowType == NULL) {
+        return -1;
+    }
+    return 0;
 }
diff --git a/Modules/_sqlite/row.h b/Modules/_sqlite/row.h
index 4ad506f..2dac41e 100644
--- a/Modules/_sqlite/row.h
+++ b/Modules/_sqlite/row.h
@@ -33,8 +33,8 @@
     PyObject* description;
 } pysqlite_Row;
 
-extern PyTypeObject pysqlite_RowType;
+extern PyTypeObject *pysqlite_RowType;
 
-int pysqlite_row_setup_types(void);
+int pysqlite_row_setup_types(PyObject *module);
 
 #endif
diff --git a/Modules/_sqlite/statement.c b/Modules/_sqlite/statement.c
index 23c204e..3bc8642 100644
--- a/Modules/_sqlite/statement.c
+++ b/Modules/_sqlite/statement.c
@@ -48,7 +48,8 @@
     TYPE_UNKNOWN
 } parameter_type;
 
-int pysqlite_statement_create(pysqlite_Statement* self, pysqlite_Connection* connection, PyObject* sql)
+pysqlite_Statement *
+pysqlite_statement_create(pysqlite_Connection *connection, PyObject *sql)
 {
     const char* tail;
     int rc;
@@ -56,28 +57,36 @@
     Py_ssize_t sql_cstr_len;
     const char* p;
 
-    self->st = NULL;
-    self->in_use = 0;
-
     assert(PyUnicode_Check(sql));
 
     sql_cstr = PyUnicode_AsUTF8AndSize(sql, &sql_cstr_len);
     if (sql_cstr == NULL) {
-        rc = PYSQLITE_SQL_WRONG_TYPE;
-        return rc;
+        PyErr_Format(pysqlite_Warning,
+                     "SQL is of wrong type ('%s'). Must be string.",
+                     Py_TYPE(sql)->tp_name);
+        return NULL;
     }
     if (strlen(sql_cstr) != (size_t)sql_cstr_len) {
-        PyErr_SetString(PyExc_ValueError, "the query contains a null character");
-        return PYSQLITE_SQL_WRONG_TYPE;
+        PyErr_SetString(PyExc_ValueError,
+                        "the query contains a null character");
+        return NULL;
     }
 
+    pysqlite_Statement *self = PyObject_GC_New(pysqlite_Statement,
+                                               pysqlite_StatementType);
+    if (self == NULL) {
+        return NULL;
+    }
+
+    self->db = connection->db;
+    self->st = NULL;
+    self->sql = Py_NewRef(sql);
+    self->in_use = 0;
+    self->is_dml = 0;
     self->in_weakreflist = NULL;
-    Py_INCREF(sql);
-    self->sql = sql;
 
     /* Determine if the statement is a DML statement.
        SELECT is the only exception. See #9924. */
-    self->is_dml = 0;
     for (p = sql_cstr; *p != 0; p++) {
         switch (*p) {
             case ' ':
@@ -95,22 +104,33 @@
     }
 
     Py_BEGIN_ALLOW_THREADS
-    rc = sqlite3_prepare_v2(connection->db,
+    rc = sqlite3_prepare_v2(self->db,
                             sql_cstr,
                             -1,
                             &self->st,
                             &tail);
     Py_END_ALLOW_THREADS
 
-    self->db = connection->db;
+    PyObject_GC_Track(self);
+
+    if (rc != SQLITE_OK) {
+        _pysqlite_seterror(self->db, NULL);
+        goto error;
+    }
 
     if (rc == SQLITE_OK && pysqlite_check_remaining_sql(tail)) {
         (void)sqlite3_finalize(self->st);
         self->st = NULL;
-        rc = PYSQLITE_TOO_MUCH_SQL;
+        PyErr_SetString(pysqlite_Warning,
+                        "You can only execute one statement at a time.");
+        goto error;
     }
 
-    return rc;
+    return self;
+
+error:
+    Py_DECREF(self);
+    return NULL;
 }
 
 int pysqlite_statement_bind_parameter(pysqlite_Statement* self, int pos, PyObject* parameter)
@@ -152,9 +172,16 @@
                 rc = sqlite3_bind_int64(self->st, pos, value);
             break;
         }
-        case TYPE_FLOAT:
-            rc = sqlite3_bind_double(self->st, pos, PyFloat_AsDouble(parameter));
+        case TYPE_FLOAT: {
+            double value = PyFloat_AsDouble(parameter);
+            if (value == -1 && PyErr_Occurred()) {
+                rc = -1;
+            }
+            else {
+                rc = sqlite3_bind_double(self->st, pos, value);
+            }
             break;
+        }
         case TYPE_UNICODE:
             string = PyUnicode_AsUTF8AndSize(parameter, &buflen);
             if (string == NULL)
@@ -240,11 +267,11 @@
         }
         for (i = 0; i < num_params; i++) {
             if (PyTuple_CheckExact(parameters)) {
-                current_param = PyTuple_GET_ITEM(parameters, i);
-                Py_INCREF(current_param);
+                PyObject *item = PyTuple_GET_ITEM(parameters, i);
+                current_param = Py_NewRef(item);
             } else if (PyList_CheckExact(parameters)) {
-                current_param = PyList_GetItem(parameters, i);
-                Py_XINCREF(current_param);
+                PyObject *item = PyList_GetItem(parameters, i);
+                current_param = Py_XNewRef(item);
             } else {
                 current_param = PySequence_GetItem(parameters, i);
             }
@@ -255,7 +282,7 @@
             if (!_need_adapt(current_param)) {
                 adapted = current_param;
             } else {
-                adapted = pysqlite_microprotocols_adapt(current_param, (PyObject*)&pysqlite_PrepareProtocolType, current_param);
+                adapted = pysqlite_microprotocols_adapt(current_param, (PyObject*)pysqlite_PrepareProtocolType, current_param);
                 Py_DECREF(current_param);
                 if (!adapted) {
                     return;
@@ -290,15 +317,15 @@
                 return;
             }
             if (PyDict_CheckExact(parameters)) {
-                current_param = PyDict_GetItemWithError(parameters, binding_name_obj);
-                Py_XINCREF(current_param);
+                PyObject *item = PyDict_GetItemWithError(parameters, binding_name_obj);
+                current_param = Py_XNewRef(item);
             } else {
                 current_param = PyObject_GetItem(parameters, binding_name_obj);
             }
             Py_DECREF(binding_name_obj);
             if (!current_param) {
                 if (!PyErr_Occurred() || PyErr_ExceptionMatches(PyExc_LookupError)) {
-                    PyErr_Format(pysqlite_ProgrammingError, "You did not supply a value for binding %d.", i);
+                    PyErr_Format(pysqlite_ProgrammingError, "You did not supply a value for binding parameter :%s.", binding_name);
                 }
                 return;
             }
@@ -306,7 +333,7 @@
             if (!_need_adapt(current_param)) {
                 adapted = current_param;
             } else {
-                adapted = pysqlite_microprotocols_adapt(current_param, (PyObject*)&pysqlite_PrepareProtocolType, current_param);
+                adapted = pysqlite_microprotocols_adapt(current_param, (PyObject*)pysqlite_PrepareProtocolType, current_param);
                 Py_DECREF(current_param);
                 if (!adapted) {
                     return;
@@ -369,23 +396,38 @@
     self->in_use = 1;
 }
 
-void pysqlite_statement_dealloc(pysqlite_Statement* self)
+static void
+stmt_dealloc(pysqlite_Statement *self)
 {
+    PyTypeObject *tp = Py_TYPE(self);
+    PyObject_GC_UnTrack(self);
+    if (self->in_weakreflist != NULL) {
+        PyObject_ClearWeakRefs((PyObject*)self);
+    }
     if (self->st) {
         Py_BEGIN_ALLOW_THREADS
         sqlite3_finalize(self->st);
         Py_END_ALLOW_THREADS
+        self->st = 0;
     }
+    tp->tp_clear((PyObject *)self);
+    tp->tp_free(self);
+    Py_DECREF(tp);
+}
 
-    self->st = NULL;
+static int
+stmt_clear(pysqlite_Statement *self)
+{
+    Py_CLEAR(self->sql);
+    return 0;
+}
 
-    Py_XDECREF(self->sql);
-
-    if (self->in_weakreflist != NULL) {
-        PyObject_ClearWeakRefs((PyObject*)self);
-    }
-
-    Py_TYPE(self)->tp_free((PyObject*)self);
+static int
+stmt_traverse(pysqlite_Statement *self, visitproc visit, void *arg)
+{
+    Py_VISIT(Py_TYPE(self));
+    Py_VISIT(self->sql);
+    return 0;
 }
 
 /*
@@ -458,50 +500,33 @@
     return 0;
 }
 
-PyTypeObject pysqlite_StatementType = {
-        PyVarObject_HEAD_INIT(NULL, 0)
-        MODULE_NAME ".Statement",                       /* tp_name */
-        sizeof(pysqlite_Statement),                     /* tp_basicsize */
-        0,                                              /* tp_itemsize */
-        (destructor)pysqlite_statement_dealloc,         /* tp_dealloc */
-        0,                                              /* tp_vectorcall_offset */
-        0,                                              /* tp_getattr */
-        0,                                              /* tp_setattr */
-        0,                                              /* tp_as_async */
-        0,                                              /* tp_repr */
-        0,                                              /* tp_as_number */
-        0,                                              /* tp_as_sequence */
-        0,                                              /* tp_as_mapping */
-        0,                                              /* tp_hash */
-        0,                                              /* tp_call */
-        0,                                              /* tp_str */
-        0,                                              /* tp_getattro */
-        0,                                              /* tp_setattro */
-        0,                                              /* tp_as_buffer */
-        Py_TPFLAGS_DEFAULT,                             /* tp_flags */
-        0,                                              /* tp_doc */
-        0,                                              /* tp_traverse */
-        0,                                              /* tp_clear */
-        0,                                              /* tp_richcompare */
-        offsetof(pysqlite_Statement, in_weakreflist),   /* tp_weaklistoffset */
-        0,                                              /* tp_iter */
-        0,                                              /* tp_iternext */
-        0,                                              /* tp_methods */
-        0,                                              /* tp_members */
-        0,                                              /* tp_getset */
-        0,                                              /* tp_base */
-        0,                                              /* tp_dict */
-        0,                                              /* tp_descr_get */
-        0,                                              /* tp_descr_set */
-        0,                                              /* tp_dictoffset */
-        (initproc)0,                                    /* tp_init */
-        0,                                              /* tp_alloc */
-        0,                                              /* tp_new */
-        0                                               /* tp_free */
+static PyMemberDef stmt_members[] = {
+    {"__weaklistoffset__", T_PYSSIZET, offsetof(pysqlite_Statement, in_weakreflist), READONLY},
+    {NULL},
+};
+static PyType_Slot stmt_slots[] = {
+    {Py_tp_members, stmt_members},
+    {Py_tp_dealloc, stmt_dealloc},
+    {Py_tp_traverse, stmt_traverse},
+    {Py_tp_clear, stmt_clear},
+    {0, NULL},
 };
 
-extern int pysqlite_statement_setup_types(void)
+static PyType_Spec stmt_spec = {
+    .name = MODULE_NAME ".Statement",
+    .basicsize = sizeof(pysqlite_Statement),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
+              Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION),
+    .slots = stmt_slots,
+};
+PyTypeObject *pysqlite_StatementType = NULL;
+
+int
+pysqlite_statement_setup_types(PyObject *module)
 {
-    pysqlite_StatementType.tp_new = PyType_GenericNew;
-    return PyType_Ready(&pysqlite_StatementType);
+    pysqlite_StatementType = (PyTypeObject *)PyType_FromModuleAndSpec(module, &stmt_spec, NULL);
+    if (pysqlite_StatementType == NULL) {
+        return -1;
+    }
+    return 0;
 }
diff --git a/Modules/_sqlite/statement.h b/Modules/_sqlite/statement.h
index 5002f02..e8c86a0 100644
--- a/Modules/_sqlite/statement.h
+++ b/Modules/_sqlite/statement.h
@@ -29,9 +29,6 @@
 #include "connection.h"
 #include "sqlite3.h"
 
-#define PYSQLITE_TOO_MUCH_SQL (-100)
-#define PYSQLITE_SQL_WRONG_TYPE (-101)
-
 typedef struct
 {
     PyObject_HEAD
@@ -43,10 +40,9 @@
     PyObject* in_weakreflist; /* List of weak references */
 } pysqlite_Statement;
 
-extern PyTypeObject pysqlite_StatementType;
+extern PyTypeObject *pysqlite_StatementType;
 
-int pysqlite_statement_create(pysqlite_Statement* self, pysqlite_Connection* connection, PyObject* sql);
-void pysqlite_statement_dealloc(pysqlite_Statement* self);
+pysqlite_Statement *pysqlite_statement_create(pysqlite_Connection *connection, PyObject *sql);
 
 int pysqlite_statement_bind_parameter(pysqlite_Statement* self, int pos, PyObject* parameter);
 void pysqlite_statement_bind_parameters(pysqlite_Statement* self, PyObject* parameters);
@@ -55,6 +51,6 @@
 int pysqlite_statement_reset(pysqlite_Statement* self);
 void pysqlite_statement_mark_dirty(pysqlite_Statement* self);
 
-int pysqlite_statement_setup_types(void);
+int pysqlite_statement_setup_types(PyObject *module);
 
 #endif
diff --git a/Modules/_sqlite/util.c b/Modules/_sqlite/util.c
index 1dbabcd..0f4eba0 100644
--- a/Modules/_sqlite/util.c
+++ b/Modules/_sqlite/util.c
@@ -28,15 +28,9 @@
 {
     int rc;
 
-    if (statement == NULL) {
-        /* this is a workaround for SQLite 3.5 and later. it now apparently
-         * returns NULL for "no-operation" statements */
-        rc = SQLITE_OK;
-    } else {
-        Py_BEGIN_ALLOW_THREADS
-        rc = sqlite3_step(statement);
-        Py_END_ALLOW_THREADS
-    }
+    Py_BEGIN_ALLOW_THREADS
+    rc = sqlite3_step(statement);
+    Py_END_ALLOW_THREADS
 
     return rc;
 }
diff --git a/Modules/_sqlite/util.h b/Modules/_sqlite/util.h
index c5a220e..cff31cd 100644
--- a/Modules/_sqlite/util.h
+++ b/Modules/_sqlite/util.h
@@ -39,10 +39,4 @@
 
 sqlite_int64 _pysqlite_long_as_int64(PyObject * value);
 
-#if SQLITE_VERSION_NUMBER >= 3007014
-#define SQLITE3_CLOSE sqlite3_close_v2
-#else
-#define SQLITE3_CLOSE sqlite3_close
-#endif
-
 #endif
diff --git a/Modules/_sre.c b/Modules/_sre.c
index 244e4f1..d21b533 100644
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -15,7 +15,7 @@
  * 2001-05-14 fl   fixes for 1.5.2 compatibility
  * 2001-07-01 fl   added BIGCHARSET support (from Martin von Loewis)
  * 2001-10-18 fl   fixed group reset issue (from Matthew Mueller)
- * 2001-10-20 fl   added split primitive; reenable unicode for 1.6/2.0/2.1
+ * 2001-10-20 fl   added split primitive; re-enable unicode for 1.6/2.0/2.1
  * 2001-10-21 fl   added sub/subn primitive
  * 2001-10-24 fl   added finditer primitive (for 2.2 only)
  * 2001-12-07 fl   fixed memory leak in sub/subn (Guido van Rossum)
@@ -41,6 +41,8 @@
 #define PY_SSIZE_T_CLEAN
 
 #include "Python.h"
+#include "pycore_long.h"          // _PyLong_GetZero()
+#include "pycore_moduleobject.h"  // _PyModule_GetState()
 #include "structmember.h"         // PyMemberDef
 
 #include "sre.h"
@@ -196,7 +198,7 @@
 data_stack_dealloc(SRE_STATE* state)
 {
     if (state->data_stack) {
-        PyMem_FREE(state->data_stack);
+        PyMem_Free(state->data_stack);
         state->data_stack = NULL;
     }
     state->data_stack_size = state->data_stack_base = 0;
@@ -211,8 +213,8 @@
     if (cursize < minsize) {
         void* stack;
         cursize = minsize+minsize/4+1024;
-        TRACE(("allocate/grow stack %" PY_FORMAT_SIZE_T "d\n", cursize));
-        stack = PyMem_REALLOC(state->data_stack, cursize);
+        TRACE(("allocate/grow stack %zd\n", cursize));
+        stack = PyMem_Realloc(state->data_stack, cursize);
         if (!stack) {
             data_stack_dealloc(state);
             return SRE_ERROR_MEMORY;
@@ -247,22 +249,36 @@
 /* -------------------------------------------------------------------- */
 /* factories and destructors */
 
-/* see sre.h for object declarations */
-static PyObject*pattern_new_match(PatternObject*, SRE_STATE*, Py_ssize_t);
-static PyObject *pattern_scanner(PatternObject *, PyObject *, Py_ssize_t, Py_ssize_t);
+/* module state */
+typedef struct {
+    PyTypeObject *Pattern_Type;
+    PyTypeObject *Match_Type;
+    PyTypeObject *Scanner_Type;
+} _sremodulestate;
 
+static _sremodulestate *
+get_sre_module_state(PyObject *m)
+{
+    _sremodulestate *state = (_sremodulestate *)_PyModule_GetState(m);
+    assert(state);
+    return state;
+}
+
+static struct PyModuleDef sremodule;
+#define get_sre_module_state_by_class(cls) \
+    (get_sre_module_state(PyType_GetModule(cls)))
+
+/* see sre.h for object declarations */
+static PyObject*pattern_new_match(_sremodulestate *, PatternObject*, SRE_STATE*, Py_ssize_t);
+static PyObject *pattern_scanner(_sremodulestate *, PatternObject *, PyObject *, Py_ssize_t, Py_ssize_t);
 
 /*[clinic input]
 module _sre
-class _sre.SRE_Pattern "PatternObject *" "&Pattern_Type"
-class _sre.SRE_Match "MatchObject *" "&Match_Type"
-class _sre.SRE_Scanner "ScannerObject *" "&Scanner_Type"
+class _sre.SRE_Pattern "PatternObject *" "get_sre_module_state_by_class(tp)->Pattern_Type"
+class _sre.SRE_Match "MatchObject *" "get_sre_module_state_by_class(tp)->Match_Type"
+class _sre.SRE_Scanner "ScannerObject *" "get_sre_module_state_by_class(tp)->Scanner_Type"
 [clinic start generated code]*/
-/*[clinic end generated code: output=da39a3ee5e6b4b0d input=b0230ec19a0deac8]*/
-
-static PyTypeObject Pattern_Type;
-static PyTypeObject Match_Type;
-static PyTypeObject Scanner_Type;
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=fe2966e32b66a231]*/
 
 /*[clinic input]
 _sre.getcodesize -> int
@@ -454,7 +470,10 @@
 
     return string;
   err:
-    PyMem_Del(state->mark);
+    /* We add an explicit cast here because MSVC has a bug when
+       compiling C code where it believes that `const void**` cannot be
+       safely casted to `void*`, see bpo-39943 for details. */
+    PyMem_Free((void*) state->mark);
     state->mark = NULL;
     if (state->buffer.buf)
         PyBuffer_Release(&state->buffer);
@@ -468,7 +487,8 @@
         PyBuffer_Release(&state->buffer);
     Py_XDECREF(state->string);
     data_stack_dealloc(state);
-    PyMem_Del(state->mark);
+    /* See above PyMem_Del for why we explicitly cast here. */
+    PyMem_Free((void*) state->mark);
     state->mark = NULL;
 }
 
@@ -542,15 +562,37 @@
     }
 }
 
+static int
+pattern_traverse(PatternObject *self, visitproc visit, void *arg)
+{
+    Py_VISIT(Py_TYPE(self));
+    Py_VISIT(self->groupindex);
+    Py_VISIT(self->indexgroup);
+    Py_VISIT(self->pattern);
+    return 0;
+}
+
+static int
+pattern_clear(PatternObject *self)
+{
+    Py_CLEAR(self->groupindex);
+    Py_CLEAR(self->indexgroup);
+    Py_CLEAR(self->pattern);
+    return 0;
+}
+
 static void
 pattern_dealloc(PatternObject* self)
 {
-    if (self->weakreflist != NULL)
+    PyTypeObject *tp = Py_TYPE(self);
+
+    PyObject_GC_UnTrack(self);
+    if (self->weakreflist != NULL) {
         PyObject_ClearWeakRefs((PyObject *) self);
-    Py_XDECREF(self->pattern);
-    Py_XDECREF(self->groupindex);
-    Py_XDECREF(self->indexgroup);
-    PyObject_DEL(self);
+    }
+    (void)pattern_clear(self);
+    tp->tp_free(self);
+    Py_DECREF(tp);
 }
 
 LOCAL(Py_ssize_t)
@@ -578,6 +620,8 @@
 /*[clinic input]
 _sre.SRE_Pattern.match
 
+    cls: defining_class
+    /
     string: object
     pos: Py_ssize_t = 0
     endpos: Py_ssize_t(c_default="PY_SSIZE_T_MAX") = sys.maxsize
@@ -586,10 +630,12 @@
 [clinic start generated code]*/
 
 static PyObject *
-_sre_SRE_Pattern_match_impl(PatternObject *self, PyObject *string,
-                            Py_ssize_t pos, Py_ssize_t endpos)
-/*[clinic end generated code: output=ea2d838888510661 input=a2ba191647abebe5]*/
+_sre_SRE_Pattern_match_impl(PatternObject *self, PyTypeObject *cls,
+                            PyObject *string, Py_ssize_t pos,
+                            Py_ssize_t endpos)
+/*[clinic end generated code: output=ec6208ea58a0cca0 input=4bdb9c3e564d13ac]*/
 {
+    _sremodulestate *module_state = get_sre_module_state_by_class(cls);
     SRE_STATE state;
     Py_ssize_t status;
     PyObject *match;
@@ -609,7 +655,7 @@
         return NULL;
     }
 
-    match = pattern_new_match(self, &state, status);
+    match = pattern_new_match(module_state, self, &state, status);
     state_fini(&state);
     return match;
 }
@@ -617,6 +663,8 @@
 /*[clinic input]
 _sre.SRE_Pattern.fullmatch
 
+    cls: defining_class
+    /
     string: object
     pos: Py_ssize_t = 0
     endpos: Py_ssize_t(c_default="PY_SSIZE_T_MAX") = sys.maxsize
@@ -625,10 +673,12 @@
 [clinic start generated code]*/
 
 static PyObject *
-_sre_SRE_Pattern_fullmatch_impl(PatternObject *self, PyObject *string,
-                                Py_ssize_t pos, Py_ssize_t endpos)
-/*[clinic end generated code: output=5833c47782a35f4a input=d9fb03a7625b5828]*/
+_sre_SRE_Pattern_fullmatch_impl(PatternObject *self, PyTypeObject *cls,
+                                PyObject *string, Py_ssize_t pos,
+                                Py_ssize_t endpos)
+/*[clinic end generated code: output=625b75b027ef94da input=50981172ab0fcfdd]*/
 {
+    _sremodulestate *module_state = get_sre_module_state_by_class(cls);
     SRE_STATE state;
     Py_ssize_t status;
     PyObject *match;
@@ -649,7 +699,7 @@
         return NULL;
     }
 
-    match = pattern_new_match(self, &state, status);
+    match = pattern_new_match(module_state, self, &state, status);
     state_fini(&state);
     return match;
 }
@@ -657,6 +707,8 @@
 /*[clinic input]
 _sre.SRE_Pattern.search
 
+    cls: defining_class
+    /
     string: object
     pos: Py_ssize_t = 0
     endpos: Py_ssize_t(c_default="PY_SSIZE_T_MAX") = sys.maxsize
@@ -667,10 +719,12 @@
 [clinic start generated code]*/
 
 static PyObject *
-_sre_SRE_Pattern_search_impl(PatternObject *self, PyObject *string,
-                             Py_ssize_t pos, Py_ssize_t endpos)
-/*[clinic end generated code: output=25f302a644e951e8 input=4ae5cb7dc38fed1b]*/
+_sre_SRE_Pattern_search_impl(PatternObject *self, PyTypeObject *cls,
+                             PyObject *string, Py_ssize_t pos,
+                             Py_ssize_t endpos)
+/*[clinic end generated code: output=bd7f2d9d583e1463 input=afa9afb66a74a4b3]*/
 {
+    _sremodulestate *module_state = get_sre_module_state_by_class(cls);
     SRE_STATE state;
     Py_ssize_t status;
     PyObject *match;
@@ -689,7 +743,7 @@
         return NULL;
     }
 
-    match = pattern_new_match(self, &state, status);
+    match = pattern_new_match(module_state, self, &state, status);
     state_fini(&state);
     return match;
 }
@@ -821,6 +875,8 @@
 /*[clinic input]
 _sre.SRE_Pattern.finditer
 
+    cls: defining_class
+    /
     string: object
     pos: Py_ssize_t = 0
     endpos: Py_ssize_t(c_default="PY_SSIZE_T_MAX") = sys.maxsize
@@ -831,15 +887,17 @@
 [clinic start generated code]*/
 
 static PyObject *
-_sre_SRE_Pattern_finditer_impl(PatternObject *self, PyObject *string,
-                               Py_ssize_t pos, Py_ssize_t endpos)
-/*[clinic end generated code: output=0bbb1a0aeb38bb14 input=612aab69e9fe08e4]*/
+_sre_SRE_Pattern_finditer_impl(PatternObject *self, PyTypeObject *cls,
+                               PyObject *string, Py_ssize_t pos,
+                               Py_ssize_t endpos)
+/*[clinic end generated code: output=1791dbf3618ade56 input=812e332a4848cbaf]*/
 {
+    _sremodulestate *module_state = get_sre_module_state_by_class(cls);
     PyObject* scanner;
     PyObject* search;
     PyObject* iterator;
 
-    scanner = pattern_scanner(self, string, pos, endpos);
+    scanner = pattern_scanner(module_state, self, string, pos, endpos);
     if (!scanner)
         return NULL;
 
@@ -857,6 +915,8 @@
 /*[clinic input]
 _sre.SRE_Pattern.scanner
 
+    cls: defining_class
+    /
     string: object
     pos: Py_ssize_t = 0
     endpos: Py_ssize_t(c_default="PY_SSIZE_T_MAX") = sys.maxsize
@@ -864,11 +924,14 @@
 [clinic start generated code]*/
 
 static PyObject *
-_sre_SRE_Pattern_scanner_impl(PatternObject *self, PyObject *string,
-                              Py_ssize_t pos, Py_ssize_t endpos)
-/*[clinic end generated code: output=54ea548aed33890b input=3aacdbde77a3a637]*/
+_sre_SRE_Pattern_scanner_impl(PatternObject *self, PyTypeObject *cls,
+                              PyObject *string, Py_ssize_t pos,
+                              Py_ssize_t endpos)
+/*[clinic end generated code: output=f70cd506112f1bd9 input=2e487e5151bcee4c]*/
 {
-    return pattern_scanner(self, string, pos, endpos);
+    _sremodulestate *module_state = get_sre_module_state_by_class(cls);
+
+    return pattern_scanner(module_state, self, string, pos, endpos);
 }
 
 /*[clinic input]
@@ -975,8 +1038,12 @@
 }
 
 static PyObject*
-pattern_subx(PatternObject* self, PyObject* ptemplate, PyObject* string,
-             Py_ssize_t count, Py_ssize_t subn)
+pattern_subx(_sremodulestate* module_state,
+             PatternObject* self,
+             PyObject* ptemplate,
+             PyObject* string,
+             Py_ssize_t count,
+             Py_ssize_t subn)
 {
     SRE_STATE state;
     PyObject* list;
@@ -1078,7 +1145,7 @@
 
         if (filter_is_callable) {
             /* pass match object through filter */
-            match = pattern_new_match(self, &state, 1);
+            match = pattern_new_match(module_state, self, &state, 1);
             if (!match)
                 goto error;
             item = PyObject_CallOneArg(filter, match);
@@ -1158,6 +1225,8 @@
 /*[clinic input]
 _sre.SRE_Pattern.sub
 
+    cls: defining_class
+    /
     repl: object
     string: object
     count: Py_ssize_t = 0
@@ -1166,16 +1235,20 @@
 [clinic start generated code]*/
 
 static PyObject *
-_sre_SRE_Pattern_sub_impl(PatternObject *self, PyObject *repl,
-                          PyObject *string, Py_ssize_t count)
-/*[clinic end generated code: output=1dbf2ec3479cba00 input=c53d70be0b3caf86]*/
+_sre_SRE_Pattern_sub_impl(PatternObject *self, PyTypeObject *cls,
+                          PyObject *repl, PyObject *string, Py_ssize_t count)
+/*[clinic end generated code: output=4be141ab04bca60d input=d8d1d4ac2311a07c]*/
 {
-    return pattern_subx(self, repl, string, count, 0);
+    _sremodulestate *module_state = get_sre_module_state_by_class(cls);
+
+    return pattern_subx(module_state, self, repl, string, count, 0);
 }
 
 /*[clinic input]
 _sre.SRE_Pattern.subn
 
+    cls: defining_class
+    /
     repl: object
     string: object
     count: Py_ssize_t = 0
@@ -1184,11 +1257,14 @@
 [clinic start generated code]*/
 
 static PyObject *
-_sre_SRE_Pattern_subn_impl(PatternObject *self, PyObject *repl,
-                           PyObject *string, Py_ssize_t count)
-/*[clinic end generated code: output=0d9522cd529e9728 input=e7342d7ce6083577]*/
+_sre_SRE_Pattern_subn_impl(PatternObject *self, PyTypeObject *cls,
+                           PyObject *repl, PyObject *string,
+                           Py_ssize_t count)
+/*[clinic end generated code: output=da02fd85258b1e1f input=8b78a65b8302e58d]*/
 {
-    return pattern_subx(self, repl, string, count, 1);
+    _sremodulestate *module_state = get_sre_module_state_by_class(cls);
+
+    return pattern_subx(module_state, self, repl, string, count, 1);
 }
 
 /*[clinic input]
@@ -1333,12 +1409,13 @@
 {
     /* "compile" pattern descriptor to pattern object */
 
+    _sremodulestate *module_state = get_sre_module_state(module);
     PatternObject* self;
     Py_ssize_t i, n;
 
     n = PyList_GET_SIZE(code);
     /* coverity[ampersand_in_size] */
-    self = PyObject_NewVar(PatternObject, &Pattern_Type, n);
+    self = PyObject_GC_NewVar(PatternObject, module_state->Pattern_Type, n);
     if (!self)
         return NULL;
     self->weakreflist = NULL;
@@ -1358,6 +1435,7 @@
             break;
         }
     }
+    PyObject_GC_Track(self);
 
     if (PyErr_Occurred()) {
         Py_DECREF(self);
@@ -1879,13 +1957,34 @@
 /* -------------------------------------------------------------------- */
 /* match methods */
 
+static int
+match_traverse(MatchObject *self, visitproc visit, void *arg)
+{
+    Py_VISIT(Py_TYPE(self));
+    Py_VISIT(self->string);
+    Py_VISIT(self->regs);
+    Py_VISIT(self->pattern);
+    return 0;
+}
+
+static int
+match_clear(MatchObject *self)
+{
+    Py_CLEAR(self->string);
+    Py_CLEAR(self->regs);
+    Py_CLEAR(self->pattern);
+    return 0;
+}
+
 static void
 match_dealloc(MatchObject* self)
 {
-    Py_XDECREF(self->regs);
-    Py_XDECREF(self->string);
-    Py_DECREF(self->pattern);
-    PyObject_DEL(self);
+    PyTypeObject *tp = Py_TYPE(self);
+
+    PyObject_GC_UnTrack(self);
+    (void)match_clear(self);
+    tp->tp_free(self);
+    Py_DECREF(tp);
 }
 
 static PyObject*
@@ -1995,7 +2094,7 @@
 
     switch (size) {
     case 0:
-        result = match_getslice(self, _PyLong_Zero, Py_None);
+        result = match_getslice(self, _PyLong_GetZero(), Py_None);
         break;
     case 1:
         result = match_getslice(self, PyTuple_GET_ITEM(args, 0), Py_None);
@@ -2314,7 +2413,10 @@
 
 
 static PyObject*
-pattern_new_match(PatternObject* pattern, SRE_STATE* state, Py_ssize_t status)
+pattern_new_match(_sremodulestate* module_state,
+                  PatternObject* pattern,
+                  SRE_STATE* state,
+                  Py_ssize_t status)
 {
     /* create match object (from state object) */
 
@@ -2327,8 +2429,9 @@
 
         /* create match object (with room for extra group marks) */
         /* coverity[ampersand_in_size] */
-        match = PyObject_NewVar(MatchObject, &Match_Type,
-                                2*(pattern->groups+1));
+        match = PyObject_GC_NewVar(MatchObject,
+                                   module_state->Match_Type,
+                                   2*(pattern->groups+1));
         if (!match)
             return NULL;
 
@@ -2361,6 +2464,7 @@
 
         match->lastindex = state->lastindex;
 
+        PyObject_GC_Track(match);
         return (PyObject*) match;
 
     } else if (status == 0) {
@@ -2379,23 +2483,46 @@
 /* -------------------------------------------------------------------- */
 /* scanner methods (experimental) */
 
+static int
+scanner_traverse(ScannerObject *self, visitproc visit, void *arg)
+{
+    Py_VISIT(Py_TYPE(self));
+    Py_VISIT(self->pattern);
+    return 0;
+}
+
+static int
+scanner_clear(ScannerObject *self)
+{
+    Py_CLEAR(self->pattern);
+    return 0;
+}
+
 static void
 scanner_dealloc(ScannerObject* self)
 {
+    PyTypeObject *tp = Py_TYPE(self);
+
+    PyObject_GC_UnTrack(self);
     state_fini(&self->state);
-    Py_XDECREF(self->pattern);
-    PyObject_DEL(self);
+    (void)scanner_clear(self);
+    tp->tp_free(self);
+    Py_DECREF(tp);
 }
 
 /*[clinic input]
 _sre.SRE_Scanner.match
 
+    cls: defining_class
+    /
+
 [clinic start generated code]*/
 
 static PyObject *
-_sre_SRE_Scanner_match_impl(ScannerObject *self)
-/*[clinic end generated code: output=936b30c63d4b81eb input=881a0154f8c13d9a]*/
+_sre_SRE_Scanner_match_impl(ScannerObject *self, PyTypeObject *cls)
+/*[clinic end generated code: output=6e22c149dc0f0325 input=b5146e1f30278cb7]*/
 {
+    _sremodulestate *module_state = get_sre_module_state_by_class(cls);
     SRE_STATE* state = &self->state;
     PyObject* match;
     Py_ssize_t status;
@@ -2411,8 +2538,8 @@
     if (PyErr_Occurred())
         return NULL;
 
-    match = pattern_new_match((PatternObject*) self->pattern,
-                               state, status);
+    match = pattern_new_match(module_state, (PatternObject*) self->pattern,
+                              state, status);
 
     if (status == 0)
         state->start = NULL;
@@ -2428,12 +2555,16 @@
 /*[clinic input]
 _sre.SRE_Scanner.search
 
+    cls: defining_class
+    /
+
 [clinic start generated code]*/
 
 static PyObject *
-_sre_SRE_Scanner_search_impl(ScannerObject *self)
-/*[clinic end generated code: output=7dc211986088f025 input=161223ee92ef9270]*/
+_sre_SRE_Scanner_search_impl(ScannerObject *self, PyTypeObject *cls)
+/*[clinic end generated code: output=23e8fc78013f9161 input=056c2d37171d0bf2]*/
 {
+    _sremodulestate *module_state = get_sre_module_state_by_class(cls);
     SRE_STATE* state = &self->state;
     PyObject* match;
     Py_ssize_t status;
@@ -2449,8 +2580,8 @@
     if (PyErr_Occurred())
         return NULL;
 
-    match = pattern_new_match((PatternObject*) self->pattern,
-                               state, status);
+    match = pattern_new_match(module_state, (PatternObject*) self->pattern,
+                              state, status);
 
     if (status == 0)
         state->start = NULL;
@@ -2463,12 +2594,16 @@
 }
 
 static PyObject *
-pattern_scanner(PatternObject *self, PyObject *string, Py_ssize_t pos, Py_ssize_t endpos)
+pattern_scanner(_sremodulestate *module_state,
+                PatternObject *self,
+                PyObject *string,
+                Py_ssize_t pos,
+                Py_ssize_t endpos)
 {
     ScannerObject* scanner;
 
     /* create scanner object */
-    scanner = PyObject_New(ScannerObject, &Scanner_Type);
+    scanner = PyObject_GC_New(ScannerObject, module_state->Scanner_Type);
     if (!scanner)
         return NULL;
     scanner->pattern = NULL;
@@ -2482,6 +2617,7 @@
     Py_INCREF(self);
     scanner->pattern = (PyObject*) self;
 
+    PyObject_GC_Track(scanner);
     return (PyObject*) scanner;
 }
 
@@ -2511,6 +2647,8 @@
 static PyObject*
 pattern_richcompare(PyObject *lefto, PyObject *righto, int op)
 {
+    PyTypeObject *tp = Py_TYPE(lefto);
+    _sremodulestate *module_state = get_sre_module_state_by_class(tp);
     PatternObject *left, *right;
     int cmp;
 
@@ -2518,7 +2656,8 @@
         Py_RETURN_NOTIMPLEMENTED;
     }
 
-    if (!Py_IS_TYPE(lefto, &Pattern_Type) || !Py_IS_TYPE(righto, &Pattern_Type)) {
+    if (!Py_IS_TYPE(righto, module_state->Pattern_Type))
+    {
         Py_RETURN_NOTIMPLEMENTED;
     }
 
@@ -2587,47 +2726,31 @@
      "The regex matching flags."},
     {"groups",     T_PYSSIZET,  PAT_OFF(groups),        READONLY,
      "The number of capturing groups in the pattern."},
+    {"__weaklistoffset__", T_PYSSIZET, offsetof(PatternObject, weakreflist), READONLY},
     {NULL}  /* Sentinel */
 };
 
-static PyTypeObject Pattern_Type = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "re.Pattern",
-    sizeof(PatternObject), sizeof(SRE_CODE),
-    (destructor)pattern_dealloc,        /* tp_dealloc */
-    0,                                  /* tp_vectorcall_offset */
-    0,                                  /* tp_getattr */
-    0,                                  /* tp_setattr */
-    0,                                  /* tp_as_async */
-    (reprfunc)pattern_repr,             /* tp_repr */
-    0,                                  /* tp_as_number */
-    0,                                  /* tp_as_sequence */
-    0,                                  /* tp_as_mapping */
-    (hashfunc)pattern_hash,             /* tp_hash */
-    0,                                  /* tp_call */
-    0,                                  /* tp_str */
-    0,                                  /* tp_getattro */
-    0,                                  /* tp_setattro */
-    0,                                  /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT,                 /* tp_flags */
-    pattern_doc,                        /* tp_doc */
-    0,                                  /* tp_traverse */
-    0,                                  /* tp_clear */
-    pattern_richcompare,                /* tp_richcompare */
-    offsetof(PatternObject, weakreflist),       /* tp_weaklistoffset */
-    0,                                  /* tp_iter */
-    0,                                  /* tp_iternext */
-    pattern_methods,                    /* tp_methods */
-    pattern_members,                    /* tp_members */
-    pattern_getset,                     /* tp_getset */
+static PyType_Slot pattern_slots[] = {
+    {Py_tp_dealloc, (destructor)pattern_dealloc},
+    {Py_tp_repr, (reprfunc)pattern_repr},
+    {Py_tp_hash, (hashfunc)pattern_hash},
+    {Py_tp_doc, (void *)pattern_doc},
+    {Py_tp_richcompare, pattern_richcompare},
+    {Py_tp_methods, pattern_methods},
+    {Py_tp_members, pattern_members},
+    {Py_tp_getset, pattern_getset},
+    {Py_tp_traverse, pattern_traverse},
+    {Py_tp_clear, pattern_clear},
+    {0, NULL},
 };
 
-/* Match objects do not support length or assignment, but do support
-   __getitem__. */
-static PyMappingMethods match_as_mapping = {
-    NULL,
-    (binaryfunc)match_getitem,
-    NULL
+static PyType_Spec pattern_spec = {
+    .name = "re.Pattern",
+    .basicsize = sizeof(PatternObject),
+    .itemsize = sizeof(SRE_CODE),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE |
+              Py_TPFLAGS_DISALLOW_INSTANTIATION | Py_TPFLAGS_HAVE_GC),
+    .slots = pattern_slots,
 };
 
 static PyMethodDef match_methods[] = {
@@ -2669,37 +2792,33 @@
 
 /* FIXME: implement setattr("string", None) as a special case (to
    detach the associated string, if any */
+static PyType_Slot match_slots[] = {
+    {Py_tp_dealloc, match_dealloc},
+    {Py_tp_repr, match_repr},
+    {Py_tp_doc, (void *)match_doc},
+    {Py_tp_methods, match_methods},
+    {Py_tp_members, match_members},
+    {Py_tp_getset, match_getset},
+    {Py_tp_traverse, match_traverse},
+    {Py_tp_clear, match_clear},
 
-static PyTypeObject Match_Type = {
-    PyVarObject_HEAD_INIT(NULL,0)
-    "re.Match",
-    sizeof(MatchObject), sizeof(Py_ssize_t),
-    (destructor)match_dealloc,  /* tp_dealloc */
-    0,                          /* tp_vectorcall_offset */
-    0,                          /* tp_getattr */
-    0,                          /* tp_setattr */
-    0,                          /* tp_as_async */
-    (reprfunc)match_repr,       /* tp_repr */
-    0,                          /* tp_as_number */
-    0,                          /* tp_as_sequence */
-    &match_as_mapping,          /* tp_as_mapping */
-    0,                          /* tp_hash */
-    0,                          /* tp_call */
-    0,                          /* tp_str */
-    0,                          /* tp_getattro */
-    0,                          /* tp_setattro */
-    0,                          /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT,         /* tp_flags */
-    match_doc,                  /* tp_doc */
-    0,                          /* tp_traverse */
-    0,                          /* tp_clear */
-    0,                          /* tp_richcompare */
-    0,                          /* tp_weaklistoffset */
-    0,                          /* tp_iter */
-    0,                          /* tp_iternext */
-    match_methods,              /* tp_methods */
-    match_members,              /* tp_members */
-    match_getset,               /* tp_getset */
+    /* As mapping.
+     *
+     * Match objects do not support length or assignment, but do support
+     * __getitem__.
+     */
+    {Py_mp_subscript, match_getitem},
+
+    {0, NULL},
+};
+
+static PyType_Spec match_spec = {
+    .name = "re.Match",
+    .basicsize = sizeof(MatchObject),
+    .itemsize = sizeof(Py_ssize_t),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE |
+              Py_TPFLAGS_DISALLOW_INSTANTIATION | Py_TPFLAGS_HAVE_GC),
+    .slots = match_slots,
 };
 
 static PyMethodDef scanner_methods[] = {
@@ -2714,36 +2833,21 @@
     {NULL}  /* Sentinel */
 };
 
-static PyTypeObject Scanner_Type = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "_" SRE_MODULE ".SRE_Scanner",
-    sizeof(ScannerObject), 0,
-    (destructor)scanner_dealloc,/* tp_dealloc */
-    0,                          /* tp_vectorcall_offset */
-    0,                          /* tp_getattr */
-    0,                          /* tp_setattr */
-    0,                          /* tp_as_async */
-    0,                          /* tp_repr */
-    0,                          /* tp_as_number */
-    0,                          /* tp_as_sequence */
-    0,                          /* tp_as_mapping */
-    0,                          /* tp_hash */
-    0,                          /* tp_call */
-    0,                          /* tp_str */
-    0,                          /* tp_getattro */
-    0,                          /* tp_setattro */
-    0,                          /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT,         /* tp_flags */
-    0,                          /* tp_doc */
-    0,                          /* tp_traverse */
-    0,                          /* tp_clear */
-    0,                          /* tp_richcompare */
-    0,                          /* tp_weaklistoffset */
-    0,                          /* tp_iter */
-    0,                          /* tp_iternext */
-    scanner_methods,            /* tp_methods */
-    scanner_members,            /* tp_members */
-    0,                          /* tp_getset */
+static PyType_Slot scanner_slots[] = {
+    {Py_tp_dealloc, scanner_dealloc},
+    {Py_tp_methods, scanner_methods},
+    {Py_tp_members, scanner_members},
+    {Py_tp_traverse, scanner_traverse},
+    {Py_tp_clear, scanner_clear},
+    {0, NULL},
+};
+
+static PyType_Spec scanner_spec = {
+    .name = "_" SRE_MODULE ".SRE_Scanner",
+    .basicsize = sizeof(ScannerObject),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE |
+              Py_TPFLAGS_DISALLOW_INSTANTIATION | Py_TPFLAGS_HAVE_GC),
+    .slots = scanner_slots,
 };
 
 static PyMethodDef _functions[] = {
@@ -2756,64 +2860,108 @@
     {NULL, NULL}
 };
 
-static struct PyModuleDef sremodule = {
-        PyModuleDef_HEAD_INIT,
-        "_" SRE_MODULE,
-        NULL,
-        -1,
-        _functions,
-        NULL,
-        NULL,
-        NULL,
-        NULL
+static int
+sre_traverse(PyObject *module, visitproc visit, void *arg)
+{
+    _sremodulestate *state = get_sre_module_state(module);
+
+    Py_VISIT(state->Pattern_Type);
+    Py_VISIT(state->Match_Type);
+    Py_VISIT(state->Scanner_Type);
+
+    return 0;
+}
+
+static int
+sre_clear(PyObject *module)
+{
+    _sremodulestate *state = get_sre_module_state(module);
+
+    Py_CLEAR(state->Pattern_Type);
+    Py_CLEAR(state->Match_Type);
+    Py_CLEAR(state->Scanner_Type);
+
+    return 0;
+}
+
+static void
+sre_free(void *module)
+{
+    sre_clear((PyObject *)module);
+}
+
+#define CREATE_TYPE(m, type, spec)                                  \
+do {                                                                \
+    type = (PyTypeObject *)PyType_FromModuleAndSpec(m, spec, NULL); \
+    if (type == NULL) {                                             \
+        goto error;                                                 \
+    }                                                               \
+} while (0)
+
+#define ADD_ULONG_CONSTANT(module, name, value)           \
+    do {                                                  \
+        PyObject *o = PyLong_FromUnsignedLong(value);     \
+        if (!o)                                           \
+            goto error;                                   \
+        int res = PyModule_AddObjectRef(module, name, o); \
+        Py_DECREF(o);                                     \
+        if (res < 0) {                                    \
+            goto error;                                   \
+        }                                                 \
+} while (0)
+
+static int
+sre_exec(PyObject *m)
+{
+    _sremodulestate *state;
+
+    /* Create heap types */
+    state = get_sre_module_state(m);
+    CREATE_TYPE(m, state->Pattern_Type, &pattern_spec);
+    CREATE_TYPE(m, state->Match_Type, &match_spec);
+    CREATE_TYPE(m, state->Scanner_Type, &scanner_spec);
+
+    if (PyModule_AddIntConstant(m, "MAGIC", SRE_MAGIC) < 0) {
+        goto error;
+    }
+
+    if (PyModule_AddIntConstant(m, "CODESIZE", sizeof(SRE_CODE)) < 0) {
+        goto error;
+    }
+
+    ADD_ULONG_CONSTANT(m, "MAXREPEAT", SRE_MAXREPEAT);
+    ADD_ULONG_CONSTANT(m, "MAXGROUPS", SRE_MAXGROUPS);
+
+    if (PyModule_AddStringConstant(m, "copyright", copyright) < 0) {
+        goto error;
+    }
+
+    return 0;
+
+error:
+    return -1;
+}
+
+static PyModuleDef_Slot sre_slots[] = {
+    {Py_mod_exec, sre_exec},
+    {0, NULL},
 };
 
-PyMODINIT_FUNC PyInit__sre(void)
+static struct PyModuleDef sremodule = {
+    .m_base = PyModuleDef_HEAD_INIT,
+    .m_name = "_" SRE_MODULE,
+    .m_size = sizeof(_sremodulestate),
+    .m_methods = _functions,
+    .m_slots = sre_slots,
+    .m_traverse = sre_traverse,
+    .m_free = sre_free,
+    .m_clear = sre_clear,
+};
+
+PyMODINIT_FUNC
+PyInit__sre(void)
 {
-    PyObject* m;
-    PyObject* d;
-    PyObject* x;
-
-    /* Patch object types */
-    if (PyType_Ready(&Pattern_Type) || PyType_Ready(&Match_Type) ||
-        PyType_Ready(&Scanner_Type))
-        return NULL;
-
-    m = PyModule_Create(&sremodule);
-    if (m == NULL)
-        return NULL;
-    d = PyModule_GetDict(m);
-
-    x = PyLong_FromLong(SRE_MAGIC);
-    if (x) {
-        PyDict_SetItemString(d, "MAGIC", x);
-        Py_DECREF(x);
-    }
-
-    x = PyLong_FromLong(sizeof(SRE_CODE));
-    if (x) {
-        PyDict_SetItemString(d, "CODESIZE", x);
-        Py_DECREF(x);
-    }
-
-    x = PyLong_FromUnsignedLong(SRE_MAXREPEAT);
-    if (x) {
-        PyDict_SetItemString(d, "MAXREPEAT", x);
-        Py_DECREF(x);
-    }
-
-    x = PyLong_FromUnsignedLong(SRE_MAXGROUPS);
-    if (x) {
-        PyDict_SetItemString(d, "MAXGROUPS", x);
-        Py_DECREF(x);
-    }
-
-    x = PyUnicode_FromString(copyright);
-    if (x) {
-        PyDict_SetItemString(d, "copyright", x);
-        Py_DECREF(x);
-    }
-    return m;
+    return PyModuleDef_Init(&sremodule);
 }
 
 /* vim:ts=4:sw=4:et
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index 7bdde45..af25204 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -14,17 +14,29 @@
        http://bugs.python.org/issue8108#msg102867 ?
 */
 
+/* Don't warn about deprecated functions, */
+#ifndef OPENSSL_API_COMPAT
+  // 0x10101000L == 1.1.1, 30000 == 3.0.0
+  #define OPENSSL_API_COMPAT 0x10101000L
+#endif
+#define OPENSSL_NO_DEPRECATED 1
+
 #define PY_SSIZE_T_CLEAN
 
 #include "Python.h"
 
+/* Include symbols from _socket module */
+#include "socketmodule.h"
+
+#include "_ssl.h"
+
 /* Redefined below for Windows debug builds after important #includes */
 #define _PySSL_FIX_ERRNO
 
 #define PySSL_BEGIN_ALLOW_THREADS_S(save) \
-    do { if (_ssl_locks_count>0) { (save) = PyEval_SaveThread(); } } while (0)
+    do { (save) = PyEval_SaveThread(); } while(0)
 #define PySSL_END_ALLOW_THREADS_S(save) \
-    do { if (_ssl_locks_count>0) { PyEval_RestoreThread(save); } _PySSL_FIX_ERRNO; } while (0)
+    do { PyEval_RestoreThread(save); _PySSL_FIX_ERRNO; } while(0)
 #define PySSL_BEGIN_ALLOW_THREADS { \
             PyThreadState *_save = NULL;  \
             PySSL_BEGIN_ALLOW_THREADS_S(_save);
@@ -32,10 +44,6 @@
 #define PySSL_UNBLOCK_THREADS   PySSL_BEGIN_ALLOW_THREADS_S(_save);
 #define PySSL_END_ALLOW_THREADS PySSL_END_ALLOW_THREADS_S(_save); }
 
-/* Include symbols from _socket module */
-#include "socketmodule.h"
-
-static PySocketModule_APIObject PySocketModule;
 
 #if defined(HAVE_POLL_H)
 #include <poll.h>
@@ -43,14 +51,6 @@
 #include <sys/poll.h>
 #endif
 
-/* Don't warn about deprecated functions */
-#ifdef __GNUC__
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
-#ifdef __clang__
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
-#endif
-
 /* Include OpenSSL header files */
 #include "openssl/rsa.h"
 #include "openssl/crypto.h"
@@ -63,38 +63,17 @@
 #include "openssl/bio.h"
 #include "openssl/dh.h"
 
-#ifndef HAVE_X509_VERIFY_PARAM_SET1_HOST
-#  ifdef LIBRESSL_VERSION_NUMBER
-#    error "LibreSSL is missing X509_VERIFY_PARAM_set1_host(), see https://github.com/libressl-portable/portable/issues/381"
-#  elif OPENSSL_VERSION_NUMBER > 0x1000200fL
-#    define HAVE_X509_VERIFY_PARAM_SET1_HOST
-#  else
-#    error "libssl is too old and does not support X509_VERIFY_PARAM_set1_host()"
-#  endif
-#endif
-
 #ifndef OPENSSL_THREADS
 #  error "OPENSSL_THREADS is not defined, Python requires thread-safe OpenSSL"
 #endif
 
-/* SSL error object */
-static PyObject *PySSLErrorObject;
-static PyObject *PySSLCertVerificationErrorObject;
-static PyObject *PySSLZeroReturnErrorObject;
-static PyObject *PySSLWantReadErrorObject;
-static PyObject *PySSLWantWriteErrorObject;
-static PyObject *PySSLSyscallErrorObject;
-static PyObject *PySSLEOFErrorObject;
 
-/* Error mappings */
-static PyObject *err_codes_to_names;
-static PyObject *err_names_to_codes;
-static PyObject *lib_codes_to_names;
 
 struct py_ssl_error_code {
     const char *mnemonic;
     int library, reason;
 };
+
 struct py_ssl_library_code {
     const char *library;
     int code;
@@ -135,154 +114,34 @@
 #endif
 
 /* Include generated data (error codes) */
+#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
+#include "_ssl_data_300.h"
+#elif (OPENSSL_VERSION_NUMBER >= 0x10101000L) && !defined(LIBRESSL_VERSION_NUMBER)
+#include "_ssl_data_111.h"
+#else
 #include "_ssl_data.h"
-
-#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER)
-#  define OPENSSL_VERSION_1_1 1
-#  define PY_OPENSSL_1_1_API 1
 #endif
 
-/* OpenSSL API compat */
-#ifdef OPENSSL_API_COMPAT
-#if OPENSSL_API_COMPAT >= 0x10100000L
-
 /* OpenSSL API 1.1.0+ does not include version methods */
+#ifndef OPENSSL_NO_SSL3_METHOD
+extern const SSL_METHOD *SSLv3_method(void);
+#endif
 #ifndef OPENSSL_NO_TLS1_METHOD
-#define OPENSSL_NO_TLS1_METHOD 1
+extern const SSL_METHOD *TLSv1_method(void);
 #endif
 #ifndef OPENSSL_NO_TLS1_1_METHOD
-#define OPENSSL_NO_TLS1_1_METHOD 1
+extern const SSL_METHOD *TLSv1_1_method(void);
 #endif
 #ifndef OPENSSL_NO_TLS1_2_METHOD
-#define OPENSSL_NO_TLS1_2_METHOD 1
-#endif
-
-#endif /* >= 1.1.0 compcat */
-#endif /* OPENSSL_API_COMPAT */
-
-/* LibreSSL 2.7.0 provides necessary OpenSSL 1.1.0 APIs */
-#if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x2070000fL
-#  define PY_OPENSSL_1_1_API 1
-#endif
-
-/* SNI support (client- and server-side) appeared in OpenSSL 1.0.0 and 0.9.8f
- * This includes the SSL_set_SSL_CTX() function.
- */
-#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
-# define HAVE_SNI 1
-#else
-# define HAVE_SNI 0
-#endif
-
-#ifdef TLSEXT_TYPE_application_layer_protocol_negotiation
-# define HAVE_ALPN 1
-#else
-# define HAVE_ALPN 0
-#endif
-
-/* We cannot rely on OPENSSL_NO_NEXTPROTONEG because LibreSSL 2.6.1 dropped
- * NPN support but did not set OPENSSL_NO_NEXTPROTONEG for compatibility
- * reasons. The check for TLSEXT_TYPE_next_proto_neg works with
- * OpenSSL 1.0.1+ and LibreSSL.
- * OpenSSL 1.1.1-pre1 dropped NPN but still has TLSEXT_TYPE_next_proto_neg.
- */
-#ifdef OPENSSL_NO_NEXTPROTONEG
-# define HAVE_NPN 0
-#elif (OPENSSL_VERSION_NUMBER >= 0x10101000L) && !defined(LIBRESSL_VERSION_NUMBER)
-# define HAVE_NPN 0
-#elif defined(TLSEXT_TYPE_next_proto_neg)
-# define HAVE_NPN 1
-#else
-# define HAVE_NPN 0
-#endif
-
-#if (OPENSSL_VERSION_NUMBER >= 0x10101000L) && !defined(LIBRESSL_VERSION_NUMBER)
-#define HAVE_OPENSSL_KEYLOG 1
+extern const SSL_METHOD *TLSv1_2_method(void);
 #endif
 
 #ifndef INVALID_SOCKET /* MS defines this */
 #define INVALID_SOCKET (-1)
 #endif
 
-/* OpenSSL 1.0.2 and LibreSSL needs extra code for locking */
-#ifndef OPENSSL_VERSION_1_1
-#define HAVE_OPENSSL_CRYPTO_LOCK
-#endif
-
-#if defined(OPENSSL_VERSION_1_1) && !defined(OPENSSL_NO_SSL2)
+/* OpenSSL 1.1 does not have SSL 2.0 */
 #define OPENSSL_NO_SSL2
-#endif
-
-#ifndef PY_OPENSSL_1_1_API
-/* OpenSSL 1.1 API shims for OpenSSL < 1.1.0 and LibreSSL < 2.7.0 */
-
-#define TLS_method SSLv23_method
-#define TLS_client_method SSLv23_client_method
-#define TLS_server_method SSLv23_server_method
-#define ASN1_STRING_get0_data ASN1_STRING_data
-#define X509_get0_notBefore X509_get_notBefore
-#define X509_get0_notAfter X509_get_notAfter
-#define OpenSSL_version_num SSLeay
-#define OpenSSL_version SSLeay_version
-#define OPENSSL_VERSION SSLEAY_VERSION
-
-static int X509_NAME_ENTRY_set(const X509_NAME_ENTRY *ne)
-{
-    return ne->set;
-}
-
-#ifndef OPENSSL_NO_COMP
-/* LCOV_EXCL_START */
-static int COMP_get_type(const COMP_METHOD *meth)
-{
-    return meth->type;
-}
-/* LCOV_EXCL_STOP */
-#endif
-
-static pem_password_cb *SSL_CTX_get_default_passwd_cb(SSL_CTX *ctx)
-{
-    return ctx->default_passwd_callback;
-}
-
-static void *SSL_CTX_get_default_passwd_cb_userdata(SSL_CTX *ctx)
-{
-    return ctx->default_passwd_callback_userdata;
-}
-
-static int X509_OBJECT_get_type(X509_OBJECT *x)
-{
-    return x->type;
-}
-
-static X509 *X509_OBJECT_get0_X509(X509_OBJECT *x)
-{
-    return x->data.x509;
-}
-
-static int BIO_up_ref(BIO *b)
-{
-    CRYPTO_add(&b->references, 1, CRYPTO_LOCK_BIO);
-    return 1;
-}
-
-static STACK_OF(X509_OBJECT) *X509_STORE_get0_objects(X509_STORE *store) {
-    return store->objs;
-}
-
-static int
-SSL_SESSION_has_ticket(const SSL_SESSION *s)
-{
-    return (s->tlsext_ticklen > 0) ? 1 : 0;
-}
-
-static unsigned long
-SSL_SESSION_get_ticket_lifetime_hint(const SSL_SESSION *s)
-{
-    return s->tlsext_tick_lifetime_hint;
-}
-
-#endif /* OpenSSL < 1.1.0 or LibreSSL < 2.7.0 */
 
 /* Default cipher suites */
 #ifndef PY_SSL_DEFAULT_CIPHERS
@@ -293,15 +152,27 @@
   #ifndef PY_SSL_DEFAULT_CIPHER_STRING
      #error "Py_SSL_DEFAULT_CIPHERS 0 needs Py_SSL_DEFAULT_CIPHER_STRING"
   #endif
+  #ifndef PY_SSL_MIN_PROTOCOL
+    #define PY_SSL_MIN_PROTOCOL TLS1_2_VERSION
+  #endif
 #elif PY_SSL_DEFAULT_CIPHERS == 1
 /* Python custom selection of sensible cipher suites
- * DEFAULT: OpenSSL's default cipher list. Since 1.0.2 the list is in sensible order.
+ * @SECLEVEL=2: security level 2 with 112 bits minimum security (e.g. 2048 bits RSA key)
+ * ECDH+*: enable ephemeral elliptic curve Diffie-Hellman
+ * DHE+*: fallback to ephemeral finite field Diffie-Hellman
+ * encryption order: AES AEAD (GCM), ChaCha AEAD, AES CBC
  * !aNULL:!eNULL: really no NULL ciphers
- * !MD5:!3DES:!DES:!RC4:!IDEA:!SEED: no weak or broken algorithms on old OpenSSL versions.
  * !aDSS: no authentication with discrete logarithm DSA algorithm
- * !SRP:!PSK: no secure remote password or pre-shared key authentication
+ * !SHA1: no weak SHA1 MAC
+ * !AESCCM: no CCM mode, it's uncommon and slow
+ *
+ * Based on Hynek's excellent blog post (update 2021-02-11)
+ * https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/
  */
-  #define PY_SSL_DEFAULT_CIPHER_STRING "DEFAULT:!aNULL:!eNULL:!MD5:!3DES:!DES:!RC4:!IDEA:!SEED:!aDSS:!SRP:!PSK"
+  #define PY_SSL_DEFAULT_CIPHER_STRING "@SECLEVEL=2:ECDH+AESGCM:ECDH+CHACHA20:ECDH+AES:DHE+AES:!aNULL:!eNULL:!aDSS:!SHA1:!AESCCM"
+  #ifndef PY_SSL_MIN_PROTOCOL
+    #define PY_SSL_MIN_PROTOCOL TLS1_2_VERSION
+  #endif
 #elif PY_SSL_DEFAULT_CIPHERS == 2
 /* Ignored in SSLContext constructor, only used to as _ssl.DEFAULT_CIPHER_STRING */
   #define PY_SSL_DEFAULT_CIPHER_STRING SSL_DEFAULT_CIPHER_LIST
@@ -394,24 +265,10 @@
 #endif
 };
 
-
-/* serves as a flag to see whether we've initialized the SSL thread support. */
-/* 0 means no, greater than 0 means yes */
-
-static unsigned int _ssl_locks_count = 0;
-
 /* SSL socket object */
 
 #define X509_NAME_MAXLEN 256
 
-/* SSL_CTX_clear_options() and SSL_clear_options() were first added in
- * OpenSSL 0.9.8m but do not appear in some 0.9.9-dev versions such the
- * 0.9.9 from "May 2008" that NetBSD 5.0 uses. */
-#if OPENSSL_VERSION_NUMBER >= 0x009080dfL && OPENSSL_VERSION_NUMBER != 0x00909000L
-# define HAVE_SSL_CTX_CLEAR_OPTIONS
-#else
-# undef HAVE_SSL_CTX_CLEAR_OPTIONS
-#endif
 
 /* In case of 'tls-unique' it will be 12 bytes for TLS, 36 bytes for
  * older SSL, but let's be safe */
@@ -421,17 +278,9 @@
 typedef struct {
     PyObject_HEAD
     SSL_CTX *ctx;
-#if HAVE_NPN
-    unsigned char *npn_protocols;
-    int npn_protocols_len;
-#endif
-#if HAVE_ALPN
     unsigned char *alpn_protocols;
     unsigned int alpn_protocols_len;
-#endif
-#ifndef OPENSSL_NO_TLSEXT
     PyObject *set_sni_cb;
-#endif
     int check_hostname;
     /* OpenSSL has no API to get hostflags from X509_VERIFY_PARAM* struct.
      * We have to maintain our own copy. OpenSSL's hostflags default to 0.
@@ -442,10 +291,10 @@
     int post_handshake_auth;
 #endif
     PyObject *msg_cb;
-#ifdef HAVE_OPENSSL_KEYLOG
     PyObject *keylog_filename;
     BIO *keylog_bio;
-#endif
+    /* Cached module state, also used in SSLSocket and SSLSession code. */
+    _sslmodulestate *state;
 } PySSLContext;
 
 typedef struct {
@@ -487,11 +336,6 @@
     PySSLContext *ctx;
 } PySSLSession;
 
-static PyTypeObject PySSLContext_Type;
-static PyTypeObject PySSLSocket_Type;
-static PyTypeObject PySSLMemoryBIO_Type;
-static PyTypeObject PySSLSession_Type;
-
 static inline _PySSLError _PySSL_errno(int failed, const SSL *ssl, int retcode)
 {
     _PySSLError err = { 0 };
@@ -508,12 +352,12 @@
 
 /*[clinic input]
 module _ssl
-class _ssl._SSLContext "PySSLContext *" "&PySSLContext_Type"
-class _ssl._SSLSocket "PySSLSocket *" "&PySSLSocket_Type"
-class _ssl.MemoryBIO "PySSLMemoryBIO *" "&PySSLMemoryBIO_Type"
-class _ssl.SSLSession "PySSLSession *" "&PySSLSession_Type"
+class _ssl._SSLContext "PySSLContext *" "get_state_type(type)->PySSLContext_Type"
+class _ssl._SSLSocket "PySSLSocket *" "get_state_type(type)->PySSLSocket_Type"
+class _ssl.MemoryBIO "PySSLMemoryBIO *" "get_state_type(type)->PySSLMemoryBIO_Type"
+class _ssl.SSLSession "PySSLSession *" "get_state_type(type)->PySSLSession_Type"
 [clinic start generated code]*/
-/*[clinic end generated code: output=da39a3ee5e6b4b0d input=bdc67fafeeaa8109]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=d293bed8bae240fd]*/
 
 #include "clinic/_ssl.c.h"
 
@@ -521,9 +365,6 @@
 
 static int PySSL_set_owner(PySSLSocket *, PyObject *, void *);
 static int PySSL_set_session(PySSLSocket *, PyObject *, void *);
-#define PySSLSocket_Check(v)    Py_IS_TYPE(v, &PySSLSocket_Type)
-#define PySSLMemoryBIO_Check(v)    Py_IS_TYPE(v, &PySSLMemoryBIO_Type)
-#define PySSLSession_Check(v)   Py_IS_TYPE(v, &PySSLSession_Type)
 
 typedef enum {
     SOCKET_IS_NONBLOCKING,
@@ -587,22 +428,21 @@
 }
 
 static PyType_Slot sslerror_type_slots[] = {
-    {Py_tp_base, NULL},  /* Filled out in module init as it's not a constant */
     {Py_tp_doc, (void*)SSLError_doc},
     {Py_tp_str, SSLError_str},
     {0, 0},
 };
 
 static PyType_Spec sslerror_type_spec = {
-    "ssl.SSLError",
-    sizeof(PyOSErrorObject),
-    0,
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-    sslerror_type_slots
+    .name = "ssl.SSLError",
+    .basicsize = sizeof(PyOSErrorObject),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = sslerror_type_slots
 };
 
 static void
-fill_and_set_sslerror(PySSLSocket *sslsock, PyObject *type, int ssl_errno,
+fill_and_set_sslerror(_sslmodulestate *state,
+                      PySSLSocket *sslsock, PyObject *type, int ssl_errno,
                       const char *errstr, int lineno, unsigned long errcode)
 {
     PyObject *err_value = NULL, *reason_obj = NULL, *lib_obj = NULL;
@@ -621,7 +461,7 @@
         key = Py_BuildValue("ii", lib, reason);
         if (key == NULL)
             goto fail;
-        reason_obj = PyDict_GetItemWithError(err_codes_to_names, key);
+        reason_obj = PyDict_GetItemWithError(state->err_codes_to_names, key);
         Py_DECREF(key);
         if (reason_obj == NULL && PyErr_Occurred()) {
             goto fail;
@@ -629,7 +469,7 @@
         key = PyLong_FromLong(lib);
         if (key == NULL)
             goto fail;
-        lib_obj = PyDict_GetItemWithError(lib_codes_to_names, key);
+        lib_obj = PyDict_GetItemWithError(state->lib_codes_to_names, key);
         Py_DECREF(key);
         if (lib_obj == NULL && PyErr_Occurred()) {
             goto fail;
@@ -641,7 +481,7 @@
         errstr = "unknown error";
 
     /* verify code for cert validation error */
-    if ((sslsock != NULL) && (type == PySSLCertVerificationErrorObject)) {
+    if ((sslsock != NULL) && (type == state->PySSLCertVerificationErrorObject)) {
         const char *verify_str = NULL;
         long verify_code;
 
@@ -652,23 +492,18 @@
         }
 
         switch (verify_code) {
-#ifdef X509_V_ERR_HOSTNAME_MISMATCH
-        /* OpenSSL >= 1.0.2, LibreSSL >= 2.5.3 */
         case X509_V_ERR_HOSTNAME_MISMATCH:
             verify_obj = PyUnicode_FromFormat(
                 "Hostname mismatch, certificate is not valid for '%S'.",
                 sslsock->server_hostname
             );
             break;
-#endif
-#ifdef X509_V_ERR_IP_ADDRESS_MISMATCH
         case X509_V_ERR_IP_ADDRESS_MISMATCH:
             verify_obj = PyUnicode_FromFormat(
                 "IP address mismatch, certificate is not valid for '%S'.",
                 sslsock->server_hostname
             );
             break;
-#endif
         default:
             verify_str = X509_verify_cert_error_string(verify_code);
             if (verify_str != NULL) {
@@ -718,7 +553,7 @@
     if (_PyObject_SetAttrId(err_value, &PyId_library, lib_obj))
         goto fail;
 
-    if ((sslsock != NULL) && (type == PySSLCertVerificationErrorObject)) {
+    if ((sslsock != NULL) && (type == state->PySSLCertVerificationErrorObject)) {
         /* Only set verify code / message for SSLCertVerificationError */
         if (_PyObject_SetAttrId(err_value, &PyId_verify_code,
                                 verify_code_obj))
@@ -749,12 +584,17 @@
 static PyObject *
 PySSL_SetError(PySSLSocket *sslsock, int ret, const char *filename, int lineno)
 {
-    PyObject *type = PySSLErrorObject;
+    PyObject *type;
     char *errstr = NULL;
     _PySSLError err;
     enum py_ssl_error p = PY_SSL_ERROR_NONE;
     unsigned long e = 0;
 
+    assert(sslsock != NULL);
+
+    _sslmodulestate *state = get_state_sock(sslsock);
+    type = state->PySSLErrorObject;
+
     assert(ret <= 0);
     e = ERR_peek_last_error();
 
@@ -764,17 +604,17 @@
         switch (err.ssl) {
         case SSL_ERROR_ZERO_RETURN:
             errstr = "TLS/SSL connection has been closed (EOF)";
-            type = PySSLZeroReturnErrorObject;
+            type = state->PySSLZeroReturnErrorObject;
             p = PY_SSL_ERROR_ZERO_RETURN;
             break;
         case SSL_ERROR_WANT_READ:
             errstr = "The operation did not complete (read)";
-            type = PySSLWantReadErrorObject;
+            type = state->PySSLWantReadErrorObject;
             p = PY_SSL_ERROR_WANT_READ;
             break;
         case SSL_ERROR_WANT_WRITE:
             p = PY_SSL_ERROR_WANT_WRITE;
-            type = PySSLWantWriteErrorObject;
+            type = state->PySSLWantWriteErrorObject;
             errstr = "The operation did not complete (write)";
             break;
         case SSL_ERROR_WANT_X509_LOOKUP:
@@ -791,7 +631,7 @@
                 PySocketSockObject *s = GET_SOCKET(sslsock);
                 if (ret == 0 || (((PyObject *)s) == Py_None)) {
                     p = PY_SSL_ERROR_EOF;
-                    type = PySSLEOFErrorObject;
+                    type = state->PySSLEOFErrorObject;
                     errstr = "EOF occurred in violation of protocol";
                 } else if (s && ret == -1) {
                     /* underlying BIO reported an I/O error */
@@ -807,12 +647,12 @@
                     }
                     else {
                         p = PY_SSL_ERROR_EOF;
-                        type = PySSLEOFErrorObject;
+                        type = state->PySSLEOFErrorObject;
                         errstr = "EOF occurred in violation of protocol";
                     }
                 } else { /* possible? */
                     p = PY_SSL_ERROR_SYSCALL;
-                    type = PySSLSyscallErrorObject;
+                    type = state->PySSLSyscallErrorObject;
                     errstr = "Some I/O error occurred";
                 }
             } else {
@@ -829,7 +669,7 @@
             }
             if (ERR_GET_LIB(e) == ERR_LIB_SSL &&
                     ERR_GET_REASON(e) == SSL_R_CERTIFICATE_VERIFY_FAILED) {
-                type = PySSLCertVerificationErrorObject;
+                type = state->PySSLCertVerificationErrorObject;
             }
             break;
         }
@@ -838,24 +678,34 @@
             errstr = "Invalid error code";
         }
     }
-    fill_and_set_sslerror(sslsock, type, p, errstr, lineno, e);
+    fill_and_set_sslerror(state, sslsock, type, p, errstr, lineno, e);
     ERR_clear_error();
     PySSL_ChainExceptions(sslsock);
     return NULL;
 }
 
 static PyObject *
-_setSSLError (const char *errstr, int errcode, const char *filename, int lineno) {
-
+_setSSLError (_sslmodulestate *state, const char *errstr, int errcode, const char *filename, int lineno)
+{
     if (errstr == NULL)
         errcode = ERR_peek_last_error();
     else
         errcode = 0;
-    fill_and_set_sslerror(NULL, PySSLErrorObject, errcode, errstr, lineno, errcode);
+    fill_and_set_sslerror(state, NULL, state->PySSLErrorObject, errcode, errstr, lineno, errcode);
     ERR_clear_error();
     return NULL;
 }
 
+static int
+_ssl_deprecated(const char* msg, int stacklevel) {
+    return PyErr_WarnEx(
+        PyExc_DeprecationWarning, msg, stacklevel
+    );
+}
+
+#define PY_SSL_DEPRECATED(name, stacklevel, ret) \
+    if (_ssl_deprecated((name), (stacklevel)) == -1) return (ret)
+
 /*
  * SSL objects
  */
@@ -898,7 +748,7 @@
     /* Only send SNI extension for non-IP hostnames */
     if (ip == NULL) {
         if (!SSL_set_tlsext_host_name(self->ssl, server_hostname)) {
-            _setSSLError(NULL, 0, __FILE__, __LINE__);
+            _setSSLError(get_state_sock(self), NULL, 0, __FILE__, __LINE__);
             goto error;
         }
     }
@@ -907,13 +757,13 @@
         if (ip == NULL) {
             if (!X509_VERIFY_PARAM_set1_host(param, server_hostname,
                                              strlen(server_hostname))) {
-                _setSSLError(NULL, 0, __FILE__, __LINE__);
+                _setSSLError(get_state_sock(self), NULL, 0, __FILE__, __LINE__);
                 goto error;
             }
         } else {
             if (!X509_VERIFY_PARAM_set1_ip(param, ASN1_STRING_get0_data(ip),
                                            ASN1_STRING_length(ip))) {
-                _setSSLError(NULL, 0, __FILE__, __LINE__);
+                _setSSLError(get_state_sock(self), NULL, 0, __FILE__, __LINE__);
                 goto error;
             }
         }
@@ -937,7 +787,23 @@
     SSL_CTX *ctx = sslctx->ctx;
     _PySSLError err = { 0 };
 
-    self = PyObject_New(PySSLSocket, &PySSLSocket_Type);
+    if ((socket_type == PY_SSL_SERVER) &&
+        (sslctx->protocol == PY_SSL_VERSION_TLS_CLIENT)) {
+        _setSSLError(get_state_ctx(sslctx),
+                     "Cannot create a server socket with a "
+                     "PROTOCOL_TLS_CLIENT context", 0, __FILE__, __LINE__);
+        return NULL;
+    }
+    if ((socket_type == PY_SSL_CLIENT) &&
+        (sslctx->protocol == PY_SSL_VERSION_TLS_SERVER)) {
+        _setSSLError(get_state_ctx(sslctx),
+                     "Cannot create a client socket with a "
+                     "PROTOCOL_TLS_SERVER context", 0, __FILE__, __LINE__);
+        return NULL;
+    }
+
+    self = PyObject_GC_New(PySSLSocket,
+                           get_state_ctx(sslctx)->PySSLSocket_Type);
     if (self == NULL)
         return NULL;
 
@@ -961,9 +827,14 @@
     PySSL_END_ALLOW_THREADS
     if (self->ssl == NULL) {
         Py_DECREF(self);
-        _setSSLError(NULL, 0, __FILE__, __LINE__);
+        _setSSLError(get_state_ctx(self), NULL, 0, __FILE__, __LINE__);
         return NULL;
     }
+    /* bpo43522 and OpenSSL < 1.1.1l: copy hostflags manually */
+#if !defined(LIBRESSL_VERSION_NUMBER) && OPENSSL_VERSION < 0x101010cf
+    X509_VERIFY_PARAM *ssl_params = SSL_get0_param(self->ssl);
+    X509_VERIFY_PARAM_set_hostflags(ssl_params, sslctx->hostflags);
+#endif
     SSL_set_app_data(self->ssl, self);
     if (sock) {
         SSL_set_fd(self->ssl, Py_SAFE_DOWNCAST(sock->sock_fd, SOCKET_T, int));
@@ -1039,6 +910,8 @@
             return NULL;
         }
     }
+
+    PyObject_GC_Track(self);
     return self;
 }
 
@@ -1061,7 +934,8 @@
 
     if (sock) {
         if (((PyObject*)sock) == Py_None) {
-            _setSSLError("Underlying socket connection gone",
+            _setSSLError(get_state_sock(self),
+                         "Underlying socket connection gone",
                          PY_SSL_ERROR_NO_SOCKET, __FILE__, __LINE__);
             return NULL;
         }
@@ -1102,15 +976,15 @@
         }
 
         if (sockstate == SOCKET_HAS_TIMED_OUT) {
-            PyErr_SetString(PySocketModule.timeout_error,
+            PyErr_SetString(PyExc_TimeoutError,
                             ERRSTR("The handshake operation timed out"));
             goto error;
         } else if (sockstate == SOCKET_HAS_BEEN_CLOSED) {
-            PyErr_SetString(PySSLErrorObject,
+            PyErr_SetString(get_state_sock(self)->PySSLErrorObject,
                             ERRSTR("Underlying socket has been closed."));
             goto error;
         } else if (sockstate == SOCKET_TOO_LARGE_FOR_SELECT) {
-            PyErr_SetString(PySSLErrorObject,
+            PyErr_SetString(get_state_sock(self)->PySSLErrorObject,
                             ERRSTR("Underlying socket too large for select()."));
             goto error;
         } else if (sockstate == SOCKET_IS_NONBLOCKING) {
@@ -1131,7 +1005,7 @@
 }
 
 static PyObject *
-_asn1obj2py(const ASN1_OBJECT *name, int no_name)
+_asn1obj2py(_sslmodulestate *state, const ASN1_OBJECT *name, int no_name)
 {
     char buf[X509_NAME_MAXLEN];
     char *namebuf = buf;
@@ -1140,7 +1014,7 @@
 
     buflen = OBJ_obj2txt(namebuf, X509_NAME_MAXLEN, name, no_name);
     if (buflen < 0) {
-        _setSSLError(NULL, 0, __FILE__, __LINE__);
+        _setSSLError(state, NULL, 0, __FILE__, __LINE__);
         return NULL;
     }
     /* initial buffer is too small for oid + terminating null byte */
@@ -1155,7 +1029,7 @@
         }
         buflen = OBJ_obj2txt(namebuf, buflen + 1, name, no_name);
         if (buflen < 0) {
-            _setSSLError(NULL, 0, __FILE__, __LINE__);
+            _setSSLError(state, NULL, 0, __FILE__, __LINE__);
             goto done;
         }
     }
@@ -1175,24 +1049,37 @@
 }
 
 static PyObject *
-_create_tuple_for_attribute(ASN1_OBJECT *name, ASN1_STRING *value)
+_create_tuple_for_attribute(_sslmodulestate *state,
+                            ASN1_OBJECT *name, ASN1_STRING *value)
 {
     Py_ssize_t buflen;
-    unsigned char *valuebuf = NULL;
-    PyObject *attr;
+    PyObject *pyattr;
+    PyObject *pyname = _asn1obj2py(state, name, 0);
 
-    buflen = ASN1_STRING_to_UTF8(&valuebuf, value);
-    if (buflen < 0) {
-        _setSSLError(NULL, 0, __FILE__, __LINE__);
+    if (pyname == NULL) {
+        _setSSLError(state, NULL, 0, __FILE__, __LINE__);
         return NULL;
     }
-    attr = Py_BuildValue("Ns#", _asn1obj2py(name, 0), valuebuf, buflen);
-    OPENSSL_free(valuebuf);
-    return attr;
+
+    if (ASN1_STRING_type(value) == V_ASN1_BIT_STRING) {
+        buflen = ASN1_STRING_length(value);
+        pyattr = Py_BuildValue("Ny#", pyname, ASN1_STRING_get0_data(value), buflen);
+    } else {
+        unsigned char *valuebuf = NULL;
+        buflen = ASN1_STRING_to_UTF8(&valuebuf, value);
+        if (buflen < 0) {
+            _setSSLError(state, NULL, 0, __FILE__, __LINE__);
+            Py_DECREF(pyname);
+            return NULL;
+        }
+        pyattr = Py_BuildValue("Ns#", pyname, valuebuf, buflen);
+        OPENSSL_free(valuebuf);
+    }
+    return pyattr;
 }
 
 static PyObject *
-_create_tuple_for_X509_NAME (X509_NAME *xname)
+_create_tuple_for_X509_NAME (_sslmodulestate *state, X509_NAME *xname)
 {
     PyObject *dn = NULL;    /* tuple which represents the "distinguished name" */
     PyObject *rdn = NULL;   /* tuple to hold a "relative distinguished name" */
@@ -1244,7 +1131,7 @@
         /* now add this attribute to the current RDN */
         name = X509_NAME_ENTRY_get_object(entry);
         value = X509_NAME_ENTRY_get_data(entry);
-        attr = _create_tuple_for_attribute(name, value);
+        attr = _create_tuple_for_attribute(state, name, value);
         /*
         fprintf(stderr, "RDN level %d, attribute %s: %s\n",
             entry->set,
@@ -1291,7 +1178,7 @@
 }
 
 static PyObject *
-_get_peer_alt_names (X509 *certificate) {
+_get_peer_alt_names (_sslmodulestate *state, X509 *certificate) {
 
     /* this code follows the procedure outlined in
        OpenSSL's crypto/x509v3/v3_prn.c:X509v3_EXT_print()
@@ -1315,7 +1202,7 @@
     /* get a memory buffer */
     biobuf = BIO_new(BIO_s_mem());
     if (biobuf == NULL) {
-        PyErr_SetString(PySSLErrorObject, "failed to allocate BIO");
+        PyErr_SetString(state->PySSLErrorObject, "failed to allocate BIO");
         return NULL;
     }
 
@@ -1352,7 +1239,7 @@
                 }
                 PyTuple_SET_ITEM(t, 0, v);
 
-                v = _create_tuple_for_X509_NAME (name->d.dirn);
+                v = _create_tuple_for_X509_NAME(state, name->d.dirn);
                 if (v == NULL) {
                     Py_DECREF(t);
                     goto fail;
@@ -1411,7 +1298,7 @@
                 len = i2t_ASN1_OBJECT(buf, sizeof(buf)-1, name->d.rid);
                 if (len < 0) {
                     Py_DECREF(t);
-                    _setSSLError(NULL, 0, __FILE__, __LINE__);
+                    _setSSLError(state, NULL, 0, __FILE__, __LINE__);
                     goto fail;
                 } else if (len >= (int)sizeof(buf)) {
                     v = PyUnicode_FromString("<INVALID>");
@@ -1494,7 +1381,7 @@
                 GENERAL_NAME_print(biobuf, name);
                 len = BIO_gets(biobuf, buf, sizeof(buf)-1);
                 if (len < 0) {
-                    _setSSLError(NULL, 0, __FILE__, __LINE__);
+                    _setSSLError(state, NULL, 0, __FILE__, __LINE__);
                     goto fail;
                 }
                 vptr = strchr(buf, ':');
@@ -1670,7 +1557,7 @@
 }
 
 static PyObject *
-_decode_certificate(X509 *certificate) {
+_decode_certificate(_sslmodulestate *state, X509 *certificate) {
 
     PyObject *retval = NULL;
     BIO *biobuf = NULL;
@@ -1691,6 +1578,7 @@
         return NULL;
 
     peer = _create_tuple_for_X509_NAME(
+        state,
         X509_get_subject_name(certificate));
     if (peer == NULL)
         goto fail0;
@@ -1701,6 +1589,7 @@
     Py_DECREF(peer);
 
     issuer = _create_tuple_for_X509_NAME(
+        state,
         X509_get_issuer_name(certificate));
     if (issuer == NULL)
         goto fail0;
@@ -1722,7 +1611,7 @@
     /* get a memory buffer */
     biobuf = BIO_new(BIO_s_mem());
     if (biobuf == NULL) {
-        PyErr_SetString(PySSLErrorObject, "failed to allocate BIO");
+        PyErr_SetString(state->PySSLErrorObject, "failed to allocate BIO");
         goto fail0;
     }
 
@@ -1732,7 +1621,7 @@
     i2a_ASN1_INTEGER(biobuf, serialNumber);
     len = BIO_gets(biobuf, buf, sizeof(buf)-1);
     if (len < 0) {
-        _setSSLError(NULL, 0, __FILE__, __LINE__);
+        _setSSLError(state, NULL, 0, __FILE__, __LINE__);
         goto fail1;
     }
     sn_obj = PyUnicode_FromStringAndSize(buf, len);
@@ -1749,7 +1638,7 @@
     ASN1_TIME_print(biobuf, notBefore);
     len = BIO_gets(biobuf, buf, sizeof(buf)-1);
     if (len < 0) {
-        _setSSLError(NULL, 0, __FILE__, __LINE__);
+        _setSSLError(state, NULL, 0, __FILE__, __LINE__);
         goto fail1;
     }
     pnotBefore = PyUnicode_FromStringAndSize(buf, len);
@@ -1766,7 +1655,7 @@
     ASN1_TIME_print(biobuf, notAfter);
     len = BIO_gets(biobuf, buf, sizeof(buf)-1);
     if (len < 0) {
-        _setSSLError(NULL, 0, __FILE__, __LINE__);
+        _setSSLError(state, NULL, 0, __FILE__, __LINE__);
         goto fail1;
     }
     pnotAfter = PyUnicode_FromStringAndSize(buf, len);
@@ -1780,7 +1669,7 @@
 
     /* Now look for subjectAltName */
 
-    peer_alt_names = _get_peer_alt_names(certificate);
+    peer_alt_names = _get_peer_alt_names(state, certificate);
     if (peer_alt_names == NULL)
         goto fail1;
     else if (peer_alt_names != Py_None) {
@@ -1839,7 +1728,7 @@
 }
 
 static PyObject *
-_certificate_to_der(X509 *certificate)
+_certificate_to_der(_sslmodulestate *state, X509 *certificate)
 {
     unsigned char *bytes_buf = NULL;
     int len;
@@ -1848,7 +1737,7 @@
     bytes_buf = NULL;
     len = i2d_X509(certificate, &bytes_buf);
     if (len < 0) {
-        _setSSLError(NULL, 0, __FILE__, __LINE__);
+        _setSSLError(state, NULL, 0, __FILE__, __LINE__);
         return NULL;
     }
     /* this is actually an immutable bytes sequence */
@@ -1857,6 +1746,9 @@
     return retval;
 }
 
+#include "_ssl/misc.c"
+#include "_ssl/cert.c"
+
 /*[clinic input]
 _ssl._test_decode_cert
     path: object(converter="PyUnicode_FSConverter")
@@ -1871,27 +1763,28 @@
     PyObject *retval = NULL;
     X509 *x=NULL;
     BIO *cert;
+    _sslmodulestate *state = get_ssl_state(module);
 
     if ((cert=BIO_new(BIO_s_file())) == NULL) {
-        PyErr_SetString(PySSLErrorObject,
+        PyErr_SetString(state->PySSLErrorObject,
                         "Can't malloc memory to read file");
         goto fail0;
     }
 
     if (BIO_read_filename(cert, PyBytes_AsString(path)) <= 0) {
-        PyErr_SetString(PySSLErrorObject,
+        PyErr_SetString(state->PySSLErrorObject,
                         "Can't open file");
         goto fail0;
     }
 
     x = PEM_read_bio_X509(cert, NULL, NULL, NULL);
     if (x == NULL) {
-        PyErr_SetString(PySSLErrorObject,
+        PyErr_SetString(state->PySSLErrorObject,
                         "Error decoding PEM-encoded file");
         goto fail0;
     }
 
-    retval = _decode_certificate(x);
+    retval = _decode_certificate(state, x);
     X509_free(x);
 
   fail0:
@@ -1936,18 +1829,82 @@
 
     if (binary_mode) {
         /* return cert in DER-encoded format */
-        result = _certificate_to_der(peer_cert);
+        result = _certificate_to_der(get_state_sock(self), peer_cert);
     } else {
         verification = SSL_CTX_get_verify_mode(SSL_get_SSL_CTX(self->ssl));
         if ((verification & SSL_VERIFY_PEER) == 0)
             result = PyDict_New();
         else
-            result = _decode_certificate(peer_cert);
+            result = _decode_certificate(get_state_sock(self), peer_cert);
     }
     X509_free(peer_cert);
     return result;
 }
 
+/*[clinic input]
+_ssl._SSLSocket.get_verified_chain
+
+[clinic start generated code]*/
+
+static PyObject *
+_ssl__SSLSocket_get_verified_chain_impl(PySSLSocket *self)
+/*[clinic end generated code: output=802421163cdc3110 input=5fb0714f77e2bd51]*/
+{
+    /* borrowed reference */
+    STACK_OF(X509) *chain = SSL_get0_verified_chain(self->ssl);
+    if (chain == NULL) {
+        Py_RETURN_NONE;
+    }
+    return _PySSL_CertificateFromX509Stack(self->ctx->state, chain, 1);
+}
+
+/*[clinic input]
+_ssl._SSLSocket.get_unverified_chain
+
+[clinic start generated code]*/
+
+static PyObject *
+_ssl__SSLSocket_get_unverified_chain_impl(PySSLSocket *self)
+/*[clinic end generated code: output=5acdae414e13f913 input=78c33c360c635cb5]*/
+{
+    PyObject *retval;
+    /* borrowed reference */
+    /* TODO: include SSL_get_peer_certificate() for server-side sockets */
+    STACK_OF(X509) *chain = SSL_get_peer_cert_chain(self->ssl);
+    if (chain == NULL) {
+        Py_RETURN_NONE;
+    }
+    retval = _PySSL_CertificateFromX509Stack(self->ctx->state, chain, 1);
+    if (retval == NULL) {
+        return NULL;
+    }
+    /* OpenSSL does not include peer cert for server side connections */
+    if (self->socket_type == PY_SSL_SERVER) {
+        PyObject *peerobj = NULL;
+        X509 *peer = SSL_get_peer_certificate(self->ssl);
+
+        if (peer == NULL) {
+            peerobj = Py_None;
+            Py_INCREF(peerobj);
+        } else {
+            /* consume X509 reference on success */
+            peerobj = _PySSL_CertificateFromX509(self->ctx->state, peer, 0);
+            if (peerobj == NULL) {
+                X509_free(peer);
+                Py_DECREF(retval);
+                return NULL;
+            }
+        }
+        int res = PyList_Insert(retval, 0, peerobj);
+        Py_DECREF(peerobj);
+        if (res < 0) {
+            Py_DECREF(retval);
+            return NULL;
+        }
+    }
+    return retval;
+}
+
 static PyObject *
 cipher_to_tuple(const SSL_CIPHER *cipher)
 {
@@ -1990,7 +1947,6 @@
     return NULL;
 }
 
-#if OPENSSL_VERSION_NUMBER >= 0x10002000UL
 static PyObject *
 cipher_to_dict(const SSL_CIPHER *cipher)
 {
@@ -1999,10 +1955,8 @@
     unsigned long cipher_id;
     int alg_bits, strength_bits, len;
     char buf[512] = {0};
-#if OPENSSL_VERSION_1_1
     int aead, nid;
     const char *skcipher = NULL, *digest = NULL, *kx = NULL, *auth = NULL;
-#endif
 
     /* can be NULL */
     cipher_name = SSL_CIPHER_get_name(cipher);
@@ -2015,7 +1969,6 @@
         buf[len-1] = '\0';
     strength_bits = SSL_CIPHER_get_bits(cipher, &alg_bits);
 
-#if OPENSSL_VERSION_1_1
     aead = SSL_CIPHER_is_aead(cipher);
     nid = SSL_CIPHER_get_cipher_nid(cipher);
     skcipher = nid != NID_undef ? OBJ_nid2ln(nid) : NULL;
@@ -2025,13 +1978,10 @@
     kx = nid != NID_undef ? OBJ_nid2ln(nid) : NULL;
     nid = SSL_CIPHER_get_auth_nid(cipher);
     auth = nid != NID_undef ? OBJ_nid2ln(nid) : NULL;
-#endif
 
     return Py_BuildValue(
         "{sksssssssisi"
-#if OPENSSL_VERSION_1_1
         "sOssssssss"
-#endif
         "}",
         "id", cipher_id,
         "name", cipher_name,
@@ -2039,16 +1989,13 @@
         "description", buf,
         "strength_bits", strength_bits,
         "alg_bits", alg_bits
-#if OPENSSL_VERSION_1_1
         ,"aead", aead ? Py_True : Py_False,
         "symmetric", skcipher,
         "digest", digest,
         "kea", kx,
         "auth", auth
-#endif
        );
 }
-#endif
 
 /*[clinic input]
 _ssl._SSLSocket.shared_ciphers
@@ -2119,28 +2066,6 @@
     return PyUnicode_FromString(version);
 }
 
-#if HAVE_NPN
-/*[clinic input]
-_ssl._SSLSocket.selected_npn_protocol
-[clinic start generated code]*/
-
-static PyObject *
-_ssl__SSLSocket_selected_npn_protocol_impl(PySSLSocket *self)
-/*[clinic end generated code: output=b91d494cd207ecf6 input=c28fde139204b826]*/
-{
-    const unsigned char *out;
-    unsigned int outlen;
-
-    SSL_get0_next_proto_negotiated(self->ssl,
-                                   &out, &outlen);
-
-    if (out == NULL)
-        Py_RETURN_NONE;
-    return PyUnicode_FromStringAndSize((char *)out, outlen);
-}
-#endif
-
-#if HAVE_ALPN
 /*[clinic input]
 _ssl._SSLSocket.selected_alpn_protocol
 [clinic start generated code]*/
@@ -2158,7 +2083,6 @@
         Py_RETURN_NONE;
     return PyUnicode_FromStringAndSize((char *)out, outlen);
 }
-#endif
 
 /*[clinic input]
 _ssl._SSLSocket.compression
@@ -2194,16 +2118,15 @@
 static int PySSL_set_context(PySSLSocket *self, PyObject *value,
                                    void *closure) {
 
-    if (PyObject_TypeCheck(value, &PySSLContext_Type)) {
-#if !HAVE_SNI
-        PyErr_SetString(PyExc_NotImplementedError, "setting a socket's "
-                        "context is not supported by your OpenSSL library");
-        return -1;
-#else
+    if (PyObject_TypeCheck(value, self->ctx->state->PySSLContext_Type)) {
         Py_INCREF(value);
         Py_SETREF(self->ctx, (PySSLContext *)value);
         SSL_set_SSL_CTX(self->ssl, self->ctx->ctx);
-#endif
+        /* Set SSL* internal msg_callback to state of new context's state */
+        SSL_set_msg_callback(
+            self->ssl,
+            self->ctx->msg_cb ? _PySSL_msg_callback : NULL
+        );
     } else {
         PyErr_SetString(PyExc_TypeError, "The value must be a SSLContext");
         return -1;
@@ -2274,6 +2197,7 @@
     Py_VISIT(self->exc_type);
     Py_VISIT(self->exc_value);
     Py_VISIT(self->exc_tb);
+    Py_VISIT(Py_TYPE(self));
     return 0;
 }
 
@@ -2289,13 +2213,17 @@
 static void
 PySSL_dealloc(PySSLSocket *self)
 {
-    if (self->ssl)
+    PyTypeObject *tp = Py_TYPE(self);
+    PyObject_GC_UnTrack(self);
+    if (self->ssl) {
         SSL_free(self->ssl);
+    }
     Py_XDECREF(self->Socket);
     Py_XDECREF(self->ctx);
     Py_XDECREF(self->server_hostname);
     Py_XDECREF(self->owner);
-    PyObject_Del(self);
+    PyObject_GC_Del(self);
+    Py_DECREF(tp);
 }
 
 /* If the socket has a timeout, do a select()/poll() on the socket.
@@ -2382,7 +2310,8 @@
 _ssl__SSLSocket_write_impl(PySSLSocket *self, Py_buffer *b)
 /*[clinic end generated code: output=aa7a6be5527358d8 input=77262d994fe5100a]*/
 {
-    int len;
+    size_t count = 0;
+    int retval;
     int sockstate;
     _PySSLError err;
     int nonblocking;
@@ -2392,19 +2321,14 @@
 
     if (sock != NULL) {
         if (((PyObject*)sock) == Py_None) {
-            _setSSLError("Underlying socket connection gone",
+            _setSSLError(get_state_sock(self),
+                         "Underlying socket connection gone",
                          PY_SSL_ERROR_NO_SOCKET, __FILE__, __LINE__);
             return NULL;
         }
         Py_INCREF(sock);
     }
 
-    if (b->len > INT_MAX) {
-        PyErr_Format(PyExc_OverflowError,
-                     "string longer than %d bytes", INT_MAX);
-        goto error;
-    }
-
     if (sock != NULL) {
         /* just in case the blocking state of the socket has been changed */
         nonblocking = (sock->sock_timeout >= 0);
@@ -2419,23 +2343,23 @@
 
     sockstate = PySSL_select(sock, 1, timeout);
     if (sockstate == SOCKET_HAS_TIMED_OUT) {
-        PyErr_SetString(PySocketModule.timeout_error,
+        PyErr_SetString(PyExc_TimeoutError,
                         "The write operation timed out");
         goto error;
     } else if (sockstate == SOCKET_HAS_BEEN_CLOSED) {
-        PyErr_SetString(PySSLErrorObject,
+        PyErr_SetString(get_state_sock(self)->PySSLErrorObject,
                         "Underlying socket has been closed.");
         goto error;
     } else if (sockstate == SOCKET_TOO_LARGE_FOR_SELECT) {
-        PyErr_SetString(PySSLErrorObject,
+        PyErr_SetString(get_state_sock(self)->PySSLErrorObject,
                         "Underlying socket too large for select().");
         goto error;
     }
 
     do {
         PySSL_BEGIN_ALLOW_THREADS
-        len = SSL_write(self->ssl, b->buf, (int)b->len);
-        err = _PySSL_errno(len <= 0, self->ssl, len);
+        retval = SSL_write_ex(self->ssl, b->buf, (size_t)b->len, &count);
+        err = _PySSL_errno(retval == 0, self->ssl, retval);
         PySSL_END_ALLOW_THREADS
         self->err = err;
 
@@ -2454,11 +2378,11 @@
         }
 
         if (sockstate == SOCKET_HAS_TIMED_OUT) {
-            PyErr_SetString(PySocketModule.timeout_error,
+            PyErr_SetString(PyExc_TimeoutError,
                             "The write operation timed out");
             goto error;
         } else if (sockstate == SOCKET_HAS_BEEN_CLOSED) {
-            PyErr_SetString(PySSLErrorObject,
+            PyErr_SetString(get_state_sock(self)->PySSLErrorObject,
                             "Underlying socket has been closed.");
             goto error;
         } else if (sockstate == SOCKET_IS_NONBLOCKING) {
@@ -2468,11 +2392,11 @@
              err.ssl == SSL_ERROR_WANT_WRITE);
 
     Py_XDECREF(sock);
-    if (len <= 0)
-        return PySSL_SetError(self, len, __FILE__, __LINE__);
+    if (retval == 0)
+        return PySSL_SetError(self, retval, __FILE__, __LINE__);
     if (PySSL_ChainExceptions(self) < 0)
         return NULL;
-    return PyLong_FromLong(len);
+    return PyLong_FromSize_t(count);
 error:
     Py_XDECREF(sock);
     PySSL_ChainExceptions(self);
@@ -2506,7 +2430,7 @@
 
 /*[clinic input]
 _ssl._SSLSocket.read
-    size as len: int
+    size as len: Py_ssize_t
     [
     buffer: Py_buffer(accept={rwbuffer})
     ]
@@ -2516,13 +2440,14 @@
 [clinic start generated code]*/
 
 static PyObject *
-_ssl__SSLSocket_read_impl(PySSLSocket *self, int len, int group_right_1,
-                          Py_buffer *buffer)
-/*[clinic end generated code: output=00097776cec2a0af input=ff157eb918d0905b]*/
+_ssl__SSLSocket_read_impl(PySSLSocket *self, Py_ssize_t len,
+                          int group_right_1, Py_buffer *buffer)
+/*[clinic end generated code: output=49b16e6406023734 input=ec48bf622be1c4a1]*/
 {
     PyObject *dest = NULL;
     char *mem;
-    int count;
+    size_t count = 0;
+    int retval;
     int sockstate;
     _PySSLError err;
     int nonblocking;
@@ -2537,7 +2462,8 @@
 
     if (sock != NULL) {
         if (((PyObject*)sock) == Py_None) {
-            _setSSLError("Underlying socket connection gone",
+            _setSSLError(get_state_sock(self),
+                         "Underlying socket connection gone",
                          PY_SSL_ERROR_NO_SOCKET, __FILE__, __LINE__);
             return NULL;
         }
@@ -2584,8 +2510,8 @@
 
     do {
         PySSL_BEGIN_ALLOW_THREADS
-        count = SSL_read(self->ssl, mem, len);
-        err = _PySSL_errno(count <= 0, self->ssl, count);
+        retval = SSL_read_ex(self->ssl, mem, (size_t)len, &count);
+        err = _PySSL_errno(retval == 0, self->ssl, retval);
         PySSL_END_ALLOW_THREADS
         self->err = err;
 
@@ -2609,7 +2535,7 @@
             sockstate = SOCKET_OPERATION_OK;
 
         if (sockstate == SOCKET_HAS_TIMED_OUT) {
-            PyErr_SetString(PySocketModule.timeout_error,
+            PyErr_SetString(PyExc_TimeoutError,
                             "The read operation timed out");
             goto error;
         } else if (sockstate == SOCKET_IS_NONBLOCKING) {
@@ -2618,8 +2544,8 @@
     } while (err.ssl == SSL_ERROR_WANT_READ ||
              err.ssl == SSL_ERROR_WANT_WRITE);
 
-    if (count <= 0) {
-        PySSL_SetError(self, count, __FILE__, __LINE__);
+    if (retval == 0) {
+        PySSL_SetError(self, retval, __FILE__, __LINE__);
         goto error;
     }
     if (self->exc_type != NULL)
@@ -2632,7 +2558,7 @@
         return dest;
     }
     else {
-        return PyLong_FromLong(count);
+        return PyLong_FromSize_t(count);
     }
 
 error:
@@ -2663,7 +2589,8 @@
     if (sock != NULL) {
         /* Guard against closed socket */
         if ((((PyObject*)sock) == Py_None) || (sock->sock_fd == INVALID_SOCKET)) {
-            _setSSLError("Underlying socket connection gone",
+            _setSSLError(get_state_sock(self),
+                         "Underlying socket connection gone",
                          PY_SSL_ERROR_NO_SOCKET, __FILE__, __LINE__);
             return NULL;
         }
@@ -2724,15 +2651,15 @@
 
         if (sockstate == SOCKET_HAS_TIMED_OUT) {
             if (err.ssl == SSL_ERROR_WANT_READ)
-                PyErr_SetString(PySocketModule.timeout_error,
+                PyErr_SetString(PyExc_TimeoutError,
                                 "The read operation timed out");
             else
-                PyErr_SetString(PySocketModule.timeout_error,
+                PyErr_SetString(PyExc_TimeoutError,
                                 "The write operation timed out");
             goto error;
         }
         else if (sockstate == SOCKET_TOO_LARGE_FOR_SELECT) {
-            PyErr_SetString(PySSLErrorObject,
+            PyErr_SetString(get_state_sock(self)->PySSLErrorObject,
                             "Underlying socket too large for select().");
             goto error;
         }
@@ -2817,7 +2744,7 @@
 #ifdef TLS1_3_VERSION
     int err = SSL_verify_client_post_handshake(self->ssl);
     if (err == 0)
-        return _setSSLError(NULL, 0, __FILE__, __LINE__);
+        return _setSSLError(get_state_sock(self), NULL, 0, __FILE__, __LINE__);
     else
         Py_RETURN_NONE;
 #else
@@ -2828,8 +2755,6 @@
 #endif
 }
 
-#ifdef OPENSSL_VERSION_1_1
-
 static SSL_SESSION*
 _ssl_session_dup(SSL_SESSION *session) {
     SSL_SESSION *newsession = NULL;
@@ -2870,7 +2795,6 @@
     }
     return NULL;
 }
-#endif
 
 static PyObject *
 PySSL_get_session(PySSLSocket *self, void *closure) {
@@ -2879,7 +2803,6 @@
     PySSLSession *pysess;
     SSL_SESSION *session;
 
-#ifdef OPENSSL_VERSION_1_1
     /* duplicate session as workaround for session bug in OpenSSL 1.1.0,
      * https://github.com/openssl/openssl/issues/1550 */
     session = SSL_get0_session(self->ssl);  /* borrowed reference */
@@ -2889,13 +2812,11 @@
     if ((session = _ssl_session_dup(session)) == NULL) {
         return NULL;
     }
-#else
     session = SSL_get1_session(self->ssl);
     if (session == NULL) {
         Py_RETURN_NONE;
     }
-#endif
-    pysess = PyObject_GC_New(PySSLSession, &PySSLSession_Type);
+    pysess = PyObject_GC_New(PySSLSession, self->ctx->state->PySSLSession_Type);
     if (pysess == NULL) {
         SSL_SESSION_free(session);
         return NULL;
@@ -2913,12 +2834,10 @@
                              void *closure)
                               {
     PySSLSession *pysess;
-#ifdef OPENSSL_VERSION_1_1
     SSL_SESSION *session;
-#endif
     int result;
 
-    if (!PySSLSession_Check(value)) {
+    if (!Py_IS_TYPE(value, get_state_sock(self)->PySSLSession_Type)) {
         PyErr_SetString(PyExc_TypeError, "Value is not a SSLSession.");
         return -1;
     }
@@ -2939,7 +2858,6 @@
                         "Cannot set session after handshake.");
         return -1;
     }
-#ifdef OPENSSL_VERSION_1_1
     /* duplicate session */
     if ((session = _ssl_session_dup(pysess->session)) == NULL) {
         return -1;
@@ -2947,11 +2865,8 @@
     result = SSL_set_session(self->ssl, session);
     /* free duplicate, SSL_set_session() bumps ref count */
     SSL_SESSION_free(session);
-#else
-    result = SSL_set_session(self->ssl, pysess->session);
-#endif
     if (result == 0) {
-        _setSSLError(NULL, 0, __FILE__, __LINE__);
+        _setSSLError(get_state_sock(self), NULL, 0, __FILE__, __LINE__);
         return -1;
     }
     return 0;
@@ -3000,48 +2915,31 @@
     _SSL__SSLSOCKET_CIPHER_METHODDEF
     _SSL__SSLSOCKET_SHARED_CIPHERS_METHODDEF
     _SSL__SSLSOCKET_VERSION_METHODDEF
-    _SSL__SSLSOCKET_SELECTED_NPN_PROTOCOL_METHODDEF
     _SSL__SSLSOCKET_SELECTED_ALPN_PROTOCOL_METHODDEF
     _SSL__SSLSOCKET_COMPRESSION_METHODDEF
     _SSL__SSLSOCKET_SHUTDOWN_METHODDEF
     _SSL__SSLSOCKET_VERIFY_CLIENT_POST_HANDSHAKE_METHODDEF
+    _SSL__SSLSOCKET_GET_UNVERIFIED_CHAIN_METHODDEF
+    _SSL__SSLSOCKET_GET_VERIFIED_CHAIN_METHODDEF
     {NULL, NULL}
 };
 
-static PyTypeObject PySSLSocket_Type = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "_ssl._SSLSocket",                  /*tp_name*/
-    sizeof(PySSLSocket),                /*tp_basicsize*/
-    0,                                  /*tp_itemsize*/
-    /* methods */
-    (destructor)PySSL_dealloc,          /*tp_dealloc*/
-    0,                                  /*tp_vectorcall_offset*/
-    0,                                  /*tp_getattr*/
-    0,                                  /*tp_setattr*/
-    0,                                  /*tp_as_async*/
-    0,                                  /*tp_repr*/
-    0,                                  /*tp_as_number*/
-    0,                                  /*tp_as_sequence*/
-    0,                                  /*tp_as_mapping*/
-    0,                                  /*tp_hash*/
-    0,                                  /*tp_call*/
-    0,                                  /*tp_str*/
-    0,                                  /*tp_getattro*/
-    0,                                  /*tp_setattro*/
-    0,                                  /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT,                 /*tp_flags*/
-    0,                                  /*tp_doc*/
-    (traverseproc) PySSL_traverse,      /*tp_traverse*/
-    (inquiry) PySSL_clear,              /*tp_clear*/
-    0,                                  /*tp_richcompare*/
-    0,                                  /*tp_weaklistoffset*/
-    0,                                  /*tp_iter*/
-    0,                                  /*tp_iternext*/
-    PySSLMethods,                       /*tp_methods*/
-    0,                                  /*tp_members*/
-    ssl_getsetlist,                     /*tp_getset*/
+static PyType_Slot PySSLSocket_slots[] = {
+    {Py_tp_methods, PySSLMethods},
+    {Py_tp_getset, ssl_getsetlist},
+    {Py_tp_dealloc, PySSL_dealloc},
+    {Py_tp_traverse, PySSL_traverse},
+    {Py_tp_clear, PySSL_clear},
+    {0, 0},
 };
 
+static PyType_Spec PySSLSocket_spec = {
+    .name = "_ssl._SSLSocket",
+    .basicsize = sizeof(PySSLSocket),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE |
+              Py_TPFLAGS_HAVE_GC),
+    .slots = PySSLSocket_slots,
+};
 
 /*
  * _SSLContext objects
@@ -3091,63 +2989,78 @@
 {
     PySSLContext *self;
     long options;
+    const SSL_METHOD *method = NULL;
     SSL_CTX *ctx = NULL;
     X509_VERIFY_PARAM *params;
     int result;
-#if defined(SSL_MODE_RELEASE_BUFFERS)
-    unsigned long libver;
-#endif
 
-    PySSL_BEGIN_ALLOW_THREADS
+   /* slower approach, walk MRO and get borrowed reference to module.
+    * _PyType_GetModuleByDef is required for SSLContext subclasses */
+    PyObject *module = _PyType_GetModuleByDef(type, &_sslmodule_def);
+    if (module == NULL) {
+        PyErr_SetString(PyExc_RuntimeError,
+                        "Cannot find internal module state");
+        return NULL;
+    }
+
     switch(proto_version) {
 #if defined(SSL3_VERSION) && !defined(OPENSSL_NO_SSL3)
     case PY_SSL_VERSION_SSL3:
-        ctx = SSL_CTX_new(SSLv3_method());
+        PY_SSL_DEPRECATED("ssl.PROTOCOL_SSLv3 is deprecated", 2, NULL);
+        method = SSLv3_method();
         break;
 #endif
 #if (defined(TLS1_VERSION) && \
         !defined(OPENSSL_NO_TLS1) && \
         !defined(OPENSSL_NO_TLS1_METHOD))
     case PY_SSL_VERSION_TLS1:
-        ctx = SSL_CTX_new(TLSv1_method());
+        PY_SSL_DEPRECATED("ssl.PROTOCOL_TLSv1 is deprecated", 2, NULL);
+        method = TLSv1_method();
         break;
 #endif
 #if (defined(TLS1_1_VERSION) && \
         !defined(OPENSSL_NO_TLS1_1) && \
         !defined(OPENSSL_NO_TLS1_1_METHOD))
     case PY_SSL_VERSION_TLS1_1:
-        ctx = SSL_CTX_new(TLSv1_1_method());
+        PY_SSL_DEPRECATED("ssl.PROTOCOL_TLSv1_1 is deprecated", 2, NULL);
+        method = TLSv1_1_method();
         break;
 #endif
 #if (defined(TLS1_2_VERSION) && \
         !defined(OPENSSL_NO_TLS1_2) && \
         !defined(OPENSSL_NO_TLS1_2_METHOD))
     case PY_SSL_VERSION_TLS1_2:
-        ctx = SSL_CTX_new(TLSv1_2_method());
+        PY_SSL_DEPRECATED("ssl.PROTOCOL_TLSv1_2 is deprecated", 2, NULL);
+        method = TLSv1_2_method();
         break;
 #endif
     case PY_SSL_VERSION_TLS:
-        /* SSLv23 */
-        ctx = SSL_CTX_new(TLS_method());
+        PY_SSL_DEPRECATED("ssl.PROTOCOL_TLS is deprecated", 2, NULL);
+        method = TLS_method();
         break;
     case PY_SSL_VERSION_TLS_CLIENT:
-        ctx = SSL_CTX_new(TLS_client_method());
+        method = TLS_client_method();
         break;
     case PY_SSL_VERSION_TLS_SERVER:
-        ctx = SSL_CTX_new(TLS_server_method());
+        method = TLS_server_method();
         break;
     default:
-        proto_version = -1;
+        method = NULL;
     }
-    PySSL_END_ALLOW_THREADS
 
-    if (proto_version == -1) {
-        PyErr_SetString(PyExc_ValueError,
-                        "invalid or unsupported protocol version");
+    if (method == NULL) {
+        PyErr_Format(PyExc_ValueError,
+                     "invalid or unsupported protocol version %i",
+                     proto_version);
         return NULL;
     }
+
+    PySSL_BEGIN_ALLOW_THREADS
+    ctx = SSL_CTX_new(method);
+    PySSL_END_ALLOW_THREADS
+
     if (ctx == NULL) {
-        _setSSLError(NULL, 0, __FILE__, __LINE__);
+        _setSSLError(get_ssl_state(module), NULL, 0, __FILE__, __LINE__);
         return NULL;
     }
 
@@ -3161,19 +3074,12 @@
     self->hostflags = X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS;
     self->protocol = proto_version;
     self->msg_cb = NULL;
-#ifdef HAVE_OPENSSL_KEYLOG
     self->keylog_filename = NULL;
     self->keylog_bio = NULL;
-#endif
-#if HAVE_NPN
-    self->npn_protocols = NULL;
-#endif
-#if HAVE_ALPN
     self->alpn_protocols = NULL;
-#endif
-#ifndef OPENSSL_NO_TLSEXT
     self->set_sni_cb = NULL;
-#endif
+    self->state = get_ssl_state(module);
+
     /* Don't check host name by default */
     if (proto_version == PY_SSL_VERSION_TLS_CLIENT) {
         self->check_hostname = 1;
@@ -3208,6 +3114,10 @@
 #ifdef SSL_OP_SINGLE_ECDH_USE
     options |= SSL_OP_SINGLE_ECDH_USE;
 #endif
+#ifdef SSL_OP_IGNORE_UNEXPECTED_EOF
+    /* Make OpenSSL 3.0.0 behave like 1.1.1 */
+    options |= SSL_OP_IGNORE_UNEXPECTED_EOF;
+#endif
     SSL_CTX_set_options(self->ctx, options);
 
     /* A bare minimum cipher list without completely broken cipher suites.
@@ -3226,42 +3136,31 @@
     if (result == 0) {
         Py_DECREF(self);
         ERR_clear_error();
-        PyErr_SetString(PySSLErrorObject,
+        PyErr_SetString(get_state_ctx(self)->PySSLErrorObject,
                         "No cipher can be selected.");
-        return NULL;
+        goto error;
     }
+#ifdef PY_SSL_MIN_PROTOCOL
+    switch(proto_version) {
+    case PY_SSL_VERSION_TLS:
+    case PY_SSL_VERSION_TLS_CLIENT:
+    case PY_SSL_VERSION_TLS_SERVER:
+        result = SSL_CTX_set_min_proto_version(ctx, PY_SSL_MIN_PROTOCOL);
+        if (result == 0) {
+            PyErr_Format(PyExc_ValueError,
+                         "Failed to set minimum protocol 0x%x",
+                          PY_SSL_MIN_PROTOCOL);
+            goto error;
+        }
+        break;
+    default:
+        break;
+    }
+#endif
 
-#if defined(SSL_MODE_RELEASE_BUFFERS)
     /* Set SSL_MODE_RELEASE_BUFFERS. This potentially greatly reduces memory
-       usage for no cost at all. However, don't do this for OpenSSL versions
-       between 1.0.1 and 1.0.1h or 1.0.0 and 1.0.0m, which are affected by CVE
-       2014-0198. I can't find exactly which beta fixed this CVE, so be
-       conservative and assume it wasn't fixed until release. We do this check
-       at runtime to avoid problems from the dynamic linker.
-       See #25672 for more on this. */
-    libver = OpenSSL_version_num();
-    if (!(libver >= 0x10001000UL && libver < 0x1000108fUL) &&
-        !(libver >= 0x10000000UL && libver < 0x100000dfUL)) {
-        SSL_CTX_set_mode(self->ctx, SSL_MODE_RELEASE_BUFFERS);
-    }
-#endif
-
-
-#if !defined(OPENSSL_NO_ECDH) && !defined(OPENSSL_VERSION_1_1)
-    /* Allow automatic ECDH curve selection (on OpenSSL 1.0.2+), or use
-       prime256v1 by default.  This is Apache mod_ssl's initialization
-       policy, so we should be safe. OpenSSL 1.1 has it enabled by default.
-     */
-#if defined(SSL_CTX_set_ecdh_auto)
-    SSL_CTX_set_ecdh_auto(self->ctx, 1);
-#else
-    {
-        EC_KEY *key = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
-        SSL_CTX_set_tmp_ecdh(self->ctx, key);
-        EC_KEY_free(key);
-    }
-#endif
-#endif
+       usage for no cost at all. */
+    SSL_CTX_set_mode(self->ctx, SSL_MODE_RELEASE_BUFFERS);
 
 #define SID_CTX "Python"
     SSL_CTX_set_session_id_context(self->ctx, (const unsigned char *) SID_CTX,
@@ -3269,11 +3168,9 @@
 #undef SID_CTX
 
     params = SSL_CTX_get0_param(self->ctx);
-#ifdef X509_V_FLAG_TRUSTED_FIRST
     /* Improve trust chain building when cross-signed intermediate
        certificates are present. See https://bugs.python.org/issue23476. */
     X509_VERIFY_PARAM_set_flags(params, X509_V_FLAG_TRUSTED_FIRST);
-#endif
     X509_VERIFY_PARAM_set_hostflags(params, self->hostflags);
 
 #ifdef TLS1_3_VERSION
@@ -3282,26 +3179,26 @@
 #endif
 
     return (PyObject *)self;
+  error:
+    Py_XDECREF(self);
+    ERR_clear_error();
+    return NULL;
 }
 
 static int
 context_traverse(PySSLContext *self, visitproc visit, void *arg)
 {
-#ifndef OPENSSL_NO_TLSEXT
     Py_VISIT(self->set_sni_cb);
-#endif
     Py_VISIT(self->msg_cb);
+    Py_VISIT(Py_TYPE(self));
     return 0;
 }
 
 static int
 context_clear(PySSLContext *self)
 {
-#ifndef OPENSSL_NO_TLSEXT
     Py_CLEAR(self->set_sni_cb);
-#endif
     Py_CLEAR(self->msg_cb);
-#ifdef HAVE_OPENSSL_KEYLOG
     Py_CLEAR(self->keylog_filename);
     if (self->keylog_bio != NULL) {
         PySSL_BEGIN_ALLOW_THREADS
@@ -3309,24 +3206,20 @@
         PySSL_END_ALLOW_THREADS
         self->keylog_bio = NULL;
     }
-#endif
     return 0;
 }
 
 static void
 context_dealloc(PySSLContext *self)
 {
+    PyTypeObject *tp = Py_TYPE(self);
     /* bpo-31095: UnTrack is needed before calling any callbacks */
     PyObject_GC_UnTrack(self);
     context_clear(self);
     SSL_CTX_free(self->ctx);
-#if HAVE_NPN
-    PyMem_FREE(self->npn_protocols);
-#endif
-#if HAVE_ALPN
     PyMem_FREE(self->alpn_protocols);
-#endif
     Py_TYPE(self)->tp_free(self);
+    Py_DECREF(tp);
 }
 
 /*[clinic input]
@@ -3345,14 +3238,13 @@
            otherwise the error will be reported again when another SSL call
            is done. */
         ERR_clear_error();
-        PyErr_SetString(PySSLErrorObject,
+        PyErr_SetString(get_state_ctx(self)->PySSLErrorObject,
                         "No cipher can be selected.");
         return NULL;
     }
     Py_RETURN_NONE;
 }
 
-#if OPENSSL_VERSION_NUMBER >= 0x10002000UL
 /*[clinic input]
 _ssl._SSLContext.get_ciphers
 [clinic start generated code]*/
@@ -3369,7 +3261,7 @@
 
     ssl = SSL_new(self->ctx);
     if (ssl == NULL) {
-        _setSSLError(NULL, 0, __FILE__, __LINE__);
+        _setSSLError(get_state_ctx(self), NULL, 0, __FILE__, __LINE__);
         goto exit;
     }
     sk = SSL_get_ciphers(ssl);
@@ -3395,10 +3287,8 @@
     return result;
 
 }
-#endif
 
 
-#if HAVE_NPN || HAVE_ALPN
 static int
 do_protocol_selection(int alpn, unsigned char **out, unsigned char *outlen,
                       const unsigned char *server_protocols, unsigned int server_protocols_len,
@@ -3422,77 +3312,7 @@
 
     return SSL_TLSEXT_ERR_OK;
 }
-#endif
 
-#if HAVE_NPN
-/* this callback gets passed to SSL_CTX_set_next_protos_advertise_cb */
-static int
-_advertiseNPN_cb(SSL *s,
-                 const unsigned char **data, unsigned int *len,
-                 void *args)
-{
-    PySSLContext *ssl_ctx = (PySSLContext *) args;
-
-    if (ssl_ctx->npn_protocols == NULL) {
-        *data = (unsigned char *)"";
-        *len = 0;
-    } else {
-        *data = ssl_ctx->npn_protocols;
-        *len = ssl_ctx->npn_protocols_len;
-    }
-
-    return SSL_TLSEXT_ERR_OK;
-}
-/* this callback gets passed to SSL_CTX_set_next_proto_select_cb */
-static int
-_selectNPN_cb(SSL *s,
-              unsigned char **out, unsigned char *outlen,
-              const unsigned char *server, unsigned int server_len,
-              void *args)
-{
-    PySSLContext *ctx = (PySSLContext *)args;
-    return do_protocol_selection(0, out, outlen, server, server_len,
-                                 ctx->npn_protocols, ctx->npn_protocols_len);
-}
-#endif
-
-/*[clinic input]
-_ssl._SSLContext._set_npn_protocols
-    protos: Py_buffer
-    /
-[clinic start generated code]*/
-
-static PyObject *
-_ssl__SSLContext__set_npn_protocols_impl(PySSLContext *self,
-                                         Py_buffer *protos)
-/*[clinic end generated code: output=72b002c3324390c6 input=319fcb66abf95bd7]*/
-{
-#if HAVE_NPN
-    PyMem_Free(self->npn_protocols);
-    self->npn_protocols = PyMem_Malloc(protos->len);
-    if (self->npn_protocols == NULL)
-        return PyErr_NoMemory();
-    memcpy(self->npn_protocols, protos->buf, protos->len);
-    self->npn_protocols_len = (int) protos->len;
-
-    /* set both server and client callbacks, because the context can
-     * be used to create both types of sockets */
-    SSL_CTX_set_next_protos_advertised_cb(self->ctx,
-                                          _advertiseNPN_cb,
-                                          self);
-    SSL_CTX_set_next_proto_select_cb(self->ctx,
-                                     _selectNPN_cb,
-                                     self);
-
-    Py_RETURN_NONE;
-#else
-    PyErr_SetString(PyExc_NotImplementedError,
-                    "The NPN extension requires OpenSSL 1.0.1 or later.");
-    return NULL;
-#endif
-}
-
-#if HAVE_ALPN
 static int
 _selectALPN_cb(SSL *s,
               const unsigned char **out, unsigned char *outlen,
@@ -3504,7 +3324,6 @@
                                  ctx->alpn_protocols, ctx->alpn_protocols_len,
                                  client_protocols, client_protocols_len);
 }
-#endif
 
 /*[clinic input]
 _ssl._SSLContext._set_alpn_protocols
@@ -3517,14 +3336,13 @@
                                           Py_buffer *protos)
 /*[clinic end generated code: output=87599a7f76651a9b input=9bba964595d519be]*/
 {
-#if HAVE_ALPN
     if ((size_t)protos->len > UINT_MAX) {
         PyErr_Format(PyExc_OverflowError,
             "protocols longer than %u bytes", UINT_MAX);
         return NULL;
     }
 
-    PyMem_FREE(self->alpn_protocols);
+    PyMem_Free(self->alpn_protocols);
     self->alpn_protocols = PyMem_Malloc(protos->len);
     if (!self->alpn_protocols)
         return PyErr_NoMemory();
@@ -3536,11 +3354,6 @@
     SSL_CTX_set_alpn_select_cb(self->ctx, _selectALPN_cb, self);
 
     Py_RETURN_NONE;
-#else
-    PyErr_SetString(PyExc_NotImplementedError,
-                    "The ALPN extension requires OpenSSL 1.0.2 or later.");
-    return NULL;
-#endif
 }
 
 static PyObject *
@@ -3557,7 +3370,7 @@
     case SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT:
         return PyLong_FromLong(PY_SSL_CERT_REQUIRED);
     }
-    PyErr_SetString(PySSLErrorObject,
+    PyErr_SetString(get_state_ctx(self)->PySSLErrorObject,
                     "invalid return value from SSL_CTX_get_verify_mode");
     return NULL;
 }
@@ -3602,13 +3415,13 @@
     set = ~flags & new_flags;
     if (clear) {
         if (!X509_VERIFY_PARAM_clear_flags(param, clear)) {
-            _setSSLError(NULL, 0, __FILE__, __LINE__);
+            _setSSLError(get_state_ctx(self), NULL, 0, __FILE__, __LINE__);
             return -1;
         }
     }
     if (set) {
         if (!X509_VERIFY_PARAM_set_flags(param, set)) {
-            _setSSLError(NULL, 0, __FILE__, __LINE__);
+            _setSSLError(get_state_ctx(self), NULL, 0, __FILE__, __LINE__);
             return -1;
         }
     }
@@ -3616,9 +3429,6 @@
 }
 
 /* Getter and setter for protocol version */
-#if defined(SSL_CTRL_GET_MAX_PROTO_VERSION)
-
-
 static int
 set_min_max_proto_version(PySSLContext *self, PyObject *arg, int what)
 {
@@ -3646,6 +3456,29 @@
         return -1;
     }
 
+    /* check for deprecations and supported values */
+    switch(v) {
+        case PY_PROTO_SSLv3:
+            PY_SSL_DEPRECATED("ssl.TLSVersion.SSLv3 is deprecated", 2, -1);
+            break;
+        case PY_PROTO_TLSv1:
+            PY_SSL_DEPRECATED("ssl.TLSVersion.TLSv1 is deprecated", 2, -1);
+            break;
+        case PY_PROTO_TLSv1_1:
+            PY_SSL_DEPRECATED("ssl.TLSVersion.TLSv1_1 is deprecated", 2, -1);
+            break;
+        case PY_PROTO_MINIMUM_SUPPORTED:
+        case PY_PROTO_MAXIMUM_SUPPORTED:
+        case PY_PROTO_TLSv1_2:
+        case PY_PROTO_TLSv1_3:
+            /* ok */
+            break;
+        default:
+            PyErr_Format(PyExc_ValueError,
+                     "Unsupported TLS/SSL version 0x%x", v);
+            return -1;
+    }
+
     if (what == 0) {
         switch(v) {
         case PY_PROTO_MINIMUM_SUPPORTED:
@@ -3713,9 +3546,8 @@
 {
     return set_min_max_proto_version(self, arg, 1);
 }
-#endif /* SSL_CTRL_GET_MAX_PROTO_VERSION */
 
-#if (OPENSSL_VERSION_NUMBER >= 0x10101000L) && !defined(LIBRESSL_VERSION_NUMBER)
+#ifdef TLS1_3_VERSION
 static PyObject *
 get_num_tickets(PySSLContext *self, void *c)
 {
@@ -3746,7 +3578,14 @@
 
 PyDoc_STRVAR(PySSLContext_num_tickets_doc,
 "Control the number of TLSv1.3 session tickets");
-#endif /* OpenSSL 1.1.1 */
+#endif /* TLS1_3_VERSION */
+
+static PyObject *
+get_security_level(PySSLContext *self, void *c)
+{
+    return PyLong_FromLong(SSL_CTX_get_security_level(self->ctx));
+}
+PyDoc_STRVAR(PySSLContext_security_level_doc, "The current security level");
 
 static PyObject *
 get_options(PySSLContext *self, void *c)
@@ -3758,19 +3597,25 @@
 set_options(PySSLContext *self, PyObject *arg, void *c)
 {
     long new_opts, opts, set, clear;
+    long opt_no = (
+        SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1 |
+        SSL_OP_NO_TLSv1_1 | SSL_OP_NO_TLSv1_2 | SSL_OP_NO_TLSv1_3
+    );
+
     if (!PyArg_Parse(arg, "l", &new_opts))
         return -1;
     opts = SSL_CTX_get_options(self->ctx);
     clear = opts & ~new_opts;
     set = ~opts & new_opts;
+
+    if ((set & opt_no) != 0) {
+        if (_ssl_deprecated("ssl.OP_NO_SSL*/ssl.OP_NO_TLS* options are "
+                            "deprecated", 2) < 0) {
+            return -1;
+        }
+    }
     if (clear) {
-#ifdef HAVE_SSL_CTX_CLEAR_OPTIONS
         SSL_CTX_clear_options(self->ctx, clear);
-#else
-        PyErr_SetString(PyExc_ValueError,
-                        "can't clear options before OpenSSL 0.9.8m");
-        return -1;
-#endif
     }
     if (set)
         SSL_CTX_set_options(self->ctx, set);
@@ -3926,6 +3771,13 @@
 
     PySSL_END_ALLOW_THREADS_S(pw_info->thread_state);
 
+    if (pw_info->error) {
+        /* already failed previously. OpenSSL 3.0.0-alpha14 invokes the
+         * callback multiple times which can lead to fatal Python error in
+         * exception check. */
+        goto error;
+    }
+
     if (pw_info->callable) {
         fn_ret = _PyObject_CallNoArg(pw_info->callable);
         if (!fn_ret) {
@@ -4019,7 +3871,7 @@
             PyErr_SetFromErrno(PyExc_OSError);
         }
         else {
-            _setSSLError(NULL, 0, __FILE__, __LINE__);
+            _setSSLError(get_state_ctx(self), NULL, 0, __FILE__, __LINE__);
         }
         goto error;
     }
@@ -4040,7 +3892,7 @@
             PyErr_SetFromErrno(PyExc_OSError);
         }
         else {
-            _setSSLError(NULL, 0, __FILE__, __LINE__);
+            _setSSLError(get_state_ctx(self), NULL, 0, __FILE__, __LINE__);
         }
         goto error;
     }
@@ -4048,7 +3900,7 @@
     r = SSL_CTX_check_private_key(self->ctx);
     PySSL_END_ALLOW_THREADS_S(pw_info.thread_state);
     if (r != 1) {
-        _setSSLError(NULL, 0, __FILE__, __LINE__);
+        _setSSLError(get_state_ctx(self), NULL, 0, __FILE__, __LINE__);
         goto error;
     }
     SSL_CTX_set_default_passwd_cb(self->ctx, orig_passwd_cb);
@@ -4073,7 +3925,7 @@
 {
     BIO *biobuf = NULL;
     X509_STORE *store;
-    int retval = 0, err, loaded = 0;
+    int retval = -1, err, loaded = 0;
 
     assert(filetype == SSL_FILETYPE_ASN1 || filetype == SSL_FILETYPE_PEM);
 
@@ -4089,7 +3941,7 @@
 
     biobuf = BIO_new_mem_buf(data, (int)len);
     if (biobuf == NULL) {
-        _setSSLError("Can't allocate buffer", 0, __FILE__, __LINE__);
+        _setSSLError(get_state_ctx(self), "Can't allocate buffer", 0, __FILE__, __LINE__);
         return -1;
     }
 
@@ -4127,23 +3979,32 @@
     }
 
     err = ERR_peek_last_error();
-    if ((filetype == SSL_FILETYPE_ASN1) &&
-            (loaded > 0) &&
-            (ERR_GET_LIB(err) == ERR_LIB_ASN1) &&
-            (ERR_GET_REASON(err) == ASN1_R_HEADER_TOO_LONG)) {
+    if (loaded == 0) {
+        const char *msg = NULL;
+        if (filetype == SSL_FILETYPE_PEM) {
+            msg = "no start line: cadata does not contain a certificate";
+        } else {
+            msg = "not enough data: cadata does not contain a certificate";
+        }
+        _setSSLError(get_state_ctx(self), msg, 0, __FILE__, __LINE__);
+        retval = -1;
+    } else if ((filetype == SSL_FILETYPE_ASN1) &&
+                    (ERR_GET_LIB(err) == ERR_LIB_ASN1) &&
+                    (ERR_GET_REASON(err) == ASN1_R_HEADER_TOO_LONG)) {
         /* EOF ASN1 file, not an error */
         ERR_clear_error();
         retval = 0;
     } else if ((filetype == SSL_FILETYPE_PEM) &&
-                   (loaded > 0) &&
                    (ERR_GET_LIB(err) == ERR_LIB_PEM) &&
                    (ERR_GET_REASON(err) == PEM_R_NO_START_LINE)) {
         /* EOF PEM file, not an error */
         ERR_clear_error();
         retval = 0;
-    } else {
-        _setSSLError(NULL, 0, __FILE__, __LINE__);
+    } else if (err != 0) {
+        _setSSLError(get_state_ctx(self), NULL, 0, __FILE__, __LINE__);
         retval = -1;
+    } else {
+        retval = 0;
     }
 
     BIO_free(biobuf);
@@ -4198,7 +4059,7 @@
         goto error;
     }
 
-    /* validata cadata type and load cadata */
+    /* validate cadata type and load cadata */
     if (cadata) {
         if (PyUnicode_Check(cadata)) {
             PyObject *cadata_ascii = PyUnicode_AsASCIIString(cadata);
@@ -4259,7 +4120,7 @@
                 PyErr_SetFromErrno(PyExc_OSError);
             }
             else {
-                _setSSLError(NULL, 0, __FILE__, __LINE__);
+                _setSSLError(get_state_ctx(self), NULL, 0, __FILE__, __LINE__);
             }
             goto error;
         }
@@ -4307,13 +4168,13 @@
             PyErr_SetFromErrnoWithFilenameObject(PyExc_OSError, filepath);
         }
         else {
-            _setSSLError(NULL, 0, __FILE__, __LINE__);
+            _setSSLError(get_state_ctx(self), NULL, 0, __FILE__, __LINE__);
         }
         return NULL;
     }
     if (!SSL_CTX_set_tmp_dh(self->ctx, dh)) {
         DH_free(dh);
-        return _setSSLError(NULL, 0, __FILE__, __LINE__);
+        return _setSSLError(get_state_ctx(self), NULL, 0, __FILE__, __LINE__);
     }
     DH_free(dh);
     Py_RETURN_NONE;
@@ -4321,7 +4182,7 @@
 
 /*[clinic input]
 _ssl._SSLContext._wrap_socket
-    sock: object(subclass_of="PySocketModule.Sock_Type")
+    sock: object(subclass_of="get_state_ctx(self)->Sock_Type")
     server_side: int
     server_hostname as hostname_obj: object = None
     *
@@ -4334,7 +4195,7 @@
 _ssl__SSLContext__wrap_socket_impl(PySSLContext *self, PyObject *sock,
                                    int server_side, PyObject *hostname_obj,
                                    PyObject *owner, PyObject *session)
-/*[clinic end generated code: output=f103f238633940b4 input=957d5006183d1894]*/
+/*[clinic end generated code: output=f103f238633940b4 input=f5916eadbc6eae81]*/
 {
     char *hostname = NULL;
     PyObject *res;
@@ -4357,8 +4218,8 @@
 
 /*[clinic input]
 _ssl._SSLContext._wrap_bio
-    incoming: object(subclass_of="&PySSLMemoryBIO_Type", type="PySSLMemoryBIO *")
-    outgoing: object(subclass_of="&PySSLMemoryBIO_Type", type="PySSLMemoryBIO *")
+    incoming: object(subclass_of="get_state_ctx(self)->PySSLMemoryBIO_Type", type="PySSLMemoryBIO *")
+    outgoing: object(subclass_of="get_state_ctx(self)->PySSLMemoryBIO_Type", type="PySSLMemoryBIO *")
     server_side: int
     server_hostname as hostname_obj: object = None
     *
@@ -4372,7 +4233,7 @@
                                 PySSLMemoryBIO *outgoing, int server_side,
                                 PyObject *hostname_obj, PyObject *owner,
                                 PyObject *session)
-/*[clinic end generated code: output=5c5d6d9b41f99332 input=8cf22f4d586ac56a]*/
+/*[clinic end generated code: output=5c5d6d9b41f99332 input=331edeec9c738382]*/
 {
     char *hostname = NULL;
     PyObject *res;
@@ -4445,13 +4306,12 @@
 /*[clinic end generated code: output=0bee74e6e09deaaa input=35f3408021463d74]*/
 {
     if (!SSL_CTX_set_default_verify_paths(self->ctx)) {
-        _setSSLError(NULL, 0, __FILE__, __LINE__);
+        _setSSLError(get_state_ctx(self), NULL, 0, __FILE__, __LINE__);
         return NULL;
     }
     Py_RETURN_NONE;
 }
 
-#ifndef OPENSSL_NO_ECDH
 /*[clinic input]
 _ssl._SSLContext.set_ecdh_curve
     name: object
@@ -4479,21 +4339,19 @@
     }
     key = EC_KEY_new_by_curve_name(nid);
     if (key == NULL) {
-        _setSSLError(NULL, 0, __FILE__, __LINE__);
+        _setSSLError(get_state_ctx(self), NULL, 0, __FILE__, __LINE__);
         return NULL;
     }
     SSL_CTX_set_tmp_ecdh(self->ctx, key);
     EC_KEY_free(key);
     Py_RETURN_NONE;
 }
-#endif
 
-#if HAVE_SNI && !defined(OPENSSL_NO_TLSEXT)
 static int
 _servername_callback(SSL *s, int *al, void *args)
 {
     int ret;
-    PySSLContext *ssl_ctx = (PySSLContext *) args;
+    PySSLContext *sslctx = (PySSLContext *) args;
     PySSLSocket *ssl;
     PyObject *result;
     /* The high-level ssl.SSLSocket object */
@@ -4501,7 +4359,7 @@
     const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name);
     PyGILState_STATE gstate = PyGILState_Ensure();
 
-    if (ssl_ctx->set_sni_cb == NULL) {
+    if (sslctx->set_sni_cb == NULL) {
         /* remove race condition in this the call back while if removing the
          * callback is in progress */
         PyGILState_Release(gstate);
@@ -4509,7 +4367,7 @@
     }
 
     ssl = SSL_get_app_data(s);
-    assert(PySSLSocket_Check(ssl));
+    assert(Py_IS_TYPE(ssl, get_state_ctx(sslctx)->PySSLSocket_Type));
 
     /* The servername callback expects an argument that represents the current
      * SSL connection and that has a .context attribute that can be changed to
@@ -4531,8 +4389,8 @@
         goto error;
 
     if (servername == NULL) {
-        result = PyObject_CallFunctionObjArgs(ssl_ctx->set_sni_cb, ssl_socket,
-                                              Py_None, ssl_ctx, NULL);
+        result = PyObject_CallFunctionObjArgs(sslctx->set_sni_cb, ssl_socket,
+                                              Py_None, sslctx, NULL);
     }
     else {
         PyObject *servername_bytes;
@@ -4540,7 +4398,7 @@
 
         servername_bytes = PyBytes_FromString(servername);
         if (servername_bytes == NULL) {
-            PyErr_WriteUnraisable((PyObject *) ssl_ctx);
+            PyErr_WriteUnraisable((PyObject *) sslctx);
             goto error;
         }
         /* server_hostname was encoded to an A-label by our caller; put it
@@ -4554,14 +4412,14 @@
         }
         Py_DECREF(servername_bytes);
         result = PyObject_CallFunctionObjArgs(
-            ssl_ctx->set_sni_cb, ssl_socket, servername_str,
-            ssl_ctx, NULL);
+            sslctx->set_sni_cb, ssl_socket, servername_str,
+            sslctx, NULL);
         Py_DECREF(servername_str);
     }
     Py_DECREF(ssl_socket);
 
     if (result == NULL) {
-        PyErr_WriteUnraisable(ssl_ctx->set_sni_cb);
+        PyErr_WriteUnraisable(sslctx->set_sni_cb);
         *al = SSL_AD_HANDSHAKE_FAILURE;
         ret = SSL_TLSEXT_ERR_ALERT_FATAL;
     }
@@ -4592,7 +4450,6 @@
     PyGILState_Release(gstate);
     return ret;
 }
-#endif
 
 static PyObject *
 get_sni_callback(PySSLContext *self, void *c)
@@ -4613,7 +4470,6 @@
                         "sni_callback cannot be set on TLS_CLIENT context");
         return -1;
     }
-#if HAVE_SNI && !defined(OPENSSL_NO_TLSEXT)
     Py_CLEAR(self->set_sni_cb);
     if (arg == Py_None) {
         SSL_CTX_set_tlsext_servername_callback(self->ctx, NULL);
@@ -4631,13 +4487,6 @@
         SSL_CTX_set_tlsext_servername_arg(self->ctx, self);
     }
     return 0;
-#else
-    PyErr_SetString(PyExc_NotImplementedError,
-                    "The TLS extension servername callback, "
-                    "SSL_CTX_set_tlsext_servername_callback, "
-                    "is not in the current OpenSSL library.");
-    return -1;
-#endif
 }
 
 PyDoc_STRVAR(PySSLContext_sni_callback_doc,
@@ -4736,9 +4585,9 @@
             continue;
         }
         if (binary_form) {
-            ci = _certificate_to_der(cert);
+            ci = _certificate_to_der(get_state_ctx(self), cert);
         } else {
-            ci = _decode_certificate(cert);
+            ci = _decode_certificate(get_state_ctx(self), cert);
         }
         if (ci == NULL) {
             goto error;
@@ -4762,21 +4611,17 @@
                        (setter) set_check_hostname, NULL},
     {"_host_flags", (getter) get_host_flags,
                     (setter) set_host_flags, NULL},
-#if SSL_CTRL_GET_MAX_PROTO_VERSION
     {"minimum_version", (getter) get_minimum_version,
                         (setter) set_minimum_version, NULL},
     {"maximum_version", (getter) get_maximum_version,
                         (setter) set_maximum_version, NULL},
-#endif
-#ifdef HAVE_OPENSSL_KEYLOG
     {"keylog_filename", (getter) _PySSLContext_get_keylog_filename,
                         (setter) _PySSLContext_set_keylog_filename, NULL},
-#endif
     {"_msg_callback", (getter) _PySSLContext_get_msg_callback,
                       (setter) _PySSLContext_set_msg_callback, NULL},
     {"sni_callback", (getter) get_sni_callback,
                      (setter) set_sni_callback, PySSLContext_sni_callback_doc},
-#if (OPENSSL_VERSION_NUMBER >= 0x10101000L) && !defined(LIBRESSL_VERSION_NUMBER)
+#ifdef TLS1_3_VERSION
     {"num_tickets", (getter) get_num_tickets,
                     (setter) set_num_tickets, PySSLContext_num_tickets_doc},
 #endif
@@ -4795,6 +4640,8 @@
                      (setter) set_verify_flags, NULL},
     {"verify_mode", (getter) get_verify_mode,
                     (setter) set_verify_mode, NULL},
+    {"security_level", (getter) get_security_level,
+                       NULL, PySSLContext_security_level_doc},
     {NULL},            /* sentinel */
 };
 
@@ -4803,7 +4650,6 @@
     _SSL__SSLCONTEXT__WRAP_BIO_METHODDEF
     _SSL__SSLCONTEXT_SET_CIPHERS_METHODDEF
     _SSL__SSLCONTEXT__SET_ALPN_PROTOCOLS_METHODDEF
-    _SSL__SSLCONTEXT__SET_NPN_PROTOCOLS_METHODDEF
     _SSL__SSLCONTEXT_LOAD_CERT_CHAIN_METHODDEF
     _SSL__SSLCONTEXT_LOAD_DH_PARAMS_METHODDEF
     _SSL__SSLCONTEXT_LOAD_VERIFY_LOCATIONS_METHODDEF
@@ -4816,45 +4662,22 @@
     {NULL, NULL}        /* sentinel */
 };
 
-static PyTypeObject PySSLContext_Type = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "_ssl._SSLContext",                        /*tp_name*/
-    sizeof(PySSLContext),                      /*tp_basicsize*/
-    0,                                         /*tp_itemsize*/
-    (destructor)context_dealloc,               /*tp_dealloc*/
-    0,                                         /*tp_vectorcall_offset*/
-    0,                                         /*tp_getattr*/
-    0,                                         /*tp_setattr*/
-    0,                                         /*tp_as_async*/
-    0,                                         /*tp_repr*/
-    0,                                         /*tp_as_number*/
-    0,                                         /*tp_as_sequence*/
-    0,                                         /*tp_as_mapping*/
-    0,                                         /*tp_hash*/
-    0,                                         /*tp_call*/
-    0,                                         /*tp_str*/
-    0,                                         /*tp_getattro*/
-    0,                                         /*tp_setattro*/
-    0,                                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
-    0,                                         /*tp_doc*/
-    (traverseproc) context_traverse,           /*tp_traverse*/
-    (inquiry) context_clear,                   /*tp_clear*/
-    0,                                         /*tp_richcompare*/
-    0,                                         /*tp_weaklistoffset*/
-    0,                                         /*tp_iter*/
-    0,                                         /*tp_iternext*/
-    context_methods,                           /*tp_methods*/
-    0,                                         /*tp_members*/
-    context_getsetlist,                        /*tp_getset*/
-    0,                                         /*tp_base*/
-    0,                                         /*tp_dict*/
-    0,                                         /*tp_descr_get*/
-    0,                                         /*tp_descr_set*/
-    0,                                         /*tp_dictoffset*/
-    0,                                         /*tp_init*/
-    0,                                         /*tp_alloc*/
-    _ssl__SSLContext,                          /*tp_new*/
+static PyType_Slot PySSLContext_slots[] = {
+    {Py_tp_methods, context_methods},
+    {Py_tp_getset, context_getsetlist},
+    {Py_tp_new, _ssl__SSLContext},
+    {Py_tp_dealloc, context_dealloc},
+    {Py_tp_traverse, context_traverse},
+    {Py_tp_clear, context_clear},
+    {0, 0},
+};
+
+static PyType_Spec PySSLContext_spec = {
+    .name = "_ssl._SSLContext",
+    .basicsize = sizeof(PySSLContext),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC |
+              Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = PySSLContext_slots,
 };
 
 
@@ -4877,8 +4700,7 @@
 
     bio = BIO_new(BIO_s_mem());
     if (bio == NULL) {
-        PyErr_SetString(PySSLErrorObject,
-                        "failed to allocate BIO");
+        PyErr_SetString(PyExc_MemoryError, "failed to allocate BIO");
         return NULL;
     }
     /* Since our BIO is non-blocking an empty read() does not indicate EOF,
@@ -4899,11 +4721,21 @@
     return (PyObject *) self;
 }
 
+static int
+memory_bio_traverse(PySSLMemoryBIO *self, visitproc visit, void *arg)
+{
+    Py_VISIT(Py_TYPE(self));
+    return 0;
+}
+
 static void
 memory_bio_dealloc(PySSLMemoryBIO *self)
 {
+    PyTypeObject *tp = Py_TYPE(self);
+    PyObject_GC_UnTrack(self);
     BIO_free(self->bio);
     Py_TYPE(self)->tp_free(self);
+    Py_DECREF(tp);
 }
 
 static PyObject *
@@ -4955,8 +4787,9 @@
 
     nbytes = BIO_read(self->bio, PyBytes_AS_STRING(result), len);
     if (nbytes < 0) {
+        _sslmodulestate *state = get_state_mbio(self);
         Py_DECREF(result);
-        _setSSLError(NULL, 0, __FILE__, __LINE__);
+        _setSSLError(state, NULL, 0, __FILE__, __LINE__);
         return NULL;
     }
 
@@ -4991,14 +4824,18 @@
     }
 
     if (self->eof_written) {
-        PyErr_SetString(PySSLErrorObject,
+        PyObject *module = PyType_GetModule(Py_TYPE(self));
+        if (module == NULL)
+            return NULL;
+        PyErr_SetString(get_ssl_state(module)->PySSLErrorObject,
                         "cannot write() after write_eof()");
         return NULL;
     }
 
     nbytes = BIO_write(self->bio, b->buf, (int)b->len);
     if (nbytes < 0) {
-        _setSSLError(NULL, 0, __FILE__, __LINE__);
+        _sslmodulestate *state = get_state_mbio(self);
+        _setSSLError(state, NULL, 0, __FILE__, __LINE__);
         return NULL;
     }
 
@@ -5041,47 +4878,22 @@
     {NULL, NULL}        /* sentinel */
 };
 
-static PyTypeObject PySSLMemoryBIO_Type = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "_ssl.MemoryBIO",                         /*tp_name*/
-    sizeof(PySSLMemoryBIO),                    /*tp_basicsize*/
-    0,                                         /*tp_itemsize*/
-    (destructor)memory_bio_dealloc,            /*tp_dealloc*/
-    0,                                         /*tp_vectorcall_offset*/
-    0,                                         /*tp_getattr*/
-    0,                                         /*tp_setattr*/
-    0,                                         /*tp_as_async*/
-    0,                                         /*tp_repr*/
-    0,                                         /*tp_as_number*/
-    0,                                         /*tp_as_sequence*/
-    0,                                         /*tp_as_mapping*/
-    0,                                         /*tp_hash*/
-    0,                                         /*tp_call*/
-    0,                                         /*tp_str*/
-    0,                                         /*tp_getattro*/
-    0,                                         /*tp_setattro*/
-    0,                                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT,                        /*tp_flags*/
-    0,                                         /*tp_doc*/
-    0,                                         /*tp_traverse*/
-    0,                                         /*tp_clear*/
-    0,                                         /*tp_richcompare*/
-    0,                                         /*tp_weaklistoffset*/
-    0,                                         /*tp_iter*/
-    0,                                         /*tp_iternext*/
-    memory_bio_methods,                        /*tp_methods*/
-    0,                                         /*tp_members*/
-    memory_bio_getsetlist,                     /*tp_getset*/
-    0,                                         /*tp_base*/
-    0,                                         /*tp_dict*/
-    0,                                         /*tp_descr_get*/
-    0,                                         /*tp_descr_set*/
-    0,                                         /*tp_dictoffset*/
-    0,                                         /*tp_init*/
-    0,                                         /*tp_alloc*/
-    _ssl_MemoryBIO,                            /*tp_new*/
+static PyType_Slot PySSLMemoryBIO_slots[] = {
+    {Py_tp_methods, memory_bio_methods},
+    {Py_tp_getset, memory_bio_getsetlist},
+    {Py_tp_new, _ssl_MemoryBIO},
+    {Py_tp_dealloc, memory_bio_dealloc},
+    {Py_tp_traverse, memory_bio_traverse},
+    {0, 0},
 };
 
+static PyType_Spec PySSLMemoryBIO_spec = {
+    .name = "_ssl.MemoryBIO",
+    .basicsize = sizeof(PySSLMemoryBIO),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE |
+              Py_TPFLAGS_HAVE_GC),
+    .slots = PySSLMemoryBIO_slots,
+};
 
 /*
  * SSL Session object
@@ -5090,6 +4902,7 @@
 static void
 PySSLSession_dealloc(PySSLSession *self)
 {
+    PyTypeObject *tp = Py_TYPE(self);
     /* bpo-31095: UnTrack is needed before calling any callbacks */
     PyObject_GC_UnTrack(self);
     Py_XDECREF(self->ctx);
@@ -5097,19 +4910,21 @@
         SSL_SESSION_free(self->session);
     }
     PyObject_GC_Del(self);
+    Py_DECREF(tp);
 }
 
 static PyObject *
 PySSLSession_richcompare(PyObject *left, PyObject *right, int op)
 {
     int result;
+    PyTypeObject *sesstype = ((PySSLSession*)left)->ctx->state->PySSLSession_Type;
 
     if (left == NULL || right == NULL) {
         PyErr_BadInternalCall();
         return NULL;
     }
 
-    if (!PySSLSession_Check(left) || !PySSLSession_Check(right)) {
+    if (!Py_IS_TYPE(left, sesstype) || !Py_IS_TYPE(right, sesstype)) {
         Py_RETURN_NOTIMPLEMENTED;
     }
 
@@ -5160,6 +4975,7 @@
 PySSLSession_traverse(PySSLSession *self, visitproc visit, void *arg)
 {
     Py_VISIT(self->ctx);
+    Py_VISIT(Py_TYPE(self));
     return 0;
 }
 
@@ -5238,37 +5054,21 @@
     {NULL},            /* sentinel */
 };
 
-static PyTypeObject PySSLSession_Type = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "_ssl.Session",                            /*tp_name*/
-    sizeof(PySSLSession),                      /*tp_basicsize*/
-    0,                                         /*tp_itemsize*/
-    (destructor)PySSLSession_dealloc,          /*tp_dealloc*/
-    0,                                         /*tp_vectorcall_offset*/
-    0,                                         /*tp_getattr*/
-    0,                                         /*tp_setattr*/
-    0,                                         /*tp_as_async*/
-    0,                                         /*tp_repr*/
-    0,                                         /*tp_as_number*/
-    0,                                         /*tp_as_sequence*/
-    0,                                         /*tp_as_mapping*/
-    0,                                         /*tp_hash*/
-    0,                                         /*tp_call*/
-    0,                                         /*tp_str*/
-    0,                                         /*tp_getattro*/
-    0,                                         /*tp_setattro*/
-    0,                                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,   /*tp_flags*/
-    0,                                         /*tp_doc*/
-    (traverseproc)PySSLSession_traverse,       /*tp_traverse*/
-    (inquiry)PySSLSession_clear,               /*tp_clear*/
-    PySSLSession_richcompare,                  /*tp_richcompare*/
-    0,                                         /*tp_weaklistoffset*/
-    0,                                         /*tp_iter*/
-    0,                                         /*tp_iternext*/
-    0,                                         /*tp_methods*/
-    0,                                         /*tp_members*/
-    PySSLSession_getsetlist,                   /*tp_getset*/
+static PyType_Slot PySSLSession_slots[] = {
+    {Py_tp_getset,PySSLSession_getsetlist},
+    {Py_tp_richcompare, PySSLSession_richcompare},
+    {Py_tp_dealloc, PySSLSession_dealloc},
+    {Py_tp_traverse, PySSLSession_traverse},
+    {Py_tp_clear, PySSLSession_clear},
+    {0, 0},
+};
+
+static PyType_Spec PySSLSession_spec = {
+    .name = "_ssl.SSLSession",
+    .basicsize = sizeof(PySSLSession),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
+              Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = PySSLSession_slots,
 };
 
 
@@ -5304,7 +5104,7 @@
 }
 
 static PyObject *
-PySSL_RAND(int len, int pseudo)
+PySSL_RAND(PyObject *module, int len, int pseudo)
 {
     int ok;
     PyObject *bytes;
@@ -5321,11 +5121,7 @@
     if (bytes == NULL)
         return NULL;
     if (pseudo) {
-#ifdef PY_OPENSSL_1_1_API
         ok = RAND_bytes((unsigned char*)PyBytes_AS_STRING(bytes), len);
-#else
-        ok = RAND_pseudo_bytes((unsigned char*)PyBytes_AS_STRING(bytes), len);
-#endif
         if (ok == 0 || ok == 1)
             return Py_BuildValue("NO", bytes, ok == 1 ? Py_True : Py_False);
     }
@@ -5340,7 +5136,7 @@
     errstr = ERR_reason_error_string(err);
     v = Py_BuildValue("(ks)", err, errstr);
     if (v != NULL) {
-        PyErr_SetObject(PySSLErrorObject, v);
+        PyErr_SetObject(get_ssl_state(module)->PySSLErrorObject, v);
         Py_DECREF(v);
     }
     return NULL;
@@ -5358,7 +5154,7 @@
 _ssl_RAND_bytes_impl(PyObject *module, int n)
 /*[clinic end generated code: output=977da635e4838bc7 input=678ddf2872dfebfc]*/
 {
-    return PySSL_RAND(n, 0);
+    return PySSL_RAND(module, n, 0);
 }
 
 /*[clinic input]
@@ -5376,13 +5172,14 @@
 _ssl_RAND_pseudo_bytes_impl(PyObject *module, int n)
 /*[clinic end generated code: output=b1509e937000e52d input=58312bd53f9bbdd0]*/
 {
-    return PySSL_RAND(n, 1);
+    PY_SSL_DEPRECATED("ssl.RAND_pseudo_bytes() is deprecated", 1, NULL);
+    return PySSL_RAND(module, n, 1);
 }
 
 /*[clinic input]
 _ssl.RAND_status
 
-Returns 1 if the OpenSSL PRNG has been seeded with enough data and 0 if not.
+Returns True if the OpenSSL PRNG has been seeded with enough data and False if not.
 
 It is necessary to seed the PRNG with RAND_add() on some platforms before
 using the ssl() function.
@@ -5390,43 +5187,11 @@
 
 static PyObject *
 _ssl_RAND_status_impl(PyObject *module)
-/*[clinic end generated code: output=7e0aaa2d39fdc1ad input=8a774b02d1dc81f3]*/
+/*[clinic end generated code: output=7e0aaa2d39fdc1ad input=d5ae5aea52f36e01]*/
 {
-    return PyLong_FromLong(RAND_status());
+    return PyBool_FromLong(RAND_status());
 }
 
-#ifndef OPENSSL_NO_EGD
-/* LCOV_EXCL_START */
-/*[clinic input]
-_ssl.RAND_egd
-    path: object(converter="PyUnicode_FSConverter")
-    /
-
-Queries the entropy gather daemon (EGD) on the socket named by 'path'.
-
-Returns number of bytes read.  Raises SSLError if connection to EGD
-fails or if it does not provide enough data to seed PRNG.
-[clinic start generated code]*/
-
-static PyObject *
-_ssl_RAND_egd_impl(PyObject *module, PyObject *path)
-/*[clinic end generated code: output=02a67c7c367f52fa input=1aeb7eb948312195]*/
-{
-    int bytes = RAND_egd(PyBytes_AsString(path));
-    Py_DECREF(path);
-    if (bytes == -1) {
-        PyErr_SetString(PySSLErrorObject,
-                        "EGD connection failed or EGD did not return "
-                        "enough data to seed the PRNG");
-        return NULL;
-    }
-    return PyLong_FromLong(bytes);
-}
-/* LCOV_EXCL_STOP */
-#endif /* OPENSSL_NO_EGD */
-
-
-
 /*[clinic input]
 _ssl.get_default_verify_paths
 
@@ -5470,7 +5235,7 @@
 }
 
 static PyObject*
-asn1obj2py(ASN1_OBJECT *obj)
+asn1obj2py(_sslmodulestate *state, ASN1_OBJECT *obj)
 {
     int nid;
     const char *ln, *sn;
@@ -5482,7 +5247,7 @@
     }
     sn = OBJ_nid2sn(nid);
     ln = OBJ_nid2ln(nid);
-    return Py_BuildValue("issN", nid, sn, ln, _asn1obj2py(obj, 1));
+    return Py_BuildValue("issN", nid, sn, ln, _asn1obj2py(state, obj, 1));
 }
 
 /*[clinic input]
@@ -5508,7 +5273,7 @@
         PyErr_Format(PyExc_ValueError, "unknown object '%.100s'", txt);
         return NULL;
     }
-    result = asn1obj2py(obj);
+    result = asn1obj2py(get_ssl_state(module), obj);
     ASN1_OBJECT_free(obj);
     return result;
 }
@@ -5537,7 +5302,7 @@
         PyErr_Format(PyExc_ValueError, "unknown NID %i", nid);
         return NULL;
     }
-    result = asn1obj2py(obj);
+    result = asn1obj2py(get_ssl_state(module), obj);
     ASN1_OBJECT_free(obj);
     return result;
 }
@@ -5869,7 +5634,6 @@
     _SSL_RAND_ADD_METHODDEF
     _SSL_RAND_BYTES_METHODDEF
     _SSL_RAND_PSEUDO_BYTES_METHODDEF
-    _SSL_RAND_EGD_METHODDEF
     _SSL_RAND_STATUS_METHODDEF
     _SSL_GET_DEFAULT_VERIFY_PATHS_METHODDEF
     _SSL_ENUM_CERTIFICATES_METHODDEF
@@ -5880,233 +5644,104 @@
 };
 
 
-#ifdef HAVE_OPENSSL_CRYPTO_LOCK
-
-/* an implementation of OpenSSL threading operations in terms
- * of the Python C thread library
- * Only used up to 1.0.2. OpenSSL 1.1.0+ has its own locking code.
- */
-
-static PyThread_type_lock *_ssl_locks = NULL;
-
-#if OPENSSL_VERSION_NUMBER >= 0x10000000
-/* use new CRYPTO_THREADID API. */
-static void
-_ssl_threadid_callback(CRYPTO_THREADID *id)
-{
-    CRYPTO_THREADID_set_numeric(id, PyThread_get_thread_ident());
-}
-#else
-/* deprecated CRYPTO_set_id_callback() API. */
-static unsigned long
-_ssl_thread_id_function (void) {
-    return PyThread_get_thread_ident();
-}
-#endif
-
-static void _ssl_thread_locking_function
-    (int mode, int n, const char *file, int line) {
-    /* this function is needed to perform locking on shared data
-       structures. (Note that OpenSSL uses a number of global data
-       structures that will be implicitly shared whenever multiple
-       threads use OpenSSL.) Multi-threaded applications will
-       crash at random if it is not set.
-
-       locking_function() must be able to handle up to
-       CRYPTO_num_locks() different mutex locks. It sets the n-th
-       lock if mode & CRYPTO_LOCK, and releases it otherwise.
-
-       file and line are the file number of the function setting the
-       lock. They can be useful for debugging.
-    */
-
-    if ((_ssl_locks == NULL) ||
-        (n < 0) || ((unsigned)n >= _ssl_locks_count))
-        return;
-
-    if (mode & CRYPTO_LOCK) {
-        PyThread_acquire_lock(_ssl_locks[n], 1);
-    } else {
-        PyThread_release_lock(_ssl_locks[n]);
-    }
-}
-
-static int _setup_ssl_threads(void) {
-
-    unsigned int i;
-
-    if (_ssl_locks == NULL) {
-        _ssl_locks_count = CRYPTO_num_locks();
-        _ssl_locks = PyMem_Calloc(_ssl_locks_count,
-                                  sizeof(PyThread_type_lock));
-        if (_ssl_locks == NULL) {
-            PyErr_NoMemory();
-            return 0;
-        }
-        for (i = 0;  i < _ssl_locks_count;  i++) {
-            _ssl_locks[i] = PyThread_allocate_lock();
-            if (_ssl_locks[i] == NULL) {
-                unsigned int j;
-                for (j = 0;  j < i;  j++) {
-                    PyThread_free_lock(_ssl_locks[j]);
-                }
-                PyMem_Free(_ssl_locks);
-                return 0;
-            }
-        }
-        CRYPTO_set_locking_callback(_ssl_thread_locking_function);
-#if OPENSSL_VERSION_NUMBER >= 0x10000000
-        CRYPTO_THREADID_set_callback(_ssl_threadid_callback);
-#else
-        CRYPTO_set_id_callback(_ssl_thread_id_function);
-#endif
-    }
-    return 1;
-}
-
-#endif  /* HAVE_OPENSSL_CRYPTO_LOCK for OpenSSL < 1.1.0 */
-
 PyDoc_STRVAR(module_doc,
 "Implementation module for SSL socket operations.  See the socket module\n\
 for documentation.");
 
-
-static struct PyModuleDef _sslmodule = {
-    PyModuleDef_HEAD_INIT,
-    "_ssl",
-    module_doc,
-    -1,
-    PySSL_methods,
-    NULL,
-    NULL,
-    NULL,
-    NULL
-};
-
-
-static void
-parse_openssl_version(unsigned long libver,
-                      unsigned int *major, unsigned int *minor,
-                      unsigned int *fix, unsigned int *patch,
-                      unsigned int *status)
+static int
+sslmodule_init_exceptions(PyObject *module)
 {
-    *status = libver & 0xF;
-    libver >>= 4;
-    *patch = libver & 0xFF;
-    libver >>= 8;
-    *fix = libver & 0xFF;
-    libver >>= 8;
-    *minor = libver & 0xFF;
-    libver >>= 8;
-    *major = libver & 0xFF;
-}
+    _sslmodulestate *state = get_ssl_state(module);
+    PyObject *bases = NULL;
 
-PyMODINIT_FUNC
-PyInit__ssl(void)
-{
-    PyObject *m, *d, *r, *bases;
-    unsigned long libver;
-    unsigned int major, minor, fix, patch, status;
-    PySocketModule_APIObject *socket_api;
-    struct py_ssl_error_code *errcode;
-    struct py_ssl_library_code *libcode;
+#define add_exception(exc, name, doc, base)                                 \
+do {                                                                        \
+    (exc) = PyErr_NewExceptionWithDoc("ssl." name, (doc), (base), NULL);    \
+    if ((state) == NULL) goto error;                                        \
+    if (PyModule_AddObjectRef(module, name, exc) < 0) goto error;           \
+} while(0)
 
-    if (PyType_Ready(&PySSLContext_Type) < 0)
-        return NULL;
-    if (PyType_Ready(&PySSLSocket_Type) < 0)
-        return NULL;
-    if (PyType_Ready(&PySSLMemoryBIO_Type) < 0)
-        return NULL;
-    if (PyType_Ready(&PySSLSession_Type) < 0)
-        return NULL;
-
-
-    m = PyModule_Create(&_sslmodule);
-    if (m == NULL)
-        return NULL;
-    d = PyModule_GetDict(m);
-
-    /* Load _socket module and its C API */
-    socket_api = PySocketModule_ImportModuleAndAPI();
-    if (!socket_api)
-        return NULL;
-    PySocketModule = *socket_api;
-
-#ifndef OPENSSL_VERSION_1_1
-    /* Load all algorithms and initialize cpuid */
-    OPENSSL_add_all_algorithms_noconf();
-    /* Init OpenSSL */
-    SSL_load_error_strings();
-    SSL_library_init();
-#endif
-
-#ifdef HAVE_OPENSSL_CRYPTO_LOCK
-    /* note that this will start threading if not already started */
-    if (!_setup_ssl_threads()) {
-        return NULL;
+    state->PySSLErrorObject = PyType_FromSpecWithBases(
+        &sslerror_type_spec, PyExc_OSError);
+    if (state->PySSLErrorObject == NULL) {
+        goto error;
     }
-#elif OPENSSL_VERSION_1_1
-    /* OpenSSL 1.1.0 builtin thread support is enabled */
-    _ssl_locks_count++;
-#endif
-
-    /* Add symbols to module dict */
-    sslerror_type_slots[0].pfunc = PyExc_OSError;
-    PySSLErrorObject = PyType_FromSpec(&sslerror_type_spec);
-    if (PySSLErrorObject == NULL)
-        return NULL;
+    if (PyModule_AddObjectRef(module, "SSLError", state->PySSLErrorObject) < 0) {
+        goto error;
+    }
 
     /* ssl.CertificateError used to be a subclass of ValueError */
-    bases = Py_BuildValue("OO", PySSLErrorObject, PyExc_ValueError);
-    if (bases == NULL)
-        return NULL;
-    PySSLCertVerificationErrorObject = PyErr_NewExceptionWithDoc(
-        "ssl.SSLCertVerificationError", SSLCertVerificationError_doc,
-        bases, NULL);
-    Py_DECREF(bases);
-    PySSLZeroReturnErrorObject = PyErr_NewExceptionWithDoc(
-        "ssl.SSLZeroReturnError", SSLZeroReturnError_doc,
-        PySSLErrorObject, NULL);
-    PySSLWantReadErrorObject = PyErr_NewExceptionWithDoc(
-        "ssl.SSLWantReadError", SSLWantReadError_doc,
-        PySSLErrorObject, NULL);
-    PySSLWantWriteErrorObject = PyErr_NewExceptionWithDoc(
-        "ssl.SSLWantWriteError", SSLWantWriteError_doc,
-        PySSLErrorObject, NULL);
-    PySSLSyscallErrorObject = PyErr_NewExceptionWithDoc(
-        "ssl.SSLSyscallError", SSLSyscallError_doc,
-        PySSLErrorObject, NULL);
-    PySSLEOFErrorObject = PyErr_NewExceptionWithDoc(
-        "ssl.SSLEOFError", SSLEOFError_doc,
-        PySSLErrorObject, NULL);
-    if (PySSLCertVerificationErrorObject == NULL
-        || PySSLZeroReturnErrorObject == NULL
-        || PySSLWantReadErrorObject == NULL
-        || PySSLWantWriteErrorObject == NULL
-        || PySSLSyscallErrorObject == NULL
-        || PySSLEOFErrorObject == NULL)
-        return NULL;
-    if (PyDict_SetItemString(d, "SSLError", PySSLErrorObject) != 0
-        || PyDict_SetItemString(d, "SSLCertVerificationError",
-                                PySSLCertVerificationErrorObject) != 0
-        || PyDict_SetItemString(d, "SSLZeroReturnError", PySSLZeroReturnErrorObject) != 0
-        || PyDict_SetItemString(d, "SSLWantReadError", PySSLWantReadErrorObject) != 0
-        || PyDict_SetItemString(d, "SSLWantWriteError", PySSLWantWriteErrorObject) != 0
-        || PyDict_SetItemString(d, "SSLSyscallError", PySSLSyscallErrorObject) != 0
-        || PyDict_SetItemString(d, "SSLEOFError", PySSLEOFErrorObject) != 0)
-        return NULL;
-    if (PyDict_SetItemString(d, "_SSLContext",
-                             (PyObject *)&PySSLContext_Type) != 0)
-        return NULL;
-    if (PyDict_SetItemString(d, "_SSLSocket",
-                             (PyObject *)&PySSLSocket_Type) != 0)
-        return NULL;
-    if (PyDict_SetItemString(d, "MemoryBIO",
-                             (PyObject *)&PySSLMemoryBIO_Type) != 0)
-        return NULL;
-    if (PyDict_SetItemString(d, "SSLSession",
-                             (PyObject *)&PySSLSession_Type) != 0)
-        return NULL;
+    bases = PyTuple_Pack(2, state->PySSLErrorObject, PyExc_ValueError);
+    if (bases == NULL) {
+        goto error;
+    }
+    add_exception(
+        state->PySSLCertVerificationErrorObject,
+        "SSLCertVerificationError",
+        SSLCertVerificationError_doc,
+        bases
+    );
+    Py_CLEAR(bases);
+
+    add_exception(
+        state->PySSLZeroReturnErrorObject,
+        "SSLZeroReturnError",
+        SSLZeroReturnError_doc,
+        state->PySSLErrorObject
+    );
+
+    add_exception(
+        state->PySSLWantWriteErrorObject,
+        "SSLWantWriteError",
+        SSLWantWriteError_doc,
+        state->PySSLErrorObject
+    );
+
+    add_exception(
+        state->PySSLWantReadErrorObject,
+        "SSLWantReadError",
+        SSLWantReadError_doc,
+        state->PySSLErrorObject
+    );
+
+    add_exception(
+        state->PySSLSyscallErrorObject,
+        "SSLSyscallError",
+        SSLSyscallError_doc,
+        state->PySSLErrorObject
+    );
+
+    add_exception(
+        state->PySSLEOFErrorObject,
+        "SSLEOFError",
+        SSLEOFError_doc,
+        state->PySSLErrorObject
+    );
+#undef add_exception
+
+    return 0;
+  error:
+    Py_XDECREF(bases);
+    return -1;
+}
+
+static int
+sslmodule_init_socketapi(PyObject *module)
+{
+    _sslmodulestate *state = get_ssl_state(module);
+    PySocketModule_APIObject *sockmod = PySocketModule_ImportModuleAndAPI();
+
+    if ((sockmod == NULL) || (sockmod->Sock_Type == NULL)) {
+        return -1;
+    }
+    state->Sock_Type = sockmod->Sock_Type;
+    Py_INCREF(state->Sock_Type);
+    return 0;
+}
+
+static int
+sslmodule_init_constants(PyObject *m)
+{
 
     PyModule_AddStringConstant(m, "_DEFAULT_CIPHERS",
                                PY_SSL_DEFAULT_CIPHER_STRING);
@@ -6146,9 +5781,14 @@
                             X509_V_FLAG_CRL_CHECK|X509_V_FLAG_CRL_CHECK_ALL);
     PyModule_AddIntConstant(m, "VERIFY_X509_STRICT",
                             X509_V_FLAG_X509_STRICT);
-#ifdef X509_V_FLAG_TRUSTED_FIRST
+    PyModule_AddIntConstant(m, "VERIFY_ALLOW_PROXY_CERTS",
+                            X509_V_FLAG_ALLOW_PROXY_CERTS);
     PyModule_AddIntConstant(m, "VERIFY_X509_TRUSTED_FIRST",
                             X509_V_FLAG_TRUSTED_FIRST);
+
+#ifdef X509_V_FLAG_PARTIAL_CHAIN
+    PyModule_AddIntConstant(m, "VERIFY_X509_PARTIAL_CHAIN",
+                            X509_V_FLAG_PARTIAL_CHAIN);
 #endif
 
     /* Alert Descriptions from ssl.h */
@@ -6258,6 +5898,10 @@
     PyModule_AddIntConstant(m, "OP_NO_RENEGOTIATION",
                             SSL_OP_NO_RENEGOTIATION);
 #endif
+#ifdef SSL_OP_IGNORE_UNEXPECTED_EOF
+    PyModule_AddIntConstant(m, "OP_IGNORE_UNEXPECTED_EOF",
+                            SSL_OP_IGNORE_UNEXPECTED_EOF);
+#endif
 
 #ifdef X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT
     PyModule_AddIntConstant(m, "HOSTFLAG_ALWAYS_CHECK_SUBJECT",
@@ -6284,6 +5928,10 @@
                             X509_CHECK_FLAG_SINGLE_LABEL_SUBDOMAINS);
 #endif
 
+    /* file types */
+    PyModule_AddIntConstant(m, "ENCODING_PEM", PY_SSL_ENCODING_PEM);
+    PyModule_AddIntConstant(m, "ENCODING_DER", PY_SSL_ENCODING_DER);
+
     /* protocol versions */
     PyModule_AddIntConstant(m, "PROTO_MINIMUM_SUPPORTED",
                             PY_PROTO_MINIMUM_SUPPORTED);
@@ -6302,31 +5950,11 @@
         PyModule_AddObject((m), (key), bool_obj); \
     } while (0)
 
-#if HAVE_SNI
     addbool(m, "HAS_SNI", 1);
-#else
-    addbool(m, "HAS_SNI", 0);
-#endif
-
     addbool(m, "HAS_TLS_UNIQUE", 1);
-
-#ifndef OPENSSL_NO_ECDH
     addbool(m, "HAS_ECDH", 1);
-#else
-    addbool(m, "HAS_ECDH", 0);
-#endif
-
-#if HAVE_NPN
-    addbool(m, "HAS_NPN", 1);
-#else
     addbool(m, "HAS_NPN", 0);
-#endif
-
-#if HAVE_ALPN
     addbool(m, "HAS_ALPN", 1);
-#else
-    addbool(m, "HAS_ALPN", 0);
-#endif
 
 #if defined(SSL2_VERSION) && !defined(OPENSSL_NO_SSL2)
     addbool(m, "HAS_SSLv2", 1);
@@ -6364,49 +5992,91 @@
     addbool(m, "HAS_TLSv1_3", 0);
 #endif
 
+    return 0;
+}
+
+static int
+sslmodule_init_errorcodes(PyObject *module)
+{
+    _sslmodulestate *state = get_ssl_state(module);
+
+    struct py_ssl_error_code *errcode;
+    struct py_ssl_library_code *libcode;
+
     /* Mappings for error codes */
-    err_codes_to_names = PyDict_New();
-    err_names_to_codes = PyDict_New();
-    if (err_codes_to_names == NULL || err_names_to_codes == NULL)
-        return NULL;
+    state->err_codes_to_names = PyDict_New();
+    if (state->err_codes_to_names == NULL)
+        return -1;
+    state->err_names_to_codes = PyDict_New();
+    if (state->err_names_to_codes == NULL)
+        return -1;
+    state->lib_codes_to_names = PyDict_New();
+    if (state->lib_codes_to_names == NULL)
+        return -1;
+
     errcode = error_codes;
     while (errcode->mnemonic != NULL) {
         PyObject *mnemo, *key;
         mnemo = PyUnicode_FromString(errcode->mnemonic);
         key = Py_BuildValue("ii", errcode->library, errcode->reason);
         if (mnemo == NULL || key == NULL)
-            return NULL;
-        if (PyDict_SetItem(err_codes_to_names, key, mnemo))
-            return NULL;
-        if (PyDict_SetItem(err_names_to_codes, mnemo, key))
-            return NULL;
+            return -1;
+        if (PyDict_SetItem(state->err_codes_to_names, key, mnemo))
+            return -1;
+        if (PyDict_SetItem(state->err_names_to_codes, mnemo, key))
+            return -1;
         Py_DECREF(key);
         Py_DECREF(mnemo);
         errcode++;
     }
-    if (PyModule_AddObject(m, "err_codes_to_names", err_codes_to_names))
-        return NULL;
-    if (PyModule_AddObject(m, "err_names_to_codes", err_names_to_codes))
-        return NULL;
 
-    lib_codes_to_names = PyDict_New();
-    if (lib_codes_to_names == NULL)
-        return NULL;
     libcode = library_codes;
     while (libcode->library != NULL) {
         PyObject *mnemo, *key;
         key = PyLong_FromLong(libcode->code);
         mnemo = PyUnicode_FromString(libcode->library);
         if (key == NULL || mnemo == NULL)
-            return NULL;
-        if (PyDict_SetItem(lib_codes_to_names, key, mnemo))
-            return NULL;
+            return -1;
+        if (PyDict_SetItem(state->lib_codes_to_names, key, mnemo))
+            return -1;
         Py_DECREF(key);
         Py_DECREF(mnemo);
         libcode++;
     }
-    if (PyModule_AddObject(m, "lib_codes_to_names", lib_codes_to_names))
-        return NULL;
+
+    if (PyModule_AddObjectRef(module, "err_codes_to_names", state->err_codes_to_names))
+        return -1;
+    if (PyModule_AddObjectRef(module, "err_names_to_codes", state->err_names_to_codes))
+        return -1;
+    if (PyModule_AddObjectRef(module, "lib_codes_to_names", state->lib_codes_to_names))
+        return -1;
+
+    return 0;
+}
+
+static void
+parse_openssl_version(unsigned long libver,
+                      unsigned int *major, unsigned int *minor,
+                      unsigned int *fix, unsigned int *patch,
+                      unsigned int *status)
+{
+    *status = libver & 0xF;
+    libver >>= 4;
+    *patch = libver & 0xFF;
+    libver >>= 8;
+    *fix = libver & 0xFF;
+    libver >>= 8;
+    *minor = libver & 0xFF;
+    libver >>= 8;
+    *major = libver & 0xFF;
+}
+
+static int
+sslmodule_init_versioninfo(PyObject *m)
+{
+    PyObject *r;
+    unsigned long libver;
+    unsigned int major, minor, fix, patch, status;
 
     /* OpenSSL version */
     /* SSLeay() gives us the version of the library linked against,
@@ -6414,23 +6084,155 @@
     */
     libver = OpenSSL_version_num();
     r = PyLong_FromUnsignedLong(libver);
-    if (r == NULL)
-        return NULL;
-    if (PyModule_AddObject(m, "OPENSSL_VERSION_NUMBER", r))
-        return NULL;
+    if (r == NULL || PyModule_AddObject(m, "OPENSSL_VERSION_NUMBER", r))
+        return -1;
+
     parse_openssl_version(libver, &major, &minor, &fix, &patch, &status);
     r = Py_BuildValue("IIIII", major, minor, fix, patch, status);
     if (r == NULL || PyModule_AddObject(m, "OPENSSL_VERSION_INFO", r))
-        return NULL;
+        return -1;
+
     r = PyUnicode_FromString(OpenSSL_version(OPENSSL_VERSION));
     if (r == NULL || PyModule_AddObject(m, "OPENSSL_VERSION", r))
-        return NULL;
+        return -1;
 
     libver = OPENSSL_VERSION_NUMBER;
     parse_openssl_version(libver, &major, &minor, &fix, &patch, &status);
     r = Py_BuildValue("IIIII", major, minor, fix, patch, status);
     if (r == NULL || PyModule_AddObject(m, "_OPENSSL_API_VERSION", r))
-        return NULL;
+        return -1;
 
-    return m;
+    return 0;
+}
+
+static int
+sslmodule_init_types(PyObject *module)
+{
+    _sslmodulestate *state = get_ssl_state(module);
+
+    state->PySSLContext_Type = (PyTypeObject *)PyType_FromModuleAndSpec(
+        module, &PySSLContext_spec, NULL
+    );
+    if (state->PySSLContext_Type == NULL)
+        return -1;
+
+    state->PySSLSocket_Type = (PyTypeObject *)PyType_FromModuleAndSpec(
+        module, &PySSLSocket_spec, NULL
+    );
+    if (state->PySSLSocket_Type == NULL)
+        return -1;
+
+    state->PySSLMemoryBIO_Type = (PyTypeObject *)PyType_FromModuleAndSpec(
+        module, &PySSLMemoryBIO_spec, NULL
+    );
+    if (state->PySSLMemoryBIO_Type == NULL)
+        return -1;
+
+    state->PySSLSession_Type = (PyTypeObject *)PyType_FromModuleAndSpec(
+        module, &PySSLSession_spec, NULL
+    );
+    if (state->PySSLSession_Type == NULL)
+        return -1;
+
+    state->PySSLCertificate_Type = (PyTypeObject *)PyType_FromModuleAndSpec(
+        module, &PySSLCertificate_spec, NULL
+    );
+    if (state->PySSLCertificate_Type == NULL)
+        return -1;
+
+    if (PyModule_AddType(module, state->PySSLContext_Type))
+        return -1;
+    if (PyModule_AddType(module, state->PySSLSocket_Type))
+        return -1;
+    if (PyModule_AddType(module, state->PySSLMemoryBIO_Type))
+        return -1;
+    if (PyModule_AddType(module, state->PySSLSession_Type))
+        return -1;
+    if (PyModule_AddType(module, state->PySSLCertificate_Type))
+        return -1;
+    return 0;
+}
+
+static PyModuleDef_Slot sslmodule_slots[] = {
+    {Py_mod_exec, sslmodule_init_types},
+    {Py_mod_exec, sslmodule_init_exceptions},
+    {Py_mod_exec, sslmodule_init_socketapi},
+    {Py_mod_exec, sslmodule_init_errorcodes},
+    {Py_mod_exec, sslmodule_init_constants},
+    {Py_mod_exec, sslmodule_init_versioninfo},
+    {0, NULL}
+};
+
+static int
+sslmodule_traverse(PyObject *m, visitproc visit, void *arg)
+{
+    _sslmodulestate *state = get_ssl_state(m);
+
+    Py_VISIT(state->PySSLContext_Type);
+    Py_VISIT(state->PySSLSocket_Type);
+    Py_VISIT(state->PySSLMemoryBIO_Type);
+    Py_VISIT(state->PySSLSession_Type);
+    Py_VISIT(state->PySSLCertificate_Type);
+    Py_VISIT(state->PySSLErrorObject);
+    Py_VISIT(state->PySSLCertVerificationErrorObject);
+    Py_VISIT(state->PySSLZeroReturnErrorObject);
+    Py_VISIT(state->PySSLWantReadErrorObject);
+    Py_VISIT(state->PySSLWantWriteErrorObject);
+    Py_VISIT(state->PySSLSyscallErrorObject);
+    Py_VISIT(state->PySSLEOFErrorObject);
+    Py_VISIT(state->err_codes_to_names);
+    Py_VISIT(state->err_names_to_codes);
+    Py_VISIT(state->lib_codes_to_names);
+    Py_VISIT(state->Sock_Type);
+
+    return 0;
+}
+
+static int
+sslmodule_clear(PyObject *m)
+{
+    _sslmodulestate *state = get_ssl_state(m);
+
+    Py_CLEAR(state->PySSLContext_Type);
+    Py_CLEAR(state->PySSLSocket_Type);
+    Py_CLEAR(state->PySSLMemoryBIO_Type);
+    Py_CLEAR(state->PySSLSession_Type);
+    Py_CLEAR(state->PySSLCertificate_Type);
+    Py_CLEAR(state->PySSLErrorObject);
+    Py_CLEAR(state->PySSLCertVerificationErrorObject);
+    Py_CLEAR(state->PySSLZeroReturnErrorObject);
+    Py_CLEAR(state->PySSLWantReadErrorObject);
+    Py_CLEAR(state->PySSLWantWriteErrorObject);
+    Py_CLEAR(state->PySSLSyscallErrorObject);
+    Py_CLEAR(state->PySSLEOFErrorObject);
+    Py_CLEAR(state->err_codes_to_names);
+    Py_CLEAR(state->err_names_to_codes);
+    Py_CLEAR(state->lib_codes_to_names);
+    Py_CLEAR(state->Sock_Type);
+
+    return 0;
+}
+
+static void
+sslmodule_free(void *m)
+{
+    sslmodule_clear((PyObject *)m);
+}
+
+static struct PyModuleDef _sslmodule_def = {
+    PyModuleDef_HEAD_INIT,
+    .m_name = "_ssl",
+    .m_doc = module_doc,
+    .m_size = sizeof(_sslmodulestate),
+    .m_methods = PySSL_methods,
+    .m_slots = sslmodule_slots,
+    .m_traverse = sslmodule_traverse,
+    .m_clear = sslmodule_clear,
+    .m_free = sslmodule_free
+};
+
+PyMODINIT_FUNC
+PyInit__ssl(void)
+{
+    return PyModuleDef_Init(&_sslmodule_def);
 }
diff --git a/Modules/_ssl.h b/Modules/_ssl.h
new file mode 100644
index 0000000..5fe6504
--- /dev/null
+++ b/Modules/_ssl.h
@@ -0,0 +1,74 @@
+#ifndef Py_SSL_H
+#define Py_SSL_H
+
+/* OpenSSL header files */
+#include "openssl/evp.h"
+#include "openssl/x509.h"
+
+/*
+ * ssl module state
+ */
+typedef struct {
+    /* Types */
+    PyTypeObject *PySSLContext_Type;
+    PyTypeObject *PySSLSocket_Type;
+    PyTypeObject *PySSLMemoryBIO_Type;
+    PyTypeObject *PySSLSession_Type;
+    PyTypeObject *PySSLCertificate_Type;
+    /* SSL error object */
+    PyObject *PySSLErrorObject;
+    PyObject *PySSLCertVerificationErrorObject;
+    PyObject *PySSLZeroReturnErrorObject;
+    PyObject *PySSLWantReadErrorObject;
+    PyObject *PySSLWantWriteErrorObject;
+    PyObject *PySSLSyscallErrorObject;
+    PyObject *PySSLEOFErrorObject;
+    /* Error mappings */
+    PyObject *err_codes_to_names;
+    PyObject *err_names_to_codes;
+    PyObject *lib_codes_to_names;
+    /* socket type from module CAPI */
+    PyTypeObject *Sock_Type;
+} _sslmodulestate;
+
+static struct PyModuleDef _sslmodule_def;
+
+Py_LOCAL_INLINE(_sslmodulestate*)
+get_ssl_state(PyObject *module)
+{
+    void *state = PyModule_GetState(module);
+    assert(state != NULL);
+    return (_sslmodulestate *)state;
+}
+
+#define get_state_type(type) \
+    (get_ssl_state(_PyType_GetModuleByDef(type, &_sslmodule_def)))
+#define get_state_ctx(c) (((PySSLContext *)(c))->state)
+#define get_state_sock(s) (((PySSLSocket *)(s))->ctx->state)
+#define get_state_obj(o) ((_sslmodulestate *)PyType_GetModuleState(Py_TYPE(o)))
+#define get_state_mbio(b) get_state_obj(b)
+#define get_state_cert(c) get_state_obj(c)
+
+/* ************************************************************************
+ * certificate
+ */
+
+enum py_ssl_encoding {
+    PY_SSL_ENCODING_PEM=X509_FILETYPE_PEM,
+    PY_SSL_ENCODING_DER=X509_FILETYPE_ASN1,
+    PY_SSL_ENCODING_PEM_AUX=X509_FILETYPE_PEM + 0x100,
+};
+
+typedef struct {
+    PyObject_HEAD
+    X509 *cert;
+    Py_hash_t hash;
+} PySSLCertificate;
+
+/* ************************************************************************
+ * helpers and utils
+ */
+static PyObject *_PySSL_BytesFromBIO(_sslmodulestate *state, BIO *bio);
+static PyObject *_PySSL_UnicodeFromBIO(_sslmodulestate *state, BIO *bio, const char *error);
+
+#endif /* Py_SSL_H */
diff --git a/Modules/_ssl/cert.c b/Modules/_ssl/cert.c
new file mode 100644
index 0000000..bda66dc
--- /dev/null
+++ b/Modules/_ssl/cert.c
@@ -0,0 +1,245 @@
+#include "Python.h"
+#include "../_ssl.h"
+
+#include "openssl/err.h"
+#include "openssl/bio.h"
+#include "openssl/pem.h"
+#include "openssl/x509.h"
+
+/*[clinic input]
+module _ssl
+class _ssl.Certificate "PySSLCertificate *" "PySSLCertificate_Type"
+[clinic start generated code]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=780fc647948cfffc]*/
+
+#include "clinic/cert.c.h"
+
+static PyObject *
+newCertificate(PyTypeObject *type, X509 *cert, int upref)
+{
+    PySSLCertificate *self;
+
+    assert(type != NULL && type->tp_alloc != NULL);
+    assert(cert != NULL);
+
+    self = (PySSLCertificate *) type->tp_alloc(type, 0);
+    if (self == NULL) {
+        return NULL;
+    }
+    if (upref == 1) {
+        X509_up_ref(cert);
+    }
+    self->cert = cert;
+    self->hash = -1;
+
+    return (PyObject *) self;
+}
+
+static PyObject *
+_PySSL_CertificateFromX509(_sslmodulestate *state, X509 *cert, int upref)
+{
+    return newCertificate(state->PySSLCertificate_Type, cert, upref);
+}
+
+static PyObject*
+_PySSL_CertificateFromX509Stack(_sslmodulestate *state, STACK_OF(X509) *stack, int upref)
+{
+    int len, i;
+    PyObject *result = NULL;
+
+    len = sk_X509_num(stack);
+    result = PyList_New(len);
+    if (result == NULL) {
+        return NULL;
+    }
+    for (i = 0; i < len; i++) {
+        X509 *cert = sk_X509_value(stack, i);
+        PyObject *ocert = _PySSL_CertificateFromX509(state, cert, upref);
+        if (ocert == NULL) {
+            Py_DECREF(result);
+            return NULL;
+        }
+        PyList_SetItem(result, i, ocert);
+    }
+    return result;
+}
+
+/*[clinic input]
+_ssl.Certificate.public_bytes
+    format: int(c_default="PY_SSL_ENCODING_PEM") = Encoding.PEM
+
+[clinic start generated code]*/
+
+static PyObject *
+_ssl_Certificate_public_bytes_impl(PySSLCertificate *self, int format)
+/*[clinic end generated code: output=c01ddbb697429e12 input=4d38c45e874b0e64]*/
+{
+    BIO *bio;
+    int retcode;
+    PyObject *result;
+    _sslmodulestate *state = get_state_cert(self);
+
+    bio = BIO_new(BIO_s_mem());
+    if (bio == NULL) {
+        PyErr_SetString(state->PySSLErrorObject,
+                        "failed to allocate BIO");
+        return NULL;
+    }
+    switch(format) {
+    case PY_SSL_ENCODING_PEM:
+        retcode = PEM_write_bio_X509(bio, self->cert);
+        break;
+    case PY_SSL_ENCODING_PEM_AUX:
+        retcode = PEM_write_bio_X509_AUX(bio, self->cert);
+        break;
+    case PY_SSL_ENCODING_DER:
+        retcode = i2d_X509_bio(bio, self->cert);
+        break;
+    default:
+        PyErr_SetString(PyExc_ValueError, "Unsupported format");
+        BIO_free(bio);
+        return NULL;
+    }
+    if (retcode != 1) {
+        BIO_free(bio);
+        _setSSLError(state, NULL, 0, __FILE__, __LINE__);
+        return NULL;
+    }
+    if (format == PY_SSL_ENCODING_DER) {
+        result = _PySSL_BytesFromBIO(state, bio);
+    } else {
+        result = _PySSL_UnicodeFromBIO(state, bio, "error");
+    }
+    BIO_free(bio);
+    return result;
+}
+
+
+/*[clinic input]
+_ssl.Certificate.get_info
+
+[clinic start generated code]*/
+
+static PyObject *
+_ssl_Certificate_get_info_impl(PySSLCertificate *self)
+/*[clinic end generated code: output=0f0deaac54f4408b input=ba2c1694b39d0778]*/
+{
+    return _decode_certificate(get_state_cert(self), self->cert);
+}
+
+static PyObject*
+_x509name_print(_sslmodulestate *state, X509_NAME *name, int indent, unsigned long flags)
+{
+    PyObject *res;
+    BIO *biobuf;
+
+    biobuf = BIO_new(BIO_s_mem());
+    if (biobuf == NULL) {
+        PyErr_SetString(PyExc_MemoryError, "failed to allocate BIO");
+        return NULL;
+    }
+
+    if (X509_NAME_print_ex(biobuf, name, indent, flags) <= 0) {
+        _setSSLError(state, NULL, 0, __FILE__, __LINE__);
+        BIO_free(biobuf);
+        return NULL;
+    }
+    res = _PySSL_UnicodeFromBIO(state, biobuf, "strict");
+    BIO_free(biobuf);
+    return res;
+}
+
+/* ************************************************************************
+ * PySSLCertificate_Type
+ */
+
+static PyObject *
+certificate_repr(PySSLCertificate *self)
+{
+    PyObject *osubject, *result;
+
+    /* subject string is ASCII encoded, UTF-8 chars are quoted */
+    osubject = _x509name_print(
+        get_state_cert(self),
+        X509_get_subject_name(self->cert),
+        0,
+        XN_FLAG_RFC2253
+    );
+    if (osubject == NULL)
+        return NULL;
+    result = PyUnicode_FromFormat(
+        "<%s '%U'>",
+        Py_TYPE(self)->tp_name, osubject
+    );
+    Py_DECREF(osubject);
+    return result;
+}
+
+static Py_hash_t
+certificate_hash(PySSLCertificate *self)
+{
+    if (self->hash == (Py_hash_t)-1) {
+        unsigned long hash;
+        hash = X509_subject_name_hash(self->cert);
+        if ((Py_hash_t)hash == (Py_hash_t)-1) {
+            self->hash = -2;
+        } else {
+            self->hash = (Py_hash_t)hash;
+        }
+    }
+    return self->hash;
+}
+
+static PyObject *
+certificate_richcompare(PySSLCertificate *self, PyObject *other, int op)
+{
+    int cmp;
+    _sslmodulestate *state = get_state_cert(self);
+
+    if (Py_TYPE(other) != state->PySSLCertificate_Type) {
+        Py_RETURN_NOTIMPLEMENTED;
+    }
+    /* only support == and != */
+    if ((op != Py_EQ) && (op != Py_NE)) {
+        Py_RETURN_NOTIMPLEMENTED;
+    }
+    cmp = X509_cmp(self->cert, ((PySSLCertificate*)other)->cert);
+    if (((op == Py_EQ) && (cmp == 0)) || ((op == Py_NE) && (cmp != 0))) {
+        Py_RETURN_TRUE;
+    } else {
+        Py_RETURN_FALSE;
+    }
+}
+
+static void
+certificate_dealloc(PySSLCertificate *self)
+{
+    PyTypeObject *tp = Py_TYPE(self);
+    X509_free(self->cert);
+    Py_TYPE(self)->tp_free(self);
+    Py_DECREF(tp);
+}
+
+static PyMethodDef certificate_methods[] = {
+    /* methods */
+    _SSL_CERTIFICATE_PUBLIC_BYTES_METHODDEF
+    _SSL_CERTIFICATE_GET_INFO_METHODDEF
+    {NULL, NULL}
+};
+
+static PyType_Slot PySSLCertificate_slots[] = {
+    {Py_tp_dealloc, certificate_dealloc},
+    {Py_tp_repr, certificate_repr},
+    {Py_tp_hash, certificate_hash},
+    {Py_tp_richcompare, certificate_richcompare},
+    {Py_tp_methods, certificate_methods},
+    {0, 0},
+};
+
+static PyType_Spec PySSLCertificate_spec = {
+    "_ssl.Certificate",
+    sizeof(PySSLCertificate),
+    0,
+    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION | Py_TPFLAGS_IMMUTABLETYPE,
+    PySSLCertificate_slots,
+};
diff --git a/Modules/_ssl/clinic/cert.c.h b/Modules/_ssl/clinic/cert.c.h
new file mode 100644
index 0000000..c437712
--- /dev/null
+++ b/Modules/_ssl/clinic/cert.c.h
@@ -0,0 +1,60 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(_ssl_Certificate_public_bytes__doc__,
+"public_bytes($self, /, format=Encoding.PEM)\n"
+"--\n"
+"\n");
+
+#define _SSL_CERTIFICATE_PUBLIC_BYTES_METHODDEF    \
+    {"public_bytes", (PyCFunction)(void(*)(void))_ssl_Certificate_public_bytes, METH_FASTCALL|METH_KEYWORDS, _ssl_Certificate_public_bytes__doc__},
+
+static PyObject *
+_ssl_Certificate_public_bytes_impl(PySSLCertificate *self, int format);
+
+static PyObject *
+_ssl_Certificate_public_bytes(PySSLCertificate *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"format", NULL};
+    static _PyArg_Parser _parser = {NULL, _keywords, "public_bytes", 0};
+    PyObject *argsbuf[1];
+    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
+    int format = PY_SSL_ENCODING_PEM;
+
+    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
+    if (!args) {
+        goto exit;
+    }
+    if (!noptargs) {
+        goto skip_optional_pos;
+    }
+    format = _PyLong_AsInt(args[0]);
+    if (format == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+skip_optional_pos:
+    return_value = _ssl_Certificate_public_bytes_impl(self, format);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_ssl_Certificate_get_info__doc__,
+"get_info($self, /)\n"
+"--\n"
+"\n");
+
+#define _SSL_CERTIFICATE_GET_INFO_METHODDEF    \
+    {"get_info", (PyCFunction)_ssl_Certificate_get_info, METH_NOARGS, _ssl_Certificate_get_info__doc__},
+
+static PyObject *
+_ssl_Certificate_get_info_impl(PySSLCertificate *self);
+
+static PyObject *
+_ssl_Certificate_get_info(PySSLCertificate *self, PyObject *Py_UNUSED(ignored))
+{
+    return _ssl_Certificate_get_info_impl(self);
+}
+/*[clinic end generated code: output=569d161749ead2da input=a9049054013a1b77]*/
diff --git a/Modules/_ssl/debughelpers.c b/Modules/_ssl/debughelpers.c
index b840da2..03c125e 100644
--- a/Modules/_ssl/debughelpers.c
+++ b/Modules/_ssl/debughelpers.c
@@ -21,8 +21,9 @@
     threadstate = PyGILState_Ensure();
 
     ssl_obj = (PySSLSocket *)SSL_get_app_data(ssl);
-    assert(PySSLSocket_Check(ssl_obj));
+    assert(Py_IS_TYPE(ssl_obj, get_state_sock(ssl_obj)->PySSLSocket_Type));
     if (ssl_obj->ctx->msg_cb == NULL) {
+        PyGILState_Release(threadstate);
         return;
     }
 
@@ -113,8 +114,6 @@
     return 0;
 }
 
-#ifdef HAVE_OPENSSL_KEYLOG
-
 static void
 _PySSL_keylog_callback(const SSL *ssl, const char *line)
 {
@@ -126,7 +125,7 @@
     threadstate = PyGILState_Ensure();
 
     ssl_obj = (PySSLSocket *)SSL_get_app_data(ssl);
-    assert(PySSLSocket_Check(ssl_obj));
+    assert(Py_IS_TYPE(ssl_obj, get_state_sock(ssl_obj)->PySSLSocket_Type));
     if (ssl_obj->ctx->keylog_bio == NULL) {
         return;
     }
@@ -200,7 +199,7 @@
 
     self->keylog_bio = BIO_new_fp(fp, BIO_CLOSE | BIO_FP_TEXT);
     if (self->keylog_bio == NULL) {
-        PyErr_SetString(PySSLErrorObject,
+        PyErr_SetString(get_state_ctx(self)->PySSLErrorObject,
                         "Can't malloc memory for keylog file");
         return -1;
     }
@@ -218,5 +217,3 @@
     SSL_CTX_set_keylog_callback(self->ctx, _PySSL_keylog_callback);
     return 0;
 }
-
-#endif
diff --git a/Modules/_ssl/misc.c b/Modules/_ssl/misc.c
new file mode 100644
index 0000000..4de091d
--- /dev/null
+++ b/Modules/_ssl/misc.c
@@ -0,0 +1,34 @@
+#include "Python.h"
+#include "../_ssl.h"
+
+#include "openssl/bio.h"
+
+/* BIO_s_mem() to PyBytes
+ */
+static PyObject *
+_PySSL_BytesFromBIO(_sslmodulestate *state, BIO *bio)
+{
+    long size;
+    char *data = NULL;
+    size = BIO_get_mem_data(bio, &data);
+    if (data == NULL || size < 0) {
+        PyErr_SetString(PyExc_ValueError, "Not a memory BIO");
+        return NULL;
+    }
+    return PyBytes_FromStringAndSize(data, size);
+}
+
+/* BIO_s_mem() to PyUnicode
+ */
+static PyObject *
+_PySSL_UnicodeFromBIO(_sslmodulestate *state, BIO *bio, const char *error)
+{
+    long size;
+    char *data = NULL;
+    size = BIO_get_mem_data(bio, &data);
+    if (data == NULL || size < 0) {
+        PyErr_SetString(PyExc_ValueError, "Not a memory BIO");
+        return NULL;
+    }
+    return PyUnicode_DecodeUTF8(data, size, error);
+}
diff --git a/Modules/_ssl_data_111.h b/Modules/_ssl_data_111.h
new file mode 100644
index 0000000..85a2f7e
--- /dev/null
+++ b/Modules/_ssl_data_111.h
@@ -0,0 +1,6525 @@
+/* File generated by Tools/ssl/make_ssl_data.py *//* Generated on 2021-04-09T09:36:21.493286 */
+static struct py_ssl_library_code library_codes[] = {
+#ifdef ERR_LIB_ASN1
+    {"ASN1", ERR_LIB_ASN1},
+#endif
+#ifdef ERR_LIB_ASYNC
+    {"ASYNC", ERR_LIB_ASYNC},
+#endif
+#ifdef ERR_LIB_BIO
+    {"BIO", ERR_LIB_BIO},
+#endif
+#ifdef ERR_LIB_BN
+    {"BN", ERR_LIB_BN},
+#endif
+#ifdef ERR_LIB_BUF
+    {"BUF", ERR_LIB_BUF},
+#endif
+#ifdef ERR_LIB_CMS
+    {"CMS", ERR_LIB_CMS},
+#endif
+#ifdef ERR_LIB_COMP
+    {"COMP", ERR_LIB_COMP},
+#endif
+#ifdef ERR_LIB_CONF
+    {"CONF", ERR_LIB_CONF},
+#endif
+#ifdef ERR_LIB_CRYPTO
+    {"CRYPTO", ERR_LIB_CRYPTO},
+#endif
+#ifdef ERR_LIB_CT
+    {"CT", ERR_LIB_CT},
+#endif
+#ifdef ERR_LIB_DH
+    {"DH", ERR_LIB_DH},
+#endif
+#ifdef ERR_LIB_DSA
+    {"DSA", ERR_LIB_DSA},
+#endif
+#ifdef ERR_LIB_DSO
+    {"DSO", ERR_LIB_DSO},
+#endif
+#ifdef ERR_LIB_EC
+    {"EC", ERR_LIB_EC},
+#endif
+#ifdef ERR_LIB_ECDH
+    {"ECDH", ERR_LIB_ECDH},
+#endif
+#ifdef ERR_LIB_ECDSA
+    {"ECDSA", ERR_LIB_ECDSA},
+#endif
+#ifdef ERR_LIB_ENGINE
+    {"ENGINE", ERR_LIB_ENGINE},
+#endif
+#ifdef ERR_LIB_EVP
+    {"EVP", ERR_LIB_EVP},
+#endif
+#ifdef ERR_LIB_FIPS
+    {"FIPS", ERR_LIB_FIPS},
+#endif
+#ifdef ERR_LIB_HMAC
+    {"HMAC", ERR_LIB_HMAC},
+#endif
+#ifdef ERR_LIB_JPAKE
+    {"JPAKE", ERR_LIB_JPAKE},
+#endif
+#ifdef ERR_LIB_KDF
+    {"KDF", ERR_LIB_KDF},
+#endif
+#ifdef ERR_LIB_METH
+    {"METH", ERR_LIB_METH},
+#endif
+#ifdef ERR_LIB_NONE
+    {"NONE", ERR_LIB_NONE},
+#endif
+#ifdef ERR_LIB_OBJ
+    {"OBJ", ERR_LIB_OBJ},
+#endif
+#ifdef ERR_LIB_OCSP
+    {"OCSP", ERR_LIB_OCSP},
+#endif
+#ifdef ERR_LIB_OSSL_STORE
+    {"OSSL_STORE", ERR_LIB_OSSL_STORE},
+#endif
+#ifdef ERR_LIB_PEM
+    {"PEM", ERR_LIB_PEM},
+#endif
+#ifdef ERR_LIB_PKCS12
+    {"PKCS12", ERR_LIB_PKCS12},
+#endif
+#ifdef ERR_LIB_PKCS7
+    {"PKCS7", ERR_LIB_PKCS7},
+#endif
+#ifdef ERR_LIB_PROXY
+    {"PROXY", ERR_LIB_PROXY},
+#endif
+#ifdef ERR_LIB_RAND
+    {"RAND", ERR_LIB_RAND},
+#endif
+#ifdef ERR_LIB_RSA
+    {"RSA", ERR_LIB_RSA},
+#endif
+#ifdef ERR_LIB_RSAREF
+    {"RSAREF", ERR_LIB_RSAREF},
+#endif
+#ifdef ERR_LIB_SM2
+    {"SM2", ERR_LIB_SM2},
+#endif
+#ifdef ERR_LIB_SSL
+    {"SSL", ERR_LIB_SSL},
+#endif
+#ifdef ERR_LIB_SSL2
+    {"SSL2", ERR_LIB_SSL2},
+#endif
+#ifdef ERR_LIB_SSL23
+    {"SSL23", ERR_LIB_SSL23},
+#endif
+#ifdef ERR_LIB_SSL3
+    {"SSL3", ERR_LIB_SSL3},
+#endif
+#ifdef ERR_LIB_SYS
+    {"SYS", ERR_LIB_SYS},
+#endif
+#ifdef ERR_LIB_TS
+    {"TS", ERR_LIB_TS},
+#endif
+#ifdef ERR_LIB_UI
+    {"UI", ERR_LIB_UI},
+#endif
+#ifdef ERR_LIB_USER
+    {"USER", ERR_LIB_USER},
+#endif
+#ifdef ERR_LIB_X509
+    {"X509", ERR_LIB_X509},
+#endif
+#ifdef ERR_LIB_X509V3
+    {"X509V3", ERR_LIB_X509V3},
+#endif
+    { NULL }
+};
+
+
+static struct py_ssl_error_code error_codes[] = {
+  #ifdef ASN1_R_ADDING_OBJECT
+    {"ADDING_OBJECT", ERR_LIB_ASN1, ASN1_R_ADDING_OBJECT},
+  #else
+    {"ADDING_OBJECT", 13, 171},
+  #endif
+  #ifdef ASN1_R_ASN1_PARSE_ERROR
+    {"ASN1_PARSE_ERROR", ERR_LIB_ASN1, ASN1_R_ASN1_PARSE_ERROR},
+  #else
+    {"ASN1_PARSE_ERROR", 13, 203},
+  #endif
+  #ifdef ASN1_R_ASN1_SIG_PARSE_ERROR
+    {"ASN1_SIG_PARSE_ERROR", ERR_LIB_ASN1, ASN1_R_ASN1_SIG_PARSE_ERROR},
+  #else
+    {"ASN1_SIG_PARSE_ERROR", 13, 204},
+  #endif
+  #ifdef ASN1_R_AUX_ERROR
+    {"AUX_ERROR", ERR_LIB_ASN1, ASN1_R_AUX_ERROR},
+  #else
+    {"AUX_ERROR", 13, 100},
+  #endif
+  #ifdef ASN1_R_BAD_OBJECT_HEADER
+    {"BAD_OBJECT_HEADER", ERR_LIB_ASN1, ASN1_R_BAD_OBJECT_HEADER},
+  #else
+    {"BAD_OBJECT_HEADER", 13, 102},
+  #endif
+  #ifdef ASN1_R_BAD_TEMPLATE
+    {"BAD_TEMPLATE", ERR_LIB_ASN1, ASN1_R_BAD_TEMPLATE},
+  #else
+    {"BAD_TEMPLATE", 13, 230},
+  #endif
+  #ifdef ASN1_R_BMPSTRING_IS_WRONG_LENGTH
+    {"BMPSTRING_IS_WRONG_LENGTH", ERR_LIB_ASN1, ASN1_R_BMPSTRING_IS_WRONG_LENGTH},
+  #else
+    {"BMPSTRING_IS_WRONG_LENGTH", 13, 214},
+  #endif
+  #ifdef ASN1_R_BN_LIB
+    {"BN_LIB", ERR_LIB_ASN1, ASN1_R_BN_LIB},
+  #else
+    {"BN_LIB", 13, 105},
+  #endif
+  #ifdef ASN1_R_BOOLEAN_IS_WRONG_LENGTH
+    {"BOOLEAN_IS_WRONG_LENGTH", ERR_LIB_ASN1, ASN1_R_BOOLEAN_IS_WRONG_LENGTH},
+  #else
+    {"BOOLEAN_IS_WRONG_LENGTH", 13, 106},
+  #endif
+  #ifdef ASN1_R_BUFFER_TOO_SMALL
+    {"BUFFER_TOO_SMALL", ERR_LIB_ASN1, ASN1_R_BUFFER_TOO_SMALL},
+  #else
+    {"BUFFER_TOO_SMALL", 13, 107},
+  #endif
+  #ifdef ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER
+    {"CIPHER_HAS_NO_OBJECT_IDENTIFIER", ERR_LIB_ASN1, ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER},
+  #else
+    {"CIPHER_HAS_NO_OBJECT_IDENTIFIER", 13, 108},
+  #endif
+  #ifdef ASN1_R_CONTEXT_NOT_INITIALISED
+    {"CONTEXT_NOT_INITIALISED", ERR_LIB_ASN1, ASN1_R_CONTEXT_NOT_INITIALISED},
+  #else
+    {"CONTEXT_NOT_INITIALISED", 13, 217},
+  #endif
+  #ifdef ASN1_R_DATA_IS_WRONG
+    {"DATA_IS_WRONG", ERR_LIB_ASN1, ASN1_R_DATA_IS_WRONG},
+  #else
+    {"DATA_IS_WRONG", 13, 109},
+  #endif
+  #ifdef ASN1_R_DECODE_ERROR
+    {"DECODE_ERROR", ERR_LIB_ASN1, ASN1_R_DECODE_ERROR},
+  #else
+    {"DECODE_ERROR", 13, 110},
+  #endif
+  #ifdef ASN1_R_DEPTH_EXCEEDED
+    {"DEPTH_EXCEEDED", ERR_LIB_ASN1, ASN1_R_DEPTH_EXCEEDED},
+  #else
+    {"DEPTH_EXCEEDED", 13, 174},
+  #endif
+  #ifdef ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED
+    {"DIGEST_AND_KEY_TYPE_NOT_SUPPORTED", ERR_LIB_ASN1, ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED},
+  #else
+    {"DIGEST_AND_KEY_TYPE_NOT_SUPPORTED", 13, 198},
+  #endif
+  #ifdef ASN1_R_ENCODE_ERROR
+    {"ENCODE_ERROR", ERR_LIB_ASN1, ASN1_R_ENCODE_ERROR},
+  #else
+    {"ENCODE_ERROR", 13, 112},
+  #endif
+  #ifdef ASN1_R_ERROR_GETTING_TIME
+    {"ERROR_GETTING_TIME", ERR_LIB_ASN1, ASN1_R_ERROR_GETTING_TIME},
+  #else
+    {"ERROR_GETTING_TIME", 13, 173},
+  #endif
+  #ifdef ASN1_R_ERROR_LOADING_SECTION
+    {"ERROR_LOADING_SECTION", ERR_LIB_ASN1, ASN1_R_ERROR_LOADING_SECTION},
+  #else
+    {"ERROR_LOADING_SECTION", 13, 172},
+  #endif
+  #ifdef ASN1_R_ERROR_SETTING_CIPHER_PARAMS
+    {"ERROR_SETTING_CIPHER_PARAMS", ERR_LIB_ASN1, ASN1_R_ERROR_SETTING_CIPHER_PARAMS},
+  #else
+    {"ERROR_SETTING_CIPHER_PARAMS", 13, 114},
+  #endif
+  #ifdef ASN1_R_EXPECTING_AN_INTEGER
+    {"EXPECTING_AN_INTEGER", ERR_LIB_ASN1, ASN1_R_EXPECTING_AN_INTEGER},
+  #else
+    {"EXPECTING_AN_INTEGER", 13, 115},
+  #endif
+  #ifdef ASN1_R_EXPECTING_AN_OBJECT
+    {"EXPECTING_AN_OBJECT", ERR_LIB_ASN1, ASN1_R_EXPECTING_AN_OBJECT},
+  #else
+    {"EXPECTING_AN_OBJECT", 13, 116},
+  #endif
+  #ifdef ASN1_R_EXPLICIT_LENGTH_MISMATCH
+    {"EXPLICIT_LENGTH_MISMATCH", ERR_LIB_ASN1, ASN1_R_EXPLICIT_LENGTH_MISMATCH},
+  #else
+    {"EXPLICIT_LENGTH_MISMATCH", 13, 119},
+  #endif
+  #ifdef ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED
+    {"EXPLICIT_TAG_NOT_CONSTRUCTED", ERR_LIB_ASN1, ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED},
+  #else
+    {"EXPLICIT_TAG_NOT_CONSTRUCTED", 13, 120},
+  #endif
+  #ifdef ASN1_R_FIELD_MISSING
+    {"FIELD_MISSING", ERR_LIB_ASN1, ASN1_R_FIELD_MISSING},
+  #else
+    {"FIELD_MISSING", 13, 121},
+  #endif
+  #ifdef ASN1_R_FIRST_NUM_TOO_LARGE
+    {"FIRST_NUM_TOO_LARGE", ERR_LIB_ASN1, ASN1_R_FIRST_NUM_TOO_LARGE},
+  #else
+    {"FIRST_NUM_TOO_LARGE", 13, 122},
+  #endif
+  #ifdef ASN1_R_HEADER_TOO_LONG
+    {"HEADER_TOO_LONG", ERR_LIB_ASN1, ASN1_R_HEADER_TOO_LONG},
+  #else
+    {"HEADER_TOO_LONG", 13, 123},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_BITSTRING_FORMAT
+    {"ILLEGAL_BITSTRING_FORMAT", ERR_LIB_ASN1, ASN1_R_ILLEGAL_BITSTRING_FORMAT},
+  #else
+    {"ILLEGAL_BITSTRING_FORMAT", 13, 175},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_BOOLEAN
+    {"ILLEGAL_BOOLEAN", ERR_LIB_ASN1, ASN1_R_ILLEGAL_BOOLEAN},
+  #else
+    {"ILLEGAL_BOOLEAN", 13, 176},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_CHARACTERS
+    {"ILLEGAL_CHARACTERS", ERR_LIB_ASN1, ASN1_R_ILLEGAL_CHARACTERS},
+  #else
+    {"ILLEGAL_CHARACTERS", 13, 124},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_FORMAT
+    {"ILLEGAL_FORMAT", ERR_LIB_ASN1, ASN1_R_ILLEGAL_FORMAT},
+  #else
+    {"ILLEGAL_FORMAT", 13, 177},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_HEX
+    {"ILLEGAL_HEX", ERR_LIB_ASN1, ASN1_R_ILLEGAL_HEX},
+  #else
+    {"ILLEGAL_HEX", 13, 178},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_IMPLICIT_TAG
+    {"ILLEGAL_IMPLICIT_TAG", ERR_LIB_ASN1, ASN1_R_ILLEGAL_IMPLICIT_TAG},
+  #else
+    {"ILLEGAL_IMPLICIT_TAG", 13, 179},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_INTEGER
+    {"ILLEGAL_INTEGER", ERR_LIB_ASN1, ASN1_R_ILLEGAL_INTEGER},
+  #else
+    {"ILLEGAL_INTEGER", 13, 180},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_NEGATIVE_VALUE
+    {"ILLEGAL_NEGATIVE_VALUE", ERR_LIB_ASN1, ASN1_R_ILLEGAL_NEGATIVE_VALUE},
+  #else
+    {"ILLEGAL_NEGATIVE_VALUE", 13, 226},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_NESTED_TAGGING
+    {"ILLEGAL_NESTED_TAGGING", ERR_LIB_ASN1, ASN1_R_ILLEGAL_NESTED_TAGGING},
+  #else
+    {"ILLEGAL_NESTED_TAGGING", 13, 181},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_NULL
+    {"ILLEGAL_NULL", ERR_LIB_ASN1, ASN1_R_ILLEGAL_NULL},
+  #else
+    {"ILLEGAL_NULL", 13, 125},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_NULL_VALUE
+    {"ILLEGAL_NULL_VALUE", ERR_LIB_ASN1, ASN1_R_ILLEGAL_NULL_VALUE},
+  #else
+    {"ILLEGAL_NULL_VALUE", 13, 182},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_OBJECT
+    {"ILLEGAL_OBJECT", ERR_LIB_ASN1, ASN1_R_ILLEGAL_OBJECT},
+  #else
+    {"ILLEGAL_OBJECT", 13, 183},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_OPTIONAL_ANY
+    {"ILLEGAL_OPTIONAL_ANY", ERR_LIB_ASN1, ASN1_R_ILLEGAL_OPTIONAL_ANY},
+  #else
+    {"ILLEGAL_OPTIONAL_ANY", 13, 126},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE
+    {"ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE", ERR_LIB_ASN1, ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE},
+  #else
+    {"ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE", 13, 170},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_PADDING
+    {"ILLEGAL_PADDING", ERR_LIB_ASN1, ASN1_R_ILLEGAL_PADDING},
+  #else
+    {"ILLEGAL_PADDING", 13, 221},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_TAGGED_ANY
+    {"ILLEGAL_TAGGED_ANY", ERR_LIB_ASN1, ASN1_R_ILLEGAL_TAGGED_ANY},
+  #else
+    {"ILLEGAL_TAGGED_ANY", 13, 127},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_TIME_VALUE
+    {"ILLEGAL_TIME_VALUE", ERR_LIB_ASN1, ASN1_R_ILLEGAL_TIME_VALUE},
+  #else
+    {"ILLEGAL_TIME_VALUE", 13, 184},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_ZERO_CONTENT
+    {"ILLEGAL_ZERO_CONTENT", ERR_LIB_ASN1, ASN1_R_ILLEGAL_ZERO_CONTENT},
+  #else
+    {"ILLEGAL_ZERO_CONTENT", 13, 222},
+  #endif
+  #ifdef ASN1_R_INTEGER_NOT_ASCII_FORMAT
+    {"INTEGER_NOT_ASCII_FORMAT", ERR_LIB_ASN1, ASN1_R_INTEGER_NOT_ASCII_FORMAT},
+  #else
+    {"INTEGER_NOT_ASCII_FORMAT", 13, 185},
+  #endif
+  #ifdef ASN1_R_INTEGER_TOO_LARGE_FOR_LONG
+    {"INTEGER_TOO_LARGE_FOR_LONG", ERR_LIB_ASN1, ASN1_R_INTEGER_TOO_LARGE_FOR_LONG},
+  #else
+    {"INTEGER_TOO_LARGE_FOR_LONG", 13, 128},
+  #endif
+  #ifdef ASN1_R_INVALID_BIT_STRING_BITS_LEFT
+    {"INVALID_BIT_STRING_BITS_LEFT", ERR_LIB_ASN1, ASN1_R_INVALID_BIT_STRING_BITS_LEFT},
+  #else
+    {"INVALID_BIT_STRING_BITS_LEFT", 13, 220},
+  #endif
+  #ifdef ASN1_R_INVALID_BMPSTRING_LENGTH
+    {"INVALID_BMPSTRING_LENGTH", ERR_LIB_ASN1, ASN1_R_INVALID_BMPSTRING_LENGTH},
+  #else
+    {"INVALID_BMPSTRING_LENGTH", 13, 129},
+  #endif
+  #ifdef ASN1_R_INVALID_DIGIT
+    {"INVALID_DIGIT", ERR_LIB_ASN1, ASN1_R_INVALID_DIGIT},
+  #else
+    {"INVALID_DIGIT", 13, 130},
+  #endif
+  #ifdef ASN1_R_INVALID_MIME_TYPE
+    {"INVALID_MIME_TYPE", ERR_LIB_ASN1, ASN1_R_INVALID_MIME_TYPE},
+  #else
+    {"INVALID_MIME_TYPE", 13, 205},
+  #endif
+  #ifdef ASN1_R_INVALID_MODIFIER
+    {"INVALID_MODIFIER", ERR_LIB_ASN1, ASN1_R_INVALID_MODIFIER},
+  #else
+    {"INVALID_MODIFIER", 13, 186},
+  #endif
+  #ifdef ASN1_R_INVALID_NUMBER
+    {"INVALID_NUMBER", ERR_LIB_ASN1, ASN1_R_INVALID_NUMBER},
+  #else
+    {"INVALID_NUMBER", 13, 187},
+  #endif
+  #ifdef ASN1_R_INVALID_OBJECT_ENCODING
+    {"INVALID_OBJECT_ENCODING", ERR_LIB_ASN1, ASN1_R_INVALID_OBJECT_ENCODING},
+  #else
+    {"INVALID_OBJECT_ENCODING", 13, 216},
+  #endif
+  #ifdef ASN1_R_INVALID_SCRYPT_PARAMETERS
+    {"INVALID_SCRYPT_PARAMETERS", ERR_LIB_ASN1, ASN1_R_INVALID_SCRYPT_PARAMETERS},
+  #else
+    {"INVALID_SCRYPT_PARAMETERS", 13, 227},
+  #endif
+  #ifdef ASN1_R_INVALID_SEPARATOR
+    {"INVALID_SEPARATOR", ERR_LIB_ASN1, ASN1_R_INVALID_SEPARATOR},
+  #else
+    {"INVALID_SEPARATOR", 13, 131},
+  #endif
+  #ifdef ASN1_R_INVALID_STRING_TABLE_VALUE
+    {"INVALID_STRING_TABLE_VALUE", ERR_LIB_ASN1, ASN1_R_INVALID_STRING_TABLE_VALUE},
+  #else
+    {"INVALID_STRING_TABLE_VALUE", 13, 218},
+  #endif
+  #ifdef ASN1_R_INVALID_UNIVERSALSTRING_LENGTH
+    {"INVALID_UNIVERSALSTRING_LENGTH", ERR_LIB_ASN1, ASN1_R_INVALID_UNIVERSALSTRING_LENGTH},
+  #else
+    {"INVALID_UNIVERSALSTRING_LENGTH", 13, 133},
+  #endif
+  #ifdef ASN1_R_INVALID_UTF8STRING
+    {"INVALID_UTF8STRING", ERR_LIB_ASN1, ASN1_R_INVALID_UTF8STRING},
+  #else
+    {"INVALID_UTF8STRING", 13, 134},
+  #endif
+  #ifdef ASN1_R_INVALID_VALUE
+    {"INVALID_VALUE", ERR_LIB_ASN1, ASN1_R_INVALID_VALUE},
+  #else
+    {"INVALID_VALUE", 13, 219},
+  #endif
+  #ifdef ASN1_R_LIST_ERROR
+    {"LIST_ERROR", ERR_LIB_ASN1, ASN1_R_LIST_ERROR},
+  #else
+    {"LIST_ERROR", 13, 188},
+  #endif
+  #ifdef ASN1_R_MIME_NO_CONTENT_TYPE
+    {"MIME_NO_CONTENT_TYPE", ERR_LIB_ASN1, ASN1_R_MIME_NO_CONTENT_TYPE},
+  #else
+    {"MIME_NO_CONTENT_TYPE", 13, 206},
+  #endif
+  #ifdef ASN1_R_MIME_PARSE_ERROR
+    {"MIME_PARSE_ERROR", ERR_LIB_ASN1, ASN1_R_MIME_PARSE_ERROR},
+  #else
+    {"MIME_PARSE_ERROR", 13, 207},
+  #endif
+  #ifdef ASN1_R_MIME_SIG_PARSE_ERROR
+    {"MIME_SIG_PARSE_ERROR", ERR_LIB_ASN1, ASN1_R_MIME_SIG_PARSE_ERROR},
+  #else
+    {"MIME_SIG_PARSE_ERROR", 13, 208},
+  #endif
+  #ifdef ASN1_R_MISSING_EOC
+    {"MISSING_EOC", ERR_LIB_ASN1, ASN1_R_MISSING_EOC},
+  #else
+    {"MISSING_EOC", 13, 137},
+  #endif
+  #ifdef ASN1_R_MISSING_SECOND_NUMBER
+    {"MISSING_SECOND_NUMBER", ERR_LIB_ASN1, ASN1_R_MISSING_SECOND_NUMBER},
+  #else
+    {"MISSING_SECOND_NUMBER", 13, 138},
+  #endif
+  #ifdef ASN1_R_MISSING_VALUE
+    {"MISSING_VALUE", ERR_LIB_ASN1, ASN1_R_MISSING_VALUE},
+  #else
+    {"MISSING_VALUE", 13, 189},
+  #endif
+  #ifdef ASN1_R_MSTRING_NOT_UNIVERSAL
+    {"MSTRING_NOT_UNIVERSAL", ERR_LIB_ASN1, ASN1_R_MSTRING_NOT_UNIVERSAL},
+  #else
+    {"MSTRING_NOT_UNIVERSAL", 13, 139},
+  #endif
+  #ifdef ASN1_R_MSTRING_WRONG_TAG
+    {"MSTRING_WRONG_TAG", ERR_LIB_ASN1, ASN1_R_MSTRING_WRONG_TAG},
+  #else
+    {"MSTRING_WRONG_TAG", 13, 140},
+  #endif
+  #ifdef ASN1_R_NESTED_ASN1_STRING
+    {"NESTED_ASN1_STRING", ERR_LIB_ASN1, ASN1_R_NESTED_ASN1_STRING},
+  #else
+    {"NESTED_ASN1_STRING", 13, 197},
+  #endif
+  #ifdef ASN1_R_NESTED_TOO_DEEP
+    {"NESTED_TOO_DEEP", ERR_LIB_ASN1, ASN1_R_NESTED_TOO_DEEP},
+  #else
+    {"NESTED_TOO_DEEP", 13, 201},
+  #endif
+  #ifdef ASN1_R_NON_HEX_CHARACTERS
+    {"NON_HEX_CHARACTERS", ERR_LIB_ASN1, ASN1_R_NON_HEX_CHARACTERS},
+  #else
+    {"NON_HEX_CHARACTERS", 13, 141},
+  #endif
+  #ifdef ASN1_R_NOT_ASCII_FORMAT
+    {"NOT_ASCII_FORMAT", ERR_LIB_ASN1, ASN1_R_NOT_ASCII_FORMAT},
+  #else
+    {"NOT_ASCII_FORMAT", 13, 190},
+  #endif
+  #ifdef ASN1_R_NOT_ENOUGH_DATA
+    {"NOT_ENOUGH_DATA", ERR_LIB_ASN1, ASN1_R_NOT_ENOUGH_DATA},
+  #else
+    {"NOT_ENOUGH_DATA", 13, 142},
+  #endif
+  #ifdef ASN1_R_NO_CONTENT_TYPE
+    {"NO_CONTENT_TYPE", ERR_LIB_ASN1, ASN1_R_NO_CONTENT_TYPE},
+  #else
+    {"NO_CONTENT_TYPE", 13, 209},
+  #endif
+  #ifdef ASN1_R_NO_MATCHING_CHOICE_TYPE
+    {"NO_MATCHING_CHOICE_TYPE", ERR_LIB_ASN1, ASN1_R_NO_MATCHING_CHOICE_TYPE},
+  #else
+    {"NO_MATCHING_CHOICE_TYPE", 13, 143},
+  #endif
+  #ifdef ASN1_R_NO_MULTIPART_BODY_FAILURE
+    {"NO_MULTIPART_BODY_FAILURE", ERR_LIB_ASN1, ASN1_R_NO_MULTIPART_BODY_FAILURE},
+  #else
+    {"NO_MULTIPART_BODY_FAILURE", 13, 210},
+  #endif
+  #ifdef ASN1_R_NO_MULTIPART_BOUNDARY
+    {"NO_MULTIPART_BOUNDARY", ERR_LIB_ASN1, ASN1_R_NO_MULTIPART_BOUNDARY},
+  #else
+    {"NO_MULTIPART_BOUNDARY", 13, 211},
+  #endif
+  #ifdef ASN1_R_NO_SIG_CONTENT_TYPE
+    {"NO_SIG_CONTENT_TYPE", ERR_LIB_ASN1, ASN1_R_NO_SIG_CONTENT_TYPE},
+  #else
+    {"NO_SIG_CONTENT_TYPE", 13, 212},
+  #endif
+  #ifdef ASN1_R_NULL_IS_WRONG_LENGTH
+    {"NULL_IS_WRONG_LENGTH", ERR_LIB_ASN1, ASN1_R_NULL_IS_WRONG_LENGTH},
+  #else
+    {"NULL_IS_WRONG_LENGTH", 13, 144},
+  #endif
+  #ifdef ASN1_R_OBJECT_NOT_ASCII_FORMAT
+    {"OBJECT_NOT_ASCII_FORMAT", ERR_LIB_ASN1, ASN1_R_OBJECT_NOT_ASCII_FORMAT},
+  #else
+    {"OBJECT_NOT_ASCII_FORMAT", 13, 191},
+  #endif
+  #ifdef ASN1_R_ODD_NUMBER_OF_CHARS
+    {"ODD_NUMBER_OF_CHARS", ERR_LIB_ASN1, ASN1_R_ODD_NUMBER_OF_CHARS},
+  #else
+    {"ODD_NUMBER_OF_CHARS", 13, 145},
+  #endif
+  #ifdef ASN1_R_SECOND_NUMBER_TOO_LARGE
+    {"SECOND_NUMBER_TOO_LARGE", ERR_LIB_ASN1, ASN1_R_SECOND_NUMBER_TOO_LARGE},
+  #else
+    {"SECOND_NUMBER_TOO_LARGE", 13, 147},
+  #endif
+  #ifdef ASN1_R_SEQUENCE_LENGTH_MISMATCH
+    {"SEQUENCE_LENGTH_MISMATCH", ERR_LIB_ASN1, ASN1_R_SEQUENCE_LENGTH_MISMATCH},
+  #else
+    {"SEQUENCE_LENGTH_MISMATCH", 13, 148},
+  #endif
+  #ifdef ASN1_R_SEQUENCE_NOT_CONSTRUCTED
+    {"SEQUENCE_NOT_CONSTRUCTED", ERR_LIB_ASN1, ASN1_R_SEQUENCE_NOT_CONSTRUCTED},
+  #else
+    {"SEQUENCE_NOT_CONSTRUCTED", 13, 149},
+  #endif
+  #ifdef ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG
+    {"SEQUENCE_OR_SET_NEEDS_CONFIG", ERR_LIB_ASN1, ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG},
+  #else
+    {"SEQUENCE_OR_SET_NEEDS_CONFIG", 13, 192},
+  #endif
+  #ifdef ASN1_R_SHORT_LINE
+    {"SHORT_LINE", ERR_LIB_ASN1, ASN1_R_SHORT_LINE},
+  #else
+    {"SHORT_LINE", 13, 150},
+  #endif
+  #ifdef ASN1_R_SIG_INVALID_MIME_TYPE
+    {"SIG_INVALID_MIME_TYPE", ERR_LIB_ASN1, ASN1_R_SIG_INVALID_MIME_TYPE},
+  #else
+    {"SIG_INVALID_MIME_TYPE", 13, 213},
+  #endif
+  #ifdef ASN1_R_STREAMING_NOT_SUPPORTED
+    {"STREAMING_NOT_SUPPORTED", ERR_LIB_ASN1, ASN1_R_STREAMING_NOT_SUPPORTED},
+  #else
+    {"STREAMING_NOT_SUPPORTED", 13, 202},
+  #endif
+  #ifdef ASN1_R_STRING_TOO_LONG
+    {"STRING_TOO_LONG", ERR_LIB_ASN1, ASN1_R_STRING_TOO_LONG},
+  #else
+    {"STRING_TOO_LONG", 13, 151},
+  #endif
+  #ifdef ASN1_R_STRING_TOO_SHORT
+    {"STRING_TOO_SHORT", ERR_LIB_ASN1, ASN1_R_STRING_TOO_SHORT},
+  #else
+    {"STRING_TOO_SHORT", 13, 152},
+  #endif
+  #ifdef ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD
+    {"THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD", ERR_LIB_ASN1, ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD},
+  #else
+    {"THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD", 13, 154},
+  #endif
+  #ifdef ASN1_R_TIME_NOT_ASCII_FORMAT
+    {"TIME_NOT_ASCII_FORMAT", ERR_LIB_ASN1, ASN1_R_TIME_NOT_ASCII_FORMAT},
+  #else
+    {"TIME_NOT_ASCII_FORMAT", 13, 193},
+  #endif
+  #ifdef ASN1_R_TOO_LARGE
+    {"TOO_LARGE", ERR_LIB_ASN1, ASN1_R_TOO_LARGE},
+  #else
+    {"TOO_LARGE", 13, 223},
+  #endif
+  #ifdef ASN1_R_TOO_LONG
+    {"TOO_LONG", ERR_LIB_ASN1, ASN1_R_TOO_LONG},
+  #else
+    {"TOO_LONG", 13, 155},
+  #endif
+  #ifdef ASN1_R_TOO_SMALL
+    {"TOO_SMALL", ERR_LIB_ASN1, ASN1_R_TOO_SMALL},
+  #else
+    {"TOO_SMALL", 13, 224},
+  #endif
+  #ifdef ASN1_R_TYPE_NOT_CONSTRUCTED
+    {"TYPE_NOT_CONSTRUCTED", ERR_LIB_ASN1, ASN1_R_TYPE_NOT_CONSTRUCTED},
+  #else
+    {"TYPE_NOT_CONSTRUCTED", 13, 156},
+  #endif
+  #ifdef ASN1_R_TYPE_NOT_PRIMITIVE
+    {"TYPE_NOT_PRIMITIVE", ERR_LIB_ASN1, ASN1_R_TYPE_NOT_PRIMITIVE},
+  #else
+    {"TYPE_NOT_PRIMITIVE", 13, 195},
+  #endif
+  #ifdef ASN1_R_UNEXPECTED_EOC
+    {"UNEXPECTED_EOC", ERR_LIB_ASN1, ASN1_R_UNEXPECTED_EOC},
+  #else
+    {"UNEXPECTED_EOC", 13, 159},
+  #endif
+  #ifdef ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH
+    {"UNIVERSALSTRING_IS_WRONG_LENGTH", ERR_LIB_ASN1, ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH},
+  #else
+    {"UNIVERSALSTRING_IS_WRONG_LENGTH", 13, 215},
+  #endif
+  #ifdef ASN1_R_UNKNOWN_FORMAT
+    {"UNKNOWN_FORMAT", ERR_LIB_ASN1, ASN1_R_UNKNOWN_FORMAT},
+  #else
+    {"UNKNOWN_FORMAT", 13, 160},
+  #endif
+  #ifdef ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM
+    {"UNKNOWN_MESSAGE_DIGEST_ALGORITHM", ERR_LIB_ASN1, ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM},
+  #else
+    {"UNKNOWN_MESSAGE_DIGEST_ALGORITHM", 13, 161},
+  #endif
+  #ifdef ASN1_R_UNKNOWN_OBJECT_TYPE
+    {"UNKNOWN_OBJECT_TYPE", ERR_LIB_ASN1, ASN1_R_UNKNOWN_OBJECT_TYPE},
+  #else
+    {"UNKNOWN_OBJECT_TYPE", 13, 162},
+  #endif
+  #ifdef ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE
+    {"UNKNOWN_PUBLIC_KEY_TYPE", ERR_LIB_ASN1, ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE},
+  #else
+    {"UNKNOWN_PUBLIC_KEY_TYPE", 13, 163},
+  #endif
+  #ifdef ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM
+    {"UNKNOWN_SIGNATURE_ALGORITHM", ERR_LIB_ASN1, ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM},
+  #else
+    {"UNKNOWN_SIGNATURE_ALGORITHM", 13, 199},
+  #endif
+  #ifdef ASN1_R_UNKNOWN_TAG
+    {"UNKNOWN_TAG", ERR_LIB_ASN1, ASN1_R_UNKNOWN_TAG},
+  #else
+    {"UNKNOWN_TAG", 13, 194},
+  #endif
+  #ifdef ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE
+    {"UNSUPPORTED_ANY_DEFINED_BY_TYPE", ERR_LIB_ASN1, ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE},
+  #else
+    {"UNSUPPORTED_ANY_DEFINED_BY_TYPE", 13, 164},
+  #endif
+  #ifdef ASN1_R_UNSUPPORTED_CIPHER
+    {"UNSUPPORTED_CIPHER", ERR_LIB_ASN1, ASN1_R_UNSUPPORTED_CIPHER},
+  #else
+    {"UNSUPPORTED_CIPHER", 13, 228},
+  #endif
+  #ifdef ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE
+    {"UNSUPPORTED_PUBLIC_KEY_TYPE", ERR_LIB_ASN1, ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE},
+  #else
+    {"UNSUPPORTED_PUBLIC_KEY_TYPE", 13, 167},
+  #endif
+  #ifdef ASN1_R_UNSUPPORTED_TYPE
+    {"UNSUPPORTED_TYPE", ERR_LIB_ASN1, ASN1_R_UNSUPPORTED_TYPE},
+  #else
+    {"UNSUPPORTED_TYPE", 13, 196},
+  #endif
+  #ifdef ASN1_R_WRONG_INTEGER_TYPE
+    {"WRONG_INTEGER_TYPE", ERR_LIB_ASN1, ASN1_R_WRONG_INTEGER_TYPE},
+  #else
+    {"WRONG_INTEGER_TYPE", 13, 225},
+  #endif
+  #ifdef ASN1_R_WRONG_PUBLIC_KEY_TYPE
+    {"WRONG_PUBLIC_KEY_TYPE", ERR_LIB_ASN1, ASN1_R_WRONG_PUBLIC_KEY_TYPE},
+  #else
+    {"WRONG_PUBLIC_KEY_TYPE", 13, 200},
+  #endif
+  #ifdef ASN1_R_WRONG_TAG
+    {"WRONG_TAG", ERR_LIB_ASN1, ASN1_R_WRONG_TAG},
+  #else
+    {"WRONG_TAG", 13, 168},
+  #endif
+  #ifdef ASYNC_R_FAILED_TO_SET_POOL
+    {"FAILED_TO_SET_POOL", ERR_LIB_ASYNC, ASYNC_R_FAILED_TO_SET_POOL},
+  #else
+    {"FAILED_TO_SET_POOL", 51, 101},
+  #endif
+  #ifdef ASYNC_R_FAILED_TO_SWAP_CONTEXT
+    {"FAILED_TO_SWAP_CONTEXT", ERR_LIB_ASYNC, ASYNC_R_FAILED_TO_SWAP_CONTEXT},
+  #else
+    {"FAILED_TO_SWAP_CONTEXT", 51, 102},
+  #endif
+  #ifdef ASYNC_R_INIT_FAILED
+    {"INIT_FAILED", ERR_LIB_ASYNC, ASYNC_R_INIT_FAILED},
+  #else
+    {"INIT_FAILED", 51, 105},
+  #endif
+  #ifdef ASYNC_R_INVALID_POOL_SIZE
+    {"INVALID_POOL_SIZE", ERR_LIB_ASYNC, ASYNC_R_INVALID_POOL_SIZE},
+  #else
+    {"INVALID_POOL_SIZE", 51, 103},
+  #endif
+  #ifdef BIO_R_ACCEPT_ERROR
+    {"ACCEPT_ERROR", ERR_LIB_BIO, BIO_R_ACCEPT_ERROR},
+  #else
+    {"ACCEPT_ERROR", 32, 100},
+  #endif
+  #ifdef BIO_R_ADDRINFO_ADDR_IS_NOT_AF_INET
+    {"ADDRINFO_ADDR_IS_NOT_AF_INET", ERR_LIB_BIO, BIO_R_ADDRINFO_ADDR_IS_NOT_AF_INET},
+  #else
+    {"ADDRINFO_ADDR_IS_NOT_AF_INET", 32, 141},
+  #endif
+  #ifdef BIO_R_AMBIGUOUS_HOST_OR_SERVICE
+    {"AMBIGUOUS_HOST_OR_SERVICE", ERR_LIB_BIO, BIO_R_AMBIGUOUS_HOST_OR_SERVICE},
+  #else
+    {"AMBIGUOUS_HOST_OR_SERVICE", 32, 129},
+  #endif
+  #ifdef BIO_R_BAD_FOPEN_MODE
+    {"BAD_FOPEN_MODE", ERR_LIB_BIO, BIO_R_BAD_FOPEN_MODE},
+  #else
+    {"BAD_FOPEN_MODE", 32, 101},
+  #endif
+  #ifdef BIO_R_BROKEN_PIPE
+    {"BROKEN_PIPE", ERR_LIB_BIO, BIO_R_BROKEN_PIPE},
+  #else
+    {"BROKEN_PIPE", 32, 124},
+  #endif
+  #ifdef BIO_R_CONNECT_ERROR
+    {"CONNECT_ERROR", ERR_LIB_BIO, BIO_R_CONNECT_ERROR},
+  #else
+    {"CONNECT_ERROR", 32, 103},
+  #endif
+  #ifdef BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET
+    {"GETHOSTBYNAME_ADDR_IS_NOT_AF_INET", ERR_LIB_BIO, BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET},
+  #else
+    {"GETHOSTBYNAME_ADDR_IS_NOT_AF_INET", 32, 107},
+  #endif
+  #ifdef BIO_R_GETSOCKNAME_ERROR
+    {"GETSOCKNAME_ERROR", ERR_LIB_BIO, BIO_R_GETSOCKNAME_ERROR},
+  #else
+    {"GETSOCKNAME_ERROR", 32, 132},
+  #endif
+  #ifdef BIO_R_GETSOCKNAME_TRUNCATED_ADDRESS
+    {"GETSOCKNAME_TRUNCATED_ADDRESS", ERR_LIB_BIO, BIO_R_GETSOCKNAME_TRUNCATED_ADDRESS},
+  #else
+    {"GETSOCKNAME_TRUNCATED_ADDRESS", 32, 133},
+  #endif
+  #ifdef BIO_R_GETTING_SOCKTYPE
+    {"GETTING_SOCKTYPE", ERR_LIB_BIO, BIO_R_GETTING_SOCKTYPE},
+  #else
+    {"GETTING_SOCKTYPE", 32, 134},
+  #endif
+  #ifdef BIO_R_INVALID_ARGUMENT
+    {"INVALID_ARGUMENT", ERR_LIB_BIO, BIO_R_INVALID_ARGUMENT},
+  #else
+    {"INVALID_ARGUMENT", 32, 125},
+  #endif
+  #ifdef BIO_R_INVALID_SOCKET
+    {"INVALID_SOCKET", ERR_LIB_BIO, BIO_R_INVALID_SOCKET},
+  #else
+    {"INVALID_SOCKET", 32, 135},
+  #endif
+  #ifdef BIO_R_IN_USE
+    {"IN_USE", ERR_LIB_BIO, BIO_R_IN_USE},
+  #else
+    {"IN_USE", 32, 123},
+  #endif
+  #ifdef BIO_R_LENGTH_TOO_LONG
+    {"LENGTH_TOO_LONG", ERR_LIB_BIO, BIO_R_LENGTH_TOO_LONG},
+  #else
+    {"LENGTH_TOO_LONG", 32, 102},
+  #endif
+  #ifdef BIO_R_LISTEN_V6_ONLY
+    {"LISTEN_V6_ONLY", ERR_LIB_BIO, BIO_R_LISTEN_V6_ONLY},
+  #else
+    {"LISTEN_V6_ONLY", 32, 136},
+  #endif
+  #ifdef BIO_R_LOOKUP_RETURNED_NOTHING
+    {"LOOKUP_RETURNED_NOTHING", ERR_LIB_BIO, BIO_R_LOOKUP_RETURNED_NOTHING},
+  #else
+    {"LOOKUP_RETURNED_NOTHING", 32, 142},
+  #endif
+  #ifdef BIO_R_MALFORMED_HOST_OR_SERVICE
+    {"MALFORMED_HOST_OR_SERVICE", ERR_LIB_BIO, BIO_R_MALFORMED_HOST_OR_SERVICE},
+  #else
+    {"MALFORMED_HOST_OR_SERVICE", 32, 130},
+  #endif
+  #ifdef BIO_R_NBIO_CONNECT_ERROR
+    {"NBIO_CONNECT_ERROR", ERR_LIB_BIO, BIO_R_NBIO_CONNECT_ERROR},
+  #else
+    {"NBIO_CONNECT_ERROR", 32, 110},
+  #endif
+  #ifdef BIO_R_NO_ACCEPT_ADDR_OR_SERVICE_SPECIFIED
+    {"NO_ACCEPT_ADDR_OR_SERVICE_SPECIFIED", ERR_LIB_BIO, BIO_R_NO_ACCEPT_ADDR_OR_SERVICE_SPECIFIED},
+  #else
+    {"NO_ACCEPT_ADDR_OR_SERVICE_SPECIFIED", 32, 143},
+  #endif
+  #ifdef BIO_R_NO_HOSTNAME_OR_SERVICE_SPECIFIED
+    {"NO_HOSTNAME_OR_SERVICE_SPECIFIED", ERR_LIB_BIO, BIO_R_NO_HOSTNAME_OR_SERVICE_SPECIFIED},
+  #else
+    {"NO_HOSTNAME_OR_SERVICE_SPECIFIED", 32, 144},
+  #endif
+  #ifdef BIO_R_NO_PORT_DEFINED
+    {"NO_PORT_DEFINED", ERR_LIB_BIO, BIO_R_NO_PORT_DEFINED},
+  #else
+    {"NO_PORT_DEFINED", 32, 113},
+  #endif
+  #ifdef BIO_R_NO_SUCH_FILE
+    {"NO_SUCH_FILE", ERR_LIB_BIO, BIO_R_NO_SUCH_FILE},
+  #else
+    {"NO_SUCH_FILE", 32, 128},
+  #endif
+  #ifdef BIO_R_NULL_PARAMETER
+    {"NULL_PARAMETER", ERR_LIB_BIO, BIO_R_NULL_PARAMETER},
+  #else
+    {"NULL_PARAMETER", 32, 115},
+  #endif
+  #ifdef BIO_R_UNABLE_TO_BIND_SOCKET
+    {"UNABLE_TO_BIND_SOCKET", ERR_LIB_BIO, BIO_R_UNABLE_TO_BIND_SOCKET},
+  #else
+    {"UNABLE_TO_BIND_SOCKET", 32, 117},
+  #endif
+  #ifdef BIO_R_UNABLE_TO_CREATE_SOCKET
+    {"UNABLE_TO_CREATE_SOCKET", ERR_LIB_BIO, BIO_R_UNABLE_TO_CREATE_SOCKET},
+  #else
+    {"UNABLE_TO_CREATE_SOCKET", 32, 118},
+  #endif
+  #ifdef BIO_R_UNABLE_TO_KEEPALIVE
+    {"UNABLE_TO_KEEPALIVE", ERR_LIB_BIO, BIO_R_UNABLE_TO_KEEPALIVE},
+  #else
+    {"UNABLE_TO_KEEPALIVE", 32, 137},
+  #endif
+  #ifdef BIO_R_UNABLE_TO_LISTEN_SOCKET
+    {"UNABLE_TO_LISTEN_SOCKET", ERR_LIB_BIO, BIO_R_UNABLE_TO_LISTEN_SOCKET},
+  #else
+    {"UNABLE_TO_LISTEN_SOCKET", 32, 119},
+  #endif
+  #ifdef BIO_R_UNABLE_TO_NODELAY
+    {"UNABLE_TO_NODELAY", ERR_LIB_BIO, BIO_R_UNABLE_TO_NODELAY},
+  #else
+    {"UNABLE_TO_NODELAY", 32, 138},
+  #endif
+  #ifdef BIO_R_UNABLE_TO_REUSEADDR
+    {"UNABLE_TO_REUSEADDR", ERR_LIB_BIO, BIO_R_UNABLE_TO_REUSEADDR},
+  #else
+    {"UNABLE_TO_REUSEADDR", 32, 139},
+  #endif
+  #ifdef BIO_R_UNAVAILABLE_IP_FAMILY
+    {"UNAVAILABLE_IP_FAMILY", ERR_LIB_BIO, BIO_R_UNAVAILABLE_IP_FAMILY},
+  #else
+    {"UNAVAILABLE_IP_FAMILY", 32, 145},
+  #endif
+  #ifdef BIO_R_UNINITIALIZED
+    {"UNINITIALIZED", ERR_LIB_BIO, BIO_R_UNINITIALIZED},
+  #else
+    {"UNINITIALIZED", 32, 120},
+  #endif
+  #ifdef BIO_R_UNKNOWN_INFO_TYPE
+    {"UNKNOWN_INFO_TYPE", ERR_LIB_BIO, BIO_R_UNKNOWN_INFO_TYPE},
+  #else
+    {"UNKNOWN_INFO_TYPE", 32, 140},
+  #endif
+  #ifdef BIO_R_UNSUPPORTED_IP_FAMILY
+    {"UNSUPPORTED_IP_FAMILY", ERR_LIB_BIO, BIO_R_UNSUPPORTED_IP_FAMILY},
+  #else
+    {"UNSUPPORTED_IP_FAMILY", 32, 146},
+  #endif
+  #ifdef BIO_R_UNSUPPORTED_METHOD
+    {"UNSUPPORTED_METHOD", ERR_LIB_BIO, BIO_R_UNSUPPORTED_METHOD},
+  #else
+    {"UNSUPPORTED_METHOD", 32, 121},
+  #endif
+  #ifdef BIO_R_UNSUPPORTED_PROTOCOL_FAMILY
+    {"UNSUPPORTED_PROTOCOL_FAMILY", ERR_LIB_BIO, BIO_R_UNSUPPORTED_PROTOCOL_FAMILY},
+  #else
+    {"UNSUPPORTED_PROTOCOL_FAMILY", 32, 131},
+  #endif
+  #ifdef BIO_R_WRITE_TO_READ_ONLY_BIO
+    {"WRITE_TO_READ_ONLY_BIO", ERR_LIB_BIO, BIO_R_WRITE_TO_READ_ONLY_BIO},
+  #else
+    {"WRITE_TO_READ_ONLY_BIO", 32, 126},
+  #endif
+  #ifdef BIO_R_WSASTARTUP
+    {"WSASTARTUP", ERR_LIB_BIO, BIO_R_WSASTARTUP},
+  #else
+    {"WSASTARTUP", 32, 122},
+  #endif
+  #ifdef BN_R_ARG2_LT_ARG3
+    {"ARG2_LT_ARG3", ERR_LIB_BN, BN_R_ARG2_LT_ARG3},
+  #else
+    {"ARG2_LT_ARG3", 3, 100},
+  #endif
+  #ifdef BN_R_BAD_RECIPROCAL
+    {"BAD_RECIPROCAL", ERR_LIB_BN, BN_R_BAD_RECIPROCAL},
+  #else
+    {"BAD_RECIPROCAL", 3, 101},
+  #endif
+  #ifdef BN_R_BIGNUM_TOO_LONG
+    {"BIGNUM_TOO_LONG", ERR_LIB_BN, BN_R_BIGNUM_TOO_LONG},
+  #else
+    {"BIGNUM_TOO_LONG", 3, 114},
+  #endif
+  #ifdef BN_R_BITS_TOO_SMALL
+    {"BITS_TOO_SMALL", ERR_LIB_BN, BN_R_BITS_TOO_SMALL},
+  #else
+    {"BITS_TOO_SMALL", 3, 118},
+  #endif
+  #ifdef BN_R_CALLED_WITH_EVEN_MODULUS
+    {"CALLED_WITH_EVEN_MODULUS", ERR_LIB_BN, BN_R_CALLED_WITH_EVEN_MODULUS},
+  #else
+    {"CALLED_WITH_EVEN_MODULUS", 3, 102},
+  #endif
+  #ifdef BN_R_DIV_BY_ZERO
+    {"DIV_BY_ZERO", ERR_LIB_BN, BN_R_DIV_BY_ZERO},
+  #else
+    {"DIV_BY_ZERO", 3, 103},
+  #endif
+  #ifdef BN_R_ENCODING_ERROR
+    {"ENCODING_ERROR", ERR_LIB_BN, BN_R_ENCODING_ERROR},
+  #else
+    {"ENCODING_ERROR", 3, 104},
+  #endif
+  #ifdef BN_R_EXPAND_ON_STATIC_BIGNUM_DATA
+    {"EXPAND_ON_STATIC_BIGNUM_DATA", ERR_LIB_BN, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA},
+  #else
+    {"EXPAND_ON_STATIC_BIGNUM_DATA", 3, 105},
+  #endif
+  #ifdef BN_R_INPUT_NOT_REDUCED
+    {"INPUT_NOT_REDUCED", ERR_LIB_BN, BN_R_INPUT_NOT_REDUCED},
+  #else
+    {"INPUT_NOT_REDUCED", 3, 110},
+  #endif
+  #ifdef BN_R_INVALID_LENGTH
+    {"INVALID_LENGTH", ERR_LIB_BN, BN_R_INVALID_LENGTH},
+  #else
+    {"INVALID_LENGTH", 3, 106},
+  #endif
+  #ifdef BN_R_INVALID_RANGE
+    {"INVALID_RANGE", ERR_LIB_BN, BN_R_INVALID_RANGE},
+  #else
+    {"INVALID_RANGE", 3, 115},
+  #endif
+  #ifdef BN_R_INVALID_SHIFT
+    {"INVALID_SHIFT", ERR_LIB_BN, BN_R_INVALID_SHIFT},
+  #else
+    {"INVALID_SHIFT", 3, 119},
+  #endif
+  #ifdef BN_R_NOT_A_SQUARE
+    {"NOT_A_SQUARE", ERR_LIB_BN, BN_R_NOT_A_SQUARE},
+  #else
+    {"NOT_A_SQUARE", 3, 111},
+  #endif
+  #ifdef BN_R_NOT_INITIALIZED
+    {"NOT_INITIALIZED", ERR_LIB_BN, BN_R_NOT_INITIALIZED},
+  #else
+    {"NOT_INITIALIZED", 3, 107},
+  #endif
+  #ifdef BN_R_NO_INVERSE
+    {"NO_INVERSE", ERR_LIB_BN, BN_R_NO_INVERSE},
+  #else
+    {"NO_INVERSE", 3, 108},
+  #endif
+  #ifdef BN_R_NO_SOLUTION
+    {"NO_SOLUTION", ERR_LIB_BN, BN_R_NO_SOLUTION},
+  #else
+    {"NO_SOLUTION", 3, 116},
+  #endif
+  #ifdef BN_R_PRIVATE_KEY_TOO_LARGE
+    {"PRIVATE_KEY_TOO_LARGE", ERR_LIB_BN, BN_R_PRIVATE_KEY_TOO_LARGE},
+  #else
+    {"PRIVATE_KEY_TOO_LARGE", 3, 117},
+  #endif
+  #ifdef BN_R_P_IS_NOT_PRIME
+    {"P_IS_NOT_PRIME", ERR_LIB_BN, BN_R_P_IS_NOT_PRIME},
+  #else
+    {"P_IS_NOT_PRIME", 3, 112},
+  #endif
+  #ifdef BN_R_TOO_MANY_ITERATIONS
+    {"TOO_MANY_ITERATIONS", ERR_LIB_BN, BN_R_TOO_MANY_ITERATIONS},
+  #else
+    {"TOO_MANY_ITERATIONS", 3, 113},
+  #endif
+  #ifdef BN_R_TOO_MANY_TEMPORARY_VARIABLES
+    {"TOO_MANY_TEMPORARY_VARIABLES", ERR_LIB_BN, BN_R_TOO_MANY_TEMPORARY_VARIABLES},
+  #else
+    {"TOO_MANY_TEMPORARY_VARIABLES", 3, 109},
+  #endif
+  #ifdef CMS_R_ADD_SIGNER_ERROR
+    {"ADD_SIGNER_ERROR", ERR_LIB_CMS, CMS_R_ADD_SIGNER_ERROR},
+  #else
+    {"ADD_SIGNER_ERROR", 46, 99},
+  #endif
+  #ifdef CMS_R_ATTRIBUTE_ERROR
+    {"ATTRIBUTE_ERROR", ERR_LIB_CMS, CMS_R_ATTRIBUTE_ERROR},
+  #else
+    {"ATTRIBUTE_ERROR", 46, 161},
+  #endif
+  #ifdef CMS_R_CERTIFICATE_ALREADY_PRESENT
+    {"CERTIFICATE_ALREADY_PRESENT", ERR_LIB_CMS, CMS_R_CERTIFICATE_ALREADY_PRESENT},
+  #else
+    {"CERTIFICATE_ALREADY_PRESENT", 46, 175},
+  #endif
+  #ifdef CMS_R_CERTIFICATE_HAS_NO_KEYID
+    {"CERTIFICATE_HAS_NO_KEYID", ERR_LIB_CMS, CMS_R_CERTIFICATE_HAS_NO_KEYID},
+  #else
+    {"CERTIFICATE_HAS_NO_KEYID", 46, 160},
+  #endif
+  #ifdef CMS_R_CERTIFICATE_VERIFY_ERROR
+    {"CERTIFICATE_VERIFY_ERROR", ERR_LIB_CMS, CMS_R_CERTIFICATE_VERIFY_ERROR},
+  #else
+    {"CERTIFICATE_VERIFY_ERROR", 46, 100},
+  #endif
+  #ifdef CMS_R_CIPHER_INITIALISATION_ERROR
+    {"CIPHER_INITIALISATION_ERROR", ERR_LIB_CMS, CMS_R_CIPHER_INITIALISATION_ERROR},
+  #else
+    {"CIPHER_INITIALISATION_ERROR", 46, 101},
+  #endif
+  #ifdef CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR
+    {"CIPHER_PARAMETER_INITIALISATION_ERROR", ERR_LIB_CMS, CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR},
+  #else
+    {"CIPHER_PARAMETER_INITIALISATION_ERROR", 46, 102},
+  #endif
+  #ifdef CMS_R_CMS_DATAFINAL_ERROR
+    {"CMS_DATAFINAL_ERROR", ERR_LIB_CMS, CMS_R_CMS_DATAFINAL_ERROR},
+  #else
+    {"CMS_DATAFINAL_ERROR", 46, 103},
+  #endif
+  #ifdef CMS_R_CMS_LIB
+    {"CMS_LIB", ERR_LIB_CMS, CMS_R_CMS_LIB},
+  #else
+    {"CMS_LIB", 46, 104},
+  #endif
+  #ifdef CMS_R_CONTENTIDENTIFIER_MISMATCH
+    {"CONTENTIDENTIFIER_MISMATCH", ERR_LIB_CMS, CMS_R_CONTENTIDENTIFIER_MISMATCH},
+  #else
+    {"CONTENTIDENTIFIER_MISMATCH", 46, 170},
+  #endif
+  #ifdef CMS_R_CONTENT_NOT_FOUND
+    {"CONTENT_NOT_FOUND", ERR_LIB_CMS, CMS_R_CONTENT_NOT_FOUND},
+  #else
+    {"CONTENT_NOT_FOUND", 46, 105},
+  #endif
+  #ifdef CMS_R_CONTENT_TYPE_MISMATCH
+    {"CONTENT_TYPE_MISMATCH", ERR_LIB_CMS, CMS_R_CONTENT_TYPE_MISMATCH},
+  #else
+    {"CONTENT_TYPE_MISMATCH", 46, 171},
+  #endif
+  #ifdef CMS_R_CONTENT_TYPE_NOT_COMPRESSED_DATA
+    {"CONTENT_TYPE_NOT_COMPRESSED_DATA", ERR_LIB_CMS, CMS_R_CONTENT_TYPE_NOT_COMPRESSED_DATA},
+  #else
+    {"CONTENT_TYPE_NOT_COMPRESSED_DATA", 46, 106},
+  #endif
+  #ifdef CMS_R_CONTENT_TYPE_NOT_ENVELOPED_DATA
+    {"CONTENT_TYPE_NOT_ENVELOPED_DATA", ERR_LIB_CMS, CMS_R_CONTENT_TYPE_NOT_ENVELOPED_DATA},
+  #else
+    {"CONTENT_TYPE_NOT_ENVELOPED_DATA", 46, 107},
+  #endif
+  #ifdef CMS_R_CONTENT_TYPE_NOT_SIGNED_DATA
+    {"CONTENT_TYPE_NOT_SIGNED_DATA", ERR_LIB_CMS, CMS_R_CONTENT_TYPE_NOT_SIGNED_DATA},
+  #else
+    {"CONTENT_TYPE_NOT_SIGNED_DATA", 46, 108},
+  #endif
+  #ifdef CMS_R_CONTENT_VERIFY_ERROR
+    {"CONTENT_VERIFY_ERROR", ERR_LIB_CMS, CMS_R_CONTENT_VERIFY_ERROR},
+  #else
+    {"CONTENT_VERIFY_ERROR", 46, 109},
+  #endif
+  #ifdef CMS_R_CTRL_ERROR
+    {"CTRL_ERROR", ERR_LIB_CMS, CMS_R_CTRL_ERROR},
+  #else
+    {"CTRL_ERROR", 46, 110},
+  #endif
+  #ifdef CMS_R_CTRL_FAILURE
+    {"CTRL_FAILURE", ERR_LIB_CMS, CMS_R_CTRL_FAILURE},
+  #else
+    {"CTRL_FAILURE", 46, 111},
+  #endif
+  #ifdef CMS_R_DECRYPT_ERROR
+    {"DECRYPT_ERROR", ERR_LIB_CMS, CMS_R_DECRYPT_ERROR},
+  #else
+    {"DECRYPT_ERROR", 46, 112},
+  #endif
+  #ifdef CMS_R_ERROR_GETTING_PUBLIC_KEY
+    {"ERROR_GETTING_PUBLIC_KEY", ERR_LIB_CMS, CMS_R_ERROR_GETTING_PUBLIC_KEY},
+  #else
+    {"ERROR_GETTING_PUBLIC_KEY", 46, 113},
+  #endif
+  #ifdef CMS_R_ERROR_READING_MESSAGEDIGEST_ATTRIBUTE
+    {"ERROR_READING_MESSAGEDIGEST_ATTRIBUTE", ERR_LIB_CMS, CMS_R_ERROR_READING_MESSAGEDIGEST_ATTRIBUTE},
+  #else
+    {"ERROR_READING_MESSAGEDIGEST_ATTRIBUTE", 46, 114},
+  #endif
+  #ifdef CMS_R_ERROR_SETTING_KEY
+    {"ERROR_SETTING_KEY", ERR_LIB_CMS, CMS_R_ERROR_SETTING_KEY},
+  #else
+    {"ERROR_SETTING_KEY", 46, 115},
+  #endif
+  #ifdef CMS_R_ERROR_SETTING_RECIPIENTINFO
+    {"ERROR_SETTING_RECIPIENTINFO", ERR_LIB_CMS, CMS_R_ERROR_SETTING_RECIPIENTINFO},
+  #else
+    {"ERROR_SETTING_RECIPIENTINFO", 46, 116},
+  #endif
+  #ifdef CMS_R_INVALID_ENCRYPTED_KEY_LENGTH
+    {"INVALID_ENCRYPTED_KEY_LENGTH", ERR_LIB_CMS, CMS_R_INVALID_ENCRYPTED_KEY_LENGTH},
+  #else
+    {"INVALID_ENCRYPTED_KEY_LENGTH", 46, 117},
+  #endif
+  #ifdef CMS_R_INVALID_KEY_ENCRYPTION_PARAMETER
+    {"INVALID_KEY_ENCRYPTION_PARAMETER", ERR_LIB_CMS, CMS_R_INVALID_KEY_ENCRYPTION_PARAMETER},
+  #else
+    {"INVALID_KEY_ENCRYPTION_PARAMETER", 46, 176},
+  #endif
+  #ifdef CMS_R_INVALID_KEY_LENGTH
+    {"INVALID_KEY_LENGTH", ERR_LIB_CMS, CMS_R_INVALID_KEY_LENGTH},
+  #else
+    {"INVALID_KEY_LENGTH", 46, 118},
+  #endif
+  #ifdef CMS_R_MD_BIO_INIT_ERROR
+    {"MD_BIO_INIT_ERROR", ERR_LIB_CMS, CMS_R_MD_BIO_INIT_ERROR},
+  #else
+    {"MD_BIO_INIT_ERROR", 46, 119},
+  #endif
+  #ifdef CMS_R_MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH
+    {"MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH", ERR_LIB_CMS, CMS_R_MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH},
+  #else
+    {"MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH", 46, 120},
+  #endif
+  #ifdef CMS_R_MESSAGEDIGEST_WRONG_LENGTH
+    {"MESSAGEDIGEST_WRONG_LENGTH", ERR_LIB_CMS, CMS_R_MESSAGEDIGEST_WRONG_LENGTH},
+  #else
+    {"MESSAGEDIGEST_WRONG_LENGTH", 46, 121},
+  #endif
+  #ifdef CMS_R_MSGSIGDIGEST_ERROR
+    {"MSGSIGDIGEST_ERROR", ERR_LIB_CMS, CMS_R_MSGSIGDIGEST_ERROR},
+  #else
+    {"MSGSIGDIGEST_ERROR", 46, 172},
+  #endif
+  #ifdef CMS_R_MSGSIGDIGEST_VERIFICATION_FAILURE
+    {"MSGSIGDIGEST_VERIFICATION_FAILURE", ERR_LIB_CMS, CMS_R_MSGSIGDIGEST_VERIFICATION_FAILURE},
+  #else
+    {"MSGSIGDIGEST_VERIFICATION_FAILURE", 46, 162},
+  #endif
+  #ifdef CMS_R_MSGSIGDIGEST_WRONG_LENGTH
+    {"MSGSIGDIGEST_WRONG_LENGTH", ERR_LIB_CMS, CMS_R_MSGSIGDIGEST_WRONG_LENGTH},
+  #else
+    {"MSGSIGDIGEST_WRONG_LENGTH", 46, 163},
+  #endif
+  #ifdef CMS_R_NEED_ONE_SIGNER
+    {"NEED_ONE_SIGNER", ERR_LIB_CMS, CMS_R_NEED_ONE_SIGNER},
+  #else
+    {"NEED_ONE_SIGNER", 46, 164},
+  #endif
+  #ifdef CMS_R_NOT_A_SIGNED_RECEIPT
+    {"NOT_A_SIGNED_RECEIPT", ERR_LIB_CMS, CMS_R_NOT_A_SIGNED_RECEIPT},
+  #else
+    {"NOT_A_SIGNED_RECEIPT", 46, 165},
+  #endif
+  #ifdef CMS_R_NOT_ENCRYPTED_DATA
+    {"NOT_ENCRYPTED_DATA", ERR_LIB_CMS, CMS_R_NOT_ENCRYPTED_DATA},
+  #else
+    {"NOT_ENCRYPTED_DATA", 46, 122},
+  #endif
+  #ifdef CMS_R_NOT_KEK
+    {"NOT_KEK", ERR_LIB_CMS, CMS_R_NOT_KEK},
+  #else
+    {"NOT_KEK", 46, 123},
+  #endif
+  #ifdef CMS_R_NOT_KEY_AGREEMENT
+    {"NOT_KEY_AGREEMENT", ERR_LIB_CMS, CMS_R_NOT_KEY_AGREEMENT},
+  #else
+    {"NOT_KEY_AGREEMENT", 46, 181},
+  #endif
+  #ifdef CMS_R_NOT_KEY_TRANSPORT
+    {"NOT_KEY_TRANSPORT", ERR_LIB_CMS, CMS_R_NOT_KEY_TRANSPORT},
+  #else
+    {"NOT_KEY_TRANSPORT", 46, 124},
+  #endif
+  #ifdef CMS_R_NOT_PWRI
+    {"NOT_PWRI", ERR_LIB_CMS, CMS_R_NOT_PWRI},
+  #else
+    {"NOT_PWRI", 46, 177},
+  #endif
+  #ifdef CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE
+    {"NOT_SUPPORTED_FOR_THIS_KEY_TYPE", ERR_LIB_CMS, CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE},
+  #else
+    {"NOT_SUPPORTED_FOR_THIS_KEY_TYPE", 46, 125},
+  #endif
+  #ifdef CMS_R_NO_CIPHER
+    {"NO_CIPHER", ERR_LIB_CMS, CMS_R_NO_CIPHER},
+  #else
+    {"NO_CIPHER", 46, 126},
+  #endif
+  #ifdef CMS_R_NO_CONTENT
+    {"NO_CONTENT", ERR_LIB_CMS, CMS_R_NO_CONTENT},
+  #else
+    {"NO_CONTENT", 46, 127},
+  #endif
+  #ifdef CMS_R_NO_CONTENT_TYPE
+    {"NO_CONTENT_TYPE", ERR_LIB_CMS, CMS_R_NO_CONTENT_TYPE},
+  #else
+    {"NO_CONTENT_TYPE", 46, 173},
+  #endif
+  #ifdef CMS_R_NO_DEFAULT_DIGEST
+    {"NO_DEFAULT_DIGEST", ERR_LIB_CMS, CMS_R_NO_DEFAULT_DIGEST},
+  #else
+    {"NO_DEFAULT_DIGEST", 46, 128},
+  #endif
+  #ifdef CMS_R_NO_DIGEST_SET
+    {"NO_DIGEST_SET", ERR_LIB_CMS, CMS_R_NO_DIGEST_SET},
+  #else
+    {"NO_DIGEST_SET", 46, 129},
+  #endif
+  #ifdef CMS_R_NO_KEY
+    {"NO_KEY", ERR_LIB_CMS, CMS_R_NO_KEY},
+  #else
+    {"NO_KEY", 46, 130},
+  #endif
+  #ifdef CMS_R_NO_KEY_OR_CERT
+    {"NO_KEY_OR_CERT", ERR_LIB_CMS, CMS_R_NO_KEY_OR_CERT},
+  #else
+    {"NO_KEY_OR_CERT", 46, 174},
+  #endif
+  #ifdef CMS_R_NO_MATCHING_DIGEST
+    {"NO_MATCHING_DIGEST", ERR_LIB_CMS, CMS_R_NO_MATCHING_DIGEST},
+  #else
+    {"NO_MATCHING_DIGEST", 46, 131},
+  #endif
+  #ifdef CMS_R_NO_MATCHING_RECIPIENT
+    {"NO_MATCHING_RECIPIENT", ERR_LIB_CMS, CMS_R_NO_MATCHING_RECIPIENT},
+  #else
+    {"NO_MATCHING_RECIPIENT", 46, 132},
+  #endif
+  #ifdef CMS_R_NO_MATCHING_SIGNATURE
+    {"NO_MATCHING_SIGNATURE", ERR_LIB_CMS, CMS_R_NO_MATCHING_SIGNATURE},
+  #else
+    {"NO_MATCHING_SIGNATURE", 46, 166},
+  #endif
+  #ifdef CMS_R_NO_MSGSIGDIGEST
+    {"NO_MSGSIGDIGEST", ERR_LIB_CMS, CMS_R_NO_MSGSIGDIGEST},
+  #else
+    {"NO_MSGSIGDIGEST", 46, 167},
+  #endif
+  #ifdef CMS_R_NO_PASSWORD
+    {"NO_PASSWORD", ERR_LIB_CMS, CMS_R_NO_PASSWORD},
+  #else
+    {"NO_PASSWORD", 46, 178},
+  #endif
+  #ifdef CMS_R_NO_PRIVATE_KEY
+    {"NO_PRIVATE_KEY", ERR_LIB_CMS, CMS_R_NO_PRIVATE_KEY},
+  #else
+    {"NO_PRIVATE_KEY", 46, 133},
+  #endif
+  #ifdef CMS_R_NO_PUBLIC_KEY
+    {"NO_PUBLIC_KEY", ERR_LIB_CMS, CMS_R_NO_PUBLIC_KEY},
+  #else
+    {"NO_PUBLIC_KEY", 46, 134},
+  #endif
+  #ifdef CMS_R_NO_RECEIPT_REQUEST
+    {"NO_RECEIPT_REQUEST", ERR_LIB_CMS, CMS_R_NO_RECEIPT_REQUEST},
+  #else
+    {"NO_RECEIPT_REQUEST", 46, 168},
+  #endif
+  #ifdef CMS_R_NO_SIGNERS
+    {"NO_SIGNERS", ERR_LIB_CMS, CMS_R_NO_SIGNERS},
+  #else
+    {"NO_SIGNERS", 46, 135},
+  #endif
+  #ifdef CMS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE
+    {"PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE", ERR_LIB_CMS, CMS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE},
+  #else
+    {"PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE", 46, 136},
+  #endif
+  #ifdef CMS_R_RECEIPT_DECODE_ERROR
+    {"RECEIPT_DECODE_ERROR", ERR_LIB_CMS, CMS_R_RECEIPT_DECODE_ERROR},
+  #else
+    {"RECEIPT_DECODE_ERROR", 46, 169},
+  #endif
+  #ifdef CMS_R_RECIPIENT_ERROR
+    {"RECIPIENT_ERROR", ERR_LIB_CMS, CMS_R_RECIPIENT_ERROR},
+  #else
+    {"RECIPIENT_ERROR", 46, 137},
+  #endif
+  #ifdef CMS_R_SIGNER_CERTIFICATE_NOT_FOUND
+    {"SIGNER_CERTIFICATE_NOT_FOUND", ERR_LIB_CMS, CMS_R_SIGNER_CERTIFICATE_NOT_FOUND},
+  #else
+    {"SIGNER_CERTIFICATE_NOT_FOUND", 46, 138},
+  #endif
+  #ifdef CMS_R_SIGNFINAL_ERROR
+    {"SIGNFINAL_ERROR", ERR_LIB_CMS, CMS_R_SIGNFINAL_ERROR},
+  #else
+    {"SIGNFINAL_ERROR", 46, 139},
+  #endif
+  #ifdef CMS_R_SMIME_TEXT_ERROR
+    {"SMIME_TEXT_ERROR", ERR_LIB_CMS, CMS_R_SMIME_TEXT_ERROR},
+  #else
+    {"SMIME_TEXT_ERROR", 46, 140},
+  #endif
+  #ifdef CMS_R_STORE_INIT_ERROR
+    {"STORE_INIT_ERROR", ERR_LIB_CMS, CMS_R_STORE_INIT_ERROR},
+  #else
+    {"STORE_INIT_ERROR", 46, 141},
+  #endif
+  #ifdef CMS_R_TYPE_NOT_COMPRESSED_DATA
+    {"TYPE_NOT_COMPRESSED_DATA", ERR_LIB_CMS, CMS_R_TYPE_NOT_COMPRESSED_DATA},
+  #else
+    {"TYPE_NOT_COMPRESSED_DATA", 46, 142},
+  #endif
+  #ifdef CMS_R_TYPE_NOT_DATA
+    {"TYPE_NOT_DATA", ERR_LIB_CMS, CMS_R_TYPE_NOT_DATA},
+  #else
+    {"TYPE_NOT_DATA", 46, 143},
+  #endif
+  #ifdef CMS_R_TYPE_NOT_DIGESTED_DATA
+    {"TYPE_NOT_DIGESTED_DATA", ERR_LIB_CMS, CMS_R_TYPE_NOT_DIGESTED_DATA},
+  #else
+    {"TYPE_NOT_DIGESTED_DATA", 46, 144},
+  #endif
+  #ifdef CMS_R_TYPE_NOT_ENCRYPTED_DATA
+    {"TYPE_NOT_ENCRYPTED_DATA", ERR_LIB_CMS, CMS_R_TYPE_NOT_ENCRYPTED_DATA},
+  #else
+    {"TYPE_NOT_ENCRYPTED_DATA", 46, 145},
+  #endif
+  #ifdef CMS_R_TYPE_NOT_ENVELOPED_DATA
+    {"TYPE_NOT_ENVELOPED_DATA", ERR_LIB_CMS, CMS_R_TYPE_NOT_ENVELOPED_DATA},
+  #else
+    {"TYPE_NOT_ENVELOPED_DATA", 46, 146},
+  #endif
+  #ifdef CMS_R_UNABLE_TO_FINALIZE_CONTEXT
+    {"UNABLE_TO_FINALIZE_CONTEXT", ERR_LIB_CMS, CMS_R_UNABLE_TO_FINALIZE_CONTEXT},
+  #else
+    {"UNABLE_TO_FINALIZE_CONTEXT", 46, 147},
+  #endif
+  #ifdef CMS_R_UNKNOWN_CIPHER
+    {"UNKNOWN_CIPHER", ERR_LIB_CMS, CMS_R_UNKNOWN_CIPHER},
+  #else
+    {"UNKNOWN_CIPHER", 46, 148},
+  #endif
+  #ifdef CMS_R_UNKNOWN_DIGEST_ALGORITHM
+    {"UNKNOWN_DIGEST_ALGORITHM", ERR_LIB_CMS, CMS_R_UNKNOWN_DIGEST_ALGORITHM},
+  #else
+    {"UNKNOWN_DIGEST_ALGORITHM", 46, 149},
+  #endif
+  #ifdef CMS_R_UNKNOWN_ID
+    {"UNKNOWN_ID", ERR_LIB_CMS, CMS_R_UNKNOWN_ID},
+  #else
+    {"UNKNOWN_ID", 46, 150},
+  #endif
+  #ifdef CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM
+    {"UNSUPPORTED_COMPRESSION_ALGORITHM", ERR_LIB_CMS, CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM},
+  #else
+    {"UNSUPPORTED_COMPRESSION_ALGORITHM", 46, 151},
+  #endif
+  #ifdef CMS_R_UNSUPPORTED_CONTENT_TYPE
+    {"UNSUPPORTED_CONTENT_TYPE", ERR_LIB_CMS, CMS_R_UNSUPPORTED_CONTENT_TYPE},
+  #else
+    {"UNSUPPORTED_CONTENT_TYPE", 46, 152},
+  #endif
+  #ifdef CMS_R_UNSUPPORTED_KEK_ALGORITHM
+    {"UNSUPPORTED_KEK_ALGORITHM", ERR_LIB_CMS, CMS_R_UNSUPPORTED_KEK_ALGORITHM},
+  #else
+    {"UNSUPPORTED_KEK_ALGORITHM", 46, 153},
+  #endif
+  #ifdef CMS_R_UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM
+    {"UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM", ERR_LIB_CMS, CMS_R_UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM},
+  #else
+    {"UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM", 46, 179},
+  #endif
+  #ifdef CMS_R_UNSUPPORTED_RECIPIENTINFO_TYPE
+    {"UNSUPPORTED_RECIPIENTINFO_TYPE", ERR_LIB_CMS, CMS_R_UNSUPPORTED_RECIPIENTINFO_TYPE},
+  #else
+    {"UNSUPPORTED_RECIPIENTINFO_TYPE", 46, 155},
+  #endif
+  #ifdef CMS_R_UNSUPPORTED_RECIPIENT_TYPE
+    {"UNSUPPORTED_RECIPIENT_TYPE", ERR_LIB_CMS, CMS_R_UNSUPPORTED_RECIPIENT_TYPE},
+  #else
+    {"UNSUPPORTED_RECIPIENT_TYPE", 46, 154},
+  #endif
+  #ifdef CMS_R_UNSUPPORTED_TYPE
+    {"UNSUPPORTED_TYPE", ERR_LIB_CMS, CMS_R_UNSUPPORTED_TYPE},
+  #else
+    {"UNSUPPORTED_TYPE", 46, 156},
+  #endif
+  #ifdef CMS_R_UNWRAP_ERROR
+    {"UNWRAP_ERROR", ERR_LIB_CMS, CMS_R_UNWRAP_ERROR},
+  #else
+    {"UNWRAP_ERROR", 46, 157},
+  #endif
+  #ifdef CMS_R_UNWRAP_FAILURE
+    {"UNWRAP_FAILURE", ERR_LIB_CMS, CMS_R_UNWRAP_FAILURE},
+  #else
+    {"UNWRAP_FAILURE", 46, 180},
+  #endif
+  #ifdef CMS_R_VERIFICATION_FAILURE
+    {"VERIFICATION_FAILURE", ERR_LIB_CMS, CMS_R_VERIFICATION_FAILURE},
+  #else
+    {"VERIFICATION_FAILURE", 46, 158},
+  #endif
+  #ifdef CMS_R_WRAP_ERROR
+    {"WRAP_ERROR", ERR_LIB_CMS, CMS_R_WRAP_ERROR},
+  #else
+    {"WRAP_ERROR", 46, 159},
+  #endif
+  #ifdef COMP_R_ZLIB_DEFLATE_ERROR
+    {"ZLIB_DEFLATE_ERROR", ERR_LIB_COMP, COMP_R_ZLIB_DEFLATE_ERROR},
+  #else
+    {"ZLIB_DEFLATE_ERROR", 41, 99},
+  #endif
+  #ifdef COMP_R_ZLIB_INFLATE_ERROR
+    {"ZLIB_INFLATE_ERROR", ERR_LIB_COMP, COMP_R_ZLIB_INFLATE_ERROR},
+  #else
+    {"ZLIB_INFLATE_ERROR", 41, 100},
+  #endif
+  #ifdef COMP_R_ZLIB_NOT_SUPPORTED
+    {"ZLIB_NOT_SUPPORTED", ERR_LIB_COMP, COMP_R_ZLIB_NOT_SUPPORTED},
+  #else
+    {"ZLIB_NOT_SUPPORTED", 41, 101},
+  #endif
+  #ifdef CONF_R_ERROR_LOADING_DSO
+    {"ERROR_LOADING_DSO", ERR_LIB_CONF, CONF_R_ERROR_LOADING_DSO},
+  #else
+    {"ERROR_LOADING_DSO", 14, 110},
+  #endif
+  #ifdef CONF_R_LIST_CANNOT_BE_NULL
+    {"LIST_CANNOT_BE_NULL", ERR_LIB_CONF, CONF_R_LIST_CANNOT_BE_NULL},
+  #else
+    {"LIST_CANNOT_BE_NULL", 14, 115},
+  #endif
+  #ifdef CONF_R_MISSING_CLOSE_SQUARE_BRACKET
+    {"MISSING_CLOSE_SQUARE_BRACKET", ERR_LIB_CONF, CONF_R_MISSING_CLOSE_SQUARE_BRACKET},
+  #else
+    {"MISSING_CLOSE_SQUARE_BRACKET", 14, 100},
+  #endif
+  #ifdef CONF_R_MISSING_EQUAL_SIGN
+    {"MISSING_EQUAL_SIGN", ERR_LIB_CONF, CONF_R_MISSING_EQUAL_SIGN},
+  #else
+    {"MISSING_EQUAL_SIGN", 14, 101},
+  #endif
+  #ifdef CONF_R_MISSING_INIT_FUNCTION
+    {"MISSING_INIT_FUNCTION", ERR_LIB_CONF, CONF_R_MISSING_INIT_FUNCTION},
+  #else
+    {"MISSING_INIT_FUNCTION", 14, 112},
+  #endif
+  #ifdef CONF_R_MODULE_INITIALIZATION_ERROR
+    {"MODULE_INITIALIZATION_ERROR", ERR_LIB_CONF, CONF_R_MODULE_INITIALIZATION_ERROR},
+  #else
+    {"MODULE_INITIALIZATION_ERROR", 14, 109},
+  #endif
+  #ifdef CONF_R_NO_CLOSE_BRACE
+    {"NO_CLOSE_BRACE", ERR_LIB_CONF, CONF_R_NO_CLOSE_BRACE},
+  #else
+    {"NO_CLOSE_BRACE", 14, 102},
+  #endif
+  #ifdef CONF_R_NO_CONF
+    {"NO_CONF", ERR_LIB_CONF, CONF_R_NO_CONF},
+  #else
+    {"NO_CONF", 14, 105},
+  #endif
+  #ifdef CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE
+    {"NO_CONF_OR_ENVIRONMENT_VARIABLE", ERR_LIB_CONF, CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE},
+  #else
+    {"NO_CONF_OR_ENVIRONMENT_VARIABLE", 14, 106},
+  #endif
+  #ifdef CONF_R_NO_SECTION
+    {"NO_SECTION", ERR_LIB_CONF, CONF_R_NO_SECTION},
+  #else
+    {"NO_SECTION", 14, 107},
+  #endif
+  #ifdef CONF_R_NO_SUCH_FILE
+    {"NO_SUCH_FILE", ERR_LIB_CONF, CONF_R_NO_SUCH_FILE},
+  #else
+    {"NO_SUCH_FILE", 14, 114},
+  #endif
+  #ifdef CONF_R_NO_VALUE
+    {"NO_VALUE", ERR_LIB_CONF, CONF_R_NO_VALUE},
+  #else
+    {"NO_VALUE", 14, 108},
+  #endif
+  #ifdef CONF_R_NUMBER_TOO_LARGE
+    {"NUMBER_TOO_LARGE", ERR_LIB_CONF, CONF_R_NUMBER_TOO_LARGE},
+  #else
+    {"NUMBER_TOO_LARGE", 14, 121},
+  #endif
+  #ifdef CONF_R_RECURSIVE_DIRECTORY_INCLUDE
+    {"RECURSIVE_DIRECTORY_INCLUDE", ERR_LIB_CONF, CONF_R_RECURSIVE_DIRECTORY_INCLUDE},
+  #else
+    {"RECURSIVE_DIRECTORY_INCLUDE", 14, 111},
+  #endif
+  #ifdef CONF_R_SSL_COMMAND_SECTION_EMPTY
+    {"SSL_COMMAND_SECTION_EMPTY", ERR_LIB_CONF, CONF_R_SSL_COMMAND_SECTION_EMPTY},
+  #else
+    {"SSL_COMMAND_SECTION_EMPTY", 14, 117},
+  #endif
+  #ifdef CONF_R_SSL_COMMAND_SECTION_NOT_FOUND
+    {"SSL_COMMAND_SECTION_NOT_FOUND", ERR_LIB_CONF, CONF_R_SSL_COMMAND_SECTION_NOT_FOUND},
+  #else
+    {"SSL_COMMAND_SECTION_NOT_FOUND", 14, 118},
+  #endif
+  #ifdef CONF_R_SSL_SECTION_EMPTY
+    {"SSL_SECTION_EMPTY", ERR_LIB_CONF, CONF_R_SSL_SECTION_EMPTY},
+  #else
+    {"SSL_SECTION_EMPTY", 14, 119},
+  #endif
+  #ifdef CONF_R_SSL_SECTION_NOT_FOUND
+    {"SSL_SECTION_NOT_FOUND", ERR_LIB_CONF, CONF_R_SSL_SECTION_NOT_FOUND},
+  #else
+    {"SSL_SECTION_NOT_FOUND", 14, 120},
+  #endif
+  #ifdef CONF_R_UNABLE_TO_CREATE_NEW_SECTION
+    {"UNABLE_TO_CREATE_NEW_SECTION", ERR_LIB_CONF, CONF_R_UNABLE_TO_CREATE_NEW_SECTION},
+  #else
+    {"UNABLE_TO_CREATE_NEW_SECTION", 14, 103},
+  #endif
+  #ifdef CONF_R_UNKNOWN_MODULE_NAME
+    {"UNKNOWN_MODULE_NAME", ERR_LIB_CONF, CONF_R_UNKNOWN_MODULE_NAME},
+  #else
+    {"UNKNOWN_MODULE_NAME", 14, 113},
+  #endif
+  #ifdef CONF_R_VARIABLE_EXPANSION_TOO_LONG
+    {"VARIABLE_EXPANSION_TOO_LONG", ERR_LIB_CONF, CONF_R_VARIABLE_EXPANSION_TOO_LONG},
+  #else
+    {"VARIABLE_EXPANSION_TOO_LONG", 14, 116},
+  #endif
+  #ifdef CONF_R_VARIABLE_HAS_NO_VALUE
+    {"VARIABLE_HAS_NO_VALUE", ERR_LIB_CONF, CONF_R_VARIABLE_HAS_NO_VALUE},
+  #else
+    {"VARIABLE_HAS_NO_VALUE", 14, 104},
+  #endif
+  #ifdef CRYPTO_R_FIPS_MODE_NOT_SUPPORTED
+    {"FIPS_MODE_NOT_SUPPORTED", ERR_LIB_CRYPTO, CRYPTO_R_FIPS_MODE_NOT_SUPPORTED},
+  #else
+    {"FIPS_MODE_NOT_SUPPORTED", 15, 101},
+  #endif
+  #ifdef CRYPTO_R_ILLEGAL_HEX_DIGIT
+    {"ILLEGAL_HEX_DIGIT", ERR_LIB_CRYPTO, CRYPTO_R_ILLEGAL_HEX_DIGIT},
+  #else
+    {"ILLEGAL_HEX_DIGIT", 15, 102},
+  #endif
+  #ifdef CRYPTO_R_ODD_NUMBER_OF_DIGITS
+    {"ODD_NUMBER_OF_DIGITS", ERR_LIB_CRYPTO, CRYPTO_R_ODD_NUMBER_OF_DIGITS},
+  #else
+    {"ODD_NUMBER_OF_DIGITS", 15, 103},
+  #endif
+  #ifdef CT_R_BASE64_DECODE_ERROR
+    {"BASE64_DECODE_ERROR", ERR_LIB_CT, CT_R_BASE64_DECODE_ERROR},
+  #else
+    {"BASE64_DECODE_ERROR", 50, 108},
+  #endif
+  #ifdef CT_R_INVALID_LOG_ID_LENGTH
+    {"INVALID_LOG_ID_LENGTH", ERR_LIB_CT, CT_R_INVALID_LOG_ID_LENGTH},
+  #else
+    {"INVALID_LOG_ID_LENGTH", 50, 100},
+  #endif
+  #ifdef CT_R_LOG_CONF_INVALID
+    {"LOG_CONF_INVALID", ERR_LIB_CT, CT_R_LOG_CONF_INVALID},
+  #else
+    {"LOG_CONF_INVALID", 50, 109},
+  #endif
+  #ifdef CT_R_LOG_CONF_INVALID_KEY
+    {"LOG_CONF_INVALID_KEY", ERR_LIB_CT, CT_R_LOG_CONF_INVALID_KEY},
+  #else
+    {"LOG_CONF_INVALID_KEY", 50, 110},
+  #endif
+  #ifdef CT_R_LOG_CONF_MISSING_DESCRIPTION
+    {"LOG_CONF_MISSING_DESCRIPTION", ERR_LIB_CT, CT_R_LOG_CONF_MISSING_DESCRIPTION},
+  #else
+    {"LOG_CONF_MISSING_DESCRIPTION", 50, 111},
+  #endif
+  #ifdef CT_R_LOG_CONF_MISSING_KEY
+    {"LOG_CONF_MISSING_KEY", ERR_LIB_CT, CT_R_LOG_CONF_MISSING_KEY},
+  #else
+    {"LOG_CONF_MISSING_KEY", 50, 112},
+  #endif
+  #ifdef CT_R_LOG_KEY_INVALID
+    {"LOG_KEY_INVALID", ERR_LIB_CT, CT_R_LOG_KEY_INVALID},
+  #else
+    {"LOG_KEY_INVALID", 50, 113},
+  #endif
+  #ifdef CT_R_SCT_FUTURE_TIMESTAMP
+    {"SCT_FUTURE_TIMESTAMP", ERR_LIB_CT, CT_R_SCT_FUTURE_TIMESTAMP},
+  #else
+    {"SCT_FUTURE_TIMESTAMP", 50, 116},
+  #endif
+  #ifdef CT_R_SCT_INVALID
+    {"SCT_INVALID", ERR_LIB_CT, CT_R_SCT_INVALID},
+  #else
+    {"SCT_INVALID", 50, 104},
+  #endif
+  #ifdef CT_R_SCT_INVALID_SIGNATURE
+    {"SCT_INVALID_SIGNATURE", ERR_LIB_CT, CT_R_SCT_INVALID_SIGNATURE},
+  #else
+    {"SCT_INVALID_SIGNATURE", 50, 107},
+  #endif
+  #ifdef CT_R_SCT_LIST_INVALID
+    {"SCT_LIST_INVALID", ERR_LIB_CT, CT_R_SCT_LIST_INVALID},
+  #else
+    {"SCT_LIST_INVALID", 50, 105},
+  #endif
+  #ifdef CT_R_SCT_LOG_ID_MISMATCH
+    {"SCT_LOG_ID_MISMATCH", ERR_LIB_CT, CT_R_SCT_LOG_ID_MISMATCH},
+  #else
+    {"SCT_LOG_ID_MISMATCH", 50, 114},
+  #endif
+  #ifdef CT_R_SCT_NOT_SET
+    {"SCT_NOT_SET", ERR_LIB_CT, CT_R_SCT_NOT_SET},
+  #else
+    {"SCT_NOT_SET", 50, 106},
+  #endif
+  #ifdef CT_R_SCT_UNSUPPORTED_VERSION
+    {"SCT_UNSUPPORTED_VERSION", ERR_LIB_CT, CT_R_SCT_UNSUPPORTED_VERSION},
+  #else
+    {"SCT_UNSUPPORTED_VERSION", 50, 115},
+  #endif
+  #ifdef CT_R_UNRECOGNIZED_SIGNATURE_NID
+    {"UNRECOGNIZED_SIGNATURE_NID", ERR_LIB_CT, CT_R_UNRECOGNIZED_SIGNATURE_NID},
+  #else
+    {"UNRECOGNIZED_SIGNATURE_NID", 50, 101},
+  #endif
+  #ifdef CT_R_UNSUPPORTED_ENTRY_TYPE
+    {"UNSUPPORTED_ENTRY_TYPE", ERR_LIB_CT, CT_R_UNSUPPORTED_ENTRY_TYPE},
+  #else
+    {"UNSUPPORTED_ENTRY_TYPE", 50, 102},
+  #endif
+  #ifdef CT_R_UNSUPPORTED_VERSION
+    {"UNSUPPORTED_VERSION", ERR_LIB_CT, CT_R_UNSUPPORTED_VERSION},
+  #else
+    {"UNSUPPORTED_VERSION", 50, 103},
+  #endif
+  #ifdef DH_R_BAD_GENERATOR
+    {"BAD_GENERATOR", ERR_LIB_DH, DH_R_BAD_GENERATOR},
+  #else
+    {"BAD_GENERATOR", 5, 101},
+  #endif
+  #ifdef DH_R_BN_DECODE_ERROR
+    {"BN_DECODE_ERROR", ERR_LIB_DH, DH_R_BN_DECODE_ERROR},
+  #else
+    {"BN_DECODE_ERROR", 5, 109},
+  #endif
+  #ifdef DH_R_BN_ERROR
+    {"BN_ERROR", ERR_LIB_DH, DH_R_BN_ERROR},
+  #else
+    {"BN_ERROR", 5, 106},
+  #endif
+  #ifdef DH_R_CHECK_INVALID_J_VALUE
+    {"CHECK_INVALID_J_VALUE", ERR_LIB_DH, DH_R_CHECK_INVALID_J_VALUE},
+  #else
+    {"CHECK_INVALID_J_VALUE", 5, 115},
+  #endif
+  #ifdef DH_R_CHECK_INVALID_Q_VALUE
+    {"CHECK_INVALID_Q_VALUE", ERR_LIB_DH, DH_R_CHECK_INVALID_Q_VALUE},
+  #else
+    {"CHECK_INVALID_Q_VALUE", 5, 116},
+  #endif
+  #ifdef DH_R_CHECK_PUBKEY_INVALID
+    {"CHECK_PUBKEY_INVALID", ERR_LIB_DH, DH_R_CHECK_PUBKEY_INVALID},
+  #else
+    {"CHECK_PUBKEY_INVALID", 5, 122},
+  #endif
+  #ifdef DH_R_CHECK_PUBKEY_TOO_LARGE
+    {"CHECK_PUBKEY_TOO_LARGE", ERR_LIB_DH, DH_R_CHECK_PUBKEY_TOO_LARGE},
+  #else
+    {"CHECK_PUBKEY_TOO_LARGE", 5, 123},
+  #endif
+  #ifdef DH_R_CHECK_PUBKEY_TOO_SMALL
+    {"CHECK_PUBKEY_TOO_SMALL", ERR_LIB_DH, DH_R_CHECK_PUBKEY_TOO_SMALL},
+  #else
+    {"CHECK_PUBKEY_TOO_SMALL", 5, 124},
+  #endif
+  #ifdef DH_R_CHECK_P_NOT_PRIME
+    {"CHECK_P_NOT_PRIME", ERR_LIB_DH, DH_R_CHECK_P_NOT_PRIME},
+  #else
+    {"CHECK_P_NOT_PRIME", 5, 117},
+  #endif
+  #ifdef DH_R_CHECK_P_NOT_SAFE_PRIME
+    {"CHECK_P_NOT_SAFE_PRIME", ERR_LIB_DH, DH_R_CHECK_P_NOT_SAFE_PRIME},
+  #else
+    {"CHECK_P_NOT_SAFE_PRIME", 5, 118},
+  #endif
+  #ifdef DH_R_CHECK_Q_NOT_PRIME
+    {"CHECK_Q_NOT_PRIME", ERR_LIB_DH, DH_R_CHECK_Q_NOT_PRIME},
+  #else
+    {"CHECK_Q_NOT_PRIME", 5, 119},
+  #endif
+  #ifdef DH_R_DECODE_ERROR
+    {"DECODE_ERROR", ERR_LIB_DH, DH_R_DECODE_ERROR},
+  #else
+    {"DECODE_ERROR", 5, 104},
+  #endif
+  #ifdef DH_R_INVALID_PARAMETER_NAME
+    {"INVALID_PARAMETER_NAME", ERR_LIB_DH, DH_R_INVALID_PARAMETER_NAME},
+  #else
+    {"INVALID_PARAMETER_NAME", 5, 110},
+  #endif
+  #ifdef DH_R_INVALID_PARAMETER_NID
+    {"INVALID_PARAMETER_NID", ERR_LIB_DH, DH_R_INVALID_PARAMETER_NID},
+  #else
+    {"INVALID_PARAMETER_NID", 5, 114},
+  #endif
+  #ifdef DH_R_INVALID_PUBKEY
+    {"INVALID_PUBKEY", ERR_LIB_DH, DH_R_INVALID_PUBKEY},
+  #else
+    {"INVALID_PUBKEY", 5, 102},
+  #endif
+  #ifdef DH_R_KDF_PARAMETER_ERROR
+    {"KDF_PARAMETER_ERROR", ERR_LIB_DH, DH_R_KDF_PARAMETER_ERROR},
+  #else
+    {"KDF_PARAMETER_ERROR", 5, 112},
+  #endif
+  #ifdef DH_R_KEYS_NOT_SET
+    {"KEYS_NOT_SET", ERR_LIB_DH, DH_R_KEYS_NOT_SET},
+  #else
+    {"KEYS_NOT_SET", 5, 108},
+  #endif
+  #ifdef DH_R_MISSING_PUBKEY
+    {"MISSING_PUBKEY", ERR_LIB_DH, DH_R_MISSING_PUBKEY},
+  #else
+    {"MISSING_PUBKEY", 5, 125},
+  #endif
+  #ifdef DH_R_MODULUS_TOO_LARGE
+    {"MODULUS_TOO_LARGE", ERR_LIB_DH, DH_R_MODULUS_TOO_LARGE},
+  #else
+    {"MODULUS_TOO_LARGE", 5, 103},
+  #endif
+  #ifdef DH_R_NOT_SUITABLE_GENERATOR
+    {"NOT_SUITABLE_GENERATOR", ERR_LIB_DH, DH_R_NOT_SUITABLE_GENERATOR},
+  #else
+    {"NOT_SUITABLE_GENERATOR", 5, 120},
+  #endif
+  #ifdef DH_R_NO_PARAMETERS_SET
+    {"NO_PARAMETERS_SET", ERR_LIB_DH, DH_R_NO_PARAMETERS_SET},
+  #else
+    {"NO_PARAMETERS_SET", 5, 107},
+  #endif
+  #ifdef DH_R_NO_PRIVATE_VALUE
+    {"NO_PRIVATE_VALUE", ERR_LIB_DH, DH_R_NO_PRIVATE_VALUE},
+  #else
+    {"NO_PRIVATE_VALUE", 5, 100},
+  #endif
+  #ifdef DH_R_PARAMETER_ENCODING_ERROR
+    {"PARAMETER_ENCODING_ERROR", ERR_LIB_DH, DH_R_PARAMETER_ENCODING_ERROR},
+  #else
+    {"PARAMETER_ENCODING_ERROR", 5, 105},
+  #endif
+  #ifdef DH_R_PEER_KEY_ERROR
+    {"PEER_KEY_ERROR", ERR_LIB_DH, DH_R_PEER_KEY_ERROR},
+  #else
+    {"PEER_KEY_ERROR", 5, 111},
+  #endif
+  #ifdef DH_R_SHARED_INFO_ERROR
+    {"SHARED_INFO_ERROR", ERR_LIB_DH, DH_R_SHARED_INFO_ERROR},
+  #else
+    {"SHARED_INFO_ERROR", 5, 113},
+  #endif
+  #ifdef DH_R_UNABLE_TO_CHECK_GENERATOR
+    {"UNABLE_TO_CHECK_GENERATOR", ERR_LIB_DH, DH_R_UNABLE_TO_CHECK_GENERATOR},
+  #else
+    {"UNABLE_TO_CHECK_GENERATOR", 5, 121},
+  #endif
+  #ifdef DSA_R_BAD_Q_VALUE
+    {"BAD_Q_VALUE", ERR_LIB_DSA, DSA_R_BAD_Q_VALUE},
+  #else
+    {"BAD_Q_VALUE", 10, 102},
+  #endif
+  #ifdef DSA_R_BN_DECODE_ERROR
+    {"BN_DECODE_ERROR", ERR_LIB_DSA, DSA_R_BN_DECODE_ERROR},
+  #else
+    {"BN_DECODE_ERROR", 10, 108},
+  #endif
+  #ifdef DSA_R_BN_ERROR
+    {"BN_ERROR", ERR_LIB_DSA, DSA_R_BN_ERROR},
+  #else
+    {"BN_ERROR", 10, 109},
+  #endif
+  #ifdef DSA_R_DECODE_ERROR
+    {"DECODE_ERROR", ERR_LIB_DSA, DSA_R_DECODE_ERROR},
+  #else
+    {"DECODE_ERROR", 10, 104},
+  #endif
+  #ifdef DSA_R_INVALID_DIGEST_TYPE
+    {"INVALID_DIGEST_TYPE", ERR_LIB_DSA, DSA_R_INVALID_DIGEST_TYPE},
+  #else
+    {"INVALID_DIGEST_TYPE", 10, 106},
+  #endif
+  #ifdef DSA_R_INVALID_PARAMETERS
+    {"INVALID_PARAMETERS", ERR_LIB_DSA, DSA_R_INVALID_PARAMETERS},
+  #else
+    {"INVALID_PARAMETERS", 10, 112},
+  #endif
+  #ifdef DSA_R_MISSING_PARAMETERS
+    {"MISSING_PARAMETERS", ERR_LIB_DSA, DSA_R_MISSING_PARAMETERS},
+  #else
+    {"MISSING_PARAMETERS", 10, 101},
+  #endif
+  #ifdef DSA_R_MISSING_PRIVATE_KEY
+    {"MISSING_PRIVATE_KEY", ERR_LIB_DSA, DSA_R_MISSING_PRIVATE_KEY},
+  #else
+    {"MISSING_PRIVATE_KEY", 10, 111},
+  #endif
+  #ifdef DSA_R_MODULUS_TOO_LARGE
+    {"MODULUS_TOO_LARGE", ERR_LIB_DSA, DSA_R_MODULUS_TOO_LARGE},
+  #else
+    {"MODULUS_TOO_LARGE", 10, 103},
+  #endif
+  #ifdef DSA_R_NO_PARAMETERS_SET
+    {"NO_PARAMETERS_SET", ERR_LIB_DSA, DSA_R_NO_PARAMETERS_SET},
+  #else
+    {"NO_PARAMETERS_SET", 10, 107},
+  #endif
+  #ifdef DSA_R_PARAMETER_ENCODING_ERROR
+    {"PARAMETER_ENCODING_ERROR", ERR_LIB_DSA, DSA_R_PARAMETER_ENCODING_ERROR},
+  #else
+    {"PARAMETER_ENCODING_ERROR", 10, 105},
+  #endif
+  #ifdef DSA_R_Q_NOT_PRIME
+    {"Q_NOT_PRIME", ERR_LIB_DSA, DSA_R_Q_NOT_PRIME},
+  #else
+    {"Q_NOT_PRIME", 10, 113},
+  #endif
+  #ifdef DSA_R_SEED_LEN_SMALL
+    {"SEED_LEN_SMALL", ERR_LIB_DSA, DSA_R_SEED_LEN_SMALL},
+  #else
+    {"SEED_LEN_SMALL", 10, 110},
+  #endif
+  #ifdef DSO_R_CTRL_FAILED
+    {"CTRL_FAILED", ERR_LIB_DSO, DSO_R_CTRL_FAILED},
+  #else
+    {"CTRL_FAILED", 37, 100},
+  #endif
+  #ifdef DSO_R_DSO_ALREADY_LOADED
+    {"DSO_ALREADY_LOADED", ERR_LIB_DSO, DSO_R_DSO_ALREADY_LOADED},
+  #else
+    {"DSO_ALREADY_LOADED", 37, 110},
+  #endif
+  #ifdef DSO_R_EMPTY_FILE_STRUCTURE
+    {"EMPTY_FILE_STRUCTURE", ERR_LIB_DSO, DSO_R_EMPTY_FILE_STRUCTURE},
+  #else
+    {"EMPTY_FILE_STRUCTURE", 37, 113},
+  #endif
+  #ifdef DSO_R_FAILURE
+    {"FAILURE", ERR_LIB_DSO, DSO_R_FAILURE},
+  #else
+    {"FAILURE", 37, 114},
+  #endif
+  #ifdef DSO_R_FILENAME_TOO_BIG
+    {"FILENAME_TOO_BIG", ERR_LIB_DSO, DSO_R_FILENAME_TOO_BIG},
+  #else
+    {"FILENAME_TOO_BIG", 37, 101},
+  #endif
+  #ifdef DSO_R_FINISH_FAILED
+    {"FINISH_FAILED", ERR_LIB_DSO, DSO_R_FINISH_FAILED},
+  #else
+    {"FINISH_FAILED", 37, 102},
+  #endif
+  #ifdef DSO_R_INCORRECT_FILE_SYNTAX
+    {"INCORRECT_FILE_SYNTAX", ERR_LIB_DSO, DSO_R_INCORRECT_FILE_SYNTAX},
+  #else
+    {"INCORRECT_FILE_SYNTAX", 37, 115},
+  #endif
+  #ifdef DSO_R_LOAD_FAILED
+    {"LOAD_FAILED", ERR_LIB_DSO, DSO_R_LOAD_FAILED},
+  #else
+    {"LOAD_FAILED", 37, 103},
+  #endif
+  #ifdef DSO_R_NAME_TRANSLATION_FAILED
+    {"NAME_TRANSLATION_FAILED", ERR_LIB_DSO, DSO_R_NAME_TRANSLATION_FAILED},
+  #else
+    {"NAME_TRANSLATION_FAILED", 37, 109},
+  #endif
+  #ifdef DSO_R_NO_FILENAME
+    {"NO_FILENAME", ERR_LIB_DSO, DSO_R_NO_FILENAME},
+  #else
+    {"NO_FILENAME", 37, 111},
+  #endif
+  #ifdef DSO_R_NULL_HANDLE
+    {"NULL_HANDLE", ERR_LIB_DSO, DSO_R_NULL_HANDLE},
+  #else
+    {"NULL_HANDLE", 37, 104},
+  #endif
+  #ifdef DSO_R_SET_FILENAME_FAILED
+    {"SET_FILENAME_FAILED", ERR_LIB_DSO, DSO_R_SET_FILENAME_FAILED},
+  #else
+    {"SET_FILENAME_FAILED", 37, 112},
+  #endif
+  #ifdef DSO_R_STACK_ERROR
+    {"STACK_ERROR", ERR_LIB_DSO, DSO_R_STACK_ERROR},
+  #else
+    {"STACK_ERROR", 37, 105},
+  #endif
+  #ifdef DSO_R_SYM_FAILURE
+    {"SYM_FAILURE", ERR_LIB_DSO, DSO_R_SYM_FAILURE},
+  #else
+    {"SYM_FAILURE", 37, 106},
+  #endif
+  #ifdef DSO_R_UNLOAD_FAILED
+    {"UNLOAD_FAILED", ERR_LIB_DSO, DSO_R_UNLOAD_FAILED},
+  #else
+    {"UNLOAD_FAILED", 37, 107},
+  #endif
+  #ifdef DSO_R_UNSUPPORTED
+    {"UNSUPPORTED", ERR_LIB_DSO, DSO_R_UNSUPPORTED},
+  #else
+    {"UNSUPPORTED", 37, 108},
+  #endif
+  #ifdef EC_R_ASN1_ERROR
+    {"ASN1_ERROR", ERR_LIB_EC, EC_R_ASN1_ERROR},
+  #else
+    {"ASN1_ERROR", 16, 115},
+  #endif
+  #ifdef EC_R_BAD_SIGNATURE
+    {"BAD_SIGNATURE", ERR_LIB_EC, EC_R_BAD_SIGNATURE},
+  #else
+    {"BAD_SIGNATURE", 16, 156},
+  #endif
+  #ifdef EC_R_BIGNUM_OUT_OF_RANGE
+    {"BIGNUM_OUT_OF_RANGE", ERR_LIB_EC, EC_R_BIGNUM_OUT_OF_RANGE},
+  #else
+    {"BIGNUM_OUT_OF_RANGE", 16, 144},
+  #endif
+  #ifdef EC_R_BUFFER_TOO_SMALL
+    {"BUFFER_TOO_SMALL", ERR_LIB_EC, EC_R_BUFFER_TOO_SMALL},
+  #else
+    {"BUFFER_TOO_SMALL", 16, 100},
+  #endif
+  #ifdef EC_R_CANNOT_INVERT
+    {"CANNOT_INVERT", ERR_LIB_EC, EC_R_CANNOT_INVERT},
+  #else
+    {"CANNOT_INVERT", 16, 165},
+  #endif
+  #ifdef EC_R_COORDINATES_OUT_OF_RANGE
+    {"COORDINATES_OUT_OF_RANGE", ERR_LIB_EC, EC_R_COORDINATES_OUT_OF_RANGE},
+  #else
+    {"COORDINATES_OUT_OF_RANGE", 16, 146},
+  #endif
+  #ifdef EC_R_CURVE_DOES_NOT_SUPPORT_ECDH
+    {"CURVE_DOES_NOT_SUPPORT_ECDH", ERR_LIB_EC, EC_R_CURVE_DOES_NOT_SUPPORT_ECDH},
+  #else
+    {"CURVE_DOES_NOT_SUPPORT_ECDH", 16, 160},
+  #endif
+  #ifdef EC_R_CURVE_DOES_NOT_SUPPORT_SIGNING
+    {"CURVE_DOES_NOT_SUPPORT_SIGNING", ERR_LIB_EC, EC_R_CURVE_DOES_NOT_SUPPORT_SIGNING},
+  #else
+    {"CURVE_DOES_NOT_SUPPORT_SIGNING", 16, 159},
+  #endif
+  #ifdef EC_R_D2I_ECPKPARAMETERS_FAILURE
+    {"D2I_ECPKPARAMETERS_FAILURE", ERR_LIB_EC, EC_R_D2I_ECPKPARAMETERS_FAILURE},
+  #else
+    {"D2I_ECPKPARAMETERS_FAILURE", 16, 117},
+  #endif
+  #ifdef EC_R_DECODE_ERROR
+    {"DECODE_ERROR", ERR_LIB_EC, EC_R_DECODE_ERROR},
+  #else
+    {"DECODE_ERROR", 16, 142},
+  #endif
+  #ifdef EC_R_DISCRIMINANT_IS_ZERO
+    {"DISCRIMINANT_IS_ZERO", ERR_LIB_EC, EC_R_DISCRIMINANT_IS_ZERO},
+  #else
+    {"DISCRIMINANT_IS_ZERO", 16, 118},
+  #endif
+  #ifdef EC_R_EC_GROUP_NEW_BY_NAME_FAILURE
+    {"EC_GROUP_NEW_BY_NAME_FAILURE", ERR_LIB_EC, EC_R_EC_GROUP_NEW_BY_NAME_FAILURE},
+  #else
+    {"EC_GROUP_NEW_BY_NAME_FAILURE", 16, 119},
+  #endif
+  #ifdef EC_R_FIELD_TOO_LARGE
+    {"FIELD_TOO_LARGE", ERR_LIB_EC, EC_R_FIELD_TOO_LARGE},
+  #else
+    {"FIELD_TOO_LARGE", 16, 143},
+  #endif
+  #ifdef EC_R_GF2M_NOT_SUPPORTED
+    {"GF2M_NOT_SUPPORTED", ERR_LIB_EC, EC_R_GF2M_NOT_SUPPORTED},
+  #else
+    {"GF2M_NOT_SUPPORTED", 16, 147},
+  #endif
+  #ifdef EC_R_GROUP2PKPARAMETERS_FAILURE
+    {"GROUP2PKPARAMETERS_FAILURE", ERR_LIB_EC, EC_R_GROUP2PKPARAMETERS_FAILURE},
+  #else
+    {"GROUP2PKPARAMETERS_FAILURE", 16, 120},
+  #endif
+  #ifdef EC_R_I2D_ECPKPARAMETERS_FAILURE
+    {"I2D_ECPKPARAMETERS_FAILURE", ERR_LIB_EC, EC_R_I2D_ECPKPARAMETERS_FAILURE},
+  #else
+    {"I2D_ECPKPARAMETERS_FAILURE", 16, 121},
+  #endif
+  #ifdef EC_R_INCOMPATIBLE_OBJECTS
+    {"INCOMPATIBLE_OBJECTS", ERR_LIB_EC, EC_R_INCOMPATIBLE_OBJECTS},
+  #else
+    {"INCOMPATIBLE_OBJECTS", 16, 101},
+  #endif
+  #ifdef EC_R_INVALID_ARGUMENT
+    {"INVALID_ARGUMENT", ERR_LIB_EC, EC_R_INVALID_ARGUMENT},
+  #else
+    {"INVALID_ARGUMENT", 16, 112},
+  #endif
+  #ifdef EC_R_INVALID_COMPRESSED_POINT
+    {"INVALID_COMPRESSED_POINT", ERR_LIB_EC, EC_R_INVALID_COMPRESSED_POINT},
+  #else
+    {"INVALID_COMPRESSED_POINT", 16, 110},
+  #endif
+  #ifdef EC_R_INVALID_COMPRESSION_BIT
+    {"INVALID_COMPRESSION_BIT", ERR_LIB_EC, EC_R_INVALID_COMPRESSION_BIT},
+  #else
+    {"INVALID_COMPRESSION_BIT", 16, 109},
+  #endif
+  #ifdef EC_R_INVALID_CURVE
+    {"INVALID_CURVE", ERR_LIB_EC, EC_R_INVALID_CURVE},
+  #else
+    {"INVALID_CURVE", 16, 141},
+  #endif
+  #ifdef EC_R_INVALID_DIGEST
+    {"INVALID_DIGEST", ERR_LIB_EC, EC_R_INVALID_DIGEST},
+  #else
+    {"INVALID_DIGEST", 16, 151},
+  #endif
+  #ifdef EC_R_INVALID_DIGEST_TYPE
+    {"INVALID_DIGEST_TYPE", ERR_LIB_EC, EC_R_INVALID_DIGEST_TYPE},
+  #else
+    {"INVALID_DIGEST_TYPE", 16, 138},
+  #endif
+  #ifdef EC_R_INVALID_ENCODING
+    {"INVALID_ENCODING", ERR_LIB_EC, EC_R_INVALID_ENCODING},
+  #else
+    {"INVALID_ENCODING", 16, 102},
+  #endif
+  #ifdef EC_R_INVALID_FIELD
+    {"INVALID_FIELD", ERR_LIB_EC, EC_R_INVALID_FIELD},
+  #else
+    {"INVALID_FIELD", 16, 103},
+  #endif
+  #ifdef EC_R_INVALID_FORM
+    {"INVALID_FORM", ERR_LIB_EC, EC_R_INVALID_FORM},
+  #else
+    {"INVALID_FORM", 16, 104},
+  #endif
+  #ifdef EC_R_INVALID_GROUP_ORDER
+    {"INVALID_GROUP_ORDER", ERR_LIB_EC, EC_R_INVALID_GROUP_ORDER},
+  #else
+    {"INVALID_GROUP_ORDER", 16, 122},
+  #endif
+  #ifdef EC_R_INVALID_KEY
+    {"INVALID_KEY", ERR_LIB_EC, EC_R_INVALID_KEY},
+  #else
+    {"INVALID_KEY", 16, 116},
+  #endif
+  #ifdef EC_R_INVALID_OUTPUT_LENGTH
+    {"INVALID_OUTPUT_LENGTH", ERR_LIB_EC, EC_R_INVALID_OUTPUT_LENGTH},
+  #else
+    {"INVALID_OUTPUT_LENGTH", 16, 161},
+  #endif
+  #ifdef EC_R_INVALID_PEER_KEY
+    {"INVALID_PEER_KEY", ERR_LIB_EC, EC_R_INVALID_PEER_KEY},
+  #else
+    {"INVALID_PEER_KEY", 16, 133},
+  #endif
+  #ifdef EC_R_INVALID_PENTANOMIAL_BASIS
+    {"INVALID_PENTANOMIAL_BASIS", ERR_LIB_EC, EC_R_INVALID_PENTANOMIAL_BASIS},
+  #else
+    {"INVALID_PENTANOMIAL_BASIS", 16, 132},
+  #endif
+  #ifdef EC_R_INVALID_PRIVATE_KEY
+    {"INVALID_PRIVATE_KEY", ERR_LIB_EC, EC_R_INVALID_PRIVATE_KEY},
+  #else
+    {"INVALID_PRIVATE_KEY", 16, 123},
+  #endif
+  #ifdef EC_R_INVALID_TRINOMIAL_BASIS
+    {"INVALID_TRINOMIAL_BASIS", ERR_LIB_EC, EC_R_INVALID_TRINOMIAL_BASIS},
+  #else
+    {"INVALID_TRINOMIAL_BASIS", 16, 137},
+  #endif
+  #ifdef EC_R_KDF_PARAMETER_ERROR
+    {"KDF_PARAMETER_ERROR", ERR_LIB_EC, EC_R_KDF_PARAMETER_ERROR},
+  #else
+    {"KDF_PARAMETER_ERROR", 16, 148},
+  #endif
+  #ifdef EC_R_KEYS_NOT_SET
+    {"KEYS_NOT_SET", ERR_LIB_EC, EC_R_KEYS_NOT_SET},
+  #else
+    {"KEYS_NOT_SET", 16, 140},
+  #endif
+  #ifdef EC_R_LADDER_POST_FAILURE
+    {"LADDER_POST_FAILURE", ERR_LIB_EC, EC_R_LADDER_POST_FAILURE},
+  #else
+    {"LADDER_POST_FAILURE", 16, 136},
+  #endif
+  #ifdef EC_R_LADDER_PRE_FAILURE
+    {"LADDER_PRE_FAILURE", ERR_LIB_EC, EC_R_LADDER_PRE_FAILURE},
+  #else
+    {"LADDER_PRE_FAILURE", 16, 153},
+  #endif
+  #ifdef EC_R_LADDER_STEP_FAILURE
+    {"LADDER_STEP_FAILURE", ERR_LIB_EC, EC_R_LADDER_STEP_FAILURE},
+  #else
+    {"LADDER_STEP_FAILURE", 16, 162},
+  #endif
+  #ifdef EC_R_MISSING_OID
+    {"MISSING_OID", ERR_LIB_EC, EC_R_MISSING_OID},
+  #else
+    {"MISSING_OID", 16, 167},
+  #endif
+  #ifdef EC_R_MISSING_PARAMETERS
+    {"MISSING_PARAMETERS", ERR_LIB_EC, EC_R_MISSING_PARAMETERS},
+  #else
+    {"MISSING_PARAMETERS", 16, 124},
+  #endif
+  #ifdef EC_R_MISSING_PRIVATE_KEY
+    {"MISSING_PRIVATE_KEY", ERR_LIB_EC, EC_R_MISSING_PRIVATE_KEY},
+  #else
+    {"MISSING_PRIVATE_KEY", 16, 125},
+  #endif
+  #ifdef EC_R_NEED_NEW_SETUP_VALUES
+    {"NEED_NEW_SETUP_VALUES", ERR_LIB_EC, EC_R_NEED_NEW_SETUP_VALUES},
+  #else
+    {"NEED_NEW_SETUP_VALUES", 16, 157},
+  #endif
+  #ifdef EC_R_NOT_A_NIST_PRIME
+    {"NOT_A_NIST_PRIME", ERR_LIB_EC, EC_R_NOT_A_NIST_PRIME},
+  #else
+    {"NOT_A_NIST_PRIME", 16, 135},
+  #endif
+  #ifdef EC_R_NOT_IMPLEMENTED
+    {"NOT_IMPLEMENTED", ERR_LIB_EC, EC_R_NOT_IMPLEMENTED},
+  #else
+    {"NOT_IMPLEMENTED", 16, 126},
+  #endif
+  #ifdef EC_R_NOT_INITIALIZED
+    {"NOT_INITIALIZED", ERR_LIB_EC, EC_R_NOT_INITIALIZED},
+  #else
+    {"NOT_INITIALIZED", 16, 111},
+  #endif
+  #ifdef EC_R_NO_PARAMETERS_SET
+    {"NO_PARAMETERS_SET", ERR_LIB_EC, EC_R_NO_PARAMETERS_SET},
+  #else
+    {"NO_PARAMETERS_SET", 16, 139},
+  #endif
+  #ifdef EC_R_NO_PRIVATE_VALUE
+    {"NO_PRIVATE_VALUE", ERR_LIB_EC, EC_R_NO_PRIVATE_VALUE},
+  #else
+    {"NO_PRIVATE_VALUE", 16, 154},
+  #endif
+  #ifdef EC_R_OPERATION_NOT_SUPPORTED
+    {"OPERATION_NOT_SUPPORTED", ERR_LIB_EC, EC_R_OPERATION_NOT_SUPPORTED},
+  #else
+    {"OPERATION_NOT_SUPPORTED", 16, 152},
+  #endif
+  #ifdef EC_R_PASSED_NULL_PARAMETER
+    {"PASSED_NULL_PARAMETER", ERR_LIB_EC, EC_R_PASSED_NULL_PARAMETER},
+  #else
+    {"PASSED_NULL_PARAMETER", 16, 134},
+  #endif
+  #ifdef EC_R_PEER_KEY_ERROR
+    {"PEER_KEY_ERROR", ERR_LIB_EC, EC_R_PEER_KEY_ERROR},
+  #else
+    {"PEER_KEY_ERROR", 16, 149},
+  #endif
+  #ifdef EC_R_PKPARAMETERS2GROUP_FAILURE
+    {"PKPARAMETERS2GROUP_FAILURE", ERR_LIB_EC, EC_R_PKPARAMETERS2GROUP_FAILURE},
+  #else
+    {"PKPARAMETERS2GROUP_FAILURE", 16, 127},
+  #endif
+  #ifdef EC_R_POINT_ARITHMETIC_FAILURE
+    {"POINT_ARITHMETIC_FAILURE", ERR_LIB_EC, EC_R_POINT_ARITHMETIC_FAILURE},
+  #else
+    {"POINT_ARITHMETIC_FAILURE", 16, 155},
+  #endif
+  #ifdef EC_R_POINT_AT_INFINITY
+    {"POINT_AT_INFINITY", ERR_LIB_EC, EC_R_POINT_AT_INFINITY},
+  #else
+    {"POINT_AT_INFINITY", 16, 106},
+  #endif
+  #ifdef EC_R_POINT_COORDINATES_BLIND_FAILURE
+    {"POINT_COORDINATES_BLIND_FAILURE", ERR_LIB_EC, EC_R_POINT_COORDINATES_BLIND_FAILURE},
+  #else
+    {"POINT_COORDINATES_BLIND_FAILURE", 16, 163},
+  #endif
+  #ifdef EC_R_POINT_IS_NOT_ON_CURVE
+    {"POINT_IS_NOT_ON_CURVE", ERR_LIB_EC, EC_R_POINT_IS_NOT_ON_CURVE},
+  #else
+    {"POINT_IS_NOT_ON_CURVE", 16, 107},
+  #endif
+  #ifdef EC_R_RANDOM_NUMBER_GENERATION_FAILED
+    {"RANDOM_NUMBER_GENERATION_FAILED", ERR_LIB_EC, EC_R_RANDOM_NUMBER_GENERATION_FAILED},
+  #else
+    {"RANDOM_NUMBER_GENERATION_FAILED", 16, 158},
+  #endif
+  #ifdef EC_R_SHARED_INFO_ERROR
+    {"SHARED_INFO_ERROR", ERR_LIB_EC, EC_R_SHARED_INFO_ERROR},
+  #else
+    {"SHARED_INFO_ERROR", 16, 150},
+  #endif
+  #ifdef EC_R_SLOT_FULL
+    {"SLOT_FULL", ERR_LIB_EC, EC_R_SLOT_FULL},
+  #else
+    {"SLOT_FULL", 16, 108},
+  #endif
+  #ifdef EC_R_UNDEFINED_GENERATOR
+    {"UNDEFINED_GENERATOR", ERR_LIB_EC, EC_R_UNDEFINED_GENERATOR},
+  #else
+    {"UNDEFINED_GENERATOR", 16, 113},
+  #endif
+  #ifdef EC_R_UNDEFINED_ORDER
+    {"UNDEFINED_ORDER", ERR_LIB_EC, EC_R_UNDEFINED_ORDER},
+  #else
+    {"UNDEFINED_ORDER", 16, 128},
+  #endif
+  #ifdef EC_R_UNKNOWN_COFACTOR
+    {"UNKNOWN_COFACTOR", ERR_LIB_EC, EC_R_UNKNOWN_COFACTOR},
+  #else
+    {"UNKNOWN_COFACTOR", 16, 164},
+  #endif
+  #ifdef EC_R_UNKNOWN_GROUP
+    {"UNKNOWN_GROUP", ERR_LIB_EC, EC_R_UNKNOWN_GROUP},
+  #else
+    {"UNKNOWN_GROUP", 16, 129},
+  #endif
+  #ifdef EC_R_UNKNOWN_ORDER
+    {"UNKNOWN_ORDER", ERR_LIB_EC, EC_R_UNKNOWN_ORDER},
+  #else
+    {"UNKNOWN_ORDER", 16, 114},
+  #endif
+  #ifdef EC_R_UNSUPPORTED_FIELD
+    {"UNSUPPORTED_FIELD", ERR_LIB_EC, EC_R_UNSUPPORTED_FIELD},
+  #else
+    {"UNSUPPORTED_FIELD", 16, 131},
+  #endif
+  #ifdef EC_R_WRONG_CURVE_PARAMETERS
+    {"WRONG_CURVE_PARAMETERS", ERR_LIB_EC, EC_R_WRONG_CURVE_PARAMETERS},
+  #else
+    {"WRONG_CURVE_PARAMETERS", 16, 145},
+  #endif
+  #ifdef EC_R_WRONG_ORDER
+    {"WRONG_ORDER", ERR_LIB_EC, EC_R_WRONG_ORDER},
+  #else
+    {"WRONG_ORDER", 16, 130},
+  #endif
+  #ifdef ENGINE_R_ALREADY_LOADED
+    {"ALREADY_LOADED", ERR_LIB_ENGINE, ENGINE_R_ALREADY_LOADED},
+  #else
+    {"ALREADY_LOADED", 38, 100},
+  #endif
+  #ifdef ENGINE_R_ARGUMENT_IS_NOT_A_NUMBER
+    {"ARGUMENT_IS_NOT_A_NUMBER", ERR_LIB_ENGINE, ENGINE_R_ARGUMENT_IS_NOT_A_NUMBER},
+  #else
+    {"ARGUMENT_IS_NOT_A_NUMBER", 38, 133},
+  #endif
+  #ifdef ENGINE_R_CMD_NOT_EXECUTABLE
+    {"CMD_NOT_EXECUTABLE", ERR_LIB_ENGINE, ENGINE_R_CMD_NOT_EXECUTABLE},
+  #else
+    {"CMD_NOT_EXECUTABLE", 38, 134},
+  #endif
+  #ifdef ENGINE_R_COMMAND_TAKES_INPUT
+    {"COMMAND_TAKES_INPUT", ERR_LIB_ENGINE, ENGINE_R_COMMAND_TAKES_INPUT},
+  #else
+    {"COMMAND_TAKES_INPUT", 38, 135},
+  #endif
+  #ifdef ENGINE_R_COMMAND_TAKES_NO_INPUT
+    {"COMMAND_TAKES_NO_INPUT", ERR_LIB_ENGINE, ENGINE_R_COMMAND_TAKES_NO_INPUT},
+  #else
+    {"COMMAND_TAKES_NO_INPUT", 38, 136},
+  #endif
+  #ifdef ENGINE_R_CONFLICTING_ENGINE_ID
+    {"CONFLICTING_ENGINE_ID", ERR_LIB_ENGINE, ENGINE_R_CONFLICTING_ENGINE_ID},
+  #else
+    {"CONFLICTING_ENGINE_ID", 38, 103},
+  #endif
+  #ifdef ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED
+    {"CTRL_COMMAND_NOT_IMPLEMENTED", ERR_LIB_ENGINE, ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED},
+  #else
+    {"CTRL_COMMAND_NOT_IMPLEMENTED", 38, 119},
+  #endif
+  #ifdef ENGINE_R_DSO_FAILURE
+    {"DSO_FAILURE", ERR_LIB_ENGINE, ENGINE_R_DSO_FAILURE},
+  #else
+    {"DSO_FAILURE", 38, 104},
+  #endif
+  #ifdef ENGINE_R_DSO_NOT_FOUND
+    {"DSO_NOT_FOUND", ERR_LIB_ENGINE, ENGINE_R_DSO_NOT_FOUND},
+  #else
+    {"DSO_NOT_FOUND", 38, 132},
+  #endif
+  #ifdef ENGINE_R_ENGINES_SECTION_ERROR
+    {"ENGINES_SECTION_ERROR", ERR_LIB_ENGINE, ENGINE_R_ENGINES_SECTION_ERROR},
+  #else
+    {"ENGINES_SECTION_ERROR", 38, 148},
+  #endif
+  #ifdef ENGINE_R_ENGINE_CONFIGURATION_ERROR
+    {"ENGINE_CONFIGURATION_ERROR", ERR_LIB_ENGINE, ENGINE_R_ENGINE_CONFIGURATION_ERROR},
+  #else
+    {"ENGINE_CONFIGURATION_ERROR", 38, 102},
+  #endif
+  #ifdef ENGINE_R_ENGINE_IS_NOT_IN_LIST
+    {"ENGINE_IS_NOT_IN_LIST", ERR_LIB_ENGINE, ENGINE_R_ENGINE_IS_NOT_IN_LIST},
+  #else
+    {"ENGINE_IS_NOT_IN_LIST", 38, 105},
+  #endif
+  #ifdef ENGINE_R_ENGINE_SECTION_ERROR
+    {"ENGINE_SECTION_ERROR", ERR_LIB_ENGINE, ENGINE_R_ENGINE_SECTION_ERROR},
+  #else
+    {"ENGINE_SECTION_ERROR", 38, 149},
+  #endif
+  #ifdef ENGINE_R_FAILED_LOADING_PRIVATE_KEY
+    {"FAILED_LOADING_PRIVATE_KEY", ERR_LIB_ENGINE, ENGINE_R_FAILED_LOADING_PRIVATE_KEY},
+  #else
+    {"FAILED_LOADING_PRIVATE_KEY", 38, 128},
+  #endif
+  #ifdef ENGINE_R_FAILED_LOADING_PUBLIC_KEY
+    {"FAILED_LOADING_PUBLIC_KEY", ERR_LIB_ENGINE, ENGINE_R_FAILED_LOADING_PUBLIC_KEY},
+  #else
+    {"FAILED_LOADING_PUBLIC_KEY", 38, 129},
+  #endif
+  #ifdef ENGINE_R_FINISH_FAILED
+    {"FINISH_FAILED", ERR_LIB_ENGINE, ENGINE_R_FINISH_FAILED},
+  #else
+    {"FINISH_FAILED", 38, 106},
+  #endif
+  #ifdef ENGINE_R_ID_OR_NAME_MISSING
+    {"ID_OR_NAME_MISSING", ERR_LIB_ENGINE, ENGINE_R_ID_OR_NAME_MISSING},
+  #else
+    {"ID_OR_NAME_MISSING", 38, 108},
+  #endif
+  #ifdef ENGINE_R_INIT_FAILED
+    {"INIT_FAILED", ERR_LIB_ENGINE, ENGINE_R_INIT_FAILED},
+  #else
+    {"INIT_FAILED", 38, 109},
+  #endif
+  #ifdef ENGINE_R_INTERNAL_LIST_ERROR
+    {"INTERNAL_LIST_ERROR", ERR_LIB_ENGINE, ENGINE_R_INTERNAL_LIST_ERROR},
+  #else
+    {"INTERNAL_LIST_ERROR", 38, 110},
+  #endif
+  #ifdef ENGINE_R_INVALID_ARGUMENT
+    {"INVALID_ARGUMENT", ERR_LIB_ENGINE, ENGINE_R_INVALID_ARGUMENT},
+  #else
+    {"INVALID_ARGUMENT", 38, 143},
+  #endif
+  #ifdef ENGINE_R_INVALID_CMD_NAME
+    {"INVALID_CMD_NAME", ERR_LIB_ENGINE, ENGINE_R_INVALID_CMD_NAME},
+  #else
+    {"INVALID_CMD_NAME", 38, 137},
+  #endif
+  #ifdef ENGINE_R_INVALID_CMD_NUMBER
+    {"INVALID_CMD_NUMBER", ERR_LIB_ENGINE, ENGINE_R_INVALID_CMD_NUMBER},
+  #else
+    {"INVALID_CMD_NUMBER", 38, 138},
+  #endif
+  #ifdef ENGINE_R_INVALID_INIT_VALUE
+    {"INVALID_INIT_VALUE", ERR_LIB_ENGINE, ENGINE_R_INVALID_INIT_VALUE},
+  #else
+    {"INVALID_INIT_VALUE", 38, 151},
+  #endif
+  #ifdef ENGINE_R_INVALID_STRING
+    {"INVALID_STRING", ERR_LIB_ENGINE, ENGINE_R_INVALID_STRING},
+  #else
+    {"INVALID_STRING", 38, 150},
+  #endif
+  #ifdef ENGINE_R_NOT_INITIALISED
+    {"NOT_INITIALISED", ERR_LIB_ENGINE, ENGINE_R_NOT_INITIALISED},
+  #else
+    {"NOT_INITIALISED", 38, 117},
+  #endif
+  #ifdef ENGINE_R_NOT_LOADED
+    {"NOT_LOADED", ERR_LIB_ENGINE, ENGINE_R_NOT_LOADED},
+  #else
+    {"NOT_LOADED", 38, 112},
+  #endif
+  #ifdef ENGINE_R_NO_CONTROL_FUNCTION
+    {"NO_CONTROL_FUNCTION", ERR_LIB_ENGINE, ENGINE_R_NO_CONTROL_FUNCTION},
+  #else
+    {"NO_CONTROL_FUNCTION", 38, 120},
+  #endif
+  #ifdef ENGINE_R_NO_INDEX
+    {"NO_INDEX", ERR_LIB_ENGINE, ENGINE_R_NO_INDEX},
+  #else
+    {"NO_INDEX", 38, 144},
+  #endif
+  #ifdef ENGINE_R_NO_LOAD_FUNCTION
+    {"NO_LOAD_FUNCTION", ERR_LIB_ENGINE, ENGINE_R_NO_LOAD_FUNCTION},
+  #else
+    {"NO_LOAD_FUNCTION", 38, 125},
+  #endif
+  #ifdef ENGINE_R_NO_REFERENCE
+    {"NO_REFERENCE", ERR_LIB_ENGINE, ENGINE_R_NO_REFERENCE},
+  #else
+    {"NO_REFERENCE", 38, 130},
+  #endif
+  #ifdef ENGINE_R_NO_SUCH_ENGINE
+    {"NO_SUCH_ENGINE", ERR_LIB_ENGINE, ENGINE_R_NO_SUCH_ENGINE},
+  #else
+    {"NO_SUCH_ENGINE", 38, 116},
+  #endif
+  #ifdef ENGINE_R_UNIMPLEMENTED_CIPHER
+    {"UNIMPLEMENTED_CIPHER", ERR_LIB_ENGINE, ENGINE_R_UNIMPLEMENTED_CIPHER},
+  #else
+    {"UNIMPLEMENTED_CIPHER", 38, 146},
+  #endif
+  #ifdef ENGINE_R_UNIMPLEMENTED_DIGEST
+    {"UNIMPLEMENTED_DIGEST", ERR_LIB_ENGINE, ENGINE_R_UNIMPLEMENTED_DIGEST},
+  #else
+    {"UNIMPLEMENTED_DIGEST", 38, 147},
+  #endif
+  #ifdef ENGINE_R_UNIMPLEMENTED_PUBLIC_KEY_METHOD
+    {"UNIMPLEMENTED_PUBLIC_KEY_METHOD", ERR_LIB_ENGINE, ENGINE_R_UNIMPLEMENTED_PUBLIC_KEY_METHOD},
+  #else
+    {"UNIMPLEMENTED_PUBLIC_KEY_METHOD", 38, 101},
+  #endif
+  #ifdef ENGINE_R_VERSION_INCOMPATIBILITY
+    {"VERSION_INCOMPATIBILITY", ERR_LIB_ENGINE, ENGINE_R_VERSION_INCOMPATIBILITY},
+  #else
+    {"VERSION_INCOMPATIBILITY", 38, 145},
+  #endif
+  #ifdef EVP_R_AES_KEY_SETUP_FAILED
+    {"AES_KEY_SETUP_FAILED", ERR_LIB_EVP, EVP_R_AES_KEY_SETUP_FAILED},
+  #else
+    {"AES_KEY_SETUP_FAILED", 6, 143},
+  #endif
+  #ifdef EVP_R_ARIA_KEY_SETUP_FAILED
+    {"ARIA_KEY_SETUP_FAILED", ERR_LIB_EVP, EVP_R_ARIA_KEY_SETUP_FAILED},
+  #else
+    {"ARIA_KEY_SETUP_FAILED", 6, 176},
+  #endif
+  #ifdef EVP_R_BAD_DECRYPT
+    {"BAD_DECRYPT", ERR_LIB_EVP, EVP_R_BAD_DECRYPT},
+  #else
+    {"BAD_DECRYPT", 6, 100},
+  #endif
+  #ifdef EVP_R_BAD_KEY_LENGTH
+    {"BAD_KEY_LENGTH", ERR_LIB_EVP, EVP_R_BAD_KEY_LENGTH},
+  #else
+    {"BAD_KEY_LENGTH", 6, 195},
+  #endif
+  #ifdef EVP_R_BUFFER_TOO_SMALL
+    {"BUFFER_TOO_SMALL", ERR_LIB_EVP, EVP_R_BUFFER_TOO_SMALL},
+  #else
+    {"BUFFER_TOO_SMALL", 6, 155},
+  #endif
+  #ifdef EVP_R_CAMELLIA_KEY_SETUP_FAILED
+    {"CAMELLIA_KEY_SETUP_FAILED", ERR_LIB_EVP, EVP_R_CAMELLIA_KEY_SETUP_FAILED},
+  #else
+    {"CAMELLIA_KEY_SETUP_FAILED", 6, 157},
+  #endif
+  #ifdef EVP_R_CIPHER_PARAMETER_ERROR
+    {"CIPHER_PARAMETER_ERROR", ERR_LIB_EVP, EVP_R_CIPHER_PARAMETER_ERROR},
+  #else
+    {"CIPHER_PARAMETER_ERROR", 6, 122},
+  #endif
+  #ifdef EVP_R_COMMAND_NOT_SUPPORTED
+    {"COMMAND_NOT_SUPPORTED", ERR_LIB_EVP, EVP_R_COMMAND_NOT_SUPPORTED},
+  #else
+    {"COMMAND_NOT_SUPPORTED", 6, 147},
+  #endif
+  #ifdef EVP_R_COPY_ERROR
+    {"COPY_ERROR", ERR_LIB_EVP, EVP_R_COPY_ERROR},
+  #else
+    {"COPY_ERROR", 6, 173},
+  #endif
+  #ifdef EVP_R_CTRL_NOT_IMPLEMENTED
+    {"CTRL_NOT_IMPLEMENTED", ERR_LIB_EVP, EVP_R_CTRL_NOT_IMPLEMENTED},
+  #else
+    {"CTRL_NOT_IMPLEMENTED", 6, 132},
+  #endif
+  #ifdef EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED
+    {"CTRL_OPERATION_NOT_IMPLEMENTED", ERR_LIB_EVP, EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED},
+  #else
+    {"CTRL_OPERATION_NOT_IMPLEMENTED", 6, 133},
+  #endif
+  #ifdef EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH
+    {"DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH", ERR_LIB_EVP, EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH},
+  #else
+    {"DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH", 6, 138},
+  #endif
+  #ifdef EVP_R_DECODE_ERROR
+    {"DECODE_ERROR", ERR_LIB_EVP, EVP_R_DECODE_ERROR},
+  #else
+    {"DECODE_ERROR", 6, 114},
+  #endif
+  #ifdef EVP_R_DIFFERENT_KEY_TYPES
+    {"DIFFERENT_KEY_TYPES", ERR_LIB_EVP, EVP_R_DIFFERENT_KEY_TYPES},
+  #else
+    {"DIFFERENT_KEY_TYPES", 6, 101},
+  #endif
+  #ifdef EVP_R_DIFFERENT_PARAMETERS
+    {"DIFFERENT_PARAMETERS", ERR_LIB_EVP, EVP_R_DIFFERENT_PARAMETERS},
+  #else
+    {"DIFFERENT_PARAMETERS", 6, 153},
+  #endif
+  #ifdef EVP_R_ERROR_LOADING_SECTION
+    {"ERROR_LOADING_SECTION", ERR_LIB_EVP, EVP_R_ERROR_LOADING_SECTION},
+  #else
+    {"ERROR_LOADING_SECTION", 6, 165},
+  #endif
+  #ifdef EVP_R_ERROR_SETTING_FIPS_MODE
+    {"ERROR_SETTING_FIPS_MODE", ERR_LIB_EVP, EVP_R_ERROR_SETTING_FIPS_MODE},
+  #else
+    {"ERROR_SETTING_FIPS_MODE", 6, 166},
+  #endif
+  #ifdef EVP_R_EXPECTING_AN_HMAC_KEY
+    {"EXPECTING_AN_HMAC_KEY", ERR_LIB_EVP, EVP_R_EXPECTING_AN_HMAC_KEY},
+  #else
+    {"EXPECTING_AN_HMAC_KEY", 6, 174},
+  #endif
+  #ifdef EVP_R_EXPECTING_AN_RSA_KEY
+    {"EXPECTING_AN_RSA_KEY", ERR_LIB_EVP, EVP_R_EXPECTING_AN_RSA_KEY},
+  #else
+    {"EXPECTING_AN_RSA_KEY", 6, 127},
+  #endif
+  #ifdef EVP_R_EXPECTING_A_DH_KEY
+    {"EXPECTING_A_DH_KEY", ERR_LIB_EVP, EVP_R_EXPECTING_A_DH_KEY},
+  #else
+    {"EXPECTING_A_DH_KEY", 6, 128},
+  #endif
+  #ifdef EVP_R_EXPECTING_A_DSA_KEY
+    {"EXPECTING_A_DSA_KEY", ERR_LIB_EVP, EVP_R_EXPECTING_A_DSA_KEY},
+  #else
+    {"EXPECTING_A_DSA_KEY", 6, 129},
+  #endif
+  #ifdef EVP_R_EXPECTING_A_EC_KEY
+    {"EXPECTING_A_EC_KEY", ERR_LIB_EVP, EVP_R_EXPECTING_A_EC_KEY},
+  #else
+    {"EXPECTING_A_EC_KEY", 6, 142},
+  #endif
+  #ifdef EVP_R_EXPECTING_A_POLY1305_KEY
+    {"EXPECTING_A_POLY1305_KEY", ERR_LIB_EVP, EVP_R_EXPECTING_A_POLY1305_KEY},
+  #else
+    {"EXPECTING_A_POLY1305_KEY", 6, 164},
+  #endif
+  #ifdef EVP_R_EXPECTING_A_SIPHASH_KEY
+    {"EXPECTING_A_SIPHASH_KEY", ERR_LIB_EVP, EVP_R_EXPECTING_A_SIPHASH_KEY},
+  #else
+    {"EXPECTING_A_SIPHASH_KEY", 6, 175},
+  #endif
+  #ifdef EVP_R_FIPS_MODE_NOT_SUPPORTED
+    {"FIPS_MODE_NOT_SUPPORTED", ERR_LIB_EVP, EVP_R_FIPS_MODE_NOT_SUPPORTED},
+  #else
+    {"FIPS_MODE_NOT_SUPPORTED", 6, 167},
+  #endif
+  #ifdef EVP_R_GET_RAW_KEY_FAILED
+    {"GET_RAW_KEY_FAILED", ERR_LIB_EVP, EVP_R_GET_RAW_KEY_FAILED},
+  #else
+    {"GET_RAW_KEY_FAILED", 6, 182},
+  #endif
+  #ifdef EVP_R_ILLEGAL_SCRYPT_PARAMETERS
+    {"ILLEGAL_SCRYPT_PARAMETERS", ERR_LIB_EVP, EVP_R_ILLEGAL_SCRYPT_PARAMETERS},
+  #else
+    {"ILLEGAL_SCRYPT_PARAMETERS", 6, 171},
+  #endif
+  #ifdef EVP_R_INITIALIZATION_ERROR
+    {"INITIALIZATION_ERROR", ERR_LIB_EVP, EVP_R_INITIALIZATION_ERROR},
+  #else
+    {"INITIALIZATION_ERROR", 6, 134},
+  #endif
+  #ifdef EVP_R_INPUT_NOT_INITIALIZED
+    {"INPUT_NOT_INITIALIZED", ERR_LIB_EVP, EVP_R_INPUT_NOT_INITIALIZED},
+  #else
+    {"INPUT_NOT_INITIALIZED", 6, 111},
+  #endif
+  #ifdef EVP_R_INVALID_DIGEST
+    {"INVALID_DIGEST", ERR_LIB_EVP, EVP_R_INVALID_DIGEST},
+  #else
+    {"INVALID_DIGEST", 6, 152},
+  #endif
+  #ifdef EVP_R_INVALID_FIPS_MODE
+    {"INVALID_FIPS_MODE", ERR_LIB_EVP, EVP_R_INVALID_FIPS_MODE},
+  #else
+    {"INVALID_FIPS_MODE", 6, 168},
+  #endif
+  #ifdef EVP_R_INVALID_IV_LENGTH
+    {"INVALID_IV_LENGTH", ERR_LIB_EVP, EVP_R_INVALID_IV_LENGTH},
+  #else
+    {"INVALID_IV_LENGTH", 6, 194},
+  #endif
+  #ifdef EVP_R_INVALID_KEY
+    {"INVALID_KEY", ERR_LIB_EVP, EVP_R_INVALID_KEY},
+  #else
+    {"INVALID_KEY", 6, 163},
+  #endif
+  #ifdef EVP_R_INVALID_KEY_LENGTH
+    {"INVALID_KEY_LENGTH", ERR_LIB_EVP, EVP_R_INVALID_KEY_LENGTH},
+  #else
+    {"INVALID_KEY_LENGTH", 6, 130},
+  #endif
+  #ifdef EVP_R_INVALID_OPERATION
+    {"INVALID_OPERATION", ERR_LIB_EVP, EVP_R_INVALID_OPERATION},
+  #else
+    {"INVALID_OPERATION", 6, 148},
+  #endif
+  #ifdef EVP_R_KEYGEN_FAILURE
+    {"KEYGEN_FAILURE", ERR_LIB_EVP, EVP_R_KEYGEN_FAILURE},
+  #else
+    {"KEYGEN_FAILURE", 6, 120},
+  #endif
+  #ifdef EVP_R_KEY_SETUP_FAILED
+    {"KEY_SETUP_FAILED", ERR_LIB_EVP, EVP_R_KEY_SETUP_FAILED},
+  #else
+    {"KEY_SETUP_FAILED", 6, 180},
+  #endif
+  #ifdef EVP_R_MEMORY_LIMIT_EXCEEDED
+    {"MEMORY_LIMIT_EXCEEDED", ERR_LIB_EVP, EVP_R_MEMORY_LIMIT_EXCEEDED},
+  #else
+    {"MEMORY_LIMIT_EXCEEDED", 6, 172},
+  #endif
+  #ifdef EVP_R_MESSAGE_DIGEST_IS_NULL
+    {"MESSAGE_DIGEST_IS_NULL", ERR_LIB_EVP, EVP_R_MESSAGE_DIGEST_IS_NULL},
+  #else
+    {"MESSAGE_DIGEST_IS_NULL", 6, 159},
+  #endif
+  #ifdef EVP_R_METHOD_NOT_SUPPORTED
+    {"METHOD_NOT_SUPPORTED", ERR_LIB_EVP, EVP_R_METHOD_NOT_SUPPORTED},
+  #else
+    {"METHOD_NOT_SUPPORTED", 6, 144},
+  #endif
+  #ifdef EVP_R_MISSING_PARAMETERS
+    {"MISSING_PARAMETERS", ERR_LIB_EVP, EVP_R_MISSING_PARAMETERS},
+  #else
+    {"MISSING_PARAMETERS", 6, 103},
+  #endif
+  #ifdef EVP_R_NOT_XOF_OR_INVALID_LENGTH
+    {"NOT_XOF_OR_INVALID_LENGTH", ERR_LIB_EVP, EVP_R_NOT_XOF_OR_INVALID_LENGTH},
+  #else
+    {"NOT_XOF_OR_INVALID_LENGTH", 6, 178},
+  #endif
+  #ifdef EVP_R_NO_CIPHER_SET
+    {"NO_CIPHER_SET", ERR_LIB_EVP, EVP_R_NO_CIPHER_SET},
+  #else
+    {"NO_CIPHER_SET", 6, 131},
+  #endif
+  #ifdef EVP_R_NO_DEFAULT_DIGEST
+    {"NO_DEFAULT_DIGEST", ERR_LIB_EVP, EVP_R_NO_DEFAULT_DIGEST},
+  #else
+    {"NO_DEFAULT_DIGEST", 6, 158},
+  #endif
+  #ifdef EVP_R_NO_DIGEST_SET
+    {"NO_DIGEST_SET", ERR_LIB_EVP, EVP_R_NO_DIGEST_SET},
+  #else
+    {"NO_DIGEST_SET", 6, 139},
+  #endif
+  #ifdef EVP_R_NO_KEY_SET
+    {"NO_KEY_SET", ERR_LIB_EVP, EVP_R_NO_KEY_SET},
+  #else
+    {"NO_KEY_SET", 6, 154},
+  #endif
+  #ifdef EVP_R_NO_OPERATION_SET
+    {"NO_OPERATION_SET", ERR_LIB_EVP, EVP_R_NO_OPERATION_SET},
+  #else
+    {"NO_OPERATION_SET", 6, 149},
+  #endif
+  #ifdef EVP_R_ONLY_ONESHOT_SUPPORTED
+    {"ONLY_ONESHOT_SUPPORTED", ERR_LIB_EVP, EVP_R_ONLY_ONESHOT_SUPPORTED},
+  #else
+    {"ONLY_ONESHOT_SUPPORTED", 6, 177},
+  #endif
+  #ifdef EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE
+    {"OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE", ERR_LIB_EVP, EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE},
+  #else
+    {"OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE", 6, 150},
+  #endif
+  #ifdef EVP_R_OPERATON_NOT_INITIALIZED
+    {"OPERATON_NOT_INITIALIZED", ERR_LIB_EVP, EVP_R_OPERATON_NOT_INITIALIZED},
+  #else
+    {"OPERATON_NOT_INITIALIZED", 6, 151},
+  #endif
+  #ifdef EVP_R_OUTPUT_WOULD_OVERFLOW
+    {"OUTPUT_WOULD_OVERFLOW", ERR_LIB_EVP, EVP_R_OUTPUT_WOULD_OVERFLOW},
+  #else
+    {"OUTPUT_WOULD_OVERFLOW", 6, 184},
+  #endif
+  #ifdef EVP_R_PARTIALLY_OVERLAPPING
+    {"PARTIALLY_OVERLAPPING", ERR_LIB_EVP, EVP_R_PARTIALLY_OVERLAPPING},
+  #else
+    {"PARTIALLY_OVERLAPPING", 6, 162},
+  #endif
+  #ifdef EVP_R_PBKDF2_ERROR
+    {"PBKDF2_ERROR", ERR_LIB_EVP, EVP_R_PBKDF2_ERROR},
+  #else
+    {"PBKDF2_ERROR", 6, 181},
+  #endif
+  #ifdef EVP_R_PKEY_APPLICATION_ASN1_METHOD_ALREADY_REGISTERED
+    {"PKEY_APPLICATION_ASN1_METHOD_ALREADY_REGISTERED", ERR_LIB_EVP, EVP_R_PKEY_APPLICATION_ASN1_METHOD_ALREADY_REGISTERED},
+  #else
+    {"PKEY_APPLICATION_ASN1_METHOD_ALREADY_REGISTERED", 6, 179},
+  #endif
+  #ifdef EVP_R_PRIVATE_KEY_DECODE_ERROR
+    {"PRIVATE_KEY_DECODE_ERROR", ERR_LIB_EVP, EVP_R_PRIVATE_KEY_DECODE_ERROR},
+  #else
+    {"PRIVATE_KEY_DECODE_ERROR", 6, 145},
+  #endif
+  #ifdef EVP_R_PRIVATE_KEY_ENCODE_ERROR
+    {"PRIVATE_KEY_ENCODE_ERROR", ERR_LIB_EVP, EVP_R_PRIVATE_KEY_ENCODE_ERROR},
+  #else
+    {"PRIVATE_KEY_ENCODE_ERROR", 6, 146},
+  #endif
+  #ifdef EVP_R_PUBLIC_KEY_NOT_RSA
+    {"PUBLIC_KEY_NOT_RSA", ERR_LIB_EVP, EVP_R_PUBLIC_KEY_NOT_RSA},
+  #else
+    {"PUBLIC_KEY_NOT_RSA", 6, 106},
+  #endif
+  #ifdef EVP_R_UNKNOWN_CIPHER
+    {"UNKNOWN_CIPHER", ERR_LIB_EVP, EVP_R_UNKNOWN_CIPHER},
+  #else
+    {"UNKNOWN_CIPHER", 6, 160},
+  #endif
+  #ifdef EVP_R_UNKNOWN_DIGEST
+    {"UNKNOWN_DIGEST", ERR_LIB_EVP, EVP_R_UNKNOWN_DIGEST},
+  #else
+    {"UNKNOWN_DIGEST", 6, 161},
+  #endif
+  #ifdef EVP_R_UNKNOWN_OPTION
+    {"UNKNOWN_OPTION", ERR_LIB_EVP, EVP_R_UNKNOWN_OPTION},
+  #else
+    {"UNKNOWN_OPTION", 6, 169},
+  #endif
+  #ifdef EVP_R_UNKNOWN_PBE_ALGORITHM
+    {"UNKNOWN_PBE_ALGORITHM", ERR_LIB_EVP, EVP_R_UNKNOWN_PBE_ALGORITHM},
+  #else
+    {"UNKNOWN_PBE_ALGORITHM", 6, 121},
+  #endif
+  #ifdef EVP_R_UNSUPPORTED_ALGORITHM
+    {"UNSUPPORTED_ALGORITHM", ERR_LIB_EVP, EVP_R_UNSUPPORTED_ALGORITHM},
+  #else
+    {"UNSUPPORTED_ALGORITHM", 6, 156},
+  #endif
+  #ifdef EVP_R_UNSUPPORTED_CIPHER
+    {"UNSUPPORTED_CIPHER", ERR_LIB_EVP, EVP_R_UNSUPPORTED_CIPHER},
+  #else
+    {"UNSUPPORTED_CIPHER", 6, 107},
+  #endif
+  #ifdef EVP_R_UNSUPPORTED_KEYLENGTH
+    {"UNSUPPORTED_KEYLENGTH", ERR_LIB_EVP, EVP_R_UNSUPPORTED_KEYLENGTH},
+  #else
+    {"UNSUPPORTED_KEYLENGTH", 6, 123},
+  #endif
+  #ifdef EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION
+    {"UNSUPPORTED_KEY_DERIVATION_FUNCTION", ERR_LIB_EVP, EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION},
+  #else
+    {"UNSUPPORTED_KEY_DERIVATION_FUNCTION", 6, 124},
+  #endif
+  #ifdef EVP_R_UNSUPPORTED_KEY_SIZE
+    {"UNSUPPORTED_KEY_SIZE", ERR_LIB_EVP, EVP_R_UNSUPPORTED_KEY_SIZE},
+  #else
+    {"UNSUPPORTED_KEY_SIZE", 6, 108},
+  #endif
+  #ifdef EVP_R_UNSUPPORTED_NUMBER_OF_ROUNDS
+    {"UNSUPPORTED_NUMBER_OF_ROUNDS", ERR_LIB_EVP, EVP_R_UNSUPPORTED_NUMBER_OF_ROUNDS},
+  #else
+    {"UNSUPPORTED_NUMBER_OF_ROUNDS", 6, 135},
+  #endif
+  #ifdef EVP_R_UNSUPPORTED_PRF
+    {"UNSUPPORTED_PRF", ERR_LIB_EVP, EVP_R_UNSUPPORTED_PRF},
+  #else
+    {"UNSUPPORTED_PRF", 6, 125},
+  #endif
+  #ifdef EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM
+    {"UNSUPPORTED_PRIVATE_KEY_ALGORITHM", ERR_LIB_EVP, EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM},
+  #else
+    {"UNSUPPORTED_PRIVATE_KEY_ALGORITHM", 6, 118},
+  #endif
+  #ifdef EVP_R_UNSUPPORTED_SALT_TYPE
+    {"UNSUPPORTED_SALT_TYPE", ERR_LIB_EVP, EVP_R_UNSUPPORTED_SALT_TYPE},
+  #else
+    {"UNSUPPORTED_SALT_TYPE", 6, 126},
+  #endif
+  #ifdef EVP_R_WRAP_MODE_NOT_ALLOWED
+    {"WRAP_MODE_NOT_ALLOWED", ERR_LIB_EVP, EVP_R_WRAP_MODE_NOT_ALLOWED},
+  #else
+    {"WRAP_MODE_NOT_ALLOWED", 6, 170},
+  #endif
+  #ifdef EVP_R_WRONG_FINAL_BLOCK_LENGTH
+    {"WRONG_FINAL_BLOCK_LENGTH", ERR_LIB_EVP, EVP_R_WRONG_FINAL_BLOCK_LENGTH},
+  #else
+    {"WRONG_FINAL_BLOCK_LENGTH", 6, 109},
+  #endif
+  #ifdef EVP_R_XTS_DUPLICATED_KEYS
+    {"XTS_DUPLICATED_KEYS", ERR_LIB_EVP, EVP_R_XTS_DUPLICATED_KEYS},
+  #else
+    {"XTS_DUPLICATED_KEYS", 6, 183},
+  #endif
+  #ifdef KDF_R_INVALID_DIGEST
+    {"INVALID_DIGEST", ERR_LIB_KDF, KDF_R_INVALID_DIGEST},
+  #else
+    {"INVALID_DIGEST", 52, 100},
+  #endif
+  #ifdef KDF_R_MISSING_ITERATION_COUNT
+    {"MISSING_ITERATION_COUNT", ERR_LIB_KDF, KDF_R_MISSING_ITERATION_COUNT},
+  #else
+    {"MISSING_ITERATION_COUNT", 52, 109},
+  #endif
+  #ifdef KDF_R_MISSING_KEY
+    {"MISSING_KEY", ERR_LIB_KDF, KDF_R_MISSING_KEY},
+  #else
+    {"MISSING_KEY", 52, 104},
+  #endif
+  #ifdef KDF_R_MISSING_MESSAGE_DIGEST
+    {"MISSING_MESSAGE_DIGEST", ERR_LIB_KDF, KDF_R_MISSING_MESSAGE_DIGEST},
+  #else
+    {"MISSING_MESSAGE_DIGEST", 52, 105},
+  #endif
+  #ifdef KDF_R_MISSING_PARAMETER
+    {"MISSING_PARAMETER", ERR_LIB_KDF, KDF_R_MISSING_PARAMETER},
+  #else
+    {"MISSING_PARAMETER", 52, 101},
+  #endif
+  #ifdef KDF_R_MISSING_PASS
+    {"MISSING_PASS", ERR_LIB_KDF, KDF_R_MISSING_PASS},
+  #else
+    {"MISSING_PASS", 52, 110},
+  #endif
+  #ifdef KDF_R_MISSING_SALT
+    {"MISSING_SALT", ERR_LIB_KDF, KDF_R_MISSING_SALT},
+  #else
+    {"MISSING_SALT", 52, 111},
+  #endif
+  #ifdef KDF_R_MISSING_SECRET
+    {"MISSING_SECRET", ERR_LIB_KDF, KDF_R_MISSING_SECRET},
+  #else
+    {"MISSING_SECRET", 52, 107},
+  #endif
+  #ifdef KDF_R_MISSING_SEED
+    {"MISSING_SEED", ERR_LIB_KDF, KDF_R_MISSING_SEED},
+  #else
+    {"MISSING_SEED", 52, 106},
+  #endif
+  #ifdef KDF_R_UNKNOWN_PARAMETER_TYPE
+    {"UNKNOWN_PARAMETER_TYPE", ERR_LIB_KDF, KDF_R_UNKNOWN_PARAMETER_TYPE},
+  #else
+    {"UNKNOWN_PARAMETER_TYPE", 52, 103},
+  #endif
+  #ifdef KDF_R_VALUE_ERROR
+    {"VALUE_ERROR", ERR_LIB_KDF, KDF_R_VALUE_ERROR},
+  #else
+    {"VALUE_ERROR", 52, 108},
+  #endif
+  #ifdef KDF_R_VALUE_MISSING
+    {"VALUE_MISSING", ERR_LIB_KDF, KDF_R_VALUE_MISSING},
+  #else
+    {"VALUE_MISSING", 52, 102},
+  #endif
+  #ifdef OBJ_R_OID_EXISTS
+    {"OID_EXISTS", ERR_LIB_OBJ, OBJ_R_OID_EXISTS},
+  #else
+    {"OID_EXISTS", 8, 102},
+  #endif
+  #ifdef OBJ_R_UNKNOWN_NID
+    {"UNKNOWN_NID", ERR_LIB_OBJ, OBJ_R_UNKNOWN_NID},
+  #else
+    {"UNKNOWN_NID", 8, 101},
+  #endif
+  #ifdef OCSP_R_CERTIFICATE_VERIFY_ERROR
+    {"CERTIFICATE_VERIFY_ERROR", ERR_LIB_OCSP, OCSP_R_CERTIFICATE_VERIFY_ERROR},
+  #else
+    {"CERTIFICATE_VERIFY_ERROR", 39, 101},
+  #endif
+  #ifdef OCSP_R_DIGEST_ERR
+    {"DIGEST_ERR", ERR_LIB_OCSP, OCSP_R_DIGEST_ERR},
+  #else
+    {"DIGEST_ERR", 39, 102},
+  #endif
+  #ifdef OCSP_R_ERROR_IN_NEXTUPDATE_FIELD
+    {"ERROR_IN_NEXTUPDATE_FIELD", ERR_LIB_OCSP, OCSP_R_ERROR_IN_NEXTUPDATE_FIELD},
+  #else
+    {"ERROR_IN_NEXTUPDATE_FIELD", 39, 122},
+  #endif
+  #ifdef OCSP_R_ERROR_IN_THISUPDATE_FIELD
+    {"ERROR_IN_THISUPDATE_FIELD", ERR_LIB_OCSP, OCSP_R_ERROR_IN_THISUPDATE_FIELD},
+  #else
+    {"ERROR_IN_THISUPDATE_FIELD", 39, 123},
+  #endif
+  #ifdef OCSP_R_ERROR_PARSING_URL
+    {"ERROR_PARSING_URL", ERR_LIB_OCSP, OCSP_R_ERROR_PARSING_URL},
+  #else
+    {"ERROR_PARSING_URL", 39, 121},
+  #endif
+  #ifdef OCSP_R_MISSING_OCSPSIGNING_USAGE
+    {"MISSING_OCSPSIGNING_USAGE", ERR_LIB_OCSP, OCSP_R_MISSING_OCSPSIGNING_USAGE},
+  #else
+    {"MISSING_OCSPSIGNING_USAGE", 39, 103},
+  #endif
+  #ifdef OCSP_R_NEXTUPDATE_BEFORE_THISUPDATE
+    {"NEXTUPDATE_BEFORE_THISUPDATE", ERR_LIB_OCSP, OCSP_R_NEXTUPDATE_BEFORE_THISUPDATE},
+  #else
+    {"NEXTUPDATE_BEFORE_THISUPDATE", 39, 124},
+  #endif
+  #ifdef OCSP_R_NOT_BASIC_RESPONSE
+    {"NOT_BASIC_RESPONSE", ERR_LIB_OCSP, OCSP_R_NOT_BASIC_RESPONSE},
+  #else
+    {"NOT_BASIC_RESPONSE", 39, 104},
+  #endif
+  #ifdef OCSP_R_NO_CERTIFICATES_IN_CHAIN
+    {"NO_CERTIFICATES_IN_CHAIN", ERR_LIB_OCSP, OCSP_R_NO_CERTIFICATES_IN_CHAIN},
+  #else
+    {"NO_CERTIFICATES_IN_CHAIN", 39, 105},
+  #endif
+  #ifdef OCSP_R_NO_RESPONSE_DATA
+    {"NO_RESPONSE_DATA", ERR_LIB_OCSP, OCSP_R_NO_RESPONSE_DATA},
+  #else
+    {"NO_RESPONSE_DATA", 39, 108},
+  #endif
+  #ifdef OCSP_R_NO_REVOKED_TIME
+    {"NO_REVOKED_TIME", ERR_LIB_OCSP, OCSP_R_NO_REVOKED_TIME},
+  #else
+    {"NO_REVOKED_TIME", 39, 109},
+  #endif
+  #ifdef OCSP_R_NO_SIGNER_KEY
+    {"NO_SIGNER_KEY", ERR_LIB_OCSP, OCSP_R_NO_SIGNER_KEY},
+  #else
+    {"NO_SIGNER_KEY", 39, 130},
+  #endif
+  #ifdef OCSP_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE
+    {"PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE", ERR_LIB_OCSP, OCSP_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE},
+  #else
+    {"PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE", 39, 110},
+  #endif
+  #ifdef OCSP_R_REQUEST_NOT_SIGNED
+    {"REQUEST_NOT_SIGNED", ERR_LIB_OCSP, OCSP_R_REQUEST_NOT_SIGNED},
+  #else
+    {"REQUEST_NOT_SIGNED", 39, 128},
+  #endif
+  #ifdef OCSP_R_RESPONSE_CONTAINS_NO_REVOCATION_DATA
+    {"RESPONSE_CONTAINS_NO_REVOCATION_DATA", ERR_LIB_OCSP, OCSP_R_RESPONSE_CONTAINS_NO_REVOCATION_DATA},
+  #else
+    {"RESPONSE_CONTAINS_NO_REVOCATION_DATA", 39, 111},
+  #endif
+  #ifdef OCSP_R_ROOT_CA_NOT_TRUSTED
+    {"ROOT_CA_NOT_TRUSTED", ERR_LIB_OCSP, OCSP_R_ROOT_CA_NOT_TRUSTED},
+  #else
+    {"ROOT_CA_NOT_TRUSTED", 39, 112},
+  #endif
+  #ifdef OCSP_R_SERVER_RESPONSE_ERROR
+    {"SERVER_RESPONSE_ERROR", ERR_LIB_OCSP, OCSP_R_SERVER_RESPONSE_ERROR},
+  #else
+    {"SERVER_RESPONSE_ERROR", 39, 114},
+  #endif
+  #ifdef OCSP_R_SERVER_RESPONSE_PARSE_ERROR
+    {"SERVER_RESPONSE_PARSE_ERROR", ERR_LIB_OCSP, OCSP_R_SERVER_RESPONSE_PARSE_ERROR},
+  #else
+    {"SERVER_RESPONSE_PARSE_ERROR", 39, 115},
+  #endif
+  #ifdef OCSP_R_SIGNATURE_FAILURE
+    {"SIGNATURE_FAILURE", ERR_LIB_OCSP, OCSP_R_SIGNATURE_FAILURE},
+  #else
+    {"SIGNATURE_FAILURE", 39, 117},
+  #endif
+  #ifdef OCSP_R_SIGNER_CERTIFICATE_NOT_FOUND
+    {"SIGNER_CERTIFICATE_NOT_FOUND", ERR_LIB_OCSP, OCSP_R_SIGNER_CERTIFICATE_NOT_FOUND},
+  #else
+    {"SIGNER_CERTIFICATE_NOT_FOUND", 39, 118},
+  #endif
+  #ifdef OCSP_R_STATUS_EXPIRED
+    {"STATUS_EXPIRED", ERR_LIB_OCSP, OCSP_R_STATUS_EXPIRED},
+  #else
+    {"STATUS_EXPIRED", 39, 125},
+  #endif
+  #ifdef OCSP_R_STATUS_NOT_YET_VALID
+    {"STATUS_NOT_YET_VALID", ERR_LIB_OCSP, OCSP_R_STATUS_NOT_YET_VALID},
+  #else
+    {"STATUS_NOT_YET_VALID", 39, 126},
+  #endif
+  #ifdef OCSP_R_STATUS_TOO_OLD
+    {"STATUS_TOO_OLD", ERR_LIB_OCSP, OCSP_R_STATUS_TOO_OLD},
+  #else
+    {"STATUS_TOO_OLD", 39, 127},
+  #endif
+  #ifdef OCSP_R_UNKNOWN_MESSAGE_DIGEST
+    {"UNKNOWN_MESSAGE_DIGEST", ERR_LIB_OCSP, OCSP_R_UNKNOWN_MESSAGE_DIGEST},
+  #else
+    {"UNKNOWN_MESSAGE_DIGEST", 39, 119},
+  #endif
+  #ifdef OCSP_R_UNKNOWN_NID
+    {"UNKNOWN_NID", ERR_LIB_OCSP, OCSP_R_UNKNOWN_NID},
+  #else
+    {"UNKNOWN_NID", 39, 120},
+  #endif
+  #ifdef OCSP_R_UNSUPPORTED_REQUESTORNAME_TYPE
+    {"UNSUPPORTED_REQUESTORNAME_TYPE", ERR_LIB_OCSP, OCSP_R_UNSUPPORTED_REQUESTORNAME_TYPE},
+  #else
+    {"UNSUPPORTED_REQUESTORNAME_TYPE", 39, 129},
+  #endif
+  #ifdef OSSL_STORE_R_AMBIGUOUS_CONTENT_TYPE
+    {"AMBIGUOUS_CONTENT_TYPE", ERR_LIB_OSSL_STORE, OSSL_STORE_R_AMBIGUOUS_CONTENT_TYPE},
+  #else
+    {"AMBIGUOUS_CONTENT_TYPE", 44, 107},
+  #endif
+  #ifdef OSSL_STORE_R_BAD_PASSWORD_READ
+    {"BAD_PASSWORD_READ", ERR_LIB_OSSL_STORE, OSSL_STORE_R_BAD_PASSWORD_READ},
+  #else
+    {"BAD_PASSWORD_READ", 44, 115},
+  #endif
+  #ifdef OSSL_STORE_R_ERROR_VERIFYING_PKCS12_MAC
+    {"ERROR_VERIFYING_PKCS12_MAC", ERR_LIB_OSSL_STORE, OSSL_STORE_R_ERROR_VERIFYING_PKCS12_MAC},
+  #else
+    {"ERROR_VERIFYING_PKCS12_MAC", 44, 113},
+  #endif
+  #ifdef OSSL_STORE_R_FINGERPRINT_SIZE_DOES_NOT_MATCH_DIGEST
+    {"FINGERPRINT_SIZE_DOES_NOT_MATCH_DIGEST", ERR_LIB_OSSL_STORE, OSSL_STORE_R_FINGERPRINT_SIZE_DOES_NOT_MATCH_DIGEST},
+  #else
+    {"FINGERPRINT_SIZE_DOES_NOT_MATCH_DIGEST", 44, 121},
+  #endif
+  #ifdef OSSL_STORE_R_INVALID_SCHEME
+    {"INVALID_SCHEME", ERR_LIB_OSSL_STORE, OSSL_STORE_R_INVALID_SCHEME},
+  #else
+    {"INVALID_SCHEME", 44, 106},
+  #endif
+  #ifdef OSSL_STORE_R_IS_NOT_A
+    {"IS_NOT_A", ERR_LIB_OSSL_STORE, OSSL_STORE_R_IS_NOT_A},
+  #else
+    {"IS_NOT_A", 44, 112},
+  #endif
+  #ifdef OSSL_STORE_R_LOADER_INCOMPLETE
+    {"LOADER_INCOMPLETE", ERR_LIB_OSSL_STORE, OSSL_STORE_R_LOADER_INCOMPLETE},
+  #else
+    {"LOADER_INCOMPLETE", 44, 116},
+  #endif
+  #ifdef OSSL_STORE_R_LOADING_STARTED
+    {"LOADING_STARTED", ERR_LIB_OSSL_STORE, OSSL_STORE_R_LOADING_STARTED},
+  #else
+    {"LOADING_STARTED", 44, 117},
+  #endif
+  #ifdef OSSL_STORE_R_NOT_A_CERTIFICATE
+    {"NOT_A_CERTIFICATE", ERR_LIB_OSSL_STORE, OSSL_STORE_R_NOT_A_CERTIFICATE},
+  #else
+    {"NOT_A_CERTIFICATE", 44, 100},
+  #endif
+  #ifdef OSSL_STORE_R_NOT_A_CRL
+    {"NOT_A_CRL", ERR_LIB_OSSL_STORE, OSSL_STORE_R_NOT_A_CRL},
+  #else
+    {"NOT_A_CRL", 44, 101},
+  #endif
+  #ifdef OSSL_STORE_R_NOT_A_KEY
+    {"NOT_A_KEY", ERR_LIB_OSSL_STORE, OSSL_STORE_R_NOT_A_KEY},
+  #else
+    {"NOT_A_KEY", 44, 102},
+  #endif
+  #ifdef OSSL_STORE_R_NOT_A_NAME
+    {"NOT_A_NAME", ERR_LIB_OSSL_STORE, OSSL_STORE_R_NOT_A_NAME},
+  #else
+    {"NOT_A_NAME", 44, 103},
+  #endif
+  #ifdef OSSL_STORE_R_NOT_PARAMETERS
+    {"NOT_PARAMETERS", ERR_LIB_OSSL_STORE, OSSL_STORE_R_NOT_PARAMETERS},
+  #else
+    {"NOT_PARAMETERS", 44, 104},
+  #endif
+  #ifdef OSSL_STORE_R_PASSPHRASE_CALLBACK_ERROR
+    {"PASSPHRASE_CALLBACK_ERROR", ERR_LIB_OSSL_STORE, OSSL_STORE_R_PASSPHRASE_CALLBACK_ERROR},
+  #else
+    {"PASSPHRASE_CALLBACK_ERROR", 44, 114},
+  #endif
+  #ifdef OSSL_STORE_R_PATH_MUST_BE_ABSOLUTE
+    {"PATH_MUST_BE_ABSOLUTE", ERR_LIB_OSSL_STORE, OSSL_STORE_R_PATH_MUST_BE_ABSOLUTE},
+  #else
+    {"PATH_MUST_BE_ABSOLUTE", 44, 108},
+  #endif
+  #ifdef OSSL_STORE_R_SEARCH_ONLY_SUPPORTED_FOR_DIRECTORIES
+    {"SEARCH_ONLY_SUPPORTED_FOR_DIRECTORIES", ERR_LIB_OSSL_STORE, OSSL_STORE_R_SEARCH_ONLY_SUPPORTED_FOR_DIRECTORIES},
+  #else
+    {"SEARCH_ONLY_SUPPORTED_FOR_DIRECTORIES", 44, 119},
+  #endif
+  #ifdef OSSL_STORE_R_UI_PROCESS_INTERRUPTED_OR_CANCELLED
+    {"UI_PROCESS_INTERRUPTED_OR_CANCELLED", ERR_LIB_OSSL_STORE, OSSL_STORE_R_UI_PROCESS_INTERRUPTED_OR_CANCELLED},
+  #else
+    {"UI_PROCESS_INTERRUPTED_OR_CANCELLED", 44, 109},
+  #endif
+  #ifdef OSSL_STORE_R_UNREGISTERED_SCHEME
+    {"UNREGISTERED_SCHEME", ERR_LIB_OSSL_STORE, OSSL_STORE_R_UNREGISTERED_SCHEME},
+  #else
+    {"UNREGISTERED_SCHEME", 44, 105},
+  #endif
+  #ifdef OSSL_STORE_R_UNSUPPORTED_CONTENT_TYPE
+    {"UNSUPPORTED_CONTENT_TYPE", ERR_LIB_OSSL_STORE, OSSL_STORE_R_UNSUPPORTED_CONTENT_TYPE},
+  #else
+    {"UNSUPPORTED_CONTENT_TYPE", 44, 110},
+  #endif
+  #ifdef OSSL_STORE_R_UNSUPPORTED_OPERATION
+    {"UNSUPPORTED_OPERATION", ERR_LIB_OSSL_STORE, OSSL_STORE_R_UNSUPPORTED_OPERATION},
+  #else
+    {"UNSUPPORTED_OPERATION", 44, 118},
+  #endif
+  #ifdef OSSL_STORE_R_UNSUPPORTED_SEARCH_TYPE
+    {"UNSUPPORTED_SEARCH_TYPE", ERR_LIB_OSSL_STORE, OSSL_STORE_R_UNSUPPORTED_SEARCH_TYPE},
+  #else
+    {"UNSUPPORTED_SEARCH_TYPE", 44, 120},
+  #endif
+  #ifdef OSSL_STORE_R_URI_AUTHORITY_UNSUPPORTED
+    {"URI_AUTHORITY_UNSUPPORTED", ERR_LIB_OSSL_STORE, OSSL_STORE_R_URI_AUTHORITY_UNSUPPORTED},
+  #else
+    {"URI_AUTHORITY_UNSUPPORTED", 44, 111},
+  #endif
+  #ifdef PEM_R_BAD_BASE64_DECODE
+    {"BAD_BASE64_DECODE", ERR_LIB_PEM, PEM_R_BAD_BASE64_DECODE},
+  #else
+    {"BAD_BASE64_DECODE", 9, 100},
+  #endif
+  #ifdef PEM_R_BAD_DECRYPT
+    {"BAD_DECRYPT", ERR_LIB_PEM, PEM_R_BAD_DECRYPT},
+  #else
+    {"BAD_DECRYPT", 9, 101},
+  #endif
+  #ifdef PEM_R_BAD_END_LINE
+    {"BAD_END_LINE", ERR_LIB_PEM, PEM_R_BAD_END_LINE},
+  #else
+    {"BAD_END_LINE", 9, 102},
+  #endif
+  #ifdef PEM_R_BAD_IV_CHARS
+    {"BAD_IV_CHARS", ERR_LIB_PEM, PEM_R_BAD_IV_CHARS},
+  #else
+    {"BAD_IV_CHARS", 9, 103},
+  #endif
+  #ifdef PEM_R_BAD_MAGIC_NUMBER
+    {"BAD_MAGIC_NUMBER", ERR_LIB_PEM, PEM_R_BAD_MAGIC_NUMBER},
+  #else
+    {"BAD_MAGIC_NUMBER", 9, 116},
+  #endif
+  #ifdef PEM_R_BAD_PASSWORD_READ
+    {"BAD_PASSWORD_READ", ERR_LIB_PEM, PEM_R_BAD_PASSWORD_READ},
+  #else
+    {"BAD_PASSWORD_READ", 9, 104},
+  #endif
+  #ifdef PEM_R_BAD_VERSION_NUMBER
+    {"BAD_VERSION_NUMBER", ERR_LIB_PEM, PEM_R_BAD_VERSION_NUMBER},
+  #else
+    {"BAD_VERSION_NUMBER", 9, 117},
+  #endif
+  #ifdef PEM_R_BIO_WRITE_FAILURE
+    {"BIO_WRITE_FAILURE", ERR_LIB_PEM, PEM_R_BIO_WRITE_FAILURE},
+  #else
+    {"BIO_WRITE_FAILURE", 9, 118},
+  #endif
+  #ifdef PEM_R_CIPHER_IS_NULL
+    {"CIPHER_IS_NULL", ERR_LIB_PEM, PEM_R_CIPHER_IS_NULL},
+  #else
+    {"CIPHER_IS_NULL", 9, 127},
+  #endif
+  #ifdef PEM_R_ERROR_CONVERTING_PRIVATE_KEY
+    {"ERROR_CONVERTING_PRIVATE_KEY", ERR_LIB_PEM, PEM_R_ERROR_CONVERTING_PRIVATE_KEY},
+  #else
+    {"ERROR_CONVERTING_PRIVATE_KEY", 9, 115},
+  #endif
+  #ifdef PEM_R_EXPECTING_PRIVATE_KEY_BLOB
+    {"EXPECTING_PRIVATE_KEY_BLOB", ERR_LIB_PEM, PEM_R_EXPECTING_PRIVATE_KEY_BLOB},
+  #else
+    {"EXPECTING_PRIVATE_KEY_BLOB", 9, 119},
+  #endif
+  #ifdef PEM_R_EXPECTING_PUBLIC_KEY_BLOB
+    {"EXPECTING_PUBLIC_KEY_BLOB", ERR_LIB_PEM, PEM_R_EXPECTING_PUBLIC_KEY_BLOB},
+  #else
+    {"EXPECTING_PUBLIC_KEY_BLOB", 9, 120},
+  #endif
+  #ifdef PEM_R_HEADER_TOO_LONG
+    {"HEADER_TOO_LONG", ERR_LIB_PEM, PEM_R_HEADER_TOO_LONG},
+  #else
+    {"HEADER_TOO_LONG", 9, 128},
+  #endif
+  #ifdef PEM_R_INCONSISTENT_HEADER
+    {"INCONSISTENT_HEADER", ERR_LIB_PEM, PEM_R_INCONSISTENT_HEADER},
+  #else
+    {"INCONSISTENT_HEADER", 9, 121},
+  #endif
+  #ifdef PEM_R_KEYBLOB_HEADER_PARSE_ERROR
+    {"KEYBLOB_HEADER_PARSE_ERROR", ERR_LIB_PEM, PEM_R_KEYBLOB_HEADER_PARSE_ERROR},
+  #else
+    {"KEYBLOB_HEADER_PARSE_ERROR", 9, 122},
+  #endif
+  #ifdef PEM_R_KEYBLOB_TOO_SHORT
+    {"KEYBLOB_TOO_SHORT", ERR_LIB_PEM, PEM_R_KEYBLOB_TOO_SHORT},
+  #else
+    {"KEYBLOB_TOO_SHORT", 9, 123},
+  #endif
+  #ifdef PEM_R_MISSING_DEK_IV
+    {"MISSING_DEK_IV", ERR_LIB_PEM, PEM_R_MISSING_DEK_IV},
+  #else
+    {"MISSING_DEK_IV", 9, 129},
+  #endif
+  #ifdef PEM_R_NOT_DEK_INFO
+    {"NOT_DEK_INFO", ERR_LIB_PEM, PEM_R_NOT_DEK_INFO},
+  #else
+    {"NOT_DEK_INFO", 9, 105},
+  #endif
+  #ifdef PEM_R_NOT_ENCRYPTED
+    {"NOT_ENCRYPTED", ERR_LIB_PEM, PEM_R_NOT_ENCRYPTED},
+  #else
+    {"NOT_ENCRYPTED", 9, 106},
+  #endif
+  #ifdef PEM_R_NOT_PROC_TYPE
+    {"NOT_PROC_TYPE", ERR_LIB_PEM, PEM_R_NOT_PROC_TYPE},
+  #else
+    {"NOT_PROC_TYPE", 9, 107},
+  #endif
+  #ifdef PEM_R_NO_START_LINE
+    {"NO_START_LINE", ERR_LIB_PEM, PEM_R_NO_START_LINE},
+  #else
+    {"NO_START_LINE", 9, 108},
+  #endif
+  #ifdef PEM_R_PROBLEMS_GETTING_PASSWORD
+    {"PROBLEMS_GETTING_PASSWORD", ERR_LIB_PEM, PEM_R_PROBLEMS_GETTING_PASSWORD},
+  #else
+    {"PROBLEMS_GETTING_PASSWORD", 9, 109},
+  #endif
+  #ifdef PEM_R_PVK_DATA_TOO_SHORT
+    {"PVK_DATA_TOO_SHORT", ERR_LIB_PEM, PEM_R_PVK_DATA_TOO_SHORT},
+  #else
+    {"PVK_DATA_TOO_SHORT", 9, 124},
+  #endif
+  #ifdef PEM_R_PVK_TOO_SHORT
+    {"PVK_TOO_SHORT", ERR_LIB_PEM, PEM_R_PVK_TOO_SHORT},
+  #else
+    {"PVK_TOO_SHORT", 9, 125},
+  #endif
+  #ifdef PEM_R_READ_KEY
+    {"READ_KEY", ERR_LIB_PEM, PEM_R_READ_KEY},
+  #else
+    {"READ_KEY", 9, 111},
+  #endif
+  #ifdef PEM_R_SHORT_HEADER
+    {"SHORT_HEADER", ERR_LIB_PEM, PEM_R_SHORT_HEADER},
+  #else
+    {"SHORT_HEADER", 9, 112},
+  #endif
+  #ifdef PEM_R_UNEXPECTED_DEK_IV
+    {"UNEXPECTED_DEK_IV", ERR_LIB_PEM, PEM_R_UNEXPECTED_DEK_IV},
+  #else
+    {"UNEXPECTED_DEK_IV", 9, 130},
+  #endif
+  #ifdef PEM_R_UNSUPPORTED_CIPHER
+    {"UNSUPPORTED_CIPHER", ERR_LIB_PEM, PEM_R_UNSUPPORTED_CIPHER},
+  #else
+    {"UNSUPPORTED_CIPHER", 9, 113},
+  #endif
+  #ifdef PEM_R_UNSUPPORTED_ENCRYPTION
+    {"UNSUPPORTED_ENCRYPTION", ERR_LIB_PEM, PEM_R_UNSUPPORTED_ENCRYPTION},
+  #else
+    {"UNSUPPORTED_ENCRYPTION", 9, 114},
+  #endif
+  #ifdef PEM_R_UNSUPPORTED_KEY_COMPONENTS
+    {"UNSUPPORTED_KEY_COMPONENTS", ERR_LIB_PEM, PEM_R_UNSUPPORTED_KEY_COMPONENTS},
+  #else
+    {"UNSUPPORTED_KEY_COMPONENTS", 9, 126},
+  #endif
+  #ifdef PEM_R_UNSUPPORTED_PUBLIC_KEY_TYPE
+    {"UNSUPPORTED_PUBLIC_KEY_TYPE", ERR_LIB_PEM, PEM_R_UNSUPPORTED_PUBLIC_KEY_TYPE},
+  #else
+    {"UNSUPPORTED_PUBLIC_KEY_TYPE", 9, 110},
+  #endif
+  #ifdef PKCS12_R_CANT_PACK_STRUCTURE
+    {"CANT_PACK_STRUCTURE", ERR_LIB_PKCS12, PKCS12_R_CANT_PACK_STRUCTURE},
+  #else
+    {"CANT_PACK_STRUCTURE", 35, 100},
+  #endif
+  #ifdef PKCS12_R_CONTENT_TYPE_NOT_DATA
+    {"CONTENT_TYPE_NOT_DATA", ERR_LIB_PKCS12, PKCS12_R_CONTENT_TYPE_NOT_DATA},
+  #else
+    {"CONTENT_TYPE_NOT_DATA", 35, 121},
+  #endif
+  #ifdef PKCS12_R_DECODE_ERROR
+    {"DECODE_ERROR", ERR_LIB_PKCS12, PKCS12_R_DECODE_ERROR},
+  #else
+    {"DECODE_ERROR", 35, 101},
+  #endif
+  #ifdef PKCS12_R_ENCODE_ERROR
+    {"ENCODE_ERROR", ERR_LIB_PKCS12, PKCS12_R_ENCODE_ERROR},
+  #else
+    {"ENCODE_ERROR", 35, 102},
+  #endif
+  #ifdef PKCS12_R_ENCRYPT_ERROR
+    {"ENCRYPT_ERROR", ERR_LIB_PKCS12, PKCS12_R_ENCRYPT_ERROR},
+  #else
+    {"ENCRYPT_ERROR", 35, 103},
+  #endif
+  #ifdef PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE
+    {"ERROR_SETTING_ENCRYPTED_DATA_TYPE", ERR_LIB_PKCS12, PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE},
+  #else
+    {"ERROR_SETTING_ENCRYPTED_DATA_TYPE", 35, 120},
+  #endif
+  #ifdef PKCS12_R_INVALID_NULL_ARGUMENT
+    {"INVALID_NULL_ARGUMENT", ERR_LIB_PKCS12, PKCS12_R_INVALID_NULL_ARGUMENT},
+  #else
+    {"INVALID_NULL_ARGUMENT", 35, 104},
+  #endif
+  #ifdef PKCS12_R_INVALID_NULL_PKCS12_POINTER
+    {"INVALID_NULL_PKCS12_POINTER", ERR_LIB_PKCS12, PKCS12_R_INVALID_NULL_PKCS12_POINTER},
+  #else
+    {"INVALID_NULL_PKCS12_POINTER", 35, 105},
+  #endif
+  #ifdef PKCS12_R_IV_GEN_ERROR
+    {"IV_GEN_ERROR", ERR_LIB_PKCS12, PKCS12_R_IV_GEN_ERROR},
+  #else
+    {"IV_GEN_ERROR", 35, 106},
+  #endif
+  #ifdef PKCS12_R_KEY_GEN_ERROR
+    {"KEY_GEN_ERROR", ERR_LIB_PKCS12, PKCS12_R_KEY_GEN_ERROR},
+  #else
+    {"KEY_GEN_ERROR", 35, 107},
+  #endif
+  #ifdef PKCS12_R_MAC_ABSENT
+    {"MAC_ABSENT", ERR_LIB_PKCS12, PKCS12_R_MAC_ABSENT},
+  #else
+    {"MAC_ABSENT", 35, 108},
+  #endif
+  #ifdef PKCS12_R_MAC_GENERATION_ERROR
+    {"MAC_GENERATION_ERROR", ERR_LIB_PKCS12, PKCS12_R_MAC_GENERATION_ERROR},
+  #else
+    {"MAC_GENERATION_ERROR", 35, 109},
+  #endif
+  #ifdef PKCS12_R_MAC_SETUP_ERROR
+    {"MAC_SETUP_ERROR", ERR_LIB_PKCS12, PKCS12_R_MAC_SETUP_ERROR},
+  #else
+    {"MAC_SETUP_ERROR", 35, 110},
+  #endif
+  #ifdef PKCS12_R_MAC_STRING_SET_ERROR
+    {"MAC_STRING_SET_ERROR", ERR_LIB_PKCS12, PKCS12_R_MAC_STRING_SET_ERROR},
+  #else
+    {"MAC_STRING_SET_ERROR", 35, 111},
+  #endif
+  #ifdef PKCS12_R_MAC_VERIFY_FAILURE
+    {"MAC_VERIFY_FAILURE", ERR_LIB_PKCS12, PKCS12_R_MAC_VERIFY_FAILURE},
+  #else
+    {"MAC_VERIFY_FAILURE", 35, 113},
+  #endif
+  #ifdef PKCS12_R_PARSE_ERROR
+    {"PARSE_ERROR", ERR_LIB_PKCS12, PKCS12_R_PARSE_ERROR},
+  #else
+    {"PARSE_ERROR", 35, 114},
+  #endif
+  #ifdef PKCS12_R_PKCS12_ALGOR_CIPHERINIT_ERROR
+    {"PKCS12_ALGOR_CIPHERINIT_ERROR", ERR_LIB_PKCS12, PKCS12_R_PKCS12_ALGOR_CIPHERINIT_ERROR},
+  #else
+    {"PKCS12_ALGOR_CIPHERINIT_ERROR", 35, 115},
+  #endif
+  #ifdef PKCS12_R_PKCS12_CIPHERFINAL_ERROR
+    {"PKCS12_CIPHERFINAL_ERROR", ERR_LIB_PKCS12, PKCS12_R_PKCS12_CIPHERFINAL_ERROR},
+  #else
+    {"PKCS12_CIPHERFINAL_ERROR", 35, 116},
+  #endif
+  #ifdef PKCS12_R_PKCS12_PBE_CRYPT_ERROR
+    {"PKCS12_PBE_CRYPT_ERROR", ERR_LIB_PKCS12, PKCS12_R_PKCS12_PBE_CRYPT_ERROR},
+  #else
+    {"PKCS12_PBE_CRYPT_ERROR", 35, 117},
+  #endif
+  #ifdef PKCS12_R_UNKNOWN_DIGEST_ALGORITHM
+    {"UNKNOWN_DIGEST_ALGORITHM", ERR_LIB_PKCS12, PKCS12_R_UNKNOWN_DIGEST_ALGORITHM},
+  #else
+    {"UNKNOWN_DIGEST_ALGORITHM", 35, 118},
+  #endif
+  #ifdef PKCS12_R_UNSUPPORTED_PKCS12_MODE
+    {"UNSUPPORTED_PKCS12_MODE", ERR_LIB_PKCS12, PKCS12_R_UNSUPPORTED_PKCS12_MODE},
+  #else
+    {"UNSUPPORTED_PKCS12_MODE", 35, 119},
+  #endif
+  #ifdef PKCS7_R_CERTIFICATE_VERIFY_ERROR
+    {"CERTIFICATE_VERIFY_ERROR", ERR_LIB_PKCS7, PKCS7_R_CERTIFICATE_VERIFY_ERROR},
+  #else
+    {"CERTIFICATE_VERIFY_ERROR", 33, 117},
+  #endif
+  #ifdef PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER
+    {"CIPHER_HAS_NO_OBJECT_IDENTIFIER", ERR_LIB_PKCS7, PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER},
+  #else
+    {"CIPHER_HAS_NO_OBJECT_IDENTIFIER", 33, 144},
+  #endif
+  #ifdef PKCS7_R_CIPHER_NOT_INITIALIZED
+    {"CIPHER_NOT_INITIALIZED", ERR_LIB_PKCS7, PKCS7_R_CIPHER_NOT_INITIALIZED},
+  #else
+    {"CIPHER_NOT_INITIALIZED", 33, 116},
+  #endif
+  #ifdef PKCS7_R_CONTENT_AND_DATA_PRESENT
+    {"CONTENT_AND_DATA_PRESENT", ERR_LIB_PKCS7, PKCS7_R_CONTENT_AND_DATA_PRESENT},
+  #else
+    {"CONTENT_AND_DATA_PRESENT", 33, 118},
+  #endif
+  #ifdef PKCS7_R_CTRL_ERROR
+    {"CTRL_ERROR", ERR_LIB_PKCS7, PKCS7_R_CTRL_ERROR},
+  #else
+    {"CTRL_ERROR", 33, 152},
+  #endif
+  #ifdef PKCS7_R_DECRYPT_ERROR
+    {"DECRYPT_ERROR", ERR_LIB_PKCS7, PKCS7_R_DECRYPT_ERROR},
+  #else
+    {"DECRYPT_ERROR", 33, 119},
+  #endif
+  #ifdef PKCS7_R_DIGEST_FAILURE
+    {"DIGEST_FAILURE", ERR_LIB_PKCS7, PKCS7_R_DIGEST_FAILURE},
+  #else
+    {"DIGEST_FAILURE", 33, 101},
+  #endif
+  #ifdef PKCS7_R_ENCRYPTION_CTRL_FAILURE
+    {"ENCRYPTION_CTRL_FAILURE", ERR_LIB_PKCS7, PKCS7_R_ENCRYPTION_CTRL_FAILURE},
+  #else
+    {"ENCRYPTION_CTRL_FAILURE", 33, 149},
+  #endif
+  #ifdef PKCS7_R_ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE
+    {"ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE", ERR_LIB_PKCS7, PKCS7_R_ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE},
+  #else
+    {"ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE", 33, 150},
+  #endif
+  #ifdef PKCS7_R_ERROR_ADDING_RECIPIENT
+    {"ERROR_ADDING_RECIPIENT", ERR_LIB_PKCS7, PKCS7_R_ERROR_ADDING_RECIPIENT},
+  #else
+    {"ERROR_ADDING_RECIPIENT", 33, 120},
+  #endif
+  #ifdef PKCS7_R_ERROR_SETTING_CIPHER
+    {"ERROR_SETTING_CIPHER", ERR_LIB_PKCS7, PKCS7_R_ERROR_SETTING_CIPHER},
+  #else
+    {"ERROR_SETTING_CIPHER", 33, 121},
+  #endif
+  #ifdef PKCS7_R_INVALID_NULL_POINTER
+    {"INVALID_NULL_POINTER", ERR_LIB_PKCS7, PKCS7_R_INVALID_NULL_POINTER},
+  #else
+    {"INVALID_NULL_POINTER", 33, 143},
+  #endif
+  #ifdef PKCS7_R_INVALID_SIGNED_DATA_TYPE
+    {"INVALID_SIGNED_DATA_TYPE", ERR_LIB_PKCS7, PKCS7_R_INVALID_SIGNED_DATA_TYPE},
+  #else
+    {"INVALID_SIGNED_DATA_TYPE", 33, 155},
+  #endif
+  #ifdef PKCS7_R_NO_CONTENT
+    {"NO_CONTENT", ERR_LIB_PKCS7, PKCS7_R_NO_CONTENT},
+  #else
+    {"NO_CONTENT", 33, 122},
+  #endif
+  #ifdef PKCS7_R_NO_DEFAULT_DIGEST
+    {"NO_DEFAULT_DIGEST", ERR_LIB_PKCS7, PKCS7_R_NO_DEFAULT_DIGEST},
+  #else
+    {"NO_DEFAULT_DIGEST", 33, 151},
+  #endif
+  #ifdef PKCS7_R_NO_MATCHING_DIGEST_TYPE_FOUND
+    {"NO_MATCHING_DIGEST_TYPE_FOUND", ERR_LIB_PKCS7, PKCS7_R_NO_MATCHING_DIGEST_TYPE_FOUND},
+  #else
+    {"NO_MATCHING_DIGEST_TYPE_FOUND", 33, 154},
+  #endif
+  #ifdef PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE
+    {"NO_RECIPIENT_MATCHES_CERTIFICATE", ERR_LIB_PKCS7, PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE},
+  #else
+    {"NO_RECIPIENT_MATCHES_CERTIFICATE", 33, 115},
+  #endif
+  #ifdef PKCS7_R_NO_SIGNATURES_ON_DATA
+    {"NO_SIGNATURES_ON_DATA", ERR_LIB_PKCS7, PKCS7_R_NO_SIGNATURES_ON_DATA},
+  #else
+    {"NO_SIGNATURES_ON_DATA", 33, 123},
+  #endif
+  #ifdef PKCS7_R_NO_SIGNERS
+    {"NO_SIGNERS", ERR_LIB_PKCS7, PKCS7_R_NO_SIGNERS},
+  #else
+    {"NO_SIGNERS", 33, 142},
+  #endif
+  #ifdef PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE
+    {"OPERATION_NOT_SUPPORTED_ON_THIS_TYPE", ERR_LIB_PKCS7, PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE},
+  #else
+    {"OPERATION_NOT_SUPPORTED_ON_THIS_TYPE", 33, 104},
+  #endif
+  #ifdef PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR
+    {"PKCS7_ADD_SIGNATURE_ERROR", ERR_LIB_PKCS7, PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR},
+  #else
+    {"PKCS7_ADD_SIGNATURE_ERROR", 33, 124},
+  #endif
+  #ifdef PKCS7_R_PKCS7_ADD_SIGNER_ERROR
+    {"PKCS7_ADD_SIGNER_ERROR", ERR_LIB_PKCS7, PKCS7_R_PKCS7_ADD_SIGNER_ERROR},
+  #else
+    {"PKCS7_ADD_SIGNER_ERROR", 33, 153},
+  #endif
+  #ifdef PKCS7_R_PKCS7_DATASIGN
+    {"PKCS7_DATASIGN", ERR_LIB_PKCS7, PKCS7_R_PKCS7_DATASIGN},
+  #else
+    {"PKCS7_DATASIGN", 33, 145},
+  #endif
+  #ifdef PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE
+    {"PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE", ERR_LIB_PKCS7, PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE},
+  #else
+    {"PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE", 33, 127},
+  #endif
+  #ifdef PKCS7_R_SIGNATURE_FAILURE
+    {"SIGNATURE_FAILURE", ERR_LIB_PKCS7, PKCS7_R_SIGNATURE_FAILURE},
+  #else
+    {"SIGNATURE_FAILURE", 33, 105},
+  #endif
+  #ifdef PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND
+    {"SIGNER_CERTIFICATE_NOT_FOUND", ERR_LIB_PKCS7, PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND},
+  #else
+    {"SIGNER_CERTIFICATE_NOT_FOUND", 33, 128},
+  #endif
+  #ifdef PKCS7_R_SIGNING_CTRL_FAILURE
+    {"SIGNING_CTRL_FAILURE", ERR_LIB_PKCS7, PKCS7_R_SIGNING_CTRL_FAILURE},
+  #else
+    {"SIGNING_CTRL_FAILURE", 33, 147},
+  #endif
+  #ifdef PKCS7_R_SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE
+    {"SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE", ERR_LIB_PKCS7, PKCS7_R_SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE},
+  #else
+    {"SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE", 33, 148},
+  #endif
+  #ifdef PKCS7_R_SMIME_TEXT_ERROR
+    {"SMIME_TEXT_ERROR", ERR_LIB_PKCS7, PKCS7_R_SMIME_TEXT_ERROR},
+  #else
+    {"SMIME_TEXT_ERROR", 33, 129},
+  #endif
+  #ifdef PKCS7_R_UNABLE_TO_FIND_CERTIFICATE
+    {"UNABLE_TO_FIND_CERTIFICATE", ERR_LIB_PKCS7, PKCS7_R_UNABLE_TO_FIND_CERTIFICATE},
+  #else
+    {"UNABLE_TO_FIND_CERTIFICATE", 33, 106},
+  #endif
+  #ifdef PKCS7_R_UNABLE_TO_FIND_MEM_BIO
+    {"UNABLE_TO_FIND_MEM_BIO", ERR_LIB_PKCS7, PKCS7_R_UNABLE_TO_FIND_MEM_BIO},
+  #else
+    {"UNABLE_TO_FIND_MEM_BIO", 33, 107},
+  #endif
+  #ifdef PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST
+    {"UNABLE_TO_FIND_MESSAGE_DIGEST", ERR_LIB_PKCS7, PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST},
+  #else
+    {"UNABLE_TO_FIND_MESSAGE_DIGEST", 33, 108},
+  #endif
+  #ifdef PKCS7_R_UNKNOWN_DIGEST_TYPE
+    {"UNKNOWN_DIGEST_TYPE", ERR_LIB_PKCS7, PKCS7_R_UNKNOWN_DIGEST_TYPE},
+  #else
+    {"UNKNOWN_DIGEST_TYPE", 33, 109},
+  #endif
+  #ifdef PKCS7_R_UNKNOWN_OPERATION
+    {"UNKNOWN_OPERATION", ERR_LIB_PKCS7, PKCS7_R_UNKNOWN_OPERATION},
+  #else
+    {"UNKNOWN_OPERATION", 33, 110},
+  #endif
+  #ifdef PKCS7_R_UNSUPPORTED_CIPHER_TYPE
+    {"UNSUPPORTED_CIPHER_TYPE", ERR_LIB_PKCS7, PKCS7_R_UNSUPPORTED_CIPHER_TYPE},
+  #else
+    {"UNSUPPORTED_CIPHER_TYPE", 33, 111},
+  #endif
+  #ifdef PKCS7_R_UNSUPPORTED_CONTENT_TYPE
+    {"UNSUPPORTED_CONTENT_TYPE", ERR_LIB_PKCS7, PKCS7_R_UNSUPPORTED_CONTENT_TYPE},
+  #else
+    {"UNSUPPORTED_CONTENT_TYPE", 33, 112},
+  #endif
+  #ifdef PKCS7_R_WRONG_CONTENT_TYPE
+    {"WRONG_CONTENT_TYPE", ERR_LIB_PKCS7, PKCS7_R_WRONG_CONTENT_TYPE},
+  #else
+    {"WRONG_CONTENT_TYPE", 33, 113},
+  #endif
+  #ifdef PKCS7_R_WRONG_PKCS7_TYPE
+    {"WRONG_PKCS7_TYPE", ERR_LIB_PKCS7, PKCS7_R_WRONG_PKCS7_TYPE},
+  #else
+    {"WRONG_PKCS7_TYPE", 33, 114},
+  #endif
+  #ifdef RAND_R_ADDITIONAL_INPUT_TOO_LONG
+    {"ADDITIONAL_INPUT_TOO_LONG", ERR_LIB_RAND, RAND_R_ADDITIONAL_INPUT_TOO_LONG},
+  #else
+    {"ADDITIONAL_INPUT_TOO_LONG", 36, 102},
+  #endif
+  #ifdef RAND_R_ALREADY_INSTANTIATED
+    {"ALREADY_INSTANTIATED", ERR_LIB_RAND, RAND_R_ALREADY_INSTANTIATED},
+  #else
+    {"ALREADY_INSTANTIATED", 36, 103},
+  #endif
+  #ifdef RAND_R_ARGUMENT_OUT_OF_RANGE
+    {"ARGUMENT_OUT_OF_RANGE", ERR_LIB_RAND, RAND_R_ARGUMENT_OUT_OF_RANGE},
+  #else
+    {"ARGUMENT_OUT_OF_RANGE", 36, 105},
+  #endif
+  #ifdef RAND_R_CANNOT_OPEN_FILE
+    {"CANNOT_OPEN_FILE", ERR_LIB_RAND, RAND_R_CANNOT_OPEN_FILE},
+  #else
+    {"CANNOT_OPEN_FILE", 36, 121},
+  #endif
+  #ifdef RAND_R_DRBG_ALREADY_INITIALIZED
+    {"DRBG_ALREADY_INITIALIZED", ERR_LIB_RAND, RAND_R_DRBG_ALREADY_INITIALIZED},
+  #else
+    {"DRBG_ALREADY_INITIALIZED", 36, 129},
+  #endif
+  #ifdef RAND_R_DRBG_NOT_INITIALISED
+    {"DRBG_NOT_INITIALISED", ERR_LIB_RAND, RAND_R_DRBG_NOT_INITIALISED},
+  #else
+    {"DRBG_NOT_INITIALISED", 36, 104},
+  #endif
+  #ifdef RAND_R_ENTROPY_INPUT_TOO_LONG
+    {"ENTROPY_INPUT_TOO_LONG", ERR_LIB_RAND, RAND_R_ENTROPY_INPUT_TOO_LONG},
+  #else
+    {"ENTROPY_INPUT_TOO_LONG", 36, 106},
+  #endif
+  #ifdef RAND_R_ENTROPY_OUT_OF_RANGE
+    {"ENTROPY_OUT_OF_RANGE", ERR_LIB_RAND, RAND_R_ENTROPY_OUT_OF_RANGE},
+  #else
+    {"ENTROPY_OUT_OF_RANGE", 36, 124},
+  #endif
+  #ifdef RAND_R_ERROR_ENTROPY_POOL_WAS_IGNORED
+    {"ERROR_ENTROPY_POOL_WAS_IGNORED", ERR_LIB_RAND, RAND_R_ERROR_ENTROPY_POOL_WAS_IGNORED},
+  #else
+    {"ERROR_ENTROPY_POOL_WAS_IGNORED", 36, 127},
+  #endif
+  #ifdef RAND_R_ERROR_INITIALISING_DRBG
+    {"ERROR_INITIALISING_DRBG", ERR_LIB_RAND, RAND_R_ERROR_INITIALISING_DRBG},
+  #else
+    {"ERROR_INITIALISING_DRBG", 36, 107},
+  #endif
+  #ifdef RAND_R_ERROR_INSTANTIATING_DRBG
+    {"ERROR_INSTANTIATING_DRBG", ERR_LIB_RAND, RAND_R_ERROR_INSTANTIATING_DRBG},
+  #else
+    {"ERROR_INSTANTIATING_DRBG", 36, 108},
+  #endif
+  #ifdef RAND_R_ERROR_RETRIEVING_ADDITIONAL_INPUT
+    {"ERROR_RETRIEVING_ADDITIONAL_INPUT", ERR_LIB_RAND, RAND_R_ERROR_RETRIEVING_ADDITIONAL_INPUT},
+  #else
+    {"ERROR_RETRIEVING_ADDITIONAL_INPUT", 36, 109},
+  #endif
+  #ifdef RAND_R_ERROR_RETRIEVING_ENTROPY
+    {"ERROR_RETRIEVING_ENTROPY", ERR_LIB_RAND, RAND_R_ERROR_RETRIEVING_ENTROPY},
+  #else
+    {"ERROR_RETRIEVING_ENTROPY", 36, 110},
+  #endif
+  #ifdef RAND_R_ERROR_RETRIEVING_NONCE
+    {"ERROR_RETRIEVING_NONCE", ERR_LIB_RAND, RAND_R_ERROR_RETRIEVING_NONCE},
+  #else
+    {"ERROR_RETRIEVING_NONCE", 36, 111},
+  #endif
+  #ifdef RAND_R_FAILED_TO_CREATE_LOCK
+    {"FAILED_TO_CREATE_LOCK", ERR_LIB_RAND, RAND_R_FAILED_TO_CREATE_LOCK},
+  #else
+    {"FAILED_TO_CREATE_LOCK", 36, 126},
+  #endif
+  #ifdef RAND_R_FUNC_NOT_IMPLEMENTED
+    {"FUNC_NOT_IMPLEMENTED", ERR_LIB_RAND, RAND_R_FUNC_NOT_IMPLEMENTED},
+  #else
+    {"FUNC_NOT_IMPLEMENTED", 36, 101},
+  #endif
+  #ifdef RAND_R_FWRITE_ERROR
+    {"FWRITE_ERROR", ERR_LIB_RAND, RAND_R_FWRITE_ERROR},
+  #else
+    {"FWRITE_ERROR", 36, 123},
+  #endif
+  #ifdef RAND_R_GENERATE_ERROR
+    {"GENERATE_ERROR", ERR_LIB_RAND, RAND_R_GENERATE_ERROR},
+  #else
+    {"GENERATE_ERROR", 36, 112},
+  #endif
+  #ifdef RAND_R_INTERNAL_ERROR
+    {"INTERNAL_ERROR", ERR_LIB_RAND, RAND_R_INTERNAL_ERROR},
+  #else
+    {"INTERNAL_ERROR", 36, 113},
+  #endif
+  #ifdef RAND_R_IN_ERROR_STATE
+    {"IN_ERROR_STATE", ERR_LIB_RAND, RAND_R_IN_ERROR_STATE},
+  #else
+    {"IN_ERROR_STATE", 36, 114},
+  #endif
+  #ifdef RAND_R_NOT_A_REGULAR_FILE
+    {"NOT_A_REGULAR_FILE", ERR_LIB_RAND, RAND_R_NOT_A_REGULAR_FILE},
+  #else
+    {"NOT_A_REGULAR_FILE", 36, 122},
+  #endif
+  #ifdef RAND_R_NOT_INSTANTIATED
+    {"NOT_INSTANTIATED", ERR_LIB_RAND, RAND_R_NOT_INSTANTIATED},
+  #else
+    {"NOT_INSTANTIATED", 36, 115},
+  #endif
+  #ifdef RAND_R_NO_DRBG_IMPLEMENTATION_SELECTED
+    {"NO_DRBG_IMPLEMENTATION_SELECTED", ERR_LIB_RAND, RAND_R_NO_DRBG_IMPLEMENTATION_SELECTED},
+  #else
+    {"NO_DRBG_IMPLEMENTATION_SELECTED", 36, 128},
+  #endif
+  #ifdef RAND_R_PARENT_LOCKING_NOT_ENABLED
+    {"PARENT_LOCKING_NOT_ENABLED", ERR_LIB_RAND, RAND_R_PARENT_LOCKING_NOT_ENABLED},
+  #else
+    {"PARENT_LOCKING_NOT_ENABLED", 36, 130},
+  #endif
+  #ifdef RAND_R_PARENT_STRENGTH_TOO_WEAK
+    {"PARENT_STRENGTH_TOO_WEAK", ERR_LIB_RAND, RAND_R_PARENT_STRENGTH_TOO_WEAK},
+  #else
+    {"PARENT_STRENGTH_TOO_WEAK", 36, 131},
+  #endif
+  #ifdef RAND_R_PERSONALISATION_STRING_TOO_LONG
+    {"PERSONALISATION_STRING_TOO_LONG", ERR_LIB_RAND, RAND_R_PERSONALISATION_STRING_TOO_LONG},
+  #else
+    {"PERSONALISATION_STRING_TOO_LONG", 36, 116},
+  #endif
+  #ifdef RAND_R_PREDICTION_RESISTANCE_NOT_SUPPORTED
+    {"PREDICTION_RESISTANCE_NOT_SUPPORTED", ERR_LIB_RAND, RAND_R_PREDICTION_RESISTANCE_NOT_SUPPORTED},
+  #else
+    {"PREDICTION_RESISTANCE_NOT_SUPPORTED", 36, 133},
+  #endif
+  #ifdef RAND_R_PRNG_NOT_SEEDED
+    {"PRNG_NOT_SEEDED", ERR_LIB_RAND, RAND_R_PRNG_NOT_SEEDED},
+  #else
+    {"PRNG_NOT_SEEDED", 36, 100},
+  #endif
+  #ifdef RAND_R_RANDOM_POOL_OVERFLOW
+    {"RANDOM_POOL_OVERFLOW", ERR_LIB_RAND, RAND_R_RANDOM_POOL_OVERFLOW},
+  #else
+    {"RANDOM_POOL_OVERFLOW", 36, 125},
+  #endif
+  #ifdef RAND_R_RANDOM_POOL_UNDERFLOW
+    {"RANDOM_POOL_UNDERFLOW", ERR_LIB_RAND, RAND_R_RANDOM_POOL_UNDERFLOW},
+  #else
+    {"RANDOM_POOL_UNDERFLOW", 36, 134},
+  #endif
+  #ifdef RAND_R_REQUEST_TOO_LARGE_FOR_DRBG
+    {"REQUEST_TOO_LARGE_FOR_DRBG", ERR_LIB_RAND, RAND_R_REQUEST_TOO_LARGE_FOR_DRBG},
+  #else
+    {"REQUEST_TOO_LARGE_FOR_DRBG", 36, 117},
+  #endif
+  #ifdef RAND_R_RESEED_ERROR
+    {"RESEED_ERROR", ERR_LIB_RAND, RAND_R_RESEED_ERROR},
+  #else
+    {"RESEED_ERROR", 36, 118},
+  #endif
+  #ifdef RAND_R_SELFTEST_FAILURE
+    {"SELFTEST_FAILURE", ERR_LIB_RAND, RAND_R_SELFTEST_FAILURE},
+  #else
+    {"SELFTEST_FAILURE", 36, 119},
+  #endif
+  #ifdef RAND_R_TOO_LITTLE_NONCE_REQUESTED
+    {"TOO_LITTLE_NONCE_REQUESTED", ERR_LIB_RAND, RAND_R_TOO_LITTLE_NONCE_REQUESTED},
+  #else
+    {"TOO_LITTLE_NONCE_REQUESTED", 36, 135},
+  #endif
+  #ifdef RAND_R_TOO_MUCH_NONCE_REQUESTED
+    {"TOO_MUCH_NONCE_REQUESTED", ERR_LIB_RAND, RAND_R_TOO_MUCH_NONCE_REQUESTED},
+  #else
+    {"TOO_MUCH_NONCE_REQUESTED", 36, 136},
+  #endif
+  #ifdef RAND_R_UNSUPPORTED_DRBG_FLAGS
+    {"UNSUPPORTED_DRBG_FLAGS", ERR_LIB_RAND, RAND_R_UNSUPPORTED_DRBG_FLAGS},
+  #else
+    {"UNSUPPORTED_DRBG_FLAGS", 36, 132},
+  #endif
+  #ifdef RAND_R_UNSUPPORTED_DRBG_TYPE
+    {"UNSUPPORTED_DRBG_TYPE", ERR_LIB_RAND, RAND_R_UNSUPPORTED_DRBG_TYPE},
+  #else
+    {"UNSUPPORTED_DRBG_TYPE", 36, 120},
+  #endif
+  #ifdef RSA_R_ALGORITHM_MISMATCH
+    {"ALGORITHM_MISMATCH", ERR_LIB_RSA, RSA_R_ALGORITHM_MISMATCH},
+  #else
+    {"ALGORITHM_MISMATCH", 4, 100},
+  #endif
+  #ifdef RSA_R_BAD_E_VALUE
+    {"BAD_E_VALUE", ERR_LIB_RSA, RSA_R_BAD_E_VALUE},
+  #else
+    {"BAD_E_VALUE", 4, 101},
+  #endif
+  #ifdef RSA_R_BAD_FIXED_HEADER_DECRYPT
+    {"BAD_FIXED_HEADER_DECRYPT", ERR_LIB_RSA, RSA_R_BAD_FIXED_HEADER_DECRYPT},
+  #else
+    {"BAD_FIXED_HEADER_DECRYPT", 4, 102},
+  #endif
+  #ifdef RSA_R_BAD_PAD_BYTE_COUNT
+    {"BAD_PAD_BYTE_COUNT", ERR_LIB_RSA, RSA_R_BAD_PAD_BYTE_COUNT},
+  #else
+    {"BAD_PAD_BYTE_COUNT", 4, 103},
+  #endif
+  #ifdef RSA_R_BAD_SIGNATURE
+    {"BAD_SIGNATURE", ERR_LIB_RSA, RSA_R_BAD_SIGNATURE},
+  #else
+    {"BAD_SIGNATURE", 4, 104},
+  #endif
+  #ifdef RSA_R_BLOCK_TYPE_IS_NOT_01
+    {"BLOCK_TYPE_IS_NOT_01", ERR_LIB_RSA, RSA_R_BLOCK_TYPE_IS_NOT_01},
+  #else
+    {"BLOCK_TYPE_IS_NOT_01", 4, 106},
+  #endif
+  #ifdef RSA_R_BLOCK_TYPE_IS_NOT_02
+    {"BLOCK_TYPE_IS_NOT_02", ERR_LIB_RSA, RSA_R_BLOCK_TYPE_IS_NOT_02},
+  #else
+    {"BLOCK_TYPE_IS_NOT_02", 4, 107},
+  #endif
+  #ifdef RSA_R_DATA_GREATER_THAN_MOD_LEN
+    {"DATA_GREATER_THAN_MOD_LEN", ERR_LIB_RSA, RSA_R_DATA_GREATER_THAN_MOD_LEN},
+  #else
+    {"DATA_GREATER_THAN_MOD_LEN", 4, 108},
+  #endif
+  #ifdef RSA_R_DATA_TOO_LARGE
+    {"DATA_TOO_LARGE", ERR_LIB_RSA, RSA_R_DATA_TOO_LARGE},
+  #else
+    {"DATA_TOO_LARGE", 4, 109},
+  #endif
+  #ifdef RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE
+    {"DATA_TOO_LARGE_FOR_KEY_SIZE", ERR_LIB_RSA, RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE},
+  #else
+    {"DATA_TOO_LARGE_FOR_KEY_SIZE", 4, 110},
+  #endif
+  #ifdef RSA_R_DATA_TOO_LARGE_FOR_MODULUS
+    {"DATA_TOO_LARGE_FOR_MODULUS", ERR_LIB_RSA, RSA_R_DATA_TOO_LARGE_FOR_MODULUS},
+  #else
+    {"DATA_TOO_LARGE_FOR_MODULUS", 4, 132},
+  #endif
+  #ifdef RSA_R_DATA_TOO_SMALL
+    {"DATA_TOO_SMALL", ERR_LIB_RSA, RSA_R_DATA_TOO_SMALL},
+  #else
+    {"DATA_TOO_SMALL", 4, 111},
+  #endif
+  #ifdef RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE
+    {"DATA_TOO_SMALL_FOR_KEY_SIZE", ERR_LIB_RSA, RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE},
+  #else
+    {"DATA_TOO_SMALL_FOR_KEY_SIZE", 4, 122},
+  #endif
+  #ifdef RSA_R_DIGEST_DOES_NOT_MATCH
+    {"DIGEST_DOES_NOT_MATCH", ERR_LIB_RSA, RSA_R_DIGEST_DOES_NOT_MATCH},
+  #else
+    {"DIGEST_DOES_NOT_MATCH", 4, 158},
+  #endif
+  #ifdef RSA_R_DIGEST_NOT_ALLOWED
+    {"DIGEST_NOT_ALLOWED", ERR_LIB_RSA, RSA_R_DIGEST_NOT_ALLOWED},
+  #else
+    {"DIGEST_NOT_ALLOWED", 4, 145},
+  #endif
+  #ifdef RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY
+    {"DIGEST_TOO_BIG_FOR_RSA_KEY", ERR_LIB_RSA, RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY},
+  #else
+    {"DIGEST_TOO_BIG_FOR_RSA_KEY", 4, 112},
+  #endif
+  #ifdef RSA_R_DMP1_NOT_CONGRUENT_TO_D
+    {"DMP1_NOT_CONGRUENT_TO_D", ERR_LIB_RSA, RSA_R_DMP1_NOT_CONGRUENT_TO_D},
+  #else
+    {"DMP1_NOT_CONGRUENT_TO_D", 4, 124},
+  #endif
+  #ifdef RSA_R_DMQ1_NOT_CONGRUENT_TO_D
+    {"DMQ1_NOT_CONGRUENT_TO_D", ERR_LIB_RSA, RSA_R_DMQ1_NOT_CONGRUENT_TO_D},
+  #else
+    {"DMQ1_NOT_CONGRUENT_TO_D", 4, 125},
+  #endif
+  #ifdef RSA_R_D_E_NOT_CONGRUENT_TO_1
+    {"D_E_NOT_CONGRUENT_TO_1", ERR_LIB_RSA, RSA_R_D_E_NOT_CONGRUENT_TO_1},
+  #else
+    {"D_E_NOT_CONGRUENT_TO_1", 4, 123},
+  #endif
+  #ifdef RSA_R_FIRST_OCTET_INVALID
+    {"FIRST_OCTET_INVALID", ERR_LIB_RSA, RSA_R_FIRST_OCTET_INVALID},
+  #else
+    {"FIRST_OCTET_INVALID", 4, 133},
+  #endif
+  #ifdef RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE
+    {"ILLEGAL_OR_UNSUPPORTED_PADDING_MODE", ERR_LIB_RSA, RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE},
+  #else
+    {"ILLEGAL_OR_UNSUPPORTED_PADDING_MODE", 4, 144},
+  #endif
+  #ifdef RSA_R_INVALID_DIGEST
+    {"INVALID_DIGEST", ERR_LIB_RSA, RSA_R_INVALID_DIGEST},
+  #else
+    {"INVALID_DIGEST", 4, 157},
+  #endif
+  #ifdef RSA_R_INVALID_DIGEST_LENGTH
+    {"INVALID_DIGEST_LENGTH", ERR_LIB_RSA, RSA_R_INVALID_DIGEST_LENGTH},
+  #else
+    {"INVALID_DIGEST_LENGTH", 4, 143},
+  #endif
+  #ifdef RSA_R_INVALID_HEADER
+    {"INVALID_HEADER", ERR_LIB_RSA, RSA_R_INVALID_HEADER},
+  #else
+    {"INVALID_HEADER", 4, 137},
+  #endif
+  #ifdef RSA_R_INVALID_LABEL
+    {"INVALID_LABEL", ERR_LIB_RSA, RSA_R_INVALID_LABEL},
+  #else
+    {"INVALID_LABEL", 4, 160},
+  #endif
+  #ifdef RSA_R_INVALID_MESSAGE_LENGTH
+    {"INVALID_MESSAGE_LENGTH", ERR_LIB_RSA, RSA_R_INVALID_MESSAGE_LENGTH},
+  #else
+    {"INVALID_MESSAGE_LENGTH", 4, 131},
+  #endif
+  #ifdef RSA_R_INVALID_MGF1_MD
+    {"INVALID_MGF1_MD", ERR_LIB_RSA, RSA_R_INVALID_MGF1_MD},
+  #else
+    {"INVALID_MGF1_MD", 4, 156},
+  #endif
+  #ifdef RSA_R_INVALID_MULTI_PRIME_KEY
+    {"INVALID_MULTI_PRIME_KEY", ERR_LIB_RSA, RSA_R_INVALID_MULTI_PRIME_KEY},
+  #else
+    {"INVALID_MULTI_PRIME_KEY", 4, 167},
+  #endif
+  #ifdef RSA_R_INVALID_OAEP_PARAMETERS
+    {"INVALID_OAEP_PARAMETERS", ERR_LIB_RSA, RSA_R_INVALID_OAEP_PARAMETERS},
+  #else
+    {"INVALID_OAEP_PARAMETERS", 4, 161},
+  #endif
+  #ifdef RSA_R_INVALID_PADDING
+    {"INVALID_PADDING", ERR_LIB_RSA, RSA_R_INVALID_PADDING},
+  #else
+    {"INVALID_PADDING", 4, 138},
+  #endif
+  #ifdef RSA_R_INVALID_PADDING_MODE
+    {"INVALID_PADDING_MODE", ERR_LIB_RSA, RSA_R_INVALID_PADDING_MODE},
+  #else
+    {"INVALID_PADDING_MODE", 4, 141},
+  #endif
+  #ifdef RSA_R_INVALID_PSS_PARAMETERS
+    {"INVALID_PSS_PARAMETERS", ERR_LIB_RSA, RSA_R_INVALID_PSS_PARAMETERS},
+  #else
+    {"INVALID_PSS_PARAMETERS", 4, 149},
+  #endif
+  #ifdef RSA_R_INVALID_PSS_SALTLEN
+    {"INVALID_PSS_SALTLEN", ERR_LIB_RSA, RSA_R_INVALID_PSS_SALTLEN},
+  #else
+    {"INVALID_PSS_SALTLEN", 4, 146},
+  #endif
+  #ifdef RSA_R_INVALID_SALT_LENGTH
+    {"INVALID_SALT_LENGTH", ERR_LIB_RSA, RSA_R_INVALID_SALT_LENGTH},
+  #else
+    {"INVALID_SALT_LENGTH", 4, 150},
+  #endif
+  #ifdef RSA_R_INVALID_TRAILER
+    {"INVALID_TRAILER", ERR_LIB_RSA, RSA_R_INVALID_TRAILER},
+  #else
+    {"INVALID_TRAILER", 4, 139},
+  #endif
+  #ifdef RSA_R_INVALID_X931_DIGEST
+    {"INVALID_X931_DIGEST", ERR_LIB_RSA, RSA_R_INVALID_X931_DIGEST},
+  #else
+    {"INVALID_X931_DIGEST", 4, 142},
+  #endif
+  #ifdef RSA_R_IQMP_NOT_INVERSE_OF_Q
+    {"IQMP_NOT_INVERSE_OF_Q", ERR_LIB_RSA, RSA_R_IQMP_NOT_INVERSE_OF_Q},
+  #else
+    {"IQMP_NOT_INVERSE_OF_Q", 4, 126},
+  #endif
+  #ifdef RSA_R_KEY_PRIME_NUM_INVALID
+    {"KEY_PRIME_NUM_INVALID", ERR_LIB_RSA, RSA_R_KEY_PRIME_NUM_INVALID},
+  #else
+    {"KEY_PRIME_NUM_INVALID", 4, 165},
+  #endif
+  #ifdef RSA_R_KEY_SIZE_TOO_SMALL
+    {"KEY_SIZE_TOO_SMALL", ERR_LIB_RSA, RSA_R_KEY_SIZE_TOO_SMALL},
+  #else
+    {"KEY_SIZE_TOO_SMALL", 4, 120},
+  #endif
+  #ifdef RSA_R_LAST_OCTET_INVALID
+    {"LAST_OCTET_INVALID", ERR_LIB_RSA, RSA_R_LAST_OCTET_INVALID},
+  #else
+    {"LAST_OCTET_INVALID", 4, 134},
+  #endif
+  #ifdef RSA_R_MGF1_DIGEST_NOT_ALLOWED
+    {"MGF1_DIGEST_NOT_ALLOWED", ERR_LIB_RSA, RSA_R_MGF1_DIGEST_NOT_ALLOWED},
+  #else
+    {"MGF1_DIGEST_NOT_ALLOWED", 4, 152},
+  #endif
+  #ifdef RSA_R_MISSING_PRIVATE_KEY
+    {"MISSING_PRIVATE_KEY", ERR_LIB_RSA, RSA_R_MISSING_PRIVATE_KEY},
+  #else
+    {"MISSING_PRIVATE_KEY", 4, 179},
+  #endif
+  #ifdef RSA_R_MODULUS_TOO_LARGE
+    {"MODULUS_TOO_LARGE", ERR_LIB_RSA, RSA_R_MODULUS_TOO_LARGE},
+  #else
+    {"MODULUS_TOO_LARGE", 4, 105},
+  #endif
+  #ifdef RSA_R_MP_COEFFICIENT_NOT_INVERSE_OF_R
+    {"MP_COEFFICIENT_NOT_INVERSE_OF_R", ERR_LIB_RSA, RSA_R_MP_COEFFICIENT_NOT_INVERSE_OF_R},
+  #else
+    {"MP_COEFFICIENT_NOT_INVERSE_OF_R", 4, 168},
+  #endif
+  #ifdef RSA_R_MP_EXPONENT_NOT_CONGRUENT_TO_D
+    {"MP_EXPONENT_NOT_CONGRUENT_TO_D", ERR_LIB_RSA, RSA_R_MP_EXPONENT_NOT_CONGRUENT_TO_D},
+  #else
+    {"MP_EXPONENT_NOT_CONGRUENT_TO_D", 4, 169},
+  #endif
+  #ifdef RSA_R_MP_R_NOT_PRIME
+    {"MP_R_NOT_PRIME", ERR_LIB_RSA, RSA_R_MP_R_NOT_PRIME},
+  #else
+    {"MP_R_NOT_PRIME", 4, 170},
+  #endif
+  #ifdef RSA_R_NO_PUBLIC_EXPONENT
+    {"NO_PUBLIC_EXPONENT", ERR_LIB_RSA, RSA_R_NO_PUBLIC_EXPONENT},
+  #else
+    {"NO_PUBLIC_EXPONENT", 4, 140},
+  #endif
+  #ifdef RSA_R_NULL_BEFORE_BLOCK_MISSING
+    {"NULL_BEFORE_BLOCK_MISSING", ERR_LIB_RSA, RSA_R_NULL_BEFORE_BLOCK_MISSING},
+  #else
+    {"NULL_BEFORE_BLOCK_MISSING", 4, 113},
+  #endif
+  #ifdef RSA_R_N_DOES_NOT_EQUAL_PRODUCT_OF_PRIMES
+    {"N_DOES_NOT_EQUAL_PRODUCT_OF_PRIMES", ERR_LIB_RSA, RSA_R_N_DOES_NOT_EQUAL_PRODUCT_OF_PRIMES},
+  #else
+    {"N_DOES_NOT_EQUAL_PRODUCT_OF_PRIMES", 4, 172},
+  #endif
+  #ifdef RSA_R_N_DOES_NOT_EQUAL_P_Q
+    {"N_DOES_NOT_EQUAL_P_Q", ERR_LIB_RSA, RSA_R_N_DOES_NOT_EQUAL_P_Q},
+  #else
+    {"N_DOES_NOT_EQUAL_P_Q", 4, 127},
+  #endif
+  #ifdef RSA_R_OAEP_DECODING_ERROR
+    {"OAEP_DECODING_ERROR", ERR_LIB_RSA, RSA_R_OAEP_DECODING_ERROR},
+  #else
+    {"OAEP_DECODING_ERROR", 4, 121},
+  #endif
+  #ifdef RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE
+    {"OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE", ERR_LIB_RSA, RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE},
+  #else
+    {"OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE", 4, 148},
+  #endif
+  #ifdef RSA_R_PADDING_CHECK_FAILED
+    {"PADDING_CHECK_FAILED", ERR_LIB_RSA, RSA_R_PADDING_CHECK_FAILED},
+  #else
+    {"PADDING_CHECK_FAILED", 4, 114},
+  #endif
+  #ifdef RSA_R_PKCS_DECODING_ERROR
+    {"PKCS_DECODING_ERROR", ERR_LIB_RSA, RSA_R_PKCS_DECODING_ERROR},
+  #else
+    {"PKCS_DECODING_ERROR", 4, 159},
+  #endif
+  #ifdef RSA_R_PSS_SALTLEN_TOO_SMALL
+    {"PSS_SALTLEN_TOO_SMALL", ERR_LIB_RSA, RSA_R_PSS_SALTLEN_TOO_SMALL},
+  #else
+    {"PSS_SALTLEN_TOO_SMALL", 4, 164},
+  #endif
+  #ifdef RSA_R_P_NOT_PRIME
+    {"P_NOT_PRIME", ERR_LIB_RSA, RSA_R_P_NOT_PRIME},
+  #else
+    {"P_NOT_PRIME", 4, 128},
+  #endif
+  #ifdef RSA_R_Q_NOT_PRIME
+    {"Q_NOT_PRIME", ERR_LIB_RSA, RSA_R_Q_NOT_PRIME},
+  #else
+    {"Q_NOT_PRIME", 4, 129},
+  #endif
+  #ifdef RSA_R_RSA_OPERATIONS_NOT_SUPPORTED
+    {"RSA_OPERATIONS_NOT_SUPPORTED", ERR_LIB_RSA, RSA_R_RSA_OPERATIONS_NOT_SUPPORTED},
+  #else
+    {"RSA_OPERATIONS_NOT_SUPPORTED", 4, 130},
+  #endif
+  #ifdef RSA_R_SLEN_CHECK_FAILED
+    {"SLEN_CHECK_FAILED", ERR_LIB_RSA, RSA_R_SLEN_CHECK_FAILED},
+  #else
+    {"SLEN_CHECK_FAILED", 4, 136},
+  #endif
+  #ifdef RSA_R_SLEN_RECOVERY_FAILED
+    {"SLEN_RECOVERY_FAILED", ERR_LIB_RSA, RSA_R_SLEN_RECOVERY_FAILED},
+  #else
+    {"SLEN_RECOVERY_FAILED", 4, 135},
+  #endif
+  #ifdef RSA_R_SSLV3_ROLLBACK_ATTACK
+    {"SSLV3_ROLLBACK_ATTACK", ERR_LIB_RSA, RSA_R_SSLV3_ROLLBACK_ATTACK},
+  #else
+    {"SSLV3_ROLLBACK_ATTACK", 4, 115},
+  #endif
+  #ifdef RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD
+    {"THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD", ERR_LIB_RSA, RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD},
+  #else
+    {"THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD", 4, 116},
+  #endif
+  #ifdef RSA_R_UNKNOWN_ALGORITHM_TYPE
+    {"UNKNOWN_ALGORITHM_TYPE", ERR_LIB_RSA, RSA_R_UNKNOWN_ALGORITHM_TYPE},
+  #else
+    {"UNKNOWN_ALGORITHM_TYPE", 4, 117},
+  #endif
+  #ifdef RSA_R_UNKNOWN_DIGEST
+    {"UNKNOWN_DIGEST", ERR_LIB_RSA, RSA_R_UNKNOWN_DIGEST},
+  #else
+    {"UNKNOWN_DIGEST", 4, 166},
+  #endif
+  #ifdef RSA_R_UNKNOWN_MASK_DIGEST
+    {"UNKNOWN_MASK_DIGEST", ERR_LIB_RSA, RSA_R_UNKNOWN_MASK_DIGEST},
+  #else
+    {"UNKNOWN_MASK_DIGEST", 4, 151},
+  #endif
+  #ifdef RSA_R_UNKNOWN_PADDING_TYPE
+    {"UNKNOWN_PADDING_TYPE", ERR_LIB_RSA, RSA_R_UNKNOWN_PADDING_TYPE},
+  #else
+    {"UNKNOWN_PADDING_TYPE", 4, 118},
+  #endif
+  #ifdef RSA_R_UNSUPPORTED_ENCRYPTION_TYPE
+    {"UNSUPPORTED_ENCRYPTION_TYPE", ERR_LIB_RSA, RSA_R_UNSUPPORTED_ENCRYPTION_TYPE},
+  #else
+    {"UNSUPPORTED_ENCRYPTION_TYPE", 4, 162},
+  #endif
+  #ifdef RSA_R_UNSUPPORTED_LABEL_SOURCE
+    {"UNSUPPORTED_LABEL_SOURCE", ERR_LIB_RSA, RSA_R_UNSUPPORTED_LABEL_SOURCE},
+  #else
+    {"UNSUPPORTED_LABEL_SOURCE", 4, 163},
+  #endif
+  #ifdef RSA_R_UNSUPPORTED_MASK_ALGORITHM
+    {"UNSUPPORTED_MASK_ALGORITHM", ERR_LIB_RSA, RSA_R_UNSUPPORTED_MASK_ALGORITHM},
+  #else
+    {"UNSUPPORTED_MASK_ALGORITHM", 4, 153},
+  #endif
+  #ifdef RSA_R_UNSUPPORTED_MASK_PARAMETER
+    {"UNSUPPORTED_MASK_PARAMETER", ERR_LIB_RSA, RSA_R_UNSUPPORTED_MASK_PARAMETER},
+  #else
+    {"UNSUPPORTED_MASK_PARAMETER", 4, 154},
+  #endif
+  #ifdef RSA_R_UNSUPPORTED_SIGNATURE_TYPE
+    {"UNSUPPORTED_SIGNATURE_TYPE", ERR_LIB_RSA, RSA_R_UNSUPPORTED_SIGNATURE_TYPE},
+  #else
+    {"UNSUPPORTED_SIGNATURE_TYPE", 4, 155},
+  #endif
+  #ifdef RSA_R_VALUE_MISSING
+    {"VALUE_MISSING", ERR_LIB_RSA, RSA_R_VALUE_MISSING},
+  #else
+    {"VALUE_MISSING", 4, 147},
+  #endif
+  #ifdef RSA_R_WRONG_SIGNATURE_LENGTH
+    {"WRONG_SIGNATURE_LENGTH", ERR_LIB_RSA, RSA_R_WRONG_SIGNATURE_LENGTH},
+  #else
+    {"WRONG_SIGNATURE_LENGTH", 4, 119},
+  #endif
+  #ifdef SM2_R_ASN1_ERROR
+    {"ASN1_ERROR", ERR_LIB_SM2, SM2_R_ASN1_ERROR},
+  #else
+    {"ASN1_ERROR", 53, 100},
+  #endif
+  #ifdef SM2_R_BAD_SIGNATURE
+    {"BAD_SIGNATURE", ERR_LIB_SM2, SM2_R_BAD_SIGNATURE},
+  #else
+    {"BAD_SIGNATURE", 53, 101},
+  #endif
+  #ifdef SM2_R_BUFFER_TOO_SMALL
+    {"BUFFER_TOO_SMALL", ERR_LIB_SM2, SM2_R_BUFFER_TOO_SMALL},
+  #else
+    {"BUFFER_TOO_SMALL", 53, 107},
+  #endif
+  #ifdef SM2_R_DIST_ID_TOO_LARGE
+    {"DIST_ID_TOO_LARGE", ERR_LIB_SM2, SM2_R_DIST_ID_TOO_LARGE},
+  #else
+    {"DIST_ID_TOO_LARGE", 53, 110},
+  #endif
+  #ifdef SM2_R_ID_NOT_SET
+    {"ID_NOT_SET", ERR_LIB_SM2, SM2_R_ID_NOT_SET},
+  #else
+    {"ID_NOT_SET", 53, 112},
+  #endif
+  #ifdef SM2_R_ID_TOO_LARGE
+    {"ID_TOO_LARGE", ERR_LIB_SM2, SM2_R_ID_TOO_LARGE},
+  #else
+    {"ID_TOO_LARGE", 53, 111},
+  #endif
+  #ifdef SM2_R_INVALID_CURVE
+    {"INVALID_CURVE", ERR_LIB_SM2, SM2_R_INVALID_CURVE},
+  #else
+    {"INVALID_CURVE", 53, 108},
+  #endif
+  #ifdef SM2_R_INVALID_DIGEST
+    {"INVALID_DIGEST", ERR_LIB_SM2, SM2_R_INVALID_DIGEST},
+  #else
+    {"INVALID_DIGEST", 53, 102},
+  #endif
+  #ifdef SM2_R_INVALID_DIGEST_TYPE
+    {"INVALID_DIGEST_TYPE", ERR_LIB_SM2, SM2_R_INVALID_DIGEST_TYPE},
+  #else
+    {"INVALID_DIGEST_TYPE", 53, 103},
+  #endif
+  #ifdef SM2_R_INVALID_ENCODING
+    {"INVALID_ENCODING", ERR_LIB_SM2, SM2_R_INVALID_ENCODING},
+  #else
+    {"INVALID_ENCODING", 53, 104},
+  #endif
+  #ifdef SM2_R_INVALID_FIELD
+    {"INVALID_FIELD", ERR_LIB_SM2, SM2_R_INVALID_FIELD},
+  #else
+    {"INVALID_FIELD", 53, 105},
+  #endif
+  #ifdef SM2_R_NO_PARAMETERS_SET
+    {"NO_PARAMETERS_SET", ERR_LIB_SM2, SM2_R_NO_PARAMETERS_SET},
+  #else
+    {"NO_PARAMETERS_SET", 53, 109},
+  #endif
+  #ifdef SM2_R_USER_ID_TOO_LARGE
+    {"USER_ID_TOO_LARGE", ERR_LIB_SM2, SM2_R_USER_ID_TOO_LARGE},
+  #else
+    {"USER_ID_TOO_LARGE", 53, 106},
+  #endif
+  #ifdef SSL_R_APPLICATION_DATA_AFTER_CLOSE_NOTIFY
+    {"APPLICATION_DATA_AFTER_CLOSE_NOTIFY", ERR_LIB_SSL, SSL_R_APPLICATION_DATA_AFTER_CLOSE_NOTIFY},
+  #else
+    {"APPLICATION_DATA_AFTER_CLOSE_NOTIFY", 20, 291},
+  #endif
+  #ifdef SSL_R_APP_DATA_IN_HANDSHAKE
+    {"APP_DATA_IN_HANDSHAKE", ERR_LIB_SSL, SSL_R_APP_DATA_IN_HANDSHAKE},
+  #else
+    {"APP_DATA_IN_HANDSHAKE", 20, 100},
+  #endif
+  #ifdef SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT
+    {"ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT", ERR_LIB_SSL, SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT},
+  #else
+    {"ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT", 20, 272},
+  #endif
+  #ifdef SSL_R_AT_LEAST_TLS_1_0_NEEDED_IN_FIPS_MODE
+    {"AT_LEAST_TLS_1_0_NEEDED_IN_FIPS_MODE", ERR_LIB_SSL, SSL_R_AT_LEAST_TLS_1_0_NEEDED_IN_FIPS_MODE},
+  #else
+    {"AT_LEAST_TLS_1_0_NEEDED_IN_FIPS_MODE", 20, 143},
+  #endif
+  #ifdef SSL_R_AT_LEAST_TLS_1_2_NEEDED_IN_SUITEB_MODE
+    {"AT_LEAST_TLS_1_2_NEEDED_IN_SUITEB_MODE", ERR_LIB_SSL, SSL_R_AT_LEAST_TLS_1_2_NEEDED_IN_SUITEB_MODE},
+  #else
+    {"AT_LEAST_TLS_1_2_NEEDED_IN_SUITEB_MODE", 20, 158},
+  #endif
+  #ifdef SSL_R_BAD_CHANGE_CIPHER_SPEC
+    {"BAD_CHANGE_CIPHER_SPEC", ERR_LIB_SSL, SSL_R_BAD_CHANGE_CIPHER_SPEC},
+  #else
+    {"BAD_CHANGE_CIPHER_SPEC", 20, 103},
+  #endif
+  #ifdef SSL_R_BAD_CIPHER
+    {"BAD_CIPHER", ERR_LIB_SSL, SSL_R_BAD_CIPHER},
+  #else
+    {"BAD_CIPHER", 20, 186},
+  #endif
+  #ifdef SSL_R_BAD_DATA
+    {"BAD_DATA", ERR_LIB_SSL, SSL_R_BAD_DATA},
+  #else
+    {"BAD_DATA", 20, 390},
+  #endif
+  #ifdef SSL_R_BAD_DATA_RETURNED_BY_CALLBACK
+    {"BAD_DATA_RETURNED_BY_CALLBACK", ERR_LIB_SSL, SSL_R_BAD_DATA_RETURNED_BY_CALLBACK},
+  #else
+    {"BAD_DATA_RETURNED_BY_CALLBACK", 20, 106},
+  #endif
+  #ifdef SSL_R_BAD_DECOMPRESSION
+    {"BAD_DECOMPRESSION", ERR_LIB_SSL, SSL_R_BAD_DECOMPRESSION},
+  #else
+    {"BAD_DECOMPRESSION", 20, 107},
+  #endif
+  #ifdef SSL_R_BAD_DH_VALUE
+    {"BAD_DH_VALUE", ERR_LIB_SSL, SSL_R_BAD_DH_VALUE},
+  #else
+    {"BAD_DH_VALUE", 20, 102},
+  #endif
+  #ifdef SSL_R_BAD_DIGEST_LENGTH
+    {"BAD_DIGEST_LENGTH", ERR_LIB_SSL, SSL_R_BAD_DIGEST_LENGTH},
+  #else
+    {"BAD_DIGEST_LENGTH", 20, 111},
+  #endif
+  #ifdef SSL_R_BAD_EARLY_DATA
+    {"BAD_EARLY_DATA", ERR_LIB_SSL, SSL_R_BAD_EARLY_DATA},
+  #else
+    {"BAD_EARLY_DATA", 20, 233},
+  #endif
+  #ifdef SSL_R_BAD_ECC_CERT
+    {"BAD_ECC_CERT", ERR_LIB_SSL, SSL_R_BAD_ECC_CERT},
+  #else
+    {"BAD_ECC_CERT", 20, 304},
+  #endif
+  #ifdef SSL_R_BAD_ECPOINT
+    {"BAD_ECPOINT", ERR_LIB_SSL, SSL_R_BAD_ECPOINT},
+  #else
+    {"BAD_ECPOINT", 20, 306},
+  #endif
+  #ifdef SSL_R_BAD_EXTENSION
+    {"BAD_EXTENSION", ERR_LIB_SSL, SSL_R_BAD_EXTENSION},
+  #else
+    {"BAD_EXTENSION", 20, 110},
+  #endif
+  #ifdef SSL_R_BAD_HANDSHAKE_LENGTH
+    {"BAD_HANDSHAKE_LENGTH", ERR_LIB_SSL, SSL_R_BAD_HANDSHAKE_LENGTH},
+  #else
+    {"BAD_HANDSHAKE_LENGTH", 20, 332},
+  #endif
+  #ifdef SSL_R_BAD_HANDSHAKE_STATE
+    {"BAD_HANDSHAKE_STATE", ERR_LIB_SSL, SSL_R_BAD_HANDSHAKE_STATE},
+  #else
+    {"BAD_HANDSHAKE_STATE", 20, 236},
+  #endif
+  #ifdef SSL_R_BAD_HELLO_REQUEST
+    {"BAD_HELLO_REQUEST", ERR_LIB_SSL, SSL_R_BAD_HELLO_REQUEST},
+  #else
+    {"BAD_HELLO_REQUEST", 20, 105},
+  #endif
+  #ifdef SSL_R_BAD_HRR_VERSION
+    {"BAD_HRR_VERSION", ERR_LIB_SSL, SSL_R_BAD_HRR_VERSION},
+  #else
+    {"BAD_HRR_VERSION", 20, 263},
+  #endif
+  #ifdef SSL_R_BAD_KEY_SHARE
+    {"BAD_KEY_SHARE", ERR_LIB_SSL, SSL_R_BAD_KEY_SHARE},
+  #else
+    {"BAD_KEY_SHARE", 20, 108},
+  #endif
+  #ifdef SSL_R_BAD_KEY_UPDATE
+    {"BAD_KEY_UPDATE", ERR_LIB_SSL, SSL_R_BAD_KEY_UPDATE},
+  #else
+    {"BAD_KEY_UPDATE", 20, 122},
+  #endif
+  #ifdef SSL_R_BAD_LEGACY_VERSION
+    {"BAD_LEGACY_VERSION", ERR_LIB_SSL, SSL_R_BAD_LEGACY_VERSION},
+  #else
+    {"BAD_LEGACY_VERSION", 20, 292},
+  #endif
+  #ifdef SSL_R_BAD_LENGTH
+    {"BAD_LENGTH", ERR_LIB_SSL, SSL_R_BAD_LENGTH},
+  #else
+    {"BAD_LENGTH", 20, 271},
+  #endif
+  #ifdef SSL_R_BAD_PACKET
+    {"BAD_PACKET", ERR_LIB_SSL, SSL_R_BAD_PACKET},
+  #else
+    {"BAD_PACKET", 20, 240},
+  #endif
+  #ifdef SSL_R_BAD_PACKET_LENGTH
+    {"BAD_PACKET_LENGTH", ERR_LIB_SSL, SSL_R_BAD_PACKET_LENGTH},
+  #else
+    {"BAD_PACKET_LENGTH", 20, 115},
+  #endif
+  #ifdef SSL_R_BAD_PROTOCOL_VERSION_NUMBER
+    {"BAD_PROTOCOL_VERSION_NUMBER", ERR_LIB_SSL, SSL_R_BAD_PROTOCOL_VERSION_NUMBER},
+  #else
+    {"BAD_PROTOCOL_VERSION_NUMBER", 20, 116},
+  #endif
+  #ifdef SSL_R_BAD_PSK
+    {"BAD_PSK", ERR_LIB_SSL, SSL_R_BAD_PSK},
+  #else
+    {"BAD_PSK", 20, 219},
+  #endif
+  #ifdef SSL_R_BAD_PSK_IDENTITY
+    {"BAD_PSK_IDENTITY", ERR_LIB_SSL, SSL_R_BAD_PSK_IDENTITY},
+  #else
+    {"BAD_PSK_IDENTITY", 20, 114},
+  #endif
+  #ifdef SSL_R_BAD_RECORD_TYPE
+    {"BAD_RECORD_TYPE", ERR_LIB_SSL, SSL_R_BAD_RECORD_TYPE},
+  #else
+    {"BAD_RECORD_TYPE", 20, 443},
+  #endif
+  #ifdef SSL_R_BAD_RSA_ENCRYPT
+    {"BAD_RSA_ENCRYPT", ERR_LIB_SSL, SSL_R_BAD_RSA_ENCRYPT},
+  #else
+    {"BAD_RSA_ENCRYPT", 20, 119},
+  #endif
+  #ifdef SSL_R_BAD_SIGNATURE
+    {"BAD_SIGNATURE", ERR_LIB_SSL, SSL_R_BAD_SIGNATURE},
+  #else
+    {"BAD_SIGNATURE", 20, 123},
+  #endif
+  #ifdef SSL_R_BAD_SRP_A_LENGTH
+    {"BAD_SRP_A_LENGTH", ERR_LIB_SSL, SSL_R_BAD_SRP_A_LENGTH},
+  #else
+    {"BAD_SRP_A_LENGTH", 20, 347},
+  #endif
+  #ifdef SSL_R_BAD_SRP_PARAMETERS
+    {"BAD_SRP_PARAMETERS", ERR_LIB_SSL, SSL_R_BAD_SRP_PARAMETERS},
+  #else
+    {"BAD_SRP_PARAMETERS", 20, 371},
+  #endif
+  #ifdef SSL_R_BAD_SRTP_MKI_VALUE
+    {"BAD_SRTP_MKI_VALUE", ERR_LIB_SSL, SSL_R_BAD_SRTP_MKI_VALUE},
+  #else
+    {"BAD_SRTP_MKI_VALUE", 20, 352},
+  #endif
+  #ifdef SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST
+    {"BAD_SRTP_PROTECTION_PROFILE_LIST", ERR_LIB_SSL, SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST},
+  #else
+    {"BAD_SRTP_PROTECTION_PROFILE_LIST", 20, 353},
+  #endif
+  #ifdef SSL_R_BAD_SSL_FILETYPE
+    {"BAD_SSL_FILETYPE", ERR_LIB_SSL, SSL_R_BAD_SSL_FILETYPE},
+  #else
+    {"BAD_SSL_FILETYPE", 20, 124},
+  #endif
+  #ifdef SSL_R_BAD_VALUE
+    {"BAD_VALUE", ERR_LIB_SSL, SSL_R_BAD_VALUE},
+  #else
+    {"BAD_VALUE", 20, 384},
+  #endif
+  #ifdef SSL_R_BAD_WRITE_RETRY
+    {"BAD_WRITE_RETRY", ERR_LIB_SSL, SSL_R_BAD_WRITE_RETRY},
+  #else
+    {"BAD_WRITE_RETRY", 20, 127},
+  #endif
+  #ifdef SSL_R_BINDER_DOES_NOT_VERIFY
+    {"BINDER_DOES_NOT_VERIFY", ERR_LIB_SSL, SSL_R_BINDER_DOES_NOT_VERIFY},
+  #else
+    {"BINDER_DOES_NOT_VERIFY", 20, 253},
+  #endif
+  #ifdef SSL_R_BIO_NOT_SET
+    {"BIO_NOT_SET", ERR_LIB_SSL, SSL_R_BIO_NOT_SET},
+  #else
+    {"BIO_NOT_SET", 20, 128},
+  #endif
+  #ifdef SSL_R_BLOCK_CIPHER_PAD_IS_WRONG
+    {"BLOCK_CIPHER_PAD_IS_WRONG", ERR_LIB_SSL, SSL_R_BLOCK_CIPHER_PAD_IS_WRONG},
+  #else
+    {"BLOCK_CIPHER_PAD_IS_WRONG", 20, 129},
+  #endif
+  #ifdef SSL_R_BN_LIB
+    {"BN_LIB", ERR_LIB_SSL, SSL_R_BN_LIB},
+  #else
+    {"BN_LIB", 20, 130},
+  #endif
+  #ifdef SSL_R_CALLBACK_FAILED
+    {"CALLBACK_FAILED", ERR_LIB_SSL, SSL_R_CALLBACK_FAILED},
+  #else
+    {"CALLBACK_FAILED", 20, 234},
+  #endif
+  #ifdef SSL_R_CANNOT_CHANGE_CIPHER
+    {"CANNOT_CHANGE_CIPHER", ERR_LIB_SSL, SSL_R_CANNOT_CHANGE_CIPHER},
+  #else
+    {"CANNOT_CHANGE_CIPHER", 20, 109},
+  #endif
+  #ifdef SSL_R_CA_DN_LENGTH_MISMATCH
+    {"CA_DN_LENGTH_MISMATCH", ERR_LIB_SSL, SSL_R_CA_DN_LENGTH_MISMATCH},
+  #else
+    {"CA_DN_LENGTH_MISMATCH", 20, 131},
+  #endif
+  #ifdef SSL_R_CA_KEY_TOO_SMALL
+    {"CA_KEY_TOO_SMALL", ERR_LIB_SSL, SSL_R_CA_KEY_TOO_SMALL},
+  #else
+    {"CA_KEY_TOO_SMALL", 20, 397},
+  #endif
+  #ifdef SSL_R_CA_MD_TOO_WEAK
+    {"CA_MD_TOO_WEAK", ERR_LIB_SSL, SSL_R_CA_MD_TOO_WEAK},
+  #else
+    {"CA_MD_TOO_WEAK", 20, 398},
+  #endif
+  #ifdef SSL_R_CCS_RECEIVED_EARLY
+    {"CCS_RECEIVED_EARLY", ERR_LIB_SSL, SSL_R_CCS_RECEIVED_EARLY},
+  #else
+    {"CCS_RECEIVED_EARLY", 20, 133},
+  #endif
+  #ifdef SSL_R_CERTIFICATE_VERIFY_FAILED
+    {"CERTIFICATE_VERIFY_FAILED", ERR_LIB_SSL, SSL_R_CERTIFICATE_VERIFY_FAILED},
+  #else
+    {"CERTIFICATE_VERIFY_FAILED", 20, 134},
+  #endif
+  #ifdef SSL_R_CERT_CB_ERROR
+    {"CERT_CB_ERROR", ERR_LIB_SSL, SSL_R_CERT_CB_ERROR},
+  #else
+    {"CERT_CB_ERROR", 20, 377},
+  #endif
+  #ifdef SSL_R_CERT_LENGTH_MISMATCH
+    {"CERT_LENGTH_MISMATCH", ERR_LIB_SSL, SSL_R_CERT_LENGTH_MISMATCH},
+  #else
+    {"CERT_LENGTH_MISMATCH", 20, 135},
+  #endif
+  #ifdef SSL_R_CIPHERSUITE_DIGEST_HAS_CHANGED
+    {"CIPHERSUITE_DIGEST_HAS_CHANGED", ERR_LIB_SSL, SSL_R_CIPHERSUITE_DIGEST_HAS_CHANGED},
+  #else
+    {"CIPHERSUITE_DIGEST_HAS_CHANGED", 20, 218},
+  #endif
+  #ifdef SSL_R_CIPHER_CODE_WRONG_LENGTH
+    {"CIPHER_CODE_WRONG_LENGTH", ERR_LIB_SSL, SSL_R_CIPHER_CODE_WRONG_LENGTH},
+  #else
+    {"CIPHER_CODE_WRONG_LENGTH", 20, 137},
+  #endif
+  #ifdef SSL_R_CIPHER_OR_HASH_UNAVAILABLE
+    {"CIPHER_OR_HASH_UNAVAILABLE", ERR_LIB_SSL, SSL_R_CIPHER_OR_HASH_UNAVAILABLE},
+  #else
+    {"CIPHER_OR_HASH_UNAVAILABLE", 20, 138},
+  #endif
+  #ifdef SSL_R_CLIENTHELLO_TLSEXT
+    {"CLIENTHELLO_TLSEXT", ERR_LIB_SSL, SSL_R_CLIENTHELLO_TLSEXT},
+  #else
+    {"CLIENTHELLO_TLSEXT", 20, 226},
+  #endif
+  #ifdef SSL_R_COMPRESSED_LENGTH_TOO_LONG
+    {"COMPRESSED_LENGTH_TOO_LONG", ERR_LIB_SSL, SSL_R_COMPRESSED_LENGTH_TOO_LONG},
+  #else
+    {"COMPRESSED_LENGTH_TOO_LONG", 20, 140},
+  #endif
+  #ifdef SSL_R_COMPRESSION_DISABLED
+    {"COMPRESSION_DISABLED", ERR_LIB_SSL, SSL_R_COMPRESSION_DISABLED},
+  #else
+    {"COMPRESSION_DISABLED", 20, 343},
+  #endif
+  #ifdef SSL_R_COMPRESSION_FAILURE
+    {"COMPRESSION_FAILURE", ERR_LIB_SSL, SSL_R_COMPRESSION_FAILURE},
+  #else
+    {"COMPRESSION_FAILURE", 20, 141},
+  #endif
+  #ifdef SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE
+    {"COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE", ERR_LIB_SSL, SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE},
+  #else
+    {"COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE", 20, 307},
+  #endif
+  #ifdef SSL_R_COMPRESSION_LIBRARY_ERROR
+    {"COMPRESSION_LIBRARY_ERROR", ERR_LIB_SSL, SSL_R_COMPRESSION_LIBRARY_ERROR},
+  #else
+    {"COMPRESSION_LIBRARY_ERROR", 20, 142},
+  #endif
+  #ifdef SSL_R_CONNECTION_TYPE_NOT_SET
+    {"CONNECTION_TYPE_NOT_SET", ERR_LIB_SSL, SSL_R_CONNECTION_TYPE_NOT_SET},
+  #else
+    {"CONNECTION_TYPE_NOT_SET", 20, 144},
+  #endif
+  #ifdef SSL_R_CONTEXT_NOT_DANE_ENABLED
+    {"CONTEXT_NOT_DANE_ENABLED", ERR_LIB_SSL, SSL_R_CONTEXT_NOT_DANE_ENABLED},
+  #else
+    {"CONTEXT_NOT_DANE_ENABLED", 20, 167},
+  #endif
+  #ifdef SSL_R_COOKIE_GEN_CALLBACK_FAILURE
+    {"COOKIE_GEN_CALLBACK_FAILURE", ERR_LIB_SSL, SSL_R_COOKIE_GEN_CALLBACK_FAILURE},
+  #else
+    {"COOKIE_GEN_CALLBACK_FAILURE", 20, 400},
+  #endif
+  #ifdef SSL_R_COOKIE_MISMATCH
+    {"COOKIE_MISMATCH", ERR_LIB_SSL, SSL_R_COOKIE_MISMATCH},
+  #else
+    {"COOKIE_MISMATCH", 20, 308},
+  #endif
+  #ifdef SSL_R_CUSTOM_EXT_HANDLER_ALREADY_INSTALLED
+    {"CUSTOM_EXT_HANDLER_ALREADY_INSTALLED", ERR_LIB_SSL, SSL_R_CUSTOM_EXT_HANDLER_ALREADY_INSTALLED},
+  #else
+    {"CUSTOM_EXT_HANDLER_ALREADY_INSTALLED", 20, 206},
+  #endif
+  #ifdef SSL_R_DANE_ALREADY_ENABLED
+    {"DANE_ALREADY_ENABLED", ERR_LIB_SSL, SSL_R_DANE_ALREADY_ENABLED},
+  #else
+    {"DANE_ALREADY_ENABLED", 20, 172},
+  #endif
+  #ifdef SSL_R_DANE_CANNOT_OVERRIDE_MTYPE_FULL
+    {"DANE_CANNOT_OVERRIDE_MTYPE_FULL", ERR_LIB_SSL, SSL_R_DANE_CANNOT_OVERRIDE_MTYPE_FULL},
+  #else
+    {"DANE_CANNOT_OVERRIDE_MTYPE_FULL", 20, 173},
+  #endif
+  #ifdef SSL_R_DANE_NOT_ENABLED
+    {"DANE_NOT_ENABLED", ERR_LIB_SSL, SSL_R_DANE_NOT_ENABLED},
+  #else
+    {"DANE_NOT_ENABLED", 20, 175},
+  #endif
+  #ifdef SSL_R_DANE_TLSA_BAD_CERTIFICATE
+    {"DANE_TLSA_BAD_CERTIFICATE", ERR_LIB_SSL, SSL_R_DANE_TLSA_BAD_CERTIFICATE},
+  #else
+    {"DANE_TLSA_BAD_CERTIFICATE", 20, 180},
+  #endif
+  #ifdef SSL_R_DANE_TLSA_BAD_CERTIFICATE_USAGE
+    {"DANE_TLSA_BAD_CERTIFICATE_USAGE", ERR_LIB_SSL, SSL_R_DANE_TLSA_BAD_CERTIFICATE_USAGE},
+  #else
+    {"DANE_TLSA_BAD_CERTIFICATE_USAGE", 20, 184},
+  #endif
+  #ifdef SSL_R_DANE_TLSA_BAD_DATA_LENGTH
+    {"DANE_TLSA_BAD_DATA_LENGTH", ERR_LIB_SSL, SSL_R_DANE_TLSA_BAD_DATA_LENGTH},
+  #else
+    {"DANE_TLSA_BAD_DATA_LENGTH", 20, 189},
+  #endif
+  #ifdef SSL_R_DANE_TLSA_BAD_DIGEST_LENGTH
+    {"DANE_TLSA_BAD_DIGEST_LENGTH", ERR_LIB_SSL, SSL_R_DANE_TLSA_BAD_DIGEST_LENGTH},
+  #else
+    {"DANE_TLSA_BAD_DIGEST_LENGTH", 20, 192},
+  #endif
+  #ifdef SSL_R_DANE_TLSA_BAD_MATCHING_TYPE
+    {"DANE_TLSA_BAD_MATCHING_TYPE", ERR_LIB_SSL, SSL_R_DANE_TLSA_BAD_MATCHING_TYPE},
+  #else
+    {"DANE_TLSA_BAD_MATCHING_TYPE", 20, 200},
+  #endif
+  #ifdef SSL_R_DANE_TLSA_BAD_PUBLIC_KEY
+    {"DANE_TLSA_BAD_PUBLIC_KEY", ERR_LIB_SSL, SSL_R_DANE_TLSA_BAD_PUBLIC_KEY},
+  #else
+    {"DANE_TLSA_BAD_PUBLIC_KEY", 20, 201},
+  #endif
+  #ifdef SSL_R_DANE_TLSA_BAD_SELECTOR
+    {"DANE_TLSA_BAD_SELECTOR", ERR_LIB_SSL, SSL_R_DANE_TLSA_BAD_SELECTOR},
+  #else
+    {"DANE_TLSA_BAD_SELECTOR", 20, 202},
+  #endif
+  #ifdef SSL_R_DANE_TLSA_NULL_DATA
+    {"DANE_TLSA_NULL_DATA", ERR_LIB_SSL, SSL_R_DANE_TLSA_NULL_DATA},
+  #else
+    {"DANE_TLSA_NULL_DATA", 20, 203},
+  #endif
+  #ifdef SSL_R_DATA_BETWEEN_CCS_AND_FINISHED
+    {"DATA_BETWEEN_CCS_AND_FINISHED", ERR_LIB_SSL, SSL_R_DATA_BETWEEN_CCS_AND_FINISHED},
+  #else
+    {"DATA_BETWEEN_CCS_AND_FINISHED", 20, 145},
+  #endif
+  #ifdef SSL_R_DATA_LENGTH_TOO_LONG
+    {"DATA_LENGTH_TOO_LONG", ERR_LIB_SSL, SSL_R_DATA_LENGTH_TOO_LONG},
+  #else
+    {"DATA_LENGTH_TOO_LONG", 20, 146},
+  #endif
+  #ifdef SSL_R_DECRYPTION_FAILED
+    {"DECRYPTION_FAILED", ERR_LIB_SSL, SSL_R_DECRYPTION_FAILED},
+  #else
+    {"DECRYPTION_FAILED", 20, 147},
+  #endif
+  #ifdef SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC
+    {"DECRYPTION_FAILED_OR_BAD_RECORD_MAC", ERR_LIB_SSL, SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC},
+  #else
+    {"DECRYPTION_FAILED_OR_BAD_RECORD_MAC", 20, 281},
+  #endif
+  #ifdef SSL_R_DH_KEY_TOO_SMALL
+    {"DH_KEY_TOO_SMALL", ERR_LIB_SSL, SSL_R_DH_KEY_TOO_SMALL},
+  #else
+    {"DH_KEY_TOO_SMALL", 20, 394},
+  #endif
+  #ifdef SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG
+    {"DH_PUBLIC_VALUE_LENGTH_IS_WRONG", ERR_LIB_SSL, SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG},
+  #else
+    {"DH_PUBLIC_VALUE_LENGTH_IS_WRONG", 20, 148},
+  #endif
+  #ifdef SSL_R_DIGEST_CHECK_FAILED
+    {"DIGEST_CHECK_FAILED", ERR_LIB_SSL, SSL_R_DIGEST_CHECK_FAILED},
+  #else
+    {"DIGEST_CHECK_FAILED", 20, 149},
+  #endif
+  #ifdef SSL_R_DTLS_MESSAGE_TOO_BIG
+    {"DTLS_MESSAGE_TOO_BIG", ERR_LIB_SSL, SSL_R_DTLS_MESSAGE_TOO_BIG},
+  #else
+    {"DTLS_MESSAGE_TOO_BIG", 20, 334},
+  #endif
+  #ifdef SSL_R_DUPLICATE_COMPRESSION_ID
+    {"DUPLICATE_COMPRESSION_ID", ERR_LIB_SSL, SSL_R_DUPLICATE_COMPRESSION_ID},
+  #else
+    {"DUPLICATE_COMPRESSION_ID", 20, 309},
+  #endif
+  #ifdef SSL_R_ECC_CERT_NOT_FOR_SIGNING
+    {"ECC_CERT_NOT_FOR_SIGNING", ERR_LIB_SSL, SSL_R_ECC_CERT_NOT_FOR_SIGNING},
+  #else
+    {"ECC_CERT_NOT_FOR_SIGNING", 20, 318},
+  #endif
+  #ifdef SSL_R_ECDH_REQUIRED_FOR_SUITEB_MODE
+    {"ECDH_REQUIRED_FOR_SUITEB_MODE", ERR_LIB_SSL, SSL_R_ECDH_REQUIRED_FOR_SUITEB_MODE},
+  #else
+    {"ECDH_REQUIRED_FOR_SUITEB_MODE", 20, 374},
+  #endif
+  #ifdef SSL_R_EE_KEY_TOO_SMALL
+    {"EE_KEY_TOO_SMALL", ERR_LIB_SSL, SSL_R_EE_KEY_TOO_SMALL},
+  #else
+    {"EE_KEY_TOO_SMALL", 20, 399},
+  #endif
+  #ifdef SSL_R_EMPTY_SRTP_PROTECTION_PROFILE_LIST
+    {"EMPTY_SRTP_PROTECTION_PROFILE_LIST", ERR_LIB_SSL, SSL_R_EMPTY_SRTP_PROTECTION_PROFILE_LIST},
+  #else
+    {"EMPTY_SRTP_PROTECTION_PROFILE_LIST", 20, 354},
+  #endif
+  #ifdef SSL_R_ENCRYPTED_LENGTH_TOO_LONG
+    {"ENCRYPTED_LENGTH_TOO_LONG", ERR_LIB_SSL, SSL_R_ENCRYPTED_LENGTH_TOO_LONG},
+  #else
+    {"ENCRYPTED_LENGTH_TOO_LONG", 20, 150},
+  #endif
+  #ifdef SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST
+    {"ERROR_IN_RECEIVED_CIPHER_LIST", ERR_LIB_SSL, SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST},
+  #else
+    {"ERROR_IN_RECEIVED_CIPHER_LIST", 20, 151},
+  #endif
+  #ifdef SSL_R_ERROR_SETTING_TLSA_BASE_DOMAIN
+    {"ERROR_SETTING_TLSA_BASE_DOMAIN", ERR_LIB_SSL, SSL_R_ERROR_SETTING_TLSA_BASE_DOMAIN},
+  #else
+    {"ERROR_SETTING_TLSA_BASE_DOMAIN", 20, 204},
+  #endif
+  #ifdef SSL_R_EXCEEDS_MAX_FRAGMENT_SIZE
+    {"EXCEEDS_MAX_FRAGMENT_SIZE", ERR_LIB_SSL, SSL_R_EXCEEDS_MAX_FRAGMENT_SIZE},
+  #else
+    {"EXCEEDS_MAX_FRAGMENT_SIZE", 20, 194},
+  #endif
+  #ifdef SSL_R_EXCESSIVE_MESSAGE_SIZE
+    {"EXCESSIVE_MESSAGE_SIZE", ERR_LIB_SSL, SSL_R_EXCESSIVE_MESSAGE_SIZE},
+  #else
+    {"EXCESSIVE_MESSAGE_SIZE", 20, 152},
+  #endif
+  #ifdef SSL_R_EXTENSION_NOT_RECEIVED
+    {"EXTENSION_NOT_RECEIVED", ERR_LIB_SSL, SSL_R_EXTENSION_NOT_RECEIVED},
+  #else
+    {"EXTENSION_NOT_RECEIVED", 20, 279},
+  #endif
+  #ifdef SSL_R_EXTRA_DATA_IN_MESSAGE
+    {"EXTRA_DATA_IN_MESSAGE", ERR_LIB_SSL, SSL_R_EXTRA_DATA_IN_MESSAGE},
+  #else
+    {"EXTRA_DATA_IN_MESSAGE", 20, 153},
+  #endif
+  #ifdef SSL_R_EXT_LENGTH_MISMATCH
+    {"EXT_LENGTH_MISMATCH", ERR_LIB_SSL, SSL_R_EXT_LENGTH_MISMATCH},
+  #else
+    {"EXT_LENGTH_MISMATCH", 20, 163},
+  #endif
+  #ifdef SSL_R_FAILED_TO_INIT_ASYNC
+    {"FAILED_TO_INIT_ASYNC", ERR_LIB_SSL, SSL_R_FAILED_TO_INIT_ASYNC},
+  #else
+    {"FAILED_TO_INIT_ASYNC", 20, 405},
+  #endif
+  #ifdef SSL_R_FRAGMENTED_CLIENT_HELLO
+    {"FRAGMENTED_CLIENT_HELLO", ERR_LIB_SSL, SSL_R_FRAGMENTED_CLIENT_HELLO},
+  #else
+    {"FRAGMENTED_CLIENT_HELLO", 20, 401},
+  #endif
+  #ifdef SSL_R_GOT_A_FIN_BEFORE_A_CCS
+    {"GOT_A_FIN_BEFORE_A_CCS", ERR_LIB_SSL, SSL_R_GOT_A_FIN_BEFORE_A_CCS},
+  #else
+    {"GOT_A_FIN_BEFORE_A_CCS", 20, 154},
+  #endif
+  #ifdef SSL_R_HTTPS_PROXY_REQUEST
+    {"HTTPS_PROXY_REQUEST", ERR_LIB_SSL, SSL_R_HTTPS_PROXY_REQUEST},
+  #else
+    {"HTTPS_PROXY_REQUEST", 20, 155},
+  #endif
+  #ifdef SSL_R_HTTP_REQUEST
+    {"HTTP_REQUEST", ERR_LIB_SSL, SSL_R_HTTP_REQUEST},
+  #else
+    {"HTTP_REQUEST", 20, 156},
+  #endif
+  #ifdef SSL_R_ILLEGAL_POINT_COMPRESSION
+    {"ILLEGAL_POINT_COMPRESSION", ERR_LIB_SSL, SSL_R_ILLEGAL_POINT_COMPRESSION},
+  #else
+    {"ILLEGAL_POINT_COMPRESSION", 20, 162},
+  #endif
+  #ifdef SSL_R_ILLEGAL_SUITEB_DIGEST
+    {"ILLEGAL_SUITEB_DIGEST", ERR_LIB_SSL, SSL_R_ILLEGAL_SUITEB_DIGEST},
+  #else
+    {"ILLEGAL_SUITEB_DIGEST", 20, 380},
+  #endif
+  #ifdef SSL_R_INAPPROPRIATE_FALLBACK
+    {"INAPPROPRIATE_FALLBACK", ERR_LIB_SSL, SSL_R_INAPPROPRIATE_FALLBACK},
+  #else
+    {"INAPPROPRIATE_FALLBACK", 20, 373},
+  #endif
+  #ifdef SSL_R_INCONSISTENT_COMPRESSION
+    {"INCONSISTENT_COMPRESSION", ERR_LIB_SSL, SSL_R_INCONSISTENT_COMPRESSION},
+  #else
+    {"INCONSISTENT_COMPRESSION", 20, 340},
+  #endif
+  #ifdef SSL_R_INCONSISTENT_EARLY_DATA_ALPN
+    {"INCONSISTENT_EARLY_DATA_ALPN", ERR_LIB_SSL, SSL_R_INCONSISTENT_EARLY_DATA_ALPN},
+  #else
+    {"INCONSISTENT_EARLY_DATA_ALPN", 20, 222},
+  #endif
+  #ifdef SSL_R_INCONSISTENT_EARLY_DATA_SNI
+    {"INCONSISTENT_EARLY_DATA_SNI", ERR_LIB_SSL, SSL_R_INCONSISTENT_EARLY_DATA_SNI},
+  #else
+    {"INCONSISTENT_EARLY_DATA_SNI", 20, 231},
+  #endif
+  #ifdef SSL_R_INCONSISTENT_EXTMS
+    {"INCONSISTENT_EXTMS", ERR_LIB_SSL, SSL_R_INCONSISTENT_EXTMS},
+  #else
+    {"INCONSISTENT_EXTMS", 20, 104},
+  #endif
+  #ifdef SSL_R_INSUFFICIENT_SECURITY
+    {"INSUFFICIENT_SECURITY", ERR_LIB_SSL, SSL_R_INSUFFICIENT_SECURITY},
+  #else
+    {"INSUFFICIENT_SECURITY", 20, 241},
+  #endif
+  #ifdef SSL_R_INVALID_ALERT
+    {"INVALID_ALERT", ERR_LIB_SSL, SSL_R_INVALID_ALERT},
+  #else
+    {"INVALID_ALERT", 20, 205},
+  #endif
+  #ifdef SSL_R_INVALID_CCS_MESSAGE
+    {"INVALID_CCS_MESSAGE", ERR_LIB_SSL, SSL_R_INVALID_CCS_MESSAGE},
+  #else
+    {"INVALID_CCS_MESSAGE", 20, 260},
+  #endif
+  #ifdef SSL_R_INVALID_CERTIFICATE_OR_ALG
+    {"INVALID_CERTIFICATE_OR_ALG", ERR_LIB_SSL, SSL_R_INVALID_CERTIFICATE_OR_ALG},
+  #else
+    {"INVALID_CERTIFICATE_OR_ALG", 20, 238},
+  #endif
+  #ifdef SSL_R_INVALID_COMMAND
+    {"INVALID_COMMAND", ERR_LIB_SSL, SSL_R_INVALID_COMMAND},
+  #else
+    {"INVALID_COMMAND", 20, 280},
+  #endif
+  #ifdef SSL_R_INVALID_COMPRESSION_ALGORITHM
+    {"INVALID_COMPRESSION_ALGORITHM", ERR_LIB_SSL, SSL_R_INVALID_COMPRESSION_ALGORITHM},
+  #else
+    {"INVALID_COMPRESSION_ALGORITHM", 20, 341},
+  #endif
+  #ifdef SSL_R_INVALID_CONFIG
+    {"INVALID_CONFIG", ERR_LIB_SSL, SSL_R_INVALID_CONFIG},
+  #else
+    {"INVALID_CONFIG", 20, 283},
+  #endif
+  #ifdef SSL_R_INVALID_CONFIGURATION_NAME
+    {"INVALID_CONFIGURATION_NAME", ERR_LIB_SSL, SSL_R_INVALID_CONFIGURATION_NAME},
+  #else
+    {"INVALID_CONFIGURATION_NAME", 20, 113},
+  #endif
+  #ifdef SSL_R_INVALID_CONTEXT
+    {"INVALID_CONTEXT", ERR_LIB_SSL, SSL_R_INVALID_CONTEXT},
+  #else
+    {"INVALID_CONTEXT", 20, 282},
+  #endif
+  #ifdef SSL_R_INVALID_CT_VALIDATION_TYPE
+    {"INVALID_CT_VALIDATION_TYPE", ERR_LIB_SSL, SSL_R_INVALID_CT_VALIDATION_TYPE},
+  #else
+    {"INVALID_CT_VALIDATION_TYPE", 20, 212},
+  #endif
+  #ifdef SSL_R_INVALID_KEY_UPDATE_TYPE
+    {"INVALID_KEY_UPDATE_TYPE", ERR_LIB_SSL, SSL_R_INVALID_KEY_UPDATE_TYPE},
+  #else
+    {"INVALID_KEY_UPDATE_TYPE", 20, 120},
+  #endif
+  #ifdef SSL_R_INVALID_MAX_EARLY_DATA
+    {"INVALID_MAX_EARLY_DATA", ERR_LIB_SSL, SSL_R_INVALID_MAX_EARLY_DATA},
+  #else
+    {"INVALID_MAX_EARLY_DATA", 20, 174},
+  #endif
+  #ifdef SSL_R_INVALID_NULL_CMD_NAME
+    {"INVALID_NULL_CMD_NAME", ERR_LIB_SSL, SSL_R_INVALID_NULL_CMD_NAME},
+  #else
+    {"INVALID_NULL_CMD_NAME", 20, 385},
+  #endif
+  #ifdef SSL_R_INVALID_SEQUENCE_NUMBER
+    {"INVALID_SEQUENCE_NUMBER", ERR_LIB_SSL, SSL_R_INVALID_SEQUENCE_NUMBER},
+  #else
+    {"INVALID_SEQUENCE_NUMBER", 20, 402},
+  #endif
+  #ifdef SSL_R_INVALID_SERVERINFO_DATA
+    {"INVALID_SERVERINFO_DATA", ERR_LIB_SSL, SSL_R_INVALID_SERVERINFO_DATA},
+  #else
+    {"INVALID_SERVERINFO_DATA", 20, 388},
+  #endif
+  #ifdef SSL_R_INVALID_SESSION_ID
+    {"INVALID_SESSION_ID", ERR_LIB_SSL, SSL_R_INVALID_SESSION_ID},
+  #else
+    {"INVALID_SESSION_ID", 20, 999},
+  #endif
+  #ifdef SSL_R_INVALID_SRP_USERNAME
+    {"INVALID_SRP_USERNAME", ERR_LIB_SSL, SSL_R_INVALID_SRP_USERNAME},
+  #else
+    {"INVALID_SRP_USERNAME", 20, 357},
+  #endif
+  #ifdef SSL_R_INVALID_STATUS_RESPONSE
+    {"INVALID_STATUS_RESPONSE", ERR_LIB_SSL, SSL_R_INVALID_STATUS_RESPONSE},
+  #else
+    {"INVALID_STATUS_RESPONSE", 20, 328},
+  #endif
+  #ifdef SSL_R_INVALID_TICKET_KEYS_LENGTH
+    {"INVALID_TICKET_KEYS_LENGTH", ERR_LIB_SSL, SSL_R_INVALID_TICKET_KEYS_LENGTH},
+  #else
+    {"INVALID_TICKET_KEYS_LENGTH", 20, 325},
+  #endif
+  #ifdef SSL_R_LENGTH_MISMATCH
+    {"LENGTH_MISMATCH", ERR_LIB_SSL, SSL_R_LENGTH_MISMATCH},
+  #else
+    {"LENGTH_MISMATCH", 20, 159},
+  #endif
+  #ifdef SSL_R_LENGTH_TOO_LONG
+    {"LENGTH_TOO_LONG", ERR_LIB_SSL, SSL_R_LENGTH_TOO_LONG},
+  #else
+    {"LENGTH_TOO_LONG", 20, 404},
+  #endif
+  #ifdef SSL_R_LENGTH_TOO_SHORT
+    {"LENGTH_TOO_SHORT", ERR_LIB_SSL, SSL_R_LENGTH_TOO_SHORT},
+  #else
+    {"LENGTH_TOO_SHORT", 20, 160},
+  #endif
+  #ifdef SSL_R_LIBRARY_BUG
+    {"LIBRARY_BUG", ERR_LIB_SSL, SSL_R_LIBRARY_BUG},
+  #else
+    {"LIBRARY_BUG", 20, 274},
+  #endif
+  #ifdef SSL_R_LIBRARY_HAS_NO_CIPHERS
+    {"LIBRARY_HAS_NO_CIPHERS", ERR_LIB_SSL, SSL_R_LIBRARY_HAS_NO_CIPHERS},
+  #else
+    {"LIBRARY_HAS_NO_CIPHERS", 20, 161},
+  #endif
+  #ifdef SSL_R_MISSING_DSA_SIGNING_CERT
+    {"MISSING_DSA_SIGNING_CERT", ERR_LIB_SSL, SSL_R_MISSING_DSA_SIGNING_CERT},
+  #else
+    {"MISSING_DSA_SIGNING_CERT", 20, 165},
+  #endif
+  #ifdef SSL_R_MISSING_ECDSA_SIGNING_CERT
+    {"MISSING_ECDSA_SIGNING_CERT", ERR_LIB_SSL, SSL_R_MISSING_ECDSA_SIGNING_CERT},
+  #else
+    {"MISSING_ECDSA_SIGNING_CERT", 20, 381},
+  #endif
+  #ifdef SSL_R_MISSING_FATAL
+    {"MISSING_FATAL", ERR_LIB_SSL, SSL_R_MISSING_FATAL},
+  #else
+    {"MISSING_FATAL", 20, 256},
+  #endif
+  #ifdef SSL_R_MISSING_PARAMETERS
+    {"MISSING_PARAMETERS", ERR_LIB_SSL, SSL_R_MISSING_PARAMETERS},
+  #else
+    {"MISSING_PARAMETERS", 20, 290},
+  #endif
+  #ifdef SSL_R_MISSING_RSA_CERTIFICATE
+    {"MISSING_RSA_CERTIFICATE", ERR_LIB_SSL, SSL_R_MISSING_RSA_CERTIFICATE},
+  #else
+    {"MISSING_RSA_CERTIFICATE", 20, 168},
+  #endif
+  #ifdef SSL_R_MISSING_RSA_ENCRYPTING_CERT
+    {"MISSING_RSA_ENCRYPTING_CERT", ERR_LIB_SSL, SSL_R_MISSING_RSA_ENCRYPTING_CERT},
+  #else
+    {"MISSING_RSA_ENCRYPTING_CERT", 20, 169},
+  #endif
+  #ifdef SSL_R_MISSING_RSA_SIGNING_CERT
+    {"MISSING_RSA_SIGNING_CERT", ERR_LIB_SSL, SSL_R_MISSING_RSA_SIGNING_CERT},
+  #else
+    {"MISSING_RSA_SIGNING_CERT", 20, 170},
+  #endif
+  #ifdef SSL_R_MISSING_SIGALGS_EXTENSION
+    {"MISSING_SIGALGS_EXTENSION", ERR_LIB_SSL, SSL_R_MISSING_SIGALGS_EXTENSION},
+  #else
+    {"MISSING_SIGALGS_EXTENSION", 20, 112},
+  #endif
+  #ifdef SSL_R_MISSING_SIGNING_CERT
+    {"MISSING_SIGNING_CERT", ERR_LIB_SSL, SSL_R_MISSING_SIGNING_CERT},
+  #else
+    {"MISSING_SIGNING_CERT", 20, 221},
+  #endif
+  #ifdef SSL_R_MISSING_SRP_PARAM
+    {"MISSING_SRP_PARAM", ERR_LIB_SSL, SSL_R_MISSING_SRP_PARAM},
+  #else
+    {"MISSING_SRP_PARAM", 20, 358},
+  #endif
+  #ifdef SSL_R_MISSING_SUPPORTED_GROUPS_EXTENSION
+    {"MISSING_SUPPORTED_GROUPS_EXTENSION", ERR_LIB_SSL, SSL_R_MISSING_SUPPORTED_GROUPS_EXTENSION},
+  #else
+    {"MISSING_SUPPORTED_GROUPS_EXTENSION", 20, 209},
+  #endif
+  #ifdef SSL_R_MISSING_TMP_DH_KEY
+    {"MISSING_TMP_DH_KEY", ERR_LIB_SSL, SSL_R_MISSING_TMP_DH_KEY},
+  #else
+    {"MISSING_TMP_DH_KEY", 20, 171},
+  #endif
+  #ifdef SSL_R_MISSING_TMP_ECDH_KEY
+    {"MISSING_TMP_ECDH_KEY", ERR_LIB_SSL, SSL_R_MISSING_TMP_ECDH_KEY},
+  #else
+    {"MISSING_TMP_ECDH_KEY", 20, 311},
+  #endif
+  #ifdef SSL_R_MIXED_HANDSHAKE_AND_NON_HANDSHAKE_DATA
+    {"MIXED_HANDSHAKE_AND_NON_HANDSHAKE_DATA", ERR_LIB_SSL, SSL_R_MIXED_HANDSHAKE_AND_NON_HANDSHAKE_DATA},
+  #else
+    {"MIXED_HANDSHAKE_AND_NON_HANDSHAKE_DATA", 20, 293},
+  #endif
+  #ifdef SSL_R_NOT_ON_RECORD_BOUNDARY
+    {"NOT_ON_RECORD_BOUNDARY", ERR_LIB_SSL, SSL_R_NOT_ON_RECORD_BOUNDARY},
+  #else
+    {"NOT_ON_RECORD_BOUNDARY", 20, 182},
+  #endif
+  #ifdef SSL_R_NOT_REPLACING_CERTIFICATE
+    {"NOT_REPLACING_CERTIFICATE", ERR_LIB_SSL, SSL_R_NOT_REPLACING_CERTIFICATE},
+  #else
+    {"NOT_REPLACING_CERTIFICATE", 20, 289},
+  #endif
+  #ifdef SSL_R_NOT_SERVER
+    {"NOT_SERVER", ERR_LIB_SSL, SSL_R_NOT_SERVER},
+  #else
+    {"NOT_SERVER", 20, 284},
+  #endif
+  #ifdef SSL_R_NO_APPLICATION_PROTOCOL
+    {"NO_APPLICATION_PROTOCOL", ERR_LIB_SSL, SSL_R_NO_APPLICATION_PROTOCOL},
+  #else
+    {"NO_APPLICATION_PROTOCOL", 20, 235},
+  #endif
+  #ifdef SSL_R_NO_CERTIFICATES_RETURNED
+    {"NO_CERTIFICATES_RETURNED", ERR_LIB_SSL, SSL_R_NO_CERTIFICATES_RETURNED},
+  #else
+    {"NO_CERTIFICATES_RETURNED", 20, 176},
+  #endif
+  #ifdef SSL_R_NO_CERTIFICATE_ASSIGNED
+    {"NO_CERTIFICATE_ASSIGNED", ERR_LIB_SSL, SSL_R_NO_CERTIFICATE_ASSIGNED},
+  #else
+    {"NO_CERTIFICATE_ASSIGNED", 20, 177},
+  #endif
+  #ifdef SSL_R_NO_CERTIFICATE_SET
+    {"NO_CERTIFICATE_SET", ERR_LIB_SSL, SSL_R_NO_CERTIFICATE_SET},
+  #else
+    {"NO_CERTIFICATE_SET", 20, 179},
+  #endif
+  #ifdef SSL_R_NO_CHANGE_FOLLOWING_HRR
+    {"NO_CHANGE_FOLLOWING_HRR", ERR_LIB_SSL, SSL_R_NO_CHANGE_FOLLOWING_HRR},
+  #else
+    {"NO_CHANGE_FOLLOWING_HRR", 20, 214},
+  #endif
+  #ifdef SSL_R_NO_CIPHERS_AVAILABLE
+    {"NO_CIPHERS_AVAILABLE", ERR_LIB_SSL, SSL_R_NO_CIPHERS_AVAILABLE},
+  #else
+    {"NO_CIPHERS_AVAILABLE", 20, 181},
+  #endif
+  #ifdef SSL_R_NO_CIPHERS_SPECIFIED
+    {"NO_CIPHERS_SPECIFIED", ERR_LIB_SSL, SSL_R_NO_CIPHERS_SPECIFIED},
+  #else
+    {"NO_CIPHERS_SPECIFIED", 20, 183},
+  #endif
+  #ifdef SSL_R_NO_CIPHER_MATCH
+    {"NO_CIPHER_MATCH", ERR_LIB_SSL, SSL_R_NO_CIPHER_MATCH},
+  #else
+    {"NO_CIPHER_MATCH", 20, 185},
+  #endif
+  #ifdef SSL_R_NO_CLIENT_CERT_METHOD
+    {"NO_CLIENT_CERT_METHOD", ERR_LIB_SSL, SSL_R_NO_CLIENT_CERT_METHOD},
+  #else
+    {"NO_CLIENT_CERT_METHOD", 20, 331},
+  #endif
+  #ifdef SSL_R_NO_COMPRESSION_SPECIFIED
+    {"NO_COMPRESSION_SPECIFIED", ERR_LIB_SSL, SSL_R_NO_COMPRESSION_SPECIFIED},
+  #else
+    {"NO_COMPRESSION_SPECIFIED", 20, 187},
+  #endif
+  #ifdef SSL_R_NO_COOKIE_CALLBACK_SET
+    {"NO_COOKIE_CALLBACK_SET", ERR_LIB_SSL, SSL_R_NO_COOKIE_CALLBACK_SET},
+  #else
+    {"NO_COOKIE_CALLBACK_SET", 20, 287},
+  #endif
+  #ifdef SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER
+    {"NO_GOST_CERTIFICATE_SENT_BY_PEER", ERR_LIB_SSL, SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER},
+  #else
+    {"NO_GOST_CERTIFICATE_SENT_BY_PEER", 20, 330},
+  #endif
+  #ifdef SSL_R_NO_METHOD_SPECIFIED
+    {"NO_METHOD_SPECIFIED", ERR_LIB_SSL, SSL_R_NO_METHOD_SPECIFIED},
+  #else
+    {"NO_METHOD_SPECIFIED", 20, 188},
+  #endif
+  #ifdef SSL_R_NO_PEM_EXTENSIONS
+    {"NO_PEM_EXTENSIONS", ERR_LIB_SSL, SSL_R_NO_PEM_EXTENSIONS},
+  #else
+    {"NO_PEM_EXTENSIONS", 20, 389},
+  #endif
+  #ifdef SSL_R_NO_PRIVATE_KEY_ASSIGNED
+    {"NO_PRIVATE_KEY_ASSIGNED", ERR_LIB_SSL, SSL_R_NO_PRIVATE_KEY_ASSIGNED},
+  #else
+    {"NO_PRIVATE_KEY_ASSIGNED", 20, 190},
+  #endif
+  #ifdef SSL_R_NO_PROTOCOLS_AVAILABLE
+    {"NO_PROTOCOLS_AVAILABLE", ERR_LIB_SSL, SSL_R_NO_PROTOCOLS_AVAILABLE},
+  #else
+    {"NO_PROTOCOLS_AVAILABLE", 20, 191},
+  #endif
+  #ifdef SSL_R_NO_RENEGOTIATION
+    {"NO_RENEGOTIATION", ERR_LIB_SSL, SSL_R_NO_RENEGOTIATION},
+  #else
+    {"NO_RENEGOTIATION", 20, 339},
+  #endif
+  #ifdef SSL_R_NO_REQUIRED_DIGEST
+    {"NO_REQUIRED_DIGEST", ERR_LIB_SSL, SSL_R_NO_REQUIRED_DIGEST},
+  #else
+    {"NO_REQUIRED_DIGEST", 20, 324},
+  #endif
+  #ifdef SSL_R_NO_SHARED_CIPHER
+    {"NO_SHARED_CIPHER", ERR_LIB_SSL, SSL_R_NO_SHARED_CIPHER},
+  #else
+    {"NO_SHARED_CIPHER", 20, 193},
+  #endif
+  #ifdef SSL_R_NO_SHARED_GROUPS
+    {"NO_SHARED_GROUPS", ERR_LIB_SSL, SSL_R_NO_SHARED_GROUPS},
+  #else
+    {"NO_SHARED_GROUPS", 20, 410},
+  #endif
+  #ifdef SSL_R_NO_SHARED_SIGNATURE_ALGORITHMS
+    {"NO_SHARED_SIGNATURE_ALGORITHMS", ERR_LIB_SSL, SSL_R_NO_SHARED_SIGNATURE_ALGORITHMS},
+  #else
+    {"NO_SHARED_SIGNATURE_ALGORITHMS", 20, 376},
+  #endif
+  #ifdef SSL_R_NO_SRTP_PROFILES
+    {"NO_SRTP_PROFILES", ERR_LIB_SSL, SSL_R_NO_SRTP_PROFILES},
+  #else
+    {"NO_SRTP_PROFILES", 20, 359},
+  #endif
+  #ifdef SSL_R_NO_SUITABLE_KEY_SHARE
+    {"NO_SUITABLE_KEY_SHARE", ERR_LIB_SSL, SSL_R_NO_SUITABLE_KEY_SHARE},
+  #else
+    {"NO_SUITABLE_KEY_SHARE", 20, 101},
+  #endif
+  #ifdef SSL_R_NO_SUITABLE_SIGNATURE_ALGORITHM
+    {"NO_SUITABLE_SIGNATURE_ALGORITHM", ERR_LIB_SSL, SSL_R_NO_SUITABLE_SIGNATURE_ALGORITHM},
+  #else
+    {"NO_SUITABLE_SIGNATURE_ALGORITHM", 20, 118},
+  #endif
+  #ifdef SSL_R_NO_VALID_SCTS
+    {"NO_VALID_SCTS", ERR_LIB_SSL, SSL_R_NO_VALID_SCTS},
+  #else
+    {"NO_VALID_SCTS", 20, 216},
+  #endif
+  #ifdef SSL_R_NO_VERIFY_COOKIE_CALLBACK
+    {"NO_VERIFY_COOKIE_CALLBACK", ERR_LIB_SSL, SSL_R_NO_VERIFY_COOKIE_CALLBACK},
+  #else
+    {"NO_VERIFY_COOKIE_CALLBACK", 20, 403},
+  #endif
+  #ifdef SSL_R_NULL_SSL_CTX
+    {"NULL_SSL_CTX", ERR_LIB_SSL, SSL_R_NULL_SSL_CTX},
+  #else
+    {"NULL_SSL_CTX", 20, 195},
+  #endif
+  #ifdef SSL_R_NULL_SSL_METHOD_PASSED
+    {"NULL_SSL_METHOD_PASSED", ERR_LIB_SSL, SSL_R_NULL_SSL_METHOD_PASSED},
+  #else
+    {"NULL_SSL_METHOD_PASSED", 20, 196},
+  #endif
+  #ifdef SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED
+    {"OLD_SESSION_CIPHER_NOT_RETURNED", ERR_LIB_SSL, SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED},
+  #else
+    {"OLD_SESSION_CIPHER_NOT_RETURNED", 20, 197},
+  #endif
+  #ifdef SSL_R_OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED
+    {"OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED", ERR_LIB_SSL, SSL_R_OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED},
+  #else
+    {"OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED", 20, 344},
+  #endif
+  #ifdef SSL_R_OVERFLOW_ERROR
+    {"OVERFLOW_ERROR", ERR_LIB_SSL, SSL_R_OVERFLOW_ERROR},
+  #else
+    {"OVERFLOW_ERROR", 20, 237},
+  #endif
+  #ifdef SSL_R_PACKET_LENGTH_TOO_LONG
+    {"PACKET_LENGTH_TOO_LONG", ERR_LIB_SSL, SSL_R_PACKET_LENGTH_TOO_LONG},
+  #else
+    {"PACKET_LENGTH_TOO_LONG", 20, 198},
+  #endif
+  #ifdef SSL_R_PARSE_TLSEXT
+    {"PARSE_TLSEXT", ERR_LIB_SSL, SSL_R_PARSE_TLSEXT},
+  #else
+    {"PARSE_TLSEXT", 20, 227},
+  #endif
+  #ifdef SSL_R_PATH_TOO_LONG
+    {"PATH_TOO_LONG", ERR_LIB_SSL, SSL_R_PATH_TOO_LONG},
+  #else
+    {"PATH_TOO_LONG", 20, 270},
+  #endif
+  #ifdef SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE
+    {"PEER_DID_NOT_RETURN_A_CERTIFICATE", ERR_LIB_SSL, SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE},
+  #else
+    {"PEER_DID_NOT_RETURN_A_CERTIFICATE", 20, 199},
+  #endif
+  #ifdef SSL_R_PEM_NAME_BAD_PREFIX
+    {"PEM_NAME_BAD_PREFIX", ERR_LIB_SSL, SSL_R_PEM_NAME_BAD_PREFIX},
+  #else
+    {"PEM_NAME_BAD_PREFIX", 20, 391},
+  #endif
+  #ifdef SSL_R_PEM_NAME_TOO_SHORT
+    {"PEM_NAME_TOO_SHORT", ERR_LIB_SSL, SSL_R_PEM_NAME_TOO_SHORT},
+  #else
+    {"PEM_NAME_TOO_SHORT", 20, 392},
+  #endif
+  #ifdef SSL_R_PIPELINE_FAILURE
+    {"PIPELINE_FAILURE", ERR_LIB_SSL, SSL_R_PIPELINE_FAILURE},
+  #else
+    {"PIPELINE_FAILURE", 20, 406},
+  #endif
+  #ifdef SSL_R_POST_HANDSHAKE_AUTH_ENCODING_ERR
+    {"POST_HANDSHAKE_AUTH_ENCODING_ERR", ERR_LIB_SSL, SSL_R_POST_HANDSHAKE_AUTH_ENCODING_ERR},
+  #else
+    {"POST_HANDSHAKE_AUTH_ENCODING_ERR", 20, 278},
+  #endif
+  #ifdef SSL_R_PRIVATE_KEY_MISMATCH
+    {"PRIVATE_KEY_MISMATCH", ERR_LIB_SSL, SSL_R_PRIVATE_KEY_MISMATCH},
+  #else
+    {"PRIVATE_KEY_MISMATCH", 20, 288},
+  #endif
+  #ifdef SSL_R_PROTOCOL_IS_SHUTDOWN
+    {"PROTOCOL_IS_SHUTDOWN", ERR_LIB_SSL, SSL_R_PROTOCOL_IS_SHUTDOWN},
+  #else
+    {"PROTOCOL_IS_SHUTDOWN", 20, 207},
+  #endif
+  #ifdef SSL_R_PSK_IDENTITY_NOT_FOUND
+    {"PSK_IDENTITY_NOT_FOUND", ERR_LIB_SSL, SSL_R_PSK_IDENTITY_NOT_FOUND},
+  #else
+    {"PSK_IDENTITY_NOT_FOUND", 20, 223},
+  #endif
+  #ifdef SSL_R_PSK_NO_CLIENT_CB
+    {"PSK_NO_CLIENT_CB", ERR_LIB_SSL, SSL_R_PSK_NO_CLIENT_CB},
+  #else
+    {"PSK_NO_CLIENT_CB", 20, 224},
+  #endif
+  #ifdef SSL_R_PSK_NO_SERVER_CB
+    {"PSK_NO_SERVER_CB", ERR_LIB_SSL, SSL_R_PSK_NO_SERVER_CB},
+  #else
+    {"PSK_NO_SERVER_CB", 20, 225},
+  #endif
+  #ifdef SSL_R_READ_BIO_NOT_SET
+    {"READ_BIO_NOT_SET", ERR_LIB_SSL, SSL_R_READ_BIO_NOT_SET},
+  #else
+    {"READ_BIO_NOT_SET", 20, 211},
+  #endif
+  #ifdef SSL_R_READ_TIMEOUT_EXPIRED
+    {"READ_TIMEOUT_EXPIRED", ERR_LIB_SSL, SSL_R_READ_TIMEOUT_EXPIRED},
+  #else
+    {"READ_TIMEOUT_EXPIRED", 20, 312},
+  #endif
+  #ifdef SSL_R_RECORD_LENGTH_MISMATCH
+    {"RECORD_LENGTH_MISMATCH", ERR_LIB_SSL, SSL_R_RECORD_LENGTH_MISMATCH},
+  #else
+    {"RECORD_LENGTH_MISMATCH", 20, 213},
+  #endif
+  #ifdef SSL_R_RECORD_TOO_SMALL
+    {"RECORD_TOO_SMALL", ERR_LIB_SSL, SSL_R_RECORD_TOO_SMALL},
+  #else
+    {"RECORD_TOO_SMALL", 20, 298},
+  #endif
+  #ifdef SSL_R_RENEGOTIATE_EXT_TOO_LONG
+    {"RENEGOTIATE_EXT_TOO_LONG", ERR_LIB_SSL, SSL_R_RENEGOTIATE_EXT_TOO_LONG},
+  #else
+    {"RENEGOTIATE_EXT_TOO_LONG", 20, 335},
+  #endif
+  #ifdef SSL_R_RENEGOTIATION_ENCODING_ERR
+    {"RENEGOTIATION_ENCODING_ERR", ERR_LIB_SSL, SSL_R_RENEGOTIATION_ENCODING_ERR},
+  #else
+    {"RENEGOTIATION_ENCODING_ERR", 20, 336},
+  #endif
+  #ifdef SSL_R_RENEGOTIATION_MISMATCH
+    {"RENEGOTIATION_MISMATCH", ERR_LIB_SSL, SSL_R_RENEGOTIATION_MISMATCH},
+  #else
+    {"RENEGOTIATION_MISMATCH", 20, 337},
+  #endif
+  #ifdef SSL_R_REQUEST_PENDING
+    {"REQUEST_PENDING", ERR_LIB_SSL, SSL_R_REQUEST_PENDING},
+  #else
+    {"REQUEST_PENDING", 20, 285},
+  #endif
+  #ifdef SSL_R_REQUEST_SENT
+    {"REQUEST_SENT", ERR_LIB_SSL, SSL_R_REQUEST_SENT},
+  #else
+    {"REQUEST_SENT", 20, 286},
+  #endif
+  #ifdef SSL_R_REQUIRED_CIPHER_MISSING
+    {"REQUIRED_CIPHER_MISSING", ERR_LIB_SSL, SSL_R_REQUIRED_CIPHER_MISSING},
+  #else
+    {"REQUIRED_CIPHER_MISSING", 20, 215},
+  #endif
+  #ifdef SSL_R_REQUIRED_COMPRESSION_ALGORITHM_MISSING
+    {"REQUIRED_COMPRESSION_ALGORITHM_MISSING", ERR_LIB_SSL, SSL_R_REQUIRED_COMPRESSION_ALGORITHM_MISSING},
+  #else
+    {"REQUIRED_COMPRESSION_ALGORITHM_MISSING", 20, 342},
+  #endif
+  #ifdef SSL_R_SCSV_RECEIVED_WHEN_RENEGOTIATING
+    {"SCSV_RECEIVED_WHEN_RENEGOTIATING", ERR_LIB_SSL, SSL_R_SCSV_RECEIVED_WHEN_RENEGOTIATING},
+  #else
+    {"SCSV_RECEIVED_WHEN_RENEGOTIATING", 20, 345},
+  #endif
+  #ifdef SSL_R_SCT_VERIFICATION_FAILED
+    {"SCT_VERIFICATION_FAILED", ERR_LIB_SSL, SSL_R_SCT_VERIFICATION_FAILED},
+  #else
+    {"SCT_VERIFICATION_FAILED", 20, 208},
+  #endif
+  #ifdef SSL_R_SERVERHELLO_TLSEXT
+    {"SERVERHELLO_TLSEXT", ERR_LIB_SSL, SSL_R_SERVERHELLO_TLSEXT},
+  #else
+    {"SERVERHELLO_TLSEXT", 20, 275},
+  #endif
+  #ifdef SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED
+    {"SESSION_ID_CONTEXT_UNINITIALIZED", ERR_LIB_SSL, SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED},
+  #else
+    {"SESSION_ID_CONTEXT_UNINITIALIZED", 20, 277},
+  #endif
+  #ifdef SSL_R_SHUTDOWN_WHILE_IN_INIT
+    {"SHUTDOWN_WHILE_IN_INIT", ERR_LIB_SSL, SSL_R_SHUTDOWN_WHILE_IN_INIT},
+  #else
+    {"SHUTDOWN_WHILE_IN_INIT", 20, 407},
+  #endif
+  #ifdef SSL_R_SIGNATURE_ALGORITHMS_ERROR
+    {"SIGNATURE_ALGORITHMS_ERROR", ERR_LIB_SSL, SSL_R_SIGNATURE_ALGORITHMS_ERROR},
+  #else
+    {"SIGNATURE_ALGORITHMS_ERROR", 20, 360},
+  #endif
+  #ifdef SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE
+    {"SIGNATURE_FOR_NON_SIGNING_CERTIFICATE", ERR_LIB_SSL, SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE},
+  #else
+    {"SIGNATURE_FOR_NON_SIGNING_CERTIFICATE", 20, 220},
+  #endif
+  #ifdef SSL_R_SRP_A_CALC
+    {"SRP_A_CALC", ERR_LIB_SSL, SSL_R_SRP_A_CALC},
+  #else
+    {"SRP_A_CALC", 20, 361},
+  #endif
+  #ifdef SSL_R_SRTP_COULD_NOT_ALLOCATE_PROFILES
+    {"SRTP_COULD_NOT_ALLOCATE_PROFILES", ERR_LIB_SSL, SSL_R_SRTP_COULD_NOT_ALLOCATE_PROFILES},
+  #else
+    {"SRTP_COULD_NOT_ALLOCATE_PROFILES", 20, 362},
+  #endif
+  #ifdef SSL_R_SRTP_PROTECTION_PROFILE_LIST_TOO_LONG
+    {"SRTP_PROTECTION_PROFILE_LIST_TOO_LONG", ERR_LIB_SSL, SSL_R_SRTP_PROTECTION_PROFILE_LIST_TOO_LONG},
+  #else
+    {"SRTP_PROTECTION_PROFILE_LIST_TOO_LONG", 20, 363},
+  #endif
+  #ifdef SSL_R_SRTP_UNKNOWN_PROTECTION_PROFILE
+    {"SRTP_UNKNOWN_PROTECTION_PROFILE", ERR_LIB_SSL, SSL_R_SRTP_UNKNOWN_PROTECTION_PROFILE},
+  #else
+    {"SRTP_UNKNOWN_PROTECTION_PROFILE", 20, 364},
+  #endif
+  #ifdef SSL_R_SSL3_EXT_INVALID_MAX_FRAGMENT_LENGTH
+    {"SSL3_EXT_INVALID_MAX_FRAGMENT_LENGTH", ERR_LIB_SSL, SSL_R_SSL3_EXT_INVALID_MAX_FRAGMENT_LENGTH},
+  #else
+    {"SSL3_EXT_INVALID_MAX_FRAGMENT_LENGTH", 20, 232},
+  #endif
+  #ifdef SSL_R_SSL3_EXT_INVALID_SERVERNAME
+    {"SSL3_EXT_INVALID_SERVERNAME", ERR_LIB_SSL, SSL_R_SSL3_EXT_INVALID_SERVERNAME},
+  #else
+    {"SSL3_EXT_INVALID_SERVERNAME", 20, 319},
+  #endif
+  #ifdef SSL_R_SSL3_EXT_INVALID_SERVERNAME_TYPE
+    {"SSL3_EXT_INVALID_SERVERNAME_TYPE", ERR_LIB_SSL, SSL_R_SSL3_EXT_INVALID_SERVERNAME_TYPE},
+  #else
+    {"SSL3_EXT_INVALID_SERVERNAME_TYPE", 20, 320},
+  #endif
+  #ifdef SSL_R_SSL3_SESSION_ID_TOO_LONG
+    {"SSL3_SESSION_ID_TOO_LONG", ERR_LIB_SSL, SSL_R_SSL3_SESSION_ID_TOO_LONG},
+  #else
+    {"SSL3_SESSION_ID_TOO_LONG", 20, 300},
+  #endif
+  #ifdef SSL_R_SSLV3_ALERT_BAD_CERTIFICATE
+    {"SSLV3_ALERT_BAD_CERTIFICATE", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_BAD_CERTIFICATE},
+  #else
+    {"SSLV3_ALERT_BAD_CERTIFICATE", 20, 1042},
+  #endif
+  #ifdef SSL_R_SSLV3_ALERT_BAD_RECORD_MAC
+    {"SSLV3_ALERT_BAD_RECORD_MAC", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_BAD_RECORD_MAC},
+  #else
+    {"SSLV3_ALERT_BAD_RECORD_MAC", 20, 1020},
+  #endif
+  #ifdef SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED
+    {"SSLV3_ALERT_CERTIFICATE_EXPIRED", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED},
+  #else
+    {"SSLV3_ALERT_CERTIFICATE_EXPIRED", 20, 1045},
+  #endif
+  #ifdef SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED
+    {"SSLV3_ALERT_CERTIFICATE_REVOKED", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED},
+  #else
+    {"SSLV3_ALERT_CERTIFICATE_REVOKED", 20, 1044},
+  #endif
+  #ifdef SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN
+    {"SSLV3_ALERT_CERTIFICATE_UNKNOWN", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN},
+  #else
+    {"SSLV3_ALERT_CERTIFICATE_UNKNOWN", 20, 1046},
+  #endif
+  #ifdef SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE
+    {"SSLV3_ALERT_DECOMPRESSION_FAILURE", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE},
+  #else
+    {"SSLV3_ALERT_DECOMPRESSION_FAILURE", 20, 1030},
+  #endif
+  #ifdef SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE
+    {"SSLV3_ALERT_HANDSHAKE_FAILURE", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE},
+  #else
+    {"SSLV3_ALERT_HANDSHAKE_FAILURE", 20, 1040},
+  #endif
+  #ifdef SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER
+    {"SSLV3_ALERT_ILLEGAL_PARAMETER", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER},
+  #else
+    {"SSLV3_ALERT_ILLEGAL_PARAMETER", 20, 1047},
+  #endif
+  #ifdef SSL_R_SSLV3_ALERT_NO_CERTIFICATE
+    {"SSLV3_ALERT_NO_CERTIFICATE", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_NO_CERTIFICATE},
+  #else
+    {"SSLV3_ALERT_NO_CERTIFICATE", 20, 1041},
+  #endif
+  #ifdef SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE
+    {"SSLV3_ALERT_UNEXPECTED_MESSAGE", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE},
+  #else
+    {"SSLV3_ALERT_UNEXPECTED_MESSAGE", 20, 1010},
+  #endif
+  #ifdef SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE
+    {"SSLV3_ALERT_UNSUPPORTED_CERTIFICATE", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE},
+  #else
+    {"SSLV3_ALERT_UNSUPPORTED_CERTIFICATE", 20, 1043},
+  #endif
+  #ifdef SSL_R_SSL_COMMAND_SECTION_EMPTY
+    {"SSL_COMMAND_SECTION_EMPTY", ERR_LIB_SSL, SSL_R_SSL_COMMAND_SECTION_EMPTY},
+  #else
+    {"SSL_COMMAND_SECTION_EMPTY", 20, 117},
+  #endif
+  #ifdef SSL_R_SSL_COMMAND_SECTION_NOT_FOUND
+    {"SSL_COMMAND_SECTION_NOT_FOUND", ERR_LIB_SSL, SSL_R_SSL_COMMAND_SECTION_NOT_FOUND},
+  #else
+    {"SSL_COMMAND_SECTION_NOT_FOUND", 20, 125},
+  #endif
+  #ifdef SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION
+    {"SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION", ERR_LIB_SSL, SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION},
+  #else
+    {"SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION", 20, 228},
+  #endif
+  #ifdef SSL_R_SSL_HANDSHAKE_FAILURE
+    {"SSL_HANDSHAKE_FAILURE", ERR_LIB_SSL, SSL_R_SSL_HANDSHAKE_FAILURE},
+  #else
+    {"SSL_HANDSHAKE_FAILURE", 20, 229},
+  #endif
+  #ifdef SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS
+    {"SSL_LIBRARY_HAS_NO_CIPHERS", ERR_LIB_SSL, SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS},
+  #else
+    {"SSL_LIBRARY_HAS_NO_CIPHERS", 20, 230},
+  #endif
+  #ifdef SSL_R_SSL_NEGATIVE_LENGTH
+    {"SSL_NEGATIVE_LENGTH", ERR_LIB_SSL, SSL_R_SSL_NEGATIVE_LENGTH},
+  #else
+    {"SSL_NEGATIVE_LENGTH", 20, 372},
+  #endif
+  #ifdef SSL_R_SSL_SECTION_EMPTY
+    {"SSL_SECTION_EMPTY", ERR_LIB_SSL, SSL_R_SSL_SECTION_EMPTY},
+  #else
+    {"SSL_SECTION_EMPTY", 20, 126},
+  #endif
+  #ifdef SSL_R_SSL_SECTION_NOT_FOUND
+    {"SSL_SECTION_NOT_FOUND", ERR_LIB_SSL, SSL_R_SSL_SECTION_NOT_FOUND},
+  #else
+    {"SSL_SECTION_NOT_FOUND", 20, 136},
+  #endif
+  #ifdef SSL_R_SSL_SESSION_ID_CALLBACK_FAILED
+    {"SSL_SESSION_ID_CALLBACK_FAILED", ERR_LIB_SSL, SSL_R_SSL_SESSION_ID_CALLBACK_FAILED},
+  #else
+    {"SSL_SESSION_ID_CALLBACK_FAILED", 20, 301},
+  #endif
+  #ifdef SSL_R_SSL_SESSION_ID_CONFLICT
+    {"SSL_SESSION_ID_CONFLICT", ERR_LIB_SSL, SSL_R_SSL_SESSION_ID_CONFLICT},
+  #else
+    {"SSL_SESSION_ID_CONFLICT", 20, 302},
+  #endif
+  #ifdef SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG
+    {"SSL_SESSION_ID_CONTEXT_TOO_LONG", ERR_LIB_SSL, SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG},
+  #else
+    {"SSL_SESSION_ID_CONTEXT_TOO_LONG", 20, 273},
+  #endif
+  #ifdef SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH
+    {"SSL_SESSION_ID_HAS_BAD_LENGTH", ERR_LIB_SSL, SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH},
+  #else
+    {"SSL_SESSION_ID_HAS_BAD_LENGTH", 20, 303},
+  #endif
+  #ifdef SSL_R_SSL_SESSION_ID_TOO_LONG
+    {"SSL_SESSION_ID_TOO_LONG", ERR_LIB_SSL, SSL_R_SSL_SESSION_ID_TOO_LONG},
+  #else
+    {"SSL_SESSION_ID_TOO_LONG", 20, 408},
+  #endif
+  #ifdef SSL_R_SSL_SESSION_VERSION_MISMATCH
+    {"SSL_SESSION_VERSION_MISMATCH", ERR_LIB_SSL, SSL_R_SSL_SESSION_VERSION_MISMATCH},
+  #else
+    {"SSL_SESSION_VERSION_MISMATCH", 20, 210},
+  #endif
+  #ifdef SSL_R_STILL_IN_INIT
+    {"STILL_IN_INIT", ERR_LIB_SSL, SSL_R_STILL_IN_INIT},
+  #else
+    {"STILL_IN_INIT", 20, 121},
+  #endif
+  #ifdef SSL_R_TLSV13_ALERT_CERTIFICATE_REQUIRED
+    {"TLSV13_ALERT_CERTIFICATE_REQUIRED", ERR_LIB_SSL, SSL_R_TLSV13_ALERT_CERTIFICATE_REQUIRED},
+  #else
+    {"TLSV13_ALERT_CERTIFICATE_REQUIRED", 20, 1116},
+  #endif
+  #ifdef SSL_R_TLSV13_ALERT_MISSING_EXTENSION
+    {"TLSV13_ALERT_MISSING_EXTENSION", ERR_LIB_SSL, SSL_R_TLSV13_ALERT_MISSING_EXTENSION},
+  #else
+    {"TLSV13_ALERT_MISSING_EXTENSION", 20, 1109},
+  #endif
+  #ifdef SSL_R_TLSV1_ALERT_ACCESS_DENIED
+    {"TLSV1_ALERT_ACCESS_DENIED", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_ACCESS_DENIED},
+  #else
+    {"TLSV1_ALERT_ACCESS_DENIED", 20, 1049},
+  #endif
+  #ifdef SSL_R_TLSV1_ALERT_DECODE_ERROR
+    {"TLSV1_ALERT_DECODE_ERROR", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_DECODE_ERROR},
+  #else
+    {"TLSV1_ALERT_DECODE_ERROR", 20, 1050},
+  #endif
+  #ifdef SSL_R_TLSV1_ALERT_DECRYPTION_FAILED
+    {"TLSV1_ALERT_DECRYPTION_FAILED", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_DECRYPTION_FAILED},
+  #else
+    {"TLSV1_ALERT_DECRYPTION_FAILED", 20, 1021},
+  #endif
+  #ifdef SSL_R_TLSV1_ALERT_DECRYPT_ERROR
+    {"TLSV1_ALERT_DECRYPT_ERROR", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_DECRYPT_ERROR},
+  #else
+    {"TLSV1_ALERT_DECRYPT_ERROR", 20, 1051},
+  #endif
+  #ifdef SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION
+    {"TLSV1_ALERT_EXPORT_RESTRICTION", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION},
+  #else
+    {"TLSV1_ALERT_EXPORT_RESTRICTION", 20, 1060},
+  #endif
+  #ifdef SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK
+    {"TLSV1_ALERT_INAPPROPRIATE_FALLBACK", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK},
+  #else
+    {"TLSV1_ALERT_INAPPROPRIATE_FALLBACK", 20, 1086},
+  #endif
+  #ifdef SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY
+    {"TLSV1_ALERT_INSUFFICIENT_SECURITY", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY},
+  #else
+    {"TLSV1_ALERT_INSUFFICIENT_SECURITY", 20, 1071},
+  #endif
+  #ifdef SSL_R_TLSV1_ALERT_INTERNAL_ERROR
+    {"TLSV1_ALERT_INTERNAL_ERROR", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_INTERNAL_ERROR},
+  #else
+    {"TLSV1_ALERT_INTERNAL_ERROR", 20, 1080},
+  #endif
+  #ifdef SSL_R_TLSV1_ALERT_NO_RENEGOTIATION
+    {"TLSV1_ALERT_NO_RENEGOTIATION", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_NO_RENEGOTIATION},
+  #else
+    {"TLSV1_ALERT_NO_RENEGOTIATION", 20, 1100},
+  #endif
+  #ifdef SSL_R_TLSV1_ALERT_PROTOCOL_VERSION
+    {"TLSV1_ALERT_PROTOCOL_VERSION", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_PROTOCOL_VERSION},
+  #else
+    {"TLSV1_ALERT_PROTOCOL_VERSION", 20, 1070},
+  #endif
+  #ifdef SSL_R_TLSV1_ALERT_RECORD_OVERFLOW
+    {"TLSV1_ALERT_RECORD_OVERFLOW", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_RECORD_OVERFLOW},
+  #else
+    {"TLSV1_ALERT_RECORD_OVERFLOW", 20, 1022},
+  #endif
+  #ifdef SSL_R_TLSV1_ALERT_UNKNOWN_CA
+    {"TLSV1_ALERT_UNKNOWN_CA", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_UNKNOWN_CA},
+  #else
+    {"TLSV1_ALERT_UNKNOWN_CA", 20, 1048},
+  #endif
+  #ifdef SSL_R_TLSV1_ALERT_USER_CANCELLED
+    {"TLSV1_ALERT_USER_CANCELLED", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_USER_CANCELLED},
+  #else
+    {"TLSV1_ALERT_USER_CANCELLED", 20, 1090},
+  #endif
+  #ifdef SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE
+    {"TLSV1_BAD_CERTIFICATE_HASH_VALUE", ERR_LIB_SSL, SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE},
+  #else
+    {"TLSV1_BAD_CERTIFICATE_HASH_VALUE", 20, 1114},
+  #endif
+  #ifdef SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE
+    {"TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE", ERR_LIB_SSL, SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE},
+  #else
+    {"TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE", 20, 1113},
+  #endif
+  #ifdef SSL_R_TLSV1_CERTIFICATE_UNOBTAINABLE
+    {"TLSV1_CERTIFICATE_UNOBTAINABLE", ERR_LIB_SSL, SSL_R_TLSV1_CERTIFICATE_UNOBTAINABLE},
+  #else
+    {"TLSV1_CERTIFICATE_UNOBTAINABLE", 20, 1111},
+  #endif
+  #ifdef SSL_R_TLSV1_UNRECOGNIZED_NAME
+    {"TLSV1_UNRECOGNIZED_NAME", ERR_LIB_SSL, SSL_R_TLSV1_UNRECOGNIZED_NAME},
+  #else
+    {"TLSV1_UNRECOGNIZED_NAME", 20, 1112},
+  #endif
+  #ifdef SSL_R_TLSV1_UNSUPPORTED_EXTENSION
+    {"TLSV1_UNSUPPORTED_EXTENSION", ERR_LIB_SSL, SSL_R_TLSV1_UNSUPPORTED_EXTENSION},
+  #else
+    {"TLSV1_UNSUPPORTED_EXTENSION", 20, 1110},
+  #endif
+  #ifdef SSL_R_TLS_HEARTBEAT_PEER_DOESNT_ACCEPT
+    {"TLS_HEARTBEAT_PEER_DOESNT_ACCEPT", ERR_LIB_SSL, SSL_R_TLS_HEARTBEAT_PEER_DOESNT_ACCEPT},
+  #else
+    {"TLS_HEARTBEAT_PEER_DOESNT_ACCEPT", 20, 365},
+  #endif
+  #ifdef SSL_R_TLS_HEARTBEAT_PENDING
+    {"TLS_HEARTBEAT_PENDING", ERR_LIB_SSL, SSL_R_TLS_HEARTBEAT_PENDING},
+  #else
+    {"TLS_HEARTBEAT_PENDING", 20, 366},
+  #endif
+  #ifdef SSL_R_TLS_ILLEGAL_EXPORTER_LABEL
+    {"TLS_ILLEGAL_EXPORTER_LABEL", ERR_LIB_SSL, SSL_R_TLS_ILLEGAL_EXPORTER_LABEL},
+  #else
+    {"TLS_ILLEGAL_EXPORTER_LABEL", 20, 367},
+  #endif
+  #ifdef SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST
+    {"TLS_INVALID_ECPOINTFORMAT_LIST", ERR_LIB_SSL, SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST},
+  #else
+    {"TLS_INVALID_ECPOINTFORMAT_LIST", 20, 157},
+  #endif
+  #ifdef SSL_R_TOO_MANY_KEY_UPDATES
+    {"TOO_MANY_KEY_UPDATES", ERR_LIB_SSL, SSL_R_TOO_MANY_KEY_UPDATES},
+  #else
+    {"TOO_MANY_KEY_UPDATES", 20, 132},
+  #endif
+  #ifdef SSL_R_TOO_MANY_WARN_ALERTS
+    {"TOO_MANY_WARN_ALERTS", ERR_LIB_SSL, SSL_R_TOO_MANY_WARN_ALERTS},
+  #else
+    {"TOO_MANY_WARN_ALERTS", 20, 409},
+  #endif
+  #ifdef SSL_R_TOO_MUCH_EARLY_DATA
+    {"TOO_MUCH_EARLY_DATA", ERR_LIB_SSL, SSL_R_TOO_MUCH_EARLY_DATA},
+  #else
+    {"TOO_MUCH_EARLY_DATA", 20, 164},
+  #endif
+  #ifdef SSL_R_UNABLE_TO_FIND_ECDH_PARAMETERS
+    {"UNABLE_TO_FIND_ECDH_PARAMETERS", ERR_LIB_SSL, SSL_R_UNABLE_TO_FIND_ECDH_PARAMETERS},
+  #else
+    {"UNABLE_TO_FIND_ECDH_PARAMETERS", 20, 314},
+  #endif
+  #ifdef SSL_R_UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS
+    {"UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS", ERR_LIB_SSL, SSL_R_UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS},
+  #else
+    {"UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS", 20, 239},
+  #endif
+  #ifdef SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES
+    {"UNABLE_TO_LOAD_SSL3_MD5_ROUTINES", ERR_LIB_SSL, SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES},
+  #else
+    {"UNABLE_TO_LOAD_SSL3_MD5_ROUTINES", 20, 242},
+  #endif
+  #ifdef SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES
+    {"UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES", ERR_LIB_SSL, SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES},
+  #else
+    {"UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES", 20, 243},
+  #endif
+  #ifdef SSL_R_UNEXPECTED_CCS_MESSAGE
+    {"UNEXPECTED_CCS_MESSAGE", ERR_LIB_SSL, SSL_R_UNEXPECTED_CCS_MESSAGE},
+  #else
+    {"UNEXPECTED_CCS_MESSAGE", 20, 262},
+  #endif
+  #ifdef SSL_R_UNEXPECTED_END_OF_EARLY_DATA
+    {"UNEXPECTED_END_OF_EARLY_DATA", ERR_LIB_SSL, SSL_R_UNEXPECTED_END_OF_EARLY_DATA},
+  #else
+    {"UNEXPECTED_END_OF_EARLY_DATA", 20, 178},
+  #endif
+  #ifdef SSL_R_UNEXPECTED_MESSAGE
+    {"UNEXPECTED_MESSAGE", ERR_LIB_SSL, SSL_R_UNEXPECTED_MESSAGE},
+  #else
+    {"UNEXPECTED_MESSAGE", 20, 244},
+  #endif
+  #ifdef SSL_R_UNEXPECTED_RECORD
+    {"UNEXPECTED_RECORD", ERR_LIB_SSL, SSL_R_UNEXPECTED_RECORD},
+  #else
+    {"UNEXPECTED_RECORD", 20, 245},
+  #endif
+  #ifdef SSL_R_UNINITIALIZED
+    {"UNINITIALIZED", ERR_LIB_SSL, SSL_R_UNINITIALIZED},
+  #else
+    {"UNINITIALIZED", 20, 276},
+  #endif
+  #ifdef SSL_R_UNKNOWN_ALERT_TYPE
+    {"UNKNOWN_ALERT_TYPE", ERR_LIB_SSL, SSL_R_UNKNOWN_ALERT_TYPE},
+  #else
+    {"UNKNOWN_ALERT_TYPE", 20, 246},
+  #endif
+  #ifdef SSL_R_UNKNOWN_CERTIFICATE_TYPE
+    {"UNKNOWN_CERTIFICATE_TYPE", ERR_LIB_SSL, SSL_R_UNKNOWN_CERTIFICATE_TYPE},
+  #else
+    {"UNKNOWN_CERTIFICATE_TYPE", 20, 247},
+  #endif
+  #ifdef SSL_R_UNKNOWN_CIPHER_RETURNED
+    {"UNKNOWN_CIPHER_RETURNED", ERR_LIB_SSL, SSL_R_UNKNOWN_CIPHER_RETURNED},
+  #else
+    {"UNKNOWN_CIPHER_RETURNED", 20, 248},
+  #endif
+  #ifdef SSL_R_UNKNOWN_CIPHER_TYPE
+    {"UNKNOWN_CIPHER_TYPE", ERR_LIB_SSL, SSL_R_UNKNOWN_CIPHER_TYPE},
+  #else
+    {"UNKNOWN_CIPHER_TYPE", 20, 249},
+  #endif
+  #ifdef SSL_R_UNKNOWN_CMD_NAME
+    {"UNKNOWN_CMD_NAME", ERR_LIB_SSL, SSL_R_UNKNOWN_CMD_NAME},
+  #else
+    {"UNKNOWN_CMD_NAME", 20, 386},
+  #endif
+  #ifdef SSL_R_UNKNOWN_COMMAND
+    {"UNKNOWN_COMMAND", ERR_LIB_SSL, SSL_R_UNKNOWN_COMMAND},
+  #else
+    {"UNKNOWN_COMMAND", 20, 139},
+  #endif
+  #ifdef SSL_R_UNKNOWN_DIGEST
+    {"UNKNOWN_DIGEST", ERR_LIB_SSL, SSL_R_UNKNOWN_DIGEST},
+  #else
+    {"UNKNOWN_DIGEST", 20, 368},
+  #endif
+  #ifdef SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE
+    {"UNKNOWN_KEY_EXCHANGE_TYPE", ERR_LIB_SSL, SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE},
+  #else
+    {"UNKNOWN_KEY_EXCHANGE_TYPE", 20, 250},
+  #endif
+  #ifdef SSL_R_UNKNOWN_PKEY_TYPE
+    {"UNKNOWN_PKEY_TYPE", ERR_LIB_SSL, SSL_R_UNKNOWN_PKEY_TYPE},
+  #else
+    {"UNKNOWN_PKEY_TYPE", 20, 251},
+  #endif
+  #ifdef SSL_R_UNKNOWN_PROTOCOL
+    {"UNKNOWN_PROTOCOL", ERR_LIB_SSL, SSL_R_UNKNOWN_PROTOCOL},
+  #else
+    {"UNKNOWN_PROTOCOL", 20, 252},
+  #endif
+  #ifdef SSL_R_UNKNOWN_SSL_VERSION
+    {"UNKNOWN_SSL_VERSION", ERR_LIB_SSL, SSL_R_UNKNOWN_SSL_VERSION},
+  #else
+    {"UNKNOWN_SSL_VERSION", 20, 254},
+  #endif
+  #ifdef SSL_R_UNKNOWN_STATE
+    {"UNKNOWN_STATE", ERR_LIB_SSL, SSL_R_UNKNOWN_STATE},
+  #else
+    {"UNKNOWN_STATE", 20, 255},
+  #endif
+  #ifdef SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED
+    {"UNSAFE_LEGACY_RENEGOTIATION_DISABLED", ERR_LIB_SSL, SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED},
+  #else
+    {"UNSAFE_LEGACY_RENEGOTIATION_DISABLED", 20, 338},
+  #endif
+  #ifdef SSL_R_UNSOLICITED_EXTENSION
+    {"UNSOLICITED_EXTENSION", ERR_LIB_SSL, SSL_R_UNSOLICITED_EXTENSION},
+  #else
+    {"UNSOLICITED_EXTENSION", 20, 217},
+  #endif
+  #ifdef SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM
+    {"UNSUPPORTED_COMPRESSION_ALGORITHM", ERR_LIB_SSL, SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM},
+  #else
+    {"UNSUPPORTED_COMPRESSION_ALGORITHM", 20, 257},
+  #endif
+  #ifdef SSL_R_UNSUPPORTED_ELLIPTIC_CURVE
+    {"UNSUPPORTED_ELLIPTIC_CURVE", ERR_LIB_SSL, SSL_R_UNSUPPORTED_ELLIPTIC_CURVE},
+  #else
+    {"UNSUPPORTED_ELLIPTIC_CURVE", 20, 315},
+  #endif
+  #ifdef SSL_R_UNSUPPORTED_PROTOCOL
+    {"UNSUPPORTED_PROTOCOL", ERR_LIB_SSL, SSL_R_UNSUPPORTED_PROTOCOL},
+  #else
+    {"UNSUPPORTED_PROTOCOL", 20, 258},
+  #endif
+  #ifdef SSL_R_UNSUPPORTED_SSL_VERSION
+    {"UNSUPPORTED_SSL_VERSION", ERR_LIB_SSL, SSL_R_UNSUPPORTED_SSL_VERSION},
+  #else
+    {"UNSUPPORTED_SSL_VERSION", 20, 259},
+  #endif
+  #ifdef SSL_R_UNSUPPORTED_STATUS_TYPE
+    {"UNSUPPORTED_STATUS_TYPE", ERR_LIB_SSL, SSL_R_UNSUPPORTED_STATUS_TYPE},
+  #else
+    {"UNSUPPORTED_STATUS_TYPE", 20, 329},
+  #endif
+  #ifdef SSL_R_USE_SRTP_NOT_NEGOTIATED
+    {"USE_SRTP_NOT_NEGOTIATED", ERR_LIB_SSL, SSL_R_USE_SRTP_NOT_NEGOTIATED},
+  #else
+    {"USE_SRTP_NOT_NEGOTIATED", 20, 369},
+  #endif
+  #ifdef SSL_R_VERSION_TOO_HIGH
+    {"VERSION_TOO_HIGH", ERR_LIB_SSL, SSL_R_VERSION_TOO_HIGH},
+  #else
+    {"VERSION_TOO_HIGH", 20, 166},
+  #endif
+  #ifdef SSL_R_VERSION_TOO_LOW
+    {"VERSION_TOO_LOW", ERR_LIB_SSL, SSL_R_VERSION_TOO_LOW},
+  #else
+    {"VERSION_TOO_LOW", 20, 396},
+  #endif
+  #ifdef SSL_R_WRONG_CERTIFICATE_TYPE
+    {"WRONG_CERTIFICATE_TYPE", ERR_LIB_SSL, SSL_R_WRONG_CERTIFICATE_TYPE},
+  #else
+    {"WRONG_CERTIFICATE_TYPE", 20, 383},
+  #endif
+  #ifdef SSL_R_WRONG_CIPHER_RETURNED
+    {"WRONG_CIPHER_RETURNED", ERR_LIB_SSL, SSL_R_WRONG_CIPHER_RETURNED},
+  #else
+    {"WRONG_CIPHER_RETURNED", 20, 261},
+  #endif
+  #ifdef SSL_R_WRONG_CURVE
+    {"WRONG_CURVE", ERR_LIB_SSL, SSL_R_WRONG_CURVE},
+  #else
+    {"WRONG_CURVE", 20, 378},
+  #endif
+  #ifdef SSL_R_WRONG_SIGNATURE_LENGTH
+    {"WRONG_SIGNATURE_LENGTH", ERR_LIB_SSL, SSL_R_WRONG_SIGNATURE_LENGTH},
+  #else
+    {"WRONG_SIGNATURE_LENGTH", 20, 264},
+  #endif
+  #ifdef SSL_R_WRONG_SIGNATURE_SIZE
+    {"WRONG_SIGNATURE_SIZE", ERR_LIB_SSL, SSL_R_WRONG_SIGNATURE_SIZE},
+  #else
+    {"WRONG_SIGNATURE_SIZE", 20, 265},
+  #endif
+  #ifdef SSL_R_WRONG_SIGNATURE_TYPE
+    {"WRONG_SIGNATURE_TYPE", ERR_LIB_SSL, SSL_R_WRONG_SIGNATURE_TYPE},
+  #else
+    {"WRONG_SIGNATURE_TYPE", 20, 370},
+  #endif
+  #ifdef SSL_R_WRONG_SSL_VERSION
+    {"WRONG_SSL_VERSION", ERR_LIB_SSL, SSL_R_WRONG_SSL_VERSION},
+  #else
+    {"WRONG_SSL_VERSION", 20, 266},
+  #endif
+  #ifdef SSL_R_WRONG_VERSION_NUMBER
+    {"WRONG_VERSION_NUMBER", ERR_LIB_SSL, SSL_R_WRONG_VERSION_NUMBER},
+  #else
+    {"WRONG_VERSION_NUMBER", 20, 267},
+  #endif
+  #ifdef SSL_R_X509_LIB
+    {"X509_LIB", ERR_LIB_SSL, SSL_R_X509_LIB},
+  #else
+    {"X509_LIB", 20, 268},
+  #endif
+  #ifdef SSL_R_X509_VERIFICATION_SETUP_PROBLEMS
+    {"X509_VERIFICATION_SETUP_PROBLEMS", ERR_LIB_SSL, SSL_R_X509_VERIFICATION_SETUP_PROBLEMS},
+  #else
+    {"X509_VERIFICATION_SETUP_PROBLEMS", 20, 269},
+  #endif
+  #ifdef TS_R_BAD_PKCS7_TYPE
+    {"BAD_PKCS7_TYPE", ERR_LIB_TS, TS_R_BAD_PKCS7_TYPE},
+  #else
+    {"BAD_PKCS7_TYPE", 47, 132},
+  #endif
+  #ifdef TS_R_BAD_TYPE
+    {"BAD_TYPE", ERR_LIB_TS, TS_R_BAD_TYPE},
+  #else
+    {"BAD_TYPE", 47, 133},
+  #endif
+  #ifdef TS_R_CANNOT_LOAD_CERT
+    {"CANNOT_LOAD_CERT", ERR_LIB_TS, TS_R_CANNOT_LOAD_CERT},
+  #else
+    {"CANNOT_LOAD_CERT", 47, 137},
+  #endif
+  #ifdef TS_R_CANNOT_LOAD_KEY
+    {"CANNOT_LOAD_KEY", ERR_LIB_TS, TS_R_CANNOT_LOAD_KEY},
+  #else
+    {"CANNOT_LOAD_KEY", 47, 138},
+  #endif
+  #ifdef TS_R_CERTIFICATE_VERIFY_ERROR
+    {"CERTIFICATE_VERIFY_ERROR", ERR_LIB_TS, TS_R_CERTIFICATE_VERIFY_ERROR},
+  #else
+    {"CERTIFICATE_VERIFY_ERROR", 47, 100},
+  #endif
+  #ifdef TS_R_COULD_NOT_SET_ENGINE
+    {"COULD_NOT_SET_ENGINE", ERR_LIB_TS, TS_R_COULD_NOT_SET_ENGINE},
+  #else
+    {"COULD_NOT_SET_ENGINE", 47, 127},
+  #endif
+  #ifdef TS_R_COULD_NOT_SET_TIME
+    {"COULD_NOT_SET_TIME", ERR_LIB_TS, TS_R_COULD_NOT_SET_TIME},
+  #else
+    {"COULD_NOT_SET_TIME", 47, 115},
+  #endif
+  #ifdef TS_R_DETACHED_CONTENT
+    {"DETACHED_CONTENT", ERR_LIB_TS, TS_R_DETACHED_CONTENT},
+  #else
+    {"DETACHED_CONTENT", 47, 134},
+  #endif
+  #ifdef TS_R_ESS_ADD_SIGNING_CERT_ERROR
+    {"ESS_ADD_SIGNING_CERT_ERROR", ERR_LIB_TS, TS_R_ESS_ADD_SIGNING_CERT_ERROR},
+  #else
+    {"ESS_ADD_SIGNING_CERT_ERROR", 47, 116},
+  #endif
+  #ifdef TS_R_ESS_ADD_SIGNING_CERT_V2_ERROR
+    {"ESS_ADD_SIGNING_CERT_V2_ERROR", ERR_LIB_TS, TS_R_ESS_ADD_SIGNING_CERT_V2_ERROR},
+  #else
+    {"ESS_ADD_SIGNING_CERT_V2_ERROR", 47, 139},
+  #endif
+  #ifdef TS_R_ESS_SIGNING_CERTIFICATE_ERROR
+    {"ESS_SIGNING_CERTIFICATE_ERROR", ERR_LIB_TS, TS_R_ESS_SIGNING_CERTIFICATE_ERROR},
+  #else
+    {"ESS_SIGNING_CERTIFICATE_ERROR", 47, 101},
+  #endif
+  #ifdef TS_R_INVALID_NULL_POINTER
+    {"INVALID_NULL_POINTER", ERR_LIB_TS, TS_R_INVALID_NULL_POINTER},
+  #else
+    {"INVALID_NULL_POINTER", 47, 102},
+  #endif
+  #ifdef TS_R_INVALID_SIGNER_CERTIFICATE_PURPOSE
+    {"INVALID_SIGNER_CERTIFICATE_PURPOSE", ERR_LIB_TS, TS_R_INVALID_SIGNER_CERTIFICATE_PURPOSE},
+  #else
+    {"INVALID_SIGNER_CERTIFICATE_PURPOSE", 47, 117},
+  #endif
+  #ifdef TS_R_MESSAGE_IMPRINT_MISMATCH
+    {"MESSAGE_IMPRINT_MISMATCH", ERR_LIB_TS, TS_R_MESSAGE_IMPRINT_MISMATCH},
+  #else
+    {"MESSAGE_IMPRINT_MISMATCH", 47, 103},
+  #endif
+  #ifdef TS_R_NONCE_MISMATCH
+    {"NONCE_MISMATCH", ERR_LIB_TS, TS_R_NONCE_MISMATCH},
+  #else
+    {"NONCE_MISMATCH", 47, 104},
+  #endif
+  #ifdef TS_R_NONCE_NOT_RETURNED
+    {"NONCE_NOT_RETURNED", ERR_LIB_TS, TS_R_NONCE_NOT_RETURNED},
+  #else
+    {"NONCE_NOT_RETURNED", 47, 105},
+  #endif
+  #ifdef TS_R_NO_CONTENT
+    {"NO_CONTENT", ERR_LIB_TS, TS_R_NO_CONTENT},
+  #else
+    {"NO_CONTENT", 47, 106},
+  #endif
+  #ifdef TS_R_NO_TIME_STAMP_TOKEN
+    {"NO_TIME_STAMP_TOKEN", ERR_LIB_TS, TS_R_NO_TIME_STAMP_TOKEN},
+  #else
+    {"NO_TIME_STAMP_TOKEN", 47, 107},
+  #endif
+  #ifdef TS_R_PKCS7_ADD_SIGNATURE_ERROR
+    {"PKCS7_ADD_SIGNATURE_ERROR", ERR_LIB_TS, TS_R_PKCS7_ADD_SIGNATURE_ERROR},
+  #else
+    {"PKCS7_ADD_SIGNATURE_ERROR", 47, 118},
+  #endif
+  #ifdef TS_R_PKCS7_ADD_SIGNED_ATTR_ERROR
+    {"PKCS7_ADD_SIGNED_ATTR_ERROR", ERR_LIB_TS, TS_R_PKCS7_ADD_SIGNED_ATTR_ERROR},
+  #else
+    {"PKCS7_ADD_SIGNED_ATTR_ERROR", 47, 119},
+  #endif
+  #ifdef TS_R_PKCS7_TO_TS_TST_INFO_FAILED
+    {"PKCS7_TO_TS_TST_INFO_FAILED", ERR_LIB_TS, TS_R_PKCS7_TO_TS_TST_INFO_FAILED},
+  #else
+    {"PKCS7_TO_TS_TST_INFO_FAILED", 47, 129},
+  #endif
+  #ifdef TS_R_POLICY_MISMATCH
+    {"POLICY_MISMATCH", ERR_LIB_TS, TS_R_POLICY_MISMATCH},
+  #else
+    {"POLICY_MISMATCH", 47, 108},
+  #endif
+  #ifdef TS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE
+    {"PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE", ERR_LIB_TS, TS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE},
+  #else
+    {"PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE", 47, 120},
+  #endif
+  #ifdef TS_R_RESPONSE_SETUP_ERROR
+    {"RESPONSE_SETUP_ERROR", ERR_LIB_TS, TS_R_RESPONSE_SETUP_ERROR},
+  #else
+    {"RESPONSE_SETUP_ERROR", 47, 121},
+  #endif
+  #ifdef TS_R_SIGNATURE_FAILURE
+    {"SIGNATURE_FAILURE", ERR_LIB_TS, TS_R_SIGNATURE_FAILURE},
+  #else
+    {"SIGNATURE_FAILURE", 47, 109},
+  #endif
+  #ifdef TS_R_THERE_MUST_BE_ONE_SIGNER
+    {"THERE_MUST_BE_ONE_SIGNER", ERR_LIB_TS, TS_R_THERE_MUST_BE_ONE_SIGNER},
+  #else
+    {"THERE_MUST_BE_ONE_SIGNER", 47, 110},
+  #endif
+  #ifdef TS_R_TIME_SYSCALL_ERROR
+    {"TIME_SYSCALL_ERROR", ERR_LIB_TS, TS_R_TIME_SYSCALL_ERROR},
+  #else
+    {"TIME_SYSCALL_ERROR", 47, 122},
+  #endif
+  #ifdef TS_R_TOKEN_NOT_PRESENT
+    {"TOKEN_NOT_PRESENT", ERR_LIB_TS, TS_R_TOKEN_NOT_PRESENT},
+  #else
+    {"TOKEN_NOT_PRESENT", 47, 130},
+  #endif
+  #ifdef TS_R_TOKEN_PRESENT
+    {"TOKEN_PRESENT", ERR_LIB_TS, TS_R_TOKEN_PRESENT},
+  #else
+    {"TOKEN_PRESENT", 47, 131},
+  #endif
+  #ifdef TS_R_TSA_NAME_MISMATCH
+    {"TSA_NAME_MISMATCH", ERR_LIB_TS, TS_R_TSA_NAME_MISMATCH},
+  #else
+    {"TSA_NAME_MISMATCH", 47, 111},
+  #endif
+  #ifdef TS_R_TSA_UNTRUSTED
+    {"TSA_UNTRUSTED", ERR_LIB_TS, TS_R_TSA_UNTRUSTED},
+  #else
+    {"TSA_UNTRUSTED", 47, 112},
+  #endif
+  #ifdef TS_R_TST_INFO_SETUP_ERROR
+    {"TST_INFO_SETUP_ERROR", ERR_LIB_TS, TS_R_TST_INFO_SETUP_ERROR},
+  #else
+    {"TST_INFO_SETUP_ERROR", 47, 123},
+  #endif
+  #ifdef TS_R_TS_DATASIGN
+    {"TS_DATASIGN", ERR_LIB_TS, TS_R_TS_DATASIGN},
+  #else
+    {"TS_DATASIGN", 47, 124},
+  #endif
+  #ifdef TS_R_UNACCEPTABLE_POLICY
+    {"UNACCEPTABLE_POLICY", ERR_LIB_TS, TS_R_UNACCEPTABLE_POLICY},
+  #else
+    {"UNACCEPTABLE_POLICY", 47, 125},
+  #endif
+  #ifdef TS_R_UNSUPPORTED_MD_ALGORITHM
+    {"UNSUPPORTED_MD_ALGORITHM", ERR_LIB_TS, TS_R_UNSUPPORTED_MD_ALGORITHM},
+  #else
+    {"UNSUPPORTED_MD_ALGORITHM", 47, 126},
+  #endif
+  #ifdef TS_R_UNSUPPORTED_VERSION
+    {"UNSUPPORTED_VERSION", ERR_LIB_TS, TS_R_UNSUPPORTED_VERSION},
+  #else
+    {"UNSUPPORTED_VERSION", 47, 113},
+  #endif
+  #ifdef TS_R_VAR_BAD_VALUE
+    {"VAR_BAD_VALUE", ERR_LIB_TS, TS_R_VAR_BAD_VALUE},
+  #else
+    {"VAR_BAD_VALUE", 47, 135},
+  #endif
+  #ifdef TS_R_VAR_LOOKUP_FAILURE
+    {"VAR_LOOKUP_FAILURE", ERR_LIB_TS, TS_R_VAR_LOOKUP_FAILURE},
+  #else
+    {"VAR_LOOKUP_FAILURE", 47, 136},
+  #endif
+  #ifdef TS_R_WRONG_CONTENT_TYPE
+    {"WRONG_CONTENT_TYPE", ERR_LIB_TS, TS_R_WRONG_CONTENT_TYPE},
+  #else
+    {"WRONG_CONTENT_TYPE", 47, 114},
+  #endif
+  #ifdef UI_R_COMMON_OK_AND_CANCEL_CHARACTERS
+    {"COMMON_OK_AND_CANCEL_CHARACTERS", ERR_LIB_UI, UI_R_COMMON_OK_AND_CANCEL_CHARACTERS},
+  #else
+    {"COMMON_OK_AND_CANCEL_CHARACTERS", 40, 104},
+  #endif
+  #ifdef UI_R_INDEX_TOO_LARGE
+    {"INDEX_TOO_LARGE", ERR_LIB_UI, UI_R_INDEX_TOO_LARGE},
+  #else
+    {"INDEX_TOO_LARGE", 40, 102},
+  #endif
+  #ifdef UI_R_INDEX_TOO_SMALL
+    {"INDEX_TOO_SMALL", ERR_LIB_UI, UI_R_INDEX_TOO_SMALL},
+  #else
+    {"INDEX_TOO_SMALL", 40, 103},
+  #endif
+  #ifdef UI_R_NO_RESULT_BUFFER
+    {"NO_RESULT_BUFFER", ERR_LIB_UI, UI_R_NO_RESULT_BUFFER},
+  #else
+    {"NO_RESULT_BUFFER", 40, 105},
+  #endif
+  #ifdef UI_R_PROCESSING_ERROR
+    {"PROCESSING_ERROR", ERR_LIB_UI, UI_R_PROCESSING_ERROR},
+  #else
+    {"PROCESSING_ERROR", 40, 107},
+  #endif
+  #ifdef UI_R_RESULT_TOO_LARGE
+    {"RESULT_TOO_LARGE", ERR_LIB_UI, UI_R_RESULT_TOO_LARGE},
+  #else
+    {"RESULT_TOO_LARGE", 40, 100},
+  #endif
+  #ifdef UI_R_RESULT_TOO_SMALL
+    {"RESULT_TOO_SMALL", ERR_LIB_UI, UI_R_RESULT_TOO_SMALL},
+  #else
+    {"RESULT_TOO_SMALL", 40, 101},
+  #endif
+  #ifdef UI_R_SYSASSIGN_ERROR
+    {"SYSASSIGN_ERROR", ERR_LIB_UI, UI_R_SYSASSIGN_ERROR},
+  #else
+    {"SYSASSIGN_ERROR", 40, 109},
+  #endif
+  #ifdef UI_R_SYSDASSGN_ERROR
+    {"SYSDASSGN_ERROR", ERR_LIB_UI, UI_R_SYSDASSGN_ERROR},
+  #else
+    {"SYSDASSGN_ERROR", 40, 110},
+  #endif
+  #ifdef UI_R_SYSQIOW_ERROR
+    {"SYSQIOW_ERROR", ERR_LIB_UI, UI_R_SYSQIOW_ERROR},
+  #else
+    {"SYSQIOW_ERROR", 40, 111},
+  #endif
+  #ifdef UI_R_UNKNOWN_CONTROL_COMMAND
+    {"UNKNOWN_CONTROL_COMMAND", ERR_LIB_UI, UI_R_UNKNOWN_CONTROL_COMMAND},
+  #else
+    {"UNKNOWN_CONTROL_COMMAND", 40, 106},
+  #endif
+  #ifdef UI_R_UNKNOWN_TTYGET_ERRNO_VALUE
+    {"UNKNOWN_TTYGET_ERRNO_VALUE", ERR_LIB_UI, UI_R_UNKNOWN_TTYGET_ERRNO_VALUE},
+  #else
+    {"UNKNOWN_TTYGET_ERRNO_VALUE", 40, 108},
+  #endif
+  #ifdef UI_R_USER_DATA_DUPLICATION_UNSUPPORTED
+    {"USER_DATA_DUPLICATION_UNSUPPORTED", ERR_LIB_UI, UI_R_USER_DATA_DUPLICATION_UNSUPPORTED},
+  #else
+    {"USER_DATA_DUPLICATION_UNSUPPORTED", 40, 112},
+  #endif
+  #ifdef X509V3_R_BAD_IP_ADDRESS
+    {"BAD_IP_ADDRESS", ERR_LIB_X509V3, X509V3_R_BAD_IP_ADDRESS},
+  #else
+    {"BAD_IP_ADDRESS", 34, 118},
+  #endif
+  #ifdef X509V3_R_BAD_OBJECT
+    {"BAD_OBJECT", ERR_LIB_X509V3, X509V3_R_BAD_OBJECT},
+  #else
+    {"BAD_OBJECT", 34, 119},
+  #endif
+  #ifdef X509V3_R_BN_DEC2BN_ERROR
+    {"BN_DEC2BN_ERROR", ERR_LIB_X509V3, X509V3_R_BN_DEC2BN_ERROR},
+  #else
+    {"BN_DEC2BN_ERROR", 34, 100},
+  #endif
+  #ifdef X509V3_R_BN_TO_ASN1_INTEGER_ERROR
+    {"BN_TO_ASN1_INTEGER_ERROR", ERR_LIB_X509V3, X509V3_R_BN_TO_ASN1_INTEGER_ERROR},
+  #else
+    {"BN_TO_ASN1_INTEGER_ERROR", 34, 101},
+  #endif
+  #ifdef X509V3_R_DIRNAME_ERROR
+    {"DIRNAME_ERROR", ERR_LIB_X509V3, X509V3_R_DIRNAME_ERROR},
+  #else
+    {"DIRNAME_ERROR", 34, 149},
+  #endif
+  #ifdef X509V3_R_DISTPOINT_ALREADY_SET
+    {"DISTPOINT_ALREADY_SET", ERR_LIB_X509V3, X509V3_R_DISTPOINT_ALREADY_SET},
+  #else
+    {"DISTPOINT_ALREADY_SET", 34, 160},
+  #endif
+  #ifdef X509V3_R_DUPLICATE_ZONE_ID
+    {"DUPLICATE_ZONE_ID", ERR_LIB_X509V3, X509V3_R_DUPLICATE_ZONE_ID},
+  #else
+    {"DUPLICATE_ZONE_ID", 34, 133},
+  #endif
+  #ifdef X509V3_R_ERROR_CONVERTING_ZONE
+    {"ERROR_CONVERTING_ZONE", ERR_LIB_X509V3, X509V3_R_ERROR_CONVERTING_ZONE},
+  #else
+    {"ERROR_CONVERTING_ZONE", 34, 131},
+  #endif
+  #ifdef X509V3_R_ERROR_CREATING_EXTENSION
+    {"ERROR_CREATING_EXTENSION", ERR_LIB_X509V3, X509V3_R_ERROR_CREATING_EXTENSION},
+  #else
+    {"ERROR_CREATING_EXTENSION", 34, 144},
+  #endif
+  #ifdef X509V3_R_ERROR_IN_EXTENSION
+    {"ERROR_IN_EXTENSION", ERR_LIB_X509V3, X509V3_R_ERROR_IN_EXTENSION},
+  #else
+    {"ERROR_IN_EXTENSION", 34, 128},
+  #endif
+  #ifdef X509V3_R_EXPECTED_A_SECTION_NAME
+    {"EXPECTED_A_SECTION_NAME", ERR_LIB_X509V3, X509V3_R_EXPECTED_A_SECTION_NAME},
+  #else
+    {"EXPECTED_A_SECTION_NAME", 34, 137},
+  #endif
+  #ifdef X509V3_R_EXTENSION_EXISTS
+    {"EXTENSION_EXISTS", ERR_LIB_X509V3, X509V3_R_EXTENSION_EXISTS},
+  #else
+    {"EXTENSION_EXISTS", 34, 145},
+  #endif
+  #ifdef X509V3_R_EXTENSION_NAME_ERROR
+    {"EXTENSION_NAME_ERROR", ERR_LIB_X509V3, X509V3_R_EXTENSION_NAME_ERROR},
+  #else
+    {"EXTENSION_NAME_ERROR", 34, 115},
+  #endif
+  #ifdef X509V3_R_EXTENSION_NOT_FOUND
+    {"EXTENSION_NOT_FOUND", ERR_LIB_X509V3, X509V3_R_EXTENSION_NOT_FOUND},
+  #else
+    {"EXTENSION_NOT_FOUND", 34, 102},
+  #endif
+  #ifdef X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED
+    {"EXTENSION_SETTING_NOT_SUPPORTED", ERR_LIB_X509V3, X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED},
+  #else
+    {"EXTENSION_SETTING_NOT_SUPPORTED", 34, 103},
+  #endif
+  #ifdef X509V3_R_EXTENSION_VALUE_ERROR
+    {"EXTENSION_VALUE_ERROR", ERR_LIB_X509V3, X509V3_R_EXTENSION_VALUE_ERROR},
+  #else
+    {"EXTENSION_VALUE_ERROR", 34, 116},
+  #endif
+  #ifdef X509V3_R_ILLEGAL_EMPTY_EXTENSION
+    {"ILLEGAL_EMPTY_EXTENSION", ERR_LIB_X509V3, X509V3_R_ILLEGAL_EMPTY_EXTENSION},
+  #else
+    {"ILLEGAL_EMPTY_EXTENSION", 34, 151},
+  #endif
+  #ifdef X509V3_R_INCORRECT_POLICY_SYNTAX_TAG
+    {"INCORRECT_POLICY_SYNTAX_TAG", ERR_LIB_X509V3, X509V3_R_INCORRECT_POLICY_SYNTAX_TAG},
+  #else
+    {"INCORRECT_POLICY_SYNTAX_TAG", 34, 152},
+  #endif
+  #ifdef X509V3_R_INVALID_ASNUMBER
+    {"INVALID_ASNUMBER", ERR_LIB_X509V3, X509V3_R_INVALID_ASNUMBER},
+  #else
+    {"INVALID_ASNUMBER", 34, 162},
+  #endif
+  #ifdef X509V3_R_INVALID_ASRANGE
+    {"INVALID_ASRANGE", ERR_LIB_X509V3, X509V3_R_INVALID_ASRANGE},
+  #else
+    {"INVALID_ASRANGE", 34, 163},
+  #endif
+  #ifdef X509V3_R_INVALID_BOOLEAN_STRING
+    {"INVALID_BOOLEAN_STRING", ERR_LIB_X509V3, X509V3_R_INVALID_BOOLEAN_STRING},
+  #else
+    {"INVALID_BOOLEAN_STRING", 34, 104},
+  #endif
+  #ifdef X509V3_R_INVALID_EXTENSION_STRING
+    {"INVALID_EXTENSION_STRING", ERR_LIB_X509V3, X509V3_R_INVALID_EXTENSION_STRING},
+  #else
+    {"INVALID_EXTENSION_STRING", 34, 105},
+  #endif
+  #ifdef X509V3_R_INVALID_INHERITANCE
+    {"INVALID_INHERITANCE", ERR_LIB_X509V3, X509V3_R_INVALID_INHERITANCE},
+  #else
+    {"INVALID_INHERITANCE", 34, 165},
+  #endif
+  #ifdef X509V3_R_INVALID_IPADDRESS
+    {"INVALID_IPADDRESS", ERR_LIB_X509V3, X509V3_R_INVALID_IPADDRESS},
+  #else
+    {"INVALID_IPADDRESS", 34, 166},
+  #endif
+  #ifdef X509V3_R_INVALID_MULTIPLE_RDNS
+    {"INVALID_MULTIPLE_RDNS", ERR_LIB_X509V3, X509V3_R_INVALID_MULTIPLE_RDNS},
+  #else
+    {"INVALID_MULTIPLE_RDNS", 34, 161},
+  #endif
+  #ifdef X509V3_R_INVALID_NAME
+    {"INVALID_NAME", ERR_LIB_X509V3, X509V3_R_INVALID_NAME},
+  #else
+    {"INVALID_NAME", 34, 106},
+  #endif
+  #ifdef X509V3_R_INVALID_NULL_ARGUMENT
+    {"INVALID_NULL_ARGUMENT", ERR_LIB_X509V3, X509V3_R_INVALID_NULL_ARGUMENT},
+  #else
+    {"INVALID_NULL_ARGUMENT", 34, 107},
+  #endif
+  #ifdef X509V3_R_INVALID_NULL_NAME
+    {"INVALID_NULL_NAME", ERR_LIB_X509V3, X509V3_R_INVALID_NULL_NAME},
+  #else
+    {"INVALID_NULL_NAME", 34, 108},
+  #endif
+  #ifdef X509V3_R_INVALID_NULL_VALUE
+    {"INVALID_NULL_VALUE", ERR_LIB_X509V3, X509V3_R_INVALID_NULL_VALUE},
+  #else
+    {"INVALID_NULL_VALUE", 34, 109},
+  #endif
+  #ifdef X509V3_R_INVALID_NUMBER
+    {"INVALID_NUMBER", ERR_LIB_X509V3, X509V3_R_INVALID_NUMBER},
+  #else
+    {"INVALID_NUMBER", 34, 140},
+  #endif
+  #ifdef X509V3_R_INVALID_NUMBERS
+    {"INVALID_NUMBERS", ERR_LIB_X509V3, X509V3_R_INVALID_NUMBERS},
+  #else
+    {"INVALID_NUMBERS", 34, 141},
+  #endif
+  #ifdef X509V3_R_INVALID_OBJECT_IDENTIFIER
+    {"INVALID_OBJECT_IDENTIFIER", ERR_LIB_X509V3, X509V3_R_INVALID_OBJECT_IDENTIFIER},
+  #else
+    {"INVALID_OBJECT_IDENTIFIER", 34, 110},
+  #endif
+  #ifdef X509V3_R_INVALID_OPTION
+    {"INVALID_OPTION", ERR_LIB_X509V3, X509V3_R_INVALID_OPTION},
+  #else
+    {"INVALID_OPTION", 34, 138},
+  #endif
+  #ifdef X509V3_R_INVALID_POLICY_IDENTIFIER
+    {"INVALID_POLICY_IDENTIFIER", ERR_LIB_X509V3, X509V3_R_INVALID_POLICY_IDENTIFIER},
+  #else
+    {"INVALID_POLICY_IDENTIFIER", 34, 134},
+  #endif
+  #ifdef X509V3_R_INVALID_PROXY_POLICY_SETTING
+    {"INVALID_PROXY_POLICY_SETTING", ERR_LIB_X509V3, X509V3_R_INVALID_PROXY_POLICY_SETTING},
+  #else
+    {"INVALID_PROXY_POLICY_SETTING", 34, 153},
+  #endif
+  #ifdef X509V3_R_INVALID_PURPOSE
+    {"INVALID_PURPOSE", ERR_LIB_X509V3, X509V3_R_INVALID_PURPOSE},
+  #else
+    {"INVALID_PURPOSE", 34, 146},
+  #endif
+  #ifdef X509V3_R_INVALID_SAFI
+    {"INVALID_SAFI", ERR_LIB_X509V3, X509V3_R_INVALID_SAFI},
+  #else
+    {"INVALID_SAFI", 34, 164},
+  #endif
+  #ifdef X509V3_R_INVALID_SECTION
+    {"INVALID_SECTION", ERR_LIB_X509V3, X509V3_R_INVALID_SECTION},
+  #else
+    {"INVALID_SECTION", 34, 135},
+  #endif
+  #ifdef X509V3_R_INVALID_SYNTAX
+    {"INVALID_SYNTAX", ERR_LIB_X509V3, X509V3_R_INVALID_SYNTAX},
+  #else
+    {"INVALID_SYNTAX", 34, 143},
+  #endif
+  #ifdef X509V3_R_ISSUER_DECODE_ERROR
+    {"ISSUER_DECODE_ERROR", ERR_LIB_X509V3, X509V3_R_ISSUER_DECODE_ERROR},
+  #else
+    {"ISSUER_DECODE_ERROR", 34, 126},
+  #endif
+  #ifdef X509V3_R_MISSING_VALUE
+    {"MISSING_VALUE", ERR_LIB_X509V3, X509V3_R_MISSING_VALUE},
+  #else
+    {"MISSING_VALUE", 34, 124},
+  #endif
+  #ifdef X509V3_R_NEED_ORGANIZATION_AND_NUMBERS
+    {"NEED_ORGANIZATION_AND_NUMBERS", ERR_LIB_X509V3, X509V3_R_NEED_ORGANIZATION_AND_NUMBERS},
+  #else
+    {"NEED_ORGANIZATION_AND_NUMBERS", 34, 142},
+  #endif
+  #ifdef X509V3_R_NO_CONFIG_DATABASE
+    {"NO_CONFIG_DATABASE", ERR_LIB_X509V3, X509V3_R_NO_CONFIG_DATABASE},
+  #else
+    {"NO_CONFIG_DATABASE", 34, 136},
+  #endif
+  #ifdef X509V3_R_NO_ISSUER_CERTIFICATE
+    {"NO_ISSUER_CERTIFICATE", ERR_LIB_X509V3, X509V3_R_NO_ISSUER_CERTIFICATE},
+  #else
+    {"NO_ISSUER_CERTIFICATE", 34, 121},
+  #endif
+  #ifdef X509V3_R_NO_ISSUER_DETAILS
+    {"NO_ISSUER_DETAILS", ERR_LIB_X509V3, X509V3_R_NO_ISSUER_DETAILS},
+  #else
+    {"NO_ISSUER_DETAILS", 34, 127},
+  #endif
+  #ifdef X509V3_R_NO_POLICY_IDENTIFIER
+    {"NO_POLICY_IDENTIFIER", ERR_LIB_X509V3, X509V3_R_NO_POLICY_IDENTIFIER},
+  #else
+    {"NO_POLICY_IDENTIFIER", 34, 139},
+  #endif
+  #ifdef X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED
+    {"NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED", ERR_LIB_X509V3, X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED},
+  #else
+    {"NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED", 34, 154},
+  #endif
+  #ifdef X509V3_R_NO_PUBLIC_KEY
+    {"NO_PUBLIC_KEY", ERR_LIB_X509V3, X509V3_R_NO_PUBLIC_KEY},
+  #else
+    {"NO_PUBLIC_KEY", 34, 114},
+  #endif
+  #ifdef X509V3_R_NO_SUBJECT_DETAILS
+    {"NO_SUBJECT_DETAILS", ERR_LIB_X509V3, X509V3_R_NO_SUBJECT_DETAILS},
+  #else
+    {"NO_SUBJECT_DETAILS", 34, 125},
+  #endif
+  #ifdef X509V3_R_OPERATION_NOT_DEFINED
+    {"OPERATION_NOT_DEFINED", ERR_LIB_X509V3, X509V3_R_OPERATION_NOT_DEFINED},
+  #else
+    {"OPERATION_NOT_DEFINED", 34, 148},
+  #endif
+  #ifdef X509V3_R_OTHERNAME_ERROR
+    {"OTHERNAME_ERROR", ERR_LIB_X509V3, X509V3_R_OTHERNAME_ERROR},
+  #else
+    {"OTHERNAME_ERROR", 34, 147},
+  #endif
+  #ifdef X509V3_R_POLICY_LANGUAGE_ALREADY_DEFINED
+    {"POLICY_LANGUAGE_ALREADY_DEFINED", ERR_LIB_X509V3, X509V3_R_POLICY_LANGUAGE_ALREADY_DEFINED},
+  #else
+    {"POLICY_LANGUAGE_ALREADY_DEFINED", 34, 155},
+  #endif
+  #ifdef X509V3_R_POLICY_PATH_LENGTH
+    {"POLICY_PATH_LENGTH", ERR_LIB_X509V3, X509V3_R_POLICY_PATH_LENGTH},
+  #else
+    {"POLICY_PATH_LENGTH", 34, 156},
+  #endif
+  #ifdef X509V3_R_POLICY_PATH_LENGTH_ALREADY_DEFINED
+    {"POLICY_PATH_LENGTH_ALREADY_DEFINED", ERR_LIB_X509V3, X509V3_R_POLICY_PATH_LENGTH_ALREADY_DEFINED},
+  #else
+    {"POLICY_PATH_LENGTH_ALREADY_DEFINED", 34, 157},
+  #endif
+  #ifdef X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY
+    {"POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY", ERR_LIB_X509V3, X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY},
+  #else
+    {"POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY", 34, 159},
+  #endif
+  #ifdef X509V3_R_SECTION_NOT_FOUND
+    {"SECTION_NOT_FOUND", ERR_LIB_X509V3, X509V3_R_SECTION_NOT_FOUND},
+  #else
+    {"SECTION_NOT_FOUND", 34, 150},
+  #endif
+  #ifdef X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS
+    {"UNABLE_TO_GET_ISSUER_DETAILS", ERR_LIB_X509V3, X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS},
+  #else
+    {"UNABLE_TO_GET_ISSUER_DETAILS", 34, 122},
+  #endif
+  #ifdef X509V3_R_UNABLE_TO_GET_ISSUER_KEYID
+    {"UNABLE_TO_GET_ISSUER_KEYID", ERR_LIB_X509V3, X509V3_R_UNABLE_TO_GET_ISSUER_KEYID},
+  #else
+    {"UNABLE_TO_GET_ISSUER_KEYID", 34, 123},
+  #endif
+  #ifdef X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT
+    {"UNKNOWN_BIT_STRING_ARGUMENT", ERR_LIB_X509V3, X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT},
+  #else
+    {"UNKNOWN_BIT_STRING_ARGUMENT", 34, 111},
+  #endif
+  #ifdef X509V3_R_UNKNOWN_EXTENSION
+    {"UNKNOWN_EXTENSION", ERR_LIB_X509V3, X509V3_R_UNKNOWN_EXTENSION},
+  #else
+    {"UNKNOWN_EXTENSION", 34, 129},
+  #endif
+  #ifdef X509V3_R_UNKNOWN_EXTENSION_NAME
+    {"UNKNOWN_EXTENSION_NAME", ERR_LIB_X509V3, X509V3_R_UNKNOWN_EXTENSION_NAME},
+  #else
+    {"UNKNOWN_EXTENSION_NAME", 34, 130},
+  #endif
+  #ifdef X509V3_R_UNKNOWN_OPTION
+    {"UNKNOWN_OPTION", ERR_LIB_X509V3, X509V3_R_UNKNOWN_OPTION},
+  #else
+    {"UNKNOWN_OPTION", 34, 120},
+  #endif
+  #ifdef X509V3_R_UNSUPPORTED_OPTION
+    {"UNSUPPORTED_OPTION", ERR_LIB_X509V3, X509V3_R_UNSUPPORTED_OPTION},
+  #else
+    {"UNSUPPORTED_OPTION", 34, 117},
+  #endif
+  #ifdef X509V3_R_UNSUPPORTED_TYPE
+    {"UNSUPPORTED_TYPE", ERR_LIB_X509V3, X509V3_R_UNSUPPORTED_TYPE},
+  #else
+    {"UNSUPPORTED_TYPE", 34, 167},
+  #endif
+  #ifdef X509V3_R_USER_TOO_LONG
+    {"USER_TOO_LONG", ERR_LIB_X509V3, X509V3_R_USER_TOO_LONG},
+  #else
+    {"USER_TOO_LONG", 34, 132},
+  #endif
+  #ifdef X509_R_AKID_MISMATCH
+    {"AKID_MISMATCH", ERR_LIB_X509, X509_R_AKID_MISMATCH},
+  #else
+    {"AKID_MISMATCH", 11, 110},
+  #endif
+  #ifdef X509_R_BAD_SELECTOR
+    {"BAD_SELECTOR", ERR_LIB_X509, X509_R_BAD_SELECTOR},
+  #else
+    {"BAD_SELECTOR", 11, 133},
+  #endif
+  #ifdef X509_R_BAD_X509_FILETYPE
+    {"BAD_X509_FILETYPE", ERR_LIB_X509, X509_R_BAD_X509_FILETYPE},
+  #else
+    {"BAD_X509_FILETYPE", 11, 100},
+  #endif
+  #ifdef X509_R_BASE64_DECODE_ERROR
+    {"BASE64_DECODE_ERROR", ERR_LIB_X509, X509_R_BASE64_DECODE_ERROR},
+  #else
+    {"BASE64_DECODE_ERROR", 11, 118},
+  #endif
+  #ifdef X509_R_CANT_CHECK_DH_KEY
+    {"CANT_CHECK_DH_KEY", ERR_LIB_X509, X509_R_CANT_CHECK_DH_KEY},
+  #else
+    {"CANT_CHECK_DH_KEY", 11, 114},
+  #endif
+  #ifdef X509_R_CERT_ALREADY_IN_HASH_TABLE
+    {"CERT_ALREADY_IN_HASH_TABLE", ERR_LIB_X509, X509_R_CERT_ALREADY_IN_HASH_TABLE},
+  #else
+    {"CERT_ALREADY_IN_HASH_TABLE", 11, 101},
+  #endif
+  #ifdef X509_R_CRL_ALREADY_DELTA
+    {"CRL_ALREADY_DELTA", ERR_LIB_X509, X509_R_CRL_ALREADY_DELTA},
+  #else
+    {"CRL_ALREADY_DELTA", 11, 127},
+  #endif
+  #ifdef X509_R_CRL_VERIFY_FAILURE
+    {"CRL_VERIFY_FAILURE", ERR_LIB_X509, X509_R_CRL_VERIFY_FAILURE},
+  #else
+    {"CRL_VERIFY_FAILURE", 11, 131},
+  #endif
+  #ifdef X509_R_IDP_MISMATCH
+    {"IDP_MISMATCH", ERR_LIB_X509, X509_R_IDP_MISMATCH},
+  #else
+    {"IDP_MISMATCH", 11, 128},
+  #endif
+  #ifdef X509_R_INVALID_ATTRIBUTES
+    {"INVALID_ATTRIBUTES", ERR_LIB_X509, X509_R_INVALID_ATTRIBUTES},
+  #else
+    {"INVALID_ATTRIBUTES", 11, 138},
+  #endif
+  #ifdef X509_R_INVALID_DIRECTORY
+    {"INVALID_DIRECTORY", ERR_LIB_X509, X509_R_INVALID_DIRECTORY},
+  #else
+    {"INVALID_DIRECTORY", 11, 113},
+  #endif
+  #ifdef X509_R_INVALID_FIELD_NAME
+    {"INVALID_FIELD_NAME", ERR_LIB_X509, X509_R_INVALID_FIELD_NAME},
+  #else
+    {"INVALID_FIELD_NAME", 11, 119},
+  #endif
+  #ifdef X509_R_INVALID_TRUST
+    {"INVALID_TRUST", ERR_LIB_X509, X509_R_INVALID_TRUST},
+  #else
+    {"INVALID_TRUST", 11, 123},
+  #endif
+  #ifdef X509_R_ISSUER_MISMATCH
+    {"ISSUER_MISMATCH", ERR_LIB_X509, X509_R_ISSUER_MISMATCH},
+  #else
+    {"ISSUER_MISMATCH", 11, 129},
+  #endif
+  #ifdef X509_R_KEY_TYPE_MISMATCH
+    {"KEY_TYPE_MISMATCH", ERR_LIB_X509, X509_R_KEY_TYPE_MISMATCH},
+  #else
+    {"KEY_TYPE_MISMATCH", 11, 115},
+  #endif
+  #ifdef X509_R_KEY_VALUES_MISMATCH
+    {"KEY_VALUES_MISMATCH", ERR_LIB_X509, X509_R_KEY_VALUES_MISMATCH},
+  #else
+    {"KEY_VALUES_MISMATCH", 11, 116},
+  #endif
+  #ifdef X509_R_LOADING_CERT_DIR
+    {"LOADING_CERT_DIR", ERR_LIB_X509, X509_R_LOADING_CERT_DIR},
+  #else
+    {"LOADING_CERT_DIR", 11, 103},
+  #endif
+  #ifdef X509_R_LOADING_DEFAULTS
+    {"LOADING_DEFAULTS", ERR_LIB_X509, X509_R_LOADING_DEFAULTS},
+  #else
+    {"LOADING_DEFAULTS", 11, 104},
+  #endif
+  #ifdef X509_R_METHOD_NOT_SUPPORTED
+    {"METHOD_NOT_SUPPORTED", ERR_LIB_X509, X509_R_METHOD_NOT_SUPPORTED},
+  #else
+    {"METHOD_NOT_SUPPORTED", 11, 124},
+  #endif
+  #ifdef X509_R_NAME_TOO_LONG
+    {"NAME_TOO_LONG", ERR_LIB_X509, X509_R_NAME_TOO_LONG},
+  #else
+    {"NAME_TOO_LONG", 11, 134},
+  #endif
+  #ifdef X509_R_NEWER_CRL_NOT_NEWER
+    {"NEWER_CRL_NOT_NEWER", ERR_LIB_X509, X509_R_NEWER_CRL_NOT_NEWER},
+  #else
+    {"NEWER_CRL_NOT_NEWER", 11, 132},
+  #endif
+  #ifdef X509_R_NO_CERTIFICATE_FOUND
+    {"NO_CERTIFICATE_FOUND", ERR_LIB_X509, X509_R_NO_CERTIFICATE_FOUND},
+  #else
+    {"NO_CERTIFICATE_FOUND", 11, 135},
+  #endif
+  #ifdef X509_R_NO_CERTIFICATE_OR_CRL_FOUND
+    {"NO_CERTIFICATE_OR_CRL_FOUND", ERR_LIB_X509, X509_R_NO_CERTIFICATE_OR_CRL_FOUND},
+  #else
+    {"NO_CERTIFICATE_OR_CRL_FOUND", 11, 136},
+  #endif
+  #ifdef X509_R_NO_CERT_SET_FOR_US_TO_VERIFY
+    {"NO_CERT_SET_FOR_US_TO_VERIFY", ERR_LIB_X509, X509_R_NO_CERT_SET_FOR_US_TO_VERIFY},
+  #else
+    {"NO_CERT_SET_FOR_US_TO_VERIFY", 11, 105},
+  #endif
+  #ifdef X509_R_NO_CRL_FOUND
+    {"NO_CRL_FOUND", ERR_LIB_X509, X509_R_NO_CRL_FOUND},
+  #else
+    {"NO_CRL_FOUND", 11, 137},
+  #endif
+  #ifdef X509_R_NO_CRL_NUMBER
+    {"NO_CRL_NUMBER", ERR_LIB_X509, X509_R_NO_CRL_NUMBER},
+  #else
+    {"NO_CRL_NUMBER", 11, 130},
+  #endif
+  #ifdef X509_R_PUBLIC_KEY_DECODE_ERROR
+    {"PUBLIC_KEY_DECODE_ERROR", ERR_LIB_X509, X509_R_PUBLIC_KEY_DECODE_ERROR},
+  #else
+    {"PUBLIC_KEY_DECODE_ERROR", 11, 125},
+  #endif
+  #ifdef X509_R_PUBLIC_KEY_ENCODE_ERROR
+    {"PUBLIC_KEY_ENCODE_ERROR", ERR_LIB_X509, X509_R_PUBLIC_KEY_ENCODE_ERROR},
+  #else
+    {"PUBLIC_KEY_ENCODE_ERROR", 11, 126},
+  #endif
+  #ifdef X509_R_SHOULD_RETRY
+    {"SHOULD_RETRY", ERR_LIB_X509, X509_R_SHOULD_RETRY},
+  #else
+    {"SHOULD_RETRY", 11, 106},
+  #endif
+  #ifdef X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN
+    {"UNABLE_TO_FIND_PARAMETERS_IN_CHAIN", ERR_LIB_X509, X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN},
+  #else
+    {"UNABLE_TO_FIND_PARAMETERS_IN_CHAIN", 11, 107},
+  #endif
+  #ifdef X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY
+    {"UNABLE_TO_GET_CERTS_PUBLIC_KEY", ERR_LIB_X509, X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY},
+  #else
+    {"UNABLE_TO_GET_CERTS_PUBLIC_KEY", 11, 108},
+  #endif
+  #ifdef X509_R_UNKNOWN_KEY_TYPE
+    {"UNKNOWN_KEY_TYPE", ERR_LIB_X509, X509_R_UNKNOWN_KEY_TYPE},
+  #else
+    {"UNKNOWN_KEY_TYPE", 11, 117},
+  #endif
+  #ifdef X509_R_UNKNOWN_NID
+    {"UNKNOWN_NID", ERR_LIB_X509, X509_R_UNKNOWN_NID},
+  #else
+    {"UNKNOWN_NID", 11, 109},
+  #endif
+  #ifdef X509_R_UNKNOWN_PURPOSE_ID
+    {"UNKNOWN_PURPOSE_ID", ERR_LIB_X509, X509_R_UNKNOWN_PURPOSE_ID},
+  #else
+    {"UNKNOWN_PURPOSE_ID", 11, 121},
+  #endif
+  #ifdef X509_R_UNKNOWN_TRUST_ID
+    {"UNKNOWN_TRUST_ID", ERR_LIB_X509, X509_R_UNKNOWN_TRUST_ID},
+  #else
+    {"UNKNOWN_TRUST_ID", 11, 120},
+  #endif
+  #ifdef X509_R_UNSUPPORTED_ALGORITHM
+    {"UNSUPPORTED_ALGORITHM", ERR_LIB_X509, X509_R_UNSUPPORTED_ALGORITHM},
+  #else
+    {"UNSUPPORTED_ALGORITHM", 11, 111},
+  #endif
+  #ifdef X509_R_WRONG_LOOKUP_TYPE
+    {"WRONG_LOOKUP_TYPE", ERR_LIB_X509, X509_R_WRONG_LOOKUP_TYPE},
+  #else
+    {"WRONG_LOOKUP_TYPE", 11, 112},
+  #endif
+  #ifdef X509_R_WRONG_TYPE
+    {"WRONG_TYPE", ERR_LIB_X509, X509_R_WRONG_TYPE},
+  #else
+    {"WRONG_TYPE", 11, 122},
+  #endif
+    { NULL }
+};
+
diff --git a/Modules/_ssl_data_300.h b/Modules/_ssl_data_300.h
new file mode 100644
index 0000000..6be8b24
--- /dev/null
+++ b/Modules/_ssl_data_300.h
@@ -0,0 +1,8435 @@
+/* File generated by Tools/ssl/make_ssl_data.py *//* Generated on 2021-04-09T09:44:43.288448 */
+static struct py_ssl_library_code library_codes[] = {
+#ifdef ERR_LIB_ASN1
+    {"ASN1", ERR_LIB_ASN1},
+#endif
+#ifdef ERR_LIB_ASYNC
+    {"ASYNC", ERR_LIB_ASYNC},
+#endif
+#ifdef ERR_LIB_BIO
+    {"BIO", ERR_LIB_BIO},
+#endif
+#ifdef ERR_LIB_BN
+    {"BN", ERR_LIB_BN},
+#endif
+#ifdef ERR_LIB_BUF
+    {"BUF", ERR_LIB_BUF},
+#endif
+#ifdef ERR_LIB_CMP
+    {"CMP", ERR_LIB_CMP},
+#endif
+#ifdef ERR_LIB_CMS
+    {"CMS", ERR_LIB_CMS},
+#endif
+#ifdef ERR_LIB_COMP
+    {"COMP", ERR_LIB_COMP},
+#endif
+#ifdef ERR_LIB_CONF
+    {"CONF", ERR_LIB_CONF},
+#endif
+#ifdef ERR_LIB_CRMF
+    {"CRMF", ERR_LIB_CRMF},
+#endif
+#ifdef ERR_LIB_CRYPTO
+    {"CRYPTO", ERR_LIB_CRYPTO},
+#endif
+#ifdef ERR_LIB_CT
+    {"CT", ERR_LIB_CT},
+#endif
+#ifdef ERR_LIB_DH
+    {"DH", ERR_LIB_DH},
+#endif
+#ifdef ERR_LIB_DSA
+    {"DSA", ERR_LIB_DSA},
+#endif
+#ifdef ERR_LIB_DSO
+    {"DSO", ERR_LIB_DSO},
+#endif
+#ifdef ERR_LIB_EC
+    {"EC", ERR_LIB_EC},
+#endif
+#ifdef ERR_LIB_ECDH
+    {"ECDH", ERR_LIB_ECDH},
+#endif
+#ifdef ERR_LIB_ECDSA
+    {"ECDSA", ERR_LIB_ECDSA},
+#endif
+#ifdef ERR_LIB_ENGINE
+    {"ENGINE", ERR_LIB_ENGINE},
+#endif
+#ifdef ERR_LIB_ESS
+    {"ESS", ERR_LIB_ESS},
+#endif
+#ifdef ERR_LIB_EVP
+    {"EVP", ERR_LIB_EVP},
+#endif
+#ifdef ERR_LIB_FIPS
+    {"FIPS", ERR_LIB_FIPS},
+#endif
+#ifdef ERR_LIB_HMAC
+    {"HMAC", ERR_LIB_HMAC},
+#endif
+#ifdef ERR_LIB_HTTP
+    {"HTTP", ERR_LIB_HTTP},
+#endif
+#ifdef ERR_LIB_JPAKE
+    {"JPAKE", ERR_LIB_JPAKE},
+#endif
+#ifdef ERR_LIB_KDF
+    {"KDF", ERR_LIB_KDF},
+#endif
+#ifdef ERR_LIB_MASK
+    {"MASK", ERR_LIB_MASK},
+#endif
+#ifdef ERR_LIB_METH
+    {"METH", ERR_LIB_METH},
+#endif
+#ifdef ERR_LIB_NONE
+    {"NONE", ERR_LIB_NONE},
+#endif
+#ifdef ERR_LIB_OBJ
+    {"OBJ", ERR_LIB_OBJ},
+#endif
+#ifdef ERR_LIB_OCSP
+    {"OCSP", ERR_LIB_OCSP},
+#endif
+#ifdef ERR_LIB_OFFSET
+    {"OFFSET", ERR_LIB_OFFSET},
+#endif
+#ifdef ERR_LIB_OSSL_DECODER
+    {"OSSL_DECODER", ERR_LIB_OSSL_DECODER},
+#endif
+#ifdef ERR_LIB_OSSL_ENCODER
+    {"OSSL_ENCODER", ERR_LIB_OSSL_ENCODER},
+#endif
+#ifdef ERR_LIB_OSSL_STORE
+    {"OSSL_STORE", ERR_LIB_OSSL_STORE},
+#endif
+#ifdef ERR_LIB_PEM
+    {"PEM", ERR_LIB_PEM},
+#endif
+#ifdef ERR_LIB_PKCS12
+    {"PKCS12", ERR_LIB_PKCS12},
+#endif
+#ifdef ERR_LIB_PKCS7
+    {"PKCS7", ERR_LIB_PKCS7},
+#endif
+#ifdef ERR_LIB_PROP
+    {"PROP", ERR_LIB_PROP},
+#endif
+#ifdef ERR_LIB_PROV
+    {"PROV", ERR_LIB_PROV},
+#endif
+#ifdef ERR_LIB_PROXY
+    {"PROXY", ERR_LIB_PROXY},
+#endif
+#ifdef ERR_LIB_RAND
+    {"RAND", ERR_LIB_RAND},
+#endif
+#ifdef ERR_LIB_RSA
+    {"RSA", ERR_LIB_RSA},
+#endif
+#ifdef ERR_LIB_RSAREF
+    {"RSAREF", ERR_LIB_RSAREF},
+#endif
+#ifdef ERR_LIB_SM2
+    {"SM2", ERR_LIB_SM2},
+#endif
+#ifdef ERR_LIB_SSL
+    {"SSL", ERR_LIB_SSL},
+#endif
+#ifdef ERR_LIB_SSL2
+    {"SSL2", ERR_LIB_SSL2},
+#endif
+#ifdef ERR_LIB_SSL23
+    {"SSL23", ERR_LIB_SSL23},
+#endif
+#ifdef ERR_LIB_SSL3
+    {"SSL3", ERR_LIB_SSL3},
+#endif
+#ifdef ERR_LIB_SYS
+    {"SYS", ERR_LIB_SYS},
+#endif
+#ifdef ERR_LIB_TS
+    {"TS", ERR_LIB_TS},
+#endif
+#ifdef ERR_LIB_UI
+    {"UI", ERR_LIB_UI},
+#endif
+#ifdef ERR_LIB_USER
+    {"USER", ERR_LIB_USER},
+#endif
+#ifdef ERR_LIB_X509
+    {"X509", ERR_LIB_X509},
+#endif
+#ifdef ERR_LIB_X509V3
+    {"X509V3", ERR_LIB_X509V3},
+#endif
+    { NULL }
+};
+
+
+static struct py_ssl_error_code error_codes[] = {
+  #ifdef ASN1_R_ADDING_OBJECT
+    {"ADDING_OBJECT", ERR_LIB_ASN1, ASN1_R_ADDING_OBJECT},
+  #else
+    {"ADDING_OBJECT", 13, 171},
+  #endif
+  #ifdef ASN1_R_ASN1_PARSE_ERROR
+    {"ASN1_PARSE_ERROR", ERR_LIB_ASN1, ASN1_R_ASN1_PARSE_ERROR},
+  #else
+    {"ASN1_PARSE_ERROR", 13, 203},
+  #endif
+  #ifdef ASN1_R_ASN1_SIG_PARSE_ERROR
+    {"ASN1_SIG_PARSE_ERROR", ERR_LIB_ASN1, ASN1_R_ASN1_SIG_PARSE_ERROR},
+  #else
+    {"ASN1_SIG_PARSE_ERROR", 13, 204},
+  #endif
+  #ifdef ASN1_R_AUX_ERROR
+    {"AUX_ERROR", ERR_LIB_ASN1, ASN1_R_AUX_ERROR},
+  #else
+    {"AUX_ERROR", 13, 100},
+  #endif
+  #ifdef ASN1_R_BAD_OBJECT_HEADER
+    {"BAD_OBJECT_HEADER", ERR_LIB_ASN1, ASN1_R_BAD_OBJECT_HEADER},
+  #else
+    {"BAD_OBJECT_HEADER", 13, 102},
+  #endif
+  #ifdef ASN1_R_BAD_TEMPLATE
+    {"BAD_TEMPLATE", ERR_LIB_ASN1, ASN1_R_BAD_TEMPLATE},
+  #else
+    {"BAD_TEMPLATE", 13, 230},
+  #endif
+  #ifdef ASN1_R_BMPSTRING_IS_WRONG_LENGTH
+    {"BMPSTRING_IS_WRONG_LENGTH", ERR_LIB_ASN1, ASN1_R_BMPSTRING_IS_WRONG_LENGTH},
+  #else
+    {"BMPSTRING_IS_WRONG_LENGTH", 13, 214},
+  #endif
+  #ifdef ASN1_R_BN_LIB
+    {"BN_LIB", ERR_LIB_ASN1, ASN1_R_BN_LIB},
+  #else
+    {"BN_LIB", 13, 105},
+  #endif
+  #ifdef ASN1_R_BOOLEAN_IS_WRONG_LENGTH
+    {"BOOLEAN_IS_WRONG_LENGTH", ERR_LIB_ASN1, ASN1_R_BOOLEAN_IS_WRONG_LENGTH},
+  #else
+    {"BOOLEAN_IS_WRONG_LENGTH", 13, 106},
+  #endif
+  #ifdef ASN1_R_BUFFER_TOO_SMALL
+    {"BUFFER_TOO_SMALL", ERR_LIB_ASN1, ASN1_R_BUFFER_TOO_SMALL},
+  #else
+    {"BUFFER_TOO_SMALL", 13, 107},
+  #endif
+  #ifdef ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER
+    {"CIPHER_HAS_NO_OBJECT_IDENTIFIER", ERR_LIB_ASN1, ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER},
+  #else
+    {"CIPHER_HAS_NO_OBJECT_IDENTIFIER", 13, 108},
+  #endif
+  #ifdef ASN1_R_CONTEXT_NOT_INITIALISED
+    {"CONTEXT_NOT_INITIALISED", ERR_LIB_ASN1, ASN1_R_CONTEXT_NOT_INITIALISED},
+  #else
+    {"CONTEXT_NOT_INITIALISED", 13, 217},
+  #endif
+  #ifdef ASN1_R_DATA_IS_WRONG
+    {"DATA_IS_WRONG", ERR_LIB_ASN1, ASN1_R_DATA_IS_WRONG},
+  #else
+    {"DATA_IS_WRONG", 13, 109},
+  #endif
+  #ifdef ASN1_R_DECODE_ERROR
+    {"DECODE_ERROR", ERR_LIB_ASN1, ASN1_R_DECODE_ERROR},
+  #else
+    {"DECODE_ERROR", 13, 110},
+  #endif
+  #ifdef ASN1_R_DEPTH_EXCEEDED
+    {"DEPTH_EXCEEDED", ERR_LIB_ASN1, ASN1_R_DEPTH_EXCEEDED},
+  #else
+    {"DEPTH_EXCEEDED", 13, 174},
+  #endif
+  #ifdef ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED
+    {"DIGEST_AND_KEY_TYPE_NOT_SUPPORTED", ERR_LIB_ASN1, ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED},
+  #else
+    {"DIGEST_AND_KEY_TYPE_NOT_SUPPORTED", 13, 198},
+  #endif
+  #ifdef ASN1_R_ENCODE_ERROR
+    {"ENCODE_ERROR", ERR_LIB_ASN1, ASN1_R_ENCODE_ERROR},
+  #else
+    {"ENCODE_ERROR", 13, 112},
+  #endif
+  #ifdef ASN1_R_ERROR_GETTING_TIME
+    {"ERROR_GETTING_TIME", ERR_LIB_ASN1, ASN1_R_ERROR_GETTING_TIME},
+  #else
+    {"ERROR_GETTING_TIME", 13, 173},
+  #endif
+  #ifdef ASN1_R_ERROR_LOADING_SECTION
+    {"ERROR_LOADING_SECTION", ERR_LIB_ASN1, ASN1_R_ERROR_LOADING_SECTION},
+  #else
+    {"ERROR_LOADING_SECTION", 13, 172},
+  #endif
+  #ifdef ASN1_R_ERROR_SETTING_CIPHER_PARAMS
+    {"ERROR_SETTING_CIPHER_PARAMS", ERR_LIB_ASN1, ASN1_R_ERROR_SETTING_CIPHER_PARAMS},
+  #else
+    {"ERROR_SETTING_CIPHER_PARAMS", 13, 114},
+  #endif
+  #ifdef ASN1_R_EXPECTING_AN_INTEGER
+    {"EXPECTING_AN_INTEGER", ERR_LIB_ASN1, ASN1_R_EXPECTING_AN_INTEGER},
+  #else
+    {"EXPECTING_AN_INTEGER", 13, 115},
+  #endif
+  #ifdef ASN1_R_EXPECTING_AN_OBJECT
+    {"EXPECTING_AN_OBJECT", ERR_LIB_ASN1, ASN1_R_EXPECTING_AN_OBJECT},
+  #else
+    {"EXPECTING_AN_OBJECT", 13, 116},
+  #endif
+  #ifdef ASN1_R_EXPLICIT_LENGTH_MISMATCH
+    {"EXPLICIT_LENGTH_MISMATCH", ERR_LIB_ASN1, ASN1_R_EXPLICIT_LENGTH_MISMATCH},
+  #else
+    {"EXPLICIT_LENGTH_MISMATCH", 13, 119},
+  #endif
+  #ifdef ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED
+    {"EXPLICIT_TAG_NOT_CONSTRUCTED", ERR_LIB_ASN1, ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED},
+  #else
+    {"EXPLICIT_TAG_NOT_CONSTRUCTED", 13, 120},
+  #endif
+  #ifdef ASN1_R_FIELD_MISSING
+    {"FIELD_MISSING", ERR_LIB_ASN1, ASN1_R_FIELD_MISSING},
+  #else
+    {"FIELD_MISSING", 13, 121},
+  #endif
+  #ifdef ASN1_R_FIRST_NUM_TOO_LARGE
+    {"FIRST_NUM_TOO_LARGE", ERR_LIB_ASN1, ASN1_R_FIRST_NUM_TOO_LARGE},
+  #else
+    {"FIRST_NUM_TOO_LARGE", 13, 122},
+  #endif
+  #ifdef ASN1_R_HEADER_TOO_LONG
+    {"HEADER_TOO_LONG", ERR_LIB_ASN1, ASN1_R_HEADER_TOO_LONG},
+  #else
+    {"HEADER_TOO_LONG", 13, 123},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_BITSTRING_FORMAT
+    {"ILLEGAL_BITSTRING_FORMAT", ERR_LIB_ASN1, ASN1_R_ILLEGAL_BITSTRING_FORMAT},
+  #else
+    {"ILLEGAL_BITSTRING_FORMAT", 13, 175},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_BOOLEAN
+    {"ILLEGAL_BOOLEAN", ERR_LIB_ASN1, ASN1_R_ILLEGAL_BOOLEAN},
+  #else
+    {"ILLEGAL_BOOLEAN", 13, 176},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_CHARACTERS
+    {"ILLEGAL_CHARACTERS", ERR_LIB_ASN1, ASN1_R_ILLEGAL_CHARACTERS},
+  #else
+    {"ILLEGAL_CHARACTERS", 13, 124},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_FORMAT
+    {"ILLEGAL_FORMAT", ERR_LIB_ASN1, ASN1_R_ILLEGAL_FORMAT},
+  #else
+    {"ILLEGAL_FORMAT", 13, 177},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_HEX
+    {"ILLEGAL_HEX", ERR_LIB_ASN1, ASN1_R_ILLEGAL_HEX},
+  #else
+    {"ILLEGAL_HEX", 13, 178},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_IMPLICIT_TAG
+    {"ILLEGAL_IMPLICIT_TAG", ERR_LIB_ASN1, ASN1_R_ILLEGAL_IMPLICIT_TAG},
+  #else
+    {"ILLEGAL_IMPLICIT_TAG", 13, 179},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_INTEGER
+    {"ILLEGAL_INTEGER", ERR_LIB_ASN1, ASN1_R_ILLEGAL_INTEGER},
+  #else
+    {"ILLEGAL_INTEGER", 13, 180},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_NEGATIVE_VALUE
+    {"ILLEGAL_NEGATIVE_VALUE", ERR_LIB_ASN1, ASN1_R_ILLEGAL_NEGATIVE_VALUE},
+  #else
+    {"ILLEGAL_NEGATIVE_VALUE", 13, 226},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_NESTED_TAGGING
+    {"ILLEGAL_NESTED_TAGGING", ERR_LIB_ASN1, ASN1_R_ILLEGAL_NESTED_TAGGING},
+  #else
+    {"ILLEGAL_NESTED_TAGGING", 13, 181},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_NULL
+    {"ILLEGAL_NULL", ERR_LIB_ASN1, ASN1_R_ILLEGAL_NULL},
+  #else
+    {"ILLEGAL_NULL", 13, 125},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_NULL_VALUE
+    {"ILLEGAL_NULL_VALUE", ERR_LIB_ASN1, ASN1_R_ILLEGAL_NULL_VALUE},
+  #else
+    {"ILLEGAL_NULL_VALUE", 13, 182},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_OBJECT
+    {"ILLEGAL_OBJECT", ERR_LIB_ASN1, ASN1_R_ILLEGAL_OBJECT},
+  #else
+    {"ILLEGAL_OBJECT", 13, 183},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_OPTIONAL_ANY
+    {"ILLEGAL_OPTIONAL_ANY", ERR_LIB_ASN1, ASN1_R_ILLEGAL_OPTIONAL_ANY},
+  #else
+    {"ILLEGAL_OPTIONAL_ANY", 13, 126},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE
+    {"ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE", ERR_LIB_ASN1, ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE},
+  #else
+    {"ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE", 13, 170},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_PADDING
+    {"ILLEGAL_PADDING", ERR_LIB_ASN1, ASN1_R_ILLEGAL_PADDING},
+  #else
+    {"ILLEGAL_PADDING", 13, 221},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_TAGGED_ANY
+    {"ILLEGAL_TAGGED_ANY", ERR_LIB_ASN1, ASN1_R_ILLEGAL_TAGGED_ANY},
+  #else
+    {"ILLEGAL_TAGGED_ANY", 13, 127},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_TIME_VALUE
+    {"ILLEGAL_TIME_VALUE", ERR_LIB_ASN1, ASN1_R_ILLEGAL_TIME_VALUE},
+  #else
+    {"ILLEGAL_TIME_VALUE", 13, 184},
+  #endif
+  #ifdef ASN1_R_ILLEGAL_ZERO_CONTENT
+    {"ILLEGAL_ZERO_CONTENT", ERR_LIB_ASN1, ASN1_R_ILLEGAL_ZERO_CONTENT},
+  #else
+    {"ILLEGAL_ZERO_CONTENT", 13, 222},
+  #endif
+  #ifdef ASN1_R_INTEGER_NOT_ASCII_FORMAT
+    {"INTEGER_NOT_ASCII_FORMAT", ERR_LIB_ASN1, ASN1_R_INTEGER_NOT_ASCII_FORMAT},
+  #else
+    {"INTEGER_NOT_ASCII_FORMAT", 13, 185},
+  #endif
+  #ifdef ASN1_R_INTEGER_TOO_LARGE_FOR_LONG
+    {"INTEGER_TOO_LARGE_FOR_LONG", ERR_LIB_ASN1, ASN1_R_INTEGER_TOO_LARGE_FOR_LONG},
+  #else
+    {"INTEGER_TOO_LARGE_FOR_LONG", 13, 128},
+  #endif
+  #ifdef ASN1_R_INVALID_BIT_STRING_BITS_LEFT
+    {"INVALID_BIT_STRING_BITS_LEFT", ERR_LIB_ASN1, ASN1_R_INVALID_BIT_STRING_BITS_LEFT},
+  #else
+    {"INVALID_BIT_STRING_BITS_LEFT", 13, 220},
+  #endif
+  #ifdef ASN1_R_INVALID_BMPSTRING_LENGTH
+    {"INVALID_BMPSTRING_LENGTH", ERR_LIB_ASN1, ASN1_R_INVALID_BMPSTRING_LENGTH},
+  #else
+    {"INVALID_BMPSTRING_LENGTH", 13, 129},
+  #endif
+  #ifdef ASN1_R_INVALID_DIGIT
+    {"INVALID_DIGIT", ERR_LIB_ASN1, ASN1_R_INVALID_DIGIT},
+  #else
+    {"INVALID_DIGIT", 13, 130},
+  #endif
+  #ifdef ASN1_R_INVALID_MIME_TYPE
+    {"INVALID_MIME_TYPE", ERR_LIB_ASN1, ASN1_R_INVALID_MIME_TYPE},
+  #else
+    {"INVALID_MIME_TYPE", 13, 205},
+  #endif
+  #ifdef ASN1_R_INVALID_MODIFIER
+    {"INVALID_MODIFIER", ERR_LIB_ASN1, ASN1_R_INVALID_MODIFIER},
+  #else
+    {"INVALID_MODIFIER", 13, 186},
+  #endif
+  #ifdef ASN1_R_INVALID_NUMBER
+    {"INVALID_NUMBER", ERR_LIB_ASN1, ASN1_R_INVALID_NUMBER},
+  #else
+    {"INVALID_NUMBER", 13, 187},
+  #endif
+  #ifdef ASN1_R_INVALID_OBJECT_ENCODING
+    {"INVALID_OBJECT_ENCODING", ERR_LIB_ASN1, ASN1_R_INVALID_OBJECT_ENCODING},
+  #else
+    {"INVALID_OBJECT_ENCODING", 13, 216},
+  #endif
+  #ifdef ASN1_R_INVALID_SCRYPT_PARAMETERS
+    {"INVALID_SCRYPT_PARAMETERS", ERR_LIB_ASN1, ASN1_R_INVALID_SCRYPT_PARAMETERS},
+  #else
+    {"INVALID_SCRYPT_PARAMETERS", 13, 227},
+  #endif
+  #ifdef ASN1_R_INVALID_SEPARATOR
+    {"INVALID_SEPARATOR", ERR_LIB_ASN1, ASN1_R_INVALID_SEPARATOR},
+  #else
+    {"INVALID_SEPARATOR", 13, 131},
+  #endif
+  #ifdef ASN1_R_INVALID_STRING_TABLE_VALUE
+    {"INVALID_STRING_TABLE_VALUE", ERR_LIB_ASN1, ASN1_R_INVALID_STRING_TABLE_VALUE},
+  #else
+    {"INVALID_STRING_TABLE_VALUE", 13, 218},
+  #endif
+  #ifdef ASN1_R_INVALID_UNIVERSALSTRING_LENGTH
+    {"INVALID_UNIVERSALSTRING_LENGTH", ERR_LIB_ASN1, ASN1_R_INVALID_UNIVERSALSTRING_LENGTH},
+  #else
+    {"INVALID_UNIVERSALSTRING_LENGTH", 13, 133},
+  #endif
+  #ifdef ASN1_R_INVALID_UTF8STRING
+    {"INVALID_UTF8STRING", ERR_LIB_ASN1, ASN1_R_INVALID_UTF8STRING},
+  #else
+    {"INVALID_UTF8STRING", 13, 134},
+  #endif
+  #ifdef ASN1_R_INVALID_VALUE
+    {"INVALID_VALUE", ERR_LIB_ASN1, ASN1_R_INVALID_VALUE},
+  #else
+    {"INVALID_VALUE", 13, 219},
+  #endif
+  #ifdef ASN1_R_LENGTH_TOO_LONG
+    {"LENGTH_TOO_LONG", ERR_LIB_ASN1, ASN1_R_LENGTH_TOO_LONG},
+  #else
+    {"LENGTH_TOO_LONG", 13, 231},
+  #endif
+  #ifdef ASN1_R_LIST_ERROR
+    {"LIST_ERROR", ERR_LIB_ASN1, ASN1_R_LIST_ERROR},
+  #else
+    {"LIST_ERROR", 13, 188},
+  #endif
+  #ifdef ASN1_R_MIME_NO_CONTENT_TYPE
+    {"MIME_NO_CONTENT_TYPE", ERR_LIB_ASN1, ASN1_R_MIME_NO_CONTENT_TYPE},
+  #else
+    {"MIME_NO_CONTENT_TYPE", 13, 206},
+  #endif
+  #ifdef ASN1_R_MIME_PARSE_ERROR
+    {"MIME_PARSE_ERROR", ERR_LIB_ASN1, ASN1_R_MIME_PARSE_ERROR},
+  #else
+    {"MIME_PARSE_ERROR", 13, 207},
+  #endif
+  #ifdef ASN1_R_MIME_SIG_PARSE_ERROR
+    {"MIME_SIG_PARSE_ERROR", ERR_LIB_ASN1, ASN1_R_MIME_SIG_PARSE_ERROR},
+  #else
+    {"MIME_SIG_PARSE_ERROR", 13, 208},
+  #endif
+  #ifdef ASN1_R_MISSING_EOC
+    {"MISSING_EOC", ERR_LIB_ASN1, ASN1_R_MISSING_EOC},
+  #else
+    {"MISSING_EOC", 13, 137},
+  #endif
+  #ifdef ASN1_R_MISSING_SECOND_NUMBER
+    {"MISSING_SECOND_NUMBER", ERR_LIB_ASN1, ASN1_R_MISSING_SECOND_NUMBER},
+  #else
+    {"MISSING_SECOND_NUMBER", 13, 138},
+  #endif
+  #ifdef ASN1_R_MISSING_VALUE
+    {"MISSING_VALUE", ERR_LIB_ASN1, ASN1_R_MISSING_VALUE},
+  #else
+    {"MISSING_VALUE", 13, 189},
+  #endif
+  #ifdef ASN1_R_MSTRING_NOT_UNIVERSAL
+    {"MSTRING_NOT_UNIVERSAL", ERR_LIB_ASN1, ASN1_R_MSTRING_NOT_UNIVERSAL},
+  #else
+    {"MSTRING_NOT_UNIVERSAL", 13, 139},
+  #endif
+  #ifdef ASN1_R_MSTRING_WRONG_TAG
+    {"MSTRING_WRONG_TAG", ERR_LIB_ASN1, ASN1_R_MSTRING_WRONG_TAG},
+  #else
+    {"MSTRING_WRONG_TAG", 13, 140},
+  #endif
+  #ifdef ASN1_R_NESTED_ASN1_STRING
+    {"NESTED_ASN1_STRING", ERR_LIB_ASN1, ASN1_R_NESTED_ASN1_STRING},
+  #else
+    {"NESTED_ASN1_STRING", 13, 197},
+  #endif
+  #ifdef ASN1_R_NESTED_TOO_DEEP
+    {"NESTED_TOO_DEEP", ERR_LIB_ASN1, ASN1_R_NESTED_TOO_DEEP},
+  #else
+    {"NESTED_TOO_DEEP", 13, 201},
+  #endif
+  #ifdef ASN1_R_NON_HEX_CHARACTERS
+    {"NON_HEX_CHARACTERS", ERR_LIB_ASN1, ASN1_R_NON_HEX_CHARACTERS},
+  #else
+    {"NON_HEX_CHARACTERS", 13, 141},
+  #endif
+  #ifdef ASN1_R_NOT_ASCII_FORMAT
+    {"NOT_ASCII_FORMAT", ERR_LIB_ASN1, ASN1_R_NOT_ASCII_FORMAT},
+  #else
+    {"NOT_ASCII_FORMAT", 13, 190},
+  #endif
+  #ifdef ASN1_R_NOT_ENOUGH_DATA
+    {"NOT_ENOUGH_DATA", ERR_LIB_ASN1, ASN1_R_NOT_ENOUGH_DATA},
+  #else
+    {"NOT_ENOUGH_DATA", 13, 142},
+  #endif
+  #ifdef ASN1_R_NO_CONTENT_TYPE
+    {"NO_CONTENT_TYPE", ERR_LIB_ASN1, ASN1_R_NO_CONTENT_TYPE},
+  #else
+    {"NO_CONTENT_TYPE", 13, 209},
+  #endif
+  #ifdef ASN1_R_NO_MATCHING_CHOICE_TYPE
+    {"NO_MATCHING_CHOICE_TYPE", ERR_LIB_ASN1, ASN1_R_NO_MATCHING_CHOICE_TYPE},
+  #else
+    {"NO_MATCHING_CHOICE_TYPE", 13, 143},
+  #endif
+  #ifdef ASN1_R_NO_MULTIPART_BODY_FAILURE
+    {"NO_MULTIPART_BODY_FAILURE", ERR_LIB_ASN1, ASN1_R_NO_MULTIPART_BODY_FAILURE},
+  #else
+    {"NO_MULTIPART_BODY_FAILURE", 13, 210},
+  #endif
+  #ifdef ASN1_R_NO_MULTIPART_BOUNDARY
+    {"NO_MULTIPART_BOUNDARY", ERR_LIB_ASN1, ASN1_R_NO_MULTIPART_BOUNDARY},
+  #else
+    {"NO_MULTIPART_BOUNDARY", 13, 211},
+  #endif
+  #ifdef ASN1_R_NO_SIG_CONTENT_TYPE
+    {"NO_SIG_CONTENT_TYPE", ERR_LIB_ASN1, ASN1_R_NO_SIG_CONTENT_TYPE},
+  #else
+    {"NO_SIG_CONTENT_TYPE", 13, 212},
+  #endif
+  #ifdef ASN1_R_NULL_IS_WRONG_LENGTH
+    {"NULL_IS_WRONG_LENGTH", ERR_LIB_ASN1, ASN1_R_NULL_IS_WRONG_LENGTH},
+  #else
+    {"NULL_IS_WRONG_LENGTH", 13, 144},
+  #endif
+  #ifdef ASN1_R_OBJECT_NOT_ASCII_FORMAT
+    {"OBJECT_NOT_ASCII_FORMAT", ERR_LIB_ASN1, ASN1_R_OBJECT_NOT_ASCII_FORMAT},
+  #else
+    {"OBJECT_NOT_ASCII_FORMAT", 13, 191},
+  #endif
+  #ifdef ASN1_R_ODD_NUMBER_OF_CHARS
+    {"ODD_NUMBER_OF_CHARS", ERR_LIB_ASN1, ASN1_R_ODD_NUMBER_OF_CHARS},
+  #else
+    {"ODD_NUMBER_OF_CHARS", 13, 145},
+  #endif
+  #ifdef ASN1_R_SECOND_NUMBER_TOO_LARGE
+    {"SECOND_NUMBER_TOO_LARGE", ERR_LIB_ASN1, ASN1_R_SECOND_NUMBER_TOO_LARGE},
+  #else
+    {"SECOND_NUMBER_TOO_LARGE", 13, 147},
+  #endif
+  #ifdef ASN1_R_SEQUENCE_LENGTH_MISMATCH
+    {"SEQUENCE_LENGTH_MISMATCH", ERR_LIB_ASN1, ASN1_R_SEQUENCE_LENGTH_MISMATCH},
+  #else
+    {"SEQUENCE_LENGTH_MISMATCH", 13, 148},
+  #endif
+  #ifdef ASN1_R_SEQUENCE_NOT_CONSTRUCTED
+    {"SEQUENCE_NOT_CONSTRUCTED", ERR_LIB_ASN1, ASN1_R_SEQUENCE_NOT_CONSTRUCTED},
+  #else
+    {"SEQUENCE_NOT_CONSTRUCTED", 13, 149},
+  #endif
+  #ifdef ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG
+    {"SEQUENCE_OR_SET_NEEDS_CONFIG", ERR_LIB_ASN1, ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG},
+  #else
+    {"SEQUENCE_OR_SET_NEEDS_CONFIG", 13, 192},
+  #endif
+  #ifdef ASN1_R_SHORT_LINE
+    {"SHORT_LINE", ERR_LIB_ASN1, ASN1_R_SHORT_LINE},
+  #else
+    {"SHORT_LINE", 13, 150},
+  #endif
+  #ifdef ASN1_R_SIG_INVALID_MIME_TYPE
+    {"SIG_INVALID_MIME_TYPE", ERR_LIB_ASN1, ASN1_R_SIG_INVALID_MIME_TYPE},
+  #else
+    {"SIG_INVALID_MIME_TYPE", 13, 213},
+  #endif
+  #ifdef ASN1_R_STREAMING_NOT_SUPPORTED
+    {"STREAMING_NOT_SUPPORTED", ERR_LIB_ASN1, ASN1_R_STREAMING_NOT_SUPPORTED},
+  #else
+    {"STREAMING_NOT_SUPPORTED", 13, 202},
+  #endif
+  #ifdef ASN1_R_STRING_TOO_LONG
+    {"STRING_TOO_LONG", ERR_LIB_ASN1, ASN1_R_STRING_TOO_LONG},
+  #else
+    {"STRING_TOO_LONG", 13, 151},
+  #endif
+  #ifdef ASN1_R_STRING_TOO_SHORT
+    {"STRING_TOO_SHORT", ERR_LIB_ASN1, ASN1_R_STRING_TOO_SHORT},
+  #else
+    {"STRING_TOO_SHORT", 13, 152},
+  #endif
+  #ifdef ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD
+    {"THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD", ERR_LIB_ASN1, ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD},
+  #else
+    {"THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD", 13, 154},
+  #endif
+  #ifdef ASN1_R_TIME_NOT_ASCII_FORMAT
+    {"TIME_NOT_ASCII_FORMAT", ERR_LIB_ASN1, ASN1_R_TIME_NOT_ASCII_FORMAT},
+  #else
+    {"TIME_NOT_ASCII_FORMAT", 13, 193},
+  #endif
+  #ifdef ASN1_R_TOO_LARGE
+    {"TOO_LARGE", ERR_LIB_ASN1, ASN1_R_TOO_LARGE},
+  #else
+    {"TOO_LARGE", 13, 223},
+  #endif
+  #ifdef ASN1_R_TOO_LONG
+    {"TOO_LONG", ERR_LIB_ASN1, ASN1_R_TOO_LONG},
+  #else
+    {"TOO_LONG", 13, 155},
+  #endif
+  #ifdef ASN1_R_TOO_SMALL
+    {"TOO_SMALL", ERR_LIB_ASN1, ASN1_R_TOO_SMALL},
+  #else
+    {"TOO_SMALL", 13, 224},
+  #endif
+  #ifdef ASN1_R_TYPE_NOT_CONSTRUCTED
+    {"TYPE_NOT_CONSTRUCTED", ERR_LIB_ASN1, ASN1_R_TYPE_NOT_CONSTRUCTED},
+  #else
+    {"TYPE_NOT_CONSTRUCTED", 13, 156},
+  #endif
+  #ifdef ASN1_R_TYPE_NOT_PRIMITIVE
+    {"TYPE_NOT_PRIMITIVE", ERR_LIB_ASN1, ASN1_R_TYPE_NOT_PRIMITIVE},
+  #else
+    {"TYPE_NOT_PRIMITIVE", 13, 195},
+  #endif
+  #ifdef ASN1_R_UNEXPECTED_EOC
+    {"UNEXPECTED_EOC", ERR_LIB_ASN1, ASN1_R_UNEXPECTED_EOC},
+  #else
+    {"UNEXPECTED_EOC", 13, 159},
+  #endif
+  #ifdef ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH
+    {"UNIVERSALSTRING_IS_WRONG_LENGTH", ERR_LIB_ASN1, ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH},
+  #else
+    {"UNIVERSALSTRING_IS_WRONG_LENGTH", 13, 215},
+  #endif
+  #ifdef ASN1_R_UNKNOWN_DIGEST
+    {"UNKNOWN_DIGEST", ERR_LIB_ASN1, ASN1_R_UNKNOWN_DIGEST},
+  #else
+    {"UNKNOWN_DIGEST", 13, 229},
+  #endif
+  #ifdef ASN1_R_UNKNOWN_FORMAT
+    {"UNKNOWN_FORMAT", ERR_LIB_ASN1, ASN1_R_UNKNOWN_FORMAT},
+  #else
+    {"UNKNOWN_FORMAT", 13, 160},
+  #endif
+  #ifdef ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM
+    {"UNKNOWN_MESSAGE_DIGEST_ALGORITHM", ERR_LIB_ASN1, ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM},
+  #else
+    {"UNKNOWN_MESSAGE_DIGEST_ALGORITHM", 13, 161},
+  #endif
+  #ifdef ASN1_R_UNKNOWN_OBJECT_TYPE
+    {"UNKNOWN_OBJECT_TYPE", ERR_LIB_ASN1, ASN1_R_UNKNOWN_OBJECT_TYPE},
+  #else
+    {"UNKNOWN_OBJECT_TYPE", 13, 162},
+  #endif
+  #ifdef ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE
+    {"UNKNOWN_PUBLIC_KEY_TYPE", ERR_LIB_ASN1, ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE},
+  #else
+    {"UNKNOWN_PUBLIC_KEY_TYPE", 13, 163},
+  #endif
+  #ifdef ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM
+    {"UNKNOWN_SIGNATURE_ALGORITHM", ERR_LIB_ASN1, ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM},
+  #else
+    {"UNKNOWN_SIGNATURE_ALGORITHM", 13, 199},
+  #endif
+  #ifdef ASN1_R_UNKNOWN_TAG
+    {"UNKNOWN_TAG", ERR_LIB_ASN1, ASN1_R_UNKNOWN_TAG},
+  #else
+    {"UNKNOWN_TAG", 13, 194},
+  #endif
+  #ifdef ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE
+    {"UNSUPPORTED_ANY_DEFINED_BY_TYPE", ERR_LIB_ASN1, ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE},
+  #else
+    {"UNSUPPORTED_ANY_DEFINED_BY_TYPE", 13, 164},
+  #endif
+  #ifdef ASN1_R_UNSUPPORTED_CIPHER
+    {"UNSUPPORTED_CIPHER", ERR_LIB_ASN1, ASN1_R_UNSUPPORTED_CIPHER},
+  #else
+    {"UNSUPPORTED_CIPHER", 13, 228},
+  #endif
+  #ifdef ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE
+    {"UNSUPPORTED_PUBLIC_KEY_TYPE", ERR_LIB_ASN1, ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE},
+  #else
+    {"UNSUPPORTED_PUBLIC_KEY_TYPE", 13, 167},
+  #endif
+  #ifdef ASN1_R_UNSUPPORTED_TYPE
+    {"UNSUPPORTED_TYPE", ERR_LIB_ASN1, ASN1_R_UNSUPPORTED_TYPE},
+  #else
+    {"UNSUPPORTED_TYPE", 13, 196},
+  #endif
+  #ifdef ASN1_R_WRONG_INTEGER_TYPE
+    {"WRONG_INTEGER_TYPE", ERR_LIB_ASN1, ASN1_R_WRONG_INTEGER_TYPE},
+  #else
+    {"WRONG_INTEGER_TYPE", 13, 225},
+  #endif
+  #ifdef ASN1_R_WRONG_PUBLIC_KEY_TYPE
+    {"WRONG_PUBLIC_KEY_TYPE", ERR_LIB_ASN1, ASN1_R_WRONG_PUBLIC_KEY_TYPE},
+  #else
+    {"WRONG_PUBLIC_KEY_TYPE", 13, 200},
+  #endif
+  #ifdef ASN1_R_WRONG_TAG
+    {"WRONG_TAG", ERR_LIB_ASN1, ASN1_R_WRONG_TAG},
+  #else
+    {"WRONG_TAG", 13, 168},
+  #endif
+  #ifdef ASYNC_R_FAILED_TO_SET_POOL
+    {"FAILED_TO_SET_POOL", ERR_LIB_ASYNC, ASYNC_R_FAILED_TO_SET_POOL},
+  #else
+    {"FAILED_TO_SET_POOL", 51, 101},
+  #endif
+  #ifdef ASYNC_R_FAILED_TO_SWAP_CONTEXT
+    {"FAILED_TO_SWAP_CONTEXT", ERR_LIB_ASYNC, ASYNC_R_FAILED_TO_SWAP_CONTEXT},
+  #else
+    {"FAILED_TO_SWAP_CONTEXT", 51, 102},
+  #endif
+  #ifdef ASYNC_R_INIT_FAILED
+    {"INIT_FAILED", ERR_LIB_ASYNC, ASYNC_R_INIT_FAILED},
+  #else
+    {"INIT_FAILED", 51, 105},
+  #endif
+  #ifdef ASYNC_R_INVALID_POOL_SIZE
+    {"INVALID_POOL_SIZE", ERR_LIB_ASYNC, ASYNC_R_INVALID_POOL_SIZE},
+  #else
+    {"INVALID_POOL_SIZE", 51, 103},
+  #endif
+  #ifdef BIO_R_ACCEPT_ERROR
+    {"ACCEPT_ERROR", ERR_LIB_BIO, BIO_R_ACCEPT_ERROR},
+  #else
+    {"ACCEPT_ERROR", 32, 100},
+  #endif
+  #ifdef BIO_R_ADDRINFO_ADDR_IS_NOT_AF_INET
+    {"ADDRINFO_ADDR_IS_NOT_AF_INET", ERR_LIB_BIO, BIO_R_ADDRINFO_ADDR_IS_NOT_AF_INET},
+  #else
+    {"ADDRINFO_ADDR_IS_NOT_AF_INET", 32, 141},
+  #endif
+  #ifdef BIO_R_AMBIGUOUS_HOST_OR_SERVICE
+    {"AMBIGUOUS_HOST_OR_SERVICE", ERR_LIB_BIO, BIO_R_AMBIGUOUS_HOST_OR_SERVICE},
+  #else
+    {"AMBIGUOUS_HOST_OR_SERVICE", 32, 129},
+  #endif
+  #ifdef BIO_R_BAD_FOPEN_MODE
+    {"BAD_FOPEN_MODE", ERR_LIB_BIO, BIO_R_BAD_FOPEN_MODE},
+  #else
+    {"BAD_FOPEN_MODE", 32, 101},
+  #endif
+  #ifdef BIO_R_BROKEN_PIPE
+    {"BROKEN_PIPE", ERR_LIB_BIO, BIO_R_BROKEN_PIPE},
+  #else
+    {"BROKEN_PIPE", 32, 124},
+  #endif
+  #ifdef BIO_R_CONNECT_ERROR
+    {"CONNECT_ERROR", ERR_LIB_BIO, BIO_R_CONNECT_ERROR},
+  #else
+    {"CONNECT_ERROR", 32, 103},
+  #endif
+  #ifdef BIO_R_CONNECT_TIMEOUT
+    {"CONNECT_TIMEOUT", ERR_LIB_BIO, BIO_R_CONNECT_TIMEOUT},
+  #else
+    {"CONNECT_TIMEOUT", 32, 147},
+  #endif
+  #ifdef BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET
+    {"GETHOSTBYNAME_ADDR_IS_NOT_AF_INET", ERR_LIB_BIO, BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET},
+  #else
+    {"GETHOSTBYNAME_ADDR_IS_NOT_AF_INET", 32, 107},
+  #endif
+  #ifdef BIO_R_GETSOCKNAME_ERROR
+    {"GETSOCKNAME_ERROR", ERR_LIB_BIO, BIO_R_GETSOCKNAME_ERROR},
+  #else
+    {"GETSOCKNAME_ERROR", 32, 132},
+  #endif
+  #ifdef BIO_R_GETSOCKNAME_TRUNCATED_ADDRESS
+    {"GETSOCKNAME_TRUNCATED_ADDRESS", ERR_LIB_BIO, BIO_R_GETSOCKNAME_TRUNCATED_ADDRESS},
+  #else
+    {"GETSOCKNAME_TRUNCATED_ADDRESS", 32, 133},
+  #endif
+  #ifdef BIO_R_GETTING_SOCKTYPE
+    {"GETTING_SOCKTYPE", ERR_LIB_BIO, BIO_R_GETTING_SOCKTYPE},
+  #else
+    {"GETTING_SOCKTYPE", 32, 134},
+  #endif
+  #ifdef BIO_R_INVALID_ARGUMENT
+    {"INVALID_ARGUMENT", ERR_LIB_BIO, BIO_R_INVALID_ARGUMENT},
+  #else
+    {"INVALID_ARGUMENT", 32, 125},
+  #endif
+  #ifdef BIO_R_INVALID_SOCKET
+    {"INVALID_SOCKET", ERR_LIB_BIO, BIO_R_INVALID_SOCKET},
+  #else
+    {"INVALID_SOCKET", 32, 135},
+  #endif
+  #ifdef BIO_R_IN_USE
+    {"IN_USE", ERR_LIB_BIO, BIO_R_IN_USE},
+  #else
+    {"IN_USE", 32, 123},
+  #endif
+  #ifdef BIO_R_LENGTH_TOO_LONG
+    {"LENGTH_TOO_LONG", ERR_LIB_BIO, BIO_R_LENGTH_TOO_LONG},
+  #else
+    {"LENGTH_TOO_LONG", 32, 102},
+  #endif
+  #ifdef BIO_R_LISTEN_V6_ONLY
+    {"LISTEN_V6_ONLY", ERR_LIB_BIO, BIO_R_LISTEN_V6_ONLY},
+  #else
+    {"LISTEN_V6_ONLY", 32, 136},
+  #endif
+  #ifdef BIO_R_LOOKUP_RETURNED_NOTHING
+    {"LOOKUP_RETURNED_NOTHING", ERR_LIB_BIO, BIO_R_LOOKUP_RETURNED_NOTHING},
+  #else
+    {"LOOKUP_RETURNED_NOTHING", 32, 142},
+  #endif
+  #ifdef BIO_R_MALFORMED_HOST_OR_SERVICE
+    {"MALFORMED_HOST_OR_SERVICE", ERR_LIB_BIO, BIO_R_MALFORMED_HOST_OR_SERVICE},
+  #else
+    {"MALFORMED_HOST_OR_SERVICE", 32, 130},
+  #endif
+  #ifdef BIO_R_NBIO_CONNECT_ERROR
+    {"NBIO_CONNECT_ERROR", ERR_LIB_BIO, BIO_R_NBIO_CONNECT_ERROR},
+  #else
+    {"NBIO_CONNECT_ERROR", 32, 110},
+  #endif
+  #ifdef BIO_R_NO_ACCEPT_ADDR_OR_SERVICE_SPECIFIED
+    {"NO_ACCEPT_ADDR_OR_SERVICE_SPECIFIED", ERR_LIB_BIO, BIO_R_NO_ACCEPT_ADDR_OR_SERVICE_SPECIFIED},
+  #else
+    {"NO_ACCEPT_ADDR_OR_SERVICE_SPECIFIED", 32, 143},
+  #endif
+  #ifdef BIO_R_NO_HOSTNAME_OR_SERVICE_SPECIFIED
+    {"NO_HOSTNAME_OR_SERVICE_SPECIFIED", ERR_LIB_BIO, BIO_R_NO_HOSTNAME_OR_SERVICE_SPECIFIED},
+  #else
+    {"NO_HOSTNAME_OR_SERVICE_SPECIFIED", 32, 144},
+  #endif
+  #ifdef BIO_R_NO_PORT_DEFINED
+    {"NO_PORT_DEFINED", ERR_LIB_BIO, BIO_R_NO_PORT_DEFINED},
+  #else
+    {"NO_PORT_DEFINED", 32, 113},
+  #endif
+  #ifdef BIO_R_NO_SUCH_FILE
+    {"NO_SUCH_FILE", ERR_LIB_BIO, BIO_R_NO_SUCH_FILE},
+  #else
+    {"NO_SUCH_FILE", 32, 128},
+  #endif
+  #ifdef BIO_R_TRANSFER_ERROR
+    {"TRANSFER_ERROR", ERR_LIB_BIO, BIO_R_TRANSFER_ERROR},
+  #else
+    {"TRANSFER_ERROR", 32, 104},
+  #endif
+  #ifdef BIO_R_TRANSFER_TIMEOUT
+    {"TRANSFER_TIMEOUT", ERR_LIB_BIO, BIO_R_TRANSFER_TIMEOUT},
+  #else
+    {"TRANSFER_TIMEOUT", 32, 105},
+  #endif
+  #ifdef BIO_R_UNABLE_TO_BIND_SOCKET
+    {"UNABLE_TO_BIND_SOCKET", ERR_LIB_BIO, BIO_R_UNABLE_TO_BIND_SOCKET},
+  #else
+    {"UNABLE_TO_BIND_SOCKET", 32, 117},
+  #endif
+  #ifdef BIO_R_UNABLE_TO_CREATE_SOCKET
+    {"UNABLE_TO_CREATE_SOCKET", ERR_LIB_BIO, BIO_R_UNABLE_TO_CREATE_SOCKET},
+  #else
+    {"UNABLE_TO_CREATE_SOCKET", 32, 118},
+  #endif
+  #ifdef BIO_R_UNABLE_TO_KEEPALIVE
+    {"UNABLE_TO_KEEPALIVE", ERR_LIB_BIO, BIO_R_UNABLE_TO_KEEPALIVE},
+  #else
+    {"UNABLE_TO_KEEPALIVE", 32, 137},
+  #endif
+  #ifdef BIO_R_UNABLE_TO_LISTEN_SOCKET
+    {"UNABLE_TO_LISTEN_SOCKET", ERR_LIB_BIO, BIO_R_UNABLE_TO_LISTEN_SOCKET},
+  #else
+    {"UNABLE_TO_LISTEN_SOCKET", 32, 119},
+  #endif
+  #ifdef BIO_R_UNABLE_TO_NODELAY
+    {"UNABLE_TO_NODELAY", ERR_LIB_BIO, BIO_R_UNABLE_TO_NODELAY},
+  #else
+    {"UNABLE_TO_NODELAY", 32, 138},
+  #endif
+  #ifdef BIO_R_UNABLE_TO_REUSEADDR
+    {"UNABLE_TO_REUSEADDR", ERR_LIB_BIO, BIO_R_UNABLE_TO_REUSEADDR},
+  #else
+    {"UNABLE_TO_REUSEADDR", 32, 139},
+  #endif
+  #ifdef BIO_R_UNAVAILABLE_IP_FAMILY
+    {"UNAVAILABLE_IP_FAMILY", ERR_LIB_BIO, BIO_R_UNAVAILABLE_IP_FAMILY},
+  #else
+    {"UNAVAILABLE_IP_FAMILY", 32, 145},
+  #endif
+  #ifdef BIO_R_UNINITIALIZED
+    {"UNINITIALIZED", ERR_LIB_BIO, BIO_R_UNINITIALIZED},
+  #else
+    {"UNINITIALIZED", 32, 120},
+  #endif
+  #ifdef BIO_R_UNKNOWN_INFO_TYPE
+    {"UNKNOWN_INFO_TYPE", ERR_LIB_BIO, BIO_R_UNKNOWN_INFO_TYPE},
+  #else
+    {"UNKNOWN_INFO_TYPE", 32, 140},
+  #endif
+  #ifdef BIO_R_UNSUPPORTED_IP_FAMILY
+    {"UNSUPPORTED_IP_FAMILY", ERR_LIB_BIO, BIO_R_UNSUPPORTED_IP_FAMILY},
+  #else
+    {"UNSUPPORTED_IP_FAMILY", 32, 146},
+  #endif
+  #ifdef BIO_R_UNSUPPORTED_METHOD
+    {"UNSUPPORTED_METHOD", ERR_LIB_BIO, BIO_R_UNSUPPORTED_METHOD},
+  #else
+    {"UNSUPPORTED_METHOD", 32, 121},
+  #endif
+  #ifdef BIO_R_UNSUPPORTED_PROTOCOL_FAMILY
+    {"UNSUPPORTED_PROTOCOL_FAMILY", ERR_LIB_BIO, BIO_R_UNSUPPORTED_PROTOCOL_FAMILY},
+  #else
+    {"UNSUPPORTED_PROTOCOL_FAMILY", 32, 131},
+  #endif
+  #ifdef BIO_R_WRITE_TO_READ_ONLY_BIO
+    {"WRITE_TO_READ_ONLY_BIO", ERR_LIB_BIO, BIO_R_WRITE_TO_READ_ONLY_BIO},
+  #else
+    {"WRITE_TO_READ_ONLY_BIO", 32, 126},
+  #endif
+  #ifdef BIO_R_WSASTARTUP
+    {"WSASTARTUP", ERR_LIB_BIO, BIO_R_WSASTARTUP},
+  #else
+    {"WSASTARTUP", 32, 122},
+  #endif
+  #ifdef BN_R_ARG2_LT_ARG3
+    {"ARG2_LT_ARG3", ERR_LIB_BN, BN_R_ARG2_LT_ARG3},
+  #else
+    {"ARG2_LT_ARG3", 3, 100},
+  #endif
+  #ifdef BN_R_BAD_RECIPROCAL
+    {"BAD_RECIPROCAL", ERR_LIB_BN, BN_R_BAD_RECIPROCAL},
+  #else
+    {"BAD_RECIPROCAL", 3, 101},
+  #endif
+  #ifdef BN_R_BIGNUM_TOO_LONG
+    {"BIGNUM_TOO_LONG", ERR_LIB_BN, BN_R_BIGNUM_TOO_LONG},
+  #else
+    {"BIGNUM_TOO_LONG", 3, 114},
+  #endif
+  #ifdef BN_R_BITS_TOO_SMALL
+    {"BITS_TOO_SMALL", ERR_LIB_BN, BN_R_BITS_TOO_SMALL},
+  #else
+    {"BITS_TOO_SMALL", 3, 118},
+  #endif
+  #ifdef BN_R_CALLED_WITH_EVEN_MODULUS
+    {"CALLED_WITH_EVEN_MODULUS", ERR_LIB_BN, BN_R_CALLED_WITH_EVEN_MODULUS},
+  #else
+    {"CALLED_WITH_EVEN_MODULUS", 3, 102},
+  #endif
+  #ifdef BN_R_DIV_BY_ZERO
+    {"DIV_BY_ZERO", ERR_LIB_BN, BN_R_DIV_BY_ZERO},
+  #else
+    {"DIV_BY_ZERO", 3, 103},
+  #endif
+  #ifdef BN_R_ENCODING_ERROR
+    {"ENCODING_ERROR", ERR_LIB_BN, BN_R_ENCODING_ERROR},
+  #else
+    {"ENCODING_ERROR", 3, 104},
+  #endif
+  #ifdef BN_R_EXPAND_ON_STATIC_BIGNUM_DATA
+    {"EXPAND_ON_STATIC_BIGNUM_DATA", ERR_LIB_BN, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA},
+  #else
+    {"EXPAND_ON_STATIC_BIGNUM_DATA", 3, 105},
+  #endif
+  #ifdef BN_R_INPUT_NOT_REDUCED
+    {"INPUT_NOT_REDUCED", ERR_LIB_BN, BN_R_INPUT_NOT_REDUCED},
+  #else
+    {"INPUT_NOT_REDUCED", 3, 110},
+  #endif
+  #ifdef BN_R_INVALID_LENGTH
+    {"INVALID_LENGTH", ERR_LIB_BN, BN_R_INVALID_LENGTH},
+  #else
+    {"INVALID_LENGTH", 3, 106},
+  #endif
+  #ifdef BN_R_INVALID_RANGE
+    {"INVALID_RANGE", ERR_LIB_BN, BN_R_INVALID_RANGE},
+  #else
+    {"INVALID_RANGE", 3, 115},
+  #endif
+  #ifdef BN_R_INVALID_SHIFT
+    {"INVALID_SHIFT", ERR_LIB_BN, BN_R_INVALID_SHIFT},
+  #else
+    {"INVALID_SHIFT", 3, 119},
+  #endif
+  #ifdef BN_R_NOT_A_SQUARE
+    {"NOT_A_SQUARE", ERR_LIB_BN, BN_R_NOT_A_SQUARE},
+  #else
+    {"NOT_A_SQUARE", 3, 111},
+  #endif
+  #ifdef BN_R_NOT_INITIALIZED
+    {"NOT_INITIALIZED", ERR_LIB_BN, BN_R_NOT_INITIALIZED},
+  #else
+    {"NOT_INITIALIZED", 3, 107},
+  #endif
+  #ifdef BN_R_NO_INVERSE
+    {"NO_INVERSE", ERR_LIB_BN, BN_R_NO_INVERSE},
+  #else
+    {"NO_INVERSE", 3, 108},
+  #endif
+  #ifdef BN_R_NO_SOLUTION
+    {"NO_SOLUTION", ERR_LIB_BN, BN_R_NO_SOLUTION},
+  #else
+    {"NO_SOLUTION", 3, 116},
+  #endif
+  #ifdef BN_R_NO_SUITABLE_DIGEST
+    {"NO_SUITABLE_DIGEST", ERR_LIB_BN, BN_R_NO_SUITABLE_DIGEST},
+  #else
+    {"NO_SUITABLE_DIGEST", 3, 120},
+  #endif
+  #ifdef BN_R_PRIVATE_KEY_TOO_LARGE
+    {"PRIVATE_KEY_TOO_LARGE", ERR_LIB_BN, BN_R_PRIVATE_KEY_TOO_LARGE},
+  #else
+    {"PRIVATE_KEY_TOO_LARGE", 3, 117},
+  #endif
+  #ifdef BN_R_P_IS_NOT_PRIME
+    {"P_IS_NOT_PRIME", ERR_LIB_BN, BN_R_P_IS_NOT_PRIME},
+  #else
+    {"P_IS_NOT_PRIME", 3, 112},
+  #endif
+  #ifdef BN_R_TOO_MANY_ITERATIONS
+    {"TOO_MANY_ITERATIONS", ERR_LIB_BN, BN_R_TOO_MANY_ITERATIONS},
+  #else
+    {"TOO_MANY_ITERATIONS", 3, 113},
+  #endif
+  #ifdef BN_R_TOO_MANY_TEMPORARY_VARIABLES
+    {"TOO_MANY_TEMPORARY_VARIABLES", ERR_LIB_BN, BN_R_TOO_MANY_TEMPORARY_VARIABLES},
+  #else
+    {"TOO_MANY_TEMPORARY_VARIABLES", 3, 109},
+  #endif
+  #ifdef CMP_R_ALGORITHM_NOT_SUPPORTED
+    {"ALGORITHM_NOT_SUPPORTED", ERR_LIB_CMP, CMP_R_ALGORITHM_NOT_SUPPORTED},
+  #else
+    {"ALGORITHM_NOT_SUPPORTED", 58, 139},
+  #endif
+  #ifdef CMP_R_BAD_CHECKAFTER_IN_POLLREP
+    {"BAD_CHECKAFTER_IN_POLLREP", ERR_LIB_CMP, CMP_R_BAD_CHECKAFTER_IN_POLLREP},
+  #else
+    {"BAD_CHECKAFTER_IN_POLLREP", 58, 167},
+  #endif
+  #ifdef CMP_R_BAD_REQUEST_ID
+    {"BAD_REQUEST_ID", ERR_LIB_CMP, CMP_R_BAD_REQUEST_ID},
+  #else
+    {"BAD_REQUEST_ID", 58, 108},
+  #endif
+  #ifdef CMP_R_CERTHASH_UNMATCHED
+    {"CERTHASH_UNMATCHED", ERR_LIB_CMP, CMP_R_CERTHASH_UNMATCHED},
+  #else
+    {"CERTHASH_UNMATCHED", 58, 156},
+  #endif
+  #ifdef CMP_R_CERTID_NOT_FOUND
+    {"CERTID_NOT_FOUND", ERR_LIB_CMP, CMP_R_CERTID_NOT_FOUND},
+  #else
+    {"CERTID_NOT_FOUND", 58, 109},
+  #endif
+  #ifdef CMP_R_CERTIFICATE_NOT_ACCEPTED
+    {"CERTIFICATE_NOT_ACCEPTED", ERR_LIB_CMP, CMP_R_CERTIFICATE_NOT_ACCEPTED},
+  #else
+    {"CERTIFICATE_NOT_ACCEPTED", 58, 169},
+  #endif
+  #ifdef CMP_R_CERTIFICATE_NOT_FOUND
+    {"CERTIFICATE_NOT_FOUND", ERR_LIB_CMP, CMP_R_CERTIFICATE_NOT_FOUND},
+  #else
+    {"CERTIFICATE_NOT_FOUND", 58, 112},
+  #endif
+  #ifdef CMP_R_CERTREQMSG_NOT_FOUND
+    {"CERTREQMSG_NOT_FOUND", ERR_LIB_CMP, CMP_R_CERTREQMSG_NOT_FOUND},
+  #else
+    {"CERTREQMSG_NOT_FOUND", 58, 157},
+  #endif
+  #ifdef CMP_R_CERTRESPONSE_NOT_FOUND
+    {"CERTRESPONSE_NOT_FOUND", ERR_LIB_CMP, CMP_R_CERTRESPONSE_NOT_FOUND},
+  #else
+    {"CERTRESPONSE_NOT_FOUND", 58, 113},
+  #endif
+  #ifdef CMP_R_CERT_AND_KEY_DO_NOT_MATCH
+    {"CERT_AND_KEY_DO_NOT_MATCH", ERR_LIB_CMP, CMP_R_CERT_AND_KEY_DO_NOT_MATCH},
+  #else
+    {"CERT_AND_KEY_DO_NOT_MATCH", 58, 114},
+  #endif
+  #ifdef CMP_R_CHECKAFTER_OUT_OF_RANGE
+    {"CHECKAFTER_OUT_OF_RANGE", ERR_LIB_CMP, CMP_R_CHECKAFTER_OUT_OF_RANGE},
+  #else
+    {"CHECKAFTER_OUT_OF_RANGE", 58, 181},
+  #endif
+  #ifdef CMP_R_ENCOUNTERED_KEYUPDATEWARNING
+    {"ENCOUNTERED_KEYUPDATEWARNING", ERR_LIB_CMP, CMP_R_ENCOUNTERED_KEYUPDATEWARNING},
+  #else
+    {"ENCOUNTERED_KEYUPDATEWARNING", 58, 176},
+  #endif
+  #ifdef CMP_R_ENCOUNTERED_WAITING
+    {"ENCOUNTERED_WAITING", ERR_LIB_CMP, CMP_R_ENCOUNTERED_WAITING},
+  #else
+    {"ENCOUNTERED_WAITING", 58, 162},
+  #endif
+  #ifdef CMP_R_ERROR_CALCULATING_PROTECTION
+    {"ERROR_CALCULATING_PROTECTION", ERR_LIB_CMP, CMP_R_ERROR_CALCULATING_PROTECTION},
+  #else
+    {"ERROR_CALCULATING_PROTECTION", 58, 115},
+  #endif
+  #ifdef CMP_R_ERROR_CREATING_CERTCONF
+    {"ERROR_CREATING_CERTCONF", ERR_LIB_CMP, CMP_R_ERROR_CREATING_CERTCONF},
+  #else
+    {"ERROR_CREATING_CERTCONF", 58, 116},
+  #endif
+  #ifdef CMP_R_ERROR_CREATING_CERTREP
+    {"ERROR_CREATING_CERTREP", ERR_LIB_CMP, CMP_R_ERROR_CREATING_CERTREP},
+  #else
+    {"ERROR_CREATING_CERTREP", 58, 117},
+  #endif
+  #ifdef CMP_R_ERROR_CREATING_CERTREQ
+    {"ERROR_CREATING_CERTREQ", ERR_LIB_CMP, CMP_R_ERROR_CREATING_CERTREQ},
+  #else
+    {"ERROR_CREATING_CERTREQ", 58, 163},
+  #endif
+  #ifdef CMP_R_ERROR_CREATING_ERROR
+    {"ERROR_CREATING_ERROR", ERR_LIB_CMP, CMP_R_ERROR_CREATING_ERROR},
+  #else
+    {"ERROR_CREATING_ERROR", 58, 118},
+  #endif
+  #ifdef CMP_R_ERROR_CREATING_GENM
+    {"ERROR_CREATING_GENM", ERR_LIB_CMP, CMP_R_ERROR_CREATING_GENM},
+  #else
+    {"ERROR_CREATING_GENM", 58, 119},
+  #endif
+  #ifdef CMP_R_ERROR_CREATING_GENP
+    {"ERROR_CREATING_GENP", ERR_LIB_CMP, CMP_R_ERROR_CREATING_GENP},
+  #else
+    {"ERROR_CREATING_GENP", 58, 120},
+  #endif
+  #ifdef CMP_R_ERROR_CREATING_PKICONF
+    {"ERROR_CREATING_PKICONF", ERR_LIB_CMP, CMP_R_ERROR_CREATING_PKICONF},
+  #else
+    {"ERROR_CREATING_PKICONF", 58, 122},
+  #endif
+  #ifdef CMP_R_ERROR_CREATING_POLLREP
+    {"ERROR_CREATING_POLLREP", ERR_LIB_CMP, CMP_R_ERROR_CREATING_POLLREP},
+  #else
+    {"ERROR_CREATING_POLLREP", 58, 123},
+  #endif
+  #ifdef CMP_R_ERROR_CREATING_POLLREQ
+    {"ERROR_CREATING_POLLREQ", ERR_LIB_CMP, CMP_R_ERROR_CREATING_POLLREQ},
+  #else
+    {"ERROR_CREATING_POLLREQ", 58, 124},
+  #endif
+  #ifdef CMP_R_ERROR_CREATING_RP
+    {"ERROR_CREATING_RP", ERR_LIB_CMP, CMP_R_ERROR_CREATING_RP},
+  #else
+    {"ERROR_CREATING_RP", 58, 125},
+  #endif
+  #ifdef CMP_R_ERROR_CREATING_RR
+    {"ERROR_CREATING_RR", ERR_LIB_CMP, CMP_R_ERROR_CREATING_RR},
+  #else
+    {"ERROR_CREATING_RR", 58, 126},
+  #endif
+  #ifdef CMP_R_ERROR_PARSING_PKISTATUS
+    {"ERROR_PARSING_PKISTATUS", ERR_LIB_CMP, CMP_R_ERROR_PARSING_PKISTATUS},
+  #else
+    {"ERROR_PARSING_PKISTATUS", 58, 107},
+  #endif
+  #ifdef CMP_R_ERROR_PROCESSING_MESSAGE
+    {"ERROR_PROCESSING_MESSAGE", ERR_LIB_CMP, CMP_R_ERROR_PROCESSING_MESSAGE},
+  #else
+    {"ERROR_PROCESSING_MESSAGE", 58, 158},
+  #endif
+  #ifdef CMP_R_ERROR_PROTECTING_MESSAGE
+    {"ERROR_PROTECTING_MESSAGE", ERR_LIB_CMP, CMP_R_ERROR_PROTECTING_MESSAGE},
+  #else
+    {"ERROR_PROTECTING_MESSAGE", 58, 127},
+  #endif
+  #ifdef CMP_R_ERROR_SETTING_CERTHASH
+    {"ERROR_SETTING_CERTHASH", ERR_LIB_CMP, CMP_R_ERROR_SETTING_CERTHASH},
+  #else
+    {"ERROR_SETTING_CERTHASH", 58, 128},
+  #endif
+  #ifdef CMP_R_ERROR_UNEXPECTED_CERTCONF
+    {"ERROR_UNEXPECTED_CERTCONF", ERR_LIB_CMP, CMP_R_ERROR_UNEXPECTED_CERTCONF},
+  #else
+    {"ERROR_UNEXPECTED_CERTCONF", 58, 160},
+  #endif
+  #ifdef CMP_R_ERROR_VALIDATING_PROTECTION
+    {"ERROR_VALIDATING_PROTECTION", ERR_LIB_CMP, CMP_R_ERROR_VALIDATING_PROTECTION},
+  #else
+    {"ERROR_VALIDATING_PROTECTION", 58, 140},
+  #endif
+  #ifdef CMP_R_ERROR_VALIDATING_SIGNATURE
+    {"ERROR_VALIDATING_SIGNATURE", ERR_LIB_CMP, CMP_R_ERROR_VALIDATING_SIGNATURE},
+  #else
+    {"ERROR_VALIDATING_SIGNATURE", 58, 171},
+  #endif
+  #ifdef CMP_R_FAILED_BUILDING_OWN_CHAIN
+    {"FAILED_BUILDING_OWN_CHAIN", ERR_LIB_CMP, CMP_R_FAILED_BUILDING_OWN_CHAIN},
+  #else
+    {"FAILED_BUILDING_OWN_CHAIN", 58, 164},
+  #endif
+  #ifdef CMP_R_FAILED_EXTRACTING_PUBKEY
+    {"FAILED_EXTRACTING_PUBKEY", ERR_LIB_CMP, CMP_R_FAILED_EXTRACTING_PUBKEY},
+  #else
+    {"FAILED_EXTRACTING_PUBKEY", 58, 141},
+  #endif
+  #ifdef CMP_R_FAILURE_OBTAINING_RANDOM
+    {"FAILURE_OBTAINING_RANDOM", ERR_LIB_CMP, CMP_R_FAILURE_OBTAINING_RANDOM},
+  #else
+    {"FAILURE_OBTAINING_RANDOM", 58, 110},
+  #endif
+  #ifdef CMP_R_FAIL_INFO_OUT_OF_RANGE
+    {"FAIL_INFO_OUT_OF_RANGE", ERR_LIB_CMP, CMP_R_FAIL_INFO_OUT_OF_RANGE},
+  #else
+    {"FAIL_INFO_OUT_OF_RANGE", 58, 129},
+  #endif
+  #ifdef CMP_R_INVALID_ARGS
+    {"INVALID_ARGS", ERR_LIB_CMP, CMP_R_INVALID_ARGS},
+  #else
+    {"INVALID_ARGS", 58, 100},
+  #endif
+  #ifdef CMP_R_INVALID_OPTION
+    {"INVALID_OPTION", ERR_LIB_CMP, CMP_R_INVALID_OPTION},
+  #else
+    {"INVALID_OPTION", 58, 174},
+  #endif
+  #ifdef CMP_R_MISSING_KEY_INPUT_FOR_CREATING_PROTECTION
+    {"MISSING_KEY_INPUT_FOR_CREATING_PROTECTION", ERR_LIB_CMP, CMP_R_MISSING_KEY_INPUT_FOR_CREATING_PROTECTION},
+  #else
+    {"MISSING_KEY_INPUT_FOR_CREATING_PROTECTION", 58, 130},
+  #endif
+  #ifdef CMP_R_MISSING_KEY_USAGE_DIGITALSIGNATURE
+    {"MISSING_KEY_USAGE_DIGITALSIGNATURE", ERR_LIB_CMP, CMP_R_MISSING_KEY_USAGE_DIGITALSIGNATURE},
+  #else
+    {"MISSING_KEY_USAGE_DIGITALSIGNATURE", 58, 142},
+  #endif
+  #ifdef CMP_R_MISSING_P10CSR
+    {"MISSING_P10CSR", ERR_LIB_CMP, CMP_R_MISSING_P10CSR},
+  #else
+    {"MISSING_P10CSR", 58, 121},
+  #endif
+  #ifdef CMP_R_MISSING_PBM_SECRET
+    {"MISSING_PBM_SECRET", ERR_LIB_CMP, CMP_R_MISSING_PBM_SECRET},
+  #else
+    {"MISSING_PBM_SECRET", 58, 166},
+  #endif
+  #ifdef CMP_R_MISSING_PRIVATE_KEY
+    {"MISSING_PRIVATE_KEY", ERR_LIB_CMP, CMP_R_MISSING_PRIVATE_KEY},
+  #else
+    {"MISSING_PRIVATE_KEY", 58, 131},
+  #endif
+  #ifdef CMP_R_MISSING_PROTECTION
+    {"MISSING_PROTECTION", ERR_LIB_CMP, CMP_R_MISSING_PROTECTION},
+  #else
+    {"MISSING_PROTECTION", 58, 143},
+  #endif
+  #ifdef CMP_R_MISSING_REFERENCE_CERT
+    {"MISSING_REFERENCE_CERT", ERR_LIB_CMP, CMP_R_MISSING_REFERENCE_CERT},
+  #else
+    {"MISSING_REFERENCE_CERT", 58, 168},
+  #endif
+  #ifdef CMP_R_MISSING_SENDER_IDENTIFICATION
+    {"MISSING_SENDER_IDENTIFICATION", ERR_LIB_CMP, CMP_R_MISSING_SENDER_IDENTIFICATION},
+  #else
+    {"MISSING_SENDER_IDENTIFICATION", 58, 111},
+  #endif
+  #ifdef CMP_R_MISSING_TRUST_STORE
+    {"MISSING_TRUST_STORE", ERR_LIB_CMP, CMP_R_MISSING_TRUST_STORE},
+  #else
+    {"MISSING_TRUST_STORE", 58, 144},
+  #endif
+  #ifdef CMP_R_MULTIPLE_REQUESTS_NOT_SUPPORTED
+    {"MULTIPLE_REQUESTS_NOT_SUPPORTED", ERR_LIB_CMP, CMP_R_MULTIPLE_REQUESTS_NOT_SUPPORTED},
+  #else
+    {"MULTIPLE_REQUESTS_NOT_SUPPORTED", 58, 161},
+  #endif
+  #ifdef CMP_R_MULTIPLE_RESPONSES_NOT_SUPPORTED
+    {"MULTIPLE_RESPONSES_NOT_SUPPORTED", ERR_LIB_CMP, CMP_R_MULTIPLE_RESPONSES_NOT_SUPPORTED},
+  #else
+    {"MULTIPLE_RESPONSES_NOT_SUPPORTED", 58, 170},
+  #endif
+  #ifdef CMP_R_MULTIPLE_SAN_SOURCES
+    {"MULTIPLE_SAN_SOURCES", ERR_LIB_CMP, CMP_R_MULTIPLE_SAN_SOURCES},
+  #else
+    {"MULTIPLE_SAN_SOURCES", 58, 102},
+  #endif
+  #ifdef CMP_R_NO_STDIO
+    {"NO_STDIO", ERR_LIB_CMP, CMP_R_NO_STDIO},
+  #else
+    {"NO_STDIO", 58, 194},
+  #endif
+  #ifdef CMP_R_NO_SUITABLE_SENDER_CERT
+    {"NO_SUITABLE_SENDER_CERT", ERR_LIB_CMP, CMP_R_NO_SUITABLE_SENDER_CERT},
+  #else
+    {"NO_SUITABLE_SENDER_CERT", 58, 145},
+  #endif
+  #ifdef CMP_R_NULL_ARGUMENT
+    {"NULL_ARGUMENT", ERR_LIB_CMP, CMP_R_NULL_ARGUMENT},
+  #else
+    {"NULL_ARGUMENT", 58, 103},
+  #endif
+  #ifdef CMP_R_PKIBODY_ERROR
+    {"PKIBODY_ERROR", ERR_LIB_CMP, CMP_R_PKIBODY_ERROR},
+  #else
+    {"PKIBODY_ERROR", 58, 146},
+  #endif
+  #ifdef CMP_R_PKISTATUSINFO_NOT_FOUND
+    {"PKISTATUSINFO_NOT_FOUND", ERR_LIB_CMP, CMP_R_PKISTATUSINFO_NOT_FOUND},
+  #else
+    {"PKISTATUSINFO_NOT_FOUND", 58, 132},
+  #endif
+  #ifdef CMP_R_POLLING_FAILED
+    {"POLLING_FAILED", ERR_LIB_CMP, CMP_R_POLLING_FAILED},
+  #else
+    {"POLLING_FAILED", 58, 172},
+  #endif
+  #ifdef CMP_R_POTENTIALLY_INVALID_CERTIFICATE
+    {"POTENTIALLY_INVALID_CERTIFICATE", ERR_LIB_CMP, CMP_R_POTENTIALLY_INVALID_CERTIFICATE},
+  #else
+    {"POTENTIALLY_INVALID_CERTIFICATE", 58, 147},
+  #endif
+  #ifdef CMP_R_RECEIVED_ERROR
+    {"RECEIVED_ERROR", ERR_LIB_CMP, CMP_R_RECEIVED_ERROR},
+  #else
+    {"RECEIVED_ERROR", 58, 180},
+  #endif
+  #ifdef CMP_R_RECIPNONCE_UNMATCHED
+    {"RECIPNONCE_UNMATCHED", ERR_LIB_CMP, CMP_R_RECIPNONCE_UNMATCHED},
+  #else
+    {"RECIPNONCE_UNMATCHED", 58, 148},
+  #endif
+  #ifdef CMP_R_REQUEST_NOT_ACCEPTED
+    {"REQUEST_NOT_ACCEPTED", ERR_LIB_CMP, CMP_R_REQUEST_NOT_ACCEPTED},
+  #else
+    {"REQUEST_NOT_ACCEPTED", 58, 149},
+  #endif
+  #ifdef CMP_R_REQUEST_REJECTED_BY_SERVER
+    {"REQUEST_REJECTED_BY_SERVER", ERR_LIB_CMP, CMP_R_REQUEST_REJECTED_BY_SERVER},
+  #else
+    {"REQUEST_REJECTED_BY_SERVER", 58, 182},
+  #endif
+  #ifdef CMP_R_SENDER_GENERALNAME_TYPE_NOT_SUPPORTED
+    {"SENDER_GENERALNAME_TYPE_NOT_SUPPORTED", ERR_LIB_CMP, CMP_R_SENDER_GENERALNAME_TYPE_NOT_SUPPORTED},
+  #else
+    {"SENDER_GENERALNAME_TYPE_NOT_SUPPORTED", 58, 150},
+  #endif
+  #ifdef CMP_R_SRVCERT_DOES_NOT_VALIDATE_MSG
+    {"SRVCERT_DOES_NOT_VALIDATE_MSG", ERR_LIB_CMP, CMP_R_SRVCERT_DOES_NOT_VALIDATE_MSG},
+  #else
+    {"SRVCERT_DOES_NOT_VALIDATE_MSG", 58, 151},
+  #endif
+  #ifdef CMP_R_TOTAL_TIMEOUT
+    {"TOTAL_TIMEOUT", ERR_LIB_CMP, CMP_R_TOTAL_TIMEOUT},
+  #else
+    {"TOTAL_TIMEOUT", 58, 184},
+  #endif
+  #ifdef CMP_R_TRANSACTIONID_UNMATCHED
+    {"TRANSACTIONID_UNMATCHED", ERR_LIB_CMP, CMP_R_TRANSACTIONID_UNMATCHED},
+  #else
+    {"TRANSACTIONID_UNMATCHED", 58, 152},
+  #endif
+  #ifdef CMP_R_TRANSFER_ERROR
+    {"TRANSFER_ERROR", ERR_LIB_CMP, CMP_R_TRANSFER_ERROR},
+  #else
+    {"TRANSFER_ERROR", 58, 159},
+  #endif
+  #ifdef CMP_R_UNEXPECTED_PKIBODY
+    {"UNEXPECTED_PKIBODY", ERR_LIB_CMP, CMP_R_UNEXPECTED_PKIBODY},
+  #else
+    {"UNEXPECTED_PKIBODY", 58, 133},
+  #endif
+  #ifdef CMP_R_UNEXPECTED_PKISTATUS
+    {"UNEXPECTED_PKISTATUS", ERR_LIB_CMP, CMP_R_UNEXPECTED_PKISTATUS},
+  #else
+    {"UNEXPECTED_PKISTATUS", 58, 185},
+  #endif
+  #ifdef CMP_R_UNEXPECTED_PVNO
+    {"UNEXPECTED_PVNO", ERR_LIB_CMP, CMP_R_UNEXPECTED_PVNO},
+  #else
+    {"UNEXPECTED_PVNO", 58, 153},
+  #endif
+  #ifdef CMP_R_UNKNOWN_ALGORITHM_ID
+    {"UNKNOWN_ALGORITHM_ID", ERR_LIB_CMP, CMP_R_UNKNOWN_ALGORITHM_ID},
+  #else
+    {"UNKNOWN_ALGORITHM_ID", 58, 134},
+  #endif
+  #ifdef CMP_R_UNKNOWN_CERT_TYPE
+    {"UNKNOWN_CERT_TYPE", ERR_LIB_CMP, CMP_R_UNKNOWN_CERT_TYPE},
+  #else
+    {"UNKNOWN_CERT_TYPE", 58, 135},
+  #endif
+  #ifdef CMP_R_UNKNOWN_PKISTATUS
+    {"UNKNOWN_PKISTATUS", ERR_LIB_CMP, CMP_R_UNKNOWN_PKISTATUS},
+  #else
+    {"UNKNOWN_PKISTATUS", 58, 186},
+  #endif
+  #ifdef CMP_R_UNSUPPORTED_ALGORITHM
+    {"UNSUPPORTED_ALGORITHM", ERR_LIB_CMP, CMP_R_UNSUPPORTED_ALGORITHM},
+  #else
+    {"UNSUPPORTED_ALGORITHM", 58, 136},
+  #endif
+  #ifdef CMP_R_UNSUPPORTED_KEY_TYPE
+    {"UNSUPPORTED_KEY_TYPE", ERR_LIB_CMP, CMP_R_UNSUPPORTED_KEY_TYPE},
+  #else
+    {"UNSUPPORTED_KEY_TYPE", 58, 137},
+  #endif
+  #ifdef CMP_R_UNSUPPORTED_PROTECTION_ALG_DHBASEDMAC
+    {"UNSUPPORTED_PROTECTION_ALG_DHBASEDMAC", ERR_LIB_CMP, CMP_R_UNSUPPORTED_PROTECTION_ALG_DHBASEDMAC},
+  #else
+    {"UNSUPPORTED_PROTECTION_ALG_DHBASEDMAC", 58, 154},
+  #endif
+  #ifdef CMP_R_VALUE_TOO_LARGE
+    {"VALUE_TOO_LARGE", ERR_LIB_CMP, CMP_R_VALUE_TOO_LARGE},
+  #else
+    {"VALUE_TOO_LARGE", 58, 175},
+  #endif
+  #ifdef CMP_R_VALUE_TOO_SMALL
+    {"VALUE_TOO_SMALL", ERR_LIB_CMP, CMP_R_VALUE_TOO_SMALL},
+  #else
+    {"VALUE_TOO_SMALL", 58, 177},
+  #endif
+  #ifdef CMP_R_WRONG_ALGORITHM_OID
+    {"WRONG_ALGORITHM_OID", ERR_LIB_CMP, CMP_R_WRONG_ALGORITHM_OID},
+  #else
+    {"WRONG_ALGORITHM_OID", 58, 138},
+  #endif
+  #ifdef CMP_R_WRONG_CERTID_IN_RP
+    {"WRONG_CERTID_IN_RP", ERR_LIB_CMP, CMP_R_WRONG_CERTID_IN_RP},
+  #else
+    {"WRONG_CERTID_IN_RP", 58, 187},
+  #endif
+  #ifdef CMP_R_WRONG_PBM_VALUE
+    {"WRONG_PBM_VALUE", ERR_LIB_CMP, CMP_R_WRONG_PBM_VALUE},
+  #else
+    {"WRONG_PBM_VALUE", 58, 155},
+  #endif
+  #ifdef CMP_R_WRONG_RP_COMPONENT_COUNT
+    {"WRONG_RP_COMPONENT_COUNT", ERR_LIB_CMP, CMP_R_WRONG_RP_COMPONENT_COUNT},
+  #else
+    {"WRONG_RP_COMPONENT_COUNT", 58, 188},
+  #endif
+  #ifdef CMP_R_WRONG_SERIAL_IN_RP
+    {"WRONG_SERIAL_IN_RP", ERR_LIB_CMP, CMP_R_WRONG_SERIAL_IN_RP},
+  #else
+    {"WRONG_SERIAL_IN_RP", 58, 173},
+  #endif
+  #ifdef CMS_R_ADD_SIGNER_ERROR
+    {"ADD_SIGNER_ERROR", ERR_LIB_CMS, CMS_R_ADD_SIGNER_ERROR},
+  #else
+    {"ADD_SIGNER_ERROR", 46, 99},
+  #endif
+  #ifdef CMS_R_ATTRIBUTE_ERROR
+    {"ATTRIBUTE_ERROR", ERR_LIB_CMS, CMS_R_ATTRIBUTE_ERROR},
+  #else
+    {"ATTRIBUTE_ERROR", 46, 161},
+  #endif
+  #ifdef CMS_R_CERTIFICATE_ALREADY_PRESENT
+    {"CERTIFICATE_ALREADY_PRESENT", ERR_LIB_CMS, CMS_R_CERTIFICATE_ALREADY_PRESENT},
+  #else
+    {"CERTIFICATE_ALREADY_PRESENT", 46, 175},
+  #endif
+  #ifdef CMS_R_CERTIFICATE_HAS_NO_KEYID
+    {"CERTIFICATE_HAS_NO_KEYID", ERR_LIB_CMS, CMS_R_CERTIFICATE_HAS_NO_KEYID},
+  #else
+    {"CERTIFICATE_HAS_NO_KEYID", 46, 160},
+  #endif
+  #ifdef CMS_R_CERTIFICATE_VERIFY_ERROR
+    {"CERTIFICATE_VERIFY_ERROR", ERR_LIB_CMS, CMS_R_CERTIFICATE_VERIFY_ERROR},
+  #else
+    {"CERTIFICATE_VERIFY_ERROR", 46, 100},
+  #endif
+  #ifdef CMS_R_CIPHER_AEAD_SET_TAG_ERROR
+    {"CIPHER_AEAD_SET_TAG_ERROR", ERR_LIB_CMS, CMS_R_CIPHER_AEAD_SET_TAG_ERROR},
+  #else
+    {"CIPHER_AEAD_SET_TAG_ERROR", 46, 184},
+  #endif
+  #ifdef CMS_R_CIPHER_GET_TAG
+    {"CIPHER_GET_TAG", ERR_LIB_CMS, CMS_R_CIPHER_GET_TAG},
+  #else
+    {"CIPHER_GET_TAG", 46, 185},
+  #endif
+  #ifdef CMS_R_CIPHER_INITIALISATION_ERROR
+    {"CIPHER_INITIALISATION_ERROR", ERR_LIB_CMS, CMS_R_CIPHER_INITIALISATION_ERROR},
+  #else
+    {"CIPHER_INITIALISATION_ERROR", 46, 101},
+  #endif
+  #ifdef CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR
+    {"CIPHER_PARAMETER_INITIALISATION_ERROR", ERR_LIB_CMS, CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR},
+  #else
+    {"CIPHER_PARAMETER_INITIALISATION_ERROR", 46, 102},
+  #endif
+  #ifdef CMS_R_CMS_DATAFINAL_ERROR
+    {"CMS_DATAFINAL_ERROR", ERR_LIB_CMS, CMS_R_CMS_DATAFINAL_ERROR},
+  #else
+    {"CMS_DATAFINAL_ERROR", 46, 103},
+  #endif
+  #ifdef CMS_R_CMS_LIB
+    {"CMS_LIB", ERR_LIB_CMS, CMS_R_CMS_LIB},
+  #else
+    {"CMS_LIB", 46, 104},
+  #endif
+  #ifdef CMS_R_CONTENTIDENTIFIER_MISMATCH
+    {"CONTENTIDENTIFIER_MISMATCH", ERR_LIB_CMS, CMS_R_CONTENTIDENTIFIER_MISMATCH},
+  #else
+    {"CONTENTIDENTIFIER_MISMATCH", 46, 170},
+  #endif
+  #ifdef CMS_R_CONTENT_NOT_FOUND
+    {"CONTENT_NOT_FOUND", ERR_LIB_CMS, CMS_R_CONTENT_NOT_FOUND},
+  #else
+    {"CONTENT_NOT_FOUND", 46, 105},
+  #endif
+  #ifdef CMS_R_CONTENT_TYPE_MISMATCH
+    {"CONTENT_TYPE_MISMATCH", ERR_LIB_CMS, CMS_R_CONTENT_TYPE_MISMATCH},
+  #else
+    {"CONTENT_TYPE_MISMATCH", 46, 171},
+  #endif
+  #ifdef CMS_R_CONTENT_TYPE_NOT_COMPRESSED_DATA
+    {"CONTENT_TYPE_NOT_COMPRESSED_DATA", ERR_LIB_CMS, CMS_R_CONTENT_TYPE_NOT_COMPRESSED_DATA},
+  #else
+    {"CONTENT_TYPE_NOT_COMPRESSED_DATA", 46, 106},
+  #endif
+  #ifdef CMS_R_CONTENT_TYPE_NOT_ENVELOPED_DATA
+    {"CONTENT_TYPE_NOT_ENVELOPED_DATA", ERR_LIB_CMS, CMS_R_CONTENT_TYPE_NOT_ENVELOPED_DATA},
+  #else
+    {"CONTENT_TYPE_NOT_ENVELOPED_DATA", 46, 107},
+  #endif
+  #ifdef CMS_R_CONTENT_TYPE_NOT_SIGNED_DATA
+    {"CONTENT_TYPE_NOT_SIGNED_DATA", ERR_LIB_CMS, CMS_R_CONTENT_TYPE_NOT_SIGNED_DATA},
+  #else
+    {"CONTENT_TYPE_NOT_SIGNED_DATA", 46, 108},
+  #endif
+  #ifdef CMS_R_CONTENT_VERIFY_ERROR
+    {"CONTENT_VERIFY_ERROR", ERR_LIB_CMS, CMS_R_CONTENT_VERIFY_ERROR},
+  #else
+    {"CONTENT_VERIFY_ERROR", 46, 109},
+  #endif
+  #ifdef CMS_R_CTRL_ERROR
+    {"CTRL_ERROR", ERR_LIB_CMS, CMS_R_CTRL_ERROR},
+  #else
+    {"CTRL_ERROR", 46, 110},
+  #endif
+  #ifdef CMS_R_CTRL_FAILURE
+    {"CTRL_FAILURE", ERR_LIB_CMS, CMS_R_CTRL_FAILURE},
+  #else
+    {"CTRL_FAILURE", 46, 111},
+  #endif
+  #ifdef CMS_R_DECODE_ERROR
+    {"DECODE_ERROR", ERR_LIB_CMS, CMS_R_DECODE_ERROR},
+  #else
+    {"DECODE_ERROR", 46, 187},
+  #endif
+  #ifdef CMS_R_DECRYPT_ERROR
+    {"DECRYPT_ERROR", ERR_LIB_CMS, CMS_R_DECRYPT_ERROR},
+  #else
+    {"DECRYPT_ERROR", 46, 112},
+  #endif
+  #ifdef CMS_R_ERROR_GETTING_PUBLIC_KEY
+    {"ERROR_GETTING_PUBLIC_KEY", ERR_LIB_CMS, CMS_R_ERROR_GETTING_PUBLIC_KEY},
+  #else
+    {"ERROR_GETTING_PUBLIC_KEY", 46, 113},
+  #endif
+  #ifdef CMS_R_ERROR_READING_MESSAGEDIGEST_ATTRIBUTE
+    {"ERROR_READING_MESSAGEDIGEST_ATTRIBUTE", ERR_LIB_CMS, CMS_R_ERROR_READING_MESSAGEDIGEST_ATTRIBUTE},
+  #else
+    {"ERROR_READING_MESSAGEDIGEST_ATTRIBUTE", 46, 114},
+  #endif
+  #ifdef CMS_R_ERROR_SETTING_KEY
+    {"ERROR_SETTING_KEY", ERR_LIB_CMS, CMS_R_ERROR_SETTING_KEY},
+  #else
+    {"ERROR_SETTING_KEY", 46, 115},
+  #endif
+  #ifdef CMS_R_ERROR_SETTING_RECIPIENTINFO
+    {"ERROR_SETTING_RECIPIENTINFO", ERR_LIB_CMS, CMS_R_ERROR_SETTING_RECIPIENTINFO},
+  #else
+    {"ERROR_SETTING_RECIPIENTINFO", 46, 116},
+  #endif
+  #ifdef CMS_R_ESS_SIGNING_CERTID_MISMATCH_ERROR
+    {"ESS_SIGNING_CERTID_MISMATCH_ERROR", ERR_LIB_CMS, CMS_R_ESS_SIGNING_CERTID_MISMATCH_ERROR},
+  #else
+    {"ESS_SIGNING_CERTID_MISMATCH_ERROR", 46, 183},
+  #endif
+  #ifdef CMS_R_INVALID_ENCRYPTED_KEY_LENGTH
+    {"INVALID_ENCRYPTED_KEY_LENGTH", ERR_LIB_CMS, CMS_R_INVALID_ENCRYPTED_KEY_LENGTH},
+  #else
+    {"INVALID_ENCRYPTED_KEY_LENGTH", 46, 117},
+  #endif
+  #ifdef CMS_R_INVALID_KEY_ENCRYPTION_PARAMETER
+    {"INVALID_KEY_ENCRYPTION_PARAMETER", ERR_LIB_CMS, CMS_R_INVALID_KEY_ENCRYPTION_PARAMETER},
+  #else
+    {"INVALID_KEY_ENCRYPTION_PARAMETER", 46, 176},
+  #endif
+  #ifdef CMS_R_INVALID_KEY_LENGTH
+    {"INVALID_KEY_LENGTH", ERR_LIB_CMS, CMS_R_INVALID_KEY_LENGTH},
+  #else
+    {"INVALID_KEY_LENGTH", 46, 118},
+  #endif
+  #ifdef CMS_R_INVALID_LABEL
+    {"INVALID_LABEL", ERR_LIB_CMS, CMS_R_INVALID_LABEL},
+  #else
+    {"INVALID_LABEL", 46, 190},
+  #endif
+  #ifdef CMS_R_INVALID_OAEP_PARAMETERS
+    {"INVALID_OAEP_PARAMETERS", ERR_LIB_CMS, CMS_R_INVALID_OAEP_PARAMETERS},
+  #else
+    {"INVALID_OAEP_PARAMETERS", 46, 191},
+  #endif
+  #ifdef CMS_R_KDF_PARAMETER_ERROR
+    {"KDF_PARAMETER_ERROR", ERR_LIB_CMS, CMS_R_KDF_PARAMETER_ERROR},
+  #else
+    {"KDF_PARAMETER_ERROR", 46, 186},
+  #endif
+  #ifdef CMS_R_MD_BIO_INIT_ERROR
+    {"MD_BIO_INIT_ERROR", ERR_LIB_CMS, CMS_R_MD_BIO_INIT_ERROR},
+  #else
+    {"MD_BIO_INIT_ERROR", 46, 119},
+  #endif
+  #ifdef CMS_R_MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH
+    {"MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH", ERR_LIB_CMS, CMS_R_MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH},
+  #else
+    {"MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH", 46, 120},
+  #endif
+  #ifdef CMS_R_MESSAGEDIGEST_WRONG_LENGTH
+    {"MESSAGEDIGEST_WRONG_LENGTH", ERR_LIB_CMS, CMS_R_MESSAGEDIGEST_WRONG_LENGTH},
+  #else
+    {"MESSAGEDIGEST_WRONG_LENGTH", 46, 121},
+  #endif
+  #ifdef CMS_R_MSGSIGDIGEST_ERROR
+    {"MSGSIGDIGEST_ERROR", ERR_LIB_CMS, CMS_R_MSGSIGDIGEST_ERROR},
+  #else
+    {"MSGSIGDIGEST_ERROR", 46, 172},
+  #endif
+  #ifdef CMS_R_MSGSIGDIGEST_VERIFICATION_FAILURE
+    {"MSGSIGDIGEST_VERIFICATION_FAILURE", ERR_LIB_CMS, CMS_R_MSGSIGDIGEST_VERIFICATION_FAILURE},
+  #else
+    {"MSGSIGDIGEST_VERIFICATION_FAILURE", 46, 162},
+  #endif
+  #ifdef CMS_R_MSGSIGDIGEST_WRONG_LENGTH
+    {"MSGSIGDIGEST_WRONG_LENGTH", ERR_LIB_CMS, CMS_R_MSGSIGDIGEST_WRONG_LENGTH},
+  #else
+    {"MSGSIGDIGEST_WRONG_LENGTH", 46, 163},
+  #endif
+  #ifdef CMS_R_NEED_ONE_SIGNER
+    {"NEED_ONE_SIGNER", ERR_LIB_CMS, CMS_R_NEED_ONE_SIGNER},
+  #else
+    {"NEED_ONE_SIGNER", 46, 164},
+  #endif
+  #ifdef CMS_R_NOT_A_SIGNED_RECEIPT
+    {"NOT_A_SIGNED_RECEIPT", ERR_LIB_CMS, CMS_R_NOT_A_SIGNED_RECEIPT},
+  #else
+    {"NOT_A_SIGNED_RECEIPT", 46, 165},
+  #endif
+  #ifdef CMS_R_NOT_ENCRYPTED_DATA
+    {"NOT_ENCRYPTED_DATA", ERR_LIB_CMS, CMS_R_NOT_ENCRYPTED_DATA},
+  #else
+    {"NOT_ENCRYPTED_DATA", 46, 122},
+  #endif
+  #ifdef CMS_R_NOT_KEK
+    {"NOT_KEK", ERR_LIB_CMS, CMS_R_NOT_KEK},
+  #else
+    {"NOT_KEK", 46, 123},
+  #endif
+  #ifdef CMS_R_NOT_KEY_AGREEMENT
+    {"NOT_KEY_AGREEMENT", ERR_LIB_CMS, CMS_R_NOT_KEY_AGREEMENT},
+  #else
+    {"NOT_KEY_AGREEMENT", 46, 181},
+  #endif
+  #ifdef CMS_R_NOT_KEY_TRANSPORT
+    {"NOT_KEY_TRANSPORT", ERR_LIB_CMS, CMS_R_NOT_KEY_TRANSPORT},
+  #else
+    {"NOT_KEY_TRANSPORT", 46, 124},
+  #endif
+  #ifdef CMS_R_NOT_PWRI
+    {"NOT_PWRI", ERR_LIB_CMS, CMS_R_NOT_PWRI},
+  #else
+    {"NOT_PWRI", 46, 177},
+  #endif
+  #ifdef CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE
+    {"NOT_SUPPORTED_FOR_THIS_KEY_TYPE", ERR_LIB_CMS, CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE},
+  #else
+    {"NOT_SUPPORTED_FOR_THIS_KEY_TYPE", 46, 125},
+  #endif
+  #ifdef CMS_R_NO_CIPHER
+    {"NO_CIPHER", ERR_LIB_CMS, CMS_R_NO_CIPHER},
+  #else
+    {"NO_CIPHER", 46, 126},
+  #endif
+  #ifdef CMS_R_NO_CONTENT
+    {"NO_CONTENT", ERR_LIB_CMS, CMS_R_NO_CONTENT},
+  #else
+    {"NO_CONTENT", 46, 127},
+  #endif
+  #ifdef CMS_R_NO_CONTENT_TYPE
+    {"NO_CONTENT_TYPE", ERR_LIB_CMS, CMS_R_NO_CONTENT_TYPE},
+  #else
+    {"NO_CONTENT_TYPE", 46, 173},
+  #endif
+  #ifdef CMS_R_NO_DEFAULT_DIGEST
+    {"NO_DEFAULT_DIGEST", ERR_LIB_CMS, CMS_R_NO_DEFAULT_DIGEST},
+  #else
+    {"NO_DEFAULT_DIGEST", 46, 128},
+  #endif
+  #ifdef CMS_R_NO_DIGEST_SET
+    {"NO_DIGEST_SET", ERR_LIB_CMS, CMS_R_NO_DIGEST_SET},
+  #else
+    {"NO_DIGEST_SET", 46, 129},
+  #endif
+  #ifdef CMS_R_NO_KEY
+    {"NO_KEY", ERR_LIB_CMS, CMS_R_NO_KEY},
+  #else
+    {"NO_KEY", 46, 130},
+  #endif
+  #ifdef CMS_R_NO_KEY_OR_CERT
+    {"NO_KEY_OR_CERT", ERR_LIB_CMS, CMS_R_NO_KEY_OR_CERT},
+  #else
+    {"NO_KEY_OR_CERT", 46, 174},
+  #endif
+  #ifdef CMS_R_NO_MATCHING_DIGEST
+    {"NO_MATCHING_DIGEST", ERR_LIB_CMS, CMS_R_NO_MATCHING_DIGEST},
+  #else
+    {"NO_MATCHING_DIGEST", 46, 131},
+  #endif
+  #ifdef CMS_R_NO_MATCHING_RECIPIENT
+    {"NO_MATCHING_RECIPIENT", ERR_LIB_CMS, CMS_R_NO_MATCHING_RECIPIENT},
+  #else
+    {"NO_MATCHING_RECIPIENT", 46, 132},
+  #endif
+  #ifdef CMS_R_NO_MATCHING_SIGNATURE
+    {"NO_MATCHING_SIGNATURE", ERR_LIB_CMS, CMS_R_NO_MATCHING_SIGNATURE},
+  #else
+    {"NO_MATCHING_SIGNATURE", 46, 166},
+  #endif
+  #ifdef CMS_R_NO_MSGSIGDIGEST
+    {"NO_MSGSIGDIGEST", ERR_LIB_CMS, CMS_R_NO_MSGSIGDIGEST},
+  #else
+    {"NO_MSGSIGDIGEST", 46, 167},
+  #endif
+  #ifdef CMS_R_NO_PASSWORD
+    {"NO_PASSWORD", ERR_LIB_CMS, CMS_R_NO_PASSWORD},
+  #else
+    {"NO_PASSWORD", 46, 178},
+  #endif
+  #ifdef CMS_R_NO_PRIVATE_KEY
+    {"NO_PRIVATE_KEY", ERR_LIB_CMS, CMS_R_NO_PRIVATE_KEY},
+  #else
+    {"NO_PRIVATE_KEY", 46, 133},
+  #endif
+  #ifdef CMS_R_NO_PUBLIC_KEY
+    {"NO_PUBLIC_KEY", ERR_LIB_CMS, CMS_R_NO_PUBLIC_KEY},
+  #else
+    {"NO_PUBLIC_KEY", 46, 134},
+  #endif
+  #ifdef CMS_R_NO_RECEIPT_REQUEST
+    {"NO_RECEIPT_REQUEST", ERR_LIB_CMS, CMS_R_NO_RECEIPT_REQUEST},
+  #else
+    {"NO_RECEIPT_REQUEST", 46, 168},
+  #endif
+  #ifdef CMS_R_NO_SIGNERS
+    {"NO_SIGNERS", ERR_LIB_CMS, CMS_R_NO_SIGNERS},
+  #else
+    {"NO_SIGNERS", 46, 135},
+  #endif
+  #ifdef CMS_R_PEER_KEY_ERROR
+    {"PEER_KEY_ERROR", ERR_LIB_CMS, CMS_R_PEER_KEY_ERROR},
+  #else
+    {"PEER_KEY_ERROR", 46, 188},
+  #endif
+  #ifdef CMS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE
+    {"PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE", ERR_LIB_CMS, CMS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE},
+  #else
+    {"PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE", 46, 136},
+  #endif
+  #ifdef CMS_R_RECEIPT_DECODE_ERROR
+    {"RECEIPT_DECODE_ERROR", ERR_LIB_CMS, CMS_R_RECEIPT_DECODE_ERROR},
+  #else
+    {"RECEIPT_DECODE_ERROR", 46, 169},
+  #endif
+  #ifdef CMS_R_RECIPIENT_ERROR
+    {"RECIPIENT_ERROR", ERR_LIB_CMS, CMS_R_RECIPIENT_ERROR},
+  #else
+    {"RECIPIENT_ERROR", 46, 137},
+  #endif
+  #ifdef CMS_R_SHARED_INFO_ERROR
+    {"SHARED_INFO_ERROR", ERR_LIB_CMS, CMS_R_SHARED_INFO_ERROR},
+  #else
+    {"SHARED_INFO_ERROR", 46, 189},
+  #endif
+  #ifdef CMS_R_SIGNER_CERTIFICATE_NOT_FOUND
+    {"SIGNER_CERTIFICATE_NOT_FOUND", ERR_LIB_CMS, CMS_R_SIGNER_CERTIFICATE_NOT_FOUND},
+  #else
+    {"SIGNER_CERTIFICATE_NOT_FOUND", 46, 138},
+  #endif
+  #ifdef CMS_R_SIGNFINAL_ERROR
+    {"SIGNFINAL_ERROR", ERR_LIB_CMS, CMS_R_SIGNFINAL_ERROR},
+  #else
+    {"SIGNFINAL_ERROR", 46, 139},
+  #endif
+  #ifdef CMS_R_SMIME_TEXT_ERROR
+    {"SMIME_TEXT_ERROR", ERR_LIB_CMS, CMS_R_SMIME_TEXT_ERROR},
+  #else
+    {"SMIME_TEXT_ERROR", 46, 140},
+  #endif
+  #ifdef CMS_R_STORE_INIT_ERROR
+    {"STORE_INIT_ERROR", ERR_LIB_CMS, CMS_R_STORE_INIT_ERROR},
+  #else
+    {"STORE_INIT_ERROR", 46, 141},
+  #endif
+  #ifdef CMS_R_TYPE_NOT_COMPRESSED_DATA
+    {"TYPE_NOT_COMPRESSED_DATA", ERR_LIB_CMS, CMS_R_TYPE_NOT_COMPRESSED_DATA},
+  #else
+    {"TYPE_NOT_COMPRESSED_DATA", 46, 142},
+  #endif
+  #ifdef CMS_R_TYPE_NOT_DATA
+    {"TYPE_NOT_DATA", ERR_LIB_CMS, CMS_R_TYPE_NOT_DATA},
+  #else
+    {"TYPE_NOT_DATA", 46, 143},
+  #endif
+  #ifdef CMS_R_TYPE_NOT_DIGESTED_DATA
+    {"TYPE_NOT_DIGESTED_DATA", ERR_LIB_CMS, CMS_R_TYPE_NOT_DIGESTED_DATA},
+  #else
+    {"TYPE_NOT_DIGESTED_DATA", 46, 144},
+  #endif
+  #ifdef CMS_R_TYPE_NOT_ENCRYPTED_DATA
+    {"TYPE_NOT_ENCRYPTED_DATA", ERR_LIB_CMS, CMS_R_TYPE_NOT_ENCRYPTED_DATA},
+  #else
+    {"TYPE_NOT_ENCRYPTED_DATA", 46, 145},
+  #endif
+  #ifdef CMS_R_TYPE_NOT_ENVELOPED_DATA
+    {"TYPE_NOT_ENVELOPED_DATA", ERR_LIB_CMS, CMS_R_TYPE_NOT_ENVELOPED_DATA},
+  #else
+    {"TYPE_NOT_ENVELOPED_DATA", 46, 146},
+  #endif
+  #ifdef CMS_R_UNABLE_TO_FINALIZE_CONTEXT
+    {"UNABLE_TO_FINALIZE_CONTEXT", ERR_LIB_CMS, CMS_R_UNABLE_TO_FINALIZE_CONTEXT},
+  #else
+    {"UNABLE_TO_FINALIZE_CONTEXT", 46, 147},
+  #endif
+  #ifdef CMS_R_UNKNOWN_CIPHER
+    {"UNKNOWN_CIPHER", ERR_LIB_CMS, CMS_R_UNKNOWN_CIPHER},
+  #else
+    {"UNKNOWN_CIPHER", 46, 148},
+  #endif
+  #ifdef CMS_R_UNKNOWN_DIGEST_ALGORITHM
+    {"UNKNOWN_DIGEST_ALGORITHM", ERR_LIB_CMS, CMS_R_UNKNOWN_DIGEST_ALGORITHM},
+  #else
+    {"UNKNOWN_DIGEST_ALGORITHM", 46, 149},
+  #endif
+  #ifdef CMS_R_UNKNOWN_ID
+    {"UNKNOWN_ID", ERR_LIB_CMS, CMS_R_UNKNOWN_ID},
+  #else
+    {"UNKNOWN_ID", 46, 150},
+  #endif
+  #ifdef CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM
+    {"UNSUPPORTED_COMPRESSION_ALGORITHM", ERR_LIB_CMS, CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM},
+  #else
+    {"UNSUPPORTED_COMPRESSION_ALGORITHM", 46, 151},
+  #endif
+  #ifdef CMS_R_UNSUPPORTED_CONTENT_TYPE
+    {"UNSUPPORTED_CONTENT_TYPE", ERR_LIB_CMS, CMS_R_UNSUPPORTED_CONTENT_TYPE},
+  #else
+    {"UNSUPPORTED_CONTENT_TYPE", 46, 152},
+  #endif
+  #ifdef CMS_R_UNSUPPORTED_ENCRYPTION_TYPE
+    {"UNSUPPORTED_ENCRYPTION_TYPE", ERR_LIB_CMS, CMS_R_UNSUPPORTED_ENCRYPTION_TYPE},
+  #else
+    {"UNSUPPORTED_ENCRYPTION_TYPE", 46, 192},
+  #endif
+  #ifdef CMS_R_UNSUPPORTED_KEK_ALGORITHM
+    {"UNSUPPORTED_KEK_ALGORITHM", ERR_LIB_CMS, CMS_R_UNSUPPORTED_KEK_ALGORITHM},
+  #else
+    {"UNSUPPORTED_KEK_ALGORITHM", 46, 153},
+  #endif
+  #ifdef CMS_R_UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM
+    {"UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM", ERR_LIB_CMS, CMS_R_UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM},
+  #else
+    {"UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM", 46, 179},
+  #endif
+  #ifdef CMS_R_UNSUPPORTED_LABEL_SOURCE
+    {"UNSUPPORTED_LABEL_SOURCE", ERR_LIB_CMS, CMS_R_UNSUPPORTED_LABEL_SOURCE},
+  #else
+    {"UNSUPPORTED_LABEL_SOURCE", 46, 193},
+  #endif
+  #ifdef CMS_R_UNSUPPORTED_RECIPIENTINFO_TYPE
+    {"UNSUPPORTED_RECIPIENTINFO_TYPE", ERR_LIB_CMS, CMS_R_UNSUPPORTED_RECIPIENTINFO_TYPE},
+  #else
+    {"UNSUPPORTED_RECIPIENTINFO_TYPE", 46, 155},
+  #endif
+  #ifdef CMS_R_UNSUPPORTED_RECIPIENT_TYPE
+    {"UNSUPPORTED_RECIPIENT_TYPE", ERR_LIB_CMS, CMS_R_UNSUPPORTED_RECIPIENT_TYPE},
+  #else
+    {"UNSUPPORTED_RECIPIENT_TYPE", 46, 154},
+  #endif
+  #ifdef CMS_R_UNSUPPORTED_TYPE
+    {"UNSUPPORTED_TYPE", ERR_LIB_CMS, CMS_R_UNSUPPORTED_TYPE},
+  #else
+    {"UNSUPPORTED_TYPE", 46, 156},
+  #endif
+  #ifdef CMS_R_UNWRAP_ERROR
+    {"UNWRAP_ERROR", ERR_LIB_CMS, CMS_R_UNWRAP_ERROR},
+  #else
+    {"UNWRAP_ERROR", 46, 157},
+  #endif
+  #ifdef CMS_R_UNWRAP_FAILURE
+    {"UNWRAP_FAILURE", ERR_LIB_CMS, CMS_R_UNWRAP_FAILURE},
+  #else
+    {"UNWRAP_FAILURE", 46, 180},
+  #endif
+  #ifdef CMS_R_VERIFICATION_FAILURE
+    {"VERIFICATION_FAILURE", ERR_LIB_CMS, CMS_R_VERIFICATION_FAILURE},
+  #else
+    {"VERIFICATION_FAILURE", 46, 158},
+  #endif
+  #ifdef CMS_R_WRAP_ERROR
+    {"WRAP_ERROR", ERR_LIB_CMS, CMS_R_WRAP_ERROR},
+  #else
+    {"WRAP_ERROR", 46, 159},
+  #endif
+  #ifdef COMP_R_ZLIB_DEFLATE_ERROR
+    {"ZLIB_DEFLATE_ERROR", ERR_LIB_COMP, COMP_R_ZLIB_DEFLATE_ERROR},
+  #else
+    {"ZLIB_DEFLATE_ERROR", 41, 99},
+  #endif
+  #ifdef COMP_R_ZLIB_INFLATE_ERROR
+    {"ZLIB_INFLATE_ERROR", ERR_LIB_COMP, COMP_R_ZLIB_INFLATE_ERROR},
+  #else
+    {"ZLIB_INFLATE_ERROR", 41, 100},
+  #endif
+  #ifdef COMP_R_ZLIB_NOT_SUPPORTED
+    {"ZLIB_NOT_SUPPORTED", ERR_LIB_COMP, COMP_R_ZLIB_NOT_SUPPORTED},
+  #else
+    {"ZLIB_NOT_SUPPORTED", 41, 101},
+  #endif
+  #ifdef CONF_R_ERROR_LOADING_DSO
+    {"ERROR_LOADING_DSO", ERR_LIB_CONF, CONF_R_ERROR_LOADING_DSO},
+  #else
+    {"ERROR_LOADING_DSO", 14, 110},
+  #endif
+  #ifdef CONF_R_INVALID_PRAGMA
+    {"INVALID_PRAGMA", ERR_LIB_CONF, CONF_R_INVALID_PRAGMA},
+  #else
+    {"INVALID_PRAGMA", 14, 122},
+  #endif
+  #ifdef CONF_R_LIST_CANNOT_BE_NULL
+    {"LIST_CANNOT_BE_NULL", ERR_LIB_CONF, CONF_R_LIST_CANNOT_BE_NULL},
+  #else
+    {"LIST_CANNOT_BE_NULL", 14, 115},
+  #endif
+  #ifdef CONF_R_MANDATORY_BRACES_IN_VARIABLE_EXPANSION
+    {"MANDATORY_BRACES_IN_VARIABLE_EXPANSION", ERR_LIB_CONF, CONF_R_MANDATORY_BRACES_IN_VARIABLE_EXPANSION},
+  #else
+    {"MANDATORY_BRACES_IN_VARIABLE_EXPANSION", 14, 123},
+  #endif
+  #ifdef CONF_R_MISSING_CLOSE_SQUARE_BRACKET
+    {"MISSING_CLOSE_SQUARE_BRACKET", ERR_LIB_CONF, CONF_R_MISSING_CLOSE_SQUARE_BRACKET},
+  #else
+    {"MISSING_CLOSE_SQUARE_BRACKET", 14, 100},
+  #endif
+  #ifdef CONF_R_MISSING_EQUAL_SIGN
+    {"MISSING_EQUAL_SIGN", ERR_LIB_CONF, CONF_R_MISSING_EQUAL_SIGN},
+  #else
+    {"MISSING_EQUAL_SIGN", 14, 101},
+  #endif
+  #ifdef CONF_R_MISSING_INIT_FUNCTION
+    {"MISSING_INIT_FUNCTION", ERR_LIB_CONF, CONF_R_MISSING_INIT_FUNCTION},
+  #else
+    {"MISSING_INIT_FUNCTION", 14, 112},
+  #endif
+  #ifdef CONF_R_MODULE_INITIALIZATION_ERROR
+    {"MODULE_INITIALIZATION_ERROR", ERR_LIB_CONF, CONF_R_MODULE_INITIALIZATION_ERROR},
+  #else
+    {"MODULE_INITIALIZATION_ERROR", 14, 109},
+  #endif
+  #ifdef CONF_R_NO_CLOSE_BRACE
+    {"NO_CLOSE_BRACE", ERR_LIB_CONF, CONF_R_NO_CLOSE_BRACE},
+  #else
+    {"NO_CLOSE_BRACE", 14, 102},
+  #endif
+  #ifdef CONF_R_NO_CONF
+    {"NO_CONF", ERR_LIB_CONF, CONF_R_NO_CONF},
+  #else
+    {"NO_CONF", 14, 105},
+  #endif
+  #ifdef CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE
+    {"NO_CONF_OR_ENVIRONMENT_VARIABLE", ERR_LIB_CONF, CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE},
+  #else
+    {"NO_CONF_OR_ENVIRONMENT_VARIABLE", 14, 106},
+  #endif
+  #ifdef CONF_R_NO_SECTION
+    {"NO_SECTION", ERR_LIB_CONF, CONF_R_NO_SECTION},
+  #else
+    {"NO_SECTION", 14, 107},
+  #endif
+  #ifdef CONF_R_NO_SUCH_FILE
+    {"NO_SUCH_FILE", ERR_LIB_CONF, CONF_R_NO_SUCH_FILE},
+  #else
+    {"NO_SUCH_FILE", 14, 114},
+  #endif
+  #ifdef CONF_R_NO_VALUE
+    {"NO_VALUE", ERR_LIB_CONF, CONF_R_NO_VALUE},
+  #else
+    {"NO_VALUE", 14, 108},
+  #endif
+  #ifdef CONF_R_NUMBER_TOO_LARGE
+    {"NUMBER_TOO_LARGE", ERR_LIB_CONF, CONF_R_NUMBER_TOO_LARGE},
+  #else
+    {"NUMBER_TOO_LARGE", 14, 121},
+  #endif
+  #ifdef CONF_R_OPENSSL_CONF_REFERENCES_MISSING_SECTION
+    {"OPENSSL_CONF_REFERENCES_MISSING_SECTION", ERR_LIB_CONF, CONF_R_OPENSSL_CONF_REFERENCES_MISSING_SECTION},
+  #else
+    {"OPENSSL_CONF_REFERENCES_MISSING_SECTION", 14, 124},
+  #endif
+  #ifdef CONF_R_RECURSIVE_DIRECTORY_INCLUDE
+    {"RECURSIVE_DIRECTORY_INCLUDE", ERR_LIB_CONF, CONF_R_RECURSIVE_DIRECTORY_INCLUDE},
+  #else
+    {"RECURSIVE_DIRECTORY_INCLUDE", 14, 111},
+  #endif
+  #ifdef CONF_R_SSL_COMMAND_SECTION_EMPTY
+    {"SSL_COMMAND_SECTION_EMPTY", ERR_LIB_CONF, CONF_R_SSL_COMMAND_SECTION_EMPTY},
+  #else
+    {"SSL_COMMAND_SECTION_EMPTY", 14, 117},
+  #endif
+  #ifdef CONF_R_SSL_COMMAND_SECTION_NOT_FOUND
+    {"SSL_COMMAND_SECTION_NOT_FOUND", ERR_LIB_CONF, CONF_R_SSL_COMMAND_SECTION_NOT_FOUND},
+  #else
+    {"SSL_COMMAND_SECTION_NOT_FOUND", 14, 118},
+  #endif
+  #ifdef CONF_R_SSL_SECTION_EMPTY
+    {"SSL_SECTION_EMPTY", ERR_LIB_CONF, CONF_R_SSL_SECTION_EMPTY},
+  #else
+    {"SSL_SECTION_EMPTY", 14, 119},
+  #endif
+  #ifdef CONF_R_SSL_SECTION_NOT_FOUND
+    {"SSL_SECTION_NOT_FOUND", ERR_LIB_CONF, CONF_R_SSL_SECTION_NOT_FOUND},
+  #else
+    {"SSL_SECTION_NOT_FOUND", 14, 120},
+  #endif
+  #ifdef CONF_R_UNABLE_TO_CREATE_NEW_SECTION
+    {"UNABLE_TO_CREATE_NEW_SECTION", ERR_LIB_CONF, CONF_R_UNABLE_TO_CREATE_NEW_SECTION},
+  #else
+    {"UNABLE_TO_CREATE_NEW_SECTION", 14, 103},
+  #endif
+  #ifdef CONF_R_UNKNOWN_MODULE_NAME
+    {"UNKNOWN_MODULE_NAME", ERR_LIB_CONF, CONF_R_UNKNOWN_MODULE_NAME},
+  #else
+    {"UNKNOWN_MODULE_NAME", 14, 113},
+  #endif
+  #ifdef CONF_R_VARIABLE_EXPANSION_TOO_LONG
+    {"VARIABLE_EXPANSION_TOO_LONG", ERR_LIB_CONF, CONF_R_VARIABLE_EXPANSION_TOO_LONG},
+  #else
+    {"VARIABLE_EXPANSION_TOO_LONG", 14, 116},
+  #endif
+  #ifdef CONF_R_VARIABLE_HAS_NO_VALUE
+    {"VARIABLE_HAS_NO_VALUE", ERR_LIB_CONF, CONF_R_VARIABLE_HAS_NO_VALUE},
+  #else
+    {"VARIABLE_HAS_NO_VALUE", 14, 104},
+  #endif
+  #ifdef CRMF_R_BAD_PBM_ITERATIONCOUNT
+    {"BAD_PBM_ITERATIONCOUNT", ERR_LIB_CRMF, CRMF_R_BAD_PBM_ITERATIONCOUNT},
+  #else
+    {"BAD_PBM_ITERATIONCOUNT", 56, 100},
+  #endif
+  #ifdef CRMF_R_CRMFERROR
+    {"CRMFERROR", ERR_LIB_CRMF, CRMF_R_CRMFERROR},
+  #else
+    {"CRMFERROR", 56, 102},
+  #endif
+  #ifdef CRMF_R_ERROR
+    {"ERROR", ERR_LIB_CRMF, CRMF_R_ERROR},
+  #else
+    {"ERROR", 56, 103},
+  #endif
+  #ifdef CRMF_R_ERROR_DECODING_CERTIFICATE
+    {"ERROR_DECODING_CERTIFICATE", ERR_LIB_CRMF, CRMF_R_ERROR_DECODING_CERTIFICATE},
+  #else
+    {"ERROR_DECODING_CERTIFICATE", 56, 104},
+  #endif
+  #ifdef CRMF_R_ERROR_DECRYPTING_CERTIFICATE
+    {"ERROR_DECRYPTING_CERTIFICATE", ERR_LIB_CRMF, CRMF_R_ERROR_DECRYPTING_CERTIFICATE},
+  #else
+    {"ERROR_DECRYPTING_CERTIFICATE", 56, 105},
+  #endif
+  #ifdef CRMF_R_ERROR_DECRYPTING_SYMMETRIC_KEY
+    {"ERROR_DECRYPTING_SYMMETRIC_KEY", ERR_LIB_CRMF, CRMF_R_ERROR_DECRYPTING_SYMMETRIC_KEY},
+  #else
+    {"ERROR_DECRYPTING_SYMMETRIC_KEY", 56, 106},
+  #endif
+  #ifdef CRMF_R_FAILURE_OBTAINING_RANDOM
+    {"FAILURE_OBTAINING_RANDOM", ERR_LIB_CRMF, CRMF_R_FAILURE_OBTAINING_RANDOM},
+  #else
+    {"FAILURE_OBTAINING_RANDOM", 56, 107},
+  #endif
+  #ifdef CRMF_R_ITERATIONCOUNT_BELOW_100
+    {"ITERATIONCOUNT_BELOW_100", ERR_LIB_CRMF, CRMF_R_ITERATIONCOUNT_BELOW_100},
+  #else
+    {"ITERATIONCOUNT_BELOW_100", 56, 108},
+  #endif
+  #ifdef CRMF_R_MALFORMED_IV
+    {"MALFORMED_IV", ERR_LIB_CRMF, CRMF_R_MALFORMED_IV},
+  #else
+    {"MALFORMED_IV", 56, 101},
+  #endif
+  #ifdef CRMF_R_NULL_ARGUMENT
+    {"NULL_ARGUMENT", ERR_LIB_CRMF, CRMF_R_NULL_ARGUMENT},
+  #else
+    {"NULL_ARGUMENT", 56, 109},
+  #endif
+  #ifdef CRMF_R_POPOSKINPUT_NOT_SUPPORTED
+    {"POPOSKINPUT_NOT_SUPPORTED", ERR_LIB_CRMF, CRMF_R_POPOSKINPUT_NOT_SUPPORTED},
+  #else
+    {"POPOSKINPUT_NOT_SUPPORTED", 56, 113},
+  #endif
+  #ifdef CRMF_R_POPO_INCONSISTENT_PUBLIC_KEY
+    {"POPO_INCONSISTENT_PUBLIC_KEY", ERR_LIB_CRMF, CRMF_R_POPO_INCONSISTENT_PUBLIC_KEY},
+  #else
+    {"POPO_INCONSISTENT_PUBLIC_KEY", 56, 117},
+  #endif
+  #ifdef CRMF_R_POPO_MISSING
+    {"POPO_MISSING", ERR_LIB_CRMF, CRMF_R_POPO_MISSING},
+  #else
+    {"POPO_MISSING", 56, 121},
+  #endif
+  #ifdef CRMF_R_POPO_MISSING_PUBLIC_KEY
+    {"POPO_MISSING_PUBLIC_KEY", ERR_LIB_CRMF, CRMF_R_POPO_MISSING_PUBLIC_KEY},
+  #else
+    {"POPO_MISSING_PUBLIC_KEY", 56, 118},
+  #endif
+  #ifdef CRMF_R_POPO_MISSING_SUBJECT
+    {"POPO_MISSING_SUBJECT", ERR_LIB_CRMF, CRMF_R_POPO_MISSING_SUBJECT},
+  #else
+    {"POPO_MISSING_SUBJECT", 56, 119},
+  #endif
+  #ifdef CRMF_R_POPO_RAVERIFIED_NOT_ACCEPTED
+    {"POPO_RAVERIFIED_NOT_ACCEPTED", ERR_LIB_CRMF, CRMF_R_POPO_RAVERIFIED_NOT_ACCEPTED},
+  #else
+    {"POPO_RAVERIFIED_NOT_ACCEPTED", 56, 120},
+  #endif
+  #ifdef CRMF_R_SETTING_MAC_ALGOR_FAILURE
+    {"SETTING_MAC_ALGOR_FAILURE", ERR_LIB_CRMF, CRMF_R_SETTING_MAC_ALGOR_FAILURE},
+  #else
+    {"SETTING_MAC_ALGOR_FAILURE", 56, 110},
+  #endif
+  #ifdef CRMF_R_SETTING_OWF_ALGOR_FAILURE
+    {"SETTING_OWF_ALGOR_FAILURE", ERR_LIB_CRMF, CRMF_R_SETTING_OWF_ALGOR_FAILURE},
+  #else
+    {"SETTING_OWF_ALGOR_FAILURE", 56, 111},
+  #endif
+  #ifdef CRMF_R_UNSUPPORTED_ALGORITHM
+    {"UNSUPPORTED_ALGORITHM", ERR_LIB_CRMF, CRMF_R_UNSUPPORTED_ALGORITHM},
+  #else
+    {"UNSUPPORTED_ALGORITHM", 56, 112},
+  #endif
+  #ifdef CRMF_R_UNSUPPORTED_CIPHER
+    {"UNSUPPORTED_CIPHER", ERR_LIB_CRMF, CRMF_R_UNSUPPORTED_CIPHER},
+  #else
+    {"UNSUPPORTED_CIPHER", 56, 114},
+  #endif
+  #ifdef CRMF_R_UNSUPPORTED_METHOD_FOR_CREATING_POPO
+    {"UNSUPPORTED_METHOD_FOR_CREATING_POPO", ERR_LIB_CRMF, CRMF_R_UNSUPPORTED_METHOD_FOR_CREATING_POPO},
+  #else
+    {"UNSUPPORTED_METHOD_FOR_CREATING_POPO", 56, 115},
+  #endif
+  #ifdef CRMF_R_UNSUPPORTED_POPO_METHOD
+    {"UNSUPPORTED_POPO_METHOD", ERR_LIB_CRMF, CRMF_R_UNSUPPORTED_POPO_METHOD},
+  #else
+    {"UNSUPPORTED_POPO_METHOD", 56, 116},
+  #endif
+  #ifdef CRYPTO_R_BAD_ALGORITHM_NAME
+    {"BAD_ALGORITHM_NAME", ERR_LIB_CRYPTO, CRYPTO_R_BAD_ALGORITHM_NAME},
+  #else
+    {"BAD_ALGORITHM_NAME", 15, 117},
+  #endif
+  #ifdef CRYPTO_R_CONFLICTING_NAMES
+    {"CONFLICTING_NAMES", ERR_LIB_CRYPTO, CRYPTO_R_CONFLICTING_NAMES},
+  #else
+    {"CONFLICTING_NAMES", 15, 118},
+  #endif
+  #ifdef CRYPTO_R_FIPS_MODE_NOT_SUPPORTED
+    {"FIPS_MODE_NOT_SUPPORTED", ERR_LIB_CRYPTO, CRYPTO_R_FIPS_MODE_NOT_SUPPORTED},
+  #else
+    {"FIPS_MODE_NOT_SUPPORTED", 15, 101},
+  #endif
+  #ifdef CRYPTO_R_HEX_STRING_TOO_SHORT
+    {"HEX_STRING_TOO_SHORT", ERR_LIB_CRYPTO, CRYPTO_R_HEX_STRING_TOO_SHORT},
+  #else
+    {"HEX_STRING_TOO_SHORT", 15, 121},
+  #endif
+  #ifdef CRYPTO_R_ILLEGAL_HEX_DIGIT
+    {"ILLEGAL_HEX_DIGIT", ERR_LIB_CRYPTO, CRYPTO_R_ILLEGAL_HEX_DIGIT},
+  #else
+    {"ILLEGAL_HEX_DIGIT", 15, 102},
+  #endif
+  #ifdef CRYPTO_R_INSUFFICIENT_DATA_SPACE
+    {"INSUFFICIENT_DATA_SPACE", ERR_LIB_CRYPTO, CRYPTO_R_INSUFFICIENT_DATA_SPACE},
+  #else
+    {"INSUFFICIENT_DATA_SPACE", 15, 106},
+  #endif
+  #ifdef CRYPTO_R_INSUFFICIENT_PARAM_SIZE
+    {"INSUFFICIENT_PARAM_SIZE", ERR_LIB_CRYPTO, CRYPTO_R_INSUFFICIENT_PARAM_SIZE},
+  #else
+    {"INSUFFICIENT_PARAM_SIZE", 15, 107},
+  #endif
+  #ifdef CRYPTO_R_INSUFFICIENT_SECURE_DATA_SPACE
+    {"INSUFFICIENT_SECURE_DATA_SPACE", ERR_LIB_CRYPTO, CRYPTO_R_INSUFFICIENT_SECURE_DATA_SPACE},
+  #else
+    {"INSUFFICIENT_SECURE_DATA_SPACE", 15, 108},
+  #endif
+  #ifdef CRYPTO_R_INVALID_NULL_ARGUMENT
+    {"INVALID_NULL_ARGUMENT", ERR_LIB_CRYPTO, CRYPTO_R_INVALID_NULL_ARGUMENT},
+  #else
+    {"INVALID_NULL_ARGUMENT", 15, 109},
+  #endif
+  #ifdef CRYPTO_R_INVALID_OSSL_PARAM_TYPE
+    {"INVALID_OSSL_PARAM_TYPE", ERR_LIB_CRYPTO, CRYPTO_R_INVALID_OSSL_PARAM_TYPE},
+  #else
+    {"INVALID_OSSL_PARAM_TYPE", 15, 110},
+  #endif
+  #ifdef CRYPTO_R_ODD_NUMBER_OF_DIGITS
+    {"ODD_NUMBER_OF_DIGITS", ERR_LIB_CRYPTO, CRYPTO_R_ODD_NUMBER_OF_DIGITS},
+  #else
+    {"ODD_NUMBER_OF_DIGITS", 15, 103},
+  #endif
+  #ifdef CRYPTO_R_PROVIDER_ALREADY_EXISTS
+    {"PROVIDER_ALREADY_EXISTS", ERR_LIB_CRYPTO, CRYPTO_R_PROVIDER_ALREADY_EXISTS},
+  #else
+    {"PROVIDER_ALREADY_EXISTS", 15, 104},
+  #endif
+  #ifdef CRYPTO_R_PROVIDER_SECTION_ERROR
+    {"PROVIDER_SECTION_ERROR", ERR_LIB_CRYPTO, CRYPTO_R_PROVIDER_SECTION_ERROR},
+  #else
+    {"PROVIDER_SECTION_ERROR", 15, 105},
+  #endif
+  #ifdef CRYPTO_R_RANDOM_SECTION_ERROR
+    {"RANDOM_SECTION_ERROR", ERR_LIB_CRYPTO, CRYPTO_R_RANDOM_SECTION_ERROR},
+  #else
+    {"RANDOM_SECTION_ERROR", 15, 119},
+  #endif
+  #ifdef CRYPTO_R_SECURE_MALLOC_FAILURE
+    {"SECURE_MALLOC_FAILURE", ERR_LIB_CRYPTO, CRYPTO_R_SECURE_MALLOC_FAILURE},
+  #else
+    {"SECURE_MALLOC_FAILURE", 15, 111},
+  #endif
+  #ifdef CRYPTO_R_STRING_TOO_LONG
+    {"STRING_TOO_LONG", ERR_LIB_CRYPTO, CRYPTO_R_STRING_TOO_LONG},
+  #else
+    {"STRING_TOO_LONG", 15, 112},
+  #endif
+  #ifdef CRYPTO_R_TOO_MANY_BYTES
+    {"TOO_MANY_BYTES", ERR_LIB_CRYPTO, CRYPTO_R_TOO_MANY_BYTES},
+  #else
+    {"TOO_MANY_BYTES", 15, 113},
+  #endif
+  #ifdef CRYPTO_R_TOO_MANY_RECORDS
+    {"TOO_MANY_RECORDS", ERR_LIB_CRYPTO, CRYPTO_R_TOO_MANY_RECORDS},
+  #else
+    {"TOO_MANY_RECORDS", 15, 114},
+  #endif
+  #ifdef CRYPTO_R_TOO_SMALL_BUFFER
+    {"TOO_SMALL_BUFFER", ERR_LIB_CRYPTO, CRYPTO_R_TOO_SMALL_BUFFER},
+  #else
+    {"TOO_SMALL_BUFFER", 15, 116},
+  #endif
+  #ifdef CRYPTO_R_UNKNOWN_NAME_IN_RANDOM_SECTION
+    {"UNKNOWN_NAME_IN_RANDOM_SECTION", ERR_LIB_CRYPTO, CRYPTO_R_UNKNOWN_NAME_IN_RANDOM_SECTION},
+  #else
+    {"UNKNOWN_NAME_IN_RANDOM_SECTION", 15, 120},
+  #endif
+  #ifdef CRYPTO_R_ZERO_LENGTH_NUMBER
+    {"ZERO_LENGTH_NUMBER", ERR_LIB_CRYPTO, CRYPTO_R_ZERO_LENGTH_NUMBER},
+  #else
+    {"ZERO_LENGTH_NUMBER", 15, 115},
+  #endif
+  #ifdef CT_R_BASE64_DECODE_ERROR
+    {"BASE64_DECODE_ERROR", ERR_LIB_CT, CT_R_BASE64_DECODE_ERROR},
+  #else
+    {"BASE64_DECODE_ERROR", 50, 108},
+  #endif
+  #ifdef CT_R_INVALID_LOG_ID_LENGTH
+    {"INVALID_LOG_ID_LENGTH", ERR_LIB_CT, CT_R_INVALID_LOG_ID_LENGTH},
+  #else
+    {"INVALID_LOG_ID_LENGTH", 50, 100},
+  #endif
+  #ifdef CT_R_LOG_CONF_INVALID
+    {"LOG_CONF_INVALID", ERR_LIB_CT, CT_R_LOG_CONF_INVALID},
+  #else
+    {"LOG_CONF_INVALID", 50, 109},
+  #endif
+  #ifdef CT_R_LOG_CONF_INVALID_KEY
+    {"LOG_CONF_INVALID_KEY", ERR_LIB_CT, CT_R_LOG_CONF_INVALID_KEY},
+  #else
+    {"LOG_CONF_INVALID_KEY", 50, 110},
+  #endif
+  #ifdef CT_R_LOG_CONF_MISSING_DESCRIPTION
+    {"LOG_CONF_MISSING_DESCRIPTION", ERR_LIB_CT, CT_R_LOG_CONF_MISSING_DESCRIPTION},
+  #else
+    {"LOG_CONF_MISSING_DESCRIPTION", 50, 111},
+  #endif
+  #ifdef CT_R_LOG_CONF_MISSING_KEY
+    {"LOG_CONF_MISSING_KEY", ERR_LIB_CT, CT_R_LOG_CONF_MISSING_KEY},
+  #else
+    {"LOG_CONF_MISSING_KEY", 50, 112},
+  #endif
+  #ifdef CT_R_LOG_KEY_INVALID
+    {"LOG_KEY_INVALID", ERR_LIB_CT, CT_R_LOG_KEY_INVALID},
+  #else
+    {"LOG_KEY_INVALID", 50, 113},
+  #endif
+  #ifdef CT_R_SCT_FUTURE_TIMESTAMP
+    {"SCT_FUTURE_TIMESTAMP", ERR_LIB_CT, CT_R_SCT_FUTURE_TIMESTAMP},
+  #else
+    {"SCT_FUTURE_TIMESTAMP", 50, 116},
+  #endif
+  #ifdef CT_R_SCT_INVALID
+    {"SCT_INVALID", ERR_LIB_CT, CT_R_SCT_INVALID},
+  #else
+    {"SCT_INVALID", 50, 104},
+  #endif
+  #ifdef CT_R_SCT_INVALID_SIGNATURE
+    {"SCT_INVALID_SIGNATURE", ERR_LIB_CT, CT_R_SCT_INVALID_SIGNATURE},
+  #else
+    {"SCT_INVALID_SIGNATURE", 50, 107},
+  #endif
+  #ifdef CT_R_SCT_LIST_INVALID
+    {"SCT_LIST_INVALID", ERR_LIB_CT, CT_R_SCT_LIST_INVALID},
+  #else
+    {"SCT_LIST_INVALID", 50, 105},
+  #endif
+  #ifdef CT_R_SCT_LOG_ID_MISMATCH
+    {"SCT_LOG_ID_MISMATCH", ERR_LIB_CT, CT_R_SCT_LOG_ID_MISMATCH},
+  #else
+    {"SCT_LOG_ID_MISMATCH", 50, 114},
+  #endif
+  #ifdef CT_R_SCT_NOT_SET
+    {"SCT_NOT_SET", ERR_LIB_CT, CT_R_SCT_NOT_SET},
+  #else
+    {"SCT_NOT_SET", 50, 106},
+  #endif
+  #ifdef CT_R_SCT_UNSUPPORTED_VERSION
+    {"SCT_UNSUPPORTED_VERSION", ERR_LIB_CT, CT_R_SCT_UNSUPPORTED_VERSION},
+  #else
+    {"SCT_UNSUPPORTED_VERSION", 50, 115},
+  #endif
+  #ifdef CT_R_UNRECOGNIZED_SIGNATURE_NID
+    {"UNRECOGNIZED_SIGNATURE_NID", ERR_LIB_CT, CT_R_UNRECOGNIZED_SIGNATURE_NID},
+  #else
+    {"UNRECOGNIZED_SIGNATURE_NID", 50, 101},
+  #endif
+  #ifdef CT_R_UNSUPPORTED_ENTRY_TYPE
+    {"UNSUPPORTED_ENTRY_TYPE", ERR_LIB_CT, CT_R_UNSUPPORTED_ENTRY_TYPE},
+  #else
+    {"UNSUPPORTED_ENTRY_TYPE", 50, 102},
+  #endif
+  #ifdef CT_R_UNSUPPORTED_VERSION
+    {"UNSUPPORTED_VERSION", ERR_LIB_CT, CT_R_UNSUPPORTED_VERSION},
+  #else
+    {"UNSUPPORTED_VERSION", 50, 103},
+  #endif
+  #ifdef DH_R_BAD_FFC_PARAMETERS
+    {"BAD_FFC_PARAMETERS", ERR_LIB_DH, DH_R_BAD_FFC_PARAMETERS},
+  #else
+    {"BAD_FFC_PARAMETERS", 5, 127},
+  #endif
+  #ifdef DH_R_BAD_GENERATOR
+    {"BAD_GENERATOR", ERR_LIB_DH, DH_R_BAD_GENERATOR},
+  #else
+    {"BAD_GENERATOR", 5, 101},
+  #endif
+  #ifdef DH_R_BN_DECODE_ERROR
+    {"BN_DECODE_ERROR", ERR_LIB_DH, DH_R_BN_DECODE_ERROR},
+  #else
+    {"BN_DECODE_ERROR", 5, 109},
+  #endif
+  #ifdef DH_R_BN_ERROR
+    {"BN_ERROR", ERR_LIB_DH, DH_R_BN_ERROR},
+  #else
+    {"BN_ERROR", 5, 106},
+  #endif
+  #ifdef DH_R_CHECK_INVALID_J_VALUE
+    {"CHECK_INVALID_J_VALUE", ERR_LIB_DH, DH_R_CHECK_INVALID_J_VALUE},
+  #else
+    {"CHECK_INVALID_J_VALUE", 5, 115},
+  #endif
+  #ifdef DH_R_CHECK_INVALID_Q_VALUE
+    {"CHECK_INVALID_Q_VALUE", ERR_LIB_DH, DH_R_CHECK_INVALID_Q_VALUE},
+  #else
+    {"CHECK_INVALID_Q_VALUE", 5, 116},
+  #endif
+  #ifdef DH_R_CHECK_PUBKEY_INVALID
+    {"CHECK_PUBKEY_INVALID", ERR_LIB_DH, DH_R_CHECK_PUBKEY_INVALID},
+  #else
+    {"CHECK_PUBKEY_INVALID", 5, 122},
+  #endif
+  #ifdef DH_R_CHECK_PUBKEY_TOO_LARGE
+    {"CHECK_PUBKEY_TOO_LARGE", ERR_LIB_DH, DH_R_CHECK_PUBKEY_TOO_LARGE},
+  #else
+    {"CHECK_PUBKEY_TOO_LARGE", 5, 123},
+  #endif
+  #ifdef DH_R_CHECK_PUBKEY_TOO_SMALL
+    {"CHECK_PUBKEY_TOO_SMALL", ERR_LIB_DH, DH_R_CHECK_PUBKEY_TOO_SMALL},
+  #else
+    {"CHECK_PUBKEY_TOO_SMALL", 5, 124},
+  #endif
+  #ifdef DH_R_CHECK_P_NOT_PRIME
+    {"CHECK_P_NOT_PRIME", ERR_LIB_DH, DH_R_CHECK_P_NOT_PRIME},
+  #else
+    {"CHECK_P_NOT_PRIME", 5, 117},
+  #endif
+  #ifdef DH_R_CHECK_P_NOT_SAFE_PRIME
+    {"CHECK_P_NOT_SAFE_PRIME", ERR_LIB_DH, DH_R_CHECK_P_NOT_SAFE_PRIME},
+  #else
+    {"CHECK_P_NOT_SAFE_PRIME", 5, 118},
+  #endif
+  #ifdef DH_R_CHECK_Q_NOT_PRIME
+    {"CHECK_Q_NOT_PRIME", ERR_LIB_DH, DH_R_CHECK_Q_NOT_PRIME},
+  #else
+    {"CHECK_Q_NOT_PRIME", 5, 119},
+  #endif
+  #ifdef DH_R_DECODE_ERROR
+    {"DECODE_ERROR", ERR_LIB_DH, DH_R_DECODE_ERROR},
+  #else
+    {"DECODE_ERROR", 5, 104},
+  #endif
+  #ifdef DH_R_INVALID_PARAMETER_NAME
+    {"INVALID_PARAMETER_NAME", ERR_LIB_DH, DH_R_INVALID_PARAMETER_NAME},
+  #else
+    {"INVALID_PARAMETER_NAME", 5, 110},
+  #endif
+  #ifdef DH_R_INVALID_PARAMETER_NID
+    {"INVALID_PARAMETER_NID", ERR_LIB_DH, DH_R_INVALID_PARAMETER_NID},
+  #else
+    {"INVALID_PARAMETER_NID", 5, 114},
+  #endif
+  #ifdef DH_R_INVALID_PUBKEY
+    {"INVALID_PUBKEY", ERR_LIB_DH, DH_R_INVALID_PUBKEY},
+  #else
+    {"INVALID_PUBKEY", 5, 102},
+  #endif
+  #ifdef DH_R_INVALID_SECRET
+    {"INVALID_SECRET", ERR_LIB_DH, DH_R_INVALID_SECRET},
+  #else
+    {"INVALID_SECRET", 5, 128},
+  #endif
+  #ifdef DH_R_KDF_PARAMETER_ERROR
+    {"KDF_PARAMETER_ERROR", ERR_LIB_DH, DH_R_KDF_PARAMETER_ERROR},
+  #else
+    {"KDF_PARAMETER_ERROR", 5, 112},
+  #endif
+  #ifdef DH_R_KEYS_NOT_SET
+    {"KEYS_NOT_SET", ERR_LIB_DH, DH_R_KEYS_NOT_SET},
+  #else
+    {"KEYS_NOT_SET", 5, 108},
+  #endif
+  #ifdef DH_R_MISSING_PUBKEY
+    {"MISSING_PUBKEY", ERR_LIB_DH, DH_R_MISSING_PUBKEY},
+  #else
+    {"MISSING_PUBKEY", 5, 125},
+  #endif
+  #ifdef DH_R_MODULUS_TOO_LARGE
+    {"MODULUS_TOO_LARGE", ERR_LIB_DH, DH_R_MODULUS_TOO_LARGE},
+  #else
+    {"MODULUS_TOO_LARGE", 5, 103},
+  #endif
+  #ifdef DH_R_MODULUS_TOO_SMALL
+    {"MODULUS_TOO_SMALL", ERR_LIB_DH, DH_R_MODULUS_TOO_SMALL},
+  #else
+    {"MODULUS_TOO_SMALL", 5, 126},
+  #endif
+  #ifdef DH_R_NOT_SUITABLE_GENERATOR
+    {"NOT_SUITABLE_GENERATOR", ERR_LIB_DH, DH_R_NOT_SUITABLE_GENERATOR},
+  #else
+    {"NOT_SUITABLE_GENERATOR", 5, 120},
+  #endif
+  #ifdef DH_R_NO_PARAMETERS_SET
+    {"NO_PARAMETERS_SET", ERR_LIB_DH, DH_R_NO_PARAMETERS_SET},
+  #else
+    {"NO_PARAMETERS_SET", 5, 107},
+  #endif
+  #ifdef DH_R_NO_PRIVATE_VALUE
+    {"NO_PRIVATE_VALUE", ERR_LIB_DH, DH_R_NO_PRIVATE_VALUE},
+  #else
+    {"NO_PRIVATE_VALUE", 5, 100},
+  #endif
+  #ifdef DH_R_PARAMETER_ENCODING_ERROR
+    {"PARAMETER_ENCODING_ERROR", ERR_LIB_DH, DH_R_PARAMETER_ENCODING_ERROR},
+  #else
+    {"PARAMETER_ENCODING_ERROR", 5, 105},
+  #endif
+  #ifdef DH_R_PEER_KEY_ERROR
+    {"PEER_KEY_ERROR", ERR_LIB_DH, DH_R_PEER_KEY_ERROR},
+  #else
+    {"PEER_KEY_ERROR", 5, 111},
+  #endif
+  #ifdef DH_R_SHARED_INFO_ERROR
+    {"SHARED_INFO_ERROR", ERR_LIB_DH, DH_R_SHARED_INFO_ERROR},
+  #else
+    {"SHARED_INFO_ERROR", 5, 113},
+  #endif
+  #ifdef DH_R_UNABLE_TO_CHECK_GENERATOR
+    {"UNABLE_TO_CHECK_GENERATOR", ERR_LIB_DH, DH_R_UNABLE_TO_CHECK_GENERATOR},
+  #else
+    {"UNABLE_TO_CHECK_GENERATOR", 5, 121},
+  #endif
+  #ifdef DSA_R_BAD_FFC_PARAMETERS
+    {"BAD_FFC_PARAMETERS", ERR_LIB_DSA, DSA_R_BAD_FFC_PARAMETERS},
+  #else
+    {"BAD_FFC_PARAMETERS", 10, 114},
+  #endif
+  #ifdef DSA_R_BAD_Q_VALUE
+    {"BAD_Q_VALUE", ERR_LIB_DSA, DSA_R_BAD_Q_VALUE},
+  #else
+    {"BAD_Q_VALUE", 10, 102},
+  #endif
+  #ifdef DSA_R_BN_DECODE_ERROR
+    {"BN_DECODE_ERROR", ERR_LIB_DSA, DSA_R_BN_DECODE_ERROR},
+  #else
+    {"BN_DECODE_ERROR", 10, 108},
+  #endif
+  #ifdef DSA_R_BN_ERROR
+    {"BN_ERROR", ERR_LIB_DSA, DSA_R_BN_ERROR},
+  #else
+    {"BN_ERROR", 10, 109},
+  #endif
+  #ifdef DSA_R_DECODE_ERROR
+    {"DECODE_ERROR", ERR_LIB_DSA, DSA_R_DECODE_ERROR},
+  #else
+    {"DECODE_ERROR", 10, 104},
+  #endif
+  #ifdef DSA_R_INVALID_DIGEST_TYPE
+    {"INVALID_DIGEST_TYPE", ERR_LIB_DSA, DSA_R_INVALID_DIGEST_TYPE},
+  #else
+    {"INVALID_DIGEST_TYPE", 10, 106},
+  #endif
+  #ifdef DSA_R_INVALID_PARAMETERS
+    {"INVALID_PARAMETERS", ERR_LIB_DSA, DSA_R_INVALID_PARAMETERS},
+  #else
+    {"INVALID_PARAMETERS", 10, 112},
+  #endif
+  #ifdef DSA_R_MISSING_PARAMETERS
+    {"MISSING_PARAMETERS", ERR_LIB_DSA, DSA_R_MISSING_PARAMETERS},
+  #else
+    {"MISSING_PARAMETERS", 10, 101},
+  #endif
+  #ifdef DSA_R_MISSING_PRIVATE_KEY
+    {"MISSING_PRIVATE_KEY", ERR_LIB_DSA, DSA_R_MISSING_PRIVATE_KEY},
+  #else
+    {"MISSING_PRIVATE_KEY", 10, 111},
+  #endif
+  #ifdef DSA_R_MODULUS_TOO_LARGE
+    {"MODULUS_TOO_LARGE", ERR_LIB_DSA, DSA_R_MODULUS_TOO_LARGE},
+  #else
+    {"MODULUS_TOO_LARGE", 10, 103},
+  #endif
+  #ifdef DSA_R_NO_PARAMETERS_SET
+    {"NO_PARAMETERS_SET", ERR_LIB_DSA, DSA_R_NO_PARAMETERS_SET},
+  #else
+    {"NO_PARAMETERS_SET", 10, 107},
+  #endif
+  #ifdef DSA_R_PARAMETER_ENCODING_ERROR
+    {"PARAMETER_ENCODING_ERROR", ERR_LIB_DSA, DSA_R_PARAMETER_ENCODING_ERROR},
+  #else
+    {"PARAMETER_ENCODING_ERROR", 10, 105},
+  #endif
+  #ifdef DSA_R_P_NOT_PRIME
+    {"P_NOT_PRIME", ERR_LIB_DSA, DSA_R_P_NOT_PRIME},
+  #else
+    {"P_NOT_PRIME", 10, 115},
+  #endif
+  #ifdef DSA_R_Q_NOT_PRIME
+    {"Q_NOT_PRIME", ERR_LIB_DSA, DSA_R_Q_NOT_PRIME},
+  #else
+    {"Q_NOT_PRIME", 10, 113},
+  #endif
+  #ifdef DSA_R_SEED_LEN_SMALL
+    {"SEED_LEN_SMALL", ERR_LIB_DSA, DSA_R_SEED_LEN_SMALL},
+  #else
+    {"SEED_LEN_SMALL", 10, 110},
+  #endif
+  #ifdef DSO_R_CTRL_FAILED
+    {"CTRL_FAILED", ERR_LIB_DSO, DSO_R_CTRL_FAILED},
+  #else
+    {"CTRL_FAILED", 37, 100},
+  #endif
+  #ifdef DSO_R_DSO_ALREADY_LOADED
+    {"DSO_ALREADY_LOADED", ERR_LIB_DSO, DSO_R_DSO_ALREADY_LOADED},
+  #else
+    {"DSO_ALREADY_LOADED", 37, 110},
+  #endif
+  #ifdef DSO_R_EMPTY_FILE_STRUCTURE
+    {"EMPTY_FILE_STRUCTURE", ERR_LIB_DSO, DSO_R_EMPTY_FILE_STRUCTURE},
+  #else
+    {"EMPTY_FILE_STRUCTURE", 37, 113},
+  #endif
+  #ifdef DSO_R_FAILURE
+    {"FAILURE", ERR_LIB_DSO, DSO_R_FAILURE},
+  #else
+    {"FAILURE", 37, 114},
+  #endif
+  #ifdef DSO_R_FILENAME_TOO_BIG
+    {"FILENAME_TOO_BIG", ERR_LIB_DSO, DSO_R_FILENAME_TOO_BIG},
+  #else
+    {"FILENAME_TOO_BIG", 37, 101},
+  #endif
+  #ifdef DSO_R_FINISH_FAILED
+    {"FINISH_FAILED", ERR_LIB_DSO, DSO_R_FINISH_FAILED},
+  #else
+    {"FINISH_FAILED", 37, 102},
+  #endif
+  #ifdef DSO_R_INCORRECT_FILE_SYNTAX
+    {"INCORRECT_FILE_SYNTAX", ERR_LIB_DSO, DSO_R_INCORRECT_FILE_SYNTAX},
+  #else
+    {"INCORRECT_FILE_SYNTAX", 37, 115},
+  #endif
+  #ifdef DSO_R_LOAD_FAILED
+    {"LOAD_FAILED", ERR_LIB_DSO, DSO_R_LOAD_FAILED},
+  #else
+    {"LOAD_FAILED", 37, 103},
+  #endif
+  #ifdef DSO_R_NAME_TRANSLATION_FAILED
+    {"NAME_TRANSLATION_FAILED", ERR_LIB_DSO, DSO_R_NAME_TRANSLATION_FAILED},
+  #else
+    {"NAME_TRANSLATION_FAILED", 37, 109},
+  #endif
+  #ifdef DSO_R_NO_FILENAME
+    {"NO_FILENAME", ERR_LIB_DSO, DSO_R_NO_FILENAME},
+  #else
+    {"NO_FILENAME", 37, 111},
+  #endif
+  #ifdef DSO_R_NULL_HANDLE
+    {"NULL_HANDLE", ERR_LIB_DSO, DSO_R_NULL_HANDLE},
+  #else
+    {"NULL_HANDLE", 37, 104},
+  #endif
+  #ifdef DSO_R_SET_FILENAME_FAILED
+    {"SET_FILENAME_FAILED", ERR_LIB_DSO, DSO_R_SET_FILENAME_FAILED},
+  #else
+    {"SET_FILENAME_FAILED", 37, 112},
+  #endif
+  #ifdef DSO_R_STACK_ERROR
+    {"STACK_ERROR", ERR_LIB_DSO, DSO_R_STACK_ERROR},
+  #else
+    {"STACK_ERROR", 37, 105},
+  #endif
+  #ifdef DSO_R_SYM_FAILURE
+    {"SYM_FAILURE", ERR_LIB_DSO, DSO_R_SYM_FAILURE},
+  #else
+    {"SYM_FAILURE", 37, 106},
+  #endif
+  #ifdef DSO_R_UNLOAD_FAILED
+    {"UNLOAD_FAILED", ERR_LIB_DSO, DSO_R_UNLOAD_FAILED},
+  #else
+    {"UNLOAD_FAILED", 37, 107},
+  #endif
+  #ifdef DSO_R_UNSUPPORTED
+    {"UNSUPPORTED", ERR_LIB_DSO, DSO_R_UNSUPPORTED},
+  #else
+    {"UNSUPPORTED", 37, 108},
+  #endif
+  #ifdef EC_R_ASN1_ERROR
+    {"ASN1_ERROR", ERR_LIB_EC, EC_R_ASN1_ERROR},
+  #else
+    {"ASN1_ERROR", 16, 115},
+  #endif
+  #ifdef EC_R_BAD_SIGNATURE
+    {"BAD_SIGNATURE", ERR_LIB_EC, EC_R_BAD_SIGNATURE},
+  #else
+    {"BAD_SIGNATURE", 16, 156},
+  #endif
+  #ifdef EC_R_BIGNUM_OUT_OF_RANGE
+    {"BIGNUM_OUT_OF_RANGE", ERR_LIB_EC, EC_R_BIGNUM_OUT_OF_RANGE},
+  #else
+    {"BIGNUM_OUT_OF_RANGE", 16, 144},
+  #endif
+  #ifdef EC_R_BUFFER_TOO_SMALL
+    {"BUFFER_TOO_SMALL", ERR_LIB_EC, EC_R_BUFFER_TOO_SMALL},
+  #else
+    {"BUFFER_TOO_SMALL", 16, 100},
+  #endif
+  #ifdef EC_R_CANNOT_INVERT
+    {"CANNOT_INVERT", ERR_LIB_EC, EC_R_CANNOT_INVERT},
+  #else
+    {"CANNOT_INVERT", 16, 165},
+  #endif
+  #ifdef EC_R_COORDINATES_OUT_OF_RANGE
+    {"COORDINATES_OUT_OF_RANGE", ERR_LIB_EC, EC_R_COORDINATES_OUT_OF_RANGE},
+  #else
+    {"COORDINATES_OUT_OF_RANGE", 16, 146},
+  #endif
+  #ifdef EC_R_CURVE_DOES_NOT_SUPPORT_ECDH
+    {"CURVE_DOES_NOT_SUPPORT_ECDH", ERR_LIB_EC, EC_R_CURVE_DOES_NOT_SUPPORT_ECDH},
+  #else
+    {"CURVE_DOES_NOT_SUPPORT_ECDH", 16, 160},
+  #endif
+  #ifdef EC_R_CURVE_DOES_NOT_SUPPORT_ECDSA
+    {"CURVE_DOES_NOT_SUPPORT_ECDSA", ERR_LIB_EC, EC_R_CURVE_DOES_NOT_SUPPORT_ECDSA},
+  #else
+    {"CURVE_DOES_NOT_SUPPORT_ECDSA", 16, 170},
+  #endif
+  #ifdef EC_R_CURVE_DOES_NOT_SUPPORT_SIGNING
+    {"CURVE_DOES_NOT_SUPPORT_SIGNING", ERR_LIB_EC, EC_R_CURVE_DOES_NOT_SUPPORT_SIGNING},
+  #else
+    {"CURVE_DOES_NOT_SUPPORT_SIGNING", 16, 159},
+  #endif
+  #ifdef EC_R_DECODE_ERROR
+    {"DECODE_ERROR", ERR_LIB_EC, EC_R_DECODE_ERROR},
+  #else
+    {"DECODE_ERROR", 16, 142},
+  #endif
+  #ifdef EC_R_DISCRIMINANT_IS_ZERO
+    {"DISCRIMINANT_IS_ZERO", ERR_LIB_EC, EC_R_DISCRIMINANT_IS_ZERO},
+  #else
+    {"DISCRIMINANT_IS_ZERO", 16, 118},
+  #endif
+  #ifdef EC_R_EC_GROUP_NEW_BY_NAME_FAILURE
+    {"EC_GROUP_NEW_BY_NAME_FAILURE", ERR_LIB_EC, EC_R_EC_GROUP_NEW_BY_NAME_FAILURE},
+  #else
+    {"EC_GROUP_NEW_BY_NAME_FAILURE", 16, 119},
+  #endif
+  #ifdef EC_R_FAILED_MAKING_PUBLIC_KEY
+    {"FAILED_MAKING_PUBLIC_KEY", ERR_LIB_EC, EC_R_FAILED_MAKING_PUBLIC_KEY},
+  #else
+    {"FAILED_MAKING_PUBLIC_KEY", 16, 166},
+  #endif
+  #ifdef EC_R_FIELD_TOO_LARGE
+    {"FIELD_TOO_LARGE", ERR_LIB_EC, EC_R_FIELD_TOO_LARGE},
+  #else
+    {"FIELD_TOO_LARGE", 16, 143},
+  #endif
+  #ifdef EC_R_GF2M_NOT_SUPPORTED
+    {"GF2M_NOT_SUPPORTED", ERR_LIB_EC, EC_R_GF2M_NOT_SUPPORTED},
+  #else
+    {"GF2M_NOT_SUPPORTED", 16, 147},
+  #endif
+  #ifdef EC_R_GROUP2PKPARAMETERS_FAILURE
+    {"GROUP2PKPARAMETERS_FAILURE", ERR_LIB_EC, EC_R_GROUP2PKPARAMETERS_FAILURE},
+  #else
+    {"GROUP2PKPARAMETERS_FAILURE", 16, 120},
+  #endif
+  #ifdef EC_R_I2D_ECPKPARAMETERS_FAILURE
+    {"I2D_ECPKPARAMETERS_FAILURE", ERR_LIB_EC, EC_R_I2D_ECPKPARAMETERS_FAILURE},
+  #else
+    {"I2D_ECPKPARAMETERS_FAILURE", 16, 121},
+  #endif
+  #ifdef EC_R_INCOMPATIBLE_OBJECTS
+    {"INCOMPATIBLE_OBJECTS", ERR_LIB_EC, EC_R_INCOMPATIBLE_OBJECTS},
+  #else
+    {"INCOMPATIBLE_OBJECTS", 16, 101},
+  #endif
+  #ifdef EC_R_INVALID_A
+    {"INVALID_A", ERR_LIB_EC, EC_R_INVALID_A},
+  #else
+    {"INVALID_A", 16, 168},
+  #endif
+  #ifdef EC_R_INVALID_ARGUMENT
+    {"INVALID_ARGUMENT", ERR_LIB_EC, EC_R_INVALID_ARGUMENT},
+  #else
+    {"INVALID_ARGUMENT", 16, 112},
+  #endif
+  #ifdef EC_R_INVALID_B
+    {"INVALID_B", ERR_LIB_EC, EC_R_INVALID_B},
+  #else
+    {"INVALID_B", 16, 169},
+  #endif
+  #ifdef EC_R_INVALID_COFACTOR
+    {"INVALID_COFACTOR", ERR_LIB_EC, EC_R_INVALID_COFACTOR},
+  #else
+    {"INVALID_COFACTOR", 16, 171},
+  #endif
+  #ifdef EC_R_INVALID_COMPRESSED_POINT
+    {"INVALID_COMPRESSED_POINT", ERR_LIB_EC, EC_R_INVALID_COMPRESSED_POINT},
+  #else
+    {"INVALID_COMPRESSED_POINT", 16, 110},
+  #endif
+  #ifdef EC_R_INVALID_COMPRESSION_BIT
+    {"INVALID_COMPRESSION_BIT", ERR_LIB_EC, EC_R_INVALID_COMPRESSION_BIT},
+  #else
+    {"INVALID_COMPRESSION_BIT", 16, 109},
+  #endif
+  #ifdef EC_R_INVALID_CURVE
+    {"INVALID_CURVE", ERR_LIB_EC, EC_R_INVALID_CURVE},
+  #else
+    {"INVALID_CURVE", 16, 141},
+  #endif
+  #ifdef EC_R_INVALID_DIGEST
+    {"INVALID_DIGEST", ERR_LIB_EC, EC_R_INVALID_DIGEST},
+  #else
+    {"INVALID_DIGEST", 16, 151},
+  #endif
+  #ifdef EC_R_INVALID_DIGEST_TYPE
+    {"INVALID_DIGEST_TYPE", ERR_LIB_EC, EC_R_INVALID_DIGEST_TYPE},
+  #else
+    {"INVALID_DIGEST_TYPE", 16, 138},
+  #endif
+  #ifdef EC_R_INVALID_ENCODING
+    {"INVALID_ENCODING", ERR_LIB_EC, EC_R_INVALID_ENCODING},
+  #else
+    {"INVALID_ENCODING", 16, 102},
+  #endif
+  #ifdef EC_R_INVALID_FIELD
+    {"INVALID_FIELD", ERR_LIB_EC, EC_R_INVALID_FIELD},
+  #else
+    {"INVALID_FIELD", 16, 103},
+  #endif
+  #ifdef EC_R_INVALID_FORM
+    {"INVALID_FORM", ERR_LIB_EC, EC_R_INVALID_FORM},
+  #else
+    {"INVALID_FORM", 16, 104},
+  #endif
+  #ifdef EC_R_INVALID_GENERATOR
+    {"INVALID_GENERATOR", ERR_LIB_EC, EC_R_INVALID_GENERATOR},
+  #else
+    {"INVALID_GENERATOR", 16, 173},
+  #endif
+  #ifdef EC_R_INVALID_GROUP_ORDER
+    {"INVALID_GROUP_ORDER", ERR_LIB_EC, EC_R_INVALID_GROUP_ORDER},
+  #else
+    {"INVALID_GROUP_ORDER", 16, 122},
+  #endif
+  #ifdef EC_R_INVALID_KEY
+    {"INVALID_KEY", ERR_LIB_EC, EC_R_INVALID_KEY},
+  #else
+    {"INVALID_KEY", 16, 116},
+  #endif
+  #ifdef EC_R_INVALID_NAMED_GROUP_CONVERSION
+    {"INVALID_NAMED_GROUP_CONVERSION", ERR_LIB_EC, EC_R_INVALID_NAMED_GROUP_CONVERSION},
+  #else
+    {"INVALID_NAMED_GROUP_CONVERSION", 16, 174},
+  #endif
+  #ifdef EC_R_INVALID_OUTPUT_LENGTH
+    {"INVALID_OUTPUT_LENGTH", ERR_LIB_EC, EC_R_INVALID_OUTPUT_LENGTH},
+  #else
+    {"INVALID_OUTPUT_LENGTH", 16, 161},
+  #endif
+  #ifdef EC_R_INVALID_P
+    {"INVALID_P", ERR_LIB_EC, EC_R_INVALID_P},
+  #else
+    {"INVALID_P", 16, 172},
+  #endif
+  #ifdef EC_R_INVALID_PEER_KEY
+    {"INVALID_PEER_KEY", ERR_LIB_EC, EC_R_INVALID_PEER_KEY},
+  #else
+    {"INVALID_PEER_KEY", 16, 133},
+  #endif
+  #ifdef EC_R_INVALID_PENTANOMIAL_BASIS
+    {"INVALID_PENTANOMIAL_BASIS", ERR_LIB_EC, EC_R_INVALID_PENTANOMIAL_BASIS},
+  #else
+    {"INVALID_PENTANOMIAL_BASIS", 16, 132},
+  #endif
+  #ifdef EC_R_INVALID_PRIVATE_KEY
+    {"INVALID_PRIVATE_KEY", ERR_LIB_EC, EC_R_INVALID_PRIVATE_KEY},
+  #else
+    {"INVALID_PRIVATE_KEY", 16, 123},
+  #endif
+  #ifdef EC_R_INVALID_SEED
+    {"INVALID_SEED", ERR_LIB_EC, EC_R_INVALID_SEED},
+  #else
+    {"INVALID_SEED", 16, 175},
+  #endif
+  #ifdef EC_R_INVALID_TRINOMIAL_BASIS
+    {"INVALID_TRINOMIAL_BASIS", ERR_LIB_EC, EC_R_INVALID_TRINOMIAL_BASIS},
+  #else
+    {"INVALID_TRINOMIAL_BASIS", 16, 137},
+  #endif
+  #ifdef EC_R_KDF_PARAMETER_ERROR
+    {"KDF_PARAMETER_ERROR", ERR_LIB_EC, EC_R_KDF_PARAMETER_ERROR},
+  #else
+    {"KDF_PARAMETER_ERROR", 16, 148},
+  #endif
+  #ifdef EC_R_KEYS_NOT_SET
+    {"KEYS_NOT_SET", ERR_LIB_EC, EC_R_KEYS_NOT_SET},
+  #else
+    {"KEYS_NOT_SET", 16, 140},
+  #endif
+  #ifdef EC_R_LADDER_POST_FAILURE
+    {"LADDER_POST_FAILURE", ERR_LIB_EC, EC_R_LADDER_POST_FAILURE},
+  #else
+    {"LADDER_POST_FAILURE", 16, 136},
+  #endif
+  #ifdef EC_R_LADDER_PRE_FAILURE
+    {"LADDER_PRE_FAILURE", ERR_LIB_EC, EC_R_LADDER_PRE_FAILURE},
+  #else
+    {"LADDER_PRE_FAILURE", 16, 153},
+  #endif
+  #ifdef EC_R_LADDER_STEP_FAILURE
+    {"LADDER_STEP_FAILURE", ERR_LIB_EC, EC_R_LADDER_STEP_FAILURE},
+  #else
+    {"LADDER_STEP_FAILURE", 16, 162},
+  #endif
+  #ifdef EC_R_MISSING_OID
+    {"MISSING_OID", ERR_LIB_EC, EC_R_MISSING_OID},
+  #else
+    {"MISSING_OID", 16, 167},
+  #endif
+  #ifdef EC_R_MISSING_PARAMETERS
+    {"MISSING_PARAMETERS", ERR_LIB_EC, EC_R_MISSING_PARAMETERS},
+  #else
+    {"MISSING_PARAMETERS", 16, 124},
+  #endif
+  #ifdef EC_R_MISSING_PRIVATE_KEY
+    {"MISSING_PRIVATE_KEY", ERR_LIB_EC, EC_R_MISSING_PRIVATE_KEY},
+  #else
+    {"MISSING_PRIVATE_KEY", 16, 125},
+  #endif
+  #ifdef EC_R_NEED_NEW_SETUP_VALUES
+    {"NEED_NEW_SETUP_VALUES", ERR_LIB_EC, EC_R_NEED_NEW_SETUP_VALUES},
+  #else
+    {"NEED_NEW_SETUP_VALUES", 16, 157},
+  #endif
+  #ifdef EC_R_NOT_A_NIST_PRIME
+    {"NOT_A_NIST_PRIME", ERR_LIB_EC, EC_R_NOT_A_NIST_PRIME},
+  #else
+    {"NOT_A_NIST_PRIME", 16, 135},
+  #endif
+  #ifdef EC_R_NOT_IMPLEMENTED
+    {"NOT_IMPLEMENTED", ERR_LIB_EC, EC_R_NOT_IMPLEMENTED},
+  #else
+    {"NOT_IMPLEMENTED", 16, 126},
+  #endif
+  #ifdef EC_R_NOT_INITIALIZED
+    {"NOT_INITIALIZED", ERR_LIB_EC, EC_R_NOT_INITIALIZED},
+  #else
+    {"NOT_INITIALIZED", 16, 111},
+  #endif
+  #ifdef EC_R_NO_PARAMETERS_SET
+    {"NO_PARAMETERS_SET", ERR_LIB_EC, EC_R_NO_PARAMETERS_SET},
+  #else
+    {"NO_PARAMETERS_SET", 16, 139},
+  #endif
+  #ifdef EC_R_NO_PRIVATE_VALUE
+    {"NO_PRIVATE_VALUE", ERR_LIB_EC, EC_R_NO_PRIVATE_VALUE},
+  #else
+    {"NO_PRIVATE_VALUE", 16, 154},
+  #endif
+  #ifdef EC_R_OPERATION_NOT_SUPPORTED
+    {"OPERATION_NOT_SUPPORTED", ERR_LIB_EC, EC_R_OPERATION_NOT_SUPPORTED},
+  #else
+    {"OPERATION_NOT_SUPPORTED", 16, 152},
+  #endif
+  #ifdef EC_R_PASSED_NULL_PARAMETER
+    {"PASSED_NULL_PARAMETER", ERR_LIB_EC, EC_R_PASSED_NULL_PARAMETER},
+  #else
+    {"PASSED_NULL_PARAMETER", 16, 134},
+  #endif
+  #ifdef EC_R_PEER_KEY_ERROR
+    {"PEER_KEY_ERROR", ERR_LIB_EC, EC_R_PEER_KEY_ERROR},
+  #else
+    {"PEER_KEY_ERROR", 16, 149},
+  #endif
+  #ifdef EC_R_POINT_ARITHMETIC_FAILURE
+    {"POINT_ARITHMETIC_FAILURE", ERR_LIB_EC, EC_R_POINT_ARITHMETIC_FAILURE},
+  #else
+    {"POINT_ARITHMETIC_FAILURE", 16, 155},
+  #endif
+  #ifdef EC_R_POINT_AT_INFINITY
+    {"POINT_AT_INFINITY", ERR_LIB_EC, EC_R_POINT_AT_INFINITY},
+  #else
+    {"POINT_AT_INFINITY", 16, 106},
+  #endif
+  #ifdef EC_R_POINT_COORDINATES_BLIND_FAILURE
+    {"POINT_COORDINATES_BLIND_FAILURE", ERR_LIB_EC, EC_R_POINT_COORDINATES_BLIND_FAILURE},
+  #else
+    {"POINT_COORDINATES_BLIND_FAILURE", 16, 163},
+  #endif
+  #ifdef EC_R_POINT_IS_NOT_ON_CURVE
+    {"POINT_IS_NOT_ON_CURVE", ERR_LIB_EC, EC_R_POINT_IS_NOT_ON_CURVE},
+  #else
+    {"POINT_IS_NOT_ON_CURVE", 16, 107},
+  #endif
+  #ifdef EC_R_RANDOM_NUMBER_GENERATION_FAILED
+    {"RANDOM_NUMBER_GENERATION_FAILED", ERR_LIB_EC, EC_R_RANDOM_NUMBER_GENERATION_FAILED},
+  #else
+    {"RANDOM_NUMBER_GENERATION_FAILED", 16, 158},
+  #endif
+  #ifdef EC_R_SHARED_INFO_ERROR
+    {"SHARED_INFO_ERROR", ERR_LIB_EC, EC_R_SHARED_INFO_ERROR},
+  #else
+    {"SHARED_INFO_ERROR", 16, 150},
+  #endif
+  #ifdef EC_R_SLOT_FULL
+    {"SLOT_FULL", ERR_LIB_EC, EC_R_SLOT_FULL},
+  #else
+    {"SLOT_FULL", 16, 108},
+  #endif
+  #ifdef EC_R_UNDEFINED_GENERATOR
+    {"UNDEFINED_GENERATOR", ERR_LIB_EC, EC_R_UNDEFINED_GENERATOR},
+  #else
+    {"UNDEFINED_GENERATOR", 16, 113},
+  #endif
+  #ifdef EC_R_UNDEFINED_ORDER
+    {"UNDEFINED_ORDER", ERR_LIB_EC, EC_R_UNDEFINED_ORDER},
+  #else
+    {"UNDEFINED_ORDER", 16, 128},
+  #endif
+  #ifdef EC_R_UNKNOWN_COFACTOR
+    {"UNKNOWN_COFACTOR", ERR_LIB_EC, EC_R_UNKNOWN_COFACTOR},
+  #else
+    {"UNKNOWN_COFACTOR", 16, 164},
+  #endif
+  #ifdef EC_R_UNKNOWN_GROUP
+    {"UNKNOWN_GROUP", ERR_LIB_EC, EC_R_UNKNOWN_GROUP},
+  #else
+    {"UNKNOWN_GROUP", 16, 129},
+  #endif
+  #ifdef EC_R_UNKNOWN_ORDER
+    {"UNKNOWN_ORDER", ERR_LIB_EC, EC_R_UNKNOWN_ORDER},
+  #else
+    {"UNKNOWN_ORDER", 16, 114},
+  #endif
+  #ifdef EC_R_UNSUPPORTED_FIELD
+    {"UNSUPPORTED_FIELD", ERR_LIB_EC, EC_R_UNSUPPORTED_FIELD},
+  #else
+    {"UNSUPPORTED_FIELD", 16, 131},
+  #endif
+  #ifdef EC_R_WRONG_CURVE_PARAMETERS
+    {"WRONG_CURVE_PARAMETERS", ERR_LIB_EC, EC_R_WRONG_CURVE_PARAMETERS},
+  #else
+    {"WRONG_CURVE_PARAMETERS", 16, 145},
+  #endif
+  #ifdef EC_R_WRONG_ORDER
+    {"WRONG_ORDER", ERR_LIB_EC, EC_R_WRONG_ORDER},
+  #else
+    {"WRONG_ORDER", 16, 130},
+  #endif
+  #ifdef ENGINE_R_ALREADY_LOADED
+    {"ALREADY_LOADED", ERR_LIB_ENGINE, ENGINE_R_ALREADY_LOADED},
+  #else
+    {"ALREADY_LOADED", 38, 100},
+  #endif
+  #ifdef ENGINE_R_ARGUMENT_IS_NOT_A_NUMBER
+    {"ARGUMENT_IS_NOT_A_NUMBER", ERR_LIB_ENGINE, ENGINE_R_ARGUMENT_IS_NOT_A_NUMBER},
+  #else
+    {"ARGUMENT_IS_NOT_A_NUMBER", 38, 133},
+  #endif
+  #ifdef ENGINE_R_CMD_NOT_EXECUTABLE
+    {"CMD_NOT_EXECUTABLE", ERR_LIB_ENGINE, ENGINE_R_CMD_NOT_EXECUTABLE},
+  #else
+    {"CMD_NOT_EXECUTABLE", 38, 134},
+  #endif
+  #ifdef ENGINE_R_COMMAND_TAKES_INPUT
+    {"COMMAND_TAKES_INPUT", ERR_LIB_ENGINE, ENGINE_R_COMMAND_TAKES_INPUT},
+  #else
+    {"COMMAND_TAKES_INPUT", 38, 135},
+  #endif
+  #ifdef ENGINE_R_COMMAND_TAKES_NO_INPUT
+    {"COMMAND_TAKES_NO_INPUT", ERR_LIB_ENGINE, ENGINE_R_COMMAND_TAKES_NO_INPUT},
+  #else
+    {"COMMAND_TAKES_NO_INPUT", 38, 136},
+  #endif
+  #ifdef ENGINE_R_CONFLICTING_ENGINE_ID
+    {"CONFLICTING_ENGINE_ID", ERR_LIB_ENGINE, ENGINE_R_CONFLICTING_ENGINE_ID},
+  #else
+    {"CONFLICTING_ENGINE_ID", 38, 103},
+  #endif
+  #ifdef ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED
+    {"CTRL_COMMAND_NOT_IMPLEMENTED", ERR_LIB_ENGINE, ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED},
+  #else
+    {"CTRL_COMMAND_NOT_IMPLEMENTED", 38, 119},
+  #endif
+  #ifdef ENGINE_R_DSO_FAILURE
+    {"DSO_FAILURE", ERR_LIB_ENGINE, ENGINE_R_DSO_FAILURE},
+  #else
+    {"DSO_FAILURE", 38, 104},
+  #endif
+  #ifdef ENGINE_R_DSO_NOT_FOUND
+    {"DSO_NOT_FOUND", ERR_LIB_ENGINE, ENGINE_R_DSO_NOT_FOUND},
+  #else
+    {"DSO_NOT_FOUND", 38, 132},
+  #endif
+  #ifdef ENGINE_R_ENGINES_SECTION_ERROR
+    {"ENGINES_SECTION_ERROR", ERR_LIB_ENGINE, ENGINE_R_ENGINES_SECTION_ERROR},
+  #else
+    {"ENGINES_SECTION_ERROR", 38, 148},
+  #endif
+  #ifdef ENGINE_R_ENGINE_CONFIGURATION_ERROR
+    {"ENGINE_CONFIGURATION_ERROR", ERR_LIB_ENGINE, ENGINE_R_ENGINE_CONFIGURATION_ERROR},
+  #else
+    {"ENGINE_CONFIGURATION_ERROR", 38, 102},
+  #endif
+  #ifdef ENGINE_R_ENGINE_IS_NOT_IN_LIST
+    {"ENGINE_IS_NOT_IN_LIST", ERR_LIB_ENGINE, ENGINE_R_ENGINE_IS_NOT_IN_LIST},
+  #else
+    {"ENGINE_IS_NOT_IN_LIST", 38, 105},
+  #endif
+  #ifdef ENGINE_R_ENGINE_SECTION_ERROR
+    {"ENGINE_SECTION_ERROR", ERR_LIB_ENGINE, ENGINE_R_ENGINE_SECTION_ERROR},
+  #else
+    {"ENGINE_SECTION_ERROR", 38, 149},
+  #endif
+  #ifdef ENGINE_R_FAILED_LOADING_PRIVATE_KEY
+    {"FAILED_LOADING_PRIVATE_KEY", ERR_LIB_ENGINE, ENGINE_R_FAILED_LOADING_PRIVATE_KEY},
+  #else
+    {"FAILED_LOADING_PRIVATE_KEY", 38, 128},
+  #endif
+  #ifdef ENGINE_R_FAILED_LOADING_PUBLIC_KEY
+    {"FAILED_LOADING_PUBLIC_KEY", ERR_LIB_ENGINE, ENGINE_R_FAILED_LOADING_PUBLIC_KEY},
+  #else
+    {"FAILED_LOADING_PUBLIC_KEY", 38, 129},
+  #endif
+  #ifdef ENGINE_R_FINISH_FAILED
+    {"FINISH_FAILED", ERR_LIB_ENGINE, ENGINE_R_FINISH_FAILED},
+  #else
+    {"FINISH_FAILED", 38, 106},
+  #endif
+  #ifdef ENGINE_R_ID_OR_NAME_MISSING
+    {"ID_OR_NAME_MISSING", ERR_LIB_ENGINE, ENGINE_R_ID_OR_NAME_MISSING},
+  #else
+    {"ID_OR_NAME_MISSING", 38, 108},
+  #endif
+  #ifdef ENGINE_R_INIT_FAILED
+    {"INIT_FAILED", ERR_LIB_ENGINE, ENGINE_R_INIT_FAILED},
+  #else
+    {"INIT_FAILED", 38, 109},
+  #endif
+  #ifdef ENGINE_R_INTERNAL_LIST_ERROR
+    {"INTERNAL_LIST_ERROR", ERR_LIB_ENGINE, ENGINE_R_INTERNAL_LIST_ERROR},
+  #else
+    {"INTERNAL_LIST_ERROR", 38, 110},
+  #endif
+  #ifdef ENGINE_R_INVALID_ARGUMENT
+    {"INVALID_ARGUMENT", ERR_LIB_ENGINE, ENGINE_R_INVALID_ARGUMENT},
+  #else
+    {"INVALID_ARGUMENT", 38, 143},
+  #endif
+  #ifdef ENGINE_R_INVALID_CMD_NAME
+    {"INVALID_CMD_NAME", ERR_LIB_ENGINE, ENGINE_R_INVALID_CMD_NAME},
+  #else
+    {"INVALID_CMD_NAME", 38, 137},
+  #endif
+  #ifdef ENGINE_R_INVALID_CMD_NUMBER
+    {"INVALID_CMD_NUMBER", ERR_LIB_ENGINE, ENGINE_R_INVALID_CMD_NUMBER},
+  #else
+    {"INVALID_CMD_NUMBER", 38, 138},
+  #endif
+  #ifdef ENGINE_R_INVALID_INIT_VALUE
+    {"INVALID_INIT_VALUE", ERR_LIB_ENGINE, ENGINE_R_INVALID_INIT_VALUE},
+  #else
+    {"INVALID_INIT_VALUE", 38, 151},
+  #endif
+  #ifdef ENGINE_R_INVALID_STRING
+    {"INVALID_STRING", ERR_LIB_ENGINE, ENGINE_R_INVALID_STRING},
+  #else
+    {"INVALID_STRING", 38, 150},
+  #endif
+  #ifdef ENGINE_R_NOT_INITIALISED
+    {"NOT_INITIALISED", ERR_LIB_ENGINE, ENGINE_R_NOT_INITIALISED},
+  #else
+    {"NOT_INITIALISED", 38, 117},
+  #endif
+  #ifdef ENGINE_R_NOT_LOADED
+    {"NOT_LOADED", ERR_LIB_ENGINE, ENGINE_R_NOT_LOADED},
+  #else
+    {"NOT_LOADED", 38, 112},
+  #endif
+  #ifdef ENGINE_R_NO_CONTROL_FUNCTION
+    {"NO_CONTROL_FUNCTION", ERR_LIB_ENGINE, ENGINE_R_NO_CONTROL_FUNCTION},
+  #else
+    {"NO_CONTROL_FUNCTION", 38, 120},
+  #endif
+  #ifdef ENGINE_R_NO_INDEX
+    {"NO_INDEX", ERR_LIB_ENGINE, ENGINE_R_NO_INDEX},
+  #else
+    {"NO_INDEX", 38, 144},
+  #endif
+  #ifdef ENGINE_R_NO_LOAD_FUNCTION
+    {"NO_LOAD_FUNCTION", ERR_LIB_ENGINE, ENGINE_R_NO_LOAD_FUNCTION},
+  #else
+    {"NO_LOAD_FUNCTION", 38, 125},
+  #endif
+  #ifdef ENGINE_R_NO_REFERENCE
+    {"NO_REFERENCE", ERR_LIB_ENGINE, ENGINE_R_NO_REFERENCE},
+  #else
+    {"NO_REFERENCE", 38, 130},
+  #endif
+  #ifdef ENGINE_R_NO_SUCH_ENGINE
+    {"NO_SUCH_ENGINE", ERR_LIB_ENGINE, ENGINE_R_NO_SUCH_ENGINE},
+  #else
+    {"NO_SUCH_ENGINE", 38, 116},
+  #endif
+  #ifdef ENGINE_R_UNIMPLEMENTED_CIPHER
+    {"UNIMPLEMENTED_CIPHER", ERR_LIB_ENGINE, ENGINE_R_UNIMPLEMENTED_CIPHER},
+  #else
+    {"UNIMPLEMENTED_CIPHER", 38, 146},
+  #endif
+  #ifdef ENGINE_R_UNIMPLEMENTED_DIGEST
+    {"UNIMPLEMENTED_DIGEST", ERR_LIB_ENGINE, ENGINE_R_UNIMPLEMENTED_DIGEST},
+  #else
+    {"UNIMPLEMENTED_DIGEST", 38, 147},
+  #endif
+  #ifdef ENGINE_R_UNIMPLEMENTED_PUBLIC_KEY_METHOD
+    {"UNIMPLEMENTED_PUBLIC_KEY_METHOD", ERR_LIB_ENGINE, ENGINE_R_UNIMPLEMENTED_PUBLIC_KEY_METHOD},
+  #else
+    {"UNIMPLEMENTED_PUBLIC_KEY_METHOD", 38, 101},
+  #endif
+  #ifdef ENGINE_R_VERSION_INCOMPATIBILITY
+    {"VERSION_INCOMPATIBILITY", ERR_LIB_ENGINE, ENGINE_R_VERSION_INCOMPATIBILITY},
+  #else
+    {"VERSION_INCOMPATIBILITY", 38, 145},
+  #endif
+  #ifdef ESS_R_EMPTY_ESS_CERT_ID_LIST
+    {"EMPTY_ESS_CERT_ID_LIST", ERR_LIB_ESS, ESS_R_EMPTY_ESS_CERT_ID_LIST},
+  #else
+    {"EMPTY_ESS_CERT_ID_LIST", 54, 107},
+  #endif
+  #ifdef ESS_R_ESS_CERT_DIGEST_ERROR
+    {"ESS_CERT_DIGEST_ERROR", ERR_LIB_ESS, ESS_R_ESS_CERT_DIGEST_ERROR},
+  #else
+    {"ESS_CERT_DIGEST_ERROR", 54, 103},
+  #endif
+  #ifdef ESS_R_ESS_CERT_ID_NOT_FOUND
+    {"ESS_CERT_ID_NOT_FOUND", ERR_LIB_ESS, ESS_R_ESS_CERT_ID_NOT_FOUND},
+  #else
+    {"ESS_CERT_ID_NOT_FOUND", 54, 104},
+  #endif
+  #ifdef ESS_R_ESS_CERT_ID_WRONG_ORDER
+    {"ESS_CERT_ID_WRONG_ORDER", ERR_LIB_ESS, ESS_R_ESS_CERT_ID_WRONG_ORDER},
+  #else
+    {"ESS_CERT_ID_WRONG_ORDER", 54, 105},
+  #endif
+  #ifdef ESS_R_ESS_DIGEST_ALG_UNKNOWN
+    {"ESS_DIGEST_ALG_UNKNOWN", ERR_LIB_ESS, ESS_R_ESS_DIGEST_ALG_UNKNOWN},
+  #else
+    {"ESS_DIGEST_ALG_UNKNOWN", 54, 106},
+  #endif
+  #ifdef ESS_R_ESS_SIGNING_CERTIFICATE_ERROR
+    {"ESS_SIGNING_CERTIFICATE_ERROR", ERR_LIB_ESS, ESS_R_ESS_SIGNING_CERTIFICATE_ERROR},
+  #else
+    {"ESS_SIGNING_CERTIFICATE_ERROR", 54, 102},
+  #endif
+  #ifdef ESS_R_ESS_SIGNING_CERT_ADD_ERROR
+    {"ESS_SIGNING_CERT_ADD_ERROR", ERR_LIB_ESS, ESS_R_ESS_SIGNING_CERT_ADD_ERROR},
+  #else
+    {"ESS_SIGNING_CERT_ADD_ERROR", 54, 100},
+  #endif
+  #ifdef ESS_R_ESS_SIGNING_CERT_V2_ADD_ERROR
+    {"ESS_SIGNING_CERT_V2_ADD_ERROR", ERR_LIB_ESS, ESS_R_ESS_SIGNING_CERT_V2_ADD_ERROR},
+  #else
+    {"ESS_SIGNING_CERT_V2_ADD_ERROR", 54, 101},
+  #endif
+  #ifdef ESS_R_MISSING_SIGNING_CERTIFICATE_ATTRIBUTE
+    {"MISSING_SIGNING_CERTIFICATE_ATTRIBUTE", ERR_LIB_ESS, ESS_R_MISSING_SIGNING_CERTIFICATE_ATTRIBUTE},
+  #else
+    {"MISSING_SIGNING_CERTIFICATE_ATTRIBUTE", 54, 108},
+  #endif
+  #ifdef EVP_R_AES_KEY_SETUP_FAILED
+    {"AES_KEY_SETUP_FAILED", ERR_LIB_EVP, EVP_R_AES_KEY_SETUP_FAILED},
+  #else
+    {"AES_KEY_SETUP_FAILED", 6, 143},
+  #endif
+  #ifdef EVP_R_ARIA_KEY_SETUP_FAILED
+    {"ARIA_KEY_SETUP_FAILED", ERR_LIB_EVP, EVP_R_ARIA_KEY_SETUP_FAILED},
+  #else
+    {"ARIA_KEY_SETUP_FAILED", 6, 176},
+  #endif
+  #ifdef EVP_R_BAD_ALGORITHM_NAME
+    {"BAD_ALGORITHM_NAME", ERR_LIB_EVP, EVP_R_BAD_ALGORITHM_NAME},
+  #else
+    {"BAD_ALGORITHM_NAME", 6, 200},
+  #endif
+  #ifdef EVP_R_BAD_DECRYPT
+    {"BAD_DECRYPT", ERR_LIB_EVP, EVP_R_BAD_DECRYPT},
+  #else
+    {"BAD_DECRYPT", 6, 100},
+  #endif
+  #ifdef EVP_R_BAD_KEY_LENGTH
+    {"BAD_KEY_LENGTH", ERR_LIB_EVP, EVP_R_BAD_KEY_LENGTH},
+  #else
+    {"BAD_KEY_LENGTH", 6, 195},
+  #endif
+  #ifdef EVP_R_BUFFER_TOO_SMALL
+    {"BUFFER_TOO_SMALL", ERR_LIB_EVP, EVP_R_BUFFER_TOO_SMALL},
+  #else
+    {"BUFFER_TOO_SMALL", 6, 155},
+  #endif
+  #ifdef EVP_R_CACHE_CONSTANTS_FAILED
+    {"CACHE_CONSTANTS_FAILED", ERR_LIB_EVP, EVP_R_CACHE_CONSTANTS_FAILED},
+  #else
+    {"CACHE_CONSTANTS_FAILED", 6, 225},
+  #endif
+  #ifdef EVP_R_CAMELLIA_KEY_SETUP_FAILED
+    {"CAMELLIA_KEY_SETUP_FAILED", ERR_LIB_EVP, EVP_R_CAMELLIA_KEY_SETUP_FAILED},
+  #else
+    {"CAMELLIA_KEY_SETUP_FAILED", 6, 157},
+  #endif
+  #ifdef EVP_R_CANNOT_GET_PARAMETERS
+    {"CANNOT_GET_PARAMETERS", ERR_LIB_EVP, EVP_R_CANNOT_GET_PARAMETERS},
+  #else
+    {"CANNOT_GET_PARAMETERS", 6, 197},
+  #endif
+  #ifdef EVP_R_CANNOT_SET_PARAMETERS
+    {"CANNOT_SET_PARAMETERS", ERR_LIB_EVP, EVP_R_CANNOT_SET_PARAMETERS},
+  #else
+    {"CANNOT_SET_PARAMETERS", 6, 198},
+  #endif
+  #ifdef EVP_R_CIPHER_NOT_GCM_MODE
+    {"CIPHER_NOT_GCM_MODE", ERR_LIB_EVP, EVP_R_CIPHER_NOT_GCM_MODE},
+  #else
+    {"CIPHER_NOT_GCM_MODE", 6, 184},
+  #endif
+  #ifdef EVP_R_CIPHER_PARAMETER_ERROR
+    {"CIPHER_PARAMETER_ERROR", ERR_LIB_EVP, EVP_R_CIPHER_PARAMETER_ERROR},
+  #else
+    {"CIPHER_PARAMETER_ERROR", 6, 122},
+  #endif
+  #ifdef EVP_R_COMMAND_NOT_SUPPORTED
+    {"COMMAND_NOT_SUPPORTED", ERR_LIB_EVP, EVP_R_COMMAND_NOT_SUPPORTED},
+  #else
+    {"COMMAND_NOT_SUPPORTED", 6, 147},
+  #endif
+  #ifdef EVP_R_CONFLICTING_ALGORITHM_NAME
+    {"CONFLICTING_ALGORITHM_NAME", ERR_LIB_EVP, EVP_R_CONFLICTING_ALGORITHM_NAME},
+  #else
+    {"CONFLICTING_ALGORITHM_NAME", 6, 201},
+  #endif
+  #ifdef EVP_R_COPY_ERROR
+    {"COPY_ERROR", ERR_LIB_EVP, EVP_R_COPY_ERROR},
+  #else
+    {"COPY_ERROR", 6, 173},
+  #endif
+  #ifdef EVP_R_CTRL_NOT_IMPLEMENTED
+    {"CTRL_NOT_IMPLEMENTED", ERR_LIB_EVP, EVP_R_CTRL_NOT_IMPLEMENTED},
+  #else
+    {"CTRL_NOT_IMPLEMENTED", 6, 132},
+  #endif
+  #ifdef EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED
+    {"CTRL_OPERATION_NOT_IMPLEMENTED", ERR_LIB_EVP, EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED},
+  #else
+    {"CTRL_OPERATION_NOT_IMPLEMENTED", 6, 133},
+  #endif
+  #ifdef EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH
+    {"DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH", ERR_LIB_EVP, EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH},
+  #else
+    {"DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH", 6, 138},
+  #endif
+  #ifdef EVP_R_DECODE_ERROR
+    {"DECODE_ERROR", ERR_LIB_EVP, EVP_R_DECODE_ERROR},
+  #else
+    {"DECODE_ERROR", 6, 114},
+  #endif
+  #ifdef EVP_R_DEFAULT_QUERY_PARSE_ERROR
+    {"DEFAULT_QUERY_PARSE_ERROR", ERR_LIB_EVP, EVP_R_DEFAULT_QUERY_PARSE_ERROR},
+  #else
+    {"DEFAULT_QUERY_PARSE_ERROR", 6, 210},
+  #endif
+  #ifdef EVP_R_DIFFERENT_KEY_TYPES
+    {"DIFFERENT_KEY_TYPES", ERR_LIB_EVP, EVP_R_DIFFERENT_KEY_TYPES},
+  #else
+    {"DIFFERENT_KEY_TYPES", 6, 101},
+  #endif
+  #ifdef EVP_R_DIFFERENT_PARAMETERS
+    {"DIFFERENT_PARAMETERS", ERR_LIB_EVP, EVP_R_DIFFERENT_PARAMETERS},
+  #else
+    {"DIFFERENT_PARAMETERS", 6, 153},
+  #endif
+  #ifdef EVP_R_ERROR_LOADING_SECTION
+    {"ERROR_LOADING_SECTION", ERR_LIB_EVP, EVP_R_ERROR_LOADING_SECTION},
+  #else
+    {"ERROR_LOADING_SECTION", 6, 165},
+  #endif
+  #ifdef EVP_R_ERROR_SETTING_FIPS_MODE
+    {"ERROR_SETTING_FIPS_MODE", ERR_LIB_EVP, EVP_R_ERROR_SETTING_FIPS_MODE},
+  #else
+    {"ERROR_SETTING_FIPS_MODE", 6, 166},
+  #endif
+  #ifdef EVP_R_EXPECTING_AN_HMAC_KEY
+    {"EXPECTING_AN_HMAC_KEY", ERR_LIB_EVP, EVP_R_EXPECTING_AN_HMAC_KEY},
+  #else
+    {"EXPECTING_AN_HMAC_KEY", 6, 174},
+  #endif
+  #ifdef EVP_R_EXPECTING_AN_RSA_KEY
+    {"EXPECTING_AN_RSA_KEY", ERR_LIB_EVP, EVP_R_EXPECTING_AN_RSA_KEY},
+  #else
+    {"EXPECTING_AN_RSA_KEY", 6, 127},
+  #endif
+  #ifdef EVP_R_EXPECTING_A_DH_KEY
+    {"EXPECTING_A_DH_KEY", ERR_LIB_EVP, EVP_R_EXPECTING_A_DH_KEY},
+  #else
+    {"EXPECTING_A_DH_KEY", 6, 128},
+  #endif
+  #ifdef EVP_R_EXPECTING_A_DSA_KEY
+    {"EXPECTING_A_DSA_KEY", ERR_LIB_EVP, EVP_R_EXPECTING_A_DSA_KEY},
+  #else
+    {"EXPECTING_A_DSA_KEY", 6, 129},
+  #endif
+  #ifdef EVP_R_EXPECTING_A_ECX_KEY
+    {"EXPECTING_A_ECX_KEY", ERR_LIB_EVP, EVP_R_EXPECTING_A_ECX_KEY},
+  #else
+    {"EXPECTING_A_ECX_KEY", 6, 219},
+  #endif
+  #ifdef EVP_R_EXPECTING_A_EC_KEY
+    {"EXPECTING_A_EC_KEY", ERR_LIB_EVP, EVP_R_EXPECTING_A_EC_KEY},
+  #else
+    {"EXPECTING_A_EC_KEY", 6, 142},
+  #endif
+  #ifdef EVP_R_EXPECTING_A_POLY1305_KEY
+    {"EXPECTING_A_POLY1305_KEY", ERR_LIB_EVP, EVP_R_EXPECTING_A_POLY1305_KEY},
+  #else
+    {"EXPECTING_A_POLY1305_KEY", 6, 164},
+  #endif
+  #ifdef EVP_R_EXPECTING_A_SIPHASH_KEY
+    {"EXPECTING_A_SIPHASH_KEY", ERR_LIB_EVP, EVP_R_EXPECTING_A_SIPHASH_KEY},
+  #else
+    {"EXPECTING_A_SIPHASH_KEY", 6, 175},
+  #endif
+  #ifdef EVP_R_FINAL_ERROR
+    {"FINAL_ERROR", ERR_LIB_EVP, EVP_R_FINAL_ERROR},
+  #else
+    {"FINAL_ERROR", 6, 188},
+  #endif
+  #ifdef EVP_R_FIPS_MODE_NOT_SUPPORTED
+    {"FIPS_MODE_NOT_SUPPORTED", ERR_LIB_EVP, EVP_R_FIPS_MODE_NOT_SUPPORTED},
+  #else
+    {"FIPS_MODE_NOT_SUPPORTED", 6, 167},
+  #endif
+  #ifdef EVP_R_GENERATE_ERROR
+    {"GENERATE_ERROR", ERR_LIB_EVP, EVP_R_GENERATE_ERROR},
+  #else
+    {"GENERATE_ERROR", 6, 214},
+  #endif
+  #ifdef EVP_R_GET_RAW_KEY_FAILED
+    {"GET_RAW_KEY_FAILED", ERR_LIB_EVP, EVP_R_GET_RAW_KEY_FAILED},
+  #else
+    {"GET_RAW_KEY_FAILED", 6, 182},
+  #endif
+  #ifdef EVP_R_ILLEGAL_SCRYPT_PARAMETERS
+    {"ILLEGAL_SCRYPT_PARAMETERS", ERR_LIB_EVP, EVP_R_ILLEGAL_SCRYPT_PARAMETERS},
+  #else
+    {"ILLEGAL_SCRYPT_PARAMETERS", 6, 171},
+  #endif
+  #ifdef EVP_R_INACCESSIBLE_DOMAIN_PARAMETERS
+    {"INACCESSIBLE_DOMAIN_PARAMETERS", ERR_LIB_EVP, EVP_R_INACCESSIBLE_DOMAIN_PARAMETERS},
+  #else
+    {"INACCESSIBLE_DOMAIN_PARAMETERS", 6, 204},
+  #endif
+  #ifdef EVP_R_INACCESSIBLE_KEY
+    {"INACCESSIBLE_KEY", ERR_LIB_EVP, EVP_R_INACCESSIBLE_KEY},
+  #else
+    {"INACCESSIBLE_KEY", 6, 203},
+  #endif
+  #ifdef EVP_R_INITIALIZATION_ERROR
+    {"INITIALIZATION_ERROR", ERR_LIB_EVP, EVP_R_INITIALIZATION_ERROR},
+  #else
+    {"INITIALIZATION_ERROR", 6, 134},
+  #endif
+  #ifdef EVP_R_INPUT_NOT_INITIALIZED
+    {"INPUT_NOT_INITIALIZED", ERR_LIB_EVP, EVP_R_INPUT_NOT_INITIALIZED},
+  #else
+    {"INPUT_NOT_INITIALIZED", 6, 111},
+  #endif
+  #ifdef EVP_R_INVALID_CUSTOM_LENGTH
+    {"INVALID_CUSTOM_LENGTH", ERR_LIB_EVP, EVP_R_INVALID_CUSTOM_LENGTH},
+  #else
+    {"INVALID_CUSTOM_LENGTH", 6, 185},
+  #endif
+  #ifdef EVP_R_INVALID_DIGEST
+    {"INVALID_DIGEST", ERR_LIB_EVP, EVP_R_INVALID_DIGEST},
+  #else
+    {"INVALID_DIGEST", 6, 152},
+  #endif
+  #ifdef EVP_R_INVALID_FIPS_MODE
+    {"INVALID_FIPS_MODE", ERR_LIB_EVP, EVP_R_INVALID_FIPS_MODE},
+  #else
+    {"INVALID_FIPS_MODE", 6, 168},
+  #endif
+  #ifdef EVP_R_INVALID_IV_LENGTH
+    {"INVALID_IV_LENGTH", ERR_LIB_EVP, EVP_R_INVALID_IV_LENGTH},
+  #else
+    {"INVALID_IV_LENGTH", 6, 194},
+  #endif
+  #ifdef EVP_R_INVALID_KEY
+    {"INVALID_KEY", ERR_LIB_EVP, EVP_R_INVALID_KEY},
+  #else
+    {"INVALID_KEY", 6, 163},
+  #endif
+  #ifdef EVP_R_INVALID_KEY_LENGTH
+    {"INVALID_KEY_LENGTH", ERR_LIB_EVP, EVP_R_INVALID_KEY_LENGTH},
+  #else
+    {"INVALID_KEY_LENGTH", 6, 130},
+  #endif
+  #ifdef EVP_R_INVALID_LENGTH
+    {"INVALID_LENGTH", ERR_LIB_EVP, EVP_R_INVALID_LENGTH},
+  #else
+    {"INVALID_LENGTH", 6, 221},
+  #endif
+  #ifdef EVP_R_INVALID_NULL_ALGORITHM
+    {"INVALID_NULL_ALGORITHM", ERR_LIB_EVP, EVP_R_INVALID_NULL_ALGORITHM},
+  #else
+    {"INVALID_NULL_ALGORITHM", 6, 218},
+  #endif
+  #ifdef EVP_R_INVALID_OPERATION
+    {"INVALID_OPERATION", ERR_LIB_EVP, EVP_R_INVALID_OPERATION},
+  #else
+    {"INVALID_OPERATION", 6, 148},
+  #endif
+  #ifdef EVP_R_INVALID_PROVIDER_FUNCTIONS
+    {"INVALID_PROVIDER_FUNCTIONS", ERR_LIB_EVP, EVP_R_INVALID_PROVIDER_FUNCTIONS},
+  #else
+    {"INVALID_PROVIDER_FUNCTIONS", 6, 193},
+  #endif
+  #ifdef EVP_R_INVALID_SALT_LENGTH
+    {"INVALID_SALT_LENGTH", ERR_LIB_EVP, EVP_R_INVALID_SALT_LENGTH},
+  #else
+    {"INVALID_SALT_LENGTH", 6, 186},
+  #endif
+  #ifdef EVP_R_INVALID_SECRET_LENGTH
+    {"INVALID_SECRET_LENGTH", ERR_LIB_EVP, EVP_R_INVALID_SECRET_LENGTH},
+  #else
+    {"INVALID_SECRET_LENGTH", 6, 223},
+  #endif
+  #ifdef EVP_R_INVALID_SEED_LENGTH
+    {"INVALID_SEED_LENGTH", ERR_LIB_EVP, EVP_R_INVALID_SEED_LENGTH},
+  #else
+    {"INVALID_SEED_LENGTH", 6, 220},
+  #endif
+  #ifdef EVP_R_INVALID_VALUE
+    {"INVALID_VALUE", ERR_LIB_EVP, EVP_R_INVALID_VALUE},
+  #else
+    {"INVALID_VALUE", 6, 222},
+  #endif
+  #ifdef EVP_R_KEYMGMT_EXPORT_FAILURE
+    {"KEYMGMT_EXPORT_FAILURE", ERR_LIB_EVP, EVP_R_KEYMGMT_EXPORT_FAILURE},
+  #else
+    {"KEYMGMT_EXPORT_FAILURE", 6, 205},
+  #endif
+  #ifdef EVP_R_KEY_SETUP_FAILED
+    {"KEY_SETUP_FAILED", ERR_LIB_EVP, EVP_R_KEY_SETUP_FAILED},
+  #else
+    {"KEY_SETUP_FAILED", 6, 180},
+  #endif
+  #ifdef EVP_R_LOCKING_NOT_SUPPORTED
+    {"LOCKING_NOT_SUPPORTED", ERR_LIB_EVP, EVP_R_LOCKING_NOT_SUPPORTED},
+  #else
+    {"LOCKING_NOT_SUPPORTED", 6, 213},
+  #endif
+  #ifdef EVP_R_MEMORY_LIMIT_EXCEEDED
+    {"MEMORY_LIMIT_EXCEEDED", ERR_LIB_EVP, EVP_R_MEMORY_LIMIT_EXCEEDED},
+  #else
+    {"MEMORY_LIMIT_EXCEEDED", 6, 172},
+  #endif
+  #ifdef EVP_R_MESSAGE_DIGEST_IS_NULL
+    {"MESSAGE_DIGEST_IS_NULL", ERR_LIB_EVP, EVP_R_MESSAGE_DIGEST_IS_NULL},
+  #else
+    {"MESSAGE_DIGEST_IS_NULL", 6, 159},
+  #endif
+  #ifdef EVP_R_METHOD_NOT_SUPPORTED
+    {"METHOD_NOT_SUPPORTED", ERR_LIB_EVP, EVP_R_METHOD_NOT_SUPPORTED},
+  #else
+    {"METHOD_NOT_SUPPORTED", 6, 144},
+  #endif
+  #ifdef EVP_R_MISSING_PARAMETERS
+    {"MISSING_PARAMETERS", ERR_LIB_EVP, EVP_R_MISSING_PARAMETERS},
+  #else
+    {"MISSING_PARAMETERS", 6, 103},
+  #endif
+  #ifdef EVP_R_NOT_ABLE_TO_COPY_CTX
+    {"NOT_ABLE_TO_COPY_CTX", ERR_LIB_EVP, EVP_R_NOT_ABLE_TO_COPY_CTX},
+  #else
+    {"NOT_ABLE_TO_COPY_CTX", 6, 190},
+  #endif
+  #ifdef EVP_R_NOT_XOF_OR_INVALID_LENGTH
+    {"NOT_XOF_OR_INVALID_LENGTH", ERR_LIB_EVP, EVP_R_NOT_XOF_OR_INVALID_LENGTH},
+  #else
+    {"NOT_XOF_OR_INVALID_LENGTH", 6, 178},
+  #endif
+  #ifdef EVP_R_NO_CIPHER_SET
+    {"NO_CIPHER_SET", ERR_LIB_EVP, EVP_R_NO_CIPHER_SET},
+  #else
+    {"NO_CIPHER_SET", 6, 131},
+  #endif
+  #ifdef EVP_R_NO_DEFAULT_DIGEST
+    {"NO_DEFAULT_DIGEST", ERR_LIB_EVP, EVP_R_NO_DEFAULT_DIGEST},
+  #else
+    {"NO_DEFAULT_DIGEST", 6, 158},
+  #endif
+  #ifdef EVP_R_NO_DIGEST_SET
+    {"NO_DIGEST_SET", ERR_LIB_EVP, EVP_R_NO_DIGEST_SET},
+  #else
+    {"NO_DIGEST_SET", 6, 139},
+  #endif
+  #ifdef EVP_R_NO_IMPORT_FUNCTION
+    {"NO_IMPORT_FUNCTION", ERR_LIB_EVP, EVP_R_NO_IMPORT_FUNCTION},
+  #else
+    {"NO_IMPORT_FUNCTION", 6, 206},
+  #endif
+  #ifdef EVP_R_NO_KEYMGMT_AVAILABLE
+    {"NO_KEYMGMT_AVAILABLE", ERR_LIB_EVP, EVP_R_NO_KEYMGMT_AVAILABLE},
+  #else
+    {"NO_KEYMGMT_AVAILABLE", 6, 199},
+  #endif
+  #ifdef EVP_R_NO_KEYMGMT_PRESENT
+    {"NO_KEYMGMT_PRESENT", ERR_LIB_EVP, EVP_R_NO_KEYMGMT_PRESENT},
+  #else
+    {"NO_KEYMGMT_PRESENT", 6, 196},
+  #endif
+  #ifdef EVP_R_NO_KEY_SET
+    {"NO_KEY_SET", ERR_LIB_EVP, EVP_R_NO_KEY_SET},
+  #else
+    {"NO_KEY_SET", 6, 154},
+  #endif
+  #ifdef EVP_R_NO_OPERATION_SET
+    {"NO_OPERATION_SET", ERR_LIB_EVP, EVP_R_NO_OPERATION_SET},
+  #else
+    {"NO_OPERATION_SET", 6, 149},
+  #endif
+  #ifdef EVP_R_NULL_MAC_PKEY_CTX
+    {"NULL_MAC_PKEY_CTX", ERR_LIB_EVP, EVP_R_NULL_MAC_PKEY_CTX},
+  #else
+    {"NULL_MAC_PKEY_CTX", 6, 208},
+  #endif
+  #ifdef EVP_R_ONLY_ONESHOT_SUPPORTED
+    {"ONLY_ONESHOT_SUPPORTED", ERR_LIB_EVP, EVP_R_ONLY_ONESHOT_SUPPORTED},
+  #else
+    {"ONLY_ONESHOT_SUPPORTED", 6, 177},
+  #endif
+  #ifdef EVP_R_OPERATION_NOT_INITIALIZED
+    {"OPERATION_NOT_INITIALIZED", ERR_LIB_EVP, EVP_R_OPERATION_NOT_INITIALIZED},
+  #else
+    {"OPERATION_NOT_INITIALIZED", 6, 151},
+  #endif
+  #ifdef EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE
+    {"OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE", ERR_LIB_EVP, EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE},
+  #else
+    {"OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE", 6, 150},
+  #endif
+  #ifdef EVP_R_OUTPUT_WOULD_OVERFLOW
+    {"OUTPUT_WOULD_OVERFLOW", ERR_LIB_EVP, EVP_R_OUTPUT_WOULD_OVERFLOW},
+  #else
+    {"OUTPUT_WOULD_OVERFLOW", 6, 202},
+  #endif
+  #ifdef EVP_R_PARAMETER_TOO_LARGE
+    {"PARAMETER_TOO_LARGE", ERR_LIB_EVP, EVP_R_PARAMETER_TOO_LARGE},
+  #else
+    {"PARAMETER_TOO_LARGE", 6, 187},
+  #endif
+  #ifdef EVP_R_PARTIALLY_OVERLAPPING
+    {"PARTIALLY_OVERLAPPING", ERR_LIB_EVP, EVP_R_PARTIALLY_OVERLAPPING},
+  #else
+    {"PARTIALLY_OVERLAPPING", 6, 162},
+  #endif
+  #ifdef EVP_R_PBKDF2_ERROR
+    {"PBKDF2_ERROR", ERR_LIB_EVP, EVP_R_PBKDF2_ERROR},
+  #else
+    {"PBKDF2_ERROR", 6, 181},
+  #endif
+  #ifdef EVP_R_PKEY_APPLICATION_ASN1_METHOD_ALREADY_REGISTERED
+    {"PKEY_APPLICATION_ASN1_METHOD_ALREADY_REGISTERED", ERR_LIB_EVP, EVP_R_PKEY_APPLICATION_ASN1_METHOD_ALREADY_REGISTERED},
+  #else
+    {"PKEY_APPLICATION_ASN1_METHOD_ALREADY_REGISTERED", 6, 179},
+  #endif
+  #ifdef EVP_R_PRIVATE_KEY_DECODE_ERROR
+    {"PRIVATE_KEY_DECODE_ERROR", ERR_LIB_EVP, EVP_R_PRIVATE_KEY_DECODE_ERROR},
+  #else
+    {"PRIVATE_KEY_DECODE_ERROR", 6, 145},
+  #endif
+  #ifdef EVP_R_PRIVATE_KEY_ENCODE_ERROR
+    {"PRIVATE_KEY_ENCODE_ERROR", ERR_LIB_EVP, EVP_R_PRIVATE_KEY_ENCODE_ERROR},
+  #else
+    {"PRIVATE_KEY_ENCODE_ERROR", 6, 146},
+  #endif
+  #ifdef EVP_R_PUBLIC_KEY_NOT_RSA
+    {"PUBLIC_KEY_NOT_RSA", ERR_LIB_EVP, EVP_R_PUBLIC_KEY_NOT_RSA},
+  #else
+    {"PUBLIC_KEY_NOT_RSA", 6, 106},
+  #endif
+  #ifdef EVP_R_SET_DEFAULT_PROPERTY_FAILURE
+    {"SET_DEFAULT_PROPERTY_FAILURE", ERR_LIB_EVP, EVP_R_SET_DEFAULT_PROPERTY_FAILURE},
+  #else
+    {"SET_DEFAULT_PROPERTY_FAILURE", 6, 209},
+  #endif
+  #ifdef EVP_R_TOO_MANY_RECORDS
+    {"TOO_MANY_RECORDS", ERR_LIB_EVP, EVP_R_TOO_MANY_RECORDS},
+  #else
+    {"TOO_MANY_RECORDS", 6, 183},
+  #endif
+  #ifdef EVP_R_UNABLE_TO_ENABLE_LOCKING
+    {"UNABLE_TO_ENABLE_LOCKING", ERR_LIB_EVP, EVP_R_UNABLE_TO_ENABLE_LOCKING},
+  #else
+    {"UNABLE_TO_ENABLE_LOCKING", 6, 212},
+  #endif
+  #ifdef EVP_R_UNABLE_TO_GET_MAXIMUM_REQUEST_SIZE
+    {"UNABLE_TO_GET_MAXIMUM_REQUEST_SIZE", ERR_LIB_EVP, EVP_R_UNABLE_TO_GET_MAXIMUM_REQUEST_SIZE},
+  #else
+    {"UNABLE_TO_GET_MAXIMUM_REQUEST_SIZE", 6, 215},
+  #endif
+  #ifdef EVP_R_UNABLE_TO_GET_RANDOM_STRENGTH
+    {"UNABLE_TO_GET_RANDOM_STRENGTH", ERR_LIB_EVP, EVP_R_UNABLE_TO_GET_RANDOM_STRENGTH},
+  #else
+    {"UNABLE_TO_GET_RANDOM_STRENGTH", 6, 216},
+  #endif
+  #ifdef EVP_R_UNABLE_TO_LOCK_CONTEXT
+    {"UNABLE_TO_LOCK_CONTEXT", ERR_LIB_EVP, EVP_R_UNABLE_TO_LOCK_CONTEXT},
+  #else
+    {"UNABLE_TO_LOCK_CONTEXT", 6, 211},
+  #endif
+  #ifdef EVP_R_UNABLE_TO_SET_CALLBACKS
+    {"UNABLE_TO_SET_CALLBACKS", ERR_LIB_EVP, EVP_R_UNABLE_TO_SET_CALLBACKS},
+  #else
+    {"UNABLE_TO_SET_CALLBACKS", 6, 217},
+  #endif
+  #ifdef EVP_R_UNKNOWN_CIPHER
+    {"UNKNOWN_CIPHER", ERR_LIB_EVP, EVP_R_UNKNOWN_CIPHER},
+  #else
+    {"UNKNOWN_CIPHER", 6, 160},
+  #endif
+  #ifdef EVP_R_UNKNOWN_DIGEST
+    {"UNKNOWN_DIGEST", ERR_LIB_EVP, EVP_R_UNKNOWN_DIGEST},
+  #else
+    {"UNKNOWN_DIGEST", 6, 161},
+  #endif
+  #ifdef EVP_R_UNKNOWN_KEY_TYPE
+    {"UNKNOWN_KEY_TYPE", ERR_LIB_EVP, EVP_R_UNKNOWN_KEY_TYPE},
+  #else
+    {"UNKNOWN_KEY_TYPE", 6, 207},
+  #endif
+  #ifdef EVP_R_UNKNOWN_OPTION
+    {"UNKNOWN_OPTION", ERR_LIB_EVP, EVP_R_UNKNOWN_OPTION},
+  #else
+    {"UNKNOWN_OPTION", 6, 169},
+  #endif
+  #ifdef EVP_R_UNKNOWN_PBE_ALGORITHM
+    {"UNKNOWN_PBE_ALGORITHM", ERR_LIB_EVP, EVP_R_UNKNOWN_PBE_ALGORITHM},
+  #else
+    {"UNKNOWN_PBE_ALGORITHM", 6, 121},
+  #endif
+  #ifdef EVP_R_UNSUPPORTED_ALGORITHM
+    {"UNSUPPORTED_ALGORITHM", ERR_LIB_EVP, EVP_R_UNSUPPORTED_ALGORITHM},
+  #else
+    {"UNSUPPORTED_ALGORITHM", 6, 156},
+  #endif
+  #ifdef EVP_R_UNSUPPORTED_CIPHER
+    {"UNSUPPORTED_CIPHER", ERR_LIB_EVP, EVP_R_UNSUPPORTED_CIPHER},
+  #else
+    {"UNSUPPORTED_CIPHER", 6, 107},
+  #endif
+  #ifdef EVP_R_UNSUPPORTED_KEYLENGTH
+    {"UNSUPPORTED_KEYLENGTH", ERR_LIB_EVP, EVP_R_UNSUPPORTED_KEYLENGTH},
+  #else
+    {"UNSUPPORTED_KEYLENGTH", 6, 123},
+  #endif
+  #ifdef EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION
+    {"UNSUPPORTED_KEY_DERIVATION_FUNCTION", ERR_LIB_EVP, EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION},
+  #else
+    {"UNSUPPORTED_KEY_DERIVATION_FUNCTION", 6, 124},
+  #endif
+  #ifdef EVP_R_UNSUPPORTED_KEY_SIZE
+    {"UNSUPPORTED_KEY_SIZE", ERR_LIB_EVP, EVP_R_UNSUPPORTED_KEY_SIZE},
+  #else
+    {"UNSUPPORTED_KEY_SIZE", 6, 108},
+  #endif
+  #ifdef EVP_R_UNSUPPORTED_KEY_TYPE
+    {"UNSUPPORTED_KEY_TYPE", ERR_LIB_EVP, EVP_R_UNSUPPORTED_KEY_TYPE},
+  #else
+    {"UNSUPPORTED_KEY_TYPE", 6, 224},
+  #endif
+  #ifdef EVP_R_UNSUPPORTED_NUMBER_OF_ROUNDS
+    {"UNSUPPORTED_NUMBER_OF_ROUNDS", ERR_LIB_EVP, EVP_R_UNSUPPORTED_NUMBER_OF_ROUNDS},
+  #else
+    {"UNSUPPORTED_NUMBER_OF_ROUNDS", 6, 135},
+  #endif
+  #ifdef EVP_R_UNSUPPORTED_PRF
+    {"UNSUPPORTED_PRF", ERR_LIB_EVP, EVP_R_UNSUPPORTED_PRF},
+  #else
+    {"UNSUPPORTED_PRF", 6, 125},
+  #endif
+  #ifdef EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM
+    {"UNSUPPORTED_PRIVATE_KEY_ALGORITHM", ERR_LIB_EVP, EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM},
+  #else
+    {"UNSUPPORTED_PRIVATE_KEY_ALGORITHM", 6, 118},
+  #endif
+  #ifdef EVP_R_UNSUPPORTED_SALT_TYPE
+    {"UNSUPPORTED_SALT_TYPE", ERR_LIB_EVP, EVP_R_UNSUPPORTED_SALT_TYPE},
+  #else
+    {"UNSUPPORTED_SALT_TYPE", 6, 126},
+  #endif
+  #ifdef EVP_R_UPDATE_ERROR
+    {"UPDATE_ERROR", ERR_LIB_EVP, EVP_R_UPDATE_ERROR},
+  #else
+    {"UPDATE_ERROR", 6, 189},
+  #endif
+  #ifdef EVP_R_WRAP_MODE_NOT_ALLOWED
+    {"WRAP_MODE_NOT_ALLOWED", ERR_LIB_EVP, EVP_R_WRAP_MODE_NOT_ALLOWED},
+  #else
+    {"WRAP_MODE_NOT_ALLOWED", 6, 170},
+  #endif
+  #ifdef EVP_R_WRONG_FINAL_BLOCK_LENGTH
+    {"WRONG_FINAL_BLOCK_LENGTH", ERR_LIB_EVP, EVP_R_WRONG_FINAL_BLOCK_LENGTH},
+  #else
+    {"WRONG_FINAL_BLOCK_LENGTH", 6, 109},
+  #endif
+  #ifdef EVP_R_XTS_DATA_UNIT_IS_TOO_LARGE
+    {"XTS_DATA_UNIT_IS_TOO_LARGE", ERR_LIB_EVP, EVP_R_XTS_DATA_UNIT_IS_TOO_LARGE},
+  #else
+    {"XTS_DATA_UNIT_IS_TOO_LARGE", 6, 191},
+  #endif
+  #ifdef EVP_R_XTS_DUPLICATED_KEYS
+    {"XTS_DUPLICATED_KEYS", ERR_LIB_EVP, EVP_R_XTS_DUPLICATED_KEYS},
+  #else
+    {"XTS_DUPLICATED_KEYS", 6, 192},
+  #endif
+  #ifdef HTTP_R_ASN1_LEN_EXCEEDS_MAX_RESP_LEN
+    {"ASN1_LEN_EXCEEDS_MAX_RESP_LEN", ERR_LIB_HTTP, HTTP_R_ASN1_LEN_EXCEEDS_MAX_RESP_LEN},
+  #else
+    {"ASN1_LEN_EXCEEDS_MAX_RESP_LEN", 61, 108},
+  #endif
+  #ifdef HTTP_R_CONNECT_FAILURE
+    {"CONNECT_FAILURE", ERR_LIB_HTTP, HTTP_R_CONNECT_FAILURE},
+  #else
+    {"CONNECT_FAILURE", 61, 100},
+  #endif
+  #ifdef HTTP_R_ERROR_PARSING_ASN1_LENGTH
+    {"ERROR_PARSING_ASN1_LENGTH", ERR_LIB_HTTP, HTTP_R_ERROR_PARSING_ASN1_LENGTH},
+  #else
+    {"ERROR_PARSING_ASN1_LENGTH", 61, 109},
+  #endif
+  #ifdef HTTP_R_ERROR_PARSING_CONTENT_LENGTH
+    {"ERROR_PARSING_CONTENT_LENGTH", ERR_LIB_HTTP, HTTP_R_ERROR_PARSING_CONTENT_LENGTH},
+  #else
+    {"ERROR_PARSING_CONTENT_LENGTH", 61, 119},
+  #endif
+  #ifdef HTTP_R_ERROR_PARSING_URL
+    {"ERROR_PARSING_URL", ERR_LIB_HTTP, HTTP_R_ERROR_PARSING_URL},
+  #else
+    {"ERROR_PARSING_URL", 61, 101},
+  #endif
+  #ifdef HTTP_R_ERROR_RECEIVING
+    {"ERROR_RECEIVING", ERR_LIB_HTTP, HTTP_R_ERROR_RECEIVING},
+  #else
+    {"ERROR_RECEIVING", 61, 103},
+  #endif
+  #ifdef HTTP_R_ERROR_SENDING
+    {"ERROR_SENDING", ERR_LIB_HTTP, HTTP_R_ERROR_SENDING},
+  #else
+    {"ERROR_SENDING", 61, 102},
+  #endif
+  #ifdef HTTP_R_FAILED_READING_DATA
+    {"FAILED_READING_DATA", ERR_LIB_HTTP, HTTP_R_FAILED_READING_DATA},
+  #else
+    {"FAILED_READING_DATA", 61, 128},
+  #endif
+  #ifdef HTTP_R_INCONSISTENT_CONTENT_LENGTH
+    {"INCONSISTENT_CONTENT_LENGTH", ERR_LIB_HTTP, HTTP_R_INCONSISTENT_CONTENT_LENGTH},
+  #else
+    {"INCONSISTENT_CONTENT_LENGTH", 61, 120},
+  #endif
+  #ifdef HTTP_R_INVALID_PORT_NUMBER
+    {"INVALID_PORT_NUMBER", ERR_LIB_HTTP, HTTP_R_INVALID_PORT_NUMBER},
+  #else
+    {"INVALID_PORT_NUMBER", 61, 123},
+  #endif
+  #ifdef HTTP_R_INVALID_URL_PATH
+    {"INVALID_URL_PATH", ERR_LIB_HTTP, HTTP_R_INVALID_URL_PATH},
+  #else
+    {"INVALID_URL_PATH", 61, 125},
+  #endif
+  #ifdef HTTP_R_INVALID_URL_SCHEME
+    {"INVALID_URL_SCHEME", ERR_LIB_HTTP, HTTP_R_INVALID_URL_SCHEME},
+  #else
+    {"INVALID_URL_SCHEME", 61, 124},
+  #endif
+  #ifdef HTTP_R_MAX_RESP_LEN_EXCEEDED
+    {"MAX_RESP_LEN_EXCEEDED", ERR_LIB_HTTP, HTTP_R_MAX_RESP_LEN_EXCEEDED},
+  #else
+    {"MAX_RESP_LEN_EXCEEDED", 61, 117},
+  #endif
+  #ifdef HTTP_R_MISSING_ASN1_ENCODING
+    {"MISSING_ASN1_ENCODING", ERR_LIB_HTTP, HTTP_R_MISSING_ASN1_ENCODING},
+  #else
+    {"MISSING_ASN1_ENCODING", 61, 110},
+  #endif
+  #ifdef HTTP_R_MISSING_CONTENT_TYPE
+    {"MISSING_CONTENT_TYPE", ERR_LIB_HTTP, HTTP_R_MISSING_CONTENT_TYPE},
+  #else
+    {"MISSING_CONTENT_TYPE", 61, 121},
+  #endif
+  #ifdef HTTP_R_MISSING_REDIRECT_LOCATION
+    {"MISSING_REDIRECT_LOCATION", ERR_LIB_HTTP, HTTP_R_MISSING_REDIRECT_LOCATION},
+  #else
+    {"MISSING_REDIRECT_LOCATION", 61, 111},
+  #endif
+  #ifdef HTTP_R_RECEIVED_ERROR
+    {"RECEIVED_ERROR", ERR_LIB_HTTP, HTTP_R_RECEIVED_ERROR},
+  #else
+    {"RECEIVED_ERROR", 61, 105},
+  #endif
+  #ifdef HTTP_R_RECEIVED_WRONG_HTTP_VERSION
+    {"RECEIVED_WRONG_HTTP_VERSION", ERR_LIB_HTTP, HTTP_R_RECEIVED_WRONG_HTTP_VERSION},
+  #else
+    {"RECEIVED_WRONG_HTTP_VERSION", 61, 106},
+  #endif
+  #ifdef HTTP_R_REDIRECTION_FROM_HTTPS_TO_HTTP
+    {"REDIRECTION_FROM_HTTPS_TO_HTTP", ERR_LIB_HTTP, HTTP_R_REDIRECTION_FROM_HTTPS_TO_HTTP},
+  #else
+    {"REDIRECTION_FROM_HTTPS_TO_HTTP", 61, 112},
+  #endif
+  #ifdef HTTP_R_REDIRECTION_NOT_ENABLED
+    {"REDIRECTION_NOT_ENABLED", ERR_LIB_HTTP, HTTP_R_REDIRECTION_NOT_ENABLED},
+  #else
+    {"REDIRECTION_NOT_ENABLED", 61, 116},
+  #endif
+  #ifdef HTTP_R_RESPONSE_LINE_TOO_LONG
+    {"RESPONSE_LINE_TOO_LONG", ERR_LIB_HTTP, HTTP_R_RESPONSE_LINE_TOO_LONG},
+  #else
+    {"RESPONSE_LINE_TOO_LONG", 61, 113},
+  #endif
+  #ifdef HTTP_R_RESPONSE_PARSE_ERROR
+    {"RESPONSE_PARSE_ERROR", ERR_LIB_HTTP, HTTP_R_RESPONSE_PARSE_ERROR},
+  #else
+    {"RESPONSE_PARSE_ERROR", 61, 104},
+  #endif
+  #ifdef HTTP_R_SOCK_NOT_SUPPORTED
+    {"SOCK_NOT_SUPPORTED", ERR_LIB_HTTP, HTTP_R_SOCK_NOT_SUPPORTED},
+  #else
+    {"SOCK_NOT_SUPPORTED", 61, 122},
+  #endif
+  #ifdef HTTP_R_STATUS_CODE_UNSUPPORTED
+    {"STATUS_CODE_UNSUPPORTED", ERR_LIB_HTTP, HTTP_R_STATUS_CODE_UNSUPPORTED},
+  #else
+    {"STATUS_CODE_UNSUPPORTED", 61, 114},
+  #endif
+  #ifdef HTTP_R_TLS_NOT_ENABLED
+    {"TLS_NOT_ENABLED", ERR_LIB_HTTP, HTTP_R_TLS_NOT_ENABLED},
+  #else
+    {"TLS_NOT_ENABLED", 61, 107},
+  #endif
+  #ifdef HTTP_R_TOO_MANY_REDIRECTIONS
+    {"TOO_MANY_REDIRECTIONS", ERR_LIB_HTTP, HTTP_R_TOO_MANY_REDIRECTIONS},
+  #else
+    {"TOO_MANY_REDIRECTIONS", 61, 115},
+  #endif
+  #ifdef HTTP_R_UNEXPECTED_CONTENT_TYPE
+    {"UNEXPECTED_CONTENT_TYPE", ERR_LIB_HTTP, HTTP_R_UNEXPECTED_CONTENT_TYPE},
+  #else
+    {"UNEXPECTED_CONTENT_TYPE", 61, 118},
+  #endif
+  #ifdef OBJ_R_OID_EXISTS
+    {"OID_EXISTS", ERR_LIB_OBJ, OBJ_R_OID_EXISTS},
+  #else
+    {"OID_EXISTS", 8, 102},
+  #endif
+  #ifdef OBJ_R_UNKNOWN_NID
+    {"UNKNOWN_NID", ERR_LIB_OBJ, OBJ_R_UNKNOWN_NID},
+  #else
+    {"UNKNOWN_NID", 8, 101},
+  #endif
+  #ifdef OBJ_R_UNKNOWN_OBJECT_NAME
+    {"UNKNOWN_OBJECT_NAME", ERR_LIB_OBJ, OBJ_R_UNKNOWN_OBJECT_NAME},
+  #else
+    {"UNKNOWN_OBJECT_NAME", 8, 103},
+  #endif
+  #ifdef OCSP_R_CERTIFICATE_VERIFY_ERROR
+    {"CERTIFICATE_VERIFY_ERROR", ERR_LIB_OCSP, OCSP_R_CERTIFICATE_VERIFY_ERROR},
+  #else
+    {"CERTIFICATE_VERIFY_ERROR", 39, 101},
+  #endif
+  #ifdef OCSP_R_DIGEST_ERR
+    {"DIGEST_ERR", ERR_LIB_OCSP, OCSP_R_DIGEST_ERR},
+  #else
+    {"DIGEST_ERR", 39, 102},
+  #endif
+  #ifdef OCSP_R_DIGEST_NAME_ERR
+    {"DIGEST_NAME_ERR", ERR_LIB_OCSP, OCSP_R_DIGEST_NAME_ERR},
+  #else
+    {"DIGEST_NAME_ERR", 39, 106},
+  #endif
+  #ifdef OCSP_R_DIGEST_SIZE_ERR
+    {"DIGEST_SIZE_ERR", ERR_LIB_OCSP, OCSP_R_DIGEST_SIZE_ERR},
+  #else
+    {"DIGEST_SIZE_ERR", 39, 107},
+  #endif
+  #ifdef OCSP_R_ERROR_IN_NEXTUPDATE_FIELD
+    {"ERROR_IN_NEXTUPDATE_FIELD", ERR_LIB_OCSP, OCSP_R_ERROR_IN_NEXTUPDATE_FIELD},
+  #else
+    {"ERROR_IN_NEXTUPDATE_FIELD", 39, 122},
+  #endif
+  #ifdef OCSP_R_ERROR_IN_THISUPDATE_FIELD
+    {"ERROR_IN_THISUPDATE_FIELD", ERR_LIB_OCSP, OCSP_R_ERROR_IN_THISUPDATE_FIELD},
+  #else
+    {"ERROR_IN_THISUPDATE_FIELD", 39, 123},
+  #endif
+  #ifdef OCSP_R_MISSING_OCSPSIGNING_USAGE
+    {"MISSING_OCSPSIGNING_USAGE", ERR_LIB_OCSP, OCSP_R_MISSING_OCSPSIGNING_USAGE},
+  #else
+    {"MISSING_OCSPSIGNING_USAGE", 39, 103},
+  #endif
+  #ifdef OCSP_R_NEXTUPDATE_BEFORE_THISUPDATE
+    {"NEXTUPDATE_BEFORE_THISUPDATE", ERR_LIB_OCSP, OCSP_R_NEXTUPDATE_BEFORE_THISUPDATE},
+  #else
+    {"NEXTUPDATE_BEFORE_THISUPDATE", 39, 124},
+  #endif
+  #ifdef OCSP_R_NOT_BASIC_RESPONSE
+    {"NOT_BASIC_RESPONSE", ERR_LIB_OCSP, OCSP_R_NOT_BASIC_RESPONSE},
+  #else
+    {"NOT_BASIC_RESPONSE", 39, 104},
+  #endif
+  #ifdef OCSP_R_NO_CERTIFICATES_IN_CHAIN
+    {"NO_CERTIFICATES_IN_CHAIN", ERR_LIB_OCSP, OCSP_R_NO_CERTIFICATES_IN_CHAIN},
+  #else
+    {"NO_CERTIFICATES_IN_CHAIN", 39, 105},
+  #endif
+  #ifdef OCSP_R_NO_RESPONSE_DATA
+    {"NO_RESPONSE_DATA", ERR_LIB_OCSP, OCSP_R_NO_RESPONSE_DATA},
+  #else
+    {"NO_RESPONSE_DATA", 39, 108},
+  #endif
+  #ifdef OCSP_R_NO_REVOKED_TIME
+    {"NO_REVOKED_TIME", ERR_LIB_OCSP, OCSP_R_NO_REVOKED_TIME},
+  #else
+    {"NO_REVOKED_TIME", 39, 109},
+  #endif
+  #ifdef OCSP_R_NO_SIGNER_KEY
+    {"NO_SIGNER_KEY", ERR_LIB_OCSP, OCSP_R_NO_SIGNER_KEY},
+  #else
+    {"NO_SIGNER_KEY", 39, 130},
+  #endif
+  #ifdef OCSP_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE
+    {"PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE", ERR_LIB_OCSP, OCSP_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE},
+  #else
+    {"PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE", 39, 110},
+  #endif
+  #ifdef OCSP_R_REQUEST_NOT_SIGNED
+    {"REQUEST_NOT_SIGNED", ERR_LIB_OCSP, OCSP_R_REQUEST_NOT_SIGNED},
+  #else
+    {"REQUEST_NOT_SIGNED", 39, 128},
+  #endif
+  #ifdef OCSP_R_RESPONSE_CONTAINS_NO_REVOCATION_DATA
+    {"RESPONSE_CONTAINS_NO_REVOCATION_DATA", ERR_LIB_OCSP, OCSP_R_RESPONSE_CONTAINS_NO_REVOCATION_DATA},
+  #else
+    {"RESPONSE_CONTAINS_NO_REVOCATION_DATA", 39, 111},
+  #endif
+  #ifdef OCSP_R_ROOT_CA_NOT_TRUSTED
+    {"ROOT_CA_NOT_TRUSTED", ERR_LIB_OCSP, OCSP_R_ROOT_CA_NOT_TRUSTED},
+  #else
+    {"ROOT_CA_NOT_TRUSTED", 39, 112},
+  #endif
+  #ifdef OCSP_R_SIGNATURE_FAILURE
+    {"SIGNATURE_FAILURE", ERR_LIB_OCSP, OCSP_R_SIGNATURE_FAILURE},
+  #else
+    {"SIGNATURE_FAILURE", 39, 117},
+  #endif
+  #ifdef OCSP_R_SIGNER_CERTIFICATE_NOT_FOUND
+    {"SIGNER_CERTIFICATE_NOT_FOUND", ERR_LIB_OCSP, OCSP_R_SIGNER_CERTIFICATE_NOT_FOUND},
+  #else
+    {"SIGNER_CERTIFICATE_NOT_FOUND", 39, 118},
+  #endif
+  #ifdef OCSP_R_STATUS_EXPIRED
+    {"STATUS_EXPIRED", ERR_LIB_OCSP, OCSP_R_STATUS_EXPIRED},
+  #else
+    {"STATUS_EXPIRED", 39, 125},
+  #endif
+  #ifdef OCSP_R_STATUS_NOT_YET_VALID
+    {"STATUS_NOT_YET_VALID", ERR_LIB_OCSP, OCSP_R_STATUS_NOT_YET_VALID},
+  #else
+    {"STATUS_NOT_YET_VALID", 39, 126},
+  #endif
+  #ifdef OCSP_R_STATUS_TOO_OLD
+    {"STATUS_TOO_OLD", ERR_LIB_OCSP, OCSP_R_STATUS_TOO_OLD},
+  #else
+    {"STATUS_TOO_OLD", 39, 127},
+  #endif
+  #ifdef OCSP_R_UNKNOWN_MESSAGE_DIGEST
+    {"UNKNOWN_MESSAGE_DIGEST", ERR_LIB_OCSP, OCSP_R_UNKNOWN_MESSAGE_DIGEST},
+  #else
+    {"UNKNOWN_MESSAGE_DIGEST", 39, 119},
+  #endif
+  #ifdef OCSP_R_UNKNOWN_NID
+    {"UNKNOWN_NID", ERR_LIB_OCSP, OCSP_R_UNKNOWN_NID},
+  #else
+    {"UNKNOWN_NID", 39, 120},
+  #endif
+  #ifdef OCSP_R_UNSUPPORTED_REQUESTORNAME_TYPE
+    {"UNSUPPORTED_REQUESTORNAME_TYPE", ERR_LIB_OCSP, OCSP_R_UNSUPPORTED_REQUESTORNAME_TYPE},
+  #else
+    {"UNSUPPORTED_REQUESTORNAME_TYPE", 39, 129},
+  #endif
+  #ifdef OSSL_DECODER_R_MISSING_GET_PARAMS
+    {"MISSING_GET_PARAMS", ERR_LIB_OSSL_DECODER, OSSL_DECODER_R_MISSING_GET_PARAMS},
+  #else
+    {"MISSING_GET_PARAMS", 60, 100},
+  #endif
+  #ifdef OSSL_ENCODER_R_ENCODER_NOT_FOUND
+    {"ENCODER_NOT_FOUND", ERR_LIB_OSSL_ENCODER, OSSL_ENCODER_R_ENCODER_NOT_FOUND},
+  #else
+    {"ENCODER_NOT_FOUND", 59, 101},
+  #endif
+  #ifdef OSSL_ENCODER_R_INCORRECT_PROPERTY_QUERY
+    {"INCORRECT_PROPERTY_QUERY", ERR_LIB_OSSL_ENCODER, OSSL_ENCODER_R_INCORRECT_PROPERTY_QUERY},
+  #else
+    {"INCORRECT_PROPERTY_QUERY", 59, 100},
+  #endif
+  #ifdef OSSL_ENCODER_R_MISSING_GET_PARAMS
+    {"MISSING_GET_PARAMS", ERR_LIB_OSSL_ENCODER, OSSL_ENCODER_R_MISSING_GET_PARAMS},
+  #else
+    {"MISSING_GET_PARAMS", 59, 102},
+  #endif
+  #ifdef OSSL_STORE_R_AMBIGUOUS_CONTENT_TYPE
+    {"AMBIGUOUS_CONTENT_TYPE", ERR_LIB_OSSL_STORE, OSSL_STORE_R_AMBIGUOUS_CONTENT_TYPE},
+  #else
+    {"AMBIGUOUS_CONTENT_TYPE", 44, 107},
+  #endif
+  #ifdef OSSL_STORE_R_BAD_PASSWORD_READ
+    {"BAD_PASSWORD_READ", ERR_LIB_OSSL_STORE, OSSL_STORE_R_BAD_PASSWORD_READ},
+  #else
+    {"BAD_PASSWORD_READ", 44, 115},
+  #endif
+  #ifdef OSSL_STORE_R_ERROR_VERIFYING_PKCS12_MAC
+    {"ERROR_VERIFYING_PKCS12_MAC", ERR_LIB_OSSL_STORE, OSSL_STORE_R_ERROR_VERIFYING_PKCS12_MAC},
+  #else
+    {"ERROR_VERIFYING_PKCS12_MAC", 44, 113},
+  #endif
+  #ifdef OSSL_STORE_R_FINGERPRINT_SIZE_DOES_NOT_MATCH_DIGEST
+    {"FINGERPRINT_SIZE_DOES_NOT_MATCH_DIGEST", ERR_LIB_OSSL_STORE, OSSL_STORE_R_FINGERPRINT_SIZE_DOES_NOT_MATCH_DIGEST},
+  #else
+    {"FINGERPRINT_SIZE_DOES_NOT_MATCH_DIGEST", 44, 121},
+  #endif
+  #ifdef OSSL_STORE_R_INVALID_SCHEME
+    {"INVALID_SCHEME", ERR_LIB_OSSL_STORE, OSSL_STORE_R_INVALID_SCHEME},
+  #else
+    {"INVALID_SCHEME", 44, 106},
+  #endif
+  #ifdef OSSL_STORE_R_IS_NOT_A
+    {"IS_NOT_A", ERR_LIB_OSSL_STORE, OSSL_STORE_R_IS_NOT_A},
+  #else
+    {"IS_NOT_A", 44, 112},
+  #endif
+  #ifdef OSSL_STORE_R_LOADER_INCOMPLETE
+    {"LOADER_INCOMPLETE", ERR_LIB_OSSL_STORE, OSSL_STORE_R_LOADER_INCOMPLETE},
+  #else
+    {"LOADER_INCOMPLETE", 44, 116},
+  #endif
+  #ifdef OSSL_STORE_R_LOADING_STARTED
+    {"LOADING_STARTED", ERR_LIB_OSSL_STORE, OSSL_STORE_R_LOADING_STARTED},
+  #else
+    {"LOADING_STARTED", 44, 117},
+  #endif
+  #ifdef OSSL_STORE_R_NOT_A_CERTIFICATE
+    {"NOT_A_CERTIFICATE", ERR_LIB_OSSL_STORE, OSSL_STORE_R_NOT_A_CERTIFICATE},
+  #else
+    {"NOT_A_CERTIFICATE", 44, 100},
+  #endif
+  #ifdef OSSL_STORE_R_NOT_A_CRL
+    {"NOT_A_CRL", ERR_LIB_OSSL_STORE, OSSL_STORE_R_NOT_A_CRL},
+  #else
+    {"NOT_A_CRL", 44, 101},
+  #endif
+  #ifdef OSSL_STORE_R_NOT_A_NAME
+    {"NOT_A_NAME", ERR_LIB_OSSL_STORE, OSSL_STORE_R_NOT_A_NAME},
+  #else
+    {"NOT_A_NAME", 44, 103},
+  #endif
+  #ifdef OSSL_STORE_R_NOT_A_PRIVATE_KEY
+    {"NOT_A_PRIVATE_KEY", ERR_LIB_OSSL_STORE, OSSL_STORE_R_NOT_A_PRIVATE_KEY},
+  #else
+    {"NOT_A_PRIVATE_KEY", 44, 102},
+  #endif
+  #ifdef OSSL_STORE_R_NOT_A_PUBLIC_KEY
+    {"NOT_A_PUBLIC_KEY", ERR_LIB_OSSL_STORE, OSSL_STORE_R_NOT_A_PUBLIC_KEY},
+  #else
+    {"NOT_A_PUBLIC_KEY", 44, 122},
+  #endif
+  #ifdef OSSL_STORE_R_NOT_PARAMETERS
+    {"NOT_PARAMETERS", ERR_LIB_OSSL_STORE, OSSL_STORE_R_NOT_PARAMETERS},
+  #else
+    {"NOT_PARAMETERS", 44, 104},
+  #endif
+  #ifdef OSSL_STORE_R_PASSPHRASE_CALLBACK_ERROR
+    {"PASSPHRASE_CALLBACK_ERROR", ERR_LIB_OSSL_STORE, OSSL_STORE_R_PASSPHRASE_CALLBACK_ERROR},
+  #else
+    {"PASSPHRASE_CALLBACK_ERROR", 44, 114},
+  #endif
+  #ifdef OSSL_STORE_R_PATH_MUST_BE_ABSOLUTE
+    {"PATH_MUST_BE_ABSOLUTE", ERR_LIB_OSSL_STORE, OSSL_STORE_R_PATH_MUST_BE_ABSOLUTE},
+  #else
+    {"PATH_MUST_BE_ABSOLUTE", 44, 108},
+  #endif
+  #ifdef OSSL_STORE_R_SEARCH_ONLY_SUPPORTED_FOR_DIRECTORIES
+    {"SEARCH_ONLY_SUPPORTED_FOR_DIRECTORIES", ERR_LIB_OSSL_STORE, OSSL_STORE_R_SEARCH_ONLY_SUPPORTED_FOR_DIRECTORIES},
+  #else
+    {"SEARCH_ONLY_SUPPORTED_FOR_DIRECTORIES", 44, 119},
+  #endif
+  #ifdef OSSL_STORE_R_UI_PROCESS_INTERRUPTED_OR_CANCELLED
+    {"UI_PROCESS_INTERRUPTED_OR_CANCELLED", ERR_LIB_OSSL_STORE, OSSL_STORE_R_UI_PROCESS_INTERRUPTED_OR_CANCELLED},
+  #else
+    {"UI_PROCESS_INTERRUPTED_OR_CANCELLED", 44, 109},
+  #endif
+  #ifdef OSSL_STORE_R_UNREGISTERED_SCHEME
+    {"UNREGISTERED_SCHEME", ERR_LIB_OSSL_STORE, OSSL_STORE_R_UNREGISTERED_SCHEME},
+  #else
+    {"UNREGISTERED_SCHEME", 44, 105},
+  #endif
+  #ifdef OSSL_STORE_R_UNSUPPORTED_CONTENT_TYPE
+    {"UNSUPPORTED_CONTENT_TYPE", ERR_LIB_OSSL_STORE, OSSL_STORE_R_UNSUPPORTED_CONTENT_TYPE},
+  #else
+    {"UNSUPPORTED_CONTENT_TYPE", 44, 110},
+  #endif
+  #ifdef OSSL_STORE_R_UNSUPPORTED_OPERATION
+    {"UNSUPPORTED_OPERATION", ERR_LIB_OSSL_STORE, OSSL_STORE_R_UNSUPPORTED_OPERATION},
+  #else
+    {"UNSUPPORTED_OPERATION", 44, 118},
+  #endif
+  #ifdef OSSL_STORE_R_UNSUPPORTED_SEARCH_TYPE
+    {"UNSUPPORTED_SEARCH_TYPE", ERR_LIB_OSSL_STORE, OSSL_STORE_R_UNSUPPORTED_SEARCH_TYPE},
+  #else
+    {"UNSUPPORTED_SEARCH_TYPE", 44, 120},
+  #endif
+  #ifdef OSSL_STORE_R_URI_AUTHORITY_UNSUPPORTED
+    {"URI_AUTHORITY_UNSUPPORTED", ERR_LIB_OSSL_STORE, OSSL_STORE_R_URI_AUTHORITY_UNSUPPORTED},
+  #else
+    {"URI_AUTHORITY_UNSUPPORTED", 44, 111},
+  #endif
+  #ifdef PEM_R_BAD_BASE64_DECODE
+    {"BAD_BASE64_DECODE", ERR_LIB_PEM, PEM_R_BAD_BASE64_DECODE},
+  #else
+    {"BAD_BASE64_DECODE", 9, 100},
+  #endif
+  #ifdef PEM_R_BAD_DECRYPT
+    {"BAD_DECRYPT", ERR_LIB_PEM, PEM_R_BAD_DECRYPT},
+  #else
+    {"BAD_DECRYPT", 9, 101},
+  #endif
+  #ifdef PEM_R_BAD_END_LINE
+    {"BAD_END_LINE", ERR_LIB_PEM, PEM_R_BAD_END_LINE},
+  #else
+    {"BAD_END_LINE", 9, 102},
+  #endif
+  #ifdef PEM_R_BAD_IV_CHARS
+    {"BAD_IV_CHARS", ERR_LIB_PEM, PEM_R_BAD_IV_CHARS},
+  #else
+    {"BAD_IV_CHARS", 9, 103},
+  #endif
+  #ifdef PEM_R_BAD_MAGIC_NUMBER
+    {"BAD_MAGIC_NUMBER", ERR_LIB_PEM, PEM_R_BAD_MAGIC_NUMBER},
+  #else
+    {"BAD_MAGIC_NUMBER", 9, 116},
+  #endif
+  #ifdef PEM_R_BAD_PASSWORD_READ
+    {"BAD_PASSWORD_READ", ERR_LIB_PEM, PEM_R_BAD_PASSWORD_READ},
+  #else
+    {"BAD_PASSWORD_READ", 9, 104},
+  #endif
+  #ifdef PEM_R_BAD_VERSION_NUMBER
+    {"BAD_VERSION_NUMBER", ERR_LIB_PEM, PEM_R_BAD_VERSION_NUMBER},
+  #else
+    {"BAD_VERSION_NUMBER", 9, 117},
+  #endif
+  #ifdef PEM_R_BIO_WRITE_FAILURE
+    {"BIO_WRITE_FAILURE", ERR_LIB_PEM, PEM_R_BIO_WRITE_FAILURE},
+  #else
+    {"BIO_WRITE_FAILURE", 9, 118},
+  #endif
+  #ifdef PEM_R_CIPHER_IS_NULL
+    {"CIPHER_IS_NULL", ERR_LIB_PEM, PEM_R_CIPHER_IS_NULL},
+  #else
+    {"CIPHER_IS_NULL", 9, 127},
+  #endif
+  #ifdef PEM_R_ERROR_CONVERTING_PRIVATE_KEY
+    {"ERROR_CONVERTING_PRIVATE_KEY", ERR_LIB_PEM, PEM_R_ERROR_CONVERTING_PRIVATE_KEY},
+  #else
+    {"ERROR_CONVERTING_PRIVATE_KEY", 9, 115},
+  #endif
+  #ifdef PEM_R_EXPECTING_DSS_KEY_BLOB
+    {"EXPECTING_DSS_KEY_BLOB", ERR_LIB_PEM, PEM_R_EXPECTING_DSS_KEY_BLOB},
+  #else
+    {"EXPECTING_DSS_KEY_BLOB", 9, 131},
+  #endif
+  #ifdef PEM_R_EXPECTING_PRIVATE_KEY_BLOB
+    {"EXPECTING_PRIVATE_KEY_BLOB", ERR_LIB_PEM, PEM_R_EXPECTING_PRIVATE_KEY_BLOB},
+  #else
+    {"EXPECTING_PRIVATE_KEY_BLOB", 9, 119},
+  #endif
+  #ifdef PEM_R_EXPECTING_PUBLIC_KEY_BLOB
+    {"EXPECTING_PUBLIC_KEY_BLOB", ERR_LIB_PEM, PEM_R_EXPECTING_PUBLIC_KEY_BLOB},
+  #else
+    {"EXPECTING_PUBLIC_KEY_BLOB", 9, 120},
+  #endif
+  #ifdef PEM_R_EXPECTING_RSA_KEY_BLOB
+    {"EXPECTING_RSA_KEY_BLOB", ERR_LIB_PEM, PEM_R_EXPECTING_RSA_KEY_BLOB},
+  #else
+    {"EXPECTING_RSA_KEY_BLOB", 9, 132},
+  #endif
+  #ifdef PEM_R_HEADER_TOO_LONG
+    {"HEADER_TOO_LONG", ERR_LIB_PEM, PEM_R_HEADER_TOO_LONG},
+  #else
+    {"HEADER_TOO_LONG", 9, 128},
+  #endif
+  #ifdef PEM_R_INCONSISTENT_HEADER
+    {"INCONSISTENT_HEADER", ERR_LIB_PEM, PEM_R_INCONSISTENT_HEADER},
+  #else
+    {"INCONSISTENT_HEADER", 9, 121},
+  #endif
+  #ifdef PEM_R_KEYBLOB_HEADER_PARSE_ERROR
+    {"KEYBLOB_HEADER_PARSE_ERROR", ERR_LIB_PEM, PEM_R_KEYBLOB_HEADER_PARSE_ERROR},
+  #else
+    {"KEYBLOB_HEADER_PARSE_ERROR", 9, 122},
+  #endif
+  #ifdef PEM_R_KEYBLOB_TOO_SHORT
+    {"KEYBLOB_TOO_SHORT", ERR_LIB_PEM, PEM_R_KEYBLOB_TOO_SHORT},
+  #else
+    {"KEYBLOB_TOO_SHORT", 9, 123},
+  #endif
+  #ifdef PEM_R_MISSING_DEK_IV
+    {"MISSING_DEK_IV", ERR_LIB_PEM, PEM_R_MISSING_DEK_IV},
+  #else
+    {"MISSING_DEK_IV", 9, 129},
+  #endif
+  #ifdef PEM_R_NOT_DEK_INFO
+    {"NOT_DEK_INFO", ERR_LIB_PEM, PEM_R_NOT_DEK_INFO},
+  #else
+    {"NOT_DEK_INFO", 9, 105},
+  #endif
+  #ifdef PEM_R_NOT_ENCRYPTED
+    {"NOT_ENCRYPTED", ERR_LIB_PEM, PEM_R_NOT_ENCRYPTED},
+  #else
+    {"NOT_ENCRYPTED", 9, 106},
+  #endif
+  #ifdef PEM_R_NOT_PROC_TYPE
+    {"NOT_PROC_TYPE", ERR_LIB_PEM, PEM_R_NOT_PROC_TYPE},
+  #else
+    {"NOT_PROC_TYPE", 9, 107},
+  #endif
+  #ifdef PEM_R_NO_START_LINE
+    {"NO_START_LINE", ERR_LIB_PEM, PEM_R_NO_START_LINE},
+  #else
+    {"NO_START_LINE", 9, 108},
+  #endif
+  #ifdef PEM_R_PROBLEMS_GETTING_PASSWORD
+    {"PROBLEMS_GETTING_PASSWORD", ERR_LIB_PEM, PEM_R_PROBLEMS_GETTING_PASSWORD},
+  #else
+    {"PROBLEMS_GETTING_PASSWORD", 9, 109},
+  #endif
+  #ifdef PEM_R_PVK_DATA_TOO_SHORT
+    {"PVK_DATA_TOO_SHORT", ERR_LIB_PEM, PEM_R_PVK_DATA_TOO_SHORT},
+  #else
+    {"PVK_DATA_TOO_SHORT", 9, 124},
+  #endif
+  #ifdef PEM_R_PVK_TOO_SHORT
+    {"PVK_TOO_SHORT", ERR_LIB_PEM, PEM_R_PVK_TOO_SHORT},
+  #else
+    {"PVK_TOO_SHORT", 9, 125},
+  #endif
+  #ifdef PEM_R_READ_KEY
+    {"READ_KEY", ERR_LIB_PEM, PEM_R_READ_KEY},
+  #else
+    {"READ_KEY", 9, 111},
+  #endif
+  #ifdef PEM_R_SHORT_HEADER
+    {"SHORT_HEADER", ERR_LIB_PEM, PEM_R_SHORT_HEADER},
+  #else
+    {"SHORT_HEADER", 9, 112},
+  #endif
+  #ifdef PEM_R_UNEXPECTED_DEK_IV
+    {"UNEXPECTED_DEK_IV", ERR_LIB_PEM, PEM_R_UNEXPECTED_DEK_IV},
+  #else
+    {"UNEXPECTED_DEK_IV", 9, 130},
+  #endif
+  #ifdef PEM_R_UNSUPPORTED_CIPHER
+    {"UNSUPPORTED_CIPHER", ERR_LIB_PEM, PEM_R_UNSUPPORTED_CIPHER},
+  #else
+    {"UNSUPPORTED_CIPHER", 9, 113},
+  #endif
+  #ifdef PEM_R_UNSUPPORTED_ENCRYPTION
+    {"UNSUPPORTED_ENCRYPTION", ERR_LIB_PEM, PEM_R_UNSUPPORTED_ENCRYPTION},
+  #else
+    {"UNSUPPORTED_ENCRYPTION", 9, 114},
+  #endif
+  #ifdef PEM_R_UNSUPPORTED_KEY_COMPONENTS
+    {"UNSUPPORTED_KEY_COMPONENTS", ERR_LIB_PEM, PEM_R_UNSUPPORTED_KEY_COMPONENTS},
+  #else
+    {"UNSUPPORTED_KEY_COMPONENTS", 9, 126},
+  #endif
+  #ifdef PEM_R_UNSUPPORTED_PUBLIC_KEY_TYPE
+    {"UNSUPPORTED_PUBLIC_KEY_TYPE", ERR_LIB_PEM, PEM_R_UNSUPPORTED_PUBLIC_KEY_TYPE},
+  #else
+    {"UNSUPPORTED_PUBLIC_KEY_TYPE", 9, 110},
+  #endif
+  #ifdef PKCS12_R_CANT_PACK_STRUCTURE
+    {"CANT_PACK_STRUCTURE", ERR_LIB_PKCS12, PKCS12_R_CANT_PACK_STRUCTURE},
+  #else
+    {"CANT_PACK_STRUCTURE", 35, 100},
+  #endif
+  #ifdef PKCS12_R_CONTENT_TYPE_NOT_DATA
+    {"CONTENT_TYPE_NOT_DATA", ERR_LIB_PKCS12, PKCS12_R_CONTENT_TYPE_NOT_DATA},
+  #else
+    {"CONTENT_TYPE_NOT_DATA", 35, 121},
+  #endif
+  #ifdef PKCS12_R_DECODE_ERROR
+    {"DECODE_ERROR", ERR_LIB_PKCS12, PKCS12_R_DECODE_ERROR},
+  #else
+    {"DECODE_ERROR", 35, 101},
+  #endif
+  #ifdef PKCS12_R_ENCODE_ERROR
+    {"ENCODE_ERROR", ERR_LIB_PKCS12, PKCS12_R_ENCODE_ERROR},
+  #else
+    {"ENCODE_ERROR", 35, 102},
+  #endif
+  #ifdef PKCS12_R_ENCRYPT_ERROR
+    {"ENCRYPT_ERROR", ERR_LIB_PKCS12, PKCS12_R_ENCRYPT_ERROR},
+  #else
+    {"ENCRYPT_ERROR", 35, 103},
+  #endif
+  #ifdef PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE
+    {"ERROR_SETTING_ENCRYPTED_DATA_TYPE", ERR_LIB_PKCS12, PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE},
+  #else
+    {"ERROR_SETTING_ENCRYPTED_DATA_TYPE", 35, 120},
+  #endif
+  #ifdef PKCS12_R_INVALID_NULL_ARGUMENT
+    {"INVALID_NULL_ARGUMENT", ERR_LIB_PKCS12, PKCS12_R_INVALID_NULL_ARGUMENT},
+  #else
+    {"INVALID_NULL_ARGUMENT", 35, 104},
+  #endif
+  #ifdef PKCS12_R_INVALID_NULL_PKCS12_POINTER
+    {"INVALID_NULL_PKCS12_POINTER", ERR_LIB_PKCS12, PKCS12_R_INVALID_NULL_PKCS12_POINTER},
+  #else
+    {"INVALID_NULL_PKCS12_POINTER", 35, 105},
+  #endif
+  #ifdef PKCS12_R_INVALID_TYPE
+    {"INVALID_TYPE", ERR_LIB_PKCS12, PKCS12_R_INVALID_TYPE},
+  #else
+    {"INVALID_TYPE", 35, 112},
+  #endif
+  #ifdef PKCS12_R_IV_GEN_ERROR
+    {"IV_GEN_ERROR", ERR_LIB_PKCS12, PKCS12_R_IV_GEN_ERROR},
+  #else
+    {"IV_GEN_ERROR", 35, 106},
+  #endif
+  #ifdef PKCS12_R_KEY_GEN_ERROR
+    {"KEY_GEN_ERROR", ERR_LIB_PKCS12, PKCS12_R_KEY_GEN_ERROR},
+  #else
+    {"KEY_GEN_ERROR", 35, 107},
+  #endif
+  #ifdef PKCS12_R_MAC_ABSENT
+    {"MAC_ABSENT", ERR_LIB_PKCS12, PKCS12_R_MAC_ABSENT},
+  #else
+    {"MAC_ABSENT", 35, 108},
+  #endif
+  #ifdef PKCS12_R_MAC_GENERATION_ERROR
+    {"MAC_GENERATION_ERROR", ERR_LIB_PKCS12, PKCS12_R_MAC_GENERATION_ERROR},
+  #else
+    {"MAC_GENERATION_ERROR", 35, 109},
+  #endif
+  #ifdef PKCS12_R_MAC_SETUP_ERROR
+    {"MAC_SETUP_ERROR", ERR_LIB_PKCS12, PKCS12_R_MAC_SETUP_ERROR},
+  #else
+    {"MAC_SETUP_ERROR", 35, 110},
+  #endif
+  #ifdef PKCS12_R_MAC_STRING_SET_ERROR
+    {"MAC_STRING_SET_ERROR", ERR_LIB_PKCS12, PKCS12_R_MAC_STRING_SET_ERROR},
+  #else
+    {"MAC_STRING_SET_ERROR", 35, 111},
+  #endif
+  #ifdef PKCS12_R_MAC_VERIFY_FAILURE
+    {"MAC_VERIFY_FAILURE", ERR_LIB_PKCS12, PKCS12_R_MAC_VERIFY_FAILURE},
+  #else
+    {"MAC_VERIFY_FAILURE", 35, 113},
+  #endif
+  #ifdef PKCS12_R_PARSE_ERROR
+    {"PARSE_ERROR", ERR_LIB_PKCS12, PKCS12_R_PARSE_ERROR},
+  #else
+    {"PARSE_ERROR", 35, 114},
+  #endif
+  #ifdef PKCS12_R_PKCS12_CIPHERFINAL_ERROR
+    {"PKCS12_CIPHERFINAL_ERROR", ERR_LIB_PKCS12, PKCS12_R_PKCS12_CIPHERFINAL_ERROR},
+  #else
+    {"PKCS12_CIPHERFINAL_ERROR", 35, 116},
+  #endif
+  #ifdef PKCS12_R_UNKNOWN_DIGEST_ALGORITHM
+    {"UNKNOWN_DIGEST_ALGORITHM", ERR_LIB_PKCS12, PKCS12_R_UNKNOWN_DIGEST_ALGORITHM},
+  #else
+    {"UNKNOWN_DIGEST_ALGORITHM", 35, 118},
+  #endif
+  #ifdef PKCS12_R_UNSUPPORTED_PKCS12_MODE
+    {"UNSUPPORTED_PKCS12_MODE", ERR_LIB_PKCS12, PKCS12_R_UNSUPPORTED_PKCS12_MODE},
+  #else
+    {"UNSUPPORTED_PKCS12_MODE", 35, 119},
+  #endif
+  #ifdef PKCS7_R_CERTIFICATE_VERIFY_ERROR
+    {"CERTIFICATE_VERIFY_ERROR", ERR_LIB_PKCS7, PKCS7_R_CERTIFICATE_VERIFY_ERROR},
+  #else
+    {"CERTIFICATE_VERIFY_ERROR", 33, 117},
+  #endif
+  #ifdef PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER
+    {"CIPHER_HAS_NO_OBJECT_IDENTIFIER", ERR_LIB_PKCS7, PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER},
+  #else
+    {"CIPHER_HAS_NO_OBJECT_IDENTIFIER", 33, 144},
+  #endif
+  #ifdef PKCS7_R_CIPHER_NOT_INITIALIZED
+    {"CIPHER_NOT_INITIALIZED", ERR_LIB_PKCS7, PKCS7_R_CIPHER_NOT_INITIALIZED},
+  #else
+    {"CIPHER_NOT_INITIALIZED", 33, 116},
+  #endif
+  #ifdef PKCS7_R_CONTENT_AND_DATA_PRESENT
+    {"CONTENT_AND_DATA_PRESENT", ERR_LIB_PKCS7, PKCS7_R_CONTENT_AND_DATA_PRESENT},
+  #else
+    {"CONTENT_AND_DATA_PRESENT", 33, 118},
+  #endif
+  #ifdef PKCS7_R_CTRL_ERROR
+    {"CTRL_ERROR", ERR_LIB_PKCS7, PKCS7_R_CTRL_ERROR},
+  #else
+    {"CTRL_ERROR", 33, 152},
+  #endif
+  #ifdef PKCS7_R_DECRYPT_ERROR
+    {"DECRYPT_ERROR", ERR_LIB_PKCS7, PKCS7_R_DECRYPT_ERROR},
+  #else
+    {"DECRYPT_ERROR", 33, 119},
+  #endif
+  #ifdef PKCS7_R_DIGEST_FAILURE
+    {"DIGEST_FAILURE", ERR_LIB_PKCS7, PKCS7_R_DIGEST_FAILURE},
+  #else
+    {"DIGEST_FAILURE", 33, 101},
+  #endif
+  #ifdef PKCS7_R_ENCRYPTION_CTRL_FAILURE
+    {"ENCRYPTION_CTRL_FAILURE", ERR_LIB_PKCS7, PKCS7_R_ENCRYPTION_CTRL_FAILURE},
+  #else
+    {"ENCRYPTION_CTRL_FAILURE", 33, 149},
+  #endif
+  #ifdef PKCS7_R_ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE
+    {"ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE", ERR_LIB_PKCS7, PKCS7_R_ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE},
+  #else
+    {"ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE", 33, 150},
+  #endif
+  #ifdef PKCS7_R_ERROR_ADDING_RECIPIENT
+    {"ERROR_ADDING_RECIPIENT", ERR_LIB_PKCS7, PKCS7_R_ERROR_ADDING_RECIPIENT},
+  #else
+    {"ERROR_ADDING_RECIPIENT", 33, 120},
+  #endif
+  #ifdef PKCS7_R_ERROR_SETTING_CIPHER
+    {"ERROR_SETTING_CIPHER", ERR_LIB_PKCS7, PKCS7_R_ERROR_SETTING_CIPHER},
+  #else
+    {"ERROR_SETTING_CIPHER", 33, 121},
+  #endif
+  #ifdef PKCS7_R_INVALID_NULL_POINTER
+    {"INVALID_NULL_POINTER", ERR_LIB_PKCS7, PKCS7_R_INVALID_NULL_POINTER},
+  #else
+    {"INVALID_NULL_POINTER", 33, 143},
+  #endif
+  #ifdef PKCS7_R_INVALID_SIGNED_DATA_TYPE
+    {"INVALID_SIGNED_DATA_TYPE", ERR_LIB_PKCS7, PKCS7_R_INVALID_SIGNED_DATA_TYPE},
+  #else
+    {"INVALID_SIGNED_DATA_TYPE", 33, 155},
+  #endif
+  #ifdef PKCS7_R_NO_CONTENT
+    {"NO_CONTENT", ERR_LIB_PKCS7, PKCS7_R_NO_CONTENT},
+  #else
+    {"NO_CONTENT", 33, 122},
+  #endif
+  #ifdef PKCS7_R_NO_DEFAULT_DIGEST
+    {"NO_DEFAULT_DIGEST", ERR_LIB_PKCS7, PKCS7_R_NO_DEFAULT_DIGEST},
+  #else
+    {"NO_DEFAULT_DIGEST", 33, 151},
+  #endif
+  #ifdef PKCS7_R_NO_MATCHING_DIGEST_TYPE_FOUND
+    {"NO_MATCHING_DIGEST_TYPE_FOUND", ERR_LIB_PKCS7, PKCS7_R_NO_MATCHING_DIGEST_TYPE_FOUND},
+  #else
+    {"NO_MATCHING_DIGEST_TYPE_FOUND", 33, 154},
+  #endif
+  #ifdef PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE
+    {"NO_RECIPIENT_MATCHES_CERTIFICATE", ERR_LIB_PKCS7, PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE},
+  #else
+    {"NO_RECIPIENT_MATCHES_CERTIFICATE", 33, 115},
+  #endif
+  #ifdef PKCS7_R_NO_SIGNATURES_ON_DATA
+    {"NO_SIGNATURES_ON_DATA", ERR_LIB_PKCS7, PKCS7_R_NO_SIGNATURES_ON_DATA},
+  #else
+    {"NO_SIGNATURES_ON_DATA", 33, 123},
+  #endif
+  #ifdef PKCS7_R_NO_SIGNERS
+    {"NO_SIGNERS", ERR_LIB_PKCS7, PKCS7_R_NO_SIGNERS},
+  #else
+    {"NO_SIGNERS", 33, 142},
+  #endif
+  #ifdef PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE
+    {"OPERATION_NOT_SUPPORTED_ON_THIS_TYPE", ERR_LIB_PKCS7, PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE},
+  #else
+    {"OPERATION_NOT_SUPPORTED_ON_THIS_TYPE", 33, 104},
+  #endif
+  #ifdef PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR
+    {"PKCS7_ADD_SIGNATURE_ERROR", ERR_LIB_PKCS7, PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR},
+  #else
+    {"PKCS7_ADD_SIGNATURE_ERROR", 33, 124},
+  #endif
+  #ifdef PKCS7_R_PKCS7_ADD_SIGNER_ERROR
+    {"PKCS7_ADD_SIGNER_ERROR", ERR_LIB_PKCS7, PKCS7_R_PKCS7_ADD_SIGNER_ERROR},
+  #else
+    {"PKCS7_ADD_SIGNER_ERROR", 33, 153},
+  #endif
+  #ifdef PKCS7_R_PKCS7_DATASIGN
+    {"PKCS7_DATASIGN", ERR_LIB_PKCS7, PKCS7_R_PKCS7_DATASIGN},
+  #else
+    {"PKCS7_DATASIGN", 33, 145},
+  #endif
+  #ifdef PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE
+    {"PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE", ERR_LIB_PKCS7, PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE},
+  #else
+    {"PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE", 33, 127},
+  #endif
+  #ifdef PKCS7_R_SIGNATURE_FAILURE
+    {"SIGNATURE_FAILURE", ERR_LIB_PKCS7, PKCS7_R_SIGNATURE_FAILURE},
+  #else
+    {"SIGNATURE_FAILURE", 33, 105},
+  #endif
+  #ifdef PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND
+    {"SIGNER_CERTIFICATE_NOT_FOUND", ERR_LIB_PKCS7, PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND},
+  #else
+    {"SIGNER_CERTIFICATE_NOT_FOUND", 33, 128},
+  #endif
+  #ifdef PKCS7_R_SIGNING_CTRL_FAILURE
+    {"SIGNING_CTRL_FAILURE", ERR_LIB_PKCS7, PKCS7_R_SIGNING_CTRL_FAILURE},
+  #else
+    {"SIGNING_CTRL_FAILURE", 33, 147},
+  #endif
+  #ifdef PKCS7_R_SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE
+    {"SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE", ERR_LIB_PKCS7, PKCS7_R_SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE},
+  #else
+    {"SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE", 33, 148},
+  #endif
+  #ifdef PKCS7_R_SMIME_TEXT_ERROR
+    {"SMIME_TEXT_ERROR", ERR_LIB_PKCS7, PKCS7_R_SMIME_TEXT_ERROR},
+  #else
+    {"SMIME_TEXT_ERROR", 33, 129},
+  #endif
+  #ifdef PKCS7_R_UNABLE_TO_FIND_CERTIFICATE
+    {"UNABLE_TO_FIND_CERTIFICATE", ERR_LIB_PKCS7, PKCS7_R_UNABLE_TO_FIND_CERTIFICATE},
+  #else
+    {"UNABLE_TO_FIND_CERTIFICATE", 33, 106},
+  #endif
+  #ifdef PKCS7_R_UNABLE_TO_FIND_MEM_BIO
+    {"UNABLE_TO_FIND_MEM_BIO", ERR_LIB_PKCS7, PKCS7_R_UNABLE_TO_FIND_MEM_BIO},
+  #else
+    {"UNABLE_TO_FIND_MEM_BIO", 33, 107},
+  #endif
+  #ifdef PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST
+    {"UNABLE_TO_FIND_MESSAGE_DIGEST", ERR_LIB_PKCS7, PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST},
+  #else
+    {"UNABLE_TO_FIND_MESSAGE_DIGEST", 33, 108},
+  #endif
+  #ifdef PKCS7_R_UNKNOWN_DIGEST_TYPE
+    {"UNKNOWN_DIGEST_TYPE", ERR_LIB_PKCS7, PKCS7_R_UNKNOWN_DIGEST_TYPE},
+  #else
+    {"UNKNOWN_DIGEST_TYPE", 33, 109},
+  #endif
+  #ifdef PKCS7_R_UNKNOWN_OPERATION
+    {"UNKNOWN_OPERATION", ERR_LIB_PKCS7, PKCS7_R_UNKNOWN_OPERATION},
+  #else
+    {"UNKNOWN_OPERATION", 33, 110},
+  #endif
+  #ifdef PKCS7_R_UNSUPPORTED_CIPHER_TYPE
+    {"UNSUPPORTED_CIPHER_TYPE", ERR_LIB_PKCS7, PKCS7_R_UNSUPPORTED_CIPHER_TYPE},
+  #else
+    {"UNSUPPORTED_CIPHER_TYPE", 33, 111},
+  #endif
+  #ifdef PKCS7_R_UNSUPPORTED_CONTENT_TYPE
+    {"UNSUPPORTED_CONTENT_TYPE", ERR_LIB_PKCS7, PKCS7_R_UNSUPPORTED_CONTENT_TYPE},
+  #else
+    {"UNSUPPORTED_CONTENT_TYPE", 33, 112},
+  #endif
+  #ifdef PKCS7_R_WRONG_CONTENT_TYPE
+    {"WRONG_CONTENT_TYPE", ERR_LIB_PKCS7, PKCS7_R_WRONG_CONTENT_TYPE},
+  #else
+    {"WRONG_CONTENT_TYPE", 33, 113},
+  #endif
+  #ifdef PKCS7_R_WRONG_PKCS7_TYPE
+    {"WRONG_PKCS7_TYPE", ERR_LIB_PKCS7, PKCS7_R_WRONG_PKCS7_TYPE},
+  #else
+    {"WRONG_PKCS7_TYPE", 33, 114},
+  #endif
+  #ifdef PROP_R_NAME_TOO_LONG
+    {"NAME_TOO_LONG", ERR_LIB_PROP, PROP_R_NAME_TOO_LONG},
+  #else
+    {"NAME_TOO_LONG", 55, 100},
+  #endif
+  #ifdef PROP_R_NOT_AN_ASCII_CHARACTER
+    {"NOT_AN_ASCII_CHARACTER", ERR_LIB_PROP, PROP_R_NOT_AN_ASCII_CHARACTER},
+  #else
+    {"NOT_AN_ASCII_CHARACTER", 55, 101},
+  #endif
+  #ifdef PROP_R_NOT_AN_HEXADECIMAL_DIGIT
+    {"NOT_AN_HEXADECIMAL_DIGIT", ERR_LIB_PROP, PROP_R_NOT_AN_HEXADECIMAL_DIGIT},
+  #else
+    {"NOT_AN_HEXADECIMAL_DIGIT", 55, 102},
+  #endif
+  #ifdef PROP_R_NOT_AN_IDENTIFIER
+    {"NOT_AN_IDENTIFIER", ERR_LIB_PROP, PROP_R_NOT_AN_IDENTIFIER},
+  #else
+    {"NOT_AN_IDENTIFIER", 55, 103},
+  #endif
+  #ifdef PROP_R_NOT_AN_OCTAL_DIGIT
+    {"NOT_AN_OCTAL_DIGIT", ERR_LIB_PROP, PROP_R_NOT_AN_OCTAL_DIGIT},
+  #else
+    {"NOT_AN_OCTAL_DIGIT", 55, 104},
+  #endif
+  #ifdef PROP_R_NOT_A_DECIMAL_DIGIT
+    {"NOT_A_DECIMAL_DIGIT", ERR_LIB_PROP, PROP_R_NOT_A_DECIMAL_DIGIT},
+  #else
+    {"NOT_A_DECIMAL_DIGIT", 55, 105},
+  #endif
+  #ifdef PROP_R_NO_MATCHING_STRING_DELIMITER
+    {"NO_MATCHING_STRING_DELIMITER", ERR_LIB_PROP, PROP_R_NO_MATCHING_STRING_DELIMITER},
+  #else
+    {"NO_MATCHING_STRING_DELIMITER", 55, 106},
+  #endif
+  #ifdef PROP_R_NO_VALUE
+    {"NO_VALUE", ERR_LIB_PROP, PROP_R_NO_VALUE},
+  #else
+    {"NO_VALUE", 55, 107},
+  #endif
+  #ifdef PROP_R_PARSE_FAILED
+    {"PARSE_FAILED", ERR_LIB_PROP, PROP_R_PARSE_FAILED},
+  #else
+    {"PARSE_FAILED", 55, 108},
+  #endif
+  #ifdef PROP_R_STRING_TOO_LONG
+    {"STRING_TOO_LONG", ERR_LIB_PROP, PROP_R_STRING_TOO_LONG},
+  #else
+    {"STRING_TOO_LONG", 55, 109},
+  #endif
+  #ifdef PROP_R_TRAILING_CHARACTERS
+    {"TRAILING_CHARACTERS", ERR_LIB_PROP, PROP_R_TRAILING_CHARACTERS},
+  #else
+    {"TRAILING_CHARACTERS", 55, 110},
+  #endif
+  #ifdef PROV_R_ADDITIONAL_INPUT_TOO_LONG
+    {"ADDITIONAL_INPUT_TOO_LONG", ERR_LIB_PROV, PROV_R_ADDITIONAL_INPUT_TOO_LONG},
+  #else
+    {"ADDITIONAL_INPUT_TOO_LONG", 57, 184},
+  #endif
+  #ifdef PROV_R_ALGORITHM_MISMATCH
+    {"ALGORITHM_MISMATCH", ERR_LIB_PROV, PROV_R_ALGORITHM_MISMATCH},
+  #else
+    {"ALGORITHM_MISMATCH", 57, 173},
+  #endif
+  #ifdef PROV_R_ALREADY_INSTANTIATED
+    {"ALREADY_INSTANTIATED", ERR_LIB_PROV, PROV_R_ALREADY_INSTANTIATED},
+  #else
+    {"ALREADY_INSTANTIATED", 57, 185},
+  #endif
+  #ifdef PROV_R_BAD_DECRYPT
+    {"BAD_DECRYPT", ERR_LIB_PROV, PROV_R_BAD_DECRYPT},
+  #else
+    {"BAD_DECRYPT", 57, 100},
+  #endif
+  #ifdef PROV_R_BAD_ENCODING
+    {"BAD_ENCODING", ERR_LIB_PROV, PROV_R_BAD_ENCODING},
+  #else
+    {"BAD_ENCODING", 57, 141},
+  #endif
+  #ifdef PROV_R_BAD_LENGTH
+    {"BAD_LENGTH", ERR_LIB_PROV, PROV_R_BAD_LENGTH},
+  #else
+    {"BAD_LENGTH", 57, 142},
+  #endif
+  #ifdef PROV_R_BAD_TLS_CLIENT_VERSION
+    {"BAD_TLS_CLIENT_VERSION", ERR_LIB_PROV, PROV_R_BAD_TLS_CLIENT_VERSION},
+  #else
+    {"BAD_TLS_CLIENT_VERSION", 57, 161},
+  #endif
+  #ifdef PROV_R_BN_ERROR
+    {"BN_ERROR", ERR_LIB_PROV, PROV_R_BN_ERROR},
+  #else
+    {"BN_ERROR", 57, 160},
+  #endif
+  #ifdef PROV_R_CIPHER_OPERATION_FAILED
+    {"CIPHER_OPERATION_FAILED", ERR_LIB_PROV, PROV_R_CIPHER_OPERATION_FAILED},
+  #else
+    {"CIPHER_OPERATION_FAILED", 57, 102},
+  #endif
+  #ifdef PROV_R_DERIVATION_FUNCTION_INIT_FAILED
+    {"DERIVATION_FUNCTION_INIT_FAILED", ERR_LIB_PROV, PROV_R_DERIVATION_FUNCTION_INIT_FAILED},
+  #else
+    {"DERIVATION_FUNCTION_INIT_FAILED", 57, 205},
+  #endif
+  #ifdef PROV_R_DIGEST_NOT_ALLOWED
+    {"DIGEST_NOT_ALLOWED", ERR_LIB_PROV, PROV_R_DIGEST_NOT_ALLOWED},
+  #else
+    {"DIGEST_NOT_ALLOWED", 57, 174},
+  #endif
+  #ifdef PROV_R_ENTROPY_SOURCE_STRENGTH_TOO_WEAK
+    {"ENTROPY_SOURCE_STRENGTH_TOO_WEAK", ERR_LIB_PROV, PROV_R_ENTROPY_SOURCE_STRENGTH_TOO_WEAK},
+  #else
+    {"ENTROPY_SOURCE_STRENGTH_TOO_WEAK", 57, 186},
+  #endif
+  #ifdef PROV_R_ERROR_INSTANTIATING_DRBG
+    {"ERROR_INSTANTIATING_DRBG", ERR_LIB_PROV, PROV_R_ERROR_INSTANTIATING_DRBG},
+  #else
+    {"ERROR_INSTANTIATING_DRBG", 57, 188},
+  #endif
+  #ifdef PROV_R_ERROR_RETRIEVING_ENTROPY
+    {"ERROR_RETRIEVING_ENTROPY", ERR_LIB_PROV, PROV_R_ERROR_RETRIEVING_ENTROPY},
+  #else
+    {"ERROR_RETRIEVING_ENTROPY", 57, 189},
+  #endif
+  #ifdef PROV_R_ERROR_RETRIEVING_NONCE
+    {"ERROR_RETRIEVING_NONCE", ERR_LIB_PROV, PROV_R_ERROR_RETRIEVING_NONCE},
+  #else
+    {"ERROR_RETRIEVING_NONCE", 57, 190},
+  #endif
+  #ifdef PROV_R_FAILED_DURING_DERIVATION
+    {"FAILED_DURING_DERIVATION", ERR_LIB_PROV, PROV_R_FAILED_DURING_DERIVATION},
+  #else
+    {"FAILED_DURING_DERIVATION", 57, 164},
+  #endif
+  #ifdef PROV_R_FAILED_TO_CREATE_LOCK
+    {"FAILED_TO_CREATE_LOCK", ERR_LIB_PROV, PROV_R_FAILED_TO_CREATE_LOCK},
+  #else
+    {"FAILED_TO_CREATE_LOCK", 57, 180},
+  #endif
+  #ifdef PROV_R_FAILED_TO_DECRYPT
+    {"FAILED_TO_DECRYPT", ERR_LIB_PROV, PROV_R_FAILED_TO_DECRYPT},
+  #else
+    {"FAILED_TO_DECRYPT", 57, 162},
+  #endif
+  #ifdef PROV_R_FAILED_TO_GENERATE_KEY
+    {"FAILED_TO_GENERATE_KEY", ERR_LIB_PROV, PROV_R_FAILED_TO_GENERATE_KEY},
+  #else
+    {"FAILED_TO_GENERATE_KEY", 57, 121},
+  #endif
+  #ifdef PROV_R_FAILED_TO_GET_PARAMETER
+    {"FAILED_TO_GET_PARAMETER", ERR_LIB_PROV, PROV_R_FAILED_TO_GET_PARAMETER},
+  #else
+    {"FAILED_TO_GET_PARAMETER", 57, 103},
+  #endif
+  #ifdef PROV_R_FAILED_TO_SET_PARAMETER
+    {"FAILED_TO_SET_PARAMETER", ERR_LIB_PROV, PROV_R_FAILED_TO_SET_PARAMETER},
+  #else
+    {"FAILED_TO_SET_PARAMETER", 57, 104},
+  #endif
+  #ifdef PROV_R_FAILED_TO_SIGN
+    {"FAILED_TO_SIGN", ERR_LIB_PROV, PROV_R_FAILED_TO_SIGN},
+  #else
+    {"FAILED_TO_SIGN", 57, 175},
+  #endif
+  #ifdef PROV_R_FIPS_MODULE_CONDITIONAL_ERROR
+    {"FIPS_MODULE_CONDITIONAL_ERROR", ERR_LIB_PROV, PROV_R_FIPS_MODULE_CONDITIONAL_ERROR},
+  #else
+    {"FIPS_MODULE_CONDITIONAL_ERROR", 57, 227},
+  #endif
+  #ifdef PROV_R_FIPS_MODULE_ENTERING_ERROR_STATE
+    {"FIPS_MODULE_ENTERING_ERROR_STATE", ERR_LIB_PROV, PROV_R_FIPS_MODULE_ENTERING_ERROR_STATE},
+  #else
+    {"FIPS_MODULE_ENTERING_ERROR_STATE", 57, 224},
+  #endif
+  #ifdef PROV_R_FIPS_MODULE_IN_ERROR_STATE
+    {"FIPS_MODULE_IN_ERROR_STATE", ERR_LIB_PROV, PROV_R_FIPS_MODULE_IN_ERROR_STATE},
+  #else
+    {"FIPS_MODULE_IN_ERROR_STATE", 57, 225},
+  #endif
+  #ifdef PROV_R_GENERATE_ERROR
+    {"GENERATE_ERROR", ERR_LIB_PROV, PROV_R_GENERATE_ERROR},
+  #else
+    {"GENERATE_ERROR", 57, 191},
+  #endif
+  #ifdef PROV_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE
+    {"ILLEGAL_OR_UNSUPPORTED_PADDING_MODE", ERR_LIB_PROV, PROV_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE},
+  #else
+    {"ILLEGAL_OR_UNSUPPORTED_PADDING_MODE", 57, 165},
+  #endif
+  #ifdef PROV_R_INDICATOR_INTEGRITY_FAILURE
+    {"INDICATOR_INTEGRITY_FAILURE", ERR_LIB_PROV, PROV_R_INDICATOR_INTEGRITY_FAILURE},
+  #else
+    {"INDICATOR_INTEGRITY_FAILURE", 57, 210},
+  #endif
+  #ifdef PROV_R_INSUFFICIENT_DRBG_STRENGTH
+    {"INSUFFICIENT_DRBG_STRENGTH", ERR_LIB_PROV, PROV_R_INSUFFICIENT_DRBG_STRENGTH},
+  #else
+    {"INSUFFICIENT_DRBG_STRENGTH", 57, 181},
+  #endif
+  #ifdef PROV_R_INVALID_AAD
+    {"INVALID_AAD", ERR_LIB_PROV, PROV_R_INVALID_AAD},
+  #else
+    {"INVALID_AAD", 57, 108},
+  #endif
+  #ifdef PROV_R_INVALID_CONFIG_DATA
+    {"INVALID_CONFIG_DATA", ERR_LIB_PROV, PROV_R_INVALID_CONFIG_DATA},
+  #else
+    {"INVALID_CONFIG_DATA", 57, 211},
+  #endif
+  #ifdef PROV_R_INVALID_CONSTANT_LENGTH
+    {"INVALID_CONSTANT_LENGTH", ERR_LIB_PROV, PROV_R_INVALID_CONSTANT_LENGTH},
+  #else
+    {"INVALID_CONSTANT_LENGTH", 57, 157},
+  #endif
+  #ifdef PROV_R_INVALID_CURVE
+    {"INVALID_CURVE", ERR_LIB_PROV, PROV_R_INVALID_CURVE},
+  #else
+    {"INVALID_CURVE", 57, 176},
+  #endif
+  #ifdef PROV_R_INVALID_CUSTOM_LENGTH
+    {"INVALID_CUSTOM_LENGTH", ERR_LIB_PROV, PROV_R_INVALID_CUSTOM_LENGTH},
+  #else
+    {"INVALID_CUSTOM_LENGTH", 57, 111},
+  #endif
+  #ifdef PROV_R_INVALID_DATA
+    {"INVALID_DATA", ERR_LIB_PROV, PROV_R_INVALID_DATA},
+  #else
+    {"INVALID_DATA", 57, 115},
+  #endif
+  #ifdef PROV_R_INVALID_DIGEST
+    {"INVALID_DIGEST", ERR_LIB_PROV, PROV_R_INVALID_DIGEST},
+  #else
+    {"INVALID_DIGEST", 57, 122},
+  #endif
+  #ifdef PROV_R_INVALID_DIGEST_LENGTH
+    {"INVALID_DIGEST_LENGTH", ERR_LIB_PROV, PROV_R_INVALID_DIGEST_LENGTH},
+  #else
+    {"INVALID_DIGEST_LENGTH", 57, 166},
+  #endif
+  #ifdef PROV_R_INVALID_DIGEST_SIZE
+    {"INVALID_DIGEST_SIZE", ERR_LIB_PROV, PROV_R_INVALID_DIGEST_SIZE},
+  #else
+    {"INVALID_DIGEST_SIZE", 57, 218},
+  #endif
+  #ifdef PROV_R_INVALID_ITERATION_COUNT
+    {"INVALID_ITERATION_COUNT", ERR_LIB_PROV, PROV_R_INVALID_ITERATION_COUNT},
+  #else
+    {"INVALID_ITERATION_COUNT", 57, 123},
+  #endif
+  #ifdef PROV_R_INVALID_IV_LENGTH
+    {"INVALID_IV_LENGTH", ERR_LIB_PROV, PROV_R_INVALID_IV_LENGTH},
+  #else
+    {"INVALID_IV_LENGTH", 57, 109},
+  #endif
+  #ifdef PROV_R_INVALID_KEY
+    {"INVALID_KEY", ERR_LIB_PROV, PROV_R_INVALID_KEY},
+  #else
+    {"INVALID_KEY", 57, 158},
+  #endif
+  #ifdef PROV_R_INVALID_KEY_LENGTH
+    {"INVALID_KEY_LENGTH", ERR_LIB_PROV, PROV_R_INVALID_KEY_LENGTH},
+  #else
+    {"INVALID_KEY_LENGTH", 57, 105},
+  #endif
+  #ifdef PROV_R_INVALID_MAC
+    {"INVALID_MAC", ERR_LIB_PROV, PROV_R_INVALID_MAC},
+  #else
+    {"INVALID_MAC", 57, 151},
+  #endif
+  #ifdef PROV_R_INVALID_MGF1_MD
+    {"INVALID_MGF1_MD", ERR_LIB_PROV, PROV_R_INVALID_MGF1_MD},
+  #else
+    {"INVALID_MGF1_MD", 57, 167},
+  #endif
+  #ifdef PROV_R_INVALID_MODE
+    {"INVALID_MODE", ERR_LIB_PROV, PROV_R_INVALID_MODE},
+  #else
+    {"INVALID_MODE", 57, 125},
+  #endif
+  #ifdef PROV_R_INVALID_PADDING_MODE
+    {"INVALID_PADDING_MODE", ERR_LIB_PROV, PROV_R_INVALID_PADDING_MODE},
+  #else
+    {"INVALID_PADDING_MODE", 57, 168},
+  #endif
+  #ifdef PROV_R_INVALID_PUBINFO
+    {"INVALID_PUBINFO", ERR_LIB_PROV, PROV_R_INVALID_PUBINFO},
+  #else
+    {"INVALID_PUBINFO", 57, 198},
+  #endif
+  #ifdef PROV_R_INVALID_SALT_LENGTH
+    {"INVALID_SALT_LENGTH", ERR_LIB_PROV, PROV_R_INVALID_SALT_LENGTH},
+  #else
+    {"INVALID_SALT_LENGTH", 57, 112},
+  #endif
+  #ifdef PROV_R_INVALID_SEED_LENGTH
+    {"INVALID_SEED_LENGTH", ERR_LIB_PROV, PROV_R_INVALID_SEED_LENGTH},
+  #else
+    {"INVALID_SEED_LENGTH", 57, 154},
+  #endif
+  #ifdef PROV_R_INVALID_SIGNATURE_SIZE
+    {"INVALID_SIGNATURE_SIZE", ERR_LIB_PROV, PROV_R_INVALID_SIGNATURE_SIZE},
+  #else
+    {"INVALID_SIGNATURE_SIZE", 57, 179},
+  #endif
+  #ifdef PROV_R_INVALID_STATE
+    {"INVALID_STATE", ERR_LIB_PROV, PROV_R_INVALID_STATE},
+  #else
+    {"INVALID_STATE", 57, 212},
+  #endif
+  #ifdef PROV_R_INVALID_TAG
+    {"INVALID_TAG", ERR_LIB_PROV, PROV_R_INVALID_TAG},
+  #else
+    {"INVALID_TAG", 57, 110},
+  #endif
+  #ifdef PROV_R_INVALID_TAG_LENGTH
+    {"INVALID_TAG_LENGTH", ERR_LIB_PROV, PROV_R_INVALID_TAG_LENGTH},
+  #else
+    {"INVALID_TAG_LENGTH", 57, 118},
+  #endif
+  #ifdef PROV_R_INVALID_UKM_LENGTH
+    {"INVALID_UKM_LENGTH", ERR_LIB_PROV, PROV_R_INVALID_UKM_LENGTH},
+  #else
+    {"INVALID_UKM_LENGTH", 57, 200},
+  #endif
+  #ifdef PROV_R_INVALID_X931_DIGEST
+    {"INVALID_X931_DIGEST", ERR_LIB_PROV, PROV_R_INVALID_X931_DIGEST},
+  #else
+    {"INVALID_X931_DIGEST", 57, 170},
+  #endif
+  #ifdef PROV_R_IN_ERROR_STATE
+    {"IN_ERROR_STATE", ERR_LIB_PROV, PROV_R_IN_ERROR_STATE},
+  #else
+    {"IN_ERROR_STATE", 57, 192},
+  #endif
+  #ifdef PROV_R_KEY_SETUP_FAILED
+    {"KEY_SETUP_FAILED", ERR_LIB_PROV, PROV_R_KEY_SETUP_FAILED},
+  #else
+    {"KEY_SETUP_FAILED", 57, 101},
+  #endif
+  #ifdef PROV_R_KEY_SIZE_TOO_SMALL
+    {"KEY_SIZE_TOO_SMALL", ERR_LIB_PROV, PROV_R_KEY_SIZE_TOO_SMALL},
+  #else
+    {"KEY_SIZE_TOO_SMALL", 57, 171},
+  #endif
+  #ifdef PROV_R_MISSING_CEK_ALG
+    {"MISSING_CEK_ALG", ERR_LIB_PROV, PROV_R_MISSING_CEK_ALG},
+  #else
+    {"MISSING_CEK_ALG", 57, 144},
+  #endif
+  #ifdef PROV_R_MISSING_CIPHER
+    {"MISSING_CIPHER", ERR_LIB_PROV, PROV_R_MISSING_CIPHER},
+  #else
+    {"MISSING_CIPHER", 57, 155},
+  #endif
+  #ifdef PROV_R_MISSING_CONFIG_DATA
+    {"MISSING_CONFIG_DATA", ERR_LIB_PROV, PROV_R_MISSING_CONFIG_DATA},
+  #else
+    {"MISSING_CONFIG_DATA", 57, 213},
+  #endif
+  #ifdef PROV_R_MISSING_CONSTANT
+    {"MISSING_CONSTANT", ERR_LIB_PROV, PROV_R_MISSING_CONSTANT},
+  #else
+    {"MISSING_CONSTANT", 57, 156},
+  #endif
+  #ifdef PROV_R_MISSING_KEY
+    {"MISSING_KEY", ERR_LIB_PROV, PROV_R_MISSING_KEY},
+  #else
+    {"MISSING_KEY", 57, 128},
+  #endif
+  #ifdef PROV_R_MISSING_MAC
+    {"MISSING_MAC", ERR_LIB_PROV, PROV_R_MISSING_MAC},
+  #else
+    {"MISSING_MAC", 57, 150},
+  #endif
+  #ifdef PROV_R_MISSING_MESSAGE_DIGEST
+    {"MISSING_MESSAGE_DIGEST", ERR_LIB_PROV, PROV_R_MISSING_MESSAGE_DIGEST},
+  #else
+    {"MISSING_MESSAGE_DIGEST", 57, 129},
+  #endif
+  #ifdef PROV_R_MISSING_OID
+    {"MISSING_OID", ERR_LIB_PROV, PROV_R_MISSING_OID},
+  #else
+    {"MISSING_OID", 57, 209},
+  #endif
+  #ifdef PROV_R_MISSING_PASS
+    {"MISSING_PASS", ERR_LIB_PROV, PROV_R_MISSING_PASS},
+  #else
+    {"MISSING_PASS", 57, 130},
+  #endif
+  #ifdef PROV_R_MISSING_SALT
+    {"MISSING_SALT", ERR_LIB_PROV, PROV_R_MISSING_SALT},
+  #else
+    {"MISSING_SALT", 57, 131},
+  #endif
+  #ifdef PROV_R_MISSING_SECRET
+    {"MISSING_SECRET", ERR_LIB_PROV, PROV_R_MISSING_SECRET},
+  #else
+    {"MISSING_SECRET", 57, 132},
+  #endif
+  #ifdef PROV_R_MISSING_SEED
+    {"MISSING_SEED", ERR_LIB_PROV, PROV_R_MISSING_SEED},
+  #else
+    {"MISSING_SEED", 57, 140},
+  #endif
+  #ifdef PROV_R_MISSING_SESSION_ID
+    {"MISSING_SESSION_ID", ERR_LIB_PROV, PROV_R_MISSING_SESSION_ID},
+  #else
+    {"MISSING_SESSION_ID", 57, 133},
+  #endif
+  #ifdef PROV_R_MISSING_TYPE
+    {"MISSING_TYPE", ERR_LIB_PROV, PROV_R_MISSING_TYPE},
+  #else
+    {"MISSING_TYPE", 57, 134},
+  #endif
+  #ifdef PROV_R_MISSING_XCGHASH
+    {"MISSING_XCGHASH", ERR_LIB_PROV, PROV_R_MISSING_XCGHASH},
+  #else
+    {"MISSING_XCGHASH", 57, 135},
+  #endif
+  #ifdef PROV_R_MODULE_INTEGRITY_FAILURE
+    {"MODULE_INTEGRITY_FAILURE", ERR_LIB_PROV, PROV_R_MODULE_INTEGRITY_FAILURE},
+  #else
+    {"MODULE_INTEGRITY_FAILURE", 57, 214},
+  #endif
+  #ifdef PROV_R_NOT_A_PRIVATE_KEY
+    {"NOT_A_PRIVATE_KEY", ERR_LIB_PROV, PROV_R_NOT_A_PRIVATE_KEY},
+  #else
+    {"NOT_A_PRIVATE_KEY", 57, 221},
+  #endif
+  #ifdef PROV_R_NOT_A_PUBLIC_KEY
+    {"NOT_A_PUBLIC_KEY", ERR_LIB_PROV, PROV_R_NOT_A_PUBLIC_KEY},
+  #else
+    {"NOT_A_PUBLIC_KEY", 57, 220},
+  #endif
+  #ifdef PROV_R_NOT_INSTANTIATED
+    {"NOT_INSTANTIATED", ERR_LIB_PROV, PROV_R_NOT_INSTANTIATED},
+  #else
+    {"NOT_INSTANTIATED", 57, 193},
+  #endif
+  #ifdef PROV_R_NOT_PARAMETERS
+    {"NOT_PARAMETERS", ERR_LIB_PROV, PROV_R_NOT_PARAMETERS},
+  #else
+    {"NOT_PARAMETERS", 57, 226},
+  #endif
+  #ifdef PROV_R_NOT_SUPPORTED
+    {"NOT_SUPPORTED", ERR_LIB_PROV, PROV_R_NOT_SUPPORTED},
+  #else
+    {"NOT_SUPPORTED", 57, 136},
+  #endif
+  #ifdef PROV_R_NOT_XOF_OR_INVALID_LENGTH
+    {"NOT_XOF_OR_INVALID_LENGTH", ERR_LIB_PROV, PROV_R_NOT_XOF_OR_INVALID_LENGTH},
+  #else
+    {"NOT_XOF_OR_INVALID_LENGTH", 57, 113},
+  #endif
+  #ifdef PROV_R_NO_KEY_SET
+    {"NO_KEY_SET", ERR_LIB_PROV, PROV_R_NO_KEY_SET},
+  #else
+    {"NO_KEY_SET", 57, 114},
+  #endif
+  #ifdef PROV_R_NO_PARAMETERS_SET
+    {"NO_PARAMETERS_SET", ERR_LIB_PROV, PROV_R_NO_PARAMETERS_SET},
+  #else
+    {"NO_PARAMETERS_SET", 57, 177},
+  #endif
+  #ifdef PROV_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE
+    {"OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE", ERR_LIB_PROV, PROV_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE},
+  #else
+    {"OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE", 57, 178},
+  #endif
+  #ifdef PROV_R_OUTPUT_BUFFER_TOO_SMALL
+    {"OUTPUT_BUFFER_TOO_SMALL", ERR_LIB_PROV, PROV_R_OUTPUT_BUFFER_TOO_SMALL},
+  #else
+    {"OUTPUT_BUFFER_TOO_SMALL", 57, 106},
+  #endif
+  #ifdef PROV_R_PARENT_CANNOT_GENERATE_RANDOM_NUMBERS
+    {"PARENT_CANNOT_GENERATE_RANDOM_NUMBERS", ERR_LIB_PROV, PROV_R_PARENT_CANNOT_GENERATE_RANDOM_NUMBERS},
+  #else
+    {"PARENT_CANNOT_GENERATE_RANDOM_NUMBERS", 57, 228},
+  #endif
+  #ifdef PROV_R_PARENT_CANNOT_SUPPLY_ENTROPY_SEED
+    {"PARENT_CANNOT_SUPPLY_ENTROPY_SEED", ERR_LIB_PROV, PROV_R_PARENT_CANNOT_SUPPLY_ENTROPY_SEED},
+  #else
+    {"PARENT_CANNOT_SUPPLY_ENTROPY_SEED", 57, 187},
+  #endif
+  #ifdef PROV_R_PARENT_LOCKING_NOT_ENABLED
+    {"PARENT_LOCKING_NOT_ENABLED", ERR_LIB_PROV, PROV_R_PARENT_LOCKING_NOT_ENABLED},
+  #else
+    {"PARENT_LOCKING_NOT_ENABLED", 57, 182},
+  #endif
+  #ifdef PROV_R_PARENT_STRENGTH_TOO_WEAK
+    {"PARENT_STRENGTH_TOO_WEAK", ERR_LIB_PROV, PROV_R_PARENT_STRENGTH_TOO_WEAK},
+  #else
+    {"PARENT_STRENGTH_TOO_WEAK", 57, 194},
+  #endif
+  #ifdef PROV_R_PATH_MUST_BE_ABSOLUTE
+    {"PATH_MUST_BE_ABSOLUTE", ERR_LIB_PROV, PROV_R_PATH_MUST_BE_ABSOLUTE},
+  #else
+    {"PATH_MUST_BE_ABSOLUTE", 57, 219},
+  #endif
+  #ifdef PROV_R_PERSONALISATION_STRING_TOO_LONG
+    {"PERSONALISATION_STRING_TOO_LONG", ERR_LIB_PROV, PROV_R_PERSONALISATION_STRING_TOO_LONG},
+  #else
+    {"PERSONALISATION_STRING_TOO_LONG", 57, 195},
+  #endif
+  #ifdef PROV_R_PSS_SALTLEN_TOO_SMALL
+    {"PSS_SALTLEN_TOO_SMALL", ERR_LIB_PROV, PROV_R_PSS_SALTLEN_TOO_SMALL},
+  #else
+    {"PSS_SALTLEN_TOO_SMALL", 57, 172},
+  #endif
+  #ifdef PROV_R_REQUEST_TOO_LARGE_FOR_DRBG
+    {"REQUEST_TOO_LARGE_FOR_DRBG", ERR_LIB_PROV, PROV_R_REQUEST_TOO_LARGE_FOR_DRBG},
+  #else
+    {"REQUEST_TOO_LARGE_FOR_DRBG", 57, 196},
+  #endif
+  #ifdef PROV_R_REQUIRE_CTR_MODE_CIPHER
+    {"REQUIRE_CTR_MODE_CIPHER", ERR_LIB_PROV, PROV_R_REQUIRE_CTR_MODE_CIPHER},
+  #else
+    {"REQUIRE_CTR_MODE_CIPHER", 57, 206},
+  #endif
+  #ifdef PROV_R_RESEED_ERROR
+    {"RESEED_ERROR", ERR_LIB_PROV, PROV_R_RESEED_ERROR},
+  #else
+    {"RESEED_ERROR", 57, 197},
+  #endif
+  #ifdef PROV_R_SEARCH_ONLY_SUPPORTED_FOR_DIRECTORIES
+    {"SEARCH_ONLY_SUPPORTED_FOR_DIRECTORIES", ERR_LIB_PROV, PROV_R_SEARCH_ONLY_SUPPORTED_FOR_DIRECTORIES},
+  #else
+    {"SEARCH_ONLY_SUPPORTED_FOR_DIRECTORIES", 57, 222},
+  #endif
+  #ifdef PROV_R_SEED_SOURCES_MUST_NOT_HAVE_A_PARENT
+    {"SEED_SOURCES_MUST_NOT_HAVE_A_PARENT", ERR_LIB_PROV, PROV_R_SEED_SOURCES_MUST_NOT_HAVE_A_PARENT},
+  #else
+    {"SEED_SOURCES_MUST_NOT_HAVE_A_PARENT", 57, 229},
+  #endif
+  #ifdef PROV_R_SELF_TEST_KAT_FAILURE
+    {"SELF_TEST_KAT_FAILURE", ERR_LIB_PROV, PROV_R_SELF_TEST_KAT_FAILURE},
+  #else
+    {"SELF_TEST_KAT_FAILURE", 57, 215},
+  #endif
+  #ifdef PROV_R_SELF_TEST_POST_FAILURE
+    {"SELF_TEST_POST_FAILURE", ERR_LIB_PROV, PROV_R_SELF_TEST_POST_FAILURE},
+  #else
+    {"SELF_TEST_POST_FAILURE", 57, 216},
+  #endif
+  #ifdef PROV_R_TAG_NOT_NEEDED
+    {"TAG_NOT_NEEDED", ERR_LIB_PROV, PROV_R_TAG_NOT_NEEDED},
+  #else
+    {"TAG_NOT_NEEDED", 57, 120},
+  #endif
+  #ifdef PROV_R_TAG_NOT_SET
+    {"TAG_NOT_SET", ERR_LIB_PROV, PROV_R_TAG_NOT_SET},
+  #else
+    {"TAG_NOT_SET", 57, 119},
+  #endif
+  #ifdef PROV_R_TOO_MANY_RECORDS
+    {"TOO_MANY_RECORDS", ERR_LIB_PROV, PROV_R_TOO_MANY_RECORDS},
+  #else
+    {"TOO_MANY_RECORDS", 57, 126},
+  #endif
+  #ifdef PROV_R_UNABLE_TO_FIND_CIPHERS
+    {"UNABLE_TO_FIND_CIPHERS", ERR_LIB_PROV, PROV_R_UNABLE_TO_FIND_CIPHERS},
+  #else
+    {"UNABLE_TO_FIND_CIPHERS", 57, 207},
+  #endif
+  #ifdef PROV_R_UNABLE_TO_GET_PARENT_STRENGTH
+    {"UNABLE_TO_GET_PARENT_STRENGTH", ERR_LIB_PROV, PROV_R_UNABLE_TO_GET_PARENT_STRENGTH},
+  #else
+    {"UNABLE_TO_GET_PARENT_STRENGTH", 57, 199},
+  #endif
+  #ifdef PROV_R_UNABLE_TO_GET_PASSPHRASE
+    {"UNABLE_TO_GET_PASSPHRASE", ERR_LIB_PROV, PROV_R_UNABLE_TO_GET_PASSPHRASE},
+  #else
+    {"UNABLE_TO_GET_PASSPHRASE", 57, 159},
+  #endif
+  #ifdef PROV_R_UNABLE_TO_INITIALISE_CIPHERS
+    {"UNABLE_TO_INITIALISE_CIPHERS", ERR_LIB_PROV, PROV_R_UNABLE_TO_INITIALISE_CIPHERS},
+  #else
+    {"UNABLE_TO_INITIALISE_CIPHERS", 57, 208},
+  #endif
+  #ifdef PROV_R_UNABLE_TO_LOAD_SHA256
+    {"UNABLE_TO_LOAD_SHA256", ERR_LIB_PROV, PROV_R_UNABLE_TO_LOAD_SHA256},
+  #else
+    {"UNABLE_TO_LOAD_SHA256", 57, 147},
+  #endif
+  #ifdef PROV_R_UNABLE_TO_LOCK_PARENT
+    {"UNABLE_TO_LOCK_PARENT", ERR_LIB_PROV, PROV_R_UNABLE_TO_LOCK_PARENT},
+  #else
+    {"UNABLE_TO_LOCK_PARENT", 57, 201},
+  #endif
+  #ifdef PROV_R_UNABLE_TO_RESEED
+    {"UNABLE_TO_RESEED", ERR_LIB_PROV, PROV_R_UNABLE_TO_RESEED},
+  #else
+    {"UNABLE_TO_RESEED", 57, 204},
+  #endif
+  #ifdef PROV_R_UNSUPPORTED_CEK_ALG
+    {"UNSUPPORTED_CEK_ALG", ERR_LIB_PROV, PROV_R_UNSUPPORTED_CEK_ALG},
+  #else
+    {"UNSUPPORTED_CEK_ALG", 57, 145},
+  #endif
+  #ifdef PROV_R_UNSUPPORTED_KEY_SIZE
+    {"UNSUPPORTED_KEY_SIZE", ERR_LIB_PROV, PROV_R_UNSUPPORTED_KEY_SIZE},
+  #else
+    {"UNSUPPORTED_KEY_SIZE", 57, 153},
+  #endif
+  #ifdef PROV_R_UNSUPPORTED_MAC_TYPE
+    {"UNSUPPORTED_MAC_TYPE", ERR_LIB_PROV, PROV_R_UNSUPPORTED_MAC_TYPE},
+  #else
+    {"UNSUPPORTED_MAC_TYPE", 57, 137},
+  #endif
+  #ifdef PROV_R_UNSUPPORTED_NUMBER_OF_ROUNDS
+    {"UNSUPPORTED_NUMBER_OF_ROUNDS", ERR_LIB_PROV, PROV_R_UNSUPPORTED_NUMBER_OF_ROUNDS},
+  #else
+    {"UNSUPPORTED_NUMBER_OF_ROUNDS", 57, 152},
+  #endif
+  #ifdef PROV_R_URI_AUTHORITY_UNSUPPORTED
+    {"URI_AUTHORITY_UNSUPPORTED", ERR_LIB_PROV, PROV_R_URI_AUTHORITY_UNSUPPORTED},
+  #else
+    {"URI_AUTHORITY_UNSUPPORTED", 57, 223},
+  #endif
+  #ifdef PROV_R_VALUE_ERROR
+    {"VALUE_ERROR", ERR_LIB_PROV, PROV_R_VALUE_ERROR},
+  #else
+    {"VALUE_ERROR", 57, 138},
+  #endif
+  #ifdef PROV_R_WRONG_FINAL_BLOCK_LENGTH
+    {"WRONG_FINAL_BLOCK_LENGTH", ERR_LIB_PROV, PROV_R_WRONG_FINAL_BLOCK_LENGTH},
+  #else
+    {"WRONG_FINAL_BLOCK_LENGTH", 57, 107},
+  #endif
+  #ifdef PROV_R_WRONG_OUTPUT_BUFFER_SIZE
+    {"WRONG_OUTPUT_BUFFER_SIZE", ERR_LIB_PROV, PROV_R_WRONG_OUTPUT_BUFFER_SIZE},
+  #else
+    {"WRONG_OUTPUT_BUFFER_SIZE", 57, 139},
+  #endif
+  #ifdef PROV_R_XOF_DIGESTS_NOT_ALLOWED
+    {"XOF_DIGESTS_NOT_ALLOWED", ERR_LIB_PROV, PROV_R_XOF_DIGESTS_NOT_ALLOWED},
+  #else
+    {"XOF_DIGESTS_NOT_ALLOWED", 57, 183},
+  #endif
+  #ifdef PROV_R_XTS_DATA_UNIT_IS_TOO_LARGE
+    {"XTS_DATA_UNIT_IS_TOO_LARGE", ERR_LIB_PROV, PROV_R_XTS_DATA_UNIT_IS_TOO_LARGE},
+  #else
+    {"XTS_DATA_UNIT_IS_TOO_LARGE", 57, 148},
+  #endif
+  #ifdef PROV_R_XTS_DUPLICATED_KEYS
+    {"XTS_DUPLICATED_KEYS", ERR_LIB_PROV, PROV_R_XTS_DUPLICATED_KEYS},
+  #else
+    {"XTS_DUPLICATED_KEYS", 57, 149},
+  #endif
+  #ifdef RAND_R_ADDITIONAL_INPUT_TOO_LONG
+    {"ADDITIONAL_INPUT_TOO_LONG", ERR_LIB_RAND, RAND_R_ADDITIONAL_INPUT_TOO_LONG},
+  #else
+    {"ADDITIONAL_INPUT_TOO_LONG", 36, 102},
+  #endif
+  #ifdef RAND_R_ALREADY_INSTANTIATED
+    {"ALREADY_INSTANTIATED", ERR_LIB_RAND, RAND_R_ALREADY_INSTANTIATED},
+  #else
+    {"ALREADY_INSTANTIATED", 36, 103},
+  #endif
+  #ifdef RAND_R_ARGUMENT_OUT_OF_RANGE
+    {"ARGUMENT_OUT_OF_RANGE", ERR_LIB_RAND, RAND_R_ARGUMENT_OUT_OF_RANGE},
+  #else
+    {"ARGUMENT_OUT_OF_RANGE", 36, 105},
+  #endif
+  #ifdef RAND_R_CANNOT_OPEN_FILE
+    {"CANNOT_OPEN_FILE", ERR_LIB_RAND, RAND_R_CANNOT_OPEN_FILE},
+  #else
+    {"CANNOT_OPEN_FILE", 36, 121},
+  #endif
+  #ifdef RAND_R_DERIVATION_FUNCTION_MANDATORY_FOR_FIPS
+    {"DERIVATION_FUNCTION_MANDATORY_FOR_FIPS", ERR_LIB_RAND, RAND_R_DERIVATION_FUNCTION_MANDATORY_FOR_FIPS},
+  #else
+    {"DERIVATION_FUNCTION_MANDATORY_FOR_FIPS", 36, 137},
+  #endif
+  #ifdef RAND_R_DRBG_ALREADY_INITIALIZED
+    {"DRBG_ALREADY_INITIALIZED", ERR_LIB_RAND, RAND_R_DRBG_ALREADY_INITIALIZED},
+  #else
+    {"DRBG_ALREADY_INITIALIZED", 36, 129},
+  #endif
+  #ifdef RAND_R_DRBG_NOT_INITIALISED
+    {"DRBG_NOT_INITIALISED", ERR_LIB_RAND, RAND_R_DRBG_NOT_INITIALISED},
+  #else
+    {"DRBG_NOT_INITIALISED", 36, 104},
+  #endif
+  #ifdef RAND_R_ENTROPY_INPUT_TOO_LONG
+    {"ENTROPY_INPUT_TOO_LONG", ERR_LIB_RAND, RAND_R_ENTROPY_INPUT_TOO_LONG},
+  #else
+    {"ENTROPY_INPUT_TOO_LONG", 36, 106},
+  #endif
+  #ifdef RAND_R_ENTROPY_OUT_OF_RANGE
+    {"ENTROPY_OUT_OF_RANGE", ERR_LIB_RAND, RAND_R_ENTROPY_OUT_OF_RANGE},
+  #else
+    {"ENTROPY_OUT_OF_RANGE", 36, 124},
+  #endif
+  #ifdef RAND_R_ERROR_ENTROPY_POOL_WAS_IGNORED
+    {"ERROR_ENTROPY_POOL_WAS_IGNORED", ERR_LIB_RAND, RAND_R_ERROR_ENTROPY_POOL_WAS_IGNORED},
+  #else
+    {"ERROR_ENTROPY_POOL_WAS_IGNORED", 36, 127},
+  #endif
+  #ifdef RAND_R_ERROR_INITIALISING_DRBG
+    {"ERROR_INITIALISING_DRBG", ERR_LIB_RAND, RAND_R_ERROR_INITIALISING_DRBG},
+  #else
+    {"ERROR_INITIALISING_DRBG", 36, 107},
+  #endif
+  #ifdef RAND_R_ERROR_INSTANTIATING_DRBG
+    {"ERROR_INSTANTIATING_DRBG", ERR_LIB_RAND, RAND_R_ERROR_INSTANTIATING_DRBG},
+  #else
+    {"ERROR_INSTANTIATING_DRBG", 36, 108},
+  #endif
+  #ifdef RAND_R_ERROR_RETRIEVING_ADDITIONAL_INPUT
+    {"ERROR_RETRIEVING_ADDITIONAL_INPUT", ERR_LIB_RAND, RAND_R_ERROR_RETRIEVING_ADDITIONAL_INPUT},
+  #else
+    {"ERROR_RETRIEVING_ADDITIONAL_INPUT", 36, 109},
+  #endif
+  #ifdef RAND_R_ERROR_RETRIEVING_ENTROPY
+    {"ERROR_RETRIEVING_ENTROPY", ERR_LIB_RAND, RAND_R_ERROR_RETRIEVING_ENTROPY},
+  #else
+    {"ERROR_RETRIEVING_ENTROPY", 36, 110},
+  #endif
+  #ifdef RAND_R_ERROR_RETRIEVING_NONCE
+    {"ERROR_RETRIEVING_NONCE", ERR_LIB_RAND, RAND_R_ERROR_RETRIEVING_NONCE},
+  #else
+    {"ERROR_RETRIEVING_NONCE", 36, 111},
+  #endif
+  #ifdef RAND_R_FAILED_TO_CREATE_LOCK
+    {"FAILED_TO_CREATE_LOCK", ERR_LIB_RAND, RAND_R_FAILED_TO_CREATE_LOCK},
+  #else
+    {"FAILED_TO_CREATE_LOCK", 36, 126},
+  #endif
+  #ifdef RAND_R_FUNC_NOT_IMPLEMENTED
+    {"FUNC_NOT_IMPLEMENTED", ERR_LIB_RAND, RAND_R_FUNC_NOT_IMPLEMENTED},
+  #else
+    {"FUNC_NOT_IMPLEMENTED", 36, 101},
+  #endif
+  #ifdef RAND_R_FWRITE_ERROR
+    {"FWRITE_ERROR", ERR_LIB_RAND, RAND_R_FWRITE_ERROR},
+  #else
+    {"FWRITE_ERROR", 36, 123},
+  #endif
+  #ifdef RAND_R_GENERATE_ERROR
+    {"GENERATE_ERROR", ERR_LIB_RAND, RAND_R_GENERATE_ERROR},
+  #else
+    {"GENERATE_ERROR", 36, 112},
+  #endif
+  #ifdef RAND_R_INSUFFICIENT_DRBG_STRENGTH
+    {"INSUFFICIENT_DRBG_STRENGTH", ERR_LIB_RAND, RAND_R_INSUFFICIENT_DRBG_STRENGTH},
+  #else
+    {"INSUFFICIENT_DRBG_STRENGTH", 36, 139},
+  #endif
+  #ifdef RAND_R_INTERNAL_ERROR
+    {"INTERNAL_ERROR", ERR_LIB_RAND, RAND_R_INTERNAL_ERROR},
+  #else
+    {"INTERNAL_ERROR", 36, 113},
+  #endif
+  #ifdef RAND_R_IN_ERROR_STATE
+    {"IN_ERROR_STATE", ERR_LIB_RAND, RAND_R_IN_ERROR_STATE},
+  #else
+    {"IN_ERROR_STATE", 36, 114},
+  #endif
+  #ifdef RAND_R_NOT_A_REGULAR_FILE
+    {"NOT_A_REGULAR_FILE", ERR_LIB_RAND, RAND_R_NOT_A_REGULAR_FILE},
+  #else
+    {"NOT_A_REGULAR_FILE", 36, 122},
+  #endif
+  #ifdef RAND_R_NOT_INSTANTIATED
+    {"NOT_INSTANTIATED", ERR_LIB_RAND, RAND_R_NOT_INSTANTIATED},
+  #else
+    {"NOT_INSTANTIATED", 36, 115},
+  #endif
+  #ifdef RAND_R_NO_DRBG_IMPLEMENTATION_SELECTED
+    {"NO_DRBG_IMPLEMENTATION_SELECTED", ERR_LIB_RAND, RAND_R_NO_DRBG_IMPLEMENTATION_SELECTED},
+  #else
+    {"NO_DRBG_IMPLEMENTATION_SELECTED", 36, 128},
+  #endif
+  #ifdef RAND_R_PARENT_LOCKING_NOT_ENABLED
+    {"PARENT_LOCKING_NOT_ENABLED", ERR_LIB_RAND, RAND_R_PARENT_LOCKING_NOT_ENABLED},
+  #else
+    {"PARENT_LOCKING_NOT_ENABLED", 36, 130},
+  #endif
+  #ifdef RAND_R_PARENT_STRENGTH_TOO_WEAK
+    {"PARENT_STRENGTH_TOO_WEAK", ERR_LIB_RAND, RAND_R_PARENT_STRENGTH_TOO_WEAK},
+  #else
+    {"PARENT_STRENGTH_TOO_WEAK", 36, 131},
+  #endif
+  #ifdef RAND_R_PERSONALISATION_STRING_TOO_LONG
+    {"PERSONALISATION_STRING_TOO_LONG", ERR_LIB_RAND, RAND_R_PERSONALISATION_STRING_TOO_LONG},
+  #else
+    {"PERSONALISATION_STRING_TOO_LONG", 36, 116},
+  #endif
+  #ifdef RAND_R_PREDICTION_RESISTANCE_NOT_SUPPORTED
+    {"PREDICTION_RESISTANCE_NOT_SUPPORTED", ERR_LIB_RAND, RAND_R_PREDICTION_RESISTANCE_NOT_SUPPORTED},
+  #else
+    {"PREDICTION_RESISTANCE_NOT_SUPPORTED", 36, 133},
+  #endif
+  #ifdef RAND_R_PRNG_NOT_SEEDED
+    {"PRNG_NOT_SEEDED", ERR_LIB_RAND, RAND_R_PRNG_NOT_SEEDED},
+  #else
+    {"PRNG_NOT_SEEDED", 36, 100},
+  #endif
+  #ifdef RAND_R_RANDOM_POOL_OVERFLOW
+    {"RANDOM_POOL_OVERFLOW", ERR_LIB_RAND, RAND_R_RANDOM_POOL_OVERFLOW},
+  #else
+    {"RANDOM_POOL_OVERFLOW", 36, 125},
+  #endif
+  #ifdef RAND_R_RANDOM_POOL_UNDERFLOW
+    {"RANDOM_POOL_UNDERFLOW", ERR_LIB_RAND, RAND_R_RANDOM_POOL_UNDERFLOW},
+  #else
+    {"RANDOM_POOL_UNDERFLOW", 36, 134},
+  #endif
+  #ifdef RAND_R_REQUEST_TOO_LARGE_FOR_DRBG
+    {"REQUEST_TOO_LARGE_FOR_DRBG", ERR_LIB_RAND, RAND_R_REQUEST_TOO_LARGE_FOR_DRBG},
+  #else
+    {"REQUEST_TOO_LARGE_FOR_DRBG", 36, 117},
+  #endif
+  #ifdef RAND_R_RESEED_ERROR
+    {"RESEED_ERROR", ERR_LIB_RAND, RAND_R_RESEED_ERROR},
+  #else
+    {"RESEED_ERROR", 36, 118},
+  #endif
+  #ifdef RAND_R_SELFTEST_FAILURE
+    {"SELFTEST_FAILURE", ERR_LIB_RAND, RAND_R_SELFTEST_FAILURE},
+  #else
+    {"SELFTEST_FAILURE", 36, 119},
+  #endif
+  #ifdef RAND_R_TOO_LITTLE_NONCE_REQUESTED
+    {"TOO_LITTLE_NONCE_REQUESTED", ERR_LIB_RAND, RAND_R_TOO_LITTLE_NONCE_REQUESTED},
+  #else
+    {"TOO_LITTLE_NONCE_REQUESTED", 36, 135},
+  #endif
+  #ifdef RAND_R_TOO_MUCH_NONCE_REQUESTED
+    {"TOO_MUCH_NONCE_REQUESTED", ERR_LIB_RAND, RAND_R_TOO_MUCH_NONCE_REQUESTED},
+  #else
+    {"TOO_MUCH_NONCE_REQUESTED", 36, 136},
+  #endif
+  #ifdef RAND_R_UNABLE_TO_CREATE_DRBG
+    {"UNABLE_TO_CREATE_DRBG", ERR_LIB_RAND, RAND_R_UNABLE_TO_CREATE_DRBG},
+  #else
+    {"UNABLE_TO_CREATE_DRBG", 36, 143},
+  #endif
+  #ifdef RAND_R_UNABLE_TO_FETCH_DRBG
+    {"UNABLE_TO_FETCH_DRBG", ERR_LIB_RAND, RAND_R_UNABLE_TO_FETCH_DRBG},
+  #else
+    {"UNABLE_TO_FETCH_DRBG", 36, 144},
+  #endif
+  #ifdef RAND_R_UNABLE_TO_GET_PARENT_RESEED_PROP_COUNTER
+    {"UNABLE_TO_GET_PARENT_RESEED_PROP_COUNTER", ERR_LIB_RAND, RAND_R_UNABLE_TO_GET_PARENT_RESEED_PROP_COUNTER},
+  #else
+    {"UNABLE_TO_GET_PARENT_RESEED_PROP_COUNTER", 36, 141},
+  #endif
+  #ifdef RAND_R_UNABLE_TO_GET_PARENT_STRENGTH
+    {"UNABLE_TO_GET_PARENT_STRENGTH", ERR_LIB_RAND, RAND_R_UNABLE_TO_GET_PARENT_STRENGTH},
+  #else
+    {"UNABLE_TO_GET_PARENT_STRENGTH", 36, 138},
+  #endif
+  #ifdef RAND_R_UNABLE_TO_LOCK_PARENT
+    {"UNABLE_TO_LOCK_PARENT", ERR_LIB_RAND, RAND_R_UNABLE_TO_LOCK_PARENT},
+  #else
+    {"UNABLE_TO_LOCK_PARENT", 36, 140},
+  #endif
+  #ifdef RAND_R_UNSUPPORTED_DRBG_FLAGS
+    {"UNSUPPORTED_DRBG_FLAGS", ERR_LIB_RAND, RAND_R_UNSUPPORTED_DRBG_FLAGS},
+  #else
+    {"UNSUPPORTED_DRBG_FLAGS", 36, 132},
+  #endif
+  #ifdef RAND_R_UNSUPPORTED_DRBG_TYPE
+    {"UNSUPPORTED_DRBG_TYPE", ERR_LIB_RAND, RAND_R_UNSUPPORTED_DRBG_TYPE},
+  #else
+    {"UNSUPPORTED_DRBG_TYPE", 36, 120},
+  #endif
+  #ifdef RSA_R_ALGORITHM_MISMATCH
+    {"ALGORITHM_MISMATCH", ERR_LIB_RSA, RSA_R_ALGORITHM_MISMATCH},
+  #else
+    {"ALGORITHM_MISMATCH", 4, 100},
+  #endif
+  #ifdef RSA_R_BAD_E_VALUE
+    {"BAD_E_VALUE", ERR_LIB_RSA, RSA_R_BAD_E_VALUE},
+  #else
+    {"BAD_E_VALUE", 4, 101},
+  #endif
+  #ifdef RSA_R_BAD_FIXED_HEADER_DECRYPT
+    {"BAD_FIXED_HEADER_DECRYPT", ERR_LIB_RSA, RSA_R_BAD_FIXED_HEADER_DECRYPT},
+  #else
+    {"BAD_FIXED_HEADER_DECRYPT", 4, 102},
+  #endif
+  #ifdef RSA_R_BAD_PAD_BYTE_COUNT
+    {"BAD_PAD_BYTE_COUNT", ERR_LIB_RSA, RSA_R_BAD_PAD_BYTE_COUNT},
+  #else
+    {"BAD_PAD_BYTE_COUNT", 4, 103},
+  #endif
+  #ifdef RSA_R_BAD_SIGNATURE
+    {"BAD_SIGNATURE", ERR_LIB_RSA, RSA_R_BAD_SIGNATURE},
+  #else
+    {"BAD_SIGNATURE", 4, 104},
+  #endif
+  #ifdef RSA_R_BLOCK_TYPE_IS_NOT_01
+    {"BLOCK_TYPE_IS_NOT_01", ERR_LIB_RSA, RSA_R_BLOCK_TYPE_IS_NOT_01},
+  #else
+    {"BLOCK_TYPE_IS_NOT_01", 4, 106},
+  #endif
+  #ifdef RSA_R_BLOCK_TYPE_IS_NOT_02
+    {"BLOCK_TYPE_IS_NOT_02", ERR_LIB_RSA, RSA_R_BLOCK_TYPE_IS_NOT_02},
+  #else
+    {"BLOCK_TYPE_IS_NOT_02", 4, 107},
+  #endif
+  #ifdef RSA_R_DATA_GREATER_THAN_MOD_LEN
+    {"DATA_GREATER_THAN_MOD_LEN", ERR_LIB_RSA, RSA_R_DATA_GREATER_THAN_MOD_LEN},
+  #else
+    {"DATA_GREATER_THAN_MOD_LEN", 4, 108},
+  #endif
+  #ifdef RSA_R_DATA_TOO_LARGE
+    {"DATA_TOO_LARGE", ERR_LIB_RSA, RSA_R_DATA_TOO_LARGE},
+  #else
+    {"DATA_TOO_LARGE", 4, 109},
+  #endif
+  #ifdef RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE
+    {"DATA_TOO_LARGE_FOR_KEY_SIZE", ERR_LIB_RSA, RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE},
+  #else
+    {"DATA_TOO_LARGE_FOR_KEY_SIZE", 4, 110},
+  #endif
+  #ifdef RSA_R_DATA_TOO_LARGE_FOR_MODULUS
+    {"DATA_TOO_LARGE_FOR_MODULUS", ERR_LIB_RSA, RSA_R_DATA_TOO_LARGE_FOR_MODULUS},
+  #else
+    {"DATA_TOO_LARGE_FOR_MODULUS", 4, 132},
+  #endif
+  #ifdef RSA_R_DATA_TOO_SMALL
+    {"DATA_TOO_SMALL", ERR_LIB_RSA, RSA_R_DATA_TOO_SMALL},
+  #else
+    {"DATA_TOO_SMALL", 4, 111},
+  #endif
+  #ifdef RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE
+    {"DATA_TOO_SMALL_FOR_KEY_SIZE", ERR_LIB_RSA, RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE},
+  #else
+    {"DATA_TOO_SMALL_FOR_KEY_SIZE", 4, 122},
+  #endif
+  #ifdef RSA_R_DIGEST_DOES_NOT_MATCH
+    {"DIGEST_DOES_NOT_MATCH", ERR_LIB_RSA, RSA_R_DIGEST_DOES_NOT_MATCH},
+  #else
+    {"DIGEST_DOES_NOT_MATCH", 4, 158},
+  #endif
+  #ifdef RSA_R_DIGEST_NOT_ALLOWED
+    {"DIGEST_NOT_ALLOWED", ERR_LIB_RSA, RSA_R_DIGEST_NOT_ALLOWED},
+  #else
+    {"DIGEST_NOT_ALLOWED", 4, 145},
+  #endif
+  #ifdef RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY
+    {"DIGEST_TOO_BIG_FOR_RSA_KEY", ERR_LIB_RSA, RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY},
+  #else
+    {"DIGEST_TOO_BIG_FOR_RSA_KEY", 4, 112},
+  #endif
+  #ifdef RSA_R_DMP1_NOT_CONGRUENT_TO_D
+    {"DMP1_NOT_CONGRUENT_TO_D", ERR_LIB_RSA, RSA_R_DMP1_NOT_CONGRUENT_TO_D},
+  #else
+    {"DMP1_NOT_CONGRUENT_TO_D", 4, 124},
+  #endif
+  #ifdef RSA_R_DMQ1_NOT_CONGRUENT_TO_D
+    {"DMQ1_NOT_CONGRUENT_TO_D", ERR_LIB_RSA, RSA_R_DMQ1_NOT_CONGRUENT_TO_D},
+  #else
+    {"DMQ1_NOT_CONGRUENT_TO_D", 4, 125},
+  #endif
+  #ifdef RSA_R_D_E_NOT_CONGRUENT_TO_1
+    {"D_E_NOT_CONGRUENT_TO_1", ERR_LIB_RSA, RSA_R_D_E_NOT_CONGRUENT_TO_1},
+  #else
+    {"D_E_NOT_CONGRUENT_TO_1", 4, 123},
+  #endif
+  #ifdef RSA_R_FIRST_OCTET_INVALID
+    {"FIRST_OCTET_INVALID", ERR_LIB_RSA, RSA_R_FIRST_OCTET_INVALID},
+  #else
+    {"FIRST_OCTET_INVALID", 4, 133},
+  #endif
+  #ifdef RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE
+    {"ILLEGAL_OR_UNSUPPORTED_PADDING_MODE", ERR_LIB_RSA, RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE},
+  #else
+    {"ILLEGAL_OR_UNSUPPORTED_PADDING_MODE", 4, 144},
+  #endif
+  #ifdef RSA_R_INVALID_DIGEST
+    {"INVALID_DIGEST", ERR_LIB_RSA, RSA_R_INVALID_DIGEST},
+  #else
+    {"INVALID_DIGEST", 4, 157},
+  #endif
+  #ifdef RSA_R_INVALID_DIGEST_LENGTH
+    {"INVALID_DIGEST_LENGTH", ERR_LIB_RSA, RSA_R_INVALID_DIGEST_LENGTH},
+  #else
+    {"INVALID_DIGEST_LENGTH", 4, 143},
+  #endif
+  #ifdef RSA_R_INVALID_HEADER
+    {"INVALID_HEADER", ERR_LIB_RSA, RSA_R_INVALID_HEADER},
+  #else
+    {"INVALID_HEADER", 4, 137},
+  #endif
+  #ifdef RSA_R_INVALID_KEYPAIR
+    {"INVALID_KEYPAIR", ERR_LIB_RSA, RSA_R_INVALID_KEYPAIR},
+  #else
+    {"INVALID_KEYPAIR", 4, 171},
+  #endif
+  #ifdef RSA_R_INVALID_KEY_LENGTH
+    {"INVALID_KEY_LENGTH", ERR_LIB_RSA, RSA_R_INVALID_KEY_LENGTH},
+  #else
+    {"INVALID_KEY_LENGTH", 4, 173},
+  #endif
+  #ifdef RSA_R_INVALID_LABEL
+    {"INVALID_LABEL", ERR_LIB_RSA, RSA_R_INVALID_LABEL},
+  #else
+    {"INVALID_LABEL", 4, 160},
+  #endif
+  #ifdef RSA_R_INVALID_MESSAGE_LENGTH
+    {"INVALID_MESSAGE_LENGTH", ERR_LIB_RSA, RSA_R_INVALID_MESSAGE_LENGTH},
+  #else
+    {"INVALID_MESSAGE_LENGTH", 4, 131},
+  #endif
+  #ifdef RSA_R_INVALID_MGF1_MD
+    {"INVALID_MGF1_MD", ERR_LIB_RSA, RSA_R_INVALID_MGF1_MD},
+  #else
+    {"INVALID_MGF1_MD", 4, 156},
+  #endif
+  #ifdef RSA_R_INVALID_MODULUS
+    {"INVALID_MODULUS", ERR_LIB_RSA, RSA_R_INVALID_MODULUS},
+  #else
+    {"INVALID_MODULUS", 4, 174},
+  #endif
+  #ifdef RSA_R_INVALID_MULTI_PRIME_KEY
+    {"INVALID_MULTI_PRIME_KEY", ERR_LIB_RSA, RSA_R_INVALID_MULTI_PRIME_KEY},
+  #else
+    {"INVALID_MULTI_PRIME_KEY", 4, 167},
+  #endif
+  #ifdef RSA_R_INVALID_OAEP_PARAMETERS
+    {"INVALID_OAEP_PARAMETERS", ERR_LIB_RSA, RSA_R_INVALID_OAEP_PARAMETERS},
+  #else
+    {"INVALID_OAEP_PARAMETERS", 4, 161},
+  #endif
+  #ifdef RSA_R_INVALID_PADDING
+    {"INVALID_PADDING", ERR_LIB_RSA, RSA_R_INVALID_PADDING},
+  #else
+    {"INVALID_PADDING", 4, 138},
+  #endif
+  #ifdef RSA_R_INVALID_PADDING_MODE
+    {"INVALID_PADDING_MODE", ERR_LIB_RSA, RSA_R_INVALID_PADDING_MODE},
+  #else
+    {"INVALID_PADDING_MODE", 4, 141},
+  #endif
+  #ifdef RSA_R_INVALID_PSS_PARAMETERS
+    {"INVALID_PSS_PARAMETERS", ERR_LIB_RSA, RSA_R_INVALID_PSS_PARAMETERS},
+  #else
+    {"INVALID_PSS_PARAMETERS", 4, 149},
+  #endif
+  #ifdef RSA_R_INVALID_PSS_SALTLEN
+    {"INVALID_PSS_SALTLEN", ERR_LIB_RSA, RSA_R_INVALID_PSS_SALTLEN},
+  #else
+    {"INVALID_PSS_SALTLEN", 4, 146},
+  #endif
+  #ifdef RSA_R_INVALID_REQUEST
+    {"INVALID_REQUEST", ERR_LIB_RSA, RSA_R_INVALID_REQUEST},
+  #else
+    {"INVALID_REQUEST", 4, 175},
+  #endif
+  #ifdef RSA_R_INVALID_SALT_LENGTH
+    {"INVALID_SALT_LENGTH", ERR_LIB_RSA, RSA_R_INVALID_SALT_LENGTH},
+  #else
+    {"INVALID_SALT_LENGTH", 4, 150},
+  #endif
+  #ifdef RSA_R_INVALID_STRENGTH
+    {"INVALID_STRENGTH", ERR_LIB_RSA, RSA_R_INVALID_STRENGTH},
+  #else
+    {"INVALID_STRENGTH", 4, 176},
+  #endif
+  #ifdef RSA_R_INVALID_TRAILER
+    {"INVALID_TRAILER", ERR_LIB_RSA, RSA_R_INVALID_TRAILER},
+  #else
+    {"INVALID_TRAILER", 4, 139},
+  #endif
+  #ifdef RSA_R_INVALID_X931_DIGEST
+    {"INVALID_X931_DIGEST", ERR_LIB_RSA, RSA_R_INVALID_X931_DIGEST},
+  #else
+    {"INVALID_X931_DIGEST", 4, 142},
+  #endif
+  #ifdef RSA_R_IQMP_NOT_INVERSE_OF_Q
+    {"IQMP_NOT_INVERSE_OF_Q", ERR_LIB_RSA, RSA_R_IQMP_NOT_INVERSE_OF_Q},
+  #else
+    {"IQMP_NOT_INVERSE_OF_Q", 4, 126},
+  #endif
+  #ifdef RSA_R_KEY_PRIME_NUM_INVALID
+    {"KEY_PRIME_NUM_INVALID", ERR_LIB_RSA, RSA_R_KEY_PRIME_NUM_INVALID},
+  #else
+    {"KEY_PRIME_NUM_INVALID", 4, 165},
+  #endif
+  #ifdef RSA_R_KEY_SIZE_TOO_SMALL
+    {"KEY_SIZE_TOO_SMALL", ERR_LIB_RSA, RSA_R_KEY_SIZE_TOO_SMALL},
+  #else
+    {"KEY_SIZE_TOO_SMALL", 4, 120},
+  #endif
+  #ifdef RSA_R_LAST_OCTET_INVALID
+    {"LAST_OCTET_INVALID", ERR_LIB_RSA, RSA_R_LAST_OCTET_INVALID},
+  #else
+    {"LAST_OCTET_INVALID", 4, 134},
+  #endif
+  #ifdef RSA_R_MGF1_DIGEST_NOT_ALLOWED
+    {"MGF1_DIGEST_NOT_ALLOWED", ERR_LIB_RSA, RSA_R_MGF1_DIGEST_NOT_ALLOWED},
+  #else
+    {"MGF1_DIGEST_NOT_ALLOWED", 4, 152},
+  #endif
+  #ifdef RSA_R_MISSING_PRIVATE_KEY
+    {"MISSING_PRIVATE_KEY", ERR_LIB_RSA, RSA_R_MISSING_PRIVATE_KEY},
+  #else
+    {"MISSING_PRIVATE_KEY", 4, 179},
+  #endif
+  #ifdef RSA_R_MODULUS_TOO_LARGE
+    {"MODULUS_TOO_LARGE", ERR_LIB_RSA, RSA_R_MODULUS_TOO_LARGE},
+  #else
+    {"MODULUS_TOO_LARGE", 4, 105},
+  #endif
+  #ifdef RSA_R_MP_COEFFICIENT_NOT_INVERSE_OF_R
+    {"MP_COEFFICIENT_NOT_INVERSE_OF_R", ERR_LIB_RSA, RSA_R_MP_COEFFICIENT_NOT_INVERSE_OF_R},
+  #else
+    {"MP_COEFFICIENT_NOT_INVERSE_OF_R", 4, 168},
+  #endif
+  #ifdef RSA_R_MP_EXPONENT_NOT_CONGRUENT_TO_D
+    {"MP_EXPONENT_NOT_CONGRUENT_TO_D", ERR_LIB_RSA, RSA_R_MP_EXPONENT_NOT_CONGRUENT_TO_D},
+  #else
+    {"MP_EXPONENT_NOT_CONGRUENT_TO_D", 4, 169},
+  #endif
+  #ifdef RSA_R_MP_R_NOT_PRIME
+    {"MP_R_NOT_PRIME", ERR_LIB_RSA, RSA_R_MP_R_NOT_PRIME},
+  #else
+    {"MP_R_NOT_PRIME", 4, 170},
+  #endif
+  #ifdef RSA_R_NO_PUBLIC_EXPONENT
+    {"NO_PUBLIC_EXPONENT", ERR_LIB_RSA, RSA_R_NO_PUBLIC_EXPONENT},
+  #else
+    {"NO_PUBLIC_EXPONENT", 4, 140},
+  #endif
+  #ifdef RSA_R_NULL_BEFORE_BLOCK_MISSING
+    {"NULL_BEFORE_BLOCK_MISSING", ERR_LIB_RSA, RSA_R_NULL_BEFORE_BLOCK_MISSING},
+  #else
+    {"NULL_BEFORE_BLOCK_MISSING", 4, 113},
+  #endif
+  #ifdef RSA_R_N_DOES_NOT_EQUAL_PRODUCT_OF_PRIMES
+    {"N_DOES_NOT_EQUAL_PRODUCT_OF_PRIMES", ERR_LIB_RSA, RSA_R_N_DOES_NOT_EQUAL_PRODUCT_OF_PRIMES},
+  #else
+    {"N_DOES_NOT_EQUAL_PRODUCT_OF_PRIMES", 4, 172},
+  #endif
+  #ifdef RSA_R_N_DOES_NOT_EQUAL_P_Q
+    {"N_DOES_NOT_EQUAL_P_Q", ERR_LIB_RSA, RSA_R_N_DOES_NOT_EQUAL_P_Q},
+  #else
+    {"N_DOES_NOT_EQUAL_P_Q", 4, 127},
+  #endif
+  #ifdef RSA_R_OAEP_DECODING_ERROR
+    {"OAEP_DECODING_ERROR", ERR_LIB_RSA, RSA_R_OAEP_DECODING_ERROR},
+  #else
+    {"OAEP_DECODING_ERROR", 4, 121},
+  #endif
+  #ifdef RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE
+    {"OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE", ERR_LIB_RSA, RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE},
+  #else
+    {"OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE", 4, 148},
+  #endif
+  #ifdef RSA_R_PADDING_CHECK_FAILED
+    {"PADDING_CHECK_FAILED", ERR_LIB_RSA, RSA_R_PADDING_CHECK_FAILED},
+  #else
+    {"PADDING_CHECK_FAILED", 4, 114},
+  #endif
+  #ifdef RSA_R_PAIRWISE_TEST_FAILURE
+    {"PAIRWISE_TEST_FAILURE", ERR_LIB_RSA, RSA_R_PAIRWISE_TEST_FAILURE},
+  #else
+    {"PAIRWISE_TEST_FAILURE", 4, 177},
+  #endif
+  #ifdef RSA_R_PKCS_DECODING_ERROR
+    {"PKCS_DECODING_ERROR", ERR_LIB_RSA, RSA_R_PKCS_DECODING_ERROR},
+  #else
+    {"PKCS_DECODING_ERROR", 4, 159},
+  #endif
+  #ifdef RSA_R_PSS_SALTLEN_TOO_SMALL
+    {"PSS_SALTLEN_TOO_SMALL", ERR_LIB_RSA, RSA_R_PSS_SALTLEN_TOO_SMALL},
+  #else
+    {"PSS_SALTLEN_TOO_SMALL", 4, 164},
+  #endif
+  #ifdef RSA_R_PUB_EXPONENT_OUT_OF_RANGE
+    {"PUB_EXPONENT_OUT_OF_RANGE", ERR_LIB_RSA, RSA_R_PUB_EXPONENT_OUT_OF_RANGE},
+  #else
+    {"PUB_EXPONENT_OUT_OF_RANGE", 4, 178},
+  #endif
+  #ifdef RSA_R_P_NOT_PRIME
+    {"P_NOT_PRIME", ERR_LIB_RSA, RSA_R_P_NOT_PRIME},
+  #else
+    {"P_NOT_PRIME", 4, 128},
+  #endif
+  #ifdef RSA_R_Q_NOT_PRIME
+    {"Q_NOT_PRIME", ERR_LIB_RSA, RSA_R_Q_NOT_PRIME},
+  #else
+    {"Q_NOT_PRIME", 4, 129},
+  #endif
+  #ifdef RSA_R_RSA_OPERATIONS_NOT_SUPPORTED
+    {"RSA_OPERATIONS_NOT_SUPPORTED", ERR_LIB_RSA, RSA_R_RSA_OPERATIONS_NOT_SUPPORTED},
+  #else
+    {"RSA_OPERATIONS_NOT_SUPPORTED", 4, 130},
+  #endif
+  #ifdef RSA_R_SLEN_CHECK_FAILED
+    {"SLEN_CHECK_FAILED", ERR_LIB_RSA, RSA_R_SLEN_CHECK_FAILED},
+  #else
+    {"SLEN_CHECK_FAILED", 4, 136},
+  #endif
+  #ifdef RSA_R_SLEN_RECOVERY_FAILED
+    {"SLEN_RECOVERY_FAILED", ERR_LIB_RSA, RSA_R_SLEN_RECOVERY_FAILED},
+  #else
+    {"SLEN_RECOVERY_FAILED", 4, 135},
+  #endif
+  #ifdef RSA_R_SSLV3_ROLLBACK_ATTACK
+    {"SSLV3_ROLLBACK_ATTACK", ERR_LIB_RSA, RSA_R_SSLV3_ROLLBACK_ATTACK},
+  #else
+    {"SSLV3_ROLLBACK_ATTACK", 4, 115},
+  #endif
+  #ifdef RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD
+    {"THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD", ERR_LIB_RSA, RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD},
+  #else
+    {"THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD", 4, 116},
+  #endif
+  #ifdef RSA_R_UNKNOWN_ALGORITHM_TYPE
+    {"UNKNOWN_ALGORITHM_TYPE", ERR_LIB_RSA, RSA_R_UNKNOWN_ALGORITHM_TYPE},
+  #else
+    {"UNKNOWN_ALGORITHM_TYPE", 4, 117},
+  #endif
+  #ifdef RSA_R_UNKNOWN_DIGEST
+    {"UNKNOWN_DIGEST", ERR_LIB_RSA, RSA_R_UNKNOWN_DIGEST},
+  #else
+    {"UNKNOWN_DIGEST", 4, 166},
+  #endif
+  #ifdef RSA_R_UNKNOWN_MASK_DIGEST
+    {"UNKNOWN_MASK_DIGEST", ERR_LIB_RSA, RSA_R_UNKNOWN_MASK_DIGEST},
+  #else
+    {"UNKNOWN_MASK_DIGEST", 4, 151},
+  #endif
+  #ifdef RSA_R_UNKNOWN_PADDING_TYPE
+    {"UNKNOWN_PADDING_TYPE", ERR_LIB_RSA, RSA_R_UNKNOWN_PADDING_TYPE},
+  #else
+    {"UNKNOWN_PADDING_TYPE", 4, 118},
+  #endif
+  #ifdef RSA_R_UNSUPPORTED_ENCRYPTION_TYPE
+    {"UNSUPPORTED_ENCRYPTION_TYPE", ERR_LIB_RSA, RSA_R_UNSUPPORTED_ENCRYPTION_TYPE},
+  #else
+    {"UNSUPPORTED_ENCRYPTION_TYPE", 4, 162},
+  #endif
+  #ifdef RSA_R_UNSUPPORTED_LABEL_SOURCE
+    {"UNSUPPORTED_LABEL_SOURCE", ERR_LIB_RSA, RSA_R_UNSUPPORTED_LABEL_SOURCE},
+  #else
+    {"UNSUPPORTED_LABEL_SOURCE", 4, 163},
+  #endif
+  #ifdef RSA_R_UNSUPPORTED_MASK_ALGORITHM
+    {"UNSUPPORTED_MASK_ALGORITHM", ERR_LIB_RSA, RSA_R_UNSUPPORTED_MASK_ALGORITHM},
+  #else
+    {"UNSUPPORTED_MASK_ALGORITHM", 4, 153},
+  #endif
+  #ifdef RSA_R_UNSUPPORTED_MASK_PARAMETER
+    {"UNSUPPORTED_MASK_PARAMETER", ERR_LIB_RSA, RSA_R_UNSUPPORTED_MASK_PARAMETER},
+  #else
+    {"UNSUPPORTED_MASK_PARAMETER", 4, 154},
+  #endif
+  #ifdef RSA_R_UNSUPPORTED_SIGNATURE_TYPE
+    {"UNSUPPORTED_SIGNATURE_TYPE", ERR_LIB_RSA, RSA_R_UNSUPPORTED_SIGNATURE_TYPE},
+  #else
+    {"UNSUPPORTED_SIGNATURE_TYPE", 4, 155},
+  #endif
+  #ifdef RSA_R_VALUE_MISSING
+    {"VALUE_MISSING", ERR_LIB_RSA, RSA_R_VALUE_MISSING},
+  #else
+    {"VALUE_MISSING", 4, 147},
+  #endif
+  #ifdef RSA_R_WRONG_SIGNATURE_LENGTH
+    {"WRONG_SIGNATURE_LENGTH", ERR_LIB_RSA, RSA_R_WRONG_SIGNATURE_LENGTH},
+  #else
+    {"WRONG_SIGNATURE_LENGTH", 4, 119},
+  #endif
+  #ifdef SM2_R_ASN1_ERROR
+    {"ASN1_ERROR", ERR_LIB_SM2, SM2_R_ASN1_ERROR},
+  #else
+    {"ASN1_ERROR", 53, 100},
+  #endif
+  #ifdef SM2_R_BAD_SIGNATURE
+    {"BAD_SIGNATURE", ERR_LIB_SM2, SM2_R_BAD_SIGNATURE},
+  #else
+    {"BAD_SIGNATURE", 53, 101},
+  #endif
+  #ifdef SM2_R_BUFFER_TOO_SMALL
+    {"BUFFER_TOO_SMALL", ERR_LIB_SM2, SM2_R_BUFFER_TOO_SMALL},
+  #else
+    {"BUFFER_TOO_SMALL", 53, 107},
+  #endif
+  #ifdef SM2_R_DIST_ID_TOO_LARGE
+    {"DIST_ID_TOO_LARGE", ERR_LIB_SM2, SM2_R_DIST_ID_TOO_LARGE},
+  #else
+    {"DIST_ID_TOO_LARGE", 53, 110},
+  #endif
+  #ifdef SM2_R_ID_NOT_SET
+    {"ID_NOT_SET", ERR_LIB_SM2, SM2_R_ID_NOT_SET},
+  #else
+    {"ID_NOT_SET", 53, 112},
+  #endif
+  #ifdef SM2_R_ID_TOO_LARGE
+    {"ID_TOO_LARGE", ERR_LIB_SM2, SM2_R_ID_TOO_LARGE},
+  #else
+    {"ID_TOO_LARGE", 53, 111},
+  #endif
+  #ifdef SM2_R_INVALID_CURVE
+    {"INVALID_CURVE", ERR_LIB_SM2, SM2_R_INVALID_CURVE},
+  #else
+    {"INVALID_CURVE", 53, 108},
+  #endif
+  #ifdef SM2_R_INVALID_DIGEST
+    {"INVALID_DIGEST", ERR_LIB_SM2, SM2_R_INVALID_DIGEST},
+  #else
+    {"INVALID_DIGEST", 53, 102},
+  #endif
+  #ifdef SM2_R_INVALID_DIGEST_TYPE
+    {"INVALID_DIGEST_TYPE", ERR_LIB_SM2, SM2_R_INVALID_DIGEST_TYPE},
+  #else
+    {"INVALID_DIGEST_TYPE", 53, 103},
+  #endif
+  #ifdef SM2_R_INVALID_ENCODING
+    {"INVALID_ENCODING", ERR_LIB_SM2, SM2_R_INVALID_ENCODING},
+  #else
+    {"INVALID_ENCODING", 53, 104},
+  #endif
+  #ifdef SM2_R_INVALID_FIELD
+    {"INVALID_FIELD", ERR_LIB_SM2, SM2_R_INVALID_FIELD},
+  #else
+    {"INVALID_FIELD", 53, 105},
+  #endif
+  #ifdef SM2_R_INVALID_PRIVATE_KEY
+    {"INVALID_PRIVATE_KEY", ERR_LIB_SM2, SM2_R_INVALID_PRIVATE_KEY},
+  #else
+    {"INVALID_PRIVATE_KEY", 53, 113},
+  #endif
+  #ifdef SM2_R_NO_PARAMETERS_SET
+    {"NO_PARAMETERS_SET", ERR_LIB_SM2, SM2_R_NO_PARAMETERS_SET},
+  #else
+    {"NO_PARAMETERS_SET", 53, 109},
+  #endif
+  #ifdef SM2_R_USER_ID_TOO_LARGE
+    {"USER_ID_TOO_LARGE", ERR_LIB_SM2, SM2_R_USER_ID_TOO_LARGE},
+  #else
+    {"USER_ID_TOO_LARGE", 53, 106},
+  #endif
+  #ifdef SSL_R_APPLICATION_DATA_AFTER_CLOSE_NOTIFY
+    {"APPLICATION_DATA_AFTER_CLOSE_NOTIFY", ERR_LIB_SSL, SSL_R_APPLICATION_DATA_AFTER_CLOSE_NOTIFY},
+  #else
+    {"APPLICATION_DATA_AFTER_CLOSE_NOTIFY", 20, 291},
+  #endif
+  #ifdef SSL_R_APP_DATA_IN_HANDSHAKE
+    {"APP_DATA_IN_HANDSHAKE", ERR_LIB_SSL, SSL_R_APP_DATA_IN_HANDSHAKE},
+  #else
+    {"APP_DATA_IN_HANDSHAKE", 20, 100},
+  #endif
+  #ifdef SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT
+    {"ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT", ERR_LIB_SSL, SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT},
+  #else
+    {"ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT", 20, 272},
+  #endif
+  #ifdef SSL_R_AT_LEAST_TLS_1_0_NEEDED_IN_FIPS_MODE
+    {"AT_LEAST_TLS_1_0_NEEDED_IN_FIPS_MODE", ERR_LIB_SSL, SSL_R_AT_LEAST_TLS_1_0_NEEDED_IN_FIPS_MODE},
+  #else
+    {"AT_LEAST_TLS_1_0_NEEDED_IN_FIPS_MODE", 20, 143},
+  #endif
+  #ifdef SSL_R_AT_LEAST_TLS_1_2_NEEDED_IN_SUITEB_MODE
+    {"AT_LEAST_TLS_1_2_NEEDED_IN_SUITEB_MODE", ERR_LIB_SSL, SSL_R_AT_LEAST_TLS_1_2_NEEDED_IN_SUITEB_MODE},
+  #else
+    {"AT_LEAST_TLS_1_2_NEEDED_IN_SUITEB_MODE", 20, 158},
+  #endif
+  #ifdef SSL_R_BAD_CHANGE_CIPHER_SPEC
+    {"BAD_CHANGE_CIPHER_SPEC", ERR_LIB_SSL, SSL_R_BAD_CHANGE_CIPHER_SPEC},
+  #else
+    {"BAD_CHANGE_CIPHER_SPEC", 20, 103},
+  #endif
+  #ifdef SSL_R_BAD_CIPHER
+    {"BAD_CIPHER", ERR_LIB_SSL, SSL_R_BAD_CIPHER},
+  #else
+    {"BAD_CIPHER", 20, 186},
+  #endif
+  #ifdef SSL_R_BAD_DATA
+    {"BAD_DATA", ERR_LIB_SSL, SSL_R_BAD_DATA},
+  #else
+    {"BAD_DATA", 20, 390},
+  #endif
+  #ifdef SSL_R_BAD_DATA_RETURNED_BY_CALLBACK
+    {"BAD_DATA_RETURNED_BY_CALLBACK", ERR_LIB_SSL, SSL_R_BAD_DATA_RETURNED_BY_CALLBACK},
+  #else
+    {"BAD_DATA_RETURNED_BY_CALLBACK", 20, 106},
+  #endif
+  #ifdef SSL_R_BAD_DECOMPRESSION
+    {"BAD_DECOMPRESSION", ERR_LIB_SSL, SSL_R_BAD_DECOMPRESSION},
+  #else
+    {"BAD_DECOMPRESSION", 20, 107},
+  #endif
+  #ifdef SSL_R_BAD_DH_VALUE
+    {"BAD_DH_VALUE", ERR_LIB_SSL, SSL_R_BAD_DH_VALUE},
+  #else
+    {"BAD_DH_VALUE", 20, 102},
+  #endif
+  #ifdef SSL_R_BAD_DIGEST_LENGTH
+    {"BAD_DIGEST_LENGTH", ERR_LIB_SSL, SSL_R_BAD_DIGEST_LENGTH},
+  #else
+    {"BAD_DIGEST_LENGTH", 20, 111},
+  #endif
+  #ifdef SSL_R_BAD_EARLY_DATA
+    {"BAD_EARLY_DATA", ERR_LIB_SSL, SSL_R_BAD_EARLY_DATA},
+  #else
+    {"BAD_EARLY_DATA", 20, 233},
+  #endif
+  #ifdef SSL_R_BAD_ECC_CERT
+    {"BAD_ECC_CERT", ERR_LIB_SSL, SSL_R_BAD_ECC_CERT},
+  #else
+    {"BAD_ECC_CERT", 20, 304},
+  #endif
+  #ifdef SSL_R_BAD_ECPOINT
+    {"BAD_ECPOINT", ERR_LIB_SSL, SSL_R_BAD_ECPOINT},
+  #else
+    {"BAD_ECPOINT", 20, 306},
+  #endif
+  #ifdef SSL_R_BAD_EXTENSION
+    {"BAD_EXTENSION", ERR_LIB_SSL, SSL_R_BAD_EXTENSION},
+  #else
+    {"BAD_EXTENSION", 20, 110},
+  #endif
+  #ifdef SSL_R_BAD_HANDSHAKE_LENGTH
+    {"BAD_HANDSHAKE_LENGTH", ERR_LIB_SSL, SSL_R_BAD_HANDSHAKE_LENGTH},
+  #else
+    {"BAD_HANDSHAKE_LENGTH", 20, 332},
+  #endif
+  #ifdef SSL_R_BAD_HANDSHAKE_STATE
+    {"BAD_HANDSHAKE_STATE", ERR_LIB_SSL, SSL_R_BAD_HANDSHAKE_STATE},
+  #else
+    {"BAD_HANDSHAKE_STATE", 20, 236},
+  #endif
+  #ifdef SSL_R_BAD_HELLO_REQUEST
+    {"BAD_HELLO_REQUEST", ERR_LIB_SSL, SSL_R_BAD_HELLO_REQUEST},
+  #else
+    {"BAD_HELLO_REQUEST", 20, 105},
+  #endif
+  #ifdef SSL_R_BAD_HRR_VERSION
+    {"BAD_HRR_VERSION", ERR_LIB_SSL, SSL_R_BAD_HRR_VERSION},
+  #else
+    {"BAD_HRR_VERSION", 20, 263},
+  #endif
+  #ifdef SSL_R_BAD_KEY_SHARE
+    {"BAD_KEY_SHARE", ERR_LIB_SSL, SSL_R_BAD_KEY_SHARE},
+  #else
+    {"BAD_KEY_SHARE", 20, 108},
+  #endif
+  #ifdef SSL_R_BAD_KEY_UPDATE
+    {"BAD_KEY_UPDATE", ERR_LIB_SSL, SSL_R_BAD_KEY_UPDATE},
+  #else
+    {"BAD_KEY_UPDATE", 20, 122},
+  #endif
+  #ifdef SSL_R_BAD_LEGACY_VERSION
+    {"BAD_LEGACY_VERSION", ERR_LIB_SSL, SSL_R_BAD_LEGACY_VERSION},
+  #else
+    {"BAD_LEGACY_VERSION", 20, 292},
+  #endif
+  #ifdef SSL_R_BAD_LENGTH
+    {"BAD_LENGTH", ERR_LIB_SSL, SSL_R_BAD_LENGTH},
+  #else
+    {"BAD_LENGTH", 20, 271},
+  #endif
+  #ifdef SSL_R_BAD_PACKET
+    {"BAD_PACKET", ERR_LIB_SSL, SSL_R_BAD_PACKET},
+  #else
+    {"BAD_PACKET", 20, 240},
+  #endif
+  #ifdef SSL_R_BAD_PACKET_LENGTH
+    {"BAD_PACKET_LENGTH", ERR_LIB_SSL, SSL_R_BAD_PACKET_LENGTH},
+  #else
+    {"BAD_PACKET_LENGTH", 20, 115},
+  #endif
+  #ifdef SSL_R_BAD_PROTOCOL_VERSION_NUMBER
+    {"BAD_PROTOCOL_VERSION_NUMBER", ERR_LIB_SSL, SSL_R_BAD_PROTOCOL_VERSION_NUMBER},
+  #else
+    {"BAD_PROTOCOL_VERSION_NUMBER", 20, 116},
+  #endif
+  #ifdef SSL_R_BAD_PSK
+    {"BAD_PSK", ERR_LIB_SSL, SSL_R_BAD_PSK},
+  #else
+    {"BAD_PSK", 20, 219},
+  #endif
+  #ifdef SSL_R_BAD_PSK_IDENTITY
+    {"BAD_PSK_IDENTITY", ERR_LIB_SSL, SSL_R_BAD_PSK_IDENTITY},
+  #else
+    {"BAD_PSK_IDENTITY", 20, 114},
+  #endif
+  #ifdef SSL_R_BAD_RECORD_TYPE
+    {"BAD_RECORD_TYPE", ERR_LIB_SSL, SSL_R_BAD_RECORD_TYPE},
+  #else
+    {"BAD_RECORD_TYPE", 20, 443},
+  #endif
+  #ifdef SSL_R_BAD_RSA_ENCRYPT
+    {"BAD_RSA_ENCRYPT", ERR_LIB_SSL, SSL_R_BAD_RSA_ENCRYPT},
+  #else
+    {"BAD_RSA_ENCRYPT", 20, 119},
+  #endif
+  #ifdef SSL_R_BAD_SIGNATURE
+    {"BAD_SIGNATURE", ERR_LIB_SSL, SSL_R_BAD_SIGNATURE},
+  #else
+    {"BAD_SIGNATURE", 20, 123},
+  #endif
+  #ifdef SSL_R_BAD_SRP_A_LENGTH
+    {"BAD_SRP_A_LENGTH", ERR_LIB_SSL, SSL_R_BAD_SRP_A_LENGTH},
+  #else
+    {"BAD_SRP_A_LENGTH", 20, 347},
+  #endif
+  #ifdef SSL_R_BAD_SRP_PARAMETERS
+    {"BAD_SRP_PARAMETERS", ERR_LIB_SSL, SSL_R_BAD_SRP_PARAMETERS},
+  #else
+    {"BAD_SRP_PARAMETERS", 20, 371},
+  #endif
+  #ifdef SSL_R_BAD_SRTP_MKI_VALUE
+    {"BAD_SRTP_MKI_VALUE", ERR_LIB_SSL, SSL_R_BAD_SRTP_MKI_VALUE},
+  #else
+    {"BAD_SRTP_MKI_VALUE", 20, 352},
+  #endif
+  #ifdef SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST
+    {"BAD_SRTP_PROTECTION_PROFILE_LIST", ERR_LIB_SSL, SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST},
+  #else
+    {"BAD_SRTP_PROTECTION_PROFILE_LIST", 20, 353},
+  #endif
+  #ifdef SSL_R_BAD_SSL_FILETYPE
+    {"BAD_SSL_FILETYPE", ERR_LIB_SSL, SSL_R_BAD_SSL_FILETYPE},
+  #else
+    {"BAD_SSL_FILETYPE", 20, 124},
+  #endif
+  #ifdef SSL_R_BAD_VALUE
+    {"BAD_VALUE", ERR_LIB_SSL, SSL_R_BAD_VALUE},
+  #else
+    {"BAD_VALUE", 20, 384},
+  #endif
+  #ifdef SSL_R_BAD_WRITE_RETRY
+    {"BAD_WRITE_RETRY", ERR_LIB_SSL, SSL_R_BAD_WRITE_RETRY},
+  #else
+    {"BAD_WRITE_RETRY", 20, 127},
+  #endif
+  #ifdef SSL_R_BINDER_DOES_NOT_VERIFY
+    {"BINDER_DOES_NOT_VERIFY", ERR_LIB_SSL, SSL_R_BINDER_DOES_NOT_VERIFY},
+  #else
+    {"BINDER_DOES_NOT_VERIFY", 20, 253},
+  #endif
+  #ifdef SSL_R_BIO_NOT_SET
+    {"BIO_NOT_SET", ERR_LIB_SSL, SSL_R_BIO_NOT_SET},
+  #else
+    {"BIO_NOT_SET", 20, 128},
+  #endif
+  #ifdef SSL_R_BLOCK_CIPHER_PAD_IS_WRONG
+    {"BLOCK_CIPHER_PAD_IS_WRONG", ERR_LIB_SSL, SSL_R_BLOCK_CIPHER_PAD_IS_WRONG},
+  #else
+    {"BLOCK_CIPHER_PAD_IS_WRONG", 20, 129},
+  #endif
+  #ifdef SSL_R_BN_LIB
+    {"BN_LIB", ERR_LIB_SSL, SSL_R_BN_LIB},
+  #else
+    {"BN_LIB", 20, 130},
+  #endif
+  #ifdef SSL_R_CALLBACK_FAILED
+    {"CALLBACK_FAILED", ERR_LIB_SSL, SSL_R_CALLBACK_FAILED},
+  #else
+    {"CALLBACK_FAILED", 20, 234},
+  #endif
+  #ifdef SSL_R_CANNOT_CHANGE_CIPHER
+    {"CANNOT_CHANGE_CIPHER", ERR_LIB_SSL, SSL_R_CANNOT_CHANGE_CIPHER},
+  #else
+    {"CANNOT_CHANGE_CIPHER", 20, 109},
+  #endif
+  #ifdef SSL_R_CANNOT_GET_GROUP_NAME
+    {"CANNOT_GET_GROUP_NAME", ERR_LIB_SSL, SSL_R_CANNOT_GET_GROUP_NAME},
+  #else
+    {"CANNOT_GET_GROUP_NAME", 20, 299},
+  #endif
+  #ifdef SSL_R_CA_DN_LENGTH_MISMATCH
+    {"CA_DN_LENGTH_MISMATCH", ERR_LIB_SSL, SSL_R_CA_DN_LENGTH_MISMATCH},
+  #else
+    {"CA_DN_LENGTH_MISMATCH", 20, 131},
+  #endif
+  #ifdef SSL_R_CA_KEY_TOO_SMALL
+    {"CA_KEY_TOO_SMALL", ERR_LIB_SSL, SSL_R_CA_KEY_TOO_SMALL},
+  #else
+    {"CA_KEY_TOO_SMALL", 20, 397},
+  #endif
+  #ifdef SSL_R_CA_MD_TOO_WEAK
+    {"CA_MD_TOO_WEAK", ERR_LIB_SSL, SSL_R_CA_MD_TOO_WEAK},
+  #else
+    {"CA_MD_TOO_WEAK", 20, 398},
+  #endif
+  #ifdef SSL_R_CCS_RECEIVED_EARLY
+    {"CCS_RECEIVED_EARLY", ERR_LIB_SSL, SSL_R_CCS_RECEIVED_EARLY},
+  #else
+    {"CCS_RECEIVED_EARLY", 20, 133},
+  #endif
+  #ifdef SSL_R_CERTIFICATE_VERIFY_FAILED
+    {"CERTIFICATE_VERIFY_FAILED", ERR_LIB_SSL, SSL_R_CERTIFICATE_VERIFY_FAILED},
+  #else
+    {"CERTIFICATE_VERIFY_FAILED", 20, 134},
+  #endif
+  #ifdef SSL_R_CERT_CB_ERROR
+    {"CERT_CB_ERROR", ERR_LIB_SSL, SSL_R_CERT_CB_ERROR},
+  #else
+    {"CERT_CB_ERROR", 20, 377},
+  #endif
+  #ifdef SSL_R_CERT_LENGTH_MISMATCH
+    {"CERT_LENGTH_MISMATCH", ERR_LIB_SSL, SSL_R_CERT_LENGTH_MISMATCH},
+  #else
+    {"CERT_LENGTH_MISMATCH", 20, 135},
+  #endif
+  #ifdef SSL_R_CIPHERSUITE_DIGEST_HAS_CHANGED
+    {"CIPHERSUITE_DIGEST_HAS_CHANGED", ERR_LIB_SSL, SSL_R_CIPHERSUITE_DIGEST_HAS_CHANGED},
+  #else
+    {"CIPHERSUITE_DIGEST_HAS_CHANGED", 20, 218},
+  #endif
+  #ifdef SSL_R_CIPHER_CODE_WRONG_LENGTH
+    {"CIPHER_CODE_WRONG_LENGTH", ERR_LIB_SSL, SSL_R_CIPHER_CODE_WRONG_LENGTH},
+  #else
+    {"CIPHER_CODE_WRONG_LENGTH", 20, 137},
+  #endif
+  #ifdef SSL_R_CLIENTHELLO_TLSEXT
+    {"CLIENTHELLO_TLSEXT", ERR_LIB_SSL, SSL_R_CLIENTHELLO_TLSEXT},
+  #else
+    {"CLIENTHELLO_TLSEXT", 20, 226},
+  #endif
+  #ifdef SSL_R_COMPRESSED_LENGTH_TOO_LONG
+    {"COMPRESSED_LENGTH_TOO_LONG", ERR_LIB_SSL, SSL_R_COMPRESSED_LENGTH_TOO_LONG},
+  #else
+    {"COMPRESSED_LENGTH_TOO_LONG", 20, 140},
+  #endif
+  #ifdef SSL_R_COMPRESSION_DISABLED
+    {"COMPRESSION_DISABLED", ERR_LIB_SSL, SSL_R_COMPRESSION_DISABLED},
+  #else
+    {"COMPRESSION_DISABLED", 20, 343},
+  #endif
+  #ifdef SSL_R_COMPRESSION_FAILURE
+    {"COMPRESSION_FAILURE", ERR_LIB_SSL, SSL_R_COMPRESSION_FAILURE},
+  #else
+    {"COMPRESSION_FAILURE", 20, 141},
+  #endif
+  #ifdef SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE
+    {"COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE", ERR_LIB_SSL, SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE},
+  #else
+    {"COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE", 20, 307},
+  #endif
+  #ifdef SSL_R_COMPRESSION_LIBRARY_ERROR
+    {"COMPRESSION_LIBRARY_ERROR", ERR_LIB_SSL, SSL_R_COMPRESSION_LIBRARY_ERROR},
+  #else
+    {"COMPRESSION_LIBRARY_ERROR", 20, 142},
+  #endif
+  #ifdef SSL_R_CONNECTION_TYPE_NOT_SET
+    {"CONNECTION_TYPE_NOT_SET", ERR_LIB_SSL, SSL_R_CONNECTION_TYPE_NOT_SET},
+  #else
+    {"CONNECTION_TYPE_NOT_SET", 20, 144},
+  #endif
+  #ifdef SSL_R_CONTEXT_NOT_DANE_ENABLED
+    {"CONTEXT_NOT_DANE_ENABLED", ERR_LIB_SSL, SSL_R_CONTEXT_NOT_DANE_ENABLED},
+  #else
+    {"CONTEXT_NOT_DANE_ENABLED", 20, 167},
+  #endif
+  #ifdef SSL_R_COOKIE_GEN_CALLBACK_FAILURE
+    {"COOKIE_GEN_CALLBACK_FAILURE", ERR_LIB_SSL, SSL_R_COOKIE_GEN_CALLBACK_FAILURE},
+  #else
+    {"COOKIE_GEN_CALLBACK_FAILURE", 20, 400},
+  #endif
+  #ifdef SSL_R_COOKIE_MISMATCH
+    {"COOKIE_MISMATCH", ERR_LIB_SSL, SSL_R_COOKIE_MISMATCH},
+  #else
+    {"COOKIE_MISMATCH", 20, 308},
+  #endif
+  #ifdef SSL_R_COPY_PARAMETERS_FAILED
+    {"COPY_PARAMETERS_FAILED", ERR_LIB_SSL, SSL_R_COPY_PARAMETERS_FAILED},
+  #else
+    {"COPY_PARAMETERS_FAILED", 20, 296},
+  #endif
+  #ifdef SSL_R_CUSTOM_EXT_HANDLER_ALREADY_INSTALLED
+    {"CUSTOM_EXT_HANDLER_ALREADY_INSTALLED", ERR_LIB_SSL, SSL_R_CUSTOM_EXT_HANDLER_ALREADY_INSTALLED},
+  #else
+    {"CUSTOM_EXT_HANDLER_ALREADY_INSTALLED", 20, 206},
+  #endif
+  #ifdef SSL_R_DANE_ALREADY_ENABLED
+    {"DANE_ALREADY_ENABLED", ERR_LIB_SSL, SSL_R_DANE_ALREADY_ENABLED},
+  #else
+    {"DANE_ALREADY_ENABLED", 20, 172},
+  #endif
+  #ifdef SSL_R_DANE_CANNOT_OVERRIDE_MTYPE_FULL
+    {"DANE_CANNOT_OVERRIDE_MTYPE_FULL", ERR_LIB_SSL, SSL_R_DANE_CANNOT_OVERRIDE_MTYPE_FULL},
+  #else
+    {"DANE_CANNOT_OVERRIDE_MTYPE_FULL", 20, 173},
+  #endif
+  #ifdef SSL_R_DANE_NOT_ENABLED
+    {"DANE_NOT_ENABLED", ERR_LIB_SSL, SSL_R_DANE_NOT_ENABLED},
+  #else
+    {"DANE_NOT_ENABLED", 20, 175},
+  #endif
+  #ifdef SSL_R_DANE_TLSA_BAD_CERTIFICATE
+    {"DANE_TLSA_BAD_CERTIFICATE", ERR_LIB_SSL, SSL_R_DANE_TLSA_BAD_CERTIFICATE},
+  #else
+    {"DANE_TLSA_BAD_CERTIFICATE", 20, 180},
+  #endif
+  #ifdef SSL_R_DANE_TLSA_BAD_CERTIFICATE_USAGE
+    {"DANE_TLSA_BAD_CERTIFICATE_USAGE", ERR_LIB_SSL, SSL_R_DANE_TLSA_BAD_CERTIFICATE_USAGE},
+  #else
+    {"DANE_TLSA_BAD_CERTIFICATE_USAGE", 20, 184},
+  #endif
+  #ifdef SSL_R_DANE_TLSA_BAD_DATA_LENGTH
+    {"DANE_TLSA_BAD_DATA_LENGTH", ERR_LIB_SSL, SSL_R_DANE_TLSA_BAD_DATA_LENGTH},
+  #else
+    {"DANE_TLSA_BAD_DATA_LENGTH", 20, 189},
+  #endif
+  #ifdef SSL_R_DANE_TLSA_BAD_DIGEST_LENGTH
+    {"DANE_TLSA_BAD_DIGEST_LENGTH", ERR_LIB_SSL, SSL_R_DANE_TLSA_BAD_DIGEST_LENGTH},
+  #else
+    {"DANE_TLSA_BAD_DIGEST_LENGTH", 20, 192},
+  #endif
+  #ifdef SSL_R_DANE_TLSA_BAD_MATCHING_TYPE
+    {"DANE_TLSA_BAD_MATCHING_TYPE", ERR_LIB_SSL, SSL_R_DANE_TLSA_BAD_MATCHING_TYPE},
+  #else
+    {"DANE_TLSA_BAD_MATCHING_TYPE", 20, 200},
+  #endif
+  #ifdef SSL_R_DANE_TLSA_BAD_PUBLIC_KEY
+    {"DANE_TLSA_BAD_PUBLIC_KEY", ERR_LIB_SSL, SSL_R_DANE_TLSA_BAD_PUBLIC_KEY},
+  #else
+    {"DANE_TLSA_BAD_PUBLIC_KEY", 20, 201},
+  #endif
+  #ifdef SSL_R_DANE_TLSA_BAD_SELECTOR
+    {"DANE_TLSA_BAD_SELECTOR", ERR_LIB_SSL, SSL_R_DANE_TLSA_BAD_SELECTOR},
+  #else
+    {"DANE_TLSA_BAD_SELECTOR", 20, 202},
+  #endif
+  #ifdef SSL_R_DANE_TLSA_NULL_DATA
+    {"DANE_TLSA_NULL_DATA", ERR_LIB_SSL, SSL_R_DANE_TLSA_NULL_DATA},
+  #else
+    {"DANE_TLSA_NULL_DATA", 20, 203},
+  #endif
+  #ifdef SSL_R_DATA_BETWEEN_CCS_AND_FINISHED
+    {"DATA_BETWEEN_CCS_AND_FINISHED", ERR_LIB_SSL, SSL_R_DATA_BETWEEN_CCS_AND_FINISHED},
+  #else
+    {"DATA_BETWEEN_CCS_AND_FINISHED", 20, 145},
+  #endif
+  #ifdef SSL_R_DATA_LENGTH_TOO_LONG
+    {"DATA_LENGTH_TOO_LONG", ERR_LIB_SSL, SSL_R_DATA_LENGTH_TOO_LONG},
+  #else
+    {"DATA_LENGTH_TOO_LONG", 20, 146},
+  #endif
+  #ifdef SSL_R_DECRYPTION_FAILED
+    {"DECRYPTION_FAILED", ERR_LIB_SSL, SSL_R_DECRYPTION_FAILED},
+  #else
+    {"DECRYPTION_FAILED", 20, 147},
+  #endif
+  #ifdef SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC
+    {"DECRYPTION_FAILED_OR_BAD_RECORD_MAC", ERR_LIB_SSL, SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC},
+  #else
+    {"DECRYPTION_FAILED_OR_BAD_RECORD_MAC", 20, 281},
+  #endif
+  #ifdef SSL_R_DH_KEY_TOO_SMALL
+    {"DH_KEY_TOO_SMALL", ERR_LIB_SSL, SSL_R_DH_KEY_TOO_SMALL},
+  #else
+    {"DH_KEY_TOO_SMALL", 20, 394},
+  #endif
+  #ifdef SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG
+    {"DH_PUBLIC_VALUE_LENGTH_IS_WRONG", ERR_LIB_SSL, SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG},
+  #else
+    {"DH_PUBLIC_VALUE_LENGTH_IS_WRONG", 20, 148},
+  #endif
+  #ifdef SSL_R_DIGEST_CHECK_FAILED
+    {"DIGEST_CHECK_FAILED", ERR_LIB_SSL, SSL_R_DIGEST_CHECK_FAILED},
+  #else
+    {"DIGEST_CHECK_FAILED", 20, 149},
+  #endif
+  #ifdef SSL_R_DTLS_MESSAGE_TOO_BIG
+    {"DTLS_MESSAGE_TOO_BIG", ERR_LIB_SSL, SSL_R_DTLS_MESSAGE_TOO_BIG},
+  #else
+    {"DTLS_MESSAGE_TOO_BIG", 20, 334},
+  #endif
+  #ifdef SSL_R_DUPLICATE_COMPRESSION_ID
+    {"DUPLICATE_COMPRESSION_ID", ERR_LIB_SSL, SSL_R_DUPLICATE_COMPRESSION_ID},
+  #else
+    {"DUPLICATE_COMPRESSION_ID", 20, 309},
+  #endif
+  #ifdef SSL_R_ECC_CERT_NOT_FOR_SIGNING
+    {"ECC_CERT_NOT_FOR_SIGNING", ERR_LIB_SSL, SSL_R_ECC_CERT_NOT_FOR_SIGNING},
+  #else
+    {"ECC_CERT_NOT_FOR_SIGNING", 20, 318},
+  #endif
+  #ifdef SSL_R_ECDH_REQUIRED_FOR_SUITEB_MODE
+    {"ECDH_REQUIRED_FOR_SUITEB_MODE", ERR_LIB_SSL, SSL_R_ECDH_REQUIRED_FOR_SUITEB_MODE},
+  #else
+    {"ECDH_REQUIRED_FOR_SUITEB_MODE", 20, 374},
+  #endif
+  #ifdef SSL_R_EE_KEY_TOO_SMALL
+    {"EE_KEY_TOO_SMALL", ERR_LIB_SSL, SSL_R_EE_KEY_TOO_SMALL},
+  #else
+    {"EE_KEY_TOO_SMALL", 20, 399},
+  #endif
+  #ifdef SSL_R_EMPTY_SRTP_PROTECTION_PROFILE_LIST
+    {"EMPTY_SRTP_PROTECTION_PROFILE_LIST", ERR_LIB_SSL, SSL_R_EMPTY_SRTP_PROTECTION_PROFILE_LIST},
+  #else
+    {"EMPTY_SRTP_PROTECTION_PROFILE_LIST", 20, 354},
+  #endif
+  #ifdef SSL_R_ENCRYPTED_LENGTH_TOO_LONG
+    {"ENCRYPTED_LENGTH_TOO_LONG", ERR_LIB_SSL, SSL_R_ENCRYPTED_LENGTH_TOO_LONG},
+  #else
+    {"ENCRYPTED_LENGTH_TOO_LONG", 20, 150},
+  #endif
+  #ifdef SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST
+    {"ERROR_IN_RECEIVED_CIPHER_LIST", ERR_LIB_SSL, SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST},
+  #else
+    {"ERROR_IN_RECEIVED_CIPHER_LIST", 20, 151},
+  #endif
+  #ifdef SSL_R_ERROR_SETTING_TLSA_BASE_DOMAIN
+    {"ERROR_SETTING_TLSA_BASE_DOMAIN", ERR_LIB_SSL, SSL_R_ERROR_SETTING_TLSA_BASE_DOMAIN},
+  #else
+    {"ERROR_SETTING_TLSA_BASE_DOMAIN", 20, 204},
+  #endif
+  #ifdef SSL_R_EXCEEDS_MAX_FRAGMENT_SIZE
+    {"EXCEEDS_MAX_FRAGMENT_SIZE", ERR_LIB_SSL, SSL_R_EXCEEDS_MAX_FRAGMENT_SIZE},
+  #else
+    {"EXCEEDS_MAX_FRAGMENT_SIZE", 20, 194},
+  #endif
+  #ifdef SSL_R_EXCESSIVE_MESSAGE_SIZE
+    {"EXCESSIVE_MESSAGE_SIZE", ERR_LIB_SSL, SSL_R_EXCESSIVE_MESSAGE_SIZE},
+  #else
+    {"EXCESSIVE_MESSAGE_SIZE", 20, 152},
+  #endif
+  #ifdef SSL_R_EXTENSION_NOT_RECEIVED
+    {"EXTENSION_NOT_RECEIVED", ERR_LIB_SSL, SSL_R_EXTENSION_NOT_RECEIVED},
+  #else
+    {"EXTENSION_NOT_RECEIVED", 20, 279},
+  #endif
+  #ifdef SSL_R_EXTRA_DATA_IN_MESSAGE
+    {"EXTRA_DATA_IN_MESSAGE", ERR_LIB_SSL, SSL_R_EXTRA_DATA_IN_MESSAGE},
+  #else
+    {"EXTRA_DATA_IN_MESSAGE", 20, 153},
+  #endif
+  #ifdef SSL_R_EXT_LENGTH_MISMATCH
+    {"EXT_LENGTH_MISMATCH", ERR_LIB_SSL, SSL_R_EXT_LENGTH_MISMATCH},
+  #else
+    {"EXT_LENGTH_MISMATCH", 20, 163},
+  #endif
+  #ifdef SSL_R_FAILED_TO_INIT_ASYNC
+    {"FAILED_TO_INIT_ASYNC", ERR_LIB_SSL, SSL_R_FAILED_TO_INIT_ASYNC},
+  #else
+    {"FAILED_TO_INIT_ASYNC", 20, 405},
+  #endif
+  #ifdef SSL_R_FRAGMENTED_CLIENT_HELLO
+    {"FRAGMENTED_CLIENT_HELLO", ERR_LIB_SSL, SSL_R_FRAGMENTED_CLIENT_HELLO},
+  #else
+    {"FRAGMENTED_CLIENT_HELLO", 20, 401},
+  #endif
+  #ifdef SSL_R_GOT_A_FIN_BEFORE_A_CCS
+    {"GOT_A_FIN_BEFORE_A_CCS", ERR_LIB_SSL, SSL_R_GOT_A_FIN_BEFORE_A_CCS},
+  #else
+    {"GOT_A_FIN_BEFORE_A_CCS", 20, 154},
+  #endif
+  #ifdef SSL_R_HTTPS_PROXY_REQUEST
+    {"HTTPS_PROXY_REQUEST", ERR_LIB_SSL, SSL_R_HTTPS_PROXY_REQUEST},
+  #else
+    {"HTTPS_PROXY_REQUEST", 20, 155},
+  #endif
+  #ifdef SSL_R_HTTP_REQUEST
+    {"HTTP_REQUEST", ERR_LIB_SSL, SSL_R_HTTP_REQUEST},
+  #else
+    {"HTTP_REQUEST", 20, 156},
+  #endif
+  #ifdef SSL_R_ILLEGAL_POINT_COMPRESSION
+    {"ILLEGAL_POINT_COMPRESSION", ERR_LIB_SSL, SSL_R_ILLEGAL_POINT_COMPRESSION},
+  #else
+    {"ILLEGAL_POINT_COMPRESSION", 20, 162},
+  #endif
+  #ifdef SSL_R_ILLEGAL_SUITEB_DIGEST
+    {"ILLEGAL_SUITEB_DIGEST", ERR_LIB_SSL, SSL_R_ILLEGAL_SUITEB_DIGEST},
+  #else
+    {"ILLEGAL_SUITEB_DIGEST", 20, 380},
+  #endif
+  #ifdef SSL_R_INAPPROPRIATE_FALLBACK
+    {"INAPPROPRIATE_FALLBACK", ERR_LIB_SSL, SSL_R_INAPPROPRIATE_FALLBACK},
+  #else
+    {"INAPPROPRIATE_FALLBACK", 20, 373},
+  #endif
+  #ifdef SSL_R_INCONSISTENT_COMPRESSION
+    {"INCONSISTENT_COMPRESSION", ERR_LIB_SSL, SSL_R_INCONSISTENT_COMPRESSION},
+  #else
+    {"INCONSISTENT_COMPRESSION", 20, 340},
+  #endif
+  #ifdef SSL_R_INCONSISTENT_EARLY_DATA_ALPN
+    {"INCONSISTENT_EARLY_DATA_ALPN", ERR_LIB_SSL, SSL_R_INCONSISTENT_EARLY_DATA_ALPN},
+  #else
+    {"INCONSISTENT_EARLY_DATA_ALPN", 20, 222},
+  #endif
+  #ifdef SSL_R_INCONSISTENT_EARLY_DATA_SNI
+    {"INCONSISTENT_EARLY_DATA_SNI", ERR_LIB_SSL, SSL_R_INCONSISTENT_EARLY_DATA_SNI},
+  #else
+    {"INCONSISTENT_EARLY_DATA_SNI", 20, 231},
+  #endif
+  #ifdef SSL_R_INCONSISTENT_EXTMS
+    {"INCONSISTENT_EXTMS", ERR_LIB_SSL, SSL_R_INCONSISTENT_EXTMS},
+  #else
+    {"INCONSISTENT_EXTMS", 20, 104},
+  #endif
+  #ifdef SSL_R_INSUFFICIENT_SECURITY
+    {"INSUFFICIENT_SECURITY", ERR_LIB_SSL, SSL_R_INSUFFICIENT_SECURITY},
+  #else
+    {"INSUFFICIENT_SECURITY", 20, 241},
+  #endif
+  #ifdef SSL_R_INVALID_ALERT
+    {"INVALID_ALERT", ERR_LIB_SSL, SSL_R_INVALID_ALERT},
+  #else
+    {"INVALID_ALERT", 20, 205},
+  #endif
+  #ifdef SSL_R_INVALID_CCS_MESSAGE
+    {"INVALID_CCS_MESSAGE", ERR_LIB_SSL, SSL_R_INVALID_CCS_MESSAGE},
+  #else
+    {"INVALID_CCS_MESSAGE", 20, 260},
+  #endif
+  #ifdef SSL_R_INVALID_CERTIFICATE_OR_ALG
+    {"INVALID_CERTIFICATE_OR_ALG", ERR_LIB_SSL, SSL_R_INVALID_CERTIFICATE_OR_ALG},
+  #else
+    {"INVALID_CERTIFICATE_OR_ALG", 20, 238},
+  #endif
+  #ifdef SSL_R_INVALID_COMMAND
+    {"INVALID_COMMAND", ERR_LIB_SSL, SSL_R_INVALID_COMMAND},
+  #else
+    {"INVALID_COMMAND", 20, 280},
+  #endif
+  #ifdef SSL_R_INVALID_COMPRESSION_ALGORITHM
+    {"INVALID_COMPRESSION_ALGORITHM", ERR_LIB_SSL, SSL_R_INVALID_COMPRESSION_ALGORITHM},
+  #else
+    {"INVALID_COMPRESSION_ALGORITHM", 20, 341},
+  #endif
+  #ifdef SSL_R_INVALID_CONFIG
+    {"INVALID_CONFIG", ERR_LIB_SSL, SSL_R_INVALID_CONFIG},
+  #else
+    {"INVALID_CONFIG", 20, 283},
+  #endif
+  #ifdef SSL_R_INVALID_CONFIGURATION_NAME
+    {"INVALID_CONFIGURATION_NAME", ERR_LIB_SSL, SSL_R_INVALID_CONFIGURATION_NAME},
+  #else
+    {"INVALID_CONFIGURATION_NAME", 20, 113},
+  #endif
+  #ifdef SSL_R_INVALID_CONTEXT
+    {"INVALID_CONTEXT", ERR_LIB_SSL, SSL_R_INVALID_CONTEXT},
+  #else
+    {"INVALID_CONTEXT", 20, 282},
+  #endif
+  #ifdef SSL_R_INVALID_CT_VALIDATION_TYPE
+    {"INVALID_CT_VALIDATION_TYPE", ERR_LIB_SSL, SSL_R_INVALID_CT_VALIDATION_TYPE},
+  #else
+    {"INVALID_CT_VALIDATION_TYPE", 20, 212},
+  #endif
+  #ifdef SSL_R_INVALID_KEY_UPDATE_TYPE
+    {"INVALID_KEY_UPDATE_TYPE", ERR_LIB_SSL, SSL_R_INVALID_KEY_UPDATE_TYPE},
+  #else
+    {"INVALID_KEY_UPDATE_TYPE", 20, 120},
+  #endif
+  #ifdef SSL_R_INVALID_MAX_EARLY_DATA
+    {"INVALID_MAX_EARLY_DATA", ERR_LIB_SSL, SSL_R_INVALID_MAX_EARLY_DATA},
+  #else
+    {"INVALID_MAX_EARLY_DATA", 20, 174},
+  #endif
+  #ifdef SSL_R_INVALID_NULL_CMD_NAME
+    {"INVALID_NULL_CMD_NAME", ERR_LIB_SSL, SSL_R_INVALID_NULL_CMD_NAME},
+  #else
+    {"INVALID_NULL_CMD_NAME", 20, 385},
+  #endif
+  #ifdef SSL_R_INVALID_SEQUENCE_NUMBER
+    {"INVALID_SEQUENCE_NUMBER", ERR_LIB_SSL, SSL_R_INVALID_SEQUENCE_NUMBER},
+  #else
+    {"INVALID_SEQUENCE_NUMBER", 20, 402},
+  #endif
+  #ifdef SSL_R_INVALID_SERVERINFO_DATA
+    {"INVALID_SERVERINFO_DATA", ERR_LIB_SSL, SSL_R_INVALID_SERVERINFO_DATA},
+  #else
+    {"INVALID_SERVERINFO_DATA", 20, 388},
+  #endif
+  #ifdef SSL_R_INVALID_SESSION_ID
+    {"INVALID_SESSION_ID", ERR_LIB_SSL, SSL_R_INVALID_SESSION_ID},
+  #else
+    {"INVALID_SESSION_ID", 20, 999},
+  #endif
+  #ifdef SSL_R_INVALID_SRP_USERNAME
+    {"INVALID_SRP_USERNAME", ERR_LIB_SSL, SSL_R_INVALID_SRP_USERNAME},
+  #else
+    {"INVALID_SRP_USERNAME", 20, 357},
+  #endif
+  #ifdef SSL_R_INVALID_STATUS_RESPONSE
+    {"INVALID_STATUS_RESPONSE", ERR_LIB_SSL, SSL_R_INVALID_STATUS_RESPONSE},
+  #else
+    {"INVALID_STATUS_RESPONSE", 20, 328},
+  #endif
+  #ifdef SSL_R_INVALID_TICKET_KEYS_LENGTH
+    {"INVALID_TICKET_KEYS_LENGTH", ERR_LIB_SSL, SSL_R_INVALID_TICKET_KEYS_LENGTH},
+  #else
+    {"INVALID_TICKET_KEYS_LENGTH", 20, 325},
+  #endif
+  #ifdef SSL_R_LENGTH_MISMATCH
+    {"LENGTH_MISMATCH", ERR_LIB_SSL, SSL_R_LENGTH_MISMATCH},
+  #else
+    {"LENGTH_MISMATCH", 20, 159},
+  #endif
+  #ifdef SSL_R_LENGTH_TOO_LONG
+    {"LENGTH_TOO_LONG", ERR_LIB_SSL, SSL_R_LENGTH_TOO_LONG},
+  #else
+    {"LENGTH_TOO_LONG", 20, 404},
+  #endif
+  #ifdef SSL_R_LENGTH_TOO_SHORT
+    {"LENGTH_TOO_SHORT", ERR_LIB_SSL, SSL_R_LENGTH_TOO_SHORT},
+  #else
+    {"LENGTH_TOO_SHORT", 20, 160},
+  #endif
+  #ifdef SSL_R_LIBRARY_BUG
+    {"LIBRARY_BUG", ERR_LIB_SSL, SSL_R_LIBRARY_BUG},
+  #else
+    {"LIBRARY_BUG", 20, 274},
+  #endif
+  #ifdef SSL_R_LIBRARY_HAS_NO_CIPHERS
+    {"LIBRARY_HAS_NO_CIPHERS", ERR_LIB_SSL, SSL_R_LIBRARY_HAS_NO_CIPHERS},
+  #else
+    {"LIBRARY_HAS_NO_CIPHERS", 20, 161},
+  #endif
+  #ifdef SSL_R_MISSING_DSA_SIGNING_CERT
+    {"MISSING_DSA_SIGNING_CERT", ERR_LIB_SSL, SSL_R_MISSING_DSA_SIGNING_CERT},
+  #else
+    {"MISSING_DSA_SIGNING_CERT", 20, 165},
+  #endif
+  #ifdef SSL_R_MISSING_ECDSA_SIGNING_CERT
+    {"MISSING_ECDSA_SIGNING_CERT", ERR_LIB_SSL, SSL_R_MISSING_ECDSA_SIGNING_CERT},
+  #else
+    {"MISSING_ECDSA_SIGNING_CERT", 20, 381},
+  #endif
+  #ifdef SSL_R_MISSING_FATAL
+    {"MISSING_FATAL", ERR_LIB_SSL, SSL_R_MISSING_FATAL},
+  #else
+    {"MISSING_FATAL", 20, 256},
+  #endif
+  #ifdef SSL_R_MISSING_PARAMETERS
+    {"MISSING_PARAMETERS", ERR_LIB_SSL, SSL_R_MISSING_PARAMETERS},
+  #else
+    {"MISSING_PARAMETERS", 20, 290},
+  #endif
+  #ifdef SSL_R_MISSING_RSA_CERTIFICATE
+    {"MISSING_RSA_CERTIFICATE", ERR_LIB_SSL, SSL_R_MISSING_RSA_CERTIFICATE},
+  #else
+    {"MISSING_RSA_CERTIFICATE", 20, 168},
+  #endif
+  #ifdef SSL_R_MISSING_RSA_ENCRYPTING_CERT
+    {"MISSING_RSA_ENCRYPTING_CERT", ERR_LIB_SSL, SSL_R_MISSING_RSA_ENCRYPTING_CERT},
+  #else
+    {"MISSING_RSA_ENCRYPTING_CERT", 20, 169},
+  #endif
+  #ifdef SSL_R_MISSING_RSA_SIGNING_CERT
+    {"MISSING_RSA_SIGNING_CERT", ERR_LIB_SSL, SSL_R_MISSING_RSA_SIGNING_CERT},
+  #else
+    {"MISSING_RSA_SIGNING_CERT", 20, 170},
+  #endif
+  #ifdef SSL_R_MISSING_SIGALGS_EXTENSION
+    {"MISSING_SIGALGS_EXTENSION", ERR_LIB_SSL, SSL_R_MISSING_SIGALGS_EXTENSION},
+  #else
+    {"MISSING_SIGALGS_EXTENSION", 20, 112},
+  #endif
+  #ifdef SSL_R_MISSING_SIGNING_CERT
+    {"MISSING_SIGNING_CERT", ERR_LIB_SSL, SSL_R_MISSING_SIGNING_CERT},
+  #else
+    {"MISSING_SIGNING_CERT", 20, 221},
+  #endif
+  #ifdef SSL_R_MISSING_SRP_PARAM
+    {"MISSING_SRP_PARAM", ERR_LIB_SSL, SSL_R_MISSING_SRP_PARAM},
+  #else
+    {"MISSING_SRP_PARAM", 20, 358},
+  #endif
+  #ifdef SSL_R_MISSING_SUPPORTED_GROUPS_EXTENSION
+    {"MISSING_SUPPORTED_GROUPS_EXTENSION", ERR_LIB_SSL, SSL_R_MISSING_SUPPORTED_GROUPS_EXTENSION},
+  #else
+    {"MISSING_SUPPORTED_GROUPS_EXTENSION", 20, 209},
+  #endif
+  #ifdef SSL_R_MISSING_TMP_DH_KEY
+    {"MISSING_TMP_DH_KEY", ERR_LIB_SSL, SSL_R_MISSING_TMP_DH_KEY},
+  #else
+    {"MISSING_TMP_DH_KEY", 20, 171},
+  #endif
+  #ifdef SSL_R_MISSING_TMP_ECDH_KEY
+    {"MISSING_TMP_ECDH_KEY", ERR_LIB_SSL, SSL_R_MISSING_TMP_ECDH_KEY},
+  #else
+    {"MISSING_TMP_ECDH_KEY", 20, 311},
+  #endif
+  #ifdef SSL_R_MIXED_HANDSHAKE_AND_NON_HANDSHAKE_DATA
+    {"MIXED_HANDSHAKE_AND_NON_HANDSHAKE_DATA", ERR_LIB_SSL, SSL_R_MIXED_HANDSHAKE_AND_NON_HANDSHAKE_DATA},
+  #else
+    {"MIXED_HANDSHAKE_AND_NON_HANDSHAKE_DATA", 20, 293},
+  #endif
+  #ifdef SSL_R_NOT_ON_RECORD_BOUNDARY
+    {"NOT_ON_RECORD_BOUNDARY", ERR_LIB_SSL, SSL_R_NOT_ON_RECORD_BOUNDARY},
+  #else
+    {"NOT_ON_RECORD_BOUNDARY", 20, 182},
+  #endif
+  #ifdef SSL_R_NOT_REPLACING_CERTIFICATE
+    {"NOT_REPLACING_CERTIFICATE", ERR_LIB_SSL, SSL_R_NOT_REPLACING_CERTIFICATE},
+  #else
+    {"NOT_REPLACING_CERTIFICATE", 20, 289},
+  #endif
+  #ifdef SSL_R_NOT_SERVER
+    {"NOT_SERVER", ERR_LIB_SSL, SSL_R_NOT_SERVER},
+  #else
+    {"NOT_SERVER", 20, 284},
+  #endif
+  #ifdef SSL_R_NO_APPLICATION_PROTOCOL
+    {"NO_APPLICATION_PROTOCOL", ERR_LIB_SSL, SSL_R_NO_APPLICATION_PROTOCOL},
+  #else
+    {"NO_APPLICATION_PROTOCOL", 20, 235},
+  #endif
+  #ifdef SSL_R_NO_CERTIFICATES_RETURNED
+    {"NO_CERTIFICATES_RETURNED", ERR_LIB_SSL, SSL_R_NO_CERTIFICATES_RETURNED},
+  #else
+    {"NO_CERTIFICATES_RETURNED", 20, 176},
+  #endif
+  #ifdef SSL_R_NO_CERTIFICATE_ASSIGNED
+    {"NO_CERTIFICATE_ASSIGNED", ERR_LIB_SSL, SSL_R_NO_CERTIFICATE_ASSIGNED},
+  #else
+    {"NO_CERTIFICATE_ASSIGNED", 20, 177},
+  #endif
+  #ifdef SSL_R_NO_CERTIFICATE_SET
+    {"NO_CERTIFICATE_SET", ERR_LIB_SSL, SSL_R_NO_CERTIFICATE_SET},
+  #else
+    {"NO_CERTIFICATE_SET", 20, 179},
+  #endif
+  #ifdef SSL_R_NO_CHANGE_FOLLOWING_HRR
+    {"NO_CHANGE_FOLLOWING_HRR", ERR_LIB_SSL, SSL_R_NO_CHANGE_FOLLOWING_HRR},
+  #else
+    {"NO_CHANGE_FOLLOWING_HRR", 20, 214},
+  #endif
+  #ifdef SSL_R_NO_CIPHERS_AVAILABLE
+    {"NO_CIPHERS_AVAILABLE", ERR_LIB_SSL, SSL_R_NO_CIPHERS_AVAILABLE},
+  #else
+    {"NO_CIPHERS_AVAILABLE", 20, 181},
+  #endif
+  #ifdef SSL_R_NO_CIPHERS_SPECIFIED
+    {"NO_CIPHERS_SPECIFIED", ERR_LIB_SSL, SSL_R_NO_CIPHERS_SPECIFIED},
+  #else
+    {"NO_CIPHERS_SPECIFIED", 20, 183},
+  #endif
+  #ifdef SSL_R_NO_CIPHER_MATCH
+    {"NO_CIPHER_MATCH", ERR_LIB_SSL, SSL_R_NO_CIPHER_MATCH},
+  #else
+    {"NO_CIPHER_MATCH", 20, 185},
+  #endif
+  #ifdef SSL_R_NO_CLIENT_CERT_METHOD
+    {"NO_CLIENT_CERT_METHOD", ERR_LIB_SSL, SSL_R_NO_CLIENT_CERT_METHOD},
+  #else
+    {"NO_CLIENT_CERT_METHOD", 20, 331},
+  #endif
+  #ifdef SSL_R_NO_COMPRESSION_SPECIFIED
+    {"NO_COMPRESSION_SPECIFIED", ERR_LIB_SSL, SSL_R_NO_COMPRESSION_SPECIFIED},
+  #else
+    {"NO_COMPRESSION_SPECIFIED", 20, 187},
+  #endif
+  #ifdef SSL_R_NO_COOKIE_CALLBACK_SET
+    {"NO_COOKIE_CALLBACK_SET", ERR_LIB_SSL, SSL_R_NO_COOKIE_CALLBACK_SET},
+  #else
+    {"NO_COOKIE_CALLBACK_SET", 20, 287},
+  #endif
+  #ifdef SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER
+    {"NO_GOST_CERTIFICATE_SENT_BY_PEER", ERR_LIB_SSL, SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER},
+  #else
+    {"NO_GOST_CERTIFICATE_SENT_BY_PEER", 20, 330},
+  #endif
+  #ifdef SSL_R_NO_METHOD_SPECIFIED
+    {"NO_METHOD_SPECIFIED", ERR_LIB_SSL, SSL_R_NO_METHOD_SPECIFIED},
+  #else
+    {"NO_METHOD_SPECIFIED", 20, 188},
+  #endif
+  #ifdef SSL_R_NO_PEM_EXTENSIONS
+    {"NO_PEM_EXTENSIONS", ERR_LIB_SSL, SSL_R_NO_PEM_EXTENSIONS},
+  #else
+    {"NO_PEM_EXTENSIONS", 20, 389},
+  #endif
+  #ifdef SSL_R_NO_PRIVATE_KEY_ASSIGNED
+    {"NO_PRIVATE_KEY_ASSIGNED", ERR_LIB_SSL, SSL_R_NO_PRIVATE_KEY_ASSIGNED},
+  #else
+    {"NO_PRIVATE_KEY_ASSIGNED", 20, 190},
+  #endif
+  #ifdef SSL_R_NO_PROTOCOLS_AVAILABLE
+    {"NO_PROTOCOLS_AVAILABLE", ERR_LIB_SSL, SSL_R_NO_PROTOCOLS_AVAILABLE},
+  #else
+    {"NO_PROTOCOLS_AVAILABLE", 20, 191},
+  #endif
+  #ifdef SSL_R_NO_RENEGOTIATION
+    {"NO_RENEGOTIATION", ERR_LIB_SSL, SSL_R_NO_RENEGOTIATION},
+  #else
+    {"NO_RENEGOTIATION", 20, 339},
+  #endif
+  #ifdef SSL_R_NO_REQUIRED_DIGEST
+    {"NO_REQUIRED_DIGEST", ERR_LIB_SSL, SSL_R_NO_REQUIRED_DIGEST},
+  #else
+    {"NO_REQUIRED_DIGEST", 20, 324},
+  #endif
+  #ifdef SSL_R_NO_SHARED_CIPHER
+    {"NO_SHARED_CIPHER", ERR_LIB_SSL, SSL_R_NO_SHARED_CIPHER},
+  #else
+    {"NO_SHARED_CIPHER", 20, 193},
+  #endif
+  #ifdef SSL_R_NO_SHARED_GROUPS
+    {"NO_SHARED_GROUPS", ERR_LIB_SSL, SSL_R_NO_SHARED_GROUPS},
+  #else
+    {"NO_SHARED_GROUPS", 20, 410},
+  #endif
+  #ifdef SSL_R_NO_SHARED_SIGNATURE_ALGORITHMS
+    {"NO_SHARED_SIGNATURE_ALGORITHMS", ERR_LIB_SSL, SSL_R_NO_SHARED_SIGNATURE_ALGORITHMS},
+  #else
+    {"NO_SHARED_SIGNATURE_ALGORITHMS", 20, 376},
+  #endif
+  #ifdef SSL_R_NO_SRTP_PROFILES
+    {"NO_SRTP_PROFILES", ERR_LIB_SSL, SSL_R_NO_SRTP_PROFILES},
+  #else
+    {"NO_SRTP_PROFILES", 20, 359},
+  #endif
+  #ifdef SSL_R_NO_SUITABLE_DIGEST_ALGORITHM
+    {"NO_SUITABLE_DIGEST_ALGORITHM", ERR_LIB_SSL, SSL_R_NO_SUITABLE_DIGEST_ALGORITHM},
+  #else
+    {"NO_SUITABLE_DIGEST_ALGORITHM", 20, 297},
+  #endif
+  #ifdef SSL_R_NO_SUITABLE_GROUPS
+    {"NO_SUITABLE_GROUPS", ERR_LIB_SSL, SSL_R_NO_SUITABLE_GROUPS},
+  #else
+    {"NO_SUITABLE_GROUPS", 20, 295},
+  #endif
+  #ifdef SSL_R_NO_SUITABLE_KEY_SHARE
+    {"NO_SUITABLE_KEY_SHARE", ERR_LIB_SSL, SSL_R_NO_SUITABLE_KEY_SHARE},
+  #else
+    {"NO_SUITABLE_KEY_SHARE", 20, 101},
+  #endif
+  #ifdef SSL_R_NO_SUITABLE_SIGNATURE_ALGORITHM
+    {"NO_SUITABLE_SIGNATURE_ALGORITHM", ERR_LIB_SSL, SSL_R_NO_SUITABLE_SIGNATURE_ALGORITHM},
+  #else
+    {"NO_SUITABLE_SIGNATURE_ALGORITHM", 20, 118},
+  #endif
+  #ifdef SSL_R_NO_VALID_SCTS
+    {"NO_VALID_SCTS", ERR_LIB_SSL, SSL_R_NO_VALID_SCTS},
+  #else
+    {"NO_VALID_SCTS", 20, 216},
+  #endif
+  #ifdef SSL_R_NO_VERIFY_COOKIE_CALLBACK
+    {"NO_VERIFY_COOKIE_CALLBACK", ERR_LIB_SSL, SSL_R_NO_VERIFY_COOKIE_CALLBACK},
+  #else
+    {"NO_VERIFY_COOKIE_CALLBACK", 20, 403},
+  #endif
+  #ifdef SSL_R_NULL_SSL_CTX
+    {"NULL_SSL_CTX", ERR_LIB_SSL, SSL_R_NULL_SSL_CTX},
+  #else
+    {"NULL_SSL_CTX", 20, 195},
+  #endif
+  #ifdef SSL_R_NULL_SSL_METHOD_PASSED
+    {"NULL_SSL_METHOD_PASSED", ERR_LIB_SSL, SSL_R_NULL_SSL_METHOD_PASSED},
+  #else
+    {"NULL_SSL_METHOD_PASSED", 20, 196},
+  #endif
+  #ifdef SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED
+    {"OLD_SESSION_CIPHER_NOT_RETURNED", ERR_LIB_SSL, SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED},
+  #else
+    {"OLD_SESSION_CIPHER_NOT_RETURNED", 20, 197},
+  #endif
+  #ifdef SSL_R_OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED
+    {"OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED", ERR_LIB_SSL, SSL_R_OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED},
+  #else
+    {"OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED", 20, 344},
+  #endif
+  #ifdef SSL_R_OVERFLOW_ERROR
+    {"OVERFLOW_ERROR", ERR_LIB_SSL, SSL_R_OVERFLOW_ERROR},
+  #else
+    {"OVERFLOW_ERROR", 20, 237},
+  #endif
+  #ifdef SSL_R_PACKET_LENGTH_TOO_LONG
+    {"PACKET_LENGTH_TOO_LONG", ERR_LIB_SSL, SSL_R_PACKET_LENGTH_TOO_LONG},
+  #else
+    {"PACKET_LENGTH_TOO_LONG", 20, 198},
+  #endif
+  #ifdef SSL_R_PARSE_TLSEXT
+    {"PARSE_TLSEXT", ERR_LIB_SSL, SSL_R_PARSE_TLSEXT},
+  #else
+    {"PARSE_TLSEXT", 20, 227},
+  #endif
+  #ifdef SSL_R_PATH_TOO_LONG
+    {"PATH_TOO_LONG", ERR_LIB_SSL, SSL_R_PATH_TOO_LONG},
+  #else
+    {"PATH_TOO_LONG", 20, 270},
+  #endif
+  #ifdef SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE
+    {"PEER_DID_NOT_RETURN_A_CERTIFICATE", ERR_LIB_SSL, SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE},
+  #else
+    {"PEER_DID_NOT_RETURN_A_CERTIFICATE", 20, 199},
+  #endif
+  #ifdef SSL_R_PEM_NAME_BAD_PREFIX
+    {"PEM_NAME_BAD_PREFIX", ERR_LIB_SSL, SSL_R_PEM_NAME_BAD_PREFIX},
+  #else
+    {"PEM_NAME_BAD_PREFIX", 20, 391},
+  #endif
+  #ifdef SSL_R_PEM_NAME_TOO_SHORT
+    {"PEM_NAME_TOO_SHORT", ERR_LIB_SSL, SSL_R_PEM_NAME_TOO_SHORT},
+  #else
+    {"PEM_NAME_TOO_SHORT", 20, 392},
+  #endif
+  #ifdef SSL_R_PIPELINE_FAILURE
+    {"PIPELINE_FAILURE", ERR_LIB_SSL, SSL_R_PIPELINE_FAILURE},
+  #else
+    {"PIPELINE_FAILURE", 20, 406},
+  #endif
+  #ifdef SSL_R_POST_HANDSHAKE_AUTH_ENCODING_ERR
+    {"POST_HANDSHAKE_AUTH_ENCODING_ERR", ERR_LIB_SSL, SSL_R_POST_HANDSHAKE_AUTH_ENCODING_ERR},
+  #else
+    {"POST_HANDSHAKE_AUTH_ENCODING_ERR", 20, 278},
+  #endif
+  #ifdef SSL_R_PRIVATE_KEY_MISMATCH
+    {"PRIVATE_KEY_MISMATCH", ERR_LIB_SSL, SSL_R_PRIVATE_KEY_MISMATCH},
+  #else
+    {"PRIVATE_KEY_MISMATCH", 20, 288},
+  #endif
+  #ifdef SSL_R_PROTOCOL_IS_SHUTDOWN
+    {"PROTOCOL_IS_SHUTDOWN", ERR_LIB_SSL, SSL_R_PROTOCOL_IS_SHUTDOWN},
+  #else
+    {"PROTOCOL_IS_SHUTDOWN", 20, 207},
+  #endif
+  #ifdef SSL_R_PSK_IDENTITY_NOT_FOUND
+    {"PSK_IDENTITY_NOT_FOUND", ERR_LIB_SSL, SSL_R_PSK_IDENTITY_NOT_FOUND},
+  #else
+    {"PSK_IDENTITY_NOT_FOUND", 20, 223},
+  #endif
+  #ifdef SSL_R_PSK_NO_CLIENT_CB
+    {"PSK_NO_CLIENT_CB", ERR_LIB_SSL, SSL_R_PSK_NO_CLIENT_CB},
+  #else
+    {"PSK_NO_CLIENT_CB", 20, 224},
+  #endif
+  #ifdef SSL_R_PSK_NO_SERVER_CB
+    {"PSK_NO_SERVER_CB", ERR_LIB_SSL, SSL_R_PSK_NO_SERVER_CB},
+  #else
+    {"PSK_NO_SERVER_CB", 20, 225},
+  #endif
+  #ifdef SSL_R_READ_BIO_NOT_SET
+    {"READ_BIO_NOT_SET", ERR_LIB_SSL, SSL_R_READ_BIO_NOT_SET},
+  #else
+    {"READ_BIO_NOT_SET", 20, 211},
+  #endif
+  #ifdef SSL_R_READ_TIMEOUT_EXPIRED
+    {"READ_TIMEOUT_EXPIRED", ERR_LIB_SSL, SSL_R_READ_TIMEOUT_EXPIRED},
+  #else
+    {"READ_TIMEOUT_EXPIRED", 20, 312},
+  #endif
+  #ifdef SSL_R_RECORD_LENGTH_MISMATCH
+    {"RECORD_LENGTH_MISMATCH", ERR_LIB_SSL, SSL_R_RECORD_LENGTH_MISMATCH},
+  #else
+    {"RECORD_LENGTH_MISMATCH", 20, 213},
+  #endif
+  #ifdef SSL_R_RECORD_TOO_SMALL
+    {"RECORD_TOO_SMALL", ERR_LIB_SSL, SSL_R_RECORD_TOO_SMALL},
+  #else
+    {"RECORD_TOO_SMALL", 20, 298},
+  #endif
+  #ifdef SSL_R_RENEGOTIATE_EXT_TOO_LONG
+    {"RENEGOTIATE_EXT_TOO_LONG", ERR_LIB_SSL, SSL_R_RENEGOTIATE_EXT_TOO_LONG},
+  #else
+    {"RENEGOTIATE_EXT_TOO_LONG", 20, 335},
+  #endif
+  #ifdef SSL_R_RENEGOTIATION_ENCODING_ERR
+    {"RENEGOTIATION_ENCODING_ERR", ERR_LIB_SSL, SSL_R_RENEGOTIATION_ENCODING_ERR},
+  #else
+    {"RENEGOTIATION_ENCODING_ERR", 20, 336},
+  #endif
+  #ifdef SSL_R_RENEGOTIATION_MISMATCH
+    {"RENEGOTIATION_MISMATCH", ERR_LIB_SSL, SSL_R_RENEGOTIATION_MISMATCH},
+  #else
+    {"RENEGOTIATION_MISMATCH", 20, 337},
+  #endif
+  #ifdef SSL_R_REQUEST_PENDING
+    {"REQUEST_PENDING", ERR_LIB_SSL, SSL_R_REQUEST_PENDING},
+  #else
+    {"REQUEST_PENDING", 20, 285},
+  #endif
+  #ifdef SSL_R_REQUEST_SENT
+    {"REQUEST_SENT", ERR_LIB_SSL, SSL_R_REQUEST_SENT},
+  #else
+    {"REQUEST_SENT", 20, 286},
+  #endif
+  #ifdef SSL_R_REQUIRED_CIPHER_MISSING
+    {"REQUIRED_CIPHER_MISSING", ERR_LIB_SSL, SSL_R_REQUIRED_CIPHER_MISSING},
+  #else
+    {"REQUIRED_CIPHER_MISSING", 20, 215},
+  #endif
+  #ifdef SSL_R_REQUIRED_COMPRESSION_ALGORITHM_MISSING
+    {"REQUIRED_COMPRESSION_ALGORITHM_MISSING", ERR_LIB_SSL, SSL_R_REQUIRED_COMPRESSION_ALGORITHM_MISSING},
+  #else
+    {"REQUIRED_COMPRESSION_ALGORITHM_MISSING", 20, 342},
+  #endif
+  #ifdef SSL_R_SCSV_RECEIVED_WHEN_RENEGOTIATING
+    {"SCSV_RECEIVED_WHEN_RENEGOTIATING", ERR_LIB_SSL, SSL_R_SCSV_RECEIVED_WHEN_RENEGOTIATING},
+  #else
+    {"SCSV_RECEIVED_WHEN_RENEGOTIATING", 20, 345},
+  #endif
+  #ifdef SSL_R_SCT_VERIFICATION_FAILED
+    {"SCT_VERIFICATION_FAILED", ERR_LIB_SSL, SSL_R_SCT_VERIFICATION_FAILED},
+  #else
+    {"SCT_VERIFICATION_FAILED", 20, 208},
+  #endif
+  #ifdef SSL_R_SERVERHELLO_TLSEXT
+    {"SERVERHELLO_TLSEXT", ERR_LIB_SSL, SSL_R_SERVERHELLO_TLSEXT},
+  #else
+    {"SERVERHELLO_TLSEXT", 20, 275},
+  #endif
+  #ifdef SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED
+    {"SESSION_ID_CONTEXT_UNINITIALIZED", ERR_LIB_SSL, SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED},
+  #else
+    {"SESSION_ID_CONTEXT_UNINITIALIZED", 20, 277},
+  #endif
+  #ifdef SSL_R_SHUTDOWN_WHILE_IN_INIT
+    {"SHUTDOWN_WHILE_IN_INIT", ERR_LIB_SSL, SSL_R_SHUTDOWN_WHILE_IN_INIT},
+  #else
+    {"SHUTDOWN_WHILE_IN_INIT", 20, 407},
+  #endif
+  #ifdef SSL_R_SIGNATURE_ALGORITHMS_ERROR
+    {"SIGNATURE_ALGORITHMS_ERROR", ERR_LIB_SSL, SSL_R_SIGNATURE_ALGORITHMS_ERROR},
+  #else
+    {"SIGNATURE_ALGORITHMS_ERROR", 20, 360},
+  #endif
+  #ifdef SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE
+    {"SIGNATURE_FOR_NON_SIGNING_CERTIFICATE", ERR_LIB_SSL, SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE},
+  #else
+    {"SIGNATURE_FOR_NON_SIGNING_CERTIFICATE", 20, 220},
+  #endif
+  #ifdef SSL_R_SRP_A_CALC
+    {"SRP_A_CALC", ERR_LIB_SSL, SSL_R_SRP_A_CALC},
+  #else
+    {"SRP_A_CALC", 20, 361},
+  #endif
+  #ifdef SSL_R_SRTP_COULD_NOT_ALLOCATE_PROFILES
+    {"SRTP_COULD_NOT_ALLOCATE_PROFILES", ERR_LIB_SSL, SSL_R_SRTP_COULD_NOT_ALLOCATE_PROFILES},
+  #else
+    {"SRTP_COULD_NOT_ALLOCATE_PROFILES", 20, 362},
+  #endif
+  #ifdef SSL_R_SRTP_PROTECTION_PROFILE_LIST_TOO_LONG
+    {"SRTP_PROTECTION_PROFILE_LIST_TOO_LONG", ERR_LIB_SSL, SSL_R_SRTP_PROTECTION_PROFILE_LIST_TOO_LONG},
+  #else
+    {"SRTP_PROTECTION_PROFILE_LIST_TOO_LONG", 20, 363},
+  #endif
+  #ifdef SSL_R_SRTP_UNKNOWN_PROTECTION_PROFILE
+    {"SRTP_UNKNOWN_PROTECTION_PROFILE", ERR_LIB_SSL, SSL_R_SRTP_UNKNOWN_PROTECTION_PROFILE},
+  #else
+    {"SRTP_UNKNOWN_PROTECTION_PROFILE", 20, 364},
+  #endif
+  #ifdef SSL_R_SSL3_EXT_INVALID_MAX_FRAGMENT_LENGTH
+    {"SSL3_EXT_INVALID_MAX_FRAGMENT_LENGTH", ERR_LIB_SSL, SSL_R_SSL3_EXT_INVALID_MAX_FRAGMENT_LENGTH},
+  #else
+    {"SSL3_EXT_INVALID_MAX_FRAGMENT_LENGTH", 20, 232},
+  #endif
+  #ifdef SSL_R_SSL3_EXT_INVALID_SERVERNAME
+    {"SSL3_EXT_INVALID_SERVERNAME", ERR_LIB_SSL, SSL_R_SSL3_EXT_INVALID_SERVERNAME},
+  #else
+    {"SSL3_EXT_INVALID_SERVERNAME", 20, 319},
+  #endif
+  #ifdef SSL_R_SSL3_EXT_INVALID_SERVERNAME_TYPE
+    {"SSL3_EXT_INVALID_SERVERNAME_TYPE", ERR_LIB_SSL, SSL_R_SSL3_EXT_INVALID_SERVERNAME_TYPE},
+  #else
+    {"SSL3_EXT_INVALID_SERVERNAME_TYPE", 20, 320},
+  #endif
+  #ifdef SSL_R_SSL3_SESSION_ID_TOO_LONG
+    {"SSL3_SESSION_ID_TOO_LONG", ERR_LIB_SSL, SSL_R_SSL3_SESSION_ID_TOO_LONG},
+  #else
+    {"SSL3_SESSION_ID_TOO_LONG", 20, 300},
+  #endif
+  #ifdef SSL_R_SSLV3_ALERT_BAD_CERTIFICATE
+    {"SSLV3_ALERT_BAD_CERTIFICATE", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_BAD_CERTIFICATE},
+  #else
+    {"SSLV3_ALERT_BAD_CERTIFICATE", 20, 1042},
+  #endif
+  #ifdef SSL_R_SSLV3_ALERT_BAD_RECORD_MAC
+    {"SSLV3_ALERT_BAD_RECORD_MAC", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_BAD_RECORD_MAC},
+  #else
+    {"SSLV3_ALERT_BAD_RECORD_MAC", 20, 1020},
+  #endif
+  #ifdef SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED
+    {"SSLV3_ALERT_CERTIFICATE_EXPIRED", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED},
+  #else
+    {"SSLV3_ALERT_CERTIFICATE_EXPIRED", 20, 1045},
+  #endif
+  #ifdef SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED
+    {"SSLV3_ALERT_CERTIFICATE_REVOKED", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED},
+  #else
+    {"SSLV3_ALERT_CERTIFICATE_REVOKED", 20, 1044},
+  #endif
+  #ifdef SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN
+    {"SSLV3_ALERT_CERTIFICATE_UNKNOWN", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN},
+  #else
+    {"SSLV3_ALERT_CERTIFICATE_UNKNOWN", 20, 1046},
+  #endif
+  #ifdef SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE
+    {"SSLV3_ALERT_DECOMPRESSION_FAILURE", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE},
+  #else
+    {"SSLV3_ALERT_DECOMPRESSION_FAILURE", 20, 1030},
+  #endif
+  #ifdef SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE
+    {"SSLV3_ALERT_HANDSHAKE_FAILURE", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE},
+  #else
+    {"SSLV3_ALERT_HANDSHAKE_FAILURE", 20, 1040},
+  #endif
+  #ifdef SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER
+    {"SSLV3_ALERT_ILLEGAL_PARAMETER", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER},
+  #else
+    {"SSLV3_ALERT_ILLEGAL_PARAMETER", 20, 1047},
+  #endif
+  #ifdef SSL_R_SSLV3_ALERT_NO_CERTIFICATE
+    {"SSLV3_ALERT_NO_CERTIFICATE", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_NO_CERTIFICATE},
+  #else
+    {"SSLV3_ALERT_NO_CERTIFICATE", 20, 1041},
+  #endif
+  #ifdef SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE
+    {"SSLV3_ALERT_UNEXPECTED_MESSAGE", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE},
+  #else
+    {"SSLV3_ALERT_UNEXPECTED_MESSAGE", 20, 1010},
+  #endif
+  #ifdef SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE
+    {"SSLV3_ALERT_UNSUPPORTED_CERTIFICATE", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE},
+  #else
+    {"SSLV3_ALERT_UNSUPPORTED_CERTIFICATE", 20, 1043},
+  #endif
+  #ifdef SSL_R_SSL_COMMAND_SECTION_EMPTY
+    {"SSL_COMMAND_SECTION_EMPTY", ERR_LIB_SSL, SSL_R_SSL_COMMAND_SECTION_EMPTY},
+  #else
+    {"SSL_COMMAND_SECTION_EMPTY", 20, 117},
+  #endif
+  #ifdef SSL_R_SSL_COMMAND_SECTION_NOT_FOUND
+    {"SSL_COMMAND_SECTION_NOT_FOUND", ERR_LIB_SSL, SSL_R_SSL_COMMAND_SECTION_NOT_FOUND},
+  #else
+    {"SSL_COMMAND_SECTION_NOT_FOUND", 20, 125},
+  #endif
+  #ifdef SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION
+    {"SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION", ERR_LIB_SSL, SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION},
+  #else
+    {"SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION", 20, 228},
+  #endif
+  #ifdef SSL_R_SSL_HANDSHAKE_FAILURE
+    {"SSL_HANDSHAKE_FAILURE", ERR_LIB_SSL, SSL_R_SSL_HANDSHAKE_FAILURE},
+  #else
+    {"SSL_HANDSHAKE_FAILURE", 20, 229},
+  #endif
+  #ifdef SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS
+    {"SSL_LIBRARY_HAS_NO_CIPHERS", ERR_LIB_SSL, SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS},
+  #else
+    {"SSL_LIBRARY_HAS_NO_CIPHERS", 20, 230},
+  #endif
+  #ifdef SSL_R_SSL_NEGATIVE_LENGTH
+    {"SSL_NEGATIVE_LENGTH", ERR_LIB_SSL, SSL_R_SSL_NEGATIVE_LENGTH},
+  #else
+    {"SSL_NEGATIVE_LENGTH", 20, 372},
+  #endif
+  #ifdef SSL_R_SSL_SECTION_EMPTY
+    {"SSL_SECTION_EMPTY", ERR_LIB_SSL, SSL_R_SSL_SECTION_EMPTY},
+  #else
+    {"SSL_SECTION_EMPTY", 20, 126},
+  #endif
+  #ifdef SSL_R_SSL_SECTION_NOT_FOUND
+    {"SSL_SECTION_NOT_FOUND", ERR_LIB_SSL, SSL_R_SSL_SECTION_NOT_FOUND},
+  #else
+    {"SSL_SECTION_NOT_FOUND", 20, 136},
+  #endif
+  #ifdef SSL_R_SSL_SESSION_ID_CALLBACK_FAILED
+    {"SSL_SESSION_ID_CALLBACK_FAILED", ERR_LIB_SSL, SSL_R_SSL_SESSION_ID_CALLBACK_FAILED},
+  #else
+    {"SSL_SESSION_ID_CALLBACK_FAILED", 20, 301},
+  #endif
+  #ifdef SSL_R_SSL_SESSION_ID_CONFLICT
+    {"SSL_SESSION_ID_CONFLICT", ERR_LIB_SSL, SSL_R_SSL_SESSION_ID_CONFLICT},
+  #else
+    {"SSL_SESSION_ID_CONFLICT", 20, 302},
+  #endif
+  #ifdef SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG
+    {"SSL_SESSION_ID_CONTEXT_TOO_LONG", ERR_LIB_SSL, SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG},
+  #else
+    {"SSL_SESSION_ID_CONTEXT_TOO_LONG", 20, 273},
+  #endif
+  #ifdef SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH
+    {"SSL_SESSION_ID_HAS_BAD_LENGTH", ERR_LIB_SSL, SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH},
+  #else
+    {"SSL_SESSION_ID_HAS_BAD_LENGTH", 20, 303},
+  #endif
+  #ifdef SSL_R_SSL_SESSION_ID_TOO_LONG
+    {"SSL_SESSION_ID_TOO_LONG", ERR_LIB_SSL, SSL_R_SSL_SESSION_ID_TOO_LONG},
+  #else
+    {"SSL_SESSION_ID_TOO_LONG", 20, 408},
+  #endif
+  #ifdef SSL_R_SSL_SESSION_VERSION_MISMATCH
+    {"SSL_SESSION_VERSION_MISMATCH", ERR_LIB_SSL, SSL_R_SSL_SESSION_VERSION_MISMATCH},
+  #else
+    {"SSL_SESSION_VERSION_MISMATCH", 20, 210},
+  #endif
+  #ifdef SSL_R_STILL_IN_INIT
+    {"STILL_IN_INIT", ERR_LIB_SSL, SSL_R_STILL_IN_INIT},
+  #else
+    {"STILL_IN_INIT", 20, 121},
+  #endif
+  #ifdef SSL_R_TLSV13_ALERT_CERTIFICATE_REQUIRED
+    {"TLSV13_ALERT_CERTIFICATE_REQUIRED", ERR_LIB_SSL, SSL_R_TLSV13_ALERT_CERTIFICATE_REQUIRED},
+  #else
+    {"TLSV13_ALERT_CERTIFICATE_REQUIRED", 20, 1116},
+  #endif
+  #ifdef SSL_R_TLSV13_ALERT_MISSING_EXTENSION
+    {"TLSV13_ALERT_MISSING_EXTENSION", ERR_LIB_SSL, SSL_R_TLSV13_ALERT_MISSING_EXTENSION},
+  #else
+    {"TLSV13_ALERT_MISSING_EXTENSION", 20, 1109},
+  #endif
+  #ifdef SSL_R_TLSV1_ALERT_ACCESS_DENIED
+    {"TLSV1_ALERT_ACCESS_DENIED", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_ACCESS_DENIED},
+  #else
+    {"TLSV1_ALERT_ACCESS_DENIED", 20, 1049},
+  #endif
+  #ifdef SSL_R_TLSV1_ALERT_DECODE_ERROR
+    {"TLSV1_ALERT_DECODE_ERROR", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_DECODE_ERROR},
+  #else
+    {"TLSV1_ALERT_DECODE_ERROR", 20, 1050},
+  #endif
+  #ifdef SSL_R_TLSV1_ALERT_DECRYPTION_FAILED
+    {"TLSV1_ALERT_DECRYPTION_FAILED", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_DECRYPTION_FAILED},
+  #else
+    {"TLSV1_ALERT_DECRYPTION_FAILED", 20, 1021},
+  #endif
+  #ifdef SSL_R_TLSV1_ALERT_DECRYPT_ERROR
+    {"TLSV1_ALERT_DECRYPT_ERROR", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_DECRYPT_ERROR},
+  #else
+    {"TLSV1_ALERT_DECRYPT_ERROR", 20, 1051},
+  #endif
+  #ifdef SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION
+    {"TLSV1_ALERT_EXPORT_RESTRICTION", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION},
+  #else
+    {"TLSV1_ALERT_EXPORT_RESTRICTION", 20, 1060},
+  #endif
+  #ifdef SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK
+    {"TLSV1_ALERT_INAPPROPRIATE_FALLBACK", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK},
+  #else
+    {"TLSV1_ALERT_INAPPROPRIATE_FALLBACK", 20, 1086},
+  #endif
+  #ifdef SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY
+    {"TLSV1_ALERT_INSUFFICIENT_SECURITY", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY},
+  #else
+    {"TLSV1_ALERT_INSUFFICIENT_SECURITY", 20, 1071},
+  #endif
+  #ifdef SSL_R_TLSV1_ALERT_INTERNAL_ERROR
+    {"TLSV1_ALERT_INTERNAL_ERROR", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_INTERNAL_ERROR},
+  #else
+    {"TLSV1_ALERT_INTERNAL_ERROR", 20, 1080},
+  #endif
+  #ifdef SSL_R_TLSV1_ALERT_NO_RENEGOTIATION
+    {"TLSV1_ALERT_NO_RENEGOTIATION", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_NO_RENEGOTIATION},
+  #else
+    {"TLSV1_ALERT_NO_RENEGOTIATION", 20, 1100},
+  #endif
+  #ifdef SSL_R_TLSV1_ALERT_PROTOCOL_VERSION
+    {"TLSV1_ALERT_PROTOCOL_VERSION", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_PROTOCOL_VERSION},
+  #else
+    {"TLSV1_ALERT_PROTOCOL_VERSION", 20, 1070},
+  #endif
+  #ifdef SSL_R_TLSV1_ALERT_RECORD_OVERFLOW
+    {"TLSV1_ALERT_RECORD_OVERFLOW", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_RECORD_OVERFLOW},
+  #else
+    {"TLSV1_ALERT_RECORD_OVERFLOW", 20, 1022},
+  #endif
+  #ifdef SSL_R_TLSV1_ALERT_UNKNOWN_CA
+    {"TLSV1_ALERT_UNKNOWN_CA", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_UNKNOWN_CA},
+  #else
+    {"TLSV1_ALERT_UNKNOWN_CA", 20, 1048},
+  #endif
+  #ifdef SSL_R_TLSV1_ALERT_USER_CANCELLED
+    {"TLSV1_ALERT_USER_CANCELLED", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_USER_CANCELLED},
+  #else
+    {"TLSV1_ALERT_USER_CANCELLED", 20, 1090},
+  #endif
+  #ifdef SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE
+    {"TLSV1_BAD_CERTIFICATE_HASH_VALUE", ERR_LIB_SSL, SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE},
+  #else
+    {"TLSV1_BAD_CERTIFICATE_HASH_VALUE", 20, 1114},
+  #endif
+  #ifdef SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE
+    {"TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE", ERR_LIB_SSL, SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE},
+  #else
+    {"TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE", 20, 1113},
+  #endif
+  #ifdef SSL_R_TLSV1_CERTIFICATE_UNOBTAINABLE
+    {"TLSV1_CERTIFICATE_UNOBTAINABLE", ERR_LIB_SSL, SSL_R_TLSV1_CERTIFICATE_UNOBTAINABLE},
+  #else
+    {"TLSV1_CERTIFICATE_UNOBTAINABLE", 20, 1111},
+  #endif
+  #ifdef SSL_R_TLSV1_UNRECOGNIZED_NAME
+    {"TLSV1_UNRECOGNIZED_NAME", ERR_LIB_SSL, SSL_R_TLSV1_UNRECOGNIZED_NAME},
+  #else
+    {"TLSV1_UNRECOGNIZED_NAME", 20, 1112},
+  #endif
+  #ifdef SSL_R_TLSV1_UNSUPPORTED_EXTENSION
+    {"TLSV1_UNSUPPORTED_EXTENSION", ERR_LIB_SSL, SSL_R_TLSV1_UNSUPPORTED_EXTENSION},
+  #else
+    {"TLSV1_UNSUPPORTED_EXTENSION", 20, 1110},
+  #endif
+  #ifdef SSL_R_TLS_ILLEGAL_EXPORTER_LABEL
+    {"TLS_ILLEGAL_EXPORTER_LABEL", ERR_LIB_SSL, SSL_R_TLS_ILLEGAL_EXPORTER_LABEL},
+  #else
+    {"TLS_ILLEGAL_EXPORTER_LABEL", 20, 367},
+  #endif
+  #ifdef SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST
+    {"TLS_INVALID_ECPOINTFORMAT_LIST", ERR_LIB_SSL, SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST},
+  #else
+    {"TLS_INVALID_ECPOINTFORMAT_LIST", 20, 157},
+  #endif
+  #ifdef SSL_R_TOO_MANY_KEY_UPDATES
+    {"TOO_MANY_KEY_UPDATES", ERR_LIB_SSL, SSL_R_TOO_MANY_KEY_UPDATES},
+  #else
+    {"TOO_MANY_KEY_UPDATES", 20, 132},
+  #endif
+  #ifdef SSL_R_TOO_MANY_WARN_ALERTS
+    {"TOO_MANY_WARN_ALERTS", ERR_LIB_SSL, SSL_R_TOO_MANY_WARN_ALERTS},
+  #else
+    {"TOO_MANY_WARN_ALERTS", 20, 409},
+  #endif
+  #ifdef SSL_R_TOO_MUCH_EARLY_DATA
+    {"TOO_MUCH_EARLY_DATA", ERR_LIB_SSL, SSL_R_TOO_MUCH_EARLY_DATA},
+  #else
+    {"TOO_MUCH_EARLY_DATA", 20, 164},
+  #endif
+  #ifdef SSL_R_UNABLE_TO_FIND_ECDH_PARAMETERS
+    {"UNABLE_TO_FIND_ECDH_PARAMETERS", ERR_LIB_SSL, SSL_R_UNABLE_TO_FIND_ECDH_PARAMETERS},
+  #else
+    {"UNABLE_TO_FIND_ECDH_PARAMETERS", 20, 314},
+  #endif
+  #ifdef SSL_R_UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS
+    {"UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS", ERR_LIB_SSL, SSL_R_UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS},
+  #else
+    {"UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS", 20, 239},
+  #endif
+  #ifdef SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES
+    {"UNABLE_TO_LOAD_SSL3_MD5_ROUTINES", ERR_LIB_SSL, SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES},
+  #else
+    {"UNABLE_TO_LOAD_SSL3_MD5_ROUTINES", 20, 242},
+  #endif
+  #ifdef SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES
+    {"UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES", ERR_LIB_SSL, SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES},
+  #else
+    {"UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES", 20, 243},
+  #endif
+  #ifdef SSL_R_UNEXPECTED_CCS_MESSAGE
+    {"UNEXPECTED_CCS_MESSAGE", ERR_LIB_SSL, SSL_R_UNEXPECTED_CCS_MESSAGE},
+  #else
+    {"UNEXPECTED_CCS_MESSAGE", 20, 262},
+  #endif
+  #ifdef SSL_R_UNEXPECTED_END_OF_EARLY_DATA
+    {"UNEXPECTED_END_OF_EARLY_DATA", ERR_LIB_SSL, SSL_R_UNEXPECTED_END_OF_EARLY_DATA},
+  #else
+    {"UNEXPECTED_END_OF_EARLY_DATA", 20, 178},
+  #endif
+  #ifdef SSL_R_UNEXPECTED_EOF_WHILE_READING
+    {"UNEXPECTED_EOF_WHILE_READING", ERR_LIB_SSL, SSL_R_UNEXPECTED_EOF_WHILE_READING},
+  #else
+    {"UNEXPECTED_EOF_WHILE_READING", 20, 294},
+  #endif
+  #ifdef SSL_R_UNEXPECTED_MESSAGE
+    {"UNEXPECTED_MESSAGE", ERR_LIB_SSL, SSL_R_UNEXPECTED_MESSAGE},
+  #else
+    {"UNEXPECTED_MESSAGE", 20, 244},
+  #endif
+  #ifdef SSL_R_UNEXPECTED_RECORD
+    {"UNEXPECTED_RECORD", ERR_LIB_SSL, SSL_R_UNEXPECTED_RECORD},
+  #else
+    {"UNEXPECTED_RECORD", 20, 245},
+  #endif
+  #ifdef SSL_R_UNINITIALIZED
+    {"UNINITIALIZED", ERR_LIB_SSL, SSL_R_UNINITIALIZED},
+  #else
+    {"UNINITIALIZED", 20, 276},
+  #endif
+  #ifdef SSL_R_UNKNOWN_ALERT_TYPE
+    {"UNKNOWN_ALERT_TYPE", ERR_LIB_SSL, SSL_R_UNKNOWN_ALERT_TYPE},
+  #else
+    {"UNKNOWN_ALERT_TYPE", 20, 246},
+  #endif
+  #ifdef SSL_R_UNKNOWN_CERTIFICATE_TYPE
+    {"UNKNOWN_CERTIFICATE_TYPE", ERR_LIB_SSL, SSL_R_UNKNOWN_CERTIFICATE_TYPE},
+  #else
+    {"UNKNOWN_CERTIFICATE_TYPE", 20, 247},
+  #endif
+  #ifdef SSL_R_UNKNOWN_CIPHER_RETURNED
+    {"UNKNOWN_CIPHER_RETURNED", ERR_LIB_SSL, SSL_R_UNKNOWN_CIPHER_RETURNED},
+  #else
+    {"UNKNOWN_CIPHER_RETURNED", 20, 248},
+  #endif
+  #ifdef SSL_R_UNKNOWN_CIPHER_TYPE
+    {"UNKNOWN_CIPHER_TYPE", ERR_LIB_SSL, SSL_R_UNKNOWN_CIPHER_TYPE},
+  #else
+    {"UNKNOWN_CIPHER_TYPE", 20, 249},
+  #endif
+  #ifdef SSL_R_UNKNOWN_CMD_NAME
+    {"UNKNOWN_CMD_NAME", ERR_LIB_SSL, SSL_R_UNKNOWN_CMD_NAME},
+  #else
+    {"UNKNOWN_CMD_NAME", 20, 386},
+  #endif
+  #ifdef SSL_R_UNKNOWN_COMMAND
+    {"UNKNOWN_COMMAND", ERR_LIB_SSL, SSL_R_UNKNOWN_COMMAND},
+  #else
+    {"UNKNOWN_COMMAND", 20, 139},
+  #endif
+  #ifdef SSL_R_UNKNOWN_DIGEST
+    {"UNKNOWN_DIGEST", ERR_LIB_SSL, SSL_R_UNKNOWN_DIGEST},
+  #else
+    {"UNKNOWN_DIGEST", 20, 368},
+  #endif
+  #ifdef SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE
+    {"UNKNOWN_KEY_EXCHANGE_TYPE", ERR_LIB_SSL, SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE},
+  #else
+    {"UNKNOWN_KEY_EXCHANGE_TYPE", 20, 250},
+  #endif
+  #ifdef SSL_R_UNKNOWN_PKEY_TYPE
+    {"UNKNOWN_PKEY_TYPE", ERR_LIB_SSL, SSL_R_UNKNOWN_PKEY_TYPE},
+  #else
+    {"UNKNOWN_PKEY_TYPE", 20, 251},
+  #endif
+  #ifdef SSL_R_UNKNOWN_PROTOCOL
+    {"UNKNOWN_PROTOCOL", ERR_LIB_SSL, SSL_R_UNKNOWN_PROTOCOL},
+  #else
+    {"UNKNOWN_PROTOCOL", 20, 252},
+  #endif
+  #ifdef SSL_R_UNKNOWN_SSL_VERSION
+    {"UNKNOWN_SSL_VERSION", ERR_LIB_SSL, SSL_R_UNKNOWN_SSL_VERSION},
+  #else
+    {"UNKNOWN_SSL_VERSION", 20, 254},
+  #endif
+  #ifdef SSL_R_UNKNOWN_STATE
+    {"UNKNOWN_STATE", ERR_LIB_SSL, SSL_R_UNKNOWN_STATE},
+  #else
+    {"UNKNOWN_STATE", 20, 255},
+  #endif
+  #ifdef SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED
+    {"UNSAFE_LEGACY_RENEGOTIATION_DISABLED", ERR_LIB_SSL, SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED},
+  #else
+    {"UNSAFE_LEGACY_RENEGOTIATION_DISABLED", 20, 338},
+  #endif
+  #ifdef SSL_R_UNSOLICITED_EXTENSION
+    {"UNSOLICITED_EXTENSION", ERR_LIB_SSL, SSL_R_UNSOLICITED_EXTENSION},
+  #else
+    {"UNSOLICITED_EXTENSION", 20, 217},
+  #endif
+  #ifdef SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM
+    {"UNSUPPORTED_COMPRESSION_ALGORITHM", ERR_LIB_SSL, SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM},
+  #else
+    {"UNSUPPORTED_COMPRESSION_ALGORITHM", 20, 257},
+  #endif
+  #ifdef SSL_R_UNSUPPORTED_ELLIPTIC_CURVE
+    {"UNSUPPORTED_ELLIPTIC_CURVE", ERR_LIB_SSL, SSL_R_UNSUPPORTED_ELLIPTIC_CURVE},
+  #else
+    {"UNSUPPORTED_ELLIPTIC_CURVE", 20, 315},
+  #endif
+  #ifdef SSL_R_UNSUPPORTED_PROTOCOL
+    {"UNSUPPORTED_PROTOCOL", ERR_LIB_SSL, SSL_R_UNSUPPORTED_PROTOCOL},
+  #else
+    {"UNSUPPORTED_PROTOCOL", 20, 258},
+  #endif
+  #ifdef SSL_R_UNSUPPORTED_SSL_VERSION
+    {"UNSUPPORTED_SSL_VERSION", ERR_LIB_SSL, SSL_R_UNSUPPORTED_SSL_VERSION},
+  #else
+    {"UNSUPPORTED_SSL_VERSION", 20, 259},
+  #endif
+  #ifdef SSL_R_UNSUPPORTED_STATUS_TYPE
+    {"UNSUPPORTED_STATUS_TYPE", ERR_LIB_SSL, SSL_R_UNSUPPORTED_STATUS_TYPE},
+  #else
+    {"UNSUPPORTED_STATUS_TYPE", 20, 329},
+  #endif
+  #ifdef SSL_R_USE_SRTP_NOT_NEGOTIATED
+    {"USE_SRTP_NOT_NEGOTIATED", ERR_LIB_SSL, SSL_R_USE_SRTP_NOT_NEGOTIATED},
+  #else
+    {"USE_SRTP_NOT_NEGOTIATED", 20, 369},
+  #endif
+  #ifdef SSL_R_VERSION_TOO_HIGH
+    {"VERSION_TOO_HIGH", ERR_LIB_SSL, SSL_R_VERSION_TOO_HIGH},
+  #else
+    {"VERSION_TOO_HIGH", 20, 166},
+  #endif
+  #ifdef SSL_R_VERSION_TOO_LOW
+    {"VERSION_TOO_LOW", ERR_LIB_SSL, SSL_R_VERSION_TOO_LOW},
+  #else
+    {"VERSION_TOO_LOW", 20, 396},
+  #endif
+  #ifdef SSL_R_WRONG_CERTIFICATE_TYPE
+    {"WRONG_CERTIFICATE_TYPE", ERR_LIB_SSL, SSL_R_WRONG_CERTIFICATE_TYPE},
+  #else
+    {"WRONG_CERTIFICATE_TYPE", 20, 383},
+  #endif
+  #ifdef SSL_R_WRONG_CIPHER_RETURNED
+    {"WRONG_CIPHER_RETURNED", ERR_LIB_SSL, SSL_R_WRONG_CIPHER_RETURNED},
+  #else
+    {"WRONG_CIPHER_RETURNED", 20, 261},
+  #endif
+  #ifdef SSL_R_WRONG_CURVE
+    {"WRONG_CURVE", ERR_LIB_SSL, SSL_R_WRONG_CURVE},
+  #else
+    {"WRONG_CURVE", 20, 378},
+  #endif
+  #ifdef SSL_R_WRONG_SIGNATURE_LENGTH
+    {"WRONG_SIGNATURE_LENGTH", ERR_LIB_SSL, SSL_R_WRONG_SIGNATURE_LENGTH},
+  #else
+    {"WRONG_SIGNATURE_LENGTH", 20, 264},
+  #endif
+  #ifdef SSL_R_WRONG_SIGNATURE_SIZE
+    {"WRONG_SIGNATURE_SIZE", ERR_LIB_SSL, SSL_R_WRONG_SIGNATURE_SIZE},
+  #else
+    {"WRONG_SIGNATURE_SIZE", 20, 265},
+  #endif
+  #ifdef SSL_R_WRONG_SIGNATURE_TYPE
+    {"WRONG_SIGNATURE_TYPE", ERR_LIB_SSL, SSL_R_WRONG_SIGNATURE_TYPE},
+  #else
+    {"WRONG_SIGNATURE_TYPE", 20, 370},
+  #endif
+  #ifdef SSL_R_WRONG_SSL_VERSION
+    {"WRONG_SSL_VERSION", ERR_LIB_SSL, SSL_R_WRONG_SSL_VERSION},
+  #else
+    {"WRONG_SSL_VERSION", 20, 266},
+  #endif
+  #ifdef SSL_R_WRONG_VERSION_NUMBER
+    {"WRONG_VERSION_NUMBER", ERR_LIB_SSL, SSL_R_WRONG_VERSION_NUMBER},
+  #else
+    {"WRONG_VERSION_NUMBER", 20, 267},
+  #endif
+  #ifdef SSL_R_X509_LIB
+    {"X509_LIB", ERR_LIB_SSL, SSL_R_X509_LIB},
+  #else
+    {"X509_LIB", 20, 268},
+  #endif
+  #ifdef SSL_R_X509_VERIFICATION_SETUP_PROBLEMS
+    {"X509_VERIFICATION_SETUP_PROBLEMS", ERR_LIB_SSL, SSL_R_X509_VERIFICATION_SETUP_PROBLEMS},
+  #else
+    {"X509_VERIFICATION_SETUP_PROBLEMS", 20, 269},
+  #endif
+  #ifdef TS_R_BAD_PKCS7_TYPE
+    {"BAD_PKCS7_TYPE", ERR_LIB_TS, TS_R_BAD_PKCS7_TYPE},
+  #else
+    {"BAD_PKCS7_TYPE", 47, 132},
+  #endif
+  #ifdef TS_R_BAD_TYPE
+    {"BAD_TYPE", ERR_LIB_TS, TS_R_BAD_TYPE},
+  #else
+    {"BAD_TYPE", 47, 133},
+  #endif
+  #ifdef TS_R_CANNOT_LOAD_CERT
+    {"CANNOT_LOAD_CERT", ERR_LIB_TS, TS_R_CANNOT_LOAD_CERT},
+  #else
+    {"CANNOT_LOAD_CERT", 47, 137},
+  #endif
+  #ifdef TS_R_CANNOT_LOAD_KEY
+    {"CANNOT_LOAD_KEY", ERR_LIB_TS, TS_R_CANNOT_LOAD_KEY},
+  #else
+    {"CANNOT_LOAD_KEY", 47, 138},
+  #endif
+  #ifdef TS_R_CERTIFICATE_VERIFY_ERROR
+    {"CERTIFICATE_VERIFY_ERROR", ERR_LIB_TS, TS_R_CERTIFICATE_VERIFY_ERROR},
+  #else
+    {"CERTIFICATE_VERIFY_ERROR", 47, 100},
+  #endif
+  #ifdef TS_R_COULD_NOT_SET_ENGINE
+    {"COULD_NOT_SET_ENGINE", ERR_LIB_TS, TS_R_COULD_NOT_SET_ENGINE},
+  #else
+    {"COULD_NOT_SET_ENGINE", 47, 127},
+  #endif
+  #ifdef TS_R_COULD_NOT_SET_TIME
+    {"COULD_NOT_SET_TIME", ERR_LIB_TS, TS_R_COULD_NOT_SET_TIME},
+  #else
+    {"COULD_NOT_SET_TIME", 47, 115},
+  #endif
+  #ifdef TS_R_DETACHED_CONTENT
+    {"DETACHED_CONTENT", ERR_LIB_TS, TS_R_DETACHED_CONTENT},
+  #else
+    {"DETACHED_CONTENT", 47, 134},
+  #endif
+  #ifdef TS_R_ESS_ADD_SIGNING_CERT_ERROR
+    {"ESS_ADD_SIGNING_CERT_ERROR", ERR_LIB_TS, TS_R_ESS_ADD_SIGNING_CERT_ERROR},
+  #else
+    {"ESS_ADD_SIGNING_CERT_ERROR", 47, 116},
+  #endif
+  #ifdef TS_R_ESS_ADD_SIGNING_CERT_V2_ERROR
+    {"ESS_ADD_SIGNING_CERT_V2_ERROR", ERR_LIB_TS, TS_R_ESS_ADD_SIGNING_CERT_V2_ERROR},
+  #else
+    {"ESS_ADD_SIGNING_CERT_V2_ERROR", 47, 139},
+  #endif
+  #ifdef TS_R_ESS_SIGNING_CERTIFICATE_ERROR
+    {"ESS_SIGNING_CERTIFICATE_ERROR", ERR_LIB_TS, TS_R_ESS_SIGNING_CERTIFICATE_ERROR},
+  #else
+    {"ESS_SIGNING_CERTIFICATE_ERROR", 47, 101},
+  #endif
+  #ifdef TS_R_INVALID_NULL_POINTER
+    {"INVALID_NULL_POINTER", ERR_LIB_TS, TS_R_INVALID_NULL_POINTER},
+  #else
+    {"INVALID_NULL_POINTER", 47, 102},
+  #endif
+  #ifdef TS_R_INVALID_SIGNER_CERTIFICATE_PURPOSE
+    {"INVALID_SIGNER_CERTIFICATE_PURPOSE", ERR_LIB_TS, TS_R_INVALID_SIGNER_CERTIFICATE_PURPOSE},
+  #else
+    {"INVALID_SIGNER_CERTIFICATE_PURPOSE", 47, 117},
+  #endif
+  #ifdef TS_R_MESSAGE_IMPRINT_MISMATCH
+    {"MESSAGE_IMPRINT_MISMATCH", ERR_LIB_TS, TS_R_MESSAGE_IMPRINT_MISMATCH},
+  #else
+    {"MESSAGE_IMPRINT_MISMATCH", 47, 103},
+  #endif
+  #ifdef TS_R_NONCE_MISMATCH
+    {"NONCE_MISMATCH", ERR_LIB_TS, TS_R_NONCE_MISMATCH},
+  #else
+    {"NONCE_MISMATCH", 47, 104},
+  #endif
+  #ifdef TS_R_NONCE_NOT_RETURNED
+    {"NONCE_NOT_RETURNED", ERR_LIB_TS, TS_R_NONCE_NOT_RETURNED},
+  #else
+    {"NONCE_NOT_RETURNED", 47, 105},
+  #endif
+  #ifdef TS_R_NO_CONTENT
+    {"NO_CONTENT", ERR_LIB_TS, TS_R_NO_CONTENT},
+  #else
+    {"NO_CONTENT", 47, 106},
+  #endif
+  #ifdef TS_R_NO_TIME_STAMP_TOKEN
+    {"NO_TIME_STAMP_TOKEN", ERR_LIB_TS, TS_R_NO_TIME_STAMP_TOKEN},
+  #else
+    {"NO_TIME_STAMP_TOKEN", 47, 107},
+  #endif
+  #ifdef TS_R_PKCS7_ADD_SIGNATURE_ERROR
+    {"PKCS7_ADD_SIGNATURE_ERROR", ERR_LIB_TS, TS_R_PKCS7_ADD_SIGNATURE_ERROR},
+  #else
+    {"PKCS7_ADD_SIGNATURE_ERROR", 47, 118},
+  #endif
+  #ifdef TS_R_PKCS7_ADD_SIGNED_ATTR_ERROR
+    {"PKCS7_ADD_SIGNED_ATTR_ERROR", ERR_LIB_TS, TS_R_PKCS7_ADD_SIGNED_ATTR_ERROR},
+  #else
+    {"PKCS7_ADD_SIGNED_ATTR_ERROR", 47, 119},
+  #endif
+  #ifdef TS_R_PKCS7_TO_TS_TST_INFO_FAILED
+    {"PKCS7_TO_TS_TST_INFO_FAILED", ERR_LIB_TS, TS_R_PKCS7_TO_TS_TST_INFO_FAILED},
+  #else
+    {"PKCS7_TO_TS_TST_INFO_FAILED", 47, 129},
+  #endif
+  #ifdef TS_R_POLICY_MISMATCH
+    {"POLICY_MISMATCH", ERR_LIB_TS, TS_R_POLICY_MISMATCH},
+  #else
+    {"POLICY_MISMATCH", 47, 108},
+  #endif
+  #ifdef TS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE
+    {"PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE", ERR_LIB_TS, TS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE},
+  #else
+    {"PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE", 47, 120},
+  #endif
+  #ifdef TS_R_RESPONSE_SETUP_ERROR
+    {"RESPONSE_SETUP_ERROR", ERR_LIB_TS, TS_R_RESPONSE_SETUP_ERROR},
+  #else
+    {"RESPONSE_SETUP_ERROR", 47, 121},
+  #endif
+  #ifdef TS_R_SIGNATURE_FAILURE
+    {"SIGNATURE_FAILURE", ERR_LIB_TS, TS_R_SIGNATURE_FAILURE},
+  #else
+    {"SIGNATURE_FAILURE", 47, 109},
+  #endif
+  #ifdef TS_R_THERE_MUST_BE_ONE_SIGNER
+    {"THERE_MUST_BE_ONE_SIGNER", ERR_LIB_TS, TS_R_THERE_MUST_BE_ONE_SIGNER},
+  #else
+    {"THERE_MUST_BE_ONE_SIGNER", 47, 110},
+  #endif
+  #ifdef TS_R_TIME_SYSCALL_ERROR
+    {"TIME_SYSCALL_ERROR", ERR_LIB_TS, TS_R_TIME_SYSCALL_ERROR},
+  #else
+    {"TIME_SYSCALL_ERROR", 47, 122},
+  #endif
+  #ifdef TS_R_TOKEN_NOT_PRESENT
+    {"TOKEN_NOT_PRESENT", ERR_LIB_TS, TS_R_TOKEN_NOT_PRESENT},
+  #else
+    {"TOKEN_NOT_PRESENT", 47, 130},
+  #endif
+  #ifdef TS_R_TOKEN_PRESENT
+    {"TOKEN_PRESENT", ERR_LIB_TS, TS_R_TOKEN_PRESENT},
+  #else
+    {"TOKEN_PRESENT", 47, 131},
+  #endif
+  #ifdef TS_R_TSA_NAME_MISMATCH
+    {"TSA_NAME_MISMATCH", ERR_LIB_TS, TS_R_TSA_NAME_MISMATCH},
+  #else
+    {"TSA_NAME_MISMATCH", 47, 111},
+  #endif
+  #ifdef TS_R_TSA_UNTRUSTED
+    {"TSA_UNTRUSTED", ERR_LIB_TS, TS_R_TSA_UNTRUSTED},
+  #else
+    {"TSA_UNTRUSTED", 47, 112},
+  #endif
+  #ifdef TS_R_TST_INFO_SETUP_ERROR
+    {"TST_INFO_SETUP_ERROR", ERR_LIB_TS, TS_R_TST_INFO_SETUP_ERROR},
+  #else
+    {"TST_INFO_SETUP_ERROR", 47, 123},
+  #endif
+  #ifdef TS_R_TS_DATASIGN
+    {"TS_DATASIGN", ERR_LIB_TS, TS_R_TS_DATASIGN},
+  #else
+    {"TS_DATASIGN", 47, 124},
+  #endif
+  #ifdef TS_R_UNACCEPTABLE_POLICY
+    {"UNACCEPTABLE_POLICY", ERR_LIB_TS, TS_R_UNACCEPTABLE_POLICY},
+  #else
+    {"UNACCEPTABLE_POLICY", 47, 125},
+  #endif
+  #ifdef TS_R_UNSUPPORTED_MD_ALGORITHM
+    {"UNSUPPORTED_MD_ALGORITHM", ERR_LIB_TS, TS_R_UNSUPPORTED_MD_ALGORITHM},
+  #else
+    {"UNSUPPORTED_MD_ALGORITHM", 47, 126},
+  #endif
+  #ifdef TS_R_UNSUPPORTED_VERSION
+    {"UNSUPPORTED_VERSION", ERR_LIB_TS, TS_R_UNSUPPORTED_VERSION},
+  #else
+    {"UNSUPPORTED_VERSION", 47, 113},
+  #endif
+  #ifdef TS_R_VAR_BAD_VALUE
+    {"VAR_BAD_VALUE", ERR_LIB_TS, TS_R_VAR_BAD_VALUE},
+  #else
+    {"VAR_BAD_VALUE", 47, 135},
+  #endif
+  #ifdef TS_R_VAR_LOOKUP_FAILURE
+    {"VAR_LOOKUP_FAILURE", ERR_LIB_TS, TS_R_VAR_LOOKUP_FAILURE},
+  #else
+    {"VAR_LOOKUP_FAILURE", 47, 136},
+  #endif
+  #ifdef TS_R_WRONG_CONTENT_TYPE
+    {"WRONG_CONTENT_TYPE", ERR_LIB_TS, TS_R_WRONG_CONTENT_TYPE},
+  #else
+    {"WRONG_CONTENT_TYPE", 47, 114},
+  #endif
+  #ifdef UI_R_COMMON_OK_AND_CANCEL_CHARACTERS
+    {"COMMON_OK_AND_CANCEL_CHARACTERS", ERR_LIB_UI, UI_R_COMMON_OK_AND_CANCEL_CHARACTERS},
+  #else
+    {"COMMON_OK_AND_CANCEL_CHARACTERS", 40, 104},
+  #endif
+  #ifdef UI_R_INDEX_TOO_LARGE
+    {"INDEX_TOO_LARGE", ERR_LIB_UI, UI_R_INDEX_TOO_LARGE},
+  #else
+    {"INDEX_TOO_LARGE", 40, 102},
+  #endif
+  #ifdef UI_R_INDEX_TOO_SMALL
+    {"INDEX_TOO_SMALL", ERR_LIB_UI, UI_R_INDEX_TOO_SMALL},
+  #else
+    {"INDEX_TOO_SMALL", 40, 103},
+  #endif
+  #ifdef UI_R_NO_RESULT_BUFFER
+    {"NO_RESULT_BUFFER", ERR_LIB_UI, UI_R_NO_RESULT_BUFFER},
+  #else
+    {"NO_RESULT_BUFFER", 40, 105},
+  #endif
+  #ifdef UI_R_PROCESSING_ERROR
+    {"PROCESSING_ERROR", ERR_LIB_UI, UI_R_PROCESSING_ERROR},
+  #else
+    {"PROCESSING_ERROR", 40, 107},
+  #endif
+  #ifdef UI_R_RESULT_TOO_LARGE
+    {"RESULT_TOO_LARGE", ERR_LIB_UI, UI_R_RESULT_TOO_LARGE},
+  #else
+    {"RESULT_TOO_LARGE", 40, 100},
+  #endif
+  #ifdef UI_R_RESULT_TOO_SMALL
+    {"RESULT_TOO_SMALL", ERR_LIB_UI, UI_R_RESULT_TOO_SMALL},
+  #else
+    {"RESULT_TOO_SMALL", 40, 101},
+  #endif
+  #ifdef UI_R_SYSASSIGN_ERROR
+    {"SYSASSIGN_ERROR", ERR_LIB_UI, UI_R_SYSASSIGN_ERROR},
+  #else
+    {"SYSASSIGN_ERROR", 40, 109},
+  #endif
+  #ifdef UI_R_SYSDASSGN_ERROR
+    {"SYSDASSGN_ERROR", ERR_LIB_UI, UI_R_SYSDASSGN_ERROR},
+  #else
+    {"SYSDASSGN_ERROR", 40, 110},
+  #endif
+  #ifdef UI_R_SYSQIOW_ERROR
+    {"SYSQIOW_ERROR", ERR_LIB_UI, UI_R_SYSQIOW_ERROR},
+  #else
+    {"SYSQIOW_ERROR", 40, 111},
+  #endif
+  #ifdef UI_R_UNKNOWN_CONTROL_COMMAND
+    {"UNKNOWN_CONTROL_COMMAND", ERR_LIB_UI, UI_R_UNKNOWN_CONTROL_COMMAND},
+  #else
+    {"UNKNOWN_CONTROL_COMMAND", 40, 106},
+  #endif
+  #ifdef UI_R_UNKNOWN_TTYGET_ERRNO_VALUE
+    {"UNKNOWN_TTYGET_ERRNO_VALUE", ERR_LIB_UI, UI_R_UNKNOWN_TTYGET_ERRNO_VALUE},
+  #else
+    {"UNKNOWN_TTYGET_ERRNO_VALUE", 40, 108},
+  #endif
+  #ifdef UI_R_USER_DATA_DUPLICATION_UNSUPPORTED
+    {"USER_DATA_DUPLICATION_UNSUPPORTED", ERR_LIB_UI, UI_R_USER_DATA_DUPLICATION_UNSUPPORTED},
+  #else
+    {"USER_DATA_DUPLICATION_UNSUPPORTED", 40, 112},
+  #endif
+  #ifdef X509V3_R_BAD_IP_ADDRESS
+    {"BAD_IP_ADDRESS", ERR_LIB_X509V3, X509V3_R_BAD_IP_ADDRESS},
+  #else
+    {"BAD_IP_ADDRESS", 34, 118},
+  #endif
+  #ifdef X509V3_R_BAD_OBJECT
+    {"BAD_OBJECT", ERR_LIB_X509V3, X509V3_R_BAD_OBJECT},
+  #else
+    {"BAD_OBJECT", 34, 119},
+  #endif
+  #ifdef X509V3_R_BN_DEC2BN_ERROR
+    {"BN_DEC2BN_ERROR", ERR_LIB_X509V3, X509V3_R_BN_DEC2BN_ERROR},
+  #else
+    {"BN_DEC2BN_ERROR", 34, 100},
+  #endif
+  #ifdef X509V3_R_BN_TO_ASN1_INTEGER_ERROR
+    {"BN_TO_ASN1_INTEGER_ERROR", ERR_LIB_X509V3, X509V3_R_BN_TO_ASN1_INTEGER_ERROR},
+  #else
+    {"BN_TO_ASN1_INTEGER_ERROR", 34, 101},
+  #endif
+  #ifdef X509V3_R_DIRNAME_ERROR
+    {"DIRNAME_ERROR", ERR_LIB_X509V3, X509V3_R_DIRNAME_ERROR},
+  #else
+    {"DIRNAME_ERROR", 34, 149},
+  #endif
+  #ifdef X509V3_R_DISTPOINT_ALREADY_SET
+    {"DISTPOINT_ALREADY_SET", ERR_LIB_X509V3, X509V3_R_DISTPOINT_ALREADY_SET},
+  #else
+    {"DISTPOINT_ALREADY_SET", 34, 160},
+  #endif
+  #ifdef X509V3_R_DUPLICATE_ZONE_ID
+    {"DUPLICATE_ZONE_ID", ERR_LIB_X509V3, X509V3_R_DUPLICATE_ZONE_ID},
+  #else
+    {"DUPLICATE_ZONE_ID", 34, 133},
+  #endif
+  #ifdef X509V3_R_EMPTY_KEY_USAGE
+    {"EMPTY_KEY_USAGE", ERR_LIB_X509V3, X509V3_R_EMPTY_KEY_USAGE},
+  #else
+    {"EMPTY_KEY_USAGE", 34, 169},
+  #endif
+  #ifdef X509V3_R_ERROR_CONVERTING_ZONE
+    {"ERROR_CONVERTING_ZONE", ERR_LIB_X509V3, X509V3_R_ERROR_CONVERTING_ZONE},
+  #else
+    {"ERROR_CONVERTING_ZONE", 34, 131},
+  #endif
+  #ifdef X509V3_R_ERROR_CREATING_EXTENSION
+    {"ERROR_CREATING_EXTENSION", ERR_LIB_X509V3, X509V3_R_ERROR_CREATING_EXTENSION},
+  #else
+    {"ERROR_CREATING_EXTENSION", 34, 144},
+  #endif
+  #ifdef X509V3_R_ERROR_IN_EXTENSION
+    {"ERROR_IN_EXTENSION", ERR_LIB_X509V3, X509V3_R_ERROR_IN_EXTENSION},
+  #else
+    {"ERROR_IN_EXTENSION", 34, 128},
+  #endif
+  #ifdef X509V3_R_EXPECTED_A_SECTION_NAME
+    {"EXPECTED_A_SECTION_NAME", ERR_LIB_X509V3, X509V3_R_EXPECTED_A_SECTION_NAME},
+  #else
+    {"EXPECTED_A_SECTION_NAME", 34, 137},
+  #endif
+  #ifdef X509V3_R_EXTENSION_EXISTS
+    {"EXTENSION_EXISTS", ERR_LIB_X509V3, X509V3_R_EXTENSION_EXISTS},
+  #else
+    {"EXTENSION_EXISTS", 34, 145},
+  #endif
+  #ifdef X509V3_R_EXTENSION_NAME_ERROR
+    {"EXTENSION_NAME_ERROR", ERR_LIB_X509V3, X509V3_R_EXTENSION_NAME_ERROR},
+  #else
+    {"EXTENSION_NAME_ERROR", 34, 115},
+  #endif
+  #ifdef X509V3_R_EXTENSION_NOT_FOUND
+    {"EXTENSION_NOT_FOUND", ERR_LIB_X509V3, X509V3_R_EXTENSION_NOT_FOUND},
+  #else
+    {"EXTENSION_NOT_FOUND", 34, 102},
+  #endif
+  #ifdef X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED
+    {"EXTENSION_SETTING_NOT_SUPPORTED", ERR_LIB_X509V3, X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED},
+  #else
+    {"EXTENSION_SETTING_NOT_SUPPORTED", 34, 103},
+  #endif
+  #ifdef X509V3_R_EXTENSION_VALUE_ERROR
+    {"EXTENSION_VALUE_ERROR", ERR_LIB_X509V3, X509V3_R_EXTENSION_VALUE_ERROR},
+  #else
+    {"EXTENSION_VALUE_ERROR", 34, 116},
+  #endif
+  #ifdef X509V3_R_ILLEGAL_EMPTY_EXTENSION
+    {"ILLEGAL_EMPTY_EXTENSION", ERR_LIB_X509V3, X509V3_R_ILLEGAL_EMPTY_EXTENSION},
+  #else
+    {"ILLEGAL_EMPTY_EXTENSION", 34, 151},
+  #endif
+  #ifdef X509V3_R_INCORRECT_POLICY_SYNTAX_TAG
+    {"INCORRECT_POLICY_SYNTAX_TAG", ERR_LIB_X509V3, X509V3_R_INCORRECT_POLICY_SYNTAX_TAG},
+  #else
+    {"INCORRECT_POLICY_SYNTAX_TAG", 34, 152},
+  #endif
+  #ifdef X509V3_R_INVALID_ASNUMBER
+    {"INVALID_ASNUMBER", ERR_LIB_X509V3, X509V3_R_INVALID_ASNUMBER},
+  #else
+    {"INVALID_ASNUMBER", 34, 162},
+  #endif
+  #ifdef X509V3_R_INVALID_ASRANGE
+    {"INVALID_ASRANGE", ERR_LIB_X509V3, X509V3_R_INVALID_ASRANGE},
+  #else
+    {"INVALID_ASRANGE", 34, 163},
+  #endif
+  #ifdef X509V3_R_INVALID_BOOLEAN_STRING
+    {"INVALID_BOOLEAN_STRING", ERR_LIB_X509V3, X509V3_R_INVALID_BOOLEAN_STRING},
+  #else
+    {"INVALID_BOOLEAN_STRING", 34, 104},
+  #endif
+  #ifdef X509V3_R_INVALID_CERTIFICATE
+    {"INVALID_CERTIFICATE", ERR_LIB_X509V3, X509V3_R_INVALID_CERTIFICATE},
+  #else
+    {"INVALID_CERTIFICATE", 34, 158},
+  #endif
+  #ifdef X509V3_R_INVALID_EMPTY_NAME
+    {"INVALID_EMPTY_NAME", ERR_LIB_X509V3, X509V3_R_INVALID_EMPTY_NAME},
+  #else
+    {"INVALID_EMPTY_NAME", 34, 108},
+  #endif
+  #ifdef X509V3_R_INVALID_EXTENSION_STRING
+    {"INVALID_EXTENSION_STRING", ERR_LIB_X509V3, X509V3_R_INVALID_EXTENSION_STRING},
+  #else
+    {"INVALID_EXTENSION_STRING", 34, 105},
+  #endif
+  #ifdef X509V3_R_INVALID_INHERITANCE
+    {"INVALID_INHERITANCE", ERR_LIB_X509V3, X509V3_R_INVALID_INHERITANCE},
+  #else
+    {"INVALID_INHERITANCE", 34, 165},
+  #endif
+  #ifdef X509V3_R_INVALID_IPADDRESS
+    {"INVALID_IPADDRESS", ERR_LIB_X509V3, X509V3_R_INVALID_IPADDRESS},
+  #else
+    {"INVALID_IPADDRESS", 34, 166},
+  #endif
+  #ifdef X509V3_R_INVALID_MULTIPLE_RDNS
+    {"INVALID_MULTIPLE_RDNS", ERR_LIB_X509V3, X509V3_R_INVALID_MULTIPLE_RDNS},
+  #else
+    {"INVALID_MULTIPLE_RDNS", 34, 161},
+  #endif
+  #ifdef X509V3_R_INVALID_NAME
+    {"INVALID_NAME", ERR_LIB_X509V3, X509V3_R_INVALID_NAME},
+  #else
+    {"INVALID_NAME", 34, 106},
+  #endif
+  #ifdef X509V3_R_INVALID_NULL_ARGUMENT
+    {"INVALID_NULL_ARGUMENT", ERR_LIB_X509V3, X509V3_R_INVALID_NULL_ARGUMENT},
+  #else
+    {"INVALID_NULL_ARGUMENT", 34, 107},
+  #endif
+  #ifdef X509V3_R_INVALID_NULL_VALUE
+    {"INVALID_NULL_VALUE", ERR_LIB_X509V3, X509V3_R_INVALID_NULL_VALUE},
+  #else
+    {"INVALID_NULL_VALUE", 34, 109},
+  #endif
+  #ifdef X509V3_R_INVALID_NUMBER
+    {"INVALID_NUMBER", ERR_LIB_X509V3, X509V3_R_INVALID_NUMBER},
+  #else
+    {"INVALID_NUMBER", 34, 140},
+  #endif
+  #ifdef X509V3_R_INVALID_NUMBERS
+    {"INVALID_NUMBERS", ERR_LIB_X509V3, X509V3_R_INVALID_NUMBERS},
+  #else
+    {"INVALID_NUMBERS", 34, 141},
+  #endif
+  #ifdef X509V3_R_INVALID_OBJECT_IDENTIFIER
+    {"INVALID_OBJECT_IDENTIFIER", ERR_LIB_X509V3, X509V3_R_INVALID_OBJECT_IDENTIFIER},
+  #else
+    {"INVALID_OBJECT_IDENTIFIER", 34, 110},
+  #endif
+  #ifdef X509V3_R_INVALID_OPTION
+    {"INVALID_OPTION", ERR_LIB_X509V3, X509V3_R_INVALID_OPTION},
+  #else
+    {"INVALID_OPTION", 34, 138},
+  #endif
+  #ifdef X509V3_R_INVALID_POLICY_IDENTIFIER
+    {"INVALID_POLICY_IDENTIFIER", ERR_LIB_X509V3, X509V3_R_INVALID_POLICY_IDENTIFIER},
+  #else
+    {"INVALID_POLICY_IDENTIFIER", 34, 134},
+  #endif
+  #ifdef X509V3_R_INVALID_PROXY_POLICY_SETTING
+    {"INVALID_PROXY_POLICY_SETTING", ERR_LIB_X509V3, X509V3_R_INVALID_PROXY_POLICY_SETTING},
+  #else
+    {"INVALID_PROXY_POLICY_SETTING", 34, 153},
+  #endif
+  #ifdef X509V3_R_INVALID_PURPOSE
+    {"INVALID_PURPOSE", ERR_LIB_X509V3, X509V3_R_INVALID_PURPOSE},
+  #else
+    {"INVALID_PURPOSE", 34, 146},
+  #endif
+  #ifdef X509V3_R_INVALID_SAFI
+    {"INVALID_SAFI", ERR_LIB_X509V3, X509V3_R_INVALID_SAFI},
+  #else
+    {"INVALID_SAFI", 34, 164},
+  #endif
+  #ifdef X509V3_R_INVALID_SECTION
+    {"INVALID_SECTION", ERR_LIB_X509V3, X509V3_R_INVALID_SECTION},
+  #else
+    {"INVALID_SECTION", 34, 135},
+  #endif
+  #ifdef X509V3_R_INVALID_SYNTAX
+    {"INVALID_SYNTAX", ERR_LIB_X509V3, X509V3_R_INVALID_SYNTAX},
+  #else
+    {"INVALID_SYNTAX", 34, 143},
+  #endif
+  #ifdef X509V3_R_ISSUER_DECODE_ERROR
+    {"ISSUER_DECODE_ERROR", ERR_LIB_X509V3, X509V3_R_ISSUER_DECODE_ERROR},
+  #else
+    {"ISSUER_DECODE_ERROR", 34, 126},
+  #endif
+  #ifdef X509V3_R_MISSING_VALUE
+    {"MISSING_VALUE", ERR_LIB_X509V3, X509V3_R_MISSING_VALUE},
+  #else
+    {"MISSING_VALUE", 34, 124},
+  #endif
+  #ifdef X509V3_R_NEED_ORGANIZATION_AND_NUMBERS
+    {"NEED_ORGANIZATION_AND_NUMBERS", ERR_LIB_X509V3, X509V3_R_NEED_ORGANIZATION_AND_NUMBERS},
+  #else
+    {"NEED_ORGANIZATION_AND_NUMBERS", 34, 142},
+  #endif
+  #ifdef X509V3_R_NEGATIVE_PATHLEN
+    {"NEGATIVE_PATHLEN", ERR_LIB_X509V3, X509V3_R_NEGATIVE_PATHLEN},
+  #else
+    {"NEGATIVE_PATHLEN", 34, 168},
+  #endif
+  #ifdef X509V3_R_NO_CONFIG_DATABASE
+    {"NO_CONFIG_DATABASE", ERR_LIB_X509V3, X509V3_R_NO_CONFIG_DATABASE},
+  #else
+    {"NO_CONFIG_DATABASE", 34, 136},
+  #endif
+  #ifdef X509V3_R_NO_ISSUER_CERTIFICATE
+    {"NO_ISSUER_CERTIFICATE", ERR_LIB_X509V3, X509V3_R_NO_ISSUER_CERTIFICATE},
+  #else
+    {"NO_ISSUER_CERTIFICATE", 34, 121},
+  #endif
+  #ifdef X509V3_R_NO_ISSUER_DETAILS
+    {"NO_ISSUER_DETAILS", ERR_LIB_X509V3, X509V3_R_NO_ISSUER_DETAILS},
+  #else
+    {"NO_ISSUER_DETAILS", 34, 127},
+  #endif
+  #ifdef X509V3_R_NO_POLICY_IDENTIFIER
+    {"NO_POLICY_IDENTIFIER", ERR_LIB_X509V3, X509V3_R_NO_POLICY_IDENTIFIER},
+  #else
+    {"NO_POLICY_IDENTIFIER", 34, 139},
+  #endif
+  #ifdef X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED
+    {"NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED", ERR_LIB_X509V3, X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED},
+  #else
+    {"NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED", 34, 154},
+  #endif
+  #ifdef X509V3_R_NO_PUBLIC_KEY
+    {"NO_PUBLIC_KEY", ERR_LIB_X509V3, X509V3_R_NO_PUBLIC_KEY},
+  #else
+    {"NO_PUBLIC_KEY", 34, 114},
+  #endif
+  #ifdef X509V3_R_NO_SUBJECT_DETAILS
+    {"NO_SUBJECT_DETAILS", ERR_LIB_X509V3, X509V3_R_NO_SUBJECT_DETAILS},
+  #else
+    {"NO_SUBJECT_DETAILS", 34, 125},
+  #endif
+  #ifdef X509V3_R_OPERATION_NOT_DEFINED
+    {"OPERATION_NOT_DEFINED", ERR_LIB_X509V3, X509V3_R_OPERATION_NOT_DEFINED},
+  #else
+    {"OPERATION_NOT_DEFINED", 34, 148},
+  #endif
+  #ifdef X509V3_R_OTHERNAME_ERROR
+    {"OTHERNAME_ERROR", ERR_LIB_X509V3, X509V3_R_OTHERNAME_ERROR},
+  #else
+    {"OTHERNAME_ERROR", 34, 147},
+  #endif
+  #ifdef X509V3_R_POLICY_LANGUAGE_ALREADY_DEFINED
+    {"POLICY_LANGUAGE_ALREADY_DEFINED", ERR_LIB_X509V3, X509V3_R_POLICY_LANGUAGE_ALREADY_DEFINED},
+  #else
+    {"POLICY_LANGUAGE_ALREADY_DEFINED", 34, 155},
+  #endif
+  #ifdef X509V3_R_POLICY_PATH_LENGTH
+    {"POLICY_PATH_LENGTH", ERR_LIB_X509V3, X509V3_R_POLICY_PATH_LENGTH},
+  #else
+    {"POLICY_PATH_LENGTH", 34, 156},
+  #endif
+  #ifdef X509V3_R_POLICY_PATH_LENGTH_ALREADY_DEFINED
+    {"POLICY_PATH_LENGTH_ALREADY_DEFINED", ERR_LIB_X509V3, X509V3_R_POLICY_PATH_LENGTH_ALREADY_DEFINED},
+  #else
+    {"POLICY_PATH_LENGTH_ALREADY_DEFINED", 34, 157},
+  #endif
+  #ifdef X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY
+    {"POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY", ERR_LIB_X509V3, X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY},
+  #else
+    {"POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY", 34, 159},
+  #endif
+  #ifdef X509V3_R_SECTION_NOT_FOUND
+    {"SECTION_NOT_FOUND", ERR_LIB_X509V3, X509V3_R_SECTION_NOT_FOUND},
+  #else
+    {"SECTION_NOT_FOUND", 34, 150},
+  #endif
+  #ifdef X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS
+    {"UNABLE_TO_GET_ISSUER_DETAILS", ERR_LIB_X509V3, X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS},
+  #else
+    {"UNABLE_TO_GET_ISSUER_DETAILS", 34, 122},
+  #endif
+  #ifdef X509V3_R_UNABLE_TO_GET_ISSUER_KEYID
+    {"UNABLE_TO_GET_ISSUER_KEYID", ERR_LIB_X509V3, X509V3_R_UNABLE_TO_GET_ISSUER_KEYID},
+  #else
+    {"UNABLE_TO_GET_ISSUER_KEYID", 34, 123},
+  #endif
+  #ifdef X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT
+    {"UNKNOWN_BIT_STRING_ARGUMENT", ERR_LIB_X509V3, X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT},
+  #else
+    {"UNKNOWN_BIT_STRING_ARGUMENT", 34, 111},
+  #endif
+  #ifdef X509V3_R_UNKNOWN_EXTENSION
+    {"UNKNOWN_EXTENSION", ERR_LIB_X509V3, X509V3_R_UNKNOWN_EXTENSION},
+  #else
+    {"UNKNOWN_EXTENSION", 34, 129},
+  #endif
+  #ifdef X509V3_R_UNKNOWN_EXTENSION_NAME
+    {"UNKNOWN_EXTENSION_NAME", ERR_LIB_X509V3, X509V3_R_UNKNOWN_EXTENSION_NAME},
+  #else
+    {"UNKNOWN_EXTENSION_NAME", 34, 130},
+  #endif
+  #ifdef X509V3_R_UNKNOWN_OPTION
+    {"UNKNOWN_OPTION", ERR_LIB_X509V3, X509V3_R_UNKNOWN_OPTION},
+  #else
+    {"UNKNOWN_OPTION", 34, 120},
+  #endif
+  #ifdef X509V3_R_UNSUPPORTED_OPTION
+    {"UNSUPPORTED_OPTION", ERR_LIB_X509V3, X509V3_R_UNSUPPORTED_OPTION},
+  #else
+    {"UNSUPPORTED_OPTION", 34, 117},
+  #endif
+  #ifdef X509V3_R_UNSUPPORTED_TYPE
+    {"UNSUPPORTED_TYPE", ERR_LIB_X509V3, X509V3_R_UNSUPPORTED_TYPE},
+  #else
+    {"UNSUPPORTED_TYPE", 34, 167},
+  #endif
+  #ifdef X509V3_R_USER_TOO_LONG
+    {"USER_TOO_LONG", ERR_LIB_X509V3, X509V3_R_USER_TOO_LONG},
+  #else
+    {"USER_TOO_LONG", 34, 132},
+  #endif
+  #ifdef X509_R_AKID_MISMATCH
+    {"AKID_MISMATCH", ERR_LIB_X509, X509_R_AKID_MISMATCH},
+  #else
+    {"AKID_MISMATCH", 11, 110},
+  #endif
+  #ifdef X509_R_BAD_SELECTOR
+    {"BAD_SELECTOR", ERR_LIB_X509, X509_R_BAD_SELECTOR},
+  #else
+    {"BAD_SELECTOR", 11, 133},
+  #endif
+  #ifdef X509_R_BAD_X509_FILETYPE
+    {"BAD_X509_FILETYPE", ERR_LIB_X509, X509_R_BAD_X509_FILETYPE},
+  #else
+    {"BAD_X509_FILETYPE", 11, 100},
+  #endif
+  #ifdef X509_R_BASE64_DECODE_ERROR
+    {"BASE64_DECODE_ERROR", ERR_LIB_X509, X509_R_BASE64_DECODE_ERROR},
+  #else
+    {"BASE64_DECODE_ERROR", 11, 118},
+  #endif
+  #ifdef X509_R_CANT_CHECK_DH_KEY
+    {"CANT_CHECK_DH_KEY", ERR_LIB_X509, X509_R_CANT_CHECK_DH_KEY},
+  #else
+    {"CANT_CHECK_DH_KEY", 11, 114},
+  #endif
+  #ifdef X509_R_CERTIFICATE_VERIFICATION_FAILED
+    {"CERTIFICATE_VERIFICATION_FAILED", ERR_LIB_X509, X509_R_CERTIFICATE_VERIFICATION_FAILED},
+  #else
+    {"CERTIFICATE_VERIFICATION_FAILED", 11, 139},
+  #endif
+  #ifdef X509_R_CERT_ALREADY_IN_HASH_TABLE
+    {"CERT_ALREADY_IN_HASH_TABLE", ERR_LIB_X509, X509_R_CERT_ALREADY_IN_HASH_TABLE},
+  #else
+    {"CERT_ALREADY_IN_HASH_TABLE", 11, 101},
+  #endif
+  #ifdef X509_R_CRL_ALREADY_DELTA
+    {"CRL_ALREADY_DELTA", ERR_LIB_X509, X509_R_CRL_ALREADY_DELTA},
+  #else
+    {"CRL_ALREADY_DELTA", 11, 127},
+  #endif
+  #ifdef X509_R_CRL_VERIFY_FAILURE
+    {"CRL_VERIFY_FAILURE", ERR_LIB_X509, X509_R_CRL_VERIFY_FAILURE},
+  #else
+    {"CRL_VERIFY_FAILURE", 11, 131},
+  #endif
+  #ifdef X509_R_ERROR_GETTING_MD_BY_NID
+    {"ERROR_GETTING_MD_BY_NID", ERR_LIB_X509, X509_R_ERROR_GETTING_MD_BY_NID},
+  #else
+    {"ERROR_GETTING_MD_BY_NID", 11, 141},
+  #endif
+  #ifdef X509_R_ERROR_USING_SIGINF_SET
+    {"ERROR_USING_SIGINF_SET", ERR_LIB_X509, X509_R_ERROR_USING_SIGINF_SET},
+  #else
+    {"ERROR_USING_SIGINF_SET", 11, 142},
+  #endif
+  #ifdef X509_R_IDP_MISMATCH
+    {"IDP_MISMATCH", ERR_LIB_X509, X509_R_IDP_MISMATCH},
+  #else
+    {"IDP_MISMATCH", 11, 128},
+  #endif
+  #ifdef X509_R_INVALID_ATTRIBUTES
+    {"INVALID_ATTRIBUTES", ERR_LIB_X509, X509_R_INVALID_ATTRIBUTES},
+  #else
+    {"INVALID_ATTRIBUTES", 11, 138},
+  #endif
+  #ifdef X509_R_INVALID_DIRECTORY
+    {"INVALID_DIRECTORY", ERR_LIB_X509, X509_R_INVALID_DIRECTORY},
+  #else
+    {"INVALID_DIRECTORY", 11, 113},
+  #endif
+  #ifdef X509_R_INVALID_DISTPOINT
+    {"INVALID_DISTPOINT", ERR_LIB_X509, X509_R_INVALID_DISTPOINT},
+  #else
+    {"INVALID_DISTPOINT", 11, 143},
+  #endif
+  #ifdef X509_R_INVALID_FIELD_NAME
+    {"INVALID_FIELD_NAME", ERR_LIB_X509, X509_R_INVALID_FIELD_NAME},
+  #else
+    {"INVALID_FIELD_NAME", 11, 119},
+  #endif
+  #ifdef X509_R_INVALID_TRUST
+    {"INVALID_TRUST", ERR_LIB_X509, X509_R_INVALID_TRUST},
+  #else
+    {"INVALID_TRUST", 11, 123},
+  #endif
+  #ifdef X509_R_ISSUER_MISMATCH
+    {"ISSUER_MISMATCH", ERR_LIB_X509, X509_R_ISSUER_MISMATCH},
+  #else
+    {"ISSUER_MISMATCH", 11, 129},
+  #endif
+  #ifdef X509_R_KEY_TYPE_MISMATCH
+    {"KEY_TYPE_MISMATCH", ERR_LIB_X509, X509_R_KEY_TYPE_MISMATCH},
+  #else
+    {"KEY_TYPE_MISMATCH", 11, 115},
+  #endif
+  #ifdef X509_R_KEY_VALUES_MISMATCH
+    {"KEY_VALUES_MISMATCH", ERR_LIB_X509, X509_R_KEY_VALUES_MISMATCH},
+  #else
+    {"KEY_VALUES_MISMATCH", 11, 116},
+  #endif
+  #ifdef X509_R_LOADING_CERT_DIR
+    {"LOADING_CERT_DIR", ERR_LIB_X509, X509_R_LOADING_CERT_DIR},
+  #else
+    {"LOADING_CERT_DIR", 11, 103},
+  #endif
+  #ifdef X509_R_LOADING_DEFAULTS
+    {"LOADING_DEFAULTS", ERR_LIB_X509, X509_R_LOADING_DEFAULTS},
+  #else
+    {"LOADING_DEFAULTS", 11, 104},
+  #endif
+  #ifdef X509_R_METHOD_NOT_SUPPORTED
+    {"METHOD_NOT_SUPPORTED", ERR_LIB_X509, X509_R_METHOD_NOT_SUPPORTED},
+  #else
+    {"METHOD_NOT_SUPPORTED", 11, 124},
+  #endif
+  #ifdef X509_R_NAME_TOO_LONG
+    {"NAME_TOO_LONG", ERR_LIB_X509, X509_R_NAME_TOO_LONG},
+  #else
+    {"NAME_TOO_LONG", 11, 134},
+  #endif
+  #ifdef X509_R_NEWER_CRL_NOT_NEWER
+    {"NEWER_CRL_NOT_NEWER", ERR_LIB_X509, X509_R_NEWER_CRL_NOT_NEWER},
+  #else
+    {"NEWER_CRL_NOT_NEWER", 11, 132},
+  #endif
+  #ifdef X509_R_NO_CERTIFICATE_FOUND
+    {"NO_CERTIFICATE_FOUND", ERR_LIB_X509, X509_R_NO_CERTIFICATE_FOUND},
+  #else
+    {"NO_CERTIFICATE_FOUND", 11, 135},
+  #endif
+  #ifdef X509_R_NO_CERTIFICATE_OR_CRL_FOUND
+    {"NO_CERTIFICATE_OR_CRL_FOUND", ERR_LIB_X509, X509_R_NO_CERTIFICATE_OR_CRL_FOUND},
+  #else
+    {"NO_CERTIFICATE_OR_CRL_FOUND", 11, 136},
+  #endif
+  #ifdef X509_R_NO_CERT_SET_FOR_US_TO_VERIFY
+    {"NO_CERT_SET_FOR_US_TO_VERIFY", ERR_LIB_X509, X509_R_NO_CERT_SET_FOR_US_TO_VERIFY},
+  #else
+    {"NO_CERT_SET_FOR_US_TO_VERIFY", 11, 105},
+  #endif
+  #ifdef X509_R_NO_CRL_FOUND
+    {"NO_CRL_FOUND", ERR_LIB_X509, X509_R_NO_CRL_FOUND},
+  #else
+    {"NO_CRL_FOUND", 11, 137},
+  #endif
+  #ifdef X509_R_NO_CRL_NUMBER
+    {"NO_CRL_NUMBER", ERR_LIB_X509, X509_R_NO_CRL_NUMBER},
+  #else
+    {"NO_CRL_NUMBER", 11, 130},
+  #endif
+  #ifdef X509_R_PUBLIC_KEY_DECODE_ERROR
+    {"PUBLIC_KEY_DECODE_ERROR", ERR_LIB_X509, X509_R_PUBLIC_KEY_DECODE_ERROR},
+  #else
+    {"PUBLIC_KEY_DECODE_ERROR", 11, 125},
+  #endif
+  #ifdef X509_R_PUBLIC_KEY_ENCODE_ERROR
+    {"PUBLIC_KEY_ENCODE_ERROR", ERR_LIB_X509, X509_R_PUBLIC_KEY_ENCODE_ERROR},
+  #else
+    {"PUBLIC_KEY_ENCODE_ERROR", 11, 126},
+  #endif
+  #ifdef X509_R_SHOULD_RETRY
+    {"SHOULD_RETRY", ERR_LIB_X509, X509_R_SHOULD_RETRY},
+  #else
+    {"SHOULD_RETRY", 11, 106},
+  #endif
+  #ifdef X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN
+    {"UNABLE_TO_FIND_PARAMETERS_IN_CHAIN", ERR_LIB_X509, X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN},
+  #else
+    {"UNABLE_TO_FIND_PARAMETERS_IN_CHAIN", 11, 107},
+  #endif
+  #ifdef X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY
+    {"UNABLE_TO_GET_CERTS_PUBLIC_KEY", ERR_LIB_X509, X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY},
+  #else
+    {"UNABLE_TO_GET_CERTS_PUBLIC_KEY", 11, 108},
+  #endif
+  #ifdef X509_R_UNKNOWN_KEY_TYPE
+    {"UNKNOWN_KEY_TYPE", ERR_LIB_X509, X509_R_UNKNOWN_KEY_TYPE},
+  #else
+    {"UNKNOWN_KEY_TYPE", 11, 117},
+  #endif
+  #ifdef X509_R_UNKNOWN_NID
+    {"UNKNOWN_NID", ERR_LIB_X509, X509_R_UNKNOWN_NID},
+  #else
+    {"UNKNOWN_NID", 11, 109},
+  #endif
+  #ifdef X509_R_UNKNOWN_PURPOSE_ID
+    {"UNKNOWN_PURPOSE_ID", ERR_LIB_X509, X509_R_UNKNOWN_PURPOSE_ID},
+  #else
+    {"UNKNOWN_PURPOSE_ID", 11, 121},
+  #endif
+  #ifdef X509_R_UNKNOWN_SIGID_ALGS
+    {"UNKNOWN_SIGID_ALGS", ERR_LIB_X509, X509_R_UNKNOWN_SIGID_ALGS},
+  #else
+    {"UNKNOWN_SIGID_ALGS", 11, 144},
+  #endif
+  #ifdef X509_R_UNKNOWN_TRUST_ID
+    {"UNKNOWN_TRUST_ID", ERR_LIB_X509, X509_R_UNKNOWN_TRUST_ID},
+  #else
+    {"UNKNOWN_TRUST_ID", 11, 120},
+  #endif
+  #ifdef X509_R_UNSUPPORTED_ALGORITHM
+    {"UNSUPPORTED_ALGORITHM", ERR_LIB_X509, X509_R_UNSUPPORTED_ALGORITHM},
+  #else
+    {"UNSUPPORTED_ALGORITHM", 11, 111},
+  #endif
+  #ifdef X509_R_WRONG_LOOKUP_TYPE
+    {"WRONG_LOOKUP_TYPE", ERR_LIB_X509, X509_R_WRONG_LOOKUP_TYPE},
+  #else
+    {"WRONG_LOOKUP_TYPE", 11, 112},
+  #endif
+  #ifdef X509_R_WRONG_TYPE
+    {"WRONG_TYPE", ERR_LIB_X509, X509_R_WRONG_TYPE},
+  #else
+    {"WRONG_TYPE", 11, 122},
+  #endif
+    { NULL }
+};
+
diff --git a/Modules/_struct.c b/Modules/_struct.c
index f759f0b..30ad9f2 100644
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -6,6 +6,7 @@
 #define PY_SSIZE_T_CLEAN
 
 #include "Python.h"
+#include "pycore_moduleobject.h"  // _PyModule_GetState()
 #include "structmember.h"         // PyMemberDef
 #include <ctype.h>
 
@@ -15,6 +16,7 @@
 /*[clinic end generated code: output=da39a3ee5e6b4b0d input=9b032058a83ed7c3]*/
 
 typedef struct {
+    PyObject *cache;
     PyObject *PyStructType;
     PyObject *unpackiter_type;
     PyObject *StructError;
@@ -23,23 +25,26 @@
 static inline _structmodulestate*
 get_struct_state(PyObject *module)
 {
-    void *state = PyModule_GetState(module);
+    void *state = _PyModule_GetState(module);
     assert(state != NULL);
     return (_structmodulestate *)state;
 }
 
 static struct PyModuleDef _structmodule;
 
-#define _structmodulestate_global get_struct_state(PyState_FindModule(&_structmodule))
+#define get_struct_state_structinst(self) \
+    (get_struct_state(_PyType_GetModuleByDef(Py_TYPE(self), &_structmodule)))
+#define get_struct_state_iterinst(self) \
+    (get_struct_state(PyType_GetModule(Py_TYPE(self))))
 
 /* The translation function for each format character is table driven */
 typedef struct _formatdef {
     char format;
     Py_ssize_t size;
     Py_ssize_t alignment;
-    PyObject* (*unpack)(const char *,
+    PyObject* (*unpack)(_structmodulestate *, const char *,
                         const struct _formatdef *);
-    int (*pack)(char *, PyObject *,
+    int (*pack)(_structmodulestate *, char *, PyObject *,
                 const struct _formatdef *);
 } formatdef;
 
@@ -61,10 +66,7 @@
     PyObject *weakreflist; /* List of weak references */
 } PyStructObject;
 
-
-#define PyStruct_Check(op) PyObject_TypeCheck(op, (PyTypeObject *)_structmodulestate_global->PyStructType)
-#define PyStruct_CheckExact(op) Py_IS_TYPE(op, (PyTypeObject *)_structmodulestate_global->PyStructType)
-
+#define PyStruct_Check(op, state) PyObject_TypeCheck(op, (PyTypeObject *)(state)->PyStructType)
 
 /* Define various structs to figure out the alignments of types */
 
@@ -102,12 +104,20 @@
     converter = 'cache_struct_converter'
     c_default = "NULL"
 
+    def parse_arg(self, argname, displayname):
+        return """
+            if (!{converter}(module, {argname}, &{paramname})) {{{{
+                goto exit;
+            }}}}
+            """.format(argname=argname, paramname=self.name,
+                       converter=self.converter)
+
     def cleanup(self):
         return "Py_XDECREF(%s);\n" % self.name
 [python start generated code]*/
-/*[python end generated code: output=da39a3ee5e6b4b0d input=49957cca130ffb63]*/
+/*[python end generated code: output=da39a3ee5e6b4b0d input=d6746621c2fb1a7d]*/
 
-static int cache_struct_converter(PyObject *, PyStructObject **);
+static int cache_struct_converter(PyObject *, PyObject *, PyStructObject **);
 
 #include "clinic/_struct.c.h"
 
@@ -115,18 +125,18 @@
    PyLongObject if possible, otherwise fails.  Caller should decref. */
 
 static PyObject *
-get_pylong(PyObject *v)
+get_pylong(_structmodulestate *state, PyObject *v)
 {
     assert(v != NULL);
     if (!PyLong_Check(v)) {
         /* Not an integer;  try to use __index__ to convert. */
         if (PyIndex_Check(v)) {
-            v = PyNumber_Index(v);
+            v = _PyNumber_Index(v);
             if (v == NULL)
                 return NULL;
         }
         else {
-            PyErr_SetString(_structmodulestate_global->StructError,
+            PyErr_SetString(state->StructError,
                             "required argument is not an integer");
             return NULL;
         }
@@ -142,11 +152,11 @@
    one */
 
 static int
-get_long(PyObject *v, long *p)
+get_long(_structmodulestate *state, PyObject *v, long *p)
 {
     long x;
 
-    v = get_pylong(v);
+    v = get_pylong(state, v);
     if (v == NULL)
         return -1;
     assert(PyLong_Check(v));
@@ -154,7 +164,7 @@
     Py_DECREF(v);
     if (x == (long)-1 && PyErr_Occurred()) {
         if (PyErr_ExceptionMatches(PyExc_OverflowError))
-            PyErr_SetString(_structmodulestate_global->StructError,
+            PyErr_SetString(state->StructError,
                             "argument out of range");
         return -1;
     }
@@ -166,11 +176,11 @@
 /* Same, but handling unsigned long */
 
 static int
-get_ulong(PyObject *v, unsigned long *p)
+get_ulong(_structmodulestate *state, PyObject *v, unsigned long *p)
 {
     unsigned long x;
 
-    v = get_pylong(v);
+    v = get_pylong(state, v);
     if (v == NULL)
         return -1;
     assert(PyLong_Check(v));
@@ -178,7 +188,7 @@
     Py_DECREF(v);
     if (x == (unsigned long)-1 && PyErr_Occurred()) {
         if (PyErr_ExceptionMatches(PyExc_OverflowError))
-            PyErr_SetString(_structmodulestate_global->StructError,
+            PyErr_SetString(state->StructError,
                             "argument out of range");
         return -1;
     }
@@ -189,11 +199,11 @@
 /* Same, but handling native long long. */
 
 static int
-get_longlong(PyObject *v, long long *p)
+get_longlong(_structmodulestate *state, PyObject *v, long long *p)
 {
     long long x;
 
-    v = get_pylong(v);
+    v = get_pylong(state, v);
     if (v == NULL)
         return -1;
     assert(PyLong_Check(v));
@@ -201,7 +211,7 @@
     Py_DECREF(v);
     if (x == (long long)-1 && PyErr_Occurred()) {
         if (PyErr_ExceptionMatches(PyExc_OverflowError))
-            PyErr_SetString(_structmodulestate_global->StructError,
+            PyErr_SetString(state->StructError,
                             "argument out of range");
         return -1;
     }
@@ -212,11 +222,11 @@
 /* Same, but handling native unsigned long long. */
 
 static int
-get_ulonglong(PyObject *v, unsigned long long *p)
+get_ulonglong(_structmodulestate *state, PyObject *v, unsigned long long *p)
 {
     unsigned long long x;
 
-    v = get_pylong(v);
+    v = get_pylong(state, v);
     if (v == NULL)
         return -1;
     assert(PyLong_Check(v));
@@ -224,7 +234,7 @@
     Py_DECREF(v);
     if (x == (unsigned long long)-1 && PyErr_Occurred()) {
         if (PyErr_ExceptionMatches(PyExc_OverflowError))
-            PyErr_SetString(_structmodulestate_global->StructError,
+            PyErr_SetString(state->StructError,
                             "argument out of range");
         return -1;
     }
@@ -235,11 +245,11 @@
 /* Same, but handling Py_ssize_t */
 
 static int
-get_ssize_t(PyObject *v, Py_ssize_t *p)
+get_ssize_t(_structmodulestate *state, PyObject *v, Py_ssize_t *p)
 {
     Py_ssize_t x;
 
-    v = get_pylong(v);
+    v = get_pylong(state, v);
     if (v == NULL)
         return -1;
     assert(PyLong_Check(v));
@@ -247,7 +257,7 @@
     Py_DECREF(v);
     if (x == (Py_ssize_t)-1 && PyErr_Occurred()) {
         if (PyErr_ExceptionMatches(PyExc_OverflowError))
-            PyErr_SetString(_structmodulestate_global->StructError,
+            PyErr_SetString(state->StructError,
                             "argument out of range");
         return -1;
     }
@@ -258,11 +268,11 @@
 /* Same, but handling size_t */
 
 static int
-get_size_t(PyObject *v, size_t *p)
+get_size_t(_structmodulestate *state, PyObject *v, size_t *p)
 {
     size_t x;
 
-    v = get_pylong(v);
+    v = get_pylong(state, v);
     if (v == NULL)
         return -1;
     assert(PyLong_Check(v));
@@ -270,7 +280,7 @@
     Py_DECREF(v);
     if (x == (size_t)-1 && PyErr_Occurred()) {
         if (PyErr_ExceptionMatches(PyExc_OverflowError))
-            PyErr_SetString(_structmodulestate_global->StructError,
+            PyErr_SetString(state->StructError,
                             "argument out of range");
         return -1;
     }
@@ -279,7 +289,7 @@
 }
 
 
-#define RANGE_ERROR(x, f, flag, mask) return _range_error(f, flag)
+#define RANGE_ERROR(state, x, f, flag, mask) return _range_error(state, f, flag)
 
 
 /* Floating point helpers */
@@ -298,13 +308,14 @@
 }
 
 static int
-pack_halffloat(char *p,      /* start of 2-byte string */
+pack_halffloat(_structmodulestate *state,
+               char *p,      /* start of 2-byte string */
                PyObject *v,  /* value to pack */
                int le)       /* true for little-endian, false for big-endian */
 {
     double x = PyFloat_AsDouble(v);
     if (x == -1.0 && PyErr_Occurred()) {
-        PyErr_SetString(_structmodulestate_global->StructError,
+        PyErr_SetString(state->StructError,
                         "required argument is not a float");
         return -1;
     }
@@ -337,7 +348,7 @@
 
 /* Helper to format the range error exceptions */
 static int
-_range_error(const formatdef *f, int is_unsigned)
+_range_error(_structmodulestate *state, const formatdef *f, int is_unsigned)
 {
     /* ulargest is the largest unsigned value with f->size bytes.
      * Note that the simpler:
@@ -350,13 +361,13 @@
     const size_t ulargest = (size_t)-1 >> ((SIZEOF_SIZE_T - f->size)*8);
     assert(f->size >= 1 && f->size <= SIZEOF_SIZE_T);
     if (is_unsigned)
-        PyErr_Format(_structmodulestate_global->StructError,
+        PyErr_Format(state->StructError,
             "'%c' format requires 0 <= number <= %zu",
             f->format,
             ulargest);
     else {
         const Py_ssize_t largest = (Py_ssize_t)(ulargest >> 1);
-        PyErr_Format(_structmodulestate_global->StructError,
+        PyErr_Format(state->StructError,
             "'%c' format requires %zd <= number <= %zd",
             f->format,
             ~ largest,
@@ -388,25 +399,25 @@
    does this). */
 
 static PyObject *
-nu_char(const char *p, const formatdef *f)
+nu_char(_structmodulestate *state, const char *p, const formatdef *f)
 {
     return PyBytes_FromStringAndSize(p, 1);
 }
 
 static PyObject *
-nu_byte(const char *p, const formatdef *f)
+nu_byte(_structmodulestate *state, const char *p, const formatdef *f)
 {
     return PyLong_FromLong((long) *(signed char *)p);
 }
 
 static PyObject *
-nu_ubyte(const char *p, const formatdef *f)
+nu_ubyte(_structmodulestate *state, const char *p, const formatdef *f)
 {
     return PyLong_FromLong((long) *(unsigned char *)p);
 }
 
 static PyObject *
-nu_short(const char *p, const formatdef *f)
+nu_short(_structmodulestate *state, const char *p, const formatdef *f)
 {
     short x;
     memcpy((char *)&x, p, sizeof x);
@@ -414,7 +425,7 @@
 }
 
 static PyObject *
-nu_ushort(const char *p, const formatdef *f)
+nu_ushort(_structmodulestate *state, const char *p, const formatdef *f)
 {
     unsigned short x;
     memcpy((char *)&x, p, sizeof x);
@@ -422,7 +433,7 @@
 }
 
 static PyObject *
-nu_int(const char *p, const formatdef *f)
+nu_int(_structmodulestate *state, const char *p, const formatdef *f)
 {
     int x;
     memcpy((char *)&x, p, sizeof x);
@@ -430,7 +441,7 @@
 }
 
 static PyObject *
-nu_uint(const char *p, const formatdef *f)
+nu_uint(_structmodulestate *state, const char *p, const formatdef *f)
 {
     unsigned int x;
     memcpy((char *)&x, p, sizeof x);
@@ -438,7 +449,7 @@
 }
 
 static PyObject *
-nu_long(const char *p, const formatdef *f)
+nu_long(_structmodulestate *state, const char *p, const formatdef *f)
 {
     long x;
     memcpy((char *)&x, p, sizeof x);
@@ -446,7 +457,7 @@
 }
 
 static PyObject *
-nu_ulong(const char *p, const formatdef *f)
+nu_ulong(_structmodulestate *state, const char *p, const formatdef *f)
 {
     unsigned long x;
     memcpy((char *)&x, p, sizeof x);
@@ -454,7 +465,7 @@
 }
 
 static PyObject *
-nu_ssize_t(const char *p, const formatdef *f)
+nu_ssize_t(_structmodulestate *state, const char *p, const formatdef *f)
 {
     Py_ssize_t x;
     memcpy((char *)&x, p, sizeof x);
@@ -462,7 +473,7 @@
 }
 
 static PyObject *
-nu_size_t(const char *p, const formatdef *f)
+nu_size_t(_structmodulestate *state, const char *p, const formatdef *f)
 {
     size_t x;
     memcpy((char *)&x, p, sizeof x);
@@ -470,7 +481,7 @@
 }
 
 static PyObject *
-nu_longlong(const char *p, const formatdef *f)
+nu_longlong(_structmodulestate *state, const char *p, const formatdef *f)
 {
     long long x;
     memcpy((char *)&x, p, sizeof x);
@@ -478,7 +489,7 @@
 }
 
 static PyObject *
-nu_ulonglong(const char *p, const formatdef *f)
+nu_ulonglong(_structmodulestate *state, const char *p, const formatdef *f)
 {
     unsigned long long x;
     memcpy((char *)&x, p, sizeof x);
@@ -486,7 +497,7 @@
 }
 
 static PyObject *
-nu_bool(const char *p, const formatdef *f)
+nu_bool(_structmodulestate *state, const char *p, const formatdef *f)
 {
     _Bool x;
     memcpy((char *)&x, p, sizeof x);
@@ -495,7 +506,7 @@
 
 
 static PyObject *
-nu_halffloat(const char *p, const formatdef *f)
+nu_halffloat(_structmodulestate *state, const char *p, const formatdef *f)
 {
 #if PY_LITTLE_ENDIAN
     return unpack_halffloat(p, 1);
@@ -505,7 +516,7 @@
 }
 
 static PyObject *
-nu_float(const char *p, const formatdef *f)
+nu_float(_structmodulestate *state, const char *p, const formatdef *f)
 {
     float x;
     memcpy((char *)&x, p, sizeof x);
@@ -513,7 +524,7 @@
 }
 
 static PyObject *
-nu_double(const char *p, const formatdef *f)
+nu_double(_structmodulestate *state, const char *p, const formatdef *f)
 {
     double x;
     memcpy((char *)&x, p, sizeof x);
@@ -521,7 +532,7 @@
 }
 
 static PyObject *
-nu_void_p(const char *p, const formatdef *f)
+nu_void_p(_structmodulestate *state, const char *p, const formatdef *f)
 {
     void *x;
     memcpy((char *)&x, p, sizeof x);
@@ -529,13 +540,13 @@
 }
 
 static int
-np_byte(char *p, PyObject *v, const formatdef *f)
+np_byte(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
 {
     long x;
-    if (get_long(v, &x) < 0)
+    if (get_long(state, v, &x) < 0)
         return -1;
     if (x < -128 || x > 127) {
-        PyErr_SetString(_structmodulestate_global->StructError,
+        PyErr_SetString(state->StructError,
                         "byte format requires -128 <= number <= 127");
         return -1;
     }
@@ -544,13 +555,13 @@
 }
 
 static int
-np_ubyte(char *p, PyObject *v, const formatdef *f)
+np_ubyte(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
 {
     long x;
-    if (get_long(v, &x) < 0)
+    if (get_long(state, v, &x) < 0)
         return -1;
     if (x < 0 || x > 255) {
-        PyErr_SetString(_structmodulestate_global->StructError,
+        PyErr_SetString(state->StructError,
                         "ubyte format requires 0 <= number <= 255");
         return -1;
     }
@@ -559,10 +570,10 @@
 }
 
 static int
-np_char(char *p, PyObject *v, const formatdef *f)
+np_char(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
 {
     if (!PyBytes_Check(v) || PyBytes_Size(v) != 1) {
-        PyErr_SetString(_structmodulestate_global->StructError,
+        PyErr_SetString(state->StructError,
                         "char format requires a bytes object of length 1");
         return -1;
     }
@@ -571,14 +582,14 @@
 }
 
 static int
-np_short(char *p, PyObject *v, const formatdef *f)
+np_short(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
 {
     long x;
     short y;
-    if (get_long(v, &x) < 0)
+    if (get_long(state, v, &x) < 0)
         return -1;
     if (x < SHRT_MIN || x > SHRT_MAX) {
-        PyErr_SetString(_structmodulestate_global->StructError,
+        PyErr_SetString(state->StructError,
                         "short format requires " Py_STRINGIFY(SHRT_MIN)
                         " <= number <= " Py_STRINGIFY(SHRT_MAX));
         return -1;
@@ -589,14 +600,14 @@
 }
 
 static int
-np_ushort(char *p, PyObject *v, const formatdef *f)
+np_ushort(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
 {
     long x;
     unsigned short y;
-    if (get_long(v, &x) < 0)
+    if (get_long(state, v, &x) < 0)
         return -1;
     if (x < 0 || x > USHRT_MAX) {
-        PyErr_SetString(_structmodulestate_global->StructError,
+        PyErr_SetString(state->StructError,
                         "ushort format requires 0 <= number <= "
                         Py_STRINGIFY(USHRT_MAX));
         return -1;
@@ -607,15 +618,15 @@
 }
 
 static int
-np_int(char *p, PyObject *v, const formatdef *f)
+np_int(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
 {
     long x;
     int y;
-    if (get_long(v, &x) < 0)
+    if (get_long(state, v, &x) < 0)
         return -1;
 #if (SIZEOF_LONG > SIZEOF_INT)
     if ((x < ((long)INT_MIN)) || (x > ((long)INT_MAX)))
-        RANGE_ERROR(x, f, 0, -1);
+        RANGE_ERROR(state, x, f, 0, -1);
 #endif
     y = (int)x;
     memcpy(p, (char *)&y, sizeof y);
@@ -623,76 +634,76 @@
 }
 
 static int
-np_uint(char *p, PyObject *v, const formatdef *f)
+np_uint(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
 {
     unsigned long x;
     unsigned int y;
-    if (get_ulong(v, &x) < 0)
+    if (get_ulong(state, v, &x) < 0)
         return -1;
     y = (unsigned int)x;
 #if (SIZEOF_LONG > SIZEOF_INT)
     if (x > ((unsigned long)UINT_MAX))
-        RANGE_ERROR(y, f, 1, -1);
+        RANGE_ERROR(state, y, f, 1, -1);
 #endif
     memcpy(p, (char *)&y, sizeof y);
     return 0;
 }
 
 static int
-np_long(char *p, PyObject *v, const formatdef *f)
+np_long(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
 {
     long x;
-    if (get_long(v, &x) < 0)
+    if (get_long(state, v, &x) < 0)
         return -1;
     memcpy(p, (char *)&x, sizeof x);
     return 0;
 }
 
 static int
-np_ulong(char *p, PyObject *v, const formatdef *f)
+np_ulong(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
 {
     unsigned long x;
-    if (get_ulong(v, &x) < 0)
+    if (get_ulong(state, v, &x) < 0)
         return -1;
     memcpy(p, (char *)&x, sizeof x);
     return 0;
 }
 
 static int
-np_ssize_t(char *p, PyObject *v, const formatdef *f)
+np_ssize_t(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
 {
     Py_ssize_t x;
-    if (get_ssize_t(v, &x) < 0)
+    if (get_ssize_t(state, v, &x) < 0)
         return -1;
     memcpy(p, (char *)&x, sizeof x);
     return 0;
 }
 
 static int
-np_size_t(char *p, PyObject *v, const formatdef *f)
+np_size_t(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
 {
     size_t x;
-    if (get_size_t(v, &x) < 0)
+    if (get_size_t(state, v, &x) < 0)
         return -1;
     memcpy(p, (char *)&x, sizeof x);
     return 0;
 }
 
 static int
-np_longlong(char *p, PyObject *v, const formatdef *f)
+np_longlong(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
 {
     long long x;
-    if (get_longlong(v, &x) < 0)
+    if (get_longlong(state, v, &x) < 0)
         return -1;
     memcpy(p, (char *)&x, sizeof x);
     return 0;
 }
 
 static int
-np_ulonglong(char *p, PyObject *v, const formatdef *f)
+np_ulonglong(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
 {
     unsigned long long x;
-    if (get_ulonglong(v, &x) < 0)
+    if (get_ulonglong(state, v, &x) < 0)
         return -1;
     memcpy(p, (char *)&x, sizeof x);
     return 0;
@@ -700,7 +711,7 @@
 
 
 static int
-np_bool(char *p, PyObject *v, const formatdef *f)
+np_bool(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
 {
     int y;
     _Bool x;
@@ -713,21 +724,21 @@
 }
 
 static int
-np_halffloat(char *p, PyObject *v, const formatdef *f)
+np_halffloat(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
 {
 #if PY_LITTLE_ENDIAN
-    return pack_halffloat(p, v, 1);
+    return pack_halffloat(state, p, v, 1);
 #else
-    return pack_halffloat(p, v, 0);
+    return pack_halffloat(state, p, v, 0);
 #endif
 }
 
 static int
-np_float(char *p, PyObject *v, const formatdef *f)
+np_float(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
 {
     float x = (float)PyFloat_AsDouble(v);
     if (x == -1 && PyErr_Occurred()) {
-        PyErr_SetString(_structmodulestate_global->StructError,
+        PyErr_SetString(state->StructError,
                         "required argument is not a float");
         return -1;
     }
@@ -736,11 +747,11 @@
 }
 
 static int
-np_double(char *p, PyObject *v, const formatdef *f)
+np_double(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
 {
     double x = PyFloat_AsDouble(v);
     if (x == -1 && PyErr_Occurred()) {
-        PyErr_SetString(_structmodulestate_global->StructError,
+        PyErr_SetString(state->StructError,
                         "required argument is not a float");
         return -1;
     }
@@ -749,11 +760,11 @@
 }
 
 static int
-np_void_p(char *p, PyObject *v, const formatdef *f)
+np_void_p(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
 {
     void *x;
 
-    v = get_pylong(v);
+    v = get_pylong(state, v);
     if (v == NULL)
         return -1;
     assert(PyLong_Check(v));
@@ -793,7 +804,7 @@
 /* Big-endian routines. *****************************************************/
 
 static PyObject *
-bu_int(const char *p, const formatdef *f)
+bu_int(_structmodulestate *state, const char *p, const formatdef *f)
 {
     long x = 0;
     Py_ssize_t i = f->size;
@@ -808,7 +819,7 @@
 }
 
 static PyObject *
-bu_uint(const char *p, const formatdef *f)
+bu_uint(_structmodulestate *state, const char *p, const formatdef *f)
 {
     unsigned long x = 0;
     Py_ssize_t i = f->size;
@@ -820,7 +831,7 @@
 }
 
 static PyObject *
-bu_longlong(const char *p, const formatdef *f)
+bu_longlong(_structmodulestate *state, const char *p, const formatdef *f)
 {
     long long x = 0;
     Py_ssize_t i = f->size;
@@ -835,7 +846,7 @@
 }
 
 static PyObject *
-bu_ulonglong(const char *p, const formatdef *f)
+bu_ulonglong(_structmodulestate *state, const char *p, const formatdef *f)
 {
     unsigned long long x = 0;
     Py_ssize_t i = f->size;
@@ -847,44 +858,44 @@
 }
 
 static PyObject *
-bu_halffloat(const char *p, const formatdef *f)
+bu_halffloat(_structmodulestate *state, const char *p, const formatdef *f)
 {
     return unpack_halffloat(p, 0);
 }
 
 static PyObject *
-bu_float(const char *p, const formatdef *f)
+bu_float(_structmodulestate *state, const char *p, const formatdef *f)
 {
     return unpack_float(p, 0);
 }
 
 static PyObject *
-bu_double(const char *p, const formatdef *f)
+bu_double(_structmodulestate *state, const char *p, const formatdef *f)
 {
     return unpack_double(p, 0);
 }
 
 static PyObject *
-bu_bool(const char *p, const formatdef *f)
+bu_bool(_structmodulestate *state, const char *p, const formatdef *f)
 {
     return PyBool_FromLong(*p != 0);
 }
 
 static int
-bp_int(char *p, PyObject *v, const formatdef *f)
+bp_int(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
 {
     long x;
     Py_ssize_t i;
     unsigned char *q = (unsigned char *)p;
-    if (get_long(v, &x) < 0)
+    if (get_long(state, v, &x) < 0)
         return -1;
     i = f->size;
     if (i != SIZEOF_LONG) {
         if ((i == 2) && (x < -32768 || x > 32767))
-            RANGE_ERROR(x, f, 0, 0xffffL);
+            RANGE_ERROR(state, x, f, 0, 0xffffL);
 #if (SIZEOF_LONG != 4)
         else if ((i == 4) && (x < -2147483648L || x > 2147483647L))
-            RANGE_ERROR(x, f, 0, 0xffffffffL);
+            RANGE_ERROR(state, x, f, 0, 0xffffffffL);
 #endif
     }
     do {
@@ -895,19 +906,19 @@
 }
 
 static int
-bp_uint(char *p, PyObject *v, const formatdef *f)
+bp_uint(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
 {
     unsigned long x;
     Py_ssize_t i;
     unsigned char *q = (unsigned char *)p;
-    if (get_ulong(v, &x) < 0)
+    if (get_ulong(state, v, &x) < 0)
         return -1;
     i = f->size;
     if (i != SIZEOF_LONG) {
         unsigned long maxint = 1;
         maxint <<= (unsigned long)(i * 8);
         if (x >= maxint)
-            RANGE_ERROR(x, f, 1, maxint - 1);
+            RANGE_ERROR(state, x, f, 1, maxint - 1);
     }
     do {
         q[--i] = (unsigned char)(x & 0xffUL);
@@ -917,10 +928,10 @@
 }
 
 static int
-bp_longlong(char *p, PyObject *v, const formatdef *f)
+bp_longlong(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
 {
     int res;
-    v = get_pylong(v);
+    v = get_pylong(state, v);
     if (v == NULL)
         return -1;
     res = _PyLong_AsByteArray((PyLongObject *)v,
@@ -933,10 +944,10 @@
 }
 
 static int
-bp_ulonglong(char *p, PyObject *v, const formatdef *f)
+bp_ulonglong(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
 {
     int res;
-    v = get_pylong(v);
+    v = get_pylong(state, v);
     if (v == NULL)
         return -1;
     res = _PyLong_AsByteArray((PyLongObject *)v,
@@ -949,17 +960,17 @@
 }
 
 static int
-bp_halffloat(char *p, PyObject *v, const formatdef *f)
+bp_halffloat(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
 {
-    return pack_halffloat(p, v, 0);
+    return pack_halffloat(state, p, v, 0);
 }
 
 static int
-bp_float(char *p, PyObject *v, const formatdef *f)
+bp_float(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
 {
     double x = PyFloat_AsDouble(v);
     if (x == -1 && PyErr_Occurred()) {
-        PyErr_SetString(_structmodulestate_global->StructError,
+        PyErr_SetString(state->StructError,
                         "required argument is not a float");
         return -1;
     }
@@ -967,11 +978,11 @@
 }
 
 static int
-bp_double(char *p, PyObject *v, const formatdef *f)
+bp_double(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
 {
     double x = PyFloat_AsDouble(v);
     if (x == -1 && PyErr_Occurred()) {
-        PyErr_SetString(_structmodulestate_global->StructError,
+        PyErr_SetString(state->StructError,
                         "required argument is not a float");
         return -1;
     }
@@ -979,7 +990,7 @@
 }
 
 static int
-bp_bool(char *p, PyObject *v, const formatdef *f)
+bp_bool(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
 {
     int y;
     y = PyObject_IsTrue(v);
@@ -1014,7 +1025,7 @@
 /* Little-endian routines. *****************************************************/
 
 static PyObject *
-lu_int(const char *p, const formatdef *f)
+lu_int(_structmodulestate *state, const char *p, const formatdef *f)
 {
     long x = 0;
     Py_ssize_t i = f->size;
@@ -1029,7 +1040,7 @@
 }
 
 static PyObject *
-lu_uint(const char *p, const formatdef *f)
+lu_uint(_structmodulestate *state, const char *p, const formatdef *f)
 {
     unsigned long x = 0;
     Py_ssize_t i = f->size;
@@ -1041,7 +1052,7 @@
 }
 
 static PyObject *
-lu_longlong(const char *p, const formatdef *f)
+lu_longlong(_structmodulestate *state, const char *p, const formatdef *f)
 {
     long long x = 0;
     Py_ssize_t i = f->size;
@@ -1056,7 +1067,7 @@
 }
 
 static PyObject *
-lu_ulonglong(const char *p, const formatdef *f)
+lu_ulonglong(_structmodulestate *state, const char *p, const formatdef *f)
 {
     unsigned long long x = 0;
     Py_ssize_t i = f->size;
@@ -1068,38 +1079,38 @@
 }
 
 static PyObject *
-lu_halffloat(const char *p, const formatdef *f)
+lu_halffloat(_structmodulestate *state, const char *p, const formatdef *f)
 {
     return unpack_halffloat(p, 1);
 }
 
 static PyObject *
-lu_float(const char *p, const formatdef *f)
+lu_float(_structmodulestate *state, const char *p, const formatdef *f)
 {
     return unpack_float(p, 1);
 }
 
 static PyObject *
-lu_double(const char *p, const formatdef *f)
+lu_double(_structmodulestate *state, const char *p, const formatdef *f)
 {
     return unpack_double(p, 1);
 }
 
 static int
-lp_int(char *p, PyObject *v, const formatdef *f)
+lp_int(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
 {
     long x;
     Py_ssize_t i;
     unsigned char *q = (unsigned char *)p;
-    if (get_long(v, &x) < 0)
+    if (get_long(state, v, &x) < 0)
         return -1;
     i = f->size;
     if (i != SIZEOF_LONG) {
         if ((i == 2) && (x < -32768 || x > 32767))
-            RANGE_ERROR(x, f, 0, 0xffffL);
+            RANGE_ERROR(state, x, f, 0, 0xffffL);
 #if (SIZEOF_LONG != 4)
         else if ((i == 4) && (x < -2147483648L || x > 2147483647L))
-            RANGE_ERROR(x, f, 0, 0xffffffffL);
+            RANGE_ERROR(state, x, f, 0, 0xffffffffL);
 #endif
     }
     do {
@@ -1110,19 +1121,19 @@
 }
 
 static int
-lp_uint(char *p, PyObject *v, const formatdef *f)
+lp_uint(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
 {
     unsigned long x;
     Py_ssize_t i;
     unsigned char *q = (unsigned char *)p;
-    if (get_ulong(v, &x) < 0)
+    if (get_ulong(state, v, &x) < 0)
         return -1;
     i = f->size;
     if (i != SIZEOF_LONG) {
         unsigned long maxint = 1;
         maxint <<= (unsigned long)(i * 8);
         if (x >= maxint)
-            RANGE_ERROR(x, f, 1, maxint - 1);
+            RANGE_ERROR(state, x, f, 1, maxint - 1);
     }
     do {
         *q++ = (unsigned char)(x & 0xffUL);
@@ -1132,10 +1143,10 @@
 }
 
 static int
-lp_longlong(char *p, PyObject *v, const formatdef *f)
+lp_longlong(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
 {
     int res;
-    v = get_pylong(v);
+    v = get_pylong(state, v);
     if (v == NULL)
         return -1;
     res = _PyLong_AsByteArray((PyLongObject*)v,
@@ -1148,10 +1159,10 @@
 }
 
 static int
-lp_ulonglong(char *p, PyObject *v, const formatdef *f)
+lp_ulonglong(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
 {
     int res;
-    v = get_pylong(v);
+    v = get_pylong(state, v);
     if (v == NULL)
         return -1;
     res = _PyLong_AsByteArray((PyLongObject*)v,
@@ -1164,17 +1175,17 @@
 }
 
 static int
-lp_halffloat(char *p, PyObject *v, const formatdef *f)
+lp_halffloat(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
 {
-    return pack_halffloat(p, v, 1);
+    return pack_halffloat(state, p, v, 1);
 }
 
 static int
-lp_float(char *p, PyObject *v, const formatdef *f)
+lp_float(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
 {
     double x = PyFloat_AsDouble(v);
     if (x == -1 && PyErr_Occurred()) {
-        PyErr_SetString(_structmodulestate_global->StructError,
+        PyErr_SetString(state->StructError,
                         "required argument is not a float");
         return -1;
     }
@@ -1182,11 +1193,11 @@
 }
 
 static int
-lp_double(char *p, PyObject *v, const formatdef *f)
+lp_double(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
 {
     double x = PyFloat_AsDouble(v);
     if (x == -1 && PyErr_Occurred()) {
-        PyErr_SetString(_structmodulestate_global->StructError,
+        PyErr_SetString(state->StructError,
                         "required argument is not a float");
         return -1;
     }
@@ -1246,14 +1257,14 @@
 /* Get the table entry for a format code */
 
 static const formatdef *
-getentry(int c, const formatdef *f)
+getentry(_structmodulestate *state, int c, const formatdef *f)
 {
     for (; f->format != '\0'; f++) {
         if (f->format == c) {
             return f;
         }
     }
-    PyErr_SetString(_structmodulestate_global->StructError, "bad char in struct format");
+    PyErr_SetString(state->StructError, "bad char in struct format");
     return NULL;
 }
 
@@ -1295,9 +1306,11 @@
     Py_ssize_t size, len, num, itemsize;
     size_t ncodes;
 
+    _structmodulestate *state = get_struct_state_structinst(self);
+
     fmt = PyBytes_AS_STRING(self->s_format);
     if (strlen(fmt) != (size_t)PyBytes_GET_SIZE(self->s_format)) {
-        PyErr_SetString(_structmodulestate_global->StructError,
+        PyErr_SetString(state->StructError,
                         "embedded null character");
         return -1;
     }
@@ -1323,7 +1336,7 @@
                 num = num*10 + (c - '0');
             }
             if (c == '\0') {
-                PyErr_SetString(_structmodulestate_global->StructError,
+                PyErr_SetString(state->StructError,
                                 "repeat count given without format specifier");
                 return -1;
             }
@@ -1331,7 +1344,7 @@
         else
             num = 1;
 
-        e = getentry(c, f);
+        e = getentry(state, c, f);
         if (e == NULL)
             return -1;
 
@@ -1361,14 +1374,14 @@
 
     self->s_size = size;
     self->s_len = len;
-    codes = PyMem_MALLOC((ncodes + 1) * sizeof(formatcode));
+    codes = PyMem_Malloc((ncodes + 1) * sizeof(formatcode));
     if (codes == NULL) {
         PyErr_NoMemory();
         return -1;
     }
     /* Free any s_codes value left over from a previous initialization. */
     if (self->s_codes != NULL)
-        PyMem_FREE(self->s_codes);
+        PyMem_Free(self->s_codes);
     self->s_codes = codes;
 
     s = fmt;
@@ -1384,7 +1397,7 @@
         else
             num = 1;
 
-        e = getentry(c, f);
+        e = getentry(state, c, f);
 
         size = align(size, c, e);
         if (c == 's' || c == 'p') {
@@ -1413,7 +1426,7 @@
     return 0;
 
   overflow:
-    PyErr_SetString(_structmodulestate_global->StructError,
+    PyErr_SetString(state->StructError,
                     "total struct size too long");
     return -1;
 }
@@ -1430,8 +1443,7 @@
     self = alloc_func(type, 0);
     if (self != NULL) {
         PyStructObject *s = (PyStructObject*)self;
-        Py_INCREF(Py_None);
-        s->s_format = Py_None;
+        s->s_format = Py_NewRef(Py_None);
         s->s_codes = NULL;
         s->s_size = -1;
         s->s_len = -1;
@@ -1490,7 +1502,7 @@
     if (s->weakreflist != NULL)
         PyObject_ClearWeakRefs((PyObject *)s);
     if (s->s_codes != NULL) {
-        PyMem_FREE(s->s_codes);
+        PyMem_Free(s->s_codes);
     }
     Py_XDECREF(s->s_format);
     freefunc free_func = PyType_GetSlot(Py_TYPE(s), Py_tp_free);
@@ -1499,7 +1511,8 @@
 }
 
 static PyObject *
-s_unpack_internal(PyStructObject *soself, const char *startfrom) {
+s_unpack_internal(PyStructObject *soself, const char *startfrom,
+                  _structmodulestate *state) {
     formatcode *code;
     Py_ssize_t i = 0;
     PyObject *result = PyTuple_New(soself->s_len);
@@ -1520,7 +1533,7 @@
                     n = code->size - 1;
                 v = PyBytes_FromStringAndSize(res + 1, n);
             } else {
-                v = e->unpack(res, e);
+                v = e->unpack(state, res, e);
             }
             if (v == NULL)
                 goto fail;
@@ -1554,14 +1567,15 @@
 Struct_unpack_impl(PyStructObject *self, Py_buffer *buffer)
 /*[clinic end generated code: output=873a24faf02e848a input=3113f8e7038b2f6c]*/
 {
+    _structmodulestate *state = get_struct_state_structinst(self);
     assert(self->s_codes != NULL);
     if (buffer->len != self->s_size) {
-        PyErr_Format(_structmodulestate_global->StructError,
+        PyErr_Format(state->StructError,
                      "unpack requires a buffer of %zd bytes",
                      self->s_size);
         return NULL;
     }
-    return s_unpack_internal(self, buffer->buf);
+    return s_unpack_internal(self, buffer->buf, state);
 }
 
 /*[clinic input]
@@ -1585,11 +1599,12 @@
                         Py_ssize_t offset)
 /*[clinic end generated code: output=57fac875e0977316 input=cafd4851d473c894]*/
 {
+    _structmodulestate *state = get_struct_state_structinst(self);
     assert(self->s_codes != NULL);
 
     if (offset < 0) {
         if (offset + self->s_size > 0) {
-            PyErr_Format(_structmodulestate_global->StructError,
+            PyErr_Format(state->StructError,
                          "not enough data to unpack %zd bytes at offset %zd",
                          self->s_size,
                          offset);
@@ -1597,7 +1612,7 @@
         }
 
         if (offset + buffer->len < 0) {
-            PyErr_Format(_structmodulestate_global->StructError,
+            PyErr_Format(state->StructError,
                          "offset %zd out of range for %zd-byte buffer",
                          offset,
                          buffer->len);
@@ -1607,7 +1622,7 @@
     }
 
     if ((buffer->len - offset) < self->s_size) {
-        PyErr_Format(_structmodulestate_global->StructError,
+        PyErr_Format(state->StructError,
                      "unpack_from requires a buffer of at least %zu bytes for "
                      "unpacking %zd bytes at offset %zd "
                      "(actual buffer size is %zd)",
@@ -1617,7 +1632,7 @@
                      buffer->len);
         return NULL;
     }
-    return s_unpack_internal(self, (char*)buffer->buf + offset);
+    return s_unpack_internal(self, (char*)buffer->buf + offset, state);
 }
 
 
@@ -1671,6 +1686,7 @@
 static PyObject *
 unpackiter_iternext(unpackiterobject *self)
 {
+    _structmodulestate *state = get_struct_state_iterinst(self);
     PyObject *result;
     if (self->so == NULL)
         return NULL;
@@ -1682,7 +1698,8 @@
     }
     assert(self->index + self->so->s_size <= self->buf.len);
     result = s_unpack_internal(self->so,
-                               (char*) self->buf.buf + self->index);
+                               (char*) self->buf.buf + self->index,
+                               state);
     self->index += self->so->s_size;
     return result;
 }
@@ -1729,17 +1746,18 @@
 Struct_iter_unpack(PyStructObject *self, PyObject *buffer)
 /*[clinic end generated code: output=172d83d0cd15dbab input=6d65b3f3107dbc99]*/
 {
+    _structmodulestate *state = get_struct_state_structinst(self);
     unpackiterobject *iter;
 
     assert(self->s_codes != NULL);
 
     if (self->s_size == 0) {
-        PyErr_Format(_structmodulestate_global->StructError,
+        PyErr_Format(state->StructError,
                      "cannot iteratively unpack with a struct of length 0");
         return NULL;
     }
 
-    iter = (unpackiterobject *) PyType_GenericAlloc((PyTypeObject *)_structmodulestate_global->unpackiter_type, 0);
+    iter = (unpackiterobject *) PyType_GenericAlloc((PyTypeObject *)state->unpackiter_type, 0);
     if (iter == NULL)
         return NULL;
 
@@ -1748,7 +1766,7 @@
         return NULL;
     }
     if (iter->buf.len % self->s_size != 0) {
-        PyErr_Format(_structmodulestate_global->StructError,
+        PyErr_Format(state->StructError,
                      "iterative unpacking requires a buffer of "
                      "a multiple of %zd bytes",
                      self->s_size);
@@ -1773,7 +1791,8 @@
  *
  */
 static int
-s_pack_internal(PyStructObject *soself, PyObject *const *args, int offset, char* buf)
+s_pack_internal(PyStructObject *soself, PyObject *const *args, int offset,
+                char* buf, _structmodulestate *state)
 {
     formatcode *code;
     /* XXX(nnorwitz): why does i need to be a local?  can we use
@@ -1794,7 +1813,7 @@
                 const void *p;
                 isstring = PyBytes_Check(v);
                 if (!isstring && !PyByteArray_Check(v)) {
-                    PyErr_SetString(_structmodulestate_global->StructError,
+                    PyErr_SetString(state->StructError,
                                     "argument for 's' must be a bytes object");
                     return -1;
                 }
@@ -1816,7 +1835,7 @@
                 const void *p;
                 isstring = PyBytes_Check(v);
                 if (!isstring && !PyByteArray_Check(v)) {
-                    PyErr_SetString(_structmodulestate_global->StructError,
+                    PyErr_SetString(state->StructError,
                                     "argument for 'p' must be a bytes object");
                     return -1;
                 }
@@ -1836,9 +1855,9 @@
                     n = 255;
                 *res = Py_SAFE_DOWNCAST(n, Py_ssize_t, unsigned char);
             } else {
-                if (e->pack(res, v, e) < 0) {
+                if (e->pack(state, res, v, e) < 0) {
                     if (PyLong_Check(v) && PyErr_ExceptionMatches(PyExc_OverflowError))
-                        PyErr_SetString(_structmodulestate_global->StructError,
+                        PyErr_SetString(state->StructError,
                                         "int too large to convert");
                     return -1;
                 }
@@ -1864,14 +1883,15 @@
 {
     char *buf;
     PyStructObject *soself;
+    _structmodulestate *state = get_struct_state_structinst(self);
 
     /* Validate arguments. */
     soself = (PyStructObject *)self;
-    assert(PyStruct_Check(self));
+    assert(PyStruct_Check(self, state));
     assert(soself->s_codes != NULL);
     if (nargs != soself->s_len)
     {
-        PyErr_Format(_structmodulestate_global->StructError,
+        PyErr_Format(state->StructError,
             "pack expected %zd items for packing (got %zd)", soself->s_len, nargs);
         return NULL;
     }
@@ -1886,7 +1906,7 @@
     }
 
     /* Call the guts */
-    if ( s_pack_internal(soself, args, 0, buf) != 0 ) {
+    if ( s_pack_internal(soself, args, 0, buf, state) != 0 ) {
         _PyBytesWriter_Dealloc(&writer);
         return NULL;
     }
@@ -1908,23 +1928,24 @@
     PyStructObject *soself;
     Py_buffer buffer;
     Py_ssize_t offset;
+    _structmodulestate *state = get_struct_state_structinst(self);
 
     /* Validate arguments.  +1 is for the first arg as buffer. */
     soself = (PyStructObject *)self;
-    assert(PyStruct_Check(self));
+    assert(PyStruct_Check(self, state));
     assert(soself->s_codes != NULL);
     if (nargs != (soself->s_len + 2))
     {
         if (nargs == 0) {
-            PyErr_Format(_structmodulestate_global->StructError,
+            PyErr_Format(state->StructError,
                         "pack_into expected buffer argument");
         }
         else if (nargs == 1) {
-            PyErr_Format(_structmodulestate_global->StructError,
+            PyErr_Format(state->StructError,
                         "pack_into expected offset argument");
         }
         else {
-            PyErr_Format(_structmodulestate_global->StructError,
+            PyErr_Format(state->StructError,
                         "pack_into expected %zd items for packing (got %zd)",
                         soself->s_len, (nargs - 2));
         }
@@ -1947,7 +1968,7 @@
     if (offset < 0) {
          /* Check that negative offset is low enough to fit data */
         if (offset + soself->s_size > 0) {
-            PyErr_Format(_structmodulestate_global->StructError,
+            PyErr_Format(state->StructError,
                          "no space to pack %zd bytes at offset %zd",
                          soself->s_size,
                          offset);
@@ -1957,7 +1978,7 @@
 
         /* Check that negative offset is not crossing buffer boundary */
         if (offset + buffer.len < 0) {
-            PyErr_Format(_structmodulestate_global->StructError,
+            PyErr_Format(state->StructError,
                          "offset %zd out of range for %zd-byte buffer",
                          offset,
                          buffer.len);
@@ -1973,7 +1994,7 @@
         assert(offset >= 0);
         assert(soself->s_size >= 0);
 
-        PyErr_Format(_structmodulestate_global->StructError,
+        PyErr_Format(state->StructError,
                      "pack_into requires a buffer of at least %zu bytes for "
                      "packing %zd bytes at offset %zd "
                      "(actual buffer size is %zd)",
@@ -1986,7 +2007,7 @@
     }
 
     /* Call the guts */
-    if (s_pack_internal(soself, args, 2, (char*)buffer.buf + offset) != 0) {
+    if (s_pack_internal(soself, args, 2, (char*)buffer.buf + offset, state) != 0) {
         PyBuffer_Release(&buffer);
         return NULL;
     }
@@ -2080,12 +2101,12 @@
 /* ---- Standalone functions  ---- */
 
 #define MAXCACHE 100
-static PyObject *cache = NULL;
 
 static int
-cache_struct_converter(PyObject *fmt, PyStructObject **ptr)
+cache_struct_converter(PyObject *module, PyObject *fmt, PyStructObject **ptr)
 {
     PyObject * s_object;
+    _structmodulestate *state = get_struct_state(module);
 
     if (fmt == NULL) {
         Py_DECREF(*ptr);
@@ -2093,13 +2114,13 @@
         return 1;
     }
 
-    if (cache == NULL) {
-        cache = PyDict_New();
-        if (cache == NULL)
+    if (state->cache == NULL) {
+        state->cache = PyDict_New();
+        if (state->cache == NULL)
             return 0;
     }
 
-    s_object = PyDict_GetItemWithError(cache, fmt);
+    s_object = PyDict_GetItemWithError(state->cache, fmt);
     if (s_object != NULL) {
         Py_INCREF(s_object);
         *ptr = (PyStructObject *)s_object;
@@ -2109,12 +2130,12 @@
         return 0;
     }
 
-    s_object = PyObject_CallOneArg(_structmodulestate_global->PyStructType, fmt);
+    s_object = PyObject_CallOneArg(state->PyStructType, fmt);
     if (s_object != NULL) {
-        if (PyDict_GET_SIZE(cache) >= MAXCACHE)
-            PyDict_Clear(cache);
+        if (PyDict_GET_SIZE(state->cache) >= MAXCACHE)
+            PyDict_Clear(state->cache);
         /* Attempt to cache the result */
-        if (PyDict_SetItem(cache, fmt, s_object) == -1)
+        if (PyDict_SetItem(state->cache, fmt, s_object) == -1)
             PyErr_Clear();
         *ptr = (PyStructObject *)s_object;
         return Py_CLEANUP_SUPPORTED;
@@ -2132,7 +2153,7 @@
 _clearcache_impl(PyObject *module)
 /*[clinic end generated code: output=ce4fb8a7bf7cb523 input=463eaae04bab3211]*/
 {
-    Py_CLEAR(cache);
+    Py_CLEAR(get_struct_state(module)->cache);
     Py_RETURN_NONE;
 }
 
@@ -2160,7 +2181,7 @@
 to the format string.  See help(struct) for more on format strings.");
 
 static PyObject *
-pack(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
+pack(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
 {
     PyObject *s_object = NULL;
     PyObject *format, *result;
@@ -2171,7 +2192,7 @@
     }
     format = args[0];
 
-    if (!cache_struct_converter(format, (PyStructObject **)&s_object)) {
+    if (!cache_struct_converter(module, format, (PyStructObject **)&s_object)) {
         return NULL;
     }
     result = s_pack(s_object, args + 1, nargs - 1);
@@ -2188,7 +2209,7 @@
 on format strings.");
 
 static PyObject *
-pack_into(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
+pack_into(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
 {
     PyObject *s_object = NULL;
     PyObject *format, *result;
@@ -2199,7 +2220,7 @@
     }
     format = args[0];
 
-    if (!cache_struct_converter(format, (PyStructObject **)&s_object)) {
+    if (!cache_struct_converter(module, format, (PyStructObject **)&s_object)) {
         return NULL;
     }
     result = s_pack_into(s_object, args + 1, nargs - 1);
@@ -2322,8 +2343,9 @@
 static int
 _structmodule_traverse(PyObject *module, visitproc visit, void *arg)
 {
-    _structmodulestate *state = (_structmodulestate *)PyModule_GetState(module);
+    _structmodulestate *state = get_struct_state(module);
     if (state) {
+        Py_VISIT(state->cache);
         Py_VISIT(state->PyStructType);
         Py_VISIT(state->unpackiter_type);
         Py_VISIT(state->StructError);
@@ -2334,8 +2356,9 @@
 static int
 _structmodule_clear(PyObject *module)
 {
-    _structmodulestate *state = (_structmodulestate *)PyModule_GetState(module);
+    _structmodulestate *state = get_struct_state(module);
     if (state) {
+        Py_CLEAR(state->cache);
         Py_CLEAR(state->PyStructType);
         Py_CLEAR(state->unpackiter_type);
         Py_CLEAR(state->StructError);
@@ -2349,40 +2372,25 @@
     _structmodule_clear((PyObject *)module);
 }
 
-static struct PyModuleDef _structmodule = {
-    PyModuleDef_HEAD_INIT,
-    "_struct",
-    module_doc,
-    sizeof(_structmodulestate),
-    module_functions,
-    NULL,
-    _structmodule_traverse,
-    _structmodule_clear,
-    _structmodule_free,
-};
-
-PyMODINIT_FUNC
-PyInit__struct(void)
+static int
+_structmodule_exec(PyObject *m)
 {
-    PyObject *m;
+    _structmodulestate *state = get_struct_state(m);
 
-    m = PyModule_Create(&_structmodule);
-    if (m == NULL)
-        return NULL;
-
-    PyObject *PyStructType = PyType_FromSpec(&PyStructType_spec);
-    if (PyStructType == NULL) {
-        return NULL;
+    state->PyStructType = PyType_FromModuleAndSpec(
+        m, &PyStructType_spec, NULL);
+    if (state->PyStructType == NULL) {
+        return -1;
     }
-    Py_INCREF(PyStructType);
-    PyModule_AddObject(m, "Struct", PyStructType);
-    get_struct_state(m)->PyStructType = PyStructType;
-
-    PyObject *unpackiter_type = PyType_FromSpec(&unpackiter_type_spec);
-    if (unpackiter_type == NULL) {
-        return NULL;
+    if (PyModule_AddType(m, (PyTypeObject *)state->PyStructType) < 0) {
+        return -1;
     }
-    get_struct_state(m)->unpackiter_type = unpackiter_type;
+
+    state->unpackiter_type = PyType_FromModuleAndSpec(
+        m, &unpackiter_type_spec, NULL);
+    if (state->unpackiter_type == NULL) {
+        return -1;
+    }
 
     /* Check endian and swap in faster functions */
     {
@@ -2427,12 +2435,36 @@
     }
 
     /* Add some symbolic constants to the module */
-    PyObject *StructError = PyErr_NewException("struct.error", NULL, NULL);
-    if (StructError == NULL)
-        return NULL;
-    Py_INCREF(StructError);
-    PyModule_AddObject(m, "error", StructError);
-    get_struct_state(m)->StructError = StructError;
+    state->StructError = PyErr_NewException("struct.error", NULL, NULL);
+    if (state->StructError == NULL) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "error", state->StructError) < 0) {
+        return -1;
+    }
 
-    return m;
+    return 0;
+}
+
+static PyModuleDef_Slot _structmodule_slots[] = {
+    {Py_mod_exec, _structmodule_exec},
+    {0, NULL}
+};
+
+static struct PyModuleDef _structmodule = {
+    PyModuleDef_HEAD_INIT,
+    .m_name = "_struct",
+    .m_doc = module_doc,
+    .m_size = sizeof(_structmodulestate),
+    .m_methods = module_functions,
+    .m_slots = _structmodule_slots,
+    .m_traverse = _structmodule_traverse,
+    .m_clear = _structmodule_clear,
+    .m_free = _structmodule_free,
+};
+
+PyMODINIT_FUNC
+PyInit__struct(void)
+{
+    return PyModuleDef_Init(&_structmodule);
 }
diff --git a/Modules/_testbuffer.c b/Modules/_testbuffer.c
index d832176..1b4fb09 100644
--- a/Modules/_testbuffer.c
+++ b/Modules/_testbuffer.c
@@ -236,7 +236,7 @@
                 ndbuf_pop(self);
         }
     }
-    PyObject_Del(self);
+    PyObject_Free(self);
 }
 
 static int
@@ -2734,7 +2734,7 @@
 static void
 staticarray_dealloc(StaticArrayObject *self)
 {
-    PyObject_Del(self);
+    PyObject_Free(self);
 }
 
 /* Return a buffer for a PyBUF_FULL_RO request. Flags are not checked,
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 54c1e62..c5c9428 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -144,6 +144,67 @@
 #endif
 }
 
+static PyObject*
+test_gc_control(PyObject *self, PyObject *Py_UNUSED(ignored))
+{
+    int orig_enabled = PyGC_IsEnabled();
+    const char* msg = "ok";
+    int old_state;
+
+    old_state = PyGC_Enable();
+    msg = "Enable(1)";
+    if (old_state != orig_enabled) {
+        goto failed;
+    }
+    msg = "IsEnabled(1)";
+    if (!PyGC_IsEnabled()) {
+        goto failed;
+    }
+
+    old_state = PyGC_Disable();
+    msg = "disable(2)";
+    if (!old_state) {
+        goto failed;
+    }
+    msg = "IsEnabled(2)";
+    if (PyGC_IsEnabled()) {
+        goto failed;
+    }
+
+    old_state = PyGC_Enable();
+    msg = "enable(3)";
+    if (old_state) {
+        goto failed;
+    }
+    msg = "IsEnabled(3)";
+    if (!PyGC_IsEnabled()) {
+        goto failed;
+    }
+
+    if (!orig_enabled) {
+        old_state = PyGC_Disable();
+        msg = "disable(4)";
+        if (old_state) {
+            goto failed;
+        }
+        msg = "IsEnabled(4)";
+        if (PyGC_IsEnabled()) {
+            goto failed;
+        }
+    }
+
+    Py_RETURN_NONE;
+
+failed:
+    /* Try to clean up if we can. */
+    if (orig_enabled) {
+        PyGC_Enable();
+    } else {
+        PyGC_Disable();
+    }
+    PyErr_Format(TestError, "GC control failed in %s", msg);
+    return NULL;
+}
 
 static PyObject*
 test_list_api(PyObject *self, PyObject *Py_UNUSED(ignored))
@@ -330,6 +391,19 @@
 };
 
 static PyObject*
+pycompilestring(PyObject* self, PyObject *obj) {
+    if (PyBytes_CheckExact(obj) == 0) {
+        PyErr_SetString(PyExc_ValueError, "Argument must be a bytes object");
+        return NULL;
+    }
+    const char *the_string = PyBytes_AsString(obj);
+    if (the_string == NULL) {
+        return NULL;
+    }
+    return Py_CompileString(the_string, "<string>", Py_file_input);
+}
+
+static PyObject*
 test_lazy_hash_inheritance(PyObject* self, PyObject *Py_UNUSED(ignored))
 {
     PyTypeObject *type;
@@ -1018,6 +1092,62 @@
 
 
 static PyObject *
+test_get_statictype_slots(PyObject *self, PyObject *Py_UNUSED(ignored))
+{
+    newfunc tp_new = PyType_GetSlot(&PyLong_Type, Py_tp_new);
+    if (PyLong_Type.tp_new != tp_new) {
+        PyErr_SetString(PyExc_AssertionError, "mismatch: tp_new of long");
+        return NULL;
+    }
+
+    reprfunc tp_repr = PyType_GetSlot(&PyLong_Type, Py_tp_repr);
+    if (PyLong_Type.tp_repr != tp_repr) {
+        PyErr_SetString(PyExc_AssertionError, "mismatch: tp_repr of long");
+        return NULL;
+    }
+
+    ternaryfunc tp_call = PyType_GetSlot(&PyLong_Type, Py_tp_call);
+    if (tp_call != NULL) {
+        PyErr_SetString(PyExc_AssertionError, "mismatch: tp_call of long");
+        return NULL;
+    }
+
+    binaryfunc nb_add = PyType_GetSlot(&PyLong_Type, Py_nb_add);
+    if (PyLong_Type.tp_as_number->nb_add != nb_add) {
+        PyErr_SetString(PyExc_AssertionError, "mismatch: nb_add of long");
+        return NULL;
+    }
+
+    lenfunc mp_length = PyType_GetSlot(&PyLong_Type, Py_mp_length);
+    if (mp_length != NULL) {
+        PyErr_SetString(PyExc_AssertionError, "mismatch: mp_length of long");
+        return NULL;
+    }
+
+    void *over_value = PyType_GetSlot(&PyLong_Type, Py_bf_releasebuffer + 1);
+    if (over_value != NULL) {
+        PyErr_SetString(PyExc_AssertionError, "mismatch: max+1 of long");
+        return NULL;
+    }
+
+    tp_new = PyType_GetSlot(&PyLong_Type, 0);
+    if (tp_new != NULL) {
+        PyErr_SetString(PyExc_AssertionError, "mismatch: slot 0 of long");
+        return NULL;
+    }
+    if (PyErr_ExceptionMatches(PyExc_SystemError)) {
+        // This is the right exception
+        PyErr_Clear();
+    }
+    else {
+        return NULL;
+    }
+
+    Py_RETURN_NONE;
+}
+
+
+static PyObject *
 get_args(PyObject *self, PyObject *args)
 {
     if (args == NULL) {
@@ -1668,6 +1798,7 @@
 
 static volatile int x;
 
+#if USE_UNICODE_WCHAR_CACHE
 /* Ignore use of deprecated APIs */
 _Py_COMP_DIAG_PUSH
 _Py_COMP_DIAG_IGNORE_DEPR_DECLS
@@ -1772,6 +1903,8 @@
     Py_DECREF(tuple);
     Py_RETURN_NONE;
 }
+_Py_COMP_DIAG_POP
+#endif /* USE_UNICODE_WCHAR_CACHE */
 
 static PyObject *
 test_widechar(PyObject *self, PyObject *Py_UNUSED(ignored))
@@ -1824,6 +1957,10 @@
         return raiseTestError("test_widechar",
                               "PyUnicode_FromWideChar(L\"\\U00110000\", 1) didn't fail");
 
+#if USE_UNICODE_WCHAR_CACHE
+/* Ignore use of deprecated APIs */
+_Py_COMP_DIAG_PUSH
+_Py_COMP_DIAG_IGNORE_DEPR_DECLS
     wide = PyUnicode_FromUnicode(invalid, 1);
     if (wide == NULL)
         PyErr_Clear();
@@ -1844,11 +1981,12 @@
         return raiseTestError("test_widechar",
                               "PyUnicode_Ready() didn't fail");
     }
+_Py_COMP_DIAG_POP
+#endif /* USE_UNICODE_WCHAR_CACHE */
 #endif
 
     Py_RETURN_NONE;
 }
-_Py_COMP_DIAG_POP
 
 static PyObject *
 unicode_aswidechar(PyObject *self, PyObject *args)
@@ -1923,12 +2061,12 @@
     buffer[str_len] = 0xffffU;
 
     if (!PyUnicode_AsUCS4(unicode, buffer, buf_len, copy_null)) {
-        PyMem_FREE(buffer);
+        PyMem_Free(buffer);
         return NULL;
     }
 
     result = PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND, buffer, buf_len);
-    PyMem_FREE(buffer);
+    PyMem_Free(buffer);
     return result;
 }
 
@@ -2024,6 +2162,7 @@
     return Py_BuildValue("(Nn)", to_copy, copied);
 }
 
+#if USE_UNICODE_WCHAR_CACHE
 /* Ignore use of deprecated APIs */
 _Py_COMP_DIAG_PUSH
 _Py_COMP_DIAG_IGNORE_DEPR_DECLS
@@ -2096,6 +2235,7 @@
     return u;
 }
 _Py_COMP_DIAG_POP
+#endif /* USE_UNICODE_WCHAR_CACHE */
 
 static PyObject *
 getargs_w_star(PyObject *self, PyObject *args)
@@ -2215,16 +2355,22 @@
     Py_RETURN_NONE;
 }
 
-/* Example passing NULLs to PyObject_Str(NULL). */
+static PyObject *
+pyobject_repr_from_null(PyObject *self, PyObject *Py_UNUSED(ignored))
+{
+    return PyObject_Repr(NULL);
+}
 
 static PyObject *
-test_null_strings(PyObject *self, PyObject *Py_UNUSED(ignored))
+pyobject_str_from_null(PyObject *self, PyObject *Py_UNUSED(ignored))
 {
-    PyObject *o1 = PyObject_Str(NULL), *o2 = PyObject_Str(NULL);
-    PyObject *tuple = PyTuple_Pack(2, o1, o2);
-    Py_XDECREF(o1);
-    Py_XDECREF(o2);
-    return tuple;
+    return PyObject_Str(NULL);
+}
+
+static PyObject *
+pyobject_bytes_from_null(PyObject *self, PyObject *Py_UNUSED(ignored))
+{
+    return PyObject_Bytes(NULL);
 }
 
 static PyObject *
@@ -2666,8 +2812,9 @@
     minute = PyDateTime_DATE_GET_MINUTE(obj);
     second = PyDateTime_DATE_GET_SECOND(obj);
     microsecond = PyDateTime_DATE_GET_MICROSECOND(obj);
+    PyObject *tzinfo = PyDateTime_DATE_GET_TZINFO(obj);
 
-    return Py_BuildValue("(llll)", hour, minute, second, microsecond);
+    return Py_BuildValue("(llllO)", hour, minute, second, microsecond, tzinfo);
 }
 
 static PyObject *
@@ -2679,8 +2826,9 @@
     minute = PyDateTime_TIME_GET_MINUTE(obj);
     second = PyDateTime_TIME_GET_SECOND(obj);
     microsecond = PyDateTime_TIME_GET_MICROSECOND(obj);
+    PyObject *tzinfo = PyDateTime_TIME_GET_TZINFO(obj);
 
-    return Py_BuildValue("(llll)", hour, minute, second, microsecond);
+    return Py_BuildValue("(llllO)", hour, minute, second, microsecond, tzinfo);
 }
 
 static PyObject *
@@ -3732,6 +3880,25 @@
 }
 
 static PyObject *
+test_structseq_newtype_null_descr_doc(PyObject *Py_UNUSED(self),
+                              PyObject *Py_UNUSED(args))
+{
+    PyStructSequence_Field descr_fields[1] = {
+        (PyStructSequence_Field){NULL, NULL}
+    };
+    // Test specifically for NULL .doc field.
+    PyStructSequence_Desc descr = {"_testcapi.test_descr", NULL, &descr_fields[0], 0};
+
+    PyTypeObject* structseq_type = PyStructSequence_NewType(&descr);
+    assert(structseq_type != NULL);
+    assert(PyType_Check(structseq_type));
+    assert(PyType_FastSubclass(structseq_type, Py_TPFLAGS_TUPLE_SUBCLASS));
+    Py_DECREF(structseq_type);
+
+    Py_RETURN_NONE;
+}
+
+static PyObject *
 test_incref_decref_API(PyObject *ob, PyObject *Py_UNUSED(ignored))
 {
     PyObject *obj = PyLong_FromLong(0);
@@ -4421,6 +4588,18 @@
     Py_RETURN_NONE;
 }
 
+static PyObject*
+getitem_with_error(PyObject *self, PyObject *args)
+{
+    PyObject *map, *key;
+    if (!PyArg_ParseTuple(args, "OO", &map, &key)) {
+        return NULL;
+    }
+
+    PyErr_SetString(PyExc_ValueError, "bug");
+    return PyObject_GetItem(map, key);
+}
+
 static PyObject *
 test_pytime_fromseconds(PyObject *self, PyObject *args)
 {
@@ -4669,6 +4848,10 @@
 static PyObject*
 check_pyobject_freed_is_freed(PyObject *self, PyObject *Py_UNUSED(args))
 {
+    /* This test would fail if run with the address sanitizer */
+#ifdef _Py_ADDRESS_SANITIZER
+    Py_RETURN_NONE;
+#else
     PyObject *op = _PyObject_CallNoArg((PyObject *)&PyBaseObject_Type);
     if (op == NULL) {
         return NULL;
@@ -4678,6 +4861,7 @@
     Py_SET_REFCNT(op, 1);
     /* object memory is freed! */
     return test_pyobject_is_freed("check_pyobject_freed_is_freed", op);
+#endif
 }
 
 
@@ -4788,6 +4972,7 @@
 static PyObject *
 raise_SIGINT_then_send_None(PyObject *self, PyObject *args)
 {
+    _Py_IDENTIFIER(send);
     PyGenObject *gen;
 
     if (!PyArg_ParseTuple(args, "O!", &PyGen_Type, &gen))
@@ -4804,7 +4989,7 @@
          because we check for signals before every bytecode operation.
      */
     raise(SIGINT);
-    return _PyGen_Send(gen, Py_None);
+    return _PyObject_CallMethodIdOneArg((PyObject *)gen, &PyId_send, Py_None);
 }
 
 
@@ -5097,7 +5282,7 @@
         PyErr_SetString(PyExc_ValueError, "unsupported error handler");
         break;
     default:
-        PyErr_SetString(PyExc_ValueError, "unknow error code");
+        PyErr_SetString(PyExc_ValueError, "unknown error code");
         break;
     }
     return res;
@@ -5140,7 +5325,7 @@
         PyErr_SetString(PyExc_ValueError, "unsupported error handler");
         break;
     default:
-        PyErr_SetString(PyExc_ValueError, "unknow error code");
+        PyErr_SetString(PyExc_ValueError, "unknown error code");
         break;
     }
     return res;
@@ -5294,7 +5479,146 @@
 }
 
 
+static PyObject*
+test_set_type_size(PyObject *self, PyObject *Py_UNUSED(ignored))
+{
+    PyObject *obj = PyList_New(0);
+    if (obj == NULL) {
+        return NULL;
+    }
+
+    // Ensure that following tests don't modify the object,
+    // to ensure that Py_DECREF() will not crash.
+    assert(Py_TYPE(obj) == &PyList_Type);
+    assert(Py_SIZE(obj) == 0);
+
+    // bpo-39573: Check that Py_TYPE() and Py_SIZE() can be used
+    // as l-values to set an object type and size.
+    Py_TYPE(obj) = &PyList_Type;
+    Py_SIZE(obj) = 0;
+
+    Py_DECREF(obj);
+    Py_RETURN_NONE;
+}
+
+
+#define TEST_REFCOUNT() \
+    do { \
+        PyObject *obj = PyList_New(0); \
+        if (obj == NULL) { \
+            return NULL; \
+        } \
+        assert(Py_REFCNT(obj) == 1); \
+        \
+        /* test Py_NewRef() */ \
+        PyObject *ref = Py_NewRef(obj); \
+        assert(ref == obj); \
+        assert(Py_REFCNT(obj) == 2); \
+        Py_DECREF(ref); \
+        \
+        /* test Py_XNewRef() */ \
+        PyObject *xref = Py_XNewRef(obj); \
+        assert(xref == obj); \
+        assert(Py_REFCNT(obj) == 2); \
+        Py_DECREF(xref); \
+        \
+        assert(Py_XNewRef(NULL) == NULL); \
+        \
+        Py_DECREF(obj); \
+        Py_RETURN_NONE; \
+    } while (0) \
+
+
+// Test Py_NewRef() and Py_XNewRef() macros
+static PyObject*
+test_refcount_macros(PyObject *self, PyObject *Py_UNUSED(ignored))
+{
+    TEST_REFCOUNT();
+}
+
+#undef Py_NewRef
+#undef Py_XNewRef
+
+// Test Py_NewRef() and Py_XNewRef() functions, after undefining macros.
+static PyObject*
+test_refcount_funcs(PyObject *self, PyObject *Py_UNUSED(ignored))
+{
+    TEST_REFCOUNT();
+}
+
+
+// Test Py_Is() function
+#define TEST_PY_IS() \
+    do { \
+        PyObject *o_none = Py_None; \
+        PyObject *o_true = Py_True; \
+        PyObject *o_false = Py_False; \
+        PyObject *obj = PyList_New(0); \
+        if (obj == NULL) { \
+            return NULL; \
+        } \
+        \
+        /* test Py_Is() */ \
+        assert(Py_Is(obj, obj)); \
+        assert(!Py_Is(obj, o_none)); \
+        \
+        /* test Py_None */ \
+        assert(Py_Is(o_none, o_none)); \
+        assert(!Py_Is(obj, o_none)); \
+        \
+        /* test Py_True */ \
+        assert(Py_Is(o_true, o_true)); \
+        assert(!Py_Is(o_false, o_true)); \
+        assert(!Py_Is(obj, o_true)); \
+        \
+        /* test Py_False */ \
+        assert(Py_Is(o_false, o_false)); \
+        assert(!Py_Is(o_true, o_false)); \
+        assert(!Py_Is(obj, o_false)); \
+        \
+        Py_DECREF(obj); \
+        Py_RETURN_NONE; \
+    } while (0)
+
+// Test Py_Is() macro
+static PyObject*
+test_py_is_macros(PyObject *self, PyObject *Py_UNUSED(ignored))
+{
+    TEST_PY_IS();
+}
+
+#undef Py_Is
+
+// Test Py_Is() function, after undefining its macro.
+static PyObject*
+test_py_is_funcs(PyObject *self, PyObject *Py_UNUSED(ignored))
+{
+    TEST_PY_IS();
+}
+
+
+static PyObject *
+test_fatal_error(PyObject *self, PyObject *args)
+{
+    char *message;
+    int release_gil = 0;
+    if (!PyArg_ParseTuple(args, "y|i:fatal_error", &message, &release_gil))
+        return NULL;
+    if (release_gil) {
+        Py_BEGIN_ALLOW_THREADS
+        Py_FatalError(message);
+        Py_END_ALLOW_THREADS
+    }
+    else {
+        Py_FatalError(message);
+    }
+    // Py_FatalError() does not return, but exits the process.
+    Py_RETURN_NONE;
+}
+
+
 static PyObject *test_buildvalue_issue38913(PyObject *, PyObject *);
+static PyObject *getargs_s_hash_int(PyObject *, PyObject *, PyObject*);
 
 static PyMethodDef TestMethods[] = {
     {"raise_exception",         raise_exception,                 METH_VARARGS},
@@ -5323,6 +5647,7 @@
     {"PyDateTime_DATE_GET",        test_PyDateTime_DATE_GET,      METH_O},
     {"PyDateTime_TIME_GET",        test_PyDateTime_TIME_GET,      METH_O},
     {"PyDateTime_DELTA_GET",       test_PyDateTime_DELTA_GET,     METH_O},
+    {"test_gc_control",         test_gc_control,                 METH_NOARGS},
     {"test_list_api",           test_list_api,                   METH_NOARGS},
     {"test_dict_iteration",     test_dict_iteration,             METH_NOARGS},
     {"dict_getitem_knownhash",  dict_getitem_knownhash,          METH_VARARGS},
@@ -5335,6 +5660,8 @@
     {"test_decref_doesnt_leak", test_decref_doesnt_leak,         METH_NOARGS},
     {"test_structseq_newtype_doesnt_leak",
         test_structseq_newtype_doesnt_leak, METH_NOARGS},
+    {"test_structseq_newtype_null_descr_doc",
+        test_structseq_newtype_null_descr_doc, METH_NOARGS},
     {"test_incref_decref_API",  test_incref_decref_API,          METH_NOARGS},
     {"test_long_and_overflow",  test_long_and_overflow,          METH_NOARGS},
     {"test_long_as_double",     test_long_as_double,             METH_NOARGS},
@@ -5345,7 +5672,9 @@
     {"test_k_code",             test_k_code,                     METH_NOARGS},
     {"test_empty_argparse",     test_empty_argparse,             METH_NOARGS},
     {"parse_tuple_and_keywords", parse_tuple_and_keywords, METH_VARARGS},
-    {"test_null_strings",       test_null_strings,               METH_NOARGS},
+    {"pyobject_repr_from_null", pyobject_repr_from_null, METH_NOARGS},
+    {"pyobject_str_from_null",  pyobject_str_from_null, METH_NOARGS},
+    {"pyobject_bytes_from_null", pyobject_bytes_from_null, METH_NOARGS},
     {"test_string_from_format", (PyCFunction)test_string_from_format, METH_NOARGS},
     {"test_with_docstring",     test_with_docstring,             METH_NOARGS,
      PyDoc_STR("This is a pretty normal docstring.")},
@@ -5361,8 +5690,10 @@
     {"PyBuffer_SizeFromFormat",  test_PyBuffer_SizeFromFormat, METH_VARARGS},
     {"test_buildvalue_N",       test_buildvalue_N,               METH_NOARGS},
     {"test_buildvalue_issue38913", test_buildvalue_issue38913,   METH_NOARGS},
-    {"get_args", get_args, METH_VARARGS},
-    {"get_kwargs", (PyCFunction)(void(*)(void))get_kwargs, METH_VARARGS|METH_KEYWORDS},
+    {"get_args",                get_args,                        METH_VARARGS},
+    {"test_get_statictype_slots", test_get_statictype_slots,     METH_NOARGS},
+    {"get_kwargs", (PyCFunction)(void(*)(void))get_kwargs,
+      METH_VARARGS|METH_KEYWORDS},
     {"getargs_tuple",           getargs_tuple,                   METH_VARARGS},
     {"getargs_keywords", (PyCFunction)(void(*)(void))getargs_keywords,
       METH_VARARGS|METH_KEYWORDS},
@@ -5397,6 +5728,8 @@
     {"getargs_s",               getargs_s,                       METH_VARARGS},
     {"getargs_s_star",          getargs_s_star,                  METH_VARARGS},
     {"getargs_s_hash",          getargs_s_hash,                  METH_VARARGS},
+    {"getargs_s_hash_int",      (PyCFunction)(void(*)(void))getargs_s_hash_int,
+      METH_VARARGS|METH_KEYWORDS},
     {"getargs_z",               getargs_z,                       METH_VARARGS},
     {"getargs_z_star",          getargs_z_star,                  METH_VARARGS},
     {"getargs_z_hash",          getargs_z_hash,                  METH_VARARGS},
@@ -5417,8 +5750,10 @@
     {"codec_incrementaldecoder",
      (PyCFunction)codec_incrementaldecoder,                      METH_VARARGS},
     {"test_s_code",             test_s_code,                     METH_NOARGS},
+#if USE_UNICODE_WCHAR_CACHE
     {"test_u_code",             test_u_code,                     METH_NOARGS},
     {"test_Z_code",             test_Z_code,                     METH_NOARGS},
+#endif /* USE_UNICODE_WCHAR_CACHE */
     {"test_widechar",           test_widechar,                   METH_NOARGS},
     {"unicode_aswidechar",      unicode_aswidechar,              METH_VARARGS},
     {"unicode_aswidecharstring",unicode_aswidecharstring,        METH_VARARGS},
@@ -5427,9 +5762,11 @@
     {"unicode_asutf8andsize",   unicode_asutf8andsize,           METH_VARARGS},
     {"unicode_findchar",        unicode_findchar,                METH_VARARGS},
     {"unicode_copycharacters",  unicode_copycharacters,          METH_VARARGS},
+#if USE_UNICODE_WCHAR_CACHE
     {"unicode_encodedecimal",   unicode_encodedecimal,           METH_VARARGS},
     {"unicode_transformdecimaltoascii", unicode_transformdecimaltoascii, METH_VARARGS},
     {"unicode_legacy_string",   unicode_legacy_string,           METH_VARARGS},
+#endif /* USE_UNICODE_WCHAR_CACHE */
     {"_test_thread_state",      test_thread_state,               METH_VARARGS},
     {"_pending_threadfunc",     pending_threadfunc,              METH_VARARGS},
 #ifdef HAVE_GETTIMEOFDAY
@@ -5499,10 +5836,10 @@
         pymarshal_read_last_object_from_file, METH_VARARGS},
     {"pymarshal_read_object_from_file",
         pymarshal_read_object_from_file, METH_VARARGS},
-    {"return_null_without_error",
-        return_null_without_error, METH_NOARGS},
-    {"return_result_with_error",
-        return_result_with_error, METH_NOARGS},
+    {"return_null_without_error", return_null_without_error, METH_NOARGS},
+    {"return_result_with_error", return_result_with_error, METH_NOARGS},
+    {"getitem_with_error", getitem_with_error, METH_VARARGS},
+    {"Py_CompileString",     pycompilestring, METH_O},
     {"PyTime_FromSeconds", test_pytime_fromseconds,  METH_VARARGS},
     {"PyTime_FromSecondsObject", test_pytime_fromsecondsobject,  METH_VARARGS},
     {"PyTime_AsSecondsDouble", test_pytime_assecondsdouble, METH_VARARGS},
@@ -5555,6 +5892,13 @@
     {"meth_fastcall_keywords", (PyCFunction)(void(*)(void))meth_fastcall_keywords, METH_FASTCALL|METH_KEYWORDS},
     {"pynumber_tobase", pynumber_tobase, METH_VARARGS},
     {"without_gc", without_gc, METH_O},
+    {"test_set_type_size", test_set_type_size, METH_NOARGS},
+    {"test_refcount_macros", test_refcount_macros, METH_NOARGS},
+    {"test_refcount_funcs", test_refcount_funcs, METH_NOARGS},
+    {"test_py_is_macros", test_py_is_macros, METH_NOARGS},
+    {"test_py_is_funcs", test_py_is_funcs, METH_NOARGS},
+    {"fatal_error", test_fatal_error, METH_VARARGS,
+     PyDoc_STR("fatal_error(message, release_gil=False): call Py_FatalError(message)")},
     {NULL, NULL} /* sentinel */
 };
 
@@ -5657,7 +6001,7 @@
 static void
 test_structmembers_free(PyObject *ob)
 {
-    PyObject_FREE(ob);
+    PyObject_Free(ob);
 }
 
 static PyTypeObject test_structmembersType = {
@@ -5872,7 +6216,8 @@
 static PyAsyncMethods awaitType_as_async = {
     (unaryfunc)awaitObject_await,           /* am_await */
     0,                                      /* am_aiter */
-    0                                       /* am_anext */
+    0,                                      /* am_anext */
+    0,                                      /* am_send  */
 };
 
 
@@ -6215,6 +6560,47 @@
     .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_VECTORCALL,
 };
 
+PyDoc_STRVAR(heapdocctype__doc__,
+"HeapDocCType(arg1, arg2)\n"
+"--\n"
+"\n"
+"somedoc");
+
+typedef struct {
+    PyObject_HEAD
+} HeapDocCTypeObject;
+
+static PyType_Slot HeapDocCType_slots[] = {
+    {Py_tp_doc, (char*)heapdocctype__doc__},
+    {0},
+};
+
+static PyType_Spec HeapDocCType_spec = {
+    "_testcapi.HeapDocCType",
+    sizeof(HeapDocCTypeObject),
+    0,
+    Py_TPFLAGS_DEFAULT,
+    HeapDocCType_slots
+};
+
+typedef struct {
+    PyObject_HEAD
+} NullTpDocTypeObject;
+
+static PyType_Slot NullTpDocType_slots[] = {
+    {Py_tp_doc, NULL},
+    {0, 0},
+};
+
+static PyType_Spec NullTpDocType_spec = {
+    "_testcapi.NullTpDocType",
+    sizeof(NullTpDocTypeObject),
+    0,
+    Py_TPFLAGS_DEFAULT,
+    NullTpDocType_slots
+};
+
+
 PyDoc_STRVAR(heapgctype__doc__,
 "A heap type with GC, and with overridden dealloc.\n\n"
 "The 'value' attribute is set to 10 in __init__.");
@@ -6236,6 +6622,13 @@
     return 0;
 }
 
+static int
+heapgcctype_traverse(HeapCTypeObject *self, visitproc visit, void *arg)
+{
+    Py_VISIT(Py_TYPE(self));
+    return 0;
+}
+
 static void
 heapgcctype_dealloc(HeapCTypeObject *self)
 {
@@ -6249,6 +6642,7 @@
     {Py_tp_init, heapctype_init},
     {Py_tp_members, heapctype_members},
     {Py_tp_dealloc, heapgcctype_dealloc},
+    {Py_tp_traverse, heapgcctype_traverse},
     {Py_tp_doc, (char*)heapgctype__doc__},
     {0, 0},
 };
@@ -6269,7 +6663,7 @@
 heapctype_dealloc(HeapCTypeObject *self)
 {
     PyTypeObject *tp = Py_TYPE(self);
-    PyObject_Del(self);
+    PyObject_Free(self);
     Py_DECREF(tp);
 }
 
@@ -6459,7 +6853,7 @@
 
     PyTypeObject *tp = Py_TYPE(self);
     Py_XDECREF(self->dict);
-    PyObject_DEL(self);
+    PyObject_Free(self);
     Py_DECREF(tp);
 }
 
@@ -6530,7 +6924,7 @@
     if (self->weakreflist != NULL)
         PyObject_ClearWeakRefs((PyObject *) self);
     Py_XDECREF(self->weakreflist);
-    PyObject_DEL(self);
+    PyObject_Free(self);
     Py_DECREF(tp);
 }
 
@@ -6573,7 +6967,7 @@
 heapctypesetattr_dealloc(HeapCTypeSetattrObject *self)
 {
     PyTypeObject *tp = Py_TYPE(self);
-    PyObject_Del(self);
+    PyObject_Free(self);
     Py_DECREF(tp);
 }
 
@@ -6883,6 +7277,20 @@
     Py_INCREF(TestError);
     PyModule_AddObject(m, "error", TestError);
 
+    PyObject *HeapDocCType = PyType_FromSpec(&HeapDocCType_spec);
+    if (HeapDocCType == NULL) {
+        return NULL;
+    }
+    PyModule_AddObject(m, "HeapDocCType", HeapDocCType);
+
+    /* bpo-41832: Add a new type to test PyType_FromSpec()
+       now can accept a NULL tp_doc slot. */
+    PyObject *NullTpDocType = PyType_FromSpec(&NullTpDocType_spec);
+    if (NullTpDocType == NULL) {
+        return NULL;
+    }
+    PyModule_AddObject(m, "NullTpDocType", NullTpDocType);
+
     PyObject *HeapGcCType = PyType_FromSpec(&HeapGcCType_spec);
     if (HeapGcCType == NULL) {
         return NULL;
@@ -6970,29 +7378,52 @@
     PyObject *res;
     const char str[] = "string";
     const Py_UNICODE unicode[] = L"unicode";
-    PyErr_SetNone(PyExc_ZeroDivisionError);
+    assert(!PyErr_Occurred());
 
     res = Py_BuildValue("(s#O)", str, 1, Py_None);
     assert(res == NULL);
-    if (!PyErr_ExceptionMatches(PyExc_ZeroDivisionError)) {
+    if (!PyErr_ExceptionMatches(PyExc_SystemError)) {
         return NULL;
     }
+    PyErr_Clear();
+
     res = Py_BuildValue("(z#O)", str, 1, Py_None);
     assert(res == NULL);
-    if (!PyErr_ExceptionMatches(PyExc_ZeroDivisionError)) {
+    if (!PyErr_ExceptionMatches(PyExc_SystemError)) {
         return NULL;
     }
+    PyErr_Clear();
+
     res = Py_BuildValue("(y#O)", str, 1, Py_None);
     assert(res == NULL);
-    if (!PyErr_ExceptionMatches(PyExc_ZeroDivisionError)) {
+    if (!PyErr_ExceptionMatches(PyExc_SystemError)) {
         return NULL;
     }
+    PyErr_Clear();
+
     res = Py_BuildValue("(u#O)", unicode, 1, Py_None);
     assert(res == NULL);
-    if (!PyErr_ExceptionMatches(PyExc_ZeroDivisionError)) {
+    if (!PyErr_ExceptionMatches(PyExc_SystemError)) {
         return NULL;
     }
-
     PyErr_Clear();
+
+
+    Py_RETURN_NONE;
+}
+
+#undef PyArg_ParseTupleAndKeywords
+PyAPI_FUNC(int) PyArg_ParseTupleAndKeywords(PyObject *, PyObject *,
+                                            const char *, char **, ...);
+
+static PyObject *
+getargs_s_hash_int(PyObject *self, PyObject *args, PyObject *kwargs)
+{
+    static char *keywords[] = {"", "x", NULL};
+    const char *s;
+    int len;
+    int i = 0;
+    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|s#i", keywords, &s, &len, &i))
+        return NULL;
     Py_RETURN_NONE;
 }
diff --git a/Modules/_testinternalcapi.c b/Modules/_testinternalcapi.c
index 4445d2e..d5616fd 100644
--- a/Modules/_testinternalcapi.c
+++ b/Modules/_testinternalcapi.c
@@ -12,59 +12,19 @@
 #define PY_SSIZE_T_CLEAN
 
 #include "Python.h"
-#include "pycore_byteswap.h"     // _Py_bswap32()
-#include "pycore_initconfig.h"   // _Py_GetConfigsAsDict()
-#include "pycore_hashtable.h"    // _Py_hashtable_new()
+#include "pycore_atomic_funcs.h" // _Py_atomic_int_get()
+#include "pycore_bitutils.h"     // _Py_bswap32()
 #include "pycore_gc.h"           // PyGC_Head
-
-
-#ifdef MS_WINDOWS
-#include <windows.h>
-
-static int
-_add_windows_config(PyObject *configs)
-{
-    HMODULE hPython3;
-    wchar_t py3path[MAX_PATH];
-    PyObject *dict = PyDict_New();
-    PyObject *obj = NULL;
-    if (!dict) {
-        return -1;
-    }
-
-    hPython3 = GetModuleHandleW(PY3_DLLNAME);
-    if (hPython3 && GetModuleFileNameW(hPython3, py3path, MAX_PATH)) {
-        obj = PyUnicode_FromWideChar(py3path, -1);
-    } else {
-        obj = Py_None;
-        Py_INCREF(obj);
-    }
-    if (obj &&
-        !PyDict_SetItemString(dict, "python3_dll", obj) &&
-        !PyDict_SetItemString(configs, "windows", dict)) {
-        Py_DECREF(obj);
-        Py_DECREF(dict);
-        return 0;
-    }
-    Py_DECREF(obj);
-    Py_DECREF(dict);
-    return -1;
-}
-#endif
+#include "pycore_hashtable.h"    // _Py_hashtable_new()
+#include "pycore_initconfig.h"   // _Py_GetConfigsAsDict()
+#include "pycore_interp.h"       // _PyInterpreterState_GetConfigCopy()
+#include "pycore_pyerrors.h"      // _Py_UTF8_Edit_Cost()
 
 
 static PyObject *
 get_configs(PyObject *self, PyObject *Py_UNUSED(args))
 {
-    PyObject *dict = _Py_GetConfigsAsDict();
-#ifdef MS_WINDOWS
-    if (dict) {
-        if (_add_windows_config(dict) < 0) {
-            Py_CLEAR(dict);
-        }
-    }
-#endif
-    return dict;
+    return _Py_GetConfigsAsDict();
 }
 
 
@@ -106,6 +66,84 @@
 }
 
 
+static int
+check_popcount(uint32_t x, int expected)
+{
+    // Use volatile to prevent the compiler to optimize out the whole test
+    volatile uint32_t u = x;
+    int bits = _Py_popcount32(u);
+    if (bits != expected) {
+        PyErr_Format(PyExc_AssertionError,
+                     "_Py_popcount32(%lu) returns %i, expected %i",
+                     (unsigned long)x, bits, expected);
+        return -1;
+    }
+    return 0;
+}
+
+
+static PyObject*
+test_popcount(PyObject *self, PyObject *Py_UNUSED(args))
+{
+#define CHECK(X, RESULT) \
+    do { \
+        if (check_popcount(X, RESULT) < 0) { \
+            return NULL; \
+        } \
+    } while (0)
+
+    CHECK(0, 0);
+    CHECK(1, 1);
+    CHECK(0x08080808, 4);
+    CHECK(0x10101010, 4);
+    CHECK(0x10204080, 4);
+    CHECK(0xDEADCAFE, 22);
+    CHECK(0xFFFFFFFF, 32);
+    Py_RETURN_NONE;
+
+#undef CHECK
+}
+
+
+static int
+check_bit_length(unsigned long x, int expected)
+{
+    // Use volatile to prevent the compiler to optimize out the whole test
+    volatile unsigned long u = x;
+    int len = _Py_bit_length(u);
+    if (len != expected) {
+        PyErr_Format(PyExc_AssertionError,
+                     "_Py_bit_length(%lu) returns %i, expected %i",
+                     x, len, expected);
+        return -1;
+    }
+    return 0;
+}
+
+
+static PyObject*
+test_bit_length(PyObject *self, PyObject *Py_UNUSED(args))
+{
+#define CHECK(X, RESULT) \
+    do { \
+        if (check_bit_length(X, RESULT) < 0) { \
+            return NULL; \
+        } \
+    } while (0)
+
+    CHECK(0, 0);
+    CHECK(1, 1);
+    CHECK(0x1000, 13);
+    CHECK(0x1234, 13);
+    CHECK(0x54321, 19);
+    CHECK(0x7FFFFFFF, 31);
+    CHECK(0xFFFFFFFF, 32);
+    Py_RETURN_NONE;
+
+#undef CHECK
+}
+
+
 #define TO_PTR(ch) ((void*)(uintptr_t)ch)
 #define FROM_PTR(ptr) ((uintptr_t)ptr)
 #define VALUE(key) (1 + ((int)(key) - 'a'))
@@ -196,11 +234,148 @@
 }
 
 
+static PyObject *
+test_get_config(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(args))
+{
+    PyConfig config;
+    PyConfig_InitIsolatedConfig(&config);
+    if (_PyInterpreterState_GetConfigCopy(&config) < 0) {
+        PyConfig_Clear(&config);
+        return NULL;
+    }
+    PyObject *dict = _PyConfig_AsDict(&config);
+    PyConfig_Clear(&config);
+    return dict;
+}
+
+
+static PyObject *
+test_set_config(PyObject *Py_UNUSED(self), PyObject *dict)
+{
+    PyConfig config;
+    PyConfig_InitIsolatedConfig(&config);
+    if (_PyConfig_FromDict(&config, dict) < 0) {
+        goto error;
+    }
+    if (_PyInterpreterState_SetConfig(&config) < 0) {
+        goto error;
+    }
+    PyConfig_Clear(&config);
+    Py_RETURN_NONE;
+
+error:
+    PyConfig_Clear(&config);
+    return NULL;
+}
+
+
+static PyObject*
+test_atomic_funcs(PyObject *self, PyObject *Py_UNUSED(args))
+{
+    // Test _Py_atomic_size_get() and _Py_atomic_size_set()
+    Py_ssize_t var = 1;
+    _Py_atomic_size_set(&var, 2);
+    assert(_Py_atomic_size_get(&var) == 2);
+    Py_RETURN_NONE;
+}
+
+
+static int
+check_edit_cost(const char *a, const char *b, Py_ssize_t expected)
+{
+    int ret = -1;
+    PyObject *a_obj = NULL;
+    PyObject *b_obj = NULL;
+
+    a_obj = PyUnicode_FromString(a);
+    if (a_obj == NULL) {
+        goto exit;
+    }
+    b_obj = PyUnicode_FromString(b);
+    if (a_obj == NULL) {
+        goto exit;
+    }
+    Py_ssize_t result = _Py_UTF8_Edit_Cost(a_obj, b_obj, -1);
+    if (result != expected) {
+        PyErr_Format(PyExc_AssertionError,
+                     "Edit cost from '%s' to '%s' returns %zd, expected %zd",
+                     a, b, result, expected);
+        goto exit;
+    }
+    // Check that smaller max_edits thresholds are exceeded.
+    Py_ssize_t max_edits = result;
+    while (max_edits > 0) {
+        max_edits /= 2;
+        Py_ssize_t result2 = _Py_UTF8_Edit_Cost(a_obj, b_obj, max_edits);
+        if (result2 <= max_edits) {
+            PyErr_Format(PyExc_AssertionError,
+                         "Edit cost from '%s' to '%s' (threshold %zd) "
+                         "returns %zd, expected greater than %zd",
+                         a, b, max_edits, result2, max_edits);
+            goto exit;
+        }
+    }
+    // Check that bigger max_edits thresholds don't change anything
+    Py_ssize_t result3 = _Py_UTF8_Edit_Cost(a_obj, b_obj, result * 2 + 1);
+    if (result3 != result) {
+        PyErr_Format(PyExc_AssertionError,
+                     "Edit cost from '%s' to '%s' (threshold %zd) "
+                     "returns %zd, expected %zd",
+                     a, b, result * 2, result3, result);
+        goto exit;
+    }
+    ret = 0;
+exit:
+    Py_XDECREF(a_obj);
+    Py_XDECREF(b_obj);
+    return ret;
+}
+
+static PyObject *
+test_edit_cost(PyObject *self, PyObject *Py_UNUSED(args))
+{
+    #define CHECK(a, b, n) do {              \
+        if (check_edit_cost(a, b, n) < 0) {  \
+            return NULL;                     \
+        }                                    \
+    } while (0)                              \
+
+    CHECK("", "", 0);
+    CHECK("", "a", 2);
+    CHECK("a", "A", 1);
+    CHECK("Apple", "Aple", 2);
+    CHECK("Banana", "B@n@n@", 6);
+    CHECK("Cherry", "Cherry!", 2);
+    CHECK("---0---", "------", 2);
+    CHECK("abc", "y", 6);
+    CHECK("aa", "bb", 4);
+    CHECK("aaaaa", "AAAAA", 5);
+    CHECK("wxyz", "wXyZ", 2);
+    CHECK("wxyz", "wXyZ123", 8);
+    CHECK("Python", "Java", 12);
+    CHECK("Java", "C#", 8);
+    CHECK("AbstractFoobarManager", "abstract_foobar_manager", 3+2*2);
+    CHECK("CPython", "PyPy", 10);
+    CHECK("CPython", "pypy", 11);
+    CHECK("AttributeError", "AttributeErrop", 2);
+    CHECK("AttributeError", "AttributeErrorTests", 10);
+
+    #undef CHECK
+    Py_RETURN_NONE;
+}
+
+
 static PyMethodDef TestMethods[] = {
     {"get_configs", get_configs, METH_NOARGS},
     {"get_recursion_depth", get_recursion_depth, METH_NOARGS},
     {"test_bswap", test_bswap, METH_NOARGS},
+    {"test_popcount", test_popcount, METH_NOARGS},
+    {"test_bit_length", test_bit_length, METH_NOARGS},
     {"test_hashtable", test_hashtable, METH_NOARGS},
+    {"get_config", test_get_config, METH_NOARGS},
+    {"set_config", test_set_config, METH_O},
+    {"test_atomic_funcs", test_atomic_funcs, METH_NOARGS},
+    {"test_edit_cost", test_edit_cost, METH_NOARGS},
     {NULL, NULL} /* sentinel */
 };
 
diff --git a/Modules/_testmultiphase.c b/Modules/_testmultiphase.c
index d69ae62..58282ce 100644
--- a/Modules/_testmultiphase.c
+++ b/Modules/_testmultiphase.c
@@ -121,29 +121,55 @@
 };
 
 
+static PyModuleDef def_meth_state_access;
+static PyModuleDef def_nonmodule;
+static PyModuleDef def_nonmodule_with_methods;
+
 /*[clinic input]
 _testmultiphase.StateAccessType.get_defining_module
 
     cls: defining_class
 
 Return the module of the defining class.
+
+Also tests that result of _PyType_GetModuleByDef matches defining_class's
+module.
 [clinic start generated code]*/
 
 static PyObject *
 _testmultiphase_StateAccessType_get_defining_module_impl(StateAccessTypeObject *self,
                                                          PyTypeObject *cls)
-/*[clinic end generated code: output=ba2a14284a5d0921 input=946149f91cf72c0d]*/
+/*[clinic end generated code: output=ba2a14284a5d0921 input=356f999fc16e0933]*/
 {
     PyObject *retval;
     retval = PyType_GetModule(cls);
     if (retval == NULL) {
         return NULL;
     }
+    assert(_PyType_GetModuleByDef(Py_TYPE(self), &def_meth_state_access) == retval);
     Py_INCREF(retval);
     return retval;
 }
 
 /*[clinic input]
+_testmultiphase.StateAccessType.getmodulebydef_bad_def
+
+    cls: defining_class
+
+Test that result of _PyType_GetModuleByDef with a bad def is NULL.
+[clinic start generated code]*/
+
+static PyObject *
+_testmultiphase_StateAccessType_getmodulebydef_bad_def_impl(StateAccessTypeObject *self,
+                                                            PyTypeObject *cls)
+/*[clinic end generated code: output=64509074dfcdbd31 input=906047715ee293cd]*/
+{
+    _PyType_GetModuleByDef(Py_TYPE(self), &def_nonmodule);  // should raise
+    assert(PyErr_Occurred());
+    return NULL;
+}
+
+/*[clinic input]
 _testmultiphase.StateAccessType.increment_count_clinic
 
     cls: defining_class
@@ -239,6 +265,7 @@
 
 static PyMethodDef StateAccessType_methods[] = {
     _TESTMULTIPHASE_STATEACCESSTYPE_GET_DEFINING_MODULE_METHODDEF
+    _TESTMULTIPHASE_STATEACCESSTYPE_GETMODULEBYDEF_BAD_DEF_METHODDEF
     _TESTMULTIPHASE_STATEACCESSTYPE_GET_COUNT_METHODDEF
     _TESTMULTIPHASE_STATEACCESSTYPE_INCREMENT_COUNT_CLINIC_METHODDEF
     {
@@ -359,6 +386,7 @@
         goto fail;
     }
     if (PyModule_AddObject(m, "Example", temp) != 0) {
+        Py_DECREF(temp);
         goto fail;
     }
 
@@ -369,6 +397,7 @@
         goto fail;
     }
     if (PyModule_AddObject(m, "error", temp) != 0) {
+        Py_DECREF(temp);
         goto fail;
     }
 
@@ -378,6 +407,7 @@
         goto fail;
     }
     if (PyModule_AddObject(m, "Str", temp) != 0) {
+        Py_DECREF(temp);
         goto fail;
     }
 
@@ -424,9 +454,6 @@
 
 /**** Importing a non-module object ****/
 
-static PyModuleDef def_nonmodule;
-static PyModuleDef def_nonmodule_with_methods;
-
 /* Create a SimpleNamespace(three=3) */
 static PyObject*
 createfunc_nonmodule(PyObject *spec, PyModuleDef *def)
@@ -807,6 +834,7 @@
         return -1;
     }
     if (PyModule_AddObject(m, "StateAccessType", temp) != 0) {
+        Py_DECREF(temp);
         return -1;
     }
 
@@ -834,6 +862,28 @@
     return PyModuleDef_Init(&def_meth_state_access);
 }
 
+static PyModuleDef def_module_state_shared = {
+    PyModuleDef_HEAD_INIT,
+    .m_name = "_test_module_state_shared",
+    .m_doc = PyDoc_STR("Regression Test module for single-phase init."),
+    .m_size = -1,
+};
+
+PyMODINIT_FUNC
+PyInit__test_module_state_shared(PyObject *spec)
+{
+    PyObject *module = PyModule_Create(&def_module_state_shared);
+    if (module == NULL) {
+        return NULL;
+    }
+
+    if (PyModule_AddObjectRef(module, "Error", PyExc_Exception) < 0) {
+        Py_DECREF(module);
+        return NULL;
+    }
+    return module;
+}
+
 
 /*** Helper for imp test ***/
 
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c
index 77baba4..813d7ec 100644
--- a/Modules/_threadmodule.c
+++ b/Modules/_threadmodule.c
@@ -3,17 +3,45 @@
 /* Interface to Sjoerd's portable C thread library */
 
 #include "Python.h"
-#include "pycore_pylifecycle.h"
 #include "pycore_interp.h"        // _PyInterpreterState.num_threads
+#include "pycore_moduleobject.h"  // _PyModule_GetState()
+#include "pycore_pylifecycle.h"
 #include "pycore_pystate.h"       // _PyThreadState_Init()
 #include <stddef.h>               // offsetof()
+#include "structmember.h"         // PyMemberDef
 
-static PyObject *ThreadError;
-static PyObject *str_dict;
+#ifdef HAVE_SIGNAL_H
+#  include <signal.h>             // SIGINT
+#endif
+
+// ThreadError is just an alias to PyExc_RuntimeError
+#define ThreadError PyExc_RuntimeError
+
+_Py_IDENTIFIER(__dict__);
 
 _Py_IDENTIFIER(stderr);
 _Py_IDENTIFIER(flush);
 
+
+// Forward declarations
+static struct PyModuleDef thread_module;
+
+
+typedef struct {
+    PyTypeObject *lock_type;
+    PyTypeObject *local_type;
+    PyTypeObject *local_dummy_type;
+} thread_module_state;
+
+static inline thread_module_state*
+get_thread_state(PyObject *module)
+{
+    void *state = _PyModule_GetState(module);
+    assert(state != NULL);
+    return (thread_module_state *)state;
+}
+
+
 /* Lock objects */
 
 typedef struct {
@@ -23,18 +51,28 @@
     char locked; /* for sanity checking */
 } lockobject;
 
+static int
+lock_traverse(lockobject *self, visitproc visit, void *arg)
+{
+    Py_VISIT(Py_TYPE(self));
+    return 0;
+}
+
 static void
 lock_dealloc(lockobject *self)
 {
-    if (self->in_weakreflist != NULL)
+    if (self->in_weakreflist != NULL) {
         PyObject_ClearWeakRefs((PyObject *) self);
+    }
     if (self->lock_lock != NULL) {
         /* Unlock the lock so it's safe to free it */
         if (self->locked)
             PyThread_release_lock(self->lock_lock);
         PyThread_free_lock(self->lock_lock);
     }
-    PyObject_Del(self);
+    PyTypeObject *tp = Py_TYPE(self);
+    tp->tp_free((PyObject*)self);
+    Py_DECREF(tp);
 }
 
 /* Helper to acquire an interruptible lock with a timeout.  If the lock acquire
@@ -48,12 +86,13 @@
 {
     PyLockStatus r;
     _PyTime_t endtime = 0;
-    _PyTime_t microseconds;
 
-    if (timeout > 0)
+    if (timeout > 0) {
         endtime = _PyTime_GetMonotonicClock() + timeout;
+    }
 
     do {
+        _PyTime_t microseconds;
         microseconds = _PyTime_AsMicroseconds(timeout, _PyTime_ROUND_CEILING);
 
         /* first a simple non-blocking try without releasing the GIL */
@@ -138,12 +177,10 @@
 lock_PyThread_acquire_lock(lockobject *self, PyObject *args, PyObject *kwds)
 {
     _PyTime_t timeout;
-    PyLockStatus r;
-
     if (lock_acquire_parse_args(args, kwds, &timeout) < 0)
         return NULL;
 
-    r = acquire_timed(self->lock_lock, timeout);
+    PyLockStatus r = acquire_timed(self->lock_lock, timeout);
     if (r == PY_LOCK_INTR) {
         return NULL;
     }
@@ -245,36 +282,39 @@
     {NULL,           NULL}              /* sentinel */
 };
 
-static PyTypeObject Locktype = {
-    PyVarObject_HEAD_INIT(&PyType_Type, 0)
-    "_thread.lock",                     /*tp_name*/
-    sizeof(lockobject),                 /*tp_basicsize*/
-    0,                                  /*tp_itemsize*/
-    /* methods */
-    (destructor)lock_dealloc,           /*tp_dealloc*/
-    0,                                  /*tp_vectorcall_offset*/
-    0,                                  /*tp_getattr*/
-    0,                                  /*tp_setattr*/
-    0,                                  /*tp_as_async*/
-    (reprfunc)lock_repr,                /*tp_repr*/
-    0,                                  /*tp_as_number*/
-    0,                                  /*tp_as_sequence*/
-    0,                                  /*tp_as_mapping*/
-    0,                                  /*tp_hash*/
-    0,                                  /*tp_call*/
-    0,                                  /*tp_str*/
-    0,                                  /*tp_getattro*/
-    0,                                  /*tp_setattro*/
-    0,                                  /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT,                 /*tp_flags*/
-    0,                                  /*tp_doc*/
-    0,                                  /*tp_traverse*/
-    0,                                  /*tp_clear*/
-    0,                                  /*tp_richcompare*/
-    offsetof(lockobject, in_weakreflist), /*tp_weaklistoffset*/
-    0,                                  /*tp_iter*/
-    0,                                  /*tp_iternext*/
-    lock_methods,                       /*tp_methods*/
+PyDoc_STRVAR(lock_doc,
+"A lock object is a synchronization primitive.  To create a lock,\n\
+call threading.Lock().  Methods are:\n\
+\n\
+acquire() -- lock the lock, possibly blocking until it can be obtained\n\
+release() -- unlock of the lock\n\
+locked() -- test whether the lock is currently locked\n\
+\n\
+A lock is not owned by the thread that locked it; another thread may\n\
+unlock it.  A thread attempting to lock a lock that it has already locked\n\
+will block until another thread unlocks it.  Deadlocks may ensue.");
+
+static PyMemberDef lock_type_members[] = {
+    {"__weaklistoffset__", T_PYSSIZET, offsetof(lockobject, in_weakreflist), READONLY},
+    {NULL},
+};
+
+static PyType_Slot lock_type_slots[] = {
+    {Py_tp_dealloc, (destructor)lock_dealloc},
+    {Py_tp_repr, (reprfunc)lock_repr},
+    {Py_tp_doc, (void *)lock_doc},
+    {Py_tp_methods, lock_methods},
+    {Py_tp_traverse, lock_traverse},
+    {Py_tp_members, lock_type_members},
+    {0, 0}
+};
+
+static PyType_Spec lock_type_spec = {
+    .name = "_thread.lock",
+    .basicsize = sizeof(lockobject),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
+              Py_TPFLAGS_DISALLOW_INSTANTIATION | Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = lock_type_slots,
 };
 
 /* Recursive lock objects */
@@ -287,6 +327,14 @@
     PyObject *in_weakreflist;
 } rlockobject;
 
+static int
+rlock_traverse(rlockobject *self, visitproc visit, void *arg)
+{
+    Py_VISIT(Py_TYPE(self));
+    return 0;
+}
+
+
 static void
 rlock_dealloc(rlockobject *self)
 {
@@ -301,7 +349,9 @@
 
         PyThread_free_lock(self->rlock_lock);
     }
-    Py_TYPE(self)->tp_free(self);
+    PyTypeObject *tp = Py_TYPE(self);
+    tp->tp_free(self);
+    Py_DECREF(tp);
 }
 
 static PyObject *
@@ -525,58 +575,45 @@
 };
 
 
-static PyTypeObject RLocktype = {
-    PyVarObject_HEAD_INIT(&PyType_Type, 0)
-    "_thread.RLock",                    /*tp_name*/
-    sizeof(rlockobject),                /*tp_basicsize*/
-    0,                                  /*tp_itemsize*/
-    /* methods */
-    (destructor)rlock_dealloc,          /*tp_dealloc*/
-    0,                                  /*tp_vectorcall_offset*/
-    0,                                  /*tp_getattr*/
-    0,                                  /*tp_setattr*/
-    0,                                  /*tp_as_async*/
-    (reprfunc)rlock_repr,               /*tp_repr*/
-    0,                                  /*tp_as_number*/
-    0,                                  /*tp_as_sequence*/
-    0,                                  /*tp_as_mapping*/
-    0,                                  /*tp_hash*/
-    0,                                  /*tp_call*/
-    0,                                  /*tp_str*/
-    0,                                  /*tp_getattro*/
-    0,                                  /*tp_setattro*/
-    0,                                  /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
-    0,                                  /*tp_doc*/
-    0,                                  /*tp_traverse*/
-    0,                                  /*tp_clear*/
-    0,                                  /*tp_richcompare*/
-    offsetof(rlockobject, in_weakreflist), /*tp_weaklistoffset*/
-    0,                                  /*tp_iter*/
-    0,                                  /*tp_iternext*/
-    rlock_methods,                      /*tp_methods*/
-    0,                                  /* tp_members */
-    0,                                  /* tp_getset */
-    0,                                  /* tp_base */
-    0,                                  /* tp_dict */
-    0,                                  /* tp_descr_get */
-    0,                                  /* tp_descr_set */
-    0,                                  /* tp_dictoffset */
-    0,                                  /* tp_init */
-    PyType_GenericAlloc,                /* tp_alloc */
-    rlock_new                           /* tp_new */
+static PyMemberDef rlock_type_members[] = {
+    {"__weaklistoffset__", T_PYSSIZET, offsetof(rlockobject, in_weakreflist), READONLY},
+    {NULL},
+};
+
+static PyType_Slot rlock_type_slots[] = {
+    {Py_tp_dealloc, (destructor)rlock_dealloc},
+    {Py_tp_repr, (reprfunc)rlock_repr},
+    {Py_tp_methods, rlock_methods},
+    {Py_tp_alloc, PyType_GenericAlloc},
+    {Py_tp_new, rlock_new},
+    {Py_tp_members, rlock_type_members},
+    {Py_tp_traverse, rlock_traverse},
+    {0, 0},
+};
+
+static PyType_Spec rlock_type_spec = {
+    .name = "_thread.RLock",
+    .basicsize = sizeof(rlockobject),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
+              Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = rlock_type_slots,
 };
 
 static lockobject *
-newlockobject(void)
+newlockobject(PyObject *module)
 {
-    lockobject *self;
-    self = PyObject_New(lockobject, &Locktype);
-    if (self == NULL)
+    thread_module_state *state = get_thread_state(module);
+
+    PyTypeObject *type = state->lock_type;
+    lockobject *self = (lockobject *)type->tp_alloc(type, 0);
+    if (self == NULL) {
         return NULL;
+    }
+
     self->lock_lock = PyThread_allocate_lock();
     self->locked = 0;
     self->in_weakreflist = NULL;
+
     if (self->lock_lock == NULL) {
         Py_DECREF(self);
         PyErr_SetString(ThreadError, "can't allocate lock");
@@ -637,35 +674,29 @@
 {
     if (self->weakreflist != NULL)
         PyObject_ClearWeakRefs((PyObject *) self);
-    Py_TYPE(self)->tp_free((PyObject*)self);
+    PyTypeObject *tp = Py_TYPE(self);
+    tp->tp_free((PyObject*)self);
+    Py_DECREF(tp);
 }
 
-static PyTypeObject localdummytype = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    /* tp_name           */ "_thread._localdummy",
-    /* tp_basicsize      */ sizeof(localdummyobject),
-    /* tp_itemsize       */ 0,
-    /* tp_dealloc        */ (destructor)localdummy_dealloc,
-    /* tp_vectorcall_offset */ 0,
-    /* tp_getattr        */ 0,
-    /* tp_setattr        */ 0,
-    /* tp_as_async       */ 0,
-    /* tp_repr           */ 0,
-    /* tp_as_number      */ 0,
-    /* tp_as_sequence    */ 0,
-    /* tp_as_mapping     */ 0,
-    /* tp_hash           */ 0,
-    /* tp_call           */ 0,
-    /* tp_str            */ 0,
-    /* tp_getattro       */ 0,
-    /* tp_setattro       */ 0,
-    /* tp_as_buffer      */ 0,
-    /* tp_flags          */ Py_TPFLAGS_DEFAULT,
-    /* tp_doc            */ "Thread-local dummy",
-    /* tp_traverse       */ 0,
-    /* tp_clear          */ 0,
-    /* tp_richcompare    */ 0,
-    /* tp_weaklistoffset */ offsetof(localdummyobject, weakreflist)
+static PyMemberDef local_dummy_type_members[] = {
+    {"__weaklistoffset__", T_PYSSIZET, offsetof(localdummyobject, weakreflist), READONLY},
+    {NULL},
+};
+
+static PyType_Slot local_dummy_type_slots[] = {
+    {Py_tp_dealloc, (destructor)localdummy_dealloc},
+    {Py_tp_doc, "Thread-local dummy"},
+    {Py_tp_members, local_dummy_type_members},
+    {0, 0}
+};
+
+static PyType_Spec local_dummy_type_spec = {
+    .name = "_thread._localdummy",
+    .basicsize = sizeof(localdummyobject),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION |
+              Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = local_dummy_type_slots,
 };
 
 
@@ -682,19 +713,19 @@
 } localobject;
 
 /* Forward declaration */
-static PyObject *_ldict(localobject *self);
+static PyObject *_ldict(localobject *self, thread_module_state *state);
 static PyObject *_localdummy_destroyed(PyObject *meth_self, PyObject *dummyweakref);
 
 /* Create and register the dummy for the current thread.
    Returns a borrowed reference of the corresponding local dict */
 static PyObject *
-_local_create_dummy(localobject *self)
+_local_create_dummy(localobject *self, thread_module_state *state)
 {
-    PyObject *tdict, *ldict = NULL, *wr = NULL;
+    PyObject *ldict = NULL, *wr = NULL;
     localdummyobject *dummy = NULL;
-    int r;
+    PyTypeObject *type = state->local_dummy_type;
 
-    tdict = PyThreadState_GetDict();
+    PyObject *tdict = PyThreadState_GetDict();
     if (tdict == NULL) {
         PyErr_SetString(PyExc_SystemError,
                         "Couldn't get thread-state dictionary");
@@ -702,25 +733,30 @@
     }
 
     ldict = PyDict_New();
-    if (ldict == NULL)
+    if (ldict == NULL) {
         goto err;
-    dummy = (localdummyobject *) localdummytype.tp_alloc(&localdummytype, 0);
-    if (dummy == NULL)
+    }
+    dummy = (localdummyobject *) type->tp_alloc(type, 0);
+    if (dummy == NULL) {
         goto err;
+    }
     dummy->localdict = ldict;
     wr = PyWeakref_NewRef((PyObject *) dummy, self->wr_callback);
-    if (wr == NULL)
+    if (wr == NULL) {
         goto err;
+    }
 
     /* As a side-effect, this will cache the weakref's hash before the
        dummy gets deleted */
-    r = PyDict_SetItem(self->dummies, wr, ldict);
-    if (r < 0)
+    int r = PyDict_SetItem(self->dummies, wr, ldict);
+    if (r < 0) {
         goto err;
+    }
     Py_CLEAR(wr);
     r = PyDict_SetItem(tdict, self->key, (PyObject *) dummy);
-    if (r < 0)
+    if (r < 0) {
         goto err;
+    }
     Py_CLEAR(dummy);
 
     Py_DECREF(ldict);
@@ -736,8 +772,6 @@
 static PyObject *
 local_new(PyTypeObject *type, PyObject *args, PyObject *kw)
 {
-    localobject *self;
-    PyObject *wr;
     static PyMethodDef wr_callback_def = {
         "_localdummy_destroyed", (PyCFunction) _localdummy_destroyed, METH_O
     };
@@ -749,42 +783,48 @@
         if (rc == 0 && kw != NULL)
             rc = PyObject_IsTrue(kw);
         if (rc != 0) {
-            if (rc > 0)
+            if (rc > 0) {
                 PyErr_SetString(PyExc_TypeError,
                           "Initialization arguments are not supported");
+            }
             return NULL;
         }
     }
 
-    self = (localobject *)type->tp_alloc(type, 0);
-    if (self == NULL)
-        return NULL;
+    PyObject *module = _PyType_GetModuleByDef(type, &thread_module);
+    thread_module_state *state = get_thread_state(module);
 
-    Py_XINCREF(args);
-    self->args = args;
-    Py_XINCREF(kw);
-    self->kw = kw;
+    localobject *self = (localobject *)type->tp_alloc(type, 0);
+    if (self == NULL) {
+        return NULL;
+    }
+
+    self->args = Py_XNewRef(args);
+    self->kw = Py_XNewRef(kw);
     self->key = PyUnicode_FromFormat("thread.local.%p", self);
-    if (self->key == NULL)
+    if (self->key == NULL) {
         goto err;
+    }
 
     self->dummies = PyDict_New();
-    if (self->dummies == NULL)
+    if (self->dummies == NULL) {
         goto err;
+    }
 
     /* We use a weak reference to self in the callback closure
        in order to avoid spurious reference cycles */
-    wr = PyWeakref_NewRef((PyObject *) self, NULL);
-    if (wr == NULL)
+    PyObject *wr = PyWeakref_NewRef((PyObject *) self, NULL);
+    if (wr == NULL) {
         goto err;
+    }
     self->wr_callback = PyCFunction_NewEx(&wr_callback_def, wr, NULL);
     Py_DECREF(wr);
-    if (self->wr_callback == NULL)
+    if (self->wr_callback == NULL) {
         goto err;
-
-    if (_local_create_dummy(self) == NULL)
+    }
+    if (_local_create_dummy(self, state) == NULL) {
         goto err;
-
+    }
     return (PyObject *)self;
 
   err:
@@ -795,6 +835,7 @@
 static int
 local_traverse(localobject *self, visitproc visit, void *arg)
 {
+    Py_VISIT(Py_TYPE(self));
     Py_VISIT(self->args);
     Py_VISIT(self->kw);
     Py_VISIT(self->dummies);
@@ -804,23 +845,26 @@
 static int
 local_clear(localobject *self)
 {
-    PyThreadState *tstate;
     Py_CLEAR(self->args);
     Py_CLEAR(self->kw);
     Py_CLEAR(self->dummies);
     Py_CLEAR(self->wr_callback);
     /* Remove all strong references to dummies from the thread states */
-    if (self->key
-        && (tstate = PyThreadState_Get())
-        && tstate->interp) {
-        for(tstate = PyInterpreterState_ThreadHead(tstate->interp);
-            tstate;
-            tstate = PyThreadState_Next(tstate))
-            if (tstate->dict && PyDict_GetItem(tstate->dict, self->key)) {
-                if (PyDict_DelItem(tstate->dict, self->key)) {
-                    PyErr_Clear();
-                }
+    if (self->key) {
+        PyInterpreterState *interp = _PyInterpreterState_GET();
+        PyThreadState *tstate = PyInterpreterState_ThreadHead(interp);
+        for(; tstate; tstate = PyThreadState_Next(tstate)) {
+            if (tstate->dict == NULL) {
+                continue;
             }
+            PyObject *v = _PyDict_Pop(tstate->dict, self->key, Py_None);
+            if (v != NULL) {
+                Py_DECREF(v);
+            }
+            else {
+                PyErr_Clear();
+            }
+        }
     }
     return 0;
 }
@@ -830,35 +874,38 @@
 {
     /* Weakrefs must be invalidated right now, otherwise they can be used
        from code called below, which is very dangerous since Py_REFCNT(self) == 0 */
-    if (self->weakreflist != NULL)
+    if (self->weakreflist != NULL) {
         PyObject_ClearWeakRefs((PyObject *) self);
+    }
 
     PyObject_GC_UnTrack(self);
 
     local_clear(self);
     Py_XDECREF(self->key);
-    Py_TYPE(self)->tp_free((PyObject*)self);
+
+    PyTypeObject *tp = Py_TYPE(self);
+    tp->tp_free((PyObject*)self);
+    Py_DECREF(tp);
 }
 
 /* Returns a borrowed reference to the local dict, creating it if necessary */
 static PyObject *
-_ldict(localobject *self)
+_ldict(localobject *self, thread_module_state *state)
 {
-    PyObject *tdict, *ldict, *dummy;
-
-    tdict = PyThreadState_GetDict();
+    PyObject *tdict = PyThreadState_GetDict();
     if (tdict == NULL) {
         PyErr_SetString(PyExc_SystemError,
                         "Couldn't get thread-state dictionary");
         return NULL;
     }
 
-    dummy = PyDict_GetItemWithError(tdict, self->key);
+    PyObject *ldict;
+    PyObject *dummy = PyDict_GetItemWithError(tdict, self->key);
     if (dummy == NULL) {
         if (PyErr_Occurred()) {
             return NULL;
         }
-        ldict = _local_create_dummy(self);
+        ldict = _local_create_dummy(self, state);
         if (ldict == NULL)
             return NULL;
 
@@ -873,7 +920,7 @@
         }
     }
     else {
-        assert(Py_IS_TYPE(dummy, &localdummytype));
+        assert(Py_IS_TYPE(dummy, state->local_dummy_type));
         ldict = ((localdummyobject *) dummy)->localdict;
     }
 
@@ -883,104 +930,98 @@
 static int
 local_setattro(localobject *self, PyObject *name, PyObject *v)
 {
-    PyObject *ldict;
-    int r;
+    PyObject *module = _PyType_GetModuleByDef(Py_TYPE(self), &thread_module);
+    thread_module_state *state = get_thread_state(module);
 
-    ldict = _ldict(self);
-    if (ldict == NULL)
+    PyObject *ldict = _ldict(self, state);
+    if (ldict == NULL) {
         return -1;
+    }
 
-    r = PyObject_RichCompareBool(name, str_dict, Py_EQ);
+    PyObject *str_dict = _PyUnicode_FromId(&PyId___dict__);  // borrowed ref
+    if (str_dict == NULL) {
+        return -1;
+    }
+
+    int r = PyObject_RichCompareBool(name, str_dict, Py_EQ);
+    if (r == -1) {
+        return -1;
+    }
     if (r == 1) {
         PyErr_Format(PyExc_AttributeError,
                      "'%.50s' object attribute '%U' is read-only",
                      Py_TYPE(self)->tp_name, name);
         return -1;
     }
-    if (r == -1)
-        return -1;
 
     return _PyObject_GenericSetAttrWithDict((PyObject *)self, name, v, ldict);
 }
 
 static PyObject *local_getattro(localobject *, PyObject *);
 
-static PyTypeObject localtype = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    /* tp_name           */ "_thread._local",
-    /* tp_basicsize      */ sizeof(localobject),
-    /* tp_itemsize       */ 0,
-    /* tp_dealloc        */ (destructor)local_dealloc,
-    /* tp_vectorcall_offset */ 0,
-    /* tp_getattr        */ 0,
-    /* tp_setattr        */ 0,
-    /* tp_as_async       */ 0,
-    /* tp_repr           */ 0,
-    /* tp_as_number      */ 0,
-    /* tp_as_sequence    */ 0,
-    /* tp_as_mapping     */ 0,
-    /* tp_hash           */ 0,
-    /* tp_call           */ 0,
-    /* tp_str            */ 0,
-    /* tp_getattro       */ (getattrofunc)local_getattro,
-    /* tp_setattro       */ (setattrofunc)local_setattro,
-    /* tp_as_buffer      */ 0,
-    /* tp_flags          */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE
-                                               | Py_TPFLAGS_HAVE_GC,
-    /* tp_doc            */ "Thread-local data",
-    /* tp_traverse       */ (traverseproc)local_traverse,
-    /* tp_clear          */ (inquiry)local_clear,
-    /* tp_richcompare    */ 0,
-    /* tp_weaklistoffset */ offsetof(localobject, weakreflist),
-    /* tp_iter           */ 0,
-    /* tp_iternext       */ 0,
-    /* tp_methods        */ 0,
-    /* tp_members        */ 0,
-    /* tp_getset         */ 0,
-    /* tp_base           */ 0,
-    /* tp_dict           */ 0, /* internal use */
-    /* tp_descr_get      */ 0,
-    /* tp_descr_set      */ 0,
-    /* tp_dictoffset     */ 0,
-    /* tp_init           */ 0,
-    /* tp_alloc          */ 0,
-    /* tp_new            */ local_new,
-    /* tp_free           */ 0, /* Low-level free-mem routine */
-    /* tp_is_gc          */ 0, /* For PyObject_IS_GC */
+static PyMemberDef local_type_members[] = {
+    {"__weaklistoffset__", T_PYSSIZET, offsetof(localobject, weakreflist), READONLY},
+    {NULL},
+};
+
+static PyType_Slot local_type_slots[] = {
+    {Py_tp_dealloc, (destructor)local_dealloc},
+    {Py_tp_getattro, (getattrofunc)local_getattro},
+    {Py_tp_setattro, (setattrofunc)local_setattro},
+    {Py_tp_doc, "Thread-local data"},
+    {Py_tp_traverse, (traverseproc)local_traverse},
+    {Py_tp_clear, (inquiry)local_clear},
+    {Py_tp_new, local_new},
+    {Py_tp_members, local_type_members},
+    {0, 0}
+};
+
+static PyType_Spec local_type_spec = {
+    .name = "_thread._local",
+    .basicsize = sizeof(localobject),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC |
+              Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = local_type_slots,
 };
 
 static PyObject *
 local_getattro(localobject *self, PyObject *name)
 {
-    PyObject *ldict, *value;
-    int r;
+    PyObject *module = _PyType_GetModuleByDef(Py_TYPE(self), &thread_module);
+    thread_module_state *state = get_thread_state(module);
 
-    ldict = _ldict(self);
+    PyObject *ldict = _ldict(self, state);
     if (ldict == NULL)
         return NULL;
 
-    r = PyObject_RichCompareBool(name, str_dict, Py_EQ);
-    if (r == 1) {
-        Py_INCREF(ldict);
-        return ldict;
-    }
-    if (r == -1)
+    PyObject *str_dict = _PyUnicode_FromId(&PyId___dict__);  // borrowed ref
+    if (str_dict == NULL) {
         return NULL;
+    }
 
-    if (!Py_IS_TYPE(self, &localtype))
+    int r = PyObject_RichCompareBool(name, str_dict, Py_EQ);
+    if (r == 1) {
+        return Py_NewRef(ldict);
+    }
+    if (r == -1) {
+        return NULL;
+    }
+
+    if (!Py_IS_TYPE(self, state->local_type)) {
         /* use generic lookup for subtypes */
-        return _PyObject_GenericGetAttrWithDict(
-            (PyObject *)self, name, ldict, 0);
+        return _PyObject_GenericGetAttrWithDict((PyObject *)self, name,
+                                                ldict, 0);
+    }
 
     /* Optimization: just look in dict ourselves */
-    value = PyDict_GetItemWithError(ldict, name);
+    PyObject *value = PyDict_GetItemWithError(ldict, name);
     if (value != NULL) {
-        Py_INCREF(value);
-        return value;
+        return Py_NewRef(value);
     }
-    else if (PyErr_Occurred()) {
+    if (PyErr_Occurred()) {
         return NULL;
     }
+
     /* Fall back on generic to get __class__ and __dict__ */
     return _PyObject_GenericGetAttrWithDict(
         (PyObject *)self, name, ldict, 0);
@@ -990,17 +1031,15 @@
 static PyObject *
 _localdummy_destroyed(PyObject *localweakref, PyObject *dummyweakref)
 {
-    PyObject *obj;
-    localobject *self;
     assert(PyWeakref_CheckRef(localweakref));
-    obj = PyWeakref_GET_OBJECT(localweakref);
-    if (obj == Py_None)
+    PyObject *obj = PyWeakref_GET_OBJECT(localweakref);
+    if (obj == Py_None) {
         Py_RETURN_NONE;
-    Py_INCREF(obj);
-    assert(PyObject_TypeCheck(obj, &localtype));
+    }
+
     /* If the thread-local object is still alive and not being cleared,
        remove the corresponding local dict */
-    self = (localobject *) obj;
+    localobject *self = (localobject *)Py_NewRef(obj);
     if (self->dummies != NULL) {
         PyObject *ldict;
         ldict = PyDict_GetItemWithError(self->dummies, dummyweakref);
@@ -1020,24 +1059,35 @@
     PyInterpreterState *interp;
     PyObject *func;
     PyObject *args;
-    PyObject *keyw;
+    PyObject *kwargs;
     PyThreadState *tstate;
     _PyRuntimeState *runtime;
 };
 
+
 static void
-t_bootstrap(void *boot_raw)
+thread_bootstate_free(struct bootstate *boot)
+{
+    Py_DECREF(boot->func);
+    Py_DECREF(boot->args);
+    Py_XDECREF(boot->kwargs);
+    PyMem_Free(boot);
+}
+
+
+static void
+thread_run(void *boot_raw)
 {
     struct bootstate *boot = (struct bootstate *) boot_raw;
     PyThreadState *tstate;
-    PyObject *res;
 
     tstate = boot->tstate;
     tstate->thread_id = PyThread_get_thread_ident();
     _PyThreadState_Init(tstate);
     PyEval_AcquireThread(tstate);
     tstate->interp->num_threads++;
-    res = PyObject_Call(boot->func, boot->args, boot->keyw);
+
+    PyObject *res = PyObject_Call(boot->func, boot->args, boot->kwargs);
     if (res == NULL) {
         if (PyErr_ExceptionMatches(PyExc_SystemExit))
             /* SystemExit is ignored silently */
@@ -1049,26 +1099,25 @@
     else {
         Py_DECREF(res);
     }
-    Py_DECREF(boot->func);
-    Py_DECREF(boot->args);
-    Py_XDECREF(boot->keyw);
-    PyMem_DEL(boot_raw);
+
+    thread_bootstate_free(boot);
     tstate->interp->num_threads--;
     PyThreadState_Clear(tstate);
     _PyThreadState_DeleteCurrent(tstate);
-    PyThread_exit_thread();
+
+    // bpo-44434: Don't call explicitly PyThread_exit_thread(). On Linux with
+    // the glibc, pthread_exit() can abort the whole process if dlopen() fails
+    // to open the libgcc_s.so library (ex: EMFILE error).
 }
 
 static PyObject *
 thread_PyThread_start_new_thread(PyObject *self, PyObject *fargs)
 {
     _PyRuntimeState *runtime = &_PyRuntime;
-    PyObject *func, *args, *keyw = NULL;
-    struct bootstate *boot;
-    unsigned long ident;
+    PyObject *func, *args, *kwargs = NULL;
 
     if (!PyArg_UnpackTuple(fargs, "start_new_thread", 2, 3,
-                           &func, &args, &keyw))
+                           &func, &args, &kwargs))
         return NULL;
     if (!PyCallable_Check(func)) {
         PyErr_SetString(PyExc_TypeError,
@@ -1080,7 +1129,7 @@
                         "2nd arg must be a tuple");
         return NULL;
     }
-    if (keyw != NULL && !PyDict_Check(keyw)) {
+    if (kwargs != NULL && !PyDict_Check(kwargs)) {
         PyErr_SetString(PyExc_TypeError,
                         "optional 3rd arg must be a dictionary");
         return NULL;
@@ -1093,31 +1142,26 @@
         return NULL;
     }
 
-    boot = PyMem_NEW(struct bootstate, 1);
-    if (boot == NULL)
-        return PyErr_NoMemory();
-    boot->interp = _PyInterpreterState_GET();
-    boot->func = func;
-    boot->args = args;
-    boot->keyw = keyw;
-    boot->tstate = _PyThreadState_Prealloc(boot->interp);
-    boot->runtime = runtime;
-    if (boot->tstate == NULL) {
-        PyMem_DEL(boot);
+    struct bootstate *boot = PyMem_NEW(struct bootstate, 1);
+    if (boot == NULL) {
         return PyErr_NoMemory();
     }
-    Py_INCREF(func);
-    Py_INCREF(args);
-    Py_XINCREF(keyw);
+    boot->interp = _PyInterpreterState_GET();
+    boot->tstate = _PyThreadState_Prealloc(boot->interp);
+    if (boot->tstate == NULL) {
+        PyMem_Free(boot);
+        return PyErr_NoMemory();
+    }
+    boot->runtime = runtime;
+    boot->func = Py_NewRef(func);
+    boot->args = Py_NewRef(args);
+    boot->kwargs = Py_XNewRef(kwargs);
 
-    ident = PyThread_start_new_thread(t_bootstrap, (void*) boot);
+    unsigned long ident = PyThread_start_new_thread(thread_run, (void*) boot);
     if (ident == PYTHREAD_INVALID_THREAD_ID) {
         PyErr_SetString(ThreadError, "can't start new thread");
-        Py_DECREF(func);
-        Py_DECREF(args);
-        Py_XDECREF(keyw);
         PyThreadState_Clear(boot->tstate);
-        PyMem_DEL(boot);
+        thread_bootstate_free(boot);
         return NULL;
     }
     return PyLong_FromUnsignedLong(ident);
@@ -1149,25 +1193,37 @@
 thread to exit silently unless the exception is caught.");
 
 static PyObject *
-thread_PyThread_interrupt_main(PyObject * self, PyObject *Py_UNUSED(ignored))
+thread_PyThread_interrupt_main(PyObject *self, PyObject *args)
 {
-    PyErr_SetInterrupt();
+    int signum = SIGINT;
+    if (!PyArg_ParseTuple(args, "|i:signum", &signum)) {
+        return NULL;
+    }
+
+    if (PyErr_SetInterruptEx(signum)) {
+        PyErr_SetString(PyExc_ValueError, "signal number out of range");
+        return NULL;
+    }
     Py_RETURN_NONE;
 }
 
 PyDoc_STRVAR(interrupt_doc,
-"interrupt_main()\n\
+"interrupt_main(signum=signal.SIGINT, /)\n\
 \n\
-Raise a KeyboardInterrupt in the main thread.\n\
-A subthread can use this function to interrupt the main thread."
+Simulate the arrival of the given signal in the main thread,\n\
+where the corresponding signal handler will be executed.\n\
+If *signum* is omitted, SIGINT is assumed.\n\
+A subthread can use this function to interrupt the main thread.\n\
+\n\
+Note: the default signal handler for SIGINT raises ``KeyboardInterrupt``."
 );
 
-static lockobject *newlockobject(void);
+static lockobject *newlockobject(PyObject *module);
 
 static PyObject *
-thread_PyThread_allocate_lock(PyObject *self, PyObject *Py_UNUSED(ignored))
+thread_PyThread_allocate_lock(PyObject *module, PyObject *Py_UNUSED(ignored))
 {
-    return (PyObject *) newlockobject();
+    return (PyObject *) newlockobject(module);
 }
 
 PyDoc_STRVAR(allocate_doc,
@@ -1244,7 +1300,6 @@
     PyObject *obj = PyWeakref_GET_OBJECT(wr);
     lockobject *lock;
     if (obj != Py_None) {
-        assert(Py_IS_TYPE(obj, &Locktype));
         lock = (lockobject *) obj;
         if (lock->locked) {
             PyThread_release_lock(lock->lock_lock);
@@ -1257,7 +1312,7 @@
 }
 
 static PyObject *
-thread__set_sentinel(PyObject *self, PyObject *Py_UNUSED(ignored))
+thread__set_sentinel(PyObject *module, PyObject *Py_UNUSED(ignored))
 {
     PyObject *wr;
     PyThreadState *tstate = PyThreadState_Get();
@@ -1272,7 +1327,7 @@
         tstate->on_delete_data = NULL;
         Py_DECREF(wr);
     }
-    lock = newlockobject();
+    lock = newlockobject(module);
     if (lock == NULL)
         return NULL;
     /* The lock is owned by whoever called _set_sentinel(), but the weakref
@@ -1425,7 +1480,7 @@
 };
 
 static PyStructSequence_Desc ExceptHookArgs_desc = {
-    .name = "_thread.ExceptHookArgs",
+    .name = "_thread._ExceptHookArgs",
     .doc = ExceptHookArgs__doc__,
     .fields = ExceptHookArgs_fields,
     .n_in_sequence = 4
@@ -1504,8 +1559,8 @@
      METH_NOARGS, exit_doc},
     {"exit",                    thread_PyThread_exit_thread,
      METH_NOARGS, exit_doc},
-    {"interrupt_main",          thread_PyThread_interrupt_main,
-     METH_NOARGS, interrupt_doc},
+    {"interrupt_main",          (PyCFunction)thread_PyThread_interrupt_main,
+     METH_VARARGS, interrupt_doc},
     {"get_ident",               thread_get_ident,
      METH_NOARGS, get_ident_doc},
 #ifdef PY_HAVE_THREAD_NATIVE_ID
@@ -1526,106 +1581,132 @@
 
 /* Initialization function */
 
+static int
+thread_module_exec(PyObject *module)
+{
+    thread_module_state *state = get_thread_state(module);
+    PyObject *d = PyModule_GetDict(module);
+
+    // Initialize the C thread library
+    PyThread_init_thread();
+
+    // Lock
+    state->lock_type = (PyTypeObject *)PyType_FromSpec(&lock_type_spec);
+    if (state->lock_type == NULL) {
+        return -1;
+    }
+    if (PyDict_SetItemString(d, "LockType", (PyObject *)state->lock_type) < 0) {
+        return -1;
+    }
+
+    // RLock
+    PyTypeObject *rlock_type = (PyTypeObject *)PyType_FromSpec(&rlock_type_spec);
+    if (rlock_type == NULL) {
+        return -1;
+    }
+    if (PyModule_AddType(module, rlock_type) < 0) {
+        Py_DECREF(rlock_type);
+        return -1;
+    }
+    Py_DECREF(rlock_type);
+
+    // Local dummy
+    state->local_dummy_type = (PyTypeObject *)PyType_FromSpec(&local_dummy_type_spec);
+    if (state->local_dummy_type == NULL) {
+        return -1;
+    }
+
+    // Local
+    state->local_type = (PyTypeObject *)PyType_FromModuleAndSpec(module, &local_type_spec, NULL);
+    if (state->local_type == NULL) {
+        return -1;
+    }
+    if (PyModule_AddType(module, state->local_type) < 0) {
+        return -1;
+    }
+
+    if (ExceptHookArgsType.tp_name == NULL) {
+        if (PyStructSequence_InitType2(&ExceptHookArgsType,
+                                       &ExceptHookArgs_desc) < 0) {
+            return -1;
+        }
+    }
+
+    // Add module attributes
+    if (PyDict_SetItemString(d, "error", ThreadError) < 0) {
+        return -1;
+    }
+    if (PyModule_AddType(module, &ExceptHookArgsType) < 0) {
+        return -1;
+    }
+
+    // TIMEOUT_MAX
+    double timeout_max = (_PyTime_t)PY_TIMEOUT_MAX * 1e-6;
+    double time_max = _PyTime_AsSecondsDouble(_PyTime_MAX);
+    timeout_max = Py_MIN(timeout_max, time_max);
+    // Round towards minus infinity
+    timeout_max = floor(timeout_max);
+
+    if (PyModule_AddObject(module, "TIMEOUT_MAX",
+                           PyFloat_FromDouble(timeout_max)) < 0) {
+        return -1;
+    }
+
+    return 0;
+}
+
+
+static int
+thread_module_traverse(PyObject *module, visitproc visit, void *arg)
+{
+    thread_module_state *state = get_thread_state(module);
+    Py_VISIT(state->lock_type);
+    Py_VISIT(state->local_type);
+    Py_VISIT(state->local_dummy_type);
+    return 0;
+}
+
+static int
+thread_module_clear(PyObject *module)
+{
+    thread_module_state *state = get_thread_state(module);
+    Py_CLEAR(state->lock_type);
+    Py_CLEAR(state->local_type);
+    Py_CLEAR(state->local_dummy_type);
+    return 0;
+}
+
+static void
+thread_module_free(void *module)
+{
+    thread_module_clear((PyObject *)module);
+}
+
+
+
 PyDoc_STRVAR(thread_doc,
 "This module provides primitive operations to write multi-threaded programs.\n\
 The 'threading' module provides a more convenient interface.");
 
-PyDoc_STRVAR(lock_doc,
-"A lock object is a synchronization primitive.  To create a lock,\n\
-call threading.Lock().  Methods are:\n\
-\n\
-acquire() -- lock the lock, possibly blocking until it can be obtained\n\
-release() -- unlock of the lock\n\
-locked() -- test whether the lock is currently locked\n\
-\n\
-A lock is not owned by the thread that locked it; another thread may\n\
-unlock it.  A thread attempting to lock a lock that it has already locked\n\
-will block until another thread unlocks it.  Deadlocks may ensue.");
-
-static struct PyModuleDef threadmodule = {
-    PyModuleDef_HEAD_INIT,
-    "_thread",
-    thread_doc,
-    -1,
-    thread_methods,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+static PyModuleDef_Slot thread_module_slots[] = {
+    {Py_mod_exec, thread_module_exec},
+    {0, NULL}
 };
 
+static struct PyModuleDef thread_module = {
+    PyModuleDef_HEAD_INIT,
+    .m_name = "_thread",
+    .m_doc = thread_doc,
+    .m_size = sizeof(thread_module_state),
+    .m_methods = thread_methods,
+    .m_traverse = thread_module_traverse,
+    .m_clear = thread_module_clear,
+    .m_free = thread_module_free,
+    .m_slots = thread_module_slots,
+};
 
 PyMODINIT_FUNC
 PyInit__thread(void)
 {
-    PyObject *m, *d, *v;
-    double time_max;
-    double timeout_max;
-    PyInterpreterState *interp = _PyInterpreterState_GET();
-
-    /* Initialize types: */
-    if (PyType_Ready(&localdummytype) < 0)
-        return NULL;
-    if (PyType_Ready(&localtype) < 0)
-        return NULL;
-    if (PyType_Ready(&Locktype) < 0)
-        return NULL;
-    if (PyType_Ready(&RLocktype) < 0)
-        return NULL;
-    if (ExceptHookArgsType.tp_name == NULL) {
-        if (PyStructSequence_InitType2(&ExceptHookArgsType,
-                                       &ExceptHookArgs_desc) < 0) {
-            return NULL;
-        }
-    }
-
-    /* Create the module and add the functions */
-    m = PyModule_Create(&threadmodule);
-    if (m == NULL)
-        return NULL;
-
-    timeout_max = (_PyTime_t)PY_TIMEOUT_MAX * 1e-6;
-    time_max = _PyTime_AsSecondsDouble(_PyTime_MAX);
-    timeout_max = Py_MIN(timeout_max, time_max);
-    /* Round towards minus infinity */
-    timeout_max = floor(timeout_max);
-
-    v = PyFloat_FromDouble(timeout_max);
-    if (!v)
-        return NULL;
-    if (PyModule_AddObject(m, "TIMEOUT_MAX", v) < 0)
-        return NULL;
-
-    /* Add a symbolic constant */
-    d = PyModule_GetDict(m);
-    ThreadError = PyExc_RuntimeError;
-    Py_INCREF(ThreadError);
-
-    PyDict_SetItemString(d, "error", ThreadError);
-    Locktype.tp_doc = lock_doc;
-    Py_INCREF(&Locktype);
-    PyDict_SetItemString(d, "LockType", (PyObject *)&Locktype);
-
-    Py_INCREF(&RLocktype);
-    if (PyModule_AddObject(m, "RLock", (PyObject *)&RLocktype) < 0)
-        return NULL;
-
-    Py_INCREF(&localtype);
-    if (PyModule_AddObject(m, "_local", (PyObject *)&localtype) < 0)
-        return NULL;
-
-    Py_INCREF(&ExceptHookArgsType);
-    if (PyModule_AddObject(m, "_ExceptHookArgs",
-                           (PyObject *)&ExceptHookArgsType) < 0)
-        return NULL;
-
-    interp->num_threads = 0;
-
-    str_dict = PyUnicode_InternFromString("__dict__");
-    if (str_dict == NULL)
-        return NULL;
-
-    /* Initialize the C thread library */
-    PyThread_init_thread();
-    return m;
+    return PyModuleDef_Init(&thread_module);
 }
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index 793c5e7..2a3e65b 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -246,12 +246,15 @@
 #endif
 
 #define ENTER_TCL \
-    { PyThreadState *tstate = PyThreadState_Get(); Py_BEGIN_ALLOW_THREADS \
-        if(tcl_lock)PyThread_acquire_lock(tcl_lock, 1); tcl_tstate = tstate;
+    { PyThreadState *tstate = PyThreadState_Get(); \
+      Py_BEGIN_ALLOW_THREADS \
+      if(tcl_lock)PyThread_acquire_lock(tcl_lock, 1); \
+      tcl_tstate = tstate;
 
 #define LEAVE_TCL \
     tcl_tstate = NULL; \
-    if(tcl_lock)PyThread_release_lock(tcl_lock); Py_END_ALLOW_THREADS}
+    if(tcl_lock)PyThread_release_lock(tcl_lock); \
+    Py_END_ALLOW_THREADS}
 
 #define ENTER_OVERLAP \
     Py_END_ALLOW_THREADS
@@ -261,12 +264,14 @@
 
 #define ENTER_PYTHON \
     { PyThreadState *tstate = tcl_tstate; tcl_tstate = NULL; \
-        if(tcl_lock) \
-          PyThread_release_lock(tcl_lock); PyEval_RestoreThread((tstate)); }
+      if(tcl_lock) \
+        PyThread_release_lock(tcl_lock); \
+      PyEval_RestoreThread((tstate)); }
 
 #define LEAVE_PYTHON \
     { PyThreadState *tstate = PyEval_SaveThread(); \
-        if(tcl_lock)PyThread_acquire_lock(tcl_lock, 1); tcl_tstate = tstate; }
+      if(tcl_lock)PyThread_acquire_lock(tcl_lock, 1); \
+      tcl_tstate = tstate; }
 
 #define CHECK_TCL_APPARTMENT \
     if (((TkappObject *)self)->threaded && \
@@ -395,7 +400,8 @@
 
     char *buf = NULL;
     PyErr_Clear();
-    /* Tcl encodes null character as \xc0\x80 */
+    /* Tcl encodes null character as \xc0\x80.
+       https://en.wikipedia.org/wiki/UTF-8#Modified_UTF-8 */
     if (memchr(s, '\xc0', size)) {
         char *q;
         const char *e = s + size;
@@ -419,6 +425,57 @@
     if (buf != NULL) {
         PyMem_Free(buf);
     }
+    if (r == NULL || PyUnicode_KIND(r) == PyUnicode_1BYTE_KIND) {
+        return r;
+    }
+
+    /* In CESU-8 non-BMP characters are represented as a surrogate pair,
+       like in UTF-16, and then each surrogate code point is encoded in UTF-8.
+       https://en.wikipedia.org/wiki/CESU-8 */
+    Py_ssize_t len = PyUnicode_GET_LENGTH(r);
+    Py_ssize_t i, j;
+    /* All encoded surrogate characters start with \xED. */
+    i = PyUnicode_FindChar(r, 0xdcED, 0, len, 1);
+    if (i == -2) {
+        Py_DECREF(r);
+        return NULL;
+    }
+    if (i == -1) {
+        return r;
+    }
+    Py_UCS4 *u = PyUnicode_AsUCS4Copy(r);
+    Py_DECREF(r);
+    if (u == NULL) {
+        return NULL;
+    }
+    Py_UCS4 ch;
+    for (j = i; i < len; i++, u[j++] = ch) {
+        Py_UCS4 ch1, ch2, ch3, high, low;
+        /* Low surrogates U+D800 - U+DBFF are encoded as
+           \xED\xA0\x80 - \xED\xAF\xBF. */
+        ch1 = ch = u[i];
+        if (ch1 != 0xdcED) continue;
+        ch2 = u[i + 1];
+        if (!(0xdcA0 <= ch2 && ch2 <= 0xdcAF)) continue;
+        ch3 = u[i + 2];
+        if (!(0xdc80 <= ch3 && ch3 <= 0xdcBF)) continue;
+        high = 0xD000 | ((ch2 & 0x3F) << 6) | (ch3 & 0x3F);
+        assert(Py_UNICODE_IS_HIGH_SURROGATE(high));
+        /* High surrogates U+DC00 - U+DFFF are encoded as
+           \xED\xB0\x80 - \xED\xBF\xBF. */
+        ch1 = u[i + 3];
+        if (ch1 != 0xdcED) continue;
+        ch2 = u[i + 4];
+        if (!(0xdcB0 <= ch2 && ch2 <= 0xdcBF)) continue;
+        ch3 = u[i + 5];
+        if (!(0xdc80 <= ch3 && ch3 <= 0xdcBF)) continue;
+        low = 0xD000 | ((ch2 & 0x3F) << 6) | (ch3 & 0x3F);
+        assert(Py_UNICODE_IS_HIGH_SURROGATE(high));
+        ch = Py_UNICODE_JOIN_SURROGATES(high, low);
+        i += 5;
+    }
+    r = PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND, u, j);
+    PyMem_Free(u);
     return r;
 }
 
@@ -852,7 +909,7 @@
     PyObject *tp = (PyObject *) Py_TYPE(self);
     Tcl_DecrRefCount(self->value);
     Py_XDECREF(self->string);
-    PyObject_Del(self);
+    PyObject_Free(self);
     Py_DECREF(tp);
 }
 
@@ -879,7 +936,7 @@
         Py_INCREF(self->string);
         return self->string;
     }
-    /* XXX Could chache result if it is non-ASCII. */
+    /* XXX Could cache result if it is non-ASCII. */
     return unicodeFromTclObj(self->value);
 }
 
@@ -950,7 +1007,7 @@
     "_tkinter.Tcl_Obj",
     sizeof(PyTclObject),
     0,
-    Py_TPFLAGS_DEFAULT,
+    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION,
     PyTclObject_Type_slots,
 };
 
@@ -2420,7 +2477,7 @@
     ENTER_PYTHON
     Py_XDECREF(data->self);
     Py_XDECREF(data->func);
-    PyMem_DEL(data);
+    PyMem_Free(data);
     LEAVE_PYTHON
 }
 
@@ -2493,7 +2550,7 @@
         CommandEvent *ev = (CommandEvent*)attemptckalloc(sizeof(CommandEvent));
         if (ev == NULL) {
             PyErr_NoMemory();
-            PyMem_DEL(data);
+            PyMem_Free(data);
             return NULL;
         }
         ev->ev.proc = (Tcl_EventProc*)Tkapp_CommandProc;
@@ -2516,7 +2573,7 @@
     }
     if (err) {
         PyErr_SetString(Tkinter_TclError, "can't create Tcl command");
-        PyMem_DEL(data);
+        PyMem_Free(data);
         return NULL;
     }
 
@@ -2614,7 +2671,7 @@
             *pp = p->next;
             Py_XDECREF(p->func);
             Py_XDECREF(p->file);
-            PyMem_DEL(p);
+            PyMem_Free(p);
         }
         else
             pp = &p->next;
@@ -2771,7 +2828,7 @@
 
     Py_XDECREF(func);
 
-    PyObject_Del(self);
+    PyObject_Free(self);
     Py_DECREF(tp);
 }
 
@@ -3044,7 +3101,7 @@
     ENTER_TCL
     Tcl_DeleteInterp(Tkapp_Interp(self));
     LEAVE_TCL
-    PyObject_Del(self);
+    PyObject_Free(self);
     Py_DECREF(tp);
     DisableEventHook();
 }
@@ -3140,8 +3197,10 @@
 
     context.size = 0;
 
-    if (!_flatten1(&context, item,0))
+    if (!_flatten1(&context, item, 0)) {
+        Py_XDECREF(context.tuple);
         return NULL;
+    }
 
     if (_PyTuple_Resize(&context.tuple, context.size))
         return NULL;
@@ -3242,7 +3301,7 @@
     "_tkinter.tktimertoken",
     sizeof(TkttObject),
     0,
-    Py_TPFLAGS_DEFAULT,
+    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION,
     Tktt_Type_slots,
 };
 
@@ -3297,7 +3356,7 @@
     "_tkinter.tkapp",
     sizeof(TkappObject),
     0,
-    Py_TPFLAGS_DEFAULT,
+    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION,
     Tkapp_Type_slots,
 };
 
@@ -3485,7 +3544,6 @@
         Py_DECREF(m);
         return NULL;
     }
-    ((PyTypeObject *)o)->tp_new = NULL;
     if (PyModule_AddObject(m, "TkappType", o)) {
         Py_DECREF(o);
         Py_DECREF(m);
@@ -3498,7 +3556,6 @@
         Py_DECREF(m);
         return NULL;
     }
-    ((PyTypeObject *)o)->tp_new = NULL;
     if (PyModule_AddObject(m, "TkttType", o)) {
         Py_DECREF(o);
         Py_DECREF(m);
@@ -3511,7 +3568,6 @@
         Py_DECREF(m);
         return NULL;
     }
-    ((PyTypeObject *)o)->tp_new = NULL;
     if (PyModule_AddObject(m, "Tcl_Obj", o)) {
         Py_DECREF(o);
         Py_DECREF(m);
diff --git a/Modules/_tracemalloc.c b/Modules/_tracemalloc.c
index 04f6c24..ba0eb73 100644
--- a/Modules/_tracemalloc.c
+++ b/Modules/_tracemalloc.c
@@ -836,7 +836,7 @@
 static void
 tracemalloc_clear_traces(void)
 {
-    /* The GIL protects variables againt concurrent access */
+    /* The GIL protects variables against concurrent access */
     assert(PyGILState_Check());
 
     TABLES_LOCK();
@@ -1241,6 +1241,9 @@
     _Py_hashtable_t *traces = (_Py_hashtable_t *)value;
 
     _Py_hashtable_t *traces2 = tracemalloc_copy_traces(traces);
+    if (traces2 == NULL) {
+        return -1;
+    }
     if (_Py_hashtable_set(domains2, TO_PTR(domain), traces2) < 0) {
         _Py_hashtable_destroy(traces2);
         return -1;
diff --git a/Modules/_winapi.c b/Modules/_winapi.c
index e1672c4..3e24d51 100644
--- a/Modules/_winapi.c
+++ b/Modules/_winapi.c
@@ -32,11 +32,13 @@
  */
 
 /* Licensed to PSF under a Contributor Agreement. */
-/* See http://www.python.org/2.4/license for licensing details. */
+/* See https://www.python.org/2.4/license for licensing details. */
 
 #include "Python.h"
+#include "pycore_moduleobject.h"  // _PyModule_GetState()
 #include "structmember.h"         // PyMemberDef
 
+
 #define WINDOWS_LEAN_AND_MEAN
 #include "windows.h"
 #include <crtdbg.h>
@@ -78,6 +80,17 @@
     return has_CancelIoEx;
 }
 
+typedef struct {
+    PyTypeObject *overlapped_type;
+} WinApiState;
+
+static inline WinApiState*
+winapi_get_state(PyObject *module)
+{
+    void *state = _PyModule_GetState(module);
+    assert(state != NULL);
+    return (WinApiState *)state;
+}
 
 /*
  * A Python object wrapping an OVERLAPPED structure and other useful data
@@ -99,12 +112,27 @@
     Py_buffer write_buffer;
 } OverlappedObject;
 
+/*
+Note: tp_clear (overlapped_clear) is not implemented because it
+requires cancelling the IO operation if it's pending and the cancellation is
+quite complex and can fail (see: overlapped_dealloc).
+*/
+static int
+overlapped_traverse(OverlappedObject *self, visitproc visit, void *arg)
+{
+    Py_VISIT(self->read_buffer);
+    Py_VISIT(self->write_buffer.obj);
+    Py_VISIT(Py_TYPE(self));
+    return 0;
+}
+
 static void
 overlapped_dealloc(OverlappedObject *self)
 {
     DWORD bytes;
     int err = GetLastError();
 
+    PyObject_GC_UnTrack(self);
     if (self->pending) {
         if (check_CancelIoEx() &&
             Py_CancelIoEx(self->handle, &self->overlapped) &&
@@ -140,7 +168,9 @@
     if (self->write_buffer.obj)
         PyBuffer_Release(&self->write_buffer);
     Py_CLEAR(self->read_buffer);
-    PyObject_Del(self);
+    PyTypeObject *tp = Py_TYPE(self);
+    tp->tp_free(self);
+    Py_DECREF(tp);
 }
 
 /*[clinic input]
@@ -164,10 +194,11 @@
 create_converter('BOOL', 'i') # F_BOOL used previously (always 'i')
 create_converter('DWORD', 'k') # F_DWORD is always "k" (which is much shorter)
 create_converter('LPCTSTR', 's')
-create_converter('LPCWSTR', 'u')
-create_converter('LPWSTR', 'u')
 create_converter('UINT', 'I') # F_UINT used previously (always 'I')
 
+class LPCWSTR_converter(Py_UNICODE_converter):
+    type = 'LPCWSTR'
+
 class HANDLE_return_converter(CReturnConverter):
     type = 'HANDLE'
 
@@ -197,7 +228,7 @@
         data.return_conversion.append(
             'return_value = HANDLE_TO_PYNUM(_return_value);\n')
 [python start generated code]*/
-/*[python end generated code: output=da39a3ee5e6b4b0d input=79464c61a31ae932]*/
+/*[python end generated code: output=da39a3ee5e6b4b0d input=011ee0c3a2244bfe]*/
 
 #include "clinic/_winapi.c.h"
 
@@ -304,55 +335,31 @@
     {NULL}
 };
 
-PyTypeObject OverlappedType = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    /* tp_name           */ "_winapi.Overlapped",
-    /* tp_basicsize      */ sizeof(OverlappedObject),
-    /* tp_itemsize       */ 0,
-    /* tp_dealloc        */ (destructor) overlapped_dealloc,
-    /* tp_vectorcall_offset */ 0,
-    /* tp_getattr        */ 0,
-    /* tp_setattr        */ 0,
-    /* tp_as_async       */ 0,
-    /* tp_repr           */ 0,
-    /* tp_as_number      */ 0,
-    /* tp_as_sequence    */ 0,
-    /* tp_as_mapping     */ 0,
-    /* tp_hash           */ 0,
-    /* tp_call           */ 0,
-    /* tp_str            */ 0,
-    /* tp_getattro       */ 0,
-    /* tp_setattro       */ 0,
-    /* tp_as_buffer      */ 0,
-    /* tp_flags          */ Py_TPFLAGS_DEFAULT,
-    /* tp_doc            */ "OVERLAPPED structure wrapper",
-    /* tp_traverse       */ 0,
-    /* tp_clear          */ 0,
-    /* tp_richcompare    */ 0,
-    /* tp_weaklistoffset */ 0,
-    /* tp_iter           */ 0,
-    /* tp_iternext       */ 0,
-    /* tp_methods        */ overlapped_methods,
-    /* tp_members        */ overlapped_members,
-    /* tp_getset         */ 0,
-    /* tp_base           */ 0,
-    /* tp_dict           */ 0,
-    /* tp_descr_get      */ 0,
-    /* tp_descr_set      */ 0,
-    /* tp_dictoffset     */ 0,
-    /* tp_init           */ 0,
-    /* tp_alloc          */ 0,
-    /* tp_new            */ 0,
+static PyType_Slot winapi_overlapped_type_slots[] = {
+    {Py_tp_traverse, overlapped_traverse},
+    {Py_tp_dealloc, overlapped_dealloc},
+    {Py_tp_doc, "OVERLAPPED structure wrapper"},
+    {Py_tp_methods, overlapped_methods},
+    {Py_tp_members, overlapped_members},
+    {0,0}
+};
+
+static PyType_Spec winapi_overlapped_type_spec = {
+    .name = "_winapi.Overlapped",
+    .basicsize = sizeof(OverlappedObject),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION |
+              Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = winapi_overlapped_type_slots,
 };
 
 static OverlappedObject *
-new_overlapped(HANDLE handle)
+new_overlapped(PyObject *module, HANDLE handle)
 {
-    OverlappedObject *self;
-
-    self = PyObject_New(OverlappedObject, &OverlappedType);
+    WinApiState *st = winapi_get_state(module);
+    OverlappedObject *self = PyObject_GC_New(OverlappedObject, st->overlapped_type);
     if (!self)
         return NULL;
+
     self->handle = handle;
     self->read_buffer = NULL;
     self->pending = 0;
@@ -361,6 +368,8 @@
     memset(&self->write_buffer, 0, sizeof(Py_buffer));
     /* Manual reset, initially non-signalled */
     self->overlapped.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+
+    PyObject_GC_Track(self);
     return self;
 }
 
@@ -408,7 +417,7 @@
     OverlappedObject *overlapped = NULL;
 
     if (use_overlapped) {
-        overlapped = new_overlapped(handle);
+        overlapped = new_overlapped(module, handle);
         if (!overlapped)
             return NULL;
     }
@@ -520,15 +529,15 @@
 /*[clinic input]
 _winapi.CreateJunction
 
-    src_path: LPWSTR
-    dst_path: LPWSTR
+    src_path: LPCWSTR
+    dst_path: LPCWSTR
     /
 [clinic start generated code]*/
 
 static PyObject *
-_winapi_CreateJunction_impl(PyObject *module, LPWSTR src_path,
-                            LPWSTR dst_path)
-/*[clinic end generated code: output=66b7eb746e1dfa25 input=8cd1f9964b6e3d36]*/
+_winapi_CreateJunction_impl(PyObject *module, LPCWSTR src_path,
+                            LPCWSTR dst_path)
+/*[clinic end generated code: output=44b3f5e9bbcc4271 input=963d29b44b9384a7]*/
 {
     /* Privilege adjustment */
     HANDLE token = NULL;
@@ -1526,7 +1535,7 @@
     if (!buf)
         return NULL;
     if (use_overlapped) {
-        overlapped = new_overlapped(handle);
+        overlapped = new_overlapped(module, handle);
         if (!overlapped) {
             Py_DECREF(buf);
             return NULL;
@@ -1713,7 +1722,7 @@
     nhandles = PySequence_Length(handle_seq);
     if (nhandles == -1)
         return NULL;
-    if (nhandles < 0 || nhandles >= MAXIMUM_WAIT_OBJECTS - 1) {
+    if (nhandles < 0 || nhandles > MAXIMUM_WAIT_OBJECTS - 1) {
         PyErr_Format(PyExc_ValueError,
                      "need at most %zd handles, got a sequence of length %zd",
                      MAXIMUM_WAIT_OBJECTS - 1, nhandles);
@@ -1809,7 +1818,7 @@
     OverlappedObject *overlapped = NULL;
 
     if (use_overlapped) {
-        overlapped = new_overlapped(handle);
+        overlapped = new_overlapped(module, handle);
         if (!overlapped)
             return NULL;
         buf = &overlapped->write_buffer;
@@ -1885,6 +1894,113 @@
     return result;
 }
 
+/*[clinic input]
+_winapi._mimetypes_read_windows_registry
+
+    on_type_read: object
+
+Optimized function for reading all known MIME types from the registry.
+
+*on_type_read* is a callable taking *type* and *ext* arguments, as for
+MimeTypes.add_type.
+[clinic start generated code]*/
+
+static PyObject *
+_winapi__mimetypes_read_windows_registry_impl(PyObject *module,
+                                              PyObject *on_type_read)
+/*[clinic end generated code: output=20829f00bebce55b input=cd357896d6501f68]*/
+{
+#define CCH_EXT 128
+#define CB_TYPE 510
+    struct {
+        wchar_t ext[CCH_EXT];
+        wchar_t type[CB_TYPE / sizeof(wchar_t) + 1];
+    } entries[64];
+    int entry = 0;
+    HKEY hkcr = NULL;
+    LRESULT err;
+
+    Py_BEGIN_ALLOW_THREADS
+    err = RegOpenKeyExW(HKEY_CLASSES_ROOT, NULL, 0, KEY_READ, &hkcr);
+    for (DWORD i = 0; err == ERROR_SUCCESS || err == ERROR_MORE_DATA; ++i) {
+        LPWSTR ext = entries[entry].ext;
+        LPWSTR type = entries[entry].type;
+        DWORD cchExt = CCH_EXT;
+        DWORD cbType = CB_TYPE;
+        HKEY subkey;
+        DWORD regType;
+
+        err = RegEnumKeyExW(hkcr, i, ext, &cchExt, NULL, NULL, NULL, NULL);
+        if (err != ERROR_SUCCESS || (cchExt && ext[0] != L'.')) {
+            continue;
+        }
+
+        err = RegOpenKeyExW(hkcr, ext, 0, KEY_READ, &subkey);
+        if (err == ERROR_FILE_NOT_FOUND) {
+            err = ERROR_SUCCESS;
+            continue;
+        } else if (err != ERROR_SUCCESS) {
+            continue;
+        }
+
+        err = RegQueryValueExW(subkey, L"Content Type", NULL,
+                              &regType, (LPBYTE)type, &cbType);
+        RegCloseKey(subkey);
+        if (err == ERROR_FILE_NOT_FOUND) {
+            err = ERROR_SUCCESS;
+            continue;
+        } else if (err != ERROR_SUCCESS) {
+            continue;
+        } else if (regType != REG_SZ || !cbType) {
+            continue;
+        }
+        type[cbType / sizeof(wchar_t)] = L'\0';
+
+        entry += 1;
+
+        /* Flush our cached entries if we are full */
+        if (entry == sizeof(entries) / sizeof(entries[0])) {
+            Py_BLOCK_THREADS
+            for (int j = 0; j < entry; ++j) {
+                PyObject *r = PyObject_CallFunction(
+                    on_type_read, "uu", entries[j].type, entries[j].ext
+                );
+                if (!r) {
+                    /* We blocked threads, so safe to return from here */
+                    RegCloseKey(hkcr);
+                    return NULL;
+                }
+                Py_DECREF(r);
+            }
+            Py_UNBLOCK_THREADS
+            entry = 0;
+        }
+    }
+    if (hkcr) {
+        RegCloseKey(hkcr);
+    }
+    Py_END_ALLOW_THREADS
+
+    if (err != ERROR_SUCCESS && err != ERROR_NO_MORE_ITEMS) {
+        PyErr_SetFromWindowsErr((int)err);
+        return NULL;
+    }
+
+    for (int j = 0; j < entry; ++j) {
+        PyObject *r = PyObject_CallFunction(
+            on_type_read, "uu", entries[j].type, entries[j].ext
+        );
+        if (!r) {
+            return NULL;
+        }
+        Py_DECREF(r);
+    }
+
+    Py_RETURN_NONE;
+#undef CCH_EXT
+#undef CB_TYPE
+}
+
 
 static PyMethodDef winapi_functions[] = {
     _WINAPI_CLOSEHANDLE_METHODDEF
@@ -1917,39 +2033,37 @@
     _WINAPI_WRITEFILE_METHODDEF
     _WINAPI_GETACP_METHODDEF
     _WINAPI_GETFILETYPE_METHODDEF
+    _WINAPI__MIMETYPES_READ_WINDOWS_REGISTRY_METHODDEF
     {NULL, NULL}
 };
 
-static struct PyModuleDef winapi_module = {
-    PyModuleDef_HEAD_INIT,
-    "_winapi",
-    NULL,
-    -1,
-    winapi_functions,
-    NULL,
-    NULL,
-    NULL,
-    NULL
-};
-
 #define WINAPI_CONSTANT(fmt, con) \
-    PyDict_SetItemString(d, #con, Py_BuildValue(fmt, con))
+    do { \
+        PyObject *value = Py_BuildValue(fmt, con); \
+        if (value == NULL) { \
+            return -1; \
+        } \
+        if (PyDict_SetItemString(d, #con, value) < 0) { \
+            Py_DECREF(value); \
+            return -1; \
+        } \
+        Py_DECREF(value); \
+    } while (0)
 
-PyMODINIT_FUNC
-PyInit__winapi(void)
+static int winapi_exec(PyObject *m)
 {
-    PyObject *d;
-    PyObject *m;
+    WinApiState *st = winapi_get_state(m);
 
-    if (PyType_Ready(&OverlappedType) < 0)
-        return NULL;
+    st->overlapped_type = (PyTypeObject *)PyType_FromModuleAndSpec(m, &winapi_overlapped_type_spec, NULL);
+    if (st->overlapped_type == NULL) {
+        return -1;
+    }
 
-    m = PyModule_Create(&winapi_module);
-    if (m == NULL)
-        return NULL;
-    d = PyModule_GetDict(m);
+    if (PyModule_AddType(m, st->overlapped_type) < 0) {
+        return -1;
+    }
 
-    PyDict_SetItemString(d, "Overlapped", (PyObject *) &OverlappedType);
+    PyObject *d = PyModule_GetDict(m);
 
     /* constants */
     WINAPI_CONSTANT(F_DWORD, CREATE_NEW_CONSOLE);
@@ -2048,5 +2162,49 @@
 
     WINAPI_CONSTANT("i", NULL);
 
-    return m;
+    return 0;
+}
+
+static PyModuleDef_Slot winapi_slots[] = {
+    {Py_mod_exec, winapi_exec},
+    {0, NULL}
+};
+
+static int
+winapi_traverse(PyObject *module, visitproc visit, void *arg)
+{
+    WinApiState *st = winapi_get_state(module);
+    Py_VISIT(st->overlapped_type);
+    return 0;
+}
+
+static int
+winapi_clear(PyObject *module)
+{
+    WinApiState *st = winapi_get_state(module);
+    Py_CLEAR(st->overlapped_type);
+    return 0;
+}
+
+static void
+winapi_free(void *module)
+{
+    winapi_clear((PyObject *)module);
+}
+
+static struct PyModuleDef winapi_module = {
+    PyModuleDef_HEAD_INIT,
+    .m_name = "_winapi",
+    .m_size = sizeof(WinApiState),
+    .m_methods = winapi_functions,
+    .m_slots = winapi_slots,
+    .m_traverse = winapi_traverse,
+    .m_clear = winapi_clear,
+    .m_free = winapi_free,
+};
+
+PyMODINIT_FUNC
+PyInit__winapi(void)
+{
+    return PyModuleDef_Init(&winapi_module);
 }
diff --git a/Modules/_xxsubinterpretersmodule.c b/Modules/_xxsubinterpretersmodule.c
index de11c09..9290255 100644
--- a/Modules/_xxsubinterpretersmodule.c
+++ b/Modules/_xxsubinterpretersmodule.c
@@ -1780,7 +1780,12 @@
     0,                              /* tp_getattro */
     0,                              /* tp_setattro */
     0,                              /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
+    // Use Py_TPFLAGS_DISALLOW_INSTANTIATION so the type cannot be instantiated
+    // from Python code.  We do this because there is a strong relationship
+    // between channel IDs and the channel lifecycle, so this limitation avoids
+    // related complications. Use the _channel_id() function instead.
+    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE
+        | Py_TPFLAGS_DISALLOW_INSTANTIATION, /* tp_flags */
     channelid_doc,                  /* tp_doc */
     0,                              /* tp_traverse */
     0,                              /* tp_clear */
@@ -1791,19 +1796,6 @@
     0,                              /* tp_methods */
     0,                              /* tp_members */
     channelid_getsets,              /* tp_getset */
-    0,                              /* tp_base */
-    0,                              /* tp_dict */
-    0,                              /* tp_descr_get */
-    0,                              /* tp_descr_set */
-    0,                              /* tp_dictoffset */
-    0,                              /* tp_init */
-    0,                              /* tp_alloc */
-    // Note that we do not set tp_new to channelid_new.  Instead we
-    // set it to NULL, meaning it cannot be instantiated from Python
-    // code.  We do this because there is a strong relationship between
-    // channel IDs and the channel lifecycle, so this limitation avoids
-    // related complications.
-    NULL,                           /* tp_new */
 };
 
 
@@ -1847,7 +1839,7 @@
         return 0;
     }
 
-    int executing = (int)(frame->f_executing);
+    int executing = _PyFrame_IsExecuting(frame);
     Py_DECREF(frame);
 
     return executing;
@@ -1939,6 +1931,20 @@
         return -1;
     }
 
+#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+    // Switch to interpreter.
+    PyThreadState *new_tstate = PyInterpreterState_ThreadHead(interp);
+    PyThreadState *save1 = PyEval_SaveThread();
+
+    (void)PyThreadState_Swap(new_tstate);
+
+    // Run the script.
+    _sharedexception *exc = NULL;
+    int result = _run_script(interp, codestr, shared, &exc);
+
+    // Switch back.
+    PyEval_RestoreThread(save1);
+#else
     // Switch to interpreter.
     PyThreadState *save_tstate = NULL;
     if (interp != PyInterpreterState_Get()) {
@@ -1956,6 +1962,7 @@
     if (save_tstate != NULL) {
         PyThreadState_Swap(save_tstate);
     }
+#endif
 
     // Propagate any exception out to the caller.
     if (exc != NULL) {
@@ -2010,7 +2017,7 @@
     }
 
     // Create and initialize the new interpreter.
-    PyThreadState *save_tstate = PyThreadState_Swap(NULL);
+    PyThreadState *save_tstate = PyThreadState_Get();
     // XXX Possible GILState issues?
     PyThreadState *tstate = _Py_NewInterpreter(isolated);
     PyThreadState_Swap(save_tstate);
diff --git a/Modules/_xxtestfuzz/fuzzer.c b/Modules/_xxtestfuzz/fuzzer.c
index 6bd2c3a..acbf068 100644
--- a/Modules/_xxtestfuzz/fuzzer.c
+++ b/Modules/_xxtestfuzz/fuzzer.c
@@ -83,7 +83,7 @@
 PyObject* struct_unpack_method = NULL;
 PyObject* struct_error = NULL;
 /* Called by LLVMFuzzerTestOneInput for initialization */
-static int init_struct_unpack() {
+static int init_struct_unpack(void) {
     /* Import struct.unpack */
     PyObject* struct_module = PyImport_ImportModule("struct");
     if (struct_module == NULL) {
@@ -146,7 +146,7 @@
 
 PyObject* json_loads_method = NULL;
 /* Called by LLVMFuzzerTestOneInput for initialization */
-static int init_json_loads() {
+static int init_json_loads(void) {
     /* Import json.loads */
     PyObject* json_module = PyImport_ImportModule("json");
     if (json_module == NULL) {
@@ -192,7 +192,7 @@
 PyObject* sre_error_exception = NULL;
 int SRE_FLAG_DEBUG = 0;
 /* Called by LLVMFuzzerTestOneInput for initialization */
-static int init_sre_compile() {
+static int init_sre_compile(void) {
     /* Import sre_compile.compile and sre.error */
     PyObject* sre_compile_module = PyImport_ImportModule("sre_compile");
     if (sre_compile_module == NULL) {
@@ -284,7 +284,7 @@
 const size_t NUM_PATTERNS = sizeof(regex_patterns) / sizeof(regex_patterns[0]);
 PyObject** compiled_patterns = NULL;
 /* Called by LLVMFuzzerTestOneInput for initialization */
-static int init_sre_match() {
+static int init_sre_match(void) {
     PyObject* re_module = PyImport_ImportModule("re");
     if (re_module == NULL) {
         return 0;
@@ -339,7 +339,7 @@
 PyObject* csv_module = NULL;
 PyObject* csv_error = NULL;
 /* Called by LLVMFuzzerTestOneInput for initialization */
-static int init_csv_reader() {
+static int init_csv_reader(void) {
     /* Import csv and csv.Error */
     csv_module = PyImport_ImportModule("csv");
     if (csv_module == NULL) {
@@ -354,7 +354,7 @@
         return 0;
     }
     /* Ignore non null-terminated strings since _csv can't handle
-       embeded nulls */
+       embedded nulls */
     if (memchr(data, '\0', size) == NULL) {
         return 0;
     }
@@ -383,7 +383,7 @@
     }
 
     /* Ignore csv.Error because we're probably going to generate
-       some bad files (embeded new-lines, unterminated quotes etc) */
+       some bad files (embedded new-lines, unterminated quotes etc) */
     if (PyErr_ExceptionMatches(csv_error)) {
         PyErr_Clear();
     }
diff --git a/Modules/_zoneinfo.c b/Modules/_zoneinfo.c
index 2cee65f..0388d27 100644
--- a/Modules/_zoneinfo.c
+++ b/Modules/_zoneinfo.c
@@ -1,4 +1,5 @@
 #include "Python.h"
+#include "pycore_long.h"          // _PyLong_GetOne()
 #include "structmember.h"
 
 #include <ctype.h>
@@ -163,7 +164,7 @@
 static size_t
 _bisect(const int64_t value, const int64_t *arr, size_t size);
 
-static void
+static int
 eject_from_strong_cache(const PyTypeObject *const type, PyObject *key);
 static void
 clear_strong_cache(const PyTypeObject *const type);
@@ -171,7 +172,7 @@
 update_strong_cache(const PyTypeObject *const type, PyObject *key,
                     PyObject *zone);
 static PyObject *
-zone_from_strong_cache(const PyTypeObject *const type, PyObject *key);
+zone_from_strong_cache(const PyTypeObject *const type, PyObject *const key);
 
 static PyObject *
 zoneinfo_new_instance(PyTypeObject *type, PyObject *key)
@@ -265,7 +266,7 @@
     }
 
     PyObject *instance = zone_from_strong_cache(type, key);
-    if (instance != NULL) {
+    if (instance != NULL || PyErr_Occurred()) {
         return instance;
     }
 
@@ -428,7 +429,10 @@
 
         while ((item = PyIter_Next(iter))) {
             // Remove from strong cache
-            eject_from_strong_cache(type, item);
+            if (eject_from_strong_cache(type, item) < 0) {
+                Py_DECREF(item);
+                break;
+            }
 
             // Remove from weak cache
             PyObject *tmp = PyObject_CallMethodObjArgs(weak_cache, pop, item,
@@ -484,9 +488,7 @@
     return tti->tzname;
 }
 
-#define HASTZINFO(p) (((_PyDateTime_BaseTZInfo *)(p))->hastzinfo)
-#define GET_DT_TZINFO(p) \
-    (HASTZINFO(p) ? ((PyDateTime_DateTime *)(p))->tzinfo : Py_None)
+#define GET_DT_TZINFO PyDateTime_DATE_GET_TZINFO
 
 static PyObject *
 zoneinfo_fromutc(PyObject *obj_self, PyObject *dt)
@@ -587,7 +589,7 @@
             }
 
             dt = NULL;
-            if (!PyDict_SetItemString(kwargs, "fold", _PyLong_One)) {
+            if (!PyDict_SetItemString(kwargs, "fold", _PyLong_GetOne())) {
                 dt = PyObject_Call(replace, args, kwargs);
             }
 
@@ -724,17 +726,16 @@
 static PyObject *
 load_timedelta(long seconds)
 {
-    PyObject *rv = NULL;
+    PyObject *rv;
     PyObject *pyoffset = PyLong_FromLong(seconds);
     if (pyoffset == NULL) {
         return NULL;
     }
-    int contains = PyDict_Contains(TIMEDELTA_CACHE, pyoffset);
-    if (contains == -1) {
-        goto error;
-    }
-
-    if (!contains) {
+    rv = PyDict_GetItemWithError(TIMEDELTA_CACHE, pyoffset);
+    if (rv == NULL) {
+        if (PyErr_Occurred()) {
+            goto error;
+        }
         PyObject *tmp = PyDateTimeAPI->Delta_FromDelta(
             0, seconds, 0, 1, PyDateTimeAPI->DeltaType);
 
@@ -745,12 +746,9 @@
         rv = PyDict_SetDefault(TIMEDELTA_CACHE, pyoffset, tmp);
         Py_DECREF(tmp);
     }
-    else {
-        rv = PyDict_GetItem(TIMEDELTA_CACHE, pyoffset);
-    }
 
+    Py_XINCREF(rv);
     Py_DECREF(pyoffset);
-    Py_INCREF(rv);
     return rv;
 error:
     Py_DECREF(pyoffset);
@@ -909,7 +907,13 @@
     // Load the transition indices and list
     self->trans_list_utc =
         PyMem_Malloc(self->num_transitions * sizeof(int64_t));
+    if (self->trans_list_utc == NULL) {
+        goto error;
+    }
     trans_idx = PyMem_Malloc(self->num_transitions * sizeof(Py_ssize_t));
+    if (trans_idx == NULL) {
+        goto error;
+    }
 
     for (size_t i = 0; i < self->num_transitions; ++i) {
         PyObject *num = PyTuple_GetItem(trans_utc, i);
@@ -991,6 +995,9 @@
 
     // Build _ttinfo objects from utcoff, dstoff and abbr
     self->_ttinfos = PyMem_Malloc(self->num_ttinfos * sizeof(_ttinfo));
+    if (self->_ttinfos == NULL) {
+        goto error;
+    }
     for (size_t i = 0; i < self->num_ttinfos; ++i) {
         PyObject *tzname = PyTuple_GetItem(abbr, i);
         if (tzname == NULL) {
@@ -1006,6 +1013,9 @@
     // Build our mapping from transition to the ttinfo that applies
     self->trans_ttinfos =
         PyMem_Calloc(self->num_transitions, sizeof(_ttinfo *));
+    if (self->trans_ttinfos == NULL) {
+        goto error;
+    }
     for (size_t i = 0; i < self->num_transitions; ++i) {
         size_t ttinfo_idx = trans_idx[i];
         assert(ttinfo_idx < self->num_ttinfos);
@@ -1219,15 +1229,9 @@
         return -1;
     }
 
-    // day is an unsigned integer, so day < 0 should always return false, but
-    // if day's type changes to a signed integer *without* changing this value,
-    // it may create a bug. Considering that the compiler should be able to
-    // optimize out the first comparison if day is an unsigned integer anyway,
-    // we will leave this comparison in place and disable the compiler warning.
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wtype-limits"
-    if (day < 0 || day > 6) {
-#pragma GCC diagnostic pop
+    // If the 'day' parameter type is changed to a signed type,
+    // "day < 0" check must be added.
+    if (/* day < 0 || */ day > 6) {
         PyErr_Format(PyExc_ValueError, "Day must be in [0, 6]");
         return -1;
     }
@@ -1338,7 +1342,7 @@
  * could technically be calculated from the timestamp, but given that the
  * callers of this function already have the year information accessible from
  * the datetime struct, it is taken as an additional parameter to reduce
- * unncessary calculation.
+ * unnecessary calculation.
  * */
 static _ttinfo *
 find_tzrule_ttinfo(_tzrule *rule, int64_t ts, unsigned char fold, int year)
@@ -1464,11 +1468,11 @@
     long std_offset = 1 << 20;
     long dst_offset = 1 << 20;
 
-    char *tz_str = PyBytes_AsString(tz_str_obj);
+    const char *tz_str = PyBytes_AsString(tz_str_obj);
     if (tz_str == NULL) {
         return -1;
     }
-    char *p = tz_str;
+    const char *p = tz_str;
 
     // Read the `std` abbreviation, which must be at least 3 characters long.
     Py_ssize_t num_chars = parse_abbr(p, &std_abbr);
@@ -2341,7 +2345,11 @@
 {
     const StrongCacheNode *node = root;
     while (node != NULL) {
-        if (PyObject_RichCompareBool(key, node->key, Py_EQ)) {
+        int rv = PyObject_RichCompareBool(key, node->key, Py_EQ);
+        if (rv < 0) {
+            return NULL;
+        }
+        if (rv) {
             return (StrongCacheNode *)node;
         }
 
@@ -2355,11 +2363,11 @@
  *
  * This function is used to enable the per-key functionality in clear_cache.
  */
-static void
+static int
 eject_from_strong_cache(const PyTypeObject *const type, PyObject *key)
 {
     if (type != &PyZoneInfo_ZoneInfoType) {
-        return;
+        return 0;
     }
 
     StrongCacheNode *node = find_in_strong_cache(ZONEINFO_STRONG_CACHE, key);
@@ -2368,6 +2376,10 @@
 
         strong_cache_node_free(node);
     }
+    else if (PyErr_Occurred()) {
+        return -1;
+    }
+    return 0;
 }
 
 /* Moves a node to the front of the LRU cache.
@@ -2524,7 +2536,11 @@
         return NULL;
     }
 
-    PyObject_SetAttrString((PyObject *)cls, "_weak_cache", weak_cache);
+    if (PyObject_SetAttrString((PyObject *)cls, "_weak_cache",
+                               weak_cache) < 0) {
+        Py_DECREF(weak_cache);
+        return NULL;
+    }
     Py_DECREF(weak_cache);
     Py_RETURN_NONE;
 }
@@ -2592,7 +2608,7 @@
 // Specify the _zoneinfo module
 static PyMethodDef module_methods[] = {{NULL, NULL}};
 static void
-module_free()
+module_free(void *m)
 {
     Py_XDECREF(_tzpath_find_tzfile);
     _tzpath_find_tzfile = NULL;
@@ -2624,6 +2640,9 @@
 zoneinfomodule_exec(PyObject *m)
 {
     PyDateTime_IMPORT;
+    if (PyDateTimeAPI == NULL) {
+        goto error;
+    }
     PyZoneInfo_ZoneInfoType.tp_base = PyDateTimeAPI->TZInfoType;
     if (PyType_Ready(&PyZoneInfo_ZoneInfoType) < 0) {
         goto error;
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index 724c503..72b9011 100644
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -5,6 +5,8 @@
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
+#include "pycore_moduleobject.h"  // _PyModule_GetState()
+#include "structmember.h"         // PyMemberDef
 #include <stddef.h>               // offsetof()
 
 #ifdef STDC_HEADERS
@@ -21,6 +23,7 @@
 /*[clinic end generated code: output=da39a3ee5e6b4b0d input=7d1b8d7f5958fd83]*/
 
 struct arrayobject; /* Forward */
+static struct PyModuleDef arraymodule;
 
 /* All possible arraydescr values are defined in the vector "descriptors"
  * below.  That's defined later because the appropriate get and set
@@ -46,8 +49,6 @@
     Py_ssize_t ob_exports;  /* Number of exported buffers */
 } arrayobject;
 
-static PyTypeObject Arraytype;
-
 typedef struct {
     PyObject_HEAD
     Py_ssize_t index;
@@ -55,9 +56,21 @@
     PyObject* (*getitem)(struct arrayobject *, Py_ssize_t);
 } arrayiterobject;
 
-static PyTypeObject PyArrayIter_Type;
+typedef struct {
+    PyTypeObject *ArrayType;
+    PyTypeObject *ArrayIterType;
+} array_state;
 
-#define PyArrayIter_Check(op) PyObject_TypeCheck(op, &PyArrayIter_Type)
+static array_state *
+get_array_state(PyObject *module)
+{
+    return (array_state *)_PyModule_GetState(module);
+}
+
+#define find_array_state_by_type(tp) \
+    (get_array_state(_PyType_GetModuleByDef(tp, &arraymodule)))
+#define get_array_state_by_class(cls) \
+    (get_array_state(PyType_GetModule(cls)))
 
 enum machine_format_code {
     UNKNOWN_FORMAT = -1,
@@ -105,8 +118,7 @@
  */
 #include "clinic/arraymodule.c.h"
 
-#define array_Check(op) PyObject_TypeCheck(op, &Arraytype)
-#define array_CheckExact(op) Py_IS_TYPE(op, &Arraytype)
+#define array_Check(op, state) PyObject_TypeCheck(op, state->ArrayType)
 
 static int
 array_resize(arrayobject *self, Py_ssize_t newsize)
@@ -133,7 +145,7 @@
     }
 
     if (newsize == 0) {
-        PyMem_FREE(self->ob_item);
+        PyMem_Free(self->ob_item);
         self->ob_item = NULL;
         Py_SET_SIZE(self, 0);
         self->allocated = 0;
@@ -337,17 +349,6 @@
         (unsigned long) ((unsigned int *)ap->ob_item)[i]);
 }
 
-static PyObject *
-get_int_unless_float(PyObject *v)
-{
-    if (PyFloat_Check(v)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "array item must be integer");
-        return NULL;
-    }
-    return _PyLong_FromNbIndexOrNbInt(v);
-}
-
 static int
 II_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
 {
@@ -355,7 +356,7 @@
     int do_decref = 0; /* if nb_int was called */
 
     if (!PyLong_Check(v)) {
-        v = get_int_unless_float(v);
+        v = _PyNumber_Index(v);
         if (NULL == v) {
             return -1;
         }
@@ -415,7 +416,7 @@
     int do_decref = 0; /* if nb_int was called */
 
     if (!PyLong_Check(v)) {
-        v = get_int_unless_float(v);
+        v = _PyNumber_Index(v);
         if (NULL == v) {
             return -1;
         }
@@ -468,7 +469,7 @@
     int do_decref = 0; /* if nb_int was called */
 
     if (!PyLong_Check(v)) {
-        v = get_int_unless_float(v);
+        v = _PyNumber_Index(v);
         if (NULL == v) {
             return -1;
         }
@@ -573,9 +574,9 @@
 Implementations of array object methods.
 ****************************************************************************/
 /*[clinic input]
-class array.array "arrayobject *" "&Arraytype"
+class array.array "arrayobject *" "ArrayType"
 [clinic start generated code]*/
-/*[clinic end generated code: output=da39a3ee5e6b4b0d input=ad43d37e942a8854]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=a5c29edf59f176a3]*/
 
 static PyObject *
 newarrayobject(PyTypeObject *type, Py_ssize_t size, const struct arraydescr *descr)
@@ -618,8 +619,11 @@
 static PyObject *
 getarrayitem(PyObject *op, Py_ssize_t i)
 {
+#ifndef NDEBUG
+    array_state *state = find_array_state_by_type(Py_TYPE(op));
+    assert(array_Check(op, state));
+#endif
     arrayobject *ap;
-    assert(array_Check(op));
     ap = (arrayobject *)op;
     assert(i>=0 && i<Py_SIZE(ap));
     return (*ap->ob_descr->getitem)(ap, i);
@@ -657,26 +661,38 @@
 
 /* Methods */
 
+static int
+array_tp_traverse(arrayobject *op, visitproc visit, void *arg)
+{
+    Py_VISIT(Py_TYPE(op));
+    return 0;
+}
+
 static void
 array_dealloc(arrayobject *op)
 {
+    PyTypeObject *tp = Py_TYPE(op);
+    PyObject_GC_UnTrack(op);
+
     if (op->weakreflist != NULL)
         PyObject_ClearWeakRefs((PyObject *) op);
     if (op->ob_item != NULL)
-        PyMem_DEL(op->ob_item);
-    Py_TYPE(op)->tp_free((PyObject *)op);
+        PyMem_Free(op->ob_item);
+    tp->tp_free(op);
+    Py_DECREF(tp);
 }
 
 static PyObject *
 array_richcompare(PyObject *v, PyObject *w, int op)
 {
+    array_state *state = find_array_state_by_type(Py_TYPE(v));
     arrayobject *va, *wa;
     PyObject *vi = NULL;
     PyObject *wi = NULL;
     Py_ssize_t i, k;
     PyObject *res;
 
-    if (!array_Check(v) || !array_Check(w))
+    if (!array_Check(v, state) || !array_Check(w, state))
         Py_RETURN_NOTIMPLEMENTED;
 
     va = (arrayobject *)v;
@@ -798,7 +814,9 @@
 static PyObject *
 array_slice(arrayobject *a, Py_ssize_t ilow, Py_ssize_t ihigh)
 {
+    array_state *state = find_array_state_by_type(Py_TYPE(a));
     arrayobject *np;
+
     if (ilow < 0)
         ilow = 0;
     else if (ilow > Py_SIZE(a))
@@ -809,7 +827,7 @@
         ihigh = ilow;
     else if (ihigh > Py_SIZE(a))
         ihigh = Py_SIZE(a);
-    np = (arrayobject *) newarrayobject(&Arraytype, ihigh - ilow, a->ob_descr);
+    np = (arrayobject *) newarrayobject(state->ArrayType, ihigh - ilow, a->ob_descr);
     if (np == NULL)
         return NULL;
     if (ihigh > ilow) {
@@ -852,9 +870,10 @@
 static PyObject *
 array_concat(arrayobject *a, PyObject *bb)
 {
+    array_state *state = find_array_state_by_type(Py_TYPE(a));
     Py_ssize_t size;
     arrayobject *np;
-    if (!array_Check(bb)) {
+    if (!array_Check(bb, state)) {
         PyErr_Format(PyExc_TypeError,
              "can only append array (not \"%.200s\") to array",
                  Py_TYPE(bb)->tp_name);
@@ -869,7 +888,7 @@
         return PyErr_NoMemory();
     }
     size = Py_SIZE(a) + Py_SIZE(b);
-    np = (arrayobject *) newarrayobject(&Arraytype, size, a->ob_descr);
+    np = (arrayobject *) newarrayobject(state->ArrayType, size, a->ob_descr);
     if (np == NULL) {
         return NULL;
     }
@@ -887,6 +906,7 @@
 static PyObject *
 array_repeat(arrayobject *a, Py_ssize_t n)
 {
+    array_state *state = find_array_state_by_type(Py_TYPE(a));
     Py_ssize_t size;
     arrayobject *np;
     Py_ssize_t oldbytes, newbytes;
@@ -896,7 +916,7 @@
         return PyErr_NoMemory();
     }
     size = Py_SIZE(a) * n;
-    np = (arrayobject *) newarrayobject(&Arraytype, size, a->ob_descr);
+    np = (arrayobject *) newarrayobject(state->ArrayType, size, a->ob_descr);
     if (np == NULL)
         return NULL;
     if (size == 0)
@@ -969,7 +989,10 @@
 static int
 setarrayitem(PyObject *a, Py_ssize_t i, PyObject *v)
 {
-    assert(array_Check(a));
+#ifndef NDEBUG
+    array_state *state = find_array_state_by_type(Py_TYPE(a));
+    assert(array_Check(a, state));
+#endif
     return array_ass_item((arrayobject *)a, i, v);
 }
 
@@ -997,11 +1020,11 @@
 }
 
 static int
-array_do_extend(arrayobject *self, PyObject *bb)
+array_do_extend(array_state *state, arrayobject *self, PyObject *bb)
 {
     Py_ssize_t size, oldsize, bbsize;
 
-    if (!array_Check(bb))
+    if (!array_Check(bb, state))
         return array_iter_extend(self, bb);
 #define b ((arrayobject *)bb)
     if (self->ob_descr != b->ob_descr) {
@@ -1032,13 +1055,15 @@
 static PyObject *
 array_inplace_concat(arrayobject *self, PyObject *bb)
 {
-    if (!array_Check(bb)) {
+    array_state *state = find_array_state_by_type(Py_TYPE(self));
+
+    if (!array_Check(bb, state)) {
         PyErr_Format(PyExc_TypeError,
             "can only extend array with array (not \"%.200s\")",
             Py_TYPE(bb)->tp_name);
         return NULL;
     }
-    if (array_do_extend(self, bb) == -1)
+    if (array_do_extend(state, self, bb) == -1)
         return NULL;
     Py_INCREF(self);
     return (PyObject *)self;
@@ -1120,18 +1145,32 @@
 array.array.index
 
     v: object
+    start: slice_index(accept={int}) = 0
+    stop: slice_index(accept={int}, c_default="PY_SSIZE_T_MAX") = sys.maxsize
     /
 
 Return index of first occurrence of v in the array.
+
+Raise ValueError if the value is not present.
 [clinic start generated code]*/
 
 static PyObject *
-array_array_index(arrayobject *self, PyObject *v)
-/*[clinic end generated code: output=d48498d325602167 input=cf619898c6649d08]*/
+array_array_index_impl(arrayobject *self, PyObject *v, Py_ssize_t start,
+                       Py_ssize_t stop)
+/*[clinic end generated code: output=c45e777880c99f52 input=089dff7baa7e5a7e]*/
 {
-    Py_ssize_t i;
-
-    for (i = 0; i < Py_SIZE(self); i++) {
+    if (start < 0) {
+        start += Py_SIZE(self);
+        if (start < 0) {
+            start = 0;
+        }
+    }
+    if (stop < 0) {
+        stop += Py_SIZE(self);
+    }
+    // Use Py_SIZE() for every iteration in case the array is mutated
+    // during PyObject_RichCompareBool()
+    for (Py_ssize_t i = start; i < stop && i < Py_SIZE(self); i++) {
         PyObject *selfi;
         int cmp;
 
@@ -1243,6 +1282,7 @@
 /*[clinic input]
 array.array.extend
 
+    cls: defining_class
     bb: object
     /
 
@@ -1250,10 +1290,12 @@
 [clinic start generated code]*/
 
 static PyObject *
-array_array_extend(arrayobject *self, PyObject *bb)
-/*[clinic end generated code: output=bbddbc8e8bef871d input=43be86aba5c31e44]*/
+array_array_extend_impl(arrayobject *self, PyTypeObject *cls, PyObject *bb)
+/*[clinic end generated code: output=e65eb7588f0bc266 input=8eb6817ec4d2cb62]*/
 {
-    if (array_do_extend(self, bb) == -1)
+    array_state *state = get_array_state_by_class(cls);
+
+    if (array_do_extend(state, self, bb) == -1)
         return NULL;
     Py_RETURN_NONE;
 }
@@ -1636,12 +1678,12 @@
     buffer: Py_buffer
     /
 
-Appends items from the string, interpreting it as an array of machine values, as if it had been read from a file using the fromfile() method).
+Appends items from the string, interpreting it as an array of machine values, as if it had been read from a file using the fromfile() method.
 [clinic start generated code]*/
 
 static PyObject *
 array_array_frombytes_impl(arrayobject *self, Py_buffer *buffer)
-/*[clinic end generated code: output=d9842c8f7510a516 input=2bbf2b53ebfcc988]*/
+/*[clinic end generated code: output=d9842c8f7510a516 input=378db226dfac949e]*/
 {
     return frombytes(self, buffer);
 }
@@ -1939,6 +1981,7 @@
                                 PyObject *items)
 /*[clinic end generated code: output=e05263141ba28365 input=2464dc8f4c7736b5]*/
 {
+    array_state *state = get_array_state(module);
     PyObject *converted_items;
     PyObject *result;
     const struct arraydescr *descr;
@@ -1949,10 +1992,10 @@
             Py_TYPE(arraytype)->tp_name);
         return NULL;
     }
-    if (!PyType_IsSubtype(arraytype, &Arraytype)) {
+    if (!PyType_IsSubtype(arraytype, state->ArrayType)) {
         PyErr_Format(PyExc_TypeError,
             "%.200s is not a subtype of %.200s",
-            arraytype->tp_name, Arraytype.tp_name);
+            arraytype->tp_name, state->ArrayType->tp_name);
         return NULL;
     }
     for (descr = descriptors; descr->typecode != '\0'; descr++) {
@@ -2298,6 +2341,8 @@
 static PyObject*
 array_subscr(arrayobject* self, PyObject* item)
 {
+    array_state *state = find_array_state_by_type(Py_TYPE(self));
+
     if (PyIndex_Check(item)) {
         Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError);
         if (i==-1 && PyErr_Occurred()) {
@@ -2321,10 +2366,10 @@
                                             step);
 
         if (slicelength <= 0) {
-            return newarrayobject(&Arraytype, 0, self->ob_descr);
+            return newarrayobject(state->ArrayType, 0, self->ob_descr);
         }
         else if (step == 1) {
-            PyObject *result = newarrayobject(&Arraytype,
+            PyObject *result = newarrayobject(state->ArrayType,
                                     slicelength, self->ob_descr);
             if (result == NULL)
                 return NULL;
@@ -2334,7 +2379,7 @@
             return result;
         }
         else {
-            result = newarrayobject(&Arraytype, slicelength, self->ob_descr);
+            result = newarrayobject(state->ArrayType, slicelength, self->ob_descr);
             if (!result) return NULL;
 
             ar = (arrayobject*)result;
@@ -2360,6 +2405,7 @@
 array_ass_subscr(arrayobject* self, PyObject* item, PyObject* value)
 {
     Py_ssize_t start, stop, step, slicelength, needed;
+    array_state* state = find_array_state_by_type(Py_TYPE(self));
     arrayobject* other;
     int itemsize;
 
@@ -2401,7 +2447,7 @@
         other = NULL;
         needed = 0;
     }
-    else if (array_Check(value)) {
+    else if (array_Check(value, state)) {
         other = (arrayobject *)value;
         needed = Py_SIZE(other);
         if (self == other) {
@@ -2513,12 +2559,6 @@
     }
 }
 
-static PyMappingMethods array_as_mapping = {
-    (lenfunc)array_length,
-    (binaryfunc)array_subscr,
-    (objobjargproc)array_ass_subscr
-};
-
 static const void *emptybuf = "";
 
 
@@ -2536,14 +2576,14 @@
     Py_INCREF(self);
     if (view->buf == NULL)
         view->buf = (void *)emptybuf;
-    view->len = (Py_SIZE(self)) * self->ob_descr->itemsize;
+    view->len = Py_SIZE(self) * self->ob_descr->itemsize;
     view->readonly = 0;
     view->ndim = 1;
     view->itemsize = self->ob_descr->itemsize;
     view->suboffsets = NULL;
     view->shape = NULL;
     if ((flags & PyBUF_ND)==PyBUF_ND) {
-        view->shape = &((Py_SIZE(self)));
+        view->shape = &((PyVarObject*)self)->ob_size;
     }
     view->strides = NULL;
     if ((flags & PyBUF_STRIDES)==PyBUF_STRIDES)
@@ -2569,32 +2609,15 @@
     self->ob_exports--;
 }
 
-static PySequenceMethods array_as_sequence = {
-    (lenfunc)array_length,                      /*sq_length*/
-    (binaryfunc)array_concat,               /*sq_concat*/
-    (ssizeargfunc)array_repeat,                 /*sq_repeat*/
-    (ssizeargfunc)array_item,                           /*sq_item*/
-    0,                                          /*sq_slice*/
-    (ssizeobjargproc)array_ass_item,                    /*sq_ass_item*/
-    0,                                          /*sq_ass_slice*/
-    (objobjproc)array_contains,                 /*sq_contains*/
-    (binaryfunc)array_inplace_concat,           /*sq_inplace_concat*/
-    (ssizeargfunc)array_inplace_repeat          /*sq_inplace_repeat*/
-};
-
-static PyBufferProcs array_as_buffer = {
-    (getbufferproc)array_buffer_getbuf,
-    (releasebufferproc)array_buffer_relbuf
-};
-
 static PyObject *
 array_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 {
+    array_state *state = find_array_state_by_type(type);
     int c;
     PyObject *initial = NULL, *it = NULL;
     const struct arraydescr *descr;
 
-    if (type == &Arraytype && !_PyArg_NoKeywords("array.array", kwds))
+    if (type == state->ArrayType && !_PyArg_NoKeywords("array.array", kwds))
         return NULL;
 
     if (!PyArg_ParseTuple(args, "C|O:array", &c, &initial))
@@ -2611,7 +2634,7 @@
                          "an array with typecode '%c'", c);
             return NULL;
         }
-        else if (array_Check(initial) &&
+        else if (array_Check(initial, state) &&
                  ((arrayobject*)initial)->ob_descr->typecode == 'u') {
             PyErr_Format(PyExc_TypeError, "cannot use a unicode array to "
                          "initialize an array with typecode '%c'", c);
@@ -2624,7 +2647,7 @@
           || PyBytes_Check(initial)
           || PyTuple_Check(initial)
           || ((c=='u') && PyUnicode_Check(initial))
-          || (array_Check(initial)
+          || (array_Check(initial, state)
               && c == ((arrayobject*)initial)->ob_descr->typecode))) {
         it = PyObject_GetIter(initial);
         if (it == NULL)
@@ -2645,7 +2668,7 @@
                 len = 0;
             else if (PyList_Check(initial))
                 len = PyList_GET_SIZE(initial);
-            else if (PyTuple_Check(initial) || array_Check(initial))
+            else if (PyTuple_Check(initial) || array_Check(initial, state))
                 len = Py_SIZE(initial);
             else
                 len = 0;
@@ -2654,7 +2677,7 @@
             if (a == NULL)
                 return NULL;
 
-            if (len > 0 && !array_Check(initial)) {
+            if (len > 0 && !array_Check(initial, state)) {
                 Py_ssize_t i;
                 for (i = 0; i < len; i++) {
                     PyObject *v =
@@ -2699,7 +2722,7 @@
                     self->allocated = n;
                 }
             }
-            else if (initial != NULL && array_Check(initial) && len > 0) {
+            else if (initial != NULL && array_Check(initial, state) && len > 0) {
                 arrayobject *self = (arrayobject *)a;
                 arrayobject *other = (arrayobject *)initial;
                 memcpy(self->ob_item, other->ob_item, len * other->ob_descr->itemsize);
@@ -2788,67 +2811,75 @@
 
 static PyObject *array_iter(arrayobject *ao);
 
-static PyTypeObject Arraytype = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "array.array",
-    sizeof(arrayobject),
-    0,
-    (destructor)array_dealloc,                  /* tp_dealloc */
-    0,                                          /* tp_vectorcall_offset */
-    0,                                          /* tp_getattr */
-    0,                                          /* tp_setattr */
-    0,                                          /* tp_as_async */
-    (reprfunc)array_repr,                       /* tp_repr */
-    0,                                          /* tp_as_number*/
-    &array_as_sequence,                         /* tp_as_sequence*/
-    &array_as_mapping,                          /* tp_as_mapping*/
-    0,                                          /* tp_hash */
-    0,                                          /* tp_call */
-    0,                                          /* tp_str */
-    PyObject_GenericGetAttr,                    /* tp_getattro */
-    0,                                          /* tp_setattro */
-    &array_as_buffer,                           /* tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
-    arraytype_doc,                              /* tp_doc */
-    0,                                          /* tp_traverse */
-    0,                                          /* tp_clear */
-    array_richcompare,                          /* tp_richcompare */
-    offsetof(arrayobject, weakreflist),         /* tp_weaklistoffset */
-    (getiterfunc)array_iter,                    /* tp_iter */
-    0,                                          /* tp_iternext */
-    array_methods,                              /* tp_methods */
-    0,                                          /* tp_members */
-    array_getsets,                              /* tp_getset */
-    0,                                          /* tp_base */
-    0,                                          /* tp_dict */
-    0,                                          /* tp_descr_get */
-    0,                                          /* tp_descr_set */
-    0,                                          /* tp_dictoffset */
-    0,                                          /* tp_init */
-    PyType_GenericAlloc,                        /* tp_alloc */
-    array_new,                                  /* tp_new */
-    PyObject_Del,                               /* tp_free */
+static struct PyMemberDef array_members[] = {
+    {"__weaklistoffset__", T_PYSSIZET, offsetof(arrayobject, weakreflist), READONLY},
+    {NULL},
 };
 
+static PyType_Slot array_slots[] = {
+    {Py_tp_dealloc, array_dealloc},
+    {Py_tp_repr, array_repr},
+    {Py_tp_getattro, PyObject_GenericGetAttr},
+    {Py_tp_doc, (void *)arraytype_doc},
+    {Py_tp_richcompare, array_richcompare},
+    {Py_tp_iter, array_iter},
+    {Py_tp_methods, array_methods},
+    {Py_tp_members, array_members},
+    {Py_tp_getset, array_getsets},
+    {Py_tp_alloc, PyType_GenericAlloc},
+    {Py_tp_new, array_new},
+    {Py_tp_traverse, array_tp_traverse},
+
+    /* as sequence */
+    {Py_sq_length, array_length},
+    {Py_sq_concat, array_concat},
+    {Py_sq_repeat, array_repeat},
+    {Py_sq_item, array_item},
+    {Py_sq_ass_item, array_ass_item},
+    {Py_sq_contains, array_contains},
+    {Py_sq_inplace_concat, array_inplace_concat},
+    {Py_sq_inplace_repeat, array_inplace_repeat},
+
+    /* as mapping */
+    {Py_mp_length, array_length},
+    {Py_mp_subscript, array_subscr},
+    {Py_mp_ass_subscript, array_ass_subscr},
+
+    /* as buffer */
+    {Py_bf_getbuffer, array_buffer_getbuf},
+    {Py_bf_releasebuffer, array_buffer_relbuf},
+
+    {0, NULL},
+};
+
+static PyType_Spec array_spec = {
+    .name = "array.array",
+    .basicsize = sizeof(arrayobject),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
+              Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_HAVE_GC |
+              Py_TPFLAGS_SEQUENCE),
+    .slots = array_slots,
+};
 
 /*********************** Array Iterator **************************/
 
 /*[clinic input]
-class array.arrayiterator "arrayiterobject *" "&PyArrayIter_Type"
+class array.arrayiterator "arrayiterobject *" "find_array_state_by_type(type)->ArrayIterType"
 [clinic start generated code]*/
-/*[clinic end generated code: output=da39a3ee5e6b4b0d input=5aefd2d74d8c8e30]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=fb46d5ef98dd95ff]*/
 
 static PyObject *
 array_iter(arrayobject *ao)
 {
+    array_state *state = find_array_state_by_type(Py_TYPE(ao));
     arrayiterobject *it;
 
-    if (!array_Check(ao)) {
+    if (!array_Check(ao, state)) {
         PyErr_BadInternalCall();
         return NULL;
     }
 
-    it = PyObject_GC_New(arrayiterobject, &PyArrayIter_Type);
+    it = PyObject_GC_New(arrayiterobject, state->ArrayIterType);
     if (it == NULL)
         return NULL;
 
@@ -2866,12 +2897,17 @@
     arrayobject *ao;
 
     assert(it != NULL);
-    assert(PyArrayIter_Check(it));
+#ifndef NDEBUG
+    array_state *state = find_array_state_by_type(Py_TYPE(it));
+    assert(PyObject_TypeCheck(it, state->ArrayIterType));
+#endif
     ao = it->ao;
     if (ao == NULL) {
         return NULL;
     }
-    assert(array_Check(ao));
+#ifndef NDEBUG
+    assert(array_Check(ao, state));
+#endif
     if (it->index < Py_SIZE(ao)) {
         return (*it->getitem)(ao, it->index++);
     }
@@ -2883,14 +2919,18 @@
 static void
 arrayiter_dealloc(arrayiterobject *it)
 {
+    PyTypeObject *tp = Py_TYPE(it);
+
     PyObject_GC_UnTrack(it);
     Py_XDECREF(it->ao);
     PyObject_GC_Del(it);
+    Py_DECREF(tp);
 }
 
 static int
 arrayiter_traverse(arrayiterobject *it, visitproc visit, void *arg)
 {
+    Py_VISIT(Py_TYPE(it));
     Py_VISIT(it->ao);
     return 0;
 }
@@ -2943,66 +2983,104 @@
     {NULL, NULL} /* sentinel */
 };
 
-static PyTypeObject PyArrayIter_Type = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "arrayiterator",                        /* tp_name */
-    sizeof(arrayiterobject),                /* tp_basicsize */
-    0,                                      /* tp_itemsize */
-    /* methods */
-    (destructor)arrayiter_dealloc,              /* tp_dealloc */
-    0,                                      /* tp_vectorcall_offset */
-    0,                                      /* tp_getattr */
-    0,                                      /* tp_setattr */
-    0,                                      /* tp_as_async */
-    0,                                      /* tp_repr */
-    0,                                      /* tp_as_number */
-    0,                                      /* tp_as_sequence */
-    0,                                      /* tp_as_mapping */
-    0,                                      /* tp_hash */
-    0,                                      /* tp_call */
-    0,                                      /* tp_str */
-    PyObject_GenericGetAttr,                /* tp_getattro */
-    0,                                      /* tp_setattro */
-    0,                                      /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */
-    0,                                      /* tp_doc */
-    (traverseproc)arrayiter_traverse,           /* tp_traverse */
-    0,                                          /* tp_clear */
-    0,                                      /* tp_richcompare */
-    0,                                      /* tp_weaklistoffset */
-    PyObject_SelfIter,                          /* tp_iter */
-    (iternextfunc)arrayiter_next,               /* tp_iternext */
-    arrayiter_methods,                      /* tp_methods */
+static PyType_Slot arrayiter_slots[] = {
+    {Py_tp_dealloc, arrayiter_dealloc},
+    {Py_tp_getattro, PyObject_GenericGetAttr},
+    {Py_tp_traverse, arrayiter_traverse},
+    {Py_tp_iter, PyObject_SelfIter},
+    {Py_tp_iternext, arrayiter_next},
+    {Py_tp_methods, arrayiter_methods},
+    {0, NULL},
+};
+
+static PyType_Spec arrayiter_spec = {
+    .name = "array.arrayiterator",
+    .basicsize = sizeof(arrayiterobject),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
+              Py_TPFLAGS_DISALLOW_INSTANTIATION | Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = arrayiter_slots,
 };
 
 
 /*********************** Install Module **************************/
 
+static int
+array_traverse(PyObject *module, visitproc visit, void *arg)
+{
+    array_state *state = get_array_state(module);
+    Py_VISIT(state->ArrayType);
+    Py_VISIT(state->ArrayIterType);
+    return 0;
+}
+
+static int
+array_clear(PyObject *module)
+{
+    array_state *state = get_array_state(module);
+    Py_CLEAR(state->ArrayType);
+    Py_CLEAR(state->ArrayIterType);
+    return 0;
+}
+
+static void
+array_free(void *module)
+{
+    array_clear((PyObject *)module);
+}
+
 /* No functions in array module. */
 static PyMethodDef a_methods[] = {
     ARRAY__ARRAY_RECONSTRUCTOR_METHODDEF
     {NULL, NULL, 0, NULL}        /* Sentinel */
 };
 
+#define CREATE_TYPE(module, type, spec)                                  \
+do {                                                                     \
+    type = (PyTypeObject *)PyType_FromModuleAndSpec(module, spec, NULL); \
+    if (type == NULL) {                                                  \
+        return -1;                                                       \
+    }                                                                    \
+} while (0)
+
 static int
 array_modexec(PyObject *m)
 {
+    array_state *state = get_array_state(m);
     char buffer[Py_ARRAY_LENGTH(descriptors)], *p;
     PyObject *typecodes;
     const struct arraydescr *descr;
 
-    if (PyType_Ready(&Arraytype) < 0)
-        return -1;
-    Py_SET_TYPE(&PyArrayIter_Type, &PyType_Type);
+    CREATE_TYPE(m, state->ArrayType, &array_spec);
+    CREATE_TYPE(m, state->ArrayIterType, &arrayiter_spec);
+    Py_SET_TYPE(state->ArrayIterType, &PyType_Type);
 
-    Py_INCREF((PyObject *)&Arraytype);
-    if (PyModule_AddObject(m, "ArrayType", (PyObject *)&Arraytype) < 0) {
-        Py_DECREF((PyObject *)&Arraytype);
+    Py_INCREF((PyObject *)state->ArrayType);
+    if (PyModule_AddObject(m, "ArrayType", (PyObject *)state->ArrayType) < 0) {
+        Py_DECREF((PyObject *)state->ArrayType);
         return -1;
     }
-    Py_INCREF((PyObject *)&Arraytype);
-    if (PyModule_AddObject(m, "array", (PyObject *)&Arraytype) < 0) {
-        Py_DECREF((PyObject *)&Arraytype);
+
+    PyObject *abc_mod = PyImport_ImportModule("collections.abc");
+    if (!abc_mod) {
+        Py_DECREF((PyObject *)state->ArrayType);
+        return -1;
+    }
+    PyObject *mutablesequence = PyObject_GetAttrString(abc_mod, "MutableSequence");
+    Py_DECREF(abc_mod);
+    if (!mutablesequence) {
+        Py_DECREF((PyObject *)state->ArrayType);
+        return -1;
+    }
+    PyObject *res = PyObject_CallMethod(mutablesequence, "register", "O",
+                                        (PyObject *)state->ArrayType);
+    Py_DECREF(mutablesequence);
+    if (!res) {
+        Py_DECREF((PyObject *)state->ArrayType);
+        return -1;
+    }
+    Py_DECREF(res);
+
+    if (PyModule_AddType(m, state->ArrayType) < 0) {
         return -1;
     }
 
@@ -3026,15 +3104,15 @@
 
 
 static struct PyModuleDef arraymodule = {
-    PyModuleDef_HEAD_INIT,
-    "array",
-    module_doc,
-    0,
-    a_methods,
-    arrayslots,
-    NULL,
-    NULL,
-    NULL
+    .m_base = PyModuleDef_HEAD_INIT,
+    .m_name = "array",
+    .m_size = sizeof(array_state),
+    .m_doc = module_doc,
+    .m_methods = a_methods,
+    .m_slots = arrayslots,
+    .m_traverse = array_traverse,
+    .m_clear = array_clear,
+    .m_free = array_free,
 };
 
 
diff --git a/Modules/atexitmodule.c b/Modules/atexitmodule.c
index 8cef64c..95c653c 100644
--- a/Modules/atexitmodule.c
+++ b/Modules/atexitmodule.c
@@ -7,117 +7,122 @@
  */
 
 #include "Python.h"
-
-/* Forward declaration (for atexit_cleanup) */
-static PyObject *atexit_clear(PyObject*, PyObject*);
-/* Forward declaration of module object */
-static struct PyModuleDef atexitmodule;
+#include "pycore_initconfig.h"    // _PyStatus_NO_MEMORY
+#include "pycore_interp.h"        // PyInterpreterState.atexit
+#include "pycore_pystate.h"       // _PyInterpreterState_GET
 
 /* ===================================================================== */
 /* Callback machinery. */
 
-typedef struct {
-    PyObject *func;
-    PyObject *args;
-    PyObject *kwargs;
-} atexit_callback;
-
-typedef struct {
-    atexit_callback **atexit_callbacks;
-    int ncallbacks;
-    int callback_len;
-} atexitmodule_state;
-
-static inline atexitmodule_state*
-get_atexit_state(PyObject *module)
+static inline struct atexit_state*
+get_atexit_state(void)
 {
-    void *state = PyModule_GetState(module);
-    assert(state != NULL);
-    return (atexitmodule_state *)state;
+    PyInterpreterState *interp = _PyInterpreterState_GET();
+    return &interp->atexit;
 }
 
 
 static void
-atexit_delete_cb(atexitmodule_state *modstate, int i)
+atexit_delete_cb(struct atexit_state *state, int i)
 {
-    atexit_callback *cb;
+    atexit_callback *cb = state->callbacks[i];
+    state->callbacks[i] = NULL;
 
-    cb = modstate->atexit_callbacks[i];
-    modstate->atexit_callbacks[i] = NULL;
     Py_DECREF(cb->func);
     Py_DECREF(cb->args);
     Py_XDECREF(cb->kwargs);
     PyMem_Free(cb);
 }
 
+
 /* Clear all callbacks without calling them */
 static void
-atexit_cleanup(atexitmodule_state *modstate)
+atexit_cleanup(struct atexit_state *state)
 {
     atexit_callback *cb;
-    int i;
-    for (i = 0; i < modstate->ncallbacks; i++) {
-        cb = modstate->atexit_callbacks[i];
+    for (int i = 0; i < state->ncallbacks; i++) {
+        cb = state->callbacks[i];
         if (cb == NULL)
             continue;
 
-        atexit_delete_cb(modstate, i);
+        atexit_delete_cb(state, i);
     }
-    modstate->ncallbacks = 0;
+    state->ncallbacks = 0;
 }
 
-/* Installed into pylifecycle.c's atexit mechanism */
+
+PyStatus
+_PyAtExit_Init(PyInterpreterState *interp)
+{
+    struct atexit_state *state = &interp->atexit;
+    // _PyAtExit_Init() must only be called once
+    assert(state->callbacks == NULL);
+
+    state->callback_len = 32;
+    state->ncallbacks = 0;
+    state->callbacks = PyMem_New(atexit_callback*, state->callback_len);
+    if (state->callbacks == NULL) {
+        return _PyStatus_NO_MEMORY();
+    }
+    return _PyStatus_OK();
+}
+
+
+void
+_PyAtExit_Fini(PyInterpreterState *interp)
+{
+    struct atexit_state *state = &interp->atexit;
+    atexit_cleanup(state);
+    PyMem_Free(state->callbacks);
+    state->callbacks = NULL;
+}
+
 
 static void
-atexit_callfuncs(PyObject *module)
+atexit_callfuncs(struct atexit_state *state)
 {
-    PyObject *exc_type = NULL, *exc_value, *exc_tb, *r;
-    atexit_callback *cb;
-    atexitmodule_state *modstate;
-    int i;
+    assert(!PyErr_Occurred());
 
-    if (module == NULL)
+    if (state->ncallbacks == 0) {
         return;
-    modstate = get_atexit_state(module);
-
-    if (modstate->ncallbacks == 0)
-        return;
-
-
-    for (i = modstate->ncallbacks - 1; i >= 0; i--)
-    {
-        cb = modstate->atexit_callbacks[i];
-        if (cb == NULL)
-            continue;
-
-        r = PyObject_Call(cb->func, cb->args, cb->kwargs);
-        Py_XDECREF(r);
-        if (r == NULL) {
-            /* Maintain the last exception, but don't leak if there are
-               multiple exceptions. */
-            if (exc_type) {
-                Py_DECREF(exc_type);
-                Py_XDECREF(exc_value);
-                Py_XDECREF(exc_tb);
-            }
-            PyErr_Fetch(&exc_type, &exc_value, &exc_tb);
-            if (!PyErr_GivenExceptionMatches(exc_type, PyExc_SystemExit)) {
-                PySys_WriteStderr("Error in atexit._run_exitfuncs:\n");
-                PyErr_NormalizeException(&exc_type, &exc_value, &exc_tb);
-                PyErr_Display(exc_type, exc_value, exc_tb);
-            }
-        }
     }
 
-    atexit_cleanup(modstate);
+    for (int i = state->ncallbacks - 1; i >= 0; i--) {
+        atexit_callback *cb = state->callbacks[i];
+        if (cb == NULL) {
+            continue;
+        }
 
-    if (exc_type)
-        PyErr_Restore(exc_type, exc_value, exc_tb);
+        // bpo-46025: Increment the refcount of cb->func as the call itself may unregister it
+        PyObject* the_func = Py_NewRef(cb->func);
+        PyObject *res = PyObject_Call(cb->func, cb->args, cb->kwargs);
+        if (res == NULL) {
+            _PyErr_WriteUnraisableMsg("in atexit callback", the_func);
+        }
+        else {
+            Py_DECREF(res);
+        }
+        Py_DECREF(the_func);
+    }
+
+    atexit_cleanup(state);
+
+    assert(!PyErr_Occurred());
 }
 
+
+void
+_PyAtExit_Call(PyInterpreterState *interp)
+{
+    struct atexit_state *state = &interp->atexit;
+    atexit_callfuncs(state);
+}
+
+
 /* ===================================================================== */
 /* Module methods. */
 
+
 PyDoc_STRVAR(atexit_register__doc__,
 "register(func, *args, **kwargs) -> func\n\
 \n\
@@ -130,68 +135,63 @@
     func is returned to facilitate usage as a decorator.");
 
 static PyObject *
-atexit_register(PyObject *self, PyObject *args, PyObject *kwargs)
+atexit_register(PyObject *module, PyObject *args, PyObject *kwargs)
 {
-    atexitmodule_state *modstate;
-    atexit_callback *new_callback;
-    PyObject *func = NULL;
-
-    modstate = get_atexit_state(self);
-
-    if (modstate->ncallbacks >= modstate->callback_len) {
-        atexit_callback **r;
-        modstate->callback_len += 16;
-        r = (atexit_callback**)PyMem_Realloc(modstate->atexit_callbacks,
-                                      sizeof(atexit_callback*) * modstate->callback_len);
-        if (r == NULL)
-            return PyErr_NoMemory();
-        modstate->atexit_callbacks = r;
-    }
-
     if (PyTuple_GET_SIZE(args) == 0) {
         PyErr_SetString(PyExc_TypeError,
                 "register() takes at least 1 argument (0 given)");
         return NULL;
     }
 
-    func = PyTuple_GET_ITEM(args, 0);
+    PyObject *func = PyTuple_GET_ITEM(args, 0);
     if (!PyCallable_Check(func)) {
         PyErr_SetString(PyExc_TypeError,
                 "the first argument must be callable");
         return NULL;
     }
 
-    new_callback = PyMem_Malloc(sizeof(atexit_callback));
-    if (new_callback == NULL)
-        return PyErr_NoMemory();
+    struct atexit_state *state = get_atexit_state();
+    if (state->ncallbacks >= state->callback_len) {
+        atexit_callback **r;
+        state->callback_len += 16;
+        size_t size = sizeof(atexit_callback*) * (size_t)state->callback_len;
+        r = (atexit_callback**)PyMem_Realloc(state->callbacks, size);
+        if (r == NULL) {
+            return PyErr_NoMemory();
+        }
+        state->callbacks = r;
+    }
 
-    new_callback->args = PyTuple_GetSlice(args, 1, PyTuple_GET_SIZE(args));
-    if (new_callback->args == NULL) {
-        PyMem_Free(new_callback);
+    atexit_callback *callback = PyMem_Malloc(sizeof(atexit_callback));
+    if (callback == NULL) {
+        return PyErr_NoMemory();
+    }
+
+    callback->args = PyTuple_GetSlice(args, 1, PyTuple_GET_SIZE(args));
+    if (callback->args == NULL) {
+        PyMem_Free(callback);
         return NULL;
     }
-    new_callback->func = func;
-    new_callback->kwargs = kwargs;
-    Py_INCREF(func);
-    Py_XINCREF(kwargs);
+    callback->func = Py_NewRef(func);
+    callback->kwargs = Py_XNewRef(kwargs);
 
-    modstate->atexit_callbacks[modstate->ncallbacks++] = new_callback;
+    state->callbacks[state->ncallbacks++] = callback;
 
-    Py_INCREF(func);
-    return func;
+    return Py_NewRef(func);
 }
 
 PyDoc_STRVAR(atexit_run_exitfuncs__doc__,
 "_run_exitfuncs() -> None\n\
 \n\
-Run all registered exit functions.");
+Run all registered exit functions.\n\
+\n\
+If a callaback raises an exception, it is logged with sys.unraisablehook.");
 
 static PyObject *
-atexit_run_exitfuncs(PyObject *self, PyObject *unused)
+atexit_run_exitfuncs(PyObject *module, PyObject *unused)
 {
-    atexit_callfuncs(self);
-    if (PyErr_Occurred())
-        return NULL;
+    struct atexit_state *state = get_atexit_state();
+    atexit_callfuncs(state);
     Py_RETURN_NONE;
 }
 
@@ -201,9 +201,9 @@
 Clear the list of previously registered exit functions.");
 
 static PyObject *
-atexit_clear(PyObject *self, PyObject *unused)
+atexit_clear(PyObject *module, PyObject *unused)
 {
-    atexit_cleanup(get_atexit_state(self));
+    atexit_cleanup(get_atexit_state());
     Py_RETURN_NONE;
 }
 
@@ -213,50 +213,10 @@
 Return the number of registered exit functions.");
 
 static PyObject *
-atexit_ncallbacks(PyObject *self, PyObject *unused)
+atexit_ncallbacks(PyObject *module, PyObject *unused)
 {
-    atexitmodule_state *modstate;
-
-    modstate = get_atexit_state(self);
-
-    return PyLong_FromSsize_t(modstate->ncallbacks);
-}
-
-static int
-atexit_m_traverse(PyObject *self, visitproc visit, void *arg)
-{
-    int i;
-    atexitmodule_state *modstate;
-
-    modstate = (atexitmodule_state *)PyModule_GetState(self);
-
-    for (i = 0; i < modstate->ncallbacks; i++) {
-        atexit_callback *cb = modstate->atexit_callbacks[i];
-        if (cb == NULL)
-            continue;
-        Py_VISIT(cb->func);
-        Py_VISIT(cb->args);
-        Py_VISIT(cb->kwargs);
-    }
-    return 0;
-}
-
-static int
-atexit_m_clear(PyObject *self)
-{
-    atexitmodule_state *modstate;
-    modstate = (atexitmodule_state *)PyModule_GetState(self);
-    atexit_cleanup(modstate);
-    return 0;
-}
-
-static void
-atexit_free(PyObject *m)
-{
-    atexitmodule_state *modstate;
-    modstate = (atexitmodule_state *)PyModule_GetState(m);
-    atexit_cleanup(modstate);
-    PyMem_Free(modstate->atexit_callbacks);
+    struct atexit_state *state = get_atexit_state();
+    return PyLong_FromSsize_t(state->ncallbacks);
 }
 
 PyDoc_STRVAR(atexit_unregister__doc__,
@@ -268,29 +228,28 @@
     func - function to be unregistered");
 
 static PyObject *
-atexit_unregister(PyObject *self, PyObject *func)
+atexit_unregister(PyObject *module, PyObject *func)
 {
-    atexitmodule_state *modstate;
-    atexit_callback *cb;
-    int i, eq;
-
-    modstate = get_atexit_state(self);
-
-    for (i = 0; i < modstate->ncallbacks; i++)
+    struct atexit_state *state = get_atexit_state();
+    for (int i = 0; i < state->ncallbacks; i++)
     {
-        cb = modstate->atexit_callbacks[i];
-        if (cb == NULL)
+        atexit_callback *cb = state->callbacks[i];
+        if (cb == NULL) {
             continue;
+        }
 
-        eq = PyObject_RichCompareBool(cb->func, func, Py_EQ);
-        if (eq < 0)
+        int eq = PyObject_RichCompareBool(cb->func, func, Py_EQ);
+        if (eq < 0) {
             return NULL;
-        if (eq)
-            atexit_delete_cb(modstate, i);
+        }
+        if (eq) {
+            atexit_delete_cb(state, i);
+        }
     }
     Py_RETURN_NONE;
 }
 
+
 static PyMethodDef atexit_methods[] = {
     {"register", (PyCFunction)(void(*)(void)) atexit_register, METH_VARARGS|METH_KEYWORDS,
         atexit_register__doc__},
@@ -305,47 +264,23 @@
     {NULL, NULL}        /* sentinel */
 };
 
+
 /* ===================================================================== */
 /* Initialization function. */
 
 PyDoc_STRVAR(atexit__doc__,
-"allow programmer to define multiple exit functions to be executed\
+"allow programmer to define multiple exit functions to be executed\n\
 upon normal program termination.\n\
 \n\
 Two public functions, register and unregister, are defined.\n\
 ");
 
-static int
-atexit_exec(PyObject *m) {
-    atexitmodule_state *modstate;
-
-    modstate = get_atexit_state(m);
-    modstate->callback_len = 32;
-    modstate->ncallbacks = 0;
-    modstate->atexit_callbacks = PyMem_New(atexit_callback*,
-                                           modstate->callback_len);
-    if (modstate->atexit_callbacks == NULL)
-        return -1;
-
-    _Py_PyAtExit(atexit_callfuncs, m);
-    return 0;
-}
-
-static PyModuleDef_Slot atexit_slots[] = {
-    {Py_mod_exec, atexit_exec},
-    {0, NULL}
-};
-
 static struct PyModuleDef atexitmodule = {
     PyModuleDef_HEAD_INIT,
-    "atexit",
-    atexit__doc__,
-    sizeof(atexitmodule_state),
-    atexit_methods,
-    atexit_slots,
-    atexit_m_traverse,
-    atexit_m_clear,
-    (freefunc)atexit_free
+    .m_name = "atexit",
+    .m_doc = atexit__doc__,
+    .m_size = 0,
+    .m_methods = atexit_methods,
 };
 
 PyMODINIT_FUNC
diff --git a/Modules/audioop.c b/Modules/audioop.c
index 3aeb6f0..2a5d805 100644
--- a/Modules/audioop.c
+++ b/Modules/audioop.c
@@ -5,13 +5,6 @@
 
 #include "Python.h"
 
-#if defined(__CHAR_UNSIGNED__)
-#if defined(signed)
-/* This module currently does not work on systems where only unsigned
-   characters are available.  Take it out of Setup.  Sorry. */
-#endif
-#endif
-
 static const int maxvals[] = {0, 0x7F, 0x7FFF, 0x7FFFFF, 0x7FFFFFFF};
 /* -1 trick is needed on Windows to support -0x80000000 without a warning */
 static const int minvals[] = {0, -0x80, -0x8000, -0x800000, -0x7FFFFFFF-1};
diff --git a/Modules/cjkcodecs/cjkcodecs.h b/Modules/cjkcodecs/cjkcodecs.h
index e41755b..ba8fad2 100644
--- a/Modules/cjkcodecs/cjkcodecs.h
+++ b/Modules/cjkcodecs/cjkcodecs.h
@@ -245,15 +245,13 @@
 static PyObject *
 getmultibytecodec(void)
 {
-    static PyObject *cofunc = NULL;
-
-    if (cofunc == NULL) {
-        PyObject *mod = PyImport_ImportModuleNoBlock("_multibytecodec");
-        if (mod == NULL)
-            return NULL;
-        cofunc = PyObject_GetAttrString(mod, "__create_codec");
-        Py_DECREF(mod);
+    PyObject *mod = PyImport_ImportModuleNoBlock("_multibytecodec");
+    if (mod == NULL) {
+        return NULL;
     }
+
+    PyObject *cofunc = PyObject_GetAttrString(mod, "__create_codec");
+    Py_DECREF(mod);
     return cofunc;
 }
 
@@ -293,14 +291,11 @@
 
     r = PyObject_CallOneArg(cofunc, codecobj);
     Py_DECREF(codecobj);
+    Py_DECREF(cofunc);
 
     return r;
 }
 
-static struct PyMethodDef __methods[] = {
-    {"getcodec", (PyCFunction)getcodec, METH_O, ""},
-    {NULL, NULL},
-};
 
 static int
 register_maps(PyObject *module)
@@ -309,12 +304,17 @@
 
     for (h = mapping_list; h->charset[0] != '\0'; h++) {
         char mhname[256] = "__map_";
-        int r;
         strcpy(mhname + sizeof("__map_") - 1, h->charset);
-        r = PyModule_AddObject(module, mhname,
-                        PyCapsule_New((void *)h, PyMultibyteCodec_CAPSULE_NAME, NULL));
-        if (r == -1)
+
+        PyObject *capsule = PyCapsule_New((void *)h,
+                                          PyMultibyteCodec_CAPSULE_NAME, NULL);
+        if (capsule == NULL) {
             return -1;
+        }
+        if (PyModule_AddObject(module, mhname, capsule) < 0) {
+            Py_DECREF(capsule);
+            return -1;
+        }
     }
     return 0;
 }
@@ -395,25 +395,36 @@
 }
 #endif
 
+static int
+_cjk_exec(PyObject *module)
+{
+    return register_maps(module);
+}
+
+
+static struct PyMethodDef _cjk_methods[] = {
+    {"getcodec", (PyCFunction)getcodec, METH_O, ""},
+    {NULL, NULL},
+};
+
+static PyModuleDef_Slot _cjk_slots[] = {
+    {Py_mod_exec, _cjk_exec},
+    {0, NULL}
+};
+
 #define I_AM_A_MODULE_FOR(loc)                                          \
-    static struct PyModuleDef __module = {                              \
+    static struct PyModuleDef _cjk_module = {                           \
         PyModuleDef_HEAD_INIT,                                          \
-        "_codecs_"#loc,                                                 \
-        NULL,                                                           \
-        0,                                                              \
-        __methods,                                                      \
-        NULL,                                                           \
-        NULL,                                                           \
-        NULL,                                                           \
-        NULL                                                            \
+        .m_name = "_codecs_"#loc,                                       \
+        .m_size = 0,                                                    \
+        .m_methods = _cjk_methods,                                      \
+        .m_slots = _cjk_slots,                                          \
     };                                                                  \
+                                                                        \
     PyMODINIT_FUNC                                                      \
     PyInit__codecs_##loc(void)                                          \
     {                                                                   \
-        PyObject *m = PyModule_Create(&__module);                       \
-        if (m != NULL)                                                  \
-            (void)register_maps(m);                                     \
-        return m;                                                       \
+        return PyModuleDef_Init(&_cjk_module);                          \
     }
 
 #endif
diff --git a/Modules/cjkcodecs/clinic/multibytecodec.c.h b/Modules/cjkcodecs/clinic/multibytecodec.c.h
index 5ddbbe2..5638883 100644
--- a/Modules/cjkcodecs/clinic/multibytecodec.c.h
+++ b/Modules/cjkcodecs/clinic/multibytecodec.c.h
@@ -171,11 +171,6 @@
     if (!noptargs) {
         goto skip_optional_pos;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     final = _PyLong_AsInt(args[1]);
     if (final == -1 && PyErr_Occurred()) {
         goto exit;
@@ -288,11 +283,6 @@
     if (!noptargs) {
         goto skip_optional_pos;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     final = _PyLong_AsInt(args[1]);
     if (final == -1 && PyErr_Occurred()) {
         goto exit;
@@ -525,4 +515,4 @@
 
 #define _MULTIBYTECODEC___CREATE_CODEC_METHODDEF    \
     {"__create_codec", (PyCFunction)_multibytecodec___create_codec, METH_O, _multibytecodec___create_codec__doc__},
-/*[clinic end generated code: output=5ce6fd4ca1f95620 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=5c0f74129db07c87 input=a9049054013a1b77]*/
diff --git a/Modules/cjkcodecs/multibytecodec.c b/Modules/cjkcodecs/multibytecodec.c
index 8640276..ba558d0 100644
--- a/Modules/cjkcodecs/multibytecodec.c
+++ b/Modules/cjkcodecs/multibytecodec.c
@@ -10,11 +10,44 @@
 #include "multibytecodec.h"
 #include "clinic/multibytecodec.c.h"
 
+#define MODULE_NAME "_multibytecodec"
+
+typedef struct {
+    PyTypeObject *encoder_type;
+    PyTypeObject *decoder_type;
+    PyTypeObject *reader_type;
+    PyTypeObject *writer_type;
+    PyTypeObject *multibytecodec_type;
+} _multibytecodec_state;
+
+static _multibytecodec_state *
+_multibytecodec_get_state(PyObject *module)
+{
+    _multibytecodec_state *state = PyModule_GetState(module);
+    assert(state != NULL);
+    return state;
+}
+
+static struct PyModuleDef _multibytecodecmodule;
+static _multibytecodec_state *
+_multibyte_codec_find_state_by_type(PyTypeObject *type)
+{
+    PyObject *module = _PyType_GetModuleByDef(type, &_multibytecodecmodule);
+    assert(module != NULL);
+    return _multibytecodec_get_state(module);
+}
+
+#define clinic_get_state() _multibyte_codec_find_state_by_type(type)
 /*[clinic input]
 module _multibytecodec
-class _multibytecodec.MultibyteCodec "MultibyteCodecObject *" "&MultibyteCodec_Type"
+class _multibytecodec.MultibyteCodec "MultibyteCodecObject *" "clinic_get_state()->multibytecodec_type"
+class _multibytecodec.MultibyteIncrementalEncoder "MultibyteIncrementalEncoderObject *" "clinic_get_state()->encoder_type"
+class _multibytecodec.MultibyteIncrementalDecoder "MultibyteIncrementalDecoderObject *" "clinic_get_state()->decoder_type"
+class _multibytecodec.MultibyteStreamReader "MultibyteStreamReaderObject *" "clinic_get_state()->reader_type"
+class _multibytecodec.MultibyteStreamWriter "MultibyteStreamWriterObject *" "clinic_get_state()->writer_type"
 [clinic start generated code]*/
-/*[clinic end generated code: output=da39a3ee5e6b4b0d input=6ad689546cbb5450]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=305a76dfdd24b99c]*/
+#undef clinic_get_state
 
 typedef struct {
     PyObject            *inobj;
@@ -688,42 +721,36 @@
     {NULL, NULL},
 };
 
+static int
+multibytecodec_traverse(PyObject *self, visitproc visit, void *arg)
+{
+    Py_VISIT(Py_TYPE(self));
+    return 0;
+}
+
 static void
 multibytecodec_dealloc(MultibyteCodecObject *self)
 {
-    PyObject_Del(self);
+    PyObject_GC_UnTrack(self);
+    PyTypeObject *tp = Py_TYPE(self);
+    tp->tp_free(self);
+    Py_DECREF(tp);
 }
 
-static PyTypeObject MultibyteCodec_Type = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "MultibyteCodec",                   /* tp_name */
-    sizeof(MultibyteCodecObject),       /* tp_basicsize */
-    0,                                  /* tp_itemsize */
-    /* methods */
-    (destructor)multibytecodec_dealloc, /* tp_dealloc */
-    0,                                  /* tp_vectorcall_offset */
-    0,                                  /* tp_getattr */
-    0,                                  /* tp_setattr */
-    0,                                  /* tp_as_async */
-    0,                                  /* tp_repr */
-    0,                                  /* tp_as_number */
-    0,                                  /* tp_as_sequence */
-    0,                                  /* tp_as_mapping */
-    0,                                  /* tp_hash */
-    0,                                  /* tp_call */
-    0,                                  /* tp_str */
-    PyObject_GenericGetAttr,            /* tp_getattro */
-    0,                                  /* tp_setattro */
-    0,                                  /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT,                 /* tp_flags */
-    0,                                  /* tp_doc */
-    0,                                  /* tp_traverse */
-    0,                                  /* tp_clear */
-    0,                                  /* tp_richcompare */
-    0,                                  /* tp_weaklistoffset */
-    0,                                  /* tp_iter */
-    0,                                  /* tp_iterext */
-    multibytecodec_methods,             /* tp_methods */
+static PyType_Slot multibytecodec_slots[] = {
+    {Py_tp_dealloc, multibytecodec_dealloc},
+    {Py_tp_getattro, PyObject_GenericGetAttr},
+    {Py_tp_methods, multibytecodec_methods},
+    {Py_tp_traverse, multibytecodec_traverse},
+    {0, NULL},
+};
+
+static PyType_Spec multibytecodec_spec = {
+    .name = MODULE_NAME ".MultibyteCodec",
+    .basicsize = sizeof(MultibyteCodecObject),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
+              Py_TPFLAGS_DISALLOW_INSTANTIATION | Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = multibytecodec_slots,
 };
 
 
@@ -869,11 +896,6 @@
 
 
 /*[clinic input]
- class _multibytecodec.MultibyteIncrementalEncoder "MultibyteIncrementalEncoderObject *" "&MultibyteIncrementalEncoder_Type"
-[clinic start generated code]*/
-/*[clinic end generated code: output=da39a3ee5e6b4b0d input=3be82909cd08924d]*/
-
-/*[clinic input]
 _multibytecodec.MultibyteIncrementalEncoder.encode
 
     input: object
@@ -1024,7 +1046,9 @@
     codec = PyObject_GetAttrString((PyObject *)type, "codec");
     if (codec == NULL)
         goto errorexit;
-    if (!MultibyteCodec_Check(codec)) {
+
+    _multibytecodec_state *state = _multibyte_codec_find_state_by_type(type);
+    if (!MultibyteCodec_Check(state, codec)) {
         PyErr_SetString(PyExc_TypeError, "codec is unexpected type");
         goto errorexit;
     }
@@ -1065,60 +1089,33 @@
 static void
 mbiencoder_dealloc(MultibyteIncrementalEncoderObject *self)
 {
+    PyTypeObject *tp = Py_TYPE(self);
     PyObject_GC_UnTrack(self);
     ERROR_DECREF(self->errors);
     Py_CLEAR(self->pending);
-    Py_TYPE(self)->tp_free(self);
+    tp->tp_free(self);
+    Py_DECREF(tp);
 }
 
-static PyTypeObject MultibyteIncrementalEncoder_Type = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "MultibyteIncrementalEncoder",      /* tp_name */
-    sizeof(MultibyteIncrementalEncoderObject), /* tp_basicsize */
-    0,                                  /* tp_itemsize */
-    /*  methods  */
-    (destructor)mbiencoder_dealloc, /* tp_dealloc */
-    0,                                  /* tp_vectorcall_offset */
-    0,                                  /* tp_getattr */
-    0,                                  /* tp_setattr */
-    0,                                  /* tp_as_async */
-    0,                                  /* tp_repr */
-    0,                                  /* tp_as_number */
-    0,                                  /* tp_as_sequence */
-    0,                                  /* tp_as_mapping */
-    0,                                  /* tp_hash */
-    0,                                  /* tp_call */
-    0,                                  /* tp_str */
-    PyObject_GenericGetAttr,            /* tp_getattro */
-    0,                                  /* tp_setattro */
-    0,                                  /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC
-        | Py_TPFLAGS_BASETYPE,          /* tp_flags */
-    0,                                  /* tp_doc */
-    (traverseproc)mbiencoder_traverse,          /* tp_traverse */
-    0,                                  /* tp_clear */
-    0,                                  /* tp_richcompare */
-    0,                                  /* tp_weaklistoffset */
-    0,                                  /* tp_iter */
-    0,                                  /* tp_iterext */
-    mbiencoder_methods,                 /* tp_methods */
-    0,                                  /* tp_members */
-    codecctx_getsets,                   /* tp_getset */
-    0,                                  /* tp_base */
-    0,                                  /* tp_dict */
-    0,                                  /* tp_descr_get */
-    0,                                  /* tp_descr_set */
-    0,                                  /* tp_dictoffset */
-    mbiencoder_init,                    /* tp_init */
-    0,                                  /* tp_alloc */
-    mbiencoder_new,                     /* tp_new */
+static PyType_Slot encoder_slots[] = {
+    {Py_tp_dealloc, mbiencoder_dealloc},
+    {Py_tp_getattro, PyObject_GenericGetAttr},
+    {Py_tp_traverse, mbiencoder_traverse},
+    {Py_tp_methods, mbiencoder_methods},
+    {Py_tp_getset, codecctx_getsets},
+    {Py_tp_init, mbiencoder_init},
+    {Py_tp_new, mbiencoder_new},
+    {0, NULL},
 };
 
+static PyType_Spec encoder_spec = {
+    .name = MODULE_NAME ".MultibyteIncrementalEncoder",
+    .basicsize = sizeof(MultibyteIncrementalEncoderObject),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE |
+              Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = encoder_slots,
+};
 
-/*[clinic input]
- class _multibytecodec.MultibyteIncrementalDecoder "MultibyteIncrementalDecoderObject *" "&MultibyteIncrementalDecoder_Type"
-[clinic start generated code]*/
-/*[clinic end generated code: output=da39a3ee5e6b4b0d input=f6003faaf2cea692]*/
 
 /*[clinic input]
 _multibytecodec.MultibyteIncrementalDecoder.decode
@@ -1191,13 +1188,13 @@
         goto errorexit;
 
     if (wdata != data)
-        PyMem_Del(wdata);
+        PyMem_Free(wdata);
     Py_XDECREF(buf.excobj);
     return res;
 
 errorexit:
     if (wdata != NULL && wdata != data)
-        PyMem_Del(wdata);
+        PyMem_Free(wdata);
     Py_XDECREF(buf.excobj);
     _PyUnicodeWriter_Dealloc(&buf.writer);
     return NULL;
@@ -1324,7 +1321,9 @@
     codec = PyObject_GetAttrString((PyObject *)type, "codec");
     if (codec == NULL)
         goto errorexit;
-    if (!MultibyteCodec_Check(codec)) {
+
+    _multibytecodec_state *state = _multibyte_codec_find_state_by_type(type);
+    if (!MultibyteCodec_Check(state, codec)) {
         PyErr_SetString(PyExc_TypeError, "codec is unexpected type");
         goto errorexit;
     }
@@ -1365,59 +1364,31 @@
 static void
 mbidecoder_dealloc(MultibyteIncrementalDecoderObject *self)
 {
+    PyTypeObject *tp = Py_TYPE(self);
     PyObject_GC_UnTrack(self);
     ERROR_DECREF(self->errors);
-    Py_TYPE(self)->tp_free(self);
+    tp->tp_free(self);
+    Py_DECREF(tp);
 }
 
-static PyTypeObject MultibyteIncrementalDecoder_Type = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "MultibyteIncrementalDecoder",      /* tp_name */
-    sizeof(MultibyteIncrementalDecoderObject), /* tp_basicsize */
-    0,                                  /* tp_itemsize */
-    /*  methods  */
-    (destructor)mbidecoder_dealloc, /* tp_dealloc */
-    0,                                  /* tp_vectorcall_offset */
-    0,                                  /* tp_getattr */
-    0,                                  /* tp_setattr */
-    0,                                  /* tp_as_async */
-    0,                                  /* tp_repr */
-    0,                                  /* tp_as_number */
-    0,                                  /* tp_as_sequence */
-    0,                                  /* tp_as_mapping */
-    0,                                  /* tp_hash */
-    0,                                  /* tp_call */
-    0,                                  /* tp_str */
-    PyObject_GenericGetAttr,            /* tp_getattro */
-    0,                                  /* tp_setattro */
-    0,                                  /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC
-        | Py_TPFLAGS_BASETYPE,          /* tp_flags */
-    0,                                  /* tp_doc */
-    (traverseproc)mbidecoder_traverse,          /* tp_traverse */
-    0,                                  /* tp_clear */
-    0,                                  /* tp_richcompare */
-    0,                                  /* tp_weaklistoffset */
-    0,                                  /* tp_iter */
-    0,                                  /* tp_iterext */
-    mbidecoder_methods,                 /* tp_methods */
-    0,                                  /* tp_members */
-    codecctx_getsets,                   /* tp_getset */
-    0,                                  /* tp_base */
-    0,                                  /* tp_dict */
-    0,                                  /* tp_descr_get */
-    0,                                  /* tp_descr_set */
-    0,                                  /* tp_dictoffset */
-    mbidecoder_init,                    /* tp_init */
-    0,                                  /* tp_alloc */
-    mbidecoder_new,                     /* tp_new */
+static PyType_Slot decoder_slots[] = {
+    {Py_tp_dealloc, mbidecoder_dealloc},
+    {Py_tp_getattro, PyObject_GenericGetAttr},
+    {Py_tp_traverse, mbidecoder_traverse},
+    {Py_tp_methods, mbidecoder_methods},
+    {Py_tp_getset, codecctx_getsets},
+    {Py_tp_init, mbidecoder_init},
+    {Py_tp_new, mbidecoder_new},
+    {0, NULL},
 };
 
-
-/*[clinic input]
- class _multibytecodec.MultibyteStreamReader "MultibyteStreamReaderObject *" "MultibyteStreamReader_Type"
-[clinic start generated code]*/
-/*[clinic end generated code: output=da39a3ee5e6b4b0d input=d323634b74976f09]*/
+static PyType_Spec decoder_spec = {
+    .name = MODULE_NAME ".MultibyteIncrementalDecoder",
+    .basicsize = sizeof(MultibyteIncrementalDecoderObject),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE |
+              Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = decoder_slots,
+};
 
 static PyObject *
 mbstreamreader_iread(MultibyteStreamReaderObject *self,
@@ -1667,7 +1638,9 @@
     codec = PyObject_GetAttrString((PyObject *)type, "codec");
     if (codec == NULL)
         goto errorexit;
-    if (!MultibyteCodec_Check(codec)) {
+
+    _multibytecodec_state *state = _multibyte_codec_find_state_by_type(type);
+    if (!MultibyteCodec_Check(state, codec)) {
         PyErr_SetString(PyExc_TypeError, "codec is unexpected type");
         goto errorexit;
     }
@@ -1711,60 +1684,33 @@
 static void
 mbstreamreader_dealloc(MultibyteStreamReaderObject *self)
 {
+    PyTypeObject *tp = Py_TYPE(self);
     PyObject_GC_UnTrack(self);
     ERROR_DECREF(self->errors);
     Py_XDECREF(self->stream);
-    Py_TYPE(self)->tp_free(self);
+    tp->tp_free(self);
+    Py_DECREF(tp);
 }
 
-static PyTypeObject MultibyteStreamReader_Type = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "MultibyteStreamReader",            /* tp_name */
-    sizeof(MultibyteStreamReaderObject), /* tp_basicsize */
-    0,                                  /* tp_itemsize */
-    /*  methods  */
-    (destructor)mbstreamreader_dealloc, /* tp_dealloc */
-    0,                                  /* tp_vectorcall_offset */
-    0,                                  /* tp_getattr */
-    0,                                  /* tp_setattr */
-    0,                                  /* tp_as_async */
-    0,                                  /* tp_repr */
-    0,                                  /* tp_as_number */
-    0,                                  /* tp_as_sequence */
-    0,                                  /* tp_as_mapping */
-    0,                                  /* tp_hash */
-    0,                                  /* tp_call */
-    0,                                  /* tp_str */
-    PyObject_GenericGetAttr,            /* tp_getattro */
-    0,                                  /* tp_setattro */
-    0,                                  /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC
-        | Py_TPFLAGS_BASETYPE,          /* tp_flags */
-    0,                                  /* tp_doc */
-    (traverseproc)mbstreamreader_traverse,      /* tp_traverse */
-    0,                                  /* tp_clear */
-    0,                                  /* tp_richcompare */
-    0,                                  /* tp_weaklistoffset */
-    0,                                  /* tp_iter */
-    0,                                  /* tp_iterext */
-    mbstreamreader_methods,             /* tp_methods */
-    mbstreamreader_members,             /* tp_members */
-    codecctx_getsets,                   /* tp_getset */
-    0,                                  /* tp_base */
-    0,                                  /* tp_dict */
-    0,                                  /* tp_descr_get */
-    0,                                  /* tp_descr_set */
-    0,                                  /* tp_dictoffset */
-    mbstreamreader_init,                /* tp_init */
-    0,                                  /* tp_alloc */
-    mbstreamreader_new,                 /* tp_new */
+static PyType_Slot reader_slots[] = {
+    {Py_tp_dealloc, mbstreamreader_dealloc},
+    {Py_tp_getattro, PyObject_GenericGetAttr},
+    {Py_tp_traverse, mbstreamreader_traverse},
+    {Py_tp_methods, mbstreamreader_methods},
+    {Py_tp_members, mbstreamreader_members},
+    {Py_tp_getset, codecctx_getsets},
+    {Py_tp_init, mbstreamreader_init},
+    {Py_tp_new, mbstreamreader_new},
+    {0, NULL},
 };
 
-
-/*[clinic input]
- class _multibytecodec.MultibyteStreamWriter "MultibyteStreamWriterObject *" "&MultibyteStreamWriter_Type"
-[clinic start generated code]*/
-/*[clinic end generated code: output=da39a3ee5e6b4b0d input=cde22780a215d6ac]*/
+static PyType_Spec reader_spec = {
+    .name = MODULE_NAME ".MultibyteStreamReader",
+    .basicsize = sizeof(MultibyteStreamReaderObject),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE |
+              Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = reader_slots,
+};
 
 static int
 mbstreamwriter_iwrite(MultibyteStreamWriterObject *self,
@@ -1899,7 +1845,9 @@
     codec = PyObject_GetAttrString((PyObject *)type, "codec");
     if (codec == NULL)
         goto errorexit;
-    if (!MultibyteCodec_Check(codec)) {
+
+    _multibytecodec_state *state = _multibyte_codec_find_state_by_type(type);
+    if (!MultibyteCodec_Check(state, codec)) {
         PyErr_SetString(PyExc_TypeError, "codec is unexpected type");
         goto errorexit;
     }
@@ -1943,10 +1891,12 @@
 static void
 mbstreamwriter_dealloc(MultibyteStreamWriterObject *self)
 {
+    PyTypeObject *tp = Py_TYPE(self);
     PyObject_GC_UnTrack(self);
     ERROR_DECREF(self->errors);
     Py_XDECREF(self->stream);
-    Py_TYPE(self)->tp_free(self);
+    tp->tp_free(self);
+    Py_DECREF(tp);
 }
 
 static struct PyMethodDef mbstreamwriter_methods[] = {
@@ -1963,47 +1913,24 @@
     {NULL,}
 };
 
-static PyTypeObject MultibyteStreamWriter_Type = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "MultibyteStreamWriter",            /* tp_name */
-    sizeof(MultibyteStreamWriterObject), /* tp_basicsize */
-    0,                                  /* tp_itemsize */
-    /*  methods  */
-    (destructor)mbstreamwriter_dealloc, /* tp_dealloc */
-    0,                                  /* tp_vectorcall_offset */
-    0,                                  /* tp_getattr */
-    0,                                  /* tp_setattr */
-    0,                                  /* tp_as_async */
-    0,                                  /* tp_repr */
-    0,                                  /* tp_as_number */
-    0,                                  /* tp_as_sequence */
-    0,                                  /* tp_as_mapping */
-    0,                                  /* tp_hash */
-    0,                                  /* tp_call */
-    0,                                  /* tp_str */
-    PyObject_GenericGetAttr,            /* tp_getattro */
-    0,                                  /* tp_setattro */
-    0,                                  /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC
-        | Py_TPFLAGS_BASETYPE,          /* tp_flags */
-    0,                                  /* tp_doc */
-    (traverseproc)mbstreamwriter_traverse,      /* tp_traverse */
-    0,                                  /* tp_clear */
-    0,                                  /* tp_richcompare */
-    0,                                  /* tp_weaklistoffset */
-    0,                                  /* tp_iter */
-    0,                                  /* tp_iterext */
-    mbstreamwriter_methods,             /* tp_methods */
-    mbstreamwriter_members,             /* tp_members */
-    codecctx_getsets,                   /* tp_getset */
-    0,                                  /* tp_base */
-    0,                                  /* tp_dict */
-    0,                                  /* tp_descr_get */
-    0,                                  /* tp_descr_set */
-    0,                                  /* tp_dictoffset */
-    mbstreamwriter_init,                /* tp_init */
-    0,                                  /* tp_alloc */
-    mbstreamwriter_new,                 /* tp_new */
+static PyType_Slot writer_slots[] = {
+    {Py_tp_dealloc, mbstreamwriter_dealloc},
+    {Py_tp_getattro, PyObject_GenericGetAttr},
+    {Py_tp_traverse, mbstreamwriter_traverse},
+    {Py_tp_methods, mbstreamwriter_methods},
+    {Py_tp_members, mbstreamwriter_members},
+    {Py_tp_getset, codecctx_getsets},
+    {Py_tp_init, mbstreamwriter_init},
+    {Py_tp_new, mbstreamwriter_new},
+    {0, NULL},
+};
+
+static PyType_Spec writer_spec = {
+    .name = MODULE_NAME ".MultibyteStreamWriter",
+    .basicsize = sizeof(MultibyteStreamWriterObject),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE |
+              Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = writer_slots,
 };
 
 
@@ -2030,59 +1957,104 @@
     if (codec->codecinit != NULL && codec->codecinit(codec->config) != 0)
         return NULL;
 
-    self = PyObject_New(MultibyteCodecObject, &MultibyteCodec_Type);
+    _multibytecodec_state *state = _multibytecodec_get_state(module);
+    self = PyObject_GC_New(MultibyteCodecObject, state->multibytecodec_type);
     if (self == NULL)
         return NULL;
     self->codec = codec;
 
+    PyObject_GC_Track(self);
     return (PyObject *)self;
 }
 
-static struct PyMethodDef __methods[] = {
+static int
+_multibytecodec_traverse(PyObject *mod, visitproc visit, void *arg)
+{
+    _multibytecodec_state *state = _multibytecodec_get_state(mod);
+    Py_VISIT(state->multibytecodec_type);
+    Py_VISIT(state->encoder_type);
+    Py_VISIT(state->decoder_type);
+    Py_VISIT(state->reader_type);
+    Py_VISIT(state->writer_type);
+    return 0;
+}
+
+static int
+_multibytecodec_clear(PyObject *mod)
+{
+    _multibytecodec_state *state = _multibytecodec_get_state(mod);
+    Py_CLEAR(state->multibytecodec_type);
+    Py_CLEAR(state->encoder_type);
+    Py_CLEAR(state->decoder_type);
+    Py_CLEAR(state->reader_type);
+    Py_CLEAR(state->writer_type);
+    return 0;
+}
+
+static void
+_multibytecodec_free(void *mod)
+{
+    _multibytecodec_clear((PyObject *)mod);
+}
+
+#define CREATE_TYPE(module, type, spec)                                      \
+    do {                                                                     \
+        type = (PyTypeObject *)PyType_FromModuleAndSpec(module, spec, NULL); \
+        if (!type) {                                                         \
+            return -1;                                                       \
+        }                                                                    \
+    } while (0)
+
+#define ADD_TYPE(module, type)                    \
+    do {                                          \
+        if (PyModule_AddType(module, type) < 0) { \
+            return -1;                            \
+        }                                         \
+    } while (0)
+
+static int
+_multibytecodec_exec(PyObject *mod)
+{
+    _multibytecodec_state *state = _multibytecodec_get_state(mod);
+    CREATE_TYPE(mod, state->multibytecodec_type, &multibytecodec_spec);
+    CREATE_TYPE(mod, state->encoder_type, &encoder_spec);
+    CREATE_TYPE(mod, state->decoder_type, &decoder_spec);
+    CREATE_TYPE(mod, state->reader_type, &reader_spec);
+    CREATE_TYPE(mod, state->writer_type, &writer_spec);
+
+    ADD_TYPE(mod, state->encoder_type);
+    ADD_TYPE(mod, state->decoder_type);
+    ADD_TYPE(mod, state->reader_type);
+    ADD_TYPE(mod, state->writer_type);
+    return 0;
+}
+
+#undef CREATE_TYPE
+#undef ADD_TYPE
+
+static struct PyMethodDef _multibytecodec_methods[] = {
     _MULTIBYTECODEC___CREATE_CODEC_METHODDEF
     {NULL, NULL},
 };
 
+static PyModuleDef_Slot _multibytecodec_slots[] = {
+    {Py_mod_exec, _multibytecodec_exec},
+    {0, NULL}
+};
 
 static struct PyModuleDef _multibytecodecmodule = {
-    PyModuleDef_HEAD_INIT,
-    "_multibytecodec",
-    NULL,
-    -1,
-    __methods,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    .m_base = PyModuleDef_HEAD_INIT,
+    .m_name = "_multibytecodec",
+    .m_size = sizeof(_multibytecodec_state),
+    .m_methods = _multibytecodec_methods,
+    .m_slots = _multibytecodec_slots,
+    .m_traverse = _multibytecodec_traverse,
+    .m_clear = _multibytecodec_clear,
+    .m_free = _multibytecodec_free,
 };
 
 PyMODINIT_FUNC
 PyInit__multibytecodec(void)
 {
-    PyObject *m;
-    PyTypeObject *typelist[] = {
-        &MultibyteIncrementalEncoder_Type,
-        &MultibyteIncrementalDecoder_Type,
-        &MultibyteStreamReader_Type,
-        &MultibyteStreamWriter_Type
-    };
-
-    if (PyType_Ready(&MultibyteCodec_Type) < 0)
-        return NULL;
-
-    m = PyModule_Create(&_multibytecodecmodule);
-    if (m == NULL)
-        return NULL;
-
-    for (size_t i = 0; i < Py_ARRAY_LENGTH(typelist); i++) {
-        if (PyModule_AddType(m, typelist[i]) < 0) {
-            return NULL;
-        }
-    }
-
-    if (PyErr_Occurred()) {
-        Py_DECREF(m);
-        m = NULL;
-    }
-    return m;
+    return PyModuleDef_Init(&_multibytecodecmodule);
 }
diff --git a/Modules/cjkcodecs/multibytecodec.h b/Modules/cjkcodecs/multibytecodec.h
index 5946821..69404ba 100644
--- a/Modules/cjkcodecs/multibytecodec.h
+++ b/Modules/cjkcodecs/multibytecodec.h
@@ -65,7 +65,7 @@
     MultibyteCodec *codec;
 } MultibyteCodecObject;
 
-#define MultibyteCodec_Check(op) Py_IS_TYPE((op), &MultibyteCodec_Type)
+#define MultibyteCodec_Check(state, op) Py_IS_TYPE((op), state->multibytecodec_type)
 
 #define _MultibyteStatefulCodec_HEAD            \
     PyObject_HEAD                               \
diff --git a/Modules/clinic/_asynciomodule.c.h b/Modules/clinic/_asynciomodule.c.h
index a071efc..c472e65 100644
--- a/Modules/clinic/_asynciomodule.c.h
+++ b/Modules/clinic/_asynciomodule.c.h
@@ -669,6 +669,45 @@
     return _asyncio_get_event_loop_impl(module);
 }
 
+PyDoc_STRVAR(_asyncio__get_event_loop__doc__,
+"_get_event_loop($module, /, stacklevel=3)\n"
+"--\n"
+"\n");
+
+#define _ASYNCIO__GET_EVENT_LOOP_METHODDEF    \
+    {"_get_event_loop", (PyCFunction)(void(*)(void))_asyncio__get_event_loop, METH_FASTCALL|METH_KEYWORDS, _asyncio__get_event_loop__doc__},
+
+static PyObject *
+_asyncio__get_event_loop_impl(PyObject *module, int stacklevel);
+
+static PyObject *
+_asyncio__get_event_loop(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"stacklevel", NULL};
+    static _PyArg_Parser _parser = {NULL, _keywords, "_get_event_loop", 0};
+    PyObject *argsbuf[1];
+    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
+    int stacklevel = 3;
+
+    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
+    if (!args) {
+        goto exit;
+    }
+    if (!noptargs) {
+        goto skip_optional_pos;
+    }
+    stacklevel = _PyLong_AsInt(args[0]);
+    if (stacklevel == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+skip_optional_pos:
+    return_value = _asyncio__get_event_loop_impl(module, stacklevel);
+
+exit:
+    return return_value;
+}
+
 PyDoc_STRVAR(_asyncio_get_running_loop__doc__,
 "get_running_loop($module, /)\n"
 "--\n"
@@ -832,4 +871,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=d0fc522bcbff9d61 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=0d127162ac92e0c0 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_bisectmodule.c.h b/Modules/clinic/_bisectmodule.c.h
index 80ab704..f118f4b 100644
--- a/Modules/clinic/_bisectmodule.c.h
+++ b/Modules/clinic/_bisectmodule.c.h
@@ -3,14 +3,14 @@
 [clinic start generated code]*/
 
 PyDoc_STRVAR(_bisect_bisect_right__doc__,
-"bisect_right($module, /, a, x, lo=0, hi=None)\n"
+"bisect_right($module, /, a, x, lo=0, hi=None, *, key=None)\n"
 "--\n"
 "\n"
 "Return the index where to insert item x in list a, assuming a is sorted.\n"
 "\n"
 "The return value i is such that all e in a[:i] have e <= x, and all e in\n"
-"a[i:] have e > x.  So if x already appears in the list, i points just\n"
-"beyond the rightmost x already there\n"
+"a[i:] have e > x.  So if x already appears in the list, a.insert(i, x) will\n"
+"insert just after the rightmost x already there.\n"
 "\n"
 "Optional args lo (default 0) and hi (default len(a)) bound the\n"
 "slice of a to be searched.");
@@ -20,20 +20,21 @@
 
 static Py_ssize_t
 _bisect_bisect_right_impl(PyObject *module, PyObject *a, PyObject *x,
-                          Py_ssize_t lo, Py_ssize_t hi);
+                          Py_ssize_t lo, Py_ssize_t hi, PyObject *key);
 
 static PyObject *
 _bisect_bisect_right(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
     PyObject *return_value = NULL;
-    static const char * const _keywords[] = {"a", "x", "lo", "hi", NULL};
+    static const char * const _keywords[] = {"a", "x", "lo", "hi", "key", NULL};
     static _PyArg_Parser _parser = {NULL, _keywords, "bisect_right", 0};
-    PyObject *argsbuf[4];
+    PyObject *argsbuf[5];
     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
     PyObject *a;
     PyObject *x;
     Py_ssize_t lo = 0;
     Py_ssize_t hi = -1;
+    PyObject *key = Py_None;
     Py_ssize_t _return_value;
 
     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 4, 0, argsbuf);
@@ -46,14 +47,9 @@
         goto skip_optional_pos;
     }
     if (args[2]) {
-        if (PyFloat_Check(args[2])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         {
             Py_ssize_t ival = -1;
-            PyObject *iobj = PyNumber_Index(args[2]);
+            PyObject *iobj = _PyNumber_Index(args[2]);
             if (iobj != NULL) {
                 ival = PyLong_AsSsize_t(iobj);
                 Py_DECREF(iobj);
@@ -67,11 +63,21 @@
             goto skip_optional_pos;
         }
     }
-    if (!_Py_convert_optional_to_ssize_t(args[3], &hi)) {
-        goto exit;
+    if (args[3]) {
+        if (!_Py_convert_optional_to_ssize_t(args[3], &hi)) {
+            goto exit;
+        }
+        if (!--noptargs) {
+            goto skip_optional_pos;
+        }
     }
 skip_optional_pos:
-    _return_value = _bisect_bisect_right_impl(module, a, x, lo, hi);
+    if (!noptargs) {
+        goto skip_optional_kwonly;
+    }
+    key = args[4];
+skip_optional_kwonly:
+    _return_value = _bisect_bisect_right_impl(module, a, x, lo, hi, key);
     if ((_return_value == -1) && PyErr_Occurred()) {
         goto exit;
     }
@@ -82,7 +88,7 @@
 }
 
 PyDoc_STRVAR(_bisect_insort_right__doc__,
-"insort_right($module, /, a, x, lo=0, hi=None)\n"
+"insort_right($module, /, a, x, lo=0, hi=None, *, key=None)\n"
 "--\n"
 "\n"
 "Insert item x in list a, and keep it sorted assuming a is sorted.\n"
@@ -97,20 +103,21 @@
 
 static PyObject *
 _bisect_insort_right_impl(PyObject *module, PyObject *a, PyObject *x,
-                          Py_ssize_t lo, Py_ssize_t hi);
+                          Py_ssize_t lo, Py_ssize_t hi, PyObject *key);
 
 static PyObject *
 _bisect_insort_right(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
     PyObject *return_value = NULL;
-    static const char * const _keywords[] = {"a", "x", "lo", "hi", NULL};
+    static const char * const _keywords[] = {"a", "x", "lo", "hi", "key", NULL};
     static _PyArg_Parser _parser = {NULL, _keywords, "insort_right", 0};
-    PyObject *argsbuf[4];
+    PyObject *argsbuf[5];
     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
     PyObject *a;
     PyObject *x;
     Py_ssize_t lo = 0;
     Py_ssize_t hi = -1;
+    PyObject *key = Py_None;
 
     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 4, 0, argsbuf);
     if (!args) {
@@ -122,14 +129,9 @@
         goto skip_optional_pos;
     }
     if (args[2]) {
-        if (PyFloat_Check(args[2])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         {
             Py_ssize_t ival = -1;
-            PyObject *iobj = PyNumber_Index(args[2]);
+            PyObject *iobj = _PyNumber_Index(args[2]);
             if (iobj != NULL) {
                 ival = PyLong_AsSsize_t(iobj);
                 Py_DECREF(iobj);
@@ -143,25 +145,35 @@
             goto skip_optional_pos;
         }
     }
-    if (!_Py_convert_optional_to_ssize_t(args[3], &hi)) {
-        goto exit;
+    if (args[3]) {
+        if (!_Py_convert_optional_to_ssize_t(args[3], &hi)) {
+            goto exit;
+        }
+        if (!--noptargs) {
+            goto skip_optional_pos;
+        }
     }
 skip_optional_pos:
-    return_value = _bisect_insort_right_impl(module, a, x, lo, hi);
+    if (!noptargs) {
+        goto skip_optional_kwonly;
+    }
+    key = args[4];
+skip_optional_kwonly:
+    return_value = _bisect_insort_right_impl(module, a, x, lo, hi, key);
 
 exit:
     return return_value;
 }
 
 PyDoc_STRVAR(_bisect_bisect_left__doc__,
-"bisect_left($module, /, a, x, lo=0, hi=None)\n"
+"bisect_left($module, /, a, x, lo=0, hi=None, *, key=None)\n"
 "--\n"
 "\n"
 "Return the index where to insert item x in list a, assuming a is sorted.\n"
 "\n"
 "The return value i is such that all e in a[:i] have e < x, and all e in\n"
-"a[i:] have e >= x.  So if x already appears in the list, i points just\n"
-"before the leftmost x already there.\n"
+"a[i:] have e >= x.  So if x already appears in the list, a.insert(i, x) will\n"
+"insert just before the leftmost x already there.\n"
 "\n"
 "Optional args lo (default 0) and hi (default len(a)) bound the\n"
 "slice of a to be searched.");
@@ -171,20 +183,21 @@
 
 static Py_ssize_t
 _bisect_bisect_left_impl(PyObject *module, PyObject *a, PyObject *x,
-                         Py_ssize_t lo, Py_ssize_t hi);
+                         Py_ssize_t lo, Py_ssize_t hi, PyObject *key);
 
 static PyObject *
 _bisect_bisect_left(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
     PyObject *return_value = NULL;
-    static const char * const _keywords[] = {"a", "x", "lo", "hi", NULL};
+    static const char * const _keywords[] = {"a", "x", "lo", "hi", "key", NULL};
     static _PyArg_Parser _parser = {NULL, _keywords, "bisect_left", 0};
-    PyObject *argsbuf[4];
+    PyObject *argsbuf[5];
     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
     PyObject *a;
     PyObject *x;
     Py_ssize_t lo = 0;
     Py_ssize_t hi = -1;
+    PyObject *key = Py_None;
     Py_ssize_t _return_value;
 
     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 4, 0, argsbuf);
@@ -197,14 +210,9 @@
         goto skip_optional_pos;
     }
     if (args[2]) {
-        if (PyFloat_Check(args[2])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         {
             Py_ssize_t ival = -1;
-            PyObject *iobj = PyNumber_Index(args[2]);
+            PyObject *iobj = _PyNumber_Index(args[2]);
             if (iobj != NULL) {
                 ival = PyLong_AsSsize_t(iobj);
                 Py_DECREF(iobj);
@@ -218,11 +226,21 @@
             goto skip_optional_pos;
         }
     }
-    if (!_Py_convert_optional_to_ssize_t(args[3], &hi)) {
-        goto exit;
+    if (args[3]) {
+        if (!_Py_convert_optional_to_ssize_t(args[3], &hi)) {
+            goto exit;
+        }
+        if (!--noptargs) {
+            goto skip_optional_pos;
+        }
     }
 skip_optional_pos:
-    _return_value = _bisect_bisect_left_impl(module, a, x, lo, hi);
+    if (!noptargs) {
+        goto skip_optional_kwonly;
+    }
+    key = args[4];
+skip_optional_kwonly:
+    _return_value = _bisect_bisect_left_impl(module, a, x, lo, hi, key);
     if ((_return_value == -1) && PyErr_Occurred()) {
         goto exit;
     }
@@ -233,7 +251,7 @@
 }
 
 PyDoc_STRVAR(_bisect_insort_left__doc__,
-"insort_left($module, /, a, x, lo=0, hi=None)\n"
+"insort_left($module, /, a, x, lo=0, hi=None, *, key=None)\n"
 "--\n"
 "\n"
 "Insert item x in list a, and keep it sorted assuming a is sorted.\n"
@@ -248,20 +266,21 @@
 
 static PyObject *
 _bisect_insort_left_impl(PyObject *module, PyObject *a, PyObject *x,
-                         Py_ssize_t lo, Py_ssize_t hi);
+                         Py_ssize_t lo, Py_ssize_t hi, PyObject *key);
 
 static PyObject *
 _bisect_insort_left(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
     PyObject *return_value = NULL;
-    static const char * const _keywords[] = {"a", "x", "lo", "hi", NULL};
+    static const char * const _keywords[] = {"a", "x", "lo", "hi", "key", NULL};
     static _PyArg_Parser _parser = {NULL, _keywords, "insort_left", 0};
-    PyObject *argsbuf[4];
+    PyObject *argsbuf[5];
     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
     PyObject *a;
     PyObject *x;
     Py_ssize_t lo = 0;
     Py_ssize_t hi = -1;
+    PyObject *key = Py_None;
 
     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 4, 0, argsbuf);
     if (!args) {
@@ -273,14 +292,9 @@
         goto skip_optional_pos;
     }
     if (args[2]) {
-        if (PyFloat_Check(args[2])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         {
             Py_ssize_t ival = -1;
-            PyObject *iobj = PyNumber_Index(args[2]);
+            PyObject *iobj = _PyNumber_Index(args[2]);
             if (iobj != NULL) {
                 ival = PyLong_AsSsize_t(iobj);
                 Py_DECREF(iobj);
@@ -294,13 +308,23 @@
             goto skip_optional_pos;
         }
     }
-    if (!_Py_convert_optional_to_ssize_t(args[3], &hi)) {
-        goto exit;
+    if (args[3]) {
+        if (!_Py_convert_optional_to_ssize_t(args[3], &hi)) {
+            goto exit;
+        }
+        if (!--noptargs) {
+            goto skip_optional_pos;
+        }
     }
 skip_optional_pos:
-    return_value = _bisect_insort_left_impl(module, a, x, lo, hi);
+    if (!noptargs) {
+        goto skip_optional_kwonly;
+    }
+    key = args[4];
+skip_optional_kwonly:
+    return_value = _bisect_insort_left_impl(module, a, x, lo, hi, key);
 
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=bcbd6c77331a08f0 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=aeb97db6db79bf96 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_bz2module.c.h b/Modules/clinic/_bz2module.c.h
index 0eb6280..71ad0b1 100644
--- a/Modules/clinic/_bz2module.c.h
+++ b/Modules/clinic/_bz2module.c.h
@@ -65,52 +65,6 @@
     return _bz2_BZ2Compressor_flush_impl(self);
 }
 
-PyDoc_STRVAR(_bz2_BZ2Compressor___init____doc__,
-"BZ2Compressor(compresslevel=9, /)\n"
-"--\n"
-"\n"
-"Create a compressor object for compressing data incrementally.\n"
-"\n"
-"  compresslevel\n"
-"    Compression level, as a number between 1 and 9.\n"
-"\n"
-"For one-shot compression, use the compress() function instead.");
-
-static int
-_bz2_BZ2Compressor___init___impl(BZ2Compressor *self, int compresslevel);
-
-static int
-_bz2_BZ2Compressor___init__(PyObject *self, PyObject *args, PyObject *kwargs)
-{
-    int return_value = -1;
-    int compresslevel = 9;
-
-    if (Py_IS_TYPE(self, &BZ2Compressor_Type) &&
-        !_PyArg_NoKeywords("BZ2Compressor", kwargs)) {
-        goto exit;
-    }
-    if (!_PyArg_CheckPositional("BZ2Compressor", PyTuple_GET_SIZE(args), 0, 1)) {
-        goto exit;
-    }
-    if (PyTuple_GET_SIZE(args) < 1) {
-        goto skip_optional;
-    }
-    if (PyFloat_Check(PyTuple_GET_ITEM(args, 0))) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
-    compresslevel = _PyLong_AsInt(PyTuple_GET_ITEM(args, 0));
-    if (compresslevel == -1 && PyErr_Occurred()) {
-        goto exit;
-    }
-skip_optional:
-    return_value = _bz2_BZ2Compressor___init___impl((BZ2Compressor *)self, compresslevel);
-
-exit:
-    return return_value;
-}
-
 PyDoc_STRVAR(_bz2_BZ2Decompressor_decompress__doc__,
 "decompress($self, /, data, max_length=-1)\n"
 "--\n"
@@ -162,14 +116,9 @@
     if (!noptargs) {
         goto skip_optional_pos;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[1]);
+        PyObject *iobj = _PyNumber_Index(args[1]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -190,34 +139,4 @@
 
     return return_value;
 }
-
-PyDoc_STRVAR(_bz2_BZ2Decompressor___init____doc__,
-"BZ2Decompressor()\n"
-"--\n"
-"\n"
-"Create a decompressor object for decompressing data incrementally.\n"
-"\n"
-"For one-shot decompression, use the decompress() function instead.");
-
-static int
-_bz2_BZ2Decompressor___init___impl(BZ2Decompressor *self);
-
-static int
-_bz2_BZ2Decompressor___init__(PyObject *self, PyObject *args, PyObject *kwargs)
-{
-    int return_value = -1;
-
-    if (Py_IS_TYPE(self, &BZ2Decompressor_Type) &&
-        !_PyArg_NoPositional("BZ2Decompressor", args)) {
-        goto exit;
-    }
-    if (Py_IS_TYPE(self, &BZ2Decompressor_Type) &&
-        !_PyArg_NoKeywords("BZ2Decompressor", kwargs)) {
-        goto exit;
-    }
-    return_value = _bz2_BZ2Decompressor___init___impl((BZ2Decompressor *)self);
-
-exit:
-    return return_value;
-}
-/*[clinic end generated code: output=3f3f1e788fe28ee1 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=ed10705d7a9fd598 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_codecsmodule.c.h b/Modules/clinic/_codecsmodule.c.h
index 772c8ca..855ac77 100644
--- a/Modules/clinic/_codecsmodule.c.h
+++ b/Modules/clinic/_codecsmodule.c.h
@@ -15,6 +15,17 @@
 #define _CODECS_REGISTER_METHODDEF    \
     {"register", (PyCFunction)_codecs_register, METH_O, _codecs_register__doc__},
 
+PyDoc_STRVAR(_codecs_unregister__doc__,
+"unregister($module, search_function, /)\n"
+"--\n"
+"\n"
+"Unregister a codec search function and clear the registry\'s cache.\n"
+"\n"
+"If the search function is not registered, do nothing.");
+
+#define _CODECS_UNREGISTER_METHODDEF    \
+    {"unregister", (PyCFunction)_codecs_unregister, METH_O, _codecs_unregister__doc__},
+
 PyDoc_STRVAR(_codecs_lookup__doc__,
 "lookup($module, encoding, /)\n"
 "--\n"
@@ -206,43 +217,6 @@
     return return_value;
 }
 
-PyDoc_STRVAR(_codecs__forget_codec__doc__,
-"_forget_codec($module, encoding, /)\n"
-"--\n"
-"\n"
-"Purge the named codec from the internal codec lookup cache");
-
-#define _CODECS__FORGET_CODEC_METHODDEF    \
-    {"_forget_codec", (PyCFunction)_codecs__forget_codec, METH_O, _codecs__forget_codec__doc__},
-
-static PyObject *
-_codecs__forget_codec_impl(PyObject *module, const char *encoding);
-
-static PyObject *
-_codecs__forget_codec(PyObject *module, PyObject *arg)
-{
-    PyObject *return_value = NULL;
-    const char *encoding;
-
-    if (!PyUnicode_Check(arg)) {
-        _PyArg_BadArgument("_forget_codec", "argument", "str", arg);
-        goto exit;
-    }
-    Py_ssize_t encoding_length;
-    encoding = PyUnicode_AsUTF8AndSize(arg, &encoding_length);
-    if (encoding == NULL) {
-        goto exit;
-    }
-    if (strlen(encoding) != (size_t)encoding_length) {
-        PyErr_SetString(PyExc_ValueError, "embedded null character");
-        goto exit;
-    }
-    return_value = _codecs__forget_codec_impl(module, encoding);
-
-exit:
-    return return_value;
-}
-
 PyDoc_STRVAR(_codecs_escape_decode__doc__,
 "escape_decode($module, data, errors=None, /)\n"
 "--\n"
@@ -424,11 +398,6 @@
     if (nargs < 3) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     final = _PyLong_AsInt(args[2]);
     if (final == -1 && PyErr_Occurred()) {
         goto exit;
@@ -499,11 +468,6 @@
     if (nargs < 3) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     final = _PyLong_AsInt(args[2]);
     if (final == -1 && PyErr_Occurred()) {
         goto exit;
@@ -574,11 +538,6 @@
     if (nargs < 3) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     final = _PyLong_AsInt(args[2]);
     if (final == -1 && PyErr_Occurred()) {
         goto exit;
@@ -649,11 +608,6 @@
     if (nargs < 3) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     final = _PyLong_AsInt(args[2]);
     if (final == -1 && PyErr_Occurred()) {
         goto exit;
@@ -724,11 +678,6 @@
     if (nargs < 3) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     final = _PyLong_AsInt(args[2]);
     if (final == -1 && PyErr_Occurred()) {
         goto exit;
@@ -801,11 +750,6 @@
     if (nargs < 3) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     byteorder = _PyLong_AsInt(args[2]);
     if (byteorder == -1 && PyErr_Occurred()) {
         goto exit;
@@ -813,11 +757,6 @@
     if (nargs < 4) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[3])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     final = _PyLong_AsInt(args[3]);
     if (final == -1 && PyErr_Occurred()) {
         goto exit;
@@ -888,11 +827,6 @@
     if (nargs < 3) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     final = _PyLong_AsInt(args[2]);
     if (final == -1 && PyErr_Occurred()) {
         goto exit;
@@ -963,11 +897,6 @@
     if (nargs < 3) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     final = _PyLong_AsInt(args[2]);
     if (final == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1038,11 +967,6 @@
     if (nargs < 3) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     final = _PyLong_AsInt(args[2]);
     if (final == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1115,11 +1039,6 @@
     if (nargs < 3) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     byteorder = _PyLong_AsInt(args[2]);
     if (byteorder == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1127,11 +1046,6 @@
     if (nargs < 4) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[3])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     final = _PyLong_AsInt(args[3]);
     if (final == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1149,7 +1063,7 @@
 }
 
 PyDoc_STRVAR(_codecs_unicode_escape_decode__doc__,
-"unicode_escape_decode($module, data, errors=None, /)\n"
+"unicode_escape_decode($module, data, errors=None, final=True, /)\n"
 "--\n"
 "\n");
 
@@ -1158,7 +1072,7 @@
 
 static PyObject *
 _codecs_unicode_escape_decode_impl(PyObject *module, Py_buffer *data,
-                                   const char *errors);
+                                   const char *errors, int final);
 
 static PyObject *
 _codecs_unicode_escape_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
@@ -1166,8 +1080,9 @@
     PyObject *return_value = NULL;
     Py_buffer data = {NULL, NULL};
     const char *errors = NULL;
+    int final = 1;
 
-    if (!_PyArg_CheckPositional("unicode_escape_decode", nargs, 1, 2)) {
+    if (!_PyArg_CheckPositional("unicode_escape_decode", nargs, 1, 3)) {
         goto exit;
     }
     if (PyUnicode_Check(args[0])) {
@@ -1208,8 +1123,15 @@
         _PyArg_BadArgument("unicode_escape_decode", "argument 2", "str or None", args[1]);
         goto exit;
     }
+    if (nargs < 3) {
+        goto skip_optional;
+    }
+    final = _PyLong_AsInt(args[2]);
+    if (final == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
 skip_optional:
-    return_value = _codecs_unicode_escape_decode_impl(module, &data, errors);
+    return_value = _codecs_unicode_escape_decode_impl(module, &data, errors, final);
 
 exit:
     /* Cleanup for data */
@@ -1221,7 +1143,7 @@
 }
 
 PyDoc_STRVAR(_codecs_raw_unicode_escape_decode__doc__,
-"raw_unicode_escape_decode($module, data, errors=None, /)\n"
+"raw_unicode_escape_decode($module, data, errors=None, final=True, /)\n"
 "--\n"
 "\n");
 
@@ -1230,7 +1152,7 @@
 
 static PyObject *
 _codecs_raw_unicode_escape_decode_impl(PyObject *module, Py_buffer *data,
-                                       const char *errors);
+                                       const char *errors, int final);
 
 static PyObject *
 _codecs_raw_unicode_escape_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
@@ -1238,8 +1160,9 @@
     PyObject *return_value = NULL;
     Py_buffer data = {NULL, NULL};
     const char *errors = NULL;
+    int final = 1;
 
-    if (!_PyArg_CheckPositional("raw_unicode_escape_decode", nargs, 1, 2)) {
+    if (!_PyArg_CheckPositional("raw_unicode_escape_decode", nargs, 1, 3)) {
         goto exit;
     }
     if (PyUnicode_Check(args[0])) {
@@ -1280,8 +1203,15 @@
         _PyArg_BadArgument("raw_unicode_escape_decode", "argument 2", "str or None", args[1]);
         goto exit;
     }
+    if (nargs < 3) {
+        goto skip_optional;
+    }
+    final = _PyLong_AsInt(args[2]);
+    if (final == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
 skip_optional:
-    return_value = _codecs_raw_unicode_escape_decode_impl(module, &data, errors);
+    return_value = _codecs_raw_unicode_escape_decode_impl(module, &data, errors, final);
 
 exit:
     /* Cleanup for data */
@@ -1539,11 +1469,6 @@
     if (nargs < 3) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     final = _PyLong_AsInt(args[2]);
     if (final == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1618,11 +1543,6 @@
     if (nargs < 3) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     final = _PyLong_AsInt(args[2]);
     if (final == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1667,11 +1587,6 @@
     if (!_PyArg_CheckPositional("code_page_decode", nargs, 2, 4)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     codepage = _PyLong_AsInt(args[0]);
     if (codepage == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1707,11 +1622,6 @@
     if (nargs < 4) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[3])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     final = _PyLong_AsInt(args[3]);
     if (final == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1973,11 +1883,6 @@
     if (nargs < 3) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     byteorder = _PyLong_AsInt(args[2]);
     if (byteorder == -1 && PyErr_Occurred()) {
         goto exit;
@@ -2160,11 +2065,6 @@
     if (nargs < 3) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     byteorder = _PyLong_AsInt(args[2]);
     if (byteorder == -1 && PyErr_Occurred()) {
         goto exit;
@@ -2765,11 +2665,6 @@
     if (!_PyArg_CheckPositional("code_page_encode", nargs, 2, 3)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     code_page = _PyLong_AsInt(args[0]);
     if (code_page == -1 && PyErr_Occurred()) {
         goto exit;
@@ -2922,4 +2817,4 @@
 #ifndef _CODECS_CODE_PAGE_ENCODE_METHODDEF
     #define _CODECS_CODE_PAGE_ENCODE_METHODDEF
 #endif /* !defined(_CODECS_CODE_PAGE_ENCODE_METHODDEF) */
-/*[clinic end generated code: output=51b42d170889524c input=a9049054013a1b77]*/
+/*[clinic end generated code: output=814dae36b6f885cb input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_collectionsmodule.c.h b/Modules/clinic/_collectionsmodule.c.h
index c3ba1a6..7e18aeb 100644
--- a/Modules/clinic/_collectionsmodule.c.h
+++ b/Modules/clinic/_collectionsmodule.c.h
@@ -50,14 +50,9 @@
     if (!_PyArg_CheckPositional("_tuplegetter", PyTuple_GET_SIZE(args), 2, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(PyTuple_GET_ITEM(args, 0))) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(PyTuple_GET_ITEM(args, 0));
+        PyObject *iobj = _PyNumber_Index(PyTuple_GET_ITEM(args, 0));
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -73,4 +68,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=9d2bfcc9df5faf35 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=947186d369f50f1e input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_curses_panel.c.h b/Modules/clinic/_curses_panel.c.h
index 9840ed8..4589807 100644
--- a/Modules/clinic/_curses_panel.c.h
+++ b/Modules/clinic/_curses_panel.c.h
@@ -9,15 +9,26 @@
 "Push the panel to the bottom of the stack.");
 
 #define _CURSES_PANEL_PANEL_BOTTOM_METHODDEF    \
-    {"bottom", (PyCFunction)_curses_panel_panel_bottom, METH_NOARGS, _curses_panel_panel_bottom__doc__},
+    {"bottom", (PyCFunction)(void(*)(void))_curses_panel_panel_bottom, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _curses_panel_panel_bottom__doc__},
 
 static PyObject *
-_curses_panel_panel_bottom_impl(PyCursesPanelObject *self);
+_curses_panel_panel_bottom_impl(PyCursesPanelObject *self, PyTypeObject *cls);
 
 static PyObject *
-_curses_panel_panel_bottom(PyCursesPanelObject *self, PyObject *Py_UNUSED(ignored))
+_curses_panel_panel_bottom(PyCursesPanelObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
-    return _curses_panel_panel_bottom_impl(self);
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = { NULL};
+    static _PyArg_Parser _parser = {":bottom", _keywords, 0};
+
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser
+        )) {
+        goto exit;
+    }
+    return_value = _curses_panel_panel_bottom_impl(self, cls);
+
+exit:
+    return return_value;
 }
 
 PyDoc_STRVAR(_curses_panel_panel_hide__doc__,
@@ -29,15 +40,26 @@
 "This does not delete the object, it just makes the window on screen invisible.");
 
 #define _CURSES_PANEL_PANEL_HIDE_METHODDEF    \
-    {"hide", (PyCFunction)_curses_panel_panel_hide, METH_NOARGS, _curses_panel_panel_hide__doc__},
+    {"hide", (PyCFunction)(void(*)(void))_curses_panel_panel_hide, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _curses_panel_panel_hide__doc__},
 
 static PyObject *
-_curses_panel_panel_hide_impl(PyCursesPanelObject *self);
+_curses_panel_panel_hide_impl(PyCursesPanelObject *self, PyTypeObject *cls);
 
 static PyObject *
-_curses_panel_panel_hide(PyCursesPanelObject *self, PyObject *Py_UNUSED(ignored))
+_curses_panel_panel_hide(PyCursesPanelObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
-    return _curses_panel_panel_hide_impl(self);
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = { NULL};
+    static _PyArg_Parser _parser = {":hide", _keywords, 0};
+
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser
+        )) {
+        goto exit;
+    }
+    return_value = _curses_panel_panel_hide_impl(self, cls);
+
+exit:
+    return return_value;
 }
 
 PyDoc_STRVAR(_curses_panel_panel_show__doc__,
@@ -47,15 +69,26 @@
 "Display the panel (which might have been hidden).");
 
 #define _CURSES_PANEL_PANEL_SHOW_METHODDEF    \
-    {"show", (PyCFunction)_curses_panel_panel_show, METH_NOARGS, _curses_panel_panel_show__doc__},
+    {"show", (PyCFunction)(void(*)(void))_curses_panel_panel_show, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _curses_panel_panel_show__doc__},
 
 static PyObject *
-_curses_panel_panel_show_impl(PyCursesPanelObject *self);
+_curses_panel_panel_show_impl(PyCursesPanelObject *self, PyTypeObject *cls);
 
 static PyObject *
-_curses_panel_panel_show(PyCursesPanelObject *self, PyObject *Py_UNUSED(ignored))
+_curses_panel_panel_show(PyCursesPanelObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
-    return _curses_panel_panel_show_impl(self);
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = { NULL};
+    static _PyArg_Parser _parser = {":show", _keywords, 0};
+
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser
+        )) {
+        goto exit;
+    }
+    return_value = _curses_panel_panel_show_impl(self, cls);
+
+exit:
+    return return_value;
 }
 
 PyDoc_STRVAR(_curses_panel_panel_top__doc__,
@@ -65,15 +98,26 @@
 "Push panel to the top of the stack.");
 
 #define _CURSES_PANEL_PANEL_TOP_METHODDEF    \
-    {"top", (PyCFunction)_curses_panel_panel_top, METH_NOARGS, _curses_panel_panel_top__doc__},
+    {"top", (PyCFunction)(void(*)(void))_curses_panel_panel_top, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _curses_panel_panel_top__doc__},
 
 static PyObject *
-_curses_panel_panel_top_impl(PyCursesPanelObject *self);
+_curses_panel_panel_top_impl(PyCursesPanelObject *self, PyTypeObject *cls);
 
 static PyObject *
-_curses_panel_panel_top(PyCursesPanelObject *self, PyObject *Py_UNUSED(ignored))
+_curses_panel_panel_top(PyCursesPanelObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
-    return _curses_panel_panel_top_impl(self);
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = { NULL};
+    static _PyArg_Parser _parser = {":top", _keywords, 0};
+
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser
+        )) {
+        goto exit;
+    }
+    return_value = _curses_panel_panel_top_impl(self, cls);
+
+exit:
+    return return_value;
 }
 
 PyDoc_STRVAR(_curses_panel_panel_above__doc__,
@@ -137,40 +181,26 @@
 "Move the panel to the screen coordinates (y, x).");
 
 #define _CURSES_PANEL_PANEL_MOVE_METHODDEF    \
-    {"move", (PyCFunction)(void(*)(void))_curses_panel_panel_move, METH_FASTCALL, _curses_panel_panel_move__doc__},
+    {"move", (PyCFunction)(void(*)(void))_curses_panel_panel_move, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _curses_panel_panel_move__doc__},
 
 static PyObject *
-_curses_panel_panel_move_impl(PyCursesPanelObject *self, int y, int x);
+_curses_panel_panel_move_impl(PyCursesPanelObject *self, PyTypeObject *cls,
+                              int y, int x);
 
 static PyObject *
-_curses_panel_panel_move(PyCursesPanelObject *self, PyObject *const *args, Py_ssize_t nargs)
+_curses_panel_panel_move(PyCursesPanelObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
     PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"", "", NULL};
+    static _PyArg_Parser _parser = {"ii:move", _keywords, 0};
     int y;
     int x;
 
-    if (!_PyArg_CheckPositional("move", nargs, 2, 2)) {
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
+        &y, &x)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
-    y = _PyLong_AsInt(args[0]);
-    if (y == -1 && PyErr_Occurred()) {
-        goto exit;
-    }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
-    x = _PyLong_AsInt(args[1]);
-    if (x == -1 && PyErr_Occurred()) {
-        goto exit;
-    }
-    return_value = _curses_panel_panel_move_impl(self, y, x);
+    return_value = _curses_panel_panel_move_impl(self, cls, y, x);
 
 exit:
     return return_value;
@@ -201,24 +231,26 @@
 "Change the window associated with the panel to the window win.");
 
 #define _CURSES_PANEL_PANEL_REPLACE_METHODDEF    \
-    {"replace", (PyCFunction)_curses_panel_panel_replace, METH_O, _curses_panel_panel_replace__doc__},
+    {"replace", (PyCFunction)(void(*)(void))_curses_panel_panel_replace, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _curses_panel_panel_replace__doc__},
 
 static PyObject *
 _curses_panel_panel_replace_impl(PyCursesPanelObject *self,
+                                 PyTypeObject *cls,
                                  PyCursesWindowObject *win);
 
 static PyObject *
-_curses_panel_panel_replace(PyCursesPanelObject *self, PyObject *arg)
+_curses_panel_panel_replace(PyCursesPanelObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
     PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"", NULL};
+    static _PyArg_Parser _parser = {"O!:replace", _keywords, 0};
     PyCursesWindowObject *win;
 
-    if (!PyObject_TypeCheck(arg, &PyCursesWindow_Type)) {
-        _PyArg_BadArgument("replace", "argument", (&PyCursesWindow_Type)->tp_name, arg);
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
+        &PyCursesWindow_Type, &win)) {
         goto exit;
     }
-    win = (PyCursesWindowObject *)arg;
-    return_value = _curses_panel_panel_replace_impl(self, win);
+    return_value = _curses_panel_panel_replace_impl(self, cls, win);
 
 exit:
     return return_value;
@@ -231,7 +263,29 @@
 "Set the panel\'s user pointer to obj.");
 
 #define _CURSES_PANEL_PANEL_SET_USERPTR_METHODDEF    \
-    {"set_userptr", (PyCFunction)_curses_panel_panel_set_userptr, METH_O, _curses_panel_panel_set_userptr__doc__},
+    {"set_userptr", (PyCFunction)(void(*)(void))_curses_panel_panel_set_userptr, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _curses_panel_panel_set_userptr__doc__},
+
+static PyObject *
+_curses_panel_panel_set_userptr_impl(PyCursesPanelObject *self,
+                                     PyTypeObject *cls, PyObject *obj);
+
+static PyObject *
+_curses_panel_panel_set_userptr(PyCursesPanelObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"", NULL};
+    static _PyArg_Parser _parser = {"O:set_userptr", _keywords, 0};
+    PyObject *obj;
+
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
+        &obj)) {
+        goto exit;
+    }
+    return_value = _curses_panel_panel_set_userptr_impl(self, cls, obj);
+
+exit:
+    return return_value;
+}
 
 PyDoc_STRVAR(_curses_panel_panel_userptr__doc__,
 "userptr($self, /)\n"
@@ -240,15 +294,27 @@
 "Return the user pointer for the panel.");
 
 #define _CURSES_PANEL_PANEL_USERPTR_METHODDEF    \
-    {"userptr", (PyCFunction)_curses_panel_panel_userptr, METH_NOARGS, _curses_panel_panel_userptr__doc__},
+    {"userptr", (PyCFunction)(void(*)(void))_curses_panel_panel_userptr, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _curses_panel_panel_userptr__doc__},
 
 static PyObject *
-_curses_panel_panel_userptr_impl(PyCursesPanelObject *self);
+_curses_panel_panel_userptr_impl(PyCursesPanelObject *self,
+                                 PyTypeObject *cls);
 
 static PyObject *
-_curses_panel_panel_userptr(PyCursesPanelObject *self, PyObject *Py_UNUSED(ignored))
+_curses_panel_panel_userptr(PyCursesPanelObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
-    return _curses_panel_panel_userptr_impl(self);
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = { NULL};
+    static _PyArg_Parser _parser = {":userptr", _keywords, 0};
+
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser
+        )) {
+        goto exit;
+    }
+    return_value = _curses_panel_panel_userptr_impl(self, cls);
+
+exit:
+    return return_value;
 }
 
 PyDoc_STRVAR(_curses_panel_bottom_panel__doc__,
@@ -335,4 +401,4 @@
 {
     return _curses_panel_update_panels_impl(module);
 }
-/*[clinic end generated code: output=d96dc1fd68e898d9 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=3081ef24e5560cb0 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_cursesmodule.c.h b/Modules/clinic/_cursesmodule.c.h
index 50d7f21..9c96116 100644
--- a/Modules/clinic/_cursesmodule.c.h
+++ b/Modules/clinic/_cursesmodule.c.h
@@ -252,11 +252,6 @@
     if (nargs < 2) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     attr = PyLong_AsLong(args[1]);
     if (attr == -1 && PyErr_Occurred()) {
         goto exit;
@@ -286,11 +281,6 @@
     PyObject *return_value = NULL;
     long attr;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     attr = PyLong_AsLong(arg);
     if (attr == -1 && PyErr_Occurred()) {
         goto exit;
@@ -319,11 +309,6 @@
     PyObject *return_value = NULL;
     long attr;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     attr = PyLong_AsLong(arg);
     if (attr == -1 && PyErr_Occurred()) {
         goto exit;
@@ -352,11 +337,6 @@
     PyObject *return_value = NULL;
     long attr;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     attr = PyLong_AsLong(arg);
     if (attr == -1 && PyErr_Occurred()) {
         goto exit;
@@ -399,11 +379,6 @@
     if (nargs < 2) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     attr = PyLong_AsLong(args[1]);
     if (attr == -1 && PyErr_Occurred()) {
         goto exit;
@@ -534,8 +509,8 @@
 {
     PyObject *return_value = NULL;
     int group_right_1 = 0;
-    PyObject *verch = _PyLong_Zero;
-    PyObject *horch = _PyLong_Zero;
+    PyObject *verch = _PyLong_GetZero();
+    PyObject *horch = _PyLong_GetZero();
 
     switch (PyTuple_GET_SIZE(args)) {
         case 0:
@@ -687,11 +662,6 @@
     if (nargs < 2) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     attr = PyLong_AsLong(args[1]);
     if (attr == -1 && PyErr_Occurred()) {
         goto exit;
@@ -719,7 +689,7 @@
 #define _CURSES_WINDOW_ENCLOSE_METHODDEF    \
     {"enclose", (PyCFunction)(void(*)(void))_curses_window_enclose, METH_FASTCALL, _curses_window_enclose__doc__},
 
-static long
+static PyObject *
 _curses_window_enclose_impl(PyCursesWindowObject *self, int y, int x);
 
 static PyObject *
@@ -728,34 +698,19 @@
     PyObject *return_value = NULL;
     int y;
     int x;
-    long _return_value;
 
     if (!_PyArg_CheckPositional("enclose", nargs, 2, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     y = _PyLong_AsInt(args[0]);
     if (y == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     x = _PyLong_AsInt(args[1]);
     if (x == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    _return_value = _curses_window_enclose_impl(self, y, x);
-    if ((_return_value == -1) && PyErr_Occurred()) {
-        goto exit;
-    }
-    return_value = PyLong_FromLong(_return_value);
+    return_value = _curses_window_enclose_impl(self, y, x);
 
 exit:
     return return_value;
@@ -1303,11 +1258,6 @@
     PyObject *return_value = NULL;
     int line;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     line = _PyLong_AsInt(arg);
     if (line == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1552,20 +1502,10 @@
     if (!_PyArg_CheckPositional("redrawln", nargs, 2, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     beg = _PyLong_AsInt(args[0]);
     if (beg == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     num = _PyLong_AsInt(args[1]);
     if (num == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1661,20 +1601,10 @@
     if (!_PyArg_CheckPositional("setscrreg", nargs, 2, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     top = _PyLong_AsInt(args[0]);
     if (top == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     bottom = _PyLong_AsInt(args[1]);
     if (bottom == -1 && PyErr_Occurred()) {
         goto exit;
@@ -2005,11 +1935,6 @@
     if (nargs < 1) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     flag = _PyLong_AsInt(args[0]);
     if (flag == -1 && PyErr_Occurred()) {
         goto exit;
@@ -2028,7 +1953,7 @@
 "Return the red, green, and blue (RGB) components of the specified color.\n"
 "\n"
 "  color_number\n"
-"    The number of the color (0 - COLORS).\n"
+"    The number of the color (0 - (COLORS-1)).\n"
 "\n"
 "A 3-tuple is returned, containing the R, G, B values for the given color,\n"
 "which will be between 0 (no component) and 1000 (maximum amount of component).");
@@ -2037,38 +1962,17 @@
     {"color_content", (PyCFunction)_curses_color_content, METH_O, _curses_color_content__doc__},
 
 static PyObject *
-_curses_color_content_impl(PyObject *module, short color_number);
+_curses_color_content_impl(PyObject *module, int color_number);
 
 static PyObject *
 _curses_color_content(PyObject *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
-    short color_number;
+    int color_number;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
+    if (!color_converter(arg, &color_number)) {
         goto exit;
     }
-    {
-        long ival = PyLong_AsLong(arg);
-        if (ival == -1 && PyErr_Occurred()) {
-            goto exit;
-        }
-        else if (ival < SHRT_MIN) {
-            PyErr_SetString(PyExc_OverflowError,
-                            "signed short integer is less than minimum");
-            goto exit;
-        }
-        else if (ival > SHRT_MAX) {
-            PyErr_SetString(PyExc_OverflowError,
-                            "signed short integer is greater than maximum");
-            goto exit;
-        }
-        else {
-            color_number = (short) ival;
-        }
-    }
     return_value = _curses_color_content_impl(module, color_number);
 
 exit:
@@ -2076,13 +1980,13 @@
 }
 
 PyDoc_STRVAR(_curses_color_pair__doc__,
-"color_pair($module, color_number, /)\n"
+"color_pair($module, pair_number, /)\n"
 "--\n"
 "\n"
 "Return the attribute value for displaying text in the specified color.\n"
 "\n"
-"  color_number\n"
-"    The number of the color (0 - COLORS).\n"
+"  pair_number\n"
+"    The number of the color pair.\n"
 "\n"
 "This attribute value can be combined with A_STANDOUT, A_REVERSE, and the\n"
 "other A_* attributes.  pair_number() is the counterpart to this function.");
@@ -2091,39 +1995,19 @@
     {"color_pair", (PyCFunction)_curses_color_pair, METH_O, _curses_color_pair__doc__},
 
 static PyObject *
-_curses_color_pair_impl(PyObject *module, short color_number);
+_curses_color_pair_impl(PyObject *module, int pair_number);
 
 static PyObject *
 _curses_color_pair(PyObject *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
-    short color_number;
+    int pair_number;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
+    pair_number = _PyLong_AsInt(arg);
+    if (pair_number == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    {
-        long ival = PyLong_AsLong(arg);
-        if (ival == -1 && PyErr_Occurred()) {
-            goto exit;
-        }
-        else if (ival < SHRT_MIN) {
-            PyErr_SetString(PyExc_OverflowError,
-                            "signed short integer is less than minimum");
-            goto exit;
-        }
-        else if (ival > SHRT_MAX) {
-            PyErr_SetString(PyExc_OverflowError,
-                            "signed short integer is greater than maximum");
-            goto exit;
-        }
-        else {
-            color_number = (short) ival;
-        }
-    }
-    return_value = _curses_color_pair_impl(module, color_number);
+    return_value = _curses_color_pair_impl(module, pair_number);
 
 exit:
     return return_value;
@@ -2155,11 +2039,6 @@
     PyObject *return_value = NULL;
     int visibility;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     visibility = _PyLong_AsInt(arg);
     if (visibility == -1 && PyErr_Occurred()) {
         goto exit;
@@ -2235,11 +2114,6 @@
     PyObject *return_value = NULL;
     int ms;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     ms = _PyLong_AsInt(arg);
     if (ms == -1 && PyErr_Occurred()) {
         goto exit;
@@ -2297,11 +2171,6 @@
     if (nargs < 1) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     flag = _PyLong_AsInt(args[0]);
     if (flag == -1 && PyErr_Occurred()) {
         goto exit;
@@ -2469,11 +2338,6 @@
     if (!_PyArg_CheckPositional("ungetmouse", nargs, 5, 5)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         long ival = PyLong_AsLong(args[0]);
         if (ival == -1 && PyErr_Occurred()) {
@@ -2493,29 +2357,14 @@
             id = (short) ival;
         }
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     x = _PyLong_AsInt(args[1]);
     if (x == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     y = _PyLong_AsInt(args[2]);
     if (y == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[3])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     z = _PyLong_AsInt(args[3]);
     if (z == -1 && PyErr_Occurred()) {
         goto exit;
@@ -2568,11 +2417,6 @@
     PyObject *return_value = NULL;
     unsigned char tenths;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         long ival = PyLong_AsLong(arg);
         if (ival == -1 && PyErr_Occurred()) {
@@ -2675,11 +2519,6 @@
     PyObject *return_value = NULL;
     int key;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     key = _PyLong_AsInt(arg);
     if (key == -1 && PyErr_Occurred()) {
         goto exit;
@@ -2699,7 +2538,7 @@
 "Change the definition of a color.\n"
 "\n"
 "  color_number\n"
-"    The number of the color to be changed (0 - COLORS).\n"
+"    The number of the color to be changed (0 - (COLORS-1)).\n"
 "  r\n"
 "    Red component (0 - 1000).\n"
 "  g\n"
@@ -2709,20 +2548,20 @@
 "\n"
 "When init_color() is used, all occurrences of that color on the screen\n"
 "immediately change to the new definition.  This function is a no-op on\n"
-"most terminals; it is active only if can_change_color() returns 1.");
+"most terminals; it is active only if can_change_color() returns true.");
 
 #define _CURSES_INIT_COLOR_METHODDEF    \
     {"init_color", (PyCFunction)(void(*)(void))_curses_init_color, METH_FASTCALL, _curses_init_color__doc__},
 
 static PyObject *
-_curses_init_color_impl(PyObject *module, short color_number, short r,
-                        short g, short b);
+_curses_init_color_impl(PyObject *module, int color_number, short r, short g,
+                        short b);
 
 static PyObject *
 _curses_init_color(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
 {
     PyObject *return_value = NULL;
-    short color_number;
+    int color_number;
     short r;
     short g;
     short b;
@@ -2730,102 +2569,18 @@
     if (!_PyArg_CheckPositional("init_color", nargs, 4, 4)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
+    if (!color_converter(args[0], &color_number)) {
         goto exit;
     }
-    {
-        long ival = PyLong_AsLong(args[0]);
-        if (ival == -1 && PyErr_Occurred()) {
-            goto exit;
-        }
-        else if (ival < SHRT_MIN) {
-            PyErr_SetString(PyExc_OverflowError,
-                            "signed short integer is less than minimum");
-            goto exit;
-        }
-        else if (ival > SHRT_MAX) {
-            PyErr_SetString(PyExc_OverflowError,
-                            "signed short integer is greater than maximum");
-            goto exit;
-        }
-        else {
-            color_number = (short) ival;
-        }
-    }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
+    if (!component_converter(args[1], &r)) {
         goto exit;
     }
-    {
-        long ival = PyLong_AsLong(args[1]);
-        if (ival == -1 && PyErr_Occurred()) {
-            goto exit;
-        }
-        else if (ival < SHRT_MIN) {
-            PyErr_SetString(PyExc_OverflowError,
-                            "signed short integer is less than minimum");
-            goto exit;
-        }
-        else if (ival > SHRT_MAX) {
-            PyErr_SetString(PyExc_OverflowError,
-                            "signed short integer is greater than maximum");
-            goto exit;
-        }
-        else {
-            r = (short) ival;
-        }
-    }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
+    if (!component_converter(args[2], &g)) {
         goto exit;
     }
-    {
-        long ival = PyLong_AsLong(args[2]);
-        if (ival == -1 && PyErr_Occurred()) {
-            goto exit;
-        }
-        else if (ival < SHRT_MIN) {
-            PyErr_SetString(PyExc_OverflowError,
-                            "signed short integer is less than minimum");
-            goto exit;
-        }
-        else if (ival > SHRT_MAX) {
-            PyErr_SetString(PyExc_OverflowError,
-                            "signed short integer is greater than maximum");
-            goto exit;
-        }
-        else {
-            g = (short) ival;
-        }
-    }
-    if (PyFloat_Check(args[3])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
+    if (!component_converter(args[3], &b)) {
         goto exit;
     }
-    {
-        long ival = PyLong_AsLong(args[3]);
-        if (ival == -1 && PyErr_Occurred()) {
-            goto exit;
-        }
-        else if (ival < SHRT_MIN) {
-            PyErr_SetString(PyExc_OverflowError,
-                            "signed short integer is less than minimum");
-            goto exit;
-        }
-        else if (ival > SHRT_MAX) {
-            PyErr_SetString(PyExc_OverflowError,
-                            "signed short integer is greater than maximum");
-            goto exit;
-        }
-        else {
-            b = (short) ival;
-        }
-    }
     return_value = _curses_init_color_impl(module, color_number, r, g, b);
 
 exit:
@@ -2841,9 +2596,9 @@
 "  pair_number\n"
 "    The number of the color-pair to be changed (1 - (COLOR_PAIRS-1)).\n"
 "  fg\n"
-"    Foreground color number (0 - COLORS).\n"
+"    Foreground color number (-1 - (COLORS-1)).\n"
 "  bg\n"
-"    Background color number (0 - COLORS).\n"
+"    Background color number (-1 - (COLORS-1)).\n"
 "\n"
 "If the color-pair was previously initialized, the screen is refreshed and\n"
 "all occurrences of that color-pair are changed to the new definition.");
@@ -2852,92 +2607,28 @@
     {"init_pair", (PyCFunction)(void(*)(void))_curses_init_pair, METH_FASTCALL, _curses_init_pair__doc__},
 
 static PyObject *
-_curses_init_pair_impl(PyObject *module, short pair_number, short fg,
-                       short bg);
+_curses_init_pair_impl(PyObject *module, int pair_number, int fg, int bg);
 
 static PyObject *
 _curses_init_pair(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
 {
     PyObject *return_value = NULL;
-    short pair_number;
-    short fg;
-    short bg;
+    int pair_number;
+    int fg;
+    int bg;
 
     if (!_PyArg_CheckPositional("init_pair", nargs, 3, 3)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
+    if (!pair_converter(args[0], &pair_number)) {
         goto exit;
     }
-    {
-        long ival = PyLong_AsLong(args[0]);
-        if (ival == -1 && PyErr_Occurred()) {
-            goto exit;
-        }
-        else if (ival < SHRT_MIN) {
-            PyErr_SetString(PyExc_OverflowError,
-                            "signed short integer is less than minimum");
-            goto exit;
-        }
-        else if (ival > SHRT_MAX) {
-            PyErr_SetString(PyExc_OverflowError,
-                            "signed short integer is greater than maximum");
-            goto exit;
-        }
-        else {
-            pair_number = (short) ival;
-        }
-    }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
+    if (!color_allow_default_converter(args[1], &fg)) {
         goto exit;
     }
-    {
-        long ival = PyLong_AsLong(args[1]);
-        if (ival == -1 && PyErr_Occurred()) {
-            goto exit;
-        }
-        else if (ival < SHRT_MIN) {
-            PyErr_SetString(PyExc_OverflowError,
-                            "signed short integer is less than minimum");
-            goto exit;
-        }
-        else if (ival > SHRT_MAX) {
-            PyErr_SetString(PyExc_OverflowError,
-                            "signed short integer is greater than maximum");
-            goto exit;
-        }
-        else {
-            fg = (short) ival;
-        }
-    }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
+    if (!color_allow_default_converter(args[2], &bg)) {
         goto exit;
     }
-    {
-        long ival = PyLong_AsLong(args[2]);
-        if (ival == -1 && PyErr_Occurred()) {
-            goto exit;
-        }
-        else if (ival < SHRT_MIN) {
-            PyErr_SetString(PyExc_OverflowError,
-                            "signed short integer is less than minimum");
-            goto exit;
-        }
-        else if (ival > SHRT_MAX) {
-            PyErr_SetString(PyExc_OverflowError,
-                            "signed short integer is greater than maximum");
-            goto exit;
-        }
-        else {
-            bg = (short) ival;
-        }
-    }
     return_value = _curses_init_pair_impl(module, pair_number, fg, bg);
 
 exit:
@@ -3024,11 +2715,6 @@
             goto skip_optional_pos;
         }
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(args[1]);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
@@ -3093,11 +2779,6 @@
     PyObject *return_value = NULL;
     int ms;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     ms = _PyLong_AsInt(arg);
     if (ms == -1 && PyErr_Occurred()) {
         goto exit;
@@ -3161,11 +2842,6 @@
     PyObject *return_value = NULL;
     int size;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     size = _PyLong_AsInt(arg);
     if (size == -1 && PyErr_Occurred()) {
         goto exit;
@@ -3195,11 +2871,6 @@
     PyObject *return_value = NULL;
     int flag;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     flag = _PyLong_AsInt(arg);
     if (flag == -1 && PyErr_Occurred()) {
         goto exit;
@@ -3257,20 +2928,10 @@
     if (!_PyArg_CheckPositional("is_term_resized", nargs, 2, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     nlines = _PyLong_AsInt(args[0]);
     if (nlines == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     ncols = _PyLong_AsInt(args[1]);
     if (ncols == -1 && PyErr_Occurred()) {
         goto exit;
@@ -3304,11 +2965,6 @@
     PyObject *return_value = NULL;
     int key;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     key = _PyLong_AsInt(arg);
     if (key == -1 && PyErr_Occurred()) {
         goto exit;
@@ -3379,11 +3035,6 @@
     PyObject *return_value = NULL;
     int yes;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     yes = _PyLong_AsInt(arg);
     if (yes == -1 && PyErr_Occurred()) {
         goto exit;
@@ -3421,11 +3072,6 @@
     PyObject *return_value = NULL;
     int interval;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     interval = _PyLong_AsInt(arg);
     if (interval == -1 && PyErr_Occurred()) {
         goto exit;
@@ -3497,11 +3143,6 @@
     PyObject *return_value = NULL;
     int ms;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     ms = _PyLong_AsInt(arg);
     if (ms == -1 && PyErr_Occurred()) {
         goto exit;
@@ -3539,20 +3180,10 @@
     if (!_PyArg_CheckPositional("newpad", nargs, 2, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     nlines = _PyLong_AsInt(args[0]);
     if (nlines == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     ncols = _PyLong_AsInt(args[1]);
     if (ncols == -1 && PyErr_Occurred()) {
         goto exit;
@@ -3648,11 +3279,6 @@
     if (nargs < 1) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     flag = _PyLong_AsInt(args[0]);
     if (flag == -1 && PyErr_Occurred()) {
         goto exit;
@@ -3773,44 +3399,23 @@
 "Return a tuple (fg, bg) containing the colors for the requested color pair.\n"
 "\n"
 "  pair_number\n"
-"    The number of the color pair (1 - (COLOR_PAIRS-1)).");
+"    The number of the color pair (0 - (COLOR_PAIRS-1)).");
 
 #define _CURSES_PAIR_CONTENT_METHODDEF    \
     {"pair_content", (PyCFunction)_curses_pair_content, METH_O, _curses_pair_content__doc__},
 
 static PyObject *
-_curses_pair_content_impl(PyObject *module, short pair_number);
+_curses_pair_content_impl(PyObject *module, int pair_number);
 
 static PyObject *
 _curses_pair_content(PyObject *module, PyObject *arg)
 {
     PyObject *return_value = NULL;
-    short pair_number;
+    int pair_number;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
+    if (!pair_converter(arg, &pair_number)) {
         goto exit;
     }
-    {
-        long ival = PyLong_AsLong(arg);
-        if (ival == -1 && PyErr_Occurred()) {
-            goto exit;
-        }
-        else if (ival < SHRT_MIN) {
-            PyErr_SetString(PyExc_OverflowError,
-                            "signed short integer is less than minimum");
-            goto exit;
-        }
-        else if (ival > SHRT_MAX) {
-            PyErr_SetString(PyExc_OverflowError,
-                            "signed short integer is greater than maximum");
-            goto exit;
-        }
-        else {
-            pair_number = (short) ival;
-        }
-    }
     return_value = _curses_pair_content_impl(module, pair_number);
 
 exit:
@@ -3837,11 +3442,6 @@
     PyObject *return_value = NULL;
     int attr;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     attr = _PyLong_AsInt(arg);
     if (attr == -1 && PyErr_Occurred()) {
         goto exit;
@@ -3911,11 +3511,6 @@
     if (nargs < 1) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     flag = _PyLong_AsInt(args[0]);
     if (flag == -1 && PyErr_Occurred()) {
         goto exit;
@@ -3979,11 +3574,6 @@
     if (nargs < 1) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     flag = _PyLong_AsInt(args[0]);
     if (flag == -1 && PyErr_Occurred()) {
         goto exit;
@@ -4081,20 +3671,10 @@
     if (!_PyArg_CheckPositional("resizeterm", nargs, 2, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     nlines = _PyLong_AsInt(args[0]);
     if (nlines == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     ncols = _PyLong_AsInt(args[1]);
     if (ncols == -1 && PyErr_Occurred()) {
         goto exit;
@@ -4142,20 +3722,10 @@
     if (!_PyArg_CheckPositional("resize_term", nargs, 2, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     nlines = _PyLong_AsInt(args[0]);
     if (nlines == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     ncols = _PyLong_AsInt(args[1]);
     if (ncols == -1 && PyErr_Occurred()) {
         goto exit;
@@ -4217,20 +3787,10 @@
     if (!_PyArg_CheckPositional("setsyx", nargs, 2, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     y = _PyLong_AsInt(args[0]);
     if (y == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     x = _PyLong_AsInt(args[1]);
     if (x == -1 && PyErr_Occurred()) {
         goto exit;
@@ -4500,11 +4060,6 @@
     PyObject *return_value = NULL;
     int fd;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(arg);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
@@ -4580,11 +4135,6 @@
     PyObject *return_value = NULL;
     int flag;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     flag = _PyLong_AsInt(arg);
     if (flag == -1 && PyErr_Occurred()) {
         goto exit;
@@ -4622,6 +4172,27 @@
 
 #endif /* !defined(STRICT_SYSV_CURSES) */
 
+PyDoc_STRVAR(_curses_has_extended_color_support__doc__,
+"has_extended_color_support($module, /)\n"
+"--\n"
+"\n"
+"Return True if the module supports extended colors; otherwise, return False.\n"
+"\n"
+"Extended color support allows more than 256 color-pairs for terminals\n"
+"that support more than 16 colors (e.g. xterm-256color).");
+
+#define _CURSES_HAS_EXTENDED_COLOR_SUPPORT_METHODDEF    \
+    {"has_extended_color_support", (PyCFunction)_curses_has_extended_color_support, METH_NOARGS, _curses_has_extended_color_support__doc__},
+
+static PyObject *
+_curses_has_extended_color_support_impl(PyObject *module);
+
+static PyObject *
+_curses_has_extended_color_support(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+    return _curses_has_extended_color_support_impl(module);
+}
+
 #ifndef _CURSES_WINDOW_ENCLOSE_METHODDEF
     #define _CURSES_WINDOW_ENCLOSE_METHODDEF
 #endif /* !defined(_CURSES_WINDOW_ENCLOSE_METHODDEF) */
@@ -4713,4 +4284,4 @@
 #ifndef _CURSES_USE_DEFAULT_COLORS_METHODDEF
     #define _CURSES_USE_DEFAULT_COLORS_METHODDEF
 #endif /* !defined(_CURSES_USE_DEFAULT_COLORS_METHODDEF) */
-/*[clinic end generated code: output=b53652f8acafd817 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=9efc9943a3ac3741 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_datetimemodule.c.h b/Modules/clinic/_datetimemodule.c.h
index 973a4ea..7bd7c19 100644
--- a/Modules/clinic/_datetimemodule.c.h
+++ b/Modules/clinic/_datetimemodule.c.h
@@ -35,29 +35,14 @@
     if (!fastargs) {
         goto exit;
     }
-    if (PyFloat_Check(fastargs[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     year = _PyLong_AsInt(fastargs[0]);
     if (year == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(fastargs[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     week = _PyLong_AsInt(fastargs[1]);
     if (week == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(fastargs[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     weekday = _PyLong_AsInt(fastargs[2]);
     if (weekday == -1 && PyErr_Occurred()) {
         goto exit;
@@ -109,4 +94,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=5e17549f29a439a5 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=f61310936e3d8091 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_dbmmodule.c.h b/Modules/clinic/_dbmmodule.c.h
index a7d7350..af288c2 100644
--- a/Modules/clinic/_dbmmodule.c.h
+++ b/Modules/clinic/_dbmmodule.c.h
@@ -27,15 +27,26 @@
 "Return a list of all keys in the database.");
 
 #define _DBM_DBM_KEYS_METHODDEF    \
-    {"keys", (PyCFunction)_dbm_dbm_keys, METH_NOARGS, _dbm_dbm_keys__doc__},
+    {"keys", (PyCFunction)(void(*)(void))_dbm_dbm_keys, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _dbm_dbm_keys__doc__},
 
 static PyObject *
-_dbm_dbm_keys_impl(dbmobject *self);
+_dbm_dbm_keys_impl(dbmobject *self, PyTypeObject *cls);
 
 static PyObject *
-_dbm_dbm_keys(dbmobject *self, PyObject *Py_UNUSED(ignored))
+_dbm_dbm_keys(dbmobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
-    return _dbm_dbm_keys_impl(self);
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = { NULL};
+    static _PyArg_Parser _parser = {":keys", _keywords, 0};
+
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser
+        )) {
+        goto exit;
+    }
+    return_value = _dbm_dbm_keys_impl(self, cls);
+
+exit:
+    return return_value;
 }
 
 PyDoc_STRVAR(_dbm_dbm_get__doc__,
@@ -45,25 +56,27 @@
 "Return the value for key if present, otherwise default.");
 
 #define _DBM_DBM_GET_METHODDEF    \
-    {"get", (PyCFunction)(void(*)(void))_dbm_dbm_get, METH_FASTCALL, _dbm_dbm_get__doc__},
+    {"get", (PyCFunction)(void(*)(void))_dbm_dbm_get, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _dbm_dbm_get__doc__},
 
 static PyObject *
-_dbm_dbm_get_impl(dbmobject *self, const char *key,
+_dbm_dbm_get_impl(dbmobject *self, PyTypeObject *cls, const char *key,
                   Py_ssize_clean_t key_length, PyObject *default_value);
 
 static PyObject *
-_dbm_dbm_get(dbmobject *self, PyObject *const *args, Py_ssize_t nargs)
+_dbm_dbm_get(dbmobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
     PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"", "", NULL};
+    static _PyArg_Parser _parser = {"s#|O:get", _keywords, 0};
     const char *key;
     Py_ssize_clean_t key_length;
     PyObject *default_value = Py_None;
 
-    if (!_PyArg_ParseStack(args, nargs, "s#|O:get",
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
         &key, &key_length, &default_value)) {
         goto exit;
     }
-    return_value = _dbm_dbm_get_impl(self, key, key_length, default_value);
+    return_value = _dbm_dbm_get_impl(self, cls, key, key_length, default_value);
 
 exit:
     return return_value;
@@ -78,26 +91,28 @@
 "If key is not in the database, it is inserted with default as the value.");
 
 #define _DBM_DBM_SETDEFAULT_METHODDEF    \
-    {"setdefault", (PyCFunction)(void(*)(void))_dbm_dbm_setdefault, METH_FASTCALL, _dbm_dbm_setdefault__doc__},
+    {"setdefault", (PyCFunction)(void(*)(void))_dbm_dbm_setdefault, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _dbm_dbm_setdefault__doc__},
 
 static PyObject *
-_dbm_dbm_setdefault_impl(dbmobject *self, const char *key,
+_dbm_dbm_setdefault_impl(dbmobject *self, PyTypeObject *cls, const char *key,
                          Py_ssize_clean_t key_length,
                          PyObject *default_value);
 
 static PyObject *
-_dbm_dbm_setdefault(dbmobject *self, PyObject *const *args, Py_ssize_t nargs)
+_dbm_dbm_setdefault(dbmobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
     PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"", "", NULL};
+    static _PyArg_Parser _parser = {"s#|O:setdefault", _keywords, 0};
     const char *key;
     Py_ssize_clean_t key_length;
     PyObject *default_value = NULL;
 
-    if (!_PyArg_ParseStack(args, nargs, "s#|O:setdefault",
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
         &key, &key_length, &default_value)) {
         goto exit;
     }
-    return_value = _dbm_dbm_setdefault_impl(self, key, key_length, default_value);
+    return_value = _dbm_dbm_setdefault_impl(self, cls, key, key_length, default_value);
 
 exit:
     return return_value;
@@ -162,11 +177,6 @@
     if (nargs < 3) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     mode = _PyLong_AsInt(args[2]);
     if (mode == -1 && PyErr_Occurred()) {
         goto exit;
@@ -177,4 +187,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=7ced103488cbca7a input=a9049054013a1b77]*/
+/*[clinic end generated code: output=6947b1115df66f7c input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_elementtree.c.h b/Modules/clinic/_elementtree.c.h
index 825416f..5ed5a6c 100644
--- a/Modules/clinic/_elementtree.c.h
+++ b/Modules/clinic/_elementtree.c.h
@@ -430,14 +430,9 @@
     if (!_PyArg_CheckPositional("insert", nargs, 2, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[0]);
+        PyObject *iobj = _PyNumber_Index(args[0]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -812,7 +807,7 @@
     PyObject * const *fastargs;
     Py_ssize_t nargs = PyTuple_GET_SIZE(args);
     Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 0;
-    PyObject *target = NULL;
+    PyObject *target = Py_None;
     const char *encoding = NULL;
 
     fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 0, 0, argsbuf);
@@ -920,4 +915,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=b7f6a32462fc42a9 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=992733cfc7390590 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_gdbmmodule.c.h b/Modules/clinic/_gdbmmodule.c.h
index aa37a24..ea4ee7d 100644
--- a/Modules/clinic/_gdbmmodule.c.h
+++ b/Modules/clinic/_gdbmmodule.c.h
@@ -12,10 +12,10 @@
     {"get", (PyCFunction)(void(*)(void))_gdbm_gdbm_get, METH_FASTCALL, _gdbm_gdbm_get__doc__},
 
 static PyObject *
-_gdbm_gdbm_get_impl(dbmobject *self, PyObject *key, PyObject *default_value);
+_gdbm_gdbm_get_impl(gdbmobject *self, PyObject *key, PyObject *default_value);
 
 static PyObject *
-_gdbm_gdbm_get(dbmobject *self, PyObject *const *args, Py_ssize_t nargs)
+_gdbm_gdbm_get(gdbmobject *self, PyObject *const *args, Py_ssize_t nargs)
 {
     PyObject *return_value = NULL;
     PyObject *key;
@@ -46,11 +46,11 @@
     {"setdefault", (PyCFunction)(void(*)(void))_gdbm_gdbm_setdefault, METH_FASTCALL, _gdbm_gdbm_setdefault__doc__},
 
 static PyObject *
-_gdbm_gdbm_setdefault_impl(dbmobject *self, PyObject *key,
+_gdbm_gdbm_setdefault_impl(gdbmobject *self, PyObject *key,
                            PyObject *default_value);
 
 static PyObject *
-_gdbm_gdbm_setdefault(dbmobject *self, PyObject *const *args, Py_ssize_t nargs)
+_gdbm_gdbm_setdefault(gdbmobject *self, PyObject *const *args, Py_ssize_t nargs)
 {
     PyObject *return_value = NULL;
     PyObject *key;
@@ -81,10 +81,10 @@
     {"close", (PyCFunction)_gdbm_gdbm_close, METH_NOARGS, _gdbm_gdbm_close__doc__},
 
 static PyObject *
-_gdbm_gdbm_close_impl(dbmobject *self);
+_gdbm_gdbm_close_impl(gdbmobject *self);
 
 static PyObject *
-_gdbm_gdbm_close(dbmobject *self, PyObject *Py_UNUSED(ignored))
+_gdbm_gdbm_close(gdbmobject *self, PyObject *Py_UNUSED(ignored))
 {
     return _gdbm_gdbm_close_impl(self);
 }
@@ -96,15 +96,26 @@
 "Get a list of all keys in the database.");
 
 #define _GDBM_GDBM_KEYS_METHODDEF    \
-    {"keys", (PyCFunction)_gdbm_gdbm_keys, METH_NOARGS, _gdbm_gdbm_keys__doc__},
+    {"keys", (PyCFunction)(void(*)(void))_gdbm_gdbm_keys, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _gdbm_gdbm_keys__doc__},
 
 static PyObject *
-_gdbm_gdbm_keys_impl(dbmobject *self);
+_gdbm_gdbm_keys_impl(gdbmobject *self, PyTypeObject *cls);
 
 static PyObject *
-_gdbm_gdbm_keys(dbmobject *self, PyObject *Py_UNUSED(ignored))
+_gdbm_gdbm_keys(gdbmobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
-    return _gdbm_gdbm_keys_impl(self);
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = { NULL};
+    static _PyArg_Parser _parser = {":keys", _keywords, 0};
+
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser
+        )) {
+        goto exit;
+    }
+    return_value = _gdbm_gdbm_keys_impl(self, cls);
+
+exit:
+    return return_value;
 }
 
 PyDoc_STRVAR(_gdbm_gdbm_firstkey__doc__,
@@ -118,15 +129,26 @@
 "hash values, and won\'t be sorted by the key values.");
 
 #define _GDBM_GDBM_FIRSTKEY_METHODDEF    \
-    {"firstkey", (PyCFunction)_gdbm_gdbm_firstkey, METH_NOARGS, _gdbm_gdbm_firstkey__doc__},
+    {"firstkey", (PyCFunction)(void(*)(void))_gdbm_gdbm_firstkey, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _gdbm_gdbm_firstkey__doc__},
 
 static PyObject *
-_gdbm_gdbm_firstkey_impl(dbmobject *self);
+_gdbm_gdbm_firstkey_impl(gdbmobject *self, PyTypeObject *cls);
 
 static PyObject *
-_gdbm_gdbm_firstkey(dbmobject *self, PyObject *Py_UNUSED(ignored))
+_gdbm_gdbm_firstkey(gdbmobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
-    return _gdbm_gdbm_firstkey_impl(self);
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = { NULL};
+    static _PyArg_Parser _parser = {":firstkey", _keywords, 0};
+
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser
+        )) {
+        goto exit;
+    }
+    return_value = _gdbm_gdbm_firstkey_impl(self, cls);
+
+exit:
+    return return_value;
 }
 
 PyDoc_STRVAR(_gdbm_gdbm_nextkey__doc__,
@@ -139,28 +161,31 @@
 "to create a list in memory that contains them all:\n"
 "\n"
 "      k = db.firstkey()\n"
-"      while k != None:\n"
+"      while k is not None:\n"
 "          print(k)\n"
 "          k = db.nextkey(k)");
 
 #define _GDBM_GDBM_NEXTKEY_METHODDEF    \
-    {"nextkey", (PyCFunction)_gdbm_gdbm_nextkey, METH_O, _gdbm_gdbm_nextkey__doc__},
+    {"nextkey", (PyCFunction)(void(*)(void))_gdbm_gdbm_nextkey, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _gdbm_gdbm_nextkey__doc__},
 
 static PyObject *
-_gdbm_gdbm_nextkey_impl(dbmobject *self, const char *key,
+_gdbm_gdbm_nextkey_impl(gdbmobject *self, PyTypeObject *cls, const char *key,
                         Py_ssize_clean_t key_length);
 
 static PyObject *
-_gdbm_gdbm_nextkey(dbmobject *self, PyObject *arg)
+_gdbm_gdbm_nextkey(gdbmobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
     PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"", NULL};
+    static _PyArg_Parser _parser = {"s#:nextkey", _keywords, 0};
     const char *key;
     Py_ssize_clean_t key_length;
 
-    if (!PyArg_Parse(arg, "s#:nextkey", &key, &key_length)) {
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
+        &key, &key_length)) {
         goto exit;
     }
-    return_value = _gdbm_gdbm_nextkey_impl(self, key, key_length);
+    return_value = _gdbm_gdbm_nextkey_impl(self, cls, key, key_length);
 
 exit:
     return return_value;
@@ -179,15 +204,26 @@
 "kept and reused as new (key,value) pairs are added.");
 
 #define _GDBM_GDBM_REORGANIZE_METHODDEF    \
-    {"reorganize", (PyCFunction)_gdbm_gdbm_reorganize, METH_NOARGS, _gdbm_gdbm_reorganize__doc__},
+    {"reorganize", (PyCFunction)(void(*)(void))_gdbm_gdbm_reorganize, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _gdbm_gdbm_reorganize__doc__},
 
 static PyObject *
-_gdbm_gdbm_reorganize_impl(dbmobject *self);
+_gdbm_gdbm_reorganize_impl(gdbmobject *self, PyTypeObject *cls);
 
 static PyObject *
-_gdbm_gdbm_reorganize(dbmobject *self, PyObject *Py_UNUSED(ignored))
+_gdbm_gdbm_reorganize(gdbmobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
-    return _gdbm_gdbm_reorganize_impl(self);
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = { NULL};
+    static _PyArg_Parser _parser = {":reorganize", _keywords, 0};
+
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser
+        )) {
+        goto exit;
+    }
+    return_value = _gdbm_gdbm_reorganize_impl(self, cls);
+
+exit:
+    return return_value;
 }
 
 PyDoc_STRVAR(_gdbm_gdbm_sync__doc__,
@@ -200,15 +236,26 @@
 "any unwritten data to be written to the disk.");
 
 #define _GDBM_GDBM_SYNC_METHODDEF    \
-    {"sync", (PyCFunction)_gdbm_gdbm_sync, METH_NOARGS, _gdbm_gdbm_sync__doc__},
+    {"sync", (PyCFunction)(void(*)(void))_gdbm_gdbm_sync, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _gdbm_gdbm_sync__doc__},
 
 static PyObject *
-_gdbm_gdbm_sync_impl(dbmobject *self);
+_gdbm_gdbm_sync_impl(gdbmobject *self, PyTypeObject *cls);
 
 static PyObject *
-_gdbm_gdbm_sync(dbmobject *self, PyObject *Py_UNUSED(ignored))
+_gdbm_gdbm_sync(gdbmobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
-    return _gdbm_gdbm_sync_impl(self);
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = { NULL};
+    static _PyArg_Parser _parser = {":sync", _keywords, 0};
+
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser
+        )) {
+        goto exit;
+    }
+    return_value = _gdbm_gdbm_sync_impl(self, cls);
+
+exit:
+    return return_value;
 }
 
 PyDoc_STRVAR(dbmopen__doc__,
@@ -283,11 +330,6 @@
     if (nargs < 3) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     mode = _PyLong_AsInt(args[2]);
     if (mode == -1 && PyErr_Occurred()) {
         goto exit;
@@ -298,4 +340,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=2766471b2fa1a816 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=3b88446433e43d96 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_hashopenssl.c.h b/Modules/clinic/_hashopenssl.c.h
index 68aa765..de01489 100644
--- a/Modules/clinic/_hashopenssl.c.h
+++ b/Modules/clinic/_hashopenssl.c.h
@@ -92,14 +92,9 @@
     if (!args) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[0]);
+        PyObject *iobj = _PyNumber_Index(args[0]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -144,14 +139,9 @@
     if (!args) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[0]);
+        PyObject *iobj = _PyNumber_Index(args[0]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -936,11 +926,6 @@
         _PyArg_BadArgument("pbkdf2_hmac", "argument 'salt'", "contiguous buffer", args[2]);
         goto exit;
     }
-    if (PyFloat_Check(args[3])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     iterations = PyLong_AsLong(args[3]);
     if (iterations == -1 && PyErr_Occurred()) {
         goto exit;
@@ -965,7 +950,7 @@
     return return_value;
 }
 
-#if (OPENSSL_VERSION_NUMBER > 0x10100000L && !defined(OPENSSL_NO_SCRYPT) && !defined(LIBRESSL_VERSION_NUMBER))
+#if defined(PY_OPENSSL_HAS_SCRYPT)
 
 PyDoc_STRVAR(_hashlib_scrypt__doc__,
 "scrypt($module, /, password, *, salt=None, n=None, r=None, p=None,\n"
@@ -1055,11 +1040,6 @@
         }
     }
     if (args[5]) {
-        if (PyFloat_Check(args[5])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         maxmem = PyLong_AsLong(args[5]);
         if (maxmem == -1 && PyErr_Occurred()) {
             goto exit;
@@ -1068,11 +1048,6 @@
             goto skip_optional_kwonly;
         }
     }
-    if (PyFloat_Check(args[6])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     dklen = PyLong_AsLong(args[6]);
     if (dklen == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1093,7 +1068,7 @@
     return return_value;
 }
 
-#endif /* (OPENSSL_VERSION_NUMBER > 0x10100000L && !defined(OPENSSL_NO_SCRYPT) && !defined(LIBRESSL_VERSION_NUMBER)) */
+#endif /* defined(PY_OPENSSL_HAS_SCRYPT) */
 
 PyDoc_STRVAR(_hashlib_hmac_singleshot__doc__,
 "hmac_digest($module, /, key, msg, digest)\n"
@@ -1106,7 +1081,7 @@
 
 static PyObject *
 _hashlib_hmac_singleshot_impl(PyObject *module, Py_buffer *key,
-                              Py_buffer *msg, const char *digest);
+                              Py_buffer *msg, PyObject *digest);
 
 static PyObject *
 _hashlib_hmac_singleshot(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
@@ -1117,7 +1092,7 @@
     PyObject *argsbuf[3];
     Py_buffer key = {NULL, NULL};
     Py_buffer msg = {NULL, NULL};
-    const char *digest;
+    PyObject *digest;
 
     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 3, 0, argsbuf);
     if (!args) {
@@ -1137,19 +1112,7 @@
         _PyArg_BadArgument("hmac_digest", "argument 'msg'", "contiguous buffer", args[1]);
         goto exit;
     }
-    if (!PyUnicode_Check(args[2])) {
-        _PyArg_BadArgument("hmac_digest", "argument 'digest'", "str", args[2]);
-        goto exit;
-    }
-    Py_ssize_t digest_length;
-    digest = PyUnicode_AsUTF8AndSize(args[2], &digest_length);
-    if (digest == NULL) {
-        goto exit;
-    }
-    if (strlen(digest) != (size_t)digest_length) {
-        PyErr_SetString(PyExc_ValueError, "embedded null character");
-        goto exit;
-    }
+    digest = args[2];
     return_value = _hashlib_hmac_singleshot_impl(module, &key, &msg, digest);
 
 exit:
@@ -1176,7 +1139,7 @@
 
 static PyObject *
 _hashlib_hmac_new_impl(PyObject *module, Py_buffer *key, PyObject *msg_obj,
-                       const char *digestmod);
+                       PyObject *digestmod);
 
 static PyObject *
 _hashlib_hmac_new(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
@@ -1188,7 +1151,7 @@
     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
     Py_buffer key = {NULL, NULL};
     PyObject *msg_obj = NULL;
-    const char *digestmod = NULL;
+    PyObject *digestmod = NULL;
 
     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
     if (!args) {
@@ -1210,19 +1173,7 @@
             goto skip_optional_pos;
         }
     }
-    if (!PyUnicode_Check(args[2])) {
-        _PyArg_BadArgument("hmac_new", "argument 'digestmod'", "str", args[2]);
-        goto exit;
-    }
-    Py_ssize_t digestmod_length;
-    digestmod = PyUnicode_AsUTF8AndSize(args[2], &digestmod_length);
-    if (digestmod == NULL) {
-        goto exit;
-    }
-    if (strlen(digestmod) != (size_t)digestmod_length) {
-        PyErr_SetString(PyExc_ValueError, "embedded null character");
-        goto exit;
-    }
+    digestmod = args[2];
 skip_optional_pos:
     return_value = _hashlib_hmac_new_impl(module, &key, msg_obj, digestmod);
 
@@ -1324,8 +1275,6 @@
     return _hashlib_HMAC_hexdigest_impl(self);
 }
 
-#if !defined(LIBRESSL_VERSION_NUMBER)
-
 PyDoc_STRVAR(_hashlib_get_fips_mode__doc__,
 "get_fips_mode($module, /)\n"
 "--\n"
@@ -1361,8 +1310,6 @@
     return return_value;
 }
 
-#endif /* !defined(LIBRESSL_VERSION_NUMBER) */
-
 PyDoc_STRVAR(_hashlib_compare_digest__doc__,
 "compare_digest($module, a, b, /)\n"
 "--\n"
@@ -1438,8 +1385,4 @@
 #ifndef _HASHLIB_SCRYPT_METHODDEF
     #define _HASHLIB_SCRYPT_METHODDEF
 #endif /* !defined(_HASHLIB_SCRYPT_METHODDEF) */
-
-#ifndef _HASHLIB_GET_FIPS_MODE_METHODDEF
-    #define _HASHLIB_GET_FIPS_MODE_METHODDEF
-#endif /* !defined(_HASHLIB_GET_FIPS_MODE_METHODDEF) */
-/*[clinic end generated code: output=b6b280e46bf0b139 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=162369cb9d43f1cc input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_heapqmodule.c.h b/Modules/clinic/_heapqmodule.c.h
index 5540370..a894315 100644
--- a/Modules/clinic/_heapqmodule.c.h
+++ b/Modules/clinic/_heapqmodule.c.h
@@ -24,6 +24,10 @@
     if (!_PyArg_CheckPositional("heappush", nargs, 2, 2)) {
         goto exit;
     }
+    if (!PyList_Check(args[0])) {
+        _PyArg_BadArgument("heappush", "argument 1", "list", args[0]);
+        goto exit;
+    }
     heap = args[0];
     item = args[1];
     return_value = _heapq_heappush_impl(module, heap, item);
@@ -41,6 +45,26 @@
 #define _HEAPQ_HEAPPOP_METHODDEF    \
     {"heappop", (PyCFunction)_heapq_heappop, METH_O, _heapq_heappop__doc__},
 
+static PyObject *
+_heapq_heappop_impl(PyObject *module, PyObject *heap);
+
+static PyObject *
+_heapq_heappop(PyObject *module, PyObject *arg)
+{
+    PyObject *return_value = NULL;
+    PyObject *heap;
+
+    if (!PyList_Check(arg)) {
+        _PyArg_BadArgument("heappop", "argument", "list", arg);
+        goto exit;
+    }
+    heap = arg;
+    return_value = _heapq_heappop_impl(module, heap);
+
+exit:
+    return return_value;
+}
+
 PyDoc_STRVAR(_heapq_heapreplace__doc__,
 "heapreplace($module, heap, item, /)\n"
 "--\n"
@@ -71,6 +95,10 @@
     if (!_PyArg_CheckPositional("heapreplace", nargs, 2, 2)) {
         goto exit;
     }
+    if (!PyList_Check(args[0])) {
+        _PyArg_BadArgument("heapreplace", "argument 1", "list", args[0]);
+        goto exit;
+    }
     heap = args[0];
     item = args[1];
     return_value = _heapq_heapreplace_impl(module, heap, item);
@@ -104,6 +132,10 @@
     if (!_PyArg_CheckPositional("heappushpop", nargs, 2, 2)) {
         goto exit;
     }
+    if (!PyList_Check(args[0])) {
+        _PyArg_BadArgument("heappushpop", "argument 1", "list", args[0]);
+        goto exit;
+    }
     heap = args[0];
     item = args[1];
     return_value = _heapq_heappushpop_impl(module, heap, item);
@@ -121,6 +153,26 @@
 #define _HEAPQ_HEAPIFY_METHODDEF    \
     {"heapify", (PyCFunction)_heapq_heapify, METH_O, _heapq_heapify__doc__},
 
+static PyObject *
+_heapq_heapify_impl(PyObject *module, PyObject *heap);
+
+static PyObject *
+_heapq_heapify(PyObject *module, PyObject *arg)
+{
+    PyObject *return_value = NULL;
+    PyObject *heap;
+
+    if (!PyList_Check(arg)) {
+        _PyArg_BadArgument("heapify", "argument", "list", arg);
+        goto exit;
+    }
+    heap = arg;
+    return_value = _heapq_heapify_impl(module, heap);
+
+exit:
+    return return_value;
+}
+
 PyDoc_STRVAR(_heapq__heappop_max__doc__,
 "_heappop_max($module, heap, /)\n"
 "--\n"
@@ -130,6 +182,26 @@
 #define _HEAPQ__HEAPPOP_MAX_METHODDEF    \
     {"_heappop_max", (PyCFunction)_heapq__heappop_max, METH_O, _heapq__heappop_max__doc__},
 
+static PyObject *
+_heapq__heappop_max_impl(PyObject *module, PyObject *heap);
+
+static PyObject *
+_heapq__heappop_max(PyObject *module, PyObject *arg)
+{
+    PyObject *return_value = NULL;
+    PyObject *heap;
+
+    if (!PyList_Check(arg)) {
+        _PyArg_BadArgument("_heappop_max", "argument", "list", arg);
+        goto exit;
+    }
+    heap = arg;
+    return_value = _heapq__heappop_max_impl(module, heap);
+
+exit:
+    return return_value;
+}
+
 PyDoc_STRVAR(_heapq__heapreplace_max__doc__,
 "_heapreplace_max($module, heap, item, /)\n"
 "--\n"
@@ -153,6 +225,10 @@
     if (!_PyArg_CheckPositional("_heapreplace_max", nargs, 2, 2)) {
         goto exit;
     }
+    if (!PyList_Check(args[0])) {
+        _PyArg_BadArgument("_heapreplace_max", "argument 1", "list", args[0]);
+        goto exit;
+    }
     heap = args[0];
     item = args[1];
     return_value = _heapq__heapreplace_max_impl(module, heap, item);
@@ -169,4 +245,24 @@
 
 #define _HEAPQ__HEAPIFY_MAX_METHODDEF    \
     {"_heapify_max", (PyCFunction)_heapq__heapify_max, METH_O, _heapq__heapify_max__doc__},
-/*[clinic end generated code: output=37ef2a3319971c8d input=a9049054013a1b77]*/
+
+static PyObject *
+_heapq__heapify_max_impl(PyObject *module, PyObject *heap);
+
+static PyObject *
+_heapq__heapify_max(PyObject *module, PyObject *arg)
+{
+    PyObject *return_value = NULL;
+    PyObject *heap;
+
+    if (!PyList_Check(arg)) {
+        _PyArg_BadArgument("_heapify_max", "argument", "list", arg);
+        goto exit;
+    }
+    heap = arg;
+    return_value = _heapq__heapify_max_impl(module, heap);
+
+exit:
+    return return_value;
+}
+/*[clinic end generated code: output=9975cf51762878d5 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_localemodule.c.h b/Modules/clinic/_localemodule.c.h
new file mode 100644
index 0000000..703d034
--- /dev/null
+++ b/Modules/clinic/_localemodule.c.h
@@ -0,0 +1,605 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(_locale_setlocale__doc__,
+"setlocale($module, category, locale=<unrepresentable>, /)\n"
+"--\n"
+"\n"
+"Activates/queries locale processing.");
+
+#define _LOCALE_SETLOCALE_METHODDEF    \
+    {"setlocale", (PyCFunction)(void(*)(void))_locale_setlocale, METH_FASTCALL, _locale_setlocale__doc__},
+
+static PyObject *
+_locale_setlocale_impl(PyObject *module, int category, const char *locale);
+
+static PyObject *
+_locale_setlocale(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    int category;
+    const char *locale = NULL;
+
+    if (!_PyArg_CheckPositional("setlocale", nargs, 1, 2)) {
+        goto exit;
+    }
+    category = _PyLong_AsInt(args[0]);
+    if (category == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    if (nargs < 2) {
+        goto skip_optional;
+    }
+    if (args[1] == Py_None) {
+        locale = NULL;
+    }
+    else if (PyUnicode_Check(args[1])) {
+        Py_ssize_t locale_length;
+        locale = PyUnicode_AsUTF8AndSize(args[1], &locale_length);
+        if (locale == NULL) {
+            goto exit;
+        }
+        if (strlen(locale) != (size_t)locale_length) {
+            PyErr_SetString(PyExc_ValueError, "embedded null character");
+            goto exit;
+        }
+    }
+    else {
+        _PyArg_BadArgument("setlocale", "argument 2", "str or None", args[1]);
+        goto exit;
+    }
+skip_optional:
+    return_value = _locale_setlocale_impl(module, category, locale);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_locale_localeconv__doc__,
+"localeconv($module, /)\n"
+"--\n"
+"\n"
+"Returns numeric and monetary locale-specific parameters.");
+
+#define _LOCALE_LOCALECONV_METHODDEF    \
+    {"localeconv", (PyCFunction)_locale_localeconv, METH_NOARGS, _locale_localeconv__doc__},
+
+static PyObject *
+_locale_localeconv_impl(PyObject *module);
+
+static PyObject *
+_locale_localeconv(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+    return _locale_localeconv_impl(module);
+}
+
+#if defined(HAVE_WCSCOLL)
+
+PyDoc_STRVAR(_locale_strcoll__doc__,
+"strcoll($module, os1, os2, /)\n"
+"--\n"
+"\n"
+"Compares two strings according to the locale.");
+
+#define _LOCALE_STRCOLL_METHODDEF    \
+    {"strcoll", (PyCFunction)(void(*)(void))_locale_strcoll, METH_FASTCALL, _locale_strcoll__doc__},
+
+static PyObject *
+_locale_strcoll_impl(PyObject *module, PyObject *os1, PyObject *os2);
+
+static PyObject *
+_locale_strcoll(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    PyObject *os1;
+    PyObject *os2;
+
+    if (!_PyArg_CheckPositional("strcoll", nargs, 2, 2)) {
+        goto exit;
+    }
+    if (!PyUnicode_Check(args[0])) {
+        _PyArg_BadArgument("strcoll", "argument 1", "str", args[0]);
+        goto exit;
+    }
+    if (PyUnicode_READY(args[0]) == -1) {
+        goto exit;
+    }
+    os1 = args[0];
+    if (!PyUnicode_Check(args[1])) {
+        _PyArg_BadArgument("strcoll", "argument 2", "str", args[1]);
+        goto exit;
+    }
+    if (PyUnicode_READY(args[1]) == -1) {
+        goto exit;
+    }
+    os2 = args[1];
+    return_value = _locale_strcoll_impl(module, os1, os2);
+
+exit:
+    return return_value;
+}
+
+#endif /* defined(HAVE_WCSCOLL) */
+
+#if defined(HAVE_WCSXFRM)
+
+PyDoc_STRVAR(_locale_strxfrm__doc__,
+"strxfrm($module, string, /)\n"
+"--\n"
+"\n"
+"Return a string that can be used as a key for locale-aware comparisons.");
+
+#define _LOCALE_STRXFRM_METHODDEF    \
+    {"strxfrm", (PyCFunction)_locale_strxfrm, METH_O, _locale_strxfrm__doc__},
+
+static PyObject *
+_locale_strxfrm_impl(PyObject *module, PyObject *str);
+
+static PyObject *
+_locale_strxfrm(PyObject *module, PyObject *arg)
+{
+    PyObject *return_value = NULL;
+    PyObject *str;
+
+    if (!PyUnicode_Check(arg)) {
+        _PyArg_BadArgument("strxfrm", "argument", "str", arg);
+        goto exit;
+    }
+    if (PyUnicode_READY(arg) == -1) {
+        goto exit;
+    }
+    str = arg;
+    return_value = _locale_strxfrm_impl(module, str);
+
+exit:
+    return return_value;
+}
+
+#endif /* defined(HAVE_WCSXFRM) */
+
+#if defined(MS_WINDOWS)
+
+PyDoc_STRVAR(_locale__getdefaultlocale__doc__,
+"_getdefaultlocale($module, /)\n"
+"--\n"
+"\n");
+
+#define _LOCALE__GETDEFAULTLOCALE_METHODDEF    \
+    {"_getdefaultlocale", (PyCFunction)_locale__getdefaultlocale, METH_NOARGS, _locale__getdefaultlocale__doc__},
+
+static PyObject *
+_locale__getdefaultlocale_impl(PyObject *module);
+
+static PyObject *
+_locale__getdefaultlocale(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+    return _locale__getdefaultlocale_impl(module);
+}
+
+#endif /* defined(MS_WINDOWS) */
+
+#if defined(HAVE_LANGINFO_H)
+
+PyDoc_STRVAR(_locale_nl_langinfo__doc__,
+"nl_langinfo($module, key, /)\n"
+"--\n"
+"\n"
+"Return the value for the locale information associated with key.");
+
+#define _LOCALE_NL_LANGINFO_METHODDEF    \
+    {"nl_langinfo", (PyCFunction)_locale_nl_langinfo, METH_O, _locale_nl_langinfo__doc__},
+
+static PyObject *
+_locale_nl_langinfo_impl(PyObject *module, int item);
+
+static PyObject *
+_locale_nl_langinfo(PyObject *module, PyObject *arg)
+{
+    PyObject *return_value = NULL;
+    int item;
+
+    item = _PyLong_AsInt(arg);
+    if (item == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    return_value = _locale_nl_langinfo_impl(module, item);
+
+exit:
+    return return_value;
+}
+
+#endif /* defined(HAVE_LANGINFO_H) */
+
+#if defined(HAVE_LIBINTL_H)
+
+PyDoc_STRVAR(_locale_gettext__doc__,
+"gettext($module, msg, /)\n"
+"--\n"
+"\n"
+"gettext(msg) -> string\n"
+"\n"
+"Return translation of msg.");
+
+#define _LOCALE_GETTEXT_METHODDEF    \
+    {"gettext", (PyCFunction)_locale_gettext, METH_O, _locale_gettext__doc__},
+
+static PyObject *
+_locale_gettext_impl(PyObject *module, const char *in);
+
+static PyObject *
+_locale_gettext(PyObject *module, PyObject *arg)
+{
+    PyObject *return_value = NULL;
+    const char *in;
+
+    if (!PyUnicode_Check(arg)) {
+        _PyArg_BadArgument("gettext", "argument", "str", arg);
+        goto exit;
+    }
+    Py_ssize_t in_length;
+    in = PyUnicode_AsUTF8AndSize(arg, &in_length);
+    if (in == NULL) {
+        goto exit;
+    }
+    if (strlen(in) != (size_t)in_length) {
+        PyErr_SetString(PyExc_ValueError, "embedded null character");
+        goto exit;
+    }
+    return_value = _locale_gettext_impl(module, in);
+
+exit:
+    return return_value;
+}
+
+#endif /* defined(HAVE_LIBINTL_H) */
+
+#if defined(HAVE_LIBINTL_H)
+
+PyDoc_STRVAR(_locale_dgettext__doc__,
+"dgettext($module, domain, msg, /)\n"
+"--\n"
+"\n"
+"dgettext(domain, msg) -> string\n"
+"\n"
+"Return translation of msg in domain.");
+
+#define _LOCALE_DGETTEXT_METHODDEF    \
+    {"dgettext", (PyCFunction)(void(*)(void))_locale_dgettext, METH_FASTCALL, _locale_dgettext__doc__},
+
+static PyObject *
+_locale_dgettext_impl(PyObject *module, const char *domain, const char *in);
+
+static PyObject *
+_locale_dgettext(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    const char *domain;
+    const char *in;
+
+    if (!_PyArg_CheckPositional("dgettext", nargs, 2, 2)) {
+        goto exit;
+    }
+    if (args[0] == Py_None) {
+        domain = NULL;
+    }
+    else if (PyUnicode_Check(args[0])) {
+        Py_ssize_t domain_length;
+        domain = PyUnicode_AsUTF8AndSize(args[0], &domain_length);
+        if (domain == NULL) {
+            goto exit;
+        }
+        if (strlen(domain) != (size_t)domain_length) {
+            PyErr_SetString(PyExc_ValueError, "embedded null character");
+            goto exit;
+        }
+    }
+    else {
+        _PyArg_BadArgument("dgettext", "argument 1", "str or None", args[0]);
+        goto exit;
+    }
+    if (!PyUnicode_Check(args[1])) {
+        _PyArg_BadArgument("dgettext", "argument 2", "str", args[1]);
+        goto exit;
+    }
+    Py_ssize_t in_length;
+    in = PyUnicode_AsUTF8AndSize(args[1], &in_length);
+    if (in == NULL) {
+        goto exit;
+    }
+    if (strlen(in) != (size_t)in_length) {
+        PyErr_SetString(PyExc_ValueError, "embedded null character");
+        goto exit;
+    }
+    return_value = _locale_dgettext_impl(module, domain, in);
+
+exit:
+    return return_value;
+}
+
+#endif /* defined(HAVE_LIBINTL_H) */
+
+#if defined(HAVE_LIBINTL_H)
+
+PyDoc_STRVAR(_locale_dcgettext__doc__,
+"dcgettext($module, domain, msg, category, /)\n"
+"--\n"
+"\n"
+"Return translation of msg in domain and category.");
+
+#define _LOCALE_DCGETTEXT_METHODDEF    \
+    {"dcgettext", (PyCFunction)(void(*)(void))_locale_dcgettext, METH_FASTCALL, _locale_dcgettext__doc__},
+
+static PyObject *
+_locale_dcgettext_impl(PyObject *module, const char *domain,
+                       const char *msgid, int category);
+
+static PyObject *
+_locale_dcgettext(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    const char *domain;
+    const char *msgid;
+    int category;
+
+    if (!_PyArg_CheckPositional("dcgettext", nargs, 3, 3)) {
+        goto exit;
+    }
+    if (args[0] == Py_None) {
+        domain = NULL;
+    }
+    else if (PyUnicode_Check(args[0])) {
+        Py_ssize_t domain_length;
+        domain = PyUnicode_AsUTF8AndSize(args[0], &domain_length);
+        if (domain == NULL) {
+            goto exit;
+        }
+        if (strlen(domain) != (size_t)domain_length) {
+            PyErr_SetString(PyExc_ValueError, "embedded null character");
+            goto exit;
+        }
+    }
+    else {
+        _PyArg_BadArgument("dcgettext", "argument 1", "str or None", args[0]);
+        goto exit;
+    }
+    if (!PyUnicode_Check(args[1])) {
+        _PyArg_BadArgument("dcgettext", "argument 2", "str", args[1]);
+        goto exit;
+    }
+    Py_ssize_t msgid_length;
+    msgid = PyUnicode_AsUTF8AndSize(args[1], &msgid_length);
+    if (msgid == NULL) {
+        goto exit;
+    }
+    if (strlen(msgid) != (size_t)msgid_length) {
+        PyErr_SetString(PyExc_ValueError, "embedded null character");
+        goto exit;
+    }
+    category = _PyLong_AsInt(args[2]);
+    if (category == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    return_value = _locale_dcgettext_impl(module, domain, msgid, category);
+
+exit:
+    return return_value;
+}
+
+#endif /* defined(HAVE_LIBINTL_H) */
+
+#if defined(HAVE_LIBINTL_H)
+
+PyDoc_STRVAR(_locale_textdomain__doc__,
+"textdomain($module, domain, /)\n"
+"--\n"
+"\n"
+"Set the C library\'s textdmain to domain, returning the new domain.");
+
+#define _LOCALE_TEXTDOMAIN_METHODDEF    \
+    {"textdomain", (PyCFunction)_locale_textdomain, METH_O, _locale_textdomain__doc__},
+
+static PyObject *
+_locale_textdomain_impl(PyObject *module, const char *domain);
+
+static PyObject *
+_locale_textdomain(PyObject *module, PyObject *arg)
+{
+    PyObject *return_value = NULL;
+    const char *domain;
+
+    if (arg == Py_None) {
+        domain = NULL;
+    }
+    else if (PyUnicode_Check(arg)) {
+        Py_ssize_t domain_length;
+        domain = PyUnicode_AsUTF8AndSize(arg, &domain_length);
+        if (domain == NULL) {
+            goto exit;
+        }
+        if (strlen(domain) != (size_t)domain_length) {
+            PyErr_SetString(PyExc_ValueError, "embedded null character");
+            goto exit;
+        }
+    }
+    else {
+        _PyArg_BadArgument("textdomain", "argument", "str or None", arg);
+        goto exit;
+    }
+    return_value = _locale_textdomain_impl(module, domain);
+
+exit:
+    return return_value;
+}
+
+#endif /* defined(HAVE_LIBINTL_H) */
+
+#if defined(HAVE_LIBINTL_H)
+
+PyDoc_STRVAR(_locale_bindtextdomain__doc__,
+"bindtextdomain($module, domain, dir, /)\n"
+"--\n"
+"\n"
+"Bind the C library\'s domain to dir.");
+
+#define _LOCALE_BINDTEXTDOMAIN_METHODDEF    \
+    {"bindtextdomain", (PyCFunction)(void(*)(void))_locale_bindtextdomain, METH_FASTCALL, _locale_bindtextdomain__doc__},
+
+static PyObject *
+_locale_bindtextdomain_impl(PyObject *module, const char *domain,
+                            PyObject *dirname_obj);
+
+static PyObject *
+_locale_bindtextdomain(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    const char *domain;
+    PyObject *dirname_obj;
+
+    if (!_PyArg_CheckPositional("bindtextdomain", nargs, 2, 2)) {
+        goto exit;
+    }
+    if (!PyUnicode_Check(args[0])) {
+        _PyArg_BadArgument("bindtextdomain", "argument 1", "str", args[0]);
+        goto exit;
+    }
+    Py_ssize_t domain_length;
+    domain = PyUnicode_AsUTF8AndSize(args[0], &domain_length);
+    if (domain == NULL) {
+        goto exit;
+    }
+    if (strlen(domain) != (size_t)domain_length) {
+        PyErr_SetString(PyExc_ValueError, "embedded null character");
+        goto exit;
+    }
+    dirname_obj = args[1];
+    return_value = _locale_bindtextdomain_impl(module, domain, dirname_obj);
+
+exit:
+    return return_value;
+}
+
+#endif /* defined(HAVE_LIBINTL_H) */
+
+#if defined(HAVE_LIBINTL_H) && defined(HAVE_BIND_TEXTDOMAIN_CODESET)
+
+PyDoc_STRVAR(_locale_bind_textdomain_codeset__doc__,
+"bind_textdomain_codeset($module, domain, codeset, /)\n"
+"--\n"
+"\n"
+"Bind the C library\'s domain to codeset.");
+
+#define _LOCALE_BIND_TEXTDOMAIN_CODESET_METHODDEF    \
+    {"bind_textdomain_codeset", (PyCFunction)(void(*)(void))_locale_bind_textdomain_codeset, METH_FASTCALL, _locale_bind_textdomain_codeset__doc__},
+
+static PyObject *
+_locale_bind_textdomain_codeset_impl(PyObject *module, const char *domain,
+                                     const char *codeset);
+
+static PyObject *
+_locale_bind_textdomain_codeset(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    const char *domain;
+    const char *codeset;
+
+    if (!_PyArg_CheckPositional("bind_textdomain_codeset", nargs, 2, 2)) {
+        goto exit;
+    }
+    if (!PyUnicode_Check(args[0])) {
+        _PyArg_BadArgument("bind_textdomain_codeset", "argument 1", "str", args[0]);
+        goto exit;
+    }
+    Py_ssize_t domain_length;
+    domain = PyUnicode_AsUTF8AndSize(args[0], &domain_length);
+    if (domain == NULL) {
+        goto exit;
+    }
+    if (strlen(domain) != (size_t)domain_length) {
+        PyErr_SetString(PyExc_ValueError, "embedded null character");
+        goto exit;
+    }
+    if (args[1] == Py_None) {
+        codeset = NULL;
+    }
+    else if (PyUnicode_Check(args[1])) {
+        Py_ssize_t codeset_length;
+        codeset = PyUnicode_AsUTF8AndSize(args[1], &codeset_length);
+        if (codeset == NULL) {
+            goto exit;
+        }
+        if (strlen(codeset) != (size_t)codeset_length) {
+            PyErr_SetString(PyExc_ValueError, "embedded null character");
+            goto exit;
+        }
+    }
+    else {
+        _PyArg_BadArgument("bind_textdomain_codeset", "argument 2", "str or None", args[1]);
+        goto exit;
+    }
+    return_value = _locale_bind_textdomain_codeset_impl(module, domain, codeset);
+
+exit:
+    return return_value;
+}
+
+#endif /* defined(HAVE_LIBINTL_H) && defined(HAVE_BIND_TEXTDOMAIN_CODESET) */
+
+PyDoc_STRVAR(_locale__get_locale_encoding__doc__,
+"_get_locale_encoding($module, /)\n"
+"--\n"
+"\n"
+"Get the current locale encoding.");
+
+#define _LOCALE__GET_LOCALE_ENCODING_METHODDEF    \
+    {"_get_locale_encoding", (PyCFunction)_locale__get_locale_encoding, METH_NOARGS, _locale__get_locale_encoding__doc__},
+
+static PyObject *
+_locale__get_locale_encoding_impl(PyObject *module);
+
+static PyObject *
+_locale__get_locale_encoding(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+    return _locale__get_locale_encoding_impl(module);
+}
+
+#ifndef _LOCALE_STRCOLL_METHODDEF
+    #define _LOCALE_STRCOLL_METHODDEF
+#endif /* !defined(_LOCALE_STRCOLL_METHODDEF) */
+
+#ifndef _LOCALE_STRXFRM_METHODDEF
+    #define _LOCALE_STRXFRM_METHODDEF
+#endif /* !defined(_LOCALE_STRXFRM_METHODDEF) */
+
+#ifndef _LOCALE__GETDEFAULTLOCALE_METHODDEF
+    #define _LOCALE__GETDEFAULTLOCALE_METHODDEF
+#endif /* !defined(_LOCALE__GETDEFAULTLOCALE_METHODDEF) */
+
+#ifndef _LOCALE_NL_LANGINFO_METHODDEF
+    #define _LOCALE_NL_LANGINFO_METHODDEF
+#endif /* !defined(_LOCALE_NL_LANGINFO_METHODDEF) */
+
+#ifndef _LOCALE_GETTEXT_METHODDEF
+    #define _LOCALE_GETTEXT_METHODDEF
+#endif /* !defined(_LOCALE_GETTEXT_METHODDEF) */
+
+#ifndef _LOCALE_DGETTEXT_METHODDEF
+    #define _LOCALE_DGETTEXT_METHODDEF
+#endif /* !defined(_LOCALE_DGETTEXT_METHODDEF) */
+
+#ifndef _LOCALE_DCGETTEXT_METHODDEF
+    #define _LOCALE_DCGETTEXT_METHODDEF
+#endif /* !defined(_LOCALE_DCGETTEXT_METHODDEF) */
+
+#ifndef _LOCALE_TEXTDOMAIN_METHODDEF
+    #define _LOCALE_TEXTDOMAIN_METHODDEF
+#endif /* !defined(_LOCALE_TEXTDOMAIN_METHODDEF) */
+
+#ifndef _LOCALE_BINDTEXTDOMAIN_METHODDEF
+    #define _LOCALE_BINDTEXTDOMAIN_METHODDEF
+#endif /* !defined(_LOCALE_BINDTEXTDOMAIN_METHODDEF) */
+
+#ifndef _LOCALE_BIND_TEXTDOMAIN_CODESET_METHODDEF
+    #define _LOCALE_BIND_TEXTDOMAIN_CODESET_METHODDEF
+#endif /* !defined(_LOCALE_BIND_TEXTDOMAIN_CODESET_METHODDEF) */
+/*[clinic end generated code: output=cd703c8a3a75fcf4 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_lsprof.c.h b/Modules/clinic/_lsprof.c.h
new file mode 100644
index 0000000..5d9c209
--- /dev/null
+++ b/Modules/clinic/_lsprof.c.h
@@ -0,0 +1,55 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(_lsprof_Profiler_getstats__doc__,
+"getstats($self, /)\n"
+"--\n"
+"\n"
+"list of profiler_entry objects.\n"
+"\n"
+"getstats() -> list of profiler_entry objects\n"
+"\n"
+"Return all information collected by the profiler.\n"
+"Each profiler_entry is a tuple-like object with the\n"
+"following attributes:\n"
+"\n"
+"    code          code object\n"
+"    callcount     how many times this was called\n"
+"    reccallcount  how many times called recursively\n"
+"    totaltime     total time in this entry\n"
+"    inlinetime    inline time in this entry (not in subcalls)\n"
+"    calls         details of the calls\n"
+"\n"
+"The calls attribute is either None or a list of\n"
+"profiler_subentry objects:\n"
+"\n"
+"    code          called code object\n"
+"    callcount     how many times this is called\n"
+"    reccallcount  how many times this is called recursively\n"
+"    totaltime     total time spent in this call\n"
+"    inlinetime    inline time (not in further subcalls)");
+
+#define _LSPROF_PROFILER_GETSTATS_METHODDEF    \
+    {"getstats", (PyCFunction)(void(*)(void))_lsprof_Profiler_getstats, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _lsprof_Profiler_getstats__doc__},
+
+static PyObject *
+_lsprof_Profiler_getstats_impl(ProfilerObject *self, PyTypeObject *cls);
+
+static PyObject *
+_lsprof_Profiler_getstats(ProfilerObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = { NULL};
+    static _PyArg_Parser _parser = {":getstats", _keywords, 0};
+
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser
+        )) {
+        goto exit;
+    }
+    return_value = _lsprof_Profiler_getstats_impl(self, cls);
+
+exit:
+    return return_value;
+}
+/*[clinic end generated code: output=b4727cfebecdd22d input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_lzmamodule.c.h b/Modules/clinic/_lzmamodule.c.h
index 82ef4d5..526031a 100644
--- a/Modules/clinic/_lzmamodule.c.h
+++ b/Modules/clinic/_lzmamodule.c.h
@@ -116,14 +116,9 @@
     if (!noptargs) {
         goto skip_optional_pos;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[1]);
+        PyObject *iobj = _PyNumber_Index(args[1]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -194,11 +189,6 @@
         goto skip_optional_pos;
     }
     if (fastargs[0]) {
-        if (PyFloat_Check(fastargs[0])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         format = _PyLong_AsInt(fastargs[0]);
         if (format == -1 && PyErr_Occurred()) {
             goto exit;
@@ -241,11 +231,6 @@
     PyObject *return_value = NULL;
     int check_id;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     check_id = _PyLong_AsInt(arg);
     if (check_id == -1 && PyErr_Occurred()) {
         goto exit;
@@ -256,39 +241,6 @@
     return return_value;
 }
 
-PyDoc_STRVAR(_lzma__encode_filter_properties__doc__,
-"_encode_filter_properties($module, filter, /)\n"
-"--\n"
-"\n"
-"Return a bytes object encoding the options (properties) of the filter specified by *filter* (a dict).\n"
-"\n"
-"The result does not include the filter ID itself, only the options.");
-
-#define _LZMA__ENCODE_FILTER_PROPERTIES_METHODDEF    \
-    {"_encode_filter_properties", (PyCFunction)_lzma__encode_filter_properties, METH_O, _lzma__encode_filter_properties__doc__},
-
-static PyObject *
-_lzma__encode_filter_properties_impl(PyObject *module, lzma_filter filter);
-
-static PyObject *
-_lzma__encode_filter_properties(PyObject *module, PyObject *arg)
-{
-    PyObject *return_value = NULL;
-    lzma_filter filter = {LZMA_VLI_UNKNOWN, NULL};
-
-    if (!lzma_filter_converter(arg, &filter)) {
-        goto exit;
-    }
-    return_value = _lzma__encode_filter_properties_impl(module, filter);
-
-exit:
-    /* Cleanup for filter */
-    if (filter.id != LZMA_VLI_UNKNOWN)
-       PyMem_Free(filter.options);
-
-    return return_value;
-}
-
 PyDoc_STRVAR(_lzma__decode_filter_properties__doc__,
 "_decode_filter_properties($module, filter_id, encoded_props, /)\n"
 "--\n"
@@ -334,4 +286,4 @@
 
     return return_value;
 }
-/*[clinic end generated code: output=f7477a10e86a717d input=a9049054013a1b77]*/
+/*[clinic end generated code: output=867b9e334053b679 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_opcode.c.h b/Modules/clinic/_opcode.c.h
index 777701f..6915f21 100644
--- a/Modules/clinic/_opcode.c.h
+++ b/Modules/clinic/_opcode.c.h
@@ -32,11 +32,6 @@
     if (!args) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     opcode = _PyLong_AsInt(args[0]);
     if (opcode == -1 && PyErr_Occurred()) {
         goto exit;
@@ -61,4 +56,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=7bc08f2835b2cf89 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=bcf66d25c2624197 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_operator.c.h b/Modules/clinic/_operator.c.h
index f9e353d..bda2eba 100644
--- a/Modules/clinic/_operator.c.h
+++ b/Modules/clinic/_operator.c.h
@@ -957,7 +957,7 @@
 "countOf($module, a, b, /)\n"
 "--\n"
 "\n"
-"Return the number of times b occurs in a.");
+"Return the number of items in a which are, or which equal, b.");
 
 #define _OPERATOR_COUNTOF_METHODDEF    \
     {"countOf", (PyCFunction)(void(*)(void))_operator_countOf, METH_FASTCALL, _operator_countOf__doc__},
@@ -1424,14 +1424,9 @@
     if (nargs < 2) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[1]);
+        PyObject *iobj = _PyNumber_Index(args[1]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -1491,4 +1486,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=e7ed71a8c475a901 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=16749e11fda51785 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_queuemodule.c.h b/Modules/clinic/_queuemodule.c.h
index c25eacf..8741f7d 100644
--- a/Modules/clinic/_queuemodule.c.h
+++ b/Modules/clinic/_queuemodule.c.h
@@ -16,11 +16,11 @@
 {
     PyObject *return_value = NULL;
 
-    if ((type == &PySimpleQueueType) &&
+    if ((type == simplequeue_get_state_by_type(type)->SimpleQueueType) &&
         !_PyArg_NoPositional("SimpleQueue", args)) {
         goto exit;
     }
-    if ((type == &PySimpleQueueType) &&
+    if ((type == simplequeue_get_state_by_type(type)->SimpleQueueType) &&
         !_PyArg_NoKeywords("SimpleQueue", kwargs)) {
         goto exit;
     }
@@ -133,42 +133,26 @@
 "in that case).");
 
 #define _QUEUE_SIMPLEQUEUE_GET_METHODDEF    \
-    {"get", (PyCFunction)(void(*)(void))_queue_SimpleQueue_get, METH_FASTCALL|METH_KEYWORDS, _queue_SimpleQueue_get__doc__},
+    {"get", (PyCFunction)(void(*)(void))_queue_SimpleQueue_get, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _queue_SimpleQueue_get__doc__},
 
 static PyObject *
-_queue_SimpleQueue_get_impl(simplequeueobject *self, int block,
-                            PyObject *timeout);
+_queue_SimpleQueue_get_impl(simplequeueobject *self, PyTypeObject *cls,
+                            int block, PyObject *timeout);
 
 static PyObject *
-_queue_SimpleQueue_get(simplequeueobject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+_queue_SimpleQueue_get(simplequeueobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
     PyObject *return_value = NULL;
     static const char * const _keywords[] = {"block", "timeout", NULL};
-    static _PyArg_Parser _parser = {NULL, _keywords, "get", 0};
-    PyObject *argsbuf[2];
-    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
+    static _PyArg_Parser _parser = {"|pO:get", _keywords, 0};
     int block = 1;
     PyObject *timeout = Py_None;
 
-    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 2, 0, argsbuf);
-    if (!args) {
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
+        &block, &timeout)) {
         goto exit;
     }
-    if (!noptargs) {
-        goto skip_optional_pos;
-    }
-    if (args[0]) {
-        block = PyObject_IsTrue(args[0]);
-        if (block < 0) {
-            goto exit;
-        }
-        if (!--noptargs) {
-            goto skip_optional_pos;
-        }
-    }
-    timeout = args[1];
-skip_optional_pos:
-    return_value = _queue_SimpleQueue_get_impl(self, block, timeout);
+    return_value = _queue_SimpleQueue_get_impl(self, cls, block, timeout);
 
 exit:
     return return_value;
@@ -184,15 +168,27 @@
 "raise the Empty exception.");
 
 #define _QUEUE_SIMPLEQUEUE_GET_NOWAIT_METHODDEF    \
-    {"get_nowait", (PyCFunction)_queue_SimpleQueue_get_nowait, METH_NOARGS, _queue_SimpleQueue_get_nowait__doc__},
+    {"get_nowait", (PyCFunction)(void(*)(void))_queue_SimpleQueue_get_nowait, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _queue_SimpleQueue_get_nowait__doc__},
 
 static PyObject *
-_queue_SimpleQueue_get_nowait_impl(simplequeueobject *self);
+_queue_SimpleQueue_get_nowait_impl(simplequeueobject *self,
+                                   PyTypeObject *cls);
 
 static PyObject *
-_queue_SimpleQueue_get_nowait(simplequeueobject *self, PyObject *Py_UNUSED(ignored))
+_queue_SimpleQueue_get_nowait(simplequeueobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
-    return _queue_SimpleQueue_get_nowait_impl(self);
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = { NULL};
+    static _PyArg_Parser _parser = {":get_nowait", _keywords, 0};
+
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser
+        )) {
+        goto exit;
+    }
+    return_value = _queue_SimpleQueue_get_nowait_impl(self, cls);
+
+exit:
+    return return_value;
 }
 
 PyDoc_STRVAR(_queue_SimpleQueue_empty__doc__,
@@ -250,4 +246,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=b4717e2974cbc909 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=ce56b46fac150909 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_randommodule.c.h b/Modules/clinic/_randommodule.c.h
index a467811..b3cd435 100644
--- a/Modules/clinic/_randommodule.c.h
+++ b/Modules/clinic/_randommodule.c.h
@@ -100,11 +100,6 @@
     PyObject *return_value = NULL;
     int k;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     k = _PyLong_AsInt(arg);
     if (k == -1 && PyErr_Occurred()) {
         goto exit;
@@ -114,4 +109,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=a7feb0c9c8d1b627 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=cc8a23b2757dc6ba input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_sre.c.h b/Modules/clinic/_sre.c.h
index d398a85..72d772c 100644
--- a/Modules/clinic/_sre.c.h
+++ b/Modules/clinic/_sre.c.h
@@ -47,11 +47,6 @@
     int character;
     int _return_value;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     character = _PyLong_AsInt(arg);
     if (character == -1 && PyErr_Occurred()) {
         goto exit;
@@ -84,11 +79,6 @@
     int character;
     int _return_value;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     character = _PyLong_AsInt(arg);
     if (character == -1 && PyErr_Occurred()) {
         goto exit;
@@ -121,11 +111,6 @@
     int character;
     int _return_value;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     character = _PyLong_AsInt(arg);
     if (character == -1 && PyErr_Occurred()) {
         goto exit;
@@ -158,11 +143,6 @@
     int character;
     int _return_value;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     character = _PyLong_AsInt(arg);
     if (character == -1 && PyErr_Occurred()) {
         goto exit;
@@ -184,73 +164,28 @@
 "Matches zero or more characters at the beginning of the string.");
 
 #define _SRE_SRE_PATTERN_MATCH_METHODDEF    \
-    {"match", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_match, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_match__doc__},
+    {"match", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_match, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_match__doc__},
 
 static PyObject *
-_sre_SRE_Pattern_match_impl(PatternObject *self, PyObject *string,
-                            Py_ssize_t pos, Py_ssize_t endpos);
+_sre_SRE_Pattern_match_impl(PatternObject *self, PyTypeObject *cls,
+                            PyObject *string, Py_ssize_t pos,
+                            Py_ssize_t endpos);
 
 static PyObject *
-_sre_SRE_Pattern_match(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+_sre_SRE_Pattern_match(PatternObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
     PyObject *return_value = NULL;
     static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
-    static _PyArg_Parser _parser = {NULL, _keywords, "match", 0};
-    PyObject *argsbuf[3];
-    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
+    static _PyArg_Parser _parser = {"O|nn:match", _keywords, 0};
     PyObject *string;
     Py_ssize_t pos = 0;
     Py_ssize_t endpos = PY_SSIZE_T_MAX;
 
-    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
-    if (!args) {
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
+        &string, &pos, &endpos)) {
         goto exit;
     }
-    string = args[0];
-    if (!noptargs) {
-        goto skip_optional_pos;
-    }
-    if (args[1]) {
-        if (PyFloat_Check(args[1])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
-        {
-            Py_ssize_t ival = -1;
-            PyObject *iobj = PyNumber_Index(args[1]);
-            if (iobj != NULL) {
-                ival = PyLong_AsSsize_t(iobj);
-                Py_DECREF(iobj);
-            }
-            if (ival == -1 && PyErr_Occurred()) {
-                goto exit;
-            }
-            pos = ival;
-        }
-        if (!--noptargs) {
-            goto skip_optional_pos;
-        }
-    }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
-    {
-        Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[2]);
-        if (iobj != NULL) {
-            ival = PyLong_AsSsize_t(iobj);
-            Py_DECREF(iobj);
-        }
-        if (ival == -1 && PyErr_Occurred()) {
-            goto exit;
-        }
-        endpos = ival;
-    }
-skip_optional_pos:
-    return_value = _sre_SRE_Pattern_match_impl(self, string, pos, endpos);
+    return_value = _sre_SRE_Pattern_match_impl(self, cls, string, pos, endpos);
 
 exit:
     return return_value;
@@ -263,73 +198,28 @@
 "Matches against all of the string.");
 
 #define _SRE_SRE_PATTERN_FULLMATCH_METHODDEF    \
-    {"fullmatch", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_fullmatch, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_fullmatch__doc__},
+    {"fullmatch", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_fullmatch, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_fullmatch__doc__},
 
 static PyObject *
-_sre_SRE_Pattern_fullmatch_impl(PatternObject *self, PyObject *string,
-                                Py_ssize_t pos, Py_ssize_t endpos);
+_sre_SRE_Pattern_fullmatch_impl(PatternObject *self, PyTypeObject *cls,
+                                PyObject *string, Py_ssize_t pos,
+                                Py_ssize_t endpos);
 
 static PyObject *
-_sre_SRE_Pattern_fullmatch(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+_sre_SRE_Pattern_fullmatch(PatternObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
     PyObject *return_value = NULL;
     static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
-    static _PyArg_Parser _parser = {NULL, _keywords, "fullmatch", 0};
-    PyObject *argsbuf[3];
-    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
+    static _PyArg_Parser _parser = {"O|nn:fullmatch", _keywords, 0};
     PyObject *string;
     Py_ssize_t pos = 0;
     Py_ssize_t endpos = PY_SSIZE_T_MAX;
 
-    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
-    if (!args) {
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
+        &string, &pos, &endpos)) {
         goto exit;
     }
-    string = args[0];
-    if (!noptargs) {
-        goto skip_optional_pos;
-    }
-    if (args[1]) {
-        if (PyFloat_Check(args[1])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
-        {
-            Py_ssize_t ival = -1;
-            PyObject *iobj = PyNumber_Index(args[1]);
-            if (iobj != NULL) {
-                ival = PyLong_AsSsize_t(iobj);
-                Py_DECREF(iobj);
-            }
-            if (ival == -1 && PyErr_Occurred()) {
-                goto exit;
-            }
-            pos = ival;
-        }
-        if (!--noptargs) {
-            goto skip_optional_pos;
-        }
-    }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
-    {
-        Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[2]);
-        if (iobj != NULL) {
-            ival = PyLong_AsSsize_t(iobj);
-            Py_DECREF(iobj);
-        }
-        if (ival == -1 && PyErr_Occurred()) {
-            goto exit;
-        }
-        endpos = ival;
-    }
-skip_optional_pos:
-    return_value = _sre_SRE_Pattern_fullmatch_impl(self, string, pos, endpos);
+    return_value = _sre_SRE_Pattern_fullmatch_impl(self, cls, string, pos, endpos);
 
 exit:
     return return_value;
@@ -344,73 +234,28 @@
 "Return None if no position in the string matches.");
 
 #define _SRE_SRE_PATTERN_SEARCH_METHODDEF    \
-    {"search", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_search, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_search__doc__},
+    {"search", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_search, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_search__doc__},
 
 static PyObject *
-_sre_SRE_Pattern_search_impl(PatternObject *self, PyObject *string,
-                             Py_ssize_t pos, Py_ssize_t endpos);
+_sre_SRE_Pattern_search_impl(PatternObject *self, PyTypeObject *cls,
+                             PyObject *string, Py_ssize_t pos,
+                             Py_ssize_t endpos);
 
 static PyObject *
-_sre_SRE_Pattern_search(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+_sre_SRE_Pattern_search(PatternObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
     PyObject *return_value = NULL;
     static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
-    static _PyArg_Parser _parser = {NULL, _keywords, "search", 0};
-    PyObject *argsbuf[3];
-    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
+    static _PyArg_Parser _parser = {"O|nn:search", _keywords, 0};
     PyObject *string;
     Py_ssize_t pos = 0;
     Py_ssize_t endpos = PY_SSIZE_T_MAX;
 
-    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
-    if (!args) {
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
+        &string, &pos, &endpos)) {
         goto exit;
     }
-    string = args[0];
-    if (!noptargs) {
-        goto skip_optional_pos;
-    }
-    if (args[1]) {
-        if (PyFloat_Check(args[1])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
-        {
-            Py_ssize_t ival = -1;
-            PyObject *iobj = PyNumber_Index(args[1]);
-            if (iobj != NULL) {
-                ival = PyLong_AsSsize_t(iobj);
-                Py_DECREF(iobj);
-            }
-            if (ival == -1 && PyErr_Occurred()) {
-                goto exit;
-            }
-            pos = ival;
-        }
-        if (!--noptargs) {
-            goto skip_optional_pos;
-        }
-    }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
-    {
-        Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[2]);
-        if (iobj != NULL) {
-            ival = PyLong_AsSsize_t(iobj);
-            Py_DECREF(iobj);
-        }
-        if (ival == -1 && PyErr_Occurred()) {
-            goto exit;
-        }
-        endpos = ival;
-    }
-skip_optional_pos:
-    return_value = _sre_SRE_Pattern_search_impl(self, string, pos, endpos);
+    return_value = _sre_SRE_Pattern_search_impl(self, cls, string, pos, endpos);
 
 exit:
     return return_value;
@@ -450,14 +295,9 @@
         goto skip_optional_pos;
     }
     if (args[1]) {
-        if (PyFloat_Check(args[1])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         {
             Py_ssize_t ival = -1;
-            PyObject *iobj = PyNumber_Index(args[1]);
+            PyObject *iobj = _PyNumber_Index(args[1]);
             if (iobj != NULL) {
                 ival = PyLong_AsSsize_t(iobj);
                 Py_DECREF(iobj);
@@ -471,14 +311,9 @@
             goto skip_optional_pos;
         }
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[2]);
+        PyObject *iobj = _PyNumber_Index(args[2]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -504,73 +339,28 @@
 "For each match, the iterator returns a match object.");
 
 #define _SRE_SRE_PATTERN_FINDITER_METHODDEF    \
-    {"finditer", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_finditer, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_finditer__doc__},
+    {"finditer", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_finditer, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_finditer__doc__},
 
 static PyObject *
-_sre_SRE_Pattern_finditer_impl(PatternObject *self, PyObject *string,
-                               Py_ssize_t pos, Py_ssize_t endpos);
+_sre_SRE_Pattern_finditer_impl(PatternObject *self, PyTypeObject *cls,
+                               PyObject *string, Py_ssize_t pos,
+                               Py_ssize_t endpos);
 
 static PyObject *
-_sre_SRE_Pattern_finditer(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+_sre_SRE_Pattern_finditer(PatternObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
     PyObject *return_value = NULL;
     static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
-    static _PyArg_Parser _parser = {NULL, _keywords, "finditer", 0};
-    PyObject *argsbuf[3];
-    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
+    static _PyArg_Parser _parser = {"O|nn:finditer", _keywords, 0};
     PyObject *string;
     Py_ssize_t pos = 0;
     Py_ssize_t endpos = PY_SSIZE_T_MAX;
 
-    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
-    if (!args) {
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
+        &string, &pos, &endpos)) {
         goto exit;
     }
-    string = args[0];
-    if (!noptargs) {
-        goto skip_optional_pos;
-    }
-    if (args[1]) {
-        if (PyFloat_Check(args[1])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
-        {
-            Py_ssize_t ival = -1;
-            PyObject *iobj = PyNumber_Index(args[1]);
-            if (iobj != NULL) {
-                ival = PyLong_AsSsize_t(iobj);
-                Py_DECREF(iobj);
-            }
-            if (ival == -1 && PyErr_Occurred()) {
-                goto exit;
-            }
-            pos = ival;
-        }
-        if (!--noptargs) {
-            goto skip_optional_pos;
-        }
-    }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
-    {
-        Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[2]);
-        if (iobj != NULL) {
-            ival = PyLong_AsSsize_t(iobj);
-            Py_DECREF(iobj);
-        }
-        if (ival == -1 && PyErr_Occurred()) {
-            goto exit;
-        }
-        endpos = ival;
-    }
-skip_optional_pos:
-    return_value = _sre_SRE_Pattern_finditer_impl(self, string, pos, endpos);
+    return_value = _sre_SRE_Pattern_finditer_impl(self, cls, string, pos, endpos);
 
 exit:
     return return_value;
@@ -582,73 +372,28 @@
 "\n");
 
 #define _SRE_SRE_PATTERN_SCANNER_METHODDEF    \
-    {"scanner", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_scanner, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_scanner__doc__},
+    {"scanner", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_scanner, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_scanner__doc__},
 
 static PyObject *
-_sre_SRE_Pattern_scanner_impl(PatternObject *self, PyObject *string,
-                              Py_ssize_t pos, Py_ssize_t endpos);
+_sre_SRE_Pattern_scanner_impl(PatternObject *self, PyTypeObject *cls,
+                              PyObject *string, Py_ssize_t pos,
+                              Py_ssize_t endpos);
 
 static PyObject *
-_sre_SRE_Pattern_scanner(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+_sre_SRE_Pattern_scanner(PatternObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
     PyObject *return_value = NULL;
     static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
-    static _PyArg_Parser _parser = {NULL, _keywords, "scanner", 0};
-    PyObject *argsbuf[3];
-    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
+    static _PyArg_Parser _parser = {"O|nn:scanner", _keywords, 0};
     PyObject *string;
     Py_ssize_t pos = 0;
     Py_ssize_t endpos = PY_SSIZE_T_MAX;
 
-    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
-    if (!args) {
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
+        &string, &pos, &endpos)) {
         goto exit;
     }
-    string = args[0];
-    if (!noptargs) {
-        goto skip_optional_pos;
-    }
-    if (args[1]) {
-        if (PyFloat_Check(args[1])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
-        {
-            Py_ssize_t ival = -1;
-            PyObject *iobj = PyNumber_Index(args[1]);
-            if (iobj != NULL) {
-                ival = PyLong_AsSsize_t(iobj);
-                Py_DECREF(iobj);
-            }
-            if (ival == -1 && PyErr_Occurred()) {
-                goto exit;
-            }
-            pos = ival;
-        }
-        if (!--noptargs) {
-            goto skip_optional_pos;
-        }
-    }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
-    {
-        Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[2]);
-        if (iobj != NULL) {
-            ival = PyLong_AsSsize_t(iobj);
-            Py_DECREF(iobj);
-        }
-        if (ival == -1 && PyErr_Occurred()) {
-            goto exit;
-        }
-        endpos = ival;
-    }
-skip_optional_pos:
-    return_value = _sre_SRE_Pattern_scanner_impl(self, string, pos, endpos);
+    return_value = _sre_SRE_Pattern_scanner_impl(self, cls, string, pos, endpos);
 
 exit:
     return return_value;
@@ -686,14 +431,9 @@
     if (!noptargs) {
         goto skip_optional_pos;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[1]);
+        PyObject *iobj = _PyNumber_Index(args[1]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -717,52 +457,27 @@
 "Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl.");
 
 #define _SRE_SRE_PATTERN_SUB_METHODDEF    \
-    {"sub", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_sub, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_sub__doc__},
+    {"sub", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_sub, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_sub__doc__},
 
 static PyObject *
-_sre_SRE_Pattern_sub_impl(PatternObject *self, PyObject *repl,
-                          PyObject *string, Py_ssize_t count);
+_sre_SRE_Pattern_sub_impl(PatternObject *self, PyTypeObject *cls,
+                          PyObject *repl, PyObject *string, Py_ssize_t count);
 
 static PyObject *
-_sre_SRE_Pattern_sub(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+_sre_SRE_Pattern_sub(PatternObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
     PyObject *return_value = NULL;
     static const char * const _keywords[] = {"repl", "string", "count", NULL};
-    static _PyArg_Parser _parser = {NULL, _keywords, "sub", 0};
-    PyObject *argsbuf[3];
-    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
+    static _PyArg_Parser _parser = {"OO|n:sub", _keywords, 0};
     PyObject *repl;
     PyObject *string;
     Py_ssize_t count = 0;
 
-    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 3, 0, argsbuf);
-    if (!args) {
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
+        &repl, &string, &count)) {
         goto exit;
     }
-    repl = args[0];
-    string = args[1];
-    if (!noptargs) {
-        goto skip_optional_pos;
-    }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
-    {
-        Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[2]);
-        if (iobj != NULL) {
-            ival = PyLong_AsSsize_t(iobj);
-            Py_DECREF(iobj);
-        }
-        if (ival == -1 && PyErr_Occurred()) {
-            goto exit;
-        }
-        count = ival;
-    }
-skip_optional_pos:
-    return_value = _sre_SRE_Pattern_sub_impl(self, repl, string, count);
+    return_value = _sre_SRE_Pattern_sub_impl(self, cls, repl, string, count);
 
 exit:
     return return_value;
@@ -775,52 +490,28 @@
 "Return the tuple (new_string, number_of_subs_made) found by replacing the leftmost non-overlapping occurrences of pattern with the replacement repl.");
 
 #define _SRE_SRE_PATTERN_SUBN_METHODDEF    \
-    {"subn", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_subn, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_subn__doc__},
+    {"subn", (PyCFunction)(void(*)(void))_sre_SRE_Pattern_subn, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_subn__doc__},
 
 static PyObject *
-_sre_SRE_Pattern_subn_impl(PatternObject *self, PyObject *repl,
-                           PyObject *string, Py_ssize_t count);
+_sre_SRE_Pattern_subn_impl(PatternObject *self, PyTypeObject *cls,
+                           PyObject *repl, PyObject *string,
+                           Py_ssize_t count);
 
 static PyObject *
-_sre_SRE_Pattern_subn(PatternObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+_sre_SRE_Pattern_subn(PatternObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
     PyObject *return_value = NULL;
     static const char * const _keywords[] = {"repl", "string", "count", NULL};
-    static _PyArg_Parser _parser = {NULL, _keywords, "subn", 0};
-    PyObject *argsbuf[3];
-    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
+    static _PyArg_Parser _parser = {"OO|n:subn", _keywords, 0};
     PyObject *repl;
     PyObject *string;
     Py_ssize_t count = 0;
 
-    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 3, 0, argsbuf);
-    if (!args) {
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
+        &repl, &string, &count)) {
         goto exit;
     }
-    repl = args[0];
-    string = args[1];
-    if (!noptargs) {
-        goto skip_optional_pos;
-    }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
-    {
-        Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[2]);
-        if (iobj != NULL) {
-            ival = PyLong_AsSsize_t(iobj);
-            Py_DECREF(iobj);
-        }
-        if (ival == -1 && PyErr_Occurred()) {
-            goto exit;
-        }
-        count = ival;
-    }
-skip_optional_pos:
-    return_value = _sre_SRE_Pattern_subn_impl(self, repl, string, count);
+    return_value = _sre_SRE_Pattern_subn_impl(self, cls, repl, string, count);
 
 exit:
     return return_value;
@@ -884,11 +575,6 @@
         goto exit;
     }
     pattern = args[0];
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     flags = _PyLong_AsInt(args[1]);
     if (flags == -1 && PyErr_Occurred()) {
         goto exit;
@@ -898,14 +584,9 @@
         goto exit;
     }
     code = args[2];
-    if (PyFloat_Check(args[3])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[3]);
+        PyObject *iobj = _PyNumber_Index(args[3]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -1180,15 +861,26 @@
 "\n");
 
 #define _SRE_SRE_SCANNER_MATCH_METHODDEF    \
-    {"match", (PyCFunction)_sre_SRE_Scanner_match, METH_NOARGS, _sre_SRE_Scanner_match__doc__},
+    {"match", (PyCFunction)(void(*)(void))_sre_SRE_Scanner_match, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Scanner_match__doc__},
 
 static PyObject *
-_sre_SRE_Scanner_match_impl(ScannerObject *self);
+_sre_SRE_Scanner_match_impl(ScannerObject *self, PyTypeObject *cls);
 
 static PyObject *
-_sre_SRE_Scanner_match(ScannerObject *self, PyObject *Py_UNUSED(ignored))
+_sre_SRE_Scanner_match(ScannerObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
-    return _sre_SRE_Scanner_match_impl(self);
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = { NULL};
+    static _PyArg_Parser _parser = {":match", _keywords, 0};
+
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser
+        )) {
+        goto exit;
+    }
+    return_value = _sre_SRE_Scanner_match_impl(self, cls);
+
+exit:
+    return return_value;
 }
 
 PyDoc_STRVAR(_sre_SRE_Scanner_search__doc__,
@@ -1197,14 +889,25 @@
 "\n");
 
 #define _SRE_SRE_SCANNER_SEARCH_METHODDEF    \
-    {"search", (PyCFunction)_sre_SRE_Scanner_search, METH_NOARGS, _sre_SRE_Scanner_search__doc__},
+    {"search", (PyCFunction)(void(*)(void))_sre_SRE_Scanner_search, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Scanner_search__doc__},
 
 static PyObject *
-_sre_SRE_Scanner_search_impl(ScannerObject *self);
+_sre_SRE_Scanner_search_impl(ScannerObject *self, PyTypeObject *cls);
 
 static PyObject *
-_sre_SRE_Scanner_search(ScannerObject *self, PyObject *Py_UNUSED(ignored))
+_sre_SRE_Scanner_search(ScannerObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
-    return _sre_SRE_Scanner_search_impl(self);
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = { NULL};
+    static _PyArg_Parser _parser = {":search", _keywords, 0};
+
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser
+        )) {
+        goto exit;
+    }
+    return_value = _sre_SRE_Scanner_search_impl(self, cls);
+
+exit:
+    return return_value;
 }
-/*[clinic end generated code: output=1adeddce58ae284c input=a9049054013a1b77]*/
+/*[clinic end generated code: output=518f7bb775c1184f input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_ssl.c.h b/Modules/clinic/_ssl.c.h
index ce8669a..b59b129 100644
--- a/Modules/clinic/_ssl.c.h
+++ b/Modules/clinic/_ssl.c.h
@@ -88,6 +88,40 @@
     return return_value;
 }
 
+PyDoc_STRVAR(_ssl__SSLSocket_get_verified_chain__doc__,
+"get_verified_chain($self, /)\n"
+"--\n"
+"\n");
+
+#define _SSL__SSLSOCKET_GET_VERIFIED_CHAIN_METHODDEF    \
+    {"get_verified_chain", (PyCFunction)_ssl__SSLSocket_get_verified_chain, METH_NOARGS, _ssl__SSLSocket_get_verified_chain__doc__},
+
+static PyObject *
+_ssl__SSLSocket_get_verified_chain_impl(PySSLSocket *self);
+
+static PyObject *
+_ssl__SSLSocket_get_verified_chain(PySSLSocket *self, PyObject *Py_UNUSED(ignored))
+{
+    return _ssl__SSLSocket_get_verified_chain_impl(self);
+}
+
+PyDoc_STRVAR(_ssl__SSLSocket_get_unverified_chain__doc__,
+"get_unverified_chain($self, /)\n"
+"--\n"
+"\n");
+
+#define _SSL__SSLSOCKET_GET_UNVERIFIED_CHAIN_METHODDEF    \
+    {"get_unverified_chain", (PyCFunction)_ssl__SSLSocket_get_unverified_chain, METH_NOARGS, _ssl__SSLSocket_get_unverified_chain__doc__},
+
+static PyObject *
+_ssl__SSLSocket_get_unverified_chain_impl(PySSLSocket *self);
+
+static PyObject *
+_ssl__SSLSocket_get_unverified_chain(PySSLSocket *self, PyObject *Py_UNUSED(ignored))
+{
+    return _ssl__SSLSocket_get_unverified_chain_impl(self);
+}
+
 PyDoc_STRVAR(_ssl__SSLSocket_shared_ciphers__doc__,
 "shared_ciphers($self, /)\n"
 "--\n"
@@ -139,29 +173,6 @@
     return _ssl__SSLSocket_version_impl(self);
 }
 
-#if (HAVE_NPN)
-
-PyDoc_STRVAR(_ssl__SSLSocket_selected_npn_protocol__doc__,
-"selected_npn_protocol($self, /)\n"
-"--\n"
-"\n");
-
-#define _SSL__SSLSOCKET_SELECTED_NPN_PROTOCOL_METHODDEF    \
-    {"selected_npn_protocol", (PyCFunction)_ssl__SSLSocket_selected_npn_protocol, METH_NOARGS, _ssl__SSLSocket_selected_npn_protocol__doc__},
-
-static PyObject *
-_ssl__SSLSocket_selected_npn_protocol_impl(PySSLSocket *self);
-
-static PyObject *
-_ssl__SSLSocket_selected_npn_protocol(PySSLSocket *self, PyObject *Py_UNUSED(ignored))
-{
-    return _ssl__SSLSocket_selected_npn_protocol_impl(self);
-}
-
-#endif /* (HAVE_NPN) */
-
-#if (HAVE_ALPN)
-
 PyDoc_STRVAR(_ssl__SSLSocket_selected_alpn_protocol__doc__,
 "selected_alpn_protocol($self, /)\n"
 "--\n"
@@ -179,8 +190,6 @@
     return _ssl__SSLSocket_selected_alpn_protocol_impl(self);
 }
 
-#endif /* (HAVE_ALPN) */
-
 PyDoc_STRVAR(_ssl__SSLSocket_compression__doc__,
 "compression($self, /)\n"
 "--\n"
@@ -262,25 +271,25 @@
     {"read", (PyCFunction)_ssl__SSLSocket_read, METH_VARARGS, _ssl__SSLSocket_read__doc__},
 
 static PyObject *
-_ssl__SSLSocket_read_impl(PySSLSocket *self, int len, int group_right_1,
-                          Py_buffer *buffer);
+_ssl__SSLSocket_read_impl(PySSLSocket *self, Py_ssize_t len,
+                          int group_right_1, Py_buffer *buffer);
 
 static PyObject *
 _ssl__SSLSocket_read(PySSLSocket *self, PyObject *args)
 {
     PyObject *return_value = NULL;
-    int len;
+    Py_ssize_t len;
     int group_right_1 = 0;
     Py_buffer buffer = {NULL, NULL};
 
     switch (PyTuple_GET_SIZE(args)) {
         case 1:
-            if (!PyArg_ParseTuple(args, "i:read", &len)) {
+            if (!PyArg_ParseTuple(args, "n:read", &len)) {
                 goto exit;
             }
             break;
         case 2:
-            if (!PyArg_ParseTuple(args, "iw*:read", &len, &buffer)) {
+            if (!PyArg_ParseTuple(args, "nw*:read", &len, &buffer)) {
                 goto exit;
             }
             group_right_1 = 1;
@@ -399,18 +408,13 @@
     PyObject *return_value = NULL;
     int proto_version;
 
-    if ((type == &PySSLContext_Type) &&
+    if ((type == get_state_type(type)->PySSLContext_Type) &&
         !_PyArg_NoKeywords("_SSLContext", kwargs)) {
         goto exit;
     }
     if (!_PyArg_CheckPositional("_SSLContext", PyTuple_GET_SIZE(args), 1, 1)) {
         goto exit;
     }
-    if (PyFloat_Check(PyTuple_GET_ITEM(args, 0))) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     proto_version = _PyLong_AsInt(PyTuple_GET_ITEM(args, 0));
     if (proto_version == -1 && PyErr_Occurred()) {
         goto exit;
@@ -457,8 +461,6 @@
     return return_value;
 }
 
-#if (OPENSSL_VERSION_NUMBER >= 0x10002000UL)
-
 PyDoc_STRVAR(_ssl__SSLContext_get_ciphers__doc__,
 "get_ciphers($self, /)\n"
 "--\n"
@@ -476,44 +478,6 @@
     return _ssl__SSLContext_get_ciphers_impl(self);
 }
 
-#endif /* (OPENSSL_VERSION_NUMBER >= 0x10002000UL) */
-
-PyDoc_STRVAR(_ssl__SSLContext__set_npn_protocols__doc__,
-"_set_npn_protocols($self, protos, /)\n"
-"--\n"
-"\n");
-
-#define _SSL__SSLCONTEXT__SET_NPN_PROTOCOLS_METHODDEF    \
-    {"_set_npn_protocols", (PyCFunction)_ssl__SSLContext__set_npn_protocols, METH_O, _ssl__SSLContext__set_npn_protocols__doc__},
-
-static PyObject *
-_ssl__SSLContext__set_npn_protocols_impl(PySSLContext *self,
-                                         Py_buffer *protos);
-
-static PyObject *
-_ssl__SSLContext__set_npn_protocols(PySSLContext *self, PyObject *arg)
-{
-    PyObject *return_value = NULL;
-    Py_buffer protos = {NULL, NULL};
-
-    if (PyObject_GetBuffer(arg, &protos, PyBUF_SIMPLE) != 0) {
-        goto exit;
-    }
-    if (!PyBuffer_IsContiguous(&protos, 'C')) {
-        _PyArg_BadArgument("_set_npn_protocols", "argument", "contiguous buffer", arg);
-        goto exit;
-    }
-    return_value = _ssl__SSLContext__set_npn_protocols_impl(self, &protos);
-
-exit:
-    /* Cleanup for protos */
-    if (protos.obj) {
-       PyBuffer_Release(&protos);
-    }
-
-    return return_value;
-}
-
 PyDoc_STRVAR(_ssl__SSLContext__set_alpn_protocols__doc__,
 "_set_alpn_protocols($self, protos, /)\n"
 "--\n"
@@ -689,16 +653,11 @@
     if (!args) {
         goto exit;
     }
-    if (!PyObject_TypeCheck(args[0], PySocketModule.Sock_Type)) {
-        _PyArg_BadArgument("_wrap_socket", "argument 'sock'", (PySocketModule.Sock_Type)->tp_name, args[0]);
+    if (!PyObject_TypeCheck(args[0], get_state_ctx(self)->Sock_Type)) {
+        _PyArg_BadArgument("_wrap_socket", "argument 'sock'", (get_state_ctx(self)->Sock_Type)->tp_name, args[0]);
         goto exit;
     }
     sock = args[0];
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     server_side = _PyLong_AsInt(args[1]);
     if (server_side == -1 && PyErr_Occurred()) {
         goto exit;
@@ -764,21 +723,16 @@
     if (!args) {
         goto exit;
     }
-    if (!PyObject_TypeCheck(args[0], &PySSLMemoryBIO_Type)) {
-        _PyArg_BadArgument("_wrap_bio", "argument 'incoming'", (&PySSLMemoryBIO_Type)->tp_name, args[0]);
+    if (!PyObject_TypeCheck(args[0], get_state_ctx(self)->PySSLMemoryBIO_Type)) {
+        _PyArg_BadArgument("_wrap_bio", "argument 'incoming'", (get_state_ctx(self)->PySSLMemoryBIO_Type)->tp_name, args[0]);
         goto exit;
     }
     incoming = (PySSLMemoryBIO *)args[0];
-    if (!PyObject_TypeCheck(args[1], &PySSLMemoryBIO_Type)) {
-        _PyArg_BadArgument("_wrap_bio", "argument 'outgoing'", (&PySSLMemoryBIO_Type)->tp_name, args[1]);
+    if (!PyObject_TypeCheck(args[1], get_state_ctx(self)->PySSLMemoryBIO_Type)) {
+        _PyArg_BadArgument("_wrap_bio", "argument 'outgoing'", (get_state_ctx(self)->PySSLMemoryBIO_Type)->tp_name, args[1]);
         goto exit;
     }
     outgoing = (PySSLMemoryBIO *)args[1];
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     server_side = _PyLong_AsInt(args[2]);
     if (server_side == -1 && PyErr_Occurred()) {
         goto exit;
@@ -844,8 +798,6 @@
     return _ssl__SSLContext_set_default_verify_paths_impl(self);
 }
 
-#if !defined(OPENSSL_NO_ECDH)
-
 PyDoc_STRVAR(_ssl__SSLContext_set_ecdh_curve__doc__,
 "set_ecdh_curve($self, name, /)\n"
 "--\n"
@@ -854,8 +806,6 @@
 #define _SSL__SSLCONTEXT_SET_ECDH_CURVE_METHODDEF    \
     {"set_ecdh_curve", (PyCFunction)_ssl__SSLContext_set_ecdh_curve, METH_O, _ssl__SSLContext_set_ecdh_curve__doc__},
 
-#endif /* !defined(OPENSSL_NO_ECDH) */
-
 PyDoc_STRVAR(_ssl__SSLContext_cert_store_stats__doc__,
 "cert_store_stats($self, /)\n"
 "--\n"
@@ -934,11 +884,11 @@
 {
     PyObject *return_value = NULL;
 
-    if ((type == &PySSLMemoryBIO_Type) &&
+    if ((type == get_state_type(type)->PySSLMemoryBIO_Type) &&
         !_PyArg_NoPositional("MemoryBIO", args)) {
         goto exit;
     }
-    if ((type == &PySSLMemoryBIO_Type) &&
+    if ((type == get_state_type(type)->PySSLMemoryBIO_Type) &&
         !_PyArg_NoKeywords("MemoryBIO", kwargs)) {
         goto exit;
     }
@@ -977,11 +927,6 @@
     if (nargs < 1) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     len = _PyLong_AsInt(args[0]);
     if (len == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1132,11 +1077,6 @@
     PyObject *return_value = NULL;
     int n;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     n = _PyLong_AsInt(arg);
     if (n == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1168,11 +1108,6 @@
     PyObject *return_value = NULL;
     int n;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     n = _PyLong_AsInt(arg);
     if (n == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1187,7 +1122,7 @@
 "RAND_status($module, /)\n"
 "--\n"
 "\n"
-"Returns 1 if the OpenSSL PRNG has been seeded with enough data and 0 if not.\n"
+"Returns True if the OpenSSL PRNG has been seeded with enough data and False if not.\n"
 "\n"
 "It is necessary to seed the PRNG with RAND_add() on some platforms before\n"
 "using the ssl() function.");
@@ -1204,40 +1139,6 @@
     return _ssl_RAND_status_impl(module);
 }
 
-#if !defined(OPENSSL_NO_EGD)
-
-PyDoc_STRVAR(_ssl_RAND_egd__doc__,
-"RAND_egd($module, path, /)\n"
-"--\n"
-"\n"
-"Queries the entropy gather daemon (EGD) on the socket named by \'path\'.\n"
-"\n"
-"Returns number of bytes read.  Raises SSLError if connection to EGD\n"
-"fails or if it does not provide enough data to seed PRNG.");
-
-#define _SSL_RAND_EGD_METHODDEF    \
-    {"RAND_egd", (PyCFunction)_ssl_RAND_egd, METH_O, _ssl_RAND_egd__doc__},
-
-static PyObject *
-_ssl_RAND_egd_impl(PyObject *module, PyObject *path);
-
-static PyObject *
-_ssl_RAND_egd(PyObject *module, PyObject *arg)
-{
-    PyObject *return_value = NULL;
-    PyObject *path;
-
-    if (!PyUnicode_FSConverter(arg, &path)) {
-        goto exit;
-    }
-    return_value = _ssl_RAND_egd_impl(module, path);
-
-exit:
-    return return_value;
-}
-
-#endif /* !defined(OPENSSL_NO_EGD) */
-
 PyDoc_STRVAR(_ssl_get_default_verify_paths__doc__,
 "get_default_verify_paths($module, /)\n"
 "--\n"
@@ -1333,11 +1234,6 @@
     PyObject *return_value = NULL;
     int nid;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     nid = _PyLong_AsInt(arg);
     if (nid == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1455,26 +1351,6 @@
 
 #endif /* defined(_MSC_VER) */
 
-#ifndef _SSL__SSLSOCKET_SELECTED_NPN_PROTOCOL_METHODDEF
-    #define _SSL__SSLSOCKET_SELECTED_NPN_PROTOCOL_METHODDEF
-#endif /* !defined(_SSL__SSLSOCKET_SELECTED_NPN_PROTOCOL_METHODDEF) */
-
-#ifndef _SSL__SSLSOCKET_SELECTED_ALPN_PROTOCOL_METHODDEF
-    #define _SSL__SSLSOCKET_SELECTED_ALPN_PROTOCOL_METHODDEF
-#endif /* !defined(_SSL__SSLSOCKET_SELECTED_ALPN_PROTOCOL_METHODDEF) */
-
-#ifndef _SSL__SSLCONTEXT_GET_CIPHERS_METHODDEF
-    #define _SSL__SSLCONTEXT_GET_CIPHERS_METHODDEF
-#endif /* !defined(_SSL__SSLCONTEXT_GET_CIPHERS_METHODDEF) */
-
-#ifndef _SSL__SSLCONTEXT_SET_ECDH_CURVE_METHODDEF
-    #define _SSL__SSLCONTEXT_SET_ECDH_CURVE_METHODDEF
-#endif /* !defined(_SSL__SSLCONTEXT_SET_ECDH_CURVE_METHODDEF) */
-
-#ifndef _SSL_RAND_EGD_METHODDEF
-    #define _SSL_RAND_EGD_METHODDEF
-#endif /* !defined(_SSL_RAND_EGD_METHODDEF) */
-
 #ifndef _SSL_ENUM_CERTIFICATES_METHODDEF
     #define _SSL_ENUM_CERTIFICATES_METHODDEF
 #endif /* !defined(_SSL_ENUM_CERTIFICATES_METHODDEF) */
@@ -1482,4 +1358,4 @@
 #ifndef _SSL_ENUM_CRLS_METHODDEF
     #define _SSL_ENUM_CRLS_METHODDEF
 #endif /* !defined(_SSL_ENUM_CRLS_METHODDEF) */
-/*[clinic end generated code: output=a4aeb3f92a091c64 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=5a7d7bf5cf8ee092 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_struct.c.h b/Modules/clinic/_struct.c.h
index 36c4b40..b0c1eb4 100644
--- a/Modules/clinic/_struct.c.h
+++ b/Modules/clinic/_struct.c.h
@@ -124,14 +124,9 @@
     if (!noptargs) {
         goto skip_optional_pos;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[1]);
+        PyObject *iobj = _PyNumber_Index(args[1]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -204,7 +199,7 @@
     PyStructObject *s_object = NULL;
     Py_ssize_t _return_value;
 
-    if (!cache_struct_converter(arg, &s_object)) {
+    if (!cache_struct_converter(module, arg, &s_object)) {
         goto exit;
     }
     _return_value = calcsize_impl(module, s_object);
@@ -246,7 +241,7 @@
     if (!_PyArg_CheckPositional("unpack", nargs, 2, 2)) {
         goto exit;
     }
-    if (!cache_struct_converter(args[0], &s_object)) {
+    if (!cache_struct_converter(module, args[0], &s_object)) {
         goto exit;
     }
     if (PyObject_GetBuffer(args[1], &buffer, PyBUF_SIMPLE) != 0) {
@@ -302,7 +297,7 @@
     if (!args) {
         goto exit;
     }
-    if (!cache_struct_converter(args[0], &s_object)) {
+    if (!cache_struct_converter(module, args[0], &s_object)) {
         goto exit;
     }
     if (PyObject_GetBuffer(args[1], &buffer, PyBUF_SIMPLE) != 0) {
@@ -315,14 +310,9 @@
     if (!noptargs) {
         goto skip_optional_pos;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[2]);
+        PyObject *iobj = _PyNumber_Index(args[2]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -374,7 +364,7 @@
     if (!_PyArg_CheckPositional("iter_unpack", nargs, 2, 2)) {
         goto exit;
     }
-    if (!cache_struct_converter(args[0], &s_object)) {
+    if (!cache_struct_converter(module, args[0], &s_object)) {
         goto exit;
     }
     buffer = args[1];
@@ -386,4 +376,4 @@
 
     return return_value;
 }
-/*[clinic end generated code: output=6a6228cfc4b7099c input=a9049054013a1b77]*/
+/*[clinic end generated code: output=a3d3cd900091cb1c input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_testmultiphase.c.h b/Modules/clinic/_testmultiphase.c.h
index 0d38c23..17c28d5 100644
--- a/Modules/clinic/_testmultiphase.c.h
+++ b/Modules/clinic/_testmultiphase.c.h
@@ -6,7 +6,10 @@
 "get_defining_module($self, /)\n"
 "--\n"
 "\n"
-"Return the module of the defining class.");
+"Return the module of the defining class.\n"
+"\n"
+"Also tests that result of _PyType_GetModuleByDef matches defining_class\'s\n"
+"module.");
 
 #define _TESTMULTIPHASE_STATEACCESSTYPE_GET_DEFINING_MODULE_METHODDEF    \
     {"get_defining_module", (PyCFunction)(void(*)(void))_testmultiphase_StateAccessType_get_defining_module, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _testmultiphase_StateAccessType_get_defining_module__doc__},
@@ -32,6 +35,36 @@
     return return_value;
 }
 
+PyDoc_STRVAR(_testmultiphase_StateAccessType_getmodulebydef_bad_def__doc__,
+"getmodulebydef_bad_def($self, /)\n"
+"--\n"
+"\n"
+"Test that result of _PyType_GetModuleByDef with a bad def is NULL.");
+
+#define _TESTMULTIPHASE_STATEACCESSTYPE_GETMODULEBYDEF_BAD_DEF_METHODDEF    \
+    {"getmodulebydef_bad_def", (PyCFunction)(void(*)(void))_testmultiphase_StateAccessType_getmodulebydef_bad_def, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _testmultiphase_StateAccessType_getmodulebydef_bad_def__doc__},
+
+static PyObject *
+_testmultiphase_StateAccessType_getmodulebydef_bad_def_impl(StateAccessTypeObject *self,
+                                                            PyTypeObject *cls);
+
+static PyObject *
+_testmultiphase_StateAccessType_getmodulebydef_bad_def(StateAccessTypeObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = { NULL};
+    static _PyArg_Parser _parser = {":getmodulebydef_bad_def", _keywords, 0};
+
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser
+        )) {
+        goto exit;
+    }
+    return_value = _testmultiphase_StateAccessType_getmodulebydef_bad_def_impl(self, cls);
+
+exit:
+    return return_value;
+}
+
 PyDoc_STRVAR(_testmultiphase_StateAccessType_increment_count_clinic__doc__,
 "increment_count_clinic($self, /, n=1, *, twice=False)\n"
 "--\n"
@@ -98,4 +131,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=39eea487e94e7f5d input=a9049054013a1b77]*/
+/*[clinic end generated code: output=eb1b8c2ee6290be3 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_tkinter.c.h b/Modules/clinic/_tkinter.c.h
index 73c3fae..9718986 100644
--- a/Modules/clinic/_tkinter.c.h
+++ b/Modules/clinic/_tkinter.c.h
@@ -434,11 +434,6 @@
         goto exit;
     }
     file = args[0];
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     mask = _PyLong_AsInt(args[1]);
     if (mask == -1 && PyErr_Occurred()) {
         goto exit;
@@ -503,11 +498,6 @@
     if (!_PyArg_CheckPositional("createtimerhandler", nargs, 2, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     milliseconds = _PyLong_AsInt(args[0]);
     if (milliseconds == -1 && PyErr_Occurred()) {
         goto exit;
@@ -542,11 +532,6 @@
     if (nargs < 1) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     threshold = _PyLong_AsInt(args[0]);
     if (threshold == -1 && PyErr_Occurred()) {
         goto exit;
@@ -581,11 +566,6 @@
     if (nargs < 1) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     flags = _PyLong_AsInt(args[0]);
     if (flags == -1 && PyErr_Occurred()) {
         goto exit;
@@ -769,11 +749,6 @@
     if (nargs < 4) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[3])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     interactive = _PyLong_AsInt(args[3]);
     if (interactive == -1 && PyErr_Occurred()) {
         goto exit;
@@ -781,11 +756,6 @@
     if (nargs < 5) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[4])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     wantobjects = _PyLong_AsInt(args[4]);
     if (wantobjects == -1 && PyErr_Occurred()) {
         goto exit;
@@ -793,11 +763,6 @@
     if (nargs < 6) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[5])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     wantTk = _PyLong_AsInt(args[5]);
     if (wantTk == -1 && PyErr_Occurred()) {
         goto exit;
@@ -805,11 +770,6 @@
     if (nargs < 7) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[6])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     sync = _PyLong_AsInt(args[6]);
     if (sync == -1 && PyErr_Occurred()) {
         goto exit;
@@ -862,11 +822,6 @@
     PyObject *return_value = NULL;
     int new_val;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     new_val = _PyLong_AsInt(arg);
     if (new_val == -1 && PyErr_Occurred()) {
         goto exit;
@@ -912,4 +867,4 @@
 #ifndef _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF
     #define _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF
 #endif /* !defined(_TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF) */
-/*[clinic end generated code: output=492b8b833fe54bc9 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=ab311480dd044fe4 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_tracemalloc.c.h b/Modules/clinic/_tracemalloc.c.h
index 049cacd..20afd76 100644
--- a/Modules/clinic/_tracemalloc.c.h
+++ b/Modules/clinic/_tracemalloc.c.h
@@ -101,11 +101,6 @@
     if (nargs < 1) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     nframe = _PyLong_AsInt(args[0]);
     if (nframe == -1 && PyErr_Occurred()) {
         goto exit;
@@ -217,4 +212,4 @@
 {
     return _tracemalloc_reset_peak_impl(module);
 }
-/*[clinic end generated code: output=a130117b1af821da input=a9049054013a1b77]*/
+/*[clinic end generated code: output=bafca0a19b0b0823 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_winapi.c.h b/Modules/clinic/_winapi.c.h
index e21f2bc..5bda156 100644
--- a/Modules/clinic/_winapi.c.h
+++ b/Modules/clinic/_winapi.c.h
@@ -195,8 +195,8 @@
     LPCWSTR name;
     HANDLE _return_value;
 
-    if (!_PyArg_ParseStack(args, nargs, "" F_HANDLE "" F_POINTER "kkku:CreateFileMapping",
-        &file_handle, &security_attributes, &protect, &max_size_high, &max_size_low, &name)) {
+    if (!_PyArg_ParseStack(args, nargs, "" F_HANDLE "" F_POINTER "kkkO&:CreateFileMapping",
+        &file_handle, &security_attributes, &protect, &max_size_high, &max_size_low, _PyUnicode_WideCharString_Converter, &name)) {
         goto exit;
     }
     _return_value = _winapi_CreateFileMapping_impl(module, file_handle, security_attributes, protect, max_size_high, max_size_low, name);
@@ -209,6 +209,11 @@
     return_value = HANDLE_TO_PYNUM(_return_value);
 
 exit:
+    /* Cleanup for name */
+    #if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free((void *)name);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+
     return return_value;
 }
 
@@ -221,23 +226,55 @@
     {"CreateJunction", (PyCFunction)(void(*)(void))_winapi_CreateJunction, METH_FASTCALL, _winapi_CreateJunction__doc__},
 
 static PyObject *
-_winapi_CreateJunction_impl(PyObject *module, LPWSTR src_path,
-                            LPWSTR dst_path);
+_winapi_CreateJunction_impl(PyObject *module, LPCWSTR src_path,
+                            LPCWSTR dst_path);
 
 static PyObject *
 _winapi_CreateJunction(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
 {
     PyObject *return_value = NULL;
-    LPWSTR src_path;
-    LPWSTR dst_path;
+    LPCWSTR src_path;
+    LPCWSTR dst_path;
 
-    if (!_PyArg_ParseStack(args, nargs, "uu:CreateJunction",
-        &src_path, &dst_path)) {
+    if (!_PyArg_CheckPositional("CreateJunction", nargs, 2, 2)) {
+        goto exit;
+    }
+    if (!PyUnicode_Check(args[0])) {
+        _PyArg_BadArgument("CreateJunction", "argument 1", "str", args[0]);
+        goto exit;
+    }
+    #if USE_UNICODE_WCHAR_CACHE
+    src_path = _PyUnicode_AsUnicode(args[0]);
+    #else /* USE_UNICODE_WCHAR_CACHE */
+    src_path = PyUnicode_AsWideCharString(args[0], NULL);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+    if (src_path == NULL) {
+        goto exit;
+    }
+    if (!PyUnicode_Check(args[1])) {
+        _PyArg_BadArgument("CreateJunction", "argument 2", "str", args[1]);
+        goto exit;
+    }
+    #if USE_UNICODE_WCHAR_CACHE
+    dst_path = _PyUnicode_AsUnicode(args[1]);
+    #else /* USE_UNICODE_WCHAR_CACHE */
+    dst_path = PyUnicode_AsWideCharString(args[1], NULL);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+    if (dst_path == NULL) {
         goto exit;
     }
     return_value = _winapi_CreateJunction_impl(module, src_path, dst_path);
 
 exit:
+    /* Cleanup for src_path */
+    #if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free((void *)src_path);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+    /* Cleanup for dst_path */
+    #if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free((void *)dst_path);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+
     return return_value;
 }
 
@@ -367,13 +404,22 @@
     const Py_UNICODE *current_directory;
     PyObject *startup_info;
 
-    if (!_PyArg_ParseStack(args, nargs, "ZOOOikOZO:CreateProcess",
-        &application_name, &command_line, &proc_attrs, &thread_attrs, &inherit_handles, &creation_flags, &env_mapping, &current_directory, &startup_info)) {
+    if (!_PyArg_ParseStack(args, nargs, "O&OOOikOO&O:CreateProcess",
+        _PyUnicode_WideCharString_Opt_Converter, &application_name, &command_line, &proc_attrs, &thread_attrs, &inherit_handles, &creation_flags, &env_mapping, _PyUnicode_WideCharString_Opt_Converter, &current_directory, &startup_info)) {
         goto exit;
     }
     return_value = _winapi_CreateProcess_impl(module, application_name, command_line, proc_attrs, thread_attrs, inherit_handles, creation_flags, env_mapping, current_directory, startup_info);
 
 exit:
+    /* Cleanup for application_name */
+    #if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free((void *)application_name);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+    /* Cleanup for current_directory */
+    #if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free((void *)current_directory);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+
     return return_value;
 }
 
@@ -706,8 +752,8 @@
     LPCWSTR name;
     HANDLE _return_value;
 
-    if (!_PyArg_ParseStack(args, nargs, "kiu:OpenFileMapping",
-        &desired_access, &inherit_handle, &name)) {
+    if (!_PyArg_ParseStack(args, nargs, "kiO&:OpenFileMapping",
+        &desired_access, &inherit_handle, _PyUnicode_WideCharString_Converter, &name)) {
         goto exit;
     }
     _return_value = _winapi_OpenFileMapping_impl(module, desired_access, inherit_handle, name);
@@ -720,6 +766,11 @@
     return_value = HANDLE_TO_PYNUM(_return_value);
 
 exit:
+    /* Cleanup for name */
+    #if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free((void *)name);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+
     return return_value;
 }
 
@@ -1097,4 +1148,40 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=f3897898ea1da99d input=a9049054013a1b77]*/
+
+PyDoc_STRVAR(_winapi__mimetypes_read_windows_registry__doc__,
+"_mimetypes_read_windows_registry($module, /, on_type_read)\n"
+"--\n"
+"\n"
+"Optimized function for reading all known MIME types from the registry.\n"
+"\n"
+"*on_type_read* is a callable taking *type* and *ext* arguments, as for\n"
+"MimeTypes.add_type.");
+
+#define _WINAPI__MIMETYPES_READ_WINDOWS_REGISTRY_METHODDEF    \
+    {"_mimetypes_read_windows_registry", (PyCFunction)(void(*)(void))_winapi__mimetypes_read_windows_registry, METH_FASTCALL|METH_KEYWORDS, _winapi__mimetypes_read_windows_registry__doc__},
+
+static PyObject *
+_winapi__mimetypes_read_windows_registry_impl(PyObject *module,
+                                              PyObject *on_type_read);
+
+static PyObject *
+_winapi__mimetypes_read_windows_registry(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"on_type_read", NULL};
+    static _PyArg_Parser _parser = {NULL, _keywords, "_mimetypes_read_windows_registry", 0};
+    PyObject *argsbuf[1];
+    PyObject *on_type_read;
+
+    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+    if (!args) {
+        goto exit;
+    }
+    on_type_read = args[0];
+    return_value = _winapi__mimetypes_read_windows_registry_impl(module, on_type_read);
+
+exit:
+    return return_value;
+}
+/*[clinic end generated code: output=ac3623be6e42017c input=a9049054013a1b77]*/
diff --git a/Modules/clinic/arraymodule.c.h b/Modules/clinic/arraymodule.c.h
index b9245ca..c46cc73 100644
--- a/Modules/clinic/arraymodule.c.h
+++ b/Modules/clinic/arraymodule.c.h
@@ -39,13 +39,50 @@
     {"count", (PyCFunction)array_array_count, METH_O, array_array_count__doc__},
 
 PyDoc_STRVAR(array_array_index__doc__,
-"index($self, v, /)\n"
+"index($self, v, start=0, stop=sys.maxsize, /)\n"
 "--\n"
 "\n"
-"Return index of first occurrence of v in the array.");
+"Return index of first occurrence of v in the array.\n"
+"\n"
+"Raise ValueError if the value is not present.");
 
 #define ARRAY_ARRAY_INDEX_METHODDEF    \
-    {"index", (PyCFunction)array_array_index, METH_O, array_array_index__doc__},
+    {"index", (PyCFunction)(void(*)(void))array_array_index, METH_FASTCALL, array_array_index__doc__},
+
+static PyObject *
+array_array_index_impl(arrayobject *self, PyObject *v, Py_ssize_t start,
+                       Py_ssize_t stop);
+
+static PyObject *
+array_array_index(arrayobject *self, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    PyObject *v;
+    Py_ssize_t start = 0;
+    Py_ssize_t stop = PY_SSIZE_T_MAX;
+
+    if (!_PyArg_CheckPositional("index", nargs, 1, 3)) {
+        goto exit;
+    }
+    v = args[0];
+    if (nargs < 2) {
+        goto skip_optional;
+    }
+    if (!_PyEval_SliceIndexNotNone(args[1], &start)) {
+        goto exit;
+    }
+    if (nargs < 3) {
+        goto skip_optional;
+    }
+    if (!_PyEval_SliceIndexNotNone(args[2], &stop)) {
+        goto exit;
+    }
+skip_optional:
+    return_value = array_array_index_impl(self, v, start, stop);
+
+exit:
+    return return_value;
+}
 
 PyDoc_STRVAR(array_array_remove__doc__,
 "remove($self, v, /)\n"
@@ -82,14 +119,9 @@
     if (nargs < 1) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[0]);
+        PyObject *iobj = _PyNumber_Index(args[0]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -113,7 +145,28 @@
 "Append items to the end of the array.");
 
 #define ARRAY_ARRAY_EXTEND_METHODDEF    \
-    {"extend", (PyCFunction)array_array_extend, METH_O, array_array_extend__doc__},
+    {"extend", (PyCFunction)(void(*)(void))array_array_extend, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, array_array_extend__doc__},
+
+static PyObject *
+array_array_extend_impl(arrayobject *self, PyTypeObject *cls, PyObject *bb);
+
+static PyObject *
+array_array_extend(arrayobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"", NULL};
+    static _PyArg_Parser _parser = {"O:extend", _keywords, 0};
+    PyObject *bb;
+
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
+        &bb)) {
+        goto exit;
+    }
+    return_value = array_array_extend_impl(self, cls, bb);
+
+exit:
+    return return_value;
+}
 
 PyDoc_STRVAR(array_array_insert__doc__,
 "insert($self, i, v, /)\n"
@@ -137,14 +190,9 @@
     if (!_PyArg_CheckPositional("insert", nargs, 2, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[0]);
+        PyObject *iobj = _PyNumber_Index(args[0]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -253,14 +301,9 @@
         goto exit;
     }
     f = args[0];
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[1]);
+        PyObject *iobj = _PyNumber_Index(args[1]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -316,7 +359,7 @@
 "frombytes($self, buffer, /)\n"
 "--\n"
 "\n"
-"Appends items from the string, interpreting it as an array of machine values, as if it had been read from a file using the fromfile() method).");
+"Appends items from the string, interpreting it as an array of machine values, as if it had been read from a file using the fromfile() method.");
 
 #define ARRAY_ARRAY_FROMBYTES_METHODDEF    \
     {"frombytes", (PyCFunction)array_array_frombytes, METH_O, array_array_frombytes__doc__},
@@ -483,11 +526,6 @@
         goto exit;
     }
     typecode = PyUnicode_READ_CHAR(args[1], 0);
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     mformat_code = _PyLong_AsInt(args[2]);
     if (mformat_code == -1 && PyErr_Occurred()) {
         goto exit;
@@ -534,4 +572,4 @@
 
 #define ARRAY_ARRAYITERATOR___SETSTATE___METHODDEF    \
     {"__setstate__", (PyCFunction)array_arrayiterator___setstate__, METH_O, array_arrayiterator___setstate____doc__},
-/*[clinic end generated code: output=9f70748dd3bc532f input=a9049054013a1b77]*/
+/*[clinic end generated code: output=f130a994f98f1227 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/audioop.c.h b/Modules/clinic/audioop.c.h
index 8745533..da12bd1 100644
--- a/Modules/clinic/audioop.c.h
+++ b/Modules/clinic/audioop.c.h
@@ -33,23 +33,13 @@
         _PyArg_BadArgument("getsample", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     width = _PyLong_AsInt(args[1]);
     if (width == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[2]);
+        PyObject *iobj = _PyNumber_Index(args[2]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -99,11 +89,6 @@
         _PyArg_BadArgument("max", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     width = _PyLong_AsInt(args[1]);
     if (width == -1 && PyErr_Occurred()) {
         goto exit;
@@ -148,11 +133,6 @@
         _PyArg_BadArgument("minmax", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     width = _PyLong_AsInt(args[1]);
     if (width == -1 && PyErr_Occurred()) {
         goto exit;
@@ -197,11 +177,6 @@
         _PyArg_BadArgument("avg", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     width = _PyLong_AsInt(args[1]);
     if (width == -1 && PyErr_Occurred()) {
         goto exit;
@@ -246,11 +221,6 @@
         _PyArg_BadArgument("rms", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     width = _PyLong_AsInt(args[1]);
     if (width == -1 && PyErr_Occurred()) {
         goto exit;
@@ -400,14 +370,9 @@
         _PyArg_BadArgument("findmax", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[1]);
+        PyObject *iobj = _PyNumber_Index(args[1]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -457,11 +422,6 @@
         _PyArg_BadArgument("avgpp", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     width = _PyLong_AsInt(args[1]);
     if (width == -1 && PyErr_Occurred()) {
         goto exit;
@@ -506,11 +466,6 @@
         _PyArg_BadArgument("maxpp", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     width = _PyLong_AsInt(args[1]);
     if (width == -1 && PyErr_Occurred()) {
         goto exit;
@@ -555,11 +510,6 @@
         _PyArg_BadArgument("cross", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     width = _PyLong_AsInt(args[1]);
     if (width == -1 && PyErr_Occurred()) {
         goto exit;
@@ -606,11 +556,6 @@
         _PyArg_BadArgument("mul", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     width = _PyLong_AsInt(args[1]);
     if (width == -1 && PyErr_Occurred()) {
         goto exit;
@@ -668,11 +613,6 @@
         _PyArg_BadArgument("tomono", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     width = _PyLong_AsInt(args[1]);
     if (width == -1 && PyErr_Occurred()) {
         goto exit;
@@ -740,11 +680,6 @@
         _PyArg_BadArgument("tostereo", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     width = _PyLong_AsInt(args[1]);
     if (width == -1 && PyErr_Occurred()) {
         goto exit;
@@ -818,11 +753,6 @@
         _PyArg_BadArgument("add", "argument 2", "contiguous buffer", args[1]);
         goto exit;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     width = _PyLong_AsInt(args[2]);
     if (width == -1 && PyErr_Occurred()) {
         goto exit;
@@ -872,20 +802,10 @@
         _PyArg_BadArgument("bias", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     width = _PyLong_AsInt(args[1]);
     if (width == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     bias = _PyLong_AsInt(args[2]);
     if (bias == -1 && PyErr_Occurred()) {
         goto exit;
@@ -930,11 +850,6 @@
         _PyArg_BadArgument("reverse", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     width = _PyLong_AsInt(args[1]);
     if (width == -1 && PyErr_Occurred()) {
         goto exit;
@@ -979,11 +894,6 @@
         _PyArg_BadArgument("byteswap", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     width = _PyLong_AsInt(args[1]);
     if (width == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1030,20 +940,10 @@
         _PyArg_BadArgument("lin2lin", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     width = _PyLong_AsInt(args[1]);
     if (width == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     newwidth = _PyLong_AsInt(args[2]);
     if (newwidth == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1097,38 +997,18 @@
         _PyArg_BadArgument("ratecv", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     width = _PyLong_AsInt(args[1]);
     if (width == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     nchannels = _PyLong_AsInt(args[2]);
     if (nchannels == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[3])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     inrate = _PyLong_AsInt(args[3]);
     if (inrate == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[4])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     outrate = _PyLong_AsInt(args[4]);
     if (outrate == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1137,11 +1017,6 @@
     if (nargs < 7) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[6])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     weightA = _PyLong_AsInt(args[6]);
     if (weightA == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1149,11 +1024,6 @@
     if (nargs < 8) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[7])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     weightB = _PyLong_AsInt(args[7]);
     if (weightB == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1199,11 +1069,6 @@
         _PyArg_BadArgument("lin2ulaw", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     width = _PyLong_AsInt(args[1]);
     if (width == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1248,11 +1113,6 @@
         _PyArg_BadArgument("ulaw2lin", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     width = _PyLong_AsInt(args[1]);
     if (width == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1297,11 +1157,6 @@
         _PyArg_BadArgument("lin2alaw", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     width = _PyLong_AsInt(args[1]);
     if (width == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1346,11 +1201,6 @@
         _PyArg_BadArgument("alaw2lin", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     width = _PyLong_AsInt(args[1]);
     if (width == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1397,11 +1247,6 @@
         _PyArg_BadArgument("lin2adpcm", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     width = _PyLong_AsInt(args[1]);
     if (width == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1449,11 +1294,6 @@
         _PyArg_BadArgument("adpcm2lin", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     width = _PyLong_AsInt(args[1]);
     if (width == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1469,4 +1309,4 @@
 
     return return_value;
 }
-/*[clinic end generated code: output=6b4f2c597f295abc input=a9049054013a1b77]*/
+/*[clinic end generated code: output=840f8c315ebd4946 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/binascii.c.h b/Modules/clinic/binascii.c.h
index 4d02c72..ae1c457 100644
--- a/Modules/clinic/binascii.c.h
+++ b/Modules/clinic/binascii.c.h
@@ -70,11 +70,6 @@
     if (!noptargs) {
         goto skip_optional_kwonly;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     backtick = _PyLong_AsInt(args[1]);
     if (backtick == -1 && PyErr_Occurred()) {
         goto exit;
@@ -159,11 +154,6 @@
     if (!noptargs) {
         goto skip_optional_kwonly;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     newline = _PyLong_AsInt(args[1]);
     if (newline == -1 && PyErr_Occurred()) {
         goto exit;
@@ -348,11 +338,6 @@
         _PyArg_BadArgument("crc_hqx", "argument 1", "contiguous buffer", args[0]);
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     crc = (unsigned int)PyLong_AsUnsignedLongMask(args[1]);
     if (crc == (unsigned int)-1 && PyErr_Occurred()) {
         goto exit;
@@ -401,11 +386,6 @@
     if (nargs < 2) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     crc = (unsigned int)PyLong_AsUnsignedLongMask(args[1]);
     if (crc == (unsigned int)-1 && PyErr_Occurred()) {
         goto exit;
@@ -488,11 +468,6 @@
             goto skip_optional_pos;
         }
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     bytes_per_sep = _PyLong_AsInt(args[2]);
     if (bytes_per_sep == -1 && PyErr_Occurred()) {
         goto exit;
@@ -563,11 +538,6 @@
             goto skip_optional_pos;
         }
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     bytes_per_sep = _PyLong_AsInt(args[2]);
     if (bytes_per_sep == -1 && PyErr_Occurred()) {
         goto exit;
@@ -684,11 +654,6 @@
     if (!noptargs) {
         goto skip_optional_pos;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     header = _PyLong_AsInt(args[1]);
     if (header == -1 && PyErr_Occurred()) {
         goto exit;
@@ -749,11 +714,6 @@
         goto skip_optional_pos;
     }
     if (args[1]) {
-        if (PyFloat_Check(args[1])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         quotetabs = _PyLong_AsInt(args[1]);
         if (quotetabs == -1 && PyErr_Occurred()) {
             goto exit;
@@ -763,11 +723,6 @@
         }
     }
     if (args[2]) {
-        if (PyFloat_Check(args[2])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         istext = _PyLong_AsInt(args[2]);
         if (istext == -1 && PyErr_Occurred()) {
             goto exit;
@@ -776,11 +731,6 @@
             goto skip_optional_pos;
         }
     }
-    if (PyFloat_Check(args[3])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     header = _PyLong_AsInt(args[3]);
     if (header == -1 && PyErr_Occurred()) {
         goto exit;
@@ -796,4 +746,4 @@
 
     return return_value;
 }
-/*[clinic end generated code: output=a1e878d3963b615e input=a9049054013a1b77]*/
+/*[clinic end generated code: output=95a0178f30801b89 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/fcntlmodule.c.h b/Modules/clinic/fcntlmodule.c.h
index 024a44c..adf527f 100644
--- a/Modules/clinic/fcntlmodule.c.h
+++ b/Modules/clinic/fcntlmodule.c.h
@@ -35,12 +35,7 @@
     if (!_PyArg_CheckPositional("fcntl", nargs, 2, 3)) {
         goto exit;
     }
-    if (!conv_descriptor(args[0], &fd)) {
-        goto exit;
-    }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
+    if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
         goto exit;
     }
     code = _PyLong_AsInt(args[1]);
@@ -110,12 +105,7 @@
     if (!_PyArg_CheckPositional("ioctl", nargs, 2, 4)) {
         goto exit;
     }
-    if (!conv_descriptor(args[0], &fd)) {
-        goto exit;
-    }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
+    if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
         goto exit;
     }
     code = (unsigned int)PyLong_AsUnsignedLongMask(args[1]);
@@ -165,12 +155,7 @@
     if (!_PyArg_CheckPositional("flock", nargs, 2, 2)) {
         goto exit;
     }
-    if (!conv_descriptor(args[0], &fd)) {
-        goto exit;
-    }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
+    if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
         goto exit;
     }
     code = _PyLong_AsInt(args[1]);
@@ -230,12 +215,7 @@
     if (!_PyArg_CheckPositional("lockf", nargs, 2, 5)) {
         goto exit;
     }
-    if (!conv_descriptor(args[0], &fd)) {
-        goto exit;
-    }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
+    if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
         goto exit;
     }
     code = _PyLong_AsInt(args[1]);
@@ -253,11 +233,6 @@
     if (nargs < 5) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[4])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     whence = _PyLong_AsInt(args[4]);
     if (whence == -1 && PyErr_Occurred()) {
         goto exit;
@@ -268,4 +243,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=e912d25e28362c52 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=8ea34bd0f7cf25ec input=a9049054013a1b77]*/
diff --git a/Modules/clinic/gcmodule.c.h b/Modules/clinic/gcmodule.c.h
index 72795c6..30efc7e 100644
--- a/Modules/clinic/gcmodule.c.h
+++ b/Modules/clinic/gcmodule.c.h
@@ -102,11 +102,6 @@
     if (!noptargs) {
         goto skip_optional_pos;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     generation = _PyLong_AsInt(args[0]);
     if (generation == -1 && PyErr_Occurred()) {
         goto exit;
@@ -151,11 +146,6 @@
     PyObject *return_value = NULL;
     int flags;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     flags = _PyLong_AsInt(arg);
     if (flags == -1 && PyErr_Occurred()) {
         goto exit;
@@ -382,4 +372,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=bd6a8056989e2e69 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=61e15f3a549f3ab5 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/itertoolsmodule.c.h b/Modules/clinic/itertoolsmodule.c.h
index 20594b0..d3f5422 100644
--- a/Modules/clinic/itertoolsmodule.c.h
+++ b/Modules/clinic/itertoolsmodule.c.h
@@ -2,6 +2,37 @@
 preserve
 [clinic start generated code]*/
 
+PyDoc_STRVAR(pairwise_new__doc__,
+"pairwise(iterable, /)\n"
+"--\n"
+"\n"
+"Return an iterator of overlapping pairs taken from the input iterator.\n"
+"\n"
+"    s -> (s0,s1), (s1,s2), (s2, s3), ...");
+
+static PyObject *
+pairwise_new_impl(PyTypeObject *type, PyObject *iterable);
+
+static PyObject *
+pairwise_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
+{
+    PyObject *return_value = NULL;
+    PyObject *iterable;
+
+    if ((type == &pairwise_type) &&
+        !_PyArg_NoKeywords("pairwise", kwargs)) {
+        goto exit;
+    }
+    if (!_PyArg_CheckPositional("pairwise", PyTuple_GET_SIZE(args), 1, 1)) {
+        goto exit;
+    }
+    iterable = PyTuple_GET_ITEM(args, 0);
+    return_value = pairwise_new_impl(type, iterable);
+
+exit:
+    return return_value;
+}
+
 PyDoc_STRVAR(itertools_groupby__doc__,
 "groupby(iterable, key=None)\n"
 "--\n"
@@ -170,14 +201,9 @@
     if (nargs < 2) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[1]);
+        PyObject *iobj = _PyNumber_Index(args[1]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -356,14 +382,9 @@
         goto exit;
     }
     iterable = fastargs[0];
-    if (PyFloat_Check(fastargs[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(fastargs[1]);
+        PyObject *iobj = _PyNumber_Index(fastargs[1]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -385,7 +406,7 @@
 "\n"
 "Return successive r-length combinations of elements in the iterable allowing individual elements to have successive repeats.\n"
 "\n"
-"combinations_with_replacement(\'ABC\', 2) --> AA AB AC BB BC CC\"");
+"combinations_with_replacement(\'ABC\', 2) --> (\'A\',\'A\'), (\'A\',\'B\'), (\'A\',\'C\'), (\'B\',\'B\'), (\'B\',\'C\'), (\'C\',\'C\')");
 
 static PyObject *
 itertools_combinations_with_replacement_impl(PyTypeObject *type,
@@ -409,14 +430,9 @@
         goto exit;
     }
     iterable = fastargs[0];
-    if (PyFloat_Check(fastargs[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(fastargs[1]);
+        PyObject *iobj = _PyNumber_Index(fastargs[1]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -642,4 +658,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=392c9706e79f6710 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=c91f57481a2461d3 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/md5module.c.h b/Modules/clinic/md5module.c.h
index c109f9e..4762f28 100644
--- a/Modules/clinic/md5module.c.h
+++ b/Modules/clinic/md5module.c.h
@@ -9,15 +9,26 @@
 "Return a copy of the hash object.");
 
 #define MD5TYPE_COPY_METHODDEF    \
-    {"copy", (PyCFunction)MD5Type_copy, METH_NOARGS, MD5Type_copy__doc__},
+    {"copy", (PyCFunction)(void(*)(void))MD5Type_copy, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, MD5Type_copy__doc__},
 
 static PyObject *
-MD5Type_copy_impl(MD5object *self);
+MD5Type_copy_impl(MD5object *self, PyTypeObject *cls);
 
 static PyObject *
-MD5Type_copy(MD5object *self, PyObject *Py_UNUSED(ignored))
+MD5Type_copy(MD5object *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
-    return MD5Type_copy_impl(self);
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = { NULL};
+    static _PyArg_Parser _parser = {":copy", _keywords, 0};
+
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser
+        )) {
+        goto exit;
+    }
+    return_value = MD5Type_copy_impl(self, cls);
+
+exit:
+    return return_value;
 }
 
 PyDoc_STRVAR(MD5Type_digest__doc__,
@@ -115,4 +126,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=dbe3abc60086f3ef input=a9049054013a1b77]*/
+/*[clinic end generated code: output=53ff7f22dbaaea36 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/overlapped.c.h b/Modules/clinic/overlapped.c.h
new file mode 100644
index 0000000..efecd90
--- /dev/null
+++ b/Modules/clinic/overlapped.c.h
@@ -0,0 +1,908 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(_overlapped_CreateIoCompletionPort__doc__,
+"CreateIoCompletionPort($module, handle, port, key, concurrency, /)\n"
+"--\n"
+"\n"
+"Create a completion port or register a handle with a port.");
+
+#define _OVERLAPPED_CREATEIOCOMPLETIONPORT_METHODDEF    \
+    {"CreateIoCompletionPort", (PyCFunction)(void(*)(void))_overlapped_CreateIoCompletionPort, METH_FASTCALL, _overlapped_CreateIoCompletionPort__doc__},
+
+static PyObject *
+_overlapped_CreateIoCompletionPort_impl(PyObject *module, HANDLE FileHandle,
+                                        HANDLE ExistingCompletionPort,
+                                        ULONG_PTR CompletionKey,
+                                        DWORD NumberOfConcurrentThreads);
+
+static PyObject *
+_overlapped_CreateIoCompletionPort(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    HANDLE FileHandle;
+    HANDLE ExistingCompletionPort;
+    ULONG_PTR CompletionKey;
+    DWORD NumberOfConcurrentThreads;
+
+    if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE""F_HANDLE""F_ULONG_PTR"k:CreateIoCompletionPort",
+        &FileHandle, &ExistingCompletionPort, &CompletionKey, &NumberOfConcurrentThreads)) {
+        goto exit;
+    }
+    return_value = _overlapped_CreateIoCompletionPort_impl(module, FileHandle, ExistingCompletionPort, CompletionKey, NumberOfConcurrentThreads);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_overlapped_GetQueuedCompletionStatus__doc__,
+"GetQueuedCompletionStatus($module, port, msecs, /)\n"
+"--\n"
+"\n"
+"Get a message from completion port.\n"
+"\n"
+"Wait for up to msecs milliseconds.");
+
+#define _OVERLAPPED_GETQUEUEDCOMPLETIONSTATUS_METHODDEF    \
+    {"GetQueuedCompletionStatus", (PyCFunction)(void(*)(void))_overlapped_GetQueuedCompletionStatus, METH_FASTCALL, _overlapped_GetQueuedCompletionStatus__doc__},
+
+static PyObject *
+_overlapped_GetQueuedCompletionStatus_impl(PyObject *module,
+                                           HANDLE CompletionPort,
+                                           DWORD Milliseconds);
+
+static PyObject *
+_overlapped_GetQueuedCompletionStatus(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    HANDLE CompletionPort;
+    DWORD Milliseconds;
+
+    if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"k:GetQueuedCompletionStatus",
+        &CompletionPort, &Milliseconds)) {
+        goto exit;
+    }
+    return_value = _overlapped_GetQueuedCompletionStatus_impl(module, CompletionPort, Milliseconds);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_overlapped_PostQueuedCompletionStatus__doc__,
+"PostQueuedCompletionStatus($module, port, bytes, key, address, /)\n"
+"--\n"
+"\n"
+"Post a message to completion port.");
+
+#define _OVERLAPPED_POSTQUEUEDCOMPLETIONSTATUS_METHODDEF    \
+    {"PostQueuedCompletionStatus", (PyCFunction)(void(*)(void))_overlapped_PostQueuedCompletionStatus, METH_FASTCALL, _overlapped_PostQueuedCompletionStatus__doc__},
+
+static PyObject *
+_overlapped_PostQueuedCompletionStatus_impl(PyObject *module,
+                                            HANDLE CompletionPort,
+                                            DWORD NumberOfBytes,
+                                            ULONG_PTR CompletionKey,
+                                            OVERLAPPED *Overlapped);
+
+static PyObject *
+_overlapped_PostQueuedCompletionStatus(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    HANDLE CompletionPort;
+    DWORD NumberOfBytes;
+    ULONG_PTR CompletionKey;
+    OVERLAPPED *Overlapped;
+
+    if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"k"F_ULONG_PTR""F_POINTER":PostQueuedCompletionStatus",
+        &CompletionPort, &NumberOfBytes, &CompletionKey, &Overlapped)) {
+        goto exit;
+    }
+    return_value = _overlapped_PostQueuedCompletionStatus_impl(module, CompletionPort, NumberOfBytes, CompletionKey, Overlapped);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_overlapped_RegisterWaitWithQueue__doc__,
+"RegisterWaitWithQueue($module, Object, CompletionPort, Overlapped,\n"
+"                      Timeout, /)\n"
+"--\n"
+"\n"
+"Register wait for Object; when complete CompletionPort is notified.");
+
+#define _OVERLAPPED_REGISTERWAITWITHQUEUE_METHODDEF    \
+    {"RegisterWaitWithQueue", (PyCFunction)(void(*)(void))_overlapped_RegisterWaitWithQueue, METH_FASTCALL, _overlapped_RegisterWaitWithQueue__doc__},
+
+static PyObject *
+_overlapped_RegisterWaitWithQueue_impl(PyObject *module, HANDLE Object,
+                                       HANDLE CompletionPort,
+                                       OVERLAPPED *Overlapped,
+                                       DWORD Milliseconds);
+
+static PyObject *
+_overlapped_RegisterWaitWithQueue(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    HANDLE Object;
+    HANDLE CompletionPort;
+    OVERLAPPED *Overlapped;
+    DWORD Milliseconds;
+
+    if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE""F_HANDLE""F_POINTER"k:RegisterWaitWithQueue",
+        &Object, &CompletionPort, &Overlapped, &Milliseconds)) {
+        goto exit;
+    }
+    return_value = _overlapped_RegisterWaitWithQueue_impl(module, Object, CompletionPort, Overlapped, Milliseconds);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_overlapped_UnregisterWait__doc__,
+"UnregisterWait($module, WaitHandle, /)\n"
+"--\n"
+"\n"
+"Unregister wait handle.");
+
+#define _OVERLAPPED_UNREGISTERWAIT_METHODDEF    \
+    {"UnregisterWait", (PyCFunction)_overlapped_UnregisterWait, METH_O, _overlapped_UnregisterWait__doc__},
+
+static PyObject *
+_overlapped_UnregisterWait_impl(PyObject *module, HANDLE WaitHandle);
+
+static PyObject *
+_overlapped_UnregisterWait(PyObject *module, PyObject *arg)
+{
+    PyObject *return_value = NULL;
+    HANDLE WaitHandle;
+
+    if (!PyArg_Parse(arg, ""F_HANDLE":UnregisterWait", &WaitHandle)) {
+        goto exit;
+    }
+    return_value = _overlapped_UnregisterWait_impl(module, WaitHandle);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_overlapped_UnregisterWaitEx__doc__,
+"UnregisterWaitEx($module, WaitHandle, Event, /)\n"
+"--\n"
+"\n"
+"Unregister wait handle.");
+
+#define _OVERLAPPED_UNREGISTERWAITEX_METHODDEF    \
+    {"UnregisterWaitEx", (PyCFunction)(void(*)(void))_overlapped_UnregisterWaitEx, METH_FASTCALL, _overlapped_UnregisterWaitEx__doc__},
+
+static PyObject *
+_overlapped_UnregisterWaitEx_impl(PyObject *module, HANDLE WaitHandle,
+                                  HANDLE Event);
+
+static PyObject *
+_overlapped_UnregisterWaitEx(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    HANDLE WaitHandle;
+    HANDLE Event;
+
+    if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE""F_HANDLE":UnregisterWaitEx",
+        &WaitHandle, &Event)) {
+        goto exit;
+    }
+    return_value = _overlapped_UnregisterWaitEx_impl(module, WaitHandle, Event);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_overlapped_CreateEvent__doc__,
+"CreateEvent($module, EventAttributes, ManualReset, InitialState, Name,\n"
+"            /)\n"
+"--\n"
+"\n"
+"Create an event.\n"
+"\n"
+"EventAttributes must be None.");
+
+#define _OVERLAPPED_CREATEEVENT_METHODDEF    \
+    {"CreateEvent", (PyCFunction)(void(*)(void))_overlapped_CreateEvent, METH_FASTCALL, _overlapped_CreateEvent__doc__},
+
+static PyObject *
+_overlapped_CreateEvent_impl(PyObject *module, PyObject *EventAttributes,
+                             BOOL ManualReset, BOOL InitialState,
+                             const Py_UNICODE *Name);
+
+static PyObject *
+_overlapped_CreateEvent(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    PyObject *EventAttributes;
+    BOOL ManualReset;
+    BOOL InitialState;
+    const Py_UNICODE *Name;
+
+    if (!_PyArg_ParseStack(args, nargs, "OiiO&:CreateEvent",
+        &EventAttributes, &ManualReset, &InitialState, _PyUnicode_WideCharString_Opt_Converter, &Name)) {
+        goto exit;
+    }
+    return_value = _overlapped_CreateEvent_impl(module, EventAttributes, ManualReset, InitialState, Name);
+
+exit:
+    /* Cleanup for Name */
+    #if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free((void *)Name);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+
+    return return_value;
+}
+
+PyDoc_STRVAR(_overlapped_SetEvent__doc__,
+"SetEvent($module, Handle, /)\n"
+"--\n"
+"\n"
+"Set event.");
+
+#define _OVERLAPPED_SETEVENT_METHODDEF    \
+    {"SetEvent", (PyCFunction)_overlapped_SetEvent, METH_O, _overlapped_SetEvent__doc__},
+
+static PyObject *
+_overlapped_SetEvent_impl(PyObject *module, HANDLE Handle);
+
+static PyObject *
+_overlapped_SetEvent(PyObject *module, PyObject *arg)
+{
+    PyObject *return_value = NULL;
+    HANDLE Handle;
+
+    if (!PyArg_Parse(arg, ""F_HANDLE":SetEvent", &Handle)) {
+        goto exit;
+    }
+    return_value = _overlapped_SetEvent_impl(module, Handle);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_overlapped_ResetEvent__doc__,
+"ResetEvent($module, Handle, /)\n"
+"--\n"
+"\n"
+"Reset event.");
+
+#define _OVERLAPPED_RESETEVENT_METHODDEF    \
+    {"ResetEvent", (PyCFunction)_overlapped_ResetEvent, METH_O, _overlapped_ResetEvent__doc__},
+
+static PyObject *
+_overlapped_ResetEvent_impl(PyObject *module, HANDLE Handle);
+
+static PyObject *
+_overlapped_ResetEvent(PyObject *module, PyObject *arg)
+{
+    PyObject *return_value = NULL;
+    HANDLE Handle;
+
+    if (!PyArg_Parse(arg, ""F_HANDLE":ResetEvent", &Handle)) {
+        goto exit;
+    }
+    return_value = _overlapped_ResetEvent_impl(module, Handle);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_overlapped_BindLocal__doc__,
+"BindLocal($module, handle, family, /)\n"
+"--\n"
+"\n"
+"Bind a socket handle to an arbitrary local port.\n"
+"\n"
+"family should be AF_INET or AF_INET6.");
+
+#define _OVERLAPPED_BINDLOCAL_METHODDEF    \
+    {"BindLocal", (PyCFunction)(void(*)(void))_overlapped_BindLocal, METH_FASTCALL, _overlapped_BindLocal__doc__},
+
+static PyObject *
+_overlapped_BindLocal_impl(PyObject *module, HANDLE Socket, int Family);
+
+static PyObject *
+_overlapped_BindLocal(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    HANDLE Socket;
+    int Family;
+
+    if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"i:BindLocal",
+        &Socket, &Family)) {
+        goto exit;
+    }
+    return_value = _overlapped_BindLocal_impl(module, Socket, Family);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_overlapped_FormatMessage__doc__,
+"FormatMessage($module, error_code, /)\n"
+"--\n"
+"\n"
+"Return error message for an error code.");
+
+#define _OVERLAPPED_FORMATMESSAGE_METHODDEF    \
+    {"FormatMessage", (PyCFunction)_overlapped_FormatMessage, METH_O, _overlapped_FormatMessage__doc__},
+
+static PyObject *
+_overlapped_FormatMessage_impl(PyObject *module, DWORD code);
+
+static PyObject *
+_overlapped_FormatMessage(PyObject *module, PyObject *arg)
+{
+    PyObject *return_value = NULL;
+    DWORD code;
+
+    if (!PyArg_Parse(arg, "k:FormatMessage", &code)) {
+        goto exit;
+    }
+    return_value = _overlapped_FormatMessage_impl(module, code);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_overlapped_Overlapped__doc__,
+"Overlapped(event=_overlapped.INVALID_HANDLE_VALUE)\n"
+"--\n"
+"\n"
+"OVERLAPPED structure wrapper.");
+
+static PyObject *
+_overlapped_Overlapped_impl(PyTypeObject *type, HANDLE event);
+
+static PyObject *
+_overlapped_Overlapped(PyTypeObject *type, PyObject *args, PyObject *kwargs)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"event", NULL};
+    static _PyArg_Parser _parser = {"|"F_HANDLE":Overlapped", _keywords, 0};
+    HANDLE event = INVALID_HANDLE_VALUE;
+
+    if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
+        &event)) {
+        goto exit;
+    }
+    return_value = _overlapped_Overlapped_impl(type, event);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_overlapped_Overlapped_cancel__doc__,
+"cancel($self, /)\n"
+"--\n"
+"\n"
+"Cancel overlapped operation.");
+
+#define _OVERLAPPED_OVERLAPPED_CANCEL_METHODDEF    \
+    {"cancel", (PyCFunction)_overlapped_Overlapped_cancel, METH_NOARGS, _overlapped_Overlapped_cancel__doc__},
+
+static PyObject *
+_overlapped_Overlapped_cancel_impl(OverlappedObject *self);
+
+static PyObject *
+_overlapped_Overlapped_cancel(OverlappedObject *self, PyObject *Py_UNUSED(ignored))
+{
+    return _overlapped_Overlapped_cancel_impl(self);
+}
+
+PyDoc_STRVAR(_overlapped_Overlapped_getresult__doc__,
+"getresult($self, wait=False, /)\n"
+"--\n"
+"\n"
+"Retrieve result of operation.\n"
+"\n"
+"If wait is true then it blocks until the operation is finished.  If wait\n"
+"is false and the operation is still pending then an error is raised.");
+
+#define _OVERLAPPED_OVERLAPPED_GETRESULT_METHODDEF    \
+    {"getresult", (PyCFunction)(void(*)(void))_overlapped_Overlapped_getresult, METH_FASTCALL, _overlapped_Overlapped_getresult__doc__},
+
+static PyObject *
+_overlapped_Overlapped_getresult_impl(OverlappedObject *self, BOOL wait);
+
+static PyObject *
+_overlapped_Overlapped_getresult(OverlappedObject *self, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    BOOL wait = FALSE;
+
+    if (!_PyArg_ParseStack(args, nargs, "|i:getresult",
+        &wait)) {
+        goto exit;
+    }
+    return_value = _overlapped_Overlapped_getresult_impl(self, wait);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_overlapped_Overlapped_ReadFile__doc__,
+"ReadFile($self, handle, size, /)\n"
+"--\n"
+"\n"
+"Start overlapped read.");
+
+#define _OVERLAPPED_OVERLAPPED_READFILE_METHODDEF    \
+    {"ReadFile", (PyCFunction)(void(*)(void))_overlapped_Overlapped_ReadFile, METH_FASTCALL, _overlapped_Overlapped_ReadFile__doc__},
+
+static PyObject *
+_overlapped_Overlapped_ReadFile_impl(OverlappedObject *self, HANDLE handle,
+                                     DWORD size);
+
+static PyObject *
+_overlapped_Overlapped_ReadFile(OverlappedObject *self, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    HANDLE handle;
+    DWORD size;
+
+    if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"k:ReadFile",
+        &handle, &size)) {
+        goto exit;
+    }
+    return_value = _overlapped_Overlapped_ReadFile_impl(self, handle, size);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_overlapped_Overlapped_ReadFileInto__doc__,
+"ReadFileInto($self, handle, buf, /)\n"
+"--\n"
+"\n"
+"Start overlapped receive.");
+
+#define _OVERLAPPED_OVERLAPPED_READFILEINTO_METHODDEF    \
+    {"ReadFileInto", (PyCFunction)(void(*)(void))_overlapped_Overlapped_ReadFileInto, METH_FASTCALL, _overlapped_Overlapped_ReadFileInto__doc__},
+
+static PyObject *
+_overlapped_Overlapped_ReadFileInto_impl(OverlappedObject *self,
+                                         HANDLE handle, PyObject *bufobj);
+
+static PyObject *
+_overlapped_Overlapped_ReadFileInto(OverlappedObject *self, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    HANDLE handle;
+    PyObject *bufobj;
+
+    if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"O:ReadFileInto",
+        &handle, &bufobj)) {
+        goto exit;
+    }
+    return_value = _overlapped_Overlapped_ReadFileInto_impl(self, handle, bufobj);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_overlapped_Overlapped_WSARecv__doc__,
+"WSARecv($self, handle, size, flags=0, /)\n"
+"--\n"
+"\n"
+"Start overlapped receive.");
+
+#define _OVERLAPPED_OVERLAPPED_WSARECV_METHODDEF    \
+    {"WSARecv", (PyCFunction)(void(*)(void))_overlapped_Overlapped_WSARecv, METH_FASTCALL, _overlapped_Overlapped_WSARecv__doc__},
+
+static PyObject *
+_overlapped_Overlapped_WSARecv_impl(OverlappedObject *self, HANDLE handle,
+                                    DWORD size, DWORD flags);
+
+static PyObject *
+_overlapped_Overlapped_WSARecv(OverlappedObject *self, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    HANDLE handle;
+    DWORD size;
+    DWORD flags = 0;
+
+    if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"k|k:WSARecv",
+        &handle, &size, &flags)) {
+        goto exit;
+    }
+    return_value = _overlapped_Overlapped_WSARecv_impl(self, handle, size, flags);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_overlapped_Overlapped_WSARecvInto__doc__,
+"WSARecvInto($self, handle, buf, flags, /)\n"
+"--\n"
+"\n"
+"Start overlapped receive.");
+
+#define _OVERLAPPED_OVERLAPPED_WSARECVINTO_METHODDEF    \
+    {"WSARecvInto", (PyCFunction)(void(*)(void))_overlapped_Overlapped_WSARecvInto, METH_FASTCALL, _overlapped_Overlapped_WSARecvInto__doc__},
+
+static PyObject *
+_overlapped_Overlapped_WSARecvInto_impl(OverlappedObject *self,
+                                        HANDLE handle, PyObject *bufobj,
+                                        DWORD flags);
+
+static PyObject *
+_overlapped_Overlapped_WSARecvInto(OverlappedObject *self, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    HANDLE handle;
+    PyObject *bufobj;
+    DWORD flags;
+
+    if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"Ok:WSARecvInto",
+        &handle, &bufobj, &flags)) {
+        goto exit;
+    }
+    return_value = _overlapped_Overlapped_WSARecvInto_impl(self, handle, bufobj, flags);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_overlapped_Overlapped_WriteFile__doc__,
+"WriteFile($self, handle, buf, /)\n"
+"--\n"
+"\n"
+"Start overlapped write.");
+
+#define _OVERLAPPED_OVERLAPPED_WRITEFILE_METHODDEF    \
+    {"WriteFile", (PyCFunction)(void(*)(void))_overlapped_Overlapped_WriteFile, METH_FASTCALL, _overlapped_Overlapped_WriteFile__doc__},
+
+static PyObject *
+_overlapped_Overlapped_WriteFile_impl(OverlappedObject *self, HANDLE handle,
+                                      PyObject *bufobj);
+
+static PyObject *
+_overlapped_Overlapped_WriteFile(OverlappedObject *self, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    HANDLE handle;
+    PyObject *bufobj;
+
+    if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"O:WriteFile",
+        &handle, &bufobj)) {
+        goto exit;
+    }
+    return_value = _overlapped_Overlapped_WriteFile_impl(self, handle, bufobj);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_overlapped_Overlapped_WSASend__doc__,
+"WSASend($self, handle, buf, flags, /)\n"
+"--\n"
+"\n"
+"Start overlapped send.");
+
+#define _OVERLAPPED_OVERLAPPED_WSASEND_METHODDEF    \
+    {"WSASend", (PyCFunction)(void(*)(void))_overlapped_Overlapped_WSASend, METH_FASTCALL, _overlapped_Overlapped_WSASend__doc__},
+
+static PyObject *
+_overlapped_Overlapped_WSASend_impl(OverlappedObject *self, HANDLE handle,
+                                    PyObject *bufobj, DWORD flags);
+
+static PyObject *
+_overlapped_Overlapped_WSASend(OverlappedObject *self, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    HANDLE handle;
+    PyObject *bufobj;
+    DWORD flags;
+
+    if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"Ok:WSASend",
+        &handle, &bufobj, &flags)) {
+        goto exit;
+    }
+    return_value = _overlapped_Overlapped_WSASend_impl(self, handle, bufobj, flags);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_overlapped_Overlapped_AcceptEx__doc__,
+"AcceptEx($self, listen_handle, accept_handle, /)\n"
+"--\n"
+"\n"
+"Start overlapped wait for client to connect.");
+
+#define _OVERLAPPED_OVERLAPPED_ACCEPTEX_METHODDEF    \
+    {"AcceptEx", (PyCFunction)(void(*)(void))_overlapped_Overlapped_AcceptEx, METH_FASTCALL, _overlapped_Overlapped_AcceptEx__doc__},
+
+static PyObject *
+_overlapped_Overlapped_AcceptEx_impl(OverlappedObject *self,
+                                     HANDLE ListenSocket,
+                                     HANDLE AcceptSocket);
+
+static PyObject *
+_overlapped_Overlapped_AcceptEx(OverlappedObject *self, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    HANDLE ListenSocket;
+    HANDLE AcceptSocket;
+
+    if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE""F_HANDLE":AcceptEx",
+        &ListenSocket, &AcceptSocket)) {
+        goto exit;
+    }
+    return_value = _overlapped_Overlapped_AcceptEx_impl(self, ListenSocket, AcceptSocket);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_overlapped_Overlapped_ConnectEx__doc__,
+"ConnectEx($self, client_handle, address_as_bytes, /)\n"
+"--\n"
+"\n"
+"Start overlapped connect.\n"
+"\n"
+"client_handle should be unbound.");
+
+#define _OVERLAPPED_OVERLAPPED_CONNECTEX_METHODDEF    \
+    {"ConnectEx", (PyCFunction)(void(*)(void))_overlapped_Overlapped_ConnectEx, METH_FASTCALL, _overlapped_Overlapped_ConnectEx__doc__},
+
+static PyObject *
+_overlapped_Overlapped_ConnectEx_impl(OverlappedObject *self,
+                                      HANDLE ConnectSocket,
+                                      PyObject *AddressObj);
+
+static PyObject *
+_overlapped_Overlapped_ConnectEx(OverlappedObject *self, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    HANDLE ConnectSocket;
+    PyObject *AddressObj;
+
+    if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"O!:ConnectEx",
+        &ConnectSocket, &PyTuple_Type, &AddressObj)) {
+        goto exit;
+    }
+    return_value = _overlapped_Overlapped_ConnectEx_impl(self, ConnectSocket, AddressObj);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_overlapped_Overlapped_DisconnectEx__doc__,
+"DisconnectEx($self, handle, flags, /)\n"
+"--\n"
+"\n");
+
+#define _OVERLAPPED_OVERLAPPED_DISCONNECTEX_METHODDEF    \
+    {"DisconnectEx", (PyCFunction)(void(*)(void))_overlapped_Overlapped_DisconnectEx, METH_FASTCALL, _overlapped_Overlapped_DisconnectEx__doc__},
+
+static PyObject *
+_overlapped_Overlapped_DisconnectEx_impl(OverlappedObject *self,
+                                         HANDLE Socket, DWORD flags);
+
+static PyObject *
+_overlapped_Overlapped_DisconnectEx(OverlappedObject *self, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    HANDLE Socket;
+    DWORD flags;
+
+    if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"k:DisconnectEx",
+        &Socket, &flags)) {
+        goto exit;
+    }
+    return_value = _overlapped_Overlapped_DisconnectEx_impl(self, Socket, flags);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_overlapped_Overlapped_TransmitFile__doc__,
+"TransmitFile($self, socket, file, offset, offset_high, count_to_write,\n"
+"             count_per_send, flags, /)\n"
+"--\n"
+"\n"
+"Transmit file data over a connected socket.");
+
+#define _OVERLAPPED_OVERLAPPED_TRANSMITFILE_METHODDEF    \
+    {"TransmitFile", (PyCFunction)(void(*)(void))_overlapped_Overlapped_TransmitFile, METH_FASTCALL, _overlapped_Overlapped_TransmitFile__doc__},
+
+static PyObject *
+_overlapped_Overlapped_TransmitFile_impl(OverlappedObject *self,
+                                         HANDLE Socket, HANDLE File,
+                                         DWORD offset, DWORD offset_high,
+                                         DWORD count_to_write,
+                                         DWORD count_per_send, DWORD flags);
+
+static PyObject *
+_overlapped_Overlapped_TransmitFile(OverlappedObject *self, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    HANDLE Socket;
+    HANDLE File;
+    DWORD offset;
+    DWORD offset_high;
+    DWORD count_to_write;
+    DWORD count_per_send;
+    DWORD flags;
+
+    if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE""F_HANDLE"kkkkk:TransmitFile",
+        &Socket, &File, &offset, &offset_high, &count_to_write, &count_per_send, &flags)) {
+        goto exit;
+    }
+    return_value = _overlapped_Overlapped_TransmitFile_impl(self, Socket, File, offset, offset_high, count_to_write, count_per_send, flags);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_overlapped_Overlapped_ConnectNamedPipe__doc__,
+"ConnectNamedPipe($self, handle, /)\n"
+"--\n"
+"\n"
+"Start overlapped wait for a client to connect.");
+
+#define _OVERLAPPED_OVERLAPPED_CONNECTNAMEDPIPE_METHODDEF    \
+    {"ConnectNamedPipe", (PyCFunction)_overlapped_Overlapped_ConnectNamedPipe, METH_O, _overlapped_Overlapped_ConnectNamedPipe__doc__},
+
+static PyObject *
+_overlapped_Overlapped_ConnectNamedPipe_impl(OverlappedObject *self,
+                                             HANDLE Pipe);
+
+static PyObject *
+_overlapped_Overlapped_ConnectNamedPipe(OverlappedObject *self, PyObject *arg)
+{
+    PyObject *return_value = NULL;
+    HANDLE Pipe;
+
+    if (!PyArg_Parse(arg, ""F_HANDLE":ConnectNamedPipe", &Pipe)) {
+        goto exit;
+    }
+    return_value = _overlapped_Overlapped_ConnectNamedPipe_impl(self, Pipe);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_overlapped_Overlapped_ConnectPipe__doc__,
+"ConnectPipe($self, addr, /)\n"
+"--\n"
+"\n"
+"Connect to the pipe for asynchronous I/O (overlapped).");
+
+#define _OVERLAPPED_OVERLAPPED_CONNECTPIPE_METHODDEF    \
+    {"ConnectPipe", (PyCFunction)_overlapped_Overlapped_ConnectPipe, METH_O, _overlapped_Overlapped_ConnectPipe__doc__},
+
+static PyObject *
+_overlapped_Overlapped_ConnectPipe_impl(OverlappedObject *self,
+                                        const Py_UNICODE *Address);
+
+static PyObject *
+_overlapped_Overlapped_ConnectPipe(OverlappedObject *self, PyObject *arg)
+{
+    PyObject *return_value = NULL;
+    const Py_UNICODE *Address;
+
+    if (!PyUnicode_Check(arg)) {
+        _PyArg_BadArgument("ConnectPipe", "argument", "str", arg);
+        goto exit;
+    }
+    #if USE_UNICODE_WCHAR_CACHE
+    Address = _PyUnicode_AsUnicode(arg);
+    #else /* USE_UNICODE_WCHAR_CACHE */
+    Address = PyUnicode_AsWideCharString(arg, NULL);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+    if (Address == NULL) {
+        goto exit;
+    }
+    return_value = _overlapped_Overlapped_ConnectPipe_impl(self, Address);
+
+exit:
+    /* Cleanup for Address */
+    #if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free((void *)Address);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+
+    return return_value;
+}
+
+PyDoc_STRVAR(_overlapped_WSAConnect__doc__,
+"WSAConnect($module, client_handle, address_as_bytes, /)\n"
+"--\n"
+"\n"
+"Bind a remote address to a connectionless (UDP) socket.");
+
+#define _OVERLAPPED_WSACONNECT_METHODDEF    \
+    {"WSAConnect", (PyCFunction)(void(*)(void))_overlapped_WSAConnect, METH_FASTCALL, _overlapped_WSAConnect__doc__},
+
+static PyObject *
+_overlapped_WSAConnect_impl(PyObject *module, HANDLE ConnectSocket,
+                            PyObject *AddressObj);
+
+static PyObject *
+_overlapped_WSAConnect(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    HANDLE ConnectSocket;
+    PyObject *AddressObj;
+
+    if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"O:WSAConnect",
+        &ConnectSocket, &AddressObj)) {
+        goto exit;
+    }
+    return_value = _overlapped_WSAConnect_impl(module, ConnectSocket, AddressObj);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_overlapped_Overlapped_WSASendTo__doc__,
+"WSASendTo($self, handle, buf, flags, address_as_bytes, /)\n"
+"--\n"
+"\n"
+"Start overlapped sendto over a connectionless (UDP) socket.");
+
+#define _OVERLAPPED_OVERLAPPED_WSASENDTO_METHODDEF    \
+    {"WSASendTo", (PyCFunction)(void(*)(void))_overlapped_Overlapped_WSASendTo, METH_FASTCALL, _overlapped_Overlapped_WSASendTo__doc__},
+
+static PyObject *
+_overlapped_Overlapped_WSASendTo_impl(OverlappedObject *self, HANDLE handle,
+                                      PyObject *bufobj, DWORD flags,
+                                      PyObject *AddressObj);
+
+static PyObject *
+_overlapped_Overlapped_WSASendTo(OverlappedObject *self, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    HANDLE handle;
+    PyObject *bufobj;
+    DWORD flags;
+    PyObject *AddressObj;
+
+    if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"OkO:WSASendTo",
+        &handle, &bufobj, &flags, &AddressObj)) {
+        goto exit;
+    }
+    return_value = _overlapped_Overlapped_WSASendTo_impl(self, handle, bufobj, flags, AddressObj);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_overlapped_Overlapped_WSARecvFrom__doc__,
+"WSARecvFrom($self, handle, size, flags=0, /)\n"
+"--\n"
+"\n"
+"Start overlapped receive.");
+
+#define _OVERLAPPED_OVERLAPPED_WSARECVFROM_METHODDEF    \
+    {"WSARecvFrom", (PyCFunction)(void(*)(void))_overlapped_Overlapped_WSARecvFrom, METH_FASTCALL, _overlapped_Overlapped_WSARecvFrom__doc__},
+
+static PyObject *
+_overlapped_Overlapped_WSARecvFrom_impl(OverlappedObject *self,
+                                        HANDLE handle, DWORD size,
+                                        DWORD flags);
+
+static PyObject *
+_overlapped_Overlapped_WSARecvFrom(OverlappedObject *self, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    HANDLE handle;
+    DWORD size;
+    DWORD flags = 0;
+
+    if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"k|k:WSARecvFrom",
+        &handle, &size, &flags)) {
+        goto exit;
+    }
+    return_value = _overlapped_Overlapped_WSARecvFrom_impl(self, handle, size, flags);
+
+exit:
+    return return_value;
+}
+/*[clinic end generated code: output=ee2ec2f93c8d334b input=a9049054013a1b77]*/
diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h
index 41baa45..7921c22 100644
--- a/Modules/clinic/posixmodule.c.h
+++ b/Modules/clinic/posixmodule.c.h
@@ -187,11 +187,6 @@
     if (!path_converter(args[0], &path)) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     mode = _PyLong_AsInt(args[1]);
     if (mode == -1 && PyErr_Occurred()) {
         goto exit;
@@ -257,11 +252,6 @@
     PyObject *return_value = NULL;
     int fd;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(arg);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
@@ -367,7 +357,7 @@
     if (!args) {
         goto exit;
     }
-    if (!fildes_converter(args[0], &fd)) {
+    if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
         goto exit;
     }
     return_value = os_fchdir_impl(module, fd);
@@ -431,11 +421,6 @@
     if (!path_converter(args[0], &path)) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     mode = _PyLong_AsInt(args[1]);
     if (mode == -1 && PyErr_Occurred()) {
         goto exit;
@@ -495,20 +480,10 @@
     if (!args) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(args[0]);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     mode = _PyLong_AsInt(args[1]);
     if (mode == -1 && PyErr_Occurred()) {
         goto exit;
@@ -555,11 +530,6 @@
     if (!path_converter(args[0], &path)) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     mode = _PyLong_AsInt(args[1]);
     if (mode == -1 && PyErr_Occurred()) {
         goto exit;
@@ -757,7 +727,7 @@
     if (!args) {
         goto exit;
     }
-    if (!fildes_converter(args[0], &fd)) {
+    if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
         goto exit;
     }
     return_value = os_fsync_impl(module, fd);
@@ -817,7 +787,7 @@
     if (!args) {
         goto exit;
     }
-    if (!fildes_converter(args[0], &fd)) {
+    if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
         goto exit;
     }
     return_value = os_fdatasync_impl(module, fd);
@@ -952,11 +922,6 @@
     if (!args) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(args[0]);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1311,6 +1276,47 @@
 
 #endif /* defined(MS_WINDOWS) */
 
+#if defined(MS_WINDOWS)
+
+PyDoc_STRVAR(os__path_splitroot__doc__,
+"_path_splitroot($module, /, path)\n"
+"--\n"
+"\n"
+"Removes everything after the root on Win32.");
+
+#define OS__PATH_SPLITROOT_METHODDEF    \
+    {"_path_splitroot", (PyCFunction)(void(*)(void))os__path_splitroot, METH_FASTCALL|METH_KEYWORDS, os__path_splitroot__doc__},
+
+static PyObject *
+os__path_splitroot_impl(PyObject *module, path_t *path);
+
+static PyObject *
+os__path_splitroot(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"path", NULL};
+    static _PyArg_Parser _parser = {NULL, _keywords, "_path_splitroot", 0};
+    PyObject *argsbuf[1];
+    path_t path = PATH_T_INITIALIZE("_path_splitroot", "path", 0, 0);
+
+    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+    if (!args) {
+        goto exit;
+    }
+    if (!path_converter(args[0], &path)) {
+        goto exit;
+    }
+    return_value = os__path_splitroot_impl(module, &path);
+
+exit:
+    /* Cleanup for path */
+    path_cleanup(&path);
+
+    return return_value;
+}
+
+#endif /* defined(MS_WINDOWS) */
+
 PyDoc_STRVAR(os_mkdir__doc__,
 "mkdir($module, /, path, mode=511, *, dir_fd=None)\n"
 "--\n"
@@ -1353,11 +1359,6 @@
         goto skip_optional_pos;
     }
     if (args[1]) {
-        if (PyFloat_Check(args[1])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         mode = _PyLong_AsInt(args[1]);
         if (mode == -1 && PyErr_Occurred()) {
             goto exit;
@@ -1403,11 +1404,6 @@
     PyObject *return_value = NULL;
     int increment;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     increment = _PyLong_AsInt(arg);
     if (increment == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1448,20 +1444,10 @@
     if (!args) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     which = _PyLong_AsInt(args[0]);
     if (which == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     who = _PyLong_AsInt(args[1]);
     if (who == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1503,29 +1489,14 @@
     if (!args) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     which = _PyLong_AsInt(args[0]);
     if (which == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     who = _PyLong_AsInt(args[1]);
     if (who == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     priority = _PyLong_AsInt(args[2]);
     if (priority == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1744,12 +1715,25 @@
 {
     PyObject *return_value = NULL;
     static const char * const _keywords[] = {"command", NULL};
-    static _PyArg_Parser _parser = {"u:system", _keywords, 0};
+    static _PyArg_Parser _parser = {NULL, _keywords, "system", 0};
+    PyObject *argsbuf[1];
     const Py_UNICODE *command;
     long _return_value;
 
-    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
-        &command)) {
+    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+    if (!args) {
+        goto exit;
+    }
+    if (!PyUnicode_Check(args[0])) {
+        _PyArg_BadArgument("system", "argument 'command'", "str", args[0]);
+        goto exit;
+    }
+    #if USE_UNICODE_WCHAR_CACHE
+    command = _PyUnicode_AsUnicode(args[0]);
+    #else /* USE_UNICODE_WCHAR_CACHE */
+    command = PyUnicode_AsWideCharString(args[0], NULL);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+    if (command == NULL) {
         goto exit;
     }
     _return_value = os_system_impl(module, command);
@@ -1759,6 +1743,11 @@
     return_value = PyLong_FromLong(_return_value);
 
 exit:
+    /* Cleanup for command */
+    #if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free((void *)command);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+
     return return_value;
 }
 
@@ -1828,11 +1817,6 @@
     PyObject *return_value = NULL;
     int mask;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     mask = _PyLong_AsInt(arg);
     if (mask == -1 && PyErr_Occurred()) {
         goto exit;
@@ -2093,11 +2077,6 @@
     if (!args) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     status = _PyLong_AsInt(args[0]);
     if (status == -1 && PyErr_Occurred()) {
         goto exit;
@@ -2289,11 +2268,6 @@
         }
     }
     if (args[5]) {
-        if (PyFloat_Check(args[5])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         resetids = _PyLong_AsInt(args[5]);
         if (resetids == -1 && PyErr_Occurred()) {
             goto exit;
@@ -2303,11 +2277,6 @@
         }
     }
     if (args[6]) {
-        if (PyFloat_Check(args[6])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         setsid = _PyLong_AsInt(args[6]);
         if (setsid == -1 && PyErr_Occurred()) {
             goto exit;
@@ -2426,11 +2395,6 @@
         }
     }
     if (args[5]) {
-        if (PyFloat_Check(args[5])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         resetids = _PyLong_AsInt(args[5]);
         if (resetids == -1 && PyErr_Occurred()) {
             goto exit;
@@ -2440,11 +2404,6 @@
         }
     }
     if (args[6]) {
-        if (PyFloat_Check(args[6])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         setsid = _PyLong_AsInt(args[6]);
         if (setsid == -1 && PyErr_Occurred()) {
             goto exit;
@@ -2510,11 +2469,6 @@
     if (!_PyArg_CheckPositional("spawnv", nargs, 3, 3)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     mode = _PyLong_AsInt(args[0]);
     if (mode == -1 && PyErr_Occurred()) {
         goto exit;
@@ -2570,11 +2524,6 @@
     if (!_PyArg_CheckPositional("spawnve", nargs, 4, 4)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     mode = _PyLong_AsInt(args[0]);
     if (mode == -1 && PyErr_Occurred()) {
         goto exit;
@@ -2738,11 +2687,6 @@
     if (!args) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     policy = _PyLong_AsInt(args[0]);
     if (policy == -1 && PyErr_Occurred()) {
         goto exit;
@@ -2782,11 +2726,6 @@
     if (!args) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     policy = _PyLong_AsInt(args[0]);
     if (policy == -1 && PyErr_Occurred()) {
         goto exit;
@@ -3288,11 +3227,6 @@
         PyErr_SetString(PyExc_ValueError, "embedded null character");
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     basegid = _PyLong_AsInt(args[1]);
     if (basegid == -1 && PyErr_Occurred()) {
         goto exit;
@@ -3411,11 +3345,6 @@
     if (!PyUnicode_FSConverter(args[0], &oname)) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     gid = _PyLong_AsInt(args[1]);
     if (gid == -1 && PyErr_Occurred()) {
         goto exit;
@@ -3709,11 +3638,6 @@
     PyObject *return_value = NULL;
     int op;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     op = _PyLong_AsInt(arg);
     if (op == -1 && PyErr_Occurred()) {
         goto exit;
@@ -3969,11 +3893,6 @@
     if (!args) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     options = _PyLong_AsInt(args[0]);
     if (options == -1 && PyErr_Occurred()) {
         goto exit;
@@ -4477,11 +4396,6 @@
     PyObject *return_value = NULL;
     int fd;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(arg);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
@@ -4565,11 +4479,6 @@
     if (!path_converter(args[0], &path)) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     flags = _PyLong_AsInt(args[1]);
     if (flags == -1 && PyErr_Occurred()) {
         goto exit;
@@ -4578,11 +4487,6 @@
         goto skip_optional_pos;
     }
     if (args[2]) {
-        if (PyFloat_Check(args[2])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         mode = _PyLong_AsInt(args[2]);
         if (mode == -1 && PyErr_Occurred()) {
             goto exit;
@@ -4637,11 +4541,6 @@
     if (!args) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(args[0]);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
@@ -4674,20 +4573,10 @@
     if (!_PyArg_CheckPositional("closerange", nargs, 2, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd_low = _PyLong_AsInt(args[0]);
     if (fd_low == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd_high = _PyLong_AsInt(args[1]);
     if (fd_high == -1 && PyErr_Occurred()) {
         goto exit;
@@ -4717,11 +4606,6 @@
     int fd;
     int _return_value;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(arg);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
@@ -4765,20 +4649,10 @@
     if (!args) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(args[0]);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd2 = _PyLong_AsInt(args[1]);
     if (fd2 == -1 && PyErr_Occurred()) {
         goto exit;
@@ -4833,20 +4707,10 @@
     if (!_PyArg_CheckPositional("lockf", nargs, 3, 3)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(args[0]);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     command = _PyLong_AsInt(args[1]);
     if (command == -1 && PyErr_Occurred()) {
         goto exit;
@@ -4889,11 +4753,6 @@
     if (!_PyArg_CheckPositional("lseek", nargs, 3, 3)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(args[0]);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
@@ -4901,11 +4760,6 @@
     if (!Py_off_t_converter(args[1], &position)) {
         goto exit;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     how = _PyLong_AsInt(args[2]);
     if (how == -1 && PyErr_Occurred()) {
         goto exit;
@@ -4942,23 +4796,13 @@
     if (!_PyArg_CheckPositional("read", nargs, 2, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(args[0]);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[1]);
+        PyObject *iobj = _PyNumber_Index(args[1]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -5007,11 +4851,6 @@
     if (!_PyArg_CheckPositional("readv", nargs, 2, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(args[0]);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
@@ -5057,23 +4896,13 @@
     if (!_PyArg_CheckPositional("pread", nargs, 3, 3)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(args[0]);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[1]);
+        PyObject *iobj = _PyNumber_Index(args[1]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -5136,11 +4965,6 @@
     if (!_PyArg_CheckPositional("preadv", nargs, 3, 4)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(args[0]);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
@@ -5152,11 +4976,6 @@
     if (nargs < 4) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[3])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     flags = _PyLong_AsInt(args[3]);
     if (flags == -1 && PyErr_Occurred()) {
         goto exit;
@@ -5197,11 +5016,6 @@
     if (!_PyArg_CheckPositional("write", nargs, 2, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(args[0]);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
@@ -5265,20 +5079,10 @@
     if (!args) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     out_fd = _PyLong_AsInt(args[0]);
     if (out_fd == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     in_fd = _PyLong_AsInt(args[1]);
     if (in_fd == -1 && PyErr_Occurred()) {
         goto exit;
@@ -5304,11 +5108,6 @@
             goto skip_optional_pos;
         }
     }
-    if (PyFloat_Check(args[6])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     flags = _PyLong_AsInt(args[6]);
     if (flags == -1 && PyErr_Occurred()) {
         goto exit;
@@ -5359,20 +5158,10 @@
     if (!args) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     out_fd = _PyLong_AsInt(args[0]);
     if (out_fd == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     in_fd = _PyLong_AsInt(args[1]);
     if (in_fd == -1 && PyErr_Occurred()) {
         goto exit;
@@ -5380,14 +5169,9 @@
     if (!Py_off_t_converter(args[2], &offset)) {
         goto exit;
     }
-    if (PyFloat_Check(args[3])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[3]);
+        PyObject *iobj = _PyNumber_Index(args[3]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -5412,11 +5196,6 @@
             goto skip_optional_pos;
         }
     }
-    if (PyFloat_Check(args[6])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     flags = _PyLong_AsInt(args[6]);
     if (flags == -1 && PyErr_Occurred()) {
         goto exit;
@@ -5461,33 +5240,18 @@
     if (!args) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     out_fd = _PyLong_AsInt(args[0]);
     if (out_fd == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     in_fd = _PyLong_AsInt(args[1]);
     if (in_fd == -1 && PyErr_Occurred()) {
         goto exit;
     }
     offobj = args[2];
-    if (PyFloat_Check(args[3])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[3]);
+        PyObject *iobj = _PyNumber_Index(args[3]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -5530,29 +5294,14 @@
     if (!_PyArg_CheckPositional("_fcopyfile", nargs, 3, 3)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     in_fd = _PyLong_AsInt(args[0]);
     if (in_fd == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     out_fd = _PyLong_AsInt(args[1]);
     if (out_fd == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     flags = _PyLong_AsInt(args[2]);
     if (flags == -1 && PyErr_Occurred()) {
         goto exit;
@@ -5593,11 +5342,6 @@
     if (!args) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(args[0]);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
@@ -5630,11 +5374,6 @@
     int fd;
     int _return_value;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(arg);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
@@ -5700,11 +5439,6 @@
     PyObject *return_value = NULL;
     int flags;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     flags = _PyLong_AsInt(arg);
     if (flags == -1 && PyErr_Occurred()) {
         goto exit;
@@ -5745,11 +5479,6 @@
     if (!_PyArg_CheckPositional("writev", nargs, 2, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(args[0]);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
@@ -5797,11 +5526,6 @@
     if (!_PyArg_CheckPositional("pwrite", nargs, 3, 3)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(args[0]);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
@@ -5852,6 +5576,7 @@
 "\n"
 "- RWF_DSYNC\n"
 "- RWF_SYNC\n"
+"- RWF_APPEND\n"
 "\n"
 "Using non-zero flags requires Linux 4.7 or newer.");
 
@@ -5875,11 +5600,6 @@
     if (!_PyArg_CheckPositional("pwritev", nargs, 3, 4)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(args[0]);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
@@ -5891,11 +5611,6 @@
     if (nargs < 4) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[3])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     flags = _PyLong_AsInt(args[3]);
     if (flags == -1 && PyErr_Occurred()) {
         goto exit;
@@ -5961,32 +5676,17 @@
     if (!args) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     src = _PyLong_AsInt(args[0]);
     if (src == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     dst = _PyLong_AsInt(args[1]);
     if (dst == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[2]);
+        PyObject *iobj = _PyNumber_Index(args[2]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -6015,6 +5715,106 @@
 
 #endif /* defined(HAVE_COPY_FILE_RANGE) */
 
+#if ((defined(HAVE_SPLICE) && !defined(_AIX)))
+
+PyDoc_STRVAR(os_splice__doc__,
+"splice($module, /, src, dst, count, offset_src=None, offset_dst=None,\n"
+"       flags=0)\n"
+"--\n"
+"\n"
+"Transfer count bytes from one pipe to a descriptor or vice versa.\n"
+"\n"
+"  src\n"
+"    Source file descriptor.\n"
+"  dst\n"
+"    Destination file descriptor.\n"
+"  count\n"
+"    Number of bytes to copy.\n"
+"  offset_src\n"
+"    Starting offset in src.\n"
+"  offset_dst\n"
+"    Starting offset in dst.\n"
+"  flags\n"
+"    Flags to modify the semantics of the call.\n"
+"\n"
+"If offset_src is None, then src is read from the current position;\n"
+"respectively for offset_dst. The offset associated to the file\n"
+"descriptor that refers to a pipe must be None.");
+
+#define OS_SPLICE_METHODDEF    \
+    {"splice", (PyCFunction)(void(*)(void))os_splice, METH_FASTCALL|METH_KEYWORDS, os_splice__doc__},
+
+static PyObject *
+os_splice_impl(PyObject *module, int src, int dst, Py_ssize_t count,
+               PyObject *offset_src, PyObject *offset_dst,
+               unsigned int flags);
+
+static PyObject *
+os_splice(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"src", "dst", "count", "offset_src", "offset_dst", "flags", NULL};
+    static _PyArg_Parser _parser = {NULL, _keywords, "splice", 0};
+    PyObject *argsbuf[6];
+    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 3;
+    int src;
+    int dst;
+    Py_ssize_t count;
+    PyObject *offset_src = Py_None;
+    PyObject *offset_dst = Py_None;
+    unsigned int flags = 0;
+
+    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 6, 0, argsbuf);
+    if (!args) {
+        goto exit;
+    }
+    src = _PyLong_AsInt(args[0]);
+    if (src == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    dst = _PyLong_AsInt(args[1]);
+    if (dst == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    {
+        Py_ssize_t ival = -1;
+        PyObject *iobj = _PyNumber_Index(args[2]);
+        if (iobj != NULL) {
+            ival = PyLong_AsSsize_t(iobj);
+            Py_DECREF(iobj);
+        }
+        if (ival == -1 && PyErr_Occurred()) {
+            goto exit;
+        }
+        count = ival;
+    }
+    if (!noptargs) {
+        goto skip_optional_pos;
+    }
+    if (args[3]) {
+        offset_src = args[3];
+        if (!--noptargs) {
+            goto skip_optional_pos;
+        }
+    }
+    if (args[4]) {
+        offset_dst = args[4];
+        if (!--noptargs) {
+            goto skip_optional_pos;
+        }
+    }
+    if (!_PyLong_UnsignedInt_Converter(args[5], &flags)) {
+        goto exit;
+    }
+skip_optional_pos:
+    return_value = os_splice_impl(module, src, dst, count, offset_src, offset_dst, flags);
+
+exit:
+    return return_value;
+}
+
+#endif /* ((defined(HAVE_SPLICE) && !defined(_AIX))) */
+
 #if defined(HAVE_MKFIFO)
 
 PyDoc_STRVAR(os_mkfifo__doc__,
@@ -6057,11 +5857,6 @@
         goto skip_optional_pos;
     }
     if (args[1]) {
-        if (PyFloat_Check(args[1])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         mode = _PyLong_AsInt(args[1]);
         if (mode == -1 && PyErr_Occurred()) {
             goto exit;
@@ -6140,11 +5935,6 @@
         goto skip_optional_pos;
     }
     if (args[1]) {
-        if (PyFloat_Check(args[1])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         mode = _PyLong_AsInt(args[1]);
         if (mode == -1 && PyErr_Occurred()) {
             goto exit;
@@ -6277,20 +6067,10 @@
     if (!_PyArg_CheckPositional("makedev", nargs, 2, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     major = _PyLong_AsInt(args[0]);
     if (major == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     minor = _PyLong_AsInt(args[1]);
     if (minor == -1 && PyErr_Occurred()) {
         goto exit;
@@ -6331,11 +6111,6 @@
     if (!_PyArg_CheckPositional("ftruncate", nargs, 2, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(args[0]);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
@@ -6428,11 +6203,6 @@
     if (!_PyArg_CheckPositional("posix_fallocate", nargs, 3, 3)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(args[0]);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
@@ -6486,11 +6256,6 @@
     if (!_PyArg_CheckPositional("posix_fadvise", nargs, 4, 4)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(args[0]);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
@@ -6501,11 +6266,6 @@
     if (!Py_off_t_converter(args[2], &length)) {
         goto exit;
     }
-    if (PyFloat_Check(args[3])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     advice = _PyLong_AsInt(args[3]);
     if (advice == -1 && PyErr_Occurred()) {
         goto exit;
@@ -6697,11 +6457,6 @@
     PyObject *return_value = NULL;
     int code;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     code = _PyLong_AsInt(arg);
     if (code == -1 && PyErr_Occurred()) {
         goto exit;
@@ -6733,11 +6488,6 @@
     int status;
     int _return_value;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     status = _PyLong_AsInt(arg);
     if (status == -1 && PyErr_Occurred()) {
         goto exit;
@@ -6785,11 +6535,6 @@
     if (!args) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     status = _PyLong_AsInt(args[0]);
     if (status == -1 && PyErr_Occurred()) {
         goto exit;
@@ -6834,11 +6579,6 @@
     if (!args) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     status = _PyLong_AsInt(args[0]);
     if (status == -1 && PyErr_Occurred()) {
         goto exit;
@@ -6883,11 +6623,6 @@
     if (!args) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     status = _PyLong_AsInt(args[0]);
     if (status == -1 && PyErr_Occurred()) {
         goto exit;
@@ -6932,11 +6667,6 @@
     if (!args) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     status = _PyLong_AsInt(args[0]);
     if (status == -1 && PyErr_Occurred()) {
         goto exit;
@@ -6981,11 +6711,6 @@
     if (!args) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     status = _PyLong_AsInt(args[0]);
     if (status == -1 && PyErr_Occurred()) {
         goto exit;
@@ -7030,11 +6755,6 @@
     if (!args) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     status = _PyLong_AsInt(args[0]);
     if (status == -1 && PyErr_Occurred()) {
         goto exit;
@@ -7079,11 +6799,6 @@
     if (!args) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     status = _PyLong_AsInt(args[0]);
     if (status == -1 && PyErr_Occurred()) {
         goto exit;
@@ -7122,11 +6837,6 @@
     PyObject *return_value = NULL;
     int fd;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(arg);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
@@ -7252,13 +6962,7 @@
     if (!_PyArg_CheckPositional("fpathconf", nargs, 2, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
-    fd = _PyLong_AsInt(args[0]);
-    if (fd == -1 && PyErr_Occurred()) {
+    if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
         goto exit;
     }
     if (!conv_path_confname(args[1], &name)) {
@@ -7421,7 +7125,8 @@
 #if defined(MS_WINDOWS)
 
 PyDoc_STRVAR(os_startfile__doc__,
-"startfile($module, /, filepath, operation=<unrepresentable>)\n"
+"startfile($module, /, filepath, operation=<unrepresentable>,\n"
+"          arguments=<unrepresentable>, cwd=None, show_cmd=1)\n"
 "--\n"
 "\n"
 "Start a file with its associated application.\n"
@@ -7433,6 +7138,16 @@
 "When another \"operation\" is given, it specifies what should be done with\n"
 "the file.  A typical operation is \"print\".\n"
 "\n"
+"\"arguments\" is passed to the application, but should be omitted if the\n"
+"file is a document.\n"
+"\n"
+"\"cwd\" is the working directory for the operation. If \"filepath\" is\n"
+"relative, it will be resolved against this directory. This argument\n"
+"should usually be an absolute path.\n"
+"\n"
+"\"show_cmd\" can be used to override the recommended visibility option.\n"
+"See the Windows ShellExecute documentation for values.\n"
+"\n"
 "startfile returns as soon as the associated application is launched.\n"
 "There is no option to wait for the application to close, and no way\n"
 "to retrieve the application\'s exit status.\n"
@@ -7446,26 +7161,95 @@
 
 static PyObject *
 os_startfile_impl(PyObject *module, path_t *filepath,
-                  const Py_UNICODE *operation);
+                  const Py_UNICODE *operation, const Py_UNICODE *arguments,
+                  path_t *cwd, int show_cmd);
 
 static PyObject *
 os_startfile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
     PyObject *return_value = NULL;
-    static const char * const _keywords[] = {"filepath", "operation", NULL};
-    static _PyArg_Parser _parser = {"O&|u:startfile", _keywords, 0};
+    static const char * const _keywords[] = {"filepath", "operation", "arguments", "cwd", "show_cmd", NULL};
+    static _PyArg_Parser _parser = {NULL, _keywords, "startfile", 0};
+    PyObject *argsbuf[5];
+    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
     path_t filepath = PATH_T_INITIALIZE("startfile", "filepath", 0, 0);
     const Py_UNICODE *operation = NULL;
+    const Py_UNICODE *arguments = NULL;
+    path_t cwd = PATH_T_INITIALIZE("startfile", "cwd", 1, 0);
+    int show_cmd = 1;
 
-    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
-        path_converter, &filepath, &operation)) {
+    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 5, 0, argsbuf);
+    if (!args) {
         goto exit;
     }
-    return_value = os_startfile_impl(module, &filepath, operation);
+    if (!path_converter(args[0], &filepath)) {
+        goto exit;
+    }
+    if (!noptargs) {
+        goto skip_optional_pos;
+    }
+    if (args[1]) {
+        if (!PyUnicode_Check(args[1])) {
+            _PyArg_BadArgument("startfile", "argument 'operation'", "str", args[1]);
+            goto exit;
+        }
+        #if USE_UNICODE_WCHAR_CACHE
+        operation = _PyUnicode_AsUnicode(args[1]);
+        #else /* USE_UNICODE_WCHAR_CACHE */
+        operation = PyUnicode_AsWideCharString(args[1], NULL);
+        #endif /* USE_UNICODE_WCHAR_CACHE */
+        if (operation == NULL) {
+            goto exit;
+        }
+        if (!--noptargs) {
+            goto skip_optional_pos;
+        }
+    }
+    if (args[2]) {
+        if (!PyUnicode_Check(args[2])) {
+            _PyArg_BadArgument("startfile", "argument 'arguments'", "str", args[2]);
+            goto exit;
+        }
+        #if USE_UNICODE_WCHAR_CACHE
+        arguments = _PyUnicode_AsUnicode(args[2]);
+        #else /* USE_UNICODE_WCHAR_CACHE */
+        arguments = PyUnicode_AsWideCharString(args[2], NULL);
+        #endif /* USE_UNICODE_WCHAR_CACHE */
+        if (arguments == NULL) {
+            goto exit;
+        }
+        if (!--noptargs) {
+            goto skip_optional_pos;
+        }
+    }
+    if (args[3]) {
+        if (!path_converter(args[3], &cwd)) {
+            goto exit;
+        }
+        if (!--noptargs) {
+            goto skip_optional_pos;
+        }
+    }
+    show_cmd = _PyLong_AsInt(args[4]);
+    if (show_cmd == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+skip_optional_pos:
+    return_value = os_startfile_impl(module, &filepath, operation, arguments, &cwd, show_cmd);
 
 exit:
     /* Cleanup for filepath */
     path_cleanup(&filepath);
+    /* Cleanup for operation */
+    #if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free((void *)operation);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+    /* Cleanup for arguments */
+    #if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free((void *)arguments);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+    /* Cleanup for cwd */
+    path_cleanup(&cwd);
 
     return return_value;
 }
@@ -7526,11 +7310,6 @@
     if (!args) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(args[0]);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
@@ -7788,11 +7567,6 @@
         goto skip_optional_pos;
     }
     if (args[3]) {
-        if (PyFloat_Check(args[3])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         flags = _PyLong_AsInt(args[3]);
         if (flags == -1 && PyErr_Occurred()) {
             goto exit;
@@ -7974,14 +7748,9 @@
     PyObject *return_value = NULL;
     Py_ssize_t size;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(arg);
+        PyObject *iobj = _PyNumber_Index(arg);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -8031,11 +7800,6 @@
     if (!noptargs) {
         goto skip_optional_pos;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     flags = (unsigned int)PyLong_AsUnsignedLongMask(args[1]);
     if (flags == (unsigned int)-1 && PyErr_Occurred()) {
         goto exit;
@@ -8052,6 +7816,134 @@
 
 #endif /* defined(HAVE_MEMFD_CREATE) */
 
+#if defined(HAVE_EVENTFD)
+
+PyDoc_STRVAR(os_eventfd__doc__,
+"eventfd($module, /, initval, flags=EFD_CLOEXEC)\n"
+"--\n"
+"\n"
+"Creates and returns an event notification file descriptor.");
+
+#define OS_EVENTFD_METHODDEF    \
+    {"eventfd", (PyCFunction)(void(*)(void))os_eventfd, METH_FASTCALL|METH_KEYWORDS, os_eventfd__doc__},
+
+static PyObject *
+os_eventfd_impl(PyObject *module, unsigned int initval, int flags);
+
+static PyObject *
+os_eventfd(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"initval", "flags", NULL};
+    static _PyArg_Parser _parser = {NULL, _keywords, "eventfd", 0};
+    PyObject *argsbuf[2];
+    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
+    unsigned int initval;
+    int flags = EFD_CLOEXEC;
+
+    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
+    if (!args) {
+        goto exit;
+    }
+    if (!_PyLong_UnsignedInt_Converter(args[0], &initval)) {
+        goto exit;
+    }
+    if (!noptargs) {
+        goto skip_optional_pos;
+    }
+    flags = _PyLong_AsInt(args[1]);
+    if (flags == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+skip_optional_pos:
+    return_value = os_eventfd_impl(module, initval, flags);
+
+exit:
+    return return_value;
+}
+
+#endif /* defined(HAVE_EVENTFD) */
+
+#if defined(HAVE_EVENTFD)
+
+PyDoc_STRVAR(os_eventfd_read__doc__,
+"eventfd_read($module, /, fd)\n"
+"--\n"
+"\n"
+"Read eventfd value");
+
+#define OS_EVENTFD_READ_METHODDEF    \
+    {"eventfd_read", (PyCFunction)(void(*)(void))os_eventfd_read, METH_FASTCALL|METH_KEYWORDS, os_eventfd_read__doc__},
+
+static PyObject *
+os_eventfd_read_impl(PyObject *module, int fd);
+
+static PyObject *
+os_eventfd_read(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"fd", NULL};
+    static _PyArg_Parser _parser = {NULL, _keywords, "eventfd_read", 0};
+    PyObject *argsbuf[1];
+    int fd;
+
+    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+    if (!args) {
+        goto exit;
+    }
+    if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
+        goto exit;
+    }
+    return_value = os_eventfd_read_impl(module, fd);
+
+exit:
+    return return_value;
+}
+
+#endif /* defined(HAVE_EVENTFD) */
+
+#if defined(HAVE_EVENTFD)
+
+PyDoc_STRVAR(os_eventfd_write__doc__,
+"eventfd_write($module, /, fd, value)\n"
+"--\n"
+"\n"
+"Write eventfd value.");
+
+#define OS_EVENTFD_WRITE_METHODDEF    \
+    {"eventfd_write", (PyCFunction)(void(*)(void))os_eventfd_write, METH_FASTCALL|METH_KEYWORDS, os_eventfd_write__doc__},
+
+static PyObject *
+os_eventfd_write_impl(PyObject *module, int fd, unsigned long long value);
+
+static PyObject *
+os_eventfd_write(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"fd", "value", NULL};
+    static _PyArg_Parser _parser = {NULL, _keywords, "eventfd_write", 0};
+    PyObject *argsbuf[2];
+    int fd;
+    unsigned long long value;
+
+    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
+    if (!args) {
+        goto exit;
+    }
+    if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
+        goto exit;
+    }
+    if (!_PyLong_UnsignedLongLong_Converter(args[1], &value)) {
+        goto exit;
+    }
+    return_value = os_eventfd_write_impl(module, fd, value);
+
+exit:
+    return return_value;
+}
+
+#endif /* defined(HAVE_EVENTFD) */
+
 #if (defined(TERMSIZE_USE_CONIO) || defined(TERMSIZE_USE_IOCTL))
 
 PyDoc_STRVAR(os_get_terminal_size__doc__,
@@ -8090,11 +7982,6 @@
     if (nargs < 1) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(args[0]);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
@@ -8149,11 +8036,6 @@
     int fd;
     int _return_value;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(arg);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
@@ -8190,20 +8072,10 @@
     if (!_PyArg_CheckPositional("set_inheritable", nargs, 2, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(args[0]);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     inheritable = _PyLong_AsInt(args[1]);
     if (inheritable == -1 && PyErr_Occurred()) {
         goto exit;
@@ -8307,11 +8179,6 @@
     int fd;
     int _return_value;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(arg);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
@@ -8355,20 +8222,10 @@
     if (!_PyArg_CheckPositional("set_blocking", nargs, 2, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(args[0]);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     blocking = _PyLong_AsInt(args[1]);
     if (blocking == -1 && PyErr_Occurred()) {
         goto exit;
@@ -8667,14 +8524,9 @@
     if (!args) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[0]);
+        PyObject *iobj = _PyNumber_Index(args[0]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -8687,11 +8539,6 @@
     if (!noptargs) {
         goto skip_optional_pos;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     flags = _PyLong_AsInt(args[1]);
     if (flags == -1 && PyErr_Occurred()) {
         goto exit;
@@ -8913,6 +8760,10 @@
     #define OS__GETVOLUMEPATHNAME_METHODDEF
 #endif /* !defined(OS__GETVOLUMEPATHNAME_METHODDEF) */
 
+#ifndef OS__PATH_SPLITROOT_METHODDEF
+    #define OS__PATH_SPLITROOT_METHODDEF
+#endif /* !defined(OS__PATH_SPLITROOT_METHODDEF) */
+
 #ifndef OS_NICE_METHODDEF
     #define OS_NICE_METHODDEF
 #endif /* !defined(OS_NICE_METHODDEF) */
@@ -9213,6 +9064,10 @@
     #define OS_COPY_FILE_RANGE_METHODDEF
 #endif /* !defined(OS_COPY_FILE_RANGE_METHODDEF) */
 
+#ifndef OS_SPLICE_METHODDEF
+    #define OS_SPLICE_METHODDEF
+#endif /* !defined(OS_SPLICE_METHODDEF) */
+
 #ifndef OS_MKFIFO_METHODDEF
     #define OS_MKFIFO_METHODDEF
 #endif /* !defined(OS_MKFIFO_METHODDEF) */
@@ -9361,6 +9216,18 @@
     #define OS_MEMFD_CREATE_METHODDEF
 #endif /* !defined(OS_MEMFD_CREATE_METHODDEF) */
 
+#ifndef OS_EVENTFD_METHODDEF
+    #define OS_EVENTFD_METHODDEF
+#endif /* !defined(OS_EVENTFD_METHODDEF) */
+
+#ifndef OS_EVENTFD_READ_METHODDEF
+    #define OS_EVENTFD_READ_METHODDEF
+#endif /* !defined(OS_EVENTFD_READ_METHODDEF) */
+
+#ifndef OS_EVENTFD_WRITE_METHODDEF
+    #define OS_EVENTFD_WRITE_METHODDEF
+#endif /* !defined(OS_EVENTFD_WRITE_METHODDEF) */
+
 #ifndef OS_GET_TERMINAL_SIZE_METHODDEF
     #define OS_GET_TERMINAL_SIZE_METHODDEF
 #endif /* !defined(OS_GET_TERMINAL_SIZE_METHODDEF) */
@@ -9396,4 +9263,4 @@
 #ifndef OS_WAITSTATUS_TO_EXITCODE_METHODDEF
     #define OS_WAITSTATUS_TO_EXITCODE_METHODDEF
 #endif /* !defined(OS_WAITSTATUS_TO_EXITCODE_METHODDEF) */
-/*[clinic end generated code: output=005919eaaef3f8e6 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=65a85d7d3f2c487e input=a9049054013a1b77]*/
diff --git a/Modules/clinic/pyexpat.c.h b/Modules/clinic/pyexpat.c.h
index ee5907c..7c56d6a 100644
--- a/Modules/clinic/pyexpat.c.h
+++ b/Modules/clinic/pyexpat.c.h
@@ -11,37 +11,26 @@
 "`isfinal\' should be true at end of input.");
 
 #define PYEXPAT_XMLPARSER_PARSE_METHODDEF    \
-    {"Parse", (PyCFunction)(void(*)(void))pyexpat_xmlparser_Parse, METH_FASTCALL, pyexpat_xmlparser_Parse__doc__},
+    {"Parse", (PyCFunction)(void(*)(void))pyexpat_xmlparser_Parse, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, pyexpat_xmlparser_Parse__doc__},
 
 static PyObject *
-pyexpat_xmlparser_Parse_impl(xmlparseobject *self, PyObject *data,
-                             int isfinal);
+pyexpat_xmlparser_Parse_impl(xmlparseobject *self, PyTypeObject *cls,
+                             PyObject *data, int isfinal);
 
 static PyObject *
-pyexpat_xmlparser_Parse(xmlparseobject *self, PyObject *const *args, Py_ssize_t nargs)
+pyexpat_xmlparser_Parse(xmlparseobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
     PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"", "", NULL};
+    static _PyArg_Parser _parser = {"O|i:Parse", _keywords, 0};
     PyObject *data;
     int isfinal = 0;
 
-    if (!_PyArg_CheckPositional("Parse", nargs, 1, 2)) {
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
+        &data, &isfinal)) {
         goto exit;
     }
-    data = args[0];
-    if (nargs < 2) {
-        goto skip_optional;
-    }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
-    isfinal = _PyLong_AsInt(args[1]);
-    if (isfinal == -1 && PyErr_Occurred()) {
-        goto exit;
-    }
-skip_optional:
-    return_value = pyexpat_xmlparser_Parse_impl(self, data, isfinal);
+    return_value = pyexpat_xmlparser_Parse_impl(self, cls, data, isfinal);
 
 exit:
     return return_value;
@@ -54,7 +43,29 @@
 "Parse XML data from file-like object.");
 
 #define PYEXPAT_XMLPARSER_PARSEFILE_METHODDEF    \
-    {"ParseFile", (PyCFunction)pyexpat_xmlparser_ParseFile, METH_O, pyexpat_xmlparser_ParseFile__doc__},
+    {"ParseFile", (PyCFunction)(void(*)(void))pyexpat_xmlparser_ParseFile, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, pyexpat_xmlparser_ParseFile__doc__},
+
+static PyObject *
+pyexpat_xmlparser_ParseFile_impl(xmlparseobject *self, PyTypeObject *cls,
+                                 PyObject *file);
+
+static PyObject *
+pyexpat_xmlparser_ParseFile(xmlparseobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"", NULL};
+    static _PyArg_Parser _parser = {"O:ParseFile", _keywords, 0};
+    PyObject *file;
+
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
+        &file)) {
+        goto exit;
+    }
+    return_value = pyexpat_xmlparser_ParseFile_impl(self, cls, file);
+
+exit:
+    return return_value;
+}
 
 PyDoc_STRVAR(pyexpat_xmlparser_SetBase__doc__,
 "SetBase($self, base, /)\n"
@@ -140,59 +151,28 @@
 "Create a parser for parsing an external entity based on the information passed to the ExternalEntityRefHandler.");
 
 #define PYEXPAT_XMLPARSER_EXTERNALENTITYPARSERCREATE_METHODDEF    \
-    {"ExternalEntityParserCreate", (PyCFunction)(void(*)(void))pyexpat_xmlparser_ExternalEntityParserCreate, METH_FASTCALL, pyexpat_xmlparser_ExternalEntityParserCreate__doc__},
+    {"ExternalEntityParserCreate", (PyCFunction)(void(*)(void))pyexpat_xmlparser_ExternalEntityParserCreate, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, pyexpat_xmlparser_ExternalEntityParserCreate__doc__},
 
 static PyObject *
 pyexpat_xmlparser_ExternalEntityParserCreate_impl(xmlparseobject *self,
+                                                  PyTypeObject *cls,
                                                   const char *context,
                                                   const char *encoding);
 
 static PyObject *
-pyexpat_xmlparser_ExternalEntityParserCreate(xmlparseobject *self, PyObject *const *args, Py_ssize_t nargs)
+pyexpat_xmlparser_ExternalEntityParserCreate(xmlparseobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
     PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"", "", NULL};
+    static _PyArg_Parser _parser = {"z|s:ExternalEntityParserCreate", _keywords, 0};
     const char *context;
     const char *encoding = NULL;
 
-    if (!_PyArg_CheckPositional("ExternalEntityParserCreate", nargs, 1, 2)) {
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
+        &context, &encoding)) {
         goto exit;
     }
-    if (args[0] == Py_None) {
-        context = NULL;
-    }
-    else if (PyUnicode_Check(args[0])) {
-        Py_ssize_t context_length;
-        context = PyUnicode_AsUTF8AndSize(args[0], &context_length);
-        if (context == NULL) {
-            goto exit;
-        }
-        if (strlen(context) != (size_t)context_length) {
-            PyErr_SetString(PyExc_ValueError, "embedded null character");
-            goto exit;
-        }
-    }
-    else {
-        _PyArg_BadArgument("ExternalEntityParserCreate", "argument 1", "str or None", args[0]);
-        goto exit;
-    }
-    if (nargs < 2) {
-        goto skip_optional;
-    }
-    if (!PyUnicode_Check(args[1])) {
-        _PyArg_BadArgument("ExternalEntityParserCreate", "argument 2", "str", args[1]);
-        goto exit;
-    }
-    Py_ssize_t encoding_length;
-    encoding = PyUnicode_AsUTF8AndSize(args[1], &encoding_length);
-    if (encoding == NULL) {
-        goto exit;
-    }
-    if (strlen(encoding) != (size_t)encoding_length) {
-        PyErr_SetString(PyExc_ValueError, "embedded null character");
-        goto exit;
-    }
-skip_optional:
-    return_value = pyexpat_xmlparser_ExternalEntityParserCreate_impl(self, context, encoding);
+    return_value = pyexpat_xmlparser_ExternalEntityParserCreate_impl(self, cls, context, encoding);
 
 exit:
     return return_value;
@@ -221,11 +201,6 @@
     PyObject *return_value = NULL;
     int flag;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     flag = _PyLong_AsInt(arg);
     if (flag == -1 && PyErr_Occurred()) {
         goto exit;
@@ -249,29 +224,25 @@
 "information to the parser. \'flag\' defaults to True if not provided.");
 
 #define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF    \
-    {"UseForeignDTD", (PyCFunction)(void(*)(void))pyexpat_xmlparser_UseForeignDTD, METH_FASTCALL, pyexpat_xmlparser_UseForeignDTD__doc__},
+    {"UseForeignDTD", (PyCFunction)(void(*)(void))pyexpat_xmlparser_UseForeignDTD, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, pyexpat_xmlparser_UseForeignDTD__doc__},
 
 static PyObject *
-pyexpat_xmlparser_UseForeignDTD_impl(xmlparseobject *self, int flag);
+pyexpat_xmlparser_UseForeignDTD_impl(xmlparseobject *self, PyTypeObject *cls,
+                                     int flag);
 
 static PyObject *
-pyexpat_xmlparser_UseForeignDTD(xmlparseobject *self, PyObject *const *args, Py_ssize_t nargs)
+pyexpat_xmlparser_UseForeignDTD(xmlparseobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
     PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"", NULL};
+    static _PyArg_Parser _parser = {"|p:UseForeignDTD", _keywords, 0};
     int flag = 1;
 
-    if (!_PyArg_CheckPositional("UseForeignDTD", nargs, 0, 1)) {
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
+        &flag)) {
         goto exit;
     }
-    if (nargs < 1) {
-        goto skip_optional;
-    }
-    flag = PyObject_IsTrue(args[0]);
-    if (flag < 0) {
-        goto exit;
-    }
-skip_optional:
-    return_value = pyexpat_xmlparser_UseForeignDTD_impl(self, flag);
+    return_value = pyexpat_xmlparser_UseForeignDTD_impl(self, cls, flag);
 
 exit:
     return return_value;
@@ -384,11 +355,6 @@
     PyObject *return_value = NULL;
     long code;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     code = PyLong_AsLong(arg);
     if (code == -1 && PyErr_Occurred()) {
         goto exit;
@@ -402,4 +368,4 @@
 #ifndef PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
     #define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
 #endif /* !defined(PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF) */
-/*[clinic end generated code: output=68ce25024280af41 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=612b9d6a17a679a7 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/readline.c.h b/Modules/clinic/readline.c.h
new file mode 100644
index 0000000..d1ee808
--- /dev/null
+++ b/Modules/clinic/readline.c.h
@@ -0,0 +1,688 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(readline_parse_and_bind__doc__,
+"parse_and_bind($module, string, /)\n"
+"--\n"
+"\n"
+"Execute the init line provided in the string argument.");
+
+#define READLINE_PARSE_AND_BIND_METHODDEF    \
+    {"parse_and_bind", (PyCFunction)readline_parse_and_bind, METH_O, readline_parse_and_bind__doc__},
+
+PyDoc_STRVAR(readline_read_init_file__doc__,
+"read_init_file($module, filename=None, /)\n"
+"--\n"
+"\n"
+"Execute a readline initialization file.\n"
+"\n"
+"The default filename is the last filename used.");
+
+#define READLINE_READ_INIT_FILE_METHODDEF    \
+    {"read_init_file", (PyCFunction)(void(*)(void))readline_read_init_file, METH_FASTCALL, readline_read_init_file__doc__},
+
+static PyObject *
+readline_read_init_file_impl(PyObject *module, PyObject *filename_obj);
+
+static PyObject *
+readline_read_init_file(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    PyObject *filename_obj = Py_None;
+
+    if (!_PyArg_CheckPositional("read_init_file", nargs, 0, 1)) {
+        goto exit;
+    }
+    if (nargs < 1) {
+        goto skip_optional;
+    }
+    filename_obj = args[0];
+skip_optional:
+    return_value = readline_read_init_file_impl(module, filename_obj);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(readline_read_history_file__doc__,
+"read_history_file($module, filename=None, /)\n"
+"--\n"
+"\n"
+"Load a readline history file.\n"
+"\n"
+"The default filename is ~/.history.");
+
+#define READLINE_READ_HISTORY_FILE_METHODDEF    \
+    {"read_history_file", (PyCFunction)(void(*)(void))readline_read_history_file, METH_FASTCALL, readline_read_history_file__doc__},
+
+static PyObject *
+readline_read_history_file_impl(PyObject *module, PyObject *filename_obj);
+
+static PyObject *
+readline_read_history_file(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    PyObject *filename_obj = Py_None;
+
+    if (!_PyArg_CheckPositional("read_history_file", nargs, 0, 1)) {
+        goto exit;
+    }
+    if (nargs < 1) {
+        goto skip_optional;
+    }
+    filename_obj = args[0];
+skip_optional:
+    return_value = readline_read_history_file_impl(module, filename_obj);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(readline_write_history_file__doc__,
+"write_history_file($module, filename=None, /)\n"
+"--\n"
+"\n"
+"Save a readline history file.\n"
+"\n"
+"The default filename is ~/.history.");
+
+#define READLINE_WRITE_HISTORY_FILE_METHODDEF    \
+    {"write_history_file", (PyCFunction)(void(*)(void))readline_write_history_file, METH_FASTCALL, readline_write_history_file__doc__},
+
+static PyObject *
+readline_write_history_file_impl(PyObject *module, PyObject *filename_obj);
+
+static PyObject *
+readline_write_history_file(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    PyObject *filename_obj = Py_None;
+
+    if (!_PyArg_CheckPositional("write_history_file", nargs, 0, 1)) {
+        goto exit;
+    }
+    if (nargs < 1) {
+        goto skip_optional;
+    }
+    filename_obj = args[0];
+skip_optional:
+    return_value = readline_write_history_file_impl(module, filename_obj);
+
+exit:
+    return return_value;
+}
+
+#if defined(HAVE_RL_APPEND_HISTORY)
+
+PyDoc_STRVAR(readline_append_history_file__doc__,
+"append_history_file($module, nelements, filename=None, /)\n"
+"--\n"
+"\n"
+"Append the last nelements items of the history list to file.\n"
+"\n"
+"The default filename is ~/.history.");
+
+#define READLINE_APPEND_HISTORY_FILE_METHODDEF    \
+    {"append_history_file", (PyCFunction)(void(*)(void))readline_append_history_file, METH_FASTCALL, readline_append_history_file__doc__},
+
+static PyObject *
+readline_append_history_file_impl(PyObject *module, int nelements,
+                                  PyObject *filename_obj);
+
+static PyObject *
+readline_append_history_file(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    int nelements;
+    PyObject *filename_obj = Py_None;
+
+    if (!_PyArg_CheckPositional("append_history_file", nargs, 1, 2)) {
+        goto exit;
+    }
+    nelements = _PyLong_AsInt(args[0]);
+    if (nelements == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    if (nargs < 2) {
+        goto skip_optional;
+    }
+    filename_obj = args[1];
+skip_optional:
+    return_value = readline_append_history_file_impl(module, nelements, filename_obj);
+
+exit:
+    return return_value;
+}
+
+#endif /* defined(HAVE_RL_APPEND_HISTORY) */
+
+PyDoc_STRVAR(readline_set_history_length__doc__,
+"set_history_length($module, length, /)\n"
+"--\n"
+"\n"
+"Set the maximal number of lines which will be written to the history file.\n"
+"\n"
+"A negative length is used to inhibit history truncation.");
+
+#define READLINE_SET_HISTORY_LENGTH_METHODDEF    \
+    {"set_history_length", (PyCFunction)readline_set_history_length, METH_O, readline_set_history_length__doc__},
+
+static PyObject *
+readline_set_history_length_impl(PyObject *module, int length);
+
+static PyObject *
+readline_set_history_length(PyObject *module, PyObject *arg)
+{
+    PyObject *return_value = NULL;
+    int length;
+
+    length = _PyLong_AsInt(arg);
+    if (length == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    return_value = readline_set_history_length_impl(module, length);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(readline_get_history_length__doc__,
+"get_history_length($module, /)\n"
+"--\n"
+"\n"
+"Return the maximum number of lines that will be written to the history file.");
+
+#define READLINE_GET_HISTORY_LENGTH_METHODDEF    \
+    {"get_history_length", (PyCFunction)readline_get_history_length, METH_NOARGS, readline_get_history_length__doc__},
+
+static PyObject *
+readline_get_history_length_impl(PyObject *module);
+
+static PyObject *
+readline_get_history_length(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+    return readline_get_history_length_impl(module);
+}
+
+PyDoc_STRVAR(readline_set_completion_display_matches_hook__doc__,
+"set_completion_display_matches_hook($module, function=None, /)\n"
+"--\n"
+"\n"
+"Set or remove the completion display function.\n"
+"\n"
+"The function is called as\n"
+"  function(substitution, [matches], longest_match_length)\n"
+"once each time matches need to be displayed.");
+
+#define READLINE_SET_COMPLETION_DISPLAY_MATCHES_HOOK_METHODDEF    \
+    {"set_completion_display_matches_hook", (PyCFunction)(void(*)(void))readline_set_completion_display_matches_hook, METH_FASTCALL, readline_set_completion_display_matches_hook__doc__},
+
+static PyObject *
+readline_set_completion_display_matches_hook_impl(PyObject *module,
+                                                  PyObject *function);
+
+static PyObject *
+readline_set_completion_display_matches_hook(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    PyObject *function = Py_None;
+
+    if (!_PyArg_CheckPositional("set_completion_display_matches_hook", nargs, 0, 1)) {
+        goto exit;
+    }
+    if (nargs < 1) {
+        goto skip_optional;
+    }
+    function = args[0];
+skip_optional:
+    return_value = readline_set_completion_display_matches_hook_impl(module, function);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(readline_set_startup_hook__doc__,
+"set_startup_hook($module, function=None, /)\n"
+"--\n"
+"\n"
+"Set or remove the function invoked by the rl_startup_hook callback.\n"
+"\n"
+"The function is called with no arguments just\n"
+"before readline prints the first prompt.");
+
+#define READLINE_SET_STARTUP_HOOK_METHODDEF    \
+    {"set_startup_hook", (PyCFunction)(void(*)(void))readline_set_startup_hook, METH_FASTCALL, readline_set_startup_hook__doc__},
+
+static PyObject *
+readline_set_startup_hook_impl(PyObject *module, PyObject *function);
+
+static PyObject *
+readline_set_startup_hook(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    PyObject *function = Py_None;
+
+    if (!_PyArg_CheckPositional("set_startup_hook", nargs, 0, 1)) {
+        goto exit;
+    }
+    if (nargs < 1) {
+        goto skip_optional;
+    }
+    function = args[0];
+skip_optional:
+    return_value = readline_set_startup_hook_impl(module, function);
+
+exit:
+    return return_value;
+}
+
+#if defined(HAVE_RL_PRE_INPUT_HOOK)
+
+PyDoc_STRVAR(readline_set_pre_input_hook__doc__,
+"set_pre_input_hook($module, function=None, /)\n"
+"--\n"
+"\n"
+"Set or remove the function invoked by the rl_pre_input_hook callback.\n"
+"\n"
+"The function is called with no arguments after the first prompt\n"
+"has been printed and just before readline starts reading input\n"
+"characters.");
+
+#define READLINE_SET_PRE_INPUT_HOOK_METHODDEF    \
+    {"set_pre_input_hook", (PyCFunction)(void(*)(void))readline_set_pre_input_hook, METH_FASTCALL, readline_set_pre_input_hook__doc__},
+
+static PyObject *
+readline_set_pre_input_hook_impl(PyObject *module, PyObject *function);
+
+static PyObject *
+readline_set_pre_input_hook(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    PyObject *function = Py_None;
+
+    if (!_PyArg_CheckPositional("set_pre_input_hook", nargs, 0, 1)) {
+        goto exit;
+    }
+    if (nargs < 1) {
+        goto skip_optional;
+    }
+    function = args[0];
+skip_optional:
+    return_value = readline_set_pre_input_hook_impl(module, function);
+
+exit:
+    return return_value;
+}
+
+#endif /* defined(HAVE_RL_PRE_INPUT_HOOK) */
+
+PyDoc_STRVAR(readline_get_completion_type__doc__,
+"get_completion_type($module, /)\n"
+"--\n"
+"\n"
+"Get the type of completion being attempted.");
+
+#define READLINE_GET_COMPLETION_TYPE_METHODDEF    \
+    {"get_completion_type", (PyCFunction)readline_get_completion_type, METH_NOARGS, readline_get_completion_type__doc__},
+
+static PyObject *
+readline_get_completion_type_impl(PyObject *module);
+
+static PyObject *
+readline_get_completion_type(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+    return readline_get_completion_type_impl(module);
+}
+
+PyDoc_STRVAR(readline_get_begidx__doc__,
+"get_begidx($module, /)\n"
+"--\n"
+"\n"
+"Get the beginning index of the completion scope.");
+
+#define READLINE_GET_BEGIDX_METHODDEF    \
+    {"get_begidx", (PyCFunction)readline_get_begidx, METH_NOARGS, readline_get_begidx__doc__},
+
+static PyObject *
+readline_get_begidx_impl(PyObject *module);
+
+static PyObject *
+readline_get_begidx(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+    return readline_get_begidx_impl(module);
+}
+
+PyDoc_STRVAR(readline_get_endidx__doc__,
+"get_endidx($module, /)\n"
+"--\n"
+"\n"
+"Get the ending index of the completion scope.");
+
+#define READLINE_GET_ENDIDX_METHODDEF    \
+    {"get_endidx", (PyCFunction)readline_get_endidx, METH_NOARGS, readline_get_endidx__doc__},
+
+static PyObject *
+readline_get_endidx_impl(PyObject *module);
+
+static PyObject *
+readline_get_endidx(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+    return readline_get_endidx_impl(module);
+}
+
+PyDoc_STRVAR(readline_set_completer_delims__doc__,
+"set_completer_delims($module, string, /)\n"
+"--\n"
+"\n"
+"Set the word delimiters for completion.");
+
+#define READLINE_SET_COMPLETER_DELIMS_METHODDEF    \
+    {"set_completer_delims", (PyCFunction)readline_set_completer_delims, METH_O, readline_set_completer_delims__doc__},
+
+PyDoc_STRVAR(readline_remove_history_item__doc__,
+"remove_history_item($module, pos, /)\n"
+"--\n"
+"\n"
+"Remove history item given by its zero-based position.");
+
+#define READLINE_REMOVE_HISTORY_ITEM_METHODDEF    \
+    {"remove_history_item", (PyCFunction)readline_remove_history_item, METH_O, readline_remove_history_item__doc__},
+
+static PyObject *
+readline_remove_history_item_impl(PyObject *module, int entry_number);
+
+static PyObject *
+readline_remove_history_item(PyObject *module, PyObject *arg)
+{
+    PyObject *return_value = NULL;
+    int entry_number;
+
+    entry_number = _PyLong_AsInt(arg);
+    if (entry_number == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    return_value = readline_remove_history_item_impl(module, entry_number);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(readline_replace_history_item__doc__,
+"replace_history_item($module, pos, line, /)\n"
+"--\n"
+"\n"
+"Replaces history item given by its position with contents of line.\n"
+"\n"
+"pos is zero-based.");
+
+#define READLINE_REPLACE_HISTORY_ITEM_METHODDEF    \
+    {"replace_history_item", (PyCFunction)(void(*)(void))readline_replace_history_item, METH_FASTCALL, readline_replace_history_item__doc__},
+
+static PyObject *
+readline_replace_history_item_impl(PyObject *module, int entry_number,
+                                   PyObject *line);
+
+static PyObject *
+readline_replace_history_item(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    int entry_number;
+    PyObject *line;
+
+    if (!_PyArg_CheckPositional("replace_history_item", nargs, 2, 2)) {
+        goto exit;
+    }
+    entry_number = _PyLong_AsInt(args[0]);
+    if (entry_number == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    if (!PyUnicode_Check(args[1])) {
+        _PyArg_BadArgument("replace_history_item", "argument 2", "str", args[1]);
+        goto exit;
+    }
+    if (PyUnicode_READY(args[1]) == -1) {
+        goto exit;
+    }
+    line = args[1];
+    return_value = readline_replace_history_item_impl(module, entry_number, line);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(readline_add_history__doc__,
+"add_history($module, string, /)\n"
+"--\n"
+"\n"
+"Add an item to the history buffer.");
+
+#define READLINE_ADD_HISTORY_METHODDEF    \
+    {"add_history", (PyCFunction)readline_add_history, METH_O, readline_add_history__doc__},
+
+PyDoc_STRVAR(readline_set_auto_history__doc__,
+"set_auto_history($module, enabled, /)\n"
+"--\n"
+"\n"
+"Enables or disables automatic history.");
+
+#define READLINE_SET_AUTO_HISTORY_METHODDEF    \
+    {"set_auto_history", (PyCFunction)readline_set_auto_history, METH_O, readline_set_auto_history__doc__},
+
+static PyObject *
+readline_set_auto_history_impl(PyObject *module,
+                               int _should_auto_add_history);
+
+static PyObject *
+readline_set_auto_history(PyObject *module, PyObject *arg)
+{
+    PyObject *return_value = NULL;
+    int _should_auto_add_history;
+
+    _should_auto_add_history = PyObject_IsTrue(arg);
+    if (_should_auto_add_history < 0) {
+        goto exit;
+    }
+    return_value = readline_set_auto_history_impl(module, _should_auto_add_history);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(readline_get_completer_delims__doc__,
+"get_completer_delims($module, /)\n"
+"--\n"
+"\n"
+"Get the word delimiters for completion.");
+
+#define READLINE_GET_COMPLETER_DELIMS_METHODDEF    \
+    {"get_completer_delims", (PyCFunction)readline_get_completer_delims, METH_NOARGS, readline_get_completer_delims__doc__},
+
+static PyObject *
+readline_get_completer_delims_impl(PyObject *module);
+
+static PyObject *
+readline_get_completer_delims(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+    return readline_get_completer_delims_impl(module);
+}
+
+PyDoc_STRVAR(readline_set_completer__doc__,
+"set_completer($module, function=None, /)\n"
+"--\n"
+"\n"
+"Set or remove the completer function.\n"
+"\n"
+"The function is called as function(text, state),\n"
+"for state in 0, 1, 2, ..., until it returns a non-string.\n"
+"It should return the next possible completion starting with \'text\'.");
+
+#define READLINE_SET_COMPLETER_METHODDEF    \
+    {"set_completer", (PyCFunction)(void(*)(void))readline_set_completer, METH_FASTCALL, readline_set_completer__doc__},
+
+static PyObject *
+readline_set_completer_impl(PyObject *module, PyObject *function);
+
+static PyObject *
+readline_set_completer(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    PyObject *function = Py_None;
+
+    if (!_PyArg_CheckPositional("set_completer", nargs, 0, 1)) {
+        goto exit;
+    }
+    if (nargs < 1) {
+        goto skip_optional;
+    }
+    function = args[0];
+skip_optional:
+    return_value = readline_set_completer_impl(module, function);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(readline_get_completer__doc__,
+"get_completer($module, /)\n"
+"--\n"
+"\n"
+"Get the current completer function.");
+
+#define READLINE_GET_COMPLETER_METHODDEF    \
+    {"get_completer", (PyCFunction)readline_get_completer, METH_NOARGS, readline_get_completer__doc__},
+
+static PyObject *
+readline_get_completer_impl(PyObject *module);
+
+static PyObject *
+readline_get_completer(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+    return readline_get_completer_impl(module);
+}
+
+PyDoc_STRVAR(readline_get_history_item__doc__,
+"get_history_item($module, index, /)\n"
+"--\n"
+"\n"
+"Return the current contents of history item at one-based index.");
+
+#define READLINE_GET_HISTORY_ITEM_METHODDEF    \
+    {"get_history_item", (PyCFunction)readline_get_history_item, METH_O, readline_get_history_item__doc__},
+
+static PyObject *
+readline_get_history_item_impl(PyObject *module, int idx);
+
+static PyObject *
+readline_get_history_item(PyObject *module, PyObject *arg)
+{
+    PyObject *return_value = NULL;
+    int idx;
+
+    idx = _PyLong_AsInt(arg);
+    if (idx == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    return_value = readline_get_history_item_impl(module, idx);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(readline_get_current_history_length__doc__,
+"get_current_history_length($module, /)\n"
+"--\n"
+"\n"
+"Return the current (not the maximum) length of history.");
+
+#define READLINE_GET_CURRENT_HISTORY_LENGTH_METHODDEF    \
+    {"get_current_history_length", (PyCFunction)readline_get_current_history_length, METH_NOARGS, readline_get_current_history_length__doc__},
+
+static PyObject *
+readline_get_current_history_length_impl(PyObject *module);
+
+static PyObject *
+readline_get_current_history_length(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+    return readline_get_current_history_length_impl(module);
+}
+
+PyDoc_STRVAR(readline_get_line_buffer__doc__,
+"get_line_buffer($module, /)\n"
+"--\n"
+"\n"
+"Return the current contents of the line buffer.");
+
+#define READLINE_GET_LINE_BUFFER_METHODDEF    \
+    {"get_line_buffer", (PyCFunction)readline_get_line_buffer, METH_NOARGS, readline_get_line_buffer__doc__},
+
+static PyObject *
+readline_get_line_buffer_impl(PyObject *module);
+
+static PyObject *
+readline_get_line_buffer(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+    return readline_get_line_buffer_impl(module);
+}
+
+#if defined(HAVE_RL_COMPLETION_APPEND_CHARACTER)
+
+PyDoc_STRVAR(readline_clear_history__doc__,
+"clear_history($module, /)\n"
+"--\n"
+"\n"
+"Clear the current readline history.");
+
+#define READLINE_CLEAR_HISTORY_METHODDEF    \
+    {"clear_history", (PyCFunction)readline_clear_history, METH_NOARGS, readline_clear_history__doc__},
+
+static PyObject *
+readline_clear_history_impl(PyObject *module);
+
+static PyObject *
+readline_clear_history(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+    return readline_clear_history_impl(module);
+}
+
+#endif /* defined(HAVE_RL_COMPLETION_APPEND_CHARACTER) */
+
+PyDoc_STRVAR(readline_insert_text__doc__,
+"insert_text($module, string, /)\n"
+"--\n"
+"\n"
+"Insert text into the line buffer at the cursor position.");
+
+#define READLINE_INSERT_TEXT_METHODDEF    \
+    {"insert_text", (PyCFunction)readline_insert_text, METH_O, readline_insert_text__doc__},
+
+PyDoc_STRVAR(readline_redisplay__doc__,
+"redisplay($module, /)\n"
+"--\n"
+"\n"
+"Change what\'s displayed on the screen to reflect contents of the line buffer.");
+
+#define READLINE_REDISPLAY_METHODDEF    \
+    {"redisplay", (PyCFunction)readline_redisplay, METH_NOARGS, readline_redisplay__doc__},
+
+static PyObject *
+readline_redisplay_impl(PyObject *module);
+
+static PyObject *
+readline_redisplay(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+    return readline_redisplay_impl(module);
+}
+
+#ifndef READLINE_APPEND_HISTORY_FILE_METHODDEF
+    #define READLINE_APPEND_HISTORY_FILE_METHODDEF
+#endif /* !defined(READLINE_APPEND_HISTORY_FILE_METHODDEF) */
+
+#ifndef READLINE_SET_PRE_INPUT_HOOK_METHODDEF
+    #define READLINE_SET_PRE_INPUT_HOOK_METHODDEF
+#endif /* !defined(READLINE_SET_PRE_INPUT_HOOK_METHODDEF) */
+
+#ifndef READLINE_CLEAR_HISTORY_METHODDEF
+    #define READLINE_CLEAR_HISTORY_METHODDEF
+#endif /* !defined(READLINE_CLEAR_HISTORY_METHODDEF) */
+/*[clinic end generated code: output=f7d390113b27989f input=a9049054013a1b77]*/
diff --git a/Modules/clinic/resource.c.h b/Modules/clinic/resource.c.h
index 80efb71..32c092a 100644
--- a/Modules/clinic/resource.c.h
+++ b/Modules/clinic/resource.c.h
@@ -19,11 +19,6 @@
     PyObject *return_value = NULL;
     int who;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     who = _PyLong_AsInt(arg);
     if (who == -1 && PyErr_Occurred()) {
         goto exit;
@@ -51,11 +46,6 @@
     PyObject *return_value = NULL;
     int resource;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     resource = _PyLong_AsInt(arg);
     if (resource == -1 && PyErr_Occurred()) {
         goto exit;
@@ -87,11 +77,6 @@
     if (!_PyArg_CheckPositional("setrlimit", nargs, 2, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     resource = _PyLong_AsInt(args[0]);
     if (resource == -1 && PyErr_Occurred()) {
         goto exit;
@@ -178,4 +163,4 @@
 #ifndef RESOURCE_PRLIMIT_METHODDEF
     #define RESOURCE_PRLIMIT_METHODDEF
 #endif /* !defined(RESOURCE_PRLIMIT_METHODDEF) */
-/*[clinic end generated code: output=ef3034f291156a34 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=ad190fb33d647d1e input=a9049054013a1b77]*/
diff --git a/Modules/clinic/selectmodule.c.h b/Modules/clinic/selectmodule.c.h
index c1072e6..be752e9 100644
--- a/Modules/clinic/selectmodule.c.h
+++ b/Modules/clinic/selectmodule.c.h
@@ -92,7 +92,7 @@
     if (!_PyArg_CheckPositional("register", nargs, 1, 2)) {
         goto exit;
     }
-    if (!fildes_converter(args[0], &fd)) {
+    if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
         goto exit;
     }
     if (nargs < 2) {
@@ -140,7 +140,7 @@
     if (!_PyArg_CheckPositional("modify", nargs, 2, 2)) {
         goto exit;
     }
-    if (!fildes_converter(args[0], &fd)) {
+    if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
         goto exit;
     }
     if (!_PyLong_UnsignedShort_Converter(args[1], &eventmask)) {
@@ -174,7 +174,7 @@
     PyObject *return_value = NULL;
     int fd;
 
-    if (!fildes_converter(arg, &fd)) {
+    if (!_PyLong_FileDescriptor_Converter(arg, &fd)) {
         goto exit;
     }
     return_value = select_poll_unregister_impl(self, fd);
@@ -193,6 +193,10 @@
 "\n"
 "Polls the set of registered file descriptors.\n"
 "\n"
+"  timeout\n"
+"    The maximum time to wait in milliseconds, or else None (or a negative\n"
+"    value) to wait indefinitely.\n"
+"\n"
 "Returns a list containing any descriptors that have events or errors to\n"
 "report, as a list of (fd, event) 2-tuples.");
 
@@ -256,7 +260,7 @@
     if (!_PyArg_CheckPositional("register", nargs, 1, 2)) {
         goto exit;
     }
-    if (!fildes_converter(args[0], &fd)) {
+    if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
         goto exit;
     }
     if (nargs < 2) {
@@ -306,7 +310,7 @@
     if (!_PyArg_CheckPositional("modify", nargs, 1, 2)) {
         goto exit;
     }
-    if (!fildes_converter(args[0], &fd)) {
+    if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
         goto exit;
     }
     if (nargs < 2) {
@@ -344,7 +348,7 @@
     PyObject *return_value = NULL;
     int fd;
 
-    if (!fildes_converter(arg, &fd)) {
+    if (!_PyLong_FileDescriptor_Converter(arg, &fd)) {
         goto exit;
     }
     return_value = select_devpoll_unregister_impl(self, fd);
@@ -363,6 +367,10 @@
 "\n"
 "Polls the set of registered file descriptors.\n"
 "\n"
+"  timeout\n"
+"    The maximum time to wait in milliseconds, or else None (or a negative\n"
+"    value) to wait indefinitely.\n"
+"\n"
 "Returns a list containing any descriptors that have events or errors to\n"
 "report, as a list of (fd, event) 2-tuples.");
 
@@ -531,11 +539,6 @@
         goto skip_optional_pos;
     }
     if (fastargs[0]) {
-        if (PyFloat_Check(fastargs[0])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         sizehint = _PyLong_AsInt(fastargs[0]);
         if (sizehint == -1 && PyErr_Occurred()) {
             goto exit;
@@ -544,11 +547,6 @@
             goto skip_optional_pos;
         }
     }
-    if (PyFloat_Check(fastargs[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     flags = _PyLong_AsInt(fastargs[1]);
     if (flags == -1 && PyErr_Occurred()) {
         goto exit;
@@ -628,11 +626,6 @@
     PyObject *return_value = NULL;
     int fd;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(arg);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
@@ -683,17 +676,12 @@
     if (!args) {
         goto exit;
     }
-    if (!fildes_converter(args[0], &fd)) {
+    if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
         goto exit;
     }
     if (!noptargs) {
         goto skip_optional_pos;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     eventmask = (unsigned int)PyLong_AsUnsignedLongMask(args[1]);
     if (eventmask == (unsigned int)-1 && PyErr_Occurred()) {
         goto exit;
@@ -741,12 +729,7 @@
     if (!args) {
         goto exit;
     }
-    if (!fildes_converter(args[0], &fd)) {
-        goto exit;
-    }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
+    if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
         goto exit;
     }
     eventmask = (unsigned int)PyLong_AsUnsignedLongMask(args[1]);
@@ -791,7 +774,7 @@
     if (!args) {
         goto exit;
     }
-    if (!fildes_converter(args[0], &fd)) {
+    if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
         goto exit;
     }
     return_value = select_epoll_unregister_impl(self, fd);
@@ -850,11 +833,6 @@
             goto skip_optional_pos;
         }
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     maxevents = _PyLong_AsInt(args[1]);
     if (maxevents == -1 && PyErr_Occurred()) {
         goto exit;
@@ -963,11 +941,11 @@
 {
     PyObject *return_value = NULL;
 
-    if ((type == _selectstate_global->kqueue_queue_Type) &&
+    if ((type == _selectstate_by_type(type)->kqueue_queue_Type) &&
         !_PyArg_NoPositional("kqueue", args)) {
         goto exit;
     }
-    if ((type == _selectstate_global->kqueue_queue_Type) &&
+    if ((type == _selectstate_by_type(type)->kqueue_queue_Type) &&
         !_PyArg_NoKeywords("kqueue", kwargs)) {
         goto exit;
     }
@@ -1045,11 +1023,6 @@
     PyObject *return_value = NULL;
     int fd;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(arg);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1098,11 +1071,6 @@
         goto exit;
     }
     changelist = args[0];
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     maxevents = _PyLong_AsInt(args[1]);
     if (maxevents == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1219,4 +1187,4 @@
 #ifndef SELECT_KQUEUE_CONTROL_METHODDEF
     #define SELECT_KQUEUE_CONTROL_METHODDEF
 #endif /* !defined(SELECT_KQUEUE_CONTROL_METHODDEF) */
-/*[clinic end generated code: output=ef42c3485a8fe3a0 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=a8fc031269d28454 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/sha1module.c.h b/Modules/clinic/sha1module.c.h
index fc37b1a..3a3ab58 100644
--- a/Modules/clinic/sha1module.c.h
+++ b/Modules/clinic/sha1module.c.h
@@ -9,15 +9,26 @@
 "Return a copy of the hash object.");
 
 #define SHA1TYPE_COPY_METHODDEF    \
-    {"copy", (PyCFunction)SHA1Type_copy, METH_NOARGS, SHA1Type_copy__doc__},
+    {"copy", (PyCFunction)(void(*)(void))SHA1Type_copy, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, SHA1Type_copy__doc__},
 
 static PyObject *
-SHA1Type_copy_impl(SHA1object *self);
+SHA1Type_copy_impl(SHA1object *self, PyTypeObject *cls);
 
 static PyObject *
-SHA1Type_copy(SHA1object *self, PyObject *Py_UNUSED(ignored))
+SHA1Type_copy(SHA1object *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
-    return SHA1Type_copy_impl(self);
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = { NULL};
+    static _PyArg_Parser _parser = {":copy", _keywords, 0};
+
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser
+        )) {
+        goto exit;
+    }
+    return_value = SHA1Type_copy_impl(self, cls);
+
+exit:
+    return return_value;
 }
 
 PyDoc_STRVAR(SHA1Type_digest__doc__,
@@ -115,4 +126,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=3ddd637ae17e14b3 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=abf1ab2545cea5a2 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/sha256module.c.h b/Modules/clinic/sha256module.c.h
index 2a788ea..89205c4 100644
--- a/Modules/clinic/sha256module.c.h
+++ b/Modules/clinic/sha256module.c.h
@@ -9,15 +9,26 @@
 "Return a copy of the hash object.");
 
 #define SHA256TYPE_COPY_METHODDEF    \
-    {"copy", (PyCFunction)SHA256Type_copy, METH_NOARGS, SHA256Type_copy__doc__},
+    {"copy", (PyCFunction)(void(*)(void))SHA256Type_copy, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, SHA256Type_copy__doc__},
 
 static PyObject *
-SHA256Type_copy_impl(SHAobject *self);
+SHA256Type_copy_impl(SHAobject *self, PyTypeObject *cls);
 
 static PyObject *
-SHA256Type_copy(SHAobject *self, PyObject *Py_UNUSED(ignored))
+SHA256Type_copy(SHAobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
-    return SHA256Type_copy_impl(self);
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = { NULL};
+    static _PyArg_Parser _parser = {":copy", _keywords, 0};
+
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser
+        )) {
+        goto exit;
+    }
+    return_value = SHA256Type_copy_impl(self, cls);
+
+exit:
+    return return_value;
 }
 
 PyDoc_STRVAR(SHA256Type_digest__doc__,
@@ -166,4 +177,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=c8cca8adbe72ec9a input=a9049054013a1b77]*/
+/*[clinic end generated code: output=b7283f75c9d08f30 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/sha512module.c.h b/Modules/clinic/sha512module.c.h
index b8185b6..f1192d7 100644
--- a/Modules/clinic/sha512module.c.h
+++ b/Modules/clinic/sha512module.c.h
@@ -9,15 +9,26 @@
 "Return a copy of the hash object.");
 
 #define SHA512TYPE_COPY_METHODDEF    \
-    {"copy", (PyCFunction)SHA512Type_copy, METH_NOARGS, SHA512Type_copy__doc__},
+    {"copy", (PyCFunction)(void(*)(void))SHA512Type_copy, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, SHA512Type_copy__doc__},
 
 static PyObject *
-SHA512Type_copy_impl(SHAobject *self);
+SHA512Type_copy_impl(SHAobject *self, PyTypeObject *cls);
 
 static PyObject *
-SHA512Type_copy(SHAobject *self, PyObject *Py_UNUSED(ignored))
+SHA512Type_copy(SHAobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
-    return SHA512Type_copy_impl(self);
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = { NULL};
+    static _PyArg_Parser _parser = {":copy", _keywords, 0};
+
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser
+        )) {
+        goto exit;
+    }
+    return_value = SHA512Type_copy_impl(self, cls);
+
+exit:
+    return return_value;
 }
 
 PyDoc_STRVAR(SHA512Type_digest__doc__,
@@ -166,4 +177,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=bbfa72d8703c82b5 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=9ff9f11937fabf35 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/signalmodule.c.h b/Modules/clinic/signalmodule.c.h
index 7f60e28..4c27314 100644
--- a/Modules/clinic/signalmodule.c.h
+++ b/Modules/clinic/signalmodule.c.h
@@ -2,6 +2,42 @@
 preserve
 [clinic start generated code]*/
 
+PyDoc_STRVAR(signal_default_int_handler__doc__,
+"default_int_handler($module, signalnum, frame, /)\n"
+"--\n"
+"\n"
+"The default handler for SIGINT installed by Python.\n"
+"\n"
+"It raises KeyboardInterrupt.");
+
+#define SIGNAL_DEFAULT_INT_HANDLER_METHODDEF    \
+    {"default_int_handler", (PyCFunction)(void(*)(void))signal_default_int_handler, METH_FASTCALL, signal_default_int_handler__doc__},
+
+static PyObject *
+signal_default_int_handler_impl(PyObject *module, int signalnum,
+                                PyObject *frame);
+
+static PyObject *
+signal_default_int_handler(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    int signalnum;
+    PyObject *frame;
+
+    if (!_PyArg_CheckPositional("default_int_handler", nargs, 2, 2)) {
+        goto exit;
+    }
+    signalnum = _PyLong_AsInt(args[0]);
+    if (signalnum == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    frame = args[1];
+    return_value = signal_default_int_handler_impl(module, signalnum, frame);
+
+exit:
+    return return_value;
+}
+
 #if defined(HAVE_ALARM)
 
 PyDoc_STRVAR(signal_alarm__doc__,
@@ -23,11 +59,6 @@
     int seconds;
     long _return_value;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     seconds = _PyLong_AsInt(arg);
     if (seconds == -1 && PyErr_Occurred()) {
         goto exit;
@@ -84,11 +115,6 @@
     PyObject *return_value = NULL;
     int signalnum;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     signalnum = _PyLong_AsInt(arg);
     if (signalnum == -1 && PyErr_Occurred()) {
         goto exit;
@@ -128,11 +154,6 @@
     if (!_PyArg_CheckPositional("signal", nargs, 2, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     signalnum = _PyLong_AsInt(args[0]);
     if (signalnum == -1 && PyErr_Occurred()) {
         goto exit;
@@ -168,11 +189,6 @@
     PyObject *return_value = NULL;
     int signalnum;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     signalnum = _PyLong_AsInt(arg);
     if (signalnum == -1 && PyErr_Occurred()) {
         goto exit;
@@ -204,11 +220,6 @@
     PyObject *return_value = NULL;
     int signalnum;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     signalnum = _PyLong_AsInt(arg);
     if (signalnum == -1 && PyErr_Occurred()) {
         goto exit;
@@ -246,20 +257,10 @@
     if (!_PyArg_CheckPositional("siginterrupt", nargs, 2, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     signalnum = _PyLong_AsInt(args[0]);
     if (signalnum == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     flag = _PyLong_AsInt(args[1]);
     if (flag == -1 && PyErr_Occurred()) {
         goto exit;
@@ -303,11 +304,6 @@
     if (!_PyArg_CheckPositional("setitimer", nargs, 2, 3)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     which = _PyLong_AsInt(args[0]);
     if (which == -1 && PyErr_Occurred()) {
         goto exit;
@@ -346,11 +342,6 @@
     PyObject *return_value = NULL;
     int which;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     which = _PyLong_AsInt(arg);
     if (which == -1 && PyErr_Occurred()) {
         goto exit;
@@ -363,7 +354,7 @@
 
 #endif /* defined(HAVE_GETITIMER) */
 
-#if defined(PYPTHREAD_SIGMASK)
+#if defined(HAVE_SIGSET_T) && defined(PYPTHREAD_SIGMASK)
 
 PyDoc_STRVAR(signal_pthread_sigmask__doc__,
 "pthread_sigmask($module, how, mask, /)\n"
@@ -387,11 +378,6 @@
     if (!_PyArg_CheckPositional("pthread_sigmask", nargs, 2, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     how = _PyLong_AsInt(args[0]);
     if (how == -1 && PyErr_Occurred()) {
         goto exit;
@@ -405,9 +391,9 @@
     return return_value;
 }
 
-#endif /* defined(PYPTHREAD_SIGMASK) */
+#endif /* defined(HAVE_SIGSET_T) && defined(PYPTHREAD_SIGMASK) */
 
-#if defined(HAVE_SIGPENDING)
+#if defined(HAVE_SIGSET_T) && defined(HAVE_SIGPENDING)
 
 PyDoc_STRVAR(signal_sigpending__doc__,
 "sigpending($module, /)\n"
@@ -430,9 +416,9 @@
     return signal_sigpending_impl(module);
 }
 
-#endif /* defined(HAVE_SIGPENDING) */
+#endif /* defined(HAVE_SIGSET_T) && defined(HAVE_SIGPENDING) */
 
-#if defined(HAVE_SIGWAIT)
+#if defined(HAVE_SIGSET_T) && defined(HAVE_SIGWAIT)
 
 PyDoc_STRVAR(signal_sigwait__doc__,
 "sigwait($module, sigset, /)\n"
@@ -465,9 +451,9 @@
     return return_value;
 }
 
-#endif /* defined(HAVE_SIGWAIT) */
+#endif /* defined(HAVE_SIGSET_T) && defined(HAVE_SIGWAIT) */
 
-#if (defined(HAVE_SIGFILLSET) || defined(MS_WINDOWS))
+#if ((defined(HAVE_SIGFILLSET) && defined(HAVE_SIGSET_T)) || defined(MS_WINDOWS))
 
 PyDoc_STRVAR(signal_valid_signals__doc__,
 "valid_signals($module, /)\n"
@@ -490,9 +476,9 @@
     return signal_valid_signals_impl(module);
 }
 
-#endif /* (defined(HAVE_SIGFILLSET) || defined(MS_WINDOWS)) */
+#endif /* ((defined(HAVE_SIGFILLSET) && defined(HAVE_SIGSET_T)) || defined(MS_WINDOWS)) */
 
-#if defined(HAVE_SIGWAITINFO)
+#if defined(HAVE_SIGSET_T) && defined(HAVE_SIGWAITINFO)
 
 PyDoc_STRVAR(signal_sigwaitinfo__doc__,
 "sigwaitinfo($module, sigset, /)\n"
@@ -523,9 +509,9 @@
     return return_value;
 }
 
-#endif /* defined(HAVE_SIGWAITINFO) */
+#endif /* defined(HAVE_SIGSET_T) && defined(HAVE_SIGWAITINFO) */
 
-#if defined(HAVE_SIGTIMEDWAIT)
+#if defined(HAVE_SIGSET_T) && defined(HAVE_SIGTIMEDWAIT)
 
 PyDoc_STRVAR(signal_sigtimedwait__doc__,
 "sigtimedwait($module, sigset, timeout, /)\n"
@@ -562,7 +548,7 @@
     return return_value;
 }
 
-#endif /* defined(HAVE_SIGTIMEDWAIT) */
+#endif /* defined(HAVE_SIGSET_T) && defined(HAVE_SIGTIMEDWAIT) */
 
 #if defined(HAVE_PTHREAD_KILL)
 
@@ -594,11 +580,6 @@
         goto exit;
     }
     thread_id = PyLong_AsUnsignedLongMask(args[0]);
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     signalnum = _PyLong_AsInt(args[1]);
     if (signalnum == -1 && PyErr_Occurred()) {
         goto exit;
@@ -638,20 +619,10 @@
     if (!_PyArg_CheckPositional("pidfd_send_signal", nargs, 2, 4)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     pidfd = _PyLong_AsInt(args[0]);
     if (pidfd == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     signalnum = _PyLong_AsInt(args[1]);
     if (signalnum == -1 && PyErr_Occurred()) {
         goto exit;
@@ -663,11 +634,6 @@
     if (nargs < 4) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[3])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     flags = _PyLong_AsInt(args[3]);
     if (flags == -1 && PyErr_Occurred()) {
         goto exit;
@@ -732,4 +698,4 @@
 #ifndef SIGNAL_PIDFD_SEND_SIGNAL_METHODDEF
     #define SIGNAL_PIDFD_SEND_SIGNAL_METHODDEF
 #endif /* !defined(SIGNAL_PIDFD_SEND_SIGNAL_METHODDEF) */
-/*[clinic end generated code: output=b41b4b6bd9ad4da2 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=c353e686367bc384 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/termios.c.h b/Modules/clinic/termios.c.h
new file mode 100644
index 0000000..a45c1f6
--- /dev/null
+++ b/Modules/clinic/termios.c.h
@@ -0,0 +1,225 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(termios_tcgetattr__doc__,
+"tcgetattr($module, fd, /)\n"
+"--\n"
+"\n"
+"Get the tty attributes for file descriptor fd.\n"
+"\n"
+"Returns a list [iflag, oflag, cflag, lflag, ispeed, ospeed, cc]\n"
+"where cc is a list of the tty special characters (each a string of\n"
+"length 1, except the items with indices VMIN and VTIME, which are\n"
+"integers when these fields are defined).  The interpretation of the\n"
+"flags and the speeds as well as the indexing in the cc array must be\n"
+"done using the symbolic constants defined in this module.");
+
+#define TERMIOS_TCGETATTR_METHODDEF    \
+    {"tcgetattr", (PyCFunction)termios_tcgetattr, METH_O, termios_tcgetattr__doc__},
+
+static PyObject *
+termios_tcgetattr_impl(PyObject *module, int fd);
+
+static PyObject *
+termios_tcgetattr(PyObject *module, PyObject *arg)
+{
+    PyObject *return_value = NULL;
+    int fd;
+
+    if (!_PyLong_FileDescriptor_Converter(arg, &fd)) {
+        goto exit;
+    }
+    return_value = termios_tcgetattr_impl(module, fd);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(termios_tcsetattr__doc__,
+"tcsetattr($module, fd, when, attributes, /)\n"
+"--\n"
+"\n"
+"Set the tty attributes for file descriptor fd.\n"
+"\n"
+"The attributes to be set are taken from the attributes argument, which\n"
+"is a list like the one returned by tcgetattr(). The when argument\n"
+"determines when the attributes are changed: termios.TCSANOW to\n"
+"change immediately, termios.TCSADRAIN to change after transmitting all\n"
+"queued output, or termios.TCSAFLUSH to change after transmitting all\n"
+"queued output and discarding all queued input.");
+
+#define TERMIOS_TCSETATTR_METHODDEF    \
+    {"tcsetattr", (PyCFunction)(void(*)(void))termios_tcsetattr, METH_FASTCALL, termios_tcsetattr__doc__},
+
+static PyObject *
+termios_tcsetattr_impl(PyObject *module, int fd, int when, PyObject *term);
+
+static PyObject *
+termios_tcsetattr(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    int fd;
+    int when;
+    PyObject *term;
+
+    if (!_PyArg_CheckPositional("tcsetattr", nargs, 3, 3)) {
+        goto exit;
+    }
+    if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
+        goto exit;
+    }
+    when = _PyLong_AsInt(args[1]);
+    if (when == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    term = args[2];
+    return_value = termios_tcsetattr_impl(module, fd, when, term);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(termios_tcsendbreak__doc__,
+"tcsendbreak($module, fd, duration, /)\n"
+"--\n"
+"\n"
+"Send a break on file descriptor fd.\n"
+"\n"
+"A zero duration sends a break for 0.25-0.5 seconds; a nonzero duration\n"
+"has a system dependent meaning.");
+
+#define TERMIOS_TCSENDBREAK_METHODDEF    \
+    {"tcsendbreak", (PyCFunction)(void(*)(void))termios_tcsendbreak, METH_FASTCALL, termios_tcsendbreak__doc__},
+
+static PyObject *
+termios_tcsendbreak_impl(PyObject *module, int fd, int duration);
+
+static PyObject *
+termios_tcsendbreak(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    int fd;
+    int duration;
+
+    if (!_PyArg_CheckPositional("tcsendbreak", nargs, 2, 2)) {
+        goto exit;
+    }
+    if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
+        goto exit;
+    }
+    duration = _PyLong_AsInt(args[1]);
+    if (duration == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    return_value = termios_tcsendbreak_impl(module, fd, duration);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(termios_tcdrain__doc__,
+"tcdrain($module, fd, /)\n"
+"--\n"
+"\n"
+"Wait until all output written to file descriptor fd has been transmitted.");
+
+#define TERMIOS_TCDRAIN_METHODDEF    \
+    {"tcdrain", (PyCFunction)termios_tcdrain, METH_O, termios_tcdrain__doc__},
+
+static PyObject *
+termios_tcdrain_impl(PyObject *module, int fd);
+
+static PyObject *
+termios_tcdrain(PyObject *module, PyObject *arg)
+{
+    PyObject *return_value = NULL;
+    int fd;
+
+    if (!_PyLong_FileDescriptor_Converter(arg, &fd)) {
+        goto exit;
+    }
+    return_value = termios_tcdrain_impl(module, fd);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(termios_tcflush__doc__,
+"tcflush($module, fd, queue, /)\n"
+"--\n"
+"\n"
+"Discard queued data on file descriptor fd.\n"
+"\n"
+"The queue selector specifies which queue: termios.TCIFLUSH for the input\n"
+"queue, termios.TCOFLUSH for the output queue, or termios.TCIOFLUSH for\n"
+"both queues.");
+
+#define TERMIOS_TCFLUSH_METHODDEF    \
+    {"tcflush", (PyCFunction)(void(*)(void))termios_tcflush, METH_FASTCALL, termios_tcflush__doc__},
+
+static PyObject *
+termios_tcflush_impl(PyObject *module, int fd, int queue);
+
+static PyObject *
+termios_tcflush(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    int fd;
+    int queue;
+
+    if (!_PyArg_CheckPositional("tcflush", nargs, 2, 2)) {
+        goto exit;
+    }
+    if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
+        goto exit;
+    }
+    queue = _PyLong_AsInt(args[1]);
+    if (queue == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    return_value = termios_tcflush_impl(module, fd, queue);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(termios_tcflow__doc__,
+"tcflow($module, fd, action, /)\n"
+"--\n"
+"\n"
+"Suspend or resume input or output on file descriptor fd.\n"
+"\n"
+"The action argument can be termios.TCOOFF to suspend output,\n"
+"termios.TCOON to restart output, termios.TCIOFF to suspend input,\n"
+"or termios.TCION to restart input.");
+
+#define TERMIOS_TCFLOW_METHODDEF    \
+    {"tcflow", (PyCFunction)(void(*)(void))termios_tcflow, METH_FASTCALL, termios_tcflow__doc__},
+
+static PyObject *
+termios_tcflow_impl(PyObject *module, int fd, int action);
+
+static PyObject *
+termios_tcflow(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    int fd;
+    int action;
+
+    if (!_PyArg_CheckPositional("tcflow", nargs, 2, 2)) {
+        goto exit;
+    }
+    if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
+        goto exit;
+    }
+    action = _PyLong_AsInt(args[1]);
+    if (action == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    return_value = termios_tcflow_impl(module, fd, action);
+
+exit:
+    return return_value;
+}
+/*[clinic end generated code: output=a129179f1e2545cc input=a9049054013a1b77]*/
diff --git a/Modules/clinic/zlibmodule.c.h b/Modules/clinic/zlibmodule.c.h
index 77ea04a..14e955d 100644
--- a/Modules/clinic/zlibmodule.c.h
+++ b/Modules/clinic/zlibmodule.c.h
@@ -44,11 +44,6 @@
     if (!noptargs) {
         goto skip_optional_pos;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     level = _PyLong_AsInt(args[1]);
     if (level == -1 && PyErr_Occurred()) {
         goto exit;
@@ -112,11 +107,6 @@
         goto skip_optional_pos;
     }
     if (args[1]) {
-        if (PyFloat_Check(args[1])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         wbits = _PyLong_AsInt(args[1]);
         if (wbits == -1 && PyErr_Occurred()) {
             goto exit;
@@ -125,8 +115,17 @@
             goto skip_optional_pos;
         }
     }
-    if (!ssize_t_converter(args[2], &bufsize)) {
-        goto exit;
+    {
+        Py_ssize_t ival = -1;
+        PyObject *iobj = _PyNumber_Index(args[2]);
+        if (iobj != NULL) {
+            ival = PyLong_AsSsize_t(iobj);
+            Py_DECREF(iobj);
+        }
+        if (ival == -1 && PyErr_Occurred()) {
+            goto exit;
+        }
+        bufsize = ival;
     }
 skip_optional_pos:
     return_value = zlib_decompress_impl(module, &data, wbits, bufsize);
@@ -200,11 +199,6 @@
         goto skip_optional_pos;
     }
     if (args[0]) {
-        if (PyFloat_Check(args[0])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         level = _PyLong_AsInt(args[0]);
         if (level == -1 && PyErr_Occurred()) {
             goto exit;
@@ -214,11 +208,6 @@
         }
     }
     if (args[1]) {
-        if (PyFloat_Check(args[1])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         method = _PyLong_AsInt(args[1]);
         if (method == -1 && PyErr_Occurred()) {
             goto exit;
@@ -228,11 +217,6 @@
         }
     }
     if (args[2]) {
-        if (PyFloat_Check(args[2])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         wbits = _PyLong_AsInt(args[2]);
         if (wbits == -1 && PyErr_Occurred()) {
             goto exit;
@@ -242,11 +226,6 @@
         }
     }
     if (args[3]) {
-        if (PyFloat_Check(args[3])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         memLevel = _PyLong_AsInt(args[3]);
         if (memLevel == -1 && PyErr_Occurred()) {
             goto exit;
@@ -256,11 +235,6 @@
         }
     }
     if (args[4]) {
-        if (PyFloat_Check(args[4])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         strategy = _PyLong_AsInt(args[4]);
         if (strategy == -1 && PyErr_Occurred()) {
             goto exit;
@@ -325,11 +299,6 @@
         goto skip_optional_pos;
     }
     if (args[0]) {
-        if (PyFloat_Check(args[0])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         wbits = _PyLong_AsInt(args[0]);
         if (wbits == -1 && PyErr_Occurred()) {
             goto exit;
@@ -360,25 +329,25 @@
 "Call the flush() method to clear these buffers.");
 
 #define ZLIB_COMPRESS_COMPRESS_METHODDEF    \
-    {"compress", (PyCFunction)zlib_Compress_compress, METH_O, zlib_Compress_compress__doc__},
+    {"compress", (PyCFunction)(void(*)(void))zlib_Compress_compress, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, zlib_Compress_compress__doc__},
 
 static PyObject *
-zlib_Compress_compress_impl(compobject *self, Py_buffer *data);
+zlib_Compress_compress_impl(compobject *self, PyTypeObject *cls,
+                            Py_buffer *data);
 
 static PyObject *
-zlib_Compress_compress(compobject *self, PyObject *arg)
+zlib_Compress_compress(compobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
     PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"", NULL};
+    static _PyArg_Parser _parser = {"y*:compress", _keywords, 0};
     Py_buffer data = {NULL, NULL};
 
-    if (PyObject_GetBuffer(arg, &data, PyBUF_SIMPLE) != 0) {
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
+        &data)) {
         goto exit;
     }
-    if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("compress", "argument", "contiguous buffer", arg);
-        goto exit;
-    }
-    return_value = zlib_Compress_compress_impl(self, &data);
+    return_value = zlib_Compress_compress_impl(self, cls, &data);
 
 exit:
     /* Cleanup for data */
@@ -407,42 +376,26 @@
 "Call the flush() method to clear these buffers.");
 
 #define ZLIB_DECOMPRESS_DECOMPRESS_METHODDEF    \
-    {"decompress", (PyCFunction)(void(*)(void))zlib_Decompress_decompress, METH_FASTCALL|METH_KEYWORDS, zlib_Decompress_decompress__doc__},
+    {"decompress", (PyCFunction)(void(*)(void))zlib_Decompress_decompress, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, zlib_Decompress_decompress__doc__},
 
 static PyObject *
-zlib_Decompress_decompress_impl(compobject *self, Py_buffer *data,
-                                Py_ssize_t max_length);
+zlib_Decompress_decompress_impl(compobject *self, PyTypeObject *cls,
+                                Py_buffer *data, Py_ssize_t max_length);
 
 static PyObject *
-zlib_Decompress_decompress(compobject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+zlib_Decompress_decompress(compobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
     PyObject *return_value = NULL;
     static const char * const _keywords[] = {"", "max_length", NULL};
-    static _PyArg_Parser _parser = {NULL, _keywords, "decompress", 0};
-    PyObject *argsbuf[2];
-    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
+    static _PyArg_Parser _parser = {"y*|n:decompress", _keywords, 0};
     Py_buffer data = {NULL, NULL};
     Py_ssize_t max_length = 0;
 
-    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
-    if (!args) {
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
+        &data, &max_length)) {
         goto exit;
     }
-    if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
-        goto exit;
-    }
-    if (!PyBuffer_IsContiguous(&data, 'C')) {
-        _PyArg_BadArgument("decompress", "argument 1", "contiguous buffer", args[0]);
-        goto exit;
-    }
-    if (!noptargs) {
-        goto skip_optional_pos;
-    }
-    if (!ssize_t_converter(args[1], &max_length)) {
-        goto exit;
-    }
-skip_optional_pos:
-    return_value = zlib_Decompress_decompress_impl(self, &data, max_length);
+    return_value = zlib_Decompress_decompress_impl(self, cls, &data, max_length);
 
 exit:
     /* Cleanup for data */
@@ -466,34 +419,24 @@
 "    can still be compressed.");
 
 #define ZLIB_COMPRESS_FLUSH_METHODDEF    \
-    {"flush", (PyCFunction)(void(*)(void))zlib_Compress_flush, METH_FASTCALL, zlib_Compress_flush__doc__},
+    {"flush", (PyCFunction)(void(*)(void))zlib_Compress_flush, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, zlib_Compress_flush__doc__},
 
 static PyObject *
-zlib_Compress_flush_impl(compobject *self, int mode);
+zlib_Compress_flush_impl(compobject *self, PyTypeObject *cls, int mode);
 
 static PyObject *
-zlib_Compress_flush(compobject *self, PyObject *const *args, Py_ssize_t nargs)
+zlib_Compress_flush(compobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
     PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"", NULL};
+    static _PyArg_Parser _parser = {"|i:flush", _keywords, 0};
     int mode = Z_FINISH;
 
-    if (!_PyArg_CheckPositional("flush", nargs, 0, 1)) {
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
+        &mode)) {
         goto exit;
     }
-    if (nargs < 1) {
-        goto skip_optional;
-    }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
-    mode = _PyLong_AsInt(args[0]);
-    if (mode == -1 && PyErr_Occurred()) {
-        goto exit;
-    }
-skip_optional:
-    return_value = zlib_Compress_flush_impl(self, mode);
+    return_value = zlib_Compress_flush_impl(self, cls, mode);
 
 exit:
     return return_value;
@@ -508,15 +451,26 @@
 "Return a copy of the compression object.");
 
 #define ZLIB_COMPRESS_COPY_METHODDEF    \
-    {"copy", (PyCFunction)zlib_Compress_copy, METH_NOARGS, zlib_Compress_copy__doc__},
+    {"copy", (PyCFunction)(void(*)(void))zlib_Compress_copy, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, zlib_Compress_copy__doc__},
 
 static PyObject *
-zlib_Compress_copy_impl(compobject *self);
+zlib_Compress_copy_impl(compobject *self, PyTypeObject *cls);
 
 static PyObject *
-zlib_Compress_copy(compobject *self, PyObject *Py_UNUSED(ignored))
+zlib_Compress_copy(compobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
-    return zlib_Compress_copy_impl(self);
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = { NULL};
+    static _PyArg_Parser _parser = {":copy", _keywords, 0};
+
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser
+        )) {
+        goto exit;
+    }
+    return_value = zlib_Compress_copy_impl(self, cls);
+
+exit:
+    return return_value;
 }
 
 #endif /* defined(HAVE_ZLIB_COPY) */
@@ -529,15 +483,26 @@
 "\n");
 
 #define ZLIB_COMPRESS___COPY___METHODDEF    \
-    {"__copy__", (PyCFunction)zlib_Compress___copy__, METH_NOARGS, zlib_Compress___copy____doc__},
+    {"__copy__", (PyCFunction)(void(*)(void))zlib_Compress___copy__, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, zlib_Compress___copy____doc__},
 
 static PyObject *
-zlib_Compress___copy___impl(compobject *self);
+zlib_Compress___copy___impl(compobject *self, PyTypeObject *cls);
 
 static PyObject *
-zlib_Compress___copy__(compobject *self, PyObject *Py_UNUSED(ignored))
+zlib_Compress___copy__(compobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
-    return zlib_Compress___copy___impl(self);
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = { NULL};
+    static _PyArg_Parser _parser = {":__copy__", _keywords, 0};
+
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser
+        )) {
+        goto exit;
+    }
+    return_value = zlib_Compress___copy___impl(self, cls);
+
+exit:
+    return return_value;
 }
 
 #endif /* defined(HAVE_ZLIB_COPY) */
@@ -550,7 +515,29 @@
 "\n");
 
 #define ZLIB_COMPRESS___DEEPCOPY___METHODDEF    \
-    {"__deepcopy__", (PyCFunction)zlib_Compress___deepcopy__, METH_O, zlib_Compress___deepcopy____doc__},
+    {"__deepcopy__", (PyCFunction)(void(*)(void))zlib_Compress___deepcopy__, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, zlib_Compress___deepcopy____doc__},
+
+static PyObject *
+zlib_Compress___deepcopy___impl(compobject *self, PyTypeObject *cls,
+                                PyObject *memo);
+
+static PyObject *
+zlib_Compress___deepcopy__(compobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"", NULL};
+    static _PyArg_Parser _parser = {"O:__deepcopy__", _keywords, 0};
+    PyObject *memo;
+
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
+        &memo)) {
+        goto exit;
+    }
+    return_value = zlib_Compress___deepcopy___impl(self, cls, memo);
+
+exit:
+    return return_value;
+}
 
 #endif /* defined(HAVE_ZLIB_COPY) */
 
@@ -563,15 +550,26 @@
 "Return a copy of the decompression object.");
 
 #define ZLIB_DECOMPRESS_COPY_METHODDEF    \
-    {"copy", (PyCFunction)zlib_Decompress_copy, METH_NOARGS, zlib_Decompress_copy__doc__},
+    {"copy", (PyCFunction)(void(*)(void))zlib_Decompress_copy, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, zlib_Decompress_copy__doc__},
 
 static PyObject *
-zlib_Decompress_copy_impl(compobject *self);
+zlib_Decompress_copy_impl(compobject *self, PyTypeObject *cls);
 
 static PyObject *
-zlib_Decompress_copy(compobject *self, PyObject *Py_UNUSED(ignored))
+zlib_Decompress_copy(compobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
-    return zlib_Decompress_copy_impl(self);
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = { NULL};
+    static _PyArg_Parser _parser = {":copy", _keywords, 0};
+
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser
+        )) {
+        goto exit;
+    }
+    return_value = zlib_Decompress_copy_impl(self, cls);
+
+exit:
+    return return_value;
 }
 
 #endif /* defined(HAVE_ZLIB_COPY) */
@@ -584,15 +582,26 @@
 "\n");
 
 #define ZLIB_DECOMPRESS___COPY___METHODDEF    \
-    {"__copy__", (PyCFunction)zlib_Decompress___copy__, METH_NOARGS, zlib_Decompress___copy____doc__},
+    {"__copy__", (PyCFunction)(void(*)(void))zlib_Decompress___copy__, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, zlib_Decompress___copy____doc__},
 
 static PyObject *
-zlib_Decompress___copy___impl(compobject *self);
+zlib_Decompress___copy___impl(compobject *self, PyTypeObject *cls);
 
 static PyObject *
-zlib_Decompress___copy__(compobject *self, PyObject *Py_UNUSED(ignored))
+zlib_Decompress___copy__(compobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
-    return zlib_Decompress___copy___impl(self);
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = { NULL};
+    static _PyArg_Parser _parser = {":__copy__", _keywords, 0};
+
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser
+        )) {
+        goto exit;
+    }
+    return_value = zlib_Decompress___copy___impl(self, cls);
+
+exit:
+    return return_value;
 }
 
 #endif /* defined(HAVE_ZLIB_COPY) */
@@ -605,7 +614,29 @@
 "\n");
 
 #define ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF    \
-    {"__deepcopy__", (PyCFunction)zlib_Decompress___deepcopy__, METH_O, zlib_Decompress___deepcopy____doc__},
+    {"__deepcopy__", (PyCFunction)(void(*)(void))zlib_Decompress___deepcopy__, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, zlib_Decompress___deepcopy____doc__},
+
+static PyObject *
+zlib_Decompress___deepcopy___impl(compobject *self, PyTypeObject *cls,
+                                  PyObject *memo);
+
+static PyObject *
+zlib_Decompress___deepcopy__(compobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"", NULL};
+    static _PyArg_Parser _parser = {"O:__deepcopy__", _keywords, 0};
+    PyObject *memo;
+
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
+        &memo)) {
+        goto exit;
+    }
+    return_value = zlib_Decompress___deepcopy___impl(self, cls, memo);
+
+exit:
+    return return_value;
+}
 
 #endif /* defined(HAVE_ZLIB_COPY) */
 
@@ -619,28 +650,25 @@
 "    the initial size of the output buffer.");
 
 #define ZLIB_DECOMPRESS_FLUSH_METHODDEF    \
-    {"flush", (PyCFunction)(void(*)(void))zlib_Decompress_flush, METH_FASTCALL, zlib_Decompress_flush__doc__},
+    {"flush", (PyCFunction)(void(*)(void))zlib_Decompress_flush, METH_METHOD|METH_FASTCALL|METH_KEYWORDS, zlib_Decompress_flush__doc__},
 
 static PyObject *
-zlib_Decompress_flush_impl(compobject *self, Py_ssize_t length);
+zlib_Decompress_flush_impl(compobject *self, PyTypeObject *cls,
+                           Py_ssize_t length);
 
 static PyObject *
-zlib_Decompress_flush(compobject *self, PyObject *const *args, Py_ssize_t nargs)
+zlib_Decompress_flush(compobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
     PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"", NULL};
+    static _PyArg_Parser _parser = {"|n:flush", _keywords, 0};
     Py_ssize_t length = DEF_BUF_SIZE;
 
-    if (!_PyArg_CheckPositional("flush", nargs, 0, 1)) {
+    if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
+        &length)) {
         goto exit;
     }
-    if (nargs < 1) {
-        goto skip_optional;
-    }
-    if (!ssize_t_converter(args[0], &length)) {
-        goto exit;
-    }
-skip_optional:
-    return_value = zlib_Decompress_flush_impl(self, length);
+    return_value = zlib_Decompress_flush_impl(self, cls, length);
 
 exit:
     return return_value;
@@ -683,11 +711,6 @@
     if (nargs < 2) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     value = (unsigned int)PyLong_AsUnsignedLongMask(args[1]);
     if (value == (unsigned int)-1 && PyErr_Occurred()) {
         goto exit;
@@ -741,11 +764,6 @@
     if (nargs < 2) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     value = (unsigned int)PyLong_AsUnsignedLongMask(args[1]);
     if (value == (unsigned int)-1 && PyErr_Occurred()) {
         goto exit;
@@ -785,4 +803,4 @@
 #ifndef ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF
     #define ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF
 #endif /* !defined(ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF) */
-/*[clinic end generated code: output=faae38ef96b88b16 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=6736bae59fab268b input=a9049054013a1b77]*/
diff --git a/Modules/cmathmodule.c b/Modules/cmathmodule.c
index 5eac4b4..0f22049 100644
--- a/Modules/cmathmodule.c
+++ b/Modules/cmathmodule.c
@@ -1254,37 +1254,35 @@
     {NULL, NULL}  /* sentinel */
 };
 
-
-static struct PyModuleDef cmathmodule = {
-    PyModuleDef_HEAD_INIT,
-    "cmath",
-    module_doc,
-    -1,
-    cmath_methods,
-    NULL,
-    NULL,
-    NULL,
-    NULL
-};
-
-PyMODINIT_FUNC
-PyInit_cmath(void)
+static int
+cmath_exec(PyObject *mod)
 {
-    PyObject *m;
+    if (PyModule_AddObject(mod, "pi", PyFloat_FromDouble(Py_MATH_PI)) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObject(mod, "e", PyFloat_FromDouble(Py_MATH_E)) < 0) {
+        return -1;
+    }
+    // 2pi
+    if (PyModule_AddObject(mod, "tau", PyFloat_FromDouble(Py_MATH_TAU)) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObject(mod, "inf", PyFloat_FromDouble(m_inf())) < 0) {
+        return -1;
+    }
 
-    m = PyModule_Create(&cmathmodule);
-    if (m == NULL)
-        return NULL;
-
-    PyModule_AddObject(m, "pi",
-                       PyFloat_FromDouble(Py_MATH_PI));
-    PyModule_AddObject(m, "e", PyFloat_FromDouble(Py_MATH_E));
-    PyModule_AddObject(m, "tau", PyFloat_FromDouble(Py_MATH_TAU)); /* 2pi */
-    PyModule_AddObject(m, "inf", PyFloat_FromDouble(m_inf()));
-    PyModule_AddObject(m, "infj", PyComplex_FromCComplex(c_infj()));
+    if (PyModule_AddObject(mod, "infj",
+                           PyComplex_FromCComplex(c_infj())) < 0) {
+        return -1;
+    }
 #if !defined(PY_NO_SHORT_FLOAT_REPR) || defined(Py_NAN)
-    PyModule_AddObject(m, "nan", PyFloat_FromDouble(m_nan()));
-    PyModule_AddObject(m, "nanj", PyComplex_FromCComplex(c_nanj()));
+    if (PyModule_AddObject(mod, "nan", PyFloat_FromDouble(m_nan())) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObject(mod, "nanj",
+                           PyComplex_FromCComplex(c_nanj())) < 0) {
+        return -1;
+    }
 #endif
 
     /* initialize special value tables */
@@ -1401,5 +1399,25 @@
       C(INF,N) C(U,U) C(INF,-0.) C(INF,0.)   C(U,U) C(INF,N) C(INF,N)
       C(N,N)   C(N,N) C(N,0.)    C(N,0.)     C(N,N) C(N,N)   C(N,N)
     })
-    return m;
+    return 0;
 }
+
+static PyModuleDef_Slot cmath_slots[] = {
+    {Py_mod_exec, cmath_exec},
+    {0, NULL}
+};
+
+static struct PyModuleDef cmathmodule = {
+    PyModuleDef_HEAD_INIT,
+    .m_name = "cmath",
+    .m_doc = module_doc,
+    .m_size = 0,
+    .m_methods = cmath_methods,
+    .m_slots = cmath_slots
+};
+
+PyMODINIT_FUNC
+PyInit_cmath(void)
+{
+    return PyModuleDef_Init(&cmathmodule);
+}
\ No newline at end of file
diff --git a/Modules/expat/COPYING b/Modules/expat/COPYING
index 8d288f0..3c0142e 100644
--- a/Modules/expat/COPYING
+++ b/Modules/expat/COPYING
@@ -1,5 +1,5 @@
 Copyright (c) 1998-2000 Thai Open Source Software Center Ltd and Clark Cooper
-Copyright (c) 2001-2017 Expat maintainers
+Copyright (c) 2001-2019 Expat maintainers
 
 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the
diff --git a/Modules/expat/ascii.h b/Modules/expat/ascii.h
index c3587e5..1f594d2 100644
--- a/Modules/expat/ascii.h
+++ b/Modules/expat/ascii.h
@@ -6,8 +6,11 @@
                         \___/_/\_\ .__/ \__,_|\__|
                                  |_| XML parser
 
-   Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
-   Copyright (c) 2000-2017 Expat development team
+   Copyright (c) 1999-2000 Thai Open Source Software Center Ltd
+   Copyright (c) 2000      Clark Cooper <coopercc@users.sourceforge.net>
+   Copyright (c) 2002      Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
+   Copyright (c) 2007      Karl Waclawek <karl@waclawek.net>
+   Copyright (c) 2017      Sebastian Pipping <sebastian@pipping.org>
    Licensed under the MIT license:
 
    Permission is  hereby granted,  free of charge,  to any  person obtaining
diff --git a/Modules/expat/asciitab.h b/Modules/expat/asciitab.h
index 63b1d1b..af766fb 100644
--- a/Modules/expat/asciitab.h
+++ b/Modules/expat/asciitab.h
@@ -7,7 +7,9 @@
                                  |_| XML parser
 
    Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
-   Copyright (c) 2000-2017 Expat development team
+   Copyright (c) 2000      Clark Cooper <coopercc@users.sourceforge.net>
+   Copyright (c) 2002      Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
+   Copyright (c) 2017      Sebastian Pipping <sebastian@pipping.org>
    Licensed under the MIT license:
 
    Permission is  hereby granted,  free of charge,  to any  person obtaining
diff --git a/Modules/expat/expat.h b/Modules/expat/expat.h
index 6c8eb1f..c9214f6 100644
--- a/Modules/expat/expat.h
+++ b/Modules/expat/expat.h
@@ -7,7 +7,15 @@
                                  |_| XML parser
 
    Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
-   Copyright (c) 2000-2017 Expat development team
+   Copyright (c) 2000      Clark Cooper <coopercc@users.sourceforge.net>
+   Copyright (c) 2000-2005 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
+   Copyright (c) 2001-2002 Greg Stein <gstein@users.sourceforge.net>
+   Copyright (c) 2002-2016 Karl Waclawek <karl@waclawek.net>
+   Copyright (c) 2016-2022 Sebastian Pipping <sebastian@pipping.org>
+   Copyright (c) 2016      Cristian Rodríguez <crrodriguez@opensuse.org>
+   Copyright (c) 2016      Thomas Beutlich <tc@tbeu.de>
+   Copyright (c) 2017      Rhodri James <rhodri@wildebeest.org.uk>
+   Copyright (c) 2022      Thijs Schreijer <thijs@thijsschreijer.nl>
    Licensed under the MIT license:
 
    Permission is  hereby granted,  free of charge,  to any  person obtaining
@@ -115,7 +123,11 @@
   XML_ERROR_RESERVED_PREFIX_XMLNS,
   XML_ERROR_RESERVED_NAMESPACE_URI,
   /* Added in 2.2.1. */
-  XML_ERROR_INVALID_ARGUMENT
+  XML_ERROR_INVALID_ARGUMENT,
+  /* Added in 2.3.0. */
+  XML_ERROR_NO_BUFFER,
+  /* Added in 2.4.0. */
+  XML_ERROR_AMPLIFICATION_LIMIT_BREACH
 };
 
 enum XML_Content_Type {
@@ -163,8 +175,10 @@
 };
 
 /* This is called for an element declaration. See above for
-   description of the model argument. It's the caller's responsibility
-   to free model when finished with it.
+   description of the model argument. It's the user code's responsibility
+   to free model when finished with it. See XML_FreeContentModel.
+   There is no need to free the model from the handler, it can be kept
+   around and freed at a later stage.
 */
 typedef void(XMLCALL *XML_ElementDeclHandler)(void *userData,
                                               const XML_Char *name,
@@ -226,6 +240,17 @@
    and the local part will be concatenated without any separator.
    It is a programming error to use the separator '\0' with namespace
    triplets (see XML_SetReturnNSTriplet).
+   If a namespace separator is chosen that can be part of a URI or
+   part of an XML name, splitting an expanded name back into its
+   1, 2 or 3 original parts on application level in the element handler
+   may end up vulnerable, so these are advised against;  sane choices for
+   a namespace separator are e.g. '\n' (line feed) and '|' (pipe).
+
+   Note that Expat does not validate namespace URIs (beyond encoding)
+   against RFC 3986 today (and is not required to do so with regard to
+   the XML 1.0 namespaces specification) but it may start doing that
+   in future releases.  Before that, an application using Expat must
+   be ready to receive namespace URIs containing non-URI characters.
 */
 XMLPARSEAPI(XML_Parser)
 XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator);
@@ -306,7 +331,7 @@
                                                    const XML_Char *pubid,
                                                    int has_internal_subset);
 
-/* This is called for the start of the DOCTYPE declaration when the
+/* This is called for the end of the DOCTYPE declaration when the
    closing > is encountered, but after processing any external
    subset.
 */
@@ -318,7 +343,7 @@
 
    For internal entities (<!ENTITY foo "bar">), value will
    be non-NULL and systemId, publicID, and notationName will be NULL.
-   The value string is NOT nul-terminated; the length is provided in
+   The value string is NOT null-terminated; the length is provided in
    the value_length argument. Since it is legal to have zero-length
    values, do not use this argument to test for internal entities.
 
@@ -513,7 +538,7 @@
    Otherwise it must return XML_STATUS_ERROR.
 
    If info does not describe a suitable encoding, then the parser will
-   return an XML_UNKNOWN_ENCODING error.
+   return an XML_ERROR_UNKNOWN_ENCODING error.
 */
 typedef int(XMLCALL *XML_UnknownEncodingHandler)(void *encodingHandlerData,
                                                  const XML_Char *name,
@@ -707,7 +732,7 @@
 /* Returns the number of the attribute/value pairs passed in last call
    to the XML_StartElementHandler that were specified in the start-tag
    rather than defaulted. Each attribute/value pair counts as 2; thus
-   this correspondds to an index into the atts array passed to the
+   this corresponds to an index into the atts array passed to the
    XML_StartElementHandler.  Returns -1 if parser == NULL.
 */
 XMLPARSEAPI(int)
@@ -716,7 +741,7 @@
 /* Returns the index of the ID attribute passed in the last call to
    XML_StartElementHandler, or -1 if there is no ID attribute or
    parser == NULL.  Each attribute/value pair counts as 2; thus this
-   correspondds to an index into the atts array passed to the
+   corresponds to an index into the atts array passed to the
    XML_StartElementHandler.
 */
 XMLPARSEAPI(int)
@@ -997,7 +1022,10 @@
   XML_FEATURE_SIZEOF_XML_LCHAR,
   XML_FEATURE_NS,
   XML_FEATURE_LARGE_SIZE,
-  XML_FEATURE_ATTR_INFO
+  XML_FEATURE_ATTR_INFO,
+  /* Added in Expat 2.4.0. */
+  XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT,
+  XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT
   /* Additional features must be added to the end of this enum. */
 };
 
@@ -1010,12 +1038,24 @@
 XMLPARSEAPI(const XML_Feature *)
 XML_GetFeatureList(void);
 
+#ifdef XML_DTD
+/* Added in Expat 2.4.0. */
+XMLPARSEAPI(XML_Bool)
+XML_SetBillionLaughsAttackProtectionMaximumAmplification(
+    XML_Parser parser, float maximumAmplificationFactor);
+
+/* Added in Expat 2.4.0. */
+XMLPARSEAPI(XML_Bool)
+XML_SetBillionLaughsAttackProtectionActivationThreshold(
+    XML_Parser parser, unsigned long long activationThresholdBytes);
+#endif
+
 /* Expat follows the semantic versioning convention.
    See http://semver.org.
 */
 #define XML_MAJOR_VERSION 2
-#define XML_MINOR_VERSION 2
-#define XML_MICRO_VERSION 8
+#define XML_MINOR_VERSION 4
+#define XML_MICRO_VERSION 7
 
 #ifdef __cplusplus
 }
diff --git a/Modules/expat/expat_external.h b/Modules/expat/expat_external.h
index f2b75dd..12c560e 100644
--- a/Modules/expat/expat_external.h
+++ b/Modules/expat/expat_external.h
@@ -7,7 +7,14 @@
                                  |_| XML parser
 
    Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
-   Copyright (c) 2000-2017 Expat development team
+   Copyright (c) 2000      Clark Cooper <coopercc@users.sourceforge.net>
+   Copyright (c) 2000-2004 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
+   Copyright (c) 2001-2002 Greg Stein <gstein@users.sourceforge.net>
+   Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net>
+   Copyright (c) 2016      Cristian Rodríguez <crrodriguez@opensuse.org>
+   Copyright (c) 2016-2019 Sebastian Pipping <sebastian@pipping.org>
+   Copyright (c) 2017      Rhodri James <rhodri@wildebeest.org.uk>
+   Copyright (c) 2018      Yury Gribov <tetra2005@gmail.com>
    Licensed under the MIT license:
 
    Permission is  hereby granted,  free of charge,  to any  person obtaining
diff --git a/Modules/expat/iasciitab.h b/Modules/expat/iasciitab.h
index ea97cfc..5d8646f 100644
--- a/Modules/expat/iasciitab.h
+++ b/Modules/expat/iasciitab.h
@@ -7,7 +7,9 @@
                                  |_| XML parser
 
    Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
-   Copyright (c) 2000-2017 Expat development team
+   Copyright (c) 2000      Clark Cooper <coopercc@users.sourceforge.net>
+   Copyright (c) 2002      Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
+   Copyright (c) 2017      Sebastian Pipping <sebastian@pipping.org>
    Licensed under the MIT license:
 
    Permission is  hereby granted,  free of charge,  to any  person obtaining
diff --git a/Modules/expat/internal.h b/Modules/expat/internal.h
index 60913da..444eba0 100644
--- a/Modules/expat/internal.h
+++ b/Modules/expat/internal.h
@@ -25,8 +25,12 @@
                         \___/_/\_\ .__/ \__,_|\__|
                                  |_| XML parser
 
-   Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
-   Copyright (c) 2000-2017 Expat development team
+   Copyright (c) 2002-2003 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
+   Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net>
+   Copyright (c) 2003      Greg Stein <gstein@users.sourceforge.net>
+   Copyright (c) 2016-2021 Sebastian Pipping <sebastian@pipping.org>
+   Copyright (c) 2018      Yury Gribov <tetra2005@gmail.com>
+   Copyright (c) 2019      David Loffredo <loffredo@steptools.com>
    Licensed under the MIT license:
 
    Permission is  hereby granted,  free of charge,  to any  person obtaining
@@ -101,22 +105,58 @@
 #  endif
 #endif
 
+#include <limits.h> // ULONG_MAX
+
+#if defined(_WIN32) && ! defined(__USE_MINGW_ANSI_STDIO)
+#  define EXPAT_FMT_ULL(midpart) "%" midpart "I64u"
+#  if defined(_WIN64) // Note: modifiers "td" and "zu" do not work for MinGW
+#    define EXPAT_FMT_PTRDIFF_T(midpart) "%" midpart "I64d"
+#    define EXPAT_FMT_SIZE_T(midpart) "%" midpart "I64u"
+#  else
+#    define EXPAT_FMT_PTRDIFF_T(midpart) "%" midpart "d"
+#    define EXPAT_FMT_SIZE_T(midpart) "%" midpart "u"
+#  endif
+#else
+#  define EXPAT_FMT_ULL(midpart) "%" midpart "llu"
+#  if ! defined(ULONG_MAX)
+#    error Compiler did not define ULONG_MAX for us
+#  elif ULONG_MAX == 18446744073709551615u // 2^64-1
+#    define EXPAT_FMT_PTRDIFF_T(midpart) "%" midpart "ld"
+#    define EXPAT_FMT_SIZE_T(midpart) "%" midpart "lu"
+#  else
+#    define EXPAT_FMT_PTRDIFF_T(midpart) "%" midpart "d"
+#    define EXPAT_FMT_SIZE_T(midpart) "%" midpart "u"
+#  endif
+#endif
+
 #ifndef UNUSED_P
 #  define UNUSED_P(p) (void)p
 #endif
 
+/* NOTE BEGIN If you ever patch these defaults to greater values
+              for non-attack XML payload in your environment,
+              please file a bug report with libexpat.  Thank you!
+*/
+#define EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT   \
+  100.0f
+#define EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT    \
+  8388608 // 8 MiB, 2^23
+/* NOTE END */
+
+#include "expat.h" // so we can use type XML_Parser below
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#ifdef XML_ENABLE_VISIBILITY
-#  if XML_ENABLE_VISIBILITY
-__attribute__((visibility("default")))
-#  endif
+void _INTERNAL_trim_to_complete_utf8_characters(const char *from,
+                                                const char **fromLimRef);
+
+#if defined(XML_DTD)
+unsigned long long testingAccountingGetCountBytesDirect(XML_Parser parser);
+unsigned long long testingAccountingGetCountBytesIndirect(XML_Parser parser);
+const char *unsignedCharToPrintable(unsigned char c);
 #endif
-void
-_INTERNAL_trim_to_complete_utf8_characters(const char *from,
-                                           const char **fromLimRef);
 
 #ifdef __cplusplus
 }
diff --git a/Modules/expat/latin1tab.h b/Modules/expat/latin1tab.h
index 6f91604..b681d27 100644
--- a/Modules/expat/latin1tab.h
+++ b/Modules/expat/latin1tab.h
@@ -7,7 +7,9 @@
                                  |_| XML parser
 
    Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
-   Copyright (c) 2000-2017 Expat development team
+   Copyright (c) 2000      Clark Cooper <coopercc@users.sourceforge.net>
+   Copyright (c) 2002      Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
+   Copyright (c) 2017      Sebastian Pipping <sebastian@pipping.org>
    Licensed under the MIT license:
 
    Permission is  hereby granted,  free of charge,  to any  person obtaining
diff --git a/Modules/expat/nametab.h b/Modules/expat/nametab.h
index 3681df3..6348544 100644
--- a/Modules/expat/nametab.h
+++ b/Modules/expat/nametab.h
@@ -6,8 +6,8 @@
                         \___/_/\_\ .__/ \__,_|\__|
                                  |_| XML parser
 
-   Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
-   Copyright (c) 2000-2017 Expat development team
+   Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
+   Copyright (c) 2017 Sebastian Pipping <sebastian@pipping.org>
    Licensed under the MIT license:
 
    Permission is  hereby granted,  free of charge,  to any  person obtaining
diff --git a/Modules/expat/pyexpatns.h b/Modules/expat/pyexpatns.h
index cfb742e..d45d9b6 100644
--- a/Modules/expat/pyexpatns.h
+++ b/Modules/expat/pyexpatns.h
@@ -38,6 +38,9 @@
 #ifndef PYEXPATNS_H
 #define PYEXPATNS_H
 
+#define testingAccountingGetCountBytesDirect PyExpat_testingAccountingGetCountBytesDirect
+#define testingAccountingGetCountBytesIndirect PyExpat_testingAccountingGetCountBytesIndirect
+#define unsignedCharToPrintable PyExpat_unsignedCharToPrintable
 #define XML_DefaultCurrent              PyExpat_XML_DefaultCurrent
 #define XML_ErrorString                 PyExpat_XML_ErrorString
 #define XML_ExpatVersion                PyExpat_XML_ExpatVersion
@@ -81,6 +84,8 @@
 #define XML_ResumeParser                PyExpat_XML_ResumeParser
 #define XML_SetAttlistDeclHandler       PyExpat_XML_SetAttlistDeclHandler
 #define XML_SetBase                     PyExpat_XML_SetBase
+#define XML_SetBillionLaughsAttackProtectionActivationThreshold PyExpat_XML_SetBillionLaughsAttackProtectionActivationThreshold
+#define XML_SetBillionLaughsAttackProtectionMaximumAmplification PyExpat_XML_SetBillionLaughsAttackProtectionMaximumAmplification
 #define XML_SetCdataSectionHandler      PyExpat_XML_SetCdataSectionHandler
 #define XML_SetCharacterDataHandler     PyExpat_XML_SetCharacterDataHandler
 #define XML_SetCommentHandler           PyExpat_XML_SetCommentHandler
diff --git a/Modules/expat/siphash.h b/Modules/expat/siphash.h
index bfee65a..e5406d7 100644
--- a/Modules/expat/siphash.h
+++ b/Modules/expat/siphash.h
@@ -11,6 +11,9 @@
  * --------------------------------------------------------------------------
  * HISTORY:
  *
+ * 2020-10-03  (Sebastian Pipping)
+ *   - Drop support for Visual Studio 9.0/2008 and earlier
+ *
  * 2019-08-03  (Sebastian Pipping)
  *   - Mark part of sip24_valid as to be excluded from clang-format
  *   - Re-format code using clang-format 9
@@ -96,15 +99,7 @@
 #define SIPHASH_H
 
 #include <stddef.h> /* size_t */
-
-#if defined(_WIN32) && defined(_MSC_VER) && (_MSC_VER < 1600)
-/* For vs2003/7.1 up to vs2008/9.0; _MSC_VER 1600 is vs2010/10.0 */
-typedef unsigned __int8 uint8_t;
-typedef unsigned __int32 uint32_t;
-typedef unsigned __int64 uint64_t;
-#else
-#  include <stdint.h> /* uint64_t uint32_t uint8_t */
-#endif
+#include <stdint.h> /* uint64_t uint32_t uint8_t */
 
 /*
  * Workaround to not require a C++11 compiler for using ULL suffix
diff --git a/Modules/expat/utf8tab.h b/Modules/expat/utf8tab.h
index a22986a..88efcf9 100644
--- a/Modules/expat/utf8tab.h
+++ b/Modules/expat/utf8tab.h
@@ -7,7 +7,9 @@
                                  |_| XML parser
 
    Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
-   Copyright (c) 2000-2017 Expat development team
+   Copyright (c) 2000      Clark Cooper <coopercc@users.sourceforge.net>
+   Copyright (c) 2002      Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
+   Copyright (c) 2017      Sebastian Pipping <sebastian@pipping.org>
    Licensed under the MIT license:
 
    Permission is  hereby granted,  free of charge,  to any  person obtaining
diff --git a/Modules/expat/winconfig.h b/Modules/expat/winconfig.h
index 562a4a8..2ecd61b 100644
--- a/Modules/expat/winconfig.h
+++ b/Modules/expat/winconfig.h
@@ -6,8 +6,10 @@
                         \___/_/\_\ .__/ \__,_|\__|
                                  |_| XML parser
 
-   Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
-   Copyright (c) 2000-2017 Expat development team
+   Copyright (c) 2000      Clark Cooper <coopercc@users.sourceforge.net>
+   Copyright (c) 2002      Greg Stein <gstein@users.sourceforge.net>
+   Copyright (c) 2005      Karl Waclawek <karl@waclawek.net>
+   Copyright (c) 2017-2021 Sebastian Pipping <sebastian@pipping.org>
    Licensed under the MIT license:
 
    Permission is  hereby granted,  free of charge,  to any  person obtaining
@@ -40,17 +42,4 @@
 #include <memory.h>
 #include <string.h>
 
-#if defined(HAVE_EXPAT_CONFIG_H) /* e.g. MinGW */
-#  include <expat_config.h>
-#else /* !defined(HAVE_EXPAT_CONFIG_H) */
-
-#  define XML_NS 1
-#  define XML_DTD 1
-#  define XML_CONTEXT_BYTES 1024
-
-/* we will assume all Windows platforms are little endian */
-#  define BYTEORDER 1234
-
-#endif /* !defined(HAVE_EXPAT_CONFIG_H) */
-
 #endif /* ndef WINCONFIG_H */
diff --git a/Modules/expat/xmlparse.c b/Modules/expat/xmlparse.c
index e740f0e..05216d9 100644
--- a/Modules/expat/xmlparse.c
+++ b/Modules/expat/xmlparse.c
@@ -1,4 +1,4 @@
-/* f2d0ab6d1d4422a08cf1cf3bbdfba96b49dea42fb5ff4615e03a2a25c306e769 (2.2.8+)
+/* fcb1a62fefa945567301146eb98e3ad3413e823a41c4378e84e8b6b6f308d824 (2.4.7+)
                             __  __            _
                          ___\ \/ /_ __   __ _| |_
                         / _ \\  /| '_ \ / _` | __|
@@ -7,7 +7,34 @@
                                  |_| XML parser
 
    Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
-   Copyright (c) 2000-2017 Expat development team
+   Copyright (c) 2000      Clark Cooper <coopercc@users.sourceforge.net>
+   Copyright (c) 2000-2006 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
+   Copyright (c) 2001-2002 Greg Stein <gstein@users.sourceforge.net>
+   Copyright (c) 2002-2016 Karl Waclawek <karl@waclawek.net>
+   Copyright (c) 2005-2009 Steven Solie <steven@solie.ca>
+   Copyright (c) 2016      Eric Rahm <erahm@mozilla.com>
+   Copyright (c) 2016-2022 Sebastian Pipping <sebastian@pipping.org>
+   Copyright (c) 2016      Gaurav <g.gupta@samsung.com>
+   Copyright (c) 2016      Thomas Beutlich <tc@tbeu.de>
+   Copyright (c) 2016      Gustavo Grieco <gustavo.grieco@imag.fr>
+   Copyright (c) 2016      Pascal Cuoq <cuoq@trust-in-soft.com>
+   Copyright (c) 2016      Ed Schouten <ed@nuxi.nl>
+   Copyright (c) 2017-2018 Rhodri James <rhodri@wildebeest.org.uk>
+   Copyright (c) 2017      Václav Slavík <vaclav@slavik.io>
+   Copyright (c) 2017      Viktor Szakats <commit@vsz.me>
+   Copyright (c) 2017      Chanho Park <chanho61.park@samsung.com>
+   Copyright (c) 2017      Rolf Eike Beer <eike@sf-mail.de>
+   Copyright (c) 2017      Hans Wennborg <hans@chromium.org>
+   Copyright (c) 2018      Anton Maklakov <antmak.pub@gmail.com>
+   Copyright (c) 2018      Benjamin Peterson <benjamin@python.org>
+   Copyright (c) 2018      Marco Maggi <marco.maggi-ipsu@poste.it>
+   Copyright (c) 2018      Mariusz Zaborski <oshogbo@vexillium.org>
+   Copyright (c) 2019      David Loffredo <loffredo@steptools.com>
+   Copyright (c) 2019-2020 Ben Wagner <bungeman@chromium.org>
+   Copyright (c) 2019      Vadim Zeitlin <vadim@zeitlins.org>
+   Copyright (c) 2021      Dong-hee Na <donghee.na@python.org>
+   Copyright (c) 2022      Samanta Navarro <ferivoz@riseup.net>
+   Copyright (c) 2022      Jeffrey Walton <noloader@gmail.com>
    Licensed under the MIT license:
 
    Permission is  hereby granted,  free of charge,  to any  person obtaining
@@ -30,13 +57,19 @@
    USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
 
+#define XML_BUILDING_EXPAT 1
+
+#include <expat_config.h>
+
 #if ! defined(_GNU_SOURCE)
 #  define _GNU_SOURCE 1 /* syscall prototype */
 #endif
 
 #ifdef _WIN32
 /* force stdlib to define rand_s() */
-#  define _CRT_RAND_S
+#  if ! defined(_CRT_RAND_S)
+#    define _CRT_RAND_S
+#  endif
 #endif
 
 #include <stddef.h>
@@ -45,6 +78,8 @@
 #include <limits.h> /* UINT_MAX */
 #include <stdio.h>  /* fprintf */
 #include <stdlib.h> /* getenv, rand_s */
+#include <stdint.h> /* uintptr_t */
+#include <math.h>   /* isnan */
 
 #ifdef _WIN32
 #  define getpid GetCurrentProcessId
@@ -56,13 +91,9 @@
 #  include <errno.h>
 #endif
 
-#define XML_BUILDING_EXPAT 1
-
 #ifdef _WIN32
 #  include "winconfig.h"
-#elif defined(HAVE_EXPAT_CONFIG_H)
-#  include <expat_config.h>
-#endif /* ndef _WIN32 */
+#endif
 
 #include "ascii.h"
 #include "expat.h"
@@ -97,14 +128,14 @@
     enabled.  For end user security, that is probably not what you want. \
     \
     Your options include: \
-      * Linux + glibc >=2.25 (getrandom): HAVE_GETRANDOM, \
-      * Linux + glibc <2.25 (syscall SYS_getrandom): HAVE_SYSCALL_GETRANDOM, \
+      * Linux >=3.17 + glibc >=2.25 (getrandom): HAVE_GETRANDOM, \
+      * Linux >=3.17 + glibc (including <2.25) (syscall SYS_getrandom): HAVE_SYSCALL_GETRANDOM, \
       * BSD / macOS >=10.7 (arc4random_buf): HAVE_ARC4RANDOM_BUF, \
-      * BSD / macOS <10.7 (arc4random): HAVE_ARC4RANDOM, \
+      * BSD / macOS (including <10.7) (arc4random): HAVE_ARC4RANDOM, \
       * libbsd (arc4random_buf): HAVE_ARC4RANDOM_BUF + HAVE_LIBBSD, \
       * libbsd (arc4random): HAVE_ARC4RANDOM + HAVE_LIBBSD, \
-      * Linux / BSD / macOS (/dev/urandom): XML_DEV_URANDOM \
-      * Windows (rand_s): _WIN32. \
+      * Linux (including <3.17) / BSD / macOS (including <10.7) / Solaris >=8 (/dev/urandom): XML_DEV_URANDOM, \
+      * Windows >=Vista (rand_s): _WIN32. \
     \
     If insist on not using any of these, bypass this error by defining \
     XML_POOR_ENTROPY; you have been warned. \
@@ -119,9 +150,7 @@
 #  define XmlGetInternalEncoding XmlGetUtf16InternalEncoding
 #  define XmlGetInternalEncodingNS XmlGetUtf16InternalEncodingNS
 #  define XmlEncode XmlUtf16Encode
-/* Using pointer subtraction to convert to integer type. */
-#  define MUST_CONVERT(enc, s)                                                 \
-    (! (enc)->isUtf16 || (((char *)(s) - (char *)NULL) & 1))
+#  define MUST_CONVERT(enc, s) (! (enc)->isUtf16 || (((uintptr_t)(s)) & 1))
 typedef unsigned short ICHAR;
 #else
 #  define XML_ENCODE_MAX XML_UTF8_ENCODE_MAX
@@ -371,6 +400,31 @@
   XML_Bool betweenDecl; /* WFC: PE Between Declarations */
 } OPEN_INTERNAL_ENTITY;
 
+enum XML_Account {
+  XML_ACCOUNT_DIRECT,           /* bytes directly passed to the Expat parser */
+  XML_ACCOUNT_ENTITY_EXPANSION, /* intermediate bytes produced during entity
+                                   expansion */
+  XML_ACCOUNT_NONE              /* i.e. do not account, was accounted already */
+};
+
+#ifdef XML_DTD
+typedef unsigned long long XmlBigCount;
+typedef struct accounting {
+  XmlBigCount countBytesDirect;
+  XmlBigCount countBytesIndirect;
+  int debugLevel;
+  float maximumAmplificationFactor; // >=1.0
+  unsigned long long activationThresholdBytes;
+} ACCOUNTING;
+
+typedef struct entity_stats {
+  unsigned int countEverOpened;
+  unsigned int currentDepth;
+  unsigned int maximumDepthSeen;
+  int debugLevel;
+} ENTITY_STATS;
+#endif /* XML_DTD */
+
 typedef enum XML_Error PTRCALL Processor(XML_Parser parser, const char *start,
                                          const char *end, const char **endPtr);
 
@@ -401,16 +455,18 @@
 static enum XML_Error doProlog(XML_Parser parser, const ENCODING *enc,
                                const char *s, const char *end, int tok,
                                const char *next, const char **nextPtr,
-                               XML_Bool haveMore, XML_Bool allowClosingDoctype);
+                               XML_Bool haveMore, XML_Bool allowClosingDoctype,
+                               enum XML_Account account);
 static enum XML_Error processInternalEntity(XML_Parser parser, ENTITY *entity,
                                             XML_Bool betweenDecl);
 static enum XML_Error doContent(XML_Parser parser, int startTagLevel,
                                 const ENCODING *enc, const char *start,
                                 const char *end, const char **endPtr,
-                                XML_Bool haveMore);
+                                XML_Bool haveMore, enum XML_Account account);
 static enum XML_Error doCdataSection(XML_Parser parser, const ENCODING *,
                                      const char **startPtr, const char *end,
-                                     const char **nextPtr, XML_Bool haveMore);
+                                     const char **nextPtr, XML_Bool haveMore,
+                                     enum XML_Account account);
 #ifdef XML_DTD
 static enum XML_Error doIgnoreSection(XML_Parser parser, const ENCODING *,
                                       const char **startPtr, const char *end,
@@ -420,7 +476,8 @@
 static void freeBindings(XML_Parser parser, BINDING *bindings);
 static enum XML_Error storeAtts(XML_Parser parser, const ENCODING *,
                                 const char *s, TAG_NAME *tagNamePtr,
-                                BINDING **bindingsPtr);
+                                BINDING **bindingsPtr,
+                                enum XML_Account account);
 static enum XML_Error addBinding(XML_Parser parser, PREFIX *prefix,
                                  const ATTRIBUTE_ID *attId, const XML_Char *uri,
                                  BINDING **bindingsPtr);
@@ -429,15 +486,18 @@
                            XML_Parser parser);
 static enum XML_Error storeAttributeValue(XML_Parser parser, const ENCODING *,
                                           XML_Bool isCdata, const char *,
-                                          const char *, STRING_POOL *);
+                                          const char *, STRING_POOL *,
+                                          enum XML_Account account);
 static enum XML_Error appendAttributeValue(XML_Parser parser, const ENCODING *,
                                            XML_Bool isCdata, const char *,
-                                           const char *, STRING_POOL *);
+                                           const char *, STRING_POOL *,
+                                           enum XML_Account account);
 static ATTRIBUTE_ID *getAttributeId(XML_Parser parser, const ENCODING *enc,
                                     const char *start, const char *end);
 static int setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *);
 static enum XML_Error storeEntityValue(XML_Parser parser, const ENCODING *enc,
-                                       const char *start, const char *end);
+                                       const char *start, const char *end,
+                                       enum XML_Account account);
 static int reportProcessingInstruction(XML_Parser parser, const ENCODING *enc,
                                        const char *start, const char *end);
 static int reportComment(XML_Parser parser, const ENCODING *enc,
@@ -501,6 +561,34 @@
 
 static void parserInit(XML_Parser parser, const XML_Char *encodingName);
 
+#ifdef XML_DTD
+static float accountingGetCurrentAmplification(XML_Parser rootParser);
+static void accountingReportStats(XML_Parser originParser, const char *epilog);
+static void accountingOnAbort(XML_Parser originParser);
+static void accountingReportDiff(XML_Parser rootParser,
+                                 unsigned int levelsAwayFromRootParser,
+                                 const char *before, const char *after,
+                                 ptrdiff_t bytesMore, int source_line,
+                                 enum XML_Account account);
+static XML_Bool accountingDiffTolerated(XML_Parser originParser, int tok,
+                                        const char *before, const char *after,
+                                        int source_line,
+                                        enum XML_Account account);
+
+static void entityTrackingReportStats(XML_Parser parser, ENTITY *entity,
+                                      const char *action, int sourceLine);
+static void entityTrackingOnOpen(XML_Parser parser, ENTITY *entity,
+                                 int sourceLine);
+static void entityTrackingOnClose(XML_Parser parser, ENTITY *entity,
+                                  int sourceLine);
+
+static XML_Parser getRootParserOf(XML_Parser parser,
+                                  unsigned int *outLevelDiff);
+#endif /* XML_DTD */
+
+static unsigned long getDebugLevel(const char *variableName,
+                                   unsigned long defaultDebugLevel);
+
 #define poolStart(pool) ((pool)->start)
 #define poolEnd(pool) ((pool)->ptr)
 #define poolLength(pool) ((pool)->ptr - (pool)->start)
@@ -614,6 +702,10 @@
   enum XML_ParamEntityParsing m_paramEntityParsing;
 #endif
   unsigned long m_hash_secret_salt;
+#ifdef XML_DTD
+  ACCOUNTING m_accounting;
+  ENTITY_STATS m_entity_stats;
+#endif
 };
 
 #define MALLOC(parser, s) (parser->m_mem.malloc_fcn((s)))
@@ -627,11 +719,11 @@
 
 XML_Parser XMLCALL
 XML_ParserCreateNS(const XML_Char *encodingName, XML_Char nsSep) {
-  XML_Char tmp[2];
-  *tmp = nsSep;
+  XML_Char tmp[2] = {nsSep, 0};
   return XML_ParserCreate_MM(encodingName, NULL, tmp);
 }
 
+// "xml=http://www.w3.org/XML/1998/namespace"
 static const XML_Char implicitContext[]
     = {ASCII_x,     ASCII_m,     ASCII_l,      ASCII_EQUALS, ASCII_h,
        ASCII_t,     ASCII_t,     ASCII_p,      ASCII_COLON,  ASCII_SLASH,
@@ -734,6 +826,15 @@
 
 #ifdef _WIN32
 
+/* Provide declaration of rand_s() for MinGW-32 (not 64, which has it),
+   as it didn't declare it in its header prior to version 5.3.0 of its
+   runtime package (mingwrt, containing stdlib.h).  The upstream fix
+   was introduced at https://osdn.net/projects/mingw/ticket/39658 . */
+#  if defined(__MINGW32__) && defined(__MINGW32_VERSION)                       \
+      && __MINGW32_VERSION < 5003000L && ! defined(__MINGW64_VERSION_MAJOR)
+__declspec(dllimport) int rand_s(unsigned int *);
+#  endif
+
 /* Obtain entropy on Windows using the rand_s() function which
  * generates cryptographically secure random numbers.  Internally it
  * uses RtlGenRandom API which is present in Windows XP and later.
@@ -789,9 +890,8 @@
 
 static unsigned long
 ENTROPY_DEBUG(const char *label, unsigned long entropy) {
-  const char *const EXPAT_ENTROPY_DEBUG = getenv("EXPAT_ENTROPY_DEBUG");
-  if (EXPAT_ENTROPY_DEBUG && ! strcmp(EXPAT_ENTROPY_DEBUG, "1")) {
-    fprintf(stderr, "Entropy: %s --> 0x%0*lx (%lu bytes)\n", label,
+  if (getDebugLevel("EXPAT_ENTROPY_DEBUG", 0) >= 1u) {
+    fprintf(stderr, "expat: Entropy: %s --> 0x%0*lx (%lu bytes)\n", label,
             (int)sizeof(entropy) * 2, entropy, (unsigned long)sizeof(entropy));
   }
   return entropy;
@@ -876,7 +976,7 @@
 
   if (memsuite) {
     XML_Memory_Handling_Suite *mtemp;
-    parser = (XML_Parser)memsuite->malloc_fcn(sizeof(struct XML_ParserStruct));
+    parser = memsuite->malloc_fcn(sizeof(struct XML_ParserStruct));
     if (parser != NULL) {
       mtemp = (XML_Memory_Handling_Suite *)&(parser->m_mem);
       mtemp->malloc_fcn = memsuite->malloc_fcn;
@@ -1053,6 +1153,18 @@
   parser->m_paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER;
 #endif
   parser->m_hash_secret_salt = 0;
+
+#ifdef XML_DTD
+  memset(&parser->m_accounting, 0, sizeof(ACCOUNTING));
+  parser->m_accounting.debugLevel = getDebugLevel("EXPAT_ACCOUNTING_DEBUG", 0u);
+  parser->m_accounting.maximumAmplificationFactor
+      = EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT;
+  parser->m_accounting.activationThresholdBytes
+      = EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT;
+
+  memset(&parser->m_entity_stats, 0, sizeof(ENTITY_STATS));
+  parser->m_entity_stats.debugLevel = getDebugLevel("EXPAT_ENTITY_DEBUG", 0u);
+#endif
 }
 
 /* moves list of bindings to m_freeBindingList */
@@ -1233,8 +1345,7 @@
      would be otherwise.
   */
   if (parser->m_ns) {
-    XML_Char tmp[2];
-    *tmp = parser->m_namespaceSeparator;
+    XML_Char tmp[2] = {parser->m_namespaceSeparator, 0};
     parser = parserCreate(encodingName, &parser->m_mem, tmp, newDtd);
   } else {
     parser = parserCreate(encodingName, &parser->m_mem, NULL, newDtd);
@@ -1399,6 +1510,7 @@
   parser->m_useForeignDTD = useDTD;
   return XML_ERROR_NONE;
 #else
+  UNUSED_P(useDTD);
   return XML_ERROR_FEATURE_REQUIRES_XML_DTD;
 #endif
 }
@@ -1780,7 +1892,7 @@
     int nLeftOver;
     enum XML_Status result;
     /* Detect overflow (a+b > MAX <==> b > MAX-a) */
-    if (len > ((XML_Size)-1) / 2 - parser->m_parseEndByteIndex) {
+    if ((XML_Size)len > ((XML_Size)-1) / 2 - parser->m_parseEndByteIndex) {
       parser->m_errorCode = XML_ERROR_NO_MEMORY;
       parser->m_eventPtr = parser->m_eventEndPtr = NULL;
       parser->m_processor = errorProcessor;
@@ -1872,6 +1984,12 @@
     parser->m_errorCode = XML_ERROR_FINISHED;
     return XML_STATUS_ERROR;
   case XML_INITIALIZED:
+    /* Has someone called XML_GetBuffer successfully before? */
+    if (! parser->m_bufferPtr) {
+      parser->m_errorCode = XML_ERROR_NO_BUFFER;
+      return XML_STATUS_ERROR;
+    }
+
     if (parser->m_parentParser == NULL && ! startParsing(parser)) {
       parser->m_errorCode = XML_ERROR_NO_MEMORY;
       return XML_STATUS_ERROR;
@@ -1950,6 +2068,11 @@
     keep = (int)EXPAT_SAFE_PTR_DIFF(parser->m_bufferPtr, parser->m_buffer);
     if (keep > XML_CONTEXT_BYTES)
       keep = XML_CONTEXT_BYTES;
+    /* Detect and prevent integer overflow */
+    if (keep > INT_MAX - neededSize) {
+      parser->m_errorCode = XML_ERROR_NO_MEMORY;
+      return NULL;
+    }
     neededSize += keep;
 #endif /* defined XML_CONTEXT_BYTES */
     if (neededSize
@@ -2155,7 +2278,7 @@
   (void)offset;
   (void)size;
 #endif /* defined XML_CONTEXT_BYTES */
-  return (char *)0;
+  return (const char *)0;
 }
 
 XML_Size XMLCALL
@@ -2316,6 +2439,14 @@
   /* Added in 2.2.5. */
   case XML_ERROR_INVALID_ARGUMENT: /* Constant added in 2.2.1, already */
     return XML_L("invalid argument");
+    /* Added in 2.3.0. */
+  case XML_ERROR_NO_BUFFER:
+    return XML_L(
+        "a successful prior call to function XML_GetBuffer is required");
+  /* Added in 2.4.0. */
+  case XML_ERROR_AMPLIFICATION_LIMIT_BREACH:
+    return XML_L(
+        "limit on input amplification factor (from DTD and entities) breached");
   }
   return NULL;
 }
@@ -2352,41 +2483,75 @@
 
 const XML_Feature *XMLCALL
 XML_GetFeatureList(void) {
-  static const XML_Feature features[]
-      = {{XML_FEATURE_SIZEOF_XML_CHAR, XML_L("sizeof(XML_Char)"),
-          sizeof(XML_Char)},
-         {XML_FEATURE_SIZEOF_XML_LCHAR, XML_L("sizeof(XML_LChar)"),
-          sizeof(XML_LChar)},
+  static const XML_Feature features[] = {
+      {XML_FEATURE_SIZEOF_XML_CHAR, XML_L("sizeof(XML_Char)"),
+       sizeof(XML_Char)},
+      {XML_FEATURE_SIZEOF_XML_LCHAR, XML_L("sizeof(XML_LChar)"),
+       sizeof(XML_LChar)},
 #ifdef XML_UNICODE
-         {XML_FEATURE_UNICODE, XML_L("XML_UNICODE"), 0},
+      {XML_FEATURE_UNICODE, XML_L("XML_UNICODE"), 0},
 #endif
 #ifdef XML_UNICODE_WCHAR_T
-         {XML_FEATURE_UNICODE_WCHAR_T, XML_L("XML_UNICODE_WCHAR_T"), 0},
+      {XML_FEATURE_UNICODE_WCHAR_T, XML_L("XML_UNICODE_WCHAR_T"), 0},
 #endif
 #ifdef XML_DTD
-         {XML_FEATURE_DTD, XML_L("XML_DTD"), 0},
+      {XML_FEATURE_DTD, XML_L("XML_DTD"), 0},
 #endif
 #ifdef XML_CONTEXT_BYTES
-         {XML_FEATURE_CONTEXT_BYTES, XML_L("XML_CONTEXT_BYTES"),
-          XML_CONTEXT_BYTES},
+      {XML_FEATURE_CONTEXT_BYTES, XML_L("XML_CONTEXT_BYTES"),
+       XML_CONTEXT_BYTES},
 #endif
 #ifdef XML_MIN_SIZE
-         {XML_FEATURE_MIN_SIZE, XML_L("XML_MIN_SIZE"), 0},
+      {XML_FEATURE_MIN_SIZE, XML_L("XML_MIN_SIZE"), 0},
 #endif
 #ifdef XML_NS
-         {XML_FEATURE_NS, XML_L("XML_NS"), 0},
+      {XML_FEATURE_NS, XML_L("XML_NS"), 0},
 #endif
 #ifdef XML_LARGE_SIZE
-         {XML_FEATURE_LARGE_SIZE, XML_L("XML_LARGE_SIZE"), 0},
+      {XML_FEATURE_LARGE_SIZE, XML_L("XML_LARGE_SIZE"), 0},
 #endif
 #ifdef XML_ATTR_INFO
-         {XML_FEATURE_ATTR_INFO, XML_L("XML_ATTR_INFO"), 0},
+      {XML_FEATURE_ATTR_INFO, XML_L("XML_ATTR_INFO"), 0},
 #endif
-         {XML_FEATURE_END, NULL, 0}};
+#ifdef XML_DTD
+      /* Added in Expat 2.4.0. */
+      {XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT,
+       XML_L("XML_BLAP_MAX_AMP"),
+       (long int)
+           EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT},
+      {XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT,
+       XML_L("XML_BLAP_ACT_THRES"),
+       EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT},
+#endif
+      {XML_FEATURE_END, NULL, 0}};
 
   return features;
 }
 
+#ifdef XML_DTD
+XML_Bool XMLCALL
+XML_SetBillionLaughsAttackProtectionMaximumAmplification(
+    XML_Parser parser, float maximumAmplificationFactor) {
+  if ((parser == NULL) || (parser->m_parentParser != NULL)
+      || isnan(maximumAmplificationFactor)
+      || (maximumAmplificationFactor < 1.0f)) {
+    return XML_FALSE;
+  }
+  parser->m_accounting.maximumAmplificationFactor = maximumAmplificationFactor;
+  return XML_TRUE;
+}
+
+XML_Bool XMLCALL
+XML_SetBillionLaughsAttackProtectionActivationThreshold(
+    XML_Parser parser, unsigned long long activationThresholdBytes) {
+  if ((parser == NULL) || (parser->m_parentParser != NULL)) {
+    return XML_FALSE;
+  }
+  parser->m_accounting.activationThresholdBytes = activationThresholdBytes;
+  return XML_TRUE;
+}
+#endif /* XML_DTD */
+
 /* Initially tag->rawName always points into the parse buffer;
    for those TAG instances opened while the current parse buffer was
    processed, and not yet closed, we need to store tag->rawName in a more
@@ -2398,6 +2563,7 @@
   while (tag) {
     int bufSize;
     int nameLen = sizeof(XML_Char) * (tag->name.strLen + 1);
+    size_t rawNameLen;
     char *rawNameBuf = tag->buf + nameLen;
     /* Stop if already stored.  Since m_tagStack is a stack, we can stop
        at the first entry that has already been copied; everything
@@ -2409,7 +2575,11 @@
     /* For re-use purposes we need to ensure that the
        size of tag->buf is a multiple of sizeof(XML_Char).
     */
-    bufSize = nameLen + ROUND_UP(tag->rawNameLength, sizeof(XML_Char));
+    rawNameLen = ROUND_UP(tag->rawNameLength, sizeof(XML_Char));
+    /* Detect and prevent integer overflow. */
+    if (rawNameLen > (size_t)INT_MAX - nameLen)
+      return XML_FALSE;
+    bufSize = nameLen + (int)rawNameLen;
     if (bufSize > tag->bufEnd - tag->buf) {
       char *temp = (char *)REALLOC(parser, tag->buf, bufSize);
       if (temp == NULL)
@@ -2439,9 +2609,9 @@
 static enum XML_Error PTRCALL
 contentProcessor(XML_Parser parser, const char *start, const char *end,
                  const char **endPtr) {
-  enum XML_Error result
-      = doContent(parser, 0, parser->m_encoding, start, end, endPtr,
-                  (XML_Bool)! parser->m_parsingStatus.finalBuffer);
+  enum XML_Error result = doContent(
+      parser, 0, parser->m_encoding, start, end, endPtr,
+      (XML_Bool)! parser->m_parsingStatus.finalBuffer, XML_ACCOUNT_DIRECT);
   if (result == XML_ERROR_NONE) {
     if (! storeRawNames(parser))
       return XML_ERROR_NO_MEMORY;
@@ -2466,6 +2636,14 @@
   int tok = XmlContentTok(parser->m_encoding, start, end, &next);
   switch (tok) {
   case XML_TOK_BOM:
+#ifdef XML_DTD
+    if (! accountingDiffTolerated(parser, tok, start, next, __LINE__,
+                                  XML_ACCOUNT_DIRECT)) {
+      accountingOnAbort(parser);
+      return XML_ERROR_AMPLIFICATION_LIMIT_BREACH;
+    }
+#endif /* XML_DTD */
+
     /* If we are at the end of the buffer, this would cause the next stage,
        i.e. externalEntityInitProcessor3, to pass control directly to
        doContent (by detecting XML_TOK_NONE) without processing any xml text
@@ -2503,6 +2681,10 @@
   const char *next = start; /* XmlContentTok doesn't always set the last arg */
   parser->m_eventPtr = start;
   tok = XmlContentTok(parser->m_encoding, start, end, &next);
+  /* Note: These bytes are accounted later in:
+           - processXmlDecl
+           - externalEntityContentProcessor
+  */
   parser->m_eventEndPtr = next;
 
   switch (tok) {
@@ -2544,7 +2726,8 @@
                                const char *end, const char **endPtr) {
   enum XML_Error result
       = doContent(parser, 1, parser->m_encoding, start, end, endPtr,
-                  (XML_Bool)! parser->m_parsingStatus.finalBuffer);
+                  (XML_Bool)! parser->m_parsingStatus.finalBuffer,
+                  XML_ACCOUNT_ENTITY_EXPANSION);
   if (result == XML_ERROR_NONE) {
     if (! storeRawNames(parser))
       return XML_ERROR_NO_MEMORY;
@@ -2555,7 +2738,7 @@
 static enum XML_Error
 doContent(XML_Parser parser, int startTagLevel, const ENCODING *enc,
           const char *s, const char *end, const char **nextPtr,
-          XML_Bool haveMore) {
+          XML_Bool haveMore, enum XML_Account account) {
   /* save one level of indirection */
   DTD *const dtd = parser->m_dtd;
 
@@ -2573,6 +2756,17 @@
   for (;;) {
     const char *next = s; /* XmlContentTok doesn't always set the last arg */
     int tok = XmlContentTok(enc, s, end, &next);
+#ifdef XML_DTD
+    const char *accountAfter
+        = ((tok == XML_TOK_TRAILING_RSQB) || (tok == XML_TOK_TRAILING_CR))
+              ? (haveMore ? s /* i.e. 0 bytes */ : end)
+              : next;
+    if (! accountingDiffTolerated(parser, tok, s, accountAfter, __LINE__,
+                                  account)) {
+      accountingOnAbort(parser);
+      return XML_ERROR_AMPLIFICATION_LIMIT_BREACH;
+    }
+#endif
     *eventEndPP = next;
     switch (tok) {
     case XML_TOK_TRAILING_CR:
@@ -2628,6 +2822,14 @@
       XML_Char ch = (XML_Char)XmlPredefinedEntityName(
           enc, s + enc->minBytesPerChar, next - enc->minBytesPerChar);
       if (ch) {
+#ifdef XML_DTD
+        /* NOTE: We are replacing 4-6 characters original input for 1 character
+         *       so there is no amplification and hence recording without
+         *       protection. */
+        accountingDiffTolerated(parser, tok, (char *)&ch,
+                                ((char *)&ch) + sizeof(XML_Char), __LINE__,
+                                XML_ACCOUNT_ENTITY_EXPANSION);
+#endif /* XML_DTD */
         if (parser->m_characterDataHandler)
           parser->m_characterDataHandler(parser->m_handlerArg, &ch, 1);
         else if (parser->m_defaultHandler)
@@ -2746,7 +2948,8 @@
       }
       tag->name.str = (XML_Char *)tag->buf;
       *toPtr = XML_T('\0');
-      result = storeAtts(parser, enc, s, &(tag->name), &(tag->bindings));
+      result
+          = storeAtts(parser, enc, s, &(tag->name), &(tag->bindings), account);
       if (result)
         return result;
       if (parser->m_startElementHandler)
@@ -2770,7 +2973,8 @@
       if (! name.str)
         return XML_ERROR_NO_MEMORY;
       poolFinish(&parser->m_tempPool);
-      result = storeAtts(parser, enc, s, &name, &bindings);
+      result = storeAtts(parser, enc, s, &name, &bindings,
+                         XML_ACCOUNT_NONE /* token spans whole start tag */);
       if (result != XML_ERROR_NONE) {
         freeBindings(parser, bindings);
         return result;
@@ -2905,7 +3109,8 @@
       /* END disabled code */
       else if (parser->m_defaultHandler)
         reportDefault(parser, enc, s, next);
-      result = doCdataSection(parser, enc, &next, end, nextPtr, haveMore);
+      result
+          = doCdataSection(parser, enc, &next, end, nextPtr, haveMore, account);
       if (result != XML_ERROR_NONE)
         return result;
       else if (! next) {
@@ -3034,7 +3239,8 @@
 */
 static enum XML_Error
 storeAtts(XML_Parser parser, const ENCODING *enc, const char *attStr,
-          TAG_NAME *tagNamePtr, BINDING **bindingsPtr) {
+          TAG_NAME *tagNamePtr, BINDING **bindingsPtr,
+          enum XML_Account account) {
   DTD *const dtd = parser->m_dtd; /* save one level of indirection */
   ELEMENT_TYPE *elementType;
   int nDefaultAtts;
@@ -3066,13 +3272,38 @@
 
   /* get the attributes from the tokenizer */
   n = XmlGetAttributes(enc, attStr, parser->m_attsSize, parser->m_atts);
+
+  /* Detect and prevent integer overflow */
+  if (n > INT_MAX - nDefaultAtts) {
+    return XML_ERROR_NO_MEMORY;
+  }
+
   if (n + nDefaultAtts > parser->m_attsSize) {
     int oldAttsSize = parser->m_attsSize;
     ATTRIBUTE *temp;
 #ifdef XML_ATTR_INFO
     XML_AttrInfo *temp2;
 #endif
+
+    /* Detect and prevent integer overflow */
+    if ((nDefaultAtts > INT_MAX - INIT_ATTS_SIZE)
+        || (n > INT_MAX - (nDefaultAtts + INIT_ATTS_SIZE))) {
+      return XML_ERROR_NO_MEMORY;
+    }
+
     parser->m_attsSize = n + nDefaultAtts + INIT_ATTS_SIZE;
+
+    /* Detect and prevent integer overflow.
+     * The preprocessor guard addresses the "always false" warning
+     * from -Wtype-limits on platforms where
+     * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
+#if UINT_MAX >= SIZE_MAX
+    if ((unsigned)parser->m_attsSize > (size_t)(-1) / sizeof(ATTRIBUTE)) {
+      parser->m_attsSize = oldAttsSize;
+      return XML_ERROR_NO_MEMORY;
+    }
+#endif
+
     temp = (ATTRIBUTE *)REALLOC(parser, (void *)parser->m_atts,
                                 parser->m_attsSize * sizeof(ATTRIBUTE));
     if (temp == NULL) {
@@ -3081,6 +3312,17 @@
     }
     parser->m_atts = temp;
 #ifdef XML_ATTR_INFO
+    /* Detect and prevent integer overflow.
+     * The preprocessor guard addresses the "always false" warning
+     * from -Wtype-limits on platforms where
+     * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
+#  if UINT_MAX >= SIZE_MAX
+    if ((unsigned)parser->m_attsSize > (size_t)(-1) / sizeof(XML_AttrInfo)) {
+      parser->m_attsSize = oldAttsSize;
+      return XML_ERROR_NO_MEMORY;
+    }
+#  endif
+
     temp2 = (XML_AttrInfo *)REALLOC(parser, (void *)parser->m_attInfo,
                                     parser->m_attsSize * sizeof(XML_AttrInfo));
     if (temp2 == NULL) {
@@ -3144,7 +3386,7 @@
       /* normalize the attribute value */
       result = storeAttributeValue(
           parser, enc, isCdata, parser->m_atts[i].valuePtr,
-          parser->m_atts[i].valueEnd, &parser->m_tempPool);
+          parser->m_atts[i].valueEnd, &parser->m_tempPool, account);
       if (result)
         return result;
       appAtts[attIndex] = poolStart(&parser->m_tempPool);
@@ -3219,7 +3461,13 @@
   if (nPrefixes) {
     int j; /* hash table index */
     unsigned long version = parser->m_nsAttsVersion;
-    int nsAttsSize = (int)1 << parser->m_nsAttsPower;
+
+    /* Detect and prevent invalid shift */
+    if (parser->m_nsAttsPower >= sizeof(unsigned int) * 8 /* bits per byte */) {
+      return XML_ERROR_NO_MEMORY;
+    }
+
+    unsigned int nsAttsSize = 1u << parser->m_nsAttsPower;
     unsigned char oldNsAttsPower = parser->m_nsAttsPower;
     /* size of hash table must be at least 2 * (# of prefixed attributes) */
     if ((nPrefixes << 1)
@@ -3230,7 +3478,28 @@
         ;
       if (parser->m_nsAttsPower < 3)
         parser->m_nsAttsPower = 3;
-      nsAttsSize = (int)1 << parser->m_nsAttsPower;
+
+      /* Detect and prevent invalid shift */
+      if (parser->m_nsAttsPower >= sizeof(nsAttsSize) * 8 /* bits per byte */) {
+        /* Restore actual size of memory in m_nsAtts */
+        parser->m_nsAttsPower = oldNsAttsPower;
+        return XML_ERROR_NO_MEMORY;
+      }
+
+      nsAttsSize = 1u << parser->m_nsAttsPower;
+
+      /* Detect and prevent integer overflow.
+       * The preprocessor guard addresses the "always false" warning
+       * from -Wtype-limits on platforms where
+       * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
+#if UINT_MAX >= SIZE_MAX
+      if (nsAttsSize > (size_t)(-1) / sizeof(NS_ATT)) {
+        /* Restore actual size of memory in m_nsAtts */
+        parser->m_nsAttsPower = oldNsAttsPower;
+        return XML_ERROR_NO_MEMORY;
+      }
+#endif
+
       temp = (NS_ATT *)REALLOC(parser, parser->m_nsAtts,
                                nsAttsSize * sizeof(NS_ATT));
       if (! temp) {
@@ -3388,9 +3657,31 @@
   tagNamePtr->prefixLen = prefixLen;
   for (i = 0; localPart[i++];)
     ; /* i includes null terminator */
+
+  /* Detect and prevent integer overflow */
+  if (binding->uriLen > INT_MAX - prefixLen
+      || i > INT_MAX - (binding->uriLen + prefixLen)) {
+    return XML_ERROR_NO_MEMORY;
+  }
+
   n = i + binding->uriLen + prefixLen;
   if (n > binding->uriAlloc) {
     TAG *p;
+
+    /* Detect and prevent integer overflow */
+    if (n > INT_MAX - EXPAND_SPARE) {
+      return XML_ERROR_NO_MEMORY;
+    }
+    /* Detect and prevent integer overflow.
+     * The preprocessor guard addresses the "always false" warning
+     * from -Wtype-limits on platforms where
+     * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
+#if UINT_MAX >= SIZE_MAX
+    if ((unsigned)(n + EXPAND_SPARE) > (size_t)(-1) / sizeof(XML_Char)) {
+      return XML_ERROR_NO_MEMORY;
+    }
+#endif
+
     uri = (XML_Char *)MALLOC(parser, (n + EXPAND_SPARE) * sizeof(XML_Char));
     if (! uri)
       return XML_ERROR_NO_MEMORY;
@@ -3415,12 +3706,124 @@
   return XML_ERROR_NONE;
 }
 
+static XML_Bool
+is_rfc3986_uri_char(XML_Char candidate) {
+  // For the RFC 3986 ANBF grammar see
+  // https://datatracker.ietf.org/doc/html/rfc3986#appendix-A
+
+  switch (candidate) {
+  // From rule "ALPHA" (uppercase half)
+  case 'A':
+  case 'B':
+  case 'C':
+  case 'D':
+  case 'E':
+  case 'F':
+  case 'G':
+  case 'H':
+  case 'I':
+  case 'J':
+  case 'K':
+  case 'L':
+  case 'M':
+  case 'N':
+  case 'O':
+  case 'P':
+  case 'Q':
+  case 'R':
+  case 'S':
+  case 'T':
+  case 'U':
+  case 'V':
+  case 'W':
+  case 'X':
+  case 'Y':
+  case 'Z':
+
+  // From rule "ALPHA" (lowercase half)
+  case 'a':
+  case 'b':
+  case 'c':
+  case 'd':
+  case 'e':
+  case 'f':
+  case 'g':
+  case 'h':
+  case 'i':
+  case 'j':
+  case 'k':
+  case 'l':
+  case 'm':
+  case 'n':
+  case 'o':
+  case 'p':
+  case 'q':
+  case 'r':
+  case 's':
+  case 't':
+  case 'u':
+  case 'v':
+  case 'w':
+  case 'x':
+  case 'y':
+  case 'z':
+
+  // From rule "DIGIT"
+  case '0':
+  case '1':
+  case '2':
+  case '3':
+  case '4':
+  case '5':
+  case '6':
+  case '7':
+  case '8':
+  case '9':
+
+  // From rule "pct-encoded"
+  case '%':
+
+  // From rule "unreserved"
+  case '-':
+  case '.':
+  case '_':
+  case '~':
+
+  // From rule "gen-delims"
+  case ':':
+  case '/':
+  case '?':
+  case '#':
+  case '[':
+  case ']':
+  case '@':
+
+  // From rule "sub-delims"
+  case '!':
+  case '$':
+  case '&':
+  case '\'':
+  case '(':
+  case ')':
+  case '*':
+  case '+':
+  case ',':
+  case ';':
+  case '=':
+    return XML_TRUE;
+
+  default:
+    return XML_FALSE;
+  }
+}
+
 /* addBinding() overwrites the value of prefix->binding without checking.
    Therefore one must keep track of the old value outside of addBinding().
 */
 static enum XML_Error
 addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId,
            const XML_Char *uri, BINDING **bindingsPtr) {
+  // "http://www.w3.org/XML/1998/namespace"
   static const XML_Char xmlNamespace[]
       = {ASCII_h,      ASCII_t,     ASCII_t,     ASCII_p,      ASCII_COLON,
          ASCII_SLASH,  ASCII_SLASH, ASCII_w,     ASCII_w,      ASCII_w,
@@ -3431,6 +3834,7 @@
          ASCII_e,      ASCII_s,     ASCII_p,     ASCII_a,      ASCII_c,
          ASCII_e,      '\0'};
   static const int xmlLen = (int)sizeof(xmlNamespace) / sizeof(XML_Char) - 1;
+  // "http://www.w3.org/2000/xmlns/"
   static const XML_Char xmlnsNamespace[]
       = {ASCII_h,     ASCII_t,      ASCII_t, ASCII_p, ASCII_COLON,  ASCII_SLASH,
          ASCII_SLASH, ASCII_w,      ASCII_w, ASCII_w, ASCII_PERIOD, ASCII_w,
@@ -3470,6 +3874,29 @@
     if (! mustBeXML && isXMLNS
         && (len > xmlnsLen || uri[len] != xmlnsNamespace[len]))
       isXMLNS = XML_FALSE;
+
+    // NOTE: While Expat does not validate namespace URIs against RFC 3986
+    //       today (and is not REQUIRED to do so with regard to the XML 1.0
+    //       namespaces specification) we have to at least make sure, that
+    //       the application on top of Expat (that is likely splitting expanded
+    //       element names ("qualified names") of form
+    //       "[uri sep] local [sep prefix] '\0'" back into 1, 2 or 3 pieces
+    //       in its element handler code) cannot be confused by an attacker
+    //       putting additional namespace separator characters into namespace
+    //       declarations.  That would be ambiguous and not to be expected.
+    //
+    //       While the HTML API docs of function XML_ParserCreateNS have been
+    //       advising against use of a namespace separator character that can
+    //       appear in a URI for >20 years now, some widespread applications
+    //       are using URI characters (':' (colon) in particular) for a
+    //       namespace separator, in practice.  To keep these applications
+    //       functional, we only reject namespaces URIs containing the
+    //       application-chosen namespace separator if the chosen separator
+    //       is a non-URI character with regard to RFC 3986.
+    if (parser->m_ns && (uri[len] == parser->m_namespaceSeparator)
+        && ! is_rfc3986_uri_char(uri[len])) {
+      return XML_ERROR_SYNTAX;
+    }
   }
   isXML = isXML && len == xmlLen;
   isXMLNS = isXMLNS && len == xmlnsLen;
@@ -3486,6 +3913,21 @@
   if (parser->m_freeBindingList) {
     b = parser->m_freeBindingList;
     if (len > b->uriAlloc) {
+      /* Detect and prevent integer overflow */
+      if (len > INT_MAX - EXPAND_SPARE) {
+        return XML_ERROR_NO_MEMORY;
+      }
+
+      /* Detect and prevent integer overflow.
+       * The preprocessor guard addresses the "always false" warning
+       * from -Wtype-limits on platforms where
+       * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
+#if UINT_MAX >= SIZE_MAX
+      if ((unsigned)(len + EXPAND_SPARE) > (size_t)(-1) / sizeof(XML_Char)) {
+        return XML_ERROR_NO_MEMORY;
+      }
+#endif
+
       XML_Char *temp = (XML_Char *)REALLOC(
           parser, b->uri, sizeof(XML_Char) * (len + EXPAND_SPARE));
       if (temp == NULL)
@@ -3498,6 +3940,21 @@
     b = (BINDING *)MALLOC(parser, sizeof(BINDING));
     if (! b)
       return XML_ERROR_NO_MEMORY;
+
+    /* Detect and prevent integer overflow */
+    if (len > INT_MAX - EXPAND_SPARE) {
+      return XML_ERROR_NO_MEMORY;
+    }
+    /* Detect and prevent integer overflow.
+     * The preprocessor guard addresses the "always false" warning
+     * from -Wtype-limits on platforms where
+     * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
+#if UINT_MAX >= SIZE_MAX
+    if ((unsigned)(len + EXPAND_SPARE) > (size_t)(-1) / sizeof(XML_Char)) {
+      return XML_ERROR_NO_MEMORY;
+    }
+#endif
+
     b->uri
         = (XML_Char *)MALLOC(parser, sizeof(XML_Char) * (len + EXPAND_SPARE));
     if (! b->uri) {
@@ -3533,9 +3990,9 @@
 static enum XML_Error PTRCALL
 cdataSectionProcessor(XML_Parser parser, const char *start, const char *end,
                       const char **endPtr) {
-  enum XML_Error result
-      = doCdataSection(parser, parser->m_encoding, &start, end, endPtr,
-                       (XML_Bool)! parser->m_parsingStatus.finalBuffer);
+  enum XML_Error result = doCdataSection(
+      parser, parser->m_encoding, &start, end, endPtr,
+      (XML_Bool)! parser->m_parsingStatus.finalBuffer, XML_ACCOUNT_DIRECT);
   if (result != XML_ERROR_NONE)
     return result;
   if (start) {
@@ -3555,7 +4012,8 @@
 */
 static enum XML_Error
 doCdataSection(XML_Parser parser, const ENCODING *enc, const char **startPtr,
-               const char *end, const char **nextPtr, XML_Bool haveMore) {
+               const char *end, const char **nextPtr, XML_Bool haveMore,
+               enum XML_Account account) {
   const char *s = *startPtr;
   const char **eventPP;
   const char **eventEndPP;
@@ -3571,8 +4029,16 @@
   *startPtr = NULL;
 
   for (;;) {
-    const char *next;
+    const char *next = s; /* in case of XML_TOK_NONE or XML_TOK_PARTIAL */
     int tok = XmlCdataSectionTok(enc, s, end, &next);
+#ifdef XML_DTD
+    if (! accountingDiffTolerated(parser, tok, s, next, __LINE__, account)) {
+      accountingOnAbort(parser);
+      return XML_ERROR_AMPLIFICATION_LIMIT_BREACH;
+    }
+#else
+    UNUSED_P(account);
+#endif
     *eventEndPP = next;
     switch (tok) {
     case XML_TOK_CDATA_SECT_CLOSE:
@@ -3689,7 +4155,7 @@
 static enum XML_Error
 doIgnoreSection(XML_Parser parser, const ENCODING *enc, const char **startPtr,
                 const char *end, const char **nextPtr, XML_Bool haveMore) {
-  const char *next;
+  const char *next = *startPtr; /* in case of XML_TOK_NONE or XML_TOK_PARTIAL */
   int tok;
   const char *s = *startPtr;
   const char **eventPP;
@@ -3717,6 +4183,13 @@
   *eventPP = s;
   *startPtr = NULL;
   tok = XmlIgnoreSectionTok(enc, s, end, &next);
+#  ifdef XML_DTD
+  if (! accountingDiffTolerated(parser, tok, s, next, __LINE__,
+                                XML_ACCOUNT_DIRECT)) {
+    accountingOnAbort(parser);
+    return XML_ERROR_AMPLIFICATION_LIMIT_BREACH;
+  }
+#  endif
   *eventEndPP = next;
   switch (tok) {
   case XML_TOK_IGNORE_SECT:
@@ -3766,7 +4239,7 @@
   const char *s;
 #ifdef XML_UNICODE
   char encodingBuf[128];
-  /* See comments abount `protoclEncodingName` in parserInit() */
+  /* See comments about `protocolEncodingName` in parserInit() */
   if (! parser->m_protocolEncodingName)
     s = NULL;
   else {
@@ -3801,6 +4274,15 @@
   const char *versionend;
   const XML_Char *storedversion = NULL;
   int standalone = -1;
+
+#ifdef XML_DTD
+  if (! accountingDiffTolerated(parser, XML_TOK_XML_DECL, s, next, __LINE__,
+                                XML_ACCOUNT_DIRECT)) {
+    accountingOnAbort(parser);
+    return XML_ERROR_AMPLIFICATION_LIMIT_BREACH;
+  }
+#endif
+
   if (! (parser->m_ns ? XmlParseXmlDeclNS : XmlParseXmlDecl)(
           isGeneralTextEntity, parser->m_encoding, s, next, &parser->m_eventPtr,
           &version, &versionend, &encodingName, &newEncoding, &standalone)) {
@@ -3950,6 +4432,10 @@
 
   for (;;) {
     tok = XmlPrologTok(parser->m_encoding, start, end, &next);
+    /* Note: Except for XML_TOK_BOM below, these bytes are accounted later in:
+             - storeEntityValue
+             - processXmlDecl
+    */
     parser->m_eventEndPtr = next;
     if (tok <= 0) {
       if (! parser->m_parsingStatus.finalBuffer && tok != XML_TOK_INVALID) {
@@ -3968,7 +4454,8 @@
         break;
       }
       /* found end of entity value - can store it now */
-      return storeEntityValue(parser, parser->m_encoding, s, end);
+      return storeEntityValue(parser, parser->m_encoding, s, end,
+                              XML_ACCOUNT_DIRECT);
     } else if (tok == XML_TOK_XML_DECL) {
       enum XML_Error result;
       result = processXmlDecl(parser, 0, start, next);
@@ -3995,6 +4482,14 @@
     */
     else if (tok == XML_TOK_BOM && next == end
              && ! parser->m_parsingStatus.finalBuffer) {
+#  ifdef XML_DTD
+      if (! accountingDiffTolerated(parser, tok, s, next, __LINE__,
+                                    XML_ACCOUNT_DIRECT)) {
+        accountingOnAbort(parser);
+        return XML_ERROR_AMPLIFICATION_LIMIT_BREACH;
+      }
+#  endif
+
       *nextPtr = next;
       return XML_ERROR_NONE;
     }
@@ -4037,16 +4532,24 @@
   }
   /* This would cause the next stage, i.e. doProlog to be passed XML_TOK_BOM.
      However, when parsing an external subset, doProlog will not accept a BOM
-     as valid, and report a syntax error, so we have to skip the BOM
+     as valid, and report a syntax error, so we have to skip the BOM, and
+     account for the BOM bytes.
   */
   else if (tok == XML_TOK_BOM) {
+    if (! accountingDiffTolerated(parser, tok, s, next, __LINE__,
+                                  XML_ACCOUNT_DIRECT)) {
+      accountingOnAbort(parser);
+      return XML_ERROR_AMPLIFICATION_LIMIT_BREACH;
+    }
+
     s = next;
     tok = XmlPrologTok(parser->m_encoding, s, end, &next);
   }
 
   parser->m_processor = prologProcessor;
   return doProlog(parser, parser->m_encoding, s, end, tok, next, nextPtr,
-                  (XML_Bool)! parser->m_parsingStatus.finalBuffer, XML_TRUE);
+                  (XML_Bool)! parser->m_parsingStatus.finalBuffer, XML_TRUE,
+                  XML_ACCOUNT_DIRECT);
 }
 
 static enum XML_Error PTRCALL
@@ -4059,6 +4562,9 @@
 
   for (;;) {
     tok = XmlPrologTok(enc, start, end, &next);
+    /* Note: These bytes are accounted later in:
+             - storeEntityValue
+    */
     if (tok <= 0) {
       if (! parser->m_parsingStatus.finalBuffer && tok != XML_TOK_INVALID) {
         *nextPtr = s;
@@ -4076,7 +4582,7 @@
         break;
       }
       /* found end of entity value - can store it now */
-      return storeEntityValue(parser, enc, s, end);
+      return storeEntityValue(parser, enc, s, end, XML_ACCOUNT_DIRECT);
     }
     start = next;
   }
@@ -4090,13 +4596,14 @@
   const char *next = s;
   int tok = XmlPrologTok(parser->m_encoding, s, end, &next);
   return doProlog(parser, parser->m_encoding, s, end, tok, next, nextPtr,
-                  (XML_Bool)! parser->m_parsingStatus.finalBuffer, XML_TRUE);
+                  (XML_Bool)! parser->m_parsingStatus.finalBuffer, XML_TRUE,
+                  XML_ACCOUNT_DIRECT);
 }
 
 static enum XML_Error
 doProlog(XML_Parser parser, const ENCODING *enc, const char *s, const char *end,
          int tok, const char *next, const char **nextPtr, XML_Bool haveMore,
-         XML_Bool allowClosingDoctype) {
+         XML_Bool allowClosingDoctype, enum XML_Account account) {
 #ifdef XML_DTD
   static const XML_Char externalSubsetName[] = {ASCII_HASH, '\0'};
 #endif /* XML_DTD */
@@ -4123,6 +4630,10 @@
   static const XML_Char enumValueSep[] = {ASCII_PIPE, '\0'};
   static const XML_Char enumValueStart[] = {ASCII_LPAREN, '\0'};
 
+#ifndef XML_DTD
+  UNUSED_P(account);
+#endif
+
   /* save one level of indirection */
   DTD *const dtd = parser->m_dtd;
 
@@ -4187,6 +4698,19 @@
       }
     }
     role = XmlTokenRole(&parser->m_prologState, tok, s, next, enc);
+#ifdef XML_DTD
+    switch (role) {
+    case XML_ROLE_INSTANCE_START: // bytes accounted in contentProcessor
+    case XML_ROLE_XML_DECL:       // bytes accounted in processXmlDecl
+    case XML_ROLE_TEXT_DECL:      // bytes accounted in processXmlDecl
+      break;
+    default:
+      if (! accountingDiffTolerated(parser, tok, s, next, __LINE__, account)) {
+        accountingOnAbort(parser);
+        return XML_ERROR_AMPLIFICATION_LIMIT_BREACH;
+      }
+    }
+#endif
     switch (role) {
     case XML_ROLE_XML_DECL: {
       enum XML_Error result = processXmlDecl(parser, 0, s, next);
@@ -4462,7 +4986,8 @@
         const XML_Char *attVal;
         enum XML_Error result = storeAttributeValue(
             parser, enc, parser->m_declAttributeIsCdata,
-            s + enc->minBytesPerChar, next - enc->minBytesPerChar, &dtd->pool);
+            s + enc->minBytesPerChar, next - enc->minBytesPerChar, &dtd->pool,
+            XML_ACCOUNT_NONE);
         if (result)
           return result;
         attVal = poolStart(&dtd->pool);
@@ -4495,8 +5020,9 @@
       break;
     case XML_ROLE_ENTITY_VALUE:
       if (dtd->keepProcessing) {
-        enum XML_Error result = storeEntityValue(
-            parser, enc, s + enc->minBytesPerChar, next - enc->minBytesPerChar);
+        enum XML_Error result
+            = storeEntityValue(parser, enc, s + enc->minBytesPerChar,
+                               next - enc->minBytesPerChar, XML_ACCOUNT_NONE);
         if (parser->m_declEntity) {
           parser->m_declEntity->textPtr = poolStart(&dtd->entityValuePool);
           parser->m_declEntity->textLen
@@ -4755,6 +5281,11 @@
       if (parser->m_prologState.level >= parser->m_groupSize) {
         if (parser->m_groupSize) {
           {
+            /* Detect and prevent integer overflow */
+            if (parser->m_groupSize > (unsigned int)(-1) / 2u) {
+              return XML_ERROR_NO_MEMORY;
+            }
+
             char *const new_connector = (char *)REALLOC(
                 parser, parser->m_groupConnector, parser->m_groupSize *= 2);
             if (new_connector == NULL) {
@@ -4765,6 +5296,16 @@
           }
 
           if (dtd->scaffIndex) {
+            /* Detect and prevent integer overflow.
+             * The preprocessor guard addresses the "always false" warning
+             * from -Wtype-limits on platforms where
+             * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
+#if UINT_MAX >= SIZE_MAX
+            if (parser->m_groupSize > (size_t)(-1) / sizeof(int)) {
+              return XML_ERROR_NO_MEMORY;
+            }
+#endif
+
             int *const new_scaff_index = (int *)REALLOC(
                 parser, dtd->scaffIndex, parser->m_groupSize * sizeof(int));
             if (new_scaff_index == NULL)
@@ -4886,12 +5427,15 @@
         if (parser->m_externalEntityRefHandler) {
           dtd->paramEntityRead = XML_FALSE;
           entity->open = XML_TRUE;
+          entityTrackingOnOpen(parser, entity, __LINE__);
           if (! parser->m_externalEntityRefHandler(
                   parser->m_externalEntityRefHandlerArg, 0, entity->base,
                   entity->systemId, entity->publicId)) {
+            entityTrackingOnClose(parser, entity, __LINE__);
             entity->open = XML_FALSE;
             return XML_ERROR_EXTERNAL_ENTITY_HANDLING;
           }
+          entityTrackingOnClose(parser, entity, __LINE__);
           entity->open = XML_FALSE;
           handleDefault = XML_FALSE;
           if (! dtd->paramEntityRead) {
@@ -4970,7 +5514,7 @@
       if (dtd->in_eldecl) {
         ELEMENT_TYPE *el;
         const XML_Char *name;
-        int nameLen;
+        size_t nameLen;
         const char *nxt
             = (quant == XML_CQUANT_NONE ? next : next - enc->minBytesPerChar);
         int myindex = nextScaffoldPart(parser);
@@ -4986,7 +5530,13 @@
         nameLen = 0;
         for (; name[nameLen++];)
           ;
-        dtd->contentStringLen += nameLen;
+
+        /* Detect and prevent integer overflow */
+        if (nameLen > UINT_MAX - dtd->contentStringLen) {
+          return XML_ERROR_NO_MEMORY;
+        }
+
+        dtd->contentStringLen += (unsigned)nameLen;
         if (parser->m_elementDeclHandler)
           handleDefault = XML_FALSE;
       }
@@ -5089,6 +5639,13 @@
   for (;;) {
     const char *next = NULL;
     int tok = XmlPrologTok(parser->m_encoding, s, end, &next);
+#ifdef XML_DTD
+    if (! accountingDiffTolerated(parser, tok, s, next, __LINE__,
+                                  XML_ACCOUNT_DIRECT)) {
+      accountingOnAbort(parser);
+      return XML_ERROR_AMPLIFICATION_LIMIT_BREACH;
+    }
+#endif
     parser->m_eventEndPtr = next;
     switch (tok) {
     /* report partial linebreak - it might be the last token */
@@ -5162,6 +5719,9 @@
       return XML_ERROR_NO_MEMORY;
   }
   entity->open = XML_TRUE;
+#ifdef XML_DTD
+  entityTrackingOnOpen(parser, entity, __LINE__);
+#endif
   entity->processed = 0;
   openEntity->next = parser->m_openInternalEntities;
   parser->m_openInternalEntities = openEntity;
@@ -5170,8 +5730,8 @@
   openEntity->betweenDecl = betweenDecl;
   openEntity->internalEventPtr = NULL;
   openEntity->internalEventEndPtr = NULL;
-  textStart = (char *)entity->textPtr;
-  textEnd = (char *)(entity->textPtr + entity->textLen);
+  textStart = (const char *)entity->textPtr;
+  textEnd = (const char *)(entity->textPtr + entity->textLen);
   /* Set a safe default value in case 'next' does not get set */
   next = textStart;
 
@@ -5180,17 +5740,22 @@
     int tok
         = XmlPrologTok(parser->m_internalEncoding, textStart, textEnd, &next);
     result = doProlog(parser, parser->m_internalEncoding, textStart, textEnd,
-                      tok, next, &next, XML_FALSE, XML_FALSE);
+                      tok, next, &next, XML_FALSE, XML_FALSE,
+                      XML_ACCOUNT_ENTITY_EXPANSION);
   } else
 #endif /* XML_DTD */
     result = doContent(parser, parser->m_tagLevel, parser->m_internalEncoding,
-                       textStart, textEnd, &next, XML_FALSE);
+                       textStart, textEnd, &next, XML_FALSE,
+                       XML_ACCOUNT_ENTITY_EXPANSION);
 
   if (result == XML_ERROR_NONE) {
     if (textEnd != next && parser->m_parsingStatus.parsing == XML_SUSPENDED) {
       entity->processed = (int)(next - textStart);
       parser->m_processor = internalEntityProcessor;
     } else {
+#ifdef XML_DTD
+      entityTrackingOnClose(parser, entity, __LINE__);
+#endif /* XML_DTD */
       entity->open = XML_FALSE;
       parser->m_openInternalEntities = openEntity->next;
       /* put openEntity back in list of free instances */
@@ -5213,8 +5778,8 @@
     return XML_ERROR_UNEXPECTED_STATE;
 
   entity = openEntity->entity;
-  textStart = ((char *)entity->textPtr) + entity->processed;
-  textEnd = (char *)(entity->textPtr + entity->textLen);
+  textStart = ((const char *)entity->textPtr) + entity->processed;
+  textEnd = (const char *)(entity->textPtr + entity->textLen);
   /* Set a safe default value in case 'next' does not get set */
   next = textStart;
 
@@ -5223,20 +5788,24 @@
     int tok
         = XmlPrologTok(parser->m_internalEncoding, textStart, textEnd, &next);
     result = doProlog(parser, parser->m_internalEncoding, textStart, textEnd,
-                      tok, next, &next, XML_FALSE, XML_TRUE);
+                      tok, next, &next, XML_FALSE, XML_TRUE,
+                      XML_ACCOUNT_ENTITY_EXPANSION);
   } else
 #endif /* XML_DTD */
     result = doContent(parser, openEntity->startTagLevel,
                        parser->m_internalEncoding, textStart, textEnd, &next,
-                       XML_FALSE);
+                       XML_FALSE, XML_ACCOUNT_ENTITY_EXPANSION);
 
   if (result != XML_ERROR_NONE)
     return result;
   else if (textEnd != next
            && parser->m_parsingStatus.parsing == XML_SUSPENDED) {
-    entity->processed = (int)(next - (char *)entity->textPtr);
+    entity->processed = (int)(next - (const char *)entity->textPtr);
     return result;
   } else {
+#ifdef XML_DTD
+    entityTrackingOnClose(parser, entity, __LINE__);
+#endif
     entity->open = XML_FALSE;
     parser->m_openInternalEntities = openEntity->next;
     /* put openEntity back in list of free instances */
@@ -5250,7 +5819,8 @@
     parser->m_processor = prologProcessor;
     tok = XmlPrologTok(parser->m_encoding, s, end, &next);
     return doProlog(parser, parser->m_encoding, s, end, tok, next, nextPtr,
-                    (XML_Bool)! parser->m_parsingStatus.finalBuffer, XML_TRUE);
+                    (XML_Bool)! parser->m_parsingStatus.finalBuffer, XML_TRUE,
+                    XML_ACCOUNT_DIRECT);
   } else
 #endif /* XML_DTD */
   {
@@ -5258,7 +5828,8 @@
     /* see externalEntityContentProcessor vs contentProcessor */
     return doContent(parser, parser->m_parentParser ? 1 : 0, parser->m_encoding,
                      s, end, nextPtr,
-                     (XML_Bool)! parser->m_parsingStatus.finalBuffer);
+                     (XML_Bool)! parser->m_parsingStatus.finalBuffer,
+                     XML_ACCOUNT_DIRECT);
   }
 }
 
@@ -5273,9 +5844,10 @@
 
 static enum XML_Error
 storeAttributeValue(XML_Parser parser, const ENCODING *enc, XML_Bool isCdata,
-                    const char *ptr, const char *end, STRING_POOL *pool) {
+                    const char *ptr, const char *end, STRING_POOL *pool,
+                    enum XML_Account account) {
   enum XML_Error result
-      = appendAttributeValue(parser, enc, isCdata, ptr, end, pool);
+      = appendAttributeValue(parser, enc, isCdata, ptr, end, pool, account);
   if (result)
     return result;
   if (! isCdata && poolLength(pool) && poolLastChar(pool) == 0x20)
@@ -5287,11 +5859,23 @@
 
 static enum XML_Error
 appendAttributeValue(XML_Parser parser, const ENCODING *enc, XML_Bool isCdata,
-                     const char *ptr, const char *end, STRING_POOL *pool) {
+                     const char *ptr, const char *end, STRING_POOL *pool,
+                     enum XML_Account account) {
   DTD *const dtd = parser->m_dtd; /* save one level of indirection */
+#ifndef XML_DTD
+  UNUSED_P(account);
+#endif
+
   for (;;) {
-    const char *next;
+    const char *next
+        = ptr; /* XmlAttributeValueTok doesn't always set the last arg */
     int tok = XmlAttributeValueTok(enc, ptr, end, &next);
+#ifdef XML_DTD
+    if (! accountingDiffTolerated(parser, tok, ptr, next, __LINE__, account)) {
+      accountingOnAbort(parser);
+      return XML_ERROR_AMPLIFICATION_LIMIT_BREACH;
+    }
+#endif
     switch (tok) {
     case XML_TOK_NONE:
       return XML_ERROR_NONE;
@@ -5351,6 +5935,14 @@
       XML_Char ch = (XML_Char)XmlPredefinedEntityName(
           enc, ptr + enc->minBytesPerChar, next - enc->minBytesPerChar);
       if (ch) {
+#ifdef XML_DTD
+        /* NOTE: We are replacing 4-6 characters original input for 1 character
+         *       so there is no amplification and hence recording without
+         *       protection. */
+        accountingDiffTolerated(parser, tok, (char *)&ch,
+                                ((char *)&ch) + sizeof(XML_Char), __LINE__,
+                                XML_ACCOUNT_ENTITY_EXPANSION);
+#endif /* XML_DTD */
         if (! poolAppendChar(pool, ch))
           return XML_ERROR_NO_MEMORY;
         break;
@@ -5428,9 +6020,16 @@
         enum XML_Error result;
         const XML_Char *textEnd = entity->textPtr + entity->textLen;
         entity->open = XML_TRUE;
+#ifdef XML_DTD
+        entityTrackingOnOpen(parser, entity, __LINE__);
+#endif
         result = appendAttributeValue(parser, parser->m_internalEncoding,
-                                      isCdata, (char *)entity->textPtr,
-                                      (char *)textEnd, pool);
+                                      isCdata, (const char *)entity->textPtr,
+                                      (const char *)textEnd, pool,
+                                      XML_ACCOUNT_ENTITY_EXPANSION);
+#ifdef XML_DTD
+        entityTrackingOnClose(parser, entity, __LINE__);
+#endif
         entity->open = XML_FALSE;
         if (result)
           return result;
@@ -5460,13 +6059,16 @@
 
 static enum XML_Error
 storeEntityValue(XML_Parser parser, const ENCODING *enc,
-                 const char *entityTextPtr, const char *entityTextEnd) {
+                 const char *entityTextPtr, const char *entityTextEnd,
+                 enum XML_Account account) {
   DTD *const dtd = parser->m_dtd; /* save one level of indirection */
   STRING_POOL *pool = &(dtd->entityValuePool);
   enum XML_Error result = XML_ERROR_NONE;
 #ifdef XML_DTD
   int oldInEntityValue = parser->m_prologState.inEntityValue;
   parser->m_prologState.inEntityValue = 1;
+#else
+  UNUSED_P(account);
 #endif /* XML_DTD */
   /* never return Null for the value argument in EntityDeclHandler,
      since this would indicate an external entity; therefore we
@@ -5477,8 +6079,19 @@
   }
 
   for (;;) {
-    const char *next;
+    const char *next
+        = entityTextPtr; /* XmlEntityValueTok doesn't always set the last arg */
     int tok = XmlEntityValueTok(enc, entityTextPtr, entityTextEnd, &next);
+
+#ifdef XML_DTD
+    if (! accountingDiffTolerated(parser, tok, entityTextPtr, next, __LINE__,
+                                  account)) {
+      accountingOnAbort(parser);
+      result = XML_ERROR_AMPLIFICATION_LIMIT_BREACH;
+      goto endEntityValue;
+    }
+#endif
+
     switch (tok) {
     case XML_TOK_PARAM_ENTITY_REF:
 #ifdef XML_DTD
@@ -5514,13 +6127,16 @@
           if (parser->m_externalEntityRefHandler) {
             dtd->paramEntityRead = XML_FALSE;
             entity->open = XML_TRUE;
+            entityTrackingOnOpen(parser, entity, __LINE__);
             if (! parser->m_externalEntityRefHandler(
                     parser->m_externalEntityRefHandlerArg, 0, entity->base,
                     entity->systemId, entity->publicId)) {
+              entityTrackingOnClose(parser, entity, __LINE__);
               entity->open = XML_FALSE;
               result = XML_ERROR_EXTERNAL_ENTITY_HANDLING;
               goto endEntityValue;
             }
+            entityTrackingOnClose(parser, entity, __LINE__);
             entity->open = XML_FALSE;
             if (! dtd->paramEntityRead)
               dtd->keepProcessing = dtd->standalone;
@@ -5528,9 +6144,12 @@
             dtd->keepProcessing = dtd->standalone;
         } else {
           entity->open = XML_TRUE;
+          entityTrackingOnOpen(parser, entity, __LINE__);
           result = storeEntityValue(
-              parser, parser->m_internalEncoding, (char *)entity->textPtr,
-              (char *)(entity->textPtr + entity->textLen));
+              parser, parser->m_internalEncoding, (const char *)entity->textPtr,
+              (const char *)(entity->textPtr + entity->textLen),
+              XML_ACCOUNT_ENTITY_EXPANSION);
+          entityTrackingOnClose(parser, entity, __LINE__);
           entity->open = XML_FALSE;
           if (result)
             goto endEntityValue;
@@ -5763,7 +6382,24 @@
       }
     } else {
       DEFAULT_ATTRIBUTE *temp;
+
+      /* Detect and prevent integer overflow */
+      if (type->allocDefaultAtts > INT_MAX / 2) {
+        return 0;
+      }
+
       int count = type->allocDefaultAtts * 2;
+
+      /* Detect and prevent integer overflow.
+       * The preprocessor guard addresses the "always false" warning
+       * from -Wtype-limits on platforms where
+       * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
+#if UINT_MAX >= SIZE_MAX
+      if ((unsigned)count > (size_t)(-1) / sizeof(DEFAULT_ATTRIBUTE)) {
+        return 0;
+      }
+#endif
+
       temp = (DEFAULT_ATTRIBUTE *)REALLOC(parser, type->defaultAtts,
                                           (count * sizeof(DEFAULT_ATTRIBUTE)));
       if (temp == NULL)
@@ -6053,7 +6689,7 @@
 
 static DTD *
 dtdCreate(const XML_Memory_Handling_Suite *ms) {
-  DTD *p = (DTD *)ms->malloc_fcn(sizeof(DTD));
+  DTD *p = ms->malloc_fcn(sizeof(DTD));
   if (p == NULL)
     return p;
   poolInit(&(p->pool), ms);
@@ -6226,8 +6862,8 @@
     if (! newE)
       return 0;
     if (oldE->nDefaultAtts) {
-      newE->defaultAtts = (DEFAULT_ATTRIBUTE *)ms->malloc_fcn(
-          oldE->nDefaultAtts * sizeof(DEFAULT_ATTRIBUTE));
+      newE->defaultAtts
+          = ms->malloc_fcn(oldE->nDefaultAtts * sizeof(DEFAULT_ATTRIBUTE));
       if (! newE->defaultAtts) {
         return 0;
       }
@@ -6389,7 +7025,7 @@
     /* table->size is a power of 2 */
     table->size = (size_t)1 << INIT_POWER;
     tsize = table->size * sizeof(NAMED *);
-    table->v = (NAMED **)table->mem->malloc_fcn(tsize);
+    table->v = table->mem->malloc_fcn(tsize);
     if (! table->v) {
       table->size = 0;
       return NULL;
@@ -6414,10 +7050,22 @@
     /* check for overflow (table is half full) */
     if (table->used >> (table->power - 1)) {
       unsigned char newPower = table->power + 1;
+
+      /* Detect and prevent invalid shift */
+      if (newPower >= sizeof(unsigned long) * 8 /* bits per byte */) {
+        return NULL;
+      }
+
       size_t newSize = (size_t)1 << newPower;
       unsigned long newMask = (unsigned long)newSize - 1;
+
+      /* Detect and prevent integer overflow */
+      if (newSize > (size_t)(-1) / sizeof(NAMED *)) {
+        return NULL;
+      }
+
       size_t tsize = newSize * sizeof(NAMED *);
-      NAMED **newV = (NAMED **)table->mem->malloc_fcn(tsize);
+      NAMED **newV = table->mem->malloc_fcn(tsize);
       if (! newV)
         return NULL;
       memset(newV, 0, tsize);
@@ -6446,7 +7094,7 @@
       }
     }
   }
-  table->v[i] = (NAMED *)table->mem->malloc_fcn(createSize);
+  table->v[i] = table->mem->malloc_fcn(createSize);
   if (! table->v[i])
     return NULL;
   memset(table->v[i], 0, createSize);
@@ -6485,7 +7133,7 @@
 static void FASTCALL
 hashTableIterInit(HASH_TABLE_ITER *iter, const HASH_TABLE *table) {
   iter->p = table->v;
-  iter->end = iter->p + table->size;
+  iter->end = iter->p ? iter->p + table->size : NULL;
 }
 
 static NAMED *FASTCALL
@@ -6734,7 +7382,7 @@
     if (bytesToAllocate == 0)
       return XML_FALSE;
 
-    tem = (BLOCK *)pool->mem->malloc_fcn(bytesToAllocate);
+    tem = pool->mem->malloc_fcn(bytesToAllocate);
     if (! tem)
       return XML_FALSE;
     tem->size = blockSize;
@@ -6765,6 +7413,20 @@
   if (dtd->scaffCount >= dtd->scaffSize) {
     CONTENT_SCAFFOLD *temp;
     if (dtd->scaffold) {
+      /* Detect and prevent integer overflow */
+      if (dtd->scaffSize > UINT_MAX / 2u) {
+        return -1;
+      }
+      /* Detect and prevent integer overflow.
+       * The preprocessor guard addresses the "always false" warning
+       * from -Wtype-limits on platforms where
+       * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
+#if UINT_MAX >= SIZE_MAX
+      if (dtd->scaffSize > (size_t)(-1) / 2u / sizeof(CONTENT_SCAFFOLD)) {
+        return -1;
+      }
+#endif
+
       temp = (CONTENT_SCAFFOLD *)REALLOC(
           parser, dtd->scaffold, dtd->scaffSize * 2 * sizeof(CONTENT_SCAFFOLD));
       if (temp == NULL)
@@ -6796,55 +7458,130 @@
   return next;
 }
 
-static void
-build_node(XML_Parser parser, int src_node, XML_Content *dest,
-           XML_Content **contpos, XML_Char **strpos) {
-  DTD *const dtd = parser->m_dtd; /* save one level of indirection */
-  dest->type = dtd->scaffold[src_node].type;
-  dest->quant = dtd->scaffold[src_node].quant;
-  if (dest->type == XML_CTYPE_NAME) {
-    const XML_Char *src;
-    dest->name = *strpos;
-    src = dtd->scaffold[src_node].name;
-    for (;;) {
-      *(*strpos)++ = *src;
-      if (! *src)
-        break;
-      src++;
-    }
-    dest->numchildren = 0;
-    dest->children = NULL;
-  } else {
-    unsigned int i;
-    int cn;
-    dest->numchildren = dtd->scaffold[src_node].childcnt;
-    dest->children = *contpos;
-    *contpos += dest->numchildren;
-    for (i = 0, cn = dtd->scaffold[src_node].firstchild; i < dest->numchildren;
-         i++, cn = dtd->scaffold[cn].nextsib) {
-      build_node(parser, cn, &(dest->children[i]), contpos, strpos);
-    }
-    dest->name = NULL;
-  }
-}
-
 static XML_Content *
 build_model(XML_Parser parser) {
+  /* Function build_model transforms the existing parser->m_dtd->scaffold
+   * array of CONTENT_SCAFFOLD tree nodes into a new array of
+   * XML_Content tree nodes followed by a gapless list of zero-terminated
+   * strings. */
   DTD *const dtd = parser->m_dtd; /* save one level of indirection */
   XML_Content *ret;
-  XML_Content *cpos;
-  XML_Char *str;
-  int allocsize = (dtd->scaffCount * sizeof(XML_Content)
-                   + (dtd->contentStringLen * sizeof(XML_Char)));
+  XML_Char *str; /* the current string writing location */
+
+  /* Detect and prevent integer overflow.
+   * The preprocessor guard addresses the "always false" warning
+   * from -Wtype-limits on platforms where
+   * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
+#if UINT_MAX >= SIZE_MAX
+  if (dtd->scaffCount > (size_t)(-1) / sizeof(XML_Content)) {
+    return NULL;
+  }
+  if (dtd->contentStringLen > (size_t)(-1) / sizeof(XML_Char)) {
+    return NULL;
+  }
+#endif
+  if (dtd->scaffCount * sizeof(XML_Content)
+      > (size_t)(-1) - dtd->contentStringLen * sizeof(XML_Char)) {
+    return NULL;
+  }
+
+  const size_t allocsize = (dtd->scaffCount * sizeof(XML_Content)
+                            + (dtd->contentStringLen * sizeof(XML_Char)));
 
   ret = (XML_Content *)MALLOC(parser, allocsize);
   if (! ret)
     return NULL;
 
-  str = (XML_Char *)(&ret[dtd->scaffCount]);
-  cpos = &ret[1];
+  /* What follows is an iterative implementation (of what was previously done
+   * recursively in a dedicated function called "build_node".  The old recursive
+   * build_node could be forced into stack exhaustion from input as small as a
+   * few megabyte, and so that was a security issue.  Hence, a function call
+   * stack is avoided now by resolving recursion.)
+   *
+   * The iterative approach works as follows:
+   *
+   * - We have two writing pointers, both walking up the result array; one does
+   *   the work, the other creates "jobs" for its colleague to do, and leads
+   *   the way:
+   *
+   *   - The faster one, pointer jobDest, always leads and writes "what job
+   *     to do" by the other, once they reach that place in the
+   *     array: leader "jobDest" stores the source node array index (relative
+   *     to array dtd->scaffold) in field "numchildren".
+   *
+   *   - The slower one, pointer dest, looks at the value stored in the
+   *     "numchildren" field (which actually holds a source node array index
+   *     at that time) and puts the real data from dtd->scaffold in.
+   *
+   * - Before the loop starts, jobDest writes source array index 0
+   *   (where the root node is located) so that dest will have something to do
+   *   when it starts operation.
+   *
+   * - Whenever nodes with children are encountered, jobDest appends
+   *   them as new jobs, in order.  As a result, tree node siblings are
+   *   adjacent in the resulting array, for example:
+   *
+   *     [0] root, has two children
+   *       [1] first child of 0, has three children
+   *         [3] first child of 1, does not have children
+   *         [4] second child of 1, does not have children
+   *         [5] third child of 1, does not have children
+   *       [2] second child of 0, does not have children
+   *
+   *   Or (the same data) presented in flat array view:
+   *
+   *     [0] root, has two children
+   *
+   *     [1] first child of 0, has three children
+   *     [2] second child of 0, does not have children
+   *
+   *     [3] first child of 1, does not have children
+   *     [4] second child of 1, does not have children
+   *     [5] third child of 1, does not have children
+   *
+   * - The algorithm repeats until all target array indices have been processed.
+   */
+  XML_Content *dest = ret; /* tree node writing location, moves upwards */
+  XML_Content *const destLimit = &ret[dtd->scaffCount];
+  XML_Content *jobDest = ret; /* next free writing location in target array */
+  str = (XML_Char *)&ret[dtd->scaffCount];
 
-  build_node(parser, 0, ret, &cpos, &str);
+  /* Add the starting job, the root node (index 0) of the source tree  */
+  (jobDest++)->numchildren = 0;
+
+  for (; dest < destLimit; dest++) {
+    /* Retrieve source tree array index from job storage */
+    const int src_node = (int)dest->numchildren;
+
+    /* Convert item */
+    dest->type = dtd->scaffold[src_node].type;
+    dest->quant = dtd->scaffold[src_node].quant;
+    if (dest->type == XML_CTYPE_NAME) {
+      const XML_Char *src;
+      dest->name = str;
+      src = dtd->scaffold[src_node].name;
+      for (;;) {
+        *str++ = *src;
+        if (! *src)
+          break;
+        src++;
+      }
+      dest->numchildren = 0;
+      dest->children = NULL;
+    } else {
+      unsigned int i;
+      int cn;
+      dest->name = NULL;
+      dest->numchildren = dtd->scaffold[src_node].childcnt;
+      dest->children = jobDest;
+
+      /* Append scaffold indices of children to array */
+      for (i = 0, cn = dtd->scaffold[src_node].firstchild;
+           i < dest->numchildren; i++, cn = dtd->scaffold[cn].nextsib)
+        (jobDest++)->numchildren = (unsigned int)cn;
+    }
+  }
+
   return ret;
 }
 
@@ -6873,7 +7610,7 @@
 
 static XML_Char *
 copyString(const XML_Char *s, const XML_Memory_Handling_Suite *memsuite) {
-  int charsRequired = 0;
+  size_t charsRequired = 0;
   XML_Char *result;
 
   /* First determine how long the string is */
@@ -6891,3 +7628,755 @@
   memcpy(result, s, charsRequired * sizeof(XML_Char));
   return result;
 }
+
+#ifdef XML_DTD
+
+static float
+accountingGetCurrentAmplification(XML_Parser rootParser) {
+  const XmlBigCount countBytesOutput
+      = rootParser->m_accounting.countBytesDirect
+        + rootParser->m_accounting.countBytesIndirect;
+  const float amplificationFactor
+      = rootParser->m_accounting.countBytesDirect
+            ? (countBytesOutput
+               / (float)(rootParser->m_accounting.countBytesDirect))
+            : 1.0f;
+  assert(! rootParser->m_parentParser);
+  return amplificationFactor;
+}
+
+static void
+accountingReportStats(XML_Parser originParser, const char *epilog) {
+  const XML_Parser rootParser = getRootParserOf(originParser, NULL);
+  assert(! rootParser->m_parentParser);
+
+  if (rootParser->m_accounting.debugLevel < 1) {
+    return;
+  }
+
+  const float amplificationFactor
+      = accountingGetCurrentAmplification(rootParser);
+  fprintf(stderr,
+          "expat: Accounting(%p): Direct " EXPAT_FMT_ULL(
+              "10") ", indirect " EXPAT_FMT_ULL("10") ", amplification %8.2f%s",
+          (void *)rootParser, rootParser->m_accounting.countBytesDirect,
+          rootParser->m_accounting.countBytesIndirect,
+          (double)amplificationFactor, epilog);
+}
+
+static void
+accountingOnAbort(XML_Parser originParser) {
+  accountingReportStats(originParser, " ABORTING\n");
+}
+
+static void
+accountingReportDiff(XML_Parser rootParser,
+                     unsigned int levelsAwayFromRootParser, const char *before,
+                     const char *after, ptrdiff_t bytesMore, int source_line,
+                     enum XML_Account account) {
+  assert(! rootParser->m_parentParser);
+
+  fprintf(stderr,
+          " (+" EXPAT_FMT_PTRDIFF_T("6") " bytes %s|%d, xmlparse.c:%d) %*s\"",
+          bytesMore, (account == XML_ACCOUNT_DIRECT) ? "DIR" : "EXP",
+          levelsAwayFromRootParser, source_line, 10, "");
+
+  const char ellipis[] = "[..]";
+  const size_t ellipsisLength = sizeof(ellipis) /* because compile-time */ - 1;
+  const unsigned int contextLength = 10;
+
+  /* Note: Performance is of no concern here */
+  const char *walker = before;
+  if ((rootParser->m_accounting.debugLevel >= 3)
+      || (after - before)
+             <= (ptrdiff_t)(contextLength + ellipsisLength + contextLength)) {
+    for (; walker < after; walker++) {
+      fprintf(stderr, "%s", unsignedCharToPrintable(walker[0]));
+    }
+  } else {
+    for (; walker < before + contextLength; walker++) {
+      fprintf(stderr, "%s", unsignedCharToPrintable(walker[0]));
+    }
+    fprintf(stderr, ellipis);
+    walker = after - contextLength;
+    for (; walker < after; walker++) {
+      fprintf(stderr, "%s", unsignedCharToPrintable(walker[0]));
+    }
+  }
+  fprintf(stderr, "\"\n");
+}
+
+static XML_Bool
+accountingDiffTolerated(XML_Parser originParser, int tok, const char *before,
+                        const char *after, int source_line,
+                        enum XML_Account account) {
+  /* Note: We need to check the token type *first* to be sure that
+   *       we can even access variable <after>, safely.
+   *       E.g. for XML_TOK_NONE <after> may hold an invalid pointer. */
+  switch (tok) {
+  case XML_TOK_INVALID:
+  case XML_TOK_PARTIAL:
+  case XML_TOK_PARTIAL_CHAR:
+  case XML_TOK_NONE:
+    return XML_TRUE;
+  }
+
+  if (account == XML_ACCOUNT_NONE)
+    return XML_TRUE; /* because these bytes have been accounted for, already */
+
+  unsigned int levelsAwayFromRootParser;
+  const XML_Parser rootParser
+      = getRootParserOf(originParser, &levelsAwayFromRootParser);
+  assert(! rootParser->m_parentParser);
+
+  const int isDirect
+      = (account == XML_ACCOUNT_DIRECT) && (originParser == rootParser);
+  const ptrdiff_t bytesMore = after - before;
+
+  XmlBigCount *const additionTarget
+      = isDirect ? &rootParser->m_accounting.countBytesDirect
+                 : &rootParser->m_accounting.countBytesIndirect;
+
+  /* Detect and avoid integer overflow */
+  if (*additionTarget > (XmlBigCount)(-1) - (XmlBigCount)bytesMore)
+    return XML_FALSE;
+  *additionTarget += bytesMore;
+
+  const XmlBigCount countBytesOutput
+      = rootParser->m_accounting.countBytesDirect
+        + rootParser->m_accounting.countBytesIndirect;
+  const float amplificationFactor
+      = accountingGetCurrentAmplification(rootParser);
+  const XML_Bool tolerated
+      = (countBytesOutput < rootParser->m_accounting.activationThresholdBytes)
+        || (amplificationFactor
+            <= rootParser->m_accounting.maximumAmplificationFactor);
+
+  if (rootParser->m_accounting.debugLevel >= 2) {
+    accountingReportStats(rootParser, "");
+    accountingReportDiff(rootParser, levelsAwayFromRootParser, before, after,
+                         bytesMore, source_line, account);
+  }
+
+  return tolerated;
+}
+
+unsigned long long
+testingAccountingGetCountBytesDirect(XML_Parser parser) {
+  if (! parser)
+    return 0;
+  return parser->m_accounting.countBytesDirect;
+}
+
+unsigned long long
+testingAccountingGetCountBytesIndirect(XML_Parser parser) {
+  if (! parser)
+    return 0;
+  return parser->m_accounting.countBytesIndirect;
+}
+
+static void
+entityTrackingReportStats(XML_Parser rootParser, ENTITY *entity,
+                          const char *action, int sourceLine) {
+  assert(! rootParser->m_parentParser);
+  if (rootParser->m_entity_stats.debugLevel < 1)
+    return;
+
+#  if defined(XML_UNICODE)
+  const char *const entityName = "[..]";
+#  else
+  const char *const entityName = entity->name;
+#  endif
+
+  fprintf(
+      stderr,
+      "expat: Entities(%p): Count %9d, depth %2d/%2d %*s%s%s; %s length %d (xmlparse.c:%d)\n",
+      (void *)rootParser, rootParser->m_entity_stats.countEverOpened,
+      rootParser->m_entity_stats.currentDepth,
+      rootParser->m_entity_stats.maximumDepthSeen,
+      (rootParser->m_entity_stats.currentDepth - 1) * 2, "",
+      entity->is_param ? "%" : "&", entityName, action, entity->textLen,
+      sourceLine);
+}
+
+static void
+entityTrackingOnOpen(XML_Parser originParser, ENTITY *entity, int sourceLine) {
+  const XML_Parser rootParser = getRootParserOf(originParser, NULL);
+  assert(! rootParser->m_parentParser);
+
+  rootParser->m_entity_stats.countEverOpened++;
+  rootParser->m_entity_stats.currentDepth++;
+  if (rootParser->m_entity_stats.currentDepth
+      > rootParser->m_entity_stats.maximumDepthSeen) {
+    rootParser->m_entity_stats.maximumDepthSeen++;
+  }
+
+  entityTrackingReportStats(rootParser, entity, "OPEN ", sourceLine);
+}
+
+static void
+entityTrackingOnClose(XML_Parser originParser, ENTITY *entity, int sourceLine) {
+  const XML_Parser rootParser = getRootParserOf(originParser, NULL);
+  assert(! rootParser->m_parentParser);
+
+  entityTrackingReportStats(rootParser, entity, "CLOSE", sourceLine);
+  rootParser->m_entity_stats.currentDepth--;
+}
+
+static XML_Parser
+getRootParserOf(XML_Parser parser, unsigned int *outLevelDiff) {
+  XML_Parser rootParser = parser;
+  unsigned int stepsTakenUpwards = 0;
+  while (rootParser->m_parentParser) {
+    rootParser = rootParser->m_parentParser;
+    stepsTakenUpwards++;
+  }
+  assert(! rootParser->m_parentParser);
+  if (outLevelDiff != NULL) {
+    *outLevelDiff = stepsTakenUpwards;
+  }
+  return rootParser;
+}
+
+const char *
+unsignedCharToPrintable(unsigned char c) {
+  switch (c) {
+  case 0:
+    return "\\0";
+  case 1:
+    return "\\x1";
+  case 2:
+    return "\\x2";
+  case 3:
+    return "\\x3";
+  case 4:
+    return "\\x4";
+  case 5:
+    return "\\x5";
+  case 6:
+    return "\\x6";
+  case 7:
+    return "\\x7";
+  case 8:
+    return "\\x8";
+  case 9:
+    return "\\t";
+  case 10:
+    return "\\n";
+  case 11:
+    return "\\xB";
+  case 12:
+    return "\\xC";
+  case 13:
+    return "\\r";
+  case 14:
+    return "\\xE";
+  case 15:
+    return "\\xF";
+  case 16:
+    return "\\x10";
+  case 17:
+    return "\\x11";
+  case 18:
+    return "\\x12";
+  case 19:
+    return "\\x13";
+  case 20:
+    return "\\x14";
+  case 21:
+    return "\\x15";
+  case 22:
+    return "\\x16";
+  case 23:
+    return "\\x17";
+  case 24:
+    return "\\x18";
+  case 25:
+    return "\\x19";
+  case 26:
+    return "\\x1A";
+  case 27:
+    return "\\x1B";
+  case 28:
+    return "\\x1C";
+  case 29:
+    return "\\x1D";
+  case 30:
+    return "\\x1E";
+  case 31:
+    return "\\x1F";
+  case 32:
+    return " ";
+  case 33:
+    return "!";
+  case 34:
+    return "\\\"";
+  case 35:
+    return "#";
+  case 36:
+    return "$";
+  case 37:
+    return "%";
+  case 38:
+    return "&";
+  case 39:
+    return "'";
+  case 40:
+    return "(";
+  case 41:
+    return ")";
+  case 42:
+    return "*";
+  case 43:
+    return "+";
+  case 44:
+    return ",";
+  case 45:
+    return "-";
+  case 46:
+    return ".";
+  case 47:
+    return "/";
+  case 48:
+    return "0";
+  case 49:
+    return "1";
+  case 50:
+    return "2";
+  case 51:
+    return "3";
+  case 52:
+    return "4";
+  case 53:
+    return "5";
+  case 54:
+    return "6";
+  case 55:
+    return "7";
+  case 56:
+    return "8";
+  case 57:
+    return "9";
+  case 58:
+    return ":";
+  case 59:
+    return ";";
+  case 60:
+    return "<";
+  case 61:
+    return "=";
+  case 62:
+    return ">";
+  case 63:
+    return "?";
+  case 64:
+    return "@";
+  case 65:
+    return "A";
+  case 66:
+    return "B";
+  case 67:
+    return "C";
+  case 68:
+    return "D";
+  case 69:
+    return "E";
+  case 70:
+    return "F";
+  case 71:
+    return "G";
+  case 72:
+    return "H";
+  case 73:
+    return "I";
+  case 74:
+    return "J";
+  case 75:
+    return "K";
+  case 76:
+    return "L";
+  case 77:
+    return "M";
+  case 78:
+    return "N";
+  case 79:
+    return "O";
+  case 80:
+    return "P";
+  case 81:
+    return "Q";
+  case 82:
+    return "R";
+  case 83:
+    return "S";
+  case 84:
+    return "T";
+  case 85:
+    return "U";
+  case 86:
+    return "V";
+  case 87:
+    return "W";
+  case 88:
+    return "X";
+  case 89:
+    return "Y";
+  case 90:
+    return "Z";
+  case 91:
+    return "[";
+  case 92:
+    return "\\\\";
+  case 93:
+    return "]";
+  case 94:
+    return "^";
+  case 95:
+    return "_";
+  case 96:
+    return "`";
+  case 97:
+    return "a";
+  case 98:
+    return "b";
+  case 99:
+    return "c";
+  case 100:
+    return "d";
+  case 101:
+    return "e";
+  case 102:
+    return "f";
+  case 103:
+    return "g";
+  case 104:
+    return "h";
+  case 105:
+    return "i";
+  case 106:
+    return "j";
+  case 107:
+    return "k";
+  case 108:
+    return "l";
+  case 109:
+    return "m";
+  case 110:
+    return "n";
+  case 111:
+    return "o";
+  case 112:
+    return "p";
+  case 113:
+    return "q";
+  case 114:
+    return "r";
+  case 115:
+    return "s";
+  case 116:
+    return "t";
+  case 117:
+    return "u";
+  case 118:
+    return "v";
+  case 119:
+    return "w";
+  case 120:
+    return "x";
+  case 121:
+    return "y";
+  case 122:
+    return "z";
+  case 123:
+    return "{";
+  case 124:
+    return "|";
+  case 125:
+    return "}";
+  case 126:
+    return "~";
+  case 127:
+    return "\\x7F";
+  case 128:
+    return "\\x80";
+  case 129:
+    return "\\x81";
+  case 130:
+    return "\\x82";
+  case 131:
+    return "\\x83";
+  case 132:
+    return "\\x84";
+  case 133:
+    return "\\x85";
+  case 134:
+    return "\\x86";
+  case 135:
+    return "\\x87";
+  case 136:
+    return "\\x88";
+  case 137:
+    return "\\x89";
+  case 138:
+    return "\\x8A";
+  case 139:
+    return "\\x8B";
+  case 140:
+    return "\\x8C";
+  case 141:
+    return "\\x8D";
+  case 142:
+    return "\\x8E";
+  case 143:
+    return "\\x8F";
+  case 144:
+    return "\\x90";
+  case 145:
+    return "\\x91";
+  case 146:
+    return "\\x92";
+  case 147:
+    return "\\x93";
+  case 148:
+    return "\\x94";
+  case 149:
+    return "\\x95";
+  case 150:
+    return "\\x96";
+  case 151:
+    return "\\x97";
+  case 152:
+    return "\\x98";
+  case 153:
+    return "\\x99";
+  case 154:
+    return "\\x9A";
+  case 155:
+    return "\\x9B";
+  case 156:
+    return "\\x9C";
+  case 157:
+    return "\\x9D";
+  case 158:
+    return "\\x9E";
+  case 159:
+    return "\\x9F";
+  case 160:
+    return "\\xA0";
+  case 161:
+    return "\\xA1";
+  case 162:
+    return "\\xA2";
+  case 163:
+    return "\\xA3";
+  case 164:
+    return "\\xA4";
+  case 165:
+    return "\\xA5";
+  case 166:
+    return "\\xA6";
+  case 167:
+    return "\\xA7";
+  case 168:
+    return "\\xA8";
+  case 169:
+    return "\\xA9";
+  case 170:
+    return "\\xAA";
+  case 171:
+    return "\\xAB";
+  case 172:
+    return "\\xAC";
+  case 173:
+    return "\\xAD";
+  case 174:
+    return "\\xAE";
+  case 175:
+    return "\\xAF";
+  case 176:
+    return "\\xB0";
+  case 177:
+    return "\\xB1";
+  case 178:
+    return "\\xB2";
+  case 179:
+    return "\\xB3";
+  case 180:
+    return "\\xB4";
+  case 181:
+    return "\\xB5";
+  case 182:
+    return "\\xB6";
+  case 183:
+    return "\\xB7";
+  case 184:
+    return "\\xB8";
+  case 185:
+    return "\\xB9";
+  case 186:
+    return "\\xBA";
+  case 187:
+    return "\\xBB";
+  case 188:
+    return "\\xBC";
+  case 189:
+    return "\\xBD";
+  case 190:
+    return "\\xBE";
+  case 191:
+    return "\\xBF";
+  case 192:
+    return "\\xC0";
+  case 193:
+    return "\\xC1";
+  case 194:
+    return "\\xC2";
+  case 195:
+    return "\\xC3";
+  case 196:
+    return "\\xC4";
+  case 197:
+    return "\\xC5";
+  case 198:
+    return "\\xC6";
+  case 199:
+    return "\\xC7";
+  case 200:
+    return "\\xC8";
+  case 201:
+    return "\\xC9";
+  case 202:
+    return "\\xCA";
+  case 203:
+    return "\\xCB";
+  case 204:
+    return "\\xCC";
+  case 205:
+    return "\\xCD";
+  case 206:
+    return "\\xCE";
+  case 207:
+    return "\\xCF";
+  case 208:
+    return "\\xD0";
+  case 209:
+    return "\\xD1";
+  case 210:
+    return "\\xD2";
+  case 211:
+    return "\\xD3";
+  case 212:
+    return "\\xD4";
+  case 213:
+    return "\\xD5";
+  case 214:
+    return "\\xD6";
+  case 215:
+    return "\\xD7";
+  case 216:
+    return "\\xD8";
+  case 217:
+    return "\\xD9";
+  case 218:
+    return "\\xDA";
+  case 219:
+    return "\\xDB";
+  case 220:
+    return "\\xDC";
+  case 221:
+    return "\\xDD";
+  case 222:
+    return "\\xDE";
+  case 223:
+    return "\\xDF";
+  case 224:
+    return "\\xE0";
+  case 225:
+    return "\\xE1";
+  case 226:
+    return "\\xE2";
+  case 227:
+    return "\\xE3";
+  case 228:
+    return "\\xE4";
+  case 229:
+    return "\\xE5";
+  case 230:
+    return "\\xE6";
+  case 231:
+    return "\\xE7";
+  case 232:
+    return "\\xE8";
+  case 233:
+    return "\\xE9";
+  case 234:
+    return "\\xEA";
+  case 235:
+    return "\\xEB";
+  case 236:
+    return "\\xEC";
+  case 237:
+    return "\\xED";
+  case 238:
+    return "\\xEE";
+  case 239:
+    return "\\xEF";
+  case 240:
+    return "\\xF0";
+  case 241:
+    return "\\xF1";
+  case 242:
+    return "\\xF2";
+  case 243:
+    return "\\xF3";
+  case 244:
+    return "\\xF4";
+  case 245:
+    return "\\xF5";
+  case 246:
+    return "\\xF6";
+  case 247:
+    return "\\xF7";
+  case 248:
+    return "\\xF8";
+  case 249:
+    return "\\xF9";
+  case 250:
+    return "\\xFA";
+  case 251:
+    return "\\xFB";
+  case 252:
+    return "\\xFC";
+  case 253:
+    return "\\xFD";
+  case 254:
+    return "\\xFE";
+  case 255:
+    return "\\xFF";
+  default:
+    assert(0); /* never gets here */
+    return "dead code";
+  }
+  assert(0); /* never gets here */
+}
+
+#endif /* XML_DTD */
+
+static unsigned long
+getDebugLevel(const char *variableName, unsigned long defaultDebugLevel) {
+  const char *const valueOrNull = getenv(variableName);
+  if (valueOrNull == NULL) {
+    return defaultDebugLevel;
+  }
+  const char *const value = valueOrNull;
+
+  errno = 0;
+  char *afterValue = (char *)value;
+  unsigned long debugLevel = strtoul(value, &afterValue, 10);
+  if ((errno != 0) || (afterValue[0] != '\0')) {
+    errno = 0;
+    return defaultDebugLevel;
+  }
+
+  return debugLevel;
+}
diff --git a/Modules/expat/xmlrole.c b/Modules/expat/xmlrole.c
index 4d3e3e8..3f0f5c1 100644
--- a/Modules/expat/xmlrole.c
+++ b/Modules/expat/xmlrole.c
@@ -7,7 +7,15 @@
                                  |_| XML parser
 
    Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
-   Copyright (c) 2000-2017 Expat development team
+   Copyright (c) 2000      Clark Cooper <coopercc@users.sourceforge.net>
+   Copyright (c) 2002      Greg Stein <gstein@users.sourceforge.net>
+   Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net>
+   Copyright (c) 2002-2003 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
+   Copyright (c) 2005-2009 Steven Solie <steven@solie.ca>
+   Copyright (c) 2016-2021 Sebastian Pipping <sebastian@pipping.org>
+   Copyright (c) 2017      Rhodri James <rhodri@wildebeest.org.uk>
+   Copyright (c) 2019      David Loffredo <loffredo@steptools.com>
+   Copyright (c) 2021      Dong-hee Na <donghee.na@python.org>
    Licensed under the MIT license:
 
    Permission is  hereby granted,  free of charge,  to any  person obtaining
@@ -30,15 +38,13 @@
    USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
 
+#include <expat_config.h>
+
 #include <stddef.h>
 
 #ifdef _WIN32
 #  include "winconfig.h"
-#else
-#  ifdef HAVE_EXPAT_CONFIG_H
-#    include <expat_config.h>
-#  endif
-#endif /* ndef _WIN32 */
+#endif
 
 #include "expat_external.h"
 #include "internal.h"
@@ -1220,6 +1226,8 @@
 #ifdef XML_DTD
   if (! state->documentEntity && tok == XML_TOK_PARAM_ENTITY_REF)
     return XML_ROLE_INNER_PARAM_ENTITY_REF;
+#else
+  UNUSED_P(tok);
 #endif
   state->handler = error;
   return XML_ROLE_ERROR;
diff --git a/Modules/expat/xmlrole.h b/Modules/expat/xmlrole.h
index 036aba6..d6e1fa1 100644
--- a/Modules/expat/xmlrole.h
+++ b/Modules/expat/xmlrole.h
@@ -7,7 +7,10 @@
                                  |_| XML parser
 
    Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
-   Copyright (c) 2000-2017 Expat development team
+   Copyright (c) 2000      Clark Cooper <coopercc@users.sourceforge.net>
+   Copyright (c) 2002      Karl Waclawek <karl@waclawek.net>
+   Copyright (c) 2002      Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
+   Copyright (c) 2017      Sebastian Pipping <sebastian@pipping.org>
    Licensed under the MIT license:
 
    Permission is  hereby granted,  free of charge,  to any  person obtaining
diff --git a/Modules/expat/xmltok.c b/Modules/expat/xmltok.c
index 54cfedb..c659983 100644
--- a/Modules/expat/xmltok.c
+++ b/Modules/expat/xmltok.c
@@ -7,7 +7,20 @@
                                  |_| XML parser
 
    Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
-   Copyright (c) 2000-2017 Expat development team
+   Copyright (c) 2000      Clark Cooper <coopercc@users.sourceforge.net>
+   Copyright (c) 2001-2003 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
+   Copyright (c) 2002      Greg Stein <gstein@users.sourceforge.net>
+   Copyright (c) 2002-2016 Karl Waclawek <karl@waclawek.net>
+   Copyright (c) 2005-2009 Steven Solie <steven@solie.ca>
+   Copyright (c) 2016-2022 Sebastian Pipping <sebastian@pipping.org>
+   Copyright (c) 2016      Pascal Cuoq <cuoq@trust-in-soft.com>
+   Copyright (c) 2016      Don Lewis <truckman@apache.org>
+   Copyright (c) 2017      Rhodri James <rhodri@wildebeest.org.uk>
+   Copyright (c) 2017      Alexander Bluhm <alexander.bluhm@gmx.net>
+   Copyright (c) 2017      Benbuck Nason <bnason@netflix.com>
+   Copyright (c) 2017      José Gutiérrez de la Concha <jose@zeroc.com>
+   Copyright (c) 2019      David Loffredo <loffredo@steptools.com>
+   Copyright (c) 2021      Dong-hee Na <donghee.na@python.org>
    Licensed under the MIT license:
 
    Permission is  hereby granted,  free of charge,  to any  person obtaining
@@ -30,24 +43,14 @@
    USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
 
-#ifdef _WIN32
-#  include "winconfig.h"
-#else
-#  ifdef HAVE_EXPAT_CONFIG_H
-#    include <expat_config.h>
-#  endif
-#endif /* ndef _WIN32 */
+#include <expat_config.h>
 
 #include <stddef.h>
 #include <string.h> /* memcpy */
+#include <stdbool.h>
 
-#if defined(_MSC_VER) && (_MSC_VER <= 1700)
-/* for vs2012/11.0/1700 and earlier Visual Studio compilers */
-#  define bool int
-#  define false 0
-#  define true 1
-#else
-#  include <stdbool.h>
+#ifdef _WIN32
+#  include "winconfig.h"
 #endif
 
 #include "expat_external.h"
@@ -95,11 +98,6 @@
         + ((((byte)[1]) & 3) << 1) + ((((byte)[2]) >> 5) & 1)]                 \
    & (1u << (((byte)[2]) & 0x1F)))
 
-#define UTF8_GET_NAMING(pages, p, n)                                           \
-  ((n) == 2                                                                    \
-       ? UTF8_GET_NAMING2(pages, (const unsigned char *)(p))                   \
-       : ((n) == 3 ? UTF8_GET_NAMING3(pages, (const unsigned char *)(p)) : 0))
-
 /* Detection of invalid UTF-8 sequences is based on Table 3.1B
    of Unicode 3.2: http://www.unicode.org/unicode/reports/tr28/
    with the additional restriction of not allowing the Unicode
@@ -269,8 +267,14 @@
 
 #define IS_NAME_CHAR(enc, p, n) (AS_NORMAL_ENCODING(enc)->isName##n(enc, p))
 #define IS_NMSTRT_CHAR(enc, p, n) (AS_NORMAL_ENCODING(enc)->isNmstrt##n(enc, p))
-#define IS_INVALID_CHAR(enc, p, n)                                             \
-  (AS_NORMAL_ENCODING(enc)->isInvalid##n(enc, p))
+#ifdef XML_MIN_SIZE
+#  define IS_INVALID_CHAR(enc, p, n)                                           \
+    (AS_NORMAL_ENCODING(enc)->isInvalid##n                                     \
+     && AS_NORMAL_ENCODING(enc)->isInvalid##n(enc, p))
+#else
+#  define IS_INVALID_CHAR(enc, p, n)                                           \
+    (AS_NORMAL_ENCODING(enc)->isInvalid##n(enc, p))
+#endif
 
 #ifdef XML_MIN_SIZE
 #  define IS_NAME_CHAR_MINBPC(enc, p)                                          \
@@ -589,13 +593,13 @@
 static int PTRFASTCALL
 unicode_byte_type(char hi, char lo) {
   switch ((unsigned char)hi) {
-  /* 0xD800–0xDBFF first 16-bit code unit or high surrogate (W1) */
+  /* 0xD800-0xDBFF first 16-bit code unit or high surrogate (W1) */
   case 0xD8:
   case 0xD9:
   case 0xDA:
   case 0xDB:
     return BT_LEAD4;
-  /* 0xDC00–0xDFFF second 16-bit code unit or low surrogate (W2) */
+  /* 0xDC00-0xDFFF second 16-bit code unit or low surrogate (W2) */
   case 0xDC:
   case 0xDD:
   case 0xDE:
diff --git a/Modules/expat/xmltok.h b/Modules/expat/xmltok.h
index 2adbf53..6f630c2 100644
--- a/Modules/expat/xmltok.h
+++ b/Modules/expat/xmltok.h
@@ -7,7 +7,11 @@
                                  |_| XML parser
 
    Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
-   Copyright (c) 2000-2017 Expat development team
+   Copyright (c) 2000      Clark Cooper <coopercc@users.sourceforge.net>
+   Copyright (c) 2002      Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
+   Copyright (c) 2002-2005 Karl Waclawek <karl@waclawek.net>
+   Copyright (c) 2016-2017 Sebastian Pipping <sebastian@pipping.org>
+   Copyright (c) 2017      Rhodri James <rhodri@wildebeest.org.uk>
    Licensed under the MIT license:
 
    Permission is  hereby granted,  free of charge,  to any  person obtaining
diff --git a/Modules/expat/xmltok_impl.c b/Modules/expat/xmltok_impl.c
index c209221..4072b06 100644
--- a/Modules/expat/xmltok_impl.c
+++ b/Modules/expat/xmltok_impl.c
@@ -1,4 +1,4 @@
-/* This file is included!
+/* This file is included (from xmltok.c, 1-3 times depending on XML_MIN_SIZE)!
                             __  __            _
                          ___\ \/ /_ __   __ _| |_
                         / _ \\  /| '_ \ / _` | __|
@@ -7,7 +7,15 @@
                                  |_| XML parser
 
    Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
-   Copyright (c) 2000-2017 Expat development team
+   Copyright (c) 2000      Clark Cooper <coopercc@users.sourceforge.net>
+   Copyright (c) 2002      Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
+   Copyright (c) 2002-2016 Karl Waclawek <karl@waclawek.net>
+   Copyright (c) 2016-2022 Sebastian Pipping <sebastian@pipping.org>
+   Copyright (c) 2017      Rhodri James <rhodri@wildebeest.org.uk>
+   Copyright (c) 2018      Benjamin Peterson <benjamin@python.org>
+   Copyright (c) 2018      Anton Maklakov <antmak.pub@gmail.com>
+   Copyright (c) 2019      David Loffredo <loffredo@steptools.com>
+   Copyright (c) 2020      Boris Kolpackov <boris@codesynthesis.com>
    Licensed under the MIT license:
 
    Permission is  hereby granted,  free of charge,  to any  person obtaining
@@ -32,7 +40,7 @@
 
 #ifdef XML_TOK_IMPL_C
 
-#  ifndef IS_INVALID_CHAR
+#  ifndef IS_INVALID_CHAR // i.e. for UTF-16 and XML_MIN_SIZE not defined
 #    define IS_INVALID_CHAR(enc, ptr, n) (0)
 #  endif
 
@@ -61,7 +69,7 @@
   case BT_LEAD##n:                                                             \
     if (end - ptr < n)                                                         \
       return XML_TOK_PARTIAL_CHAR;                                             \
-    if (! IS_NAME_CHAR(enc, ptr, n)) {                                         \
+    if (IS_INVALID_CHAR(enc, ptr, n) || ! IS_NAME_CHAR(enc, ptr, n)) {         \
       *nextTokPtr = ptr;                                                       \
       return XML_TOK_INVALID;                                                  \
     }                                                                          \
@@ -90,7 +98,7 @@
   case BT_LEAD##n:                                                             \
     if (end - ptr < n)                                                         \
       return XML_TOK_PARTIAL_CHAR;                                             \
-    if (! IS_NMSTRT_CHAR(enc, ptr, n)) {                                       \
+    if (IS_INVALID_CHAR(enc, ptr, n) || ! IS_NMSTRT_CHAR(enc, ptr, n)) {       \
       *nextTokPtr = ptr;                                                       \
       return XML_TOK_INVALID;                                                  \
     }                                                                          \
@@ -1134,6 +1142,10 @@
   case BT_LEAD##n:                                                             \
     if (end - ptr < n)                                                         \
       return XML_TOK_PARTIAL_CHAR;                                             \
+    if (IS_INVALID_CHAR(enc, ptr, n)) {                                        \
+      *nextTokPtr = ptr;                                                       \
+      return XML_TOK_INVALID;                                                  \
+    }                                                                          \
     if (IS_NMSTRT_CHAR(enc, ptr, n)) {                                         \
       ptr += n;                                                                \
       tok = XML_TOK_NAME;                                                      \
@@ -1262,7 +1274,7 @@
     switch (BYTE_TYPE(enc, ptr)) {
 #  define LEAD_CASE(n)                                                         \
   case BT_LEAD##n:                                                             \
-    ptr += n;                                                                  \
+    ptr += n; /* NOTE: The encoding has already been validated. */             \
     break;
       LEAD_CASE(2)
       LEAD_CASE(3)
@@ -1331,7 +1343,7 @@
     switch (BYTE_TYPE(enc, ptr)) {
 #  define LEAD_CASE(n)                                                         \
   case BT_LEAD##n:                                                             \
-    ptr += n;                                                                  \
+    ptr += n; /* NOTE: The encoding has already been validated. */             \
     break;
       LEAD_CASE(2)
       LEAD_CASE(3)
@@ -1510,7 +1522,7 @@
       state = inName;                                                          \
     }
 #  define LEAD_CASE(n)                                                         \
-  case BT_LEAD##n:                                                             \
+  case BT_LEAD##n: /* NOTE: The encoding has already been validated. */        \
     START_NAME ptr += (n - MINBPC(enc));                                       \
     break;
       LEAD_CASE(2)
@@ -1722,7 +1734,7 @@
     switch (BYTE_TYPE(enc, ptr)) {
 #  define LEAD_CASE(n)                                                         \
   case BT_LEAD##n:                                                             \
-    ptr += n;                                                                  \
+    ptr += n; /* NOTE: The encoding has already been validated. */             \
     break;
       LEAD_CASE(2)
       LEAD_CASE(3)
@@ -1767,14 +1779,15 @@
     switch (BYTE_TYPE(enc, ptr)) {
 #  define LEAD_CASE(n)                                                         \
   case BT_LEAD##n:                                                             \
-    ptr += n;                                                                  \
+    ptr += n; /* NOTE: The encoding has already been validated. */             \
+    pos->columnNumber++;                                                       \
     break;
       LEAD_CASE(2)
       LEAD_CASE(3)
       LEAD_CASE(4)
 #  undef LEAD_CASE
     case BT_LF:
-      pos->columnNumber = (XML_Size)-1;
+      pos->columnNumber = 0;
       pos->lineNumber++;
       ptr += MINBPC(enc);
       break;
@@ -1783,13 +1796,13 @@
       ptr += MINBPC(enc);
       if (HAS_CHAR(enc, ptr, end) && BYTE_TYPE(enc, ptr) == BT_LF)
         ptr += MINBPC(enc);
-      pos->columnNumber = (XML_Size)-1;
+      pos->columnNumber = 0;
       break;
     default:
       ptr += MINBPC(enc);
+      pos->columnNumber++;
       break;
     }
-    pos->columnNumber++;
   }
 }
 
diff --git a/Modules/expat/xmltok_impl.h b/Modules/expat/xmltok_impl.h
index e925dbc..c518aad 100644
--- a/Modules/expat/xmltok_impl.h
+++ b/Modules/expat/xmltok_impl.h
@@ -7,7 +7,8 @@
                                  |_| XML parser
 
    Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
-   Copyright (c) 2000-2017 Expat development team
+   Copyright (c) 2000      Clark Cooper <coopercc@users.sourceforge.net>
+   Copyright (c) 2017-2019 Sebastian Pipping <sebastian@pipping.org>
    Licensed under the MIT license:
 
    Permission is  hereby granted,  free of charge,  to any  person obtaining
diff --git a/Modules/expat/xmltok_ns.c b/Modules/expat/xmltok_ns.c
index 919c74e..fbdd3e3 100644
--- a/Modules/expat/xmltok_ns.c
+++ b/Modules/expat/xmltok_ns.c
@@ -7,7 +7,11 @@
                                  |_| XML parser
 
    Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
-   Copyright (c) 2000-2017 Expat development team
+   Copyright (c) 2000      Clark Cooper <coopercc@users.sourceforge.net>
+   Copyright (c) 2002      Greg Stein <gstein@users.sourceforge.net>
+   Copyright (c) 2002      Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
+   Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net>
+   Copyright (c) 2017-2021 Sebastian Pipping <sebastian@pipping.org>
    Licensed under the MIT license:
 
    Permission is  hereby granted,  free of charge,  to any  person obtaining
@@ -89,7 +93,7 @@
 static const ENCODING *
 NS(findEncoding)(const ENCODING *enc, const char *ptr, const char *end) {
 #  define ENCODING_MAX 128
-  char buf[ENCODING_MAX];
+  char buf[ENCODING_MAX] = "";
   char *p = buf;
   int i;
   XmlUtf8Convert(enc, &ptr, end, &p, p + ENCODING_MAX - 1);
diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c
index e7a2850..88a5b93 100644
--- a/Modules/faulthandler.c
+++ b/Modules/faulthandler.c
@@ -1,6 +1,8 @@
 #include "Python.h"
-#include "pycore_initconfig.h"
-#include "pycore_traceback.h"
+#include "pycore_initconfig.h"    // _PyStatus_ERR
+#include "pycore_pyerrors.h"      // _Py_DumpExtensionModules
+#include "pycore_pystate.h"       // _PyThreadState_GET()
+#include "pycore_traceback.h"     // _Py_DumpTracebackThreads
 #include <signal.h>
 #include <object.h>
 #include <frameobject.h>
@@ -15,6 +17,17 @@
 #  include <sys/resource.h>
 #endif
 
+/* Using an alternative stack requires sigaltstack()
+   and sigaction() SA_ONSTACK */
+#if defined(HAVE_SIGALTSTACK) && defined(HAVE_SIGACTION)
+#  define FAULTHANDLER_USE_ALT_STACK
+#endif
+
+#if defined(FAULTHANDLER_USE_ALT_STACK) && defined(HAVE_LINUX_AUXVEC_H)
+#  include <linux/auxvec.h>
+#  include <sys/auxv.h>
+#endif
+
 /* Allocate at maximum 100 MiB of the stack to raise the stack overflow */
 #define STACK_OVERFLOW_MAX_SIZE (100 * 1024 * 1024)
 
@@ -27,6 +40,23 @@
 
 #define PUTS(fd, str) _Py_write_noraise(fd, str, strlen(str))
 
+
+// clang uses __attribute__((no_sanitize("undefined")))
+// GCC 4.9+ uses __attribute__((no_sanitize_undefined))
+#if defined(__has_feature)  // Clang
+#  if __has_feature(undefined_behavior_sanitizer)
+#    define _Py_NO_SANITIZE_UNDEFINED __attribute__((no_sanitize("undefined")))
+#  endif
+#endif
+#if defined(__GNUC__) \
+    && ((__GNUC__ >= 5) || (__GNUC__ == 4) && (__GNUC_MINOR__ >= 9))
+#  define _Py_NO_SANITIZE_UNDEFINED __attribute__((no_sanitize_undefined))
+#endif
+#ifndef _Py_NO_SANITIZE_UNDEFINED
+#  define _Py_NO_SANITIZE_UNDEFINED
+#endif
+
+
 _Py_IDENTIFIER(enable);
 _Py_IDENTIFIER(fileno);
 _Py_IDENTIFIER(flush);
@@ -120,12 +150,6 @@
 static const size_t faulthandler_nsignals = \
     Py_ARRAY_LENGTH(faulthandler_handlers);
 
-/* Using an alternative stack requires sigaltstack()
-   and sigaction() SA_ONSTACK */
-#if defined(HAVE_SIGALTSTACK) && defined(HAVE_SIGACTION)
-#  define FAULTHANDLER_USE_ALT_STACK
-#endif
-
 #ifdef FAULTHANDLER_USE_ALT_STACK
 static stack_t stack;
 static stack_t old_stack;
@@ -207,7 +231,7 @@
 static PyThreadState*
 get_thread_state(void)
 {
-    PyThreadState *tstate = _PyThreadState_UncheckedGet();
+    PyThreadState *tstate = _PyThreadState_GET();
     if (tstate == NULL) {
         /* just in case but very unlikely... */
         PyErr_SetString(PyExc_RuntimeError,
@@ -349,6 +373,8 @@
     faulthandler_dump_traceback(fd, fatal_error.all_threads,
                                 fatal_error.interp);
 
+    _Py_DumpExtensionModules(fd, fatal_error.interp);
+
     errno = save_errno;
 #ifdef MS_WINDOWS
     if (signum == SIGSEGV) {
@@ -1010,7 +1036,7 @@
 #endif
 }
 
-static PyObject *
+static PyObject* _Py_NO_SANITIZE_UNDEFINED
 faulthandler_read_null(PyObject *self, PyObject *args)
 {
     volatile int *x;
@@ -1099,17 +1125,20 @@
     Py_RETURN_NONE;
 }
 
-static PyObject *
+static PyObject* _Py_NO_SANITIZE_UNDEFINED
 faulthandler_sigfpe(PyObject *self, PyObject *args)
 {
+    faulthandler_suppress_crash_report();
+
     /* Do an integer division by zero: raise a SIGFPE on Intel CPU, but not on
        PowerPC. Use volatile to disable compile-time optimizations. */
     volatile int x = 1, y = 0, z;
-    faulthandler_suppress_crash_report();
     z = x / y;
+
     /* If the division by zero didn't raise a SIGFPE (e.g. on PowerPC),
        raise it manually. */
     raise(SIGFPE);
+
     /* This line is never reached, but we pretend to make something with z
        to silence a compiler warning. */
     return PyLong_FromLong(z);
@@ -1123,25 +1152,6 @@
     Py_RETURN_NONE;
 }
 
-static PyObject *
-faulthandler_fatal_error_py(PyObject *self, PyObject *args)
-{
-    char *message;
-    int release_gil = 0;
-    if (!PyArg_ParseTuple(args, "y|i:fatal_error", &message, &release_gil))
-        return NULL;
-    faulthandler_suppress_crash_report();
-    if (release_gil) {
-        Py_BEGIN_ALLOW_THREADS
-        Py_FatalError(message);
-        Py_END_ALLOW_THREADS
-    }
-    else {
-        Py_FatalError(message);
-    }
-    Py_RETURN_NONE;
-}
-
 #if defined(FAULTHANDLER_USE_ALT_STACK)
 #define FAULTHANDLER_STACK_OVERFLOW
 
@@ -1278,8 +1288,6 @@
      PyDoc_STR("_sigabrt(): raise a SIGABRT signal")},
     {"_sigfpe", (PyCFunction)faulthandler_sigfpe, METH_NOARGS,
      PyDoc_STR("_sigfpe(): raise a SIGFPE signal")},
-    {"_fatal_error", faulthandler_fatal_error_py, METH_VARARGS,
-     PyDoc_STR("_fatal_error(message): call Py_FatalError(message)")},
 #ifdef FAULTHANDLER_STACK_OVERFLOW
     {"_stack_overflow", faulthandler_stack_overflow, METH_NOARGS,
      PyDoc_STR("_stack_overflow(): recursive call to raise a stack overflow")},
@@ -1291,59 +1299,55 @@
     {NULL, NULL}  /* sentinel */
 };
 
+static int
+PyExec_faulthandler(PyObject *module) {
+    /* Add constants for unit tests */
+#ifdef MS_WINDOWS
+    /* RaiseException() codes (prefixed by an underscore) */
+    if (PyModule_AddIntConstant(module, "_EXCEPTION_ACCESS_VIOLATION",
+                                EXCEPTION_ACCESS_VIOLATION)) {
+        return -1;
+    }
+    if (PyModule_AddIntConstant(module, "_EXCEPTION_INT_DIVIDE_BY_ZERO",
+                                EXCEPTION_INT_DIVIDE_BY_ZERO)) {
+        return -1;
+    }
+    if (PyModule_AddIntConstant(module, "_EXCEPTION_STACK_OVERFLOW",
+                                EXCEPTION_STACK_OVERFLOW)) {
+        return -1;
+    }
+
+    /* RaiseException() flags (prefixed by an underscore) */
+    if (PyModule_AddIntConstant(module, "_EXCEPTION_NONCONTINUABLE",
+                                EXCEPTION_NONCONTINUABLE)) {
+        return -1;
+    }
+    if (PyModule_AddIntConstant(module, "_EXCEPTION_NONCONTINUABLE_EXCEPTION",
+                                EXCEPTION_NONCONTINUABLE_EXCEPTION)) {
+        return -1;
+    }
+#endif
+    return 0;
+}
+
+static PyModuleDef_Slot faulthandler_slots[] = {
+    {Py_mod_exec, PyExec_faulthandler},
+    {0, NULL}
+};
+
 static struct PyModuleDef module_def = {
     PyModuleDef_HEAD_INIT,
-    "faulthandler",
-    module_doc,
-    0, /* non-negative size to be able to unload the module */
-    module_methods,
-    NULL,
-    faulthandler_traverse,
-    NULL,
-    NULL
+    .m_name = "faulthandler",
+    .m_doc = module_doc,
+    .m_methods = module_methods,
+    .m_traverse = faulthandler_traverse,
+    .m_slots = faulthandler_slots
 };
 
 PyMODINIT_FUNC
 PyInit_faulthandler(void)
 {
-    PyObject *m = PyModule_Create(&module_def);
-    if (m == NULL)
-        return NULL;
-
-    /* Add constants for unit tests */
-#ifdef MS_WINDOWS
-    /* RaiseException() codes (prefixed by an underscore) */
-    if (PyModule_AddIntConstant(m, "_EXCEPTION_ACCESS_VIOLATION",
-                                EXCEPTION_ACCESS_VIOLATION)) {
-        goto error;
-    }
-    if (PyModule_AddIntConstant(m, "_EXCEPTION_INT_DIVIDE_BY_ZERO",
-                                EXCEPTION_INT_DIVIDE_BY_ZERO)) {
-        goto error;
-    }
-    if (PyModule_AddIntConstant(m, "_EXCEPTION_STACK_OVERFLOW",
-                                EXCEPTION_STACK_OVERFLOW)) {
-        goto error;
-    }
-
-    /* RaiseException() flags (prefixed by an underscore) */
-    if (PyModule_AddIntConstant(m, "_EXCEPTION_NONCONTINUABLE",
-                                EXCEPTION_NONCONTINUABLE)) {
-        goto error;
-    }
-    if (PyModule_AddIntConstant(m, "_EXCEPTION_NONCONTINUABLE_EXCEPTION",
-                                EXCEPTION_NONCONTINUABLE_EXCEPTION)) {
-        goto error;
-    }
-#endif
-
-    return m;
-
-#ifdef MS_WINDOWS
-error:
-    Py_DECREF(m);
-    return NULL;
-#endif
+    return PyModuleDef_Init(&module_def);
 }
 
 static int
@@ -1375,6 +1379,15 @@
        signal handler uses more than SIGSTKSZ bytes of stack memory on some
        platforms. */
     stack.ss_size = SIGSTKSZ * 2;
+#ifdef AT_MINSIGSTKSZ
+    /* bpo-46968: Query Linux for minimal stack size to ensure signal delivery
+       for the hardware running CPython. This OS feature is available in
+       Linux kernel version >= 5.14 */
+    unsigned long at_minstack_size = getauxval(AT_MINSIGSTKSZ);
+    if (at_minstack_size != 0) {
+        stack.ss_size = SIGSTKSZ + at_minstack_size;
+    }
+#endif
 #endif
 
     memset(&thread, 0, sizeof(thread));
diff --git a/Modules/fcntlmodule.c b/Modules/fcntlmodule.c
index 43f9b22..cdf0f9b 100644
--- a/Modules/fcntlmodule.c
+++ b/Modules/fcntlmodule.c
@@ -20,24 +20,12 @@
 [clinic start generated code]*/
 /*[clinic end generated code: output=da39a3ee5e6b4b0d input=124b58387c158179]*/
 
-static int
-conv_descriptor(PyObject *object, int *target)
-{
-    int fd = PyObject_AsFileDescriptor(object);
-
-    if (fd < 0)
-        return 0;
-    *target = fd;
-    return 1;
-}
-
-/* Must come after conv_descriptor definition. */
 #include "clinic/fcntlmodule.c.h"
 
 /*[clinic input]
 fcntl.fcntl
 
-    fd: object(type='int', converter='conv_descriptor')
+    fd: fildes
     cmd as code: int
     arg: object(c_default='NULL') = 0
     /
@@ -57,7 +45,7 @@
 
 static PyObject *
 fcntl_fcntl_impl(PyObject *module, int fd, int code, PyObject *arg)
-/*[clinic end generated code: output=888fc93b51c295bd input=8cefbe59b29efbe2]*/
+/*[clinic end generated code: output=888fc93b51c295bd input=7955340198e5f334]*/
 {
     unsigned int int_arg = 0;
     int ret;
@@ -116,7 +104,7 @@
 /*[clinic input]
 fcntl.ioctl
 
-    fd: object(type='int', converter='conv_descriptor')
+    fd: fildes
     request as code: unsigned_int(bitwise=True)
     arg as ob_arg: object(c_default='NULL') = 0
     mutate_flag as mutate_arg: bool = True
@@ -155,7 +143,7 @@
 static PyObject *
 fcntl_ioctl_impl(PyObject *module, int fd, unsigned int code,
                  PyObject *ob_arg, int mutate_arg)
-/*[clinic end generated code: output=7f7f5840c65991be input=ede70c433cccbbb2]*/
+/*[clinic end generated code: output=7f7f5840c65991be input=967b4a4cbeceb0a8]*/
 {
 #define IOCTL_BUFSZ 1024
     /* We use the unsigned non-checked 'I' format for the 'code' parameter
@@ -280,7 +268,7 @@
 /*[clinic input]
 fcntl.flock
 
-    fd: object(type='int', converter='conv_descriptor')
+    fd: fildes
     operation as code: int
     /
 
@@ -292,7 +280,7 @@
 
 static PyObject *
 fcntl_flock_impl(PyObject *module, int fd, int code)
-/*[clinic end generated code: output=84059e2b37d2fc64 input=b70a0a41ca22a8a0]*/
+/*[clinic end generated code: output=84059e2b37d2fc64 input=0bfc00f795953452]*/
 {
     int ret;
     int async_err = 0;
@@ -346,7 +334,7 @@
 /*[clinic input]
 fcntl.lockf
 
-    fd: object(type='int', converter='conv_descriptor')
+    fd: fildes
     cmd as code: int
     len as lenobj: object(c_default='NULL') = 0
     start as startobj: object(c_default='NULL') = 0
@@ -380,7 +368,7 @@
 static PyObject *
 fcntl_lockf_impl(PyObject *module, int fd, int code, PyObject *lenobj,
                  PyObject *startobj, int whence)
-/*[clinic end generated code: output=4985e7a172e7461a input=3a5dc01b04371f1a]*/
+/*[clinic end generated code: output=4985e7a172e7461a input=5480479fc63a04b8]*/
 {
     int ret;
     int async_err = 0;
@@ -577,6 +565,14 @@
     if (PyModule_AddIntMacro(m, F_SHLCK)) return -1;
 #endif
 
+/* Linux specifics */
+#ifdef F_SETPIPE_SZ
+    if (PyModule_AddIntMacro(m, F_SETPIPE_SZ)) return -1;
+#endif
+#ifdef F_GETPIPE_SZ
+    if (PyModule_AddIntMacro(m, F_GETPIPE_SZ)) return -1;
+#endif
+
 /* OS X specifics */
 #ifdef F_FULLFSYNC
     if (PyModule_AddIntMacro(m, F_FULLFSYNC)) return -1;
@@ -662,34 +658,31 @@
     return 0;
 }
 
+static int
+fcntl_exec(PyObject *module)
+{
+    if (all_ins(module) < 0) {
+        return -1;
+    }
+    return 0;
+}
+
+static PyModuleDef_Slot fcntl_slots[] = {
+    {Py_mod_exec, fcntl_exec},
+    {0, NULL}
+};
 
 static struct PyModuleDef fcntlmodule = {
     PyModuleDef_HEAD_INIT,
-    "fcntl",
-    module_doc,
-    -1,
-    fcntl_methods,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    .m_name = "fcntl",
+    .m_doc = module_doc,
+    .m_size = 0,
+    .m_methods = fcntl_methods,
+    .m_slots = fcntl_slots,
 };
 
 PyMODINIT_FUNC
 PyInit_fcntl(void)
 {
-    PyObject *m;
-
-    /* Create the module and add the functions and documentation */
-    m = PyModule_Create(&fcntlmodule);
-    if (m == NULL)
-        return NULL;
-
-    /* Add some symbolic constants to the module */
-    if (all_ins(m) < 0) {
-        Py_DECREF(m);
-        return NULL;
-    }
-
-    return m;
+    return PyModuleDef_Init(&fcntlmodule);
 }
diff --git a/Modules/gc_weakref.txt b/Modules/gc_weakref.txt
index 2f18402..6d07cce 100644
--- a/Modules/gc_weakref.txt
+++ b/Modules/gc_weakref.txt
@@ -47,10 +47,10 @@
 too, and they can do ordinary things with weakrefs that end up resurrecting
 CT while gc is running.
 
-    http://www.python.org/sf/1055820
+    https://www.python.org/sf/1055820
 
 shows how innocent it can be, and also how nasty.  Variants of the three
-focussed test cases attached to that bug report are now part of Python's
+focused test cases attached to that bug report are now part of Python's
 standard Lib/test/test_gc.py.
 
 Jim Fulton gave the best nutshell summary of the new (in 2.4 and 2.3.5)
diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c
index 56dcb10..805a159 100644
--- a/Modules/gcmodule.c
+++ b/Modules/gcmodule.c
@@ -31,7 +31,6 @@
 #include "pycore_pyerrors.h"
 #include "pycore_pystate.h"     // _PyThreadState_GET()
 #include "pydtrace.h"
-#include "pytime.h"             // _PyTime_GetMonotonicClock()
 
 typedef struct _gc_runtime_state GCState;
 
@@ -128,6 +127,15 @@
 
 #define GEN_HEAD(gcstate, n) (&(gcstate)->generations[n].head)
 
+
+static GCState *
+get_gc_state(void)
+{
+    PyInterpreterState *interp = _PyInterpreterState_GET();
+    return &interp->gc;
+}
+
+
 void
 _PyGC_InitState(GCState *gcstate)
 {
@@ -153,15 +161,20 @@
 
 
 PyStatus
-_PyGC_Init(PyThreadState *tstate)
+_PyGC_Init(PyInterpreterState *interp)
 {
-    GCState *gcstate = &tstate->interp->gc;
+    GCState *gcstate = &interp->gc;
+
+    gcstate->garbage = PyList_New(0);
     if (gcstate->garbage == NULL) {
-        gcstate->garbage = PyList_New(0);
-        if (gcstate->garbage == NULL) {
-            return _PyStatus_NO_MEMORY();
-        }
+        return _PyStatus_NO_MEMORY();
     }
+
+    gcstate->callbacks = PyList_New(0);
+    if (gcstate->callbacks == NULL) {
+        return _PyStatus_NO_MEMORY();
+    }
+
     return _PyStatus_OK();
 }
 
@@ -1023,15 +1036,15 @@
  * Clearing the free lists may give back memory to the OS earlier.
  */
 static void
-clear_freelists(void)
+clear_freelists(PyInterpreterState *interp)
 {
-    _PyFrame_ClearFreeList();
-    _PyTuple_ClearFreeList();
-    _PyFloat_ClearFreeList();
-    _PyList_ClearFreeList();
-    _PyDict_ClearFreeList();
-    _PyAsyncGen_ClearFreeLists();
-    _PyContext_ClearFreeList();
+    _PyFrame_ClearFreeList(interp);
+    _PyTuple_ClearFreeList(interp);
+    _PyFloat_ClearFreeList(interp);
+    _PyList_ClearFreeList(interp);
+    _PyDict_ClearFreeList(interp);
+    _PyAsyncGen_ClearFreeLists(interp);
+    _PyContext_ClearFreeList(interp);
 }
 
 // Show stats for objects in each generations
@@ -1043,7 +1056,7 @@
 
     for (int i = 0; i < NUM_GENERATIONS && pos < sizeof(buf); i++) {
         pos += PyOS_snprintf(buf+pos, sizeof(buf)-pos,
-                             " %"PY_FORMAT_SIZE_T"d",
+                             " %zd",
                              gc_list_size(GEN_HEAD(gcstate, i)));
     }
 
@@ -1167,8 +1180,9 @@
 /* This is the main function.  Read this to understand how the
  * collection process works. */
 static Py_ssize_t
-collect(PyThreadState *tstate, int generation,
-        Py_ssize_t *n_collected, Py_ssize_t *n_uncollectable, int nofail)
+gc_collect_main(PyThreadState *tstate, int generation,
+                Py_ssize_t *n_collected, Py_ssize_t *n_uncollectable,
+                int nofail)
 {
     int i;
     Py_ssize_t m = 0; /* # objects collected */
@@ -1181,6 +1195,19 @@
     _PyTime_t t1 = 0;   /* initialize to prevent a compiler warning */
     GCState *gcstate = &tstate->interp->gc;
 
+    // gc_collect_main() must not be called before _PyGC_Init
+    // or after _PyGC_Fini()
+    assert(gcstate->garbage != NULL);
+    assert(!_PyErr_Occurred(tstate));
+
+#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+    if (tstate->interp->config._isolated_interpreter) {
+        // bpo-40533: The garbage collector must not be run on parallel on
+        // Python objects shared by multiple interpreters.
+        return 0;
+    }
+#endif
+
     if (gcstate->debug & DEBUG_STATS) {
         PySys_WriteStderr("gc: collecting generation %d...\n", generation);
         show_stats_each_generations(gcstate);
@@ -1282,8 +1309,7 @@
     if (gcstate->debug & DEBUG_STATS) {
         double d = _PyTime_AsSecondsDouble(_PyTime_GetMonotonicClock() - t1);
         PySys_WriteStderr(
-            "gc: done, %" PY_FORMAT_SIZE_T "d unreachable, "
-            "%" PY_FORMAT_SIZE_T "d uncollectable, %.4fs elapsed\n",
+            "gc: done, %zd unreachable, %zd uncollectable, %.4fs elapsed\n",
             n+m, n, d);
     }
 
@@ -1297,7 +1323,7 @@
     /* Clear free list only during the collection of the highest
      * generation */
     if (generation == NUM_GENERATIONS-1) {
-        clear_freelists();
+        clear_freelists(tstate->interp);
     }
 
     if (_PyErr_Occurred(tstate)) {
@@ -1379,19 +1405,19 @@
  * progress callbacks.
  */
 static Py_ssize_t
-collect_with_callback(PyThreadState *tstate, int generation)
+gc_collect_with_callback(PyThreadState *tstate, int generation)
 {
     assert(!_PyErr_Occurred(tstate));
     Py_ssize_t result, collected, uncollectable;
     invoke_gc_callback(tstate, "start", generation, 0, 0);
-    result = collect(tstate, generation, &collected, &uncollectable, 0);
+    result = gc_collect_main(tstate, generation, &collected, &uncollectable, 0);
     invoke_gc_callback(tstate, "stop", generation, collected, uncollectable);
     assert(!_PyErr_Occurred(tstate));
     return result;
 }
 
 static Py_ssize_t
-collect_generations(PyThreadState *tstate)
+gc_collect_generations(PyThreadState *tstate)
 {
     GCState *gcstate = &tstate->interp->gc;
     /* Find the oldest generation (highest numbered) where the count
@@ -1439,7 +1465,7 @@
             if (i == NUM_GENERATIONS - 1
                 && gcstate->long_lived_pending < gcstate->long_lived_total / 4)
                 continue;
-            n = collect_with_callback(tstate, i);
+            n = gc_collect_with_callback(tstate, i);
             break;
         }
     }
@@ -1458,9 +1484,7 @@
 gc_enable_impl(PyObject *module)
 /*[clinic end generated code: output=45a427e9dce9155c input=81ac4940ca579707]*/
 {
-    PyThreadState *tstate = _PyThreadState_GET();
-    GCState *gcstate = &tstate->interp->gc;
-    gcstate->enabled = 1;
+    PyGC_Enable();
     Py_RETURN_NONE;
 }
 
@@ -1474,9 +1498,7 @@
 gc_disable_impl(PyObject *module)
 /*[clinic end generated code: output=97d1030f7aa9d279 input=8c2e5a14e800d83b]*/
 {
-    PyThreadState *tstate = _PyThreadState_GET();
-    GCState *gcstate = &tstate->interp->gc;
-    gcstate->enabled = 0;
+    PyGC_Disable();
     Py_RETURN_NONE;
 }
 
@@ -1490,9 +1512,7 @@
 gc_isenabled_impl(PyObject *module)
 /*[clinic end generated code: output=1874298331c49130 input=30005e0422373b31]*/
 {
-    PyThreadState *tstate = _PyThreadState_GET();
-    GCState *gcstate = &tstate->interp->gc;
-    return gcstate->enabled;
+    return PyGC_IsEnabled();
 }
 
 /*[clinic input]
@@ -1528,7 +1548,7 @@
     }
     else {
         gcstate->collecting = 1;
-        n = collect_with_callback(tstate, generation);
+        n = gc_collect_with_callback(tstate, generation);
         gcstate->collecting = 0;
     }
     return n;
@@ -1556,8 +1576,7 @@
 gc_set_debug_impl(PyObject *module, int flags)
 /*[clinic end generated code: output=7c8366575486b228 input=5e5ce15e84fbed15]*/
 {
-    PyThreadState *tstate = _PyThreadState_GET();
-    GCState *gcstate = &tstate->interp->gc;
+    GCState *gcstate = get_gc_state();
     gcstate->debug = flags;
     Py_RETURN_NONE;
 }
@@ -1572,8 +1591,7 @@
 gc_get_debug_impl(PyObject *module)
 /*[clinic end generated code: output=91242f3506cd1e50 input=91a101e1c3b98366]*/
 {
-    PyThreadState *tstate = _PyThreadState_GET();
-    GCState *gcstate = &tstate->interp->gc;
+    GCState *gcstate = get_gc_state();
     return gcstate->debug;
 }
 
@@ -1586,8 +1604,7 @@
 static PyObject *
 gc_set_threshold(PyObject *self, PyObject *args)
 {
-    PyThreadState *tstate = _PyThreadState_GET();
-    GCState *gcstate = &tstate->interp->gc;
+    GCState *gcstate = get_gc_state();
     if (!PyArg_ParseTuple(args, "i|ii:set_threshold",
                           &gcstate->generations[0].threshold,
                           &gcstate->generations[1].threshold,
@@ -1610,8 +1627,7 @@
 gc_get_threshold_impl(PyObject *module)
 /*[clinic end generated code: output=7902bc9f41ecbbd8 input=286d79918034d6e6]*/
 {
-    PyThreadState *tstate = _PyThreadState_GET();
-    GCState *gcstate = &tstate->interp->gc;
+    GCState *gcstate = get_gc_state();
     return Py_BuildValue("(iii)",
                          gcstate->generations[0].threshold,
                          gcstate->generations[1].threshold,
@@ -1628,8 +1644,7 @@
 gc_get_count_impl(PyObject *module)
 /*[clinic end generated code: output=354012e67b16398f input=a392794a08251751]*/
 {
-    PyThreadState *tstate = _PyThreadState_GET();
-    GCState *gcstate = &tstate->interp->gc;
+    GCState *gcstate = get_gc_state();
     return Py_BuildValue("(iii)",
                          gcstate->generations[0].count,
                          gcstate->generations[1].count,
@@ -1672,15 +1687,17 @@
 static PyObject *
 gc_get_referrers(PyObject *self, PyObject *args)
 {
-    PyThreadState *tstate = _PyThreadState_GET();
-    int i;
+    if (PySys_Audit("gc.get_referrers", "(O)", args) < 0) {
+        return NULL;
+    }
+
     PyObject *result = PyList_New(0);
     if (!result) {
         return NULL;
     }
 
-    GCState *gcstate = &tstate->interp->gc;
-    for (i = 0; i < NUM_GENERATIONS; i++) {
+    GCState *gcstate = get_gc_state();
+    for (int i = 0; i < NUM_GENERATIONS; i++) {
         if (!(gc_referrers_for(args, GEN_HEAD(gcstate, i), result))) {
             Py_DECREF(result);
             return NULL;
@@ -1704,6 +1721,9 @@
 gc_get_referents(PyObject *self, PyObject *args)
 {
     Py_ssize_t i;
+    if (PySys_Audit("gc.get_referents", "(O)", args) < 0) {
+        return NULL;
+    }
     PyObject *result = PyList_New(0);
 
     if (result == NULL)
@@ -1746,6 +1766,10 @@
     PyObject* result;
     GCState *gcstate = &tstate->interp->gc;
 
+    if (PySys_Audit("gc.get_objects", "n", generation) < 0) {
+        return NULL;
+    }
+
     result = PyList_New(0);
     if (result == NULL) {
         return NULL;
@@ -1799,11 +1823,10 @@
 {
     int i;
     struct gc_generation_stats stats[NUM_GENERATIONS], *st;
-    PyThreadState *tstate = _PyThreadState_GET();
 
     /* To get consistent values despite allocations while constructing
        the result list, we use a snapshot of the running stats. */
-    GCState *gcstate = &tstate->interp->gc;
+    GCState *gcstate = get_gc_state();
     for (i = 0; i < NUM_GENERATIONS; i++) {
         stats[i] = gcstate->generation_stats[i];
     }
@@ -1894,8 +1917,7 @@
 gc_freeze_impl(PyObject *module)
 /*[clinic end generated code: output=502159d9cdc4c139 input=b602b16ac5febbe5]*/
 {
-    PyThreadState *tstate = _PyThreadState_GET();
-    GCState *gcstate = &tstate->interp->gc;
+    GCState *gcstate = get_gc_state();
     for (int i = 0; i < NUM_GENERATIONS; ++i) {
         gc_list_merge(GEN_HEAD(gcstate, i), &gcstate->permanent_generation.head);
         gcstate->generations[i].count = 0;
@@ -1915,8 +1937,7 @@
 gc_unfreeze_impl(PyObject *module)
 /*[clinic end generated code: output=1c15f2043b25e169 input=2dd52b170f4cef6c]*/
 {
-    PyThreadState *tstate = _PyThreadState_GET();
-    GCState *gcstate = &tstate->interp->gc;
+    GCState *gcstate = get_gc_state();
     gc_list_merge(&gcstate->permanent_generation.head,
                   GEN_HEAD(gcstate, NUM_GENERATIONS-1));
     Py_RETURN_NONE;
@@ -1932,8 +1953,7 @@
 gc_get_freeze_count_impl(PyObject *module)
 /*[clinic end generated code: output=61cbd9f43aa032e1 input=45ffbc65cfe2a6ed]*/
 {
-    PyThreadState *tstate = _PyThreadState_GET();
-    GCState *gcstate = &tstate->interp->gc;
+    GCState *gcstate = get_gc_state();
     return gc_list_size(&gcstate->permanent_generation.head);
 }
 
@@ -1984,63 +2004,79 @@
     {NULL,      NULL}           /* Sentinel */
 };
 
-static struct PyModuleDef gcmodule = {
-    PyModuleDef_HEAD_INIT,
-    "gc",              /* m_name */
-    gc__doc__,         /* m_doc */
-    -1,                /* m_size */
-    GcMethods,         /* m_methods */
-    NULL,              /* m_reload */
-    NULL,              /* m_traverse */
-    NULL,              /* m_clear */
-    NULL               /* m_free */
-};
-
-PyMODINIT_FUNC
-PyInit_gc(void)
+static int
+gcmodule_exec(PyObject *module)
 {
-    PyThreadState *tstate = _PyThreadState_GET();
-    GCState *gcstate = &tstate->interp->gc;
+    GCState *gcstate = get_gc_state();
 
-    PyObject *m = PyModule_Create(&gcmodule);
-
-    if (m == NULL) {
-        return NULL;
+    /* garbage and callbacks are initialized by _PyGC_Init() early in
+     * interpreter lifecycle. */
+    assert(gcstate->garbage != NULL);
+    if (PyModule_AddObjectRef(module, "garbage", gcstate->garbage) < 0) {
+        return -1;
+    }
+    assert(gcstate->callbacks != NULL);
+    if (PyModule_AddObjectRef(module, "callbacks", gcstate->callbacks) < 0) {
+        return -1;
     }
 
-    if (gcstate->garbage == NULL) {
-        gcstate->garbage = PyList_New(0);
-        if (gcstate->garbage == NULL) {
-            return NULL;
-        }
-    }
-    Py_INCREF(gcstate->garbage);
-    if (PyModule_AddObject(m, "garbage", gcstate->garbage) < 0) {
-        return NULL;
-    }
-
-    if (gcstate->callbacks == NULL) {
-        gcstate->callbacks = PyList_New(0);
-        if (gcstate->callbacks == NULL) {
-            return NULL;
-        }
-    }
-    Py_INCREF(gcstate->callbacks);
-    if (PyModule_AddObject(m, "callbacks", gcstate->callbacks) < 0) {
-        return NULL;
-    }
-
-#define ADD_INT(NAME) if (PyModule_AddIntConstant(m, #NAME, NAME) < 0) { return NULL; }
+#define ADD_INT(NAME) if (PyModule_AddIntConstant(module, #NAME, NAME) < 0) { return -1; }
     ADD_INT(DEBUG_STATS);
     ADD_INT(DEBUG_COLLECTABLE);
     ADD_INT(DEBUG_UNCOLLECTABLE);
     ADD_INT(DEBUG_SAVEALL);
     ADD_INT(DEBUG_LEAK);
 #undef ADD_INT
-    return m;
+    return 0;
 }
 
-/* API to invoke gc.collect() from C */
+static PyModuleDef_Slot gcmodule_slots[] = {
+    {Py_mod_exec, gcmodule_exec},
+    {0, NULL}
+};
+
+static struct PyModuleDef gcmodule = {
+    PyModuleDef_HEAD_INIT,
+    .m_name = "gc",
+    .m_doc = gc__doc__,
+    .m_size = 0,  // per interpreter state, see: get_gc_state()
+    .m_methods = GcMethods,
+    .m_slots = gcmodule_slots
+};
+
+PyMODINIT_FUNC
+PyInit_gc(void)
+{
+    return PyModuleDef_Init(&gcmodule);
+}
+
+/* C API for controlling the state of the garbage collector */
+int
+PyGC_Enable(void)
+{
+    GCState *gcstate = get_gc_state();
+    int old_state = gcstate->enabled;
+    gcstate->enabled = 1;
+    return old_state;
+}
+
+int
+PyGC_Disable(void)
+{
+    GCState *gcstate = get_gc_state();
+    int old_state = gcstate->enabled;
+    gcstate->enabled = 0;
+    return old_state;
+}
+
+int
+PyGC_IsEnabled(void)
+{
+    GCState *gcstate = get_gc_state();
+    return gcstate->enabled;
+}
+
+/* Public API to invoke gc.collect() from C */
 Py_ssize_t
 PyGC_Collect(void)
 {
@@ -2060,7 +2096,7 @@
         PyObject *exc, *value, *tb;
         gcstate->collecting = 1;
         _PyErr_Fetch(tstate, &exc, &value, &tb);
-        n = collect_with_callback(tstate, NUM_GENERATIONS - 1);
+        n = gc_collect_with_callback(tstate, NUM_GENERATIONS - 1);
         _PyErr_Restore(tstate, exc, value, tb);
         gcstate->collecting = 0;
     }
@@ -2069,41 +2105,30 @@
 }
 
 Py_ssize_t
-_PyGC_CollectIfEnabled(void)
+_PyGC_CollectNoFail(PyThreadState *tstate)
 {
-    return PyGC_Collect();
-}
-
-Py_ssize_t
-_PyGC_CollectNoFail(void)
-{
-    PyThreadState *tstate = _PyThreadState_GET();
-    assert(!_PyErr_Occurred(tstate));
-
-    GCState *gcstate = &tstate->interp->gc;
-    Py_ssize_t n;
-
     /* Ideally, this function is only called on interpreter shutdown,
        and therefore not recursively.  Unfortunately, when there are daemon
        threads, a daemon thread can start a cyclic garbage collection
        during interpreter shutdown (and then never finish it).
        See http://bugs.python.org/issue8713#msg195178 for an example.
        */
+    GCState *gcstate = &tstate->interp->gc;
     if (gcstate->collecting) {
-        n = 0;
+        return 0;
     }
-    else {
-        gcstate->collecting = 1;
-        n = collect(tstate, NUM_GENERATIONS - 1, NULL, NULL, 1);
-        gcstate->collecting = 0;
-    }
+
+    Py_ssize_t n;
+    gcstate->collecting = 1;
+    n = gc_collect_main(tstate, NUM_GENERATIONS - 1, NULL, NULL, 1);
+    gcstate->collecting = 0;
     return n;
 }
 
 void
-_PyGC_DumpShutdownStats(PyThreadState *tstate)
+_PyGC_DumpShutdownStats(PyInterpreterState *interp)
 {
-    GCState *gcstate = &tstate->interp->gc;
+    GCState *gcstate = &interp->gc;
     if (!(gcstate->debug & DEBUG_SAVEALL)
         && gcstate->garbage != NULL && PyList_GET_SIZE(gcstate->garbage) > 0) {
         const char *message;
@@ -2137,12 +2162,36 @@
     }
 }
 
-void
-_PyGC_Fini(PyThreadState *tstate)
+
+static void
+gc_fini_untrack(PyGC_Head *list)
 {
-    GCState *gcstate = &tstate->interp->gc;
+    PyGC_Head *gc;
+    for (gc = GC_NEXT(list); gc != list; gc = GC_NEXT(list)) {
+        PyObject *op = FROM_GC(gc);
+        _PyObject_GC_UNTRACK(op);
+    }
+}
+
+
+void
+_PyGC_Fini(PyInterpreterState *interp)
+{
+    GCState *gcstate = &interp->gc;
     Py_CLEAR(gcstate->garbage);
     Py_CLEAR(gcstate->callbacks);
+
+    if (!_Py_IsMainInterpreter(interp)) {
+        // bpo-46070: Explicitly untrack all objects currently tracked by the
+        // GC. Otherwise, if an object is used later by another interpreter,
+        // calling PyObject_GC_UnTrack() on the object crashs if the previous
+        // or the next object of the PyGC_Head structure became a dangling
+        // pointer.
+        for (int i = 0; i < NUM_GENERATIONS; i++) {
+            PyGC_Head *gen = GEN_HEAD(gcstate, i);
+            gc_fini_untrack(gen);
+        }
+    }
 }
 
 /* for debugging */
@@ -2239,7 +2288,7 @@
         !_PyErr_Occurred(tstate))
     {
         gcstate->collecting = 1;
-        collect_generations(tstate);
+        gc_collect_generations(tstate);
         gcstate->collecting = 0;
     }
     PyObject *op = FROM_GC(g);
@@ -2262,8 +2311,10 @@
 _PyObject_GC_New(PyTypeObject *tp)
 {
     PyObject *op = _PyObject_GC_Malloc(_PyObject_SIZE(tp));
-    if (op != NULL)
-        op = PyObject_INIT(op, tp);
+    if (op == NULL) {
+        return NULL;
+    }
+    _PyObject_Init(op, tp);
     return op;
 }
 
@@ -2279,8 +2330,10 @@
     }
     size = _PyObject_VAR_SIZE(tp, nitems);
     op = (PyVarObject *) _PyObject_GC_Malloc(size);
-    if (op != NULL)
-        op = PyObject_INIT_VAR(op, tp, nitems);
+    if (op == NULL) {
+        return NULL;
+    }
+    _PyObject_InitVar(op, tp, nitems);
     return op;
 }
 
@@ -2294,7 +2347,7 @@
     }
 
     PyGC_Head *g = AS_GC(op);
-    g = (PyGC_Head *)PyObject_REALLOC(g,  sizeof(PyGC_Head) + basicsize);
+    g = (PyGC_Head *)PyObject_Realloc(g,  sizeof(PyGC_Head) + basicsize);
     if (g == NULL)
         return (PyVarObject *)PyErr_NoMemory();
     op = (PyVarObject *) FROM_GC(g);
@@ -2309,12 +2362,11 @@
     if (_PyObject_GC_IS_TRACKED(op)) {
         gc_list_remove(g);
     }
-    PyThreadState *tstate = _PyThreadState_GET();
-    GCState *gcstate = &tstate->interp->gc;
+    GCState *gcstate = get_gc_state();
     if (gcstate->generations[0].count > 0) {
         gcstate->generations[0].count--;
     }
-    PyObject_FREE(g);
+    PyObject_Free(g);
 }
 
 int
diff --git a/Modules/getbuildinfo.c b/Modules/getbuildinfo.c
index 5f941a2..7cb7397 100644
--- a/Modules/getbuildinfo.c
+++ b/Modules/getbuildinfo.c
@@ -40,8 +40,9 @@
     const char *revision = _Py_gitversion();
     const char *sep = *revision ? ":" : "";
     const char *gitid = _Py_gitidentifier();
-    if (!(*gitid))
-        gitid = "default";
+    if (!(*gitid)) {
+        gitid = "main";
+    }
     PyOS_snprintf(buildinfo, sizeof(buildinfo),
                   "%s%s%s, %.20s, %.9s", gitid, sep, revision,
                   DATE, TIME);
diff --git a/Modules/getpath.c b/Modules/getpath.c
index 980874f..ef6dd59 100644
--- a/Modules/getpath.c
+++ b/Modules/getpath.c
@@ -10,7 +10,6 @@
 #include <string.h>
 
 #ifdef __APPLE__
-#  include <AvailabilityMacros.h>
 #  include <mach-o/dyld.h>
 #endif
 
@@ -1264,6 +1263,7 @@
 
     status = calculate_open_pyenv(calculate, &env_file);
     if (_PyStatus_EXCEPTION(status)) {
+        assert(env_file == NULL);
         return status;
     }
     if (env_file == NULL) {
@@ -1324,11 +1324,6 @@
         goto done;
     }
 
-    /* Replace "00" with version */
-    size_t len = wcslen(calculate->zip_path);
-    calculate->zip_path[len - 6] = VERSION[0];
-    calculate->zip_path[len - 5] = VERSION[2];
-
     res = _PyStatus_OK();
 
 done:
@@ -1510,7 +1505,7 @@
     }
 
     /* If a pyvenv.cfg configure file is found,
-       argv0_path is overriden with its 'home' variable. */
+       argv0_path is overridden with its 'home' variable. */
     status = calculate_read_pyenv(calculate);
     if (_PyStatus_EXCEPTION(status)) {
         return status;
diff --git a/Modules/grpmodule.c b/Modules/grpmodule.c
index cdb3ae8..f6298ca 100644
--- a/Modules/grpmodule.c
+++ b/Modules/grpmodule.c
@@ -46,20 +46,19 @@
     return (grpmodulestate *)state;
 }
 
-#define modulestate_global get_grp_state(PyState_FindModule(&grpmodule))
-
 static struct PyModuleDef grpmodule;
 
 #define DEFAULT_BUFFER_SIZE 1024
 
 static PyObject *
-mkgrent(struct group *p)
+mkgrent(PyObject *module, struct group *p)
 {
     int setIndex = 0;
     PyObject *v, *w;
     char **member;
 
-    if ((v = PyStructSequence_New(modulestate_global->StructGrpType)) == NULL)
+    v = PyStructSequence_New(get_grp_state(module)->StructGrpType);
+    if (v == NULL)
         return NULL;
 
     if ((w = PyList_New(0)) == NULL) {
@@ -111,30 +110,14 @@
 grp_getgrgid_impl(PyObject *module, PyObject *id)
 /*[clinic end generated code: output=30797c289504a1ba input=15fa0e2ccf5cda25]*/
 {
-    PyObject *py_int_id, *retval = NULL;
+    PyObject *retval = NULL;
     int nomem = 0;
     char *buf = NULL, *buf2 = NULL;
     gid_t gid;
     struct group *p;
 
     if (!_Py_Gid_Converter(id, &gid)) {
-        if (!PyErr_ExceptionMatches(PyExc_TypeError)) {
-            return NULL;
-        }
-        PyErr_Clear();
-        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
-                             "group id must be int, not %.200",
-                             Py_TYPE(id)->tp_name) < 0) {
-            return NULL;
-        }
-        py_int_id = PyNumber_Long(id);
-        if (!py_int_id)
-            return NULL;
-        if (!_Py_Gid_Converter(py_int_id, &gid)) {
-            Py_DECREF(py_int_id);
-            return NULL;
-        }
-        Py_DECREF(py_int_id);
+        return NULL;
     }
 #ifdef HAVE_GETGRGID_R
     int status;
@@ -186,7 +169,7 @@
         Py_DECREF(gid_obj);
         return NULL;
     }
-    retval = mkgrent(p);
+    retval = mkgrent(module, p);
 #ifdef HAVE_GETGRGID_R
     PyMem_RawFree(buf);
 #endif
@@ -264,7 +247,7 @@
         }
         goto out;
     }
-    retval = mkgrent(p);
+    retval = mkgrent(module, p);
 out:
     PyMem_RawFree(buf);
     Py_DECREF(bytes);
@@ -291,7 +274,7 @@
         return NULL;
     setgrent();
     while ((p = getgrent()) != NULL) {
-        PyObject *v = mkgrent(p);
+        PyObject *v = mkgrent(module, p);
         if (v == NULL || PyList_Append(d, v) != 0) {
             Py_XDECREF(v);
             Py_DECREF(d);
@@ -327,6 +310,26 @@
 according to the password database.  Check both databases to get\n\
 complete membership information.)");
 
+static int
+grpmodule_exec(PyObject *module)
+{
+    grpmodulestate *state = get_grp_state(module);
+
+    state->StructGrpType = PyStructSequence_NewType(&struct_group_type_desc);
+    if (state->StructGrpType == NULL) {
+        return -1;
+    }
+    if (PyModule_AddType(module, state->StructGrpType) < 0) {
+        return -1;
+    }
+    return 0;
+}
+
+static PyModuleDef_Slot grpmodule_slots[] = {
+    {Py_mod_exec, grpmodule_exec},
+    {0, NULL}
+};
+
 static int grpmodule_traverse(PyObject *m, visitproc visit, void *arg) {
     Py_VISIT(get_grp_state(m)->StructGrpType);
     return 0;
@@ -342,37 +345,19 @@
 }
 
 static struct PyModuleDef grpmodule = {
-        PyModuleDef_HEAD_INIT,
-        "grp",
-        grp__doc__,
-        sizeof(grpmodulestate),
-        grp_methods,
-        NULL,
-        grpmodule_traverse,
-        grpmodule_clear,
-        grpmodule_free,
+    PyModuleDef_HEAD_INIT,
+    .m_name = "grp",
+    .m_doc = grp__doc__,
+    .m_size = sizeof(grpmodulestate),
+    .m_methods = grp_methods,
+    .m_slots = grpmodule_slots,
+    .m_traverse = grpmodule_traverse,
+    .m_clear = grpmodule_clear,
+    .m_free = grpmodule_free,
 };
 
 PyMODINIT_FUNC
 PyInit_grp(void)
 {
-    PyObject *m;
-    if ((m = PyState_FindModule(&grpmodule)) != NULL) {
-        Py_INCREF(m);
-        return m;
-    }
-
-    if ((m = PyModule_Create(&grpmodule)) == NULL) {
-        return NULL;
-    }
-
-    grpmodulestate *state = PyModule_GetState(m);
-    state->StructGrpType = PyStructSequence_NewType(&struct_group_type_desc);
-    if (state->StructGrpType == NULL) {
-        return NULL;
-    }
-
-    Py_INCREF(state->StructGrpType);
-    PyModule_AddObject(m, "struct_group", (PyObject *) state->StructGrpType);
-    return m;
+   return PyModuleDef_Init(&grpmodule);
 }
diff --git a/Modules/hashlib.h b/Modules/hashlib.h
index 978593e..56ae7a5 100644
--- a/Modules/hashlib.h
+++ b/Modules/hashlib.h
@@ -8,7 +8,7 @@
 #define GET_BUFFER_VIEW_OR_ERROR(obj, viewp, erraction) do { \
         if (PyUnicode_Check((obj))) { \
             PyErr_SetString(PyExc_TypeError, \
-                            "Unicode-objects must be encoded before hashing");\
+                            "Strings must be encoded before hashing");\
             erraction; \
         } \
         if (!PyObject_CheckBuffer((obj))) { \
diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c
index 18fcebd..f8e2c45 100644
--- a/Modules/itertoolsmodule.c
+++ b/Modules/itertoolsmodule.c
@@ -1,7 +1,10 @@
 
+
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
-#include "pycore_tupleobject.h"
+#include "pycore_long.h"          // _PyLong_GetZero()
+#include "pycore_object.h"        // _PyObject_GC_TRACK()
+#include "pycore_tuple.h"         // _PyTuple_ITEMS()
 #include <stddef.h>               // offsetof()
 
 /* Itertools module written and maintained
@@ -26,8 +29,9 @@
 class itertools.compress "compressobject *" "&compress_type"
 class itertools.filterfalse "filterfalseobject *" "&filterfalse_type"
 class itertools.count "countobject *" "&count_type"
+class itertools.pairwise "pairwiseobject *" "&pairwise_type"
 [clinic start generated code]*/
-/*[clinic end generated code: output=da39a3ee5e6b4b0d input=ea05c93c6d94726a]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=6498ed21fbe1bf94]*/
 
 static PyTypeObject groupby_type;
 static PyTypeObject _grouper_type;
@@ -44,9 +48,140 @@
 static PyTypeObject compress_type;
 static PyTypeObject filterfalse_type;
 static PyTypeObject count_type;
+static PyTypeObject pairwise_type;
 
 #include "clinic/itertoolsmodule.c.h"
 
+/* pairwise object ***********************************************************/
+
+typedef struct {
+    PyObject_HEAD
+    PyObject *it;
+    PyObject *old;
+} pairwiseobject;
+
+/*[clinic input]
+@classmethod
+itertools.pairwise.__new__ as pairwise_new
+    iterable: object
+    /
+Return an iterator of overlapping pairs taken from the input iterator.
+
+    s -> (s0,s1), (s1,s2), (s2, s3), ...
+
+[clinic start generated code]*/
+
+static PyObject *
+pairwise_new_impl(PyTypeObject *type, PyObject *iterable)
+/*[clinic end generated code: output=9f0267062d384456 input=6e7c3cddb431a8d6]*/
+{
+    PyObject *it;
+    pairwiseobject *po;
+
+    it = PyObject_GetIter(iterable);
+    if (it == NULL) {
+        return NULL;
+    }
+    po = (pairwiseobject *)type->tp_alloc(type, 0);
+    if (po == NULL) {
+        Py_DECREF(it);
+        return NULL;
+    }
+    po->it = it;
+    po->old = NULL;
+    return (PyObject *)po;
+}
+
+static void
+pairwise_dealloc(pairwiseobject *po)
+{
+    PyObject_GC_UnTrack(po);
+    Py_XDECREF(po->it);
+    Py_XDECREF(po->old);
+    Py_TYPE(po)->tp_free(po);
+}
+
+static int
+pairwise_traverse(pairwiseobject *po, visitproc visit, void *arg)
+{
+    Py_VISIT(po->it);
+    Py_VISIT(po->old);
+    return 0;
+}
+
+static PyObject *
+pairwise_next(pairwiseobject *po)
+{
+    PyObject *it = po->it;
+    PyObject *old = po->old;
+    PyObject *new, *result;
+
+    if (it == NULL) {
+        return NULL;
+    }
+    if (old == NULL) {
+        po->old = old = (*Py_TYPE(it)->tp_iternext)(it);
+        if (old == NULL) {
+            Py_CLEAR(po->it);
+            return NULL;
+        }
+    }
+    new = (*Py_TYPE(it)->tp_iternext)(it);
+    if (new == NULL) {
+        Py_CLEAR(po->it);
+        Py_CLEAR(po->old);
+        return NULL;
+    }
+    /* Future optimization: Reuse the result tuple as we do in enumerate() */
+    result = PyTuple_Pack(2, old, new);
+    Py_SETREF(po->old, new);
+    return result;
+}
+
+static PyTypeObject pairwise_type = {
+    PyVarObject_HEAD_INIT(&PyType_Type, 0)
+    "itertools.pairwise",           /* tp_name */
+    sizeof(pairwiseobject),         /* tp_basicsize */
+    0,                              /* tp_itemsize */
+    /* methods */
+    (destructor)pairwise_dealloc,   /* tp_dealloc */
+    0,                              /* tp_vectorcall_offset */
+    0,                              /* tp_getattr */
+    0,                              /* tp_setattr */
+    0,                              /* tp_as_async */
+    0,                              /* tp_repr */
+    0,                              /* tp_as_number */
+    0,                              /* tp_as_sequence */
+    0,                              /* tp_as_mapping */
+    0,                              /* tp_hash */
+    0,                              /* tp_call */
+    0,                              /* tp_str */
+    PyObject_GenericGetAttr,        /* tp_getattro */
+    0,                              /* tp_setattro */
+    0,                              /* tp_as_buffer */
+    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
+        Py_TPFLAGS_BASETYPE,        /* tp_flags */
+    pairwise_new__doc__,            /* tp_doc */
+    (traverseproc)pairwise_traverse,    /* tp_traverse */
+    0,                              /* tp_clear */
+    0,                              /* tp_richcompare */
+    0,                              /* tp_weaklistoffset */
+    PyObject_SelfIter,              /* tp_iter */
+    (iternextfunc)pairwise_next,    /* tp_iternext */
+    0,                              /* tp_methods */
+    0,                              /* tp_members */
+    0,                              /* tp_getset */
+    0,                              /* tp_base */
+    0,                              /* tp_dict */
+    0,                              /* tp_descr_get */
+    0,                              /* tp_descr_set */
+    0,                              /* tp_dictoffset */
+    0,                              /* tp_init */
+    PyType_GenericAlloc,            /* tp_alloc */
+    pairwise_new,                   /* tp_new */
+    PyObject_GC_Del,                /* tp_free */
+};
+
 
 /* groupby object ************************************************************/
 
@@ -728,7 +863,7 @@
 tee_fromiterable(PyObject *iterable)
 {
     teeobject *to;
-    PyObject *it = NULL;
+    PyObject *it;
 
     it = PyObject_GetIter(iterable);
     if (it == NULL)
@@ -738,21 +873,22 @@
         goto done;
     }
 
-    to = PyObject_GC_New(teeobject, &tee_type);
-    if (to == NULL)
-        goto done;
-    to->dataobj = (teedataobject *)teedataobject_newinternal(it);
-    if (!to->dataobj) {
-        PyObject_GC_Del(to);
+    PyObject *dataobj = teedataobject_newinternal(it);
+    if (!dataobj) {
         to = NULL;
         goto done;
     }
-
+    to = PyObject_GC_New(teeobject, &tee_type);
+    if (to == NULL) {
+        Py_DECREF(dataobj);
+        goto done;
+    }
+    to->dataobj = (teedataobject *)dataobj;
     to->index = 0;
     to->weakreflist = NULL;
     PyObject_GC_Track(to);
 done:
-    Py_XDECREF(it);
+    Py_DECREF(it);
     return (PyObject *)to;
 }
 
@@ -999,8 +1135,7 @@
 static int
 cycle_traverse(cycleobject *lz, visitproc visit, void *arg)
 {
-    if (lz->it)
-        Py_VISIT(lz->it);
+    Py_VISIT(lz->it);
     Py_VISIT(lz->saved);
     return 0;
 }
@@ -2245,6 +2380,11 @@
             lz->result = result;
             Py_DECREF(old_result);
         }
+        // bpo-42536: The GC may have untracked this result tuple. Since we're
+        // recycling it, make sure it's tracked again:
+        else if (!_PyObject_GC_IS_TRACKED(result)) {
+            _PyObject_GC_TRACK(result);
+        }
         /* Now, we've got the only copy so we can update it in-place */
         assert (npools==0 || Py_REFCNT(result) == 1);
 
@@ -2568,6 +2708,11 @@
             co->result = result;
             Py_DECREF(old_result);
         }
+        // bpo-42536: The GC may have untracked this result tuple. Since we're
+        // recycling it, make sure it's tracked again:
+        else if (!_PyObject_GC_IS_TRACKED(result)) {
+            _PyObject_GC_TRACK(result);
+        }
         /* Now, we've got the only copy so we can update it in-place
          * CPython's empty tuple is a singleton and cached in
          * PyTuple's freelist.
@@ -2781,14 +2926,14 @@
     r: Py_ssize_t
 Return successive r-length combinations of elements in the iterable allowing individual elements to have successive repeats.
 
-combinations_with_replacement('ABC', 2) --> AA AB AC BB BC CC"
+combinations_with_replacement('ABC', 2) --> ('A','A'), ('A','B'), ('A','C'), ('B','B'), ('B','C'), ('C','C')
 [clinic start generated code]*/
 
 static PyObject *
 itertools_combinations_with_replacement_impl(PyTypeObject *type,
                                              PyObject *iterable,
                                              Py_ssize_t r)
-/*[clinic end generated code: output=48b26856d4e659ca input=dc2a8c7ba785fad7]*/
+/*[clinic end generated code: output=48b26856d4e659ca input=1dc58e82a0878fdc]*/
 {
     cwrobject *co;
     Py_ssize_t n;
@@ -2902,6 +3047,11 @@
             co->result = result;
             Py_DECREF(old_result);
         }
+        // bpo-42536: The GC may have untracked this result tuple. Since we're
+        // recycling it, make sure it's tracked again:
+        else if (!_PyObject_GC_IS_TRACKED(result)) {
+            _PyObject_GC_TRACK(result);
+        }
         /* Now, we've got the only copy so we can update it in-place CPython's
            empty tuple is a singleton and cached in PyTuple's freelist. */
         assert(r == 0 || Py_REFCNT(result) == 1);
@@ -3246,6 +3396,11 @@
             po->result = result;
             Py_DECREF(old_result);
         }
+        // bpo-42536: The GC may have untracked this result tuple. Since we're
+        // recycling it, make sure it's tracked again:
+        else if (!_PyObject_GC_IS_TRACKED(result)) {
+            _PyObject_GC_TRACK(result);
+        }
         /* Now, we've got the only copy so we can update it in-place */
         assert(r == 0 || Py_REFCNT(result) == 1);
 
@@ -4041,13 +4196,14 @@
         }
     } else {
         cnt = 0;
-        long_cnt = _PyLong_Zero;
+        long_cnt = _PyLong_GetZero();
     }
     Py_INCREF(long_cnt);
 
     /* If not specified, step defaults to 1 */
-    if (long_step == NULL)
-        long_step = _PyLong_One;
+    if (long_step == NULL) {
+        long_step = _PyLong_GetOne();
+    }
     Py_INCREF(long_step);
 
     assert(long_cnt != NULL && long_step != NULL);
@@ -4515,6 +4671,11 @@
             PyTuple_SET_ITEM(result, i, item);
             Py_DECREF(olditem);
         }
+        // bpo-42536: The GC may have untracked this result tuple. Since we're
+        // recycling it, make sure it's tracked again:
+        if (!_PyObject_GC_IS_TRACKED(result)) {
+            _PyObject_GC_TRACK(result);
+        }
     } else {
         result = PyTuple_New(tuplesize);
         if (result == NULL)
@@ -4665,6 +4826,7 @@
 filterfalse(pred, seq) --> elements of seq where pred(elem) is False\n\
 islice(seq, [start,] stop [, step]) --> elements from\n\
        seq[start:stop:step]\n\
+pairwise(s) --> (s[0],s[1]), (s[1],s[2]), (s[2], s[3]), ...\n\
 starmap(fun, seq) --> fun(*seq[0]), fun(*seq[1]), ...\n\
 tee(it, n=2) --> (it1, it2 , ... itn) splits one iterator into n\n\
 takewhile(pred, seq) --> seq[0], seq[1], until pred fails\n\
@@ -4694,6 +4856,7 @@
         &filterfalse_type,
         &count_type,
         &ziplongest_type,
+        &pairwise_type,
         &permutations_type,
         &product_type,
         &repeat_type,
diff --git a/Modules/main.c b/Modules/main.c
index 2cc891f..2684d23 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -87,7 +87,7 @@
 }
 
 
-/* Return non-zero is stdin is a TTY or if -i command line option is used */
+/* Return non-zero if stdin is a TTY or if -i command line option is used */
 static int
 stdin_is_interactive(const PyConfig *config)
 {
@@ -223,7 +223,7 @@
 
 
 static int
-pymain_run_command(wchar_t *command, PyCompilerFlags *cf)
+pymain_run_command(wchar_t *command)
 {
     PyObject *unicode, *bytes;
     int ret;
@@ -243,7 +243,9 @@
         goto error;
     }
 
-    ret = PyRun_SimpleStringFlags(PyBytes_AsString(bytes), cf);
+    PyCompilerFlags cf = _PyCompilerFlags_INIT;
+    cf.cf_flags |= PyCF_IGNORE_COOKIE;
+    ret = PyRun_SimpleStringFlags(PyBytes_AsString(bytes), &cf);
     Py_DECREF(bytes);
     return (ret != 0);
 
@@ -305,29 +307,23 @@
 
 
 static int
-pymain_run_file(const PyConfig *config, PyCompilerFlags *cf)
+pymain_run_file_obj(PyObject *program_name, PyObject *filename,
+                    int skip_source_first_line)
 {
-    const wchar_t *filename = config->run_filename;
-    if (PySys_Audit("cpython.run_file", "u", filename) < 0) {
+    if (PySys_Audit("cpython.run_file", "O", filename) < 0) {
         return pymain_exit_err_print();
     }
-    FILE *fp = _Py_wfopen(filename, L"rb");
+
+    FILE *fp = _Py_fopen_obj(filename, "rb");
     if (fp == NULL) {
-        char *cfilename_buffer;
-        const char *cfilename;
-        int err = errno;
-        cfilename_buffer = _Py_EncodeLocaleRaw(filename, NULL);
-        if (cfilename_buffer != NULL)
-            cfilename = cfilename_buffer;
-        else
-            cfilename = "<unprintable file name>";
-        fprintf(stderr, "%ls: can't open file '%s': [Errno %d] %s\n",
-                config->program_name, cfilename, err, strerror(err));
-        PyMem_RawFree(cfilename_buffer);
+        // Ignore the OSError
+        PyErr_Clear();
+        PySys_FormatStderr("%S: can't open file %R: [Errno %d] %s\n",
+                           program_name, filename, errno, strerror(errno));
         return 2;
     }
 
-    if (config->skip_source_first_line) {
+    if (skip_source_first_line) {
         int ch;
         /* Push back first newline so line numbers remain the same */
         while ((ch = getc(fp)) != EOF) {
@@ -340,104 +336,97 @@
 
     struct _Py_stat_struct sb;
     if (_Py_fstat_noraise(fileno(fp), &sb) == 0 && S_ISDIR(sb.st_mode)) {
-        fprintf(stderr,
-                "%ls: '%ls' is a directory, cannot continue\n",
-                config->program_name, filename);
+        PySys_FormatStderr("%S: %R is a directory, cannot continue\n",
+                           program_name, filename);
         fclose(fp);
         return 1;
     }
 
-    /* call pending calls like signal handlers (SIGINT) */
+    // Call pending calls like signal handlers (SIGINT)
     if (Py_MakePendingCalls() == -1) {
         fclose(fp);
         return pymain_exit_err_print();
     }
 
-    PyObject *unicode, *bytes = NULL;
-    const char *filename_str;
-
-    unicode = PyUnicode_FromWideChar(filename, wcslen(filename));
-    if (unicode != NULL) {
-        bytes = PyUnicode_EncodeFSDefault(unicode);
-        Py_DECREF(unicode);
-    }
-    if (bytes != NULL) {
-        filename_str = PyBytes_AsString(bytes);
-    }
-    else {
-        PyErr_Clear();
-        filename_str = "<filename encoding error>";
-    }
-
     /* PyRun_AnyFileExFlags(closeit=1) calls fclose(fp) before running code */
-    int run = PyRun_AnyFileExFlags(fp, filename_str, 1, cf);
-    Py_XDECREF(bytes);
+    PyCompilerFlags cf = _PyCompilerFlags_INIT;
+    int run = _PyRun_AnyFileObject(fp, filename, 1, &cf);
     return (run != 0);
 }
 
+static int
+pymain_run_file(const PyConfig *config)
+{
+    PyObject *filename = PyUnicode_FromWideChar(config->run_filename, -1);
+    if (filename == NULL) {
+        PyErr_Print();
+        return -1;
+    }
+    PyObject *program_name = PyUnicode_FromWideChar(config->program_name, -1);
+    if (program_name == NULL) {
+        Py_DECREF(filename);
+        PyErr_Print();
+        return -1;
+    }
+
+    int res = pymain_run_file_obj(program_name, filename,
+                                  config->skip_source_first_line);
+    Py_DECREF(filename);
+    Py_DECREF(program_name);
+    return res;
+}
+
 
 static int
-pymain_run_startup(PyConfig *config, PyCompilerFlags *cf, int *exitcode)
+pymain_run_startup(PyConfig *config, int *exitcode)
 {
     int ret;
-    PyObject *startup_obj = NULL;
     if (!config->use_environment) {
         return 0;
     }
+    PyObject *startup = NULL;
 #ifdef MS_WINDOWS
-    const wchar_t *wstartup = _wgetenv(L"PYTHONSTARTUP");
-    if (wstartup == NULL || wstartup[0] == L'\0') {
+    const wchar_t *env = _wgetenv(L"PYTHONSTARTUP");
+    if (env == NULL || env[0] == L'\0') {
         return 0;
     }
-    PyObject *startup_bytes = NULL;
-    startup_obj = PyUnicode_FromWideChar(wstartup, wcslen(wstartup));
-    if (startup_obj == NULL) {
-        goto error;
-    }
-    startup_bytes = PyUnicode_EncodeFSDefault(startup_obj);
-    if (startup_bytes == NULL) {
-        goto error;
-    }
-    const char *startup = PyBytes_AS_STRING(startup_bytes);
-#else
-    const char *startup = _Py_GetEnv(config->use_environment, "PYTHONSTARTUP");
+    startup = PyUnicode_FromWideChar(env, wcslen(env));
     if (startup == NULL) {
+        goto error;
+    }
+#else
+    const char *env = _Py_GetEnv(config->use_environment, "PYTHONSTARTUP");
+    if (env == NULL) {
         return 0;
     }
-    startup_obj = PyUnicode_DecodeFSDefault(startup);
-    if (startup_obj == NULL) {
+    startup = PyUnicode_DecodeFSDefault(env);
+    if (startup == NULL) {
         goto error;
     }
 #endif
-    if (PySys_Audit("cpython.run_startup", "O", startup_obj) < 0) {
+    if (PySys_Audit("cpython.run_startup", "O", startup) < 0) {
         goto error;
     }
 
-#ifdef MS_WINDOWS
-    FILE *fp = _Py_wfopen(wstartup, L"r");
-#else
-    FILE *fp = _Py_fopen(startup, "r");
-#endif
+    FILE *fp = _Py_fopen_obj(startup, "r");
     if (fp == NULL) {
         int save_errno = errno;
         PyErr_Clear();
         PySys_WriteStderr("Could not open PYTHONSTARTUP\n");
 
         errno = save_errno;
-        PyErr_SetFromErrnoWithFilenameObjects(PyExc_OSError, startup_obj, NULL);
+        PyErr_SetFromErrnoWithFilenameObjects(PyExc_OSError, startup, NULL);
         goto error;
     }
 
-    (void) PyRun_SimpleFileExFlags(fp, startup, 0, cf);
+    PyCompilerFlags cf = _PyCompilerFlags_INIT;
+    (void) _PyRun_SimpleFileObject(fp, startup, 0, &cf);
     PyErr_Clear();
     fclose(fp);
     ret = 0;
 
 done:
-#ifdef MS_WINDOWS
-    Py_XDECREF(startup_bytes);
-#endif
-    Py_XDECREF(startup_obj);
+    Py_XDECREF(startup);
     return ret;
 
 error:
@@ -484,14 +473,14 @@
 
 
 static int
-pymain_run_stdin(PyConfig *config, PyCompilerFlags *cf)
+pymain_run_stdin(PyConfig *config)
 {
     if (stdin_is_interactive(config)) {
         config->inspect = 0;
         Py_InspectFlag = 0; /* do exit on SystemExit */
 
         int exitcode;
-        if (pymain_run_startup(config, cf, &exitcode)) {
+        if (pymain_run_startup(config, &exitcode)) {
             return exitcode;
         }
 
@@ -509,13 +498,14 @@
         return pymain_exit_err_print();
     }
 
-    int run = PyRun_AnyFileExFlags(stdin, "<stdin>", 0, cf);
+    PyCompilerFlags cf = _PyCompilerFlags_INIT;
+    int run = PyRun_AnyFileExFlags(stdin, "<stdin>", 0, &cf);
     return (run != 0);
 }
 
 
 static void
-pymain_repl(PyConfig *config, PyCompilerFlags *cf, int *exitcode)
+pymain_repl(PyConfig *config, int *exitcode)
 {
     /* Check this environment variable at the end, to give programs the
        opportunity to set it from Python. */
@@ -534,7 +524,8 @@
         return;
     }
 
-    int res = PyRun_AnyFileFlags(stdin, "<stdin>", cf);
+    PyCompilerFlags cf = _PyCompilerFlags_INIT;
+    int res = PyRun_AnyFileFlags(stdin, "<stdin>", &cf);
     *exitcode = (res != 0);
 }
 
@@ -580,13 +571,11 @@
         }
     }
 
-    PyCompilerFlags cf = _PyCompilerFlags_INIT;
-
     pymain_header(config);
     pymain_import_readline(config);
 
     if (config->run_command) {
-        *exitcode = pymain_run_command(config->run_command, &cf);
+        *exitcode = pymain_run_command(config->run_command);
     }
     else if (config->run_module) {
         *exitcode = pymain_run_module(config->run_module, 1);
@@ -595,13 +584,13 @@
         *exitcode = pymain_run_module(L"__main__", 0);
     }
     else if (config->run_filename != NULL) {
-        *exitcode = pymain_run_file(config, &cf);
+        *exitcode = pymain_run_file(config);
     }
     else {
-        *exitcode = pymain_run_stdin(config, &cf);
+        *exitcode = pymain_run_stdin(config);
     }
 
-    pymain_repl(config, &cf, exitcode);
+    pymain_repl(config, exitcode);
     goto done;
 
 error:
diff --git a/Modules/makesetup b/Modules/makesetup
index fefe3fd..1a76783 100755
--- a/Modules/makesetup
+++ b/Modules/makesetup
@@ -231,7 +231,7 @@
 			*) src='$(srcdir)/'"$srcdir/$src";;
 			esac
 			case $doconfig in
-			no)	cc="$cc \$(CCSHARED) \$(PY_CFLAGS) \$(PY_CPPFLAGS)";;
+			no)	cc="$cc \$(CCSHARED) \$(PY_CFLAGS_NODIST) \$(PY_CPPFLAGS)";;
 			*)
 				cc="$cc \$(PY_BUILTIN_MODULE_CFLAGS)";;
 			esac
diff --git a/Modules/makexp_aix b/Modules/makexp_aix
index cb349c2..b39d93b 100755
--- a/Modules/makexp_aix
+++ b/Modules/makexp_aix
@@ -3,7 +3,7 @@
 # ===========================================================================
 # FILE:         makexp_aix
 # TYPE:         standalone executable
-# SYSTEM:	AIX 3.2.5 and AIX 4
+# SYSTEM:	    AIX
 #
 # DESCRIPTION:  This script creates an export list of ALL global symbols
 #               from a list of object or archive files.
@@ -48,34 +48,24 @@
 echo "* $notemsg" >> $expFileName
 echo "*" >> $expFileName
 
-# Extract the symbol list using 'nm' which produces quite
-# different output under AIX 4 than under AIX 3.2.5.
-# The following handles both versions by using a common flagset.
+# Extract the symbol list using 'nm'
 # Here are some hidden tricks:
-# 1. Use /usr/ccs/bin/nm. Relevant to AIX 3.2.5 which has
-#    another version under /usr/ucb/bin/nm.
-# 2. Use the -B flag to have a standard BSD representation
-#    of the symbol list on both AIX 3.2.5 and AIX 4. The "-B"
-#    flag is missing in the AIX 3.2.5 online usage help of 'nm'.
-# 3. Use the -x flag to have a hex representation of the symbol
-#    values. This fills the leading whitespaces on AIX 4,
-#    thus simplifying the sed statement.
-# 4. Eliminate all entries except those with either "B", "D"
-#    or "T" key letters. We are interested only in the global
-#    (extern) BSS, DATA and TEXT symbols. With the same statement
-#    we eliminate object member lines relevant to AIX 4.
-# 5. Eliminate entries containing a dot. We can have a dot only
-#    as a symbol prefix, but such symbols are undefined externs.
-# 6. Eliminate everything including the key letter, so that we're
-#    left with just the symbol name.
-# 7. Eliminate all entries containing two colons, like Class::method
+# - Use the -B flag to have a standard BSD representation
+#   of the symbol list.
+# - Use the -x flag to have a hex representation of the symbol
+#   values. This fills the leading whitespaces, thus simplifying
+#   the sed statement.
+# - Eliminate all entries except those with either "B", "D"
+#   or "T" key letters. We are interested only in the global
+#   (extern) BSS, DATA and TEXT symbols. With the same statement
+#   we eliminate object member lines relevant to AIX 4.
+# - Eliminate entries containing a dot. We can have a dot only
+#   as a symbol prefix, but such symbols are undefined externs.
+# - Eliminate everything including the key letter, so that we're
+#   left with just the symbol name.
+# - Eliminate all entries containing two colons, like Class::method
 #
 
-# Use -X32_64 if it appears to be implemented in this version of 'nm'.
-NM=/usr/ccs/bin/nm
-xopt=-X32_64
-$NM -e $xopt $1 >/dev/null 2>&1 || xopt=""
-
-$NM -Bex $xopt $inputFiles					\
+/usr/ccs/bin/nm -Bex -X32_64 $inputFiles \
 | sed -e '/ [^BDT] /d' -e '/\./d' -e 's/.* [BDT] //' -e '/::/d'	\
 | sort | uniq >> $expFileName
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c
index 4aa7e65..4534176 100644
--- a/Modules/mathmodule.c
+++ b/Modules/mathmodule.c
@@ -53,7 +53,9 @@
  */
 
 #include "Python.h"
+#include "pycore_bitutils.h"      // _Py_bit_length()
 #include "pycore_dtoa.h"
+#include "pycore_long.h"          // _PyLong_GetZero()
 #include "_math.h"
 
 #include "clinic/mathmodule.c.h"
@@ -843,13 +845,15 @@
         Py_SETREF(res, PyNumber_Absolute(res));
         return res;
     }
+
+    PyObject *one = _PyLong_GetOne();  // borrowed ref
     for (i = 1; i < nargs; i++) {
-        x = PyNumber_Index(args[i]);
+        x = _PyNumber_Index(args[i]);
         if (x == NULL) {
             Py_DECREF(res);
             return NULL;
         }
-        if (res == _PyLong_One) {
+        if (res == one) {
             /* Fast path: just check arguments.
                It is okay to use identity comparison here. */
             Py_DECREF(x);
@@ -916,13 +920,15 @@
         Py_SETREF(res, PyNumber_Absolute(res));
         return res;
     }
+
+    PyObject *zero = _PyLong_GetZero();  // borrowed ref
     for (i = 1; i < nargs; i++) {
         x = PyNumber_Index(args[i]);
         if (x == NULL) {
             Py_DECREF(res);
             return NULL;
         }
-        if (res == _PyLong_Zero) {
+        if (res == zero) {
             /* Fast path: just check arguments.
                It is okay to use identity comparison here. */
             Py_DECREF(x);
@@ -971,9 +977,13 @@
          * On some platforms (Ubuntu/ia64) it seems that errno can be
          * set to ERANGE for subnormal results that do *not* underflow
          * to zero.  So to be safe, we'll ignore ERANGE whenever the
-         * function result is less than one in absolute value.
+         * function result is less than 1.5 in absolute value.
+         *
+         * bpo-46018: Changed to 1.5 to ensure underflows in expm1()
+         * are correctly detected, since the function may underflow
+         * toward -1.0 rather than 0.0.
          */
-        if (fabs(x) < 1.0)
+        if (fabs(x) < 1.5)
             result = 0;
         else
             PyErr_SetString(PyExc_OverflowError,
@@ -1728,7 +1738,7 @@
     uint64_t m, u;
     PyObject *a = NULL, *b;
 
-    n = PyNumber_Index(n);
+    n = _PyNumber_Index(n);
     if (n == NULL) {
         return NULL;
     }
@@ -1836,7 +1846,7 @@
     }
 
     if (a_too_large) {
-        Py_SETREF(a, PyNumber_Subtract(a, _PyLong_One));
+        Py_SETREF(a, PyNumber_Subtract(a, _PyLong_GetOne()));
     }
     Py_DECREF(n);
     return a;
@@ -1873,7 +1883,7 @@
  *        (1) *
  *        (1) *
  *        (1 * 3 * 5) *
- *        (1 * 3 * 5 * 7 * 9)
+ *        (1 * 3 * 5 * 7 * 9) *
  *        (1 * 3 * 5 * 7 * 9 * 11 * 13 * 15 * 17 * 19)
  *
  * Here i goes from large to small: the first term corresponds to i=4 (any
@@ -2052,37 +2062,9 @@
 {
     long x, two_valuation;
     int overflow;
-    PyObject *result, *odd_part, *pyint_form;
+    PyObject *result, *odd_part;
 
-    if (PyFloat_Check(arg)) {
-        if (PyErr_WarnEx(PyExc_DeprecationWarning,
-                         "Using factorial() with floats is deprecated",
-                         1) < 0)
-        {
-            return NULL;
-        }
-        PyObject *lx;
-        double dx = PyFloat_AS_DOUBLE((PyFloatObject *)arg);
-        if (!(Py_IS_FINITE(dx) && dx == floor(dx))) {
-            PyErr_SetString(PyExc_ValueError,
-                            "factorial() only accepts integral values");
-            return NULL;
-        }
-        lx = PyLong_FromDouble(dx);
-        if (lx == NULL)
-            return NULL;
-        x = PyLong_AsLongAndOverflow(lx, &overflow);
-        Py_DECREF(lx);
-    }
-    else {
-        pyint_form = PyNumber_Index(arg);
-        if (pyint_form == NULL) {
-            return NULL;
-        }
-        x = PyLong_AsLongAndOverflow(pyint_form, &overflow);
-        Py_DECREF(pyint_form);
-    }
-
+    x = PyLong_AsLongAndOverflow(arg, &overflow);
     if (x == -1 && PyErr_Occurred()) {
         return NULL;
     }
@@ -2431,40 +2413,108 @@
 }
 
 /*
-Given an *n* length *vec* of values and a value *max*, compute:
+Given a *vec* of values, compute the vector norm:
 
-    max * sqrt(sum((x / max) ** 2 for x in vec))
+    sqrt(sum(x ** 2 for x in vec))
 
-The value of the *max* variable must be non-negative and
-equal to the absolute value of the largest magnitude
-entry in the vector.  If n==0, then *max* should be 0.0.
+The *max* variable should be equal to the largest fabs(x).
+The *n* variable is the length of *vec*.
+If n==0, then *max* should be 0.0.
 If an infinity is present in the vec, *max* should be INF.
-
 The *found_nan* variable indicates whether some member of
 the *vec* is a NaN.
 
-To improve accuracy and to increase the number of cases where
-vector_norm() is commutative, we use a variant of Neumaier
-summation specialized to exploit that we always know that
-|csum| >= |x|.
+To avoid overflow/underflow and to achieve high accuracy giving results
+that are almost always correctly rounded, four techniques are used:
 
-The *csum* variable tracks the cumulative sum and *frac* tracks
-the cumulative fractional errors at each step.  Since this
-variant assumes that |csum| >= |x| at each step, we establish
-the precondition by starting the accumulation from 1.0 which
-represents the largest possible value of (x/max)**2.
+* lossless scaling using a power-of-two scaling factor
+* accurate squaring using Veltkamp-Dekker splitting [1]
+* compensated summation using a variant of the Neumaier algorithm [2]
+* differential correction of the square root [3]
 
-After the loop is finished, the initial 1.0 is subtracted out
-for a net zero effect on the final sum.  Since *csum* will be
-greater than 1.0, the subtraction of 1.0 will not cause
-fractional digits to be dropped from *csum*.
+The usual presentation of the Neumaier summation algorithm has an
+expensive branch depending on which operand has the larger
+magnitude.  We avoid this cost by arranging the calculation so that
+fabs(csum) is always as large as fabs(x).
+
+To establish the invariant, *csum* is initialized to 1.0 which is
+always larger than x**2 after scaling or after division by *max*.
+After the loop is finished, the initial 1.0 is subtracted out for a
+net zero effect on the final sum.  Since *csum* will be greater than
+1.0, the subtraction of 1.0 will not cause fractional digits to be
+dropped from *csum*.
+
+To get the full benefit from compensated summation, the largest
+addend should be in the range: 0.5 <= |x| <= 1.0.  Accordingly,
+scaling or division by *max* should not be skipped even if not
+otherwise needed to prevent overflow or loss of precision.
+
+The assertion that hi*hi <= 1.0 is a bit subtle.  Each vector element
+gets scaled to a magnitude below 1.0.  The Veltkamp-Dekker splitting
+algorithm gives a *hi* value that is correctly rounded to half
+precision.  When a value at or below 1.0 is correctly rounded, it
+never goes above 1.0.  And when values at or below 1.0 are squared,
+they remain at or below 1.0, thus preserving the summation invariant.
+
+Another interesting assertion is that csum+lo*lo == csum. In the loop,
+each scaled vector element has a magnitude less than 1.0.  After the
+Veltkamp split, *lo* has a maximum value of 2**-27.  So the maximum
+value of *lo* squared is 2**-54.  The value of ulp(1.0)/2.0 is 2**-53.
+Given that csum >= 1.0, we have:
+    lo**2 <= 2**-54 < 2**-53 == 1/2*ulp(1.0) <= ulp(csum)/2
+Since lo**2 is less than 1/2 ulp(csum), we have csum+lo*lo == csum.
+
+To minimize loss of information during the accumulation of fractional
+values, each term has a separate accumulator.  This also breaks up
+sequential dependencies in the inner loop so the CPU can maximize
+floating point throughput. [4]  On a 2.6 GHz Haswell, adding one
+dimension has an incremental cost of only 5ns -- for example when
+moving from hypot(x,y) to hypot(x,y,z).
+
+The square root differential correction is needed because a
+correctly rounded square root of a correctly rounded sum of
+squares can still be off by as much as one ulp.
+
+The differential correction starts with a value *x* that is
+the difference between the square of *h*, the possibly inaccurately
+rounded square root, and the accurately computed sum of squares.
+The correction is the first order term of the Maclaurin series
+expansion of sqrt(h**2 + x) == h + x/(2*h) + O(x**2). [5]
+
+Essentially, this differential correction is equivalent to one
+refinement step in Newton's divide-and-average square root
+algorithm, effectively doubling the number of accurate bits.
+This technique is used in Dekker's SQRT2 algorithm and again in
+Borges' ALGORITHM 4 and 5.
+
+Without proof for all cases, hypot() cannot claim to be always
+correctly rounded.  However for n <= 1000, prior to the final addition
+that rounds the overall result, the internal accuracy of "h" together
+with its correction of "x / (2.0 * h)" is at least 100 bits. [6]
+Also, hypot() was tested against a Decimal implementation with
+prec=300.  After 100 million trials, no incorrectly rounded examples
+were found.  In addition, perfect commutativity (all permutations are
+exactly equal) was verified for 1 billion random inputs with n=5. [7]
+
+References:
+
+1. Veltkamp-Dekker splitting: http://csclub.uwaterloo.ca/~pbarfuss/dekker1971.pdf
+2. Compensated summation:  http://www.ti3.tu-harburg.de/paper/rump/Ru08b.pdf
+3. Square root differential correction:  https://arxiv.org/pdf/1904.09481.pdf
+4. Data dependency graph:  https://bugs.python.org/file49439/hypot.png
+5. https://www.wolframalpha.com/input/?i=Maclaurin+series+sqrt%28h**2+%2B+x%29+at+x%3D0
+6. Analysis of internal accuracy:  https://bugs.python.org/file49484/best_frac.py
+7. Commutativity test:  https://bugs.python.org/file49448/test_hypot_commutativity.py
 
 */
 
 static inline double
 vector_norm(Py_ssize_t n, double *vec, double max, int found_nan)
 {
-    double x, csum = 1.0, oldcsum, frac = 0.0;
+    const double T27 = 134217729.0;     /* ldexp(1.0, 27) + 1.0) */
+    double x, scale, oldcsum, csum = 1.0, frac1 = 0.0, frac2 = 0.0, frac3 = 0.0;
+    double t, hi, lo, h;
+    int max_e;
     Py_ssize_t i;
 
     if (Py_IS_INFINITY(max)) {
@@ -2476,17 +2526,83 @@
     if (max == 0.0 || n <= 1) {
         return max;
     }
+    frexp(max, &max_e);
+    if (max_e >= -1023) {
+        scale = ldexp(1.0, -max_e);
+        assert(max * scale >= 0.5);
+        assert(max * scale < 1.0);
+        for (i=0 ; i < n ; i++) {
+            x = vec[i];
+            assert(Py_IS_FINITE(x) && fabs(x) <= max);
+
+            x *= scale;
+            assert(fabs(x) < 1.0);
+
+            t = x * T27;
+            hi = t - (t - x);
+            lo = x - hi;
+            assert(hi + lo == x);
+
+            x = hi * hi;
+            assert(x <= 1.0);
+            assert(fabs(csum) >= fabs(x));
+            oldcsum = csum;
+            csum += x;
+            frac1 += (oldcsum - csum) + x;
+
+            x = 2.0 * hi * lo;
+            assert(fabs(csum) >= fabs(x));
+            oldcsum = csum;
+            csum += x;
+            frac2 += (oldcsum - csum) + x;
+
+            assert(csum + lo * lo == csum);
+            frac3 += lo * lo;
+        }
+        h = sqrt(csum - 1.0 + (frac1 + frac2 + frac3));
+
+        x = h;
+        t = x * T27;
+        hi = t - (t - x);
+        lo = x - hi;
+        assert (hi + lo == x);
+
+        x = -hi * hi;
+        assert(fabs(csum) >= fabs(x));
+        oldcsum = csum;
+        csum += x;
+        frac1 += (oldcsum - csum) + x;
+
+        x = -2.0 * hi * lo;
+        assert(fabs(csum) >= fabs(x));
+        oldcsum = csum;
+        csum += x;
+        frac2 += (oldcsum - csum) + x;
+
+        x = -lo * lo;
+        assert(fabs(csum) >= fabs(x));
+        oldcsum = csum;
+        csum += x;
+        frac3 += (oldcsum - csum) + x;
+
+        x = csum - 1.0 + (frac1 + frac2 + frac3);
+        return (h + x / (2.0 * h)) / scale;
+    }
+    /* When max_e < -1023, ldexp(1.0, -max_e) overflows.
+       So instead of multiplying by a scale, we just divide by *max*.
+    */
     for (i=0 ; i < n ; i++) {
         x = vec[i];
         assert(Py_IS_FINITE(x) && fabs(x) <= max);
         x /= max;
         x = x*x;
+        assert(x <= 1.0);
+        assert(fabs(csum) >= fabs(x));
         oldcsum = csum;
         csum += x;
-        assert(csum >= x);
-        frac += (oldcsum - csum) + x;
+        frac1 += (oldcsum - csum) + x;
     }
-    return max * sqrt(csum - 1.0 + frac);
+    return max * sqrt(csum - 1.0 + frac1);
 }
 
 #define NUM_STACK_ELEMS 16
@@ -2969,14 +3085,9 @@
     }
 
     if (result == NULL) {
-        result = PyLong_FromLong(1);
-        if (result == NULL) {
-            Py_DECREF(iter);
-            return NULL;
-        }
-    } else {
-        Py_INCREF(result);
+        result = _PyLong_GetOne();
     }
+    Py_INCREF(result);
 #ifndef SLOW_PROD
     /* Fast paths for integers keeping temporary products in C.
      * Assumes all inputs are the same type.
@@ -2992,7 +3103,7 @@
         }
         /* Loop over all the items in the iterable until we finish, we overflow
          * or we found a non integer element */
-        while(result == NULL) {
+        while (result == NULL) {
             item = PyIter_Next(iter);
             if (item == NULL) {
                 Py_DECREF(iter);
@@ -3136,24 +3247,11 @@
     if (n == NULL) {
         return NULL;
     }
-    if (!PyLong_CheckExact(n)) {
-        Py_SETREF(n, _PyLong_Copy((PyLongObject *)n));
-        if (n == NULL) {
-            return NULL;
-        }
-    }
     k = PyNumber_Index(k);
     if (k == NULL) {
         Py_DECREF(n);
         return NULL;
     }
-    if (!PyLong_CheckExact(k)) {
-        Py_SETREF(k, _PyLong_Copy((PyLongObject *)k));
-        if (k == NULL) {
-            Py_DECREF(n);
-            return NULL;
-        }
-    }
 
     if (Py_SIZE(n) < 0) {
         PyErr_SetString(PyExc_ValueError,
@@ -3198,10 +3296,10 @@
         goto done;
     }
 
-    factor = n;
-    Py_INCREF(factor);
+    factor = Py_NewRef(n);
+    PyObject *one = _PyLong_GetOne();  // borrowed ref
     for (i = 1; i < factors; ++i) {
-        Py_SETREF(factor, PyNumber_Subtract(factor, _PyLong_One));
+        Py_SETREF(factor, PyNumber_Subtract(factor, one));
         if (factor == NULL) {
             goto error;
         }
@@ -3259,24 +3357,11 @@
     if (n == NULL) {
         return NULL;
     }
-    if (!PyLong_CheckExact(n)) {
-        Py_SETREF(n, _PyLong_Copy((PyLongObject *)n));
-        if (n == NULL) {
-            return NULL;
-        }
-    }
     k = PyNumber_Index(k);
     if (k == NULL) {
         Py_DECREF(n);
         return NULL;
     }
-    if (!PyLong_CheckExact(k)) {
-        Py_SETREF(k, _PyLong_Copy((PyLongObject *)k));
-        if (k == NULL) {
-            Py_DECREF(n);
-            return NULL;
-        }
-    }
 
     if (Py_SIZE(n) < 0) {
         PyErr_SetString(PyExc_ValueError,
@@ -3333,10 +3418,10 @@
         goto done;
     }
 
-    factor = n;
-    Py_INCREF(factor);
+    factor = Py_NewRef(n);
+    PyObject *one = _PyLong_GetOne();  // borrowed ref
     for (i = 1; i < factors; ++i) {
-        Py_SETREF(factor, PyNumber_Subtract(factor, _PyLong_One));
+        Py_SETREF(factor, PyNumber_Subtract(factor, one));
         if (factor == NULL) {
             goto error;
         }
@@ -3391,6 +3476,12 @@
            Bug fixed in bos.adt.libm 7.2.2.0 by APAR IV95512. */
         return PyFloat_FromDouble(y);
     }
+    if (Py_IS_NAN(x)) {
+        return PyFloat_FromDouble(x);
+    }
+    if (Py_IS_NAN(y)) {
+        return PyFloat_FromDouble(y);
+    }
 #endif
     return PyFloat_FromDouble(nextafter(x, y));
 }
diff --git a/Modules/md5module.c b/Modules/md5module.c
index e4d9db4..b50d2e5 100644
--- a/Modules/md5module.c
+++ b/Modules/md5module.c
@@ -74,7 +74,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
+ * Tom St Denis, tomstdenis@gmail.com, https://www.libtom.net
  */
 
 /* rotate the hard way (platform optimizations could be done) */
@@ -211,7 +211,7 @@
 
 /**
    Initialize the hash state
-   @param sha1   The hash state you wish to initialize
+   @param md5   The hash state you wish to initialize
 */
 static void
 md5_init(struct md5_state *md5)
@@ -227,7 +227,7 @@
 
 /**
    Process a block of memory though the hash
-   @param sha1   The hash state
+   @param md5   The hash state
    @param in     The data to hash
    @param inlen  The length of the data (octets)
 */
@@ -263,7 +263,7 @@
 
 /**
    Terminate the hash to get the digest
-   @param sha1  The hash state
+   @param md5  The hash state
    @param out [out] The destination of the hash (16 bytes)
 */
 static void
@@ -318,22 +318,41 @@
  * ------------------------------------------------------------------------
  */
 
-static PyTypeObject MD5type;
+typedef struct {
+    PyTypeObject* md5_type;
+} MD5State;
 
-
-static MD5object *
-newMD5object(void)
+static inline MD5State*
+md5_get_state(PyObject *module)
 {
-    return (MD5object *)PyObject_New(MD5object, &MD5type);
+    void *state = PyModule_GetState(module);
+    assert(state != NULL);
+    return (MD5State *)state;
 }
 
+static MD5object *
+newMD5object(MD5State * st)
+{
+    MD5object *md5 = (MD5object *)PyObject_GC_New(MD5object, st->md5_type);
+    PyObject_GC_Track(md5);
+    return md5;
+}
 
 /* Internal methods for a hash object */
+static int
+MD5_traverse(PyObject *ptr, visitproc visit, void *arg)
+{
+    Py_VISIT(Py_TYPE(ptr));
+    return 0;
+}
 
 static void
 MD5_dealloc(PyObject *ptr)
 {
-    PyObject_Del(ptr);
+    PyTypeObject *tp = Py_TYPE(ptr);
+    PyObject_GC_UnTrack(ptr);
+    PyObject_GC_Del(ptr);
+    Py_DECREF(tp);
 }
 
 
@@ -342,16 +361,19 @@
 /*[clinic input]
 MD5Type.copy
 
+    cls: defining_class
+
 Return a copy of the hash object.
 [clinic start generated code]*/
 
 static PyObject *
-MD5Type_copy_impl(MD5object *self)
-/*[clinic end generated code: output=596eb36852f02071 input=2c09e6d2493f3079]*/
+MD5Type_copy_impl(MD5object *self, PyTypeObject *cls)
+/*[clinic end generated code: output=bf055e08244bf5ee input=d89087dcfb2a8620]*/
 {
-    MD5object *newobj;
+    MD5State *st = PyType_GetModuleState(cls);
 
-    if ((newobj = newMD5object())==NULL)
+    MD5object *newobj;
+    if ((newobj = newMD5object(st))==NULL)
         return NULL;
 
     newobj->hash_state = self->hash_state;
@@ -445,7 +467,6 @@
     return PyLong_FromLong(MD5_DIGESTSIZE);
 }
 
-
 static PyGetSetDef MD5_getseters[] = {
     {"block_size",
      (getter)MD5_get_block_size, NULL,
@@ -462,40 +483,21 @@
     {NULL}  /* Sentinel */
 };
 
-static PyTypeObject MD5type = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "_md5.md5",         /*tp_name*/
-    sizeof(MD5object),  /*tp_basicsize*/
-    0,                  /*tp_itemsize*/
-    /* methods */
-    MD5_dealloc,        /*tp_dealloc*/
-    0,                  /*tp_vectorcall_offset*/
-    0,                  /*tp_getattr*/
-    0,                  /*tp_setattr*/
-    0,                  /*tp_as_async*/
-    0,                  /*tp_repr*/
-    0,                  /*tp_as_number*/
-    0,                  /*tp_as_sequence*/
-    0,                  /*tp_as_mapping*/
-    0,                  /*tp_hash*/
-    0,                  /*tp_call*/
-    0,                  /*tp_str*/
-    0,                  /*tp_getattro*/
-    0,                  /*tp_setattro*/
-    0,                  /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT, /*tp_flags*/
-    0,                  /*tp_doc*/
-    0,                  /*tp_traverse*/
-    0,                  /*tp_clear*/
-    0,                  /*tp_richcompare*/
-    0,                  /*tp_weaklistoffset*/
-    0,                  /*tp_iter*/
-    0,                  /*tp_iternext*/
-    MD5_methods,        /* tp_methods */
-    NULL,               /* tp_members */
-    MD5_getseters,      /* tp_getset */
+static PyType_Slot md5_type_slots[] = {
+    {Py_tp_dealloc, MD5_dealloc},
+    {Py_tp_methods, MD5_methods},
+    {Py_tp_getset, MD5_getseters},
+    {Py_tp_traverse, MD5_traverse},
+    {0,0}
 };
 
+static PyType_Spec md5_type_spec = {
+    .name = "_md5.md5",
+    .basicsize =  sizeof(MD5object),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION |
+              Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_HAVE_GC),
+    .slots = md5_type_slots
+};
 
 /* The single module-level function: new() */
 
@@ -519,7 +521,8 @@
     if (string)
         GET_BUFFER_VIEW_OR_ERROUT(string, &buf);
 
-    if ((new = newMD5object()) == NULL) {
+    MD5State *st = md5_get_state(module);
+    if ((new = newMD5object(st)) == NULL) {
         if (string)
             PyBuffer_Release(&buf);
         return NULL;
@@ -549,37 +552,69 @@
     {NULL,      NULL}            /* Sentinel */
 };
 
+static int
+_md5_traverse(PyObject *module, visitproc visit, void *arg)
+{
+    MD5State *state = md5_get_state(module);
+    Py_VISIT(state->md5_type);
+    return 0;
+}
+
+static int
+_md5_clear(PyObject *module)
+{
+    MD5State *state = md5_get_state(module);
+    Py_CLEAR(state->md5_type);
+    return 0;
+}
+
+static void
+_md5_free(void *module)
+{
+    _md5_clear((PyObject *)module);
+}
 
 /* Initialize this module. */
+static int
+md5_exec(PyObject *m)
+{
+    MD5State *st = md5_get_state(m);
+
+    st->md5_type = (PyTypeObject *)PyType_FromModuleAndSpec(
+        m, &md5_type_spec, NULL);
+
+    if (st->md5_type == NULL) {
+        return -1;
+    }
+
+    Py_INCREF((PyObject *)st->md5_type);
+    if (PyModule_AddObject(m, "MD5Type", (PyObject *)st->md5_type) < 0) {
+         Py_DECREF(st->md5_type);
+        return -1;
+    }
+
+    return 0;
+}
+
+static PyModuleDef_Slot _md5_slots[] = {
+    {Py_mod_exec, md5_exec},
+    {0, NULL}
+};
+
 
 static struct PyModuleDef _md5module = {
         PyModuleDef_HEAD_INIT,
-        "_md5",
-        NULL,
-        -1,
-        MD5_functions,
-        NULL,
-        NULL,
-        NULL,
-        NULL
+        .m_name = "_md5",
+        .m_size = sizeof(MD5State),
+        .m_methods = MD5_functions,
+        .m_slots = _md5_slots,
+        .m_traverse = _md5_traverse,
+        .m_clear = _md5_clear,
+        .m_free = _md5_free,
 };
 
 PyMODINIT_FUNC
 PyInit__md5(void)
 {
-    PyObject *m;
-
-    Py_SET_TYPE(&MD5type, &PyType_Type);
-    if (PyType_Ready(&MD5type) < 0) {
-        return NULL;
-    }
-
-    m = PyModule_Create(&_md5module);
-    if (m == NULL) {
-        return NULL;
-    }
-
-    Py_INCREF((PyObject *)&MD5type);
-    PyModule_AddObject(m, "MD5Type", (PyObject *)&MD5type);
-    return m;
+    return PyModuleDef_Init(&_md5module);
 }
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index a3e22d0..6397b0d 100644
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -20,6 +20,7 @@
 
 #define PY_SSIZE_T_CLEAN
 #include <Python.h>
+#include "structmember.h"         // PyMemberDef
 #include <stddef.h>               // offsetof()
 
 #ifndef MS_WINDOWS
@@ -113,10 +114,31 @@
     access_mode access;
 } mmap_object;
 
+typedef struct {
+    PyTypeObject *mmap_object_type;
+} mmap_state;
+
+static mmap_state *
+get_mmap_state(PyObject *module)
+{
+    mmap_state *state = PyModule_GetState(module);
+    assert(state);
+    return state;
+}
+
+static int
+mmap_object_traverse(mmap_object *m_obj, visitproc visit, void *arg)
+{
+    Py_VISIT(Py_TYPE(m_obj));
+    return 0;
+}
 
 static void
 mmap_object_dealloc(mmap_object *m_obj)
 {
+    PyTypeObject *tp = Py_TYPE(m_obj);
+    PyObject_GC_UnTrack(m_obj);
+
 #ifdef MS_WINDOWS
     Py_BEGIN_ALLOW_THREADS
     if (m_obj->data != NULL)
@@ -142,7 +164,9 @@
 
     if (m_obj->weakreflist != NULL)
         PyObject_ClearWeakRefs((PyObject *) m_obj);
-    Py_TYPE(m_obj)->tp_free((PyObject*)m_obj);
+
+    tp->tp_free(m_obj);
+    Py_DECREF(tp);
 }
 
 static PyObject *
@@ -793,6 +817,11 @@
 }
 #endif // HAVE_MADVISE
 
+static struct PyMemberDef mmap_object_members[] = {
+    {"__weaklistoffset__", T_PYSSIZET, offsetof(mmap_object, weakreflist), READONLY},
+    {NULL},
+};
+
 static struct PyMethodDef mmap_object_methods[] = {
     {"close",           (PyCFunction) mmap_close_method,        METH_NOARGS},
     {"find",            (PyCFunction) mmap_find_method,         METH_VARARGS},
@@ -1035,27 +1064,6 @@
     }
 }
 
-static PySequenceMethods mmap_as_sequence = {
-    (lenfunc)mmap_length,            /*sq_length*/
-    0,                               /*sq_concat*/
-    0,                               /*sq_repeat*/
-    (ssizeargfunc)mmap_item,         /*sq_item*/
-    0,                               /*sq_slice*/
-    (ssizeobjargproc)mmap_ass_item,  /*sq_ass_item*/
-    0,                               /*sq_ass_slice*/
-};
-
-static PyMappingMethods mmap_as_mapping = {
-    (lenfunc)mmap_length,
-    (binaryfunc)mmap_subscript,
-    (objobjargproc)mmap_ass_subscript,
-};
-
-static PyBufferProcs mmap_as_buffer = {
-    (getbufferproc)mmap_buffer_getbuf,
-    (releasebufferproc)mmap_buffer_releasebuf,
-};
-
 static PyObject *
 new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict);
 
@@ -1083,47 +1091,39 @@
 To map anonymous memory, pass -1 as the fileno (both versions).");
 
 
-static PyTypeObject mmap_object_type = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "mmap.mmap",                                /* tp_name */
-    sizeof(mmap_object),                        /* tp_basicsize */
-    0,                                          /* tp_itemsize */
-    /* methods */
-    (destructor)mmap_object_dealloc,            /* tp_dealloc */
-    0,                                          /* tp_vectorcall_offset */
-    0,                                          /* tp_getattr */
-    0,                                          /* tp_setattr */
-    0,                                          /* tp_as_async */
-    (reprfunc)mmap__repr__method,               /* tp_repr */
-    0,                                          /* tp_as_number */
-    &mmap_as_sequence,                          /* tp_as_sequence */
-    &mmap_as_mapping,                           /* tp_as_mapping */
-    0,                                          /* tp_hash */
-    0,                                          /* tp_call */
-    0,                                          /* tp_str */
-    PyObject_GenericGetAttr,                    /* tp_getattro */
-    0,                                          /* tp_setattro */
-    &mmap_as_buffer,                            /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,   /* tp_flags */
-    mmap_doc,                                   /* tp_doc */
-    0,                                          /* tp_traverse */
-    0,                                          /* tp_clear */
-    0,                                          /* tp_richcompare */
-    offsetof(mmap_object, weakreflist),         /* tp_weaklistoffset */
-    0,                                          /* tp_iter */
-    0,                                          /* tp_iternext */
-    mmap_object_methods,                        /* tp_methods */
-    0,                                          /* tp_members */
-    mmap_object_getset,                         /* tp_getset */
-    0,                                          /* tp_base */
-    0,                                          /* tp_dict */
-    0,                                          /* tp_descr_get */
-    0,                                          /* tp_descr_set */
-    0,                                          /* tp_dictoffset */
-    0,                                          /* tp_init */
-    PyType_GenericAlloc,                        /* tp_alloc */
-    new_mmap_object,                            /* tp_new */
-    PyObject_Del,                               /* tp_free */
+static PyType_Slot mmap_object_slots[] = {
+    {Py_tp_new, new_mmap_object},
+    {Py_tp_dealloc, mmap_object_dealloc},
+    {Py_tp_repr, mmap__repr__method},
+    {Py_tp_doc, (void *)mmap_doc},
+    {Py_tp_methods, mmap_object_methods},
+    {Py_tp_members, mmap_object_members},
+    {Py_tp_getset, mmap_object_getset},
+    {Py_tp_getattro, PyObject_GenericGetAttr},
+    {Py_tp_traverse, mmap_object_traverse},
+
+    /* as sequence */
+    {Py_sq_length, mmap_length},
+    {Py_sq_item, mmap_item},
+    {Py_sq_ass_item, mmap_ass_item},
+
+    /* as mapping */
+    {Py_mp_length, mmap_length},
+    {Py_mp_subscript, mmap_subscript},
+    {Py_mp_ass_subscript, mmap_ass_subscript},
+
+    /* as buffer */
+    {Py_bf_getbuffer, mmap_buffer_getbuf},
+    {Py_bf_releasebuffer, mmap_buffer_releasebuf},
+    {0, NULL},
+};
+
+static PyType_Spec mmap_object_spec = {
+    .name = "mmap.mmap",
+    .basicsize = sizeof(mmap_object),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
+              Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = mmap_object_slots,
 };
 
 
@@ -1378,13 +1378,10 @@
      */
     if (fileno != -1 && fileno != 0) {
         /* Ensure that fileno is within the CRT's valid range */
-        _Py_BEGIN_SUPPRESS_IPH
-        fh = (HANDLE)_get_osfhandle(fileno);
-        _Py_END_SUPPRESS_IPH
-        if (fh==(HANDLE)-1) {
-            PyErr_SetFromErrno(PyExc_OSError);
+        fh = _Py_get_osfhandle(fileno);
+        if (fh == INVALID_HANDLE_VALUE)
             return NULL;
-        }
+
         /* Win9x appears to need us seeked to zero */
         lseek(fileno, 0, SEEK_SET);
     }
@@ -1509,154 +1506,201 @@
 }
 #endif /* MS_WINDOWS */
 
-static void
-setint(PyObject *d, const char *name, long value)
+static int
+mmap_traverse(PyObject *module, visitproc visit, void *arg)
 {
-    PyObject *o = PyLong_FromLong(value);
-    if (o) {
-        PyDict_SetItemString(d, name, o);
-        Py_DECREF(o);
-    }
+    mmap_state *state = get_mmap_state(module);
+    Py_VISIT(state->mmap_object_type);
+    return 0;
 }
 
+static int
+mmap_clear(PyObject *module)
+{
+    mmap_state *state = get_mmap_state(module);
+    Py_CLEAR(state->mmap_object_type);
+    return 0;
+}
+
+static void
+mmap_free(void *module)
+{
+    mmap_clear((PyObject *)module);
+}
+
+static int
+mmap_exec(PyObject *module)
+{
+    mmap_state *state = get_mmap_state(module);
+
+    Py_INCREF(PyExc_OSError);
+    if (PyModule_AddObject(module, "error", PyExc_OSError) < 0) {
+        Py_DECREF(PyExc_OSError);
+        return -1;
+    }
+
+    state->mmap_object_type = (PyTypeObject *)PyType_FromModuleAndSpec(module,
+                                                                       &mmap_object_spec,
+                                                                       NULL);
+    if (state->mmap_object_type == NULL) {
+        return -1;
+    }
+    if (PyModule_AddType(module, state->mmap_object_type) < 0) {
+        return -1;
+    }
+
+#define ADD_INT_MACRO(module, constant)                                     \
+    do {                                                                    \
+        if (PyModule_AddIntConstant(module, #constant, constant) < 0) {     \
+            return -1;                                                      \
+        }                                                                   \
+    } while (0)
+
+#ifdef PROT_EXEC
+    ADD_INT_MACRO(module, PROT_EXEC);
+#endif
+#ifdef PROT_READ
+    ADD_INT_MACRO(module, PROT_READ);
+#endif
+#ifdef PROT_WRITE
+    ADD_INT_MACRO(module, PROT_WRITE);
+#endif
+
+#ifdef MAP_SHARED
+    ADD_INT_MACRO(module, MAP_SHARED);
+#endif
+#ifdef MAP_PRIVATE
+    ADD_INT_MACRO(module, MAP_PRIVATE);
+#endif
+#ifdef MAP_DENYWRITE
+    ADD_INT_MACRO(module, MAP_DENYWRITE);
+#endif
+#ifdef MAP_EXECUTABLE
+    ADD_INT_MACRO(module, MAP_EXECUTABLE);
+#endif
+#ifdef MAP_ANONYMOUS
+    if (PyModule_AddIntConstant(module, "MAP_ANON", MAP_ANONYMOUS) < 0 ) {
+        return -1;
+    }
+    ADD_INT_MACRO(module, MAP_ANONYMOUS);
+#endif
+#ifdef MAP_POPULATE
+    ADD_INT_MACRO(module, MAP_POPULATE);
+#endif
+    if (PyModule_AddIntConstant(module, "PAGESIZE", (long)my_getpagesize()) < 0 ) {
+        return -1;
+    }
+
+    if (PyModule_AddIntConstant(module, "ALLOCATIONGRANULARITY", (long)my_getallocationgranularity()) < 0 ) {
+        return -1;
+    }
+
+    ADD_INT_MACRO(module, ACCESS_DEFAULT);
+    ADD_INT_MACRO(module, ACCESS_READ);
+    ADD_INT_MACRO(module, ACCESS_WRITE);
+    ADD_INT_MACRO(module, ACCESS_COPY);
+
+#ifdef HAVE_MADVISE
+    // Conventional advice values
+#ifdef MADV_NORMAL
+    ADD_INT_MACRO(module, MADV_NORMAL);
+#endif
+#ifdef MADV_RANDOM
+    ADD_INT_MACRO(module, MADV_RANDOM);
+#endif
+#ifdef MADV_SEQUENTIAL
+    ADD_INT_MACRO(module, MADV_SEQUENTIAL);
+#endif
+#ifdef MADV_WILLNEED
+    ADD_INT_MACRO(module, MADV_WILLNEED);
+#endif
+#ifdef MADV_DONTNEED
+    ADD_INT_MACRO(module, MADV_DONTNEED);
+#endif
+
+    // Linux-specific advice values
+#ifdef MADV_REMOVE
+    ADD_INT_MACRO(module, MADV_REMOVE);
+#endif
+#ifdef MADV_DONTFORK
+    ADD_INT_MACRO(module, MADV_DONTFORK);
+#endif
+#ifdef MADV_DOFORK
+    ADD_INT_MACRO(module, MADV_DOFORK);
+#endif
+#ifdef MADV_HWPOISON
+    ADD_INT_MACRO(module, MADV_HWPOISON);
+#endif
+#ifdef MADV_MERGEABLE
+    ADD_INT_MACRO(module, MADV_MERGEABLE);
+#endif
+#ifdef MADV_UNMERGEABLE
+    ADD_INT_MACRO(module, MADV_UNMERGEABLE);
+#endif
+#ifdef MADV_SOFT_OFFLINE
+    ADD_INT_MACRO(module, MADV_SOFT_OFFLINE);
+#endif
+#ifdef MADV_HUGEPAGE
+    ADD_INT_MACRO(module, MADV_HUGEPAGE);
+#endif
+#ifdef MADV_NOHUGEPAGE
+    ADD_INT_MACRO(module, MADV_NOHUGEPAGE);
+#endif
+#ifdef MADV_DONTDUMP
+    ADD_INT_MACRO(module, MADV_DONTDUMP);
+#endif
+#ifdef MADV_DODUMP
+    ADD_INT_MACRO(module, MADV_DODUMP);
+#endif
+#ifdef MADV_FREE // (Also present on FreeBSD and macOS.)
+    ADD_INT_MACRO(module, MADV_FREE);
+#endif
+
+    // FreeBSD-specific
+#ifdef MADV_NOSYNC
+    ADD_INT_MACRO(module, MADV_NOSYNC);
+#endif
+#ifdef MADV_AUTOSYNC
+    ADD_INT_MACRO(module, MADV_AUTOSYNC);
+#endif
+#ifdef MADV_NOCORE
+    ADD_INT_MACRO(module, MADV_NOCORE);
+#endif
+#ifdef MADV_CORE
+    ADD_INT_MACRO(module, MADV_CORE);
+#endif
+#ifdef MADV_PROTECT
+    ADD_INT_MACRO(module, MADV_PROTECT);
+#endif
+
+    // Darwin-specific
+#ifdef MADV_FREE_REUSABLE // (As MADV_FREE but reclaims more faithful for task_info/Activity Monitor...)
+    ADD_INT_MACRO(module, MADV_FREE_REUSABLE);
+#endif
+#ifdef MADV_FREE_REUSE // (Reuse pages previously tagged as reusable)
+    ADD_INT_MACRO(module, MADV_FREE_REUSE);
+#endif
+#endif // HAVE_MADVISE
+    return 0;
+}
+
+static PyModuleDef_Slot mmap_slots[] = {
+    {Py_mod_exec, mmap_exec},
+    {0, NULL}
+};
 
 static struct PyModuleDef mmapmodule = {
     PyModuleDef_HEAD_INIT,
-    "mmap",
-    NULL,
-    -1,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    .m_name = "mmap",
+    .m_size = sizeof(mmap_state),
+    .m_slots = mmap_slots,
+    .m_traverse = mmap_traverse,
+    .m_clear = mmap_clear,
+    .m_free = mmap_free,
 };
 
 PyMODINIT_FUNC
 PyInit_mmap(void)
 {
-    PyObject *dict, *module;
-
-    if (PyType_Ready(&mmap_object_type) < 0)
-        return NULL;
-
-    module = PyModule_Create(&mmapmodule);
-    if (module == NULL)
-        return NULL;
-    dict = PyModule_GetDict(module);
-    if (!dict)
-        return NULL;
-    PyDict_SetItemString(dict, "error", PyExc_OSError);
-    PyDict_SetItemString(dict, "mmap", (PyObject*) &mmap_object_type);
-#ifdef PROT_EXEC
-    setint(dict, "PROT_EXEC", PROT_EXEC);
-#endif
-#ifdef PROT_READ
-    setint(dict, "PROT_READ", PROT_READ);
-#endif
-#ifdef PROT_WRITE
-    setint(dict, "PROT_WRITE", PROT_WRITE);
-#endif
-
-#ifdef MAP_SHARED
-    setint(dict, "MAP_SHARED", MAP_SHARED);
-#endif
-#ifdef MAP_PRIVATE
-    setint(dict, "MAP_PRIVATE", MAP_PRIVATE);
-#endif
-#ifdef MAP_DENYWRITE
-    setint(dict, "MAP_DENYWRITE", MAP_DENYWRITE);
-#endif
-#ifdef MAP_EXECUTABLE
-    setint(dict, "MAP_EXECUTABLE", MAP_EXECUTABLE);
-#endif
-#ifdef MAP_ANONYMOUS
-    setint(dict, "MAP_ANON", MAP_ANONYMOUS);
-    setint(dict, "MAP_ANONYMOUS", MAP_ANONYMOUS);
-#endif
-
-    setint(dict, "PAGESIZE", (long)my_getpagesize());
-
-    setint(dict, "ALLOCATIONGRANULARITY", (long)my_getallocationgranularity());
-
-    setint(dict, "ACCESS_DEFAULT", ACCESS_DEFAULT);
-    setint(dict, "ACCESS_READ", ACCESS_READ);
-    setint(dict, "ACCESS_WRITE", ACCESS_WRITE);
-    setint(dict, "ACCESS_COPY", ACCESS_COPY);
-
-#ifdef HAVE_MADVISE
-    // Conventional advice values
-#ifdef MADV_NORMAL
-    setint(dict, "MADV_NORMAL", MADV_NORMAL);
-#endif
-#ifdef MADV_RANDOM
-    setint(dict, "MADV_RANDOM", MADV_RANDOM);
-#endif
-#ifdef MADV_SEQUENTIAL
-    setint(dict, "MADV_SEQUENTIAL", MADV_SEQUENTIAL);
-#endif
-#ifdef MADV_WILLNEED
-    setint(dict, "MADV_WILLNEED", MADV_WILLNEED);
-#endif
-#ifdef MADV_DONTNEED
-    setint(dict, "MADV_DONTNEED", MADV_DONTNEED);
-#endif
-
-    // Linux-specific advice values
-#ifdef MADV_REMOVE
-    setint(dict, "MADV_REMOVE", MADV_REMOVE);
-#endif
-#ifdef MADV_DONTFORK
-    setint(dict, "MADV_DONTFORK", MADV_DONTFORK);
-#endif
-#ifdef MADV_DOFORK
-    setint(dict, "MADV_DOFORK", MADV_DOFORK);
-#endif
-#ifdef MADV_HWPOISON
-    setint(dict, "MADV_HWPOISON", MADV_HWPOISON);
-#endif
-#ifdef MADV_MERGEABLE
-    setint(dict, "MADV_MERGEABLE", MADV_MERGEABLE);
-#endif
-#ifdef MADV_UNMERGEABLE
-    setint(dict, "MADV_UNMERGEABLE", MADV_UNMERGEABLE);
-#endif
-#ifdef MADV_SOFT_OFFLINE
-    setint(dict, "MADV_SOFT_OFFLINE", MADV_SOFT_OFFLINE);
-#endif
-#ifdef MADV_HUGEPAGE
-    setint(dict, "MADV_HUGEPAGE", MADV_HUGEPAGE);
-#endif
-#ifdef MADV_NOHUGEPAGE
-    setint(dict, "MADV_NOHUGEPAGE", MADV_NOHUGEPAGE);
-#endif
-#ifdef MADV_DONTDUMP
-    setint(dict, "MADV_DONTDUMP", MADV_DONTDUMP);
-#endif
-#ifdef MADV_DODUMP
-    setint(dict, "MADV_DODUMP", MADV_DODUMP);
-#endif
-#ifdef MADV_FREE // (Also present on FreeBSD and macOS.)
-    setint(dict, "MADV_FREE", MADV_FREE);
-#endif
-
-    // FreeBSD-specific
-#ifdef MADV_NOSYNC
-    setint(dict, "MADV_NOSYNC", MADV_NOSYNC);
-#endif
-#ifdef MADV_AUTOSYNC
-    setint(dict, "MADV_AUTOSYNC", MADV_AUTOSYNC);
-#endif
-#ifdef MADV_NOCORE
-    setint(dict, "MADV_NOCORE", MADV_NOCORE);
-#endif
-#ifdef MADV_CORE
-    setint(dict, "MADV_CORE", MADV_CORE);
-#endif
-#ifdef MADV_PROTECT
-    setint(dict, "MADV_PROTECT", MADV_PROTECT);
-#endif
-#endif // HAVE_MADVISE
-
-    return module;
+    return PyModuleDef_Init(&mmapmodule);
 }
diff --git a/Modules/nismodule.c b/Modules/nismodule.c
index a24978e..6655451 100644
--- a/Modules/nismodule.c
+++ b/Modules/nismodule.c
@@ -44,12 +44,42 @@
 Returns an array of all available NIS maps within a domain. If domain\n\
 is not specified it defaults to the system default domain.\n");
 
-static PyObject *NisError;
+typedef struct {
+    PyObject *nis_error;
+} nis_state;
+
+static inline nis_state*
+get_nis_state(PyObject *module)
+{
+    void *state = PyModule_GetState(module);
+    assert(state != NULL);
+    return (nis_state *)state;
+}
+
+static int
+nis_clear(PyObject *m)
+{
+    Py_CLEAR(get_nis_state(m)->nis_error);
+    return 0;
+}
+
+static int
+nis_traverse(PyObject *m, visitproc visit, void *arg)
+{
+    Py_VISIT(get_nis_state(m)->nis_error);
+    return 0;
+}
+
+static void
+nis_free(void *m)
+{
+    nis_clear((PyObject *) m);
+}
 
 static PyObject *
-nis_error (int err)
+nis_error(nis_state *state, int err)
 {
-    PyErr_SetString(NisError, yperr_string(err));
+    PyErr_SetString(state->nis_error, yperr_string(err));
     return NULL;
 }
 
@@ -70,7 +100,7 @@
 };
 
 static char *
-nis_mapname (char *map, int *pfix)
+nis_mapname(char *map, int *pfix)
 {
     int i;
 
@@ -98,7 +128,7 @@
 };
 
 static int
-nis_foreach (int instatus, char *inkey, int inkeylen, char *inval,
+nis_foreach(int instatus, char *inkey, int inkeylen, char *inval,
              int invallen, struct ypcallback_data *indata)
 {
     if (instatus == YP_TRUE) {
@@ -137,21 +167,22 @@
 }
 
 static PyObject *
-nis_get_default_domain (PyObject *self, PyObject *Py_UNUSED(ignored))
+nis_get_default_domain(PyObject *module, PyObject *Py_UNUSED(ignored))
 {
     char *domain;
     int err;
     PyObject *res;
-
-    if ((err = yp_get_default_domain(&domain)) != 0)
-        return nis_error(err);
+    nis_state *state = get_nis_state(module);
+    if ((err = yp_get_default_domain(&domain)) != 0) {
+        return nis_error(state, err);
+    }
 
     res = PyUnicode_FromStringAndSize (domain, strlen(domain));
     return res;
 }
 
 static PyObject *
-nis_match (PyObject *self, PyObject *args, PyObject *kwdict)
+nis_match(PyObject *module, PyObject *args, PyObject *kwdict)
 {
     char *match;
     char *domain = NULL;
@@ -165,18 +196,22 @@
 
     if (!PyArg_ParseTupleAndKeywords(args, kwdict,
                                      "Us|s:match", kwlist,
-                                     &ukey, &map, &domain))
+                                     &ukey, &map, &domain)) {
         return NULL;
-    if ((bkey = PyUnicode_EncodeFSDefault(ukey)) == NULL)
+    }
+    if ((bkey = PyUnicode_EncodeFSDefault(ukey)) == NULL) {
         return NULL;
+    }
     /* check for embedded null bytes */
     if (PyBytes_AsStringAndSize(bkey, &key, &keylen) == -1) {
         Py_DECREF(bkey);
         return NULL;
     }
+
+    nis_state *state = get_nis_state(module);
     if (!domain && ((err = yp_get_default_domain(&domain)) != 0)) {
         Py_DECREF(bkey);
-        return nis_error(err);
+        return nis_error(state, err);
     }
     map = nis_mapname (map, &fix);
     if (fix)
@@ -187,15 +222,16 @@
     Py_DECREF(bkey);
     if (fix)
         len--;
-    if (err != 0)
-        return nis_error(err);
+    if (err != 0) {
+        return nis_error(state, err);
+    }
     res = PyUnicode_DecodeFSDefaultAndSize(match, len);
     free (match);
     return res;
 }
 
 static PyObject *
-nis_cat (PyObject *self, PyObject *args, PyObject *kwdict)
+nis_cat(PyObject *module, PyObject *args, PyObject *kwdict)
 {
     char *domain = NULL;
     char *map;
@@ -206,10 +242,13 @@
     static char *kwlist[] = {"map", "domain", NULL};
 
     if (!PyArg_ParseTupleAndKeywords(args, kwdict, "s|s:cat",
-                                     kwlist, &map, &domain))
+                                     kwlist, &map, &domain)) {
         return NULL;
-    if (!domain && ((err = yp_get_default_domain(&domain)) != 0))
-        return nis_error(err);
+    }
+    nis_state *state = get_nis_state(module);
+    if (!domain && ((err = yp_get_default_domain(&domain)) != 0)) {
+        return nis_error(state, err);
+    }
     dict = PyDict_New ();
     if (dict == NULL)
         return NULL;
@@ -222,7 +261,7 @@
     PyEval_RestoreThread(data.state);
     if (err != 0) {
         Py_DECREF(dict);
-        return nis_error(err);
+        return nis_error(state, err);
     }
     return dict;
 }
@@ -352,7 +391,7 @@
 
 static
 nismaplist *
-nis_maplist (char *dom)
+nis_maplist(nis_state *state, char *dom)
 {
     nisresp_maplist *list;
     CLIENT *cl;
@@ -364,12 +403,12 @@
         mapi++;
     }
     if (!server) {
-        PyErr_SetString(NisError, "No NIS master found for any map");
+        PyErr_SetString(state->nis_error, "No NIS master found for any map");
         return NULL;
     }
     cl = clnt_create(server, YPPROG, YPVERS, "tcp");
     if (cl == NULL) {
-        PyErr_SetString(NisError, clnt_spcreateerror(server));
+        PyErr_SetString(state->nis_error, clnt_spcreateerror(server));
         goto finally;
     }
     list = nisproc_maplist_2 (&dom, cl);
@@ -388,7 +427,7 @@
 }
 
 static PyObject *
-nis_maps (PyObject *self, PyObject *args, PyObject *kwdict)
+nis_maps (PyObject *module, PyObject *args, PyObject *kwdict)
 {
     char *domain = NULL;
     nismaplist *maps;
@@ -397,17 +436,22 @@
     static char *kwlist[] = {"domain", NULL};
 
     if (!PyArg_ParseTupleAndKeywords(args, kwdict,
-                                     "|s:maps", kwlist, &domain))
-        return NULL;
-    if (!domain && ((err = yp_get_default_domain (&domain)) != 0)) {
-        nis_error(err);
+                                     "|s:maps", kwlist, &domain)) {
         return NULL;
     }
 
-    if ((maps = nis_maplist (domain)) == NULL)
+    nis_state *state = get_nis_state(module);
+    if (!domain && ((err = yp_get_default_domain (&domain)) != 0)) {
+        nis_error(state, err);
         return NULL;
-    if ((list = PyList_New(0)) == NULL)
+    }
+
+    if ((maps = nis_maplist(state, domain)) == NULL) {
         return NULL;
+    }
+    if ((list = PyList_New(0)) == NULL) {
+        return NULL;
+    }
     for (; maps; maps = maps->next) {
         PyObject *str = PyUnicode_FromString(maps->map);
         if (!str || PyList_Append(list, str) < 0)
@@ -439,31 +483,45 @@
     {NULL,                      NULL}            /* Sentinel */
 };
 
+static int
+nis_exec(PyObject *module)
+{
+    nis_state* state = get_nis_state(module);
+    state->nis_error = PyErr_NewException("nis.error", NULL, NULL);
+    if (state->nis_error == NULL) {
+        return -1;
+    }
+
+    Py_INCREF(state->nis_error);
+    if (PyModule_AddObject(module, "error", state->nis_error) < 0) {
+        Py_DECREF(state->nis_error);
+        return -1;
+    }
+    return 0;
+}
+
+static PyModuleDef_Slot nis_slots[] = {
+    {Py_mod_exec, nis_exec},
+    {0, NULL}
+};
+
 PyDoc_STRVAR(nis__doc__,
 "This module contains functions for accessing NIS maps.\n");
 
 static struct PyModuleDef nismodule = {
     PyModuleDef_HEAD_INIT,
-    "nis",
-    nis__doc__,
-    -1,
-    nis_methods,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    .m_name = "nis",
+    .m_doc = nis__doc__,
+    .m_size = sizeof(nis_state),
+    .m_methods = nis_methods,
+    .m_traverse = nis_traverse,
+    .m_clear = nis_clear,
+    .m_free = nis_free,
+    .m_slots = nis_slots,
 };
 
 PyMODINIT_FUNC
 PyInit_nis(void)
 {
-    PyObject *m, *d;
-    m = PyModule_Create(&nismodule);
-    if (m == NULL)
-        return NULL;
-    d = PyModule_GetDict(m);
-    NisError = PyErr_NewException("nis.error", NULL, NULL);
-    if (NisError != NULL)
-        PyDict_SetItemString(d, "error", NisError);
-    return m;
+    return PyModuleDef_Init(&nismodule);
 }
diff --git a/Modules/ossaudiodev.c b/Modules/ossaudiodev.c
index 2a1ac10..4f2d9cb 100644
--- a/Modules/ossaudiodev.c
+++ b/Modules/ossaudiodev.c
@@ -154,7 +154,7 @@
     /* if already closed, don't reclose it */
     if (self->fd != -1)
         close(self->fd);
-    PyObject_Del(self);
+    PyObject_Free(self);
 }
 
 
@@ -199,7 +199,7 @@
     /* if already closed, don't reclose it */
     if (self->fd != -1)
         close(self->fd);
-    PyObject_Del(self);
+    PyObject_Free(self);
 }
 
 
diff --git a/Modules/overlapped.c b/Modules/overlapped.c
index cd7869f..7c45708 100644
--- a/Modules/overlapped.c
+++ b/Modules/overlapped.c
@@ -37,6 +37,36 @@
 
 #define T_HANDLE T_POINTER
 
+/*[python input]
+class OVERLAPPED_converter(CConverter):
+    type = 'OVERLAPPED *'
+    format_unit = '"F_POINTER"'
+
+class HANDLE_converter(CConverter):
+    type = 'HANDLE'
+    format_unit = '"F_HANDLE"'
+
+class ULONG_PTR_converter(CConverter):
+    type = 'ULONG_PTR'
+    format_unit = '"F_ULONG_PTR"'
+
+class DWORD_converter(CConverter):
+    type = 'DWORD'
+    format_unit = 'k'
+
+class BOOL_converter(CConverter):
+    type = 'BOOL'
+    format_unit = 'i'
+[python start generated code]*/
+/*[python end generated code: output=da39a3ee5e6b4b0d input=83bb8c2c2514f2a8]*/
+
+/*[clinic input]
+module _overlapped
+class _overlapped.Overlapped "OverlappedObject *" "&OverlappedType"
+[clinic start generated code]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=92e5a799db35b96c]*/
+
+
 enum {TYPE_NONE, TYPE_NOT_STARTED, TYPE_READ, TYPE_READINTO, TYPE_WRITE,
       TYPE_ACCEPT, TYPE_CONNECT, TYPE_DISCONNECT, TYPE_CONNECT_NAMED_PIPE,
       TYPE_WAIT_NAMED_PIPE_AND_CONNECT, TYPE_TRANSMIT_FILE, TYPE_READ_FROM,
@@ -70,6 +100,19 @@
     };
 } OverlappedObject;
 
+typedef struct {
+    PyTypeObject *overlapped_type;
+} OverlappedState;
+
+static inline OverlappedState*
+overlapped_get_state(PyObject *module)
+{
+    void *state = PyModule_GetState(module);
+    assert(state != NULL);
+    return (OverlappedState *)state;
+}
+
+
 /*
  * Map Windows error codes to subclasses of OSError
  */
@@ -150,25 +193,27 @@
  * Completion port stuff
  */
 
-PyDoc_STRVAR(
-    CreateIoCompletionPort_doc,
-    "CreateIoCompletionPort(handle, port, key, concurrency) -> port\n\n"
-    "Create a completion port or register a handle with a port.");
+/*[clinic input]
+_overlapped.CreateIoCompletionPort
+
+    handle as FileHandle: HANDLE
+    port as ExistingCompletionPort: HANDLE
+    key as CompletionKey: ULONG_PTR
+    concurrency as NumberOfConcurrentThreads: DWORD
+    /
+
+Create a completion port or register a handle with a port.
+[clinic start generated code]*/
 
 static PyObject *
-overlapped_CreateIoCompletionPort(PyObject *self, PyObject *args)
+_overlapped_CreateIoCompletionPort_impl(PyObject *module, HANDLE FileHandle,
+                                        HANDLE ExistingCompletionPort,
+                                        ULONG_PTR CompletionKey,
+                                        DWORD NumberOfConcurrentThreads)
+/*[clinic end generated code: output=24ede2b0f05e5433 input=847bae4d0efe1976]*/
 {
-    HANDLE FileHandle;
-    HANDLE ExistingCompletionPort;
-    ULONG_PTR CompletionKey;
-    DWORD NumberOfConcurrentThreads;
     HANDLE ret;
 
-    if (!PyArg_ParseTuple(args, F_HANDLE F_HANDLE F_ULONG_PTR F_DWORD,
-                          &FileHandle, &ExistingCompletionPort, &CompletionKey,
-                          &NumberOfConcurrentThreads))
-        return NULL;
-
     Py_BEGIN_ALLOW_THREADS
     ret = CreateIoCompletionPort(FileHandle, ExistingCompletionPort,
                                  CompletionKey, NumberOfConcurrentThreads);
@@ -179,26 +224,30 @@
     return Py_BuildValue(F_HANDLE, ret);
 }
 
-PyDoc_STRVAR(
-    GetQueuedCompletionStatus_doc,
-    "GetQueuedCompletionStatus(port, msecs) -> (err, bytes, key, address)\n\n"
-    "Get a message from completion port.  Wait for up to msecs milliseconds.");
+/*[clinic input]
+_overlapped.GetQueuedCompletionStatus
+
+    port as CompletionPort: HANDLE
+    msecs as Milliseconds: DWORD
+    /
+
+Get a message from completion port.
+
+Wait for up to msecs milliseconds.
+[clinic start generated code]*/
 
 static PyObject *
-overlapped_GetQueuedCompletionStatus(PyObject *self, PyObject *args)
+_overlapped_GetQueuedCompletionStatus_impl(PyObject *module,
+                                           HANDLE CompletionPort,
+                                           DWORD Milliseconds)
+/*[clinic end generated code: output=68314171628dddb7 input=94a042d14c4f6410]*/
 {
-    HANDLE CompletionPort = NULL;
     DWORD NumberOfBytes = 0;
     ULONG_PTR CompletionKey = 0;
     OVERLAPPED *Overlapped = NULL;
-    DWORD Milliseconds;
     DWORD err;
     BOOL ret;
 
-    if (!PyArg_ParseTuple(args, F_HANDLE F_DWORD,
-                          &CompletionPort, &Milliseconds))
-        return NULL;
-
     Py_BEGIN_ALLOW_THREADS
     ret = GetQueuedCompletionStatus(CompletionPort, &NumberOfBytes,
                                     &CompletionKey, &Overlapped, Milliseconds);
@@ -215,25 +264,28 @@
                          err, NumberOfBytes, CompletionKey, Overlapped);
 }
 
-PyDoc_STRVAR(
-    PostQueuedCompletionStatus_doc,
-    "PostQueuedCompletionStatus(port, bytes, key, address) -> None\n\n"
-    "Post a message to completion port.");
+/*[clinic input]
+_overlapped.PostQueuedCompletionStatus
+
+    port as CompletionPort: HANDLE
+    bytes as NumberOfBytes: DWORD
+    key as CompletionKey: ULONG_PTR
+    address as Overlapped: OVERLAPPED
+    /
+
+Post a message to completion port.
+[clinic start generated code]*/
 
 static PyObject *
-overlapped_PostQueuedCompletionStatus(PyObject *self, PyObject *args)
+_overlapped_PostQueuedCompletionStatus_impl(PyObject *module,
+                                            HANDLE CompletionPort,
+                                            DWORD NumberOfBytes,
+                                            ULONG_PTR CompletionKey,
+                                            OVERLAPPED *Overlapped)
+/*[clinic end generated code: output=93e73f2933a43e9e input=e936202d87937aca]*/
 {
-    HANDLE CompletionPort;
-    DWORD NumberOfBytes;
-    ULONG_PTR CompletionKey;
-    OVERLAPPED *Overlapped;
     BOOL ret;
 
-    if (!PyArg_ParseTuple(args, F_HANDLE F_DWORD F_ULONG_PTR F_POINTER,
-                          &CompletionPort, &NumberOfBytes, &CompletionKey,
-                          &Overlapped))
-        return NULL;
-
     Py_BEGIN_ALLOW_THREADS
     ret = PostQueuedCompletionStatus(CompletionPort, NumberOfBytes,
                                      CompletionKey, Overlapped);
@@ -264,26 +316,27 @@
     PyMem_RawFree(p);
 }
 
-PyDoc_STRVAR(
-    RegisterWaitWithQueue_doc,
-    "RegisterWaitWithQueue(Object, CompletionPort, Overlapped, Timeout)\n"
-    "    -> WaitHandle\n\n"
-    "Register wait for Object; when complete CompletionPort is notified.\n");
+/*[clinic input]
+_overlapped.RegisterWaitWithQueue
+
+    Object: HANDLE
+    CompletionPort: HANDLE
+    Overlapped: OVERLAPPED
+    Timeout as Milliseconds: DWORD
+    /
+
+Register wait for Object; when complete CompletionPort is notified.
+[clinic start generated code]*/
 
 static PyObject *
-overlapped_RegisterWaitWithQueue(PyObject *self, PyObject *args)
+_overlapped_RegisterWaitWithQueue_impl(PyObject *module, HANDLE Object,
+                                       HANDLE CompletionPort,
+                                       OVERLAPPED *Overlapped,
+                                       DWORD Milliseconds)
+/*[clinic end generated code: output=c2ace732e447fe45 input=2dd4efee44abe8ee]*/
 {
     HANDLE NewWaitObject;
-    HANDLE Object;
-    ULONG Milliseconds;
-    struct PostCallbackData data, *pdata;
-
-    if (!PyArg_ParseTuple(args, F_HANDLE F_HANDLE F_POINTER F_DWORD,
-                          &Object,
-                          &data.CompletionPort,
-                          &data.Overlapped,
-                          &Milliseconds))
-        return NULL;
+    struct PostCallbackData data = {CompletionPort, Overlapped}, *pdata;
 
     /* Use PyMem_RawMalloc() rather than PyMem_Malloc(), since
        PostToQueueCallback() will call PyMem_Free() from a new C thread
@@ -305,20 +358,21 @@
     return Py_BuildValue(F_HANDLE, NewWaitObject);
 }
 
-PyDoc_STRVAR(
-    UnregisterWait_doc,
-    "UnregisterWait(WaitHandle) -> None\n\n"
-    "Unregister wait handle.\n");
+/*[clinic input]
+_overlapped.UnregisterWait
+
+    WaitHandle: HANDLE
+    /
+
+Unregister wait handle.
+[clinic start generated code]*/
 
 static PyObject *
-overlapped_UnregisterWait(PyObject *self, PyObject *args)
+_overlapped_UnregisterWait_impl(PyObject *module, HANDLE WaitHandle)
+/*[clinic end generated code: output=ec90cd955a9a617d input=a56709544cb2df0f]*/
 {
-    HANDLE WaitHandle;
     BOOL ret;
 
-    if (!PyArg_ParseTuple(args, F_HANDLE, &WaitHandle))
-        return NULL;
-
     Py_BEGIN_ALLOW_THREADS
     ret = UnregisterWait(WaitHandle);
     Py_END_ALLOW_THREADS
@@ -328,20 +382,23 @@
     Py_RETURN_NONE;
 }
 
-PyDoc_STRVAR(
-    UnregisterWaitEx_doc,
-    "UnregisterWaitEx(WaitHandle, Event) -> None\n\n"
-    "Unregister wait handle.\n");
+/*[clinic input]
+_overlapped.UnregisterWaitEx
+
+    WaitHandle: HANDLE
+    Event: HANDLE
+    /
+
+Unregister wait handle.
+[clinic start generated code]*/
 
 static PyObject *
-overlapped_UnregisterWaitEx(PyObject *self, PyObject *args)
+_overlapped_UnregisterWaitEx_impl(PyObject *module, HANDLE WaitHandle,
+                                  HANDLE Event)
+/*[clinic end generated code: output=2e3d84c1d5f65b92 input=953cddc1de50fab9]*/
 {
-    HANDLE WaitHandle, Event;
     BOOL ret;
 
-    if (!PyArg_ParseTuple(args, F_HANDLE F_HANDLE, &WaitHandle, &Event))
-        return NULL;
-
     Py_BEGIN_ALLOW_THREADS
     ret = UnregisterWaitEx(WaitHandle, Event);
     Py_END_ALLOW_THREADS
@@ -355,26 +412,28 @@
  * Event functions -- currently only used by tests
  */
 
-PyDoc_STRVAR(
-    CreateEvent_doc,
-    "CreateEvent(EventAttributes, ManualReset, InitialState, Name)"
-    " -> Handle\n\n"
-    "Create an event.  EventAttributes must be None.\n");
+/*[clinic input]
+_overlapped.CreateEvent
+
+    EventAttributes: object
+    ManualReset: BOOL
+    InitialState: BOOL
+    Name: Py_UNICODE(accept={str, NoneType})
+    /
+
+Create an event.
+
+EventAttributes must be None.
+[clinic start generated code]*/
 
 static PyObject *
-overlapped_CreateEvent(PyObject *self, PyObject *args)
+_overlapped_CreateEvent_impl(PyObject *module, PyObject *EventAttributes,
+                             BOOL ManualReset, BOOL InitialState,
+                             const Py_UNICODE *Name)
+/*[clinic end generated code: output=8e04f0916c17b13d input=dbc36ae14375ba24]*/
 {
-    PyObject *EventAttributes;
-    BOOL ManualReset;
-    BOOL InitialState;
-    Py_UNICODE *Name;
     HANDLE Event;
 
-    if (!PyArg_ParseTuple(args, "O" F_BOOL F_BOOL "Z",
-                          &EventAttributes, &ManualReset,
-                          &InitialState, &Name))
-        return NULL;
-
     if (EventAttributes != Py_None) {
         PyErr_SetString(PyExc_ValueError, "EventAttributes must be None");
         return NULL;
@@ -389,20 +448,21 @@
     return Py_BuildValue(F_HANDLE, Event);
 }
 
-PyDoc_STRVAR(
-    SetEvent_doc,
-    "SetEvent(Handle) -> None\n\n"
-    "Set event.\n");
+/*[clinic input]
+_overlapped.SetEvent
+
+    Handle: HANDLE
+    /
+
+Set event.
+[clinic start generated code]*/
 
 static PyObject *
-overlapped_SetEvent(PyObject *self, PyObject *args)
+_overlapped_SetEvent_impl(PyObject *module, HANDLE Handle)
+/*[clinic end generated code: output=5b8d974216b0e569 input=d8b0d26eb7391e80]*/
 {
-    HANDLE Handle;
     BOOL ret;
 
-    if (!PyArg_ParseTuple(args, F_HANDLE, &Handle))
-        return NULL;
-
     Py_BEGIN_ALLOW_THREADS
     ret = SetEvent(Handle);
     Py_END_ALLOW_THREADS
@@ -412,20 +472,21 @@
     Py_RETURN_NONE;
 }
 
-PyDoc_STRVAR(
-    ResetEvent_doc,
-    "ResetEvent(Handle) -> None\n\n"
-    "Reset event.\n");
+/*[clinic input]
+_overlapped.ResetEvent
+
+    Handle: HANDLE
+    /
+
+Reset event.
+[clinic start generated code]*/
 
 static PyObject *
-overlapped_ResetEvent(PyObject *self, PyObject *args)
+_overlapped_ResetEvent_impl(PyObject *module, HANDLE Handle)
+/*[clinic end generated code: output=066537a8405cddb2 input=d4e089c9ba84ff2f]*/
 {
-    HANDLE Handle;
     BOOL ret;
 
-    if (!PyArg_ParseTuple(args, F_HANDLE, &Handle))
-        return NULL;
-
     Py_BEGIN_ALLOW_THREADS
     ret = ResetEvent(Handle);
     Py_END_ALLOW_THREADS
@@ -439,36 +500,40 @@
  * Bind socket handle to local port without doing slow getaddrinfo()
  */
 
-PyDoc_STRVAR(
-    BindLocal_doc,
-    "BindLocal(handle, family) -> None\n\n"
-    "Bind a socket handle to an arbitrary local port.\n"
-    "family should AF_INET or AF_INET6.\n");
+/*[clinic input]
+_overlapped.BindLocal
+
+    handle as Socket: HANDLE
+    family as Family: int
+    /
+
+Bind a socket handle to an arbitrary local port.
+
+family should be AF_INET or AF_INET6.
+[clinic start generated code]*/
 
 static PyObject *
-overlapped_BindLocal(PyObject *self, PyObject *args)
+_overlapped_BindLocal_impl(PyObject *module, HANDLE Socket, int Family)
+/*[clinic end generated code: output=edb93862697aed9c input=a0e7b5c2f541170c]*/
 {
-    SOCKET Socket;
-    int Family;
     BOOL ret;
 
-    if (!PyArg_ParseTuple(args, F_HANDLE "i", &Socket, &Family))
-        return NULL;
-
     if (Family == AF_INET) {
         struct sockaddr_in addr;
         memset(&addr, 0, sizeof(addr));
         addr.sin_family = AF_INET;
         addr.sin_port = 0;
         addr.sin_addr.S_un.S_addr = INADDR_ANY;
-        ret = bind(Socket, (SOCKADDR*)&addr, sizeof(addr)) != SOCKET_ERROR;
+        ret = bind((SOCKET)Socket, (SOCKADDR*)&addr, sizeof(addr))
+                != SOCKET_ERROR;
     } else if (Family == AF_INET6) {
         struct sockaddr_in6 addr;
         memset(&addr, 0, sizeof(addr));
         addr.sin6_family = AF_INET6;
         addr.sin6_port = 0;
         addr.sin6_addr = in6addr_any;
-        ret = bind(Socket, (SOCKADDR*)&addr, sizeof(addr)) != SOCKET_ERROR;
+        ret = bind((SOCKET)Socket, (SOCKADDR*)&addr, sizeof(addr))
+                != SOCKET_ERROR;
     } else {
         PyErr_SetString(PyExc_ValueError, "expected tuple of length 2 or 4");
         return NULL;
@@ -483,21 +548,23 @@
  * Windows equivalent of os.strerror() -- compare _ctypes/callproc.c
  */
 
-PyDoc_STRVAR(
-    FormatMessage_doc,
-    "FormatMessage(error_code) -> error_message\n\n"
-    "Return error message for an error code.");
+/*[clinic input]
+_overlapped.FormatMessage
+
+    error_code as code: DWORD
+    /
+
+Return error message for an error code.
+[clinic start generated code]*/
 
 static PyObject *
-overlapped_FormatMessage(PyObject *ignore, PyObject *args)
+_overlapped_FormatMessage_impl(PyObject *module, DWORD code)
+/*[clinic end generated code: output=02c964ff22407c6b input=644bb5b80326179e]*/
 {
-    DWORD code, n;
+    DWORD n;
     WCHAR *lpMsgBuf;
     PyObject *res;
 
-    if (!PyArg_ParseTuple(args, F_DWORD, &code))
-        return NULL;
-
     n = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER |
                        FORMAT_MESSAGE_FROM_SYSTEM |
                        FORMAT_MESSAGE_IGNORE_INSERTS,
@@ -537,19 +604,20 @@
  * for overlapped I/O
  */
 
-PyDoc_STRVAR(
-    Overlapped_doc,
-    "Overlapped object");
+/*[clinic input]
+@classmethod
+_overlapped.Overlapped.__new__
+
+    event: HANDLE(c_default='INVALID_HANDLE_VALUE') = _overlapped.INVALID_HANDLE_VALUE
+
+OVERLAPPED structure wrapper.
+[clinic start generated code]*/
 
 static PyObject *
-Overlapped_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+_overlapped_Overlapped_impl(PyTypeObject *type, HANDLE event)
+/*[clinic end generated code: output=6da60504a18eb421 input=26b8a7429e629e95]*/
 {
     OverlappedObject *self;
-    HANDLE event = INVALID_HANDLE_VALUE;
-    static char *kwlist[] = {"event", NULL};
-
-    if (!PyArg_ParseTupleAndKeywords(args, kwds, "|" F_HANDLE, kwlist, &event))
-        return NULL;
 
     if (event == INVALID_HANDLE_VALUE) {
         event = CreateEvent(NULL, TRUE, FALSE, NULL);
@@ -651,8 +719,11 @@
     }
 
     Overlapped_clear(self);
-    PyObject_Del(self);
     SetLastError(olderr);
+
+    PyTypeObject *tp = Py_TYPE(self);
+    PyObject_Free(self);
+    Py_DECREF(tp);
 }
 
 
@@ -719,13 +790,15 @@
     }
 }
 
-PyDoc_STRVAR(
-    Overlapped_cancel_doc,
-    "cancel() -> None\n\n"
-    "Cancel overlapped operation");
+/*[clinic input]
+_overlapped.Overlapped.cancel
+
+Cancel overlapped operation.
+[clinic start generated code]*/
 
 static PyObject *
-Overlapped_cancel(OverlappedObject *self, PyObject *Py_UNUSED(ignored))
+_overlapped_Overlapped_cancel_impl(OverlappedObject *self)
+/*[clinic end generated code: output=54ad7aeece89901c input=80eb67c7b57dbcf1]*/
 {
     BOOL ret = TRUE;
 
@@ -748,25 +821,27 @@
     Py_RETURN_NONE;
 }
 
-PyDoc_STRVAR(
-    Overlapped_getresult_doc,
-    "getresult(wait=False) -> result\n\n"
-    "Retrieve result of operation.  If wait is true then it blocks\n"
-    "until the operation is finished.  If wait is false and the\n"
-    "operation is still pending then an error is raised.");
+/*[clinic input]
+_overlapped.Overlapped.getresult
+
+    wait: BOOL(c_default='FALSE') = False
+    /
+
+Retrieve result of operation.
+
+If wait is true then it blocks until the operation is finished.  If wait
+is false and the operation is still pending then an error is raised.
+[clinic start generated code]*/
 
 static PyObject *
-Overlapped_getresult(OverlappedObject *self, PyObject *args)
+_overlapped_Overlapped_getresult_impl(OverlappedObject *self, BOOL wait)
+/*[clinic end generated code: output=8c9bd04d08994f6c input=aa5b03e9897ca074]*/
 {
-    BOOL wait = FALSE;
     DWORD transferred = 0;
     BOOL ret;
     DWORD err;
     PyObject *addr;
 
-    if (!PyArg_ParseTuple(args, "|" F_BOOL, &wait))
-        return NULL;
-
     if (self->type == TYPE_NONE) {
         PyErr_SetString(PyExc_ValueError, "operation not yet attempted");
         return NULL;
@@ -878,21 +953,23 @@
     }
 }
 
-PyDoc_STRVAR(
-    Overlapped_ReadFile_doc,
-    "ReadFile(handle, size) -> Overlapped[message]\n\n"
-    "Start overlapped read");
+/*[clinic input]
+_overlapped.Overlapped.ReadFile
+
+    handle: HANDLE
+    size: DWORD
+    /
+
+Start overlapped read.
+[clinic start generated code]*/
 
 static PyObject *
-Overlapped_ReadFile(OverlappedObject *self, PyObject *args)
+_overlapped_Overlapped_ReadFile_impl(OverlappedObject *self, HANDLE handle,
+                                     DWORD size)
+/*[clinic end generated code: output=4c8557e16941e4ae input=98c495baa0342425]*/
 {
-    HANDLE handle;
-    DWORD size;
     PyObject *buf;
 
-    if (!PyArg_ParseTuple(args, F_HANDLE F_DWORD, &handle, &size))
-        return NULL;
-
     if (self->type != TYPE_NONE) {
         PyErr_SetString(PyExc_ValueError, "operation already attempted");
         return NULL;
@@ -912,20 +989,21 @@
     return do_ReadFile(self, handle, PyBytes_AS_STRING(buf), size);
 }
 
-PyDoc_STRVAR(
-    Overlapped_ReadFileInto_doc,
-    "ReadFileInto(handle, buf) -> Overlapped[bytes_transferred]\n\n"
-    "Start overlapped receive");
+/*[clinic input]
+_overlapped.Overlapped.ReadFileInto
+
+    handle: HANDLE
+    buf as bufobj: object
+    /
+
+Start overlapped receive.
+[clinic start generated code]*/
 
 static PyObject *
-Overlapped_ReadFileInto(OverlappedObject *self, PyObject *args)
+_overlapped_Overlapped_ReadFileInto_impl(OverlappedObject *self,
+                                         HANDLE handle, PyObject *bufobj)
+/*[clinic end generated code: output=1e9e712e742e5b2a input=16f6cc268d1d0387]*/
 {
-    HANDLE handle;
-    PyObject *bufobj;
-
-    if (!PyArg_ParseTuple(args, F_HANDLE "O", &handle, &bufobj))
-        return NULL;
-
     if (self->type != TYPE_NONE) {
         PyErr_SetString(PyExc_ValueError, "operation already attempted");
         return NULL;
@@ -981,23 +1059,24 @@
     }
 }
 
-PyDoc_STRVAR(
-    Overlapped_WSARecv_doc,
-    "RecvFile(handle, size, flags) -> Overlapped[message]\n\n"
-    "Start overlapped receive");
+/*[clinic input]
+_overlapped.Overlapped.WSARecv
+
+    handle: HANDLE
+    size: DWORD
+    flags: DWORD = 0
+    /
+
+Start overlapped receive.
+[clinic start generated code]*/
 
 static PyObject *
-Overlapped_WSARecv(OverlappedObject *self, PyObject *args)
+_overlapped_Overlapped_WSARecv_impl(OverlappedObject *self, HANDLE handle,
+                                    DWORD size, DWORD flags)
+/*[clinic end generated code: output=3a5e9c61ff040906 input=8c04e506cc3d741a]*/
 {
-    HANDLE handle;
-    DWORD size;
-    DWORD flags = 0;
     PyObject *buf;
 
-    if (!PyArg_ParseTuple(args, F_HANDLE F_DWORD "|" F_DWORD,
-                          &handle, &size, &flags))
-        return NULL;
-
     if (self->type != TYPE_NONE) {
         PyErr_SetString(PyExc_ValueError, "operation already attempted");
         return NULL;
@@ -1017,22 +1096,23 @@
     return do_WSARecv(self, handle, PyBytes_AS_STRING(buf), size, flags);
 }
 
-PyDoc_STRVAR(
-    Overlapped_WSARecvInto_doc,
-    "WSARecvInto(handle, buf, flags) -> Overlapped[bytes_transferred]\n\n"
-    "Start overlapped receive");
+/*[clinic input]
+_overlapped.Overlapped.WSARecvInto
+
+    handle: HANDLE
+    buf as bufobj: object
+    flags: DWORD
+    /
+
+Start overlapped receive.
+[clinic start generated code]*/
 
 static PyObject *
-Overlapped_WSARecvInto(OverlappedObject *self, PyObject *args)
+_overlapped_Overlapped_WSARecvInto_impl(OverlappedObject *self,
+                                        HANDLE handle, PyObject *bufobj,
+                                        DWORD flags)
+/*[clinic end generated code: output=9a438abc436fe87c input=4f87c38fc381d525]*/
 {
-    HANDLE handle;
-    PyObject *bufobj;
-    DWORD flags;
-
-    if (!PyArg_ParseTuple(args, F_HANDLE "O" F_DWORD,
-                          &handle, &bufobj, &flags))
-        return NULL;
-
     if (self->type != TYPE_NONE) {
         PyErr_SetString(PyExc_ValueError, "operation already attempted");
         return NULL;
@@ -1056,23 +1136,25 @@
                       (DWORD)self->user_buffer.len, flags);
 }
 
-PyDoc_STRVAR(
-    Overlapped_WriteFile_doc,
-    "WriteFile(handle, buf) -> Overlapped[bytes_transferred]\n\n"
-    "Start overlapped write");
+/*[clinic input]
+_overlapped.Overlapped.WriteFile
+
+    handle: HANDLE
+    buf as bufobj: object
+    /
+
+Start overlapped write.
+[clinic start generated code]*/
 
 static PyObject *
-Overlapped_WriteFile(OverlappedObject *self, PyObject *args)
+_overlapped_Overlapped_WriteFile_impl(OverlappedObject *self, HANDLE handle,
+                                      PyObject *bufobj)
+/*[clinic end generated code: output=c376230b6120d877 input=b8d9a7608d8a1e72]*/
 {
-    HANDLE handle;
-    PyObject *bufobj;
     DWORD written;
     BOOL ret;
     DWORD err;
 
-    if (!PyArg_ParseTuple(args, F_HANDLE "O", &handle, &bufobj))
-        return NULL;
-
     if (self->type != TYPE_NONE) {
         PyErr_SetString(PyExc_ValueError, "operation already attempted");
         return NULL;
@@ -1109,26 +1191,27 @@
     }
 }
 
-PyDoc_STRVAR(
-    Overlapped_WSASend_doc,
-    "WSASend(handle, buf, flags) -> Overlapped[bytes_transferred]\n\n"
-    "Start overlapped send");
+/*[clinic input]
+_overlapped.Overlapped.WSASend
+
+    handle: HANDLE
+    buf as bufobj: object
+    flags: DWORD
+    /
+
+Start overlapped send.
+[clinic start generated code]*/
 
 static PyObject *
-Overlapped_WSASend(OverlappedObject *self, PyObject *args)
+_overlapped_Overlapped_WSASend_impl(OverlappedObject *self, HANDLE handle,
+                                    PyObject *bufobj, DWORD flags)
+/*[clinic end generated code: output=316031c7467040cc input=932e7cba6d18f708]*/
 {
-    HANDLE handle;
-    PyObject *bufobj;
-    DWORD flags;
     DWORD written;
     WSABUF wsabuf;
     int ret;
     DWORD err;
 
-    if (!PyArg_ParseTuple(args, F_HANDLE "O" F_DWORD,
-                          &handle, &bufobj, &flags))
-        return NULL;
-
     if (self->type != TYPE_NONE) {
         PyErr_SetString(PyExc_ValueError, "operation already attempted");
         return NULL;
@@ -1166,26 +1249,28 @@
     }
 }
 
-PyDoc_STRVAR(
-    Overlapped_AcceptEx_doc,
-    "AcceptEx(listen_handle, accept_handle) -> Overlapped[address_as_bytes]\n\n"
-    "Start overlapped wait for client to connect");
+/*[clinic input]
+_overlapped.Overlapped.AcceptEx
+
+    listen_handle as ListenSocket: HANDLE
+    accept_handle as AcceptSocket: HANDLE
+    /
+
+Start overlapped wait for client to connect.
+[clinic start generated code]*/
 
 static PyObject *
-Overlapped_AcceptEx(OverlappedObject *self, PyObject *args)
+_overlapped_Overlapped_AcceptEx_impl(OverlappedObject *self,
+                                     HANDLE ListenSocket,
+                                     HANDLE AcceptSocket)
+/*[clinic end generated code: output=9a7381d4232af889 input=b83473224fc3a1c5]*/
 {
-    SOCKET ListenSocket;
-    SOCKET AcceptSocket;
     DWORD BytesReceived;
     DWORD size;
     PyObject *buf;
     BOOL ret;
     DWORD err;
 
-    if (!PyArg_ParseTuple(args, F_HANDLE F_HANDLE,
-                          &ListenSocket, &AcceptSocket))
-        return NULL;
-
     if (self->type != TYPE_NONE) {
         PyErr_SetString(PyExc_ValueError, "operation already attempted");
         return NULL;
@@ -1197,12 +1282,13 @@
         return NULL;
 
     self->type = TYPE_ACCEPT;
-    self->handle = (HANDLE)ListenSocket;
+    self->handle = ListenSocket;
     self->allocated_buffer = buf;
 
     Py_BEGIN_ALLOW_THREADS
-    ret = Py_AcceptEx(ListenSocket, AcceptSocket, PyBytes_AS_STRING(buf),
-                      0, size, size, &BytesReceived, &self->overlapped);
+    ret = Py_AcceptEx((SOCKET)ListenSocket, (SOCKET)AcceptSocket,
+                      PyBytes_AS_STRING(buf), 0, size, size, &BytesReceived,
+                      &self->overlapped);
     Py_END_ALLOW_THREADS
 
     self->error = err = ret ? ERROR_SUCCESS : WSAGetLastError();
@@ -1220,6 +1306,7 @@
 static int
 parse_address(PyObject *obj, SOCKADDR *Address, int Length)
 {
+    PyObject *Host_obj;
     Py_UNICODE *Host;
     unsigned short Port;
     unsigned long FlowInfo;
@@ -1227,57 +1314,92 @@
 
     memset(Address, 0, Length);
 
-    if (PyArg_ParseTuple(obj, "uH", &Host, &Port))
-    {
+    switch (PyTuple_GET_SIZE(obj)) {
+    case 2: {
+        if (!PyArg_ParseTuple(obj, "UH", &Host_obj, &Port)) {
+            return -1;
+        }
+#if USE_UNICODE_WCHAR_CACHE
+        Host = (wchar_t *)_PyUnicode_AsUnicode(Host_obj);
+#else /* USE_UNICODE_WCHAR_CACHE */
+        Host = PyUnicode_AsWideCharString(Host_obj, NULL);
+#endif /* USE_UNICODE_WCHAR_CACHE */
+        if (Host == NULL) {
+            return -1;
+        }
         Address->sa_family = AF_INET;
         if (WSAStringToAddressW(Host, AF_INET, NULL, Address, &Length) < 0) {
             SetFromWindowsErr(WSAGetLastError());
-            return -1;
+            Length = -1;
         }
-        ((SOCKADDR_IN*)Address)->sin_port = htons(Port);
+        else {
+            ((SOCKADDR_IN*)Address)->sin_port = htons(Port);
+        }
+#if !USE_UNICODE_WCHAR_CACHE
+        PyMem_Free(Host);
+#endif /* USE_UNICODE_WCHAR_CACHE */
         return Length;
     }
-    else if (PyArg_ParseTuple(obj,
-                              "uHkk;ConnectEx(): illegal address_as_bytes "
-                              "argument", &Host, &Port, &FlowInfo, &ScopeId))
-    {
-        PyErr_Clear();
+    case 4: {
+        if (!PyArg_ParseTuple(obj,
+                "UHkk;ConnectEx(): illegal address_as_bytes argument",
+                &Host_obj, &Port, &FlowInfo, &ScopeId))
+        {
+            return -1;
+        }
+#if USE_UNICODE_WCHAR_CACHE
+        Host = (wchar_t *)_PyUnicode_AsUnicode(Host_obj);
+#else /* USE_UNICODE_WCHAR_CACHE */
+        Host = PyUnicode_AsWideCharString(Host_obj, NULL);
+#endif /* USE_UNICODE_WCHAR_CACHE */
+        if (Host == NULL) {
+            return -1;
+        }
         Address->sa_family = AF_INET6;
         if (WSAStringToAddressW(Host, AF_INET6, NULL, Address, &Length) < 0) {
             SetFromWindowsErr(WSAGetLastError());
-            return -1;
+            Length = -1;
         }
-        ((SOCKADDR_IN6*)Address)->sin6_port = htons(Port);
-        ((SOCKADDR_IN6*)Address)->sin6_flowinfo = FlowInfo;
-        ((SOCKADDR_IN6*)Address)->sin6_scope_id = ScopeId;
+        else {
+            ((SOCKADDR_IN6*)Address)->sin6_port = htons(Port);
+            ((SOCKADDR_IN6*)Address)->sin6_flowinfo = FlowInfo;
+            ((SOCKADDR_IN6*)Address)->sin6_scope_id = ScopeId;
+        }
+#if !USE_UNICODE_WCHAR_CACHE
+        PyMem_Free(Host);
+#endif /* USE_UNICODE_WCHAR_CACHE */
         return Length;
     }
-
-    return -1;
+    default:
+        PyErr_SetString(PyExc_ValueError, "illegal address_as_bytes argument");
+        return -1;
+    }
 }
 
-PyDoc_STRVAR(
-    Overlapped_ConnectEx_doc,
-    "ConnectEx(client_handle, address_as_bytes) -> Overlapped[None]\n\n"
-    "Start overlapped connect.  client_handle should be unbound.");
+/*[clinic input]
+_overlapped.Overlapped.ConnectEx
+
+    client_handle as ConnectSocket: HANDLE
+    address_as_bytes as AddressObj: object(subclass_of='&PyTuple_Type')
+    /
+
+Start overlapped connect.
+
+client_handle should be unbound.
+[clinic start generated code]*/
 
 static PyObject *
-Overlapped_ConnectEx(OverlappedObject *self, PyObject *args)
+_overlapped_Overlapped_ConnectEx_impl(OverlappedObject *self,
+                                      HANDLE ConnectSocket,
+                                      PyObject *AddressObj)
+/*[clinic end generated code: output=5aebbbdb4f022833 input=d6bbd2d84b156fc1]*/
 {
-    SOCKET ConnectSocket;
-    PyObject *AddressObj;
     char AddressBuf[sizeof(struct sockaddr_in6)];
     SOCKADDR *Address = (SOCKADDR*)AddressBuf;
     int Length;
     BOOL ret;
     DWORD err;
 
-    if (!PyArg_ParseTuple(args, F_HANDLE "O!:ConnectEx",
-                          &ConnectSocket, &PyTuple_Type, &AddressObj))
-    {
-        return NULL;
-    }
-
     if (self->type != TYPE_NONE) {
         PyErr_SetString(PyExc_ValueError, "operation already attempted");
         return NULL;
@@ -1289,10 +1411,10 @@
         return NULL;
 
     self->type = TYPE_CONNECT;
-    self->handle = (HANDLE)ConnectSocket;
+    self->handle = ConnectSocket;
 
     Py_BEGIN_ALLOW_THREADS
-    ret = Py_ConnectEx(ConnectSocket, Address, Length,
+    ret = Py_ConnectEx((SOCKET)ConnectSocket, Address, Length,
                        NULL, 0, NULL, &self->overlapped);
     Py_END_ALLOW_THREADS
 
@@ -1307,32 +1429,33 @@
     }
 }
 
-PyDoc_STRVAR(
-    Overlapped_DisconnectEx_doc,
-    "DisconnectEx(handle, flags) -> Overlapped[None]\n\n"
-    "Start overlapped connect.  client_handle should be unbound.");
+/*[clinic input]
+_overlapped.Overlapped.DisconnectEx
+
+    handle as Socket: HANDLE
+    flags: DWORD
+    /
+
+[clinic start generated code]*/
 
 static PyObject *
-Overlapped_DisconnectEx(OverlappedObject *self, PyObject *args)
+_overlapped_Overlapped_DisconnectEx_impl(OverlappedObject *self,
+                                         HANDLE Socket, DWORD flags)
+/*[clinic end generated code: output=8d64ddb8c93c2126 input=680845cdcdf820eb]*/
 {
-    SOCKET Socket;
-    DWORD flags;
     BOOL ret;
     DWORD err;
 
-    if (!PyArg_ParseTuple(args, F_HANDLE F_DWORD, &Socket, &flags))
-        return NULL;
-
     if (self->type != TYPE_NONE) {
         PyErr_SetString(PyExc_ValueError, "operation already attempted");
         return NULL;
     }
 
     self->type = TYPE_DISCONNECT;
-    self->handle = (HANDLE)Socket;
+    self->handle = Socket;
 
     Py_BEGIN_ALLOW_THREADS
-    ret = Py_DisconnectEx(Socket, &self->overlapped, flags, 0);
+    ret = Py_DisconnectEx((SOCKET)Socket, &self->overlapped, flags, 0);
     Py_END_ALLOW_THREADS
 
     self->error = err = ret ? ERROR_SUCCESS : WSAGetLastError();
@@ -1346,48 +1469,45 @@
     }
 }
 
-PyDoc_STRVAR(
-    Overlapped_TransmitFile_doc,
-    "TransmitFile(socket, file, offset, offset_high, "
-    "count_to_write, count_per_send, flags) "
-    "-> Overlapped[None]\n\n"
-    "Transmit file data over a connected socket.");
+/*[clinic input]
+_overlapped.Overlapped.TransmitFile
+
+    socket as Socket: HANDLE
+    file as File: HANDLE
+    offset: DWORD
+    offset_high: DWORD
+    count_to_write: DWORD
+    count_per_send: DWORD
+    flags: DWORD
+    /
+
+Transmit file data over a connected socket.
+[clinic start generated code]*/
 
 static PyObject *
-Overlapped_TransmitFile(OverlappedObject *self, PyObject *args)
+_overlapped_Overlapped_TransmitFile_impl(OverlappedObject *self,
+                                         HANDLE Socket, HANDLE File,
+                                         DWORD offset, DWORD offset_high,
+                                         DWORD count_to_write,
+                                         DWORD count_per_send, DWORD flags)
+/*[clinic end generated code: output=03f3ca5512e678fd input=7e6f97b391f60e8c]*/
 {
-    SOCKET Socket;
-    HANDLE File;
-    DWORD offset;
-    DWORD offset_high;
-    DWORD count_to_write;
-    DWORD count_per_send;
-    DWORD flags;
     BOOL ret;
     DWORD err;
 
-    if (!PyArg_ParseTuple(args,
-                          F_HANDLE F_HANDLE F_DWORD F_DWORD
-                          F_DWORD F_DWORD F_DWORD,
-                          &Socket, &File, &offset, &offset_high,
-                          &count_to_write, &count_per_send,
-                          &flags))
-        return NULL;
-
     if (self->type != TYPE_NONE) {
         PyErr_SetString(PyExc_ValueError, "operation already attempted");
         return NULL;
     }
 
     self->type = TYPE_TRANSMIT_FILE;
-    self->handle = (HANDLE)Socket;
+    self->handle = Socket;
     self->overlapped.Offset = offset;
     self->overlapped.OffsetHigh = offset_high;
 
     Py_BEGIN_ALLOW_THREADS
-    ret = Py_TransmitFile(Socket, File, count_to_write, count_per_send,
-                          &self->overlapped,
-                          NULL, flags);
+    ret = Py_TransmitFile((SOCKET)Socket, File, count_to_write,
+                          count_per_send, &self->overlapped, NULL, flags);
     Py_END_ALLOW_THREADS
 
     self->error = err = ret ? ERROR_SUCCESS : WSAGetLastError();
@@ -1401,21 +1521,23 @@
     }
 }
 
-PyDoc_STRVAR(
-    Overlapped_ConnectNamedPipe_doc,
-    "ConnectNamedPipe(handle) -> Overlapped[None]\n\n"
-    "Start overlapped wait for a client to connect.");
+/*[clinic input]
+_overlapped.Overlapped.ConnectNamedPipe
+
+    handle as Pipe: HANDLE
+    /
+
+Start overlapped wait for a client to connect.
+[clinic start generated code]*/
 
 static PyObject *
-Overlapped_ConnectNamedPipe(OverlappedObject *self, PyObject *args)
+_overlapped_Overlapped_ConnectNamedPipe_impl(OverlappedObject *self,
+                                             HANDLE Pipe)
+/*[clinic end generated code: output=3e69adfe55818abe input=8b0d4cef8a72f7bc]*/
 {
-    HANDLE Pipe;
     BOOL ret;
     DWORD err;
 
-    if (!PyArg_ParseTuple(args, F_HANDLE, &Pipe))
-        return NULL;
-
     if (self->type != TYPE_NONE) {
         PyErr_SetString(PyExc_ValueError, "operation already attempted");
         return NULL;
@@ -1442,25 +1564,22 @@
     }
 }
 
-PyDoc_STRVAR(
-    ConnectPipe_doc,
-    "ConnectPipe(addr) -> pipe_handle\n\n"
-    "Connect to the pipe for asynchronous I/O (overlapped).");
+/*[clinic input]
+_overlapped.Overlapped.ConnectPipe
+
+    addr as Address: Py_UNICODE
+    /
+
+Connect to the pipe for asynchronous I/O (overlapped).
+[clinic start generated code]*/
 
 static PyObject *
-overlapped_ConnectPipe(PyObject *self, PyObject *args)
+_overlapped_Overlapped_ConnectPipe_impl(OverlappedObject *self,
+                                        const Py_UNICODE *Address)
+/*[clinic end generated code: output=3cc9661667d459d4 input=167c06a274efcefc]*/
 {
-    PyObject *AddressObj;
-    wchar_t *Address;
     HANDLE PipeHandle;
 
-    if (!PyArg_ParseTuple(args, "U",  &AddressObj))
-        return NULL;
-
-    Address = PyUnicode_AsWideCharString(AddressObj, NULL);
-    if (Address == NULL)
-        return NULL;
-
     Py_BEGIN_ALLOW_THREADS
     PipeHandle = CreateFileW(Address,
                              GENERIC_READ | GENERIC_WRITE,
@@ -1468,7 +1587,6 @@
                              FILE_FLAG_OVERLAPPED, NULL);
     Py_END_ALLOW_THREADS
 
-    PyMem_Free(Address);
     if (PipeHandle == INVALID_HANDLE_VALUE)
         return SetFromWindowsErr(0);
     return Py_BuildValue(F_HANDLE, PipeHandle);
@@ -1503,41 +1621,39 @@
         }
         break;
     case TYPE_READ_FROM:
-        if(self->read_from.result) {
-            Py_VISIT(self->read_from.result);
-        }
-        if(self->read_from.allocated_buffer) {
-            Py_VISIT(self->read_from.allocated_buffer);
-        }
+        Py_VISIT(self->read_from.result);
+        Py_VISIT(self->read_from.allocated_buffer);
     }
     return 0;
 }
 
 // UDP functions
 
-PyDoc_STRVAR(
-    WSAConnect_doc,
-    "WSAConnect(client_handle, address_as_bytes) -> Overlapped[None]\n\n"
-    "Bind a remote address to a connectionless (UDP) socket");
-
 /*
  * Note: WSAConnect does not support Overlapped I/O so this function should
  * _only_ be used for connectionless sockets (UDP).
  */
+
+/*[clinic input]
+_overlapped.WSAConnect
+
+    client_handle as ConnectSocket: HANDLE
+    address_as_bytes as AddressObj: object
+    /
+
+Bind a remote address to a connectionless (UDP) socket.
+[clinic start generated code]*/
+
 static PyObject *
-overlapped_WSAConnect(PyObject *self, PyObject *args)
+_overlapped_WSAConnect_impl(PyObject *module, HANDLE ConnectSocket,
+                            PyObject *AddressObj)
+/*[clinic end generated code: output=ea0b4391e94dad63 input=169f8075e9ae7fa4]*/
 {
-    SOCKET ConnectSocket;
-    PyObject *AddressObj;
     char AddressBuf[sizeof(struct sockaddr_in6)];
     SOCKADDR *Address = (SOCKADDR*)AddressBuf;
     int Length;
     int err;
 
-    if (!PyArg_ParseTuple(args, F_HANDLE "O", &ConnectSocket, &AddressObj)) {
-        return NULL;
-    }
-
     Length = sizeof(AddressBuf);
     Length = parse_address(AddressObj, Address, Length);
     if (Length < 0) {
@@ -1547,7 +1663,7 @@
     Py_BEGIN_ALLOW_THREADS
     // WSAConnect does not support overlapped I/O so this call will
     // successfully complete immediately.
-    err = WSAConnect(ConnectSocket, Address, Length,
+    err = WSAConnect((SOCKET)ConnectSocket, Address, Length,
                         NULL, NULL, NULL, NULL);
     Py_END_ALLOW_THREADS
 
@@ -1559,19 +1675,24 @@
     }
 }
 
-PyDoc_STRVAR(
-    Overlapped_WSASendTo_doc,
-    "WSASendTo(handle, buf, flags, address_as_bytes) -> "
-    "Overlapped[bytes_transferred]\n\n"
-    "Start overlapped sendto over a connectionless (UDP) socket");
+/*[clinic input]
+_overlapped.Overlapped.WSASendTo
+
+    handle: HANDLE
+    buf as bufobj: object
+    flags: DWORD
+    address_as_bytes as AddressObj: object
+    /
+
+Start overlapped sendto over a connectionless (UDP) socket.
+[clinic start generated code]*/
 
 static PyObject *
-Overlapped_WSASendTo(OverlappedObject *self, PyObject *args)
+_overlapped_Overlapped_WSASendTo_impl(OverlappedObject *self, HANDLE handle,
+                                      PyObject *bufobj, DWORD flags,
+                                      PyObject *AddressObj)
+/*[clinic end generated code: output=fe0ff55eb60d65e1 input=f709e6ecebd9bc18]*/
 {
-    HANDLE handle;
-    PyObject *bufobj;
-    DWORD flags;
-    PyObject *AddressObj;
     char AddressBuf[sizeof(struct sockaddr_in6)];
     SOCKADDR *Address = (SOCKADDR*)AddressBuf;
     int AddressLength;
@@ -1580,12 +1701,6 @@
     int ret;
     DWORD err;
 
-    if (!PyArg_ParseTuple(args, F_HANDLE "O" F_DWORD "O",
-                          &handle, &bufobj, &flags, &AddressObj))
-    {
-        return NULL;
-    }
-
     // Parse the "to" address
     AddressLength = sizeof(AddressBuf);
     AddressLength = parse_address(AddressObj, Address, AddressLength);
@@ -1640,24 +1755,29 @@
     "RecvFile(handle, size, flags) -> Overlapped[(message, (host, port))]\n\n"
     "Start overlapped receive");
 
+/*[clinic input]
+_overlapped.Overlapped.WSARecvFrom
+
+    handle: HANDLE
+    size: DWORD
+    flags: DWORD = 0
+    /
+
+Start overlapped receive.
+[clinic start generated code]*/
+
 static PyObject *
-Overlapped_WSARecvFrom(OverlappedObject *self, PyObject *args)
+_overlapped_Overlapped_WSARecvFrom_impl(OverlappedObject *self,
+                                        HANDLE handle, DWORD size,
+                                        DWORD flags)
+/*[clinic end generated code: output=13832a2025b86860 input=1b2663fa130e0286]*/
 {
-    HANDLE handle;
-    DWORD size;
-    DWORD flags = 0;
     DWORD nread;
     PyObject *buf;
     WSABUF wsabuf;
     int ret;
     DWORD err;
 
-    if (!PyArg_ParseTuple(args, F_HANDLE F_DWORD "|" F_DWORD,
-                          &handle, &size, &flags))
-    {
-        return NULL;
-    }
-
     if (self->type != TYPE_NONE) {
         PyErr_SetString(PyExc_ValueError, "operation already attempted");
         return NULL;
@@ -1703,38 +1823,24 @@
     }
 }
 
+#include "clinic/overlapped.c.h"
 
 static PyMethodDef Overlapped_methods[] = {
-    {"getresult", (PyCFunction) Overlapped_getresult,
-     METH_VARARGS, Overlapped_getresult_doc},
-    {"cancel", (PyCFunction) Overlapped_cancel,
-     METH_NOARGS, Overlapped_cancel_doc},
-    {"ReadFile", (PyCFunction) Overlapped_ReadFile,
-     METH_VARARGS, Overlapped_ReadFile_doc},
-    {"ReadFileInto", (PyCFunction) Overlapped_ReadFileInto,
-     METH_VARARGS, Overlapped_ReadFileInto_doc},
-    {"WSARecv", (PyCFunction) Overlapped_WSARecv,
-     METH_VARARGS, Overlapped_WSARecv_doc},
-    {"WSARecvInto", (PyCFunction) Overlapped_WSARecvInto,
-     METH_VARARGS, Overlapped_WSARecvInto_doc},
-    {"WriteFile", (PyCFunction) Overlapped_WriteFile,
-     METH_VARARGS, Overlapped_WriteFile_doc},
-    {"WSASend", (PyCFunction) Overlapped_WSASend,
-     METH_VARARGS, Overlapped_WSASend_doc},
-    {"AcceptEx", (PyCFunction) Overlapped_AcceptEx,
-     METH_VARARGS, Overlapped_AcceptEx_doc},
-    {"ConnectEx", (PyCFunction) Overlapped_ConnectEx,
-     METH_VARARGS, Overlapped_ConnectEx_doc},
-    {"DisconnectEx", (PyCFunction) Overlapped_DisconnectEx,
-     METH_VARARGS, Overlapped_DisconnectEx_doc},
-    {"TransmitFile", (PyCFunction) Overlapped_TransmitFile,
-     METH_VARARGS, Overlapped_TransmitFile_doc},
-    {"ConnectNamedPipe", (PyCFunction) Overlapped_ConnectNamedPipe,
-     METH_VARARGS, Overlapped_ConnectNamedPipe_doc},
-    {"WSARecvFrom", (PyCFunction) Overlapped_WSARecvFrom,
-     METH_VARARGS, Overlapped_WSARecvFrom_doc },
-    {"WSASendTo", (PyCFunction) Overlapped_WSASendTo,
-     METH_VARARGS, Overlapped_WSASendTo_doc },
+    _OVERLAPPED_OVERLAPPED_GETRESULT_METHODDEF
+    _OVERLAPPED_OVERLAPPED_CANCEL_METHODDEF
+    _OVERLAPPED_OVERLAPPED_READFILE_METHODDEF
+    _OVERLAPPED_OVERLAPPED_READFILEINTO_METHODDEF
+    _OVERLAPPED_OVERLAPPED_WSARECV_METHODDEF
+    _OVERLAPPED_OVERLAPPED_WSARECVINTO_METHODDEF
+    _OVERLAPPED_OVERLAPPED_WRITEFILE_METHODDEF
+    _OVERLAPPED_OVERLAPPED_WSASEND_METHODDEF
+    _OVERLAPPED_OVERLAPPED_ACCEPTEX_METHODDEF
+    _OVERLAPPED_OVERLAPPED_CONNECTEX_METHODDEF
+    _OVERLAPPED_OVERLAPPED_DISCONNECTEX_METHODDEF
+    _OVERLAPPED_OVERLAPPED_TRANSMITFILE_METHODDEF
+    _OVERLAPPED_OVERLAPPED_CONNECTNAMEDPIPE_METHODDEF
+    _OVERLAPPED_OVERLAPPED_WSARECVFROM_METHODDEF
+    _OVERLAPPED_OVERLAPPED_WSASENDTO_METHODDEF
     {NULL}
 };
 
@@ -1756,112 +1862,100 @@
     {NULL},
 };
 
-PyTypeObject OverlappedType = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    /* tp_name           */ "_overlapped.Overlapped",
-    /* tp_basicsize      */ sizeof(OverlappedObject),
-    /* tp_itemsize       */ 0,
-    /* tp_dealloc        */ (destructor) Overlapped_dealloc,
-    /* tp_vectorcall_offset */ 0,
-    /* tp_getattr        */ 0,
-    /* tp_setattr        */ 0,
-    /* tp_as_async       */ 0,
-    /* tp_repr           */ 0,
-    /* tp_as_number      */ 0,
-    /* tp_as_sequence    */ 0,
-    /* tp_as_mapping     */ 0,
-    /* tp_hash           */ 0,
-    /* tp_call           */ 0,
-    /* tp_str            */ 0,
-    /* tp_getattro       */ 0,
-    /* tp_setattro       */ 0,
-    /* tp_as_buffer      */ 0,
-    /* tp_flags          */ Py_TPFLAGS_DEFAULT,
-    /* tp_doc            */ "OVERLAPPED structure wrapper",
-    /* tp_traverse       */ (traverseproc)Overlapped_traverse,
-    /* tp_clear          */ 0,
-    /* tp_richcompare    */ 0,
-    /* tp_weaklistoffset */ 0,
-    /* tp_iter           */ 0,
-    /* tp_iternext       */ 0,
-    /* tp_methods        */ Overlapped_methods,
-    /* tp_members        */ Overlapped_members,
-    /* tp_getset         */ Overlapped_getsets,
-    /* tp_base           */ 0,
-    /* tp_dict           */ 0,
-    /* tp_descr_get      */ 0,
-    /* tp_descr_set      */ 0,
-    /* tp_dictoffset     */ 0,
-    /* tp_init           */ 0,
-    /* tp_alloc          */ 0,
-    /* tp_new            */ Overlapped_new,
+static PyType_Slot overlapped_type_slots[] = {
+    {Py_tp_dealloc, Overlapped_dealloc},
+    {Py_tp_doc, (char *)_overlapped_Overlapped__doc__},
+    {Py_tp_traverse, Overlapped_traverse},
+    {Py_tp_methods, Overlapped_methods},
+    {Py_tp_members, Overlapped_members},
+    {Py_tp_getset, Overlapped_getsets},
+    {Py_tp_new, _overlapped_Overlapped},
+    {0,0}
+};
+
+static PyType_Spec overlapped_type_spec = {
+    .name = "_overlapped.Overlapped",
+    .basicsize = sizeof(OverlappedObject),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = overlapped_type_slots
 };
 
 static PyMethodDef overlapped_functions[] = {
-    {"CreateIoCompletionPort", overlapped_CreateIoCompletionPort,
-     METH_VARARGS, CreateIoCompletionPort_doc},
-    {"GetQueuedCompletionStatus", overlapped_GetQueuedCompletionStatus,
-     METH_VARARGS, GetQueuedCompletionStatus_doc},
-    {"PostQueuedCompletionStatus", overlapped_PostQueuedCompletionStatus,
-     METH_VARARGS, PostQueuedCompletionStatus_doc},
-    {"FormatMessage", overlapped_FormatMessage,
-     METH_VARARGS, FormatMessage_doc},
-    {"BindLocal", overlapped_BindLocal,
-     METH_VARARGS, BindLocal_doc},
-    {"RegisterWaitWithQueue", overlapped_RegisterWaitWithQueue,
-     METH_VARARGS, RegisterWaitWithQueue_doc},
-    {"UnregisterWait", overlapped_UnregisterWait,
-     METH_VARARGS, UnregisterWait_doc},
-    {"UnregisterWaitEx", overlapped_UnregisterWaitEx,
-     METH_VARARGS, UnregisterWaitEx_doc},
-    {"CreateEvent", overlapped_CreateEvent,
-     METH_VARARGS, CreateEvent_doc},
-    {"SetEvent", overlapped_SetEvent,
-     METH_VARARGS, SetEvent_doc},
-    {"ResetEvent", overlapped_ResetEvent,
-     METH_VARARGS, ResetEvent_doc},
-    {"ConnectPipe", overlapped_ConnectPipe,
-     METH_VARARGS, ConnectPipe_doc},
-    {"WSAConnect", overlapped_WSAConnect,
-     METH_VARARGS, WSAConnect_doc},
+    _OVERLAPPED_CREATEIOCOMPLETIONPORT_METHODDEF
+    _OVERLAPPED_GETQUEUEDCOMPLETIONSTATUS_METHODDEF
+    _OVERLAPPED_POSTQUEUEDCOMPLETIONSTATUS_METHODDEF
+    _OVERLAPPED_FORMATMESSAGE_METHODDEF
+    _OVERLAPPED_BINDLOCAL_METHODDEF
+    _OVERLAPPED_REGISTERWAITWITHQUEUE_METHODDEF
+    _OVERLAPPED_UNREGISTERWAIT_METHODDEF
+    _OVERLAPPED_UNREGISTERWAITEX_METHODDEF
+    _OVERLAPPED_CREATEEVENT_METHODDEF
+    _OVERLAPPED_SETEVENT_METHODDEF
+    _OVERLAPPED_RESETEVENT_METHODDEF
+    _OVERLAPPED_OVERLAPPED_CONNECTPIPE_METHODDEF
+    _OVERLAPPED_WSACONNECT_METHODDEF
     {NULL}
 };
 
-static struct PyModuleDef overlapped_module = {
-    PyModuleDef_HEAD_INIT,
-    "_overlapped",
-    NULL,
-    -1,
-    overlapped_functions,
-    NULL,
-    NULL,
-    NULL,
-    NULL
-};
+static int
+overlapped_traverse(PyObject *module, visitproc visit, void *arg)
+{
+    OverlappedState *state = overlapped_get_state(module);
+    Py_VISIT(state->overlapped_type);
+    return 0;
+}
+
+static int
+overlapped_clear(PyObject *module)
+{
+    OverlappedState *state = overlapped_get_state(module);
+    Py_CLEAR(state->overlapped_type);
+    return 0;
+}
+
+static void
+overlapped_free(void *module)
+{
+    overlapped_clear((PyObject *)module);
+}
 
 #define WINAPI_CONSTANT(fmt, con) \
-    PyDict_SetItemString(d, #con, Py_BuildValue(fmt, con))
+    do { \
+        PyObject *value = Py_BuildValue(fmt, con); \
+        if (value == NULL) { \
+            return -1; \
+        } \
+        if (PyModule_AddObject(module, #con, value) < 0 ) { \
+            Py_DECREF(value); \
+            return -1; \
+        } \
+    } while (0)
 
-PyMODINIT_FUNC
-PyInit__overlapped(void)
+static int
+overlapped_exec(PyObject *module)
 {
-    PyObject *m, *d;
-
     /* Ensure WSAStartup() called before initializing function pointers */
-    m = PyImport_ImportModule("_socket");
-    if (!m)
-        return NULL;
-    Py_DECREF(m);
-
-    if (initialize_function_pointers() < 0)
-        return NULL;
-
-    m = PyModule_Create(&overlapped_module);
-    if (PyModule_AddType(m, &OverlappedType) < 0) {
-        return NULL;
+    PyObject *socket_module = PyImport_ImportModule("_socket");
+    if (!socket_module) {
+        return -1;
     }
 
-    d = PyModule_GetDict(m);
+    Py_DECREF(socket_module);
+
+    if (initialize_function_pointers() < 0) {
+        return -1;
+    }
+
+    OverlappedState *st = overlapped_get_state(module);
+    st->overlapped_type = (PyTypeObject *)PyType_FromModuleAndSpec(
+        module, &overlapped_type_spec, NULL);
+    if (st->overlapped_type == NULL) {
+        return -1;
+    }
+
+    if (PyModule_AddType(module, st->overlapped_type) < 0) {
+        return -1;
+    }
 
     WINAPI_CONSTANT(F_DWORD,  ERROR_IO_PENDING);
     WINAPI_CONSTANT(F_DWORD,  ERROR_NETNAME_DELETED);
@@ -1875,5 +1969,27 @@
     WINAPI_CONSTANT(F_DWORD,  SO_UPDATE_CONNECT_CONTEXT);
     WINAPI_CONSTANT(F_DWORD,  TF_REUSE_SOCKET);
 
-    return m;
+    return 0;
+}
+
+static PyModuleDef_Slot overlapped_slots[] = {
+    {Py_mod_exec, overlapped_exec},
+    {0, NULL}
+};
+
+static struct PyModuleDef overlapped_module = {
+    PyModuleDef_HEAD_INIT,
+    .m_name = "_overlapped",
+    .m_size = sizeof(OverlappedState),
+    .m_methods = overlapped_functions,
+    .m_slots = overlapped_slots,
+    .m_traverse = overlapped_traverse,
+    .m_clear = overlapped_clear,
+    .m_free = overlapped_free
+};
+
+PyMODINIT_FUNC
+PyInit__overlapped(void)
+{
+    return PyModuleDef_Init(&overlapped_module);
 }
diff --git a/Modules/parsermodule.c b/Modules/parsermodule.c
deleted file mode 100644
index 24b0ffb..0000000
--- a/Modules/parsermodule.c
+++ /dev/null
@@ -1,1222 +0,0 @@
-/*  parsermodule.c
- *
- *  Copyright 1995-1996 by Fred L. Drake, Jr. and Virginia Polytechnic
- *  Institute and State University, Blacksburg, Virginia, USA.
- *  Portions copyright 1991-1995 by Stichting Mathematisch Centrum,
- *  Amsterdam, The Netherlands.  Copying is permitted under the terms
- *  associated with the main Python distribution, with the additional
- *  restriction that this additional notice be included and maintained
- *  on all distributed copies.
- *
- *  This module serves to replace the original parser module written
- *  by Guido.  The functionality is not matched precisely, but the
- *  original may be implemented on top of this.  This is desirable
- *  since the source of the text to be parsed is now divorced from
- *  this interface.
- *
- *  Unlike the prior interface, the ability to give a parse tree
- *  produced by Python code as a tuple to the compiler is enabled by
- *  this module.  See the documentation for more details.
- *
- *  I've added some annotations that help with the lint code-checking
- *  program, but they're not complete by a long shot.  The real errors
- *  that lint detects are gone, but there are still warnings with
- *  Py_[X]DECREF() and Py_[X]INCREF() macros.  The lint annotations
- *  look like "NOTE(...)".
- *
- */
-
-#include "Python.h"                     /* general Python API             */
-#include "Python-ast.h"                 /* mod_ty */
-#undef Yield   /* undefine macro conflicting with <winbase.h> */
-#include "ast.h"
-#include "graminit.h"                   /* symbols defined in the grammar */
-#include "node.h"                       /* internal parser structure      */
-#include "errcode.h"                    /* error codes for PyNode_*()     */
-#include "token.h"                      /* token definitions              */
-                                        /* ISTERMINAL() / ISNONTERMINAL() */
-#include "grammar.h"
-#include "parsetok.h"
-
-extern grammar _PyParser_Grammar; /* From graminit.c */
-
-#ifdef lint
-#include <note.h>
-#else
-#define NOTE(x)
-#endif
-
-/*  String constants used to initialize module attributes.
- *
- */
-static const char parser_copyright_string[] =
-"Copyright 1995-1996 by Virginia Polytechnic Institute & State\n\
-University, Blacksburg, Virginia, USA, and Fred L. Drake, Jr., Reston,\n\
-Virginia, USA.  Portions copyright 1991-1995 by Stichting Mathematisch\n\
-Centrum, Amsterdam, The Netherlands.";
-
-
-PyDoc_STRVAR(parser_doc_string,
-"This is an interface to Python's internal parser.");
-
-static const char parser_version_string[] = "0.5";
-
-
-typedef PyObject* (*SeqMaker) (Py_ssize_t length);
-typedef int (*SeqInserter) (PyObject* sequence,
-                            Py_ssize_t index,
-                            PyObject* element);
-
-/*  The function below is copyrighted by Stichting Mathematisch Centrum.  The
- *  original copyright statement is included below, and continues to apply
- *  in full to the function immediately following.  All other material is
- *  original, copyrighted by Fred L. Drake, Jr. and Virginia Polytechnic
- *  Institute and State University.  Changes were made to comply with the
- *  new naming conventions.  Added arguments to provide support for creating
- *  lists as well as tuples, and optionally including the line numbers.
- */
-
-
-static PyObject*
-node2tuple(node *n,                     /* node to convert               */
-           SeqMaker mkseq,              /* create sequence               */
-           SeqInserter addelem,         /* func. to add elem. in seq.    */
-           int lineno,                  /* include line numbers?         */
-           int col_offset)              /* include column offsets?       */
-{
-    PyObject *result = NULL, *w;
-
-    if (n == NULL) {
-        Py_RETURN_NONE;
-    }
-
-    if (ISNONTERMINAL(TYPE(n))) {
-        int i;
-
-        result = mkseq(1 + NCH(n) + (TYPE(n) == encoding_decl));
-        if (result == NULL)
-            goto error;
-
-        w = PyLong_FromLong(TYPE(n));
-        if (w == NULL)
-            goto error;
-        (void) addelem(result, 0, w);
-
-        for (i = 0; i < NCH(n); i++) {
-            w = node2tuple(CHILD(n, i), mkseq, addelem, lineno, col_offset);
-            if (w == NULL)
-                goto error;
-            (void) addelem(result, i+1, w);
-        }
-
-        if (TYPE(n) == encoding_decl) {
-            w = PyUnicode_FromString(STR(n));
-            if (w == NULL)
-                goto error;
-            (void) addelem(result, i+1, w);
-        }
-    }
-    else if (ISTERMINAL(TYPE(n))) {
-        result = mkseq(2 + lineno + col_offset);
-        if (result == NULL)
-            goto error;
-
-        w = PyLong_FromLong(TYPE(n));
-        if (w == NULL)
-            goto error;
-        (void) addelem(result, 0, w);
-
-        w = PyUnicode_FromString(STR(n));
-        if (w == NULL)
-            goto error;
-        (void) addelem(result, 1, w);
-
-        if (lineno) {
-            w = PyLong_FromLong(n->n_lineno);
-            if (w == NULL)
-                goto error;
-            (void) addelem(result, 2, w);
-        }
-
-        if (col_offset) {
-            w = PyLong_FromLong(n->n_col_offset);
-            if (w == NULL)
-                goto error;
-            (void) addelem(result, 2 + lineno, w);
-        }
-    }
-    else {
-        PyErr_SetString(PyExc_SystemError,
-                        "unrecognized parse tree node type");
-        return ((PyObject*) NULL);
-    }
-    return result;
-
-error:
-    Py_XDECREF(result);
-    return NULL;
-}
-/*
- *  End of material copyrighted by Stichting Mathematisch Centrum.
- */
-
-
-
-/*  There are two types of intermediate objects we're interested in:
- *  'eval' and 'exec' types.  These constants can be used in the st_type
- *  field of the object type to identify which any given object represents.
- *  These should probably go in an external header to allow other extensions
- *  to use them, but then, we really should be using C++ too.  ;-)
- */
-
-#define PyST_EXPR  1
-#define PyST_SUITE 2
-
-
-/*  These are the internal objects and definitions required to implement the
- *  ST type.  Most of the internal names are more reminiscent of the 'old'
- *  naming style, but the code uses the new naming convention.
- */
-
-static PyObject*
-parser_error = 0;
-
-
-typedef struct {
-    PyObject_HEAD                       /* standard object header           */
-    node* st_node;                      /* the node* returned by the parser */
-    int   st_type;                      /* EXPR or SUITE ?                  */
-    PyCompilerFlags st_flags;           /* Parser and compiler flags        */
-} PyST_Object;
-
-
-static void parser_free(PyST_Object *st);
-static PyObject* parser_sizeof(PyST_Object *, void *);
-static PyObject* parser_richcompare(PyObject *left, PyObject *right, int op);
-static PyObject* parser_compilest(PyST_Object *, PyObject *, PyObject *);
-static PyObject* parser_isexpr(PyST_Object *, PyObject *, PyObject *);
-static PyObject* parser_issuite(PyST_Object *, PyObject *, PyObject *);
-static PyObject* parser_st2list(PyST_Object *, PyObject *, PyObject *);
-static PyObject* parser_st2tuple(PyST_Object *, PyObject *, PyObject *);
-
-#define PUBLIC_METHOD_TYPE (METH_VARARGS|METH_KEYWORDS)
-
-static PyMethodDef parser_methods[] = {
-    {"compile",         (PyCFunction)(void(*)(void))parser_compilest,  PUBLIC_METHOD_TYPE,
-        PyDoc_STR("Compile this ST object into a code object.")},
-    {"isexpr",          (PyCFunction)(void(*)(void))parser_isexpr,     PUBLIC_METHOD_TYPE,
-        PyDoc_STR("Determines if this ST object was created from an expression.")},
-    {"issuite",         (PyCFunction)(void(*)(void))parser_issuite,    PUBLIC_METHOD_TYPE,
-        PyDoc_STR("Determines if this ST object was created from a suite.")},
-    {"tolist",          (PyCFunction)(void(*)(void))parser_st2list,    PUBLIC_METHOD_TYPE,
-        PyDoc_STR("Creates a list-tree representation of this ST.")},
-    {"totuple",         (PyCFunction)(void(*)(void))parser_st2tuple,   PUBLIC_METHOD_TYPE,
-        PyDoc_STR("Creates a tuple-tree representation of this ST.")},
-    {"__sizeof__",      (PyCFunction)parser_sizeof,     METH_NOARGS,
-        PyDoc_STR("Returns size in memory, in bytes.")},
-    {NULL, NULL, 0, NULL}
-};
-
-static
-PyTypeObject PyST_Type = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "parser.st",                        /* tp_name              */
-    (int) sizeof(PyST_Object),          /* tp_basicsize         */
-    0,                                  /* tp_itemsize          */
-    (destructor)parser_free,            /* tp_dealloc           */
-    0,                                  /* tp_vectorcall_offset */
-    0,                                  /* tp_getattr           */
-    0,                                  /* tp_setattr           */
-    0,                                  /* tp_as_async          */
-    0,                                  /* tp_repr              */
-    0,                                  /* tp_as_number         */
-    0,                                  /* tp_as_sequence       */
-    0,                                  /* tp_as_mapping        */
-    0,                                  /* tp_hash              */
-    0,                                  /* tp_call              */
-    0,                                  /* tp_str               */
-    0,                                  /* tp_getattro          */
-    0,                                  /* tp_setattro          */
-
-    /* Functions to access object as input/output buffer */
-    0,                                  /* tp_as_buffer         */
-
-    Py_TPFLAGS_DEFAULT,                 /* tp_flags             */
-
-    /* __doc__ */
-    "Intermediate representation of a Python parse tree.",
-    0,                                  /* tp_traverse */
-    0,                                  /* tp_clear */
-    parser_richcompare,                 /* tp_richcompare */
-    0,                                  /* tp_weaklistoffset */
-    0,                                  /* tp_iter */
-    0,                                  /* tp_iternext */
-    parser_methods,                     /* tp_methods */
-};  /* PyST_Type */
-
-
-/* PyST_Type isn't subclassable, so just check ob_type */
-#define PyST_Object_Check(v) Py_IS_TYPE(v, &PyST_Type)
-
-static int
-parser_compare_nodes(node *left, node *right)
-{
-    int j;
-
-    if (TYPE(left) < TYPE(right))
-        return (-1);
-
-    if (TYPE(right) < TYPE(left))
-        return (1);
-
-    if (ISTERMINAL(TYPE(left)))
-        return (strcmp(STR(left), STR(right)));
-
-    if (NCH(left) < NCH(right))
-        return (-1);
-
-    if (NCH(right) < NCH(left))
-        return (1);
-
-    for (j = 0; j < NCH(left); ++j) {
-        int v = parser_compare_nodes(CHILD(left, j), CHILD(right, j));
-
-        if (v != 0)
-            return (v);
-    }
-    return (0);
-}
-
-/*  parser_richcompare(PyObject* left, PyObject* right, int op)
- *
- *  Comparison function used by the Python operators ==, !=, <, >, <=, >=
- *  This really just wraps a call to parser_compare_nodes() with some easy
- *  checks and protection code.
- *
- */
-
-static PyObject *
-parser_richcompare(PyObject *left, PyObject *right, int op)
-{
-    int result;
-
-    /* neither argument should be NULL, unless something's gone wrong */
-    if (left == NULL || right == NULL) {
-        PyErr_BadInternalCall();
-        return NULL;
-    }
-
-    /* both arguments should be instances of PyST_Object */
-    if (!PyST_Object_Check(left) || !PyST_Object_Check(right)) {
-        Py_RETURN_NOTIMPLEMENTED;
-    }
-
-    if (left == right)
-        /* if arguments are identical, they're equal */
-        result = 0;
-    else
-        result = parser_compare_nodes(((PyST_Object *)left)->st_node,
-                                      ((PyST_Object *)right)->st_node);
-
-    Py_RETURN_RICHCOMPARE(result, 0, op);
-}
-
-/*  parser_newstobject(node* st)
- *
- *  Allocates a new Python object representing an ST.  This is simply the
- *  'wrapper' object that holds a node* and allows it to be passed around in
- *  Python code.
- *
- */
-static PyObject*
-parser_newstobject(node *st, int type)
-{
-    PyST_Object* o = PyObject_New(PyST_Object, &PyST_Type);
-
-    if (o != 0) {
-        o->st_node = st;
-        o->st_type = type;
-        o->st_flags = _PyCompilerFlags_INIT;
-    }
-    else {
-        PyNode_Free(st);
-    }
-    return ((PyObject*)o);
-}
-
-
-/*  void parser_free(PyST_Object* st)
- *
- *  This is called by a del statement that reduces the reference count to 0.
- *
- */
-static void
-parser_free(PyST_Object *st)
-{
-    PyNode_Free(st->st_node);
-    PyObject_Del(st);
-}
-
-static PyObject *
-parser_sizeof(PyST_Object *st, void *unused)
-{
-    Py_ssize_t res;
-
-    res = _PyObject_SIZE(Py_TYPE(st)) + _PyNode_SizeOf(st->st_node);
-    return PyLong_FromSsize_t(res);
-}
-
-
-/*  parser_st2tuple(PyObject* self, PyObject* args, PyObject* kw)
- *
- *  This provides conversion from a node* to a tuple object that can be
- *  returned to the Python-level caller.  The ST object is not modified.
- *
- */
-static PyObject*
-parser_st2tuple(PyST_Object *self, PyObject *args, PyObject *kw)
-{
-    int line_info = 0;
-    int col_info = 0;
-    PyObject *res = 0;
-    int ok;
-
-    static char *keywords[] = {"st", "line_info", "col_info", NULL};
-
-    if (self == NULL || PyModule_Check(self)) {
-        ok = PyArg_ParseTupleAndKeywords(args, kw, "O!|pp:st2tuple", keywords,
-                                         &PyST_Type, &self, &line_info,
-                                         &col_info);
-    }
-    else
-        ok = PyArg_ParseTupleAndKeywords(args, kw, "|pp:totuple", &keywords[1],
-                                         &line_info, &col_info);
-    if (ok != 0) {
-        /*
-         *  Convert ST into a tuple representation.  Use Guido's function,
-         *  since it's known to work already.
-         */
-        res = node2tuple(((PyST_Object*)self)->st_node,
-                         PyTuple_New, PyTuple_SetItem, line_info, col_info);
-    }
-    return (res);
-}
-
-
-/*  parser_st2list(PyObject* self, PyObject* args, PyObject* kw)
- *
- *  This provides conversion from a node* to a list object that can be
- *  returned to the Python-level caller.  The ST object is not modified.
- *
- */
-static PyObject*
-parser_st2list(PyST_Object *self, PyObject *args, PyObject *kw)
-{
-    int line_info = 0;
-    int col_info = 0;
-    PyObject *res = 0;
-    int ok;
-
-    static char *keywords[] = {"st", "line_info", "col_info", NULL};
-
-    if (self == NULL || PyModule_Check(self))
-        ok = PyArg_ParseTupleAndKeywords(args, kw, "O!|pp:st2list", keywords,
-                                         &PyST_Type, &self, &line_info,
-                                         &col_info);
-    else
-        ok = PyArg_ParseTupleAndKeywords(args, kw, "|pp:tolist", &keywords[1],
-                                         &line_info, &col_info);
-    if (ok) {
-        /*
-         *  Convert ST into a tuple representation.  Use Guido's function,
-         *  since it's known to work already.
-         */
-        res = node2tuple(self->st_node,
-                         PyList_New, PyList_SetItem, line_info, col_info);
-    }
-    return (res);
-}
-
-
-/*  parser_compilest(PyObject* self, PyObject* args)
- *
- *  This function creates code objects from the parse tree represented by
- *  the passed-in data object.  An optional file name is passed in as well.
- *
- */
-static PyObject*
-parser_compilest(PyST_Object *self, PyObject *args, PyObject *kw)
-{
-    PyObject*     res = NULL;
-    PyArena*      arena = NULL;
-    mod_ty        mod;
-    PyObject*     filename = NULL;
-    int ok;
-
-    static char *keywords[] = {"st", "filename", NULL};
-
-    if (self == NULL || PyModule_Check(self))
-        ok = PyArg_ParseTupleAndKeywords(args, kw, "O!|O&:compilest", keywords,
-                                         &PyST_Type, &self,
-                                         PyUnicode_FSDecoder, &filename);
-    else
-        ok = PyArg_ParseTupleAndKeywords(args, kw, "|O&:compile", &keywords[1],
-                                         PyUnicode_FSDecoder, &filename);
-    if (!ok)
-        goto error;
-
-    if (filename == NULL) {
-        filename = PyUnicode_FromString("<syntax-tree>");
-        if (filename == NULL)
-            goto error;
-    }
-
-    arena = PyArena_New();
-    if (!arena)
-        goto error;
-
-    mod = PyAST_FromNodeObject(self->st_node, &self->st_flags,
-                               filename, arena);
-    if (!mod)
-        goto error;
-
-    res = (PyObject *)PyAST_CompileObject(mod, filename,
-                                          &self->st_flags, -1, arena);
-error:
-    Py_XDECREF(filename);
-    if (arena != NULL)
-        PyArena_Free(arena);
-    return res;
-}
-
-
-/*  PyObject* parser_isexpr(PyObject* self, PyObject* args)
- *  PyObject* parser_issuite(PyObject* self, PyObject* args)
- *
- *  Checks the passed-in ST object to determine if it is an expression or
- *  a statement suite, respectively.  The return is a Python truth value.
- *
- */
-static PyObject*
-parser_isexpr(PyST_Object *self, PyObject *args, PyObject *kw)
-{
-    PyObject* res = 0;
-    int ok;
-
-    static char *keywords[] = {"st", NULL};
-
-    if (self == NULL || PyModule_Check(self))
-        ok = PyArg_ParseTupleAndKeywords(args, kw, "O!:isexpr", keywords,
-                                         &PyST_Type, &self);
-    else
-        ok = PyArg_ParseTupleAndKeywords(args, kw, ":isexpr", &keywords[1]);
-
-    if (ok) {
-        /* Check to see if the ST represents an expression or not. */
-        res = (self->st_type == PyST_EXPR) ? Py_True : Py_False;
-        Py_INCREF(res);
-    }
-    return (res);
-}
-
-
-static PyObject*
-parser_issuite(PyST_Object *self, PyObject *args, PyObject *kw)
-{
-    PyObject* res = 0;
-    int ok;
-
-    static char *keywords[] = {"st", NULL};
-
-    if (self == NULL || PyModule_Check(self))
-        ok = PyArg_ParseTupleAndKeywords(args, kw, "O!:issuite", keywords,
-                                         &PyST_Type, &self);
-    else
-        ok = PyArg_ParseTupleAndKeywords(args, kw, ":issuite", &keywords[1]);
-
-    if (ok) {
-        /* Check to see if the ST represents an expression or not. */
-        res = (self->st_type == PyST_EXPR) ? Py_False : Py_True;
-        Py_INCREF(res);
-    }
-    return (res);
-}
-
-
-/*  err_string(const char* message)
- *
- *  Sets the error string for an exception of type ParserError.
- *
- */
-static void
-err_string(const char *message)
-{
-    PyErr_SetString(parser_error, message);
-}
-
-
-/*  PyObject* parser_do_parse(PyObject* args, int type)
- *
- *  Internal function to actually execute the parse and return the result if
- *  successful or set an exception if not.
- *
- */
-static PyObject*
-parser_do_parse(PyObject *args, PyObject *kw, const char *argspec, int type)
-{
-    char*     string = 0;
-    PyObject* res    = 0;
-    int flags        = 0;
-    perrdetail err;
-
-    static char *keywords[] = {"source", NULL};
-
-    if (PyArg_ParseTupleAndKeywords(args, kw, argspec, keywords, &string)) {
-        node* n = PyParser_ParseStringFlagsFilenameEx(string, NULL,
-                                                       &_PyParser_Grammar,
-                                                      (type == PyST_EXPR)
-                                                      ? eval_input : file_input,
-                                                      &err, &flags);
-
-        if (n) {
-            res = parser_newstobject(n, type);
-            if (res) {
-                ((PyST_Object *)res)->st_flags.cf_flags = flags & PyCF_MASK;
-                ((PyST_Object *)res)->st_flags.cf_feature_version = PY_MINOR_VERSION;
-            }
-        }
-        else {
-            PyParser_SetError(&err);
-        }
-        PyParser_ClearError(&err);
-    }
-    return (res);
-}
-
-
-/*  PyObject* parser_expr(PyObject* self, PyObject* args)
- *  PyObject* parser_suite(PyObject* self, PyObject* args)
- *
- *  External interfaces to the parser itself.  Which is called determines if
- *  the parser attempts to recognize an expression ('eval' form) or statement
- *  suite ('exec' form).  The real work is done by parser_do_parse() above.
- *
- */
-static PyObject*
-parser_expr(PyST_Object *self, PyObject *args, PyObject *kw)
-{
-    NOTE(ARGUNUSED(self))
-    return (parser_do_parse(args, kw, "s:expr", PyST_EXPR));
-}
-
-
-static PyObject*
-parser_suite(PyST_Object *self, PyObject *args, PyObject *kw)
-{
-    NOTE(ARGUNUSED(self))
-    return (parser_do_parse(args, kw, "s:suite", PyST_SUITE));
-}
-
-
-
-/*  This is the messy part of the code.  Conversion from a tuple to an ST
- *  object requires that the input tuple be valid without having to rely on
- *  catching an exception from the compiler.  This is done to allow the
- *  compiler itself to remain fast, since most of its input will come from
- *  the parser directly, and therefore be known to be syntactically correct.
- *  This validation is done to ensure that we don't core dump the compile
- *  phase, returning an exception instead.
- *
- *  Two aspects can be broken out in this code:  creating a node tree from
- *  the tuple passed in, and verifying that it is indeed valid.  It may be
- *  advantageous to expand the number of ST types to include funcdefs and
- *  lambdadefs to take advantage of the optimizer, recognizing those STs
- *  here.  They are not necessary, and not quite as useful in a raw form.
- *  For now, let's get expressions and suites working reliably.
- */
-
-
-static node* build_node_tree(PyObject *tuple);
-
-static int
-validate_node(node *tree)
-{
-    int type = TYPE(tree);
-    int nch = NCH(tree);
-    state *dfa_state;
-    int pos, arc;
-
-    assert(ISNONTERMINAL(type));
-    type -= NT_OFFSET;
-    if (type >= _PyParser_Grammar.g_ndfas) {
-        PyErr_Format(parser_error, "Unrecognized node type %d.", TYPE(tree));
-        return 0;
-    }
-    const dfa *nt_dfa = &_PyParser_Grammar.g_dfa[type];
-    REQ(tree, nt_dfa->d_type);
-
-    /* Run the DFA for this nonterminal. */
-    dfa_state = nt_dfa->d_state;
-    for (pos = 0; pos < nch; ++pos) {
-        node *ch = CHILD(tree, pos);
-        int ch_type = TYPE(ch);
-        if ((ch_type >= NT_OFFSET + _PyParser_Grammar.g_ndfas)
-            || (ISTERMINAL(ch_type) && (ch_type >= N_TOKENS))
-            || (ch_type < 0)
-           ) {
-            PyErr_Format(parser_error, "Unrecognized node type %d.", ch_type);
-            return 0;
-        }
-        if (ch_type == suite && TYPE(tree) == funcdef) {
-            /* This is the opposite hack of what we do in parser.c
-               (search for func_body_suite), except we don't ever
-               support type comments here. */
-            ch_type = func_body_suite;
-        }
-        for (arc = 0; arc < dfa_state->s_narcs; ++arc) {
-            short a_label = dfa_state->s_arc[arc].a_lbl;
-            assert(a_label < _PyParser_Grammar.g_ll.ll_nlabels);
-
-            const char *label_str = _PyParser_Grammar.g_ll.ll_label[a_label].lb_str;
-            if ((_PyParser_Grammar.g_ll.ll_label[a_label].lb_type == ch_type)
-                && ((ch->n_str == NULL) || (label_str == NULL)
-                     || (strcmp(ch->n_str, label_str) == 0))
-               ) {
-                /* The child is acceptable; if non-terminal, validate it recursively. */
-                if (ISNONTERMINAL(ch_type) && !validate_node(ch))
-                    return 0;
-
-                /* Update the state, and move on to the next child. */
-                dfa_state = &nt_dfa->d_state[dfa_state->s_arc[arc].a_arrow];
-                goto arc_found;
-            }
-        }
-        /* What would this state have accepted? */
-        {
-            short a_label = dfa_state->s_arc->a_lbl;
-            if (!a_label) /* Wouldn't accept any more children */
-                goto illegal_num_children;
-
-            int next_type = _PyParser_Grammar.g_ll.ll_label[a_label].lb_type;
-            const char *expected_str = _PyParser_Grammar.g_ll.ll_label[a_label].lb_str;
-
-            if (ISNONTERMINAL(next_type)) {
-                PyErr_Format(parser_error, "Expected %s, got %s.",
-                             _PyParser_Grammar.g_dfa[next_type - NT_OFFSET].d_name,
-                             ISTERMINAL(ch_type) ? _PyParser_TokenNames[ch_type] :
-                             _PyParser_Grammar.g_dfa[ch_type - NT_OFFSET].d_name);
-            }
-            else if (expected_str != NULL) {
-                PyErr_Format(parser_error, "Illegal terminal: expected '%s'.",
-                             expected_str);
-            }
-            else {
-                PyErr_Format(parser_error, "Illegal terminal: expected %s.",
-                             _PyParser_TokenNames[next_type]);
-            }
-            return 0;
-        }
-
-arc_found:
-        continue;
-    }
-    /* Are we in a final state? If so, return 1 for successful validation. */
-    for (arc = 0; arc < dfa_state->s_narcs; ++arc) {
-        if (!dfa_state->s_arc[arc].a_lbl) {
-            return 1;
-        }
-    }
-
-illegal_num_children:
-    PyErr_Format(parser_error,
-                 "Illegal number of children for %s node.", nt_dfa->d_name);
-    return 0;
-}
-
-/*  PyObject* parser_tuple2st(PyObject* self, PyObject* args)
- *
- *  This is the public function, called from the Python code.  It receives a
- *  single tuple object from the caller, and creates an ST object if the
- *  tuple can be validated.  It does this by checking the first code of the
- *  tuple, and, if acceptable, builds the internal representation.  If this
- *  step succeeds, the internal representation is validated as fully as
- *  possible with the recursive validate_node() routine defined above.
- *
- *  This function must be changed if support is to be added for PyST_FRAGMENT
- *  ST objects.
- *
- */
-static PyObject*
-parser_tuple2st(PyST_Object *self, PyObject *args, PyObject *kw)
-{
-    NOTE(ARGUNUSED(self))
-    PyObject *st = 0;
-    PyObject *tuple;
-    node *tree;
-
-    static char *keywords[] = {"sequence", NULL};
-
-    if (!PyArg_ParseTupleAndKeywords(args, kw, "O:sequence2st", keywords,
-                                     &tuple))
-        return (0);
-    if (!PySequence_Check(tuple)) {
-        PyErr_SetString(PyExc_ValueError,
-                        "sequence2st() requires a single sequence argument");
-        return (0);
-    }
-    /*
-     *  Convert the tree to the internal form before checking it.
-     */
-    tree = build_node_tree(tuple);
-    if (tree != 0) {
-        node *validation_root = NULL;
-        int tree_type = 0;
-        switch (TYPE(tree)) {
-        case eval_input:
-            /*  Might be an eval form.  */
-            tree_type = PyST_EXPR;
-            validation_root = tree;
-            break;
-        case encoding_decl:
-            /* This looks like an encoding_decl so far. */
-            if (NCH(tree) == 1) {
-                tree_type = PyST_SUITE;
-                validation_root = CHILD(tree, 0);
-            }
-            else {
-                err_string("Error Parsing encoding_decl");
-            }
-            break;
-        case file_input:
-            /*  This looks like an exec form so far.  */
-            tree_type = PyST_SUITE;
-            validation_root = tree;
-            break;
-        default:
-            /*  This is a fragment, at best. */
-            err_string("parse tree does not use a valid start symbol");
-        }
-
-        if (validation_root != NULL && validate_node(validation_root))
-            st = parser_newstobject(tree, tree_type);
-        else
-            PyNode_Free(tree);
-    }
-    /*  Make sure we raise an exception on all errors.  We should never
-     *  get this, but we'd do well to be sure something is done.
-     */
-    if (st == NULL && !PyErr_Occurred())
-        err_string("unspecified ST error occurred");
-
-    return st;
-}
-
-
-/*  node* build_node_children()
- *
- *  Iterate across the children of the current non-terminal node and build
- *  their structures.  If successful, return the root of this portion of
- *  the tree, otherwise, 0.  Any required exception will be specified already,
- *  and no memory will have been deallocated.
- *
- */
-static node*
-build_node_children(PyObject *tuple, node *root, int *line_num)
-{
-    Py_ssize_t len = PyObject_Size(tuple);
-    Py_ssize_t i;
-    int  err;
-
-    if (len < 0) {
-        return NULL;
-    }
-    for (i = 1; i < len; ++i) {
-        /* elem must always be a sequence, however simple */
-        PyObject* elem = PySequence_GetItem(tuple, i);
-        int ok = elem != NULL;
-        int type = 0;
-        char *strn = 0;
-
-        if (ok)
-            ok = PySequence_Check(elem);
-        if (ok) {
-            PyObject *temp = PySequence_GetItem(elem, 0);
-            if (temp == NULL)
-                ok = 0;
-            else {
-                ok = PyLong_Check(temp);
-                if (ok) {
-                    type = _PyLong_AsInt(temp);
-                    if (type == -1 && PyErr_Occurred()) {
-                        Py_DECREF(temp);
-                        Py_DECREF(elem);
-                        return NULL;
-                    }
-                }
-                Py_DECREF(temp);
-            }
-        }
-        if (!ok) {
-            PyObject *err = Py_BuildValue("Os", elem,
-                                          "Illegal node construct.");
-            PyErr_SetObject(parser_error, err);
-            Py_XDECREF(err);
-            Py_XDECREF(elem);
-            return NULL;
-        }
-        if (ISTERMINAL(type)) {
-            Py_ssize_t len = PyObject_Size(elem);
-            PyObject *temp;
-            const char *temp_str;
-
-            if ((len != 2) && (len != 3)) {
-                err_string("terminal nodes must have 2 or 3 entries");
-                Py_DECREF(elem);
-                return NULL;
-            }
-            temp = PySequence_GetItem(elem, 1);
-            if (temp == NULL) {
-                Py_DECREF(elem);
-                return NULL;
-            }
-            if (!PyUnicode_Check(temp)) {
-                PyErr_Format(parser_error,
-                             "second item in terminal node must be a string,"
-                             " found %s",
-                             Py_TYPE(temp)->tp_name);
-                Py_DECREF(temp);
-                Py_DECREF(elem);
-                return NULL;
-            }
-            if (len == 3) {
-                PyObject *o = PySequence_GetItem(elem, 2);
-                if (o == NULL) {
-                    Py_DECREF(temp);
-                    Py_DECREF(elem);
-                    return NULL;
-                }
-                if (PyLong_Check(o)) {
-                    int num = _PyLong_AsInt(o);
-                    if (num == -1 && PyErr_Occurred()) {
-                        Py_DECREF(o);
-                        Py_DECREF(temp);
-                        Py_DECREF(elem);
-                        return NULL;
-                    }
-                    *line_num = num;
-                }
-                else {
-                    PyErr_Format(parser_error,
-                                 "third item in terminal node must be an"
-                                 " integer, found %s",
-                                 Py_TYPE(temp)->tp_name);
-                    Py_DECREF(o);
-                    Py_DECREF(temp);
-                    Py_DECREF(elem);
-                    return NULL;
-                }
-                Py_DECREF(o);
-            }
-            temp_str = PyUnicode_AsUTF8AndSize(temp, &len);
-            if (temp_str == NULL) {
-                Py_DECREF(temp);
-                Py_DECREF(elem);
-                return NULL;
-            }
-            strn = (char *)PyObject_MALLOC(len + 1);
-            if (strn == NULL) {
-                Py_DECREF(temp);
-                Py_DECREF(elem);
-                PyErr_NoMemory();
-                return NULL;
-            }
-            (void) memcpy(strn, temp_str, len + 1);
-            Py_DECREF(temp);
-        }
-        else if (!ISNONTERMINAL(type)) {
-            /*
-             *  It has to be one or the other; this is an error.
-             *  Raise an exception.
-             */
-            PyObject *err = Py_BuildValue("Os", elem, "unknown node type.");
-            PyErr_SetObject(parser_error, err);
-            Py_XDECREF(err);
-            Py_DECREF(elem);
-            return NULL;
-        }
-        err = PyNode_AddChild(root, type, strn, *line_num, 0, *line_num, 0);
-        if (err == E_NOMEM) {
-            Py_DECREF(elem);
-            PyObject_FREE(strn);
-            PyErr_NoMemory();
-            return NULL;
-        }
-        if (err == E_OVERFLOW) {
-            Py_DECREF(elem);
-            PyObject_FREE(strn);
-            PyErr_SetString(PyExc_ValueError,
-                            "unsupported number of child nodes");
-            return NULL;
-        }
-
-        if (ISNONTERMINAL(type)) {
-            node* new_child = CHILD(root, i - 1);
-
-            if (new_child != build_node_children(elem, new_child, line_num)) {
-                Py_DECREF(elem);
-                return NULL;
-            }
-        }
-        else if (type == NEWLINE) {     /* It's true:  we increment the     */
-            ++(*line_num);              /* line number *after* the newline! */
-        }
-        Py_DECREF(elem);
-    }
-    return root;
-}
-
-
-static node*
-build_node_tree(PyObject *tuple)
-{
-    node* res = 0;
-    PyObject *temp = PySequence_GetItem(tuple, 0);
-    long num = -1;
-
-    if (temp != NULL)
-        num = PyLong_AsLong(temp);
-    Py_XDECREF(temp);
-    if (ISTERMINAL(num)) {
-        /*
-         *  The tuple is simple, but it doesn't start with a start symbol.
-         *  Raise an exception now and be done with it.
-         */
-        tuple = Py_BuildValue("Os", tuple,
-                    "Illegal syntax-tree; cannot start with terminal symbol.");
-        PyErr_SetObject(parser_error, tuple);
-        Py_XDECREF(tuple);
-    }
-    else if (ISNONTERMINAL(num)) {
-        /*
-         *  Not efficient, but that can be handled later.
-         */
-        int line_num = 0;
-        PyObject *encoding = NULL;
-
-        if (num == encoding_decl) {
-            encoding = PySequence_GetItem(tuple, 2);
-            if (encoding == NULL) {
-                PyErr_SetString(parser_error, "missed encoding");
-                return NULL;
-            }
-            if (!PyUnicode_Check(encoding)) {
-                PyErr_Format(parser_error,
-                             "encoding must be a string, found %.200s",
-                             Py_TYPE(encoding)->tp_name);
-                Py_DECREF(encoding);
-                return NULL;
-            }
-            /* tuple isn't borrowed anymore here, need to DECREF */
-            tuple = PySequence_GetSlice(tuple, 0, 2);
-            if (tuple == NULL) {
-                Py_DECREF(encoding);
-                return NULL;
-            }
-        }
-        res = PyNode_New(num);
-        if (res != NULL) {
-            if (res != build_node_children(tuple, res, &line_num)) {
-                PyNode_Free(res);
-                res = NULL;
-            }
-            if (res && encoding) {
-                Py_ssize_t len;
-                const char *temp;
-                temp = PyUnicode_AsUTF8AndSize(encoding, &len);
-                if (temp == NULL) {
-                    PyNode_Free(res);
-                    Py_DECREF(encoding);
-                    Py_DECREF(tuple);
-                    return NULL;
-                }
-                res->n_str = (char *)PyObject_MALLOC(len + 1);
-                if (res->n_str == NULL) {
-                    PyNode_Free(res);
-                    Py_DECREF(encoding);
-                    Py_DECREF(tuple);
-                    PyErr_NoMemory();
-                    return NULL;
-                }
-                (void) memcpy(res->n_str, temp, len + 1);
-            }
-        }
-        if (encoding != NULL) {
-            Py_DECREF(encoding);
-            Py_DECREF(tuple);
-        }
-    }
-    else {
-        /*  The tuple is illegal -- if the number is neither TERMINAL nor
-         *  NONTERMINAL, we can't use it.  Not sure the implementation
-         *  allows this condition, but the API doesn't preclude it.
-         */
-        PyObject *err = Py_BuildValue("Os", tuple,
-                                      "Illegal component tuple.");
-        PyErr_SetObject(parser_error, err);
-        Py_XDECREF(err);
-    }
-
-    return (res);
-}
-
-
-static PyObject*
-pickle_constructor = NULL;
-
-
-static PyObject*
-parser__pickler(PyObject *self, PyObject *args)
-{
-    NOTE(ARGUNUSED(self))
-    PyObject *result = NULL;
-    PyObject *st = NULL;
-
-    if (PyArg_ParseTuple(args, "O!:_pickler", &PyST_Type, &st)) {
-        PyObject *newargs;
-        PyObject *tuple;
-
-        if ((newargs = PyTuple_Pack(2, st, Py_True)) == NULL)
-            return NULL;
-        tuple = parser_st2tuple((PyST_Object*)NULL, newargs, NULL);
-        if (tuple != NULL) {
-            result = Py_BuildValue("O(O)", pickle_constructor, tuple);
-            Py_DECREF(tuple);
-        }
-        Py_DECREF(newargs);
-    }
-
-    return (result);
-}
-
-
-/*  Functions exported by this module.  Most of this should probably
- *  be converted into an ST object with methods, but that is better
- *  done directly in Python, allowing subclasses to be created directly.
- *  We'd really have to write a wrapper around it all anyway to allow
- *  inheritance.
- */
-static PyMethodDef parser_functions[] =  {
-    {"compilest",      (PyCFunction)(void(*)(void))parser_compilest,  PUBLIC_METHOD_TYPE,
-        PyDoc_STR("Compiles an ST object into a code object.")},
-    {"expr",            (PyCFunction)(void(*)(void))parser_expr,      PUBLIC_METHOD_TYPE,
-        PyDoc_STR("Creates an ST object from an expression.")},
-    {"isexpr",          (PyCFunction)(void(*)(void))parser_isexpr,    PUBLIC_METHOD_TYPE,
-        PyDoc_STR("Determines if an ST object was created from an expression.")},
-    {"issuite",         (PyCFunction)(void(*)(void))parser_issuite,   PUBLIC_METHOD_TYPE,
-        PyDoc_STR("Determines if an ST object was created from a suite.")},
-    {"suite",           (PyCFunction)(void(*)(void))parser_suite,     PUBLIC_METHOD_TYPE,
-        PyDoc_STR("Creates an ST object from a suite.")},
-    {"sequence2st",     (PyCFunction)(void(*)(void))parser_tuple2st,  PUBLIC_METHOD_TYPE,
-        PyDoc_STR("Creates an ST object from a tree representation.")},
-    {"st2tuple",        (PyCFunction)(void(*)(void))parser_st2tuple,  PUBLIC_METHOD_TYPE,
-        PyDoc_STR("Creates a tuple-tree representation of an ST.")},
-    {"st2list",         (PyCFunction)(void(*)(void))parser_st2list,   PUBLIC_METHOD_TYPE,
-        PyDoc_STR("Creates a list-tree representation of an ST.")},
-    {"tuple2st",        (PyCFunction)(void(*)(void))parser_tuple2st,  PUBLIC_METHOD_TYPE,
-        PyDoc_STR("Creates an ST object from a tree representation.")},
-
-    /* private stuff: support pickle module */
-    {"_pickler",        (PyCFunction)parser__pickler,  METH_VARARGS,
-        PyDoc_STR("Returns the pickle magic to allow ST objects to be pickled.")},
-
-    {NULL, NULL, 0, NULL}
-    };
-
-
-
-static struct PyModuleDef parsermodule = {
-        PyModuleDef_HEAD_INIT,
-        "parser",
-        NULL,
-        -1,
-        parser_functions,
-        NULL,
-        NULL,
-        NULL,
-        NULL
-};
-
-PyMODINIT_FUNC PyInit_parser(void);  /* supply a prototype */
-
-PyMODINIT_FUNC
-PyInit_parser(void)
-{
-    PyObject *module, *copyreg;
-
-    if (PyErr_WarnEx(PyExc_DeprecationWarning,
-            "The parser module is deprecated and will be removed "
-            "in future versions of Python", 7) != 0) {
-        return NULL;
-    }
-
-    if (PyType_Ready(&PyST_Type) < 0)
-        return NULL;
-    module = PyModule_Create(&parsermodule);
-    if (module == NULL)
-        return NULL;
-
-    if (parser_error == 0)
-        parser_error = PyErr_NewException("parser.ParserError", NULL, NULL);
-
-    if (parser_error == 0)
-        return NULL;
-    /* CAUTION:  The code next used to skip bumping the refcount on
-     * parser_error.  That's a disaster if PyInit_parser() gets called more
-     * than once.  By incref'ing, we ensure that each module dict that
-     * gets created owns its reference to the shared parser_error object,
-     * and the file static parser_error vrbl owns a reference too.
-     */
-    Py_INCREF(parser_error);
-    if (PyModule_AddObject(module, "ParserError", parser_error) != 0)
-        return NULL;
-
-    Py_INCREF(&PyST_Type);
-    PyModule_AddObject(module, "STType", (PyObject*)&PyST_Type);
-
-    PyModule_AddStringConstant(module, "__copyright__",
-                               parser_copyright_string);
-    PyModule_AddStringConstant(module, "__doc__",
-                               parser_doc_string);
-    PyModule_AddStringConstant(module, "__version__",
-                               parser_version_string);
-
-    /* Register to support pickling.
-     * If this fails, the import of this module will fail because an
-     * exception will be raised here; should we clear the exception?
-     */
-    copyreg = PyImport_ImportModuleNoBlock("copyreg");
-    if (copyreg != NULL) {
-        PyObject *func, *pickler;
-        _Py_IDENTIFIER(pickle);
-        _Py_IDENTIFIER(sequence2st);
-        _Py_IDENTIFIER(_pickler);
-
-        func = _PyObject_GetAttrId(copyreg, &PyId_pickle);
-        pickle_constructor = _PyObject_GetAttrId(module, &PyId_sequence2st);
-        pickler = _PyObject_GetAttrId(module, &PyId__pickler);
-        Py_XINCREF(pickle_constructor);
-        if ((func != NULL) && (pickle_constructor != NULL)
-            && (pickler != NULL)) {
-            PyObject *res;
-
-            res = PyObject_CallFunctionObjArgs(func, &PyST_Type, pickler,
-                                               pickle_constructor, NULL);
-            Py_XDECREF(res);
-        }
-        Py_XDECREF(func);
-        Py_XDECREF(pickle_constructor);
-        Py_XDECREF(pickler);
-        Py_DECREF(copyreg);
-    }
-    return module;
-}
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 66179b7..03de470 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -10,6 +10,8 @@
 #define PY_SSIZE_T_CLEAN
 
 #include "Python.h"
+#include "pycore_fileutils.h"
+#include "pycore_moduleobject.h"  // _PyModule_GetState()
 #ifdef MS_WINDOWS
    /* include <windows.h> early to avoid conflict with pycore_condvar.h:
 
@@ -18,10 +20,15 @@
 
       FSCTL_GET_REPARSE_POINT is not exported with WIN32_LEAN_AND_MEAN. */
 #  include <windows.h>
+#  include <pathcch.h>
 #endif
 
+#ifdef __VXWORKS__
+#  include "pycore_bitutils.h"    // _Py_popcount32()
+#endif
 #include "pycore_ceval.h"         // _PyEval_ReInitThreads()
 #include "pycore_import.h"        // _PyImport_ReInitLock()
+#include "pycore_initconfig.h"    // _PyStatus_EXCEPTION()
 #include "pycore_pystate.h"       // _PyInterpreterState_GET()
 #include "structmember.h"         // PyMemberDef
 #ifndef MS_WINDOWS
@@ -32,7 +39,7 @@
 
 /* On android API level 21, 'AT_EACCESS' is not declared although
  * HAVE_FACCESSAT is defined. */
-#ifdef __BIONIC__
+#ifdef __ANDROID__
 #  undef HAVE_FACCESSAT
 #endif
 
@@ -56,7 +63,13 @@
  */
 #if defined(__APPLE__)
 
-#if defined(__has_builtin) && __has_builtin(__builtin_available)
+#if defined(__has_builtin)
+#if __has_builtin(__builtin_available)
+#define HAVE_BUILTIN_AVAILABLE 1
+#endif
+#endif
+
+#ifdef HAVE_BUILTIN_AVAILABLE
 #  define HAVE_FSTATAT_RUNTIME __builtin_available(macOS 10.10, iOS 8.0, *)
 #  define HAVE_FACCESSAT_RUNTIME __builtin_available(macOS 10.10, iOS 8.0, *)
 #  define HAVE_FCHMODAT_RUNTIME __builtin_available(macOS 10.10, iOS 8.0, *)
@@ -513,6 +526,11 @@
 #  include <linux/memfd.h>
 #endif
 
+/* eventfd() */
+#ifdef HAVE_SYS_EVENTFD_H
+#  include <sys/eventfd.h>
+#endif
+
 #ifdef _Py_MEMORY_SANITIZER
 #  include <sanitizer/msan_interface.h>
 #endif
@@ -570,15 +588,45 @@
 void
 PyOS_AfterFork_Child(void)
 {
+    PyStatus status;
     _PyRuntimeState *runtime = &_PyRuntime;
-    _PyGILState_Reinit(runtime);
-    _PyEval_ReInitThreads(runtime);
-    _PyImport_ReInitLock();
-    _PySignal_AfterFork();
-    _PyRuntimeState_ReInitThreads(runtime);
-    _PyInterpreterState_DeleteExceptMain(runtime);
 
-    run_at_forkers(_PyInterpreterState_GET()->after_forkers_child, 0);
+    status = _PyGILState_Reinit(runtime);
+    if (_PyStatus_EXCEPTION(status)) {
+        goto fatal_error;
+    }
+
+    PyThreadState *tstate = _PyThreadState_GET();
+    _Py_EnsureTstateNotNULL(tstate);
+
+    status = _PyEval_ReInitThreads(tstate);
+    if (_PyStatus_EXCEPTION(status)) {
+        goto fatal_error;
+    }
+
+    status = _PyImport_ReInitLock();
+    if (_PyStatus_EXCEPTION(status)) {
+        goto fatal_error;
+    }
+
+    _PySignal_AfterFork();
+
+    status = _PyRuntimeState_ReInitThreads(runtime);
+    if (_PyStatus_EXCEPTION(status)) {
+        goto fatal_error;
+    }
+
+    status = _PyInterpreterState_DeleteExceptMain(runtime);
+    if (_PyStatus_EXCEPTION(status)) {
+        goto fatal_error;
+    }
+    assert(_PyThreadState_GET() == tstate);
+
+    run_at_forkers(tstate->interp->after_forkers_child, 0);
+    return;
+
+fatal_error:
+    Py_ExitStatusException(status);
 }
 
 static int
@@ -632,7 +680,7 @@
 }
 
 int
-_Py_Uid_Converter(PyObject *obj, void *p)
+_Py_Uid_Converter(PyObject *obj, uid_t *p)
 {
     uid_t uid;
     PyObject *index;
@@ -640,7 +688,7 @@
     long result;
     unsigned long uresult;
 
-    index = PyNumber_Index(obj);
+    index = _PyNumber_Index(obj);
     if (index == NULL) {
         PyErr_Format(PyExc_TypeError,
                      "uid should be integer, not %.200s",
@@ -719,7 +767,7 @@
 
 success:
     Py_DECREF(index);
-    *(uid_t *)p = uid;
+    *p = uid;
     return 1;
 
 underflow:
@@ -738,7 +786,7 @@
 }
 
 int
-_Py_Gid_Converter(PyObject *obj, void *p)
+_Py_Gid_Converter(PyObject *obj, gid_t *p)
 {
     gid_t gid;
     PyObject *index;
@@ -746,7 +794,7 @@
     long result;
     unsigned long uresult;
 
-    index = PyNumber_Index(obj);
+    index = _PyNumber_Index(obj);
     if (index == NULL) {
         PyErr_Format(PyExc_TypeError,
                      "gid should be integer, not %.200s",
@@ -826,7 +874,7 @@
 
 success:
     Py_DECREF(index);
-    *(gid_t *)p = gid;
+    *p = gid;
     return 1;
 
 underflow:
@@ -880,7 +928,7 @@
     int overflow;
     long long_value;
 
-    PyObject *index = PyNumber_Index(o);
+    PyObject *index = _PyNumber_Index(o);
     if (index == NULL) {
         return 0;
     }
@@ -947,7 +995,7 @@
 static inline _posixstate*
 get_posix_state(PyObject *module)
 {
-    void *state = PyModule_GetState(module);
+    void *state = _PyModule_GetState(module);
     assert(state != NULL);
     return (_posixstate *)state;
 }
@@ -1066,6 +1114,11 @@
 static void
 path_cleanup(path_t *path)
 {
+#if !USE_UNICODE_WCHAR_CACHE
+    wchar_t *wide = (wchar_t *)path->wide;
+    path->wide = NULL;
+    PyMem_Free(wide);
+#endif /* USE_UNICODE_WCHAR_CACHE */
     Py_CLEAR(path->object);
     Py_CLEAR(path->cleanup);
 }
@@ -1080,7 +1133,7 @@
     const char *narrow;
 #ifdef MS_WINDOWS
     PyObject *wo = NULL;
-    const wchar_t *wide;
+    wchar_t *wide = NULL;
 #endif
 
 #define FORMAT_EXCEPTION(exc, fmt) \
@@ -1153,7 +1206,14 @@
 
     if (is_unicode) {
 #ifdef MS_WINDOWS
+#if USE_UNICODE_WCHAR_CACHE
+_Py_COMP_DIAG_PUSH
+_Py_COMP_DIAG_IGNORE_DEPR_DECLS
         wide = PyUnicode_AsUnicodeAndSize(o, &length);
+_Py_COMP_DIAG_POP
+#else /* USE_UNICODE_WCHAR_CACHE */
+        wide = PyUnicode_AsWideCharString(o, &length);
+#endif /* USE_UNICODE_WCHAR_CACHE */
         if (!wide) {
             goto error_exit;
         }
@@ -1169,6 +1229,9 @@
         path->wide = wide;
         path->narrow = FALSE;
         path->fd = -1;
+#if !USE_UNICODE_WCHAR_CACHE
+        wide = NULL;
+#endif /* USE_UNICODE_WCHAR_CACHE */
         goto success_exit;
 #else
         if (!PyUnicode_FSConverter(o, &bytes)) {
@@ -1244,7 +1307,15 @@
         goto error_exit;
     }
 
+#if USE_UNICODE_WCHAR_CACHE
+_Py_COMP_DIAG_PUSH
+_Py_COMP_DIAG_IGNORE_DEPR_DECLS
     wide = PyUnicode_AsUnicodeAndSize(wo, &length);
+_Py_COMP_DIAG_POP
+#else /* USE_UNICODE_WCHAR_CACHE */
+    wide = PyUnicode_AsWideCharString(wo, &length);
+    Py_DECREF(wo);
+#endif /* USE_UNICODE_WCHAR_CACHE */
     if (!wide) {
         goto error_exit;
     }
@@ -1258,8 +1329,12 @@
     }
     path->wide = wide;
     path->narrow = TRUE;
-    path->cleanup = wo;
     Py_DECREF(bytes);
+#if USE_UNICODE_WCHAR_CACHE
+    path->cleanup = wo;
+#else /* USE_UNICODE_WCHAR_CACHE */
+    wide = NULL;
+#endif /* USE_UNICODE_WCHAR_CACHE */
 #else
     path->wide = NULL;
     path->narrow = narrow;
@@ -1283,7 +1358,11 @@
     Py_XDECREF(o);
     Py_XDECREF(bytes);
 #ifdef MS_WINDOWS
+#if USE_UNICODE_WCHAR_CACHE
     Py_XDECREF(wo);
+#else /* USE_UNICODE_WCHAR_CACHE */
+    PyMem_Free(wide);
+#endif /* USE_UNICODE_WCHAR_CACHE */
 #endif
     return 0;
 }
@@ -1569,13 +1648,11 @@
             Py_DECREF(d);
             return NULL;
         }
-        if (PyDict_GetItemWithError(d, k) == NULL) {
-            if (PyErr_Occurred() || PyDict_SetItem(d, k, v) != 0) {
-                Py_DECREF(v);
-                Py_DECREF(k);
-                Py_DECREF(d);
-                return NULL;
-            }
+        if (PyDict_SetDefault(d, k, v) == NULL) {
+            Py_DECREF(v);
+            Py_DECREF(k);
+            Py_DECREF(d);
+            return NULL;
         }
         Py_DECREF(k);
         Py_DECREF(v);
@@ -1678,18 +1755,6 @@
 
 /* POSIX generic methods */
 
-static int
-fildes_converter(PyObject *o, void *p)
-{
-    int fd;
-    int *pointer = (int *)p;
-    fd = PyObject_AsFileDescriptor(o);
-    if (fd < 0)
-        return 0;
-    *pointer = fd;
-    return 1;
-}
-
 static PyObject *
 posix_fildes_fd(int fd, int (*func)(int))
 {
@@ -1786,9 +1851,28 @@
 {
     HANDLE hFindFile;
     WIN32_FIND_DATAW FileData;
-    hFindFile = FindFirstFileW(pszFile, &FileData);
-    if (hFindFile == INVALID_HANDLE_VALUE)
+    LPCWSTR filename = pszFile;
+    size_t n = wcslen(pszFile);
+    if (n && (pszFile[n - 1] == L'\\' || pszFile[n - 1] == L'/')) {
+        // cannot use PyMem_Malloc here because we do not hold the GIL
+        filename = (LPCWSTR)malloc((n + 1) * sizeof(filename[0]));
+        wcsncpy_s((LPWSTR)filename, n + 1, pszFile, n);
+        while (--n > 0 && (filename[n] == L'\\' || filename[n] == L'/')) {
+            ((LPWSTR)filename)[n] = L'\0';
+        }
+        if (!n || (n == 1 && filename[1] == L':')) {
+            // Nothing left to query
+            free((void *)filename);
+            return FALSE;
+        }
+    }
+    hFindFile = FindFirstFileW(filename, &FileData);
+    if (pszFile != filename) {
+        free((void *)filename);
+    }
+    if (hFindFile == INVALID_HANDLE_VALUE) {
         return FALSE;
+    }
     FindClose(hFindFile);
     find_data_to_file_info(&FileData, info, reparse_tag);
     return TRUE;
@@ -2702,10 +2786,6 @@
         else:
             self.converter = 'dir_fd_converter'
 
-class fildes_converter(CConverter):
-    type = 'int'
-    converter = 'fildes_converter'
-
 class uid_t_converter(CConverter):
     type = "uid_t"
     converter = '_Py_Uid_Converter'
@@ -2768,7 +2848,7 @@
     converter="conv_sysconf_confname"
 
 [python start generated code]*/
-/*[python end generated code: output=da39a3ee5e6b4b0d input=f1c8ae8d744f6c8b]*/
+/*[python end generated code: output=da39a3ee5e6b4b0d input=3338733161aa7879]*/
 
 /*[clinic input]
 
@@ -4330,6 +4410,53 @@
     return result;
 }
 
+
+/*[clinic input]
+os._path_splitroot
+
+    path: path_t
+
+Removes everything after the root on Win32.
+[clinic start generated code]*/
+
+static PyObject *
+os__path_splitroot_impl(PyObject *module, path_t *path)
+/*[clinic end generated code: output=ab7f1a88b654581c input=dc93b1d3984cffb6]*/
+{
+    wchar_t *buffer;
+    wchar_t *end;
+    PyObject *result = NULL;
+    HRESULT ret;
+
+    buffer = (wchar_t*)PyMem_Malloc(sizeof(wchar_t) * (wcslen(path->wide) + 1));
+    if (!buffer) {
+        return NULL;
+    }
+    wcscpy(buffer, path->wide);
+    for (wchar_t *p = wcschr(buffer, L'/'); p; p = wcschr(p, L'/')) {
+        *p = L'\\';
+    }
+
+    Py_BEGIN_ALLOW_THREADS
+    ret = PathCchSkipRoot(buffer, &end);
+    Py_END_ALLOW_THREADS
+    if (FAILED(ret)) {
+        result = Py_BuildValue("sO", "", path->object);
+    } else if (end != buffer) {
+        size_t rootLen = (size_t)(end - buffer);
+        result = Py_BuildValue("NN",
+            PyUnicode_FromWideChar(path->wide, rootLen),
+            PyUnicode_FromWideChar(path->wide + rootLen, -1)
+        );
+    } else {
+        result = Py_BuildValue("Os", path->object, "");
+    }
+    PyMem_Free(buffer);
+
+    return result;
+}
+
+
 #endif /* MS_WINDOWS */
 
 
@@ -5427,7 +5554,7 @@
     Py_ssize_t i;
     for (i = 0; i < count; i++)
         PyMem_Free(array[i]);
-    PyMem_DEL(array);
+    PyMem_Free(array);
 }
 
 static int
@@ -5803,6 +5930,7 @@
 
     }
 
+#ifdef HAVE_SIGSET_T
    if (setsigmask) {
         sigset_t set;
         if (!_Py_Sigset_Converter(setsigmask, &set)) {
@@ -5828,6 +5956,13 @@
         }
         all_flags |= POSIX_SPAWN_SETSIGDEF;
     }
+#else
+    if (setsigmask || setsigdef) {
+        PyErr_SetString(PyExc_NotImplementedError,
+                        "sigset is not supported on this platform");
+        goto fail;
+    }
+#endif
 
     if (scheduler) {
 #ifdef POSIX_SPAWN_SETSCHEDULER
@@ -6457,9 +6592,10 @@
         res = Py_BuildValue(_Py_PARSE_INTPTR, spawnval);
 
   fail_2:
-    while (--envc >= 0)
-        PyMem_DEL(envlist[envc]);
-    PyMem_DEL(envlist);
+    while (--envc >= 0) {
+        PyMem_Free(envlist[envc]);
+    }
+    PyMem_Free(envlist);
   fail_1:
     free_string_array(argvlist, lastarg);
   fail_0:
@@ -6468,7 +6604,6 @@
 
 #endif /* HAVE_SPAWNV */
 
-
 #ifdef HAVE_FORK
 
 /* Helper function to validate arguments.
@@ -7058,12 +7193,11 @@
 
 
 /* AIX uses /dev/ptc but is otherwise the same as /dev/ptmx */
-/* IRIX has both /dev/ptc and /dev/ptmx, use ptmx */
 #if defined(HAVE_DEV_PTC) && !defined(HAVE_DEV_PTMX)
-#define DEV_PTY_FILE "/dev/ptc"
-#define HAVE_DEV_PTMX
+#  define DEV_PTY_FILE "/dev/ptc"
+#  define HAVE_DEV_PTMX
 #else
-#define DEV_PTY_FILE "/dev/ptmx"
+#  define DEV_PTY_FILE "/dev/ptmx"
 #endif
 
 #if defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) || defined(HAVE_DEV_PTMX)
@@ -7393,7 +7527,7 @@
 
     list = PyList_New(ngroups);
     if (list == NULL) {
-        PyMem_Del(groups);
+        PyMem_Free(groups);
         return NULL;
     }
 
@@ -7405,13 +7539,13 @@
 #endif
         if (o == NULL) {
             Py_DECREF(list);
-            PyMem_Del(groups);
+            PyMem_Free(groups);
             return NULL;
         }
         PyList_SET_ITEM(list, i, o);
     }
 
-    PyMem_Del(groups);
+    PyMem_Free(groups);
 
     return list;
 }
@@ -9078,25 +9212,6 @@
     Py_RETURN_NONE;
 }
 
-
-#ifdef HAVE_FDWALK
-static int
-_fdwalk_close_func(void *lohi, int fd)
-{
-    int lo = ((int *)lohi)[0];
-    int hi = ((int *)lohi)[1];
-
-    if (fd >= hi) {
-        return 1;
-    }
-    else if (fd >= lo) {
-        /* Ignore errors */
-        (void)close(fd);
-    }
-    return 0;
-}
-#endif /* HAVE_FDWALK */
-
 /*[clinic input]
 os.closerange
 
@@ -9111,32 +9226,8 @@
 os_closerange_impl(PyObject *module, int fd_low, int fd_high)
 /*[clinic end generated code: output=0ce5c20fcda681c2 input=5855a3d053ebd4ec]*/
 {
-#ifdef HAVE_FDWALK
-    int lohi[2];
-#endif
     Py_BEGIN_ALLOW_THREADS
-    _Py_BEGIN_SUPPRESS_IPH
-#ifdef HAVE_FDWALK
-    lohi[0] = Py_MAX(fd_low, 0);
-    lohi[1] = fd_high;
-    fdwalk(_fdwalk_close_func, lohi);
-#else
-    fd_low = Py_MAX(fd_low, 0);
-#ifdef __FreeBSD__
-    if (fd_high >= sysconf(_SC_OPEN_MAX)) {
-        /* Any errors encountered while closing file descriptors are ignored */
-        closefrom(fd_low);
-    }
-    else
-#endif
-    {
-        for (int i = fd_low; i < fd_high; i++) {
-            /* Ignore errors */
-            (void)close(i);
-        }
-    }
-#endif
-    _Py_END_SUPPRESS_IPH
+    _Py_closerange(fd_low, fd_high - 1);
     Py_END_ALLOW_THREADS
     Py_RETURN_NONE;
 }
@@ -9399,7 +9490,7 @@
 
     *buf = PyMem_New(Py_buffer, cnt);
     if (*buf == NULL) {
-        PyMem_Del(*iov);
+        PyMem_Free(*iov);
         PyErr_NoMemory();
         return -1;
     }
@@ -9419,11 +9510,11 @@
     return 0;
 
 fail:
-    PyMem_Del(*iov);
+    PyMem_Free(*iov);
     for (j = 0; j < i; j++) {
         PyBuffer_Release(&(*buf)[j]);
     }
-    PyMem_Del(*buf);
+    PyMem_Free(*buf);
     return -1;
 }
 
@@ -9431,11 +9522,11 @@
 iov_cleanup(struct iovec *iov, Py_buffer *buf, int cnt)
 {
     int i;
-    PyMem_Del(iov);
+    PyMem_Free(iov);
     for (i = 0; i < cnt; i++) {
         PyBuffer_Release(&buf[i]);
     }
-    PyMem_Del(buf);
+    PyMem_Free(buf);
 }
 #endif
 
@@ -9979,9 +10070,11 @@
 /*[clinic end generated code: output=6a48c8b4e644ca00 input=08ce94aa1eaf7b5e]*/
 {
     int return_value;
+    Py_BEGIN_ALLOW_THREADS
     _Py_BEGIN_SUPPRESS_IPH
     return_value = isatty(fd);
     _Py_END_SUPPRESS_IPH
+    Py_END_ALLOW_THREADS
     return return_value;
 }
 
@@ -10015,18 +10108,16 @@
     attr.bInheritHandle = FALSE;
 
     Py_BEGIN_ALLOW_THREADS
-    _Py_BEGIN_SUPPRESS_IPH
     ok = CreatePipe(&read, &write, &attr, 0);
     if (ok) {
-        fds[0] = _open_osfhandle((intptr_t)read, _O_RDONLY);
-        fds[1] = _open_osfhandle((intptr_t)write, _O_WRONLY);
+        fds[0] = _Py_open_osfhandle_noraise(read, _O_RDONLY);
+        fds[1] = _Py_open_osfhandle_noraise(write, _O_WRONLY);
         if (fds[0] == -1 || fds[1] == -1) {
             CloseHandle(read);
             CloseHandle(write);
             ok = 0;
         }
     }
-    _Py_END_SUPPRESS_IPH
     Py_END_ALLOW_THREADS
 
     if (!ok)
@@ -10211,6 +10302,7 @@
 
 - RWF_DSYNC
 - RWF_SYNC
+- RWF_APPEND
 
 Using non-zero flags requires Linux 4.7 or newer.
 [clinic start generated code]*/
@@ -10218,7 +10310,7 @@
 static Py_ssize_t
 os_pwritev_impl(PyObject *module, int fd, PyObject *buffers, Py_off_t offset,
                 int flags)
-/*[clinic end generated code: output=e3dd3e9d11a6a5c7 input=803dc5ddbf0cfd3b]*/
+/*[clinic end generated code: output=e3dd3e9d11a6a5c7 input=35358c327e1a2a8e]*/
 {
     Py_ssize_t cnt;
     Py_ssize_t result;
@@ -10360,6 +10452,75 @@
 }
 #endif /* HAVE_COPY_FILE_RANGE*/
 
+#if (defined(HAVE_SPLICE) && !defined(_AIX))
+/*[clinic input]
+
+os.splice
+    src: int
+        Source file descriptor.
+    dst: int
+        Destination file descriptor.
+    count: Py_ssize_t
+        Number of bytes to copy.
+    offset_src: object = None
+        Starting offset in src.
+    offset_dst: object = None
+        Starting offset in dst.
+    flags: unsigned_int = 0
+        Flags to modify the semantics of the call.
+
+Transfer count bytes from one pipe to a descriptor or vice versa.
+
+If offset_src is None, then src is read from the current position;
+respectively for offset_dst. The offset associated to the file
+descriptor that refers to a pipe must be None.
+[clinic start generated code]*/
+
+static PyObject *
+os_splice_impl(PyObject *module, int src, int dst, Py_ssize_t count,
+               PyObject *offset_src, PyObject *offset_dst,
+               unsigned int flags)
+/*[clinic end generated code: output=d0386f25a8519dc5 input=047527c66c6d2e0a]*/
+{
+    off_t offset_src_val, offset_dst_val;
+    off_t *p_offset_src = NULL;
+    off_t *p_offset_dst = NULL;
+    Py_ssize_t ret;
+    int async_err = 0;
+
+    if (count < 0) {
+        PyErr_SetString(PyExc_ValueError, "negative value for 'count' not allowed");
+        return NULL;
+    }
+
+    if (offset_src != Py_None) {
+        if (!Py_off_t_converter(offset_src, &offset_src_val)) {
+            return NULL;
+        }
+        p_offset_src = &offset_src_val;
+    }
+
+    if (offset_dst != Py_None) {
+        if (!Py_off_t_converter(offset_dst, &offset_dst_val)) {
+            return NULL;
+        }
+        p_offset_dst = &offset_dst_val;
+    }
+
+    do {
+        Py_BEGIN_ALLOW_THREADS
+        ret = splice(src, p_offset_src, dst, p_offset_dst, count, flags);
+        Py_END_ALLOW_THREADS
+    } while (ret < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals()));
+
+    if (ret < 0) {
+        return (!async_err) ? posix_error() : NULL;
+    }
+
+    return PyLong_FromSsize_t(ret);
+}
+#endif /* HAVE_SPLICE*/
+
 #ifdef HAVE_MKFIFO
 /*[clinic input]
 os.mkfifo
@@ -11396,7 +11557,7 @@
 /*[clinic input]
 os.fpathconf -> long
 
-    fd: int
+    fd: fildes
     name: path_confname
     /
 
@@ -11407,7 +11568,7 @@
 
 static long
 os_fpathconf_impl(PyObject *module, int fd, int name)
-/*[clinic end generated code: output=d5b7042425fc3e21 input=5942a024d3777810]*/
+/*[clinic end generated code: output=d5b7042425fc3e21 input=5b8d2471cfaae186]*/
 {
     long limit;
 
@@ -12332,6 +12493,9 @@
 os.startfile
     filepath: path_t
     operation: Py_UNICODE = NULL
+    arguments: Py_UNICODE = NULL
+    cwd: path_t(nullable=True) = None
+    show_cmd: int = 1
 
 Start a file with its associated application.
 
@@ -12342,6 +12506,16 @@
 When another "operation" is given, it specifies what should be done with
 the file.  A typical operation is "print".
 
+"arguments" is passed to the application, but should be omitted if the
+file is a document.
+
+"cwd" is the working directory for the operation. If "filepath" is
+relative, it will be resolved against this directory. This argument
+should usually be an absolute path.
+
+"show_cmd" can be used to override the recommended visibility option.
+See the Windows ShellExecute documentation for values.
+
 startfile returns as soon as the associated application is launched.
 There is no option to wait for the application to close, and no way
 to retrieve the application's exit status.
@@ -12353,8 +12527,9 @@
 
 static PyObject *
 os_startfile_impl(PyObject *module, path_t *filepath,
-                  const Py_UNICODE *operation)
-/*[clinic end generated code: output=66dc311c94d50797 input=c940888a5390f039]*/
+                  const Py_UNICODE *operation, const Py_UNICODE *arguments,
+                  path_t *cwd, int show_cmd)
+/*[clinic end generated code: output=3baa4f9795841880 input=8248997b80669622]*/
 {
     HINSTANCE rc;
 
@@ -12368,10 +12543,15 @@
     if (PySys_Audit("os.startfile", "Ou", filepath->object, operation) < 0) {
         return NULL;
     }
+    if (PySys_Audit("os.startfile/2", "OuuOi", filepath->object, operation,
+                    arguments, cwd->object ? cwd->object : Py_None,
+                    show_cmd) < 0) {
+        return NULL;
+    }
 
     Py_BEGIN_ALLOW_THREADS
     rc = Py_ShellExecuteW((HWND)0, operation, filepath->wide,
-                          NULL, NULL, SW_SHOWNORMAL);
+                          arguments, cwd->wide, show_cmd);
     Py_END_ALLOW_THREADS
 
     if (rc <= (HINSTANCE)32) {
@@ -12737,7 +12917,7 @@
             path_error(path);
             break;
         }
-        buffer = PyMem_MALLOC(buffer_size);
+        buffer = PyMem_Malloc(buffer_size);
         if (!buffer) {
             PyErr_NoMemory();
             break;
@@ -12754,7 +12934,7 @@
 
         if (length < 0) {
             if (errno == ERANGE) {
-                PyMem_FREE(buffer);
+                PyMem_Free(buffer);
                 buffer = NULL;
                 continue;
             }
@@ -12792,7 +12972,7 @@
     }
 exit:
     if (buffer)
-        PyMem_FREE(buffer);
+        PyMem_Free(buffer);
     return result;
 }
 #endif /* USE_XATTRS */
@@ -12854,6 +13034,79 @@
 }
 #endif
 
+#ifdef HAVE_EVENTFD
+/*[clinic input]
+os.eventfd
+
+    initval: unsigned_int
+    flags: int(c_default="EFD_CLOEXEC") = EFD_CLOEXEC
+
+Creates and returns an event notification file descriptor.
+[clinic start generated code]*/
+
+static PyObject *
+os_eventfd_impl(PyObject *module, unsigned int initval, int flags)
+/*[clinic end generated code: output=ce9c9bbd1446f2de input=66203e3c50c4028b]*/
+
+{
+    /* initval is limited to uint32_t, internal counter is uint64_t */
+    int fd;
+    Py_BEGIN_ALLOW_THREADS
+    fd = eventfd(initval, flags);
+    Py_END_ALLOW_THREADS
+    if (fd == -1) {
+        return PyErr_SetFromErrno(PyExc_OSError);
+    }
+    return PyLong_FromLong(fd);
+}
+
+/*[clinic input]
+os.eventfd_read
+
+    fd: fildes
+
+Read eventfd value
+[clinic start generated code]*/
+
+static PyObject *
+os_eventfd_read_impl(PyObject *module, int fd)
+/*[clinic end generated code: output=8f2c7b59a3521fd1 input=110f8b57fa596afe]*/
+{
+    eventfd_t value;
+    int result;
+    Py_BEGIN_ALLOW_THREADS
+    result = eventfd_read(fd, &value);
+    Py_END_ALLOW_THREADS
+    if (result == -1) {
+        return PyErr_SetFromErrno(PyExc_OSError);
+    }
+    return PyLong_FromUnsignedLongLong(value);
+}
+
+/*[clinic input]
+os.eventfd_write
+
+    fd: fildes
+    value: unsigned_long_long
+
+Write eventfd value.
+[clinic start generated code]*/
+
+static PyObject *
+os_eventfd_write_impl(PyObject *module, int fd, unsigned long long value)
+/*[clinic end generated code: output=bebd9040bbf987f5 input=156de8555be5a949]*/
+{
+    int result;
+    Py_BEGIN_ALLOW_THREADS
+    result = eventfd_write(fd, value);
+    Py_END_ALLOW_THREADS
+    if (result == -1) {
+        return PyErr_SetFromErrno(PyExc_OSError);
+    }
+    Py_RETURN_NONE;
+}
+#endif  /* HAVE_EVENTFD */
+
 /* Terminal size querying */
 
 PyDoc_STRVAR(TerminalSize_docstring,
@@ -12984,6 +13237,8 @@
     ncpu = mpctl(MPC_GETNUMSPUS, NULL, NULL);
 #elif defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_ONLN)
     ncpu = sysconf(_SC_NPROCESSORS_ONLN);
+#elif defined(__VXWORKS__)
+    ncpu = _Py_popcount32(vxCpuEnabledGet());
 #elif defined(__DragonFly__) || \
       defined(__OpenBSD__)   || \
       defined(__FreeBSD__)   || \
@@ -13170,14 +13425,6 @@
 #endif
 } DirEntry;
 
-static PyObject *
-_disabled_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
-{
-    PyErr_Format(PyExc_TypeError,
-        "cannot create '%.100s' instances", _PyType_Name(type));
-    return NULL;
-}
-
 static void
 DirEntry_dealloc(DirEntry *entry)
 {
@@ -13232,7 +13479,15 @@
 #ifdef MS_WINDOWS
     if (!PyUnicode_FSDecoder(self->path, &ub))
         return NULL;
+#if USE_UNICODE_WCHAR_CACHE
+_Py_COMP_DIAG_PUSH
+_Py_COMP_DIAG_IGNORE_DEPR_DECLS
     const wchar_t *path = PyUnicode_AsUnicode(ub);
+_Py_COMP_DIAG_POP
+#else /* USE_UNICODE_WCHAR_CACHE */
+    wchar_t *path = PyUnicode_AsWideCharString(ub, NULL);
+    Py_DECREF(ub);
+#endif /* USE_UNICODE_WCHAR_CACHE */
 #else /* POSIX */
     if (!PyUnicode_FSConverter(self->path, &ub))
         return NULL;
@@ -13259,7 +13514,11 @@
         else
             result = LSTAT(path, &st);
     }
+#if defined(MS_WINDOWS) && !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free(path);
+#else /* USE_UNICODE_WCHAR_CACHE */
     Py_DECREF(ub);
+#endif /* USE_UNICODE_WCHAR_CACHE */
 
     if (result != 0)
         return path_object_error(self->path);
@@ -13448,15 +13707,24 @@
 #ifdef MS_WINDOWS
     if (!self->got_file_index) {
         PyObject *unicode;
-        const wchar_t *path;
         STRUCT_STAT stat;
         int result;
 
         if (!PyUnicode_FSDecoder(self->path, &unicode))
             return NULL;
-        path = PyUnicode_AsUnicode(unicode);
+#if USE_UNICODE_WCHAR_CACHE
+_Py_COMP_DIAG_PUSH
+_Py_COMP_DIAG_IGNORE_DEPR_DECLS
+        const wchar_t *path = PyUnicode_AsUnicode(unicode);
         result = LSTAT(path, &stat);
         Py_DECREF(unicode);
+_Py_COMP_DIAG_POP
+#else /* USE_UNICODE_WCHAR_CACHE */
+        wchar_t *path = PyUnicode_AsWideCharString(unicode, NULL);
+        Py_DECREF(unicode);
+        result = LSTAT(path, &stat);
+        PyMem_Free(path);
+#endif /* USE_UNICODE_WCHAR_CACHE */
 
         if (result != 0)
             return path_object_error(self->path);
@@ -13515,7 +13783,6 @@
 };
 
 static PyType_Slot DirEntryType_slots[] = {
-    {Py_tp_new, _disabled_new},
     {Py_tp_dealloc, DirEntry_dealloc},
     {Py_tp_repr, DirEntry_repr},
     {Py_tp_methods, DirEntry_methods},
@@ -13527,7 +13794,7 @@
     MODNAME ".DirEntry",
     sizeof(DirEntry),
     0,
-    Py_TPFLAGS_DEFAULT,
+    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION,
     DirEntryType_slots
 };
 
@@ -13947,7 +14214,6 @@
 };
 
 static PyType_Slot ScandirIteratorType_slots[] = {
-    {Py_tp_new, _disabled_new},
     {Py_tp_dealloc, ScandirIterator_dealloc},
     {Py_tp_finalize, ScandirIterator_finalize},
     {Py_tp_iter, PyObject_SelfIter},
@@ -13962,7 +14228,8 @@
     0,
     // bpo-40549: Py_TPFLAGS_BASETYPE should not be used, since
     // PyType_GetModule(Py_TYPE(self)) doesn't work on a subclass instance.
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_FINALIZE,
+    (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_FINALIZE
+        | Py_TPFLAGS_DISALLOW_INSTANTIATION),
     ScandirIteratorType_slots
 };
 
@@ -14010,10 +14277,9 @@
     iterator->dirp = NULL;
 #endif
 
-    memcpy(&iterator->path, path, sizeof(path_t));
     /* Move the ownership to iterator->path */
-    path->object = NULL;
-    path->cleanup = NULL;
+    memcpy(&iterator->path, path, sizeof(path_t));
+    memset(path, 0, sizeof(path_t));
 
 #ifdef MS_WINDOWS
     iterator->first_time = 1;
@@ -14038,7 +14304,7 @@
     if (iterator->path.fd != -1) {
       if (HAVE_FDOPENDIR_RUNTIME) {
         /* closedir() closes the FD, so we duplicate it */
-        fd = _Py_dup(path->fd);
+        fd = _Py_dup(iterator->path.fd);
         if (fd == -1)
             goto error;
 
@@ -14328,7 +14594,7 @@
 
    os.waitstatus_to_exitcode() is implemented in C and not in Python, so
    subprocess can safely call it during late Python finalization without
-   risking that used os attributes were set to None by _PyImport_Cleanup(). */
+   risking that used os attributes were set to None by finalize_modules(). */
 #if defined(WIFEXITED) || defined(MS_WINDOWS)
 /*[clinic input]
 os.waitstatus_to_exitcode
@@ -14354,11 +14620,6 @@
 os_waitstatus_to_exitcode_impl(PyObject *module, PyObject *status_obj)
 /*[clinic end generated code: output=db50b1b0ba3c7153 input=7fe2d7fdaea3db42]*/
 {
-    if (PyFloat_Check(status_obj)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        return NULL;
-    }
 #ifndef MS_WINDOWS
     int status = _PyLong_AsInt(status_obj);
     if (status == -1 && PyErr_Occurred()) {
@@ -14450,6 +14711,7 @@
     OS_POSIX_SPAWNP_METHODDEF
     OS_READLINK_METHODDEF
     OS_COPY_FILE_RANGE_METHODDEF
+    OS_SPLICE_METHODDEF
     OS_RENAME_METHODDEF
     OS_REPLACE_METHODDEF
     OS_RMDIR_METHODDEF
@@ -14573,6 +14835,7 @@
     OS__GETDISKUSAGE_METHODDEF
     OS__GETFINALPATHNAME_METHODDEF
     OS__GETVOLUMEPATHNAME_METHODDEF
+    OS__PATH_SPLITROOT_METHODDEF
     OS_GETLOADAVG_METHODDEF
     OS_URANDOM_METHODDEF
     OS_SETRESUID_METHODDEF
@@ -14597,6 +14860,9 @@
     OS_FSPATH_METHODDEF
     OS_GETRANDOM_METHODDEF
     OS_MEMFD_CREATE_METHODDEF
+    OS_EVENTFD_METHODDEF
+    OS_EVENTFD_READ_METHODDEF
+    OS_EVENTFD_WRITE_METHODDEF
     OS__ADD_DLL_DIRECTORY_METHODDEF
     OS__REMOVE_DLL_DIRECTORY_METHODDEF
     OS_WAITSTATUS_TO_EXITCODE_METHODDEF
@@ -14722,7 +14988,15 @@
 #ifdef O_ACCMODE
     if (PyModule_AddIntMacro(m, O_ACCMODE)) return -1;
 #endif
-
+#ifdef O_EVTONLY
+    if (PyModule_AddIntMacro(m, O_EVTONLY)) return -1;
+#endif
+#ifdef O_FSYNC
+    if (PyModule_AddIntMacro(m, O_FSYNC)) return -1;
+#endif
+#ifdef O_SYMLINK
+    if (PyModule_AddIntMacro(m, O_SYMLINK)) return -1;
+#endif
 
 #ifdef SEEK_HOLE
     if (PyModule_AddIntMacro(m, SEEK_HOLE)) return -1;
@@ -14772,6 +15046,9 @@
     /* Do not follow links.      */
     if (PyModule_AddIntMacro(m, O_NOFOLLOW)) return -1;
 #endif
+#ifdef O_NOFOLLOW_ANY
+    if (PyModule_AddIntMacro(m, O_NOFOLLOW_ANY)) return -1;
+#endif
 #ifdef O_NOLINKS
     /* Fails if link count of the named file is greater than 1 */
     if (PyModule_AddIntMacro(m, O_NOLINKS)) return -1;
@@ -14965,6 +15242,16 @@
 #ifdef RWF_NOWAIT
     if (PyModule_AddIntConstant(m, "RWF_NOWAIT", RWF_NOWAIT)) return -1;
 #endif
+#ifdef RWF_APPEND
+    if (PyModule_AddIntConstant(m, "RWF_APPEND", RWF_APPEND)) return -1;
+#endif
+
+/* constants for splice */
+#if defined(HAVE_SPLICE) && defined(__linux__)
+    if (PyModule_AddIntConstant(m, "SPLICE_F_MOVE", SPLICE_F_MOVE)) return -1;
+    if (PyModule_AddIntConstant(m, "SPLICE_F_NONBLOCK", SPLICE_F_NONBLOCK)) return -1;
+    if (PyModule_AddIntConstant(m, "SPLICE_F_MORE", SPLICE_F_MORE)) return -1;
+#endif
 
 /* constants for posix_spawn */
 #ifdef HAVE_POSIX_SPAWN
@@ -15102,6 +15389,12 @@
 #ifdef MFD_HUGE_16GB
     if (PyModule_AddIntMacro(m, MFD_HUGE_16GB)) return -1;
 #endif
+#endif /* HAVE_MEMFD_CREATE */
+
+#ifdef HAVE_EVENTFD
+    if (PyModule_AddIntMacro(m, EFD_CLOEXEC)) return -1;
+    if (PyModule_AddIntMacro(m, EFD_NONBLOCK)) return -1;
+    if (PyModule_AddIntMacro(m, EFD_SEMAPHORE)) return -1;
 #endif
 
 #if defined(__APPLE__)
@@ -15195,6 +15488,10 @@
     int (*probe)(void);
 } have_functions[] = {
 
+#ifdef HAVE_EVENTFD
+    {"HAVE_EVENTFD", NULL},
+#endif
+
 #ifdef HAVE_FACCESSAT
     { "HAVE_FACCESSAT", probe_faccessat },
 #endif
diff --git a/Modules/posixmodule.h b/Modules/posixmodule.h
index 1e00562..5452ffb 100644
--- a/Modules/posixmodule.h
+++ b/Modules/posixmodule.h
@@ -14,8 +14,8 @@
 #ifndef MS_WINDOWS
 PyAPI_FUNC(PyObject *) _PyLong_FromUid(uid_t);
 PyAPI_FUNC(PyObject *) _PyLong_FromGid(gid_t);
-PyAPI_FUNC(int) _Py_Uid_Converter(PyObject *, void *);
-PyAPI_FUNC(int) _Py_Gid_Converter(PyObject *, void *);
+PyAPI_FUNC(int) _Py_Uid_Converter(PyObject *, uid_t *);
+PyAPI_FUNC(int) _Py_Gid_Converter(PyObject *, gid_t *);
 #endif /* MS_WINDOWS */
 
 #if defined(PYPTHREAD_SIGMASK) || defined(HAVE_SIGWAIT) || \
@@ -23,9 +23,7 @@
 # define HAVE_SIGSET_T
 #endif
 
-#ifdef HAVE_SIGSET_T
 PyAPI_FUNC(int) _Py_Sigset_Converter(PyObject *, void *);
-#endif /* HAVE_SIGSET_T */
 #endif /* Py_LIMITED_API */
 
 #ifdef __cplusplus
diff --git a/Modules/pwdmodule.c b/Modules/pwdmodule.c
index 901a3ed..14d3f9d 100644
--- a/Modules/pwdmodule.c
+++ b/Modules/pwdmodule.c
@@ -59,8 +59,6 @@
     return (pwdmodulestate *)state;
 }
 
-#define modulestate_global get_pwd_state(PyState_FindModule(&pwdmodule))
-
 static struct PyModuleDef pwdmodule;
 
 #define DEFAULT_BUFFER_SIZE 1024
@@ -79,10 +77,10 @@
 }
 
 static PyObject *
-mkpwent(struct passwd *p)
+mkpwent(PyObject *module, struct passwd *p)
 {
     int setIndex = 0;
-    PyObject *v = PyStructSequence_New(modulestate_global->StructPwdType);
+    PyObject *v = PyStructSequence_New(get_pwd_state(module)->StructPwdType);
     if (v == NULL)
         return NULL;
 
@@ -194,7 +192,7 @@
         Py_DECREF(uid_obj);
         return NULL;
     }
-    retval = mkpwent(p);
+    retval = mkpwent(module, p);
 #ifdef HAVE_GETPWUID_R
     PyMem_RawFree(buf);
 #endif
@@ -274,7 +272,7 @@
         }
         goto out;
     }
-    retval = mkpwent(p);
+    retval = mkpwent(module, p);
 out:
     PyMem_RawFree(buf);
     Py_DECREF(bytes);
@@ -300,7 +298,7 @@
         return NULL;
     setpwent();
     while ((p = getpwent()) != NULL) {
-        PyObject *v = mkpwent(p);
+        PyObject *v = mkpwent(module, p);
         if (v == NULL || PyList_Append(d, v) != 0) {
             Py_XDECREF(v);
             Py_DECREF(d);
@@ -323,6 +321,26 @@
     {NULL,              NULL}           /* sentinel */
 };
 
+static int
+pwdmodule_exec(PyObject *module)
+{
+    pwdmodulestate *state = get_pwd_state(module);
+
+    state->StructPwdType = PyStructSequence_NewType(&struct_pwd_type_desc);
+    if (state->StructPwdType == NULL) {
+        return -1;
+    }
+    if (PyModule_AddType(module, state->StructPwdType) < 0) {
+        return -1;
+    }
+    return 0;
+}
+
+static PyModuleDef_Slot pwdmodule_slots[] = {
+    {Py_mod_exec, pwdmodule_exec},
+    {0, NULL}
+};
+
 static int pwdmodule_traverse(PyObject *m, visitproc visit, void *arg) {
     Py_VISIT(get_pwd_state(m)->StructPwdType);
     return 0;
@@ -337,34 +355,19 @@
 
 static struct PyModuleDef pwdmodule = {
     PyModuleDef_HEAD_INIT,
-    "pwd",
-    pwd__doc__,
-    sizeof(pwdmodulestate),
-    pwd_methods,
-    NULL,
-    pwdmodule_traverse,
-    pwdmodule_clear,
-    pwdmodule_free,
+    .m_name = "pwd",
+    .m_doc = pwd__doc__,
+    .m_size = sizeof(pwdmodulestate),
+    .m_methods = pwd_methods,
+    .m_slots = pwdmodule_slots,
+    .m_traverse = pwdmodule_traverse,
+    .m_clear = pwdmodule_clear,
+    .m_free = pwdmodule_free,
 };
 
 
 PyMODINIT_FUNC
 PyInit_pwd(void)
 {
-    PyObject *m;
-    if ((m = PyState_FindModule(&pwdmodule)) != NULL) {
-        Py_INCREF(m);
-        return m;
-    }
-    if ((m = PyModule_Create(&pwdmodule)) == NULL)
-        return NULL;
-
-    pwdmodulestate *state = PyModule_GetState(m);
-    state->StructPwdType = PyStructSequence_NewType(&struct_pwd_type_desc);
-    if (state->StructPwdType == NULL) {
-        return NULL;
-    }
-    Py_INCREF(state->StructPwdType);
-    PyModule_AddObject(m, "struct_passwd", (PyObject *) state->StructPwdType);
-    return m;
+    return PyModuleDef_Init(&pwdmodule);
 }
diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c
index 12ae66d..b3d9bdd 100644
--- a/Modules/pyexpat.c
+++ b/Modules/pyexpat.c
@@ -47,7 +47,18 @@
     _DummyDecl
 };
 
-static PyObject *ErrorObject;
+typedef struct {
+    PyTypeObject *xml_parse_type;
+    PyObject *error;
+} pyexpat_state;
+
+static inline pyexpat_state*
+pyexpat_get_state(PyObject *module)
+{
+    void *state = PyModule_GetState(module);
+    assert(state != NULL);
+    return (pyexpat_state *)state;
+}
 
 /* ----------------------------------------------------- */
 
@@ -73,8 +84,6 @@
 
 #define CHARACTER_DATA_BUFFER_SIZE 8192
 
-static PyTypeObject Xmlparsetype;
-
 typedef void (*xmlhandlersetter)(XML_Parser self, void *meth);
 typedef void* xmlhandler;
 
@@ -107,7 +116,7 @@
  * information.  Always returns NULL.
  */
 static PyObject *
-set_error(xmlparseobject *self, enum XML_Error code)
+set_error(pyexpat_state *state, xmlparseobject *self, enum XML_Error code)
 {
     PyObject *err;
     PyObject *buffer;
@@ -119,13 +128,13 @@
                                   XML_ErrorString(code), lineno, column);
     if (buffer == NULL)
         return NULL;
-    err = PyObject_CallOneArg(ErrorObject, buffer);
+    err = PyObject_CallOneArg(state->error, buffer);
     Py_DECREF(buffer);
     if (  err != NULL
           && set_error_attr(err, "code", code)
           && set_error_attr(err, "offset", column)
           && set_error_attr(err, "lineno", lineno)) {
-        PyErr_SetObject(ErrorObject, err);
+        PyErr_SetObject(state->error, err);
     }
     Py_XDECREF(err);
     return NULL;
@@ -680,13 +689,13 @@
 
 
 static PyObject *
-get_parse_result(xmlparseobject *self, int rv)
+get_parse_result(pyexpat_state *state, xmlparseobject *self, int rv)
 {
     if (PyErr_Occurred()) {
         return NULL;
     }
     if (rv == 0) {
-        return set_error(self, XML_GetErrorCode(self->itself));
+        return set_error(state, self, XML_GetErrorCode(self->itself));
     }
     if (flush_character_buffer(self) < 0) {
         return NULL;
@@ -699,6 +708,7 @@
 /*[clinic input]
 pyexpat.xmlparser.Parse
 
+    cls: defining_class
     data: object
     isfinal: bool(accept={int}) = False
     /
@@ -709,14 +719,15 @@
 [clinic start generated code]*/
 
 static PyObject *
-pyexpat_xmlparser_Parse_impl(xmlparseobject *self, PyObject *data,
-                             int isfinal)
-/*[clinic end generated code: output=f4db843dd1f4ed4b input=eb616027bfa9847f]*/
+pyexpat_xmlparser_Parse_impl(xmlparseobject *self, PyTypeObject *cls,
+                             PyObject *data, int isfinal)
+/*[clinic end generated code: output=8faffe07fe1f862a input=fc97f833558ca715]*/
 {
     const char *s;
     Py_ssize_t slen;
     Py_buffer view;
     int rc;
+    pyexpat_state *state = PyType_GetModuleState(cls);
 
     if (PyUnicode_Check(data)) {
         view.buf = NULL;
@@ -745,9 +756,10 @@
     rc = XML_Parse(self->itself, s, (int)slen, isfinal);
 
 done:
-    if (view.buf != NULL)
+    if (view.buf != NULL) {
         PyBuffer_Release(&view);
-    return get_parse_result(self, rc);
+    }
+    return get_parse_result(state, self, rc);
 }
 
 /* File reading copied from cPickle */
@@ -796,6 +808,7 @@
 /*[clinic input]
 pyexpat.xmlparser.ParseFile
 
+    cls: defining_class
     file: object
     /
 
@@ -803,13 +816,16 @@
 [clinic start generated code]*/
 
 static PyObject *
-pyexpat_xmlparser_ParseFile(xmlparseobject *self, PyObject *file)
-/*[clinic end generated code: output=2adc6a13100cc42b input=fbb5a12b6038d735]*/
+pyexpat_xmlparser_ParseFile_impl(xmlparseobject *self, PyTypeObject *cls,
+                                 PyObject *file)
+/*[clinic end generated code: output=34780a094c8ca3ae input=ba4bc9c541684793]*/
 {
     int rv = 1;
     PyObject *readmethod = NULL;
     _Py_IDENTIFIER(read);
 
+    pyexpat_state *state = PyType_GetModuleState(cls);
+
     if (_PyObject_LookupAttrId(file, &PyId_read, &readmethod) < 0) {
         return NULL;
     }
@@ -823,7 +839,7 @@
         void *buf = XML_GetBuffer(self->itself, BUF_SIZE);
         if (buf == NULL) {
             Py_XDECREF(readmethod);
-            return get_parse_result(self, 0);
+            return get_parse_result(state, self, 0);
         }
 
         bytes_read = readinst(buf, BUF_SIZE, readmethod);
@@ -841,7 +857,7 @@
             break;
     }
     Py_XDECREF(readmethod);
-    return get_parse_result(self, rv);
+    return get_parse_result(state, self, rv);
 }
 
 /*[clinic input]
@@ -907,6 +923,7 @@
 /*[clinic input]
 pyexpat.xmlparser.ExternalEntityParserCreate
 
+    cls: defining_class
     context: str(accept={str, NoneType})
     encoding: str = NULL
     /
@@ -916,16 +933,21 @@
 
 static PyObject *
 pyexpat_xmlparser_ExternalEntityParserCreate_impl(xmlparseobject *self,
+                                                  PyTypeObject *cls,
                                                   const char *context,
                                                   const char *encoding)
-/*[clinic end generated code: output=535cda9d7a0fbcd6 input=b906714cc122c322]*/
+/*[clinic end generated code: output=01d4472b49cb3f92 input=ec70c6b9e6e9619a]*/
 {
     xmlparseobject *new_parser;
     int i;
 
-    new_parser = PyObject_GC_New(xmlparseobject, &Xmlparsetype);
-    if (new_parser == NULL)
+    pyexpat_state *state = PyType_GetModuleState(cls);
+
+    new_parser = PyObject_GC_New(xmlparseobject, state->xml_parse_type);
+    if (new_parser == NULL) {
         return NULL;
+    }
+
     new_parser->buffer_size = self->buffer_size;
     new_parser->buffer_used = 0;
     new_parser->buffer = NULL;
@@ -1006,6 +1028,7 @@
 /*[clinic input]
 pyexpat.xmlparser.UseForeignDTD
 
+    cls: defining_class
     flag: bool = True
     /
 
@@ -1017,14 +1040,16 @@
 [clinic start generated code]*/
 
 static PyObject *
-pyexpat_xmlparser_UseForeignDTD_impl(xmlparseobject *self, int flag)
-/*[clinic end generated code: output=cfaa9aa50bb0f65c input=78144c519d116a6e]*/
+pyexpat_xmlparser_UseForeignDTD_impl(xmlparseobject *self, PyTypeObject *cls,
+                                     int flag)
+/*[clinic end generated code: output=d7d98252bd25a20f input=23440ecb0573fb29]*/
 {
+    pyexpat_state *state = PyType_GetModuleState(cls);
     enum XML_Error rc;
 
     rc = XML_UseForeignDTD(self->itself, flag ? XML_TRUE : XML_FALSE);
     if (rc != XML_ERROR_NONE) {
-        return set_error(self, rc);
+        return set_error(state, self, rc);
     }
     Py_RETURN_NONE;
 }
@@ -1104,12 +1129,13 @@
 
 
 static PyObject *
-newxmlparseobject(const char *encoding, const char *namespace_separator, PyObject *intern)
+newxmlparseobject(pyexpat_state *state, const char *encoding,
+                  const char *namespace_separator, PyObject *intern)
 {
     int i;
     xmlparseobject *self;
 
-    self = PyObject_GC_New(xmlparseobject, &Xmlparsetype);
+    self = PyObject_GC_New(xmlparseobject, state->xml_parse_type);
     if (self == NULL)
         return NULL;
 
@@ -1156,19 +1182,34 @@
     return (PyObject*)self;
 }
 
+static int
+xmlparse_traverse(xmlparseobject *op, visitproc visit, void *arg)
+{
+    for (int i = 0; handler_info[i].name != NULL; i++) {
+        Py_VISIT(op->handlers[i]);
+    }
+    Py_VISIT(Py_TYPE(op));
+    return 0;
+}
+
+static int
+xmlparse_clear(xmlparseobject *op)
+{
+    clear_handlers(op, 0);
+    Py_CLEAR(op->intern);
+    return 0;
+}
 
 static void
 xmlparse_dealloc(xmlparseobject *self)
 {
-    int i;
     PyObject_GC_UnTrack(self);
+    (void)xmlparse_clear(self);
     if (self->itself != NULL)
         XML_ParserFree(self->itself);
     self->itself = NULL;
 
     if (self->handlers != NULL) {
-        for (i = 0; handler_info[i].name != NULL; i++)
-            Py_CLEAR(self->handlers[i]);
         PyMem_Free(self->handlers);
         self->handlers = NULL;
     }
@@ -1176,8 +1217,9 @@
         PyMem_Free(self->buffer);
         self->buffer = NULL;
     }
-    Py_XDECREF(self->intern);
+    PyTypeObject *tp = Py_TYPE(self);
     PyObject_GC_Del(self);
+    Py_DECREF(tp);
 }
 
 
@@ -1445,57 +1487,25 @@
 #undef XMLPARSE_GETTER_DEF
 #undef XMLPARSE_GETTER_SETTER_DEF
 
-static int
-xmlparse_traverse(xmlparseobject *op, visitproc visit, void *arg)
-{
-    int i;
-    for (i = 0; handler_info[i].name != NULL; i++)
-        Py_VISIT(op->handlers[i]);
-    return 0;
-}
-
-static int
-xmlparse_clear(xmlparseobject *op)
-{
-    clear_handlers(op, 0);
-    Py_CLEAR(op->intern);
-    return 0;
-}
-
 PyDoc_STRVAR(Xmlparsetype__doc__, "XML parser");
 
-static PyTypeObject Xmlparsetype = {
-        PyVarObject_HEAD_INIT(NULL, 0)
-        "pyexpat.xmlparser",            /*tp_name*/
-        sizeof(xmlparseobject),         /*tp_basicsize*/
-        0,                              /*tp_itemsize*/
-        /* methods */
-        (destructor)xmlparse_dealloc,   /*tp_dealloc*/
-        0,                              /*tp_vectorcall_offset*/
-        0,                      /*tp_getattr*/
-        0,  /*tp_setattr*/
-        0,                      /*tp_as_async*/
-        (reprfunc)0,            /*tp_repr*/
-        0,                      /*tp_as_number*/
-        0,              /*tp_as_sequence*/
-        0,              /*tp_as_mapping*/
-        (hashfunc)0,            /*tp_hash*/
-        (ternaryfunc)0,         /*tp_call*/
-        (reprfunc)0,            /*tp_str*/
-        (getattrofunc)0,                /* tp_getattro */
-        (setattrofunc)0,                /* tp_setattro */
-        0,              /* tp_as_buffer */
-        Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
-        Xmlparsetype__doc__, /* tp_doc - Documentation string */
-        (traverseproc)xmlparse_traverse,        /* tp_traverse */
-        (inquiry)xmlparse_clear,                /* tp_clear */
-        0,                              /* tp_richcompare */
-        0,                              /* tp_weaklistoffset */
-        0,                              /* tp_iter */
-        0,                              /* tp_iternext */
-        xmlparse_methods,               /* tp_methods */
-        xmlparse_members,               /* tp_members */
-        xmlparse_getsetlist,            /* tp_getset */
+static PyType_Slot _xml_parse_type_spec_slots[] = {
+    {Py_tp_dealloc, xmlparse_dealloc},
+    {Py_tp_doc, (void *)Xmlparsetype__doc__},
+    {Py_tp_traverse, xmlparse_traverse},
+    {Py_tp_clear, xmlparse_clear},
+    {Py_tp_methods, xmlparse_methods},
+    {Py_tp_members, xmlparse_members},
+    {Py_tp_getset, xmlparse_getsetlist},
+    {0, 0}
+};
+
+static PyType_Spec _xml_parse_type_spec = {
+    .name = "pyexpat.xmlparser",
+    .basicsize = sizeof(xmlparseobject),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
+              Py_TPFLAGS_DISALLOW_INSTANTIATION | Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = _xml_parse_type_spec_slots,
 };
 
 /* End of code for xmlparser objects */
@@ -1541,7 +1551,8 @@
         return NULL;
     }
 
-    result = newxmlparseobject(encoding, namespace_separator, intern);
+    pyexpat_state *state = pyexpat_get_state(module);
+    result = newxmlparseobject(state, encoding, namespace_separator, intern);
     if (intern_decref) {
         Py_DECREF(intern);
     }
@@ -1583,26 +1594,10 @@
 #define MODULE_NAME "pyexpat"
 #endif
 
-#ifndef MODULE_INITFUNC
-#define MODULE_INITFUNC PyInit_pyexpat
-#endif
-
-static struct PyModuleDef pyexpatmodule = {
-        PyModuleDef_HEAD_INIT,
-        MODULE_NAME,
-        pyexpat_module_documentation,
-        -1,
-        pyexpat_methods,
-        NULL,
-        NULL,
-        NULL,
-        NULL
-};
-
-static int init_handler_descrs(void)
+static int init_handler_descrs(pyexpat_state *state)
 {
     int i;
-    assert(!PyType_HasFeature(&Xmlparsetype, Py_TPFLAGS_VALID_VERSION_TAG));
+    assert(!PyType_HasFeature(state->xml_parse_type, Py_TPFLAGS_VALID_VERSION_TAG));
     for (i = 0; handler_info[i].name != NULL; i++) {
         struct HandlerInfo *hi = &handler_info[i];
         hi->getset.name = hi->name;
@@ -1610,19 +1605,11 @@
         hi->getset.set = (setter)xmlparse_handler_setter;
         hi->getset.closure = &handler_info[i];
 
-        PyObject *descr = PyDescr_NewGetSet(&Xmlparsetype, &hi->getset);
+        PyObject *descr = PyDescr_NewGetSet(state->xml_parse_type, &hi->getset);
         if (descr == NULL)
             return -1;
 
-        if (PyDict_GetItemWithError(Xmlparsetype.tp_dict, PyDescr_NAME(descr))) {
-            Py_DECREF(descr);
-            continue;
-        }
-        else if (PyErr_Occurred()) {
-            Py_DECREF(descr);
-            return -1;
-        }
-        if (PyDict_SetItem(Xmlparsetype.tp_dict, PyDescr_NAME(descr), descr) < 0) {
+        if (PyDict_SetDefault(state->xml_parse_type->tp_dict, PyDescr_NAME(descr), descr) == NULL) {
             Py_DECREF(descr);
             return -1;
         }
@@ -1631,210 +1618,182 @@
     return 0;
 }
 
-PyMODINIT_FUNC
-MODULE_INITFUNC(void)
+static PyObject *
+add_submodule(PyObject *mod, const char *fullname)
 {
-    PyObject *m, *d;
-    PyObject *errmod_name = PyUnicode_FromString(MODULE_NAME ".errors");
-    PyObject *errors_module;
-    PyObject *modelmod_name;
-    PyObject *model_module;
-    PyObject *tmpnum, *tmpstr;
-    PyObject *codes_dict;
-    PyObject *rev_codes_dict;
-    int res;
-    static struct PyExpat_CAPI capi;
-    PyObject *capi_object;
+    const char *name = strrchr(fullname, '.') + 1;
 
-    if (errmod_name == NULL)
-        return NULL;
-    modelmod_name = PyUnicode_FromString(MODULE_NAME ".model");
-    if (modelmod_name == NULL)
-        return NULL;
-
-    if (PyType_Ready(&Xmlparsetype) < 0 || init_handler_descrs() < 0)
-        return NULL;
-
-    /* Create the module and add the functions */
-    m = PyModule_Create(&pyexpatmodule);
-    if (m == NULL)
-        return NULL;
-
-    /* Add some symbolic constants to the module */
-    if (ErrorObject == NULL) {
-        ErrorObject = PyErr_NewException("xml.parsers.expat.ExpatError",
-                                         NULL, NULL);
-        if (ErrorObject == NULL)
-            return NULL;
-    }
-    Py_INCREF(ErrorObject);
-    PyModule_AddObject(m, "error", ErrorObject);
-    Py_INCREF(ErrorObject);
-    PyModule_AddObject(m, "ExpatError", ErrorObject);
-    Py_INCREF(&Xmlparsetype);
-    PyModule_AddObject(m, "XMLParserType", (PyObject *) &Xmlparsetype);
-
-    PyModule_AddStringConstant(m, "EXPAT_VERSION",
-                               XML_ExpatVersion());
-    {
-        XML_Expat_Version info = XML_ExpatVersionInfo();
-        PyModule_AddObject(m, "version_info",
-                           Py_BuildValue("(iii)", info.major,
-                                         info.minor, info.micro));
-    }
-    /* XXX When Expat supports some way of figuring out how it was
-       compiled, this should check and set native_encoding
-       appropriately.
-    */
-    PyModule_AddStringConstant(m, "native_encoding", "UTF-8");
-
-    d = PyModule_GetDict(m);
-    if (d == NULL) {
-        Py_DECREF(m);
-        return NULL;
-    }
-    errors_module = PyDict_GetItemWithError(d, errmod_name);
-    if (errors_module == NULL && !PyErr_Occurred()) {
-        errors_module = PyModule_New(MODULE_NAME ".errors");
-        if (errors_module != NULL) {
-            _PyImport_SetModule(errmod_name, errors_module);
-            /* gives away the reference to errors_module */
-            PyModule_AddObject(m, "errors", errors_module);
-        }
-    }
-    Py_DECREF(errmod_name);
-    model_module = PyDict_GetItemWithError(d, modelmod_name);
-    if (model_module == NULL && !PyErr_Occurred()) {
-        model_module = PyModule_New(MODULE_NAME ".model");
-        if (model_module != NULL) {
-            _PyImport_SetModule(modelmod_name, model_module);
-            /* gives away the reference to model_module */
-            PyModule_AddObject(m, "model", model_module);
-        }
-    }
-    Py_DECREF(modelmod_name);
-    if (errors_module == NULL || model_module == NULL) {
-        /* Don't core dump later! */
-        Py_DECREF(m);
+    PyObject *submodule = PyModule_New(fullname);
+    if (submodule == NULL) {
         return NULL;
     }
 
-#if XML_COMBINED_VERSION > 19505
-    {
-        const XML_Feature *features = XML_GetFeatureList();
-        PyObject *list = PyList_New(0);
-        if (list == NULL)
-            /* just ignore it */
-            PyErr_Clear();
-        else {
-            int i = 0;
-            for (; features[i].feature != XML_FEATURE_END; ++i) {
-                int ok;
-                PyObject *item = Py_BuildValue("si", features[i].name,
-                                               features[i].value);
-                if (item == NULL) {
-                    Py_DECREF(list);
-                    list = NULL;
-                    break;
-                }
-                ok = PyList_Append(list, item);
-                Py_DECREF(item);
-                if (ok < 0) {
-                    PyErr_Clear();
-                    break;
-                }
-            }
-            if (list != NULL)
-                PyModule_AddObject(m, "features", list);
-        }
+    PyObject *mod_name = PyUnicode_FromString(fullname);
+    if (mod_name == NULL) {
+        Py_DECREF(submodule);
+        return NULL;
     }
-#endif
 
-    codes_dict = PyDict_New();
-    rev_codes_dict = PyDict_New();
+    if (_PyImport_SetModule(mod_name, submodule) < 0) {
+        Py_DECREF(submodule);
+        Py_DECREF(mod_name);
+        return NULL;
+    }
+    Py_DECREF(mod_name);
+
+    /* gives away the reference to the submodule */
+    if (PyModule_AddObject(mod, name, submodule) < 0) {
+        Py_DECREF(submodule);
+        return NULL;
+    }
+
+    return submodule;
+}
+
+static int
+add_error(PyObject *errors_module, PyObject *codes_dict,
+          PyObject *rev_codes_dict, const char *name, int value)
+{
+    const char *error_string = XML_ErrorString(value);
+    if (PyModule_AddStringConstant(errors_module, name, error_string) < 0) {
+        return -1;
+    }
+
+    PyObject *num = PyLong_FromLong(value);
+    if (num == NULL) {
+        return -1;
+    }
+
+    if (PyDict_SetItemString(codes_dict, error_string, num) < 0) {
+        Py_DECREF(num);
+        return -1;
+    }
+
+    PyObject *str = PyUnicode_FromString(error_string);
+    if (str == NULL) {
+        Py_DECREF(num);
+        return -1;
+    }
+
+    int res = PyDict_SetItem(rev_codes_dict, num, str);
+    Py_DECREF(str);
+    Py_DECREF(num);
+    if (res < 0) {
+        return -1;
+    }
+
+    return 0;
+}
+
+static int
+add_errors_module(PyObject *mod)
+{
+    PyObject *errors_module = add_submodule(mod, MODULE_NAME ".errors");
+    if (errors_module == NULL) {
+        return -1;
+    }
+
+    PyObject *codes_dict = PyDict_New();
+    PyObject *rev_codes_dict = PyDict_New();
     if (codes_dict == NULL || rev_codes_dict == NULL) {
-        Py_XDECREF(codes_dict);
-        Py_XDECREF(rev_codes_dict);
-        return NULL;
+        goto error;
     }
 
-#define MYCONST(name) \
-    if (PyModule_AddStringConstant(errors_module, #name,               \
-                                   XML_ErrorString(name)) < 0)         \
-        return NULL;                                                   \
-    tmpnum = PyLong_FromLong(name);                                    \
-    if (tmpnum == NULL) return NULL;                                   \
-    res = PyDict_SetItemString(codes_dict,                             \
-                               XML_ErrorString(name), tmpnum);         \
-    if (res < 0) return NULL;                                          \
-    tmpstr = PyUnicode_FromString(XML_ErrorString(name));              \
-    if (tmpstr == NULL) return NULL;                                   \
-    res = PyDict_SetItem(rev_codes_dict, tmpnum, tmpstr);              \
-    Py_DECREF(tmpstr);                                                 \
-    Py_DECREF(tmpnum);                                                 \
-    if (res < 0) return NULL;                                          \
+#define ADD_CONST(name) do {                                        \
+        if (add_error(errors_module, codes_dict, rev_codes_dict,    \
+                      #name, name) < 0) {                           \
+            goto error;                                             \
+        }                                                           \
+    } while(0)
 
-    MYCONST(XML_ERROR_NO_MEMORY);
-    MYCONST(XML_ERROR_SYNTAX);
-    MYCONST(XML_ERROR_NO_ELEMENTS);
-    MYCONST(XML_ERROR_INVALID_TOKEN);
-    MYCONST(XML_ERROR_UNCLOSED_TOKEN);
-    MYCONST(XML_ERROR_PARTIAL_CHAR);
-    MYCONST(XML_ERROR_TAG_MISMATCH);
-    MYCONST(XML_ERROR_DUPLICATE_ATTRIBUTE);
-    MYCONST(XML_ERROR_JUNK_AFTER_DOC_ELEMENT);
-    MYCONST(XML_ERROR_PARAM_ENTITY_REF);
-    MYCONST(XML_ERROR_UNDEFINED_ENTITY);
-    MYCONST(XML_ERROR_RECURSIVE_ENTITY_REF);
-    MYCONST(XML_ERROR_ASYNC_ENTITY);
-    MYCONST(XML_ERROR_BAD_CHAR_REF);
-    MYCONST(XML_ERROR_BINARY_ENTITY_REF);
-    MYCONST(XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF);
-    MYCONST(XML_ERROR_MISPLACED_XML_PI);
-    MYCONST(XML_ERROR_UNKNOWN_ENCODING);
-    MYCONST(XML_ERROR_INCORRECT_ENCODING);
-    MYCONST(XML_ERROR_UNCLOSED_CDATA_SECTION);
-    MYCONST(XML_ERROR_EXTERNAL_ENTITY_HANDLING);
-    MYCONST(XML_ERROR_NOT_STANDALONE);
-    MYCONST(XML_ERROR_UNEXPECTED_STATE);
-    MYCONST(XML_ERROR_ENTITY_DECLARED_IN_PE);
-    MYCONST(XML_ERROR_FEATURE_REQUIRES_XML_DTD);
-    MYCONST(XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING);
+    ADD_CONST(XML_ERROR_NO_MEMORY);
+    ADD_CONST(XML_ERROR_SYNTAX);
+    ADD_CONST(XML_ERROR_NO_ELEMENTS);
+    ADD_CONST(XML_ERROR_INVALID_TOKEN);
+    ADD_CONST(XML_ERROR_UNCLOSED_TOKEN);
+    ADD_CONST(XML_ERROR_PARTIAL_CHAR);
+    ADD_CONST(XML_ERROR_TAG_MISMATCH);
+    ADD_CONST(XML_ERROR_DUPLICATE_ATTRIBUTE);
+    ADD_CONST(XML_ERROR_JUNK_AFTER_DOC_ELEMENT);
+    ADD_CONST(XML_ERROR_PARAM_ENTITY_REF);
+    ADD_CONST(XML_ERROR_UNDEFINED_ENTITY);
+    ADD_CONST(XML_ERROR_RECURSIVE_ENTITY_REF);
+    ADD_CONST(XML_ERROR_ASYNC_ENTITY);
+    ADD_CONST(XML_ERROR_BAD_CHAR_REF);
+    ADD_CONST(XML_ERROR_BINARY_ENTITY_REF);
+    ADD_CONST(XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF);
+    ADD_CONST(XML_ERROR_MISPLACED_XML_PI);
+    ADD_CONST(XML_ERROR_UNKNOWN_ENCODING);
+    ADD_CONST(XML_ERROR_INCORRECT_ENCODING);
+    ADD_CONST(XML_ERROR_UNCLOSED_CDATA_SECTION);
+    ADD_CONST(XML_ERROR_EXTERNAL_ENTITY_HANDLING);
+    ADD_CONST(XML_ERROR_NOT_STANDALONE);
+    ADD_CONST(XML_ERROR_UNEXPECTED_STATE);
+    ADD_CONST(XML_ERROR_ENTITY_DECLARED_IN_PE);
+    ADD_CONST(XML_ERROR_FEATURE_REQUIRES_XML_DTD);
+    ADD_CONST(XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING);
     /* Added in Expat 1.95.7. */
-    MYCONST(XML_ERROR_UNBOUND_PREFIX);
+    ADD_CONST(XML_ERROR_UNBOUND_PREFIX);
     /* Added in Expat 1.95.8. */
-    MYCONST(XML_ERROR_UNDECLARING_PREFIX);
-    MYCONST(XML_ERROR_INCOMPLETE_PE);
-    MYCONST(XML_ERROR_XML_DECL);
-    MYCONST(XML_ERROR_TEXT_DECL);
-    MYCONST(XML_ERROR_PUBLICID);
-    MYCONST(XML_ERROR_SUSPENDED);
-    MYCONST(XML_ERROR_NOT_SUSPENDED);
-    MYCONST(XML_ERROR_ABORTED);
-    MYCONST(XML_ERROR_FINISHED);
-    MYCONST(XML_ERROR_SUSPEND_PE);
+    ADD_CONST(XML_ERROR_UNDECLARING_PREFIX);
+    ADD_CONST(XML_ERROR_INCOMPLETE_PE);
+    ADD_CONST(XML_ERROR_XML_DECL);
+    ADD_CONST(XML_ERROR_TEXT_DECL);
+    ADD_CONST(XML_ERROR_PUBLICID);
+    ADD_CONST(XML_ERROR_SUSPENDED);
+    ADD_CONST(XML_ERROR_NOT_SUSPENDED);
+    ADD_CONST(XML_ERROR_ABORTED);
+    ADD_CONST(XML_ERROR_FINISHED);
+    ADD_CONST(XML_ERROR_SUSPEND_PE);
+#undef ADD_CONST
 
     if (PyModule_AddStringConstant(errors_module, "__doc__",
                                    "Constants used to describe "
-                                   "error conditions.") < 0)
-        return NULL;
+                                   "error conditions.") < 0) {
+        goto error;
+    }
 
-    if (PyModule_AddObject(errors_module, "codes", codes_dict) < 0)
-        return NULL;
-    if (PyModule_AddObject(errors_module, "messages", rev_codes_dict) < 0)
-        return NULL;
+    Py_INCREF(codes_dict);
+    if (PyModule_AddObject(errors_module, "codes", codes_dict) < 0) {
+        Py_DECREF(codes_dict);
+        goto error;
+    }
+    Py_CLEAR(codes_dict);
 
-#undef MYCONST
+    Py_INCREF(rev_codes_dict);
+    if (PyModule_AddObject(errors_module, "messages", rev_codes_dict) < 0) {
+        Py_DECREF(rev_codes_dict);
+        goto error;
+    }
+    Py_CLEAR(rev_codes_dict);
 
-#define MYCONST(c) PyModule_AddIntConstant(m, #c, c)
-    MYCONST(XML_PARAM_ENTITY_PARSING_NEVER);
-    MYCONST(XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE);
-    MYCONST(XML_PARAM_ENTITY_PARSING_ALWAYS);
-#undef MYCONST
+    return 0;
 
-#define MYCONST(c) PyModule_AddIntConstant(model_module, #c, c)
-    PyModule_AddStringConstant(model_module, "__doc__",
-                     "Constants used to interpret content model information.");
+error:
+    Py_XDECREF(codes_dict);
+    Py_XDECREF(rev_codes_dict);
+    return -1;
+}
+
+static int
+add_model_module(PyObject *mod)
+{
+    PyObject *model_module = add_submodule(mod, MODULE_NAME ".model");
+    if (model_module == NULL) {
+        return -1;
+    }
+
+#define MYCONST(c)  do {                                        \
+        if (PyModule_AddIntConstant(model_module, #c, c) < 0) { \
+            return -1;                                          \
+        }                                                       \
+    } while(0)
+
+    if (PyModule_AddStringConstant(
+        model_module, "__doc__",
+        "Constants used to interpret content model information.") < 0) {
+        return -1;
+    }
 
     MYCONST(XML_CTYPE_EMPTY);
     MYCONST(XML_CTYPE_ANY);
@@ -1848,42 +1807,228 @@
     MYCONST(XML_CQUANT_REP);
     MYCONST(XML_CQUANT_PLUS);
 #undef MYCONST
+    return 0;
+}
 
+#if XML_COMBINED_VERSION > 19505
+static int
+add_features(PyObject *mod)
+{
+    PyObject *list = PyList_New(0);
+    if (list == NULL) {
+        return -1;
+    }
+
+    const XML_Feature *features = XML_GetFeatureList();
+    for (size_t i = 0; features[i].feature != XML_FEATURE_END; ++i) {
+        PyObject *item = Py_BuildValue("si", features[i].name,
+                                       features[i].value);
+        if (item == NULL) {
+            goto error;
+        }
+        int ok = PyList_Append(list, item);
+        Py_DECREF(item);
+        if (ok < 0) {
+            goto error;
+        }
+    }
+    if (PyModule_AddObject(mod, "features", list) < 0) {
+        goto error;
+    }
+    return 0;
+
+error:
+    Py_DECREF(list);
+    return -1;
+}
+#endif
+
+static void
+pyexpat_destructor(PyObject *op)
+{
+    void *p = PyCapsule_GetPointer(op, PyExpat_CAPSULE_NAME);
+    PyMem_Free(p);
+}
+
+static int
+pyexpat_exec(PyObject *mod)
+{
+    pyexpat_state *state = pyexpat_get_state(mod);
+    state->xml_parse_type = (PyTypeObject *)PyType_FromModuleAndSpec(
+        mod, &_xml_parse_type_spec, NULL);
+
+    if (state->xml_parse_type == NULL) {
+        return -1;
+    }
+
+    if (init_handler_descrs(state) < 0) {
+        return -1;
+    }
+    state->error = PyErr_NewException("xml.parsers.expat.ExpatError",
+                                      NULL, NULL);
+    if (state->error == NULL) {
+        return -1;
+    }
+
+    /* Add some symbolic constants to the module */
+
+    if (PyModule_AddObjectRef(mod, "error", state->error) < 0) {
+        return -1;
+    }
+
+    if (PyModule_AddObjectRef(mod, "ExpatError", state->error) < 0) {
+        return -1;
+    }
+
+    if (PyModule_AddObjectRef(mod, "XMLParserType",
+                           (PyObject *) state->xml_parse_type) < 0) {
+        return -1;
+    }
+
+    if (PyModule_AddStringConstant(mod, "EXPAT_VERSION",
+                                   XML_ExpatVersion()) < 0) {
+        return -1;
+    }
+    {
+        XML_Expat_Version info = XML_ExpatVersionInfo();
+        PyObject *versionInfo = Py_BuildValue("(iii)",
+                                              info.major,
+                                              info.minor,
+                                              info.micro);
+        if (PyModule_AddObject(mod, "version_info", versionInfo) < 0) {
+            Py_DECREF(versionInfo);
+            return -1;
+        }
+    }
+    /* XXX When Expat supports some way of figuring out how it was
+       compiled, this should check and set native_encoding
+       appropriately.
+    */
+    if (PyModule_AddStringConstant(mod, "native_encoding", "UTF-8") < 0) {
+        return -1;
+    }
+
+    if (add_errors_module(mod) < 0) {
+        return -1;
+    }
+
+    if (add_model_module(mod) < 0) {
+        return -1;
+    }
+
+#if XML_COMBINED_VERSION > 19505
+    if (add_features(mod) < 0) {
+        return -1;
+    }
+#endif
+
+#define MYCONST(c) do {                                 \
+        if (PyModule_AddIntConstant(mod, #c, c) < 0) {  \
+            return -1;                                  \
+        }                                               \
+    } while(0)
+
+    MYCONST(XML_PARAM_ENTITY_PARSING_NEVER);
+    MYCONST(XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE);
+    MYCONST(XML_PARAM_ENTITY_PARSING_ALWAYS);
+#undef MYCONST
+
+    struct PyExpat_CAPI *capi = PyMem_Calloc(1, sizeof(struct PyExpat_CAPI));
+    if (capi == NULL) {
+        PyErr_NoMemory();
+        return -1;
+    }
     /* initialize pyexpat dispatch table */
-    capi.size = sizeof(capi);
-    capi.magic = PyExpat_CAPI_MAGIC;
-    capi.MAJOR_VERSION = XML_MAJOR_VERSION;
-    capi.MINOR_VERSION = XML_MINOR_VERSION;
-    capi.MICRO_VERSION = XML_MICRO_VERSION;
-    capi.ErrorString = XML_ErrorString;
-    capi.GetErrorCode = XML_GetErrorCode;
-    capi.GetErrorColumnNumber = XML_GetErrorColumnNumber;
-    capi.GetErrorLineNumber = XML_GetErrorLineNumber;
-    capi.Parse = XML_Parse;
-    capi.ParserCreate_MM = XML_ParserCreate_MM;
-    capi.ParserFree = XML_ParserFree;
-    capi.SetCharacterDataHandler = XML_SetCharacterDataHandler;
-    capi.SetCommentHandler = XML_SetCommentHandler;
-    capi.SetDefaultHandlerExpand = XML_SetDefaultHandlerExpand;
-    capi.SetElementHandler = XML_SetElementHandler;
-    capi.SetNamespaceDeclHandler = XML_SetNamespaceDeclHandler;
-    capi.SetProcessingInstructionHandler = XML_SetProcessingInstructionHandler;
-    capi.SetUnknownEncodingHandler = XML_SetUnknownEncodingHandler;
-    capi.SetUserData = XML_SetUserData;
-    capi.SetStartDoctypeDeclHandler = XML_SetStartDoctypeDeclHandler;
-    capi.SetEncoding = XML_SetEncoding;
-    capi.DefaultUnknownEncodingHandler = PyUnknownEncodingHandler;
+    capi->size = sizeof(*capi);
+    capi->magic = PyExpat_CAPI_MAGIC;
+    capi->MAJOR_VERSION = XML_MAJOR_VERSION;
+    capi->MINOR_VERSION = XML_MINOR_VERSION;
+    capi->MICRO_VERSION = XML_MICRO_VERSION;
+    capi->ErrorString = XML_ErrorString;
+    capi->GetErrorCode = XML_GetErrorCode;
+    capi->GetErrorColumnNumber = XML_GetErrorColumnNumber;
+    capi->GetErrorLineNumber = XML_GetErrorLineNumber;
+    capi->Parse = XML_Parse;
+    capi->ParserCreate_MM = XML_ParserCreate_MM;
+    capi->ParserFree = XML_ParserFree;
+    capi->SetCharacterDataHandler = XML_SetCharacterDataHandler;
+    capi->SetCommentHandler = XML_SetCommentHandler;
+    capi->SetDefaultHandlerExpand = XML_SetDefaultHandlerExpand;
+    capi->SetElementHandler = XML_SetElementHandler;
+    capi->SetNamespaceDeclHandler = XML_SetNamespaceDeclHandler;
+    capi->SetProcessingInstructionHandler = XML_SetProcessingInstructionHandler;
+    capi->SetUnknownEncodingHandler = XML_SetUnknownEncodingHandler;
+    capi->SetUserData = XML_SetUserData;
+    capi->SetStartDoctypeDeclHandler = XML_SetStartDoctypeDeclHandler;
+    capi->SetEncoding = XML_SetEncoding;
+    capi->DefaultUnknownEncodingHandler = PyUnknownEncodingHandler;
 #if XML_COMBINED_VERSION >= 20100
-    capi.SetHashSalt = XML_SetHashSalt;
+    capi->SetHashSalt = XML_SetHashSalt;
 #else
-    capi.SetHashSalt = NULL;
+    capi->SetHashSalt = NULL;
 #endif
 
     /* export using capsule */
-    capi_object = PyCapsule_New(&capi, PyExpat_CAPSULE_NAME, NULL);
-    if (capi_object)
-        PyModule_AddObject(m, "expat_CAPI", capi_object);
-    return m;
+    PyObject *capi_object = PyCapsule_New(capi, PyExpat_CAPSULE_NAME,
+                                          pyexpat_destructor);
+    if (capi_object == NULL) {
+        PyMem_Free(capi);
+        return -1;
+    }
+
+    if (PyModule_AddObject(mod, "expat_CAPI", capi_object) < 0) {
+        Py_DECREF(capi_object);
+        return -1;
+    }
+
+    return 0;
+}
+
+static int
+pyexpat_traverse(PyObject *module, visitproc visit, void *arg)
+{
+    pyexpat_state *state = pyexpat_get_state(module);
+    Py_VISIT(state->xml_parse_type);
+    Py_VISIT(state->error);
+    return 0;
+}
+
+static int
+pyexpat_clear(PyObject *module)
+{
+    pyexpat_state *state = pyexpat_get_state(module);
+    Py_CLEAR(state->xml_parse_type);
+    Py_CLEAR(state->error);
+    return 0;
+}
+
+static void
+pyexpat_free(void *module)
+{
+    pyexpat_clear((PyObject *)module);
+}
+
+static PyModuleDef_Slot pyexpat_slots[] = {
+    {Py_mod_exec, pyexpat_exec},
+    {0, NULL}
+};
+
+static struct PyModuleDef pyexpatmodule = {
+    PyModuleDef_HEAD_INIT,
+    .m_name = MODULE_NAME,
+    .m_doc = pyexpat_module_documentation,
+    .m_size = sizeof(pyexpat_state),
+    .m_methods = pyexpat_methods,
+    .m_slots = pyexpat_slots,
+    .m_traverse = pyexpat_traverse,
+    .m_clear = pyexpat_clear,
+    .m_free = pyexpat_free
+};
+
+PyMODINIT_FUNC
+PyInit_pyexpat(void)
+{
+    return PyModuleDef_Init(&pyexpatmodule);
 }
 
 static void
diff --git a/Modules/readline.c b/Modules/readline.c
index 12d6cc7..c79d22f 100644
--- a/Modules/readline.c
+++ b/Modules/readline.c
@@ -26,10 +26,14 @@
 #  define RESTORE_LOCALE(sl)
 #endif
 
+#ifdef WITH_EDITLINE
+#  include <editline/readline.h>
+#else
 /* GNU readline definitions */
-#undef HAVE_CONFIG_H /* Else readline/chardefs.h includes strings.h */
-#include <readline/readline.h>
-#include <readline/history.h>
+#  undef HAVE_CONFIG_H /* Else readline/chardefs.h includes strings.h */
+#  include <readline/readline.h>
+#  include <readline/history.h>
+#endif
 
 #ifdef HAVE_RL_COMPLETION_MATCHES
 #define completion_matches(x, y) \
@@ -51,7 +55,7 @@
  *
  * This emulation library is not 100% API compatible with the "real" readline
  * and cannot be detected at compile-time,
- * hence we use a runtime check to detect if the Python readlinke module is
+ * hence we use a runtime check to detect if the Python readline module is
  * linked to libedit.
  *
  * Currently there is one known API incompatibility:
@@ -63,7 +67,8 @@
 static int using_libedit_emulation = 0;
 static const char libedit_version_tag[] = "EditLine wrapper";
 
-static int libedit_history_start = 0;
+static int8_t libedit_history_start = 0;
+static int8_t libedit_append_replace_history_offset = 0;
 
 #ifdef HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK
 static void
@@ -94,6 +99,11 @@
     return (readlinestate *)state;
 }
 
+/*[clinic input]
+module readline
+[clinic start generated code]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=ad49da781b9c8721]*/
+
 static int
 readline_clear(PyObject *m)
 {
@@ -146,10 +156,40 @@
 }
 
 
+/*
+Explicitly disable bracketed paste in the interactive interpreter, even if it's
+set in the inputrc, is enabled by default (eg GNU Readline 8.1), or a user calls
+readline.read_init_file(). The Python REPL has not implemented bracketed
+paste support. Also, bracketed mode writes the "\x1b[?2004h" escape sequence
+into stdout which causes test failures in applications that don't support it.
+It can still be explicitly enabled by calling readline.parse_and_bind("set
+enable-bracketed-paste on"). See bpo-42819 for more details.
+
+This should be removed if bracketed paste mode is implemented (bpo-39820).
+*/
+
+static void
+disable_bracketed_paste(void)
+{
+    if (!using_libedit_emulation) {
+        rl_variable_bind ("enable-bracketed-paste", "off");
+    }
+}
+
 /* Exported function to send one line to readline's init file parser */
 
+/*[clinic input]
+readline.parse_and_bind
+
+    string: object
+    /
+
+Execute the init line provided in the string argument.
+[clinic start generated code]*/
+
 static PyObject *
-parse_and_bind(PyObject *self, PyObject *string)
+readline_parse_and_bind(PyObject *module, PyObject *string)
+/*[clinic end generated code: output=1a1ede8afb9546c1 input=8a28a00bb4d61eec]*/
 {
     char *copy;
     PyObject *encoded = encode(string);
@@ -170,49 +210,59 @@
     Py_RETURN_NONE;
 }
 
-PyDoc_STRVAR(doc_parse_and_bind,
-"parse_and_bind(string) -> None\n\
-Execute the init line provided in the string argument.");
-
-
 /* Exported function to parse a readline init file */
 
+/*[clinic input]
+readline.read_init_file
+
+    filename as filename_obj: object = None
+    /
+
+Execute a readline initialization file.
+
+The default filename is the last filename used.
+[clinic start generated code]*/
+
 static PyObject *
-read_init_file(PyObject *self, PyObject *args)
+readline_read_init_file_impl(PyObject *module, PyObject *filename_obj)
+/*[clinic end generated code: output=8e059b676142831e input=4c80c473e448139d]*/
 {
-    PyObject *filename_obj = Py_None, *filename_bytes;
-    if (!PyArg_ParseTuple(args, "|O:read_init_file", &filename_obj))
-        return NULL;
+    PyObject *filename_bytes;
     if (filename_obj != Py_None) {
         if (!PyUnicode_FSConverter(filename_obj, &filename_bytes))
             return NULL;
-        errno = rl_read_init_file(PyBytes_AsString(filename_bytes));
+        errno = rl_read_init_file(PyBytes_AS_STRING(filename_bytes));
         Py_DECREF(filename_bytes);
     } else
         errno = rl_read_init_file(NULL);
     if (errno)
         return PyErr_SetFromErrno(PyExc_OSError);
+    disable_bracketed_paste();
     Py_RETURN_NONE;
 }
 
-PyDoc_STRVAR(doc_read_init_file,
-"read_init_file([filename]) -> None\n\
-Execute a readline initialization file.\n\
-The default filename is the last filename used.");
-
-
 /* Exported function to load a readline history file */
 
+/*[clinic input]
+readline.read_history_file
+
+    filename as filename_obj: object = None
+    /
+
+Load a readline history file.
+
+The default filename is ~/.history.
+[clinic start generated code]*/
+
 static PyObject *
-read_history_file(PyObject *self, PyObject *args)
+readline_read_history_file_impl(PyObject *module, PyObject *filename_obj)
+/*[clinic end generated code: output=66a951836fb54fbb input=3d29d755b7e6932e]*/
 {
-    PyObject *filename_obj = Py_None, *filename_bytes;
-    if (!PyArg_ParseTuple(args, "|O:read_history_file", &filename_obj))
-        return NULL;
+    PyObject *filename_bytes;
     if (filename_obj != Py_None) {
         if (!PyUnicode_FSConverter(filename_obj, &filename_bytes))
             return NULL;
-        errno = read_history(PyBytes_AsString(filename_bytes));
+        errno = read_history(PyBytes_AS_STRING(filename_bytes));
         Py_DECREF(filename_bytes);
     } else
         errno = read_history(NULL);
@@ -222,26 +272,31 @@
 }
 
 static int _history_length = -1; /* do not truncate history by default */
-PyDoc_STRVAR(doc_read_history_file,
-"read_history_file([filename]) -> None\n\
-Load a readline history file.\n\
-The default filename is ~/.history.");
-
 
 /* Exported function to save a readline history file */
 
+/*[clinic input]
+readline.write_history_file
+
+    filename as filename_obj: object = None
+    /
+
+Save a readline history file.
+
+The default filename is ~/.history.
+[clinic start generated code]*/
+
 static PyObject *
-write_history_file(PyObject *self, PyObject *args)
+readline_write_history_file_impl(PyObject *module, PyObject *filename_obj)
+/*[clinic end generated code: output=fbcad13d8ef59ae6 input=28a8e062fe363703]*/
 {
-    PyObject *filename_obj = Py_None, *filename_bytes;
+    PyObject *filename_bytes;
     const char *filename;
     int err;
-    if (!PyArg_ParseTuple(args, "|O:write_history_file", &filename_obj))
-        return NULL;
     if (filename_obj != Py_None) {
         if (!PyUnicode_FSConverter(filename_obj, &filename_bytes))
             return NULL;
-        filename = PyBytes_AsString(filename_bytes);
+        filename = PyBytes_AS_STRING(filename_bytes);
     } else {
         filename_bytes = NULL;
         filename = NULL;
@@ -256,33 +311,39 @@
     Py_RETURN_NONE;
 }
 
-PyDoc_STRVAR(doc_write_history_file,
-"write_history_file([filename]) -> None\n\
-Save a readline history file.\n\
-The default filename is ~/.history.");
-
-
 #ifdef HAVE_RL_APPEND_HISTORY
 /* Exported function to save part of a readline history file */
 
+/*[clinic input]
+readline.append_history_file
+
+    nelements: int
+    filename as filename_obj: object = None
+    /
+
+Append the last nelements items of the history list to file.
+
+The default filename is ~/.history.
+[clinic start generated code]*/
+
 static PyObject *
-append_history_file(PyObject *self, PyObject *args)
+readline_append_history_file_impl(PyObject *module, int nelements,
+                                  PyObject *filename_obj)
+/*[clinic end generated code: output=5df06fc9da56e4e4 input=784b774db3a4b7c5]*/
 {
-    int nelements;
-    PyObject *filename_obj = Py_None, *filename_bytes;
+    PyObject *filename_bytes;
     const char *filename;
     int err;
-    if (!PyArg_ParseTuple(args, "i|O:append_history_file", &nelements, &filename_obj))
-        return NULL;
     if (filename_obj != Py_None) {
         if (!PyUnicode_FSConverter(filename_obj, &filename_bytes))
             return NULL;
-        filename = PyBytes_AsString(filename_bytes);
+        filename = PyBytes_AS_STRING(filename_bytes);
     } else {
         filename_bytes = NULL;
         filename = NULL;
     }
-    errno = err = append_history(nelements, filename);
+    errno = err = append_history(
+        nelements - libedit_append_replace_history_offset, filename);
     if (!err && _history_length >= 0)
         history_truncate_file(filename, _history_length);
     Py_XDECREF(filename_bytes);
@@ -291,57 +352,50 @@
         return PyErr_SetFromErrno(PyExc_OSError);
     Py_RETURN_NONE;
 }
-
-PyDoc_STRVAR(doc_append_history_file,
-"append_history_file(nelements[, filename]) -> None\n\
-Append the last nelements items of the history list to file.\n\
-The default filename is ~/.history.");
 #endif
 
 
 /* Set history length */
 
-static PyObject*
-set_history_length(PyObject *self, PyObject *args)
+/*[clinic input]
+readline.set_history_length
+
+    length: int
+    /
+
+Set the maximal number of lines which will be written to the history file.
+
+A negative length is used to inhibit history truncation.
+[clinic start generated code]*/
+
+static PyObject *
+readline_set_history_length_impl(PyObject *module, int length)
+/*[clinic end generated code: output=e161a53e45987dc7 input=b8901bf16488b760]*/
 {
-    int length = _history_length;
-    if (!PyArg_ParseTuple(args, "i:set_history_length", &length))
-        return NULL;
     _history_length = length;
     Py_RETURN_NONE;
 }
 
-PyDoc_STRVAR(set_history_length_doc,
-"set_history_length(length) -> None\n\
-set the maximal number of lines which will be written to\n\
-the history file. A negative length is used to inhibit\n\
-history truncation.");
-
-
 /* Get history length */
 
-static PyObject*
-get_history_length(PyObject *self, PyObject *noarg)
+/*[clinic input]
+readline.get_history_length
+
+Return the maximum number of lines that will be written to the history file.
+[clinic start generated code]*/
+
+static PyObject *
+readline_get_history_length_impl(PyObject *module)
+/*[clinic end generated code: output=83a2eeae35b6d2b9 input=5dce2eeba4327817]*/
 {
     return PyLong_FromLong(_history_length);
 }
 
-PyDoc_STRVAR(get_history_length_doc,
-"get_history_length() -> int\n\
-return the maximum number of lines that will be written to\n\
-the history file.");
-
-
 /* Generic hook function setter */
 
 static PyObject *
-set_hook(const char *funcname, PyObject **hook_var, PyObject *args)
+set_hook(const char *funcname, PyObject **hook_var, PyObject *function)
 {
-    PyObject *function = Py_None;
-    char buf[80];
-    PyOS_snprintf(buf, sizeof(buf), "|O:set_%.50s", funcname);
-    if (!PyArg_ParseTuple(args, buf, &function))
-        return NULL;
     if (function == Py_None) {
         Py_CLEAR(*hook_var);
     }
@@ -358,12 +412,27 @@
     Py_RETURN_NONE;
 }
 
+/*[clinic input]
+readline.set_completion_display_matches_hook
+
+    function: object = None
+    /
+
+Set or remove the completion display function.
+
+The function is called as
+  function(substitution, [matches], longest_match_length)
+once each time matches need to be displayed.
+[clinic start generated code]*/
 
 static PyObject *
-set_completion_display_matches_hook(PyObject *self, PyObject *args)
+readline_set_completion_display_matches_hook_impl(PyObject *module,
+                                                  PyObject *function)
+/*[clinic end generated code: output=516e5cb8db75a328 input=4f0bfd5ab0179a26]*/
 {
     PyObject *result = set_hook("completion_display_matches_hook",
-                    &readlinestate_global->completion_display_matches_hook, args);
+                    &readlinestate_global->completion_display_matches_hook,
+                    function);
 #ifdef HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK
     /* We cannot set this hook globally, since it replaces the
        default completion display. */
@@ -379,90 +448,114 @@
 
 }
 
-PyDoc_STRVAR(doc_set_completion_display_matches_hook,
-"set_completion_display_matches_hook([function]) -> None\n\
-Set or remove the completion display function.\n\
-The function is called as\n\
-  function(substitution, [matches], longest_match_length)\n\
-once each time matches need to be displayed.");
+/*[clinic input]
+readline.set_startup_hook
+
+    function: object = None
+    /
+
+Set or remove the function invoked by the rl_startup_hook callback.
+
+The function is called with no arguments just
+before readline prints the first prompt.
+[clinic start generated code]*/
 
 static PyObject *
-set_startup_hook(PyObject *self, PyObject *args)
+readline_set_startup_hook_impl(PyObject *module, PyObject *function)
+/*[clinic end generated code: output=02cd0e0c4fa082ad input=7783b4334b26d16d]*/
 {
-    return set_hook("startup_hook", &readlinestate_global->startup_hook, args);
+    return set_hook("startup_hook", &readlinestate_global->startup_hook,
+            function);
 }
 
-PyDoc_STRVAR(doc_set_startup_hook,
-"set_startup_hook([function]) -> None\n\
-Set or remove the function invoked by the rl_startup_hook callback.\n\
-The function is called with no arguments just\n\
-before readline prints the first prompt.");
-
-
 #ifdef HAVE_RL_PRE_INPUT_HOOK
 
 /* Set pre-input hook */
 
+/*[clinic input]
+readline.set_pre_input_hook
+
+    function: object = None
+    /
+
+Set or remove the function invoked by the rl_pre_input_hook callback.
+
+The function is called with no arguments after the first prompt
+has been printed and just before readline starts reading input
+characters.
+[clinic start generated code]*/
+
 static PyObject *
-set_pre_input_hook(PyObject *self, PyObject *args)
+readline_set_pre_input_hook_impl(PyObject *module, PyObject *function)
+/*[clinic end generated code: output=fe1a96505096f464 input=4f3eaeaf7ce1fdbe]*/
 {
-    return set_hook("pre_input_hook", &readlinestate_global->pre_input_hook, args);
+    return set_hook("pre_input_hook", &readlinestate_global->pre_input_hook,
+            function);
 }
-
-PyDoc_STRVAR(doc_set_pre_input_hook,
-"set_pre_input_hook([function]) -> None\n\
-Set or remove the function invoked by the rl_pre_input_hook callback.\n\
-The function is called with no arguments after the first prompt\n\
-has been printed and just before readline starts reading input\n\
-characters.");
-
 #endif
 
 
 /* Get the completion type for the scope of the tab-completion */
+
+/*[clinic input]
+readline.get_completion_type
+
+Get the type of completion being attempted.
+[clinic start generated code]*/
+
 static PyObject *
-get_completion_type(PyObject *self, PyObject *noarg)
+readline_get_completion_type_impl(PyObject *module)
+/*[clinic end generated code: output=5c54d58a04997c07 input=04b92bc7a82dac91]*/
 {
   return PyLong_FromLong(rl_completion_type);
 }
 
-PyDoc_STRVAR(doc_get_completion_type,
-"get_completion_type() -> int\n\
-Get the type of completion being attempted.");
-
-
 /* Get the beginning index for the scope of the tab-completion */
 
+/*[clinic input]
+readline.get_begidx
+
+Get the beginning index of the completion scope.
+[clinic start generated code]*/
+
 static PyObject *
-get_begidx(PyObject *self, PyObject *noarg)
+readline_get_begidx_impl(PyObject *module)
+/*[clinic end generated code: output=362616ee8ed1b2b1 input=e083b81c8eb4bac3]*/
 {
     Py_INCREF(readlinestate_global->begidx);
     return readlinestate_global->begidx;
 }
 
-PyDoc_STRVAR(doc_get_begidx,
-"get_begidx() -> int\n\
-get the beginning index of the completion scope");
-
-
 /* Get the ending index for the scope of the tab-completion */
 
+/*[clinic input]
+readline.get_endidx
+
+Get the ending index of the completion scope.
+[clinic start generated code]*/
+
 static PyObject *
-get_endidx(PyObject *self, PyObject *noarg)
+readline_get_endidx_impl(PyObject *module)
+/*[clinic end generated code: output=7f763350b12d7517 input=d4c7e34a625fd770]*/
 {
     Py_INCREF(readlinestate_global->endidx);
     return readlinestate_global->endidx;
 }
 
-PyDoc_STRVAR(doc_get_endidx,
-"get_endidx() -> int\n\
-get the ending index of the completion scope");
-
-
 /* Set the tab-completion word-delimiters that readline uses */
 
+/*[clinic input]
+readline.set_completer_delims
+
+    string: object
+    /
+
+Set the word delimiters for completion.
+[clinic start generated code]*/
+
 static PyObject *
-set_completer_delims(PyObject *self, PyObject *string)
+readline_set_completer_delims(PyObject *module, PyObject *string)
+/*[clinic end generated code: output=4305b266106c4f1f input=ae945337ebd01e20]*/
 {
     char *break_chars;
     PyObject *encoded = encode(string);
@@ -484,10 +577,6 @@
         return PyErr_NoMemory();
 }
 
-PyDoc_STRVAR(doc_set_completer_delims,
-"set_completer_delims(string) -> None\n\
-set the word delimiters for completion");
-
 /* _py_free_history_entry: Utility function to free a history entry. */
 
 #if defined(RL_READLINE_VERSION) && RL_READLINE_VERSION >= 0x0500
@@ -520,14 +609,21 @@
 
 #endif
 
+/*[clinic input]
+readline.remove_history_item
+
+    pos as entry_number: int
+    /
+
+Remove history item given by its zero-based position.
+[clinic start generated code]*/
+
 static PyObject *
-py_remove_history(PyObject *self, PyObject *args)
+readline_remove_history_item_impl(PyObject *module, int entry_number)
+/*[clinic end generated code: output=ab114f029208c7e8 input=f248beb720ff1838]*/
 {
-    int entry_number;
     HIST_ENTRY *entry;
 
-    if (!PyArg_ParseTuple(args, "i:remove_history_item", &entry_number))
-        return NULL;
     if (entry_number < 0) {
         PyErr_SetString(PyExc_ValueError,
                         "History index cannot be negative");
@@ -545,22 +641,26 @@
     Py_RETURN_NONE;
 }
 
-PyDoc_STRVAR(doc_remove_history,
-"remove_history_item(pos) -> None\n\
-remove history item given by its position");
+/*[clinic input]
+readline.replace_history_item
+
+    pos as entry_number: int
+    line: unicode
+    /
+
+Replaces history item given by its position with contents of line.
+
+pos is zero-based.
+[clinic start generated code]*/
 
 static PyObject *
-py_replace_history(PyObject *self, PyObject *args)
+readline_replace_history_item_impl(PyObject *module, int entry_number,
+                                   PyObject *line)
+/*[clinic end generated code: output=f8cec2770ca125eb input=368bb66fe5ee5222]*/
 {
-    int entry_number;
-    PyObject *line;
     PyObject *encoded;
     HIST_ENTRY *old_entry;
 
-    if (!PyArg_ParseTuple(args, "iU:replace_history_item", &entry_number,
-                          &line)) {
-        return NULL;
-    }
     if (entry_number < 0) {
         PyErr_SetString(PyExc_ValueError,
                         "History index cannot be negative");
@@ -570,7 +670,9 @@
     if (encoded == NULL) {
         return NULL;
     }
-    old_entry = replace_history_entry(entry_number, PyBytes_AS_STRING(encoded), (void *)NULL);
+    old_entry = replace_history_entry(
+        entry_number + libedit_append_replace_history_offset,
+        PyBytes_AS_STRING(encoded), (void *)NULL);
     Py_DECREF(encoded);
     if (!old_entry) {
         PyErr_Format(PyExc_ValueError,
@@ -583,14 +685,20 @@
     Py_RETURN_NONE;
 }
 
-PyDoc_STRVAR(doc_replace_history,
-"replace_history_item(pos, line) -> None\n\
-replaces history item given by its position with contents of line");
-
 /* Add a line to the history buffer */
 
+/*[clinic input]
+readline.add_history
+
+    string: object
+    /
+
+Add an item to the history buffer.
+[clinic start generated code]*/
+
 static PyObject *
-py_add_history(PyObject *self, PyObject *string)
+readline_add_history(PyObject *module, PyObject *string)
+/*[clinic end generated code: output=b107b7e8106e803d input=e57c1cf6bc68d7e3]*/
 {
     PyObject *encoded = encode(string);
     if (encoded == NULL) {
@@ -601,60 +709,75 @@
     Py_RETURN_NONE;
 }
 
-PyDoc_STRVAR(doc_add_history,
-"add_history(string) -> None\n\
-add an item to the history buffer");
-
 static int should_auto_add_history = 1;
 
 /* Enable or disable automatic history */
 
+/*[clinic input]
+readline.set_auto_history
+
+    enabled as _should_auto_add_history: bool
+    /
+
+Enables or disables automatic history.
+[clinic start generated code]*/
+
 static PyObject *
-py_set_auto_history(PyObject *self, PyObject *args)
+readline_set_auto_history_impl(PyObject *module,
+                               int _should_auto_add_history)
+/*[clinic end generated code: output=619c6968246fd82b input=3d413073a1a03355]*/
 {
-    if (!PyArg_ParseTuple(args, "p:set_auto_history",
-                          &should_auto_add_history)) {
-        return NULL;
-    }
+    should_auto_add_history = _should_auto_add_history;
     Py_RETURN_NONE;
 }
 
-PyDoc_STRVAR(doc_set_auto_history,
-"set_auto_history(enabled) -> None\n\
-Enables or disables automatic history.");
-
 
 /* Get the tab-completion word-delimiters that readline uses */
 
+/*[clinic input]
+readline.get_completer_delims
+
+Get the word delimiters for completion.
+[clinic start generated code]*/
+
 static PyObject *
-get_completer_delims(PyObject *self, PyObject *noarg)
+readline_get_completer_delims_impl(PyObject *module)
+/*[clinic end generated code: output=6b060280fa68ef43 input=e36eb14fb8a1f08a]*/
 {
     return decode(rl_completer_word_break_characters);
 }
 
-PyDoc_STRVAR(doc_get_completer_delims,
-"get_completer_delims() -> string\n\
-get the word delimiters for completion");
-
-
 /* Set the completer function */
 
+/*[clinic input]
+readline.set_completer
+
+    function: object = None
+    /
+
+Set or remove the completer function.
+
+The function is called as function(text, state),
+for state in 0, 1, 2, ..., until it returns a non-string.
+It should return the next possible completion starting with 'text'.
+[clinic start generated code]*/
+
 static PyObject *
-set_completer(PyObject *self, PyObject *args)
+readline_set_completer_impl(PyObject *module, PyObject *function)
+/*[clinic end generated code: output=171a2a60f81d3204 input=51e81e13118eb877]*/
 {
-    return set_hook("completer", &readlinestate_global->completer, args);
+    return set_hook("completer", &readlinestate_global->completer, function);
 }
 
-PyDoc_STRVAR(doc_set_completer,
-"set_completer([function]) -> None\n\
-Set or remove the completer function.\n\
-The function is called as function(text, state),\n\
-for state in 0, 1, 2, ..., until it returns a non-string.\n\
-It should return the next possible completion starting with 'text'.");
+/*[clinic input]
+readline.get_completer
 
+Get the current completer function.
+[clinic start generated code]*/
 
 static PyObject *
-get_completer(PyObject *self, PyObject *noargs)
+readline_get_completer_impl(PyObject *module)
+/*[clinic end generated code: output=6e6bbd8226d14475 input=6457522e56d70d13]*/
 {
     if (readlinestate_global->completer == NULL) {
         Py_RETURN_NONE;
@@ -663,11 +786,6 @@
     return readlinestate_global->completer;
 }
 
-PyDoc_STRVAR(doc_get_completer,
-"get_completer() -> function\n\
-\n\
-Returns current completer function.");
-
 /* Private function to get current length of history.  XXX It may be
  * possible to replace this with a direct use of history_length instead,
  * but it's not clear whether BSD's libedit keeps history_length up to date.
@@ -689,14 +807,21 @@
 
 /* Exported function to get any element of history */
 
+/*[clinic input]
+readline.get_history_item
+
+    index as idx: int
+    /
+
+Return the current contents of history item at one-based index.
+[clinic start generated code]*/
+
 static PyObject *
-get_history_item(PyObject *self, PyObject *args)
+readline_get_history_item_impl(PyObject *module, int idx)
+/*[clinic end generated code: output=83d3e53ea5f34b3d input=8adf5c80e6c7ff2b]*/
 {
-    int idx = 0;
     HIST_ENTRY *hist_ent;
 
-    if (!PyArg_ParseTuple(args, "i:get_history_item", &idx))
-        return NULL;
     if (using_libedit_emulation) {
         /* Older versions of libedit's readline emulation
          * use 0-based indexes, while readline and newer
@@ -723,58 +848,70 @@
     }
 }
 
-PyDoc_STRVAR(doc_get_history_item,
-"get_history_item() -> string\n\
-return the current contents of history item at index.");
-
-
 /* Exported function to get current length of history */
 
+/*[clinic input]
+readline.get_current_history_length
+
+Return the current (not the maximum) length of history.
+[clinic start generated code]*/
+
 static PyObject *
-get_current_history_length(PyObject *self, PyObject *noarg)
+readline_get_current_history_length_impl(PyObject *module)
+/*[clinic end generated code: output=436b294f12ba1e3f input=9cb3f431a68d071f]*/
 {
     return PyLong_FromLong((long)_py_get_history_length());
 }
 
-PyDoc_STRVAR(doc_get_current_history_length,
-"get_current_history_length() -> integer\n\
-return the current (not the maximum) length of history.");
-
-
 /* Exported function to read the current line buffer */
 
+/*[clinic input]
+readline.get_line_buffer
+
+Return the current contents of the line buffer.
+[clinic start generated code]*/
+
 static PyObject *
-get_line_buffer(PyObject *self, PyObject *noarg)
+readline_get_line_buffer_impl(PyObject *module)
+/*[clinic end generated code: output=d22f9025ecad80e4 input=5f5fbc0d12c69412]*/
 {
     return decode(rl_line_buffer);
 }
 
-PyDoc_STRVAR(doc_get_line_buffer,
-"get_line_buffer() -> string\n\
-return the current contents of the line buffer.");
-
-
 #ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER
 
 /* Exported function to clear the current history */
 
+/*[clinic input]
+readline.clear_history
+
+Clear the current readline history.
+[clinic start generated code]*/
+
 static PyObject *
-py_clear_history(PyObject *self, PyObject *noarg)
+readline_clear_history_impl(PyObject *module)
+/*[clinic end generated code: output=1f2dbb0dfa5d5ebb input=208962c4393f5d16]*/
 {
     clear_history();
     Py_RETURN_NONE;
 }
-
-PyDoc_STRVAR(doc_clear_history,
-"clear_history() -> None\n\
-Clear the current readline history.");
 #endif
 
 
 /* Exported function to insert text into the line buffer */
 
+/*[clinic input]
+readline.insert_text
+
+    string: object
+    /
+
+Insert text into the line buffer at the cursor position.
+[clinic start generated code]*/
+
 static PyObject *
-insert_text(PyObject *self, PyObject *string)
+readline_insert_text(PyObject *module, PyObject *string)
+/*[clinic end generated code: output=23d792821d320c19 input=bc96c3c848d5ccb5]*/
 {
     PyObject *encoded = encode(string);
     if (encoded == NULL) {
@@ -785,77 +922,60 @@
     Py_RETURN_NONE;
 }
 
-PyDoc_STRVAR(doc_insert_text,
-"insert_text(string) -> None\n\
-Insert text into the line buffer at the cursor position.");
-
-
 /* Redisplay the line buffer */
 
+/*[clinic input]
+readline.redisplay
+
+Change what's displayed on the screen to reflect contents of the line buffer.
+[clinic start generated code]*/
+
 static PyObject *
-redisplay(PyObject *self, PyObject *noarg)
+readline_redisplay_impl(PyObject *module)
+/*[clinic end generated code: output=a8b9725827c3c34b input=b485151058d75edc]*/
 {
     rl_redisplay();
     Py_RETURN_NONE;
 }
 
-PyDoc_STRVAR(doc_redisplay,
-"redisplay() -> None\n\
-Change what's displayed on the screen to reflect the current\n\
-contents of the line buffer.");
-
+#include "clinic/readline.c.h"
 
 /* Table of functions exported by the module */
 
 static struct PyMethodDef readline_methods[] =
 {
-    {"parse_and_bind", parse_and_bind, METH_O, doc_parse_and_bind},
-    {"get_line_buffer", get_line_buffer, METH_NOARGS, doc_get_line_buffer},
-    {"insert_text", insert_text, METH_O, doc_insert_text},
-    {"redisplay", redisplay, METH_NOARGS, doc_redisplay},
-    {"read_init_file", read_init_file, METH_VARARGS, doc_read_init_file},
-    {"read_history_file", read_history_file,
-     METH_VARARGS, doc_read_history_file},
-    {"write_history_file", write_history_file,
-     METH_VARARGS, doc_write_history_file},
+    READLINE_PARSE_AND_BIND_METHODDEF
+    READLINE_GET_LINE_BUFFER_METHODDEF
+    READLINE_INSERT_TEXT_METHODDEF
+    READLINE_REDISPLAY_METHODDEF
+    READLINE_READ_INIT_FILE_METHODDEF
+    READLINE_READ_HISTORY_FILE_METHODDEF
+    READLINE_WRITE_HISTORY_FILE_METHODDEF
 #ifdef HAVE_RL_APPEND_HISTORY
-    {"append_history_file", append_history_file,
-     METH_VARARGS, doc_append_history_file},
+    READLINE_APPEND_HISTORY_FILE_METHODDEF
 #endif
-    {"get_history_item", get_history_item,
-     METH_VARARGS, doc_get_history_item},
-    {"get_current_history_length", (PyCFunction)get_current_history_length,
-     METH_NOARGS, doc_get_current_history_length},
-    {"set_history_length", set_history_length,
-     METH_VARARGS, set_history_length_doc},
-    {"get_history_length", get_history_length,
-     METH_NOARGS, get_history_length_doc},
-    {"set_completer", set_completer, METH_VARARGS, doc_set_completer},
-    {"get_completer", get_completer, METH_NOARGS, doc_get_completer},
-    {"get_completion_type", get_completion_type,
-     METH_NOARGS, doc_get_completion_type},
-    {"get_begidx", get_begidx, METH_NOARGS, doc_get_begidx},
-    {"get_endidx", get_endidx, METH_NOARGS, doc_get_endidx},
-
-    {"set_completer_delims", set_completer_delims,
-     METH_O, doc_set_completer_delims},
-    {"set_auto_history", py_set_auto_history, METH_VARARGS, doc_set_auto_history},
-    {"add_history", py_add_history, METH_O, doc_add_history},
-    {"remove_history_item", py_remove_history, METH_VARARGS, doc_remove_history},
-    {"replace_history_item", py_replace_history, METH_VARARGS, doc_replace_history},
-    {"get_completer_delims", get_completer_delims,
-     METH_NOARGS, doc_get_completer_delims},
-
-    {"set_completion_display_matches_hook", set_completion_display_matches_hook,
-     METH_VARARGS, doc_set_completion_display_matches_hook},
-    {"set_startup_hook", set_startup_hook,
-     METH_VARARGS, doc_set_startup_hook},
+    READLINE_GET_HISTORY_ITEM_METHODDEF
+    READLINE_GET_CURRENT_HISTORY_LENGTH_METHODDEF
+    READLINE_SET_HISTORY_LENGTH_METHODDEF
+    READLINE_GET_HISTORY_LENGTH_METHODDEF
+    READLINE_SET_COMPLETER_METHODDEF
+    READLINE_GET_COMPLETER_METHODDEF
+    READLINE_GET_COMPLETION_TYPE_METHODDEF
+    READLINE_GET_BEGIDX_METHODDEF
+    READLINE_GET_ENDIDX_METHODDEF
+    READLINE_SET_COMPLETER_DELIMS_METHODDEF
+    READLINE_SET_AUTO_HISTORY_METHODDEF
+    READLINE_ADD_HISTORY_METHODDEF
+    READLINE_REMOVE_HISTORY_ITEM_METHODDEF
+    READLINE_REPLACE_HISTORY_ITEM_METHODDEF
+    READLINE_GET_COMPLETER_DELIMS_METHODDEF
+    READLINE_SET_COMPLETION_DISPLAY_MATCHES_HOOK_METHODDEF
+    READLINE_SET_STARTUP_HOOK_METHODDEF
 #ifdef HAVE_RL_PRE_INPUT_HOOK
-    {"set_pre_input_hook", set_pre_input_hook,
-     METH_VARARGS, doc_set_pre_input_hook},
+    READLINE_SET_PRE_INPUT_HOOK_METHODDEF
 #endif
 #ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER
-    {"clear_history", py_clear_history, METH_NOARGS, doc_clear_history},
+    READLINE_CLEAR_HISTORY_METHODDEF
 #endif
     {0, 0}
 };
@@ -1098,6 +1218,22 @@
     } else {
         libedit_history_start = 1;
     }
+    /* Some libedit implementations use 1 based indexing on
+     * replace_history_entry where libreadline uses 0 based.
+     * The API our module presents is supposed to be 0 based.
+     * It's a mad mad mad mad world.
+     */
+    {
+        add_history("2");
+        HIST_ENTRY *old_entry = replace_history_entry(1, "X", NULL);
+        _py_free_history_entry(old_entry);
+        HIST_ENTRY *item = history_get(libedit_history_start);
+        if (item && item->line && strcmp(item->line, "X")) {
+            libedit_append_replace_history_offset = 0;
+        } else {
+            libedit_append_replace_history_offset = 1;
+        }
+    }
     clear_history();
 
     using_history();
@@ -1152,6 +1288,8 @@
     else
         rl_initialize();
 
+    disable_bracketed_paste();
+
     RESTORE_LOCALE(saved_locale)
     return 0;
 }
diff --git a/Modules/resource.c b/Modules/resource.c
index ddbf80b..0d69c29 100644
--- a/Modules/resource.c
+++ b/Modules/resource.c
@@ -63,8 +63,20 @@
     16          /* n_in_sequence */
 };
 
-static int initialized;
-static PyTypeObject StructRUsageType;
+typedef struct {
+  PyTypeObject *StructRUsageType;
+} resourcemodulestate;
+
+
+static inline resourcemodulestate*
+get_resource_state(PyObject *module)
+{
+    void *state = PyModule_GetState(module);
+    assert(state != NULL);
+    return (resourcemodulestate *)state;
+}
+
+static struct PyModuleDef resourcemodule;
 
 /*[clinic input]
 resource.getrusage
@@ -91,7 +103,8 @@
         return NULL;
     }
 
-    result = PyStructSequence_New(&StructRUsageType);
+    result = PyStructSequence_New(
+        get_resource_state(module)->StructRUsageType);
     if (!result)
         return NULL;
 
@@ -313,13 +326,10 @@
     long pagesize = 0;
 #if defined(HAVE_GETPAGESIZE)
     pagesize = getpagesize();
-#elif defined(HAVE_SYSCONF)
-#if defined(_SC_PAGE_SIZE)
+#elif defined(HAVE_SYSCONF) && defined(_SC_PAGE_SIZE)
     pagesize = sysconf(_SC_PAGE_SIZE);
 #else
-    /* Irix 5.3 has _SC_PAGESIZE, but not _SC_PAGE_SIZE */
-    pagesize = sysconf(_SC_PAGESIZE);
-#endif
+#   error "unsupported platform: resource.getpagesize()"
 #endif
     return pagesize;
 }
@@ -339,10 +349,10 @@
 
 /* Module initialization */
 
-
 static int
 resource_exec(PyObject *module)
 {
+    resourcemodulestate *state = get_resource_state(module);
 #define ADD_INT(module, value)                                    \
     do {                                                          \
         if (PyModule_AddIntConstant(module, #value, value) < 0) { \
@@ -356,13 +366,12 @@
         Py_DECREF(PyExc_OSError);
         return -1;
     }
-    if (!initialized) {
-        if (PyStructSequence_InitType2(&StructRUsageType,
-                                       &struct_rusage_desc) < 0)
-            return -1;
-    }
 
-    if(PyModule_AddType(module, &StructRUsageType) < 0) {
+    state->StructRUsageType = PyStructSequence_NewType(&struct_rusage_desc);
+    if (state->StructRUsageType == NULL) {
+        return -1;
+    }
+    if (PyModule_AddType(module, state->StructRUsageType) < 0) {
         return -1;
     }
 
@@ -471,6 +480,10 @@
     ADD_INT(module, RLIMIT_NPTS);
 #endif
 
+#ifdef RLIMIT_KQUEUES
+    ADD_INT(module, RLIMIT_KQUEUES);
+#endif
+
     PyObject *v;
     if (sizeof(RLIM_INFINITY) > sizeof(long)) {
         v = PyLong_FromLongLong((long long) RLIM_INFINITY);
@@ -486,8 +499,6 @@
         Py_DECREF(v);
         return -1;
     }
-
-    initialized = 1;
     return 0;
 
 #undef ADD_INT
@@ -498,12 +509,32 @@
     {0, NULL}
 };
 
+static int
+resourcemodule_traverse(PyObject *m, visitproc visit, void *arg) {
+    Py_VISIT(get_resource_state(m)->StructRUsageType);
+    return 0;
+}
+
+static int
+resourcemodule_clear(PyObject *m) {
+    Py_CLEAR(get_resource_state(m)->StructRUsageType);
+    return 0;
+}
+
+static void
+resourcemodule_free(void *m) {
+    resourcemodule_clear((PyObject *)m);
+}
+
 static struct PyModuleDef resourcemodule = {
     PyModuleDef_HEAD_INIT,
     .m_name = "resource",
-    .m_size = 0,
+    .m_size = sizeof(resourcemodulestate),
     .m_methods = resource_methods,
     .m_slots = resource_slots,
+    .m_traverse = resourcemodule_traverse,
+    .m_clear = resourcemodule_clear,
+    .m_free = resourcemodule_free,
 };
 
 PyMODINIT_FUNC
diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c
index fb71e91..3afcb0e 100644
--- a/Modules/selectmodule.c
+++ b/Modules/selectmodule.c
@@ -77,35 +77,16 @@
     return (_selectstate *)state;
 }
 
-#define _selectstate_global get_select_state(PyState_FindModule(&selectmodule))
+#define _selectstate_by_type(type) get_select_state(PyType_GetModule(type))
 
 /*[clinic input]
 module select
-class select.poll "pollObject *" "&poll_Type"
-class select.devpoll "devpollObject *" "&devpoll_Type"
-class select.epoll "pyEpoll_Object *" "&pyEpoll_Type"
-class select.kqueue "kqueue_queue_Object *" "_selectstate_global->kqueue_queue_Type"
+class select.poll "pollObject *" "_selectstate_by_type(type)->poll_Type"
+class select.devpoll "devpollObject *" "_selectstate_by_type(type)->devpoll_Type"
+class select.epoll "pyEpoll_Object *" "_selectstate_by_type(type)->pyEpoll_Type"
+class select.kqueue "kqueue_queue_Object *" "_selectstate_by_type(type)->kqueue_queue_Type"
 [clinic start generated code]*/
-/*[clinic end generated code: output=da39a3ee5e6b4b0d input=41071028e0ede093]*/
-
-static int
-fildes_converter(PyObject *o, void *p)
-{
-    int fd;
-    int *pointer = (int *)p;
-    fd = PyObject_AsFileDescriptor(o);
-    if (fd == -1)
-        return 0;
-    *pointer = fd;
-    return 1;
-}
-
-/*[python input]
-class fildes_converter(CConverter):
-    type = 'int'
-    converter = 'fildes_converter'
-[python start generated code]*/
-/*[python end generated code: output=da39a3ee5e6b4b0d input=ca54eb5aa476e20a]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=8072de35824aa327]*/
 
 /* list of Python objects and their file descriptor */
 typedef struct {
@@ -313,9 +294,9 @@
     wfd2obj = PyMem_NEW(pylist, FD_SETSIZE + 1);
     efd2obj = PyMem_NEW(pylist, FD_SETSIZE + 1);
     if (rfd2obj == NULL || wfd2obj == NULL || efd2obj == NULL) {
-        if (rfd2obj) PyMem_DEL(rfd2obj);
-        if (wfd2obj) PyMem_DEL(wfd2obj);
-        if (efd2obj) PyMem_DEL(efd2obj);
+        if (rfd2obj) PyMem_Free(rfd2obj);
+        if (wfd2obj) PyMem_Free(wfd2obj);
+        if (efd2obj) PyMem_Free(efd2obj);
         return PyErr_NoMemory();
     }
 #endif /* SELECT_USES_HEAP */
@@ -400,9 +381,9 @@
     reap_obj(wfd2obj);
     reap_obj(efd2obj);
 #ifdef SELECT_USES_HEAP
-    PyMem_DEL(rfd2obj);
-    PyMem_DEL(wfd2obj);
-    PyMem_DEL(efd2obj);
+    PyMem_Free(rfd2obj);
+    PyMem_Free(wfd2obj);
+    PyMem_Free(efd2obj);
 #endif /* SELECT_USES_HEAP */
     return ret;
 }
@@ -518,11 +499,14 @@
     key = PyLong_FromLong(fd);
     if (key == NULL)
         return NULL;
-    if (PyDict_GetItemWithError(self->dict, key) == NULL) {
-        if (!PyErr_Occurred()) {
-            errno = ENOENT;
-            PyErr_SetFromErrno(PyExc_OSError);
-        }
+    err = PyDict_Contains(self->dict, key);
+    if (err < 0) {
+        Py_DECREF(key);
+        return NULL;
+    }
+    if (err == 0) {
+        errno = ENOENT;
+        PyErr_SetFromErrno(PyExc_OSError);
         Py_DECREF(key);
         return NULL;
     }
@@ -580,6 +564,8 @@
 select.poll.poll
 
     timeout as timeout_obj: object = None
+      The maximum time to wait in milliseconds, or else None (or a negative
+      value) to wait indefinitely.
     /
 
 Polls the set of registered file descriptors.
@@ -590,7 +576,7 @@
 
 static PyObject *
 select_poll_poll_impl(pollObject *self, PyObject *timeout_obj)
-/*[clinic end generated code: output=876e837d193ed7e4 input=7a446ed45189e894]*/
+/*[clinic end generated code: output=876e837d193ed7e4 input=c2f6953ec45e5622]*/
 {
     PyObject *result_list = NULL;
     int poll_result, i, j;
@@ -725,10 +711,10 @@
 }
 
 static pollObject *
-newPollObject(void)
+newPollObject(PyObject *module)
 {
     pollObject *self;
-    self = PyObject_New(pollObject, _selectstate_global->poll_Type);
+    self = PyObject_New(pollObject, get_select_state(module)->poll_Type);
     if (self == NULL)
         return NULL;
     /* ufd_uptodate is a Boolean, denoting whether the
@@ -744,21 +730,14 @@
     return self;
 }
 
-static PyObject *
-poll_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
-{
-    PyErr_Format(PyExc_TypeError, "Cannot create '%.200s' instances", _PyType_Name(type));
-    return NULL;
-}
-
 static void
 poll_dealloc(pollObject *self)
 {
     PyObject* type = (PyObject *)Py_TYPE(self);
     if (self->ufds != NULL)
-        PyMem_DEL(self->ufds);
+        PyMem_Free(self->ufds);
     Py_XDECREF(self->dict);
-    PyObject_Del(self);
+    PyObject_Free(self);
     Py_DECREF(type);
 }
 
@@ -911,6 +890,8 @@
 /*[clinic input]
 select.devpoll.poll
     timeout as timeout_obj: object = None
+      The maximum time to wait in milliseconds, or else None (or a negative
+      value) to wait indefinitely.
     /
 
 Polls the set of registered file descriptors.
@@ -921,7 +902,7 @@
 
 static PyObject *
 select_devpoll_poll_impl(devpollObject *self, PyObject *timeout_obj)
-/*[clinic end generated code: output=2654e5457cca0b3c input=fd0db698d84f0333]*/
+/*[clinic end generated code: output=2654e5457cca0b3c input=3c3f0a355ec2bedb]*/
 {
     struct dvpoll dvp;
     PyObject *result_list = NULL;
@@ -1089,7 +1070,7 @@
 };
 
 static devpollObject *
-newDevPollObject(void)
+newDevPollObject(PyObject *module)
 {
     devpollObject *self;
     int fd_devpoll, limit_result;
@@ -1119,10 +1100,10 @@
         return NULL;
     }
 
-    self = PyObject_New(devpollObject, _selectstate_global->devpoll_Type);
+    self = PyObject_New(devpollObject, get_select_state(module)->devpoll_Type);
     if (self == NULL) {
         close(fd_devpoll);
-        PyMem_DEL(fds);
+        PyMem_Free(fds);
         return NULL;
     }
     self->fd_devpoll = fd_devpoll;
@@ -1133,20 +1114,13 @@
     return self;
 }
 
-static PyObject *
-devpoll_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
-{
-    PyErr_Format(PyExc_TypeError, "Cannot create '%.200s' instances", _PyType_Name(type));
-    return NULL;
-}
-
 static void
 devpoll_dealloc(devpollObject *self)
 {
     PyObject *type = (PyObject *)Py_TYPE(self);
     (void)devpoll_internal_close(self);
-    PyMem_DEL(self->fds);
-    PyObject_Del(self);
+    PyMem_Free(self->fds);
+    PyObject_Free(self);
     Py_DECREF(type);
 }
 
@@ -1154,7 +1128,6 @@
     {Py_tp_dealloc, devpoll_dealloc},
     {Py_tp_getset, devpoll_getsetlist},
     {Py_tp_methods, devpoll_methods},
-    {Py_tp_new, devpoll_new},
     {0, 0},
 };
 
@@ -1162,7 +1135,7 @@
     "select.devpoll",
     sizeof(devpollObject),
     0,
-    Py_TPFLAGS_DEFAULT,
+    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION,
     devpoll_Type_slots
 };
 
@@ -1182,7 +1155,7 @@
 select_poll_impl(PyObject *module)
 /*[clinic end generated code: output=16a665a4e1d228c5 input=3f877909d5696bbf]*/
 {
-    return (PyObject *)newPollObject();
+    return (PyObject *)newPollObject(module);
 }
 
 #ifdef HAVE_SYS_DEVPOLL_H
@@ -1200,7 +1173,7 @@
 select_devpoll_impl(PyObject *module)
 /*[clinic end generated code: output=ea9213cc87fd9581 input=53a1af94564f00a3]*/
 {
-    return (PyObject *)newDevPollObject();
+    return (PyObject *)newDevPollObject(module);
 }
 #endif
 
@@ -1254,8 +1227,6 @@
     SOCKET epfd;                        /* epoll control file descriptor */
 } pyEpoll_Object;
 
-#define pyepoll_CHECK(op) (PyObject_TypeCheck((op), _selectstate_global->pyEpoll_Type))
-
 static PyObject *
 pyepoll_err_closed(void)
 {
@@ -1683,7 +1654,8 @@
                            PyObject *exc_value, PyObject *exc_tb)
 /*[clinic end generated code: output=c480f38ce361748e input=7ae81a5a4c1a98d8]*/
 {
-    return PyObject_CallMethodObjArgs((PyObject *)self, _selectstate_global->close, NULL);
+    _selectstate *state = _selectstate_by_type(Py_TYPE(self));
+    return PyObject_CallMethodObjArgs((PyObject *)self, state->close, NULL);
 }
 
 static PyGetSetDef pyepoll_getsetlist[] = {
@@ -1757,15 +1729,13 @@
     struct kevent e;
 } kqueue_event_Object;
 
-#define kqueue_event_Check(op) (PyObject_TypeCheck((op), _selectstate_global->kqueue_event_Type))
+#define kqueue_event_Check(op, state) (PyObject_TypeCheck((op), state->kqueue_event_Type))
 
 typedef struct {
     PyObject_HEAD
     SOCKET kqfd;                /* kqueue control fd */
 } kqueue_queue_Object;
 
-#define kqueue_queue_Check(op) (PyObject_TypeCheck((op), _selectstate_global->kqueue_queue_Type))
-
 #if (SIZEOF_UINTPTR_T != SIZEOF_VOID_P)
 #   error uintptr_t does not match void *!
 #elif (SIZEOF_UINTPTR_T == SIZEOF_LONG_LONG)
@@ -1906,8 +1876,9 @@
                          int op)
 {
     int result;
+    _selectstate *state = _selectstate_by_type(Py_TYPE(s));
 
-    if (!kqueue_event_Check(o)) {
+    if (!kqueue_event_Check(o, state)) {
         Py_RETURN_NOTIMPLEMENTED;
     }
 
@@ -2129,6 +2100,7 @@
     struct timespec timeoutspec;
     struct timespec *ptimeoutspec;
     _PyTime_t timeout, deadline = 0;
+    _selectstate *state = _selectstate_by_type(Py_TYPE(self));
 
     if (self->kqfd < 0)
         return kqueue_queue_err_closed();
@@ -2181,9 +2153,10 @@
             PyErr_NoMemory();
             goto error;
         }
+        _selectstate *state = _selectstate_by_type(Py_TYPE(self));
         for (i = 0; i < nchanges; ++i) {
             ei = PySequence_Fast_GET_ITEM(seq, i);
-            if (!kqueue_event_Check(ei)) {
+            if (!kqueue_event_Check(ei, state)) {
                 PyErr_SetString(PyExc_TypeError,
                     "changelist must be an iterable of "
                     "select.kevent objects");
@@ -2245,7 +2218,7 @@
     for (i = 0; i < gotevents; i++) {
         kqueue_event_Object *ch;
 
-        ch = PyObject_New(kqueue_event_Object, _selectstate_global->kqueue_event_Type);
+        ch = PyObject_New(kqueue_event_Object, state->kqueue_event_Type);
         if (ch == NULL) {
             goto error;
         }
@@ -2291,16 +2264,14 @@
 static PyType_Slot poll_Type_slots[] = {
     {Py_tp_dealloc, poll_dealloc},
     {Py_tp_methods, poll_methods},
-    {Py_tp_new, poll_new},
     {0, 0},
 };
 
 static PyType_Spec poll_Type_spec = {
-    "select.poll",
-    sizeof(pollObject),
-    0,
-    Py_TPFLAGS_DEFAULT,
-    poll_Type_slots
+    .name = "select.poll",
+    .basicsize = sizeof(pollObject),
+    .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION,
+    .slots = poll_Type_slots,
 };
 
 #ifdef HAVE_SYS_DEVPOLL_H
@@ -2408,24 +2379,28 @@
 static int
 _select_traverse(PyObject *module, visitproc visit, void *arg)
 {
-    Py_VISIT(get_select_state(module)->close);
-    Py_VISIT(get_select_state(module)->poll_Type);
-    Py_VISIT(get_select_state(module)->devpoll_Type);
-    Py_VISIT(get_select_state(module)->pyEpoll_Type);
-    Py_VISIT(get_select_state(module)->kqueue_event_Type);
-    Py_VISIT(get_select_state(module)->kqueue_queue_Type);
+    _selectstate *state = get_select_state(module);
+
+    Py_VISIT(state->close);
+    Py_VISIT(state->poll_Type);
+    Py_VISIT(state->devpoll_Type);
+    Py_VISIT(state->pyEpoll_Type);
+    Py_VISIT(state->kqueue_event_Type);
+    Py_VISIT(state->kqueue_queue_Type);
     return 0;
 }
 
 static int
 _select_clear(PyObject *module)
 {
-    Py_CLEAR(get_select_state(module)->close);
-    Py_CLEAR(get_select_state(module)->poll_Type);
-    Py_CLEAR(get_select_state(module)->devpoll_Type);
-    Py_CLEAR(get_select_state(module)->pyEpoll_Type);
-    Py_CLEAR(get_select_state(module)->kqueue_event_Type);
-    Py_CLEAR(get_select_state(module)->kqueue_queue_Type);
+    _selectstate *state = get_select_state(module);
+
+    Py_CLEAR(state->close);
+    Py_CLEAR(state->poll_Type);
+    Py_CLEAR(state->devpoll_Type);
+    Py_CLEAR(state->pyEpoll_Type);
+    Py_CLEAR(state->kqueue_event_Type);
+    Py_CLEAR(state->kqueue_queue_Type);
     return 0;
 }
 
@@ -2435,30 +2410,18 @@
     _select_clear((PyObject *)module);
 }
 
-static struct PyModuleDef selectmodule = {
-    PyModuleDef_HEAD_INIT,
-    "select",
-    module_doc,
-    sizeof(_selectstate),
-    select_methods,
-    NULL,
-    _select_traverse,
-    _select_clear,
-    _select_free,
-};
-
-PyMODINIT_FUNC
-PyInit_select(void)
+int
+_select_exec(PyObject *m)
 {
-    PyObject *m;
-    m = PyModule_Create(&selectmodule);
-    if (m == NULL)
-        return NULL;
+    _selectstate *state = get_select_state(m);
 
-    get_select_state(m)->close = PyUnicode_InternFromString("close");
-
-    Py_INCREF(PyExc_OSError);
-    PyModule_AddObject(m, "error", PyExc_OSError);
+    state->close = PyUnicode_InternFromString("close");
+    if (state->close == NULL) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "error", PyExc_OSError) < 0) {
+        return -1;
+    }
 
 #ifdef PIPE_BUF
 #ifdef HAVE_BROKEN_PIPE_BUF
@@ -2478,11 +2441,11 @@
 #else
     {
 #endif
-        PyObject *poll_Type = PyType_FromSpec(&poll_Type_spec);
-        if (poll_Type == NULL)
-            return NULL;
-        get_select_state(m)->poll_Type = (PyTypeObject *)poll_Type;
-        Py_INCREF(poll_Type);
+        state->poll_Type = (PyTypeObject *)PyType_FromModuleAndSpec(
+            m, &poll_Type_spec, NULL);
+        if (state->poll_Type == NULL) {
+            return -1;
+        }
 
         PyModule_AddIntMacro(m, POLLIN);
         PyModule_AddIntMacro(m, POLLPRI);
@@ -2514,20 +2477,22 @@
 #endif /* HAVE_POLL */
 
 #ifdef HAVE_SYS_DEVPOLL_H
-    PyObject *devpoll_Type = PyType_FromSpec(&devpoll_Type_spec);
-    if (devpoll_Type == NULL)
-        return NULL;
-    get_select_state(m)->devpoll_Type = (PyTypeObject *)devpoll_Type;
-    Py_INCREF(devpoll_Type);
+    state->devpoll_Type = (PyTypeObject *)PyType_FromModuleAndSpec(
+        m, &devpoll_Type_spec, NULL);
+    if (state->devpoll_Type == NULL) {
+        return -1;
+    }
 #endif
 
 #ifdef HAVE_EPOLL
-    PyObject *pyEpoll_Type = PyType_FromSpec(&pyEpoll_Type_spec);
-    if (pyEpoll_Type == NULL)
-        return NULL;
-    get_select_state(m)->pyEpoll_Type = (PyTypeObject *)pyEpoll_Type;
-    Py_INCREF(pyEpoll_Type);
-    PyModule_AddObject(m, "epoll", (PyObject *)get_select_state(m)->pyEpoll_Type);
+    state->pyEpoll_Type = (PyTypeObject *)PyType_FromModuleAndSpec(
+        m, &pyEpoll_Type_spec, NULL);
+    if (state->pyEpoll_Type == NULL) {
+        return -1;
+    }
+    if (PyModule_AddType(m, state->pyEpoll_Type) < 0) {
+        return -1;
+    }
 
     PyModule_AddIntMacro(m, EPOLLIN);
     PyModule_AddIntMacro(m, EPOLLOUT);
@@ -2569,19 +2534,23 @@
 #endif /* HAVE_EPOLL */
 
 #ifdef HAVE_KQUEUE
-    PyObject *kqueue_event_Type = PyType_FromSpec(&kqueue_event_Type_spec);
-    if (kqueue_event_Type == NULL)
-        return NULL;
-    get_select_state(m)->kqueue_event_Type = (PyTypeObject *)kqueue_event_Type;
-    Py_INCREF(get_select_state(m)->kqueue_event_Type);
-    PyModule_AddObject(m, "kevent", kqueue_event_Type);
+    state->kqueue_event_Type = (PyTypeObject *)PyType_FromModuleAndSpec(
+        m, &kqueue_event_Type_spec, NULL);
+    if (state->kqueue_event_Type == NULL) {
+        return -1;
+    }
+    if (PyModule_AddType(m, state->kqueue_event_Type) < 0) {
+        return -1;
+    }
 
-    PyObject *kqueue_queue_Type = PyType_FromSpec(&kqueue_queue_Type_spec);
-    if (kqueue_queue_Type == NULL)
-        return NULL;
-    get_select_state(m)->kqueue_queue_Type = (PyTypeObject *)kqueue_queue_Type;
-    Py_INCREF(get_select_state(m)->kqueue_queue_Type);
-    PyModule_AddObject(m, "kqueue", kqueue_queue_Type);
+    state->kqueue_queue_Type = (PyTypeObject *)PyType_FromModuleAndSpec(
+        m, &kqueue_queue_Type_spec, NULL);
+    if (state->kqueue_queue_Type == NULL) {
+        return -1;
+    }
+    if (PyModule_AddType(m, state->kqueue_queue_Type) < 0) {
+        return -1;
+    }
 
     /* event filters */
     PyModule_AddIntConstant(m, "KQ_FILTER_READ", EVFILT_READ);
@@ -2658,5 +2627,28 @@
 #endif
 
 #endif /* HAVE_KQUEUE */
-    return m;
+    return 0;
+}
+
+static PyModuleDef_Slot _select_slots[] = {
+    {Py_mod_exec, _select_exec},
+    {0, NULL}
+};
+
+static struct PyModuleDef selectmodule = {
+    PyModuleDef_HEAD_INIT,
+    .m_name = "select",
+    .m_doc = module_doc,
+    .m_size = sizeof(_selectstate),
+    .m_methods = select_methods,
+    .m_slots = _select_slots,
+    .m_traverse = _select_traverse,
+    .m_clear = _select_clear,
+    .m_free = _select_free,
+};
+
+PyMODINIT_FUNC
+PyInit_select(void)
+{
+    return PyModuleDef_Init(&selectmodule);
 }
diff --git a/Modules/sha1module.c b/Modules/sha1module.c
index b0656d8..d186aa4 100644
--- a/Modules/sha1module.c
+++ b/Modules/sha1module.c
@@ -74,7 +74,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
+ * Tom St Denis, tomstdenis@gmail.com, https://www.libtom.net
  */
 
 /* rotate the hard way (platform optimizations could be done) */
@@ -269,7 +269,7 @@
         sha1->curlen = 0;
     }
 
-    /* pad upto 56 bytes of zeroes */
+    /* pad up to 56 bytes of zeroes */
     while (sha1->curlen < 56) {
         sha1->buf[sha1->curlen++] = (unsigned char)0;
     }
@@ -295,22 +295,42 @@
  * ------------------------------------------------------------------------
  */
 
-static PyTypeObject SHA1type;
+typedef struct {
+    PyTypeObject* sha1_type;
+} SHA1State;
 
+static inline SHA1State*
+sha1_get_state(PyObject *module)
+{
+    void *state = PyModule_GetState(module);
+    assert(state != NULL);
+    return (SHA1State *)state;
+}
 
 static SHA1object *
-newSHA1object(void)
+newSHA1object(SHA1State *st)
 {
-    return (SHA1object *)PyObject_New(SHA1object, &SHA1type);
+    SHA1object *sha = (SHA1object *)PyObject_GC_New(SHA1object, st->sha1_type);
+    PyObject_GC_Track(sha);
+    return sha;
 }
 
 
 /* Internal methods for a hash object */
+static int
+SHA1_traverse(PyObject *ptr, visitproc visit, void *arg)
+{
+    Py_VISIT(Py_TYPE(ptr));
+    return 0;
+}
 
 static void
 SHA1_dealloc(PyObject *ptr)
 {
-    PyObject_Del(ptr);
+    PyTypeObject *tp = Py_TYPE(ptr);
+    PyObject_GC_UnTrack(ptr);
+    PyObject_GC_Del(ptr);
+    Py_DECREF(tp);
 }
 
 
@@ -319,16 +339,19 @@
 /*[clinic input]
 SHA1Type.copy
 
+    cls: defining_class
+
 Return a copy of the hash object.
 [clinic start generated code]*/
 
 static PyObject *
-SHA1Type_copy_impl(SHA1object *self)
-/*[clinic end generated code: output=b4e001264620f02a input=b7eae10df6f89b36]*/
+SHA1Type_copy_impl(SHA1object *self, PyTypeObject *cls)
+/*[clinic end generated code: output=b32d4461ce8bc7a7 input=6c22e66fcc34c58e]*/
 {
-    SHA1object *newobj;
+    SHA1State *st = PyType_GetModuleState(cls);
 
-    if ((newobj = newSHA1object()) == NULL)
+    SHA1object *newobj;
+    if ((newobj = newSHA1object(st)) == NULL)
         return NULL;
 
     newobj->hash_state = self->hash_state;
@@ -422,7 +445,6 @@
     return PyLong_FromLong(SHA1_DIGESTSIZE);
 }
 
-
 static PyGetSetDef SHA1_getseters[] = {
     {"block_size",
      (getter)SHA1_get_block_size, NULL,
@@ -439,40 +461,21 @@
     {NULL}  /* Sentinel */
 };
 
-static PyTypeObject SHA1type = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "_sha1.sha1",               /*tp_name*/
-    sizeof(SHA1object), /*tp_basicsize*/
-    0,                  /*tp_itemsize*/
-    /* methods */
-    SHA1_dealloc,       /*tp_dealloc*/
-    0,                  /*tp_vectorcall_offset*/
-    0,                  /*tp_getattr*/
-    0,                  /*tp_setattr*/
-    0,                  /*tp_as_async*/
-    0,                  /*tp_repr*/
-    0,                  /*tp_as_number*/
-    0,                  /*tp_as_sequence*/
-    0,                  /*tp_as_mapping*/
-    0,                  /*tp_hash*/
-    0,                  /*tp_call*/
-    0,                  /*tp_str*/
-    0,                  /*tp_getattro*/
-    0,                  /*tp_setattro*/
-    0,                  /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT, /*tp_flags*/
-    0,                  /*tp_doc*/
-    0,                  /*tp_traverse*/
-    0,                  /*tp_clear*/
-    0,                  /*tp_richcompare*/
-    0,                  /*tp_weaklistoffset*/
-    0,                  /*tp_iter*/
-    0,                  /*tp_iternext*/
-    SHA1_methods,       /* tp_methods */
-    NULL,               /* tp_members */
-    SHA1_getseters,      /* tp_getset */
+static PyType_Slot sha1_type_slots[] = {
+    {Py_tp_dealloc, SHA1_dealloc},
+    {Py_tp_methods, SHA1_methods},
+    {Py_tp_getset, SHA1_getseters},
+    {Py_tp_traverse, SHA1_traverse},
+    {0,0}
 };
 
+static PyType_Spec sha1_type_spec = {
+    .name = "_sha1.sha1",
+    .basicsize =  sizeof(SHA1object),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION |
+              Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_HAVE_GC),
+    .slots = sha1_type_slots
+};
 
 /* The single module-level function: new() */
 
@@ -496,7 +499,8 @@
     if (string)
         GET_BUFFER_VIEW_OR_ERROUT(string, &buf);
 
-    if ((new = newSHA1object()) == NULL) {
+    SHA1State *st = sha1_get_state(module);
+    if ((new = newSHA1object(st)) == NULL) {
         if (string)
             PyBuffer_Release(&buf);
         return NULL;
@@ -526,37 +530,72 @@
     {NULL,      NULL}            /* Sentinel */
 };
 
+static int
+_sha1_traverse(PyObject *module, visitproc visit, void *arg)
+{
+    SHA1State *state = sha1_get_state(module);
+    Py_VISIT(state->sha1_type);
+    return 0;
+}
+
+static int
+_sha1_clear(PyObject *module)
+{
+    SHA1State *state = sha1_get_state(module);
+    Py_CLEAR(state->sha1_type);
+    return 0;
+}
+
+static void
+_sha1_free(void *module)
+{
+    _sha1_clear((PyObject *)module);
+}
+
+static int
+_sha1_exec(PyObject *module)
+{
+    SHA1State* st = sha1_get_state(module);
+
+    st->sha1_type = (PyTypeObject *)PyType_FromModuleAndSpec(
+        module, &sha1_type_spec, NULL);
+
+    if (st->sha1_type == NULL) {
+        return -1;
+    }
+
+    Py_INCREF(st->sha1_type);
+    if (PyModule_AddObject(module,
+                           "SHA1Type",
+                           (PyObject *)st->sha1_type) < 0) {
+        Py_DECREF(st->sha1_type);
+        return -1;
+    }
+
+    return 0;
+}
+
 
 /* Initialize this module. */
 
+static PyModuleDef_Slot _sha1_slots[] = {
+    {Py_mod_exec, _sha1_exec},
+    {0, NULL}
+};
+
 static struct PyModuleDef _sha1module = {
         PyModuleDef_HEAD_INIT,
-        "_sha1",
-        NULL,
-        -1,
-        SHA1_functions,
-        NULL,
-        NULL,
-        NULL,
-        NULL
+        .m_name = "_sha1",
+        .m_size = sizeof(SHA1State),
+        .m_methods = SHA1_functions,
+        .m_slots = _sha1_slots,
+        .m_traverse = _sha1_traverse,
+        .m_clear = _sha1_clear,
+        .m_free = _sha1_free
 };
 
 PyMODINIT_FUNC
 PyInit__sha1(void)
 {
-    PyObject *m;
-
-    Py_SET_TYPE(&SHA1type, &PyType_Type);
-    if (PyType_Ready(&SHA1type) < 0) {
-        return NULL;
-    }
-
-    m = PyModule_Create(&_sha1module);
-    if (m == NULL) {
-        return NULL;
-    }
-
-    Py_INCREF((PyObject *)&SHA1type);
-    PyModule_AddObject(m, "SHA1Type", (PyObject *)&SHA1type);
-    return m;
+    return PyModuleDef_Init(&_sha1module);
 }
diff --git a/Modules/sha256module.c b/Modules/sha256module.c
index 8edb1d5..fac7073 100644
--- a/Modules/sha256module.c
+++ b/Modules/sha256module.c
@@ -17,7 +17,7 @@
 /* SHA objects */
 
 #include "Python.h"
-#include "pycore_byteswap.h"      // _Py_bswap32()
+#include "pycore_bitutils.h"      // _Py_bswap32()
 #include "structmember.h"         // PyMemberDef
 #include "hashlib.h"
 #include "pystrhex.h"
@@ -51,6 +51,19 @@
 
 #include "clinic/sha256module.c.h"
 
+typedef struct {
+    PyTypeObject* sha224_type;
+    PyTypeObject* sha256_type;
+} _sha256_state;
+
+static inline _sha256_state*
+_sha256_get_state(PyObject *module)
+{
+    void *state = PyModule_GetState(module);
+    assert(state != NULL);
+    return (_sha256_state *)state;
+}
+
 /* When run on a little-endian CPU we need to perform byte reversal on an
    array of longwords. */
 
@@ -93,7 +106,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://libtom.org
+ * Tom St Denis, tomstdenis@iahu.ca, https://www.libtom.net
  */
 
 
@@ -365,28 +378,40 @@
  * ------------------------------------------------------------------------
  */
 
-static PyTypeObject SHA224type;
-static PyTypeObject SHA256type;
-
 
 static SHAobject *
-newSHA224object(void)
+newSHA224object(_sha256_state *state)
 {
-    return (SHAobject *)PyObject_New(SHAobject, &SHA224type);
+    SHAobject *sha = (SHAobject *)PyObject_GC_New(SHAobject,
+                                                  state->sha224_type);
+    PyObject_GC_Track(sha);
+    return sha;
 }
 
 static SHAobject *
-newSHA256object(void)
+newSHA256object(_sha256_state *state)
 {
-    return (SHAobject *)PyObject_New(SHAobject, &SHA256type);
+    SHAobject *sha = (SHAobject *)PyObject_GC_New(SHAobject,
+                                                  state->sha256_type);
+    PyObject_GC_Track(sha);
+    return sha;
 }
 
 /* Internal methods for a hash object */
+static int
+SHA_traverse(PyObject *ptr, visitproc visit, void *arg)
+{
+    Py_VISIT(Py_TYPE(ptr));
+    return 0;
+}
 
 static void
 SHA_dealloc(PyObject *ptr)
 {
-    PyObject_Del(ptr);
+    PyTypeObject *tp = Py_TYPE(ptr);
+    PyObject_GC_UnTrack(ptr);
+    PyObject_GC_Del(ptr);
+    Py_DECREF(tp);
 }
 
 
@@ -395,21 +420,25 @@
 /*[clinic input]
 SHA256Type.copy
 
+    cls:defining_class
+
 Return a copy of the hash object.
 [clinic start generated code]*/
 
 static PyObject *
-SHA256Type_copy_impl(SHAobject *self)
-/*[clinic end generated code: output=1a8bbd66a0c9c168 input=f58840a618d4f2a7]*/
+SHA256Type_copy_impl(SHAobject *self, PyTypeObject *cls)
+/*[clinic end generated code: output=9273f92c382be12f input=3137146fcb88e212]*/
 {
     SHAobject *newobj;
-
-    if (Py_IS_TYPE(self, &SHA256type)) {
-        if ( (newobj = newSHA256object())==NULL)
+    _sha256_state *state = PyType_GetModuleState(cls);
+    if (Py_IS_TYPE(self, state->sha256_type)) {
+        if ( (newobj = newSHA256object(state)) == NULL) {
             return NULL;
+        }
     } else {
-        if ( (newobj = newSHA224object())==NULL)
+        if ( (newobj = newSHA224object(state))==NULL) {
             return NULL;
+        }
     }
 
     SHAcopy(self, newobj);
@@ -517,74 +546,30 @@
     {NULL}  /* Sentinel */
 };
 
-static PyTypeObject SHA224type = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "_sha256.sha224",   /*tp_name*/
-    sizeof(SHAobject),  /*tp_basicsize*/
-    0,                  /*tp_itemsize*/
-    /* methods */
-    SHA_dealloc,        /*tp_dealloc*/
-    0,                  /*tp_vectorcall_offset*/
-    0,                  /*tp_getattr*/
-    0,                  /*tp_setattr*/
-    0,                  /*tp_as_async*/
-    0,                  /*tp_repr*/
-    0,                  /*tp_as_number*/
-    0,                  /*tp_as_sequence*/
-    0,                  /*tp_as_mapping*/
-    0,                  /*tp_hash*/
-    0,                  /*tp_call*/
-    0,                  /*tp_str*/
-    0,                  /*tp_getattro*/
-    0,                  /*tp_setattro*/
-    0,                  /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT, /*tp_flags*/
-    0,                  /*tp_doc*/
-    0,                  /*tp_traverse*/
-    0,                  /*tp_clear*/
-    0,                  /*tp_richcompare*/
-    0,                  /*tp_weaklistoffset*/
-    0,                  /*tp_iter*/
-    0,                  /*tp_iternext*/
-    SHA_methods,        /* tp_methods */
-    SHA_members,        /* tp_members */
-    SHA_getseters,      /* tp_getset */
+static PyType_Slot sha256_types_slots[] = {
+    {Py_tp_dealloc, SHA_dealloc},
+    {Py_tp_methods, SHA_methods},
+    {Py_tp_members, SHA_members},
+    {Py_tp_getset, SHA_getseters},
+    {Py_tp_traverse, SHA_traverse},
+    {0,0}
 };
 
-static PyTypeObject SHA256type = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "_sha256.sha256",   /*tp_name*/
-    sizeof(SHAobject),  /*tp_basicsize*/
-    0,                  /*tp_itemsize*/
-    /* methods */
-    SHA_dealloc,        /*tp_dealloc*/
-    0,                  /*tp_vectorcall_offset*/
-    0,                  /*tp_getattr*/
-    0,                  /*tp_setattr*/
-    0,                  /*tp_as_async*/
-    0,                  /*tp_repr*/
-    0,                  /*tp_as_number*/
-    0,                  /*tp_as_sequence*/
-    0,                  /*tp_as_mapping*/
-    0,                  /*tp_hash*/
-    0,                  /*tp_call*/
-    0,                  /*tp_str*/
-    0,                  /*tp_getattro*/
-    0,                  /*tp_setattro*/
-    0,                  /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT, /*tp_flags*/
-    0,                  /*tp_doc*/
-    0,                  /*tp_traverse*/
-    0,                  /*tp_clear*/
-    0,                  /*tp_richcompare*/
-    0,                  /*tp_weaklistoffset*/
-    0,                  /*tp_iter*/
-    0,                  /*tp_iternext*/
-    SHA_methods,        /* tp_methods */
-    SHA_members,        /* tp_members */
-    SHA_getseters,      /* tp_getset */
+static PyType_Spec sha224_type_spec = {
+    .name = "_sha256.sha224",
+    .basicsize = sizeof(SHAobject),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION |
+              Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_HAVE_GC),
+    .slots = sha256_types_slots
 };
 
+static PyType_Spec sha256_type_spec = {
+    .name = "_sha256.sha256",
+    .basicsize = sizeof(SHAobject),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION |
+              Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_HAVE_GC),
+    .slots = sha256_types_slots
+};
 
 /* The single module-level function: new() */
 
@@ -602,15 +587,19 @@
 _sha256_sha256_impl(PyObject *module, PyObject *string, int usedforsecurity)
 /*[clinic end generated code: output=a1de327e8e1185cf input=9be86301aeb14ea5]*/
 {
-    SHAobject *new;
     Py_buffer buf;
 
-    if (string)
+    if (string) {
         GET_BUFFER_VIEW_OR_ERROUT(string, &buf);
+    }
 
-    if ((new = newSHA256object()) == NULL) {
-        if (string)
+    _sha256_state *state = PyModule_GetState(module);
+
+    SHAobject *new;
+    if ((new = newSHA256object(state)) == NULL) {
+        if (string) {
             PyBuffer_Release(&buf);
+        }
         return NULL;
     }
 
@@ -618,8 +607,9 @@
 
     if (PyErr_Occurred()) {
         Py_DECREF(new);
-        if (string)
+        if (string) {
             PyBuffer_Release(&buf);
+        }
         return NULL;
     }
     if (string) {
@@ -644,15 +634,17 @@
 _sha256_sha224_impl(PyObject *module, PyObject *string, int usedforsecurity)
 /*[clinic end generated code: output=08be6b36569bc69c input=9fcfb46e460860ac]*/
 {
-    SHAobject *new;
     Py_buffer buf;
-
-    if (string)
+    if (string) {
         GET_BUFFER_VIEW_OR_ERROUT(string, &buf);
+    }
 
-    if ((new = newSHA224object()) == NULL) {
-        if (string)
+    _sha256_state *state = PyModule_GetState(module);
+    SHAobject *new;
+    if ((new = newSHA224object(state)) == NULL) {
+        if (string) {
             PyBuffer_Release(&buf);
+        }
         return NULL;
     }
 
@@ -660,8 +652,9 @@
 
     if (PyErr_Occurred()) {
         Py_DECREF(new);
-        if (string)
+        if (string) {
             PyBuffer_Release(&buf);
+        }
         return NULL;
     }
     if (string) {
@@ -681,43 +674,80 @@
     {NULL,      NULL}            /* Sentinel */
 };
 
+static int
+_sha256_traverse(PyObject *module, visitproc visit, void *arg)
+{
+    _sha256_state *state = _sha256_get_state(module);
+    Py_VISIT(state->sha224_type);
+    Py_VISIT(state->sha256_type);
+    return 0;
+}
 
-/* Initialize this module. */
+static int
+_sha256_clear(PyObject *module)
+{
+    _sha256_state *state = _sha256_get_state(module);
+    Py_CLEAR(state->sha224_type);
+    Py_CLEAR(state->sha256_type);
+    return 0;
+}
 
-static struct PyModuleDef _sha256module = {
-        PyModuleDef_HEAD_INIT,
-        "_sha256",
-        NULL,
-        -1,
-        SHA_functions,
-        NULL,
-        NULL,
-        NULL,
-        NULL
+static void
+_sha256_free(void *module)
+{
+    _sha256_clear((PyObject *)module);
+}
+
+static int sha256_exec(PyObject *module)
+{
+    _sha256_state *state = _sha256_get_state(module);
+
+    state->sha224_type = (PyTypeObject *)PyType_FromModuleAndSpec(
+        module, &sha224_type_spec, NULL);
+
+    if (state->sha224_type == NULL) {
+        return -1;
+    }
+
+    state->sha256_type = (PyTypeObject *)PyType_FromModuleAndSpec(
+        module, &sha256_type_spec, NULL);
+
+    if (state->sha256_type == NULL) {
+        return -1;
+    }
+
+    Py_INCREF((PyObject *)state->sha224_type);
+    if (PyModule_AddObject(module, "SHA224Type", (PyObject *)state->sha224_type) < 0) {
+        Py_DECREF((PyObject *)state->sha224_type);
+        return -1;
+    }
+    Py_INCREF((PyObject *)state->sha256_type);
+    if (PyModule_AddObject(module, "SHA256Type", (PyObject *)state->sha256_type) < 0) {
+        Py_DECREF((PyObject *)state->sha256_type);
+        return -1;
+    }
+    return 0;
+}
+
+static PyModuleDef_Slot _sha256_slots[] = {
+    {Py_mod_exec, sha256_exec},
+    {0, NULL}
 };
 
+static struct PyModuleDef _sha256module = {
+    PyModuleDef_HEAD_INIT,
+    .m_name = "_sha256",
+    .m_size = sizeof(_sha256_state),
+    .m_methods = SHA_functions,
+    .m_slots = _sha256_slots,
+    .m_traverse = _sha256_traverse,
+    .m_clear = _sha256_clear,
+    .m_free = _sha256_free
+};
+
+/* Initialize this module. */
 PyMODINIT_FUNC
 PyInit__sha256(void)
 {
-    PyObject *m;
-
-    Py_SET_TYPE(&SHA224type, &PyType_Type);
-    if (PyType_Ready(&SHA224type) < 0) {
-        return NULL;
-    }
-    Py_SET_TYPE(&SHA256type, &PyType_Type);
-    if (PyType_Ready(&SHA256type) < 0) {
-        return NULL;
-    }
-
-    m = PyModule_Create(&_sha256module);
-    if (m == NULL)
-        return NULL;
-
-    Py_INCREF((PyObject *)&SHA224type);
-    PyModule_AddObject(m, "SHA224Type", (PyObject *)&SHA224type);
-    Py_INCREF((PyObject *)&SHA256type);
-    PyModule_AddObject(m, "SHA256Type", (PyObject *)&SHA256type);
-    return m;
-
+    return PyModuleDef_Init(&_sha256module);
 }
diff --git a/Modules/sha512module.c b/Modules/sha512module.c
index 561ef8e..4ea2fc1 100644
--- a/Modules/sha512module.c
+++ b/Modules/sha512module.c
@@ -17,7 +17,7 @@
 /* SHA objects */
 
 #include "Python.h"
-#include "pycore_byteswap.h"      // _Py_bswap32()
+#include "pycore_bitutils.h"      // _Py_bswap64()
 #include "structmember.h"         // PyMemberDef
 #include "hashlib.h"
 #include "pystrhex.h"
@@ -94,7 +94,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://libtom.org
+ * Tom St Denis, tomstdenis@iahu.ca, https://www.libtom.net
  */
 
 
@@ -422,28 +422,50 @@
  * ------------------------------------------------------------------------
  */
 
-static PyTypeObject SHA384type;
-static PyTypeObject SHA512type;
+typedef struct {
+    PyTypeObject* sha384_type;
+    PyTypeObject* sha512_type;
+} SHA512State;
 
-
-static SHAobject *
-newSHA384object(void)
+static inline SHA512State*
+sha512_get_state(PyObject *module)
 {
-    return (SHAobject *)PyObject_New(SHAobject, &SHA384type);
+    void *state = PyModule_GetState(module);
+    assert(state != NULL);
+    return (SHA512State *)state;
 }
 
 static SHAobject *
-newSHA512object(void)
+newSHA384object(SHA512State *st)
 {
-    return (SHAobject *)PyObject_New(SHAobject, &SHA512type);
+    SHAobject *sha = (SHAobject *)PyObject_GC_New(SHAobject, st->sha384_type);
+    PyObject_GC_Track(sha);
+    return sha;
+}
+
+static SHAobject *
+newSHA512object(SHA512State *st)
+{
+    SHAobject *sha = (SHAobject *)PyObject_GC_New(SHAobject, st->sha512_type);
+    PyObject_GC_Track(sha);
+    return sha;
 }
 
 /* Internal methods for a hash object */
+static int
+SHA_traverse(PyObject *ptr, visitproc visit, void *arg)
+{
+    Py_VISIT(Py_TYPE(ptr));
+    return 0;
+}
 
 static void
 SHA512_dealloc(PyObject *ptr)
 {
-    PyObject_Del(ptr);
+    PyTypeObject *tp = Py_TYPE(ptr);
+    PyObject_GC_UnTrack(ptr);
+    PyObject_GC_Del(ptr);
+    Py_DECREF(tp);
 }
 
 
@@ -452,21 +474,27 @@
 /*[clinic input]
 SHA512Type.copy
 
+    cls: defining_class
+
 Return a copy of the hash object.
 [clinic start generated code]*/
 
 static PyObject *
-SHA512Type_copy_impl(SHAobject *self)
-/*[clinic end generated code: output=adea896ed3164821 input=9f5f31e6c457776a]*/
+SHA512Type_copy_impl(SHAobject *self, PyTypeObject *cls)
+/*[clinic end generated code: output=85ea5b47837a08e6 input=f673a18f66527c90]*/
 {
     SHAobject *newobj;
+    SHA512State *st = PyType_GetModuleState(cls);
 
-    if (Py_IS_TYPE((PyObject*)self, &SHA512type)) {
-        if ( (newobj = newSHA512object())==NULL)
+    if (Py_IS_TYPE((PyObject*)self, st->sha512_type)) {
+        if ( (newobj = newSHA512object(st))==NULL) {
             return NULL;
-    } else {
-        if ( (newobj = newSHA384object())==NULL)
+        }
+    }
+    else {
+        if ( (newobj = newSHA384object(st))==NULL) {
             return NULL;
+        }
     }
 
     SHAcopy(self, newobj);
@@ -574,74 +602,41 @@
     {NULL}  /* Sentinel */
 };
 
-static PyTypeObject SHA384type = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "_sha512.sha384",   /*tp_name*/
-    sizeof(SHAobject),  /*tp_basicsize*/
-    0,                  /*tp_itemsize*/
-    /* methods */
-    SHA512_dealloc,     /*tp_dealloc*/
-    0,                  /*tp_vectorcall_offset*/
-    0,                  /*tp_getattr*/
-    0,                  /*tp_setattr*/
-    0,                  /*tp_as_async*/
-    0,                  /*tp_repr*/
-    0,                  /*tp_as_number*/
-    0,                  /*tp_as_sequence*/
-    0,                  /*tp_as_mapping*/
-    0,                  /*tp_hash*/
-    0,                  /*tp_call*/
-    0,                  /*tp_str*/
-    0,                  /*tp_getattro*/
-    0,                  /*tp_setattro*/
-    0,                  /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT, /*tp_flags*/
-    0,                  /*tp_doc*/
-    0,                  /*tp_traverse*/
-    0,                  /*tp_clear*/
-    0,                  /*tp_richcompare*/
-    0,                  /*tp_weaklistoffset*/
-    0,                  /*tp_iter*/
-    0,                  /*tp_iternext*/
-    SHA_methods,        /* tp_methods */
-    SHA_members,        /* tp_members */
-    SHA_getseters,      /* tp_getset */
+static PyType_Slot sha512_sha384_type_slots[] = {
+    {Py_tp_dealloc, SHA512_dealloc},
+    {Py_tp_methods, SHA_methods},
+    {Py_tp_members, SHA_members},
+    {Py_tp_getset, SHA_getseters},
+    {Py_tp_traverse, SHA_traverse},
+    {0,0}
 };
 
-static PyTypeObject SHA512type = {
-    PyVarObject_HEAD_INIT(NULL, 0)
-    "_sha512.sha512",   /*tp_name*/
-    sizeof(SHAobject),  /*tp_basicsize*/
-    0,                  /*tp_itemsize*/
-    /* methods */
-    SHA512_dealloc,     /*tp_dealloc*/
-    0,                  /*tp_vectorcall_offset*/
-    0,                  /*tp_getattr*/
-    0,                  /*tp_setattr*/
-    0,                  /*tp_as_async*/
-    0,                  /*tp_repr*/
-    0,                  /*tp_as_number*/
-    0,                  /*tp_as_sequence*/
-    0,                  /*tp_as_mapping*/
-    0,                  /*tp_hash*/
-    0,                  /*tp_call*/
-    0,                  /*tp_str*/
-    0,                  /*tp_getattro*/
-    0,                  /*tp_setattro*/
-    0,                  /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT, /*tp_flags*/
-    0,                  /*tp_doc*/
-    0,                  /*tp_traverse*/
-    0,                  /*tp_clear*/
-    0,                  /*tp_richcompare*/
-    0,                  /*tp_weaklistoffset*/
-    0,                  /*tp_iter*/
-    0,                  /*tp_iternext*/
-    SHA_methods,        /* tp_methods */
-    SHA_members,        /* tp_members */
-    SHA_getseters,      /* tp_getset */
+static PyType_Spec sha512_sha384_type_spec = {
+    .name = "_sha512.sha384",
+    .basicsize =  sizeof(SHAobject),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION |
+              Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_HAVE_GC),
+    .slots = sha512_sha384_type_slots
 };
 
+static PyType_Slot sha512_sha512_type_slots[] = {
+    {Py_tp_dealloc, SHA512_dealloc},
+    {Py_tp_methods, SHA_methods},
+    {Py_tp_members, SHA_members},
+    {Py_tp_getset, SHA_getseters},
+    {Py_tp_traverse, SHA_traverse},
+    {0,0}
+};
+
+// Using PyType_GetModuleState() on this type is safe since
+// it cannot be subclassed: it does not have the Py_TPFLAGS_BASETYPE flag.
+static PyType_Spec sha512_sha512_type_spec = {
+    .name = "_sha512.sha512",
+    .basicsize =  sizeof(SHAobject),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION |
+              Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_HAVE_GC),
+    .slots = sha512_sha512_type_slots
+};
 
 /* The single module-level function: new() */
 
@@ -662,10 +657,12 @@
     SHAobject *new;
     Py_buffer buf;
 
+    SHA512State *st = sha512_get_state(module);
+
     if (string)
         GET_BUFFER_VIEW_OR_ERROUT(string, &buf);
 
-    if ((new = newSHA512object()) == NULL) {
+    if ((new = newSHA512object(st)) == NULL) {
         if (string)
             PyBuffer_Release(&buf);
         return NULL;
@@ -704,10 +701,12 @@
     SHAobject *new;
     Py_buffer buf;
 
+    SHA512State *st = sha512_get_state(module);
+
     if (string)
         GET_BUFFER_VIEW_OR_ERROUT(string, &buf);
 
-    if ((new = newSHA384object()) == NULL) {
+    if ((new = newSHA384object(st)) == NULL) {
         if (string)
             PyBuffer_Release(&buf);
         return NULL;
@@ -738,43 +737,80 @@
     {NULL,      NULL}            /* Sentinel */
 };
 
+static int
+_sha512_traverse(PyObject *module, visitproc visit, void *arg)
+{
+    SHA512State *state = sha512_get_state(module);
+    Py_VISIT(state->sha384_type);
+    Py_VISIT(state->sha512_type);
+    return 0;
+}
+
+static int
+_sha512_clear(PyObject *module)
+{
+    SHA512State *state = sha512_get_state(module);
+    Py_CLEAR(state->sha384_type);
+    Py_CLEAR(state->sha512_type);
+    return 0;
+}
+
+static void
+_sha512_free(void *module)
+{
+    _sha512_clear((PyObject *)module);
+}
+
 
 /* Initialize this module. */
+static int
+_sha512_exec(PyObject *m)
+{
+    SHA512State* st = sha512_get_state(m);
+
+    st->sha384_type = (PyTypeObject *)PyType_FromModuleAndSpec(
+        m, &sha512_sha384_type_spec, NULL);
+
+    st->sha512_type = (PyTypeObject *)PyType_FromModuleAndSpec(
+        m, &sha512_sha512_type_spec, NULL);
+
+    if (st->sha384_type == NULL || st->sha512_type == NULL) {
+        return -1;
+    }
+
+    Py_INCREF(st->sha384_type);
+    if (PyModule_AddObject(m, "SHA384Type", (PyObject *)st->sha384_type) < 0) {
+        Py_DECREF(st->sha384_type);
+        return -1;
+    }
+
+    Py_INCREF(st->sha512_type);
+    if (PyModule_AddObject(m, "SHA384Type", (PyObject *)st->sha512_type) < 0) {
+        Py_DECREF(st->sha512_type);
+        return -1;
+    }
+
+    return 0;
+}
+
+static PyModuleDef_Slot _sha512_slots[] = {
+    {Py_mod_exec, _sha512_exec},
+    {0, NULL}
+};
 
 static struct PyModuleDef _sha512module = {
         PyModuleDef_HEAD_INIT,
-        "_sha512",
-        NULL,
-        -1,
-        SHA_functions,
-        NULL,
-        NULL,
-        NULL,
-        NULL
+        .m_name = "_sha512",
+        .m_size = sizeof(SHA512State),
+        .m_methods = SHA_functions,
+        .m_slots = _sha512_slots,
+        .m_traverse = _sha512_traverse,
+        .m_clear = _sha512_clear,
+        .m_free = _sha512_free
 };
 
 PyMODINIT_FUNC
 PyInit__sha512(void)
 {
-    PyObject *m;
-
-    Py_SET_TYPE(&SHA384type, &PyType_Type);
-    if (PyType_Ready(&SHA384type) < 0) {
-        return NULL;
-    }
-    Py_SET_TYPE(&SHA512type, &PyType_Type);
-    if (PyType_Ready(&SHA512type) < 0) {
-        return NULL;
-    }
-
-    m = PyModule_Create(&_sha512module);
-    if (m == NULL) {
-        return NULL;
-    }
-
-    Py_INCREF((PyObject *)&SHA384type);
-    PyModule_AddObject(m, "SHA384Type", (PyObject *)&SHA384type);
-    Py_INCREF((PyObject *)&SHA512type);
-    PyModule_AddObject(m, "SHA512Type", (PyObject *)&SHA512type);
-    return m;
+    return PyModuleDef_Init(&_sha512module);
 }
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
index 540e2d9..c3a5237 100644
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -4,37 +4,39 @@
 /* XXX Signals should be recorded per thread, now we have thread state. */
 
 #include "Python.h"
-#include "pycore_atomic.h"
-#include "pycore_call.h"
-#include "pycore_ceval.h"
-#include "pycore_pyerrors.h"
-#include "pycore_pystate.h"    // _PyThreadState_GET()
+#include "pycore_atomic.h"        // _Py_atomic_int
+#include "pycore_call.h"          // _PyObject_Call()
+#include "pycore_ceval.h"         // _PyEval_SignalReceived()
+#include "pycore_moduleobject.h"  // _PyModule_GetState()
+#include "pycore_pyerrors.h"      // _PyErr_SetString()
+#include "pycore_pylifecycle.h"   // NSIG
+#include "pycore_pystate.h"       // _PyThreadState_GET()
 
 #ifndef MS_WINDOWS
-#include "posixmodule.h"
+#  include "posixmodule.h"
 #endif
 #ifdef MS_WINDOWS
-#include "socketmodule.h"   /* needed for SOCKET_T */
+#  include "socketmodule.h"   /* needed for SOCKET_T */
 #endif
 
 #ifdef MS_WINDOWS
-#include <windows.h>
-#ifdef HAVE_PROCESS_H
-#include <process.h>
-#endif
+#  include <windows.h>
+#  ifdef HAVE_PROCESS_H
+#    include <process.h>
+#  endif
 #endif
 
 #ifdef HAVE_SIGNAL_H
-#include <signal.h>
+#  include <signal.h>
 #endif
 #ifdef HAVE_SYS_SYSCALL_H
-#include <sys/syscall.h>
+#  include <sys/syscall.h>
 #endif
 #ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
+#  include <sys/stat.h>
 #endif
 #ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
+#  include <sys/time.h>
 #endif
 
 #if defined(HAVE_PTHREAD_SIGMASK) && !defined(HAVE_BROKEN_PTHREAD_SIGMASK)
@@ -46,19 +48,7 @@
 #endif
 
 #ifndef SIG_ERR
-#define SIG_ERR ((PyOS_sighandler_t)(-1))
-#endif
-
-#ifndef NSIG
-# if defined(_NSIG)
-#  define NSIG _NSIG            /* For BSD/SysV */
-# elif defined(_SIGMAX)
-#  define NSIG (_SIGMAX + 1)    /* For QNX */
-# elif defined(SIGMAX)
-#  define NSIG (SIGMAX + 1)     /* For djgpp */
-# else
-#  define NSIG 64               /* Use a reasonable default value */
-# endif
+#  define SIG_ERR ((PyOS_sighandler_t)(-1))
 #endif
 
 #include "clinic/signalmodule.c.h"
@@ -68,6 +58,8 @@
 [clinic start generated code]*/
 /*[clinic end generated code: output=da39a3ee5e6b4b0d input=b0301a3bde5fe9d3]*/
 
+#ifdef HAVE_SETSIG_T
+
 /*[python input]
 
 class sigset_t_converter(CConverter):
@@ -76,6 +68,7 @@
 
 [python start generated code]*/
 /*[python end generated code: output=da39a3ee5e6b4b0d input=b5689d14466b6823]*/
+#endif
 
 /*
    NOTES ON THE INTERACTION BETWEEN SIGNALS AND THREADS
@@ -106,7 +99,10 @@
 
 static volatile struct {
     _Py_atomic_int tripped;
-    PyObject *func;
+    /* func is atomic to ensure that PyErr_SetInterrupt is async-signal-safe
+     * (even though it would probably be otherwise, anyway).
+     */
+    _Py_atomic_address func;
 } Handlers[NSIG];
 
 #ifdef MS_WINDOWS
@@ -120,7 +116,11 @@
 #else
 #define INVALID_FD (-1)
 static volatile struct {
+#ifdef __VXWORKS__
+    int fd;
+#else
     sig_atomic_t fd;
+#endif
     int warn_on_full_buffer;
 } wakeup = {.fd = INVALID_FD, .warn_on_full_buffer = 1};
 #endif
@@ -128,17 +128,64 @@
 /* Speed up sigcheck() when none tripped */
 static _Py_atomic_int is_tripped;
 
-static PyObject *DefaultHandler;
-static PyObject *IgnoreHandler;
-static PyObject *IntHandler;
-
+typedef struct {
+    PyObject *default_handler;
+    PyObject *ignore_handler;
 #ifdef MS_WINDOWS
-static HANDLE sigint_event = NULL;
+    HANDLE sigint_event;
+#endif
+} signal_state_t;
+
+// State shared by all Python interpreters
+static signal_state_t signal_global_state = {0};
+
+#if defined(HAVE_GETITIMER) || defined(HAVE_SETITIMER)
+#  define PYHAVE_ITIMER_ERROR
 #endif
 
-#ifdef HAVE_GETITIMER
-static PyObject *ItimerError;
+typedef struct {
+    PyObject *default_handler;  // borrowed ref (signal_global_state)
+    PyObject *ignore_handler;  // borrowed ref (signal_global_state)
+#ifdef PYHAVE_ITIMER_ERROR
+    PyObject *itimer_error;
+#endif
+} _signal_module_state;
 
+
+Py_LOCAL_INLINE(PyObject *)
+get_handler(int i)
+{
+    return (PyObject *)_Py_atomic_load(&Handlers[i].func);
+}
+
+Py_LOCAL_INLINE(void)
+set_handler(int i, PyObject* func)
+{
+    _Py_atomic_store(&Handlers[i].func, (uintptr_t)func);
+}
+
+
+static inline _signal_module_state*
+get_signal_state(PyObject *module)
+{
+    void *state = _PyModule_GetState(module);
+    assert(state != NULL);
+    return (_signal_module_state *)state;
+}
+
+
+static inline int
+compare_handler(PyObject *func, PyObject *dfl_ign_handler)
+{
+    assert(PyLong_CheckExact(dfl_ign_handler));
+    if (!PyLong_CheckExact(func)) {
+        return 0;
+    }
+    // Assume that comparison of two PyLong objects will never fail.
+    return PyObject_RichCompareBool(func, dfl_ign_handler, Py_EQ) == 1;
+}
+
+#ifdef HAVE_GETITIMER
 /* auxiliary functions for setitimer */
 static int
 timeval_from_double(PyObject *obj, struct timeval *tv)
@@ -189,19 +236,26 @@
 }
 #endif
 
+/*[clinic input]
+signal.default_int_handler
+    signalnum: int
+    frame: object
+    /
+
+The default handler for SIGINT installed by Python.
+
+It raises KeyboardInterrupt.
+[clinic start generated code]*/
+
 static PyObject *
-signal_default_int_handler(PyObject *self, PyObject *args)
+signal_default_int_handler_impl(PyObject *module, int signalnum,
+                                PyObject *frame)
+/*[clinic end generated code: output=bb11c2eb115ace4e input=efcd4a56a207acfd]*/
 {
     PyErr_SetNone(PyExc_KeyboardInterrupt);
     return NULL;
 }
 
-PyDoc_STRVAR(default_int_handler_doc,
-"default_int_handler(...)\n\
-\n\
-The default handler for SIGINT installed by Python.\n\
-It raises KeyboardInterrupt.");
-
 
 static int
 report_wakeup_write_error(void *data)
@@ -240,10 +294,6 @@
 static void
 trip_signal(int sig_num)
 {
-    unsigned char byte;
-    int fd;
-    Py_ssize_t rc;
-
     _Py_atomic_store_relaxed(&Handlers[sig_num].tripped, 1);
 
     /* Set is_tripped after setting .tripped, as it gets
@@ -275,6 +325,7 @@
        See bpo-30038 for more details.
     */
 
+    int fd;
 #ifdef MS_WINDOWS
     fd = Py_SAFE_DOWNCAST(wakeup.fd, SOCKET_T, int);
 #else
@@ -282,10 +333,10 @@
 #endif
 
     if (fd != INVALID_FD) {
-        byte = (unsigned char)sig_num;
+        unsigned char byte = (unsigned char)sig_num;
 #ifdef MS_WINDOWS
         if (wakeup.use_send) {
-            rc = send(fd, &byte, 1, 0);
+            Py_ssize_t rc = send(fd, &byte, 1, 0);
 
             if (rc < 0) {
                 int last_error = GetLastError();
@@ -305,7 +356,7 @@
         {
             /* _Py_write_noraise() retries write() if write() is interrupted by
                a signal (fails with EINTR). */
-            rc = _Py_write_noraise(fd, &byte, 1);
+            Py_ssize_t rc = _Py_write_noraise(fd, &byte, 1);
 
             if (rc < 0) {
                 if (wakeup.warn_on_full_buffer ||
@@ -348,8 +399,10 @@
     errno = save_errno;
 
 #ifdef MS_WINDOWS
-    if (sig_num == SIGINT)
-        SetEvent(sigint_event);
+    if (sig_num == SIGINT) {
+        signal_state_t *state = &signal_global_state;
+        SetEvent(state->sigint_event);
+    }
 #endif
 }
 
@@ -448,6 +501,7 @@
 signal_signal_impl(PyObject *module, int signalnum, PyObject *handler)
 /*[clinic end generated code: output=b44cfda43780f3a1 input=deee84af5fa0432c]*/
 {
+    _signal_module_state *modstate = get_signal_state(module);
     PyObject *old_handler;
     void (*func)(int);
 #ifdef MS_WINDOWS
@@ -482,21 +536,18 @@
                          "signal number out of range");
         return NULL;
     }
-    if (handler == IgnoreHandler) {
+    if (PyCallable_Check(handler)) {
+        func = signal_handler;
+    } else if (compare_handler(handler, modstate->ignore_handler)) {
         func = SIG_IGN;
-    }
-    else if (handler == DefaultHandler) {
+    } else if (compare_handler(handler, modstate->default_handler)) {
         func = SIG_DFL;
-    }
-    else if (!PyCallable_Check(handler)) {
+    } else {
         _PyErr_SetString(tstate, PyExc_TypeError,
                          "signal handler must be signal.SIG_IGN, "
                          "signal.SIG_DFL, or a callable object");
         return NULL;
     }
-    else {
-        func = signal_handler;
-    }
 
     /* Check for pending signals before changing signal handler */
     if (_PyErr_CheckSignalsTstate(tstate)) {
@@ -507,9 +558,8 @@
         return NULL;
     }
 
-    old_handler = Handlers[signalnum].func;
-    Py_INCREF(handler);
-    Handlers[signalnum].func = handler;
+    old_handler = get_handler(signalnum);
+    set_handler(signalnum, Py_NewRef(handler));
 
     if (old_handler != NULL) {
         return old_handler;
@@ -545,10 +595,9 @@
                         "signal number out of range");
         return NULL;
     }
-    old_handler = Handlers[signalnum].func;
+    old_handler = get_handler(signalnum);
     if (old_handler != NULL) {
-        Py_INCREF(old_handler);
-        return old_handler;
+        return Py_NewRef(old_handler);
     }
     else {
         Py_RETURN_NONE;
@@ -657,7 +706,19 @@
                         "signal number out of range");
         return NULL;
     }
-    if (siginterrupt(signalnum, flag)<0) {
+#ifdef HAVE_SIGACTION
+    struct sigaction act;
+    (void) sigaction(signalnum, NULL, &act);
+    if (flag) {
+        act.sa_flags &= ~SA_RESTART;
+    }
+    else {
+        act.sa_flags |= SA_RESTART;
+    }
+    if (sigaction(signalnum, &act, NULL) < 0) {
+#else
+    if (siginterrupt(signalnum, flag) < 0) {
+#endif
         PyErr_SetFromErrno(PyExc_OSError);
         return NULL;
     }
@@ -691,7 +752,7 @@
     if (sockfd == (SOCKET_T)(-1) && PyErr_Occurred())
         return NULL;
 #else
-    int fd, old_fd;
+    int fd;
 
     if (!PyArg_ParseTupleAndKeywords(args, kwds, "i|$p:set_wakeup_fd", kwlist,
                                      &fd, &warn_on_full_buffer))
@@ -773,7 +834,7 @@
         }
     }
 
-    old_fd = wakeup.fd;
+    int old_fd = wakeup.fd;
     wakeup.fd = fd;
     wakeup.warn_on_full_buffer = warn_on_full_buffer;
 
@@ -794,14 +855,14 @@
 int
 PySignal_SetWakeupFd(int fd)
 {
-    int old_fd;
-    if (fd < 0)
+    if (fd < 0) {
         fd = -1;
+    }
 
 #ifdef MS_WINDOWS
-    old_fd = Py_SAFE_DOWNCAST(wakeup.fd, SOCKET_T, int);
+    int old_fd = Py_SAFE_DOWNCAST(wakeup.fd, SOCKET_T, int);
 #else
-    old_fd = wakeup.fd;
+    int old_fd = wakeup.fd;
 #endif
     wakeup.fd = fd;
     wakeup.warn_on_full_buffer = 1;
@@ -810,7 +871,6 @@
 
 
 #ifdef HAVE_SETITIMER
-
 /*[clinic input]
 signal.setitimer
 
@@ -832,8 +892,9 @@
                       PyObject *interval)
 /*[clinic end generated code: output=65f9dcbddc35527b input=de43daf194e6f66f]*/
 {
-    struct itimerval new, old;
+    _signal_module_state *modstate = get_signal_state(module);
 
+    struct itimerval new;
     if (timeval_from_double(seconds, &new.it_value) < 0) {
         return NULL;
     }
@@ -842,19 +903,18 @@
     }
 
     /* Let OS check "which" value */
+    struct itimerval old;
     if (setitimer(which, &new, &old) != 0) {
-        PyErr_SetFromErrno(ItimerError);
+        PyErr_SetFromErrno(modstate->itimer_error);
         return NULL;
     }
 
     return itimer_retval(&old);
 }
-
-#endif
+#endif  // HAVE_SETITIMER
 
 
 #ifdef HAVE_GETITIMER
-
 /*[clinic input]
 signal.getitimer
 
@@ -868,18 +928,20 @@
 signal_getitimer_impl(PyObject *module, int which)
 /*[clinic end generated code: output=9e053175d517db40 input=f7d21d38f3490627]*/
 {
-    struct itimerval old;
+    _signal_module_state *modstate = get_signal_state(module);
 
+    struct itimerval old;
     if (getitimer(which, &old) != 0) {
-        PyErr_SetFromErrno(ItimerError);
+        PyErr_SetFromErrno(modstate->itimer_error);
         return NULL;
     }
 
     return itimer_retval(&old);
 }
+#endif // HAVE_GETITIMER
 
-#endif
 
+#ifdef HAVE_SIGSET_T
 #if defined(PYPTHREAD_SIGMASK) || defined(HAVE_SIGPENDING)
 static PyObject*
 sigset_to_set(sigset_t mask)
@@ -1011,9 +1073,9 @@
 }
 
 #endif   /* #ifdef HAVE_SIGWAIT */
+#endif   /* #ifdef HAVE_SIGSET_T */
 
-
-#if defined(HAVE_SIGFILLSET) || defined(MS_WINDOWS)
+#if (defined(HAVE_SIGFILLSET) && defined(HAVE_SIGSET_T)) || defined(MS_WINDOWS)
 
 /*[clinic input]
 signal.valid_signals
@@ -1051,11 +1113,11 @@
 #endif
 }
 
-#endif   /* #if defined(HAVE_SIGFILLSET) || defined(MS_WINDOWS) */
+#endif   /* #if (defined(HAVE_SIGFILLSET) && defined(HAVE_SIGSET_T)) || defined(MS_WINDOWS) */
+
 
 
 #if defined(HAVE_SIGWAITINFO) || defined(HAVE_SIGTIMEDWAIT)
-static int initialized;
 static PyStructSequence_Field struct_siginfo_fields[] = {
     {"si_signo",        "signal number"},
     {"si_code",         "signal code"},
@@ -1117,6 +1179,7 @@
 }
 #endif
 
+#ifdef HAVE_SIGSET_T
 #ifdef HAVE_SIGWAITINFO
 
 /*[clinic input]
@@ -1219,6 +1282,7 @@
 }
 
 #endif   /* #ifdef HAVE_SIGTIMEDWAIT */
+#endif   /* #ifdef HAVE_SIGSET_T */
 
 
 #if defined(HAVE_PTHREAD_KILL)
@@ -1297,7 +1361,7 @@
 /* List of functions defined in the module -- some of the methoddefs are
    defined to nothing if the corresponding C function is not available. */
 static PyMethodDef signal_methods[] = {
-    {"default_int_handler", signal_default_int_handler, METH_VARARGS, default_int_handler_doc},
+    SIGNAL_DEFAULT_INT_HANDLER_METHODDEF
     SIGNAL_ALARM_METHODDEF
     SIGNAL_SETITIMER_METHODDEF
     SIGNAL_GETITIMER_METHODDEF
@@ -1358,311 +1422,345 @@
 A signal handler function is called with two arguments:\n\
 the first is the signal number, the second is the interrupted stack frame.");
 
-static struct PyModuleDef signalmodule = {
+
+
+static int
+signal_add_constants(PyObject *module)
+{
+#define ADD_INT_MACRO(macro) \
+    if (PyModule_AddIntConstant(module, #macro, macro) < 0) { \
+        return -1; \
+    }
+
+    ADD_INT_MACRO(NSIG);
+
+    // SIG_xxx pthread_sigmask() constants
+#ifdef SIG_BLOCK
+    ADD_INT_MACRO(SIG_BLOCK);
+#endif
+#ifdef SIG_UNBLOCK
+    ADD_INT_MACRO(SIG_UNBLOCK);
+#endif
+#ifdef SIG_SETMASK
+    ADD_INT_MACRO(SIG_SETMASK);
+#endif
+
+    // SIGxxx signal number constants
+#ifdef SIGHUP
+    ADD_INT_MACRO(SIGHUP);
+#endif
+#ifdef SIGINT
+    ADD_INT_MACRO(SIGINT);
+#endif
+#ifdef SIGBREAK
+    ADD_INT_MACRO(SIGBREAK);
+#endif
+#ifdef SIGQUIT
+    ADD_INT_MACRO(SIGQUIT);
+#endif
+#ifdef SIGILL
+    ADD_INT_MACRO(SIGILL);
+#endif
+#ifdef SIGTRAP
+    ADD_INT_MACRO(SIGTRAP);
+#endif
+#ifdef SIGIOT
+    ADD_INT_MACRO(SIGIOT);
+#endif
+#ifdef SIGABRT
+    ADD_INT_MACRO(SIGABRT);
+#endif
+#ifdef SIGEMT
+    ADD_INT_MACRO(SIGEMT);
+#endif
+#ifdef SIGFPE
+    ADD_INT_MACRO(SIGFPE);
+#endif
+#ifdef SIGKILL
+    ADD_INT_MACRO(SIGKILL);
+#endif
+#ifdef SIGBUS
+    ADD_INT_MACRO(SIGBUS);
+#endif
+#ifdef SIGSEGV
+    ADD_INT_MACRO(SIGSEGV);
+#endif
+#ifdef SIGSYS
+    ADD_INT_MACRO(SIGSYS);
+#endif
+#ifdef SIGPIPE
+    ADD_INT_MACRO(SIGPIPE);
+#endif
+#ifdef SIGALRM
+    ADD_INT_MACRO(SIGALRM);
+#endif
+#ifdef SIGTERM
+    ADD_INT_MACRO(SIGTERM);
+#endif
+#ifdef SIGUSR1
+    ADD_INT_MACRO(SIGUSR1);
+#endif
+#ifdef SIGUSR2
+    ADD_INT_MACRO(SIGUSR2);
+#endif
+#ifdef SIGCLD
+    ADD_INT_MACRO(SIGCLD);
+#endif
+#ifdef SIGCHLD
+    ADD_INT_MACRO(SIGCHLD);
+#endif
+#ifdef SIGPWR
+    ADD_INT_MACRO(SIGPWR);
+#endif
+#ifdef SIGIO
+    ADD_INT_MACRO(SIGIO);
+#endif
+#ifdef SIGURG
+    ADD_INT_MACRO(SIGURG);
+#endif
+#ifdef SIGWINCH
+    ADD_INT_MACRO(SIGWINCH);
+#endif
+#ifdef SIGPOLL
+    ADD_INT_MACRO(SIGPOLL);
+#endif
+#ifdef SIGSTOP
+    ADD_INT_MACRO(SIGSTOP);
+#endif
+#ifdef SIGTSTP
+    ADD_INT_MACRO(SIGTSTP);
+#endif
+#ifdef SIGCONT
+    ADD_INT_MACRO(SIGCONT);
+#endif
+#ifdef SIGTTIN
+    ADD_INT_MACRO(SIGTTIN);
+#endif
+#ifdef SIGTTOU
+    ADD_INT_MACRO(SIGTTOU);
+#endif
+#ifdef SIGVTALRM
+    ADD_INT_MACRO(SIGVTALRM);
+#endif
+#ifdef SIGPROF
+    ADD_INT_MACRO(SIGPROF);
+#endif
+#ifdef SIGXCPU
+    ADD_INT_MACRO(SIGXCPU);
+#endif
+#ifdef SIGXFSZ
+    ADD_INT_MACRO(SIGXFSZ);
+#endif
+#ifdef SIGRTMIN
+    ADD_INT_MACRO(SIGRTMIN);
+#endif
+#ifdef SIGRTMAX
+    ADD_INT_MACRO(SIGRTMAX);
+#endif
+#ifdef SIGINFO
+    ADD_INT_MACRO(SIGINFO);
+#endif
+
+    // ITIMER_xxx constants
+#ifdef ITIMER_REAL
+    ADD_INT_MACRO(ITIMER_REAL);
+#endif
+#ifdef ITIMER_VIRTUAL
+    ADD_INT_MACRO(ITIMER_VIRTUAL);
+#endif
+#ifdef ITIMER_PROF
+    ADD_INT_MACRO(ITIMER_PROF);
+#endif
+
+    // CTRL_xxx Windows signals
+#ifdef CTRL_C_EVENT
+    ADD_INT_MACRO(CTRL_C_EVENT);
+#endif
+#ifdef CTRL_BREAK_EVENT
+    ADD_INT_MACRO(CTRL_BREAK_EVENT);
+#endif
+
+    return 0;
+
+#undef ADD_INT_MACRO
+}
+
+
+static int
+signal_get_set_handlers(signal_state_t *state, PyObject *mod_dict)
+{
+    // Get signal handlers
+    for (int signum = 1; signum < NSIG; signum++) {
+        void (*c_handler)(int) = PyOS_getsig(signum);
+        PyObject *func;
+        if (c_handler == SIG_DFL) {
+            func = state->default_handler;
+        }
+        else if (c_handler == SIG_IGN) {
+            func = state->ignore_handler;
+        }
+        else {
+            func = Py_None; // None of our business
+        }
+        // If signal_module_exec() is called more than one, we must
+        // clear the strong reference to the previous function.
+        PyObject* old_func = get_handler(signum);
+        set_handler(signum, Py_NewRef(func));
+        Py_XDECREF(old_func);
+    }
+
+    // Install Python SIGINT handler which raises KeyboardInterrupt
+    PyObject* sigint_func = get_handler(SIGINT);
+    if (sigint_func == state->default_handler) {
+        PyObject *int_handler = PyMapping_GetItemString(mod_dict,
+                                                        "default_int_handler");
+        if (!int_handler) {
+            return -1;
+        }
+
+        set_handler(SIGINT, int_handler);
+        Py_DECREF(sigint_func);
+        PyOS_setsig(SIGINT, signal_handler);
+    }
+    return 0;
+}
+
+
+static int
+signal_module_exec(PyObject *m)
+{
+    assert(!PyErr_Occurred());
+
+    signal_state_t *state = &signal_global_state;
+    _signal_module_state *modstate = get_signal_state(m);
+
+    modstate->default_handler = state->default_handler;  // borrowed ref
+    modstate->ignore_handler = state->ignore_handler;  // borrowed ref
+
+#ifdef PYHAVE_ITIMER_ERROR
+    modstate->itimer_error = PyErr_NewException("signal.itimer_error",
+                                                PyExc_OSError, NULL);
+    if (modstate->itimer_error == NULL) {
+        return -1;
+    }
+#endif
+
+    if (signal_add_constants(m) < 0) {
+        return -1;
+    }
+
+    /* Add some symbolic constants to the module */
+    PyObject *d = PyModule_GetDict(m);
+    if (PyDict_SetItemString(d, "SIG_DFL", state->default_handler) < 0) {
+        return -1;
+    }
+    if (PyDict_SetItemString(d, "SIG_IGN", state->ignore_handler) < 0) {
+        return -1;
+    }
+#ifdef PYHAVE_ITIMER_ERROR
+    if (PyDict_SetItemString(d, "ItimerError", modstate->itimer_error) < 0) {
+        return -1;
+    }
+#endif
+#if defined(HAVE_SIGWAITINFO) || defined(HAVE_SIGTIMEDWAIT)
+    if (PyModule_AddType(m, &SiginfoType) < 0) {
+        return -1;
+    }
+#endif
+
+    PyThreadState *tstate = _PyThreadState_GET();
+    if (_Py_IsMainInterpreter(tstate->interp)) {
+        if (signal_get_set_handlers(state, d) < 0) {
+            return -1;
+        }
+    }
+
+    assert(!PyErr_Occurred());
+    return 0;
+}
+
+
+#ifdef PYHAVE_ITIMER_ERROR
+static int
+_signal_module_traverse(PyObject *module, visitproc visit, void *arg)
+{
+    _signal_module_state *modstate = get_signal_state(module);
+    Py_VISIT(modstate->itimer_error);
+    return 0;
+}
+
+static int
+_signal_module_clear(PyObject *module)
+{
+    _signal_module_state *modstate = get_signal_state(module);
+    Py_CLEAR(modstate->itimer_error);
+    return 0;
+}
+
+static void
+_signal_module_free(void *module)
+{
+    _signal_module_clear((PyObject *)module);
+}
+#endif  // PYHAVE_ITIMER_ERROR
+
+
+static PyModuleDef_Slot signal_slots[] = {
+    {Py_mod_exec, signal_module_exec},
+    {0, NULL}
+};
+
+static struct PyModuleDef signal_module = {
     PyModuleDef_HEAD_INIT,
     "_signal",
-    module_doc,
-    -1,
-    signal_methods,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    .m_doc = module_doc,
+    .m_size = sizeof(_signal_module_state),
+    .m_methods = signal_methods,
+    .m_slots = signal_slots,
+#ifdef PYHAVE_ITIMER_ERROR
+    .m_traverse = _signal_module_traverse,
+    .m_clear = _signal_module_clear,
+    .m_free = _signal_module_free,
+#endif
 };
 
+
 PyMODINIT_FUNC
 PyInit__signal(void)
 {
-    PyObject *m, *d;
-    int i;
-
-    /* Create the module and add the functions */
-    m = PyModule_Create(&signalmodule);
-    if (m == NULL)
-        return NULL;
-
-#if defined(HAVE_SIGWAITINFO) || defined(HAVE_SIGTIMEDWAIT)
-    if (!initialized) {
-        if (PyStructSequence_InitType2(&SiginfoType, &struct_siginfo_desc) < 0)
-            return NULL;
-    }
-    Py_INCREF((PyObject*) &SiginfoType);
-    PyModule_AddObject(m, "struct_siginfo", (PyObject*) &SiginfoType);
-    initialized = 1;
-#endif
-
-    /* Add some symbolic constants to the module */
-    d = PyModule_GetDict(m);
-
-    DefaultHandler = PyLong_FromVoidPtr((void *)SIG_DFL);
-    if (!DefaultHandler ||
-        PyDict_SetItemString(d, "SIG_DFL", DefaultHandler) < 0) {
-        goto finally;
-    }
-
-    IgnoreHandler = PyLong_FromVoidPtr((void *)SIG_IGN);
-    if (!IgnoreHandler ||
-        PyDict_SetItemString(d, "SIG_IGN", IgnoreHandler) < 0) {
-        goto finally;
-    }
-
-    if (PyModule_AddIntMacro(m, NSIG))
-        goto finally;
-
-#ifdef SIG_BLOCK
-    if (PyModule_AddIntMacro(m, SIG_BLOCK))
-         goto finally;
-#endif
-#ifdef SIG_UNBLOCK
-    if (PyModule_AddIntMacro(m, SIG_UNBLOCK))
-         goto finally;
-#endif
-#ifdef SIG_SETMASK
-    if (PyModule_AddIntMacro(m, SIG_SETMASK))
-         goto finally;
-#endif
-
-    IntHandler = PyDict_GetItemString(d, "default_int_handler");
-    if (!IntHandler)
-        goto finally;
-    Py_INCREF(IntHandler);
-
-    _Py_atomic_store_relaxed(&Handlers[0].tripped, 0);
-    for (i = 1; i < NSIG; i++) {
-        void (*t)(int);
-        t = PyOS_getsig(i);
-        _Py_atomic_store_relaxed(&Handlers[i].tripped, 0);
-        if (t == SIG_DFL)
-            Handlers[i].func = DefaultHandler;
-        else if (t == SIG_IGN)
-            Handlers[i].func = IgnoreHandler;
-        else
-            Handlers[i].func = Py_None; /* None of our business */
-        Py_INCREF(Handlers[i].func);
-    }
-    if (Handlers[SIGINT].func == DefaultHandler) {
-        /* Install default int handler */
-        Py_INCREF(IntHandler);
-        Py_SETREF(Handlers[SIGINT].func, IntHandler);
-        PyOS_setsig(SIGINT, signal_handler);
-    }
-
-#ifdef SIGHUP
-    if (PyModule_AddIntMacro(m, SIGHUP))
-         goto finally;
-#endif
-#ifdef SIGINT
-    if (PyModule_AddIntMacro(m, SIGINT))
-         goto finally;
-#endif
-#ifdef SIGBREAK
-    if (PyModule_AddIntMacro(m, SIGBREAK))
-         goto finally;
-#endif
-#ifdef SIGQUIT
-    if (PyModule_AddIntMacro(m, SIGQUIT))
-         goto finally;
-#endif
-#ifdef SIGILL
-    if (PyModule_AddIntMacro(m, SIGILL))
-         goto finally;
-#endif
-#ifdef SIGTRAP
-    if (PyModule_AddIntMacro(m, SIGTRAP))
-         goto finally;
-#endif
-#ifdef SIGIOT
-    if (PyModule_AddIntMacro(m, SIGIOT))
-         goto finally;
-#endif
-#ifdef SIGABRT
-    if (PyModule_AddIntMacro(m, SIGABRT))
-         goto finally;
-#endif
-#ifdef SIGEMT
-    if (PyModule_AddIntMacro(m, SIGEMT))
-         goto finally;
-#endif
-#ifdef SIGFPE
-    if (PyModule_AddIntMacro(m, SIGFPE))
-         goto finally;
-#endif
-#ifdef SIGKILL
-    if (PyModule_AddIntMacro(m, SIGKILL))
-         goto finally;
-#endif
-#ifdef SIGBUS
-    if (PyModule_AddIntMacro(m, SIGBUS))
-         goto finally;
-#endif
-#ifdef SIGSEGV
-    if (PyModule_AddIntMacro(m, SIGSEGV))
-         goto finally;
-#endif
-#ifdef SIGSYS
-    if (PyModule_AddIntMacro(m, SIGSYS))
-         goto finally;
-#endif
-#ifdef SIGPIPE
-    if (PyModule_AddIntMacro(m, SIGPIPE))
-         goto finally;
-#endif
-#ifdef SIGALRM
-    if (PyModule_AddIntMacro(m, SIGALRM))
-         goto finally;
-#endif
-#ifdef SIGTERM
-    if (PyModule_AddIntMacro(m, SIGTERM))
-         goto finally;
-#endif
-#ifdef SIGUSR1
-    if (PyModule_AddIntMacro(m, SIGUSR1))
-         goto finally;
-#endif
-#ifdef SIGUSR2
-    if (PyModule_AddIntMacro(m, SIGUSR2))
-         goto finally;
-#endif
-#ifdef SIGCLD
-    if (PyModule_AddIntMacro(m, SIGCLD))
-         goto finally;
-#endif
-#ifdef SIGCHLD
-    if (PyModule_AddIntMacro(m, SIGCHLD))
-         goto finally;
-#endif
-#ifdef SIGPWR
-    if (PyModule_AddIntMacro(m, SIGPWR))
-         goto finally;
-#endif
-#ifdef SIGIO
-    if (PyModule_AddIntMacro(m, SIGIO))
-         goto finally;
-#endif
-#ifdef SIGURG
-    if (PyModule_AddIntMacro(m, SIGURG))
-         goto finally;
-#endif
-#ifdef SIGWINCH
-    if (PyModule_AddIntMacro(m, SIGWINCH))
-         goto finally;
-#endif
-#ifdef SIGPOLL
-    if (PyModule_AddIntMacro(m, SIGPOLL))
-         goto finally;
-#endif
-#ifdef SIGSTOP
-    if (PyModule_AddIntMacro(m, SIGSTOP))
-         goto finally;
-#endif
-#ifdef SIGTSTP
-    if (PyModule_AddIntMacro(m, SIGTSTP))
-         goto finally;
-#endif
-#ifdef SIGCONT
-    if (PyModule_AddIntMacro(m, SIGCONT))
-         goto finally;
-#endif
-#ifdef SIGTTIN
-    if (PyModule_AddIntMacro(m, SIGTTIN))
-         goto finally;
-#endif
-#ifdef SIGTTOU
-    if (PyModule_AddIntMacro(m, SIGTTOU))
-         goto finally;
-#endif
-#ifdef SIGVTALRM
-    if (PyModule_AddIntMacro(m, SIGVTALRM))
-         goto finally;
-#endif
-#ifdef SIGPROF
-    if (PyModule_AddIntMacro(m, SIGPROF))
-         goto finally;
-#endif
-#ifdef SIGXCPU
-    if (PyModule_AddIntMacro(m, SIGXCPU))
-         goto finally;
-#endif
-#ifdef SIGXFSZ
-    if (PyModule_AddIntMacro(m, SIGXFSZ))
-         goto finally;
-#endif
-#ifdef SIGRTMIN
-    if (PyModule_AddIntMacro(m, SIGRTMIN))
-         goto finally;
-#endif
-#ifdef SIGRTMAX
-    if (PyModule_AddIntMacro(m, SIGRTMAX))
-         goto finally;
-#endif
-#ifdef SIGINFO
-    if (PyModule_AddIntMacro(m, SIGINFO))
-         goto finally;
-#endif
-
-#ifdef ITIMER_REAL
-    if (PyModule_AddIntMacro(m, ITIMER_REAL))
-         goto finally;
-#endif
-#ifdef ITIMER_VIRTUAL
-    if (PyModule_AddIntMacro(m, ITIMER_VIRTUAL))
-         goto finally;
-#endif
-#ifdef ITIMER_PROF
-    if (PyModule_AddIntMacro(m, ITIMER_PROF))
-         goto finally;
-#endif
-
-#if defined (HAVE_SETITIMER) || defined (HAVE_GETITIMER)
-    ItimerError = PyErr_NewException("signal.ItimerError",
-            PyExc_OSError, NULL);
-    if (!ItimerError ||
-        PyDict_SetItemString(d, "ItimerError", ItimerError) < 0) {
-        goto finally;
-    }
-#endif
-
-#ifdef CTRL_C_EVENT
-    if (PyModule_AddIntMacro(m, CTRL_C_EVENT))
-         goto finally;
-#endif
-
-#ifdef CTRL_BREAK_EVENT
-    if (PyModule_AddIntMacro(m, CTRL_BREAK_EVENT))
-         goto finally;
-#endif
-
-    if (PyErr_Occurred()) {
-        Py_DECREF(m);
-        m = NULL;
-    }
-
-  finally:
-    return m;
+    return PyModuleDef_Init(&signal_module);
 }
 
-static void
-finisignal(void)
-{
-    int i;
-    PyObject *func;
 
-    for (i = 1; i < NSIG; i++) {
-        func = Handlers[i].func;
-        _Py_atomic_store_relaxed(&Handlers[i].tripped, 0);
-        Handlers[i].func = NULL;
-        if (func != NULL && func != Py_None &&
-            func != DefaultHandler && func != IgnoreHandler)
-            PyOS_setsig(i, SIG_DFL);
+void
+_PySignal_Fini(void)
+{
+    signal_state_t *state = &signal_global_state;
+
+    // Restore default signals and clear handlers
+    for (int signum = 1; signum < NSIG; signum++) {
+        PyObject *func = get_handler(signum);
+        _Py_atomic_store_relaxed(&Handlers[signum].tripped, 0);
+        set_handler(signum, NULL);
+        if (func != NULL
+            && func != Py_None
+            && !compare_handler(func, state->default_handler)
+            && !compare_handler(func, state->ignore_handler))
+        {
+            PyOS_setsig(signum, SIG_DFL);
+        }
         Py_XDECREF(func);
     }
 
-    Py_CLEAR(IntHandler);
-    Py_CLEAR(DefaultHandler);
-    Py_CLEAR(IgnoreHandler);
-#ifdef HAVE_GETITIMER
-    Py_CLEAR(ItimerError);
+#ifdef MS_WINDOWS
+    if (state->sigint_event != NULL) {
+        CloseHandle(state->sigint_event);
+        state->sigint_event = NULL;
+    }
 #endif
+
+    Py_CLEAR(state->default_handler);
+    Py_CLEAR(state->ignore_handler);
 }
 
 
@@ -1708,16 +1806,42 @@
         frame = Py_None;
     }
 
+    signal_state_t *state = &signal_global_state;
     for (int i = 1; i < NSIG; i++) {
         if (!_Py_atomic_load_relaxed(&Handlers[i].tripped)) {
             continue;
         }
         _Py_atomic_store_relaxed(&Handlers[i].tripped, 0);
 
+        /* Signal handlers can be modified while a signal is received,
+         * and therefore the fact that trip_signal() or PyErr_SetInterrupt()
+         * was called doesn't guarantee that there is still a Python
+         * signal handler for it by the time PyErr_CheckSignals() is called
+         * (see bpo-43406).
+         */
+        PyObject *func = get_handler(i);
+        if (func == NULL || func == Py_None ||
+            compare_handler(func, state->ignore_handler) ||
+            compare_handler(func, state->default_handler)) {
+            /* No Python signal handler due to aforementioned race condition.
+             * We can't call raise() as it would break the assumption
+             * that PyErr_SetInterrupt() only *simulates* an incoming
+             * signal (i.e. it will never kill the process).
+             * We also don't want to interrupt user code with a cryptic
+             * asynchronous exception, so instead just write out an
+             * unraisable error.
+             */
+            PyErr_Format(PyExc_OSError,
+                         "Signal %i ignored due to race condition",
+                         i);
+            PyErr_WriteUnraisable(Py_None);
+            continue;
+        }
+
         PyObject *arglist = Py_BuildValue("(iO)", i, frame);
         PyObject *result;
         if (arglist) {
-            result = _PyObject_Call(tstate, Handlers[i].func, arglist, NULL);
+            result = _PyObject_Call(tstate, func, arglist, NULL);
             Py_DECREF(arglist);
         }
         else {
@@ -1745,30 +1869,32 @@
 }
 
 
-/* Simulate the effect of a signal.SIGINT signal arriving. The next time
-   PyErr_CheckSignals is called,  the Python SIGINT signal handler will be
-   raised.
+/* Simulate the effect of a signal arriving. The next time PyErr_CheckSignals
+   is called,  the corresponding Python signal handler will be raised.
 
-   Missing signal handler for the SIGINT signal is silently ignored. */
+   Missing signal handler for the given signal number is silently ignored. */
+int
+PyErr_SetInterruptEx(int signum)
+{
+    if (signum < 1 || signum >= NSIG) {
+        return -1;
+    }
+
+    signal_state_t *state = &signal_global_state;
+    PyObject *func = get_handler(signum);
+    if (!compare_handler(func, state->ignore_handler)
+            && !compare_handler(func, state->default_handler)) {
+        trip_signal(signum);
+    }
+    return 0;
+}
+
 void
 PyErr_SetInterrupt(void)
 {
-    if ((Handlers[SIGINT].func != IgnoreHandler) &&
-        (Handlers[SIGINT].func != DefaultHandler)) {
-        trip_signal(SIGINT);
-    }
+    (void) PyErr_SetInterruptEx(SIGINT);
 }
 
-void
-PyOS_InitInterrupts(void)
-{
-    PyObject *m = PyImport_ImportModule("_signal");
-    if (m) {
-        Py_DECREF(m);
-    }
-}
-
-
 static int
 signal_install_handlers(void)
 {
@@ -1793,18 +1919,65 @@
 }
 
 
+/* Restore signals that the interpreter has called SIG_IGN on to SIG_DFL.
+ *
+ * All of the code in this function must only use async-signal-safe functions,
+ * listed at `man 7 signal` or
+ * http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html.
+ *
+ * If this function is updated, update also _posix_spawn() of subprocess.py.
+ */
+void
+_Py_RestoreSignals(void)
+{
+#ifdef SIGPIPE
+    PyOS_setsig(SIGPIPE, SIG_DFL);
+#endif
+#ifdef SIGXFZ
+    PyOS_setsig(SIGXFZ, SIG_DFL);
+#endif
+#ifdef SIGXFSZ
+    PyOS_setsig(SIGXFSZ, SIG_DFL);
+#endif
+}
+
+
 int
 _PySignal_Init(int install_signal_handlers)
 {
+    signal_state_t *state = &signal_global_state;
+
+    state->default_handler = PyLong_FromVoidPtr((void *)SIG_DFL);
+    if (state->default_handler == NULL) {
+        return -1;
+    }
+
+    state->ignore_handler = PyLong_FromVoidPtr((void *)SIG_IGN);
+    if (state->ignore_handler == NULL) {
+        return -1;
+    }
+
 #ifdef MS_WINDOWS
     /* Create manual-reset event, initially unset */
-    sigint_event = CreateEvent(NULL, TRUE, FALSE, FALSE);
-    if (sigint_event == NULL) {
+    state->sigint_event = CreateEvent(NULL, TRUE, FALSE, FALSE);
+    if (state->sigint_event == NULL) {
         PyErr_SetFromWindowsErr(0);
         return -1;
     }
 #endif
 
+#if defined(HAVE_SIGWAITINFO) || defined(HAVE_SIGTIMEDWAIT)
+    if (SiginfoType.tp_name == NULL) {
+        if (PyStructSequence_InitType2(&SiginfoType, &struct_siginfo_desc) < 0) {
+            return -1;
+        }
+    }
+#endif
+
+    for (int signum = 1; signum < NSIG; signum++) {
+        _Py_atomic_store_relaxed(&Handlers[signum].tripped, 0);
+    }
+
     if (install_signal_handlers) {
         if (signal_install_handlers() < 0) {
             return -1;
@@ -1815,13 +1988,6 @@
 }
 
 
-void
-PyOS_FiniInterrupts(void)
-{
-    finisignal();
-}
-
-
 // The caller doesn't have to hold the GIL
 int
 _PyOS_InterruptOccurred(PyThreadState *tstate)
@@ -1849,14 +2015,16 @@
 }
 
 
+#ifdef HAVE_FORK
 static void
 _clear_pending_signals(void)
 {
-    int i;
-    if (!_Py_atomic_load(&is_tripped))
+    if (!_Py_atomic_load(&is_tripped)) {
         return;
+    }
+
     _Py_atomic_store(&is_tripped, 0);
-    for (i = 1; i < NSIG; ++i) {
+    for (int i = 1; i < NSIG; ++i) {
         _Py_atomic_store_relaxed(&Handlers[i].tripped, 0);
     }
 }
@@ -1869,6 +2037,8 @@
      * the interpreter had an opportunity to call the handlers.  issue9535. */
     _clear_pending_signals();
 }
+#endif   /* HAVE_FORK */
+
 
 int
 _PyOS_IsMainThread(void)
@@ -1878,13 +2048,14 @@
 }
 
 #ifdef MS_WINDOWS
+/* Returns a manual-reset event which gets tripped whenever
+   SIGINT is received.
+
+   Python.h does not include windows.h so we do cannot use HANDLE
+   as the return type of this function.  We use void* instead. */
 void *_PyOS_SigintEvent(void)
 {
-    /* Returns a manual-reset event which gets tripped whenever
-       SIGINT is received.
-
-       Python.h does not include windows.h so we do cannot use HANDLE
-       as the return type of this function.  We use void* instead. */
-    return sigint_event;
+    signal_state_t *state = &signal_global_state;
+    return state->sigint_event;
 }
 #endif
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 76ef606..ab8618b 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -45,7 +45,7 @@
 - socket.if_nameindex() -> list of tuples (if_index, if_name)
 - socket.if_nametoindex(name) -> corresponding interface index
 - socket.if_indextoname(index) -> corresponding interface name
-- an Internet socket address is a pair (hostname, port)
+- an internet socket address is a pair (hostname, port)
   where hostname can be anything recognized by gethostbyname()
   (including the dd.dd.dd.dd notation) and port is in host byte order
 - where a hostname is returned, the dd.dd.dd.dd notation is used
@@ -151,9 +151,6 @@
 setsockopt(level, optname, value[, optlen]) -- set socket options\n\
 settimeout(None | float) -- set or clear the timeout\n\
 shutdown(how) -- shut down traffic in one or both directions\n\
-if_nameindex() -- return all network interface indices and names\n\
-if_nametoindex(name) -- return the corresponding interface index\n\
-if_indextoname(index) -- return the corresponding interface name\n\
 \n\
  [*] not available on all platforms!");
 
@@ -197,43 +194,6 @@
 # define USE_GETHOSTBYNAME_LOCK
 #endif
 
-/* To use __FreeBSD_version, __OpenBSD__, and __NetBSD_Version__ */
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-/* On systems on which getaddrinfo() is believed to not be thread-safe,
-   (this includes the getaddrinfo emulation) protect access with a lock.
-
-   getaddrinfo is thread-safe on Mac OS X 10.5 and later. Originally it was
-   a mix of code including an unsafe implementation from an old BSD's
-   libresolv. In 10.5 Apple reimplemented it as a safe IPC call to the
-   mDNSResponder process. 10.5 is the first be UNIX '03 certified, which
-   includes the requirement that getaddrinfo be thread-safe. See issue #25924.
-
-   It's thread-safe in OpenBSD starting with 5.4, released Nov 2013:
-   http://www.openbsd.org/plus54.html
-
-   It's thread-safe in NetBSD starting with 4.0, released Dec 2007:
-
-http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/net/getaddrinfo.c.diff?r1=1.82&r2=1.83
- */
-#if ((defined(__APPLE__) && \
-        MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5) || \
-    (defined(__FreeBSD__) && __FreeBSD_version+0 < 503000) || \
-    (defined(__OpenBSD__) && OpenBSD+0 < 201311) || \
-    (defined(__NetBSD__) && __NetBSD_Version__+0 < 400000000) || \
-    !defined(HAVE_GETADDRINFO))
-#define USE_GETADDRINFO_LOCK
-#endif
-
-#ifdef USE_GETADDRINFO_LOCK
-#define ACQUIRE_GETADDRINFO_LOCK PyThread_acquire_lock(netdb_lock, 1);
-#define RELEASE_GETADDRINFO_LOCK PyThread_release_lock(netdb_lock);
-#else
-#define ACQUIRE_GETADDRINFO_LOCK
-#define RELEASE_GETADDRINFO_LOCK
-#endif
-
 #if defined(__APPLE__) || defined(__CYGWIN__) || defined(__NetBSD__)
 #  include <sys/ioctl.h>
 #endif
@@ -361,7 +321,7 @@
     {14393, "TCP_FASTOPEN"}
 };
 
-static void
+static int
 remove_unusable_flags(PyObject *m)
 {
     PyObject *dict;
@@ -370,7 +330,7 @@
 
     dict = PyModule_GetDict(m);
     if (dict == NULL) {
-        return;
+        return -1;
     }
 
     /* set to Windows 10, except BuildNumber. */
@@ -396,19 +356,19 @@
             break;
         }
         else {
-            if (PyDict_GetItemString(
-                    dict,
-                    win_runtime_flags[i].flag_name) != NULL)
-            {
-                if (PyDict_DelItemString(
-                        dict,
-                        win_runtime_flags[i].flag_name))
-                {
-                    PyErr_Clear();
-                }
+            PyObject *flag_name = PyUnicode_FromString(win_runtime_flags[i].flag_name);
+            if (flag_name == NULL) {
+                return -1;
             }
+            PyObject *v = _PyDict_Pop(dict, flag_name, Py_None);
+            Py_DECREF(flag_name);
+            if (v == NULL) {
+                return -1;
+            }
+            Py_DECREF(v);
         }
     }
+    return 0;
 }
 
 #endif
@@ -551,7 +511,6 @@
    by this module (but not argument type or memory errors, etc.). */
 static PyObject *socket_herror;
 static PyObject *socket_gaierror;
-static PyObject *socket_timeout;
 
 /* A forward reference to the socket type object.
    The sock_type variable contains pointers to various functions,
@@ -923,7 +882,7 @@
                 if (err)
                     *err = SOCK_TIMEOUT_ERR;
                 else
-                    PyErr_SetString(socket_timeout, "timed out");
+                    PyErr_SetString(PyExc_TimeoutError, "timed out");
                 return -1;
             }
 
@@ -968,7 +927,7 @@
                reading, but the data then discarded by the OS because of a
                wrong checksum.
 
-               Loop on select() to recheck for socket readyness. */
+               Loop on select() to recheck for socket readiness. */
             continue;
         }
 
@@ -1060,7 +1019,7 @@
 
 /* Lock to allow python interpreter to continue, but only allow one
    thread to be in gethostbyname or getaddrinfo */
-#if defined(USE_GETHOSTBYNAME_LOCK) || defined(USE_GETADDRINFO_LOCK)
+#if defined(USE_GETHOSTBYNAME_LOCK)
 static PyThread_type_lock netdb_lock;
 #endif
 
@@ -1085,14 +1044,12 @@
         hints.ai_socktype = SOCK_DGRAM;         /*dummy*/
         hints.ai_flags = AI_PASSIVE;
         Py_BEGIN_ALLOW_THREADS
-        ACQUIRE_GETADDRINFO_LOCK
         error = getaddrinfo(NULL, "0", &hints, &res);
         Py_END_ALLOW_THREADS
         /* We assume that those thread-unsafe getaddrinfo() versions
            *are* safe regarding their return value, ie. that a
            subsequent call to getaddrinfo() does not destroy the
            outcome of the first call. */
-        RELEASE_GETADDRINFO_LOCK
         if (error) {
             set_gaierror(error);
             return -1;
@@ -1193,7 +1150,6 @@
     memset(&hints, 0, sizeof(hints));
     hints.ai_family = af;
     Py_BEGIN_ALLOW_THREADS
-    ACQUIRE_GETADDRINFO_LOCK
     error = getaddrinfo(name, NULL, &hints, &res);
 #if defined(__digital__) && defined(__unix__)
     if (error == EAI_NONAME && af == AF_UNSPEC) {
@@ -1204,7 +1160,6 @@
     }
 #endif
     Py_END_ALLOW_THREADS
-    RELEASE_GETADDRINFO_LOCK  /* see comment in setipaddr() */
     if (error) {
         set_gaierror(error);
         return -1;
@@ -1558,10 +1513,10 @@
 #ifdef CAN_J1939
           case CAN_J1939:
           {
-              return Py_BuildValue("O&KkB", PyUnicode_DecodeFSDefault,
+              return Py_BuildValue("O&KIB", PyUnicode_DecodeFSDefault,
                                           ifname,
-                                          a->can_addr.j1939.name,
-                                          a->can_addr.j1939.pgn,
+                                          (unsigned long long)a->can_addr.j1939.name,
+                                          (unsigned int)a->can_addr.j1939.pgn,
                                           a->can_addr.j1939.addr);
           }
 #endif /* CAN_J1939 */
@@ -2252,13 +2207,13 @@
             PyObject *interfaceName;
             struct ifreq ifr;
             Py_ssize_t len;
-            uint64_t j1939_name;
-            uint32_t j1939_pgn;
+            unsigned long long j1939_name; /* at least 64 bits */
+            unsigned int j1939_pgn; /* at least 32 bits */
             uint8_t j1939_addr;
 
             struct sockaddr_can *addr = &addrbuf->can;
 
-            if (!PyArg_ParseTuple(args, "O&KkB", PyUnicode_FSConverter,
+            if (!PyArg_ParseTuple(args, "O&KIB", PyUnicode_FSConverter,
                                               &interfaceName,
                                               &j1939_name,
                                               &j1939_pgn,
@@ -2286,8 +2241,8 @@
 
             addr->can_family = AF_CAN;
             addr->can_ifindex = ifr.ifr_ifindex;
-            addr->can_addr.j1939.name = j1939_name;
-            addr->can_addr.j1939.pgn = j1939_pgn;
+            addr->can_addr.j1939.name = (uint64_t)j1939_name;
+            addr->can_addr.j1939.pgn = (uint32_t)j1939_pgn;
             addr->can_addr.j1939.addr = j1939_addr;
 
             *len_ret = sizeof(*addr);
@@ -2921,7 +2876,7 @@
     /* Blocking mode for a Python socket object means that operations
        like :meth:`recv` or :meth:`sendall` will block the execution of
        the current thread until they are complete or aborted with a
-       `socket.timeout` or `socket.error` errors.  When timeout is `None`,
+       `TimeoutError` or `socket.error` errors.  When timeout is `None`,
        the underlying FD is in a blocking mode.  When timeout is a positive
        number, the FD is in a non-blocking mode, and socket ops are
        implemented with a `select()` call.
@@ -3407,8 +3362,9 @@
 PyDoc_STRVAR(getsockname_doc,
 "getsockname() -> address info\n\
 \n\
-Return the address of the local endpoint.  For IP sockets, the address\n\
-info is a pair (hostaddr, port).");
+Return the address of the local endpoint. The format depends on the\n\
+address family. For IPv4 sockets, the address info is a pair\n\
+(hostaddr, port).");
 
 
 #ifdef HAVE_GETPEERNAME         /* Cray APP doesn't have this :-( */
@@ -4247,7 +4203,7 @@
             }
 
             if (interval <= 0) {
-                PyErr_SetString(socket_timeout, "timed out");
+                PyErr_SetString(PyExc_TimeoutError, "timed out");
                 goto done;
             }
         }
@@ -5195,13 +5151,6 @@
         else
 #endif
         {
-
-            if (PyFloat_Check(fdobj)) {
-                PyErr_SetString(PyExc_TypeError,
-                                "integer argument expected, got float");
-                return -1;
-            }
-
             fd = PyLong_AsSocket_t(fdobj);
             if (fd == (SOCKET_T)(-1) && PyErr_Occurred())
                 return -1;
@@ -5556,7 +5505,7 @@
 #ifdef MS_WINDOWS
     /* Issue #26227: gethostbyaddr() returns a string encoded
      * to the ANSI code page */
-    return PyUnicode_DecodeFSDefault(name);
+    return PyUnicode_DecodeMBCS(name, strlen(name), "surrogatepass");
 #else
     /* Decode from UTF-8 */
     return PyUnicode_FromString(name);
@@ -6150,13 +6099,10 @@
         return NULL;
     }
     if (x > 0xffff) {
-        if (PyErr_WarnEx(PyExc_DeprecationWarning,
-                         "ntohs: Python int too large to convert to C "
-                         "16-bit unsigned integer (The silent truncation "
-                         "is deprecated)",
-                         1)) {
-            return NULL;
-        }
+        PyErr_SetString(PyExc_OverflowError,
+                        "ntohs: Python int too large to convert to C "
+                        "16-bit unsigned integer");
+        return NULL;
     }
     return PyLong_FromUnsignedLong(ntohs((unsigned short)x));
 }
@@ -6164,12 +6110,7 @@
 PyDoc_STRVAR(ntohs_doc,
 "ntohs(integer) -> integer\n\
 \n\
-Convert a 16-bit unsigned integer from network to host byte order.\n\
-Note that in case the received integer does not fit in 16-bit unsigned\n\
-integer, but does fit in a positive C int, it is silently truncated to\n\
-16-bit unsigned integer.\n\
-However, this silent truncation feature is deprecated, and will raise an\n\
-exception in future versions of Python.");
+Convert a 16-bit unsigned integer from network to host byte order.");
 
 
 static PyObject *
@@ -6221,13 +6162,10 @@
         return NULL;
     }
     if (x > 0xffff) {
-        if (PyErr_WarnEx(PyExc_DeprecationWarning,
-                         "htons: Python int too large to convert to C "
-                         "16-bit unsigned integer (The silent truncation "
-                         "is deprecated)",
-                         1)) {
-            return NULL;
-        }
+        PyErr_SetString(PyExc_OverflowError,
+                        "htons: Python int too large to convert to C "
+                        "16-bit unsigned integer");
+        return NULL;
     }
     return PyLong_FromUnsignedLong(htons((unsigned short)x));
 }
@@ -6235,12 +6173,7 @@
 PyDoc_STRVAR(htons_doc,
 "htons(integer) -> integer\n\
 \n\
-Convert a 16-bit unsigned integer from host to network byte order.\n\
-Note that in case the received integer does not fit in 16-bit unsigned\n\
-integer, but does fit in a positive C int, it is silently truncated to\n\
-16-bit unsigned integer.\n\
-However, this silent truncation feature is deprecated, and will raise an\n\
-exception in future versions of Python.");
+Convert a 16-bit unsigned integer from host to network byte order.");
 
 
 static PyObject *
@@ -6569,10 +6502,8 @@
     hints.ai_protocol = protocol;
     hints.ai_flags = flags;
     Py_BEGIN_ALLOW_THREADS
-    ACQUIRE_GETADDRINFO_LOCK
     error = getaddrinfo(hptr, pptr, &hints, &res0);
     Py_END_ALLOW_THREADS
-    RELEASE_GETADDRINFO_LOCK  /* see comment in setipaddr() */
     if (error) {
         set_gaierror(error);
         goto err;
@@ -6665,10 +6596,8 @@
     hints.ai_socktype = SOCK_DGRAM;     /* make numeric port happy */
     hints.ai_flags = AI_NUMERICHOST;    /* don't do any name resolution */
     Py_BEGIN_ALLOW_THREADS
-    ACQUIRE_GETADDRINFO_LOCK
     error = getaddrinfo(hostp, pbuf, &hints, &res);
     Py_END_ALLOW_THREADS
-    RELEASE_GETADDRINFO_LOCK  /* see comment in setipaddr() */
     if (error) {
         set_gaierror(error);
         goto fail;
@@ -7101,16 +7030,36 @@
 }
 #endif
 
-
-/* C API table - always add new things to the end for binary
-   compatibility. */
-static
-PySocketModule_APIObject PySocketModuleAPI =
+static void
+sock_free_api(PySocketModule_APIObject *capi)
 {
-    &sock_type,
-    NULL,
-    NULL
-};
+    Py_DECREF(capi->Sock_Type);
+    Py_DECREF(capi->error);
+    Py_DECREF(capi->timeout_error);
+    PyMem_Free(capi);
+}
+
+static void
+sock_destroy_api(PyObject *capsule)
+{
+    void *capi = PyCapsule_GetPointer(capsule, PySocket_CAPSULE_NAME);
+    sock_free_api(capi);
+}
+
+static PySocketModule_APIObject *
+sock_get_api(void)
+{
+    PySocketModule_APIObject *capi = PyMem_Malloc(sizeof(PySocketModule_APIObject));
+    if (capi == NULL) {
+        PyErr_NoMemory();
+        return NULL;
+    }
+
+    capi->Sock_Type = (PyTypeObject *)Py_NewRef(&sock_type);
+    capi->error = Py_NewRef(PyExc_OSError);
+    capi->timeout_error = Py_NewRef(PyExc_TimeoutError);
+    return capi;
+}
 
 
 /* Initialize the _socket module.
@@ -7160,8 +7109,6 @@
         return NULL;
 
     Py_INCREF(PyExc_OSError);
-    PySocketModuleAPI.error = PyExc_OSError;
-    Py_INCREF(PyExc_OSError);
     PyModule_AddObject(m, "error", PyExc_OSError);
     socket_herror = PyErr_NewException("socket.herror",
                                        PyExc_OSError, NULL);
@@ -7175,13 +7122,8 @@
         return NULL;
     Py_INCREF(socket_gaierror);
     PyModule_AddObject(m, "gaierror", socket_gaierror);
-    socket_timeout = PyErr_NewException("socket.timeout",
-                                        PyExc_OSError, NULL);
-    if (socket_timeout == NULL)
-        return NULL;
-    PySocketModuleAPI.timeout_error = socket_timeout;
-    Py_INCREF(socket_timeout);
-    PyModule_AddObject(m, "timeout", socket_timeout);
+    PyModule_AddObjectRef(m, "timeout", PyExc_TimeoutError);
+
     Py_INCREF((PyObject *)&sock_type);
     if (PyModule_AddObject(m, "SocketType",
                            (PyObject *)&sock_type) != 0)
@@ -7200,10 +7142,24 @@
     PyModule_AddObject(m, "has_ipv6", has_ipv6);
 
     /* Export C API */
-    if (PyModule_AddObject(m, PySocket_CAPI_NAME,
-           PyCapsule_New(&PySocketModuleAPI, PySocket_CAPSULE_NAME, NULL)
-                             ) != 0)
+    PySocketModule_APIObject *capi = sock_get_api();
+    if (capi == NULL) {
+        Py_DECREF(m);
         return NULL;
+    }
+    PyObject *capsule = PyCapsule_New(capi,
+                                      PySocket_CAPSULE_NAME,
+                                      sock_destroy_api);
+    if (capsule == NULL) {
+        sock_free_api(capi);
+        Py_DECREF(m);
+        return NULL;
+    }
+    if (PyModule_AddObject(m, PySocket_CAPI_NAME, capsule) < 0) {
+        Py_DECREF(capsule);
+        Py_DECREF(m);
+        return NULL;
+    }
 
     /* Address families (we only support AF_INET and AF_UNIX) */
 #ifdef AF_UNSPEC
@@ -7968,6 +7924,9 @@
 #ifdef  IPPROTO_BIP
     PyModule_AddIntMacro(m, IPPROTO_BIP);
 #endif
+#ifdef  IPPROTO_MPTCP
+    PyModule_AddIntMacro(m, IPPROTO_MPTCP);
+#endif
 /**/
 #ifdef  IPPROTO_RAW
     PyModule_AddIntMacro(m, IPPROTO_RAW);
@@ -8062,6 +8021,9 @@
 #ifdef  IP_RECVRETOPTS
     PyModule_AddIntMacro(m, IP_RECVRETOPTS);
 #endif
+#ifdef  IP_RECVTOS
+    PyModule_AddIntMacro(m, IP_RECVTOS);
+#endif
 #ifdef  IP_RECVDSTADDR
     PyModule_AddIntMacro(m, IP_RECVDSTADDR);
 #endif
@@ -8194,6 +8156,10 @@
 #ifdef  TCP_KEEPIDLE
     PyModule_AddIntMacro(m, TCP_KEEPIDLE);
 #endif
+    /* TCP_KEEPALIVE is OSX's TCP_KEEPIDLE equivalent */
+#if defined(__APPLE__) && defined(TCP_KEEPALIVE)
+    PyModule_AddIntMacro(m, TCP_KEEPALIVE);
+#endif
 #ifdef  TCP_KEEPINTVL
     PyModule_AddIntMacro(m, TCP_KEEPINTVL);
 #endif
@@ -8428,13 +8394,16 @@
 #endif /* _MSTCPIP_ */
 
     /* Initialize gethostbyname lock */
-#if defined(USE_GETHOSTBYNAME_LOCK) || defined(USE_GETADDRINFO_LOCK)
+#if defined(USE_GETHOSTBYNAME_LOCK)
     netdb_lock = PyThread_allocate_lock();
 #endif
 
 #ifdef MS_WINDOWS
     /* remove some flags on older version Windows during run-time */
-    remove_unusable_flags(m);
+    if (remove_unusable_flags(m) < 0) {
+        Py_DECREF(m);
+        return NULL;
+    }
 #endif
 
     return m;
diff --git a/Modules/socketmodule.h b/Modules/socketmodule.h
index ba2c9f5..e4f375d 100644
--- a/Modules/socketmodule.h
+++ b/Modules/socketmodule.h
@@ -342,7 +342,8 @@
 
 */
 
-/* C API for usage by other Python modules */
+/* C API for usage by other Python modules.
+ * Always add new things to the end for binary compatibility. */
 typedef struct {
     PyTypeObject *Sock_Type;
     PyObject *error;
diff --git a/Modules/spwdmodule.c b/Modules/spwdmodule.c
index 1601ec0..acea306 100644
--- a/Modules/spwdmodule.c
+++ b/Modules/spwdmodule.c
@@ -59,9 +59,19 @@
     9,
 };
 
-static int initialized;
-static PyTypeObject StructSpwdType;
+typedef struct {
+    PyTypeObject *StructSpwdType;
+} spwdmodulestate;
 
+static inline spwdmodulestate*
+get_spwd_state(PyObject *module)
+{
+    void *state = PyModule_GetState(module);
+    assert(state != NULL);
+    return (spwdmodulestate *)state;
+}
+
+static struct PyModuleDef spwdmodule;
 
 static void
 sets(PyObject *v, int i, const char* val)
@@ -75,10 +85,10 @@
   }
 }
 
-static PyObject *mkspent(struct spwd *p)
+static PyObject *mkspent(PyObject *module, struct spwd *p)
 {
     int setIndex = 0;
-    PyObject *v = PyStructSequence_New(&StructSpwdType);
+    PyObject *v = PyStructSequence_New(get_spwd_state(module)->StructSpwdType);
     if (v == NULL)
         return NULL;
 
@@ -144,7 +154,7 @@
             PyErr_SetString(PyExc_KeyError, "getspnam(): name not found");
         goto out;
     }
-    retval = mkspent(p);
+    retval = mkspent(module, p);
 out:
     Py_DECREF(bytes);
     return retval;
@@ -172,7 +182,7 @@
         return NULL;
     setspent();
     while ((p = getspent()) != NULL) {
-        PyObject *v = mkspent(p);
+        PyObject *v = mkspent(module, p);
         if (v == NULL || PyList_Append(d, v) != 0) {
             Py_XDECREF(v);
             Py_DECREF(d);
@@ -197,34 +207,54 @@
     {NULL,              NULL}           /* sentinel */
 };
 
+static int
+spwdmodule_exec(PyObject *module)
+{
+    spwdmodulestate *state = get_spwd_state(module);
 
+    state->StructSpwdType = PyStructSequence_NewType(&struct_spwd_type_desc);
+    if (state->StructSpwdType == NULL) {
+        return -1;
+    }
+    if (PyModule_AddType(module, state->StructSpwdType) < 0) {
+        return -1;
+    }
+    return 0;
+}
+
+static PyModuleDef_Slot spwdmodule_slots[] = {
+    {Py_mod_exec, spwdmodule_exec},
+    {0, NULL}
+};
+
+static int spwdmodule_traverse(PyObject *m, visitproc visit, void *arg) {
+    Py_VISIT(get_spwd_state(m)->StructSpwdType);
+    return 0;
+}
+
+static int spwdmodule_clear(PyObject *m) {
+    Py_CLEAR(get_spwd_state(m)->StructSpwdType);
+    return 0;
+}
+
+static void spwdmodule_free(void *m) {
+    spwdmodule_clear((PyObject *)m);
+}
 
 static struct PyModuleDef spwdmodule = {
     PyModuleDef_HEAD_INIT,
-    "spwd",
-    spwd__doc__,
-    -1,
-    spwd_methods,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    .m_name = "spwd",
+    .m_doc = spwd__doc__,
+    .m_size = sizeof(spwdmodulestate),
+    .m_methods = spwd_methods,
+    .m_slots = spwdmodule_slots,
+    .m_traverse = spwdmodule_traverse,
+    .m_clear = spwdmodule_clear,
+    .m_free = spwdmodule_free,
 };
 
 PyMODINIT_FUNC
 PyInit_spwd(void)
 {
-    PyObject *m;
-    m=PyModule_Create(&spwdmodule);
-    if (m == NULL)
-        return NULL;
-    if (!initialized) {
-        if (PyStructSequence_InitType2(&StructSpwdType,
-                                       &struct_spwd_type_desc) < 0)
-            return NULL;
-    }
-    Py_INCREF((PyObject *) &StructSpwdType);
-    PyModule_AddObject(m, "struct_spwd", (PyObject *) &StructSpwdType);
-    initialized = 1;
-    return m;
+    return PyModuleDef_Init(&spwdmodule);
 }
diff --git a/Modules/sre_lib.h b/Modules/sre_lib.h
index 9cc7863..322f66f 100644
--- a/Modules/sre_lib.h
+++ b/Modules/sre_lib.h
@@ -323,12 +323,12 @@
             if (!i)
                 break;
         }
-        TRACE(("|%p|%p|COUNT %" PY_FORMAT_SIZE_T "d\n", pattern, ptr,
+        TRACE(("|%p|%p|COUNT %zd\n", pattern, ptr,
                (SRE_CHAR*) state->ptr - ptr));
         return (SRE_CHAR*) state->ptr - ptr;
     }
 
-    TRACE(("|%p|%p|COUNT %" PY_FORMAT_SIZE_T "d\n", pattern, ptr,
+    TRACE(("|%p|%p|COUNT %zd\n", pattern, ptr,
            ptr - (SRE_CHAR*) state->ptr));
     return ptr - (SRE_CHAR*) state->ptr;
 }
@@ -414,8 +414,7 @@
 #define DATA_STACK_ALLOC(state, type, ptr) \
 do { \
     alloc_pos = state->data_stack_base; \
-    TRACE(("allocating %s in %" PY_FORMAT_SIZE_T "d " \
-           "(%" PY_FORMAT_SIZE_T "d)\n", \
+    TRACE(("allocating %s in %zd (%zd)\n", \
            Py_STRINGIFY(type), alloc_pos, sizeof(type))); \
     if (sizeof(type) > state->data_stack_size - alloc_pos) { \
         int j = data_stack_grow(state, sizeof(type)); \
@@ -429,14 +428,13 @@
 
 #define DATA_STACK_LOOKUP_AT(state, type, ptr, pos) \
 do { \
-    TRACE(("looking up %s at %" PY_FORMAT_SIZE_T "d\n", Py_STRINGIFY(type), pos)); \
+    TRACE(("looking up %s at %zd\n", Py_STRINGIFY(type), pos)); \
     ptr = (type*)(state->data_stack+pos); \
 } while (0)
 
 #define DATA_STACK_PUSH(state, data, size) \
 do { \
-    TRACE(("copy data in %p to %" PY_FORMAT_SIZE_T "d " \
-           "(%" PY_FORMAT_SIZE_T "d)\n", \
+    TRACE(("copy data in %p to %zd (%zd)\n", \
            data, state->data_stack_base, size)); \
     if (size > state->data_stack_size - state->data_stack_base) { \
         int j = data_stack_grow(state, size); \
@@ -448,20 +446,21 @@
     state->data_stack_base += size; \
 } while (0)
 
+/* We add an explicit cast to memcpy here because MSVC has a bug when
+   compiling C code where it believes that `const void**` cannot be
+   safely casted to `void*`, see bpo-39943 for details. */
 #define DATA_STACK_POP(state, data, size, discard) \
 do { \
-    TRACE(("copy data to %p from %" PY_FORMAT_SIZE_T "d " \
-           "(%" PY_FORMAT_SIZE_T "d)\n", \
+    TRACE(("copy data to %p from %zd (%zd)\n", \
            data, state->data_stack_base-size, size)); \
-    memcpy(data, state->data_stack+state->data_stack_base-size, size); \
+    memcpy((void*) data, state->data_stack+state->data_stack_base-size, size); \
     if (discard) \
         state->data_stack_base -= size; \
 } while (0)
 
 #define DATA_STACK_POP_DISCARD(state, size) \
 do { \
-    TRACE(("discard data from %" PY_FORMAT_SIZE_T "d " \
-           "(%" PY_FORMAT_SIZE_T "d)\n", \
+    TRACE(("discard data from %zd (%zd)\n", \
            state->data_stack_base-size, size)); \
     state->data_stack_base -= size; \
 } while(0)
@@ -574,8 +573,7 @@
         /* optimization info block */
         /* <INFO> <1=skip> <2=flags> <3=min> ... */
         if (ctx->pattern[3] && (uintptr_t)(end - ctx->ptr) < ctx->pattern[3]) {
-            TRACE(("reject (got %" PY_FORMAT_SIZE_T "d chars, "
-                   "need %" PY_FORMAT_SIZE_T "d)\n",
+            TRACE(("reject (got %zd chars, need %zd)\n",
                    end - ctx->ptr, (Py_ssize_t) ctx->pattern[3]));
             RETURN_FAILURE;
         }
@@ -988,7 +986,7 @@
                    ctx->pattern[1], ctx->pattern[2]));
 
             /* install new repeat context */
-            ctx->u.rep = (SRE_REPEAT*) PyObject_MALLOC(sizeof(*ctx->u.rep));
+            ctx->u.rep = (SRE_REPEAT*) PyObject_Malloc(sizeof(*ctx->u.rep));
             if (!ctx->u.rep) {
                 PyErr_NoMemory();
                 RETURN_FAILURE;
@@ -1002,7 +1000,7 @@
             state->ptr = ctx->ptr;
             DO_JUMP(JUMP_REPEAT, jump_repeat, ctx->pattern+ctx->pattern[0]);
             state->repeat = ctx->u.rep->prev;
-            PyObject_FREE(ctx->u.rep);
+            PyObject_Free(ctx->u.rep);
 
             if (ret) {
                 RETURN_ON_ERROR(ret);
@@ -1025,7 +1023,7 @@
 
             ctx->count = ctx->u.rep->count+1;
 
-            TRACE(("|%p|%p|MAX_UNTIL %" PY_FORMAT_SIZE_T "d\n", ctx->pattern,
+            TRACE(("|%p|%p|MAX_UNTIL %zd\n", ctx->pattern,
                    ctx->ptr, ctx->count));
 
             if (ctx->count < (Py_ssize_t) ctx->u.rep->pattern[1]) {
@@ -1088,7 +1086,7 @@
 
             ctx->count = ctx->u.rep->count+1;
 
-            TRACE(("|%p|%p|MIN_UNTIL %" PY_FORMAT_SIZE_T "d %p\n", ctx->pattern,
+            TRACE(("|%p|%p|MIN_UNTIL %zd %p\n", ctx->pattern,
                    ctx->ptr, ctx->count, ctx->u.rep->pattern));
 
             if (ctx->count < (Py_ssize_t) ctx->u.rep->pattern[1]) {
@@ -1355,7 +1353,7 @@
             TRACE(("|%p|%p|JUMP_ASSERT_NOT\n", ctx->pattern, ctx->ptr));
             goto jump_assert_not;
         case JUMP_NONE:
-            TRACE(("|%p|%p|RETURN %" PY_FORMAT_SIZE_T "d\n", ctx->pattern,
+            TRACE(("|%p|%p|RETURN %zd\n", ctx->pattern,
                    ctx->ptr, ret));
             break;
     }
@@ -1417,7 +1415,7 @@
         pattern += 1 + pattern[1];
     }
 
-    TRACE(("prefix = %p %" PY_FORMAT_SIZE_T "d %" PY_FORMAT_SIZE_T "d\n",
+    TRACE(("prefix = %p %zd %zd\n",
            prefix, prefix_len, prefix_skip));
     TRACE(("charset = %p\n", charset));
 
diff --git a/Modules/symtablemodule.c b/Modules/symtablemodule.c
index 9180f18..c25ecc2 100644
--- a/Modules/symtablemodule.c
+++ b/Modules/symtablemodule.c
@@ -1,8 +1,5 @@
 #include "Python.h"
-
-#include "code.h"
-#include "Python-ast.h"
-#include "symtable.h"
+#include "pycore_symtable.h"      // struct symtable
 
 #include "clinic/symtablemodule.c.h"
 /*[clinic input]
@@ -61,8 +58,7 @@
     }
     t = (PyObject *)st->st_top;
     Py_INCREF(t);
-    PyMem_Free((void *)st->st_future);
-    PySymtable_Free(st);
+    _PySymtable_Free(st);
     return t;
 }
 
@@ -71,56 +67,60 @@
     {NULL,              NULL}           /* sentinel */
 };
 
+static int
+symtable_init_stentry_type(PyObject *m)
+{
+    return PyType_Ready(&PySTEntry_Type);
+}
+
+static int
+symtable_init_constants(PyObject *m)
+{
+    if (PyModule_AddIntMacro(m, USE) < 0) return -1;
+    if (PyModule_AddIntMacro(m, DEF_GLOBAL) < 0) return -1;
+    if (PyModule_AddIntMacro(m, DEF_NONLOCAL) < 0) return -1;
+    if (PyModule_AddIntMacro(m, DEF_LOCAL) < 0) return -1;
+    if (PyModule_AddIntMacro(m, DEF_PARAM) < 0) return -1;
+    if (PyModule_AddIntMacro(m, DEF_FREE) < 0) return -1;
+    if (PyModule_AddIntMacro(m, DEF_FREE_CLASS) < 0) return -1;
+    if (PyModule_AddIntMacro(m, DEF_IMPORT) < 0) return -1;
+    if (PyModule_AddIntMacro(m, DEF_BOUND) < 0) return -1;
+    if (PyModule_AddIntMacro(m, DEF_ANNOT) < 0) return -1;
+
+    if (PyModule_AddIntConstant(m, "TYPE_FUNCTION", FunctionBlock) < 0)
+        return -1;
+    if (PyModule_AddIntConstant(m, "TYPE_CLASS", ClassBlock) < 0) return -1;
+    if (PyModule_AddIntConstant(m, "TYPE_MODULE", ModuleBlock) < 0)
+        return -1;
+
+    if (PyModule_AddIntMacro(m, LOCAL) < 0) return -1;
+    if (PyModule_AddIntMacro(m, GLOBAL_EXPLICIT) < 0) return -1;
+    if (PyModule_AddIntMacro(m, GLOBAL_IMPLICIT) < 0) return -1;
+    if (PyModule_AddIntMacro(m, FREE) < 0) return -1;
+    if (PyModule_AddIntMacro(m, CELL) < 0) return -1;
+
+    if (PyModule_AddIntConstant(m, "SCOPE_OFF", SCOPE_OFFSET) < 0) return -1;
+    if (PyModule_AddIntMacro(m, SCOPE_MASK) < 0) return -1;
+
+    return 0;
+}
+
+static PyModuleDef_Slot symtable_slots[] = {
+    {Py_mod_exec, symtable_init_stentry_type},
+    {Py_mod_exec, symtable_init_constants},
+    {0, NULL}
+};
+
 static struct PyModuleDef symtablemodule = {
     PyModuleDef_HEAD_INIT,
-    "_symtable",
-    NULL,
-    -1,
-    symtable_methods,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    .m_name = "_symtable",
+    .m_size = 0,
+    .m_methods = symtable_methods,
+    .m_slots = symtable_slots,
 };
 
 PyMODINIT_FUNC
 PyInit__symtable(void)
 {
-    PyObject *m;
-
-    if (PyType_Ready(&PySTEntry_Type) < 0)
-        return NULL;
-
-    m = PyModule_Create(&symtablemodule);
-    if (m == NULL)
-        return NULL;
-    PyModule_AddIntMacro(m, USE);
-    PyModule_AddIntMacro(m, DEF_GLOBAL);
-    PyModule_AddIntMacro(m, DEF_NONLOCAL);
-    PyModule_AddIntMacro(m, DEF_LOCAL);
-    PyModule_AddIntMacro(m, DEF_PARAM);
-    PyModule_AddIntMacro(m, DEF_FREE);
-    PyModule_AddIntMacro(m, DEF_FREE_CLASS);
-    PyModule_AddIntMacro(m, DEF_IMPORT);
-    PyModule_AddIntMacro(m, DEF_BOUND);
-    PyModule_AddIntMacro(m, DEF_ANNOT);
-
-    PyModule_AddIntConstant(m, "TYPE_FUNCTION", FunctionBlock);
-    PyModule_AddIntConstant(m, "TYPE_CLASS", ClassBlock);
-    PyModule_AddIntConstant(m, "TYPE_MODULE", ModuleBlock);
-
-    PyModule_AddIntMacro(m, LOCAL);
-    PyModule_AddIntMacro(m, GLOBAL_EXPLICIT);
-    PyModule_AddIntMacro(m, GLOBAL_IMPLICIT);
-    PyModule_AddIntMacro(m, FREE);
-    PyModule_AddIntMacro(m, CELL);
-
-    PyModule_AddIntConstant(m, "SCOPE_OFF", SCOPE_OFFSET);
-    PyModule_AddIntMacro(m, SCOPE_MASK);
-
-    if (PyErr_Occurred()) {
-        Py_DECREF(m);
-        m = 0;
-    }
-    return m;
+    return PyModuleDef_Init(&symtablemodule);
 }
diff --git a/Modules/syslogmodule.c b/Modules/syslogmodule.c
index cdc94a6..0f2fea1 100644
--- a/Modules/syslogmodule.c
+++ b/Modules/syslogmodule.c
@@ -183,7 +183,7 @@
         PyObject *openargs;
 
         /* Continue even if PyTuple_New fails, because openlog(3) is optional.
-         * So, we can still do loggin in the unlikely event things are so hosed
+         * So, we can still do logging in the unlikely event things are so hosed
          * that we can't do this tuple.
          */
         if ((openargs = PyTuple_New(0))) {
diff --git a/Modules/termios.c b/Modules/termios.c
index 75e5e52..fdfe589 100644
--- a/Modules/termios.c
+++ b/Modules/termios.c
@@ -1,4 +1,4 @@
-/* termiosmodule.c -- POSIX terminal I/O module implementation.  */
+/* termios.c -- POSIX terminal I/O module implementation.  */
 
 #include "Python.h"
 
@@ -29,6 +29,13 @@
 #include <sys/bsdtty.h>
 #endif
 
+/*[clinic input]
+module termios
+[clinic start generated code]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=01105c85d0ca7252]*/
+
+#include "clinic/termios.c.h"
+
 PyDoc_STRVAR(termios__doc__,
 "This module provides an interface to the Posix calls for tty I/O control.\n\
 For a complete description of these calls, see the Posix or Unix manual\n\
@@ -51,59 +58,46 @@
     return (termiosmodulestate *)state;
 }
 
-#define modulestate_global get_termios_state(PyState_FindModule(&termiosmodule))
-
-static int fdconv(PyObject* obj, void* p)
-{
-    int fd;
-
-    fd = PyObject_AsFileDescriptor(obj);
-    if (fd >= 0) {
-        *(int*)p = fd;
-        return 1;
-    }
-    return 0;
-}
-
 static struct PyModuleDef termiosmodule;
 
-PyDoc_STRVAR(termios_tcgetattr__doc__,
-"tcgetattr(fd) -> list_of_attrs\n\
-\n\
-Get the tty attributes for file descriptor fd, as follows:\n\
-[iflag, oflag, cflag, lflag, ispeed, ospeed, cc] where cc is a list\n\
-of the tty special characters (each a string of length 1, except the items\n\
-with indices VMIN and VTIME, which are integers when these fields are\n\
-defined).  The interpretation of the flags and the speeds as well as the\n\
-indexing in the cc array must be done using the symbolic constants defined\n\
-in this module.");
+/*[clinic input]
+termios.tcgetattr
+
+    fd: fildes
+    /
+
+Get the tty attributes for file descriptor fd.
+
+Returns a list [iflag, oflag, cflag, lflag, ispeed, ospeed, cc]
+where cc is a list of the tty special characters (each a string of
+length 1, except the items with indices VMIN and VTIME, which are
+integers when these fields are defined).  The interpretation of the
+flags and the speeds as well as the indexing in the cc array must be
+done using the symbolic constants defined in this module.
+[clinic start generated code]*/
 
 static PyObject *
-termios_tcgetattr(PyObject *self, PyObject *args)
+termios_tcgetattr_impl(PyObject *module, int fd)
+/*[clinic end generated code: output=2b3da39db870e629 input=54dad9779ebe74b1]*/
 {
-    int fd;
+    termiosmodulestate *state = PyModule_GetState(module);
     struct termios mode;
-    PyObject *cc;
-    speed_t ispeed, ospeed;
+    if (tcgetattr(fd, &mode) == -1) {
+        return PyErr_SetFromErrno(state->TermiosError);
+    }
+
+    speed_t ispeed = cfgetispeed(&mode);
+    speed_t ospeed = cfgetospeed(&mode);
+
+    PyObject *cc = PyList_New(NCCS);
+    if (cc == NULL) {
+        return NULL;
+    }
+
     PyObject *v;
     int i;
-    char ch;
-
-    if (!PyArg_ParseTuple(args, "O&:tcgetattr",
-                          fdconv, (void*)&fd))
-        return NULL;
-
-    if (tcgetattr(fd, &mode) == -1)
-        return PyErr_SetFromErrno(modulestate_global->TermiosError);
-
-    ispeed = cfgetispeed(&mode);
-    ospeed = cfgetospeed(&mode);
-
-    cc = PyList_New(NCCS);
-    if (cc == NULL)
-        return NULL;
     for (i = 0; i < NCCS; i++) {
-        ch = (char)mode.c_cc[i];
+        char ch = (char)mode.c_cc[i];
         v = PyBytes_FromStringAndSize(&ch, 1);
         if (v == NULL)
             goto err;
@@ -144,29 +138,28 @@
     return NULL;
 }
 
-PyDoc_STRVAR(termios_tcsetattr__doc__,
-"tcsetattr(fd, when, attributes) -> None\n\
-\n\
-Set the tty attributes for file descriptor fd.\n\
-The attributes to be set are taken from the attributes argument, which\n\
-is a list like the one returned by tcgetattr(). The when argument\n\
-determines when the attributes are changed: termios.TCSANOW to\n\
-change immediately, termios.TCSADRAIN to change after transmitting all\n\
-queued output, or termios.TCSAFLUSH to change after transmitting all\n\
-queued output and discarding all queued input. ");
+/*[clinic input]
+termios.tcsetattr
+
+    fd: fildes
+    when: int
+    attributes as term: object
+    /
+
+Set the tty attributes for file descriptor fd.
+
+The attributes to be set are taken from the attributes argument, which
+is a list like the one returned by tcgetattr(). The when argument
+determines when the attributes are changed: termios.TCSANOW to
+change immediately, termios.TCSADRAIN to change after transmitting all
+queued output, or termios.TCSAFLUSH to change after transmitting all
+queued output and discarding all queued input.
+[clinic start generated code]*/
 
 static PyObject *
-termios_tcsetattr(PyObject *self, PyObject *args)
+termios_tcsetattr_impl(PyObject *module, int fd, int when, PyObject *term)
+/*[clinic end generated code: output=bcd2b0a7b98a4bf5 input=5dafabdd5a08f018]*/
 {
-    int fd, when;
-    struct termios mode;
-    speed_t ispeed, ospeed;
-    PyObject *term, *cc, *v;
-    int i;
-
-    if (!PyArg_ParseTuple(args, "O&iO:tcsetattr",
-                          fdconv, &fd, &when, &term))
-        return NULL;
     if (!PyList_Check(term) || PyList_Size(term) != 7) {
         PyErr_SetString(PyExc_TypeError,
                      "tcsetattr, arg 3: must be 7 element list");
@@ -174,18 +167,22 @@
     }
 
     /* Get the old mode, in case there are any hidden fields... */
-    termiosmodulestate *state = modulestate_global;
-    if (tcgetattr(fd, &mode) == -1)
+    termiosmodulestate *state = PyModule_GetState(module);
+    struct termios mode;
+    if (tcgetattr(fd, &mode) == -1) {
         return PyErr_SetFromErrno(state->TermiosError);
+    }
+
     mode.c_iflag = (tcflag_t) PyLong_AsLong(PyList_GetItem(term, 0));
     mode.c_oflag = (tcflag_t) PyLong_AsLong(PyList_GetItem(term, 1));
     mode.c_cflag = (tcflag_t) PyLong_AsLong(PyList_GetItem(term, 2));
     mode.c_lflag = (tcflag_t) PyLong_AsLong(PyList_GetItem(term, 3));
-    ispeed = (speed_t) PyLong_AsLong(PyList_GetItem(term, 4));
-    ospeed = (speed_t) PyLong_AsLong(PyList_GetItem(term, 5));
-    cc = PyList_GetItem(term, 6);
-    if (PyErr_Occurred())
+    speed_t ispeed = (speed_t) PyLong_AsLong(PyList_GetItem(term, 4));
+    speed_t ospeed = (speed_t) PyLong_AsLong(PyList_GetItem(term, 5));
+    PyObject *cc = PyList_GetItem(term, 6);
+    if (PyErr_Occurred()) {
         return NULL;
+    }
 
     if (!PyList_Check(cc) || PyList_Size(cc) != NCCS) {
         PyErr_Format(PyExc_TypeError,
@@ -194,6 +191,8 @@
         return NULL;
     }
 
+    int i;
+    PyObject *v;
     for (i = 0; i < NCCS; i++) {
         v = PyList_GetItem(cc, i);
 
@@ -218,104 +217,112 @@
     Py_RETURN_NONE;
 }
 
-PyDoc_STRVAR(termios_tcsendbreak__doc__,
-"tcsendbreak(fd, duration) -> None\n\
-\n\
-Send a break on file descriptor fd.\n\
-A zero duration sends a break for 0.25-0.5 seconds; a nonzero duration\n\
-has a system dependent meaning.");
+/*[clinic input]
+termios.tcsendbreak
+
+    fd: fildes
+    duration: int
+    /
+
+Send a break on file descriptor fd.
+
+A zero duration sends a break for 0.25-0.5 seconds; a nonzero duration
+has a system dependent meaning.
+[clinic start generated code]*/
 
 static PyObject *
-termios_tcsendbreak(PyObject *self, PyObject *args)
+termios_tcsendbreak_impl(PyObject *module, int fd, int duration)
+/*[clinic end generated code: output=5945f589b5d3ac66 input=dc2f32417691f8ed]*/
 {
-    int fd, duration;
-
-    if (!PyArg_ParseTuple(args, "O&i:tcsendbreak",
-                          fdconv, &fd, &duration))
-        return NULL;
-    if (tcsendbreak(fd, duration) == -1)
-        return PyErr_SetFromErrno(modulestate_global->TermiosError);
+    termiosmodulestate *state = PyModule_GetState(module);
+    if (tcsendbreak(fd, duration) == -1) {
+        return PyErr_SetFromErrno(state->TermiosError);
+    }
 
     Py_RETURN_NONE;
 }
 
-PyDoc_STRVAR(termios_tcdrain__doc__,
-"tcdrain(fd) -> None\n\
-\n\
-Wait until all output written to file descriptor fd has been transmitted.");
+/*[clinic input]
+termios.tcdrain
+
+    fd: fildes
+    /
+
+Wait until all output written to file descriptor fd has been transmitted.
+[clinic start generated code]*/
 
 static PyObject *
-termios_tcdrain(PyObject *self, PyObject *args)
+termios_tcdrain_impl(PyObject *module, int fd)
+/*[clinic end generated code: output=5fd86944c6255955 input=c99241b140b32447]*/
 {
-    int fd;
-
-    if (!PyArg_ParseTuple(args, "O&:tcdrain",
-                          fdconv, &fd))
-        return NULL;
-    if (tcdrain(fd) == -1)
-        return PyErr_SetFromErrno(modulestate_global->TermiosError);
+    termiosmodulestate *state = PyModule_GetState(module);
+    if (tcdrain(fd) == -1) {
+        return PyErr_SetFromErrno(state->TermiosError);
+    }
 
     Py_RETURN_NONE;
 }
 
-PyDoc_STRVAR(termios_tcflush__doc__,
-"tcflush(fd, queue) -> None\n\
-\n\
-Discard queued data on file descriptor fd.\n\
-The queue selector specifies which queue: termios.TCIFLUSH for the input\n\
-queue, termios.TCOFLUSH for the output queue, or termios.TCIOFLUSH for\n\
-both queues. ");
+/*[clinic input]
+termios.tcflush
+
+    fd: fildes
+    queue: int
+    /
+
+Discard queued data on file descriptor fd.
+
+The queue selector specifies which queue: termios.TCIFLUSH for the input
+queue, termios.TCOFLUSH for the output queue, or termios.TCIOFLUSH for
+both queues.
+[clinic start generated code]*/
 
 static PyObject *
-termios_tcflush(PyObject *self, PyObject *args)
+termios_tcflush_impl(PyObject *module, int fd, int queue)
+/*[clinic end generated code: output=2424f80312ec2f21 input=0f7d08122ddc07b5]*/
 {
-    int fd, queue;
-
-    if (!PyArg_ParseTuple(args, "O&i:tcflush",
-                          fdconv, &fd, &queue))
-        return NULL;
-    if (tcflush(fd, queue) == -1)
-        return PyErr_SetFromErrno(modulestate_global->TermiosError);
+    termiosmodulestate *state = PyModule_GetState(module);
+    if (tcflush(fd, queue) == -1) {
+        return PyErr_SetFromErrno(state->TermiosError);
+    }
 
     Py_RETURN_NONE;
 }
 
-PyDoc_STRVAR(termios_tcflow__doc__,
-"tcflow(fd, action) -> None\n\
-\n\
-Suspend or resume input or output on file descriptor fd.\n\
-The action argument can be termios.TCOOFF to suspend output,\n\
-termios.TCOON to restart output, termios.TCIOFF to suspend input,\n\
-or termios.TCION to restart input.");
+/*[clinic input]
+termios.tcflow
+
+    fd: fildes
+    action: int
+    /
+
+Suspend or resume input or output on file descriptor fd.
+
+The action argument can be termios.TCOOFF to suspend output,
+termios.TCOON to restart output, termios.TCIOFF to suspend input,
+or termios.TCION to restart input.
+[clinic start generated code]*/
 
 static PyObject *
-termios_tcflow(PyObject *self, PyObject *args)
+termios_tcflow_impl(PyObject *module, int fd, int action)
+/*[clinic end generated code: output=afd10928e6ea66eb input=c6aff0640b6efd9c]*/
 {
-    int fd, action;
-
-    if (!PyArg_ParseTuple(args, "O&i:tcflow",
-                          fdconv, &fd, &action))
-        return NULL;
-    if (tcflow(fd, action) == -1)
-        return PyErr_SetFromErrno(modulestate_global->TermiosError);
+    termiosmodulestate *state = PyModule_GetState(module);
+    if (tcflow(fd, action) == -1) {
+        return PyErr_SetFromErrno(state->TermiosError);
+    }
 
     Py_RETURN_NONE;
 }
 
 static PyMethodDef termios_methods[] =
 {
-    {"tcgetattr", termios_tcgetattr,
-     METH_VARARGS, termios_tcgetattr__doc__},
-    {"tcsetattr", termios_tcsetattr,
-     METH_VARARGS, termios_tcsetattr__doc__},
-    {"tcsendbreak", termios_tcsendbreak,
-     METH_VARARGS, termios_tcsendbreak__doc__},
-    {"tcdrain", termios_tcdrain,
-     METH_VARARGS, termios_tcdrain__doc__},
-    {"tcflush", termios_tcflush,
-     METH_VARARGS, termios_tcflush__doc__},
-    {"tcflow", termios_tcflow,
-     METH_VARARGS, termios_tcflow__doc__},
+    TERMIOS_TCGETATTR_METHODDEF
+    TERMIOS_TCSETATTR_METHODDEF
+    TERMIOS_TCSENDBREAK_METHODDEF
+    TERMIOS_TCDRAIN_METHODDEF
+    TERMIOS_TCFLUSH_METHODDEF
+    TERMIOS_TCFLOW_METHODDEF
     {NULL, NULL}
 };
 
@@ -997,44 +1004,49 @@
     termiosmodule_clear((PyObject *)m);
 }
 
-static struct PyModuleDef termiosmodule = {
-    PyModuleDef_HEAD_INIT,
-    "termios",
-    termios__doc__,
-    sizeof(termiosmodulestate),
-    termios_methods,
-    NULL,
-    termiosmodule_traverse,
-    termiosmodule_clear,
-    termiosmodule_free,
-};
-
-PyMODINIT_FUNC
-PyInit_termios(void)
+static int
+termios_exec(PyObject *mod)
 {
-    PyObject *m;
     struct constant *constant = termios_constants;
-
-    if ((m = PyState_FindModule(&termiosmodule)) != NULL) {
-        Py_INCREF(m);
-        return m;
-    }
-
-    if ((m = PyModule_Create(&termiosmodule)) == NULL) {
-        return NULL;
-    }
-
-    termiosmodulestate *state = get_termios_state(m);
+    termiosmodulestate *state = get_termios_state(mod);
     state->TermiosError = PyErr_NewException("termios.error", NULL, NULL);
     if (state->TermiosError == NULL) {
-        return NULL;
+        return -1;
     }
     Py_INCREF(state->TermiosError);
-    PyModule_AddObject(m, "error", state->TermiosError);
+    if (PyModule_AddObject(mod, "error", state->TermiosError) < 0) {
+        Py_DECREF(state->TermiosError);
+        return -1;
+    }
 
     while (constant->name != NULL) {
-        PyModule_AddIntConstant(m, constant->name, constant->value);
+        if (PyModule_AddIntConstant(
+            mod, constant->name, constant->value) < 0) {
+            return -1;
+        }
         ++constant;
     }
-    return m;
+    return 0;
+}
+
+static PyModuleDef_Slot termios_slots[] = {
+    {Py_mod_exec, termios_exec},
+    {0, NULL}
+};
+
+static struct PyModuleDef termiosmodule = {
+    PyModuleDef_HEAD_INIT,
+    .m_name = "termios",
+    .m_doc = termios__doc__,
+    .m_size = sizeof(termiosmodulestate),
+    .m_methods = termios_methods,
+    .m_slots = termios_slots,
+    .m_traverse = termiosmodule_traverse,
+    .m_clear = termiosmodule_clear,
+    .m_free = termiosmodule_free,
+};
+
+PyMODINIT_FUNC PyInit_termios(void)
+{
+    return PyModuleDef_Init(&termiosmodule);
 }
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index 80eab30..4caacc3 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -51,7 +51,7 @@
 #define _Py_tzname tzname
 #endif
 
-#if defined(__APPLE__ ) && defined(__has_builtin) 
+#if defined(__APPLE__ ) && defined(__has_builtin)
 #  if __has_builtin(__builtin_available)
 #    define HAVE_CLOCK_GETTIME_RUNTIME __builtin_available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *)
 #  endif
@@ -74,10 +74,21 @@
 }
 
 
+static int
+get_system_time(_PyTime_t *t)
+{
+    // Avoid _PyTime_GetSystemClock() which silently ignores errors.
+    return _PyTime_GetSystemClockWithInfo(t, NULL);
+}
+
+
 static PyObject *
 time_time(PyObject *self, PyObject *unused)
 {
-    _PyTime_t t = _PyTime_GetSystemClock();
+    _PyTime_t t;
+    if (get_system_time(&t) < 0) {
+        return NULL;
+    }
     return _PyFloat_FromPyTime(t);
 }
 
@@ -91,7 +102,10 @@
 static PyObject *
 time_time_ns(PyObject *self, PyObject *unused)
 {
-    _PyTime_t t = _PyTime_GetSystemClock();
+    _PyTime_t t;
+    if (get_system_time(&t) < 0) {
+        return NULL;
+    }
     return _PyTime_AsNanosecondsObject(t);
 }
 
@@ -147,20 +161,11 @@
 }
 #endif /* HAVE_CLOCK */
 
-static PyObject*
-perf_counter(_Py_clock_info_t *info)
-{
-    _PyTime_t t;
-    if (_PyTime_GetPerfCounterWithInfo(&t, info) < 0) {
-        return NULL;
-    }
-    return _PyFloat_FromPyTime(t);
-}
 
 #ifdef HAVE_CLOCK_GETTIME
 
 #ifdef __APPLE__
-/* 
+/*
  * The clock_* functions will be removed from the module
  * dict entirely when the C API is not available.
  */
@@ -1096,10 +1101,22 @@
 should not be relied on.");
 #endif /* HAVE_WORKING_TZSET */
 
+
+static int
+get_monotonic(_PyTime_t *t)
+{
+    // Avoid _PyTime_GetMonotonicClock() which silently ignores errors.
+    return _PyTime_GetMonotonicClockWithInfo(t, NULL);
+}
+
+
 static PyObject *
 time_monotonic(PyObject *self, PyObject *unused)
 {
-    _PyTime_t t = _PyTime_GetMonotonicClock();
+    _PyTime_t t;
+    if (get_monotonic(&t) < 0) {
+        return NULL;
+    }
     return _PyFloat_FromPyTime(t);
 }
 
@@ -1111,7 +1128,10 @@
 static PyObject *
 time_monotonic_ns(PyObject *self, PyObject *unused)
 {
-    _PyTime_t t = _PyTime_GetMonotonicClock();
+    _PyTime_t t;
+    if (get_monotonic(&t) < 0) {
+        return NULL;
+    }
     return _PyTime_AsNanosecondsObject(t);
 }
 
@@ -1120,10 +1140,23 @@
 \n\
 Monotonic clock, cannot go backward, as nanoseconds.");
 
+
+static int
+get_perf_counter(_PyTime_t *t)
+{
+    // Avoid _PyTime_GetPerfCounter() which silently ignores errors.
+    return _PyTime_GetPerfCounterWithInfo(t, NULL);
+}
+
+
 static PyObject *
 time_perf_counter(PyObject *self, PyObject *unused)
 {
-    return perf_counter(NULL);
+    _PyTime_t t;
+    if (get_perf_counter(&t) < 0) {
+        return NULL;
+    }
+    return _PyFloat_FromPyTime(t);
 }
 
 PyDoc_STRVAR(perf_counter_doc,
@@ -1131,10 +1164,14 @@
 \n\
 Performance counter for benchmarking.");
 
+
 static PyObject *
 time_perf_counter_ns(PyObject *self, PyObject *unused)
 {
-    _PyTime_t t = _PyTime_GetPerfCounter();
+    _PyTime_t t;
+    if (get_perf_counter(&t) < 0) {
+        return NULL;
+    }
     return _PyTime_AsNanosecondsObject(t);
 }
 
@@ -1421,7 +1458,7 @@
 
 #if defined(__APPLE__) && defined(__has_attribute) && __has_attribute(availability)
 static int
-_PyTime_GetThreadTimeWithInfo(_PyTime_t *tp, _Py_clock_info_t *info) 
+_PyTime_GetThreadTimeWithInfo(_PyTime_t *tp, _Py_clock_info_t *info)
      __attribute__((availability(macos, introduced=10.12)))
      __attribute__((availability(ios, introduced=10.0)))
      __attribute__((availability(tvos, introduced=10.0)))
@@ -1460,7 +1497,7 @@
 
 #ifdef HAVE_THREAD_TIME
 #ifdef __APPLE__
-/* 
+/*
  * The clock_* functions will be removed from the module
  * dict entirely when the C API is not available.
  */
@@ -2025,7 +2062,10 @@
     HANDLE hInterruptEvent;
 #endif
 
-    deadline = _PyTime_GetMonotonicClock() + secs;
+    if (get_monotonic(&monotonic) < 0) {
+        return -1;
+    }
+    deadline = monotonic + secs;
 
     do {
 #ifndef MS_WINDOWS
@@ -2077,10 +2117,13 @@
         if (PyErr_CheckSignals())
             return -1;
 
-        monotonic = _PyTime_GetMonotonicClock();
+        if (get_monotonic(&monotonic) < 0) {
+            return -1;
+        }
         secs = deadline - monotonic;
-        if (secs < 0)
+        if (secs < 0) {
             break;
+        }
         /* retry with the recomputed delay */
     } while (1);
 
diff --git a/Modules/unicodedata.c b/Modules/unicodedata.c
index 8a1198a..f87eb60 100644
--- a/Modules/unicodedata.c
+++ b/Modules/unicodedata.c
@@ -16,7 +16,7 @@
 #define PY_SSIZE_T_CLEAN
 
 #include "Python.h"
-#include "ucnhash.h"
+#include "pycore_ucnhash.h"       // _PyUnicode_Name_CAPI
 #include "structmember.h"         // PyMemberDef
 
 #include <stdbool.h>
@@ -28,9 +28,9 @@
 
 /*[clinic input]
 module unicodedata
-class unicodedata.UCD 'PreviousDBVersion *' '&UCD_Type'
+class unicodedata.UCD 'PreviousDBVersion *' '<not used>'
 [clinic start generated code]*/
-/*[clinic end generated code: output=da39a3ee5e6b4b0d input=6dac153082d150bc]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=e47113e05924be43]*/
 
 /* character properties */
 
@@ -90,22 +90,26 @@
         {NULL}
 };
 
-/* forward declaration */
-static PyTypeObject UCD_Type;
-#define UCD_Check(o) Py_IS_TYPE(o, &UCD_Type)
+// Check if self is an unicodedata.UCD instance.
+// If self is NULL (when the PyCapsule C API is used), return 0.
+// PyModule_Check() is used to avoid having to retrieve the ucd_type.
+// See unicodedata_functions comment to the rationale of this macro.
+#define UCD_Check(self) (self != NULL && !PyModule_Check(self))
 
 static PyObject*
-new_previous_version(const char*name, const change_record* (*getrecord)(Py_UCS4),
+new_previous_version(PyTypeObject *ucd_type,
+                     const char*name, const change_record* (*getrecord)(Py_UCS4),
                      Py_UCS4 (*normalization)(Py_UCS4))
 {
-        PreviousDBVersion *self;
-        self = PyObject_New(PreviousDBVersion, &UCD_Type);
-        if (self == NULL)
-                return NULL;
-        self->name = name;
-        self->getrecord = getrecord;
-        self->normalization = normalization;
-        return (PyObject*)self;
+    PreviousDBVersion *self;
+    self = PyObject_GC_New(PreviousDBVersion, ucd_type);
+    if (self == NULL)
+        return NULL;
+    self->name = name;
+    self->getrecord = getrecord;
+    self->normalization = normalization;
+    PyObject_GC_Track(self);
+    return (PyObject*)self;
 }
 
 
@@ -135,7 +139,7 @@
     long rc;
     Py_UCS4 c = (Py_UCS4)chr;
 
-    if (self && UCD_Check(self)) {
+    if (UCD_Check(self)) {
         const change_record *old = get_old_record(self, c);
         if (old->category_changed == 0) {
             /* unassigned */
@@ -223,7 +227,7 @@
     double rc;
     Py_UCS4 c = (Py_UCS4)chr;
 
-    if (self && UCD_Check(self)) {
+    if (UCD_Check(self)) {
         const change_record *old = get_old_record(self, c);
         if (old->category_changed == 0) {
             /* unassigned */
@@ -268,7 +272,7 @@
     int index;
     Py_UCS4 c = (Py_UCS4)chr;
     index = (int) _getrecord_ex(c)->category;
-    if (self && UCD_Check(self)) {
+    if (UCD_Check(self)) {
         const change_record *old = get_old_record(self, c);
         if (old->category_changed != 0xFF)
             index = old->category_changed;
@@ -295,7 +299,7 @@
     int index;
     Py_UCS4 c = (Py_UCS4)chr;
     index = (int) _getrecord_ex(c)->bidirectional;
-    if (self && UCD_Check(self)) {
+    if (UCD_Check(self)) {
         const change_record *old = get_old_record(self, c);
         if (old->category_changed == 0)
             index = 0; /* unassigned */
@@ -324,7 +328,7 @@
     int index;
     Py_UCS4 c = (Py_UCS4)chr;
     index = (int) _getrecord_ex(c)->combining;
-    if (self && UCD_Check(self)) {
+    if (UCD_Check(self)) {
         const change_record *old = get_old_record(self, c);
         if (old->category_changed == 0)
             index = 0; /* unassigned */
@@ -352,7 +356,7 @@
     int index;
     Py_UCS4 c = (Py_UCS4)chr;
     index = (int) _getrecord_ex(c)->mirrored;
-    if (self && UCD_Check(self)) {
+    if (UCD_Check(self)) {
         const change_record *old = get_old_record(self, c);
         if (old->category_changed == 0)
             index = 0; /* unassigned */
@@ -379,7 +383,7 @@
     int index;
     Py_UCS4 c = (Py_UCS4)chr;
     index = (int) _getrecord_ex(c)->east_asian_width;
-    if (self && UCD_Check(self)) {
+    if (UCD_Check(self)) {
         const change_record *old = get_old_record(self, c);
         if (old->category_changed == 0)
             index = 0; /* unassigned */
@@ -413,7 +417,7 @@
 
     code = (int)c;
 
-    if (self && UCD_Check(self)) {
+    if (UCD_Check(self)) {
         const change_record *old = get_old_record(self, c);
         if (old->category_changed == 0)
             return PyUnicode_FromString(""); /* unassigned */
@@ -456,12 +460,14 @@
 }
 
 static void
-get_decomp_record(PyObject *self, Py_UCS4 code, int *index, int *prefix, int *count)
+get_decomp_record(PyObject *self, Py_UCS4 code,
+                  int *index, int *prefix, int *count)
 {
     if (code >= 0x110000) {
         *index = 0;
-    } else if (self && UCD_Check(self) &&
-               get_old_record(self, code)->category_changed==0) {
+    }
+    else if (UCD_Check(self)
+             && get_old_record(self, code)->category_changed==0) {
         /* unassigned in old version */
         *index = 0;
     }
@@ -558,7 +564,7 @@
                 continue;
             }
             /* normalization changes */
-            if (self && UCD_Check(self)) {
+            if (UCD_Check(self)) {
                 Py_UCS4 value = ((PreviousDBVersion*)self)->normalization(code);
                 if (value != 0) {
                     stack[stackptr++] = value;
@@ -794,13 +800,13 @@
  *   https://www.unicode.org/reports/tr15/#Detecting_Normalization_Forms
  */
 static QuickcheckResult
-is_normalized_quickcheck(PyObject *self, PyObject *input,
-                         bool nfc, bool k, bool yes_only)
+is_normalized_quickcheck(PyObject *self, PyObject *input, bool nfc, bool k,
+                         bool yes_only)
 {
-    /* An older version of the database is requested, quickchecks must be
-       disabled. */
-    if (self && UCD_Check(self))
+    /* UCD 3.2.0 is requested, quickchecks must be disabled. */
+    if (UCD_Check(self)) {
         return NO;
+    }
 
     Py_ssize_t i, len;
     int kind;
@@ -940,28 +946,32 @@
     }
 
     if (_PyUnicode_EqualToASCIIId(form, &PyId_NFC)) {
-        if (is_normalized_quickcheck(self, input, true,  false, true) == YES) {
+        if (is_normalized_quickcheck(self, input,
+                                     true,  false, true) == YES) {
             Py_INCREF(input);
             return input;
         }
         return nfc_nfkc(self, input, 0);
     }
     if (_PyUnicode_EqualToASCIIId(form, &PyId_NFKC)) {
-        if (is_normalized_quickcheck(self, input, true,  true,  true) == YES) {
+        if (is_normalized_quickcheck(self, input,
+                                     true,  true,  true) == YES) {
             Py_INCREF(input);
             return input;
         }
         return nfc_nfkc(self, input, 1);
     }
     if (_PyUnicode_EqualToASCIIId(form, &PyId_NFD)) {
-        if (is_normalized_quickcheck(self, input, false, false, true) == YES) {
+        if (is_normalized_quickcheck(self, input,
+                                     false, false, true) == YES) {
             Py_INCREF(input);
             return input;
         }
         return nfd_nfkd(self, input, 0);
     }
     if (_PyUnicode_EqualToASCIIId(form, &PyId_NFKD)) {
-        if (is_normalized_quickcheck(self, input, false, true,  true) == YES) {
+        if (is_normalized_quickcheck(self, input,
+                                     false, true,  true) == YES) {
             Py_INCREF(input);
             return input;
         }
@@ -1048,8 +1058,8 @@
                           (cp < named_sequences_end))
 
 static int
-_getucname(PyObject *self, Py_UCS4 code, char* buffer, int buflen,
-           int with_alias_and_seq)
+_getucname(PyObject *self,
+           Py_UCS4 code, char* buffer, int buflen, int with_alias_and_seq)
 {
     /* Find the name associated with the given code point.
      * If with_alias_and_seq is 1, check for names in the Private Use Area 15
@@ -1066,7 +1076,7 @@
     if (!with_alias_and_seq && (IS_ALIAS(code) || IS_NAMED_SEQ(code)))
         return 0;
 
-    if (self && UCD_Check(self)) {
+    if (UCD_Check(self)) {
         /* in 3.2.0 there are no aliases and named sequences */
         const change_record *old;
         if (IS_ALIAS(code) || IS_NAMED_SEQ(code))
@@ -1150,6 +1160,15 @@
 }
 
 static int
+capi_getucname(Py_UCS4 code,
+               char* buffer, int buflen,
+               int with_alias_and_seq)
+{
+    return _getucname(NULL, code, buffer, buflen, with_alias_and_seq);
+
+}
+
+static int
 _cmpname(PyObject *self, int code, const char* name, int namelen)
 {
     /* check if code corresponds to the given name */
@@ -1200,8 +1219,8 @@
 }
 
 static int
-_getcode(PyObject* self, const char* name, int namelen, Py_UCS4* code,
-         int with_named_seq)
+_getcode(PyObject* self,
+         const char* name, int namelen, Py_UCS4* code, int with_named_seq)
 {
     /* Return the code point associated with the given name.
      * Named aliases are resolved too (unless self != NULL (i.e. we are using
@@ -1262,8 +1281,9 @@
     v = code_hash[i];
     if (!v)
         return 0;
-    if (_cmpname(self, v, name, namelen))
+    if (_cmpname(self, v, name, namelen)) {
         return _check_alias_and_seq(v, code, with_named_seq);
+    }
     incr = (h ^ (h >> 3)) & mask;
     if (!incr)
         incr = mask;
@@ -1272,21 +1292,51 @@
         v = code_hash[i];
         if (!v)
             return 0;
-        if (_cmpname(self, v, name, namelen))
+        if (_cmpname(self, v, name, namelen)) {
             return _check_alias_and_seq(v, code, with_named_seq);
+        }
         incr = incr << 1;
         if (incr > mask)
             incr = incr ^ code_poly;
     }
 }
 
-static const _PyUnicode_Name_CAPI hashAPI =
+static int
+capi_getcode(const char* name, int namelen, Py_UCS4* code,
+             int with_named_seq)
 {
-    sizeof(_PyUnicode_Name_CAPI),
-    _getucname,
-    _getcode
+    return _getcode(NULL, name, namelen, code, with_named_seq);
+
+}
+
+static void
+unicodedata_destroy_capi(PyObject *capsule)
+{
+    void *capi = PyCapsule_GetPointer(capsule, PyUnicodeData_CAPSULE_NAME);
+    PyMem_Free(capi);
+}
+
+static PyObject *
+unicodedata_create_capi(void)
+{
+    _PyUnicode_Name_CAPI *capi = PyMem_Malloc(sizeof(_PyUnicode_Name_CAPI));
+    if (capi == NULL) {
+        PyErr_NoMemory();
+        return NULL;
+    }
+    capi->getname = capi_getucname;
+    capi->getcode = capi_getcode;
+
+    PyObject *capsule = PyCapsule_New(capi,
+                                      PyUnicodeData_CAPSULE_NAME,
+                                      unicodedata_destroy_capi);
+    if (capsule == NULL) {
+        PyMem_Free(capi);
+    }
+    return capsule;
 };
 
+
 /* -------------------------------------------------------------------- */
 /* Python bindings */
 
@@ -1365,8 +1415,10 @@
     return PyUnicode_FromOrdinal(code);
 }
 
-/* XXX Add doc strings. */
-
+// List of functions used to define module functions *AND* unicodedata.UCD
+// methods. For module functions, self is the module. For UCD methods, self
+// is an UCD instance. The UCD_Check() macro is used to check if self is
+// an UCD instance.
 static PyMethodDef unicodedata_functions[] = {
     UNICODEDATA_UCD_DECIMAL_METHODDEF
     UNICODEDATA_UCD_DIGIT_METHODDEF
@@ -1384,50 +1436,37 @@
     {NULL, NULL}                /* sentinel */
 };
 
-static PyTypeObject UCD_Type = {
-        /* The ob_type field must be initialized in the module init function
-         * to be portable to Windows without using C++. */
-        PyVarObject_HEAD_INIT(NULL, 0)
-        "unicodedata.UCD",              /*tp_name*/
-        sizeof(PreviousDBVersion),      /*tp_basicsize*/
-        0,                      /*tp_itemsize*/
-        /* methods */
-        (destructor)PyObject_Del, /*tp_dealloc*/
-        0,                      /*tp_vectorcall_offset*/
-        0,                      /*tp_getattr*/
-        0,                      /*tp_setattr*/
-        0,                      /*tp_as_async*/
-        0,                      /*tp_repr*/
-        0,                      /*tp_as_number*/
-        0,                      /*tp_as_sequence*/
-        0,                      /*tp_as_mapping*/
-        0,                      /*tp_hash*/
-        0,                      /*tp_call*/
-        0,                      /*tp_str*/
-        PyObject_GenericGetAttr,/*tp_getattro*/
-        0,                      /*tp_setattro*/
-        0,                      /*tp_as_buffer*/
-        Py_TPFLAGS_DEFAULT,     /*tp_flags*/
-        0,                      /*tp_doc*/
-        0,                      /*tp_traverse*/
-        0,                      /*tp_clear*/
-        0,                      /*tp_richcompare*/
-        0,                      /*tp_weaklistoffset*/
-        0,                      /*tp_iter*/
-        0,                      /*tp_iternext*/
-        unicodedata_functions,  /*tp_methods*/
-        DB_members,             /*tp_members*/
-        0,                      /*tp_getset*/
-        0,                      /*tp_base*/
-        0,                      /*tp_dict*/
-        0,                      /*tp_descr_get*/
-        0,                      /*tp_descr_set*/
-        0,                      /*tp_dictoffset*/
-        0,                      /*tp_init*/
-        0,                      /*tp_alloc*/
-        0,                      /*tp_new*/
-        0,                      /*tp_free*/
-        0,                      /*tp_is_gc*/
+static int
+ucd_traverse(PreviousDBVersion *self, visitproc visit, void *arg)
+{
+    Py_VISIT(Py_TYPE(self));
+    return 0;
+}
+
+static void
+ucd_dealloc(PreviousDBVersion *self)
+{
+    PyTypeObject *tp = Py_TYPE(self);
+    PyObject_GC_UnTrack(self);
+    PyObject_GC_Del(self);
+    Py_DECREF(tp);
+}
+
+static PyType_Slot ucd_type_slots[] = {
+    {Py_tp_dealloc, ucd_dealloc},
+    {Py_tp_traverse, ucd_traverse},
+    {Py_tp_getattro, PyObject_GenericGetAttr},
+    {Py_tp_methods, unicodedata_functions},
+    {Py_tp_members, DB_members},
+    {0, 0}
+};
+
+static PyType_Spec ucd_type_spec = {
+    .name = "unicodedata.UCD",
+    .basicsize = sizeof(PreviousDBVersion),
+    .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION |
+              Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_IMMUTABLETYPE),
+    .slots = ucd_type_slots
 };
 
 PyDoc_STRVAR(unicodedata_docstring,
@@ -1439,45 +1478,70 @@
 The module uses the same names and symbols as defined by the\n\
 UnicodeData File Format " UNIDATA_VERSION ".");
 
-static struct PyModuleDef unicodedatamodule = {
-        PyModuleDef_HEAD_INIT,
-        "unicodedata",
-        unicodedata_docstring,
-        -1,
-        unicodedata_functions,
-        NULL,
-        NULL,
-        NULL,
-        NULL
+static int
+unicodedata_exec(PyObject *module)
+{
+    if (PyModule_AddStringConstant(module, "unidata_version", UNIDATA_VERSION) < 0) {
+        return -1;
+    }
+
+    PyTypeObject *ucd_type = (PyTypeObject *)PyType_FromSpec(&ucd_type_spec);
+    if (ucd_type == NULL) {
+        return -1;
+    }
+
+    if (PyModule_AddType(module, ucd_type) < 0) {
+        Py_DECREF(ucd_type);
+        return -1;
+    }
+
+    // Unicode database version 3.2.0 used by the IDNA encoding
+    PyObject *v;
+    v = new_previous_version(ucd_type, "3.2.0",
+                             get_change_3_2_0, normalization_3_2_0);
+    Py_DECREF(ucd_type);
+    if (v == NULL) {
+        return -1;
+    }
+    if (PyModule_AddObject(module, "ucd_3_2_0", v) < 0) {
+        Py_DECREF(v);
+        return -1;
+    }
+
+    /* Export C API */
+    PyObject *capsule = unicodedata_create_capi();
+    if (capsule == NULL) {
+        return -1;
+    }
+    int rc = PyModule_AddObjectRef(module, "_ucnhash_CAPI", capsule);
+    Py_DECREF(capsule);
+    if (rc < 0) {
+        return -1;
+    }
+    return 0;
+}
+
+static PyModuleDef_Slot unicodedata_slots[] = {
+    {Py_mod_exec, unicodedata_exec},
+    {0, NULL}
+};
+
+static struct PyModuleDef unicodedata_module = {
+    PyModuleDef_HEAD_INIT,
+    .m_name = "unicodedata",
+    .m_doc = unicodedata_docstring,
+    .m_size = 0,
+    .m_methods = unicodedata_functions,
+    .m_slots = unicodedata_slots,
 };
 
 PyMODINIT_FUNC
 PyInit_unicodedata(void)
 {
-    PyObject *m, *v;
-
-    Py_SET_TYPE(&UCD_Type, &PyType_Type);
-
-    m = PyModule_Create(&unicodedatamodule);
-    if (!m)
-        return NULL;
-
-    PyModule_AddStringConstant(m, "unidata_version", UNIDATA_VERSION);
-    Py_INCREF(&UCD_Type);
-    PyModule_AddObject(m, "UCD", (PyObject*)&UCD_Type);
-
-    /* Previous versions */
-    v = new_previous_version("3.2.0", get_change_3_2_0, normalization_3_2_0);
-    if (v != NULL)
-        PyModule_AddObject(m, "ucd_3_2_0", v);
-
-    /* Export C API */
-    v = PyCapsule_New((void *)&hashAPI, PyUnicodeData_CAPSULE_NAME, NULL);
-    if (v != NULL)
-        PyModule_AddObject(m, "ucnhash_CAPI", v);
-    return m;
+    return PyModuleDef_Init(&unicodedata_module);
 }
 
+
 /*
 Local variables:
 c-basic-offset: 4
diff --git a/Modules/xxlimited.c b/Modules/xxlimited.c
index 5b05a94..9bd9a54 100644
--- a/Modules/xxlimited.c
+++ b/Modules/xxlimited.c
@@ -3,77 +3,134 @@
    also declares object types. All occurrences of 'Xxo' should be changed
    to something reasonable for your objects. After that, all other
    occurrences of 'xx' should be changed to something reasonable for your
-   module. If your module is named foo your sourcefile should be named
-   foomodule.c.
+   module. If your module is named foo your source file should be named
+   foo.c or foomodule.c.
 
    You will probably want to delete all references to 'x_attr' and add
    your own types of attributes instead.  Maybe you want to name your
    local variables other than 'self'.  If your object type is needed in
    other files, you'll have to create a file "foobarobject.h"; see
-   floatobject.h for an example. */
+   floatobject.h for an example.
 
-/* Xxo objects */
+   This module roughly corresponds to::
+
+      class Xxo:
+         """A class that explicitly stores attributes in an internal dict"""
+
+          def __init__(self):
+              # In the C class, "_x_attr" is not accessible from Python code
+              self._x_attr = {}
+
+          def __getattr__(self, name):
+              return self._x_attr[name]
+
+          def __setattr__(self, name, value):
+              self._x_attr[name] = value
+
+          def __delattr__(self, name):
+              del self._x_attr[name]
+
+          def demo(o, /):
+              if isinstance(o, str):
+                  return o
+              elif isinstance(o, Xxo):
+                  return o
+              else:
+                  raise Error('argument must be str or Xxo')
+
+      class Error(Exception):
+          """Exception raised by the xxlimited module"""
+
+      def foo(i: int, j: int, /):
+          """Return the sum of i and j."""
+          # Unlike this pseudocode, the C function will *only* work with
+          # integers and perform C long int arithmetic
+          return i + j
+
+      def new():
+          return Xxo()
+
+      def Str(str):
+          # A trivial subclass of a built-in type
+          pass
+   */
+
+#define Py_LIMITED_API 0x030a0000
 
 #include "Python.h"
 
-static PyObject *ErrorObject;
+// Module state
+typedef struct {
+    PyObject *Xxo_Type;    // Xxo class
+    PyObject *Error_Type;       // Error class
+} xx_state;
 
+
+/* Xxo objects */
+
+// Instance state
 typedef struct {
     PyObject_HEAD
     PyObject            *x_attr;        /* Attributes dictionary */
 } XxoObject;
 
-static PyObject *Xxo_Type;
-
-#define XxoObject_Check(v)      Py_IS_TYPE(v, Xxo_Type)
+// XXX: no good way to do this yet
+// #define XxoObject_Check(v)      Py_IS_TYPE(v, Xxo_Type)
 
 static XxoObject *
-newXxoObject(PyObject *arg)
+newXxoObject(PyObject *module)
 {
-    XxoObject *self;
-    self = PyObject_GC_New(XxoObject, (PyTypeObject*)Xxo_Type);
-    if (self == NULL)
+    xx_state *state = PyModule_GetState(module);
+    if (state == NULL) {
         return NULL;
+    }
+    XxoObject *self;
+    self = PyObject_GC_New(XxoObject, (PyTypeObject*)state->Xxo_Type);
+    if (self == NULL) {
+        return NULL;
+    }
     self->x_attr = NULL;
     return self;
 }
 
-/* Xxo methods */
+/* Xxo finalization */
 
 static int
 Xxo_traverse(XxoObject *self, visitproc visit, void *arg)
 {
+    // Visit the type
     Py_VISIT(Py_TYPE(self));
+
+    // Visit the attribute dict
     Py_VISIT(self->x_attr);
     return 0;
 }
 
+static int
+Xxo_clear(XxoObject *self)
+{
+    Py_CLEAR(self->x_attr);
+    return 0;
+}
+
 static void
 Xxo_finalize(XxoObject *self)
 {
     Py_CLEAR(self->x_attr);
 }
 
-static PyObject *
-Xxo_demo(XxoObject *self, PyObject *args)
+static void
+Xxo_dealloc(XxoObject *self)
 {
-    PyObject *o = NULL;
-    if (!PyArg_ParseTuple(args, "|O:demo", &o))
-        return NULL;
-    /* Test availability of fast type checks */
-    if (o != NULL && PyUnicode_Check(o)) {
-        Py_INCREF(o);
-        return o;
-    }
-    Py_INCREF(Py_None);
-    return Py_None;
+    Xxo_finalize(self);
+    PyTypeObject *tp = Py_TYPE(self);
+    freefunc free = PyType_GetSlot(tp, Py_tp_free);
+    free(self);
+    Py_DECREF(tp);
 }
 
-static PyMethodDef Xxo_methods[] = {
-    {"demo",            (PyCFunction)Xxo_demo,  METH_VARARGS,
-        PyDoc_STR("demo() -> None")},
-    {NULL,              NULL}           /* sentinel */
-};
+
+/* Xxo attribute handling */
 
 static PyObject *
 Xxo_getattro(XxoObject *self, PyObject *name)
@@ -92,45 +149,110 @@
 }
 
 static int
-Xxo_setattr(XxoObject *self, const char *name, PyObject *v)
+Xxo_setattro(XxoObject *self, PyObject *name, PyObject *v)
 {
     if (self->x_attr == NULL) {
+        // prepare the attribute dict
         self->x_attr = PyDict_New();
-        if (self->x_attr == NULL)
+        if (self->x_attr == NULL) {
             return -1;
+        }
     }
     if (v == NULL) {
-        int rv = PyDict_DelItemString(self->x_attr, name);
-        if (rv < 0 && PyErr_ExceptionMatches(PyExc_KeyError))
+        // delete an attribute
+        int rv = PyDict_DelItem(self->x_attr, name);
+        if (rv < 0 && PyErr_ExceptionMatches(PyExc_KeyError)) {
             PyErr_SetString(PyExc_AttributeError,
                 "delete non-existing Xxo attribute");
+            return -1;
+        }
         return rv;
     }
-    else
-        return PyDict_SetItemString(self->x_attr, name, v);
+    else {
+        // set an attribute
+        return PyDict_SetItem(self->x_attr, name, v);
+    }
 }
 
+/* Xxo methods */
+
+static PyObject *
+Xxo_demo(XxoObject *self, PyTypeObject *defining_class,
+         PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+{
+    if (kwnames != NULL && PyObject_Length(kwnames)) {
+        PyErr_SetString(PyExc_TypeError, "demo() takes no keyword arguments");
+        return NULL;
+    }
+    if (nargs != 1) {
+        PyErr_SetString(PyExc_TypeError, "demo() takes exactly 1 argument");
+        return NULL;
+    }
+
+    PyObject *o = args[0];
+
+    /* Test if the argument is "str" */
+    if (PyUnicode_Check(o)) {
+        Py_INCREF(o);
+        return o;
+    }
+
+    /* test if the argument is of the Xxo class */
+    if (PyObject_TypeCheck(o, defining_class)) {
+        Py_INCREF(o);
+        return o;
+    }
+
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+
+static PyMethodDef Xxo_methods[] = {
+    {"demo",            (PyCFunction)(void(*)(void))Xxo_demo,
+     METH_METHOD | METH_FASTCALL | METH_KEYWORDS, PyDoc_STR("demo(o) -> o")},
+    {NULL,              NULL}           /* sentinel */
+};
+
+/* Xxo type definition */
+
+PyDoc_STRVAR(Xxo_doc,
+             "A class that explicitly stores attributes in an internal dict");
+
 static PyType_Slot Xxo_Type_slots[] = {
-    {Py_tp_doc, "The Xxo type"},
+    {Py_tp_doc, (char *)Xxo_doc},
     {Py_tp_traverse, Xxo_traverse},
+    {Py_tp_clear, Xxo_clear},
     {Py_tp_finalize, Xxo_finalize},
+    {Py_tp_dealloc, Xxo_dealloc},
     {Py_tp_getattro, Xxo_getattro},
-    {Py_tp_setattr, Xxo_setattr},
+    {Py_tp_setattro, Xxo_setattro},
     {Py_tp_methods, Xxo_methods},
-    {0, 0},
+    {0, 0},  /* sentinel */
 };
 
 static PyType_Spec Xxo_Type_spec = {
-    "xxlimited.Xxo",
-    sizeof(XxoObject),
-    0,
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
-    Xxo_Type_slots
+    .name = "xxlimited.Xxo",
+    .basicsize = sizeof(XxoObject),
+    .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
+    .slots = Xxo_Type_slots,
 };
 
-/* --------------------------------------------------------------------- */
 
-/* Function of two integers returning integer */
+/* Str type definition*/
+
+static PyType_Slot Str_Type_slots[] = {
+    {0, 0},  /* sentinel */
+};
+
+static PyType_Spec Str_Type_spec = {
+    .name = "xxlimited.Str",
+    .basicsize = 0,
+    .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+    .slots = Str_Type_slots,
+};
+
+
+/* Function of two integers returning integer (with C "long int" arithmetic) */
 
 PyDoc_STRVAR(xx_foo_doc,
 "foo(i,j)\n\
@@ -138,7 +260,7 @@
 Return the sum of i and j.");
 
 static PyObject *
-xx_foo(PyObject *self, PyObject *args)
+xx_foo(PyObject *module, PyObject *args)
 {
     long i, j;
     long res;
@@ -152,153 +274,110 @@
 /* Function of no arguments returning new Xxo object */
 
 static PyObject *
-xx_new(PyObject *self, PyObject *args)
+xx_new(PyObject *module, PyObject *Py_UNUSED(unused))
 {
     XxoObject *rv;
 
-    if (!PyArg_ParseTuple(args, ":new"))
-        return NULL;
-    rv = newXxoObject(args);
+    rv = newXxoObject(module);
     if (rv == NULL)
         return NULL;
     return (PyObject *)rv;
 }
 
-/* Test bad format character */
 
-static PyObject *
-xx_roj(PyObject *self, PyObject *args)
-{
-    PyObject *a;
-    long b;
-    if (!PyArg_ParseTuple(args, "O#:roj", &a, &b))
-        return NULL;
-    Py_INCREF(Py_None);
-    return Py_None;
-}
-
-
-/* ---------- */
-
-static PyType_Slot Str_Type_slots[] = {
-    {Py_tp_base, NULL}, /* filled out in module init function */
-    {0, 0},
-};
-
-static PyType_Spec Str_Type_spec = {
-    "xxlimited.Str",
-    0,
-    0,
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-    Str_Type_slots
-};
-
-/* ---------- */
-
-static PyObject *
-null_richcompare(PyObject *self, PyObject *other, int op)
-{
-    Py_RETURN_NOTIMPLEMENTED;
-}
-
-static PyType_Slot Null_Type_slots[] = {
-    {Py_tp_base, NULL}, /* filled out in module init */
-    {Py_tp_new, NULL},
-    {Py_tp_richcompare, null_richcompare},
-    {0, 0}
-};
-
-static PyType_Spec Null_Type_spec = {
-    "xxlimited.Null",
-    0,               /* basicsize */
-    0,               /* itemsize */
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-    Null_Type_slots
-};
-
-/* ---------- */
 
 /* List of functions defined in the module */
 
 static PyMethodDef xx_methods[] = {
-    {"roj",             xx_roj,         METH_VARARGS,
-        PyDoc_STR("roj(a,b) -> None")},
     {"foo",             xx_foo,         METH_VARARGS,
         xx_foo_doc},
-    {"new",             xx_new,         METH_VARARGS,
+    {"new",             xx_new,         METH_NOARGS,
         PyDoc_STR("new() -> new Xx object")},
     {NULL,              NULL}           /* sentinel */
 };
 
+
+/* The module itself */
+
 PyDoc_STRVAR(module_doc,
 "This is a template module just for instruction.");
 
 static int
 xx_modexec(PyObject *m)
 {
-    PyObject *o;
+    xx_state *state = PyModule_GetState(m);
 
-    /* Due to cross platform compiler issues the slots must be filled
-     * here. It's required for portability to Windows without requiring
-     * C++. */
-    Null_Type_slots[0].pfunc = &PyBaseObject_Type;
-    Null_Type_slots[1].pfunc = PyType_GenericNew;
-    Str_Type_slots[0].pfunc = &PyUnicode_Type;
-
-    Xxo_Type = PyType_FromSpec(&Xxo_Type_spec);
-    if (Xxo_Type == NULL)
-        goto fail;
-
-    /* Add some symbolic constants to the module */
-    if (ErrorObject == NULL) {
-        ErrorObject = PyErr_NewException("xxlimited.error", NULL, NULL);
-        if (ErrorObject == NULL)
-            goto fail;
+    state->Error_Type = PyErr_NewException("xxlimited.Error", NULL, NULL);
+    if (state->Error_Type == NULL) {
+        return -1;
     }
-    Py_INCREF(ErrorObject);
-    PyModule_AddObject(m, "error", ErrorObject);
+    if (PyModule_AddType(m, (PyTypeObject*)state->Error_Type) < 0) {
+        return -1;
+    }
 
-    /* Add Xxo */
-    o = PyType_FromSpec(&Xxo_Type_spec);
-    if (o == NULL)
-        goto fail;
-    PyModule_AddObject(m, "Xxo", o);
+    state->Xxo_Type = PyType_FromModuleAndSpec(m, &Xxo_Type_spec, NULL);
+    if (state->Xxo_Type == NULL) {
+        return -1;
+    }
+    if (PyModule_AddType(m, (PyTypeObject*)state->Xxo_Type) < 0) {
+        return -1;
+    }
 
-    /* Add Str */
-    o = PyType_FromSpec(&Str_Type_spec);
-    if (o == NULL)
-        goto fail;
-    PyModule_AddObject(m, "Str", o);
+    // Add the Str type. It is not needed from C code, so it is only
+    // added to the module dict.
+    // It does not inherit from "object" (PyObject_Type), but from "str"
+    // (PyUnincode_Type).
+    PyObject *Str_Type = PyType_FromModuleAndSpec(
+        m, &Str_Type_spec, (PyObject *)&PyUnicode_Type);
+    if (Str_Type == NULL) {
+        return -1;
+    }
+    if (PyModule_AddType(m, (PyTypeObject*)Str_Type) < 0) {
+        return -1;
+    }
+    Py_DECREF(Str_Type);
 
-    /* Add Null */
-    o = PyType_FromSpec(&Null_Type_spec);
-    if (o == NULL)
-        goto fail;
-    PyModule_AddObject(m, "Null", o);
     return 0;
- fail:
-    Py_XDECREF(m);
-    return -1;
 }
 
-
 static PyModuleDef_Slot xx_slots[] = {
     {Py_mod_exec, xx_modexec},
     {0, NULL}
 };
 
+static int
+xx_traverse(PyObject *module, visitproc visit, void *arg)
+{
+    xx_state *state = PyModule_GetState(module);
+    Py_VISIT(state->Xxo_Type);
+    Py_VISIT(state->Error_Type);
+    return 0;
+}
+
+static int
+xx_clear(PyObject *module)
+{
+    xx_state *state = PyModule_GetState(module);
+    Py_CLEAR(state->Xxo_Type);
+    Py_CLEAR(state->Error_Type);
+    return 0;
+}
+
 static struct PyModuleDef xxmodule = {
     PyModuleDef_HEAD_INIT,
-    "xxlimited",
-    module_doc,
-    0,
-    xx_methods,
-    xx_slots,
-    NULL,
-    NULL,
-    NULL
+    .m_name = "xxlimited",
+    .m_doc = module_doc,
+    .m_size = sizeof(xx_state),
+    .m_methods = xx_methods,
+    .m_slots = xx_slots,
+    .m_traverse = xx_traverse,
+    .m_clear = xx_clear,
+    /* m_free is not necessary here: xx_clear clears all references,
+     * and the module state is deallocated along with the module.
+     */
 };
 
+
 /* Export function for the module (*must* be called PyInit_xx) */
 
 PyMODINIT_FUNC
diff --git a/Modules/xxlimited_35.c b/Modules/xxlimited_35.c
new file mode 100644
index 0000000..647abf6
--- /dev/null
+++ b/Modules/xxlimited_35.c
@@ -0,0 +1,311 @@
+
+/* This module is compiled using limited API from Python 3.5,
+ * making sure that it works as expected.
+ *
+ * See the xxlimited module for an extension module template.
+ */
+
+#define Py_LIMITED_API 0x03050000
+
+#include "Python.h"
+
+/* Xxo objects */
+
+static PyObject *ErrorObject;
+
+typedef struct {
+    PyObject_HEAD
+    PyObject            *x_attr;        /* Attributes dictionary */
+} XxoObject;
+
+static PyObject *Xxo_Type;
+
+#define XxoObject_Check(v)      Py_IS_TYPE(v, Xxo_Type)
+
+static XxoObject *
+newXxoObject(PyObject *arg)
+{
+    XxoObject *self;
+    self = PyObject_GC_New(XxoObject, (PyTypeObject*)Xxo_Type);
+    if (self == NULL)
+        return NULL;
+    self->x_attr = NULL;
+    return self;
+}
+
+/* Xxo methods */
+
+static int
+Xxo_traverse(XxoObject *self, visitproc visit, void *arg)
+{
+    Py_VISIT(Py_TYPE(self));
+    Py_VISIT(self->x_attr);
+    return 0;
+}
+
+static int
+Xxo_clear(XxoObject *self)
+{
+    Py_CLEAR(self->x_attr);
+    return 0;
+}
+
+static void
+Xxo_finalize(XxoObject *self)
+{
+    Py_CLEAR(self->x_attr);
+}
+
+static PyObject *
+Xxo_demo(XxoObject *self, PyObject *args)
+{
+    PyObject *o = NULL;
+    if (!PyArg_ParseTuple(args, "|O:demo", &o))
+        return NULL;
+    /* Test availability of fast type checks */
+    if (o != NULL && PyUnicode_Check(o)) {
+        Py_INCREF(o);
+        return o;
+    }
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+
+static PyMethodDef Xxo_methods[] = {
+    {"demo",            (PyCFunction)Xxo_demo,  METH_VARARGS,
+        PyDoc_STR("demo() -> None")},
+    {NULL,              NULL}           /* sentinel */
+};
+
+static PyObject *
+Xxo_getattro(XxoObject *self, PyObject *name)
+{
+    if (self->x_attr != NULL) {
+        PyObject *v = PyDict_GetItemWithError(self->x_attr, name);
+        if (v != NULL) {
+            Py_INCREF(v);
+            return v;
+        }
+        else if (PyErr_Occurred()) {
+            return NULL;
+        }
+    }
+    return PyObject_GenericGetAttr((PyObject *)self, name);
+}
+
+static int
+Xxo_setattr(XxoObject *self, const char *name, PyObject *v)
+{
+    if (self->x_attr == NULL) {
+        self->x_attr = PyDict_New();
+        if (self->x_attr == NULL)
+            return -1;
+    }
+    if (v == NULL) {
+        int rv = PyDict_DelItemString(self->x_attr, name);
+        if (rv < 0 && PyErr_ExceptionMatches(PyExc_KeyError))
+            PyErr_SetString(PyExc_AttributeError,
+                "delete non-existing Xxo attribute");
+        return rv;
+    }
+    else
+        return PyDict_SetItemString(self->x_attr, name, v);
+}
+
+static PyType_Slot Xxo_Type_slots[] = {
+    {Py_tp_doc, "The Xxo type"},
+    {Py_tp_traverse, Xxo_traverse},
+    {Py_tp_clear, Xxo_clear},
+    {Py_tp_finalize, Xxo_finalize},
+    {Py_tp_getattro, Xxo_getattro},
+    {Py_tp_setattr, Xxo_setattr},
+    {Py_tp_methods, Xxo_methods},
+    {0, 0},
+};
+
+static PyType_Spec Xxo_Type_spec = {
+    "xxlimited.Xxo",
+    sizeof(XxoObject),
+    0,
+    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
+    Xxo_Type_slots
+};
+
+/* --------------------------------------------------------------------- */
+
+/* Function of two integers returning integer */
+
+PyDoc_STRVAR(xx_foo_doc,
+"foo(i,j)\n\
+\n\
+Return the sum of i and j.");
+
+static PyObject *
+xx_foo(PyObject *self, PyObject *args)
+{
+    long i, j;
+    long res;
+    if (!PyArg_ParseTuple(args, "ll:foo", &i, &j))
+        return NULL;
+    res = i+j; /* XXX Do something here */
+    return PyLong_FromLong(res);
+}
+
+
+/* Function of no arguments returning new Xxo object */
+
+static PyObject *
+xx_new(PyObject *self, PyObject *args)
+{
+    XxoObject *rv;
+
+    if (!PyArg_ParseTuple(args, ":new"))
+        return NULL;
+    rv = newXxoObject(args);
+    if (rv == NULL)
+        return NULL;
+    return (PyObject *)rv;
+}
+
+/* Test bad format character */
+
+static PyObject *
+xx_roj(PyObject *self, PyObject *args)
+{
+    PyObject *a;
+    long b;
+    if (!PyArg_ParseTuple(args, "O#:roj", &a, &b))
+        return NULL;
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+
+
+/* ---------- */
+
+static PyType_Slot Str_Type_slots[] = {
+    {Py_tp_base, NULL}, /* filled out in module init function */
+    {0, 0},
+};
+
+static PyType_Spec Str_Type_spec = {
+    "xxlimited.Str",
+    0,
+    0,
+    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+    Str_Type_slots
+};
+
+/* ---------- */
+
+static PyObject *
+null_richcompare(PyObject *self, PyObject *other, int op)
+{
+    Py_RETURN_NOTIMPLEMENTED;
+}
+
+static PyType_Slot Null_Type_slots[] = {
+    {Py_tp_base, NULL}, /* filled out in module init */
+    {Py_tp_new, NULL},
+    {Py_tp_richcompare, null_richcompare},
+    {0, 0}
+};
+
+static PyType_Spec Null_Type_spec = {
+    "xxlimited.Null",
+    0,               /* basicsize */
+    0,               /* itemsize */
+    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+    Null_Type_slots
+};
+
+/* ---------- */
+
+/* List of functions defined in the module */
+
+static PyMethodDef xx_methods[] = {
+    {"roj",             xx_roj,         METH_VARARGS,
+        PyDoc_STR("roj(a,b) -> None")},
+    {"foo",             xx_foo,         METH_VARARGS,
+        xx_foo_doc},
+    {"new",             xx_new,         METH_VARARGS,
+        PyDoc_STR("new() -> new Xx object")},
+    {NULL,              NULL}           /* sentinel */
+};
+
+PyDoc_STRVAR(module_doc,
+"This is a module for testing limited API from Python 3.5.");
+
+static int
+xx_modexec(PyObject *m)
+{
+    PyObject *o;
+
+    /* Due to cross platform compiler issues the slots must be filled
+     * here. It's required for portability to Windows without requiring
+     * C++. */
+    Null_Type_slots[0].pfunc = &PyBaseObject_Type;
+    Null_Type_slots[1].pfunc = PyType_GenericNew;
+    Str_Type_slots[0].pfunc = &PyUnicode_Type;
+
+    Xxo_Type = PyType_FromSpec(&Xxo_Type_spec);
+    if (Xxo_Type == NULL)
+        goto fail;
+
+    /* Add some symbolic constants to the module */
+    if (ErrorObject == NULL) {
+        ErrorObject = PyErr_NewException("xxlimited.error", NULL, NULL);
+        if (ErrorObject == NULL)
+            goto fail;
+    }
+    Py_INCREF(ErrorObject);
+    PyModule_AddObject(m, "error", ErrorObject);
+
+    /* Add Xxo */
+    o = PyType_FromSpec(&Xxo_Type_spec);
+    if (o == NULL)
+        goto fail;
+    PyModule_AddObject(m, "Xxo", o);
+
+    /* Add Str */
+    o = PyType_FromSpec(&Str_Type_spec);
+    if (o == NULL)
+        goto fail;
+    PyModule_AddObject(m, "Str", o);
+
+    /* Add Null */
+    o = PyType_FromSpec(&Null_Type_spec);
+    if (o == NULL)
+        goto fail;
+    PyModule_AddObject(m, "Null", o);
+    return 0;
+ fail:
+    Py_XDECREF(m);
+    return -1;
+}
+
+
+static PyModuleDef_Slot xx_slots[] = {
+    {Py_mod_exec, xx_modexec},
+    {0, NULL}
+};
+
+static struct PyModuleDef xxmodule = {
+    PyModuleDef_HEAD_INIT,
+    "xxlimited_35",
+    module_doc,
+    0,
+    xx_methods,
+    xx_slots,
+    NULL,
+    NULL,
+    NULL
+};
+
+/* Export function for the module (*must* be called PyInit_xx) */
+
+PyMODINIT_FUNC
+PyInit_xxlimited_35(void)
+{
+    return PyModuleDef_Init(&xxmodule);
+}
diff --git a/Modules/xxmodule.c b/Modules/xxmodule.c
index 17b049c..edcd621 100644
--- a/Modules/xxmodule.c
+++ b/Modules/xxmodule.c
@@ -44,7 +44,7 @@
 Xxo_dealloc(XxoObject *self)
 {
     Py_XDECREF(self->x_attr);
-    PyObject_Del(self);
+    PyObject_Free(self);
 }
 
 static PyObject *
diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c
index fe27909..a6940f2 100644
--- a/Modules/zlibmodule.c
+++ b/Modules/zlibmodule.c
@@ -9,11 +9,166 @@
 #include "structmember.h"         // PyMemberDef
 #include "zlib.h"
 
+// Blocks output buffer wrappers
+#include "pycore_blocks_output_buffer.h"
 
-#define ENTER_ZLIB(obj) \
-    Py_BEGIN_ALLOW_THREADS; \
-    PyThread_acquire_lock((obj)->lock, 1); \
-    Py_END_ALLOW_THREADS;
+#if OUTPUT_BUFFER_MAX_BLOCK_SIZE > UINT32_MAX
+    #error "The maximum block size accepted by zlib is UINT32_MAX."
+#endif
+
+/* On success, return value >= 0
+   On failure, return -1 */
+static inline Py_ssize_t
+OutputBuffer_InitAndGrow(_BlocksOutputBuffer *buffer, Py_ssize_t max_length,
+                         Bytef **next_out, uint32_t *avail_out)
+{
+    Py_ssize_t allocated;
+
+    allocated = _BlocksOutputBuffer_InitAndGrow(
+                    buffer, max_length, (void**) next_out);
+    *avail_out = (uint32_t) allocated;
+    return allocated;
+}
+
+/* On success, return value >= 0
+   On failure, return -1 */
+static inline Py_ssize_t
+OutputBuffer_Grow(_BlocksOutputBuffer *buffer,
+                  Bytef **next_out, uint32_t *avail_out)
+{
+    Py_ssize_t allocated;
+
+    allocated = _BlocksOutputBuffer_Grow(
+                    buffer, (void**) next_out, (Py_ssize_t) *avail_out);
+    *avail_out = (uint32_t) allocated;
+    return allocated;
+}
+
+static inline Py_ssize_t
+OutputBuffer_GetDataSize(_BlocksOutputBuffer *buffer, uint32_t avail_out)
+{
+    return _BlocksOutputBuffer_GetDataSize(buffer, (Py_ssize_t) avail_out);
+}
+
+static inline PyObject *
+OutputBuffer_Finish(_BlocksOutputBuffer *buffer, uint32_t avail_out)
+{
+    return _BlocksOutputBuffer_Finish(buffer, (Py_ssize_t) avail_out);
+}
+
+static inline void
+OutputBuffer_OnError(_BlocksOutputBuffer *buffer)
+{
+    _BlocksOutputBuffer_OnError(buffer);
+}
+
+/* The max buffer size accepted by zlib is UINT32_MAX, the initial buffer size
+   `init_size` may > it in 64-bit build. These wrapper functions maintain an
+   UINT32_MAX sliding window for the first block:
+    1. OutputBuffer_WindowInitWithSize()
+    2. OutputBuffer_WindowGrow()
+    3. OutputBuffer_WindowFinish()
+    4. OutputBuffer_WindowOnError()
+
+   ==== is the sliding window:
+    1. ====------
+           ^ next_posi, left_bytes is 6
+    2. ----====--
+               ^ next_posi, left_bytes is 2
+    3. --------==
+                 ^ next_posi, left_bytes is 0  */
+typedef struct {
+    Py_ssize_t left_bytes;
+    Bytef *next_posi;
+} _Uint32Window;
+
+/* Initialize the buffer with an initial buffer size.
+
+   On success, return value >= 0
+   On failure, return value < 0 */
+static inline Py_ssize_t
+OutputBuffer_WindowInitWithSize(_BlocksOutputBuffer *buffer, _Uint32Window *window,
+                                Py_ssize_t init_size,
+                                Bytef **next_out, uint32_t *avail_out)
+{
+    Py_ssize_t allocated = _BlocksOutputBuffer_InitWithSize(
+                               buffer, init_size, (void**) next_out);
+
+    if (allocated >= 0) {
+        // the UINT32_MAX sliding window
+        Py_ssize_t window_size = Py_MIN((size_t)allocated, UINT32_MAX);
+        *avail_out = (uint32_t) window_size;
+
+        window->left_bytes = allocated - window_size;
+        window->next_posi = *next_out + window_size;
+    }
+    return allocated;
+}
+
+/* Grow the buffer.
+
+   On success, return value >= 0
+   On failure, return value < 0 */
+static inline Py_ssize_t
+OutputBuffer_WindowGrow(_BlocksOutputBuffer *buffer, _Uint32Window *window,
+                        Bytef **next_out, uint32_t *avail_out)
+{
+    Py_ssize_t allocated;
+
+    /* ensure no gaps in the data.
+       if inlined, this check could be optimized away.*/
+    if (*avail_out != 0) {
+        PyErr_SetString(PyExc_SystemError,
+                        "*avail_out != 0 in OutputBuffer_WindowGrow().");
+        return -1;
+    }
+
+    // slide the UINT32_MAX sliding window
+    if (window->left_bytes > 0) {
+        Py_ssize_t window_size = Py_MIN((size_t)window->left_bytes, UINT32_MAX);
+
+        *next_out = window->next_posi;
+        *avail_out = (uint32_t) window_size;
+
+        window->left_bytes -= window_size;
+        window->next_posi += window_size;
+
+        return window_size;
+    }
+    assert(window->left_bytes == 0);
+
+    // only the first block may > UINT32_MAX
+    allocated = _BlocksOutputBuffer_Grow(
+                    buffer, (void**) next_out, (Py_ssize_t) *avail_out);
+    *avail_out = (uint32_t) allocated;
+    return allocated;
+}
+
+/* Finish the buffer.
+
+   On success, return a bytes object
+   On failure, return NULL */
+static inline PyObject *
+OutputBuffer_WindowFinish(_BlocksOutputBuffer *buffer, _Uint32Window *window,
+                          uint32_t avail_out)
+{
+    Py_ssize_t real_avail_out = (Py_ssize_t) avail_out + window->left_bytes;
+    return _BlocksOutputBuffer_Finish(buffer, real_avail_out);
+}
+
+static inline void
+OutputBuffer_WindowOnError(_BlocksOutputBuffer *buffer, _Uint32Window *window)
+{
+    _BlocksOutputBuffer_OnError(buffer);
+}
+
+
+#define ENTER_ZLIB(obj) do {                      \
+    if (!PyThread_acquire_lock((obj)->lock, 0)) { \
+        Py_BEGIN_ALLOW_THREADS                    \
+        PyThread_acquire_lock((obj)->lock, 1);    \
+        Py_END_ALLOW_THREADS                      \
+    } } while (0)
 #define LEAVE_ZLIB(obj) PyThread_release_lock((obj)->lock);
 
 #if defined(ZLIB_VERNUM) && ZLIB_VERNUM >= 0x1221
@@ -37,18 +192,16 @@
     PyTypeObject *Comptype;
     PyTypeObject *Decomptype;
     PyObject *ZlibError;
-} _zlibstate;
+} zlibstate;
 
-static inline _zlibstate*
+static inline zlibstate*
 get_zlib_state(PyObject *module)
 {
     void *state = PyModule_GetState(module);
     assert(state != NULL);
-    return (_zlibstate *)state;
+    return (zlibstate *)state;
 }
 
-#define _zlibstate_global ((_zlibstate *)PyModule_GetState(PyState_FindModule(&zlibmodule)))
-
 typedef struct
 {
     PyObject_HEAD
@@ -62,7 +215,7 @@
 } compobject;
 
 static void
-zlib_error(z_stream zst, int err, const char *msg)
+zlib_error(zlibstate *state, z_stream zst, int err, const char *msg)
 {
     const char *zmsg = Z_NULL;
     /* In case of a version mismatch, zst.msg won't be initialized.
@@ -85,9 +238,9 @@
         }
     }
     if (zmsg == Z_NULL)
-        PyErr_Format(_zlibstate_global->ZlibError, "Error %d %s", err, msg);
+        PyErr_Format(state->ZlibError, "Error %d %s", err, msg);
     else
-        PyErr_Format(_zlibstate_global->ZlibError, "Error %d %s: %.200s", err, msg, zmsg);
+        PyErr_Format(state->ZlibError, "Error %d %s: %.200s", err, msg, zmsg);
 }
 
 /*[clinic input]
@@ -149,56 +302,6 @@
     *remains -= zst->avail_in;
 }
 
-static Py_ssize_t
-arrange_output_buffer_with_maximum(z_stream *zst, PyObject **buffer,
-                                   Py_ssize_t length,
-                                   Py_ssize_t max_length)
-{
-    Py_ssize_t occupied;
-
-    if (*buffer == NULL) {
-        if (!(*buffer = PyBytes_FromStringAndSize(NULL, length)))
-            return -1;
-        occupied = 0;
-    }
-    else {
-        occupied = zst->next_out - (Byte *)PyBytes_AS_STRING(*buffer);
-
-        if (length == occupied) {
-            Py_ssize_t new_length;
-            assert(length <= max_length);
-            /* can not scale the buffer over max_length */
-            if (length == max_length)
-                return -2;
-            if (length <= (max_length >> 1))
-                new_length = length << 1;
-            else
-                new_length = max_length;
-            if (_PyBytes_Resize(buffer, new_length) < 0)
-                return -1;
-            length = new_length;
-        }
-    }
-
-    zst->avail_out = (uInt)Py_MIN((size_t)(length - occupied), UINT_MAX);
-    zst->next_out = (Byte *)PyBytes_AS_STRING(*buffer) + occupied;
-
-    return length;
-}
-
-static Py_ssize_t
-arrange_output_buffer(z_stream *zst, PyObject **buffer, Py_ssize_t length)
-{
-    Py_ssize_t ret;
-
-    ret = arrange_output_buffer_with_maximum(zst, buffer, length,
-                                             PY_SSIZE_T_MAX);
-    if (ret == -2)
-        PyErr_NoMemory();
-
-    return ret;
-}
-
 /*[clinic input]
 zlib.compress
 
@@ -215,20 +318,25 @@
 zlib_compress_impl(PyObject *module, Py_buffer *data, int level)
 /*[clinic end generated code: output=d80906d73f6294c8 input=638d54b6315dbed3]*/
 {
-    PyObject *RetVal = NULL;
-    Byte *ibuf;
-    Py_ssize_t ibuflen, obuflen = DEF_BUF_SIZE;
-    int err, flush;
+    PyObject *RetVal;
+    int flush;
     z_stream zst;
+    _BlocksOutputBuffer buffer = {.list = NULL};
 
-    ibuf = data->buf;
-    ibuflen = data->len;
+    zlibstate *state = get_zlib_state(module);
+
+    Byte *ibuf = data->buf;
+    Py_ssize_t ibuflen = data->len;
+
+    if (OutputBuffer_InitAndGrow(&buffer, -1, &zst.next_out, &zst.avail_out) < 0) {
+        goto error;
+    }
 
     zst.opaque = NULL;
     zst.zalloc = PyZlib_Malloc;
     zst.zfree = PyZlib_Free;
     zst.next_in = ibuf;
-    err = deflateInit(&zst, level);
+    int err = deflateInit(&zst, level);
 
     switch (err) {
     case Z_OK:
@@ -238,11 +346,11 @@
                         "Out of memory while compressing data");
         goto error;
     case Z_STREAM_ERROR:
-        PyErr_SetString(_zlibstate_global->ZlibError, "Bad compression level");
+        PyErr_SetString(state->ZlibError, "Bad compression level");
         goto error;
     default:
         deflateEnd(&zst);
-        zlib_error(zst, err, "while compressing data");
+        zlib_error(state, zst, err, "while compressing data");
         goto error;
     }
 
@@ -251,10 +359,11 @@
         flush = ibuflen == 0 ? Z_FINISH : Z_NO_FLUSH;
 
         do {
-            obuflen = arrange_output_buffer(&zst, &RetVal, obuflen);
-            if (obuflen < 0) {
-                deflateEnd(&zst);
-                goto error;
+            if (zst.avail_out == 0) {
+                if (OutputBuffer_Grow(&buffer, &zst.next_out, &zst.avail_out) < 0) {
+                    deflateEnd(&zst);
+                    goto error;
+                }
             }
 
             Py_BEGIN_ALLOW_THREADS
@@ -263,7 +372,7 @@
 
             if (err == Z_STREAM_ERROR) {
                 deflateEnd(&zst);
-                zlib_error(zst, err, "while compressing data");
+                zlib_error(state, zst, err, "while compressing data");
                 goto error;
             }
 
@@ -275,49 +384,19 @@
 
     err = deflateEnd(&zst);
     if (err == Z_OK) {
-        if (_PyBytes_Resize(&RetVal, zst.next_out -
-                            (Byte *)PyBytes_AS_STRING(RetVal)) < 0)
+        RetVal = OutputBuffer_Finish(&buffer, zst.avail_out);
+        if (RetVal == NULL) {
             goto error;
+        }
         return RetVal;
     }
     else
-        zlib_error(zst, err, "while finishing compression");
+        zlib_error(state, zst, err, "while finishing compression");
  error:
-    Py_XDECREF(RetVal);
+    OutputBuffer_OnError(&buffer);
     return NULL;
 }
 
-/*[python input]
-
-class ssize_t_converter(CConverter):
-    type = 'Py_ssize_t'
-    converter = 'ssize_t_converter'
-    c_ignored_default = "0"
-
-[python start generated code]*/
-/*[python end generated code: output=da39a3ee5e6b4b0d input=5f34ba1b394cb8e7]*/
-
-static int
-ssize_t_converter(PyObject *obj, void *ptr)
-{
-    PyObject *long_obj;
-    Py_ssize_t val;
-
-    /* XXX Should be replaced with PyNumber_AsSsize_t after the end of the
-       deprecation period. */
-    long_obj = _PyLong_FromNbIndexOrNbInt(obj);
-    if (long_obj == NULL) {
-        return 0;
-    }
-    val = PyLong_AsSsize_t(long_obj);
-    Py_DECREF(long_obj);
-    if (val == -1 && PyErr_Occurred()) {
-        return 0;
-    }
-    *(Py_ssize_t *)ptr = val;
-    return 1;
-}
-
 /*[clinic input]
 zlib.decompress
 
@@ -326,7 +405,7 @@
     /
     wbits: int(c_default="MAX_WBITS") = MAX_WBITS
         The window buffer size and container format.
-    bufsize: ssize_t(c_default="DEF_BUF_SIZE") = DEF_BUF_SIZE
+    bufsize: Py_ssize_t(c_default="DEF_BUF_SIZE") = DEF_BUF_SIZE
         The initial output buffer size.
 
 Returns a bytes object containing the uncompressed data.
@@ -335,13 +414,17 @@
 static PyObject *
 zlib_decompress_impl(PyObject *module, Py_buffer *data, int wbits,
                      Py_ssize_t bufsize)
-/*[clinic end generated code: output=77c7e35111dc8c42 input=21960936208e9a5b]*/
+/*[clinic end generated code: output=77c7e35111dc8c42 input=a9ac17beff1f893f]*/
 {
-    PyObject *RetVal = NULL;
+    PyObject *RetVal;
     Byte *ibuf;
     Py_ssize_t ibuflen;
     int err, flush;
     z_stream zst;
+    _BlocksOutputBuffer buffer = {.list = NULL};
+    _Uint32Window window;  // output buffer's UINT32_MAX sliding window
+
+    zlibstate *state = get_zlib_state(module);
 
     if (bufsize < 0) {
         PyErr_SetString(PyExc_ValueError, "bufsize must be non-negative");
@@ -350,6 +433,11 @@
         bufsize = 1;
     }
 
+    if (OutputBuffer_WindowInitWithSize(&buffer, &window, bufsize,
+                                        &zst.next_out, &zst.avail_out) < 0) {
+        goto error;
+    }
+
     ibuf = data->buf;
     ibuflen = data->len;
 
@@ -369,7 +457,7 @@
         goto error;
     default:
         inflateEnd(&zst);
-        zlib_error(zst, err, "while preparing to decompress data");
+        zlib_error(state, zst, err, "while preparing to decompress data");
         goto error;
     }
 
@@ -378,10 +466,12 @@
         flush = ibuflen == 0 ? Z_FINISH : Z_NO_FLUSH;
 
         do {
-            bufsize = arrange_output_buffer(&zst, &RetVal, bufsize);
-            if (bufsize < 0) {
-                inflateEnd(&zst);
-                goto error;
+            if (zst.avail_out == 0) {
+                if (OutputBuffer_WindowGrow(&buffer, &window,
+                                            &zst.next_out, &zst.avail_out) < 0) {
+                    inflateEnd(&zst);
+                    goto error;
+                }
             }
 
             Py_BEGIN_ALLOW_THREADS
@@ -400,7 +490,7 @@
                 goto error;
             default:
                 inflateEnd(&zst);
-                zlib_error(zst, err, "while decompressing data");
+                zlib_error(state, zst, err, "while decompressing data");
                 goto error;
             }
 
@@ -411,24 +501,23 @@
 
     if (err != Z_STREAM_END) {
         inflateEnd(&zst);
-        zlib_error(zst, err, "while decompressing data");
+        zlib_error(state, zst, err, "while decompressing data");
         goto error;
     }
 
     err = inflateEnd(&zst);
     if (err != Z_OK) {
-        zlib_error(zst, err, "while finishing decompression");
+        zlib_error(state, zst, err, "while finishing decompression");
         goto error;
     }
 
-    if (_PyBytes_Resize(&RetVal, zst.next_out -
-                        (Byte *)PyBytes_AS_STRING(RetVal)) < 0)
-        goto error;
-
-    return RetVal;
+    RetVal = OutputBuffer_WindowFinish(&buffer, &window, zst.avail_out);
+    if (RetVal != NULL) {
+        return RetVal;
+    }
 
  error:
-    Py_XDECREF(RetVal);
+    OutputBuffer_WindowOnError(&buffer, &window);
     return NULL;
 }
 
@@ -465,16 +554,14 @@
                       int memLevel, int strategy, Py_buffer *zdict)
 /*[clinic end generated code: output=8b5bed9c8fc3814d input=2fa3d026f90ab8d5]*/
 {
-    compobject *self = NULL;
-    int err;
-
+    zlibstate *state = get_zlib_state(module);
     if (zdict->buf != NULL && (size_t)zdict->len > UINT_MAX) {
         PyErr_SetString(PyExc_OverflowError,
                         "zdict length does not fit in an unsigned int");
-        goto error;
+        return NULL;
     }
 
-    self = newcompobject(_zlibstate_global->Comptype);
+    compobject *self = newcompobject(state->Comptype);
     if (self == NULL)
         goto error;
     self->zst.opaque = NULL;
@@ -482,7 +569,7 @@
     self->zst.zfree = PyZlib_Free;
     self->zst.next_in = NULL;
     self->zst.avail_in = 0;
-    err = deflateInit2(&self->zst, level, method, wbits, memLevel, strategy);
+    int err = deflateInit2(&self->zst, level, method, wbits, memLevel, strategy);
     switch (err) {
     case Z_OK:
         self->is_initialised = 1;
@@ -510,7 +597,7 @@
         PyErr_SetString(PyExc_ValueError, "Invalid initialization option");
         goto error;
     default:
-        zlib_error(self->zst, err, "while creating compression object");
+        zlib_error(state, self->zst, err, "while creating compression object");
         goto error;
     }
 
@@ -521,11 +608,9 @@
 }
 
 static int
-set_inflate_zdict(compobject *self)
+set_inflate_zdict(zlibstate *state, compobject *self)
 {
     Py_buffer zdict_buf;
-    int err;
-
     if (PyObject_GetBuffer(self->zdict, &zdict_buf, PyBUF_SIMPLE) == -1) {
         return -1;
     }
@@ -535,11 +620,12 @@
         PyBuffer_Release(&zdict_buf);
         return -1;
     }
+    int err;
     err = inflateSetDictionary(&self->zst,
                                zdict_buf.buf, (unsigned int)zdict_buf.len);
     PyBuffer_Release(&zdict_buf);
     if (err != Z_OK) {
-        zlib_error(self->zst, err, "while setting zdict");
+        zlib_error(state, self->zst, err, "while setting zdict");
         return -1;
     }
     return 0;
@@ -561,8 +647,7 @@
 zlib_decompressobj_impl(PyObject *module, int wbits, PyObject *zdict)
 /*[clinic end generated code: output=3069b99994f36906 input=d3832b8511fc977b]*/
 {
-    int err;
-    compobject *self;
+    zlibstate *state = get_zlib_state(module);
 
     if (zdict != NULL && !PyObject_CheckBuffer(zdict)) {
         PyErr_SetString(PyExc_TypeError,
@@ -570,7 +655,7 @@
         return NULL;
     }
 
-    self = newcompobject(_zlibstate_global->Decomptype);
+    compobject *self = newcompobject(state->Decomptype);
     if (self == NULL)
         return NULL;
     self->zst.opaque = NULL;
@@ -582,18 +667,18 @@
         Py_INCREF(zdict);
         self->zdict = zdict;
     }
-    err = inflateInit2(&self->zst, wbits);
+    int err = inflateInit2(&self->zst, wbits);
     switch (err) {
     case Z_OK:
         self->is_initialised = 1;
         if (self->zdict != NULL && wbits < 0) {
 #ifdef AT_LEAST_ZLIB_1_2_2_1
-            if (set_inflate_zdict(self) < 0) {
+            if (set_inflate_zdict(state, self) < 0) {
                 Py_DECREF(self);
                 return NULL;
             }
 #else
-            PyErr_Format(_zlibstate_global->ZlibError,
+            PyErr_Format(state->ZlibError,
                          "zlib version %s does not allow raw inflate with dictionary",
                          ZLIB_VERSION);
             Py_DECREF(self);
@@ -611,7 +696,7 @@
                         "Can't allocate memory for decompression object");
         return NULL;
     default:
-        zlib_error(self->zst, err, "while creating decompression object");
+        zlib_error(state, self->zst, err, "while creating decompression object");
         Py_DECREF(self);
         return NULL;
     }
@@ -625,7 +710,7 @@
     Py_XDECREF(self->unused_data);
     Py_XDECREF(self->unconsumed_tail);
     Py_XDECREF(self->zdict);
-    PyObject_Del(self);
+    PyObject_Free(self);
     Py_DECREF(type);
 }
 
@@ -648,6 +733,7 @@
 /*[clinic input]
 zlib.Compress.compress
 
+    cls: defining_class
     data: Py_buffer
         Binary data to be compressed.
     /
@@ -660,32 +746,40 @@
 [clinic start generated code]*/
 
 static PyObject *
-zlib_Compress_compress_impl(compobject *self, Py_buffer *data)
-/*[clinic end generated code: output=5d5cd791cbc6a7f4 input=0d95908d6e64fab8]*/
+zlib_Compress_compress_impl(compobject *self, PyTypeObject *cls,
+                            Py_buffer *data)
+/*[clinic end generated code: output=6731b3f0ff357ca6 input=04d00f65ab01d260]*/
 {
-    PyObject *RetVal = NULL;
-    Py_ssize_t ibuflen, obuflen = DEF_BUF_SIZE;
+    PyObject *RetVal;
     int err;
-
-    self->zst.next_in = data->buf;
-    ibuflen = data->len;
+    _BlocksOutputBuffer buffer = {.list = NULL};
+    zlibstate *state = PyType_GetModuleState(cls);
 
     ENTER_ZLIB(self);
 
+    self->zst.next_in = data->buf;
+    Py_ssize_t ibuflen = data->len;
+
+    if (OutputBuffer_InitAndGrow(&buffer, -1, &self->zst.next_out, &self->zst.avail_out) < 0) {
+        goto error;
+    }
+
     do {
         arrange_input_buffer(&self->zst, &ibuflen);
 
         do {
-            obuflen = arrange_output_buffer(&self->zst, &RetVal, obuflen);
-            if (obuflen < 0)
-                goto error;
+            if (self->zst.avail_out == 0) {
+                if (OutputBuffer_Grow(&buffer, &self->zst.next_out, &self->zst.avail_out) < 0) {
+                    goto error;
+                }
+            }
 
             Py_BEGIN_ALLOW_THREADS
             err = deflate(&self->zst, Z_NO_FLUSH);
             Py_END_ALLOW_THREADS
 
             if (err == Z_STREAM_ERROR) {
-                zlib_error(self->zst, err, "while compressing data");
+                zlib_error(state, self->zst, err, "while compressing data");
                 goto error;
             }
 
@@ -694,12 +788,14 @@
 
     } while (ibuflen != 0);
 
-    if (_PyBytes_Resize(&RetVal, self->zst.next_out -
-                        (Byte *)PyBytes_AS_STRING(RetVal)) == 0)
+    RetVal = OutputBuffer_Finish(&buffer, self->zst.avail_out);
+    if (RetVal != NULL) {
         goto success;
+    }
 
  error:
-    Py_CLEAR(RetVal);
+    OutputBuffer_OnError(&buffer);
+    RetVal = NULL;
  success:
     LEAVE_ZLIB(self);
     return RetVal;
@@ -753,10 +849,11 @@
 /*[clinic input]
 zlib.Decompress.decompress
 
+    cls: defining_class
     data: Py_buffer
         The binary data to decompress.
     /
-    max_length: ssize_t = 0
+    max_length: Py_ssize_t = 0
         The maximum allowable length of the decompressed data.
         Unconsumed input data will be stored in
         the unconsumed_tail attribute.
@@ -769,45 +866,47 @@
 [clinic start generated code]*/
 
 static PyObject *
-zlib_Decompress_decompress_impl(compobject *self, Py_buffer *data,
-                                Py_ssize_t max_length)
-/*[clinic end generated code: output=6e5173c74e710352 input=b85a212a012b770a]*/
+zlib_Decompress_decompress_impl(compobject *self, PyTypeObject *cls,
+                                Py_buffer *data, Py_ssize_t max_length)
+/*[clinic end generated code: output=b024a93c2c922d57 input=bfb37b3864cfb606]*/
 {
     int err = Z_OK;
-    Py_ssize_t ibuflen, obuflen = DEF_BUF_SIZE, hard_limit;
-    PyObject *RetVal = NULL;
+    Py_ssize_t ibuflen;
+    PyObject *RetVal;
+    _BlocksOutputBuffer buffer = {.list = NULL};
 
+    PyObject *module = PyType_GetModule(cls);
+    if (module == NULL)
+        return NULL;
+
+    zlibstate *state = get_zlib_state(module);
     if (max_length < 0) {
         PyErr_SetString(PyExc_ValueError, "max_length must be non-negative");
         return NULL;
-    } else if (max_length == 0)
-        hard_limit = PY_SSIZE_T_MAX;
-    else
-        hard_limit = max_length;
+    } else if (max_length == 0) {
+        max_length = -1;
+    }
+
+    ENTER_ZLIB(self);
 
     self->zst.next_in = data->buf;
     ibuflen = data->len;
 
-    /* limit amount of data allocated to max_length */
-    if (max_length && obuflen > max_length)
-        obuflen = max_length;
-
-    ENTER_ZLIB(self);
+    if (OutputBuffer_InitAndGrow(&buffer, max_length, &self->zst.next_out, &self->zst.avail_out) < 0) {
+        goto abort;
+    }
 
     do {
         arrange_input_buffer(&self->zst, &ibuflen);
 
         do {
-            obuflen = arrange_output_buffer_with_maximum(&self->zst, &RetVal,
-                                                         obuflen, hard_limit);
-            if (obuflen == -2) {
-                if (max_length > 0) {
+            if (self->zst.avail_out == 0) {
+                if (OutputBuffer_GetDataSize(&buffer, self->zst.avail_out) == max_length) {
                     goto save;
                 }
-                PyErr_NoMemory();
-            }
-            if (obuflen < 0) {
-                goto abort;
+                if (OutputBuffer_Grow(&buffer, &self->zst.next_out, &self->zst.avail_out) < 0) {
+                    goto abort;
+                }
             }
 
             Py_BEGIN_ALLOW_THREADS
@@ -821,8 +920,9 @@
                 break;
             default:
                 if (err == Z_NEED_DICT && self->zdict != NULL) {
-                    if (set_inflate_zdict(self) < 0)
+                    if (set_inflate_zdict(state, self) < 0) {
                         goto abort;
+                    }
                     else
                         break;
                 }
@@ -846,16 +946,18 @@
            but there wasn't more output when we tried again, so it is
            not an error condition.
         */
-        zlib_error(self->zst, err, "while decompressing data");
+        zlib_error(state, self->zst, err, "while decompressing data");
         goto abort;
     }
 
-    if (_PyBytes_Resize(&RetVal, self->zst.next_out -
-                        (Byte *)PyBytes_AS_STRING(RetVal)) == 0)
+    RetVal = OutputBuffer_Finish(&buffer, self->zst.avail_out);
+    if (RetVal != NULL) {
         goto success;
+    }
 
  abort:
-    Py_CLEAR(RetVal);
+    OutputBuffer_OnError(&buffer);
+    RetVal = NULL;
  success:
     LEAVE_ZLIB(self);
     return RetVal;
@@ -864,6 +966,7 @@
 /*[clinic input]
 zlib.Compress.flush
 
+    cls: defining_class
     mode: int(c_default="Z_FINISH") = zlib.Z_FINISH
         One of the constants Z_SYNC_FLUSH, Z_FULL_FLUSH, Z_FINISH.
         If mode == Z_FINISH, the compressor object can no longer be
@@ -875,13 +978,14 @@
 [clinic start generated code]*/
 
 static PyObject *
-zlib_Compress_flush_impl(compobject *self, int mode)
-/*[clinic end generated code: output=a203f4cefc9de727 input=73ed066794bd15bc]*/
+zlib_Compress_flush_impl(compobject *self, PyTypeObject *cls, int mode)
+/*[clinic end generated code: output=c7efd13efd62add2 input=286146e29442eb6c]*/
 {
     int err;
-    Py_ssize_t length = DEF_BUF_SIZE;
-    PyObject *RetVal = NULL;
+    PyObject *RetVal;
+    _BlocksOutputBuffer buffer = {.list = NULL};
 
+    zlibstate *state = PyType_GetModuleState(cls);
     /* Flushing with Z_NO_FLUSH is a no-op, so there's no point in
        doing any work at all; just return an empty string. */
     if (mode == Z_NO_FLUSH) {
@@ -892,11 +996,15 @@
 
     self->zst.avail_in = 0;
 
+    if (OutputBuffer_InitAndGrow(&buffer, -1, &self->zst.next_out, &self->zst.avail_out) < 0) {
+        goto error;
+    }
+
     do {
-        length = arrange_output_buffer(&self->zst, &RetVal, length);
-        if (length < 0) {
-            Py_CLEAR(RetVal);
-            goto error;
+        if (self->zst.avail_out == 0) {
+            if (OutputBuffer_Grow(&buffer, &self->zst.next_out, &self->zst.avail_out) < 0) {
+                goto error;
+            }
         }
 
         Py_BEGIN_ALLOW_THREADS
@@ -904,8 +1012,7 @@
         Py_END_ALLOW_THREADS
 
         if (err == Z_STREAM_ERROR) {
-            zlib_error(self->zst, err, "while flushing");
-            Py_CLEAR(RetVal);
+            zlib_error(state, self->zst, err, "while flushing");
             goto error;
         }
     } while (self->zst.avail_out == 0);
@@ -917,8 +1024,7 @@
     if (err == Z_STREAM_END && mode == Z_FINISH) {
         err = deflateEnd(&self->zst);
         if (err != Z_OK) {
-            zlib_error(self->zst, err, "while finishing compression");
-            Py_CLEAR(RetVal);
+            zlib_error(state, self->zst, err, "while finishing compression");
             goto error;
         }
         else
@@ -929,16 +1035,19 @@
            not an error condition.
         */
     } else if (err != Z_OK && err != Z_BUF_ERROR) {
-        zlib_error(self->zst, err, "while flushing");
-        Py_CLEAR(RetVal);
+        zlib_error(state, self->zst, err, "while flushing");
         goto error;
     }
 
-    if (_PyBytes_Resize(&RetVal, self->zst.next_out -
-                        (Byte *)PyBytes_AS_STRING(RetVal)) < 0)
-        Py_CLEAR(RetVal);
+    RetVal = OutputBuffer_Finish(&buffer, self->zst.avail_out);
+    if (RetVal != NULL) {
+        goto success;
+    }
 
- error:
+error:
+    OutputBuffer_OnError(&buffer);
+    RetVal = NULL;
+success:
     LEAVE_ZLIB(self);
     return RetVal;
 }
@@ -948,24 +1057,25 @@
 /*[clinic input]
 zlib.Compress.copy
 
+    cls: defining_class
+
 Return a copy of the compression object.
 [clinic start generated code]*/
 
 static PyObject *
-zlib_Compress_copy_impl(compobject *self)
-/*[clinic end generated code: output=5144aa153c21e805 input=c656351f94b82718]*/
+zlib_Compress_copy_impl(compobject *self, PyTypeObject *cls)
+/*[clinic end generated code: output=c4d2cfb4b0d7350b input=235497e482d40986]*/
 {
-    compobject *retval = NULL;
-    int err;
+    zlibstate *state = PyType_GetModuleState(cls);
 
-    retval = newcompobject(_zlibstate_global->Comptype);
+    compobject *retval = newcompobject(state->Comptype);
     if (!retval) return NULL;
 
     /* Copy the zstream state
      * We use ENTER_ZLIB / LEAVE_ZLIB to make this thread-safe
      */
     ENTER_ZLIB(self);
-    err = deflateCopy(&retval->zst, &self->zst);
+    int err = deflateCopy(&retval->zst, &self->zst);
     switch (err) {
     case Z_OK:
         break;
@@ -977,7 +1087,7 @@
                         "Can't allocate memory for compression object");
         goto error;
     default:
-        zlib_error(self->zst, err, "while copying compression object");
+        zlib_error(state, self->zst, err, "while copying compression object");
         goto error;
     }
     Py_INCREF(self->unused_data);
@@ -1002,51 +1112,57 @@
 
 /*[clinic input]
 zlib.Compress.__copy__
+
+    cls: defining_class
+
 [clinic start generated code]*/
 
 static PyObject *
-zlib_Compress___copy___impl(compobject *self)
-/*[clinic end generated code: output=1875e6791975442e input=be97a05a788dfd83]*/
+zlib_Compress___copy___impl(compobject *self, PyTypeObject *cls)
+/*[clinic end generated code: output=074613db332cb668 input=5c0188367ab0fe64]*/
 {
-    return zlib_Compress_copy_impl(self);
+    return zlib_Compress_copy_impl(self, cls);
 }
 
 /*[clinic input]
 zlib.Compress.__deepcopy__
 
+    cls: defining_class
     memo: object
     /
 
 [clinic start generated code]*/
 
 static PyObject *
-zlib_Compress___deepcopy__(compobject *self, PyObject *memo)
-/*[clinic end generated code: output=f47a2213282c9eb0 input=a9a8b0b40d83388e]*/
+zlib_Compress___deepcopy___impl(compobject *self, PyTypeObject *cls,
+                                PyObject *memo)
+/*[clinic end generated code: output=24b3aed785f54033 input=c90347319a514430]*/
 {
-    return zlib_Compress_copy_impl(self);
+    return zlib_Compress_copy_impl(self, cls);
 }
 
 /*[clinic input]
 zlib.Decompress.copy
 
+    cls: defining_class
+
 Return a copy of the decompression object.
 [clinic start generated code]*/
 
 static PyObject *
-zlib_Decompress_copy_impl(compobject *self)
-/*[clinic end generated code: output=02a883a2a510c8cc input=ba6c3e96712a596b]*/
+zlib_Decompress_copy_impl(compobject *self, PyTypeObject *cls)
+/*[clinic end generated code: output=a7ddc016e1d0a781 input=20ef3aa208282ff2]*/
 {
-    compobject *retval = NULL;
-    int err;
+    zlibstate *state = PyType_GetModuleState(cls);
 
-    retval = newcompobject(_zlibstate_global->Decomptype);
+    compobject *retval = newcompobject(state->Decomptype);
     if (!retval) return NULL;
 
     /* Copy the zstream state
      * We use ENTER_ZLIB / LEAVE_ZLIB to make this thread-safe
      */
     ENTER_ZLIB(self);
-    err = inflateCopy(&retval->zst, &self->zst);
+    int err = inflateCopy(&retval->zst, &self->zst);
     switch (err) {
     case Z_OK:
         break;
@@ -1058,7 +1174,7 @@
                         "Can't allocate memory for decompression object");
         goto error;
     default:
-        zlib_error(self->zst, err, "while copying decompression object");
+        zlib_error(state, self->zst, err, "while copying decompression object");
         goto error;
     }
 
@@ -1084,28 +1200,33 @@
 
 /*[clinic input]
 zlib.Decompress.__copy__
+
+    cls: defining_class
+
 [clinic start generated code]*/
 
 static PyObject *
-zlib_Decompress___copy___impl(compobject *self)
-/*[clinic end generated code: output=80bae8bc43498ad4 input=efcb98b5472c13d2]*/
+zlib_Decompress___copy___impl(compobject *self, PyTypeObject *cls)
+/*[clinic end generated code: output=cf1e6473744f53fa input=cc3143067b622bdf]*/
 {
-    return zlib_Decompress_copy_impl(self);
+    return zlib_Decompress_copy_impl(self, cls);
 }
 
 /*[clinic input]
 zlib.Decompress.__deepcopy__
 
+    cls: defining_class
     memo: object
     /
 
 [clinic start generated code]*/
 
 static PyObject *
-zlib_Decompress___deepcopy__(compobject *self, PyObject *memo)
-/*[clinic end generated code: output=1f77286ab490124b input=6e99bd0ac4b9cd8b]*/
+zlib_Decompress___deepcopy___impl(compobject *self, PyTypeObject *cls,
+                                  PyObject *memo)
+/*[clinic end generated code: output=34f7b719a0c0d51b input=fc13b9c58622544e]*/
 {
-    return zlib_Decompress_copy_impl(self);
+    return zlib_Decompress_copy_impl(self, cls);
 }
 
 #endif
@@ -1113,7 +1234,8 @@
 /*[clinic input]
 zlib.Decompress.flush
 
-    length: ssize_t(c_default="DEF_BUF_SIZE") = zlib.DEF_BUF_SIZE
+    cls: defining_class
+    length: Py_ssize_t(c_default="DEF_BUF_SIZE") = zlib.DEF_BUF_SIZE
         the initial size of the output buffer.
     /
 
@@ -1121,35 +1243,55 @@
 [clinic start generated code]*/
 
 static PyObject *
-zlib_Decompress_flush_impl(compobject *self, Py_ssize_t length)
-/*[clinic end generated code: output=68c75ea127cbe654 input=aa4ec37f3aef4da0]*/
+zlib_Decompress_flush_impl(compobject *self, PyTypeObject *cls,
+                           Py_ssize_t length)
+/*[clinic end generated code: output=4532fc280bd0f8f2 input=42f1f4b75230e2cd]*/
 {
     int err, flush;
     Py_buffer data;
-    PyObject *RetVal = NULL;
+    PyObject *RetVal;
     Py_ssize_t ibuflen;
+    _BlocksOutputBuffer buffer = {.list = NULL};
+    _Uint32Window window;  // output buffer's UINT32_MAX sliding window
+
+    PyObject *module = PyType_GetModule(cls);
+    if (module == NULL) {
+        return NULL;
+    }
+
+    zlibstate *state = get_zlib_state(module);
 
     if (length <= 0) {
         PyErr_SetString(PyExc_ValueError, "length must be greater than zero");
         return NULL;
     }
 
-    if (PyObject_GetBuffer(self->unconsumed_tail, &data, PyBUF_SIMPLE) == -1)
-        return NULL;
-
     ENTER_ZLIB(self);
 
+    if (PyObject_GetBuffer(self->unconsumed_tail, &data, PyBUF_SIMPLE) == -1) {
+        LEAVE_ZLIB(self);
+        return NULL;
+    }
+
     self->zst.next_in = data.buf;
     ibuflen = data.len;
 
+    if (OutputBuffer_WindowInitWithSize(&buffer, &window, length,
+                                        &self->zst.next_out, &self->zst.avail_out) < 0) {
+        goto abort;
+    }
+
     do {
         arrange_input_buffer(&self->zst, &ibuflen);
         flush = ibuflen == 0 ? Z_FINISH : Z_NO_FLUSH;
 
         do {
-            length = arrange_output_buffer(&self->zst, &RetVal, length);
-            if (length < 0)
-                goto abort;
+            if (self->zst.avail_out == 0) {
+                if (OutputBuffer_WindowGrow(&buffer, &window,
+                                            &self->zst.next_out, &self->zst.avail_out) < 0) {
+                    goto abort;
+                }
+            }
 
             Py_BEGIN_ALLOW_THREADS
             err = inflate(&self->zst, flush);
@@ -1162,8 +1304,9 @@
                 break;
             default:
                 if (err == Z_NEED_DICT && self->zdict != NULL) {
-                    if (set_inflate_zdict(self) < 0)
+                    if (set_inflate_zdict(state, self) < 0) {
                         goto abort;
+                    }
                     else
                         break;
                 }
@@ -1175,8 +1318,9 @@
     } while (err != Z_STREAM_END && ibuflen != 0);
 
  save:
-    if (save_unconsumed_input(self, &data, err) < 0)
+    if (save_unconsumed_input(self, &data, err) < 0) {
         goto abort;
+    }
 
     /* If at end of stream, clean up any memory allocated by zlib. */
     if (err == Z_STREAM_END) {
@@ -1184,17 +1328,19 @@
         self->is_initialised = 0;
         err = inflateEnd(&self->zst);
         if (err != Z_OK) {
-            zlib_error(self->zst, err, "while finishing decompression");
+            zlib_error(state, self->zst, err, "while finishing decompression");
             goto abort;
         }
     }
 
-    if (_PyBytes_Resize(&RetVal, self->zst.next_out -
-                        (Byte *)PyBytes_AS_STRING(RetVal)) == 0)
+    RetVal = OutputBuffer_WindowFinish(&buffer, &window, self->zst.avail_out);
+    if (RetVal != NULL) {
         goto success;
+    }
 
  abort:
-    Py_CLEAR(RetVal);
+    OutputBuffer_WindowOnError(&buffer, &window);
+    RetVal = NULL;
  success:
     PyBuffer_Release(&data);
     LEAVE_ZLIB(self);
@@ -1330,11 +1476,10 @@
 };
 
 static PyType_Spec Comptype_spec = {
-    "zlib.Compress",
-    sizeof(compobject),
-    0,
-    Py_TPFLAGS_DEFAULT,
-    Comptype_slots
+    .name = "zlib.Compress",
+    .basicsize = sizeof(compobject),
+    .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION,
+    .slots= Comptype_slots,
 };
 
 static PyType_Slot Decomptype_slots[] = {
@@ -1345,11 +1490,10 @@
 };
 
 static PyType_Spec Decomptype_spec = {
-    "zlib.Decompress",
-    sizeof(compobject),
-    0,
-    Py_TPFLAGS_DEFAULT,
-    Decomptype_slots
+    .name = "zlib.Decompress",
+    .basicsize = sizeof(compobject),
+    .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION,
+    .slots = Decomptype_slots,
 };
 
 PyDoc_STRVAR(zlib_module_documentation,
@@ -1361,16 +1505,16 @@
 "compressobj([level[, ...]]) -- Return a compressor object.\n"
 "crc32(string[, start]) -- Compute a CRC-32 checksum.\n"
 "decompress(string,[wbits],[bufsize]) -- Decompresses a compressed string.\n"
-"decompressobj([wbits[, zdict]]]) -- Return a decompressor object.\n"
+"decompressobj([wbits[, zdict]]) -- Return a decompressor object.\n"
 "\n"
 "'wbits' is window buffer size and container format.\n"
 "Compressor objects support compress() and flush() methods; decompressor\n"
 "objects support decompress() and flush().");
 
 static int
-zlib_clear(PyObject *m)
+zlib_clear(PyObject *mod)
 {
-    _zlibstate *state = get_zlib_state(m);
+    zlibstate *state = get_zlib_state(mod);
     Py_CLEAR(state->Comptype);
     Py_CLEAR(state->Decomptype);
     Py_CLEAR(state->ZlibError);
@@ -1378,9 +1522,9 @@
 }
 
 static int
-zlib_traverse(PyObject *m, visitproc visit, void *arg)
+zlib_traverse(PyObject *mod, visitproc visit, void *arg)
 {
-    _zlibstate *state = get_zlib_state(m);
+    zlibstate *state = get_zlib_state(mod);
     Py_VISIT(state->Comptype);
     Py_VISIT(state->Decomptype);
     Py_VISIT(state->ZlibError);
@@ -1388,93 +1532,122 @@
 }
 
 static void
-zlib_free(void *m)
+zlib_free(void *mod)
 {
-    zlib_clear((PyObject *)m);
+    zlib_clear((PyObject *)mod);
 }
 
+static int
+zlib_exec(PyObject *mod)
+{
+    zlibstate *state = get_zlib_state(mod);
+
+    state->Comptype = (PyTypeObject *)PyType_FromModuleAndSpec(
+        mod, &Comptype_spec, NULL);
+    if (state->Comptype == NULL) {
+        return -1;
+    }
+
+    state->Decomptype = (PyTypeObject *)PyType_FromModuleAndSpec(
+        mod, &Decomptype_spec, NULL);
+    if (state->Decomptype == NULL) {
+        return -1;
+    }
+
+    state->ZlibError = PyErr_NewException("zlib.error", NULL, NULL);
+    if (state->ZlibError == NULL) {
+        return -1;
+    }
+
+    Py_INCREF(state->ZlibError);
+    if (PyModule_AddObject(mod, "error", state->ZlibError) < 0) {
+        Py_DECREF(state->ZlibError);
+        return -1;
+    }
+
+#define ZLIB_ADD_INT_MACRO(c)                           \
+    do {                                                \
+        if ((PyModule_AddIntConstant(mod, #c, c)) < 0) {  \
+            return -1;                                  \
+        }                                               \
+    } while(0)
+
+    ZLIB_ADD_INT_MACRO(MAX_WBITS);
+    ZLIB_ADD_INT_MACRO(DEFLATED);
+    ZLIB_ADD_INT_MACRO(DEF_MEM_LEVEL);
+    ZLIB_ADD_INT_MACRO(DEF_BUF_SIZE);
+    // compression levels
+    ZLIB_ADD_INT_MACRO(Z_NO_COMPRESSION);
+    ZLIB_ADD_INT_MACRO(Z_BEST_SPEED);
+    ZLIB_ADD_INT_MACRO(Z_BEST_COMPRESSION);
+    ZLIB_ADD_INT_MACRO(Z_DEFAULT_COMPRESSION);
+    // compression strategies
+    ZLIB_ADD_INT_MACRO(Z_FILTERED);
+    ZLIB_ADD_INT_MACRO(Z_HUFFMAN_ONLY);
+#ifdef Z_RLE // 1.2.0.1
+    ZLIB_ADD_INT_MACRO(Z_RLE);
+#endif
+#ifdef Z_FIXED // 1.2.2.2
+    ZLIB_ADD_INT_MACRO(Z_FIXED);
+#endif
+    ZLIB_ADD_INT_MACRO(Z_DEFAULT_STRATEGY);
+    // allowed flush values
+    ZLIB_ADD_INT_MACRO(Z_NO_FLUSH);
+    ZLIB_ADD_INT_MACRO(Z_PARTIAL_FLUSH);
+    ZLIB_ADD_INT_MACRO(Z_SYNC_FLUSH);
+    ZLIB_ADD_INT_MACRO(Z_FULL_FLUSH);
+    ZLIB_ADD_INT_MACRO(Z_FINISH);
+#ifdef Z_BLOCK // 1.2.0.5 for inflate, 1.2.3.4 for deflate
+    ZLIB_ADD_INT_MACRO(Z_BLOCK);
+#endif
+#ifdef Z_TREES // 1.2.3.4, only for inflate
+    ZLIB_ADD_INT_MACRO(Z_TREES);
+#endif
+    PyObject *ver = PyUnicode_FromString(ZLIB_VERSION);
+    if (ver == NULL) {
+        return -1;
+    }
+
+    if (PyModule_AddObject(mod, "ZLIB_VERSION", ver) < 0) {
+        Py_DECREF(ver);
+        return -1;
+    }
+
+    ver = PyUnicode_FromString(zlibVersion());
+    if (ver == NULL) {
+        return -1;
+    }
+
+    if (PyModule_AddObject(mod, "ZLIB_RUNTIME_VERSION", ver) < 0) {
+        Py_DECREF(ver);
+        return -1;
+    }
+
+    if (PyModule_AddStringConstant(mod, "__version__", "1.0") < 0) {
+        return -1;
+    }
+    return 0;
+}
+
+static PyModuleDef_Slot zlib_slots[] = {
+    {Py_mod_exec, zlib_exec},
+    {0, NULL}
+};
+
 static struct PyModuleDef zlibmodule = {
-        PyModuleDef_HEAD_INIT,
-        "zlib",
-        zlib_module_documentation,
-        sizeof(_zlibstate),
-        zlib_methods,
-        NULL,
-        zlib_traverse,
-        zlib_clear,
-        zlib_free,
+    PyModuleDef_HEAD_INIT,
+    .m_name = "zlib",
+    .m_doc = zlib_module_documentation,
+    .m_size = sizeof(zlibstate),
+    .m_methods = zlib_methods,
+    .m_slots = zlib_slots,
+    .m_traverse = zlib_traverse,
+    .m_clear = zlib_clear,
+    .m_free = zlib_free,
 };
 
 PyMODINIT_FUNC
 PyInit_zlib(void)
 {
-    PyObject *m, *ver;
-    m = PyState_FindModule(&zlibmodule);
-    if (m != NULL) {
-        Py_INCREF(m);
-        return m;
-    }
-    m = PyModule_Create(&zlibmodule);
-    if (m == NULL)
-        return NULL;
-
-    PyTypeObject *Comptype = (PyTypeObject *)PyType_FromSpec(&Comptype_spec);
-    if (Comptype == NULL)
-        return NULL;
-    get_zlib_state(m)->Comptype = Comptype;
-
-    PyTypeObject *Decomptype = (PyTypeObject *)PyType_FromSpec(&Decomptype_spec);
-    if (Decomptype == NULL)
-        return NULL;
-    get_zlib_state(m)->Decomptype = Decomptype;
-
-    PyObject *ZlibError = PyErr_NewException("zlib.error", NULL, NULL);
-    if (ZlibError != NULL) {
-        Py_INCREF(ZlibError);
-        PyModule_AddObject(m, "error", ZlibError);
-        get_zlib_state(m)->ZlibError = ZlibError;
-    }
-    PyModule_AddIntMacro(m, MAX_WBITS);
-    PyModule_AddIntMacro(m, DEFLATED);
-    PyModule_AddIntMacro(m, DEF_MEM_LEVEL);
-    PyModule_AddIntMacro(m, DEF_BUF_SIZE);
-    // compression levels
-    PyModule_AddIntMacro(m, Z_NO_COMPRESSION);
-    PyModule_AddIntMacro(m, Z_BEST_SPEED);
-    PyModule_AddIntMacro(m, Z_BEST_COMPRESSION);
-    PyModule_AddIntMacro(m, Z_DEFAULT_COMPRESSION);
-    // compression strategies
-    PyModule_AddIntMacro(m, Z_FILTERED);
-    PyModule_AddIntMacro(m, Z_HUFFMAN_ONLY);
-#ifdef Z_RLE // 1.2.0.1
-    PyModule_AddIntMacro(m, Z_RLE);
-#endif
-#ifdef Z_FIXED // 1.2.2.2
-    PyModule_AddIntMacro(m, Z_FIXED);
-#endif
-    PyModule_AddIntMacro(m, Z_DEFAULT_STRATEGY);
-    // allowed flush values
-    PyModule_AddIntMacro(m, Z_NO_FLUSH);
-    PyModule_AddIntMacro(m, Z_PARTIAL_FLUSH);
-    PyModule_AddIntMacro(m, Z_SYNC_FLUSH);
-    PyModule_AddIntMacro(m, Z_FULL_FLUSH);
-    PyModule_AddIntMacro(m, Z_FINISH);
-#ifdef Z_BLOCK // 1.2.0.5 for inflate, 1.2.3.4 for deflate
-    PyModule_AddIntMacro(m, Z_BLOCK);
-#endif
-#ifdef Z_TREES // 1.2.3.4, only for inflate
-    PyModule_AddIntMacro(m, Z_TREES);
-#endif
-    ver = PyUnicode_FromString(ZLIB_VERSION);
-    if (ver != NULL)
-        PyModule_AddObject(m, "ZLIB_VERSION", ver);
-
-    ver = PyUnicode_FromString(zlibVersion());
-    if (ver != NULL)
-        PyModule_AddObject(m, "ZLIB_RUNTIME_VERSION", ver);
-
-    PyModule_AddStringConstant(m, "__version__", "1.0");
-
-    PyState_AddModule(m, &zlibmodule);
-    return m;
+    return PyModuleDef_Init(&zlibmodule);
 }
diff --git a/Objects/abstract.c b/Objects/abstract.c
index 1922619..3ac8554 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -3,8 +3,10 @@
 #include "Python.h"
 #include "pycore_abstract.h"      // _PyIndex_Check()
 #include "pycore_ceval.h"         // _Py_EnterRecursiveCall()
-#include "pycore_pyerrors.h"
+#include "pycore_object.h"        // _Py_CheckSlotResult()
+#include "pycore_pyerrors.h"      // _PyErr_Occurred()
 #include "pycore_pystate.h"       // _PyThreadState_GET()
+#include "pycore_unionobject.h"   // _PyUnion_Check()
 #include <ctype.h>
 #include <stddef.h>               // offsetof()
 #include "longintrepr.h"
@@ -23,9 +25,11 @@
 static PyObject *
 null_error(void)
 {
-    if (!PyErr_Occurred())
-        PyErr_SetString(PyExc_SystemError,
-                        "null argument to internal routine");
+    PyThreadState *tstate = _PyThreadState_GET();
+    if (!_PyErr_Occurred(tstate)) {
+        _PyErr_SetString(tstate, PyExc_SystemError,
+                         "null argument to internal routine");
+    }
     return NULL;
 }
 
@@ -48,17 +52,15 @@
 Py_ssize_t
 PyObject_Size(PyObject *o)
 {
-    PySequenceMethods *m;
-
     if (o == NULL) {
         null_error();
         return -1;
     }
 
-    m = Py_TYPE(o)->tp_as_sequence;
+    PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
     if (m && m->sq_length) {
         Py_ssize_t len = m->sq_length(o);
-        assert(len >= 0 || PyErr_Occurred());
+        assert(_Py_CheckSlotResult(o, "__len__", len >= 0));
         return len;
     }
 
@@ -94,11 +96,12 @@
     if (_PyObject_HasLen(o)) {
         res = PyObject_Length(o);
         if (res < 0) {
-            assert(PyErr_Occurred());
-            if (!PyErr_ExceptionMatches(PyExc_TypeError)) {
+            PyThreadState *tstate = _PyThreadState_GET();
+            assert(_PyErr_Occurred(tstate));
+            if (!_PyErr_ExceptionMatches(tstate, PyExc_TypeError)) {
                 return -1;
             }
-            PyErr_Clear();
+            _PyErr_Clear(tstate);
         }
         else {
             return res;
@@ -114,8 +117,9 @@
     result = _PyObject_CallNoArg(hint);
     Py_DECREF(hint);
     if (result == NULL) {
-        if (PyErr_ExceptionMatches(PyExc_TypeError)) {
-            PyErr_Clear();
+        PyThreadState *tstate = _PyThreadState_GET();
+        if (_PyErr_ExceptionMatches(tstate, PyExc_TypeError)) {
+            _PyErr_Clear(tstate);
             return defaultvalue;
         }
         return -1;
@@ -145,21 +149,18 @@
 PyObject *
 PyObject_GetItem(PyObject *o, PyObject *key)
 {
-    PyMappingMethods *m;
-    PySequenceMethods *ms;
-
     if (o == NULL || key == NULL) {
         return null_error();
     }
 
-    m = Py_TYPE(o)->tp_as_mapping;
+    PyMappingMethods *m = Py_TYPE(o)->tp_as_mapping;
     if (m && m->mp_subscript) {
         PyObject *item = m->mp_subscript(o, key);
-        assert((item != NULL) ^ (PyErr_Occurred() != NULL));
+        assert(_Py_CheckSlotResult(o, "__getitem__", item != NULL));
         return item;
     }
 
-    ms = Py_TYPE(o)->tp_as_sequence;
+    PySequenceMethods *ms = Py_TYPE(o)->tp_as_sequence;
     if (ms && ms->sq_item) {
         if (_PyIndex_Check(key)) {
             Py_ssize_t key_value;
@@ -199,15 +200,17 @@
 int
 PyObject_SetItem(PyObject *o, PyObject *key, PyObject *value)
 {
-    PyMappingMethods *m;
-
     if (o == NULL || key == NULL || value == NULL) {
         null_error();
         return -1;
     }
-    m = Py_TYPE(o)->tp_as_mapping;
-    if (m && m->mp_ass_subscript)
-        return m->mp_ass_subscript(o, key, value);
+
+    PyMappingMethods *m = Py_TYPE(o)->tp_as_mapping;
+    if (m && m->mp_ass_subscript) {
+        int res = m->mp_ass_subscript(o, key, value);
+        assert(_Py_CheckSlotResult(o, "__setitem__", res >= 0));
+        return res;
+    }
 
     if (Py_TYPE(o)->tp_as_sequence) {
         if (_PyIndex_Check(key)) {
@@ -231,15 +234,17 @@
 int
 PyObject_DelItem(PyObject *o, PyObject *key)
 {
-    PyMappingMethods *m;
-
     if (o == NULL || key == NULL) {
         null_error();
         return -1;
     }
-    m = Py_TYPE(o)->tp_as_mapping;
-    if (m && m->mp_ass_subscript)
-        return m->mp_ass_subscript(o, key, (PyObject*)NULL);
+
+    PyMappingMethods *m = Py_TYPE(o)->tp_as_mapping;
+    if (m && m->mp_ass_subscript) {
+        int res = m->mp_ass_subscript(o, key, (PyObject*)NULL);
+        assert(_Py_CheckSlotResult(o, "__delitem__", res >= 0));
+        return res;
+    }
 
     if (Py_TYPE(o)->tp_as_sequence) {
         if (_PyIndex_Check(key)) {
@@ -380,7 +385,9 @@
                      Py_TYPE(obj)->tp_name);
         return -1;
     }
-    return (*pb->bf_getbuffer)(obj, view, flags);
+    int res = (*pb->bf_getbuffer)(obj, view, flags);
+    assert(_Py_CheckSlotResult(obj, "getbuffer", res >= 0));
+    return res;
 }
 
 static int
@@ -708,7 +715,7 @@
 {
     if (view == NULL) {
         PyErr_SetString(PyExc_BufferError,
-            "PyBuffer_FillInfo: view==NULL argument is obsolete");
+                        "PyBuffer_FillInfo: view==NULL argument is obsolete");
         return -1;
     }
 
@@ -749,8 +756,9 @@
     if (obj == NULL)
         return;
     pb = Py_TYPE(obj)->tp_as_buffer;
-    if (pb && pb->bf_releasebuffer)
+    if (pb && pb->bf_releasebuffer) {
         pb->bf_releasebuffer(obj, view);
+    }
     view->obj = NULL;
     Py_DECREF(obj);
 }
@@ -790,10 +798,12 @@
     /* Find the (unbound!) __format__ method */
     meth = _PyObject_LookupSpecial(obj, &PyId___format__);
     if (meth == NULL) {
-        if (!PyErr_Occurred())
-            PyErr_Format(PyExc_TypeError,
-                         "Type %.100s doesn't define __format__",
-                         Py_TYPE(obj)->tp_name);
+        PyThreadState *tstate = _PyThreadState_GET();
+        if (!_PyErr_Occurred(tstate)) {
+            _PyErr_Format(tstate, PyExc_TypeError,
+                          "Type %.100s doesn't define __format__",
+                          Py_TYPE(obj)->tp_name);
+        }
         goto done;
     }
 
@@ -803,8 +813,8 @@
 
     if (result && !PyUnicode_Check(result)) {
         PyErr_Format(PyExc_TypeError,
-             "__format__ must return a str, not %.200s",
-             Py_TYPE(result)->tp_name);
+                     "__format__ must return a str, not %.200s",
+                     Py_TYPE(result)->tp_name);
         Py_DECREF(result);
         result = NULL;
         goto done;
@@ -819,10 +829,10 @@
 int
 PyNumber_Check(PyObject *o)
 {
-    return o && Py_TYPE(o)->tp_as_number &&
-           (Py_TYPE(o)->tp_as_number->nb_index ||
-            Py_TYPE(o)->tp_as_number->nb_int ||
-            Py_TYPE(o)->tp_as_number->nb_float);
+    if (o == NULL)
+        return 0;
+    PyNumberMethods *nb = Py_TYPE(o)->tp_as_number;
+    return nb && (nb->nb_index || nb->nb_int || nb->nb_float || PyComplex_Check(o));
 }
 
 /* Binary operators */
@@ -844,21 +854,33 @@
  */
 
 static PyObject *
-binary_op1(PyObject *v, PyObject *w, const int op_slot)
+binary_op1(PyObject *v, PyObject *w, const int op_slot
+#ifndef NDEBUG
+           , const char *op_name
+#endif
+           )
 {
-    PyObject *x;
-    binaryfunc slotv = NULL;
-    binaryfunc slotw = NULL;
-
-    if (Py_TYPE(v)->tp_as_number != NULL)
+    binaryfunc slotv;
+    if (Py_TYPE(v)->tp_as_number != NULL) {
         slotv = NB_BINOP(Py_TYPE(v)->tp_as_number, op_slot);
-    if (!Py_IS_TYPE(w, Py_TYPE(v)) &&
-        Py_TYPE(w)->tp_as_number != NULL) {
-        slotw = NB_BINOP(Py_TYPE(w)->tp_as_number, op_slot);
-        if (slotw == slotv)
-            slotw = NULL;
     }
+    else {
+        slotv = NULL;
+    }
+
+    binaryfunc slotw;
+    if (!Py_IS_TYPE(w, Py_TYPE(v)) && Py_TYPE(w)->tp_as_number != NULL) {
+        slotw = NB_BINOP(Py_TYPE(w)->tp_as_number, op_slot);
+        if (slotw == slotv) {
+            slotw = NULL;
+        }
+    }
+    else {
+        slotw = NULL;
+    }
+
     if (slotv) {
+        PyObject *x;
         if (slotw && PyType_IsSubtype(Py_TYPE(w), Py_TYPE(v))) {
             x = slotw(v, w);
             if (x != Py_NotImplemented)
@@ -867,19 +889,29 @@
             slotw = NULL;
         }
         x = slotv(v, w);
-        if (x != Py_NotImplemented)
+        assert(_Py_CheckSlotResult(v, op_name, x != NULL));
+        if (x != Py_NotImplemented) {
             return x;
+        }
         Py_DECREF(x); /* can't do it */
     }
     if (slotw) {
-        x = slotw(v, w);
-        if (x != Py_NotImplemented)
+        PyObject *x = slotw(v, w);
+        assert(_Py_CheckSlotResult(w, op_name, x != NULL));
+        if (x != Py_NotImplemented) {
             return x;
+        }
         Py_DECREF(x); /* can't do it */
     }
     Py_RETURN_NOTIMPLEMENTED;
 }
 
+#ifdef NDEBUG
+#  define BINARY_OP1(v, w, op_slot, op_name) binary_op1(v, w, op_slot)
+#else
+#  define BINARY_OP1(v, w, op_slot, op_name) binary_op1(v, w, op_slot, op_name)
+#endif
+
 static PyObject *
 binop_type_error(PyObject *v, PyObject *w, const char *op_name)
 {
@@ -895,7 +927,7 @@
 static PyObject *
 binary_op(PyObject *v, PyObject *w, const int op_slot, const char *op_name)
 {
-    PyObject *result = binary_op1(v, w, op_slot);
+    PyObject *result = BINARY_OP1(v, w, op_slot, op_name);
     if (result == Py_NotImplemented) {
         Py_DECREF(result);
 
@@ -912,7 +944,6 @@
                 Py_TYPE(w)->tp_name);
             return NULL;
         }
-
         return binop_type_error(v, w, op_name);
     }
     return result;
@@ -931,70 +962,92 @@
            PyObject *w,
            PyObject *z,
            const int op_slot,
-           const char *op_name)
+           const char *op_name
+           )
 {
-    PyNumberMethods *mv, *mw, *mz;
-    PyObject *x = NULL;
-    ternaryfunc slotv = NULL;
-    ternaryfunc slotw = NULL;
-    ternaryfunc slotz = NULL;
+    PyNumberMethods *mv = Py_TYPE(v)->tp_as_number;
+    PyNumberMethods *mw = Py_TYPE(w)->tp_as_number;
 
-    mv = Py_TYPE(v)->tp_as_number;
-    mw = Py_TYPE(w)->tp_as_number;
-    if (mv != NULL)
+    ternaryfunc slotv;
+    if (mv != NULL) {
         slotv = NB_TERNOP(mv, op_slot);
+    }
+    else {
+        slotv = NULL;
+    }
+
+    ternaryfunc slotw;
     if (!Py_IS_TYPE(w, Py_TYPE(v)) && mw != NULL) {
         slotw = NB_TERNOP(mw, op_slot);
-        if (slotw == slotv)
+        if (slotw == slotv) {
             slotw = NULL;
+        }
     }
+    else {
+        slotw = NULL;
+    }
+
     if (slotv) {
+        PyObject *x;
         if (slotw && PyType_IsSubtype(Py_TYPE(w), Py_TYPE(v))) {
             x = slotw(v, w, z);
-            if (x != Py_NotImplemented)
+            if (x != Py_NotImplemented) {
                 return x;
+            }
             Py_DECREF(x); /* can't do it */
             slotw = NULL;
         }
         x = slotv(v, w, z);
-        if (x != Py_NotImplemented)
+        assert(_Py_CheckSlotResult(v, op_name, x != NULL));
+        if (x != Py_NotImplemented) {
             return x;
+        }
         Py_DECREF(x); /* can't do it */
     }
     if (slotw) {
-        x = slotw(v, w, z);
-        if (x != Py_NotImplemented)
+        PyObject *x = slotw(v, w, z);
+        assert(_Py_CheckSlotResult(w, op_name, x != NULL));
+        if (x != Py_NotImplemented) {
             return x;
+        }
         Py_DECREF(x); /* can't do it */
     }
-    mz = Py_TYPE(z)->tp_as_number;
+
+    PyNumberMethods *mz = Py_TYPE(z)->tp_as_number;
     if (mz != NULL) {
-        slotz = NB_TERNOP(mz, op_slot);
-        if (slotz == slotv || slotz == slotw)
+        ternaryfunc slotz = NB_TERNOP(mz, op_slot);
+        if (slotz == slotv || slotz == slotw) {
             slotz = NULL;
+        }
         if (slotz) {
-            x = slotz(v, w, z);
-            if (x != Py_NotImplemented)
+            PyObject *x = slotz(v, w, z);
+            assert(_Py_CheckSlotResult(z, op_name, x != NULL));
+            if (x != Py_NotImplemented) {
                 return x;
+            }
             Py_DECREF(x); /* can't do it */
         }
     }
 
-    if (z == Py_None)
+    if (z == Py_None) {
         PyErr_Format(
             PyExc_TypeError,
-            "unsupported operand type(s) for ** or pow(): "
+            "unsupported operand type(s) for %.100s: "
             "'%.100s' and '%.100s'",
+            op_name,
             Py_TYPE(v)->tp_name,
             Py_TYPE(w)->tp_name);
-    else
+    }
+    else {
         PyErr_Format(
             PyExc_TypeError,
-            "unsupported operand type(s) for pow(): "
+            "unsupported operand type(s) for %.100s: "
             "'%.100s', '%.100s', '%.100s'",
+            op_name,
             Py_TYPE(v)->tp_name,
             Py_TYPE(w)->tp_name,
             Py_TYPE(z)->tp_name);
+    }
     return NULL;
 }
 
@@ -1015,16 +1068,20 @@
 PyObject *
 PyNumber_Add(PyObject *v, PyObject *w)
 {
-    PyObject *result = binary_op1(v, w, NB_SLOT(nb_add));
-    if (result == Py_NotImplemented) {
-        PySequenceMethods *m = Py_TYPE(v)->tp_as_sequence;
-        Py_DECREF(result);
-        if (m && m->sq_concat) {
-            return (*m->sq_concat)(v, w);
-        }
-        result = binop_type_error(v, w, "+");
+    PyObject *result = BINARY_OP1(v, w, NB_SLOT(nb_add), "+");
+    if (result != Py_NotImplemented) {
+        return result;
     }
-    return result;
+    Py_DECREF(result);
+
+    PySequenceMethods *m = Py_TYPE(v)->tp_as_sequence;
+    if (m && m->sq_concat) {
+        result = (*m->sq_concat)(v, w);
+        assert(_Py_CheckSlotResult(v, "+", result != NULL));
+        return result;
+    }
+
+    return binop_type_error(v, w, "+");
 }
 
 static PyObject *
@@ -1033,20 +1090,23 @@
     Py_ssize_t count;
     if (_PyIndex_Check(n)) {
         count = PyNumber_AsSsize_t(n, PyExc_OverflowError);
-        if (count == -1 && PyErr_Occurred())
+        if (count == -1 && PyErr_Occurred()) {
             return NULL;
+        }
     }
     else {
         return type_error("can't multiply sequence by "
                           "non-int of type '%.200s'", n);
     }
-    return (*repeatfunc)(seq, count);
+    PyObject *res = (*repeatfunc)(seq, count);
+    assert(_Py_CheckSlotResult(seq, "*", res != NULL));
+    return res;
 }
 
 PyObject *
 PyNumber_Multiply(PyObject *v, PyObject *w)
 {
-    PyObject *result = binary_op1(v, w, NB_SLOT(nb_multiply));
+    PyObject *result = BINARY_OP1(v, w, NB_SLOT(nb_multiply), "*");
     if (result == Py_NotImplemented) {
         PySequenceMethods *mv = Py_TYPE(v)->tp_as_sequence;
         PySequenceMethods *mw = Py_TYPE(w)->tp_as_sequence;
@@ -1109,27 +1169,42 @@
    */
 
 static PyObject *
-binary_iop1(PyObject *v, PyObject *w, const int iop_slot, const int op_slot)
+binary_iop1(PyObject *v, PyObject *w, const int iop_slot, const int op_slot
+#ifndef NDEBUG
+            , const char *op_name
+#endif
+            )
 {
     PyNumberMethods *mv = Py_TYPE(v)->tp_as_number;
     if (mv != NULL) {
         binaryfunc slot = NB_BINOP(mv, iop_slot);
         if (slot) {
             PyObject *x = (slot)(v, w);
+            assert(_Py_CheckSlotResult(v, op_name, x != NULL));
             if (x != Py_NotImplemented) {
                 return x;
             }
             Py_DECREF(x);
         }
     }
+#ifdef NDEBUG
     return binary_op1(v, w, op_slot);
+#else
+    return binary_op1(v, w, op_slot, op_name);
+#endif
 }
 
+#ifdef NDEBUG
+#  define BINARY_IOP1(v, w, iop_slot, op_slot, op_name) binary_iop1(v, w, iop_slot, op_slot)
+#else
+#  define BINARY_IOP1(v, w, iop_slot, op_slot, op_name) binary_iop1(v, w, iop_slot, op_slot, op_name)
+#endif
+
 static PyObject *
 binary_iop(PyObject *v, PyObject *w, const int iop_slot, const int op_slot,
                 const char *op_name)
 {
-    PyObject *result = binary_iop1(v, w, iop_slot, op_slot);
+    PyObject *result = BINARY_IOP1(v, w, iop_slot, op_slot, op_name);
     if (result == Py_NotImplemented) {
         Py_DECREF(result);
         return binop_type_error(v, w, op_name);
@@ -1137,6 +1212,24 @@
     return result;
 }
 
+static PyObject *
+ternary_iop(PyObject *v, PyObject *w, PyObject *z, const int iop_slot, const int op_slot,
+                const char *op_name)
+{
+    PyNumberMethods *mv = Py_TYPE(v)->tp_as_number;
+    if (mv != NULL) {
+        ternaryfunc slot = NB_TERNOP(mv, iop_slot);
+        if (slot) {
+            PyObject *x = (slot)(v, w, z);
+            if (x != Py_NotImplemented) {
+                return x;
+            }
+            Py_DECREF(x);
+        }
+    }
+    return ternary_op(v, w, z, op_slot, op_name);
+}
+
 #define INPLACE_BINOP(func, iop, op, op_name) \
     PyObject * \
     func(PyObject *v, PyObject *w) { \
@@ -1168,18 +1261,20 @@
 PyObject *
 PyNumber_InPlaceAdd(PyObject *v, PyObject *w)
 {
-    PyObject *result = binary_iop1(v, w, NB_SLOT(nb_inplace_add),
-                                   NB_SLOT(nb_add));
+    PyObject *result = BINARY_IOP1(v, w, NB_SLOT(nb_inplace_add),
+                                   NB_SLOT(nb_add), "+=");
     if (result == Py_NotImplemented) {
         PySequenceMethods *m = Py_TYPE(v)->tp_as_sequence;
         Py_DECREF(result);
         if (m != NULL) {
-            binaryfunc f = NULL;
-            f = m->sq_inplace_concat;
-            if (f == NULL)
-                f = m->sq_concat;
-            if (f != NULL)
-                return (*f)(v, w);
+            binaryfunc func = m->sq_inplace_concat;
+            if (func == NULL)
+                func = m->sq_concat;
+            if (func != NULL) {
+                result = func(v, w);
+                assert(_Py_CheckSlotResult(v, "+=", result != NULL));
+                return result;
+            }
         }
         result = binop_type_error(v, w, "+=");
     }
@@ -1189,8 +1284,8 @@
 PyObject *
 PyNumber_InPlaceMultiply(PyObject *v, PyObject *w)
 {
-    PyObject *result = binary_iop1(v, w, NB_SLOT(nb_inplace_multiply),
-                                   NB_SLOT(nb_multiply));
+    PyObject *result = BINARY_IOP1(v, w, NB_SLOT(nb_inplace_multiply),
+                                   NB_SLOT(nb_multiply), "*=");
     if (result == Py_NotImplemented) {
         ssizeargfunc f = NULL;
         PySequenceMethods *mv = Py_TYPE(v)->tp_as_sequence;
@@ -1232,13 +1327,8 @@
 PyObject *
 PyNumber_InPlacePower(PyObject *v, PyObject *w, PyObject *z)
 {
-    if (Py_TYPE(v)->tp_as_number &&
-        Py_TYPE(v)->tp_as_number->nb_inplace_power != NULL) {
-        return ternary_op(v, w, z, NB_SLOT(nb_inplace_power), "**=");
-    }
-    else {
-        return ternary_op(v, w, z, NB_SLOT(nb_power), "**=");
-    }
+    return ternary_iop(v, w, z, NB_SLOT(nb_inplace_power),
+                                NB_SLOT(nb_power), "**=");
 }
 
 
@@ -1247,15 +1337,16 @@
 PyObject *
 PyNumber_Negative(PyObject *o)
 {
-    PyNumberMethods *m;
-
     if (o == NULL) {
         return null_error();
     }
 
-    m = Py_TYPE(o)->tp_as_number;
-    if (m && m->nb_negative)
-        return (*m->nb_negative)(o);
+    PyNumberMethods *m = Py_TYPE(o)->tp_as_number;
+    if (m && m->nb_negative) {
+        PyObject *res = (*m->nb_negative)(o);
+        assert(_Py_CheckSlotResult(o, "__neg__", res != NULL));
+        return res;
+    }
 
     return type_error("bad operand type for unary -: '%.200s'", o);
 }
@@ -1263,15 +1354,16 @@
 PyObject *
 PyNumber_Positive(PyObject *o)
 {
-    PyNumberMethods *m;
-
     if (o == NULL) {
         return null_error();
     }
 
-    m = Py_TYPE(o)->tp_as_number;
-    if (m && m->nb_positive)
-        return (*m->nb_positive)(o);
+    PyNumberMethods *m = Py_TYPE(o)->tp_as_number;
+    if (m && m->nb_positive) {
+        PyObject *res = (*m->nb_positive)(o);
+        assert(_Py_CheckSlotResult(o, "__pos__", res != NULL));
+        return res;
+    }
 
     return type_error("bad operand type for unary +: '%.200s'", o);
 }
@@ -1279,15 +1371,16 @@
 PyObject *
 PyNumber_Invert(PyObject *o)
 {
-    PyNumberMethods *m;
-
     if (o == NULL) {
         return null_error();
     }
 
-    m = Py_TYPE(o)->tp_as_number;
-    if (m && m->nb_invert)
-        return (*m->nb_invert)(o);
+    PyNumberMethods *m = Py_TYPE(o)->tp_as_number;
+    if (m && m->nb_invert) {
+        PyObject *res = (*m->nb_invert)(o);
+        assert(_Py_CheckSlotResult(o, "__invert__", res != NULL));
+        return res;
+    }
 
     return type_error("bad operand type for unary ~: '%.200s'", o);
 }
@@ -1295,15 +1388,16 @@
 PyObject *
 PyNumber_Absolute(PyObject *o)
 {
-    PyNumberMethods *m;
-
     if (o == NULL) {
         return null_error();
     }
 
-    m = Py_TYPE(o)->tp_as_number;
-    if (m && m->nb_absolute)
-        return m->nb_absolute(o);
+    PyNumberMethods *m = Py_TYPE(o)->tp_as_number;
+    if (m && m->nb_absolute) {
+        PyObject *res = m->nb_absolute(o);
+        assert(_Py_CheckSlotResult(o, "__abs__", res != NULL));
+        return res;
+    }
 
     return type_error("bad operand type for abs(): '%.200s'", o);
 }
@@ -1317,13 +1411,13 @@
 
 
 /* Return a Python int from the object item.
+   Can return an instance of int subclass.
    Raise TypeError if the result is not an int
    or if the object cannot be interpreted as an index.
 */
 PyObject *
-PyNumber_Index(PyObject *item)
+_PyNumber_Index(PyObject *item)
 {
-    PyObject *result = NULL;
     if (item == NULL) {
         return null_error();
     }
@@ -1338,9 +1432,13 @@
                      "as an integer", Py_TYPE(item)->tp_name);
         return NULL;
     }
-    result = Py_TYPE(item)->tp_as_number->nb_index(item);
-    if (!result || PyLong_CheckExact(result))
+
+    PyObject *result = Py_TYPE(item)->tp_as_number->nb_index(item);
+    assert(_Py_CheckSlotResult(item, "__index__", result != NULL));
+    if (!result || PyLong_CheckExact(result)) {
         return result;
+    }
+
     if (!PyLong_Check(result)) {
         PyErr_Format(PyExc_TypeError,
                      "__index__ returned non-int (type %.200s)",
@@ -1360,6 +1458,20 @@
     return result;
 }
 
+/* Return an exact Python int from the object item.
+   Raise TypeError if the result is not an int
+   or if the object cannot be interpreted as an index.
+*/
+PyObject *
+PyNumber_Index(PyObject *item)
+{
+    PyObject *result = _PyNumber_Index(item);
+    if (result != NULL && !PyLong_CheckExact(result)) {
+        Py_SETREF(result, _PyLong_Copy((PyLongObject *)result));
+    }
+    return result;
+}
+
 /* Return an error on Overflow only if err is not NULL*/
 
 Py_ssize_t
@@ -1367,23 +1479,29 @@
 {
     Py_ssize_t result;
     PyObject *runerr;
-    PyObject *value = PyNumber_Index(item);
+    PyObject *value = _PyNumber_Index(item);
     if (value == NULL)
         return -1;
 
     /* We're done if PyLong_AsSsize_t() returns without error. */
     result = PyLong_AsSsize_t(value);
-    if (result != -1 || !(runerr = PyErr_Occurred()))
+    if (result != -1)
         goto finish;
 
+    PyThreadState *tstate = _PyThreadState_GET();
+    runerr = _PyErr_Occurred(tstate);
+    if (!runerr) {
+        goto finish;
+    }
+
     /* Error handling code -- only manage OverflowError differently */
-    if (!PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError))
+    if (!PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
         goto finish;
+    }
+    _PyErr_Clear(tstate);
 
-    PyErr_Clear();
     /* If no error-handling desired then the default clipping
-       is sufficient.
-     */
+       is sufficient. */
     if (!err) {
         assert(PyLong_Check(value));
         /* Whether or not it is less than or equal to
@@ -1396,9 +1514,9 @@
     }
     else {
         /* Otherwise replace the error with caller's error object. */
-        PyErr_Format(err,
-                     "cannot fit '%.200s' into an index-sized integer",
-                     Py_TYPE(item)->tp_name);
+        _PyErr_Format(tstate, err,
+                      "cannot fit '%.200s' into an index-sized integer",
+                      Py_TYPE(item)->tp_name);
     }
 
  finish:
@@ -1426,18 +1544,35 @@
     }
     m = Py_TYPE(o)->tp_as_number;
     if (m && m->nb_int) { /* This should include subclasses of int */
-        result = _PyLong_FromNbInt(o);
-        if (result != NULL && !PyLong_CheckExact(result)) {
-            Py_SETREF(result, _PyLong_Copy((PyLongObject *)result));
+        /* Convert using the nb_int slot, which should return something
+           of exact type int. */
+        result = m->nb_int(o);
+        assert(_Py_CheckSlotResult(o, "__int__", result != NULL));
+        if (!result || PyLong_CheckExact(result)) {
+            return result;
         }
+
+        if (!PyLong_Check(result)) {
+            PyErr_Format(PyExc_TypeError,
+                         "__int__ returned non-int (type %.200s)",
+                         Py_TYPE(result)->tp_name);
+            Py_DECREF(result);
+            return NULL;
+        }
+        /* Issue #17576: warn if 'result' not of exact type int. */
+        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
+                "__int__ returned non-int (type %.200s).  "
+                "The ability to return an instance of a strict subclass of int "
+                "is deprecated, and may be removed in a future version of Python.",
+                Py_TYPE(result)->tp_name)) {
+            Py_DECREF(result);
+            return NULL;
+        }
+        Py_SETREF(result, _PyLong_Copy((PyLongObject *)result));
         return result;
     }
     if (m && m->nb_index) {
-        result = _PyLong_FromNbIndexOrNbInt(o);
-        if (result != NULL && !PyLong_CheckExact(result)) {
-            Py_SETREF(result, _PyLong_Copy((PyLongObject *)result));
-        }
-        return result;
+        return PyNumber_Index(o);
     }
     trunc_func = _PyObject_LookupSpecial(o, &PyId___trunc__);
     if (trunc_func) {
@@ -1452,8 +1587,7 @@
         }
         /* __trunc__ is specified to return an Integral type,
            but int() needs to return an int. */
-        m = Py_TYPE(result)->tp_as_number;
-        if (m == NULL || (m->nb_index == NULL && m->nb_int == NULL)) {
+        if (!PyIndex_Check(result)) {
             PyErr_Format(
                 PyExc_TypeError,
                 "__trunc__ returned non-Integral (type %.200s)",
@@ -1461,17 +1595,14 @@
             Py_DECREF(result);
             return NULL;
         }
-        Py_SETREF(result, _PyLong_FromNbIndexOrNbInt(result));
-        if (result != NULL && !PyLong_CheckExact(result)) {
-            Py_SETREF(result, _PyLong_Copy((PyLongObject *)result));
-        }
+        Py_SETREF(result, PyNumber_Index(result));
         return result;
     }
     if (PyErr_Occurred())
         return NULL;
 
     if (PyUnicode_Check(o))
-        /* The below check is done in PyLong_FromUnicode(). */
+        /* The below check is done in PyLong_FromUnicodeObject(). */
         return PyLong_FromUnicodeObject(o, 10);
 
     if (PyBytes_Check(o))
@@ -1503,29 +1634,28 @@
     }
 
     return type_error("int() argument must be a string, a bytes-like object "
-                      "or a number, not '%.200s'", o);
+                      "or a real number, not '%.200s'", o);
 }
 
 PyObject *
 PyNumber_Float(PyObject *o)
 {
-    PyNumberMethods *m;
-
     if (o == NULL) {
         return null_error();
     }
 
     if (PyFloat_CheckExact(o)) {
-        Py_INCREF(o);
-        return o;
+        return Py_NewRef(o);
     }
-    m = Py_TYPE(o)->tp_as_number;
+
+    PyNumberMethods *m = Py_TYPE(o)->tp_as_number;
     if (m && m->nb_float) { /* This should include subclasses of float */
         PyObject *res = m->nb_float(o);
-        double val;
+        assert(_Py_CheckSlotResult(o, "__float__", res != NULL));
         if (!res || PyFloat_CheckExact(res)) {
             return res;
         }
+
         if (!PyFloat_Check(res)) {
             PyErr_Format(PyExc_TypeError,
                          "%.50s.__float__ returned non-float (type %.50s)",
@@ -1542,12 +1672,13 @@
             Py_DECREF(res);
             return NULL;
         }
-        val = PyFloat_AS_DOUBLE(res);
+        double val = PyFloat_AS_DOUBLE(res);
         Py_DECREF(res);
         return PyFloat_FromDouble(val);
     }
+
     if (m && m->nb_index) {
-        PyObject *res = PyNumber_Index(o);
+        PyObject *res = _PyNumber_Index(o);
         if (!res) {
             return NULL;
         }
@@ -1558,7 +1689,9 @@
         }
         return PyFloat_FromDouble(val);
     }
-    if (PyFloat_Check(o)) { /* A float subclass with nb_float == NULL */
+
+    /* A float subclass with nb_float == NULL */
+    if (PyFloat_Check(o)) {
         return PyFloat_FromDouble(PyFloat_AS_DOUBLE(o));
     }
     return PyFloat_FromString(o);
@@ -1573,7 +1706,7 @@
                         "PyNumber_ToBase: base must be 2, 8, 10 or 16");
         return NULL;
     }
-    PyObject *index = PyNumber_Index(n);
+    PyObject *index = _PyNumber_Index(n);
     if (!index)
         return NULL;
     PyObject *res = _PyLong_Format(index, base);
@@ -1596,17 +1729,15 @@
 Py_ssize_t
 PySequence_Size(PyObject *s)
 {
-    PySequenceMethods *m;
-
     if (s == NULL) {
         null_error();
         return -1;
     }
 
-    m = Py_TYPE(s)->tp_as_sequence;
+    PySequenceMethods *m = Py_TYPE(s)->tp_as_sequence;
     if (m && m->sq_length) {
         Py_ssize_t len = m->sq_length(s);
-        assert(len >= 0 || PyErr_Occurred());
+        assert(_Py_CheckSlotResult(s, "__len__", len >= 0));
         return len;
     }
 
@@ -1629,21 +1760,22 @@
 PyObject *
 PySequence_Concat(PyObject *s, PyObject *o)
 {
-    PySequenceMethods *m;
-
     if (s == NULL || o == NULL) {
         return null_error();
     }
 
-    m = Py_TYPE(s)->tp_as_sequence;
-    if (m && m->sq_concat)
-        return m->sq_concat(s, o);
+    PySequenceMethods *m = Py_TYPE(s)->tp_as_sequence;
+    if (m && m->sq_concat) {
+        PyObject *res = m->sq_concat(s, o);
+        assert(_Py_CheckSlotResult(s, "+", res != NULL));
+        return res;
+    }
 
     /* Instances of user classes defining an __add__() method only
        have an nb_add slot, not an sq_concat slot.      So we fall back
        to nb_add if both arguments appear to be sequences. */
     if (PySequence_Check(s) && PySequence_Check(o)) {
-        PyObject *result = binary_op1(s, o, NB_SLOT(nb_add));
+        PyObject *result = BINARY_OP1(s, o, NB_SLOT(nb_add), "+");
         if (result != Py_NotImplemented)
             return result;
         Py_DECREF(result);
@@ -1654,15 +1786,16 @@
 PyObject *
 PySequence_Repeat(PyObject *o, Py_ssize_t count)
 {
-    PySequenceMethods *m;
-
     if (o == NULL) {
         return null_error();
     }
 
-    m = Py_TYPE(o)->tp_as_sequence;
-    if (m && m->sq_repeat)
-        return m->sq_repeat(o, count);
+    PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
+    if (m && m->sq_repeat) {
+        PyObject *res = m->sq_repeat(o, count);
+        assert(_Py_CheckSlotResult(o, "*", res != NULL));
+        return res;
+    }
 
     /* Instances of user classes defining a __mul__() method only
        have an nb_multiply slot, not an sq_repeat slot. so we fall back
@@ -1672,7 +1805,7 @@
         n = PyLong_FromSsize_t(count);
         if (n == NULL)
             return NULL;
-        result = binary_op1(o, n, NB_SLOT(nb_multiply));
+        result = BINARY_OP1(o, n, NB_SLOT(nb_multiply), "*");
         Py_DECREF(n);
         if (result != Py_NotImplemented)
             return result;
@@ -1684,21 +1817,25 @@
 PyObject *
 PySequence_InPlaceConcat(PyObject *s, PyObject *o)
 {
-    PySequenceMethods *m;
-
     if (s == NULL || o == NULL) {
         return null_error();
     }
 
-    m = Py_TYPE(s)->tp_as_sequence;
-    if (m && m->sq_inplace_concat)
-        return m->sq_inplace_concat(s, o);
-    if (m && m->sq_concat)
-        return m->sq_concat(s, o);
+    PySequenceMethods *m = Py_TYPE(s)->tp_as_sequence;
+    if (m && m->sq_inplace_concat) {
+        PyObject *res = m->sq_inplace_concat(s, o);
+        assert(_Py_CheckSlotResult(s, "+=", res != NULL));
+        return res;
+    }
+    if (m && m->sq_concat) {
+        PyObject *res = m->sq_concat(s, o);
+        assert(_Py_CheckSlotResult(s, "+", res != NULL));
+        return res;
+    }
 
     if (PySequence_Check(s) && PySequence_Check(o)) {
-        PyObject *result = binary_iop1(s, o, NB_SLOT(nb_inplace_add),
-                                       NB_SLOT(nb_add));
+        PyObject *result = BINARY_IOP1(s, o, NB_SLOT(nb_inplace_add),
+                                       NB_SLOT(nb_add), "+=");
         if (result != Py_NotImplemented)
             return result;
         Py_DECREF(result);
@@ -1709,25 +1846,29 @@
 PyObject *
 PySequence_InPlaceRepeat(PyObject *o, Py_ssize_t count)
 {
-    PySequenceMethods *m;
-
     if (o == NULL) {
         return null_error();
     }
 
-    m = Py_TYPE(o)->tp_as_sequence;
-    if (m && m->sq_inplace_repeat)
-        return m->sq_inplace_repeat(o, count);
-    if (m && m->sq_repeat)
-        return m->sq_repeat(o, count);
+    PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
+    if (m && m->sq_inplace_repeat) {
+        PyObject *res = m->sq_inplace_repeat(o, count);
+        assert(_Py_CheckSlotResult(o, "*=", res != NULL));
+        return res;
+    }
+    if (m && m->sq_repeat) {
+        PyObject *res = m->sq_repeat(o, count);
+        assert(_Py_CheckSlotResult(o, "*", res != NULL));
+        return res;
+    }
 
     if (PySequence_Check(o)) {
         PyObject *n, *result;
         n = PyLong_FromSsize_t(count);
         if (n == NULL)
             return NULL;
-        result = binary_iop1(o, n, NB_SLOT(nb_inplace_multiply),
-                             NB_SLOT(nb_multiply));
+        result = BINARY_IOP1(o, n, NB_SLOT(nb_inplace_multiply),
+                             NB_SLOT(nb_multiply), "*=");
         Py_DECREF(n);
         if (result != Py_NotImplemented)
             return result;
@@ -1739,25 +1880,25 @@
 PyObject *
 PySequence_GetItem(PyObject *s, Py_ssize_t i)
 {
-    PySequenceMethods *m;
-
     if (s == NULL) {
         return null_error();
     }
 
-    m = Py_TYPE(s)->tp_as_sequence;
+    PySequenceMethods *m = Py_TYPE(s)->tp_as_sequence;
     if (m && m->sq_item) {
         if (i < 0) {
             if (m->sq_length) {
                 Py_ssize_t l = (*m->sq_length)(s);
+                assert(_Py_CheckSlotResult(s, "__len__", l >= 0));
                 if (l < 0) {
-                    assert(PyErr_Occurred());
                     return NULL;
                 }
                 i += l;
             }
         }
-        return m->sq_item(s, i);
+        PyObject *res = m->sq_item(s, i);
+        assert(_Py_CheckSlotResult(s, "__getitem__", res != NULL));
+        return res;
     }
 
     if (Py_TYPE(s)->tp_as_mapping && Py_TYPE(s)->tp_as_mapping->mp_subscript) {
@@ -1769,19 +1910,18 @@
 PyObject *
 PySequence_GetSlice(PyObject *s, Py_ssize_t i1, Py_ssize_t i2)
 {
-    PyMappingMethods *mp;
-
     if (!s) {
         return null_error();
     }
 
-    mp = Py_TYPE(s)->tp_as_mapping;
+    PyMappingMethods *mp = Py_TYPE(s)->tp_as_mapping;
     if (mp && mp->mp_subscript) {
-        PyObject *res;
         PyObject *slice = _PySlice_FromIndices(i1, i2);
-        if (!slice)
+        if (!slice) {
             return NULL;
-        res = mp->mp_subscript(s, slice);
+        }
+        PyObject *res = mp->mp_subscript(s, slice);
+        assert(_Py_CheckSlotResult(s, "__getitem__", res != NULL));
         Py_DECREF(slice);
         return res;
     }
@@ -1792,26 +1932,26 @@
 int
 PySequence_SetItem(PyObject *s, Py_ssize_t i, PyObject *o)
 {
-    PySequenceMethods *m;
-
     if (s == NULL) {
         null_error();
         return -1;
     }
 
-    m = Py_TYPE(s)->tp_as_sequence;
+    PySequenceMethods *m = Py_TYPE(s)->tp_as_sequence;
     if (m && m->sq_ass_item) {
         if (i < 0) {
             if (m->sq_length) {
                 Py_ssize_t l = (*m->sq_length)(s);
+                assert(_Py_CheckSlotResult(s, "__len__", l >= 0));
                 if (l < 0) {
-                    assert(PyErr_Occurred());
                     return -1;
                 }
                 i += l;
             }
         }
-        return m->sq_ass_item(s, i, o);
+        int res = m->sq_ass_item(s, i, o);
+        assert(_Py_CheckSlotResult(s, "__setitem__", res >= 0));
+        return res;
     }
 
     if (Py_TYPE(s)->tp_as_mapping && Py_TYPE(s)->tp_as_mapping->mp_ass_subscript) {
@@ -1825,26 +1965,26 @@
 int
 PySequence_DelItem(PyObject *s, Py_ssize_t i)
 {
-    PySequenceMethods *m;
-
     if (s == NULL) {
         null_error();
         return -1;
     }
 
-    m = Py_TYPE(s)->tp_as_sequence;
+    PySequenceMethods *m = Py_TYPE(s)->tp_as_sequence;
     if (m && m->sq_ass_item) {
         if (i < 0) {
             if (m->sq_length) {
                 Py_ssize_t l = (*m->sq_length)(s);
+                assert(_Py_CheckSlotResult(s, "__len__", l >= 0));
                 if (l < 0) {
-                    assert(PyErr_Occurred());
                     return -1;
                 }
                 i += l;
             }
         }
-        return m->sq_ass_item(s, i, (PyObject *)NULL);
+        int res = m->sq_ass_item(s, i, (PyObject *)NULL);
+        assert(_Py_CheckSlotResult(s, "__delitem__", res >= 0));
+        return res;
     }
 
     if (Py_TYPE(s)->tp_as_mapping && Py_TYPE(s)->tp_as_mapping->mp_ass_subscript) {
@@ -1858,20 +1998,18 @@
 int
 PySequence_SetSlice(PyObject *s, Py_ssize_t i1, Py_ssize_t i2, PyObject *o)
 {
-    PyMappingMethods *mp;
-
     if (s == NULL) {
         null_error();
         return -1;
     }
 
-    mp = Py_TYPE(s)->tp_as_mapping;
+    PyMappingMethods *mp = Py_TYPE(s)->tp_as_mapping;
     if (mp && mp->mp_ass_subscript) {
-        int res;
         PyObject *slice = _PySlice_FromIndices(i1, i2);
         if (!slice)
             return -1;
-        res = mp->mp_ass_subscript(s, slice, o);
+        int res = mp->mp_ass_subscript(s, slice, o);
+        assert(_Py_CheckSlotResult(s, "__setitem__", res >= 0));
         Py_DECREF(slice);
         return res;
     }
@@ -1883,20 +2021,19 @@
 int
 PySequence_DelSlice(PyObject *s, Py_ssize_t i1, Py_ssize_t i2)
 {
-    PyMappingMethods *mp;
-
     if (s == NULL) {
         null_error();
         return -1;
     }
 
-    mp = Py_TYPE(s)->tp_as_mapping;
+    PyMappingMethods *mp = Py_TYPE(s)->tp_as_mapping;
     if (mp && mp->mp_ass_subscript) {
-        int res;
         PyObject *slice = _PySlice_FromIndices(i1, i2);
-        if (!slice)
+        if (!slice) {
             return -1;
-        res = mp->mp_ass_subscript(s, slice, NULL);
+        }
+        int res = mp->mp_ass_subscript(s, slice, NULL);
+        assert(_Py_CheckSlotResult(s, "__delitem__", res >= 0));
         Py_DECREF(slice);
         return res;
     }
@@ -2027,8 +2164,10 @@
 
     it = PyObject_GetIter(v);
     if (it == NULL) {
-        if (PyErr_ExceptionMatches(PyExc_TypeError))
-            PyErr_SetString(PyExc_TypeError, m);
+        PyThreadState *tstate = _PyThreadState_GET();
+        if (_PyErr_ExceptionMatches(tstate, PyExc_TypeError)) {
+            _PyErr_SetString(tstate, PyExc_TypeError, m);
+        }
         return NULL;
     }
 
@@ -2141,11 +2280,13 @@
 int
 PySequence_Contains(PyObject *seq, PyObject *ob)
 {
-    Py_ssize_t result;
     PySequenceMethods *sqm = Py_TYPE(seq)->tp_as_sequence;
-    if (sqm != NULL && sqm->sq_contains != NULL)
-        return (*sqm->sq_contains)(seq, ob);
-    result = _PySequence_IterSearch(seq, ob, PY_ITERSEARCH_CONTAINS);
+    if (sqm != NULL && sqm->sq_contains != NULL) {
+        int res = (*sqm->sq_contains)(seq, ob);
+        assert(_Py_CheckSlotResult(seq, "__contains__", res >= 0));
+        return res;
+    }
+    Py_ssize_t result = _PySequence_IterSearch(seq, ob, PY_ITERSEARCH_CONTAINS);
     return Py_SAFE_DOWNCAST(result, Py_ssize_t, int);
 }
 
@@ -2175,17 +2316,15 @@
 Py_ssize_t
 PyMapping_Size(PyObject *o)
 {
-    PyMappingMethods *m;
-
     if (o == NULL) {
         null_error();
         return -1;
     }
 
-    m = Py_TYPE(o)->tp_as_mapping;
+    PyMappingMethods *m = Py_TYPE(o)->tp_as_mapping;
     if (m && m->mp_length) {
         Py_ssize_t len = m->mp_length(o);
-        assert(len >= 0 || PyErr_Occurred());
+        assert(_Py_CheckSlotResult(o, "__len__", len >= 0));
         return len;
     }
 
@@ -2285,12 +2424,13 @@
     }
     it = PyObject_GetIter(meth_output);
     if (it == NULL) {
-        if (PyErr_ExceptionMatches(PyExc_TypeError)) {
-            PyErr_Format(PyExc_TypeError,
-                         "%.200s.%U() returned a non-iterable (type %.200s)",
-                         Py_TYPE(o)->tp_name,
-                         _PyUnicode_FromId(meth_id),
-                         Py_TYPE(meth_output)->tp_name);
+        PyThreadState *tstate = _PyThreadState_GET();
+        if (_PyErr_ExceptionMatches(tstate, PyExc_TypeError)) {
+            _PyErr_Format(tstate, PyExc_TypeError,
+                          "%.200s.%U() returned a non-iterable (type %.200s)",
+                          Py_TYPE(o)->tp_name,
+                          _PyUnicode_FromId(meth_id),
+                          Py_TYPE(meth_output)->tp_name);
         }
         Py_DECREF(meth_output);
         return NULL;
@@ -2417,14 +2557,22 @@
             derived = PyTuple_GET_ITEM(bases, 0);
             continue;
         }
-        for (i = 0; i < n; i++) {
-            r = abstract_issubclass(PyTuple_GET_ITEM(bases, i), cls);
-            if (r != 0)
-                break;
-        }
-        Py_DECREF(bases);
-        return r;
+        break;
     }
+    assert(n >= 2);
+    if (Py_EnterRecursiveCall(" in __issubclass__")) {
+        Py_DECREF(bases);
+        return -1;
+    }
+    for (i = 0; i < n; i++) {
+        r = abstract_issubclass(PyTuple_GET_ITEM(bases, i), cls);
+        if (r != 0) {
+            break;
+        }
+    }
+    Py_LeaveRecursiveCall();
+    Py_DECREF(bases);
+    return r;
 }
 
 static int
@@ -2433,8 +2581,10 @@
     PyObject *bases = abstract_get_bases(cls);
     if (bases == NULL) {
         /* Do not mask errors. */
-        if (!PyErr_Occurred())
-            PyErr_SetString(PyExc_TypeError, error);
+        PyThreadState *tstate = _PyThreadState_GET();
+        if (!_PyErr_Occurred(tstate)) {
+            _PyErr_SetString(tstate, PyExc_TypeError, error);
+        }
         return 0;
     }
     Py_DECREF(bases);
@@ -2447,7 +2597,6 @@
     PyObject *icls;
     int retval;
     _Py_IDENTIFIER(__class__);
-
     if (PyType_Check(cls)) {
         retval = PyObject_TypeCheck(inst, (PyTypeObject *)cls);
         if (retval == 0) {
@@ -2467,7 +2616,7 @@
     }
     else {
         if (!check_class(cls,
-            "isinstance() arg 2 must be a type or tuple of types"))
+            "isinstance() arg 2 must be a type, a tuple of types, or a union"))
             return -1;
         retval = _PyObject_LookupAttrId(inst, &PyId___class__, &icls);
         if (icls != NULL) {
@@ -2560,10 +2709,12 @@
     if (!check_class(derived,
                      "issubclass() arg 1 must be a class"))
         return -1;
-    if (!check_class(cls,
-                    "issubclass() arg 2 must be a class"
-                    " or tuple of classes"))
+
+    if (!_PyUnion_Check(cls) && !check_class(cls,
+                            "issubclass() arg 2 must be a class,"
+                            " a tuple of classes, or a union")) {
         return -1;
+    }
 
     return abstract_issubclass(derived, cls);
 }
@@ -2672,12 +2823,41 @@
     }
 }
 
-#undef PyIter_Check
+PyObject *
+PyObject_GetAIter(PyObject *o) {
+    PyTypeObject *t = Py_TYPE(o);
+    unaryfunc f;
 
-int PyIter_Check(PyObject *obj)
+    if (t->tp_as_async == NULL || t->tp_as_async->am_aiter == NULL) {
+        return type_error("'%.200s' object is not an async iterable", o);
+    }
+    f = t->tp_as_async->am_aiter;
+    PyObject *it = (*f)(o);
+    if (it != NULL && !PyAIter_Check(it)) {
+        PyErr_Format(PyExc_TypeError,
+                     "aiter() returned not an async iterator of type '%.100s'",
+                     Py_TYPE(it)->tp_name);
+        Py_DECREF(it);
+        it = NULL;
+    }
+    return it;
+}
+
+int
+PyIter_Check(PyObject *obj)
 {
-    return Py_TYPE(obj)->tp_iternext != NULL &&
-           Py_TYPE(obj)->tp_iternext != &_PyObject_NextNotImplemented;
+    PyTypeObject *tp = Py_TYPE(obj);
+    return (tp->tp_iternext != NULL &&
+            tp->tp_iternext != &_PyObject_NextNotImplemented);
+}
+
+int
+PyAIter_Check(PyObject *obj)
+{
+    PyTypeObject *tp = Py_TYPE(obj);
+    return (tp->tp_as_async != NULL &&
+            tp->tp_as_async->am_anext != NULL &&
+            tp->tp_as_async->am_anext != &_PyObject_NextNotImplemented);
 }
 
 /* Return next item.
@@ -2692,13 +2872,42 @@
 {
     PyObject *result;
     result = (*Py_TYPE(iter)->tp_iternext)(iter);
-    if (result == NULL &&
-        PyErr_Occurred() &&
-        PyErr_ExceptionMatches(PyExc_StopIteration))
-        PyErr_Clear();
+    if (result == NULL) {
+        PyThreadState *tstate = _PyThreadState_GET();
+        if (_PyErr_Occurred(tstate)
+            && _PyErr_ExceptionMatches(tstate, PyExc_StopIteration))
+        {
+            _PyErr_Clear(tstate);
+        }
+    }
     return result;
 }
 
+PySendResult
+PyIter_Send(PyObject *iter, PyObject *arg, PyObject **result)
+{
+    _Py_IDENTIFIER(send);
+    assert(arg != NULL);
+    assert(result != NULL);
+    if (Py_TYPE(iter)->tp_as_async && Py_TYPE(iter)->tp_as_async->am_send) {
+        PySendResult res = Py_TYPE(iter)->tp_as_async->am_send(iter, arg, result);
+        assert(_Py_CheckSlotResult(iter, "am_send", res != PYGEN_ERROR));
+        return res;
+    }
+    if (arg == Py_None && PyIter_Check(iter)) {
+        *result = Py_TYPE(iter)->tp_iternext(iter);
+    }
+    else {
+        *result = _PyObject_CallMethodIdOneArg(iter, &PyId_send, arg);
+    }
+    if (*result != NULL) {
+        return PYGEN_NEXT;
+    }
+    if (_PyGen_FetchStopIterationValue(result) == 0) {
+        return PYGEN_RETURN;
+    }
+    return PYGEN_ERROR;
+}
 
 /*
  * Flatten a sequence of bytes() objects into a C array of
diff --git a/Objects/boolobject.c b/Objects/boolobject.c
index 720835b..b786966 100644
--- a/Objects/boolobject.c
+++ b/Objects/boolobject.c
@@ -55,6 +55,30 @@
     return PyBool_FromLong(ok);
 }
 
+static PyObject *
+bool_vectorcall(PyObject *type, PyObject * const*args,
+                size_t nargsf, PyObject *kwnames)
+{
+    long ok = 0;
+    if (!_PyArg_NoKwnames("bool", kwnames)) {
+        return NULL;
+    }
+
+    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
+    if (!_PyArg_CheckPositional("bool", nargs, 0, 1)) {
+        return NULL;
+    }
+
+    assert(PyType_Check(type));
+    if (nargs) {
+        ok = PyObject_IsTrue(args[0]);
+        if (ok < 0) {
+            return NULL;
+        }
+    }
+    return PyBool_FromLong(ok);
+}
+
 /* Arithmetic operations redefined to return bool if both args are bool. */
 
 static PyObject *
@@ -170,6 +194,7 @@
     0,                                          /* tp_init */
     0,                                          /* tp_alloc */
     bool_new,                                   /* tp_new */
+    .tp_vectorcall = bool_vectorcall,
 };
 
 /* The objects representing bool values False and True */
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c
index 97d7796..1ab9621 100644
--- a/Objects/bytearrayobject.c
+++ b/Objects/bytearrayobject.c
@@ -13,31 +13,23 @@
 [clinic start generated code]*/
 /*[clinic end generated code: output=da39a3ee5e6b4b0d input=5535b77c37a119e0]*/
 
+/* For PyByteArray_AS_STRING(). */
 char _PyByteArray_empty_string[] = "";
 
-/* end nullbytes support */
-
 /* Helpers */
 
 static int
 _getbytevalue(PyObject* arg, int *value)
 {
-    long face_value;
+    int overflow;
+    long face_value = PyLong_AsLongAndOverflow(arg, &overflow);
 
-    if (PyLong_Check(arg)) {
-        face_value = PyLong_AsLong(arg);
-    } else {
-        PyObject *index = PyNumber_Index(arg);
-        if (index == NULL) {
-            *value = -1;
-            return 0;
-        }
-        face_value = PyLong_AsLong(index);
-        Py_DECREF(index);
+    if (face_value == -1 && PyErr_Occurred()) {
+        *value = -1;
+        return 0;
     }
-
     if (face_value < 0 || face_value >= 256) {
-        /* this includes the OverflowError in case the long is too large */
+        /* this includes an overflow in converting to C long */
         PyErr_SetString(PyExc_ValueError, "byte must be in range(0, 256)");
         *value = -1;
         return 0;
@@ -273,7 +265,7 @@
 
     result = (PyByteArrayObject *) \
         PyByteArray_FromStringAndSize(NULL, va.len + vb.len);
-    // result->ob_bytes is NULL if result is an empty string:
+    // result->ob_bytes is NULL if result is an empty bytearray:
     // if va.len + vb.len equals zero.
     if (result != NULL && result->ob_bytes != NULL) {
         memcpy(result->ob_bytes, va.buf, va.len);
@@ -329,6 +321,7 @@
     PyByteArrayObject *result;
     Py_ssize_t mysize;
     Py_ssize_t size;
+    const char *buf;
 
     if (count < 0)
         count = 0;
@@ -337,13 +330,14 @@
         return PyErr_NoMemory();
     size = mysize * count;
     result = (PyByteArrayObject *)PyByteArray_FromStringAndSize(NULL, size);
+    buf = PyByteArray_AS_STRING(self);
     if (result != NULL && size != 0) {
         if (mysize == 1)
-            memset(result->ob_bytes, self->ob_bytes[0], size);
+            memset(result->ob_bytes, buf[0], size);
         else {
             Py_ssize_t i;
             for (i = 0; i < count; i++)
-                memcpy(result->ob_bytes + i*mysize, self->ob_bytes, mysize);
+                memcpy(result->ob_bytes + i*mysize, buf, mysize);
         }
     }
     return (PyObject *)result;
@@ -745,13 +739,20 @@
     }
 }
 
+/*[clinic input]
+bytearray.__init__
+
+    source as arg: object = NULL
+    encoding: str = NULL
+    errors: str = NULL
+
+[clinic start generated code]*/
+
 static int
-bytearray_init(PyByteArrayObject *self, PyObject *args, PyObject *kwds)
+bytearray___init___impl(PyByteArrayObject *self, PyObject *arg,
+                        const char *encoding, const char *errors)
+/*[clinic end generated code: output=4ce1304649c2f8b3 input=1141a7122eefd7b9]*/
 {
-    static char *kwlist[] = {"source", "encoding", "errors", 0};
-    PyObject *arg = NULL;
-    const char *encoding = NULL;
-    const char *errors = NULL;
     Py_ssize_t count;
     PyObject *it;
     PyObject *(*iternext)(PyObject *);
@@ -762,11 +763,6 @@
             return -1;
     }
 
-    /* Parse arguments */
-    if (!PyArg_ParseTupleAndKeywords(args, kwds, "|Oss:bytearray", kwlist,
-                                     &arg, &encoding, &errors))
-        return -1;
-
     /* Make a quick exit if no first argument */
     if (arg == NULL) {
         if (encoding != NULL || errors != NULL) {
@@ -1010,26 +1006,20 @@
 {
     Py_ssize_t self_size, other_size;
     Py_buffer self_bytes, other_bytes;
-    int cmp, rc;
+    int cmp;
 
-    /* Bytes can be compared to anything that supports the (binary)
-       buffer API.  Except that a comparison with Unicode is always an
-       error, even if the comparison is for equality. */
-    rc = PyObject_IsInstance(self, (PyObject*)&PyUnicode_Type);
-    if (!rc)
-        rc = PyObject_IsInstance(other, (PyObject*)&PyUnicode_Type);
-    if (rc < 0)
-        return NULL;
-    if (rc) {
-        if (_Py_GetConfig()->bytes_warning && (op == Py_EQ || op == Py_NE)) {
-            if (PyErr_WarnEx(PyExc_BytesWarning,
-                            "Comparison between bytearray and string", 1))
-                return NULL;
+    if (!PyObject_CheckBuffer(self) || !PyObject_CheckBuffer(other)) {
+        if (PyUnicode_Check(self) || PyUnicode_Check(other)) {
+            if (_Py_GetConfig()->bytes_warning && (op == Py_EQ || op == Py_NE)) {
+                if (PyErr_WarnEx(PyExc_BytesWarning,
+                                "Comparison between bytearray and string", 1))
+                    return NULL;
+            }
         }
-
         Py_RETURN_NOTIMPLEMENTED;
     }
 
+    /* Bytearrays can be compared to anything that supports the buffer API. */
     if (PyObject_GetBuffer(self, &self_bytes, PyBUF_SIMPLE) != 0) {
         PyErr_Clear();
         Py_RETURN_NOTIMPLEMENTED;
@@ -1337,7 +1327,7 @@
         if (trans_table[c] != -1)
             *output++ = (char)trans_table[c];
     }
-    /* Fix the size of the resulting string */
+    /* Fix the size of the resulting bytearray */
     if (inlen > 0)
         if (PyByteArray_Resize(result, output - output_start) < 0) {
             Py_CLEAR(result);
@@ -1746,6 +1736,11 @@
     }
     Py_DECREF(it);
 
+    if (PyErr_Occurred()) {
+        Py_DECREF(bytearray_obj);
+        return NULL;
+    }
+
     /* Resize down to exact size. */
     if (PyByteArray_Resize((PyObject *)bytearray_obj, len) < 0) {
         Py_DECREF(bytearray_obj);
@@ -1758,10 +1753,7 @@
     }
     Py_DECREF(bytearray_obj);
 
-    if (PyErr_Occurred()) {
-        return NULL;
-    }
-
+    assert(!PyErr_Occurred());
     Py_RETURN_NONE;
 }
 
@@ -2092,7 +2084,7 @@
         How many bytes between separators.  Positive values count from the
         right, negative values count from the left.
 
-Create a str of hexadecimal numbers from a bytearray object.
+Create a string of hexadecimal numbers from a bytearray object.
 
 Example:
 >>> value = bytearray([0xb9, 0x01, 0xef])
@@ -2108,7 +2100,7 @@
 
 static PyObject *
 bytearray_hex_impl(PyByteArrayObject *self, PyObject *sep, int bytes_per_sep)
-/*[clinic end generated code: output=29c4e5ef72c565a0 input=814c15830ac8c4b5]*/
+/*[clinic end generated code: output=29c4e5ef72c565a0 input=808667e49bcccb54]*/
 {
     char* argbuf = PyByteArray_AS_STRING(self);
     Py_ssize_t arglen = PyByteArray_GET_SIZE(self);
@@ -2345,7 +2337,8 @@
     PyObject_GenericGetAttr,            /* tp_getattro */
     0,                                  /* tp_setattro */
     &bytearray_as_buffer,               /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
+    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
+        _Py_TPFLAGS_MATCH_SELF,       /* tp_flags */
     bytearray_doc,                      /* tp_doc */
     0,                                  /* tp_traverse */
     0,                                  /* tp_clear */
@@ -2361,13 +2354,13 @@
     0,                                  /* tp_descr_get */
     0,                                  /* tp_descr_set */
     0,                                  /* tp_dictoffset */
-    (initproc)bytearray_init,           /* tp_init */
+    (initproc)bytearray___init__,       /* tp_init */
     PyType_GenericAlloc,                /* tp_alloc */
     PyType_GenericNew,                  /* tp_new */
     PyObject_Del,                       /* tp_free */
 };
 
-/*********************** Bytes Iterator ****************************/
+/*********************** Bytearray Iterator ****************************/
 
 typedef struct {
     PyObject_HEAD
diff --git a/Objects/bytes_methods.c b/Objects/bytes_methods.c
index 72daa1f..994fb8a 100644
--- a/Objects/bytes_methods.c
+++ b/Objects/bytes_methods.c
@@ -100,14 +100,14 @@
 False otherwise.");
 
 // Optimization is copied from ascii_decode in unicodeobject.c
-/* Mask to quickly check whether a C 'long' contains a
+/* Mask to quickly check whether a C 'size_t' contains a
    non-ASCII, UTF8-encoded char. */
-#if (SIZEOF_LONG == 8)
-# define ASCII_CHAR_MASK 0x8080808080808080UL
-#elif (SIZEOF_LONG == 4)
-# define ASCII_CHAR_MASK 0x80808080UL
+#if (SIZEOF_SIZE_T == 8)
+# define ASCII_CHAR_MASK 0x8080808080808080ULL
+#elif (SIZEOF_SIZE_T == 4)
+# define ASCII_CHAR_MASK 0x80808080U
 #else
-# error C 'long' size should be either 4 or 8!
+# error C 'size_t' size should be either 4 or 8!
 #endif
 
 PyObject*
@@ -115,20 +115,19 @@
 {
     const char *p = cptr;
     const char *end = p + len;
-    const char *aligned_end = (const char *) _Py_ALIGN_DOWN(end, SIZEOF_LONG);
 
     while (p < end) {
         /* Fast path, see in STRINGLIB(utf8_decode) in stringlib/codecs.h
            for an explanation. */
-        if (_Py_IS_ALIGNED(p, SIZEOF_LONG)) {
+        if (_Py_IS_ALIGNED(p, ALIGNOF_SIZE_T)) {
             /* Help allocation */
             const char *_p = p;
-            while (_p < aligned_end) {
-                unsigned long value = *(const unsigned long *) _p;
+            while (_p + SIZEOF_SIZE_T <= end) {
+                size_t value = *(const size_t *) _p;
                 if (value & ASCII_CHAR_MASK) {
                     Py_RETURN_FALSE;
                 }
-                _p += SIZEOF_LONG;
+                _p += SIZEOF_SIZE_T;
             }
             p = _p;
             if (_p == end)
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
index 25d9814..eaedb0b 100644
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -4,8 +4,10 @@
 
 #include "Python.h"
 #include "pycore_abstract.h"      // _PyIndex_Check()
-#include "pycore_bytes_methods.h"
-#include "pycore_object.h"
+#include "pycore_bytes_methods.h" // _Py_bytes_startswith()
+#include "pycore_format.h"        // F_LJUST
+#include "pycore_initconfig.h"    // _PyStatus_OK()
+#include "pycore_object.h"        // _PyObject_GC_TRACK
 #include "pycore_pymem.h"         // PYMEM_CLEANBYTE
 
 #include "pystrhex.h"
@@ -18,16 +20,13 @@
 
 #include "clinic/bytesobject.c.h"
 
-static PyBytesObject *characters[UCHAR_MAX + 1];
-static PyBytesObject *nullstring;
-
 _Py_IDENTIFIER(__bytes__);
 
-/* PyBytesObject_SIZE gives the basic size of a string; any memory allocation
-   for a string of length n should request PyBytesObject_SIZE + n bytes.
+/* PyBytesObject_SIZE gives the basic size of a bytes object; any memory allocation
+   for a bytes object of length n should request PyBytesObject_SIZE + n bytes.
 
    Using PyBytesObject_SIZE instead of sizeof(PyBytesObject) saves
-   3 bytes per string allocation on a typical system.
+   3 or 7 bytes per bytes object allocation on a typical system.
 */
 #define PyBytesObject_SIZE (offsetof(PyBytesObject, ob_sval) + 1)
 
@@ -35,6 +34,53 @@
 Py_LOCAL_INLINE(Py_ssize_t) _PyBytesWriter_GetSize(_PyBytesWriter *writer,
                                                    char *str);
 
+
+static struct _Py_bytes_state*
+get_bytes_state(void)
+{
+    PyInterpreterState *interp = _PyInterpreterState_GET();
+    return &interp->bytes;
+}
+
+
+// Return a borrowed reference to the empty bytes string singleton.
+static inline PyObject* bytes_get_empty(void)
+{
+    struct _Py_bytes_state *state = get_bytes_state();
+    // bytes_get_empty() must not be called before _PyBytes_Init()
+    // or after _PyBytes_Fini()
+    assert(state->empty_string != NULL);
+    return state->empty_string;
+}
+
+
+// Return a strong reference to the empty bytes string singleton.
+static inline PyObject* bytes_new_empty(void)
+{
+    PyObject *empty = bytes_get_empty();
+    Py_INCREF(empty);
+    return (PyObject *)empty;
+}
+
+
+static int
+bytes_create_empty_string_singleton(struct _Py_bytes_state *state)
+{
+    // Create the empty bytes string singleton
+    PyBytesObject *op = (PyBytesObject *)PyObject_Malloc(PyBytesObject_SIZE);
+    if (op == NULL) {
+        return -1;
+    }
+    _PyObject_InitVar((PyVarObject*)op, &PyBytes_Type, 0);
+    op->ob_shash = -1;
+    op->ob_sval[0] = '\0';
+
+    assert(state->empty_string == NULL);
+    state->empty_string = (PyObject *)op;
+    return 0;
+}
+
+
 /*
    For PyBytes_FromString(), the parameter `str' points to a null-terminated
    string containing exactly `size' bytes.
@@ -63,9 +109,8 @@
     PyBytesObject *op;
     assert(size >= 0);
 
-    if (size == 0 && (op = nullstring) != NULL) {
-        Py_INCREF(op);
-        return (PyObject *)op;
+    if (size == 0) {
+        return bytes_new_empty();
     }
 
     if ((size_t)size > (size_t)PY_SSIZE_T_MAX - PyBytesObject_SIZE) {
@@ -79,16 +124,13 @@
         op = (PyBytesObject *)PyObject_Calloc(1, PyBytesObject_SIZE + size);
     else
         op = (PyBytesObject *)PyObject_Malloc(PyBytesObject_SIZE + size);
-    if (op == NULL)
+    if (op == NULL) {
         return PyErr_NoMemory();
-    (void)PyObject_INIT_VAR(op, &PyBytes_Type, size);
+    }
+    _PyObject_InitVar((PyVarObject*)op, &PyBytes_Type, size);
     op->ob_shash = -1;
-    if (!use_calloc)
+    if (!use_calloc) {
         op->ob_sval[size] = '\0';
-    /* empty byte string singleton */
-    if (size == 0) {
-        nullstring = op;
-        Py_INCREF(op);
     }
     return (PyObject *) op;
 }
@@ -102,11 +144,16 @@
             "Negative size passed to PyBytes_FromStringAndSize");
         return NULL;
     }
-    if (size == 1 && str != NULL &&
-        (op = characters[*str & UCHAR_MAX]) != NULL)
-    {
-        Py_INCREF(op);
-        return (PyObject *)op;
+    if (size == 1 && str != NULL) {
+        struct _Py_bytes_state *state = get_bytes_state();
+        op = state->characters[*str & UCHAR_MAX];
+        if (op != NULL) {
+            Py_INCREF(op);
+            return (PyObject *)op;
+        }
+    }
+    if (size == 0) {
+        return bytes_new_empty();
     }
 
     op = (PyBytesObject *)_PyBytes_FromSize(size, 0);
@@ -118,8 +165,9 @@
     memcpy(op->ob_sval, str, size);
     /* share short strings */
     if (size == 1) {
-        characters[*str & UCHAR_MAX] = op;
+        struct _Py_bytes_state *state = get_bytes_state();
         Py_INCREF(op);
+        state->characters[*str & UCHAR_MAX] = op;
     }
     return (PyObject *) op;
 }
@@ -137,29 +185,32 @@
             "byte string is too long");
         return NULL;
     }
-    if (size == 0 && (op = nullstring) != NULL) {
-        Py_INCREF(op);
-        return (PyObject *)op;
+
+    struct _Py_bytes_state *state = get_bytes_state();
+    if (size == 0) {
+        return bytes_new_empty();
     }
-    if (size == 1 && (op = characters[*str & UCHAR_MAX]) != NULL) {
-        Py_INCREF(op);
-        return (PyObject *)op;
+    else if (size == 1) {
+        op = state->characters[*str & UCHAR_MAX];
+        if (op != NULL) {
+            Py_INCREF(op);
+            return (PyObject *)op;
+        }
     }
 
     /* Inline PyObject_NewVar */
-    op = (PyBytesObject *)PyObject_MALLOC(PyBytesObject_SIZE + size);
-    if (op == NULL)
+    op = (PyBytesObject *)PyObject_Malloc(PyBytesObject_SIZE + size);
+    if (op == NULL) {
         return PyErr_NoMemory();
-    (void)PyObject_INIT_VAR(op, &PyBytes_Type, size);
+    }
+    _PyObject_InitVar((PyVarObject*)op, &PyBytes_Type, size);
     op->ob_shash = -1;
     memcpy(op->ob_sval, str, size+1);
     /* share short strings */
-    if (size == 0) {
-        nullstring = op;
+    if (size == 1) {
+        assert(state->characters[*str & UCHAR_MAX] == NULL);
         Py_INCREF(op);
-    } else if (size == 1) {
-        characters[*str & UCHAR_MAX] = op;
-        Py_INCREF(op);
+        state->characters[*str & UCHAR_MAX] = op;
     }
     return (PyObject *) op;
 }
@@ -256,27 +307,29 @@
         }
 
         case 'd':
-            if (longflag)
+            if (longflag) {
                 sprintf(buffer, "%ld", va_arg(vargs, long));
-            else if (size_tflag)
-                sprintf(buffer, "%" PY_FORMAT_SIZE_T "d",
-                    va_arg(vargs, Py_ssize_t));
-            else
+            }
+            else if (size_tflag) {
+                sprintf(buffer, "%zd", va_arg(vargs, Py_ssize_t));
+            }
+            else {
                 sprintf(buffer, "%d", va_arg(vargs, int));
+            }
             assert(strlen(buffer) < sizeof(buffer));
             WRITE_BYTES(buffer);
             break;
 
         case 'u':
-            if (longflag)
-                sprintf(buffer, "%lu",
-                    va_arg(vargs, unsigned long));
-            else if (size_tflag)
-                sprintf(buffer, "%" PY_FORMAT_SIZE_T "u",
-                    va_arg(vargs, size_t));
-            else
-                sprintf(buffer, "%u",
-                    va_arg(vargs, unsigned int));
+            if (longflag) {
+                sprintf(buffer, "%lu", va_arg(vargs, unsigned long));
+            }
+            else if (size_tflag) {
+                sprintf(buffer, "%zu", va_arg(vargs, size_t));
+            }
+            else {
+                sprintf(buffer, "%u", va_arg(vargs, unsigned int));
+            }
             assert(strlen(buffer) < sizeof(buffer));
             WRITE_BYTES(buffer);
             break;
@@ -387,19 +440,6 @@
     return NULL;
 }
 
-/* Format codes
- * F_LJUST      '-'
- * F_SIGN       '+'
- * F_BLANK      ' '
- * F_ALT        '#'
- * F_ZERO       '0'
- */
-#define F_LJUST (1<<0)
-#define F_SIGN  (1<<1)
-#define F_BLANK (1<<2)
-#define F_ALT   (1<<3)
-#define F_ZERO  (1<<4)
-
 /* Returns a new reference to a PyBytes object, or NULL on failure. */
 
 static char*
@@ -455,25 +495,22 @@
     if (PyNumber_Check(v)) {
         /* make sure number is a type of integer for o, x, and X */
         if (type == 'o' || type == 'x' || type == 'X')
-            iobj = PyNumber_Index(v);
+            iobj = _PyNumber_Index(v);
         else
             iobj = PyNumber_Long(v);
-        if (iobj == NULL) {
-            if (!PyErr_ExceptionMatches(PyExc_TypeError))
-                return NULL;
-        }
-        else if (!PyLong_Check(iobj))
-            Py_CLEAR(iobj);
         if (iobj != NULL) {
+            assert(PyLong_Check(iobj));
             result = _PyUnicode_FormatLong(iobj, flags & F_ALT, prec, type);
             Py_DECREF(iobj);
             return result;
         }
+        if (!PyErr_ExceptionMatches(PyExc_TypeError))
+            return NULL;
     }
     PyErr_Format(PyExc_TypeError,
         "%%%c format: %s is required, not %.200s", type,
         (type == 'o' || type == 'x' || type == 'X') ? "an integer"
-                                                    : "a number",
+                                                    : "a real number",
         Py_TYPE(v)->tp_name);
     return NULL;
 }
@@ -490,26 +527,16 @@
         return 1;
     }
     else {
-        PyObject *iobj;
-        long ival;
         int overflow;
-        /* make sure number is a type of integer */
-        if (PyLong_Check(arg)) {
-            ival = PyLong_AsLongAndOverflow(arg, &overflow);
-        }
-        else {
-            iobj = PyNumber_Index(arg);
-            if (iobj == NULL) {
-                if (!PyErr_ExceptionMatches(PyExc_TypeError))
-                    return 0;
+        long ival = PyLong_AsLongAndOverflow(arg, &overflow);
+        if (ival == -1 && PyErr_Occurred()) {
+            if (PyErr_ExceptionMatches(PyExc_TypeError)) {
                 goto onError;
             }
-            ival = PyLong_AsLongAndOverflow(iobj, &overflow);
-            Py_DECREF(iobj);
+            return 0;
         }
-        if (!overflow && ival == -1 && PyErr_Occurred())
-            goto onError;
-        if (overflow || !(0 <= ival && ival <= 255)) {
+        if (!(0 <= ival && ival <= 255)) {
+            /* this includes an overflow in converting to C long */
             PyErr_SetString(PyExc_OverflowError,
                             "%c arg not in range(256)");
             return 0;
@@ -1245,6 +1272,8 @@
 /* -------------------------------------------------------------------- */
 /* Methods */
 
+#define STRINGLIB_GET_EMPTY() bytes_get_empty()
+
 #include "stringlib/stringdefs.h"
 
 #include "stringlib/fastsearch.h"
@@ -1257,6 +1286,8 @@
 
 #include "stringlib/transmogrify.h"
 
+#undef STRINGLIB_GET_EMPTY
+
 PyObject *
 PyBytes_Repr(PyObject *obj, int smartquotes)
 {
@@ -1432,10 +1463,11 @@
             "repeated bytes are too long");
         return NULL;
     }
-    op = (PyBytesObject *)PyObject_MALLOC(PyBytesObject_SIZE + nbytes);
-    if (op == NULL)
+    op = (PyBytesObject *)PyObject_Malloc(PyBytesObject_SIZE + nbytes);
+    if (op == NULL) {
         return PyErr_NoMemory();
-    (void)PyObject_INIT_VAR(op, &PyBytes_Type, size);
+    }
+    _PyObject_InitVar((PyVarObject*)op, &PyBytes_Type, size);
     op->ob_shash = -1;
     op->ob_sval[size] = '\0';
     if (Py_SIZE(a) == 1 && n > 0) {
@@ -1494,36 +1526,19 @@
     int c;
     Py_ssize_t len_a, len_b;
     Py_ssize_t min_len;
-    int rc;
 
     /* Make sure both arguments are strings. */
     if (!(PyBytes_Check(a) && PyBytes_Check(b))) {
         if (_Py_GetConfig()->bytes_warning && (op == Py_EQ || op == Py_NE)) {
-            rc = PyObject_IsInstance((PyObject*)a,
-                                     (PyObject*)&PyUnicode_Type);
-            if (!rc)
-                rc = PyObject_IsInstance((PyObject*)b,
-                                         (PyObject*)&PyUnicode_Type);
-            if (rc < 0)
-                return NULL;
-            if (rc) {
+            if (PyUnicode_Check(a) || PyUnicode_Check(b)) {
                 if (PyErr_WarnEx(PyExc_BytesWarning,
                                  "Comparison between bytes and string", 1))
                     return NULL;
             }
-            else {
-                rc = PyObject_IsInstance((PyObject*)a,
-                                         (PyObject*)&PyLong_Type);
-                if (!rc)
-                    rc = PyObject_IsInstance((PyObject*)b,
-                                             (PyObject*)&PyLong_Type);
-                if (rc < 0)
+            if (PyLong_Check(a) || PyLong_Check(b)) {
+                if (PyErr_WarnEx(PyExc_BytesWarning,
+                                 "Comparison between bytes and int", 1))
                     return NULL;
-                if (rc) {
-                    if (PyErr_WarnEx(PyExc_BytesWarning,
-                                     "Comparison between bytes and int", 1))
-                        return NULL;
-                }
             }
         }
         Py_RETURN_NOTIMPLEMENTED;
@@ -1533,7 +1548,7 @@
         case Py_EQ:
         case Py_LE:
         case Py_GE:
-            /* a string is equal to itself */
+            /* a byte string is equal to itself */
             Py_RETURN_TRUE;
         case Py_NE:
         case Py_LT:
@@ -2122,7 +2137,7 @@
         Py_INCREF(input_obj);
         return input_obj;
     }
-    /* Fix the size of the resulting string */
+    /* Fix the size of the resulting byte string */
     if (inlen > 0)
         _PyBytes_Resize(&result, output - output_start);
     return result;
@@ -2426,7 +2441,7 @@
         How many bytes between separators.  Positive values count from the
         right, negative values count from the left.
 
-Create a str of hexadecimal numbers from a bytes object.
+Create a string of hexadecimal numbers from a bytes object.
 
 Example:
 >>> value = b'\xb9\x01\xef'
@@ -2442,7 +2457,7 @@
 
 static PyObject *
 bytes_hex_impl(PyBytesObject *self, PyObject *sep, int bytes_per_sep)
-/*[clinic end generated code: output=1f134da504064139 input=f1238d3455990218]*/
+/*[clinic end generated code: output=1f134da504064139 input=1a21282b1f1ae595]*/
 {
     const char *argbuf = PyBytes_AS_STRING(self);
     Py_ssize_t arglen = PyBytes_GET_SIZE(self);
@@ -2536,24 +2551,27 @@
 };
 
 static PyObject *
-bytes_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
+bytes_subtype_new(PyTypeObject *, PyObject *);
+
+/*[clinic input]
+@classmethod
+bytes.__new__ as bytes_new
+
+    source as x: object = NULL
+    encoding: str = NULL
+    errors: str = NULL
+
+[clinic start generated code]*/
 
 static PyObject *
-bytes_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+bytes_new_impl(PyTypeObject *type, PyObject *x, const char *encoding,
+               const char *errors)
+/*[clinic end generated code: output=1e0c471be311a425 input=f0a966d19b7262b4]*/
 {
-    PyObject *x = NULL;
-    const char *encoding = NULL;
-    const char *errors = NULL;
-    PyObject *new = NULL;
+    PyObject *bytes;
     PyObject *func;
     Py_ssize_t size;
-    static char *kwlist[] = {"source", "encoding", "errors", 0};
 
-    if (type != &PyBytes_Type)
-        return bytes_subtype_new(type, args, kwds);
-    if (!PyArg_ParseTupleAndKeywords(args, kwds, "|Oss:bytes", kwlist, &x,
-                                     &encoding, &errors))
-        return NULL;
     if (x == NULL) {
         if (encoding != NULL || errors != NULL) {
             PyErr_SetString(PyExc_TypeError,
@@ -2562,78 +2580,73 @@
                             "errors without a string argument");
             return NULL;
         }
-        return PyBytes_FromStringAndSize(NULL, 0);
+        bytes = PyBytes_FromStringAndSize(NULL, 0);
     }
-
-    if (encoding != NULL) {
+    else if (encoding != NULL) {
         /* Encode via the codec registry */
         if (!PyUnicode_Check(x)) {
             PyErr_SetString(PyExc_TypeError,
                             "encoding without a string argument");
             return NULL;
         }
-        new = PyUnicode_AsEncodedString(x, encoding, errors);
-        if (new == NULL)
-            return NULL;
-        assert(PyBytes_Check(new));
-        return new;
+        bytes = PyUnicode_AsEncodedString(x, encoding, errors);
     }
-
-    if (errors != NULL) {
+    else if (errors != NULL) {
         PyErr_SetString(PyExc_TypeError,
                         PyUnicode_Check(x) ?
                         "string argument without an encoding" :
                         "errors without a string argument");
         return NULL;
     }
-
     /* We'd like to call PyObject_Bytes here, but we need to check for an
        integer argument before deferring to PyBytes_FromObject, something
        PyObject_Bytes doesn't do. */
-    func = _PyObject_LookupSpecial(x, &PyId___bytes__);
-    if (func != NULL) {
-        new = _PyObject_CallNoArg(func);
+    else if ((func = _PyObject_LookupSpecial(x, &PyId___bytes__)) != NULL) {
+        bytes = _PyObject_CallNoArg(func);
         Py_DECREF(func);
-        if (new == NULL)
+        if (bytes == NULL)
             return NULL;
-        if (!PyBytes_Check(new)) {
+        if (!PyBytes_Check(bytes)) {
             PyErr_Format(PyExc_TypeError,
-                         "__bytes__ returned non-bytes (type %.200s)",
-                         Py_TYPE(new)->tp_name);
-            Py_DECREF(new);
+                        "__bytes__ returned non-bytes (type %.200s)",
+                        Py_TYPE(bytes)->tp_name);
+            Py_DECREF(bytes);
             return NULL;
         }
-        return new;
     }
     else if (PyErr_Occurred())
         return NULL;
-
-    if (PyUnicode_Check(x)) {
+    else if (PyUnicode_Check(x)) {
         PyErr_SetString(PyExc_TypeError,
                         "string argument without an encoding");
         return NULL;
     }
     /* Is it an integer? */
-    if (_PyIndex_Check(x)) {
+    else if (_PyIndex_Check(x)) {
         size = PyNumber_AsSsize_t(x, PyExc_OverflowError);
         if (size == -1 && PyErr_Occurred()) {
             if (!PyErr_ExceptionMatches(PyExc_TypeError))
                 return NULL;
             PyErr_Clear();  /* fall through */
+            bytes = PyBytes_FromObject(x);
         }
         else {
             if (size < 0) {
                 PyErr_SetString(PyExc_ValueError, "negative count");
                 return NULL;
             }
-            new = _PyBytes_FromSize(size, 1);
-            if (new == NULL)
-                return NULL;
-            return new;
+            bytes = _PyBytes_FromSize(size, 1);
         }
     }
+    else {
+        bytes = PyBytes_FromObject(x);
+    }
 
-    return PyBytes_FromObject(x);
+    if (bytes != NULL && type != &PyBytes_Type) {
+        Py_SETREF(bytes, bytes_subtype_new(type, bytes));
+    }
+
+    return bytes;
 }
 
 static PyObject*
@@ -2746,7 +2759,7 @@
     Py_ssize_t i, size;
     _PyBytesWriter writer;
 
-    /* For iterator version, create a string object and resize as needed */
+    /* For iterator version, create a bytes object and resize as needed */
     size = PyObject_LengthHint(x, 64);
     if (size == -1 && PyErr_Occurred())
         return NULL;
@@ -2845,15 +2858,12 @@
 }
 
 static PyObject *
-bytes_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+bytes_subtype_new(PyTypeObject *type, PyObject *tmp)
 {
-    PyObject *tmp, *pnew;
+    PyObject *pnew;
     Py_ssize_t n;
 
     assert(PyType_IsSubtype(type, &PyBytes_Type));
-    tmp = bytes_new(&PyBytes_Type, args, kwds);
-    if (tmp == NULL)
-        return NULL;
     assert(PyBytes_Check(tmp));
     n = PyBytes_GET_SIZE(tmp);
     pnew = type->tp_alloc(type, n);
@@ -2863,7 +2873,6 @@
         ((PyBytesObject *)pnew)->ob_shash =
             ((PyBytesObject *)tmp)->ob_shash;
     }
-    Py_DECREF(tmp);
     return pnew;
 }
 
@@ -2903,7 +2912,8 @@
     0,                                          /* tp_setattro */
     &bytes_as_buffer,                           /* tp_as_buffer */
     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
-        Py_TPFLAGS_BYTES_SUBCLASS,              /* tp_flags */
+        Py_TPFLAGS_BYTES_SUBCLASS |
+        _Py_TPFLAGS_MATCH_SELF,               /* tp_flags */
     bytes_doc,                                  /* tp_doc */
     0,                                          /* tp_traverse */
     0,                                          /* tp_clear */
@@ -3021,9 +3031,9 @@
         goto error;
     }
     if (newsize == 0) {
-        *pv = _PyBytes_FromSize(0, 0);
+        *pv = bytes_new_empty();
         Py_DECREF(v);
-        return (*pv == NULL) ? -1 : 0;
+        return 0;
     }
     /* XXX UNREF/NEWREF interface should be more symmetrical */
 #ifdef Py_REF_DEBUG
@@ -3033,9 +3043,9 @@
     _Py_ForgetReference(v);
 #endif
     *pv = (PyObject *)
-        PyObject_REALLOC(v, PyBytesObject_SIZE + newsize);
+        PyObject_Realloc(v, PyBytesObject_SIZE + newsize);
     if (*pv == NULL) {
-        PyObject_Del(v);
+        PyObject_Free(v);
         PyErr_NoMemory();
         return -1;
     }
@@ -3052,13 +3062,26 @@
     return -1;
 }
 
-void
-_PyBytes_Fini(void)
+
+PyStatus
+_PyBytes_Init(PyInterpreterState *interp)
 {
-    int i;
-    for (i = 0; i < UCHAR_MAX + 1; i++)
-        Py_CLEAR(characters[i]);
-    Py_CLEAR(nullstring);
+    struct _Py_bytes_state *state = &interp->bytes;
+    if (bytes_create_empty_string_singleton(state) < 0) {
+        return _PyStatus_NO_MEMORY();
+    }
+    return _PyStatus_OK();
+}
+
+
+void
+_PyBytes_Fini(PyInterpreterState *interp)
+{
+    struct _Py_bytes_state* state = &interp->bytes;
+    for (int i = 0; i < UCHAR_MAX + 1; i++) {
+        Py_CLEAR(state->characters[i]);
+    }
+    Py_CLEAR(state->empty_string);
 }
 
 /*********************** Bytes Iterator ****************************/
@@ -3088,7 +3111,6 @@
 striter_next(striterobject *it)
 {
     PyBytesObject *seq;
-    PyObject *item;
 
     assert(it != NULL);
     seq = it->it_seq;
@@ -3097,11 +3119,8 @@
     assert(PyBytes_Check(seq));
 
     if (it->it_index < PyBytes_GET_SIZE(seq)) {
-        item = PyLong_FromLong(
-            (unsigned char)seq->ob_sval[it->it_index]);
-        if (item != NULL)
-            ++it->it_index;
-        return item;
+        return PyLong_FromLong(
+            (unsigned char)seq->ob_sval[it->it_index++]);
     }
 
     it->it_seq = NULL;
diff --git a/Objects/call.c b/Objects/call.c
index 61426c7..960c37e 100644
--- a/Objects/call.c
+++ b/Objects/call.c
@@ -1,11 +1,11 @@
 #include "Python.h"
-#include "pycore_call.h"
-#include "pycore_ceval.h"        // _PyEval_EvalFrame()
-#include "pycore_object.h"
-#include "pycore_pyerrors.h"
-#include "pycore_pystate.h"      // _PyThreadState_GET()
-#include "pycore_tupleobject.h"
-#include "frameobject.h"
+#include "pycore_call.h"          // _PyObject_CallNoArgTstate()
+#include "pycore_ceval.h"         // _PyEval_EvalFrame()
+#include "pycore_object.h"        // _PyObject_GC_TRACK()
+#include "pycore_pyerrors.h"      // _PyErr_Occurred()
+#include "pycore_pystate.h"       // _PyThreadState_GET()
+#include "pycore_tuple.h"         // _PyTuple_ITEMS()
+#include "frameobject.h"          // _PyFrame_New_NoTrack()
 
 
 static PyObject *const *
@@ -39,16 +39,16 @@
         if (!_PyErr_Occurred(tstate)) {
             if (callable)
                 _PyErr_Format(tstate, PyExc_SystemError,
-                              "%R returned NULL without setting an error",
+                              "%R returned NULL without setting an exception",
                               callable);
             else
                 _PyErr_Format(tstate, PyExc_SystemError,
-                              "%s returned NULL without setting an error",
+                              "%s returned NULL without setting an exception",
                               where);
 #ifdef Py_DEBUG
             /* Ensure that the bug is caught in debug mode.
                Py_FatalError() logs the SystemError exception raised above. */
-            Py_FatalError("a function returned NULL without setting an error");
+            Py_FatalError("a function returned NULL without setting an exception");
 #endif
             return NULL;
         }
@@ -60,17 +60,17 @@
             if (callable) {
                 _PyErr_FormatFromCauseTstate(
                     tstate, PyExc_SystemError,
-                    "%R returned a result with an error set", callable);
+                    "%R returned a result with an exception set", callable);
             }
             else {
                 _PyErr_FormatFromCauseTstate(
                     tstate, PyExc_SystemError,
-                    "%s returned a result with an error set", where);
+                    "%s returned a result with an exception set", where);
             }
 #ifdef Py_DEBUG
             /* Ensure that the bug is caught in debug mode.
                Py_FatalError() logs the SystemError exception raised above. */
-            Py_FatalError("a function returned a result with an error set");
+            Py_FatalError("a function returned a result with an exception set");
 #endif
             return NULL;
         }
@@ -79,6 +79,30 @@
 }
 
 
+int
+_Py_CheckSlotResult(PyObject *obj, const char *slot_name, int success)
+{
+    PyThreadState *tstate = _PyThreadState_GET();
+    if (!success) {
+        if (!_PyErr_Occurred(tstate)) {
+            _Py_FatalErrorFormat(__func__,
+                                 "Slot %s of type %s failed "
+                                 "without setting an exception",
+                                 slot_name, Py_TYPE(obj)->tp_name);
+        }
+    }
+    else {
+        if (_PyErr_Occurred(tstate)) {
+            _Py_FatalErrorFormat(__func__,
+                                 "Slot %s of type %s succeeded "
+                                 "with an exception set",
+                                 slot_name, Py_TYPE(obj)->tp_name);
+        }
+    }
+    return 1;
+}
+
+
 /* --- Core PyObject call functions ------------------------------- */
 
 /* Call a callable Python object without any arguments */
@@ -205,6 +229,7 @@
 PyVectorcall_Call(PyObject *callable, PyObject *tuple, PyObject *kwargs)
 {
     PyThreadState *tstate = _PyThreadState_GET();
+    vectorcallfunc func;
 
     /* get vectorcallfunc as in PyVectorcall_Function, but without
      * the Py_TPFLAGS_HAVE_VECTORCALL check */
@@ -215,7 +240,7 @@
                       Py_TYPE(callable)->tp_name);
         return NULL;
     }
-    vectorcallfunc func = *(vectorcallfunc *)(((char *)callable) + offset);
+    memcpy(&func, (char *) callable + offset, sizeof(func));
     if (func == NULL) {
         _PyErr_Format(tstate, PyExc_TypeError,
                       "'%.200s' object does not support vectorcall",
@@ -303,106 +328,24 @@
 
 /* --- PyFunction call functions ---------------------------------- */
 
-static PyObject* _Py_HOT_FUNCTION
-function_code_fastcall(PyThreadState *tstate, PyCodeObject *co,
-                       PyObject *const *args, Py_ssize_t nargs,
-                       PyObject *globals)
-{
-    assert(tstate != NULL);
-    assert(globals != NULL);
-
-    /* XXX Perhaps we should create a specialized
-       _PyFrame_New_NoTrack() that doesn't take locals, but does
-       take builtins without sanity checking them.
-       */
-    PyFrameObject *f = _PyFrame_New_NoTrack(tstate, co, globals, NULL);
-    if (f == NULL) {
-        return NULL;
-    }
-
-    PyObject **fastlocals = f->f_localsplus;
-
-    for (Py_ssize_t i = 0; i < nargs; i++) {
-        Py_INCREF(*args);
-        fastlocals[i] = *args++;
-    }
-    PyObject *result = _PyEval_EvalFrame(tstate, f, 0);
-
-    if (Py_REFCNT(f) > 1) {
-        Py_DECREF(f);
-        _PyObject_GC_TRACK(f);
-    }
-    else {
-        ++tstate->recursion_depth;
-        Py_DECREF(f);
-        --tstate->recursion_depth;
-    }
-    return result;
-}
-
-
 PyObject *
 _PyFunction_Vectorcall(PyObject *func, PyObject* const* stack,
                        size_t nargsf, PyObject *kwnames)
 {
     assert(PyFunction_Check(func));
-    assert(kwnames == NULL || PyTuple_CheckExact(kwnames));
-
+    PyFrameConstructor *f = PyFunction_AS_FRAME_CONSTRUCTOR(func);
     Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
     assert(nargs >= 0);
-    Py_ssize_t nkwargs = (kwnames == NULL) ? 0 : PyTuple_GET_SIZE(kwnames);
-    assert((nargs == 0 && nkwargs == 0) || stack != NULL);
-    /* kwnames must only contain strings and all keys must be unique */
-
     PyThreadState *tstate = _PyThreadState_GET();
-    PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
-    PyObject *globals = PyFunction_GET_GLOBALS(func);
-    PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
-
-    if (co->co_kwonlyargcount == 0 && nkwargs == 0 &&
-        (co->co_flags & ~PyCF_MASK) == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE))
-    {
-        if (argdefs == NULL && co->co_argcount == nargs) {
-            return function_code_fastcall(tstate, co, stack, nargs, globals);
-        }
-        else if (nargs == 0 && argdefs != NULL
-                 && co->co_argcount == PyTuple_GET_SIZE(argdefs)) {
-            /* function called with no arguments, but all parameters have
-               a default value: use default values as arguments .*/
-            stack = _PyTuple_ITEMS(argdefs);
-            return function_code_fastcall(tstate, co,
-                                          stack, PyTuple_GET_SIZE(argdefs),
-                                          globals);
-        }
-    }
-
-    PyObject *kwdefs = PyFunction_GET_KW_DEFAULTS(func);
-    PyObject *closure = PyFunction_GET_CLOSURE(func);
-    PyObject *name = ((PyFunctionObject *)func) -> func_name;
-    PyObject *qualname = ((PyFunctionObject *)func) -> func_qualname;
-
-    PyObject **d;
-    Py_ssize_t nd;
-    if (argdefs != NULL) {
-        d = _PyTuple_ITEMS(argdefs);
-        nd = PyTuple_GET_SIZE(argdefs);
-        assert(nd <= INT_MAX);
+    assert(nargs == 0 || stack != NULL);
+    if (((PyCodeObject *)f->fc_code)->co_flags & CO_OPTIMIZED) {
+        return _PyEval_Vector(tstate, f, NULL, stack, nargs, kwnames);
     }
     else {
-        d = NULL;
-        nd = 0;
+        return _PyEval_Vector(tstate, f, f->fc_globals, stack, nargs, kwnames);
     }
-    return _PyEval_EvalCode(tstate,
-                (PyObject*)co, globals, (PyObject *)NULL,
-                stack, nargs,
-                nkwargs ? _PyTuple_ITEMS(kwnames) : NULL,
-                stack + nargs,
-                nkwargs, 1,
-                d, (int)nd, kwdefs,
-                closure, name, qualname);
 }
 
-
 /* --- More complex call functions -------------------------------- */
 
 /* External interface to call any callable object.
diff --git a/Objects/capsule.c b/Objects/capsule.c
index ed24cc1..800a6c4 100644
--- a/Objects/capsule.c
+++ b/Objects/capsule.c
@@ -198,7 +198,7 @@
     void *return_value = NULL;
     char *trace;
     size_t name_length = (strlen(name) + 1) * sizeof(char);
-    char *name_dup = (char *)PyMem_MALLOC(name_length);
+    char *name_dup = (char *)PyMem_Malloc(name_length);
 
     if (!name_dup) {
         return PyErr_NoMemory();
@@ -247,7 +247,7 @@
 EXIT:
     Py_XDECREF(object);
     if (name_dup) {
-        PyMem_FREE(name_dup);
+        PyMem_Free(name_dup);
     }
     return return_value;
 }
@@ -260,7 +260,7 @@
     if (capsule->destructor) {
         capsule->destructor(o);
     }
-    PyObject_DEL(o);
+    PyObject_Free(o);
 }
 
 
diff --git a/Objects/classobject.c b/Objects/classobject.c
index fd9f875..af73be3 100644
--- a/Objects/classobject.c
+++ b/Objects/classobject.c
@@ -462,7 +462,7 @@
 static PyObject *
 instancemethod_call(PyObject *self, PyObject *arg, PyObject *kw)
 {
-    return PyObject_Call(PyMethod_GET_FUNCTION(self), arg, kw);
+    return PyObject_Call(PyInstanceMethod_GET_FUNCTION(self), arg, kw);
 }
 
 static PyObject *
diff --git a/Objects/clinic/bytearrayobject.c.h b/Objects/clinic/bytearrayobject.c.h
index 35ba1ff..1e3f197 100644
--- a/Objects/clinic/bytearrayobject.c.h
+++ b/Objects/clinic/bytearrayobject.c.h
@@ -2,6 +2,75 @@
 preserve
 [clinic start generated code]*/
 
+static int
+bytearray___init___impl(PyByteArrayObject *self, PyObject *arg,
+                        const char *encoding, const char *errors);
+
+static int
+bytearray___init__(PyObject *self, PyObject *args, PyObject *kwargs)
+{
+    int return_value = -1;
+    static const char * const _keywords[] = {"source", "encoding", "errors", NULL};
+    static _PyArg_Parser _parser = {NULL, _keywords, "bytearray", 0};
+    PyObject *argsbuf[3];
+    PyObject * const *fastargs;
+    Py_ssize_t nargs = PyTuple_GET_SIZE(args);
+    Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 0;
+    PyObject *arg = NULL;
+    const char *encoding = NULL;
+    const char *errors = NULL;
+
+    fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 3, 0, argsbuf);
+    if (!fastargs) {
+        goto exit;
+    }
+    if (!noptargs) {
+        goto skip_optional_pos;
+    }
+    if (fastargs[0]) {
+        arg = fastargs[0];
+        if (!--noptargs) {
+            goto skip_optional_pos;
+        }
+    }
+    if (fastargs[1]) {
+        if (!PyUnicode_Check(fastargs[1])) {
+            _PyArg_BadArgument("bytearray", "argument 'encoding'", "str", fastargs[1]);
+            goto exit;
+        }
+        Py_ssize_t encoding_length;
+        encoding = PyUnicode_AsUTF8AndSize(fastargs[1], &encoding_length);
+        if (encoding == NULL) {
+            goto exit;
+        }
+        if (strlen(encoding) != (size_t)encoding_length) {
+            PyErr_SetString(PyExc_ValueError, "embedded null character");
+            goto exit;
+        }
+        if (!--noptargs) {
+            goto skip_optional_pos;
+        }
+    }
+    if (!PyUnicode_Check(fastargs[2])) {
+        _PyArg_BadArgument("bytearray", "argument 'errors'", "str", fastargs[2]);
+        goto exit;
+    }
+    Py_ssize_t errors_length;
+    errors = PyUnicode_AsUTF8AndSize(fastargs[2], &errors_length);
+    if (errors == NULL) {
+        goto exit;
+    }
+    if (strlen(errors) != (size_t)errors_length) {
+        PyErr_SetString(PyExc_ValueError, "embedded null character");
+        goto exit;
+    }
+skip_optional_pos:
+    return_value = bytearray___init___impl((PyByteArrayObject *)self, arg, encoding, errors);
+
+exit:
+    return return_value;
+}
+
 PyDoc_STRVAR(bytearray_clear__doc__,
 "clear($self, /)\n"
 "--\n"
@@ -268,14 +337,9 @@
     if (nargs < 3) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[2]);
+        PyObject *iobj = _PyNumber_Index(args[2]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -346,14 +410,9 @@
             goto skip_optional_pos;
         }
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[1]);
+        PyObject *iobj = _PyNumber_Index(args[1]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -450,14 +509,9 @@
             goto skip_optional_pos;
         }
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[1]);
+        PyObject *iobj = _PyNumber_Index(args[1]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -519,14 +573,9 @@
     if (!_PyArg_CheckPositional("insert", nargs, 2, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[0]);
+        PyObject *iobj = _PyNumber_Index(args[0]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -617,14 +666,9 @@
     if (nargs < 1) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[0]);
+        PyObject *iobj = _PyNumber_Index(args[0]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -896,11 +940,6 @@
     if (!noptargs) {
         goto skip_optional_pos;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     keepends = _PyLong_AsInt(args[0]);
     if (keepends == -1 && PyErr_Occurred()) {
         goto exit;
@@ -951,7 +990,7 @@
 "hex($self, /, sep=<unrepresentable>, bytes_per_sep=1)\n"
 "--\n"
 "\n"
-"Create a str of hexadecimal numbers from a bytearray object.\n"
+"Create a string of hexadecimal numbers from a bytearray object.\n"
 "\n"
 "  sep\n"
 "    An optional single character or byte to separate hex bytes.\n"
@@ -1000,11 +1039,6 @@
             goto skip_optional_pos;
         }
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     bytes_per_sep = _PyLong_AsInt(args[1]);
     if (bytes_per_sep == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1058,11 +1092,6 @@
     if (nargs < 1) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     proto = _PyLong_AsInt(args[0]);
     if (proto == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1091,4 +1120,4 @@
 {
     return bytearray_sizeof_impl(self);
 }
-/*[clinic end generated code: output=b2919f76709e48dc input=a9049054013a1b77]*/
+/*[clinic end generated code: output=a82659f581e55629 input=a9049054013a1b77]*/
diff --git a/Objects/clinic/bytesobject.c.h b/Objects/clinic/bytesobject.c.h
index 063a377..9e365ce 100644
--- a/Objects/clinic/bytesobject.c.h
+++ b/Objects/clinic/bytesobject.c.h
@@ -46,14 +46,9 @@
             goto skip_optional_pos;
         }
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[1]);
+        PyObject *iobj = _PyNumber_Index(args[1]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -202,14 +197,9 @@
             goto skip_optional_pos;
         }
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[1]);
+        PyObject *iobj = _PyNumber_Index(args[1]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -493,14 +483,9 @@
     if (nargs < 3) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[2]);
+        PyObject *iobj = _PyNumber_Index(args[2]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -715,11 +700,6 @@
     if (!noptargs) {
         goto skip_optional_pos;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     keepends = _PyLong_AsInt(args[0]);
     if (keepends == -1 && PyErr_Occurred()) {
         goto exit;
@@ -770,7 +750,7 @@
 "hex($self, /, sep=<unrepresentable>, bytes_per_sep=1)\n"
 "--\n"
 "\n"
-"Create a str of hexadecimal numbers from a bytes object.\n"
+"Create a string of hexadecimal numbers from a bytes object.\n"
 "\n"
 "  sep\n"
 "    An optional single character or byte to separate hex bytes.\n"
@@ -819,11 +799,6 @@
             goto skip_optional_pos;
         }
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     bytes_per_sep = _PyLong_AsInt(args[1]);
     if (bytes_per_sep == -1 && PyErr_Occurred()) {
         goto exit;
@@ -834,4 +809,73 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=220388917d7bf751 input=a9049054013a1b77]*/
+
+static PyObject *
+bytes_new_impl(PyTypeObject *type, PyObject *x, const char *encoding,
+               const char *errors);
+
+static PyObject *
+bytes_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"source", "encoding", "errors", NULL};
+    static _PyArg_Parser _parser = {NULL, _keywords, "bytes", 0};
+    PyObject *argsbuf[3];
+    PyObject * const *fastargs;
+    Py_ssize_t nargs = PyTuple_GET_SIZE(args);
+    Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 0;
+    PyObject *x = NULL;
+    const char *encoding = NULL;
+    const char *errors = NULL;
+
+    fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 3, 0, argsbuf);
+    if (!fastargs) {
+        goto exit;
+    }
+    if (!noptargs) {
+        goto skip_optional_pos;
+    }
+    if (fastargs[0]) {
+        x = fastargs[0];
+        if (!--noptargs) {
+            goto skip_optional_pos;
+        }
+    }
+    if (fastargs[1]) {
+        if (!PyUnicode_Check(fastargs[1])) {
+            _PyArg_BadArgument("bytes", "argument 'encoding'", "str", fastargs[1]);
+            goto exit;
+        }
+        Py_ssize_t encoding_length;
+        encoding = PyUnicode_AsUTF8AndSize(fastargs[1], &encoding_length);
+        if (encoding == NULL) {
+            goto exit;
+        }
+        if (strlen(encoding) != (size_t)encoding_length) {
+            PyErr_SetString(PyExc_ValueError, "embedded null character");
+            goto exit;
+        }
+        if (!--noptargs) {
+            goto skip_optional_pos;
+        }
+    }
+    if (!PyUnicode_Check(fastargs[2])) {
+        _PyArg_BadArgument("bytes", "argument 'errors'", "str", fastargs[2]);
+        goto exit;
+    }
+    Py_ssize_t errors_length;
+    errors = PyUnicode_AsUTF8AndSize(fastargs[2], &errors_length);
+    if (errors == NULL) {
+        goto exit;
+    }
+    if (strlen(errors) != (size_t)errors_length) {
+        PyErr_SetString(PyExc_ValueError, "embedded null character");
+        goto exit;
+    }
+skip_optional_pos:
+    return_value = bytes_new_impl(type, x, encoding, errors);
+
+exit:
+    return return_value;
+}
+/*[clinic end generated code: output=b3f0ec2753246b9c input=a9049054013a1b77]*/
diff --git a/Objects/clinic/codeobject.c.h b/Objects/clinic/codeobject.c.h
index 1dd8227..bae2ab0 100644
--- a/Objects/clinic/codeobject.c.h
+++ b/Objects/clinic/codeobject.c.h
@@ -2,13 +2,149 @@
 preserve
 [clinic start generated code]*/
 
+PyDoc_STRVAR(code_new__doc__,
+"code(argcount, posonlyargcount, kwonlyargcount, nlocals, stacksize,\n"
+"     flags, codestring, constants, names, varnames, filename, name,\n"
+"     firstlineno, linetable, freevars=(), cellvars=(), /)\n"
+"--\n"
+"\n"
+"Create a code object.  Not for the faint of heart.");
+
+static PyObject *
+code_new_impl(PyTypeObject *type, int argcount, int posonlyargcount,
+              int kwonlyargcount, int nlocals, int stacksize, int flags,
+              PyObject *code, PyObject *consts, PyObject *names,
+              PyObject *varnames, PyObject *filename, PyObject *name,
+              int firstlineno, PyObject *linetable, PyObject *freevars,
+              PyObject *cellvars);
+
+static PyObject *
+code_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
+{
+    PyObject *return_value = NULL;
+    int argcount;
+    int posonlyargcount;
+    int kwonlyargcount;
+    int nlocals;
+    int stacksize;
+    int flags;
+    PyObject *code;
+    PyObject *consts;
+    PyObject *names;
+    PyObject *varnames;
+    PyObject *filename;
+    PyObject *name;
+    int firstlineno;
+    PyObject *linetable;
+    PyObject *freevars = NULL;
+    PyObject *cellvars = NULL;
+
+    if ((type == &PyCode_Type) &&
+        !_PyArg_NoKeywords("code", kwargs)) {
+        goto exit;
+    }
+    if (!_PyArg_CheckPositional("code", PyTuple_GET_SIZE(args), 14, 16)) {
+        goto exit;
+    }
+    argcount = _PyLong_AsInt(PyTuple_GET_ITEM(args, 0));
+    if (argcount == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    posonlyargcount = _PyLong_AsInt(PyTuple_GET_ITEM(args, 1));
+    if (posonlyargcount == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    kwonlyargcount = _PyLong_AsInt(PyTuple_GET_ITEM(args, 2));
+    if (kwonlyargcount == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    nlocals = _PyLong_AsInt(PyTuple_GET_ITEM(args, 3));
+    if (nlocals == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    stacksize = _PyLong_AsInt(PyTuple_GET_ITEM(args, 4));
+    if (stacksize == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    flags = _PyLong_AsInt(PyTuple_GET_ITEM(args, 5));
+    if (flags == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    if (!PyBytes_Check(PyTuple_GET_ITEM(args, 6))) {
+        _PyArg_BadArgument("code", "argument 7", "bytes", PyTuple_GET_ITEM(args, 6));
+        goto exit;
+    }
+    code = PyTuple_GET_ITEM(args, 6);
+    if (!PyTuple_Check(PyTuple_GET_ITEM(args, 7))) {
+        _PyArg_BadArgument("code", "argument 8", "tuple", PyTuple_GET_ITEM(args, 7));
+        goto exit;
+    }
+    consts = PyTuple_GET_ITEM(args, 7);
+    if (!PyTuple_Check(PyTuple_GET_ITEM(args, 8))) {
+        _PyArg_BadArgument("code", "argument 9", "tuple", PyTuple_GET_ITEM(args, 8));
+        goto exit;
+    }
+    names = PyTuple_GET_ITEM(args, 8);
+    if (!PyTuple_Check(PyTuple_GET_ITEM(args, 9))) {
+        _PyArg_BadArgument("code", "argument 10", "tuple", PyTuple_GET_ITEM(args, 9));
+        goto exit;
+    }
+    varnames = PyTuple_GET_ITEM(args, 9);
+    if (!PyUnicode_Check(PyTuple_GET_ITEM(args, 10))) {
+        _PyArg_BadArgument("code", "argument 11", "str", PyTuple_GET_ITEM(args, 10));
+        goto exit;
+    }
+    if (PyUnicode_READY(PyTuple_GET_ITEM(args, 10)) == -1) {
+        goto exit;
+    }
+    filename = PyTuple_GET_ITEM(args, 10);
+    if (!PyUnicode_Check(PyTuple_GET_ITEM(args, 11))) {
+        _PyArg_BadArgument("code", "argument 12", "str", PyTuple_GET_ITEM(args, 11));
+        goto exit;
+    }
+    if (PyUnicode_READY(PyTuple_GET_ITEM(args, 11)) == -1) {
+        goto exit;
+    }
+    name = PyTuple_GET_ITEM(args, 11);
+    firstlineno = _PyLong_AsInt(PyTuple_GET_ITEM(args, 12));
+    if (firstlineno == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    if (!PyBytes_Check(PyTuple_GET_ITEM(args, 13))) {
+        _PyArg_BadArgument("code", "argument 14", "bytes", PyTuple_GET_ITEM(args, 13));
+        goto exit;
+    }
+    linetable = PyTuple_GET_ITEM(args, 13);
+    if (PyTuple_GET_SIZE(args) < 15) {
+        goto skip_optional;
+    }
+    if (!PyTuple_Check(PyTuple_GET_ITEM(args, 14))) {
+        _PyArg_BadArgument("code", "argument 15", "tuple", PyTuple_GET_ITEM(args, 14));
+        goto exit;
+    }
+    freevars = PyTuple_GET_ITEM(args, 14);
+    if (PyTuple_GET_SIZE(args) < 16) {
+        goto skip_optional;
+    }
+    if (!PyTuple_Check(PyTuple_GET_ITEM(args, 15))) {
+        _PyArg_BadArgument("code", "argument 16", "tuple", PyTuple_GET_ITEM(args, 15));
+        goto exit;
+    }
+    cellvars = PyTuple_GET_ITEM(args, 15);
+skip_optional:
+    return_value = code_new_impl(type, argcount, posonlyargcount, kwonlyargcount, nlocals, stacksize, flags, code, consts, names, varnames, filename, name, firstlineno, linetable, freevars, cellvars);
+
+exit:
+    return return_value;
+}
+
 PyDoc_STRVAR(code_replace__doc__,
 "replace($self, /, *, co_argcount=-1, co_posonlyargcount=-1,\n"
 "        co_kwonlyargcount=-1, co_nlocals=-1, co_stacksize=-1,\n"
 "        co_flags=-1, co_firstlineno=-1, co_code=None, co_consts=None,\n"
 "        co_names=None, co_varnames=None, co_freevars=None,\n"
 "        co_cellvars=None, co_filename=None, co_name=None,\n"
-"        co_lnotab=None)\n"
+"        co_linetable=None)\n"
 "--\n"
 "\n"
 "Return a copy of the code object with new values for the specified fields.");
@@ -24,13 +160,13 @@
                   PyObject *co_consts, PyObject *co_names,
                   PyObject *co_varnames, PyObject *co_freevars,
                   PyObject *co_cellvars, PyObject *co_filename,
-                  PyObject *co_name, PyBytesObject *co_lnotab);
+                  PyObject *co_name, PyBytesObject *co_linetable);
 
 static PyObject *
 code_replace(PyCodeObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
 {
     PyObject *return_value = NULL;
-    static const char * const _keywords[] = {"co_argcount", "co_posonlyargcount", "co_kwonlyargcount", "co_nlocals", "co_stacksize", "co_flags", "co_firstlineno", "co_code", "co_consts", "co_names", "co_varnames", "co_freevars", "co_cellvars", "co_filename", "co_name", "co_lnotab", NULL};
+    static const char * const _keywords[] = {"co_argcount", "co_posonlyargcount", "co_kwonlyargcount", "co_nlocals", "co_stacksize", "co_flags", "co_firstlineno", "co_code", "co_consts", "co_names", "co_varnames", "co_freevars", "co_cellvars", "co_filename", "co_name", "co_linetable", NULL};
     static _PyArg_Parser _parser = {NULL, _keywords, "replace", 0};
     PyObject *argsbuf[16];
     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
@@ -49,7 +185,7 @@
     PyObject *co_cellvars = self->co_cellvars;
     PyObject *co_filename = self->co_filename;
     PyObject *co_name = self->co_name;
-    PyBytesObject *co_lnotab = (PyBytesObject *)self->co_lnotab;
+    PyBytesObject *co_linetable = (PyBytesObject *)self->co_linetable;
 
     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 0, 0, argsbuf);
     if (!args) {
@@ -59,11 +195,6 @@
         goto skip_optional_kwonly;
     }
     if (args[0]) {
-        if (PyFloat_Check(args[0])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         co_argcount = _PyLong_AsInt(args[0]);
         if (co_argcount == -1 && PyErr_Occurred()) {
             goto exit;
@@ -73,11 +204,6 @@
         }
     }
     if (args[1]) {
-        if (PyFloat_Check(args[1])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         co_posonlyargcount = _PyLong_AsInt(args[1]);
         if (co_posonlyargcount == -1 && PyErr_Occurred()) {
             goto exit;
@@ -87,11 +213,6 @@
         }
     }
     if (args[2]) {
-        if (PyFloat_Check(args[2])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         co_kwonlyargcount = _PyLong_AsInt(args[2]);
         if (co_kwonlyargcount == -1 && PyErr_Occurred()) {
             goto exit;
@@ -101,11 +222,6 @@
         }
     }
     if (args[3]) {
-        if (PyFloat_Check(args[3])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         co_nlocals = _PyLong_AsInt(args[3]);
         if (co_nlocals == -1 && PyErr_Occurred()) {
             goto exit;
@@ -115,11 +231,6 @@
         }
     }
     if (args[4]) {
-        if (PyFloat_Check(args[4])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         co_stacksize = _PyLong_AsInt(args[4]);
         if (co_stacksize == -1 && PyErr_Occurred()) {
             goto exit;
@@ -129,11 +240,6 @@
         }
     }
     if (args[5]) {
-        if (PyFloat_Check(args[5])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         co_flags = _PyLong_AsInt(args[5]);
         if (co_flags == -1 && PyErr_Occurred()) {
             goto exit;
@@ -143,11 +249,6 @@
         }
     }
     if (args[6]) {
-        if (PyFloat_Check(args[6])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         co_firstlineno = _PyLong_AsInt(args[6]);
         if (co_firstlineno == -1 && PyErr_Occurred()) {
             goto exit;
@@ -243,14 +344,14 @@
         }
     }
     if (!PyBytes_Check(args[15])) {
-        _PyArg_BadArgument("replace", "argument 'co_lnotab'", "bytes", args[15]);
+        _PyArg_BadArgument("replace", "argument 'co_linetable'", "bytes", args[15]);
         goto exit;
     }
-    co_lnotab = (PyBytesObject *)args[15];
+    co_linetable = (PyBytesObject *)args[15];
 skip_optional_kwonly:
-    return_value = code_replace_impl(self, co_argcount, co_posonlyargcount, co_kwonlyargcount, co_nlocals, co_stacksize, co_flags, co_firstlineno, co_code, co_consts, co_names, co_varnames, co_freevars, co_cellvars, co_filename, co_name, co_lnotab);
+    return_value = code_replace_impl(self, co_argcount, co_posonlyargcount, co_kwonlyargcount, co_nlocals, co_stacksize, co_flags, co_firstlineno, co_code, co_consts, co_names, co_varnames, co_freevars, co_cellvars, co_filename, co_name, co_linetable);
 
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=27fe34e82106b220 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=e3091c7baaaaa420 input=a9049054013a1b77]*/
diff --git a/Objects/clinic/complexobject.c.h b/Objects/clinic/complexobject.c.h
index 8caa910..557fbf9 100644
--- a/Objects/clinic/complexobject.c.h
+++ b/Objects/clinic/complexobject.c.h
@@ -2,6 +2,73 @@
 preserve
 [clinic start generated code]*/
 
+PyDoc_STRVAR(complex_conjugate__doc__,
+"conjugate($self, /)\n"
+"--\n"
+"\n"
+"Return the complex conjugate of its argument. (3-4j).conjugate() == 3+4j.");
+
+#define COMPLEX_CONJUGATE_METHODDEF    \
+    {"conjugate", (PyCFunction)complex_conjugate, METH_NOARGS, complex_conjugate__doc__},
+
+static PyObject *
+complex_conjugate_impl(PyComplexObject *self);
+
+static PyObject *
+complex_conjugate(PyComplexObject *self, PyObject *Py_UNUSED(ignored))
+{
+    return complex_conjugate_impl(self);
+}
+
+PyDoc_STRVAR(complex___getnewargs____doc__,
+"__getnewargs__($self, /)\n"
+"--\n"
+"\n");
+
+#define COMPLEX___GETNEWARGS___METHODDEF    \
+    {"__getnewargs__", (PyCFunction)complex___getnewargs__, METH_NOARGS, complex___getnewargs____doc__},
+
+static PyObject *
+complex___getnewargs___impl(PyComplexObject *self);
+
+static PyObject *
+complex___getnewargs__(PyComplexObject *self, PyObject *Py_UNUSED(ignored))
+{
+    return complex___getnewargs___impl(self);
+}
+
+PyDoc_STRVAR(complex___format____doc__,
+"__format__($self, format_spec, /)\n"
+"--\n"
+"\n"
+"Convert to a string according to format_spec.");
+
+#define COMPLEX___FORMAT___METHODDEF    \
+    {"__format__", (PyCFunction)complex___format__, METH_O, complex___format____doc__},
+
+static PyObject *
+complex___format___impl(PyComplexObject *self, PyObject *format_spec);
+
+static PyObject *
+complex___format__(PyComplexObject *self, PyObject *arg)
+{
+    PyObject *return_value = NULL;
+    PyObject *format_spec;
+
+    if (!PyUnicode_Check(arg)) {
+        _PyArg_BadArgument("__format__", "argument", "str", arg);
+        goto exit;
+    }
+    if (PyUnicode_READY(arg) == -1) {
+        goto exit;
+    }
+    format_spec = arg;
+    return_value = complex___format___impl(self, format_spec);
+
+exit:
+    return return_value;
+}
+
 PyDoc_STRVAR(complex_new__doc__,
 "complex(real=0, imag=0)\n"
 "--\n"
@@ -23,7 +90,7 @@
     PyObject * const *fastargs;
     Py_ssize_t nargs = PyTuple_GET_SIZE(args);
     Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 0;
-    PyObject *r = _PyLong_Zero;
+    PyObject *r = NULL;
     PyObject *i = NULL;
 
     fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 2, 0, argsbuf);
@@ -46,4 +113,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=a0fe23fdbdc9b06b input=a9049054013a1b77]*/
+/*[clinic end generated code: output=056cac3226d94967 input=a9049054013a1b77]*/
diff --git a/Objects/clinic/dictobject.c.h b/Objects/clinic/dictobject.c.h
index 7395e3b..beb3f36 100644
--- a/Objects/clinic/dictobject.c.h
+++ b/Objects/clinic/dictobject.c.h
@@ -122,7 +122,8 @@
 "\n"
 "D.pop(k[,d]) -> v, remove specified key and return the corresponding value.\n"
 "\n"
-"If key is not found, default is returned if given, otherwise KeyError is raised");
+"If the key is not found, return the default if given; otherwise,\n"
+"raise a KeyError.");
 
 #define DICT_POP_METHODDEF    \
     {"pop", (PyCFunction)(void(*)(void))dict_pop, METH_FASTCALL, dict_pop__doc__},
@@ -190,4 +191,4 @@
 {
     return dict___reversed___impl(self);
 }
-/*[clinic end generated code: output=4d98145508da8fa3 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=7b77c16e43d6735a input=a9049054013a1b77]*/
diff --git a/Objects/clinic/floatobject.c.h b/Objects/clinic/floatobject.c.h
index b755483..494c0a2 100644
--- a/Objects/clinic/floatobject.c.h
+++ b/Objects/clinic/floatobject.c.h
@@ -206,7 +206,7 @@
 float_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
 {
     PyObject *return_value = NULL;
-    PyObject *x = _PyLong_Zero;
+    PyObject *x = NULL;
 
     if ((type == &PyFloat_Type) &&
         !_PyArg_NoKeywords("float", kwargs)) {
@@ -289,8 +289,8 @@
     return return_value;
 }
 
-PyDoc_STRVAR(float___set_format____doc__,
-"__set_format__($type, typestr, fmt, /)\n"
+PyDoc_STRVAR(float___setformat____doc__,
+"__setformat__($type, typestr, fmt, /)\n"
 "--\n"
 "\n"
 "You probably don\'t want to use this function.\n"
@@ -307,25 +307,25 @@
 "Override the automatic determination of C-level floating point type.\n"
 "This affects how floats are converted to and from binary strings.");
 
-#define FLOAT___SET_FORMAT___METHODDEF    \
-    {"__set_format__", (PyCFunction)(void(*)(void))float___set_format__, METH_FASTCALL|METH_CLASS, float___set_format____doc__},
+#define FLOAT___SETFORMAT___METHODDEF    \
+    {"__setformat__", (PyCFunction)(void(*)(void))float___setformat__, METH_FASTCALL|METH_CLASS, float___setformat____doc__},
 
 static PyObject *
-float___set_format___impl(PyTypeObject *type, const char *typestr,
-                          const char *fmt);
+float___setformat___impl(PyTypeObject *type, const char *typestr,
+                         const char *fmt);
 
 static PyObject *
-float___set_format__(PyTypeObject *type, PyObject *const *args, Py_ssize_t nargs)
+float___setformat__(PyTypeObject *type, PyObject *const *args, Py_ssize_t nargs)
 {
     PyObject *return_value = NULL;
     const char *typestr;
     const char *fmt;
 
-    if (!_PyArg_CheckPositional("__set_format__", nargs, 2, 2)) {
+    if (!_PyArg_CheckPositional("__setformat__", nargs, 2, 2)) {
         goto exit;
     }
     if (!PyUnicode_Check(args[0])) {
-        _PyArg_BadArgument("__set_format__", "argument 1", "str", args[0]);
+        _PyArg_BadArgument("__setformat__", "argument 1", "str", args[0]);
         goto exit;
     }
     Py_ssize_t typestr_length;
@@ -338,7 +338,7 @@
         goto exit;
     }
     if (!PyUnicode_Check(args[1])) {
-        _PyArg_BadArgument("__set_format__", "argument 2", "str", args[1]);
+        _PyArg_BadArgument("__setformat__", "argument 2", "str", args[1]);
         goto exit;
     }
     Py_ssize_t fmt_length;
@@ -350,7 +350,7 @@
         PyErr_SetString(PyExc_ValueError, "embedded null character");
         goto exit;
     }
-    return_value = float___set_format___impl(type, typestr, fmt);
+    return_value = float___setformat___impl(type, typestr, fmt);
 
 exit:
     return return_value;
@@ -387,4 +387,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=25fbbe253f44e2df input=a9049054013a1b77]*/
+/*[clinic end generated code: output=f4aae29054273cb5 input=a9049054013a1b77]*/
diff --git a/Objects/clinic/listobject.c.h b/Objects/clinic/listobject.c.h
index ed137c9..01e31d7 100644
--- a/Objects/clinic/listobject.c.h
+++ b/Objects/clinic/listobject.c.h
@@ -24,14 +24,9 @@
     if (!_PyArg_CheckPositional("insert", nargs, 2, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[0]);
+        PyObject *iobj = _PyNumber_Index(args[0]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -128,14 +123,9 @@
     if (nargs < 1) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[0]);
+        PyObject *iobj = _PyNumber_Index(args[0]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -196,11 +186,6 @@
             goto skip_optional_kwonly;
         }
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     reverse = _PyLong_AsInt(args[1]);
     if (reverse == -1 && PyErr_Occurred()) {
         goto exit;
@@ -367,4 +352,4 @@
 {
     return list___reversed___impl(self);
 }
-/*[clinic end generated code: output=1ff61490c091d165 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=0063aad535edf62d input=a9049054013a1b77]*/
diff --git a/Objects/clinic/longobject.c.h b/Objects/clinic/longobject.c.h
index 27e8dfe..4bd47b1 100644
--- a/Objects/clinic/longobject.c.h
+++ b/Objects/clinic/longobject.c.h
@@ -87,6 +87,40 @@
     return return_value;
 }
 
+PyDoc_STRVAR(int___round____doc__,
+"__round__($self, ndigits=<unrepresentable>, /)\n"
+"--\n"
+"\n"
+"Rounding an Integral returns itself.\n"
+"\n"
+"Rounding with an ndigits argument also returns an integer.");
+
+#define INT___ROUND___METHODDEF    \
+    {"__round__", (PyCFunction)(void(*)(void))int___round__, METH_FASTCALL, int___round____doc__},
+
+static PyObject *
+int___round___impl(PyObject *self, PyObject *o_ndigits);
+
+static PyObject *
+int___round__(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    PyObject *o_ndigits = NULL;
+
+    if (!_PyArg_CheckPositional("__round__", nargs, 0, 1)) {
+        goto exit;
+    }
+    if (nargs < 1) {
+        goto skip_optional;
+    }
+    o_ndigits = args[0];
+skip_optional:
+    return_value = int___round___impl(self, o_ndigits);
+
+exit:
+    return return_value;
+}
+
 PyDoc_STRVAR(int___sizeof____doc__,
 "__sizeof__($self, /)\n"
 "--\n"
@@ -138,6 +172,31 @@
     return int_bit_length_impl(self);
 }
 
+PyDoc_STRVAR(int_bit_count__doc__,
+"bit_count($self, /)\n"
+"--\n"
+"\n"
+"Number of ones in the binary representation of the absolute value of self.\n"
+"\n"
+"Also known as the population count.\n"
+"\n"
+">>> bin(13)\n"
+"\'0b1101\'\n"
+">>> (13).bit_count()\n"
+"3");
+
+#define INT_BIT_COUNT_METHODDEF    \
+    {"bit_count", (PyCFunction)int_bit_count, METH_NOARGS, int_bit_count__doc__},
+
+static PyObject *
+int_bit_count_impl(PyObject *self);
+
+static PyObject *
+int_bit_count(PyObject *self, PyObject *Py_UNUSED(ignored))
+{
+    return int_bit_count_impl(self);
+}
+
 PyDoc_STRVAR(int_as_integer_ratio__doc__,
 "as_integer_ratio($self, /)\n"
 "--\n"
@@ -209,14 +268,9 @@
     if (!args) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[0]);
+        PyObject *iobj = _PyNumber_Index(args[0]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -313,4 +367,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=77bc3b2615822cb8 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=ea18e51af5b53591 input=a9049054013a1b77]*/
diff --git a/Objects/clinic/memoryobject.c.h b/Objects/clinic/memoryobject.c.h
index 75ac201..4a682f6 100644
--- a/Objects/clinic/memoryobject.c.h
+++ b/Objects/clinic/memoryobject.c.h
@@ -2,6 +2,198 @@
 preserve
 [clinic start generated code]*/
 
+PyDoc_STRVAR(memoryview__doc__,
+"memoryview(object)\n"
+"--\n"
+"\n"
+"Create a new memoryview object which references the given object.");
+
+static PyObject *
+memoryview_impl(PyTypeObject *type, PyObject *object);
+
+static PyObject *
+memoryview(PyTypeObject *type, PyObject *args, PyObject *kwargs)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"object", NULL};
+    static _PyArg_Parser _parser = {NULL, _keywords, "memoryview", 0};
+    PyObject *argsbuf[1];
+    PyObject * const *fastargs;
+    Py_ssize_t nargs = PyTuple_GET_SIZE(args);
+    PyObject *object;
+
+    fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 1, 0, argsbuf);
+    if (!fastargs) {
+        goto exit;
+    }
+    object = fastargs[0];
+    return_value = memoryview_impl(type, object);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(memoryview_release__doc__,
+"release($self, /)\n"
+"--\n"
+"\n"
+"Release the underlying buffer exposed by the memoryview object.");
+
+#define MEMORYVIEW_RELEASE_METHODDEF    \
+    {"release", (PyCFunction)memoryview_release, METH_NOARGS, memoryview_release__doc__},
+
+static PyObject *
+memoryview_release_impl(PyMemoryViewObject *self);
+
+static PyObject *
+memoryview_release(PyMemoryViewObject *self, PyObject *Py_UNUSED(ignored))
+{
+    return memoryview_release_impl(self);
+}
+
+PyDoc_STRVAR(memoryview_cast__doc__,
+"cast($self, /, format, shape=<unrepresentable>)\n"
+"--\n"
+"\n"
+"Cast a memoryview to a new format or shape.");
+
+#define MEMORYVIEW_CAST_METHODDEF    \
+    {"cast", (PyCFunction)(void(*)(void))memoryview_cast, METH_FASTCALL|METH_KEYWORDS, memoryview_cast__doc__},
+
+static PyObject *
+memoryview_cast_impl(PyMemoryViewObject *self, PyObject *format,
+                     PyObject *shape);
+
+static PyObject *
+memoryview_cast(PyMemoryViewObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"format", "shape", NULL};
+    static _PyArg_Parser _parser = {NULL, _keywords, "cast", 0};
+    PyObject *argsbuf[2];
+    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
+    PyObject *format;
+    PyObject *shape = NULL;
+
+    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
+    if (!args) {
+        goto exit;
+    }
+    if (!PyUnicode_Check(args[0])) {
+        _PyArg_BadArgument("cast", "argument 'format'", "str", args[0]);
+        goto exit;
+    }
+    if (PyUnicode_READY(args[0]) == -1) {
+        goto exit;
+    }
+    format = args[0];
+    if (!noptargs) {
+        goto skip_optional_pos;
+    }
+    shape = args[1];
+skip_optional_pos:
+    return_value = memoryview_cast_impl(self, format, shape);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(memoryview_toreadonly__doc__,
+"toreadonly($self, /)\n"
+"--\n"
+"\n"
+"Return a readonly version of the memoryview.");
+
+#define MEMORYVIEW_TOREADONLY_METHODDEF    \
+    {"toreadonly", (PyCFunction)memoryview_toreadonly, METH_NOARGS, memoryview_toreadonly__doc__},
+
+static PyObject *
+memoryview_toreadonly_impl(PyMemoryViewObject *self);
+
+static PyObject *
+memoryview_toreadonly(PyMemoryViewObject *self, PyObject *Py_UNUSED(ignored))
+{
+    return memoryview_toreadonly_impl(self);
+}
+
+PyDoc_STRVAR(memoryview_tolist__doc__,
+"tolist($self, /)\n"
+"--\n"
+"\n"
+"Return the data in the buffer as a list of elements.");
+
+#define MEMORYVIEW_TOLIST_METHODDEF    \
+    {"tolist", (PyCFunction)memoryview_tolist, METH_NOARGS, memoryview_tolist__doc__},
+
+static PyObject *
+memoryview_tolist_impl(PyMemoryViewObject *self);
+
+static PyObject *
+memoryview_tolist(PyMemoryViewObject *self, PyObject *Py_UNUSED(ignored))
+{
+    return memoryview_tolist_impl(self);
+}
+
+PyDoc_STRVAR(memoryview_tobytes__doc__,
+"tobytes($self, /, order=\'C\')\n"
+"--\n"
+"\n"
+"Return the data in the buffer as a byte string.\n"
+"\n"
+"Order can be {\'C\', \'F\', \'A\'}. When order is \'C\' or \'F\', the data of the\n"
+"original array is converted to C or Fortran order. For contiguous views,\n"
+"\'A\' returns an exact copy of the physical memory. In particular, in-memory\n"
+"Fortran order is preserved. For non-contiguous views, the data is converted\n"
+"to C first. order=None is the same as order=\'C\'.");
+
+#define MEMORYVIEW_TOBYTES_METHODDEF    \
+    {"tobytes", (PyCFunction)(void(*)(void))memoryview_tobytes, METH_FASTCALL|METH_KEYWORDS, memoryview_tobytes__doc__},
+
+static PyObject *
+memoryview_tobytes_impl(PyMemoryViewObject *self, const char *order);
+
+static PyObject *
+memoryview_tobytes(PyMemoryViewObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"order", NULL};
+    static _PyArg_Parser _parser = {NULL, _keywords, "tobytes", 0};
+    PyObject *argsbuf[1];
+    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
+    const char *order = NULL;
+
+    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
+    if (!args) {
+        goto exit;
+    }
+    if (!noptargs) {
+        goto skip_optional_pos;
+    }
+    if (args[0] == Py_None) {
+        order = NULL;
+    }
+    else if (PyUnicode_Check(args[0])) {
+        Py_ssize_t order_length;
+        order = PyUnicode_AsUTF8AndSize(args[0], &order_length);
+        if (order == NULL) {
+            goto exit;
+        }
+        if (strlen(order) != (size_t)order_length) {
+            PyErr_SetString(PyExc_ValueError, "embedded null character");
+            goto exit;
+        }
+    }
+    else {
+        _PyArg_BadArgument("tobytes", "argument 'order'", "str or None", args[0]);
+        goto exit;
+    }
+skip_optional_pos:
+    return_value = memoryview_tobytes_impl(self, order);
+
+exit:
+    return return_value;
+}
+
 PyDoc_STRVAR(memoryview_hex__doc__,
 "hex($self, /, sep=<unrepresentable>, bytes_per_sep=1)\n"
 "--\n"
@@ -56,11 +248,6 @@
             goto skip_optional_pos;
         }
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     bytes_per_sep = _PyLong_AsInt(args[1]);
     if (bytes_per_sep == -1 && PyErr_Occurred()) {
         goto exit;
@@ -71,4 +258,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=ee265a73f68b0077 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=1b879bb934d18c66 input=a9049054013a1b77]*/
diff --git a/Objects/clinic/odictobject.c.h b/Objects/clinic/odictobject.c.h
index f43bc14..a3ab9ea 100644
--- a/Objects/clinic/odictobject.c.h
+++ b/Objects/clinic/odictobject.c.h
@@ -83,6 +83,49 @@
     return return_value;
 }
 
+PyDoc_STRVAR(OrderedDict_pop__doc__,
+"pop($self, /, key, default=<unrepresentable>)\n"
+"--\n"
+"\n"
+"od.pop(key[,default]) -> v, remove specified key and return the corresponding value.\n"
+"\n"
+"If the key is not found, return the default if given; otherwise,\n"
+"raise a KeyError.");
+
+#define ORDEREDDICT_POP_METHODDEF    \
+    {"pop", (PyCFunction)(void(*)(void))OrderedDict_pop, METH_FASTCALL|METH_KEYWORDS, OrderedDict_pop__doc__},
+
+static PyObject *
+OrderedDict_pop_impl(PyODictObject *self, PyObject *key,
+                     PyObject *default_value);
+
+static PyObject *
+OrderedDict_pop(PyODictObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"key", "default", NULL};
+    static _PyArg_Parser _parser = {NULL, _keywords, "pop", 0};
+    PyObject *argsbuf[2];
+    Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
+    PyObject *key;
+    PyObject *default_value = NULL;
+
+    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
+    if (!args) {
+        goto exit;
+    }
+    key = args[0];
+    if (!noptargs) {
+        goto skip_optional_pos;
+    }
+    default_value = args[1];
+skip_optional_pos:
+    return_value = OrderedDict_pop_impl(self, key, default_value);
+
+exit:
+    return return_value;
+}
+
 PyDoc_STRVAR(OrderedDict_popitem__doc__,
 "popitem($self, /, last=True)\n"
 "--\n"
@@ -168,4 +211,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=8eb1296df9142908 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=e0afaad5b4bb47fe input=a9049054013a1b77]*/
diff --git a/Objects/clinic/typeobject.c.h b/Objects/clinic/typeobject.c.h
index 357eb44..8c70d76 100644
--- a/Objects/clinic/typeobject.c.h
+++ b/Objects/clinic/typeobject.c.h
@@ -166,11 +166,6 @@
     PyObject *return_value = NULL;
     int protocol;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     protocol = _PyLong_AsInt(arg);
     if (protocol == -1 && PyErr_Occurred()) {
         goto exit;
@@ -248,4 +243,4 @@
 {
     return object___dir___impl(self);
 }
-/*[clinic end generated code: output=7a6d272d282308f3 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=b4fb62939b08baf9 input=a9049054013a1b77]*/
diff --git a/Objects/clinic/unicodeobject.c.h b/Objects/clinic/unicodeobject.c.h
index cf81df4..9ef8ce2 100644
--- a/Objects/clinic/unicodeobject.c.h
+++ b/Objects/clinic/unicodeobject.c.h
@@ -86,14 +86,9 @@
     if (!_PyArg_CheckPositional("center", nargs, 1, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[0]);
+        PyObject *iobj = _PyNumber_Index(args[0]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -224,11 +219,6 @@
     if (!noptargs) {
         goto skip_optional_pos;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     tabsize = _PyLong_AsInt(args[0]);
     if (tabsize == -1 && PyErr_Occurred()) {
         goto exit;
@@ -530,14 +520,9 @@
     if (!_PyArg_CheckPositional("ljust", nargs, 1, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[0]);
+        PyObject *iobj = _PyNumber_Index(args[0]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -730,14 +715,9 @@
     if (nargs < 3) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[2]);
+        PyObject *iobj = _PyNumber_Index(args[2]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -849,14 +829,9 @@
     if (!_PyArg_CheckPositional("rjust", nargs, 1, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[0]);
+        PyObject *iobj = _PyNumber_Index(args[0]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -923,14 +898,9 @@
             goto skip_optional_pos;
         }
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[1]);
+        PyObject *iobj = _PyNumber_Index(args[1]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -1025,14 +995,9 @@
             goto skip_optional_pos;
         }
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[1]);
+        PyObject *iobj = _PyNumber_Index(args[1]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -1081,11 +1046,6 @@
     if (!noptargs) {
         goto skip_optional_pos;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     keepends = _PyLong_AsInt(args[0]);
     if (keepends == -1 && PyErr_Occurred()) {
         goto exit;
@@ -1231,14 +1191,9 @@
     PyObject *return_value = NULL;
     Py_ssize_t width;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(arg);
+        PyObject *iobj = _PyNumber_Index(arg);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -1303,4 +1258,73 @@
 {
     return unicode_sizeof_impl(self);
 }
-/*[clinic end generated code: output=b91233f3722643be input=a9049054013a1b77]*/
+
+static PyObject *
+unicode_new_impl(PyTypeObject *type, PyObject *x, const char *encoding,
+                 const char *errors);
+
+static PyObject *
+unicode_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
+{
+    PyObject *return_value = NULL;
+    static const char * const _keywords[] = {"object", "encoding", "errors", NULL};
+    static _PyArg_Parser _parser = {NULL, _keywords, "str", 0};
+    PyObject *argsbuf[3];
+    PyObject * const *fastargs;
+    Py_ssize_t nargs = PyTuple_GET_SIZE(args);
+    Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 0;
+    PyObject *x = NULL;
+    const char *encoding = NULL;
+    const char *errors = NULL;
+
+    fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 3, 0, argsbuf);
+    if (!fastargs) {
+        goto exit;
+    }
+    if (!noptargs) {
+        goto skip_optional_pos;
+    }
+    if (fastargs[0]) {
+        x = fastargs[0];
+        if (!--noptargs) {
+            goto skip_optional_pos;
+        }
+    }
+    if (fastargs[1]) {
+        if (!PyUnicode_Check(fastargs[1])) {
+            _PyArg_BadArgument("str", "argument 'encoding'", "str", fastargs[1]);
+            goto exit;
+        }
+        Py_ssize_t encoding_length;
+        encoding = PyUnicode_AsUTF8AndSize(fastargs[1], &encoding_length);
+        if (encoding == NULL) {
+            goto exit;
+        }
+        if (strlen(encoding) != (size_t)encoding_length) {
+            PyErr_SetString(PyExc_ValueError, "embedded null character");
+            goto exit;
+        }
+        if (!--noptargs) {
+            goto skip_optional_pos;
+        }
+    }
+    if (!PyUnicode_Check(fastargs[2])) {
+        _PyArg_BadArgument("str", "argument 'errors'", "str", fastargs[2]);
+        goto exit;
+    }
+    Py_ssize_t errors_length;
+    errors = PyUnicode_AsUTF8AndSize(fastargs[2], &errors_length);
+    if (errors == NULL) {
+        goto exit;
+    }
+    if (strlen(errors) != (size_t)errors_length) {
+        PyErr_SetString(PyExc_ValueError, "embedded null character");
+        goto exit;
+    }
+skip_optional_pos:
+    return_value = unicode_new_impl(type, x, encoding, errors);
+
+exit:
+    return return_value;
+}
+/*[clinic end generated code: output=f10cf85d3935b3b7 input=a9049054013a1b77]*/
diff --git a/Objects/codeobject.c b/Objects/codeobject.c
index 7376359..976cec5 100644
--- a/Objects/codeobject.c
+++ b/Objects/codeobject.c
@@ -4,10 +4,10 @@
 #include "code.h"
 #include "opcode.h"
 #include "structmember.h"         // PyMemberDef
-#include "pycore_code.h"
+#include "pycore_code.h"          // _PyOpcache
 #include "pycore_interp.h"        // PyInterpreterState.co_extra_freefuncs
 #include "pycore_pystate.h"       // _PyInterpreterState_GET()
-#include "pycore_tupleobject.h"
+#include "pycore_tuple.h"         // _PyTuple_ITEMS()
 #include "clinic/codeobject.c.h"
 
 /* Holder for co_extra information */
@@ -119,7 +119,7 @@
                           PyObject *code, PyObject *consts, PyObject *names,
                           PyObject *varnames, PyObject *freevars, PyObject *cellvars,
                           PyObject *filename, PyObject *name, int firstlineno,
-                          PyObject *lnotab)
+                          PyObject *linetable)
 {
     PyCodeObject *co;
     Py_ssize_t *cell2arg = NULL;
@@ -137,7 +137,7 @@
         cellvars == NULL || !PyTuple_Check(cellvars) ||
         name == NULL || !PyUnicode_Check(name) ||
         filename == NULL || !PyUnicode_Check(filename) ||
-        lnotab == NULL || !PyBytes_Check(lnotab)) {
+        linetable == NULL || !PyBytes_Check(linetable)) {
         PyErr_BadInternalCall();
         return NULL;
     }
@@ -166,6 +166,14 @@
         return NULL;
     }
 
+    /* Make sure that code is indexable with an int, this is
+       a long running assumption in ceval.c and many parts of
+       the interpreter. */
+    if (PyBytes_GET_SIZE(code) > INT_MAX) {
+        PyErr_SetString(PyExc_OverflowError, "co_code larger than INT_MAX");
+        return NULL;
+    }
+
     /* Check for any inner or outer closure references */
     n_cellvars = PyTuple_GET_SIZE(cellvars);
     if (!n_cellvars && !PyTuple_GET_SIZE(freevars)) {
@@ -205,7 +213,7 @@
                 PyObject *arg = PyTuple_GET_ITEM(varnames, j);
                 int cmp = PyUnicode_Compare(cell, arg);
                 if (cmp == -1 && PyErr_Occurred()) {
-                    PyMem_FREE(cell2arg);
+                    PyMem_Free(cell2arg);
                     return NULL;
                 }
                 if (cmp == 0) {
@@ -216,14 +224,14 @@
             }
         }
         if (!used_cell2arg) {
-            PyMem_FREE(cell2arg);
+            PyMem_Free(cell2arg);
             cell2arg = NULL;
         }
     }
     co = PyObject_New(PyCodeObject, &PyCode_Type);
     if (co == NULL) {
         if (cell2arg)
-            PyMem_FREE(cell2arg);
+            PyMem_Free(cell2arg);
         return NULL;
     }
     co->co_argcount = argcount;
@@ -250,8 +258,8 @@
     Py_INCREF(name);
     co->co_name = name;
     co->co_firstlineno = firstlineno;
-    Py_INCREF(lnotab);
-    co->co_lnotab = lnotab;
+    Py_INCREF(linetable);
+    co->co_linetable = linetable;
     co->co_zombieframe = NULL;
     co->co_weakreflist = NULL;
     co->co_extra = NULL;
@@ -269,12 +277,12 @@
            PyObject *code, PyObject *consts, PyObject *names,
            PyObject *varnames, PyObject *freevars, PyObject *cellvars,
            PyObject *filename, PyObject *name, int firstlineno,
-           PyObject *lnotab)
+           PyObject *linetable)
 {
     return PyCode_NewWithPosOnlyArgs(argcount, 0, kwonlyargcount, nlocals,
                                      stacksize, flags, code, consts, names,
                                      varnames, freevars, cellvars, filename,
-                                     name, firstlineno, lnotab);
+                                     name, firstlineno, linetable);
 }
 
 int
@@ -286,15 +294,15 @@
         return -1;
     }
 
-    _Py_CODEUNIT *opcodes = (_Py_CODEUNIT*)PyBytes_AS_STRING(co->co_code);
+    const _Py_CODEUNIT *opcodes = (_Py_CODEUNIT*)PyBytes_AS_STRING(co->co_code);
     Py_ssize_t opts = 0;
 
     for (Py_ssize_t i = 0; i < co_size;) {
         unsigned char opcode = _Py_OPCODE(opcodes[i]);
         i++;  // 'i' is now aligned to (next_instr - first_instr)
 
-        // TODO: LOAD_METHOD, LOAD_ATTR
-        if (opcode == LOAD_GLOBAL) {
+        // TODO: LOAD_METHOD
+        if (opcode == LOAD_GLOBAL || opcode == LOAD_ATTR) {
             opts++;
             co->co_opcache_map[i] = (unsigned char)opts;
             if (opts > 254) {
@@ -306,12 +314,12 @@
     if (opts) {
         co->co_opcache = (_PyOpcache *)PyMem_Calloc(opts, sizeof(_PyOpcache));
         if (co->co_opcache == NULL) {
-            PyMem_FREE(co->co_opcache_map);
+            PyMem_Free(co->co_opcache_map);
             return -1;
         }
     }
     else {
-        PyMem_FREE(co->co_opcache_map);
+        PyMem_Free(co->co_opcache_map);
         co->co_opcache_map = NULL;
         co->co_opcache = NULL;
     }
@@ -361,7 +369,7 @@
                 filename_ob,                    /* filename */
                 funcname_ob,                    /* name */
                 firstlineno,                    /* firstlineno */
-                emptystring                     /* lnotab */
+                emptystring                     /* linetable */
                 );
 
 failed:
@@ -387,11 +395,89 @@
     {"co_cellvars",     T_OBJECT,       OFF(co_cellvars),        READONLY},
     {"co_filename",     T_OBJECT,       OFF(co_filename),        READONLY},
     {"co_name",         T_OBJECT,       OFF(co_name),            READONLY},
-    {"co_firstlineno", T_INT,           OFF(co_firstlineno),     READONLY},
-    {"co_lnotab",       T_OBJECT,       OFF(co_lnotab),          READONLY},
+    {"co_firstlineno",  T_INT,          OFF(co_firstlineno),     READONLY},
+    {"co_linetable",    T_OBJECT,       OFF(co_linetable),       READONLY},
     {NULL}      /* Sentinel */
 };
 
+static int
+emit_pair(PyObject **bytes, int *offset, int a, int b)
+{
+    Py_ssize_t len = PyBytes_GET_SIZE(*bytes);
+    if (*offset + 2 >= len) {
+        if (_PyBytes_Resize(bytes, len * 2) < 0)
+            return 0;
+    }
+    unsigned char *lnotab = (unsigned char *) PyBytes_AS_STRING(*bytes);
+    lnotab += *offset;
+    *lnotab++ = a;
+    *lnotab++ = b;
+    *offset += 2;
+    return 1;
+}
+
+static int
+emit_delta(PyObject **bytes, int bdelta, int ldelta, int *offset)
+{
+    while (bdelta > 255) {
+        if (!emit_pair(bytes, offset, 255, 0)) {
+            return 0;
+        }
+        bdelta -= 255;
+    }
+    while (ldelta > 127) {
+        if (!emit_pair(bytes, offset, bdelta, 127)) {
+            return 0;
+        }
+        bdelta = 0;
+        ldelta -= 127;
+    }
+    while (ldelta < -128) {
+        if (!emit_pair(bytes, offset, bdelta, -128)) {
+            return 0;
+        }
+        bdelta = 0;
+        ldelta += 128;
+    }
+    return emit_pair(bytes, offset, bdelta, ldelta);
+}
+
+static PyObject *
+code_getlnotab(PyCodeObject *code, void *closure)
+{
+    PyCodeAddressRange bounds;
+    PyObject *bytes;
+    int table_offset = 0;
+    int code_offset = 0;
+    int line = code->co_firstlineno;
+    bytes = PyBytes_FromStringAndSize(NULL, 64);
+    if (bytes == NULL) {
+        return NULL;
+    }
+    _PyCode_InitAddressRange(code, &bounds);
+    while (PyLineTable_NextAddressRange(&bounds)) {
+        if (bounds.opaque.computed_line != line) {
+            int bdelta = bounds.ar_start - code_offset;
+            int ldelta = bounds.opaque.computed_line - line;
+            if (!emit_delta(&bytes, bdelta, ldelta, &table_offset)) {
+                Py_DECREF(bytes);
+                return NULL;
+            }
+            code_offset = bounds.ar_start;
+            line = bounds.opaque.computed_line;
+        }
+    }
+    _PyBytes_Resize(&bytes, table_offset);
+    return bytes;
+}
+
+
+static PyGetSetDef code_getsetlist[] = {
+    {"co_lnotab",    (getter)code_getlnotab, NULL, NULL},
+    {0}
+};
+
+
 /* Helper for code_new: return a shallow copy of a tuple that is
    guaranteed to contain exact strings, by converting string subclasses
    to exact strings and complaining if a non-string is found. */
@@ -434,46 +520,45 @@
     return newtuple;
 }
 
-PyDoc_STRVAR(code_doc,
-"code(argcount, posonlyargcount, kwonlyargcount, nlocals, stacksize,\n\
-      flags, codestring, constants, names, varnames, filename, name,\n\
-      firstlineno, lnotab[, freevars[, cellvars]])\n\
-\n\
-Create a code object.  Not for the faint of heart.");
+/*[clinic input]
+@classmethod
+code.__new__ as code_new
+
+    argcount: int
+    posonlyargcount: int
+    kwonlyargcount: int
+    nlocals: int
+    stacksize: int
+    flags: int
+    codestring as code: object(subclass_of="&PyBytes_Type")
+    constants as consts: object(subclass_of="&PyTuple_Type")
+    names: object(subclass_of="&PyTuple_Type")
+    varnames: object(subclass_of="&PyTuple_Type")
+    filename: unicode
+    name: unicode
+    firstlineno: int
+    linetable: object(subclass_of="&PyBytes_Type")
+    freevars: object(subclass_of="&PyTuple_Type", c_default="NULL") = ()
+    cellvars: object(subclass_of="&PyTuple_Type", c_default="NULL") = ()
+    /
+
+Create a code object.  Not for the faint of heart.
+[clinic start generated code]*/
 
 static PyObject *
-code_new(PyTypeObject *type, PyObject *args, PyObject *kw)
+code_new_impl(PyTypeObject *type, int argcount, int posonlyargcount,
+              int kwonlyargcount, int nlocals, int stacksize, int flags,
+              PyObject *code, PyObject *consts, PyObject *names,
+              PyObject *varnames, PyObject *filename, PyObject *name,
+              int firstlineno, PyObject *linetable, PyObject *freevars,
+              PyObject *cellvars)
+/*[clinic end generated code: output=42c1839b082ba293 input=0ec80da632b99f57]*/
 {
-    int argcount;
-    int posonlyargcount;
-    int kwonlyargcount;
-    int nlocals;
-    int stacksize;
-    int flags;
     PyObject *co = NULL;
-    PyObject *code;
-    PyObject *consts;
-    PyObject *names, *ournames = NULL;
-    PyObject *varnames, *ourvarnames = NULL;
-    PyObject *freevars = NULL, *ourfreevars = NULL;
-    PyObject *cellvars = NULL, *ourcellvars = NULL;
-    PyObject *filename;
-    PyObject *name;
-    int firstlineno;
-    PyObject *lnotab;
-
-    if (!PyArg_ParseTuple(args, "iiiiiiSO!O!O!UUiS|O!O!:code",
-                          &argcount, &posonlyargcount, &kwonlyargcount,
-                              &nlocals, &stacksize, &flags,
-                          &code,
-                          &PyTuple_Type, &consts,
-                          &PyTuple_Type, &names,
-                          &PyTuple_Type, &varnames,
-                          &filename, &name,
-                          &firstlineno, &lnotab,
-                          &PyTuple_Type, &freevars,
-                          &PyTuple_Type, &cellvars))
-        return NULL;
+    PyObject *ournames = NULL;
+    PyObject *ourvarnames = NULL;
+    PyObject *ourfreevars = NULL;
+    PyObject *ourcellvars = NULL;
 
     if (PySys_Audit("code.__new__", "OOOiiiiii",
                     code, filename, name, argcount, posonlyargcount,
@@ -533,7 +618,7 @@
                                                code, consts, ournames,
                                                ourvarnames, ourfreevars,
                                                ourcellvars, filename,
-                                               name, firstlineno, lnotab);
+                                               name, firstlineno, linetable);
   cleanup:
     Py_XDECREF(ournames);
     Py_XDECREF(ourvarnames);
@@ -546,10 +631,10 @@
 code_dealloc(PyCodeObject *co)
 {
     if (co->co_opcache != NULL) {
-        PyMem_FREE(co->co_opcache);
+        PyMem_Free(co->co_opcache);
     }
     if (co->co_opcache_map != NULL) {
-        PyMem_FREE(co->co_opcache_map);
+        PyMem_Free(co->co_opcache_map);
     }
     co->co_opcache_flag = 0;
     co->co_opcache_size = 0;
@@ -577,14 +662,14 @@
     Py_XDECREF(co->co_cellvars);
     Py_XDECREF(co->co_filename);
     Py_XDECREF(co->co_name);
-    Py_XDECREF(co->co_lnotab);
+    Py_XDECREF(co->co_linetable);
     if (co->co_cell2arg != NULL)
-        PyMem_FREE(co->co_cell2arg);
+        PyMem_Free(co->co_cell2arg);
     if (co->co_zombieframe != NULL)
         PyObject_GC_Del(co->co_zombieframe);
     if (co->co_weakreflist != NULL)
         PyObject_ClearWeakRefs((PyObject*)co);
-    PyObject_DEL(co);
+    PyObject_Free(co);
 }
 
 static PyObject *
@@ -629,7 +714,7 @@
     co_cellvars: object(subclass_of="&PyTuple_Type", c_default="self->co_cellvars") = None
     co_filename: unicode(c_default="self->co_filename") = None
     co_name: unicode(c_default="self->co_name") = None
-    co_lnotab: PyBytesObject(c_default="(PyBytesObject *)self->co_lnotab") = None
+    co_linetable: PyBytesObject(c_default="(PyBytesObject *)self->co_linetable") = None
 
 Return a copy of the code object with new values for the specified fields.
 [clinic start generated code]*/
@@ -642,8 +727,8 @@
                   PyObject *co_consts, PyObject *co_names,
                   PyObject *co_varnames, PyObject *co_freevars,
                   PyObject *co_cellvars, PyObject *co_filename,
-                  PyObject *co_name, PyBytesObject *co_lnotab)
-/*[clinic end generated code: output=25c8e303913bcace input=d9051bc8f24e6b28]*/
+                  PyObject *co_name, PyBytesObject *co_linetable)
+/*[clinic end generated code: output=50d77e668d3b449b input=a5f997b173d7f636]*/
 {
 #define CHECK_INT_ARG(ARG) \
         if (ARG < 0) { \
@@ -673,7 +758,7 @@
         co_argcount, co_posonlyargcount, co_kwonlyargcount, co_nlocals,
         co_stacksize, co_flags, (PyObject*)co_code, co_consts, co_names,
         co_varnames, co_freevars, co_cellvars, co_filename, co_name,
-        co_firstlineno, (PyObject*)co_lnotab);
+        co_firstlineno, (PyObject*)co_linetable);
 }
 
 static PyObject *
@@ -926,10 +1011,188 @@
     return h;
 }
 
+typedef struct {
+    PyObject_HEAD
+    PyCodeObject *li_code;
+    PyCodeAddressRange li_line;
+    char *li_end;
+} lineiterator;
+
+
+static void
+lineiter_dealloc(lineiterator *li)
+{
+    Py_DECREF(li->li_code);
+    Py_TYPE(li)->tp_free(li);
+}
+
+static PyObject *
+lineiter_next(lineiterator *li)
+{
+    PyCodeAddressRange *bounds = &li->li_line;
+    if (!PyLineTable_NextAddressRange(bounds)) {
+        return NULL;
+    }
+    PyObject *start = NULL;
+    PyObject *end = NULL;
+    PyObject *line = NULL;
+    PyObject *result = PyTuple_New(3);
+    start = PyLong_FromLong(bounds->ar_start);
+    end = PyLong_FromLong(bounds->ar_end);
+    if (bounds->ar_line < 0) {
+        Py_INCREF(Py_None);
+        line = Py_None;
+    }
+    else {
+        line = PyLong_FromLong(bounds->ar_line);
+    }
+    if (result == NULL || start == NULL || end == NULL || line == NULL) {
+        goto error;
+    }
+    PyTuple_SET_ITEM(result, 0, start);
+    PyTuple_SET_ITEM(result, 1, end);
+    PyTuple_SET_ITEM(result, 2, line);
+    return result;
+error:
+    Py_XDECREF(start);
+    Py_XDECREF(end);
+    Py_XDECREF(line);
+    Py_XDECREF(result);
+    return result;
+}
+
+static PyTypeObject LineIterator = {
+    PyVarObject_HEAD_INIT(&PyType_Type, 0)
+    "line_iterator",                    /* tp_name */
+    sizeof(lineiterator),               /* tp_basicsize */
+    0,                                  /* tp_itemsize */
+    /* methods */
+    (destructor)lineiter_dealloc,       /* tp_dealloc */
+    0,                                  /* tp_vectorcall_offset */
+    0,                                  /* tp_getattr */
+    0,                                  /* tp_setattr */
+    0,                                  /* tp_as_async */
+    0,                                  /* tp_repr */
+    0,                                  /* tp_as_number */
+    0,                                  /* tp_as_sequence */
+    0,                                  /* tp_as_mapping */
+    0,                                  /* tp_hash */
+    0,                                  /* tp_call */
+    0,                                  /* tp_str */
+    0,                                  /* tp_getattro */
+    0,                                  /* tp_setattro */
+    0,                                  /* tp_as_buffer */
+    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,       /* tp_flags */
+    0,                                  /* tp_doc */
+    0,                                  /* tp_traverse */
+    0,                                  /* tp_clear */
+    0,                                  /* tp_richcompare */
+    0,                                  /* tp_weaklistoffset */
+    PyObject_SelfIter,                  /* tp_iter */
+    (iternextfunc)lineiter_next,        /* tp_iternext */
+    0,                                  /* tp_methods */
+    0,                                  /* tp_members */
+    0,                                  /* tp_getset */
+    0,                                  /* tp_base */
+    0,                                  /* tp_dict */
+    0,                                  /* tp_descr_get */
+    0,                                  /* tp_descr_set */
+    0,                                  /* tp_dictoffset */
+    0,                                  /* tp_init */
+    0,                                  /* tp_alloc */
+    0,                                  /* tp_new */
+    PyObject_Del,                       /* tp_free */
+};
+
+static PyObject *
+code_linesiterator(PyCodeObject *code, PyObject *Py_UNUSED(args))
+{
+    lineiterator *li = (lineiterator *)PyType_GenericAlloc(&LineIterator, 0);
+    if (li == NULL) {
+        return NULL;
+    }
+    Py_INCREF(code);
+    li->li_code = code;
+    _PyCode_InitAddressRange(code, &li->li_line);
+    return (PyObject *)li;
+}
+
+static void
+retreat(PyCodeAddressRange *bounds)
+{
+    int ldelta = ((signed char *)bounds->opaque.lo_next)[-1];
+    if (ldelta == -128) {
+        ldelta = 0;
+    }
+    bounds->opaque.computed_line -= ldelta;
+    bounds->opaque.lo_next -= 2;
+    bounds->ar_end = bounds->ar_start;
+    bounds->ar_start -= ((unsigned char *)bounds->opaque.lo_next)[-2];
+    ldelta = ((signed char *)bounds->opaque.lo_next)[-1];
+    if (ldelta == -128) {
+        bounds->ar_line = -1;
+    }
+    else {
+        bounds->ar_line = bounds->opaque.computed_line;
+    }
+}
+
+static void
+advance(PyCodeAddressRange *bounds)
+{
+    bounds->ar_start = bounds->ar_end;
+    int delta = ((unsigned char *)bounds->opaque.lo_next)[0];
+    bounds->ar_end += delta;
+    int ldelta = ((signed char *)bounds->opaque.lo_next)[1];
+    bounds->opaque.lo_next += 2;
+    if (ldelta == -128) {
+        bounds->ar_line = -1;
+    }
+    else {
+        bounds->opaque.computed_line += ldelta;
+        bounds->ar_line = bounds->opaque.computed_line;
+    }
+}
+
+static inline int
+at_end(PyCodeAddressRange *bounds) {
+    return bounds->opaque.lo_next >= bounds->opaque.limit;
+}
+
+int
+PyLineTable_PreviousAddressRange(PyCodeAddressRange *range)
+{
+    if (range->ar_start <= 0) {
+        return 0;
+    }
+    retreat(range);
+    while (range->ar_start == range->ar_end) {
+        assert(range->ar_start > 0);
+        retreat(range);
+    }
+    return 1;
+}
+
+int
+PyLineTable_NextAddressRange(PyCodeAddressRange *range)
+{
+    if (at_end(range)) {
+        return 0;
+    }
+    advance(range);
+    while (range->ar_start == range->ar_end) {
+        assert(!at_end(range));
+        advance(range);
+    }
+    return 1;
+}
+
+
 /* XXX code objects need to participate in GC? */
 
 static struct PyMethodDef code_methods[] = {
     {"__sizeof__", (PyCFunction)code_sizeof, METH_NOARGS},
+    {"co_lines", (PyCFunction)code_linesiterator, METH_NOARGS},
     CODE_REPLACE_METHODDEF
     {NULL, NULL}                /* sentinel */
 };
@@ -955,7 +1218,7 @@
     0,                                  /* tp_setattro */
     0,                                  /* tp_as_buffer */
     Py_TPFLAGS_DEFAULT,                 /* tp_flags */
-    code_doc,                           /* tp_doc */
+    code_new__doc__,                    /* tp_doc */
     0,                                  /* tp_traverse */
     0,                                  /* tp_clear */
     code_richcompare,                   /* tp_richcompare */
@@ -964,7 +1227,7 @@
     0,                                  /* tp_iternext */
     code_methods,                       /* tp_methods */
     code_memberlist,                    /* tp_members */
-    0,                                  /* tp_getset */
+    code_getsetlist,                    /* tp_getset */
     0,                                  /* tp_base */
     0,                                  /* tp_dict */
     0,                                  /* tp_descr_get */
@@ -975,78 +1238,58 @@
     code_new,                           /* tp_new */
 };
 
-/* Use co_lnotab to compute the line number from a bytecode index, addrq.  See
+/* Use co_linetable to compute the line number from a bytecode index, addrq.  See
    lnotab_notes.txt for the details of the lnotab representation.
 */
 
 int
 PyCode_Addr2Line(PyCodeObject *co, int addrq)
 {
-    Py_ssize_t size = PyBytes_Size(co->co_lnotab) / 2;
-    unsigned char *p = (unsigned char*)PyBytes_AsString(co->co_lnotab);
-    int line = co->co_firstlineno;
-    int addr = 0;
-    while (--size >= 0) {
-        addr += *p++;
-        if (addr > addrq)
-            break;
-        line += (signed char)*p;
-        p++;
+    if (addrq < 0) {
+        return co->co_firstlineno;
     }
-    return line;
+    assert(addrq >= 0 && addrq < PyBytes_GET_SIZE(co->co_code));
+    PyCodeAddressRange bounds;
+    _PyCode_InitAddressRange(co, &bounds);
+    return _PyCode_CheckLineNumber(addrq, &bounds);
+}
+
+void
+PyLineTable_InitAddressRange(const char *linetable, Py_ssize_t length, int firstlineno, PyCodeAddressRange *range)
+{
+    range->opaque.lo_next = linetable;
+    range->opaque.limit = range->opaque.lo_next + length;
+    range->ar_start = -1;
+    range->ar_end = 0;
+    range->opaque.computed_line = firstlineno;
+    range->ar_line = -1;
+}
+
+int
+_PyCode_InitAddressRange(PyCodeObject* co, PyCodeAddressRange *bounds)
+{
+    const char *linetable = PyBytes_AS_STRING(co->co_linetable);
+    Py_ssize_t length = PyBytes_GET_SIZE(co->co_linetable);
+    PyLineTable_InitAddressRange(linetable, length, co->co_firstlineno, bounds);
+    return bounds->ar_line;
 }
 
 /* Update *bounds to describe the first and one-past-the-last instructions in
-   the same line as lasti.  Return the number of that line. */
+   the same line as lasti.  Return the number of that line, or -1 if lasti is out of bounds. */
 int
-_PyCode_CheckLineNumber(PyCodeObject* co, int lasti, PyAddrPair *bounds)
+_PyCode_CheckLineNumber(int lasti, PyCodeAddressRange *bounds)
 {
-    Py_ssize_t size;
-    int addr, line;
-    unsigned char* p;
-
-    p = (unsigned char*)PyBytes_AS_STRING(co->co_lnotab);
-    size = PyBytes_GET_SIZE(co->co_lnotab) / 2;
-
-    addr = 0;
-    line = co->co_firstlineno;
-    assert(line > 0);
-
-    /* possible optimization: if f->f_lasti == instr_ub
-       (likely to be a common case) then we already know
-       instr_lb -- if we stored the matching value of p
-       somewhere we could skip the first while loop. */
-
-    /* See lnotab_notes.txt for the description of
-       co_lnotab.  A point to remember: increments to p
-       come in (addr, line) pairs. */
-
-    bounds->ap_lower = 0;
-    while (size > 0) {
-        if (addr + *p > lasti)
-            break;
-        addr += *p++;
-        if ((signed char)*p)
-            bounds->ap_lower = addr;
-        line += (signed char)*p;
-        p++;
-        --size;
-    }
-
-    if (size > 0) {
-        while (--size >= 0) {
-            addr += *p++;
-            if ((signed char)*p)
-                break;
-            p++;
+    while (bounds->ar_end <= lasti) {
+        if (!PyLineTable_NextAddressRange(bounds)) {
+            return -1;
         }
-        bounds->ap_upper = addr;
     }
-    else {
-        bounds->ap_upper = INT_MAX;
+    while (bounds->ar_start > lasti) {
+        if (!PyLineTable_PreviousAddressRange(bounds)) {
+            return -1;
+        }
     }
-
-    return line;
+    return bounds->ar_line;
 }
 
 
diff --git a/Objects/complexobject.c b/Objects/complexobject.c
index a490377..3e47949 100644
--- a/Objects/complexobject.c
+++ b/Objects/complexobject.c
@@ -6,8 +6,11 @@
 /* Submitted by Jim Hugunin */
 
 #include "Python.h"
+#include "pycore_long.h"          // _PyLong_GetZero()
+#include "pycore_object.h"        // _PyObject_Init()
 #include "structmember.h"         // PyMemberDef
 
+
 /*[clinic input]
 class complex "PyComplexObject *" "&PyComplex_Type"
 [clinic start generated code]*/
@@ -169,14 +172,7 @@
 static Py_complex
 c_powi(Py_complex x, long n)
 {
-    Py_complex cn;
-
-    if (n > 100 || n < -100) {
-        cn.real = (double) n;
-        cn.imag = 0.;
-        return _Py_c_pow(x,cn);
-    }
-    else if (n > 0)
+    if (n > 0)
         return c_powu(x,n);
     else
         return _Py_c_quot(c_1, c_powu(x,-n));
@@ -229,13 +225,12 @@
 PyObject *
 PyComplex_FromCComplex(Py_complex cval)
 {
-    PyComplexObject *op;
-
     /* Inline PyObject_New */
-    op = (PyComplexObject *) PyObject_MALLOC(sizeof(PyComplexObject));
-    if (op == NULL)
+    PyComplexObject *op = PyObject_Malloc(sizeof(PyComplexObject));
+    if (op == NULL) {
         return PyErr_NoMemory();
-    (void)PyObject_INIT(op, &PyComplex_Type);
+    }
+    _PyObject_Init((PyObject*)op, &PyComplex_Type);
     op->cval = cval;
     return (PyObject *) op;
 }
@@ -410,10 +405,10 @@
 complex_hash(PyComplexObject *v)
 {
     Py_uhash_t hashreal, hashimag, combined;
-    hashreal = (Py_uhash_t)_Py_HashDouble(v->cval.real);
+    hashreal = (Py_uhash_t)_Py_HashDouble((PyObject *) v, v->cval.real);
     if (hashreal == (Py_uhash_t)-1)
         return -1;
-    hashimag = (Py_uhash_t)_Py_HashDouble(v->cval.imag);
+    hashimag = (Py_uhash_t)_Py_HashDouble((PyObject *)v, v->cval.imag);
     if (hashimag == (Py_uhash_t)-1)
         return -1;
     /* Note:  if the imaginary part is 0, hashimag is 0 now,
@@ -509,28 +504,9 @@
 }
 
 static PyObject *
-complex_remainder(PyObject *v, PyObject *w)
-{
-    PyErr_SetString(PyExc_TypeError,
-                    "can't mod complex numbers.");
-    return NULL;
-}
-
-
-static PyObject *
-complex_divmod(PyObject *v, PyObject *w)
-{
-    PyErr_SetString(PyExc_TypeError,
-                    "can't take floor or mod of complex number.");
-    return NULL;
-}
-
-static PyObject *
 complex_pow(PyObject *v, PyObject *w, PyObject *z)
 {
     Py_complex p;
-    Py_complex exponent;
-    long int_exponent;
     Py_complex a, b;
     TO_COMPLEX(v, a);
     TO_COMPLEX(w, b);
@@ -540,12 +516,14 @@
         return NULL;
     }
     errno = 0;
-    exponent = b;
-    int_exponent = (long)exponent.real;
-    if (exponent.imag == 0. && exponent.real == int_exponent)
-        p = c_powi(a, int_exponent);
-    else
-        p = _Py_c_pow(a, exponent);
+    // Check whether the exponent has a small integer value, and if so use
+    // a faster and more accurate algorithm.
+    if (b.imag == 0.0 && b.real == floor(b.real) && fabs(b.real) <= 100.0) {
+        p = c_powi(a, (long)b.real);
+    }
+    else {
+        p = _Py_c_pow(a, b);
+    }
 
     Py_ADJUST_ERANGE2(p.real, p.imag);
     if (errno == EDOM) {
@@ -562,14 +540,6 @@
 }
 
 static PyObject *
-complex_int_div(PyObject *v, PyObject *w)
-{
-    PyErr_SetString(PyExc_TypeError,
-                    "can't take floor of complex number.");
-    return NULL;
-}
-
-static PyObject *
 complex_neg(PyComplexObject *v)
 {
     Py_complex neg;
@@ -667,62 +637,54 @@
     Py_RETURN_NOTIMPLEMENTED;
 }
 
-static PyObject *
-complex_int(PyObject *v)
-{
-    PyErr_SetString(PyExc_TypeError,
-               "can't convert complex to int");
-    return NULL;
-}
+/*[clinic input]
+complex.conjugate
+
+Return the complex conjugate of its argument. (3-4j).conjugate() == 3+4j.
+[clinic start generated code]*/
 
 static PyObject *
-complex_float(PyObject *v)
+complex_conjugate_impl(PyComplexObject *self)
+/*[clinic end generated code: output=5059ef162edfc68e input=5fea33e9747ec2c4]*/
 {
-    PyErr_SetString(PyExc_TypeError,
-               "can't convert complex to float");
-    return NULL;
-}
-
-static PyObject *
-complex_conjugate(PyObject *self, PyObject *Py_UNUSED(ignored))
-{
-    Py_complex c;
-    c = ((PyComplexObject *)self)->cval;
+    Py_complex c = self->cval;
     c.imag = -c.imag;
     return PyComplex_FromCComplex(c);
 }
 
-PyDoc_STRVAR(complex_conjugate_doc,
-"complex.conjugate() -> complex\n"
-"\n"
-"Return the complex conjugate of its argument. (3-4j).conjugate() == 3+4j.");
+/*[clinic input]
+complex.__getnewargs__
+
+[clinic start generated code]*/
 
 static PyObject *
-complex_getnewargs(PyComplexObject *v, PyObject *Py_UNUSED(ignored))
+complex___getnewargs___impl(PyComplexObject *self)
+/*[clinic end generated code: output=689b8206e8728934 input=539543e0a50533d7]*/
 {
-    Py_complex c = v->cval;
+    Py_complex c = self->cval;
     return Py_BuildValue("(dd)", c.real, c.imag);
 }
 
-PyDoc_STRVAR(complex__format__doc,
-"complex.__format__() -> str\n"
-"\n"
-"Convert to a string according to format_spec.");
+
+/*[clinic input]
+complex.__format__
+
+    format_spec: unicode
+    /
+
+Convert to a string according to format_spec.
+[clinic start generated code]*/
 
 static PyObject *
-complex__format__(PyObject* self, PyObject* args)
+complex___format___impl(PyComplexObject *self, PyObject *format_spec)
+/*[clinic end generated code: output=bfcb60df24cafea0 input=014ef5488acbe1d5]*/
 {
-    PyObject *format_spec;
     _PyUnicodeWriter writer;
     int ret;
-
-    if (!PyArg_ParseTuple(args, "U:__format__", &format_spec))
-        return NULL;
-
     _PyUnicodeWriter_Init(&writer);
     ret = _PyComplex_FormatAdvancedWriter(
         &writer,
-        self,
+        (PyObject *)self,
         format_spec, 0, PyUnicode_GET_LENGTH(format_spec));
     if (ret == -1) {
         _PyUnicodeWriter_Dealloc(&writer);
@@ -732,11 +694,9 @@
 }
 
 static PyMethodDef complex_methods[] = {
-    {"conjugate",       (PyCFunction)complex_conjugate, METH_NOARGS,
-     complex_conjugate_doc},
-    {"__getnewargs__",          (PyCFunction)complex_getnewargs,        METH_NOARGS},
-    {"__format__",          (PyCFunction)complex__format__,
-                                       METH_VARARGS, complex__format__doc},
+    COMPLEX_CONJUGATE_METHODDEF
+    COMPLEX___GETNEWARGS___METHODDEF
+    COMPLEX___FORMAT___METHODDEF
     {NULL,              NULL}           /* sentinel */
 };
 
@@ -904,7 +864,7 @@
 /*[clinic input]
 @classmethod
 complex.__new__ as complex_new
-    real as r: object(c_default="_PyLong_Zero") = 0
+    real as r: object(c_default="NULL") = 0
     imag as i: object(c_default="NULL") = 0
 
 Create a complex number from a real part and an optional imaginary part.
@@ -914,7 +874,7 @@
 
 static PyObject *
 complex_new_impl(PyTypeObject *type, PyObject *r, PyObject *i)
-/*[clinic end generated code: output=b6c7dd577b537dc1 input=6f6b0bedba29bcb5]*/
+/*[clinic end generated code: output=b6c7dd577b537dc1 input=f4c667f2596d4fd1]*/
 {
     PyObject *tmp;
     PyNumberMethods *nbr, *nbi = NULL;
@@ -923,6 +883,10 @@
     int cr_is_complex = 0;
     int ci_is_complex = 0;
 
+    if (r == NULL) {
+        r = _PyLong_GetZero();
+    }
+
     /* Special-case for a single argument when type(arg) is complex. */
     if (PyComplex_CheckExact(r) && i == NULL &&
         type == &PyComplex_Type) {
@@ -959,7 +923,9 @@
     }
 
     nbr = Py_TYPE(r)->tp_as_number;
-    if (nbr == NULL || (nbr->nb_float == NULL && nbr->nb_index == NULL)) {
+    if (nbr == NULL ||
+        (nbr->nb_float == NULL && nbr->nb_index == NULL && !PyComplex_Check(r)))
+    {
         PyErr_Format(PyExc_TypeError,
                      "complex() first argument must be a string or a number, "
                      "not '%.200s'",
@@ -971,7 +937,9 @@
     }
     if (i != NULL) {
         nbi = Py_TYPE(i)->tp_as_number;
-        if (nbi == NULL || (nbi->nb_float == NULL && nbi->nb_index == NULL)) {
+        if (nbi == NULL ||
+            (nbi->nb_float == NULL && nbi->nb_index == NULL && !PyComplex_Check(i)))
+        {
             PyErr_Format(PyExc_TypeError,
                          "complex() second argument must be a number, "
                          "not '%.200s'",
@@ -1050,8 +1018,8 @@
     (binaryfunc)complex_add,                    /* nb_add */
     (binaryfunc)complex_sub,                    /* nb_subtract */
     (binaryfunc)complex_mul,                    /* nb_multiply */
-    (binaryfunc)complex_remainder,              /* nb_remainder */
-    (binaryfunc)complex_divmod,                 /* nb_divmod */
+    0,                                          /* nb_remainder */
+    0,                                          /* nb_divmod */
     (ternaryfunc)complex_pow,                   /* nb_power */
     (unaryfunc)complex_neg,                     /* nb_negative */
     (unaryfunc)complex_pos,                     /* nb_positive */
@@ -1063,9 +1031,9 @@
     0,                                          /* nb_and */
     0,                                          /* nb_xor */
     0,                                          /* nb_or */
-    complex_int,                                /* nb_int */
+    0,                                          /* nb_int */
     0,                                          /* nb_reserved */
-    complex_float,                              /* nb_float */
+    0,                                          /* nb_float */
     0,                                          /* nb_inplace_add */
     0,                                          /* nb_inplace_subtract */
     0,                                          /* nb_inplace_multiply*/
@@ -1076,7 +1044,7 @@
     0,                                          /* nb_inplace_and */
     0,                                          /* nb_inplace_xor */
     0,                                          /* nb_inplace_or */
-    (binaryfunc)complex_int_div,                /* nb_floor_divide */
+    0,                                          /* nb_floor_divide */
     (binaryfunc)complex_div,                    /* nb_true_divide */
     0,                                          /* nb_inplace_floor_divide */
     0,                                          /* nb_inplace_true_divide */
diff --git a/Objects/descrobject.c b/Objects/descrobject.c
index fce9cdd..09b0f82 100644
--- a/Objects/descrobject.c
+++ b/Objects/descrobject.c
@@ -1,10 +1,10 @@
 /* Descriptors -- a new, flexible way to describe attributes */
 
 #include "Python.h"
-#include "pycore_ceval.h"        // _Py_EnterRecursiveCall()
-#include "pycore_object.h"
-#include "pycore_pystate.h"      // _PyThreadState_GET()
-#include "pycore_tupleobject.h"
+#include "pycore_ceval.h"         // _Py_EnterRecursiveCall()
+#include "pycore_object.h"        // _PyObject_GC_UNTRACK()
+#include "pycore_pystate.h"       // _PyThreadState_GET()
+#include "pycore_tuple.h"         // _PyTuple_ITEMS()
 #include "structmember.h"         // PyMemberDef
 
 _Py_IDENTIFIER(getattr);
@@ -72,13 +72,8 @@
 }
 
 static int
-descr_check(PyDescrObject *descr, PyObject *obj, PyObject **pres)
+descr_check(PyDescrObject *descr, PyObject *obj)
 {
-    if (obj == NULL) {
-        Py_INCREF(descr);
-        *pres = (PyObject *)descr;
-        return 1;
-    }
     if (!PyObject_TypeCheck(obj, descr->d_type)) {
         PyErr_Format(PyExc_TypeError,
                      "descriptor '%V' for '%.100s' objects "
@@ -86,8 +81,7 @@
                      descr_name((PyDescrObject *)descr), "?",
                      descr->d_type->tp_name,
                      Py_TYPE(obj)->tp_name);
-        *pres = NULL;
-        return 1;
+        return -1;
     }
     return 0;
 }
@@ -137,10 +131,12 @@
 static PyObject *
 method_get(PyMethodDescrObject *descr, PyObject *obj, PyObject *type)
 {
-    PyObject *res;
-
-    if (descr_check((PyDescrObject *)descr, obj, &res))
-        return res;
+    if (obj == NULL) {
+        return Py_NewRef(descr);
+    }
+    if (descr_check((PyDescrObject *)descr, obj) < 0) {
+        return NULL;
+    }
     if (descr->d_method->ml_flags & METH_METHOD) {
         if (PyType_Check(type)) {
             return PyCMethod_New(descr->d_method, obj, NULL, descr->d_common.d_type);
@@ -159,12 +155,14 @@
 static PyObject *
 member_get(PyMemberDescrObject *descr, PyObject *obj, PyObject *type)
 {
-    PyObject *res;
+    if (obj == NULL) {
+        return Py_NewRef(descr);
+    }
+    if (descr_check((PyDescrObject *)descr, obj) < 0) {
+        return NULL;
+    }
 
-    if (descr_check((PyDescrObject *)descr, obj, &res))
-        return res;
-
-    if (descr->d_member->flags & READ_RESTRICTED) {
+    if (descr->d_member->flags & PY_AUDIT_READ) {
         if (PySys_Audit("object.__getattr__", "Os",
             obj ? obj : Py_None, descr->d_member->name) < 0) {
             return NULL;
@@ -177,10 +175,12 @@
 static PyObject *
 getset_get(PyGetSetDescrObject *descr, PyObject *obj, PyObject *type)
 {
-    PyObject *res;
-
-    if (descr_check((PyDescrObject *)descr, obj, &res))
-        return res;
+    if (obj == NULL) {
+        return Py_NewRef(descr);
+    }
+    if (descr_check((PyDescrObject *)descr, obj) < 0) {
+        return NULL;
+    }
     if (descr->d_getset->get != NULL)
         return descr->d_getset->get(obj, descr->d_getset->closure);
     PyErr_Format(PyExc_AttributeError,
@@ -193,16 +193,17 @@
 static PyObject *
 wrapperdescr_get(PyWrapperDescrObject *descr, PyObject *obj, PyObject *type)
 {
-    PyObject *res;
-
-    if (descr_check((PyDescrObject *)descr, obj, &res))
-        return res;
+    if (obj == NULL) {
+        return Py_NewRef(descr);
+    }
+    if (descr_check((PyDescrObject *)descr, obj) < 0) {
+        return NULL;
+    }
     return PyWrapper_New((PyObject *)descr, obj);
 }
 
 static int
-descr_setcheck(PyDescrObject *descr, PyObject *obj, PyObject *value,
-               int *pres)
+descr_setcheck(PyDescrObject *descr, PyObject *obj, PyObject *value)
 {
     assert(obj != NULL);
     if (!PyObject_TypeCheck(obj, descr->d_type)) {
@@ -212,8 +213,7 @@
                      descr_name(descr), "?",
                      descr->d_type->tp_name,
                      Py_TYPE(obj)->tp_name);
-        *pres = -1;
-        return 1;
+        return -1;
     }
     return 0;
 }
@@ -221,23 +221,22 @@
 static int
 member_set(PyMemberDescrObject *descr, PyObject *obj, PyObject *value)
 {
-    int res;
-
-    if (descr_setcheck((PyDescrObject *)descr, obj, value, &res))
-        return res;
+    if (descr_setcheck((PyDescrObject *)descr, obj, value) < 0) {
+        return -1;
+    }
     return PyMember_SetOne((char *)obj, descr->d_member, value);
 }
 
 static int
 getset_set(PyGetSetDescrObject *descr, PyObject *obj, PyObject *value)
 {
-    int res;
-
-    if (descr_setcheck((PyDescrObject *)descr, obj, value, &res))
-        return res;
-    if (descr->d_getset->set != NULL)
+    if (descr_setcheck((PyDescrObject *)descr, obj, value) < 0) {
+        return -1;
+    }
+    if (descr->d_getset->set != NULL) {
         return descr->d_getset->set(obj, value,
                                     descr->d_getset->closure);
+    }
     PyErr_Format(PyExc_AttributeError,
                  "attribute '%V' of '%.100s' objects is not writable",
                  descr_name((PyDescrObject *)descr), "?",
@@ -264,8 +263,7 @@
         return -1;
     }
     PyObject *self = args[0];
-    PyObject *dummy;
-    if (descr_check((PyDescrObject *)func, self, &dummy)) {
+    if (descr_check((PyDescrObject *)func, self) < 0) {
         return -1;
     }
     if (kwnames && PyTuple_GET_SIZE(kwnames)) {
@@ -995,6 +993,11 @@
     return (PyObject *)descr;
 }
 
+int
+PyDescr_IsData(PyObject *ob)
+{
+    return Py_TYPE(ob)->tp_descr_set != NULL;
+}
 
 /* --- mappingproxy: read-only proxy for mappings --- */
 
@@ -1132,11 +1135,11 @@
      PyDoc_STR("D.get(k[,d]) -> D[k] if k in D, else d."
                "  d defaults to None.")},
     {"keys",      (PyCFunction)mappingproxy_keys,       METH_NOARGS,
-     PyDoc_STR("D.keys() -> list of D's keys")},
+     PyDoc_STR("D.keys() -> a set-like object providing a view on D's keys")},
     {"values",    (PyCFunction)mappingproxy_values,     METH_NOARGS,
-     PyDoc_STR("D.values() -> list of D's values")},
+     PyDoc_STR("D.values() -> an object providing a view on D's values")},
     {"items",     (PyCFunction)mappingproxy_items,      METH_NOARGS,
-     PyDoc_STR("D.items() -> list of D's (key, value) pairs, as 2-tuples")},
+     PyDoc_STR("D.items() -> a set-like object providing a view on D's items")},
     {"copy",      (PyCFunction)mappingproxy_copy,       METH_NOARGS,
      PyDoc_STR("D.copy() -> a shallow copy of D")},
     {"__class_getitem__", (PyCFunction)Py_GenericAlias, METH_O|METH_CLASS,
@@ -1490,6 +1493,7 @@
     PyObject *prop_set;
     PyObject *prop_del;
     PyObject *prop_doc;
+    PyObject *prop_name;
     int getter_doc;
 } propertyobject;
 
@@ -1506,7 +1510,7 @@
 
 
 PyDoc_STRVAR(getter_doc,
-             "Descriptor to change the getter on a property.");
+             "Descriptor to obtain a copy of the property with a different getter.");
 
 static PyObject *
 property_getter(PyObject *self, PyObject *getter)
@@ -1516,7 +1520,7 @@
 
 
 PyDoc_STRVAR(setter_doc,
-             "Descriptor to change the setter on a property.");
+             "Descriptor to obtain a copy of the property with a different setter.");
 
 static PyObject *
 property_setter(PyObject *self, PyObject *setter)
@@ -1526,7 +1530,7 @@
 
 
 PyDoc_STRVAR(deleter_doc,
-             "Descriptor to change the deleter on a property.");
+             "Descriptor to obtain a copy of the property with a different deleter.");
 
 static PyObject *
 property_deleter(PyObject *self, PyObject *deleter)
@@ -1535,10 +1539,33 @@
 }
 
 
+PyDoc_STRVAR(set_name_doc,
+             "Method to set name of a property.");
+
+static PyObject *
+property_set_name(PyObject *self, PyObject *args) {
+    if (PyTuple_GET_SIZE(args) != 2) {
+        PyErr_Format(
+                PyExc_TypeError,
+                "__set_name__() takes 2 positional arguments but %d were given",
+                PyTuple_GET_SIZE(args));
+        return NULL;
+    }
+
+    propertyobject *prop = (propertyobject *)self;
+    PyObject *name = PyTuple_GET_ITEM(args, 1);
+
+    Py_XINCREF(name);
+    Py_XSETREF(prop->prop_name, name);
+
+    Py_RETURN_NONE;
+}
+
 static PyMethodDef property_methods[] = {
     {"getter", property_getter, METH_O, getter_doc},
     {"setter", property_setter, METH_O, setter_doc},
     {"deleter", property_deleter, METH_O, deleter_doc},
+    {"__set_name__", property_set_name, METH_VARARGS, set_name_doc},
     {0}
 };
 
@@ -1553,6 +1580,7 @@
     Py_XDECREF(gs->prop_set);
     Py_XDECREF(gs->prop_del);
     Py_XDECREF(gs->prop_doc);
+    Py_XDECREF(gs->prop_name);
     Py_TYPE(self)->tp_free(self);
 }
 
@@ -1566,7 +1594,12 @@
 
     propertyobject *gs = (propertyobject *)self;
     if (gs->prop_get == NULL) {
-        PyErr_SetString(PyExc_AttributeError, "unreadable attribute");
+        if (gs->prop_name != NULL) {
+            PyErr_Format(PyExc_AttributeError, "unreadable attribute %R", gs->prop_name);
+        } else {
+            PyErr_SetString(PyExc_AttributeError, "unreadable attribute");
+        }
+
         return NULL;
     }
 
@@ -1584,10 +1617,18 @@
     else
         func = gs->prop_set;
     if (func == NULL) {
-        PyErr_SetString(PyExc_AttributeError,
+        if (gs->prop_name != NULL) {
+            PyErr_Format(PyExc_AttributeError,
                         value == NULL ?
-                        "can't delete attribute" :
-                "can't set attribute");
+                        "can't delete attribute %R" :
+                        "can't set attribute %R",
+                        gs->prop_name);
+        } else {
+            PyErr_SetString(PyExc_AttributeError,
+                            value == NULL ?
+                            "can't delete attribute" :
+                            "can't set attribute");
+        }
         return -1;
     }
     if (value == NULL)
@@ -1634,6 +1675,9 @@
     Py_DECREF(type);
     if (new == NULL)
         return NULL;
+
+    Py_XINCREF(pold->prop_name);
+    Py_XSETREF(((propertyobject *) new)->prop_name, pold->prop_name);
     return new;
 }
 
@@ -1695,6 +1739,8 @@
     Py_XSETREF(self->prop_set, fset);
     Py_XSETREF(self->prop_del, fdel);
     Py_XSETREF(self->prop_doc, doc);
+    Py_XSETREF(self->prop_name, NULL);
+
     self->getter_doc = 0;
 
     /* if no docstring given and the getter has one, use that one */
@@ -1769,6 +1815,7 @@
     Py_VISIT(pp->prop_set);
     Py_VISIT(pp->prop_del);
     Py_VISIT(pp->prop_doc);
+    Py_VISIT(pp->prop_name);
     return 0;
 }
 
@@ -1803,7 +1850,8 @@
     PyObject_GenericGetAttr,                    /* tp_getattro */
     0,                                          /* tp_setattro */
     0,                                          /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */
+    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
+        Py_TPFLAGS_MAPPING,                     /* tp_flags */
     0,                                          /* tp_doc */
     mappingproxy_traverse,                      /* tp_traverse */
     0,                                          /* tp_clear */
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index faee6bc..24973c0 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -111,8 +111,10 @@
 #define PyDict_MINSIZE 8
 
 #include "Python.h"
+#include "pycore_bitutils.h" // _Py_bit_length
 #include "pycore_gc.h"       // _PyObject_GC_IS_TRACKED()
-#include "pycore_object.h"
+#include "pycore_object.h"   // _PyObject_GC_TRACK()
+#include "pycore_pyerrors.h" // _PyErr_Fetch()
 #include "pycore_pystate.h"  // _PyThreadState_GET()
 #include "dict-common.h"
 #include "stringlib/eq.h"    // unicode_eq()
@@ -235,7 +237,7 @@
 static Py_ssize_t lookdict_split(PyDictObject *mp, PyObject *key,
                                  Py_hash_t hash, PyObject **value_addr);
 
-static int dictresize(PyDictObject *mp, Py_ssize_t minused);
+static int dictresize(PyDictObject *mp, Py_ssize_t newsize);
 
 static PyObject* dict_iter(PyDictObject *dict);
 
@@ -246,52 +248,54 @@
 
 #define DICT_NEXT_VERSION() (++pydict_global_version)
 
-/* Dictionary reuse scheme to save calls to malloc and free */
-#ifndef PyDict_MAXFREELIST
-#define PyDict_MAXFREELIST 80
-#endif
-
-#if PyDict_MAXFREELIST > 0
-static PyDictObject *free_list[PyDict_MAXFREELIST];
-static int numfree = 0;
-static PyDictKeysObject *keys_free_list[PyDict_MAXFREELIST];
-static int numfreekeys = 0;
-#endif
-
 #include "clinic/dictobject.c.h"
 
-void
-_PyDict_ClearFreeList(void)
+
+static struct _Py_dict_state *
+get_dict_state(void)
 {
-#if PyDict_MAXFREELIST > 0
-    while (numfree) {
-        PyDictObject *op = free_list[--numfree];
+    PyInterpreterState *interp = _PyInterpreterState_GET();
+    return &interp->dict_state;
+}
+
+
+void
+_PyDict_ClearFreeList(PyInterpreterState *interp)
+{
+    struct _Py_dict_state *state = &interp->dict_state;
+    while (state->numfree) {
+        PyDictObject *op = state->free_list[--state->numfree];
         assert(PyDict_CheckExact(op));
         PyObject_GC_Del(op);
     }
-    while (numfreekeys) {
-        PyObject_FREE(keys_free_list[--numfreekeys]);
+    while (state->keys_numfree) {
+        PyObject_Free(state->keys_free_list[--state->keys_numfree]);
     }
+}
+
+
+void
+_PyDict_Fini(PyInterpreterState *interp)
+{
+    _PyDict_ClearFreeList(interp);
+#ifdef Py_DEBUG
+    struct _Py_dict_state *state = &interp->dict_state;
+    state->numfree = -1;
+    state->keys_numfree = -1;
 #endif
 }
 
+
 /* Print summary info about the state of the optimized allocator */
 void
 _PyDict_DebugMallocStats(FILE *out)
 {
-#if PyDict_MAXFREELIST > 0
-    _PyDebugAllocatorStats(out,
-                           "free PyDictObject", numfree, sizeof(PyDictObject));
-#endif
+    struct _Py_dict_state *state = get_dict_state();
+    _PyDebugAllocatorStats(out, "free PyDictObject",
+                           state->numfree, sizeof(PyDictObject));
 }
 
 
-void
-_PyDict_Fini(void)
-{
-    _PyDict_ClearFreeList();
-}
-
 #define DK_SIZE(dk) ((dk)->dk_size)
 #if SIZEOF_VOID_P > 4
 #define DK_IXSIZE(dk)                          \
@@ -408,18 +412,40 @@
  */
 #define USABLE_FRACTION(n) (((n) << 1)/3)
 
-/* ESTIMATE_SIZE is reverse function of USABLE_FRACTION.
+/* Find the smallest dk_size >= minsize. */
+static inline Py_ssize_t
+calculate_keysize(Py_ssize_t minsize)
+{
+#if SIZEOF_LONG == SIZEOF_SIZE_T
+    minsize = (minsize | PyDict_MINSIZE) - 1;
+    return 1LL << _Py_bit_length(minsize | (PyDict_MINSIZE-1));
+#elif defined(_MSC_VER)
+    // On 64bit Windows, sizeof(long) == 4.
+    minsize = (minsize | PyDict_MINSIZE) - 1;
+    unsigned long msb;
+    _BitScanReverse64(&msb, (uint64_t)minsize);
+    return 1LL << (msb + 1);
+#else
+    Py_ssize_t size;
+    for (size = PyDict_MINSIZE;
+            size < minsize && size > 0;
+            size <<= 1)
+        ;
+    return size;
+#endif
+}
+
+/* estimate_keysize is reverse function of USABLE_FRACTION.
+ *
  * This can be used to reserve enough size to insert n entries without
  * resizing.
  */
-#define ESTIMATE_SIZE(n)  (((n)*3+1) >> 1)
+static inline Py_ssize_t
+estimate_keysize(Py_ssize_t n)
+{
+    return calculate_keysize((n*3 + 1) / 2);
+}
 
-/* Alternative fraction that is otherwise close enough to 2n/3 to make
- * little difference. 8 * 2/3 == 8 * 5/8 == 5. 16 * 2/3 == 16 * 5/8 == 10.
- * 32 * 2/3 = 21, 32 * 5/8 = 20.
- * Its advantage is that it is faster to compute on machines with slow division.
- * #define USABLE_FRACTION(n) (((n) >> 1) + ((n) >> 2) - ((n) >> 3))
- */
 
 /* GROWTH_RATE. Growth rate upon hitting maximum load.
  * Currently set to used*3.
@@ -536,7 +562,8 @@
 }
 
 
-static PyDictKeysObject *new_keys_object(Py_ssize_t size)
+static PyDictKeysObject*
+new_keys_object(Py_ssize_t size)
 {
     PyDictKeysObject *dk;
     Py_ssize_t es, usable;
@@ -560,14 +587,17 @@
         es = sizeof(Py_ssize_t);
     }
 
-#if PyDict_MAXFREELIST > 0
-    if (size == PyDict_MINSIZE && numfreekeys > 0) {
-        dk = keys_free_list[--numfreekeys];
+    struct _Py_dict_state *state = get_dict_state();
+#ifdef Py_DEBUG
+    // new_keys_object() must not be called after _PyDict_Fini()
+    assert(state->keys_numfree != -1);
+#endif
+    if (size == PyDict_MINSIZE && state->keys_numfree > 0) {
+        dk = state->keys_free_list[--state->keys_numfree];
     }
     else
-#endif
     {
-        dk = PyObject_MALLOC(sizeof(PyDictKeysObject)
+        dk = PyObject_Malloc(sizeof(PyDictKeysObject)
                              + es * size
                              + sizeof(PyDictKeyEntry) * usable);
         if (dk == NULL) {
@@ -597,17 +627,20 @@
         Py_XDECREF(entries[i].me_key);
         Py_XDECREF(entries[i].me_value);
     }
-#if PyDict_MAXFREELIST > 0
-    if (keys->dk_size == PyDict_MINSIZE && numfreekeys < PyDict_MAXFREELIST) {
-        keys_free_list[numfreekeys++] = keys;
+    struct _Py_dict_state *state = get_dict_state();
+#ifdef Py_DEBUG
+    // free_keys_object() must not be called after _PyDict_Fini()
+    assert(state->keys_numfree != -1);
+#endif
+    if (keys->dk_size == PyDict_MINSIZE && state->keys_numfree < PyDict_MAXFREELIST) {
+        state->keys_free_list[state->keys_numfree++] = keys;
         return;
     }
-#endif
-    PyObject_FREE(keys);
+    PyObject_Free(keys);
 }
 
 #define new_values(size) PyMem_NEW(PyObject *, size)
-#define free_values(values) PyMem_FREE(values)
+#define free_values(values) PyMem_Free(values)
 
 /* Consumes a reference to the keys object */
 static PyObject *
@@ -615,16 +648,18 @@
 {
     PyDictObject *mp;
     assert(keys != NULL);
-#if PyDict_MAXFREELIST > 0
-    if (numfree) {
-        mp = free_list[--numfree];
+    struct _Py_dict_state *state = get_dict_state();
+#ifdef Py_DEBUG
+    // new_dict() must not be called after _PyDict_Fini()
+    assert(state->numfree != -1);
+#endif
+    if (state->numfree) {
+        mp = state->free_list[--state->numfree];
         assert (mp != NULL);
         assert (Py_IS_TYPE(mp, &PyDict_Type));
         _Py_NewReference((PyObject *)mp);
     }
-    else
-#endif
-    {
+    else {
         mp = PyObject_GC_New(PyDictObject, &PyDict_Type);
         if (mp == NULL) {
             dictkeys_decref(keys);
@@ -662,10 +697,11 @@
 }
 
 
-static PyObject *
-clone_combined_dict(PyDictObject *orig)
+static PyDictKeysObject *
+clone_combined_dict_keys(PyDictObject *orig)
 {
-    assert(PyDict_CheckExact(orig));
+    assert(PyDict_Check(orig));
+    assert(Py_TYPE(orig)->tp_iter == (getiterfunc)dict_iter);
     assert(orig->ma_values == NULL);
     assert(orig->ma_keys->dk_refcnt == 1);
 
@@ -692,19 +728,6 @@
         }
     }
 
-    PyDictObject *new = (PyDictObject *)new_dict(keys, NULL);
-    if (new == NULL) {
-        /* In case of an error, `new_dict()` takes care of
-           cleaning up `keys`. */
-        return NULL;
-    }
-    new->ma_used = orig->ma_used;
-    ASSERT_CONSISTENT(new);
-    if (_PyObject_GC_IS_TRACKED(orig)) {
-        /* Maintain tracking. */
-        _PyObject_GC_TRACK(new);
-    }
-
     /* Since we copied the keys table we now have an extra reference
        in the system.  Manually call increment _Py_RefTotal to signal that
        we have it now; calling dictkeys_incref would be an error as
@@ -712,8 +735,7 @@
 #ifdef Py_REF_DEBUG
     _Py_RefTotal++;
 #endif
-
-    return (PyObject *)new;
+    return keys;
 }
 
 PyObject *
@@ -835,7 +857,6 @@
        unicodes is to override __eq__, and for speed we don't cater to
        that here. */
     if (!PyUnicode_CheckExact(key)) {
-        mp->ma_keys->dk_lookup = lookdict;
         return lookdict(mp, key, hash, value_addr);
     }
 
@@ -878,7 +899,6 @@
        unicodes is to override __eq__, and for speed we don't cater to
        that here. */
     if (!PyUnicode_CheckExact(key)) {
-        mp->ma_keys->dk_lookup = lookdict;
         return lookdict(mp, key, hash, value_addr);
     }
 
@@ -1037,7 +1057,7 @@
 static int
 insertion_resize(PyDictObject *mp)
 {
-    return dictresize(mp, GROWTH_RATE(mp));
+    return dictresize(mp, calculate_keysize(GROWTH_RATE(mp)));
 }
 
 /*
@@ -1062,7 +1082,6 @@
     if (ix == DKIX_ERROR)
         goto Fail;
 
-    assert(PyUnicode_CheckExact(key) || mp->ma_keys->dk_lookup == lookdict);
     MAINTAIN_TRACKING(mp, key, value);
 
     /* When insertion order is different from shared key, we can't share
@@ -1084,6 +1103,9 @@
             if (insertion_resize(mp) < 0)
                 goto Fail;
         }
+        if (!PyUnicode_CheckExact(key) && mp->ma_keys->dk_lookup != lookdict) {
+            mp->ma_keys->dk_lookup = lookdict;
+        }
         Py_ssize_t hashpos = find_empty_slot(mp->ma_keys, hash);
         ep = &DK_ENTRIES(mp->ma_keys)[mp->ma_keys->dk_nentries];
         dictkeys_set_index(mp->ma_keys, hashpos, mp->ma_keys->dk_nentries);
@@ -1195,22 +1217,19 @@
 but can be resplit by make_keys_shared().
 */
 static int
-dictresize(PyDictObject *mp, Py_ssize_t minsize)
+dictresize(PyDictObject *mp, Py_ssize_t newsize)
 {
-    Py_ssize_t newsize, numentries;
+    Py_ssize_t numentries;
     PyDictKeysObject *oldkeys;
     PyObject **oldvalues;
     PyDictKeyEntry *oldentries, *newentries;
 
-    /* Find the smallest table size > minused. */
-    for (newsize = PyDict_MINSIZE;
-         newsize < minsize && newsize > 0;
-         newsize <<= 1)
-        ;
     if (newsize <= 0) {
         PyErr_NoMemory();
         return -1;
     }
+    assert(IS_POWER_OF_2(newsize));
+    assert(newsize >= PyDict_MINSIZE);
 
     oldkeys = mp->ma_keys;
 
@@ -1273,16 +1292,18 @@
 #ifdef Py_REF_DEBUG
         _Py_RefTotal--;
 #endif
-#if PyDict_MAXFREELIST > 0
-        if (oldkeys->dk_size == PyDict_MINSIZE &&
-            numfreekeys < PyDict_MAXFREELIST)
-        {
-            keys_free_list[numfreekeys++] = oldkeys;
-        }
-        else
+        struct _Py_dict_state *state = get_dict_state();
+#ifdef Py_DEBUG
+        // dictresize() must not be called after _PyDict_Fini()
+        assert(state->keys_numfree != -1);
 #endif
+        if (oldkeys->dk_size == PyDict_MINSIZE &&
+            state->keys_numfree < PyDict_MAXFREELIST)
         {
-            PyObject_FREE(oldkeys);
+            state->keys_free_list[state->keys_numfree++] = oldkeys;
+        }
+        else {
+            PyObject_Free(oldkeys);
         }
     }
 
@@ -1354,13 +1375,8 @@
         newsize = max_presize;
     }
     else {
-        Py_ssize_t minsize = ESTIMATE_SIZE(minused);
-        newsize = PyDict_MINSIZE*2;
-        while (newsize < minsize) {
-            newsize <<= 1;
-        }
+        newsize = estimate_keysize(minused);
     }
-    assert(IS_POWER_OF_2(newsize));
 
     new_keys = new_keys_object(newsize);
     if (new_keys == NULL)
@@ -1381,14 +1397,12 @@
 PyObject *
 PyDict_GetItem(PyObject *op, PyObject *key)
 {
-    Py_hash_t hash;
-    Py_ssize_t ix;
-    PyDictObject *mp = (PyDictObject *)op;
-    PyThreadState *tstate;
-    PyObject *value;
-
-    if (!PyDict_Check(op))
+    if (!PyDict_Check(op)) {
         return NULL;
+    }
+    PyDictObject *mp = (PyDictObject *)op;
+
+    Py_hash_t hash;
     if (!PyUnicode_CheckExact(key) ||
         (hash = ((PyASCIIObject *) key)->hash) == -1)
     {
@@ -1399,32 +1413,68 @@
         }
     }
 
-    /* We can arrive here with a NULL tstate during initialization: try
-       running "python -Wi" for an example related to string interning.
-       Let's just hope that no exception occurs then...  This must be
-       _PyThreadState_GET() and not PyThreadState_Get() because the latter
-       abort Python if tstate is NULL. */
-    tstate = _PyThreadState_GET();
-    if (tstate != NULL && tstate->curexc_type != NULL) {
-        /* preserve the existing exception */
-        PyObject *err_type, *err_value, *err_tb;
-        PyErr_Fetch(&err_type, &err_value, &err_tb);
-        ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value);
-        /* ignore errors */
-        PyErr_Restore(err_type, err_value, err_tb);
-        if (ix < 0)
-            return NULL;
-    }
-    else {
-        ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value);
-        if (ix < 0) {
-            PyErr_Clear();
-            return NULL;
-        }
+    PyThreadState *tstate = _PyThreadState_GET();
+#ifdef Py_DEBUG
+    // bpo-40839: Before Python 3.10, it was possible to call PyDict_GetItem()
+    // with the GIL released.
+    _Py_EnsureTstateNotNULL(tstate);
+#endif
+
+    /* Preserve the existing exception */
+    PyObject *exc_type, *exc_value, *exc_tb;
+    PyObject *value;
+    Py_ssize_t ix;
+
+    _PyErr_Fetch(tstate, &exc_type, &exc_value, &exc_tb);
+    ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value);
+
+    /* Ignore any exception raised by the lookup */
+    _PyErr_Restore(tstate, exc_type, exc_value, exc_tb);
+
+    if (ix < 0) {
+        return NULL;
     }
     return value;
 }
 
+Py_ssize_t
+_PyDict_GetItemHint(PyDictObject *mp, PyObject *key,
+                    Py_ssize_t hint, PyObject **value)
+{
+    assert(*value == NULL);
+    assert(PyDict_CheckExact((PyObject*)mp));
+    assert(PyUnicode_CheckExact(key));
+
+    if (hint >= 0 && hint < mp->ma_keys->dk_nentries) {
+        PyObject *res = NULL;
+
+        PyDictKeyEntry *ep = DK_ENTRIES(mp->ma_keys) + (size_t)hint;
+        if (ep->me_key == key) {
+            if (mp->ma_keys->dk_lookup == lookdict_split) {
+                assert(mp->ma_values != NULL);
+                res = mp->ma_values[(size_t)hint];
+            }
+            else {
+                res = ep->me_value;
+            }
+            if (res != NULL) {
+                *value = res;
+                return hint;
+            }
+        }
+    }
+
+    Py_hash_t hash = ((PyASCIIObject *) key)->hash;
+    if (hash == -1) {
+        hash = PyObject_Hash(key);
+        if (hash == -1) {
+            return -1;
+        }
+    }
+
+    return (mp->ma_keys->dk_lookup)(mp, key, hash, value);
+}
+
 /* Same as PyDict_GetItemWithError() but with hash supplied by caller.
    This returns NULL *with* an exception set if an exception occurred.
    It returns NULL *without* an exception set if the key wasn't present.
@@ -1933,7 +1983,7 @@
             PyObject *key;
             Py_hash_t hash;
 
-            if (dictresize(mp, ESTIMATE_SIZE(PyDict_GET_SIZE(iterable)))) {
+            if (dictresize(mp, estimate_keysize(PyDict_GET_SIZE(iterable)))) {
                 Py_DECREF(d);
                 return NULL;
             }
@@ -1952,7 +2002,7 @@
             PyObject *key;
             Py_hash_t hash;
 
-            if (dictresize(mp, ESTIMATE_SIZE(PySet_GET_SIZE(iterable)))) {
+            if (dictresize(mp, estimate_keysize(PySet_GET_SIZE(iterable)))) {
                 Py_DECREF(d);
                 return NULL;
             }
@@ -2025,13 +2075,15 @@
         assert(keys->dk_refcnt == 1);
         dictkeys_decref(keys);
     }
-#if PyDict_MAXFREELIST > 0
-    if (numfree < PyDict_MAXFREELIST && Py_IS_TYPE(mp, &PyDict_Type)) {
-        free_list[numfree++] = mp;
-    }
-    else
+    struct _Py_dict_state *state = get_dict_state();
+#ifdef Py_DEBUG
+    // new_dict() must not be called after _PyDict_Fini()
+    assert(state->numfree != -1);
 #endif
-    {
+    if (state->numfree < PyDict_MAXFREELIST && Py_IS_TYPE(mp, &PyDict_Type)) {
+        state->free_list[state->numfree++] = mp;
+    }
+    else {
         Py_TYPE(mp)->tp_free((PyObject *)mp);
     }
     Py_TRASHCAN_END
@@ -2465,8 +2517,8 @@
                 goto Fail;
             }
         }
-        else if (PyDict_GetItemWithError(d, key) == NULL) {
-            if (PyErr_Occurred() || PyDict_SetItem(d, key, value) < 0) {
+        else {
+            if (PyDict_SetDefault(d, key, value) == NULL) {
                 Py_DECREF(key);
                 Py_DECREF(value);
                 goto Fail;
@@ -2515,18 +2567,51 @@
         if (other == mp || other->ma_used == 0)
             /* a.update(a) or a.update({}); nothing to do */
             return 0;
-        if (mp->ma_used == 0)
+        if (mp->ma_used == 0) {
             /* Since the target dict is empty, PyDict_GetItem()
              * always returns NULL.  Setting override to 1
              * skips the unnecessary test.
              */
             override = 1;
+            PyDictKeysObject *okeys = other->ma_keys;
+
+            // If other is clean, combined, and just allocated, just clone it.
+            if (other->ma_values == NULL &&
+                    other->ma_used == okeys->dk_nentries &&
+                    (okeys->dk_size == PyDict_MINSIZE ||
+                     USABLE_FRACTION(okeys->dk_size/2) < other->ma_used)) {
+                PyDictKeysObject *keys = clone_combined_dict_keys(other);
+                if (keys == NULL) {
+                    return -1;
+                }
+
+                dictkeys_decref(mp->ma_keys);
+                mp->ma_keys = keys;
+                if (mp->ma_values != NULL) {
+                    if (mp->ma_values != empty_values) {
+                        free_values(mp->ma_values);
+                    }
+                    mp->ma_values = NULL;
+                }
+
+                mp->ma_used = other->ma_used;
+                mp->ma_version_tag = DICT_NEXT_VERSION();
+                ASSERT_CONSISTENT(mp);
+
+                if (_PyObject_GC_IS_TRACKED(other) && !_PyObject_GC_IS_TRACKED(mp)) {
+                    /* Maintain tracking. */
+                    _PyObject_GC_TRACK(mp);
+                }
+
+                return 0;
+            }
+        }
         /* Do one big resize at the start, rather than
          * incrementally resizing as we insert new items.  Expect
          * that there will be no (or few) overlapping keys.
          */
         if (USABLE_FRACTION(mp->ma_keys->dk_size) < other->ma_used) {
-            if (dictresize(mp, ESTIMATE_SIZE(mp->ma_used + other->ma_used))) {
+            if (dictresize(mp, estimate_keysize(mp->ma_used + other->ma_used))) {
                return -1;
             }
         }
@@ -2548,19 +2633,20 @@
                 Py_INCREF(value);
                 if (override == 1)
                     err = insertdict(mp, key, hash, value);
-                else if (_PyDict_GetItem_KnownHash(a, key, hash) == NULL) {
-                    if (PyErr_Occurred()) {
-                        Py_DECREF(value);
-                        Py_DECREF(key);
-                        return -1;
+                else {
+                    err = _PyDict_Contains_KnownHash(a, key, hash);
+                    if (err == 0) {
+                        err = insertdict(mp, key, hash, value);
                     }
-                    err = insertdict(mp, key, hash, value);
-                }
-                else if (override != 0) {
-                    _PyErr_SetKeyError(key);
-                    Py_DECREF(value);
-                    Py_DECREF(key);
-                    return -1;
+                    else if (err > 0) {
+                        if (override != 0) {
+                            _PyErr_SetKeyError(key);
+                            Py_DECREF(value);
+                            Py_DECREF(key);
+                            return -1;
+                        }
+                        err = 0;
+                    }
                 }
                 Py_DECREF(value);
                 Py_DECREF(key);
@@ -2597,18 +2683,16 @@
 
         for (key = PyIter_Next(iter); key; key = PyIter_Next(iter)) {
             if (override != 1) {
-                if (PyDict_GetItemWithError(a, key) != NULL) {
-                    if (override != 0) {
+                status = PyDict_Contains(a, key);
+                if (status != 0) {
+                    if (status > 0) {
+                        if (override == 0) {
+                            Py_DECREF(key);
+                            continue;
+                        }
                         _PyErr_SetKeyError(key);
-                        Py_DECREF(key);
-                        Py_DECREF(iter);
-                        return -1;
                     }
                     Py_DECREF(key);
-                    continue;
-                }
-                else if (PyErr_Occurred()) {
-                    Py_DECREF(key);
                     Py_DECREF(iter);
                     return -1;
                 }
@@ -2706,12 +2790,13 @@
         return (PyObject *)split_copy;
     }
 
-    if (PyDict_CheckExact(mp) && mp->ma_values == NULL &&
+    if (Py_TYPE(mp)->tp_iter == (getiterfunc)dict_iter &&
+            mp->ma_values == NULL &&
             (mp->ma_used >= (mp->ma_keys->dk_nentries * 2) / 3))
     {
         /* Use fast-copy if:
 
-           (1) 'mp' is an instance of a subclassed dict; and
+           (1) type(mp) doesn't override tp_iter; and
 
            (2) 'mp' is not a split-dict; and
 
@@ -2723,13 +2808,31 @@
            operations and copied after that.  In cases like this, we defer to
            PyDict_Merge, which produces a compacted copy.
         */
-        return clone_combined_dict(mp);
+        PyDictKeysObject *keys = clone_combined_dict_keys(mp);
+        if (keys == NULL) {
+            return NULL;
+        }
+        PyDictObject *new = (PyDictObject *)new_dict(keys, NULL);
+        if (new == NULL) {
+            /* In case of an error, `new_dict()` takes care of
+               cleaning up `keys`. */
+            return NULL;
+        }
+
+        new->ma_used = mp->ma_used;
+        ASSERT_CONSISTENT(new);
+        if (_PyObject_GC_IS_TRACKED(mp)) {
+            /* Maintain tracking. */
+            _PyObject_GC_TRACK(new);
+        }
+
+        return (PyObject *)new;
     }
 
     copy = PyDict_New();
     if (copy == NULL)
         return NULL;
-    if (PyDict_Merge(copy, o, 1) == 0)
+    if (dict_merge(copy, o, 1) == 0)
         return copy;
     Py_DECREF(copy);
     return NULL;
@@ -2965,6 +3068,9 @@
                 return NULL;
             }
         }
+        if (!PyUnicode_CheckExact(key) && mp->ma_keys->dk_lookup != lookdict) {
+            mp->ma_keys->dk_lookup = lookdict;
+        }
         Py_ssize_t hashpos = find_empty_slot(mp->ma_keys, hash);
         ep0 = DK_ENTRIES(mp->ma_keys);
         ep = &ep0[mp->ma_keys->dk_nentries];
@@ -3042,12 +3148,13 @@
 
 D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
 
-If key is not found, default is returned if given, otherwise KeyError is raised
+If the key is not found, return the default if given; otherwise,
+raise a KeyError.
 [clinic start generated code]*/
 
 static PyObject *
 dict_pop_impl(PyDictObject *self, PyObject *key, PyObject *default_value)
-/*[clinic end generated code: output=3abb47b89f24c21c input=eeebec7812190348]*/
+/*[clinic end generated code: output=3abb47b89f24c21c input=e221baa01044c44c]*/
 {
     return _PyDict_Pop((PyObject*)self, key, default_value);
 }
@@ -3302,7 +3409,7 @@
 
 /* Internal version of PyDict_Contains used when the hash value is already known */
 int
-_PyDict_Contains(PyObject *op, PyObject *key, Py_hash_t hash)
+_PyDict_Contains_KnownHash(PyObject *op, PyObject *key, Py_hash_t hash)
 {
     PyDictObject *mp = (PyDictObject *)op;
     PyObject *value;
@@ -3314,6 +3421,16 @@
     return (ix != DKIX_EMPTY && value != NULL);
 }
 
+int
+_PyDict_ContainsId(PyObject *op, struct _Py_Identifier *key)
+{
+    PyObject *kv = _PyUnicode_FromId(key); /* borrowed */
+    if (kv == NULL) {
+        return -1;
+    }
+    return PyDict_Contains(op, kv);
+}
+
 /* Hack to implement "key in dict" */
 static PySequenceMethods dict_as_sequence = {
     0,                          /* sq_length */
@@ -3346,16 +3463,15 @@
     d = (PyDictObject *)self;
 
     /* The object has been implicitly tracked by tp_alloc */
-    if (type == &PyDict_Type)
+    if (type == &PyDict_Type) {
         _PyObject_GC_UNTRACK(d);
+    }
 
     d->ma_used = 0;
     d->ma_version_tag = DICT_NEXT_VERSION();
-    d->ma_keys = new_keys_object(PyDict_MINSIZE);
-    if (d->ma_keys == NULL) {
-        Py_DECREF(self);
-        return NULL;
-    }
+    dictkeys_incref(Py_EMPTY_KEYS);
+    d->ma_keys = Py_EMPTY_KEYS;
+    d->ma_values = empty_values;
     ASSERT_CONSISTENT(d);
     return self;
 }
@@ -3436,7 +3552,8 @@
     0,                                          /* tp_setattro */
     0,                                          /* tp_as_buffer */
     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
-        Py_TPFLAGS_BASETYPE | Py_TPFLAGS_DICT_SUBCLASS,         /* tp_flags */
+        Py_TPFLAGS_BASETYPE | Py_TPFLAGS_DICT_SUBCLASS |
+        _Py_TPFLAGS_MATCH_SELF | Py_TPFLAGS_MAPPING,  /* tp_flags */
     dictionary_doc,                             /* tp_doc */
     dict_traverse,                              /* tp_traverse */
     dict_tp_clear,                              /* tp_clear */
@@ -3459,18 +3576,6 @@
     .tp_vectorcall = dict_vectorcall,
 };
 
-PyObject *
-_PyDict_GetItemId(PyObject *dp, struct _Py_Identifier *key)
-{
-    PyObject *kv;
-    kv = _PyUnicode_FromId(key); /* borrowed */
-    if (kv == NULL) {
-        PyErr_Clear();
-        return NULL;
-    }
-    return PyDict_GetItem(dp, kv);
-}
-
 /* For backward compatibility with old dictionary interface */
 
 PyObject *
@@ -3861,6 +3966,11 @@
         Py_INCREF(result);
         Py_DECREF(oldkey);
         Py_DECREF(oldvalue);
+        // bpo-42536: The GC may have untracked this result tuple. Since we're
+        // recycling it, make sure it's tracked again:
+        if (!_PyObject_GC_IS_TRACKED(result)) {
+            _PyObject_GC_TRACK(result);
+        }
     }
     else {
         result = PyTuple_New(2);
@@ -3976,6 +4086,11 @@
             Py_INCREF(result);
             Py_DECREF(oldkey);
             Py_DECREF(oldvalue);
+            // bpo-42536: The GC may have untracked this result tuple. Since
+            // we're recycling it, make sure it's tracked again:
+            if (!_PyObject_GC_IS_TRACKED(result)) {
+                _PyObject_GC_TRACK(result);
+            }
         }
         else {
             result = PyTuple_New(2);
@@ -4119,6 +4234,22 @@
     return (PyObject *)dv;
 }
 
+static PyObject *
+dictview_mapping(PyObject *view, void *Py_UNUSED(ignored)) {
+    assert(view != NULL);
+    assert(PyDictKeys_Check(view)
+           || PyDictValues_Check(view)
+           || PyDictItems_Check(view));
+    PyObject *mapping = (PyObject *)((_PyDictViewObject *)view)->dv_dict;
+    return PyDictProxy_New(mapping);
+}
+
+static PyGetSetDef dictview_getset[] = {
+    {"mapping", dictview_mapping, (setter)NULL,
+     "dictionary that this view refers to", NULL},
+    {0}
+};
+
 /* TODO(guido): The views objects are not complete:
 
  * support more set operations
@@ -4328,7 +4459,7 @@
 
     /* if other is a set and self is smaller than other,
        reuse set intersection logic */
-    if (Py_IS_TYPE(other, &PySet_Type) && len_self <= PyObject_Size(other)) {
+    if (PySet_CheckExact(other) && len_self <= PyObject_Size(other)) {
         _Py_IDENTIFIER(intersection);
         return _PyObject_CallMethodIdObjArgs(other, &PyId_intersection, self, NULL);
     }
@@ -4406,9 +4537,99 @@
     return result;
 }
 
+static PyObject *
+dictitems_xor(PyObject *self, PyObject *other)
+{
+    assert(PyDictItems_Check(self));
+    assert(PyDictItems_Check(other));
+    PyObject *d1 = (PyObject *)((_PyDictViewObject *)self)->dv_dict;
+    PyObject *d2 = (PyObject *)((_PyDictViewObject *)other)->dv_dict;
+
+    PyObject *temp_dict = PyDict_Copy(d1);
+    if (temp_dict == NULL) {
+        return NULL;
+    }
+    PyObject *result_set = PySet_New(NULL);
+    if (result_set == NULL) {
+        Py_CLEAR(temp_dict);
+        return NULL;
+    }
+
+    PyObject *key = NULL, *val1 = NULL, *val2 = NULL;
+    Py_ssize_t pos = 0;
+    Py_hash_t hash;
+
+    while (_PyDict_Next(d2, &pos, &key, &val2, &hash)) {
+        Py_INCREF(key);
+        Py_INCREF(val2);
+        val1 = _PyDict_GetItem_KnownHash(temp_dict, key, hash);
+
+        int to_delete;
+        if (val1 == NULL) {
+            if (PyErr_Occurred()) {
+                goto error;
+            }
+            to_delete = 0;
+        }
+        else {
+            Py_INCREF(val1);
+            to_delete = PyObject_RichCompareBool(val1, val2, Py_EQ);
+            if (to_delete < 0) {
+                goto error;
+            }
+        }
+
+        if (to_delete) {
+            if (_PyDict_DelItem_KnownHash(temp_dict, key, hash) < 0) {
+                goto error;
+            }
+        }
+        else {
+            PyObject *pair = PyTuple_Pack(2, key, val2);
+            if (pair == NULL) {
+                goto error;
+            }
+            if (PySet_Add(result_set, pair) < 0) {
+                Py_DECREF(pair);
+                goto error;
+            }
+            Py_DECREF(pair);
+        }
+        Py_DECREF(key);
+        Py_XDECREF(val1);
+        Py_DECREF(val2);
+    }
+    key = val1 = val2 = NULL;
+
+    _Py_IDENTIFIER(items);
+    PyObject *remaining_pairs = _PyObject_CallMethodIdNoArgs(temp_dict,
+                                                             &PyId_items);
+    if (remaining_pairs == NULL) {
+        goto error;
+    }
+    if (_PySet_Update(result_set, remaining_pairs) < 0) {
+        Py_DECREF(remaining_pairs);
+        goto error;
+    }
+    Py_DECREF(temp_dict);
+    Py_DECREF(remaining_pairs);
+    return result_set;
+
+error:
+    Py_XDECREF(temp_dict);
+    Py_XDECREF(result_set);
+    Py_XDECREF(key);
+    Py_XDECREF(val1);
+    Py_XDECREF(val2);
+    return NULL;
+}
+
 static PyObject*
 dictviews_xor(PyObject* self, PyObject *other)
 {
+    if (PyDictItems_Check(self) && PyDictItems_Check(other)) {
+        return dictitems_xor(self, other);
+    }
     PyObject *result = dictviews_to_set(self);
     if (result == NULL) {
         return NULL;
@@ -4542,7 +4763,7 @@
     (getiterfunc)dictkeys_iter,                 /* tp_iter */
     0,                                          /* tp_iternext */
     dictkeys_methods,                           /* tp_methods */
-    0,
+    .tp_getset = dictview_getset,
 };
 
 static PyObject *
@@ -4605,7 +4826,7 @@
     (objobjproc)dictitems_contains,     /* sq_contains */
 };
 
-static PyObject* dictitems_reversed(_PyDictViewObject *dv);
+static PyObject* dictitems_reversed(_PyDictViewObject *dv, PyObject *Py_UNUSED(ignored));
 
 PyDoc_STRVAR(reversed_items_doc,
 "Return a reverse iterator over the dict items.");
@@ -4613,7 +4834,7 @@
 static PyMethodDef dictitems_methods[] = {
     {"isdisjoint",      (PyCFunction)dictviews_isdisjoint,  METH_O,
      isdisjoint_doc},
-    {"__reversed__",    (PyCFunction)(void(*)(void))dictitems_reversed,    METH_NOARGS,
+    {"__reversed__",    (PyCFunction)dictitems_reversed,    METH_NOARGS,
      reversed_items_doc},
     {NULL,              NULL}           /* sentinel */
 };
@@ -4648,7 +4869,7 @@
     (getiterfunc)dictitems_iter,                /* tp_iter */
     0,                                          /* tp_iternext */
     dictitems_methods,                          /* tp_methods */
-    0,
+    .tp_getset = dictview_getset,
 };
 
 static PyObject *
@@ -4658,7 +4879,7 @@
 }
 
 static PyObject *
-dictitems_reversed(_PyDictViewObject *dv)
+dictitems_reversed(_PyDictViewObject *dv, PyObject *Py_UNUSED(ignored))
 {
     if (dv->dv_dict == NULL) {
         Py_RETURN_NONE;
@@ -4688,13 +4909,13 @@
     (objobjproc)0,                      /* sq_contains */
 };
 
-static PyObject* dictvalues_reversed(_PyDictViewObject *dv);
+static PyObject* dictvalues_reversed(_PyDictViewObject *dv, PyObject *Py_UNUSED(ignored));
 
 PyDoc_STRVAR(reversed_values_doc,
 "Return a reverse iterator over the dict values.");
 
 static PyMethodDef dictvalues_methods[] = {
-    {"__reversed__",    (PyCFunction)(void(*)(void))dictvalues_reversed,    METH_NOARGS,
+    {"__reversed__",    (PyCFunction)dictvalues_reversed,    METH_NOARGS,
      reversed_values_doc},
     {NULL,              NULL}           /* sentinel */
 };
@@ -4729,7 +4950,7 @@
     (getiterfunc)dictvalues_iter,               /* tp_iter */
     0,                                          /* tp_iternext */
     dictvalues_methods,                         /* tp_methods */
-    0,
+    .tp_getset = dictview_getset,
 };
 
 static PyObject *
@@ -4739,7 +4960,7 @@
 }
 
 static PyObject *
-dictvalues_reversed(_PyDictViewObject *dv)
+dictvalues_reversed(_PyDictViewObject *dv, PyObject *Py_UNUSED(ignored))
 {
     if (dv->dv_dict == NULL) {
         Py_RETURN_NONE;
@@ -4754,10 +4975,12 @@
 _PyDict_NewKeysForClass(void)
 {
     PyDictKeysObject *keys = new_keys_object(PyDict_MINSIZE);
-    if (keys == NULL)
+    if (keys == NULL) {
         PyErr_Clear();
-    else
+    }
+    else {
         keys->dk_lookup = lookdict_split;
+    }
     return keys;
 }
 
diff --git a/Objects/enumobject.c b/Objects/enumobject.c
index 4a83bb4..98ece3f 100644
--- a/Objects/enumobject.c
+++ b/Objects/enumobject.c
@@ -1,6 +1,8 @@
 /* enumerate object */
 
 #include "Python.h"
+#include "pycore_long.h"          // _PyLong_GetOne()
+#include "pycore_object.h"        // _PyObject_GC_TRACK()
 
 #include "clinic/enumobject.c.h"
 
@@ -115,7 +117,7 @@
     }
     next_index = en->en_longindex;
     assert(next_index != NULL);
-    stepped_up = PyNumber_Add(next_index, _PyLong_One);
+    stepped_up = PyNumber_Add(next_index, _PyLong_GetOne());
     if (stepped_up == NULL) {
         Py_DECREF(next_item);
         return NULL;
@@ -130,6 +132,11 @@
         PyTuple_SET_ITEM(result, 1, next_item);
         Py_DECREF(old_index);
         Py_DECREF(old_item);
+        // bpo-42536: The GC may have untracked this result tuple. Since we're
+        // recycling it, make sure it's tracked again:
+        if (!_PyObject_GC_IS_TRACKED(result)) {
+            _PyObject_GC_TRACK(result);
+        }
         return result;
     }
     result = PyTuple_New(2);
@@ -175,6 +182,11 @@
         PyTuple_SET_ITEM(result, 1, next_item);
         Py_DECREF(old_index);
         Py_DECREF(old_item);
+        // bpo-42536: The GC may have untracked this result tuple. Since we're
+        // recycling it, make sure it's tracked again:
+        if (!_PyObject_GC_IS_TRACKED(result)) {
+            _PyObject_GC_TRACK(result);
+        }
         return result;
     }
     result = PyTuple_New(2);
@@ -314,6 +326,24 @@
     return (PyObject *)ro;
 }
 
+static PyObject *
+reversed_vectorcall(PyObject *type, PyObject * const*args,
+                size_t nargsf, PyObject *kwnames)
+{
+    assert(PyType_Check(type));
+
+    if (!_PyArg_NoKwnames("reversed", kwnames)) {
+        return NULL;
+    }
+
+    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
+    if (!_PyArg_CheckPositional("reversed", nargs, 1, 1)) {
+        return NULL;
+    }
+
+    return reversed_new_impl((PyTypeObject *)type, args[0]);
+}
+
 static void
 reversed_dealloc(reversedobject *ro)
 {
@@ -445,4 +475,5 @@
     PyType_GenericAlloc,            /* tp_alloc */
     reversed_new,                   /* tp_new */
     PyObject_GC_Del,                /* tp_free */
+    .tp_vectorcall = (vectorcallfunc)reversed_vectorcall,
 };
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index e44ce72..6537a7c 100644
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -19,8 +19,13 @@
 PyObject *PyExc_WindowsError = NULL;
 #endif
 
-/* The dict map from errno codes to OSError subclasses */
-static PyObject *errnomap = NULL;
+
+static struct _Py_exc_state*
+get_exc_state(void)
+{
+    PyInterpreterState *interp = _PyInterpreterState_GET();
+    return &interp->exc_state;
+}
 
 
 /* NOTE: If the exception class hierarchy changes, don't forget to update
@@ -359,8 +364,6 @@
     Py_XSETREF(_PyBaseExceptionObject_cast(self)->context, context);
 }
 
-#undef PyExceptionClass_Name
-
 const char *
 PyExceptionClass_Name(PyObject *ob)
 {
@@ -985,10 +988,11 @@
             ))
             goto error;
 
+        struct _Py_exc_state *state = get_exc_state();
         if (myerrno && PyLong_Check(myerrno) &&
-            errnomap && (PyObject *) type == PyExc_OSError) {
+            state->errnomap && (PyObject *) type == PyExc_OSError) {
             PyObject *newtype;
-            newtype = PyDict_GetItemWithError(errnomap, myerrno);
+            newtype = PyDict_GetItemWithError(state->errnomap, myerrno);
             if (newtype) {
                 assert(PyType_Check(newtype));
                 type = (PyTypeObject *) newtype;
@@ -1322,29 +1326,155 @@
 /*
  *    NameError extends Exception
  */
-SimpleExtendsException(PyExc_Exception, NameError,
-                       "Name not found globally.");
+
+static int
+NameError_init(PyNameErrorObject *self, PyObject *args, PyObject *kwds)
+{
+    static char *kwlist[] = {"name", NULL};
+    PyObject *name = NULL;
+
+    if (BaseException_init((PyBaseExceptionObject *)self, args, NULL) == -1) {
+        return -1;
+    }
+
+    PyObject *empty_tuple = PyTuple_New(0);
+    if (!empty_tuple) {
+        return -1;
+    }
+    if (!PyArg_ParseTupleAndKeywords(empty_tuple, kwds, "|$O:NameError", kwlist,
+                                     &name)) {
+        Py_DECREF(empty_tuple);
+        return -1;
+    }
+    Py_DECREF(empty_tuple);
+
+    Py_XINCREF(name);
+    Py_XSETREF(self->name, name);
+
+    return 0;
+}
+
+static int
+NameError_clear(PyNameErrorObject *self)
+{
+    Py_CLEAR(self->name);
+    return BaseException_clear((PyBaseExceptionObject *)self);
+}
+
+static void
+NameError_dealloc(PyNameErrorObject *self)
+{
+    _PyObject_GC_UNTRACK(self);
+    NameError_clear(self);
+    Py_TYPE(self)->tp_free((PyObject *)self);
+}
+
+static int
+NameError_traverse(PyNameErrorObject *self, visitproc visit, void *arg)
+{
+    Py_VISIT(self->name);
+    return BaseException_traverse((PyBaseExceptionObject *)self, visit, arg);
+}
+
+static PyMemberDef NameError_members[] = {
+        {"name", T_OBJECT, offsetof(PyNameErrorObject, name), 0, PyDoc_STR("name")},
+        {NULL}  /* Sentinel */
+};
+
+static PyMethodDef NameError_methods[] = {
+        {NULL}  /* Sentinel */
+};
+
+ComplexExtendsException(PyExc_Exception, NameError,
+                        NameError, 0,
+                        NameError_methods, NameError_members,
+                        0, BaseException_str, "Name not found globally.");
 
 /*
  *    UnboundLocalError extends NameError
  */
-SimpleExtendsException(PyExc_NameError, UnboundLocalError,
+
+MiddlingExtendsException(PyExc_NameError, UnboundLocalError, NameError,
                        "Local name referenced but not bound to a value.");
 
 /*
  *    AttributeError extends Exception
  */
-SimpleExtendsException(PyExc_Exception, AttributeError,
-                       "Attribute not found.");
 
+static int
+AttributeError_init(PyAttributeErrorObject *self, PyObject *args, PyObject *kwds)
+{
+    static char *kwlist[] = {"name", "obj", NULL};
+    PyObject *name = NULL;
+    PyObject *obj = NULL;
+
+    if (BaseException_init((PyBaseExceptionObject *)self, args, NULL) == -1) {
+        return -1;
+    }
+
+    PyObject *empty_tuple = PyTuple_New(0);
+    if (!empty_tuple) {
+        return -1;
+    }
+    if (!PyArg_ParseTupleAndKeywords(empty_tuple, kwds, "|$OO:AttributeError", kwlist,
+                                     &name, &obj)) {
+        Py_DECREF(empty_tuple);
+        return -1;
+    }
+    Py_DECREF(empty_tuple);
+
+    Py_XINCREF(name);
+    Py_XSETREF(self->name, name);
+
+    Py_XINCREF(obj);
+    Py_XSETREF(self->obj, obj);
+
+    return 0;
+}
+
+static int
+AttributeError_clear(PyAttributeErrorObject *self)
+{
+    Py_CLEAR(self->obj);
+    Py_CLEAR(self->name);
+    return BaseException_clear((PyBaseExceptionObject *)self);
+}
+
+static void
+AttributeError_dealloc(PyAttributeErrorObject *self)
+{
+    _PyObject_GC_UNTRACK(self);
+    AttributeError_clear(self);
+    Py_TYPE(self)->tp_free((PyObject *)self);
+}
+
+static int
+AttributeError_traverse(PyAttributeErrorObject *self, visitproc visit, void *arg)
+{
+    Py_VISIT(self->obj);
+    Py_VISIT(self->name);
+    return BaseException_traverse((PyBaseExceptionObject *)self, visit, arg);
+}
+
+static PyMemberDef AttributeError_members[] = {
+    {"name", T_OBJECT, offsetof(PyAttributeErrorObject, name), 0, PyDoc_STR("attribute name")},
+    {"obj", T_OBJECT, offsetof(PyAttributeErrorObject, obj), 0, PyDoc_STR("object")},
+    {NULL}  /* Sentinel */
+};
+
+static PyMethodDef AttributeError_methods[] = {
+    {NULL}  /* Sentinel */
+};
+
+ComplexExtendsException(PyExc_Exception, AttributeError,
+                        AttributeError, 0,
+                        AttributeError_methods, AttributeError_members,
+                        0, BaseException_str, "Attribute not found.");
 
 /*
  *    SyntaxError extends Exception
  */
 
-/* Helper function to customize error message for some syntax errors */
-static int _report_missing_parentheses(PySyntaxErrorObject *self);
-
 static int
 SyntaxError_init(PySyntaxErrorObject *self, PyObject *args, PyObject *kwds)
 {
@@ -1361,39 +1491,30 @@
     if (lenargs == 2) {
         info = PyTuple_GET_ITEM(args, 1);
         info = PySequence_Tuple(info);
-        if (!info)
+        if (!info) {
             return -1;
+        }
 
-        if (PyTuple_GET_SIZE(info) != 4) {
-            /* not a very good error message, but it's what Python 2.4 gives */
-            PyErr_SetString(PyExc_IndexError, "tuple index out of range");
+        self->end_lineno = NULL;
+        self->end_offset = NULL;
+        if (!PyArg_ParseTuple(info, "OOOO|OO",
+                              &self->filename, &self->lineno,
+                              &self->offset, &self->text,
+                              &self->end_lineno, &self->end_offset)) {
             Py_DECREF(info);
             return -1;
         }
 
-        Py_INCREF(PyTuple_GET_ITEM(info, 0));
-        Py_XSETREF(self->filename, PyTuple_GET_ITEM(info, 0));
-
-        Py_INCREF(PyTuple_GET_ITEM(info, 1));
-        Py_XSETREF(self->lineno, PyTuple_GET_ITEM(info, 1));
-
-        Py_INCREF(PyTuple_GET_ITEM(info, 2));
-        Py_XSETREF(self->offset, PyTuple_GET_ITEM(info, 2));
-
-        Py_INCREF(PyTuple_GET_ITEM(info, 3));
-        Py_XSETREF(self->text, PyTuple_GET_ITEM(info, 3));
-
+        Py_INCREF(self->filename);
+        Py_INCREF(self->lineno);
+        Py_INCREF(self->offset);
+        Py_INCREF(self->text);
+        Py_XINCREF(self->end_lineno);
+        Py_XINCREF(self->end_offset);
         Py_DECREF(info);
 
-        /*
-         * Issue #21669: Custom error for 'print' & 'exec' as statements
-         *
-         * Only applies to SyntaxError instances, not to subclasses such
-         * as TabError or IndentationError (see issue #31161)
-         */
-        if (Py_IS_TYPE(self, (PyTypeObject *)PyExc_SyntaxError) &&
-                self->text && PyUnicode_Check(self->text) &&
-                _report_missing_parentheses(self) < 0) {
+        if (self->end_lineno != NULL && self->end_offset == NULL) {
+            PyErr_SetString(PyExc_TypeError, "end_offset must be provided when end_lineno is provided");
             return -1;
         }
     }
@@ -1407,6 +1528,8 @@
     Py_CLEAR(self->filename);
     Py_CLEAR(self->lineno);
     Py_CLEAR(self->offset);
+    Py_CLEAR(self->end_lineno);
+    Py_CLEAR(self->end_offset);
     Py_CLEAR(self->text);
     Py_CLEAR(self->print_file_and_line);
     return BaseException_clear((PyBaseExceptionObject *)self);
@@ -1427,6 +1550,8 @@
     Py_VISIT(self->filename);
     Py_VISIT(self->lineno);
     Py_VISIT(self->offset);
+    Py_VISIT(self->end_lineno);
+    Py_VISIT(self->end_offset);
     Py_VISIT(self->text);
     Py_VISIT(self->print_file_and_line);
     return BaseException_traverse((PyBaseExceptionObject *)self, visit, arg);
@@ -1517,6 +1642,10 @@
         PyDoc_STR("exception offset")},
     {"text", T_OBJECT, offsetof(PySyntaxErrorObject, text), 0,
         PyDoc_STR("exception text")},
+    {"end_lineno", T_OBJECT, offsetof(PySyntaxErrorObject, end_lineno), 0,
+                   PyDoc_STR("exception end lineno")},
+    {"end_offset", T_OBJECT, offsetof(PySyntaxErrorObject, end_offset), 0,
+                   PyDoc_STR("exception end offset")},
     {"print_file_and_line", T_OBJECT,
         offsetof(PySyntaxErrorObject, print_file_and_line), 0,
         PyDoc_STR("exception print_file_and_line")},
@@ -2274,8 +2403,6 @@
  */
 
 #define MEMERRORS_SAVE 16
-static PyBaseExceptionObject *memerrors_freelist = NULL;
-static int memerrors_numfree = 0;
 
 static PyObject *
 MemoryError_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
@@ -2288,16 +2415,21 @@
         return BaseException_new(type, args, kwds);
     }
 
-    if (memerrors_freelist == NULL)
+    struct _Py_exc_state *state = get_exc_state();
+    if (state->memerrors_freelist == NULL) {
         return BaseException_new(type, args, kwds);
+    }
+
     /* Fetch object from freelist and revive it */
-    self = memerrors_freelist;
+    self = state->memerrors_freelist;
     self->args = PyTuple_New(0);
     /* This shouldn't happen since the empty tuple is persistent */
-    if (self->args == NULL)
+    if (self->args == NULL) {
         return NULL;
-    memerrors_freelist = (PyBaseExceptionObject *) self->dict;
-    memerrors_numfree--;
+    }
+
+    state->memerrors_freelist = (PyBaseExceptionObject *) self->dict;
+    state->memerrors_numfree--;
     self->dict = NULL;
     _Py_NewReference((PyObject *)self);
     _PyObject_GC_TRACK(self);
@@ -2309,18 +2441,23 @@
 {
     BaseException_clear(self);
 
+    /* If this is a subclass of MemoryError, we don't need to
+     * do anything in the free-list*/
     if (!Py_IS_TYPE(self, (PyTypeObject *) PyExc_MemoryError)) {
-        return Py_TYPE(self)->tp_free((PyObject *)self);
+        Py_TYPE(self)->tp_free((PyObject *)self);
+        return;
     }
 
     _PyObject_GC_UNTRACK(self);
 
-    if (memerrors_numfree >= MEMERRORS_SAVE)
+    struct _Py_exc_state *state = get_exc_state();
+    if (state->memerrors_numfree >= MEMERRORS_SAVE) {
         Py_TYPE(self)->tp_free((PyObject *)self);
+    }
     else {
-        self->dict = (PyObject *) memerrors_freelist;
-        memerrors_freelist = self;
-        memerrors_numfree++;
+        self->dict = (PyObject *) state->memerrors_freelist;
+        state->memerrors_freelist = self;
+        state->memerrors_numfree++;
     }
 }
 
@@ -2345,11 +2482,11 @@
 }
 
 static void
-free_preallocated_memerrors(void)
+free_preallocated_memerrors(struct _Py_exc_state *state)
 {
-    while (memerrors_freelist != NULL) {
-        PyObject *self = (PyObject *) memerrors_freelist;
-        memerrors_freelist = (PyBaseExceptionObject *) memerrors_freelist->dict;
+    while (state->memerrors_freelist != NULL) {
+        PyObject *self = (PyObject *) state->memerrors_freelist;
+        state->memerrors_freelist = (PyBaseExceptionObject *)state->memerrors_freelist->dict;
         Py_TYPE(self)->tp_free((PyObject *)self);
     }
 }
@@ -2453,6 +2590,13 @@
 
 
 /*
+ *    EncodingWarning extends Warning
+ */
+SimpleExtendsException(PyExc_Warning, EncodingWarning,
+    "Base class for warnings about encodings.");
+
+
+/*
  *    ResourceWarning extends Warning
  */
 SimpleExtendsException(PyExc_Warning, ResourceWarning,
@@ -2517,8 +2661,10 @@
 #endif /* MS_WINDOWS */
 
 PyStatus
-_PyExc_Init(void)
+_PyExc_Init(PyInterpreterState *interp)
 {
+    struct _Py_exc_state *state = &interp->exc_state;
+
 #define PRE_INIT(TYPE) \
     if (!(_PyExc_ ## TYPE.tp_flags & Py_TPFLAGS_READY)) { \
         if (PyType_Ready(&_PyExc_ ## TYPE) < 0) { \
@@ -2531,8 +2677,10 @@
     do { \
         PyObject *_code = PyLong_FromLong(CODE); \
         assert(_PyObject_RealIsSubclass(PyExc_ ## TYPE, PyExc_OSError)); \
-        if (!_code || PyDict_SetItem(errnomap, _code, PyExc_ ## TYPE)) \
+        if (!_code || PyDict_SetItem(state->errnomap, _code, PyExc_ ## TYPE)) { \
+            Py_XDECREF(_code); \
             return _PyStatus_ERR("errmap insertion problem."); \
+        } \
         Py_DECREF(_code); \
     } while (0)
 
@@ -2576,6 +2724,7 @@
     PRE_INIT(BufferError);
     PRE_INIT(Warning);
     PRE_INIT(UserWarning);
+    PRE_INIT(EncodingWarning);
     PRE_INIT(DeprecationWarning);
     PRE_INIT(PendingDeprecationWarning);
     PRE_INIT(SyntaxWarning);
@@ -2605,15 +2754,14 @@
     PRE_INIT(TimeoutError);
 
     if (preallocate_memerrors() < 0) {
-        return _PyStatus_ERR("Could not preallocate MemoryError object");
+        return _PyStatus_NO_MEMORY();
     }
 
     /* Add exceptions to errnomap */
-    if (!errnomap) {
-        errnomap = PyDict_New();
-        if (!errnomap) {
-            return _PyStatus_ERR("Cannot allocate map from errnos to OSError subclasses");
-        }
+    assert(state->errnomap == NULL);
+    state->errnomap = PyDict_New();
+    if (!state->errnomap) {
+        return _PyStatus_NO_MEMORY();
     }
 
     ADD_ERRNO(BlockingIOError, EAGAIN);
@@ -2716,6 +2864,7 @@
     POST_INIT(BufferError);
     POST_INIT(Warning);
     POST_INIT(UserWarning);
+    POST_INIT(EncodingWarning);
     POST_INIT(DeprecationWarning);
     POST_INIT(PendingDeprecationWarning);
     POST_INIT(SyntaxWarning);
@@ -2751,10 +2900,11 @@
 }
 
 void
-_PyExc_Fini(void)
+_PyExc_Fini(PyInterpreterState *interp)
 {
-    free_preallocated_memerrors();
-    Py_CLEAR(errnomap);
+    struct _Py_exc_state *state = &interp->exc_state;
+    free_preallocated_memerrors(state);
+    Py_CLEAR(state->errnomap);
 }
 
 /* Helper to do the equivalent of "raise X from Y" in C, but always using
@@ -2887,189 +3037,3 @@
     PyErr_Restore(new_exc, new_val, new_tb);
     return new_val;
 }
-
-
-/* To help with migration from Python 2, SyntaxError.__init__ applies some
- * heuristics to try to report a more meaningful exception when print and
- * exec are used like statements.
- *
- * The heuristics are currently expected to detect the following cases:
- *   - top level statement
- *   - statement in a nested suite
- *   - trailing section of a one line complex statement
- *
- * They're currently known not to trigger:
- *   - after a semi-colon
- *
- * The error message can be a bit odd in cases where the "arguments" are
- * completely illegal syntactically, but that isn't worth the hassle of
- * fixing.
- *
- * We also can't do anything about cases that are legal Python 3 syntax
- * but mean something entirely different from what they did in Python 2
- * (omitting the arguments entirely, printing items preceded by a unary plus
- * or minus, using the stream redirection syntax).
- */
-
-
-// Static helper for setting legacy print error message
-static int
-_set_legacy_print_statement_msg(PySyntaxErrorObject *self, Py_ssize_t start)
-{
-    // PRINT_OFFSET is to remove the `print ` prefix from the data.
-    const int PRINT_OFFSET = 6;
-    const int STRIP_BOTH = 2;
-    Py_ssize_t start_pos = start + PRINT_OFFSET;
-    Py_ssize_t text_len = PyUnicode_GET_LENGTH(self->text);
-    Py_UCS4 semicolon = ';';
-    Py_ssize_t end_pos = PyUnicode_FindChar(self->text, semicolon,
-                                            start_pos, text_len, 1);
-    if (end_pos < -1) {
-      return -1;
-    } else if (end_pos == -1) {
-      end_pos = text_len;
-    }
-
-    PyObject *data = PyUnicode_Substring(self->text, start_pos, end_pos);
-    if (data == NULL) {
-        return -1;
-    }
-
-    PyObject *strip_sep_obj = PyUnicode_FromString(" \t\r\n");
-    if (strip_sep_obj == NULL) {
-        Py_DECREF(data);
-        return -1;
-    }
-
-    PyObject *new_data = _PyUnicode_XStrip(data, STRIP_BOTH, strip_sep_obj);
-    Py_DECREF(data);
-    Py_DECREF(strip_sep_obj);
-    if (new_data == NULL) {
-        return -1;
-    }
-    // gets the modified text_len after stripping `print `
-    text_len = PyUnicode_GET_LENGTH(new_data);
-    const char *maybe_end_arg = "";
-    if (text_len > 0 && PyUnicode_READ_CHAR(new_data, text_len-1) == ',') {
-        maybe_end_arg = " end=\" \"";
-    }
-    PyObject *error_msg = PyUnicode_FromFormat(
-        "Missing parentheses in call to 'print'. Did you mean print(%U%s)?",
-        new_data, maybe_end_arg
-    );
-    Py_DECREF(new_data);
-    if (error_msg == NULL)
-        return -1;
-
-    Py_XSETREF(self->msg, error_msg);
-    return 1;
-}
-
-static int
-_check_for_legacy_statements(PySyntaxErrorObject *self, Py_ssize_t start)
-{
-    /* Return values:
-     *   -1: an error occurred
-     *    0: nothing happened
-     *    1: the check triggered & the error message was changed
-     */
-    static PyObject *print_prefix = NULL;
-    static PyObject *exec_prefix = NULL;
-    Py_ssize_t text_len = PyUnicode_GET_LENGTH(self->text), match;
-    int kind = PyUnicode_KIND(self->text);
-    const void *data = PyUnicode_DATA(self->text);
-
-    /* Ignore leading whitespace */
-    while (start < text_len) {
-        Py_UCS4 ch = PyUnicode_READ(kind, data, start);
-        if (!Py_UNICODE_ISSPACE(ch))
-            break;
-        start++;
-    }
-    /* Checking against an empty or whitespace-only part of the string */
-    if (start == text_len) {
-        return 0;
-    }
-
-    /* Check for legacy print statements */
-    if (print_prefix == NULL) {
-        print_prefix = PyUnicode_InternFromString("print ");
-        if (print_prefix == NULL) {
-            return -1;
-        }
-    }
-    match = PyUnicode_Tailmatch(self->text, print_prefix,
-                                start, text_len, -1);
-    if (match == -1) {
-        return -1;
-    }
-    if (match) {
-        return _set_legacy_print_statement_msg(self, start);
-    }
-
-    /* Check for legacy exec statements */
-    if (exec_prefix == NULL) {
-        exec_prefix = PyUnicode_InternFromString("exec ");
-        if (exec_prefix == NULL) {
-            return -1;
-        }
-    }
-    match = PyUnicode_Tailmatch(self->text, exec_prefix, start, text_len, -1);
-    if (match == -1) {
-        return -1;
-    }
-    if (match) {
-        PyObject *msg = PyUnicode_FromString("Missing parentheses in call "
-                                             "to 'exec'");
-        if (msg == NULL) {
-            return -1;
-        }
-        Py_XSETREF(self->msg, msg);
-        return 1;
-    }
-    /* Fall back to the default error message */
-    return 0;
-}
-
-static int
-_report_missing_parentheses(PySyntaxErrorObject *self)
-{
-    Py_UCS4 left_paren = 40;
-    Py_ssize_t left_paren_index;
-    Py_ssize_t text_len = PyUnicode_GET_LENGTH(self->text);
-    int legacy_check_result = 0;
-
-    /* Skip entirely if there is an opening parenthesis */
-    left_paren_index = PyUnicode_FindChar(self->text, left_paren,
-                                          0, text_len, 1);
-    if (left_paren_index < -1) {
-        return -1;
-    }
-    if (left_paren_index != -1) {
-        /* Use default error message for any line with an opening paren */
-        return 0;
-    }
-    /* Handle the simple statement case */
-    legacy_check_result = _check_for_legacy_statements(self, 0);
-    if (legacy_check_result < 0) {
-        return -1;
-
-    }
-    if (legacy_check_result == 0) {
-        /* Handle the one-line complex statement case */
-        Py_UCS4 colon = 58;
-        Py_ssize_t colon_index;
-        colon_index = PyUnicode_FindChar(self->text, colon,
-                                         0, text_len, 1);
-        if (colon_index < -1) {
-            return -1;
-        }
-        if (colon_index >= 0 && colon_index < text_len) {
-            /* Check again, starting from just after the colon */
-            if (_check_for_legacy_statements(self, colon_index+1) < 0) {
-                return -1;
-            }
-        }
-    }
-    return 0;
-}
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index 1c6ecaf..5a2816f 100644
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -223,6 +223,17 @@
     return fd;
 }
 
+int
+_PyLong_FileDescriptor_Converter(PyObject *o, void *ptr)
+{
+    int fd = PyObject_AsFileDescriptor(o);
+    if (fd == -1) {
+        return 0;
+    }
+    *(int *)ptr = fd;
+    return 1;
+}
+
 /*
 ** Py_UniversalNewlineFgets is an fgets variation that understands
 ** all of \r, \n and \r\n conventions.
@@ -314,29 +325,6 @@
     int fd;
 } PyStdPrinter_Object;
 
-static PyObject *
-stdprinter_new(PyTypeObject *type, PyObject *args, PyObject *kews)
-{
-    PyStdPrinter_Object *self;
-
-    assert(type != NULL && type->tp_alloc != NULL);
-
-    self = (PyStdPrinter_Object *) type->tp_alloc(type, 0);
-    if (self != NULL) {
-        self->fd = -1;
-    }
-
-    return (PyObject *) self;
-}
-
-static int
-stdprinter_init(PyObject *self, PyObject *args, PyObject *kwds)
-{
-    PyErr_SetString(PyExc_TypeError,
-                    "cannot create 'stderrprinter' instances");
-    return -1;
-}
-
 PyObject *
 PyFile_NewStdPrinter(int fd)
 {
@@ -379,7 +367,7 @@
         return NULL;
     }
 
-    /* Encode Unicode to UTF-8/surrogateescape */
+    /* Encode Unicode to UTF-8/backslashreplace */
     str = PyUnicode_AsUTF8AndSize(unicode, &n);
     if (str == NULL) {
         PyErr_Clear();
@@ -496,7 +484,7 @@
     PyObject_GenericGetAttr,                    /* tp_getattro */
     0,                                          /* tp_setattro */
     0,                                          /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT,                         /* tp_flags */
+    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION, /* tp_flags */
     0,                                          /* tp_doc */
     0,                                          /* tp_traverse */
     0,                                          /* tp_clear */
@@ -512,9 +500,9 @@
     0,                                          /* tp_descr_get */
     0,                                          /* tp_descr_set */
     0,                                          /* tp_dictoffset */
-    stdprinter_init,                            /* tp_init */
+    0,                                          /* tp_init */
     PyType_GenericAlloc,                        /* tp_alloc */
-    stdprinter_new,                             /* tp_new */
+    0,                                          /* tp_new */
     PyObject_Del,                               /* tp_free */
 };
 
diff --git a/Objects/floatobject.c b/Objects/floatobject.c
index 9f50140..2e02f37 100644
--- a/Objects/floatobject.c
+++ b/Objects/floatobject.c
@@ -4,7 +4,11 @@
    for any kind of float exception without losing portability. */
 
 #include "Python.h"
-#include "pycore_dtoa.h"
+#include "pycore_dtoa.h"          // _Py_dg_dtoa()
+#include "pycore_interp.h"        // _PyInterpreterState.float_state
+#include "pycore_long.h"          // _PyLong_GetOne()
+#include "pycore_object.h"        // _PyObject_Init()
+#include "pycore_pystate.h"       // _PyInterpreterState_GET()
 
 #include <ctype.h>
 #include <float.h>
@@ -16,16 +20,18 @@
 
 #include "clinic/floatobject.c.h"
 
-/* Special free list
-   free_list is a singly-linked list of available PyFloatObjects, linked
-   via abuse of their ob_type members.
-*/
-
 #ifndef PyFloat_MAXFREELIST
-#define PyFloat_MAXFREELIST    100
+#  define PyFloat_MAXFREELIST   100
 #endif
-static int numfree = 0;
-static PyFloatObject *free_list = NULL;
+
+
+static struct _Py_float_state *
+get_float_state(void)
+{
+    PyInterpreterState *interp = _PyInterpreterState_GET();
+    return &interp->float_state;
+}
+
 
 double
 PyFloat_GetMax(void)
@@ -59,12 +65,14 @@
                     "is a normalized float"},
     {"min_10_exp",      "DBL_MIN_10_EXP -- minimum int e such that 10**e is "
                     "a normalized"},
-    {"dig",             "DBL_DIG -- digits"},
+    {"dig",             "DBL_DIG -- maximum number of decimal digits that "
+                    "can be faithfully represented in a float"},
     {"mant_dig",        "DBL_MANT_DIG -- mantissa digits"},
     {"epsilon",         "DBL_EPSILON -- Difference between 1 and the next "
                     "representable float"},
     {"radix",           "FLT_RADIX -- radix of exponent"},
-    {"rounds",          "FLT_ROUNDS -- rounding mode"},
+    {"rounds",          "FLT_ROUNDS -- rounding mode used for arithmetic "
+                    "operations"},
     {0}
 };
 
@@ -115,17 +123,23 @@
 PyObject *
 PyFloat_FromDouble(double fval)
 {
-    PyFloatObject *op = free_list;
+    struct _Py_float_state *state = get_float_state();
+    PyFloatObject *op = state->free_list;
     if (op != NULL) {
-        free_list = (PyFloatObject *) Py_TYPE(op);
-        numfree--;
-    } else {
-        op = (PyFloatObject*) PyObject_MALLOC(sizeof(PyFloatObject));
-        if (!op)
-            return PyErr_NoMemory();
+#ifdef Py_DEBUG
+        // PyFloat_FromDouble() must not be called after _PyFloat_Fini()
+        assert(state->numfree != -1);
+#endif
+        state->free_list = (PyFloatObject *) Py_TYPE(op);
+        state->numfree--;
     }
-    /* Inline PyObject_New */
-    (void)PyObject_INIT(op, &PyFloat_Type);
+    else {
+        op = PyObject_Malloc(sizeof(PyFloatObject));
+        if (!op) {
+            return PyErr_NoMemory();
+        }
+    }
+    _PyObject_Init((PyObject*)op, &PyFloat_Type);
     op->ob_fval = fval;
     return (PyObject *) op;
 }
@@ -202,7 +216,7 @@
     }
     else {
         PyErr_Format(PyExc_TypeError,
-            "float() argument must be a string or a number, not '%.200s'",
+            "float() argument must be a string or a real number, not '%.200s'",
             Py_TYPE(v)->tp_name);
         return NULL;
     }
@@ -217,16 +231,22 @@
 float_dealloc(PyFloatObject *op)
 {
     if (PyFloat_CheckExact(op)) {
-        if (numfree >= PyFloat_MAXFREELIST)  {
-            PyObject_FREE(op);
+        struct _Py_float_state *state = get_float_state();
+#ifdef Py_DEBUG
+        // float_dealloc() must not be called after _PyFloat_Fini()
+        assert(state->numfree != -1);
+#endif
+        if (state->numfree >= PyFloat_MAXFREELIST)  {
+            PyObject_Free(op);
             return;
         }
-        numfree++;
-        Py_SET_TYPE(op, (PyTypeObject *)free_list);
-        free_list = op;
+        state->numfree++;
+        Py_SET_TYPE(op, (PyTypeObject *)state->free_list);
+        state->free_list = op;
     }
-    else
+    else {
         Py_TYPE(op)->tp_free((PyObject *)op);
+    }
 }
 
 double
@@ -248,7 +268,7 @@
     nb = Py_TYPE(op)->tp_as_number;
     if (nb == NULL || nb->nb_float == NULL) {
         if (nb && nb->nb_index) {
-            PyObject *res = PyNumber_Index(op);
+            PyObject *res = _PyNumber_Index(op);
             if (!res) {
                 return -1;
             }
@@ -485,7 +505,7 @@
                 Py_DECREF(vv);
                 vv = temp;
 
-                temp = PyNumber_Or(vv, _PyLong_One);
+                temp = PyNumber_Or(vv, _PyLong_GetOne());
                 if (temp == NULL)
                     goto Error;
                 Py_DECREF(vv);
@@ -536,7 +556,7 @@
 static Py_hash_t
 float_hash(PyFloatObject *v)
 {
-    return _Py_HashDouble(v->ob_fval);
+    return _Py_HashDouble((PyObject *)v, v->ob_fval);
 }
 
 static PyObject *
@@ -1443,8 +1463,8 @@
        bits lsb, lsb-2, lsb-3, lsb-4, ... is 1. */
     if ((digit & half_eps) != 0) {
         round_up = 0;
-        if ((digit & (3*half_eps-1)) != 0 ||
-            (half_eps == 8 && (HEX_DIGIT(key_digit+1) & 1) != 0))
+        if ((digit & (3*half_eps-1)) != 0 || (half_eps == 8 &&
+                key_digit+1 < ndigits && (HEX_DIGIT(key_digit+1) & 1) != 0))
             round_up = 1;
         else
             for (i = key_digit-1; i >= 0; i--)
@@ -1586,7 +1606,7 @@
 /*[clinic input]
 @classmethod
 float.__new__ as float_new
-    x: object(c_default="_PyLong_Zero") = 0
+    x: object(c_default="NULL") = 0
     /
 
 Convert a string or number to a floating point number, if possible.
@@ -1594,10 +1614,18 @@
 
 static PyObject *
 float_new_impl(PyTypeObject *type, PyObject *x)
-/*[clinic end generated code: output=ccf1e8dc460ba6ba input=540ee77c204ff87a]*/
+/*[clinic end generated code: output=ccf1e8dc460ba6ba input=f43661b7de03e9d8]*/
 {
-    if (type != &PyFloat_Type)
+    if (type != &PyFloat_Type) {
+        if (x == NULL) {
+            x = _PyLong_GetZero();
+        }
         return float_subtype_new(type, x); /* Wimp out */
+    }
+
+    if (x == NULL) {
+        return PyFloat_FromDouble(0.0);
+    }
     /* If it's a string, but not a string subclass, use
        PyFloat_FromString. */
     if (PyUnicode_CheckExact(x))
@@ -1630,6 +1658,24 @@
     return newobj;
 }
 
+static PyObject *
+float_vectorcall(PyObject *type, PyObject * const*args,
+                 size_t nargsf, PyObject *kwnames)
+{
+    if (!_PyArg_NoKwnames("float", kwnames)) {
+        return NULL;
+    }
+
+    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
+    if (!_PyArg_CheckPositional("float", nargs, 0, 1)) {
+        return NULL;
+    }
+
+    PyObject *x = nargs >= 1 ? args[0] : NULL;
+    return float_new_impl((PyTypeObject *)type, x);
+}
+
+
 /*[clinic input]
 float.__getnewargs__
 [clinic start generated code]*/
@@ -1702,7 +1748,7 @@
 
 /*[clinic input]
 @classmethod
-float.__set_format__
+float.__setformat__
 
     typestr: str
         Must be 'double' or 'float'.
@@ -1721,9 +1767,9 @@
 [clinic start generated code]*/
 
 static PyObject *
-float___set_format___impl(PyTypeObject *type, const char *typestr,
-                          const char *fmt)
-/*[clinic end generated code: output=504460f5dc85acbd input=5306fa2b81a997e4]*/
+float___setformat___impl(PyTypeObject *type, const char *typestr,
+                         const char *fmt)
+/*[clinic end generated code: output=06864de1fb5f1f04 input=c0e9e04dd87f9988]*/
 {
     float_format_type f;
     float_format_type detected;
@@ -1825,7 +1871,7 @@
     FLOAT_IS_INTEGER_METHODDEF
     FLOAT___GETNEWARGS___METHODDEF
     FLOAT___GETFORMAT___METHODDEF
-    FLOAT___SET_FORMAT___METHODDEF
+    FLOAT___SETFORMAT___METHODDEF
     FLOAT___FORMAT___METHODDEF
     {NULL,              NULL}           /* sentinel */
 };
@@ -1899,7 +1945,8 @@
     PyObject_GenericGetAttr,                    /* tp_getattro */
     0,                                          /* tp_setattro */
     0,                                          /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,   /* tp_flags */
+    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
+        _Py_TPFLAGS_MATCH_SELF,               /* tp_flags */
     float_new__doc__,                           /* tp_doc */
     0,                                          /* tp_traverse */
     0,                                          /* tp_clear */
@@ -1918,9 +1965,10 @@
     0,                                          /* tp_init */
     0,                                          /* tp_alloc */
     float_new,                                  /* tp_new */
+    .tp_vectorcall = (vectorcallfunc)float_vectorcall,
 };
 
-int
+void
 _PyFloat_Init(void)
 {
     /* We attempt to determine if this machine is using IEEE
@@ -1968,41 +2016,52 @@
 
     double_format = detected_double_format;
     float_format = detected_float_format;
+}
 
+int
+_PyFloat_InitTypes(void)
+{
     /* Init float info */
     if (FloatInfoType.tp_name == NULL) {
         if (PyStructSequence_InitType2(&FloatInfoType, &floatinfo_desc) < 0) {
-            return 0;
+            return -1;
         }
     }
-    return 1;
+    return 0;
 }
 
 void
-_PyFloat_ClearFreeList(void)
+_PyFloat_ClearFreeList(PyInterpreterState *interp)
 {
-    PyFloatObject *f = free_list, *next;
-    for (; f; f = next) {
-        next = (PyFloatObject*) Py_TYPE(f);
-        PyObject_FREE(f);
+    struct _Py_float_state *state = &interp->float_state;
+    PyFloatObject *f = state->free_list;
+    while (f != NULL) {
+        PyFloatObject *next = (PyFloatObject*) Py_TYPE(f);
+        PyObject_Free(f);
+        f = next;
     }
-    free_list = NULL;
-    numfree = 0;
+    state->free_list = NULL;
+    state->numfree = 0;
 }
 
 void
-_PyFloat_Fini(void)
+_PyFloat_Fini(PyInterpreterState *interp)
 {
-    _PyFloat_ClearFreeList();
+    _PyFloat_ClearFreeList(interp);
+#ifdef Py_DEBUG
+    struct _Py_float_state *state = &interp->float_state;
+    state->numfree = -1;
+#endif
 }
 
 /* Print summary info about the state of the optimized allocator */
 void
 _PyFloat_DebugMallocStats(FILE *out)
 {
+    struct _Py_float_state *state = get_float_state();
     _PyDebugAllocatorStats(out,
                            "free PyFloatObject",
-                           numfree, sizeof(PyFloatObject));
+                           state->numfree, sizeof(PyFloatObject));
 }
 
 
@@ -2291,7 +2350,7 @@
             flo = 0;
             ++fhi;
             if (fhi >> 28) {
-                /* And it also progagated out of the next 28 bits. */
+                /* And it also propagated out of the next 28 bits. */
                 fhi = 0;
                 ++e;
                 if (e >= 2047)
diff --git a/Objects/frameobject.c b/Objects/frameobject.c
index a2fc0a4..d02cf9d 100644
--- a/Objects/frameobject.c
+++ b/Objects/frameobject.c
@@ -1,27 +1,34 @@
 /* Frame object implementation */
 
 #include "Python.h"
-#include "pycore_object.h"
-#include "pycore_gc.h"       // _PyObject_GC_IS_TRACKED()
+#include "pycore_ceval.h"         // _PyEval_BuiltinsFromGlobals()
+#include "pycore_moduleobject.h"  // _PyModule_GetDict()
+#include "pycore_object.h"        // _PyObject_GC_UNTRACK()
 
-#include "code.h"
-#include "frameobject.h"
-#include "opcode.h"
+#include "frameobject.h"          // PyFrameObject
+#include "opcode.h"               // EXTENDED_ARG
 #include "structmember.h"         // PyMemberDef
 
 #define OFF(x) offsetof(PyFrameObject, x)
 
 static PyMemberDef frame_memberlist[] = {
     {"f_back",          T_OBJECT,       OFF(f_back),      READONLY},
-    {"f_code",          T_OBJECT,       OFF(f_code),      READONLY},
+    {"f_code",          T_OBJECT,       OFF(f_code),      READONLY|PY_AUDIT_READ},
     {"f_builtins",      T_OBJECT,       OFF(f_builtins),  READONLY},
     {"f_globals",       T_OBJECT,       OFF(f_globals),   READONLY},
-    {"f_lasti",         T_INT,          OFF(f_lasti),     READONLY},
     {"f_trace_lines",   T_BOOL,         OFF(f_trace_lines), 0},
     {"f_trace_opcodes", T_BOOL,         OFF(f_trace_opcodes), 0},
     {NULL}      /* Sentinel */
 };
 
+static struct _Py_frame_state *
+get_frame_state(void)
+{
+    PyInterpreterState *interp = _PyInterpreterState_GET();
+    return &interp->frame;
+}
+
+
 static PyObject *
 frame_getlocals(PyFrameObject *f, void *closure)
 {
@@ -35,18 +42,33 @@
 PyFrame_GetLineNumber(PyFrameObject *f)
 {
     assert(f != NULL);
-    if (f->f_trace) {
+    if (f->f_lineno != 0) {
         return f->f_lineno;
     }
     else {
-        return PyCode_Addr2Line(f->f_code, f->f_lasti);
+        return PyCode_Addr2Line(f->f_code, f->f_lasti*sizeof(_Py_CODEUNIT));
     }
 }
 
 static PyObject *
 frame_getlineno(PyFrameObject *f, void *closure)
 {
-    return PyLong_FromLong(PyFrame_GetLineNumber(f));
+    int lineno = PyFrame_GetLineNumber(f);
+    if (lineno < 0) {
+        Py_RETURN_NONE;
+    }
+    else {
+        return PyLong_FromLong(lineno);
+    }
+}
+
+static PyObject *
+frame_getlasti(PyFrameObject *f, void *closure)
+{
+    if (f->f_lasti < 0) {
+        return PyLong_FromLong(-1);
+    }
+    return PyLong_FromLong(f->f_lasti*sizeof(_Py_CODEUNIT));
 }
 
 
@@ -128,7 +150,7 @@
                 case POP_JUMP_IF_FALSE:
                 case POP_JUMP_IF_TRUE:
                 case JUMP_IF_NOT_EXC_MATCH:
-                    j = get_arg(code, i) / sizeof(_Py_CODEUNIT);
+                    j = get_arg(code, i);
                     assert(j < len);
                     if (blocks[j] == -1 && j < i) {
                         todo = 1;
@@ -138,7 +160,7 @@
                     blocks[i+1] = block_stack;
                     break;
                 case JUMP_ABSOLUTE:
-                    j = get_arg(code, i) / sizeof(_Py_CODEUNIT);
+                    j = get_arg(code, i);
                     assert(j < len);
                     if (blocks[j] == -1 && j < i) {
                         todo = 1;
@@ -147,7 +169,7 @@
                     blocks[j] = block_stack;
                     break;
                 case SETUP_FINALLY:
-                    j = get_arg(code, i) / sizeof(_Py_CODEUNIT) + i + 1;
+                    j = get_arg(code, i) + i + 1;
                     assert(j < len);
                     except_stack = push_block(block_stack, Except);
                     assert(blocks[j] == -1 || blocks[j] == except_stack);
@@ -157,7 +179,7 @@
                     break;
                 case SETUP_WITH:
                 case SETUP_ASYNC_WITH:
-                    j = get_arg(code, i) / sizeof(_Py_CODEUNIT) + i + 1;
+                    j = get_arg(code, i) + i + 1;
                     assert(j < len);
                     except_stack = push_block(block_stack, Except);
                     assert(blocks[j] == -1 || blocks[j] == except_stack);
@@ -166,7 +188,7 @@
                     blocks[i+1] = block_stack;
                     break;
                 case JUMP_FORWARD:
-                    j = get_arg(code, i) / sizeof(_Py_CODEUNIT) + i + 1;
+                    j = get_arg(code, i) + i + 1;
                     assert(j < len);
                     assert(blocks[j] == -1 || blocks[j] == block_stack);
                     blocks[j] = block_stack;
@@ -179,7 +201,7 @@
                 case FOR_ITER:
                     blocks[i+1] = block_stack;
                     block_stack = pop_block(block_stack);
-                    j = get_arg(code, i) / sizeof(_Py_CODEUNIT) + i + 1;
+                    j = get_arg(code, i) + i + 1;
                     assert(j < len);
                     assert(blocks[j] == -1 || blocks[j] == block_stack);
                     blocks[j] = block_stack;
@@ -240,36 +262,22 @@
 static int *
 marklines(PyCodeObject *code, int len)
 {
+    PyCodeAddressRange bounds;
+    _PyCode_InitAddressRange(code, &bounds);
+    assert (bounds.ar_end == 0);
+
     int *linestarts = PyMem_New(int, len);
     if (linestarts == NULL) {
         return NULL;
     }
-    Py_ssize_t size = PyBytes_GET_SIZE(code->co_lnotab) / 2;
-    unsigned char *p = (unsigned char*)PyBytes_AS_STRING(code->co_lnotab);
-    int line = code->co_firstlineno;
-    int addr = 0;
-    int index = 0;
-    while (--size >= 0) {
-        addr += *p++;
-        if (index*2 < addr) {
-            linestarts[index++] = line;
-        }
-        while (index*2 < addr) {
-            linestarts[index++] = -1;
-            if (index >= len) {
-                break;
-            }
-        }
-        line += (signed char)*p;
-        p++;
+    for (int i = 0; i < len; i++) {
+        linestarts[i] = -1;
     }
-    if (index < len) {
-        linestarts[index++] = line;
+
+    while (PyLineTable_NextAddressRange(&bounds)) {
+        assert(bounds.ar_start/(int)sizeof(_Py_CODEUNIT) < len);
+        linestarts[bounds.ar_start/sizeof(_Py_CODEUNIT)] = bounds.ar_line;
     }
-    while (index < len) {
-        linestarts[index++] = -1;
-    }
-    assert(index == len);
     return linestarts;
 }
 
@@ -291,17 +299,20 @@
 static void
 frame_stack_pop(PyFrameObject *f)
 {
-    PyObject *v = (*--f->f_stacktop);
+    assert(f->f_stackdepth >= 0);
+    f->f_stackdepth--;
+    PyObject *v = f->f_valuestack[f->f_stackdepth];
     Py_DECREF(v);
 }
 
 static void
 frame_block_unwind(PyFrameObject *f)
 {
+    assert(f->f_stackdepth >= 0);
     assert(f->f_iblock > 0);
     f->f_iblock--;
     PyTryBlock *b = &f->f_blockstack[f->f_iblock];
-    intptr_t delta = (f->f_stacktop - f->f_valuestack) - b->b_level;
+    intptr_t delta = f->f_stackdepth - b->b_level;
     while (delta > 0) {
         frame_stack_pop(f);
         delta--;
@@ -343,33 +354,36 @@
         return -1;
     }
 
-    /* Upon the 'call' trace event of a new frame, f->f_lasti is -1 and
-     * f->f_trace is NULL, check first on the first condition.
-     * Forbidding jumps from the 'call' event of a new frame is a side effect
-     * of allowing to set f_lineno only from trace functions. */
-    if (f->f_lasti == -1) {
-        PyErr_Format(PyExc_ValueError,
+    /*
+     * This code preserves the historical restrictions on
+     * setting the line number of a frame.
+     * Jumps are forbidden on a 'return' trace event (except after a yield).
+     * Jumps from 'call' trace events are also forbidden.
+     * In addition, jumps are forbidden when not tracing,
+     * as this is a debugging feature.
+     */
+    switch(f->f_state) {
+        case FRAME_CREATED:
+            PyErr_Format(PyExc_ValueError,
                      "can't jump from the 'call' trace event of a new frame");
-        return -1;
-    }
-
-    /* You can only do this from within a trace function, not via
-     * _getframe or similar hackery. */
-    if (!f->f_trace) {
-        PyErr_Format(PyExc_ValueError,
-                     "f_lineno can only be set by a trace function");
-        return -1;
-    }
-
-    /* Forbid jumps upon a 'return' trace event (except after executing a
-     * YIELD_VALUE or YIELD_FROM opcode, f_stacktop is not NULL in that case)
-     * and upon an 'exception' trace event.
-     * Jumps from 'call' trace events have already been forbidden above for new
-     * frames, so this check does not change anything for 'call' events. */
-    if (f->f_stacktop == NULL) {
-        PyErr_SetString(PyExc_ValueError,
+            return -1;
+        case FRAME_RETURNED:
+        case FRAME_UNWINDING:
+        case FRAME_RAISED:
+        case FRAME_CLEARED:
+            PyErr_SetString(PyExc_ValueError,
                 "can only jump from a 'line' trace event");
-        return -1;
+            return -1;
+        case FRAME_EXECUTING:
+        case FRAME_SUSPENDED:
+            /* You can only do this from within a trace function, not via
+            * _getframe or similar hackery. */
+            if (!f->f_trace) {
+                PyErr_Format(PyExc_ValueError,
+                            "f_lineno can only be set by a trace function");
+                return -1;
+            }
+            break;
     }
 
     int new_lineno;
@@ -397,7 +411,9 @@
         return -1;
     }
 
-    int len = PyBytes_GET_SIZE(f->f_code->co_code)/sizeof(_Py_CODEUNIT);
+    /* PyCode_NewWithPosOnlyArgs limits co_code to be under INT_MAX so this
+     * should never overflow. */
+    int len = (int)(PyBytes_GET_SIZE(f->f_code->co_code) / sizeof(_Py_CODEUNIT));
     int *lines = marklines(f->f_code, len);
     if (lines == NULL) {
         return -1;
@@ -421,7 +437,7 @@
     int64_t target_block_stack = -1;
     int64_t best_block_stack = -1;
     int best_addr = -1;
-    int64_t start_block_stack = blocks[f->f_lasti/sizeof(_Py_CODEUNIT)];
+    int64_t start_block_stack = blocks[f->f_lasti];
     const char *msg = "cannot find bytecode for specified line";
     for (int i = 0; i < len; i++) {
         if (lines[i] == new_lineno) {
@@ -430,7 +446,7 @@
                 msg = NULL;
                 if (target_block_stack > best_block_stack) {
                     best_block_stack = target_block_stack;
-                    best_addr = i*sizeof(_Py_CODEUNIT);
+                    best_addr = i;
                 }
             }
             else if (msg) {
@@ -473,8 +489,8 @@
         start_block_stack = pop_block(start_block_stack);
     }
 
-    /* Finally set the new f_lineno and f_lasti and return OK. */
-    f->f_lineno = new_lineno;
+    /* Finally set the new f_lasti and return OK. */
+    f->f_lineno = 0;
     f->f_lasti = best_addr;
     return 0;
 }
@@ -495,11 +511,9 @@
 static int
 frame_settrace(PyFrameObject *f, PyObject* v, void *closure)
 {
-    /* We rely on f_lineno being accurate when f_trace is set. */
-    f->f_lineno = PyFrame_GetLineNumber(f);
-
-    if (v == Py_None)
+    if (v == Py_None) {
         v = NULL;
+    }
     Py_XINCREF(v);
     Py_XSETREF(f->f_trace, v);
 
@@ -512,6 +526,7 @@
     {"f_lineno",        (getter)frame_getlineno,
                     (setter)frame_setlineno, NULL},
     {"f_trace",         (getter)frame_gettrace, (setter)frame_settrace, NULL},
+    {"f_lasti",         (getter)frame_getlasti, NULL, NULL},
     {0}
 };
 
@@ -559,31 +574,25 @@
 /* max value for numfree */
 #define PyFrame_MAXFREELIST 200
 
-#if PyFrame_MAXFREELIST > 0
-static PyFrameObject *free_list = NULL;
-static int numfree = 0;         /* number of frames currently in free_list */
-#endif
-
 static void _Py_HOT_FUNCTION
 frame_dealloc(PyFrameObject *f)
 {
-    PyObject **p, **valuestack;
-    PyCodeObject *co;
-
-    if (_PyObject_GC_IS_TRACKED(f))
+    if (_PyObject_GC_IS_TRACKED(f)) {
         _PyObject_GC_UNTRACK(f);
+    }
 
-    Py_TRASHCAN_SAFE_BEGIN(f)
+    Py_TRASHCAN_BEGIN(f, frame_dealloc);
     /* Kill all local variables */
-    valuestack = f->f_valuestack;
-    for (p = f->f_localsplus; p < valuestack; p++)
+    PyObject **valuestack = f->f_valuestack;
+    for (PyObject **p = f->f_localsplus; p < valuestack; p++) {
         Py_CLEAR(*p);
+    }
 
     /* Free stack */
-    if (f->f_stacktop != NULL) {
-        for (p = valuestack; p < f->f_stacktop; p++)
-            Py_XDECREF(*p);
+    for (int i = 0; i < f->f_stackdepth; i++) {
+        Py_XDECREF(f->f_valuestack[i]);
     }
+    f->f_stackdepth = 0;
 
     Py_XDECREF(f->f_back);
     Py_DECREF(f->f_builtins);
@@ -591,23 +600,28 @@
     Py_CLEAR(f->f_locals);
     Py_CLEAR(f->f_trace);
 
-    co = f->f_code;
+    PyCodeObject *co = f->f_code;
     if (co->co_zombieframe == NULL) {
         co->co_zombieframe = f;
     }
-#if PyFrame_MAXFREELIST > 0
-    else if (numfree < PyFrame_MAXFREELIST) {
-        ++numfree;
-        f->f_back = free_list;
-        free_list = f;
-    }
-#endif
     else {
-        PyObject_GC_Del(f);
+        struct _Py_frame_state *state = get_frame_state();
+#ifdef Py_DEBUG
+        // frame_dealloc() must not be called after _PyFrame_Fini()
+        assert(state->numfree != -1);
+#endif
+        if (state->numfree < PyFrame_MAXFREELIST) {
+            ++state->numfree;
+            f->f_back = state->free_list;
+            state->free_list = f;
+        }
+        else {
+            PyObject_GC_Del(f);
+        }
     }
 
     Py_DECREF(co);
-    Py_TRASHCAN_SAFE_END(f)
+    Py_TRASHCAN_END;
 }
 
 static inline Py_ssize_t
@@ -636,10 +650,8 @@
     }
 
     /* stack */
-    if (f->f_stacktop != NULL) {
-        for (PyObject **p = f->f_valuestack; p < f->f_stacktop; p++) {
-            Py_VISIT(*p);
-        }
+    for (int i = 0; i < f->f_stackdepth; i++) {
+        Py_VISIT(f->f_valuestack[i]);
     }
     return 0;
 }
@@ -652,9 +664,7 @@
      * frame may also point to this frame, believe itself to still be
      * active, and try cleaning up this frame again.
      */
-    PyObject **oldtop = f->f_stacktop;
-    f->f_stacktop = NULL;
-    f->f_executing = 0;
+    f->f_state = FRAME_CLEARED;
 
     Py_CLEAR(f->f_trace);
 
@@ -665,18 +675,17 @@
     }
 
     /* stack */
-    if (oldtop != NULL) {
-        for (PyObject **p = f->f_valuestack; p < oldtop; p++) {
-            Py_CLEAR(*p);
-        }
+    for (int i = 0; i < f->f_stackdepth; i++) {
+        Py_CLEAR(f->f_valuestack[i]);
     }
+    f->f_stackdepth = 0;
     return 0;
 }
 
 static PyObject *
 frame_clear(PyFrameObject *f, PyObject *Py_UNUSED(ignored))
 {
-    if (f->f_executing) {
+    if (_PyFrame_IsExecuting(f)) {
         PyErr_SetString(PyExc_RuntimeError,
                         "cannot clear an executing frame");
         return NULL;
@@ -768,9 +777,7 @@
 static inline PyFrameObject*
 frame_alloc(PyCodeObject *code)
 {
-    PyFrameObject *f;
-
-    f = code->co_zombieframe;
+    PyFrameObject *f = code->co_zombieframe;
     if (f != NULL) {
         code->co_zombieframe = NULL;
         _Py_NewReference((PyObject *)f);
@@ -781,21 +788,23 @@
     Py_ssize_t ncells = PyTuple_GET_SIZE(code->co_cellvars);
     Py_ssize_t nfrees = PyTuple_GET_SIZE(code->co_freevars);
     Py_ssize_t extras = code->co_stacksize + code->co_nlocals + ncells + nfrees;
-#if PyFrame_MAXFREELIST > 0
-    if (free_list == NULL)
-#endif
+    struct _Py_frame_state *state = get_frame_state();
+    if (state->free_list == NULL)
     {
         f = PyObject_GC_NewVar(PyFrameObject, &PyFrame_Type, extras);
         if (f == NULL) {
             return NULL;
         }
     }
-#if PyFrame_MAXFREELIST > 0
     else {
-        assert(numfree > 0);
-        --numfree;
-        f = free_list;
-        free_list = free_list->f_back;
+#ifdef Py_DEBUG
+        // frame_alloc() must not be called after _PyFrame_Fini()
+        assert(state->numfree != -1);
+#endif
+        assert(state->numfree > 0);
+        --state->numfree;
+        f = state->free_list;
+        state->free_list = state->free_list->f_back;
         if (Py_SIZE(f) < extras) {
             PyFrameObject *new_f = PyObject_GC_Resize(PyFrameObject, f, extras);
             if (new_f == NULL) {
@@ -806,132 +815,72 @@
         }
         _Py_NewReference((PyObject *)f);
     }
-#endif
 
-    f->f_code = code;
     extras = code->co_nlocals + ncells + nfrees;
     f->f_valuestack = f->f_localsplus + extras;
-    for (Py_ssize_t i=0; i<extras; i++) {
+    for (Py_ssize_t i=0; i < extras; i++) {
         f->f_localsplus[i] = NULL;
     }
-    f->f_locals = NULL;
-    f->f_trace = NULL;
     return f;
 }
 
 
-static inline PyObject *
-frame_get_builtins(PyFrameObject *back, PyObject *globals)
-{
-    PyObject *builtins;
-
-    if (back != NULL && back->f_globals == globals) {
-        /* If we share the globals, we share the builtins.
-           Save a lookup and a call. */
-        builtins = back->f_builtins;
-        assert(builtins != NULL);
-        Py_INCREF(builtins);
-        return builtins;
-    }
-
-    builtins = _PyDict_GetItemIdWithError(globals, &PyId___builtins__);
-    if (builtins != NULL && PyModule_Check(builtins)) {
-        builtins = PyModule_GetDict(builtins);
-        assert(builtins != NULL);
-    }
-    if (builtins != NULL) {
-        Py_INCREF(builtins);
-        return builtins;
-    }
-
-    if (PyErr_Occurred()) {
-        return NULL;
-    }
-
-    /* No builtins! Make up a minimal one.
-       Give them 'None', at least. */
-    builtins = PyDict_New();
-    if (builtins == NULL) {
-        return NULL;
-    }
-    if (PyDict_SetItemString(builtins, "None", Py_None) < 0) {
-        Py_DECREF(builtins);
-        return NULL;
-    }
-    return builtins;
-}
-
-
 PyFrameObject* _Py_HOT_FUNCTION
-_PyFrame_New_NoTrack(PyThreadState *tstate, PyCodeObject *code,
-                     PyObject *globals, PyObject *locals)
+_PyFrame_New_NoTrack(PyThreadState *tstate, PyFrameConstructor *con, PyObject *locals)
 {
-#ifdef Py_DEBUG
-    if (code == NULL || globals == NULL || !PyDict_Check(globals) ||
-        (locals != NULL && !PyMapping_Check(locals))) {
-        PyErr_BadInternalCall();
-        return NULL;
-    }
-#endif
+    assert(con != NULL);
+    assert(con->fc_globals != NULL);
+    assert(con->fc_builtins != NULL);
+    assert(con->fc_code != NULL);
+    assert(locals == NULL || PyMapping_Check(locals));
 
-    PyFrameObject *back = tstate->frame;
-    PyObject *builtins = frame_get_builtins(back, globals);
-    if (builtins == NULL) {
-        return NULL;
-    }
-
-    PyFrameObject *f = frame_alloc(code);
+    PyFrameObject *f = frame_alloc((PyCodeObject *)con->fc_code);
     if (f == NULL) {
-        Py_DECREF(builtins);
         return NULL;
     }
 
-    f->f_stacktop = f->f_valuestack;
-    f->f_builtins = builtins;
-    Py_XINCREF(back);
-    f->f_back = back;
-    Py_INCREF(code);
-    Py_INCREF(globals);
-    f->f_globals = globals;
-    /* Most functions have CO_NEWLOCALS and CO_OPTIMIZED set. */
-    if ((code->co_flags & (CO_NEWLOCALS | CO_OPTIMIZED)) ==
-        (CO_NEWLOCALS | CO_OPTIMIZED))
-        ; /* f_locals = NULL; will be set by PyFrame_FastToLocals() */
-    else if (code->co_flags & CO_NEWLOCALS) {
-        locals = PyDict_New();
-        if (locals == NULL) {
-            Py_DECREF(f);
-            return NULL;
-        }
-        f->f_locals = locals;
-    }
-    else {
-        if (locals == NULL)
-            locals = globals;
-        Py_INCREF(locals);
-        f->f_locals = locals;
-    }
-
-    f->f_lasti = -1;
-    f->f_lineno = code->co_firstlineno;
-    f->f_iblock = 0;
-    f->f_executing = 0;
-    f->f_gen = NULL;
-    f->f_trace_opcodes = 0;
+    f->f_back = (PyFrameObject*)Py_XNewRef(tstate->frame);
+    f->f_code = (PyCodeObject *)Py_NewRef(con->fc_code);
+    f->f_builtins = Py_NewRef(con->fc_builtins);
+    f->f_globals = Py_NewRef(con->fc_globals);
+    f->f_locals = Py_XNewRef(locals);
+    // f_valuestack initialized by frame_alloc()
+    f->f_trace = NULL;
+    f->f_stackdepth = 0;
     f->f_trace_lines = 1;
-
-    assert(f->f_code != NULL);
-
+    f->f_trace_opcodes = 0;
+    f->f_gen = NULL;
+    f->f_lasti = -1;
+    f->f_lineno = 0;
+    f->f_iblock = 0;
+    f->f_state = FRAME_CREATED;
+    // f_blockstack and f_localsplus initialized by frame_alloc()
     return f;
 }
 
+/* Legacy API */
 PyFrameObject*
 PyFrame_New(PyThreadState *tstate, PyCodeObject *code,
             PyObject *globals, PyObject *locals)
 {
-    PyFrameObject *f = _PyFrame_New_NoTrack(tstate, code, globals, locals);
-    if (f)
+    PyObject *builtins = _PyEval_BuiltinsFromGlobals(tstate, globals); // borrowed ref
+    if (builtins == NULL) {
+        return NULL;
+    }
+    PyFrameConstructor desc = {
+        .fc_globals = globals,
+        .fc_builtins = builtins,
+        .fc_name = code->co_name,
+        .fc_qualname = code->co_name,
+        .fc_code = (PyObject *)code,
+        .fc_defaults = NULL,
+        .fc_kwdefaults = NULL,
+        .fc_closure = NULL
+    };
+    PyFrameObject *f = _PyFrame_New_NoTrack(tstate, &desc, locals);
+    if (f) {
         _PyObject_GC_TRACK(f);
+    }
     return f;
 }
 
@@ -1175,34 +1124,36 @@
 
 /* Clear out the free list */
 void
-_PyFrame_ClearFreeList(void)
+_PyFrame_ClearFreeList(PyInterpreterState *interp)
 {
-#if PyFrame_MAXFREELIST > 0
-    while (free_list != NULL) {
-        PyFrameObject *f = free_list;
-        free_list = free_list->f_back;
+    struct _Py_frame_state *state = &interp->frame;
+    while (state->free_list != NULL) {
+        PyFrameObject *f = state->free_list;
+        state->free_list = state->free_list->f_back;
         PyObject_GC_Del(f);
-        --numfree;
+        --state->numfree;
     }
-    assert(numfree == 0);
-#endif
+    assert(state->numfree == 0);
 }
 
 void
-_PyFrame_Fini(void)
+_PyFrame_Fini(PyInterpreterState *interp)
 {
-    _PyFrame_ClearFreeList();
+    _PyFrame_ClearFreeList(interp);
+#ifdef Py_DEBUG
+    struct _Py_frame_state *state = &interp->frame;
+    state->numfree = -1;
+#endif
 }
 
 /* Print summary info about the state of the optimized allocator */
 void
 _PyFrame_DebugMallocStats(FILE *out)
 {
-#if PyFrame_MAXFREELIST > 0
+    struct _Py_frame_state *state = get_frame_state();
     _PyDebugAllocatorStats(out,
                            "free PyFrameObject",
-                           numfree, sizeof(PyFrameObject));
-#endif
+                           state->numfree, sizeof(PyFrameObject));
 }
 
 
@@ -1225,3 +1176,21 @@
     Py_XINCREF(back);
     return back;
 }
+
+PyObject*
+_PyEval_BuiltinsFromGlobals(PyThreadState *tstate, PyObject *globals)
+{
+    PyObject *builtins = _PyDict_GetItemIdWithError(globals, &PyId___builtins__);
+    if (builtins) {
+        if (PyModule_Check(builtins)) {
+            builtins = _PyModule_GetDict(builtins);
+            assert(builtins != NULL);
+        }
+        return builtins;
+    }
+    if (PyErr_Occurred()) {
+        return NULL;
+    }
+
+    return _PyEval_GetBuiltins(tstate);
+}
diff --git a/Objects/funcobject.c b/Objects/funcobject.c
index 2c60275..801478a 100644
--- a/Objects/funcobject.c
+++ b/Objects/funcobject.c
@@ -2,77 +2,94 @@
 /* Function object implementation */
 
 #include "Python.h"
-#include "pycore_object.h"
-#include "pycore_tupleobject.h"
-#include "code.h"
+#include "pycore_ceval.h"         // _PyEval_BuiltinsFromGlobals()
+#include "pycore_object.h"        // _PyObject_GC_UNTRACK()
+#include "pycore_pyerrors.h"      // _PyErr_Occurred()
 #include "structmember.h"         // PyMemberDef
 
 PyObject *
 PyFunction_NewWithQualName(PyObject *code, PyObject *globals, PyObject *qualname)
 {
-    PyFunctionObject *op;
-    PyObject *doc, *consts, *module;
-    static PyObject *__name__ = NULL;
+    assert(globals != NULL);
+    assert(PyDict_Check(globals));
+    Py_INCREF(globals);
 
-    if (__name__ == NULL) {
-        __name__ = PyUnicode_InternFromString("__name__");
-        if (__name__ == NULL)
-            return NULL;
-    }
+    PyThreadState *tstate = _PyThreadState_GET();
 
-    /* __module__: If module name is in globals, use it.
-       Otherwise, use None. */
-    module = PyDict_GetItemWithError(globals, __name__);
-    if (module) {
-        Py_INCREF(module);
-    }
-    else if (PyErr_Occurred()) {
-        return NULL;
-    }
+    PyCodeObject *code_obj = (PyCodeObject *)code;
+    Py_INCREF(code_obj);
 
-    op = PyObject_GC_New(PyFunctionObject, &PyFunction_Type);
+    PyObject *name = code_obj->co_name;
+    assert(name != NULL);
+    Py_INCREF(name);
+    if (!qualname) {
+        qualname = name;
+    }
+    Py_INCREF(qualname);
+
+    PyObject *consts = code_obj->co_consts;
+    assert(PyTuple_Check(consts));
+    PyObject *doc;
+    if (PyTuple_Size(consts) >= 1) {
+        doc = PyTuple_GetItem(consts, 0);
+        if (!PyUnicode_Check(doc)) {
+            doc = Py_None;
+        }
+    }
+    else {
+        doc = Py_None;
+    }
+    Py_INCREF(doc);
+
+    // __module__: Use globals['__name__'] if it exists, or NULL.
+    _Py_IDENTIFIER(__name__);
+    PyObject *module = _PyDict_GetItemIdWithError(globals, &PyId___name__);
+    PyObject *builtins = NULL;
+    if (module == NULL && _PyErr_Occurred(tstate)) {
+        goto error;
+    }
+    Py_XINCREF(module);
+
+    builtins = _PyEval_BuiltinsFromGlobals(tstate, globals); // borrowed ref
+    if (builtins == NULL) {
+        goto error;
+    }
+    Py_INCREF(builtins);
+
+    PyFunctionObject *op = PyObject_GC_New(PyFunctionObject, &PyFunction_Type);
     if (op == NULL) {
-        Py_XDECREF(module);
-        return NULL;
+        goto error;
     }
     /* Note: No failures from this point on, since func_dealloc() does not
        expect a partially-created object. */
 
-    op->func_weakreflist = NULL;
-    Py_INCREF(code);
-    op->func_code = code;
-    Py_INCREF(globals);
     op->func_globals = globals;
-    op->func_name = ((PyCodeObject *)code)->co_name;
-    Py_INCREF(op->func_name);
-    op->func_defaults = NULL; /* No default arguments */
-    op->func_kwdefaults = NULL; /* No keyword only defaults */
+    op->func_builtins = builtins;
+    op->func_name = name;
+    op->func_qualname = qualname;
+    op->func_code = (PyObject*)code_obj;
+    op->func_defaults = NULL;    // No default positional arguments
+    op->func_kwdefaults = NULL;  // No default keyword arguments
     op->func_closure = NULL;
-    op->vectorcall = _PyFunction_Vectorcall;
-    op->func_module = module;
-
-    consts = ((PyCodeObject *)code)->co_consts;
-    if (PyTuple_Size(consts) >= 1) {
-        doc = PyTuple_GetItem(consts, 0);
-        if (!PyUnicode_Check(doc))
-            doc = Py_None;
-    }
-    else
-        doc = Py_None;
-    Py_INCREF(doc);
     op->func_doc = doc;
-
     op->func_dict = NULL;
+    op->func_weakreflist = NULL;
+    op->func_module = module;
     op->func_annotations = NULL;
-
-    if (qualname)
-        op->func_qualname = qualname;
-    else
-        op->func_qualname = op->func_name;
-    Py_INCREF(op->func_qualname);
+    op->vectorcall = _PyFunction_Vectorcall;
 
     _PyObject_GC_TRACK(op);
     return (PyObject *)op;
+
+error:
+    Py_DECREF(globals);
+    Py_DECREF(code_obj);
+    Py_DECREF(name);
+    Py_DECREF(qualname);
+    Py_DECREF(doc);
+    Py_XDECREF(module);
+    Py_XDECREF(builtins);
+    return NULL;
 }
 
 PyObject *
@@ -204,6 +221,37 @@
     return 0;
 }
 
+static PyObject *
+func_get_annotation_dict(PyFunctionObject *op)
+{
+    if (op->func_annotations == NULL) {
+        return NULL;
+    }
+    if (PyTuple_CheckExact(op->func_annotations)) {
+        PyObject *ann_tuple = op->func_annotations;
+        PyObject *ann_dict = PyDict_New();
+        if (ann_dict == NULL) {
+            return NULL;
+        }
+
+        assert(PyTuple_GET_SIZE(ann_tuple) % 2 == 0);
+
+        for (Py_ssize_t i = 0; i < PyTuple_GET_SIZE(ann_tuple); i += 2) {
+            int err = PyDict_SetItem(ann_dict,
+                                     PyTuple_GET_ITEM(ann_tuple, i),
+                                     PyTuple_GET_ITEM(ann_tuple, i + 1));
+
+            if (err < 0) {
+                return NULL;
+            }
+        }
+        Py_SETREF(op->func_annotations, ann_dict);
+    }
+    Py_INCREF(op->func_annotations);
+    assert(PyDict_Check(op->func_annotations));
+    return op->func_annotations;
+}
+
 PyObject *
 PyFunction_GetAnnotations(PyObject *op)
 {
@@ -211,7 +259,7 @@
         PyErr_BadInternalCall();
         return NULL;
     }
-    return ((PyFunctionObject *) op) -> func_annotations;
+    return func_get_annotation_dict((PyFunctionObject *)op);
 }
 
 int
@@ -244,6 +292,7 @@
     {"__doc__",       T_OBJECT,     OFF(func_doc), 0},
     {"__globals__",   T_OBJECT,     OFF(func_globals), READONLY},
     {"__module__",    T_OBJECT,     OFF(func_module), 0},
+    {"__builtins__",  T_OBJECT,     OFF(func_builtins), READONLY},
     {NULL}  /* Sentinel */
 };
 
@@ -425,8 +474,7 @@
         if (op->func_annotations == NULL)
             return NULL;
     }
-    Py_INCREF(op->func_annotations);
-    return op->func_annotations;
+    return func_get_annotation_dict(op);
 }
 
 static int
@@ -550,9 +598,9 @@
 
     newfunc = (PyFunctionObject *)PyFunction_New((PyObject *)code,
                                                  globals);
-    if (newfunc == NULL)
+    if (newfunc == NULL) {
         return NULL;
-
+    }
     if (name != Py_None) {
         Py_INCREF(name);
         Py_SETREF(newfunc->func_name, name);
@@ -574,15 +622,16 @@
 {
     Py_CLEAR(op->func_code);
     Py_CLEAR(op->func_globals);
-    Py_CLEAR(op->func_module);
+    Py_CLEAR(op->func_builtins);
     Py_CLEAR(op->func_name);
+    Py_CLEAR(op->func_qualname);
+    Py_CLEAR(op->func_module);
     Py_CLEAR(op->func_defaults);
     Py_CLEAR(op->func_kwdefaults);
     Py_CLEAR(op->func_doc);
     Py_CLEAR(op->func_dict);
     Py_CLEAR(op->func_closure);
     Py_CLEAR(op->func_annotations);
-    Py_CLEAR(op->func_qualname);
     return 0;
 }
 
@@ -601,7 +650,7 @@
 func_repr(PyFunctionObject *op)
 {
     return PyUnicode_FromFormat("<function %U at %p>",
-                               op->func_qualname, op);
+                                op->func_qualname, op);
 }
 
 static int
@@ -609,6 +658,7 @@
 {
     Py_VISIT(f->func_code);
     Py_VISIT(f->func_globals);
+    Py_VISIT(f->func_builtins);
     Py_VISIT(f->func_module);
     Py_VISIT(f->func_defaults);
     Py_VISIT(f->func_kwdefaults);
@@ -676,6 +726,50 @@
 };
 
 
+static int
+functools_copy_attr(PyObject *wrapper, PyObject *wrapped, PyObject *name)
+{
+    PyObject *value = PyObject_GetAttr(wrapped, name);
+    if (value == NULL) {
+        if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
+            PyErr_Clear();
+            return 0;
+        }
+        return -1;
+    }
+
+    int res = PyObject_SetAttr(wrapper, name, value);
+    Py_DECREF(value);
+    return res;
+}
+
+// Similar to functools.wraps(wrapper, wrapped)
+static int
+functools_wraps(PyObject *wrapper, PyObject *wrapped)
+{
+#define COPY_ATTR(ATTR) \
+    do { \
+        _Py_IDENTIFIER(ATTR); \
+        PyObject *attr = _PyUnicode_FromId(&PyId_ ## ATTR); \
+        if (attr == NULL) { \
+            return -1; \
+        } \
+        if (functools_copy_attr(wrapper, wrapped, attr) < 0) { \
+            return -1; \
+        } \
+    } while (0) \
+
+    COPY_ATTR(__module__);
+    COPY_ATTR(__name__);
+    COPY_ATTR(__qualname__);
+    COPY_ATTR(__doc__);
+    COPY_ATTR(__annotations__);
+    return 0;
+
+#undef COPY_ATTR
+}
+
+
 /* Class method object */
 
 /* A class method receives the class as implicit first argument,
@@ -742,7 +836,7 @@
         type = (PyObject *)(Py_TYPE(obj));
     if (Py_TYPE(cm->cm_callable)->tp_descr_get != NULL) {
         return Py_TYPE(cm->cm_callable)->tp_descr_get(cm->cm_callable, type,
-                                                      NULL);
+                                                      type);
     }
     return PyMethod_New(cm->cm_callable, type);
 }
@@ -759,11 +853,16 @@
         return -1;
     Py_INCREF(callable);
     Py_XSETREF(cm->cm_callable, callable);
+
+    if (functools_wraps((PyObject *)cm, cm->cm_callable) < 0) {
+        return -1;
+    }
     return 0;
 }
 
 static PyMemberDef cm_memberlist[] = {
     {"__func__", T_OBJECT, offsetof(classmethod, cm_callable), READONLY},
+    {"__wrapped__", T_OBJECT, offsetof(classmethod, cm_callable), READONLY},
     {NULL}  /* Sentinel */
 };
 
@@ -782,13 +881,17 @@
 
 static PyGetSetDef cm_getsetlist[] = {
     {"__isabstractmethod__",
-     (getter)cm_get___isabstractmethod__, NULL,
-     NULL,
-     NULL},
+     (getter)cm_get___isabstractmethod__, NULL, NULL, NULL},
     {"__dict__", PyObject_GenericGetDict, PyObject_GenericSetDict, NULL, NULL},
     {NULL} /* Sentinel */
 };
 
+static PyObject*
+cm_repr(classmethod *cm)
+{
+    return PyUnicode_FromFormat("<classmethod(%R)>", cm->cm_callable);
+}
+
 PyDoc_STRVAR(classmethod_doc,
 "classmethod(function) -> method\n\
 \n\
@@ -821,7 +924,7 @@
     0,                                          /* tp_getattr */
     0,                                          /* tp_setattr */
     0,                                          /* tp_as_async */
-    0,                                          /* tp_repr */
+    (reprfunc)cm_repr,                          /* tp_repr */
     0,                                          /* tp_as_number */
     0,                                          /* tp_as_sequence */
     0,                                          /* tp_as_mapping */
@@ -941,11 +1044,23 @@
         return -1;
     Py_INCREF(callable);
     Py_XSETREF(sm->sm_callable, callable);
+
+    if (functools_wraps((PyObject *)sm, sm->sm_callable) < 0) {
+        return -1;
+    }
     return 0;
 }
 
+static PyObject*
+sm_call(PyObject *callable, PyObject *args, PyObject *kwargs)
+{
+    staticmethod *sm = (staticmethod *)callable;
+    return PyObject_Call(sm->sm_callable, args, kwargs);
+}
+
 static PyMemberDef sm_memberlist[] = {
     {"__func__", T_OBJECT, offsetof(staticmethod, sm_callable), READONLY},
+    {"__wrapped__", T_OBJECT, offsetof(staticmethod, sm_callable), READONLY},
     {NULL}  /* Sentinel */
 };
 
@@ -964,13 +1079,17 @@
 
 static PyGetSetDef sm_getsetlist[] = {
     {"__isabstractmethod__",
-     (getter)sm_get___isabstractmethod__, NULL,
-     NULL,
-     NULL},
+     (getter)sm_get___isabstractmethod__, NULL, NULL, NULL},
     {"__dict__", PyObject_GenericGetDict, PyObject_GenericSetDict, NULL, NULL},
     {NULL} /* Sentinel */
 };
 
+static PyObject*
+sm_repr(staticmethod *sm)
+{
+    return PyUnicode_FromFormat("<staticmethod(%R)>", sm->sm_callable);
+}
+
 PyDoc_STRVAR(staticmethod_doc,
 "staticmethod(function) -> method\n\
 \n\
@@ -1001,12 +1120,12 @@
     0,                                          /* tp_getattr */
     0,                                          /* tp_setattr */
     0,                                          /* tp_as_async */
-    0,                                          /* tp_repr */
+    (reprfunc)sm_repr,                          /* tp_repr */
     0,                                          /* tp_as_number */
     0,                                          /* tp_as_sequence */
     0,                                          /* tp_as_mapping */
     0,                                          /* tp_hash */
-    0,                                          /* tp_call */
+    sm_call,                                    /* tp_call */
     0,                                          /* tp_str */
     0,                                          /* tp_getattro */
     0,                                          /* tp_setattro */
diff --git a/Objects/genericaliasobject.c b/Objects/genericaliasobject.c
index c5a81a5..dbe5d89 100644
--- a/Objects/genericaliasobject.c
+++ b/Objects/genericaliasobject.c
@@ -2,6 +2,7 @@
 
 #include "Python.h"
 #include "pycore_object.h"
+#include "pycore_unionobject.h"   // _Py_union_type_or, _PyGenericAlias_Check
 #include "structmember.h"         // PyMemberDef
 
 typedef struct {
@@ -24,7 +25,7 @@
     Py_XDECREF(alias->origin);
     Py_XDECREF(alias->args);
     Py_XDECREF(alias->parameters);
-    self->ob_type->tp_free(self);
+    Py_TYPE(self)->tp_free(self);
 }
 
 static int
@@ -197,8 +198,8 @@
     return 0;
 }
 
-static PyObject *
-make_parameters(PyObject *args)
+PyObject *
+_Py_make_parameters(PyObject *args)
 {
     Py_ssize_t nargs = PyTuple_GET_SIZE(args);
     Py_ssize_t len = nargs;
@@ -293,18 +294,10 @@
     return obj;
 }
 
-static PyObject *
-ga_getitem(PyObject *self, PyObject *item)
+PyObject *
+_Py_subs_parameters(PyObject *self, PyObject *args, PyObject *parameters, PyObject *item)
 {
-    gaobject *alias = (gaobject *)self;
-    // do a lookup for __parameters__ so it gets populated (if not already)
-    if (alias->parameters == NULL) {
-        alias->parameters = make_parameters(alias->args);
-        if (alias->parameters == NULL) {
-            return NULL;
-        }
-    }
-    Py_ssize_t nparams = PyTuple_GET_SIZE(alias->parameters);
+    Py_ssize_t nparams = PyTuple_GET_SIZE(parameters);
     if (nparams == 0) {
         return PyErr_Format(PyExc_TypeError,
                             "There are no type variables left in %R",
@@ -319,32 +312,32 @@
                             nitems > nparams ? "many" : "few",
                             self);
     }
-    /* Replace all type variables (specified by alias->parameters)
+    /* Replace all type variables (specified by parameters)
        with corresponding values specified by argitems.
         t = list[T];          t[int]      -> newargs = [int]
         t = dict[str, T];     t[int]      -> newargs = [str, int]
         t = dict[T, list[S]]; t[str, int] -> newargs = [str, list[int]]
      */
-    Py_ssize_t nargs = PyTuple_GET_SIZE(alias->args);
+    Py_ssize_t nargs = PyTuple_GET_SIZE(args);
     PyObject *newargs = PyTuple_New(nargs);
     if (newargs == NULL) {
         return NULL;
     }
     for (Py_ssize_t iarg = 0; iarg < nargs; iarg++) {
-        PyObject *arg = PyTuple_GET_ITEM(alias->args, iarg);
+        PyObject *arg = PyTuple_GET_ITEM(args, iarg);
         int typevar = is_typevar(arg);
         if (typevar < 0) {
             Py_DECREF(newargs);
             return NULL;
         }
         if (typevar) {
-            Py_ssize_t iparam = tuple_index(alias->parameters, nparams, arg);
+            Py_ssize_t iparam = tuple_index(parameters, nparams, arg);
             assert(iparam >= 0);
             arg = argitems[iparam];
             Py_INCREF(arg);
         }
         else {
-            arg = subs_tvars(arg, alias->parameters, argitems);
+            arg = subs_tvars(arg, parameters, argitems);
             if (arg == NULL) {
                 Py_DECREF(newargs);
                 return NULL;
@@ -353,6 +346,26 @@
         PyTuple_SET_ITEM(newargs, iarg, arg);
     }
 
+    return newargs;
+}
+
+static PyObject *
+ga_getitem(PyObject *self, PyObject *item)
+{
+    gaobject *alias = (gaobject *)self;
+    // Populate __parameters__ if needed.
+    if (alias->parameters == NULL) {
+        alias->parameters = _Py_make_parameters(alias->args);
+        if (alias->parameters == NULL) {
+            return NULL;
+        }
+    }
+
+    PyObject *newargs = _Py_subs_parameters(self, alias->args, alias->parameters, item);
+    if (newargs == NULL) {
+        return NULL;
+    }
+
     PyObject *res = Py_GenericAlias(alias->origin, newargs);
 
     Py_DECREF(newargs);
@@ -405,6 +418,8 @@
     "__mro_entries__",
     "__reduce_ex__",  // needed so we don't look up object.__reduce_ex__
     "__reduce__",
+    "__copy__",
+    "__deepcopy__",
     NULL,
 };
 
@@ -428,8 +443,7 @@
 static PyObject *
 ga_richcompare(PyObject *a, PyObject *b, int op)
 {
-    if (!Py_IS_TYPE(a, &Py_GenericAliasType) ||
-        !Py_IS_TYPE(b, &Py_GenericAliasType) ||
+    if (!_PyGenericAlias_Check(b) ||
         (op != Py_EQ && op != Py_NE))
     {
         Py_RETURN_NOTIMPLEMENTED;
@@ -549,7 +563,7 @@
 {
     gaobject *alias = (gaobject *)self;
     if (alias->parameters == NULL) {
-        alias->parameters = make_parameters(alias->args);
+        alias->parameters = _Py_make_parameters(alias->args);
         if (alias->parameters == NULL) {
             return NULL;
         }
@@ -563,6 +577,29 @@
     {0}
 };
 
+/* A helper function to create GenericAlias' args tuple and set its attributes.
+ * Returns 1 on success, 0 on failure.
+ */
+static inline int
+setup_ga(gaobject *alias, PyObject *origin, PyObject *args) {
+    if (!PyTuple_Check(args)) {
+        args = PyTuple_Pack(1, args);
+        if (args == NULL) {
+            return 0;
+        }
+    }
+    else {
+        Py_INCREF(args);
+    }
+
+    Py_INCREF(origin);
+    alias->origin = origin;
+    alias->args = args;
+    alias->parameters = NULL;
+    alias->weakreflist = NULL;
+    return 1;
+}
+
 static PyObject *
 ga_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 {
@@ -574,9 +611,21 @@
     }
     PyObject *origin = PyTuple_GET_ITEM(args, 0);
     PyObject *arguments = PyTuple_GET_ITEM(args, 1);
-    return Py_GenericAlias(origin, arguments);
+    gaobject *self = (gaobject *)type->tp_alloc(type, 0);
+    if (self == NULL) {
+        return NULL;
+    }
+    if (!setup_ga(self, origin, arguments)) {
+        Py_DECREF(self);
+        return NULL;
+    }
+    return (PyObject *)self;
 }
 
+static PyNumberMethods ga_as_number = {
+        .nb_or = _Py_union_type_or, // Add __or__ function
+};
+
 // TODO:
 // - argument clinic?
 // - __doc__?
@@ -590,11 +639,12 @@
     .tp_basicsize = sizeof(gaobject),
     .tp_dealloc = ga_dealloc,
     .tp_repr = ga_repr,
+    .tp_as_number = &ga_as_number,  // allow X | Y of GenericAlias objs
     .tp_as_mapping = &ga_as_mapping,
     .tp_hash = ga_hash,
     .tp_call = ga_call,
     .tp_getattro = ga_getattro,
-    .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
+    .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
     .tp_traverse = ga_traverse,
     .tp_richcompare = ga_richcompare,
     .tp_weaklistoffset = offsetof(gaobject, weakreflist),
@@ -609,27 +659,14 @@
 PyObject *
 Py_GenericAlias(PyObject *origin, PyObject *args)
 {
-    if (!PyTuple_Check(args)) {
-        args = PyTuple_Pack(1, args);
-        if (args == NULL) {
-            return NULL;
-        }
-    }
-    else {
-        Py_INCREF(args);
-    }
-
-    gaobject *alias = PyObject_GC_New(gaobject, &Py_GenericAliasType);
+    gaobject *alias = (gaobject*) PyType_GenericAlloc(
+            (PyTypeObject *)&Py_GenericAliasType, 0);
     if (alias == NULL) {
-        Py_DECREF(args);
         return NULL;
     }
-
-    Py_INCREF(origin);
-    alias->origin = origin;
-    alias->args = args;
-    alias->parameters = NULL;
-    alias->weakreflist = NULL;
-    _PyObject_GC_TRACK(alias);
+    if (!setup_ga(alias, origin, args)) {
+        Py_DECREF(alias);
+        return NULL;
+    }
     return (PyObject *)alias;
 }
diff --git a/Objects/genobject.c b/Objects/genobject.c
index 72c93f6..33fc4a5 100644
--- a/Objects/genobject.c
+++ b/Objects/genobject.c
@@ -47,7 +47,7 @@
     PyObject *res = NULL;
     PyObject *error_type, *error_value, *error_traceback;
 
-    if (gen->gi_frame == NULL || gen->gi_frame->f_stacktop == NULL) {
+    if (gen->gi_frame == NULL ||  _PyFrameHasCompleted(gen->gi_frame)) {
         /* Generator isn't paused, so no need to close */
         return;
     }
@@ -136,14 +136,29 @@
     PyObject_GC_Del(gen);
 }
 
-static PyObject *
-gen_send_ex(PyGenObject *gen, PyObject *arg, int exc, int closing)
+static PySendResult
+gen_send_ex2(PyGenObject *gen, PyObject *arg, PyObject **presult,
+             int exc, int closing)
 {
     PyThreadState *tstate = _PyThreadState_GET();
     PyFrameObject *f = gen->gi_frame;
     PyObject *result;
 
-    if (gen->gi_running) {
+    *presult = NULL;
+    if (f != NULL && f->f_lasti < 0 && arg && arg != Py_None) {
+        const char *msg = "can't send non-None value to a "
+                            "just-started generator";
+        if (PyCoro_CheckExact(gen)) {
+            msg = NON_INIT_CORO_MSG;
+        }
+        else if (PyAsyncGen_CheckExact(gen)) {
+            msg = "can't send non-None value to a "
+                    "just-started async generator";
+        }
+        PyErr_SetString(PyExc_TypeError, msg);
+        return PYGEN_ERROR;
+    }
+    if (f != NULL && _PyFrame_IsExecuting(f)) {
         const char *msg = "generator already executing";
         if (PyCoro_CheckExact(gen)) {
             msg = "coroutine already executing";
@@ -152,9 +167,9 @@
             msg = "async generator already executing";
         }
         PyErr_SetString(PyExc_ValueError, msg);
-        return NULL;
+        return PYGEN_ERROR;
     }
-    if (f == NULL || f->f_stacktop == NULL) {
+    if (f == NULL || _PyFrameHasCompleted(f)) {
         if (PyCoro_CheckExact(gen) && !closing) {
             /* `gen` is an exhausted coroutine: raise an error,
                except when called from gen_close(), which should
@@ -165,37 +180,21 @@
         }
         else if (arg && !exc) {
             /* `gen` is an exhausted generator:
-               only set exception if called from send(). */
-            if (PyAsyncGen_CheckExact(gen)) {
-                PyErr_SetNone(PyExc_StopAsyncIteration);
-            }
-            else {
-                PyErr_SetNone(PyExc_StopIteration);
-            }
+               only return value if called from send(). */
+            *presult = Py_None;
+            Py_INCREF(*presult);
+            return PYGEN_RETURN;
         }
-        return NULL;
+        return PYGEN_ERROR;
     }
 
-    if (f->f_lasti == -1) {
-        if (arg && arg != Py_None) {
-            const char *msg = "can't send non-None value to a "
-                              "just-started generator";
-            if (PyCoro_CheckExact(gen)) {
-                msg = NON_INIT_CORO_MSG;
-            }
-            else if (PyAsyncGen_CheckExact(gen)) {
-                msg = "can't send non-None value to a "
-                      "just-started async generator";
-            }
-            PyErr_SetString(PyExc_TypeError, msg);
-            return NULL;
-        }
-    } else {
-        /* Push arg onto the frame's value stack */
-        result = arg ? arg : Py_None;
-        Py_INCREF(result);
-        *(f->f_stacktop++) = result;
-    }
+    assert(_PyFrame_IsRunnable(f));
+    assert(f->f_lasti >= 0 || ((unsigned char *)PyBytes_AS_STRING(f->f_code->co_code))[0] == GEN_START);
+    /* Push arg onto the frame's value stack */
+    result = arg ? arg : Py_None;
+    Py_INCREF(result);
+    gen->gi_frame->f_valuestack[gen->gi_frame->f_stackdepth] = result;
+    gen->gi_frame->f_stackdepth++;
 
     /* Generators always return to their most recent caller, not
      * necessarily their creator. */
@@ -203,7 +202,6 @@
     assert(f->f_back == NULL);
     f->f_back = tstate->frame;
 
-    gen->gi_running = 1;
     gen->gi_exc_state.previous_item = tstate->exc_info;
     tstate->exc_info = &gen->gi_exc_state;
 
@@ -215,7 +213,6 @@
     result = _PyEval_EvalFrame(tstate, f, exc);
     tstate->exc_info = gen->gi_exc_state.previous_item;
     gen->gi_exc_state.previous_item = NULL;
-    gen->gi_running = 0;
 
     /* Don't keep the reference to f_back any longer than necessary.  It
      * may keep a chain of frames alive or it could create a reference
@@ -225,53 +222,73 @@
 
     /* If the generator just returned (as opposed to yielding), signal
      * that the generator is exhausted. */
-    if (result && f->f_stacktop == NULL) {
-        if (result == Py_None) {
-            /* Delay exception instantiation if we can */
-            if (PyAsyncGen_CheckExact(gen)) {
-                PyErr_SetNone(PyExc_StopAsyncIteration);
+    if (result) {
+        if (!_PyFrameHasCompleted(f)) {
+            *presult = result;
+            return PYGEN_NEXT;
+        }
+        assert(result == Py_None || !PyAsyncGen_CheckExact(gen));
+        if (result == Py_None && !PyAsyncGen_CheckExact(gen) && !arg) {
+            /* Return NULL if called by gen_iternext() */
+            Py_CLEAR(result);
+        }
+    }
+    else {
+        if (PyErr_ExceptionMatches(PyExc_StopIteration)) {
+            const char *msg = "generator raised StopIteration";
+            if (PyCoro_CheckExact(gen)) {
+                msg = "coroutine raised StopIteration";
             }
-            else {
-                PyErr_SetNone(PyExc_StopIteration);
+            else if (PyAsyncGen_CheckExact(gen)) {
+                msg = "async generator raised StopIteration";
             }
+            _PyErr_FormatFromCause(PyExc_RuntimeError, "%s", msg);
+        }
+        else if (PyAsyncGen_CheckExact(gen) &&
+                PyErr_ExceptionMatches(PyExc_StopAsyncIteration))
+        {
+            /* code in `gen` raised a StopAsyncIteration error:
+               raise a RuntimeError.
+            */
+            const char *msg = "async generator raised StopAsyncIteration";
+            _PyErr_FormatFromCause(PyExc_RuntimeError, "%s", msg);
+        }
+    }
+
+    /* generator can't be rerun, so release the frame */
+    /* first clean reference cycle through stored exception traceback */
+    _PyErr_ClearExcState(&gen->gi_exc_state);
+    gen->gi_frame->f_gen = NULL;
+    gen->gi_frame = NULL;
+    Py_DECREF(f);
+
+    *presult = result;
+    return result ? PYGEN_RETURN : PYGEN_ERROR;
+}
+
+static PySendResult
+PyGen_am_send(PyGenObject *gen, PyObject *arg, PyObject **result)
+{
+    return gen_send_ex2(gen, arg, result, 0, 0);
+}
+
+static PyObject *
+gen_send_ex(PyGenObject *gen, PyObject *arg, int exc, int closing)
+{
+    PyObject *result;
+    if (gen_send_ex2(gen, arg, &result, exc, closing) == PYGEN_RETURN) {
+        if (PyAsyncGen_CheckExact(gen)) {
+            assert(result == Py_None);
+            PyErr_SetNone(PyExc_StopAsyncIteration);
+        }
+        else if (result == Py_None) {
+            PyErr_SetNone(PyExc_StopIteration);
         }
         else {
-            /* Async generators cannot return anything but None */
-            assert(!PyAsyncGen_CheckExact(gen));
             _PyGen_SetStopIterationValue(result);
         }
         Py_CLEAR(result);
     }
-    else if (!result && PyErr_ExceptionMatches(PyExc_StopIteration)) {
-        const char *msg = "generator raised StopIteration";
-        if (PyCoro_CheckExact(gen)) {
-            msg = "coroutine raised StopIteration";
-        }
-        else if (PyAsyncGen_CheckExact(gen)) {
-            msg = "async generator raised StopIteration";
-        }
-        _PyErr_FormatFromCause(PyExc_RuntimeError, "%s", msg);
-
-    }
-    else if (!result && PyAsyncGen_CheckExact(gen) &&
-             PyErr_ExceptionMatches(PyExc_StopAsyncIteration))
-    {
-        /* code in `gen` raised a StopAsyncIteration error:
-           raise a RuntimeError.
-        */
-        const char *msg = "async generator raised StopAsyncIteration";
-        _PyErr_FormatFromCause(PyExc_RuntimeError, "%s", msg);
-    }
-
-    if (!result || f->f_stacktop == NULL) {
-        /* generator can't be rerun, so release the frame */
-        /* first clean reference cycle through stored exception traceback */
-        _PyErr_ClearExcState(&gen->gi_exc_state);
-        gen->gi_frame->f_gen = NULL;
-        gen->gi_frame = NULL;
-        Py_DECREF(f);
-    }
-
     return result;
 }
 
@@ -279,8 +296,8 @@
 "send(arg) -> send 'arg' into generator,\n\
 return next yielded value or raise StopIteration.");
 
-PyObject *
-_PyGen_Send(PyGenObject *gen, PyObject *arg)
+static PyObject *
+gen_send(PyGenObject *gen, PyObject *arg)
 {
     return gen_send_ex(gen, arg, 0, 0);
 }
@@ -326,7 +343,7 @@
     PyObject *yf = NULL;
     PyFrameObject *f = gen->gi_frame;
 
-    if (f && f->f_stacktop) {
+    if (f) {
         PyObject *bytecode = f->f_code->co_code;
         unsigned char *code = (unsigned char *)PyBytes_AS_STRING(bytecode);
 
@@ -338,9 +355,10 @@
             return NULL;
         }
 
-        if (code[f->f_lasti + sizeof(_Py_CODEUNIT)] != YIELD_FROM)
+        if (code[(f->f_lasti+1)*sizeof(_Py_CODEUNIT)] != YIELD_FROM)
             return NULL;
-        yf = f->f_stacktop[-1];
+        assert(f->f_stackdepth > 0);
+        yf = f->f_valuestack[f->f_stackdepth-1];
         Py_INCREF(yf);
     }
 
@@ -355,9 +373,10 @@
     int err = 0;
 
     if (yf) {
-        gen->gi_running = 1;
+        PyFrameState state = gen->gi_frame->f_state;
+        gen->gi_frame->f_state = FRAME_EXECUTING;
         err = gen_close_iter(yf);
-        gen->gi_running = 0;
+        gen->gi_frame->f_state = state;
         Py_DECREF(yf);
     }
     if (err == 0)
@@ -404,9 +423,10 @@
                We have to allow some awaits to work it through, hence the
                `close_on_genexit` parameter here.
             */
-            gen->gi_running = 1;
+            PyFrameState state = gen->gi_frame->f_state;
+            gen->gi_frame->f_state = FRAME_EXECUTING;
             err = gen_close_iter(yf);
-            gen->gi_running = 0;
+            gen->gi_frame->f_state = state;
             Py_DECREF(yf);
             if (err < 0)
                 return gen_send_ex(gen, Py_None, 1, 0);
@@ -417,7 +437,6 @@
             PyThreadState *tstate = _PyThreadState_GET();
             PyFrameObject *f = tstate->frame;
 
-            gen->gi_running = 1;
             /* Since we are fast-tracking things by skipping the eval loop,
                we need to update the current frame so the stack trace
                will be reported correctly to the user. */
@@ -426,10 +445,12 @@
             tstate->frame = gen->gi_frame;
             /* Close the generator that we are currently iterating with
                'yield from' or awaiting on with 'await'. */
+            PyFrameState state = gen->gi_frame->f_state;
+            gen->gi_frame->f_state = FRAME_EXECUTING;
             ret = _gen_throw((PyGenObject *)yf, close_on_genexit,
                              typ, val, tb);
+            gen->gi_frame->f_state = state;
             tstate->frame = f;
-            gen->gi_running = 0;
         } else {
             /* `yf` is an iterator or a coroutine-like object. */
             PyObject *meth;
@@ -441,23 +462,26 @@
                 Py_DECREF(yf);
                 goto throw_here;
             }
-            gen->gi_running = 1;
+            PyFrameState state = gen->gi_frame->f_state;
+            gen->gi_frame->f_state = FRAME_EXECUTING;
             ret = PyObject_CallFunctionObjArgs(meth, typ, val, tb, NULL);
-            gen->gi_running = 0;
+            gen->gi_frame->f_state = state;
             Py_DECREF(meth);
         }
         Py_DECREF(yf);
         if (!ret) {
             PyObject *val;
             /* Pop subiterator from stack */
-            ret = *(--gen->gi_frame->f_stacktop);
+            assert(gen->gi_frame->f_stackdepth > 0);
+            gen->gi_frame->f_stackdepth--;
+            ret = gen->gi_frame->f_valuestack[gen->gi_frame->f_stackdepth];
             assert(ret == yf);
             Py_DECREF(ret);
             /* Termination repetition of YIELD_FROM */
             assert(gen->gi_frame->f_lasti >= 0);
-            gen->gi_frame->f_lasti += sizeof(_Py_CODEUNIT);
+            gen->gi_frame->f_lasti += 1;
             if (_PyGen_FetchStopIterationValue(&val) == 0) {
-                ret = gen_send_ex(gen, val, 0, 0);
+                ret = gen_send(gen, val);
                 Py_DECREF(val);
             } else {
                 ret = gen_send_ex(gen, Py_None, 1, 0);
@@ -543,7 +567,15 @@
 static PyObject *
 gen_iternext(PyGenObject *gen)
 {
-    return gen_send_ex(gen, NULL, 0, 0);
+    PyObject *result;
+    assert(PyGen_CheckExact(gen) || PyCoro_CheckExact(gen));
+    if (gen_send_ex2(gen, NULL, &result, 0, 0) == PYGEN_RETURN) {
+        if (result != Py_None) {
+            _PyGen_SetStopIterationValue(result);
+        }
+        Py_CLEAR(result);
+    }
+    return result;
 }
 
 /*
@@ -700,6 +732,16 @@
     return yf;
 }
 
+
+static PyObject *
+gen_getrunning(PyGenObject *gen, void *Py_UNUSED(ignored))
+{
+    if (gen->gi_frame == NULL) {
+        Py_RETURN_FALSE;
+    }
+    return PyBool_FromLong(_PyFrame_IsExecuting(gen->gi_frame));
+}
+
 static PyGetSetDef gen_getsetlist[] = {
     {"__name__", (getter)gen_get_name, (setter)gen_set_name,
      PyDoc_STR("name of the generator")},
@@ -707,23 +749,31 @@
      PyDoc_STR("qualified name of the generator")},
     {"gi_yieldfrom", (getter)gen_getyieldfrom, NULL,
      PyDoc_STR("object being iterated by yield from, or None")},
+    {"gi_running", (getter)gen_getrunning, NULL, NULL},
     {NULL} /* Sentinel */
 };
 
 static PyMemberDef gen_memberlist[] = {
-    {"gi_frame",     T_OBJECT, offsetof(PyGenObject, gi_frame),    READONLY},
-    {"gi_running",   T_BOOL,   offsetof(PyGenObject, gi_running),  READONLY},
-    {"gi_code",      T_OBJECT, offsetof(PyGenObject, gi_code),     READONLY},
+    {"gi_frame",     T_OBJECT, offsetof(PyGenObject, gi_frame),    READONLY|PY_AUDIT_READ},
+    {"gi_code",      T_OBJECT, offsetof(PyGenObject, gi_code),     READONLY|PY_AUDIT_READ},
     {NULL}      /* Sentinel */
 };
 
 static PyMethodDef gen_methods[] = {
-    {"send",(PyCFunction)_PyGen_Send, METH_O, send_doc},
+    {"send",(PyCFunction)gen_send, METH_O, send_doc},
     {"throw",(PyCFunction)gen_throw, METH_VARARGS, throw_doc},
     {"close",(PyCFunction)gen_close, METH_NOARGS, close_doc},
     {NULL, NULL}        /* Sentinel */
 };
 
+static PyAsyncMethods gen_as_async = {
+    0,                                          /* am_await */
+    0,                                          /* am_aiter */
+    0,                                          /* am_anext */
+    (sendfunc)PyGen_am_send,                    /* am_send  */
+};
+
+
 PyTypeObject PyGen_Type = {
     PyVarObject_HEAD_INIT(&PyType_Type, 0)
     "generator",                                /* tp_name */
@@ -734,7 +784,7 @@
     0,                                          /* tp_vectorcall_offset */
     0,                                          /* tp_getattr */
     0,                                          /* tp_setattr */
-    0,                                          /* tp_as_async */
+    &gen_as_async,                              /* tp_as_async */
     (reprfunc)gen_repr,                         /* tp_repr */
     0,                                          /* tp_as_number */
     0,                                          /* tp_as_sequence */
@@ -790,7 +840,6 @@
     f->f_gen = (PyObject *) gen;
     Py_INCREF(f->f_code);
     gen->gi_code = (PyObject *)(f->f_code);
-    gen->gi_running = 0;
     gen->gi_weakreflist = NULL;
     gen->gi_exc_state.exc_type = NULL;
     gen->gi_exc_state.exc_value = NULL;
@@ -920,6 +969,15 @@
     return yf;
 }
 
+static PyObject *
+cr_getrunning(PyCoroObject *coro, void *Py_UNUSED(ignored))
+{
+    if (coro->cr_frame == NULL) {
+        Py_RETURN_FALSE;
+    }
+    return PyBool_FromLong(_PyFrame_IsExecuting(coro->cr_frame));
+}
+
 static PyGetSetDef coro_getsetlist[] = {
     {"__name__", (getter)gen_get_name, (setter)gen_set_name,
      PyDoc_STR("name of the coroutine")},
@@ -927,13 +985,13 @@
      PyDoc_STR("qualified name of the coroutine")},
     {"cr_await", (getter)coro_get_cr_await, NULL,
      PyDoc_STR("object being awaited on, or None")},
+    {"cr_running", (getter)cr_getrunning, NULL, NULL},
     {NULL} /* Sentinel */
 };
 
 static PyMemberDef coro_memberlist[] = {
-    {"cr_frame",     T_OBJECT, offsetof(PyCoroObject, cr_frame),    READONLY},
-    {"cr_running",   T_BOOL,   offsetof(PyCoroObject, cr_running),  READONLY},
-    {"cr_code",      T_OBJECT, offsetof(PyCoroObject, cr_code),     READONLY},
+    {"cr_frame",     T_OBJECT, offsetof(PyCoroObject, cr_frame),    READONLY|PY_AUDIT_READ},
+    {"cr_code",      T_OBJECT, offsetof(PyCoroObject, cr_code),     READONLY|PY_AUDIT_READ},
     {"cr_origin",    T_OBJECT, offsetof(PyCoroObject, cr_origin),   READONLY},
     {NULL}      /* Sentinel */
 };
@@ -950,7 +1008,7 @@
 "close() -> raise GeneratorExit inside coroutine.");
 
 static PyMethodDef coro_methods[] = {
-    {"send",(PyCFunction)_PyGen_Send, METH_O, coro_send_doc},
+    {"send",(PyCFunction)gen_send, METH_O, coro_send_doc},
     {"throw",(PyCFunction)gen_throw, METH_VARARGS, coro_throw_doc},
     {"close",(PyCFunction)gen_close, METH_NOARGS, coro_close_doc},
     {NULL, NULL}        /* Sentinel */
@@ -959,7 +1017,8 @@
 static PyAsyncMethods coro_as_async = {
     (unaryfunc)coro_await,                      /* am_await */
     0,                                          /* am_aiter */
-    0                                           /* am_anext */
+    0,                                          /* am_anext */
+    (sendfunc)PyGen_am_send,                    /* am_send  */
 };
 
 PyTypeObject PyCoro_Type = {
@@ -1025,13 +1084,13 @@
 static PyObject *
 coro_wrapper_iternext(PyCoroWrapper *cw)
 {
-    return gen_send_ex((PyGenObject *)cw->cw_coroutine, NULL, 0, 0);
+    return gen_iternext((PyGenObject *)cw->cw_coroutine);
 }
 
 static PyObject *
 coro_wrapper_send(PyCoroWrapper *cw, PyObject *arg)
 {
-    return gen_send_ex((PyGenObject *)cw->cw_coroutine, arg, 0, 0);
+    return gen_send((PyGenObject *)cw->cw_coroutine, arg);
 }
 
 static PyObject *
@@ -1171,7 +1230,7 @@
 } AwaitableState;
 
 
-typedef struct {
+typedef struct PyAsyncGenASend {
     PyObject_HEAD
     PyAsyncGenObject *ags_gen;
 
@@ -1183,7 +1242,7 @@
 } PyAsyncGenASend;
 
 
-typedef struct {
+typedef struct PyAsyncGenAThrow {
     PyObject_HEAD
     PyAsyncGenObject *agt_gen;
 
@@ -1195,28 +1254,12 @@
 } PyAsyncGenAThrow;
 
 
-typedef struct {
+typedef struct _PyAsyncGenWrappedValue {
     PyObject_HEAD
     PyObject *agw_val;
 } _PyAsyncGenWrappedValue;
 
 
-#ifndef _PyAsyncGen_MAXFREELIST
-#define _PyAsyncGen_MAXFREELIST 80
-#endif
-
-/* Freelists boost performance 6-10%; they also reduce memory
-   fragmentation, as _PyAsyncGenWrappedValue and PyAsyncGenASend
-   are short-living objects that are instantiated for every
-   __anext__ call.
-*/
-
-static _PyAsyncGenWrappedValue *ag_value_freelist[_PyAsyncGen_MAXFREELIST];
-static int ag_value_freelist_free = 0;
-
-static PyAsyncGenASend *ag_asend_freelist[_PyAsyncGen_MAXFREELIST];
-static int ag_asend_freelist_free = 0;
-
 #define _PyAsyncGenWrappedValue_CheckExact(o) \
                     Py_IS_TYPE(o, &_PyAsyncGenWrappedValue_Type)
 
@@ -1328,10 +1371,10 @@
 };
 
 static PyMemberDef async_gen_memberlist[] = {
-    {"ag_frame",   T_OBJECT, offsetof(PyAsyncGenObject, ag_frame),   READONLY},
+    {"ag_frame",   T_OBJECT, offsetof(PyAsyncGenObject, ag_frame),   READONLY|PY_AUDIT_READ},
     {"ag_running", T_BOOL,   offsetof(PyAsyncGenObject, ag_running_async),
         READONLY},
-    {"ag_code",    T_OBJECT, offsetof(PyAsyncGenObject, ag_code),    READONLY},
+    {"ag_code",    T_OBJECT, offsetof(PyAsyncGenObject, ag_code),    READONLY|PY_AUDIT_READ},
     {NULL}      /* Sentinel */
 };
 
@@ -1357,7 +1400,8 @@
 static PyAsyncMethods async_gen_as_async = {
     0,                                          /* am_await */
     PyObject_SelfIter,                          /* am_aiter */
-    (unaryfunc)async_gen_anext                  /* am_anext */
+    (unaryfunc)async_gen_anext,                 /* am_anext */
+    (sendfunc)PyGen_am_send,                    /* am_send  */
 };
 
 
@@ -1414,6 +1458,14 @@
 };
 
 
+static struct _Py_async_gen_state *
+get_async_gen_state(void)
+{
+    PyInterpreterState *interp = _PyInterpreterState_GET();
+    return &interp->async_gen;
+}
+
+
 PyObject *
 PyAsyncGen_New(PyFrameObject *f, PyObject *name, PyObject *qualname)
 {
@@ -1432,27 +1484,34 @@
 
 
 void
-_PyAsyncGen_ClearFreeLists(void)
+_PyAsyncGen_ClearFreeLists(PyInterpreterState *interp)
 {
-    while (ag_value_freelist_free) {
+    struct _Py_async_gen_state *state = &interp->async_gen;
+
+    while (state->value_numfree) {
         _PyAsyncGenWrappedValue *o;
-        o = ag_value_freelist[--ag_value_freelist_free];
+        o = state->value_freelist[--state->value_numfree];
         assert(_PyAsyncGenWrappedValue_CheckExact(o));
         PyObject_GC_Del(o);
     }
 
-    while (ag_asend_freelist_free) {
+    while (state->asend_numfree) {
         PyAsyncGenASend *o;
-        o = ag_asend_freelist[--ag_asend_freelist_free];
+        o = state->asend_freelist[--state->asend_numfree];
         assert(Py_IS_TYPE(o, &_PyAsyncGenASend_Type));
         PyObject_GC_Del(o);
     }
 }
 
 void
-_PyAsyncGen_Fini(void)
+_PyAsyncGen_Fini(PyInterpreterState *interp)
 {
-    _PyAsyncGen_ClearFreeLists();
+    _PyAsyncGen_ClearFreeLists(interp);
+#ifdef Py_DEBUG
+    struct _Py_async_gen_state *state = &interp->async_gen;
+    state->value_numfree = -1;
+    state->asend_numfree = -1;
+#endif
 }
 
 
@@ -1495,10 +1554,16 @@
     _PyObject_GC_UNTRACK((PyObject *)o);
     Py_CLEAR(o->ags_gen);
     Py_CLEAR(o->ags_sendval);
-    if (ag_asend_freelist_free < _PyAsyncGen_MAXFREELIST) {
+    struct _Py_async_gen_state *state = get_async_gen_state();
+#ifdef Py_DEBUG
+    // async_gen_asend_dealloc() must not be called after _PyAsyncGen_Fini()
+    assert(state->asend_numfree != -1);
+#endif
+    if (state->asend_numfree < _PyAsyncGen_MAXFREELIST) {
         assert(PyAsyncGenASend_CheckExact(o));
-        ag_asend_freelist[ag_asend_freelist_free++] = o;
-    } else {
+        state->asend_freelist[state->asend_numfree++] = o;
+    }
+    else {
         PyObject_GC_Del(o);
     }
 }
@@ -1539,7 +1604,7 @@
     }
 
     o->ags_gen->ag_running_async = 1;
-    result = gen_send_ex((PyGenObject*)o->ags_gen, arg, 0, 0);
+    result = gen_send((PyGenObject*)o->ags_gen, arg);
     result = async_gen_unwrap_value(o->ags_gen, result);
 
     if (result == NULL) {
@@ -1599,7 +1664,8 @@
 static PyAsyncMethods async_gen_asend_as_async = {
     PyObject_SelfIter,                          /* am_await */
     0,                                          /* am_aiter */
-    0                                           /* am_anext */
+    0,                                          /* am_anext */
+    0,                                          /* am_send  */
 };
 
 
@@ -1650,11 +1716,17 @@
 async_gen_asend_new(PyAsyncGenObject *gen, PyObject *sendval)
 {
     PyAsyncGenASend *o;
-    if (ag_asend_freelist_free) {
-        ag_asend_freelist_free--;
-        o = ag_asend_freelist[ag_asend_freelist_free];
+    struct _Py_async_gen_state *state = get_async_gen_state();
+#ifdef Py_DEBUG
+    // async_gen_asend_new() must not be called after _PyAsyncGen_Fini()
+    assert(state->asend_numfree != -1);
+#endif
+    if (state->asend_numfree) {
+        state->asend_numfree--;
+        o = state->asend_freelist[state->asend_numfree];
         _Py_NewReference((PyObject *)o);
-    } else {
+    }
+    else {
         o = PyObject_GC_New(PyAsyncGenASend, &_PyAsyncGenASend_Type);
         if (o == NULL) {
             return NULL;
@@ -1682,10 +1754,16 @@
 {
     _PyObject_GC_UNTRACK((PyObject *)o);
     Py_CLEAR(o->agw_val);
-    if (ag_value_freelist_free < _PyAsyncGen_MAXFREELIST) {
+    struct _Py_async_gen_state *state = get_async_gen_state();
+#ifdef Py_DEBUG
+    // async_gen_wrapped_val_dealloc() must not be called after _PyAsyncGen_Fini()
+    assert(state->value_numfree != -1);
+#endif
+    if (state->value_numfree < _PyAsyncGen_MAXFREELIST) {
         assert(_PyAsyncGenWrappedValue_CheckExact(o));
-        ag_value_freelist[ag_value_freelist_free++] = o;
-    } else {
+        state->value_freelist[state->value_numfree++] = o;
+    }
+    else {
         PyObject_GC_Del(o);
     }
 }
@@ -1749,12 +1827,18 @@
     _PyAsyncGenWrappedValue *o;
     assert(val);
 
-    if (ag_value_freelist_free) {
-        ag_value_freelist_free--;
-        o = ag_value_freelist[ag_value_freelist_free];
+    struct _Py_async_gen_state *state = get_async_gen_state();
+#ifdef Py_DEBUG
+    // _PyAsyncGenValueWrapperNew() must not be called after _PyAsyncGen_Fini()
+    assert(state->value_numfree != -1);
+#endif
+    if (state->value_numfree) {
+        state->value_numfree--;
+        o = state->value_freelist[state->value_numfree];
         assert(_PyAsyncGenWrappedValue_CheckExact(o));
         _Py_NewReference((PyObject*)o);
-    } else {
+    }
+    else {
         o = PyObject_GC_New(_PyAsyncGenWrappedValue,
                             &_PyAsyncGenWrappedValue_Type);
         if (o == NULL) {
@@ -1804,7 +1888,7 @@
         return NULL;
     }
 
-    if (f == NULL || f->f_stacktop == NULL) {
+    if (f == NULL || _PyFrameHasCompleted(f)) {
         o->agt_state = AWAITABLE_STATE_CLOSED;
         PyErr_SetNone(PyExc_StopIteration);
         return NULL;
@@ -1877,7 +1961,7 @@
 
     assert(o->agt_state == AWAITABLE_STATE_ITER);
 
-    retval = gen_send_ex((PyGenObject *)gen, arg, 0, 0);
+    retval = gen_send((PyGenObject *)gen, arg);
     if (o->agt_args) {
         return async_gen_unwrap_value(o->agt_gen, retval);
     } else {
@@ -1989,7 +2073,8 @@
 static PyAsyncMethods async_gen_athrow_as_async = {
     PyObject_SelfIter,                          /* am_await */
     0,                                          /* am_aiter */
-    0                                           /* am_anext */
+    0,                                          /* am_anext */
+    0,                                          /* am_send  */
 };
 
 
diff --git a/Objects/interpreteridobject.c b/Objects/interpreteridobject.c
index 39bde97..4623910 100644
--- a/Objects/interpreteridobject.c
+++ b/Objects/interpreteridobject.c
@@ -24,15 +24,21 @@
         }
     }
 
+    if (interp != NULL) {
+        if (_PyInterpreterState_IDIncref(interp) < 0) {
+            return NULL;
+        }
+    }
+
     interpid *self = PyObject_New(interpid, cls);
     if (self == NULL) {
+        if (interp != NULL) {
+            _PyInterpreterState_IDDecref(interp);
+        }
         return NULL;
     }
     self->id = id;
 
-    if (interp != NULL) {
-        _PyInterpreterState_IDIncref(interp);
-    }
     return self;
 }
 
diff --git a/Objects/iterobject.c b/Objects/iterobject.c
index 6cac41a..e493e41 100644
--- a/Objects/iterobject.c
+++ b/Objects/iterobject.c
@@ -157,7 +157,7 @@
     PyObject_GenericGetAttr,                    /* tp_getattro */
     0,                                          /* tp_setattro */
     0,                                          /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */
+    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,    /* tp_flags */
     0,                                          /* tp_doc */
     (traverseproc)iter_traverse,                /* tp_traverse */
     0,                                          /* tp_clear */
@@ -276,7 +276,7 @@
     PyObject_GenericGetAttr,                    /* tp_getattro */
     0,                                          /* tp_setattro */
     0,                                          /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */
+    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,    /* tp_flags */
     0,                                          /* tp_doc */
     (traverseproc)calliter_traverse,            /* tp_traverse */
     0,                                          /* tp_clear */
@@ -288,3 +288,214 @@
 };
 
 
+/* -------------------------------------- */
+
+typedef struct {
+    PyObject_HEAD
+    PyObject *wrapped;
+    PyObject *default_value;
+} anextawaitableobject;
+
+static void
+anextawaitable_dealloc(anextawaitableobject *obj)
+{
+    _PyObject_GC_UNTRACK(obj);
+    Py_XDECREF(obj->wrapped);
+    Py_XDECREF(obj->default_value);
+    PyObject_GC_Del(obj);
+}
+
+static int
+anextawaitable_traverse(anextawaitableobject *obj, visitproc visit, void *arg)
+{
+    Py_VISIT(obj->wrapped);
+    Py_VISIT(obj->default_value);
+    return 0;
+}
+
+static PyObject *
+anextawaitable_getiter(anextawaitableobject *obj)
+{
+    assert(obj->wrapped != NULL);
+    PyObject *awaitable = _PyCoro_GetAwaitableIter(obj->wrapped);
+    if (awaitable == NULL) {
+        return NULL;
+    }
+    if (Py_TYPE(awaitable)->tp_iternext == NULL) {
+        /* _PyCoro_GetAwaitableIter returns a Coroutine, a Generator,
+         * or an iterator. Of these, only coroutines lack tp_iternext.
+         */
+        assert(PyCoro_CheckExact(awaitable));
+        unaryfunc getter = Py_TYPE(awaitable)->tp_as_async->am_await;
+        PyObject *new_awaitable = getter(awaitable);
+        if (new_awaitable == NULL) {
+            Py_DECREF(awaitable);
+            return NULL;
+        }
+        Py_SETREF(awaitable, new_awaitable);
+        if (!PyIter_Check(awaitable)) {
+            PyErr_SetString(PyExc_TypeError,
+                            "__await__ returned a non-iterable");
+            Py_DECREF(awaitable);
+            return NULL;
+        }
+    }
+    return awaitable;
+}
+
+static PyObject *
+anextawaitable_iternext(anextawaitableobject *obj)
+{
+    /* Consider the following class:
+     *
+     *     class A:
+     *         async def __anext__(self):
+     *             ...
+     *     a = A()
+     *
+     * Then `await anext(a)` should call
+     * a.__anext__().__await__().__next__()
+     *
+     * On the other hand, given
+     *
+     *     async def agen():
+     *         yield 1
+     *         yield 2
+     *     gen = agen()
+     *
+     * Then `await anext(gen)` can just call
+     * gen.__anext__().__next__()
+     */
+    PyObject *awaitable = anextawaitable_getiter(obj);
+    if (awaitable == NULL) {
+        return NULL;
+    }
+    PyObject *result = (*Py_TYPE(awaitable)->tp_iternext)(awaitable);
+    Py_DECREF(awaitable);
+    if (result != NULL) {
+        return result;
+    }
+    if (PyErr_ExceptionMatches(PyExc_StopAsyncIteration)) {
+        _PyGen_SetStopIterationValue(obj->default_value);
+    }
+    return NULL;
+}
+
+
+static PyObject *
+anextawaitable_proxy(anextawaitableobject *obj, char *meth, PyObject *arg) {
+    PyObject *awaitable = anextawaitable_getiter(obj);
+    if (awaitable == NULL) {
+        return NULL;
+    }
+    PyObject *ret = PyObject_CallMethod(awaitable, meth, "O", arg);
+    Py_DECREF(awaitable);
+    if (ret != NULL) {
+        return ret;
+    }
+    if (PyErr_ExceptionMatches(PyExc_StopAsyncIteration)) {
+        /* `anextawaitableobject` is only used by `anext()` when
+         * a default value is provided. So when we have a StopAsyncIteration
+         * exception we replace it with a `StopIteration(default)`, as if
+         * it was the return value of `__anext__()` coroutine.
+         */
+        _PyGen_SetStopIterationValue(obj->default_value);
+    }
+    return NULL;
+}
+
+
+static PyObject *
+anextawaitable_send(anextawaitableobject *obj, PyObject *arg) {
+    return anextawaitable_proxy(obj, "send", arg);
+}
+
+
+static PyObject *
+anextawaitable_throw(anextawaitableobject *obj, PyObject *arg) {
+    return anextawaitable_proxy(obj, "throw", arg);
+}
+
+
+static PyObject *
+anextawaitable_close(anextawaitableobject *obj, PyObject *arg) {
+    return anextawaitable_proxy(obj, "close", arg);
+}
+
+
+PyDoc_STRVAR(send_doc,
+"send(arg) -> send 'arg' into the wrapped iterator,\n\
+return next yielded value or raise StopIteration.");
+
+
+PyDoc_STRVAR(throw_doc,
+"throw(typ[,val[,tb]]) -> raise exception in the wrapped iterator,\n\
+return next yielded value or raise StopIteration.");
+
+
+PyDoc_STRVAR(close_doc,
+"close() -> raise GeneratorExit inside generator.");
+
+
+static PyMethodDef anextawaitable_methods[] = {
+    {"send",(PyCFunction)anextawaitable_send, METH_O, send_doc},
+    {"throw",(PyCFunction)anextawaitable_throw, METH_VARARGS, throw_doc},
+    {"close",(PyCFunction)anextawaitable_close, METH_VARARGS, close_doc},
+    {NULL, NULL}        /* Sentinel */
+};
+
+
+static PyAsyncMethods anextawaitable_as_async = {
+    PyObject_SelfIter,                          /* am_await */
+    0,                                          /* am_aiter */
+    0,                                          /* am_anext */
+    0,                                          /* am_send  */
+};
+
+PyTypeObject _PyAnextAwaitable_Type = {
+    PyVarObject_HEAD_INIT(&PyType_Type, 0)
+    "anext_awaitable",                          /* tp_name */
+    sizeof(anextawaitableobject),               /* tp_basicsize */
+    0,                                          /* tp_itemsize */
+    /* methods */
+    (destructor)anextawaitable_dealloc,         /* tp_dealloc */
+    0,                                          /* tp_vectorcall_offset */
+    0,                                          /* tp_getattr */
+    0,                                          /* tp_setattr */
+    &anextawaitable_as_async,                   /* tp_as_async */
+    0,                                          /* tp_repr */
+    0,                                          /* tp_as_number */
+    0,                                          /* tp_as_sequence */
+    0,                                          /* tp_as_mapping */
+    0,                                          /* tp_hash */
+    0,                                          /* tp_call */
+    0,                                          /* tp_str */
+    PyObject_GenericGetAttr,                    /* tp_getattro */
+    0,                                          /* tp_setattro */
+    0,                                          /* tp_as_buffer */
+    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,    /* tp_flags */
+    0,                                          /* tp_doc */
+    (traverseproc)anextawaitable_traverse,      /* tp_traverse */
+    0,                                          /* tp_clear */
+    0,                                          /* tp_richcompare */
+    0,                                          /* tp_weaklistoffset */
+    PyObject_SelfIter,                          /* tp_iter */
+    (unaryfunc)anextawaitable_iternext,         /* tp_iternext */
+    anextawaitable_methods,                     /* tp_methods */
+};
+
+PyObject *
+PyAnextAwaitable_New(PyObject *awaitable, PyObject *default_value)
+{
+    anextawaitableobject *anext = PyObject_GC_New(
+            anextawaitableobject, &_PyAnextAwaitable_Type);
+    if (anext == NULL) {
+        return NULL;
+    }
+    Py_INCREF(awaitable);
+    anext->wrapped = awaitable;
+    Py_INCREF(default_value);
+    anext->default_value = default_value;
+    _PyObject_GC_TRACK(anext);
+    return (PyObject *)anext;
+}
diff --git a/Objects/listobject.c b/Objects/listobject.c
index f9eb370..533ee74 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -1,10 +1,10 @@
 /* List object implementation */
 
 #include "Python.h"
-#include "pycore_abstract.h"   // _PyIndex_Check()
-#include "pycore_object.h"
-#include "pycore_tupleobject.h"
-#include "pycore_accu.h"
+#include "pycore_abstract.h"      // _PyIndex_Check()
+#include "pycore_interp.h"        // PyInterpreterState.list
+#include "pycore_object.h"        // _PyObject_GC_TRACK()
+#include "pycore_tuple.h"         // _PyTuple_FromArray()
 
 #ifdef STDC_HEADERS
 #include <stddef.h>
@@ -19,6 +19,15 @@
 
 #include "clinic/listobject.c.h"
 
+
+static struct _Py_list_state *
+get_list_state(void)
+{
+    PyInterpreterState *interp = _PyInterpreterState_GET();
+    return &interp->list;
+}
+
+
 /* Ensure ob_item has room for at least newsize elements, and set
  * ob_size to newsize.  If newsize > ob_size on entry, the content
  * of the new slots at exit is undefined heap trash; it's the caller's
@@ -60,7 +69,7 @@
      *       is PY_SSIZE_T_MAX * (9 / 8) + 6 which always fits in a size_t.
      */
     new_allocated = ((size_t)newsize + (newsize >> 3) + 6) & ~(size_t)3;
-    /* Do not overallocate if the new size is closer to overalocated size
+    /* Do not overallocate if the new size is closer to overallocated size
      * than to the old size.
      */
     if (newsize - Py_SIZE(self) > (Py_ssize_t)(new_allocated - newsize))
@@ -96,59 +105,65 @@
     return 0;
 }
 
-/* Empty list reuse scheme to save calls to malloc and free */
-#ifndef PyList_MAXFREELIST
-#  define PyList_MAXFREELIST 80
-#endif
-
-static PyListObject *free_list[PyList_MAXFREELIST];
-static int numfree = 0;
-
 void
-_PyList_ClearFreeList(void)
+_PyList_ClearFreeList(PyInterpreterState *interp)
 {
-    while (numfree) {
-        PyListObject *op = free_list[--numfree];
+    struct _Py_list_state *state = &interp->list;
+    while (state->numfree) {
+        PyListObject *op = state->free_list[--state->numfree];
         assert(PyList_CheckExact(op));
         PyObject_GC_Del(op);
     }
 }
 
 void
-_PyList_Fini(void)
+_PyList_Fini(PyInterpreterState *interp)
 {
-    _PyList_ClearFreeList();
+    _PyList_ClearFreeList(interp);
+#ifdef Py_DEBUG
+    struct _Py_list_state *state = &interp->list;
+    state->numfree = -1;
+#endif
 }
 
 /* Print summary info about the state of the optimized allocator */
 void
 _PyList_DebugMallocStats(FILE *out)
 {
+    struct _Py_list_state *state = get_list_state();
     _PyDebugAllocatorStats(out,
                            "free PyListObject",
-                           numfree, sizeof(PyListObject));
+                           state->numfree, sizeof(PyListObject));
 }
 
 PyObject *
 PyList_New(Py_ssize_t size)
 {
-    PyListObject *op;
-
     if (size < 0) {
         PyErr_BadInternalCall();
         return NULL;
     }
-    if (numfree) {
-        numfree--;
-        op = free_list[numfree];
+
+    struct _Py_list_state *state = get_list_state();
+    PyListObject *op;
+#ifdef Py_DEBUG
+    // PyList_New() must not be called after _PyList_Fini()
+    assert(state->numfree != -1);
+#endif
+    if (state->numfree) {
+        state->numfree--;
+        op = state->free_list[state->numfree];
         _Py_NewReference((PyObject *)op);
-    } else {
-        op = PyObject_GC_New(PyListObject, &PyList_Type);
-        if (op == NULL)
-            return NULL;
     }
-    if (size <= 0)
+    else {
+        op = PyObject_GC_New(PyListObject, &PyList_Type);
+        if (op == NULL) {
+            return NULL;
+        }
+    }
+    if (size <= 0) {
         op->ob_item = NULL;
+    }
     else {
         op->ob_item = (PyObject **) PyMem_Calloc(size, sizeof(PyObject *));
         if (op->ob_item == NULL) {
@@ -165,9 +180,10 @@
 static PyObject *
 list_new_prealloc(Py_ssize_t size)
 {
+    assert(size > 0);
     PyListObject *op = (PyListObject *) PyList_New(0);
-    if (size == 0 || op == NULL) {
-        return (PyObject *) op;
+    if (op == NULL) {
+        return NULL;
     }
     assert(op->ob_item == NULL);
     op->ob_item = PyMem_New(PyObject *, size);
@@ -255,12 +271,8 @@
         PyErr_BadInternalCall();
         return -1;
     }
-    if (n == PY_SSIZE_T_MAX) {
-        PyErr_SetString(PyExc_OverflowError,
-            "cannot add more objects to list");
-        return -1;
-    }
 
+    assert((size_t)n + 1 < PY_SSIZE_T_MAX);
     if (list_resize(self, n+1) < 0)
         return -1;
 
@@ -295,12 +307,7 @@
     Py_ssize_t n = PyList_GET_SIZE(self);
 
     assert (v != NULL);
-    if (n == PY_SSIZE_T_MAX) {
-        PyErr_SetString(PyExc_OverflowError,
-            "cannot add more objects to list");
-        return -1;
-    }
-
+    assert((size_t)n + 1 < PY_SSIZE_T_MAX);
     if (list_resize(self, n+1) < 0)
         return -1;
 
@@ -335,12 +342,19 @@
         while (--i >= 0) {
             Py_XDECREF(op->ob_item[i]);
         }
-        PyMem_FREE(op->ob_item);
+        PyMem_Free(op->ob_item);
     }
-    if (numfree < PyList_MAXFREELIST && PyList_CheckExact(op))
-        free_list[numfree++] = op;
-    else
+    struct _Py_list_state *state = get_list_state();
+#ifdef Py_DEBUG
+    // list_dealloc() must not be called after _PyList_Fini()
+    assert(state->numfree != -1);
+#endif
+    if (state->numfree < PyList_MAXFREELIST && PyList_CheckExact(op)) {
+        state->free_list[state->numfree++] = op;
+    }
+    else {
         Py_TYPE(op)->tp_free((PyObject *)op);
+    }
     Py_TRASHCAN_END
 }
 
@@ -446,6 +460,9 @@
     PyObject **src, **dest;
     Py_ssize_t i, len;
     len = ihigh - ilow;
+    if (len <= 0) {
+        return PyList_New(0);
+    }
     np = (PyListObject *) list_new_prealloc(len);
     if (np == NULL)
         return NULL;
@@ -497,9 +514,11 @@
         return NULL;
     }
 #define b ((PyListObject *)bb)
-    if (Py_SIZE(a) > PY_SSIZE_T_MAX - Py_SIZE(b))
-        return PyErr_NoMemory();
+    assert((size_t)Py_SIZE(a) + (size_t)Py_SIZE(b) < PY_SSIZE_T_MAX);
     size = Py_SIZE(a) + Py_SIZE(b);
+    if (size == 0) {
+        return PyList_New(0);
+    }
     np = (PyListObject *) list_new_prealloc(size);
     if (np == NULL) {
         return NULL;
@@ -580,7 +599,7 @@
         while (--i >= 0) {
             Py_XDECREF(item[i]);
         }
-        PyMem_FREE(item);
+        PyMem_Free(item);
     }
     /* Never fails; the return value can be ignored.
        Note that there is no guarantee that the list is actually empty
@@ -656,7 +675,7 @@
     /* If norig == 0, item might be NULL, in which case we may not memcpy from it. */
     if (s) {
         if (s > sizeof(recycle_on_stack)) {
-            recycle = (PyObject **)PyMem_MALLOC(s);
+            recycle = (PyObject **)PyMem_Malloc(s);
             if (recycle == NULL) {
                 PyErr_NoMemory();
                 goto Error;
@@ -694,7 +713,7 @@
     result = 0;
  Error:
     if (recycle != recycle_on_stack)
-        PyMem_FREE(recycle);
+        PyMem_Free(recycle);
     Py_XDECREF(v_as_SF);
     return result;
 #undef b
@@ -2005,7 +2024,7 @@
     return PyObject_RichCompareBool(v, w, Py_LT);
 }
 
-/* Homogeneous compare: safe for any two compareable objects of the same type.
+/* Homogeneous compare: safe for any two comparable objects of the same type.
  * (ms->key_richcompare is set to ob_type->tp_richcompare in the
  *  pre-sort check.)
  */
@@ -2218,7 +2237,7 @@
             /* Leverage stack space we allocated but won't otherwise use */
             keys = &ms.temparray[saved_ob_size+1];
         else {
-            keys = PyMem_MALLOC(sizeof(PyObject *) * saved_ob_size);
+            keys = PyMem_Malloc(sizeof(PyObject *) * saved_ob_size);
             if (keys == NULL) {
                 PyErr_NoMemory();
                 goto keyfunc_fail;
@@ -2231,7 +2250,7 @@
                 for (i=i-1 ; i>=0 ; i--)
                     Py_DECREF(keys[i]);
                 if (saved_ob_size >= MERGESTATE_TEMP_SIZE/2)
-                    PyMem_FREE(keys);
+                    PyMem_Free(keys);
                 goto keyfunc_fail;
             }
         }
@@ -2402,7 +2421,7 @@
         for (i = 0; i < saved_ob_size; i++)
             Py_DECREF(keys[i]);
         if (saved_ob_size >= MERGESTATE_TEMP_SIZE/2)
-            PyMem_FREE(keys);
+            PyMem_Free(keys);
     }
 
     if (self->allocated != -1 && result != NULL) {
@@ -2430,7 +2449,7 @@
         while (--i >= 0) {
             Py_XDECREF(final_ob_item[i]);
         }
-        PyMem_FREE(final_ob_item);
+        PyMem_Free(final_ob_item);
     }
     Py_XINCREF(result);
     return result;
@@ -2896,7 +2915,7 @@
             }
 
             garbage = (PyObject**)
-                PyMem_MALLOC(slicelength*sizeof(PyObject*));
+                PyMem_Malloc(slicelength*sizeof(PyObject*));
             if (!garbage) {
                 PyErr_NoMemory();
                 return -1;
@@ -2937,7 +2956,7 @@
             for (i = 0; i < slicelength; i++) {
                 Py_DECREF(garbage[i]);
             }
-            PyMem_FREE(garbage);
+            PyMem_Free(garbage);
 
             return res;
         }
@@ -2978,7 +2997,7 @@
             }
 
             garbage = (PyObject**)
-                PyMem_MALLOC(slicelength*sizeof(PyObject*));
+                PyMem_Malloc(slicelength*sizeof(PyObject*));
             if (!garbage) {
                 Py_DECREF(seq);
                 PyErr_NoMemory();
@@ -2999,7 +3018,7 @@
                 Py_DECREF(garbage[i]);
             }
 
-            PyMem_FREE(garbage);
+            PyMem_Free(garbage);
             Py_DECREF(seq);
 
             return 0;
@@ -3040,7 +3059,8 @@
     0,                                          /* tp_setattro */
     0,                                          /* tp_as_buffer */
     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
-        Py_TPFLAGS_BASETYPE | Py_TPFLAGS_LIST_SUBCLASS, /* tp_flags */
+        Py_TPFLAGS_BASETYPE | Py_TPFLAGS_LIST_SUBCLASS |
+        _Py_TPFLAGS_MATCH_SELF | Py_TPFLAGS_SEQUENCE,  /* tp_flags */
     list___init____doc__,                       /* tp_doc */
     (traverseproc)list_traverse,                /* tp_traverse */
     (inquiry)_list_clear,                       /* tp_clear */
diff --git a/Objects/listsort.txt b/Objects/listsort.txt
index 174777a..42809d7 100644
--- a/Objects/listsort.txt
+++ b/Objects/listsort.txt
@@ -758,6 +758,6 @@
 As noted above, even the simplest Python comparison triggers a large pile of
 C-level pointer dereferences, conditionals, and function calls.  This can be
 partially mitigated by pre-scanning the data to determine whether the data is
-homogenous with respect to type.  If so, it is sometimes possible to
+homogeneous with respect to type.  If so, it is sometimes possible to
 substitute faster type-specific comparisons for the slower, generic
 PyObject_RichCompareBool.
diff --git a/Objects/lnotab_notes.txt b/Objects/lnotab_notes.txt
index 71a2979..f482310 100644
--- a/Objects/lnotab_notes.txt
+++ b/Objects/lnotab_notes.txt
@@ -1,11 +1,99 @@
-All about co_lnotab, the line number table.
+Description of the internal format of the line number table
 
-Code objects store a field named co_lnotab.  This is an array of unsigned bytes
-disguised as a Python bytes object.  It is used to map bytecode offsets to
-source code line #s for tracebacks and to identify line number boundaries for
-line tracing. Because of internals of the peephole optimizer, it's possible
-for lnotab to contain bytecode offsets that are no longer valid (for example
-if the optimizer removed the last line in a function).
+Conceptually, the line number table consists of a sequence of triples:
+    start-offset (inclusive), end-offset (exclusive), line-number.
+
+Note that not all byte codes have a line number so we need handle `None` for the line-number.
+
+However, storing the above sequence directly would be very inefficient as we would need 12 bytes per entry.
+
+First, note that the end of one entry is the same as the start of the next, so we can overlap entries.
+Second, we don't really need arbitrary access to the sequence, so we can store deltas.
+
+We just need to store (end - start, line delta) pairs. The start offset of the first entry is always zero.
+
+Third, most deltas are small, so we can use a single byte for each value, as long we allow several entries for the same line.
+
+Consider the following table
+     Start    End     Line
+      0       6       1
+      6       50      2
+      50      350     7
+      350     360     No line number
+      360     376     8
+      376     380     208
+
+Stripping the redundant ends gives:
+
+   End-Start  Line-delta
+      6         +1
+      44        +1
+      300       +5
+      10        No line number
+      16        +1
+      4         +200
+
+
+Note that the end - start value is always positive.
+
+Finally, in order to fit into a single byte we need to convert start deltas to the range 0 <= delta <= 254,
+and line deltas to the range -127  <= delta <= 127.
+A line delta of -128 is used to indicate no line number.
+Also note that a delta of zero indicates that there are no bytecodes in the given range,
+which means we can use an invalid line number for that range.
+
+Final form:
+
+   Start delta   Line delta
+    6               +1
+    44              +1
+    254             +5
+    46              0
+    10              -128 (No line number, treated as a delta of zero)
+    16              +1
+    0               +127 (line 135, but the range is empty as no bytecodes are at line 135)
+    4               +73
+
+Iterating over the table.
+-------------------------
+
+For the `co_lines` attribute we want to emit the full form, omitting the (350, 360, No line number) and empty entries.
+
+The code is as follows:
+
+def co_lines(code):
+    line = code.co_firstlineno
+    end = 0
+    table_iter = iter(code.internal_line_table):
+    for sdelta, ldelta in table_iter:
+        if ldelta == 0: # No change to line number, just accumulate changes to end
+            end += odelta
+            continue
+        start = end
+        end = start + sdelta
+        if ldelta == -128: # No valid line number -- skip entry
+            continue
+        line += ldelta
+        if end == start: # Empty range, omit.
+            continue
+        yield start, end, line
+
+
+
+
+The historical co_lnotab format
+-------------------------------
+
+prior to 3.10 code objects stored a field named co_lnotab.
+This was an array of unsigned bytes disguised as a Python bytes object.
+
+The old co_lnotab did not account for the presence of bytecodes without a line number,
+nor was it well suited to tracing as a number of workarounds were required.
+
+The old format can still be accessed via `code.co_lnotab`, which is lazily computed from the new format.
+
+Below is the description of the old co_lnotab format:
+
 
 The array is conceptually a compressed list of
     (bytecode offset increment, line number increment)
diff --git a/Objects/longobject.c b/Objects/longobject.c
index 0ff0e80..685bd56 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -3,8 +3,11 @@
 /* XXX The functional organization of this file is terrible */
 
 #include "Python.h"
-#include "pycore_interp.h"    // _PY_NSMALLPOSINTS
-#include "pycore_pystate.h"   // _Py_IsMainInterpreter()
+#include "pycore_bitutils.h"      // _Py_popcount32()
+#include "pycore_interp.h"        // _PY_NSMALLPOSINTS
+#include "pycore_long.h"          // __PyLong_GetSmallInt_internal()
+#include "pycore_object.h"        // _PyObject_InitVar()
+#include "pycore_pystate.h"       // _Py_IsMainInterpreter()
 #include "longintrepr.h"
 
 #include <float.h>
@@ -17,8 +20,8 @@
 [clinic start generated code]*/
 /*[clinic end generated code: output=da39a3ee5e6b4b0d input=ec0275e3422a36e3]*/
 
-#define NSMALLPOSINTS           _PY_NSMALLPOSINTS
 #define NSMALLNEGINTS           _PY_NSMALLNEGINTS
+#define NSMALLPOSINTS           _PY_NSMALLPOSINTS
 
 _Py_IDENTIFIER(little);
 _Py_IDENTIFIER(big);
@@ -29,10 +32,6 @@
              (Py_SIZE(x) == 0 ? (sdigit)0 :                             \
               (sdigit)(x)->ob_digit[0]))
 
-PyObject *_PyLong_Zero = NULL;
-PyObject *_PyLong_One = NULL;
-
-#if NSMALLNEGINTS + NSMALLPOSINTS > 0
 #define IS_SMALL_INT(ival) (-NSMALLNEGINTS <= (ival) && (ival) < NSMALLPOSINTS)
 #define IS_SMALL_UINT(ival) ((ival) < NSMALLPOSINTS)
 
@@ -40,8 +39,7 @@
 get_small_int(sdigit ival)
 {
     assert(IS_SMALL_INT(ival));
-    PyThreadState *tstate = _PyThreadState_GET();
-    PyObject *v = (PyObject*)tstate->interp->small_ints[ival + NSMALLNEGINTS];
+    PyObject *v = __PyLong_GetSmallInt_internal(ival);
     Py_INCREF(v);
     return v;
 }
@@ -58,12 +56,6 @@
     }
     return v;
 }
-#else
-#define IS_SMALL_INT(ival) 0
-#define IS_SMALL_UINT(ival) 0
-#define get_small_int(ival) (Py_UNREACHABLE(), NULL)
-#define maybe_small_long(val) (val)
-#endif
 
 /* If a freshly-allocated int is already shared, it must
    be a small integer, so negating it must go to PyLong_FromLong */
@@ -119,123 +111,6 @@
     return v;
 }
 
-/* _PyLong_FromNbInt: Convert the given object to a PyLongObject
-   using the nb_int slot, if available.  Raise TypeError if either the
-   nb_int slot is not available or the result of the call to nb_int
-   returns something not of type int.
-*/
-PyObject *
-_PyLong_FromNbInt(PyObject *integral)
-{
-    PyNumberMethods *nb;
-    PyObject *result;
-
-    /* Fast path for the case that we already have an int. */
-    if (PyLong_CheckExact(integral)) {
-        Py_INCREF(integral);
-        return integral;
-    }
-
-    nb = Py_TYPE(integral)->tp_as_number;
-    if (nb == NULL || nb->nb_int == NULL) {
-        PyErr_Format(PyExc_TypeError,
-                     "an integer is required (got type %.200s)",
-                     Py_TYPE(integral)->tp_name);
-        return NULL;
-    }
-
-    /* Convert using the nb_int slot, which should return something
-       of exact type int. */
-    result = nb->nb_int(integral);
-    if (!result || PyLong_CheckExact(result))
-        return result;
-    if (!PyLong_Check(result)) {
-        PyErr_Format(PyExc_TypeError,
-                     "__int__ returned non-int (type %.200s)",
-                     Py_TYPE(result)->tp_name);
-        Py_DECREF(result);
-        return NULL;
-    }
-    /* Issue #17576: warn if 'result' not of exact type int. */
-    if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
-            "__int__ returned non-int (type %.200s).  "
-            "The ability to return an instance of a strict subclass of int "
-            "is deprecated, and may be removed in a future version of Python.",
-            Py_TYPE(result)->tp_name)) {
-        Py_DECREF(result);
-        return NULL;
-    }
-    return result;
-}
-
-/* Convert the given object to a PyLongObject using the nb_index or
-   nb_int slots, if available (the latter is deprecated).
-   Raise TypeError if either nb_index and nb_int slots are not
-   available or the result of the call to nb_index or nb_int
-   returns something not of type int.
-   Should be replaced with PyNumber_Index after the end of the
-   deprecation period.
-*/
-PyObject *
-_PyLong_FromNbIndexOrNbInt(PyObject *integral)
-{
-    PyNumberMethods *nb;
-    PyObject *result;
-
-    /* Fast path for the case that we already have an int. */
-    if (PyLong_CheckExact(integral)) {
-        Py_INCREF(integral);
-        return integral;
-    }
-
-    nb = Py_TYPE(integral)->tp_as_number;
-    if (nb == NULL || (nb->nb_index == NULL && nb->nb_int == NULL)) {
-        PyErr_Format(PyExc_TypeError,
-                     "an integer is required (got type %.200s)",
-                     Py_TYPE(integral)->tp_name);
-        return NULL;
-    }
-
-    if (nb->nb_index) {
-    /* Convert using the nb_index slot, which should return something
-       of exact type int. */
-        result = nb->nb_index(integral);
-        if (!result || PyLong_CheckExact(result))
-            return result;
-        if (!PyLong_Check(result)) {
-            PyErr_Format(PyExc_TypeError,
-                         "__index__ returned non-int (type %.200s)",
-                         Py_TYPE(result)->tp_name);
-            Py_DECREF(result);
-            return NULL;
-        }
-        /* Issue #17576: warn if 'result' not of exact type int. */
-        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
-                "__index__ returned non-int (type %.200s).  "
-                "The ability to return an instance of a strict subclass of int "
-                "is deprecated, and may be removed in a future version of Python.",
-                Py_TYPE(result)->tp_name))
-        {
-            Py_DECREF(result);
-            return NULL;
-        }
-        return result;
-    }
-
-    result = _PyLong_FromNbInt(integral);
-    if (result && PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
-            "an integer is required (got type %.200s).  "
-            "Implicit conversion to integers using __int__ is deprecated, "
-            "and may be removed in a future version of Python.",
-            Py_TYPE(integral)->tp_name))
-    {
-        Py_DECREF(result);
-        return NULL;
-    }
-    return result;
-}
-
-
 /* Allocate a new int object with size digits.
    Return NULL and set exception if we run out of memory. */
 
@@ -256,13 +131,14 @@
                         "too many digits in integer");
         return NULL;
     }
-    result = PyObject_MALLOC(offsetof(PyLongObject, ob_digit) +
+    result = PyObject_Malloc(offsetof(PyLongObject, ob_digit) +
                              size*sizeof(digit));
     if (!result) {
         PyErr_NoMemory();
         return NULL;
     }
-    return (PyLongObject*)PyObject_INIT_VAR(result, &PyLong_Type, size);
+    _PyObject_InitVar((PyVarObject*)result, &PyLong_Type, size);
+    return result;
 }
 
 PyObject *
@@ -480,7 +356,7 @@
 #define PY_ABS_LONG_MIN         (0-(unsigned long)LONG_MIN)
 #define PY_ABS_SSIZE_T_MIN      (0-(size_t)PY_SSIZE_T_MIN)
 
-/* Get a C long int from an int object or any object that has an __int__
+/* Get a C long int from an int object or any object that has an __index__
    method.
 
    On overflow, return -1 and set *overflow to 1 or -1 depending on the sign of
@@ -499,7 +375,7 @@
     long res;
     Py_ssize_t i;
     int sign;
-    int do_decref = 0; /* if nb_int was called */
+    int do_decref = 0; /* if PyNumber_Index was called */
 
     *overflow = 0;
     if (vv == NULL) {
@@ -511,7 +387,7 @@
         v = (PyLongObject *)vv;
     }
     else {
-        v = (PyLongObject *)_PyLong_FromNbIndexOrNbInt(vv);
+        v = (PyLongObject *)_PyNumber_Index(vv);
         if (v == NULL)
             return -1;
         do_decref = 1;
@@ -566,7 +442,7 @@
     return res;
 }
 
-/* Get a C long int from an int object or any object that has an __int__
+/* Get a C long int from an int object or any object that has an __index__
    method.  Return -1 and set an error if overflow occurs. */
 
 long
@@ -583,7 +459,7 @@
     return result;
 }
 
-/* Get a C int from an int object or any object that has an __int__
+/* Get a C int from an int object or any object that has an __index__
    method.  Return -1 and set an error if overflow occurs. */
 
 int
@@ -791,7 +667,7 @@
         return _PyLong_AsUnsignedLongMask(op);
     }
 
-    lo = (PyLongObject *)_PyLong_FromNbIndexOrNbInt(op);
+    lo = (PyLongObject *)_PyNumber_Index(op);
     if (lo == NULL)
         return (unsigned long)-1;
 
@@ -811,6 +687,13 @@
     return Py_SIZE(v) == 0 ? 0 : (Py_SIZE(v) < 0 ? -1 : 1);
 }
 
+static int
+bit_length_digit(digit x)
+{
+    Py_BUILD_ASSERT(PyLong_SHIFT <= sizeof(unsigned long) * 8);
+    return _Py_bit_length((unsigned long)x);
+}
+
 size_t
 _PyLong_NumBits(PyObject *vv)
 {
@@ -828,7 +711,7 @@
         if ((size_t)(ndigits - 1) > SIZE_MAX / (size_t)PyLong_SHIFT)
             goto Overflow;
         result = (size_t)(ndigits - 1) * (size_t)PyLong_SHIFT;
-        msd_bits = _Py_bit_length(msd);
+        msd_bits = bit_length_digit(msd);
         if (SIZE_MAX - msd_bits < result)
             goto Overflow;
         result += msd_bits;
@@ -1230,7 +1113,7 @@
 }
 
 /* Get a C long long int from an int object or any object that has an
-   __int__ method.  Return -1 and set an error if overflow occurs. */
+   __index__ method.  Return -1 and set an error if overflow occurs. */
 
 long long
 PyLong_AsLongLong(PyObject *vv)
@@ -1238,7 +1121,7 @@
     PyLongObject *v;
     long long bytes;
     int res;
-    int do_decref = 0; /* if nb_int was called */
+    int do_decref = 0; /* if PyNumber_Index was called */
 
     if (vv == NULL) {
         PyErr_BadInternalCall();
@@ -1249,7 +1132,7 @@
         v = (PyLongObject *)vv;
     }
     else {
-        v = (PyLongObject *)_PyLong_FromNbIndexOrNbInt(vv);
+        v = (PyLongObject *)_PyNumber_Index(vv);
         if (v == NULL)
             return -1;
         do_decref = 1;
@@ -1364,7 +1247,7 @@
         return _PyLong_AsUnsignedLongLongMask(op);
     }
 
-    lo = (PyLongObject *)_PyLong_FromNbIndexOrNbInt(op);
+    lo = (PyLongObject *)_PyNumber_Index(op);
     if (lo == NULL)
         return (unsigned long long)-1;
 
@@ -1374,7 +1257,7 @@
 }
 
 /* Get a C long long int from an int object or any object that has an
-   __int__ method.
+   __index__ method.
 
    On overflow, return -1 and set *overflow to 1 or -1 depending on the sign of
    the result.  Otherwise *overflow is 0.
@@ -1392,7 +1275,7 @@
     long long res;
     Py_ssize_t i;
     int sign;
-    int do_decref = 0; /* if nb_int was called */
+    int do_decref = 0; /* if PyNumber_Index was called */
 
     *overflow = 0;
     if (vv == NULL) {
@@ -1404,7 +1287,7 @@
         v = (PyLongObject *)vv;
     }
     else {
-        v = (PyLongObject *)_PyLong_FromNbIndexOrNbInt(vv);
+        v = (PyLongObject *)_PyNumber_Index(vv);
         if (v == NULL)
             return -1;
         do_decref = 1;
@@ -1938,7 +1821,7 @@
             return -1;
         }
         size_a_in_bits = (size_a - 1) * PyLong_SHIFT +
-                         _Py_bit_length(a->ob_digit[size_a - 1]);
+                         bit_length_digit(a->ob_digit[size_a - 1]);
         /* Allow 1 character for a '-' sign. */
         sz = negative + (size_a_in_bits + (bits - 1)) / bits;
     }
@@ -2611,17 +2494,6 @@
 }
 
 PyObject *
-PyLong_FromUnicode(Py_UNICODE *u, Py_ssize_t length, int base)
-{
-    PyObject *v, *unicode = PyUnicode_FromWideChar(u, length);
-    if (unicode == NULL)
-        return NULL;
-    v = PyLong_FromUnicodeObject(unicode, base);
-    Py_DECREF(unicode);
-    return v;
-}
-
-PyObject *
 PyLong_FromUnicodeObject(PyObject *u, int base)
 {
     PyObject *result, *asciidig;
@@ -2677,8 +2549,9 @@
         if (*prem == NULL) {
             return -1;
         }
-        Py_INCREF(_PyLong_Zero);
-        *pdiv = (PyLongObject*)_PyLong_Zero;
+        PyObject *zero = _PyLong_GetZero();
+        Py_INCREF(zero);
+        *pdiv = (PyLongObject*)zero;
         return 0;
     }
     if (size_b == 1) {
@@ -2758,7 +2631,7 @@
 
     /* normalize: shift w1 left so that its top digit is >= PyLong_BASE/2.
        shift v1 left by the same amount.  Results go into w and v. */
-    d = PyLong_SHIFT - _Py_bit_length(w1->ob_digit[size_w-1]);
+    d = PyLong_SHIFT - bit_length_digit(w1->ob_digit[size_w-1]);
     carry = v_lshift(w->ob_digit, w1->ob_digit, size_w, d);
     assert(carry == 0);
     carry = v_lshift(v->ob_digit, v1->ob_digit, size_v, d);
@@ -2880,7 +2753,7 @@
         *e = 0;
         return 0.0;
     }
-    a_bits = _Py_bit_length(a->ob_digit[a_size-1]);
+    a_bits = bit_length_digit(a->ob_digit[a_size-1]);
     /* The following is an overflow-free version of the check
        "if ((a_size - 1) * PyLong_SHIFT + a_bits > PY_SSIZE_T_MAX) ..." */
     if (a_size >= (PY_SSIZE_T_MAX - 1) / PyLong_SHIFT + 1 &&
@@ -3787,7 +3660,7 @@
             Py_DECREF(div);
             return -1;
         }
-        temp = (PyLongObject *) long_sub(div, (PyLongObject *)_PyLong_One);
+        temp = (PyLongObject *) long_sub(div, (PyLongObject *)_PyLong_GetOne());
         if (temp == NULL) {
             Py_DECREF(mod);
             Py_DECREF(div);
@@ -3973,8 +3846,8 @@
         /* Extreme underflow */
         goto underflow_or_zero;
     /* Next line is now safe from overflowing a Py_ssize_t */
-    diff = diff * PyLong_SHIFT + _Py_bit_length(a->ob_digit[a_size - 1]) -
-        _Py_bit_length(b->ob_digit[b_size - 1]);
+    diff = diff * PyLong_SHIFT + bit_length_digit(a->ob_digit[a_size - 1]) -
+        bit_length_digit(b->ob_digit[b_size - 1]);
     /* Now diff = a_bits - b_bits. */
     if (diff > DBL_MAX_EXP)
         goto overflow;
@@ -4050,7 +3923,7 @@
     }
     x_size = Py_ABS(Py_SIZE(x));
     assert(x_size > 0); /* result of division is never zero */
-    x_bits = (x_size-1)*PyLong_SHIFT+_Py_bit_length(x->ob_digit[x_size-1]);
+    x_bits = (x_size-1)*PyLong_SHIFT+bit_length_digit(x->ob_digit[x_size-1]);
 
     /* The number of extra bits that have to be rounded away. */
     extra_bits = Py_MAX(x_bits, DBL_MIN_EXP - shift) - DBL_MANT_DIG;
@@ -4196,7 +4069,7 @@
 
     Py_DECREF(c);
     Py_DECREF(n);
-    if (long_compare(a, (PyLongObject *)_PyLong_One)) {
+    if (long_compare(a, (PyLongObject *)_PyLong_GetOne())) {
         /* a != 1; we don't have an inverse. */
         Py_DECREF(a);
         Py_DECREF(b);
@@ -4312,6 +4185,7 @@
                 goto Error;
             Py_DECREF(a);
             a = temp;
+            temp = NULL;
         }
 
         /* Reduce base by modulus in some cases:
@@ -4431,7 +4305,7 @@
     PyLongObject *x;
     if (Py_ABS(Py_SIZE(v)) <=1)
         return PyLong_FromLong(-(MEDIUM_VALUE(v)+1));
-    x = (PyLongObject *) long_add(v, (PyLongObject *)_PyLong_One);
+    x = (PyLongObject *) long_add(v, (PyLongObject *)_PyLong_GetOne());
     if (x == NULL)
         return NULL;
     _PyLong_Negate(&x);
@@ -4864,7 +4738,7 @@
     alloc_b = Py_SIZE(b);
     /* reduce until a fits into 2 digits */
     while ((size_a = Py_SIZE(a)) > 2) {
-        nbits = _Py_bit_length(a->ob_digit[size_a-1]);
+        nbits = bit_length_digit(a->ob_digit[size_a-1]);
         /* extract top 2*PyLong_SHIFT bits of a into x, along with
            corresponding bits of b into y */
         size_b = Py_SIZE(b);
@@ -5223,7 +5097,8 @@
 
     /* compare twice the remainder with the divisor, to see
        if we need to adjust the quotient and remainder */
-    twice_rem = long_lshift((PyObject *)rem, _PyLong_One);
+    PyObject *one = _PyLong_GetOne();  // borrowed reference
+    twice_rem = long_lshift((PyObject *)rem, one);
     if (twice_rem == NULL)
         goto error;
     if (quo_is_neg) {
@@ -5240,9 +5115,9 @@
     if ((Py_SIZE(b) < 0 ? cmp < 0 : cmp > 0) || (cmp == 0 && quo_is_odd)) {
         /* fix up quotient */
         if (quo_is_neg)
-            temp = long_sub(quo, (PyLongObject *)_PyLong_One);
+            temp = long_sub(quo, (PyLongObject *)one);
         else
-            temp = long_add(quo, (PyLongObject *)_PyLong_One);
+            temp = long_add(quo, (PyLongObject *)one);
         Py_DECREF(quo);
         quo = (PyLongObject *)temp;
         if (quo == NULL)
@@ -5273,10 +5148,22 @@
     return NULL;
 }
 
+/*[clinic input]
+int.__round__
+
+    ndigits as o_ndigits: object = NULL
+    /
+
+Rounding an Integral returns itself.
+
+Rounding with an ndigits argument also returns an integer.
+[clinic start generated code]*/
+
 static PyObject *
-long_round(PyObject *self, PyObject *args)
+int___round___impl(PyObject *self, PyObject *o_ndigits)
+/*[clinic end generated code: output=954fda6b18875998 input=1614cf23ec9e18c3]*/
 {
-    PyObject *o_ndigits=NULL, *temp, *result, *ndigits;
+    PyObject *temp, *result, *ndigits;
 
     /* To round an integer m to the nearest 10**n (n positive), we make use of
      * the divmod_near operation, defined by:
@@ -5292,12 +5179,10 @@
      *
      *   m - divmod_near(m, 10**n)[1].
      */
-    if (!PyArg_ParseTuple(args, "|O", &o_ndigits))
-        return NULL;
     if (o_ndigits == NULL)
         return long_long(self);
 
-    ndigits = PyNumber_Index(o_ndigits);
+    ndigits = _PyNumber_Index(o_ndigits);
     if (ndigits == NULL)
         return NULL;
 
@@ -5385,7 +5270,7 @@
         return PyLong_FromLong(0);
 
     msd = ((PyLongObject *)self)->ob_digit[ndigits-1];
-    msd_bits = _Py_bit_length(msd);
+    msd_bits = bit_length_digit(msd);
 
     if (ndigits <= PY_SSIZE_T_MAX/PyLong_SHIFT)
         return PyLong_FromSsize_t((ndigits-1)*PyLong_SHIFT + msd_bits);
@@ -5421,6 +5306,73 @@
     return NULL;
 }
 
+static int
+popcount_digit(digit d)
+{
+    // digit can be larger than uint32_t, but only PyLong_SHIFT bits
+    // of it will be ever used.
+    Py_BUILD_ASSERT(PyLong_SHIFT <= 32);
+    return _Py_popcount32((uint32_t)d);
+}
+
+/*[clinic input]
+int.bit_count
+
+Number of ones in the binary representation of the absolute value of self.
+
+Also known as the population count.
+
+>>> bin(13)
+'0b1101'
+>>> (13).bit_count()
+3
+[clinic start generated code]*/
+
+static PyObject *
+int_bit_count_impl(PyObject *self)
+/*[clinic end generated code: output=2e571970daf1e5c3 input=7e0adef8e8ccdf2e]*/
+{
+    assert(self != NULL);
+    assert(PyLong_Check(self));
+
+    PyLongObject *z = (PyLongObject *)self;
+    Py_ssize_t ndigits = Py_ABS(Py_SIZE(z));
+    Py_ssize_t bit_count = 0;
+
+    /* Each digit has up to PyLong_SHIFT ones, so the accumulated bit count
+       from the first PY_SSIZE_T_MAX/PyLong_SHIFT digits can't overflow a
+       Py_ssize_t. */
+    Py_ssize_t ndigits_fast = Py_MIN(ndigits, PY_SSIZE_T_MAX/PyLong_SHIFT);
+    for (Py_ssize_t i = 0; i < ndigits_fast; i++) {
+        bit_count += popcount_digit(z->ob_digit[i]);
+    }
+
+    PyObject *result = PyLong_FromSsize_t(bit_count);
+    if (result == NULL) {
+        return NULL;
+    }
+
+    /* Use Python integers if bit_count would overflow. */
+    for (Py_ssize_t i = ndigits_fast; i < ndigits; i++) {
+        PyObject *x = PyLong_FromLong(popcount_digit(z->ob_digit[i]));
+        if (x == NULL) {
+            goto error;
+        }
+        PyObject *y = long_add((PyLongObject *)result, (PyLongObject *)x);
+        Py_DECREF(x);
+        if (y == NULL) {
+            goto error;
+        }
+        Py_DECREF(result);
+        result = y;
+    }
+
+    return result;
+
+  error:
+    Py_DECREF(result);
+    return NULL;
+}
 
 /*[clinic input]
 int.as_integer_ratio
@@ -5447,7 +5399,7 @@
     if (numerator == NULL) {
         return NULL;
     }
-    ratio_tuple = PyTuple_Pack(2, numerator, _PyLong_One);
+    ratio_tuple = PyTuple_Pack(2, numerator, _PyLong_GetOne());
     Py_DECREF(numerator);
     return ratio_tuple;
 }
@@ -5577,6 +5529,7 @@
     {"conjugate",       long_long_meth, METH_NOARGS,
      "Returns self, the complex conjugate of any int."},
     INT_BIT_LENGTH_METHODDEF
+    INT_BIT_COUNT_METHODDEF
     INT_TO_BYTES_METHODDEF
     INT_FROM_BYTES_METHODDEF
     INT_AS_INTEGER_RATIO_METHODDEF
@@ -5586,9 +5539,7 @@
      "Flooring an Integral returns itself."},
     {"__ceil__",        long_long_meth, METH_NOARGS,
      "Ceiling of an Integral returns itself."},
-    {"__round__",       (PyCFunction)long_round, METH_VARARGS,
-     "Rounding an Integral returns itself.\n"
-     "Rounding with an ndigits argument also returns an integer."},
+    INT___ROUND___METHODDEF
     INT___GETNEWARGS___METHODDEF
     INT___FORMAT___METHODDEF
     INT___SIZEOF___METHODDEF
@@ -5689,7 +5640,8 @@
     0,                                          /* tp_setattro */
     0,                                          /* tp_as_buffer */
     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
-        Py_TPFLAGS_LONG_SUBCLASS,               /* tp_flags */
+        Py_TPFLAGS_LONG_SUBCLASS |
+        _Py_TPFLAGS_MATCH_SELF,               /* tp_flags */
     long_doc,                                   /* tp_doc */
     0,                                          /* tp_traverse */
     0,                                          /* tp_clear */
@@ -5752,9 +5704,8 @@
 }
 
 int
-_PyLong_Init(PyThreadState *tstate)
+_PyLong_Init(PyInterpreterState *interp)
 {
-#if NSMALLNEGINTS + NSMALLPOSINTS > 0
     for (Py_ssize_t i=0; i < NSMALLNEGINTS + NSMALLPOSINTS; i++) {
         sdigit ival = (sdigit)i - NSMALLNEGINTS;
         int size = (ival < 0) ? -1 : ((ival == 0) ? 0 : 1);
@@ -5767,43 +5718,28 @@
         Py_SET_SIZE(v, size);
         v->ob_digit[0] = (digit)abs(ival);
 
-        tstate->interp->small_ints[i] = v;
+        interp->small_ints[i] = v;
     }
-#endif
+    return 0;
+}
 
-    if (_Py_IsMainInterpreter(tstate)) {
-        _PyLong_Zero = PyLong_FromLong(0);
-        if (_PyLong_Zero == NULL) {
-            return 0;
-        }
 
-        _PyLong_One = PyLong_FromLong(1);
-        if (_PyLong_One == NULL) {
-            return 0;
-        }
-
-        /* initialize int_info */
-        if (Int_InfoType.tp_name == NULL) {
-            if (PyStructSequence_InitType2(&Int_InfoType, &int_info_desc) < 0) {
-                return 0;
-            }
+int
+_PyLong_InitTypes(void)
+{
+    /* initialize int_info */
+    if (Int_InfoType.tp_name == NULL) {
+        if (PyStructSequence_InitType2(&Int_InfoType, &int_info_desc) < 0) {
+            return -1;
         }
     }
-
-    return 1;
+    return 0;
 }
 
 void
-_PyLong_Fini(PyThreadState *tstate)
+_PyLong_Fini(PyInterpreterState *interp)
 {
-    if (_Py_IsMainInterpreter(tstate)) {
-        Py_CLEAR(_PyLong_One);
-        Py_CLEAR(_PyLong_Zero);
-    }
-
-#if NSMALLNEGINTS + NSMALLPOSINTS > 0
     for (Py_ssize_t i = 0; i < NSMALLNEGINTS + NSMALLPOSINTS; i++) {
-        Py_CLEAR(tstate->interp->small_ints[i]);
+        Py_CLEAR(interp->small_ints[i]);
     }
-#endif
 }
diff --git a/Objects/memoryobject.c b/Objects/memoryobject.c
index 682bbe8..913d358 100644
--- a/Objects/memoryobject.c
+++ b/Objects/memoryobject.c
@@ -238,12 +238,6 @@
 #define REQ_FORMAT(flags) (flags&PyBUF_FORMAT)
 
 
-PyDoc_STRVAR(memory_doc,
-"memoryview(object)\n--\n\
-\n\
-Create a new memoryview object which references the given object.");
-
-
 /**************************************************************************/
 /*                       Copy memoryview buffers                          */
 /**************************************************************************/
@@ -961,18 +955,20 @@
 }
 
 
+/*[clinic input]
+@classmethod
+memoryview.__new__
+
+    object: object
+
+Create a new memoryview object which references the given object.
+[clinic start generated code]*/
+
 static PyObject *
-memory_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds)
+memoryview_impl(PyTypeObject *type, PyObject *object)
+/*[clinic end generated code: output=7de78e184ed66db8 input=f04429eb0bdf8c6e]*/
 {
-    PyObject *obj;
-    static char *kwlist[] = {"object", NULL};
-
-    if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:memoryview", kwlist,
-                                     &obj)) {
-        return NULL;
-    }
-
-    return PyMemoryView_FromObject(obj);
+    return PyMemoryView_FromObject(object);
 }
 
 
@@ -1062,8 +1058,15 @@
     return -1;
 }
 
+/*[clinic input]
+memoryview.release
+
+Release the underlying buffer exposed by the memoryview object.
+[clinic start generated code]*/
+
 static PyObject *
-memory_release(PyMemoryViewObject *self, PyObject *noargs)
+memoryview_release_impl(PyMemoryViewObject *self)
+/*[clinic end generated code: output=d0b7e3ba95b7fcb9 input=bc71d1d51f4a52f0]*/
 {
     if (_memory_release(self) < 0)
         return NULL;
@@ -1108,7 +1111,7 @@
 static PyObject *
 memory_exit(PyObject *self, PyObject *args)
 {
-    return memory_release((PyMemoryViewObject *)self, NULL);
+    return memoryview_release_impl((PyMemoryViewObject *)self);
 }
 
 
@@ -1352,26 +1355,25 @@
    All casts must result in views that will have the exact byte
    size of the original input. Otherwise, an error is raised.
 */
+/*[clinic input]
+memoryview.cast
+
+    format: unicode
+    shape: object = NULL
+
+Cast a memoryview to a new format or shape.
+[clinic start generated code]*/
+
 static PyObject *
-memory_cast(PyMemoryViewObject *self, PyObject *args, PyObject *kwds)
+memoryview_cast_impl(PyMemoryViewObject *self, PyObject *format,
+                     PyObject *shape)
+/*[clinic end generated code: output=bae520b3a389cbab input=138936cc9041b1a3]*/
 {
-    static char *kwlist[] = {"format", "shape", NULL};
     PyMemoryViewObject *mv = NULL;
-    PyObject *shape = NULL;
-    PyObject *format;
     Py_ssize_t ndim = 1;
 
     CHECK_RELEASED(self);
 
-    if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|O", kwlist,
-                                     &format, &shape)) {
-        return NULL;
-    }
-    if (!PyUnicode_Check(format)) {
-        PyErr_SetString(PyExc_TypeError,
-            "memoryview: format argument must be a string");
-        return NULL;
-    }
     if (!MV_C_CONTIGUOUS(self->flags)) {
         PyErr_SetString(PyExc_TypeError,
             "memoryview: casts are restricted to C-contiguous views");
@@ -1415,8 +1417,15 @@
     return NULL;
 }
 
+/*[clinic input]
+memoryview.toreadonly
+
+Return a readonly version of the memoryview.
+[clinic start generated code]*/
+
 static PyObject *
-memory_toreadonly(PyMemoryViewObject *self, PyObject *noargs)
+memoryview_toreadonly_impl(PyMemoryViewObject *self)
+/*[clinic end generated code: output=2c7e056f04c99e62 input=dc06d20f19ba236f]*/
 {
     CHECK_RELEASED(self);
     /* Even if self is already readonly, we still need to create a new
@@ -1578,7 +1587,7 @@
     PyObject *tmp;
     long ld;
 
-    tmp = PyNumber_Index(item);
+    tmp = _PyNumber_Index(item);
     if (tmp == NULL)
         return -1;
 
@@ -1593,7 +1602,7 @@
     PyObject *tmp;
     unsigned long lu;
 
-    tmp = PyNumber_Index(item);
+    tmp = _PyNumber_Index(item);
     if (tmp == NULL)
         return (unsigned long)-1;
 
@@ -1608,7 +1617,7 @@
     PyObject *tmp;
     long long lld;
 
-    tmp = PyNumber_Index(item);
+    tmp = _PyNumber_Index(item);
     if (tmp == NULL)
         return -1;
 
@@ -1623,7 +1632,7 @@
     PyObject *tmp;
     unsigned long long llu;
 
-    tmp = PyNumber_Index(item);
+    tmp = _PyNumber_Index(item);
     if (tmp == NULL)
         return (unsigned long long)-1;
 
@@ -1638,7 +1647,7 @@
     PyObject *tmp;
     Py_ssize_t zd;
 
-    tmp = PyNumber_Index(item);
+    tmp = _PyNumber_Index(item);
     if (tmp == NULL)
         return -1;
 
@@ -1653,7 +1662,7 @@
     PyObject *tmp;
     size_t zu;
 
-    tmp = PyNumber_Index(item);
+    tmp = _PyNumber_Index(item);
     if (tmp == NULL)
         return (size_t)-1;
 
@@ -2109,13 +2118,20 @@
 
 /* Return a list representation of the memoryview. Currently only buffers
    with native format strings are supported. */
+/*[clinic input]
+memoryview.tolist
+
+Return the data in the buffer as a list of elements.
+[clinic start generated code]*/
+
 static PyObject *
-memory_tolist(PyMemoryViewObject *mv, PyObject *noargs)
+memoryview_tolist_impl(PyMemoryViewObject *self)
+/*[clinic end generated code: output=a6cda89214fd5a1b input=21e7d0c1860b211a]*/
 {
-    const Py_buffer *view = &(mv->view);
+    const Py_buffer *view = &self->view;
     const char *fmt;
 
-    CHECK_RELEASED(mv);
+    CHECK_RELEASED(self);
 
     fmt = adjust_fmt(view);
     if (fmt == NULL)
@@ -2135,21 +2151,30 @@
     }
 }
 
+/*[clinic input]
+memoryview.tobytes
+
+    order: str(accept={str, NoneType}, c_default="NULL") = 'C'
+
+Return the data in the buffer as a byte string.
+
+Order can be {'C', 'F', 'A'}. When order is 'C' or 'F', the data of the
+original array is converted to C or Fortran order. For contiguous views,
+'A' returns an exact copy of the physical memory. In particular, in-memory
+Fortran order is preserved. For non-contiguous views, the data is converted
+to C first. order=None is the same as order='C'.
+[clinic start generated code]*/
+
 static PyObject *
-memory_tobytes(PyMemoryViewObject *self, PyObject *args, PyObject *kwds)
+memoryview_tobytes_impl(PyMemoryViewObject *self, const char *order)
+/*[clinic end generated code: output=1288b62560a32a23 input=0efa3ddaeda573a8]*/
 {
-    static char *kwlist[] = {"order", NULL};
     Py_buffer *src = VIEW_ADDR(self);
-    char *order = NULL;
     char ord = 'C';
     PyObject *bytes;
 
     CHECK_RELEASED(self);
 
-    if (!PyArg_ParseTupleAndKeywords(args, kwds, "|z", kwlist, &order)) {
-        return NULL;
-    }
-
     if (order) {
         if (strcmp(order, "F") == 0) {
             ord = 'F';
@@ -3122,43 +3147,125 @@
     {NULL, NULL, NULL, NULL},
 };
 
-PyDoc_STRVAR(memory_release_doc,
-"release($self, /)\n--\n\
-\n\
-Release the underlying buffer exposed by the memoryview object.");
-PyDoc_STRVAR(memory_tobytes_doc,
-"tobytes($self, /, order=None)\n--\n\
-\n\
-Return the data in the buffer as a byte string. Order can be {'C', 'F', 'A'}.\n\
-When order is 'C' or 'F', the data of the original array is converted to C or\n\
-Fortran order. For contiguous views, 'A' returns an exact copy of the physical\n\
-memory. In particular, in-memory Fortran order is preserved. For non-contiguous\n\
-views, the data is converted to C first. order=None is the same as order='C'.");
-PyDoc_STRVAR(memory_tolist_doc,
-"tolist($self, /)\n--\n\
-\n\
-Return the data in the buffer as a list of elements.");
-PyDoc_STRVAR(memory_cast_doc,
-"cast($self, /, format, *, shape)\n--\n\
-\n\
-Cast a memoryview to a new format or shape.");
-PyDoc_STRVAR(memory_toreadonly_doc,
-"toreadonly($self, /)\n--\n\
-\n\
-Return a readonly version of the memoryview.");
 
 static PyMethodDef memory_methods[] = {
-    {"release",     (PyCFunction)memory_release, METH_NOARGS, memory_release_doc},
-    {"tobytes",     (PyCFunction)(void(*)(void))memory_tobytes, METH_VARARGS|METH_KEYWORDS, memory_tobytes_doc},
+    MEMORYVIEW_RELEASE_METHODDEF
+    MEMORYVIEW_TOBYTES_METHODDEF
     MEMORYVIEW_HEX_METHODDEF
-    {"tolist",      (PyCFunction)memory_tolist, METH_NOARGS, memory_tolist_doc},
-    {"cast",        (PyCFunction)(void(*)(void))memory_cast, METH_VARARGS|METH_KEYWORDS, memory_cast_doc},
-    {"toreadonly",  (PyCFunction)memory_toreadonly, METH_NOARGS, memory_toreadonly_doc},
+    MEMORYVIEW_TOLIST_METHODDEF
+    MEMORYVIEW_CAST_METHODDEF
+    MEMORYVIEW_TOREADONLY_METHODDEF
     {"__enter__",   memory_enter, METH_NOARGS, NULL},
     {"__exit__",    memory_exit, METH_VARARGS, NULL},
     {NULL,          NULL}
 };
 
+/**************************************************************************/
+/*                          Memoryview Iterator                           */
+/**************************************************************************/
+
+static PyTypeObject PyMemoryIter_Type;
+
+typedef struct {
+    PyObject_HEAD
+    Py_ssize_t it_index;
+    PyMemoryViewObject *it_seq; // Set to NULL when iterator is exhausted
+    Py_ssize_t it_length;
+    const char *it_fmt;
+} memoryiterobject;
+
+static void
+memoryiter_dealloc(memoryiterobject *it)
+{
+    _PyObject_GC_UNTRACK(it);
+    Py_XDECREF(it->it_seq);
+    PyObject_GC_Del(it);
+}
+
+static int
+memoryiter_traverse(memoryiterobject *it, visitproc visit, void *arg)
+{
+    Py_VISIT(it->it_seq);
+    return 0;
+}
+
+static PyObject *
+memoryiter_next(memoryiterobject *it)
+{
+    PyMemoryViewObject *seq;
+    seq = it->it_seq;
+    if (seq == NULL) {
+        return NULL;
+    }
+
+    if (it->it_index < it->it_length) {
+        CHECK_RELEASED(seq);
+        Py_buffer *view = &(seq->view);
+        char *ptr = (char *)seq->view.buf;
+
+        ptr += view->strides[0] * it->it_index++;
+        ptr = ADJUST_PTR(ptr, view->suboffsets, 0);
+        if (ptr == NULL) {
+            return NULL;
+        }
+        return unpack_single(ptr, it->it_fmt);
+    }
+
+    it->it_seq = NULL;
+    Py_DECREF(seq);
+    return NULL;
+}
+
+static PyObject *
+memory_iter(PyObject *seq)
+{
+    if (!PyMemoryView_Check(seq)) {
+        PyErr_BadInternalCall();
+        return NULL;
+    }
+    PyMemoryViewObject *obj = (PyMemoryViewObject *)seq;
+    int ndims = obj->view.ndim;
+    if (ndims == 0) {
+        PyErr_SetString(PyExc_TypeError, "invalid indexing of 0-dim memory");
+        return NULL;
+    }
+    if (ndims != 1) {
+        PyErr_SetString(PyExc_NotImplementedError,
+            "multi-dimensional sub-views are not implemented");
+        return NULL;
+    }
+
+    const char *fmt = adjust_fmt(&obj->view);
+    if (fmt == NULL) {
+        return NULL;
+    }
+
+    memoryiterobject *it;
+    it = PyObject_GC_New(memoryiterobject, &PyMemoryIter_Type);
+    if (it == NULL) {
+        return NULL;
+    }
+    it->it_fmt = fmt;
+    it->it_length = memory_length(obj);
+    it->it_index = 0;
+    Py_INCREF(seq);
+    it->it_seq = obj;
+    _PyObject_GC_TRACK(it);
+    return (PyObject *)it;
+}
+
+static PyTypeObject PyMemoryIter_Type = {
+    PyVarObject_HEAD_INIT(&PyType_Type, 0)
+    .tp_name = "memory_iterator",
+    .tp_basicsize = sizeof(memoryiterobject),
+    // methods
+    .tp_dealloc = (destructor)memoryiter_dealloc,
+    .tp_getattro = PyObject_GenericGetAttr,
+    .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
+    .tp_traverse = (traverseproc)memoryiter_traverse,
+    .tp_iter = PyObject_SelfIter,
+    .tp_iternext = (iternextfunc)memoryiter_next,
+};
 
 PyTypeObject PyMemoryView_Type = {
     PyVarObject_HEAD_INIT(&PyType_Type, 0)
@@ -3180,13 +3287,14 @@
     PyObject_GenericGetAttr,                  /* tp_getattro */
     0,                                        /* tp_setattro */
     &memory_as_buffer,                        /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,  /* tp_flags */
-    memory_doc,                               /* tp_doc */
+    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
+       Py_TPFLAGS_SEQUENCE,                   /* tp_flags */
+    memoryview__doc__,                        /* tp_doc */
     (traverseproc)memory_traverse,            /* tp_traverse */
     (inquiry)memory_clear,                    /* tp_clear */
     memory_richcompare,                       /* tp_richcompare */
     offsetof(PyMemoryViewObject, weakreflist),/* tp_weaklistoffset */
-    0,                                        /* tp_iter */
+    memory_iter,                              /* tp_iter */
     0,                                        /* tp_iternext */
     memory_methods,                           /* tp_methods */
     0,                                        /* tp_members */
@@ -3198,5 +3306,5 @@
     0,                                        /* tp_dictoffset */
     0,                                        /* tp_init */
     0,                                        /* tp_alloc */
-    memory_new,                               /* tp_new */
+    memoryview,                               /* tp_new */
 };
diff --git a/Objects/methodobject.c b/Objects/methodobject.c
index 7b43041..2df63cf 100644
--- a/Objects/methodobject.c
+++ b/Objects/methodobject.c
@@ -160,7 +160,10 @@
 static void
 meth_dealloc(PyCFunctionObject *m)
 {
-    _PyObject_GC_UNTRACK(m);
+    // The Py_TRASHCAN mechanism requires that we be able to
+    // call PyObject_GC_UnTrack twice on an object.
+    PyObject_GC_UnTrack(m);
+    Py_TRASHCAN_BEGIN(m, meth_dealloc);
     if (m->m_weakreflist != NULL) {
         PyObject_ClearWeakRefs((PyObject*) m);
     }
@@ -170,6 +173,7 @@
     Py_XDECREF(m->m_self);
     Py_XDECREF(m->m_module);
     PyObject_GC_Del(m);
+    Py_TRASHCAN_END;
 }
 
 static PyObject *
diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c
index ee4ed97..b69e5ce 100644
--- a/Objects/moduleobject.c
+++ b/Objects/moduleobject.c
@@ -4,6 +4,7 @@
 #include "Python.h"
 #include "pycore_interp.h"        // PyInterpreterState.importlib
 #include "pycore_pystate.h"       // _PyInterpreterState_GET()
+#include "pycore_moduleobject.h"  // _PyModule_GetDef()
 #include "structmember.h"         // PyMemberDef
 
 static Py_ssize_t max_module_number;
@@ -11,15 +12,9 @@
 _Py_IDENTIFIER(__doc__);
 _Py_IDENTIFIER(__name__);
 _Py_IDENTIFIER(__spec__);
-
-typedef struct {
-    PyObject_HEAD
-    PyObject *md_dict;
-    struct PyModuleDef *md_def;
-    void *md_state;
-    PyObject *md_weaklist;
-    PyObject *md_name;  /* for logging purposes after md_dict is cleared */
-} PyModuleObject;
+_Py_IDENTIFIER(__dict__);
+_Py_IDENTIFIER(__dir__);
+_Py_IDENTIFIER(__annotations__);
 
 static PyMemberDef module_members[] = {
     {"__dict__", T_OBJECT, offsetof(PyModuleObject, md_dict), READONLY},
@@ -35,6 +30,19 @@
 };
 
 
+int
+_PyModule_IsExtension(PyObject *obj)
+{
+    if (!PyModule_Check(obj)) {
+        return 0;
+    }
+    PyModuleObject *module = (PyModuleObject*)obj;
+
+    struct PyModuleDef *def = module->md_def;
+    return (def != NULL && def->m_methods != NULL);
+}
+
+
 PyObject*
 PyModuleDef_Init(struct PyModuleDef* def)
 {
@@ -211,7 +219,7 @@
         return NULL;
 
     if (module->m_size > 0) {
-        m->md_state = PyMem_MALLOC(module->m_size);
+        m->md_state = PyMem_Malloc(module->m_size);
         if (!m->md_state) {
             PyErr_NoMemory();
             Py_DECREF(m);
@@ -377,7 +385,7 @@
         if (md->md_state == NULL) {
             /* Always set a state pointer; this serves as a marker to skip
              * multiple initialization (importlib.reload() is no-op) */
-            md->md_state = PyMem_MALLOC(def->m_size);
+            md->md_state = PyMem_Malloc(def->m_size);
             if (!md->md_state) {
                 PyErr_NoMemory();
                 return -1;
@@ -456,14 +464,11 @@
 PyObject *
 PyModule_GetDict(PyObject *m)
 {
-    PyObject *d;
     if (!PyModule_Check(m)) {
         PyErr_BadInternalCall();
         return NULL;
     }
-    d = ((PyModuleObject *)m) -> md_dict;
-    assert(d != NULL);
-    return d;
+    return _PyModule_GetDict(m);
 }
 
 PyObject*
@@ -476,11 +481,13 @@
         return NULL;
     }
     d = ((PyModuleObject *)m)->md_dict;
-    if (d == NULL ||
-        (name = _PyDict_GetItemId(d, &PyId___name__)) == NULL ||
+    if (d == NULL || !PyDict_Check(d) ||
+        (name = _PyDict_GetItemIdWithError(d, &PyId___name__)) == NULL ||
         !PyUnicode_Check(name))
     {
-        PyErr_SetString(PyExc_SystemError, "nameless module");
+        if (!PyErr_Occurred()) {
+            PyErr_SetString(PyExc_SystemError, "nameless module");
+        }
         return NULL;
     }
     Py_INCREF(name);
@@ -509,10 +516,12 @@
     }
     d = ((PyModuleObject *)m)->md_dict;
     if (d == NULL ||
-        (fileobj = _PyDict_GetItemId(d, &PyId___file__)) == NULL ||
+        (fileobj = _PyDict_GetItemIdWithError(d, &PyId___file__)) == NULL ||
         !PyUnicode_Check(fileobj))
     {
-        PyErr_SetString(PyExc_SystemError, "module filename missing");
+        if (!PyErr_Occurred()) {
+            PyErr_SetString(PyExc_SystemError, "module filename missing");
+        }
         return NULL;
     }
     Py_INCREF(fileobj);
@@ -539,7 +548,7 @@
         PyErr_BadArgument();
         return NULL;
     }
-    return ((PyModuleObject *)m)->md_def;
+    return _PyModule_GetDef(m);
 }
 
 void*
@@ -549,7 +558,7 @@
         PyErr_BadArgument();
         return NULL;
     }
-    return ((PyModuleObject *)m)->md_state;
+    return _PyModule_GetState(m);
 }
 
 void
@@ -677,7 +686,7 @@
     Py_XDECREF(m->md_dict);
     Py_XDECREF(m->md_name);
     if (m->md_state != NULL)
-        PyMem_FREE(m->md_state);
+        PyMem_Free(m->md_state);
     Py_TYPE(m)->tp_free((PyObject *)m);
 }
 
@@ -721,14 +730,21 @@
     PyErr_Clear();
     if (m->md_dict) {
         _Py_IDENTIFIER(__getattr__);
-        getattr = _PyDict_GetItemId(m->md_dict, &PyId___getattr__);
+        getattr = _PyDict_GetItemIdWithError(m->md_dict, &PyId___getattr__);
         if (getattr) {
             return PyObject_CallOneArg(getattr, name);
         }
-        mod_name = _PyDict_GetItemId(m->md_dict, &PyId___name__);
+        if (PyErr_Occurred()) {
+            return NULL;
+        }
+        mod_name = _PyDict_GetItemIdWithError(m->md_dict, &PyId___name__);
         if (mod_name && PyUnicode_Check(mod_name)) {
             Py_INCREF(mod_name);
-            PyObject *spec = _PyDict_GetItemId(m->md_dict, &PyId___spec__);
+            PyObject *spec = _PyDict_GetItemIdWithError(m->md_dict, &PyId___spec__);
+            if (spec == NULL && PyErr_Occurred()) {
+                Py_DECREF(mod_name);
+                return NULL;
+            }
             Py_XINCREF(spec);
             if (_PyModuleSpec_IsInitializing(spec)) {
                 PyErr_Format(PyExc_AttributeError,
@@ -746,6 +762,9 @@
             Py_DECREF(mod_name);
             return NULL;
         }
+        else if (PyErr_Occurred()) {
+            return NULL;
+        }
     }
     PyErr_Format(PyExc_AttributeError,
                 "module has no attribute '%U'", name);
@@ -791,8 +810,6 @@
 static PyObject *
 module_dir(PyObject *self, PyObject *args)
 {
-    _Py_IDENTIFIER(__dict__);
-    _Py_IDENTIFIER(__dir__);
     PyObject *result = NULL;
     PyObject *dict = _PyObject_GetAttrId(self, &PyId___dict__);
 
@@ -807,11 +824,7 @@
             }
         }
         else {
-            const char *name = PyModule_GetName(self);
-            if (name)
-                PyErr_Format(PyExc_TypeError,
-                             "%.200s.__dict__ is not a dictionary",
-                             name);
+            PyErr_Format(PyExc_TypeError, "<module>.__dict__ is not a dictionary");
         }
     }
 
@@ -825,6 +838,78 @@
     {0}
 };
 
+static PyObject *
+module_get_annotations(PyModuleObject *m, void *Py_UNUSED(ignored))
+{
+    PyObject *dict = _PyObject_GetAttrId((PyObject *)m, &PyId___dict__);
+
+    if ((dict == NULL) || !PyDict_Check(dict)) {
+        PyErr_Format(PyExc_TypeError, "<module>.__dict__ is not a dictionary");
+        Py_XDECREF(dict);
+        return NULL;
+    }
+
+    PyObject *annotations;
+    /* there's no _PyDict_GetItemId without WithError, so let's LBYL. */
+    if (_PyDict_ContainsId(dict, &PyId___annotations__)) {
+        annotations = _PyDict_GetItemIdWithError(dict, &PyId___annotations__);
+        /*
+        ** _PyDict_GetItemIdWithError could still fail,
+        ** for instance with a well-timed Ctrl-C or a MemoryError.
+        ** so let's be totally safe.
+        */
+        if (annotations) {
+            Py_INCREF(annotations);
+        }
+    } else {
+        annotations = PyDict_New();
+        if (annotations) {
+            int result = _PyDict_SetItemId(dict, &PyId___annotations__, annotations);
+            if (result) {
+                Py_CLEAR(annotations);
+            }
+        }
+    }
+    Py_DECREF(dict);
+    return annotations;
+}
+
+static int
+module_set_annotations(PyModuleObject *m, PyObject *value, void *Py_UNUSED(ignored))
+{
+    int ret = -1;
+    PyObject *dict = _PyObject_GetAttrId((PyObject *)m, &PyId___dict__);
+
+    if ((dict == NULL) || !PyDict_Check(dict)) {
+        PyErr_Format(PyExc_TypeError, "<module>.__dict__ is not a dictionary");
+        goto exit;
+    }
+
+    if (value != NULL) {
+        /* set */
+        ret = _PyDict_SetItemId(dict, &PyId___annotations__, value);
+        goto exit;
+    }
+
+    /* delete */
+    if (!_PyDict_ContainsId(dict, &PyId___annotations__)) {
+        PyErr_Format(PyExc_AttributeError, "__annotations__");
+        goto exit;
+    }
+
+    ret = _PyDict_DelItemId(dict, &PyId___annotations__);
+
+exit:
+    Py_XDECREF(dict);
+    return ret;
+}
+
+
+static PyGetSetDef module_getsets[] = {
+    {"__annotations__", (getter)module_get_annotations, (setter)module_set_annotations},
+    {NULL}
+};
+
 PyTypeObject PyModule_Type = {
     PyVarObject_HEAD_INIT(&PyType_Type, 0)
     "module",                                   /* tp_name */
@@ -856,7 +941,7 @@
     0,                                          /* tp_iternext */
     module_methods,                             /* tp_methods */
     module_members,                             /* tp_members */
-    0,                                          /* tp_getset */
+    module_getsets,                             /* tp_getset */
     0,                                          /* tp_base */
     0,                                          /* tp_dict */
     0,                                          /* tp_descr_get */
diff --git a/Objects/object.c b/Objects/object.c
index 623ee52..47c352e 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -10,9 +10,16 @@
 #include "pycore_pylifecycle.h"
 #include "pycore_pymem.h"         // _PyMem_IsPtrFreed()
 #include "pycore_pystate.h"       // _PyThreadState_GET()
+#include "pycore_symtable.h"      // PySTEntry_Type
+#include "pycore_unionobject.h"   // _PyUnion_Type
 #include "frameobject.h"
 #include "interpreteridobject.h"
 
+#ifdef Py_LIMITED_API
+   // Prevent recursive call _Py_IncRef() <=> Py_INCREF()
+#  error "Py_LIMITED_API macro must not be defined"
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -66,8 +73,7 @@
 void
 _PyDebug_PrintTotalRefs(void) {
     fprintf(stderr,
-            "[%" PY_FORMAT_SIZE_T "d refs, "
-            "%" PY_FORMAT_SIZE_T "d blocks]\n",
+            "[%zd refs, %zd blocks]\n",
             _Py_GetRefTotal(), _Py_GetAllocatedBlocks());
 }
 #endif /* Py_REF_DEBUG */
@@ -137,36 +143,48 @@
     Py_XDECREF(o);
 }
 
+void
+_Py_IncRef(PyObject *o)
+{
+    Py_INCREF(o);
+}
+
+void
+_Py_DecRef(PyObject *o)
+{
+    Py_DECREF(o);
+}
+
 PyObject *
 PyObject_Init(PyObject *op, PyTypeObject *tp)
 {
-    /* Any changes should be reflected in PyObject_INIT() macro */
     if (op == NULL) {
         return PyErr_NoMemory();
     }
 
-    return PyObject_INIT(op, tp);
+    _PyObject_Init(op, tp);
+    return op;
 }
 
 PyVarObject *
 PyObject_InitVar(PyVarObject *op, PyTypeObject *tp, Py_ssize_t size)
 {
-    /* Any changes should be reflected in PyObject_INIT_VAR() macro */
     if (op == NULL) {
         return (PyVarObject *) PyErr_NoMemory();
     }
 
-    return PyObject_INIT_VAR(op, tp, size);
+    _PyObject_InitVar(op, tp, size);
+    return op;
 }
 
 PyObject *
 _PyObject_New(PyTypeObject *tp)
 {
-    PyObject *op = (PyObject *) PyObject_MALLOC(_PyObject_SIZE(tp));
+    PyObject *op = (PyObject *) PyObject_Malloc(_PyObject_SIZE(tp));
     if (op == NULL) {
         return PyErr_NoMemory();
     }
-    PyObject_INIT(op, tp);
+    _PyObject_Init(op, tp);
     return op;
 }
 
@@ -175,10 +193,12 @@
 {
     PyVarObject *op;
     const size_t size = _PyObject_VAR_SIZE(tp, nitems);
-    op = (PyVarObject *) PyObject_MALLOC(size);
-    if (op == NULL)
+    op = (PyVarObject *) PyObject_Malloc(size);
+    if (op == NULL) {
         return (PyVarObject *)PyErr_NoMemory();
-    return PyObject_INIT_VAR(op, tp, nitems);
+    }
+    _PyObject_InitVar(op, tp, nitems);
+    return op;
 }
 
 void
@@ -854,17 +874,6 @@
 }
 
 int
-_PyObject_HasAttrId(PyObject *v, _Py_Identifier *name)
-{
-    int result;
-    PyObject *oname = _PyUnicode_FromId(name); /* borrowed */
-    if (!oname)
-        return -1;
-    result = PyObject_HasAttr(v, oname);
-    return result;
-}
-
-int
 _PyObject_SetAttrId(PyObject *v, _Py_Identifier *name, PyObject *w)
 {
     int result;
@@ -875,29 +884,70 @@
     return result;
 }
 
+static inline int
+set_attribute_error_context(PyObject* v, PyObject* name)
+{
+    assert(PyErr_Occurred());
+    _Py_IDENTIFIER(name);
+    _Py_IDENTIFIER(obj);
+    if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
+        return 0;
+    }
+    // Intercept AttributeError exceptions and augment them to offer suggestions later.
+    PyObject *type, *value, *traceback;
+    PyErr_Fetch(&type, &value, &traceback);
+    PyErr_NormalizeException(&type, &value, &traceback);
+    // Check if the normalized exception is indeed an AttributeError
+    if (!PyErr_GivenExceptionMatches(value, PyExc_AttributeError)) {
+        goto restore;
+    }
+    PyAttributeErrorObject* the_exc = (PyAttributeErrorObject*) value;
+    // Check if this exception was already augmented
+    if (the_exc->name || the_exc->obj) {
+        goto restore;
+    }
+    // Augment the exception with the name and object
+    if (_PyObject_SetAttrId(value, &PyId_name, name) ||
+        _PyObject_SetAttrId(value, &PyId_obj, v)) {
+        return 1;
+    }
+restore:
+    PyErr_Restore(type, value, traceback);
+    return 0;
+}
+
 PyObject *
 PyObject_GetAttr(PyObject *v, PyObject *name)
 {
     PyTypeObject *tp = Py_TYPE(v);
-
     if (!PyUnicode_Check(name)) {
         PyErr_Format(PyExc_TypeError,
                      "attribute name must be string, not '%.200s'",
                      Py_TYPE(name)->tp_name);
         return NULL;
     }
-    if (tp->tp_getattro != NULL)
-        return (*tp->tp_getattro)(v, name);
-    if (tp->tp_getattr != NULL) {
-        const char *name_str = PyUnicode_AsUTF8(name);
-        if (name_str == NULL)
-            return NULL;
-        return (*tp->tp_getattr)(v, (char *)name_str);
+
+    PyObject* result = NULL;
+    if (tp->tp_getattro != NULL) {
+        result = (*tp->tp_getattro)(v, name);
     }
-    PyErr_Format(PyExc_AttributeError,
-                 "'%.50s' object has no attribute '%U'",
-                 tp->tp_name, name);
-    return NULL;
+    else if (tp->tp_getattr != NULL) {
+        const char *name_str = PyUnicode_AsUTF8(name);
+        if (name_str == NULL) {
+            return NULL;
+        }
+        result = (*tp->tp_getattr)(v, (char *)name_str);
+    }
+    else {
+        PyErr_Format(PyExc_AttributeError,
+                    "'%.50s' object has no attribute '%U'",
+                    tp->tp_name, name);
+    }
+
+    if (result == NULL) {
+        set_attribute_error_context(v, name);
+    }
+    return result;
 }
 
 int
@@ -1156,6 +1206,8 @@
     PyErr_Format(PyExc_AttributeError,
                  "'%.50s' object has no attribute '%U'",
                  tp->tp_name, name);
+
+    set_attribute_error_context(obj, name);
     return 0;
 }
 
@@ -1168,7 +1220,7 @@
     /* Make sure the logic of _PyObject_GetMethod is in sync with
        this method.
 
-       When suppress=1, this function suppress AttributeError.
+       When suppress=1, this function suppresses AttributeError.
     */
 
     PyTypeObject *tp = Py_TYPE(obj);
@@ -1386,7 +1438,7 @@
 }
 
 
-/* Test a value used as condition, e.g., in a for or if statement.
+/* Test a value used as condition, e.g., in a while or if statement.
    Return -1 if an error occurred */
 
 int
@@ -1738,82 +1790,109 @@
         return status;
     }
 
-#define INIT_TYPE(TYPE, NAME) \
+#define INIT_TYPE(TYPE) \
     do { \
-        if (PyType_Ready(TYPE) < 0) { \
-            return _PyStatus_ERR("Can't initialize " NAME " type"); \
+        if (PyType_Ready(&(TYPE)) < 0) { \
+            return _PyStatus_ERR("Can't initialize " #TYPE " type"); \
         } \
     } while (0)
 
-    INIT_TYPE(&PyBaseObject_Type, "object");
-    INIT_TYPE(&PyType_Type, "type");
-    INIT_TYPE(&_PyWeakref_RefType, "weakref");
-    INIT_TYPE(&_PyWeakref_CallableProxyType, "callable weakref proxy");
-    INIT_TYPE(&_PyWeakref_ProxyType, "weakref proxy");
-    INIT_TYPE(&PyLong_Type, "int");
-    INIT_TYPE(&PyBool_Type, "bool");
-    INIT_TYPE(&PyByteArray_Type, "bytearray");
-    INIT_TYPE(&PyBytes_Type, "str");
-    INIT_TYPE(&PyList_Type, "list");
-    INIT_TYPE(&_PyNone_Type, "None");
-    INIT_TYPE(&_PyNotImplemented_Type, "NotImplemented");
-    INIT_TYPE(&PyTraceBack_Type, "traceback");
-    INIT_TYPE(&PySuper_Type, "super");
-    INIT_TYPE(&PyRange_Type, "range");
-    INIT_TYPE(&PyDict_Type, "dict");
-    INIT_TYPE(&PyDictKeys_Type, "dict keys");
-    INIT_TYPE(&PyDictValues_Type, "dict values");
-    INIT_TYPE(&PyDictItems_Type, "dict items");
-    INIT_TYPE(&PyDictRevIterKey_Type, "reversed dict keys");
-    INIT_TYPE(&PyDictRevIterValue_Type, "reversed dict values");
-    INIT_TYPE(&PyDictRevIterItem_Type, "reversed dict items");
-    INIT_TYPE(&PyODict_Type, "OrderedDict");
-    INIT_TYPE(&PyODictKeys_Type, "odict_keys");
-    INIT_TYPE(&PyODictItems_Type, "odict_items");
-    INIT_TYPE(&PyODictValues_Type, "odict_values");
-    INIT_TYPE(&PyODictIter_Type, "odict_keyiterator");
-    INIT_TYPE(&PySet_Type, "set");
-    INIT_TYPE(&PyUnicode_Type, "str");
-    INIT_TYPE(&PySlice_Type, "slice");
-    INIT_TYPE(&PyStaticMethod_Type, "static method");
-    INIT_TYPE(&PyComplex_Type, "complex");
-    INIT_TYPE(&PyFloat_Type, "float");
-    INIT_TYPE(&PyFrozenSet_Type, "frozenset");
-    INIT_TYPE(&PyProperty_Type, "property");
-    INIT_TYPE(&_PyManagedBuffer_Type, "managed buffer");
-    INIT_TYPE(&PyMemoryView_Type, "memoryview");
-    INIT_TYPE(&PyTuple_Type, "tuple");
-    INIT_TYPE(&PyEnum_Type, "enumerate");
-    INIT_TYPE(&PyReversed_Type, "reversed");
-    INIT_TYPE(&PyStdPrinter_Type, "StdPrinter");
-    INIT_TYPE(&PyCode_Type, "code");
-    INIT_TYPE(&PyFrame_Type, "frame");
-    INIT_TYPE(&PyCFunction_Type, "builtin function");
-    INIT_TYPE(&PyCMethod_Type, "builtin method");
-    INIT_TYPE(&PyMethod_Type, "method");
-    INIT_TYPE(&PyFunction_Type, "function");
-    INIT_TYPE(&PyDictProxy_Type, "dict proxy");
-    INIT_TYPE(&PyGen_Type, "generator");
-    INIT_TYPE(&PyGetSetDescr_Type, "get-set descriptor");
-    INIT_TYPE(&PyWrapperDescr_Type, "wrapper");
-    INIT_TYPE(&_PyMethodWrapper_Type, "method wrapper");
-    INIT_TYPE(&PyEllipsis_Type, "ellipsis");
-    INIT_TYPE(&PyMemberDescr_Type, "member descriptor");
-    INIT_TYPE(&_PyNamespace_Type, "namespace");
-    INIT_TYPE(&PyCapsule_Type, "capsule");
-    INIT_TYPE(&PyLongRangeIter_Type, "long range iterator");
-    INIT_TYPE(&PyCell_Type, "cell");
-    INIT_TYPE(&PyInstanceMethod_Type, "instance method");
-    INIT_TYPE(&PyClassMethodDescr_Type, "class method descr");
-    INIT_TYPE(&PyMethodDescr_Type, "method descr");
-    INIT_TYPE(&PyCallIter_Type, "call iter");
-    INIT_TYPE(&PySeqIter_Type, "sequence iterator");
-    INIT_TYPE(&PyPickleBuffer_Type, "pickle.PickleBuffer");
-    INIT_TYPE(&PyCoro_Type, "coroutine");
-    INIT_TYPE(&_PyCoroWrapper_Type, "coroutine wrapper");
-    INIT_TYPE(&_PyInterpreterID_Type, "interpreter ID");
-    return _PyStatus_OK();
+    // Base types
+    INIT_TYPE(PyBaseObject_Type);
+    INIT_TYPE(PyType_Type);
+    assert(PyBaseObject_Type.tp_base == NULL);
+    assert(PyType_Type.tp_base == &PyBaseObject_Type);
 
+    // All other static types
+    INIT_TYPE(PyAsyncGen_Type);
+    INIT_TYPE(PyBool_Type);
+    INIT_TYPE(PyByteArrayIter_Type);
+    INIT_TYPE(PyByteArray_Type);
+    INIT_TYPE(PyBytesIter_Type);
+    INIT_TYPE(PyBytes_Type);
+    INIT_TYPE(PyCFunction_Type);
+    INIT_TYPE(PyCMethod_Type);
+    INIT_TYPE(PyCallIter_Type);
+    INIT_TYPE(PyCapsule_Type);
+    INIT_TYPE(PyCell_Type);
+    INIT_TYPE(PyClassMethodDescr_Type);
+    INIT_TYPE(PyClassMethod_Type);
+    INIT_TYPE(PyCode_Type);
+    INIT_TYPE(PyComplex_Type);
+    INIT_TYPE(PyCoro_Type);
+    INIT_TYPE(PyDictItems_Type);
+    INIT_TYPE(PyDictIterItem_Type);
+    INIT_TYPE(PyDictIterKey_Type);
+    INIT_TYPE(PyDictIterValue_Type);
+    INIT_TYPE(PyDictKeys_Type);
+    INIT_TYPE(PyDictProxy_Type);
+    INIT_TYPE(PyDictRevIterItem_Type);
+    INIT_TYPE(PyDictRevIterKey_Type);
+    INIT_TYPE(PyDictRevIterValue_Type);
+    INIT_TYPE(PyDictValues_Type);
+    INIT_TYPE(PyDict_Type);
+    INIT_TYPE(PyEllipsis_Type);
+    INIT_TYPE(PyEnum_Type);
+    INIT_TYPE(PyFloat_Type);
+    INIT_TYPE(PyFrame_Type);
+    INIT_TYPE(PyFrozenSet_Type);
+    INIT_TYPE(PyFunction_Type);
+    INIT_TYPE(PyGen_Type);
+    INIT_TYPE(PyGetSetDescr_Type);
+    INIT_TYPE(PyInstanceMethod_Type);
+    INIT_TYPE(PyListIter_Type);
+    INIT_TYPE(PyListRevIter_Type);
+    INIT_TYPE(PyList_Type);
+    INIT_TYPE(PyLongRangeIter_Type);
+    INIT_TYPE(PyLong_Type);
+    INIT_TYPE(PyMemberDescr_Type);
+    INIT_TYPE(PyMemoryView_Type);
+    INIT_TYPE(PyMethodDescr_Type);
+    INIT_TYPE(PyMethod_Type);
+    INIT_TYPE(PyModuleDef_Type);
+    INIT_TYPE(PyModule_Type);
+    INIT_TYPE(PyODictItems_Type);
+    INIT_TYPE(PyODictIter_Type);
+    INIT_TYPE(PyODictKeys_Type);
+    INIT_TYPE(PyODictValues_Type);
+    INIT_TYPE(PyODict_Type);
+    INIT_TYPE(PyPickleBuffer_Type);
+    INIT_TYPE(PyProperty_Type);
+    INIT_TYPE(PyRangeIter_Type);
+    INIT_TYPE(PyRange_Type);
+    INIT_TYPE(PyReversed_Type);
+    INIT_TYPE(PySTEntry_Type);
+    INIT_TYPE(PySeqIter_Type);
+    INIT_TYPE(PySetIter_Type);
+    INIT_TYPE(PySet_Type);
+    INIT_TYPE(PySlice_Type);
+    INIT_TYPE(PyStaticMethod_Type);
+    INIT_TYPE(PyStdPrinter_Type);
+    INIT_TYPE(PySuper_Type);
+    INIT_TYPE(PyTraceBack_Type);
+    INIT_TYPE(PyTupleIter_Type);
+    INIT_TYPE(PyTuple_Type);
+    INIT_TYPE(PyUnicodeIter_Type);
+    INIT_TYPE(PyUnicode_Type);
+    INIT_TYPE(PyWrapperDescr_Type);
+    INIT_TYPE(Py_GenericAliasType);
+    INIT_TYPE(_PyAnextAwaitable_Type);
+    INIT_TYPE(_PyAsyncGenASend_Type);
+    INIT_TYPE(_PyAsyncGenAThrow_Type);
+    INIT_TYPE(_PyAsyncGenWrappedValue_Type);
+    INIT_TYPE(_PyCoroWrapper_Type);
+    INIT_TYPE(_PyInterpreterID_Type);
+    INIT_TYPE(_PyManagedBuffer_Type);
+    INIT_TYPE(_PyMethodWrapper_Type);
+    INIT_TYPE(_PyNamespace_Type);
+    INIT_TYPE(_PyNone_Type);
+    INIT_TYPE(_PyNotImplemented_Type);
+    INIT_TYPE(_PyWeakref_CallableProxyType);
+    INIT_TYPE(_PyWeakref_ProxyType);
+    INIT_TYPE(_PyWeakref_RefType);
+    INIT_TYPE(_PyUnion_Type);
+
+    return _PyStatus_OK();
 #undef INIT_TYPE
 }
 
@@ -1876,9 +1955,10 @@
     PyObject *op;
     fprintf(fp, "Remaining objects:\n");
     for (op = refchain._ob_next; op != &refchain; op = op->_ob_next) {
-        fprintf(fp, "%p [%" PY_FORMAT_SIZE_T "d] ", (void *)op, Py_REFCNT(op));
-        if (PyObject_Print(op, fp, 0) != 0)
+        fprintf(fp, "%p [%zd] ", (void *)op, Py_REFCNT(op));
+        if (PyObject_Print(op, fp, 0) != 0) {
             PyErr_Clear();
+        }
         putc('\n', fp);
     }
 }
@@ -1892,7 +1972,7 @@
     PyObject *op;
     fprintf(fp, "Remaining object addresses:\n");
     for (op = refchain._ob_next; op != &refchain; op = op->_ob_next)
-        fprintf(fp, "%p [%" PY_FORMAT_SIZE_T "d] %s\n", (void *)op,
+        fprintf(fp, "%p [%zd] %s\n", (void *)op,
             Py_REFCNT(op), Py_TYPE(op)->tp_name);
 }
 
@@ -2029,8 +2109,8 @@
 void
 _PyTrash_deposit_object(PyObject *op)
 {
-    PyThreadState *tstate = _PyThreadState_GET();
-    struct _gc_runtime_state *gcstate = &tstate->interp->gc;
+    PyInterpreterState *interp = _PyInterpreterState_GET();
+    struct _gc_runtime_state *gcstate = &interp->gc;
 
     _PyObject_ASSERT(op, _PyObject_IS_GC(op));
     _PyObject_ASSERT(op, !_PyObject_GC_IS_TRACKED(op));
@@ -2057,8 +2137,8 @@
 void
 _PyTrash_destroy_chain(void)
 {
-    PyThreadState *tstate = _PyThreadState_GET();
-    struct _gc_runtime_state *gcstate = &tstate->interp->gc;
+    PyInterpreterState *interp = _PyInterpreterState_GET();
+    struct _gc_runtime_state *gcstate = &interp->gc;
 
     while (gcstate->trash_delete_later) {
         PyObject *op = gcstate->trash_delete_later;
@@ -2143,6 +2223,15 @@
 }
 
 
+/* bpo-40170: It's only be used in Py_TRASHCAN_BEGIN macro to hide
+   implementation details. */
+int
+_PyTrash_cond(PyObject *op, destructor dealloc)
+{
+    return Py_TYPE(op)->tp_dealloc == dealloc;
+}
+
+
 void _Py_NO_RETURN
 _PyObject_AssertFailed(PyObject *obj, const char *expr, const char *msg,
                        const char *file, int line, const char *function)
@@ -2217,6 +2306,49 @@
 }
 
 
+#undef Py_NewRef
+#undef Py_XNewRef
+
+// Export Py_NewRef() and Py_XNewRef() as regular functions for the stable ABI.
+PyObject*
+Py_NewRef(PyObject *obj)
+{
+    return _Py_NewRef(obj);
+}
+
+PyObject*
+Py_XNewRef(PyObject *obj)
+{
+    return _Py_XNewRef(obj);
+}
+
+#undef Py_Is
+#undef Py_IsNone
+#undef Py_IsTrue
+#undef Py_IsFalse
+
+// Export Py_Is(), Py_IsNone(), Py_IsTrue(), Py_IsFalse() as regular functions
+// for the stable ABI.
+int Py_Is(PyObject *x, PyObject *y)
+{
+    return (x == y);
+}
+
+int Py_IsNone(PyObject *x)
+{
+    return Py_Is(x, Py_None);
+}
+
+int Py_IsTrue(PyObject *x)
+{
+    return Py_Is(x, Py_True);
+}
+
+int Py_IsFalse(PyObject *x)
+{
+    return Py_Is(x, Py_False);
+}
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c
index eb34f10..615703a 100644
--- a/Objects/obmalloc.c
+++ b/Objects/obmalloc.c
@@ -836,7 +836,7 @@
 
 /*
  * Alignment of addresses returned to the user. 8-bytes alignment works
- * on most current architectures (with 32-bit or 64-bit address busses).
+ * on most current architectures (with 32-bit or 64-bit address buses).
  * The alignment value is also used for grouping small requests in size
  * classes spaced ALIGNMENT bytes apart.
  *
@@ -894,6 +894,22 @@
 #endif
 #endif
 
+#if !defined(WITH_PYMALLOC_RADIX_TREE)
+/* Use radix-tree to track arena memory regions, for address_in_range().
+ * Enable by default since it allows larger pool sizes.  Can be disabled
+ * using -DWITH_PYMALLOC_RADIX_TREE=0 */
+#define WITH_PYMALLOC_RADIX_TREE 1
+#endif
+
+#if SIZEOF_VOID_P > 4
+/* on 64-bit platforms use larger pools and arenas if we can */
+#define USE_LARGE_ARENAS
+#if WITH_PYMALLOC_RADIX_TREE
+/* large pools only supported if radix-tree is enabled */
+#define USE_LARGE_POOLS
+#endif
+#endif
+
 /*
  * The allocator sub-allocates <Big> blocks of memory (called arenas) aligned
  * on a page boundary. This is a reserved virtual address space for the
@@ -907,18 +923,34 @@
  * Arenas are allocated with mmap() on systems supporting anonymous memory
  * mappings to reduce heap fragmentation.
  */
-#define ARENA_SIZE              (256 << 10)     /* 256KB */
+#ifdef USE_LARGE_ARENAS
+#define ARENA_BITS              20                    /* 1 MiB */
+#else
+#define ARENA_BITS              18                    /* 256 KiB */
+#endif
+#define ARENA_SIZE              (1 << ARENA_BITS)
+#define ARENA_SIZE_MASK         (ARENA_SIZE - 1)
 
 #ifdef WITH_MEMORY_LIMITS
 #define MAX_ARENAS              (SMALL_MEMORY_LIMIT / ARENA_SIZE)
 #endif
 
 /*
- * Size of the pools used for small blocks. Should be a power of 2,
- * between 1K and SYSTEM_PAGE_SIZE, that is: 1k, 2k, 4k.
+ * Size of the pools used for small blocks.  Must be a power of 2.
  */
-#define POOL_SIZE               SYSTEM_PAGE_SIZE        /* must be 2^N */
-#define POOL_SIZE_MASK          SYSTEM_PAGE_SIZE_MASK
+#ifdef USE_LARGE_POOLS
+#define POOL_BITS               14                  /* 16 KiB */
+#else
+#define POOL_BITS               12                  /* 4 KiB */
+#endif
+#define POOL_SIZE               (1 << POOL_BITS)
+#define POOL_SIZE_MASK          (POOL_SIZE - 1)
+
+#if !WITH_PYMALLOC_RADIX_TREE
+#if POOL_SIZE != SYSTEM_PAGE_SIZE
+#   error "pool size must be equal to system page size"
+#endif
+#endif
 
 #define MAX_POOLS_IN_ARENA  (ARENA_SIZE / POOL_SIZE)
 #if MAX_POOLS_IN_ARENA * POOL_SIZE != ARENA_SIZE
@@ -1233,6 +1265,264 @@
     return n;
 }
 
+#if WITH_PYMALLOC_RADIX_TREE
+/*==========================================================================*/
+/* radix tree for tracking arena usage
+
+   bit allocation for keys
+
+   64-bit pointers and 2^20 arena size:
+     16 -> ignored (POINTER_BITS - ADDRESS_BITS)
+     10 -> MAP_TOP
+     10 -> MAP_MID
+      8 -> MAP_BOT
+     20 -> ideal aligned arena
+   ----
+     64
+
+   32-bit pointers and 2^18 arena size:
+     14 -> MAP_BOT
+     18 -> ideal aligned arena
+   ----
+     32
+
+*/
+
+#if SIZEOF_VOID_P == 8
+
+/* number of bits in a pointer */
+#define POINTER_BITS 64
+
+/* Current 64-bit processors are limited to 48-bit physical addresses.  For
+ * now, the top 17 bits of addresses will all be equal to bit 2**47.  If that
+ * changes in the future, this must be adjusted upwards.
+ */
+#define ADDRESS_BITS 48
+
+/* use the top and mid layers of the radix tree */
+#define USE_INTERIOR_NODES
+
+#elif SIZEOF_VOID_P == 4
+
+#define POINTER_BITS 32
+#define ADDRESS_BITS 32
+
+#else
+
+ /* Currently this code works for 64-bit or 32-bit pointers only.  */
+#error "obmalloc radix tree requires 64-bit or 32-bit pointers."
+
+#endif /* SIZEOF_VOID_P */
+
+/* arena_coverage_t members require this to be true  */
+#if ARENA_BITS >= 32
+#   error "arena size must be < 2^32"
+#endif
+
+#ifdef USE_INTERIOR_NODES
+/* number of bits used for MAP_TOP and MAP_MID nodes */
+#define INTERIOR_BITS ((ADDRESS_BITS - ARENA_BITS + 2) / 3)
+#else
+#define INTERIOR_BITS 0
+#endif
+
+#define MAP_TOP_BITS INTERIOR_BITS
+#define MAP_TOP_LENGTH (1 << MAP_TOP_BITS)
+#define MAP_TOP_MASK (MAP_TOP_LENGTH - 1)
+
+#define MAP_MID_BITS INTERIOR_BITS
+#define MAP_MID_LENGTH (1 << MAP_MID_BITS)
+#define MAP_MID_MASK (MAP_MID_LENGTH - 1)
+
+#define MAP_BOT_BITS (ADDRESS_BITS - ARENA_BITS - 2*INTERIOR_BITS)
+#define MAP_BOT_LENGTH (1 << MAP_BOT_BITS)
+#define MAP_BOT_MASK (MAP_BOT_LENGTH - 1)
+
+#define MAP_BOT_SHIFT ARENA_BITS
+#define MAP_MID_SHIFT (MAP_BOT_BITS + MAP_BOT_SHIFT)
+#define MAP_TOP_SHIFT (MAP_MID_BITS + MAP_MID_SHIFT)
+
+#define AS_UINT(p) ((uintptr_t)(p))
+#define MAP_BOT_INDEX(p) ((AS_UINT(p) >> MAP_BOT_SHIFT) & MAP_BOT_MASK)
+#define MAP_MID_INDEX(p) ((AS_UINT(p) >> MAP_MID_SHIFT) & MAP_MID_MASK)
+#define MAP_TOP_INDEX(p) ((AS_UINT(p) >> MAP_TOP_SHIFT) & MAP_TOP_MASK)
+
+#if ADDRESS_BITS > POINTER_BITS
+/* Return non-physical address bits of a pointer.  Those bits should be same
+ * for all valid pointers if ADDRESS_BITS set correctly.  Linux has support for
+ * 57-bit address space (Intel 5-level paging) but will not currently give
+ * those addresses to user space.
+ */
+#define HIGH_BITS(p) (AS_UINT(p) >> ADDRESS_BITS)
+#else
+#define HIGH_BITS(p) 0
+#endif
+
+
+/* This is the leaf of the radix tree.  See arena_map_mark_used() for the
+ * meaning of these members. */
+typedef struct {
+    int32_t tail_hi;
+    int32_t tail_lo;
+} arena_coverage_t;
+
+typedef struct arena_map_bot {
+    /* The members tail_hi and tail_lo are accessed together.  So, it
+     * better to have them as an array of structs, rather than two
+     * arrays.
+     */
+    arena_coverage_t arenas[MAP_BOT_LENGTH];
+} arena_map_bot_t;
+
+#ifdef USE_INTERIOR_NODES
+typedef struct arena_map_mid {
+    struct arena_map_bot *ptrs[MAP_MID_LENGTH];
+} arena_map_mid_t;
+
+typedef struct arena_map_top {
+    struct arena_map_mid *ptrs[MAP_TOP_LENGTH];
+} arena_map_top_t;
+#endif
+
+/* The root of radix tree.  Note that by initializing like this, the memory
+ * should be in the BSS.  The OS will only memory map pages as the MAP_MID
+ * nodes get used (OS pages are demand loaded as needed).
+ */
+#ifdef USE_INTERIOR_NODES
+static arena_map_top_t arena_map_root;
+/* accounting for number of used interior nodes */
+static int arena_map_mid_count;
+static int arena_map_bot_count;
+#else
+static arena_map_bot_t arena_map_root;
+#endif
+
+/* Return a pointer to a bottom tree node, return NULL if it doesn't exist or
+ * it cannot be created */
+static arena_map_bot_t *
+arena_map_get(block *p, int create)
+{
+#ifdef USE_INTERIOR_NODES
+    /* sanity check that ADDRESS_BITS is correct */
+    assert(HIGH_BITS(p) == HIGH_BITS(&arena_map_root));
+    int i1 = MAP_TOP_INDEX(p);
+    if (arena_map_root.ptrs[i1] == NULL) {
+        if (!create) {
+            return NULL;
+        }
+        arena_map_mid_t *n = PyMem_RawCalloc(1, sizeof(arena_map_mid_t));
+        if (n == NULL) {
+            return NULL;
+        }
+        arena_map_root.ptrs[i1] = n;
+        arena_map_mid_count++;
+    }
+    int i2 = MAP_MID_INDEX(p);
+    if (arena_map_root.ptrs[i1]->ptrs[i2] == NULL) {
+        if (!create) {
+            return NULL;
+        }
+        arena_map_bot_t *n = PyMem_RawCalloc(1, sizeof(arena_map_bot_t));
+        if (n == NULL) {
+            return NULL;
+        }
+        arena_map_root.ptrs[i1]->ptrs[i2] = n;
+        arena_map_bot_count++;
+    }
+    return arena_map_root.ptrs[i1]->ptrs[i2];
+#else
+    return &arena_map_root;
+#endif
+}
+
+
+/* The radix tree only tracks arenas.  So, for 16 MiB arenas, we throw
+ * away 24 bits of the address.  That reduces the space requirement of
+ * the tree compared to similar radix tree page-map schemes.  In
+ * exchange for slashing the space requirement, it needs more
+ * computation to check an address.
+ *
+ * Tracking coverage is done by "ideal" arena address.  It is easier to
+ * explain in decimal so let's say that the arena size is 100 bytes.
+ * Then, ideal addresses are 100, 200, 300, etc.  For checking if a
+ * pointer address is inside an actual arena, we have to check two ideal
+ * arena addresses.  E.g. if pointer is 357, we need to check 200 and
+ * 300.  In the rare case that an arena is aligned in the ideal way
+ * (e.g. base address of arena is 200) then we only have to check one
+ * ideal address.
+ *
+ * The tree nodes for 200 and 300 both store the address of arena.
+ * There are two cases: the arena starts at a lower ideal arena and
+ * extends to this one, or the arena starts in this arena and extends to
+ * the next ideal arena.  The tail_lo and tail_hi members correspond to
+ * these two cases.
+ */
+
+
+/* mark or unmark addresses covered by arena */
+static int
+arena_map_mark_used(uintptr_t arena_base, int is_used)
+{
+    /* sanity check that ADDRESS_BITS is correct */
+    assert(HIGH_BITS(arena_base) == HIGH_BITS(&arena_map_root));
+    arena_map_bot_t *n_hi = arena_map_get((block *)arena_base, is_used);
+    if (n_hi == NULL) {
+        assert(is_used); /* otherwise node should already exist */
+        return 0; /* failed to allocate space for node */
+    }
+    int i3 = MAP_BOT_INDEX((block *)arena_base);
+    int32_t tail = (int32_t)(arena_base & ARENA_SIZE_MASK);
+    if (tail == 0) {
+        /* is ideal arena address */
+        n_hi->arenas[i3].tail_hi = is_used ? -1 : 0;
+    }
+    else {
+        /* arena_base address is not ideal (aligned to arena size) and
+         * so it potentially covers two MAP_BOT nodes.  Get the MAP_BOT node
+         * for the next arena.  Note that it might be in different MAP_TOP
+         * and MAP_MID nodes as well so we need to call arena_map_get()
+         * again (do the full tree traversal).
+         */
+        n_hi->arenas[i3].tail_hi = is_used ? tail : 0;
+        uintptr_t arena_base_next = arena_base + ARENA_SIZE;
+        /* If arena_base is a legit arena address, so is arena_base_next - 1
+         * (last address in arena).  If arena_base_next overflows then it
+         * must overflow to 0.  However, that would mean arena_base was
+         * "ideal" and we should not be in this case. */
+        assert(arena_base < arena_base_next);
+        arena_map_bot_t *n_lo = arena_map_get((block *)arena_base_next, is_used);
+        if (n_lo == NULL) {
+            assert(is_used); /* otherwise should already exist */
+            n_hi->arenas[i3].tail_hi = 0;
+            return 0; /* failed to allocate space for node */
+        }
+        int i3_next = MAP_BOT_INDEX(arena_base_next);
+        n_lo->arenas[i3_next].tail_lo = is_used ? tail : 0;
+    }
+    return 1;
+}
+
+/* Return true if 'p' is a pointer inside an obmalloc arena.
+ * _PyObject_Free() calls this so it needs to be very fast. */
+static int
+arena_map_is_used(block *p)
+{
+    arena_map_bot_t *n = arena_map_get(p, 0);
+    if (n == NULL) {
+        return 0;
+    }
+    int i3 = MAP_BOT_INDEX(p);
+    /* ARENA_BITS must be < 32 so that the tail is a non-negative int32_t. */
+    int32_t hi = n->arenas[i3].tail_hi;
+    int32_t lo = n->arenas[i3].tail_lo;
+    int32_t tail = (int32_t)(AS_UINT(p) & ARENA_SIZE_MASK);
+    return (tail < lo) || (tail >= hi && hi != 0);
+}
+
+/* end of radix tree logic */
+/*==========================================================================*/
+#endif /* WITH_PYMALLOC_RADIX_TREE */
+
 
 /* Allocate a new arena.  If we run out of memory, return NULL.  Else
  * allocate a new arena, and return the address of an arena_object
@@ -1302,6 +1592,15 @@
     unused_arena_objects = arenaobj->nextarena;
     assert(arenaobj->address == 0);
     address = _PyObject_Arena.alloc(_PyObject_Arena.ctx, ARENA_SIZE);
+#if WITH_PYMALLOC_RADIX_TREE
+    if (address != NULL) {
+        if (!arena_map_mark_used((uintptr_t)address, 1)) {
+            /* marking arena in radix tree failed, abort */
+            _PyObject_Arena.free(_PyObject_Arena.ctx, address, ARENA_SIZE);
+            address = NULL;
+        }
+    }
+#endif
     if (address == NULL) {
         /* The allocation failed: return NULL after putting the
          * arenaobj back.
@@ -1332,6 +1631,17 @@
 }
 
 
+
+#if WITH_PYMALLOC_RADIX_TREE
+/* Return true if and only if P is an address that was allocated by
+   pymalloc.  When the radix tree is used, 'poolp' is unused.
+ */
+static bool
+address_in_range(void *p, poolp pool)
+{
+    return arena_map_is_used(p);
+}
+#else
 /*
 address_in_range(P, POOL)
 
@@ -1423,6 +1733,7 @@
         arenas[arenaindex].address != 0;
 }
 
+#endif /* !WITH_PYMALLOC_RADIX_TREE */
 
 /*==========================================================================*/
 
@@ -1768,6 +2079,11 @@
         ao->nextarena = unused_arena_objects;
         unused_arena_objects = ao;
 
+#if WITH_PYMALLOC_RADIX_TREE
+        /* mark arena region as not under control of obmalloc */
+        arena_map_mark_used(ao->address, 0);
+#endif
+
         /* Free the entire arena. */
         _PyObject_Arena.free(_PyObject_Arena.ctx,
                              (void *)ao->address, ARENA_SIZE);
@@ -2420,8 +2736,7 @@
     fprintf(stderr, " API '%c'\n", id);
 
     nbytes = read_size_t(q - 2*SST);
-    fprintf(stderr, "    %" PY_FORMAT_SIZE_T "u bytes originally "
-                    "requested\n", nbytes);
+    fprintf(stderr, "    %zu bytes originally requested\n", nbytes);
 
     /* In case this is nuts, check the leading pad bytes first. */
     fprintf(stderr, "    The %d pad bytes at p-%d are ", SST-1, SST-1);
@@ -2477,8 +2792,9 @@
 
 #ifdef PYMEM_DEBUG_SERIALNO
     size_t serial = read_size_t(tail + SST);
-    fprintf(stderr, "    The block was made by call #%" PY_FORMAT_SIZE_T
-                    "u to debug malloc/realloc.\n", serial);
+    fprintf(stderr,
+            "    The block was made by call #%zu to debug malloc/realloc.\n",
+            serial);
 #endif
 
     if (nbytes > 0) {
@@ -2553,7 +2869,7 @@
     char buf1[128];
     char buf2[128];
     PyOS_snprintf(buf1, sizeof(buf1),
-                  "%d %ss * %" PY_FORMAT_SIZE_T "d bytes each",
+                  "%d %ss * %zd bytes each",
                   num_blocks, block_name, sizeof_block);
     PyOS_snprintf(buf2, sizeof(buf2),
                   "%48s ", buf1);
@@ -2694,10 +3010,7 @@
             assert(b == 0 && f == 0);
             continue;
         }
-        fprintf(out, "%5u %6u "
-                        "%11" PY_FORMAT_SIZE_T "u "
-                        "%15" PY_FORMAT_SIZE_T "u "
-                        "%13" PY_FORMAT_SIZE_T "u\n",
+        fprintf(out, "%5u %6u %11zu %15zu %13zu\n",
                 i, size, p, b, f);
         allocated_bytes += b * size;
         available_bytes += f * size;
@@ -2716,12 +3029,13 @@
     (void)printone(out, "# arenas allocated current", narenas);
 
     PyOS_snprintf(buf, sizeof(buf),
-        "%" PY_FORMAT_SIZE_T "u arenas * %d bytes/arena",
-        narenas, ARENA_SIZE);
+                  "%zu arenas * %d bytes/arena",
+                  narenas, ARENA_SIZE);
     (void)printone(out, buf, narenas * ARENA_SIZE);
 
     fputc('\n', out);
 
+    /* Account for what all of those arena bytes are being used for. */
     total = printone(out, "# bytes in allocated blocks", allocated_bytes);
     total += printone(out, "# bytes in available blocks", available_bytes);
 
@@ -2733,6 +3047,25 @@
     total += printone(out, "# bytes lost to quantization", quantization);
     total += printone(out, "# bytes lost to arena alignment", arena_alignment);
     (void)printone(out, "Total", total);
+    assert(narenas * ARENA_SIZE == total);
+
+#if WITH_PYMALLOC_RADIX_TREE
+    fputs("\narena map counts\n", out);
+#ifdef USE_INTERIOR_NODES
+    (void)printone(out, "# arena map mid nodes", arena_map_mid_count);
+    (void)printone(out, "# arena map bot nodes", arena_map_bot_count);
+    fputc('\n', out);
+#endif
+    total = printone(out, "# bytes lost to arena map root", sizeof(arena_map_root));
+#ifdef USE_INTERIOR_NODES
+    total += printone(out, "# bytes lost to arena map mid",
+                      sizeof(arena_map_mid_t) * arena_map_mid_count);
+    total += printone(out, "# bytes lost to arena map bot",
+                      sizeof(arena_map_bot_t) * arena_map_bot_count);
+    (void)printone(out, "Total", total);
+#endif
+#endif
+
     return 1;
 }
 
diff --git a/Objects/odictobject.c b/Objects/odictobject.c
index d5bf499..c0ccb16 100644
--- a/Objects/odictobject.c
+++ b/Objects/odictobject.c
@@ -459,7 +459,7 @@
 - implement a fuller MutableMapping API in C?
 - move the MutableMapping implementation to abstract.c?
 - optimize mutablemapping_update
-- use PyObject_MALLOC (small object allocator) for odict nodes?
+- use PyObject_Malloc (small object allocator) for odict nodes?
 - support subclasses better (e.g. in odict_richcompare)
 
 */
@@ -567,14 +567,14 @@
         i = _odict_get_index_raw(od, _odictnode_KEY(node),
                                  _odictnode_HASH(node));
         if (i < 0) {
-            PyMem_FREE(fast_nodes);
+            PyMem_Free(fast_nodes);
             return -1;
         }
         fast_nodes[i] = node;
     }
 
     /* Replace the old fast nodes table. */
-    PyMem_FREE(od->od_fast_nodes);
+    PyMem_Free(od->od_fast_nodes);
     od->od_fast_nodes = fast_nodes;
     od->od_fast_nodes_size = size;
     od->od_resize_sentinel = ((PyDictObject *)od)->ma_keys;
@@ -683,7 +683,7 @@
     }
 
     /* must not be added yet */
-    node = (_ODictNode *)PyMem_MALLOC(sizeof(_ODictNode));
+    node = (_ODictNode *)PyMem_Malloc(sizeof(_ODictNode));
     if (node == NULL) {
         Py_DECREF(key);
         PyErr_NoMemory();
@@ -701,7 +701,7 @@
 #define _odictnode_DEALLOC(node) \
     do { \
         Py_DECREF(_odictnode_KEY(node)); \
-        PyMem_FREE((void *)node); \
+        PyMem_Free((void *)node); \
     } while (0)
 
 /* Repeated calls on the same node are no-ops. */
@@ -776,7 +776,7 @@
 {
     _ODictNode *node, *next;
 
-    PyMem_FREE(od->od_fast_nodes);
+    PyMem_Free(od->od_fast_nodes);
     od->od_fast_nodes = NULL;
     od->od_fast_nodes_size = 0;
     od->od_resize_sentinel = NULL;
@@ -1045,30 +1045,28 @@
 
 /* pop() */
 
-PyDoc_STRVAR(odict_pop__doc__,
-"od.pop(k[,d]) -> v, remove specified key and return the corresponding\n\
-        value.  If key is not found, d is returned if given, otherwise KeyError\n\
-        is raised.\n\
-\n\
-        ");
-
 /* forward */
 static PyObject * _odict_popkey(PyObject *, PyObject *, PyObject *);
 
 /* Skips __missing__() calls. */
+/*[clinic input]
+OrderedDict.pop
+
+    key: object
+    default: object = NULL
+
+od.pop(key[,default]) -> v, remove specified key and return the corresponding value.
+
+If the key is not found, return the default if given; otherwise,
+raise a KeyError.
+[clinic start generated code]*/
+
 static PyObject *
-odict_pop(PyObject *od, PyObject *args, PyObject *kwargs)
+OrderedDict_pop_impl(PyODictObject *self, PyObject *key,
+                     PyObject *default_value)
+/*[clinic end generated code: output=7a6447d104e7494b input=7efe36601007dff7]*/
 {
-    static char *kwlist[] = {"key", "default", 0};
-    PyObject *key, *failobj = NULL;
-
-    /* borrowed */
-    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O:pop", kwlist,
-                                     &key, &failobj)) {
-        return NULL;
-    }
-
-    return _odict_popkey(od, key, failobj);
+    return _odict_popkey((PyObject *)self, key, default_value);
 }
 
 static PyObject *
@@ -1290,6 +1288,7 @@
 #define _odict_ITER_REVERSED 1
 #define _odict_ITER_KEYS 2
 #define _odict_ITER_VALUES 4
+#define _odict_ITER_ITEMS (_odict_ITER_KEYS|_odict_ITER_VALUES)
 
 /* forward */
 static PyObject * odictiter_new(PyODictObject *, int);
@@ -1362,8 +1361,7 @@
     {"__reduce__",      (PyCFunction)odict_reduce,      METH_NOARGS,
      odict_reduce__doc__},
     ORDEREDDICT_SETDEFAULT_METHODDEF
-    {"pop",             (PyCFunction)(void(*)(void))odict_pop,
-     METH_VARARGS | METH_KEYWORDS, odict_pop__doc__},
+    ORDEREDDICT_POP_METHODDEF
     ORDEREDDICT_POPITEM_METHODDEF
     {"keys",            odictkeys_new,                  METH_NOARGS,
      odict_keys__doc__},
@@ -1708,7 +1706,7 @@
     _PyObject_GC_UNTRACK(di);
     Py_XDECREF(di->di_odict);
     Py_XDECREF(di->di_current);
-    if (di->kind & (_odict_ITER_KEYS | _odict_ITER_VALUES)) {
+    if ((di->kind & _odict_ITER_ITEMS) == _odict_ITER_ITEMS) {
         Py_DECREF(di->di_result);
     }
     PyObject_GC_Del(di);
@@ -1817,6 +1815,11 @@
         Py_INCREF(result);
         Py_DECREF(PyTuple_GET_ITEM(result, 0));  /* borrowed */
         Py_DECREF(PyTuple_GET_ITEM(result, 1));  /* borrowed */
+        // bpo-42536: The GC may have untracked this result tuple. Since we're
+        // recycling it, make sure it's tracked again:
+        if (!_PyObject_GC_IS_TRACKED(result)) {
+            _PyObject_GC_TRACK(result);
+        }
     }
     else {
         result = PyTuple_New(2);
@@ -1909,15 +1912,16 @@
     if (di == NULL)
         return NULL;
 
-    if (kind & (_odict_ITER_KEYS | _odict_ITER_VALUES)){
+    if ((kind & _odict_ITER_ITEMS) == _odict_ITER_ITEMS) {
         di->di_result = PyTuple_Pack(2, Py_None, Py_None);
         if (di->di_result == NULL) {
             Py_DECREF(di);
             return NULL;
         }
     }
-    else
+    else {
         di->di_result = NULL;
+    }
 
     di->kind = kind;
     node = reversed ? _odict_LAST(od) : _odict_FIRST(od);
diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c
index 751dbb9..a848d67 100644
--- a/Objects/rangeobject.c
+++ b/Objects/rangeobject.c
@@ -1,8 +1,9 @@
 /* Range object implementation */
 
 #include "Python.h"
-#include "pycore_abstract.h"   // _PyIndex_Check()
-#include "pycore_tupleobject.h"
+#include "pycore_abstract.h"      // _PyIndex_Check()
+#include "pycore_long.h"          // _PyLong_GetZero()
+#include "pycore_tuple.h"         // _PyTuple_ITEMS()
 #include "structmember.h"         // PyMemberDef
 
 /* Support objects whose length is > PY_SSIZE_T_MAX.
@@ -105,10 +106,10 @@
             if (!stop) {
                 return NULL;
             }
-            Py_INCREF(_PyLong_Zero);
-            start = _PyLong_Zero;
-            Py_INCREF(_PyLong_One);
-            step = _PyLong_One;
+            start = _PyLong_GetZero();
+            Py_INCREF(start);
+            step = _PyLong_GetOne();
+            Py_INCREF(step);
             break;
         case 0:
             PyErr_SetString(PyExc_TypeError,
@@ -170,7 +171,7 @@
     Py_DECREF(r->stop);
     Py_DECREF(r->step);
     Py_DECREF(r->length);
-    PyObject_Del(r);
+    PyObject_Free(r);
 }
 
 /* Return number of items in range (lo, hi, step) as a PyLong object,
@@ -190,7 +191,10 @@
     PyObject *tmp1 = NULL, *tmp2 = NULL, *result;
                 /* holds sub-expression evaluations */
 
-    cmp_result = PyObject_RichCompareBool(step, _PyLong_Zero, Py_GT);
+    PyObject *zero = _PyLong_GetZero();  // borrowed reference
+    PyObject *one = _PyLong_GetOne();  // borrowed reference
+
+    cmp_result = PyObject_RichCompareBool(step, zero, Py_GT);
     if (cmp_result == -1)
         return NULL;
 
@@ -212,19 +216,21 @@
         Py_DECREF(step);
         if (cmp_result < 0)
             return NULL;
-        return PyLong_FromLong(0);
+        result = zero;
+        Py_INCREF(result);
+        return result;
     }
 
     if ((tmp1 = PyNumber_Subtract(hi, lo)) == NULL)
         goto Fail;
 
-    if ((diff = PyNumber_Subtract(tmp1, _PyLong_One)) == NULL)
+    if ((diff = PyNumber_Subtract(tmp1, one)) == NULL)
         goto Fail;
 
     if ((tmp2 = PyNumber_FloorDivide(diff, step)) == NULL)
         goto Fail;
 
-    if ((result = PyNumber_Add(tmp2, _PyLong_One)) == NULL)
+    if ((result = PyNumber_Add(tmp2, one)) == NULL)
         goto Fail;
 
     Py_DECREF(tmp2);
@@ -254,17 +260,24 @@
     /* PyLong equivalent to:
      *    return r->start + (i * r->step)
      */
-    incr = PyNumber_Multiply(i, r->step);
-    if (!incr)
-        return NULL;
-    result = PyNumber_Add(r->start, incr);
-    Py_DECREF(incr);
+    if (r->step == _PyLong_GetOne()) {
+        result = PyNumber_Add(r->start, i);
+    }
+    else {
+        incr = PyNumber_Multiply(i, r->step);
+        if (!incr) {
+            return NULL;
+        }
+        result = PyNumber_Add(r->start, incr);
+        Py_DECREF(incr);
+    }
     return result;
 }
 
 static PyObject *
 compute_range_item(rangeobject *r, PyObject *arg)
 {
+    PyObject *zero = _PyLong_GetZero();  // borrowed reference
     int cmp_result;
     PyObject *i, *result;
 
@@ -275,7 +288,7 @@
      *     i = arg
      *   }
      */
-    cmp_result = PyObject_RichCompareBool(arg, _PyLong_Zero, Py_LT);
+    cmp_result = PyObject_RichCompareBool(arg, zero, Py_LT);
     if (cmp_result == -1) {
         return NULL;
     }
@@ -294,7 +307,7 @@
      *     <report index out of bounds>
      *   }
      */
-    cmp_result = PyObject_RichCompareBool(i, _PyLong_Zero, Py_LT);
+    cmp_result = PyObject_RichCompareBool(i, zero, Py_LT);
     if (cmp_result == 0) {
         cmp_result = PyObject_RichCompareBool(i, r->length, Py_GE);
     }
@@ -369,6 +382,7 @@
 static int
 range_contains_long(rangeobject *r, PyObject *ob)
 {
+    PyObject *zero = _PyLong_GetZero();  // borrowed reference
     int cmp1, cmp2, cmp3;
     PyObject *tmp1 = NULL;
     PyObject *tmp2 = NULL;
@@ -376,7 +390,7 @@
 
     /* Check if the value can possibly be in the range. */
 
-    cmp1 = PyObject_RichCompareBool(r->step, _PyLong_Zero, Py_GT);
+    cmp1 = PyObject_RichCompareBool(r->step, zero, Py_GT);
     if (cmp1 == -1)
         goto end;
     if (cmp1 == 1) { /* positive steps: start <= ob < stop */
@@ -403,7 +417,7 @@
     if (tmp2 == NULL)
         goto end;
     /* result = ((int(ob) - start) % step) == 0 */
-    result = PyObject_RichCompareBool(tmp2, _PyLong_Zero, Py_EQ);
+    result = PyObject_RichCompareBool(tmp2, zero, Py_EQ);
   end:
     Py_XDECREF(tmp1);
     Py_XDECREF(tmp2);
@@ -454,7 +468,7 @@
     /* Return False or error to the caller. */
     if (cmp_result != 1)
         return cmp_result;
-    cmp_result = PyObject_RichCompareBool(r0->length, _PyLong_One, Py_EQ);
+    cmp_result = PyObject_RichCompareBool(r0->length, _PyLong_GetOne(), Py_EQ);
     /* Return True or error to the caller. */
     if (cmp_result != 0)
         return cmp_result;
@@ -523,7 +537,7 @@
     else {
         Py_INCREF(r->start);
         PyTuple_SET_ITEM(t, 1, r->start);
-        cmp_result = PyObject_RichCompareBool(r->length, _PyLong_One, Py_EQ);
+        cmp_result = PyObject_RichCompareBool(r->length, _PyLong_GetOne(), Py_EQ);
         if (cmp_result == -1)
             goto end;
         if (cmp_result == 1) {
@@ -576,13 +590,19 @@
         return NULL;
 
     if (contains) {
-        PyObject *idx, *tmp = PyNumber_Subtract(ob, r->start);
-        if (tmp == NULL)
+        PyObject *idx = PyNumber_Subtract(ob, r->start);
+        if (idx == NULL) {
             return NULL;
+        }
+
+        if (r->step == _PyLong_GetOne()) {
+            return idx;
+        }
+
         /* idx = (ob - r.start) // r.step */
-        idx = PyNumber_FloorDivide(tmp, r->step);
-        Py_DECREF(tmp);
-        return idx;
+        PyObject *sidx = PyNumber_FloorDivide(idx, r->step);
+        Py_DECREF(idx);
+        return sidx;
     }
 
     /* object is not in the range */
@@ -715,7 +735,7 @@
         PyObject_GenericGetAttr,  /* tp_getattro */
         0,                      /* tp_setattro */
         0,                      /* tp_as_buffer */
-        Py_TPFLAGS_DEFAULT,     /* tp_flags */
+        Py_TPFLAGS_DEFAULT | Py_TPFLAGS_SEQUENCE,  /* tp_flags */
         range_doc,              /* tp_doc */
         0,                      /* tp_traverse */
         0,                      /* tp_clear */
@@ -793,7 +813,7 @@
     if (range == NULL)
         goto err;
     /* return the result */
-    return Py_BuildValue("N(N)i", _PyEval_GetBuiltinId(&PyId_iter),
+    return Py_BuildValue("N(N)l", _PyEval_GetBuiltinId(&PyId_iter),
                          range, r->index);
 err:
     Py_XDECREF(start);
@@ -895,22 +915,14 @@
    is not representable as a C long, OverflowError is raised. */
 
 static PyObject *
-fast_range_iter(long start, long stop, long step)
+fast_range_iter(long start, long stop, long step, long len)
 {
     rangeiterobject *it = PyObject_New(rangeiterobject, &PyRangeIter_Type);
-    unsigned long ulen;
     if (it == NULL)
         return NULL;
     it->start = start;
     it->step = step;
-    ulen = get_len_of_range(start, stop, step);
-    if (ulen > (unsigned long)LONG_MAX) {
-        Py_DECREF(it);
-        PyErr_SetString(PyExc_OverflowError,
-                        "range too large to represent as a range_iterator");
-        return NULL;
-    }
-    it->len = (long)ulen;
+    it->len = len;
     it->index = 0;
     return (PyObject *)it;
 }
@@ -962,14 +974,15 @@
 static PyObject *
 longrangeiter_setstate(longrangeiterobject *r, PyObject *state)
 {
+    PyObject *zero = _PyLong_GetZero();  // borrowed reference
     int cmp;
 
     /* clip the value */
-    cmp = PyObject_RichCompareBool(state, _PyLong_Zero, Py_LT);
+    cmp = PyObject_RichCompareBool(state, zero, Py_LT);
     if (cmp < 0)
         return NULL;
     if (cmp > 0) {
-        state = _PyLong_Zero;
+        state = zero;
     }
     else {
         cmp = PyObject_RichCompareBool(r->len, state, Py_LT);
@@ -1000,7 +1013,7 @@
     Py_XDECREF(r->start);
     Py_XDECREF(r->step);
     Py_XDECREF(r->len);
-    PyObject_Del(r);
+    PyObject_Free(r);
 }
 
 static PyObject *
@@ -1010,7 +1023,7 @@
     if (PyObject_RichCompareBool(r->index, r->len, Py_LT) != 1)
         return NULL;
 
-    new_index = PyNumber_Add(r->index, _PyLong_One);
+    new_index = PyNumber_Add(r->index, _PyLong_GetOne());
     if (!new_index)
         return NULL;
 
@@ -1071,7 +1084,7 @@
     rangeobject *r = (rangeobject *)seq;
     longrangeiterobject *it;
     long lstart, lstop, lstep;
-    PyObject *int_it;
+    unsigned long ulen;
 
     assert(PyRange_Check(seq));
 
@@ -1092,12 +1105,22 @@
         PyErr_Clear();
         goto long_range;
     }
-    int_it = fast_range_iter(lstart, lstop, lstep);
-    if (int_it == NULL && PyErr_ExceptionMatches(PyExc_OverflowError)) {
-        PyErr_Clear();
+    ulen = get_len_of_range(lstart, lstop, lstep);
+    if (ulen > (unsigned long)LONG_MAX) {
         goto long_range;
     }
-    return (PyObject *)int_it;
+    /* check for potential overflow of lstart + ulen * lstep */
+    if (ulen) {
+        if (lstep > 0) {
+            if (lstop > LONG_MAX - (lstep - 1))
+                goto long_range;
+        }
+        else {
+            if (lstop < LONG_MIN + (-1 - lstep))
+                goto long_range;
+        }
+    }
+    return fast_range_iter(lstart, lstop, lstep, (long)ulen);
 
   long_range:
     it = PyObject_New(longrangeiterobject, &PyLongRangeIter_Type);
@@ -1107,7 +1130,7 @@
     it->start = r->start;
     it->step = r->step;
     it->len = r->length;
-    it->index = _PyLong_Zero;
+    it->index = _PyLong_GetZero();
     Py_INCREF(it->start);
     Py_INCREF(it->step);
     Py_INCREF(it->len);
@@ -1183,7 +1206,7 @@
 
     new_stop = lstart - lstep;
     new_start = (long)(new_stop + ulen * lstep);
-    return fast_range_iter(new_start, new_stop, -lstep);
+    return fast_range_iter(new_start, new_stop, -lstep, (long)ulen);
 
 long_range:
     it = PyObject_New(longrangeiterobject, &PyLongRangeIter_Type);
@@ -1195,7 +1218,7 @@
     it->len = range->length;
     Py_INCREF(it->len);
 
-    diff = PyNumber_Subtract(it->len, _PyLong_One);
+    diff = PyNumber_Subtract(it->len, _PyLong_GetOne());
     if (!diff)
         goto create_failure;
 
@@ -1214,7 +1237,7 @@
     if (!it->step)
         goto create_failure;
 
-    it->index = _PyLong_Zero;
+    it->index = _PyLong_GetZero();
     Py_INCREF(it->index);
     return (PyObject *)it;
 
diff --git a/Objects/setobject.c b/Objects/setobject.c
index 76b1944..e8ba32e 100644
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -16,7 +16,7 @@
    reduces the cost of hash collisions because consecutive memory accesses
    tend to be much cheaper than scattered probes.  After LINEAR_PROBES steps,
    we then use more of the upper bits from the hash value and apply a simple
-   linear congruential random number genearator.  This helps break-up long
+   linear congruential random number generator.  This helps break-up long
    chains of collisions.
 
    All arithmetic on hash should ignore overflow.
@@ -103,6 +103,7 @@
 set_add_entry(PySetObject *so, PyObject *key, Py_hash_t hash)
 {
     setentry *table;
+    setentry *freeslot;
     setentry *entry;
     size_t perturb;
     size_t mask;
@@ -118,6 +119,7 @@
 
     mask = so->mask;
     i = (size_t)hash & mask;
+    freeslot = NULL;
     perturb = hash;
 
     while (1) {
@@ -125,7 +127,7 @@
         probes = (i + LINEAR_PROBES <= mask) ? LINEAR_PROBES: 0;
         do {
             if (entry->hash == 0 && entry->key == NULL)
-                goto found_unused;
+                goto found_unused_or_dummy;
             if (entry->hash == hash) {
                 PyObject *startkey = entry->key;
                 assert(startkey != dummy);
@@ -147,12 +149,24 @@
                     goto restart;
                 mask = so->mask;
             }
+            else if (entry->hash == -1) {
+                assert (entry->key == dummy);
+                freeslot = entry;
+            }
             entry++;
         } while (probes--);
         perturb >>= PERTURB_SHIFT;
         i = (i * 5 + 1 + perturb) & mask;
     }
 
+  found_unused_or_dummy:
+    if (freeslot == NULL)
+        goto found_unused;
+    so->used++;
+    freeslot->key = key;
+    freeslot->hash = hash;
+    return 0;
+
   found_unused:
     so->fill++;
     so->used++;
@@ -289,7 +303,7 @@
     }
 
     if (is_oldtable_malloced)
-        PyMem_DEL(oldtable);
+        PyMem_Free(oldtable);
     return 0;
 }
 
@@ -424,7 +438,7 @@
     }
 
     if (table_is_malloced)
-        PyMem_DEL(table);
+        PyMem_Free(table);
     return 0;
 }
 
@@ -484,7 +498,7 @@
         }
     }
     if (so->table != so->smalltable)
-        PyMem_DEL(so->table);
+        PyMem_Free(so->table);
     Py_TYPE(so)->tp_free(so);
     Py_TRASHCAN_END
 }
@@ -522,7 +536,7 @@
         goto done;
     listrepr = tmp;
 
-    if (!Py_IS_TYPE(so, &PySet_Type))
+    if (!PySet_CheckExact(so))
         result = PyUnicode_FromFormat("%s({%U})",
                                       Py_TYPE(so)->tp_name,
                                       listrepr);
@@ -975,9 +989,6 @@
     return make_new_set(type, iterable);
 }
 
-/* The empty frozenset is a singleton */
-static PyObject *emptyfrozenset = NULL;
-
 static PyObject *
 make_new_frozenset(PyTypeObject *type, PyObject *iterable)
 {
@@ -985,26 +996,12 @@
         return make_new_set(type, iterable);
     }
 
-    if (iterable != NULL) {
-        if (PyFrozenSet_CheckExact(iterable)) {
-            /* frozenset(f) is idempotent */
-            Py_INCREF(iterable);
-            return iterable;
-        }
-        PyObject *res = make_new_set((PyTypeObject *)type, iterable);
-        if (res == NULL || PySet_GET_SIZE(res) != 0) {
-            return res;
-        }
-        /* If the created frozenset is empty, return the empty frozenset singleton instead */
-        Py_DECREF(res);
+    if (iterable != NULL && PyFrozenSet_CheckExact(iterable)) {
+        /* frozenset(f) is idempotent */
+        Py_INCREF(iterable);
+        return iterable;
     }
-
-    // The empty frozenset is a singleton
-    if (emptyfrozenset == NULL) {
-        emptyfrozenset = make_new_set((PyTypeObject *)type, NULL);
-    }
-    Py_XINCREF(emptyfrozenset);
-    return emptyfrozenset;
+    return make_new_set((PyTypeObject *)type, iterable);
 }
 
 static PyObject *
@@ -1207,17 +1204,21 @@
         while (set_next((PySetObject *)other, &pos, &entry)) {
             key = entry->key;
             hash = entry->hash;
+            Py_INCREF(key);
             rv = set_contains_entry(so, key, hash);
             if (rv < 0) {
                 Py_DECREF(result);
+                Py_DECREF(key);
                 return NULL;
             }
             if (rv) {
                 if (set_add_entry(result, key, hash)) {
                     Py_DECREF(result);
+                    Py_DECREF(key);
                     return NULL;
                 }
             }
+            Py_DECREF(key);
         }
         return (PyObject *)result;
     }
@@ -1357,11 +1358,16 @@
             other = tmp;
         }
         while (set_next((PySetObject *)other, &pos, &entry)) {
-            rv = set_contains_entry(so, entry->key, entry->hash);
-            if (rv < 0)
+            PyObject *key = entry->key;
+            Py_INCREF(key);
+            rv = set_contains_entry(so, key, entry->hash);
+            Py_DECREF(key);
+            if (rv < 0) {
                 return NULL;
-            if (rv)
+            }
+            if (rv) {
                 Py_RETURN_FALSE;
+            }
         }
         Py_RETURN_TRUE;
     }
@@ -1410,7 +1416,7 @@
 
         /* Optimization:  When the other set is more than 8 times
            larger than the base set, replace the other set with
-           interesection of the two sets.
+           intersection of the two sets.
         */
         if ((PySet_GET_SIZE(other) >> 3) > PySet_GET_SIZE(so)) {
             other = set_intersection(so, other);
@@ -1420,11 +1426,16 @@
             Py_INCREF(other);
         }
 
-        while (set_next((PySetObject *)other, &pos, &entry))
-            if (set_discard_entry(so, entry->key, entry->hash) < 0) {
+        while (set_next((PySetObject *)other, &pos, &entry)) {
+            PyObject *key = entry->key;
+            Py_INCREF(key);
+            if (set_discard_entry(so, key, entry->hash) < 0) {
                 Py_DECREF(other);
+                Py_DECREF(key);
                 return -1;
             }
+            Py_DECREF(key);
+        }
 
         Py_DECREF(other);
     } else {
@@ -1515,17 +1526,21 @@
         while (set_next(so, &pos, &entry)) {
             key = entry->key;
             hash = entry->hash;
-            rv = _PyDict_Contains(other, key, hash);
+            Py_INCREF(key);
+            rv = _PyDict_Contains_KnownHash(other, key, hash);
             if (rv < 0) {
                 Py_DECREF(result);
+                Py_DECREF(key);
                 return NULL;
             }
             if (!rv) {
                 if (set_add_entry((PySetObject *)result, key, hash)) {
                     Py_DECREF(result);
+                    Py_DECREF(key);
                     return NULL;
                 }
             }
+            Py_DECREF(key);
         }
         return result;
     }
@@ -1534,17 +1549,21 @@
     while (set_next(so, &pos, &entry)) {
         key = entry->key;
         hash = entry->hash;
+        Py_INCREF(key);
         rv = set_contains_entry((PySetObject *)other, key, hash);
         if (rv < 0) {
             Py_DECREF(result);
+            Py_DECREF(key);
             return NULL;
         }
         if (!rv) {
             if (set_add_entry((PySetObject *)result, key, hash)) {
                 Py_DECREF(result);
+                Py_DECREF(key);
                 return NULL;
             }
         }
+        Py_DECREF(key);
     }
     return result;
 }
@@ -1641,17 +1660,21 @@
     while (set_next(otherset, &pos, &entry)) {
         key = entry->key;
         hash = entry->hash;
+        Py_INCREF(key);
         rv = set_discard_entry(so, key, hash);
         if (rv < 0) {
             Py_DECREF(otherset);
+            Py_DECREF(key);
             return NULL;
         }
         if (rv == DISCARD_NOTFOUND) {
             if (set_add_entry(so, key, hash)) {
                 Py_DECREF(otherset);
+                Py_DECREF(key);
                 return NULL;
             }
         }
+        Py_DECREF(key);
     }
     Py_DECREF(otherset);
     Py_RETURN_NONE;
@@ -1726,11 +1749,16 @@
         Py_RETURN_FALSE;
 
     while (set_next(so, &pos, &entry)) {
-        rv = set_contains_entry((PySetObject *)other, entry->key, entry->hash);
-        if (rv < 0)
+        PyObject *key = entry->key;
+        Py_INCREF(key);
+        rv = set_contains_entry((PySetObject *)other, key, entry->hash);
+        Py_DECREF(key);
+        if (rv < 0) {
             return NULL;
-        if (!rv)
+        }
+        if (!rv) {
             Py_RETURN_FALSE;
+        }
     }
     Py_RETURN_TRUE;
 }
@@ -2110,7 +2138,8 @@
     0,                                  /* tp_setattro */
     0,                                  /* tp_as_buffer */
     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
-        Py_TPFLAGS_BASETYPE,            /* tp_flags */
+        Py_TPFLAGS_BASETYPE |
+        _Py_TPFLAGS_MATCH_SELF,       /* tp_flags */
     set_doc,                            /* tp_doc */
     (traverseproc)set_traverse,         /* tp_traverse */
     (inquiry)set_clear_internal,        /* tp_clear */
@@ -2210,7 +2239,8 @@
     0,                                  /* tp_setattro */
     0,                                  /* tp_as_buffer */
     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
-        Py_TPFLAGS_BASETYPE,            /* tp_flags */
+        Py_TPFLAGS_BASETYPE |
+        _Py_TPFLAGS_MATCH_SELF,       /* tp_flags */
     frozenset_doc,                      /* tp_doc */
     (traverseproc)set_traverse,         /* tp_traverse */
     (inquiry)set_clear_internal,        /* tp_clear */
@@ -2299,12 +2329,6 @@
     return set_add_key((PySetObject *)anyset, key);
 }
 
-void
-_PySet_Fini(void)
-{
-    Py_CLEAR(emptyfrozenset);
-}
-
 int
 _PySet_NextEntry(PyObject *set, Py_ssize_t *pos, PyObject **key, Py_hash_t *hash)
 {
@@ -2527,4 +2551,3 @@
   _PyObject_EXTRA_INIT
   2, &_PySetDummy_Type
 };
-
diff --git a/Objects/sliceobject.c b/Objects/sliceobject.c
index 391711f..22fb7c6 100644
--- a/Objects/sliceobject.c
+++ b/Objects/sliceobject.c
@@ -15,7 +15,8 @@
 
 #include "Python.h"
 #include "pycore_abstract.h"      // _PyIndex_Check()
-#include "pycore_object.h"
+#include "pycore_long.h"          // _PyLong_GetZero()
+#include "pycore_object.h"        // _PyObject_GC_TRACK()
 #include "structmember.h"         // PyMemberDef
 
 static PyObject *
@@ -95,16 +96,12 @@
 
 /* Slice object implementation */
 
-/* Using a cache is very effective since typically only a single slice is
- * created and then deleted again
- */
-static PySliceObject *slice_cache = NULL;
 
-void _PySlice_Fini(void)
+void _PySlice_Fini(PyInterpreterState *interp)
 {
-    PySliceObject *obj = slice_cache;
+    PySliceObject *obj = interp->slice_cache;
     if (obj != NULL) {
-        slice_cache = NULL;
+        interp->slice_cache = NULL;
         PyObject_GC_Del(obj);
     }
 }
@@ -116,26 +113,35 @@
 PyObject *
 PySlice_New(PyObject *start, PyObject *stop, PyObject *step)
 {
-    PySliceObject *obj;
-    if (slice_cache != NULL) {
-        obj = slice_cache;
-        slice_cache = NULL;
-        _Py_NewReference((PyObject *)obj);
-    } else {
-        obj = PyObject_GC_New(PySliceObject, &PySlice_Type);
-        if (obj == NULL)
-            return NULL;
+    if (step == NULL) {
+        step = Py_None;
+    }
+    if (start == NULL) {
+        start = Py_None;
+    }
+    if (stop == NULL) {
+        stop = Py_None;
     }
 
-    if (step == NULL) step = Py_None;
-    Py_INCREF(step);
-    if (start == NULL) start = Py_None;
-    Py_INCREF(start);
-    if (stop == NULL) stop = Py_None;
-    Py_INCREF(stop);
+    PyInterpreterState *interp = _PyInterpreterState_GET();
+    PySliceObject *obj;
+    if (interp->slice_cache != NULL) {
+        obj = interp->slice_cache;
+        interp->slice_cache = NULL;
+        _Py_NewReference((PyObject *)obj);
+    }
+    else {
+        obj = PyObject_GC_New(PySliceObject, &PySlice_Type);
+        if (obj == NULL) {
+            return NULL;
+        }
+    }
 
+    Py_INCREF(step);
     obj->step = step;
+    Py_INCREF(start);
     obj->start = start;
+    Py_INCREF(stop);
     obj->stop = stop;
 
     _PyObject_GC_TRACK(obj);
@@ -324,14 +330,17 @@
 static void
 slice_dealloc(PySliceObject *r)
 {
+    PyInterpreterState *interp = _PyInterpreterState_GET();
     _PyObject_GC_UNTRACK(r);
     Py_DECREF(r->step);
     Py_DECREF(r->start);
     Py_DECREF(r->stop);
-    if (slice_cache == NULL)
-        slice_cache = r;
-    else
+    if (interp->slice_cache == NULL) {
+        interp->slice_cache = r;
+    }
+    else {
         PyObject_GC_Del(r);
+    }
 }
 
 static PyObject *
@@ -379,7 +388,7 @@
 
     /* Convert step to an integer; raise for zero step. */
     if (self->step == Py_None) {
-        step = _PyLong_One;
+        step = _PyLong_GetOne();
         Py_INCREF(step);
         step_is_negative = 0;
     }
@@ -408,7 +417,7 @@
             goto error;
     }
     else {
-        lower = _PyLong_Zero;
+        lower = _PyLong_GetZero();
         Py_INCREF(lower);
         upper = length;
         Py_INCREF(upper);
diff --git a/Objects/stringlib/README.txt b/Objects/stringlib/README.txt
index 8ff6ad8..e1e3292 100644
--- a/Objects/stringlib/README.txt
+++ b/Objects/stringlib/README.txt
@@ -11,10 +11,10 @@
 
     the type used to hold a character (char or Py_UNICODE)
 
-STRINGLIB_EMPTY
+STRINGLIB_GET_EMPTY()
 
-    a PyObject representing the empty string, only to be used if
-    STRINGLIB_MUTABLE is 0
+    returns a PyObject representing the empty string, only to be used if
+    STRINGLIB_MUTABLE is 0. It must not be NULL.
 
 Py_ssize_t STRINGLIB_LEN(PyObject*)
 
diff --git a/Objects/stringlib/asciilib.h b/Objects/stringlib/asciilib.h
index e69a2c0..7749e8f 100644
--- a/Objects/stringlib/asciilib.h
+++ b/Objects/stringlib/asciilib.h
@@ -11,7 +11,6 @@
 #define STRINGLIB_CHAR           Py_UCS1
 #define STRINGLIB_TYPE_NAME      "unicode"
 #define STRINGLIB_PARSE_CODE     "U"
-#define STRINGLIB_EMPTY          unicode_empty
 #define STRINGLIB_ISSPACE        Py_UNICODE_ISSPACE
 #define STRINGLIB_ISLINEBREAK    BLOOM_LINEBREAK
 #define STRINGLIB_ISDECIMAL      Py_UNICODE_ISDECIMAL
diff --git a/Objects/stringlib/clinic/transmogrify.h.h b/Objects/stringlib/clinic/transmogrify.h.h
index 8a3a060..a5135a0 100644
--- a/Objects/stringlib/clinic/transmogrify.h.h
+++ b/Objects/stringlib/clinic/transmogrify.h.h
@@ -33,11 +33,6 @@
     if (!noptargs) {
         goto skip_optional_pos;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     tabsize = _PyLong_AsInt(args[0]);
     if (tabsize == -1 && PyErr_Occurred()) {
         goto exit;
@@ -73,14 +68,9 @@
     if (!_PyArg_CheckPositional("ljust", nargs, 1, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[0]);
+        PyObject *iobj = _PyNumber_Index(args[0]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -134,14 +124,9 @@
     if (!_PyArg_CheckPositional("rjust", nargs, 1, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[0]);
+        PyObject *iobj = _PyNumber_Index(args[0]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -195,14 +180,9 @@
     if (!_PyArg_CheckPositional("center", nargs, 1, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(args[0]);
+        PyObject *iobj = _PyNumber_Index(args[0]);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -252,14 +232,9 @@
     PyObject *return_value = NULL;
     Py_ssize_t width;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     {
         Py_ssize_t ival = -1;
-        PyObject *iobj = PyNumber_Index(arg);
+        PyObject *iobj = _PyNumber_Index(arg);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -274,4 +249,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=15be047aef999b4e input=a9049054013a1b77]*/
+/*[clinic end generated code: output=2d9abc7b1cffeca6 input=a9049054013a1b77]*/
diff --git a/Objects/stringlib/codecs.h b/Objects/stringlib/codecs.h
index 9b2a29b..b17cda1 100644
--- a/Objects/stringlib/codecs.h
+++ b/Objects/stringlib/codecs.h
@@ -4,16 +4,16 @@
 # error "codecs.h is specific to Unicode"
 #endif
 
-#include "pycore_byteswap.h"      // _Py_bswap32()
+#include "pycore_bitutils.h"      // _Py_bswap32()
 
-/* Mask to quickly check whether a C 'long' contains a
+/* Mask to quickly check whether a C 'size_t' contains a
    non-ASCII, UTF8-encoded char. */
-#if (SIZEOF_LONG == 8)
-# define ASCII_CHAR_MASK 0x8080808080808080UL
-#elif (SIZEOF_LONG == 4)
-# define ASCII_CHAR_MASK 0x80808080UL
+#if (SIZEOF_SIZE_T == 8)
+# define ASCII_CHAR_MASK 0x8080808080808080ULL
+#elif (SIZEOF_SIZE_T == 4)
+# define ASCII_CHAR_MASK 0x80808080U
 #else
-# error C 'long' size should be either 4 or 8!
+# error C 'size_t' size should be either 4 or 8!
 #endif
 
 /* 10xxxxxx */
@@ -26,7 +26,6 @@
 {
     Py_UCS4 ch;
     const char *s = *inptr;
-    const char *aligned_end = (const char *) _Py_ALIGN_DOWN(end, SIZEOF_LONG);
     STRINGLIB_CHAR *p = dest + *outpos;
 
     while (s < end) {
@@ -36,19 +35,19 @@
             /* Fast path for runs of ASCII characters. Given that common UTF-8
                input will consist of an overwhelming majority of ASCII
                characters, we try to optimize for this case by checking
-               as many characters as a C 'long' can contain.
+               as many characters as a C 'size_t' can contain.
                First, check if we can do an aligned read, as most CPUs have
                a penalty for unaligned reads.
             */
-            if (_Py_IS_ALIGNED(s, SIZEOF_LONG)) {
+            if (_Py_IS_ALIGNED(s, ALIGNOF_SIZE_T)) {
                 /* Help register allocation */
                 const char *_s = s;
                 STRINGLIB_CHAR *_p = p;
-                while (_s < aligned_end) {
-                    /* Read a whole long at a time (either 4 or 8 bytes),
+                while (_s + SIZEOF_SIZE_T <= end) {
+                    /* Read a whole size_t at a time (either 4 or 8 bytes),
                        and do a fast unrolled copy if it only contains ASCII
                        characters. */
-                    unsigned long value = *(const unsigned long *) _s;
+                    size_t value = *(const size_t *) _s;
                     if (value & ASCII_CHAR_MASK)
                         break;
 #if PY_LITTLE_ENDIAN
@@ -56,14 +55,14 @@
                     _p[1] = (STRINGLIB_CHAR)((value >> 8) & 0xFFu);
                     _p[2] = (STRINGLIB_CHAR)((value >> 16) & 0xFFu);
                     _p[3] = (STRINGLIB_CHAR)((value >> 24) & 0xFFu);
-# if SIZEOF_LONG == 8
+# if SIZEOF_SIZE_T == 8
                     _p[4] = (STRINGLIB_CHAR)((value >> 32) & 0xFFu);
                     _p[5] = (STRINGLIB_CHAR)((value >> 40) & 0xFFu);
                     _p[6] = (STRINGLIB_CHAR)((value >> 48) & 0xFFu);
                     _p[7] = (STRINGLIB_CHAR)((value >> 56) & 0xFFu);
 # endif
 #else
-# if SIZEOF_LONG == 8
+# if SIZEOF_SIZE_T == 8
                     _p[0] = (STRINGLIB_CHAR)((value >> 56) & 0xFFu);
                     _p[1] = (STRINGLIB_CHAR)((value >> 48) & 0xFFu);
                     _p[2] = (STRINGLIB_CHAR)((value >> 40) & 0xFFu);
@@ -79,8 +78,8 @@
                     _p[3] = (STRINGLIB_CHAR)(value & 0xFFu);
 # endif
 #endif
-                    _s += SIZEOF_LONG;
-                    _p += SIZEOF_LONG;
+                    _s += SIZEOF_SIZE_T;
+                    _p += SIZEOF_SIZE_T;
                 }
                 s = _s;
                 p = _p;
@@ -496,8 +495,6 @@
                         int native_ordering)
 {
     Py_UCS4 ch;
-    const unsigned char *aligned_end =
-            (const unsigned char *) _Py_ALIGN_DOWN(e, SIZEOF_LONG);
     const unsigned char *q = *inptr;
     STRINGLIB_CHAR *p = dest + *outpos;
     /* Offsets from q for retrieving byte pairs in the right order. */
@@ -512,10 +509,10 @@
         Py_UCS4 ch2;
         /* First check for possible aligned read of a C 'long'. Unaligned
            reads are more expensive, better to defer to another iteration. */
-        if (_Py_IS_ALIGNED(q, SIZEOF_LONG)) {
+        if (_Py_IS_ALIGNED(q, ALIGNOF_LONG)) {
             /* Fast path for runs of in-range non-surrogate chars. */
             const unsigned char *_q = q;
-            while (_q < aligned_end) {
+            while (_q + SIZEOF_LONG <= e) {
                 unsigned long block = * (const unsigned long *) _q;
                 if (native_ordering) {
                     /* Can use buffer directly */
diff --git a/Objects/stringlib/fastsearch.h b/Objects/stringlib/fastsearch.h
index 56a4467..6574720 100644
--- a/Objects/stringlib/fastsearch.h
+++ b/Objects/stringlib/fastsearch.h
@@ -9,10 +9,16 @@
 /* note: fastsearch may access s[n], which isn't a problem when using
    Python's ordinary string types, but may cause problems if you're
    using this code in other contexts.  also, the count mode returns -1
-   if there cannot possible be a match in the target string, and 0 if
+   if there cannot possibly be a match in the target string, and 0 if
    it has actually checked for matches, but didn't find any.  callers
    beware! */
 
+/* If the strings are long enough, use Crochemore and Perrin's Two-Way
+   algorithm, which has worst-case O(n) runtime and best-case O(n/k).
+   Also compute a table of shifts to achieve O(n/k) in more cases,
+   and often (data dependent) deduce larger shifts than pure C&P can
+   deduce. */
+
 #define FAST_COUNT 0
 #define FAST_SEARCH 1
 #define FAST_RSEARCH 2
@@ -160,6 +166,353 @@
 
 #undef MEMCHR_CUT_OFF
 
+/* Change to a 1 to see logging comments walk through the algorithm. */
+#if 0 && STRINGLIB_SIZEOF_CHAR == 1
+# define LOG(...) printf(__VA_ARGS__)
+# define LOG_STRING(s, n) printf("\"%.*s\"", n, s)
+#else
+# define LOG(...)
+# define LOG_STRING(s, n)
+#endif
+
+Py_LOCAL_INLINE(Py_ssize_t)
+STRINGLIB(_lex_search)(const STRINGLIB_CHAR *needle, Py_ssize_t len_needle,
+                       Py_ssize_t *return_period, int invert_alphabet)
+{
+    /* Do a lexicographic search. Essentially this:
+           >>> max(needle[i:] for i in range(len(needle)+1))
+       Also find the period of the right half.   */
+    Py_ssize_t max_suffix = 0;
+    Py_ssize_t candidate = 1;
+    Py_ssize_t k = 0;
+    // The period of the right half.
+    Py_ssize_t period = 1;
+
+    while (candidate + k < len_needle) {
+        // each loop increases candidate + k + max_suffix
+        STRINGLIB_CHAR a = needle[candidate + k];
+        STRINGLIB_CHAR b = needle[max_suffix + k];
+        // check if the suffix at candidate is better than max_suffix
+        if (invert_alphabet ? (b < a) : (a < b)) {
+            // Fell short of max_suffix.
+            // The next k + 1 characters are non-increasing
+            // from candidate, so they won't start a maximal suffix.
+            candidate += k + 1;
+            k = 0;
+            // We've ruled out any period smaller than what's
+            // been scanned since max_suffix.
+            period = candidate - max_suffix;
+        }
+        else if (a == b) {
+            if (k + 1 != period) {
+                // Keep scanning the equal strings
+                k++;
+            }
+            else {
+                // Matched a whole period.
+                // Start matching the next period.
+                candidate += period;
+                k = 0;
+            }
+        }
+        else {
+            // Did better than max_suffix, so replace it.
+            max_suffix = candidate;
+            candidate++;
+            k = 0;
+            period = 1;
+        }
+    }
+    *return_period = period;
+    return max_suffix;
+}
+
+Py_LOCAL_INLINE(Py_ssize_t)
+STRINGLIB(_factorize)(const STRINGLIB_CHAR *needle,
+                      Py_ssize_t len_needle,
+                      Py_ssize_t *return_period)
+{
+    /* Do a "critical factorization", making it so that:
+       >>> needle = (left := needle[:cut]) + (right := needle[cut:])
+       where the "local period" of the cut is maximal.
+
+       The local period of the cut is the minimal length of a string w
+       such that (left endswith w or w endswith left)
+       and (right startswith w or w startswith left).
+
+       The Critical Factorization Theorem says that this maximal local
+       period is the global period of the string.
+
+       Crochemore and Perrin (1991) show that this cut can be computed
+       as the later of two cuts: one that gives a lexicographically
+       maximal right half, and one that gives the same with the
+       with respect to a reversed alphabet-ordering.
+
+       This is what we want to happen:
+           >>> x = "GCAGAGAG"
+           >>> cut, period = factorize(x)
+           >>> x[:cut], (right := x[cut:])
+           ('GC', 'AGAGAG')
+           >>> period  # right half period
+           2
+           >>> right[period:] == right[:-period]
+           True
+
+       This is how the local period lines up in the above example:
+                GC | AGAGAG
+           AGAGAGC = AGAGAGC
+       The length of this minimal repetition is 7, which is indeed the
+       period of the original string. */
+
+    Py_ssize_t cut1, period1, cut2, period2, cut, period;
+    cut1 = STRINGLIB(_lex_search)(needle, len_needle, &period1, 0);
+    cut2 = STRINGLIB(_lex_search)(needle, len_needle, &period2, 1);
+
+    // Take the later cut.
+    if (cut1 > cut2) {
+        period = period1;
+        cut = cut1;
+    }
+    else {
+        period = period2;
+        cut = cut2;
+    }
+
+    LOG("split: "); LOG_STRING(needle, cut);
+    LOG(" + "); LOG_STRING(needle + cut, len_needle - cut);
+    LOG("\n");
+
+    *return_period = period;
+    return cut;
+}
+
+#define SHIFT_TYPE uint8_t
+#define NOT_FOUND ((1U<<(8*sizeof(SHIFT_TYPE))) - 1U)
+#define SHIFT_OVERFLOW (NOT_FOUND - 1U)
+
+#define TABLE_SIZE_BITS 6
+#define TABLE_SIZE (1U << TABLE_SIZE_BITS)
+#define TABLE_MASK (TABLE_SIZE - 1U)
+
+typedef struct STRINGLIB(_pre) {
+    const STRINGLIB_CHAR *needle;
+    Py_ssize_t len_needle;
+    Py_ssize_t cut;
+    Py_ssize_t period;
+    int is_periodic;
+    SHIFT_TYPE table[TABLE_SIZE];
+} STRINGLIB(prework);
+
+
+Py_LOCAL_INLINE(void)
+STRINGLIB(_preprocess)(const STRINGLIB_CHAR *needle, Py_ssize_t len_needle,
+                       STRINGLIB(prework) *p)
+{
+    p->needle = needle;
+    p->len_needle = len_needle;
+    p->cut = STRINGLIB(_factorize)(needle, len_needle, &(p->period));
+    assert(p->period + p->cut <= len_needle);
+    p->is_periodic = (0 == memcmp(needle,
+                                  needle + p->period,
+                                  p->cut * STRINGLIB_SIZEOF_CHAR));
+    if (p->is_periodic) {
+        assert(p->cut <= len_needle/2);
+        assert(p->cut < p->period);
+    }
+    else {
+        // A lower bound on the period
+        p->period = Py_MAX(p->cut, len_needle - p->cut) + 1;
+    }
+    // Now fill up a table
+    memset(&(p->table[0]), 0xff, TABLE_SIZE*sizeof(SHIFT_TYPE));
+    assert(p->table[0] == NOT_FOUND);
+    assert(p->table[TABLE_MASK] == NOT_FOUND);
+    for (Py_ssize_t i = 0; i < len_needle; i++) {
+        Py_ssize_t shift = len_needle - i;
+        if (shift > SHIFT_OVERFLOW) {
+            shift = SHIFT_OVERFLOW;
+        }
+        p->table[needle[i] & TABLE_MASK] = Py_SAFE_DOWNCAST(shift,
+                                                            Py_ssize_t,
+                                                            SHIFT_TYPE);
+    }
+}
+
+Py_LOCAL_INLINE(Py_ssize_t)
+STRINGLIB(_two_way)(const STRINGLIB_CHAR *haystack, Py_ssize_t len_haystack,
+                    STRINGLIB(prework) *p)
+{
+    // Crochemore and Perrin's (1991) Two-Way algorithm.
+    // See http://www-igm.univ-mlv.fr/~lecroq/string/node26.html#SECTION00260
+    Py_ssize_t len_needle = p->len_needle;
+    Py_ssize_t cut = p->cut;
+    Py_ssize_t period = p->period;
+    const STRINGLIB_CHAR *needle = p->needle;
+    const STRINGLIB_CHAR *window = haystack;
+    const STRINGLIB_CHAR *last_window = haystack + len_haystack - len_needle;
+    SHIFT_TYPE *table = p->table;
+    LOG("===== Two-way: \"%s\" in \"%s\". =====\n", needle, haystack);
+
+    if (p->is_periodic) {
+        LOG("Needle is periodic.\n");
+        Py_ssize_t memory = 0;
+      periodicwindowloop:
+        while (window <= last_window) {
+            Py_ssize_t i = Py_MAX(cut, memory);
+
+            // Visualize the line-up:
+            LOG("> "); LOG_STRING(haystack, len_haystack);
+            LOG("\n> "); LOG("%*s", window - haystack, "");
+            LOG_STRING(needle, len_needle);
+            LOG("\n> "); LOG("%*s", window - haystack + i, "");
+            LOG(" ^ <-- cut\n");
+
+            if (window[i] != needle[i]) {
+                // Sunday's trick: if we're going to jump, we might
+                // as well jump to line up the character *after* the
+                // current window.
+                STRINGLIB_CHAR first_outside = window[len_needle];
+                SHIFT_TYPE shift = table[first_outside & TABLE_MASK];
+                if (shift == NOT_FOUND) {
+                    LOG("\"%c\" not found. Skipping entirely.\n",
+                        first_outside);
+                    window += len_needle + 1;
+                }
+                else {
+                    LOG("Shifting to line up \"%c\".\n", first_outside);
+                    Py_ssize_t memory_shift = i - cut + 1;
+                    window += Py_MAX(shift, memory_shift);
+                }
+                memory = 0;
+                goto periodicwindowloop;
+            }
+            for (i = i + 1; i < len_needle; i++) {
+                if (needle[i] != window[i]) {
+                    LOG("Right half does not match. Jump ahead by %d.\n",
+                        i - cut + 1);
+                    window += i - cut + 1;
+                    memory = 0;
+                    goto periodicwindowloop;
+                }
+            }
+            for (i = memory; i < cut; i++) {
+                if (needle[i] != window[i]) {
+                    LOG("Left half does not match. Jump ahead by period %d.\n",
+                        period);
+                    window += period;
+                    memory = len_needle - period;
+                    goto periodicwindowloop;
+                }
+            }
+            LOG("Left half matches. Returning %d.\n",
+                window - haystack);
+            return window - haystack;
+        }
+    }
+    else {
+        LOG("Needle is not periodic.\n");
+        assert(cut < len_needle);
+        STRINGLIB_CHAR needle_cut = needle[cut];
+      windowloop:
+        while (window <= last_window) {
+
+            // Visualize the line-up:
+            LOG("> "); LOG_STRING(haystack, len_haystack);
+            LOG("\n> "); LOG("%*s", window - haystack, "");
+            LOG_STRING(needle, len_needle);
+            LOG("\n> "); LOG("%*s", window - haystack + cut, "");
+            LOG(" ^ <-- cut\n");
+
+            if (window[cut] != needle_cut) {
+                // Sunday's trick: if we're going to jump, we might
+                // as well jump to line up the character *after* the
+                // current window.
+                STRINGLIB_CHAR first_outside = window[len_needle];
+                SHIFT_TYPE shift = table[first_outside & TABLE_MASK];
+                if (shift == NOT_FOUND) {
+                    LOG("\"%c\" not found. Skipping entirely.\n",
+                        first_outside);
+                    window += len_needle + 1;
+                }
+                else {
+                    LOG("Shifting to line up \"%c\".\n", first_outside);
+                    window += shift;
+                }
+                goto windowloop;
+            }
+            for (Py_ssize_t i = cut + 1; i < len_needle; i++) {
+                if (needle[i] != window[i]) {
+                    LOG("Right half does not match. Advance by %d.\n",
+                        i - cut + 1);
+                    window += i - cut + 1;
+                    goto windowloop;
+                }
+            }
+            for (Py_ssize_t i = 0; i < cut; i++) {
+                if (needle[i] != window[i]) {
+                    LOG("Left half does not match. Advance by period %d.\n",
+                        period);
+                    window += period;
+                    goto windowloop;
+                }
+            }
+            LOG("Left half matches. Returning %d.\n", window - haystack);
+            return window - haystack;
+        }
+    }
+    LOG("Not found. Returning -1.\n");
+    return -1;
+}
+
+Py_LOCAL_INLINE(Py_ssize_t)
+STRINGLIB(_two_way_find)(const STRINGLIB_CHAR *haystack,
+                         Py_ssize_t len_haystack,
+                         const STRINGLIB_CHAR *needle,
+                         Py_ssize_t len_needle)
+{
+    LOG("###### Finding \"%s\" in \"%s\".\n", needle, haystack);
+    STRINGLIB(prework) p;
+    STRINGLIB(_preprocess)(needle, len_needle, &p);
+    return STRINGLIB(_two_way)(haystack, len_haystack, &p);
+}
+
+Py_LOCAL_INLINE(Py_ssize_t)
+STRINGLIB(_two_way_count)(const STRINGLIB_CHAR *haystack,
+                          Py_ssize_t len_haystack,
+                          const STRINGLIB_CHAR *needle,
+                          Py_ssize_t len_needle,
+                          Py_ssize_t maxcount)
+{
+    LOG("###### Counting \"%s\" in \"%s\".\n", needle, haystack);
+    STRINGLIB(prework) p;
+    STRINGLIB(_preprocess)(needle, len_needle, &p);
+    Py_ssize_t index = 0, count = 0;
+    while (1) {
+        Py_ssize_t result;
+        result = STRINGLIB(_two_way)(haystack + index,
+                                     len_haystack - index, &p);
+        if (result == -1) {
+            return count;
+        }
+        count++;
+        if (count == maxcount) {
+            return maxcount;
+        }
+        index += result + len_needle;
+    }
+    return count;
+}
+
+#undef SHIFT_TYPE
+#undef NOT_FOUND
+#undef SHIFT_OVERFLOW
+#undef TABLE_SIZE_BITS
+#undef TABLE_SIZE
+#undef TABLE_MASK
+
+#undef LOG
+#undef LOG_STRING
+
 Py_LOCAL_INLINE(Py_ssize_t)
 FASTSEARCH(const STRINGLIB_CHAR* s, Py_ssize_t n,
            const STRINGLIB_CHAR* p, Py_ssize_t m,
@@ -195,10 +548,22 @@
     }
 
     mlast = m - 1;
-    skip = mlast - 1;
+    skip = mlast;
     mask = 0;
 
     if (mode != FAST_RSEARCH) {
+        if (m >= 100 && w >= 2000 && w / m >= 5) {
+            /* For larger problems where the needle isn't a huge
+               percentage of the size of the haystack, the relatively
+               expensive O(m) startup cost of the two-way algorithm
+               will surely pay off. */
+            if (mode == FAST_SEARCH) {
+                return STRINGLIB(_two_way_find)(s, n, p, m);
+            }
+            else {
+                return STRINGLIB(_two_way_count)(s, n, p, m, maxcount);
+            }
+        }
         const STRINGLIB_CHAR *ss = s + m - 1;
         const STRINGLIB_CHAR *pp = p + m - 1;
 
@@ -207,41 +572,118 @@
         /* process pattern[:-1] */
         for (i = 0; i < mlast; i++) {
             STRINGLIB_BLOOM_ADD(mask, p[i]);
-            if (p[i] == p[mlast])
+            if (p[i] == p[mlast]) {
                 skip = mlast - i - 1;
+            }
         }
         /* process pattern[-1] outside the loop */
         STRINGLIB_BLOOM_ADD(mask, p[mlast]);
 
+        if (m >= 100 && w >= 8000) {
+            /* To ensure that we have good worst-case behavior,
+               here's an adaptive version of the algorithm, where if
+               we match O(m) characters without any matches of the
+               entire needle, then we predict that the startup cost of
+               the two-way algorithm will probably be worth it. */
+            Py_ssize_t hits = 0;
+            for (i = 0; i <= w; i++) {
+                if (ss[i] == pp[0]) {
+                    /* candidate match */
+                    for (j = 0; j < mlast; j++) {
+                        if (s[i+j] != p[j]) {
+                            break;
+                        }
+                    }
+                    if (j == mlast) {
+                        /* got a match! */
+                        if (mode != FAST_COUNT) {
+                            return i;
+                        }
+                        count++;
+                        if (count == maxcount) {
+                            return maxcount;
+                        }
+                        i = i + mlast;
+                        continue;
+                    }
+                    /* miss: check if next character is part of pattern */
+                    if (!STRINGLIB_BLOOM(mask, ss[i+1])) {
+                        i = i + m;
+                    }
+                    else {
+                        i = i + skip;
+                    }
+                    hits += j + 1;
+                    if (hits >= m / 4 && i < w - 1000) {
+                        /* We've done O(m) fruitless comparisons
+                           anyway, so spend the O(m) cost on the
+                           setup for the two-way algorithm. */
+                        Py_ssize_t res;
+                        if (mode == FAST_COUNT) {
+                            res = STRINGLIB(_two_way_count)(
+                                s+i, n-i, p, m, maxcount-count);
+                            return count + res;
+                        }
+                        else {
+                            res = STRINGLIB(_two_way_find)(s+i, n-i, p, m);
+                            if (res == -1) {
+                                return -1;
+                            }
+                            return i + res;
+                        }
+                    }
+                }
+                else {
+                    /* skip: check if next character is part of pattern */
+                    if (!STRINGLIB_BLOOM(mask, ss[i+1])) {
+                        i = i + m;
+                    }
+                }
+            }
+            if (mode != FAST_COUNT) {
+                return -1;
+            }
+            return count;
+        }
+        /* The standard, non-adaptive version of the algorithm. */
         for (i = 0; i <= w; i++) {
             /* note: using mlast in the skip path slows things down on x86 */
             if (ss[i] == pp[0]) {
                 /* candidate match */
-                for (j = 0; j < mlast; j++)
-                    if (s[i+j] != p[j])
+                for (j = 0; j < mlast; j++) {
+                    if (s[i+j] != p[j]) {
                         break;
+                    }
+                }
                 if (j == mlast) {
                     /* got a match! */
-                    if (mode != FAST_COUNT)
+                    if (mode != FAST_COUNT) {
                         return i;
+                    }
                     count++;
-                    if (count == maxcount)
+                    if (count == maxcount) {
                         return maxcount;
+                    }
                     i = i + mlast;
                     continue;
                 }
                 /* miss: check if next character is part of pattern */
-                if (!STRINGLIB_BLOOM(mask, ss[i+1]))
+                if (!STRINGLIB_BLOOM(mask, ss[i+1])) {
                     i = i + m;
-                else
+                }
+                else {
                     i = i + skip;
-            } else {
+                }
+            }
+            else {
                 /* skip: check if next character is part of pattern */
-                if (!STRINGLIB_BLOOM(mask, ss[i+1]))
+                if (!STRINGLIB_BLOOM(mask, ss[i+1])) {
                     i = i + m;
+                }
             }
         }
-    } else {    /* FAST_RSEARCH */
+    }
+    else {    /* FAST_RSEARCH */
 
         /* create compressed boyer-moore delta 1 table */
 
@@ -250,28 +692,36 @@
         /* process pattern[:0:-1] */
         for (i = mlast; i > 0; i--) {
             STRINGLIB_BLOOM_ADD(mask, p[i]);
-            if (p[i] == p[0])
+            if (p[i] == p[0]) {
                 skip = i - 1;
+            }
         }
 
         for (i = w; i >= 0; i--) {
             if (s[i] == p[0]) {
                 /* candidate match */
-                for (j = mlast; j > 0; j--)
-                    if (s[i+j] != p[j])
+                for (j = mlast; j > 0; j--) {
+                    if (s[i+j] != p[j]) {
                         break;
-                if (j == 0)
+                    }
+                }
+                if (j == 0) {
                     /* got a match! */
                     return i;
+                }
                 /* miss: check if previous character is part of pattern */
-                if (i > 0 && !STRINGLIB_BLOOM(mask, s[i-1]))
+                if (i > 0 && !STRINGLIB_BLOOM(mask, s[i-1])) {
                     i = i - m;
-                else
+                }
+                else {
                     i = i - skip;
-            } else {
+                }
+            }
+            else {
                 /* skip: check if previous character is part of pattern */
-                if (i > 0 && !STRINGLIB_BLOOM(mask, s[i-1]))
+                if (i > 0 && !STRINGLIB_BLOOM(mask, s[i-1])) {
                     i = i - m;
+                }
             }
         }
     }
diff --git a/Objects/stringlib/find_max_char.h b/Objects/stringlib/find_max_char.h
index f4e0a77..b9ffdfc 100644
--- a/Objects/stringlib/find_max_char.h
+++ b/Objects/stringlib/find_max_char.h
@@ -4,14 +4,14 @@
 # error "find_max_char.h is specific to Unicode"
 #endif
 
-/* Mask to quickly check whether a C 'long' contains a
+/* Mask to quickly check whether a C 'size_t' contains a
    non-ASCII, UTF8-encoded char. */
-#if (SIZEOF_LONG == 8)
-# define UCS1_ASCII_CHAR_MASK 0x8080808080808080UL
-#elif (SIZEOF_LONG == 4)
-# define UCS1_ASCII_CHAR_MASK 0x80808080UL
+#if (SIZEOF_SIZE_T == 8)
+# define UCS1_ASCII_CHAR_MASK 0x8080808080808080ULL
+#elif (SIZEOF_SIZE_T == 4)
+# define UCS1_ASCII_CHAR_MASK 0x80808080U
 #else
-# error C 'long' size should be either 4 or 8!
+# error C 'size_t' size should be either 4 or 8!
 #endif
 
 #if STRINGLIB_SIZEOF_CHAR == 1
@@ -20,18 +20,16 @@
 STRINGLIB(find_max_char)(const STRINGLIB_CHAR *begin, const STRINGLIB_CHAR *end)
 {
     const unsigned char *p = (const unsigned char *) begin;
-    const unsigned char *aligned_end =
-            (const unsigned char *) _Py_ALIGN_DOWN(end, SIZEOF_LONG);
 
     while (p < end) {
-        if (_Py_IS_ALIGNED(p, SIZEOF_LONG)) {
+        if (_Py_IS_ALIGNED(p, ALIGNOF_SIZE_T)) {
             /* Help register allocation */
             const unsigned char *_p = p;
-            while (_p < aligned_end) {
-                unsigned long value = *(const unsigned long *) _p;
+            while (_p + SIZEOF_SIZE_T <= end) {
+                size_t value = *(const size_t *) _p;
                 if (value & UCS1_ASCII_CHAR_MASK)
                     return 255;
-                _p += SIZEOF_LONG;
+                _p += SIZEOF_SIZE_T;
             }
             p = _p;
             if (p == end)
diff --git a/Objects/stringlib/join.h b/Objects/stringlib/join.h
index 53bcbde..62e4c98 100644
--- a/Objects/stringlib/join.h
+++ b/Objects/stringlib/join.h
@@ -155,7 +155,7 @@
     for (i = 0; i < nbufs; i++)
         PyBuffer_Release(&buffers[i]);
     if (buffers != static_buffers)
-        PyMem_FREE(buffers);
+        PyMem_Free(buffers);
     return res;
 }
 
diff --git a/Objects/stringlib/partition.h b/Objects/stringlib/partition.h
index ed32a6f..bcc2176 100644
--- a/Objects/stringlib/partition.h
+++ b/Objects/stringlib/partition.h
@@ -1,9 +1,14 @@
 /* stringlib: partition implementation */
 
 #ifndef STRINGLIB_FASTSEARCH_H
-#error must include "stringlib/fastsearch.h" before including this module
+#  error must include "stringlib/fastsearch.h" before including this module
 #endif
 
+#if !STRINGLIB_MUTABLE && !defined(STRINGLIB_GET_EMPTY)
+#  error "STRINGLIB_GET_EMPTY must be defined if STRINGLIB_MUTABLE is zero"
+#endif
+
+
 Py_LOCAL_INLINE(PyObject*)
 STRINGLIB(partition)(PyObject* str_obj,
                     const STRINGLIB_CHAR* str, Py_ssize_t str_len,
@@ -37,10 +42,12 @@
 #else
         Py_INCREF(str_obj);
         PyTuple_SET_ITEM(out, 0, (PyObject*) str_obj);
-        Py_INCREF(STRINGLIB_EMPTY);
-        PyTuple_SET_ITEM(out, 1, (PyObject*) STRINGLIB_EMPTY);
-        Py_INCREF(STRINGLIB_EMPTY);
-        PyTuple_SET_ITEM(out, 2, (PyObject*) STRINGLIB_EMPTY);
+        PyObject *empty = (PyObject*)STRINGLIB_GET_EMPTY();
+        assert(empty != NULL);
+        Py_INCREF(empty);
+        PyTuple_SET_ITEM(out, 1, empty);
+        Py_INCREF(empty);
+        PyTuple_SET_ITEM(out, 2, empty);
 #endif
         return out;
     }
@@ -90,10 +97,12 @@
             return NULL;
         }
 #else
-        Py_INCREF(STRINGLIB_EMPTY);
-        PyTuple_SET_ITEM(out, 0, (PyObject*) STRINGLIB_EMPTY);
-        Py_INCREF(STRINGLIB_EMPTY);
-        PyTuple_SET_ITEM(out, 1, (PyObject*) STRINGLIB_EMPTY);
+        PyObject *empty = (PyObject*)STRINGLIB_GET_EMPTY();
+        assert(empty != NULL);
+        Py_INCREF(empty);
+        PyTuple_SET_ITEM(out, 0, empty);
+        Py_INCREF(empty);
+        PyTuple_SET_ITEM(out, 1, empty);
         Py_INCREF(str_obj);
         PyTuple_SET_ITEM(out, 2, (PyObject*) str_obj);
 #endif
diff --git a/Objects/stringlib/stringdefs.h b/Objects/stringlib/stringdefs.h
index ce27f3e..88641b2 100644
--- a/Objects/stringlib/stringdefs.h
+++ b/Objects/stringlib/stringdefs.h
@@ -13,7 +13,6 @@
 #define STRINGLIB_CHAR           char
 #define STRINGLIB_TYPE_NAME      "string"
 #define STRINGLIB_PARSE_CODE     "S"
-#define STRINGLIB_EMPTY          nullstring
 #define STRINGLIB_ISSPACE        Py_ISSPACE
 #define STRINGLIB_ISLINEBREAK(x) ((x == '\n') || (x == '\r'))
 #define STRINGLIB_ISDECIMAL(x)   ((x >= '0') && (x <= '9'))
diff --git a/Objects/stringlib/stringlib_find_two_way_notes.txt b/Objects/stringlib/stringlib_find_two_way_notes.txt
new file mode 100644
index 0000000..afe4543
--- /dev/null
+++ b/Objects/stringlib/stringlib_find_two_way_notes.txt
@@ -0,0 +1,431 @@
+This document explains Crochemore and Perrin's Two-Way string matching
+algorithm, in which a smaller string (the "pattern" or "needle")
+is searched for in a longer string (the "text" or "haystack"),
+determining whether the needle is a substring of the haystack, and if
+so, at what index(es). It is to be used by Python's string
+(and bytes-like) objects when calling `find`, `index`, `__contains__`,
+or implicitly in methods like `replace` or `partition`.
+
+This is essentially a re-telling of the paper
+
+    Crochemore M., Perrin D., 1991, Two-way string-matching,
+        Journal of the ACM 38(3):651-675.
+
+focused more on understanding and examples than on rigor. See also
+the code sample here:
+
+    http://www-igm.univ-mlv.fr/~lecroq/string/node26.html#SECTION00260
+
+The algorithm runs in O(len(needle) + len(haystack)) time and with
+O(1) space. However, since there is a larger preprocessing cost than
+simpler algorithms, this Two-Way algorithm is to be used only when the
+needle and haystack lengths meet certain thresholds.
+
+
+These are the basic steps of the algorithm:
+
+    * "Very carefully" cut the needle in two.
+    * For each alignment attempted:
+        1. match the right part
+            * On failure, jump by the amount matched + 1
+        2. then match the left part.
+            * On failure jump by max(len(left), len(right)) + 1
+    * If the needle is periodic, don't re-do comparisons; maintain
+      a "memory" of how many characters you already know match.
+
+
+-------- Matching the right part --------
+
+We first scan the right part of the needle to check if it matches the
+the aligned characters in the haystack. We scan left-to-right,
+and if a mismatch occurs, we jump ahead by the amount matched plus 1.
+
+Example:
+
+       text:    ........EFGX...................
+    pattern:    ....abcdEFGH....
+        cut:        <<<<>>>>
+
+Matched 3, so jump ahead by 4:
+
+       text:    ........EFGX...................
+    pattern:        ....abcdEFGH....
+        cut:            <<<<>>>>
+
+Why are we allowed to do this? Because we cut the needle very
+carefully, in such a way that if the cut is ...abcd + EFGH... then
+we have
+
+        d != E
+       cd != EF
+      bcd != EFG
+     abcd != EFGH
+          ... and so on.
+
+If this is true for every pair of equal-length substrings around the
+cut, then the following alignments do not work, so we can skip them:
+
+       text:    ........EFG....................
+    pattern:     ....abcdEFGH....
+                        ^   (Bad because d != E)
+       text:    ........EFG....................
+    pattern:      ....abcdEFGH....
+                        ^^   (Bad because cd != EF)
+       text:    ........EFG....................
+    pattern:       ....abcdEFGH....
+                        ^^^   (Bad because bcd != EFG)
+
+Skip 3 alignments => increment alignment by 4.
+
+
+-------- If len(left_part) < len(right_part) --------
+
+Above is the core idea, and it begins to suggest how the algorithm can
+be linear-time. There is one bit of subtlety involving what to do
+around the end of the needle: if the left half is shorter than the
+right, then we could run into something like this:
+
+       text:    .....EFG......
+    pattern:       cdEFGH
+
+The same argument holds that we can skip ahead by 4, so long as
+
+       d != E
+      cd != EF
+     ?cd != EFG
+    ??cd != EFGH
+         etc.
+
+The question marks represent "wildcards" that always match; they're
+outside the limits of the needle, so there's no way for them to
+invalidate a match. To ensure that the inequalities above are always
+true, we need them to be true for all possible '?' values. We thus
+need cd != FG and cd != GH, etc.
+
+
+-------- Matching the left part --------
+
+Once we have ensured the right part matches, we scan the left part
+(order doesn't matter, but traditionally right-to-left), and if we
+find a mismatch, we jump ahead by
+max(len(left_part), len(right_part)) + 1. That we can jump by
+at least len(right_part) + 1 we have already seen:
+
+       text: .....EFG.....
+    pattern:  abcdEFG
+    Matched 3, so jump by 4,
+    using the fact that d != E, cd != EF, and bcd != EFG.
+
+But we can also jump by at least len(left_part) + 1:
+
+       text: ....cdEF.....
+    pattern:   abcdEF
+    Jump by len('abcd') + 1 = 5.
+
+    Skip the alignments:
+       text: ....cdEF.....
+    pattern:    abcdEF
+       text: ....cdEF.....
+    pattern:     abcdEF
+       text: ....cdEF.....
+    pattern:      abcdEF
+       text: ....cdEF.....
+    pattern:       abcdEF
+
+This requires the following facts:
+       d != E
+      cd != EF
+     bcd != EF?
+    abcd != EF??
+         etc., for all values of ?s, as above.
+
+If we have both sets of inequalities, then we can indeed jump by
+max(len(left_part), len(right_part)) + 1. Under the assumption of such
+a nice splitting of the needle, we now have enough to prove linear
+time for the search: consider the forward-progress/comparisons ratio
+at each alignment position. If a mismatch occurs in the right part,
+the ratio is 1 position forward per comparison. On the other hand,
+if a mismatch occurs in the left half, we advance by more than
+len(needle)//2 positions for at most len(needle) comparisons,
+so this ratio is more than 1/2. This average "movement speed" is
+bounded below by the constant "1 position per 2 comparisons", so we
+have linear time.
+
+
+-------- The periodic case --------
+
+The sets of inequalities listed so far seem too good to be true in
+the general case. Indeed, they fail when a needle is periodic:
+there's no way to split 'AAbAAbAAbA' in two such that
+
+    (the stuff n characters to the left of the split)
+    cannot equal
+    (the stuff n characters to the right of the split)
+    for all n.
+
+This is because no matter how you cut it, you'll get
+s[cut-3:cut] == s[cut:cut+3]. So what do we do? We still cut the
+needle in two so that n can be as big as possible. If we were to
+split it as
+
+    AAbA + AbAAbA
+
+then A == A at the split, so this is bad (we failed at length 1), but
+if we split it as
+
+    AA + bAAbAAbA
+
+we at least have A != b and AA != bA, and we fail at length 3
+since ?AA == bAA. We already knew that a cut to make length-3
+mismatch was impossible due to the period, but we now see that the
+bound is sharp; we can get length-1 and length-2 to mismatch.
+
+This is exactly the content of the *critical factorization theorem*:
+that no matter the period of the original needle, you can cut it in
+such a way that (with the appropriate question marks),
+needle[cut-k:cut] mismatches needle[cut:cut+k] for all k < the period.
+
+Even "non-periodic" strings are periodic with a period equal to
+their length, so for such needles, the CFT already guarantees that
+the algorithm described so far will work, since we can cut the needle
+so that the length-k chunks on either side of the cut mismatch for all
+k < len(needle). Looking closer at the algorithm, we only actually
+require that k go up to max(len(left_part), len(right_part)).
+So long as the period exceeds that, we're good.
+
+The more general shorter-period case is a bit harder. The essentials
+are the same, except we use the periodicity to our advantage by
+"remembering" periods that we've already compared. In our running
+example, say we're computing
+
+    "AAbAAbAAbA" in "bbbAbbAAbAAbAAbbbAAbAAbAAbAA".
+
+We cut as AA + bAAbAAbA, and then the algorithm runs as follows:
+
+    First alignment:
+    bbbAbbAAbAAbAAbbbAAbAAbAAbAA
+    AAbAAbAAbA
+      ^^X
+    - Mismatch at third position, so jump by 3.
+    - This requires that A!=b and AA != bA.
+
+    Second alignment:
+    bbbAbbAAbAAbAAbbbAAbAAbAAbAA
+       AAbAAbAAbA
+         ^^^^^^^^
+        X
+    - Matched entire right part
+    - Mismatch at left part.
+    - Jump forward a period, remembering the existing comparisons
+
+    Third alignment:
+    bbbAbbAAbAAbAAbbbAAbAAbAAbAA
+          AAbAAbAAbA
+          mmmmmmm^^X
+    - There's "memory": a bunch of characters were already matched.
+    - Two more characters match beyond that.
+    - The 8th character of the right part mismatched, so jump by 8
+    - The above rule is more complicated than usual: we don't have
+      the right inequalities for lengths 1 through 7, but we do have
+      shifted copies of the length-1 and length-2 inequalities,
+      along with knowledge of the mismatch. We can skip all of these
+      alignments at once:
+
+        bbbAbbAAbAAbAAbbbAAbAAbAAbAA
+               AAbAAbAAbA
+                ~                   A != b at the cut
+        bbbAbbAAbAAbAAbbbAAbAAbAAbAA
+                AAbAAbAAbA
+                ~~                  AA != bA at the cut
+        bbbAbbAAbAAbAAbbbAAbAAbAAbAA
+                 AAbAAbAAbA
+                 ^^^^X              7-3=4 match, and the 5th misses.
+        bbbAbbAAbAAbAAbbbAAbAAbAAbAA
+                  AAbAAbAAbA
+                   ~                A != b at the cut
+        bbbAbbAAbAAbAAbbbAAbAAbAAbAA
+                   AAbAAbAAbA
+                   ~~               AA != bA at the cut
+        bbbAbbAAbAAbAAbbbAAbAAbAAbAA
+                    AAbAAbAAbA
+                      ^X            7-3-3=1 match and the 2nd misses.
+        bbbAbbAAbAAbAAbbbAAbAAbAAbAA
+                     AAbAAbAAbA
+                      ~             A != b at the cut
+
+    Fourth alignment:
+    bbbAbbAAbAAbAAbbbAAbAAbAAbAA
+                 AAbAAbAAbA
+                   ^X
+    - Second character mismatches, so jump by 2.
+
+    Fifth alignment:
+    bbbAbbAAbAAbAAbbbAAbAAbAAbAA
+                  AAbAAbAAbA
+                    ^^^^^^^^
+                   X
+    - Right half matches, so use memory and skip ahead by period=3
+
+    Sixth alignment:
+    bbbAbbAAbAAbAAbbbAAbAAbAAbAA
+                     AAbAAbAAbA
+                     mmmmmmmm^^
+    - Right part matches, left part is remembered, found a match!
+
+The one tricky skip by 8 here generalizes: if we have a period of p,
+then the CFT says we can ensure the cut has the inequality property
+for lengths 1 through p-1, and jumping by p would line up the
+matching characters and mismatched character one period earlier.
+Inductively, this proves that we can skip by the number of characters
+matched in the right half, plus 1, just as in the original algorithm.
+
+To make it explicit, the memory is set whenever the entire right part
+is matched and is then used as a starting point in the next alignment.
+In such a case, the alignment jumps forward one period, and the right
+half matches all except possibly the last period. Additionally,
+if we cut so that the left part has a length strictly less than the
+period (we always can!), then we can know that the left part already
+matches. The memory is reset to 0 whenever there is a mismatch in the
+right part.
+
+To prove linearity for the periodic case, note that if a right-part
+character mismatches, then we advance forward 1 unit per comparison.
+On the other hand, if the entire right part matches, then the skipping
+forward by one period "defers" some of the comparisons to the next
+alignment, where they will then be spent at the usual rate of
+one comparison per step forward. Even if left-half comparisons
+are always "wasted", they constitute less than half of all
+comparisons, so the average rate is certainly at least 1 move forward
+per 2 comparisons.
+
+
+-------- When to choose the periodic algorithm ---------
+
+The periodic algorithm is always valid but has an overhead of one
+more "memory" register and some memory computation steps, so the
+here-described-first non-periodic/long-period algorithm -- skipping by
+max(len(left_part), len(right_part)) + 1 rather than the period --
+should be preferred when possible.
+
+Interestingly, the long-period algorithm does not require an exact
+computation of the period; it works even with some long-period, but
+undeniably "periodic" needles:
+
+    Cut: AbcdefAbc == Abcde + fAbc
+
+This cut gives these inequalities:
+
+                 e != f
+                de != fA
+               cde != fAb
+              bcde != fAbc
+             Abcde != fAbc?
+    The first failure is a period long, per the CFT:
+            ?Abcde == fAbc??
+
+A sufficient condition for using the long-period algorithm is having
+the period of the needle be greater than
+max(len(left_part), len(right_part)). This way, after choosing a good
+split, we get all of the max(len(left_part), len(right_part))
+inequalities around the cut that were required in the long-period
+version of the algorithm.
+
+With all of this in mind, here's how we choose:
+
+    (1) Choose a "critical factorization" of the needle -- a cut
+        where we have period minus 1 inequalities in a row.
+        More specifically, choose a cut so that the left_part
+        is less than one period long.
+    (2) Determine the period P_r of the right_part.
+    (3) Check if the left part is just an extension of the pattern of
+        the right part, so that the whole needle has period P_r.
+        Explicitly, check if
+            needle[0:cut] == needle[0+P_r:cut+P_r]
+        If so, we use the periodic algorithm. If not equal, we use the
+        long-period algorithm.
+
+Note that if equality holds in (3), then the period of the whole
+string is P_r. On the other hand, suppose equality does not hold.
+The period of the needle is then strictly greater than P_r. Here's
+a general fact:
+
+    If p is a substring of s and p has period r, then the period
+    of s is either equal to r or greater than len(p).
+
+We know that needle_period != P_r,
+and therefore needle_period > len(right_part).
+Additionally, we'll choose the cut (see below)
+so that len(left_part) < needle_period.
+
+Thus, in the case where equality does not hold, we have that
+needle_period >= max(len(left_part), len(right_part)) + 1,
+so the long-period algorithm works, but otherwise, we know the period
+of the needle.
+
+Note that this decision process doesn't always require an exact
+computation of the period -- we can get away with only computing P_r!
+
+
+-------- Computing the cut --------
+
+Our remaining tasks are now to compute a cut of the needle with as
+many inequalities as possible, ensuring that cut < needle_period.
+Meanwhile, we must also compute the period P_r of the right_part.
+
+The computation is relatively simple, essentially doing this:
+
+    suffix1 = max(needle[i:] for i in range(len(needle)))
+    suffix2 = ... # the same as above, but invert the alphabet
+    cut1 = len(needle) - len(suffix1)
+    cut2 = len(needle) - len(suffix2)
+    cut = max(cut1, cut2) # the later cut
+
+For cut2, "invert the alphabet" is different than saying min(...),
+since in lexicographic order, we still put "py" < "python", even
+if the alphabet is inverted. Computing these, along with the method
+of computing the period of the right half, is easiest to read directly
+from the source code in fastsearch.h, in which these are computed
+in linear time.
+
+Crochemore & Perrin's Theorem 3.1 give that "cut" above is a
+critical factorization less than the period, but a very brief sketch
+of their proof goes something like this (this is far from complete):
+
+    * If this cut splits the needle as some
+      needle == (a + w) + (w + b), meaning there's a bad equality
+      w == w, it's impossible for w + b to be bigger than both
+      b and w + w + b, so this can't happen. We thus have all of
+      the ineuqalities with no question marks.
+    * By maximality, the right part is not a substring of the left
+      part. Thus, we have all of the inequalities involving no
+      left-side question marks.
+    * If you have all of the inequalities without right-side question
+      marks, we have a critical factorization.
+    * If one such inequality fails, then there's a smaller period,
+      but the factorization is nonetheless critical. Here's where
+      you need the redundancy coming from computing both cuts and
+      choosing the later one.
+
+
+-------- Some more Bells and Whistles --------
+
+Beyond Crochemore & Perrin's original algorithm, we can use a couple
+more tricks for speed in fastsearch.h:
+
+    1. Even though C&P has a best-case O(n/m) time, this doesn't occur
+       very often, so we add a Boyer-Moore bad character table to
+       achieve sublinear time in more cases.
+
+    2. The prework of computing the cut/period is expensive per
+       needle character, so we shouldn't do it if it won't pay off.
+       For this reason, if the needle and haystack are long enough,
+       only automatically start with two-way if the needle's length
+       is a small percentage of the length of the haystack.
+
+    3. In cases where the needle and haystack are large but the needle
+       makes up a significant percentage of the length of the
+       haystack, don't pay the expensive two-way preprocessing cost
+       if you don't need to. Instead, keep track of how many
+       character comparisons are equal, and if that exceeds
+       O(len(needle)), then pay that cost, since the simpler algorithm
+       isn't doing very well.
diff --git a/Objects/stringlib/ucs1lib.h b/Objects/stringlib/ucs1lib.h
index bc4b104..5b0b8a0 100644
--- a/Objects/stringlib/ucs1lib.h
+++ b/Objects/stringlib/ucs1lib.h
@@ -11,7 +11,6 @@
 #define STRINGLIB_CHAR           Py_UCS1
 #define STRINGLIB_TYPE_NAME      "unicode"
 #define STRINGLIB_PARSE_CODE     "U"
-#define STRINGLIB_EMPTY          unicode_empty
 #define STRINGLIB_ISSPACE        Py_UNICODE_ISSPACE
 #define STRINGLIB_ISLINEBREAK    BLOOM_LINEBREAK
 #define STRINGLIB_ISDECIMAL      Py_UNICODE_ISDECIMAL
diff --git a/Objects/stringlib/ucs2lib.h b/Objects/stringlib/ucs2lib.h
index 86a1dff..6af0151 100644
--- a/Objects/stringlib/ucs2lib.h
+++ b/Objects/stringlib/ucs2lib.h
@@ -11,7 +11,6 @@
 #define STRINGLIB_CHAR           Py_UCS2
 #define STRINGLIB_TYPE_NAME      "unicode"
 #define STRINGLIB_PARSE_CODE     "U"
-#define STRINGLIB_EMPTY          unicode_empty
 #define STRINGLIB_ISSPACE        Py_UNICODE_ISSPACE
 #define STRINGLIB_ISLINEBREAK    BLOOM_LINEBREAK
 #define STRINGLIB_ISDECIMAL      Py_UNICODE_ISDECIMAL
diff --git a/Objects/stringlib/ucs4lib.h b/Objects/stringlib/ucs4lib.h
index 3c32a93..39071a0 100644
--- a/Objects/stringlib/ucs4lib.h
+++ b/Objects/stringlib/ucs4lib.h
@@ -11,7 +11,6 @@
 #define STRINGLIB_CHAR           Py_UCS4
 #define STRINGLIB_TYPE_NAME      "unicode"
 #define STRINGLIB_PARSE_CODE     "U"
-#define STRINGLIB_EMPTY          unicode_empty
 #define STRINGLIB_ISSPACE        Py_UNICODE_ISSPACE
 #define STRINGLIB_ISLINEBREAK    BLOOM_LINEBREAK
 #define STRINGLIB_ISDECIMAL      Py_UNICODE_ISDECIMAL
diff --git a/Objects/stringlib/unicode_format.h b/Objects/stringlib/unicode_format.h
index b526ad2..7152ec6 100644
--- a/Objects/stringlib/unicode_format.h
+++ b/Objects/stringlib/unicode_format.h
@@ -983,7 +983,7 @@
 formatteriter_dealloc(formatteriterobject *it)
 {
     Py_XDECREF(it->str);
-    PyObject_FREE(it);
+    PyObject_Free(it);
 }
 
 /* returns a tuple:
@@ -1147,7 +1147,7 @@
 fieldnameiter_dealloc(fieldnameiterobject *it)
 {
     Py_XDECREF(it->str);
-    PyObject_FREE(it);
+    PyObject_Free(it);
 }
 
 /* returns a tuple:
diff --git a/Objects/stringlib/unicodedefs.h b/Objects/stringlib/unicodedefs.h
index 3db5629..5ea79cd 100644
--- a/Objects/stringlib/unicodedefs.h
+++ b/Objects/stringlib/unicodedefs.h
@@ -13,7 +13,6 @@
 #define STRINGLIB_CHAR           Py_UNICODE
 #define STRINGLIB_TYPE_NAME      "unicode"
 #define STRINGLIB_PARSE_CODE     "U"
-#define STRINGLIB_EMPTY          unicode_empty
 #define STRINGLIB_ISSPACE        Py_UNICODE_ISSPACE
 #define STRINGLIB_ISLINEBREAK    BLOOM_LINEBREAK
 #define STRINGLIB_ISDECIMAL      Py_UNICODE_ISDECIMAL
diff --git a/Objects/structseq.c b/Objects/structseq.c
index b17b1f9..73795b6 100644
--- a/Objects/structseq.c
+++ b/Objects/structseq.c
@@ -8,31 +8,46 @@
 */
 
 #include "Python.h"
-#include "pycore_tupleobject.h"
-#include "pycore_object.h"
+#include "pycore_tuple.h"         // _PyTuple_FromArray()
+#include "pycore_object.h"        // _PyObject_GC_TRACK()
 #include "structmember.h"         // PyMemberDef
+#include "pycore_structseq.h"     // PyStructSequence_InitType()
 
 static const char visible_length_key[] = "n_sequence_fields";
 static const char real_length_key[] = "n_fields";
 static const char unnamed_fields_key[] = "n_unnamed_fields";
+static const char match_args_key[] = "__match_args__";
 
 /* Fields with this name have only a field index, not a field name.
    They are only allowed for indices < n_visible_fields. */
 const char * const PyStructSequence_UnnamedField = "unnamed field";
+
 _Py_IDENTIFIER(n_sequence_fields);
 _Py_IDENTIFIER(n_fields);
 _Py_IDENTIFIER(n_unnamed_fields);
 
-#define VISIBLE_SIZE(op) Py_SIZE(op)
-#define VISIBLE_SIZE_TP(tp) PyLong_AsSsize_t( \
-                      _PyDict_GetItemId((tp)->tp_dict, &PyId_n_sequence_fields))
+static Py_ssize_t
+get_type_attr_as_size(PyTypeObject *tp, _Py_Identifier *id)
+{
+    PyObject *name = _PyUnicode_FromId(id);
+    if (name == NULL) {
+        return -1;
+    }
+    PyObject *v = PyDict_GetItemWithError(tp->tp_dict, name);
+    if (v == NULL && !PyErr_Occurred()) {
+        PyErr_Format(PyExc_TypeError,
+                     "Missed attribute '%U' of type %s",
+                     name, tp->tp_name);
+    }
+    return PyLong_AsSsize_t(v);
+}
 
-#define REAL_SIZE_TP(tp) PyLong_AsSsize_t( \
-                      _PyDict_GetItemId((tp)->tp_dict, &PyId_n_fields))
+#define VISIBLE_SIZE(op) Py_SIZE(op)
+#define VISIBLE_SIZE_TP(tp) get_type_attr_as_size(tp, &PyId_n_sequence_fields)
+#define REAL_SIZE_TP(tp) get_type_attr_as_size(tp, &PyId_n_fields)
 #define REAL_SIZE(op) REAL_SIZE_TP(Py_TYPE(op))
 
-#define UNNAMED_FIELDS_TP(tp) PyLong_AsSsize_t( \
-                      _PyDict_GetItemId((tp)->tp_dict, &PyId_n_unnamed_fields))
+#define UNNAMED_FIELDS_TP(tp) get_type_attr_as_size(tp, &PyId_n_unnamed_fields)
 #define UNNAMED_FIELDS(op) UNNAMED_FIELDS_TP(Py_TYPE(op))
 
 
@@ -41,13 +56,20 @@
 {
     PyStructSequence *obj;
     Py_ssize_t size = REAL_SIZE_TP(type), i;
+    if (size < 0) {
+        return NULL;
+    }
+    Py_ssize_t vsize = VISIBLE_SIZE_TP(type);
+    if (vsize < 0) {
+        return NULL;
+    }
 
     obj = PyObject_GC_NewVar(PyStructSequence, type, size);
     if (obj == NULL)
         return NULL;
     /* Hack the size of the variable object, so invisible fields don't appear
      to Python code. */
-    Py_SET_SIZE(obj, VISIBLE_SIZE_TP(type));
+    Py_SET_SIZE(obj, vsize);
     for (i = 0; i < size; i++)
         obj->ob_item[i] = NULL;
 
@@ -94,7 +116,7 @@
         Py_XDECREF(obj->ob_item[i]);
     }
     PyObject_GC_Del(obj);
-    if (PyType_GetFlags(tp) & Py_TPFLAGS_HEAPTYPE) {
+    if (_PyType_HasFeature(tp, Py_TPFLAGS_HEAPTYPE)) {
         Py_DECREF(tp);
     }
 }
@@ -121,6 +143,19 @@
     PyStructSequence *res = NULL;
     Py_ssize_t len, min_len, max_len, i, n_unnamed_fields;
 
+    min_len = VISIBLE_SIZE_TP(type);
+    if (min_len < 0) {
+        return NULL;
+    }
+    max_len = REAL_SIZE_TP(type);
+    if (max_len < 0) {
+        return NULL;
+    }
+    n_unnamed_fields = UNNAMED_FIELDS_TP(type);
+    if (n_unnamed_fields < 0) {
+        return NULL;
+    }
+
     arg = PySequence_Fast(arg, "constructor requires a sequence");
 
     if (!arg) {
@@ -136,10 +171,6 @@
     }
 
     len = PySequence_Fast_GET_SIZE(arg);
-    min_len = VISIBLE_SIZE_TP(type);
-    max_len = REAL_SIZE_TP(type);
-    n_unnamed_fields = UNNAMED_FIELDS_TP(type);
-
     if (min_len != max_len) {
         if (len < min_len) {
             PyErr_Format(PyExc_TypeError,
@@ -177,18 +208,26 @@
         Py_INCREF(v);
         res->ob_item[i] = v;
     }
+    Py_DECREF(arg);
     for (; i < max_len; ++i) {
-        if (dict && (ob = PyDict_GetItemString(
-            dict, type->tp_members[i-n_unnamed_fields].name))) {
+        if (dict == NULL) {
+            ob = Py_None;
         }
         else {
-            ob = Py_None;
+            ob = _PyDict_GetItemStringWithError(dict,
+                type->tp_members[i-n_unnamed_fields].name);
+            if (ob == NULL) {
+                if (PyErr_Occurred()) {
+                    Py_DECREF(res);
+                    return NULL;
+                }
+                ob = Py_None;
+            }
         }
         Py_INCREF(ob);
         res->ob_item[i] = ob;
     }
 
-    Py_DECREF(arg);
     _PyObject_GC_TRACK(res);
     return (PyObject*) res;
 }
@@ -288,8 +327,14 @@
     Py_ssize_t n_fields, n_visible_fields, n_unnamed_fields, i;
 
     n_fields = REAL_SIZE(self);
+    if (n_fields < 0) {
+        return NULL;
+    }
     n_visible_fields = VISIBLE_SIZE(self);
     n_unnamed_fields = UNNAMED_FIELDS(self);
+    if (n_unnamed_fields < 0) {
+        return NULL;
+    }
     tup = _PyTuple_FromArray(self->ob_item, n_visible_fields);
     if (!tup)
         goto error;
@@ -356,7 +401,40 @@
     SET_DICT_FROM_SIZE(visible_length_key, desc->n_in_sequence);
     SET_DICT_FROM_SIZE(real_length_key, n_members);
     SET_DICT_FROM_SIZE(unnamed_fields_key, n_unnamed_members);
+
+    // Prepare and set __match_args__
+    Py_ssize_t i, k;
+    PyObject* keys = PyTuple_New(desc->n_in_sequence);
+    if (keys == NULL) {
+        return -1;
+    }
+
+    for (i = k = 0; i < desc->n_in_sequence; ++i) {
+        if (desc->fields[i].name == PyStructSequence_UnnamedField) {
+            continue;
+        }
+        PyObject* new_member = PyUnicode_FromString(desc->fields[i].name);
+        if (new_member == NULL) {
+            goto error;
+        }
+        PyTuple_SET_ITEM(keys, k, new_member);
+        k++;
+    }
+
+    if (_PyTuple_Resize(&keys, k) == -1) {
+        goto error;
+    }
+
+    if (PyDict_SetItemString(dict, match_args_key, keys) < 0) {
+        goto error;
+    }
+
+    Py_DECREF(keys);
     return 0;
+
+error:
+    Py_DECREF(keys);
+    return -1;
 }
 
 static void
@@ -382,8 +460,10 @@
     members[k].name = NULL;
 }
 
+
 int
-PyStructSequence_InitType2(PyTypeObject *type, PyStructSequence_Desc *desc)
+_PyStructSequence_InitType(PyTypeObject *type, PyStructSequence_Desc *desc,
+                           unsigned long tp_flags)
 {
     PyMemberDef *members;
     Py_ssize_t n_members, n_unnamed_members;
@@ -411,7 +491,7 @@
     type->tp_base = &PyTuple_Type;
     type->tp_methods = structseq_methods;
     type->tp_new = structseq_new;
-    type->tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC;
+    type->tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | tp_flags;
     type->tp_traverse = (traverseproc) structseq_traverse;
 
     n_members = count_members(desc, &n_unnamed_members);
@@ -424,14 +504,14 @@
     type->tp_members = members;
 
     if (PyType_Ready(type) < 0) {
-        PyMem_FREE(members);
+        PyMem_Free(members);
         return -1;
     }
     Py_INCREF(type);
 
     if (initialize_structseq_dict(
             desc, type->tp_dict, n_members, n_unnamed_members) < 0) {
-        PyMem_FREE(members);
+        PyMem_Free(members);
         Py_DECREF(type);
         return -1;
     }
@@ -439,6 +519,12 @@
     return 0;
 }
 
+int
+PyStructSequence_InitType2(PyTypeObject *type, PyStructSequence_Desc *desc)
+{
+    return _PyStructSequence_InitType(type, desc, 0);
+}
+
 void
 PyStructSequence_InitType(PyTypeObject *type, PyStructSequence_Desc *desc)
 {
@@ -449,7 +535,6 @@
 PyStructSequence_NewType(PyStructSequence_Desc *desc)
 {
     PyMemberDef *members;
-    PyObject *bases;
     PyTypeObject *type;
     PyType_Slot slots[8];
     PyType_Spec spec;
@@ -483,14 +568,8 @@
     spec.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC;
     spec.slots = slots;
 
-    bases = PyTuple_Pack(1, &PyTuple_Type);
-    if (bases == NULL) {
-        PyMem_FREE(members);
-        return NULL;
-    }
-    type = (PyTypeObject *)PyType_FromSpecWithBases(&spec, bases);
-    Py_DECREF(bases);
-    PyMem_FREE(members);
+    type = (PyTypeObject *)PyType_FromSpecWithBases(&spec, (PyObject *)&PyTuple_Type);
+    PyMem_Free(members);
     if (type == NULL) {
         return NULL;
     }
@@ -509,7 +588,8 @@
     if (_PyUnicode_FromId(&PyId_n_sequence_fields) == NULL
         || _PyUnicode_FromId(&PyId_n_fields) == NULL
         || _PyUnicode_FromId(&PyId_n_unnamed_fields) == NULL)
+    {
         return -1;
-
+    }
     return 0;
 }
diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c
index 9092c9f..6b1ab74 100644
--- a/Objects/tupleobject.c
+++ b/Objects/tupleobject.c
@@ -2,10 +2,10 @@
 /* Tuple object implementation */
 
 #include "Python.h"
-#include "pycore_abstract.h"   // _PyIndex_Check()
-#include "pycore_accu.h"
-#include "pycore_gc.h"         // _PyObject_GC_IS_TRACKED()
-#include "pycore_object.h"
+#include "pycore_abstract.h"      // _PyIndex_Check()
+#include "pycore_gc.h"            // _PyObject_GC_IS_TRACKED()
+#include "pycore_initconfig.h"    // _PyStatus_OK()
+#include "pycore_object.h"        // _PyObject_GC_TRACK()
 
 /*[clinic input]
 class tuple "PyTupleObject *" "&PyTuple_Type"
@@ -14,41 +14,36 @@
 
 #include "clinic/tupleobject.c.h"
 
-/* Speed optimization to avoid frequent malloc/free of small tuples */
-#ifndef PyTuple_MAXSAVESIZE
-#define PyTuple_MAXSAVESIZE     20  /* Largest tuple to save on free list */
-#endif
-#ifndef PyTuple_MAXFREELIST
-#define PyTuple_MAXFREELIST  2000  /* Maximum number of tuples of each size to save */
-#endif
 
 #if PyTuple_MAXSAVESIZE > 0
-/* Entries 1 up to PyTuple_MAXSAVESIZE are free lists, entry 0 is the empty
-   tuple () of which at most one instance will be allocated.
-*/
-static PyTupleObject *free_list[PyTuple_MAXSAVESIZE];
-static int numfree[PyTuple_MAXSAVESIZE];
+static struct _Py_tuple_state *
+get_tuple_state(void)
+{
+    PyInterpreterState *interp = _PyInterpreterState_GET();
+    return &interp->tuple;
+}
 #endif
 
+
 static inline void
 tuple_gc_track(PyTupleObject *op)
 {
     _PyObject_GC_TRACK(op);
 }
 
+
 /* Print summary info about the state of the optimized allocator */
 void
 _PyTuple_DebugMallocStats(FILE *out)
 {
 #if PyTuple_MAXSAVESIZE > 0
-    int i;
-    char buf[128];
-    for (i = 1; i < PyTuple_MAXSAVESIZE; i++) {
+    struct _Py_tuple_state *state = get_tuple_state();
+    for (int i = 1; i < PyTuple_MAXSAVESIZE; i++) {
+        char buf[128];
         PyOS_snprintf(buf, sizeof(buf),
                       "free %d-sized PyTupleObject", i);
-        _PyDebugAllocatorStats(out,
-                               buf,
-                               numfree[i], _PyObject_VAR_SIZE(&PyTuple_Type, i));
+        _PyDebugAllocatorStats(out, buf, state->numfree[i],
+                               _PyObject_VAR_SIZE(&PyTuple_Type, i));
     }
 #endif
 }
@@ -65,19 +60,30 @@
 tuple_alloc(Py_ssize_t size)
 {
     PyTupleObject *op;
+#if PyTuple_MAXSAVESIZE > 0
+    // If Python is built with the empty tuple singleton,
+    // tuple_alloc(0) must not be called.
+    assert(size != 0);
+#endif
     if (size < 0) {
         PyErr_BadInternalCall();
         return NULL;
     }
+
 #if PyTuple_MAXSAVESIZE > 0
-    if (size < PyTuple_MAXSAVESIZE && (op = free_list[size]) != NULL) {
+    struct _Py_tuple_state *state = get_tuple_state();
+#ifdef Py_DEBUG
+    // tuple_alloc() must not be called after _PyTuple_Fini()
+    assert(state->numfree[0] != -1);
+#endif
+    if (size < PyTuple_MAXSAVESIZE && (op = state->free_list[size]) != NULL) {
         assert(size != 0);
-        free_list[size] = (PyTupleObject *) op->ob_item[0];
-        numfree[size]--;
-        /* Inline PyObject_InitVar */
+        state->free_list[size] = (PyTupleObject *) op->ob_item[0];
+        state->numfree[size]--;
+        /* Inlined _PyObject_InitVar() without _PyType_HasFeature() test */
 #ifdef Py_TRACE_REFS
-        Py_SIZE(op) = size;
-        Py_TYPE(op) = &PyTuple_Type;
+        Py_SET_SIZE(op, size);
+        Py_SET_TYPE(op, &PyTuple_Type);
 #endif
         _Py_NewReference((PyObject *)op);
     }
@@ -96,15 +102,56 @@
     return op;
 }
 
+static int
+tuple_create_empty_tuple_singleton(struct _Py_tuple_state *state)
+{
+#if PyTuple_MAXSAVESIZE > 0
+    assert(state->free_list[0] == NULL);
+
+    PyTupleObject *op = PyObject_GC_NewVar(PyTupleObject, &PyTuple_Type, 0);
+    if (op == NULL) {
+        return -1;
+    }
+    // The empty tuple singleton is not tracked by the GC.
+    // It does not contain any Python object.
+
+    state->free_list[0] = op;
+    state->numfree[0]++;
+
+    assert(state->numfree[0] == 1);
+#endif
+    return 0;
+}
+
+
+static PyObject *
+tuple_get_empty(void)
+{
+#if PyTuple_MAXSAVESIZE > 0
+    struct _Py_tuple_state *state = get_tuple_state();
+    PyTupleObject *op = state->free_list[0];
+    // tuple_get_empty() must not be called before _PyTuple_Init()
+    // or after _PyTuple_Fini()
+    assert(op != NULL);
+#ifdef Py_DEBUG
+    assert(state->numfree[0] != -1);
+#endif
+
+    Py_INCREF(op);
+    return (PyObject *) op;
+#else
+    return PyTuple_New(0);
+#endif
+}
+
+
 PyObject *
 PyTuple_New(Py_ssize_t size)
 {
     PyTupleObject *op;
 #if PyTuple_MAXSAVESIZE > 0
-    if (size == 0 && free_list[0]) {
-        op = free_list[0];
-        Py_INCREF(op);
-        return (PyObject *) op;
+    if (size == 0) {
+        return tuple_get_empty();
     }
 #endif
     op = tuple_alloc(size);
@@ -114,13 +161,6 @@
     for (Py_ssize_t i = 0; i < size; i++) {
         op->ob_item[i] = NULL;
     }
-#if PyTuple_MAXSAVESIZE > 0
-    if (size == 0) {
-        free_list[0] = op;
-        ++numfree[0];
-        Py_INCREF(op);          /* extra INCREF so that this is never freed */
-    }
-#endif
     tuple_gc_track(op);
     return (PyObject *) op;
 }
@@ -201,7 +241,7 @@
     va_list vargs;
 
     if (n == 0) {
-        return PyTuple_New(0);
+        return tuple_get_empty();
     }
 
     va_start(vargs, n);
@@ -227,27 +267,33 @@
 static void
 tupledealloc(PyTupleObject *op)
 {
-    Py_ssize_t i;
     Py_ssize_t len =  Py_SIZE(op);
     PyObject_GC_UnTrack(op);
     Py_TRASHCAN_BEGIN(op, tupledealloc)
     if (len > 0) {
-        i = len;
-        while (--i >= 0)
+        Py_ssize_t i = len;
+        while (--i >= 0) {
             Py_XDECREF(op->ob_item[i]);
+        }
 #if PyTuple_MAXSAVESIZE > 0
-        if (len < PyTuple_MAXSAVESIZE &&
-            numfree[len] < PyTuple_MAXFREELIST &&
-            Py_IS_TYPE(op, &PyTuple_Type))
+        struct _Py_tuple_state *state = get_tuple_state();
+#ifdef Py_DEBUG
+        // tupledealloc() must not be called after _PyTuple_Fini()
+        assert(state->numfree[0] != -1);
+#endif
+        if (len < PyTuple_MAXSAVESIZE
+            && state->numfree[len] < PyTuple_MAXFREELIST
+            && Py_IS_TYPE(op, &PyTuple_Type))
         {
-            op->ob_item[0] = (PyObject *) free_list[len];
-            numfree[len]++;
-            free_list[len] = op;
+            op->ob_item[0] = (PyObject *) state->free_list[len];
+            state->numfree[len]++;
+            state->free_list[len] = op;
             goto done; /* return */
         }
 #endif
     }
     Py_TYPE(op)->tp_free((PyObject *)op);
+
 #if PyTuple_MAXSAVESIZE > 0
 done:
 #endif
@@ -414,7 +460,7 @@
 _PyTuple_FromArray(PyObject *const *src, Py_ssize_t n)
 {
     if (n == 0) {
-        return PyTuple_New(0);
+        return tuple_get_empty();
     }
 
     PyTupleObject *tuple = tuple_alloc(n);
@@ -475,16 +521,16 @@
                  Py_TYPE(bb)->tp_name);
         return NULL;
     }
-#define b ((PyTupleObject *)bb)
+    PyTupleObject *b = (PyTupleObject *)bb;
+
     if (Py_SIZE(b) == 0 && PyTuple_CheckExact(a)) {
         Py_INCREF(a);
         return (PyObject *)a;
     }
-    if (Py_SIZE(a) > PY_SSIZE_T_MAX - Py_SIZE(b))
-        return PyErr_NoMemory();
+    assert((size_t)Py_SIZE(a) + (size_t)Py_SIZE(b) < PY_SSIZE_T_MAX);
     size = Py_SIZE(a) + Py_SIZE(b);
     if (size == 0) {
-        return PyTuple_New(0);
+        return tuple_get_empty();
     }
 
     np = tuple_alloc(size);
@@ -507,7 +553,6 @@
     }
     tuple_gc_track(np);
     return (PyObject *)np;
-#undef b
 }
 
 static PyObject *
@@ -526,7 +571,7 @@
         }
     }
     if (Py_SIZE(a) == 0 || n <= 0) {
-        return PyTuple_New(0);
+        return tuple_get_empty();
     }
     if (n > PY_SSIZE_T_MAX / Py_SIZE(a))
         return PyErr_NoMemory();
@@ -702,10 +747,12 @@
     if (type != &PyTuple_Type)
         return tuple_subtype_new(type, iterable);
 
-    if (iterable == NULL)
-        return PyTuple_New(0);
-    else
+    if (iterable == NULL) {
+        return tuple_get_empty();
+    }
+    else {
         return PySequence_Tuple(iterable);
+    }
 }
 
 static PyObject *
@@ -724,7 +771,9 @@
     if (nargs) {
         return tuple_new_impl((PyTypeObject *)type, args[0]);
     }
-    return PyTuple_New(0);
+    else {
+        return tuple_get_empty();
+    }
 }
 
 static PyObject *
@@ -787,7 +836,7 @@
                                             &stop, step);
 
         if (slicelength <= 0) {
-            return PyTuple_New(0);
+            return tuple_get_empty();
         }
         else if (start == 0 && step == 1 &&
                  slicelength == PyTuple_GET_SIZE(self) &&
@@ -868,7 +917,8 @@
     0,                                          /* tp_setattro */
     0,                                          /* tp_as_buffer */
     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
-        Py_TPFLAGS_BASETYPE | Py_TPFLAGS_TUPLE_SUBCLASS, /* tp_flags */
+        Py_TPFLAGS_BASETYPE | Py_TPFLAGS_TUPLE_SUBCLASS |
+        _Py_TPFLAGS_MATCH_SELF | Py_TPFLAGS_SEQUENCE,  /* tp_flags */
     tuple_new__doc__,                           /* tp_doc */
     (traverseproc)tupletraverse,                /* tp_traverse */
     0,                                          /* tp_clear */
@@ -958,13 +1008,14 @@
 }
 
 void
-_PyTuple_ClearFreeList(void)
+_PyTuple_ClearFreeList(PyInterpreterState *interp)
 {
 #if PyTuple_MAXSAVESIZE > 0
+    struct _Py_tuple_state *state = &interp->tuple;
     for (Py_ssize_t i = 1; i < PyTuple_MAXSAVESIZE; i++) {
-        PyTupleObject *p = free_list[i];
-        free_list[i] = NULL;
-        numfree[i] = 0;
+        PyTupleObject *p = state->free_list[i];
+        state->free_list[i] = NULL;
+        state->numfree[i] = 0;
         while (p) {
             PyTupleObject *q = p;
             p = (PyTupleObject *)(p->ob_item[0]);
@@ -975,15 +1026,30 @@
 #endif
 }
 
+
+PyStatus
+_PyTuple_Init(PyInterpreterState *interp)
+{
+    struct _Py_tuple_state *state = &interp->tuple;
+    if (tuple_create_empty_tuple_singleton(state) < 0) {
+        return _PyStatus_NO_MEMORY();
+    }
+    return _PyStatus_OK();
+}
+
+
 void
-_PyTuple_Fini(void)
+_PyTuple_Fini(PyInterpreterState *interp)
 {
 #if PyTuple_MAXSAVESIZE > 0
-    /* empty tuples are used all over the place and applications may
-     * rely on the fact that an empty tuple is a singleton. */
-    Py_CLEAR(free_list[0]);
-
-    _PyTuple_ClearFreeList();
+    struct _Py_tuple_state *state = &interp->tuple;
+    // The empty tuple singleton must not be tracked by the GC
+    assert(!_PyObject_GC_IS_TRACKED(state->free_list[0]));
+    Py_CLEAR(state->free_list[0]);
+    _PyTuple_ClearFreeList(interp);
+#ifdef Py_DEBUG
+    state->numfree[0] = -1;
+#endif
 #endif
 }
 
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index acbe3fa..b3ba120 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -2,10 +2,13 @@
 
 #include "Python.h"
 #include "pycore_call.h"
+#include "pycore_compile.h"       // _Py_Mangle()
 #include "pycore_initconfig.h"
+#include "pycore_moduleobject.h"  // _PyModule_GetDef()
 #include "pycore_object.h"
 #include "pycore_pyerrors.h"
 #include "pycore_pystate.h"       // _PyThreadState_GET()
+#include "pycore_unionobject.h"   // _Py_union_type_or
 #include "frameobject.h"
 #include "structmember.h"         // PyMemberDef
 
@@ -19,53 +22,45 @@
 
 #include "clinic/typeobject.c.h"
 
-#define MCACHE
-
-#ifdef MCACHE
-/* Support type attribute cache */
+/* Support type attribute lookup cache */
 
 /* The cache can keep references to the names alive for longer than
    they normally would.  This is why the maximum size is limited to
    MCACHE_MAX_ATTR_SIZE, since it might be a problem if very large
    strings are used as attribute names. */
 #define MCACHE_MAX_ATTR_SIZE    100
-#define MCACHE_SIZE_EXP         12
 #define MCACHE_HASH(version, name_hash)                                 \
         (((unsigned int)(version) ^ (unsigned int)(name_hash))          \
          & ((1 << MCACHE_SIZE_EXP) - 1))
 
 #define MCACHE_HASH_METHOD(type, name)                                  \
-        MCACHE_HASH((type)->tp_version_tag,                     \
-                    ((PyASCIIObject *)(name))->hash)
+    MCACHE_HASH((type)->tp_version_tag, ((Py_ssize_t)(name)) >> 3)
 #define MCACHE_CACHEABLE_NAME(name)                             \
         PyUnicode_CheckExact(name) &&                           \
         PyUnicode_IS_READY(name) &&                             \
-        PyUnicode_GET_LENGTH(name) <= MCACHE_MAX_ATTR_SIZE
+        (PyUnicode_GET_LENGTH(name) <= MCACHE_MAX_ATTR_SIZE)
 
-struct method_cache_entry {
-    unsigned int version;
-    PyObject *name;             /* reference to exactly a str or None */
-    PyObject *value;            /* borrowed */
-};
-
-static struct method_cache_entry method_cache[1 << MCACHE_SIZE_EXP];
+// bpo-42745: next_version_tag remains shared by all interpreters because of static types
+// Used to set PyTypeObject.tp_version_tag
 static unsigned int next_version_tag = 0;
+
+typedef struct PySlot_Offset {
+    short subslot_offset;
+    short slot_offset;
+} PySlot_Offset;
+
+
+/* bpo-40521: Interned strings are shared by all subinterpreters */
+#ifndef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+#  define INTERN_NAME_STRINGS
 #endif
 
-#define MCACHE_STATS 0
-
-#if MCACHE_STATS
-static size_t method_cache_hits = 0;
-static size_t method_cache_misses = 0;
-static size_t method_cache_collisions = 0;
-#endif
-
-#define INTERN_NAME_STRINGS
-
 /* alphabetical order */
 _Py_IDENTIFIER(__abstractmethods__);
+_Py_IDENTIFIER(__annotations__);
 _Py_IDENTIFIER(__class__);
 _Py_IDENTIFIER(__class_getitem__);
+_Py_IDENTIFIER(__classcell__);
 _Py_IDENTIFIER(__delitem__);
 _Py_IDENTIFIER(__dict__);
 _Py_IDENTIFIER(__doc__);
@@ -77,8 +72,10 @@
 _Py_IDENTIFIER(__module__);
 _Py_IDENTIFIER(__name__);
 _Py_IDENTIFIER(__new__);
+_Py_IDENTIFIER(__qualname__);
 _Py_IDENTIFIER(__set_name__);
 _Py_IDENTIFIER(__setitem__);
+_Py_IDENTIFIER(__weakref__);
 _Py_IDENTIFIER(builtins);
 _Py_IDENTIFIER(mro);
 
@@ -166,6 +163,11 @@
     CHECK(!(type->tp_flags & Py_TPFLAGS_READYING));
     CHECK(type->tp_dict != NULL);
 
+    if (type->tp_flags & Py_TPFLAGS_DISALLOW_INSTANTIATION) {
+        CHECK(type->tp_new == NULL);
+        CHECK(_PyDict_ContainsId(type->tp_dict, &PyId___new__) == 0);
+    }
+
     return 1;
 #undef CHECK
 }
@@ -217,46 +219,99 @@
     return PyUnicode_FromStringAndSize(start, end - start);
 }
 
+
+static struct type_cache*
+get_type_cache(void)
+{
+    PyInterpreterState *interp = _PyInterpreterState_GET();
+    return &interp->type_cache;
+}
+
+
+static void
+type_cache_clear(struct type_cache *cache, int use_none)
+{
+    for (Py_ssize_t i = 0; i < (1 << MCACHE_SIZE_EXP); i++) {
+        struct type_cache_entry *entry = &cache->hashtable[i];
+        entry->version = 0;
+        if (use_none) {
+            // Set to None so _PyType_Lookup() can use Py_SETREF(),
+            // rather than using slower Py_XSETREF().
+            Py_XSETREF(entry->name, Py_NewRef(Py_None));
+        }
+        else {
+            Py_CLEAR(entry->name);
+        }
+        entry->value = NULL;
+    }
+
+    // Mark all version tags as invalid
+    PyType_Modified(&PyBaseObject_Type);
+}
+
+
+void
+_PyType_InitCache(PyInterpreterState *interp)
+{
+    struct type_cache *cache = &interp->type_cache;
+    for (Py_ssize_t i = 0; i < (1 << MCACHE_SIZE_EXP); i++) {
+        struct type_cache_entry *entry = &cache->hashtable[i];
+        assert(entry->name == NULL);
+
+        entry->version = 0;
+        // Set to None so _PyType_Lookup() can use Py_SETREF(),
+        // rather than using slower Py_XSETREF().
+        entry->name = Py_NewRef(Py_None);
+        entry->value = NULL;
+    }
+}
+
+
+static unsigned int
+_PyType_ClearCache(PyInterpreterState *interp)
+{
+    struct type_cache *cache = &interp->type_cache;
+#if MCACHE_STATS
+    size_t total = cache->hits + cache->collisions + cache->misses;
+    fprintf(stderr, "-- Method cache hits        = %zd (%d%%)\n",
+            cache->hits, (int) (100.0 * cache->hits / total));
+    fprintf(stderr, "-- Method cache true misses = %zd (%d%%)\n",
+            cache->misses, (int) (100.0 * cache->misses / total));
+    fprintf(stderr, "-- Method cache collisions  = %zd (%d%%)\n",
+            cache->collisions, (int) (100.0 * cache->collisions / total));
+    fprintf(stderr, "-- Method cache size        = %zd KiB\n",
+            sizeof(cache->hashtable) / 1024);
+#endif
+
+    unsigned int cur_version_tag = next_version_tag - 1;
+    if (_Py_IsMainInterpreter(interp)) {
+        next_version_tag = 0;
+    }
+
+    type_cache_clear(cache, 0);
+
+    return cur_version_tag;
+}
+
+
 unsigned int
 PyType_ClearCache(void)
 {
-#ifdef MCACHE
-    Py_ssize_t i;
-    unsigned int cur_version_tag = next_version_tag - 1;
-
-#if MCACHE_STATS
-    size_t total = method_cache_hits + method_cache_collisions + method_cache_misses;
-    fprintf(stderr, "-- Method cache hits        = %zd (%d%%)\n",
-            method_cache_hits, (int) (100.0 * method_cache_hits / total));
-    fprintf(stderr, "-- Method cache true misses = %zd (%d%%)\n",
-            method_cache_misses, (int) (100.0 * method_cache_misses / total));
-    fprintf(stderr, "-- Method cache collisions  = %zd (%d%%)\n",
-            method_cache_collisions, (int) (100.0 * method_cache_collisions / total));
-    fprintf(stderr, "-- Method cache size        = %zd KiB\n",
-            sizeof(method_cache) / 1024);
-#endif
-
-    for (i = 0; i < (1 << MCACHE_SIZE_EXP); i++) {
-        method_cache[i].version = 0;
-        Py_CLEAR(method_cache[i].name);
-        method_cache[i].value = NULL;
-    }
-    next_version_tag = 0;
-    /* mark all version tags as invalid */
-    PyType_Modified(&PyBaseObject_Type);
-    return cur_version_tag;
-#else
-    return 0;
-#endif
+    PyInterpreterState *interp = _PyInterpreterState_GET();
+    return _PyType_ClearCache(interp);
 }
 
+
 void
-_PyType_Fini(void)
+_PyType_Fini(PyInterpreterState *interp)
 {
-    PyType_ClearCache();
-    clear_slotdefs();
+    _PyType_ClearCache(interp);
+    if (_Py_IsMainInterpreter(interp)) {
+        clear_slotdefs();
+    }
 }
 
+
 void
 PyType_Modified(PyTypeObject *type)
 {
@@ -266,10 +321,6 @@
 
        Invariants:
 
-       - Py_TPFLAGS_VALID_VERSION_TAG is never set if
-         Py_TPFLAGS_HAVE_VERSION_TAG is not set (in case of a
-         bizarre MRO, see type_mro_modified()).
-
        - before Py_TPFLAGS_VALID_VERSION_TAG can be set on a type,
          it must first be set on all super types.
 
@@ -298,6 +349,7 @@
         }
     }
     type->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
+    type->tp_version_tag = 0; /* 0 is not a valid version tag */
 }
 
 static void
@@ -320,9 +372,6 @@
     PyObject *mro_meth = NULL;
     PyObject *type_mro_meth = NULL;
 
-    if (!_PyType_HasFeature(type, Py_TPFLAGS_HAVE_VERSION_TAG))
-        return;
-
     if (custom) {
         mro_meth = lookup_maybe_method(
             (PyObject *)type, &PyId_mro, &unbound);
@@ -345,8 +394,7 @@
         assert(PyType_Check(b));
         cls = (PyTypeObject *)b;
 
-        if (!_PyType_HasFeature(cls, Py_TPFLAGS_HAVE_VERSION_TAG) ||
-            !PyType_IsSubtype(type, cls)) {
+        if (!PyType_IsSubtype(type, cls)) {
             goto clear;
         }
     }
@@ -354,13 +402,12 @@
  clear:
     Py_XDECREF(mro_meth);
     Py_XDECREF(type_mro_meth);
-    type->tp_flags &= ~(Py_TPFLAGS_HAVE_VERSION_TAG|
-                        Py_TPFLAGS_VALID_VERSION_TAG);
+    type->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
+    type->tp_version_tag = 0; /* 0 is not a valid version tag */
 }
 
-#ifdef MCACHE
 static int
-assign_version_tag(PyTypeObject *type)
+assign_version_tag(struct type_cache *cache, PyTypeObject *type)
 {
     /* Ensure that the tp_version_tag is valid and set
        Py_TPFLAGS_VALID_VERSION_TAG.  To respect the invariant, this
@@ -372,8 +419,6 @@
 
     if (_PyType_HasFeature(type, Py_TPFLAGS_VALID_VERSION_TAG))
         return 1;
-    if (!_PyType_HasFeature(type, Py_TPFLAGS_HAVE_VERSION_TAG))
-        return 0;
     if (!_PyType_HasFeature(type, Py_TPFLAGS_READY))
         return 0;
 
@@ -381,31 +426,22 @@
     /* for stress-testing: next_version_tag &= 0xFF; */
 
     if (type->tp_version_tag == 0) {
-        /* wrap-around or just starting Python - clear the whole
-           cache by filling names with references to Py_None.
-           Values are also set to NULL for added protection, as they
-           are borrowed reference */
-        for (i = 0; i < (1 << MCACHE_SIZE_EXP); i++) {
-            method_cache[i].value = NULL;
-            Py_INCREF(Py_None);
-            Py_XSETREF(method_cache[i].name, Py_None);
-        }
-        /* mark all version tags as invalid */
-        PyType_Modified(&PyBaseObject_Type);
-        return 1;
+        // Wrap-around or just starting Python - clear the whole cache
+        type_cache_clear(cache, 1);
+        return 0;
     }
+
     bases = type->tp_bases;
     n = PyTuple_GET_SIZE(bases);
     for (i = 0; i < n; i++) {
         PyObject *b = PyTuple_GET_ITEM(bases, i);
         assert(PyType_Check(b));
-        if (!assign_version_tag((PyTypeObject *)b))
+        if (!assign_version_tag(cache, (PyTypeObject *)b))
             return 0;
     }
     type->tp_flags |= Py_TPFLAGS_VALID_VERSION_TAG;
     return 1;
 }
-#endif
 
 
 static PyMemberDef type_members[] = {
@@ -424,14 +460,16 @@
 static int
 check_set_special_type_attr(PyTypeObject *type, PyObject *value, const char *name)
 {
-    if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) {
+    if (_PyType_HasFeature(type, Py_TPFLAGS_IMMUTABLETYPE)) {
         PyErr_Format(PyExc_TypeError,
-                     "can't set %s.%s", type->tp_name, name);
+                     "cannot set '%s' attribute of immutable type '%s'",
+                     name, type->tp_name);
         return 0;
     }
     if (!value) {
         PyErr_Format(PyExc_TypeError,
-                     "can't delete %s.%s", type->tp_name, name);
+                     "cannot delete '%s' attribute of immutable type '%s'",
+                     name, type->tp_name);
         return 0;
     }
 
@@ -894,6 +932,75 @@
     return _PyDict_SetItemId(type->tp_dict, &PyId___doc__, value);
 }
 
+static PyObject *
+type_get_annotations(PyTypeObject *type, void *context)
+{
+    if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) {
+        PyErr_Format(PyExc_AttributeError, "type object '%s' has no attribute '__annotations__'", type->tp_name);
+        return NULL;
+    }
+
+    PyObject *annotations;
+    /* there's no _PyDict_GetItemId without WithError, so let's LBYL. */
+    if (_PyDict_ContainsId(type->tp_dict, &PyId___annotations__)) {
+        annotations = _PyDict_GetItemIdWithError(type->tp_dict, &PyId___annotations__);
+        /*
+        ** _PyDict_GetItemIdWithError could still fail,
+        ** for instance with a well-timed Ctrl-C or a MemoryError.
+        ** so let's be totally safe.
+        */
+        if (annotations) {
+            if (Py_TYPE(annotations)->tp_descr_get) {
+                annotations = Py_TYPE(annotations)->tp_descr_get(annotations, NULL,
+                                                       (PyObject *)type);
+            } else {
+                Py_INCREF(annotations);
+            }
+        }
+    } else {
+        annotations = PyDict_New();
+        if (annotations) {
+            int result = _PyDict_SetItemId(type->tp_dict, &PyId___annotations__, annotations);
+            if (result) {
+                Py_CLEAR(annotations);
+            } else {
+                PyType_Modified(type);
+            }
+        }
+    }
+    return annotations;
+}
+
+static int
+type_set_annotations(PyTypeObject *type, PyObject *value, void *context)
+{
+    if (_PyType_HasFeature(type, Py_TPFLAGS_IMMUTABLETYPE)) {
+        PyErr_Format(PyExc_TypeError,
+                     "cannot set '__annotations__' attribute of immutable type '%s'",
+                     type->tp_name);
+        return -1;
+    }
+
+    int result;
+    if (value != NULL) {
+        /* set */
+        result = _PyDict_SetItemId(type->tp_dict, &PyId___annotations__, value);
+    } else {
+        /* delete */
+        if (!_PyDict_ContainsId(type->tp_dict, &PyId___annotations__)) {
+            PyErr_Format(PyExc_AttributeError, "__annotations__");
+            return -1;
+        }
+        result = _PyDict_DelItemId(type->tp_dict, &PyId___annotations__);
+    }
+
+    if (result == 0) {
+        PyType_Modified(type);
+    }
+    return result;
+}
+
+
 /*[clinic input]
 type.__instancecheck__ -> bool
 
@@ -937,6 +1044,7 @@
     {"__dict__",  (getter)type_dict,  NULL, NULL},
     {"__doc__", (getter)type_get_doc, (setter)type_set_doc, NULL},
     {"__text_signature__", (getter)type_get_text_signature, NULL, NULL},
+    {"__annotations__", (getter)type_get_annotations, (setter)type_set_annotations, NULL},
     {0}
 };
 
@@ -1006,8 +1114,7 @@
 
     if (type->tp_new == NULL) {
         _PyErr_Format(tstate, PyExc_TypeError,
-                      "cannot create '%.100s' instances",
-                      type->tp_name);
+                      "cannot create '%s' instances", type->tp_name);
         return NULL;
     }
 
@@ -1047,7 +1154,7 @@
         obj = _PyObject_GC_Malloc(size);
     }
     else {
-        obj = (PyObject *)PyObject_MALLOC(size);
+        obj = (PyObject *)PyObject_Malloc(size);
     }
 
     if (obj == NULL) {
@@ -1057,10 +1164,10 @@
     memset(obj, '\0', size);
 
     if (type->tp_itemsize == 0) {
-        (void)PyObject_INIT(obj, type);
+        _PyObject_Init(obj, type);
     }
     else {
-        (void) PyObject_INIT_VAR((PyVarObject *)obj, type, nitems);
+        _PyObject_InitVar((PyVarObject *)obj, type, nitems);
     }
 
     if (_PyType_IS_GC(type)) {
@@ -1231,14 +1338,22 @@
         /* Extract the type again; tp_del may have changed it */
         type = Py_TYPE(self);
 
+        // Don't read type memory after calling basedealloc() since basedealloc()
+        // can deallocate the type and free its memory.
+        int type_needs_decref = (type->tp_flags & Py_TPFLAGS_HEAPTYPE
+                                 && !(base->tp_flags & Py_TPFLAGS_HEAPTYPE));
+
         /* Call the base tp_dealloc() */
         assert(basedealloc);
         basedealloc(self);
 
-       /* Only decref if the base type is not already a heap allocated type.
-          Otherwise, basedealloc should have decref'd it already */
-        if (type->tp_flags & Py_TPFLAGS_HEAPTYPE && !(base->tp_flags & Py_TPFLAGS_HEAPTYPE))
+        /* Can't reference self beyond this point. It's possible tp_del switched
+           our type from a HEAPTYPE to a non-HEAPTYPE, so be careful about
+           reference counting. Only decref if the base type is not already a heap
+           allocated type. Otherwise, basedealloc should have decref'd it already */
+        if (type_needs_decref) {
             Py_DECREF(type);
+        }
 
         /* Done */
         return;
@@ -1333,6 +1448,12 @@
     if (_PyType_IS_GC(base)) {
         _PyObject_GC_TRACK(self);
     }
+
+    // Don't read type memory after calling basedealloc() since basedealloc()
+    // can deallocate the type and free its memory.
+    int type_needs_decref = (type->tp_flags & Py_TPFLAGS_HEAPTYPE
+                             && !(base->tp_flags & Py_TPFLAGS_HEAPTYPE));
+
     assert(basedealloc);
     basedealloc(self);
 
@@ -1340,8 +1461,9 @@
        our type from a HEAPTYPE to a non-HEAPTYPE, so be careful about
        reference counting. Only decref if the base type is not already a heap
        allocated type. Otherwise, basedealloc should have decref'd it already */
-    if (type->tp_flags & Py_TPFLAGS_HEAPTYPE && !(base->tp_flags & Py_TPFLAGS_HEAPTYPE))
-      Py_DECREF(type);
+    if (type_needs_decref) {
+        Py_DECREF(type);
+    }
 
   endlabel:
     Py_TRASHCAN_END
@@ -1767,7 +1889,7 @@
     }
 
   out:
-    PyMem_Del(remain);
+    PyMem_Free(remain);
 
     return res;
 }
@@ -1780,7 +1902,7 @@
     PyObject **to_merge;
     Py_ssize_t i, n;
 
-    if (type->tp_dict == NULL) {
+    if (!_PyType_IsReady(type)) {
         if (PyType_Ready(type) < 0)
             return NULL;
     }
@@ -1847,7 +1969,7 @@
 
     result = PyList_New(1);
     if (result == NULL) {
-        PyMem_Del(to_merge);
+        PyMem_Free(to_merge);
         return NULL;
     }
 
@@ -1857,7 +1979,7 @@
         Py_CLEAR(result);
     }
 
-    PyMem_Del(to_merge);
+    PyMem_Free(to_merge);
     return result;
 }
 
@@ -1952,14 +2074,20 @@
 
     new_mro = PySequence_Tuple(mro_result);
     Py_DECREF(mro_result);
-    if (new_mro == NULL)
+    if (new_mro == NULL) {
         return NULL;
+    }
+
+    if (PyTuple_GET_SIZE(new_mro) == 0) {
+        Py_DECREF(new_mro);
+        PyErr_Format(PyExc_TypeError, "type MRO must not be empty");
+        return NULL;
+    }
 
     if (custom && mro_check(type, new_mro) < 0) {
         Py_DECREF(new_mro);
         return NULL;
     }
-
     return new_mro;
 }
 
@@ -1999,8 +2127,9 @@
     new_mro = mro_invoke(type);  /* might cause reentrance */
     reent = (type->tp_mro != old_mro);
     Py_XDECREF(old_mro);
-    if (new_mro == NULL)
+    if (new_mro == NULL) {
         return -1;
+    }
 
     if (reent) {
         Py_DECREF(new_mro);
@@ -2049,7 +2178,7 @@
             return NULL;
         }
         base_i = (PyTypeObject *)base_proto;
-        if (base_i->tp_dict == NULL) {
+        if (!_PyType_IsReady(base_i)) {
             if (PyType_Ready(base_i) < 0)
                 return NULL;
         }
@@ -2126,8 +2255,8 @@
 static int object_init(PyObject *, PyObject *, PyObject *);
 static int update_slot(PyTypeObject *, PyObject *);
 static void fixup_slot_dispatchers(PyTypeObject *);
-static int set_names(PyTypeObject *);
-static int init_subclass(PyTypeObject *, PyObject *);
+static int type_new_set_names(PyTypeObject *);
+static int type_new_init_subclass(PyTypeObject *, PyObject *);
 
 /*
  * Helpers for  __dict__ descriptor.  We don't want to expose the dicts
@@ -2372,398 +2501,467 @@
     return winner;
 }
 
+
+// Forward declaration
 static PyObject *
-type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
+type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds);
+
+typedef struct {
+    PyTypeObject *metatype;
+    PyObject *args;
+    PyObject *kwds;
+    PyObject *orig_dict;
+    PyObject *name;
+    PyObject *bases;
+    PyTypeObject *base;
+    PyObject *slots;
+    Py_ssize_t nslot;
+    int add_dict;
+    int add_weak;
+    int may_add_dict;
+    int may_add_weak;
+} type_new_ctx;
+
+
+/* Check for valid slot names and two special cases */
+static int
+type_new_visit_slots(type_new_ctx *ctx)
 {
-    PyObject *name, *bases = NULL, *orig_dict, *dict = NULL;
-    PyObject *qualname, *slots = NULL, *tmp, *newslots, *cell;
-    PyTypeObject *type = NULL, *base, *tmptype, *winner;
-    PyHeapTypeObject *et;
-    PyMemberDef *mp;
-    Py_ssize_t i, nbases, nslots, slotoffset, name_size;
-    int j, may_add_dict, may_add_weak, add_dict, add_weak;
-    _Py_IDENTIFIER(__qualname__);
-    _Py_IDENTIFIER(__slots__);
-    _Py_IDENTIFIER(__classcell__);
-
-    assert(args != NULL && PyTuple_Check(args));
-    assert(kwds == NULL || PyDict_Check(kwds));
-
-    /* Check arguments: (name, bases, dict) */
-    if (!PyArg_ParseTuple(args, "UO!O!:type.__new__", &name, &PyTuple_Type,
-                          &bases, &PyDict_Type, &orig_dict))
-        return NULL;
-
-    /* Adjust for empty tuple bases */
-    nbases = PyTuple_GET_SIZE(bases);
-    if (nbases == 0) {
-        base = &PyBaseObject_Type;
-        bases = PyTuple_Pack(1, base);
-        if (bases == NULL)
-            return NULL;
-        nbases = 1;
-    }
-    else {
-        _Py_IDENTIFIER(__mro_entries__);
-        for (i = 0; i < nbases; i++) {
-            tmp = PyTuple_GET_ITEM(bases, i);
-            if (PyType_Check(tmp)) {
-                continue;
-            }
-            if (_PyObject_LookupAttrId(tmp, &PyId___mro_entries__, &tmp) < 0) {
-                return NULL;
-            }
-            if (tmp != NULL) {
+    PyObject *slots = ctx->slots;
+    Py_ssize_t nslot = ctx->nslot;
+    for (Py_ssize_t i = 0; i < nslot; i++) {
+        PyObject *name = PyTuple_GET_ITEM(slots, i);
+        if (!valid_identifier(name)) {
+            return -1;
+        }
+        assert(PyUnicode_Check(name));
+        if (_PyUnicode_EqualToASCIIId(name, &PyId___dict__)) {
+            if (!ctx->may_add_dict || ctx->add_dict != 0) {
                 PyErr_SetString(PyExc_TypeError,
-                                "type() doesn't support MRO entry resolution; "
-                                "use types.new_class()");
-                Py_DECREF(tmp);
-                return NULL;
+                    "__dict__ slot disallowed: "
+                    "we already got one");
+                return -1;
             }
+            ctx->add_dict++;
         }
-        /* Search the bases for the proper metatype to deal with this: */
-        winner = _PyType_CalculateMetaclass(metatype, bases);
-        if (winner == NULL) {
-            return NULL;
+        if (_PyUnicode_EqualToASCIIId(name, &PyId___weakref__)) {
+            if (!ctx->may_add_weak || ctx->add_weak != 0) {
+                PyErr_SetString(PyExc_TypeError,
+                    "__weakref__ slot disallowed: "
+                    "either we already got one, "
+                    "or __itemsize__ != 0");
+                return -1;
+            }
+            ctx->add_weak++;
         }
+    }
+    return 0;
+}
 
-        if (winner != metatype) {
-            if (winner->tp_new != type_new) /* Pass it to the winner */
-                return winner->tp_new(winner, args, kwds);
-            metatype = winner;
-        }
 
-        /* Calculate best base, and check that all bases are type objects */
-        base = best_base(bases);
-        if (base == NULL) {
-            return NULL;
-        }
+/* Copy slots into a list, mangle names and sort them.
+   Sorted names are needed for __class__ assignment.
+   Convert them back to tuple at the end.
+*/
+static PyObject*
+type_new_copy_slots(type_new_ctx *ctx, PyObject *dict)
+{
+    PyObject *slots = ctx->slots;
+    Py_ssize_t nslot = ctx->nslot;
 
-        Py_INCREF(bases);
+    Py_ssize_t new_nslot = nslot - ctx->add_dict - ctx->add_weak;
+    PyObject *new_slots = PyList_New(new_nslot);
+    if (new_slots == NULL) {
+        return NULL;
     }
 
-    /* Use "goto error" from this point on as we now own the reference to "bases". */
+    Py_ssize_t j = 0;
+    for (Py_ssize_t i = 0; i < nslot; i++) {
+        PyObject *slot = PyTuple_GET_ITEM(slots, i);
+        if ((ctx->add_dict &&
+             _PyUnicode_EqualToASCIIId(slot, &PyId___dict__)) ||
+            (ctx->add_weak &&
+             _PyUnicode_EqualToASCIIString(slot, "__weakref__")))
+        {
+            continue;
+        }
 
-    dict = PyDict_Copy(orig_dict);
-    if (dict == NULL)
-        goto error;
-
-    /* Check for a __slots__ sequence variable in dict, and count it */
-    slots = _PyDict_GetItemIdWithError(dict, &PyId___slots__);
-    nslots = 0;
-    add_dict = 0;
-    add_weak = 0;
-    may_add_dict = base->tp_dictoffset == 0;
-    may_add_weak = base->tp_weaklistoffset == 0 && base->tp_itemsize == 0;
-    if (slots == NULL) {
-        if (PyErr_Occurred()) {
+        slot =_Py_Mangle(ctx->name, slot);
+        if (!slot) {
             goto error;
         }
-        if (may_add_dict) {
-            add_dict++;
+        PyList_SET_ITEM(new_slots, j, slot);
+
+        int r = PyDict_Contains(dict, slot);
+        if (r < 0) {
+            goto error;
         }
-        if (may_add_weak) {
-            add_weak++;
+        if (r > 0) {
+            /* CPython inserts __qualname__ and __classcell__ (when needed)
+               into the namespace when creating a class.  They will be deleted
+               below so won't act as class variables. */
+            if (!_PyUnicode_EqualToASCIIId(slot, &PyId___qualname__) &&
+                !_PyUnicode_EqualToASCIIId(slot, &PyId___classcell__))
+            {
+                PyErr_Format(PyExc_ValueError,
+                             "%R in __slots__ conflicts with class variable",
+                             slot);
+                goto error;
+            }
+        }
+
+        j++;
+    }
+    assert(j == new_nslot);
+
+    if (PyList_Sort(new_slots) == -1) {
+        goto error;
+    }
+
+    PyObject *tuple = PyList_AsTuple(new_slots);
+    Py_DECREF(new_slots);
+    if (tuple == NULL) {
+        return NULL;
+    }
+
+    assert(PyTuple_GET_SIZE(tuple) == new_nslot);
+    return tuple;
+
+error:
+    Py_DECREF(new_slots);
+    return NULL;
+}
+
+
+static void
+type_new_slots_bases(type_new_ctx *ctx)
+{
+    Py_ssize_t nbases = PyTuple_GET_SIZE(ctx->bases);
+    if (nbases > 1 &&
+        ((ctx->may_add_dict && ctx->add_dict == 0) ||
+         (ctx->may_add_weak && ctx->add_weak == 0)))
+    {
+        for (Py_ssize_t i = 0; i < nbases; i++) {
+            PyObject *base = PyTuple_GET_ITEM(ctx->bases, i);
+            if (base == (PyObject *)ctx->base) {
+                /* Skip primary base */
+                continue;
+            }
+
+            assert(PyType_Check(base));
+            PyTypeObject *type = (PyTypeObject *)base;
+            if (ctx->may_add_dict && ctx->add_dict == 0 &&
+                type->tp_dictoffset != 0)
+            {
+                ctx->add_dict++;
+            }
+            if (ctx->may_add_weak && ctx->add_weak == 0 &&
+                type->tp_weaklistoffset != 0)
+            {
+                ctx->add_weak++;
+            }
+            if (ctx->may_add_dict && ctx->add_dict == 0) {
+                continue;
+            }
+            if (ctx->may_add_weak && ctx->add_weak == 0) {
+                continue;
+            }
+            /* Nothing more to check */
+            break;
+        }
+    }
+}
+
+
+static int
+type_new_slots_impl(type_new_ctx *ctx, PyObject *dict)
+{
+    /* Are slots allowed? */
+    if (ctx->nslot > 0 && ctx->base->tp_itemsize != 0) {
+        PyErr_Format(PyExc_TypeError,
+                     "nonempty __slots__ not supported for subtype of '%s'",
+                     ctx->base->tp_name);
+        return -1;
+    }
+
+    if (type_new_visit_slots(ctx) < 0) {
+        return -1;
+    }
+
+    PyObject *new_slots = type_new_copy_slots(ctx, dict);
+    if (new_slots == NULL) {
+        return -1;
+    }
+    assert(PyTuple_CheckExact(new_slots));
+
+    Py_XSETREF(ctx->slots, new_slots);
+    ctx->nslot = PyTuple_GET_SIZE(new_slots);
+
+    /* Secondary bases may provide weakrefs or dict */
+    type_new_slots_bases(ctx);
+    return 0;
+}
+
+
+static Py_ssize_t
+type_new_slots(type_new_ctx *ctx, PyObject *dict)
+{
+    // Check for a __slots__ sequence variable in dict, and count it
+    ctx->add_dict = 0;
+    ctx->add_weak = 0;
+    ctx->may_add_dict = (ctx->base->tp_dictoffset == 0);
+    ctx->may_add_weak = (ctx->base->tp_weaklistoffset == 0
+                         && ctx->base->tp_itemsize == 0);
+
+    if (ctx->slots == NULL) {
+        if (ctx->may_add_dict) {
+            ctx->add_dict++;
+        }
+        if (ctx->may_add_weak) {
+            ctx->add_weak++;
         }
     }
     else {
         /* Have slots */
-
-        /* Make it into a tuple */
-        if (PyUnicode_Check(slots))
-            slots = PyTuple_Pack(1, slots);
-        else
-            slots = PySequence_Tuple(slots);
-        if (slots == NULL)
-            goto error;
-        assert(PyTuple_Check(slots));
-
-        /* Are slots allowed? */
-        nslots = PyTuple_GET_SIZE(slots);
-        if (nslots > 0 && base->tp_itemsize != 0) {
-            PyErr_Format(PyExc_TypeError,
-                         "nonempty __slots__ "
-                         "not supported for subtype of '%s'",
-                         base->tp_name);
-            goto error;
-        }
-
-        /* Check for valid slot names and two special cases */
-        for (i = 0; i < nslots; i++) {
-            PyObject *tmp = PyTuple_GET_ITEM(slots, i);
-            if (!valid_identifier(tmp))
-                goto error;
-            assert(PyUnicode_Check(tmp));
-            if (_PyUnicode_EqualToASCIIId(tmp, &PyId___dict__)) {
-                if (!may_add_dict || add_dict) {
-                    PyErr_SetString(PyExc_TypeError,
-                        "__dict__ slot disallowed: "
-                        "we already got one");
-                    goto error;
-                }
-                add_dict++;
-            }
-            if (_PyUnicode_EqualToASCIIString(tmp, "__weakref__")) {
-                if (!may_add_weak || add_weak) {
-                    PyErr_SetString(PyExc_TypeError,
-                        "__weakref__ slot disallowed: "
-                        "either we already got one, "
-                        "or __itemsize__ != 0");
-                    goto error;
-                }
-                add_weak++;
-            }
-        }
-
-        /* Copy slots into a list, mangle names and sort them.
-           Sorted names are needed for __class__ assignment.
-           Convert them back to tuple at the end.
-        */
-        newslots = PyList_New(nslots - add_dict - add_weak);
-        if (newslots == NULL)
-            goto error;
-        for (i = j = 0; i < nslots; i++) {
-            tmp = PyTuple_GET_ITEM(slots, i);
-            if ((add_dict &&
-                 _PyUnicode_EqualToASCIIId(tmp, &PyId___dict__)) ||
-                (add_weak &&
-                 _PyUnicode_EqualToASCIIString(tmp, "__weakref__")))
-                continue;
-            tmp =_Py_Mangle(name, tmp);
-            if (!tmp) {
-                Py_DECREF(newslots);
-                goto error;
-            }
-            PyList_SET_ITEM(newslots, j, tmp);
-            if (PyDict_GetItemWithError(dict, tmp)) {
-                /* CPython inserts __qualname__ and __classcell__ (when needed)
-                   into the namespace when creating a class.  They will be deleted
-                   below so won't act as class variables. */
-                if (!_PyUnicode_EqualToASCIIId(tmp, &PyId___qualname__) &&
-                    !_PyUnicode_EqualToASCIIId(tmp, &PyId___classcell__)) {
-                    PyErr_Format(PyExc_ValueError,
-                                 "%R in __slots__ conflicts with class variable",
-                                 tmp);
-                    Py_DECREF(newslots);
-                    goto error;
-                }
-            }
-            else if (PyErr_Occurred()) {
-                Py_DECREF(newslots);
-                goto error;
-            }
-            j++;
-        }
-        assert(j == nslots - add_dict - add_weak);
-        nslots = j;
-        Py_CLEAR(slots);
-        if (PyList_Sort(newslots) == -1) {
-            Py_DECREF(newslots);
-            goto error;
-        }
-        slots = PyList_AsTuple(newslots);
-        Py_DECREF(newslots);
-        if (slots == NULL)
-            goto error;
-
-        /* Secondary bases may provide weakrefs or dict */
-        if (nbases > 1 &&
-            ((may_add_dict && !add_dict) ||
-             (may_add_weak && !add_weak))) {
-            for (i = 0; i < nbases; i++) {
-                tmp = PyTuple_GET_ITEM(bases, i);
-                if (tmp == (PyObject *)base)
-                    continue; /* Skip primary base */
-                assert(PyType_Check(tmp));
-                tmptype = (PyTypeObject *)tmp;
-                if (may_add_dict && !add_dict &&
-                    tmptype->tp_dictoffset != 0)
-                    add_dict++;
-                if (may_add_weak && !add_weak &&
-                    tmptype->tp_weaklistoffset != 0)
-                    add_weak++;
-                if (may_add_dict && !add_dict)
-                    continue;
-                if (may_add_weak && !add_weak)
-                    continue;
-                /* Nothing more to check */
-                break;
-            }
+        if (type_new_slots_impl(ctx, dict) < 0) {
+            return -1;
         }
     }
+    return 0;
+}
 
-    /* Allocate the type object */
-    type = (PyTypeObject *)metatype->tp_alloc(metatype, nslots);
-    if (type == NULL)
-        goto error;
 
-    /* Keep name and slots alive in the extended type object */
-    et = (PyHeapTypeObject *)type;
-    Py_INCREF(name);
-    et->ht_name = name;
-    et->ht_slots = slots;
-    slots = NULL;
+static PyTypeObject*
+type_new_alloc(type_new_ctx *ctx)
+{
+    PyTypeObject *metatype = ctx->metatype;
+    PyTypeObject *type;
 
-    /* Initialize tp_flags */
+    // Allocate the type object
+    type = (PyTypeObject *)metatype->tp_alloc(metatype, ctx->nslot);
+    if (type == NULL) {
+        return NULL;
+    }
+    PyHeapTypeObject *et = (PyHeapTypeObject *)type;
+
+    // Initialize tp_flags.
     // All heap types need GC, since we can create a reference cycle by storing
-    // an instance on one of its parents:
-    type->tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HEAPTYPE |
-        Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC;
+    // an instance on one of its parents.
+    type->tp_flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HEAPTYPE |
+                      Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC);
 
-    /* Initialize essential fields */
+    // Initialize essential fields
     type->tp_as_async = &et->as_async;
     type->tp_as_number = &et->as_number;
     type->tp_as_sequence = &et->as_sequence;
     type->tp_as_mapping = &et->as_mapping;
     type->tp_as_buffer = &et->as_buffer;
-    type->tp_name = PyUnicode_AsUTF8AndSize(name, &name_size);
-    if (!type->tp_name)
-        goto error;
+
+    type->tp_bases = Py_NewRef(ctx->bases);
+    type->tp_base = (PyTypeObject *)Py_NewRef(ctx->base);
+
+    type->tp_dealloc = subtype_dealloc;
+    /* Always override allocation strategy to use regular heap */
+    type->tp_alloc = PyType_GenericAlloc;
+    type->tp_free = PyObject_GC_Del;
+
+    type->tp_traverse = subtype_traverse;
+    type->tp_clear = subtype_clear;
+
+    et->ht_name = Py_NewRef(ctx->name);
+    et->ht_module = NULL;
+
+    return type;
+}
+
+
+static int
+type_new_set_name(const type_new_ctx *ctx, PyTypeObject *type)
+{
+    Py_ssize_t name_size;
+    type->tp_name = PyUnicode_AsUTF8AndSize(ctx->name, &name_size);
+    if (!type->tp_name) {
+        return -1;
+    }
     if (strlen(type->tp_name) != (size_t)name_size) {
         PyErr_SetString(PyExc_ValueError,
                         "type name must not contain null characters");
-        goto error;
+        return -1;
+    }
+    return 0;
+}
+
+
+/* Set __module__ in the dict */
+static int
+type_new_set_module(PyTypeObject *type)
+{
+    int r = _PyDict_ContainsId(type->tp_dict, &PyId___module__);
+    if (r < 0) {
+        return -1;
+    }
+    if (r > 0) {
+        return 0;
     }
 
-    /* Set tp_base and tp_bases */
-    type->tp_bases = bases;
-    bases = NULL;
-    Py_INCREF(base);
-    type->tp_base = base;
+    PyObject *globals = PyEval_GetGlobals();
+    if (globals == NULL) {
+        return 0;
+    }
 
-    /* Initialize tp_dict from passed-in dict */
-    Py_INCREF(dict);
-    type->tp_dict = dict;
-
-    /* Set __module__ in the dict */
-    if (_PyDict_GetItemIdWithError(dict, &PyId___module__) == NULL) {
+    PyObject *module = _PyDict_GetItemIdWithError(globals, &PyId___name__);
+    if (module == NULL) {
         if (PyErr_Occurred()) {
-            goto error;
+            return -1;
         }
-        tmp = PyEval_GetGlobals();
-        if (tmp != NULL) {
-            tmp = _PyDict_GetItemIdWithError(tmp, &PyId___name__);
-            if (tmp != NULL) {
-                if (_PyDict_SetItemId(dict, &PyId___module__,
-                                      tmp) < 0)
-                    goto error;
-            }
-            else if (PyErr_Occurred()) {
-                goto error;
-            }
-        }
+        return 0;
     }
 
-    /* Set ht_qualname to dict['__qualname__'] if available, else to
-       __name__.  The __qualname__ accessor will look for ht_qualname.
-    */
-    qualname = _PyDict_GetItemIdWithError(dict, &PyId___qualname__);
+    if (_PyDict_SetItemId(type->tp_dict, &PyId___module__, module) < 0) {
+        return -1;
+    }
+    return 0;
+}
+
+
+/* Set ht_qualname to dict['__qualname__'] if available, else to
+   __name__.  The __qualname__ accessor will look for ht_qualname. */
+static int
+type_new_set_ht_name(PyTypeObject *type)
+{
+    PyHeapTypeObject *et = (PyHeapTypeObject *)type;
+    PyObject *qualname = _PyDict_GetItemIdWithError(type->tp_dict,
+                                                    &PyId___qualname__);
     if (qualname != NULL) {
         if (!PyUnicode_Check(qualname)) {
             PyErr_Format(PyExc_TypeError,
-                         "type __qualname__ must be a str, not %s",
-                         Py_TYPE(qualname)->tp_name);
-            goto error;
+                    "type __qualname__ must be a str, not %s",
+                    Py_TYPE(qualname)->tp_name);
+            return -1;
+        }
+        et->ht_qualname = Py_NewRef(qualname);
+        if (_PyDict_DelItemId(type->tp_dict, &PyId___qualname__) < 0) {
+            return -1;
         }
     }
-    else if (PyErr_Occurred()) {
-        goto error;
-    }
-    et->ht_qualname = qualname ? qualname : et->ht_name;
-    Py_INCREF(et->ht_qualname);
-    if (qualname != NULL && _PyDict_DelItemId(dict, &PyId___qualname__) < 0)
-        goto error;
-
-    /* Set ht_module */
-    et->ht_module = NULL;
-
-    /* Set tp_doc to a copy of dict['__doc__'], if the latter is there
-       and is a string.  The __doc__ accessor will first look for tp_doc;
-       if that fails, it will still look into __dict__.
-    */
-    {
-        PyObject *doc = _PyDict_GetItemIdWithError(dict, &PyId___doc__);
-        if (doc != NULL && PyUnicode_Check(doc)) {
-            Py_ssize_t len;
-            const char *doc_str;
-            char *tp_doc;
-
-            doc_str = PyUnicode_AsUTF8(doc);
-            if (doc_str == NULL)
-                goto error;
-            /* Silently truncate the docstring if it contains null bytes. */
-            len = strlen(doc_str);
-            tp_doc = (char *)PyObject_MALLOC(len + 1);
-            if (tp_doc == NULL) {
-                PyErr_NoMemory();
-                goto error;
-            }
-            memcpy(tp_doc, doc_str, len + 1);
-            type->tp_doc = tp_doc;
+    else {
+        if (PyErr_Occurred()) {
+            return -1;
         }
-        else if (doc == NULL && PyErr_Occurred()) {
-            goto error;
+        et->ht_qualname = Py_NewRef(et->ht_name);
+    }
+    return 0;
+}
+
+
+/* Set tp_doc to a copy of dict['__doc__'], if the latter is there
+   and is a string.  The __doc__ accessor will first look for tp_doc;
+   if that fails, it will still look into __dict__. */
+static int
+type_new_set_doc(PyTypeObject *type)
+{
+    PyObject *doc = _PyDict_GetItemIdWithError(type->tp_dict, &PyId___doc__);
+    if (doc == NULL) {
+        if (PyErr_Occurred()) {
+            return -1;
         }
+        // no __doc__ key
+        return 0;
+    }
+    if (!PyUnicode_Check(doc)) {
+        // ignore non-string __doc__
+        return 0;
     }
 
-    /* Special-case __new__: if it's a plain function,
-       make it a static function */
-    tmp = _PyDict_GetItemIdWithError(dict, &PyId___new__);
-    if (tmp != NULL && PyFunction_Check(tmp)) {
-        tmp = PyStaticMethod_New(tmp);
-        if (tmp == NULL)
-            goto error;
-        if (_PyDict_SetItemId(dict, &PyId___new__, tmp) < 0) {
-            Py_DECREF(tmp);
-            goto error;
-        }
-        Py_DECREF(tmp);
-    }
-    else if (tmp == NULL && PyErr_Occurred()) {
-        goto error;
+    const char *doc_str = PyUnicode_AsUTF8(doc);
+    if (doc_str == NULL) {
+        return -1;
     }
 
-    /* Special-case __init_subclass__ and __class_getitem__:
-       if they are plain functions, make them classmethods */
-    tmp = _PyDict_GetItemIdWithError(dict, &PyId___init_subclass__);
-    if (tmp != NULL && PyFunction_Check(tmp)) {
-        tmp = PyClassMethod_New(tmp);
-        if (tmp == NULL)
-            goto error;
-        if (_PyDict_SetItemId(dict, &PyId___init_subclass__, tmp) < 0) {
-            Py_DECREF(tmp);
-            goto error;
-        }
-        Py_DECREF(tmp);
-    }
-    else if (tmp == NULL && PyErr_Occurred()) {
-        goto error;
+    // Silently truncate the docstring if it contains a null byte
+    Py_ssize_t size = strlen(doc_str) + 1;
+    char *tp_doc = (char *)PyObject_Malloc(size);
+    if (tp_doc == NULL) {
+        PyErr_NoMemory();
+        return -1;
     }
 
-    tmp = _PyDict_GetItemIdWithError(dict, &PyId___class_getitem__);
-    if (tmp != NULL && PyFunction_Check(tmp)) {
-        tmp = PyClassMethod_New(tmp);
-        if (tmp == NULL)
-            goto error;
-        if (_PyDict_SetItemId(dict, &PyId___class_getitem__, tmp) < 0) {
-            Py_DECREF(tmp);
-            goto error;
+    memcpy(tp_doc, doc_str, size);
+    type->tp_doc = tp_doc;
+    return 0;
+}
+
+
+static int
+type_new_staticmethod(PyTypeObject *type, _Py_Identifier *attr_id)
+{
+    PyObject *func = _PyDict_GetItemIdWithError(type->tp_dict, attr_id);
+    if (func == NULL) {
+        if (PyErr_Occurred()) {
+            return -1;
         }
-        Py_DECREF(tmp);
+        return 0;
     }
-    else if (tmp == NULL && PyErr_Occurred()) {
-        goto error;
+    if (!PyFunction_Check(func)) {
+        return 0;
     }
 
-    /* Add descriptors for custom slots from __slots__, or for __dict__ */
-    mp = PyHeapType_GET_MEMBERS(et);
-    slotoffset = base->tp_basicsize;
+    PyObject *static_func = PyStaticMethod_New(func);
+    if (static_func == NULL) {
+        return -1;
+    }
+    if (_PyDict_SetItemId(type->tp_dict, attr_id, static_func) < 0) {
+        Py_DECREF(static_func);
+        return -1;
+    }
+    Py_DECREF(static_func);
+    return 0;
+}
+
+
+static int
+type_new_classmethod(PyTypeObject *type, _Py_Identifier *attr_id)
+{
+    PyObject *func = _PyDict_GetItemIdWithError(type->tp_dict, attr_id);
+    if (func == NULL) {
+        if (PyErr_Occurred()) {
+            return -1;
+        }
+        return 0;
+    }
+    if (!PyFunction_Check(func)) {
+        return 0;
+    }
+
+    PyObject *method = PyClassMethod_New(func);
+    if (method == NULL) {
+        return -1;
+    }
+
+    if (_PyDict_SetItemId(type->tp_dict, attr_id, method) < 0) {
+        Py_DECREF(method);
+        return -1;
+    }
+    Py_DECREF(method);
+    return 0;
+}
+
+
+/* Add descriptors for custom slots from __slots__, or for __dict__ */
+static int
+type_new_descriptors(const type_new_ctx *ctx, PyTypeObject *type)
+{
+    PyHeapTypeObject *et = (PyHeapTypeObject *)type;
+    Py_ssize_t slotoffset = ctx->base->tp_basicsize;
     if (et->ht_slots != NULL) {
-        for (i = 0; i < nslots; i++, mp++) {
+        PyMemberDef *mp = PyHeapType_GET_MEMBERS(et);
+        Py_ssize_t nslot = PyTuple_GET_SIZE(et->ht_slots);
+        for (Py_ssize_t i = 0; i < nslot; i++, mp++) {
             mp->name = PyUnicode_AsUTF8(
                 PyTuple_GET_ITEM(et->ht_slots, i));
-            if (mp->name == NULL)
-                goto error;
+            if (mp->name == NULL) {
+                return -1;
+            }
             mp->type = T_OBJECT_EX;
             mp->offset = slotoffset;
 
@@ -2774,95 +2972,391 @@
             slotoffset += sizeof(PyObject *);
         }
     }
-    if (add_dict) {
-        if (base->tp_itemsize)
+
+    if (ctx->add_dict) {
+        if (ctx->base->tp_itemsize) {
             type->tp_dictoffset = -(long)sizeof(PyObject *);
-        else
+        }
+        else {
             type->tp_dictoffset = slotoffset;
+        }
         slotoffset += sizeof(PyObject *);
     }
-    if (add_weak) {
-        assert(!base->tp_itemsize);
+
+    if (ctx->add_weak) {
+        assert(!ctx->base->tp_itemsize);
         type->tp_weaklistoffset = slotoffset;
         slotoffset += sizeof(PyObject *);
     }
-    type->tp_basicsize = slotoffset;
-    type->tp_itemsize = base->tp_itemsize;
-    type->tp_members = PyHeapType_GET_MEMBERS(et);
 
-    if (type->tp_weaklistoffset && type->tp_dictoffset)
+    type->tp_basicsize = slotoffset;
+    type->tp_itemsize = ctx->base->tp_itemsize;
+    type->tp_members = PyHeapType_GET_MEMBERS(et);
+    return 0;
+}
+
+
+static void
+type_new_set_slots(const type_new_ctx *ctx, PyTypeObject *type)
+{
+    if (type->tp_weaklistoffset && type->tp_dictoffset) {
         type->tp_getset = subtype_getsets_full;
-    else if (type->tp_weaklistoffset && !type->tp_dictoffset)
+    }
+    else if (type->tp_weaklistoffset && !type->tp_dictoffset) {
         type->tp_getset = subtype_getsets_weakref_only;
-    else if (!type->tp_weaklistoffset && type->tp_dictoffset)
+    }
+    else if (!type->tp_weaklistoffset && type->tp_dictoffset) {
         type->tp_getset = subtype_getsets_dict_only;
-    else
+    }
+    else {
         type->tp_getset = NULL;
+    }
 
     /* Special case some slots */
-    if (type->tp_dictoffset != 0 || nslots > 0) {
-        if (base->tp_getattr == NULL && base->tp_getattro == NULL)
+    if (type->tp_dictoffset != 0 || ctx->nslot > 0) {
+        PyTypeObject *base = ctx->base;
+        if (base->tp_getattr == NULL && base->tp_getattro == NULL) {
             type->tp_getattro = PyObject_GenericGetAttr;
-        if (base->tp_setattr == NULL && base->tp_setattro == NULL)
+        }
+        if (base->tp_setattr == NULL && base->tp_setattro == NULL) {
             type->tp_setattro = PyObject_GenericSetAttr;
-    }
-    type->tp_dealloc = subtype_dealloc;
-
-    /* Always override allocation strategy to use regular heap */
-    type->tp_alloc = PyType_GenericAlloc;
-    type->tp_free = PyObject_GC_Del;
-    type->tp_traverse = subtype_traverse;
-    type->tp_clear = subtype_clear;
-
-    /* store type in class' cell if one is supplied */
-    cell = _PyDict_GetItemIdWithError(dict, &PyId___classcell__);
-    if (cell != NULL) {
-        /* At least one method requires a reference to its defining class */
-        if (!PyCell_Check(cell)) {
-            PyErr_Format(PyExc_TypeError,
-                         "__classcell__ must be a nonlocal cell, not %.200R",
-                         Py_TYPE(cell));
-            goto error;
-        }
-        PyCell_Set(cell, (PyObject *) type);
-        if (_PyDict_DelItemId(dict, &PyId___classcell__) < 0) {
-            goto error;
         }
     }
-    else if (PyErr_Occurred()) {
+}
+
+
+/* store type in class' cell if one is supplied */
+static int
+type_new_set_classcell(PyTypeObject *type)
+{
+    PyObject *cell = _PyDict_GetItemIdWithError(type->tp_dict,
+                                                &PyId___classcell__);
+    if (cell == NULL) {
+        if (PyErr_Occurred()) {
+            return -1;
+        }
+        return 0;
+    }
+
+    /* At least one method requires a reference to its defining class */
+    if (!PyCell_Check(cell)) {
+        PyErr_Format(PyExc_TypeError,
+                     "__classcell__ must be a nonlocal cell, not %.200R",
+                     Py_TYPE(cell));
+        return -1;
+    }
+
+    (void)PyCell_Set(cell, (PyObject *) type);
+    if (_PyDict_DelItemId(type->tp_dict, &PyId___classcell__) < 0) {
+        return -1;
+    }
+    return 0;
+}
+
+
+static int
+type_new_set_attrs(const type_new_ctx *ctx, PyTypeObject *type)
+{
+    if (type_new_set_name(ctx, type) < 0) {
+        return -1;
+    }
+
+    if (type_new_set_module(type) < 0) {
+        return -1;
+    }
+
+    if (type_new_set_ht_name(type) < 0) {
+        return -1;
+    }
+
+    if (type_new_set_doc(type) < 0) {
+        return -1;
+    }
+
+    /* Special-case __new__: if it's a plain function,
+       make it a static function */
+    if (type_new_staticmethod(type, &PyId___new__) < 0) {
+        return -1;
+    }
+
+    /* Special-case __init_subclass__ and __class_getitem__:
+       if they are plain functions, make them classmethods */
+    if (type_new_classmethod(type, &PyId___init_subclass__) < 0) {
+        return -1;
+    }
+    if (type_new_classmethod(type, &PyId___class_getitem__) < 0) {
+        return -1;
+    }
+
+    if (type_new_descriptors(ctx, type) < 0) {
+        return -1;
+    }
+
+    type_new_set_slots(ctx, type);
+
+    if (type_new_set_classcell(type) < 0) {
+        return -1;
+    }
+    return 0;
+}
+
+
+static int
+type_new_get_slots(type_new_ctx *ctx, PyObject *dict)
+{
+    _Py_IDENTIFIER(__slots__);
+    PyObject *slots = _PyDict_GetItemIdWithError(dict, &PyId___slots__);
+    if (slots == NULL) {
+        if (PyErr_Occurred()) {
+            return -1;
+        }
+        ctx->slots = NULL;
+        ctx->nslot = 0;
+        return 0;
+    }
+
+    // Make it into a tuple
+    PyObject *new_slots;
+    if (PyUnicode_Check(slots)) {
+        new_slots = PyTuple_Pack(1, slots);
+    }
+    else {
+        new_slots = PySequence_Tuple(slots);
+    }
+    if (new_slots == NULL) {
+        return -1;
+    }
+    assert(PyTuple_CheckExact(new_slots));
+    ctx->slots = new_slots;
+    ctx->nslot = PyTuple_GET_SIZE(new_slots);
+    return 0;
+}
+
+
+static PyTypeObject*
+type_new_init(type_new_ctx *ctx)
+{
+    PyObject *dict = PyDict_Copy(ctx->orig_dict);
+    if (dict == NULL) {
+        goto error;
+    }
+
+    if (type_new_get_slots(ctx, dict) < 0) {
+        goto error;
+    }
+    assert(!PyErr_Occurred());
+
+    if (type_new_slots(ctx, dict) < 0) {
+        goto error;
+    }
+
+    PyTypeObject *type = type_new_alloc(ctx);
+    if (type == NULL) {
+        goto error;
+    }
+
+    type->tp_dict = dict;
+
+    PyHeapTypeObject *et = (PyHeapTypeObject*)type;
+    et->ht_slots = ctx->slots;
+    ctx->slots = NULL;
+
+    return type;
+
+error:
+    Py_CLEAR(ctx->slots);
+    Py_XDECREF(dict);
+    return NULL;
+}
+
+
+static PyObject*
+type_new_impl(type_new_ctx *ctx)
+{
+    PyTypeObject *type = type_new_init(ctx);
+    if (type == NULL) {
+        return NULL;
+    }
+
+    if (type_new_set_attrs(ctx, type) < 0) {
         goto error;
     }
 
     /* Initialize the rest */
-    if (PyType_Ready(type) < 0)
+    if (PyType_Ready(type) < 0) {
         goto error;
+    }
 
-    /* Put the proper slots in place */
+    // Put the proper slots in place
     fixup_slot_dispatchers(type);
 
     if (type->tp_dictoffset) {
+        PyHeapTypeObject *et = (PyHeapTypeObject*)type;
         et->ht_cached_keys = _PyDict_NewKeysForClass();
     }
 
-    if (set_names(type) < 0)
+    if (type_new_set_names(type) < 0) {
         goto error;
+    }
 
-    if (init_subclass(type, kwds) < 0)
+    if (type_new_init_subclass(type, ctx->kwds) < 0) {
         goto error;
+    }
 
-    Py_DECREF(dict);
+    assert(_PyType_CheckConsistency(type));
     return (PyObject *)type;
 
 error:
-    Py_XDECREF(dict);
-    Py_XDECREF(bases);
-    Py_XDECREF(slots);
-    Py_XDECREF(type);
+    Py_DECREF(type);
     return NULL;
 }
 
-static const short slotoffsets[] = {
-    -1, /* invalid slot */
+
+static int
+type_new_get_bases(type_new_ctx *ctx, PyObject **type)
+{
+    Py_ssize_t nbases = PyTuple_GET_SIZE(ctx->bases);
+    if (nbases == 0) {
+        // Adjust for empty tuple bases
+        ctx->base = &PyBaseObject_Type;
+        PyObject *new_bases = PyTuple_Pack(1, ctx->base);
+        if (new_bases == NULL) {
+            return -1;
+        }
+        ctx->bases = new_bases;
+        return 0;
+    }
+
+    _Py_IDENTIFIER(__mro_entries__);
+    for (Py_ssize_t i = 0; i < nbases; i++) {
+        PyObject *base = PyTuple_GET_ITEM(ctx->bases, i);
+        if (PyType_Check(base)) {
+            continue;
+        }
+        PyObject *mro_entries;
+        if (_PyObject_LookupAttrId(base, &PyId___mro_entries__,
+                                   &mro_entries) < 0) {
+            return -1;
+        }
+        if (mro_entries != NULL) {
+            PyErr_SetString(PyExc_TypeError,
+                            "type() doesn't support MRO entry resolution; "
+                            "use types.new_class()");
+            Py_DECREF(mro_entries);
+            return -1;
+        }
+    }
+
+    // Search the bases for the proper metatype to deal with this
+    PyTypeObject *winner;
+    winner = _PyType_CalculateMetaclass(ctx->metatype, ctx->bases);
+    if (winner == NULL) {
+        return -1;
+    }
+
+    if (winner != ctx->metatype) {
+        if (winner->tp_new != type_new) {
+            /* Pass it to the winner */
+            *type = winner->tp_new(winner, ctx->args, ctx->kwds);
+            if (*type == NULL) {
+                return -1;
+            }
+            return 1;
+        }
+
+        ctx->metatype = winner;
+    }
+
+    /* Calculate best base, and check that all bases are type objects */
+    PyTypeObject *base = best_base(ctx->bases);
+    if (base == NULL) {
+        return -1;
+    }
+
+    ctx->base = base;
+    ctx->bases = Py_NewRef(ctx->bases);
+    return 0;
+}
+
+
+static PyObject *
+type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
+{
+    assert(args != NULL && PyTuple_Check(args));
+    assert(kwds == NULL || PyDict_Check(kwds));
+
+    /* Parse arguments: (name, bases, dict) */
+    PyObject *name, *bases, *orig_dict;
+    if (!PyArg_ParseTuple(args, "UO!O!:type.__new__",
+                          &name,
+                          &PyTuple_Type, &bases,
+                          &PyDict_Type, &orig_dict))
+    {
+        return NULL;
+    }
+
+    type_new_ctx ctx = {
+        .metatype = metatype,
+        .args = args,
+        .kwds = kwds,
+        .orig_dict = orig_dict,
+        .name = name,
+        .bases = bases,
+        .base = NULL,
+        .slots = NULL,
+        .nslot = 0,
+        .add_dict = 0,
+        .add_weak = 0,
+        .may_add_dict = 0,
+        .may_add_weak = 0};
+    PyObject *type = NULL;
+    int res = type_new_get_bases(&ctx, &type);
+    if (res < 0) {
+        assert(PyErr_Occurred());
+        return NULL;
+    }
+    if (res == 1) {
+        assert(type != NULL);
+        return type;
+    }
+    assert(ctx.base != NULL);
+    assert(ctx.bases != NULL);
+
+    type = type_new_impl(&ctx);
+    Py_DECREF(ctx.bases);
+    return type;
+}
+
+
+static PyObject *
+type_vectorcall(PyObject *metatype, PyObject *const *args,
+                 size_t nargsf, PyObject *kwnames)
+{
+    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
+    if (nargs == 1 && metatype == (PyObject *)&PyType_Type){
+        if (!_PyArg_NoKwnames("type", kwnames)) {
+            return NULL;
+        }
+        return Py_NewRef(Py_TYPE(args[0]));
+    }
+    /* In other (much less common) cases, fall back to
+       more flexible calling conventions. */
+    PyThreadState *tstate = PyThreadState_GET();
+    return _PyObject_MakeTpCall(tstate, metatype, args, nargs, kwnames);
+}
+
+/* An array of type slot offsets corresponding to Py_tp_* constants,
+  * for use in e.g. PyType_Spec and PyType_GetSlot.
+  * Each entry has two offsets: "slot_offset" and "subslot_offset".
+  * If is subslot_offset is -1, slot_offset is an offset within the
+  * PyTypeObject struct.
+  * Otherwise slot_offset is an offset to a pointer to a sub-slots struct
+  * (such as "tp_as_number"), and subslot_offset is the offset within
+  * that struct.
+  * The actual table is generated by a script.
+  */
+static const PySlot_Offset pyslot_offsets[] = {
+    {0, 0},
 #include "typeslots.inc"
 };
 
@@ -2878,10 +3372,12 @@
     PyHeapTypeObject *res;
     PyObject *modname;
     PyTypeObject *type, *base;
+    int r;
 
     const PyType_Slot *slot;
     Py_ssize_t nmembers, weaklistoffset, dictoffset, vectorcalloffset;
     char *res_start;
+    short slot_offset, subslot_offset;
 
     nmembers = weaklistoffset = dictoffset = vectorcalloffset = 0;
     for (slot = spec->slots; slot->slot; slot++) {
@@ -2967,8 +3463,9 @@
         }
     }
     else if (!PyTuple_Check(bases)) {
-        PyErr_SetString(PyExc_SystemError, "bases is not a tuple");
-        goto fail;
+        bases = PyTuple_Pack(1, bases);
+        if (!bases)
+            goto fail;
     }
     else {
         Py_INCREF(bases);
@@ -3004,7 +3501,7 @@
 
     for (slot = spec->slots; slot->slot; slot++) {
         if (slot->slot < 0
-            || (size_t)slot->slot >= Py_ARRAY_LENGTH(slotoffsets)) {
+            || (size_t)slot->slot >= Py_ARRAY_LENGTH(pyslot_offsets)) {
             PyErr_SetString(PyExc_RuntimeError, "invalid slot offset");
             goto fail;
         }
@@ -3015,15 +3512,18 @@
         else if (slot->slot == Py_tp_doc) {
             /* For the docstring slot, which usually points to a static string
                literal, we need to make a copy */
-            const char *old_doc = _PyType_DocWithoutSignature(type->tp_name, slot->pfunc);
-            size_t len = strlen(old_doc)+1;
-            char *tp_doc = PyObject_MALLOC(len);
+            if (slot->pfunc == NULL) {
+                type->tp_doc = NULL;
+                continue;
+            }
+            size_t len = strlen(slot->pfunc)+1;
+            char *tp_doc = PyObject_Malloc(len);
             if (tp_doc == NULL) {
                 type->tp_doc = NULL;
                 PyErr_NoMemory();
                 goto fail;
             }
-            memcpy(tp_doc, old_doc, len);
+            memcpy(tp_doc, slot->pfunc, len);
             type->tp_doc = tp_doc;
         }
         else if (slot->slot == Py_tp_members) {
@@ -3034,7 +3534,15 @@
         }
         else {
             /* Copy other slots directly */
-            *(void**)(res_start + slotoffsets[slot->slot]) = slot->pfunc;
+            PySlot_Offset slotoffsets = pyslot_offsets[slot->slot];
+            slot_offset = slotoffsets.slot_offset;
+            if (slotoffsets.subslot_offset == -1) {
+                *(void**)((char*)res_start + slot_offset) = slot->pfunc;
+            } else {
+                void *parent_slot = *(void**)((char*)res_start + slot_offset);
+                subslot_offset = slotoffsets.subslot_offset;
+                *(void**)((char*)parent_slot + subslot_offset) = slot->pfunc;
+            }
         }
     }
     if (type->tp_dealloc == NULL) {
@@ -3055,6 +3563,16 @@
         res->ht_cached_keys = _PyDict_NewKeysForClass();
     }
 
+    if (type->tp_doc) {
+        PyObject *__doc__ = PyUnicode_FromString(_PyType_DocWithoutSignature(type->tp_name, type->tp_doc));
+        if (!__doc__)
+            goto fail;
+        r = _PyDict_SetItemId(type->tp_dict, &PyId___doc__, __doc__);
+        Py_DECREF(__doc__);
+        if (r < 0)
+            goto fail;
+    }
+
     if (weaklistoffset) {
         type->tp_weaklistoffset = weaklistoffset;
         if (PyDict_DelItemString((PyObject *)type->tp_dict, "__weaklistoffset__") < 0)
@@ -3067,21 +3585,21 @@
     }
 
     /* Set type.__module__ */
-    if (_PyDict_GetItemIdWithError(type->tp_dict, &PyId___module__) == NULL) {
-        if (PyErr_Occurred()) {
-            goto fail;
-        }
+    r = _PyDict_ContainsId(type->tp_dict, &PyId___module__);
+    if (r < 0) {
+        goto fail;
+    }
+    if (r == 0) {
         s = strrchr(spec->name, '.');
         if (s != NULL) {
-            int err;
             modname = PyUnicode_FromStringAndSize(
                     spec->name, (Py_ssize_t)(s - spec->name));
             if (modname == NULL) {
                 goto fail;
             }
-            err = _PyDict_SetItemId(type->tp_dict, &PyId___module__, modname);
+            r = _PyDict_SetItemId(type->tp_dict, &PyId___module__, modname);
             Py_DECREF(modname);
-            if (err != 0)
+            if (r != 0)
                 goto fail;
         } else {
             if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
@@ -3104,18 +3622,34 @@
     return PyType_FromSpecWithBases(spec, NULL);
 }
 
+/* private in 3.10 and 3.9.8+; public in 3.11 */
+PyObject *
+_PyType_GetQualName(PyTypeObject *type)
+{
+    return type_qualname(type, NULL);
+}
+
+
 void *
 PyType_GetSlot(PyTypeObject *type, int slot)
 {
-    if (!_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE) || slot < 0) {
+    void *parent_slot;
+    int slots_len = Py_ARRAY_LENGTH(pyslot_offsets);
+
+    if (slot <= 0 || slot >= slots_len) {
         PyErr_BadInternalCall();
         return NULL;
     }
-    if ((size_t)slot >= Py_ARRAY_LENGTH(slotoffsets)) {
-        /* Extension module requesting slot from a future version */
+
+    parent_slot = *(void**)((char*)type + pyslot_offsets[slot].slot_offset);
+    if (parent_slot == NULL) {
         return NULL;
     }
-    return  *(void**)(((char*)type) + slotoffsets[slot]);
+    /* Return slot directly if we have no sub slot. */
+    if (pyslot_offsets[slot].subslot_offset == -1) {
+        return parent_slot;
+    }
+    return *(void**)((char*)parent_slot + pyslot_offsets[slot].subslot_offset);
 }
 
 PyObject *
@@ -3149,9 +3683,53 @@
     if (m == NULL) {
         return NULL;
     }
-    return PyModule_GetState(m);
+    return _PyModule_GetState(m);
 }
 
+
+/* Get the module of the first superclass where the module has the
+ * given PyModuleDef.
+ * Implemented by walking the MRO, is relatively slow.
+ *
+ * This is internal API for experimentation within stdlib. Discussion:
+ * https://mail.python.org/archives/list/capi-sig@python.org/thread/T3P2QNLNLBRFHWSKYSTPMVEIL2EEKFJU/
+ */
+PyObject *
+_PyType_GetModuleByDef(PyTypeObject *type, struct PyModuleDef *def)
+{
+    assert(PyType_Check(type));
+
+    PyObject *mro = type->tp_mro;
+    // The type must be ready
+    assert(mro != NULL);
+    assert(PyTuple_Check(mro));
+    // mro_invoke() ensures that the type MRO cannot be empty, so we don't have
+    // to check i < PyTuple_GET_SIZE(mro) at the first loop iteration.
+    assert(PyTuple_GET_SIZE(mro) >= 1);
+
+    Py_ssize_t n = PyTuple_GET_SIZE(mro);
+    for (Py_ssize_t i = 0; i < n; i++) {
+        PyObject *super = PyTuple_GET_ITEM(mro, i);
+        if(!_PyType_HasFeature((PyTypeObject *)super, Py_TPFLAGS_HEAPTYPE)) {
+            // Static types in the MRO need to be skipped
+            continue;
+        }
+
+        PyHeapTypeObject *ht = (PyHeapTypeObject*)super;
+        PyObject *module = ht->ht_module;
+        if (module && _PyModule_GetDef(module) == def) {
+            return module;
+        }
+    }
+
+    PyErr_Format(
+        PyExc_TypeError,
+        "_PyType_GetModuleByDef: No superclass of '%s' has the given module",
+        type->tp_name);
+    return NULL;
+}
+
+
 /* Internal API to look for a name through the MRO, bypassing the method cache.
    This returns a borrowed reference, and might set an exception.
    'error' is set to: -1: error with exception; 1: error without exception; 0: ok */
@@ -3222,20 +3800,17 @@
     PyObject *res;
     int error;
 
-#ifdef MCACHE
-    if (MCACHE_CACHEABLE_NAME(name) &&
-        _PyType_HasFeature(type, Py_TPFLAGS_VALID_VERSION_TAG)) {
-        /* fast path */
-        unsigned int h = MCACHE_HASH_METHOD(type, name);
-        if (method_cache[h].version == type->tp_version_tag &&
-            method_cache[h].name == name) {
+    unsigned int h = MCACHE_HASH_METHOD(type, name);
+    struct type_cache *cache = get_type_cache();
+    struct type_cache_entry *entry = &cache->hashtable[h];
+    if (entry->version == type->tp_version_tag &&
+        entry->name == name) {
 #if MCACHE_STATS
-            method_cache_hits++;
+        cache->hits++;
 #endif
-            return method_cache[h].value;
-        }
+        assert(_PyType_HasFeature(type, Py_TPFLAGS_VALID_VERSION_TAG));
+        return entry->value;
     }
-#endif
 
     /* We may end up clearing live exceptions below, so make sure it's ours. */
     assert(!PyErr_Occurred());
@@ -3257,22 +3832,23 @@
         return NULL;
     }
 
-#ifdef MCACHE
-    if (MCACHE_CACHEABLE_NAME(name) && assign_version_tag(type)) {
-        unsigned int h = MCACHE_HASH_METHOD(type, name);
-        method_cache[h].version = type->tp_version_tag;
-        method_cache[h].value = res;  /* borrowed */
-        Py_INCREF(name);
+    if (MCACHE_CACHEABLE_NAME(name) && assign_version_tag(cache, type)) {
+        h = MCACHE_HASH_METHOD(type, name);
+        struct type_cache_entry *entry = &cache->hashtable[h];
+        entry->version = type->tp_version_tag;
+        entry->value = res;  /* borrowed */
         assert(((PyASCIIObject *)(name))->hash != -1);
 #if MCACHE_STATS
-        if (method_cache[h].name != Py_None && method_cache[h].name != name)
-            method_cache_collisions++;
-        else
-            method_cache_misses++;
+        if (entry->name != Py_None && entry->name != name) {
+            cache->collisions++;
+        }
+        else {
+            cache->misses++;
+        }
 #endif
-        Py_SETREF(method_cache[h].name, name);
+        assert(_PyType_HasFeature(type, Py_TPFLAGS_VALID_VERSION_TAG));
+        Py_SETREF(entry->name, Py_NewRef(name));
     }
-#endif
     return res;
 }
 
@@ -3322,7 +3898,7 @@
     }
 
     /* Initialize this type (we'll assume the metatype is initialized) */
-    if (type->tp_dict == NULL) {
+    if (!_PyType_IsReady(type)) {
         if (PyType_Ready(type) < 0)
             return NULL;
     }
@@ -3397,11 +3973,11 @@
 type_setattro(PyTypeObject *type, PyObject *name, PyObject *value)
 {
     int res;
-    if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) {
+    if (type->tp_flags & Py_TPFLAGS_IMMUTABLETYPE) {
         PyErr_Format(
             PyExc_TypeError,
-            "can't set attributes of built-in/extension type '%s'",
-            type->tp_name);
+            "cannot set %R attribute of immutable type '%s'",
+            name, type->tp_name);
         return -1;
     }
     if (PyUnicode_Check(name)) {
@@ -3650,10 +4226,8 @@
 };
 
 PyDoc_STRVAR(type_doc,
-/* this text signature cannot be accurate yet.  will fix.  --larry */
-"type(object_or_name, bases, dict)\n"
 "type(object) -> the object's type\n"
-"type(name, bases, dict) -> a new type");
+"type(name, bases, dict, **kwds) -> a new type");
 
 static int
 type_traverse(PyTypeObject *type, visitproc visit, void *arg)
@@ -3741,6 +4315,11 @@
     return type->tp_flags & Py_TPFLAGS_HEAPTYPE;
 }
 
+
+static PyNumberMethods type_as_number = {
+        .nb_or = _Py_union_type_or, // Add __or__ function
+};
+
 PyTypeObject PyType_Type = {
     PyVarObject_HEAD_INIT(&PyType_Type, 0)
     "type",                                     /* tp_name */
@@ -3752,7 +4331,7 @@
     0,                                          /* tp_setattr */
     0,                                          /* tp_as_async */
     (reprfunc)type_repr,                        /* tp_repr */
-    0,                                          /* tp_as_number */
+    &type_as_number,                            /* tp_as_number */
     0,                                          /* tp_as_sequence */
     0,                                          /* tp_as_mapping */
     0,                                          /* tp_hash */
@@ -3784,6 +4363,7 @@
     type_new,                                   /* tp_new */
     PyObject_GC_Del,                            /* tp_free */
     (inquiry)type_is_gc,                        /* tp_is_gc */
+    .tp_vectorcall = type_vectorcall,
 };
 
 
@@ -4168,10 +4748,10 @@
        In theory the proper fix would be to identify which classes rely on
        this invariant and somehow disallow __class__ assignment only for them,
        perhaps via some mechanism like a new Py_TPFLAGS_IMMUTABLE flag (a
-       "blacklisting" approach). But in practice, since this problem wasn't
+       "denylisting" approach). But in practice, since this problem wasn't
        noticed late in the 3.5 RC cycle, we're taking the conservative
        approach and reinstating the same HEAPTYPE->HEAPTYPE check that we used
-       to have, plus a "whitelist". For now, the whitelist consists only of
+       to have, plus an "allowlist". For now, the allowlist consists only of
        ModuleType subtypes, since those are the cases that motivated the patch
        in the first place -- see https://bugs.python.org/issue22986 -- and
        since module objects are mutable we can be sure that they are
@@ -4186,10 +4766,10 @@
     */
     if (!(PyType_IsSubtype(newto, &PyModule_Type) &&
           PyType_IsSubtype(oldto, &PyModule_Type)) &&
-        (!(newto->tp_flags & Py_TPFLAGS_HEAPTYPE) ||
-         !(oldto->tp_flags & Py_TPFLAGS_HEAPTYPE))) {
+        (_PyType_HasFeature(newto, Py_TPFLAGS_IMMUTABLETYPE) ||
+         _PyType_HasFeature(oldto, Py_TPFLAGS_IMMUTABLETYPE))) {
         PyErr_Format(PyExc_TypeError,
-                     "__class__ assignment only supported for heap types "
+                     "__class__ assignment only supported for mutable types "
                      "or ModuleType subclasses");
         return -1;
     }
@@ -4749,8 +5329,11 @@
     _Py_IDENTIFIER(__reduce__);
 
     if (objreduce == NULL) {
-        objreduce = _PyDict_GetItemId(PyBaseObject_Type.tp_dict,
-                                      &PyId___reduce__);
+        objreduce = _PyDict_GetItemIdWithError(PyBaseObject_Type.tp_dict,
+                                               &PyId___reduce__);
+        if (objreduce == NULL && PyErr_Occurred()) {
+            return NULL;
+        }
     }
 
     if (_PyObject_LookupAttrId(self, &PyId___reduce__, &reduce) < 0) {
@@ -4968,96 +5551,98 @@
 };
 
 
-/* Add the methods from tp_methods to the __dict__ in a type object */
-
 static int
-add_methods(PyTypeObject *type, PyMethodDef *meth)
+type_add_method(PyTypeObject *type, PyMethodDef *meth)
 {
-    PyObject *dict = type->tp_dict;
+    PyObject *descr;
+    int isdescr = 1;
+    if (meth->ml_flags & METH_CLASS) {
+        if (meth->ml_flags & METH_STATIC) {
+            PyErr_SetString(PyExc_ValueError,
+                    "method cannot be both class and static");
+            return -1;
+        }
+        descr = PyDescr_NewClassMethod(type, meth);
+    }
+    else if (meth->ml_flags & METH_STATIC) {
+        PyObject *cfunc = PyCFunction_NewEx(meth, (PyObject*)type, NULL);
+        if (cfunc == NULL) {
+            return -1;
+        }
+        descr = PyStaticMethod_New(cfunc);
+        isdescr = 0;  // PyStaticMethod is not PyDescrObject
+        Py_DECREF(cfunc);
+    }
+    else {
+        descr = PyDescr_NewMethod(type, meth);
+    }
+    if (descr == NULL) {
+        return -1;
+    }
+
     PyObject *name;
-
-    for (; meth->ml_name != NULL; meth++) {
-        PyObject *descr;
-        int err;
-        int isdescr = 1;
-        if (meth->ml_flags & METH_CLASS) {
-            if (meth->ml_flags & METH_STATIC) {
-                PyErr_SetString(PyExc_ValueError,
-                     "method cannot be both class and static");
-                return -1;
-            }
-            descr = PyDescr_NewClassMethod(type, meth);
-        }
-        else if (meth->ml_flags & METH_STATIC) {
-            PyObject *cfunc = PyCFunction_NewEx(meth, (PyObject*)type, NULL);
-            if (cfunc == NULL)
-                return -1;
-            descr = PyStaticMethod_New(cfunc);
-            isdescr = 0;  // PyStaticMethod is not PyDescrObject
-            Py_DECREF(cfunc);
-        }
-        else {
-            descr = PyDescr_NewMethod(type, meth);
-        }
-        if (descr == NULL)
+    if (isdescr) {
+        name = PyDescr_NAME(descr);
+    }
+    else {
+        name = PyUnicode_FromString(meth->ml_name);
+        if (name == NULL) {
+            Py_DECREF(descr);
             return -1;
+        }
+    }
 
-        if (isdescr) {
-            name = PyDescr_NAME(descr);
-        }
-        else {
-            name = PyUnicode_FromString(meth->ml_name);
-            if (name == NULL) {
-                Py_DECREF(descr);
-                return -1;
-            }
-        }
-
-        if (!(meth->ml_flags & METH_COEXIST)) {
-            if (PyDict_GetItemWithError(dict, name)) {
-                if (!isdescr) {
-                    Py_DECREF(name);
-                }
-                Py_DECREF(descr);
-                continue;
-            }
-            else if (PyErr_Occurred()) {
-                if (!isdescr) {
-                    Py_DECREF(name);
-                }
-                return -1;
-            }
-        }
-        err = PyDict_SetItem(dict, name, descr);
-        if (!isdescr) {
-            Py_DECREF(name);
-        }
-        Py_DECREF(descr);
-        if (err < 0)
-            return -1;
+    int err;
+    if (!(meth->ml_flags & METH_COEXIST)) {
+        err = PyDict_SetDefault(type->tp_dict, name, descr) == NULL;
+    }
+    else {
+        err = PyDict_SetItem(type->tp_dict, name, descr) < 0;
+    }
+    if (!isdescr) {
+        Py_DECREF(name);
+    }
+    Py_DECREF(descr);
+    if (err) {
+        return -1;
     }
     return 0;
 }
 
-static int
-add_members(PyTypeObject *type, PyMemberDef *memb)
-{
-    PyObject *dict = type->tp_dict;
 
+/* Add the methods from tp_methods to the __dict__ in a type object */
+static int
+type_add_methods(PyTypeObject *type)
+{
+    PyMethodDef *meth = type->tp_methods;
+    if (meth == NULL) {
+        return 0;
+    }
+
+    for (; meth->ml_name != NULL; meth++) {
+        if (type_add_method(type, meth) < 0) {
+            return -1;
+        }
+    }
+    return 0;
+}
+
+
+static int
+type_add_members(PyTypeObject *type)
+{
+    PyMemberDef *memb = type->tp_members;
+    if (memb == NULL) {
+        return 0;
+    }
+
+    PyObject *dict = type->tp_dict;
     for (; memb->name != NULL; memb++) {
         PyObject *descr = PyDescr_NewMember(type, memb);
         if (descr == NULL)
             return -1;
 
-        if (PyDict_GetItemWithError(dict, PyDescr_NAME(descr))) {
-            Py_DECREF(descr);
-            continue;
-        }
-        else if (PyErr_Occurred()) {
-            Py_DECREF(descr);
-            return -1;
-        }
-        if (PyDict_SetItem(dict, PyDescr_NAME(descr), descr) < 0) {
+        if (PyDict_SetDefault(dict, PyDescr_NAME(descr), descr) == NULL) {
             Py_DECREF(descr);
             return -1;
         }
@@ -5066,25 +5651,23 @@
     return 0;
 }
 
+
 static int
-add_getset(PyTypeObject *type, PyGetSetDef *gsp)
+type_add_getset(PyTypeObject *type)
 {
-    PyObject *dict = type->tp_dict;
+    PyGetSetDef *gsp = type->tp_getset;
+    if (gsp == NULL) {
+        return 0;
+    }
 
+    PyObject *dict = type->tp_dict;
     for (; gsp->name != NULL; gsp++) {
         PyObject *descr = PyDescr_NewGetSet(type, gsp);
-        if (descr == NULL)
+        if (descr == NULL) {
             return -1;
+        }
 
-        if (PyDict_GetItemWithError(dict, PyDescr_NAME(descr))) {
-            Py_DECREF(descr);
-            continue;
-        }
-        else if (PyErr_Occurred()) {
-            Py_DECREF(descr);
-            return -1;
-        }
-        if (PyDict_SetItem(dict, PyDescr_NAME(descr), descr) < 0) {
+        if (PyDict_SetDefault(dict, PyDescr_NAME(descr), descr) == NULL) {
             Py_DECREF(descr);
             return -1;
         }
@@ -5093,10 +5676,10 @@
     return 0;
 }
 
+
 static void
 inherit_special(PyTypeObject *type, PyTypeObject *base)
 {
-
     /* Copying tp_traverse and tp_clear is connected to the GC flags */
     if (!(type->tp_flags & Py_TPFLAGS_HAVE_GC) &&
         (base->tp_flags & Py_TPFLAGS_HAVE_GC) &&
@@ -5107,53 +5690,48 @@
         if (type->tp_clear == NULL)
             type->tp_clear = base->tp_clear;
     }
-    {
-        /* The condition below could use some explanation.
-           It appears that tp_new is not inherited for static types
-           whose base class is 'object'; this seems to be a precaution
-           so that old extension types don't suddenly become
-           callable (object.__new__ wouldn't insure the invariants
-           that the extension type's own factory function ensures).
-           Heap types, of course, are under our control, so they do
-           inherit tp_new; static extension types that specify some
-           other built-in type as the default also
-           inherit object.__new__. */
-        if (base != &PyBaseObject_Type ||
-            (type->tp_flags & Py_TPFLAGS_HEAPTYPE)) {
-            if (type->tp_new == NULL)
-                type->tp_new = base->tp_new;
-        }
-    }
+
     if (type->tp_basicsize == 0)
         type->tp_basicsize = base->tp_basicsize;
 
     /* Copy other non-function slots */
 
-#undef COPYVAL
 #define COPYVAL(SLOT) \
-    if (type->SLOT == 0) type->SLOT = base->SLOT
+    if (type->SLOT == 0) { type->SLOT = base->SLOT; }
 
     COPYVAL(tp_itemsize);
     COPYVAL(tp_weaklistoffset);
     COPYVAL(tp_dictoffset);
+#undef COPYVAL
 
     /* Setup fast subclass flags */
-    if (PyType_IsSubtype(base, (PyTypeObject*)PyExc_BaseException))
+    if (PyType_IsSubtype(base, (PyTypeObject*)PyExc_BaseException)) {
         type->tp_flags |= Py_TPFLAGS_BASE_EXC_SUBCLASS;
-    else if (PyType_IsSubtype(base, &PyType_Type))
+    }
+    else if (PyType_IsSubtype(base, &PyType_Type)) {
         type->tp_flags |= Py_TPFLAGS_TYPE_SUBCLASS;
-    else if (PyType_IsSubtype(base, &PyLong_Type))
+    }
+    else if (PyType_IsSubtype(base, &PyLong_Type)) {
         type->tp_flags |= Py_TPFLAGS_LONG_SUBCLASS;
-    else if (PyType_IsSubtype(base, &PyBytes_Type))
+    }
+    else if (PyType_IsSubtype(base, &PyBytes_Type)) {
         type->tp_flags |= Py_TPFLAGS_BYTES_SUBCLASS;
-    else if (PyType_IsSubtype(base, &PyUnicode_Type))
+    }
+    else if (PyType_IsSubtype(base, &PyUnicode_Type)) {
         type->tp_flags |= Py_TPFLAGS_UNICODE_SUBCLASS;
-    else if (PyType_IsSubtype(base, &PyTuple_Type))
+    }
+    else if (PyType_IsSubtype(base, &PyTuple_Type)) {
         type->tp_flags |= Py_TPFLAGS_TUPLE_SUBCLASS;
-    else if (PyType_IsSubtype(base, &PyList_Type))
+    }
+    else if (PyType_IsSubtype(base, &PyList_Type)) {
         type->tp_flags |= Py_TPFLAGS_LIST_SUBCLASS;
-    else if (PyType_IsSubtype(base, &PyDict_Type))
+    }
+    else if (PyType_IsSubtype(base, &PyDict_Type)) {
         type->tp_flags |= Py_TPFLAGS_DICT_SUBCLASS;
+    }
+    if (PyType_HasFeature(base, _Py_TPFLAGS_MATCH_SELF)) {
+        type->tp_flags |= _Py_TPFLAGS_MATCH_SELF;
+    }
 }
 
 static int
@@ -5163,14 +5741,14 @@
     _Py_IDENTIFIER(__eq__);
 
     assert(dict != NULL);
-    if (_PyDict_GetItemId(dict, &PyId___eq__) != NULL)
-        return 1;
-    if (_PyDict_GetItemId(dict, &PyId___hash__) != NULL)
-        return 1;
-    return 0;
+    int r = _PyDict_ContainsId(dict, &PyId___eq__);
+    if (r == 0) {
+        r = _PyDict_ContainsId(dict, &PyId___hash__);
+    }
+    return r;
 }
 
-static void
+static int
 inherit_slots(PyTypeObject *type, PyTypeObject *base)
 {
     PyTypeObject *basebase;
@@ -5313,11 +5891,16 @@
         /* Copy comparison-related slots only when
            not overriding them anywhere */
         if (type->tp_richcompare == NULL &&
-            type->tp_hash == NULL &&
-            !overrides_hash(type))
+            type->tp_hash == NULL)
         {
-            type->tp_richcompare = base->tp_richcompare;
-            type->tp_hash = base->tp_hash;
+            int r = overrides_hash(type);
+            if (r < 0) {
+                return -1;
+            }
+            if (!r) {
+                type->tp_richcompare = base->tp_richcompare;
+                type->tp_hash = base->tp_hash;
+            }
         }
     }
     {
@@ -5360,24 +5943,17 @@
          * obvious to be done -- the type is on its own.
          */
     }
+    return 0;
 }
 
 static int add_operators(PyTypeObject *);
+static int add_tp_new_wrapper(PyTypeObject *type);
 
-int
-PyType_Ready(PyTypeObject *type)
+#define COLLECTION_FLAGS (Py_TPFLAGS_SEQUENCE | Py_TPFLAGS_MAPPING)
+
+static int
+type_ready_checks(PyTypeObject *type)
 {
-    PyObject *dict, *bases;
-    PyTypeObject *base;
-    Py_ssize_t i, n;
-
-    if (type->tp_flags & Py_TPFLAGS_READY) {
-        assert(_PyType_CheckConsistency(type));
-        return 0;
-    }
-    _PyObject_ASSERT((PyObject *)type,
-                     (type->tp_flags & Py_TPFLAGS_READYING) == 0);
-
     /* Consistency checks for PEP 590:
      * - Py_TPFLAGS_METHOD_DESCRIPTOR requires tp_descr_get
      * - Py_TPFLAGS_HAVE_VECTORCALL requires tp_call and
@@ -5392,38 +5968,43 @@
         _PyObject_ASSERT((PyObject *)type, type->tp_call != NULL);
     }
 
-    type->tp_flags |= Py_TPFLAGS_READYING;
-
-#ifdef Py_TRACE_REFS
-    /* PyType_Ready is the closest thing we have to a choke point
-     * for type objects, so is the best place I can think of to try
-     * to get type objects into the doubly-linked list of all objects.
-     * Still, not all type objects go through PyType_Ready.
-     */
-    _Py_AddToAllObjects((PyObject *)type, 0);
-#endif
+    /* Consistency checks for pattern matching
+     * Py_TPFLAGS_SEQUENCE and Py_TPFLAGS_MAPPING are mutually exclusive */
+    _PyObject_ASSERT((PyObject *)type, (type->tp_flags & COLLECTION_FLAGS) != COLLECTION_FLAGS);
 
     if (type->tp_name == NULL) {
         PyErr_Format(PyExc_SystemError,
                      "Type does not define the tp_name field.");
-        goto error;
+        return -1;
     }
+    return 0;
+}
 
+
+static int
+type_ready_set_bases(PyTypeObject *type)
+{
     /* Initialize tp_base (defaults to BaseObject unless that's us) */
-    base = type->tp_base;
+    PyTypeObject *base = type->tp_base;
     if (base == NULL && type != &PyBaseObject_Type) {
-        base = type->tp_base = &PyBaseObject_Type;
-        Py_INCREF(base);
+        base = &PyBaseObject_Type;
+        if (type->tp_flags & Py_TPFLAGS_HEAPTYPE) {
+            type->tp_base = (PyTypeObject*)Py_NewRef((PyObject*)base);
+        }
+        else {
+            type->tp_base = base;
+        }
     }
+    assert(type->tp_base != NULL || type == &PyBaseObject_Type);
 
     /* Now the only way base can still be NULL is if type is
-     * &PyBaseObject_Type.
-     */
+     * &PyBaseObject_Type. */
 
     /* Initialize the base class */
-    if (base != NULL && base->tp_dict == NULL) {
-        if (PyType_Ready(base) < 0)
-            goto error;
+    if (base != NULL && !_PyType_IsReady(base)) {
+        if (PyType_Ready(base) < 0) {
+            return -1;
+        }
     }
 
     /* Initialize ob_type if NULL.      This means extensions that want to be
@@ -5438,78 +6019,190 @@
     }
 
     /* Initialize tp_bases */
-    bases = type->tp_bases;
+    PyObject *bases = type->tp_bases;
     if (bases == NULL) {
-        if (base == NULL)
+        PyTypeObject *base = type->tp_base;
+        if (base == NULL) {
             bases = PyTuple_New(0);
-        else
+        }
+        else {
             bases = PyTuple_Pack(1, base);
-        if (bases == NULL)
-            goto error;
+        }
+        if (bases == NULL) {
+            return -1;
+        }
         type->tp_bases = bases;
     }
+    return 0;
+}
 
-    /* Initialize tp_dict */
-    dict = type->tp_dict;
+
+static int
+type_ready_set_dict(PyTypeObject *type)
+{
+    if (type->tp_dict != NULL) {
+        return 0;
+    }
+
+    PyObject *dict = PyDict_New();
     if (dict == NULL) {
-        dict = PyDict_New();
-        if (dict == NULL)
-            goto error;
-        type->tp_dict = dict;
+        return -1;
+    }
+    type->tp_dict = dict;
+    return 0;
+}
+
+
+/* If the type dictionary doesn't contain a __doc__, set it from
+   the tp_doc slot. */
+static int
+type_dict_set_doc(PyTypeObject *type)
+{
+    int r = _PyDict_ContainsId(type->tp_dict, &PyId___doc__);
+    if (r < 0) {
+        return -1;
+    }
+    if (r > 0) {
+        return 0;
     }
 
+    if (type->tp_doc != NULL) {
+        const char *doc_str;
+        doc_str = _PyType_DocWithoutSignature(type->tp_name, type->tp_doc);
+        PyObject *doc = PyUnicode_FromString(doc_str);
+        if (doc == NULL) {
+            return -1;
+        }
+
+        if (_PyDict_SetItemId(type->tp_dict, &PyId___doc__, doc) < 0) {
+            Py_DECREF(doc);
+            return -1;
+        }
+        Py_DECREF(doc);
+    }
+    else {
+        if (_PyDict_SetItemId(type->tp_dict, &PyId___doc__, Py_None) < 0) {
+            return -1;
+        }
+    }
+    return 0;
+}
+
+
+static int
+type_ready_fill_dict(PyTypeObject *type)
+{
     /* Add type-specific descriptors to tp_dict */
-    if (add_operators(type) < 0)
-        goto error;
-    if (type->tp_methods != NULL) {
-        if (add_methods(type, type->tp_methods) < 0)
-            goto error;
+    if (add_operators(type) < 0) {
+        return -1;
     }
-    if (type->tp_members != NULL) {
-        if (add_members(type, type->tp_members) < 0)
-            goto error;
+    if (type_add_methods(type) < 0) {
+        return -1;
     }
-    if (type->tp_getset != NULL) {
-        if (add_getset(type, type->tp_getset) < 0)
-            goto error;
+    if (type_add_members(type) < 0) {
+        return -1;
     }
+    if (type_add_getset(type) < 0) {
+        return -1;
+    }
+    if (type_dict_set_doc(type) < 0) {
+        return -1;
+    }
+    return 0;
+}
 
+
+static int
+type_ready_mro(PyTypeObject *type)
+{
     /* Calculate method resolution order */
-    if (mro_internal(type, NULL) < 0)
-        goto error;
-
-    /* Inherit special flags from dominant base */
-    if (type->tp_base != NULL)
-        inherit_special(type, type->tp_base);
-
-    /* Initialize tp_dict properly */
-    bases = type->tp_mro;
-    assert(bases != NULL);
-    assert(PyTuple_Check(bases));
-    n = PyTuple_GET_SIZE(bases);
-    for (i = 1; i < n; i++) {
-        PyObject *b = PyTuple_GET_ITEM(bases, i);
-        if (PyType_Check(b))
-            inherit_slots(type, (PyTypeObject *)b);
+    if (mro_internal(type, NULL) < 0) {
+        return -1;
     }
+    assert(type->tp_mro != NULL);
+    assert(PyTuple_Check(type->tp_mro));
 
     /* All bases of statically allocated type should be statically allocated */
-    if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE))
-        for (i = 0; i < n; i++) {
-            PyObject *b = PyTuple_GET_ITEM(bases, i);
-            if (PyType_Check(b) &&
-                (((PyTypeObject *)b)->tp_flags & Py_TPFLAGS_HEAPTYPE)) {
+    if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) {
+        PyObject *mro = type->tp_mro;
+        Py_ssize_t n = PyTuple_GET_SIZE(mro);
+        for (Py_ssize_t i = 0; i < n; i++) {
+            PyTypeObject *base = (PyTypeObject *)PyTuple_GET_ITEM(mro, i);
+            if (PyType_Check(base) && (base->tp_flags & Py_TPFLAGS_HEAPTYPE)) {
                 PyErr_Format(PyExc_TypeError,
                              "type '%.100s' is not dynamically allocated but "
                              "its base type '%.100s' is dynamically allocated",
-                             type->tp_name, ((PyTypeObject *)b)->tp_name);
-                goto error;
+                             type->tp_name, base->tp_name);
+                return -1;
             }
         }
+    }
+    return 0;
+}
+
+
+// For static types, inherit tp_as_xxx structures from the base class
+// if it's NULL.
+//
+// For heap types, tp_as_xxx structures are not NULL: they are set to the
+// PyHeapTypeObject.as_xxx fields by type_new_alloc().
+static void
+type_ready_inherit_as_structs(PyTypeObject *type, PyTypeObject *base)
+{
+    if (type->tp_as_async == NULL) {
+        type->tp_as_async = base->tp_as_async;
+    }
+    if (type->tp_as_number == NULL) {
+        type->tp_as_number = base->tp_as_number;
+    }
+    if (type->tp_as_sequence == NULL) {
+        type->tp_as_sequence = base->tp_as_sequence;
+    }
+    if (type->tp_as_mapping == NULL) {
+        type->tp_as_mapping = base->tp_as_mapping;
+    }
+    if (type->tp_as_buffer == NULL) {
+        type->tp_as_buffer = base->tp_as_buffer;
+    }
+}
+
+static void
+inherit_patma_flags(PyTypeObject *type, PyTypeObject *base) {
+    if ((type->tp_flags & COLLECTION_FLAGS) == 0) {
+        type->tp_flags |= base->tp_flags & COLLECTION_FLAGS;
+    }
+}
+
+static int
+type_ready_inherit(PyTypeObject *type)
+{
+    /* Inherit special flags from dominant base */
+    PyTypeObject *base = type->tp_base;
+    if (base != NULL) {
+        inherit_special(type, base);
+    }
+
+    // Inherit slots
+    PyObject *mro = type->tp_mro;
+    Py_ssize_t n = PyTuple_GET_SIZE(type->tp_mro);
+    for (Py_ssize_t i = 1; i < n; i++) {
+        PyObject *b = PyTuple_GET_ITEM(mro, i);
+        if (PyType_Check(b)) {
+            if (inherit_slots(type, (PyTypeObject *)b) < 0) {
+                return -1;
+            }
+            inherit_patma_flags(type, (PyTypeObject *)b);
+        }
+    }
+
+    if (base != NULL) {
+        type_ready_inherit_as_structs(type, base);
+    }
 
     /* Sanity check for tp_free. */
     if (_PyType_IS_GC(type) && (type->tp_flags & Py_TPFLAGS_BASETYPE) &&
-        (type->tp_free == NULL || type->tp_free == PyObject_Del)) {
+        (type->tp_free == NULL || type->tp_free == PyObject_Del))
+    {
         /* This base class needs to call tp_free, but doesn't have
          * one, or its tp_free is for non-gc'ed objects.
          */
@@ -5517,108 +6210,201 @@
                      "gc and is a base type but has inappropriate "
                      "tp_free slot",
                      type->tp_name);
-        goto error;
+        return -1;
     }
 
-    /* if the type dictionary doesn't contain a __doc__, set it from
-       the tp_doc slot.
-     */
-    if (_PyDict_GetItemIdWithError(type->tp_dict, &PyId___doc__) == NULL) {
-        if (PyErr_Occurred()) {
-            goto error;
-        }
-        if (type->tp_doc != NULL) {
-            const char *old_doc = _PyType_DocWithoutSignature(type->tp_name,
-                type->tp_doc);
-            PyObject *doc = PyUnicode_FromString(old_doc);
-            if (doc == NULL)
-                goto error;
-            if (_PyDict_SetItemId(type->tp_dict, &PyId___doc__, doc) < 0) {
-                Py_DECREF(doc);
-                goto error;
-            }
-            Py_DECREF(doc);
-        } else {
-            if (_PyDict_SetItemId(type->tp_dict,
-                                  &PyId___doc__, Py_None) < 0)
-                goto error;
-        }
+    return 0;
+}
+
+
+/* Hack for tp_hash and __hash__.
+   If after all that, tp_hash is still NULL, and __hash__ is not in
+   tp_dict, set tp_hash to PyObject_HashNotImplemented and
+   tp_dict['__hash__'] equal to None.
+   This signals that __hash__ is not inherited. */
+static int
+type_ready_set_hash(PyTypeObject *type)
+{
+    if (type->tp_hash != NULL) {
+        return 0;
     }
 
-    /* Hack for tp_hash and __hash__.
-       If after all that, tp_hash is still NULL, and __hash__ is not in
-       tp_dict, set tp_hash to PyObject_HashNotImplemented and
-       tp_dict['__hash__'] equal to None.
-       This signals that __hash__ is not inherited.
-     */
-    if (type->tp_hash == NULL) {
-        if (_PyDict_GetItemIdWithError(type->tp_dict, &PyId___hash__) == NULL) {
-            if (PyErr_Occurred() ||
-               _PyDict_SetItemId(type->tp_dict, &PyId___hash__, Py_None) < 0)
-            {
-                goto error;
-            }
-            type->tp_hash = PyObject_HashNotImplemented;
-        }
+    int r = _PyDict_ContainsId(type->tp_dict, &PyId___hash__);
+    if (r < 0) {
+        return -1;
+    }
+    if (r > 0) {
+        return 0;
     }
 
-    /* Some more special stuff */
-    base = type->tp_base;
-    if (base != NULL) {
-        if (type->tp_as_async == NULL)
-            type->tp_as_async = base->tp_as_async;
-        if (type->tp_as_number == NULL)
-            type->tp_as_number = base->tp_as_number;
-        if (type->tp_as_sequence == NULL)
-            type->tp_as_sequence = base->tp_as_sequence;
-        if (type->tp_as_mapping == NULL)
-            type->tp_as_mapping = base->tp_as_mapping;
-        if (type->tp_as_buffer == NULL)
-            type->tp_as_buffer = base->tp_as_buffer;
+    if (_PyDict_SetItemId(type->tp_dict, &PyId___hash__, Py_None) < 0) {
+        return -1;
     }
+    type->tp_hash = PyObject_HashNotImplemented;
+    return 0;
+}
 
-    /* Link into each base class's list of subclasses */
-    bases = type->tp_bases;
-    n = PyTuple_GET_SIZE(bases);
-    for (i = 0; i < n; i++) {
+
+/* Link into each base class's list of subclasses */
+static int
+type_ready_add_subclasses(PyTypeObject *type)
+{
+    PyObject *bases = type->tp_bases;
+    Py_ssize_t nbase = PyTuple_GET_SIZE(bases);
+    for (Py_ssize_t i = 0; i < nbase; i++) {
         PyObject *b = PyTuple_GET_ITEM(bases, i);
-        if (PyType_Check(b) &&
-            add_subclass((PyTypeObject *)b, type) < 0)
-            goto error;
+        if (PyType_Check(b) && add_subclass((PyTypeObject *)b, type) < 0) {
+            return -1;
+        }
+    }
+    return 0;
+}
+
+
+// Set tp_new and the "__new__" key in the type dictionary.
+// Use the Py_TPFLAGS_DISALLOW_INSTANTIATION flag.
+static int
+type_ready_set_new(PyTypeObject *type)
+{
+    PyTypeObject *base = type->tp_base;
+    /* The condition below could use some explanation.
+
+       It appears that tp_new is not inherited for static types whose base
+       class is 'object'; this seems to be a precaution so that old extension
+       types don't suddenly become callable (object.__new__ wouldn't insure the
+       invariants that the extension type's own factory function ensures).
+
+       Heap types, of course, are under our control, so they do inherit tp_new;
+       static extension types that specify some other built-in type as the
+       default also inherit object.__new__. */
+    if (type->tp_new == NULL
+        && base == &PyBaseObject_Type
+        && !(type->tp_flags & Py_TPFLAGS_HEAPTYPE))
+    {
+        type->tp_flags |= Py_TPFLAGS_DISALLOW_INSTANTIATION;
+    }
+
+    if (!(type->tp_flags & Py_TPFLAGS_DISALLOW_INSTANTIATION)) {
+        if (type->tp_new != NULL) {
+            // If "__new__" key does not exists in the type dictionary,
+            // set it to tp_new_wrapper().
+            if (add_tp_new_wrapper(type) < 0) {
+                return -1;
+            }
+        }
+        else {
+            // tp_new is NULL: inherit tp_new from base
+            type->tp_new = base->tp_new;
+        }
+    }
+    else {
+        // Py_TPFLAGS_DISALLOW_INSTANTIATION sets tp_new to NULL
+        type->tp_new = NULL;
+    }
+    return 0;
+}
+
+
+static int
+type_ready(PyTypeObject *type)
+{
+    if (type_ready_checks(type) < 0) {
+        return -1;
+    }
+
+#ifdef Py_TRACE_REFS
+    /* PyType_Ready is the closest thing we have to a choke point
+     * for type objects, so is the best place I can think of to try
+     * to get type objects into the doubly-linked list of all objects.
+     * Still, not all type objects go through PyType_Ready.
+     */
+    _Py_AddToAllObjects((PyObject *)type, 0);
+#endif
+
+    /* Initialize tp_dict: _PyType_IsReady() tests if tp_dict != NULL */
+    if (type_ready_set_dict(type) < 0) {
+        return -1;
+    }
+    if (type_ready_set_bases(type) < 0) {
+        return -1;
+    }
+    if (type_ready_mro(type) < 0) {
+        return -1;
+    }
+    if (type_ready_set_new(type) < 0) {
+        return -1;
+    }
+    if (type_ready_fill_dict(type) < 0) {
+        return -1;
+    }
+    if (type_ready_inherit(type) < 0) {
+        return -1;
+    }
+    if (type_ready_set_hash(type) < 0) {
+        return -1;
+    }
+    if (type_ready_add_subclasses(type) < 0) {
+        return -1;
+    }
+    return 0;
+}
+
+
+int
+PyType_Ready(PyTypeObject *type)
+{
+    if (type->tp_flags & Py_TPFLAGS_READY) {
+        assert(_PyType_CheckConsistency(type));
+        return 0;
+    }
+    _PyObject_ASSERT((PyObject *)type,
+                     (type->tp_flags & Py_TPFLAGS_READYING) == 0);
+
+    type->tp_flags |= Py_TPFLAGS_READYING;
+
+    /* Historically, all static types were immutable. See bpo-43908 */
+    if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) {
+        type->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE;
+    }
+
+    if (type_ready(type) < 0) {
+        type->tp_flags &= ~Py_TPFLAGS_READYING;
+        return -1;
     }
 
     /* All done -- set the ready flag */
-    type->tp_flags =
-        (type->tp_flags & ~Py_TPFLAGS_READYING) | Py_TPFLAGS_READY;
+    type->tp_flags = (type->tp_flags & ~Py_TPFLAGS_READYING) | Py_TPFLAGS_READY;
     assert(_PyType_CheckConsistency(type));
     return 0;
-
-  error:
-    type->tp_flags &= ~Py_TPFLAGS_READYING;
-    return -1;
 }
 
+
 static int
 add_subclass(PyTypeObject *base, PyTypeObject *type)
 {
-    int result = -1;
-    PyObject *dict, *key, *newobj;
+    PyObject *key = PyLong_FromVoidPtr((void *) type);
+    if (key == NULL)
+        return -1;
 
-    dict = base->tp_subclasses;
+    PyObject *ref = PyWeakref_NewRef((PyObject *)type, NULL);
+    if (ref == NULL) {
+        Py_DECREF(key);
+        return -1;
+    }
+
+    // Only get tp_subclasses after creating the key and value.
+    // PyWeakref_NewRef() can trigger a garbage collection which can execute
+    // arbitrary Python code and so modify base->tp_subclasses.
+    PyObject *dict = base->tp_subclasses;
     if (dict == NULL) {
         base->tp_subclasses = dict = PyDict_New();
         if (dict == NULL)
             return -1;
     }
     assert(PyDict_CheckExact(dict));
-    key = PyLong_FromVoidPtr((void *) type);
-    if (key == NULL)
-        return -1;
-    newobj = PyWeakref_NewRef((PyObject *)type, NULL);
-    if (newobj != NULL) {
-        result = PyDict_SetItem(dict, key, newobj);
-        Py_DECREF(newobj);
-    }
+
+    int result = PyDict_SetItem(dict, key, ref);
+    Py_DECREF(ref);
     Py_DECREF(key);
     return result;
 }
@@ -6176,8 +6962,8 @@
                      "__new__() called with non-type 'self'");
         return NULL;
     }
-
     type = (PyTypeObject *)self;
+
     if (!PyTuple_Check(args) || PyTuple_GET_SIZE(args) < 1) {
         PyErr_Format(PyExc_TypeError,
                      "%s.__new__(): not enough arguments",
@@ -6239,21 +7025,21 @@
 static int
 add_tp_new_wrapper(PyTypeObject *type)
 {
-    PyObject *func;
-
-    if (_PyDict_GetItemIdWithError(type->tp_dict, &PyId___new__) != NULL)
+    int r = _PyDict_ContainsId(type->tp_dict, &PyId___new__);
+    if (r > 0) {
         return 0;
-    if (PyErr_Occurred())
-        return -1;
-    func = PyCFunction_NewEx(tp_new_methoddef, (PyObject *)type, NULL);
-    if (func == NULL)
-        return -1;
-    if (_PyDict_SetItemId(type->tp_dict, &PyId___new__, func)) {
-        Py_DECREF(func);
+    }
+    if (r < 0) {
         return -1;
     }
+
+    PyObject *func = PyCFunction_NewEx(tp_new_methoddef, (PyObject *)type, NULL);
+    if (func == NULL) {
+        return -1;
+    }
+    r = _PyDict_SetItemId(type->tp_dict, &PyId___new__, func);
     Py_DECREF(func);
-    return 0;
+    return r;
 }
 
 /* Slot wrappers that call the corresponding __foo__ slot.  See comments
@@ -6368,7 +7154,7 @@
     if (res == NULL)
         return -1;
 
-    Py_SETREF(res, PyNumber_Index(res));
+    Py_SETREF(res, _PyNumber_Index(res));
     if (res == NULL)
         return -1;
 
@@ -7210,7 +7996,7 @@
     UNSLOT("__abs__", nb_absolute, slot_nb_absolute, wrap_unaryfunc,
            "abs(self)"),
     UNSLOT("__bool__", nb_bool, slot_nb_bool, wrap_inquirypred,
-           "self != 0"),
+           "True if self else False"),
     UNSLOT("__invert__", nb_invert, slot_nb_invert, wrap_unaryfunc, "~self"),
     BINSLOT("__lshift__", nb_lshift, slot_nb_lshift, "<<"),
     RBINSLOT("__rlshift__", nb_lshift, slot_nb_lshift, "<<"),
@@ -7610,8 +8396,17 @@
     assert(slotdefs_initialized);
     pp = ptrs;
     for (p = slotdefs; p->name; p++) {
-        if (p->name_strobj == name)
+        assert(PyUnicode_CheckExact(p->name_strobj));
+        assert(PyUnicode_CheckExact(name));
+#ifdef INTERN_NAME_STRINGS
+        if (p->name_strobj == name) {
             *pp++ = p;
+        }
+#else
+        if (p->name_strobj == name || _PyUnicode_EQ(p->name_strobj, name)) {
+            *pp++ = p;
+        }
+#endif
     }
     *pp = NULL;
     for (pp = ptrs; *pp; pp++) {
@@ -7633,11 +8428,11 @@
 static void
 fixup_slot_dispatchers(PyTypeObject *type)
 {
-    slotdef *p;
-
+    assert(!PyErr_Occurred());
     assert(slotdefs_initialized);
-    for (p = slotdefs; p->name; )
+    for (slotdef *p = slotdefs; p->name; ) {
         p = update_one_slot(type, p);
+    }
 }
 
 static void
@@ -7655,63 +8450,67 @@
     }
 }
 
-/* Call __set_name__ on all descriptors in a newly generated type */
+
+/* Call __set_name__ on all attributes (including descriptors)
+  in a newly generated type */
 static int
-set_names(PyTypeObject *type)
+type_new_set_names(PyTypeObject *type)
 {
-    PyObject *names_to_set, *key, *value, *set_name, *tmp;
-    Py_ssize_t i = 0;
-
-    names_to_set = PyDict_Copy(type->tp_dict);
-    if (names_to_set == NULL)
+    PyObject *names_to_set = PyDict_Copy(type->tp_dict);
+    if (names_to_set == NULL) {
         return -1;
+    }
 
+    Py_ssize_t i = 0;
+    PyObject *key, *value;
     while (PyDict_Next(names_to_set, &i, &key, &value)) {
-        set_name = _PyObject_LookupSpecial(value, &PyId___set_name__);
-        if (set_name != NULL) {
-            tmp = PyObject_CallFunctionObjArgs(set_name, type, key, NULL);
-            Py_DECREF(set_name);
-            if (tmp == NULL) {
-                _PyErr_FormatFromCause(PyExc_RuntimeError,
-                    "Error calling __set_name__ on '%.100s' instance %R "
-                    "in '%.100s'",
-                    Py_TYPE(value)->tp_name, key, type->tp_name);
-                Py_DECREF(names_to_set);
-                return -1;
+        PyObject *set_name = _PyObject_LookupSpecial(value, &PyId___set_name__);
+        if (set_name == NULL) {
+            if (PyErr_Occurred()) {
+                goto error;
             }
-            else
-                Py_DECREF(tmp);
+            continue;
         }
-        else if (PyErr_Occurred()) {
-            Py_DECREF(names_to_set);
-            return -1;
+
+        PyObject *res = PyObject_CallFunctionObjArgs(set_name, type, key, NULL);
+        Py_DECREF(set_name);
+
+        if (res == NULL) {
+            _PyErr_FormatFromCause(PyExc_RuntimeError,
+                "Error calling __set_name__ on '%.100s' instance %R "
+                "in '%.100s'",
+                Py_TYPE(value)->tp_name, key, type->tp_name);
+            goto error;
         }
+        Py_DECREF(res);
     }
 
     Py_DECREF(names_to_set);
     return 0;
+
+error:
+    Py_DECREF(names_to_set);
+    return -1;
 }
 
+
 /* Call __init_subclass__ on the parent of a newly generated type */
 static int
-init_subclass(PyTypeObject *type, PyObject *kwds)
+type_new_init_subclass(PyTypeObject *type, PyObject *kwds)
 {
-    PyObject *super, *func, *result;
     PyObject *args[2] = {(PyObject *)type, (PyObject *)type};
-
-    super = _PyObject_FastCall((PyObject *)&PySuper_Type, args, 2);
+    PyObject *super = _PyObject_FastCall((PyObject *)&PySuper_Type, args, 2);
     if (super == NULL) {
         return -1;
     }
 
-    func = _PyObject_GetAttrId(super, &PyId___init_subclass__);
+    PyObject *func = _PyObject_GetAttrId(super, &PyId___init_subclass__);
     Py_DECREF(super);
     if (func == NULL) {
         return -1;
     }
 
-
-    result = PyObject_VectorcallDict(func, NULL, 0, kwds);
+    PyObject *result = PyObject_VectorcallDict(func, NULL, 0, kwds);
     Py_DECREF(func);
     if (result == NULL) {
         return -1;
@@ -7721,6 +8520,7 @@
     return 0;
 }
 
+
 /* recurse_down_subclasses() and update_subclasses() are mutually
    recursive functions to call a callback for all subclasses,
    but refraining from recursing into subclasses that define 'name'. */
@@ -7757,10 +8557,11 @@
         /* Avoid recursing down into unaffected classes */
         dict = subclass->tp_dict;
         if (dict != NULL && PyDict_Check(dict)) {
-            if (PyDict_GetItemWithError(dict, name) != NULL) {
+            int r = PyDict_Contains(dict, name);
+            if (r > 0) {
                 continue;
             }
-            if (PyErr_Occurred()) {
+            if (r < 0) {
                 return -1;
             }
         }
@@ -7815,9 +8616,10 @@
         ptr = slotptr(type, p->offset);
         if (!ptr || !*ptr)
             continue;
-        if (PyDict_GetItemWithError(dict, p->name_strobj))
+        int r = PyDict_Contains(dict, p->name_strobj);
+        if (r > 0)
             continue;
-        if (PyErr_Occurred()) {
+        if (r < 0) {
             return -1;
         }
         if (*ptr == (void *)PyObject_HashNotImplemented) {
@@ -7838,10 +8640,6 @@
             Py_DECREF(descr);
         }
     }
-    if (type->tp_new != NULL) {
-        if (add_tp_new_wrapper(type) < 0)
-            return -1;
-    }
     return 0;
 }
 
diff --git a/Objects/typeslots.inc b/Objects/typeslots.inc
index ffc9bb2..896daa7 100644
--- a/Objects/typeslots.inc
+++ b/Objects/typeslots.inc
@@ -1,81 +1,82 @@
 /* Generated by typeslots.py */
-offsetof(PyHeapTypeObject, as_buffer.bf_getbuffer),
-offsetof(PyHeapTypeObject, as_buffer.bf_releasebuffer),
-offsetof(PyHeapTypeObject, as_mapping.mp_ass_subscript),
-offsetof(PyHeapTypeObject, as_mapping.mp_length),
-offsetof(PyHeapTypeObject, as_mapping.mp_subscript),
-offsetof(PyHeapTypeObject, as_number.nb_absolute),
-offsetof(PyHeapTypeObject, as_number.nb_add),
-offsetof(PyHeapTypeObject, as_number.nb_and),
-offsetof(PyHeapTypeObject, as_number.nb_bool),
-offsetof(PyHeapTypeObject, as_number.nb_divmod),
-offsetof(PyHeapTypeObject, as_number.nb_float),
-offsetof(PyHeapTypeObject, as_number.nb_floor_divide),
-offsetof(PyHeapTypeObject, as_number.nb_index),
-offsetof(PyHeapTypeObject, as_number.nb_inplace_add),
-offsetof(PyHeapTypeObject, as_number.nb_inplace_and),
-offsetof(PyHeapTypeObject, as_number.nb_inplace_floor_divide),
-offsetof(PyHeapTypeObject, as_number.nb_inplace_lshift),
-offsetof(PyHeapTypeObject, as_number.nb_inplace_multiply),
-offsetof(PyHeapTypeObject, as_number.nb_inplace_or),
-offsetof(PyHeapTypeObject, as_number.nb_inplace_power),
-offsetof(PyHeapTypeObject, as_number.nb_inplace_remainder),
-offsetof(PyHeapTypeObject, as_number.nb_inplace_rshift),
-offsetof(PyHeapTypeObject, as_number.nb_inplace_subtract),
-offsetof(PyHeapTypeObject, as_number.nb_inplace_true_divide),
-offsetof(PyHeapTypeObject, as_number.nb_inplace_xor),
-offsetof(PyHeapTypeObject, as_number.nb_int),
-offsetof(PyHeapTypeObject, as_number.nb_invert),
-offsetof(PyHeapTypeObject, as_number.nb_lshift),
-offsetof(PyHeapTypeObject, as_number.nb_multiply),
-offsetof(PyHeapTypeObject, as_number.nb_negative),
-offsetof(PyHeapTypeObject, as_number.nb_or),
-offsetof(PyHeapTypeObject, as_number.nb_positive),
-offsetof(PyHeapTypeObject, as_number.nb_power),
-offsetof(PyHeapTypeObject, as_number.nb_remainder),
-offsetof(PyHeapTypeObject, as_number.nb_rshift),
-offsetof(PyHeapTypeObject, as_number.nb_subtract),
-offsetof(PyHeapTypeObject, as_number.nb_true_divide),
-offsetof(PyHeapTypeObject, as_number.nb_xor),
-offsetof(PyHeapTypeObject, as_sequence.sq_ass_item),
-offsetof(PyHeapTypeObject, as_sequence.sq_concat),
-offsetof(PyHeapTypeObject, as_sequence.sq_contains),
-offsetof(PyHeapTypeObject, as_sequence.sq_inplace_concat),
-offsetof(PyHeapTypeObject, as_sequence.sq_inplace_repeat),
-offsetof(PyHeapTypeObject, as_sequence.sq_item),
-offsetof(PyHeapTypeObject, as_sequence.sq_length),
-offsetof(PyHeapTypeObject, as_sequence.sq_repeat),
-offsetof(PyHeapTypeObject, ht_type.tp_alloc),
-offsetof(PyHeapTypeObject, ht_type.tp_base),
-offsetof(PyHeapTypeObject, ht_type.tp_bases),
-offsetof(PyHeapTypeObject, ht_type.tp_call),
-offsetof(PyHeapTypeObject, ht_type.tp_clear),
-offsetof(PyHeapTypeObject, ht_type.tp_dealloc),
-offsetof(PyHeapTypeObject, ht_type.tp_del),
-offsetof(PyHeapTypeObject, ht_type.tp_descr_get),
-offsetof(PyHeapTypeObject, ht_type.tp_descr_set),
-offsetof(PyHeapTypeObject, ht_type.tp_doc),
-offsetof(PyHeapTypeObject, ht_type.tp_getattr),
-offsetof(PyHeapTypeObject, ht_type.tp_getattro),
-offsetof(PyHeapTypeObject, ht_type.tp_hash),
-offsetof(PyHeapTypeObject, ht_type.tp_init),
-offsetof(PyHeapTypeObject, ht_type.tp_is_gc),
-offsetof(PyHeapTypeObject, ht_type.tp_iter),
-offsetof(PyHeapTypeObject, ht_type.tp_iternext),
-offsetof(PyHeapTypeObject, ht_type.tp_methods),
-offsetof(PyHeapTypeObject, ht_type.tp_new),
-offsetof(PyHeapTypeObject, ht_type.tp_repr),
-offsetof(PyHeapTypeObject, ht_type.tp_richcompare),
-offsetof(PyHeapTypeObject, ht_type.tp_setattr),
-offsetof(PyHeapTypeObject, ht_type.tp_setattro),
-offsetof(PyHeapTypeObject, ht_type.tp_str),
-offsetof(PyHeapTypeObject, ht_type.tp_traverse),
-offsetof(PyHeapTypeObject, ht_type.tp_members),
-offsetof(PyHeapTypeObject, ht_type.tp_getset),
-offsetof(PyHeapTypeObject, ht_type.tp_free),
-offsetof(PyHeapTypeObject, as_number.nb_matrix_multiply),
-offsetof(PyHeapTypeObject, as_number.nb_inplace_matrix_multiply),
-offsetof(PyHeapTypeObject, as_async.am_await),
-offsetof(PyHeapTypeObject, as_async.am_aiter),
-offsetof(PyHeapTypeObject, as_async.am_anext),
-offsetof(PyHeapTypeObject, ht_type.tp_finalize),
+{offsetof(PyBufferProcs, bf_getbuffer), offsetof(PyTypeObject, tp_as_buffer)},
+{offsetof(PyBufferProcs, bf_releasebuffer), offsetof(PyTypeObject, tp_as_buffer)},
+{offsetof(PyMappingMethods, mp_ass_subscript), offsetof(PyTypeObject, tp_as_mapping)},
+{offsetof(PyMappingMethods, mp_length), offsetof(PyTypeObject, tp_as_mapping)},
+{offsetof(PyMappingMethods, mp_subscript), offsetof(PyTypeObject, tp_as_mapping)},
+{offsetof(PyNumberMethods, nb_absolute), offsetof(PyTypeObject, tp_as_number)},
+{offsetof(PyNumberMethods, nb_add), offsetof(PyTypeObject, tp_as_number)},
+{offsetof(PyNumberMethods, nb_and), offsetof(PyTypeObject, tp_as_number)},
+{offsetof(PyNumberMethods, nb_bool), offsetof(PyTypeObject, tp_as_number)},
+{offsetof(PyNumberMethods, nb_divmod), offsetof(PyTypeObject, tp_as_number)},
+{offsetof(PyNumberMethods, nb_float), offsetof(PyTypeObject, tp_as_number)},
+{offsetof(PyNumberMethods, nb_floor_divide), offsetof(PyTypeObject, tp_as_number)},
+{offsetof(PyNumberMethods, nb_index), offsetof(PyTypeObject, tp_as_number)},
+{offsetof(PyNumberMethods, nb_inplace_add), offsetof(PyTypeObject, tp_as_number)},
+{offsetof(PyNumberMethods, nb_inplace_and), offsetof(PyTypeObject, tp_as_number)},
+{offsetof(PyNumberMethods, nb_inplace_floor_divide), offsetof(PyTypeObject, tp_as_number)},
+{offsetof(PyNumberMethods, nb_inplace_lshift), offsetof(PyTypeObject, tp_as_number)},
+{offsetof(PyNumberMethods, nb_inplace_multiply), offsetof(PyTypeObject, tp_as_number)},
+{offsetof(PyNumberMethods, nb_inplace_or), offsetof(PyTypeObject, tp_as_number)},
+{offsetof(PyNumberMethods, nb_inplace_power), offsetof(PyTypeObject, tp_as_number)},
+{offsetof(PyNumberMethods, nb_inplace_remainder), offsetof(PyTypeObject, tp_as_number)},
+{offsetof(PyNumberMethods, nb_inplace_rshift), offsetof(PyTypeObject, tp_as_number)},
+{offsetof(PyNumberMethods, nb_inplace_subtract), offsetof(PyTypeObject, tp_as_number)},
+{offsetof(PyNumberMethods, nb_inplace_true_divide), offsetof(PyTypeObject, tp_as_number)},
+{offsetof(PyNumberMethods, nb_inplace_xor), offsetof(PyTypeObject, tp_as_number)},
+{offsetof(PyNumberMethods, nb_int), offsetof(PyTypeObject, tp_as_number)},
+{offsetof(PyNumberMethods, nb_invert), offsetof(PyTypeObject, tp_as_number)},
+{offsetof(PyNumberMethods, nb_lshift), offsetof(PyTypeObject, tp_as_number)},
+{offsetof(PyNumberMethods, nb_multiply), offsetof(PyTypeObject, tp_as_number)},
+{offsetof(PyNumberMethods, nb_negative), offsetof(PyTypeObject, tp_as_number)},
+{offsetof(PyNumberMethods, nb_or), offsetof(PyTypeObject, tp_as_number)},
+{offsetof(PyNumberMethods, nb_positive), offsetof(PyTypeObject, tp_as_number)},
+{offsetof(PyNumberMethods, nb_power), offsetof(PyTypeObject, tp_as_number)},
+{offsetof(PyNumberMethods, nb_remainder), offsetof(PyTypeObject, tp_as_number)},
+{offsetof(PyNumberMethods, nb_rshift), offsetof(PyTypeObject, tp_as_number)},
+{offsetof(PyNumberMethods, nb_subtract), offsetof(PyTypeObject, tp_as_number)},
+{offsetof(PyNumberMethods, nb_true_divide), offsetof(PyTypeObject, tp_as_number)},
+{offsetof(PyNumberMethods, nb_xor), offsetof(PyTypeObject, tp_as_number)},
+{offsetof(PySequenceMethods, sq_ass_item), offsetof(PyTypeObject, tp_as_sequence)},
+{offsetof(PySequenceMethods, sq_concat), offsetof(PyTypeObject, tp_as_sequence)},
+{offsetof(PySequenceMethods, sq_contains), offsetof(PyTypeObject, tp_as_sequence)},
+{offsetof(PySequenceMethods, sq_inplace_concat), offsetof(PyTypeObject, tp_as_sequence)},
+{offsetof(PySequenceMethods, sq_inplace_repeat), offsetof(PyTypeObject, tp_as_sequence)},
+{offsetof(PySequenceMethods, sq_item), offsetof(PyTypeObject, tp_as_sequence)},
+{offsetof(PySequenceMethods, sq_length), offsetof(PyTypeObject, tp_as_sequence)},
+{offsetof(PySequenceMethods, sq_repeat), offsetof(PyTypeObject, tp_as_sequence)},
+{-1, offsetof(PyTypeObject, tp_alloc)},
+{-1, offsetof(PyTypeObject, tp_base)},
+{-1, offsetof(PyTypeObject, tp_bases)},
+{-1, offsetof(PyTypeObject, tp_call)},
+{-1, offsetof(PyTypeObject, tp_clear)},
+{-1, offsetof(PyTypeObject, tp_dealloc)},
+{-1, offsetof(PyTypeObject, tp_del)},
+{-1, offsetof(PyTypeObject, tp_descr_get)},
+{-1, offsetof(PyTypeObject, tp_descr_set)},
+{-1, offsetof(PyTypeObject, tp_doc)},
+{-1, offsetof(PyTypeObject, tp_getattr)},
+{-1, offsetof(PyTypeObject, tp_getattro)},
+{-1, offsetof(PyTypeObject, tp_hash)},
+{-1, offsetof(PyTypeObject, tp_init)},
+{-1, offsetof(PyTypeObject, tp_is_gc)},
+{-1, offsetof(PyTypeObject, tp_iter)},
+{-1, offsetof(PyTypeObject, tp_iternext)},
+{-1, offsetof(PyTypeObject, tp_methods)},
+{-1, offsetof(PyTypeObject, tp_new)},
+{-1, offsetof(PyTypeObject, tp_repr)},
+{-1, offsetof(PyTypeObject, tp_richcompare)},
+{-1, offsetof(PyTypeObject, tp_setattr)},
+{-1, offsetof(PyTypeObject, tp_setattro)},
+{-1, offsetof(PyTypeObject, tp_str)},
+{-1, offsetof(PyTypeObject, tp_traverse)},
+{-1, offsetof(PyTypeObject, tp_members)},
+{-1, offsetof(PyTypeObject, tp_getset)},
+{-1, offsetof(PyTypeObject, tp_free)},
+{offsetof(PyNumberMethods, nb_matrix_multiply), offsetof(PyTypeObject, tp_as_number)},
+{offsetof(PyNumberMethods, nb_inplace_matrix_multiply), offsetof(PyTypeObject, tp_as_number)},
+{offsetof(PyAsyncMethods, am_await), offsetof(PyTypeObject, tp_as_async)},
+{offsetof(PyAsyncMethods, am_aiter), offsetof(PyTypeObject, tp_as_async)},
+{offsetof(PyAsyncMethods, am_anext), offsetof(PyTypeObject, tp_as_async)},
+{-1, offsetof(PyTypeObject, tp_finalize)},
+{offsetof(PyAsyncMethods, am_send), offsetof(PyTypeObject, tp_as_async)},
diff --git a/Objects/typeslots.py b/Objects/typeslots.py
index 9b6d4ad..8ab05f9 100755
--- a/Objects/typeslots.py
+++ b/Objects/typeslots.py
@@ -3,6 +3,7 @@
 
 import sys, re
 
+
 def generate_typeslots(out=sys.stdout):
     out.write("/* Generated by typeslots.py */\n")
     res = {}
@@ -10,27 +11,34 @@
         m = re.match("#define Py_([a-z_]+) ([0-9]+)", line)
         if not m:
             continue
+
         member = m.group(1)
         if member.startswith("tp_"):
-            member = "ht_type."+member
+            member = f'{{-1, offsetof(PyTypeObject, {member})}}'
         elif member.startswith("am_"):
-            member = "as_async."+member
+            member = (f'{{offsetof(PyAsyncMethods, {member}),'+
+                      ' offsetof(PyTypeObject, tp_as_async)}')
         elif member.startswith("nb_"):
-            member = "as_number."+member
+            member = (f'{{offsetof(PyNumberMethods, {member}),'+
+                      ' offsetof(PyTypeObject, tp_as_number)}')
         elif member.startswith("mp_"):
-            member = "as_mapping."+member
+            member = (f'{{offsetof(PyMappingMethods, {member}),'+
+                      ' offsetof(PyTypeObject, tp_as_mapping)}')
         elif member.startswith("sq_"):
-            member = "as_sequence."+member
+            member = (f'{{offsetof(PySequenceMethods, {member}),'+
+                      ' offsetof(PyTypeObject, tp_as_sequence)}')
         elif member.startswith("bf_"):
-            member = "as_buffer."+member
+            member = (f'{{offsetof(PyBufferProcs, {member}),'+
+                      ' offsetof(PyTypeObject, tp_as_buffer)}')
         res[int(m.group(2))] = member
 
     M = max(res.keys())+1
     for i in range(1,M):
         if i in res:
-            out.write("offsetof(PyHeapTypeObject, %s),\n" % res[i])
+            out.write("%s,\n" % res[i])
         else:
-            out.write("0,\n")
+            out.write("{0, 0},\n")
+
 
 def main():
     if len(sys.argv) == 2:
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index ffd13f7..077cf8d 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -40,24 +40,29 @@
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
-#include "pycore_abstract.h"       // _PyIndex_Check()
-#include "pycore_bytes_methods.h"
-#include "pycore_fileutils.h"
-#include "pycore_initconfig.h"
-#include "pycore_interp.h"         // PyInterpreterState.fs_codec
-#include "pycore_object.h"
-#include "pycore_pathconfig.h"
-#include "pycore_pylifecycle.h"
-#include "pycore_pystate.h"        // _PyInterpreterState_GET()
-#include "ucnhash.h"
-#include "stringlib/eq.h"
+#include "pycore_abstract.h"      // _PyIndex_Check()
+#include "pycore_atomic_funcs.h"  // _Py_atomic_size_get()
+#include "pycore_bytes_methods.h" // _Py_bytes_lower()
+#include "pycore_format.h"        // F_LJUST
+#include "pycore_initconfig.h"    // _PyStatus_OK()
+#include "pycore_interp.h"        // PyInterpreterState.fs_codec
+#include "pycore_object.h"        // _PyObject_GC_TRACK()
+#include "pycore_pathconfig.h"    // _Py_DumpPathConfig()
+#include "pycore_pylifecycle.h"   // _Py_SetFileSystemEncoding()
+#include "pycore_pystate.h"       // _PyInterpreterState_GET()
+#include "pycore_ucnhash.h"       // _PyUnicode_Name_CAPI
+#include "stringlib/eq.h"         // unicode_eq()
 
 #ifdef MS_WINDOWS
 #include <windows.h>
 #endif
 
-/* Uncomment to display statistics on interned strings at exit when
-   using Valgrind or Insecure++. */
+#ifdef HAVE_NON_UNICODE_WCHAR_T_REPRESENTATION
+#include "pycore_fileutils.h"     // _Py_LocaleUsesNonUnicodeWchar()
+#endif
+
+/* Uncomment to display statistics on interned strings at exit
+   in _PyUnicode_ClearInterned(). */
 /* #define INTERNED_STATS 1 */
 
 
@@ -93,7 +98,8 @@
 extern "C" {
 #endif
 
-/* Maximum code point of Unicode 6.0: 0x10ffff (1,114,111) */
+// Maximum code point of Unicode 6.0: 0x10ffff (1,114,111).
+// The value must be the same in fileutils.c.
 #define MAX_UNICODE 0x10ffff
 
 #ifdef Py_DEBUG
@@ -205,7 +211,10 @@
 #  define OVERALLOCATE_FACTOR 4
 #endif
 
-#define INTERNED_STRINGS
+/* bpo-40521: Interned strings are shared by all interpreters. */
+#ifndef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+#  define INTERNED_STRINGS
+#endif
 
 /* This dictionary holds all interned unicode strings.  Note that references
    to strings in this dictionary are *not* counted in the string's ob_refcnt.
@@ -219,26 +228,36 @@
 static PyObject *interned = NULL;
 #endif
 
-/* The empty Unicode object is shared to improve performance. */
-static PyObject *unicode_empty = NULL;
+static struct _Py_unicode_state*
+get_unicode_state(void)
+{
+    PyInterpreterState *interp = _PyInterpreterState_GET();
+    return &interp->unicode;
+}
 
-#define _Py_INCREF_UNICODE_EMPTY()                      \
-    do {                                                \
-        if (unicode_empty != NULL)                      \
-            Py_INCREF(unicode_empty);                   \
-        else {                                          \
-            unicode_empty = PyUnicode_New(0, 0);        \
-            if (unicode_empty != NULL) {                \
-                Py_INCREF(unicode_empty);               \
-                assert(_PyUnicode_CheckConsistency(unicode_empty, 1)); \
-            }                                           \
-        }                                               \
-    } while (0)
 
-#define _Py_RETURN_UNICODE_EMPTY()                      \
-    do {                                                \
-        _Py_INCREF_UNICODE_EMPTY();                     \
-        return unicode_empty;                           \
+// Return a borrowed reference to the empty string singleton.
+static inline PyObject* unicode_get_empty(void)
+{
+    struct _Py_unicode_state *state = get_unicode_state();
+    // unicode_get_empty() must not be called before _PyUnicode_Init()
+    // or after _PyUnicode_Fini()
+    assert(state->empty_string != NULL);
+    return state->empty_string;
+}
+
+
+// Return a strong reference to the empty string singleton.
+static inline PyObject* unicode_new_empty(void)
+{
+    PyObject *empty = unicode_get_empty();
+    Py_INCREF(empty);
+    return empty;
+}
+
+#define _Py_RETURN_UNICODE_EMPTY()   \
+    do {                             \
+        return unicode_new_empty();  \
     } while (0)
 
 static inline void
@@ -289,17 +308,6 @@
                     _Py_error_handler error_handler, const char *errors,
                     Py_ssize_t *consumed);
 
-/* List of static strings. */
-static _Py_Identifier *static_strings = NULL;
-
-#define LATIN1_SINGLETONS
-
-#ifdef LATIN1_SINGLETONS
-/* Single character Unicode strings in the Latin-1 range are being
-   shared as well. */
-static PyObject *unicode_latin1[256] = {NULL};
-#endif
-
 /* Fast detection of the most frequent whitespace characters */
 const unsigned char _Py_ascii_whitespace[] = {
     0, 0, 0, 0, 0, 0, 0, 0,
@@ -493,20 +501,6 @@
 }
 
 
-/* The max unicode value is always 0x10FFFF while using the PEP-393 API.
-   This function is kept for backward compatibility with the old API. */
-Py_UNICODE
-PyUnicode_GetMax(void)
-{
-#ifdef Py_UNICODE_WIDE
-    return 0x10FFFF;
-#else
-    /* This is actually an illegal character, so it should
-       not be passed to unichr. */
-    return 0xFFFF;
-#endif
-}
-
 int
 _PyUnicode_CheckConsistency(PyObject *op, int check_content)
 {
@@ -643,9 +637,8 @@
     if (len == 1) {
         wchar_t ch = _PyUnicode_WSTR(unicode)[0];
         if ((Py_UCS4)ch < 256) {
-            PyObject *latin1_char = get_latin1_char((unsigned char)ch);
             Py_DECREF(unicode);
-            return latin1_char;
+            return get_latin1_char((unsigned char)ch);
         }
     }
 
@@ -670,20 +663,21 @@
 
     length = PyUnicode_GET_LENGTH(unicode);
     if (length == 0) {
-        if (unicode != unicode_empty) {
+        PyObject *empty = unicode_get_empty();
+        if (unicode != empty) {
             Py_DECREF(unicode);
-            _Py_RETURN_UNICODE_EMPTY();
+            Py_INCREF(empty);
         }
-        return unicode_empty;
+        return empty;
     }
 
-#ifdef LATIN1_SINGLETONS
     if (length == 1) {
-        const void *data = PyUnicode_DATA(unicode);
         int kind = PyUnicode_KIND(unicode);
-        Py_UCS4 ch = PyUnicode_READ(kind, data, 0);
-        if (ch < 256) {
-            PyObject *latin1_char = unicode_latin1[ch];
+        if (kind == PyUnicode_1BYTE_KIND) {
+            const Py_UCS1 *data = PyUnicode_1BYTE_DATA(unicode);
+            Py_UCS1 ch = data[0];
+            struct _Py_unicode_state *state = get_unicode_state();
+            PyObject *latin1_char = state->latin1[ch];
             if (latin1_char != NULL) {
                 if (unicode != latin1_char) {
                     Py_INCREF(latin1_char);
@@ -694,12 +688,14 @@
             else {
                 assert(_PyUnicode_CheckConsistency(unicode, 1));
                 Py_INCREF(unicode);
-                unicode_latin1[ch] = unicode;
+                state->latin1[ch] = unicode;
                 return unicode;
             }
         }
+        else {
+            assert(PyUnicode_READ_CHAR(unicode, 0) >= 256);
+        }
     }
-#endif
 
     assert(_PyUnicode_CheckConsistency(unicode, 1));
     return unicode;
@@ -862,7 +858,7 @@
    to keep things simple, we use a single bitmask, using the least 5
    bits from each unicode characters as the bit index. */
 
-/* the linebreak mask is set up by Unicode_Init below */
+/* the linebreak mask is set up by _PyUnicode_Init() below */
 
 #if LONG_BIT >= 128
 #define BLOOM_WIDTH 128
@@ -936,6 +932,8 @@
 
 /* Compilation of templated routines */
 
+#define STRINGLIB_GET_EMPTY() unicode_get_empty()
+
 #include "stringlib/asciilib.h"
 #include "stringlib/fastsearch.h"
 #include "stringlib/partition.h"
@@ -984,6 +982,8 @@
 #include "stringlib/undef.h"
 _Py_COMP_DIAG_POP
 
+#undef STRINGLIB_GET_EMPTY
+
 /* --- Unicode Object ----------------------------------------------------- */
 
 static inline Py_ssize_t
@@ -1065,7 +1065,7 @@
     new_size = (struct_size + (length + 1) * char_size);
 
     if (_PyUnicode_HAS_UTF8_MEMORY(unicode)) {
-        PyObject_DEL(_PyUnicode_UTF8(unicode));
+        PyObject_Free(_PyUnicode_UTF8(unicode));
         _PyUnicode_UTF8(unicode) = NULL;
         _PyUnicode_UTF8_LENGTH(unicode) = 0;
     }
@@ -1076,7 +1076,7 @@
     _Py_ForgetReference(unicode);
 #endif
 
-    new_unicode = (PyObject *)PyObject_REALLOC(unicode, new_size);
+    new_unicode = (PyObject *)PyObject_Realloc(unicode, new_size);
     if (new_unicode == NULL) {
         _Py_NewReference(unicode);
         PyErr_NoMemory();
@@ -1092,7 +1092,7 @@
             _PyUnicode_WSTR_LENGTH(unicode) = length;
     }
     else if (_PyUnicode_HAS_WSTR_MEMORY(unicode)) {
-        PyObject_DEL(_PyUnicode_WSTR(unicode));
+        PyObject_Free(_PyUnicode_WSTR(unicode));
         _PyUnicode_WSTR(unicode) = NULL;
         if (!PyUnicode_IS_ASCII(unicode))
             _PyUnicode_WSTR_LENGTH(unicode) = 0;
@@ -1135,12 +1135,12 @@
 
         if (!share_utf8 && _PyUnicode_HAS_UTF8_MEMORY(unicode))
         {
-            PyObject_DEL(_PyUnicode_UTF8(unicode));
+            PyObject_Free(_PyUnicode_UTF8(unicode));
             _PyUnicode_UTF8(unicode) = NULL;
             _PyUnicode_UTF8_LENGTH(unicode) = 0;
         }
 
-        data = (PyObject *)PyObject_REALLOC(data, new_size);
+        data = (PyObject *)PyObject_Realloc(data, new_size);
         if (data == NULL) {
             PyErr_NoMemory();
             return -1;
@@ -1173,7 +1173,7 @@
     }
     new_size = sizeof(wchar_t) * (length + 1);
     wstr =  _PyUnicode_WSTR(unicode);
-    wstr = PyObject_REALLOC(wstr, new_size);
+    wstr = PyObject_Realloc(wstr, new_size);
     if (!wstr) {
         PyErr_NoMemory();
         return -1;
@@ -1232,9 +1232,8 @@
     size_t new_size;
 
     /* Optimization for empty strings */
-    if (length == 0 && unicode_empty != NULL) {
-        Py_INCREF(unicode_empty);
-        return (PyUnicodeObject*)unicode_empty;
+    if (length == 0) {
+        return (PyUnicodeObject *)unicode_new_empty();
     }
 
     /* Ensure we won't overflow the size. */
@@ -1264,7 +1263,7 @@
     _PyUnicode_UTF8(unicode) = NULL;
     _PyUnicode_UTF8_LENGTH(unicode) = 0;
 
-    _PyUnicode_WSTR(unicode) = (Py_UNICODE*) PyObject_MALLOC(new_size);
+    _PyUnicode_WSTR(unicode) = (Py_UNICODE*) PyObject_Malloc(new_size);
     if (!_PyUnicode_WSTR(unicode)) {
         Py_DECREF(unicode);
         PyErr_NoMemory();
@@ -1364,27 +1363,51 @@
     }
     else
         data = unicode->data.any;
-    printf("%s: len=%" PY_FORMAT_SIZE_T "u, ",
-           unicode_kind_name(op), ascii->length);
+    printf("%s: len=%zu, ", unicode_kind_name(op), ascii->length);
 
     if (ascii->wstr == data)
         printf("shared ");
     printf("wstr=%p", (void *)ascii->wstr);
 
     if (!(ascii->state.ascii == 1 && ascii->state.compact == 1)) {
-        printf(" (%" PY_FORMAT_SIZE_T "u), ", compact->wstr_length);
-        if (!ascii->state.compact && compact->utf8 == unicode->data.any)
+        printf(" (%zu), ", compact->wstr_length);
+        if (!ascii->state.compact && compact->utf8 == unicode->data.any) {
             printf("shared ");
-        printf("utf8=%p (%" PY_FORMAT_SIZE_T "u)",
-               (void *)compact->utf8, compact->utf8_length);
+        }
+        printf("utf8=%p (%zu)", (void *)compact->utf8, compact->utf8_length);
     }
     printf(", data=%p\n", data);
 }
 #endif
 
+static int
+unicode_create_empty_string_singleton(struct _Py_unicode_state *state)
+{
+    // Use size=1 rather than size=0, so PyUnicode_New(0, maxchar) can be
+    // optimized to always use state->empty_string without having to check if
+    // it is NULL or not.
+    PyObject *empty = PyUnicode_New(1, 0);
+    if (empty == NULL) {
+        return -1;
+    }
+    PyUnicode_1BYTE_DATA(empty)[0] = 0;
+    _PyUnicode_LENGTH(empty) = 0;
+    assert(_PyUnicode_CheckConsistency(empty, 1));
+
+    assert(state->empty_string == NULL);
+    state->empty_string = empty;
+    return 0;
+}
+
+
 PyObject *
 PyUnicode_New(Py_ssize_t size, Py_UCS4 maxchar)
 {
+    /* Optimization for empty strings */
+    if (size == 0) {
+        return unicode_new_empty();
+    }
+
     PyObject *obj;
     PyCompactUnicodeObject *unicode;
     void *data;
@@ -1393,12 +1416,6 @@
     Py_ssize_t char_size;
     Py_ssize_t struct_size;
 
-    /* Optimization for empty strings */
-    if (size == 0 && unicode_empty != NULL) {
-        Py_INCREF(unicode_empty);
-        return unicode_empty;
-    }
-
     is_ascii = 0;
     is_sharing = 0;
     struct_size = sizeof(PyCompactUnicodeObject);
@@ -1443,12 +1460,11 @@
      * PyObject_New() so we are able to allocate space for the object and
      * it's data buffer.
      */
-    obj = (PyObject *) PyObject_MALLOC(struct_size + (size + 1) * char_size);
-    if (obj == NULL)
+    obj = (PyObject *) PyObject_Malloc(struct_size + (size + 1) * char_size);
+    if (obj == NULL) {
         return PyErr_NoMemory();
-    obj = PyObject_INIT(obj, &PyUnicode_Type);
-    if (obj == NULL)
-        return NULL;
+    }
+    _PyObject_Init(obj, &PyUnicode_Type);
 
     unicode = (PyCompactUnicodeObject *)obj;
     if (is_ascii)
@@ -1789,8 +1805,8 @@
             *maxchar = ch;
             if (*maxchar > MAX_UNICODE) {
                 PyErr_Format(PyExc_ValueError,
-                             "character U+%x is not in range [U+0000; U+10ffff]",
-                             ch);
+                             "character U+%x is not in range [U+0000; U+%x]",
+                             ch, MAX_UNICODE);
                 return -1;
             }
         }
@@ -1826,7 +1842,7 @@
         return -1;
 
     if (maxchar < 256) {
-        _PyUnicode_DATA_ANY(unicode) = PyObject_MALLOC(_PyUnicode_WSTR_LENGTH(unicode) + 1);
+        _PyUnicode_DATA_ANY(unicode) = PyObject_Malloc(_PyUnicode_WSTR_LENGTH(unicode) + 1);
         if (!_PyUnicode_DATA_ANY(unicode)) {
             PyErr_NoMemory();
             return -1;
@@ -1847,7 +1863,7 @@
             _PyUnicode_UTF8(unicode) = NULL;
             _PyUnicode_UTF8_LENGTH(unicode) = 0;
         }
-        PyObject_FREE(_PyUnicode_WSTR(unicode));
+        PyObject_Free(_PyUnicode_WSTR(unicode));
         _PyUnicode_WSTR(unicode) = NULL;
         _PyUnicode_WSTR_LENGTH(unicode) = 0;
     }
@@ -1867,7 +1883,7 @@
         _PyUnicode_UTF8_LENGTH(unicode) = 0;
 #else
         /* sizeof(wchar_t) == 4 */
-        _PyUnicode_DATA_ANY(unicode) = PyObject_MALLOC(
+        _PyUnicode_DATA_ANY(unicode) = PyObject_Malloc(
             2 * (_PyUnicode_WSTR_LENGTH(unicode) + 1));
         if (!_PyUnicode_DATA_ANY(unicode)) {
             PyErr_NoMemory();
@@ -1881,7 +1897,7 @@
         _PyUnicode_STATE(unicode).kind = PyUnicode_2BYTE_KIND;
         _PyUnicode_UTF8(unicode) = NULL;
         _PyUnicode_UTF8_LENGTH(unicode) = 0;
-        PyObject_FREE(_PyUnicode_WSTR(unicode));
+        PyObject_Free(_PyUnicode_WSTR(unicode));
         _PyUnicode_WSTR(unicode) = NULL;
         _PyUnicode_WSTR_LENGTH(unicode) = 0;
 #endif
@@ -1896,7 +1912,7 @@
             PyErr_NoMemory();
             return -1;
         }
-        _PyUnicode_DATA_ANY(unicode) = PyObject_MALLOC(4 * (length_wo_surrogates + 1));
+        _PyUnicode_DATA_ANY(unicode) = PyObject_Malloc(4 * (length_wo_surrogates + 1));
         if (!_PyUnicode_DATA_ANY(unicode)) {
             PyErr_NoMemory();
             return -1;
@@ -1908,7 +1924,7 @@
         /* unicode_convert_wchar_to_ucs4() requires a ready string */
         _PyUnicode_STATE(unicode).ready = 1;
         unicode_convert_wchar_to_ucs4(_PyUnicode_WSTR(unicode), end, unicode);
-        PyObject_FREE(_PyUnicode_WSTR(unicode));
+        PyObject_Free(_PyUnicode_WSTR(unicode));
         _PyUnicode_WSTR(unicode) = NULL;
         _PyUnicode_WSTR_LENGTH(unicode) = 0;
 #else
@@ -1935,15 +1951,24 @@
         break;
 
     case SSTATE_INTERNED_MORTAL:
-        /* revive dead object temporarily for DelItem */
-        Py_SET_REFCNT(unicode, 3);
+    {
 #ifdef INTERNED_STRINGS
+        /* Revive the dead object temporarily. PyDict_DelItem() removes two
+           references (key and value) which were ignored by
+           PyUnicode_InternInPlace(). Use refcnt=3 rather than refcnt=2
+           to prevent calling unicode_dealloc() again. Adjust refcnt after
+           PyDict_DelItem(). */
+        assert(Py_REFCNT(unicode) == 0);
+        Py_SET_REFCNT(unicode, 3);
         if (PyDict_DelItem(interned, unicode) != 0) {
             _PyErr_WriteUnraisableMsg("deletion of interned string failed",
                                       NULL);
         }
+        assert(Py_REFCNT(unicode) == 1);
+        Py_SET_REFCNT(unicode, 0);
 #endif
         break;
+    }
 
     case SSTATE_INTERNED_IMMORTAL:
         _PyObject_ASSERT_FAILED_MSG(unicode, "Immortal interned string died");
@@ -1954,13 +1979,13 @@
     }
 
     if (_PyUnicode_HAS_WSTR_MEMORY(unicode)) {
-        PyObject_DEL(_PyUnicode_WSTR(unicode));
+        PyObject_Free(_PyUnicode_WSTR(unicode));
     }
     if (_PyUnicode_HAS_UTF8_MEMORY(unicode)) {
-        PyObject_DEL(_PyUnicode_UTF8(unicode));
+        PyObject_Free(_PyUnicode_UTF8(unicode));
     }
     if (!PyUnicode_IS_COMPACT(unicode) && _PyUnicode_DATA_ANY(unicode)) {
-        PyObject_DEL(_PyUnicode_DATA_ANY(unicode));
+        PyObject_Free(_PyUnicode_DATA_ANY(unicode));
     }
 
     Py_TYPE(unicode)->tp_free(unicode);
@@ -1970,18 +1995,18 @@
 static int
 unicode_is_singleton(PyObject *unicode)
 {
-    if (unicode == unicode_empty) {
+    struct _Py_unicode_state *state = get_unicode_state();
+    if (unicode == state->empty_string) {
         return 1;
     }
-#ifdef LATIN1_SINGLETONS
     PyASCIIObject *ascii = (PyASCIIObject *)unicode;
     if (ascii->state.kind != PyUnicode_WCHAR_KIND && ascii->length == 1)
     {
         Py_UCS4 ch = PyUnicode_READ_CHAR(unicode, 0);
-        if (ch < 256 && unicode_latin1[ch] == unicode)
+        if (ch < 256 && state->latin1[ch] == unicode) {
             return 1;
+        }
     }
-#endif
     return 0;
 }
 #endif
@@ -2026,10 +2051,8 @@
         return 0;
 
     if (length == 0) {
-        _Py_INCREF_UNICODE_EMPTY();
-        if (!unicode_empty)
-            return -1;
-        Py_SETREF(*p_unicode, unicode_empty);
+        PyObject *empty = unicode_new_empty();
+        Py_SETREF(*p_unicode, empty);
         return 0;
     }
 
@@ -2121,17 +2144,15 @@
 }
 
 static PyObject*
-get_latin1_char(unsigned char ch)
+get_latin1_char(Py_UCS1 ch)
 {
-    PyObject *unicode;
+    struct _Py_unicode_state *state = get_unicode_state();
 
-#ifdef LATIN1_SINGLETONS
-    unicode = unicode_latin1[ch];
+    PyObject *unicode = state->latin1[ch];
     if (unicode) {
         Py_INCREF(unicode);
         return unicode;
     }
-#endif
 
     unicode = PyUnicode_New(1, ch);
     if (!unicode) {
@@ -2141,10 +2162,8 @@
     PyUnicode_1BYTE_DATA(unicode)[0] = ch;
     assert(_PyUnicode_CheckConsistency(unicode, 1));
 
-#ifdef LATIN1_SINGLETONS
     Py_INCREF(unicode);
-    unicode_latin1[ch] = unicode;
-#endif
+    state->latin1[ch] = unicode;
     return unicode;
 }
 
@@ -2155,8 +2174,9 @@
 
     assert(ch <= MAX_UNICODE);
 
-    if (ch < 256)
+    if (ch < 256) {
         return get_latin1_char(ch);
+    }
 
     unicode = PyUnicode_New(1, ch);
     if (unicode == NULL)
@@ -2176,8 +2196,16 @@
 PyObject *
 PyUnicode_FromUnicode(const Py_UNICODE *u, Py_ssize_t size)
 {
-    if (u == NULL)
+    if (u == NULL) {
+        if (size > 0) {
+            if (PyErr_WarnEx(PyExc_DeprecationWarning,
+                    "PyUnicode_FromUnicode(NULL, size) is deprecated; "
+                    "use PyUnicode_New() instead", 1) < 0) {
+                return NULL;
+            }
+        }
         return (PyObject*)_PyUnicode_New(size);
+    }
 
     if (size < 0) {
         PyErr_BadInternalCall();
@@ -2210,6 +2238,20 @@
     if (size == 0)
         _Py_RETURN_UNICODE_EMPTY();
 
+#ifdef HAVE_NON_UNICODE_WCHAR_T_REPRESENTATION
+    /* Oracle Solaris uses non-Unicode internal wchar_t form for
+       non-Unicode locales and hence needs conversion to UCS-4 first. */
+    if (_Py_LocaleUsesNonUnicodeWchar()) {
+        wchar_t* converted = _Py_DecodeNonUnicodeWchar(u, size);
+        if (!converted) {
+            return NULL;
+        }
+        PyObject *unicode = _PyUnicode_FromUCS4(converted, size);
+        PyMem_Free(converted);
+        return unicode;
+    }
+#endif
+
     /* Single character Unicode objects in the Latin-1 range are
        shared when using this constructor */
     if (size == 1 && (Py_UCS4)*u < 256)
@@ -2263,10 +2305,19 @@
                         "Negative size passed to PyUnicode_FromStringAndSize");
         return NULL;
     }
-    if (u != NULL)
+    if (u != NULL) {
         return PyUnicode_DecodeUTF8Stateful(u, size, NULL, NULL);
-    else
+    }
+    else {
+        if (size > 0) {
+            if (PyErr_WarnEx(PyExc_DeprecationWarning,
+                    "PyUnicode_FromStringAndSize(NULL, size) is deprecated; "
+                    "use PyUnicode_New() instead", 1) < 0) {
+                return NULL;
+            }
+        }
         return (PyObject *)_PyUnicode_New(size);
+    }
 }
 
 PyObject *
@@ -2280,36 +2331,84 @@
     return PyUnicode_DecodeUTF8Stateful(u, (Py_ssize_t)size, NULL, NULL);
 }
 
+
 PyObject *
 _PyUnicode_FromId(_Py_Identifier *id)
 {
-    if (!id->object) {
-        id->object = PyUnicode_DecodeUTF8Stateful(id->string,
-                                                  strlen(id->string),
-                                                  NULL, NULL);
-        if (!id->object)
-            return NULL;
-        PyUnicode_InternInPlace(&id->object);
-        assert(!id->next);
-        id->next = static_strings;
-        static_strings = id;
+    PyInterpreterState *interp = _PyInterpreterState_GET();
+    struct _Py_unicode_ids *ids = &interp->unicode.ids;
+
+    Py_ssize_t index = _Py_atomic_size_get(&id->index);
+    if (index < 0) {
+        struct _Py_unicode_runtime_ids *rt_ids = &interp->runtime->unicode_ids;
+
+        PyThread_acquire_lock(rt_ids->lock, WAIT_LOCK);
+        // Check again to detect concurrent access. Another thread can have
+        // initialized the index while this thread waited for the lock.
+        index = _Py_atomic_size_get(&id->index);
+        if (index < 0) {
+            assert(rt_ids->next_index < PY_SSIZE_T_MAX);
+            index = rt_ids->next_index;
+            rt_ids->next_index++;
+            _Py_atomic_size_set(&id->index, index);
+        }
+        PyThread_release_lock(rt_ids->lock);
     }
-    return id->object;
+    assert(index >= 0);
+
+    PyObject *obj;
+    if (index < ids->size) {
+        obj = ids->array[index];
+        if (obj) {
+            // Return a borrowed reference
+            return obj;
+        }
+    }
+
+    obj = PyUnicode_DecodeUTF8Stateful(id->string, strlen(id->string),
+                                       NULL, NULL);
+    if (!obj) {
+        return NULL;
+    }
+    PyUnicode_InternInPlace(&obj);
+
+    if (index >= ids->size) {
+        // Overallocate to reduce the number of realloc
+        Py_ssize_t new_size = Py_MAX(index * 2, 16);
+        Py_ssize_t item_size = sizeof(ids->array[0]);
+        PyObject **new_array = PyMem_Realloc(ids->array, new_size * item_size);
+        if (new_array == NULL) {
+            PyErr_NoMemory();
+            return NULL;
+        }
+        memset(&new_array[ids->size], 0, (new_size - ids->size) * item_size);
+        ids->array = new_array;
+        ids->size = new_size;
+    }
+
+    // The array stores a strong reference
+    ids->array[index] = obj;
+
+    // Return a borrowed reference
+    return obj;
 }
 
+
 static void
-unicode_clear_static_strings(void)
+unicode_clear_identifiers(struct _Py_unicode_state *state)
 {
-    _Py_Identifier *tmp, *s = static_strings;
-    while (s) {
-        Py_CLEAR(s->object);
-        tmp = s->next;
-        s->next = NULL;
-        s = tmp;
+    struct _Py_unicode_ids *ids = &state->ids;
+    for (Py_ssize_t i=0; i < ids->size; i++) {
+        Py_XDECREF(ids->array[i]);
     }
-    static_strings = NULL;
+    ids->size = 0;
+    PyMem_Free(ids->array);
+    ids->array = NULL;
+    // Don't reset _PyRuntime next_index: _Py_Identifier.id remains valid
+    // after Py_Finalize().
 }
 
+
 /* Internal function, doesn't check maximum character */
 
 PyObject*
@@ -2352,11 +2451,13 @@
     PyObject *res;
     unsigned char max_char;
 
-    if (size == 0)
+    if (size == 0) {
         _Py_RETURN_UNICODE_EMPTY();
+    }
     assert(size > 0);
-    if (size == 1)
+    if (size == 1) {
         return get_latin1_char(u[0]);
+    }
 
     max_char = ucs1lib_find_max_char(u, u + size);
     res = PyUnicode_New(size, max_char);
@@ -2847,35 +2948,35 @@
         Py_ssize_t arglen;
 
         if (*f == 'u') {
-            if (longflag)
-                len = sprintf(buffer, "%lu",
-                        va_arg(*vargs, unsigned long));
-            else if (longlongflag)
-                len = sprintf(buffer, "%llu",
-                        va_arg(*vargs, unsigned long long));
-            else if (size_tflag)
-                len = sprintf(buffer, "%" PY_FORMAT_SIZE_T "u",
-                        va_arg(*vargs, size_t));
-            else
-                len = sprintf(buffer, "%u",
-                        va_arg(*vargs, unsigned int));
+            if (longflag) {
+                len = sprintf(buffer, "%lu", va_arg(*vargs, unsigned long));
+            }
+            else if (longlongflag) {
+                len = sprintf(buffer, "%llu", va_arg(*vargs, unsigned long long));
+            }
+            else if (size_tflag) {
+                len = sprintf(buffer, "%zu", va_arg(*vargs, size_t));
+            }
+            else {
+                len = sprintf(buffer, "%u", va_arg(*vargs, unsigned int));
+            }
         }
         else if (*f == 'x') {
             len = sprintf(buffer, "%x", va_arg(*vargs, int));
         }
         else {
-            if (longflag)
-                len = sprintf(buffer, "%li",
-                        va_arg(*vargs, long));
-            else if (longlongflag)
-                len = sprintf(buffer, "%lli",
-                        va_arg(*vargs, long long));
-            else if (size_tflag)
-                len = sprintf(buffer, "%" PY_FORMAT_SIZE_T "i",
-                        va_arg(*vargs, Py_ssize_t));
-            else
-                len = sprintf(buffer, "%i",
-                        va_arg(*vargs, int));
+            if (longflag) {
+                len = sprintf(buffer, "%li", va_arg(*vargs, long));
+            }
+            else if (longlongflag) {
+                len = sprintf(buffer, "%lli", va_arg(*vargs, long long));
+            }
+            else if (size_tflag) {
+                len = sprintf(buffer, "%zi", va_arg(*vargs, Py_ssize_t));
+            }
+            else {
+                len = sprintf(buffer, "%i", va_arg(*vargs, int));
+            }
         }
         assert(len >= 0);
 
@@ -3115,9 +3216,11 @@
     assert(unicode != NULL);
     assert(_PyUnicode_CHECK(unicode));
 
+#if USE_UNICODE_WCHAR_CACHE
     if (_PyUnicode_WSTR(unicode) != NULL) {
         return PyUnicode_WSTR_LENGTH(unicode);
     }
+#endif /* USE_UNICODE_WCHAR_CACHE */
     assert(PyUnicode_IS_READY(unicode));
 
     res = _PyUnicode_LENGTH(unicode);
@@ -3138,16 +3241,21 @@
 static void
 unicode_copy_as_widechar(PyObject *unicode, wchar_t *w, Py_ssize_t size)
 {
-    const wchar_t *wstr;
-
     assert(unicode != NULL);
     assert(_PyUnicode_CHECK(unicode));
 
-    wstr = _PyUnicode_WSTR(unicode);
+#if USE_UNICODE_WCHAR_CACHE
+    const wchar_t *wstr = _PyUnicode_WSTR(unicode);
     if (wstr != NULL) {
         memcpy(w, wstr, size * sizeof(wchar_t));
         return;
     }
+#else /* USE_UNICODE_WCHAR_CACHE */
+    if (PyUnicode_KIND(unicode) == sizeof(wchar_t)) {
+        memcpy(w, PyUnicode_DATA(unicode), size * sizeof(wchar_t));
+        return;
+    }
+#endif /* USE_UNICODE_WCHAR_CACHE */
     assert(PyUnicode_IS_READY(unicode));
 
     if (PyUnicode_KIND(unicode) == PyUnicode_1BYTE_KIND) {
@@ -3222,6 +3330,17 @@
         res = size;
     }
     unicode_copy_as_widechar(unicode, w, size);
+
+#if HAVE_NON_UNICODE_WCHAR_T_REPRESENTATION
+    /* Oracle Solaris uses non-Unicode internal wchar_t form for
+       non-Unicode locales and hence needs conversion first. */
+    if (_Py_LocaleUsesNonUnicodeWchar()) {
+        if (_Py_EncodeNonUnicodeWchar_InPlace(w, size) < 0) {
+            return -1;
+        }
+    }
+#endif
+
     return res;
 }
 
@@ -3248,11 +3367,22 @@
         return NULL;
     }
     unicode_copy_as_widechar(unicode, buffer, buflen + 1);
+
+#if HAVE_NON_UNICODE_WCHAR_T_REPRESENTATION
+    /* Oracle Solaris uses non-Unicode internal wchar_t form for
+       non-Unicode locales and hence needs conversion first. */
+    if (_Py_LocaleUsesNonUnicodeWchar()) {
+        if (_Py_EncodeNonUnicodeWchar_InPlace(buffer, (buflen + 1)) < 0) {
+            return NULL;
+        }
+    }
+#endif
+
     if (size != NULL) {
         *size = buflen;
     }
     else if (wcslen(buffer) != (size_t)buflen) {
-        PyMem_FREE(buffer);
+        PyMem_Free(buffer);
         PyErr_SetString(PyExc_ValueError,
                         "embedded null character");
         return NULL;
@@ -3262,6 +3392,74 @@
 
 #endif /* HAVE_WCHAR_H */
 
+int
+_PyUnicode_WideCharString_Converter(PyObject *obj, void *ptr)
+{
+    wchar_t **p = (wchar_t **)ptr;
+    if (obj == NULL) {
+#if !USE_UNICODE_WCHAR_CACHE
+        PyMem_Free(*p);
+#endif /* USE_UNICODE_WCHAR_CACHE */
+        *p = NULL;
+        return 1;
+    }
+    if (PyUnicode_Check(obj)) {
+#if USE_UNICODE_WCHAR_CACHE
+        *p = (wchar_t *)_PyUnicode_AsUnicode(obj);
+        if (*p == NULL) {
+            return 0;
+        }
+        return 1;
+#else /* USE_UNICODE_WCHAR_CACHE */
+        *p = PyUnicode_AsWideCharString(obj, NULL);
+        if (*p == NULL) {
+            return 0;
+        }
+        return Py_CLEANUP_SUPPORTED;
+#endif /* USE_UNICODE_WCHAR_CACHE */
+    }
+    PyErr_Format(PyExc_TypeError,
+                 "argument must be str, not %.50s",
+                 Py_TYPE(obj)->tp_name);
+    return 0;
+}
+
+int
+_PyUnicode_WideCharString_Opt_Converter(PyObject *obj, void *ptr)
+{
+    wchar_t **p = (wchar_t **)ptr;
+    if (obj == NULL) {
+#if !USE_UNICODE_WCHAR_CACHE
+        PyMem_Free(*p);
+#endif /* USE_UNICODE_WCHAR_CACHE */
+        *p = NULL;
+        return 1;
+    }
+    if (obj == Py_None) {
+        *p = NULL;
+        return 1;
+    }
+    if (PyUnicode_Check(obj)) {
+#if USE_UNICODE_WCHAR_CACHE
+        *p = (wchar_t *)_PyUnicode_AsUnicode(obj);
+        if (*p == NULL) {
+            return 0;
+        }
+        return 1;
+#else /* USE_UNICODE_WCHAR_CACHE */
+        *p = PyUnicode_AsWideCharString(obj, NULL);
+        if (*p == NULL) {
+            return 0;
+        }
+        return Py_CLEANUP_SUPPORTED;
+#endif /* USE_UNICODE_WCHAR_CACHE */
+    }
+    PyErr_Format(PyExc_TypeError,
+                 "argument must be str or None, not %.50s",
+                 Py_TYPE(obj)->tp_name);
+    return 0;
+}
+
 PyObject *
 PyUnicode_FromOrdinal(int ordinal)
 {
@@ -4085,7 +4283,7 @@
             PyErr_NoMemory();
             return NULL;
         }
-        w = (wchar_t *) PyObject_MALLOC(sizeof(wchar_t) * (wlen + 1));
+        w = (wchar_t *) PyObject_Malloc(sizeof(wchar_t) * (wlen + 1));
         if (w == NULL) {
             PyErr_NoMemory();
             return NULL;
@@ -4275,7 +4473,6 @@
     Py_ssize_t requiredsize;
     Py_ssize_t newpos;
     PyObject *inputobj = NULL;
-    wchar_t *repwstr;
     Py_ssize_t repwlen;
 
     if (*errorHandler == NULL) {
@@ -4321,9 +4518,19 @@
         goto onError;
     }
 
-    repwstr = PyUnicode_AsUnicodeAndSize(repunicode, &repwlen);
-    if (repwstr == NULL)
+#if USE_UNICODE_WCHAR_CACHE
+_Py_COMP_DIAG_PUSH
+_Py_COMP_DIAG_IGNORE_DEPR_DECLS
+    repwlen = PyUnicode_GetSize(repunicode);
+    if (repwlen < 0)
         goto onError;
+_Py_COMP_DIAG_POP
+#else /* USE_UNICODE_WCHAR_CACHE */
+    repwlen = PyUnicode_AsWideChar(repunicode, NULL, 0);
+    if (repwlen < 0)
+        goto onError;
+    repwlen--;
+#endif /* USE_UNICODE_WCHAR_CACHE */
     /* need more space? (at least enough for what we
        have+the replacement+the rest of the string (starting
        at the new input position), so we won't have to check space
@@ -4343,7 +4550,7 @@
             goto onError;
         }
     }
-    wcsncpy(*buf + *outpos, repwstr, repwlen);
+    PyUnicode_AsWideChar(repunicode, *buf + *outpos, repwlen);
     *outpos += repwlen;
     *endinpos = newpos;
     *inptr = *input + newpos;
@@ -4906,45 +5113,36 @@
 #include "stringlib/codecs.h"
 #include "stringlib/undef.h"
 
-/* Mask to quickly check whether a C 'long' contains a
+/* Mask to quickly check whether a C 'size_t' contains a
    non-ASCII, UTF8-encoded char. */
-#if (SIZEOF_LONG == 8)
-# define ASCII_CHAR_MASK 0x8080808080808080UL
-#elif (SIZEOF_LONG == 4)
-# define ASCII_CHAR_MASK 0x80808080UL
+#if (SIZEOF_SIZE_T == 8)
+# define ASCII_CHAR_MASK 0x8080808080808080ULL
+#elif (SIZEOF_SIZE_T == 4)
+# define ASCII_CHAR_MASK 0x80808080U
 #else
-# error C 'long' size should be either 4 or 8!
+# error C 'size_t' size should be either 4 or 8!
 #endif
 
 static Py_ssize_t
 ascii_decode(const char *start, const char *end, Py_UCS1 *dest)
 {
     const char *p = start;
-    const char *aligned_end = (const char *) _Py_ALIGN_DOWN(end, SIZEOF_LONG);
 
-    /*
-     * Issue #17237: m68k is a bit different from most architectures in
-     * that objects do not use "natural alignment" - for example, int and
-     * long are only aligned at 2-byte boundaries.  Therefore the assert()
-     * won't work; also, tests have shown that skipping the "optimised
-     * version" will even speed up m68k.
-     */
-#if !defined(__m68k__)
-#if SIZEOF_LONG <= SIZEOF_VOID_P
-    assert(_Py_IS_ALIGNED(dest, SIZEOF_LONG));
-    if (_Py_IS_ALIGNED(p, SIZEOF_LONG)) {
+#if SIZEOF_SIZE_T <= SIZEOF_VOID_P
+    assert(_Py_IS_ALIGNED(dest, ALIGNOF_SIZE_T));
+    if (_Py_IS_ALIGNED(p, ALIGNOF_SIZE_T)) {
         /* Fast path, see in STRINGLIB(utf8_decode) for
            an explanation. */
         /* Help allocation */
         const char *_p = p;
         Py_UCS1 * q = dest;
-        while (_p < aligned_end) {
-            unsigned long value = *(const unsigned long *) _p;
+        while (_p + SIZEOF_SIZE_T <= end) {
+            size_t value = *(const size_t *) _p;
             if (value & ASCII_CHAR_MASK)
                 break;
-            *((unsigned long *)q) = value;
-            _p += SIZEOF_LONG;
-            q += SIZEOF_LONG;
+            *((size_t *)q) = value;
+            _p += SIZEOF_SIZE_T;
+            q += SIZEOF_SIZE_T;
         }
         p = _p;
         while (p < end) {
@@ -4955,18 +5153,17 @@
         return p - start;
     }
 #endif
-#endif
     while (p < end) {
         /* Fast path, see in STRINGLIB(utf8_decode) in stringlib/codecs.h
            for an explanation. */
-        if (_Py_IS_ALIGNED(p, SIZEOF_LONG)) {
+        if (_Py_IS_ALIGNED(p, ALIGNOF_SIZE_T)) {
             /* Help allocation */
             const char *_p = p;
-            while (_p < aligned_end) {
-                unsigned long value = *(const unsigned long *) _p;
+            while (_p + SIZEOF_SIZE_T <= end) {
+                size_t value = *(const size_t *) _p;
                 if (value & ASCII_CHAR_MASK)
                     break;
-                _p += SIZEOF_LONG;
+                _p += SIZEOF_SIZE_T;
             }
             p = _p;
             if (_p == end)
@@ -4993,8 +5190,9 @@
 
     /* ASCII is equivalent to the first 128 ordinals in Unicode. */
     if (size == 1 && (unsigned char)s[0] < 128) {
-        if (consumed)
+        if (consumed) {
             *consumed = 1;
+        }
         return get_latin1_char((unsigned char)s[0]);
     }
 
@@ -5503,7 +5701,7 @@
                     PyBytes_AS_STRING(writer.buffer);
     Py_ssize_t len = end - start;
 
-    char *cache = PyObject_MALLOC(len + 1);
+    char *cache = PyObject_Malloc(len + 1);
     if (cache == NULL) {
         _PyBytesWriter_Dealloc(&writer);
         PyErr_NoMemory();
@@ -6224,12 +6422,13 @@
 
 /* --- Unicode Escape Codec ----------------------------------------------- */
 
-static _PyUnicode_Name_CAPI *ucnhash_CAPI = NULL;
+static _PyUnicode_Name_CAPI *ucnhash_capi = NULL;
 
 PyObject *
-_PyUnicode_DecodeUnicodeEscape(const char *s,
+_PyUnicode_DecodeUnicodeEscapeInternal(const char *s,
                                Py_ssize_t size,
                                const char *errors,
+                               Py_ssize_t *consumed,
                                const char **first_invalid_escape)
 {
     const char *starts = s;
@@ -6242,6 +6441,9 @@
     *first_invalid_escape = NULL;
 
     if (size == 0) {
+        if (consumed) {
+            *consumed = 0;
+        }
         _Py_RETURN_UNICODE_EMPTY();
     }
     /* Escaped strings will always be longer than the resulting
@@ -6260,8 +6462,6 @@
         unsigned char c = (unsigned char) *s++;
         Py_UCS4 ch;
         int count;
-        Py_ssize_t startinpos;
-        Py_ssize_t endinpos;
         const char *message;
 
 #define WRITE_ASCII_CHAR(ch)                                                  \
@@ -6288,11 +6488,11 @@
             continue;
         }
 
-        startinpos = s - starts - 1;
+        Py_ssize_t startinpos = s - starts - 1;
         /* \ - Escapes */
         if (s >= end) {
             message = "\\ at end of string";
-            goto error;
+            goto incomplete;
         }
         c = (unsigned char) *s++;
 
@@ -6346,7 +6546,10 @@
             count = 8;
             message = "truncated \\UXXXXXXXX escape";
         hexescape:
-            for (ch = 0; count && s < end; ++s, --count) {
+            for (ch = 0; count; ++s, --count) {
+                if (s >= end) {
+                    goto incomplete;
+                }
                 c = (unsigned char)*s;
                 ch <<= 4;
                 if (c >= '0' && c <= '9') {
@@ -6359,12 +6562,9 @@
                     ch += c - ('A' - 10);
                 }
                 else {
-                    break;
+                    goto error;
                 }
             }
-            if (count) {
-                goto error;
-            }
 
             /* when we get here, ch is a 32-bit unicode character */
             if (ch > MAX_UNICODE) {
@@ -6377,11 +6577,11 @@
 
             /* \N{name} */
         case 'N':
-            if (ucnhash_CAPI == NULL) {
+            if (ucnhash_capi == NULL) {
                 /* load the unicode data module */
-                ucnhash_CAPI = (_PyUnicode_Name_CAPI *)PyCapsule_Import(
+                ucnhash_capi = (_PyUnicode_Name_CAPI *)PyCapsule_Import(
                                                 PyUnicodeData_CAPSULE_NAME, 1);
-                if (ucnhash_CAPI == NULL) {
+                if (ucnhash_capi == NULL) {
                     PyErr_SetString(
                         PyExc_UnicodeError,
                         "\\N escapes not supported (can't load unicodedata module)"
@@ -6391,19 +6591,25 @@
             }
 
             message = "malformed \\N character escape";
-            if (s < end && *s == '{') {
+            if (s >= end) {
+                goto incomplete;
+            }
+            if (*s == '{') {
                 const char *start = ++s;
                 size_t namelen;
                 /* look for the closing brace */
                 while (s < end && *s != '}')
                     s++;
+                if (s >= end) {
+                    goto incomplete;
+                }
                 namelen = s - start;
-                if (namelen && s < end) {
+                if (namelen) {
                     /* found a name.  look it up in the unicode database */
                     s++;
                     ch = 0xffffffff; /* in case 'getcode' messes up */
                     if (namelen <= INT_MAX &&
-                        ucnhash_CAPI->getcode(NULL, start, (int)namelen,
+                        ucnhash_capi->getcode(start, (int)namelen,
                                               &ch, 0)) {
                         assert(ch <= MAX_UNICODE);
                         WRITE_CHAR(ch);
@@ -6424,8 +6630,13 @@
             continue;
         }
 
-      error:
-        endinpos = s-starts;
+      incomplete:
+        if (consumed) {
+            *consumed = startinpos;
+            break;
+        }
+      error:;
+        Py_ssize_t endinpos = s-starts;
         writer.min_length = end - s + writer.pos;
         if (unicode_decode_call_errorhandler_writer(
                 errors, &errorHandler,
@@ -6452,12 +6663,14 @@
 }
 
 PyObject *
-PyUnicode_DecodeUnicodeEscape(const char *s,
+_PyUnicode_DecodeUnicodeEscapeStateful(const char *s,
                               Py_ssize_t size,
-                              const char *errors)
+                              const char *errors,
+                              Py_ssize_t *consumed)
 {
     const char *first_invalid_escape;
-    PyObject *result = _PyUnicode_DecodeUnicodeEscape(s, size, errors,
+    PyObject *result = _PyUnicode_DecodeUnicodeEscapeInternal(s, size, errors,
+                                                      consumed,
                                                       &first_invalid_escape);
     if (result == NULL)
         return NULL;
@@ -6472,6 +6685,14 @@
     return result;
 }
 
+PyObject *
+PyUnicode_DecodeUnicodeEscape(const char *s,
+                              Py_ssize_t size,
+                              const char *errors)
+{
+    return _PyUnicode_DecodeUnicodeEscapeStateful(s, size, errors, NULL);
+}
+
 /* Return a Unicode-Escape string version of the Unicode object. */
 
 PyObject *
@@ -6610,9 +6831,10 @@
 /* --- Raw Unicode Escape Codec ------------------------------------------- */
 
 PyObject *
-PyUnicode_DecodeRawUnicodeEscape(const char *s,
-                                 Py_ssize_t size,
-                                 const char *errors)
+_PyUnicode_DecodeRawUnicodeEscapeStateful(const char *s,
+                                          Py_ssize_t size,
+                                          const char *errors,
+                                          Py_ssize_t *consumed)
 {
     const char *starts = s;
     _PyUnicodeWriter writer;
@@ -6621,6 +6843,9 @@
     PyObject *exc = NULL;
 
     if (size == 0) {
+        if (consumed) {
+            *consumed = 0;
+        }
         _Py_RETURN_UNICODE_EMPTY();
     }
 
@@ -6639,8 +6864,6 @@
         unsigned char c = (unsigned char) *s++;
         Py_UCS4 ch;
         int count;
-        Py_ssize_t startinpos;
-        Py_ssize_t endinpos;
         const char *message;
 
 #define WRITE_CHAR(ch)                                                        \
@@ -6655,11 +6878,21 @@
             } while(0)
 
         /* Non-escape characters are interpreted as Unicode ordinals */
-        if (c != '\\' || s >= end) {
+        if (c != '\\' || (s >= end && !consumed)) {
             WRITE_CHAR(c);
             continue;
         }
 
+        Py_ssize_t startinpos = s - starts - 1;
+        /* \ - Escapes */
+        if (s >= end) {
+            assert(consumed);
+            // Set message to silent compiler warning.
+            // Actually it is never used.
+            message = "\\ at end of string";
+            goto incomplete;
+        }
+
         c = (unsigned char) *s++;
         if (c == 'u') {
             count = 4;
@@ -6675,10 +6908,12 @@
             WRITE_CHAR(c);
             continue;
         }
-        startinpos = s - starts - 2;
 
         /* \uHHHH with 4 hex digits, \U00HHHHHH with 8 */
-        for (ch = 0; count && s < end; ++s, --count) {
+        for (ch = 0; count; ++s, --count) {
+            if (s >= end) {
+                goto incomplete;
+            }
             c = (unsigned char)*s;
             ch <<= 4;
             if (c >= '0' && c <= '9') {
@@ -6691,18 +6926,23 @@
                 ch += c - ('A' - 10);
             }
             else {
-                break;
+                goto error;
             }
         }
-        if (!count) {
-            if (ch <= MAX_UNICODE) {
-                WRITE_CHAR(ch);
-                continue;
-            }
+        if (ch > MAX_UNICODE) {
             message = "\\Uxxxxxxxx out of range";
+            goto error;
         }
+        WRITE_CHAR(ch);
+        continue;
 
-        endinpos = s-starts;
+      incomplete:
+        if (consumed) {
+            *consumed = startinpos;
+            break;
+        }
+      error:;
+        Py_ssize_t endinpos = s-starts;
         writer.min_length = end - s + writer.pos;
         if (unicode_decode_call_errorhandler_writer(
                 errors, &errorHandler,
@@ -6724,7 +6964,14 @@
     Py_XDECREF(errorHandler);
     Py_XDECREF(exc);
     return NULL;
+}
 
+PyObject *
+PyUnicode_DecodeRawUnicodeEscape(const char *s,
+                                 Py_ssize_t size,
+                                 const char *errors)
+{
+    return _PyUnicode_DecodeRawUnicodeEscapeStateful(s, size, errors, NULL);
 }
 
 
@@ -7161,8 +7408,9 @@
         _Py_RETURN_UNICODE_EMPTY();
 
     /* ASCII is equivalent to the first 128 ordinals in Unicode. */
-    if (size == 1 && (unsigned char)s[0] < 128)
+    if (size == 1 && (unsigned char)s[0] < 128) {
         return get_latin1_char((unsigned char)s[0]);
+    }
 
     // Shortcut for simple case
     PyObject *u = PyUnicode_New(size, 127);
@@ -7291,7 +7539,7 @@
 #endif
 
 /* INT_MAX is the theoretical largest chunk (or INT_MAX / 2 when
-   transcoding from UTF-16), but INT_MAX / 4 perfoms better in
+   transcoding from UTF-16), but INT_MAX / 4 performs better in
    both cases also and avoids partial characters overrunning the
    length limit in MultiByteToWideChar on Windows */
 #define DECODING_CHUNK_SIZE (INT_MAX/4)
@@ -7643,6 +7891,7 @@
     /* Create a substring so that we can get the UTF-16 representation
        of just the slice under consideration. */
     PyObject *substring;
+    int ret = -1;
 
     assert(len > 0);
 
@@ -7654,11 +7903,22 @@
     substring = PyUnicode_Substring(unicode, offset, offset+len);
     if (substring == NULL)
         return -1;
+#if USE_UNICODE_WCHAR_CACHE
+_Py_COMP_DIAG_PUSH
+_Py_COMP_DIAG_IGNORE_DEPR_DECLS
     p = PyUnicode_AsUnicodeAndSize(substring, &size);
     if (p == NULL) {
         Py_DECREF(substring);
         return -1;
     }
+_Py_COMP_DIAG_POP
+#else /* USE_UNICODE_WCHAR_CACHE */
+    p = PyUnicode_AsWideCharString(substring, &size);
+    Py_CLEAR(substring);
+    if (p == NULL) {
+        return -1;
+    }
+#endif /* USE_UNICODE_WCHAR_CACHE */
     assert(size <= INT_MAX);
 
     /* First get the size of the result */
@@ -7670,16 +7930,15 @@
         goto error;
     /* If we used a default char, then we failed! */
     if (pusedDefaultChar && *pusedDefaultChar) {
-        Py_DECREF(substring);
-        return -2;
+        ret = -2;
+        goto done;
     }
 
     if (*outbytes == NULL) {
         /* Create string object */
         *outbytes = PyBytes_FromStringAndSize(NULL, outsize);
         if (*outbytes == NULL) {
-            Py_DECREF(substring);
-            return -1;
+            goto done;
         }
         out = PyBytes_AS_STRING(*outbytes);
     }
@@ -7688,12 +7947,10 @@
         const Py_ssize_t n = PyBytes_Size(*outbytes);
         if (outsize > PY_SSIZE_T_MAX - n) {
             PyErr_NoMemory();
-            Py_DECREF(substring);
-            return -1;
+            goto done;
         }
         if (_PyBytes_Resize(outbytes, n + outsize) < 0) {
-            Py_DECREF(substring);
-            return -1;
+            goto done;
         }
         out = PyBytes_AS_STRING(*outbytes) + n;
     }
@@ -7703,19 +7960,29 @@
                                   p, (int)size,
                                   out, outsize,
                                   NULL, pusedDefaultChar);
-    Py_CLEAR(substring);
     if (outsize <= 0)
         goto error;
-    if (pusedDefaultChar && *pusedDefaultChar)
-        return -2;
-    return 0;
+    if (pusedDefaultChar && *pusedDefaultChar) {
+        ret = -2;
+        goto done;
+    }
+    ret = 0;
+
+done:
+#if USE_UNICODE_WCHAR_CACHE
+    Py_DECREF(substring);
+#else /* USE_UNICODE_WCHAR_CACHE */
+    PyMem_Free(p);
+#endif /* USE_UNICODE_WCHAR_CACHE */
+    return ret;
 
 error:
-    Py_XDECREF(substring);
-    if (GetLastError() == ERROR_NO_UNICODE_TRANSLATION)
-        return -2;
+    if (GetLastError() == ERROR_NO_UNICODE_TRANSLATION) {
+        ret = -2;
+        goto done;
+    }
     PyErr_SetFromWindowsErr(0);
-    return -1;
+    goto done;
 }
 
 /*
@@ -8400,11 +8667,13 @@
     }
 
     /* Create a three-level trie */
-    result = PyObject_MALLOC(sizeof(struct encoding_map) +
+    result = PyObject_Malloc(sizeof(struct encoding_map) +
                              16*count2 + 128*count3 - 1);
-    if (!result)
+    if (!result) {
         return PyErr_NoMemory();
-    PyObject_Init(result, &EncodingMapType);
+    }
+
+    _PyObject_Init(result, &EncodingMapType);
     mresult = (struct encoding_map*)result;
     mresult->count2 = count2;
     mresult->count3 = count3;
@@ -10065,7 +10334,7 @@
         PyErr_SetString(PyExc_OverflowError, "string is too long");
         return NULL;
     }
-    tmp = PyMem_MALLOC(sizeof(Py_UCS4) * 3 * length);
+    tmp = PyMem_Malloc(sizeof(Py_UCS4) * 3 * length);
     if (tmp == NULL)
         return PyErr_NoMemory();
     newlength = perform(kind, data, length, tmp, &maxchar);
@@ -10089,7 +10358,7 @@
         Py_UNREACHABLE();
     }
   leave:
-    PyMem_FREE(tmp);
+    PyMem_Free(tmp);
     return res;
 }
 
@@ -10820,7 +11089,7 @@
             release1 = 1;
         }
         /* new_size = PyUnicode_GET_LENGTH(self) + n * (PyUnicode_GET_LENGTH(str2) -
-           PyUnicode_GET_LENGTH(str1))); */
+           PyUnicode_GET_LENGTH(str1)); */
         if (len1 < len2 && len2 - len1 > (PY_SSIZE_T_MAX - slen) / n) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "replace string is too long");
@@ -10828,10 +11097,7 @@
         }
         new_size = slen + n * (len2 - len1);
         if (new_size == 0) {
-            _Py_INCREF_UNICODE_EMPTY();
-            if (!unicode_empty)
-                goto error;
-            u = unicode_empty;
+            u = unicode_new_empty();
             goto done;
         }
         if (new_size > (PY_SSIZE_T_MAX / rkind)) {
@@ -10907,11 +11173,11 @@
     assert(release1 == (buf1 != PyUnicode_DATA(str1)));
     assert(release2 == (buf2 != PyUnicode_DATA(str2)));
     if (srelease)
-        PyMem_FREE((void *)sbuf);
+        PyMem_Free((void *)sbuf);
     if (release1)
-        PyMem_FREE((void *)buf1);
+        PyMem_Free((void *)buf1);
     if (release2)
-        PyMem_FREE((void *)buf2);
+        PyMem_Free((void *)buf2);
     assert(_PyUnicode_CheckConsistency(u, 1));
     return u;
 
@@ -10921,11 +11187,11 @@
     assert(release1 == (buf1 != PyUnicode_DATA(str1)));
     assert(release2 == (buf2 != PyUnicode_DATA(str2)));
     if (srelease)
-        PyMem_FREE((void *)sbuf);
+        PyMem_Free((void *)sbuf);
     if (release1)
-        PyMem_FREE((void *)buf1);
+        PyMem_Free((void *)buf1);
     if (release2)
-        PyMem_FREE((void *)buf2);
+        PyMem_Free((void *)buf2);
     return unicode_result_unchanged(self);
 
   error:
@@ -10933,11 +11199,11 @@
     assert(release1 == (buf1 != PyUnicode_DATA(str1)));
     assert(release2 == (buf2 != PyUnicode_DATA(str2)));
     if (srelease)
-        PyMem_FREE((void *)sbuf);
+        PyMem_Free((void *)sbuf);
     if (release1)
-        PyMem_FREE((void *)buf1);
+        PyMem_Free((void *)buf1);
     if (release2)
-        PyMem_FREE((void *)buf2);
+        PyMem_Free((void *)buf2);
     return NULL;
 }
 
@@ -11354,8 +11620,9 @@
 #ifdef INTERNED_STRINGS
     assert(_PyUnicode_HASH(right_uni) != -1);
     Py_hash_t hash = _PyUnicode_HASH(left);
-    if (hash != -1 && hash != _PyUnicode_HASH(right_uni))
+    if (hash != -1 && hash != _PyUnicode_HASH(right_uni)) {
         return 0;
+    }
 #endif
 
     return unicode_compare_eq(left, right_uni);
@@ -11489,10 +11756,13 @@
         return NULL;
 
     /* Shortcuts */
-    if (left == unicode_empty)
+    PyObject *empty = unicode_get_empty();  // Borrowed reference
+    if (left == empty) {
         return PyUnicode_FromObject(right);
-    if (right == unicode_empty)
+    }
+    if (right == empty) {
         return PyUnicode_FromObject(left);
+    }
 
     left_len = PyUnicode_GET_LENGTH(left);
     right_len = PyUnicode_GET_LENGTH(right);
@@ -11543,14 +11813,16 @@
         goto error;
 
     /* Shortcuts */
-    if (left == unicode_empty) {
+    PyObject *empty = unicode_get_empty();  // Borrowed reference
+    if (left == empty) {
         Py_DECREF(left);
         Py_INCREF(right);
         *p_left = right;
         return;
     }
-    if (right == unicode_empty)
+    if (right == empty) {
         return;
+    }
 
     left_len = PyUnicode_GET_LENGTH(left);
     right_len = PyUnicode_GET_LENGTH(right);
@@ -13247,14 +13519,8 @@
     len1 = PyUnicode_GET_LENGTH(str_obj);
     len2 = PyUnicode_GET_LENGTH(sep_obj);
     if (kind1 < kind2 || len1 < len2) {
-        _Py_INCREF_UNICODE_EMPTY();
-        if (!unicode_empty)
-            out = NULL;
-        else {
-            out = PyTuple_Pack(3, str_obj, unicode_empty, unicode_empty);
-            Py_DECREF(unicode_empty);
-        }
-        return out;
+        PyObject *empty = unicode_get_empty();  // Borrowed reference
+        return PyTuple_Pack(3, str_obj, empty, empty);
     }
     buf1 = PyUnicode_DATA(str_obj);
     buf2 = PyUnicode_DATA(sep_obj);
@@ -13305,14 +13571,8 @@
     len1 = PyUnicode_GET_LENGTH(str_obj);
     len2 = PyUnicode_GET_LENGTH(sep_obj);
     if (kind1 < kind2 || len1 < len2) {
-        _Py_INCREF_UNICODE_EMPTY();
-        if (!unicode_empty)
-            out = NULL;
-        else {
-            out = PyTuple_Pack(3, unicode_empty, unicode_empty, str_obj);
-            Py_DECREF(unicode_empty);
-        }
-        return out;
+        PyObject *empty = unicode_get_empty();  // Borrowed reference
+        return PyTuple_Pack(3, empty, empty, str_obj);
     }
     buf1 = PyUnicode_DATA(str_obj);
     buf2 = PyUnicode_DATA(sep_obj);
@@ -13928,7 +14188,7 @@
     {
     case PyUnicode_1BYTE_KIND: maxchar = 0xff; break;
     case PyUnicode_2BYTE_KIND: maxchar = 0xffff; break;
-    case PyUnicode_4BYTE_KIND: maxchar = 0x10ffff; break;
+    case PyUnicode_4BYTE_KIND: maxchar = MAX_UNICODE; break;
     default:
         Py_UNREACHABLE();
     }
@@ -14635,20 +14895,15 @@
     /* make sure number is a type of integer for o, x, and X */
     if (!PyLong_Check(v)) {
         if (type == 'o' || type == 'x' || type == 'X') {
-            iobj = PyNumber_Index(v);
-            if (iobj == NULL) {
-                if (PyErr_ExceptionMatches(PyExc_TypeError))
-                    goto wrongtype;
-                return -1;
-            }
+            iobj = _PyNumber_Index(v);
         }
         else {
             iobj = PyNumber_Long(v);
-            if (iobj == NULL ) {
-                if (PyErr_ExceptionMatches(PyExc_TypeError))
-                    goto wrongtype;
-                return -1;
-            }
+        }
+        if (iobj == NULL ) {
+            if (PyErr_ExceptionMatches(PyExc_TypeError))
+                goto wrongtype;
+            return -1;
         }
         assert(PyLong_Check(iobj));
     }
@@ -14712,7 +14967,7 @@
             break;
         default:
             PyErr_Format(PyExc_TypeError,
-                    "%%%c format: a number is required, "
+                    "%%%c format: a real number is required, "
                     "not %.200s",
                     type, Py_TYPE(v)->tp_name);
             break;
@@ -14731,24 +14986,17 @@
         goto onError;
     }
     else {
-        PyObject *iobj;
-        long x;
-        /* make sure number is a type of integer */
-        if (!PyLong_Check(v)) {
-            iobj = PyNumber_Index(v);
-            if (iobj == NULL) {
+        int overflow;
+        long x = PyLong_AsLongAndOverflow(v, &overflow);
+        if (x == -1 && PyErr_Occurred()) {
+            if (PyErr_ExceptionMatches(PyExc_TypeError)) {
                 goto onError;
             }
-            x = PyLong_AsLong(iobj);
-            Py_DECREF(iobj);
+            return (Py_UCS4) -1;
         }
-        else {
-            x = PyLong_AsLong(v);
-        }
-        if (x == -1 && PyErr_Occurred())
-            goto onError;
 
         if (x < 0 || x > MAX_UNICODE) {
+            /* this includes an overflow in converting to C long */
             PyErr_SetString(PyExc_OverflowError,
                             "%c arg not in range(0x110000)");
             return (Py_UCS4) -1;
@@ -15346,52 +15594,57 @@
 }
 
 static PyObject *
-unicode_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
+unicode_subtype_new(PyTypeObject *type, PyObject *unicode);
+
+/*[clinic input]
+@classmethod
+str.__new__ as unicode_new
+
+    object as x: object = NULL
+    encoding: str = NULL
+    errors: str = NULL
+
+[clinic start generated code]*/
 
 static PyObject *
-unicode_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+unicode_new_impl(PyTypeObject *type, PyObject *x, const char *encoding,
+                 const char *errors)
+/*[clinic end generated code: output=fc72d4878b0b57e9 input=e81255e5676d174e]*/
 {
-    PyObject *x = NULL;
-    static char *kwlist[] = {"object", "encoding", "errors", 0};
-    char *encoding = NULL;
-    char *errors = NULL;
+    PyObject *unicode;
+    if (x == NULL) {
+        unicode = unicode_new_empty();
+    }
+    else if (encoding == NULL && errors == NULL) {
+        unicode = PyObject_Str(x);
+    }
+    else {
+        unicode = PyUnicode_FromEncodedObject(x, encoding, errors);
+    }
 
-    if (type != &PyUnicode_Type)
-        return unicode_subtype_new(type, args, kwds);
-    if (!PyArg_ParseTupleAndKeywords(args, kwds, "|Oss:str",
-                                     kwlist, &x, &encoding, &errors))
-        return NULL;
-    if (x == NULL)
-        _Py_RETURN_UNICODE_EMPTY();
-    if (encoding == NULL && errors == NULL)
-        return PyObject_Str(x);
-    else
-        return PyUnicode_FromEncodedObject(x, encoding, errors);
+    if (unicode != NULL && type != &PyUnicode_Type) {
+        Py_SETREF(unicode, unicode_subtype_new(type, unicode));
+    }
+    return unicode;
 }
 
 static PyObject *
-unicode_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+unicode_subtype_new(PyTypeObject *type, PyObject *unicode)
 {
-    PyObject *unicode, *self;
+    PyObject *self;
     Py_ssize_t length, char_size;
     int share_wstr, share_utf8;
     unsigned int kind;
     void *data;
 
     assert(PyType_IsSubtype(type, &PyUnicode_Type));
-
-    unicode = unicode_new(&PyUnicode_Type, args, kwds);
-    if (unicode == NULL)
-        return NULL;
     assert(_PyUnicode_CHECK(unicode));
     if (PyUnicode_READY(unicode) == -1) {
-        Py_DECREF(unicode);
         return NULL;
     }
 
     self = type->tp_alloc(type, 0);
     if (self == NULL) {
-        Py_DECREF(unicode);
         return NULL;
     }
     kind = PyUnicode_KIND(unicode);
@@ -15438,7 +15691,7 @@
         PyErr_NoMemory();
         goto onError;
     }
-    data = PyObject_MALLOC((length + 1) * char_size);
+    data = PyObject_Malloc((length + 1) * char_size);
     if (data == NULL) {
         PyErr_NoMemory();
         goto onError;
@@ -15460,11 +15713,9 @@
 #ifdef Py_DEBUG
     _PyUnicode_HASH(self) = _PyUnicode_HASH(unicode);
 #endif
-    Py_DECREF(unicode);
     return self;
 
 onError:
-    Py_DECREF(unicode);
     Py_DECREF(self);
     return NULL;
 }
@@ -15505,7 +15756,8 @@
     0,                            /* tp_setattro */
     0,                            /* tp_as_buffer */
     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
-    Py_TPFLAGS_UNICODE_SUBCLASS,   /* tp_flags */
+        Py_TPFLAGS_UNICODE_SUBCLASS |
+        _Py_TPFLAGS_MATCH_SELF, /* tp_flags */
     unicode_doc,                  /* tp_doc */
     0,                            /* tp_traverse */
     0,                            /* tp_clear */
@@ -15530,36 +15782,40 @@
 /* Initialize the Unicode implementation */
 
 PyStatus
-_PyUnicode_Init(void)
+_PyUnicode_Init(PyInterpreterState *interp)
 {
-    /* XXX - move this array to unicodectype.c ? */
-    Py_UCS2 linebreak[] = {
-        0x000A, /* LINE FEED */
-        0x000D, /* CARRIAGE RETURN */
-        0x001C, /* FILE SEPARATOR */
-        0x001D, /* GROUP SEPARATOR */
-        0x001E, /* RECORD SEPARATOR */
-        0x0085, /* NEXT LINE */
-        0x2028, /* LINE SEPARATOR */
-        0x2029, /* PARAGRAPH SEPARATOR */
-    };
-
-    /* Init the implementation */
-    _Py_INCREF_UNICODE_EMPTY();
-    if (!unicode_empty) {
-        return _PyStatus_ERR("Can't create empty string");
+    struct _Py_unicode_state *state = &interp->unicode;
+    if (unicode_create_empty_string_singleton(state) < 0) {
+        return _PyStatus_NO_MEMORY();
     }
-    Py_DECREF(unicode_empty);
 
+    if (_Py_IsMainInterpreter(interp)) {
+        /* initialize the linebreak bloom filter */
+        const Py_UCS2 linebreak[] = {
+            0x000A, /* LINE FEED */
+            0x000D, /* CARRIAGE RETURN */
+            0x001C, /* FILE SEPARATOR */
+            0x001D, /* GROUP SEPARATOR */
+            0x001E, /* RECORD SEPARATOR */
+            0x0085, /* NEXT LINE */
+            0x2028, /* LINE SEPARATOR */
+            0x2029, /* PARAGRAPH SEPARATOR */
+        };
+        bloom_linebreak = make_bloom_mask(
+            PyUnicode_2BYTE_KIND, linebreak,
+            Py_ARRAY_LENGTH(linebreak));
+    }
+
+    return _PyStatus_OK();
+}
+
+
+PyStatus
+_PyUnicode_InitTypes(void)
+{
     if (PyType_Ready(&PyUnicode_Type) < 0) {
         return _PyStatus_ERR("Can't initialize unicode type");
     }
-
-    /* initialize the linebreak bloom filter */
-    bloom_linebreak = make_bloom_mask(
-        PyUnicode_2BYTE_KIND, linebreak,
-        Py_ARRAY_LENGTH(linebreak));
-
     if (PyType_Ready(&EncodingMapType) < 0) {
          return _PyStatus_ERR("Can't initialize encoding map type");
     }
@@ -15597,6 +15853,11 @@
     }
 
 #ifdef INTERNED_STRINGS
+    if (PyUnicode_READY(s) == -1) {
+        PyErr_Clear();
+        return;
+    }
+
     if (interned == NULL) {
         interned = PyDict_New();
         if (interned == NULL) {
@@ -15605,9 +15866,7 @@
         }
     }
 
-    PyObject *t;
-    t = PyDict_SetDefault(interned, s, s);
-
+    PyObject *t = PyDict_SetDefault(interned, s, s);
     if (t == NULL) {
         PyErr_Clear();
         return;
@@ -15619,16 +15878,30 @@
         return;
     }
 
-    /* The two references in interned are not counted by refcnt.
-       The deallocator will take care of this */
+    /* The two references in interned dict (key and value) are not counted by
+       refcnt. unicode_dealloc() and _PyUnicode_ClearInterned() take care of
+       this. */
     Py_SET_REFCNT(s, Py_REFCNT(s) - 2);
     _PyUnicode_STATE(s).interned = SSTATE_INTERNED_MORTAL;
+#else
+    // PyDict expects that interned strings have their hash
+    // (PyASCIIObject.hash) already computed.
+    (void)unicode_hash(s);
 #endif
 }
 
 void
 PyUnicode_InternImmortal(PyObject **p)
 {
+    if (PyErr_WarnEx(PyExc_DeprecationWarning,
+            "PyUnicode_InternImmortal() is deprecated; "
+            "use PyUnicode_InternInPlace() instead", 1) < 0)
+    {
+        // The function has no return value, the exception cannot
+        // be reported to the caller, so just log it.
+        PyErr_WriteUnraisable(NULL);
+    }
+
     PyUnicode_InternInPlace(p);
     if (PyUnicode_CHECK_INTERNED(*p) != SSTATE_INTERNED_IMMORTAL) {
         _PyUnicode_STATE(*p).interned = SSTATE_INTERNED_IMMORTAL;
@@ -15647,45 +15920,45 @@
 }
 
 
-#if defined(WITH_VALGRIND) || defined(__INSURE__)
-static void
-unicode_release_interned(void)
+void
+_PyUnicode_ClearInterned(PyInterpreterState *interp)
 {
-    if (interned == NULL || !PyDict_Check(interned)) {
-        return;
-    }
-    PyObject *keys = PyDict_Keys(interned);
-    if (keys == NULL || !PyList_Check(keys)) {
-        PyErr_Clear();
+    if (!_Py_IsMainInterpreter(interp)) {
+        // interned dict is shared by all interpreters
         return;
     }
 
-    /* Since unicode_release_interned() is intended to help a leak
-       detector, interned unicode strings are not forcibly deallocated;
-       rather, we give them their stolen references back, and then clear
-       and DECREF the interned dict. */
+    if (interned == NULL) {
+        return;
+    }
+    assert(PyDict_CheckExact(interned));
 
-    Py_ssize_t n = PyList_GET_SIZE(keys);
+    /* Interned unicode strings are not forcibly deallocated; rather, we give
+       them their stolen references back, and then clear and DECREF the
+       interned dict. */
+
 #ifdef INTERNED_STATS
-    fprintf(stderr, "releasing %" PY_FORMAT_SIZE_T "d interned strings\n",
-            n);
+    fprintf(stderr, "releasing %zd interned strings\n",
+            PyDict_GET_SIZE(interned));
 
     Py_ssize_t immortal_size = 0, mortal_size = 0;
 #endif
-    for (Py_ssize_t i = 0; i < n; i++) {
-        PyObject *s = PyList_GET_ITEM(keys, i);
-        if (PyUnicode_READY(s) == -1) {
-            Py_UNREACHABLE();
-        }
+    Py_ssize_t pos = 0;
+    PyObject *s, *ignored_value;
+    while (PyDict_Next(interned, &pos, &s, &ignored_value)) {
+        assert(PyUnicode_IS_READY(s));
+
         switch (PyUnicode_CHECK_INTERNED(s)) {
         case SSTATE_INTERNED_IMMORTAL:
-            Py_REFCNT(s) += 1;
+            Py_SET_REFCNT(s, Py_REFCNT(s) + 1);
 #ifdef INTERNED_STATS
             immortal_size += PyUnicode_GET_LENGTH(s);
 #endif
             break;
         case SSTATE_INTERNED_MORTAL:
-            Py_REFCNT(s) += 2;
+            // Restore the two references (key and value) ignored
+            // by PyUnicode_InternInPlace().
+            Py_SET_REFCNT(s, Py_REFCNT(s) + 2);
 #ifdef INTERNED_STATS
             mortal_size += PyUnicode_GET_LENGTH(s);
 #endif
@@ -15698,15 +15971,14 @@
         _PyUnicode_STATE(s).interned = SSTATE_NOT_INTERNED;
     }
 #ifdef INTERNED_STATS
-    fprintf(stderr, "total size of all interned strings: "
-            "%" PY_FORMAT_SIZE_T "d/%" PY_FORMAT_SIZE_T "d "
-            "mortal/immortal\n", mortal_size, immortal_size);
+    fprintf(stderr,
+            "total size of all interned strings: %zd/%zd mortal/immortal\n",
+            mortal_size, immortal_size);
 #endif
-    Py_DECREF(keys);
+
     PyDict_Clear(interned);
     Py_CLEAR(interned);
 }
-#endif
 
 
 /********************* Unicode Iterator **************************/
@@ -15868,127 +16140,6 @@
     return (PyObject *)it;
 }
 
-
-size_t
-Py_UNICODE_strlen(const Py_UNICODE *u)
-{
-    return wcslen(u);
-}
-
-Py_UNICODE*
-Py_UNICODE_strcpy(Py_UNICODE *s1, const Py_UNICODE *s2)
-{
-    Py_UNICODE *u = s1;
-    while ((*u++ = *s2++));
-    return s1;
-}
-
-Py_UNICODE*
-Py_UNICODE_strncpy(Py_UNICODE *s1, const Py_UNICODE *s2, size_t n)
-{
-    Py_UNICODE *u = s1;
-    while ((*u++ = *s2++))
-        if (n-- == 0)
-            break;
-    return s1;
-}
-
-Py_UNICODE*
-Py_UNICODE_strcat(Py_UNICODE *s1, const Py_UNICODE *s2)
-{
-    Py_UNICODE *u1 = s1;
-    u1 += wcslen(u1);
-    while ((*u1++ = *s2++));
-    return s1;
-}
-
-int
-Py_UNICODE_strcmp(const Py_UNICODE *s1, const Py_UNICODE *s2)
-{
-    while (*s1 && *s2 && *s1 == *s2)
-        s1++, s2++;
-    if (*s1 && *s2)
-        return (*s1 < *s2) ? -1 : +1;
-    if (*s1)
-        return 1;
-    if (*s2)
-        return -1;
-    return 0;
-}
-
-int
-Py_UNICODE_strncmp(const Py_UNICODE *s1, const Py_UNICODE *s2, size_t n)
-{
-    Py_UNICODE u1, u2;
-    for (; n != 0; n--) {
-        u1 = *s1;
-        u2 = *s2;
-        if (u1 != u2)
-            return (u1 < u2) ? -1 : +1;
-        if (u1 == '\0')
-            return 0;
-        s1++;
-        s2++;
-    }
-    return 0;
-}
-
-Py_UNICODE*
-Py_UNICODE_strchr(const Py_UNICODE *s, Py_UNICODE c)
-{
-    const Py_UNICODE *p;
-    for (p = s; *p; p++)
-        if (*p == c)
-            return (Py_UNICODE*)p;
-    return NULL;
-}
-
-Py_UNICODE*
-Py_UNICODE_strrchr(const Py_UNICODE *s, Py_UNICODE c)
-{
-    const Py_UNICODE *p;
-    p = s + wcslen(s);
-    while (p != s) {
-        p--;
-        if (*p == c)
-            return (Py_UNICODE*)p;
-    }
-    return NULL;
-}
-
-Py_UNICODE*
-PyUnicode_AsUnicodeCopy(PyObject *unicode)
-{
-    Py_UNICODE *u, *copy;
-    Py_ssize_t len, size;
-
-    if (!PyUnicode_Check(unicode)) {
-        PyErr_BadArgument();
-        return NULL;
-    }
-_Py_COMP_DIAG_PUSH
-_Py_COMP_DIAG_IGNORE_DEPR_DECLS
-    u = PyUnicode_AsUnicodeAndSize(unicode, &len);
-_Py_COMP_DIAG_POP
-    if (u == NULL)
-        return NULL;
-    /* Ensure we won't overflow the size. */
-    if (len > ((PY_SSIZE_T_MAX / (Py_ssize_t)sizeof(Py_UNICODE)) - 1)) {
-        PyErr_NoMemory();
-        return NULL;
-    }
-    size = len + 1; /* copy the null character */
-    size *= sizeof(Py_UNICODE);
-    copy = PyMem_Malloc(size);
-    if (copy == NULL) {
-        PyErr_NoMemory();
-        return NULL;
-    }
-    memcpy(copy, u, size);
-    return copy;
-}
-
-
 static int
 encode_wstr_utf8(wchar_t *wstr, char **str, const char *name)
 {
@@ -16054,10 +16205,10 @@
 
 
 static PyStatus
-init_stdio_encoding(PyThreadState *tstate)
+init_stdio_encoding(PyInterpreterState *interp)
 {
     /* Update the stdio encoding to the normalized Python codec name. */
-    PyConfig *config = (PyConfig*)_PyInterpreterState_GetConfig(tstate->interp);
+    PyConfig *config = (PyConfig*)_PyInterpreterState_GetConfig(interp);
     if (config_get_codec_name(&config->stdio_encoding) < 0) {
         return _PyStatus_ERR("failed to get the Python codec name "
                              "of the stdio encoding");
@@ -16074,7 +16225,7 @@
     _Py_error_handler error_handler;
     error_handler = get_error_handler_wide(config->filesystem_errors);
     if (error_handler == _Py_ERROR_UNKNOWN) {
-        PyErr_SetString(PyExc_RuntimeError, "unknow filesystem error handler");
+        PyErr_SetString(PyExc_RuntimeError, "unknown filesystem error handler");
         return -1;
     }
 
@@ -16150,7 +16301,7 @@
         return status;
     }
 
-    return init_stdio_encoding(tstate);
+    return init_stdio_encoding(tstate->interp);
 }
 
 
@@ -16194,33 +16345,23 @@
 
 
 void
-_PyUnicode_Fini(PyThreadState *tstate)
+_PyUnicode_Fini(PyInterpreterState *interp)
 {
-    if (_Py_IsMainInterpreter(tstate)) {
-#if defined(WITH_VALGRIND) || defined(__INSURE__)
-        /* Insure++ is a memory analysis tool that aids in discovering
-         * memory leaks and other memory problems.  On Python exit, the
-         * interned string dictionaries are flagged as being in use at exit
-         * (which it is).  Under normal circumstances, this is fine because
-         * the memory will be automatically reclaimed by the system.  Under
-         * memory debugging, it's a huge source of useless noise, so we
-         * trade off slower shutdown for less distraction in the memory
-         * reports.  -baw
-         */
-        unicode_release_interned();
-#endif /* __INSURE__ */
+    struct _Py_unicode_state *state = &interp->unicode;
 
-        Py_CLEAR(unicode_empty);
-
-#ifdef LATIN1_SINGLETONS
-        for (Py_ssize_t i = 0; i < 256; i++) {
-            Py_CLEAR(unicode_latin1[i]);
-        }
-#endif
-        unicode_clear_static_strings();
+    if (_Py_IsMainInterpreter(interp)) {
+        // _PyUnicode_ClearInterned() must be called before _PyUnicode_Fini()
+        assert(interned == NULL);
     }
 
-    _PyUnicode_FiniEncodings(&tstate->interp->unicode.fs_codec);
+    _PyUnicode_FiniEncodings(&state->fs_codec);
+
+    unicode_clear_identifiers(state);
+
+    for (Py_ssize_t i = 0; i < 256; i++) {
+        Py_CLEAR(state->latin1[i]);
+    }
+    Py_CLEAR(state->empty_string);
 }
 
 
@@ -16237,20 +16378,16 @@
 
 static struct PyModuleDef _string_module = {
     PyModuleDef_HEAD_INIT,
-    "_string",
-    PyDoc_STR("string helper module"),
-    0,
-    _string_methods,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    .m_name = "_string",
+    .m_doc = PyDoc_STR("string helper module"),
+    .m_size = 0,
+    .m_methods = _string_methods,
 };
 
 PyMODINIT_FUNC
 PyInit__string(void)
 {
-    return PyModule_Create(&_string_module);
+    return PyModuleDef_Init(&_string_module);
 }
 
 
diff --git a/Objects/unionobject.c b/Objects/unionobject.c
new file mode 100644
index 0000000..80c7038
--- /dev/null
+++ b/Objects/unionobject.c
@@ -0,0 +1,496 @@
+// types.UnionType -- used to represent e.g. Union[int, str], int | str
+#include "Python.h"
+#include "pycore_object.h"  // _PyObject_GC_TRACK/UNTRACK
+#include "pycore_unionobject.h"
+#include "structmember.h"
+
+
+static PyObject *make_union(PyObject *);
+
+
+typedef struct {
+    PyObject_HEAD
+    PyObject *args;
+    PyObject *parameters;
+} unionobject;
+
+static void
+unionobject_dealloc(PyObject *self)
+{
+    unionobject *alias = (unionobject *)self;
+
+    _PyObject_GC_UNTRACK(self);
+
+    Py_XDECREF(alias->args);
+    Py_XDECREF(alias->parameters);
+    Py_TYPE(self)->tp_free(self);
+}
+
+static int
+union_traverse(PyObject *self, visitproc visit, void *arg)
+{
+    unionobject *alias = (unionobject *)self;
+    Py_VISIT(alias->args);
+    Py_VISIT(alias->parameters);
+    return 0;
+}
+
+static Py_hash_t
+union_hash(PyObject *self)
+{
+    unionobject *alias = (unionobject *)self;
+    PyObject *args = PyFrozenSet_New(alias->args);
+    if (args == NULL) {
+        return (Py_hash_t)-1;
+    }
+    Py_hash_t hash = PyObject_Hash(args);
+    Py_DECREF(args);
+    return hash;
+}
+
+static int
+is_generic_alias_in_args(PyObject *args)
+{
+    Py_ssize_t nargs = PyTuple_GET_SIZE(args);
+    for (Py_ssize_t iarg = 0; iarg < nargs; iarg++) {
+        PyObject *arg = PyTuple_GET_ITEM(args, iarg);
+        if (_PyGenericAlias_Check(arg)) {
+            return 0;
+        }
+    }
+    return 1;
+}
+
+static PyObject *
+union_instancecheck(PyObject *self, PyObject *instance)
+{
+    unionobject *alias = (unionobject *) self;
+    Py_ssize_t nargs = PyTuple_GET_SIZE(alias->args);
+    if (!is_generic_alias_in_args(alias->args)) {
+        PyErr_SetString(PyExc_TypeError,
+            "isinstance() argument 2 cannot contain a parameterized generic");
+        return NULL;
+    }
+    for (Py_ssize_t iarg = 0; iarg < nargs; iarg++) {
+        PyObject *arg = PyTuple_GET_ITEM(alias->args, iarg);
+        if (PyType_Check(arg)) {
+            int res = PyObject_IsInstance(instance, arg);
+            if (res < 0) {
+                return NULL;
+            }
+            if (res) {
+                Py_RETURN_TRUE;
+            }
+        }
+    }
+    Py_RETURN_FALSE;
+}
+
+static PyObject *
+union_subclasscheck(PyObject *self, PyObject *instance)
+{
+    if (!PyType_Check(instance)) {
+        PyErr_SetString(PyExc_TypeError, "issubclass() arg 1 must be a class");
+        return NULL;
+    }
+    unionobject *alias = (unionobject *)self;
+    if (!is_generic_alias_in_args(alias->args)) {
+        PyErr_SetString(PyExc_TypeError,
+            "issubclass() argument 2 cannot contain a parameterized generic");
+        return NULL;
+    }
+    Py_ssize_t nargs = PyTuple_GET_SIZE(alias->args);
+    for (Py_ssize_t iarg = 0; iarg < nargs; iarg++) {
+        PyObject *arg = PyTuple_GET_ITEM(alias->args, iarg);
+        if (PyType_Check(arg)) {
+            int res = PyObject_IsSubclass(instance, arg);
+            if (res < 0) {
+                return NULL;
+            }
+            if (res) {
+                Py_RETURN_TRUE;
+            }
+        }
+    }
+    Py_RETURN_FALSE;
+}
+
+static PyObject *
+union_richcompare(PyObject *a, PyObject *b, int op)
+{
+    if (!_PyUnion_Check(b) || (op != Py_EQ && op != Py_NE)) {
+        Py_RETURN_NOTIMPLEMENTED;
+    }
+
+    PyObject *a_set = PySet_New(((unionobject*)a)->args);
+    if (a_set == NULL) {
+        return NULL;
+    }
+    PyObject *b_set = PySet_New(((unionobject*)b)->args);
+    if (b_set == NULL) {
+        Py_DECREF(a_set);
+        return NULL;
+    }
+    PyObject *result = PyObject_RichCompare(a_set, b_set, op);
+    Py_DECREF(b_set);
+    Py_DECREF(a_set);
+    return result;
+}
+
+static PyObject*
+flatten_args(PyObject* args)
+{
+    Py_ssize_t arg_length = PyTuple_GET_SIZE(args);
+    Py_ssize_t total_args = 0;
+    // Get number of total args once it's flattened.
+    for (Py_ssize_t i = 0; i < arg_length; i++) {
+        PyObject *arg = PyTuple_GET_ITEM(args, i);
+        if (_PyUnion_Check(arg)) {
+            total_args += PyTuple_GET_SIZE(((unionobject*) arg)->args);
+        } else {
+            total_args++;
+        }
+    }
+    // Create new tuple of flattened args.
+    PyObject *flattened_args = PyTuple_New(total_args);
+    if (flattened_args == NULL) {
+        return NULL;
+    }
+    Py_ssize_t pos = 0;
+    for (Py_ssize_t i = 0; i < arg_length; i++) {
+        PyObject *arg = PyTuple_GET_ITEM(args, i);
+        if (_PyUnion_Check(arg)) {
+            PyObject* nested_args = ((unionobject*)arg)->args;
+            Py_ssize_t nested_arg_length = PyTuple_GET_SIZE(nested_args);
+            for (Py_ssize_t j = 0; j < nested_arg_length; j++) {
+                PyObject* nested_arg = PyTuple_GET_ITEM(nested_args, j);
+                Py_INCREF(nested_arg);
+                PyTuple_SET_ITEM(flattened_args, pos, nested_arg);
+                pos++;
+            }
+        } else {
+            if (arg == Py_None) {
+                arg = (PyObject *)&_PyNone_Type;
+            }
+            Py_INCREF(arg);
+            PyTuple_SET_ITEM(flattened_args, pos, arg);
+            pos++;
+        }
+    }
+    assert(pos == total_args);
+    return flattened_args;
+}
+
+static PyObject*
+dedup_and_flatten_args(PyObject* args)
+{
+    args = flatten_args(args);
+    if (args == NULL) {
+        return NULL;
+    }
+    Py_ssize_t arg_length = PyTuple_GET_SIZE(args);
+    PyObject *new_args = PyTuple_New(arg_length);
+    if (new_args == NULL) {
+        Py_DECREF(args);
+        return NULL;
+    }
+    // Add unique elements to an array.
+    Py_ssize_t added_items = 0;
+    for (Py_ssize_t i = 0; i < arg_length; i++) {
+        int is_duplicate = 0;
+        PyObject* i_element = PyTuple_GET_ITEM(args, i);
+        for (Py_ssize_t j = 0; j < added_items; j++) {
+            PyObject* j_element = PyTuple_GET_ITEM(new_args, j);
+            int is_ga = _PyGenericAlias_Check(i_element) &&
+                        _PyGenericAlias_Check(j_element);
+            // RichCompare to also deduplicate GenericAlias types (slower)
+            is_duplicate = is_ga ? PyObject_RichCompareBool(i_element, j_element, Py_EQ)
+                : i_element == j_element;
+            // Should only happen if RichCompare fails
+            if (is_duplicate < 0) {
+                Py_DECREF(args);
+                Py_DECREF(new_args);
+                return NULL;
+            }
+            if (is_duplicate)
+                break;
+        }
+        if (!is_duplicate) {
+            Py_INCREF(i_element);
+            PyTuple_SET_ITEM(new_args, added_items, i_element);
+            added_items++;
+        }
+    }
+    Py_DECREF(args);
+    _PyTuple_Resize(&new_args, added_items);
+    return new_args;
+}
+
+static int
+is_unionable(PyObject *obj)
+{
+    return (obj == Py_None ||
+        PyType_Check(obj) ||
+        _PyGenericAlias_Check(obj) ||
+        _PyUnion_Check(obj));
+}
+
+PyObject *
+_Py_union_type_or(PyObject* self, PyObject* other)
+{
+    if (!is_unionable(self) || !is_unionable(other)) {
+        Py_RETURN_NOTIMPLEMENTED;
+    }
+
+    PyObject *tuple = PyTuple_Pack(2, self, other);
+    if (tuple == NULL) {
+        return NULL;
+    }
+
+    PyObject *new_union = make_union(tuple);
+    Py_DECREF(tuple);
+    return new_union;
+}
+
+static int
+union_repr_item(_PyUnicodeWriter *writer, PyObject *p)
+{
+    _Py_IDENTIFIER(__module__);
+    _Py_IDENTIFIER(__qualname__);
+    _Py_IDENTIFIER(__origin__);
+    _Py_IDENTIFIER(__args__);
+    PyObject *qualname = NULL;
+    PyObject *module = NULL;
+    PyObject *tmp;
+    PyObject *r = NULL;
+    int err;
+
+    if (p == (PyObject *)&_PyNone_Type) {
+        return _PyUnicodeWriter_WriteASCIIString(writer, "None", 4);
+    }
+
+    if (_PyObject_LookupAttrId(p, &PyId___origin__, &tmp) < 0) {
+        goto exit;
+    }
+
+    if (tmp) {
+        Py_DECREF(tmp);
+        if (_PyObject_LookupAttrId(p, &PyId___args__, &tmp) < 0) {
+            goto exit;
+        }
+        if (tmp) {
+            // It looks like a GenericAlias
+            Py_DECREF(tmp);
+            goto use_repr;
+        }
+    }
+
+    if (_PyObject_LookupAttrId(p, &PyId___qualname__, &qualname) < 0) {
+        goto exit;
+    }
+    if (qualname == NULL) {
+        goto use_repr;
+    }
+    if (_PyObject_LookupAttrId(p, &PyId___module__, &module) < 0) {
+        goto exit;
+    }
+    if (module == NULL || module == Py_None) {
+        goto use_repr;
+    }
+
+    // Looks like a class
+    if (PyUnicode_Check(module) &&
+        _PyUnicode_EqualToASCIIString(module, "builtins"))
+    {
+        // builtins don't need a module name
+        r = PyObject_Str(qualname);
+        goto exit;
+    }
+    else {
+        r = PyUnicode_FromFormat("%S.%S", module, qualname);
+        goto exit;
+    }
+
+use_repr:
+    r = PyObject_Repr(p);
+exit:
+    Py_XDECREF(qualname);
+    Py_XDECREF(module);
+    if (r == NULL) {
+        return -1;
+    }
+    err = _PyUnicodeWriter_WriteStr(writer, r);
+    Py_DECREF(r);
+    return err;
+}
+
+static PyObject *
+union_repr(PyObject *self)
+{
+    unionobject *alias = (unionobject *)self;
+    Py_ssize_t len = PyTuple_GET_SIZE(alias->args);
+
+    _PyUnicodeWriter writer;
+    _PyUnicodeWriter_Init(&writer);
+     for (Py_ssize_t i = 0; i < len; i++) {
+        if (i > 0 && _PyUnicodeWriter_WriteASCIIString(&writer, " | ", 3) < 0) {
+            goto error;
+        }
+        PyObject *p = PyTuple_GET_ITEM(alias->args, i);
+        if (union_repr_item(&writer, p) < 0) {
+            goto error;
+        }
+    }
+    return _PyUnicodeWriter_Finish(&writer);
+error:
+    _PyUnicodeWriter_Dealloc(&writer);
+    return NULL;
+}
+
+static PyMemberDef union_members[] = {
+        {"__args__", T_OBJECT, offsetof(unionobject, args), READONLY},
+        {0}
+};
+
+static PyMethodDef union_methods[] = {
+        {"__instancecheck__", union_instancecheck, METH_O},
+        {"__subclasscheck__", union_subclasscheck, METH_O},
+        {0}};
+
+
+static PyObject *
+union_getitem(PyObject *self, PyObject *item)
+{
+    unionobject *alias = (unionobject *)self;
+    // Populate __parameters__ if needed.
+    if (alias->parameters == NULL) {
+        alias->parameters = _Py_make_parameters(alias->args);
+        if (alias->parameters == NULL) {
+            return NULL;
+        }
+    }
+
+    PyObject *newargs = _Py_subs_parameters(self, alias->args, alias->parameters, item);
+    if (newargs == NULL) {
+        return NULL;
+    }
+
+    PyObject *res;
+    Py_ssize_t nargs = PyTuple_GET_SIZE(newargs);
+    if (nargs == 0) {
+        res = make_union(newargs);
+    }
+    else {
+        res = PyTuple_GET_ITEM(newargs, 0);
+        Py_INCREF(res);
+        for (Py_ssize_t iarg = 1; iarg < nargs; iarg++) {
+            PyObject *arg = PyTuple_GET_ITEM(newargs, iarg);
+            Py_SETREF(res, PyNumber_Or(res, arg));
+            if (res == NULL) {
+                break;
+            }
+        }
+    }
+    Py_DECREF(newargs);
+    return res;
+}
+
+static PyMappingMethods union_as_mapping = {
+    .mp_subscript = union_getitem,
+};
+
+static PyObject *
+union_parameters(PyObject *self, void *Py_UNUSED(unused))
+{
+    unionobject *alias = (unionobject *)self;
+    if (alias->parameters == NULL) {
+        alias->parameters = _Py_make_parameters(alias->args);
+        if (alias->parameters == NULL) {
+            return NULL;
+        }
+    }
+    Py_INCREF(alias->parameters);
+    return alias->parameters;
+}
+
+static PyGetSetDef union_properties[] = {
+    {"__parameters__", union_parameters, (setter)NULL, "Type variables in the types.UnionType.", NULL},
+    {0}
+};
+
+static PyNumberMethods union_as_number = {
+        .nb_or = _Py_union_type_or, // Add __or__ function
+};
+
+static const char* const cls_attrs[] = {
+        "__module__",  // Required for compatibility with typing module
+        NULL,
+};
+
+static PyObject *
+union_getattro(PyObject *self, PyObject *name)
+{
+    unionobject *alias = (unionobject *)self;
+    if (PyUnicode_Check(name)) {
+        for (const char * const *p = cls_attrs; ; p++) {
+            if (*p == NULL) {
+                break;
+            }
+            if (_PyUnicode_EqualToASCIIString(name, *p)) {
+                return PyObject_GetAttr((PyObject *) Py_TYPE(alias), name);
+            }
+        }
+    }
+    return PyObject_GenericGetAttr(self, name);
+}
+
+PyTypeObject _PyUnion_Type = {
+    PyVarObject_HEAD_INIT(&PyType_Type, 0)
+    .tp_name = "types.UnionType",
+    .tp_doc = "Represent a PEP 604 union type\n"
+              "\n"
+              "E.g. for int | str",
+    .tp_basicsize = sizeof(unionobject),
+    .tp_dealloc = unionobject_dealloc,
+    .tp_alloc = PyType_GenericAlloc,
+    .tp_free = PyObject_GC_Del,
+    .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
+    .tp_traverse = union_traverse,
+    .tp_hash = union_hash,
+    .tp_getattro = union_getattro,
+    .tp_members = union_members,
+    .tp_methods = union_methods,
+    .tp_richcompare = union_richcompare,
+    .tp_as_mapping = &union_as_mapping,
+    .tp_as_number = &union_as_number,
+    .tp_repr = union_repr,
+    .tp_getset = union_properties,
+};
+
+static PyObject *
+make_union(PyObject *args)
+{
+    assert(PyTuple_CheckExact(args));
+
+    args = dedup_and_flatten_args(args);
+    if (args == NULL) {
+        return NULL;
+    }
+    if (PyTuple_GET_SIZE(args) == 1) {
+        PyObject *result1 = PyTuple_GET_ITEM(args, 0);
+        Py_INCREF(result1);
+        Py_DECREF(args);
+        return result1;
+    }
+
+    unionobject *result = PyObject_GC_New(unionobject, &_PyUnion_Type);
+    if (result == NULL) {
+        Py_DECREF(args);
+        return NULL;
+    }
+
+    result->parameters = NULL;
+    result->args = args;
+    _PyObject_GC_TRACK(result);
+    return (PyObject*)result;
+}
diff --git a/Objects/weakrefobject.c b/Objects/weakrefobject.c
index 313e8ab..bb56c7d 100644
--- a/Objects/weakrefobject.c
+++ b/Objects/weakrefobject.c
@@ -657,6 +657,12 @@
         return NULL;
 
     PyObject *obj = PyWeakref_GET_OBJECT(proxy);
+    if (!PyIter_Check(obj)) {
+        PyErr_Format(PyExc_TypeError,
+            "Weakref proxy referenced a non-iterator '%.200s' object",
+            Py_TYPE(obj)->tp_name);
+        return NULL;
+    }
     Py_INCREF(obj);
     PyObject* res = PyIter_Next(obj);
     Py_DECREF(obj);
@@ -732,21 +738,6 @@
 };
 
 
-static Py_hash_t
-proxy_hash(PyObject *self)
-{
-    PyWeakReference *proxy = (PyWeakReference *)self;
-    if (!proxy_checkref(proxy)) {
-        return -1;
-    }
-    PyObject *obj = PyWeakref_GET_OBJECT(proxy);
-    Py_INCREF(obj);
-    Py_hash_t res = PyObject_Hash(obj);
-    Py_DECREF(obj);
-    return res;
-}
-
-
 PyTypeObject
 _PyWeakref_ProxyType = {
     PyVarObject_HEAD_INIT(&PyType_Type, 0)
@@ -763,7 +754,8 @@
     &proxy_as_number,                   /* tp_as_number */
     &proxy_as_sequence,                 /* tp_as_sequence */
     &proxy_as_mapping,                  /* tp_as_mapping */
-    proxy_hash,                         /* tp_hash */
+// Notice that tp_hash is intentionally omitted as proxies are "mutable" (when the reference dies).
+    0,                                  /* tp_hash */
     0,                                  /* tp_call */
     proxy_str,                          /* tp_str */
     proxy_getattr,                      /* tp_getattro */
diff --git a/PC/_msi.c b/PC/_msi.c
index 58c1cfd..01516e8 100644
--- a/PC/_msi.c
+++ b/PC/_msi.c
@@ -12,10 +12,26 @@
 #include <msidefs.h>
 #include <rpc.h>
 
+/*[clinic input]
+module _msi
+class _msi.Record "msiobj *" "&record_Type"
+class _msi.SummaryInformation "msiobj *" "&summary_Type"
+class _msi.View "msiobj *" "&msiview_Type"
+class _msi.Database "msiobj *" "&msidb_Type"
+[clinic start generated code]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=89a3605762cf4bdc]*/
+
 static PyObject *MSIError;
 
-static PyObject*
-uuidcreate(PyObject* obj, PyObject*args)
+/*[clinic input]
+_msi.UuidCreate
+
+Return the string representation of a new unique identifier.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_UuidCreate_impl(PyObject *module)
+/*[clinic end generated code: output=534ecf36f10af98e input=168024ab4b3e832b]*/
 {
     UUID result;
     wchar_t *cresult;
@@ -41,21 +57,50 @@
 
 }
 
+/* Helper for converting file names from UTF-8 to wchat_t*.  */
+static wchar_t *
+utf8_to_wchar(const char *s, int *err)
+{
+    PyObject *obj = PyUnicode_FromString(s);
+    if (obj == NULL) {
+        if (PyErr_ExceptionMatches(PyExc_MemoryError)) {
+            *err = ENOMEM;
+        }
+        else {
+            *err = EINVAL;
+        }
+        PyErr_Clear();
+        return NULL;
+    }
+    wchar_t *ws = PyUnicode_AsWideCharString(obj, NULL);
+    if (ws == NULL) {
+        *err = ENOMEM;
+        PyErr_Clear();
+    }
+    Py_DECREF(obj);
+    return ws;
+}
+
 /* FCI callback functions */
 
 static FNFCIALLOC(cb_alloc)
 {
-    return malloc(cb);
+    return PyMem_RawMalloc(cb);
 }
 
 static FNFCIFREE(cb_free)
 {
-    free(memory);
+    PyMem_RawFree(memory);
 }
 
 static FNFCIOPEN(cb_open)
 {
-    int result = _open(pszFile, oflag | O_NOINHERIT, pmode);
+    wchar_t *ws = utf8_to_wchar(pszFile, err);
+    if (ws == NULL) {
+        return -1;
+    }
+    int result = _wopen(ws, oflag | O_NOINHERIT, pmode);
+    PyMem_Free(ws);
     if (result == -1)
         *err = errno;
     return result;
@@ -95,7 +140,12 @@
 
 static FNFCIDELETE(cb_delete)
 {
-    int result = remove(pszFile);
+    wchar_t *ws = utf8_to_wchar(pszFile, err);
+    if (ws == NULL) {
+        return -1;
+    }
+    int result = _wremove(ws);
+    PyMem_Free(ws);
     if (result != 0)
         *err = errno;
     return result;
@@ -143,7 +193,7 @@
         if (!PyBytes_Check(result)) {
             PyErr_Format(PyExc_TypeError,
                 "Incorrect return type %s from getnextcabinet",
-                result->ob_type->tp_name);
+                Py_TYPE(result)->tp_name);
             Py_DECREF(result);
             return FALSE;
         }
@@ -159,15 +209,22 @@
     FILETIME filetime;
     HANDLE handle;
 
-    /* Need Win32 handle to get time stamps */
-    handle = CreateFile(pszName, GENERIC_READ, FILE_SHARE_READ, NULL,
-        OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
-    if (handle == INVALID_HANDLE_VALUE)
+    wchar_t *ws = utf8_to_wchar(pszName, err);
+    if (ws == NULL) {
         return -1;
+    }
 
-    if (GetFileInformationByHandle(handle, &bhfi) == FALSE)
-    {
+    /* Need Win32 handle to get time stamps */
+    handle = CreateFileW(ws, GENERIC_READ, FILE_SHARE_READ, NULL,
+        OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+    if (handle == INVALID_HANDLE_VALUE) {
+        PyMem_Free(ws);
+        return -1;
+    }
+
+    if (GetFileInformationByHandle(handle, &bhfi) == FALSE) {
         CloseHandle(handle);
+        PyMem_Free(ws);
         return -1;
     }
 
@@ -179,22 +236,33 @@
 
     CloseHandle(handle);
 
-    return _open(pszName, _O_RDONLY | _O_BINARY | O_NOINHERIT);
+    int result = _wopen(ws, _O_RDONLY | _O_BINARY | O_NOINHERIT);
+    PyMem_Free(ws);
+    return result;
 }
 
-static PyObject* fcicreate(PyObject* obj, PyObject* args)
+/*[clinic input]
+_msi.FCICreate
+    cabname: str
+        the name of the CAB file
+    files: object
+        a list of tuples, each containing the name of the file on disk,
+        and the name of the file inside the CAB file
+    /
+
+Create a new CAB file.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_FCICreate_impl(PyObject *module, const char *cabname, PyObject *files)
+/*[clinic end generated code: output=55dc05728361b799 input=1d2d75fdc8b44b71]*/
 {
-    char *cabname, *p;
-    PyObject *files;
+    const char *p;
     CCAB ccab;
     HFCI hfci;
     ERF erf;
     Py_ssize_t i;
 
-
-    if (!PyArg_ParseTuple(args, "sO:FCICreate", &cabname, &files))
-        return NULL;
-
     if (!PyList_Check(files)) {
         PyErr_SetString(PyExc_TypeError, "FCICreate expects a list");
         return NULL;
@@ -212,7 +280,7 @@
     ccab.setID = 0;
     ccab.szDisk[0] = '\0';
 
-    for (i = 0, p = cabname; *p; p = CharNext(p))
+    for (i = 0, p = cabname; *p; p++)
         if (*p == '\\' || *p == '/')
             i = p - cabname + 1;
 
@@ -283,7 +351,7 @@
 {
     MsiCloseHandle(msidb->h);
     msidb->h = 0;
-    PyObject_Del(msidb);
+    PyObject_Free(msidb);
 }
 
 static PyObject*
@@ -344,34 +412,56 @@
     return NULL;
 }
 
-static PyObject*
-msidb_close(msiobj* msidb, PyObject *args)
+#include "clinic/_msi.c.h"
+
+/*[clinic input]
+_msi.Database.Close
+
+Close the database object.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_Database_Close_impl(msiobj *self)
+/*[clinic end generated code: output=ddf2d7712ea804f1 input=104330ce4a486187]*/
 {
     int status;
-    if ((status = MsiCloseHandle(msidb->h)) != ERROR_SUCCESS) {
+    if ((status = MsiCloseHandle(self->h)) != ERROR_SUCCESS) {
         return msierror(status);
     }
-    msidb->h = 0;
+    self->h = 0;
     Py_RETURN_NONE;
 }
 
 /*************************** Record objects **********************/
 
-static PyObject*
-record_getfieldcount(msiobj* record, PyObject* args)
+/*[clinic input]
+_msi.Record.GetFieldCount
+
+Return the number of fields of the record.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_Record_GetFieldCount_impl(msiobj *self)
+/*[clinic end generated code: output=112795079c904398 input=5fb9d4071b28897b]*/
 {
-    return PyLong_FromLong(MsiRecordGetFieldCount(record->h));
+    return PyLong_FromLong(MsiRecordGetFieldCount(self->h));
 }
 
-static PyObject*
-record_getinteger(msiobj* record, PyObject* args)
+/*[clinic input]
+_msi.Record.GetInteger
+    field: unsigned_int(bitwise=True)
+    /
+
+Return the value of field as an integer where possible.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_Record_GetInteger_impl(msiobj *self, unsigned int field)
+/*[clinic end generated code: output=7174ebb6e8ed1c79 input=d19209947e2bfe61]*/
 {
-    unsigned int field;
     int status;
 
-    if (!PyArg_ParseTuple(args, "I:GetInteger", &field))
-        return NULL;
-    status = MsiRecordGetInteger(record->h, field);
+    status = MsiRecordGetInteger(self->h, field);
     if (status == MSI_NULL_INTEGER){
         PyErr_SetString(MSIError, "could not convert record field to integer");
         return NULL;
@@ -379,24 +469,30 @@
     return PyLong_FromLong((long) status);
 }
 
-static PyObject*
-record_getstring(msiobj* record, PyObject* args)
+/*[clinic input]
+_msi.Record.GetString
+    field: unsigned_int(bitwise=True)
+    /
+
+Return the value of field as a string where possible.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_Record_GetString_impl(msiobj *self, unsigned int field)
+/*[clinic end generated code: output=f670d1b484cfa47c input=ffa11f21450b77d8]*/
 {
-    unsigned int field;
     unsigned int status;
     WCHAR buf[2000];
     WCHAR *res = buf;
     DWORD size = sizeof(buf);
     PyObject* string;
 
-    if (!PyArg_ParseTuple(args, "I:GetString", &field))
-        return NULL;
-    status = MsiRecordGetStringW(record->h, field, res, &size);
+    status = MsiRecordGetStringW(self->h, field, res, &size);
     if (status == ERROR_MORE_DATA) {
         res = (WCHAR*) malloc((size + 1)*sizeof(WCHAR));
         if (res == NULL)
             return PyErr_NoMemory();
-        status = MsiRecordGetStringW(record->h, field, res, &size);
+        status = MsiRecordGetStringW(self->h, field, res, &size);
     }
     if (status != ERROR_SUCCESS)
         return msierror((int) status);
@@ -406,59 +502,81 @@
     return string;
 }
 
-static PyObject*
-record_cleardata(msiobj* record, PyObject *args)
+/*[clinic input]
+_msi.Record.ClearData
+
+Set all fields of the record to 0.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_Record_ClearData_impl(msiobj *self)
+/*[clinic end generated code: output=1891467214b977f4 input=2a911c95aaded102]*/
 {
-    int status = MsiRecordClearData(record->h);
+    int status = MsiRecordClearData(self->h);
     if (status != ERROR_SUCCESS)
         return msierror(status);
 
     Py_RETURN_NONE;
 }
 
-static PyObject*
-record_setstring(msiobj* record, PyObject *args)
+/*[clinic input]
+_msi.Record.SetString
+    field: int
+    value: Py_UNICODE
+    /
+
+Set field to a string value.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_Record_SetString_impl(msiobj *self, int field, const Py_UNICODE *value)
+/*[clinic end generated code: output=2e37505b0f11f985 input=fb8ec70a2a6148e0]*/
 {
     int status;
-    int field;
-    wchar_t *data;
 
-    if (!PyArg_ParseTuple(args, "iu:SetString", &field, &data))
-        return NULL;
-
-    if ((status = MsiRecordSetStringW(record->h, field, data)) != ERROR_SUCCESS)
+    if ((status = MsiRecordSetStringW(self->h, field, value)) != ERROR_SUCCESS)
         return msierror(status);
 
     Py_RETURN_NONE;
 }
 
-static PyObject*
-record_setstream(msiobj* record, PyObject *args)
+/*[clinic input]
+_msi.Record.SetStream
+    field: int
+    value: Py_UNICODE
+    /
+
+Set field to the contents of the file named value.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_Record_SetStream_impl(msiobj *self, int field, const Py_UNICODE *value)
+/*[clinic end generated code: output=442facac16913b48 input=a07aa19b865e8292]*/
 {
     int status;
-    int field;
-    wchar_t *data;
 
-    if (!PyArg_ParseTuple(args, "iu:SetStream", &field, &data))
-        return NULL;
-
-    if ((status = MsiRecordSetStreamW(record->h, field, data)) != ERROR_SUCCESS)
+    if ((status = MsiRecordSetStreamW(self->h, field, value)) != ERROR_SUCCESS)
         return msierror(status);
 
     Py_RETURN_NONE;
 }
 
-static PyObject*
-record_setinteger(msiobj* record, PyObject *args)
+/*[clinic input]
+_msi.Record.SetInteger
+    field: int
+    value: int
+    /
+
+Set field to an integer value.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_Record_SetInteger_impl(msiobj *self, int field, int value)
+/*[clinic end generated code: output=669e8647775d0ce7 input=c571aa775e7e451b]*/
 {
     int status;
-    int field;
-    int data;
 
-    if (!PyArg_ParseTuple(args, "ii:SetInteger", &field, &data))
-        return NULL;
-
-    if ((status = MsiRecordSetInteger(record->h, field, data)) != ERROR_SUCCESS)
+    if ((status = MsiRecordSetInteger(self->h, field, value)) != ERROR_SUCCESS)
         return msierror(status);
 
     Py_RETURN_NONE;
@@ -467,20 +585,13 @@
 
 
 static PyMethodDef record_methods[] = {
-    { "GetFieldCount", (PyCFunction)record_getfieldcount, METH_NOARGS,
-        PyDoc_STR("GetFieldCount() -> int\nWraps MsiRecordGetFieldCount")},
-    { "GetInteger", (PyCFunction)record_getinteger, METH_VARARGS,
-    PyDoc_STR("GetInteger(field) -> int\nWraps MsiRecordGetInteger")},
-    { "GetString", (PyCFunction)record_getstring, METH_VARARGS,
-    PyDoc_STR("GetString(field) -> string\nWraps MsiRecordGetString")},
-    { "SetString", (PyCFunction)record_setstring, METH_VARARGS,
-        PyDoc_STR("SetString(field,str) -> None\nWraps MsiRecordSetString")},
-    { "SetStream", (PyCFunction)record_setstream, METH_VARARGS,
-        PyDoc_STR("SetStream(field,filename) -> None\nWraps MsiRecordSetInteger")},
-    { "SetInteger", (PyCFunction)record_setinteger, METH_VARARGS,
-        PyDoc_STR("SetInteger(field,int) -> None\nWraps MsiRecordSetInteger")},
-    { "ClearData", (PyCFunction)record_cleardata, METH_NOARGS,
-        PyDoc_STR("ClearData() -> int\nWraps MsiRecordGClearData")},
+    _MSI_RECORD_GETFIELDCOUNT_METHODDEF
+    _MSI_RECORD_GETINTEGER_METHODDEF
+    _MSI_RECORD_GETSTRING_METHODDEF
+    _MSI_RECORD_SETSTRING_METHODDEF
+    _MSI_RECORD_SETSTREAM_METHODDEF
+    _MSI_RECORD_SETINTEGER_METHODDEF
+    _MSI_RECORD_CLEARDATA_METHODDEF
     { NULL, NULL }
 };
 
@@ -544,11 +655,20 @@
 
 /*************************** SummaryInformation objects **************/
 
-static PyObject*
-summary_getproperty(msiobj* si, PyObject *args)
+/*[clinic input]
+_msi.SummaryInformation.GetProperty
+    field: int
+        the name of the property, one of the PID_* constants
+    /
+
+Return a property of the summary.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_SummaryInformation_GetProperty_impl(msiobj *self, int field)
+/*[clinic end generated code: output=f8946a33ee14f6ef input=f8dfe2c890d6cb8b]*/
 {
     int status;
-    int field;
     PyObject *result;
     UINT type;
     INT ival;
@@ -557,10 +677,7 @@
     char *sval = sbuf;
     DWORD ssize = sizeof(sbuf);
 
-    if (!PyArg_ParseTuple(args, "i:GetProperty", &field))
-        return NULL;
-
-    status = MsiSummaryInfoGetProperty(si->h, field, &type, &ival,
+    status = MsiSummaryInfoGetProperty(self->h, field, &type, &ival,
         &fval, sval, &ssize);
     if (status == ERROR_MORE_DATA) {
         ssize++;
@@ -568,7 +685,7 @@
         if (sval == NULL) {
             return PyErr_NoMemory();
         }
-        status = MsiSummaryInfoGetProperty(si->h, field, &type, &ival,
+        status = MsiSummaryInfoGetProperty(self->h, field, &type, &ival,
             &fval, sval, &ssize);
     }
     if (status != ERROR_SUCCESS) {
@@ -601,42 +718,64 @@
     return result;
 }
 
-static PyObject*
-summary_getpropertycount(msiobj* si, PyObject *args)
+/*[clinic input]
+_msi.SummaryInformation.GetPropertyCount
+
+Return the number of summary properties.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_SummaryInformation_GetPropertyCount_impl(msiobj *self)
+/*[clinic end generated code: output=68e94b2aeee92b3d input=2e71e985586d82dc]*/
 {
     int status;
     UINT result;
 
-    status = MsiSummaryInfoGetPropertyCount(si->h, &result);
+    status = MsiSummaryInfoGetPropertyCount(self->h, &result);
     if (status != ERROR_SUCCESS)
         return msierror(status);
 
     return PyLong_FromLong(result);
 }
 
-static PyObject*
-summary_setproperty(msiobj* si, PyObject *args)
+/*[clinic input]
+_msi.SummaryInformation.SetProperty
+    field: int
+        the name of the property, one of the PID_* constants
+    value as data: object
+        the new value of the property (integer or string)
+    /
+
+Set a property.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_SummaryInformation_SetProperty_impl(msiobj *self, int field,
+                                         PyObject *data)
+/*[clinic end generated code: output=3d4692c8984bb675 input=f2a7811b905abbed]*/
 {
     int status;
-    int field;
-    PyObject* data;
-
-    if (!PyArg_ParseTuple(args, "iO:SetProperty", &field, &data))
-        return NULL;
 
     if (PyUnicode_Check(data)) {
+#if USE_UNICODE_WCHAR_CACHE
         const WCHAR *value = _PyUnicode_AsUnicode(data);
+#else /* USE_UNICODE_WCHAR_CACHE */
+        WCHAR *value = PyUnicode_AsWideCharString(data, NULL);
+#endif /* USE_UNICODE_WCHAR_CACHE */
         if (value == NULL) {
             return NULL;
         }
-        status = MsiSummaryInfoSetPropertyW(si->h, field, VT_LPSTR,
+        status = MsiSummaryInfoSetPropertyW(self->h, field, VT_LPSTR,
             0, NULL, value);
+#if !USE_UNICODE_WCHAR_CACHE
+        PyMem_Free(value);
+#endif /* USE_UNICODE_WCHAR_CACHE */
     } else if (PyLong_CheckExact(data)) {
         long value = PyLong_AsLong(data);
         if (value == -1 && PyErr_Occurred()) {
             return NULL;
         }
-        status = MsiSummaryInfoSetProperty(si->h, field, VT_I4,
+        status = MsiSummaryInfoSetProperty(self->h, field, VT_I4,
             value, NULL, NULL);
     } else {
         PyErr_SetString(PyExc_TypeError, "unsupported type");
@@ -650,26 +789,29 @@
 }
 
 
-static PyObject*
-summary_persist(msiobj* si, PyObject *args)
+/*[clinic input]
+_msi.SummaryInformation.Persist
+
+Write the modified properties to the summary information stream.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_SummaryInformation_Persist_impl(msiobj *self)
+/*[clinic end generated code: output=c564bd17f5e122c9 input=e3dda9d530095ef7]*/
 {
     int status;
 
-    status = MsiSummaryInfoPersist(si->h);
+    status = MsiSummaryInfoPersist(self->h);
     if (status != ERROR_SUCCESS)
         return msierror(status);
     Py_RETURN_NONE;
 }
 
 static PyMethodDef summary_methods[] = {
-    { "GetProperty", (PyCFunction)summary_getproperty, METH_VARARGS,
-        PyDoc_STR("GetProperty(propid) -> value\nWraps MsiSummaryInfoGetProperty")},
-    { "GetPropertyCount", (PyCFunction)summary_getpropertycount, METH_NOARGS,
-        PyDoc_STR("GetProperty() -> int\nWraps MsiSummaryInfoGetPropertyCount")},
-    { "SetProperty", (PyCFunction)summary_setproperty, METH_VARARGS,
-        PyDoc_STR("SetProperty(value) -> None\nWraps MsiSummaryInfoProperty")},
-    { "Persist", (PyCFunction)summary_persist, METH_NOARGS,
-        PyDoc_STR("Persist() -> None\nWraps MsiSummaryInfoPersist")},
+    _MSI_SUMMARYINFORMATION_GETPROPERTY_METHODDEF
+    _MSI_SUMMARYINFORMATION_GETPROPERTYCOUNT_METHODDEF
+    _MSI_SUMMARYINFORMATION_SETPROPERTY_METHODDEF
+    _MSI_SUMMARYINFORMATION_PERSIST_METHODDEF
     { NULL, NULL }
 };
 
@@ -719,38 +861,52 @@
 
 /*************************** View objects **************/
 
-static PyObject*
-view_execute(msiobj *view, PyObject*args)
+/*[clinic input]
+_msi.View.Execute
+    params as oparams: object
+        a record describing actual values of the parameter tokens
+        in the query or None
+    /
+
+Execute the SQL query of the view.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_View_Execute(msiobj *self, PyObject *oparams)
+/*[clinic end generated code: output=f0f65fd2900bcb4e input=cb163a15d453348e]*/
 {
     int status;
     MSIHANDLE params = 0;
-    PyObject *oparams = Py_None;
-
-    if (!PyArg_ParseTuple(args, "O:Execute", &oparams))
-        return NULL;
 
     if (oparams != Py_None) {
-        if (oparams->ob_type != &record_Type) {
+        if (!Py_IS_TYPE(oparams, &record_Type)) {
             PyErr_SetString(PyExc_TypeError, "Execute argument must be a record");
             return NULL;
         }
         params = ((msiobj*)oparams)->h;
     }
 
-    status = MsiViewExecute(view->h, params);
+    status = MsiViewExecute(self->h, params);
     if (status != ERROR_SUCCESS)
         return msierror(status);
 
     Py_RETURN_NONE;
 }
 
-static PyObject*
-view_fetch(msiobj *view, PyObject*args)
+/*[clinic input]
+_msi.View.Fetch
+
+Return a result record of the query.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_View_Fetch_impl(msiobj *self)
+/*[clinic end generated code: output=ba154a3794537d4e input=7f3e3d06c449001c]*/
 {
     int status;
     MSIHANDLE result;
 
-    status = MsiViewFetch(view->h, &result);
+    status = MsiViewFetch(self->h, &result);
     if (status == ERROR_NO_MORE_ITEMS) {
         Py_RETURN_NONE;
     } else if (status != ERROR_SUCCESS) {
@@ -760,65 +916,80 @@
     return record_new(result);
 }
 
-static PyObject*
-view_getcolumninfo(msiobj *view, PyObject *args)
+/*[clinic input]
+_msi.View.GetColumnInfo
+    kind: int
+        MSICOLINFO_NAMES or MSICOLINFO_TYPES
+    /
+
+Return a record describing the columns of the view.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_View_GetColumnInfo_impl(msiobj *self, int kind)
+/*[clinic end generated code: output=e7c1697db9403660 input=afedb892bf564a3b]*/
 {
     int status;
-    int kind;
     MSIHANDLE result;
 
-    if (!PyArg_ParseTuple(args, "i:GetColumnInfo", &kind))
-        return NULL;
-
-    if ((status = MsiViewGetColumnInfo(view->h, kind, &result)) != ERROR_SUCCESS)
+    if ((status = MsiViewGetColumnInfo(self->h, kind, &result)) != ERROR_SUCCESS)
         return msierror(status);
 
     return record_new(result);
 }
 
-static PyObject*
-view_modify(msiobj *view, PyObject *args)
+/*[clinic input]
+_msi.View.Modify
+    kind: int
+        one of the MSIMODIFY_* constants
+    data: object
+        a record describing the new data
+    /
+
+Modify the view.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_View_Modify_impl(msiobj *self, int kind, PyObject *data)
+/*[clinic end generated code: output=69aaf3ce8ddac0ba input=2828de22de0d47b4]*/
 {
-    int kind;
-    PyObject *data;
     int status;
 
-    if (!PyArg_ParseTuple(args, "iO:Modify", &kind, &data))
-        return NULL;
-
-    if (data->ob_type != &record_Type) {
+    if (!Py_IS_TYPE(data, &record_Type)) {
         PyErr_SetString(PyExc_TypeError, "Modify expects a record object");
         return NULL;
     }
 
-    if ((status = MsiViewModify(view->h, kind, ((msiobj*)data)->h)) != ERROR_SUCCESS)
+    if ((status = MsiViewModify(self->h, kind, ((msiobj*)data)->h)) != ERROR_SUCCESS)
         return msierror(status);
 
     Py_RETURN_NONE;
 }
 
-static PyObject*
-view_close(msiobj *view, PyObject*args)
+/*[clinic input]
+_msi.View.Close
+
+Close the view.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_View_Close_impl(msiobj *self)
+/*[clinic end generated code: output=488f7b8645ca104a input=de6927d1308c401c]*/
 {
     int status;
 
-    if ((status = MsiViewClose(view->h)) != ERROR_SUCCESS)
+    if ((status = MsiViewClose(self->h)) != ERROR_SUCCESS)
         return msierror(status);
 
     Py_RETURN_NONE;
 }
 
 static PyMethodDef view_methods[] = {
-    { "Execute", (PyCFunction)view_execute, METH_VARARGS,
-        PyDoc_STR("Execute(params=None) -> None\nWraps MsiViewExecute")},
-    { "GetColumnInfo", (PyCFunction)view_getcolumninfo, METH_VARARGS,
-        PyDoc_STR("GetColumnInfo() -> result\nWraps MsiGetColumnInfo")},
-    { "Fetch", (PyCFunction)view_fetch, METH_NOARGS,
-        PyDoc_STR("Fetch() -> result\nWraps MsiViewFetch")},
-    { "Modify", (PyCFunction)view_modify, METH_VARARGS,
-        PyDoc_STR("Modify(mode,record) -> None\nWraps MsiViewModify")},
-    { "Close", (PyCFunction)view_close, METH_NOARGS,
-        PyDoc_STR("Close() -> result\nWraps MsiViewClose")},
+    _MSI_VIEW_EXECUTE_METHODDEF
+    _MSI_VIEW_GETCOLUMNINFO_METHODDEF
+    _MSI_VIEW_FETCH_METHODDEF
+    _MSI_VIEW_MODIFY_METHODDEF
+    _MSI_VIEW_CLOSE_METHODDEF
     { NULL, NULL }
 };
 
@@ -868,18 +1039,24 @@
 
 /*************************** Database objects **************/
 
-static PyObject*
-msidb_openview(msiobj *msidb, PyObject *args)
+/*[clinic input]
+_msi.Database.OpenView
+    sql: Py_UNICODE
+        the SQL statement to execute
+    /
+
+Return a view object.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_Database_OpenView_impl(msiobj *self, const Py_UNICODE *sql)
+/*[clinic end generated code: output=e712e6a11229abfd input=50f1771f37e500df]*/
 {
     int status;
-    const wchar_t *sql;
     MSIHANDLE hView;
     msiobj *result;
 
-    if (!PyArg_ParseTuple(args, "u:OpenView", &sql))
-        return NULL;
-
-    if ((status = MsiDatabaseOpenViewW(msidb->h, sql, &hView)) != ERROR_SUCCESS)
+    if ((status = MsiDatabaseOpenViewW(self->h, sql, &hView)) != ERROR_SUCCESS)
         return msierror(status);
 
     result = PyObject_New(struct msiobj, &msiview_Type);
@@ -892,29 +1069,42 @@
     return (PyObject*)result;
 }
 
-static PyObject*
-msidb_commit(msiobj *msidb, PyObject *args)
+/*[clinic input]
+_msi.Database.Commit
+
+Commit the changes pending in the current transaction.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_Database_Commit_impl(msiobj *self)
+/*[clinic end generated code: output=f33021feb8b0cdd8 input=375bb120d402266d]*/
 {
     int status;
 
-    if ((status = MsiDatabaseCommit(msidb->h)) != ERROR_SUCCESS)
+    if ((status = MsiDatabaseCommit(self->h)) != ERROR_SUCCESS)
         return msierror(status);
 
     Py_RETURN_NONE;
 }
 
-static PyObject*
-msidb_getsummaryinformation(msiobj *db, PyObject *args)
+/*[clinic input]
+_msi.Database.GetSummaryInformation
+    count: int
+        the maximum number of updated values
+    /
+
+Return a new summary information object.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_Database_GetSummaryInformation_impl(msiobj *self, int count)
+/*[clinic end generated code: output=781e51a4ea4da847 input=18a899ead6521735]*/
 {
     int status;
-    int count;
     MSIHANDLE result;
     msiobj *oresult;
 
-    if (!PyArg_ParseTuple(args, "i:GetSummaryInformation", &count))
-        return NULL;
-
-    status = MsiGetSummaryInformation(db->h, NULL, count, &result);
+    status = MsiGetSummaryInformation(self->h, NULL, count, &result);
     if (status != ERROR_SUCCESS)
         return msierror(status);
 
@@ -929,14 +1119,10 @@
 }
 
 static PyMethodDef db_methods[] = {
-    { "OpenView", (PyCFunction)msidb_openview, METH_VARARGS,
-        PyDoc_STR("OpenView(sql) -> viewobj\nWraps MsiDatabaseOpenView")},
-    { "Commit", (PyCFunction)msidb_commit, METH_NOARGS,
-        PyDoc_STR("Commit() -> None\nWraps MsiDatabaseCommit")},
-    { "GetSummaryInformation", (PyCFunction)msidb_getsummaryinformation, METH_VARARGS,
-        PyDoc_STR("GetSummaryInformation(updateCount) -> viewobj\nWraps MsiGetSummaryInformation")},
-    { "Close", (PyCFunction)msidb_close, METH_NOARGS,
-        PyDoc_STR("Close() -> None\nWraps MsiCloseHandle")},
+    _MSI_DATABASE_OPENVIEW_METHODDEF
+    _MSI_DATABASE_COMMIT_METHODDEF
+    _MSI_DATABASE_GETSUMMARYINFORMATION_METHODDEF
+    _MSI_DATABASE_CLOSE_METHODDEF
     { NULL, NULL }
 };
 
@@ -995,15 +1181,25 @@
     Py_NOT_PERSIST(x, MSIDBOPEN_CREATE) &&     \
     Py_NOT_PERSIST(x, MSIDBOPEN_CREATEDIRECT))
 
-static PyObject* msiopendb(PyObject *obj, PyObject *args)
+/*[clinic input]
+_msi.OpenDatabase
+    path: Py_UNICODE
+        the file name of the MSI file
+    persist: int
+        the persistence mode
+    /
+
+Return a new database object.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_OpenDatabase_impl(PyObject *module, const Py_UNICODE *path, int persist)
+/*[clinic end generated code: output=d34b7202b745de05 input=1300f3b97659559b]*/
 {
     int status;
-    const wchar_t *path;
-    int persist;
     MSIHANDLE h;
     msiobj *result;
-    if (!PyArg_ParseTuple(args, "ui:MSIOpenDatabase", &path, &persist))
-        return NULL;
+
     /* We need to validate that persist is a valid MSIDBOPEN_* value. Otherwise,
        MsiOpenDatabase may treat the value as a pointer, leading to unexpected
        behavior. */
@@ -1022,14 +1218,20 @@
     return (PyObject*)result;
 }
 
-static PyObject*
-createrecord(PyObject *o, PyObject *args)
-{
-    int count;
-    MSIHANDLE h;
+/*[clinic input]
+_msi.CreateRecord
+    count: int
+        the number of fields of the record
+    /
 
-    if (!PyArg_ParseTuple(args, "i:CreateRecord", &count))
-        return NULL;
+Return a new record object.
+[clinic start generated code]*/
+
+static PyObject *
+_msi_CreateRecord_impl(PyObject *module, int count)
+/*[clinic end generated code: output=0ba0a00beea3e99e input=53f17d5b5d9b077d]*/
+{
+    MSIHANDLE h;
 
     h = MsiCreateRecord(count);
     if (h == 0)
@@ -1040,14 +1242,10 @@
 
 
 static PyMethodDef msi_methods[] = {
-        {"UuidCreate", (PyCFunction)uuidcreate, METH_NOARGS,
-                PyDoc_STR("UuidCreate() -> string")},
-        {"FCICreate",   (PyCFunction)fcicreate, METH_VARARGS,
-                PyDoc_STR("fcicreate(cabname,files) -> None")},
-        {"OpenDatabase", (PyCFunction)msiopendb, METH_VARARGS,
-        PyDoc_STR("OpenDatabase(name, flags) -> dbobj\nWraps MsiOpenDatabase")},
-        {"CreateRecord", (PyCFunction)createrecord, METH_VARARGS,
-        PyDoc_STR("OpenDatabase(name, flags) -> dbobj\nWraps MsiCreateRecord")},
+        _MSI_UUIDCREATE_METHODDEF
+        _MSI_FCICREATE_METHODDEF
+        _MSI_OPENDATABASE_METHODDEF
+        _MSI_CREATERECORD_METHODDEF
         {NULL,          NULL}           /* sentinel */
 };
 
diff --git a/PC/_testconsole.c b/PC/_testconsole.c
index b62f21c..db84f73 100644
--- a/PC/_testconsole.c
+++ b/PC/_testconsole.c
@@ -13,10 +13,10 @@
 #include <fcntl.h>
 
  /* The full definition is in iomodule. We reproduce
- enough here to get the handle, which is all we want. */
+ enough here to get the fd, which is all we want. */
 typedef struct {
     PyObject_HEAD
-    HANDLE handle;
+    int fd;
 } winconsoleio;
 
 
@@ -67,7 +67,10 @@
         prec->Event.KeyEvent.uChar.UnicodeChar = *p;
     }
 
-    HANDLE hInput = ((winconsoleio*)file)->handle;
+    HANDLE hInput = _Py_get_osfhandle(((winconsoleio*)file)->fd);
+    if (hInput == INVALID_HANDLE_VALUE)
+        goto error;
+
     DWORD total = 0;
     while (total < size) {
         DWORD wrote;
diff --git a/PC/bdist_wininst/PythonPowered.bmp b/PC/bdist_wininst/PythonPowered.bmp
deleted file mode 100644
index dd70709..0000000
--- a/PC/bdist_wininst/PythonPowered.bmp
+++ /dev/null
Binary files differ
diff --git a/PC/bdist_wininst/README.txt b/PC/bdist_wininst/README.txt
deleted file mode 100644
index 7c29be7..0000000
--- a/PC/bdist_wininst/README.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-
-XXX Write description
-XXX Dont't forget to mention upx
-
-XXX Add pointer to this file into PC/README.txt
diff --git a/PC/bdist_wininst/archive.h b/PC/bdist_wininst/archive.h
deleted file mode 100644
index 50ff15c..0000000
--- a/PC/bdist_wininst/archive.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
-  IMPORTANT NOTE: IF THIS FILE IS CHANGED, PCBUILD\BDIST_WININST.VCXPROJ MUST
-  BE REBUILT AS WELL.
-
-  IF CHANGES TO THIS FILE ARE CHECKED IN, THE RECOMPILED BINARIES MUST BE
-  CHECKED IN AS WELL!
-*/
-
-#pragma pack(1)
-
-/* zip-archive headers
- * See: http://www.pkware.com/appnote.html
- */
-
-struct eof_cdir {
-    long tag;           /* must be 0x06054b50 */
-    short disknum;
-    short firstdisk;
-    short nTotalCDirThis;
-    short nTotalCDir;
-    long nBytesCDir;
-    long ofsCDir;
-    short commentlen;
-};
-
-struct cdir {
-    long tag;           /* must be 0x02014b50 */
-    short version_made;
-    short version_extract;
-    short gp_bitflag;
-    short comp_method;
-    short last_mod_file_time;
-    short last_mod_file_date;
-    long crc32;
-    long comp_size;
-    long uncomp_size;
-    short fname_length;
-    short extra_length;
-    short comment_length;
-    short disknum_start;
-    short int_file_attr;
-    long ext_file_attr;
-    long ofs_local_header;
-};
-
-struct fhdr {
-    long tag;           /* must be 0x04034b50 */
-    short version_needed;
-    short flags;
-    short method;
-    short last_mod_file_time;
-    short last_mod_file_date;
-    long crc32;
-    long comp_size;
-    long uncomp_size;
-    short fname_length;
-    short extra_length;
-};
-
-
-struct meta_data_hdr {
-    int tag;
-    int uncomp_size;
-    int bitmap_size;
-};
-
-#pragma pack()
-
-/* installation scheme */
-
-typedef struct tagSCHEME {
-    char *name;
-    char *prefix;
-} SCHEME;
-
-typedef int (*NOTIFYPROC)(int code, LPSTR text, ...);
-
-extern BOOL
-extract_file(char *dst, char *src, int method, int comp_size,
-             int uncomp_size, NOTIFYPROC notify);
-
-extern BOOL
-unzip_archive(SCHEME *scheme, char *dirname, char *data,
-              DWORD size,  NOTIFYPROC notify);
-
-extern char *
-map_new_file(DWORD flags, char *filename, char
-             *pathname_part, int size,
-             WORD wFatDate, WORD wFatTime,
-             NOTIFYPROC callback);
-
-extern BOOL
-ensure_directory (char *pathname, char *new_part,
-                  NOTIFYPROC callback);
-
-/* codes for NOITIFYPROC */
-#define DIR_CREATED 1
-#define CAN_OVERWRITE 2
-#define FILE_CREATED 3
-#define ZLIB_ERROR 4
-#define SYSTEM_ERROR 5
-#define NUM_FILES 6
-#define FILE_OVERWRITTEN 7
-
diff --git a/PC/bdist_wininst/bdist_wininst.vcxproj b/PC/bdist_wininst/bdist_wininst.vcxproj
deleted file mode 100644
index 390bf4e..0000000
--- a/PC/bdist_wininst/bdist_wininst.vcxproj
+++ /dev/null
@@ -1,125 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="Debug|ARM">
-      <Configuration>Debug</Configuration>
-      <Platform>ARM</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|Win32">
-      <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|x64">
-      <Configuration>Debug</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="PGInstrument|ARM">
-      <Configuration>PGInstrument</Configuration>
-      <Platform>ARM</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="PGInstrument|Win32">
-      <Configuration>PGInstrument</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="PGInstrument|x64">
-      <Configuration>PGInstrument</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="PGUpdate|ARM">
-      <Configuration>PGUpdate</Configuration>
-      <Platform>ARM</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="PGUpdate|Win32">
-      <Configuration>PGUpdate</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="PGUpdate|x64">
-      <Configuration>PGUpdate</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|ARM">
-      <Configuration>Release</Configuration>
-      <Platform>ARM</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
-      <Configuration>Release</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|x64">
-      <Configuration>Release</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-  </ItemGroup>
-  <PropertyGroup Label="Globals">
-    <ProjectGuid>{EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}</ProjectGuid>
-    <RootNamespace>wininst</RootNamespace>
-    <SupportPGO>false</SupportPGO>
-  </PropertyGroup>
-  <Import Project="..\..\PCbuild\python.props" />
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
-  <PropertyGroup Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseOfMfc>false</UseOfMfc>
-    <CharacterSet>NotSet</CharacterSet>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
-  <ImportGroup Label="ExtensionSettings">
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-    <Import Project="..\..\PCbuild\pyproject.props" />
-  </ImportGroup>
-  <PropertyGroup>
-    <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
-    <OutDir>$(PySourcePath)lib\distutils\command\</OutDir>
-    <LinkIncremental>false</LinkIncremental>
-    <TargetName>wininst-$(VisualStudioVersion)</TargetName>
-    <TargetName Condition="$(PlatformToolset) == 'v140'">wininst-14.0</TargetName>
-    <TargetName Condition="$(PlatformToolset) == 'v120'">wininst-12.0</TargetName>
-    <TargetName Condition="$(PlatformToolset) == 'v110'">wininst-11.0</TargetName>
-    <TargetName Condition="$(PlatformToolset) == 'v100'">wininst-10.0</TargetName>
-    <TargetName Condition="$(Platform) == 'x64'">$(TargetName)-amd64</TargetName>
-    <TargetExt>.exe</TargetExt>
-  </PropertyGroup>
-  <ItemDefinitionGroup>
-    <Midl>
-      <TypeLibraryName>$(OutDir)wininst.tlb</TypeLibraryName>
-    </Midl>
-    <ClCompile>
-      <Optimization>MinSpace</Optimization>
-      <AdditionalIncludeDirectories>$(zlibDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary Condition="'$(Configuration)'=='Debug'">MultiThreadedDebug</RuntimeLibrary>
-      <RuntimeLibrary Condition="'$(Configuration)'=='Release'">MultiThreaded</RuntimeLibrary>
-    </ClCompile>
-    <ResourceCompile>
-      <AdditionalIncludeDirectories>$(PySourcePath)PC\bdist_wininst;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ResourceCompile>
-    <Link>
-      <AdditionalDependencies>comctl32.lib;imagehlp.lib;%(AdditionalDependencies)</AdditionalDependencies>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemGroup>
-    <ClCompile Include="extract.c" />
-    <ClCompile Include="install.c" />
-    <ClCompile Include="$(zlibDir)\adler32.c" />
-    <ClCompile Include="$(zlibDir)\crc32.c" />
-    <ClCompile Include="$(zlibDir)\inffast.c" />
-    <ClCompile Include="$(zlibDir)\inflate.c" />
-    <ClCompile Include="$(zlibDir)\inftrees.c" />
-    <ClCompile Include="$(zlibDir)\zutil.c" />
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="archive.h" />
-    <ClInclude Include="$(zlibDir)\zlib.h" />
-  </ItemGroup>
-  <ItemGroup>
-    <ResourceCompile Include="install.rc" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="PythonPowered.bmp" />
-  </ItemGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-  <ImportGroup Label="ExtensionTargets">
-  </ImportGroup>
-</Project>
\ No newline at end of file
diff --git a/PC/bdist_wininst/bdist_wininst.vcxproj.filters b/PC/bdist_wininst/bdist_wininst.vcxproj.filters
deleted file mode 100644
index c97742e..0000000
--- a/PC/bdist_wininst/bdist_wininst.vcxproj.filters
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup>
-    <Filter Include="Source Files">
-      <UniqueIdentifier>{293b1092-03ad-4b7c-acb9-c4ab62e52f55}</UniqueIdentifier>
-      <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
-    </Filter>
-    <Filter Include="Source Files\zlib">
-      <UniqueIdentifier>{0edc0406-282f-4dbc-b60e-a867c34a2a31}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="Header Files">
-      <UniqueIdentifier>{ea0c0f0e-3b73-474e-a999-e9689d032ccc}</UniqueIdentifier>
-      <Extensions>h;hpp;hxx;hm;inl</Extensions>
-    </Filter>
-    <Filter Include="Resource Files">
-      <UniqueIdentifier>{0c77c1cf-3f87-4f87-bd86-b425211c2181}</UniqueIdentifier>
-      <Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
-    </Filter>
-    <Filter Include="Header Files\zlib">
-      <UniqueIdentifier>{d10220c7-69e3-47c5-8d82-c8e0d4d2ac88}</UniqueIdentifier>
-    </Filter>
-  </ItemGroup>
-  <ItemGroup>
-    <ClCompile Include="extract.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="install.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="$(zlibDir)\adler32.c">
-      <Filter>Source Files\zlib</Filter>
-    </ClCompile>
-    <ClCompile Include="$(zlibDir)\crc32.c">
-      <Filter>Source Files\zlib</Filter>
-    </ClCompile>
-    <ClCompile Include="$(zlibDir)\inffast.c">
-      <Filter>Source Files\zlib</Filter>
-    </ClCompile>
-    <ClCompile Include="$(zlibDir)\inflate.c">
-      <Filter>Source Files\zlib</Filter>
-    </ClCompile>
-    <ClCompile Include="$(zlibDir)\inftrees.c">
-      <Filter>Source Files\zlib</Filter>
-    </ClCompile>
-    <ClCompile Include="$(zlibDir)\zutil.c">
-      <Filter>Source Files\zlib</Filter>
-    </ClCompile>
-  </ItemGroup>
-  <ItemGroup>
-    <ResourceCompile Include="install.rc">
-      <Filter>Resource Files</Filter>
-    </ResourceCompile>
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="archive.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="$(zlibDir)\zlib.h">
-      <Filter>Header Files\zlib</Filter>
-    </ClInclude>
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="PythonPowered.bmp">
-      <Filter>Resource Files</Filter>
-    </None>
-  </ItemGroup>
-</Project>
\ No newline at end of file
diff --git a/PC/bdist_wininst/build.bat b/PC/bdist_wininst/build.bat
deleted file mode 100644
index 3ce46cf..0000000
--- a/PC/bdist_wininst/build.bat
+++ /dev/null
@@ -1,19 +0,0 @@
-@echo off
-setlocal
-
-set D=%~dp0
-set PCBUILD=%~dp0..\..\PCbuild\
-
-
-echo Building Lib\distutils\command\wininst-xx.0.exe
-
-call "%PCBUILD%find_msbuild.bat" %MSBUILD%
-if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2)
-
-%MSBUILD% "%D%bdist_wininst.vcxproj" "/p:SolutionDir=%PCBUILD%\" /p:Configuration=Release /p:Platform=Win32
-if errorlevel 1 goto :eof
-
-
-echo Building Lib\distutils\command\wininst-xx.0-amd64.exe
-
-%MSBUILD% "%D%bdist_wininst.vcxproj" "/p:SolutionDir=%PCBUILD%\" /p:Configuration=Release /p:Platform=x64
diff --git a/PC/bdist_wininst/extract.c b/PC/bdist_wininst/extract.c
deleted file mode 100644
index 0249d9f..0000000
--- a/PC/bdist_wininst/extract.c
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
-  IMPORTANT NOTE: IF THIS FILE IS CHANGED, PCBUILD\BDIST_WININST.VCXPROJ MUST
-  BE REBUILT AS WELL.
-
-  IF CHANGES TO THIS FILE ARE CHECKED IN, THE RECOMPILED BINARIES MUST BE
-  CHECKED IN AS WELL!
-*/
-
-#include <windows.h>
-
-#include "zlib.h"
-
-#include <stdio.h>
-#include <stdarg.h>
-
-#include "archive.h"
-
-/* Convert unix-path to dos-path */
-static void normpath(char *path)
-{
-    while (path && *path) {
-        if (*path == '/')
-            *path = '\\';
-        ++path;
-    }
-}
-
-BOOL ensure_directory(char *pathname, char *new_part, NOTIFYPROC notify)
-{
-    while (new_part && *new_part && (new_part = strchr(new_part, '\\'))) {
-        DWORD attr;
-        *new_part = '\0';
-        attr = GetFileAttributes(pathname);
-        if (attr == -1) {
-            /* nothing found */
-            if (!CreateDirectory(pathname, NULL) && notify)
-                notify(SYSTEM_ERROR,
-                       "CreateDirectory (%s)", pathname);
-            else
-                notify(DIR_CREATED, pathname);
-        }
-        if (attr & FILE_ATTRIBUTE_DIRECTORY) {
-            ;
-        } else {
-            SetLastError(183);
-            if (notify)
-                notify(SYSTEM_ERROR,
-                       "CreateDirectory (%s)", pathname);
-        }
-        *new_part = '\\';
-        ++new_part;
-    }
-    return TRUE;
-}
-
-/* XXX Should better explicitly specify
- * uncomp_size and file_times instead of pfhdr!
- */
-char *map_new_file(DWORD flags, char *filename,
-                   char *pathname_part, int size,
-                   WORD wFatDate, WORD wFatTime,
-                   NOTIFYPROC notify)
-{
-    HANDLE hFile, hFileMapping;
-    char *dst;
-    FILETIME ft;
-
-  try_again:
-    if (!flags)
-        flags = CREATE_NEW;
-    hFile = CreateFile(filename,
-                       GENERIC_WRITE | GENERIC_READ,
-                       0, NULL,
-                       flags,
-                       FILE_ATTRIBUTE_NORMAL, NULL);
-    if (hFile == INVALID_HANDLE_VALUE) {
-        DWORD x = GetLastError();
-        switch (x) {
-        case ERROR_FILE_EXISTS:
-            if (notify && notify(CAN_OVERWRITE, filename))
-                hFile = CreateFile(filename,
-                                   GENERIC_WRITE|GENERIC_READ,
-                                   0, NULL,
-                                   CREATE_ALWAYS,
-                                   FILE_ATTRIBUTE_NORMAL,
-                                   NULL);
-            else {
-                if (notify)
-                    notify(FILE_OVERWRITTEN, filename);
-                return NULL;
-            }
-            break;
-        case ERROR_PATH_NOT_FOUND:
-            if (ensure_directory(filename, pathname_part, notify))
-                goto try_again;
-            else
-                return FALSE;
-            break;
-        default:
-            SetLastError(x);
-            break;
-        }
-    }
-    if (hFile == INVALID_HANDLE_VALUE) {
-        if (notify)
-            notify (SYSTEM_ERROR, "CreateFile (%s)", filename);
-        return NULL;
-    }
-
-    if (notify)
-        notify(FILE_CREATED, filename);
-
-    DosDateTimeToFileTime(wFatDate, wFatTime, &ft);
-    SetFileTime(hFile, &ft, &ft, &ft);
-
-
-    if (size == 0) {
-        /* We cannot map a zero-length file (Also it makes
-           no sense */
-        CloseHandle(hFile);
-        return NULL;
-    }
-
-    hFileMapping = CreateFileMapping(hFile,
-                                     NULL, PAGE_READWRITE, 0, size, NULL);
-
-    CloseHandle(hFile);
-
-    if (hFileMapping == NULL) {
-        if (notify)
-            notify(SYSTEM_ERROR,
-                   "CreateFileMapping (%s)", filename);
-        return NULL;
-    }
-
-    dst = MapViewOfFile(hFileMapping,
-                        FILE_MAP_WRITE, 0, 0, 0);
-
-    CloseHandle(hFileMapping);
-
-    if (!dst) {
-        if (notify)
-            notify(SYSTEM_ERROR, "MapViewOfFile (%s)", filename);
-        return NULL;
-    }
-    return dst;
-}
-
-
-BOOL
-extract_file(char *dst, char *src, int method, int comp_size,
-             int uncomp_size, NOTIFYPROC notify)
-{
-    z_stream zstream;
-    int result;
-
-    if (method == Z_DEFLATED) {
-        int x;
-        memset(&zstream, 0, sizeof(zstream));
-        zstream.next_in = src;
-        zstream.avail_in = comp_size+1;
-        zstream.next_out = dst;
-        zstream.avail_out = uncomp_size;
-
-/* Apparently an undocumented feature of zlib: Set windowsize
-   to negative values to suppress the gzip header and be compatible with
-   zip! */
-        result = TRUE;
-        if (Z_OK != (x = inflateInit2(&zstream, -15))) {
-            if (notify)
-                notify(ZLIB_ERROR,
-                       "inflateInit2 returns %d", x);
-            result = FALSE;
-            goto cleanup;
-        }
-        if (Z_STREAM_END != (x = inflate(&zstream, Z_FINISH))) {
-            if (notify)
-                notify(ZLIB_ERROR,
-                       "inflate returns %d", x);
-            result = FALSE;
-        }
-      cleanup:
-        if (Z_OK != (x = inflateEnd(&zstream))) {
-            if (notify)
-                notify (ZLIB_ERROR,
-                    "inflateEnd returns %d", x);
-            result = FALSE;
-        }
-    } else if (method == 0) {
-        memcpy(dst, src, uncomp_size);
-        result = TRUE;
-    } else
-        result = FALSE;
-    UnmapViewOfFile(dst);
-    return result;
-}
-
-/* Open a zip-compatible archive and extract all files
- * into the specified directory (which is assumed to exist)
- */
-BOOL
-unzip_archive(SCHEME *scheme, char *dirname, char *data, DWORD size,
-              NOTIFYPROC notify)
-{
-    int n;
-    char pathname[MAX_PATH];
-    char *new_part;
-
-    /* read the end of central directory record */
-    struct eof_cdir *pe = (struct eof_cdir *)&data[size - sizeof
-                                                   (struct eof_cdir)];
-
-    int arc_start = size - sizeof (struct eof_cdir) - pe->nBytesCDir -
-        pe->ofsCDir;
-
-    /* set position to start of central directory */
-    int pos = arc_start + pe->ofsCDir;
-
-    /* make sure this is a zip file */
-    if (pe->tag != 0x06054b50)
-        return FALSE;
-
-    /* Loop through the central directory, reading all entries */
-    for (n = 0; n < pe->nTotalCDir; ++n) {
-        int i;
-        char *fname;
-        char *pcomp;
-        char *dst;
-        struct cdir *pcdir;
-        struct fhdr *pfhdr;
-
-        pcdir = (struct cdir *)&data[pos];
-        pfhdr = (struct fhdr *)&data[pcdir->ofs_local_header +
-                                     arc_start];
-
-        if (pcdir->tag != 0x02014b50)
-            return FALSE;
-        if (pfhdr->tag != 0x04034b50)
-            return FALSE;
-        pos += sizeof(struct cdir);
-        fname = (char *)&data[pos]; /* This is not null terminated! */
-        pos += pcdir->fname_length + pcdir->extra_length +
-            pcdir->comment_length;
-
-        pcomp = &data[pcdir->ofs_local_header
-                      + sizeof(struct fhdr)
-                      + arc_start
-                      + pfhdr->fname_length
-                      + pfhdr->extra_length];
-
-        /* dirname is the Python home directory (prefix) */
-        strcpy(pathname, dirname);
-        if (pathname[strlen(pathname)-1] != '\\')
-            strcat(pathname, "\\");
-        new_part = &pathname[lstrlen(pathname)];
-        /* we must now match the first part of the pathname
-         * in the archive to a component in the installation
-         * scheme (PURELIB, PLATLIB, HEADERS, SCRIPTS, or DATA)
-         * and replace this part by the one in the scheme to use
-         */
-        for (i = 0; scheme[i].name; ++i) {
-            if (0 == strnicmp(scheme[i].name, fname,
-                              strlen(scheme[i].name))) {
-                char *rest;
-                int len;
-
-                /* length of the replaced part */
-                int namelen = strlen(scheme[i].name);
-
-                strcat(pathname, scheme[i].prefix);
-
-                rest = fname + namelen;
-                len = pfhdr->fname_length - namelen;
-
-                if ((pathname[strlen(pathname)-1] != '\\')
-                    && (pathname[strlen(pathname)-1] != '/'))
-                    strcat(pathname, "\\");
-                /* Now that pathname ends with a separator,
-                 * we must make sure rest does not start with
-                 * an additional one.
-                 */
-                if ((rest[0] == '\\') || (rest[0] == '/')) {
-                    ++rest;
-                    --len;
-                }
-
-                strncat(pathname, rest, len);
-                goto Done;
-            }
-        }
-        /* no prefix to replace found, go unchanged */
-        strncat(pathname, fname, pfhdr->fname_length);
-      Done:
-        normpath(pathname);
-        if (pathname[strlen(pathname)-1] != '\\') {
-            /*
-             * The local file header (pfhdr) does not always
-             * contain the compressed and uncompressed sizes of
-             * the data depending on bit 3 of the flags field.  So
-             * it seems better to use the data from the central
-             * directory (pcdir).
-             */
-            dst = map_new_file(0, pathname, new_part,
-                               pcdir->uncomp_size,
-                               pcdir->last_mod_file_date,
-                               pcdir->last_mod_file_time, notify);
-            if (dst) {
-                if (!extract_file(dst, pcomp, pfhdr->method,
-                                  pcdir->comp_size,
-                                  pcdir->uncomp_size,
-                                  notify))
-                    return FALSE;
-            } /* else ??? */
-        }
-        if (notify)
-            notify(NUM_FILES, new_part, (int)pe->nTotalCDir,
-                   (int)n+1);
-    }
-    return TRUE;
-}
diff --git a/PC/bdist_wininst/install.c b/PC/bdist_wininst/install.c
deleted file mode 100644
index 5d77542..0000000
--- a/PC/bdist_wininst/install.c
+++ /dev/null
@@ -1,2700 +0,0 @@
-/*
-  IMPORTANT NOTE: IF THIS FILE IS CHANGED, PCBUILD\BDIST_WININST.VCXPROJ MUST
-  BE REBUILT AS WELL.
-
-  IF CHANGES TO THIS FILE ARE CHECKED IN, THE RECOMPILED BINARIES MUST BE
-  CHECKED IN AS WELL!
-*/
-
-/*
- * Written by Thomas Heller, May 2000
- *
- * $Id$
- */
-
-/*
- * Windows Installer program for distutils.
- *
- * (a kind of self-extracting zip-file)
- *
- * At runtime, the exefile has appended:
- * - compressed setup-data in ini-format, containing the following sections:
- *      [metadata]
- *      author=Greg Ward
- *      author_email=gward@python.net
- *      description=Python Distribution Utilities
- *      licence=Python
- *      name=Distutils
- *      url=http://www.python.org/sigs/distutils-sig/
- *      version=0.9pre
- *
- *      [Setup]
- *      info= text to be displayed in the edit-box
- *      title= to be displayed by this program
- *      target_version = if present, python version required
- *      pyc_compile = if 0, do not compile py to pyc
- *      pyo_compile = if 0, do not compile py to pyo
- *
- * - a struct meta_data_hdr, describing the above
- * - a zip-file, containing the modules to be installed.
- *   for the format see http://www.pkware.com/appnote.html
- *
- * What does this program do?
- * - the setup-data is uncompressed and written to a temporary file.
- * - setup-data is queried with GetPrivateProfile... calls
- * - [metadata] - info is displayed in the dialog box
- * - The registry is searched for installations of python
- * - The user can select the python version to use.
- * - The python-installation directory (sys.prefix) is displayed
- * - When the start-button is pressed, files from the zip-archive
- *   are extracted to the file system. All .py filenames are stored
- *   in a list.
- */
-/*
- * Includes now an uninstaller.
- */
-
-/*
- * To Do:
- *
- * display some explanation when no python version is found
- * instead showing the user an empty listbox to select something from.
- *
- * Finish the code so that we can use other python installations
- * additionally to those found in the registry,
- * and then #define USE_OTHER_PYTHON_VERSIONS
- *
- *  - install a help-button, which will display something meaningful
- *    to the poor user.
- *    text to the user
- *  - should there be a possibility to display a README file
- *    before starting the installation (if one is present in the archive)
- *  - more comments about what the code does(?)
- *
- *  - evolve this into a full blown installer (???)
- */
-
-#include <windows.h>
-#include <commctrl.h>
-#include <imagehlp.h>
-#include <objbase.h>
-#include <shlobj.h>
-#include <objidl.h>
-#include "resource.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <malloc.h>
-#include <io.h>
-#include <fcntl.h>
-
-#include "archive.h"
-
-/* Only for debugging!
-   static int dprintf(char *fmt, ...)
-   {
-   char Buffer[4096];
-   va_list marker;
-   int result;
-
-   va_start(marker, fmt);
-   result = wvsprintf(Buffer, fmt, marker);
-   OutputDebugString(Buffer);
-   return result;
-   }
-*/
-
-/* Bah: global variables */
-FILE *logfile;
-
-char modulename[MAX_PATH];
-wchar_t wmodulename[MAX_PATH];
-
-HWND hwndMain;
-HWND hDialog;
-
-char *ini_file;                 /* Full pathname of ini-file */
-/* From ini-file */
-char info[4096];                /* [Setup] info= */
-char title[80];                 /* [Setup] title=, contains package name
-                                   including version: "Distutils-1.0.1" */
-char target_version[10];        /* [Setup] target_version=, required python
-                                   version or empty string */
-char build_info[80];            /* [Setup] build_info=, distutils version
-                                   and build date */
-
-char meta_name[80];             /* package name without version like
-                                   'Distutils' */
-char install_script[MAX_PATH];
-char *pre_install_script; /* run before we install a single file */
-
-char user_access_control[10]; // one of 'auto', 'force', otherwise none.
-
-int py_major, py_minor;         /* Python version selected for installation */
-
-char *arc_data;                 /* memory mapped archive */
-DWORD arc_size;                 /* number of bytes in archive */
-int exe_size;                   /* number of bytes for exe-file portion */
-char python_dir[MAX_PATH];
-char pythondll[MAX_PATH];
-BOOL pyc_compile, pyo_compile;
-/* Either HKLM or HKCU, depending on where Python itself is registered, and
-   the permissions of the current user. */
-HKEY hkey_root = (HKEY)-1;
-
-BOOL success;                   /* Installation successful? */
-char *failure_reason = NULL;
-
-HANDLE hBitmap;
-char *bitmap_bytes;
-
-static const char *REGISTRY_SUFFIX_6432 =
-#ifdef _WIN64
-                                          "";
-#else
-                                          "-32";
-#endif
-
-
-#define WM_NUMFILES WM_USER+1
-/* wParam: 0, lParam: total number of files */
-#define WM_NEXTFILE WM_USER+2
-/* wParam: number of this file */
-/* lParam: points to pathname */
-
-static BOOL notify(int code, char *fmt, ...);
-
-/* Note: If scheme.prefix is nonempty, it must end with a '\'! */
-/* Note: purelib must be the FIRST entry! */
-SCHEME old_scheme[] = {
-    { "PURELIB", "" },
-    { "PLATLIB", "" },
-    { "HEADERS", "" }, /* 'Include/dist_name' part already in archive */
-    { "SCRIPTS", "Scripts\\" },
-    { "DATA", "" },
-    { NULL, NULL },
-};
-
-SCHEME new_scheme[] = {
-    { "PURELIB", "Lib\\site-packages\\" },
-    { "PLATLIB", "Lib\\site-packages\\" },
-    { "HEADERS", "" }, /* 'Include/dist_name' part already in archive */
-    { "SCRIPTS", "Scripts\\" },
-    { "DATA", "" },
-    { NULL, NULL },
-};
-
-static void unescape(char *dst, char *src, unsigned size)
-{
-    char *eon;
-    char ch;
-
-    while (src && *src && (size > 2)) {
-        if (*src == '\\') {
-            switch (*++src) {
-            case 'n':
-                ++src;
-                *dst++ = '\r';
-                *dst++ = '\n';
-                size -= 2;
-                break;
-            case 'r':
-                ++src;
-                *dst++ = '\r';
-                --size;
-                break;
-            case '0': case '1': case '2': case '3':
-                ch = (char)strtol(src, &eon, 8);
-                if (ch == '\n') {
-                    *dst++ = '\r';
-                    --size;
-                }
-                *dst++ = ch;
-                --size;
-                src = eon;
-            }
-        } else {
-            *dst++ = *src++;
-            --size;
-        }
-    }
-    *dst = '\0';
-}
-
-static struct tagFile {
-    char *path;
-    struct tagFile *next;
-} *file_list = NULL;
-
-static void set_failure_reason(char *reason)
-{
-    if (failure_reason)
-    free(failure_reason);
-    failure_reason = strdup(reason);
-    success = FALSE;
-}
-static char *get_failure_reason()
-{
-    if (!failure_reason)
-    return "Installation failed.";
-    return failure_reason;
-}
-
-static void add_to_filelist(char *path)
-{
-    struct tagFile *p;
-    p = (struct tagFile *)malloc(sizeof(struct tagFile));
-    p->path = strdup(path);
-    p->next = file_list;
-    file_list = p;
-}
-
-static int do_compile_files(int (__cdecl * PyRun_SimpleString)(char *),
-                             int optimize)
-{
-    struct tagFile *p;
-    int total, n;
-    char Buffer[MAX_PATH + 64];
-    int errors = 0;
-
-    total = 0;
-    p = file_list;
-    while (p) {
-        ++total;
-        p = p->next;
-    }
-    SendDlgItemMessage(hDialog, IDC_PROGRESS, PBM_SETRANGE, 0,
-                        MAKELPARAM(0, total));
-    SendDlgItemMessage(hDialog, IDC_PROGRESS, PBM_SETPOS, 0, 0);
-
-    n = 0;
-    p = file_list;
-    while (p) {
-        ++n;
-        wsprintf(Buffer,
-                  "import py_compile; py_compile.compile (r'%s')",
-                  p->path);
-        if (PyRun_SimpleString(Buffer)) {
-            ++errors;
-        }
-        /* We send the notification even if the files could not
-         * be created so that the uninstaller will remove them
-         * in case they are created later.
-         */
-        wsprintf(Buffer, "%s%c", p->path, optimize ? 'o' : 'c');
-        notify(FILE_CREATED, Buffer);
-
-        SendDlgItemMessage(hDialog, IDC_PROGRESS, PBM_SETPOS, n, 0);
-        SetDlgItemText(hDialog, IDC_INFO, p->path);
-        p = p->next;
-    }
-    return errors;
-}
-
-#define DECLPROC(dll, result, name, args)\
-    typedef result (*__PROC__##name) args;\
-    result (*name)args = (__PROC__##name)GetProcAddress(dll, #name)
-
-
-#define DECLVAR(dll, type, name)\
-    type *name = (type*)GetProcAddress(dll, #name)
-
-typedef void PyObject;
-
-// Convert a "char *" string to "whcar_t *", or NULL on error.
-// Result string must be free'd
-wchar_t *widen_string(char *src)
-{
-    wchar_t *result;
-    DWORD dest_cch;
-    int src_len = strlen(src) + 1; // include NULL term in all ops
-    /* use MultiByteToWideChar() to see how much we need. */
-    /* NOTE: this will include the null-term in the length */
-    dest_cch = MultiByteToWideChar(CP_ACP, 0, src, src_len, NULL, 0);
-    // alloc the buffer
-    result = (wchar_t *)malloc(dest_cch * sizeof(wchar_t));
-    if (result==NULL)
-        return NULL;
-    /* do the conversion */
-    if (0==MultiByteToWideChar(CP_ACP, 0, src, src_len, result, dest_cch)) {
-        free(result);
-        return NULL;
-    }
-    return result;
-}
-
-/*
- * Returns number of files which failed to compile,
- * -1 if python could not be loaded at all
- */
-static int compile_filelist(HINSTANCE hPython, BOOL optimize_flag)
-{
-    DECLPROC(hPython, void, Py_Initialize, (void));
-    DECLPROC(hPython, void, Py_SetProgramName, (wchar_t *));
-    DECLPROC(hPython, void, Py_Finalize, (void));
-    DECLPROC(hPython, int, PyRun_SimpleString, (char *));
-    DECLPROC(hPython, PyObject *, PySys_GetObject, (char *));
-    DECLVAR(hPython, int, Py_OptimizeFlag);
-
-    int errors = 0;
-    struct tagFile *p = file_list;
-
-    if (!p)
-        return 0;
-
-    if (!Py_Initialize || !Py_SetProgramName || !Py_Finalize)
-        return -1;
-
-    if (!PyRun_SimpleString || !PySys_GetObject || !Py_OptimizeFlag)
-        return -1;
-
-    *Py_OptimizeFlag = optimize_flag ? 1 : 0;
-    Py_SetProgramName(wmodulename);
-    Py_Initialize();
-
-    errors += do_compile_files(PyRun_SimpleString, optimize_flag);
-    Py_Finalize();
-
-    return errors;
-}
-
-typedef PyObject *(*PyCFunction)(PyObject *, PyObject *);
-
-struct PyMethodDef {
-    char        *ml_name;
-    PyCFunction  ml_meth;
-    int                  ml_flags;
-    char        *ml_doc;
-};
-typedef struct PyMethodDef PyMethodDef;
-
-// XXX - all of these are potentially fragile!  We load and unload
-// the Python DLL multiple times - so storing functions pointers
-// is dangerous (although things *look* OK at present)
-// Better might be to roll prepare_script_environment() into
-// LoadPythonDll(), and create a new UnloadPythonDLL() which also
-// clears the global pointers.
-void *(*g_Py_BuildValue)(char *, ...);
-int (*g_PyArg_ParseTuple)(PyObject *, char *, ...);
-PyObject * (*g_PyLong_FromVoidPtr)(void *);
-
-PyObject *g_PyExc_ValueError;
-PyObject *g_PyExc_OSError;
-
-PyObject *(*g_PyErr_Format)(PyObject *, char *, ...);
-
-#define DEF_CSIDL(name) { name, #name }
-
-struct {
-    int nFolder;
-    char *name;
-} csidl_names[] = {
-    /* Startup menu for all users.
-       NT only */
-    DEF_CSIDL(CSIDL_COMMON_STARTMENU),
-    /* Startup menu. */
-    DEF_CSIDL(CSIDL_STARTMENU),
-
-/*    DEF_CSIDL(CSIDL_COMMON_APPDATA), */
-/*    DEF_CSIDL(CSIDL_LOCAL_APPDATA), */
-    /* Repository for application-specific data.
-       Needs Internet Explorer 4.0 */
-    DEF_CSIDL(CSIDL_APPDATA),
-
-    /* The desktop for all users.
-       NT only */
-    DEF_CSIDL(CSIDL_COMMON_DESKTOPDIRECTORY),
-    /* The desktop. */
-    DEF_CSIDL(CSIDL_DESKTOPDIRECTORY),
-
-    /* Startup folder for all users.
-       NT only */
-    DEF_CSIDL(CSIDL_COMMON_STARTUP),
-    /* Startup folder. */
-    DEF_CSIDL(CSIDL_STARTUP),
-
-    /* Programs item in the start menu for all users.
-       NT only */
-    DEF_CSIDL(CSIDL_COMMON_PROGRAMS),
-    /* Program item in the user's start menu. */
-    DEF_CSIDL(CSIDL_PROGRAMS),
-
-/*    DEF_CSIDL(CSIDL_PROGRAM_FILES_COMMON), */
-/*    DEF_CSIDL(CSIDL_PROGRAM_FILES), */
-
-    /* Virtual folder containing fonts. */
-    DEF_CSIDL(CSIDL_FONTS),
-};
-
-#define DIM(a) (sizeof(a) / sizeof((a)[0]))
-
-static PyObject *FileCreated(PyObject *self, PyObject *args)
-{
-    char *path;
-    if (!g_PyArg_ParseTuple(args, "s", &path))
-        return NULL;
-    notify(FILE_CREATED, path);
-    return g_Py_BuildValue("");
-}
-
-static PyObject *DirectoryCreated(PyObject *self, PyObject *args)
-{
-    char *path;
-    if (!g_PyArg_ParseTuple(args, "s", &path))
-        return NULL;
-    notify(DIR_CREATED, path);
-    return g_Py_BuildValue("");
-}
-
-static PyObject *GetSpecialFolderPath(PyObject *self, PyObject *args)
-{
-    char *name;
-    char lpszPath[MAX_PATH];
-    int i;
-    static HRESULT (WINAPI *My_SHGetSpecialFolderPath)(HWND hwnd,
-                                                       LPTSTR lpszPath,
-                                                       int nFolder,
-                                                       BOOL fCreate);
-
-    if (!My_SHGetSpecialFolderPath) {
-        HINSTANCE hLib = LoadLibrary("shell32.dll");
-        if (!hLib) {
-            g_PyErr_Format(g_PyExc_OSError,
-                           "function not available");
-            return NULL;
-        }
-        My_SHGetSpecialFolderPath = (BOOL (WINAPI *)(HWND, LPTSTR,
-                                                     int, BOOL))
-            GetProcAddress(hLib,
-                           "SHGetSpecialFolderPathA");
-    }
-
-    if (!g_PyArg_ParseTuple(args, "s", &name))
-        return NULL;
-
-    if (!My_SHGetSpecialFolderPath) {
-        g_PyErr_Format(g_PyExc_OSError, "function not available");
-        return NULL;
-    }
-
-    for (i = 0; i < DIM(csidl_names); ++i) {
-        if (0 == strcmpi(csidl_names[i].name, name)) {
-            int nFolder;
-            nFolder = csidl_names[i].nFolder;
-            if (My_SHGetSpecialFolderPath(NULL, lpszPath,
-                                          nFolder, 0))
-                return g_Py_BuildValue("s", lpszPath);
-            else {
-                g_PyErr_Format(g_PyExc_OSError,
-                               "no such folder (%s)", name);
-                return NULL;
-            }
-
-        }
-    };
-    g_PyErr_Format(g_PyExc_ValueError, "unknown CSIDL (%s)", name);
-    return NULL;
-}
-
-static PyObject *CreateShortcut(PyObject *self, PyObject *args)
-{
-    char *path; /* path and filename */
-    char *description;
-    char *filename;
-
-    char *arguments = NULL;
-    char *iconpath = NULL;
-    int iconindex = 0;
-    char *workdir = NULL;
-
-    WCHAR wszFilename[MAX_PATH];
-
-    IShellLink *ps1 = NULL;
-    IPersistFile *pPf = NULL;
-
-    HRESULT hr;
-
-    hr = CoInitialize(NULL);
-    if (FAILED(hr)) {
-        g_PyErr_Format(g_PyExc_OSError,
-                       "CoInitialize failed, error 0x%x", hr);
-        goto error;
-    }
-
-    if (!g_PyArg_ParseTuple(args, "sss|sssi",
-                            &path, &description, &filename,
-                            &arguments, &workdir, &iconpath, &iconindex))
-        return NULL;
-
-    hr = CoCreateInstance(&CLSID_ShellLink,
-                          NULL,
-                          CLSCTX_INPROC_SERVER,
-                          &IID_IShellLink,
-                          &ps1);
-    if (FAILED(hr)) {
-        g_PyErr_Format(g_PyExc_OSError,
-                       "CoCreateInstance failed, error 0x%x", hr);
-        goto error;
-    }
-
-    hr = ps1->lpVtbl->QueryInterface(ps1, &IID_IPersistFile,
-                                     (void **)&pPf);
-    if (FAILED(hr)) {
-        g_PyErr_Format(g_PyExc_OSError,
-                       "QueryInterface(IPersistFile) error 0x%x", hr);
-        goto error;
-    }
-
-
-    hr = ps1->lpVtbl->SetPath(ps1, path);
-    if (FAILED(hr)) {
-        g_PyErr_Format(g_PyExc_OSError,
-                       "SetPath() failed, error 0x%x", hr);
-        goto error;
-    }
-
-    hr = ps1->lpVtbl->SetDescription(ps1, description);
-    if (FAILED(hr)) {
-        g_PyErr_Format(g_PyExc_OSError,
-                       "SetDescription() failed, error 0x%x", hr);
-        goto error;
-    }
-
-    if (arguments) {
-        hr = ps1->lpVtbl->SetArguments(ps1, arguments);
-        if (FAILED(hr)) {
-            g_PyErr_Format(g_PyExc_OSError,
-                           "SetArguments() error 0x%x", hr);
-            goto error;
-        }
-    }
-
-    if (iconpath) {
-        hr = ps1->lpVtbl->SetIconLocation(ps1, iconpath, iconindex);
-        if (FAILED(hr)) {
-            g_PyErr_Format(g_PyExc_OSError,
-                           "SetIconLocation() error 0x%x", hr);
-            goto error;
-        }
-    }
-
-    if (workdir) {
-        hr = ps1->lpVtbl->SetWorkingDirectory(ps1, workdir);
-        if (FAILED(hr)) {
-            g_PyErr_Format(g_PyExc_OSError,
-                           "SetWorkingDirectory() error 0x%x", hr);
-            goto error;
-        }
-    }
-
-    MultiByteToWideChar(CP_ACP, 0,
-                        filename, -1,
-                        wszFilename, MAX_PATH);
-
-    hr = pPf->lpVtbl->Save(pPf, wszFilename, TRUE);
-    if (FAILED(hr)) {
-        g_PyErr_Format(g_PyExc_OSError,
-                       "Failed to create shortcut '%s' - error 0x%x", filename, hr);
-        goto error;
-    }
-
-    pPf->lpVtbl->Release(pPf);
-    ps1->lpVtbl->Release(ps1);
-    CoUninitialize();
-    return g_Py_BuildValue("");
-
-  error:
-    if (pPf)
-        pPf->lpVtbl->Release(pPf);
-
-    if (ps1)
-        ps1->lpVtbl->Release(ps1);
-
-    CoUninitialize();
-
-    return NULL;
-}
-
-static PyObject *PyMessageBox(PyObject *self, PyObject *args)
-{
-    int rc;
-    char *text, *caption;
-    int flags;
-    if (!g_PyArg_ParseTuple(args, "ssi", &text, &caption, &flags))
-        return NULL;
-    rc = MessageBox(GetFocus(), text, caption, flags);
-    return g_Py_BuildValue("i", rc);
-}
-
-static PyObject *GetRootHKey(PyObject *self, PyObject *Py_UNUSED(ignored))
-{
-    return g_PyLong_FromVoidPtr(hkey_root);
-}
-
-#define METH_VARARGS 0x0001
-#define METH_NOARGS   0x0004
-
-PyMethodDef meth[] = {
-    {"create_shortcut", CreateShortcut, METH_VARARGS, NULL},
-    {"get_special_folder_path", GetSpecialFolderPath, METH_VARARGS, NULL},
-    {"get_root_hkey", GetRootHKey, METH_NOARGS, NULL},
-    {"file_created", FileCreated, METH_VARARGS, NULL},
-    {"directory_created", DirectoryCreated, METH_VARARGS, NULL},
-    {"message_box", PyMessageBox, METH_VARARGS, NULL},
-};
-
-static HINSTANCE LoadPythonDll(char *fname)
-{
-    char fullpath[_MAX_PATH];
-    LONG size = sizeof(fullpath);
-    char subkey_name[80];
-    char buffer[260 + 12];
-    HINSTANCE h;
-
-    /* make sure PYTHONHOME is set, to that sys.path is initialized correctly */
-    wsprintf(buffer, "PYTHONHOME=%s", python_dir);
-    _putenv(buffer);
-    h = LoadLibrary(fname);
-    if (h)
-        return h;
-    wsprintf(subkey_name,
-             "SOFTWARE\\Python\\PythonCore\\%d.%d%s\\InstallPath",
-             py_major, py_minor, REGISTRY_SUFFIX_6432);
-    if (ERROR_SUCCESS != RegQueryValue(HKEY_CURRENT_USER, subkey_name,
-                                       fullpath, &size) &&
-        ERROR_SUCCESS != RegQueryValue(HKEY_LOCAL_MACHINE, subkey_name,
-                                       fullpath, &size))
-        return NULL;
-    strcat(fullpath, "\\");
-    strcat(fullpath, fname);
-    // We use LOAD_WITH_ALTERED_SEARCH_PATH to ensure any dependent DLLs
-    // next to the Python DLL (eg, the CRT DLL) are also loaded.
-    return LoadLibraryEx(fullpath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
-}
-
-static int prepare_script_environment(HINSTANCE hPython)
-{
-    PyObject *mod;
-    DECLPROC(hPython, PyObject *, PyImport_ImportModule, (char *));
-    DECLPROC(hPython, int, PyObject_SetAttrString, (PyObject *, char *, PyObject *));
-    DECLPROC(hPython, PyObject *, PyObject_GetAttrString, (PyObject *, char *));
-    DECLPROC(hPython, PyObject *, PyCFunction_New, (PyMethodDef *, PyObject *));
-    DECLPROC(hPython, PyObject *, Py_BuildValue, (char *, ...));
-    DECLPROC(hPython, int, PyArg_ParseTuple, (PyObject *, char *, ...));
-    DECLPROC(hPython, PyObject *, PyErr_Format, (PyObject *, char *));
-    DECLPROC(hPython, PyObject *, PyLong_FromVoidPtr, (void *));
-    if (!PyImport_ImportModule || !PyObject_GetAttrString ||
-        !PyObject_SetAttrString || !PyCFunction_New)
-        return 1;
-    if (!Py_BuildValue || !PyArg_ParseTuple || !PyErr_Format)
-        return 1;
-
-    mod = PyImport_ImportModule("builtins");
-    if (mod) {
-        int i;
-        g_PyExc_ValueError = PyObject_GetAttrString(mod, "ValueError");
-        g_PyExc_OSError = PyObject_GetAttrString(mod, "OSError");
-        for (i = 0; i < DIM(meth); ++i) {
-            PyObject_SetAttrString(mod, meth[i].ml_name,
-                                   PyCFunction_New(&meth[i], NULL));
-        }
-    }
-    g_Py_BuildValue = Py_BuildValue;
-    g_PyArg_ParseTuple = PyArg_ParseTuple;
-    g_PyErr_Format = PyErr_Format;
-    g_PyLong_FromVoidPtr = PyLong_FromVoidPtr;
-
-    return 0;
-}
-
-/*
- * This function returns one of the following error codes:
- * 1 if the Python-dll does not export the functions we need
- * 2 if no install-script is specified in pathname
- * 3 if the install-script file could not be opened
- * the return value of PyRun_SimpleString() or Py_FinalizeEx() otherwise,
- * which is 0 if everything is ok, -1 if an exception had occurred
- * in the install-script.
- */
-
-static int
-do_run_installscript(HINSTANCE hPython, char *pathname, int argc, char **argv)
-{
-    int fh, result, i;
-    static wchar_t *wargv[256];
-    DECLPROC(hPython, void, Py_Initialize, (void));
-    DECLPROC(hPython, int, PySys_SetArgv, (int, wchar_t **));
-    DECLPROC(hPython, int, PyRun_SimpleString, (char *));
-    DECLPROC(hPython, int, Py_FinalizeEx, (void));
-    DECLPROC(hPython, PyObject *, Py_BuildValue, (char *, ...));
-    DECLPROC(hPython, PyObject *, PyCFunction_New,
-             (PyMethodDef *, PyObject *));
-    DECLPROC(hPython, int, PyArg_ParseTuple, (PyObject *, char *, ...));
-    DECLPROC(hPython, PyObject *, PyErr_Format, (PyObject *, char *));
-
-    if (!Py_Initialize || !PySys_SetArgv
-        || !PyRun_SimpleString || !Py_FinalizeEx)
-        return 1;
-
-    if (!Py_BuildValue || !PyArg_ParseTuple || !PyErr_Format)
-        return 1;
-
-    if (!PyCFunction_New || !PyArg_ParseTuple || !PyErr_Format)
-        return 1;
-
-    if (pathname == NULL || pathname[0] == '\0')
-        return 2;
-
-    fh = open(pathname, _O_RDONLY | O_NOINHERIT);
-    if (-1 == fh) {
-        fprintf(stderr, "Could not open postinstall-script %s\n",
-            pathname);
-        return 3;
-    }
-
-    SetDlgItemText(hDialog, IDC_INFO, "Running Script...");
-
-    Py_Initialize();
-
-    prepare_script_environment(hPython);
-    // widen the argv array for py3k.
-    memset(wargv, 0, sizeof(wargv));
-    for (i=0;i<argc;i++)
-        wargv[i] = argv[i] ? widen_string(argv[i]) : NULL;
-    PySys_SetArgv(argc, wargv);
-    // free the strings we just widened.
-    for (i=0;i<argc;i++)
-        if (wargv[i])
-            free(wargv[i]);
-
-    result = 3;
-    {
-        struct _stat statbuf;
-        if(0 == _fstat(fh, &statbuf)) {
-            char *script = alloca(statbuf.st_size + 5);
-            int n = read(fh, script, statbuf.st_size);
-            if (n > 0) {
-                script[n] = '\n';
-                script[n+1] = 0;
-                result = PyRun_SimpleString(script);
-            }
-        }
-    }
-    if (Py_FinalizeEx() < 0) {
-        result = -1;
-    }
-
-    close(fh);
-    return result;
-}
-
-static int
-run_installscript(char *pathname, int argc, char **argv, char **pOutput)
-{
-    HINSTANCE hPython;
-    int result = 1;
-    int out_buf_size;
-    HANDLE redirected, old_stderr, old_stdout;
-    char *tempname;
-
-    *pOutput = NULL;
-
-    tempname = tempnam(NULL, NULL);
-    // We use a static CRT while the Python version we load uses
-    // the CRT from one of various possible DLLs.  As a result we
-    // need to redirect the standard handles using the API rather
-    // than the CRT.
-    redirected = CreateFile(
-                                    tempname,
-                                    GENERIC_WRITE | GENERIC_READ,
-                                    FILE_SHARE_READ,
-                                    NULL,
-                                    CREATE_ALWAYS,
-                                    FILE_ATTRIBUTE_NORMAL | FILE_FLAG_WRITE_THROUGH,
-                                    NULL);
-    old_stdout = GetStdHandle(STD_OUTPUT_HANDLE);
-    old_stderr = GetStdHandle(STD_ERROR_HANDLE);
-    SetStdHandle(STD_OUTPUT_HANDLE, redirected);
-    SetStdHandle(STD_ERROR_HANDLE, redirected);
-
-    hPython = LoadPythonDll(pythondll);
-    if (hPython) {
-        result = do_run_installscript(hPython, pathname, argc, argv);
-        FreeLibrary(hPython);
-    } else {
-        fprintf(stderr, "*** Could not load Python ***");
-    }
-    SetStdHandle(STD_OUTPUT_HANDLE, old_stdout);
-    SetStdHandle(STD_ERROR_HANDLE, old_stderr);
-    out_buf_size = min(GetFileSize(redirected, NULL), 4096);
-    *pOutput = malloc(out_buf_size+1);
-    if (*pOutput) {
-        DWORD nread = 0;
-        SetFilePointer(redirected, 0, 0, FILE_BEGIN);
-        ReadFile(redirected, *pOutput, out_buf_size, &nread, NULL);
-        (*pOutput)[nread] = '\0';
-    }
-    CloseHandle(redirected);
-    DeleteFile(tempname);
-    return result;
-}
-
-static int do_run_simple_script(HINSTANCE hPython, char *script)
-{
-    int rc;
-    DECLPROC(hPython, void, Py_Initialize, (void));
-    DECLPROC(hPython, void, Py_SetProgramName, (wchar_t *));
-    DECLPROC(hPython, int, Py_FinalizeEx, (void));
-    DECLPROC(hPython, int, PyRun_SimpleString, (char *));
-    DECLPROC(hPython, void, PyErr_Print, (void));
-
-    if (!Py_Initialize || !Py_SetProgramName || !Py_FinalizeEx ||
-        !PyRun_SimpleString || !PyErr_Print)
-        return -1;
-
-    Py_SetProgramName(wmodulename);
-    Py_Initialize();
-    prepare_script_environment(hPython);
-    rc = PyRun_SimpleString(script);
-    if (rc)
-        PyErr_Print();
-    if (Py_FinalizeEx() < 0) {
-        rc = -1;
-    }
-    return rc;
-}
-
-static int run_simple_script(char *script)
-{
-    int rc;
-    HINSTANCE hPython;
-    char *tempname = tempnam(NULL, NULL);
-    // Redirect output using win32 API - see comments above...
-    HANDLE redirected = CreateFile(
-                                    tempname,
-                                    GENERIC_WRITE | GENERIC_READ,
-                                    FILE_SHARE_READ,
-                                    NULL,
-                                    CREATE_ALWAYS,
-                                    FILE_ATTRIBUTE_NORMAL | FILE_FLAG_WRITE_THROUGH,
-                                    NULL);
-    HANDLE old_stdout = GetStdHandle(STD_OUTPUT_HANDLE);
-    HANDLE old_stderr = GetStdHandle(STD_ERROR_HANDLE);
-    SetStdHandle(STD_OUTPUT_HANDLE, redirected);
-    SetStdHandle(STD_ERROR_HANDLE, redirected);
-
-    hPython = LoadPythonDll(pythondll);
-    if (!hPython) {
-        char reason[128];
-        wsprintf(reason, "Can't load Python for pre-install script (%d)", GetLastError());
-        set_failure_reason(reason);
-        return -1;
-    }
-    rc = do_run_simple_script(hPython, script);
-    FreeLibrary(hPython);
-    SetStdHandle(STD_OUTPUT_HANDLE, old_stdout);
-    SetStdHandle(STD_ERROR_HANDLE, old_stderr);
-    /* We only care about the output when we fail.  If the script works
-       OK, then we discard it
-    */
-    if (rc) {
-        int err_buf_size;
-        char *err_buf;
-        const char *prefix = "Running the pre-installation script failed\r\n";
-        int prefix_len = strlen(prefix);
-        err_buf_size = GetFileSize(redirected, NULL);
-        if (err_buf_size==INVALID_FILE_SIZE) // an error - let's try anyway...
-            err_buf_size = 4096;
-        err_buf = malloc(prefix_len + err_buf_size + 1);
-        if (err_buf) {
-            DWORD n = 0;
-            strcpy(err_buf, prefix);
-            SetFilePointer(redirected, 0, 0, FILE_BEGIN);
-            ReadFile(redirected, err_buf+prefix_len, err_buf_size, &n, NULL);
-            err_buf[prefix_len+n] = '\0';
-            set_failure_reason(err_buf);
-            free(err_buf);
-        } else {
-            set_failure_reason("Out of memory!");
-        }
-    }
-    CloseHandle(redirected);
-    DeleteFile(tempname);
-    return rc;
-}
-
-
-static BOOL SystemError(int error, char *msg)
-{
-    char Buffer[1024];
-    int n;
-
-    if (error) {
-        LPVOID lpMsgBuf;
-        FormatMessage(
-            FORMAT_MESSAGE_ALLOCATE_BUFFER |
-            FORMAT_MESSAGE_FROM_SYSTEM |
-            FORMAT_MESSAGE_IGNORE_INSERTS,
-            NULL,
-            error,
-            MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-            (LPSTR)&lpMsgBuf,
-            0,
-            NULL
-            );
-        strncpy(Buffer, lpMsgBuf, sizeof(Buffer));
-        LocalFree(lpMsgBuf);
-    } else
-        Buffer[0] = '\0';
-    n = lstrlen(Buffer);
-    _snprintf(Buffer+n, sizeof(Buffer)-n, msg);
-    MessageBox(hwndMain, Buffer, "Runtime Error", MB_OK | MB_ICONSTOP);
-    return FALSE;
-}
-
-static BOOL notify (int code, char *fmt, ...)
-{
-    char Buffer[1024];
-    va_list marker;
-    BOOL result = TRUE;
-    int a, b;
-    char *cp;
-
-    va_start(marker, fmt);
-    _vsnprintf(Buffer, sizeof(Buffer), fmt, marker);
-
-    switch (code) {
-/* Questions */
-    case CAN_OVERWRITE:
-        break;
-
-/* Information notification */
-    case DIR_CREATED:
-        if (logfile)
-            fprintf(logfile, "100 Made Dir: %s\n", fmt);
-        break;
-
-    case FILE_CREATED:
-        if (logfile)
-            fprintf(logfile, "200 File Copy: %s\n", fmt);
-        goto add_to_filelist_label;
-        break;
-
-    case FILE_OVERWRITTEN:
-        if (logfile)
-            fprintf(logfile, "200 File Overwrite: %s\n", fmt);
-      add_to_filelist_label:
-        if ((cp = strrchr(fmt, '.')) && (0 == strcmp (cp, ".py")))
-            add_to_filelist(fmt);
-        break;
-
-/* Error Messages */
-    case ZLIB_ERROR:
-        MessageBox(GetFocus(), Buffer, "Error",
-                    MB_OK | MB_ICONWARNING);
-        break;
-
-    case SYSTEM_ERROR:
-        SystemError(GetLastError(), Buffer);
-        break;
-
-    case NUM_FILES:
-        a = va_arg(marker, int);
-        b = va_arg(marker, int);
-        SendMessage(hDialog, WM_NUMFILES, 0, MAKELPARAM(0, a));
-        SendMessage(hDialog, WM_NEXTFILE, b,(LPARAM)fmt);
-    }
-    va_end(marker);
-
-    return result;
-}
-
-static char *MapExistingFile(char *pathname, DWORD *psize)
-{
-    HANDLE hFile, hFileMapping;
-    DWORD nSizeLow, nSizeHigh;
-    char *data;
-
-    hFile = CreateFile(pathname,
-                        GENERIC_READ, FILE_SHARE_READ, NULL,
-                        OPEN_EXISTING,
-                        FILE_ATTRIBUTE_NORMAL, NULL);
-    if (hFile == INVALID_HANDLE_VALUE)
-        return NULL;
-    nSizeLow = GetFileSize(hFile, &nSizeHigh);
-    hFileMapping = CreateFileMapping(hFile,
-                                      NULL, PAGE_READONLY, 0, 0, NULL);
-    CloseHandle(hFile);
-
-    if (hFileMapping == NULL)
-        return NULL;
-
-    data = MapViewOfFile(hFileMapping,
-                          FILE_MAP_READ, 0, 0, 0);
-
-    CloseHandle(hFileMapping);
-    *psize = nSizeLow;
-    return data;
-}
-
-
-static void create_bitmap(HWND hwnd)
-{
-    BITMAPFILEHEADER *bfh;
-    BITMAPINFO *bi;
-    HDC hdc;
-
-    if (!bitmap_bytes)
-        return;
-
-    if (hBitmap)
-        return;
-
-    hdc = GetDC(hwnd);
-
-    bfh = (BITMAPFILEHEADER *)bitmap_bytes;
-    bi = (BITMAPINFO *)(bitmap_bytes + sizeof(BITMAPFILEHEADER));
-
-    hBitmap = CreateDIBitmap(hdc,
-                             &bi->bmiHeader,
-                             CBM_INIT,
-                             bitmap_bytes + bfh->bfOffBits,
-                             bi,
-                             DIB_RGB_COLORS);
-    ReleaseDC(hwnd, hdc);
-}
-
-/* Extract everything we need to begin the installation.  Currently this
-   is the INI filename with install data, and the raw pre-install script
-*/
-static BOOL ExtractInstallData(char *data, DWORD size, int *pexe_size,
-                               char **out_ini_file, char **out_preinstall_script)
-{
-    /* read the end of central directory record */
-    struct eof_cdir *pe = (struct eof_cdir *)&data[size - sizeof
-                                                   (struct eof_cdir)];
-
-    int arc_start = size - sizeof (struct eof_cdir) - pe->nBytesCDir -
-        pe->ofsCDir;
-
-    int ofs = arc_start - sizeof (struct meta_data_hdr);
-
-    /* read meta_data info */
-    struct meta_data_hdr *pmd = (struct meta_data_hdr *)&data[ofs];
-    char *src, *dst;
-    char *ini_file;
-    char tempdir[MAX_PATH];
-
-    /* ensure that if we fail, we don't have garbage out pointers */
-    *out_ini_file = *out_preinstall_script = NULL;
-
-    if (pe->tag != 0x06054b50) {
-        return FALSE;
-    }
-
-    if (pmd->tag != 0x1234567B) {
-        return SystemError(0,
-                   "Invalid cfgdata magic number (see bdist_wininst.py)");
-    }
-    if (ofs < 0) {
-        return FALSE;
-    }
-
-    if (pmd->bitmap_size) {
-        /* Store pointer to bitmap bytes */
-        bitmap_bytes = (char *)pmd - pmd->uncomp_size - pmd->bitmap_size;
-    }
-
-    *pexe_size = ofs - pmd->uncomp_size - pmd->bitmap_size;
-
-    src = ((char *)pmd) - pmd->uncomp_size;
-    ini_file = malloc(MAX_PATH); /* will be returned, so do not free it */
-    if (!ini_file)
-        return FALSE;
-    if (!GetTempPath(sizeof(tempdir), tempdir)
-        || !GetTempFileName(tempdir, "~du", 0, ini_file)) {
-        SystemError(GetLastError(),
-                     "Could not create temporary file");
-        return FALSE;
-    }
-
-    dst = map_new_file(CREATE_ALWAYS, ini_file, NULL, pmd->uncomp_size,
-                        0, 0, NULL/*notify*/);
-    if (!dst)
-        return FALSE;
-    /* Up to the first \0 is the INI file data. */
-    strncpy(dst, src, pmd->uncomp_size);
-    src += strlen(dst) + 1;
-    /* Up to next \0 is the pre-install script */
-    *out_preinstall_script = strdup(src);
-    *out_ini_file = ini_file;
-    UnmapViewOfFile(dst);
-    return TRUE;
-}
-
-static void PumpMessages(void)
-{
-    MSG msg;
-    while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
-        TranslateMessage(&msg);
-        DispatchMessage(&msg);
-    }
-}
-
-LRESULT CALLBACK
-WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
-    HDC hdc;
-    HFONT hFont;
-    int h;
-    PAINTSTRUCT ps;
-    switch (msg) {
-    case WM_PAINT:
-        hdc = BeginPaint(hwnd, &ps);
-        h = GetSystemMetrics(SM_CYSCREEN) / 10;
-        hFont = CreateFont(h, 0, 0, 0, 700, TRUE,
-                            0, 0, 0, 0, 0, 0, 0, "Times Roman");
-        hFont = SelectObject(hdc, hFont);
-        SetBkMode(hdc, TRANSPARENT);
-        TextOut(hdc, 15, 15, title, strlen(title));
-        SetTextColor(hdc, RGB(255, 255, 255));
-        TextOut(hdc, 10, 10, title, strlen(title));
-        DeleteObject(SelectObject(hdc, hFont));
-        EndPaint(hwnd, &ps);
-        return 0;
-    }
-    return DefWindowProc(hwnd, msg, wParam, lParam);
-}
-
-static HWND CreateBackground(char *title)
-{
-    WNDCLASS wc;
-    HWND hwnd;
-    char buffer[4096];
-
-    wc.style = CS_VREDRAW | CS_HREDRAW;
-    wc.lpfnWndProc = WindowProc;
-    wc.cbWndExtra = 0;
-    wc.cbClsExtra = 0;
-    wc.hInstance = GetModuleHandle(NULL);
-    wc.hIcon = NULL;
-    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
-    wc.hbrBackground = CreateSolidBrush(RGB(0, 0, 128));
-    wc.lpszMenuName = NULL;
-    wc.lpszClassName = "SetupWindowClass";
-
-    if (!RegisterClass(&wc))
-        MessageBox(hwndMain,
-                    "Could not register window class",
-                    "Setup.exe", MB_OK);
-
-    wsprintf(buffer, "Setup %s", title);
-    hwnd = CreateWindow("SetupWindowClass",
-                         buffer,
-                         0,
-                         0, 0,
-                         GetSystemMetrics(SM_CXFULLSCREEN),
-                         GetSystemMetrics(SM_CYFULLSCREEN),
-                         NULL,
-                         NULL,
-                         GetModuleHandle(NULL),
-                         NULL);
-    ShowWindow(hwnd, SW_SHOWMAXIMIZED);
-    UpdateWindow(hwnd);
-    return hwnd;
-}
-
-/*
- * Center a window on the screen
- */
-static void CenterWindow(HWND hwnd)
-{
-    RECT rc;
-    int w, h;
-
-    GetWindowRect(hwnd, &rc);
-    w = GetSystemMetrics(SM_CXSCREEN);
-    h = GetSystemMetrics(SM_CYSCREEN);
-    MoveWindow(hwnd,
-               (w - (rc.right-rc.left))/2,
-               (h - (rc.bottom-rc.top))/2,
-                rc.right-rc.left, rc.bottom-rc.top, FALSE);
-}
-
-#include <prsht.h>
-
-INT_PTR CALLBACK
-IntroDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
-    LPNMHDR lpnm;
-    char Buffer[4096];
-
-    switch (msg) {
-    case WM_INITDIALOG:
-        create_bitmap(hwnd);
-        if(hBitmap)
-            SendDlgItemMessage(hwnd, IDC_BITMAP, STM_SETIMAGE,
-                               IMAGE_BITMAP, (LPARAM)hBitmap);
-        CenterWindow(GetParent(hwnd));
-        wsprintf(Buffer,
-                  "This Wizard will install %s on your computer. "
-                  "Click Next to continue "
-                  "or Cancel to exit the Setup Wizard.",
-                  meta_name);
-        SetDlgItemText(hwnd, IDC_TITLE, Buffer);
-        SetDlgItemText(hwnd, IDC_INTRO_TEXT, info);
-        SetDlgItemText(hwnd, IDC_BUILD_INFO, build_info);
-        return FALSE;
-
-    case WM_NOTIFY:
-        lpnm = (LPNMHDR) lParam;
-
-        switch (lpnm->code) {
-        case PSN_SETACTIVE:
-            PropSheet_SetWizButtons(GetParent(hwnd), PSWIZB_NEXT);
-            break;
-
-        case PSN_WIZNEXT:
-            break;
-
-        case PSN_RESET:
-            break;
-
-        default:
-            break;
-        }
-    }
-    return FALSE;
-}
-
-#ifdef USE_OTHER_PYTHON_VERSIONS
-/* These are really private variables used to communicate
- * between StatusRoutine and CheckPythonExe
- */
-char bound_image_dll[_MAX_PATH];
-int bound_image_major;
-int bound_image_minor;
-
-static BOOL __stdcall StatusRoutine(IMAGEHLP_STATUS_REASON reason,
-                                    PSTR ImageName,
-                                    PSTR DllName,
-                                    ULONG Va,
-                                    ULONG Parameter)
-{
-    char fname[_MAX_PATH];
-    int int_version;
-
-    switch(reason) {
-    case BindOutOfMemory:
-    case BindRvaToVaFailed:
-    case BindNoRoomInImage:
-    case BindImportProcedureFailed:
-        break;
-
-    case BindImportProcedure:
-    case BindForwarder:
-    case BindForwarderNOT:
-    case BindImageModified:
-    case BindExpandFileHeaders:
-    case BindImageComplete:
-    case BindSymbolsNotUpdated:
-    case BindMismatchedSymbols:
-    case BindImportModuleFailed:
-        break;
-
-    case BindImportModule:
-        if (1 == sscanf(DllName, "python%d", &int_version)) {
-            SearchPath(NULL, DllName, NULL, sizeof(fname),
-                       fname, NULL);
-            strcpy(bound_image_dll, fname);
-            bound_image_major = int_version / 10;
-            bound_image_minor = int_version % 10;
-            OutputDebugString("BOUND ");
-            OutputDebugString(fname);
-            OutputDebugString("\n");
-        }
-        break;
-    }
-    return TRUE;
-}
-
-/*
- */
-static LPSTR get_sys_prefix(LPSTR exe, LPSTR dll)
-{
-    void (__cdecl * Py_Initialize)(void);
-    void (__cdecl * Py_SetProgramName)(char *);
-    void (__cdecl * Py_Finalize)(void);
-    void* (__cdecl * PySys_GetObject)(char *);
-    void (__cdecl * PySys_SetArgv)(int, char **);
-    char* (__cdecl * Py_GetPrefix)(void);
-    char* (__cdecl * Py_GetPath)(void);
-    HINSTANCE hPython;
-    LPSTR prefix = NULL;
-    int (__cdecl * PyRun_SimpleString)(char *);
-
-    {
-        char Buffer[256];
-        wsprintf(Buffer, "PYTHONHOME=%s", exe);
-        *strrchr(Buffer, '\\') = '\0';
-//      MessageBox(GetFocus(), Buffer, "PYTHONHOME", MB_OK);
-                _putenv(Buffer);
-                _putenv("PYTHONPATH=");
-    }
-
-    hPython = LoadLibrary(dll);
-    if (!hPython)
-        return NULL;
-    Py_Initialize = (void (*)(void))GetProcAddress
-        (hPython,"Py_Initialize");
-
-    PySys_SetArgv = (void (*)(int, char **))GetProcAddress
-        (hPython,"PySys_SetArgv");
-
-    PyRun_SimpleString = (int (*)(char *))GetProcAddress
-        (hPython,"PyRun_SimpleString");
-
-    Py_SetProgramName = (void (*)(char *))GetProcAddress
-        (hPython,"Py_SetProgramName");
-
-    PySys_GetObject = (void* (*)(char *))GetProcAddress
-        (hPython,"PySys_GetObject");
-
-    Py_GetPrefix = (char * (*)(void))GetProcAddress
-        (hPython,"Py_GetPrefix");
-
-    Py_GetPath = (char * (*)(void))GetProcAddress
-        (hPython,"Py_GetPath");
-
-    Py_Finalize = (void (*)(void))GetProcAddress(hPython,
-                                                  "Py_Finalize");
-    Py_SetProgramName(exe);
-    Py_Initialize();
-    PySys_SetArgv(1, &exe);
-
-    MessageBox(GetFocus(), Py_GetPrefix(), "PREFIX", MB_OK);
-    MessageBox(GetFocus(), Py_GetPath(), "PATH", MB_OK);
-
-    Py_Finalize();
-    FreeLibrary(hPython);
-
-    return prefix;
-}
-
-static BOOL
-CheckPythonExe(LPSTR pathname, LPSTR version, int *pmajor, int *pminor)
-{
-    bound_image_dll[0] = '\0';
-    if (!BindImageEx(BIND_NO_BOUND_IMPORTS | BIND_NO_UPDATE | BIND_ALL_IMAGES,
-                     pathname,
-                     NULL,
-                     NULL,
-                     StatusRoutine))
-        return SystemError(0, "Could not bind image");
-    if (bound_image_dll[0] == '\0')
-        return SystemError(0, "Does not seem to be a python executable");
-    *pmajor = bound_image_major;
-    *pminor = bound_image_minor;
-    if (version && *version) {
-        char core_version[12];
-        wsprintf(core_version, "%d.%d", bound_image_major, bound_image_minor);
-        if (strcmp(version, core_version))
-            return SystemError(0, "Wrong Python version");
-    }
-    get_sys_prefix(pathname, bound_image_dll);
-    return TRUE;
-}
-
-/*
- * Browse for other python versions. Insert it into the listbox specified
- * by hwnd. version, if not NULL or empty, is the version required.
- */
-static BOOL GetOtherPythonVersion(HWND hwnd, LPSTR version)
-{
-    char vers_name[_MAX_PATH + 80];
-    DWORD itemindex;
-    OPENFILENAME of;
-    char pathname[_MAX_PATH];
-    DWORD result;
-
-    strcpy(pathname, "python.exe");
-
-    memset(&of, 0, sizeof(of));
-    of.lStructSize = sizeof(OPENFILENAME);
-    of.hwndOwner = GetParent(hwnd);
-    of.hInstance = NULL;
-    of.lpstrFilter = "python.exe\0python.exe\0";
-    of.lpstrCustomFilter = NULL;
-    of.nMaxCustFilter = 0;
-    of.nFilterIndex = 1;
-    of.lpstrFile = pathname;
-    of.nMaxFile = sizeof(pathname);
-    of.lpstrFileTitle = NULL;
-    of.nMaxFileTitle = 0;
-    of.lpstrInitialDir = NULL;
-    of.lpstrTitle = "Python executable";
-    of.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST;
-    of.lpstrDefExt = "exe";
-
-    result = GetOpenFileName(&of);
-    if (result) {
-        int major, minor;
-        if (!CheckPythonExe(pathname, version, &major, &minor)) {
-            return FALSE;
-        }
-        *strrchr(pathname, '\\') = '\0';
-        wsprintf(vers_name, "Python Version %d.%d in %s",
-                  major, minor, pathname);
-        itemindex = SendMessage(hwnd, LB_INSERTSTRING, -1,
-                                (LPARAM)(LPSTR)vers_name);
-        SendMessage(hwnd, LB_SETCURSEL, itemindex, 0);
-        SendMessage(hwnd, LB_SETITEMDATA, itemindex,
-                    (LPARAM)(LPSTR)strdup(pathname));
-        return TRUE;
-    }
-    return FALSE;
-}
-#endif /* USE_OTHER_PYTHON_VERSIONS */
-
-typedef struct _InstalledVersionInfo {
-    char prefix[MAX_PATH+1]; // sys.prefix directory.
-    HKEY hkey; // Is this Python in HKCU or HKLM?
-} InstalledVersionInfo;
-
-
-/*
- * Fill the listbox specified by hwnd with all python versions found
- * in the registry. version, if not NULL or empty, is the version
- * required.
- */
-static BOOL GetPythonVersions(HWND hwnd, HKEY hkRoot, LPSTR version)
-{
-    DWORD index = 0;
-    char core_version[80];
-    HKEY hKey;
-    BOOL result = TRUE;
-    DWORD bufsize;
-
-    if (ERROR_SUCCESS != RegOpenKeyEx(hkRoot,
-                                       "Software\\Python\\PythonCore",
-                                       0,       KEY_READ, &hKey))
-        return FALSE;
-    bufsize = sizeof(core_version);
-    while (ERROR_SUCCESS == RegEnumKeyEx(hKey, index,
-                                          core_version, &bufsize, NULL,
-                                          NULL, NULL, NULL)) {
-        char subkey_name[80], vers_name[80];
-        int itemindex;
-        DWORD value_size;
-        HKEY hk;
-
-        bufsize = sizeof(core_version);
-        ++index;
-        if (version && *version && strcmp(version, core_version))
-            continue;
-
-        wsprintf(vers_name, "Python Version %s (found in registry)",
-                  core_version);
-        wsprintf(subkey_name,
-                  "Software\\Python\\PythonCore\\%s\\InstallPath",
-                  core_version);
-        if (ERROR_SUCCESS == RegOpenKeyEx(hkRoot, subkey_name, 0, KEY_READ, &hk)) {
-            InstalledVersionInfo *ivi =
-                  (InstalledVersionInfo *)malloc(sizeof(InstalledVersionInfo));
-            value_size = sizeof(ivi->prefix);
-            if (ivi &&
-                ERROR_SUCCESS == RegQueryValueEx(hk, NULL, NULL, NULL,
-                                                 ivi->prefix, &value_size)) {
-                itemindex = SendMessage(hwnd, LB_ADDSTRING, 0,
-                                        (LPARAM)(LPSTR)vers_name);
-                ivi->hkey = hkRoot;
-                SendMessage(hwnd, LB_SETITEMDATA, itemindex,
-                            (LPARAM)(LPSTR)ivi);
-            }
-            RegCloseKey(hk);
-        }
-    }
-    RegCloseKey(hKey);
-    return result;
-}
-
-/* Determine if the current user can write to HKEY_LOCAL_MACHINE */
-BOOL HasLocalMachinePrivs()
-{
-                HKEY hKey;
-                DWORD result;
-                static char KeyName[] =
-                        "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
-
-                result = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
-                                          KeyName,
-                                          0,
-                                          KEY_CREATE_SUB_KEY,
-                                          &hKey);
-                if (result==0)
-                        RegCloseKey(hKey);
-                return result==0;
-}
-
-// Check the root registry key to use - either HKLM or HKCU.
-// If Python is installed in HKCU, then our extension also must be installed
-// in HKCU - as Python won't be available for other users, we shouldn't either
-// (and will fail if we are!)
-// If Python is installed in HKLM, then we will also prefer to use HKLM, but
-// this may not be possible - so we silently fall back to HKCU.
-//
-// We assume hkey_root is already set to where Python itself is installed.
-void CheckRootKey(HWND hwnd)
-{
-    if (hkey_root==HKEY_CURRENT_USER) {
-        ; // as above, always install ourself in HKCU too.
-    } else if (hkey_root==HKEY_LOCAL_MACHINE) {
-        // Python in HKLM, but we may or may not have permissions there.
-        // Open the uninstall key with 'create' permissions - if this fails,
-        // we don't have permission.
-        if (!HasLocalMachinePrivs())
-            hkey_root = HKEY_CURRENT_USER;
-    } else {
-        MessageBox(hwnd, "Don't know Python's installation type",
-                           "Strange", MB_OK | MB_ICONSTOP);
-        /* Default to wherever they can, but preferring HKLM */
-        hkey_root = HasLocalMachinePrivs() ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
-    }
-}
-
-/* Return the installation scheme depending on Python version number */
-SCHEME *GetScheme(int major, int minor)
-{
-    if (major > 2)
-        return new_scheme;
-    else if((major == 2) && (minor >= 2))
-        return new_scheme;
-    return old_scheme;
-}
-
-INT_PTR CALLBACK
-SelectPythonDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
-    LPNMHDR lpnm;
-
-    switch (msg) {
-    case WM_INITDIALOG:
-        if (hBitmap)
-            SendDlgItemMessage(hwnd, IDC_BITMAP, STM_SETIMAGE,
-                               IMAGE_BITMAP, (LPARAM)hBitmap);
-        GetPythonVersions(GetDlgItem(hwnd, IDC_VERSIONS_LIST),
-                           HKEY_LOCAL_MACHINE, target_version);
-        GetPythonVersions(GetDlgItem(hwnd, IDC_VERSIONS_LIST),
-                           HKEY_CURRENT_USER, target_version);
-        {               /* select the last entry which is the highest python
-                   version found */
-            int count;
-            count = SendDlgItemMessage(hwnd, IDC_VERSIONS_LIST,
-                                        LB_GETCOUNT, 0, 0);
-            if (count && count != LB_ERR)
-                SendDlgItemMessage(hwnd, IDC_VERSIONS_LIST, LB_SETCURSEL,
-                                    count-1, 0);
-
-            /* If a specific Python version is required,
-             * display a prominent notice showing this fact.
-             */
-            if (target_version && target_version[0]) {
-                char buffer[4096];
-                wsprintf(buffer,
-                         "Python %s is required for this package. "
-                         "Select installation to use:",
-                         target_version);
-                SetDlgItemText(hwnd, IDC_TITLE, buffer);
-            }
-
-            if (count == 0) {
-                char Buffer[4096];
-                const char *msg;
-                if (target_version && target_version[0]) {
-                    wsprintf(Buffer,
-                             "Python version %s required, which was not found"
-                             " in the registry.", target_version);
-                    msg = Buffer;
-                } else
-                    msg = "No Python installation found in the registry.";
-                MessageBox(hwnd, msg, "Cannot install",
-                           MB_OK | MB_ICONSTOP);
-            }
-        }
-        goto UpdateInstallDir;
-        break;
-
-    case WM_COMMAND:
-        switch (LOWORD(wParam)) {
-/*
-  case IDC_OTHERPYTHON:
-  if (GetOtherPythonVersion(GetDlgItem(hwnd, IDC_VERSIONS_LIST),
-  target_version))
-  goto UpdateInstallDir;
-  break;
-*/
-        case IDC_VERSIONS_LIST:
-            switch (HIWORD(wParam)) {
-                int id;
-            case LBN_SELCHANGE:
-              UpdateInstallDir:
-                PropSheet_SetWizButtons(GetParent(hwnd),
-                                        PSWIZB_BACK | PSWIZB_NEXT);
-                id = SendDlgItemMessage(hwnd, IDC_VERSIONS_LIST,
-                                         LB_GETCURSEL, 0, 0);
-                if (id == LB_ERR) {
-                    PropSheet_SetWizButtons(GetParent(hwnd),
-                                            PSWIZB_BACK);
-                    SetDlgItemText(hwnd, IDC_PATH, "");
-                    SetDlgItemText(hwnd, IDC_INSTALL_PATH, "");
-                    strcpy(python_dir, "");
-                    strcpy(pythondll, "");
-                } else {
-                    char *pbuf;
-                    int result;
-                    InstalledVersionInfo *ivi;
-                    PropSheet_SetWizButtons(GetParent(hwnd),
-                                            PSWIZB_BACK | PSWIZB_NEXT);
-                    /* Get the python directory */
-                    ivi = (InstalledVersionInfo *)
-                        SendDlgItemMessage(hwnd,
-                            IDC_VERSIONS_LIST,
-                            LB_GETITEMDATA,
-                            id,
-                            0);
-                    hkey_root = ivi->hkey;
-                    strcpy(python_dir, ivi->prefix);
-                    SetDlgItemText(hwnd, IDC_PATH, python_dir);
-                    /* retrieve the python version and pythondll to use */
-                    result = SendDlgItemMessage(hwnd, IDC_VERSIONS_LIST,
-                                                 LB_GETTEXTLEN, (WPARAM)id, 0);
-                    pbuf = (char *)malloc(result + 1);
-                    if (pbuf) {
-                        /* guess the name of the python-dll */
-                        SendDlgItemMessage(hwnd, IDC_VERSIONS_LIST,
-                                            LB_GETTEXT, (WPARAM)id,
-                                            (LPARAM)pbuf);
-                        result = sscanf(pbuf, "Python Version %d.%d",
-                                         &py_major, &py_minor);
-                        if (result == 2) {
-#ifdef _DEBUG
-                            wsprintf(pythondll, "python%d%d_d.dll",
-                                     py_major, py_minor);
-#else
-                            wsprintf(pythondll, "python%d%d.dll",
-                                     py_major, py_minor);
-#endif
-                        }
-                        free(pbuf);
-                    } else
-                        strcpy(pythondll, "");
-                    /* retrieve the scheme for this version */
-                    {
-                        char install_path[_MAX_PATH];
-                        SCHEME *scheme = GetScheme(py_major, py_minor);
-                        strcpy(install_path, python_dir);
-                        if (install_path[strlen(install_path)-1] != '\\')
-                            strcat(install_path, "\\");
-                        strcat(install_path, scheme[0].prefix);
-                        SetDlgItemText(hwnd, IDC_INSTALL_PATH, install_path);
-                    }
-                }
-            }
-            break;
-        }
-        return 0;
-
-    case WM_NOTIFY:
-        lpnm = (LPNMHDR) lParam;
-
-        switch (lpnm->code) {
-            int id;
-        case PSN_SETACTIVE:
-            id = SendDlgItemMessage(hwnd, IDC_VERSIONS_LIST,
-                                     LB_GETCURSEL, 0, 0);
-            if (id == LB_ERR)
-                PropSheet_SetWizButtons(GetParent(hwnd),
-                                        PSWIZB_BACK);
-            else
-                PropSheet_SetWizButtons(GetParent(hwnd),
-                                        PSWIZB_BACK | PSWIZB_NEXT);
-            break;
-
-        case PSN_WIZNEXT:
-            break;
-
-        case PSN_WIZFINISH:
-            break;
-
-        case PSN_RESET:
-            break;
-
-        default:
-            break;
-        }
-    }
-    return 0;
-}
-
-static BOOL OpenLogfile(char *dir)
-{
-    char buffer[_MAX_PATH+1];
-    time_t ltime;
-    struct tm *now;
-    long result;
-    HKEY hKey, hSubkey;
-    char subkey_name[256];
-    static char KeyName[] =
-        "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
-    const char *root_name = (hkey_root==HKEY_LOCAL_MACHINE ?
-                            "HKEY_LOCAL_MACHINE" : "HKEY_CURRENT_USER");
-    DWORD disposition;
-
-    /* Use Create, as the Uninstall subkey may not exist under HKCU.
-       Use CreateKeyEx, so we can specify a SAM specifying write access
-    */
-        result = RegCreateKeyEx(hkey_root,
-                      KeyName,
-                      0, /* reserved */
-                  NULL, /* class */
-                  0, /* options */
-                  KEY_CREATE_SUB_KEY, /* sam */
-                  NULL, /* security */
-                  &hKey, /* result key */
-                  NULL); /* disposition */
-    if (result != ERROR_SUCCESS) {
-        if (result == ERROR_ACCESS_DENIED) {
-            /* This should no longer be able to happen - we have already
-               checked if they have permissions in HKLM, and all users
-               should have write access to HKCU.
-            */
-            MessageBox(GetFocus(),
-                       "You do not seem to have sufficient access rights\n"
-                       "on this machine to install this software",
-                       NULL,
-                       MB_OK | MB_ICONSTOP);
-            return FALSE;
-        } else {
-            MessageBox(GetFocus(), KeyName, "Could not open key", MB_OK);
-        }
-    }
-
-    sprintf(buffer, "%s\\%s-wininst.log", dir, meta_name);
-    logfile = fopen(buffer, "a");
-    if (!logfile) {
-        char error[1024];
-
-        sprintf(error, "Can't create \"%s\" (%s).\n\n"
-                "Try to execute the installer as administrator.",
-                buffer, strerror(errno));
-        MessageBox(GetFocus(), error, NULL, MB_OK | MB_ICONSTOP);
-        return FALSE;
-    }
-
-    time(&ltime);
-    now = localtime(&ltime);
-    strftime(buffer, sizeof(buffer),
-             "*** Installation started %Y/%m/%d %H:%M ***\n",
-             localtime(&ltime));
-    fprintf(logfile, buffer);
-    fprintf(logfile, "Source: %s\n", modulename);
-
-    /* Root key must be first entry processed by uninstaller. */
-    fprintf(logfile, "999 Root Key: %s\n", root_name);
-
-    sprintf(subkey_name, "%s-py%d.%d", meta_name, py_major, py_minor);
-
-    result = RegCreateKeyEx(hKey, subkey_name,
-                            0, NULL, 0,
-                            KEY_WRITE,
-                            NULL,
-                            &hSubkey,
-                            &disposition);
-
-    if (result != ERROR_SUCCESS)
-        MessageBox(GetFocus(), subkey_name, "Could not create key", MB_OK);
-
-    RegCloseKey(hKey);
-
-    if (disposition == REG_CREATED_NEW_KEY)
-        fprintf(logfile, "020 Reg DB Key: [%s]%s\n", KeyName, subkey_name);
-
-    sprintf(buffer, "Python %d.%d %s", py_major, py_minor, title);
-
-    result = RegSetValueEx(hSubkey, "DisplayName",
-                           0,
-                           REG_SZ,
-                           buffer,
-                           strlen(buffer)+1);
-
-    if (result != ERROR_SUCCESS)
-        MessageBox(GetFocus(), buffer, "Could not set key value", MB_OK);
-
-    fprintf(logfile, "040 Reg DB Value: [%s\\%s]%s=%s\n",
-        KeyName, subkey_name, "DisplayName", buffer);
-
-    {
-        FILE *fp;
-        sprintf(buffer, "%s\\Remove%s.exe", dir, meta_name);
-        fp = fopen(buffer, "wb");
-        fwrite(arc_data, exe_size, 1, fp);
-        fclose(fp);
-
-        sprintf(buffer, "\"%s\\Remove%s.exe\" -u \"%s\\%s-wininst.log\"",
-            dir, meta_name, dir, meta_name);
-
-        result = RegSetValueEx(hSubkey, "UninstallString",
-                               0,
-                               REG_SZ,
-                               buffer,
-                               strlen(buffer)+1);
-
-        if (result != ERROR_SUCCESS)
-            MessageBox(GetFocus(), buffer, "Could not set key value", MB_OK);
-
-        fprintf(logfile, "040 Reg DB Value: [%s\\%s]%s=%s\n",
-            KeyName, subkey_name, "UninstallString", buffer);
-    }
-    return TRUE;
-}
-
-static void CloseLogfile(void)
-{
-    char buffer[_MAX_PATH+1];
-    time_t ltime;
-    struct tm *now;
-
-    time(&ltime);
-    now = localtime(&ltime);
-    strftime(buffer, sizeof(buffer),
-             "*** Installation finished %Y/%m/%d %H:%M ***\n",
-             localtime(&ltime));
-    fprintf(logfile, buffer);
-    if (logfile)
-        fclose(logfile);
-}
-
-INT_PTR CALLBACK
-InstallFilesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
-    LPNMHDR lpnm;
-    char Buffer[4096];
-    SCHEME *scheme;
-
-    switch (msg) {
-    case WM_INITDIALOG:
-        if (hBitmap)
-            SendDlgItemMessage(hwnd, IDC_BITMAP, STM_SETIMAGE,
-                               IMAGE_BITMAP, (LPARAM)hBitmap);
-        wsprintf(Buffer,
-                  "Click Next to begin the installation of %s. "
-                  "If you want to review or change any of your "
-                  " installation settings, click Back. "
-                  "Click Cancel to exit the wizard.",
-                  meta_name);
-        SetDlgItemText(hwnd, IDC_TITLE, Buffer);
-        SetDlgItemText(hwnd, IDC_INFO, "Ready to install");
-        break;
-
-    case WM_NUMFILES:
-        SendDlgItemMessage(hwnd, IDC_PROGRESS, PBM_SETRANGE, 0, lParam);
-        PumpMessages();
-        return TRUE;
-
-    case WM_NEXTFILE:
-        SendDlgItemMessage(hwnd, IDC_PROGRESS, PBM_SETPOS, wParam,
-                            0);
-        SetDlgItemText(hwnd, IDC_INFO, (LPSTR)lParam);
-        PumpMessages();
-        return TRUE;
-
-    case WM_NOTIFY:
-        lpnm = (LPNMHDR) lParam;
-
-        switch (lpnm->code) {
-        case PSN_SETACTIVE:
-            PropSheet_SetWizButtons(GetParent(hwnd),
-                                    PSWIZB_BACK | PSWIZB_NEXT);
-            break;
-
-        case PSN_WIZFINISH:
-            break;
-
-        case PSN_WIZNEXT:
-            /* Handle a Next button click here */
-            hDialog = hwnd;
-            success = TRUE;
-
-            /* Disable the buttons while we work.  Sending CANCELTOCLOSE has
-              the effect of disabling the cancel button, which is a) as we
-              do everything synchronously we can't cancel, and b) the next
-              step is 'finished', when it is too late to cancel anyway.
-              The next step being 'Finished' means we also don't need to
-              restore the button state back */
-            PropSheet_SetWizButtons(GetParent(hwnd), 0);
-            SendMessage(GetParent(hwnd), PSM_CANCELTOCLOSE, 0, 0);
-            /* Make sure the installation directory name ends in a */
-            /* backslash */
-            if (python_dir[strlen(python_dir)-1] != '\\')
-                strcat(python_dir, "\\");
-            /* Strip the trailing backslash again */
-            python_dir[strlen(python_dir)-1] = '\0';
-
-            CheckRootKey(hwnd);
-
-            if (!OpenLogfile(python_dir))
-                break;
-
-/*
- * The scheme we have to use depends on the Python version...
- if sys.version < "2.2":
-    WINDOWS_SCHEME = {
-    'purelib': '$base',
-    'platlib': '$base',
-    'headers': '$base/Include/$dist_name',
-    'scripts': '$base/Scripts',
-    'data'   : '$base',
-    }
- else:
-    WINDOWS_SCHEME = {
-    'purelib': '$base/Lib/site-packages',
-    'platlib': '$base/Lib/site-packages',
-    'headers': '$base/Include/$dist_name',
-    'scripts': '$base/Scripts',
-    'data'   : '$base',
-    }
-*/
-            scheme = GetScheme(py_major, py_minor);
-            /* Run the pre-install script. */
-            if (pre_install_script && *pre_install_script) {
-                SetDlgItemText (hwnd, IDC_TITLE,
-                                "Running pre-installation script");
-                run_simple_script(pre_install_script);
-            }
-            if (!success) {
-                break;
-            }
-            /* Extract all files from the archive */
-            SetDlgItemText(hwnd, IDC_TITLE, "Installing files...");
-            if (!unzip_archive (scheme,
-                                python_dir, arc_data,
-                                arc_size, notify))
-                set_failure_reason("Failed to unzip installation files");
-            /* Compile the py-files */
-            if (success && pyc_compile) {
-                int errors;
-                HINSTANCE hPython;
-                SetDlgItemText(hwnd, IDC_TITLE,
-                                "Compiling files to .pyc...");
-
-                SetDlgItemText(hDialog, IDC_INFO, "Loading python...");
-                hPython = LoadPythonDll(pythondll);
-                if (hPython) {
-                    errors = compile_filelist(hPython, FALSE);
-                    FreeLibrary(hPython);
-                }
-                /* Compilation errors are intentionally ignored:
-                 * Python2.0 contains a bug which will result
-                 * in sys.path containing garbage under certain
-                 * circumstances, and an error message will only
-                 * confuse the user.
-                 */
-            }
-            if (success && pyo_compile) {
-                int errors;
-                HINSTANCE hPython;
-                SetDlgItemText(hwnd, IDC_TITLE,
-                                "Compiling files to .pyo...");
-
-                SetDlgItemText(hDialog, IDC_INFO, "Loading python...");
-                hPython = LoadPythonDll(pythondll);
-                if (hPython) {
-                    errors = compile_filelist(hPython, TRUE);
-                    FreeLibrary(hPython);
-                }
-                /* Errors ignored: see above */
-            }
-
-
-            break;
-
-        case PSN_RESET:
-            break;
-
-        default:
-            break;
-        }
-    }
-    return 0;
-}
-
-
-INT_PTR CALLBACK
-FinishedDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
-    LPNMHDR lpnm;
-
-    switch (msg) {
-    case WM_INITDIALOG:
-        if (hBitmap)
-            SendDlgItemMessage(hwnd, IDC_BITMAP, STM_SETIMAGE,
-                               IMAGE_BITMAP, (LPARAM)hBitmap);
-        if (!success)
-            SetDlgItemText(hwnd, IDC_INFO, get_failure_reason());
-
-        /* async delay: will show the dialog box completely before
-           the install_script is started */
-        PostMessage(hwnd, WM_USER, 0, 0L);
-        return TRUE;
-
-    case WM_USER:
-
-        if (success && install_script && install_script[0]) {
-            char fname[MAX_PATH];
-            char *buffer;
-            HCURSOR hCursor;
-            int result;
-
-            char *argv[3] = {NULL, "-install", NULL};
-
-            SetDlgItemText(hwnd, IDC_TITLE,
-                            "Please wait while running postinstall script...");
-            strcpy(fname, python_dir);
-            strcat(fname, "\\Scripts\\");
-            strcat(fname, install_script);
-
-            if (logfile)
-                fprintf(logfile, "300 Run Script: [%s]%s\n", pythondll, fname);
-
-            hCursor = SetCursor(LoadCursor(NULL, IDC_WAIT));
-
-            argv[0] = fname;
-
-            result = run_installscript(fname, 2, argv, &buffer);
-            if (0 != result) {
-                fprintf(stderr, "*** run_installscript: internal error 0x%X ***\n", result);
-            }
-            if (buffer)
-                SetDlgItemText(hwnd, IDC_INFO, buffer);
-            SetDlgItemText(hwnd, IDC_TITLE,
-                            "Postinstall script finished.\n"
-                            "Click the Finish button to exit the Setup wizard.");
-
-            free(buffer);
-            SetCursor(hCursor);
-            CloseLogfile();
-        }
-
-        return TRUE;
-
-    case WM_NOTIFY:
-        lpnm = (LPNMHDR) lParam;
-
-        switch (lpnm->code) {
-        case PSN_SETACTIVE: /* Enable the Finish button */
-            PropSheet_SetWizButtons(GetParent(hwnd), PSWIZB_FINISH);
-            break;
-
-        case PSN_WIZNEXT:
-            break;
-
-        case PSN_WIZFINISH:
-            break;
-
-        case PSN_RESET:
-            break;
-
-        default:
-            break;
-        }
-    }
-    return 0;
-}
-
-void RunWizard(HWND hwnd)
-{
-    PROPSHEETPAGE   psp =       {0};
-    HPROPSHEETPAGE  ahpsp[4] =  {0};
-    PROPSHEETHEADER psh =       {0};
-
-    /* Display module information */
-    psp.dwSize =        sizeof(psp);
-    psp.dwFlags =       PSP_DEFAULT|PSP_HIDEHEADER;
-    psp.hInstance =     GetModuleHandle (NULL);
-    psp.lParam =        0;
-    psp.pfnDlgProc =    IntroDlgProc;
-    psp.pszTemplate =   MAKEINTRESOURCE(IDD_INTRO);
-
-    ahpsp[0] =          CreatePropertySheetPage(&psp);
-
-    /* Select python version to use */
-    psp.dwFlags =       PSP_DEFAULT|PSP_HIDEHEADER;
-    psp.pszTemplate =       MAKEINTRESOURCE(IDD_SELECTPYTHON);
-    psp.pfnDlgProc =        SelectPythonDlgProc;
-
-    ahpsp[1] =              CreatePropertySheetPage(&psp);
-
-    /* Install the files */
-    psp.dwFlags =           PSP_DEFAULT|PSP_HIDEHEADER;
-    psp.pszTemplate =       MAKEINTRESOURCE(IDD_INSTALLFILES);
-    psp.pfnDlgProc =        InstallFilesDlgProc;
-
-    ahpsp[2] =              CreatePropertySheetPage(&psp);
-
-    /* Show success or failure */
-    psp.dwFlags =           PSP_DEFAULT|PSP_HIDEHEADER;
-    psp.pszTemplate =       MAKEINTRESOURCE(IDD_FINISHED);
-    psp.pfnDlgProc =        FinishedDlgProc;
-
-    ahpsp[3] =              CreatePropertySheetPage(&psp);
-
-    /* Create the property sheet */
-    psh.dwSize =            sizeof(psh);
-    psh.hInstance =         GetModuleHandle(NULL);
-    psh.hwndParent =        hwnd;
-    psh.phpage =            ahpsp;
-    psh.dwFlags =           PSH_WIZARD/*97*//*|PSH_WATERMARK|PSH_HEADER*/;
-        psh.pszbmWatermark =    NULL;
-        psh.pszbmHeader =       NULL;
-        psh.nStartPage =        0;
-        psh.nPages =            4;
-
-        PropertySheet(&psh);
-}
-
-// subtly different from HasLocalMachinePrivs(), in that after executing
-// an 'elevated' process, we expect this to return TRUE - but there is no
-// such implication for HasLocalMachinePrivs
-BOOL MyIsUserAnAdmin()
-{
-    typedef BOOL (WINAPI *PFNIsUserAnAdmin)();
-    static PFNIsUserAnAdmin pfnIsUserAnAdmin = NULL;
-    HMODULE shell32;
-    // This function isn't guaranteed to be available (and it can't hurt
-    // to leave the library loaded)
-    if (0 == (shell32=LoadLibrary("shell32.dll")))
-        return FALSE;
-    if (NULL == (pfnIsUserAnAdmin=(PFNIsUserAnAdmin)GetProcAddress(shell32, "IsUserAnAdmin")))
-        return FALSE;
-    return (*pfnIsUserAnAdmin)();
-}
-
-// Some magic for Vista's UAC.  If there is a target_version, and
-// if that target version is installed in the registry under
-// HKLM, and we are not current administrator, then
-// re-execute ourselves requesting elevation.
-// Split into 2 functions - "should we elevate" and "spawn elevated"
-
-// Returns TRUE if we should spawn an elevated child
-BOOL NeedAutoUAC()
-{
-    HKEY hk;
-    char key_name[80];
-    // no Python version info == we can't know yet.
-    if (target_version[0] == '\0')
-        return FALSE;
-    // see how python is current installed
-    wsprintf(key_name,
-                     "Software\\Python\\PythonCore\\%s\\InstallPath",
-                     target_version);
-    if (ERROR_SUCCESS != RegOpenKeyEx(HKEY_LOCAL_MACHINE,
-                                      key_name, 0, KEY_READ, &hk))
-        return FALSE;
-    RegCloseKey(hk);
-    // Python is installed in HKLM - we must elevate.
-    return TRUE;
-}
-
-// Spawn ourself as an elevated application.  On failure, a message is
-// displayed to the user - but this app will always terminate, even
-// on error.
-void SpawnUAC()
-{
-    // interesting failure scenario that has been seen: initial executable
-    // runs from a network drive - but once elevated, that network share
-    // isn't seen, and ShellExecute fails with SE_ERR_ACCESSDENIED.
-    int ret = (int)ShellExecute(0, "runas", modulename, "", NULL,
-                                SW_SHOWNORMAL);
-    if (ret <= 32) {
-        char msg[128];
-        wsprintf(msg, "Failed to start elevated process (ShellExecute returned %d)", ret);
-        MessageBox(0, msg, "Setup", MB_OK | MB_ICONERROR);
-    }
-}
-
-int DoInstall(void)
-{
-    char ini_buffer[4096];
-
-    /* Read installation information */
-    GetPrivateProfileString("Setup", "title", "", ini_buffer,
-                             sizeof(ini_buffer), ini_file);
-    unescape(title, ini_buffer, sizeof(title));
-
-    GetPrivateProfileString("Setup", "info", "", ini_buffer,
-                             sizeof(ini_buffer), ini_file);
-    unescape(info, ini_buffer, sizeof(info));
-
-    GetPrivateProfileString("Setup", "build_info", "", build_info,
-                             sizeof(build_info), ini_file);
-
-    pyc_compile = GetPrivateProfileInt("Setup", "target_compile", 1,
-                                        ini_file);
-    pyo_compile = GetPrivateProfileInt("Setup", "target_optimize", 1,
-                                        ini_file);
-
-    GetPrivateProfileString("Setup", "target_version", "",
-                             target_version, sizeof(target_version),
-                             ini_file);
-
-    GetPrivateProfileString("metadata", "name", "",
-                             meta_name, sizeof(meta_name),
-                             ini_file);
-
-    GetPrivateProfileString("Setup", "install_script", "",
-                             install_script, sizeof(install_script),
-                             ini_file);
-
-    GetPrivateProfileString("Setup", "user_access_control", "",
-                             user_access_control, sizeof(user_access_control), ini_file);
-
-    strcat(target_version, REGISTRY_SUFFIX_6432);
-
-    // See if we need to do the Vista UAC magic.
-    if (strcmp(user_access_control, "force")==0) {
-        if (!MyIsUserAnAdmin()) {
-            SpawnUAC();
-            return 0;
-        }
-        // already admin - keep going
-    } else if (strcmp(user_access_control, "auto")==0) {
-        // Check if it looks like we need UAC control, based
-        // on how Python itself was installed.
-        if (!MyIsUserAnAdmin() && NeedAutoUAC()) {
-            SpawnUAC();
-            return 0;
-        }
-    } else {
-        // display a warning about unknown values - only the developer
-        // of the extension will see it (until they fix it!)
-        if (user_access_control[0] && strcmp(user_access_control, "none") != 0) {
-            MessageBox(GetFocus(), "Bad user_access_control value", "oops", MB_OK);
-        // nothing to do.
-        }
-    }
-
-    hwndMain = CreateBackground(title);
-
-    RunWizard(hwndMain);
-
-    /* Clean up */
-    UnmapViewOfFile(arc_data);
-    if (ini_file)
-        DeleteFile(ini_file);
-
-    if (hBitmap)
-        DeleteObject(hBitmap);
-
-    return 0;
-}
-
-/*********************** uninstall section ******************************/
-
-static int compare(const void *p1, const void *p2)
-{
-    return strcmp(*(char **)p2, *(char **)p1);
-}
-
-/*
- * Commit suicide (remove the uninstaller itself).
- *
- * Create a batch file to first remove the uninstaller
- * (will succeed after it has finished), then the batch file itself.
- *
- * This technique has been demonstrated by Jeff Richter,
- * MSJ 1/1996
- */
-void remove_exe(void)
-{
-    char exename[_MAX_PATH];
-    char batname[_MAX_PATH];
-    FILE *fp;
-    STARTUPINFO si;
-    PROCESS_INFORMATION pi;
-
-    GetModuleFileName(NULL, exename, sizeof(exename));
-    sprintf(batname, "%s.bat", exename);
-    fp = fopen(batname, "w");
-    fprintf(fp, ":Repeat\n");
-    fprintf(fp, "del \"%s\"\n", exename);
-    fprintf(fp, "if exist \"%s\" goto Repeat\n", exename);
-    fprintf(fp, "del \"%s\"\n", batname);
-    fclose(fp);
-
-    ZeroMemory(&si, sizeof(si));
-    si.cb = sizeof(si);
-    si.dwFlags = STARTF_USESHOWWINDOW;
-    si.wShowWindow = SW_HIDE;
-    if (CreateProcess(NULL,
-                      batname,
-                      NULL,
-                      NULL,
-                      FALSE,
-                      CREATE_SUSPENDED | IDLE_PRIORITY_CLASS,
-                      NULL,
-                      "\\",
-                      &si,
-                      &pi)) {
-        SetThreadPriority(pi.hThread, THREAD_PRIORITY_IDLE);
-        SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
-        SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS);
-        CloseHandle(pi.hProcess);
-        ResumeThread(pi.hThread);
-        CloseHandle(pi.hThread);
-    }
-}
-
-void DeleteRegistryKey(char *string)
-{
-    char *keyname;
-    char *subkeyname;
-    char *delim;
-    HKEY hKey;
-    long result;
-    char *line;
-
-    line = strdup(string); /* so we can change it */
-
-    keyname = strchr(line, '[');
-    if (!keyname)
-        return;
-    ++keyname;
-
-    subkeyname = strchr(keyname, ']');
-    if (!subkeyname)
-        return;
-    *subkeyname++='\0';
-    delim = strchr(subkeyname, '\n');
-    if (delim)
-        *delim = '\0';
-
-    result = RegOpenKeyEx(hkey_root,
-                          keyname,
-                          0,
-                          KEY_WRITE,
-                          &hKey);
-
-    if (result != ERROR_SUCCESS)
-        MessageBox(GetFocus(), string, "Could not open key", MB_OK);
-    else {
-        result = RegDeleteKey(hKey, subkeyname);
-        if (result != ERROR_SUCCESS && result != ERROR_FILE_NOT_FOUND)
-            MessageBox(GetFocus(), string, "Could not delete key", MB_OK);
-        RegCloseKey(hKey);
-    }
-    free(line);
-}
-
-void DeleteRegistryValue(char *string)
-{
-    char *keyname;
-    char *valuename;
-    char *value;
-    HKEY hKey;
-    long result;
-    char *line;
-
-    line = strdup(string); /* so we can change it */
-
-/* Format is 'Reg DB Value: [key]name=value' */
-    keyname = strchr(line, '[');
-    if (!keyname)
-        return;
-    ++keyname;
-    valuename = strchr(keyname, ']');
-    if (!valuename)
-        return;
-    *valuename++ = '\0';
-    value = strchr(valuename, '=');
-    if (!value)
-        return;
-
-    *value++ = '\0';
-
-    result = RegOpenKeyEx(hkey_root,
-                          keyname,
-                          0,
-                          KEY_WRITE,
-                          &hKey);
-    if (result != ERROR_SUCCESS)
-        MessageBox(GetFocus(), string, "Could not open key", MB_OK);
-    else {
-        result = RegDeleteValue(hKey, valuename);
-        if (result != ERROR_SUCCESS && result != ERROR_FILE_NOT_FOUND)
-            MessageBox(GetFocus(), string, "Could not delete value", MB_OK);
-        RegCloseKey(hKey);
-    }
-    free(line);
-}
-
-BOOL MyDeleteFile(char *line)
-{
-    char *pathname = strchr(line, ':');
-    if (!pathname)
-        return FALSE;
-    ++pathname;
-    while (isspace(*pathname))
-        ++pathname;
-    return DeleteFile(pathname);
-}
-
-BOOL MyRemoveDirectory(char *line)
-{
-    char *pathname = strchr(line, ':');
-    if (!pathname)
-        return FALSE;
-    ++pathname;
-    while (isspace(*pathname))
-        ++pathname;
-    return RemoveDirectory(pathname);
-}
-
-BOOL Run_RemoveScript(char *line)
-{
-    char *dllname;
-    char *scriptname;
-    static char lastscript[MAX_PATH];
-
-/* Format is 'Run Scripts: [pythondll]scriptname' */
-/* XXX Currently, pythondll carries no path!!! */
-    dllname = strchr(line, '[');
-    if (!dllname)
-        return FALSE;
-    ++dllname;
-    scriptname = strchr(dllname, ']');
-    if (!scriptname)
-        return FALSE;
-    *scriptname++ = '\0';
-    /* this function may be called more than one time with the same
-       script, only run it one time */
-    if (strcmp(lastscript, scriptname)) {
-        char *argv[3] = {NULL, "-remove", NULL};
-        char *buffer = NULL;
-
-        argv[0] = scriptname;
-
-        if (0 != run_installscript(scriptname, 2, argv, &buffer))
-            fprintf(stderr, "*** Could not run installation script ***");
-
-        if (buffer && buffer[0])
-            MessageBox(GetFocus(), buffer, "uninstall-script", MB_OK);
-        free(buffer);
-
-        strcpy(lastscript, scriptname);
-    }
-    return TRUE;
-}
-
-int DoUninstall(int argc, char **argv)
-{
-    FILE *logfile;
-    char buffer[4096];
-    int nLines = 0;
-    int i;
-    char *cp;
-    int nFiles = 0;
-    int nDirs = 0;
-    int nErrors = 0;
-    char **lines;
-    int lines_buffer_size = 10;
-
-    if (argc != 3) {
-        MessageBox(NULL,
-                   "Wrong number of args",
-                   NULL,
-                   MB_OK);
-        return 1; /* Error */
-    }
-    if (strcmp(argv[1], "-u")) {
-        MessageBox(NULL,
-                   "2. arg is not -u",
-                   NULL,
-                   MB_OK);
-        return 1; /* Error */
-    }
-
-    logfile = fopen(argv[2], "r");
-    if (!logfile) {
-        MessageBox(NULL,
-                   "could not open logfile",
-                   NULL,
-                   MB_OK);
-        return 1; /* Error */
-    }
-
-    lines = (char **)malloc(sizeof(char *) * lines_buffer_size);
-    if (!lines)
-        return SystemError(0, "Out of memory");
-
-    /* Read the whole logfile, reallocating the buffer */
-    while (fgets(buffer, sizeof(buffer), logfile)) {
-        int len = strlen(buffer);
-        /* remove trailing white space */
-        while (isspace(buffer[len-1]))
-            len -= 1;
-        buffer[len] = '\0';
-        lines[nLines++] = strdup(buffer);
-        if (nLines >= lines_buffer_size) {
-            lines_buffer_size += 10;
-            lines = (char **)realloc(lines,
-                                     sizeof(char *) * lines_buffer_size);
-            if (!lines)
-                return SystemError(0, "Out of memory");
-        }
-    }
-    fclose(logfile);
-
-    /* Sort all the lines, so that highest 3-digit codes are first */
-    qsort(&lines[0], nLines, sizeof(char *),
-          compare);
-
-    if (IDYES != MessageBox(NULL,
-                            "Are you sure you want to remove\n"
-                            "this package from your computer?",
-                            "Please confirm",
-                            MB_YESNO | MB_ICONQUESTION))
-        return 0;
-
-    hkey_root = HKEY_LOCAL_MACHINE;
-    cp = "";
-    for (i = 0; i < nLines; ++i) {
-        /* Ignore duplicate lines */
-        if (strcmp(cp, lines[i])) {
-            int ign;
-            cp = lines[i];
-            /* Parse the lines */
-            if (2 == sscanf(cp, "%d Root Key: %s", &ign, &buffer)) {
-                if (strcmp(buffer, "HKEY_CURRENT_USER")==0)
-                    hkey_root = HKEY_CURRENT_USER;
-                else {
-                    // HKLM - check they have permissions.
-                    if (!HasLocalMachinePrivs()) {
-                        MessageBox(GetFocus(),
-                                   "You do not seem to have sufficient access rights\n"
-                                   "on this machine to uninstall this software",
-                                   NULL,
-                                   MB_OK | MB_ICONSTOP);
-                        return 1; /* Error */
-                    }
-                }
-            } else if (2 == sscanf(cp, "%d Made Dir: %s", &ign, &buffer)) {
-                if (MyRemoveDirectory(cp))
-                    ++nDirs;
-                else {
-                    int code = GetLastError();
-                    if (code != 2 && code != 3) { /* file or path not found */
-                        ++nErrors;
-                    }
-                }
-            } else if (2 == sscanf(cp, "%d File Copy: %s", &ign, &buffer)) {
-                if (MyDeleteFile(cp))
-                    ++nFiles;
-                else {
-                    int code = GetLastError();
-                    if (code != 2 && code != 3) { /* file or path not found */
-                        ++nErrors;
-                    }
-                }
-            } else if (2 == sscanf(cp, "%d File Overwrite: %s", &ign, &buffer)) {
-                if (MyDeleteFile(cp))
-                    ++nFiles;
-                else {
-                    int code = GetLastError();
-                    if (code != 2 && code != 3) { /* file or path not found */
-                        ++nErrors;
-                    }
-                }
-            } else if (2 == sscanf(cp, "%d Reg DB Key: %s", &ign, &buffer)) {
-                DeleteRegistryKey(cp);
-            } else if (2 == sscanf(cp, "%d Reg DB Value: %s", &ign, &buffer)) {
-                DeleteRegistryValue(cp);
-            } else if (2 == sscanf(cp, "%d Run Script: %s", &ign, &buffer)) {
-                Run_RemoveScript(cp);
-            }
-        }
-    }
-
-    if (DeleteFile(argv[2])) {
-        ++nFiles;
-    } else {
-        ++nErrors;
-        SystemError(GetLastError(), argv[2]);
-    }
-    if (nErrors)
-        wsprintf(buffer,
-                 "%d files and %d directories removed\n"
-                 "%d files or directories could not be removed",
-                 nFiles, nDirs, nErrors);
-    else
-        wsprintf(buffer, "%d files and %d directories removed",
-                 nFiles, nDirs);
-    MessageBox(NULL, buffer, "Uninstall Finished!",
-               MB_OK | MB_ICONINFORMATION);
-    remove_exe();
-    return 0;
-}
-
-int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst,
-                    LPSTR lpszCmdLine, INT nCmdShow)
-{
-    extern int __argc;
-    extern char **__argv;
-    char *basename;
-
-    GetModuleFileName(NULL, modulename, sizeof(modulename));
-    GetModuleFileNameW(NULL, wmodulename, sizeof(wmodulename)/sizeof(wmodulename[0]));
-
-    /* Map the executable file to memory */
-    arc_data = MapExistingFile(modulename, &arc_size);
-    if (!arc_data) {
-        SystemError(GetLastError(), "Could not open archive");
-        return 1;
-    }
-
-    /* OK. So this program can act as installer (self-extracting
-     * zip-file, or as uninstaller when started with '-u logfile'
-     * command line flags.
-     *
-     * The installer is usually started without command line flags,
-     * and the uninstaller is usually started with the '-u logfile'
-     * flag. What to do if some innocent user double-clicks the
-     * exe-file?
-     * The following implements a defensive strategy...
-     */
-
-    /* Try to extract the configuration data into a temporary file */
-    if (ExtractInstallData(arc_data, arc_size, &exe_size,
-                           &ini_file, &pre_install_script))
-        return DoInstall();
-
-    if (!ini_file && __argc > 1) {
-        return DoUninstall(__argc, __argv);
-    }
-
-
-    basename = strrchr(modulename, '\\');
-    if (basename)
-        ++basename;
-
-    /* Last guess about the purpose of this program */
-    if (basename && (0 == strncmp(basename, "Remove", 6)))
-        SystemError(0, "This program is normally started by windows");
-    else
-        SystemError(0, "Setup program invalid or damaged");
-    return 1;
-}
diff --git a/PC/bdist_wininst/install.rc b/PC/bdist_wininst/install.rc
deleted file mode 100644
index dfa2ffc..0000000
--- a/PC/bdist_wininst/install.rc
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
-  IMPORTANT NOTE: IF THIS FILE IS CHANGED, PCBUILD\BDIST_WININST.VCXPROJ MUST
-  BE REBUILT AS WELL.
-
-  IF CHANGES TO THIS FILE ARE CHECKED IN, THE RECOMPILED BINARIES MUST BE
-  CHECKED IN AS WELL!
-*/
-
-#include <winres.h>
-#include "resource.h"
-
-LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-#pragma code_page(1252)
-
-IDB_BITMAP              BITMAP  DISCARDABLE     "PythonPowered.bmp"
-
-
-IDD_INTRO DIALOGEX 0, 0, 379, 178
-STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
-CAPTION "Setup"
-FONT 8, "MS Sans Serif", 0, 0, 0x1
-BEGIN
-    LTEXT           "This Wizard will install %s on your computer. Click Next to continue or Cancel to exit the Setup Wizard.",
-                    IDC_TITLE,125,10,247,20,NOT WS_GROUP
-    EDITTEXT        IDC_INTRO_TEXT,125,31,247,131,ES_MULTILINE | ES_READONLY | 
-                    WS_VSCROLL | WS_HSCROLL | NOT WS_TABSTOP
-    CONTROL         110,IDC_BITMAP,"Static",SS_BITMAP | SS_CENTERIMAGE,6,8,
-                    104,163,WS_EX_CLIENTEDGE
-    LTEXT           "",IDC_BUILD_INFO,125,163,247,8
-END
-
-IDD_SELECTPYTHON DIALOGEX 0, 0, 379, 178
-STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
-CAPTION "Setup"
-FONT 8, "MS Sans Serif", 0, 0, 0x1
-BEGIN
-    LTEXT           "Select python installation to use:",IDC_TITLE,125,10,
-                    247,12,NOT WS_GROUP
-    EDITTEXT        IDC_PATH,191,136,181,14,ES_AUTOHSCROLL | ES_READONLY
-    LTEXT           "Python Directory:",IDC_STATIC,125,137,55,8
-    LISTBOX         IDC_VERSIONS_LIST,125,24,247,106,LBS_SORT | 
-                    LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
-    CONTROL         110,IDC_BITMAP,"Static",SS_BITMAP | SS_CENTERIMAGE,6,8,
-                    104,163,WS_EX_CLIENTEDGE
-    EDITTEXT        IDC_INSTALL_PATH,191,157,181,14,ES_AUTOHSCROLL | 
-                    ES_READONLY
-    LTEXT           "Installation Directory:",IDC_STATIC,125,158,66,8
-    PUSHBUTTON      "Find other ...",IDC_OTHERPYTHON,322,7,50,14,NOT 
-                    WS_VISIBLE
-END
-
-IDD_INSTALLFILES DIALOGEX 0, 0, 379, 178
-STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
-CAPTION "Setup"
-FONT 8, "MS Sans Serif", 0, 0, 0x1
-BEGIN
-    LTEXT           "Click Next to begin the installation. If you want to review or change any of your installation settings, click Back. Click Cancel to exit the Wizard.",
-                    IDC_TITLE,125,10,246,31,NOT WS_GROUP
-    CONTROL         "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER,
-                    125,157,246,14
-    CTEXT           "Installation progress:",IDC_INFO,125,137,246,8
-    CONTROL         110,IDC_BITMAP,"Static",SS_BITMAP | SS_CENTERIMAGE,6,8,
-                    104,163,WS_EX_CLIENTEDGE
-END
-
-IDD_FINISHED DIALOGEX 0, 0, 379, 178
-STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
-CAPTION "Setup"
-FONT 8, "MS Sans Serif"
-BEGIN
-    LTEXT           "Click the Finish button to exit the Setup wizard.",
-                    IDC_TITLE,125,10,247,31,NOT WS_GROUP
-    CONTROL         110,IDC_BITMAP,"Static",SS_BITMAP | SS_CENTERIMAGE,6,8,
-                    104,163,WS_EX_CLIENTEDGE
-    EDITTEXT        IDC_INFO,125,40,247,131,ES_MULTILINE | ES_READONLY | 
-                    WS_VSCROLL | WS_HSCROLL | NOT WS_TABSTOP
-END
diff --git a/PC/bdist_wininst/resource.h b/PC/bdist_wininst/resource.h
deleted file mode 100644
index 86aeabb..0000000
--- a/PC/bdist_wininst/resource.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-  IMPORTANT NOTE: IF THIS FILE IS CHANGED, PCBUILD\BDIST_WININST.VCXPROJ MUST
-  BE REBUILT AS WELL.
-
-  IF CHANGES TO THIS FILE ARE CHECKED IN, THE RECOMPILED BINARIES MUST BE
-  CHECKED IN AS WELL!
-*/
-
-#define IDD_DIALOG1                     101
-#define IDB_BITMAP1                     103
-#define IDD_INTRO                       107
-#define IDD_SELECTPYTHON                108
-#define IDD_INSTALLFILES                109
-#define IDD_FINISHED                    110
-#define IDB_BITMAP                      110
-#define IDC_EDIT1                       1000
-#define IDC_TITLE                       1000
-#define IDC_START                       1001
-#define IDC_PROGRESS                    1003
-#define IDC_INFO                        1004
-#define IDC_PYTHON15                    1006
-#define IDC_PATH                        1007
-#define IDC_PYTHON16                    1008
-#define IDC_INSTALL_PATH                1008
-#define IDC_PYTHON20                    1009
-#define IDC_BROWSE                      1010
-#define IDC_INTRO_TEXT                  1021
-#define IDC_VERSIONS_LIST               1022
-#define IDC_BUILD_INFO                  1024
-#define IDC_BITMAP                      1025
-#define IDC_OTHERPYTHON                 1026
diff --git a/PC/classicAppCompat.can.xml b/PC/classicAppCompat.can.xml
index f00475c..df361f8 100644
--- a/PC/classicAppCompat.can.xml
+++ b/PC/classicAppCompat.can.xml
@@ -1 +1 @@
-<CustomCapabilityDescriptor xmlns="http://schemas.microsoft.com/appx/2016/sccd" xmlns:s="http://schemas.microsoft.com/appx/2016/sccd"><CustomCapabilities><CustomCapability Name="Microsoft.classicAppCompat_8wekyb3d8bbwe"></CustomCapability></CustomCapabilities><AuthorizedEntities><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.14_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.15_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.14_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.15_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity></AuthorizedEntities></CustomCapabilityDescriptor>
\ No newline at end of file
+<CustomCapabilityDescriptor xmlns="http://schemas.microsoft.com/appx/2016/sccd" xmlns:s="http://schemas.microsoft.com/appx/2016/sccd"><CustomCapabilities><CustomCapability Name="Microsoft.classicAppCompat_8wekyb3d8bbwe"></CustomCapability></CustomCapabilities><AuthorizedEntities><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.14_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.15_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.16_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.17_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0" CertificateSignatureHash="6045e624888e299179d5ae0ceda57c9874ff6ccf889fa14b2d50f751bfb9e2f8"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0" CertificateSignatureHash="6045e624888e299179d5ae0ceda57c9874ff6ccf889fa14b2d50f751bfb9e2f8"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0" CertificateSignatureHash="6045e624888e299179d5ae0ceda57c9874ff6ccf889fa14b2d50f751bfb9e2f8"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0" CertificateSignatureHash="6045e624888e299179d5ae0ceda57c9874ff6ccf889fa14b2d50f751bfb9e2f8"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0" CertificateSignatureHash="6045e624888e299179d5ae0ceda57c9874ff6ccf889fa14b2d50f751bfb9e2f8"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0" CertificateSignatureHash="6045e624888e299179d5ae0ceda57c9874ff6ccf889fa14b2d50f751bfb9e2f8"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0" CertificateSignatureHash="6045e624888e299179d5ae0ceda57c9874ff6ccf889fa14b2d50f751bfb9e2f8"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.14_qbz5n2kfra8p0" CertificateSignatureHash="6045e624888e299179d5ae0ceda57c9874ff6ccf889fa14b2d50f751bfb9e2f8"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.14_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.15_qbz5n2kfra8p0" CertificateSignatureHash="6045e624888e299179d5ae0ceda57c9874ff6ccf889fa14b2d50f751bfb9e2f8"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.15_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.16_qbz5n2kfra8p0" CertificateSignatureHash="6045e624888e299179d5ae0ceda57c9874ff6ccf889fa14b2d50f751bfb9e2f8"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.16_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.17_qbz5n2kfra8p0" CertificateSignatureHash="6045e624888e299179d5ae0ceda57c9874ff6ccf889fa14b2d50f751bfb9e2f8"></AuthorizedEntity><AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.17_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity></AuthorizedEntities></CustomCapabilityDescriptor>
\ No newline at end of file
diff --git a/PC/classicAppCompat.sccd b/PC/classicAppCompat.sccd
index 9764898..d7a70cd 100644
--- a/PC/classicAppCompat.sccd
+++ b/PC/classicAppCompat.sccd
@@ -1,28 +1,41 @@
-<?xml version="1.0" encoding="utf-8"?>
-<CustomCapabilityDescriptor xmlns="http://schemas.microsoft.com/appx/2016/sccd" xmlns:s="http://schemas.microsoft.com/appx/2016/sccd">
-	<CustomCapabilities>
-		<CustomCapability Name="Microsoft.classicAppCompat_8wekyb3d8bbwe"/>
-	</CustomCapabilities>
-	<AuthorizedEntities>
-		<!--PFN for store installation-->
-		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"/>
-		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"/>
-		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"/>
-		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"/>
-		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"/>
-		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"/>
-		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"/>
-		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.14_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"/>
-		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.15_qbz5n2kfra8p0" CertificateSignatureHash="0000000000000000000000000000000000000000000000000000000000000000"/>
-		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"/>
-		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"/>
-		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"/>
-		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"/>
-		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"/>
-		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"/>
-		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"/>
-		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.14_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"/>
-		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.15_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"/>
-	</AuthorizedEntities>
-	<!--Once signed, this file can no longer be modified-->
-	<Catalog>MIIq5AYJKoZIhvcNAQcCoIIq1TCCKtECAQExDzANBglghkgBZQMEAgEFADCCARAGCSsGAQQBgjcKAaCCAQEwgf4wDAYKKwYBBAGCNwwBAQQQaM+L42jwBUGvBczrtolMmhcNMTgxMTMwMDA1OTAzWjAOBgorBgEEAYI3DAEDBQAwgbwwKgQUWKcU3R38DGPlKK33XGIwKtVL1r4xEjAQBgorBgEEAYI3DAIDMQKCADCBjQQg3K+KBOQX7HfxjRNZC9cx8gIPkEhPRO1nJFRdWQrVEJ4xaTAQBgorBgEEAYI3DAIDMQKCADBVBgorBgEEAYI3AgEEMUcwRTAQBgorBgEEAYI3AgEZogKAADAxMA0GCWCGSAFlAwQCAQUABCDcr4oE5Bfsd/GNE1kL1zHyAg+QSE9E7WckVF1ZCtUQnqCCFFAwggZSMIIEOqADAgECAhMzAAMu49KhfNamygpWAAIAAy7jMA0GCSqGSIb3DQEBCwUAMIGMMQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMQ0wCwYDVQQLEwRNT1BSMScwJQYDVQQDEx5NaWNyb3NvZnQgTWFya2V0cGxhY2UgQ0EgRyAwMTMwHhcNMTgxMTMwMDA1NTA1WhcNMTgxMjAzMDA1NTA1WjB0MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMR4wHAYDVQQDExVNaWNyb3NvZnQgQ29ycG9yYXRpb24wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCwpcimfAx3HEpba1GLL/gDaRVddHE5PXTRmwlgaz8kt6/rq5rlrPFnCnbIc5818v0xJIznastbmrq26xyCEHyMLBKnyneTKE36I7+TGjcY0D7ow+o2vY7LDKMCTGlh31fx1Tvrl+5xTbWX5jdLU/3MB5faeOGh+0Knzwx1KDoXWgPtfXnD8I5jxJieoWoCwCjKTJgBOklLy9nbOalxf0h+xQRy2p5fj+PxAwQPgHWft36AF7/IMbt9FcXMtg4xdpnTYz4OV3dFOPz4m3M8HwVgNMv89W/1Ozc7uOyZt0Ij1baT6r2L3IjYg5ftzpGqaDOFcWlyDFSdhMR6BIKW8xEpAgMBAAGjggHCMIIBvjAYBgNVHSUBAf8EDjAMBgorBgEEAYI3TBwBMB0GA1UdDgQWBBRdpGYiCytx83FYzPSl+o97YzpxGzAPBgNVHREECDAGggRNT1BSMB8GA1UdIwQYMBaAFEnYB1RFhpclHtZZcRLDcpt0OE3oMGIGA1UdHwRbMFkwV6BVoFOGUWh0dHA6Ly93d3cubWljcm9zb2Z0LmNvbS9wa2lvcHMvY3JsL01pY3Jvc29mdCUyME1hcmtldHBsYWNlJTIwQ0ElMjBHJTIwMDEzKDIpLmNybDBvBggrBgEFBQcBAQRjMGEwXwYIKwYBBQUHMAKGU2h0dHA6Ly93d3cubWljcm9zb2Z0LmNvbS9wa2lvcHMvY2VydHMvTWljcm9zb2Z0JTIwTWFya2V0cGxhY2UlMjBDQSUyMEclMjAwMTMoMikuY3J0MAwGA1UdEwEB/wQCMAAwDgYDVR0PAQH/BAQDAgXgMDwGCSsGAQQBgjcVBwQvMC0GJSsGAQQBgjcVCIOS9kTqrxCDkY0wgqzgLIKinDE0g+6NOIaE7wACAWQCARYwIAYJKwYBBAGCNxUKAQH/BBAwDjAMBgorBgEEAYI3TBwBMA0GCSqGSIb3DQEBCwUAA4ICAQB3Dk3rXH52CDq/z1fwqn9xI5WGjGmu6oAE4HSc3sNdFrSVMMGm4gTlYGWSZ0wJUUf16mVr/rdXhxuR3MZn+m4Bhdl8KQqYjYbIvCUVj0o9nZ+yT6foeY8bKnB+K5h6rol+mjDj5IfcutC4x2Kx5RrtDtRTSoKA63iZ74DYngPpBGBBgaS2c/QzgqPRAMMRqy2KBDP0miCnpR3F4YlzHGyOZwyHhESjYd9kwF47+msuHS04JZpnGHIvBppKN9XQzH3WezNnnX3lz4AyAUMsMFuARqEnacUhrAHL9n5zMv9CzxDYN1r1/aDh/788RuGuZM+E3NtmbxJJ7j6T5/VtXNBRgKtIq8d2+11j6qvKLigOTxSC25/A70BZBEvllLFnvc1vA2LrC9drwt1KpSmWie1nvpilw7o+gHMOG9utUxGha2VuVizuVNGCywTRRjvmGS1QqTfaun1URVrLfnDINXuTgN1Vwp0J5IGpJ3D8yj01NDQ/RworE+3W/R531NBYova9QRhU/igEw/Aa/q8wjZ4Pzxr9oBIo0Ta3Tv6qIggaWXw0U9+F0J7SCqIhn0d0ATO+E1Qs/SxZIAICLwmqzoLYUAh8q153esBs4uesueqgt5ueyHK8V3WjMS4wxEyVN5ZMET3hFtEshsZC31tLDdjq750U4SgQVmoYSm3F3ZOKQDCCBtcwggS/oAMCAQICCmESRKIAAAAAAAIwDQYJKoZIhvcNAQELBQAwgYgxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xMjAwBgNVBAMTKU1pY3Jvc29mdCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAyMDExMB4XDTExMDMyODIxMDkzOVoXDTMxMDMyODIxMTkzOVowfTELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEnMCUGA1UEAxMeTWljcm9zb2Z0IE1hcmtldFBsYWNlIFBDQSAyMDExMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAubUaSwGYVsE3MAnPfvmozUhAB3qxBABgJRW1vDp4+tVinXxD32f7k1K89JQ6zDOgS/iDgULC+yFK1K/1Qjac/0M7P6c8v5LSjnWGlERLa/qY32j46S7SLQcit3g2jgoTTO03eUG+9yHZUTGV/FJdRYB8uXhrznJBa+Y+yGwiQKF+m6XFeBH/KORoKFx+dmMoy9EWJ/m/o9IiUj2kzm9C691+vZ/I2w0Bj93W9SPPkV2PCNHlzgfIAoeajWpHmi38Wi3xZHonkzAVBHxPsCBppOoNsWvmAfUM7eBthkSPvFruekyDCPNEYhfGqgqtqLkoBebXLZCOVybF7wTQaLvse60//3P003icRcCoQYgY4NAqrF7j80o5U7DkeXxcB0xvengsaKgiAaV1DKkRbpe98wCqr1AASvm5rAJUYMU+mXmOieV2EelY2jGrenWe9FQpNXYV1NoWBh0WKoFxttoWYAnF705bIWtSZsz08ZfK6WLX4GXNLcPBlgCzfTm1sdKYASWdBbH2haaNhPapFhQQBJHKwnVW2iXErImhuPi45W3MVTZ5D9ASshZx69cLYY6xAdIa+89Kf/uRrsGOVZfahDuDw+NI183iAyzC8z/QRt2P32LYxP0xrCdqVh+DJo2i4NoE8Uk1usCdbVRuBMBQl/AwpOTq7IMvHGElf65CqzUCAwEAAaOCAUswggFHMBAGCSsGAQQBgjcVAQQDAgEAMB0GA1UdDgQWBBQPU8s/FmEl/mCJHdO5fOiQrbOU0TAZBgkrBgEEAYI3FAIEDB4KAFMAdQBiAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBRyLToCMZBDuRQFTuHqp8cx0SOJNDBaBgNVHR8EUzBRME+gTaBLhklodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpL2NybC9wcm9kdWN0cy9NaWNSb29DZXJBdXQyMDExXzIwMTFfMDNfMjIuY3JsMF4GCCsGAQUFBwEBBFIwUDBOBggrBgEFBQcwAoZCaHR0cDovL3d3dy5taWNyb3NvZnQuY29tL3BraS9jZXJ0cy9NaWNSb29DZXJBdXQyMDExXzIwMTFfMDNfMjIuY3J0MA0GCSqGSIb3DQEBCwUAA4ICAQCjuZmM8ZVNDgp9wHsL4RY8KJ8nLinvxFTphNGCrxaLknkYG5pmMhVlX+UB/tSiW8W13W60nggz9u5xwMx7v/1t/Tgm6g2brVyOKI5A7u6/2SIJwkJKFw953K0YIKVT28w9zl8dSJnmRnyR0G86ncWbF6CLQ6A6lBQ9o2mTGVqDr4m35WKAnc6YxUUM1y74mbzFFZr63VHsCcOp3pXWnUqAY1rb6Q6NX1b3clncKqLFm0EjKHcQ56grTbwuuB7pMdh/IFCJR01MQzQbDtpEisbOeZUi43YVAAHKqI1EO9bRwg3frCjwAbml9MmI4utMW94gWFgvrMxIX+n42RBDIjf3Ot3jkT6gt3XeTTmO9bptgblZimhERdkFRUFpVtkocJeLoGuuzP93uH/Yp032wzRH+XmMgujfZv+vnfllJqxdowoQLx55FxLLeTeYfwi/xMSjZO2gNven3U/3KeSCd1kUOFS3AOrwZ0UNOXJeW5JQC6Vfd1BavFZ6FAta1fMLu3WFvNB+FqeHUaU3ya7rmtxJnzk29DeSqXgGNmVSywBS4NajI5jJIKAA6UhNJlsg8CHYwUOKf5ej8OoQCkbadUxXygAfxCfW2YBbujtI+PoyejRFxWUjYFWO5LeTI62UMyqfOEiqugoYjNxmQZla2s4YHVuqIC34R85FQlg9pKQBsDCCBxswggUDoAMCAQICEzMAAABCs21EHGjyqKYAAAAAAEIwDQYJKoZIhvcNAQELBQAwfTELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEnMCUGA1UEAxMeTWljcm9zb2Z0IE1hcmtldFBsYWNlIFBDQSAyMDExMB4XDTE4MDQyMDE2NDI0NFoXDTIxMDQyMDE2NDI0NFowgYwxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xDTALBgNVBAsTBE1PUFIxJzAlBgNVBAMTHk1pY3Jvc29mdCBNYXJrZXRwbGFjZSBDQSBHIDAxMzCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAOZ2KM9Pq1YCOiqWOivmHjUtkMgznTMP/Mr2YfzZeIIJySg1F4WxFZc4jagGHHNof9NRT+GGnktWsXkZuH1DzQEG4Ps1ln8+4vhbDglqu5ymDnd6RmsyoD+8xfc8bBIvE5o6R+ES4/GVD5TqNsOrWbwETaIZVbmTulJLoTS1WSsSjowmbc+sHqZiY8BNJNThUEmXSjuHqkQKKshuiFWYEqOTitp71mBLyH1wN7/jThRzGpolOeFusRNJdb8sEqvNzEN9Qh+Kp6ndzrnjE+t8ixXW3lShyyOOZqQMwsQn9q9T0v7Q69GuojBTFBOHKwigcCHr4xahuN+ZYMk0xGg+sm3Uj7I9mrWTSTiIRMZNIWq3sFg4+rFg48NYfRlXUpONmL7vXq6v1pIU99d2MXQ6uUrnUr1/n5ZiHGCeFcvWwqO8BYHdcTlrSOkayfFp7W9oCk9QO4Xy0h9cQRedRo2kvdTHxIuJS70Hdv6oePPF2ZFaLucUzzwsR4/XMAVKY8Vsm950omsSSOImsMtzavUdQM+wZFxvHTRqVDkF3quPdME0bCZOWB4hQJmd+o2clw+1mpwPu0/M92nA9FJg7MGPxkFaYW7g26jSqUJZ9AcX+Xa5TSIeqMZt3cRVjMTx0T/v73Sv8TpalqIQ5Fde1+hFK07sOAm3TwgzvlVJnbYgp0/rAgMBAAGjggGCMIIBfjASBgkrBgEEAYI3FQEEBQIDAgACMCMGCSsGAQQBgjcVAgQWBBSbJnDhuc3nQXuKuACsPflEbwjbozAdBgNVHQ4EFgQUSdgHVEWGlyUe1llxEsNym3Q4TegwEQYDVR0gBAowCDAGBgRVHSAAMBkGCSsGAQQBgjcUAgQMHgoAUwB1AGIAQwBBMAsGA1UdDwQEAwIBhjASBgNVHRMBAf8ECDAGAQH/AgEAMB8GA1UdIwQYMBaAFA9Tyz8WYSX+YIkd07l86JCts5TRMFcGA1UdHwRQME4wTKBKoEiGRmh0dHA6Ly9jcmwubWljcm9zb2Z0LmNvbS9wa2kvY3JsL3Byb2R1Y3RzL01pY01hclBDQTIwMTFfMjAxMS0wMy0yOC5jcmwwWwYIKwYBBQUHAQEETzBNMEsGCCsGAQUFBzAChj9odHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20vcGtpL2NlcnRzL01pY01hclBDQTIwMTFfMjAxMS0wMy0yOC5jcnQwDQYJKoZIhvcNAQELBQADggIBAIa2oa6kvuIHCNfz7anlL0W9tOCt8gQNkxOGRK3yliQIelNQahDJojyEFlHQ2BcHL5oZit3WeSDoYddhojx6YzJIWwfGwtVqgc0JFDKJJ2ZXRYMRsuy01Hn25xob+zRMS6VmV1axQn6uwOSMcgYmzoroh6edjPKu7qXcpt6LmhF2qFvLySA7wBCwfI/rR5/PX6I7a07Av7PpbY6/+2ujd8m1H3hwMrb4Hq3z6gcq62zJ3nDXUbC0Bp6Jt2kV9f0rEFpDK9oxE2qrGBUf8c3O2XirHOgAjRyWjWWtVms+MP8qBIA1NSLrBmToEWVP3sEkQZWMkoZWo4rYEJZpX7UIgdDc9zYNakgTCJqPhqn8AE1sgSSnpqAdMkkP41rTlFCv2ig2QVzDerjGfEv+uPDnlAT0kucbBJxHHvUC4aqUxaTSa0sy2bZ6NWFx8/u0gW8JahzxYvvvZL8SfwaA9P4ETb8pH1jw+6N/LfM2zJrNKhf5hjKa0VDOXUpkYq60OqVVnWJ6oJaSIWNkZKfzPnl/UHA8Bh4qfVrhc9H5PExPhhB9WVTsjf4r+OOVuolJldThcWQqljiPjk5rultr63G5xLyFpxNi4BCrcNQBJFB5wKgOWOyjQTVWTmh2ESaeqZ2aWBjftFHlxJ/qYc7WOGJV0+cHGkB/dvFxmKnv6tuWexiMMYIVUTCCFU0CAQEwgaQwgYwxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xDTALBgNVBAsTBE1PUFIxJzAlBgNVBAMTHk1pY3Jvc29mdCBNYXJrZXRwbGFjZSBDQSBHIDAxMwITMwADLuPSoXzWpsoKVgACAAMu4zANBglghkgBZQMEAgEFAKCBlTAYBgkqhkiG9w0BCQMxCwYJKwYBBAGCNwoBMC8GCSqGSIb3DQEJBDEiBCAS0d3bw2YOODvKFr0S4e3BDnaDcZXUKeBO77yvkWzVojBIBgorBgEEAYI3AgEMMTowOKAegBwATQBpAGMAcgBvAHMAbwBmAHQAIABDAG8AcgBwoRaAFGh0dHA6Ly9NaWNyb3NvZnQuY29tMA0GCSqGSIb3DQEBAQUABIIBABoap3Y+2k+zFz2cCmkc8xxHnpIygLsUSRMXeXdjPVcYx3o5cPLIixnL6p8+LIrlIagPg23mzTEmnjZaO4aaexk+3XojlHj22w/bEigEDnKyWt5bHeS0UNHJbxEFYRfd84IP1+mSH4c4+GuU9p3LsAMh6wN03MYrGmczUOnlP6YlxHNQbQxnV0sl14yOE5ni9oT4y+l+SllvbV3/Jhwpov68aoP/2MazqxR4QyGfSxhCPJ4UuDHU7IrpnTxGBTL1/oUU8ED0FxyDoH/Sc5OhTLInFqbZaVzm5Mpr12wYUBL4nE5h0Kf6BCKdgM8a+Ti3wMUsBoC79ff3jE9U/xwSneOhghLlMIIS4QYKKwYBBAGCNwMDATGCEtEwghLNBgkqhkiG9w0BBwKgghK+MIISugIBAzEPMA0GCWCGSAFlAwQCAQUAMIIBUQYLKoZIhvcNAQkQAQSgggFABIIBPDCCATgCAQEGCisGAQQBhFkKAwEwMTANBglghkgBZQMEAgEFAAQghPy22lwuCYESw8jYhb4F9ZDPJ1LPgSSZgJDkyXYzVt4CBlv98KtAoBgTMjAxODExMzAwMTA1MTkuMTM4WjAEgAIB9KCB0KSBzTCByjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAldBMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xLTArBgNVBAsTJE1pY3Jvc29mdCBJcmVsYW5kIE9wZXJhdGlvbnMgTGltaXRlZDEmMCQGA1UECxMdVGhhbGVzIFRTUyBFU046RDA4Mi00QkZELUVFQkExJTAjBgNVBAMTHE1pY3Jvc29mdCBUaW1lLVN0YW1wIHNlcnZpY2Wggg48MIIE8TCCA9mgAwIBAgITMwAAAOIYOHtm6erB2AAAAAAA4jANBgkqhkiG9w0BAQsFADB8MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSYwJAYDVQQDEx1NaWNyb3NvZnQgVGltZS1TdGFtcCBQQ0EgMjAxMDAeFw0xODA4MjMyMDI3MDNaFw0xOTExMjMyMDI3MDNaMIHKMQswCQYDVQQGEwJVUzELMAkGA1UECBMCV0ExEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEtMCsGA1UECxMkTWljcm9zb2Z0IElyZWxhbmQgT3BlcmF0aW9ucyBMaW1pdGVkMSYwJAYDVQQLEx1UaGFsZXMgVFNTIEVTTjpEMDgyLTRCRkQtRUVCQTElMCMGA1UEAxMcTWljcm9zb2Z0IFRpbWUtU3RhbXAgc2VydmljZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKirA72FF3NCLW5mfLO/D0EZ5Ycs00oiMSissXLB6WF9GNdP78QzFwAypxW/+qZSczqaHbDH8hlbxkzf3DiYgAdpQjnGkLujwKtWSaP29/lVf7jFqHy9v6eH+LdOi0LvtrPRW34MyCvpxZyOW4H1h3PkxCBL5Ra21sDqgcVL1me0osw8QTURXmI4LyeLdTH3CcI2AgNDXTjsFBf3QsO+JYyAOYWrTcLnywVN6DrigmgrDJk5w+wR4VrHfl2T9PRZbZ+UDt13wwyB9d6IURuzV8lHsAVfF8t9S0aGVPmkQ3c2waOhHpsp6VEM+T5D2Ph8xJX1r82z67WRlmGcOP2NWC0CAwEAAaOCARswggEXMB0GA1UdDgQWBBSJPpD6BsP2p+crDJL232voEtLxezAfBgNVHSMEGDAWgBTVYzpcijGQ80N7fEYbxTNoWoVtVTBWBgNVHR8ETzBNMEugSaBHhkVodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpL2NybC9wcm9kdWN0cy9NaWNUaW1TdGFQQ0FfMjAxMC0wNy0wMS5jcmwwWgYIKwYBBQUHAQEETjBMMEoGCCsGAQUFBzAChj5odHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20vcGtpL2NlcnRzL01pY1RpbVN0YVBDQV8yMDEwLTA3LTAxLmNydDAMBgNVHRMBAf8EAjAAMBMGA1UdJQQMMAoGCCsGAQUFBwMIMA0GCSqGSIb3DQEBCwUAA4IBAQARQHu7ISeBuJSHKuDRI04704cH0B7BYzeEIrD15awviMRcYIfIOHpvGzZOWQgP2Hm0Rr7kvTUu1VrSSaQ7i1gPWdhqMmw5WBnSS5bxeMhhx9UsASeE84vUu82NeZapGSjH38YAb4WT+TtiTkcoI59rA+CTCq108ttIxVfZcr3id76OETIH0HvhlnxOOWjwGy4ul6Za5RoTLG/oo2rrGmVi3FwrNWGezYLBODuEsjzG36lCRtBKC2ZAHfbOz5wtkUHbqh79mUKocjP4r3qxf5TN87yf6g1uTx+J8pdnAi5iHt+ZtangWqnVTE8PoIREWhBVlGFfQdkELUx2Or90aAqWMIIGcTCCBFmgAwIBAgIKYQmBKgAAAAAAAjANBgkqhkiG9w0BAQsFADCBiDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEyMDAGA1UEAxMpTWljcm9zb2Z0IFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTAwHhcNMTAwNzAxMjEzNjU1WhcNMjUwNzAxMjE0NjU1WjB8MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSYwJAYDVQQDEx1NaWNyb3NvZnQgVGltZS1TdGFtcCBQQ0EgMjAxMDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKkdDbx3EYo6IOz8E5f1+n9plGt0VBDVpQoAgoX77XxoSyxfxcPlYcJ2tz5mK1vwFVMnBDEfQRsalR3OCROOfGEwWbEwRA/xYIiEVEMM1024OAizQt2TrNZzMFcmgqNFDdDq9UeBzb8kYDJYYEbyWEeGMoQedGFnkV+BVLHPk0ySwcSmXdFhE24oxhr5hoC732H8RsEnHSRnEnIaIYqvS2SJUGKxXf13Hz3wV3WsvYpCTUBR0Q+cBj5nf/VmwAOWRH7v0Ev9buWayrGo8noqCjHw2k4GkbaICDXoeByw6ZnNPOcvRLqn9NxkvaQBwSAJk3jN/LzAyURdXhacAQVPIk0CAwEAAaOCAeYwggHiMBAGCSsGAQQBgjcVAQQDAgEAMB0GA1UdDgQWBBTVYzpcijGQ80N7fEYbxTNoWoVtVTAZBgkrBgEEAYI3FAIEDB4KAFMAdQBiAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBTV9lbLj+iiXGJo0T2UkFvXzpoYxDBWBgNVHR8ETzBNMEugSaBHhkVodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpL2NybC9wcm9kdWN0cy9NaWNSb29DZXJBdXRfMjAxMC0wNi0yMy5jcmwwWgYIKwYBBQUHAQEETjBMMEoGCCsGAQUFBzAChj5odHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20vcGtpL2NlcnRzL01pY1Jvb0NlckF1dF8yMDEwLTA2LTIzLmNydDCBoAYDVR0gAQH/BIGVMIGSMIGPBgkrBgEEAYI3LgMwgYEwPQYIKwYBBQUHAgEWMWh0dHA6Ly93d3cubWljcm9zb2Z0LmNvbS9QS0kvZG9jcy9DUFMvZGVmYXVsdC5odG0wQAYIKwYBBQUHAgIwNB4yIB0ATABlAGcAYQBsAF8AUABvAGwAaQBjAHkAXwBTAHQAYQB0AGUAbQBlAG4AdAAuIB0wDQYJKoZIhvcNAQELBQADggIBAAfmiFEN4sbgmD+BcQM9naOhIW+z66bM9TG+zwXiqf76V20ZMLPCxWbJat/15/B4vceoniXj+bzta1RXCCtRgkQS+7lTjMz0YBKKdsxAQEGb3FwX/1z5Xhc1mCRWS3TvQhDIr79/xn/yN31aPxzymXlKkVIArzgPF/UveYFl2am1a+THzvbKegBvSzBEJCI8z+0DpZaPWSm8tv0E4XCfMkon/VWvL/625Y4zu2JfmttXQOnxzplmkIz/amJ/3cVKC5Em4jnsGUpxY517IW3DnKOiPPp/fZZqkHimbdLhnPkd/DjYlPTGpQqWhqS9nhquBEKDuLWAmyI4ILUl5WTs9/S/fmNZJQ96LjlXdqJxqgaKD4kWumGnEcua2A5HmoDF0M2n0O99g/DhO3EJ3110mCIIYdqwUB5vvfHhAN/nMQekkzr3ZUd46PioSKv33nJ+YWtvd6mBy6cJrDm77MbL2IK0cs0d9LiFAR6A+xuJKlQ5slvayA1VmXqHczsI5pgt6o3gMy4SKfXAL1QnIffIrE7aKLixqduWsqdCosnPGUFN4Ib5KpqjEWYw07t0MkvfY3v1mYovG8chr1m1rtxEPJdQcdeh0sVV42neV8HR3jDA/czmTfsNv11P6Z0eGTgvvM9YBS7vDaBQNdrvCScc1bN+NR4Iuto229Nfj950iEkSoYICzjCCAjcCAQEwgfihgdCkgc0wgcoxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJXQTEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMS0wKwYDVQQLEyRNaWNyb3NvZnQgSXJlbGFuZCBPcGVyYXRpb25zIExpbWl0ZWQxJjAkBgNVBAsTHVRoYWxlcyBUU1MgRVNOOkQwODItNEJGRC1FRUJBMSUwIwYDVQQDExxNaWNyb3NvZnQgVGltZS1TdGFtcCBzZXJ2aWNloiMKAQEwBwYFKw4DAhoDFQByQCUheEOevaI9Zc/3QGrkX42iC6CBgzCBgKR+MHwxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xJjAkBgNVBAMTHU1pY3Jvc29mdCBUaW1lLVN0YW1wIFBDQSAyMDEwMA0GCSqGSIb3DQEBBQUAAgUA36ppYDAiGA8yMDE4MTEyOTIxMzQyNFoYDzIwMTgxMTMwMjEzNDI0WjB3MD0GCisGAQQBhFkKBAExLzAtMAoCBQDfqmlgAgEAMAoCAQACAitfAgH/MAcCAQACAhGtMAoCBQDfq7rgAgEAMDYGCisGAQQBhFkKBAIxKDAmMAwGCisGAQQBhFkKAwKgCjAIAgEAAgMHoSChCjAIAgEAAgMBhqAwDQYJKoZIhvcNAQEFBQADgYEAbAXXPR9wy4NA0892GGqetaZF+pNClpGcfEpSuHABaZ4Gzr1nY1nmrhexTtr/U6omHALRWzkQwthk0cy+mnEHXyOZGmoEEpgrLgK3AAP5NbK/XbtHQRyZJQyhZScFbOyQycoE8QQalSVOhWxk/bbBMQaQiYVMIexNd/T0KgaDDUMxggMNMIIDCQIBATCBkzB8MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSYwJAYDVQQDEx1NaWNyb3NvZnQgVGltZS1TdGFtcCBQQ0EgMjAxMAITMwAAAOIYOHtm6erB2AAAAAAA4jANBglghkgBZQMEAgEFAKCCAUowGgYJKoZIhvcNAQkDMQ0GCyqGSIb3DQEJEAEEMC8GCSqGSIb3DQEJBDEiBCCr9IiSbx6s8MLdxldRG49+4h6CbicW8hWXAicI3jNmhDCB+gYLKoZIhvcNAQkQAi8xgeowgecwgeQwgb0EIN8BpJSmQCGubWwVa4tW+aMveoHMX/nDnVN8fiDOMsrLMIGYMIGApH4wfDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEmMCQGA1UEAxMdTWljcm9zb2Z0IFRpbWUtU3RhbXAgUENBIDIwMTACEzMAAADiGDh7ZunqwdgAAAAAAOIwIgQgTkOfRvGEZNbr5/hgWclsL4/Q7SOZihE/U0lz2wEMIGcwDQYJKoZIhvcNAQELBQAEggEATlxnCfTzFfTMDvK085zlYPVCroKYW6gKFYnbAhNmrNzcxqALKmIYXpFU7B6HH/vYzkUfCyXpf5tsyEWu0oTySOjyAZ9+2vdaG8nEgjOp0L737lcitgusIjpWtta3Ik0b+mzffnvyjrgTSuKDDni3mxGfvJU77k1Ctempma4H2FJso6Bur0PRH99vIYDu4lHigOSLbeyjR5CiDciBwEVUSA0FxhoFNX1yfpxz3sukOvkaoTduREIjH5LxUjNI1ZTMK/ZkeETI8IPRpWVzAc8q7CujErHKo4sdKej/O2cfUTUHplFLVCGGExpJUCg5FH5jVUUFt75ad8503sdGplggVQ==</Catalog></CustomCapabilityDescriptor>
+<?xml version="1.0" encoding="utf-8"?>

+<CustomCapabilityDescriptor xmlns="http://schemas.microsoft.com/appx/2016/sccd" xmlns:s="http://schemas.microsoft.com/appx/2016/sccd">

+	<CustomCapabilities>

+		<CustomCapability Name="Microsoft.classicAppCompat_8wekyb3d8bbwe"></CustomCapability>

+	</CustomCapabilities>

+	<AuthorizedEntities>

+		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity>

+		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity>

+		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity>

+		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity>

+		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity>

+		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity>

+		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity>

+		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.14_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity>

+		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.15_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity>

+		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.16_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity>

+		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.17_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity>

+		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0" CertificateSignatureHash="6045e624888e299179d5ae0ceda57c9874ff6ccf889fa14b2d50f751bfb9e2f8"></AuthorizedEntity>

+		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity>

+		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0" CertificateSignatureHash="6045e624888e299179d5ae0ceda57c9874ff6ccf889fa14b2d50f751bfb9e2f8"></AuthorizedEntity>

+		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity>

+		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0" CertificateSignatureHash="6045e624888e299179d5ae0ceda57c9874ff6ccf889fa14b2d50f751bfb9e2f8"></AuthorizedEntity>

+		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity>

+		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0" CertificateSignatureHash="6045e624888e299179d5ae0ceda57c9874ff6ccf889fa14b2d50f751bfb9e2f8"></AuthorizedEntity>

+		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity>

+		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0" CertificateSignatureHash="6045e624888e299179d5ae0ceda57c9874ff6ccf889fa14b2d50f751bfb9e2f8"></AuthorizedEntity>

+		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity>

+		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0" CertificateSignatureHash="6045e624888e299179d5ae0ceda57c9874ff6ccf889fa14b2d50f751bfb9e2f8"></AuthorizedEntity>

+		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity>

+		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0" CertificateSignatureHash="6045e624888e299179d5ae0ceda57c9874ff6ccf889fa14b2d50f751bfb9e2f8"></AuthorizedEntity>

+		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity>

+		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.14_qbz5n2kfra8p0" CertificateSignatureHash="6045e624888e299179d5ae0ceda57c9874ff6ccf889fa14b2d50f751bfb9e2f8"></AuthorizedEntity>

+		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.14_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity>

+		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.15_qbz5n2kfra8p0" CertificateSignatureHash="6045e624888e299179d5ae0ceda57c9874ff6ccf889fa14b2d50f751bfb9e2f8"></AuthorizedEntity>

+		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.15_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity>

+		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.16_qbz5n2kfra8p0" CertificateSignatureHash="6045e624888e299179d5ae0ceda57c9874ff6ccf889fa14b2d50f751bfb9e2f8"></AuthorizedEntity>

+		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.16_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity>

+		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.17_qbz5n2kfra8p0" CertificateSignatureHash="6045e624888e299179d5ae0ceda57c9874ff6ccf889fa14b2d50f751bfb9e2f8"></AuthorizedEntity>

+		<AuthorizedEntity AppPackageFamilyName="PythonSoftwareFoundation.Python.3.17_qbz5n2kfra8p0" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity>

+	</AuthorizedEntities>

+	<Catalog>MIIucgYJKoZIhvcNAQcCoIIuYzCCLl8CAQExDzANBglghkgBZQMEAgEFADCCARAGCSsGAQQBgjcKAaCCAQEwgf4wDAYKKwYBBAGCNwwBAQQQ293slyDTMUOmVyeQqmcNSBcNMjIwMjA0MDkwNjU2WjAOBgorBgEEAYI3DAEDBQAwgbwwKgQUdgFpbn9QXi/ly4CZFKA2Eimoq6YxEjAQBgorBgEEAYI3DAIDMQKCADCBjQQg3YHMbvV3unL0mx/RJ8ihTJd1C/SYSnMHbN0yMrWijuQxaTAQBgorBgEEAYI3DAIDMQKCADBVBgorBgEEAYI3AgEEMUcwRTAQBgorBgEEAYI3AgEZogKAADAxMA0GCWCGSAFlAwQCAQUABCDdgcxu9Xe6cvSbH9EnyKFMl3UL9JhKcwds3TIytaKO5KCCE8owggYEMIID7KADAgECAhMzAA/d9uEraWrDsxZGAAAAD932MA0GCSqGSIb3DQEBCwUAMIGLMQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMQwwCgYDVQQLEwNBT0MxJzAlBgNVBAMTHk1pY3Jvc29mdCBNYXJrZXRwbGFjZSBDQSBHIDAyMjAeFw0yMjAyMDQwODU5MzZaFw0yMjAyMDcwODU5MzZaMC8xLTArBgNVBAMTJDQ2ZTIwYzY2LTUxNTEtNDNhOS05MWQ4LTMwNDY0ZGZhMDg4ZjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALaMR5Ajlp2POidTxT0N47z5sukiE9fqMuI1QimTXIfB2/gPdMsNUbVCD57ha8J1DUJQpO5nuunbk3SONwfDTdWKx9u7zWubpEmgG7hZ8LTKFlF+xhS6lS/FBSSHyXpdScWPg62BMnDysqHMH/AjLw26HNPRWK8A0vx9jsalFwLg15u4MPuKN3Bpawr/OL0B+7eh/dGO3PutAqJ4aZs2lUCIyODg0q3Tzhgi7SIvFacFWJ8Qj6+D3AfasOv8oanfpNLLPhPlxXGEK9sMKHOOb8mTU9V/ibERqEKTHkJ24Vu+BwrXq5eVedtwmHT2WWR7teaIvrUT9AiPmMhx4hIF/0MCAwEAAaOCAbowggG2MBgGA1UdJQEB/wQOMAwGCisGAQQBgjdMHAEwHQYDVR0OBBYEFB4NpkpeSLk/j691tPw97rB4XKDJMA0GA1UdEQQGMASCAlVTMB8GA1UdIwQYMBaAFPeC7EkBPjJR1eFAcP4hAMeQ72IPMF8GA1UdHwRYMFYwVKBSoFCGTmh0dHA6Ly93d3cubWljcm9zb2Z0LmNvbS9wa2lvcHMvY3JsL01pY3Jvc29mdCUyME1hcmtldHBsYWNlJTIwQ0ElMjBHJTIwMDIyLmNybDBsBggrBgEFBQcBAQRgMF4wXAYIKwYBBQUHMAKGUGh0dHA6Ly93d3cubWljcm9zb2Z0LmNvbS9wa2lvcHMvY2VydHMvTWljcm9zb2Z0JTIwTWFya2V0cGxhY2UlMjBDQSUyMEclMjAwMjIuY3J0MAwGA1UdEwEB/wQCMAAwDgYDVR0PAQH/BAQDAgXgMDwGCSsGAQQBgjcVBwQvMC0GJSsGAQQBgjcVCIOS9kTqrxCDkY0wgqzgLIKinDE0g+6NOIaE7wACAWQCARcwIAYJKwYBBAGCNxUKAQH/BBAwDjAMBgorBgEEAYI3TBwBMA0GCSqGSIb3DQEBCwUAA4ICAQBAiJuIJeMS+PMrxG+kwPWT7yy7A6P8trchwtXyYep/WXu7xT2tH2ys3wuP4DYG5CY4nKekjTKraQhZGuYj4r4KrUviShe8ZWMIcK4MRduXAU81UOd/fsCq5djQ6NDN4Bzq1TxjwZKiEMEWmXaunj6XAlDSX3SgyyMb/ywmur8VVKO+xFVkOxAqCjNo1VaCv3zEvr3Y6dUwO9gYQui1bAQVQzdxRYUPEJlsFBmbNL1AnZ39r4/9K/6orxavU4qwkj4cXnhtMYKDjTIIbTBrfD4glP6mnmkcZpN0ItfEAVgU9rGpXg84hQLeP83nBs2Y8DrF3bBF9867dJCl90c5rK1DMcelmH3oUAwqZ3U+jIIj3HGyfefAQ6HPL0yiY9OYLXQZUxcZF13m92l5s7dy2C21cIh0W0iTcWPIhNn9cia4Hr7FabTC0RoQkO1bg0PKvPMnoe0AqEVmPKImNDncg538AjPy2qeUxn7+0kcuZWEdKVAPwWfzh5qvSAmYKk4XNBfN2E40GQ0ruRdvMVMFeYBLXKm4SJR6zoiBa5v7qzt1uQqZf6GD4BNFZivBp0P2B9lTubEAU6SmUsazRnEVmekIO+x7gDuXbMS8tv6mb1pbGCtIV/wRcIYNcDkHKTHMbW5xR/OmGTM3mPRxoMQtaWtxIeagZkU2nl+pElA/0h7pIjCCBtcwggS/oAMCAQICCmESRKIAAAAAAAIwDQYJKoZIhvcNAQELBQAwgYgxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xMjAwBgNVBAMTKU1pY3Jvc29mdCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAyMDExMB4XDTExMDMyODIxMDkzOVoXDTMxMDMyODIxMTkzOVowfTELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEnMCUGA1UEAxMeTWljcm9zb2Z0IE1hcmtldFBsYWNlIFBDQSAyMDExMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAubUaSwGYVsE3MAnPfvmozUhAB3qxBABgJRW1vDp4+tVinXxD32f7k1K89JQ6zDOgS/iDgULC+yFK1K/1Qjac/0M7P6c8v5LSjnWGlERLa/qY32j46S7SLQcit3g2jgoTTO03eUG+9yHZUTGV/FJdRYB8uXhrznJBa+Y+yGwiQKF+m6XFeBH/KORoKFx+dmMoy9EWJ/m/o9IiUj2kzm9C691+vZ/I2w0Bj93W9SPPkV2PCNHlzgfIAoeajWpHmi38Wi3xZHonkzAVBHxPsCBppOoNsWvmAfUM7eBthkSPvFruekyDCPNEYhfGqgqtqLkoBebXLZCOVybF7wTQaLvse60//3P003icRcCoQYgY4NAqrF7j80o5U7DkeXxcB0xvengsaKgiAaV1DKkRbpe98wCqr1AASvm5rAJUYMU+mXmOieV2EelY2jGrenWe9FQpNXYV1NoWBh0WKoFxttoWYAnF705bIWtSZsz08ZfK6WLX4GXNLcPBlgCzfTm1sdKYASWdBbH2haaNhPapFhQQBJHKwnVW2iXErImhuPi45W3MVTZ5D9ASshZx69cLYY6xAdIa+89Kf/uRrsGOVZfahDuDw+NI183iAyzC8z/QRt2P32LYxP0xrCdqVh+DJo2i4NoE8Uk1usCdbVRuBMBQl/AwpOTq7IMvHGElf65CqzUCAwEAAaOCAUswggFHMBAGCSsGAQQBgjcVAQQDAgEAMB0GA1UdDgQWBBQPU8s/FmEl/mCJHdO5fOiQrbOU0TAZBgkrBgEEAYI3FAIEDB4KAFMAdQBiAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBRyLToCMZBDuRQFTuHqp8cx0SOJNDBaBgNVHR8EUzBRME+gTaBLhklodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpL2NybC9wcm9kdWN0cy9NaWNSb29DZXJBdXQyMDExXzIwMTFfMDNfMjIuY3JsMF4GCCsGAQUFBwEBBFIwUDBOBggrBgEFBQcwAoZCaHR0cDovL3d3dy5taWNyb3NvZnQuY29tL3BraS9jZXJ0cy9NaWNSb29DZXJBdXQyMDExXzIwMTFfMDNfMjIuY3J0MA0GCSqGSIb3DQEBCwUAA4ICAQCjuZmM8ZVNDgp9wHsL4RY8KJ8nLinvxFTphNGCrxaLknkYG5pmMhVlX+UB/tSiW8W13W60nggz9u5xwMx7v/1t/Tgm6g2brVyOKI5A7u6/2SIJwkJKFw953K0YIKVT28w9zl8dSJnmRnyR0G86ncWbF6CLQ6A6lBQ9o2mTGVqDr4m35WKAnc6YxUUM1y74mbzFFZr63VHsCcOp3pXWnUqAY1rb6Q6NX1b3clncKqLFm0EjKHcQ56grTbwuuB7pMdh/IFCJR01MQzQbDtpEisbOeZUi43YVAAHKqI1EO9bRwg3frCjwAbml9MmI4utMW94gWFgvrMxIX+n42RBDIjf3Ot3jkT6gt3XeTTmO9bptgblZimhERdkFRUFpVtkocJeLoGuuzP93uH/Yp032wzRH+XmMgujfZv+vnfllJqxdowoQLx55FxLLeTeYfwi/xMSjZO2gNven3U/3KeSCd1kUOFS3AOrwZ0UNOXJeW5JQC6Vfd1BavFZ6FAta1fMLu3WFvNB+FqeHUaU3ya7rmtxJnzk29DeSqXgGNmVSywBS4NajI5jJIKAA6UhNJlsg8CHYwUOKf5ej8OoQCkbadUxXygAfxCfW2YBbujtI+PoyejRFxWUjYFWO5LeTI62UMyqfOEiqugoYjNxmQZla2s4YHVuqIC34R85FQlg9pKQBsDCCBuMwggTLoAMCAQICEzMAAABLZz0Eed1JFCkAAAAAAEswDQYJKoZIhvcNAQELBQAwfTELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEnMCUGA1UEAxMeTWljcm9zb2Z0IE1hcmtldFBsYWNlIFBDQSAyMDExMB4XDTE5MDQxODIwNDUwNFoXDTI0MDQxODIwNDUwNFowgYsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xDDAKBgNVBAsTA0FPQzEnMCUGA1UEAxMeTWljcm9zb2Z0IE1hcmtldHBsYWNlIENBIEcgMDIyMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAzGfV5tDxZ3oPG8aq2OwrBLSRFC61lYvWtkqOdKswlBHVncuoOIzekLIFNsMwluoK0plNZ5w/JPmwkGTGIrt9ftbWQz0k7XRfacXvQQfhCaBgjkybvvDx7CTL0UDEUiXfEEkylUcQKOdm9LApPDP4oO/V8RS4ugkqkjsuVaOyfYv0TytjVVQon72W+wR/AyrBAXgfwzzEb85403GTJRzQMlTw1YqdgS/o9SCsvH9dRZTGlWCatIl+a00eTG5zgeu0xCtqwgERhw9UT6mlPqmp6RqJ8XMgKylh9Ss+jI53EmraAFlelph16kuqF6n3vNnRBfhQ+gmNdtKi9s3jI8Di7ip8hYGPHGGhtcw0AYUg5r/VQhIfXxO45zO7SFvjujX0ji0b3WKB/xD9Sg1KO1fiTpj82ifyPqHvL+iwn5dV98C4ru0dQ0hfK7tA4K5qkW+2gym0fBjGYWq81/smrj6LbPdNqCotgTMU4dCMBhmSJOD9fSiPUybrbHJrHGR5YNs5VJbHH5u1ia8UrgsSrGTb1bh38Tb10matJpBI7NwDWTkV7kMvgNRQsGO/1+dg47PLW3X7TbiZniTPC+oAqOh1CiF+ODnem4Nw1iRw854LN3yqibLHgTi093mCBtPGWZxg2sTcHUX4fo/UHNbSh8bERJznnennm4gEJXAYtpnEFSUCAwEAAaOCAUswggFHMA4GA1UdDwEB/wQEAwIBhjAQBgkrBgEEAYI3FQEEAwIBADAdBgNVHQ4EFgQU94LsSQE+MlHV4UBw/iEAx5DvYg8wGQYJKwYBBAGCNxQCBAweCgBTAHUAYgBDAEEwEgYDVR0TAQH/BAgwBgEB/wIBADAfBgNVHSMEGDAWgBQPU8s/FmEl/mCJHdO5fOiQrbOU0TBXBgNVHR8EUDBOMEygSqBIhkZodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpL2NybC9wcm9kdWN0cy9NaWNNYXJQQ0EyMDExXzIwMTEtMDMtMjguY3JsMFsGCCsGAQUFBwEBBE8wTTBLBggrBgEFBQcwAoY/aHR0cDovL3d3dy5taWNyb3NvZnQuY29tL3BraS9jZXJ0cy9NaWNNYXJQQ0EyMDExXzIwMTEtMDMtMjguY3J0MA0GCSqGSIb3DQEBCwUAA4ICAQAbTWps31OnBv77EVpCaU68drubToSKtpw9fYt4MvAhorXGRrRRfS6qou5o45QZAKjwzbOrr33dWxF4P3gCGqZxCotW32p6hlXGP7BnYlVw6242nlX0PahgpyWVWBmi0ElKH8N6HYhJqAW74tUNCzY7ALNMwk/JVEMKpWq+5XqutAEmtP0SdoSZPRwPtdiRjMLS8yyjP4HVAiKJ+m0wV3bLBtCG20BttEGkly7fYa2/E0ps41PLeX3T2yKRgmnGjhD16NUcMDdRpBh7MCXktwpISDEanB8QySJNdErU+NaKukgOW68+Oyk7lGiiZcG3boCGNec9JkM7dQdpA4tneQg0FI/o0mkDZR5aVItbAjRfMgAXpm6Hfu9DqOP+/R0K9v+CwyhwEjF3+SeL8YBAijXHD5YaiWzwZzBDtNQpuOXc91NmF7ifdHVy9IE1EhuIIQsMio3l0Uo87vGdwQ50po8o1F72zi1vfvKfDmszVezk6fF7cy7fZYh8I0ceVbZ4XY4xJ76TdYMItUAoPkvVdDq5B/d4oI7/xHfomRsEw08fuLxCRE8/BcvzSlDpnxu4wL6IULqVwHE+fbQ82Lr5ZDLxa1dYUw8zBGgCnx/ObVPj1RO1CaVi13wCxm8yaHeflKJWw7ZHOLeOGQyMRT+f9cFFk+5fzCA9GcwiSlEyYj4ilzGCGWUwghlhAgEBMIGjMIGLMQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMQwwCgYDVQQLEwNBT0MxJzAlBgNVBAMTHk1pY3Jvc29mdCBNYXJrZXRwbGFjZSBDQSBHIDAyMgITMwAP3fbhK2lqw7MWRgAAAA/d9jANBglghkgBZQMEAgEFAKCBjzAYBgkqhkiG9w0BCQMxCwYJKwYBBAGCNwoBMC8GCSqGSIb3DQEJBDEiBCBDgOMhvMousTIzk/P1eC2qGiSJLdSm3brGanFMLa41+DBCBgorBgEEAYI3AgEMMTQwMqAUgBIATQBpAGMAcgBvAHMAbwBmAHShGoAYaHR0cDovL3d3dy5taWNyb3NvZnQuY29tMA0GCSqGSIb3DQEBAQUABIIBAJ8LEwzLh2rDfLOOOodKT10yXoCzHPaQLv9sMwei+650mqV0iHaw9bUolBZAdBnF7JBRjY+yb9AIF7M/Av9pHRKvuLHWDntlo49RrfvNucHaJqPjCMm81h/GAuimPSBMpRtTCW+HHDWrw+HoGbRWQ+N/Vpt//pzj9gAzOzs8W9gU0RMz3ub4Hfgunm/CGACjFu5Hi2sjJbgigNlyRnxjI4+h3J7dGVOfR8hlhRB9YjXDB700F0bzaKqxC9LH7kZbAjiHPgLLCWz7OQ/rTo7wV5/e6v9GCKpamydPy/0MObq4TDi0fn75aVHTJJrzlwt1BJKyVPdAsOhiFUH3Mq4WheKhghcAMIIW/AYKKwYBBAGCNwMDATGCFuwwghboBgkqhkiG9w0BBwKgghbZMIIW1QIBAzEPMA0GCWCGSAFlAwQCAQUAMIIBUQYLKoZIhvcNAQkQAQSgggFABIIBPDCCATgCAQEGCisGAQQBhFkKAwEwMTANBglghkgBZQMEAgEFAAQgr34HNu5gF3j5DAITqq38vc6sNxs6ZqLz9i9zU2oQDtoCBmH66bcTCRgTMjAyMjAyMDQwOTA5NDkuNTkxWjAEgAIB9KCB0KSBzTCByjELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjElMCMGA1UECxMcTWljcm9zb2Z0IEFtZXJpY2EgT3BlcmF0aW9uczEmMCQGA1UECxMdVGhhbGVzIFRTUyBFU046REQ4Qy1FMzM3LTJGQUUxJTAjBgNVBAMTHE1pY3Jvc29mdCBUaW1lLVN0YW1wIFNlcnZpY2WgghFXMIIHDDCCBPSgAwIBAgITMwAAAZwPpk1h0p5LKAABAAABnDANBgkqhkiG9w0BAQsFADB8MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSYwJAYDVQQDEx1NaWNyb3NvZnQgVGltZS1TdGFtcCBQQ0EgMjAxMDAeFw0yMTEyMDIxOTA1MTlaFw0yMzAyMjgxOTA1MTlaMIHKMQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSUwIwYDVQQLExxNaWNyb3NvZnQgQW1lcmljYSBPcGVyYXRpb25zMSYwJAYDVQQLEx1UaGFsZXMgVFNTIEVTTjpERDhDLUUzMzctMkZBRTElMCMGA1UEAxMcTWljcm9zb2Z0IFRpbWUtU3RhbXAgU2VydmljZTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANtSKgwZXUkWP6zrXazTaYq7bco9Q2zvU6MN4ka3GRMX2tJZOK4DxeBiQACL/n7YV/sKTslwpD0f9cPU4rCDX9sfcTWo7XPxdHLQ+WkaGbKKWATsqw69bw8hkJ/bjcp2V2A6vGsvwcqJCh07BK3JPmUtZikyy5PZ8fyTyiKGN7hOWlaIU9oIoucUNoAHQJzLq8h20eNgHUh7eI5k+Kyq4v6810LHuA6EHyKJOZN2xTw5JSkLy0FN5Mhg/OaFrFBl3iag2Tqp4InKLt+Jbh/Jd0etnei2aDHFrmlfPmlRSv5wSNX5zAhgEyRpjmQcz1zp0QaSAefRkMm923/ngU51IbrVbAeHj569SHC9doHgsIxkh0K3lpw582+0ONXcIfIU6nkBT+qADAZ+0dT1uu/gRTBy614QAofjo258TbSX9aOU1SHuAC+3bMoyM7jNdHEJROH+msFDBcmJRl4VKsReI5+S69KUGeLIBhhmnmQ6drF8Ip0ZiO+vhAsD3e9AnqnY7Hcge850I9oKvwuwpVwWnKnwwSGElMz7UvCocmoUMXk7Vn2aNti+bdH28+GQb5EMsqhOmvuZOCRpOWN33G+b3g5unwEP0eTiY+LnWa2AuK43z/pplURJVle29K42QPkOcglB6sjLmNpEpb9basJ72eA0Mlp1LtH3oYZGXsggTfuXAgMBAAGjggE2MIIBMjAdBgNVHQ4EFgQUu2kJZ1Ndjl2112SynL6jGMID+rIwHwYDVR0jBBgwFoAUn6cVXQBeYl2D9OXSZacbUzUZ6XIwXwYDVR0fBFgwVjBUoFKgUIZOaHR0cDovL3d3dy5taWNyb3NvZnQuY29tL3BraW9wcy9jcmwvTWljcm9zb2Z0JTIwVGltZS1TdGFtcCUyMFBDQSUyMDIwMTAoMSkuY3JsMGwGCCsGAQUFBwEBBGAwXjBcBggrBgEFBQcwAoZQaHR0cDovL3d3dy5taWNyb3NvZnQuY29tL3BraW9wcy9jZXJ0cy9NaWNyb3NvZnQlMjBUaW1lLVN0YW1wJTIwUENBJTIwMjAxMCgxKS5jcnQwDAYDVR0TAQH/BAIwADATBgNVHSUEDDAKBggrBgEFBQcDCDANBgkqhkiG9w0BAQsFAAOCAgEApwAqpiMYRzNNYyz3PSbtijbeyCpUXcvIrqA4zPtMIcAk34W9u9mRDndWS+tlR3WwTpr1OgaV1wmc6YFzqK6EGWm903UEsFE7xBJMPXjfdVOPhcJB3vfvA0PX56oobcF2OvNsOSwTB8bi/ns+Cs39Puzs+QSNQZd8iAVBCSvxNCL78dln2RGU1xyB4AKqV9vi4Y/Gfmx2FA+jF0y+YLeob0M40nlSxL0q075t7L6iFRMNr0u8ROhzhDPLl+4ePYfUmyYJoobvydel9anAEsHFlhKl+aXb2ic3yNwbsoPycZJL/vo8OVvYYxCy+/5FrQmAvoW0ZEaBiYcKkzrNWt/hX9r5KgdwL61x0ZiTZopTko6W/58UTefTbhX7Pni0MApH3Pvyt6N0IFap+/LlwFRD1zn7e6ccPTwESnuo/auCmgPznq80OATA7vufsRZPvqeX8jKtsraSNscvNQymEWlcqdXV9hYkjb4T/Qse9cUYaoXg68wFHFuslWfTdPYPLl1vqzlPMnNJpC8KtdioDgcq+y1BaSqSm8EdNfwzT37+/JFtVc3Gs915fDqgPZDgOSzKQIV+fw3aPYt2LET3AbmKKW/r13Oy8cg3+D0D362GQBAJVv0NRI5NowgaCw6oNgWOFPrN72WSEcca/8QQiTGP2XpLiGpRDJZ6sWRpRYNdydkwggdxMIIFWaADAgECAhMzAAAAFcXna54Cm0mZAAAAAAAVMA0GCSqGSIb3DQEBCwUAMIGIMQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTIwMAYDVQQDEylNaWNyb3NvZnQgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgMjAxMDAeFw0yMTA5MzAxODIyMjVaFw0zMDA5MzAxODMyMjVaMHwxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xJjAkBgNVBAMTHU1pY3Jvc29mdCBUaW1lLVN0YW1wIFBDQSAyMDEwMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA5OGmTOe0ciELeaLL1yR5vQ7VgtP97pwHB9KpbE51yMo1V/YBf2xK4OK9uT4XYDP/XE/HZveVU3Fa4n5KWv64NmeFRiMMtY0Tz3cywBAY6GB9alKDRLemjkZrBxTzxXb1hlDcwUTIcVxRMTegCjhuje3XD9gmU3w5YQJ6xKr9cmmvHaus9ja+NSZk2pg7uhp7M62AW36MEBydUv626GIl3GoPz130/o5Tz9bshVZN7928jaTjkY+yOSxRnOlwaQ3KNi1wjjHINSi947SHJMPgyY9+tVSP3PoFVZhtaDuaRr3tpK56KTesy+uDRedGbsoy1cCGMFxPLOJiss254o2I5JasAUq7vnGpF1tnYN74kpEeHT39IM9zfUGaRnXNxF803RKJ1v2lIH1+/NmeRd+2ci/bfV+AutuqfjbsNkz2K26oElHovwUDo9Fzpk03dJQcNIIP8BDyt0cY7afomXw/TNuvXsLz1dhzPUNOwTM5TI4CvEJoLhDqhFFG4tG9ahhaYQFzymeiXtcodgLiMxhy16cg8ML6EgrXY28MyTZki1ugpoMhXV8wdJGUlNi5UPkLiWHzNgY1GIRH29wb0f2y1BzFa/ZcUlFdEtsluq9QBXpsxREdcu+N+VLEhReTwDwV2xo3xwgVGD94q0W29R6HXtqPnhZyacaue7e3PmriLq0CAwEAAaOCAd0wggHZMBIGCSsGAQQBgjcVAQQFAgMBAAEwIwYJKwYBBAGCNxUCBBYEFCqnUv5kxJq+gpE8RjUpzxD/LwTuMB0GA1UdDgQWBBSfpxVdAF5iXYP05dJlpxtTNRnpcjBcBgNVHSAEVTBTMFEGDCsGAQQBgjdMg30BATBBMD8GCCsGAQUFBwIBFjNodHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20vcGtpb3BzL0RvY3MvUmVwb3NpdG9yeS5odG0wEwYDVR0lBAwwCgYIKwYBBQUHAwgwGQYJKwYBBAGCNxQCBAweCgBTAHUAYgBDAEEwCwYDVR0PBAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAU1fZWy4/oolxiaNE9lJBb186aGMQwVgYDVR0fBE8wTTBLoEmgR4ZFaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraS9jcmwvcHJvZHVjdHMvTWljUm9vQ2VyQXV0XzIwMTAtMDYtMjMuY3JsMFoGCCsGAQUFBwEBBE4wTDBKBggrBgEFBQcwAoY+aHR0cDovL3d3dy5taWNyb3NvZnQuY29tL3BraS9jZXJ0cy9NaWNSb29DZXJBdXRfMjAxMC0wNi0yMy5jcnQwDQYJKoZIhvcNAQELBQADggIBAJ1VffwqreEsH2cBMSRb4Z5yS/ypb+pcFLY+TkdkeLEGk5c9MTO1OdfCcTY/2mRsfNB1OW27DzHkwo/7bNGhlBgi7ulmZzpTTd2YurYeeNg2LpypglYAA7AFvonoaeC6Ce5732pvvinLbtg/SHUB2RjebYIM9W0jVOR4U3UkV7ndn/OOPcbzaN9l9qRWqveVtihVJ9AkvUCgvxm2EhIRXT0n4ECWOKz3+SmJw7wXsFSFQrP8DJ6LGYnn8AtqgcKBGUIZUnWKNsIdw2FzLixre24/LAl4FOmRsqlb30mjdAy87JGA0j3mSj5mO0+7hvoyGtmW9I/2kQH2zsZ0/fZMcm8Qq3UwxTSwethQ/gpY3UA8x1RtnWN0SCyxTkctwRQEcb9k+SS+c23Kjgm9swFXSVRk2XPXfx5bRAGOWhmRaw2fpCjcZxkoJLo4S5pu+yFUa2pFEUep8beuyOiJXk+d0tBMdrVXVAmxaQFEfnyhYWxz/gq77EFmPWn9y8FBSX5+k77L+DvktxW/tM4+pTFRhLy/AsGConsXHRWJjXD+57XQKBqJC4822rpM+Zv/Cuk0+CQ1ZyvgDbjmjJnW4SLq8CdCPSWU5nR0W2rRnj7tfqAxM328y+l7vzhwRNGQ8cirOoo6CGJ/2XBjU02N7oJtpQUQwXEGahC0HVUzWLOhcGbyoYICzjCCAjcCAQEwgfihgdCkgc0wgcoxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xJTAjBgNVBAsTHE1pY3Jvc29mdCBBbWVyaWNhIE9wZXJhdGlvbnMxJjAkBgNVBAsTHVRoYWxlcyBUU1MgRVNOOkREOEMtRTMzNy0yRkFFMSUwIwYDVQQDExxNaWNyb3NvZnQgVGltZS1TdGFtcCBTZXJ2aWNloiMKAQEwBwYFKw4DAhoDFQDN2Wnq3fCz9ucStub1zQz7129TQKCBgzCBgKR+MHwxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xJjAkBgNVBAMTHU1pY3Jvc29mdCBUaW1lLVN0YW1wIFBDQSAyMDEwMA0GCSqGSIb3DQEBBQUAAgUA5adiZjAiGA8yMDIyMDIwNDE2MjkyNloYDzIwMjIwMjA1MTYyOTI2WjB3MD0GCisGAQQBhFkKBAExLzAtMAoCBQDlp2JmAgEAMAoCAQACAh92AgH/MAcCAQACAhFfMAoCBQDlqLPmAgEAMDYGCisGAQQBhFkKBAIxKDAmMAwGCisGAQQBhFkKAwKgCjAIAgEAAgMHoSChCjAIAgEAAgMBhqAwDQYJKoZIhvcNAQEFBQADgYEAbKzHReDTwgAKGSkgO/zxCAV/RcxwGpZK4M2bWgwqHVIi+/xiAKdQOSKeMz3UwRO4LI4EN4BjeK+ATpruzOtVGkyA8yzwdJFPv99j4O/Hc5kJSvovfECah62tBB3siNIFaAYNK+BF76k3j4+y9q9lF5yjQ8ZylVYbOfOjlJ2uevsxggQNMIIECQIBATCBkzB8MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSYwJAYDVQQDEx1NaWNyb3NvZnQgVGltZS1TdGFtcCBQQ0EgMjAxMAITMwAAAZwPpk1h0p5LKAABAAABnDANBglghkgBZQMEAgEFAKCCAUowGgYJKoZIhvcNAQkDMQ0GCyqGSIb3DQEJEAEEMC8GCSqGSIb3DQEJBDEiBCD10XWSucJFd8jLe5PaC9h9/GHXK7ZZ0kb4BGFNqgWk9DCB+gYLKoZIhvcNAQkQAi8xgeowgecwgeQwgb0EIDcPRYUgjSzKOhF39d4QgbRZQgrPO7Lo/qE5GtvSeqa8MIGYMIGApH4wfDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEmMCQGA1UEAxMdTWljcm9zb2Z0IFRpbWUtU3RhbXAgUENBIDIwMTACEzMAAAGcD6ZNYdKeSygAAQAAAZwwIgQgPTEmgx6rn5xpH+xmlpYkcn0dL16GyYRqyG8uRajrfTYwDQYJKoZIhvcNAQELBQAEggIAxmSLisdd5cs+7liXX7vsF8zX3Y1rbtyPZ0M466WBaVULlfeuu9RMzOhWha7bkfYmKs5hXOQNBJrIHxnHbWeDu/V7EVF80IQ7/6qWiVPNcLtMnS8+uyw3Tby2gEhshO/HHOJRqllrgtUGuPl8FoAAPbPKV7X7jrg1kqOWoqpwyiSzt5cN/qijwfTcTIaPeON5wMd8wRT2l5F9e/JDBSq0WuzYb2r0kifv9wq21orm4sQkbg5GgDa/oCr3PQVCNSvPb2G7HANcqJXHeRKyoCeVhX5UaFrCQbdxGFytOc5GzptQKNn18yGg4VYrFpigUcglLbuREqqlPabwZh/QfgKdp4b4uVA6On5HIV5e9XdJ9TXhvDArEQ+Kgyao5xlgb4MkvPO9Thh9UIbw9r3JhQ+uKnCvXyiE2SpTLq1OXTjt/RrLZb+qsZW4nrDRBlBswa4G5OVW/svvI8N2/+YYrSdaCWt4unWSnSxeVUWZkugBmWdeoEJpfs5Qy8NwC+g1TyXcMjolOFTfBB6JYpHCbk6Euh2gKxq5weBb7puxVN4cvawYY2zorp6ZXtAmQGflZTl02nWld+nvDoF/zi6IUmP7PTKvbEVs8T+QkCiIM7cpLMs4NFK29f33lu1iZeGwJAxCYsV/P7geuRfA++bpDutTXjLKMqUTgf00sqJ/5HGuwLE=</Catalog></CustomCapabilityDescriptor>

diff --git a/PC/clinic/_msi.c.h b/PC/clinic/_msi.c.h
new file mode 100644
index 0000000..85c4d22
--- /dev/null
+++ b/PC/clinic/_msi.c.h
@@ -0,0 +1,716 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(_msi_UuidCreate__doc__,
+"UuidCreate($module, /)\n"
+"--\n"
+"\n"
+"Return the string representation of a new unique identifier.");
+
+#define _MSI_UUIDCREATE_METHODDEF    \
+    {"UuidCreate", (PyCFunction)_msi_UuidCreate, METH_NOARGS, _msi_UuidCreate__doc__},
+
+static PyObject *
+_msi_UuidCreate_impl(PyObject *module);
+
+static PyObject *
+_msi_UuidCreate(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+    return _msi_UuidCreate_impl(module);
+}
+
+PyDoc_STRVAR(_msi_FCICreate__doc__,
+"FCICreate($module, cabname, files, /)\n"
+"--\n"
+"\n"
+"Create a new CAB file.\n"
+"\n"
+"  cabname\n"
+"    the name of the CAB file\n"
+"  files\n"
+"    a list of tuples, each containing the name of the file on disk,\n"
+"    and the name of the file inside the CAB file");
+
+#define _MSI_FCICREATE_METHODDEF    \
+    {"FCICreate", (PyCFunction)(void(*)(void))_msi_FCICreate, METH_FASTCALL, _msi_FCICreate__doc__},
+
+static PyObject *
+_msi_FCICreate_impl(PyObject *module, const char *cabname, PyObject *files);
+
+static PyObject *
+_msi_FCICreate(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    const char *cabname;
+    PyObject *files;
+
+    if (!_PyArg_CheckPositional("FCICreate", nargs, 2, 2)) {
+        goto exit;
+    }
+    if (!PyUnicode_Check(args[0])) {
+        _PyArg_BadArgument("FCICreate", "argument 1", "str", args[0]);
+        goto exit;
+    }
+    Py_ssize_t cabname_length;
+    cabname = PyUnicode_AsUTF8AndSize(args[0], &cabname_length);
+    if (cabname == NULL) {
+        goto exit;
+    }
+    if (strlen(cabname) != (size_t)cabname_length) {
+        PyErr_SetString(PyExc_ValueError, "embedded null character");
+        goto exit;
+    }
+    files = args[1];
+    return_value = _msi_FCICreate_impl(module, cabname, files);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_msi_Database_Close__doc__,
+"Close($self, /)\n"
+"--\n"
+"\n"
+"Close the database object.");
+
+#define _MSI_DATABASE_CLOSE_METHODDEF    \
+    {"Close", (PyCFunction)_msi_Database_Close, METH_NOARGS, _msi_Database_Close__doc__},
+
+static PyObject *
+_msi_Database_Close_impl(msiobj *self);
+
+static PyObject *
+_msi_Database_Close(msiobj *self, PyObject *Py_UNUSED(ignored))
+{
+    return _msi_Database_Close_impl(self);
+}
+
+PyDoc_STRVAR(_msi_Record_GetFieldCount__doc__,
+"GetFieldCount($self, /)\n"
+"--\n"
+"\n"
+"Return the number of fields of the record.");
+
+#define _MSI_RECORD_GETFIELDCOUNT_METHODDEF    \
+    {"GetFieldCount", (PyCFunction)_msi_Record_GetFieldCount, METH_NOARGS, _msi_Record_GetFieldCount__doc__},
+
+static PyObject *
+_msi_Record_GetFieldCount_impl(msiobj *self);
+
+static PyObject *
+_msi_Record_GetFieldCount(msiobj *self, PyObject *Py_UNUSED(ignored))
+{
+    return _msi_Record_GetFieldCount_impl(self);
+}
+
+PyDoc_STRVAR(_msi_Record_GetInteger__doc__,
+"GetInteger($self, field, /)\n"
+"--\n"
+"\n"
+"Return the value of field as an integer where possible.");
+
+#define _MSI_RECORD_GETINTEGER_METHODDEF    \
+    {"GetInteger", (PyCFunction)_msi_Record_GetInteger, METH_O, _msi_Record_GetInteger__doc__},
+
+static PyObject *
+_msi_Record_GetInteger_impl(msiobj *self, unsigned int field);
+
+static PyObject *
+_msi_Record_GetInteger(msiobj *self, PyObject *arg)
+{
+    PyObject *return_value = NULL;
+    unsigned int field;
+
+    field = (unsigned int)PyLong_AsUnsignedLongMask(arg);
+    if (field == (unsigned int)-1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    return_value = _msi_Record_GetInteger_impl(self, field);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_msi_Record_GetString__doc__,
+"GetString($self, field, /)\n"
+"--\n"
+"\n"
+"Return the value of field as a string where possible.");
+
+#define _MSI_RECORD_GETSTRING_METHODDEF    \
+    {"GetString", (PyCFunction)_msi_Record_GetString, METH_O, _msi_Record_GetString__doc__},
+
+static PyObject *
+_msi_Record_GetString_impl(msiobj *self, unsigned int field);
+
+static PyObject *
+_msi_Record_GetString(msiobj *self, PyObject *arg)
+{
+    PyObject *return_value = NULL;
+    unsigned int field;
+
+    field = (unsigned int)PyLong_AsUnsignedLongMask(arg);
+    if (field == (unsigned int)-1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    return_value = _msi_Record_GetString_impl(self, field);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_msi_Record_ClearData__doc__,
+"ClearData($self, /)\n"
+"--\n"
+"\n"
+"Set all fields of the record to 0.");
+
+#define _MSI_RECORD_CLEARDATA_METHODDEF    \
+    {"ClearData", (PyCFunction)_msi_Record_ClearData, METH_NOARGS, _msi_Record_ClearData__doc__},
+
+static PyObject *
+_msi_Record_ClearData_impl(msiobj *self);
+
+static PyObject *
+_msi_Record_ClearData(msiobj *self, PyObject *Py_UNUSED(ignored))
+{
+    return _msi_Record_ClearData_impl(self);
+}
+
+PyDoc_STRVAR(_msi_Record_SetString__doc__,
+"SetString($self, field, value, /)\n"
+"--\n"
+"\n"
+"Set field to a string value.");
+
+#define _MSI_RECORD_SETSTRING_METHODDEF    \
+    {"SetString", (PyCFunction)(void(*)(void))_msi_Record_SetString, METH_FASTCALL, _msi_Record_SetString__doc__},
+
+static PyObject *
+_msi_Record_SetString_impl(msiobj *self, int field, const Py_UNICODE *value);
+
+static PyObject *
+_msi_Record_SetString(msiobj *self, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    int field;
+    const Py_UNICODE *value;
+
+    if (!_PyArg_CheckPositional("SetString", nargs, 2, 2)) {
+        goto exit;
+    }
+    field = _PyLong_AsInt(args[0]);
+    if (field == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    if (!PyUnicode_Check(args[1])) {
+        _PyArg_BadArgument("SetString", "argument 2", "str", args[1]);
+        goto exit;
+    }
+    #if USE_UNICODE_WCHAR_CACHE
+    value = _PyUnicode_AsUnicode(args[1]);
+    #else /* USE_UNICODE_WCHAR_CACHE */
+    value = PyUnicode_AsWideCharString(args[1], NULL);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+    if (value == NULL) {
+        goto exit;
+    }
+    return_value = _msi_Record_SetString_impl(self, field, value);
+
+exit:
+    /* Cleanup for value */
+    #if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free((void *)value);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+
+    return return_value;
+}
+
+PyDoc_STRVAR(_msi_Record_SetStream__doc__,
+"SetStream($self, field, value, /)\n"
+"--\n"
+"\n"
+"Set field to the contents of the file named value.");
+
+#define _MSI_RECORD_SETSTREAM_METHODDEF    \
+    {"SetStream", (PyCFunction)(void(*)(void))_msi_Record_SetStream, METH_FASTCALL, _msi_Record_SetStream__doc__},
+
+static PyObject *
+_msi_Record_SetStream_impl(msiobj *self, int field, const Py_UNICODE *value);
+
+static PyObject *
+_msi_Record_SetStream(msiobj *self, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    int field;
+    const Py_UNICODE *value;
+
+    if (!_PyArg_CheckPositional("SetStream", nargs, 2, 2)) {
+        goto exit;
+    }
+    field = _PyLong_AsInt(args[0]);
+    if (field == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    if (!PyUnicode_Check(args[1])) {
+        _PyArg_BadArgument("SetStream", "argument 2", "str", args[1]);
+        goto exit;
+    }
+    #if USE_UNICODE_WCHAR_CACHE
+    value = _PyUnicode_AsUnicode(args[1]);
+    #else /* USE_UNICODE_WCHAR_CACHE */
+    value = PyUnicode_AsWideCharString(args[1], NULL);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+    if (value == NULL) {
+        goto exit;
+    }
+    return_value = _msi_Record_SetStream_impl(self, field, value);
+
+exit:
+    /* Cleanup for value */
+    #if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free((void *)value);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+
+    return return_value;
+}
+
+PyDoc_STRVAR(_msi_Record_SetInteger__doc__,
+"SetInteger($self, field, value, /)\n"
+"--\n"
+"\n"
+"Set field to an integer value.");
+
+#define _MSI_RECORD_SETINTEGER_METHODDEF    \
+    {"SetInteger", (PyCFunction)(void(*)(void))_msi_Record_SetInteger, METH_FASTCALL, _msi_Record_SetInteger__doc__},
+
+static PyObject *
+_msi_Record_SetInteger_impl(msiobj *self, int field, int value);
+
+static PyObject *
+_msi_Record_SetInteger(msiobj *self, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    int field;
+    int value;
+
+    if (!_PyArg_CheckPositional("SetInteger", nargs, 2, 2)) {
+        goto exit;
+    }
+    field = _PyLong_AsInt(args[0]);
+    if (field == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    value = _PyLong_AsInt(args[1]);
+    if (value == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    return_value = _msi_Record_SetInteger_impl(self, field, value);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_msi_SummaryInformation_GetProperty__doc__,
+"GetProperty($self, field, /)\n"
+"--\n"
+"\n"
+"Return a property of the summary.\n"
+"\n"
+"  field\n"
+"    the name of the property, one of the PID_* constants");
+
+#define _MSI_SUMMARYINFORMATION_GETPROPERTY_METHODDEF    \
+    {"GetProperty", (PyCFunction)_msi_SummaryInformation_GetProperty, METH_O, _msi_SummaryInformation_GetProperty__doc__},
+
+static PyObject *
+_msi_SummaryInformation_GetProperty_impl(msiobj *self, int field);
+
+static PyObject *
+_msi_SummaryInformation_GetProperty(msiobj *self, PyObject *arg)
+{
+    PyObject *return_value = NULL;
+    int field;
+
+    field = _PyLong_AsInt(arg);
+    if (field == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    return_value = _msi_SummaryInformation_GetProperty_impl(self, field);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_msi_SummaryInformation_GetPropertyCount__doc__,
+"GetPropertyCount($self, /)\n"
+"--\n"
+"\n"
+"Return the number of summary properties.");
+
+#define _MSI_SUMMARYINFORMATION_GETPROPERTYCOUNT_METHODDEF    \
+    {"GetPropertyCount", (PyCFunction)_msi_SummaryInformation_GetPropertyCount, METH_NOARGS, _msi_SummaryInformation_GetPropertyCount__doc__},
+
+static PyObject *
+_msi_SummaryInformation_GetPropertyCount_impl(msiobj *self);
+
+static PyObject *
+_msi_SummaryInformation_GetPropertyCount(msiobj *self, PyObject *Py_UNUSED(ignored))
+{
+    return _msi_SummaryInformation_GetPropertyCount_impl(self);
+}
+
+PyDoc_STRVAR(_msi_SummaryInformation_SetProperty__doc__,
+"SetProperty($self, field, value, /)\n"
+"--\n"
+"\n"
+"Set a property.\n"
+"\n"
+"  field\n"
+"    the name of the property, one of the PID_* constants\n"
+"  value\n"
+"    the new value of the property (integer or string)");
+
+#define _MSI_SUMMARYINFORMATION_SETPROPERTY_METHODDEF    \
+    {"SetProperty", (PyCFunction)(void(*)(void))_msi_SummaryInformation_SetProperty, METH_FASTCALL, _msi_SummaryInformation_SetProperty__doc__},
+
+static PyObject *
+_msi_SummaryInformation_SetProperty_impl(msiobj *self, int field,
+                                         PyObject *data);
+
+static PyObject *
+_msi_SummaryInformation_SetProperty(msiobj *self, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    int field;
+    PyObject *data;
+
+    if (!_PyArg_CheckPositional("SetProperty", nargs, 2, 2)) {
+        goto exit;
+    }
+    field = _PyLong_AsInt(args[0]);
+    if (field == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    data = args[1];
+    return_value = _msi_SummaryInformation_SetProperty_impl(self, field, data);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_msi_SummaryInformation_Persist__doc__,
+"Persist($self, /)\n"
+"--\n"
+"\n"
+"Write the modified properties to the summary information stream.");
+
+#define _MSI_SUMMARYINFORMATION_PERSIST_METHODDEF    \
+    {"Persist", (PyCFunction)_msi_SummaryInformation_Persist, METH_NOARGS, _msi_SummaryInformation_Persist__doc__},
+
+static PyObject *
+_msi_SummaryInformation_Persist_impl(msiobj *self);
+
+static PyObject *
+_msi_SummaryInformation_Persist(msiobj *self, PyObject *Py_UNUSED(ignored))
+{
+    return _msi_SummaryInformation_Persist_impl(self);
+}
+
+PyDoc_STRVAR(_msi_View_Execute__doc__,
+"Execute($self, params, /)\n"
+"--\n"
+"\n"
+"Execute the SQL query of the view.\n"
+"\n"
+"  params\n"
+"    a record describing actual values of the parameter tokens\n"
+"    in the query or None");
+
+#define _MSI_VIEW_EXECUTE_METHODDEF    \
+    {"Execute", (PyCFunction)_msi_View_Execute, METH_O, _msi_View_Execute__doc__},
+
+PyDoc_STRVAR(_msi_View_Fetch__doc__,
+"Fetch($self, /)\n"
+"--\n"
+"\n"
+"Return a result record of the query.");
+
+#define _MSI_VIEW_FETCH_METHODDEF    \
+    {"Fetch", (PyCFunction)_msi_View_Fetch, METH_NOARGS, _msi_View_Fetch__doc__},
+
+static PyObject *
+_msi_View_Fetch_impl(msiobj *self);
+
+static PyObject *
+_msi_View_Fetch(msiobj *self, PyObject *Py_UNUSED(ignored))
+{
+    return _msi_View_Fetch_impl(self);
+}
+
+PyDoc_STRVAR(_msi_View_GetColumnInfo__doc__,
+"GetColumnInfo($self, kind, /)\n"
+"--\n"
+"\n"
+"Return a record describing the columns of the view.\n"
+"\n"
+"  kind\n"
+"    MSICOLINFO_NAMES or MSICOLINFO_TYPES");
+
+#define _MSI_VIEW_GETCOLUMNINFO_METHODDEF    \
+    {"GetColumnInfo", (PyCFunction)_msi_View_GetColumnInfo, METH_O, _msi_View_GetColumnInfo__doc__},
+
+static PyObject *
+_msi_View_GetColumnInfo_impl(msiobj *self, int kind);
+
+static PyObject *
+_msi_View_GetColumnInfo(msiobj *self, PyObject *arg)
+{
+    PyObject *return_value = NULL;
+    int kind;
+
+    kind = _PyLong_AsInt(arg);
+    if (kind == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    return_value = _msi_View_GetColumnInfo_impl(self, kind);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_msi_View_Modify__doc__,
+"Modify($self, kind, data, /)\n"
+"--\n"
+"\n"
+"Modify the view.\n"
+"\n"
+"  kind\n"
+"    one of the MSIMODIFY_* constants\n"
+"  data\n"
+"    a record describing the new data");
+
+#define _MSI_VIEW_MODIFY_METHODDEF    \
+    {"Modify", (PyCFunction)(void(*)(void))_msi_View_Modify, METH_FASTCALL, _msi_View_Modify__doc__},
+
+static PyObject *
+_msi_View_Modify_impl(msiobj *self, int kind, PyObject *data);
+
+static PyObject *
+_msi_View_Modify(msiobj *self, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    int kind;
+    PyObject *data;
+
+    if (!_PyArg_CheckPositional("Modify", nargs, 2, 2)) {
+        goto exit;
+    }
+    kind = _PyLong_AsInt(args[0]);
+    if (kind == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    data = args[1];
+    return_value = _msi_View_Modify_impl(self, kind, data);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_msi_View_Close__doc__,
+"Close($self, /)\n"
+"--\n"
+"\n"
+"Close the view.");
+
+#define _MSI_VIEW_CLOSE_METHODDEF    \
+    {"Close", (PyCFunction)_msi_View_Close, METH_NOARGS, _msi_View_Close__doc__},
+
+static PyObject *
+_msi_View_Close_impl(msiobj *self);
+
+static PyObject *
+_msi_View_Close(msiobj *self, PyObject *Py_UNUSED(ignored))
+{
+    return _msi_View_Close_impl(self);
+}
+
+PyDoc_STRVAR(_msi_Database_OpenView__doc__,
+"OpenView($self, sql, /)\n"
+"--\n"
+"\n"
+"Return a view object.\n"
+"\n"
+"  sql\n"
+"    the SQL statement to execute");
+
+#define _MSI_DATABASE_OPENVIEW_METHODDEF    \
+    {"OpenView", (PyCFunction)_msi_Database_OpenView, METH_O, _msi_Database_OpenView__doc__},
+
+static PyObject *
+_msi_Database_OpenView_impl(msiobj *self, const Py_UNICODE *sql);
+
+static PyObject *
+_msi_Database_OpenView(msiobj *self, PyObject *arg)
+{
+    PyObject *return_value = NULL;
+    const Py_UNICODE *sql;
+
+    if (!PyUnicode_Check(arg)) {
+        _PyArg_BadArgument("OpenView", "argument", "str", arg);
+        goto exit;
+    }
+    #if USE_UNICODE_WCHAR_CACHE
+    sql = _PyUnicode_AsUnicode(arg);
+    #else /* USE_UNICODE_WCHAR_CACHE */
+    sql = PyUnicode_AsWideCharString(arg, NULL);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+    if (sql == NULL) {
+        goto exit;
+    }
+    return_value = _msi_Database_OpenView_impl(self, sql);
+
+exit:
+    /* Cleanup for sql */
+    #if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free((void *)sql);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+
+    return return_value;
+}
+
+PyDoc_STRVAR(_msi_Database_Commit__doc__,
+"Commit($self, /)\n"
+"--\n"
+"\n"
+"Commit the changes pending in the current transaction.");
+
+#define _MSI_DATABASE_COMMIT_METHODDEF    \
+    {"Commit", (PyCFunction)_msi_Database_Commit, METH_NOARGS, _msi_Database_Commit__doc__},
+
+static PyObject *
+_msi_Database_Commit_impl(msiobj *self);
+
+static PyObject *
+_msi_Database_Commit(msiobj *self, PyObject *Py_UNUSED(ignored))
+{
+    return _msi_Database_Commit_impl(self);
+}
+
+PyDoc_STRVAR(_msi_Database_GetSummaryInformation__doc__,
+"GetSummaryInformation($self, count, /)\n"
+"--\n"
+"\n"
+"Return a new summary information object.\n"
+"\n"
+"  count\n"
+"    the maximum number of updated values");
+
+#define _MSI_DATABASE_GETSUMMARYINFORMATION_METHODDEF    \
+    {"GetSummaryInformation", (PyCFunction)_msi_Database_GetSummaryInformation, METH_O, _msi_Database_GetSummaryInformation__doc__},
+
+static PyObject *
+_msi_Database_GetSummaryInformation_impl(msiobj *self, int count);
+
+static PyObject *
+_msi_Database_GetSummaryInformation(msiobj *self, PyObject *arg)
+{
+    PyObject *return_value = NULL;
+    int count;
+
+    count = _PyLong_AsInt(arg);
+    if (count == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    return_value = _msi_Database_GetSummaryInformation_impl(self, count);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_msi_OpenDatabase__doc__,
+"OpenDatabase($module, path, persist, /)\n"
+"--\n"
+"\n"
+"Return a new database object.\n"
+"\n"
+"  path\n"
+"    the file name of the MSI file\n"
+"  persist\n"
+"    the persistence mode");
+
+#define _MSI_OPENDATABASE_METHODDEF    \
+    {"OpenDatabase", (PyCFunction)(void(*)(void))_msi_OpenDatabase, METH_FASTCALL, _msi_OpenDatabase__doc__},
+
+static PyObject *
+_msi_OpenDatabase_impl(PyObject *module, const Py_UNICODE *path, int persist);
+
+static PyObject *
+_msi_OpenDatabase(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    const Py_UNICODE *path;
+    int persist;
+
+    if (!_PyArg_CheckPositional("OpenDatabase", nargs, 2, 2)) {
+        goto exit;
+    }
+    if (!PyUnicode_Check(args[0])) {
+        _PyArg_BadArgument("OpenDatabase", "argument 1", "str", args[0]);
+        goto exit;
+    }
+    #if USE_UNICODE_WCHAR_CACHE
+    path = _PyUnicode_AsUnicode(args[0]);
+    #else /* USE_UNICODE_WCHAR_CACHE */
+    path = PyUnicode_AsWideCharString(args[0], NULL);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+    if (path == NULL) {
+        goto exit;
+    }
+    persist = _PyLong_AsInt(args[1]);
+    if (persist == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    return_value = _msi_OpenDatabase_impl(module, path, persist);
+
+exit:
+    /* Cleanup for path */
+    #if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free((void *)path);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+
+    return return_value;
+}
+
+PyDoc_STRVAR(_msi_CreateRecord__doc__,
+"CreateRecord($module, count, /)\n"
+"--\n"
+"\n"
+"Return a new record object.\n"
+"\n"
+"  count\n"
+"    the number of fields of the record");
+
+#define _MSI_CREATERECORD_METHODDEF    \
+    {"CreateRecord", (PyCFunction)_msi_CreateRecord, METH_O, _msi_CreateRecord__doc__},
+
+static PyObject *
+_msi_CreateRecord_impl(PyObject *module, int count);
+
+static PyObject *
+_msi_CreateRecord(PyObject *module, PyObject *arg)
+{
+    PyObject *return_value = NULL;
+    int count;
+
+    count = _PyLong_AsInt(arg);
+    if (count == -1 && PyErr_Occurred()) {
+        goto exit;
+    }
+    return_value = _msi_CreateRecord_impl(module, count);
+
+exit:
+    return return_value;
+}
+/*[clinic end generated code: output=49debf733ee5cab2 input=a9049054013a1b77]*/
diff --git a/PC/clinic/msvcrtmodule.c.h b/PC/clinic/msvcrtmodule.c.h
index 180c3e5..1ac82cb 100644
--- a/PC/clinic/msvcrtmodule.c.h
+++ b/PC/clinic/msvcrtmodule.c.h
@@ -53,29 +53,14 @@
     if (!_PyArg_CheckPositional("locking", nargs, 3, 3)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(args[0]);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     mode = _PyLong_AsInt(args[1]);
     if (mode == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     nbytes = PyLong_AsLong(args[2]);
     if (nbytes == -1 && PyErr_Occurred()) {
         goto exit;
@@ -114,20 +99,10 @@
     if (!_PyArg_CheckPositional("setmode", nargs, 2, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(args[0]);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     flags = _PyLong_AsInt(args[1]);
     if (flags == -1 && PyErr_Occurred()) {
         goto exit;
@@ -201,11 +176,6 @@
     int fd;
     void *_return_value;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     fd = _PyLong_AsInt(arg);
     if (fd == -1 && PyErr_Occurred()) {
         goto exit;
@@ -561,20 +531,10 @@
     if (!_PyArg_CheckPositional("CrtSetReportMode", nargs, 2, 2)) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     type = _PyLong_AsInt(args[0]);
     if (type == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     mode = _PyLong_AsInt(args[1]);
     if (mode == -1 && PyErr_Occurred()) {
         goto exit;
@@ -614,11 +574,6 @@
     int mode;
     long _return_value;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     mode = _PyLong_AsInt(arg);
     if (mode == -1 && PyErr_Occurred()) {
         goto exit;
@@ -635,6 +590,24 @@
 
 #endif /* defined(_DEBUG) */
 
+PyDoc_STRVAR(msvcrt_GetErrorMode__doc__,
+"GetErrorMode($module, /)\n"
+"--\n"
+"\n"
+"Wrapper around GetErrorMode.");
+
+#define MSVCRT_GETERRORMODE_METHODDEF    \
+    {"GetErrorMode", (PyCFunction)msvcrt_GetErrorMode, METH_NOARGS, msvcrt_GetErrorMode__doc__},
+
+static PyObject *
+msvcrt_GetErrorMode_impl(PyObject *module);
+
+static PyObject *
+msvcrt_GetErrorMode(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+    return msvcrt_GetErrorMode_impl(module);
+}
+
 PyDoc_STRVAR(msvcrt_SetErrorMode__doc__,
 "SetErrorMode($module, mode, /)\n"
 "--\n"
@@ -653,11 +626,6 @@
     PyObject *return_value = NULL;
     unsigned int mode;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     mode = (unsigned int)PyLong_AsUnsignedLongMask(arg);
     if (mode == (unsigned int)-1 && PyErr_Occurred()) {
         goto exit;
@@ -679,4 +647,4 @@
 #ifndef MSVCRT_SET_ERROR_MODE_METHODDEF
     #define MSVCRT_SET_ERROR_MODE_METHODDEF
 #endif /* !defined(MSVCRT_SET_ERROR_MODE_METHODDEF) */
-/*[clinic end generated code: output=7cc6ffaf64f268f7 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=20dfbc768edce7c0 input=a9049054013a1b77]*/
diff --git a/PC/clinic/winreg.c.h b/PC/clinic/winreg.c.h
index b7af185..183301f 100644
--- a/PC/clinic/winreg.c.h
+++ b/PC/clinic/winreg.c.h
@@ -152,8 +152,27 @@
     HKEY key;
     HKEY _return_value;
 
-    if (!_PyArg_ParseStack(args, nargs, "ZO&:ConnectRegistry",
-        &computer_name, clinic_HKEY_converter, &key)) {
+    if (!_PyArg_CheckPositional("ConnectRegistry", nargs, 2, 2)) {
+        goto exit;
+    }
+    if (args[0] == Py_None) {
+        computer_name = NULL;
+    }
+    else if (PyUnicode_Check(args[0])) {
+        #if USE_UNICODE_WCHAR_CACHE
+        computer_name = _PyUnicode_AsUnicode(args[0]);
+        #else /* USE_UNICODE_WCHAR_CACHE */
+        computer_name = PyUnicode_AsWideCharString(args[0], NULL);
+        #endif /* USE_UNICODE_WCHAR_CACHE */
+        if (computer_name == NULL) {
+            goto exit;
+        }
+    }
+    else {
+        _PyArg_BadArgument("ConnectRegistry", "argument 1", "str or None", args[0]);
+        goto exit;
+    }
+    if (!clinic_HKEY_converter(args[1], &key)) {
         goto exit;
     }
     _return_value = winreg_ConnectRegistry_impl(module, computer_name, key);
@@ -163,6 +182,11 @@
     return_value = PyHKEY_FromHKEY(_return_value);
 
 exit:
+    /* Cleanup for computer_name */
+    #if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free((void *)computer_name);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+
     return return_value;
 }
 
@@ -199,8 +223,27 @@
     const Py_UNICODE *sub_key;
     HKEY _return_value;
 
-    if (!_PyArg_ParseStack(args, nargs, "O&Z:CreateKey",
-        clinic_HKEY_converter, &key, &sub_key)) {
+    if (!_PyArg_CheckPositional("CreateKey", nargs, 2, 2)) {
+        goto exit;
+    }
+    if (!clinic_HKEY_converter(args[0], &key)) {
+        goto exit;
+    }
+    if (args[1] == Py_None) {
+        sub_key = NULL;
+    }
+    else if (PyUnicode_Check(args[1])) {
+        #if USE_UNICODE_WCHAR_CACHE
+        sub_key = _PyUnicode_AsUnicode(args[1]);
+        #else /* USE_UNICODE_WCHAR_CACHE */
+        sub_key = PyUnicode_AsWideCharString(args[1], NULL);
+        #endif /* USE_UNICODE_WCHAR_CACHE */
+        if (sub_key == NULL) {
+            goto exit;
+        }
+    }
+    else {
+        _PyArg_BadArgument("CreateKey", "argument 2", "str or None", args[1]);
         goto exit;
     }
     _return_value = winreg_CreateKey_impl(module, key, sub_key);
@@ -210,6 +253,11 @@
     return_value = PyHKEY_FromHKEY(_return_value);
 
 exit:
+    /* Cleanup for sub_key */
+    #if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free((void *)sub_key);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+
     return return_value;
 }
 
@@ -251,7 +299,7 @@
 {
     PyObject *return_value = NULL;
     static const char * const _keywords[] = {"key", "sub_key", "reserved", "access", NULL};
-    static _PyArg_Parser _parser = {"O&Z|ii:CreateKeyEx", _keywords, 0};
+    static _PyArg_Parser _parser = {"O&O&|ii:CreateKeyEx", _keywords, 0};
     HKEY key;
     const Py_UNICODE *sub_key;
     int reserved = 0;
@@ -259,7 +307,7 @@
     HKEY _return_value;
 
     if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
-        clinic_HKEY_converter, &key, &sub_key, &reserved, &access)) {
+        clinic_HKEY_converter, &key, _PyUnicode_WideCharString_Opt_Converter, &sub_key, &reserved, &access)) {
         goto exit;
     }
     _return_value = winreg_CreateKeyEx_impl(module, key, sub_key, reserved, access);
@@ -269,6 +317,11 @@
     return_value = PyHKEY_FromHKEY(_return_value);
 
 exit:
+    /* Cleanup for sub_key */
+    #if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free((void *)sub_key);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+
     return return_value;
 }
 
@@ -303,13 +356,32 @@
     HKEY key;
     const Py_UNICODE *sub_key;
 
-    if (!_PyArg_ParseStack(args, nargs, "O&u:DeleteKey",
-        clinic_HKEY_converter, &key, &sub_key)) {
+    if (!_PyArg_CheckPositional("DeleteKey", nargs, 2, 2)) {
+        goto exit;
+    }
+    if (!clinic_HKEY_converter(args[0], &key)) {
+        goto exit;
+    }
+    if (!PyUnicode_Check(args[1])) {
+        _PyArg_BadArgument("DeleteKey", "argument 2", "str", args[1]);
+        goto exit;
+    }
+    #if USE_UNICODE_WCHAR_CACHE
+    sub_key = _PyUnicode_AsUnicode(args[1]);
+    #else /* USE_UNICODE_WCHAR_CACHE */
+    sub_key = PyUnicode_AsWideCharString(args[1], NULL);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+    if (sub_key == NULL) {
         goto exit;
     }
     return_value = winreg_DeleteKey_impl(module, key, sub_key);
 
 exit:
+    /* Cleanup for sub_key */
+    #if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free((void *)sub_key);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+
     return return_value;
 }
 
@@ -351,19 +423,24 @@
 {
     PyObject *return_value = NULL;
     static const char * const _keywords[] = {"key", "sub_key", "access", "reserved", NULL};
-    static _PyArg_Parser _parser = {"O&u|ii:DeleteKeyEx", _keywords, 0};
+    static _PyArg_Parser _parser = {"O&O&|ii:DeleteKeyEx", _keywords, 0};
     HKEY key;
     const Py_UNICODE *sub_key;
     REGSAM access = KEY_WOW64_64KEY;
     int reserved = 0;
 
     if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
-        clinic_HKEY_converter, &key, &sub_key, &access, &reserved)) {
+        clinic_HKEY_converter, &key, _PyUnicode_WideCharString_Converter, &sub_key, &access, &reserved)) {
         goto exit;
     }
     return_value = winreg_DeleteKeyEx_impl(module, key, sub_key, access, reserved);
 
 exit:
+    /* Cleanup for sub_key */
+    #if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free((void *)sub_key);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+
     return return_value;
 }
 
@@ -391,13 +468,37 @@
     HKEY key;
     const Py_UNICODE *value;
 
-    if (!_PyArg_ParseStack(args, nargs, "O&Z:DeleteValue",
-        clinic_HKEY_converter, &key, &value)) {
+    if (!_PyArg_CheckPositional("DeleteValue", nargs, 2, 2)) {
+        goto exit;
+    }
+    if (!clinic_HKEY_converter(args[0], &key)) {
+        goto exit;
+    }
+    if (args[1] == Py_None) {
+        value = NULL;
+    }
+    else if (PyUnicode_Check(args[1])) {
+        #if USE_UNICODE_WCHAR_CACHE
+        value = _PyUnicode_AsUnicode(args[1]);
+        #else /* USE_UNICODE_WCHAR_CACHE */
+        value = PyUnicode_AsWideCharString(args[1], NULL);
+        #endif /* USE_UNICODE_WCHAR_CACHE */
+        if (value == NULL) {
+            goto exit;
+        }
+    }
+    else {
+        _PyArg_BadArgument("DeleteValue", "argument 2", "str or None", args[1]);
         goto exit;
     }
     return_value = winreg_DeleteValue_impl(module, key, value);
 
 exit:
+    /* Cleanup for value */
+    #if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free((void *)value);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+
     return return_value;
 }
 
@@ -435,11 +536,6 @@
     if (!clinic_HKEY_converter(args[0], &key)) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     index = _PyLong_AsInt(args[1]);
     if (index == -1 && PyErr_Occurred()) {
         goto exit;
@@ -493,11 +589,6 @@
     if (!clinic_HKEY_converter(args[0], &key)) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     index = _PyLong_AsInt(args[1]);
     if (index == -1 && PyErr_Occurred()) {
         goto exit;
@@ -527,12 +618,26 @@
     PyObject *return_value = NULL;
     const Py_UNICODE *string;
 
-    if (!PyArg_Parse(arg, "u:ExpandEnvironmentStrings", &string)) {
+    if (!PyUnicode_Check(arg)) {
+        _PyArg_BadArgument("ExpandEnvironmentStrings", "argument", "str", arg);
+        goto exit;
+    }
+    #if USE_UNICODE_WCHAR_CACHE
+    string = _PyUnicode_AsUnicode(arg);
+    #else /* USE_UNICODE_WCHAR_CACHE */
+    string = PyUnicode_AsWideCharString(arg, NULL);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+    if (string == NULL) {
         goto exit;
     }
     return_value = winreg_ExpandEnvironmentStrings_impl(module, string);
 
 exit:
+    /* Cleanup for string */
+    #if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free((void *)string);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+
     return return_value;
 }
 
@@ -619,13 +724,48 @@
     const Py_UNICODE *sub_key;
     const Py_UNICODE *file_name;
 
-    if (!_PyArg_ParseStack(args, nargs, "O&uu:LoadKey",
-        clinic_HKEY_converter, &key, &sub_key, &file_name)) {
+    if (!_PyArg_CheckPositional("LoadKey", nargs, 3, 3)) {
+        goto exit;
+    }
+    if (!clinic_HKEY_converter(args[0], &key)) {
+        goto exit;
+    }
+    if (!PyUnicode_Check(args[1])) {
+        _PyArg_BadArgument("LoadKey", "argument 2", "str", args[1]);
+        goto exit;
+    }
+    #if USE_UNICODE_WCHAR_CACHE
+    sub_key = _PyUnicode_AsUnicode(args[1]);
+    #else /* USE_UNICODE_WCHAR_CACHE */
+    sub_key = PyUnicode_AsWideCharString(args[1], NULL);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+    if (sub_key == NULL) {
+        goto exit;
+    }
+    if (!PyUnicode_Check(args[2])) {
+        _PyArg_BadArgument("LoadKey", "argument 3", "str", args[2]);
+        goto exit;
+    }
+    #if USE_UNICODE_WCHAR_CACHE
+    file_name = _PyUnicode_AsUnicode(args[2]);
+    #else /* USE_UNICODE_WCHAR_CACHE */
+    file_name = PyUnicode_AsWideCharString(args[2], NULL);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+    if (file_name == NULL) {
         goto exit;
     }
     return_value = winreg_LoadKey_impl(module, key, sub_key, file_name);
 
 exit:
+    /* Cleanup for sub_key */
+    #if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free((void *)sub_key);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+    /* Cleanup for file_name */
+    #if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free((void *)file_name);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+
     return return_value;
 }
 
@@ -660,7 +800,7 @@
 {
     PyObject *return_value = NULL;
     static const char * const _keywords[] = {"key", "sub_key", "reserved", "access", NULL};
-    static _PyArg_Parser _parser = {"O&Z|ii:OpenKey", _keywords, 0};
+    static _PyArg_Parser _parser = {"O&O&|ii:OpenKey", _keywords, 0};
     HKEY key;
     const Py_UNICODE *sub_key;
     int reserved = 0;
@@ -668,7 +808,7 @@
     HKEY _return_value;
 
     if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
-        clinic_HKEY_converter, &key, &sub_key, &reserved, &access)) {
+        clinic_HKEY_converter, &key, _PyUnicode_WideCharString_Opt_Converter, &sub_key, &reserved, &access)) {
         goto exit;
     }
     _return_value = winreg_OpenKey_impl(module, key, sub_key, reserved, access);
@@ -678,6 +818,11 @@
     return_value = PyHKEY_FromHKEY(_return_value);
 
 exit:
+    /* Cleanup for sub_key */
+    #if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free((void *)sub_key);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+
     return return_value;
 }
 
@@ -712,7 +857,7 @@
 {
     PyObject *return_value = NULL;
     static const char * const _keywords[] = {"key", "sub_key", "reserved", "access", NULL};
-    static _PyArg_Parser _parser = {"O&Z|ii:OpenKeyEx", _keywords, 0};
+    static _PyArg_Parser _parser = {"O&O&|ii:OpenKeyEx", _keywords, 0};
     HKEY key;
     const Py_UNICODE *sub_key;
     int reserved = 0;
@@ -720,7 +865,7 @@
     HKEY _return_value;
 
     if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
-        clinic_HKEY_converter, &key, &sub_key, &reserved, &access)) {
+        clinic_HKEY_converter, &key, _PyUnicode_WideCharString_Opt_Converter, &sub_key, &reserved, &access)) {
         goto exit;
     }
     _return_value = winreg_OpenKeyEx_impl(module, key, sub_key, reserved, access);
@@ -730,6 +875,11 @@
     return_value = PyHKEY_FromHKEY(_return_value);
 
 exit:
+    /* Cleanup for sub_key */
+    #if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free((void *)sub_key);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+
     return return_value;
 }
 
@@ -802,13 +952,37 @@
     HKEY key;
     const Py_UNICODE *sub_key;
 
-    if (!_PyArg_ParseStack(args, nargs, "O&Z:QueryValue",
-        clinic_HKEY_converter, &key, &sub_key)) {
+    if (!_PyArg_CheckPositional("QueryValue", nargs, 2, 2)) {
+        goto exit;
+    }
+    if (!clinic_HKEY_converter(args[0], &key)) {
+        goto exit;
+    }
+    if (args[1] == Py_None) {
+        sub_key = NULL;
+    }
+    else if (PyUnicode_Check(args[1])) {
+        #if USE_UNICODE_WCHAR_CACHE
+        sub_key = _PyUnicode_AsUnicode(args[1]);
+        #else /* USE_UNICODE_WCHAR_CACHE */
+        sub_key = PyUnicode_AsWideCharString(args[1], NULL);
+        #endif /* USE_UNICODE_WCHAR_CACHE */
+        if (sub_key == NULL) {
+            goto exit;
+        }
+    }
+    else {
+        _PyArg_BadArgument("QueryValue", "argument 2", "str or None", args[1]);
         goto exit;
     }
     return_value = winreg_QueryValue_impl(module, key, sub_key);
 
 exit:
+    /* Cleanup for sub_key */
+    #if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free((void *)sub_key);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+
     return return_value;
 }
 
@@ -841,13 +1015,37 @@
     HKEY key;
     const Py_UNICODE *name;
 
-    if (!_PyArg_ParseStack(args, nargs, "O&Z:QueryValueEx",
-        clinic_HKEY_converter, &key, &name)) {
+    if (!_PyArg_CheckPositional("QueryValueEx", nargs, 2, 2)) {
+        goto exit;
+    }
+    if (!clinic_HKEY_converter(args[0], &key)) {
+        goto exit;
+    }
+    if (args[1] == Py_None) {
+        name = NULL;
+    }
+    else if (PyUnicode_Check(args[1])) {
+        #if USE_UNICODE_WCHAR_CACHE
+        name = _PyUnicode_AsUnicode(args[1]);
+        #else /* USE_UNICODE_WCHAR_CACHE */
+        name = PyUnicode_AsWideCharString(args[1], NULL);
+        #endif /* USE_UNICODE_WCHAR_CACHE */
+        if (name == NULL) {
+            goto exit;
+        }
+    }
+    else {
+        _PyArg_BadArgument("QueryValueEx", "argument 2", "str or None", args[1]);
         goto exit;
     }
     return_value = winreg_QueryValueEx_impl(module, key, name);
 
 exit:
+    /* Cleanup for name */
+    #if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free((void *)name);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+
     return return_value;
 }
 
@@ -885,13 +1083,32 @@
     HKEY key;
     const Py_UNICODE *file_name;
 
-    if (!_PyArg_ParseStack(args, nargs, "O&u:SaveKey",
-        clinic_HKEY_converter, &key, &file_name)) {
+    if (!_PyArg_CheckPositional("SaveKey", nargs, 2, 2)) {
+        goto exit;
+    }
+    if (!clinic_HKEY_converter(args[0], &key)) {
+        goto exit;
+    }
+    if (!PyUnicode_Check(args[1])) {
+        _PyArg_BadArgument("SaveKey", "argument 2", "str", args[1]);
+        goto exit;
+    }
+    #if USE_UNICODE_WCHAR_CACHE
+    file_name = _PyUnicode_AsUnicode(args[1]);
+    #else /* USE_UNICODE_WCHAR_CACHE */
+    file_name = PyUnicode_AsWideCharString(args[1], NULL);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+    if (file_name == NULL) {
         goto exit;
     }
     return_value = winreg_SaveKey_impl(module, key, file_name);
 
 exit:
+    /* Cleanup for file_name */
+    #if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free((void *)file_name);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+
     return return_value;
 }
 
@@ -926,8 +1143,7 @@
 
 static PyObject *
 winreg_SetValue_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key,
-                     DWORD type, const Py_UNICODE *value,
-                     Py_ssize_clean_t value_length);
+                     DWORD type, PyObject *value_obj);
 
 static PyObject *
 winreg_SetValue(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
@@ -936,16 +1152,20 @@
     HKEY key;
     const Py_UNICODE *sub_key;
     DWORD type;
-    const Py_UNICODE *value;
-    Py_ssize_clean_t value_length;
+    PyObject *value_obj;
 
-    if (!_PyArg_ParseStack(args, nargs, "O&Zku#:SetValue",
-        clinic_HKEY_converter, &key, &sub_key, &type, &value, &value_length)) {
+    if (!_PyArg_ParseStack(args, nargs, "O&O&kU:SetValue",
+        clinic_HKEY_converter, &key, _PyUnicode_WideCharString_Opt_Converter, &sub_key, &type, &value_obj)) {
         goto exit;
     }
-    return_value = winreg_SetValue_impl(module, key, sub_key, type, value, value_length);
+    return_value = winreg_SetValue_impl(module, key, sub_key, type, value_obj);
 
 exit:
+    /* Cleanup for sub_key */
+    #if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free((void *)sub_key);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+
     return return_value;
 }
 
@@ -1010,13 +1230,18 @@
     DWORD type;
     PyObject *value;
 
-    if (!_PyArg_ParseStack(args, nargs, "O&ZOkO:SetValueEx",
-        clinic_HKEY_converter, &key, &value_name, &reserved, &type, &value)) {
+    if (!_PyArg_ParseStack(args, nargs, "O&O&OkO:SetValueEx",
+        clinic_HKEY_converter, &key, _PyUnicode_WideCharString_Opt_Converter, &value_name, &reserved, &type, &value)) {
         goto exit;
     }
     return_value = winreg_SetValueEx_impl(module, key, value_name, reserved, type, value);
 
 exit:
+    /* Cleanup for value_name */
+    #if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free((void *)value_name);
+    #endif /* USE_UNICODE_WCHAR_CACHE */
+
     return return_value;
 }
 
@@ -1121,4 +1346,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=015afbbd690eb59d input=a9049054013a1b77]*/
+/*[clinic end generated code: output=497a2e804821d5c9 input=a9049054013a1b77]*/
diff --git a/PC/clinic/winsound.c.h b/PC/clinic/winsound.c.h
index b37db4c..c545899 100644
--- a/PC/clinic/winsound.c.h
+++ b/PC/clinic/winsound.c.h
@@ -34,11 +34,6 @@
         goto exit;
     }
     sound = args[0];
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     flags = _PyLong_AsInt(args[1]);
     if (flags == -1 && PyErr_Occurred()) {
         goto exit;
@@ -81,20 +76,10 @@
     if (!args) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     frequency = _PyLong_AsInt(args[0]);
     if (frequency == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     duration = _PyLong_AsInt(args[1]);
     if (duration == -1 && PyErr_Occurred()) {
         goto exit;
@@ -136,11 +121,6 @@
     if (!noptargs) {
         goto skip_optional_pos;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     type = _PyLong_AsInt(args[0]);
     if (type == -1 && PyErr_Occurred()) {
         goto exit;
@@ -151,4 +131,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=28d1cd033282723d input=a9049054013a1b77]*/
+/*[clinic end generated code: output=16b3c1a96861cd3a input=a9049054013a1b77]*/
diff --git a/PC/config.c b/PC/config.c
index 32af2a8..87cd76d 100644
--- a/PC/config.c
+++ b/PC/config.c
@@ -45,7 +45,6 @@
 extern PyObject* PyInit_mmap(void);
 extern PyObject* PyInit__csv(void);
 extern PyObject* PyInit__sre(void);
-extern PyObject* PyInit_parser(void);
 extern PyObject* PyInit_winreg(void);
 extern PyObject* PyInit__struct(void);
 extern PyObject* PyInit__datetime(void);
@@ -75,7 +74,6 @@
 
 extern PyObject* PyInit__contextvars(void);
 
-extern PyObject* PyInit__peg_parser(void);
 
 /* tools/freeze/makeconfig.py marker for additional "extern" */
 /* -- ADDMODULE MARKER 1 -- */
@@ -127,7 +125,6 @@
     {"mmap", PyInit_mmap},
     {"_csv", PyInit__csv},
     {"_sre", PyInit__sre},
-    {"parser", PyInit_parser},
     {"winreg", PyInit_winreg},
     {"_struct", PyInit__struct},
     {"_datetime", PyInit__datetime},
@@ -171,7 +168,6 @@
     {"_opcode", PyInit__opcode},
 
     {"_contextvars", PyInit__contextvars},
-    {"_peg_parser", PyInit__peg_parser},
 
     /* Sentinel */
     {0, 0}
diff --git a/PC/getpathp.c b/PC/getpathp.c
index 53da3a6..7c0eeab 100644
--- a/PC/getpathp.c
+++ b/PC/getpathp.c
@@ -29,7 +29,7 @@
      - If we DO have a Python Home: The relevant sub-directories (Lib,
        DLLs, etc) are based on the Python Home
      - If we DO NOT have a Python Home, the core Python Path is
-       loaded from the registry.  This is the main PythonPath key,
+       loaded from the registry.  (This is the main PythonPath key,
        and both HKLM and HKCU are combined to form the path)
 
    * Iff - we can not locate the Python Home, have not had a PYTHONPATH
@@ -91,7 +91,6 @@
 
 #include <windows.h>
 #include <pathcch.h>
-#include <shlwapi.h>
 
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
@@ -332,7 +331,7 @@
    Returns NULL, or a pointer that should be freed.
 
    XXX - this code is pretty strange, as it used to also
-   work on Win16, where the buffer sizes werent available
+   work on Win16, where the buffer sizes were not available
    in advance.  It could be simplied now Win16/Win32s is dead!
 */
 static wchar_t *
diff --git a/PC/icons/logox128.png b/PC/icons/logox128.png
index d2655c7..a403de5 100644
--- a/PC/icons/logox128.png
+++ b/PC/icons/logox128.png
Binary files differ
diff --git a/PC/icons/py.png b/PC/icons/py.png
index 5c184e6..629022a 100644
--- a/PC/icons/py.png
+++ b/PC/icons/py.png
Binary files differ
diff --git a/PC/icons/pythonwx150.png b/PC/icons/pythonwx150.png
index 4c3eb31..589873a 100644
--- a/PC/icons/pythonwx150.png
+++ b/PC/icons/pythonwx150.png
Binary files differ
diff --git a/PC/icons/pythonwx44.png b/PC/icons/pythonwx44.png
index e3b32a8..8cd8dd0 100644
--- a/PC/icons/pythonwx44.png
+++ b/PC/icons/pythonwx44.png
Binary files differ
diff --git a/PC/icons/pythonx150.png b/PC/icons/pythonx150.png
index 5f8d304..e00aa75 100644
--- a/PC/icons/pythonx150.png
+++ b/PC/icons/pythonx150.png
Binary files differ
diff --git a/PC/icons/pythonx44.png b/PC/icons/pythonx44.png
index 3881daa..db0e9b9 100644
--- a/PC/icons/pythonx44.png
+++ b/PC/icons/pythonx44.png
Binary files differ
diff --git a/PC/icons/pythonx50.png b/PC/icons/pythonx50.png
index 7cc3aec..8eb5ffc 100644
--- a/PC/icons/pythonx50.png
+++ b/PC/icons/pythonx50.png
Binary files differ
diff --git a/PC/launcher.c b/PC/launcher.c
index 106fc66..734e753 100644
--- a/PC/launcher.c
+++ b/PC/launcher.c
@@ -344,7 +344,7 @@
                     }
                     else if (attrs & FILE_ATTRIBUTE_DIRECTORY) {
                         debug(L"locate_pythons_for_key: '%ls' is a directory\n",
-                              ip->executable, attrs);
+                              ip->executable);
                     }
                     else if (find_existing_python(ip->executable)) {
                         debug(L"locate_pythons_for_key: %ls: already found\n",
@@ -425,11 +425,21 @@
     INSTALLED_PYTHON * ip1 = (INSTALLED_PYTHON *) p1;
     INSTALLED_PYTHON * ip2 = (INSTALLED_PYTHON *) p2;
     /* note reverse sorting on version */
-    int result = wcscmp(ip2->version, ip1->version);
-
-    if (result == 0)
-        result = ip2->bits - ip1->bits; /* 64 before 32 */
-    return result;
+    int result = CompareStringW(LOCALE_INVARIANT, SORT_DIGITSASNUMBERS,
+                                ip2->version, -1, ip1->version, -1);
+    switch (result) {
+    case 0:
+        error(0, L"CompareStringW failed");
+        return 0;
+    case CSTR_LESS_THAN:
+        return -1;
+    case CSTR_EQUAL:
+        return ip2->bits - ip1->bits; /* 64 before 32 */
+    case CSTR_GREATER_THAN:
+        return 1;
+    default:
+        return 0; // This should never be reached.
+    }
 }
 
 static void
@@ -532,8 +542,17 @@
     }
     for (i = 0; i < num_installed_pythons; i++, ip++) {
         n = wcslen(ip->version);
-        if (n > wlen)
+        /*
+         * If wlen is greater than 1, we're probably trying to find a specific
+         * version and thus want an exact match: 3.1 != 3.10.  Otherwise, we
+         * just want a prefix match.
+         */
+        if ((wlen > 1) && (n != wlen)) {
+            continue;
+        }
+        if (n > wlen) {
             n = wlen;
+        }
         if ((wcsncmp(ip->version, wanted_ver, n) == 0) &&
             /* bits == 0 => don't care */
             ((bits == 0) || (ip->bits == bits))) {
@@ -1248,6 +1267,7 @@
     { 3390, 3399, L"3.7" },
     { 3400, 3419, L"3.8" },
     { 3420, 3429, L"3.9" },
+    { 3430, 3439, L"3.10" },
     { 0 }
 };
 
@@ -1541,8 +1561,8 @@
     fputws(L"\nany of the following, (in priority order):", stdout);
     fputws(L"\n An active virtual environment", stdout);
     fputws(L"\n A shebang line in the script (if present)", stdout);
-    fputws(L"\n With -2 or -3 flag a matching PY_PYTHON2 or PY_PYTHON3 Enviroment variable", stdout);
-    fputws(L"\n A PY_PYTHON Enviroment variable", stdout);
+    fputws(L"\n With -2 or -3 flag a matching PY_PYTHON2 or PY_PYTHON3 Environment variable", stdout);
+    fputws(L"\n A PY_PYTHON Environment variable", stdout);
     fputws(L"\n From [defaults] in py.ini in your %LOCALAPPDATA%\\py.ini", stdout);
     fputws(L"\n From [defaults] in py.ini beside py.exe (use `where py` to locate)", stdout);
     fputws(L"\n\nThe following help text is from Python:\n\n", stdout);
diff --git a/PC/layout/main.py b/PC/layout/main.py
index 3eef755..fb6f526 100644
--- a/PC/layout/main.py
+++ b/PC/layout/main.py
@@ -33,10 +33,7 @@
 from .support.props import *
 from .support.nuspec import *
 
-BDIST_WININST_FILES_ONLY = FileNameSet("wininst-*", "bdist_wininst.py")
-BDIST_WININST_STUB = "PC/layout/support/distutils.command.bdist_wininst.py"
-
-TEST_PYDS_ONLY = FileStemSet("xxlimited", "_ctypes_test", "_test*")
+TEST_PYDS_ONLY = FileStemSet("xxlimited", "xxlimited_35", "_ctypes_test", "_test*")
 TEST_DIRS_ONLY = FileNameSet("test", "tests")
 
 IDLE_DIRS_ONLY = FileNameSet("idlelib")
@@ -100,17 +97,11 @@
         else:
             if f in TCLTK_FILES_ONLY:
                 return ns.include_tcltk
-            if f in BDIST_WININST_FILES_ONLY:
-                return ns.include_bdist_wininst
         return True
 
     for dest, src in rglob(ns.source / "Lib", "**/*", _c):
         yield dest, src
 
-    if not ns.include_bdist_wininst:
-        src = ns.source / BDIST_WININST_STUB
-        yield Path("distutils/command/bdist_wininst.py"), src
-
 
 def get_tcltk_lib(ns):
     if not ns.include_tcltk:
diff --git a/PC/layout/support/appxmanifest.py b/PC/layout/support/appxmanifest.py
index 747c97a..427a36f 100644
--- a/PC/layout/support/appxmanifest.py
+++ b/PC/layout/support/appxmanifest.py
@@ -412,14 +412,22 @@
         if value:
             node.text = value
 
-    winver = sys.getwindowsversion()[:3]
+    try:
+        winver = tuple(int(i) for i in os.getenv("APPX_DATA_WINVER", "").split(".", maxsplit=3))
+    except (TypeError, ValueError):
+        winver = ()
+
+    # Default "known good" version is 10.0.22000, first Windows 11 release
+    winver = winver or (10, 0, 22000)
+
     if winver < (10, 0, 17763):
         winver = 10, 0, 17763
     find_or_add(xml, "m:Dependencies/m:TargetDeviceFamily").set(
-        "MaxVersionTested", "{}.{}.{}.0".format(*winver)
+        "MaxVersionTested", "{}.{}.{}.{}".format(*(winver + (0, 0, 0, 0)[:4]))
     )
 
-    if winver > (10, 0, 17763):
+    # Only for Python 3.11 and later. Older versions do not disable virtualization
+    if (VER_MAJOR, VER_MINOR) >= (3, 11) and winver > (10, 0, 17763):
         disable_registry_virtualization(xml)
 
     app = add_application(
@@ -430,7 +438,7 @@
         ["python", "python{}".format(VER_MAJOR), "python{}".format(VER_DOT)],
         PYTHON_VE_DATA,
         "console",
-        ("python.file", [".py"], '"%1"', "Python File", PY_PNG),
+        ("python.file", [".py"], '"%1" %*', "Python File", PY_PNG),
     )
 
     add_application(
@@ -441,7 +449,7 @@
         ["pythonw", "pythonw{}".format(VER_MAJOR), "pythonw{}".format(VER_DOT)],
         PYTHONW_VE_DATA,
         "windows",
-        ("python.windowedfile", [".pyw"], '"%1"', "Python File (no console)", PY_PNG),
+        ("python.windowedfile", [".pyw"], '"%1" %*', "Python File (no console)", PY_PNG),
     )
 
     if ns.include_pip and ns.include_launchers:
diff --git a/PC/layout/support/constants.py b/PC/layout/support/constants.py
index 6cf0fe1..6efd8bc 100644
--- a/PC/layout/support/constants.py
+++ b/PC/layout/support/constants.py
@@ -16,7 +16,7 @@
         hexversion = int(os.getenv("PYTHON_HEXVERSION"), 16)
     except (TypeError, ValueError):
         hexversion = sys.hexversion
-    return struct.pack(">i", sys.hexversion)
+    return struct.pack(">i", hexversion)
 
 
 def _get_suffix(field4):
diff --git a/PC/layout/support/distutils.command.bdist_wininst.py b/PC/layout/support/distutils.command.bdist_wininst.py
deleted file mode 100644
index 6e9b49f..0000000
--- a/PC/layout/support/distutils.command.bdist_wininst.py
+++ /dev/null
@@ -1,25 +0,0 @@
-"""distutils.command.bdist_wininst
-
-Suppress the 'bdist_wininst' command, while still allowing
-setuptools to import it without breaking."""
-
-from distutils.core import Command
-from distutils.errors import DistutilsPlatformError
-
-
-class bdist_wininst(Command):
-    description = "create an executable installer for MS Windows"
-
-    # Marker for tests that we have the unsupported bdist_wininst
-    _unsupported = True
-
-    def initialize_options(self):
-        pass
-
-    def finalize_options(self):
-        pass
-
-    def run(self):
-        raise DistutilsPlatformError(
-            "bdist_wininst is not supported in this Python distribution"
-        )
diff --git a/PC/layout/support/options.py b/PC/layout/support/options.py
index 5e1543b..9faf20c 100644
--- a/PC/layout/support/options.py
+++ b/PC/layout/support/options.py
@@ -26,7 +26,6 @@
     "venv": {"help": "venv"},
     "dev": {"help": "headers and libs"},
     "symbols": {"help": "symbols"},
-    "bdist-wininst": {"help": "bdist_wininst support"},
     "underpth": {"help": "a python._pth file", "not-in-all": True},
     "launchers": {"help": "specific launchers"},
     "appxmanifest": {"help": "an appxmanifest"},
@@ -81,7 +80,6 @@
             "venv",
             "dev",
             "symbols",
-            "bdist-wininst",
             "chm",
         ],
     },
diff --git a/PC/msvcrtmodule.c b/PC/msvcrtmodule.c
index faceb03..0591497 100644
--- a/PC/msvcrtmodule.c
+++ b/PC/msvcrtmodule.c
@@ -177,19 +177,11 @@
 msvcrt_open_osfhandle_impl(PyObject *module, void *handle, int flags)
 /*[clinic end generated code: output=b2fb97c4b515e4e6 input=d5db190a307cf4bb]*/
 {
-    int fd;
-
     if (PySys_Audit("msvcrt.open_osfhandle", "Ki", handle, flags) < 0) {
         return -1;
     }
 
-    _Py_BEGIN_SUPPRESS_IPH
-    fd = _open_osfhandle((intptr_t)handle, flags);
-    _Py_END_SUPPRESS_IPH
-    if (fd == -1)
-        PyErr_SetFromErrno(PyExc_OSError);
-
-    return fd;
+    return _Py_open_osfhandle(handle, flags);
 }
 
 /*[clinic input]
@@ -207,19 +199,11 @@
 msvcrt_get_osfhandle_impl(PyObject *module, int fd)
 /*[clinic end generated code: output=aca01dfe24637374 input=5fcfde9b17136aa2]*/
 {
-    intptr_t handle = -1;
-
     if (PySys_Audit("msvcrt.get_osfhandle", "(i)", fd) < 0) {
         return NULL;
     }
 
-    _Py_BEGIN_SUPPRESS_IPH
-    handle = _get_osfhandle(fd);
-    _Py_END_SUPPRESS_IPH
-    if (handle == -1)
-        PyErr_SetFromErrno(PyExc_OSError);
-
-    return (HANDLE)handle;
+    return _Py_get_osfhandle(fd);
 }
 
 /* Console I/O */
@@ -483,6 +467,25 @@
 #endif /* _DEBUG */
 
 /*[clinic input]
+msvcrt.GetErrorMode
+
+Wrapper around GetErrorMode.
+[clinic start generated code]*/
+
+static PyObject *
+msvcrt_GetErrorMode_impl(PyObject *module)
+/*[clinic end generated code: output=3103fc6145913591 input=5a7fb083b6dd71fd]*/
+{
+    unsigned int res;
+
+    _Py_BEGIN_SUPPRESS_IPH
+    res = GetErrorMode();
+    _Py_END_SUPPRESS_IPH
+
+    return PyLong_FromUnsignedLong(res);
+}
+
+/*[clinic input]
 msvcrt.SetErrorMode
 
     mode: unsigned_int(bitwise=True)
@@ -520,6 +523,7 @@
     MSVCRT_GETCHE_METHODDEF
     MSVCRT_PUTCH_METHODDEF
     MSVCRT_UNGETCH_METHODDEF
+    MSVCRT_GETERRORMODE_METHODDEF
     MSVCRT_SETERRORMODE_METHODDEF
     MSVCRT_CRTSETREPORTFILE_METHODDEF
     MSVCRT_CRTSETREPORTMODE_METHODDEF
diff --git a/PC/pyconfig.h b/PC/pyconfig.h
index d7d3cf0..103e647 100644
--- a/PC/pyconfig.h
+++ b/PC/pyconfig.h
@@ -165,11 +165,11 @@
 
 /* Define like size_t, omitting the "unsigned" */
 #ifdef MS_WIN64
-typedef __int64 ssize_t;
+typedef __int64 Py_ssize_t;
 #else
-typedef _W64 int ssize_t;
+typedef _W64 int Py_ssize_t;
 #endif
-#define HAVE_SSIZE_T 1
+#define HAVE_PY_SSIZE_T 1
 
 #if defined(MS_WIN32) && !defined(MS_WIN64)
 #if defined(_M_IX86)
@@ -268,11 +268,11 @@
                         file in their Makefile (other compilers are
                         generally taken care of by distutils.) */
 #                       if defined(_DEBUG)
-#                               pragma comment(lib,"python39_d.lib")
+#                               pragma comment(lib,"python310_d.lib")
 #                       elif defined(Py_LIMITED_API)
 #                               pragma comment(lib,"python3.lib")
 #                       else
-#                               pragma comment(lib,"python39.lib")
+#                               pragma comment(lib,"python310.lib")
 #                       endif /* _DEBUG */
 #               endif /* _MSC_VER */
 #       endif /* Py_BUILD_CORE */
@@ -289,6 +289,7 @@
 #       define SIZEOF_FPOS_T 8
 #       define SIZEOF_HKEY 8
 #       define SIZEOF_SIZE_T 8
+#       define ALIGNOF_SIZE_T 8
 /* configure.ac defines HAVE_LARGEFILE_SUPPORT iff
    sizeof(off_t) > sizeof(long), and sizeof(long long) >= sizeof(off_t).
    On Win64 the second condition is not true, but if fpos_t replaces off_t
@@ -303,6 +304,7 @@
 #       define SIZEOF_FPOS_T 8
 #       define SIZEOF_HKEY 4
 #       define SIZEOF_SIZE_T 4
+#       define ALIGNOF_SIZE_T 4
         /* MS VS2005 changes time_t to a 64-bit type on all platforms */
 #       if defined(_MSC_VER) && _MSC_VER >= 1400
 #       define SIZEOF_TIME_T 8
@@ -321,6 +323,7 @@
 #define SIZEOF_SHORT 2
 #define SIZEOF_INT 4
 #define SIZEOF_LONG 4
+#define ALIGNOF_LONG 4
 #define SIZEOF_LONG_LONG 8
 #define SIZEOF_DOUBLE 8
 #define SIZEOF_FLOAT 4
diff --git a/PC/pylauncher.rc b/PC/pylauncher.rc
index 92987af..ff7e71e 100644
--- a/PC/pylauncher.rc
+++ b/PC/pylauncher.rc
@@ -2,9 +2,13 @@
 
 #include "python_ver_rc.h"
 
+#ifndef RT_MANIFEST
+// bpo-45220: Cannot reliably #include RT_MANIFEST from
+// anywhere, so we hardcode it
+#define RT_MANIFEST 24
+#endif
 // Include the manifest file that indicates we support all
 // current versions of Windows.
-#include <winuser.h>
 1 RT_MANIFEST "python.manifest"
 
 #if defined(PY_ICON)
diff --git a/PC/pyshellext.cpp b/PC/pyshellext.cpp
index 0198802..ffca169 100644
--- a/PC/pyshellext.cpp
+++ b/PC/pyshellext.cpp
@@ -12,15 +12,14 @@
 #include <olectl.h>
 #include <strsafe.h>
 
-#include "pyshellext_h.h"
-
 #define DDWM_UPDATEWINDOW (WM_USER+3)
 
 static HINSTANCE hModule;
 static CLIPFORMAT cfDropDescription;
 static CLIPFORMAT cfDragWindow;
 
-static const LPCWSTR CLASS_SUBKEY = L"Software\\Classes\\CLSID\\{BEA218D2-6950-497B-9434-61683EC065FE}";
+#define CLASS_GUID "{BEA218D2-6950-497B-9434-61683EC065FE}"
+static const LPCWSTR CLASS_SUBKEY = L"Software\\Classes\\CLSID\\" CLASS_GUID;
 static const LPCWSTR DRAG_MESSAGE = L"Open with %1";
 
 using namespace Microsoft::WRL;
@@ -121,8 +120,7 @@
     return hr;
 }
 
-
-class PyShellExt : public RuntimeClass<
+class DECLSPEC_UUID(CLASS_GUID) PyShellExt : public RuntimeClass<
     RuntimeClassFlags<ClassicCom>,
     IDropTarget,
     IPersistFile
@@ -483,7 +481,7 @@
     }
 
     STDMETHODIMP GetClassID(CLSID *pClassID) {
-        *pClassID = CLSID_PyShellExt;
+        *pClassID = __uuidof(PyShellExt);
         return S_OK;
     }
 };
diff --git a/PC/pyshellext.def b/PC/pyshellext.def
index 5424bd1..288a9ad 100644
--- a/PC/pyshellext.def
+++ b/PC/pyshellext.def
@@ -1,4 +1,3 @@
-LIBRARY	"pyshellext"
 EXPORTS
   DllRegisterServer PRIVATE
   DllUnregisterServer PRIVATE
diff --git a/PC/pyshellext.idl b/PC/pyshellext.idl
deleted file mode 100644
index c0a1838..0000000
--- a/PC/pyshellext.idl
+++ /dev/null
@@ -1,12 +0,0 @@
-import "ocidl.idl";
-
-[uuid(44039A76-3BDD-41C1-A31B-71C00202CE81), version(1.0)]
-library PyShellExtLib
-{
-    [uuid(BEA218D2-6950-497B-9434-61683EC065FE), version(1.0)]
-    coclass PyShellExt
-    {
-        [default] interface IDropTarget;
-        interface IPersistFile;
-    }
-};
\ No newline at end of file
diff --git a/PC/pyshellext.rc b/PC/pyshellext.rc
index e5924a4..af797ce 100644
--- a/PC/pyshellext.rc
+++ b/PC/pyshellext.rc
@@ -2,9 +2,14 @@
 
 #include "python_ver_rc.h"
 
+#ifndef RT_MANIFEST
+// bpo-45220: Cannot reliably #include RT_MANIFEST from
+// anywhere, so we hardcode it
+#define RT_MANIFEST 24
+#endif
+
 // Include the manifest file that indicates we support all
 // current versions of Windows.
-#include <winuser.h>
 1 RT_MANIFEST "python.manifest"
 
 /////////////////////////////////////////////////////////////////////////////
diff --git a/PC/pyshellext_d.def b/PC/pyshellext_d.def
deleted file mode 100644
index 7d2148b..0000000
--- a/PC/pyshellext_d.def
+++ /dev/null
@@ -1,6 +0,0 @@
-LIBRARY	"pyshellext_d"
-EXPORTS
-  DllRegisterServer PRIVATE
-  DllUnregisterServer PRIVATE
-  DllGetClassObject PRIVATE
-  DllCanUnloadNow PRIVATE
diff --git a/PC/python3.def b/PC/python3.def
deleted file mode 100644
index 66d1595..0000000
--- a/PC/python3.def
+++ /dev/null
@@ -1,804 +0,0 @@
-; This file specifies the import forwarding for python3.dll
-; It is used when building python3dll.vcxproj
-LIBRARY	"python3"
-EXPORTS
-  PyArg_Parse=python39.PyArg_Parse
-  PyArg_ParseTuple=python39.PyArg_ParseTuple
-  PyArg_ParseTupleAndKeywords=python39.PyArg_ParseTupleAndKeywords
-  PyArg_UnpackTuple=python39.PyArg_UnpackTuple
-  PyArg_VaParse=python39.PyArg_VaParse
-  PyArg_VaParseTupleAndKeywords=python39.PyArg_VaParseTupleAndKeywords
-  PyArg_ValidateKeywordArguments=python39.PyArg_ValidateKeywordArguments
-  PyBaseObject_Type=python39.PyBaseObject_Type DATA
-  PyBool_FromLong=python39.PyBool_FromLong
-  PyBool_Type=python39.PyBool_Type DATA
-  PyByteArrayIter_Type=python39.PyByteArrayIter_Type DATA
-  PyByteArray_AsString=python39.PyByteArray_AsString
-  PyByteArray_Concat=python39.PyByteArray_Concat
-  PyByteArray_FromObject=python39.PyByteArray_FromObject
-  PyByteArray_FromStringAndSize=python39.PyByteArray_FromStringAndSize
-  PyByteArray_Resize=python39.PyByteArray_Resize
-  PyByteArray_Size=python39.PyByteArray_Size
-  PyByteArray_Type=python39.PyByteArray_Type DATA
-  PyBytesIter_Type=python39.PyBytesIter_Type DATA
-  PyBytes_AsString=python39.PyBytes_AsString
-  PyBytes_AsStringAndSize=python39.PyBytes_AsStringAndSize
-  PyBytes_Concat=python39.PyBytes_Concat
-  PyBytes_ConcatAndDel=python39.PyBytes_ConcatAndDel
-  PyBytes_DecodeEscape=python39.PyBytes_DecodeEscape
-  PyBytes_FromFormat=python39.PyBytes_FromFormat
-  PyBytes_FromFormatV=python39.PyBytes_FromFormatV
-  PyBytes_FromObject=python39.PyBytes_FromObject
-  PyBytes_FromString=python39.PyBytes_FromString
-  PyBytes_FromStringAndSize=python39.PyBytes_FromStringAndSize
-  PyBytes_Repr=python39.PyBytes_Repr
-  PyBytes_Size=python39.PyBytes_Size
-  PyBytes_Type=python39.PyBytes_Type DATA
-  PyCFunction_Call=python39.PyCFunction_Call
-  PyCFunction_GetFlags=python39.PyCFunction_GetFlags
-  PyCFunction_GetFunction=python39.PyCFunction_GetFunction
-  PyCFunction_GetSelf=python39.PyCFunction_GetSelf
-  PyCFunction_New=python39.PyCFunction_New
-  PyCFunction_NewEx=python39.PyCFunction_NewEx
-  PyCFunction_Type=python39.PyCFunction_Type DATA
-  PyCallIter_New=python39.PyCallIter_New
-  PyCallIter_Type=python39.PyCallIter_Type DATA
-  PyCallable_Check=python39.PyCallable_Check
-  PyCapsule_GetContext=python39.PyCapsule_GetContext
-  PyCapsule_GetDestructor=python39.PyCapsule_GetDestructor
-  PyCapsule_GetName=python39.PyCapsule_GetName
-  PyCapsule_GetPointer=python39.PyCapsule_GetPointer
-  PyCapsule_Import=python39.PyCapsule_Import
-  PyCapsule_IsValid=python39.PyCapsule_IsValid
-  PyCapsule_New=python39.PyCapsule_New
-  PyCapsule_SetContext=python39.PyCapsule_SetContext
-  PyCapsule_SetDestructor=python39.PyCapsule_SetDestructor
-  PyCapsule_SetName=python39.PyCapsule_SetName
-  PyCapsule_SetPointer=python39.PyCapsule_SetPointer
-  PyCapsule_Type=python39.PyCapsule_Type DATA
-  PyClassMethodDescr_Type=python39.PyClassMethodDescr_Type DATA
-  PyCodec_BackslashReplaceErrors=python39.PyCodec_BackslashReplaceErrors
-  PyCodec_Decode=python39.PyCodec_Decode
-  PyCodec_Decoder=python39.PyCodec_Decoder
-  PyCodec_Encode=python39.PyCodec_Encode
-  PyCodec_Encoder=python39.PyCodec_Encoder
-  PyCodec_IgnoreErrors=python39.PyCodec_IgnoreErrors
-  PyCodec_IncrementalDecoder=python39.PyCodec_IncrementalDecoder
-  PyCodec_IncrementalEncoder=python39.PyCodec_IncrementalEncoder
-  PyCodec_KnownEncoding=python39.PyCodec_KnownEncoding
-  PyCodec_LookupError=python39.PyCodec_LookupError
-  PyCodec_NameReplaceErrors=python39.PyCodec_NameReplaceErrors
-  PyCodec_Register=python39.PyCodec_Register
-  PyCodec_RegisterError=python39.PyCodec_RegisterError
-  PyCodec_ReplaceErrors=python39.PyCodec_ReplaceErrors
-  PyCodec_StreamReader=python39.PyCodec_StreamReader
-  PyCodec_StreamWriter=python39.PyCodec_StreamWriter
-  PyCodec_StrictErrors=python39.PyCodec_StrictErrors
-  PyCodec_XMLCharRefReplaceErrors=python39.PyCodec_XMLCharRefReplaceErrors
-  PyComplex_FromDoubles=python39.PyComplex_FromDoubles
-  PyComplex_ImagAsDouble=python39.PyComplex_ImagAsDouble
-  PyComplex_RealAsDouble=python39.PyComplex_RealAsDouble
-  PyComplex_Type=python39.PyComplex_Type DATA
-  PyDescr_NewClassMethod=python39.PyDescr_NewClassMethod
-  PyDescr_NewGetSet=python39.PyDescr_NewGetSet
-  PyDescr_NewMember=python39.PyDescr_NewMember
-  PyDescr_NewMethod=python39.PyDescr_NewMethod
-  PyDictItems_Type=python39.PyDictItems_Type DATA
-  PyDictIterItem_Type=python39.PyDictIterItem_Type DATA
-  PyDictIterKey_Type=python39.PyDictIterKey_Type DATA
-  PyDictIterValue_Type=python39.PyDictIterValue_Type DATA
-  PyDictKeys_Type=python39.PyDictKeys_Type DATA
-  PyDictProxy_New=python39.PyDictProxy_New
-  PyDictProxy_Type=python39.PyDictProxy_Type DATA
-  PyDictValues_Type=python39.PyDictValues_Type DATA
-  PyDict_Clear=python39.PyDict_Clear
-  PyDict_Contains=python39.PyDict_Contains
-  PyDict_Copy=python39.PyDict_Copy
-  PyDict_DelItem=python39.PyDict_DelItem
-  PyDict_DelItemString=python39.PyDict_DelItemString
-  PyDict_GetItem=python39.PyDict_GetItem
-  PyDict_GetItemString=python39.PyDict_GetItemString
-  PyDict_GetItemWithError=python39.PyDict_GetItemWithError
-  PyDict_Items=python39.PyDict_Items
-  PyDict_Keys=python39.PyDict_Keys
-  PyDict_Merge=python39.PyDict_Merge
-  PyDict_MergeFromSeq2=python39.PyDict_MergeFromSeq2
-  PyDict_New=python39.PyDict_New
-  PyDict_Next=python39.PyDict_Next
-  PyDict_SetItem=python39.PyDict_SetItem
-  PyDict_SetItemString=python39.PyDict_SetItemString
-  PyDict_Size=python39.PyDict_Size
-  PyDict_Type=python39.PyDict_Type DATA
-  PyDict_Update=python39.PyDict_Update
-  PyDict_Values=python39.PyDict_Values
-  PyEllipsis_Type=python39.PyEllipsis_Type DATA
-  PyEnum_Type=python39.PyEnum_Type DATA
-  PyErr_BadArgument=python39.PyErr_BadArgument
-  PyErr_BadInternalCall=python39.PyErr_BadInternalCall
-  PyErr_CheckSignals=python39.PyErr_CheckSignals
-  PyErr_Clear=python39.PyErr_Clear
-  PyErr_Display=python39.PyErr_Display
-  PyErr_ExceptionMatches=python39.PyErr_ExceptionMatches
-  PyErr_Fetch=python39.PyErr_Fetch
-  PyErr_Format=python39.PyErr_Format
-  PyErr_FormatV=python39.PyErr_FormatV
-  PyErr_GetExcInfo=python39.PyErr_GetExcInfo
-  PyErr_GivenExceptionMatches=python39.PyErr_GivenExceptionMatches
-  PyErr_NewException=python39.PyErr_NewException
-  PyErr_NewExceptionWithDoc=python39.PyErr_NewExceptionWithDoc
-  PyErr_NoMemory=python39.PyErr_NoMemory
-  PyErr_NormalizeException=python39.PyErr_NormalizeException
-  PyErr_Occurred=python39.PyErr_Occurred
-  PyErr_Print=python39.PyErr_Print
-  PyErr_PrintEx=python39.PyErr_PrintEx
-  PyErr_ProgramText=python39.PyErr_ProgramText
-  PyErr_ResourceWarning=python39.PyErr_ResourceWarning
-  PyErr_Restore=python39.PyErr_Restore
-  PyErr_SetExcFromWindowsErr=python39.PyErr_SetExcFromWindowsErr
-  PyErr_SetExcFromWindowsErrWithFilename=python39.PyErr_SetExcFromWindowsErrWithFilename
-  PyErr_SetExcFromWindowsErrWithFilenameObject=python39.PyErr_SetExcFromWindowsErrWithFilenameObject
-  PyErr_SetExcFromWindowsErrWithFilenameObjects=python39.PyErr_SetExcFromWindowsErrWithFilenameObjects
-  PyErr_SetExcInfo=python39.PyErr_SetExcInfo
-  PyErr_SetFromErrno=python39.PyErr_SetFromErrno
-  PyErr_SetFromErrnoWithFilename=python39.PyErr_SetFromErrnoWithFilename
-  PyErr_SetFromErrnoWithFilenameObject=python39.PyErr_SetFromErrnoWithFilenameObject
-  PyErr_SetFromErrnoWithFilenameObjects=python39.PyErr_SetFromErrnoWithFilenameObjects
-  PyErr_SetFromWindowsErr=python39.PyErr_SetFromWindowsErr
-  PyErr_SetFromWindowsErrWithFilename=python39.PyErr_SetFromWindowsErrWithFilename
-  PyErr_SetImportError=python39.PyErr_SetImportError
-  PyErr_SetImportErrorSubclass=python39.PyErr_SetImportErrorSubclass
-  PyErr_SetInterrupt=python39.PyErr_SetInterrupt
-  PyErr_SetNone=python39.PyErr_SetNone
-  PyErr_SetObject=python39.PyErr_SetObject
-  PyErr_SetString=python39.PyErr_SetString
-  PyErr_SyntaxLocation=python39.PyErr_SyntaxLocation
-  PyErr_SyntaxLocationEx=python39.PyErr_SyntaxLocationEx
-  PyErr_WarnEx=python39.PyErr_WarnEx
-  PyErr_WarnExplicit=python39.PyErr_WarnExplicit
-  PyErr_WarnFormat=python39.PyErr_WarnFormat
-  PyErr_WriteUnraisable=python39.PyErr_WriteUnraisable
-  PyEval_AcquireLock=python39.PyEval_AcquireLock
-  PyEval_AcquireThread=python39.PyEval_AcquireThread
-  PyEval_CallFunction=python39.PyEval_CallFunction
-  PyEval_CallMethod=python39.PyEval_CallMethod
-  PyEval_CallObjectWithKeywords=python39.PyEval_CallObjectWithKeywords
-  PyEval_EvalCode=python39.PyEval_EvalCode
-  PyEval_EvalCodeEx=python39.PyEval_EvalCodeEx
-  PyEval_EvalFrame=python39.PyEval_EvalFrame
-  PyEval_EvalFrameEx=python39.PyEval_EvalFrameEx
-  PyEval_GetBuiltins=python39.PyEval_GetBuiltins
-  PyEval_GetCallStats=python39.PyEval_GetCallStats
-  PyEval_GetFrame=python39.PyEval_GetFrame
-  PyEval_GetFuncDesc=python39.PyEval_GetFuncDesc
-  PyEval_GetFuncName=python39.PyEval_GetFuncName
-  PyEval_GetGlobals=python39.PyEval_GetGlobals
-  PyEval_GetLocals=python39.PyEval_GetLocals
-  PyEval_InitThreads=python39.PyEval_InitThreads
-  PyEval_ReInitThreads=python39.PyEval_ReInitThreads
-  PyEval_ReleaseLock=python39.PyEval_ReleaseLock
-  PyEval_ReleaseThread=python39.PyEval_ReleaseThread
-  PyEval_RestoreThread=python39.PyEval_RestoreThread
-  PyEval_SaveThread=python39.PyEval_SaveThread
-  PyEval_ThreadsInitialized=python39.PyEval_ThreadsInitialized
-  PyExc_ArithmeticError=python39.PyExc_ArithmeticError DATA
-  PyExc_AssertionError=python39.PyExc_AssertionError DATA
-  PyExc_AttributeError=python39.PyExc_AttributeError DATA
-  PyExc_BaseException=python39.PyExc_BaseException DATA
-  PyExc_BlockingIOError=python39.PyExc_BlockingIOError DATA
-  PyExc_BrokenPipeError=python39.PyExc_BrokenPipeError DATA
-  PyExc_BufferError=python39.PyExc_BufferError DATA
-  PyExc_BytesWarning=python39.PyExc_BytesWarning DATA
-  PyExc_ChildProcessError=python39.PyExc_ChildProcessError DATA
-  PyExc_ConnectionAbortedError=python39.PyExc_ConnectionAbortedError DATA
-  PyExc_ConnectionError=python39.PyExc_ConnectionError DATA
-  PyExc_ConnectionRefusedError=python39.PyExc_ConnectionRefusedError DATA
-  PyExc_ConnectionResetError=python39.PyExc_ConnectionResetError DATA
-  PyExc_DeprecationWarning=python39.PyExc_DeprecationWarning DATA
-  PyExc_EOFError=python39.PyExc_EOFError DATA
-  PyExc_EnvironmentError=python39.PyExc_EnvironmentError DATA
-  PyExc_Exception=python39.PyExc_Exception DATA
-  PyExc_FileExistsError=python39.PyExc_FileExistsError DATA
-  PyExc_FileNotFoundError=python39.PyExc_FileNotFoundError DATA
-  PyExc_FloatingPointError=python39.PyExc_FloatingPointError DATA
-  PyExc_FutureWarning=python39.PyExc_FutureWarning DATA
-  PyExc_GeneratorExit=python39.PyExc_GeneratorExit DATA
-  PyExc_IOError=python39.PyExc_IOError DATA
-  PyExc_ImportError=python39.PyExc_ImportError DATA
-  PyExc_ImportWarning=python39.PyExc_ImportWarning DATA
-  PyExc_IndentationError=python39.PyExc_IndentationError DATA
-  PyExc_IndexError=python39.PyExc_IndexError DATA
-  PyExc_InterruptedError=python39.PyExc_InterruptedError DATA
-  PyExc_IsADirectoryError=python39.PyExc_IsADirectoryError DATA
-  PyExc_KeyError=python39.PyExc_KeyError DATA
-  PyExc_KeyboardInterrupt=python39.PyExc_KeyboardInterrupt DATA
-  PyExc_LookupError=python39.PyExc_LookupError DATA
-  PyExc_MemoryError=python39.PyExc_MemoryError DATA
-  PyExc_ModuleNotFoundError=python39.PyExc_ModuleNotFoundError DATA
-  PyExc_NameError=python39.PyExc_NameError DATA
-  PyExc_NotADirectoryError=python39.PyExc_NotADirectoryError DATA
-  PyExc_NotImplementedError=python39.PyExc_NotImplementedError DATA
-  PyExc_OSError=python39.PyExc_OSError DATA
-  PyExc_OverflowError=python39.PyExc_OverflowError DATA
-  PyExc_PendingDeprecationWarning=python39.PyExc_PendingDeprecationWarning DATA
-  PyExc_PermissionError=python39.PyExc_PermissionError DATA
-  PyExc_ProcessLookupError=python39.PyExc_ProcessLookupError DATA
-  PyExc_RecursionError=python39.PyExc_RecursionError DATA
-  PyExc_ReferenceError=python39.PyExc_ReferenceError DATA
-  PyExc_ResourceWarning=python39.PyExc_ResourceWarning DATA
-  PyExc_RuntimeError=python39.PyExc_RuntimeError DATA
-  PyExc_RuntimeWarning=python39.PyExc_RuntimeWarning DATA
-  PyExc_StopAsyncIteration=python39.PyExc_StopAsyncIteration DATA
-  PyExc_StopIteration=python39.PyExc_StopIteration DATA
-  PyExc_SyntaxError=python39.PyExc_SyntaxError DATA
-  PyExc_SyntaxWarning=python39.PyExc_SyntaxWarning DATA
-  PyExc_SystemError=python39.PyExc_SystemError DATA
-  PyExc_SystemExit=python39.PyExc_SystemExit DATA
-  PyExc_TabError=python39.PyExc_TabError DATA
-  PyExc_TimeoutError=python39.PyExc_TimeoutError DATA
-  PyExc_TypeError=python39.PyExc_TypeError DATA
-  PyExc_UnboundLocalError=python39.PyExc_UnboundLocalError DATA
-  PyExc_UnicodeDecodeError=python39.PyExc_UnicodeDecodeError DATA
-  PyExc_UnicodeEncodeError=python39.PyExc_UnicodeEncodeError DATA
-  PyExc_UnicodeError=python39.PyExc_UnicodeError DATA
-  PyExc_UnicodeTranslateError=python39.PyExc_UnicodeTranslateError DATA
-  PyExc_UnicodeWarning=python39.PyExc_UnicodeWarning DATA
-  PyExc_UserWarning=python39.PyExc_UserWarning DATA
-  PyExc_ValueError=python39.PyExc_ValueError DATA
-  PyExc_Warning=python39.PyExc_Warning DATA
-  PyExc_WindowsError=python39.PyExc_WindowsError DATA
-  PyExc_ZeroDivisionError=python39.PyExc_ZeroDivisionError DATA
-  PyExceptionClass_Name=python39.PyExceptionClass_Name
-  PyException_GetCause=python39.PyException_GetCause
-  PyException_GetContext=python39.PyException_GetContext
-  PyException_GetTraceback=python39.PyException_GetTraceback
-  PyException_SetCause=python39.PyException_SetCause
-  PyException_SetContext=python39.PyException_SetContext
-  PyException_SetTraceback=python39.PyException_SetTraceback
-  PyFile_FromFd=python39.PyFile_FromFd
-  PyFile_GetLine=python39.PyFile_GetLine
-  PyFile_WriteObject=python39.PyFile_WriteObject
-  PyFile_WriteString=python39.PyFile_WriteString
-  PyFilter_Type=python39.PyFilter_Type DATA
-  PyFloat_AsDouble=python39.PyFloat_AsDouble
-  PyFloat_FromDouble=python39.PyFloat_FromDouble
-  PyFloat_FromString=python39.PyFloat_FromString
-  PyFloat_GetInfo=python39.PyFloat_GetInfo
-  PyFloat_GetMax=python39.PyFloat_GetMax
-  PyFloat_GetMin=python39.PyFloat_GetMin
-  PyFloat_Type=python39.PyFloat_Type DATA
-  PyFrozenSet_New=python39.PyFrozenSet_New
-  PyFrozenSet_Type=python39.PyFrozenSet_Type DATA
-  PyGC_Collect=python39.PyGC_Collect
-  PyGILState_Ensure=python39.PyGILState_Ensure
-  PyGILState_GetThisThreadState=python39.PyGILState_GetThisThreadState
-  PyGILState_Release=python39.PyGILState_Release
-  PyGetSetDescr_Type=python39.PyGetSetDescr_Type DATA
-  PyImport_AddModule=python39.PyImport_AddModule
-  PyImport_AddModuleObject=python39.PyImport_AddModuleObject
-  PyImport_AppendInittab=python39.PyImport_AppendInittab
-  PyImport_Cleanup=python39.PyImport_Cleanup
-  PyImport_ExecCodeModule=python39.PyImport_ExecCodeModule
-  PyImport_ExecCodeModuleEx=python39.PyImport_ExecCodeModuleEx
-  PyImport_ExecCodeModuleObject=python39.PyImport_ExecCodeModuleObject
-  PyImport_ExecCodeModuleWithPathnames=python39.PyImport_ExecCodeModuleWithPathnames
-  PyImport_GetImporter=python39.PyImport_GetImporter
-  PyImport_GetMagicNumber=python39.PyImport_GetMagicNumber
-  PyImport_GetMagicTag=python39.PyImport_GetMagicTag
-  PyImport_GetModule=python39.PyImport_GetModule
-  PyImport_GetModuleDict=python39.PyImport_GetModuleDict
-  PyImport_Import=python39.PyImport_Import
-  PyImport_ImportFrozenModule=python39.PyImport_ImportFrozenModule
-  PyImport_ImportFrozenModuleObject=python39.PyImport_ImportFrozenModuleObject
-  PyImport_ImportModule=python39.PyImport_ImportModule
-  PyImport_ImportModuleLevel=python39.PyImport_ImportModuleLevel
-  PyImport_ImportModuleLevelObject=python39.PyImport_ImportModuleLevelObject
-  PyImport_ImportModuleNoBlock=python39.PyImport_ImportModuleNoBlock
-  PyImport_ReloadModule=python39.PyImport_ReloadModule
-  PyIndex_Check=python39.PyIndex_Check
-  PyInterpreterState_Clear=python39.PyInterpreterState_Clear
-  PyInterpreterState_Delete=python39.PyInterpreterState_Delete
-  PyInterpreterState_New=python39.PyInterpreterState_New
-  PyIter_Check=python39.PyIter_Check
-  PyIter_Next=python39.PyIter_Next
-  PyListIter_Type=python39.PyListIter_Type DATA
-  PyListRevIter_Type=python39.PyListRevIter_Type DATA
-  PyList_Append=python39.PyList_Append
-  PyList_AsTuple=python39.PyList_AsTuple
-  PyList_GetItem=python39.PyList_GetItem
-  PyList_GetSlice=python39.PyList_GetSlice
-  PyList_Insert=python39.PyList_Insert
-  PyList_New=python39.PyList_New
-  PyList_Reverse=python39.PyList_Reverse
-  PyList_SetItem=python39.PyList_SetItem
-  PyList_SetSlice=python39.PyList_SetSlice
-  PyList_Size=python39.PyList_Size
-  PyList_Sort=python39.PyList_Sort
-  PyList_Type=python39.PyList_Type DATA
-  PyLongRangeIter_Type=python39.PyLongRangeIter_Type DATA
-  PyLong_AsDouble=python39.PyLong_AsDouble
-  PyLong_AsLong=python39.PyLong_AsLong
-  PyLong_AsLongAndOverflow=python39.PyLong_AsLongAndOverflow
-  PyLong_AsLongLong=python39.PyLong_AsLongLong
-  PyLong_AsLongLongAndOverflow=python39.PyLong_AsLongLongAndOverflow
-  PyLong_AsSize_t=python39.PyLong_AsSize_t
-  PyLong_AsSsize_t=python39.PyLong_AsSsize_t
-  PyLong_AsUnsignedLong=python39.PyLong_AsUnsignedLong
-  PyLong_AsUnsignedLongLong=python39.PyLong_AsUnsignedLongLong
-  PyLong_AsUnsignedLongLongMask=python39.PyLong_AsUnsignedLongLongMask
-  PyLong_AsUnsignedLongMask=python39.PyLong_AsUnsignedLongMask
-  PyLong_AsVoidPtr=python39.PyLong_AsVoidPtr
-  PyLong_FromDouble=python39.PyLong_FromDouble
-  PyLong_FromLong=python39.PyLong_FromLong
-  PyLong_FromLongLong=python39.PyLong_FromLongLong
-  PyLong_FromSize_t=python39.PyLong_FromSize_t
-  PyLong_FromSsize_t=python39.PyLong_FromSsize_t
-  PyLong_FromString=python39.PyLong_FromString
-  PyLong_FromUnsignedLong=python39.PyLong_FromUnsignedLong
-  PyLong_FromUnsignedLongLong=python39.PyLong_FromUnsignedLongLong
-  PyLong_FromVoidPtr=python39.PyLong_FromVoidPtr
-  PyLong_GetInfo=python39.PyLong_GetInfo
-  PyLong_Type=python39.PyLong_Type DATA
-  PyMap_Type=python39.PyMap_Type DATA
-  PyMapping_Check=python39.PyMapping_Check
-  PyMapping_GetItemString=python39.PyMapping_GetItemString
-  PyMapping_HasKey=python39.PyMapping_HasKey
-  PyMapping_HasKeyString=python39.PyMapping_HasKeyString
-  PyMapping_Items=python39.PyMapping_Items
-  PyMapping_Keys=python39.PyMapping_Keys
-  PyMapping_Length=python39.PyMapping_Length
-  PyMapping_SetItemString=python39.PyMapping_SetItemString
-  PyMapping_Size=python39.PyMapping_Size
-  PyMapping_Values=python39.PyMapping_Values
-  PyMem_Calloc=python39.PyMem_Calloc
-  PyMem_Free=python39.PyMem_Free
-  PyMem_Malloc=python39.PyMem_Malloc
-  PyMem_Realloc=python39.PyMem_Realloc
-  PyMemberDescr_Type=python39.PyMemberDescr_Type DATA
-  PyMemoryView_FromMemory=python39.PyMemoryView_FromMemory
-  PyMemoryView_FromObject=python39.PyMemoryView_FromObject
-  PyMemoryView_GetContiguous=python39.PyMemoryView_GetContiguous
-  PyMemoryView_Type=python39.PyMemoryView_Type DATA
-  PyMethodDescr_Type=python39.PyMethodDescr_Type DATA
-  PyModuleDef_Init=python39.PyModuleDef_Init
-  PyModuleDef_Type=python39.PyModuleDef_Type DATA
-  PyModule_AddFunctions=python39.PyModule_AddFunctions
-  PyModule_AddIntConstant=python39.PyModule_AddIntConstant
-  PyModule_AddObject=python39.PyModule_AddObject
-  PyModule_AddStringConstant=python39.PyModule_AddStringConstant
-  PyModule_Create2=python39.PyModule_Create2
-  PyModule_ExecDef=python39.PyModule_ExecDef
-  PyModule_FromDefAndSpec2=python39.PyModule_FromDefAndSpec2
-  PyModule_GetDef=python39.PyModule_GetDef
-  PyModule_GetDict=python39.PyModule_GetDict
-  PyModule_GetFilename=python39.PyModule_GetFilename
-  PyModule_GetFilenameObject=python39.PyModule_GetFilenameObject
-  PyModule_GetName=python39.PyModule_GetName
-  PyModule_GetNameObject=python39.PyModule_GetNameObject
-  PyModule_GetState=python39.PyModule_GetState
-  PyModule_New=python39.PyModule_New
-  PyModule_NewObject=python39.PyModule_NewObject
-  PyModule_SetDocString=python39.PyModule_SetDocString
-  PyModule_Type=python39.PyModule_Type DATA
-  PyNullImporter_Type=python39.PyNullImporter_Type DATA
-  PyNumber_Absolute=python39.PyNumber_Absolute
-  PyNumber_Add=python39.PyNumber_Add
-  PyNumber_And=python39.PyNumber_And
-  PyNumber_AsSsize_t=python39.PyNumber_AsSsize_t
-  PyNumber_Check=python39.PyNumber_Check
-  PyNumber_Divmod=python39.PyNumber_Divmod
-  PyNumber_Float=python39.PyNumber_Float
-  PyNumber_FloorDivide=python39.PyNumber_FloorDivide
-  PyNumber_InPlaceAdd=python39.PyNumber_InPlaceAdd
-  PyNumber_InPlaceAnd=python39.PyNumber_InPlaceAnd
-  PyNumber_InPlaceFloorDivide=python39.PyNumber_InPlaceFloorDivide
-  PyNumber_InPlaceLshift=python39.PyNumber_InPlaceLshift
-  PyNumber_InPlaceMatrixMultiply=python39.PyNumber_InPlaceMatrixMultiply
-  PyNumber_InPlaceMultiply=python39.PyNumber_InPlaceMultiply
-  PyNumber_InPlaceOr=python39.PyNumber_InPlaceOr
-  PyNumber_InPlacePower=python39.PyNumber_InPlacePower
-  PyNumber_InPlaceRemainder=python39.PyNumber_InPlaceRemainder
-  PyNumber_InPlaceRshift=python39.PyNumber_InPlaceRshift
-  PyNumber_InPlaceSubtract=python39.PyNumber_InPlaceSubtract
-  PyNumber_InPlaceTrueDivide=python39.PyNumber_InPlaceTrueDivide
-  PyNumber_InPlaceXor=python39.PyNumber_InPlaceXor
-  PyNumber_Index=python39.PyNumber_Index
-  PyNumber_Invert=python39.PyNumber_Invert
-  PyNumber_Long=python39.PyNumber_Long
-  PyNumber_Lshift=python39.PyNumber_Lshift
-  PyNumber_MatrixMultiply=python39.PyNumber_MatrixMultiply
-  PyNumber_Multiply=python39.PyNumber_Multiply
-  PyNumber_Negative=python39.PyNumber_Negative
-  PyNumber_Or=python39.PyNumber_Or
-  PyNumber_Positive=python39.PyNumber_Positive
-  PyNumber_Power=python39.PyNumber_Power
-  PyNumber_Remainder=python39.PyNumber_Remainder
-  PyNumber_Rshift=python39.PyNumber_Rshift
-  PyNumber_Subtract=python39.PyNumber_Subtract
-  PyNumber_ToBase=python39.PyNumber_ToBase
-  PyNumber_TrueDivide=python39.PyNumber_TrueDivide
-  PyNumber_Xor=python39.PyNumber_Xor
-  PyODictItems_Type=python39.PyODictItems_Type DATA
-  PyODictIter_Type=python39.PyODictIter_Type DATA
-  PyODictKeys_Type=python39.PyODictKeys_Type DATA
-  PyODictValues_Type=python39.PyODictValues_Type DATA
-  PyODict_DelItem=python39.PyODict_DelItem
-  PyODict_New=python39.PyODict_New
-  PyODict_SetItem=python39.PyODict_SetItem
-  PyODict_Type=python39.PyODict_Type DATA
-  PyOS_AfterFork=python39.PyOS_AfterFork
-  PyOS_CheckStack=python39.PyOS_CheckStack
-  PyOS_FSPath=python39.PyOS_FSPath
-  PyOS_InitInterrupts=python39.PyOS_InitInterrupts
-  PyOS_InputHook=python39.PyOS_InputHook DATA
-  PyOS_InterruptOccurred=python39.PyOS_InterruptOccurred
-  PyOS_ReadlineFunctionPointer=python39.PyOS_ReadlineFunctionPointer DATA
-  PyOS_double_to_string=python39.PyOS_double_to_string
-  PyOS_getsig=python39.PyOS_getsig
-  PyOS_mystricmp=python39.PyOS_mystricmp
-  PyOS_mystrnicmp=python39.PyOS_mystrnicmp
-  PyOS_setsig=python39.PyOS_setsig
-  PyOS_snprintf=python39.PyOS_snprintf
-  PyOS_string_to_double=python39.PyOS_string_to_double
-  PyOS_strtol=python39.PyOS_strtol
-  PyOS_strtoul=python39.PyOS_strtoul
-  PyOS_vsnprintf=python39.PyOS_vsnprintf
-  PyObject_ASCII=python39.PyObject_ASCII
-  PyObject_AsCharBuffer=python39.PyObject_AsCharBuffer
-  PyObject_AsFileDescriptor=python39.PyObject_AsFileDescriptor
-  PyObject_AsReadBuffer=python39.PyObject_AsReadBuffer
-  PyObject_AsWriteBuffer=python39.PyObject_AsWriteBuffer
-  PyObject_Bytes=python39.PyObject_Bytes
-  PyObject_Call=python39.PyObject_Call
-  PyObject_CallFunction=python39.PyObject_CallFunction
-  PyObject_CallFunctionObjArgs=python39.PyObject_CallFunctionObjArgs
-  PyObject_CallMethod=python39.PyObject_CallMethod
-  PyObject_CallMethodObjArgs=python39.PyObject_CallMethodObjArgs
-  PyObject_CallObject=python39.PyObject_CallObject
-  PyObject_Calloc=python39.PyObject_Calloc
-  PyObject_CheckReadBuffer=python39.PyObject_CheckReadBuffer
-  PyObject_ClearWeakRefs=python39.PyObject_ClearWeakRefs
-  PyObject_DelItem=python39.PyObject_DelItem
-  PyObject_DelItemString=python39.PyObject_DelItemString
-  PyObject_Dir=python39.PyObject_Dir
-  PyObject_Format=python39.PyObject_Format
-  PyObject_Free=python39.PyObject_Free
-  PyObject_GC_Del=python39.PyObject_GC_Del
-  PyObject_GC_Track=python39.PyObject_GC_Track
-  PyObject_GC_UnTrack=python39.PyObject_GC_UnTrack
-  PyObject_GenericGetAttr=python39.PyObject_GenericGetAttr
-  PyObject_GenericSetAttr=python39.PyObject_GenericSetAttr
-  PyObject_GenericSetDict=python39.PyObject_GenericSetDict
-  PyObject_GetAttr=python39.PyObject_GetAttr
-  PyObject_GetAttrString=python39.PyObject_GetAttrString
-  PyObject_GetItem=python39.PyObject_GetItem
-  PyObject_GetIter=python39.PyObject_GetIter
-  PyObject_HasAttr=python39.PyObject_HasAttr
-  PyObject_HasAttrString=python39.PyObject_HasAttrString
-  PyObject_Hash=python39.PyObject_Hash
-  PyObject_HashNotImplemented=python39.PyObject_HashNotImplemented
-  PyObject_Init=python39.PyObject_Init
-  PyObject_InitVar=python39.PyObject_InitVar
-  PyObject_IsInstance=python39.PyObject_IsInstance
-  PyObject_IsSubclass=python39.PyObject_IsSubclass
-  PyObject_IsTrue=python39.PyObject_IsTrue
-  PyObject_Length=python39.PyObject_Length
-  PyObject_Malloc=python39.PyObject_Malloc
-  PyObject_Not=python39.PyObject_Not
-  PyObject_Realloc=python39.PyObject_Realloc
-  PyObject_Repr=python39.PyObject_Repr
-  PyObject_RichCompare=python39.PyObject_RichCompare
-  PyObject_RichCompareBool=python39.PyObject_RichCompareBool
-  PyObject_SelfIter=python39.PyObject_SelfIter
-  PyObject_SetAttr=python39.PyObject_SetAttr
-  PyObject_SetAttrString=python39.PyObject_SetAttrString
-  PyObject_SetItem=python39.PyObject_SetItem
-  PyObject_Size=python39.PyObject_Size
-  PyObject_Str=python39.PyObject_Str
-  PyObject_Type=python39.PyObject_Type
-  PyParser_SimpleParseFileFlags=python39.PyParser_SimpleParseFileFlags
-  PyParser_SimpleParseStringFlags=python39.PyParser_SimpleParseStringFlags
-  PyParser_SimpleParseStringFlagsFilename=python39.PyParser_SimpleParseStringFlagsFilename
-  PyProperty_Type=python39.PyProperty_Type DATA
-  PyRangeIter_Type=python39.PyRangeIter_Type DATA
-  PyRange_Type=python39.PyRange_Type DATA
-  PyReversed_Type=python39.PyReversed_Type DATA
-  PySeqIter_New=python39.PySeqIter_New
-  PySeqIter_Type=python39.PySeqIter_Type DATA
-  PySequence_Check=python39.PySequence_Check
-  PySequence_Concat=python39.PySequence_Concat
-  PySequence_Contains=python39.PySequence_Contains
-  PySequence_Count=python39.PySequence_Count
-  PySequence_DelItem=python39.PySequence_DelItem
-  PySequence_DelSlice=python39.PySequence_DelSlice
-  PySequence_Fast=python39.PySequence_Fast
-  PySequence_GetItem=python39.PySequence_GetItem
-  PySequence_GetSlice=python39.PySequence_GetSlice
-  PySequence_In=python39.PySequence_In
-  PySequence_InPlaceConcat=python39.PySequence_InPlaceConcat
-  PySequence_InPlaceRepeat=python39.PySequence_InPlaceRepeat
-  PySequence_Index=python39.PySequence_Index
-  PySequence_Length=python39.PySequence_Length
-  PySequence_List=python39.PySequence_List
-  PySequence_Repeat=python39.PySequence_Repeat
-  PySequence_SetItem=python39.PySequence_SetItem
-  PySequence_SetSlice=python39.PySequence_SetSlice
-  PySequence_Size=python39.PySequence_Size
-  PySequence_Tuple=python39.PySequence_Tuple
-  PySetIter_Type=python39.PySetIter_Type DATA
-  PySet_Add=python39.PySet_Add
-  PySet_Clear=python39.PySet_Clear
-  PySet_Contains=python39.PySet_Contains
-  PySet_Discard=python39.PySet_Discard
-  PySet_New=python39.PySet_New
-  PySet_Pop=python39.PySet_Pop
-  PySet_Size=python39.PySet_Size
-  PySet_Type=python39.PySet_Type DATA
-  PySlice_AdjustIndices=python39.PySlice_AdjustIndices
-  PySlice_GetIndices=python39.PySlice_GetIndices
-  PySlice_GetIndicesEx=python39.PySlice_GetIndicesEx
-  PySlice_New=python39.PySlice_New
-  PySlice_Type=python39.PySlice_Type DATA
-  PySlice_Unpack=python39.PySlice_Unpack
-  PySortWrapper_Type=python39.PySortWrapper_Type DATA
-  PyInterpreterState_GetID=python39.PyInterpreterState_GetID
-  PyState_AddModule=python39.PyState_AddModule
-  PyState_FindModule=python39.PyState_FindModule
-  PyState_RemoveModule=python39.PyState_RemoveModule
-  PyStructSequence_GetItem=python39.PyStructSequence_GetItem
-  PyStructSequence_New=python39.PyStructSequence_New
-  PyStructSequence_NewType=python39.PyStructSequence_NewType
-  PyStructSequence_SetItem=python39.PyStructSequence_SetItem
-  PySuper_Type=python39.PySuper_Type DATA
-  PySys_AddWarnOption=python39.PySys_AddWarnOption
-  PySys_AddWarnOptionUnicode=python39.PySys_AddWarnOptionUnicode
-  PySys_AddXOption=python39.PySys_AddXOption
-  PySys_FormatStderr=python39.PySys_FormatStderr
-  PySys_FormatStdout=python39.PySys_FormatStdout
-  PySys_GetObject=python39.PySys_GetObject
-  PySys_GetXOptions=python39.PySys_GetXOptions
-  PySys_HasWarnOptions=python39.PySys_HasWarnOptions
-  PySys_ResetWarnOptions=python39.PySys_ResetWarnOptions
-  PySys_SetArgv=python39.PySys_SetArgv
-  PySys_SetArgvEx=python39.PySys_SetArgvEx
-  PySys_SetObject=python39.PySys_SetObject
-  PySys_SetPath=python39.PySys_SetPath
-  PySys_WriteStderr=python39.PySys_WriteStderr
-  PySys_WriteStdout=python39.PySys_WriteStdout
-  PyThreadState_Clear=python39.PyThreadState_Clear
-  PyThreadState_Delete=python39.PyThreadState_Delete
-  PyThreadState_DeleteCurrent=python39.PyThreadState_DeleteCurrent
-  PyThreadState_Get=python39.PyThreadState_Get
-  PyThreadState_GetDict=python39.PyThreadState_GetDict
-  PyThreadState_New=python39.PyThreadState_New
-  PyThreadState_SetAsyncExc=python39.PyThreadState_SetAsyncExc
-  PyThreadState_Swap=python39.PyThreadState_Swap
-  PyThread_tss_alloc=python39.PyThread_tss_alloc
-  PyThread_tss_create=python39.PyThread_tss_create
-  PyThread_tss_delete=python39.PyThread_tss_delete
-  PyThread_tss_free=python39.PyThread_tss_free
-  PyThread_tss_get=python39.PyThread_tss_get
-  PyThread_tss_is_created=python39.PyThread_tss_is_created
-  PyThread_tss_set=python39.PyThread_tss_set
-  PyTraceBack_Here=python39.PyTraceBack_Here
-  PyTraceBack_Print=python39.PyTraceBack_Print
-  PyTraceBack_Type=python39.PyTraceBack_Type DATA
-  PyTupleIter_Type=python39.PyTupleIter_Type DATA
-  PyTuple_GetItem=python39.PyTuple_GetItem
-  PyTuple_GetSlice=python39.PyTuple_GetSlice
-  PyTuple_New=python39.PyTuple_New
-  PyTuple_Pack=python39.PyTuple_Pack
-  PyTuple_SetItem=python39.PyTuple_SetItem
-  PyTuple_Size=python39.PyTuple_Size
-  PyTuple_Type=python39.PyTuple_Type DATA
-  PyType_ClearCache=python39.PyType_ClearCache
-  PyType_FromSpec=python39.PyType_FromSpec
-  PyType_FromSpecWithBases=python39.PyType_FromSpecWithBases
-  PyType_GenericAlloc=python39.PyType_GenericAlloc
-  PyType_GenericNew=python39.PyType_GenericNew
-  PyType_GetFlags=python39.PyType_GetFlags
-  PyType_GetSlot=python39.PyType_GetSlot
-  PyType_IsSubtype=python39.PyType_IsSubtype
-  PyType_Modified=python39.PyType_Modified
-  PyType_Ready=python39.PyType_Ready
-  PyType_Type=python39.PyType_Type DATA
-  PyUnicodeDecodeError_Create=python39.PyUnicodeDecodeError_Create
-  PyUnicodeDecodeError_GetEncoding=python39.PyUnicodeDecodeError_GetEncoding
-  PyUnicodeDecodeError_GetEnd=python39.PyUnicodeDecodeError_GetEnd
-  PyUnicodeDecodeError_GetObject=python39.PyUnicodeDecodeError_GetObject
-  PyUnicodeDecodeError_GetReason=python39.PyUnicodeDecodeError_GetReason
-  PyUnicodeDecodeError_GetStart=python39.PyUnicodeDecodeError_GetStart
-  PyUnicodeDecodeError_SetEnd=python39.PyUnicodeDecodeError_SetEnd
-  PyUnicodeDecodeError_SetReason=python39.PyUnicodeDecodeError_SetReason
-  PyUnicodeDecodeError_SetStart=python39.PyUnicodeDecodeError_SetStart
-  PyUnicodeEncodeError_GetEncoding=python39.PyUnicodeEncodeError_GetEncoding
-  PyUnicodeEncodeError_GetEnd=python39.PyUnicodeEncodeError_GetEnd
-  PyUnicodeEncodeError_GetObject=python39.PyUnicodeEncodeError_GetObject
-  PyUnicodeEncodeError_GetReason=python39.PyUnicodeEncodeError_GetReason
-  PyUnicodeEncodeError_GetStart=python39.PyUnicodeEncodeError_GetStart
-  PyUnicodeEncodeError_SetEnd=python39.PyUnicodeEncodeError_SetEnd
-  PyUnicodeEncodeError_SetReason=python39.PyUnicodeEncodeError_SetReason
-  PyUnicodeEncodeError_SetStart=python39.PyUnicodeEncodeError_SetStart
-  PyUnicodeIter_Type=python39.PyUnicodeIter_Type DATA
-  PyUnicodeTranslateError_GetEnd=python39.PyUnicodeTranslateError_GetEnd
-  PyUnicodeTranslateError_GetObject=python39.PyUnicodeTranslateError_GetObject
-  PyUnicodeTranslateError_GetReason=python39.PyUnicodeTranslateError_GetReason
-  PyUnicodeTranslateError_GetStart=python39.PyUnicodeTranslateError_GetStart
-  PyUnicodeTranslateError_SetEnd=python39.PyUnicodeTranslateError_SetEnd
-  PyUnicodeTranslateError_SetReason=python39.PyUnicodeTranslateError_SetReason
-  PyUnicodeTranslateError_SetStart=python39.PyUnicodeTranslateError_SetStart
-  PyUnicode_Append=python39.PyUnicode_Append
-  PyUnicode_AppendAndDel=python39.PyUnicode_AppendAndDel
-  PyUnicode_AsASCIIString=python39.PyUnicode_AsASCIIString
-  PyUnicode_AsCharmapString=python39.PyUnicode_AsCharmapString
-  PyUnicode_AsDecodedObject=python39.PyUnicode_AsDecodedObject
-  PyUnicode_AsDecodedUnicode=python39.PyUnicode_AsDecodedUnicode
-  PyUnicode_AsEncodedObject=python39.PyUnicode_AsEncodedObject
-  PyUnicode_AsEncodedString=python39.PyUnicode_AsEncodedString
-  PyUnicode_AsEncodedUnicode=python39.PyUnicode_AsEncodedUnicode
-  PyUnicode_AsLatin1String=python39.PyUnicode_AsLatin1String
-  PyUnicode_AsMBCSString=python39.PyUnicode_AsMBCSString
-  PyUnicode_AsRawUnicodeEscapeString=python39.PyUnicode_AsRawUnicodeEscapeString
-  PyUnicode_AsUCS4=python39.PyUnicode_AsUCS4
-  PyUnicode_AsUCS4Copy=python39.PyUnicode_AsUCS4Copy
-  PyUnicode_AsUTF16String=python39.PyUnicode_AsUTF16String
-  PyUnicode_AsUTF32String=python39.PyUnicode_AsUTF32String
-  PyUnicode_AsUTF8String=python39.PyUnicode_AsUTF8String
-  PyUnicode_AsUnicodeEscapeString=python39.PyUnicode_AsUnicodeEscapeString
-  PyUnicode_AsWideChar=python39.PyUnicode_AsWideChar
-  PyUnicode_AsWideCharString=python39.PyUnicode_AsWideCharString
-  PyUnicode_BuildEncodingMap=python39.PyUnicode_BuildEncodingMap
-  PyUnicode_Compare=python39.PyUnicode_Compare
-  PyUnicode_CompareWithASCIIString=python39.PyUnicode_CompareWithASCIIString
-  PyUnicode_Concat=python39.PyUnicode_Concat
-  PyUnicode_Contains=python39.PyUnicode_Contains
-  PyUnicode_Count=python39.PyUnicode_Count
-  PyUnicode_Decode=python39.PyUnicode_Decode
-  PyUnicode_DecodeASCII=python39.PyUnicode_DecodeASCII
-  PyUnicode_DecodeCharmap=python39.PyUnicode_DecodeCharmap
-  PyUnicode_DecodeCodePageStateful=python39.PyUnicode_DecodeCodePageStateful
-  PyUnicode_DecodeFSDefault=python39.PyUnicode_DecodeFSDefault
-  PyUnicode_DecodeFSDefaultAndSize=python39.PyUnicode_DecodeFSDefaultAndSize
-  PyUnicode_DecodeLatin1=python39.PyUnicode_DecodeLatin1
-  PyUnicode_DecodeLocale=python39.PyUnicode_DecodeLocale
-  PyUnicode_DecodeLocaleAndSize=python39.PyUnicode_DecodeLocaleAndSize
-  PyUnicode_DecodeMBCS=python39.PyUnicode_DecodeMBCS
-  PyUnicode_DecodeMBCSStateful=python39.PyUnicode_DecodeMBCSStateful
-  PyUnicode_DecodeRawUnicodeEscape=python39.PyUnicode_DecodeRawUnicodeEscape
-  PyUnicode_DecodeUTF16=python39.PyUnicode_DecodeUTF16
-  PyUnicode_DecodeUTF16Stateful=python39.PyUnicode_DecodeUTF16Stateful
-  PyUnicode_DecodeUTF32=python39.PyUnicode_DecodeUTF32
-  PyUnicode_DecodeUTF32Stateful=python39.PyUnicode_DecodeUTF32Stateful
-  PyUnicode_DecodeUTF7=python39.PyUnicode_DecodeUTF7
-  PyUnicode_DecodeUTF7Stateful=python39.PyUnicode_DecodeUTF7Stateful
-  PyUnicode_DecodeUTF8=python39.PyUnicode_DecodeUTF8
-  PyUnicode_DecodeUTF8Stateful=python39.PyUnicode_DecodeUTF8Stateful
-  PyUnicode_DecodeUnicodeEscape=python39.PyUnicode_DecodeUnicodeEscape
-  PyUnicode_EncodeCodePage=python39.PyUnicode_EncodeCodePage
-  PyUnicode_EncodeFSDefault=python39.PyUnicode_EncodeFSDefault
-  PyUnicode_EncodeLocale=python39.PyUnicode_EncodeLocale
-  PyUnicode_FSConverter=python39.PyUnicode_FSConverter
-  PyUnicode_FSDecoder=python39.PyUnicode_FSDecoder
-  PyUnicode_Find=python39.PyUnicode_Find
-  PyUnicode_FindChar=python39.PyUnicode_FindChar
-  PyUnicode_Format=python39.PyUnicode_Format
-  PyUnicode_FromEncodedObject=python39.PyUnicode_FromEncodedObject
-  PyUnicode_FromFormat=python39.PyUnicode_FromFormat
-  PyUnicode_FromFormatV=python39.PyUnicode_FromFormatV
-  PyUnicode_FromObject=python39.PyUnicode_FromObject
-  PyUnicode_FromOrdinal=python39.PyUnicode_FromOrdinal
-  PyUnicode_FromString=python39.PyUnicode_FromString
-  PyUnicode_FromStringAndSize=python39.PyUnicode_FromStringAndSize
-  PyUnicode_FromWideChar=python39.PyUnicode_FromWideChar
-  PyUnicode_GetDefaultEncoding=python39.PyUnicode_GetDefaultEncoding
-  PyUnicode_GetLength=python39.PyUnicode_GetLength
-  PyUnicode_GetSize=python39.PyUnicode_GetSize
-  PyUnicode_InternFromString=python39.PyUnicode_InternFromString
-  PyUnicode_InternImmortal=python39.PyUnicode_InternImmortal
-  PyUnicode_InternInPlace=python39.PyUnicode_InternInPlace
-  PyUnicode_IsIdentifier=python39.PyUnicode_IsIdentifier
-  PyUnicode_Join=python39.PyUnicode_Join
-  PyUnicode_Partition=python39.PyUnicode_Partition
-  PyUnicode_RPartition=python39.PyUnicode_RPartition
-  PyUnicode_RSplit=python39.PyUnicode_RSplit
-  PyUnicode_ReadChar=python39.PyUnicode_ReadChar
-  PyUnicode_Replace=python39.PyUnicode_Replace
-  PyUnicode_Resize=python39.PyUnicode_Resize
-  PyUnicode_RichCompare=python39.PyUnicode_RichCompare
-  PyUnicode_Split=python39.PyUnicode_Split
-  PyUnicode_Splitlines=python39.PyUnicode_Splitlines
-  PyUnicode_Substring=python39.PyUnicode_Substring
-  PyUnicode_Tailmatch=python39.PyUnicode_Tailmatch
-  PyUnicode_Translate=python39.PyUnicode_Translate
-  PyUnicode_Type=python39.PyUnicode_Type DATA
-  PyUnicode_WriteChar=python39.PyUnicode_WriteChar
-  PyWeakref_GetObject=python39.PyWeakref_GetObject
-  PyWeakref_NewProxy=python39.PyWeakref_NewProxy
-  PyWeakref_NewRef=python39.PyWeakref_NewRef
-  PyWrapperDescr_Type=python39.PyWrapperDescr_Type DATA
-  PyWrapper_New=python39.PyWrapper_New
-  PyZip_Type=python39.PyZip_Type DATA
-  Py_AddPendingCall=python39.Py_AddPendingCall
-  Py_AtExit=python39.Py_AtExit
-  Py_BuildValue=python39.Py_BuildValue
-  Py_CompileString=python39.Py_CompileString
-  Py_DecRef=python39.Py_DecRef
-  Py_DecodeLocale=python39.Py_DecodeLocale
-  Py_EncodeLocale=python39.Py_EncodeLocale
-  Py_EndInterpreter=python39.Py_EndInterpreter
-  Py_EnterRecursiveCall=python39.Py_EnterRecursiveCall
-  Py_Exit=python39.Py_Exit
-  Py_FatalError=python39.Py_FatalError
-  Py_FileSystemDefaultEncodeErrors=python39.Py_FileSystemDefaultEncodeErrors DATA
-  Py_FileSystemDefaultEncoding=python39.Py_FileSystemDefaultEncoding DATA
-  Py_Finalize=python39.Py_Finalize
-  Py_FinalizeEx=python39.Py_FinalizeEx
-  Py_GenericAlias=python39.Py_GenericAlias
-  Py_GenericAliasType=python39.Py_GenericAliasType
-  Py_GetArgcArgv=python39.Py_GetArgcArgv
-  Py_GetBuildInfo=python39.Py_GetBuildInfo
-  Py_GetCompiler=python39.Py_GetCompiler
-  Py_GetCopyright=python39.Py_GetCopyright
-  Py_GetExecPrefix=python39.Py_GetExecPrefix
-  Py_GetPath=python39.Py_GetPath
-  Py_GetPlatform=python39.Py_GetPlatform
-  Py_GetPrefix=python39.Py_GetPrefix
-  Py_GetProgramFullPath=python39.Py_GetProgramFullPath
-  Py_GetProgramName=python39.Py_GetProgramName
-  Py_GetPythonHome=python39.Py_GetPythonHome
-  Py_GetRecursionLimit=python39.Py_GetRecursionLimit
-  Py_GetVersion=python39.Py_GetVersion
-  Py_HasFileSystemDefaultEncoding=python39.Py_HasFileSystemDefaultEncoding DATA
-  Py_IncRef=python39.Py_IncRef
-  Py_Initialize=python39.Py_Initialize
-  Py_InitializeEx=python39.Py_InitializeEx
-  Py_IsInitialized=python39.Py_IsInitialized
-  Py_LeaveRecursiveCall=python39.Py_LeaveRecursiveCall
-  Py_Main=python39.Py_Main
-  Py_MakePendingCalls=python39.Py_MakePendingCalls
-  Py_NewInterpreter=python39.Py_NewInterpreter
-  Py_ReprEnter=python39.Py_ReprEnter
-  Py_ReprLeave=python39.Py_ReprLeave
-  Py_SetPath=python39.Py_SetPath
-  Py_SetProgramName=python39.Py_SetProgramName
-  Py_SetPythonHome=python39.Py_SetPythonHome
-  Py_SetRecursionLimit=python39.Py_SetRecursionLimit
-  Py_SymtableString=python39.Py_SymtableString
-  Py_UTF8Mode=python39.Py_UTF8Mode DATA
-  Py_VaBuildValue=python39.Py_VaBuildValue
-  _PyArg_ParseTupleAndKeywords_SizeT=python39._PyArg_ParseTupleAndKeywords_SizeT
-  _PyArg_ParseTuple_SizeT=python39._PyArg_ParseTuple_SizeT
-  _PyArg_Parse_SizeT=python39._PyArg_Parse_SizeT
-  _PyArg_VaParseTupleAndKeywords_SizeT=python39._PyArg_VaParseTupleAndKeywords_SizeT
-  _PyArg_VaParse_SizeT=python39._PyArg_VaParse_SizeT
-  _PyErr_BadInternalCall=python39._PyErr_BadInternalCall
-  _PyObject_CallFunction_SizeT=python39._PyObject_CallFunction_SizeT
-  _PyObject_CallMethod_SizeT=python39._PyObject_CallMethod_SizeT
-  _PyObject_GC_Malloc=python39._PyObject_GC_Malloc
-  _PyObject_GC_New=python39._PyObject_GC_New
-  _PyObject_GC_NewVar=python39._PyObject_GC_NewVar
-  _PyObject_GC_Resize=python39._PyObject_GC_Resize
-  _PyObject_New=python39._PyObject_New
-  _PyObject_NewVar=python39._PyObject_NewVar
-  _PyState_AddModule=python39._PyState_AddModule
-  _PyThreadState_Init=python39._PyThreadState_Init
-  _PyThreadState_Prealloc=python39._PyThreadState_Prealloc
-  _PyTrash_delete_later=python39._PyTrash_delete_later DATA
-  _PyTrash_delete_nesting=python39._PyTrash_delete_nesting DATA
-  _PyTrash_deposit_object=python39._PyTrash_deposit_object
-  _PyTrash_destroy_chain=python39._PyTrash_destroy_chain
-  _PyTrash_thread_deposit_object=python39._PyTrash_thread_deposit_object
-  _PyTrash_thread_destroy_chain=python39._PyTrash_thread_destroy_chain
-  _PyWeakref_CallableProxyType=python39._PyWeakref_CallableProxyType DATA
-  _PyWeakref_ProxyType=python39._PyWeakref_ProxyType DATA
-  _PyWeakref_RefType=python39._PyWeakref_RefType DATA
-  _Py_BuildValue_SizeT=python39._Py_BuildValue_SizeT
-  _Py_CheckRecursionLimit=python39._Py_CheckRecursionLimit DATA
-  _Py_CheckRecursiveCall=python39._Py_CheckRecursiveCall
-  _Py_Dealloc=python39._Py_Dealloc
-  _Py_EllipsisObject=python39._Py_EllipsisObject DATA
-  _Py_FalseStruct=python39._Py_FalseStruct DATA
-  _Py_NoneStruct=python39._Py_NoneStruct DATA
-  _Py_NotImplementedStruct=python39._Py_NotImplementedStruct DATA
-  _Py_SwappedOp=python39._Py_SwappedOp DATA
-  _Py_TrueStruct=python39._Py_TrueStruct DATA
-  _Py_VaBuildValue_SizeT=python39._Py_VaBuildValue_SizeT
diff --git a/PC/python3dll.c b/PC/python3dll.c
old mode 100644
new mode 100755
index ef29071..08d3c52
--- a/PC/python3dll.c
+++ b/PC/python3dll.c
@@ -1,9 +1,855 @@
-#include <windows.h>
 
-BOOL WINAPI
-DllMain(HINSTANCE hInstDLL,
-        DWORD fdwReason,
-        LPVOID lpReserved)
-{
-    return TRUE;
-}
\ No newline at end of file
+/* Re-export stable Python ABI */
+
+/* Generated by Tools/scripts/stable_abi.py */
+
+#ifdef _M_IX86
+#define DECORATE "_"
+#else
+#define DECORATE
+#endif
+
+#define EXPORT_FUNC(name) \
+    __pragma(comment(linker, "/EXPORT:" DECORATE #name "=" PYTHON_DLL_NAME "." #name))
+#define EXPORT_DATA(name) \
+    __pragma(comment(linker, "/EXPORT:" DECORATE #name "=" PYTHON_DLL_NAME "." #name ",DATA"))
+
+EXPORT_FUNC(_Py_BuildValue_SizeT)
+EXPORT_FUNC(_Py_CheckRecursiveCall)
+EXPORT_FUNC(_Py_Dealloc)
+EXPORT_FUNC(_Py_DecRef)
+EXPORT_FUNC(_Py_IncRef)
+EXPORT_FUNC(_Py_VaBuildValue_SizeT)
+EXPORT_FUNC(_PyArg_Parse_SizeT)
+EXPORT_FUNC(_PyArg_ParseTuple_SizeT)
+EXPORT_FUNC(_PyArg_ParseTupleAndKeywords_SizeT)
+EXPORT_FUNC(_PyArg_VaParse_SizeT)
+EXPORT_FUNC(_PyArg_VaParseTupleAndKeywords_SizeT)
+EXPORT_FUNC(_PyErr_BadInternalCall)
+EXPORT_FUNC(_PyObject_CallFunction_SizeT)
+EXPORT_FUNC(_PyObject_CallMethod_SizeT)
+EXPORT_FUNC(_PyObject_GC_Malloc)
+EXPORT_FUNC(_PyObject_GC_New)
+EXPORT_FUNC(_PyObject_GC_NewVar)
+EXPORT_FUNC(_PyObject_GC_Resize)
+EXPORT_FUNC(_PyObject_New)
+EXPORT_FUNC(_PyObject_NewVar)
+EXPORT_FUNC(_PyState_AddModule)
+EXPORT_FUNC(_PyThreadState_Init)
+EXPORT_FUNC(_PyThreadState_Prealloc)
+EXPORT_FUNC(_PyTrash_deposit_object)
+EXPORT_FUNC(_PyTrash_destroy_chain)
+EXPORT_FUNC(_PyTrash_thread_deposit_object)
+EXPORT_FUNC(_PyTrash_thread_destroy_chain)
+EXPORT_FUNC(Py_AddPendingCall)
+EXPORT_FUNC(Py_AtExit)
+EXPORT_FUNC(Py_BuildValue)
+EXPORT_FUNC(Py_BytesMain)
+EXPORT_FUNC(Py_CompileString)
+EXPORT_FUNC(Py_DecodeLocale)
+EXPORT_FUNC(Py_DecRef)
+EXPORT_FUNC(Py_EncodeLocale)
+EXPORT_FUNC(Py_EndInterpreter)
+EXPORT_FUNC(Py_EnterRecursiveCall)
+EXPORT_FUNC(Py_Exit)
+EXPORT_FUNC(Py_FatalError)
+EXPORT_FUNC(Py_Finalize)
+EXPORT_FUNC(Py_FinalizeEx)
+EXPORT_FUNC(Py_GenericAlias)
+EXPORT_FUNC(Py_GetArgcArgv)
+EXPORT_FUNC(Py_GetBuildInfo)
+EXPORT_FUNC(Py_GetCompiler)
+EXPORT_FUNC(Py_GetCopyright)
+EXPORT_FUNC(Py_GetExecPrefix)
+EXPORT_FUNC(Py_GetPath)
+EXPORT_FUNC(Py_GetPlatform)
+EXPORT_FUNC(Py_GetPrefix)
+EXPORT_FUNC(Py_GetProgramFullPath)
+EXPORT_FUNC(Py_GetProgramName)
+EXPORT_FUNC(Py_GetPythonHome)
+EXPORT_FUNC(Py_GetRecursionLimit)
+EXPORT_FUNC(Py_GetVersion)
+EXPORT_FUNC(Py_IncRef)
+EXPORT_FUNC(Py_Initialize)
+EXPORT_FUNC(Py_InitializeEx)
+EXPORT_FUNC(Py_Is)
+EXPORT_FUNC(Py_IsFalse)
+EXPORT_FUNC(Py_IsInitialized)
+EXPORT_FUNC(Py_IsNone)
+EXPORT_FUNC(Py_IsTrue)
+EXPORT_FUNC(Py_LeaveRecursiveCall)
+EXPORT_FUNC(Py_Main)
+EXPORT_FUNC(Py_MakePendingCalls)
+EXPORT_FUNC(Py_NewInterpreter)
+EXPORT_FUNC(Py_NewRef)
+EXPORT_FUNC(Py_ReprEnter)
+EXPORT_FUNC(Py_ReprLeave)
+EXPORT_FUNC(Py_SetPath)
+EXPORT_FUNC(Py_SetProgramName)
+EXPORT_FUNC(Py_SetPythonHome)
+EXPORT_FUNC(Py_SetRecursionLimit)
+EXPORT_FUNC(Py_VaBuildValue)
+EXPORT_FUNC(Py_XNewRef)
+EXPORT_FUNC(PyAIter_Check)
+EXPORT_FUNC(PyArg_Parse)
+EXPORT_FUNC(PyArg_ParseTuple)
+EXPORT_FUNC(PyArg_ParseTupleAndKeywords)
+EXPORT_FUNC(PyArg_UnpackTuple)
+EXPORT_FUNC(PyArg_ValidateKeywordArguments)
+EXPORT_FUNC(PyArg_VaParse)
+EXPORT_FUNC(PyArg_VaParseTupleAndKeywords)
+EXPORT_FUNC(PyBool_FromLong)
+EXPORT_FUNC(PyByteArray_AsString)
+EXPORT_FUNC(PyByteArray_Concat)
+EXPORT_FUNC(PyByteArray_FromObject)
+EXPORT_FUNC(PyByteArray_FromStringAndSize)
+EXPORT_FUNC(PyByteArray_Resize)
+EXPORT_FUNC(PyByteArray_Size)
+EXPORT_FUNC(PyBytes_AsString)
+EXPORT_FUNC(PyBytes_AsStringAndSize)
+EXPORT_FUNC(PyBytes_Concat)
+EXPORT_FUNC(PyBytes_ConcatAndDel)
+EXPORT_FUNC(PyBytes_DecodeEscape)
+EXPORT_FUNC(PyBytes_FromFormat)
+EXPORT_FUNC(PyBytes_FromFormatV)
+EXPORT_FUNC(PyBytes_FromObject)
+EXPORT_FUNC(PyBytes_FromString)
+EXPORT_FUNC(PyBytes_FromStringAndSize)
+EXPORT_FUNC(PyBytes_Repr)
+EXPORT_FUNC(PyBytes_Size)
+EXPORT_FUNC(PyCallable_Check)
+EXPORT_FUNC(PyCallIter_New)
+EXPORT_FUNC(PyCapsule_GetContext)
+EXPORT_FUNC(PyCapsule_GetDestructor)
+EXPORT_FUNC(PyCapsule_GetName)
+EXPORT_FUNC(PyCapsule_GetPointer)
+EXPORT_FUNC(PyCapsule_Import)
+EXPORT_FUNC(PyCapsule_IsValid)
+EXPORT_FUNC(PyCapsule_New)
+EXPORT_FUNC(PyCapsule_SetContext)
+EXPORT_FUNC(PyCapsule_SetDestructor)
+EXPORT_FUNC(PyCapsule_SetName)
+EXPORT_FUNC(PyCapsule_SetPointer)
+EXPORT_FUNC(PyCFunction_Call)
+EXPORT_FUNC(PyCFunction_GetFlags)
+EXPORT_FUNC(PyCFunction_GetFunction)
+EXPORT_FUNC(PyCFunction_GetSelf)
+EXPORT_FUNC(PyCFunction_New)
+EXPORT_FUNC(PyCFunction_NewEx)
+EXPORT_FUNC(PyCMethod_New)
+EXPORT_FUNC(PyCodec_BackslashReplaceErrors)
+EXPORT_FUNC(PyCodec_Decode)
+EXPORT_FUNC(PyCodec_Decoder)
+EXPORT_FUNC(PyCodec_Encode)
+EXPORT_FUNC(PyCodec_Encoder)
+EXPORT_FUNC(PyCodec_IgnoreErrors)
+EXPORT_FUNC(PyCodec_IncrementalDecoder)
+EXPORT_FUNC(PyCodec_IncrementalEncoder)
+EXPORT_FUNC(PyCodec_KnownEncoding)
+EXPORT_FUNC(PyCodec_LookupError)
+EXPORT_FUNC(PyCodec_NameReplaceErrors)
+EXPORT_FUNC(PyCodec_Register)
+EXPORT_FUNC(PyCodec_RegisterError)
+EXPORT_FUNC(PyCodec_ReplaceErrors)
+EXPORT_FUNC(PyCodec_StreamReader)
+EXPORT_FUNC(PyCodec_StreamWriter)
+EXPORT_FUNC(PyCodec_StrictErrors)
+EXPORT_FUNC(PyCodec_Unregister)
+EXPORT_FUNC(PyCodec_XMLCharRefReplaceErrors)
+EXPORT_FUNC(PyComplex_FromDoubles)
+EXPORT_FUNC(PyComplex_ImagAsDouble)
+EXPORT_FUNC(PyComplex_RealAsDouble)
+EXPORT_FUNC(PyDescr_NewClassMethod)
+EXPORT_FUNC(PyDescr_NewGetSet)
+EXPORT_FUNC(PyDescr_NewMember)
+EXPORT_FUNC(PyDescr_NewMethod)
+EXPORT_FUNC(PyDict_Clear)
+EXPORT_FUNC(PyDict_Contains)
+EXPORT_FUNC(PyDict_Copy)
+EXPORT_FUNC(PyDict_DelItem)
+EXPORT_FUNC(PyDict_DelItemString)
+EXPORT_FUNC(PyDict_GetItem)
+EXPORT_FUNC(PyDict_GetItemString)
+EXPORT_FUNC(PyDict_GetItemWithError)
+EXPORT_FUNC(PyDict_Items)
+EXPORT_FUNC(PyDict_Keys)
+EXPORT_FUNC(PyDict_Merge)
+EXPORT_FUNC(PyDict_MergeFromSeq2)
+EXPORT_FUNC(PyDict_New)
+EXPORT_FUNC(PyDict_Next)
+EXPORT_FUNC(PyDict_SetItem)
+EXPORT_FUNC(PyDict_SetItemString)
+EXPORT_FUNC(PyDict_Size)
+EXPORT_FUNC(PyDict_Update)
+EXPORT_FUNC(PyDict_Values)
+EXPORT_FUNC(PyDictProxy_New)
+EXPORT_FUNC(PyErr_BadArgument)
+EXPORT_FUNC(PyErr_BadInternalCall)
+EXPORT_FUNC(PyErr_CheckSignals)
+EXPORT_FUNC(PyErr_Clear)
+EXPORT_FUNC(PyErr_Display)
+EXPORT_FUNC(PyErr_ExceptionMatches)
+EXPORT_FUNC(PyErr_Fetch)
+EXPORT_FUNC(PyErr_Format)
+EXPORT_FUNC(PyErr_FormatV)
+EXPORT_FUNC(PyErr_GetExcInfo)
+EXPORT_FUNC(PyErr_GivenExceptionMatches)
+EXPORT_FUNC(PyErr_NewException)
+EXPORT_FUNC(PyErr_NewExceptionWithDoc)
+EXPORT_FUNC(PyErr_NoMemory)
+EXPORT_FUNC(PyErr_NormalizeException)
+EXPORT_FUNC(PyErr_Occurred)
+EXPORT_FUNC(PyErr_Print)
+EXPORT_FUNC(PyErr_PrintEx)
+EXPORT_FUNC(PyErr_ProgramText)
+EXPORT_FUNC(PyErr_ResourceWarning)
+EXPORT_FUNC(PyErr_Restore)
+EXPORT_FUNC(PyErr_SetExcFromWindowsErr)
+EXPORT_FUNC(PyErr_SetExcFromWindowsErrWithFilename)
+EXPORT_FUNC(PyErr_SetExcFromWindowsErrWithFilenameObject)
+EXPORT_FUNC(PyErr_SetExcFromWindowsErrWithFilenameObjects)
+EXPORT_FUNC(PyErr_SetExcInfo)
+EXPORT_FUNC(PyErr_SetFromErrno)
+EXPORT_FUNC(PyErr_SetFromErrnoWithFilename)
+EXPORT_FUNC(PyErr_SetFromErrnoWithFilenameObject)
+EXPORT_FUNC(PyErr_SetFromErrnoWithFilenameObjects)
+EXPORT_FUNC(PyErr_SetFromWindowsErr)
+EXPORT_FUNC(PyErr_SetFromWindowsErrWithFilename)
+EXPORT_FUNC(PyErr_SetImportError)
+EXPORT_FUNC(PyErr_SetImportErrorSubclass)
+EXPORT_FUNC(PyErr_SetInterrupt)
+EXPORT_FUNC(PyErr_SetInterruptEx)
+EXPORT_FUNC(PyErr_SetNone)
+EXPORT_FUNC(PyErr_SetObject)
+EXPORT_FUNC(PyErr_SetString)
+EXPORT_FUNC(PyErr_SyntaxLocation)
+EXPORT_FUNC(PyErr_SyntaxLocationEx)
+EXPORT_FUNC(PyErr_WarnEx)
+EXPORT_FUNC(PyErr_WarnExplicit)
+EXPORT_FUNC(PyErr_WarnFormat)
+EXPORT_FUNC(PyErr_WriteUnraisable)
+EXPORT_FUNC(PyEval_AcquireLock)
+EXPORT_FUNC(PyEval_AcquireThread)
+EXPORT_FUNC(PyEval_CallFunction)
+EXPORT_FUNC(PyEval_CallMethod)
+EXPORT_FUNC(PyEval_CallObjectWithKeywords)
+EXPORT_FUNC(PyEval_EvalCode)
+EXPORT_FUNC(PyEval_EvalCodeEx)
+EXPORT_FUNC(PyEval_EvalFrame)
+EXPORT_FUNC(PyEval_EvalFrameEx)
+EXPORT_FUNC(PyEval_GetBuiltins)
+EXPORT_FUNC(PyEval_GetFrame)
+EXPORT_FUNC(PyEval_GetFuncDesc)
+EXPORT_FUNC(PyEval_GetFuncName)
+EXPORT_FUNC(PyEval_GetGlobals)
+EXPORT_FUNC(PyEval_GetLocals)
+EXPORT_FUNC(PyEval_InitThreads)
+EXPORT_FUNC(PyEval_ReleaseLock)
+EXPORT_FUNC(PyEval_ReleaseThread)
+EXPORT_FUNC(PyEval_RestoreThread)
+EXPORT_FUNC(PyEval_SaveThread)
+EXPORT_FUNC(PyEval_ThreadsInitialized)
+EXPORT_FUNC(PyException_GetCause)
+EXPORT_FUNC(PyException_GetContext)
+EXPORT_FUNC(PyException_GetTraceback)
+EXPORT_FUNC(PyException_SetCause)
+EXPORT_FUNC(PyException_SetContext)
+EXPORT_FUNC(PyException_SetTraceback)
+EXPORT_FUNC(PyExceptionClass_Name)
+EXPORT_FUNC(PyFile_FromFd)
+EXPORT_FUNC(PyFile_GetLine)
+EXPORT_FUNC(PyFile_WriteObject)
+EXPORT_FUNC(PyFile_WriteString)
+EXPORT_FUNC(PyFloat_AsDouble)
+EXPORT_FUNC(PyFloat_FromDouble)
+EXPORT_FUNC(PyFloat_FromString)
+EXPORT_FUNC(PyFloat_GetInfo)
+EXPORT_FUNC(PyFloat_GetMax)
+EXPORT_FUNC(PyFloat_GetMin)
+EXPORT_FUNC(PyFrame_GetCode)
+EXPORT_FUNC(PyFrame_GetLineNumber)
+EXPORT_FUNC(PyFrozenSet_New)
+EXPORT_FUNC(PyGC_Collect)
+EXPORT_FUNC(PyGC_Disable)
+EXPORT_FUNC(PyGC_Enable)
+EXPORT_FUNC(PyGC_IsEnabled)
+EXPORT_FUNC(PyGILState_Ensure)
+EXPORT_FUNC(PyGILState_GetThisThreadState)
+EXPORT_FUNC(PyGILState_Release)
+EXPORT_FUNC(PyImport_AddModule)
+EXPORT_FUNC(PyImport_AddModuleObject)
+EXPORT_FUNC(PyImport_AppendInittab)
+EXPORT_FUNC(PyImport_ExecCodeModule)
+EXPORT_FUNC(PyImport_ExecCodeModuleEx)
+EXPORT_FUNC(PyImport_ExecCodeModuleObject)
+EXPORT_FUNC(PyImport_ExecCodeModuleWithPathnames)
+EXPORT_FUNC(PyImport_GetImporter)
+EXPORT_FUNC(PyImport_GetMagicNumber)
+EXPORT_FUNC(PyImport_GetMagicTag)
+EXPORT_FUNC(PyImport_GetModule)
+EXPORT_FUNC(PyImport_GetModuleDict)
+EXPORT_FUNC(PyImport_Import)
+EXPORT_FUNC(PyImport_ImportFrozenModule)
+EXPORT_FUNC(PyImport_ImportFrozenModuleObject)
+EXPORT_FUNC(PyImport_ImportModule)
+EXPORT_FUNC(PyImport_ImportModuleLevel)
+EXPORT_FUNC(PyImport_ImportModuleLevelObject)
+EXPORT_FUNC(PyImport_ImportModuleNoBlock)
+EXPORT_FUNC(PyImport_ReloadModule)
+EXPORT_FUNC(PyIndex_Check)
+EXPORT_FUNC(PyInterpreterState_Clear)
+EXPORT_FUNC(PyInterpreterState_Delete)
+EXPORT_FUNC(PyInterpreterState_Get)
+EXPORT_FUNC(PyInterpreterState_GetDict)
+EXPORT_FUNC(PyInterpreterState_GetID)
+EXPORT_FUNC(PyInterpreterState_New)
+EXPORT_FUNC(PyIter_Check)
+EXPORT_FUNC(PyIter_Next)
+EXPORT_FUNC(PyIter_Send)
+EXPORT_FUNC(PyList_Append)
+EXPORT_FUNC(PyList_AsTuple)
+EXPORT_FUNC(PyList_GetItem)
+EXPORT_FUNC(PyList_GetSlice)
+EXPORT_FUNC(PyList_Insert)
+EXPORT_FUNC(PyList_New)
+EXPORT_FUNC(PyList_Reverse)
+EXPORT_FUNC(PyList_SetItem)
+EXPORT_FUNC(PyList_SetSlice)
+EXPORT_FUNC(PyList_Size)
+EXPORT_FUNC(PyList_Sort)
+EXPORT_FUNC(PyLong_AsDouble)
+EXPORT_FUNC(PyLong_AsLong)
+EXPORT_FUNC(PyLong_AsLongAndOverflow)
+EXPORT_FUNC(PyLong_AsLongLong)
+EXPORT_FUNC(PyLong_AsLongLongAndOverflow)
+EXPORT_FUNC(PyLong_AsSize_t)
+EXPORT_FUNC(PyLong_AsSsize_t)
+EXPORT_FUNC(PyLong_AsUnsignedLong)
+EXPORT_FUNC(PyLong_AsUnsignedLongLong)
+EXPORT_FUNC(PyLong_AsUnsignedLongLongMask)
+EXPORT_FUNC(PyLong_AsUnsignedLongMask)
+EXPORT_FUNC(PyLong_AsVoidPtr)
+EXPORT_FUNC(PyLong_FromDouble)
+EXPORT_FUNC(PyLong_FromLong)
+EXPORT_FUNC(PyLong_FromLongLong)
+EXPORT_FUNC(PyLong_FromSize_t)
+EXPORT_FUNC(PyLong_FromSsize_t)
+EXPORT_FUNC(PyLong_FromString)
+EXPORT_FUNC(PyLong_FromUnsignedLong)
+EXPORT_FUNC(PyLong_FromUnsignedLongLong)
+EXPORT_FUNC(PyLong_FromVoidPtr)
+EXPORT_FUNC(PyLong_GetInfo)
+EXPORT_FUNC(PyMapping_Check)
+EXPORT_FUNC(PyMapping_GetItemString)
+EXPORT_FUNC(PyMapping_HasKey)
+EXPORT_FUNC(PyMapping_HasKeyString)
+EXPORT_FUNC(PyMapping_Items)
+EXPORT_FUNC(PyMapping_Keys)
+EXPORT_FUNC(PyMapping_Length)
+EXPORT_FUNC(PyMapping_SetItemString)
+EXPORT_FUNC(PyMapping_Size)
+EXPORT_FUNC(PyMapping_Values)
+EXPORT_FUNC(PyMarshal_ReadObjectFromString)
+EXPORT_FUNC(PyMarshal_WriteObjectToString)
+EXPORT_FUNC(PyMem_Calloc)
+EXPORT_FUNC(PyMem_Free)
+EXPORT_FUNC(PyMem_Malloc)
+EXPORT_FUNC(PyMem_Realloc)
+EXPORT_FUNC(PyMember_GetOne)
+EXPORT_FUNC(PyMember_SetOne)
+EXPORT_FUNC(PyMemoryView_FromMemory)
+EXPORT_FUNC(PyMemoryView_FromObject)
+EXPORT_FUNC(PyMemoryView_GetContiguous)
+EXPORT_FUNC(PyModule_AddFunctions)
+EXPORT_FUNC(PyModule_AddIntConstant)
+EXPORT_FUNC(PyModule_AddObject)
+EXPORT_FUNC(PyModule_AddObjectRef)
+EXPORT_FUNC(PyModule_AddStringConstant)
+EXPORT_FUNC(PyModule_AddType)
+EXPORT_FUNC(PyModule_Create2)
+EXPORT_FUNC(PyModule_ExecDef)
+EXPORT_FUNC(PyModule_FromDefAndSpec2)
+EXPORT_FUNC(PyModule_GetDef)
+EXPORT_FUNC(PyModule_GetDict)
+EXPORT_FUNC(PyModule_GetFilename)
+EXPORT_FUNC(PyModule_GetFilenameObject)
+EXPORT_FUNC(PyModule_GetName)
+EXPORT_FUNC(PyModule_GetNameObject)
+EXPORT_FUNC(PyModule_GetState)
+EXPORT_FUNC(PyModule_New)
+EXPORT_FUNC(PyModule_NewObject)
+EXPORT_FUNC(PyModule_SetDocString)
+EXPORT_FUNC(PyModuleDef_Init)
+EXPORT_FUNC(PyNumber_Absolute)
+EXPORT_FUNC(PyNumber_Add)
+EXPORT_FUNC(PyNumber_And)
+EXPORT_FUNC(PyNumber_AsSsize_t)
+EXPORT_FUNC(PyNumber_Check)
+EXPORT_FUNC(PyNumber_Divmod)
+EXPORT_FUNC(PyNumber_Float)
+EXPORT_FUNC(PyNumber_FloorDivide)
+EXPORT_FUNC(PyNumber_Index)
+EXPORT_FUNC(PyNumber_InPlaceAdd)
+EXPORT_FUNC(PyNumber_InPlaceAnd)
+EXPORT_FUNC(PyNumber_InPlaceFloorDivide)
+EXPORT_FUNC(PyNumber_InPlaceLshift)
+EXPORT_FUNC(PyNumber_InPlaceMatrixMultiply)
+EXPORT_FUNC(PyNumber_InPlaceMultiply)
+EXPORT_FUNC(PyNumber_InPlaceOr)
+EXPORT_FUNC(PyNumber_InPlacePower)
+EXPORT_FUNC(PyNumber_InPlaceRemainder)
+EXPORT_FUNC(PyNumber_InPlaceRshift)
+EXPORT_FUNC(PyNumber_InPlaceSubtract)
+EXPORT_FUNC(PyNumber_InPlaceTrueDivide)
+EXPORT_FUNC(PyNumber_InPlaceXor)
+EXPORT_FUNC(PyNumber_Invert)
+EXPORT_FUNC(PyNumber_Long)
+EXPORT_FUNC(PyNumber_Lshift)
+EXPORT_FUNC(PyNumber_MatrixMultiply)
+EXPORT_FUNC(PyNumber_Multiply)
+EXPORT_FUNC(PyNumber_Negative)
+EXPORT_FUNC(PyNumber_Or)
+EXPORT_FUNC(PyNumber_Positive)
+EXPORT_FUNC(PyNumber_Power)
+EXPORT_FUNC(PyNumber_Remainder)
+EXPORT_FUNC(PyNumber_Rshift)
+EXPORT_FUNC(PyNumber_Subtract)
+EXPORT_FUNC(PyNumber_ToBase)
+EXPORT_FUNC(PyNumber_TrueDivide)
+EXPORT_FUNC(PyNumber_Xor)
+EXPORT_FUNC(PyObject_AsCharBuffer)
+EXPORT_FUNC(PyObject_ASCII)
+EXPORT_FUNC(PyObject_AsFileDescriptor)
+EXPORT_FUNC(PyObject_AsReadBuffer)
+EXPORT_FUNC(PyObject_AsWriteBuffer)
+EXPORT_FUNC(PyObject_Bytes)
+EXPORT_FUNC(PyObject_Call)
+EXPORT_FUNC(PyObject_CallFunction)
+EXPORT_FUNC(PyObject_CallFunctionObjArgs)
+EXPORT_FUNC(PyObject_CallMethod)
+EXPORT_FUNC(PyObject_CallMethodObjArgs)
+EXPORT_FUNC(PyObject_CallNoArgs)
+EXPORT_FUNC(PyObject_CallObject)
+EXPORT_FUNC(PyObject_Calloc)
+EXPORT_FUNC(PyObject_CheckReadBuffer)
+EXPORT_FUNC(PyObject_ClearWeakRefs)
+EXPORT_FUNC(PyObject_DelItem)
+EXPORT_FUNC(PyObject_DelItemString)
+EXPORT_FUNC(PyObject_Dir)
+EXPORT_FUNC(PyObject_Format)
+EXPORT_FUNC(PyObject_Free)
+EXPORT_FUNC(PyObject_GC_Del)
+EXPORT_FUNC(PyObject_GC_IsFinalized)
+EXPORT_FUNC(PyObject_GC_IsTracked)
+EXPORT_FUNC(PyObject_GC_Track)
+EXPORT_FUNC(PyObject_GC_UnTrack)
+EXPORT_FUNC(PyObject_GenericGetAttr)
+EXPORT_FUNC(PyObject_GenericGetDict)
+EXPORT_FUNC(PyObject_GenericSetAttr)
+EXPORT_FUNC(PyObject_GenericSetDict)
+EXPORT_FUNC(PyObject_GetAIter)
+EXPORT_FUNC(PyObject_GetAttr)
+EXPORT_FUNC(PyObject_GetAttrString)
+EXPORT_FUNC(PyObject_GetItem)
+EXPORT_FUNC(PyObject_GetIter)
+EXPORT_FUNC(PyObject_HasAttr)
+EXPORT_FUNC(PyObject_HasAttrString)
+EXPORT_FUNC(PyObject_Hash)
+EXPORT_FUNC(PyObject_HashNotImplemented)
+EXPORT_FUNC(PyObject_Init)
+EXPORT_FUNC(PyObject_InitVar)
+EXPORT_FUNC(PyObject_IsInstance)
+EXPORT_FUNC(PyObject_IsSubclass)
+EXPORT_FUNC(PyObject_IsTrue)
+EXPORT_FUNC(PyObject_Length)
+EXPORT_FUNC(PyObject_Malloc)
+EXPORT_FUNC(PyObject_Not)
+EXPORT_FUNC(PyObject_Realloc)
+EXPORT_FUNC(PyObject_Repr)
+EXPORT_FUNC(PyObject_RichCompare)
+EXPORT_FUNC(PyObject_RichCompareBool)
+EXPORT_FUNC(PyObject_SelfIter)
+EXPORT_FUNC(PyObject_SetAttr)
+EXPORT_FUNC(PyObject_SetAttrString)
+EXPORT_FUNC(PyObject_SetItem)
+EXPORT_FUNC(PyObject_Size)
+EXPORT_FUNC(PyObject_Str)
+EXPORT_FUNC(PyObject_Type)
+EXPORT_FUNC(PyOS_double_to_string)
+EXPORT_FUNC(PyOS_FSPath)
+EXPORT_FUNC(PyOS_getsig)
+EXPORT_FUNC(PyOS_InterruptOccurred)
+EXPORT_FUNC(PyOS_mystricmp)
+EXPORT_FUNC(PyOS_mystrnicmp)
+EXPORT_FUNC(PyOS_setsig)
+EXPORT_FUNC(PyOS_snprintf)
+EXPORT_FUNC(PyOS_string_to_double)
+EXPORT_FUNC(PyOS_strtol)
+EXPORT_FUNC(PyOS_strtoul)
+EXPORT_FUNC(PyOS_vsnprintf)
+EXPORT_FUNC(PySeqIter_New)
+EXPORT_FUNC(PySequence_Check)
+EXPORT_FUNC(PySequence_Concat)
+EXPORT_FUNC(PySequence_Contains)
+EXPORT_FUNC(PySequence_Count)
+EXPORT_FUNC(PySequence_DelItem)
+EXPORT_FUNC(PySequence_DelSlice)
+EXPORT_FUNC(PySequence_Fast)
+EXPORT_FUNC(PySequence_GetItem)
+EXPORT_FUNC(PySequence_GetSlice)
+EXPORT_FUNC(PySequence_In)
+EXPORT_FUNC(PySequence_Index)
+EXPORT_FUNC(PySequence_InPlaceConcat)
+EXPORT_FUNC(PySequence_InPlaceRepeat)
+EXPORT_FUNC(PySequence_Length)
+EXPORT_FUNC(PySequence_List)
+EXPORT_FUNC(PySequence_Repeat)
+EXPORT_FUNC(PySequence_SetItem)
+EXPORT_FUNC(PySequence_SetSlice)
+EXPORT_FUNC(PySequence_Size)
+EXPORT_FUNC(PySequence_Tuple)
+EXPORT_FUNC(PySet_Add)
+EXPORT_FUNC(PySet_Clear)
+EXPORT_FUNC(PySet_Contains)
+EXPORT_FUNC(PySet_Discard)
+EXPORT_FUNC(PySet_New)
+EXPORT_FUNC(PySet_Pop)
+EXPORT_FUNC(PySet_Size)
+EXPORT_FUNC(PySlice_AdjustIndices)
+EXPORT_FUNC(PySlice_GetIndices)
+EXPORT_FUNC(PySlice_GetIndicesEx)
+EXPORT_FUNC(PySlice_New)
+EXPORT_FUNC(PySlice_Unpack)
+EXPORT_FUNC(PyState_AddModule)
+EXPORT_FUNC(PyState_FindModule)
+EXPORT_FUNC(PyState_RemoveModule)
+EXPORT_FUNC(PyStructSequence_GetItem)
+EXPORT_FUNC(PyStructSequence_New)
+EXPORT_FUNC(PyStructSequence_NewType)
+EXPORT_FUNC(PyStructSequence_SetItem)
+EXPORT_FUNC(PySys_AddWarnOption)
+EXPORT_FUNC(PySys_AddWarnOptionUnicode)
+EXPORT_FUNC(PySys_AddXOption)
+EXPORT_FUNC(PySys_FormatStderr)
+EXPORT_FUNC(PySys_FormatStdout)
+EXPORT_FUNC(PySys_GetObject)
+EXPORT_FUNC(PySys_GetXOptions)
+EXPORT_FUNC(PySys_HasWarnOptions)
+EXPORT_FUNC(PySys_ResetWarnOptions)
+EXPORT_FUNC(PySys_SetArgv)
+EXPORT_FUNC(PySys_SetArgvEx)
+EXPORT_FUNC(PySys_SetObject)
+EXPORT_FUNC(PySys_SetPath)
+EXPORT_FUNC(PySys_WriteStderr)
+EXPORT_FUNC(PySys_WriteStdout)
+EXPORT_FUNC(PyThread_acquire_lock)
+EXPORT_FUNC(PyThread_acquire_lock_timed)
+EXPORT_FUNC(PyThread_allocate_lock)
+EXPORT_FUNC(PyThread_create_key)
+EXPORT_FUNC(PyThread_delete_key)
+EXPORT_FUNC(PyThread_delete_key_value)
+EXPORT_FUNC(PyThread_exit_thread)
+EXPORT_FUNC(PyThread_free_lock)
+EXPORT_FUNC(PyThread_get_key_value)
+EXPORT_FUNC(PyThread_get_stacksize)
+EXPORT_FUNC(PyThread_get_thread_ident)
+EXPORT_FUNC(PyThread_get_thread_native_id)
+EXPORT_FUNC(PyThread_GetInfo)
+EXPORT_FUNC(PyThread_init_thread)
+EXPORT_FUNC(PyThread_ReInitTLS)
+EXPORT_FUNC(PyThread_release_lock)
+EXPORT_FUNC(PyThread_set_key_value)
+EXPORT_FUNC(PyThread_set_stacksize)
+EXPORT_FUNC(PyThread_start_new_thread)
+EXPORT_FUNC(PyThread_tss_alloc)
+EXPORT_FUNC(PyThread_tss_create)
+EXPORT_FUNC(PyThread_tss_delete)
+EXPORT_FUNC(PyThread_tss_free)
+EXPORT_FUNC(PyThread_tss_get)
+EXPORT_FUNC(PyThread_tss_is_created)
+EXPORT_FUNC(PyThread_tss_set)
+EXPORT_FUNC(PyThreadState_Clear)
+EXPORT_FUNC(PyThreadState_Delete)
+EXPORT_FUNC(PyThreadState_DeleteCurrent)
+EXPORT_FUNC(PyThreadState_Get)
+EXPORT_FUNC(PyThreadState_GetDict)
+EXPORT_FUNC(PyThreadState_GetFrame)
+EXPORT_FUNC(PyThreadState_GetID)
+EXPORT_FUNC(PyThreadState_GetInterpreter)
+EXPORT_FUNC(PyThreadState_New)
+EXPORT_FUNC(PyThreadState_SetAsyncExc)
+EXPORT_FUNC(PyThreadState_Swap)
+EXPORT_FUNC(PyTraceBack_Here)
+EXPORT_FUNC(PyTraceBack_Print)
+EXPORT_FUNC(PyTuple_GetItem)
+EXPORT_FUNC(PyTuple_GetSlice)
+EXPORT_FUNC(PyTuple_New)
+EXPORT_FUNC(PyTuple_Pack)
+EXPORT_FUNC(PyTuple_SetItem)
+EXPORT_FUNC(PyTuple_Size)
+EXPORT_FUNC(PyType_ClearCache)
+EXPORT_FUNC(PyType_FromModuleAndSpec)
+EXPORT_FUNC(PyType_FromSpec)
+EXPORT_FUNC(PyType_FromSpecWithBases)
+EXPORT_FUNC(PyType_GenericAlloc)
+EXPORT_FUNC(PyType_GenericNew)
+EXPORT_FUNC(PyType_GetFlags)
+EXPORT_FUNC(PyType_GetModule)
+EXPORT_FUNC(PyType_GetModuleState)
+EXPORT_FUNC(PyType_GetSlot)
+EXPORT_FUNC(PyType_IsSubtype)
+EXPORT_FUNC(PyType_Modified)
+EXPORT_FUNC(PyType_Ready)
+EXPORT_FUNC(PyUnicode_Append)
+EXPORT_FUNC(PyUnicode_AppendAndDel)
+EXPORT_FUNC(PyUnicode_AsASCIIString)
+EXPORT_FUNC(PyUnicode_AsCharmapString)
+EXPORT_FUNC(PyUnicode_AsDecodedObject)
+EXPORT_FUNC(PyUnicode_AsDecodedUnicode)
+EXPORT_FUNC(PyUnicode_AsEncodedObject)
+EXPORT_FUNC(PyUnicode_AsEncodedString)
+EXPORT_FUNC(PyUnicode_AsEncodedUnicode)
+EXPORT_FUNC(PyUnicode_AsLatin1String)
+EXPORT_FUNC(PyUnicode_AsMBCSString)
+EXPORT_FUNC(PyUnicode_AsRawUnicodeEscapeString)
+EXPORT_FUNC(PyUnicode_AsUCS4)
+EXPORT_FUNC(PyUnicode_AsUCS4Copy)
+EXPORT_FUNC(PyUnicode_AsUnicodeEscapeString)
+EXPORT_FUNC(PyUnicode_AsUTF16String)
+EXPORT_FUNC(PyUnicode_AsUTF32String)
+EXPORT_FUNC(PyUnicode_AsUTF8AndSize)
+EXPORT_FUNC(PyUnicode_AsUTF8String)
+EXPORT_FUNC(PyUnicode_AsWideChar)
+EXPORT_FUNC(PyUnicode_AsWideCharString)
+EXPORT_FUNC(PyUnicode_BuildEncodingMap)
+EXPORT_FUNC(PyUnicode_Compare)
+EXPORT_FUNC(PyUnicode_CompareWithASCIIString)
+EXPORT_FUNC(PyUnicode_Concat)
+EXPORT_FUNC(PyUnicode_Contains)
+EXPORT_FUNC(PyUnicode_Count)
+EXPORT_FUNC(PyUnicode_Decode)
+EXPORT_FUNC(PyUnicode_DecodeASCII)
+EXPORT_FUNC(PyUnicode_DecodeCharmap)
+EXPORT_FUNC(PyUnicode_DecodeCodePageStateful)
+EXPORT_FUNC(PyUnicode_DecodeFSDefault)
+EXPORT_FUNC(PyUnicode_DecodeFSDefaultAndSize)
+EXPORT_FUNC(PyUnicode_DecodeLatin1)
+EXPORT_FUNC(PyUnicode_DecodeLocale)
+EXPORT_FUNC(PyUnicode_DecodeLocaleAndSize)
+EXPORT_FUNC(PyUnicode_DecodeMBCS)
+EXPORT_FUNC(PyUnicode_DecodeMBCSStateful)
+EXPORT_FUNC(PyUnicode_DecodeRawUnicodeEscape)
+EXPORT_FUNC(PyUnicode_DecodeUnicodeEscape)
+EXPORT_FUNC(PyUnicode_DecodeUTF16)
+EXPORT_FUNC(PyUnicode_DecodeUTF16Stateful)
+EXPORT_FUNC(PyUnicode_DecodeUTF32)
+EXPORT_FUNC(PyUnicode_DecodeUTF32Stateful)
+EXPORT_FUNC(PyUnicode_DecodeUTF7)
+EXPORT_FUNC(PyUnicode_DecodeUTF7Stateful)
+EXPORT_FUNC(PyUnicode_DecodeUTF8)
+EXPORT_FUNC(PyUnicode_DecodeUTF8Stateful)
+EXPORT_FUNC(PyUnicode_EncodeCodePage)
+EXPORT_FUNC(PyUnicode_EncodeFSDefault)
+EXPORT_FUNC(PyUnicode_EncodeLocale)
+EXPORT_FUNC(PyUnicode_Find)
+EXPORT_FUNC(PyUnicode_FindChar)
+EXPORT_FUNC(PyUnicode_Format)
+EXPORT_FUNC(PyUnicode_FromEncodedObject)
+EXPORT_FUNC(PyUnicode_FromFormat)
+EXPORT_FUNC(PyUnicode_FromFormatV)
+EXPORT_FUNC(PyUnicode_FromObject)
+EXPORT_FUNC(PyUnicode_FromOrdinal)
+EXPORT_FUNC(PyUnicode_FromString)
+EXPORT_FUNC(PyUnicode_FromStringAndSize)
+EXPORT_FUNC(PyUnicode_FromWideChar)
+EXPORT_FUNC(PyUnicode_FSConverter)
+EXPORT_FUNC(PyUnicode_FSDecoder)
+EXPORT_FUNC(PyUnicode_GetDefaultEncoding)
+EXPORT_FUNC(PyUnicode_GetLength)
+EXPORT_FUNC(PyUnicode_GetSize)
+EXPORT_FUNC(PyUnicode_InternFromString)
+EXPORT_FUNC(PyUnicode_InternImmortal)
+EXPORT_FUNC(PyUnicode_InternInPlace)
+EXPORT_FUNC(PyUnicode_IsIdentifier)
+EXPORT_FUNC(PyUnicode_Join)
+EXPORT_FUNC(PyUnicode_Partition)
+EXPORT_FUNC(PyUnicode_ReadChar)
+EXPORT_FUNC(PyUnicode_Replace)
+EXPORT_FUNC(PyUnicode_Resize)
+EXPORT_FUNC(PyUnicode_RichCompare)
+EXPORT_FUNC(PyUnicode_RPartition)
+EXPORT_FUNC(PyUnicode_RSplit)
+EXPORT_FUNC(PyUnicode_Split)
+EXPORT_FUNC(PyUnicode_Splitlines)
+EXPORT_FUNC(PyUnicode_Substring)
+EXPORT_FUNC(PyUnicode_Tailmatch)
+EXPORT_FUNC(PyUnicode_Translate)
+EXPORT_FUNC(PyUnicode_WriteChar)
+EXPORT_FUNC(PyUnicodeDecodeError_Create)
+EXPORT_FUNC(PyUnicodeDecodeError_GetEncoding)
+EXPORT_FUNC(PyUnicodeDecodeError_GetEnd)
+EXPORT_FUNC(PyUnicodeDecodeError_GetObject)
+EXPORT_FUNC(PyUnicodeDecodeError_GetReason)
+EXPORT_FUNC(PyUnicodeDecodeError_GetStart)
+EXPORT_FUNC(PyUnicodeDecodeError_SetEnd)
+EXPORT_FUNC(PyUnicodeDecodeError_SetReason)
+EXPORT_FUNC(PyUnicodeDecodeError_SetStart)
+EXPORT_FUNC(PyUnicodeEncodeError_GetEncoding)
+EXPORT_FUNC(PyUnicodeEncodeError_GetEnd)
+EXPORT_FUNC(PyUnicodeEncodeError_GetObject)
+EXPORT_FUNC(PyUnicodeEncodeError_GetReason)
+EXPORT_FUNC(PyUnicodeEncodeError_GetStart)
+EXPORT_FUNC(PyUnicodeEncodeError_SetEnd)
+EXPORT_FUNC(PyUnicodeEncodeError_SetReason)
+EXPORT_FUNC(PyUnicodeEncodeError_SetStart)
+EXPORT_FUNC(PyUnicodeTranslateError_GetEnd)
+EXPORT_FUNC(PyUnicodeTranslateError_GetObject)
+EXPORT_FUNC(PyUnicodeTranslateError_GetReason)
+EXPORT_FUNC(PyUnicodeTranslateError_GetStart)
+EXPORT_FUNC(PyUnicodeTranslateError_SetEnd)
+EXPORT_FUNC(PyUnicodeTranslateError_SetReason)
+EXPORT_FUNC(PyUnicodeTranslateError_SetStart)
+EXPORT_FUNC(PyWeakref_GetObject)
+EXPORT_FUNC(PyWeakref_NewProxy)
+EXPORT_FUNC(PyWeakref_NewRef)
+EXPORT_FUNC(PyWrapper_New)
+
+EXPORT_DATA(_Py_EllipsisObject)
+EXPORT_DATA(_Py_FalseStruct)
+EXPORT_DATA(_Py_NoneStruct)
+EXPORT_DATA(_Py_NotImplementedStruct)
+EXPORT_DATA(_Py_SwappedOp)
+EXPORT_DATA(_Py_TrueStruct)
+EXPORT_DATA(_PyWeakref_CallableProxyType)
+EXPORT_DATA(_PyWeakref_ProxyType)
+EXPORT_DATA(_PyWeakref_RefType)
+EXPORT_DATA(Py_FileSystemDefaultEncodeErrors)
+EXPORT_DATA(Py_FileSystemDefaultEncoding)
+EXPORT_DATA(Py_GenericAliasType)
+EXPORT_DATA(Py_HasFileSystemDefaultEncoding)
+EXPORT_DATA(Py_UTF8Mode)
+EXPORT_DATA(PyBaseObject_Type)
+EXPORT_DATA(PyBool_Type)
+EXPORT_DATA(PyByteArray_Type)
+EXPORT_DATA(PyByteArrayIter_Type)
+EXPORT_DATA(PyBytes_Type)
+EXPORT_DATA(PyBytesIter_Type)
+EXPORT_DATA(PyCallIter_Type)
+EXPORT_DATA(PyCapsule_Type)
+EXPORT_DATA(PyCFunction_Type)
+EXPORT_DATA(PyClassMethodDescr_Type)
+EXPORT_DATA(PyComplex_Type)
+EXPORT_DATA(PyDict_Type)
+EXPORT_DATA(PyDictItems_Type)
+EXPORT_DATA(PyDictIterItem_Type)
+EXPORT_DATA(PyDictIterKey_Type)
+EXPORT_DATA(PyDictIterValue_Type)
+EXPORT_DATA(PyDictKeys_Type)
+EXPORT_DATA(PyDictProxy_Type)
+EXPORT_DATA(PyDictRevIterItem_Type)
+EXPORT_DATA(PyDictRevIterKey_Type)
+EXPORT_DATA(PyDictRevIterValue_Type)
+EXPORT_DATA(PyDictValues_Type)
+EXPORT_DATA(PyEllipsis_Type)
+EXPORT_DATA(PyEnum_Type)
+EXPORT_DATA(PyExc_ArithmeticError)
+EXPORT_DATA(PyExc_AssertionError)
+EXPORT_DATA(PyExc_AttributeError)
+EXPORT_DATA(PyExc_BaseException)
+EXPORT_DATA(PyExc_BlockingIOError)
+EXPORT_DATA(PyExc_BrokenPipeError)
+EXPORT_DATA(PyExc_BufferError)
+EXPORT_DATA(PyExc_BytesWarning)
+EXPORT_DATA(PyExc_ChildProcessError)
+EXPORT_DATA(PyExc_ConnectionAbortedError)
+EXPORT_DATA(PyExc_ConnectionError)
+EXPORT_DATA(PyExc_ConnectionRefusedError)
+EXPORT_DATA(PyExc_ConnectionResetError)
+EXPORT_DATA(PyExc_DeprecationWarning)
+EXPORT_DATA(PyExc_EncodingWarning)
+EXPORT_DATA(PyExc_EnvironmentError)
+EXPORT_DATA(PyExc_EOFError)
+EXPORT_DATA(PyExc_Exception)
+EXPORT_DATA(PyExc_FileExistsError)
+EXPORT_DATA(PyExc_FileNotFoundError)
+EXPORT_DATA(PyExc_FloatingPointError)
+EXPORT_DATA(PyExc_FutureWarning)
+EXPORT_DATA(PyExc_GeneratorExit)
+EXPORT_DATA(PyExc_ImportError)
+EXPORT_DATA(PyExc_ImportWarning)
+EXPORT_DATA(PyExc_IndentationError)
+EXPORT_DATA(PyExc_IndexError)
+EXPORT_DATA(PyExc_InterruptedError)
+EXPORT_DATA(PyExc_IOError)
+EXPORT_DATA(PyExc_IsADirectoryError)
+EXPORT_DATA(PyExc_KeyboardInterrupt)
+EXPORT_DATA(PyExc_KeyError)
+EXPORT_DATA(PyExc_LookupError)
+EXPORT_DATA(PyExc_MemoryError)
+EXPORT_DATA(PyExc_ModuleNotFoundError)
+EXPORT_DATA(PyExc_NameError)
+EXPORT_DATA(PyExc_NotADirectoryError)
+EXPORT_DATA(PyExc_NotImplementedError)
+EXPORT_DATA(PyExc_OSError)
+EXPORT_DATA(PyExc_OverflowError)
+EXPORT_DATA(PyExc_PendingDeprecationWarning)
+EXPORT_DATA(PyExc_PermissionError)
+EXPORT_DATA(PyExc_ProcessLookupError)
+EXPORT_DATA(PyExc_RecursionError)
+EXPORT_DATA(PyExc_ReferenceError)
+EXPORT_DATA(PyExc_ResourceWarning)
+EXPORT_DATA(PyExc_RuntimeError)
+EXPORT_DATA(PyExc_RuntimeWarning)
+EXPORT_DATA(PyExc_StopAsyncIteration)
+EXPORT_DATA(PyExc_StopIteration)
+EXPORT_DATA(PyExc_SyntaxError)
+EXPORT_DATA(PyExc_SyntaxWarning)
+EXPORT_DATA(PyExc_SystemError)
+EXPORT_DATA(PyExc_SystemExit)
+EXPORT_DATA(PyExc_TabError)
+EXPORT_DATA(PyExc_TimeoutError)
+EXPORT_DATA(PyExc_TypeError)
+EXPORT_DATA(PyExc_UnboundLocalError)
+EXPORT_DATA(PyExc_UnicodeDecodeError)
+EXPORT_DATA(PyExc_UnicodeEncodeError)
+EXPORT_DATA(PyExc_UnicodeError)
+EXPORT_DATA(PyExc_UnicodeTranslateError)
+EXPORT_DATA(PyExc_UnicodeWarning)
+EXPORT_DATA(PyExc_UserWarning)
+EXPORT_DATA(PyExc_ValueError)
+EXPORT_DATA(PyExc_Warning)
+EXPORT_DATA(PyExc_WindowsError)
+EXPORT_DATA(PyExc_ZeroDivisionError)
+EXPORT_DATA(PyFilter_Type)
+EXPORT_DATA(PyFloat_Type)
+EXPORT_DATA(PyFrozenSet_Type)
+EXPORT_DATA(PyGetSetDescr_Type)
+EXPORT_DATA(PyList_Type)
+EXPORT_DATA(PyListIter_Type)
+EXPORT_DATA(PyListRevIter_Type)
+EXPORT_DATA(PyLong_Type)
+EXPORT_DATA(PyLongRangeIter_Type)
+EXPORT_DATA(PyMap_Type)
+EXPORT_DATA(PyMemberDescr_Type)
+EXPORT_DATA(PyMemoryView_Type)
+EXPORT_DATA(PyMethodDescr_Type)
+EXPORT_DATA(PyModule_Type)
+EXPORT_DATA(PyModuleDef_Type)
+EXPORT_DATA(PyOS_InputHook)
+EXPORT_DATA(PyProperty_Type)
+EXPORT_DATA(PyRange_Type)
+EXPORT_DATA(PyRangeIter_Type)
+EXPORT_DATA(PyReversed_Type)
+EXPORT_DATA(PySeqIter_Type)
+EXPORT_DATA(PySet_Type)
+EXPORT_DATA(PySetIter_Type)
+EXPORT_DATA(PySlice_Type)
+EXPORT_DATA(PySuper_Type)
+EXPORT_DATA(PyTraceBack_Type)
+EXPORT_DATA(PyTuple_Type)
+EXPORT_DATA(PyTupleIter_Type)
+EXPORT_DATA(PyType_Type)
+EXPORT_DATA(PyUnicode_Type)
+EXPORT_DATA(PyUnicodeIter_Type)
+EXPORT_DATA(PyWrapperDescr_Type)
+EXPORT_DATA(PyZip_Type)
diff --git a/PC/python_exe.rc b/PC/python_exe.rc
index ae0b029..c3d3bff 100644
--- a/PC/python_exe.rc
+++ b/PC/python_exe.rc
@@ -2,9 +2,14 @@
 
 #include "python_ver_rc.h"
 
+#ifndef RT_MANIFEST
+// bpo-45220: Cannot reliably #include RT_MANIFEST from
+// anywhere, so we hardcode it
+#define RT_MANIFEST 24
+#endif
+
 // Include the manifest file that indicates we support all
 // current versions of Windows.
-#include <winuser.h>
 1 RT_MANIFEST "python.manifest"
 
 1 ICON DISCARDABLE "icons\python.ico" 
diff --git a/PC/python_nt.rc b/PC/python_nt.rc
index b5fb58f..ae64fbd 100644
--- a/PC/python_nt.rc
+++ b/PC/python_nt.rc
@@ -2,9 +2,14 @@
 
 #include "python_ver_rc.h"
 
+#ifndef RT_MANIFEST
+// bpo-45220: Cannot reliably #include RT_MANIFEST from
+// anywhere, so we hardcode it
+#define RT_MANIFEST 24
+#endif
+
 // Include the manifest file that indicates we support all
 // current versions of Windows.
-#include <winuser.h>
 2 RT_MANIFEST "python.manifest"
 
 /////////////////////////////////////////////////////////////////////////////
diff --git a/PC/python_ver_rc.h b/PC/python_ver_rc.h
index 060aecd..e6c1d24 100644
--- a/PC/python_ver_rc.h
+++ b/PC/python_ver_rc.h
@@ -5,7 +5,7 @@
 #include "winver.h"
 
 #define PYTHON_COMPANY   "Python Software Foundation"
-#define PYTHON_COPYRIGHT "Copyright \xA9 2001-2016 Python Software Foundation. Copyright \xA9 2000 BeOpen.com. Copyright \xA9 1995-2001 CNRI. Copyright \xA9 1991-1995 SMC."
+#define PYTHON_COPYRIGHT "Copyright \xA9 2001-2022 Python Software Foundation. Copyright \xA9 2000 BeOpen.com. Copyright \xA9 1995-2001 CNRI. Copyright \xA9 1991-1995 SMC."
 
 #define MS_WINDOWS
 #include "modsupport.h"
diff --git a/PC/pythonw_exe.rc b/PC/pythonw_exe.rc
index 88bf359..38570b7 100644
--- a/PC/pythonw_exe.rc
+++ b/PC/pythonw_exe.rc
@@ -2,9 +2,14 @@
 
 #include "python_ver_rc.h"
 
+#ifndef RT_MANIFEST
+// bpo-45220: Cannot reliably #include RT_MANIFEST from
+// anywhere, so we hardcode it
+#define RT_MANIFEST 24
+#endif
+
 // Include the manifest file that indicates we support all
 // current versions of Windows.
-#include <winuser.h>
 1 RT_MANIFEST "python.manifest"
 
 1 ICON DISCARDABLE "icons\pythonw.ico" 
diff --git a/PC/sqlite3.rc b/PC/sqlite3.rc
index 84bd87d..9ae2aa0 100644
--- a/PC/sqlite3.rc
+++ b/PC/sqlite3.rc
@@ -2,9 +2,14 @@
 
 #include <winver.h>
 
+#ifndef RT_MANIFEST
+// bpo-45220: Cannot reliably #include RT_MANIFEST from
+// anywhere, so we hardcode it
+#define RT_MANIFEST 24
+#endif
+
 // Include the manifest file that indicates we support all
 // current versions of Windows.
-#include <winuser.h>
 2 RT_MANIFEST "python.manifest"
 
 /////////////////////////////////////////////////////////////////////////////
diff --git a/PC/store_info.txt b/PC/store_info.txt
index 8c20412..f6a85cb 100644
--- a/PC/store_info.txt
+++ b/PC/store_info.txt
@@ -82,7 +82,7 @@
 
 Python is an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but effective approach to object-oriented programming. Python’s elegant syntax and dynamic typing, together with its interpreted nature, make it an ideal language for scripting and rapid application development in many areas on most platforms.
 
-The Python interpreter and the extensive standard library are freely available in source or binary form for all major platforms from the Python Web site, https://www.python.org/, and may be freely distributed. The same site also contains distributions of and pointers to many free third party Python modules, programs and tools, and additional documentation.
+The Python interpreter and the extensive standard library are freely available in source or binary form for all major platforms from the Python web site, https://www.python.org/, and may be freely distributed. The same site also contains distributions of and pointers to many free third party Python modules, programs and tools, and additional documentation.
 
 The Python interpreter is easily extended with new functions and data types implemented in C or C++ (or other languages callable from C). Python is also suitable as an extension language for customizable applications.
 
diff --git a/PC/winreg.c b/PC/winreg.c
index 1305b70..004a89a 100644
--- a/PC/winreg.c
+++ b/PC/winreg.c
@@ -14,6 +14,7 @@
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
+#include "pycore_object.h"        // _PyObject_Init()
 #include "structmember.h"         // PyMemberDef
 #include <windows.h>
 
@@ -111,7 +112,7 @@
     HKEY hkey;
 } PyHKEYObject;
 
-#define PyHKEY_Check(op) ((op)->ob_type == &PyHKEY_Type)
+#define PyHKEY_Check(op) Py_IS_TYPE(op, &PyHKEY_Type)
 
 static char *failMsg = "bad operand type";
 
@@ -144,7 +145,7 @@
     PyHKEYObject *obkey = (PyHKEYObject *)ob;
     if (obkey->hkey)
         RegCloseKey((HKEY)obkey->hkey);
-    PyObject_DEL(ob);
+    PyObject_Free(ob);
 }
 
 static int
@@ -457,13 +458,12 @@
 PyObject *
 PyHKEY_FromHKEY(HKEY h)
 {
-    PyHKEYObject *op;
-
     /* Inline PyObject_New */
-    op = (PyHKEYObject *) PyObject_MALLOC(sizeof(PyHKEYObject));
-    if (op == NULL)
+    PyHKEYObject *op = (PyHKEYObject *) PyObject_Malloc(sizeof(PyHKEYObject));
+    if (op == NULL) {
         return PyErr_NoMemory();
-    PyObject_INIT(op, &PyHKEY_Type);
+    }
+    _PyObject_Init((PyObject*)op, &PyHKEY_Type);
     op->hkey = h;
     return (PyObject *)op;
 }
@@ -640,16 +640,25 @@
                 for (j = 0; j < i; j++)
                 {
                     PyObject *t;
-                    wchar_t *wstr;
                     Py_ssize_t len;
 
                     t = PyList_GET_ITEM(value, j);
                     if (!PyUnicode_Check(t))
                         return FALSE;
-                    wstr = PyUnicode_AsUnicodeAndSize(t, &len);
-                    if (wstr == NULL)
+#if USE_UNICODE_WCHAR_CACHE
+_Py_COMP_DIAG_PUSH
+_Py_COMP_DIAG_IGNORE_DEPR_DECLS
+                    len = PyUnicode_GetSize(t);
+                    if (len < 0)
                         return FALSE;
-                    size += Py_SAFE_DOWNCAST((len + 1) * sizeof(wchar_t),
+                    len++;
+_Py_COMP_DIAG_POP
+#else /* USE_UNICODE_WCHAR_CACHE */
+                    len = PyUnicode_AsWideChar(t, NULL, 0);
+                    if (len < 0)
+                        return FALSE;
+#endif /* USE_UNICODE_WCHAR_CACHE */
+                    size += Py_SAFE_DOWNCAST(len * sizeof(wchar_t),
                                              size_t, DWORD);
                 }
 
@@ -665,17 +674,18 @@
                 for (j = 0; j < i; j++)
                 {
                     PyObject *t;
-                    wchar_t *wstr;
                     Py_ssize_t len;
 
                     t = PyList_GET_ITEM(value, j);
-                    wstr = PyUnicode_AsUnicodeAndSize(t, &len);
-                    assert(wstr);
-                    wcscpy(P, wstr);
-                    P += (len + 1);
+                    assert(size > 0);
+                    len = PyUnicode_AsWideChar(t, P, size);
+                    assert(len >= 0);
+                    assert((unsigned)len < size);
+                    size -= (DWORD)len + 1;
+                    P += len + 1;
                 }
                 /* And doubly-terminate the list... */
-                *P = '\0';
+                *P = L'\0';
                 break;
             }
         case REG_BINARY:
@@ -693,7 +703,7 @@
                     PyErr_Format(PyExc_TypeError,
                         "Objects of type '%s' can not "
                         "be used as binary registry values",
-                        value->ob_type->tp_name);
+                        Py_TYPE(value)->tp_name);
                     return FALSE;
                 }
 
@@ -1669,7 +1679,7 @@
     type: DWORD
         An integer that specifies the type of the data.  Currently this must
         be REG_SZ, meaning only strings are supported.
-    value: Py_UNICODE(zeroes=True)
+    value as value_obj: unicode
         A string that specifies the new value.
     /
 
@@ -1688,30 +1698,51 @@
 
 static PyObject *
 winreg_SetValue_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key,
-                     DWORD type, const Py_UNICODE *value,
-                     Py_ssize_clean_t value_length)
-/*[clinic end generated code: output=686bedb1cbb4367b input=2cd2adab79339c53]*/
+                     DWORD type, PyObject *value_obj)
+/*[clinic end generated code: output=d4773dc9c372311a input=bf088494ae2d24fd]*/
 {
+    Py_ssize_t value_length;
     long rc;
 
     if (type != REG_SZ) {
         PyErr_SetString(PyExc_TypeError, "type must be winreg.REG_SZ");
         return NULL;
     }
-    if ((size_t)value_length >= PY_DWORD_MAX) {
+
+#if USE_UNICODE_WCHAR_CACHE
+_Py_COMP_DIAG_PUSH
+_Py_COMP_DIAG_IGNORE_DEPR_DECLS
+    const wchar_t *value = PyUnicode_AsUnicodeAndSize(value_obj, &value_length);
+_Py_COMP_DIAG_POP
+#else /* USE_UNICODE_WCHAR_CACHE */
+    wchar_t *value = PyUnicode_AsWideCharString(value_obj, &value_length);
+#endif /* USE_UNICODE_WCHAR_CACHE */
+    if (value == NULL) {
+        return NULL;
+    }
+    if ((Py_ssize_t)(DWORD)value_length != value_length) {
         PyErr_SetString(PyExc_OverflowError, "value is too long");
+#if !USE_UNICODE_WCHAR_CACHE
+        PyMem_Free(value);
+#endif /* USE_UNICODE_WCHAR_CACHE */
         return NULL;
     }
 
     if (PySys_Audit("winreg.SetValue", "nunu#",
                     (Py_ssize_t)key, sub_key, (Py_ssize_t)type,
                     value, value_length) < 0) {
+#if !USE_UNICODE_WCHAR_CACHE
+        PyMem_Free(value);
+#endif /* USE_UNICODE_WCHAR_CACHE */
         return NULL;
     }
 
     Py_BEGIN_ALLOW_THREADS
     rc = RegSetValueW(key, sub_key, REG_SZ, value, (DWORD)(value_length + 1));
     Py_END_ALLOW_THREADS
+#if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free(value);
+#endif /* USE_UNICODE_WCHAR_CACHE */
     if (rc != ERROR_SUCCESS)
         return PyErr_SetFromWindowsErrWithFunction(rc, "RegSetValue");
     Py_RETURN_NONE;
@@ -1782,12 +1813,13 @@
     if (PySys_Audit("winreg.SetValue", "nunO",
                     (Py_ssize_t)key, value_name, (Py_ssize_t)type,
                     value) < 0) {
+        PyMem_Free(data);
         return NULL;
     }
     Py_BEGIN_ALLOW_THREADS
     rc = RegSetValueExW(key, value_name, 0, type, data, len);
     Py_END_ALLOW_THREADS
-    PyMem_DEL(data);
+    PyMem_Free(data);
     if (rc != ERROR_SUCCESS)
         return PyErr_SetFromWindowsErrWithFunction(rc,
                                                    "RegSetValueEx");
diff --git a/PCbuild/Directory.Build.props b/PCbuild/Directory.Build.props
new file mode 100644
index 0000000..3d2fe55
--- /dev/null
+++ b/PCbuild/Directory.Build.props
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <!-- This is intentionally left blank but exists to avoid being imported from some directory above -->
+</Project>
diff --git a/PCbuild/Directory.Build.targets b/PCbuild/Directory.Build.targets
new file mode 100644
index 0000000..3d2fe55
--- /dev/null
+++ b/PCbuild/Directory.Build.targets
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <!-- This is intentionally left blank but exists to avoid being imported from some directory above -->
+</Project>
diff --git a/PCbuild/_decimal.vcxproj b/PCbuild/_decimal.vcxproj
index 4c71cdb..0916f1a 100644
--- a/PCbuild/_decimal.vcxproj
+++ b/PCbuild/_decimal.vcxproj
@@ -93,11 +93,11 @@
   </PropertyGroup>
   <ItemDefinitionGroup>
     <ClCompile>
-      <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;MASM;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PreprocessorDefinitions Condition="'$(Platform)' == 'Win32'">CONFIG_32;PPRO;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Platform)' == 'Win32'">CONFIG_32;PPRO;MASM;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions Condition="'$(Platform)'=='ARM'">CONFIG_32;ANSI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions Condition="'$(Platform)'=='ARM64'">CONFIG_64;ANSI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PreprocessorDefinitions Condition="'$(Platform)' == 'x64'">CONFIG_64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Platform)' == 'x64'">CONFIG_64;MASM;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>..\Modules\_decimal;..\Modules\_decimal\libmpdec;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
   </ItemDefinitionGroup>
diff --git a/PCbuild/_freeze_importlib.vcxproj b/PCbuild/_freeze_importlib.vcxproj
index a0fe49c..e437412 100644
--- a/PCbuild/_freeze_importlib.vcxproj
+++ b/PCbuild/_freeze_importlib.vcxproj
@@ -123,6 +123,11 @@
       <IntFile>$(IntDir)importlib_zipimport.g.h</IntFile>
       <OutFile>$(PySourcePath)Python\importlib_zipimport.h</OutFile>
     </None>
+    <None Include="..\Tools\freeze\flag.py">
+      <ModName>hello</ModName>
+      <IntFile>$(IntDir)frozen_hello.g.h</IntFile>
+      <OutFile>$(PySourcePath)Python\frozen_hello.h</OutFile>
+    </None>
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
@@ -130,20 +135,17 @@
   <Target Name="_RebuildImportLib">
     <Exec Command='"$(TargetPath)" "%(None.ModName)" "%(None.FullPath)" "%(None.IntFile)"' />
     
-    <PropertyGroup>
-      <_OldContent Condition="Exists($(OutTargetPath))"></_OldContent>
-      <_NewContent Condition="Exists($(IntTargetPath))">$([System.IO.File]::ReadAllText($(IntTargetPath)).Replace(`&#x0D;&#x0A;`, `&#x0A;`))</_NewContent>
-    </PropertyGroup>
-    
     <Copy SourceFiles="%(None.IntFile)"
           DestinationFiles="%(None.OutFile)"
           Condition="!Exists(%(None.OutFile)) or (Exists(%(None.IntFile)) and '$([System.IO.File]::ReadAllText(%(None.OutFile)).Replace(`&#x0D;&#x0A;`, `&#x0A;`))' != '$([System.IO.File]::ReadAllText(%(None.IntFile)).Replace(`&#x0D;&#x0A;`, `&#x0A;`))')">
       <Output TaskParameter="CopiedFiles" ItemName="_Updated" />
     </Copy>
-    
-    <Warning Text="@(_Updated->'%(Filename)%(Extension)',', ') updated. You will need to rebuild pythoncore to see the changes.%0D%0A%0D%0AIf you are not developing on Windows but you see this error on a continuous integration build, you need to run 'make regen-all' and commit any changes."
+
+    <Message Text="Updated files: @(_Updated->'%(Filename)%(Extension)',', ')"
+             Condition="'@(_Updated)' != ''" Importance="high" />
+    <Warning Text="Frozen importlib files were updated. Please rebuild to pick up the changes.%0D%0A%0D%0AIf you are not developing on Windows but you see this error on a continuous integration build, please run 'make regen-all' and commit anything that changes."
              Condition="'@(_Updated)' != '' and $(Configuration) == 'Debug'" />
-    <Error Text="@(_Updated->'%(Filename)%(Extension)',', ') updated. You will need to rebuild pythoncore to see the changes.%0D%0A%0D%0AIf you are not developing on Windows but you see this error on a continuous integration build, you need to run 'make regen-all' and commit any changes."
+    <Error Text="Frozen importlib files were updated. Please rebuild to pick up the changes.%0D%0A%0D%0AIf you are not developing on Windows but you see this error on a continuous integration build, please run 'make regen-all' and commit anything that changes."
            Condition="'@(_Updated)' != '' and $(Configuration) == 'Release'" />
   </Target>
   <Target Name="RebuildImportLib" AfterTargets="AfterBuild" Condition="$(Configuration) == 'Debug' or $(Configuration) == 'Release'"
@@ -151,9 +153,7 @@
   </Target>
   <Target Name="_CleanImportLib" BeforeTargets="CoreClean">
     <ItemGroup>
-      <Clean Include="$(IntDir)importlib.g.h" />
-      <Clean Include="$(IntDir)importlib_external.g.h" />
-      <Clean Include="$(IntDir)importlib_zipimport.g.h" />
+      <Clean Include="%(None.IntFile)" />
     </ItemGroup>
   </Target>
 </Project>
diff --git a/PCbuild/_sqlite3.vcxproj b/PCbuild/_sqlite3.vcxproj
index 7e00626..5eb8559 100644
--- a/PCbuild/_sqlite3.vcxproj
+++ b/PCbuild/_sqlite3.vcxproj
@@ -94,7 +94,6 @@
   <ItemDefinitionGroup>
     <ClCompile>
       <AdditionalIncludeDirectories>$(sqlite3Dir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>MODULE_NAME="sqlite3";%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
   </ItemDefinitionGroup>
   <ItemGroup>
diff --git a/PCbuild/blurb.bat b/PCbuild/blurb.bat
new file mode 100644
index 0000000..0be228a
--- /dev/null
+++ b/PCbuild/blurb.bat
@@ -0,0 +1,28 @@
+@echo off
+rem
+rem Runs the blurb tool. If necessary, will install Python and/or blurb.
+rem
+rem Pass "--update"/"-U" as the first argument to update blurb.
+rem
+
+call "%~dp0find_python.bat" %PYTHON%
+if ERRORLEVEL 1 (echo Cannot locate python.exe on PATH or as PYTHON variable & exit /b 3)
+
+if "%1" EQU "--update" (%PYTHON% -m pip install -U blurb && shift)
+if "%1" EQU "-U" (%PYTHON% -m pip install -U blurb && shift)
+
+%PYTHON% -m blurb %1 %2 %3 %4 %5 %6 %7 %8 %9
+if ERRORLEVEL 1 goto :install_and_retry
+exit /B 0
+
+:install_and_retry
+rem Before reporting the error, make sure that blurb is actually installed.
+rem If not, install it first and try again.
+set _ERR=%ERRORLEVEL%
+%PYTHON% -c "import blurb"
+if NOT ERRORLEVEL 1 exit /B %_ERR%
+echo Installing blurb...
+%PYTHON% -m pip install blurb
+if ERRORLEVEL 1 exit /B %ERRORLEVEL%
+%PYTHON% -m blurb %*
+exit /B
diff --git a/PCbuild/build.bat b/PCbuild/build.bat
index 5a41ca5..d333cea 100644
--- a/PCbuild/build.bat
+++ b/PCbuild/build.bat
@@ -34,7 +34,7 @@
 echo.  --pgo          Build with Profile-Guided Optimization.  This flag
 echo.                 overrides -c and -d
 echo.  --test-marker  Enable the test marker within the build.
-echo.  --regen        Regenerate all opcodes, grammar and tokens
+echo.  --regen        Regenerate all opcodes, grammar and tokens.
 echo.
 echo.Available flags to avoid building certain modules.
 echo.These flags have no effect if '-e' is not given:
@@ -116,8 +116,14 @@
 call "%dir%find_msbuild.bat" %MSBUILD%
 if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2)
 
+call "%dir%find_python.bat" %PYTHON%
+if ERRORLEVEL 1 (echo Cannot locate python.exe on PATH or as PYTHON variable & exit /b 3)
+set PythonForBuild=%PYTHON%
+
 if "%kill%"=="true" call :Kill
-if ERRORLEVEL 1 exit /B 3
+if ERRORLEVEL 1 exit /B %ERRORLEVEL%
+
+if "%regen%"=="true" goto :Regen
 
 if "%do_pgo%"=="true" (
     set conf=PGInstrument
@@ -147,6 +153,15 @@
 @echo off
 exit /B %ERRORLEVEL%
 
+:Regen
+echo on
+%MSBUILD% "%dir%\pythoncore.vcxproj" /t:Regen %verbose%^
+ /p:Configuration=%conf% /p:Platform=%platf%^
+ /p:ForceRegen=true
+
+@echo off
+exit /B %ERRORLEVEL%
+
 :Build
 rem Call on MSBuild to do the work, echo the command.
 rem Passing %1-9 is not the preferred option, but argument parsing in
@@ -160,14 +175,6 @@
  /p:UseTestMarker=%UseTestMarker% %GITProperty%^
  %1 %2 %3 %4 %5 %6 %7 %8 %9
 
-@if not ERRORLEVEL 1 @if "%Regen%"=="true" (
-    %MSBUILD% "%dir%regen.vcxproj" /t:%target% %parallel% %verbose%^
-     /p:IncludeExternals=%IncludeExternals%^
-     /p:Configuration=%conf% /p:Platform=%platf%^
-     /p:UseTestMarker=%UseTestMarker% %GITProperty%^
-     %1 %2 %3 %4 %5 %6 %7 %8 %9
-)
-
 @echo off
 exit /b %ERRORLEVEL%
 
diff --git a/PCbuild/find_python.bat b/PCbuild/find_python.bat
index 75413cd..d0e4a86 100644
--- a/PCbuild/find_python.bat
+++ b/PCbuild/find_python.bat
@@ -34,10 +34,10 @@
 @if exist "%_Py_EXTERNALS_DIR%\pythonx86\tools\python.exe" (set PYTHON="%_Py_EXTERNALS_DIR%\pythonx86\tools\python.exe") & (set _Py_Python_Source=found in externals directory) & goto :found
 
 @rem If HOST_PYTHON is recent enough, use that
-@if NOT "%HOST_PYTHON%"=="" @%HOST_PYTHON% -Ec "import sys; assert sys.version_info[:2] >= (3, 6)" >nul 2>nul && (set PYTHON="%HOST_PYTHON%") && (set _Py_Python_Source=found as HOST_PYTHON) && goto :found
+@if NOT "%HOST_PYTHON%"=="" @%HOST_PYTHON% -Ec "import sys; assert sys.version_info[:2] >= (3, 8)" >nul 2>nul && (set PYTHON="%HOST_PYTHON%") && (set _Py_Python_Source=found as HOST_PYTHON) && goto :found
 
 @rem If py.exe finds a recent enough version, use that one
-@for %%p in (3.8 3.7 3.6) do @py -%%p -EV >nul 2>&1 && (set PYTHON=py -%%p) && (set _Py_Python_Source=found %%p with py.exe) && goto :found
+@for %%p in (3.9 3.8) do @py -%%p -EV >nul 2>&1 && (set PYTHON=py -%%p) && (set _Py_Python_Source=found %%p with py.exe) && goto :found
 
 @if NOT exist "%_Py_EXTERNALS_DIR%" mkdir "%_Py_EXTERNALS_DIR%"
 @set _Py_NUGET=%NUGET%
diff --git a/PCbuild/get_external.py b/PCbuild/get_external.py
index a682d38..4ecc892 100755
--- a/PCbuild/get_external.py
+++ b/PCbuild/get_external.py
@@ -3,6 +3,8 @@
 import argparse
 import os
 import pathlib
+import sys
+import time
 import zipfile
 from urllib.request import urlretrieve
 
@@ -53,7 +55,22 @@
         verbose=args.verbose,
     )
     final_name = args.externals_dir / args.tag
-    extract_zip(args.externals_dir, zip_path).replace(final_name)
+    extracted = extract_zip(args.externals_dir, zip_path)
+    for wait in [1, 2, 3, 5, 8, 0]:
+        try:
+            extracted.replace(final_name)
+            break
+        except PermissionError as ex:
+            retry = f" Retrying in {wait}s..." if wait else ""
+            print(f"Encountered permission error '{ex}'.{retry}", file=sys.stderr)
+            time.sleep(wait)
+    else:
+        print(
+            f"ERROR: Failed to extract {final_name}.",
+            "You may need to restart your build",
+            file=sys.stderr,
+        )
+        sys.exit(1)
 
 
 if __name__ == '__main__':
diff --git a/PCbuild/get_externals.bat b/PCbuild/get_externals.bat
index 3bb2819..7129898 100644
--- a/PCbuild/get_externals.bat
+++ b/PCbuild/get_externals.bat
@@ -51,12 +51,12 @@
 echo.Fetching external libraries...
 
 set libraries=
-set libraries=%libraries%                                       bzip2-1.0.6
-if NOT "%IncludeLibffiSrc%"=="false" set libraries=%libraries%  libffi
-if NOT "%IncludeSSLSrc%"=="false" set libraries=%libraries%     openssl-1.1.1g
-set libraries=%libraries%                                       sqlite-3.33.0.0
-if NOT "%IncludeTkinterSrc%"=="false" set libraries=%libraries% tcl-core-8.6.9.0
-if NOT "%IncludeTkinterSrc%"=="false" set libraries=%libraries% tk-8.6.9.0
+set libraries=%libraries%                                       bzip2-1.0.8
+if NOT "%IncludeLibffiSrc%"=="false" set libraries=%libraries%  libffi-3.3.0
+if NOT "%IncludeSSLSrc%"=="false" set libraries=%libraries%     openssl-1.1.1n
+set libraries=%libraries%                                       sqlite-3.37.2.0
+if NOT "%IncludeTkinterSrc%"=="false" set libraries=%libraries% tcl-core-8.6.12.0
+if NOT "%IncludeTkinterSrc%"=="false" set libraries=%libraries% tk-8.6.12.0
 if NOT "%IncludeTkinterSrc%"=="false" set libraries=%libraries% tix-8.4.3.6
 set libraries=%libraries%                                       xz-5.2.2
 set libraries=%libraries%                                       zlib-1.2.11
@@ -76,9 +76,9 @@
 echo.Fetching external binaries...
 
 set binaries=
-if NOT "%IncludeLibffi%"=="false"  set binaries=%binaries% libffi
-if NOT "%IncludeSSL%"=="false"     set binaries=%binaries% openssl-bin-1.1.1g
-if NOT "%IncludeTkinter%"=="false" set binaries=%binaries% tcltk-8.6.9.0
+if NOT "%IncludeLibffi%"=="false"  set binaries=%binaries% libffi-3.3.0
+if NOT "%IncludeSSL%"=="false"     set binaries=%binaries% openssl-bin-1.1.1n
+if NOT "%IncludeTkinter%"=="false" set binaries=%binaries% tcltk-8.6.12.0
 if NOT "%IncludeSSLSrc%"=="false"  set binaries=%binaries% nasm-2.11.06
 
 for %%b in (%binaries%) do (
diff --git a/PCbuild/lib.pyproj b/PCbuild/lib.pyproj
index f0c51ed..c826ffa 100644
--- a/PCbuild/lib.pyproj
+++ b/PCbuild/lib.pyproj
@@ -162,7 +162,6 @@
     <Compile Include="distutils\command\bdist_dumb.py" />
     <Compile Include="distutils\command\bdist_msi.py" />
     <Compile Include="distutils\command\bdist_rpm.py" />
-    <Compile Include="distutils\command\bdist_wininst.py" />
     <Compile Include="distutils\command\build.py" />
     <Compile Include="distutils\command\build_clib.py" />
     <Compile Include="distutils\command\build_ext.py" />
@@ -204,7 +203,6 @@
     <Compile Include="distutils\tests\test_bdist_dumb.py" />
     <Compile Include="distutils\tests\test_bdist_msi.py" />
     <Compile Include="distutils\tests\test_bdist_rpm.py" />
-    <Compile Include="distutils\tests\test_bdist_wininst.py" />
     <Compile Include="distutils\tests\test_build.py" />
     <Compile Include="distutils\tests\test_build_clib.py" />
     <Compile Include="distutils\tests\test_build_ext.py" />
@@ -1196,6 +1194,7 @@
     <Compile Include="test\test_nntplib.py" />
     <Compile Include="test\test_ntpath.py" />
     <Compile Include="test\test_numeric_tower.py" />
+    <Compile Include="test\test_opcache.py" />
     <Compile Include="test\test_opcodes.py" />
     <Compile Include="test\test_openpty.py" />
     <Compile Include="test\test_operator.py" />
@@ -1430,7 +1429,6 @@
     <Compile Include="tkinter\messagebox.py" />
     <Compile Include="tkinter\scrolledtext.py" />
     <Compile Include="tkinter\simpledialog.py" />
-    <Compile Include="tkinter\test\runtktests.py" />
     <Compile Include="tkinter\test\support.py" />
     <Compile Include="tkinter\test\test_tkinter\test_font.py" />
     <Compile Include="tkinter\test\test_tkinter\test_geometry_managers.py" />
@@ -1442,7 +1440,6 @@
     <Compile Include="tkinter\test\test_tkinter\test_widgets.py" />
     <Compile Include="tkinter\test\test_tkinter\__init__.py" />
     <Compile Include="tkinter\test\test_ttk\test_extensions.py" />
-    <Compile Include="tkinter\test\test_ttk\test_functions.py" />
     <Compile Include="tkinter\test\test_ttk\test_style.py" />
     <Compile Include="tkinter\test\test_ttk\test_widgets.py" />
     <Compile Include="tkinter\test\test_ttk\__init__.py" />
@@ -1572,7 +1569,6 @@
     <Compile Include="zoneinfo\__init__.py" />
     <Compile Include="zoneinfo\_tzpath.py" />
     <Compile Include="zoneinfo\_zoneinfo.py" />
-    <Compile Include="_bootlocale.py" />
     <Compile Include="_collections_abc.py" />
     <Compile Include="_compat_pickle.py" />
     <Compile Include="_compression.py" />
diff --git a/PCbuild/pcbuild.proj b/PCbuild/pcbuild.proj
index 4d416c5..8e7088d 100644
--- a/PCbuild/pcbuild.proj
+++ b/PCbuild/pcbuild.proj
@@ -66,6 +66,7 @@
     <!-- Test modules -->
     <TestModules Include="_ctypes_test;_testbuffer;_testcapi;_testinternalcapi;_testembed;_testimportmultiple;_testmultiphase;_testconsole" />
     <TestModules Include="xxlimited" Condition="'$(Configuration)' == 'Release'" />
+    <TestModules Include="xxlimited_35" Condition="'$(Configuration)' == 'Release'" />
     <Projects Include="@(TestModules->'%(Identity).vcxproj')" Condition="$(IncludeTests)">
       <!-- Disable parallel build for test modules -->
       <BuildInParallel>false</BuildInParallel>
diff --git a/PCbuild/pcbuild.sln b/PCbuild/pcbuild.sln
index 4b6dc1e..3507b97 100644
--- a/PCbuild/pcbuild.sln
+++ b/PCbuild/pcbuild.sln
@@ -53,8 +53,6 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pyexpat", "pyexpat.vcxproj", "{D06B6426-4762-44CC-8BAD-D79052507F2F}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bdist_wininst", "..\PC\bdist_wininst\bdist_wininst.vcxproj", "{EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}"
-EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_hashlib", "_hashlib.vcxproj", "{447F05A8-F581-4CAC-A466-5AC7936E207E}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sqlite3", "sqlite3.vcxproj", "{A1A295E5-463C-437F-81CA-1F32367685DA}"
diff --git a/PCbuild/prepare_libffi.bat b/PCbuild/prepare_libffi.bat
index 922a475..7e7842a 100644
--- a/PCbuild/prepare_libffi.bat
+++ b/PCbuild/prepare_libffi.bat
@@ -38,6 +38,7 @@
 set BUILD_ARM64=
 set BUILD_PDB=
 set BUILD_NOOPT=
+set COPY_LICENSE=
 set INSTALL_CYGWIN=
 
 :CheckOpts
@@ -49,6 +50,7 @@
 if /I "%1"=="-arm64" (set BUILD_ARM64=1) & shift & goto :CheckOpts
 if /I "%1"=="-pdb" (set BUILD_PDB=-g) & shift & goto :CheckOpts
 if /I "%1"=="-noopt" (set BUILD_NOOPT=CFLAGS='-Od -warn all') & shift & goto :CheckOpts
+if /I "%1"=="-license" (set COPY_LICENSE=1) & shift & goto :CheckOpts
 if /I "%1"=="-?" goto :Usage
 if /I "%1"=="--install-cygwin" (set INSTALL_CYGWIN=1) & shift & goto :CheckOpts
 goto :Usage
@@ -60,6 +62,7 @@
     set BUILD_X86=1
     set BUILD_ARM32=1
     set BUILD_ARM64=1
+    set COPY_LICENSE=1
 )
 
 if "%INSTALL_CYGWIN%"=="1" call :InstallCygwin
@@ -98,9 +101,14 @@
 )
 
 if "%BUILD_X64%"=="1" call :BuildOne x64 x86_64-w64-cygwin x86_64-w64-cygwin
+if errorlevel 1 exit /B %ERRORLEVEL%
 if "%BUILD_X86%"=="1" call :BuildOne x86 i686-pc-cygwin i686-pc-cygwin
+if errorlevel 1 exit /B %ERRORLEVEL%
 if "%BUILD_ARM32%"=="1" call :BuildOne x86_arm i686-pc-cygwin arm-w32-cygwin
+if errorlevel 1 exit /B %ERRORLEVEL%
 if "%BUILD_ARM64%"=="1" call :BuildOne x86_arm64 i686-pc-cygwin aarch64-w64-cygwin
+if errorlevel 1 exit /B %ERRORLEVEL%
+if "%COPY_LICENSE%"=="1" copy /y "%LIBFFI_SOURCE%\LICENSE" "%LIBFFI_OUT%\LICENSE"
 
 popd
 endlocal
@@ -179,11 +187,11 @@
 
 echo copying files to %_LIBFFI_OUT%
 if not exist %_LIBFFI_OUT%\include (md %_LIBFFI_OUT%\include)
-copy %ARTIFACTS%\.libs\libffi-7.dll %_LIBFFI_OUT%
-copy %ARTIFACTS%\.libs\libffi-7.lib %_LIBFFI_OUT%
-copy %ARTIFACTS%\.libs\libffi-7.pdb %_LIBFFI_OUT%
-copy %ARTIFACTS%\fficonfig.h %_LIBFFI_OUT%\include
-copy %ARTIFACTS%\include\*.h %_LIBFFI_OUT%\include
+copy %ARTIFACTS%\.libs\libffi-*.dll %_LIBFFI_OUT% || exit /B 1
+copy %ARTIFACTS%\.libs\libffi-*.lib %_LIBFFI_OUT% || exit /B 1
+copy %ARTIFACTS%\.libs\libffi-*.pdb %_LIBFFI_OUT%
+copy %ARTIFACTS%\fficonfig.h %_LIBFFI_OUT%\include || exit /B 1
+copy %ARTIFACTS%\include\*.h %_LIBFFI_OUT%\include || exit /B 1
 
 endlocal
 exit /b
diff --git a/PCbuild/pyproject.props b/PCbuild/pyproject.props
index d7762ca..d492b71 100644
--- a/PCbuild/pyproject.props
+++ b/PCbuild/pyproject.props
@@ -44,10 +44,11 @@
       <CompileAs>Default</CompileAs>
       <SuppressStartupBanner>true</SuppressStartupBanner>
       <WholeProgramOptimization>true</WholeProgramOptimization>
-      <InlineFunctionExpansion Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">OnlyExplicitInline</InlineFunctionExpansion>
-      <InlineFunctionExpansion Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">OnlyExplicitInline</InlineFunctionExpansion>
+      <ControlFlowGuard Condition="$(EnableControlFlowGuard) != ''">$(EnableControlFlowGuard)</ControlFlowGuard>
+      <AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
     </ClCompile>
     <ClCompile Condition="$(Configuration) == 'Debug'">
+      <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
       <Optimization>Disabled</Optimization>
       <WholeProgramOptimization>false</WholeProgramOptimization>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@@ -73,6 +74,7 @@
       <LinkTimeCodeGeneration Condition="$(SupportPGO) and $(Configuration) == 'PGInstrument'">PGInstrument</LinkTimeCodeGeneration>
       <LinkTimeCodeGeneration Condition="$(SupportPGO) and $(Configuration) == 'PGUpdate'">PGUpdate</LinkTimeCodeGeneration>
       <AdditionalDependencies>advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalOptions Condition="$(Configuration) != 'Debug'">/OPT:REF,NOICF %(AdditionalOptions)</AdditionalOptions>
     </Link>
     <Lib>
       <LinkTimeCodeGeneration Condition="$(Configuration) == 'Release'">true</LinkTimeCodeGeneration>
diff --git a/PCbuild/pyshellext.vcxproj b/PCbuild/pyshellext.vcxproj
index 655054e..ea432d6 100644
--- a/PCbuild/pyshellext.vcxproj
+++ b/PCbuild/pyshellext.vcxproj
@@ -96,7 +96,7 @@
     <Link>
       <AdditionalDependencies>version.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <SubSystem>Console</SubSystem>
-      <ModuleDefinitionFile>..\PC\pyshellext$(PyDebugExt).def</ModuleDefinitionFile>
+      <ModuleDefinitionFile>..\PC\pyshellext.def</ModuleDefinitionFile>
     </Link>
     <Midl>
       <CompileInterface>true</CompileInterface>
@@ -104,11 +104,9 @@
   </ItemDefinitionGroup>
   <ItemGroup>
     <ClCompile Include="..\PC\pyshellext.cpp" />
-    <Midl Include="..\PC\pyshellext.idl" />
   </ItemGroup>
   <ItemGroup>
     <None Include="..\PC\pyshellext.def" />
-    <None Include="..\PC\pyshellext_d.def" />
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="..\PC\pyshellext.rc" />
diff --git a/PCbuild/pyshellext.vcxproj.filters b/PCbuild/pyshellext.vcxproj.filters
index 36d1d16..77cd306 100644
--- a/PCbuild/pyshellext.vcxproj.filters
+++ b/PCbuild/pyshellext.vcxproj.filters
@@ -16,11 +16,6 @@
     </ClCompile>
   </ItemGroup>
   <ItemGroup>
-    <Midl Include="..\PC\pyshellext.idl">
-      <Filter>Source Files</Filter>
-    </Midl>
-  </ItemGroup>
-  <ItemGroup>
     <ResourceCompile Include="..\PC\pyshellext.rc">
       <Filter>Resource Files</Filter>
     </ResourceCompile>
@@ -29,8 +24,5 @@
     <None Include="..\PC\pyshellext.def">
       <Filter>Source Files</Filter>
     </None>
-    <None Include="..\PC\pyshellext_d.def">
-      <Filter>Source Files</Filter>
-    </None>
   </ItemGroup>
 </Project>
\ No newline at end of file
diff --git a/PCbuild/python.props b/PCbuild/python.props
index acc41a2..7a11cfa 100644
--- a/PCbuild/python.props
+++ b/PCbuild/python.props
@@ -11,7 +11,8 @@
 
     We set BasePlatformToolset for ICC's benefit, it's otherwise ignored.
     -->
-    <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and ('$(MSBuildToolsVersion)' == '16.0' or '$(VisualStudioVersion)' == '16.0')">v142</BasePlatformToolset>
+    <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and '$(VisualStudioVersion)' == '17.0'">v142</BasePlatformToolset>
+    <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and '$(VisualStudioVersion)' == '16.0'">v142</BasePlatformToolset>
     <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and ('$(MSBuildToolsVersion)' == '15.0' or '$(VisualStudioVersion)' == '15.0')">v141</BasePlatformToolset>
     <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and '$(VCTargetsPath14)' != ''">v140</BasePlatformToolset>
     <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and '$(VCTargetsPath12)' != ''">v120</BasePlatformToolset>
@@ -56,14 +57,14 @@
     <ExternalsDir>$(EXTERNALS_DIR)</ExternalsDir>
     <ExternalsDir Condition="$(ExternalsDir) == ''">$([System.IO.Path]::GetFullPath(`$(PySourcePath)externals`))</ExternalsDir>
     <ExternalsDir Condition="!HasTrailingSlash($(ExternalsDir))">$(ExternalsDir)\</ExternalsDir>
-    <sqlite3Dir>$(ExternalsDir)sqlite-3.33.0.0\</sqlite3Dir>
-    <bz2Dir>$(ExternalsDir)bzip2-1.0.6\</bz2Dir>
+    <sqlite3Dir>$(ExternalsDir)sqlite-3.37.2.0\</sqlite3Dir>
+    <bz2Dir>$(ExternalsDir)bzip2-1.0.8\</bz2Dir>
     <lzmaDir>$(ExternalsDir)xz-5.2.2\</lzmaDir>
-    <libffiDir>$(ExternalsDir)libffi\</libffiDir>
-    <libffiOutDir>$(ExternalsDir)libffi\$(ArchName)\</libffiOutDir>
+    <libffiDir>$(ExternalsDir)libffi-3.3.0\</libffiDir>
+    <libffiOutDir>$(ExternalsDir)libffi-3.3.0\$(ArchName)\</libffiOutDir>
     <libffiIncludeDir>$(libffiOutDir)include</libffiIncludeDir>
-    <opensslDir>$(ExternalsDir)openssl-1.1.1g\</opensslDir>
-    <opensslOutDir>$(ExternalsDir)openssl-bin-1.1.1g\$(ArchName)\</opensslOutDir>
+    <opensslDir>$(ExternalsDir)openssl-1.1.1n\</opensslDir>
+    <opensslOutDir>$(ExternalsDir)openssl-bin-1.1.1n\$(ArchName)\</opensslOutDir>
     <opensslIncludeDir>$(opensslOutDir)include</opensslIncludeDir>
     <nasmDir>$(ExternalsDir)\nasm-2.11.06\</nasmDir>
     <zlibDir>$(ExternalsDir)\zlib-1.2.11\</zlibDir>
@@ -108,9 +109,18 @@
 
     <!-- The minimum allowed SDK version to use for building -->
     <DefaultWindowsSDKVersion>10.0.10586.0</DefaultWindowsSDKVersion>
-    <DefaultWindowsSDKVersion Condition="$([System.Version]::Parse($(_RegistryVersion))) > $([System.Version]::Parse($(DefaultWindowsSDKVersion)))">$(_RegistryVersion)</DefaultWindowsSDKVersion>
+    <DefaultWindowsSDKVersion Condition="$(_RegistryVersion) != '' and $([System.Version]::Parse($(_RegistryVersion))) > $([System.Version]::Parse($(DefaultWindowsSDKVersion)))">$(_RegistryVersion)</DefaultWindowsSDKVersion>
   </PropertyGroup>
-  
+
+  <Target Name="_CheckWindowsSDKFound" BeforeTargets="_CheckWindowsSDKInstalled" Condition="$(_RegistryVersion) == ''">
+    <PropertyGroup>
+      <_Message>Failed to locate a Windows SDK installation.</_Message>
+      <_Message>$(_Message) If the build fails, please use the Visual Studio Installer to install the Windows SDK.</_Message>
+      <_Message>$(_Message) (Ignore the version number specified in the error message and select the latest.)</_Message>
+    </PropertyGroup>
+    <Warning Text="$(_Message)" />
+  </Target>
+
   <PropertyGroup Condition="$(WindowsTargetPlatformVersion) == ''">
     <WindowsTargetPlatformVersion>$(DefaultWindowsSDKVersion)</WindowsTargetPlatformVersion>
   </PropertyGroup>
@@ -175,7 +185,7 @@
     <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'b'">11</ReleaseLevelNumber>
     <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'rc'">12</ReleaseLevelNumber>
   </PropertyGroup>
-  
+
   <PropertyGroup>
     <PythonVersionNumber>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)</PythonVersionNumber>
     <PythonVersion>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)$(ReleaseLevelName)</PythonVersion>
diff --git a/PCbuild/python.vcxproj b/PCbuild/python.vcxproj
index 2094420..b58945a 100644
--- a/PCbuild/python.vcxproj
+++ b/PCbuild/python.vcxproj
@@ -114,7 +114,9 @@
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
+    <Import Project="regen.targets" />
   </ImportGroup>
+  <Target Name="_TriggerPostRegen" AfterTargets="Build" DependsOnTargets="PostBuildRegen" />
   <Target Name="ValidateUcrtbase" AfterTargets="AfterBuild" Condition="$(Configuration) != 'PGInstrument' and $(Platform) != 'ARM' and $(Platform) != 'ARM64'">
     <PropertyGroup>
       <UcrtName>ucrtbase</UcrtName>
@@ -145,23 +147,4 @@
     </PropertyGroup>
     <WriteLinesToFile File="$(PySourcePath)python.bat" Lines="$(_Content)" Overwrite="true" Condition="'$(_Content)' != '$(_ExistingContent)'" />
   </Target>
-  <Target Name="GenerateLicense" AfterTargets="AfterBuild">
-    <ItemGroup>
-      <LicenseFiles Include="$(PySourcePath)LICENSE;
-                             $(PySourcePath)PC\crtlicense.txt;
-                             $(bz2Dir)LICENSE;
-                             $(opensslOutDir)LICENSE;
-                             $(libffiDir)LICENSE;" />
-      <LicenseFiles Include="$(tcltkDir)tcllicense.terms;
-                             $(tcltkDir)tklicense.terms;
-                             $(tcltkDir)tixlicense.terms" Condition="$(IncludeTkinter)" />
-      <_LicenseFiles Include="@(LicenseFiles)">
-        <Content Condition="Exists(%(FullPath))">$([System.IO.File]::ReadAllText(%(FullPath)))</Content>
-      </_LicenseFiles>
-    </ItemGroup>
-
-    <WriteLinesToFile File="$(OutDir)LICENSE.txt"
-                      Overwrite="true"
-                      Lines="@(_LicenseFiles->'%(Content)')" />
-  </Target>
 </Project>
diff --git a/PCbuild/python3dll.vcxproj b/PCbuild/python3dll.vcxproj
index ef344be..ec22e6f 100644
--- a/PCbuild/python3dll.vcxproj
+++ b/PCbuild/python3dll.vcxproj
@@ -88,32 +88,17 @@
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup>
     <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
-    <_Machine>X86</_Machine>
-    <_Machine Condition="$(Platform) == 'x64'">X64</_Machine>
-    <_Machine Condition="$(Platform) == 'ARM'">ARM</_Machine>
-    <_Machine Condition="$(Platform) == 'ARM64'">ARM64</_Machine>
-    <ExtensionsToDeleteOnClean>$(ExtensionsToDeleteOnClean);$(IntDir)python3_d.def;$(IntDir)python3stub.def</ExtensionsToDeleteOnClean>
   </PropertyGroup>
   <ItemDefinitionGroup>
     <ClCompile>
+      <PreprocessorDefinitions>PYTHON_DLL_NAME="$(PyDllName)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <BufferSecurityCheck>false</BufferSecurityCheck>
     </ClCompile>
     <Link>
-      <AdditionalDependencies>$(OutDir)$(TargetName)stub.lib</AdditionalDependencies>
-      <ModuleDefinitionFile Condition="$(Configuration) != 'Debug'">$(PySourcePath)PC\python3.def</ModuleDefinitionFile>
-      <ModuleDefinitionFile Condition="$(Configuration) == 'Debug'">$(IntDir)python3_d.def</ModuleDefinitionFile>
-      <EntryPointSymbol>DllMain</EntryPointSymbol>
+      <NoEntryPoint>true</NoEntryPoint>
     </Link>
-    <PreLinkEvent>
-      <Command>lib /nologo /def:"$(IntDir)python3stub.def" /out:"$(OutDir)$(TargetName)stub.lib" /MACHINE:$(_Machine)</Command>
-      <Message>Rebuilding $(TargetName)stub.lib</Message>
-      <Outputs>$(OutDir)$(TargetName)stub.lib</Outputs>
-    </PreLinkEvent>
   </ItemDefinitionGroup>
   <ItemGroup>
-    <None Include="..\PC\python3.def" />
-  </ItemGroup>
-  <ItemGroup>
     <ClCompile Include="..\PC\python3dll.c" />
   </ItemGroup>
   <ItemGroup>
@@ -122,62 +107,4 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
-  
-  <Target Name="BuildPython3_dDef" BeforeTargets="BuildStubDef" Condition="$(Configuration) == 'Debug'">
-    <ItemGroup>
-      <_DefLines Remove="@(_DefLines)" />
-      <_Lines Remove="@(_Lines)" />
-      <_OriginalLines Remove="@(_OriginalLines)" />
-    </ItemGroup>
-    <ReadLinesFromFile File="..\PC\python3.def">
-      <Output TaskParameter="Lines" ItemName="_DefLines" />
-    </ReadLinesFromFile>
-    <ReadLinesFromFile File="$(IntDir)python3_d.def" Condition="Exists('$(IntDir)python3_d.def')">
-      <Output TaskParameter="Lines" ItemName="_OriginalLines" />
-    </ReadLinesFromFile>
-    <PropertyGroup>
-      <_Pattern1>(=python$(MajorVersionNumber)$(MinorVersionNumber))\.</_Pattern1>
-      <_Sub1>$1_d.</_Sub1>
-      <_Pattern2>"python3"</_Pattern2>
-      <_Sub2>"python3_d"</_Sub2>
-    </PropertyGroup>
-    <ItemGroup>
-      <_Lines Include="@(_DefLines)">
-        <New>$([System.Text.RegularExpressions.Regex]::Replace($([System.Text.RegularExpressions.Regex]::Replace(`%(Identity)`, `$(_Pattern1)`, `$(_Sub1)`)), `$(_Pattern2)`, `$(_Sub2)`))</New>
-      </_Lines>
-    </ItemGroup>
-    <MakeDir Directories="$(IntDir)" />
-    <Message Text="Updating python3_d.def" Condition="@(_Lines->'%(New)') != @(_OriginalLines)" Importance="high" />
-    <WriteLinesToFile File="$(IntDir)python3_d.def" Lines="@(_Lines->'%(New)')" Overwrite="true"
-                      Condition="@(_Lines->'%(New)') != @(_OriginalLines)" />
-  </Target>
-  
-  <Target Name="BuildStubDef" BeforeTargets="PreLinkEvent">
-    <ItemGroup>
-      <_DefLines Remove="@(_DefLines)" />
-      <_Lines Remove="@(_Lines)" />
-      <_OriginalLines Remove="@(_OriginalLines)" />
-    </ItemGroup>
-    <ReadLinesFromFile File="..\PC\python3.def">
-      <Output TaskParameter="Lines" ItemName="_DefLines" />
-    </ReadLinesFromFile>
-    <ReadLinesFromFile File="$(IntDir)python3stub.def" Condition="Exists('$(IntDir)python3stub.def')">
-      <Output TaskParameter="Lines" ItemName="_OriginalLines" />
-    </ReadLinesFromFile>
-    <PropertyGroup>
-      <_Pattern>^[\w.]+=.+?\.([^ ]+).*$</_Pattern>
-      <_Sub>$1</_Sub>
-    </PropertyGroup>
-    <ItemGroup>
-      <_Lines Include="EXPORTS" />
-      <_Symbols Include="@(_DefLines)" Condition="$([System.Text.RegularExpressions.Regex]::IsMatch(`%(Identity)`, `$(_Pattern)`))">
-        <Symbol>$([System.Text.RegularExpressions.Regex]::Replace(`%(Identity)`, `$(_Pattern)`, `$(_Sub)`))</Symbol>
-      </_Symbols>
-      <_Lines Include="@(_Symbols->'%(Symbol)')" />
-    </ItemGroup>
-    <MakeDir Directories="$(IntDir)" />
-    <Message Text="Updating python3stub.def" Condition="@(_Lines) != @(_OriginalLines)" Importance="high" />
-    <WriteLinesToFile File="$(IntDir)python3stub.def" Lines="@(_Lines)" Overwrite="true"
-                      Condition="@(_Lines) != @(_OriginalLines)" />
-  </Target>
 </Project>
\ No newline at end of file
diff --git a/PCbuild/python3dll.vcxproj.filters b/PCbuild/python3dll.vcxproj.filters
index a756605..ba562df 100644
--- a/PCbuild/python3dll.vcxproj.filters
+++ b/PCbuild/python3dll.vcxproj.filters
@@ -11,11 +11,6 @@
     </Filter>
   </ItemGroup>
   <ItemGroup>
-    <None Include="..\PC\python3.def">
-      <Filter>Source Files</Filter>
-    </None>
-  </ItemGroup>
-  <ItemGroup>
     <ClCompile Include="..\PC\python3dll.c">
       <Filter>Source Files</Filter>
     </ClCompile>
diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj
index 2625d02..c39ba3e 100644
--- a/PCbuild/pythoncore.vcxproj
+++ b/PCbuild/pythoncore.vcxproj
@@ -106,16 +106,12 @@
       <PreprocessorDefinitions Condition="$(IncludeExternals)">_Py_HAVE_ZLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
     <Link>
-      <AdditionalDependencies>version.lib;shlwapi.lib;ws2_32.lib;pathcch.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>version.lib;ws2_32.lib;pathcch.lib;%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
-    <ClInclude Include="..\Include\Python-ast.h" />
     <ClInclude Include="..\Include\Python.h" />
     <ClInclude Include="..\Include\abstract.h" />
-    <ClInclude Include="..\Include\asdl.h" />
-    <ClInclude Include="..\Include\ast.h" />
-    <ClInclude Include="..\Include\bitset.h" />
     <ClInclude Include="..\Include\boolobject.h" />
     <ClInclude Include="..\Include\bytearrayobject.h" />
     <ClInclude Include="..\Include\bytesobject.h" />
@@ -132,6 +128,7 @@
     <ClInclude Include="..\Include\cpython\bytesobject.h" />
     <ClInclude Include="..\Include\cpython\ceval.h" />
     <ClInclude Include="..\Include\cpython\code.h" />
+    <ClInclude Include="..\Include\cpython\compile.h" />
     <ClInclude Include="..\Include\cpython\dictobject.h" />
     <ClInclude Include="..\Include\cpython\fileobject.h" />
     <ClInclude Include="..\Include\cpython\fileutils.h" />
@@ -143,10 +140,19 @@
     <ClInclude Include="..\Include\cpython\methodobject.h" />
     <ClInclude Include="..\Include\cpython\object.h" />
     <ClInclude Include="..\Include\cpython\objimpl.h" />
+    <ClInclude Include="..\Include\cpython\odictobject.h" />
+    <ClInclude Include="..\Include\cpython\parser_interface.h" />
+    <ClInclude Include="..\Include\cpython\picklebufobject.h" />
+    <ClInclude Include="..\Include\cpython\pyarena.h" />
+    <ClInclude Include="..\Include\cpython\pyctype.h" />
+    <ClInclude Include="..\Include\cpython\pydebug.h" />
     <ClInclude Include="..\Include\cpython\pyerrors.h" />
+    <ClInclude Include="..\Include\cpython\pyfpe.h" />
     <ClInclude Include="..\Include\cpython\pylifecycle.h" />
     <ClInclude Include="..\Include\cpython\pymem.h" />
     <ClInclude Include="..\Include\cpython\pystate.h" />
+    <ClInclude Include="..\Include\cpython\pythonrun.h" />
+    <ClInclude Include="..\Include\cpython\pytime.h" />
     <ClInclude Include="..\Include\cpython\sysmodule.h" />
     <ClInclude Include="..\Include\cpython\traceback.h" />
     <ClInclude Include="..\Include\cpython\tupleobject.h" />
@@ -164,22 +170,25 @@
     <ClInclude Include="..\Include\frameobject.h" />
     <ClInclude Include="..\Include\funcobject.h" />
     <ClInclude Include="..\Include\genobject.h" />
-    <ClInclude Include="..\Include\graminit.h" />
-    <ClInclude Include="..\Include\grammar.h" />
     <ClInclude Include="..\Include\import.h" />
-    <ClInclude Include="..\Include\internal\pegen_interface.h" />
     <ClInclude Include="..\Include\internal\pycore_abstract.h" />
     <ClInclude Include="..\Include\internal\pycore_accu.h" />
+    <ClInclude Include="..\Include\internal\pycore_asdl.h" />
+    <ClInclude Include="..\Include\internal\pycore_ast.h" />
+    <ClInclude Include="..\Include\internal\pycore_ast_state.h" />
     <ClInclude Include="..\Include\internal\pycore_atomic.h" />
+    <ClInclude Include="..\Include\internal\pycore_atomic_funcs.h" />
+    <ClInclude Include="..\Include\internal\pycore_bitutils.h" />
     <ClInclude Include="..\Include\internal\pycore_bytes_methods.h" />
-    <ClInclude Include="..\Include\internal\pycore_byteswap.h" />
     <ClInclude Include="..\Include\internal\pycore_call.h" />
     <ClInclude Include="..\Include\internal\pycore_ceval.h" />
     <ClInclude Include="..\Include\internal\pycore_code.h" />
+    <ClInclude Include="..\Include\internal\pycore_compile.h" />
     <ClInclude Include="..\Include\internal\pycore_condvar.h" />
     <ClInclude Include="..\Include\internal\pycore_context.h" />
     <ClInclude Include="..\Include\internal\pycore_dtoa.h" />
     <ClInclude Include="..\Include\internal\pycore_fileutils.h" />
+    <ClInclude Include="..\Include\internal\pycore_format.h" />
     <ClInclude Include="..\Include\internal\pycore_gc.h" />
     <ClInclude Include="..\Include\internal\pycore_getopt.h" />
     <ClInclude Include="..\Include\internal\pycore_gil.h" />
@@ -188,17 +197,25 @@
     <ClInclude Include="..\Include\internal\pycore_import.h" />
     <ClInclude Include="..\Include\internal\pycore_initconfig.h" />
     <ClInclude Include="..\Include\internal\pycore_interp.h" />
+    <ClInclude Include="..\Include\internal\pycore_list.h" />
+    <ClInclude Include="..\Include\internal\pycore_long.h" />
+    <ClInclude Include="..\Include\internal\pycore_moduleobject.h" />
     <ClInclude Include="..\Include\internal\pycore_object.h" />
     <ClInclude Include="..\Include\internal\pycore_pathconfig.h" />
+    <ClInclude Include="..\Include\internal\pycore_pyarena.h" />
     <ClInclude Include="..\Include\internal\pycore_pyerrors.h" />
     <ClInclude Include="..\Include\internal\pycore_pyhash.h" />
     <ClInclude Include="..\Include\internal\pycore_pylifecycle.h" />
     <ClInclude Include="..\Include\internal\pycore_pymem.h" />
     <ClInclude Include="..\Include\internal\pycore_pystate.h" />
     <ClInclude Include="..\Include\internal\pycore_runtime.h" />
+    <ClInclude Include="..\Include\internal\pycore_structseq.h" />
     <ClInclude Include="..\Include\internal\pycore_sysmodule.h" />
+    <ClInclude Include="..\Include\internal\pycore_symtable.h" />
     <ClInclude Include="..\Include\internal\pycore_traceback.h" />
-    <ClInclude Include="..\Include\internal\pycore_tupleobject.h" />
+    <ClInclude Include="..\Include\internal\pycore_tuple.h" />
+    <ClInclude Include="..\Include\internal\pycore_ucnhash.h" />
+    <ClInclude Include="..\Include\internal\pycore_unionobject.h" />
     <ClInclude Include="..\Include\internal\pycore_warnings.h" />
     <ClInclude Include="..\Include\interpreteridobject.h" />
     <ClInclude Include="..\Include\intrcheck.h" />
@@ -212,24 +229,16 @@
     <ClInclude Include="..\Include\modsupport.h" />
     <ClInclude Include="..\Include\moduleobject.h" />
     <ClInclude Include="..\Include\namespaceobject.h" />
-    <ClInclude Include="..\Include\node.h" />
     <ClInclude Include="..\Include\object.h" />
     <ClInclude Include="..\Include\objimpl.h" />
-    <ClInclude Include="..\Include\odictobject.h" />
     <ClInclude Include="..\Include\opcode.h" />
     <ClInclude Include="..\Include\osdefs.h" />
     <ClInclude Include="..\Include\osmodule.h" />
-    <ClInclude Include="..\Include\parsetok.h" />
     <ClInclude Include="..\Include\patchlevel.h" />
-    <ClInclude Include="..\Include\picklebufobject.h" />
     <ClInclude Include="..\Include\py_curses.h" />
-    <ClInclude Include="..\Include\pyarena.h" />
     <ClInclude Include="..\Include\pycapsule.h" />
-    <ClInclude Include="..\Include\pyctype.h" />
-    <ClInclude Include="..\Include\pydebug.h" />
     <ClInclude Include="..\Include\pyerrors.h" />
     <ClInclude Include="..\Include\pyexpat.h" />
-    <ClInclude Include="..\Include\pyfpe.h" />
     <ClInclude Include="..\Include\pyframe.h" />
     <ClInclude Include="..\Include\pyhash.h" />
     <ClInclude Include="..\Include\pylifecycle.h" />
@@ -243,7 +252,6 @@
     <ClInclude Include="..\Include\pystrtod.h" />
     <ClInclude Include="..\Include\pythonrun.h" />
     <ClInclude Include="..\Include\pythread.h" />
-    <ClInclude Include="..\Include\pytime.h" />
     <ClInclude Include="..\Include\rangeobject.h" />
     <ClInclude Include="..\Include\setobject.h" />
     <ClInclude Include="..\Include\sliceobject.h" />
@@ -255,7 +263,6 @@
     <ClInclude Include="..\Include\traceback.h" />
     <ClInclude Include="..\Include\tracemalloc.h" />
     <ClInclude Include="..\Include\tupleobject.h" />
-    <ClInclude Include="..\Include\ucnhash.h" />
     <ClInclude Include="..\Include\unicodeobject.h" />
     <ClInclude Include="..\Include\weakrefobject.h" />
     <ClInclude Include="..\Modules\_math.h" />
@@ -282,15 +289,15 @@
     <ClInclude Include="..\Objects\stringlib\replace.h" />
     <ClInclude Include="..\Objects\stringlib\split.h" />
     <ClInclude Include="..\Objects\unicodetype_db.h" />
-    <ClInclude Include="..\Parser\parser.h" />
     <ClInclude Include="..\Parser\tokenizer.h" />
-    <ClInclude Include="..\Parser\pegen\parse_string.h" />
-    <ClInclude Include="..\Parser\pegen\pegen.h" />
+    <ClInclude Include="..\Parser\string_parser.h" />
+    <ClInclude Include="..\Parser\pegen.h" />
     <ClInclude Include="..\PC\errmap.h" />
     <ClInclude Include="..\PC\pyconfig.h" />
     <ClInclude Include="..\Python\ceval_gil.h" />
     <ClInclude Include="..\Python\condvar.h" />
     <ClInclude Include="..\Python\importdl.h" />
+    <ClInclude Include="..\Python\stdlib_module_names.h" />
     <ClInclude Include="..\Python\thread_nt.h" />
     <ClInclude Include="..\Python\wordcode_helpers.h" />
   </ItemGroup>
@@ -346,8 +353,6 @@
     <ClCompile Include="..\Modules\mmapmodule.c" />
     <ClCompile Include="..\Modules\_opcode.c" />
     <ClCompile Include="..\Modules\_operator.c" />
-    <ClCompile Include="..\Modules\parsermodule.c" />
-    <ClCompile Include="..\Modules\_peg_parser.c" />
     <ClCompile Include="..\Modules\posixmodule.c" />
     <ClCompile Include="..\Modules\rotatingtree.c" />
     <ClCompile Include="..\Modules\sha1module.c" />
@@ -419,20 +424,15 @@
     <ClCompile Include="..\Objects\typeobject.c" />
     <ClCompile Include="..\Objects\unicodectype.c" />
     <ClCompile Include="..\Objects\unicodeobject.c" />
+    <ClCompile Include="..\Objects\unionobject.c" />
     <ClCompile Include="..\Objects\weakrefobject.c" />
-    <ClCompile Include="..\Parser\acceler.c" />
-    <ClCompile Include="..\Parser\grammar1.c" />
-    <ClCompile Include="..\Parser\listnode.c" />
     <ClCompile Include="..\Parser\myreadline.c" />
-    <ClCompile Include="..\Parser\node.c" />
-    <ClCompile Include="..\Parser\parser.c" />
-    <ClCompile Include="..\Parser\parsetok.c" />
     <ClCompile Include="..\Parser\tokenizer.c" />
     <ClCompile Include="..\Parser\token.c" />
-    <ClCompile Include="..\Parser\pegen\pegen.c" />
-    <ClCompile Include="..\Parser\pegen\parse.c" />
-    <ClCompile Include="..\Parser\pegen\parse_string.c" />
-    <ClCompile Include="..\Parser\pegen\peg_api.c" />
+    <ClCompile Include="..\Parser\pegen.c" />
+    <ClCompile Include="..\Parser\parser.c" />
+    <ClCompile Include="..\Parser\string_parser.c" />
+    <ClCompile Include="..\Parser\peg_api.c" />
     <ClCompile Include="..\PC\invalid_parameter_handler.c" />
     <ClCompile Include="..\PC\winreg.c" />
     <ClCompile Include="..\PC\config.c" />
@@ -463,7 +463,6 @@
     <ClCompile Include="..\Python\getopt.c" />
     <ClCompile Include="..\Python\getplatform.c" />
     <ClCompile Include="..\Python\getversion.c" />
-    <ClCompile Include="..\Python\graminit.c" />
     <ClCompile Include="..\Python\hamt.c" />
     <ClCompile Include="..\Python\hashtable.c" />
     <ClCompile Include="..\Python\import.c" />
@@ -474,7 +473,6 @@
     <ClCompile Include="..\Python\mysnprintf.c" />
     <ClCompile Include="..\Python\mystrtoul.c" />
     <ClCompile Include="..\Python\pathconfig.c" />
-    <ClCompile Include="..\Python\peephole.c" />
     <ClCompile Include="..\Python\preconfig.c" />
     <ClCompile Include="..\Python\pyarena.c" />
     <ClCompile Include="..\Python\pyctype.c" />
@@ -489,6 +487,7 @@
     <ClCompile Include="..\Python\dtoa.c" />
     <ClCompile Include="..\Python\Python-ast.c" />
     <ClCompile Include="..\Python\pythonrun.c" />
+    <ClCompile Include="..\Python\suggestions.c" />
     <ClCompile Include="..\Python\structmember.c" />
     <ClCompile Include="..\Python\symtable.c" />
     <ClCompile Include="..\Python\sysmodule.c" />
@@ -517,7 +516,9 @@
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
+    <Import Project="regen.targets" />
   </ImportGroup>
+  <Target Name="_TriggerRegen" BeforeTargets="PrepareForBuild" DependsOnTargets="Regen" />
   <Target Name="_GetBuildInfo" BeforeTargets="PrepareForBuild">
     <PropertyGroup>
       <GIT Condition="$(GIT) == ''">git</GIT>
diff --git a/PCbuild/pythoncore.vcxproj.filters b/PCbuild/pythoncore.vcxproj.filters
index 4b9eebd..55b57ef 100644
--- a/PCbuild/pythoncore.vcxproj.filters
+++ b/PCbuild/pythoncore.vcxproj.filters
@@ -37,23 +37,11 @@
     <Filter Include="Include\cpython">
       <UniqueIdentifier>{875bf4f2-ac42-46bd-b703-8371a824ec32}</UniqueIdentifier>
     </Filter>
-    <Filter Include="Parser\pegen">
-      <UniqueIdentifier>{33dbdbe0-42c4-4478-bed2-a12cb1e68773}</UniqueIdentifier>
-    </Filter>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\Include\abstract.h">
       <Filter>Include</Filter>
     </ClInclude>
-    <ClInclude Include="..\Include\asdl.h">
-      <Filter>Include</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Include\ast.h">
-      <Filter>Include</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Include\bitset.h">
-      <Filter>Include</Filter>
-    </ClInclude>
     <ClInclude Include="..\Include\boolobject.h">
       <Filter>Include</Filter>
     </ClInclude>
@@ -126,108 +114,9 @@
     <ClInclude Include="..\Include\genobject.h">
       <Filter>Include</Filter>
     </ClInclude>
-    <ClInclude Include="..\Include\graminit.h">
-      <Filter>Include</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Include\grammar.h">
-      <Filter>Include</Filter>
-    </ClInclude>
     <ClInclude Include="..\Include\import.h">
       <Filter>Include</Filter>
     </ClInclude>
-    <ClInclude Include="..\Include\internal\pycore_abstract.h">
-      <Filter>Include</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Include\internal\pycore_accu.h">
-      <Filter>Include</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Include\internal\pycore_atomic.h">
-      <Filter>Include</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Include\internal\pycore_byteswap.h">
-      <Filter>Include</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Include\internal\pycore_bytes_methods.h">
-      <Filter>Include</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Include\internal\pycore_call.h">
-      <Filter>Include</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Include\internal\pycore_code.h">
-      <Filter>Include</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Include\internal\pycore_ceval.h">
-      <Filter>Include</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Include\internal\pycore_condvar.h">
-      <Filter>Include</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Include\internal\pycore_context.h">
-      <Filter>Include</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Include\internal\pycore_dtoa.h">
-      <Filter>Include</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Include\internal\pycore_fileutils.h">
-      <Filter>Include</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Include\internal\pycore_getopt.h">
-      <Filter>Include</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Include\internal\pycore_gil.h">
-      <Filter>Include</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Include\internal\pycore_hamt.h">
-      <Filter>Include</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Include\internal\pycore_hashtable.h">
-      <Filter>Include</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Include\internal\pycore_import.h">
-      <Filter>Include</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Include\internal\pycore_initconfig.h">
-      <Filter>Include</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Include\internal\pycore_interp.h">
-      <Filter>Include</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Include\internal\pycore_object.h">
-      <Filter>Include</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Include\internal\pycore_pathconfig.h">
-      <Filter>Include</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Include\internal\pycore_pyerrors.h">
-      <Filter>Include</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Include\internal\pycore_pyhash.h">
-      <Filter>Include</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Include\internal\pycore_pylifecycle.h">
-      <Filter>Include</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Include\internal\pycore_pymem.h">
-      <Filter>Include</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Include\internal\pycore_pystate.h">
-      <Filter>Include</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Include\internal\pycore_runtime.h">
-      <Filter>Include</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Include\internal\pycore_sysmodule.h">
-      <Filter>Include</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Include\internal\pycore_traceback.h">
-      <Filter>Include</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Include\internal\pycore_tupleobject.h">
-      <Filter>Include</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Include\internal\pycore_warnings.h">
-      <Filter>Include</Filter>
-    </ClInclude>
     <ClInclude Include="..\Include\intrcheck.h">
       <Filter>Include</Filter>
     </ClInclude>
@@ -258,9 +147,6 @@
     <ClInclude Include="..\Include\moduleobject.h">
       <Filter>Include</Filter>
     </ClInclude>
-    <ClInclude Include="..\Include\node.h">
-      <Filter>Include</Filter>
-    </ClInclude>
     <ClInclude Include="..\Include\object.h">
       <Filter>Include</Filter>
     </ClInclude>
@@ -276,48 +162,27 @@
     <ClInclude Include="..\Include\osmodule.h">
       <Filter>Include</Filter>
     </ClInclude>
-    <ClInclude Include="..\Include\parsetok.h">
-      <Filter>Include</Filter>
-    </ClInclude>
     <ClInclude Include="..\Include\patchlevel.h">
       <Filter>Include</Filter>
     </ClInclude>
-    <ClInclude Include="..\Include\picklebufobject.h">
-      <Filter>Include</Filter>
-    </ClInclude>
     <ClInclude Include="..\Include\py_curses.h">
       <Filter>Include</Filter>
     </ClInclude>
-    <ClInclude Include="..\Include\pyarena.h">
-      <Filter>Include</Filter>
-    </ClInclude>
     <ClInclude Include="..\Include\pycapsule.h">
       <Filter>Include</Filter>
     </ClInclude>
-    <ClInclude Include="..\Include\pyctype.h">
-      <Filter>Include</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Include\pydebug.h">
-      <Filter>Include</Filter>
-    </ClInclude>
     <ClInclude Include="..\Include\pyerrors.h">
       <Filter>Include</Filter>
     </ClInclude>
     <ClInclude Include="..\Include\pyexpat.h">
       <Filter>Include</Filter>
     </ClInclude>
-    <ClInclude Include="..\Include\pyfpe.h">
-      <Filter>Include</Filter>
-    </ClInclude>
     <ClInclude Include="..\Include\pylifecycle.h">
       <Filter>Include</Filter>
     </ClInclude>
     <ClInclude Include="..\Include\pymath.h">
       <Filter>Include</Filter>
     </ClInclude>
-    <ClInclude Include="..\Include\pytime.h">
-      <Filter>Include</Filter>
-    </ClInclude>
     <ClInclude Include="..\Include\pymacro.h">
       <Filter>Include</Filter>
     </ClInclude>
@@ -339,9 +204,6 @@
     <ClInclude Include="..\Include\pystrhex.h">
       <Filter>Include</Filter>
     </ClInclude>
-    <ClInclude Include="..\Include\Python-ast.h">
-      <Filter>Include</Filter>
-    </ClInclude>
     <ClInclude Include="..\Include\Python.h">
       <Filter>Include</Filter>
     </ClInclude>
@@ -384,9 +246,6 @@
     <ClInclude Include="..\Include\tupleobject.h">
       <Filter>Include</Filter>
     </ClInclude>
-    <ClInclude Include="..\Include\ucnhash.h">
-      <Filter>Include</Filter>
-    </ClInclude>
     <ClInclude Include="..\Include\unicodeobject.h">
       <Filter>Include</Filter>
     </ClInclude>
@@ -462,9 +321,6 @@
     <ClInclude Include="..\Objects\unicodetype_db.h">
       <Filter>Objects</Filter>
     </ClInclude>
-    <ClInclude Include="..\Parser\parser.h">
-      <Filter>Parser</Filter>
-    </ClInclude>
     <ClInclude Include="..\Parser\tokenizer.h">
       <Filter>Parser</Filter>
     </ClInclude>
@@ -477,6 +333,9 @@
     <ClInclude Include="..\Python\importdl.h">
       <Filter>Python</Filter>
     </ClInclude>
+    <ClInclude Include="..\Python\stdlib_module_names.h">
+      <Filter>Python</Filter>
+    </ClInclude>
     <ClInclude Include="..\Python\thread_nt.h">
       <Filter>Python</Filter>
     </ClInclude>
@@ -501,8 +360,11 @@
     <ClInclude Include="..\Modules\hashtable.h">
       <Filter>Modules</Filter>
     </ClInclude>
-    <ClInclude Include="..\Include\odictobject.h">
-      <Filter>Include</Filter>
+    <ClInclude Include="..\Parser\pegen.h">
+      <Filter>Parser</Filter>
+    </ClInclude>
+    <ClInclude Include="..\Parser\string_parser.h">
+      <Filter>Parser</Filter>
     </ClInclude>
     <ClInclude Include="..\Include\pyframe.h">
       <Filter>Include</Filter>
@@ -522,6 +384,9 @@
     <ClInclude Include="..\Include\cpython\code.h">
       <Filter>Include\cpython</Filter>
     </ClInclude>
+    <ClInclude Include="..\Include\cpython\compile.h">
+      <Filter>Include</Filter>
+    </ClInclude>
     <ClInclude Include="..\Include\cpython\dictobject.h">
       <Filter>Include\cpython</Filter>
     </ClInclude>
@@ -537,6 +402,9 @@
     <ClInclude Include="..\Include\cpython\listobject.h">
       <Filter>Include\cpython</Filter>
     </ClInclude>
+    <ClInclude Include="..\Include\cpython\odictobject.h">
+      <Filter>Include</Filter>
+    </ClInclude>
     <ClInclude Include="..\Include\cpython\unicodeobject.h">
       <Filter>Include\cpython</Filter>
     </ClInclude>
@@ -549,15 +417,36 @@
     <ClInclude Include="..\Include\cpython\object.h">
       <Filter>Include\cpython</Filter>
     </ClInclude>
+    <ClInclude Include="..\Include\cpython\parser_interface.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\Include\cpython\picklebufobject.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\Include\cpython\pyarena.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\Include\cpython\pyctype.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\Include\cpython\pydebug.h">
+      <Filter>Include</Filter>
+    </ClInclude>
     <ClInclude Include="..\Include\cpython\pyerrors.h">
       <Filter>Include\cpython</Filter>
     </ClInclude>
+    <ClInclude Include="..\Include\cpython\pyfpe.h">
+      <Filter>Include</Filter>
+    </ClInclude>
     <ClInclude Include="..\Include\cpython\pymem.h">
       <Filter>Include\cpython</Filter>
     </ClInclude>
     <ClInclude Include="..\Include\cpython\pylifecycle.h">
       <Filter>Include\cpython</Filter>
     </ClInclude>
+    <ClInclude Include="..\Include\cpython\pytime.h">
+      <Filter>Include\cpython</Filter>
+    </ClInclude>
     <ClInclude Include="..\Include\cpython\tupleobject.h">
       <Filter>Include\cpython</Filter>
     </ClInclude>
@@ -570,6 +459,9 @@
     <ClInclude Include="..\Include\cpython\interpreteridobject.h">
       <Filter>Include\cpython</Filter>
     </ClInclude>
+    <ClInclude Include="..\Include\cpython\pythonrun.h">
+      <Filter>Include\cpython</Filter>
+    </ClInclude>
     <ClInclude Include="..\Include\cpython\sysmodule.h">
       <Filter>Include\cpython</Filter>
     </ClInclude>
@@ -588,9 +480,24 @@
     <ClInclude Include="..\Include\internal\pycore_accu.h">
       <Filter>Include\internal</Filter>
     </ClInclude>
+    <ClInclude Include="..\Include\internal\pycore_asdl.h">
+      <Filter>Include\internal</Filter>
+    </ClInclude>
+    <ClInclude Include="..\Include\internal\pycore_ast.h">
+      <Filter>Include\internal</Filter>
+    </ClInclude>
+    <ClInclude Include="..\Include\internal\pycore_ast_state.h">
+      <Filter>Include\internal</Filter>
+    </ClInclude>
     <ClInclude Include="..\Include\internal\pycore_atomic.h">
       <Filter>Include\internal</Filter>
     </ClInclude>
+    <ClInclude Include="..\Include\internal\pycore_atomic_funcs.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\Include\internal\pycore_bitutils.h">
+      <Filter>Include\internal</Filter>
+    </ClInclude>
     <ClInclude Include="..\Include\internal\pycore_bytes_methods.h">
       <Filter>Include\internal</Filter>
     </ClInclude>
@@ -603,6 +510,9 @@
     <ClInclude Include="..\Include\internal\pycore_code.h">
       <Filter>Include\internal</Filter>
     </ClInclude>
+    <ClInclude Include="..\Include\internal\pycore_compile.h">
+      <Filter>Include\internal</Filter>
+    </ClInclude>
     <ClInclude Include="..\Include\internal\pycore_condvar.h">
       <Filter>Include\internal</Filter>
     </ClInclude>
@@ -615,6 +525,9 @@
     <ClInclude Include="..\Include\internal\pycore_fileutils.h">
       <Filter>Include\internal</Filter>
     </ClInclude>
+    <ClInclude Include="..\Include\internal\pycore_format.h">
+      <Filter>Include\internal</Filter>
+    </ClInclude>
     <ClInclude Include="..\Include\internal\pycore_gc.h">
       <Filter>Include\internal</Filter>
     </ClInclude>
@@ -639,12 +552,24 @@
     <ClInclude Include="..\Include\internal\pycore_interp.h">
       <Filter>Include\internal</Filter>
     </ClInclude>
+    <ClInclude Include="..\Include\internal\pycore_list.h">
+      <Filter>Include\internal</Filter>
+    </ClInclude>
+    <ClInclude Include="..\Include\internal\pycore_long.h">
+      <Filter>Include\internal</Filter>
+    </ClInclude>
+    <ClInclude Include="..\Include\internal\pycore_moduleobject.h">
+      <Filter>Include\internal</Filter>
+    </ClInclude>
     <ClInclude Include="..\Include\internal\pycore_object.h">
       <Filter>Include\internal</Filter>
     </ClInclude>
     <ClInclude Include="..\Include\internal\pycore_pathconfig.h">
       <Filter>Include\internal</Filter>
     </ClInclude>
+    <ClInclude Include="..\Include\internal\pycore_pyarena.h">
+      <Filter>Include\internal</Filter>
+    </ClInclude>
     <ClInclude Include="..\Include\internal\pycore_pyerrors.h">
       <Filter>Include\internal</Filter>
     </ClInclude>
@@ -666,18 +591,54 @@
     <ClInclude Include="..\Include\internal\pycore_sysmodule.h">
       <Filter>Include\internal</Filter>
     </ClInclude>
+    <ClInclude Include="..\Include\internal\pycore_symtable.h">
+      <Filter>Include\internal</Filter>
+    </ClInclude>
     <ClInclude Include="..\Include\internal\pycore_traceback.h">
       <Filter>Include\internal</Filter>
     </ClInclude>
-    <ClInclude Include="..\Parser\pegen\parse_string.h">
-      <Filter>Parser\pegen</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Parser\pegen\pegen.h">
-      <Filter>Parser\pegen</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Include\internal\pegen_interface.h">
+    <ClInclude Include="..\Include\internal\pycore_tuple.h">
       <Filter>Include\internal</Filter>
     </ClInclude>
+    <ClInclude Include="..\Include\internal\pycore_ucnhash.h">
+      <Filter>Include\internal</Filter>
+    </ClInclude>
+    <ClInclude Include="..\Include\internal\pycore_unionobject.h">
+      <Filter>Include\internal</Filter>
+    </ClInclude>
+    <ClInclude Include="$(zlibDir)\crc32.h">
+      <Filter>Modules\zlib</Filter>
+    </ClInclude>
+    <ClInclude Include="$(zlibDir)\deflate.h">
+      <Filter>Modules\zlib</Filter>
+    </ClInclude>
+    <ClInclude Include="$(zlibDir)\inffast.h">
+      <Filter>Modules\zlib</Filter>
+    </ClInclude>
+    <ClInclude Include="$(zlibDir)\inffixed.h">
+      <Filter>Modules\zlib</Filter>
+    </ClInclude>
+    <ClInclude Include="$(zlibDir)\inflate.h">
+      <Filter>Modules\zlib</Filter>
+    </ClInclude>
+    <ClInclude Include="$(zlibDir)\inftrees.h">
+      <Filter>Modules\zlib</Filter>
+    </ClInclude>
+    <ClInclude Include="$(zlibDir)\trees.h">
+      <Filter>Modules\zlib</Filter>
+    </ClInclude>
+    <ClInclude Include="$(zlibDir)\zconf.h">
+      <Filter>Modules\zlib</Filter>
+    </ClInclude>
+    <ClInclude Include="$(zlibDir)\zconf.in.h">
+      <Filter>Modules\zlib</Filter>
+    </ClInclude>
+    <ClInclude Include="$(zlibDir)\zlib.h">
+      <Filter>Modules\zlib</Filter>
+    </ClInclude>
+    <ClInclude Include="$(zlibDir)\zutil.h">
+      <Filter>Modules\zlib</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\Modules\_abc.c">
@@ -818,6 +779,9 @@
     <ClCompile Include="..\Modules\xxsubtype.c">
       <Filter>Modules</Filter>
     </ClCompile>
+    <ClCompile Include="..\Modules\zlibmodule.c">
+      <Filter>Modules</Filter>
+    </ClCompile>
     <ClCompile Include="..\Modules\_io\fileio.c">
       <Filter>Modules\_io</Filter>
     </ClCompile>
@@ -980,27 +944,9 @@
     <ClCompile Include="..\Objects\weakrefobject.c">
       <Filter>Objects</Filter>
     </ClCompile>
-    <ClCompile Include="..\Parser\acceler.c">
-      <Filter>Parser</Filter>
-    </ClCompile>
-    <ClCompile Include="..\Parser\grammar1.c">
-      <Filter>Parser</Filter>
-    </ClCompile>
-    <ClCompile Include="..\Parser\listnode.c">
-      <Filter>Parser</Filter>
-    </ClCompile>
     <ClCompile Include="..\Parser\myreadline.c">
       <Filter>Parser</Filter>
     </ClCompile>
-    <ClCompile Include="..\Parser\node.c">
-      <Filter>Parser</Filter>
-    </ClCompile>
-    <ClCompile Include="..\Parser\parser.c">
-      <Filter>Parser</Filter>
-    </ClCompile>
-    <ClCompile Include="..\Parser\parsetok.c">
-      <Filter>Parser</Filter>
-    </ClCompile>
     <ClCompile Include="..\Parser\tokenizer.c">
       <Filter>Parser</Filter>
     </ClCompile>
@@ -1088,9 +1034,6 @@
     <ClCompile Include="..\Python\getversion.c">
       <Filter>Python</Filter>
     </ClCompile>
-    <ClCompile Include="..\Python\graminit.c">
-      <Filter>Python</Filter>
-    </ClCompile>
     <ClCompile Include="..\Python\hashtable.c">
       <Filter>Modules</Filter>
     </ClCompile>
@@ -1118,9 +1061,6 @@
     <ClCompile Include="..\Python\pathconfig.c">
       <Filter>Python</Filter>
     </ClCompile>
-    <ClCompile Include="..\Python\peephole.c">
-      <Filter>Python</Filter>
-    </ClCompile>
     <ClCompile Include="..\Python\preconfig.c">
       <Filter>Python</Filter>
     </ClCompile>
@@ -1211,38 +1151,65 @@
     <ClCompile Include="..\Modules\_contextvarsmodule.c">
       <Filter>Modules</Filter>
     </ClCompile>
+    <ClCompile Include="$(zlibDir)\adler32.c">
+      <Filter>Modules\zlib</Filter>
+    </ClCompile>
+    <ClCompile Include="$(zlibDir)\compress.c">
+      <Filter>Modules\zlib</Filter>
+    </ClCompile>
+    <ClCompile Include="$(zlibDir)\crc32.c">
+      <Filter>Modules\zlib</Filter>
+    </ClCompile>
+    <ClCompile Include="$(zlibDir)\deflate.c">
+      <Filter>Modules\zlib</Filter>
+    </ClCompile>
+    <ClCompile Include="$(zlibDir)\infback.c">
+      <Filter>Modules\zlib</Filter>
+    </ClCompile>
+    <ClCompile Include="$(zlibDir)\inffast.c">
+      <Filter>Modules\zlib</Filter>
+    </ClCompile>
+    <ClCompile Include="$(zlibDir)\inflate.c">
+      <Filter>Modules\zlib</Filter>
+    </ClCompile>
+    <ClCompile Include="$(zlibDir)\inftrees.c">
+      <Filter>Modules\zlib</Filter>
+    </ClCompile>
+    <ClCompile Include="$(zlibDir)\trees.c">
+      <Filter>Modules\zlib</Filter>
+    </ClCompile>
+    <ClCompile Include="$(zlibDir)\uncompr.c">
+      <Filter>Modules\zlib</Filter>
+    </ClCompile>
+    <ClCompile Include="$(zlibDir)\zutil.c">
+      <Filter>Modules\zlib</Filter>
+    </ClCompile>
     <ClCompile Include="..\Python\hamt.c">
       <Filter>Python</Filter>
     </ClCompile>
     <ClCompile Include="..\Parser\parser.c">
       <Filter>Parser</Filter>
     </ClCompile>
+    <ClCompile Include="..\Parser\pegen.c">
+      <Filter>Parser</Filter>
+    </ClCompile>
+    <ClCompile Include="..\Parser\peg_api.c">
+      <Filter>Parser</Filter>
+    </ClCompile>
     <ClCompile Include="..\Modules\_xxsubinterpretersmodule.c">
       <Filter>Modules</Filter>
     </ClCompile>
+    <ClCompile Include="..\Parser\string_parser.c">
+      <Filter>Parser</Filter>
+    </ClCompile>
     <ClCompile Include="..\Python\context.c">
       <Filter>Python</Filter>
     </ClCompile>
     <ClCompile Include="..\Objects\genericaliasobject.c">
       <Filter>Objects</Filter>
     </ClCompile>
-    <ClCompile Include="..\Parser\pegen\pegen.c">
-      <Filter>Parser\pegen</Filter>
-    </ClCompile>
-    <ClCompile Include="..\Parser\pegen\parse.c">
-      <Filter>Parser\pegen</Filter>
-    </ClCompile>
-    <ClCompile Include="..\Parser\pegen\parse_string.c">
-      <Filter>Parser\pegen</Filter>
-    </ClCompile>
-    <ClCompile Include="..\Parser\pegen\peg_api.c">
-      <Filter>Parser\pegen</Filter>
-    </ClCompile>
-    <ClCompile Include="..\Modules\parsermodule.c">
-      <Filter>Modules</Filter>
-    </ClCompile>
-    <ClCompile Include="..\Modules\_peg_parser.c">
-      <Filter>Modules</Filter>
+    <ClCompile Include="..\Objects\unionobject.c">
+      <Filter>Objects</Filter>
     </ClCompile>
   </ItemGroup>
   <ItemGroup>
@@ -1250,4 +1217,4 @@
       <Filter>Resource Files</Filter>
     </ResourceCompile>
   </ItemGroup>
-</Project>
\ No newline at end of file
+</Project>
diff --git a/PCbuild/readme.txt b/PCbuild/readme.txt
index bafd912..1ea8beb 100644
--- a/PCbuild/readme.txt
+++ b/PCbuild/readme.txt
@@ -38,7 +38,7 @@
     Used to build Python with extra debugging capabilities, equivalent
     to using ./configure --with-pydebug on UNIX.  All binaries built
     using this configuration have "_d" added to their name:
-    python39_d.dll, python_d.exe, parser_d.pyd, and so on.  Both the
+    python310_d.dll, python_d.exe, parser_d.pyd, and so on.  Both the
     build and rt (run test) batch files in this directory accept a -d
     option for debug builds.  If you are building Python to help with
     development of CPython, you will most likely use this configuration.
@@ -125,6 +125,9 @@
 xxlimited
     builds an example module that makes use of the PEP 384 Stable ABI,
     see Modules\xxlimited.c
+xxlimited_35
+    ditto for testing the Python 3.5 stable ABI, see
+    Modules\xxlimited_35.c
 
 The following sub-projects are for individual modules of the standard
 library which are implemented in C; each one builds a DLL (renamed to
@@ -158,7 +161,7 @@
 about getting the source for building these libraries.  The sub-projects
 are:
 _bz2
-    Python wrapper for version 1.0.6 of the libbzip2 compression library
+    Python wrapper for version 1.0.8 of the libbzip2 compression library
     Homepage:
         http://www.bzip.org/
 _lzma
@@ -166,7 +169,7 @@
     Homepage:
         http://tukaani.org/xz/
 _ssl
-    Python wrapper for version 1.1.1c of the OpenSSL secure sockets
+    Python wrapper for version 1.1.1k of the OpenSSL secure sockets
     library, which is downloaded from our binaries repository at
     https://github.com/python/cpython-bin-deps.
 
@@ -185,7 +188,7 @@
     again when building.
 
 _sqlite3
-    Wraps SQLite 3.33.0, which is itself built by sqlite3.vcxproj
+    Wraps SQLite 3.37.2, which is itself built by sqlite3.vcxproj
     Homepage:
         http://www.sqlite.org/
 _tkinter
diff --git a/PCbuild/regen.targets b/PCbuild/regen.targets
new file mode 100644
index 0000000..08ace57
--- /dev/null
+++ b/PCbuild/regen.targets
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Target Name="_SetPythonForBuild">
+    <PropertyGroup>
+      <PythonForBuild>$(PYTHON)</PythonForBuild>
+    </PropertyGroup>
+  </Target>
+
+  <ItemGroup>
+    <_PegenSources Include="$(PySourcePath)Grammar\python.gram;$(PySourcePath)Grammar\Tokens" />
+    <_PegenOutputs Include="$(PySourcePath)Parser\parser.c" />
+    <_ASTSources Include="$(PySourcePath)Parser\Python.asdl" />
+    <_ASTOutputs Include="$(PySourcePath)Include\internal\pycore_ast.h">
+      <Argument>-H</Argument>
+    </_ASTOutputs>
+    <_ASTOutputs Include="$(PySourcePath)Include\internal\pycore_ast_state.h">
+      <Argument>-I</Argument>
+    </_ASTOutputs>
+    <_ASTOutputs Include="$(PySourcePath)Python\Python-ast.c">
+      <Argument>-C</Argument>
+    </_ASTOutputs>
+    <_OpcodeSources Include="$(PySourcePath)Tools\scripts\generate_opcode_h.py;$(PySourcePath)Lib\opcode.py" />
+    <_OpcodeOutputs Include="$(PySourcePath)Include\opcode.h;$(PySourcePath)Python\opcode_targets.h" />
+    <_TokenSources Include="$(PySourcePath)Grammar\Tokens" />
+    <_TokenOutputs Include="$(PySourcePath)Doc\library\token-list.inc">
+      <Format>rst</Format>
+    </_TokenOutputs>
+    <_TokenOutputs Include="$(PySourcePath)Include\token.h">
+      <Format>h</Format>
+    </_TokenOutputs>
+    <_TokenOutputs Include="$(PySourcePath)Parser\token.c">
+      <Format>c</Format>
+    </_TokenOutputs>
+    <_TokenOutputs Include="$(PySourcePath)Lib\token.py">
+      <Format>py</Format>
+    </_TokenOutputs>
+    <_KeywordSources Include="$(PySourcePath)Grammar\python.gram;$(PySourcePath)Grammar\Tokens" />
+    <_KeywordOutputs Include="$(PySourcePath)Lib\keyword.py" />
+  </ItemGroup>
+
+  <Target Name="_TouchRegenSources" Condition="$(ForceRegen) == 'true'">
+    <Message Text="Touching source files to force regeneration" Importance="high" />
+    <Touch Files="@(_PegenSources);@(_ASTSources);@(_OpcodeSources);@(_TokenSources);@(_KeywordOutputs)"
+           AlwaysCreate="False" />
+  </Target>
+
+  <Target Name="_RegenPegen" Inputs="@(_PegenSources)" Outputs="@(_PegenOutputs)">
+    <Message Text="Regenerate @(_PegenOutputs->'%(Filename)%(Extension)',' ')" Importance="high" />
+    <!-- Specify python.gram with POSIX-like path because the argument gets written into the file verbatim -->
+    <Exec Command="set PYTHONPATH=Tools\peg_generator%0D%0A$(PythonForBuild) -m pegen -q c ./Grammar/python.gram Grammar\Tokens -o Parser\parser.c"
+          WorkingDirectory="$(PySourcePath)" />
+  </Target>
+
+  <Target Name="_RegenAST_H" Inputs="@(_ASTSources)" Outputs="@(_ASTOutputs)">
+    <Message Text="Regenerate @(_ASTOutputs->'%(Filename)%(Extension)',' ')" Importance="high" />
+    <Exec Command="$(PythonForBuild) Parser\asdl_c.py Parser\Python.asdl @(_ASTOutputs->'%(Argument) &quot;%(Identity)&quot;',' ')"
+          WorkingDirectory="$(PySourcePath)" />
+  </Target>
+
+  <Target Name="_RegenOpcodes" Inputs="@(_OpcodeSources)" Outputs="@(_OpcodeOutputs)">
+    <Message Text="Regenerate @(_OpcodeOutputs->'%(Filename)%(Extension)',' ')" Importance="high" />
+    <Exec Command="$(PythonForBuild) Tools\scripts\generate_opcode_h.py Lib\opcode.py Include\opcode.h"
+          WorkingDirectory="$(PySourcePath)" />
+    <Exec Command="$(PythonForBuild) Python\makeopcodetargets.py Python\opcode_targets.h"
+          WorkingDirectory="$(PySourcePath)" />
+  </Target>
+
+  <Target Name="_RegenTokens" Inputs="@(_TokenSources)" Outputs="@(_TokenOutputs)">
+    <Message Text="Regenerate @(_TokenOutputs->'%(Filename)%(Extension)',' ')" Importance="high" />
+    <Exec Command="$(PythonForBuild) Tools\scripts\generate_token.py %(_TokenOutputs.Format) Grammar\Tokens &quot;%(_TokenOutputs.Identity)&quot;"
+          WorkingDirectory="$(PySourcePath)" />
+    <Touch Files="@(_TokenOutputs)" />
+  </Target>
+
+  <Target Name="_RegenKeywords" Inputs="@(_KeywordSources)" Outputs="@(_KeywordOutputs)">
+    <Message Text="Regenerate @(_KeywordOutputs->'%(Filename)%(Extension)',' ')" Importance="high" />
+    <Exec Command="set PYTHONPATH=Tools\peg_generator%0D%0A$(PythonForBuild) -m pegen.keywordgen Grammar\python.gram Grammar\Tokens Lib\keyword.py"
+          WorkingDirectory="$(PySourcePath)" />
+  </Target>
+
+  <Target Name="Regen"
+          Condition="$(Configuration) != 'PGUpdate'"
+          DependsOnTargets="_TouchRegenSources;_RegenPegen;_RegenAST_H;_RegenOpcodes;_RegenTokens;_RegenKeywords">
+    <Message Text="Generated sources are up to date" Importance="high" />
+  </Target>
+
+
+  <ItemGroup>
+    <_LicenseSources Include="$(PySourcePath)LICENSE;
+                              $(PySourcePath)PC\crtlicense.txt;
+                              $(bz2Dir)LICENSE;
+                              $(opensslOutDir)LICENSE;
+                              $(libffiDir)LICENSE;" />
+    <_LicenseSources Include="$(tcltkDir)tcllicense.terms;
+                              $(tcltkDir)tklicense.terms;
+                              $(tcltkDir)tixlicense.terms" Condition="$(IncludeTkinter)" />
+  </ItemGroup>
+
+  <Target Name="_RegenLicense">
+    <ItemGroup>
+      <_Text1 Include="@(_LicenseSources)">
+        <Content Condition="Exists(%(FullPath))">$([System.IO.File]::ReadAllText(%(FullPath)))</Content>
+      </_Text1>
+      <_Text Include="@(_Text1->'%(Content)')" />
+    </ItemGroup>
+
+    <WriteLinesToFile File="$(OutDir)LICENSE.txt" Overwrite="true" Lines="@(_Text)" />
+    <Warning Text="License file %(_LicenseSources.FullPath) is missing"
+             Condition="!Exists(@(_LicenseSources))" />
+    <Message Text="Wrote $(OutDir)LICENSE.txt" Importance="high" />
+  </Target>
+
+  <Target Name="PostBuildRegen" DependsOnTargets="_RegenLicense" />
+</Project>
diff --git a/PCbuild/regen.vcxproj b/PCbuild/regen.vcxproj
deleted file mode 100644
index 564a4dd..0000000
--- a/PCbuild/regen.vcxproj
+++ /dev/null
@@ -1,230 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="Debug|ARM">
-      <Configuration>Debug</Configuration>
-      <Platform>ARM</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|Win32">
-      <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|x64">
-      <Configuration>Debug</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="PGInstrument|ARM">
-      <Configuration>PGInstrument</Configuration>
-      <Platform>ARM</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="PGInstrument|Win32">
-      <Configuration>PGInstrument</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="PGInstrument|x64">
-      <Configuration>PGInstrument</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="PGUpdate|ARM">
-      <Configuration>PGUpdate</Configuration>
-      <Platform>ARM</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="PGUpdate|Win32">
-      <Configuration>PGUpdate</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="PGUpdate|x64">
-      <Configuration>PGUpdate</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|ARM">
-      <Configuration>Release</Configuration>
-      <Platform>ARM</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
-      <Configuration>Release</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|x64">
-      <Configuration>Release</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-  </ItemGroup>
-  <PropertyGroup Label="Globals">
-    <ProjectGuid>{21CF2108-2CC9-4005-A6ED-B7965ADE3854}</ProjectGuid>
-    <Keyword>Win32Proj</Keyword>
-    <RootNamespace>regen</RootNamespace>
-    <SupportPGO>false</SupportPGO>
-    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
-  </PropertyGroup>
-  <Import Project="python.props" />
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
-  <PropertyGroup Label="Configuration">
-    <ConfigurationType>Utility</ConfigurationType>
-    <CharacterSet>Unicode</CharacterSet>
-  </PropertyGroup>
-  <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <PlatformToolset>v142</PlatformToolset>
-  </PropertyGroup>
-  <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
-    <PlatformToolset>v142</PlatformToolset>
-  </PropertyGroup>
-  <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-    <PlatformToolset>v142</PlatformToolset>
-  </PropertyGroup>
-  <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <PlatformToolset>v142</PlatformToolset>
-  </PropertyGroup>
-  <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
-    <PlatformToolset>v142</PlatformToolset>
-  </PropertyGroup>
-  <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-    <PlatformToolset>v142</PlatformToolset>
-  </PropertyGroup>
-  <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='PGUpdate|x64'">
-    <PlatformToolset>v142</PlatformToolset>
-  </PropertyGroup>
-  <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='PGUpdate|ARM'">
-    <PlatformToolset>v142</PlatformToolset>
-  </PropertyGroup>
-  <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='PGUpdate|Win32'">
-    <PlatformToolset>v142</PlatformToolset>
-  </PropertyGroup>
-  <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='PGInstrument|ARM'">
-    <PlatformToolset>v142</PlatformToolset>
-  </PropertyGroup>
-  <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='PGInstrument|x64'">
-    <PlatformToolset>v142</PlatformToolset>
-  </PropertyGroup>
-  <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='PGInstrument|Win32'">
-    <PlatformToolset>v142</PlatformToolset>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
-  <ImportGroup Label="ExtensionSettings">
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-    <Import Project="pyproject.props" />
-  </ImportGroup>
-  <PropertyGroup Label="UserMacros" />
-  <ItemDefinitionGroup>
-    <ClCompile>
-      <PreprocessorDefinitions>_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <Link>
-      <SubSystem>Console</SubSystem>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemGroup>
-    <ClCompile Include="..\Programs\_freeze_importlib.c" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="pythoncore.vcxproj">
-      <Project>{cf7ac3d1-e2df-41d2-bea6-1e2556cdea26}</Project>
-      <Private>true</Private>
-      <ReferenceOutputAssembly>true</ReferenceOutputAssembly>
-      <CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
-      <LinkLibraryDependencies>true</LinkLibraryDependencies>
-      <UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
-    </ProjectReference>
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="..\Grammar\Grammar">
-    </None>
-    <None Include="..\Grammar\Tokens">
-    </None>
-    <None Include="..\Include\graminit.h">
-    </None>
-    <None Include="..\Python\graminit.c">
-    </None>
-    <None Include="..\Include\token.h">
-    </None>
-    <None Include="..\Include\opcode.h">
-    </None>
-    <None Include="..\Include\Python-ast.h">
-    </None>
-    <None Include="..\Python\Python-ast.c">
-    </None>
-    <None Include="..\Lib\keyword.py">
-    </None>
-    <None Include="..\Lib\symbol.py">
-    </None>
-    <None Include="..\Doc\library\token-list.inc">
-    </None>
-  </ItemGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-  <ImportGroup Label="ExtensionTargets">
-  </ImportGroup>
-  <Target Name="_RegenGrammar" BeforeTargets="Build">
-    <!-- Regenerate Include/graminit.h and Python/graminit.c from Grammar/Grammar using pgen-->
-    <Exec Command="&quot;$(PythonExe)&quot; -m Parser.pgen &quot;$(PySourcePath)Grammar\Grammar&quot; &quot;$(PySourcePath)Grammar\Tokens&quot; &quot;$(IntDir)graminit.h&quot; &quot;$(IntDir)graminit.c&quot;" />
-    <Copy SourceFiles="$(IntDir)graminit.h" DestinationFiles="$(PySourcePath)Include\graminit.h">
-      <Output TaskParameter="CopiedFiles" ItemName="_UpdatedH" />
-    </Copy>
-    <Copy SourceFiles="$(IntDir)graminit.c" DestinationFiles="$(PySourcePath)Python\graminit.c">
-      <Output TaskParameter="CopiedFiles" ItemName="_UpdatedC" />
-    </Copy>
-    <Warning Text="Grammar updated. You will need to rebuild pythoncore to see the changes." Condition="'@(_UpdatedH)' != '' and '@(_UpdatedC)' != ''" />
-  </Target>
-  <Target Name="_RegenPegen" BeforeTargets="Build">
-    <!-- Regenerate Parser/pegen/parse.c -->
-    <SetEnv Name="PYTHONPATH" Prefix="true" Value="$(PySourcePath)Tools\peg_generator\" />
-    <Exec Command="&quot;$(PythonExe)&quot; -m pegen -q c &quot;$(PySourcePath)Grammar\python.gram&quot; &quot;$(PySourcePath)Grammar\Tokens&quot; -o &quot;$(IntDir)parse.c&quot;" />
-    <Copy SourceFiles="$(IntDir)parse.c" DestinationFiles="$(PySourcePath)Parser\pegen\parse.c">
-      <Output TaskParameter="CopiedFiles" ItemName="_UpdatedParse" />
-    </Copy>
-    <Warning Text="Pegen updated. You will need to rebuild pythoncore to see the changes." Condition="'@(_UpdatedParse)' != ''" />
-  </Target>
-  <Target Name="_RegenAST_H" AfterTargets="_RegenGrammar">
-    <!-- Regenerate Include/Python-ast.h and Python/Python-ast.c using Parser/asdl_c.py -h -->
-    <Exec Command="&quot;$(PythonExe)&quot; &quot;$(PySourcePath)Parser\asdl_c.py&quot; &quot;$(PySourcePath)Parser\Python.asdl&quot; -H &quot;$(IntDir)Python-ast.h&quot; -C &quot;$(IntDir)Python-ast.c&quot;" />
-    <Copy SourceFiles="$(IntDir)Python-ast.h" DestinationFiles="$(PySourcePath)Include\Python-ast.h">
-      <Output TaskParameter="CopiedFiles" ItemName="_UpdatedH" />
-    </Copy>
-    <Copy SourceFiles="$(IntDir)Python-ast.c" DestinationFiles="$(PySourcePath)Python\Python-ast.c">
-      <Output TaskParameter="CopiedFiles" ItemName="_UpdatedC" />
-    </Copy>
-    <Warning Text="ASDL is updated. You will need to rebuild pythoncore to see the changes." Condition="'@(_UpdatedH)' != '' and '@(_UpdatedC)' != ''" />
-  </Target>
-  <Target Name="_RegenOpcodes" AfterTargets="_RegenAST_C">
-    <!-- Regenerate Include/opcode.h from Lib/opcode.py using Tools/scripts/generate_opcode_h.py-->
-    <Exec Command="&quot;$(PythonExe)&quot; $(PySourcePath)Tools\scripts\generate_opcode_h.py &quot;$(PySourcePath)Lib\opcode.py&quot; &quot;$(IntDir)opcode.h&quot;" />
-    <Copy SourceFiles="$(IntDir)opcode.h" DestinationFiles="$(PySourcePath)Include\opcode.h">
-      <Output TaskParameter="CopiedFiles" ItemName="_Updated" />
-    </Copy>
-    <Warning Text="Opcodes updated. You will need to rebuild pythoncore to see the changes." Condition="'@(_Updated)' != ''" />
-  </Target>
-  <Target Name="_RegenTokens" AfterTargets="_RegenOpcodes">
-    <!-- Regenerate Doc/library/token-list.inc from Grammar/Tokens using Tools/scripts/generate_token.py-->
-    <Exec Command="&quot;$(PythonExe)&quot; $(PySourcePath)Tools\scripts\generate_token.py rst &quot;$(PySourcePath)Grammar\Tokens&quot; &quot;$(PySourcePath)Doc\library\token-list.inc&quot;" />
-    <!-- Regenerate Include/token.h from Grammar/Tokens using Tools/scripts/generate_token.py-->
-    <Exec Command="&quot;$(PythonExe)&quot; $(PySourcePath)Tools\scripts\generate_token.py h &quot;$(PySourcePath)Grammar\Tokens&quot; &quot;$(PySourcePath)Include\token.h&quot;" />
-    <!-- Regenerate Parser/token.c from Grammar/Tokens using Tools/scripts/generate_token.py-->
-    <Exec Command="&quot;$(PythonExe)&quot; $(PySourcePath)Tools\scripts\generate_token.py c &quot;$(PySourcePath)Grammar\Tokens&quot; &quot;$(PySourcePath)Parser\token.c&quot;" />
-    <!-- Regenerate Lib/token.py from Grammar/Tokens using Tools/scripts/generate_token.py -->
-    <Exec Command="&quot;$(PythonExe)&quot; $(PySourcePath)Tools\scripts\generate_token.py py &quot;$(PySourcePath)Grammar\Tokens&quot; &quot;$(PySourcePath)Lib\token.py&quot;" />
-  </Target>
-  <Target Name="_RegenKeywords" AfterTargets="_RegenTokens">
-    <!-- Regenerate Lib/keyword.py from Grammar/python.gram and Grammar/Tokens using Tools/peg_generator/pegen-->
-    <SetEnv Name="PYTHONPATH" Prefix="true" Value="$(PySourcePath)Tools\peg_generator\" />
-    <Exec Command="&quot;$(PythonExe)&quot; -m pegen.keywordgen &quot;$(PySourcePath)Grammar\python.gram&quot; &quot;$(PySourcePath)Grammar\Tokens&quot; &quot;$(IntDir)keyword.py&quot;" />
-    <Copy SourceFiles="$(IntDir)keyword.py" DestinationFiles="$(PySourcePath)Lib\keyword.py">
-      <Output TaskParameter="CopiedFiles" ItemName="_Updated" />
-    </Copy>
-    <Warning Text="Keywords updated. You will need to rebuild pythoncore to see the changes." Condition="'@(_Updated)' != ''" />
-  </Target>
-  <Target Name="_RegenSymbols" AfterTargets="_RegenKeywords">
-    <!-- Regenerate Lib/symbol.py from Include/graminit.h using Tools/scripts/generate_symbol_py.py-->
-    <Exec Command="&quot;$(PythonExe)&quot; $(PySourcePath)Tools\scripts\generate_symbol_py.py &quot;$(PySourcePath)Include\graminit.h&quot;  &quot;$(PySourcePath)Lib\symbol.py&quot;" />
-  </Target>
-  <Target Name="_CleanFiles" BeforeTargets="CoreClean">
-    <ItemGroup>
-      <Clean Include="$(IntDir)keyword.py" />
-      <Clean Include="$(IntDir)opcode.h" />
-      <Clean Include="$(IntDir)Python-ast.c" />
-      <Clean Include="$(IntDir)Python-ast.h" />
-      <Clean Include="$(IntDir)graminit.h.new" />
-      <Clean Include="$(IntDir)graminit.c.new" />
-    </ItemGroup>
-  </Target>
-</Project>
diff --git a/PCbuild/sqlite3.vcxproj b/PCbuild/sqlite3.vcxproj
index 7351a6d..e39e2d9 100644
--- a/PCbuild/sqlite3.vcxproj
+++ b/PCbuild/sqlite3.vcxproj
@@ -98,7 +98,7 @@
   <ItemDefinitionGroup>
     <ClCompile>
       <AdditionalIncludeDirectories>$(sqlite3Dir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>SQLITE_ENABLE_JSON1;SQLITE_ENABLE_FTS4;SQLITE_ENABLE_FTS5;SQLITE_API=__declspec(dllexport);%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>SQLITE_ENABLE_MATH_FUNCTIONS;SQLITE_ENABLE_JSON1;SQLITE_ENABLE_FTS4;SQLITE_ENABLE_FTS5;SQLITE_ENABLE_RTREE;SQLITE_API=__declspec(dllexport);%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <WarningLevel>Level1</WarningLevel>
     </ClCompile>
     <ResourceCompile>
diff --git a/PCbuild/tcltk.props b/PCbuild/tcltk.props
index 7fcd3e1..16dc35d 100644
--- a/PCbuild/tcltk.props
+++ b/PCbuild/tcltk.props
@@ -4,7 +4,7 @@
   <PropertyGroup>
     <TclMajorVersion>8</TclMajorVersion>
     <TclMinorVersion>6</TclMinorVersion>
-    <TclPatchLevel>9</TclPatchLevel>
+    <TclPatchLevel>12</TclPatchLevel>
     <TclRevision>0</TclRevision>
     <TkMajorVersion>$(TclMajorVersion)</TkMajorVersion>
     <TkMinorVersion>$(TclMinorVersion)</TkMinorVersion>
@@ -36,8 +36,7 @@
     <BuildDirTop>Release</BuildDirTop>
     <BuildDirTop Condition="$(Configuration) == 'Debug'">Debug</BuildDirTop>
     <BuildDirTop Condition="$(TclMachine) != 'IX86'">$(BuildDirTop)_$(TclMachine)</BuildDirTop>
-    <BuildDirTop Condition="$(PlatformToolset) == 'v141'">$(BuildDirTop)_VC13</BuildDirTop>
-    <BuildDirTop Condition="$(PlatformToolset) == 'v140'">$(BuildDirTop)_VC13</BuildDirTop>
+    <BuildDirTop Condition="$(PlatformToolset.StartsWith('v14'))">$(BuildDirTop)_VC13</BuildDirTop>
     <BuildDirTop Condition="$(PlatformToolset) == 'v120'">$(BuildDirTop)_VC12</BuildDirTop>
     <BuildDirTop Condition="$(PlatformToolset) == 'v110'">$(BuildDirTop)_VC11</BuildDirTop>
     <BuildDirTop Condition="$(PlatformToolset) == 'v100'">$(BuildDirTop)_VC10</BuildDirTop>
diff --git a/PCbuild/xxlimited.vcxproj b/PCbuild/xxlimited.vcxproj
index 776335a..1c776fb 100644
--- a/PCbuild/xxlimited.vcxproj
+++ b/PCbuild/xxlimited.vcxproj
@@ -93,9 +93,6 @@
     <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
   </PropertyGroup>
   <ItemDefinitionGroup>
-    <ClCompile>
-      <PreprocessorDefinitions>%(PreprocessorDefinitions);Py_LIMITED_API=0x03060000</PreprocessorDefinitions>
-    </ClCompile>
     <Link>
       <AdditionalDependencies>wsock32.lib;%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
@@ -111,4 +108,4 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
-</Project>
\ No newline at end of file
+</Project>
diff --git a/PCbuild/xxlimited_35.vcxproj b/PCbuild/xxlimited_35.vcxproj
new file mode 100644
index 0000000..dd830b3
--- /dev/null
+++ b/PCbuild/xxlimited_35.vcxproj
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|ARM">
+      <Configuration>Debug</Configuration>
+      <Platform>ARM</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|ARM64">
+      <Configuration>Debug</Configuration>
+      <Platform>ARM64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="PGInstrument|ARM">
+      <Configuration>PGInstrument</Configuration>
+      <Platform>ARM</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="PGInstrument|ARM64">
+      <Configuration>PGInstrument</Configuration>
+      <Platform>ARM64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="PGInstrument|Win32">
+      <Configuration>PGInstrument</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="PGInstrument|x64">
+      <Configuration>PGInstrument</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="PGUpdate|ARM">
+      <Configuration>PGUpdate</Configuration>
+      <Platform>ARM</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="PGUpdate|ARM64">
+      <Configuration>PGUpdate</Configuration>
+      <Platform>ARM64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="PGUpdate|Win32">
+      <Configuration>PGUpdate</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="PGUpdate|x64">
+      <Configuration>PGUpdate</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|ARM">
+      <Configuration>Release</Configuration>
+      <Platform>ARM</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|ARM64">
+      <Configuration>Release</Configuration>
+      <Platform>ARM64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{fb868ea7-f93a-4d9b-be78-ca4e9ba14fff}</ProjectGuid>
+    <RootNamespace>xxlimited_35</RootNamespace>
+    <Keyword>Win32Proj</Keyword>
+  </PropertyGroup>
+  <Import Project="python.props" />
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <CharacterSet>NotSet</CharacterSet>
+    <SupportPGO>false</SupportPGO>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <PropertyGroup>
+    <TargetExt>.pyd</TargetExt>
+  </PropertyGroup>
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="pyproject.props" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup>
+    <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+  </PropertyGroup>
+  <ItemDefinitionGroup>
+    <Link>
+      <AdditionalDependencies>wsock32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="..\Modules\xxlimited_35.c" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="python3dll.vcxproj">
+      <Project>{885d4898-d08d-4091-9c40-c700cfe3fc5a}</Project>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
diff --git a/PCbuild/xxlimited_35.vcxproj.filters b/PCbuild/xxlimited_35.vcxproj.filters
new file mode 100644
index 0000000..35bfb05
--- /dev/null
+++ b/PCbuild/xxlimited_35.vcxproj.filters
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Source Files">
+      <UniqueIdentifier>{5be27194-6530-452d-8d86-3767b991fa83}</UniqueIdentifier>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="..\Modules\xxlimited_35.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+  </ItemGroup>
+</Project>
diff --git a/Parser/Python.asdl b/Parser/Python.asdl
index 889712b..32fdc01 100644
--- a/Parser/Python.asdl
+++ b/Parser/Python.asdl
@@ -36,6 +36,8 @@
           | With(withitem* items, stmt* body, string? type_comment)
           | AsyncWith(withitem* items, stmt* body, string? type_comment)
 
+          | Match(expr subject, match_case* cases)
+
           | Raise(expr? exc, expr? cause)
           | Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)
           | Assert(expr test, expr? msg)
@@ -72,7 +74,7 @@
          -- x < 4 < 3 and (x < 4) < 3
          | Compare(expr left, cmpop* ops, expr* comparators)
          | Call(expr func, expr* args, keyword* keywords)
-         | FormattedValue(expr value, int? conversion, expr? format_spec)
+         | FormattedValue(expr value, int conversion, expr? format_spec)
          | JoinedStr(expr* values)
          | Constant(constant value, string? kind)
 
@@ -118,8 +120,25 @@
 
     -- import name with optional 'as' alias.
     alias = (identifier name, identifier? asname)
+             attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset)
 
     withitem = (expr context_expr, expr? optional_vars)
 
+    match_case = (pattern pattern, expr? guard, stmt* body)
+
+    pattern = MatchValue(expr value)
+            | MatchSingleton(constant value)
+            | MatchSequence(pattern* patterns)
+            | MatchMapping(expr* keys, pattern* patterns, identifier? rest)
+            | MatchClass(expr cls, pattern* patterns, identifier* kwd_attrs, pattern* kwd_patterns)
+
+            | MatchStar(identifier? name)
+            -- The optional "rest" MatchMapping parameter handles capturing extra mapping keys
+
+            | MatchAs(pattern? pattern, identifier? name)
+            | MatchOr(pattern* patterns)
+
+             attributes (int lineno, int col_offset, int end_lineno, int end_col_offset)
+
     type_ignore = TypeIgnore(int lineno, string tag)
 }
diff --git a/Parser/acceler.c b/Parser/acceler.c
deleted file mode 100644
index e515833..0000000
--- a/Parser/acceler.c
+++ /dev/null
@@ -1,123 +0,0 @@
-
-/* Parser accelerator module */
-
-/* The parser as originally conceived had disappointing performance.
-   This module does some precomputation that speeds up the selection
-   of a DFA based upon a token, turning a search through an array
-   into a simple indexing operation.  The parser now cannot work
-   without the accelerators installed.  Note that the accelerators
-   are installed dynamically when the parser is initialized, they
-   are not part of the static data structure written on graminit.[ch]
-   by the parser generator. */
-
-#include "Python.h"
-#include "grammar.h"
-#include "node.h"
-#include "token.h"
-#include "parser.h"
-
-/* Forward references */
-static void fixdfa(grammar *, const dfa *);
-static void fixstate(grammar *, state *);
-
-void
-PyGrammar_AddAccelerators(grammar *g)
-{
-    int i;
-    const dfa *d = g->g_dfa;
-    for (i = g->g_ndfas; --i >= 0; d++)
-        fixdfa(g, d);
-    g->g_accel = 1;
-}
-
-void
-PyGrammar_RemoveAccelerators(grammar *g)
-{
-    int i;
-    g->g_accel = 0;
-    const dfa *d = g->g_dfa;
-    for (i = g->g_ndfas; --i >= 0; d++) {
-        state *s;
-        int j;
-        s = d->d_state;
-        for (j = 0; j < d->d_nstates; j++, s++) {
-            if (s->s_accel)
-                PyObject_FREE(s->s_accel);
-            s->s_accel = NULL;
-        }
-    }
-}
-
-static void
-fixdfa(grammar *g, const dfa *d)
-{
-    state *s;
-    int j;
-    s = d->d_state;
-    for (j = 0; j < d->d_nstates; j++, s++)
-        fixstate(g, s);
-}
-
-static void
-fixstate(grammar *g, state *s)
-{
-    const arc *a;
-    int k;
-    int *accel;
-    int nl = g->g_ll.ll_nlabels;
-    s->s_accept = 0;
-    accel = (int *) PyObject_MALLOC(nl * sizeof(int));
-    if (accel == NULL) {
-        fprintf(stderr, "no mem to build parser accelerators\n");
-        exit(1);
-    }
-    for (k = 0; k < nl; k++)
-        accel[k] = -1;
-    a = s->s_arc;
-    for (k = s->s_narcs; --k >= 0; a++) {
-        int lbl = a->a_lbl;
-        const label *l = &g->g_ll.ll_label[lbl];
-        int type = l->lb_type;
-        if (a->a_arrow >= (1 << 7)) {
-            printf("XXX too many states!\n");
-            continue;
-        }
-        if (ISNONTERMINAL(type)) {
-            const dfa *d1 = PyGrammar_FindDFA(g, type);
-            int ibit;
-            if (type - NT_OFFSET >= (1 << 7)) {
-                printf("XXX too high nonterminal number!\n");
-                continue;
-            }
-            for (ibit = 0; ibit < g->g_ll.ll_nlabels; ibit++) {
-                if (testbit(d1->d_first, ibit)) {
-                    if (accel[ibit] != -1)
-                        printf("XXX ambiguity!\n");
-                    accel[ibit] = a->a_arrow | (1 << 7) |
-                        ((type - NT_OFFSET) << 8);
-                }
-            }
-        }
-        else if (lbl == EMPTY)
-            s->s_accept = 1;
-        else if (lbl >= 0 && lbl < nl)
-            accel[lbl] = a->a_arrow;
-    }
-    while (nl > 0 && accel[nl-1] == -1)
-        nl--;
-    for (k = 0; k < nl && accel[k] == -1;)
-        k++;
-    if (k < nl) {
-        int i;
-        s->s_accel = (int *) PyObject_MALLOC((nl-k) * sizeof(int));
-        if (s->s_accel == NULL) {
-            fprintf(stderr, "no mem to add parser accelerators\n");
-            exit(1);
-        }
-        s->s_lower = k;
-        s->s_upper = nl;
-        for (i = 0; k < nl; i++, k++)
-            s->s_accel[i] = accel[k];
-    }
-    PyObject_FREE(accel);
-}
diff --git a/Parser/asdl.py b/Parser/asdl.py
index 7f50948..e3e6c34 100644
--- a/Parser/asdl.py
+++ b/Parser/asdl.py
@@ -204,7 +204,7 @@
 
 def parse(filename):
     """Parse ASDL from the given file and return a Module node describing it."""
-    with open(filename) as f:
+    with open(filename, encoding="utf-8") as f:
         parser = ASDLParser()
         return parser.parse(f.read())
 
diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py
index 6f3154a..4e5c5c8 100755
--- a/Parser/asdl_c.py
+++ b/Parser/asdl_c.py
@@ -3,15 +3,17 @@
 
 import os
 import sys
+import textwrap
 
 from argparse import ArgumentParser
+from contextlib import contextmanager
 from pathlib import Path
 
 import asdl
 
 TABSIZE = 4
 MAX_COL = 80
-AUTOGEN_MESSAGE = "/* File automatically generated by {}. */\n\n"
+AUTOGEN_MESSAGE = "// File automatically generated by {}.\n\n"
 
 def get_c_type(name):
     """Return a string for the C name of the type.
@@ -163,6 +165,32 @@
         self.emit(s, depth)
         self.emit("", depth)
 
+class SequenceDefVisitor(EmitVisitor):
+    def visitModule(self, mod):
+        for dfn in mod.dfns:
+            self.visit(dfn)
+
+    def visitType(self, type, depth=0):
+        self.visit(type.value, type.name, depth)
+
+    def visitSum(self, sum, name, depth):
+        if is_simple(sum):
+            return
+        self.emit_sequence_constructor(name, depth)
+
+    def emit_sequence_constructor(self, name,depth):
+        ctype = get_c_type(name)
+        self.emit("""\
+typedef struct {
+    _ASDL_SEQ_HEAD
+    %(ctype)s typed_elements[1];
+} asdl_%(name)s_seq;""" % locals(), reflow=False, depth=depth)
+        self.emit("", depth)
+        self.emit("asdl_%(name)s_seq *_Py_asdl_%(name)s_seq_new(Py_ssize_t size, PyArena *arena);" % locals(), depth)
+        self.emit("", depth)
+
+    def visitProduct(self, product, name, depth):
+        self.emit_sequence_constructor(name, depth)
 
 class StructVisitor(EmitVisitor):
     """Visitor to generate typedefs for AST."""
@@ -219,7 +247,8 @@
             if field.type == 'cmpop':
                 self.emit("asdl_int_seq *%(name)s;" % locals(), depth)
             else:
-                self.emit("asdl_seq *%(name)s;" % locals(), depth)
+                _type = field.type
+                self.emit("asdl_%(_type)s_seq *%(name)s;" % locals(), depth)
         else:
             self.emit("%(ctype)s %(name)s;" % locals(), depth)
 
@@ -236,6 +265,10 @@
         self.emit("", depth)
 
 
+def ast_func_name(name):
+    return f"_PyAST_{name}"
+
+
 class PrototypeVisitor(EmitVisitor):
     """Generate function prototypes for the .h file"""
 
@@ -274,7 +307,7 @@
                 if f.type == 'cmpop':
                     ctype = "asdl_int_seq *"
                 else:
-                    ctype = "asdl_seq *"
+                    ctype = f"asdl_{f.type}_seq *"
             else:
                 ctype = get_c_type(f.type)
             args.append((ctype, name, f.opt or f.seq))
@@ -294,12 +327,7 @@
             argstr += ", PyArena *arena"
         else:
             argstr = "PyArena *arena"
-        margs = "a0"
-        for i in range(1, len(args)+1):
-            margs += ", a%d" % i
-        self.emit("#define %s(%s) _Py_%s(%s)" % (name, margs, name, margs), 0,
-                reflow=False)
-        self.emit("%s _Py_%s(%s);" % (ctype, name, argstr), False)
+        self.emit("%s %s(%s);" % (ctype, ast_func_name(name), argstr), False)
 
     def visitProduct(self, prod, name):
         self.emit_function(name, get_c_type(name),
@@ -321,7 +349,7 @@
         else:
             argstr = "PyArena *arena"
         self.emit("%s" % ctype, 0)
-        emit("%s(%s)" % (name, argstr))
+        emit("%s(%s)" % (ast_func_name(name), argstr))
         emit("{")
         emit("%s p;" % ctype, 1)
         for argtype, argname, opt in args:
@@ -334,7 +362,7 @@
                 emit('return NULL;', 2)
                 emit('}', 1)
 
-        emit("p = (%s)PyArena_Malloc(arena, sizeof(*p));" % ctype, 1);
+        emit("p = (%s)_PyArena_Malloc(arena, sizeof(*p));" % ctype, 1);
         emit("if (!p)", 1)
         emit("return NULL;", 2)
         if union:
@@ -387,17 +415,25 @@
 
 class Obj2ModPrototypeVisitor(PickleVisitor):
     def visitProduct(self, prod, name):
-        code = "static int obj2ast_%s(astmodulestate *state, PyObject* obj, %s* out, PyArena* arena);"
+        code = "static int obj2ast_%s(struct ast_state *state, PyObject* obj, %s* out, PyArena* arena);"
         self.emit(code % (name, get_c_type(name)), 0)
 
     visitSum = visitProduct
 
 
 class Obj2ModVisitor(PickleVisitor):
+    @contextmanager
+    def recursive_call(self, node, level):
+        self.emit('if (Py_EnterRecursiveCall(" while traversing \'%s\' node")) {' % node, level, reflow=False)
+        self.emit('goto failed;', level + 1)
+        self.emit('}', level)
+        yield
+        self.emit('Py_LeaveRecursiveCall();', level)
+
     def funcHeader(self, name):
         ctype = get_c_type(name)
         self.emit("int", 0)
-        self.emit("obj2ast_%s(astmodulestate *state, PyObject* obj, %s* out, PyArena* arena)" % (name, ctype), 0)
+        self.emit("obj2ast_%s(struct ast_state *state, PyObject* obj, %s* out, PyArena* arena)" % (name, ctype), 0)
         self.emit("{", 0)
         self.emit("int isinstance;", 1)
         self.emit("", 0)
@@ -460,7 +496,7 @@
             for f in t.fields:
                 self.visitField(f, t.name, sum=sum, depth=2)
             args = [f.name for f in t.fields] + [a.name for a in sum.attributes]
-            self.emit("*out = %s(%s);" % (t.name, self.buildArgs(args)), 2)
+            self.emit("*out = %s(%s);" % (ast_func_name(t.name), self.buildArgs(args)), 2)
             self.emit("if (*out == NULL) goto failed;", 2)
             self.emit("return 0;", 2)
             self.emit("}", 1)
@@ -479,7 +515,7 @@
     def visitProduct(self, prod, name):
         ctype = get_c_type(name)
         self.emit("int", 0)
-        self.emit("obj2ast_%s(astmodulestate *state, PyObject* obj, %s* out, PyArena* arena)" % (name, ctype), 0)
+        self.emit("obj2ast_%s(struct ast_state *state, PyObject* obj, %s* out, PyArena* arena)" % (name, ctype), 0)
         self.emit("{", 0)
         self.emit("PyObject* tmp = NULL;", 1)
         for f in prod.fields:
@@ -493,7 +529,7 @@
             self.visitField(a, name, prod=prod, depth=1)
         args = [f.name for f in prod.fields]
         args.extend([a.name for a in prod.attributes])
-        self.emit("*out = %s(%s);" % (name, self.buildArgs(args)), 1)
+        self.emit("*out = %s(%s);" % (ast_func_name(name), self.buildArgs(args)), 1)
         self.emit("return 0;", 1)
         self.emit("failed:", 0)
         self.emit("Py_XDECREF(tmp);", 1)
@@ -507,7 +543,8 @@
             if self.isSimpleType(field):
                 self.emit("asdl_int_seq* %s;" % field.name, depth)
             else:
-                self.emit("asdl_seq* %s;" % field.name, depth)
+                _type = field.type
+                self.emit(f"asdl_{field.type}_seq* {field.name};", depth)
         else:
             ctype = get_c_type(field.type)
             self.emit("%s %s;" % (ctype, field.name), depth)
@@ -562,14 +599,15 @@
             if self.isSimpleType(field):
                 self.emit("%s = _Py_asdl_int_seq_new(len, arena);" % field.name, depth+1)
             else:
-                self.emit("%s = _Py_asdl_seq_new(len, arena);" % field.name, depth+1)
+                self.emit("%s = _Py_asdl_%s_seq_new(len, arena);" % (field.name, field.type), depth+1)
             self.emit("if (%s == NULL) goto failed;" % field.name, depth+1)
             self.emit("for (i = 0; i < len; i++) {", depth+1)
             self.emit("%s val;" % ctype, depth+2)
             self.emit("PyObject *tmp2 = PyList_GET_ITEM(tmp, i);", depth+2)
             self.emit("Py_INCREF(tmp2);", depth+2)
-            self.emit("res = obj2ast_%s(state, tmp2, &val, arena);" %
-                      field.type, depth+2, reflow=False)
+            with self.recursive_call(name, depth+2):
+                self.emit("res = obj2ast_%s(state, tmp2, &val, arena);" %
+                          field.type, depth+2, reflow=False)
             self.emit("Py_DECREF(tmp2);", depth+2)
             self.emit("if (res != 0) goto failed;", depth+2)
             self.emit("if (len != PyList_GET_SIZE(tmp)) {", depth+2)
@@ -582,29 +620,38 @@
             self.emit("asdl_seq_SET(%s, i, val);" % field.name, depth+2)
             self.emit("}", depth+1)
         else:
-            self.emit("res = obj2ast_%s(state, tmp, &%s, arena);" %
-                      (field.type, field.name), depth+1)
+            with self.recursive_call(name, depth+1):
+                self.emit("res = obj2ast_%s(state, tmp, &%s, arena);" %
+                          (field.type, field.name), depth+1)
             self.emit("if (res != 0) goto failed;", depth+1)
 
         self.emit("Py_CLEAR(tmp);", depth+1)
         self.emit("}", depth)
 
 
-class MarshalPrototypeVisitor(PickleVisitor):
+class SequenceConstructorVisitor(EmitVisitor):
+    def visitModule(self, mod):
+        for dfn in mod.dfns:
+            self.visit(dfn)
 
-    def prototype(self, sum, name):
-        ctype = get_c_type(name)
-        self.emit("static int marshal_write_%s(PyObject **, int *, %s);"
-                  % (name, ctype), 0)
+    def visitType(self, type):
+        self.visit(type.value, type.name)
 
-    visitProduct = visitSum = prototype
+    def visitProduct(self, prod, name):
+        self.emit_sequence_constructor(name, get_c_type(name))
 
+    def visitSum(self, sum, name):
+        if not is_simple(sum):
+            self.emit_sequence_constructor(name, get_c_type(name))
+
+    def emit_sequence_constructor(self, name, type):
+        self.emit(f"GENERATE_ASDL_SEQ_CONSTRUCTOR({name}, {type})", depth=0)
 
 class PyTypesDeclareVisitor(PickleVisitor):
 
     def visitProduct(self, prod, name):
         self.emit_type("%s_type" % name)
-        self.emit("static PyObject* ast2obj_%s(astmodulestate *state, void*);" % name, 0)
+        self.emit("static PyObject* ast2obj_%s(struct ast_state *state, void*);" % name, 0)
         if prod.attributes:
             for a in prod.attributes:
                 self.emit_identifier(a.name)
@@ -634,7 +681,7 @@
             ptype = get_c_type(name)
             for t in sum.types:
                 self.emit_singleton("%s_singleton" % t.name)
-        self.emit("static PyObject* ast2obj_%s(astmodulestate *state, %s);" % (name, ptype), 0)
+        self.emit("static PyObject* ast2obj_%s(struct ast_state *state, %s);" % (name, ptype), 0)
         for t in sum.types:
             self.visitConstructor(t, name)
 
@@ -647,6 +694,7 @@
                 self.emit('"%s",' % t.name, 1)
             self.emit("};",0)
 
+
 class PyTypesVisitor(PickleVisitor):
 
     def visitModule(self, mod):
@@ -688,7 +736,7 @@
 static int
 ast_type_init(PyObject *self, PyObject *args, PyObject *kw)
 {
-    astmodulestate *state = get_global_ast_state();
+    struct ast_state *state = get_ast_state();
     if (state == NULL) {
         return -1;
     }
@@ -764,7 +812,7 @@
 static PyObject *
 ast_type_reduce(PyObject *self, PyObject *unused)
 {
-    astmodulestate *state = get_global_ast_state();
+    struct ast_state *state = get_ast_state();
     if (state == NULL) {
         return NULL;
     }
@@ -819,7 +867,7 @@
 };
 
 static PyObject *
-make_type(astmodulestate *state, const char *type, PyObject* base,
+make_type(struct ast_state *state, const char *type, PyObject* base,
           const char* const* fields, int num_fields, const char *doc)
 {
     PyObject *fnames, *result;
@@ -834,9 +882,10 @@
         }
         PyTuple_SET_ITEM(fnames, i, field);
     }
-    result = PyObject_CallFunction((PyObject*)&PyType_Type, "s(O){OOOOOs}",
+    result = PyObject_CallFunction((PyObject*)&PyType_Type, "s(O){OOOOOOOs}",
                     type, base,
                     state->_fields, fnames,
+                    state->__match_args__, fnames,
                     state->__module__,
                     state->ast,
                     state->__doc__, doc);
@@ -845,7 +894,7 @@
 }
 
 static int
-add_attributes(astmodulestate *state, PyObject *type, const char * const *attrs, int num_fields)
+add_attributes(struct ast_state *state, PyObject *type, const char * const *attrs, int num_fields)
 {
     int i, result;
     PyObject *s, *l = PyTuple_New(num_fields);
@@ -866,7 +915,7 @@
 
 /* Conversion AST -> Python */
 
-static PyObject* ast2obj_list(astmodulestate *state, asdl_seq *seq, PyObject* (*func)(astmodulestate *state, void*))
+static PyObject* ast2obj_list(struct ast_state *state, asdl_seq *seq, PyObject* (*func)(struct ast_state *state, void*))
 {
     Py_ssize_t i, n = asdl_seq_LEN(seq);
     PyObject *result = PyList_New(n);
@@ -874,7 +923,7 @@
     if (!result)
         return NULL;
     for (i = 0; i < n; i++) {
-        value = func(state, asdl_seq_GET(seq, i));
+        value = func(state, asdl_seq_GET_UNTYPED(seq, i));
         if (!value) {
             Py_DECREF(result);
             return NULL;
@@ -884,7 +933,7 @@
     return result;
 }
 
-static PyObject* ast2obj_object(astmodulestate *Py_UNUSED(state), void *o)
+static PyObject* ast2obj_object(struct ast_state *Py_UNUSED(state), void *o)
 {
     if (!o)
         o = Py_None;
@@ -895,19 +944,19 @@
 #define ast2obj_identifier ast2obj_object
 #define ast2obj_string ast2obj_object
 
-static PyObject* ast2obj_int(astmodulestate *Py_UNUSED(state), long b)
+static PyObject* ast2obj_int(struct ast_state *Py_UNUSED(state), long b)
 {
     return PyLong_FromLong(b);
 }
 
 /* Conversion Python -> AST */
 
-static int obj2ast_object(astmodulestate *Py_UNUSED(state), PyObject* obj, PyObject** out, PyArena* arena)
+static int obj2ast_object(struct ast_state *Py_UNUSED(state), PyObject* obj, PyObject** out, PyArena* arena)
 {
     if (obj == Py_None)
         obj = NULL;
     if (obj) {
-        if (PyArena_AddPyObject(arena, obj) < 0) {
+        if (_PyArena_AddPyObject(arena, obj) < 0) {
             *out = NULL;
             return -1;
         }
@@ -917,9 +966,9 @@
     return 0;
 }
 
-static int obj2ast_constant(astmodulestate *Py_UNUSED(state), PyObject* obj, PyObject** out, PyArena* arena)
+static int obj2ast_constant(struct ast_state *Py_UNUSED(state), PyObject* obj, PyObject** out, PyArena* arena)
 {
-    if (PyArena_AddPyObject(arena, obj) < 0) {
+    if (_PyArena_AddPyObject(arena, obj) < 0) {
         *out = NULL;
         return -1;
     }
@@ -928,7 +977,7 @@
     return 0;
 }
 
-static int obj2ast_identifier(astmodulestate *state, PyObject* obj, PyObject** out, PyArena* arena)
+static int obj2ast_identifier(struct ast_state *state, PyObject* obj, PyObject** out, PyArena* arena)
 {
     if (!PyUnicode_CheckExact(obj) && obj != Py_None) {
         PyErr_SetString(PyExc_TypeError, "AST identifier must be of type str");
@@ -937,7 +986,7 @@
     return obj2ast_object(state, obj, out, arena);
 }
 
-static int obj2ast_string(astmodulestate *state, PyObject* obj, PyObject** out, PyArena* arena)
+static int obj2ast_string(struct ast_state *state, PyObject* obj, PyObject** out, PyArena* arena)
 {
     if (!PyUnicode_CheckExact(obj) && !PyBytes_CheckExact(obj)) {
         PyErr_SetString(PyExc_TypeError, "AST string must be of type str");
@@ -946,7 +995,7 @@
     return obj2ast_object(state, obj, out, arena);
 }
 
-static int obj2ast_int(astmodulestate* Py_UNUSED(state), PyObject* obj, int* out, PyArena* arena)
+static int obj2ast_int(struct ast_state* Py_UNUSED(state), PyObject* obj, int* out, PyArena* arena)
 {
     int i;
     if (!PyLong_Check(obj)) {
@@ -961,12 +1010,13 @@
     return 0;
 }
 
-static int add_ast_fields(astmodulestate *state)
+static int add_ast_fields(struct ast_state *state)
 {
     PyObject *empty_tuple;
     empty_tuple = PyTuple_New(0);
     if (!empty_tuple ||
         PyObject_SetAttrString(state->AST_type, "_fields", empty_tuple) < 0 ||
+        PyObject_SetAttrString(state->AST_type, "__match_args__", empty_tuple) < 0 ||
         PyObject_SetAttrString(state->AST_type, "_attributes", empty_tuple) < 0) {
         Py_XDECREF(empty_tuple);
         return -1;
@@ -977,18 +1027,35 @@
 
 """, 0, reflow=False)
 
-        self.emit("static int init_types(astmodulestate *state)",0)
-        self.emit("{", 0)
-        self.emit("if (state->initialized) return 1;", 1)
-        self.emit("if (init_identifiers(state) < 0) return 0;", 1)
-        self.emit("state->AST_type = PyType_FromSpec(&AST_type_spec);", 1)
-        self.emit("if (!state->AST_type) return 0;", 1)
-        self.emit("if (add_ast_fields(state) < 0) return 0;", 1)
+        self.file.write(textwrap.dedent('''
+            static int
+            init_types(struct ast_state *state)
+            {
+                // init_types() must not be called after _PyAST_Fini()
+                // has been called
+                assert(state->initialized >= 0);
+
+                if (state->initialized) {
+                    return 1;
+                }
+                if (init_identifiers(state) < 0) {
+                    return 0;
+                }
+                state->AST_type = PyType_FromSpec(&AST_type_spec);
+                if (!state->AST_type) {
+                    return 0;
+                }
+                if (add_ast_fields(state) < 0) {
+                    return 0;
+                }
+        '''))
         for dfn in mod.dfns:
             self.visit(dfn)
-        self.emit("state->initialized = 1;", 1)
-        self.emit("return 1;", 1);
-        self.emit("}", 0)
+        self.file.write(textwrap.dedent('''
+                state->initialized = 1;
+                return 1;
+            }
+        '''))
 
     def visitProduct(self, prod, name):
         if prod.fields:
@@ -1056,16 +1123,13 @@
         self.emit("static int", 0)
         self.emit("astmodule_exec(PyObject *m)", 0)
         self.emit("{", 0)
-        self.emit('astmodulestate *state = get_ast_state(m);', 1)
-        self.emit("", 0)
-
-        self.emit("if (!init_types(state)) {", 1)
-        self.emit("return -1;", 2)
-        self.emit("}", 1)
-        self.emit('if (PyModule_AddObject(m, "AST", state->AST_type) < 0) {', 1)
+        self.emit('struct ast_state *state = get_ast_state();', 1)
+        self.emit('if (state == NULL) {', 1)
         self.emit('return -1;', 2)
         self.emit('}', 1)
-        self.emit('Py_INCREF(state->AST_type);', 1)
+        self.emit('if (PyModule_AddObjectRef(m, "AST", state->AST_type) < 0) {', 1)
+        self.emit('return -1;', 2)
+        self.emit('}', 1)
         self.emit('if (PyModule_AddIntMacro(m, PyCF_ALLOW_TOP_LEVEL_AWAIT) < 0) {', 1)
         self.emit("return -1;", 2)
         self.emit('}', 1)
@@ -1089,7 +1153,7 @@
 static struct PyModuleDef _astmodule = {
     PyModuleDef_HEAD_INIT,
     .m_name = "_ast",
-    // The _ast module uses a global state (global_ast_state).
+    // The _ast module uses a per-interpreter state (PyInterpreterState.ast)
     .m_size = 0,
     .m_slots = astmodule_slots,
 };
@@ -1113,30 +1177,10 @@
         self.addObj(cons.name)
 
     def addObj(self, name):
-        self.emit("if (PyModule_AddObject(m, \"%s\", "
+        self.emit("if (PyModule_AddObjectRef(m, \"%s\", "
                   "state->%s_type) < 0) {" % (name, name), 1)
         self.emit("return -1;", 2)
         self.emit('}', 1)
-        self.emit("Py_INCREF(state->%s_type);" % name, 1)
-
-
-_SPECIALIZED_SEQUENCES = ('stmt', 'expr')
-
-def find_sequence(fields, doing_specialization):
-    """Return True if any field uses a sequence."""
-    for f in fields:
-        if f.seq:
-            if not doing_specialization:
-                return True
-            if str(f.type) not in _SPECIALIZED_SEQUENCES:
-                return True
-    return False
-
-def has_sequence(types, doing_specialization):
-    for t in types:
-        if find_sequence(t.fields, doing_specialization):
-            return True
-    return False
 
 
 class StaticVisitor(PickleVisitor):
@@ -1151,7 +1195,7 @@
     def func_begin(self, name):
         ctype = get_c_type(name)
         self.emit("PyObject*", 0)
-        self.emit("ast2obj_%s(astmodulestate *state, void* _o)" % (name), 0)
+        self.emit("ast2obj_%s(struct ast_state *state, void* _o)" % (name), 0)
         self.emit("{", 0)
         self.emit("%s o = (%s)_o;" % (ctype, ctype), 1)
         self.emit("PyObject *result = NULL, *value = NULL;", 1)
@@ -1188,7 +1232,7 @@
         self.func_end()
 
     def simpleSum(self, sum, name):
-        self.emit("PyObject* ast2obj_%s(astmodulestate *state, %s_ty o)" % (name, name), 0)
+        self.emit("PyObject* ast2obj_%s(struct ast_state *state, %s_ty o)" % (name, name), 0)
         self.emit("{", 0)
         self.emit("switch(o) {", 1)
         for t in sum.types:
@@ -1236,18 +1280,6 @@
         emit("goto failed;", 1)
         emit("Py_DECREF(value);", 0)
 
-    def emitSeq(self, field, value, depth, emit):
-        emit("seq = %s;" % value, 0)
-        emit("n = asdl_seq_LEN(seq);", 0)
-        emit("value = PyList_New(n);", 0)
-        emit("if (!value) goto failed;", 0)
-        emit("for (i = 0; i < n; i++) {", 0)
-        self.set("value", field, "asdl_seq_GET(seq, i)", depth + 1)
-        emit("if (!value1) goto failed;", 1)
-        emit("PyList_SET_ITEM(value, i, value1);", 1)
-        emit("value1 = NULL;", 1)
-        emit("}", 0)
-
     def set(self, field, value, depth):
         if field.seq:
             # XXX should really check for is_simple, but that requires a symbol table
@@ -1264,9 +1296,8 @@
                           depth+2, reflow=False)
                 self.emit("}", depth)
             else:
-                self.emit("value = ast2obj_list(state, %s, ast2obj_%s);" % (value, field.type), depth)
+                self.emit("value = ast2obj_list(state, (asdl_seq*)%s, ast2obj_%s);" % (value, field.type), depth)
         else:
-            ctype = get_c_type(field.type)
             self.emit("value = ast2obj_%s(state, %s);" % (field.type, value), depth, reflow=False)
 
 
@@ -1275,7 +1306,7 @@
     CODE = """
 PyObject* PyAST_mod2obj(mod_ty t)
 {
-    astmodulestate *state = get_global_ast_state();
+    struct ast_state *state = get_ast_state();
     if (state == NULL) {
         return NULL;
     }
@@ -1292,7 +1323,11 @@
         return NULL;
     }
 
-    astmodulestate *state = get_global_ast_state();
+    struct ast_state *state = get_ast_state();
+    if (state == NULL) {
+        return NULL;
+    }
+
     PyObject *req_type[3];
     req_type[0] = state->Module_type;
     req_type[1] = state->Expression_type;
@@ -1318,7 +1353,7 @@
 
 int PyAST_Check(PyObject* obj)
 {
-    astmodulestate *state = get_global_ast_state();
+    struct ast_state *state = get_ast_state();
     if (state == NULL) {
         return -1;
     }
@@ -1336,7 +1371,35 @@
             v.emit("", 0)
 
 
-def generate_module_def(f, mod):
+def generate_ast_state(module_state, f):
+    f.write('struct ast_state {\n')
+    f.write('    int initialized;\n')
+    for s in module_state:
+        f.write('    PyObject *' + s + ';\n')
+    f.write('};')
+
+
+def generate_ast_fini(module_state, f):
+    f.write(textwrap.dedent("""
+            void _PyAST_Fini(PyInterpreterState *interp)
+            {
+                struct ast_state *state = &interp->ast;
+
+    """))
+    for s in module_state:
+        f.write("    Py_CLEAR(state->" + s + ');\n')
+    f.write(textwrap.dedent("""
+            #if !defined(NDEBUG)
+                state->initialized = -1;
+            #else
+                state->initialized = 0;
+            #endif
+            }
+
+    """))
+
+
+def generate_module_def(mod, f, internal_h):
     # Gather all the data needed for ModuleSpec
     visitor_list = set()
     with open(os.devnull, "w") as devnull:
@@ -1350,6 +1413,7 @@
     state_strings = {
         "ast",
         "_fields",
+        "__match_args__",
         "__doc__",
         "__dict__",
         "__module__",
@@ -1366,50 +1430,36 @@
             module_state.add(tp)
     state_strings = sorted(state_strings)
     module_state = sorted(module_state)
-    f.write('typedef struct {\n')
-    f.write('    int initialized;\n')
-    for s in module_state:
-        f.write('    PyObject *' + s + ';\n')
-    f.write('} astmodulestate;\n\n')
-    f.write("""
-// Forward declaration
-static int init_types(astmodulestate *state);
 
-// bpo-41194, bpo-41261, bpo-41631: The _ast module uses a global state.
-static astmodulestate global_ast_state = {0};
+    generate_ast_state(module_state, internal_h)
 
-static astmodulestate*
-get_global_ast_state(void)
-{
-    astmodulestate* state = &global_ast_state;
-    if (!init_types(state)) {
-        return NULL;
-    }
-    return state;
-}
+    print(textwrap.dedent("""
+        #include "Python.h"
+        #include "pycore_ast.h"
+        #include "pycore_ast_state.h"       // struct ast_state
+        #include "pycore_interp.h"          // _PyInterpreterState.ast
+        #include "pycore_pystate.h"         // _PyInterpreterState_GET()
+        #include "structmember.h"
+        #include <stddef.h>
 
-static astmodulestate*
-get_ast_state(PyObject* Py_UNUSED(module))
-{
-    astmodulestate* state = get_global_ast_state();
-    // get_ast_state() must only be called after _ast module is imported,
-    // and astmodule_exec() calls init_types()
-    assert(state != NULL);
-    return state;
-}
+        // Forward declaration
+        static int init_types(struct ast_state *state);
 
-void _PyAST_Fini()
-{
-    astmodulestate* state = &global_ast_state;
-""")
-    for s in module_state:
-        f.write("    Py_CLEAR(state->" + s + ');\n')
-    f.write("""
-    state->initialized = 0;
-}
+        static struct ast_state*
+        get_ast_state(void)
+        {
+            PyInterpreterState *interp = _PyInterpreterState_GET();
+            struct ast_state *state = &interp->ast;
+            if (!init_types(state)) {
+                return NULL;
+            }
+            return state;
+        }
+    """).strip(), file=f)
 
-""")
-    f.write('static int init_identifiers(astmodulestate *state)\n')
+    generate_ast_fini(module_state, f)
+
+    f.write('static int init_identifiers(struct ast_state *state)\n')
     f.write('{\n')
     for identifier in state_strings:
         f.write('    if ((state->' + identifier)
@@ -1418,45 +1468,79 @@
     f.write('    return 1;\n')
     f.write('};\n\n')
 
-def write_header(f, mod):
-    f.write('#ifndef Py_PYTHON_AST_H\n')
-    f.write('#define Py_PYTHON_AST_H\n')
-    f.write('#ifdef __cplusplus\n')
-    f.write('extern "C" {\n')
-    f.write('#endif\n')
-    f.write('\n')
-    f.write('#ifndef Py_LIMITED_API\n')
-    f.write('#include "asdl.h"\n')
-    f.write('\n')
-    f.write('#undef Yield   /* undefine macro conflicting with <winbase.h> */\n')
-    f.write('\n')
+def write_header(mod, f):
+    f.write(textwrap.dedent("""
+        #ifndef Py_INTERNAL_AST_H
+        #define Py_INTERNAL_AST_H
+        #ifdef __cplusplus
+        extern "C" {
+        #endif
+
+        #ifndef Py_BUILD_CORE
+        #  error "this header requires Py_BUILD_CORE define"
+        #endif
+
+        #include "pycore_asdl.h"
+
+    """).lstrip())
     c = ChainOfVisitors(TypeDefVisitor(f),
+                        SequenceDefVisitor(f),
                         StructVisitor(f))
     c.visit(mod)
     f.write("// Note: these macros affect function definitions, not only call sites.\n")
     PrototypeVisitor(f).visit(mod)
-    f.write("\n")
-    f.write("PyObject* PyAST_mod2obj(mod_ty t);\n")
-    f.write("mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode);\n")
-    f.write("int PyAST_Check(PyObject* obj);\n")
-    f.write("#endif /* !Py_LIMITED_API */\n")
-    f.write('\n')
-    f.write('#ifdef __cplusplus\n')
-    f.write('}\n')
-    f.write('#endif\n')
-    f.write('#endif /* !Py_PYTHON_AST_H */\n')
+    f.write(textwrap.dedent("""
 
-def write_source(f, mod):
-    f.write('#include <stddef.h>\n')
-    f.write('\n')
-    f.write('#include "Python.h"\n')
-    f.write('#include "%s-ast.h"\n' % mod.name)
-    f.write('#include "structmember.h"         // PyMemberDef\n')
-    f.write('\n')
+        PyObject* PyAST_mod2obj(mod_ty t);
+        mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode);
+        int PyAST_Check(PyObject* obj);
 
-    generate_module_def(f, mod)
+        extern int _PyAST_Validate(mod_ty);
+
+        /* _PyAST_ExprAsUnicode is defined in ast_unparse.c */
+        extern PyObject* _PyAST_ExprAsUnicode(expr_ty);
+
+        /* Return the borrowed reference to the first literal string in the
+           sequence of statements or NULL if it doesn't start from a literal string.
+           Doesn't set exception. */
+        extern PyObject* _PyAST_GetDocString(asdl_stmt_seq *);
+
+        #ifdef __cplusplus
+        }
+        #endif
+        #endif /* !Py_INTERNAL_AST_H */
+    """))
+
+
+def write_internal_h_header(mod, f):
+    print(textwrap.dedent("""
+        #ifndef Py_INTERNAL_AST_STATE_H
+        #define Py_INTERNAL_AST_STATE_H
+        #ifdef __cplusplus
+        extern "C" {
+        #endif
+
+        #ifndef Py_BUILD_CORE
+        #  error "this header requires Py_BUILD_CORE define"
+        #endif
+    """).lstrip(), file=f)
+
+
+def write_internal_h_footer(mod, f):
+    print(textwrap.dedent("""
+
+        #ifdef __cplusplus
+        }
+        #endif
+        #endif /* !Py_INTERNAL_AST_STATE_H */
+    """), file=f)
+
+
+def write_source(mod, f, internal_h_file):
+    generate_module_def(mod, f, internal_h_file)
 
     v = ChainOfVisitors(
+        SequenceConstructorVisitor(f),
         PyTypesDeclareVisitor(f),
         PyTypesVisitor(f),
         Obj2ModPrototypeVisitor(f),
@@ -1468,27 +1552,37 @@
     )
     v.visit(mod)
 
-def main(input_file, c_file, h_file, dump_module=False):
+def main(input_filename, c_filename, h_filename, internal_h_filename, dump_module=False):
     auto_gen_msg = AUTOGEN_MESSAGE.format("/".join(Path(__file__).parts[-2:]))
-    mod = asdl.parse(input_file)
+    mod = asdl.parse(input_filename)
     if dump_module:
         print('Parsed Module:')
         print(mod)
     if not asdl.check(mod):
         sys.exit(1)
-    for file, writer in (c_file, write_source), (h_file, write_header):
-        if file is not None:
-            with file.open("w") as f:
-                f.write(auto_gen_msg)
-                writer(f, mod)
-            print(file, "regenerated.")
+
+    with c_filename.open("w") as c_file, \
+         h_filename.open("w") as h_file, \
+         internal_h_filename.open("w") as internal_h_file:
+        c_file.write(auto_gen_msg)
+        h_file.write(auto_gen_msg)
+        internal_h_file.write(auto_gen_msg)
+
+        write_internal_h_header(mod, internal_h_file)
+        write_source(mod, c_file, internal_h_file)
+        write_header(mod, h_file)
+        write_internal_h_footer(mod, internal_h_file)
+
+    print(f"{c_filename}, {h_filename}, {internal_h_filename} regenerated.")
 
 if __name__ == "__main__":
     parser = ArgumentParser()
     parser.add_argument("input_file", type=Path)
-    parser.add_argument("-C", "--c-file", type=Path, default=None)
-    parser.add_argument("-H", "--h-file", type=Path, default=None)
+    parser.add_argument("-C", "--c-file", type=Path, required=True)
+    parser.add_argument("-H", "--h-file", type=Path, required=True)
+    parser.add_argument("-I", "--internal-h-file", type=Path, required=True)
     parser.add_argument("-d", "--dump-module", action="store_true")
 
-    options = parser.parse_args()
-    main(**vars(options))
+    args = parser.parse_args()
+    main(args.input_file, args.c_file, args.h_file,
+         args.internal_h_file, args.dump_module)
diff --git a/Parser/grammar1.c b/Parser/grammar1.c
deleted file mode 100644
index c702040..0000000
--- a/Parser/grammar1.c
+++ /dev/null
@@ -1,47 +0,0 @@
-
-/* Grammar subroutines needed by parser */
-
-#include "Python.h"
-#include "grammar.h"
-#include "token.h"
-
-/* Return the DFA for the given type */
-
-const dfa *
-PyGrammar_FindDFA(grammar *g, int type)
-{
-    /* Massive speed-up */
-    const dfa *d = &g->g_dfa[type - NT_OFFSET];
-    assert(d->d_type == type);
-    return d;
-}
-
-const char *
-PyGrammar_LabelRepr(label *lb)
-{
-    static char buf[100];
-
-    if (lb->lb_type == ENDMARKER)
-        return "EMPTY";
-    else if (ISNONTERMINAL(lb->lb_type)) {
-        if (lb->lb_str == NULL) {
-            PyOS_snprintf(buf, sizeof(buf), "NT%d", lb->lb_type);
-            return buf;
-        }
-        else
-            return lb->lb_str;
-    }
-    else if (lb->lb_type < N_TOKENS) {
-        if (lb->lb_str == NULL)
-            return _PyParser_TokenNames[lb->lb_type];
-        else {
-            PyOS_snprintf(buf, sizeof(buf), "%.32s(%.32s)",
-                _PyParser_TokenNames[lb->lb_type], lb->lb_str);
-            return buf;
-        }
-    }
-    else {
-        Py_FatalError("invalid grammar label");
-        return NULL;
-    }
-}
diff --git a/Parser/listnode.c b/Parser/listnode.c
deleted file mode 100644
index c806b98..0000000
--- a/Parser/listnode.c
+++ /dev/null
@@ -1,71 +0,0 @@
-
-/* List a node on a file */
-
-#include "Python.h"
-#include "pycore_interp.h"        // PyInterpreterState.parser
-#include "pycore_pystate.h"       // _PyInterpreterState_GET()
-#include "token.h"
-#include "node.h"
-
-/* Forward */
-static void list1node(FILE *, node *);
-static void listnode(FILE *, node *);
-
-void
-PyNode_ListTree(node *n)
-{
-    listnode(stdout, n);
-}
-
-static void
-listnode(FILE *fp, node *n)
-{
-    PyInterpreterState *interp = _PyInterpreterState_GET();
-
-    interp->parser.listnode.level = 0;
-    interp->parser.listnode.atbol = 1;
-    list1node(fp, n);
-}
-
-static void
-list1node(FILE *fp, node *n)
-{
-    PyInterpreterState *interp;
-
-    if (n == NULL)
-        return;
-    if (ISNONTERMINAL(TYPE(n))) {
-        int i;
-        for (i = 0; i < NCH(n); i++)
-            list1node(fp, CHILD(n, i));
-    }
-    else if (ISTERMINAL(TYPE(n))) {
-        interp = _PyInterpreterState_GET();
-        switch (TYPE(n)) {
-        case INDENT:
-            interp->parser.listnode.level++;
-            break;
-        case DEDENT:
-            interp->parser.listnode.level--;
-            break;
-        default:
-            if (interp->parser.listnode.atbol) {
-                int i;
-                for (i = 0; i < interp->parser.listnode.level; ++i)
-                    fprintf(fp, "\t");
-                interp->parser.listnode.atbol = 0;
-            }
-            if (TYPE(n) == NEWLINE) {
-                if (STR(n) != NULL)
-                    fprintf(fp, "%s", STR(n));
-                fprintf(fp, "\n");
-                interp->parser.listnode.atbol = 1;
-            }
-            else
-                fprintf(fp, "%s ", STR(n));
-            break;
-        }
-    }
-    else
-        fprintf(fp, "? ");
-}
diff --git a/Parser/myreadline.c b/Parser/myreadline.c
index 143b41f..e5e2fb1 100644
--- a/Parser/myreadline.c
+++ b/Parser/myreadline.c
@@ -249,10 +249,8 @@
     if (!Py_LegacyWindowsStdioFlag && sys_stdin == stdin) {
         HANDLE hStdIn, hStdErr;
 
-        _Py_BEGIN_SUPPRESS_IPH
-        hStdIn = (HANDLE)_get_osfhandle(fileno(sys_stdin));
-        hStdErr = (HANDLE)_get_osfhandle(fileno(stderr));
-        _Py_END_SUPPRESS_IPH
+        hStdIn = _Py_get_osfhandle_noraise(fileno(sys_stdin));
+        hStdErr = _Py_get_osfhandle_noraise(fileno(stderr));
 
         if (_get_console_type(hStdIn) == 'r') {
             fflush(sys_stdout);
diff --git a/Parser/node.c b/Parser/node.c
deleted file mode 100644
index 8789e01..0000000
--- a/Parser/node.c
+++ /dev/null
@@ -1,189 +0,0 @@
-/* Parse tree node implementation */
-
-#include "Python.h"
-#include "node.h"
-#include "errcode.h"
-
-node *
-PyNode_New(int type)
-{
-    node *n = (node *) PyObject_MALLOC(1 * sizeof(node));
-    if (n == NULL)
-        return NULL;
-    n->n_type = type;
-    n->n_str = NULL;
-    n->n_lineno = 0;
-    n->n_end_lineno = 0;
-    n->n_col_offset = 0;
-    n->n_end_col_offset = -1;
-    n->n_nchildren = 0;
-    n->n_child = NULL;
-    return n;
-}
-
-/* See comments at XXXROUNDUP below.  Returns -1 on overflow. */
-static int
-fancy_roundup(int n)
-{
-    /* Round up to the closest power of 2 >= n. */
-    int result = 256;
-    assert(n > 128);
-    while (result < n) {
-        result <<= 1;
-        if (result <= 0)
-            return -1;
-    }
-    return result;
-}
-
-/* A gimmick to make massive numbers of reallocs quicker.  The result is
- * a number >= the input.  In PyNode_AddChild, it's used like so, when
- * we're about to add child number current_size + 1:
- *
- *     if XXXROUNDUP(current_size) < XXXROUNDUP(current_size + 1):
- *         allocate space for XXXROUNDUP(current_size + 1) total children
- *     else:
- *         we already have enough space
- *
- * Since a node starts out empty, we must have
- *
- *     XXXROUNDUP(0) < XXXROUNDUP(1)
- *
- * so that we allocate space for the first child.  One-child nodes are very
- * common (presumably that would change if we used a more abstract form
- * of syntax tree), so to avoid wasting memory it's desirable that
- * XXXROUNDUP(1) == 1.  That in turn forces XXXROUNDUP(0) == 0.
- *
- * Else for 2 <= n <= 128, we round up to the closest multiple of 4.  Why 4?
- * Rounding up to a multiple of an exact power of 2 is very efficient, and
- * most nodes with more than one child have <= 4 kids.
- *
- * Else we call fancy_roundup() to grow proportionately to n.  We've got an
- * extreme case then (like test_longexp.py), and on many platforms doing
- * anything less than proportional growth leads to exorbitant runtime
- * (e.g., MacPython), or extreme fragmentation of user address space (e.g.,
- * Win98).
- *
- * In a run of compileall across the 2.3a0 Lib directory, Andrew MacIntyre
- * reported that, with this scheme, 89% of PyObject_REALLOC calls in
- * PyNode_AddChild passed 1 for the size, and 9% passed 4.  So this usually
- * wastes very little memory, but is very effective at sidestepping
- * platform-realloc disasters on vulnerable platforms.
- *
- * Note that this would be straightforward if a node stored its current
- * capacity.  The code is tricky to avoid that.
- */
-#define XXXROUNDUP(n) ((n) <= 1 ? (n) :                         \
-               (n) <= 128 ? (int)_Py_SIZE_ROUND_UP((n), 4) :    \
-               fancy_roundup(n))
-
-
-void
-_PyNode_FinalizeEndPos(node *n)
-{
-    int nch = NCH(n);
-    node *last;
-    if (nch == 0) {
-        return;
-    }
-    last = CHILD(n, nch - 1);
-    _PyNode_FinalizeEndPos(last);
-    n->n_end_lineno = last->n_end_lineno;
-    n->n_end_col_offset = last->n_end_col_offset;
-}
-
-int
-PyNode_AddChild(node *n1, int type, char *str, int lineno, int col_offset,
-                int end_lineno, int end_col_offset)
-{
-    const int nch = n1->n_nchildren;
-    int current_capacity;
-    int required_capacity;
-    node *n;
-
-    // finalize end position of previous node (if any)
-    if (nch > 0) {
-        _PyNode_FinalizeEndPos(CHILD(n1, nch - 1));
-    }
-
-    if (nch == INT_MAX || nch < 0)
-        return E_OVERFLOW;
-
-    current_capacity = XXXROUNDUP(nch);
-    required_capacity = XXXROUNDUP(nch + 1);
-    if (current_capacity < 0 || required_capacity < 0)
-        return E_OVERFLOW;
-    if (current_capacity < required_capacity) {
-        if ((size_t)required_capacity > SIZE_MAX / sizeof(node)) {
-            return E_NOMEM;
-        }
-        n = n1->n_child;
-        n = (node *) PyObject_REALLOC(n,
-                                      required_capacity * sizeof(node));
-        if (n == NULL)
-            return E_NOMEM;
-        n1->n_child = n;
-    }
-
-    n = &n1->n_child[n1->n_nchildren++];
-    n->n_type = type;
-    n->n_str = str;
-    n->n_lineno = lineno;
-    n->n_col_offset = col_offset;
-    n->n_end_lineno = end_lineno;  // this and below will be updates after all children are added.
-    n->n_end_col_offset = end_col_offset;
-    n->n_nchildren = 0;
-    n->n_child = NULL;
-    return 0;
-}
-
-/* Forward */
-static void freechildren(node *);
-static Py_ssize_t sizeofchildren(node *n);
-
-
-void
-PyNode_Free(node *n)
-{
-    if (n != NULL) {
-        freechildren(n);
-        PyObject_FREE(n);
-    }
-}
-
-Py_ssize_t
-_PyNode_SizeOf(node *n)
-{
-    Py_ssize_t res = 0;
-
-    if (n != NULL)
-        res = sizeof(node) + sizeofchildren(n);
-    return res;
-}
-
-static void
-freechildren(node *n)
-{
-    int i;
-    for (i = NCH(n); --i >= 0; )
-        freechildren(CHILD(n, i));
-    if (n->n_child != NULL)
-        PyObject_FREE(n->n_child);
-    if (STR(n) != NULL)
-        PyObject_FREE(STR(n));
-}
-
-static Py_ssize_t
-sizeofchildren(node *n)
-{
-    Py_ssize_t res = 0;
-    int i;
-    for (i = NCH(n); --i >= 0; )
-        res += sizeofchildren(CHILD(n, i));
-    if (n->n_child != NULL)
-        /* allocated size of n->n_child array */
-        res += XXXROUNDUP(NCH(n)) * sizeof(node);
-    if (STR(n) != NULL)
-        res += strlen(STR(n)) + 1;
-    return res;
-}
diff --git a/Parser/parser.c b/Parser/parser.c
index a61b2f5..3f73003 100644
--- a/Parser/parser.c
+++ b/Parser/parser.c
@@ -1,463 +1,34520 @@
+// @generated by pegen.py from python.gram
+#include "pegen.h"
 
-/* Parser implementation */
-
-/* For a description, see the comments at end of this file */
-
-/* XXX To do: error recovery */
-
-#include "Python.h"
-#include "token.h"
-#include "grammar.h"
-#include "node.h"
-#include "parser.h"
-#include "errcode.h"
-#include "graminit.h"
-
-
-#ifdef Py_DEBUG
-extern int Py_DebugFlag;
-#define D(x) if (!Py_DebugFlag); else x
+#if defined(Py_DEBUG) && defined(Py_BUILD_CORE)
+#  define D(x) if (Py_DebugFlag) x;
 #else
-#define D(x)
+#  define D(x)
 #endif
 
+# define MAXSTACK 6000
+static const int n_keyword_lists = 9;
+static KeywordToken *reserved_keywords[] = {
+    (KeywordToken[]) {{NULL, -1}},
+    (KeywordToken[]) {{NULL, -1}},
+    (KeywordToken[]) {
+        {"if", 510},
+        {"in", 518},
+        {"as", 520},
+        {"is", 530},
+        {"or", 531},
+        {NULL, -1},
+    },
+    (KeywordToken[]) {
+        {"del", 503},
+        {"try", 511},
+        {"for", 517},
+        {"def", 526},
+        {"not", 529},
+        {"and", 532},
+        {NULL, -1},
+    },
+    (KeywordToken[]) {
+        {"pass", 502},
+        {"from", 514},
+        {"elif", 515},
+        {"else", 516},
+        {"with", 519},
+        {"None", 523},
+        {"True", 524},
+        {NULL, -1},
+    },
+    (KeywordToken[]) {
+        {"raise", 501},
+        {"yield", 504},
+        {"break", 506},
+        {"while", 512},
+        {"False", 525},
+        {"class", 527},
+        {NULL, -1},
+    },
+    (KeywordToken[]) {
+        {"return", 500},
+        {"assert", 505},
+        {"global", 508},
+        {"import", 513},
+        {"except", 521},
+        {"lambda", 528},
+        {NULL, -1},
+    },
+    (KeywordToken[]) {
+        {"finally", 522},
+        {NULL, -1},
+    },
+    (KeywordToken[]) {
+        {"continue", 507},
+        {"nonlocal", 509},
+        {NULL, -1},
+    },
+};
+static char *soft_keywords[] = {
+    "_",
+    "case",
+    "match",
+    NULL,
+};
+#define file_type 1000
+#define interactive_type 1001
+#define eval_type 1002
+#define func_type_type 1003
+#define fstring_type 1004
+#define type_expressions_type 1005
+#define statements_type 1006
+#define statement_type 1007
+#define statement_newline_type 1008
+#define simple_stmts_type 1009
+#define simple_stmt_type 1010
+#define compound_stmt_type 1011
+#define assignment_type 1012
+#define augassign_type 1013
+#define global_stmt_type 1014
+#define nonlocal_stmt_type 1015
+#define yield_stmt_type 1016
+#define assert_stmt_type 1017
+#define del_stmt_type 1018
+#define import_stmt_type 1019
+#define import_name_type 1020
+#define import_from_type 1021
+#define import_from_targets_type 1022
+#define import_from_as_names_type 1023
+#define import_from_as_name_type 1024
+#define dotted_as_names_type 1025
+#define dotted_as_name_type 1026
+#define dotted_name_type 1027  // Left-recursive
+#define if_stmt_type 1028
+#define elif_stmt_type 1029
+#define else_block_type 1030
+#define while_stmt_type 1031
+#define for_stmt_type 1032
+#define with_stmt_type 1033
+#define with_item_type 1034
+#define try_stmt_type 1035
+#define except_block_type 1036
+#define finally_block_type 1037
+#define match_stmt_type 1038
+#define subject_expr_type 1039
+#define case_block_type 1040
+#define guard_type 1041
+#define patterns_type 1042
+#define pattern_type 1043
+#define as_pattern_type 1044
+#define or_pattern_type 1045
+#define closed_pattern_type 1046
+#define literal_pattern_type 1047
+#define literal_expr_type 1048
+#define complex_number_type 1049
+#define signed_number_type 1050
+#define signed_real_number_type 1051
+#define real_number_type 1052
+#define imaginary_number_type 1053
+#define capture_pattern_type 1054
+#define pattern_capture_target_type 1055
+#define wildcard_pattern_type 1056
+#define value_pattern_type 1057
+#define attr_type 1058  // Left-recursive
+#define name_or_attr_type 1059  // Left-recursive
+#define group_pattern_type 1060
+#define sequence_pattern_type 1061
+#define open_sequence_pattern_type 1062
+#define maybe_sequence_pattern_type 1063
+#define maybe_star_pattern_type 1064
+#define star_pattern_type 1065
+#define mapping_pattern_type 1066
+#define items_pattern_type 1067
+#define key_value_pattern_type 1068
+#define double_star_pattern_type 1069
+#define class_pattern_type 1070
+#define positional_patterns_type 1071
+#define keyword_patterns_type 1072
+#define keyword_pattern_type 1073
+#define return_stmt_type 1074
+#define raise_stmt_type 1075
+#define function_def_type 1076
+#define function_def_raw_type 1077
+#define func_type_comment_type 1078
+#define params_type 1079
+#define parameters_type 1080
+#define slash_no_default_type 1081
+#define slash_with_default_type 1082
+#define star_etc_type 1083
+#define kwds_type 1084
+#define param_no_default_type 1085
+#define param_with_default_type 1086
+#define param_maybe_default_type 1087
+#define param_type 1088
+#define annotation_type 1089
+#define default_type 1090
+#define decorators_type 1091
+#define class_def_type 1092
+#define class_def_raw_type 1093
+#define block_type 1094
+#define star_expressions_type 1095
+#define star_expression_type 1096
+#define star_named_expressions_type 1097
+#define star_named_expression_type 1098
+#define assignment_expression_type 1099
+#define named_expression_type 1100
+#define annotated_rhs_type 1101
+#define expressions_type 1102
+#define expression_type 1103
+#define lambdef_type 1104
+#define lambda_params_type 1105
+#define lambda_parameters_type 1106
+#define lambda_slash_no_default_type 1107
+#define lambda_slash_with_default_type 1108
+#define lambda_star_etc_type 1109
+#define lambda_kwds_type 1110
+#define lambda_param_no_default_type 1111
+#define lambda_param_with_default_type 1112
+#define lambda_param_maybe_default_type 1113
+#define lambda_param_type 1114
+#define disjunction_type 1115
+#define conjunction_type 1116
+#define inversion_type 1117
+#define comparison_type 1118
+#define compare_op_bitwise_or_pair_type 1119
+#define eq_bitwise_or_type 1120
+#define noteq_bitwise_or_type 1121
+#define lte_bitwise_or_type 1122
+#define lt_bitwise_or_type 1123
+#define gte_bitwise_or_type 1124
+#define gt_bitwise_or_type 1125
+#define notin_bitwise_or_type 1126
+#define in_bitwise_or_type 1127
+#define isnot_bitwise_or_type 1128
+#define is_bitwise_or_type 1129
+#define bitwise_or_type 1130  // Left-recursive
+#define bitwise_xor_type 1131  // Left-recursive
+#define bitwise_and_type 1132  // Left-recursive
+#define shift_expr_type 1133  // Left-recursive
+#define sum_type 1134  // Left-recursive
+#define term_type 1135  // Left-recursive
+#define factor_type 1136
+#define power_type 1137
+#define await_primary_type 1138
+#define primary_type 1139  // Left-recursive
+#define slices_type 1140
+#define slice_type 1141
+#define atom_type 1142
+#define strings_type 1143
+#define list_type 1144
+#define listcomp_type 1145
+#define tuple_type 1146
+#define group_type 1147
+#define genexp_type 1148
+#define set_type 1149
+#define setcomp_type 1150
+#define dict_type 1151
+#define dictcomp_type 1152
+#define double_starred_kvpairs_type 1153
+#define double_starred_kvpair_type 1154
+#define kvpair_type 1155
+#define for_if_clauses_type 1156
+#define for_if_clause_type 1157
+#define yield_expr_type 1158
+#define arguments_type 1159
+#define args_type 1160
+#define kwargs_type 1161
+#define starred_expression_type 1162
+#define kwarg_or_starred_type 1163
+#define kwarg_or_double_starred_type 1164
+#define star_targets_type 1165
+#define star_targets_list_seq_type 1166
+#define star_targets_tuple_seq_type 1167
+#define star_target_type 1168
+#define target_with_star_atom_type 1169
+#define star_atom_type 1170
+#define single_target_type 1171
+#define single_subscript_attribute_target_type 1172
+#define del_targets_type 1173
+#define del_target_type 1174
+#define del_t_atom_type 1175
+#define t_primary_type 1176  // Left-recursive
+#define t_lookahead_type 1177
+#define invalid_arguments_type 1178
+#define invalid_kwarg_type 1179
+#define expression_without_invalid_type 1180
+#define invalid_legacy_expression_type 1181
+#define invalid_expression_type 1182
+#define invalid_named_expression_type 1183
+#define invalid_assignment_type 1184
+#define invalid_ann_assign_target_type 1185
+#define invalid_del_stmt_type 1186
+#define invalid_block_type 1187
+#define invalid_comprehension_type 1188
+#define invalid_dict_comprehension_type 1189
+#define invalid_parameters_type 1190
+#define invalid_parameters_helper_type 1191
+#define invalid_lambda_parameters_type 1192
+#define invalid_lambda_parameters_helper_type 1193
+#define invalid_star_etc_type 1194
+#define invalid_lambda_star_etc_type 1195
+#define invalid_double_type_comments_type 1196
+#define invalid_with_item_type 1197
+#define invalid_for_target_type 1198
+#define invalid_group_type 1199
+#define invalid_import_from_targets_type 1200
+#define invalid_with_stmt_type 1201
+#define invalid_with_stmt_indent_type 1202
+#define invalid_try_stmt_type 1203
+#define invalid_except_stmt_type 1204
+#define invalid_finally_stmt_type 1205
+#define invalid_except_stmt_indent_type 1206
+#define invalid_match_stmt_type 1207
+#define invalid_case_block_type 1208
+#define invalid_as_pattern_type 1209
+#define invalid_class_pattern_type 1210
+#define invalid_class_argument_pattern_type 1211
+#define invalid_if_stmt_type 1212
+#define invalid_elif_stmt_type 1213
+#define invalid_else_stmt_type 1214
+#define invalid_while_stmt_type 1215
+#define invalid_for_stmt_type 1216
+#define invalid_def_raw_type 1217
+#define invalid_class_def_raw_type 1218
+#define invalid_double_starred_kvpairs_type 1219
+#define invalid_kvpair_type 1220
+#define _loop0_1_type 1221
+#define _loop0_2_type 1222
+#define _loop0_4_type 1223
+#define _gather_3_type 1224
+#define _loop0_6_type 1225
+#define _gather_5_type 1226
+#define _loop0_8_type 1227
+#define _gather_7_type 1228
+#define _loop0_10_type 1229
+#define _gather_9_type 1230
+#define _loop1_11_type 1231
+#define _loop0_13_type 1232
+#define _gather_12_type 1233
+#define _tmp_14_type 1234
+#define _tmp_15_type 1235
+#define _tmp_16_type 1236
+#define _tmp_17_type 1237
+#define _tmp_18_type 1238
+#define _tmp_19_type 1239
+#define _tmp_20_type 1240
+#define _tmp_21_type 1241
+#define _loop1_22_type 1242
+#define _tmp_23_type 1243
+#define _tmp_24_type 1244
+#define _loop0_26_type 1245
+#define _gather_25_type 1246
+#define _loop0_28_type 1247
+#define _gather_27_type 1248
+#define _tmp_29_type 1249
+#define _tmp_30_type 1250
+#define _loop0_31_type 1251
+#define _loop1_32_type 1252
+#define _loop0_34_type 1253
+#define _gather_33_type 1254
+#define _tmp_35_type 1255
+#define _loop0_37_type 1256
+#define _gather_36_type 1257
+#define _tmp_38_type 1258
+#define _loop0_40_type 1259
+#define _gather_39_type 1260
+#define _loop0_42_type 1261
+#define _gather_41_type 1262
+#define _loop0_44_type 1263
+#define _gather_43_type 1264
+#define _loop0_46_type 1265
+#define _gather_45_type 1266
+#define _tmp_47_type 1267
+#define _loop1_48_type 1268
+#define _tmp_49_type 1269
+#define _loop1_50_type 1270
+#define _loop0_52_type 1271
+#define _gather_51_type 1272
+#define _tmp_53_type 1273
+#define _tmp_54_type 1274
+#define _tmp_55_type 1275
+#define _tmp_56_type 1276
+#define _loop0_58_type 1277
+#define _gather_57_type 1278
+#define _loop0_60_type 1279
+#define _gather_59_type 1280
+#define _tmp_61_type 1281
+#define _loop0_63_type 1282
+#define _gather_62_type 1283
+#define _loop0_65_type 1284
+#define _gather_64_type 1285
+#define _tmp_66_type 1286
+#define _tmp_67_type 1287
+#define _tmp_68_type 1288
+#define _tmp_69_type 1289
+#define _loop0_70_type 1290
+#define _loop0_71_type 1291
+#define _loop0_72_type 1292
+#define _loop1_73_type 1293
+#define _loop0_74_type 1294
+#define _loop1_75_type 1295
+#define _loop1_76_type 1296
+#define _loop1_77_type 1297
+#define _loop0_78_type 1298
+#define _loop1_79_type 1299
+#define _loop0_80_type 1300
+#define _loop1_81_type 1301
+#define _loop0_82_type 1302
+#define _loop1_83_type 1303
+#define _loop1_84_type 1304
+#define _tmp_85_type 1305
+#define _loop1_86_type 1306
+#define _loop0_88_type 1307
+#define _gather_87_type 1308
+#define _loop1_89_type 1309
+#define _loop0_90_type 1310
+#define _loop0_91_type 1311
+#define _loop0_92_type 1312
+#define _loop1_93_type 1313
+#define _loop0_94_type 1314
+#define _loop1_95_type 1315
+#define _loop1_96_type 1316
+#define _loop1_97_type 1317
+#define _loop0_98_type 1318
+#define _loop1_99_type 1319
+#define _loop0_100_type 1320
+#define _loop1_101_type 1321
+#define _loop0_102_type 1322
+#define _loop1_103_type 1323
+#define _loop1_104_type 1324
+#define _loop1_105_type 1325
+#define _loop1_106_type 1326
+#define _tmp_107_type 1327
+#define _loop0_109_type 1328
+#define _gather_108_type 1329
+#define _tmp_110_type 1330
+#define _tmp_111_type 1331
+#define _tmp_112_type 1332
+#define _tmp_113_type 1333
+#define _loop1_114_type 1334
+#define _tmp_115_type 1335
+#define _tmp_116_type 1336
+#define _tmp_117_type 1337
+#define _loop0_119_type 1338
+#define _gather_118_type 1339
+#define _loop1_120_type 1340
+#define _loop0_121_type 1341
+#define _loop0_122_type 1342
+#define _loop0_124_type 1343
+#define _gather_123_type 1344
+#define _tmp_125_type 1345
+#define _loop0_127_type 1346
+#define _gather_126_type 1347
+#define _loop0_129_type 1348
+#define _gather_128_type 1349
+#define _loop0_131_type 1350
+#define _gather_130_type 1351
+#define _loop0_133_type 1352
+#define _gather_132_type 1353
+#define _loop0_134_type 1354
+#define _loop0_136_type 1355
+#define _gather_135_type 1356
+#define _loop1_137_type 1357
+#define _tmp_138_type 1358
+#define _loop0_140_type 1359
+#define _gather_139_type 1360
+#define _tmp_141_type 1361
+#define _tmp_142_type 1362
+#define _tmp_143_type 1363
+#define _tmp_144_type 1364
+#define _tmp_145_type 1365
+#define _tmp_146_type 1366
+#define _tmp_147_type 1367
+#define _tmp_148_type 1368
+#define _loop0_149_type 1369
+#define _loop0_150_type 1370
+#define _loop0_151_type 1371
+#define _tmp_152_type 1372
+#define _tmp_153_type 1373
+#define _tmp_154_type 1374
+#define _tmp_155_type 1375
+#define _loop0_156_type 1376
+#define _loop1_157_type 1377
+#define _loop0_158_type 1378
+#define _loop1_159_type 1379
+#define _tmp_160_type 1380
+#define _tmp_161_type 1381
+#define _tmp_162_type 1382
+#define _loop0_164_type 1383
+#define _gather_163_type 1384
+#define _loop0_166_type 1385
+#define _gather_165_type 1386
+#define _loop0_168_type 1387
+#define _gather_167_type 1388
+#define _loop0_170_type 1389
+#define _gather_169_type 1390
+#define _tmp_171_type 1391
+#define _tmp_172_type 1392
+#define _tmp_173_type 1393
+#define _tmp_174_type 1394
+#define _tmp_175_type 1395
+#define _tmp_176_type 1396
+#define _tmp_177_type 1397
+#define _loop0_179_type 1398
+#define _gather_178_type 1399
+#define _tmp_180_type 1400
+#define _tmp_181_type 1401
+#define _tmp_182_type 1402
+#define _tmp_183_type 1403
+#define _tmp_184_type 1404
+#define _tmp_185_type 1405
+#define _tmp_186_type 1406
+#define _tmp_187_type 1407
+#define _tmp_188_type 1408
+#define _tmp_189_type 1409
+#define _tmp_190_type 1410
+#define _tmp_191_type 1411
+#define _tmp_192_type 1412
+#define _tmp_193_type 1413
+#define _tmp_194_type 1414
+#define _tmp_195_type 1415
+#define _tmp_196_type 1416
+#define _tmp_197_type 1417
+#define _tmp_198_type 1418
+#define _tmp_199_type 1419
+#define _tmp_200_type 1420
+#define _tmp_201_type 1421
+#define _tmp_202_type 1422
+#define _tmp_203_type 1423
+#define _tmp_204_type 1424
+#define _tmp_205_type 1425
+#define _tmp_206_type 1426
 
-/* STACK DATA TYPE */
+static mod_ty file_rule(Parser *p);
+static mod_ty interactive_rule(Parser *p);
+static mod_ty eval_rule(Parser *p);
+static mod_ty func_type_rule(Parser *p);
+static expr_ty fstring_rule(Parser *p);
+static asdl_expr_seq* type_expressions_rule(Parser *p);
+static asdl_stmt_seq* statements_rule(Parser *p);
+static asdl_stmt_seq* statement_rule(Parser *p);
+static asdl_stmt_seq* statement_newline_rule(Parser *p);
+static asdl_stmt_seq* simple_stmts_rule(Parser *p);
+static stmt_ty simple_stmt_rule(Parser *p);
+static stmt_ty compound_stmt_rule(Parser *p);
+static stmt_ty assignment_rule(Parser *p);
+static AugOperator* augassign_rule(Parser *p);
+static stmt_ty global_stmt_rule(Parser *p);
+static stmt_ty nonlocal_stmt_rule(Parser *p);
+static stmt_ty yield_stmt_rule(Parser *p);
+static stmt_ty assert_stmt_rule(Parser *p);
+static stmt_ty del_stmt_rule(Parser *p);
+static stmt_ty import_stmt_rule(Parser *p);
+static stmt_ty import_name_rule(Parser *p);
+static stmt_ty import_from_rule(Parser *p);
+static asdl_alias_seq* import_from_targets_rule(Parser *p);
+static asdl_alias_seq* import_from_as_names_rule(Parser *p);
+static alias_ty import_from_as_name_rule(Parser *p);
+static asdl_alias_seq* dotted_as_names_rule(Parser *p);
+static alias_ty dotted_as_name_rule(Parser *p);
+static expr_ty dotted_name_rule(Parser *p);
+static stmt_ty if_stmt_rule(Parser *p);
+static stmt_ty elif_stmt_rule(Parser *p);
+static asdl_stmt_seq* else_block_rule(Parser *p);
+static stmt_ty while_stmt_rule(Parser *p);
+static stmt_ty for_stmt_rule(Parser *p);
+static stmt_ty with_stmt_rule(Parser *p);
+static withitem_ty with_item_rule(Parser *p);
+static stmt_ty try_stmt_rule(Parser *p);
+static excepthandler_ty except_block_rule(Parser *p);
+static asdl_stmt_seq* finally_block_rule(Parser *p);
+static stmt_ty match_stmt_rule(Parser *p);
+static expr_ty subject_expr_rule(Parser *p);
+static match_case_ty case_block_rule(Parser *p);
+static expr_ty guard_rule(Parser *p);
+static pattern_ty patterns_rule(Parser *p);
+static pattern_ty pattern_rule(Parser *p);
+static pattern_ty as_pattern_rule(Parser *p);
+static pattern_ty or_pattern_rule(Parser *p);
+static pattern_ty closed_pattern_rule(Parser *p);
+static pattern_ty literal_pattern_rule(Parser *p);
+static expr_ty literal_expr_rule(Parser *p);
+static expr_ty complex_number_rule(Parser *p);
+static expr_ty signed_number_rule(Parser *p);
+static expr_ty signed_real_number_rule(Parser *p);
+static expr_ty real_number_rule(Parser *p);
+static expr_ty imaginary_number_rule(Parser *p);
+static pattern_ty capture_pattern_rule(Parser *p);
+static expr_ty pattern_capture_target_rule(Parser *p);
+static pattern_ty wildcard_pattern_rule(Parser *p);
+static pattern_ty value_pattern_rule(Parser *p);
+static expr_ty attr_rule(Parser *p);
+static expr_ty name_or_attr_rule(Parser *p);
+static pattern_ty group_pattern_rule(Parser *p);
+static pattern_ty sequence_pattern_rule(Parser *p);
+static asdl_seq* open_sequence_pattern_rule(Parser *p);
+static asdl_seq* maybe_sequence_pattern_rule(Parser *p);
+static pattern_ty maybe_star_pattern_rule(Parser *p);
+static pattern_ty star_pattern_rule(Parser *p);
+static pattern_ty mapping_pattern_rule(Parser *p);
+static asdl_seq* items_pattern_rule(Parser *p);
+static KeyPatternPair* key_value_pattern_rule(Parser *p);
+static expr_ty double_star_pattern_rule(Parser *p);
+static pattern_ty class_pattern_rule(Parser *p);
+static asdl_pattern_seq* positional_patterns_rule(Parser *p);
+static asdl_seq* keyword_patterns_rule(Parser *p);
+static KeyPatternPair* keyword_pattern_rule(Parser *p);
+static stmt_ty return_stmt_rule(Parser *p);
+static stmt_ty raise_stmt_rule(Parser *p);
+static stmt_ty function_def_rule(Parser *p);
+static stmt_ty function_def_raw_rule(Parser *p);
+static Token* func_type_comment_rule(Parser *p);
+static arguments_ty params_rule(Parser *p);
+static arguments_ty parameters_rule(Parser *p);
+static asdl_arg_seq* slash_no_default_rule(Parser *p);
+static SlashWithDefault* slash_with_default_rule(Parser *p);
+static StarEtc* star_etc_rule(Parser *p);
+static arg_ty kwds_rule(Parser *p);
+static arg_ty param_no_default_rule(Parser *p);
+static NameDefaultPair* param_with_default_rule(Parser *p);
+static NameDefaultPair* param_maybe_default_rule(Parser *p);
+static arg_ty param_rule(Parser *p);
+static expr_ty annotation_rule(Parser *p);
+static expr_ty default_rule(Parser *p);
+static asdl_expr_seq* decorators_rule(Parser *p);
+static stmt_ty class_def_rule(Parser *p);
+static stmt_ty class_def_raw_rule(Parser *p);
+static asdl_stmt_seq* block_rule(Parser *p);
+static expr_ty star_expressions_rule(Parser *p);
+static expr_ty star_expression_rule(Parser *p);
+static asdl_expr_seq* star_named_expressions_rule(Parser *p);
+static expr_ty star_named_expression_rule(Parser *p);
+static expr_ty assignment_expression_rule(Parser *p);
+static expr_ty named_expression_rule(Parser *p);
+static expr_ty annotated_rhs_rule(Parser *p);
+static expr_ty expressions_rule(Parser *p);
+static expr_ty expression_rule(Parser *p);
+static expr_ty lambdef_rule(Parser *p);
+static arguments_ty lambda_params_rule(Parser *p);
+static arguments_ty lambda_parameters_rule(Parser *p);
+static asdl_arg_seq* lambda_slash_no_default_rule(Parser *p);
+static SlashWithDefault* lambda_slash_with_default_rule(Parser *p);
+static StarEtc* lambda_star_etc_rule(Parser *p);
+static arg_ty lambda_kwds_rule(Parser *p);
+static arg_ty lambda_param_no_default_rule(Parser *p);
+static NameDefaultPair* lambda_param_with_default_rule(Parser *p);
+static NameDefaultPair* lambda_param_maybe_default_rule(Parser *p);
+static arg_ty lambda_param_rule(Parser *p);
+static expr_ty disjunction_rule(Parser *p);
+static expr_ty conjunction_rule(Parser *p);
+static expr_ty inversion_rule(Parser *p);
+static expr_ty comparison_rule(Parser *p);
+static CmpopExprPair* compare_op_bitwise_or_pair_rule(Parser *p);
+static CmpopExprPair* eq_bitwise_or_rule(Parser *p);
+static CmpopExprPair* noteq_bitwise_or_rule(Parser *p);
+static CmpopExprPair* lte_bitwise_or_rule(Parser *p);
+static CmpopExprPair* lt_bitwise_or_rule(Parser *p);
+static CmpopExprPair* gte_bitwise_or_rule(Parser *p);
+static CmpopExprPair* gt_bitwise_or_rule(Parser *p);
+static CmpopExprPair* notin_bitwise_or_rule(Parser *p);
+static CmpopExprPair* in_bitwise_or_rule(Parser *p);
+static CmpopExprPair* isnot_bitwise_or_rule(Parser *p);
+static CmpopExprPair* is_bitwise_or_rule(Parser *p);
+static expr_ty bitwise_or_rule(Parser *p);
+static expr_ty bitwise_xor_rule(Parser *p);
+static expr_ty bitwise_and_rule(Parser *p);
+static expr_ty shift_expr_rule(Parser *p);
+static expr_ty sum_rule(Parser *p);
+static expr_ty term_rule(Parser *p);
+static expr_ty factor_rule(Parser *p);
+static expr_ty power_rule(Parser *p);
+static expr_ty await_primary_rule(Parser *p);
+static expr_ty primary_rule(Parser *p);
+static expr_ty slices_rule(Parser *p);
+static expr_ty slice_rule(Parser *p);
+static expr_ty atom_rule(Parser *p);
+static expr_ty strings_rule(Parser *p);
+static expr_ty list_rule(Parser *p);
+static expr_ty listcomp_rule(Parser *p);
+static expr_ty tuple_rule(Parser *p);
+static expr_ty group_rule(Parser *p);
+static expr_ty genexp_rule(Parser *p);
+static expr_ty set_rule(Parser *p);
+static expr_ty setcomp_rule(Parser *p);
+static expr_ty dict_rule(Parser *p);
+static expr_ty dictcomp_rule(Parser *p);
+static asdl_seq* double_starred_kvpairs_rule(Parser *p);
+static KeyValuePair* double_starred_kvpair_rule(Parser *p);
+static KeyValuePair* kvpair_rule(Parser *p);
+static asdl_comprehension_seq* for_if_clauses_rule(Parser *p);
+static comprehension_ty for_if_clause_rule(Parser *p);
+static expr_ty yield_expr_rule(Parser *p);
+static expr_ty arguments_rule(Parser *p);
+static expr_ty args_rule(Parser *p);
+static asdl_seq* kwargs_rule(Parser *p);
+static expr_ty starred_expression_rule(Parser *p);
+static KeywordOrStarred* kwarg_or_starred_rule(Parser *p);
+static KeywordOrStarred* kwarg_or_double_starred_rule(Parser *p);
+static expr_ty star_targets_rule(Parser *p);
+static asdl_expr_seq* star_targets_list_seq_rule(Parser *p);
+static asdl_expr_seq* star_targets_tuple_seq_rule(Parser *p);
+static expr_ty star_target_rule(Parser *p);
+static expr_ty target_with_star_atom_rule(Parser *p);
+static expr_ty star_atom_rule(Parser *p);
+static expr_ty single_target_rule(Parser *p);
+static expr_ty single_subscript_attribute_target_rule(Parser *p);
+static asdl_expr_seq* del_targets_rule(Parser *p);
+static expr_ty del_target_rule(Parser *p);
+static expr_ty del_t_atom_rule(Parser *p);
+static expr_ty t_primary_rule(Parser *p);
+static void *t_lookahead_rule(Parser *p);
+static void *invalid_arguments_rule(Parser *p);
+static void *invalid_kwarg_rule(Parser *p);
+static expr_ty expression_without_invalid_rule(Parser *p);
+static void *invalid_legacy_expression_rule(Parser *p);
+static void *invalid_expression_rule(Parser *p);
+static void *invalid_named_expression_rule(Parser *p);
+static void *invalid_assignment_rule(Parser *p);
+static expr_ty invalid_ann_assign_target_rule(Parser *p);
+static void *invalid_del_stmt_rule(Parser *p);
+static void *invalid_block_rule(Parser *p);
+static void *invalid_comprehension_rule(Parser *p);
+static void *invalid_dict_comprehension_rule(Parser *p);
+static void *invalid_parameters_rule(Parser *p);
+static void *invalid_parameters_helper_rule(Parser *p);
+static void *invalid_lambda_parameters_rule(Parser *p);
+static void *invalid_lambda_parameters_helper_rule(Parser *p);
+static void *invalid_star_etc_rule(Parser *p);
+static void *invalid_lambda_star_etc_rule(Parser *p);
+static void *invalid_double_type_comments_rule(Parser *p);
+static void *invalid_with_item_rule(Parser *p);
+static void *invalid_for_target_rule(Parser *p);
+static void *invalid_group_rule(Parser *p);
+static void *invalid_import_from_targets_rule(Parser *p);
+static void *invalid_with_stmt_rule(Parser *p);
+static void *invalid_with_stmt_indent_rule(Parser *p);
+static void *invalid_try_stmt_rule(Parser *p);
+static void *invalid_except_stmt_rule(Parser *p);
+static void *invalid_finally_stmt_rule(Parser *p);
+static void *invalid_except_stmt_indent_rule(Parser *p);
+static void *invalid_match_stmt_rule(Parser *p);
+static void *invalid_case_block_rule(Parser *p);
+static void *invalid_as_pattern_rule(Parser *p);
+static void *invalid_class_pattern_rule(Parser *p);
+static asdl_pattern_seq* invalid_class_argument_pattern_rule(Parser *p);
+static void *invalid_if_stmt_rule(Parser *p);
+static void *invalid_elif_stmt_rule(Parser *p);
+static void *invalid_else_stmt_rule(Parser *p);
+static void *invalid_while_stmt_rule(Parser *p);
+static void *invalid_for_stmt_rule(Parser *p);
+static void *invalid_def_raw_rule(Parser *p);
+static void *invalid_class_def_raw_rule(Parser *p);
+static void *invalid_double_starred_kvpairs_rule(Parser *p);
+static void *invalid_kvpair_rule(Parser *p);
+static asdl_seq *_loop0_1_rule(Parser *p);
+static asdl_seq *_loop0_2_rule(Parser *p);
+static asdl_seq *_loop0_4_rule(Parser *p);
+static asdl_seq *_gather_3_rule(Parser *p);
+static asdl_seq *_loop0_6_rule(Parser *p);
+static asdl_seq *_gather_5_rule(Parser *p);
+static asdl_seq *_loop0_8_rule(Parser *p);
+static asdl_seq *_gather_7_rule(Parser *p);
+static asdl_seq *_loop0_10_rule(Parser *p);
+static asdl_seq *_gather_9_rule(Parser *p);
+static asdl_seq *_loop1_11_rule(Parser *p);
+static asdl_seq *_loop0_13_rule(Parser *p);
+static asdl_seq *_gather_12_rule(Parser *p);
+static void *_tmp_14_rule(Parser *p);
+static void *_tmp_15_rule(Parser *p);
+static void *_tmp_16_rule(Parser *p);
+static void *_tmp_17_rule(Parser *p);
+static void *_tmp_18_rule(Parser *p);
+static void *_tmp_19_rule(Parser *p);
+static void *_tmp_20_rule(Parser *p);
+static void *_tmp_21_rule(Parser *p);
+static asdl_seq *_loop1_22_rule(Parser *p);
+static void *_tmp_23_rule(Parser *p);
+static void *_tmp_24_rule(Parser *p);
+static asdl_seq *_loop0_26_rule(Parser *p);
+static asdl_seq *_gather_25_rule(Parser *p);
+static asdl_seq *_loop0_28_rule(Parser *p);
+static asdl_seq *_gather_27_rule(Parser *p);
+static void *_tmp_29_rule(Parser *p);
+static void *_tmp_30_rule(Parser *p);
+static asdl_seq *_loop0_31_rule(Parser *p);
+static asdl_seq *_loop1_32_rule(Parser *p);
+static asdl_seq *_loop0_34_rule(Parser *p);
+static asdl_seq *_gather_33_rule(Parser *p);
+static void *_tmp_35_rule(Parser *p);
+static asdl_seq *_loop0_37_rule(Parser *p);
+static asdl_seq *_gather_36_rule(Parser *p);
+static void *_tmp_38_rule(Parser *p);
+static asdl_seq *_loop0_40_rule(Parser *p);
+static asdl_seq *_gather_39_rule(Parser *p);
+static asdl_seq *_loop0_42_rule(Parser *p);
+static asdl_seq *_gather_41_rule(Parser *p);
+static asdl_seq *_loop0_44_rule(Parser *p);
+static asdl_seq *_gather_43_rule(Parser *p);
+static asdl_seq *_loop0_46_rule(Parser *p);
+static asdl_seq *_gather_45_rule(Parser *p);
+static void *_tmp_47_rule(Parser *p);
+static asdl_seq *_loop1_48_rule(Parser *p);
+static void *_tmp_49_rule(Parser *p);
+static asdl_seq *_loop1_50_rule(Parser *p);
+static asdl_seq *_loop0_52_rule(Parser *p);
+static asdl_seq *_gather_51_rule(Parser *p);
+static void *_tmp_53_rule(Parser *p);
+static void *_tmp_54_rule(Parser *p);
+static void *_tmp_55_rule(Parser *p);
+static void *_tmp_56_rule(Parser *p);
+static asdl_seq *_loop0_58_rule(Parser *p);
+static asdl_seq *_gather_57_rule(Parser *p);
+static asdl_seq *_loop0_60_rule(Parser *p);
+static asdl_seq *_gather_59_rule(Parser *p);
+static void *_tmp_61_rule(Parser *p);
+static asdl_seq *_loop0_63_rule(Parser *p);
+static asdl_seq *_gather_62_rule(Parser *p);
+static asdl_seq *_loop0_65_rule(Parser *p);
+static asdl_seq *_gather_64_rule(Parser *p);
+static void *_tmp_66_rule(Parser *p);
+static void *_tmp_67_rule(Parser *p);
+static void *_tmp_68_rule(Parser *p);
+static void *_tmp_69_rule(Parser *p);
+static asdl_seq *_loop0_70_rule(Parser *p);
+static asdl_seq *_loop0_71_rule(Parser *p);
+static asdl_seq *_loop0_72_rule(Parser *p);
+static asdl_seq *_loop1_73_rule(Parser *p);
+static asdl_seq *_loop0_74_rule(Parser *p);
+static asdl_seq *_loop1_75_rule(Parser *p);
+static asdl_seq *_loop1_76_rule(Parser *p);
+static asdl_seq *_loop1_77_rule(Parser *p);
+static asdl_seq *_loop0_78_rule(Parser *p);
+static asdl_seq *_loop1_79_rule(Parser *p);
+static asdl_seq *_loop0_80_rule(Parser *p);
+static asdl_seq *_loop1_81_rule(Parser *p);
+static asdl_seq *_loop0_82_rule(Parser *p);
+static asdl_seq *_loop1_83_rule(Parser *p);
+static asdl_seq *_loop1_84_rule(Parser *p);
+static void *_tmp_85_rule(Parser *p);
+static asdl_seq *_loop1_86_rule(Parser *p);
+static asdl_seq *_loop0_88_rule(Parser *p);
+static asdl_seq *_gather_87_rule(Parser *p);
+static asdl_seq *_loop1_89_rule(Parser *p);
+static asdl_seq *_loop0_90_rule(Parser *p);
+static asdl_seq *_loop0_91_rule(Parser *p);
+static asdl_seq *_loop0_92_rule(Parser *p);
+static asdl_seq *_loop1_93_rule(Parser *p);
+static asdl_seq *_loop0_94_rule(Parser *p);
+static asdl_seq *_loop1_95_rule(Parser *p);
+static asdl_seq *_loop1_96_rule(Parser *p);
+static asdl_seq *_loop1_97_rule(Parser *p);
+static asdl_seq *_loop0_98_rule(Parser *p);
+static asdl_seq *_loop1_99_rule(Parser *p);
+static asdl_seq *_loop0_100_rule(Parser *p);
+static asdl_seq *_loop1_101_rule(Parser *p);
+static asdl_seq *_loop0_102_rule(Parser *p);
+static asdl_seq *_loop1_103_rule(Parser *p);
+static asdl_seq *_loop1_104_rule(Parser *p);
+static asdl_seq *_loop1_105_rule(Parser *p);
+static asdl_seq *_loop1_106_rule(Parser *p);
+static void *_tmp_107_rule(Parser *p);
+static asdl_seq *_loop0_109_rule(Parser *p);
+static asdl_seq *_gather_108_rule(Parser *p);
+static void *_tmp_110_rule(Parser *p);
+static void *_tmp_111_rule(Parser *p);
+static void *_tmp_112_rule(Parser *p);
+static void *_tmp_113_rule(Parser *p);
+static asdl_seq *_loop1_114_rule(Parser *p);
+static void *_tmp_115_rule(Parser *p);
+static void *_tmp_116_rule(Parser *p);
+static void *_tmp_117_rule(Parser *p);
+static asdl_seq *_loop0_119_rule(Parser *p);
+static asdl_seq *_gather_118_rule(Parser *p);
+static asdl_seq *_loop1_120_rule(Parser *p);
+static asdl_seq *_loop0_121_rule(Parser *p);
+static asdl_seq *_loop0_122_rule(Parser *p);
+static asdl_seq *_loop0_124_rule(Parser *p);
+static asdl_seq *_gather_123_rule(Parser *p);
+static void *_tmp_125_rule(Parser *p);
+static asdl_seq *_loop0_127_rule(Parser *p);
+static asdl_seq *_gather_126_rule(Parser *p);
+static asdl_seq *_loop0_129_rule(Parser *p);
+static asdl_seq *_gather_128_rule(Parser *p);
+static asdl_seq *_loop0_131_rule(Parser *p);
+static asdl_seq *_gather_130_rule(Parser *p);
+static asdl_seq *_loop0_133_rule(Parser *p);
+static asdl_seq *_gather_132_rule(Parser *p);
+static asdl_seq *_loop0_134_rule(Parser *p);
+static asdl_seq *_loop0_136_rule(Parser *p);
+static asdl_seq *_gather_135_rule(Parser *p);
+static asdl_seq *_loop1_137_rule(Parser *p);
+static void *_tmp_138_rule(Parser *p);
+static asdl_seq *_loop0_140_rule(Parser *p);
+static asdl_seq *_gather_139_rule(Parser *p);
+static void *_tmp_141_rule(Parser *p);
+static void *_tmp_142_rule(Parser *p);
+static void *_tmp_143_rule(Parser *p);
+static void *_tmp_144_rule(Parser *p);
+static void *_tmp_145_rule(Parser *p);
+static void *_tmp_146_rule(Parser *p);
+static void *_tmp_147_rule(Parser *p);
+static void *_tmp_148_rule(Parser *p);
+static asdl_seq *_loop0_149_rule(Parser *p);
+static asdl_seq *_loop0_150_rule(Parser *p);
+static asdl_seq *_loop0_151_rule(Parser *p);
+static void *_tmp_152_rule(Parser *p);
+static void *_tmp_153_rule(Parser *p);
+static void *_tmp_154_rule(Parser *p);
+static void *_tmp_155_rule(Parser *p);
+static asdl_seq *_loop0_156_rule(Parser *p);
+static asdl_seq *_loop1_157_rule(Parser *p);
+static asdl_seq *_loop0_158_rule(Parser *p);
+static asdl_seq *_loop1_159_rule(Parser *p);
+static void *_tmp_160_rule(Parser *p);
+static void *_tmp_161_rule(Parser *p);
+static void *_tmp_162_rule(Parser *p);
+static asdl_seq *_loop0_164_rule(Parser *p);
+static asdl_seq *_gather_163_rule(Parser *p);
+static asdl_seq *_loop0_166_rule(Parser *p);
+static asdl_seq *_gather_165_rule(Parser *p);
+static asdl_seq *_loop0_168_rule(Parser *p);
+static asdl_seq *_gather_167_rule(Parser *p);
+static asdl_seq *_loop0_170_rule(Parser *p);
+static asdl_seq *_gather_169_rule(Parser *p);
+static void *_tmp_171_rule(Parser *p);
+static void *_tmp_172_rule(Parser *p);
+static void *_tmp_173_rule(Parser *p);
+static void *_tmp_174_rule(Parser *p);
+static void *_tmp_175_rule(Parser *p);
+static void *_tmp_176_rule(Parser *p);
+static void *_tmp_177_rule(Parser *p);
+static asdl_seq *_loop0_179_rule(Parser *p);
+static asdl_seq *_gather_178_rule(Parser *p);
+static void *_tmp_180_rule(Parser *p);
+static void *_tmp_181_rule(Parser *p);
+static void *_tmp_182_rule(Parser *p);
+static void *_tmp_183_rule(Parser *p);
+static void *_tmp_184_rule(Parser *p);
+static void *_tmp_185_rule(Parser *p);
+static void *_tmp_186_rule(Parser *p);
+static void *_tmp_187_rule(Parser *p);
+static void *_tmp_188_rule(Parser *p);
+static void *_tmp_189_rule(Parser *p);
+static void *_tmp_190_rule(Parser *p);
+static void *_tmp_191_rule(Parser *p);
+static void *_tmp_192_rule(Parser *p);
+static void *_tmp_193_rule(Parser *p);
+static void *_tmp_194_rule(Parser *p);
+static void *_tmp_195_rule(Parser *p);
+static void *_tmp_196_rule(Parser *p);
+static void *_tmp_197_rule(Parser *p);
+static void *_tmp_198_rule(Parser *p);
+static void *_tmp_199_rule(Parser *p);
+static void *_tmp_200_rule(Parser *p);
+static void *_tmp_201_rule(Parser *p);
+static void *_tmp_202_rule(Parser *p);
+static void *_tmp_203_rule(Parser *p);
+static void *_tmp_204_rule(Parser *p);
+static void *_tmp_205_rule(Parser *p);
+static void *_tmp_206_rule(Parser *p);
 
-static void s_reset(stack *);
 
-static void
-s_reset(stack *s)
+// file: statements? $
+static mod_ty
+file_rule(Parser *p)
 {
-    s->s_top = &s->s_base[MAXSTACK];
-}
-
-#define s_empty(s) ((s)->s_top == &(s)->s_base[MAXSTACK])
-
-static int
-s_push(stack *s, const dfa *d, node *parent)
-{
-    stackentry *top;
-    if (s->s_top == s->s_base) {
-        fprintf(stderr, "s_push: parser stack overflow\n");
-        return E_NOMEM;
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
     }
-    top = --s->s_top;
-    top->s_dfa = d;
-    top->s_parent = parent;
-    top->s_state = 0;
-    return 0;
-}
-
-#ifdef Py_DEBUG
-
-static void
-s_pop(stack *s)
-{
-    if (s_empty(s)) {
-        Py_FatalError("parser stack underflow");
-    }
-    s->s_top++;
-}
-
-#else /* !Py_DEBUG */
-
-#define s_pop(s) (s)->s_top++
-
-#endif
-
-
-/* PARSER CREATION */
-
-parser_state *
-PyParser_New(grammar *g, int start)
-{
-    parser_state *ps;
-
-    if (!g->g_accel)
-        PyGrammar_AddAccelerators(g);
-    ps = (parser_state *)PyMem_MALLOC(sizeof(parser_state));
-    if (ps == NULL)
-        return NULL;
-    ps->p_grammar = g;
-#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD
-    ps->p_flags = 0;
-#endif
-    ps->p_tree = PyNode_New(start);
-    if (ps->p_tree == NULL) {
-        PyMem_FREE(ps);
+    if (p->error_indicator) {
+        p->level--;
         return NULL;
     }
-    s_reset(&ps->p_stack);
-    (void) s_push(&ps->p_stack, PyGrammar_FindDFA(g, start), ps->p_tree);
-    return ps;
-}
-
-void
-PyParser_Delete(parser_state *ps)
-{
-    /* NB If you want to save the parse tree,
-       you must set p_tree to NULL before calling delparser! */
-    PyNode_Free(ps->p_tree);
-    PyMem_FREE(ps);
-}
-
-
-/* PARSER STACK OPERATIONS */
-
-static int
-shift(stack *s, int type, char *str, int newstate, int lineno, int col_offset,
-      int end_lineno, int end_col_offset)
-{
-    int err;
-    assert(!s_empty(s));
-    err = PyNode_AddChild(s->s_top->s_parent, type, str, lineno, col_offset,
-                          end_lineno, end_col_offset);
-    if (err)
-        return err;
-    s->s_top->s_state = newstate;
-    return 0;
-}
-
-static int
-push(stack *s, int type, const dfa *d, int newstate, int lineno, int col_offset,
-     int end_lineno, int end_col_offset)
-{
-    int err;
-    node *n;
-    n = s->s_top->s_parent;
-    assert(!s_empty(s));
-    err = PyNode_AddChild(n, type, (char *)NULL, lineno, col_offset,
-                          end_lineno, end_col_offset);
-    if (err)
-        return err;
-    s->s_top->s_state = newstate;
-    return s_push(s, d, CHILD(n, NCH(n)-1));
-}
-
-
-/* PARSER PROPER */
-
-static int
-classify(parser_state *ps, int type, const char *str)
-{
-    grammar *g = ps->p_grammar;
-    int n = g->g_ll.ll_nlabels;
-
-    if (type == NAME) {
-        const label *l = g->g_ll.ll_label;
-        int i;
-        for (i = n; i > 0; i--, l++) {
-            if (l->lb_type != NAME || l->lb_str == NULL ||
-                l->lb_str[0] != str[0] ||
-                strcmp(l->lb_str, str) != 0)
-                continue;
-#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD
-#if 0
-            /* Leaving this in as an example */
-            if (!(ps->p_flags & CO_FUTURE_WITH_STATEMENT)) {
-                if (str[0] == 'w' && strcmp(str, "with") == 0)
-                    break; /* not a keyword yet */
-                else if (str[0] == 'a' && strcmp(str, "as") == 0)
-                    break; /* not a keyword yet */
+    mod_ty _res = NULL;
+    int _mark = p->mark;
+    { // statements? $
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> file[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statements? $"));
+        void *a;
+        Token * endmarker_var;
+        if (
+            (a = statements_rule(p), !p->error_indicator)  // statements?
+            &&
+            (endmarker_var = _PyPegen_expect_token(p, ENDMARKER))  // token='ENDMARKER'
+        )
+        {
+            D(fprintf(stderr, "%*c+ file[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statements? $"));
+            _res = _PyPegen_make_module ( p , a );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
             }
-#endif
-#endif
-            D(printf("It's a keyword\n"));
-            return n - i;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s file[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statements? $"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// interactive: statement_newline
+static mod_ty
+interactive_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    mod_ty _res = NULL;
+    int _mark = p->mark;
+    { // statement_newline
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> interactive[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement_newline"));
+        asdl_stmt_seq* a;
+        if (
+            (a = statement_newline_rule(p))  // statement_newline
+        )
+        {
+            D(fprintf(stderr, "%*c+ interactive[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statement_newline"));
+            _res = _PyAST_Interactive ( a , p -> arena );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s interactive[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement_newline"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// eval: expressions NEWLINE* $
+static mod_ty
+eval_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    mod_ty _res = NULL;
+    int _mark = p->mark;
+    { // expressions NEWLINE* $
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> eval[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expressions NEWLINE* $"));
+        asdl_seq * _loop0_1_var;
+        expr_ty a;
+        Token * endmarker_var;
+        if (
+            (a = expressions_rule(p))  // expressions
+            &&
+            (_loop0_1_var = _loop0_1_rule(p))  // NEWLINE*
+            &&
+            (endmarker_var = _PyPegen_expect_token(p, ENDMARKER))  // token='ENDMARKER'
+        )
+        {
+            D(fprintf(stderr, "%*c+ eval[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expressions NEWLINE* $"));
+            _res = _PyAST_Expression ( a , p -> arena );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s eval[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expressions NEWLINE* $"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// func_type: '(' type_expressions? ')' '->' expression NEWLINE* $
+static mod_ty
+func_type_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    mod_ty _res = NULL;
+    int _mark = p->mark;
+    { // '(' type_expressions? ')' '->' expression NEWLINE* $
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> func_type[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $"));
+        Token * _literal;
+        Token * _literal_1;
+        Token * _literal_2;
+        asdl_seq * _loop0_2_var;
+        void *a;
+        expr_ty b;
+        Token * endmarker_var;
+        if (
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+            &&
+            (a = type_expressions_rule(p), !p->error_indicator)  // type_expressions?
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
+            &&
+            (_literal_2 = _PyPegen_expect_token(p, 51))  // token='->'
+            &&
+            (b = expression_rule(p))  // expression
+            &&
+            (_loop0_2_var = _loop0_2_rule(p))  // NEWLINE*
+            &&
+            (endmarker_var = _PyPegen_expect_token(p, ENDMARKER))  // token='ENDMARKER'
+        )
+        {
+            D(fprintf(stderr, "%*c+ func_type[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $"));
+            _res = _PyAST_FunctionType ( a , b , p -> arena );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s func_type[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// fstring: star_expressions
+static expr_ty
+fstring_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    { // star_expressions
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> fstring[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
+        expr_ty star_expressions_var;
+        if (
+            (star_expressions_var = star_expressions_rule(p))  // star_expressions
+        )
+        {
+            D(fprintf(stderr, "%*c+ fstring[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
+            _res = star_expressions_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s fstring[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// type_expressions:
+//     | ','.expression+ ',' '*' expression ',' '**' expression
+//     | ','.expression+ ',' '*' expression
+//     | ','.expression+ ',' '**' expression
+//     | '*' expression ',' '**' expression
+//     | '*' expression
+//     | '**' expression
+//     | ','.expression+
+static asdl_expr_seq*
+type_expressions_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_expr_seq* _res = NULL;
+    int _mark = p->mark;
+    { // ','.expression+ ',' '*' expression ',' '**' expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
+        Token * _literal;
+        Token * _literal_1;
+        Token * _literal_2;
+        Token * _literal_3;
+        asdl_seq * a;
+        expr_ty b;
+        expr_ty c;
+        if (
+            (a = _gather_3_rule(p))  // ','.expression+
+            &&
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 16))  // token='*'
+            &&
+            (b = expression_rule(p))  // expression
+            &&
+            (_literal_2 = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (_literal_3 = _PyPegen_expect_token(p, 35))  // token='**'
+            &&
+            (c = expression_rule(p))  // expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
+            _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , CHECK ( asdl_seq * , _PyPegen_seq_append_to_end ( p , a , b ) ) , c );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
+    }
+    { // ','.expression+ ',' '*' expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression"));
+        Token * _literal;
+        Token * _literal_1;
+        asdl_seq * a;
+        expr_ty b;
+        if (
+            (a = _gather_5_rule(p))  // ','.expression+
+            &&
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 16))  // token='*'
+            &&
+            (b = expression_rule(p))  // expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression"));
+            _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , a , b );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '*' expression"));
+    }
+    { // ','.expression+ ',' '**' expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '**' expression"));
+        Token * _literal;
+        Token * _literal_1;
+        asdl_seq * a;
+        expr_ty b;
+        if (
+            (a = _gather_7_rule(p))  // ','.expression+
+            &&
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 35))  // token='**'
+            &&
+            (b = expression_rule(p))  // expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '**' expression"));
+            _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , a , b );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '**' expression"));
+    }
+    { // '*' expression ',' '**' expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression ',' '**' expression"));
+        Token * _literal;
+        Token * _literal_1;
+        Token * _literal_2;
+        expr_ty a;
+        expr_ty b;
+        if (
+            (_literal = _PyPegen_expect_token(p, 16))  // token='*'
+            &&
+            (a = expression_rule(p))  // expression
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (_literal_2 = _PyPegen_expect_token(p, 35))  // token='**'
+            &&
+            (b = expression_rule(p))  // expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression ',' '**' expression"));
+            _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , CHECK ( asdl_seq * , _PyPegen_singleton_seq ( p , a ) ) , b );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression ',' '**' expression"));
+    }
+    { // '*' expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression"));
+        Token * _literal;
+        expr_ty a;
+        if (
+            (_literal = _PyPegen_expect_token(p, 16))  // token='*'
+            &&
+            (a = expression_rule(p))  // expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression"));
+            _res = ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , a );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression"));
+    }
+    { // '**' expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression"));
+        Token * _literal;
+        expr_ty a;
+        if (
+            (_literal = _PyPegen_expect_token(p, 35))  // token='**'
+            &&
+            (a = expression_rule(p))  // expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression"));
+            _res = ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , a );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression"));
+    }
+    { // ','.expression+
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+"));
+        asdl_expr_seq* a;
+        if (
+            (a = (asdl_expr_seq*)_gather_9_rule(p))  // ','.expression+
+        )
+        {
+            D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+"));
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// statements: statement+
+static asdl_stmt_seq*
+statements_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_stmt_seq* _res = NULL;
+    int _mark = p->mark;
+    { // statement+
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> statements[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement+"));
+        asdl_seq * a;
+        if (
+            (a = _loop1_11_rule(p))  // statement+
+        )
+        {
+            D(fprintf(stderr, "%*c+ statements[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statement+"));
+            _res = ( asdl_stmt_seq * ) _PyPegen_seq_flatten ( p , a );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s statements[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement+"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// statement: compound_stmt | simple_stmts
+static asdl_stmt_seq*
+statement_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_stmt_seq* _res = NULL;
+    int _mark = p->mark;
+    { // compound_stmt
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> statement[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compound_stmt"));
+        stmt_ty a;
+        if (
+            (a = compound_stmt_rule(p))  // compound_stmt
+        )
+        {
+            D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "compound_stmt"));
+            _res = ( asdl_stmt_seq * ) _PyPegen_singleton_seq ( p , a );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s statement[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compound_stmt"));
+    }
+    { // simple_stmts
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> statement[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmts"));
+        asdl_stmt_seq* a;
+        if (
+            (a = (asdl_stmt_seq*)simple_stmts_rule(p))  // simple_stmts
+        )
+        {
+            D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmts"));
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s statement[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmts"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// statement_newline: compound_stmt NEWLINE | simple_stmts | NEWLINE | $
+static asdl_stmt_seq*
+statement_newline_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_stmt_seq* _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // compound_stmt NEWLINE
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compound_stmt NEWLINE"));
+        stmt_ty a;
+        Token * newline_var;
+        if (
+            (a = compound_stmt_rule(p))  // compound_stmt
+            &&
+            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+        )
+        {
+            D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "compound_stmt NEWLINE"));
+            _res = ( asdl_stmt_seq * ) _PyPegen_singleton_seq ( p , a );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compound_stmt NEWLINE"));
+    }
+    { // simple_stmts
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmts"));
+        asdl_stmt_seq* simple_stmts_var;
+        if (
+            (simple_stmts_var = simple_stmts_rule(p))  // simple_stmts
+        )
+        {
+            D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmts"));
+            _res = simple_stmts_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmts"));
+    }
+    { // NEWLINE
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
+        Token * newline_var;
+        if (
+            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+        )
+        {
+            D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = ( asdl_stmt_seq * ) _PyPegen_singleton_seq ( p , CHECK ( stmt_ty , _PyAST_Pass ( EXTRA ) ) );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
+    }
+    { // $
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "$"));
+        Token * endmarker_var;
+        if (
+            (endmarker_var = _PyPegen_expect_token(p, ENDMARKER))  // token='ENDMARKER'
+        )
+        {
+            D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "$"));
+            _res = _PyPegen_interactive_exit ( p );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "$"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// simple_stmts: simple_stmt !';' NEWLINE | ';'.simple_stmt+ ';'? NEWLINE
+static asdl_stmt_seq*
+simple_stmts_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_stmt_seq* _res = NULL;
+    int _mark = p->mark;
+    { // simple_stmt !';' NEWLINE
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> simple_stmts[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt !';' NEWLINE"));
+        stmt_ty a;
+        Token * newline_var;
+        if (
+            (a = simple_stmt_rule(p))  // simple_stmt
+            &&
+            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 13)  // token=';'
+            &&
+            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+        )
+        {
+            D(fprintf(stderr, "%*c+ simple_stmts[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt !';' NEWLINE"));
+            _res = ( asdl_stmt_seq * ) _PyPegen_singleton_seq ( p , a );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s simple_stmts[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt !';' NEWLINE"));
+    }
+    { // ';'.simple_stmt+ ';'? NEWLINE
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> simple_stmts[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'.simple_stmt+ ';'? NEWLINE"));
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        asdl_stmt_seq* a;
+        Token * newline_var;
+        if (
+            (a = (asdl_stmt_seq*)_gather_12_rule(p))  // ';'.simple_stmt+
+            &&
+            (_opt_var = _PyPegen_expect_token(p, 13), !p->error_indicator)  // ';'?
+            &&
+            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+        )
+        {
+            D(fprintf(stderr, "%*c+ simple_stmts[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'.simple_stmt+ ';'? NEWLINE"));
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s simple_stmts[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'.simple_stmt+ ';'? NEWLINE"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// simple_stmt:
+//     | assignment
+//     | star_expressions
+//     | &'return' return_stmt
+//     | &('import' | 'from') import_stmt
+//     | &'raise' raise_stmt
+//     | 'pass'
+//     | &'del' del_stmt
+//     | &'yield' yield_stmt
+//     | &'assert' assert_stmt
+//     | 'break'
+//     | 'continue'
+//     | &'global' global_stmt
+//     | &'nonlocal' nonlocal_stmt
+static stmt_ty
+simple_stmt_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    stmt_ty _res = NULL;
+    if (_PyPegen_is_memoized(p, simple_stmt_type, &_res)) {
+        p->level--;
+        return _res;
+    }
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // assignment
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "assignment"));
+        stmt_ty assignment_var;
+        if (
+            (assignment_var = assignment_rule(p))  // assignment
+        )
+        {
+            D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "assignment"));
+            _res = assignment_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "assignment"));
+    }
+    { // star_expressions
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
+        expr_ty e;
+        if (
+            (e = star_expressions_rule(p))  // star_expressions
+        )
+        {
+            D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Expr ( e , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
+    }
+    { // &'return' return_stmt
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'return' return_stmt"));
+        stmt_ty return_stmt_var;
+        if (
+            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 500)  // token='return'
+            &&
+            (return_stmt_var = return_stmt_rule(p))  // return_stmt
+        )
+        {
+            D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'return' return_stmt"));
+            _res = return_stmt_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'return' return_stmt"));
+    }
+    { // &('import' | 'from') import_stmt
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('import' | 'from') import_stmt"));
+        stmt_ty import_stmt_var;
+        if (
+            _PyPegen_lookahead(1, _tmp_14_rule, p)
+            &&
+            (import_stmt_var = import_stmt_rule(p))  // import_stmt
+        )
+        {
+            D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('import' | 'from') import_stmt"));
+            _res = import_stmt_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('import' | 'from') import_stmt"));
+    }
+    { // &'raise' raise_stmt
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'raise' raise_stmt"));
+        stmt_ty raise_stmt_var;
+        if (
+            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 501)  // token='raise'
+            &&
+            (raise_stmt_var = raise_stmt_rule(p))  // raise_stmt
+        )
+        {
+            D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'raise' raise_stmt"));
+            _res = raise_stmt_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'raise' raise_stmt"));
+    }
+    { // 'pass'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'pass'"));
+        Token * _keyword;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 502))  // token='pass'
+        )
+        {
+            D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'pass'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Pass ( EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'pass'"));
+    }
+    { // &'del' del_stmt
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'del' del_stmt"));
+        stmt_ty del_stmt_var;
+        if (
+            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 503)  // token='del'
+            &&
+            (del_stmt_var = del_stmt_rule(p))  // del_stmt
+        )
+        {
+            D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'del' del_stmt"));
+            _res = del_stmt_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'del' del_stmt"));
+    }
+    { // &'yield' yield_stmt
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'yield' yield_stmt"));
+        stmt_ty yield_stmt_var;
+        if (
+            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 504)  // token='yield'
+            &&
+            (yield_stmt_var = yield_stmt_rule(p))  // yield_stmt
+        )
+        {
+            D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'yield' yield_stmt"));
+            _res = yield_stmt_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'yield' yield_stmt"));
+    }
+    { // &'assert' assert_stmt
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'assert' assert_stmt"));
+        stmt_ty assert_stmt_var;
+        if (
+            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 505)  // token='assert'
+            &&
+            (assert_stmt_var = assert_stmt_rule(p))  // assert_stmt
+        )
+        {
+            D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'assert' assert_stmt"));
+            _res = assert_stmt_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'assert' assert_stmt"));
+    }
+    { // 'break'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'break'"));
+        Token * _keyword;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 506))  // token='break'
+        )
+        {
+            D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'break'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Break ( EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'break'"));
+    }
+    { // 'continue'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'continue'"));
+        Token * _keyword;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 507))  // token='continue'
+        )
+        {
+            D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'continue'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Continue ( EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'continue'"));
+    }
+    { // &'global' global_stmt
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'global' global_stmt"));
+        stmt_ty global_stmt_var;
+        if (
+            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 508)  // token='global'
+            &&
+            (global_stmt_var = global_stmt_rule(p))  // global_stmt
+        )
+        {
+            D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'global' global_stmt"));
+            _res = global_stmt_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'global' global_stmt"));
+    }
+    { // &'nonlocal' nonlocal_stmt
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'nonlocal' nonlocal_stmt"));
+        stmt_ty nonlocal_stmt_var;
+        if (
+            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 509)  // token='nonlocal'
+            &&
+            (nonlocal_stmt_var = nonlocal_stmt_rule(p))  // nonlocal_stmt
+        )
+        {
+            D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'nonlocal' nonlocal_stmt"));
+            _res = nonlocal_stmt_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'nonlocal' nonlocal_stmt"));
+    }
+    _res = NULL;
+  done:
+    _PyPegen_insert_memo(p, _mark, simple_stmt_type, _res);
+    p->level--;
+    return _res;
+}
+
+// compound_stmt:
+//     | &('def' | '@' | ASYNC) function_def
+//     | &'if' if_stmt
+//     | &('class' | '@') class_def
+//     | &('with' | ASYNC) with_stmt
+//     | &('for' | ASYNC) for_stmt
+//     | &'try' try_stmt
+//     | &'while' while_stmt
+//     | match_stmt
+static stmt_ty
+compound_stmt_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    stmt_ty _res = NULL;
+    int _mark = p->mark;
+    { // &('def' | '@' | ASYNC) function_def
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('def' | '@' | ASYNC) function_def"));
+        stmt_ty function_def_var;
+        if (
+            _PyPegen_lookahead(1, _tmp_15_rule, p)
+            &&
+            (function_def_var = function_def_rule(p))  // function_def
+        )
+        {
+            D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('def' | '@' | ASYNC) function_def"));
+            _res = function_def_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('def' | '@' | ASYNC) function_def"));
+    }
+    { // &'if' if_stmt
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'if' if_stmt"));
+        stmt_ty if_stmt_var;
+        if (
+            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 510)  // token='if'
+            &&
+            (if_stmt_var = if_stmt_rule(p))  // if_stmt
+        )
+        {
+            D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'if' if_stmt"));
+            _res = if_stmt_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'if' if_stmt"));
+    }
+    { // &('class' | '@') class_def
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('class' | '@') class_def"));
+        stmt_ty class_def_var;
+        if (
+            _PyPegen_lookahead(1, _tmp_16_rule, p)
+            &&
+            (class_def_var = class_def_rule(p))  // class_def
+        )
+        {
+            D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('class' | '@') class_def"));
+            _res = class_def_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('class' | '@') class_def"));
+    }
+    { // &('with' | ASYNC) with_stmt
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('with' | ASYNC) with_stmt"));
+        stmt_ty with_stmt_var;
+        if (
+            _PyPegen_lookahead(1, _tmp_17_rule, p)
+            &&
+            (with_stmt_var = with_stmt_rule(p))  // with_stmt
+        )
+        {
+            D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('with' | ASYNC) with_stmt"));
+            _res = with_stmt_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('with' | ASYNC) with_stmt"));
+    }
+    { // &('for' | ASYNC) for_stmt
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('for' | ASYNC) for_stmt"));
+        stmt_ty for_stmt_var;
+        if (
+            _PyPegen_lookahead(1, _tmp_18_rule, p)
+            &&
+            (for_stmt_var = for_stmt_rule(p))  // for_stmt
+        )
+        {
+            D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('for' | ASYNC) for_stmt"));
+            _res = for_stmt_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('for' | ASYNC) for_stmt"));
+    }
+    { // &'try' try_stmt
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'try' try_stmt"));
+        stmt_ty try_stmt_var;
+        if (
+            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 511)  // token='try'
+            &&
+            (try_stmt_var = try_stmt_rule(p))  // try_stmt
+        )
+        {
+            D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'try' try_stmt"));
+            _res = try_stmt_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'try' try_stmt"));
+    }
+    { // &'while' while_stmt
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'while' while_stmt"));
+        stmt_ty while_stmt_var;
+        if (
+            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 512)  // token='while'
+            &&
+            (while_stmt_var = while_stmt_rule(p))  // while_stmt
+        )
+        {
+            D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'while' while_stmt"));
+            _res = while_stmt_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'while' while_stmt"));
+    }
+    { // match_stmt
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "match_stmt"));
+        stmt_ty match_stmt_var;
+        if (
+            (match_stmt_var = match_stmt_rule(p))  // match_stmt
+        )
+        {
+            D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "match_stmt"));
+            _res = match_stmt_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "match_stmt"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// assignment:
+//     | NAME ':' expression ['=' annotated_rhs]
+//     | ('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]
+//     | ((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?
+//     | single_target augassign ~ (yield_expr | star_expressions)
+//     | invalid_assignment
+static stmt_ty
+assignment_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    stmt_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // NAME ':' expression ['=' annotated_rhs]
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]"));
+        Token * _literal;
+        expr_ty a;
+        expr_ty b;
+        void *c;
+        if (
+            (a = _PyPegen_name_token(p))  // NAME
+            &&
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (b = expression_rule(p))  // expression
+            &&
+            (c = _tmp_19_rule(p), !p->error_indicator)  // ['=' annotated_rhs]
+        )
+        {
+            D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = CHECK_VERSION ( stmt_ty , 6 , "Variable annotation syntax is" , _PyAST_AnnAssign ( CHECK ( expr_ty , _PyPegen_set_expr_context ( p , a , Store ) ) , b , c , 1 , EXTRA ) );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]"));
+    }
+    { // ('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]"));
+        Token * _literal;
+        void *a;
+        expr_ty b;
+        void *c;
+        if (
+            (a = _tmp_20_rule(p))  // '(' single_target ')' | single_subscript_attribute_target
+            &&
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (b = expression_rule(p))  // expression
+            &&
+            (c = _tmp_21_rule(p), !p->error_indicator)  // ['=' annotated_rhs]
+        )
+        {
+            D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = CHECK_VERSION ( stmt_ty , 6 , "Variable annotations syntax is" , _PyAST_AnnAssign ( a , b , c , 0 , EXTRA ) );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]"));
+    }
+    { // ((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?"));
+        asdl_expr_seq* a;
+        void *b;
+        void *tc;
+        if (
+            (a = (asdl_expr_seq*)_loop1_22_rule(p))  // ((star_targets '='))+
+            &&
+            (b = _tmp_23_rule(p))  // yield_expr | star_expressions
+            &&
+            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22)  // token='='
+            &&
+            (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator)  // TYPE_COMMENT?
+        )
+        {
+            D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Assign ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?"));
+    }
+    { // single_target augassign ~ (yield_expr | star_expressions)
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_target augassign ~ (yield_expr | star_expressions)"));
+        int _cut_var = 0;
+        expr_ty a;
+        AugOperator* b;
+        void *c;
+        if (
+            (a = single_target_rule(p))  // single_target
+            &&
+            (b = augassign_rule(p))  // augassign
+            &&
+            (_cut_var = 1)
+            &&
+            (c = _tmp_24_rule(p))  // yield_expr | star_expressions
+        )
+        {
+            D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_target augassign ~ (yield_expr | star_expressions)"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_AugAssign ( a , b -> kind , c , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_target augassign ~ (yield_expr | star_expressions)"));
+        if (_cut_var) {
+            p->level--;
+            return NULL;
         }
     }
-
-    {
-        const label *l = g->g_ll.ll_label;
-        int i;
-        for (i = n; i > 0; i--, l++) {
-            if (l->lb_type == type && l->lb_str == NULL) {
-                D(printf("It's a token we know\n"));
-                return n - i;
-            }
+    if (p->call_invalid_rules) { // invalid_assignment
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
         }
+        D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_assignment"));
+        void *invalid_assignment_var;
+        if (
+            (invalid_assignment_var = invalid_assignment_rule(p))  // invalid_assignment
+        )
+        {
+            D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_assignment"));
+            _res = invalid_assignment_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_assignment"));
     }
-
-    D(printf("Illegal token\n"));
-    return -1;
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
 }
 
-#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD
-#if 0
-/* Leaving this in as an example */
-static void
-future_hack(parser_state *ps)
+// augassign:
+//     | '+='
+//     | '-='
+//     | '*='
+//     | '@='
+//     | '/='
+//     | '%='
+//     | '&='
+//     | '|='
+//     | '^='
+//     | '<<='
+//     | '>>='
+//     | '**='
+//     | '//='
+static AugOperator*
+augassign_rule(Parser *p)
 {
-    node *n = ps->p_stack.s_top->s_parent;
-    node *ch, *cch;
-    int i;
-
-    /* from __future__ import ..., must have at least 4 children */
-    n = CHILD(n, 0);
-    if (NCH(n) < 4)
-        return;
-    ch = CHILD(n, 0);
-    if (STR(ch) == NULL || strcmp(STR(ch), "from") != 0)
-        return;
-    ch = CHILD(n, 1);
-    if (NCH(ch) == 1 && STR(CHILD(ch, 0)) &&
-        strcmp(STR(CHILD(ch, 0)), "__future__") != 0)
-        return;
-    ch = CHILD(n, 3);
-    /* ch can be a star, a parenthesis or import_as_names */
-    if (TYPE(ch) == STAR)
-        return;
-    if (TYPE(ch) == LPAR)
-        ch = CHILD(n, 4);
-
-    for (i = 0; i < NCH(ch); i += 2) {
-        cch = CHILD(ch, i);
-        if (NCH(cch) >= 1 && TYPE(CHILD(cch, 0)) == NAME) {
-            char *str_ch = STR(CHILD(cch, 0));
-            if (strcmp(str_ch, FUTURE_WITH_STATEMENT) == 0) {
-                ps->p_flags |= CO_FUTURE_WITH_STATEMENT;
-            } else if (strcmp(str_ch, FUTURE_PRINT_FUNCTION) == 0) {
-                ps->p_flags |= CO_FUTURE_PRINT_FUNCTION;
-            } else if (strcmp(str_ch, FUTURE_UNICODE_LITERALS) == 0) {
-                ps->p_flags |= CO_FUTURE_UNICODE_LITERALS;
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    AugOperator* _res = NULL;
+    int _mark = p->mark;
+    { // '+='
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+='"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 36))  // token='+='
+        )
+        {
+            D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+='"));
+            _res = _PyPegen_augoperator ( p , Add );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
             }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+='"));
+    }
+    { // '-='
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-='"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 37))  // token='-='
+        )
+        {
+            D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-='"));
+            _res = _PyPegen_augoperator ( p , Sub );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-='"));
+    }
+    { // '*='
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*='"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 38))  // token='*='
+        )
+        {
+            D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*='"));
+            _res = _PyPegen_augoperator ( p , Mult );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*='"));
+    }
+    { // '@='
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@='"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 50))  // token='@='
+        )
+        {
+            D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@='"));
+            _res = CHECK_VERSION ( AugOperator * , 5 , "The '@' operator is" , _PyPegen_augoperator ( p , MatMult ) );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@='"));
+    }
+    { // '/='
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'/='"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 39))  // token='/='
+        )
+        {
+            D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'/='"));
+            _res = _PyPegen_augoperator ( p , Div );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'/='"));
+    }
+    { // '%='
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'%='"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 40))  // token='%='
+        )
+        {
+            D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'%='"));
+            _res = _PyPegen_augoperator ( p , Mod );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'%='"));
+    }
+    { // '&='
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'&='"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 41))  // token='&='
+        )
+        {
+            D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'&='"));
+            _res = _PyPegen_augoperator ( p , BitAnd );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'&='"));
+    }
+    { // '|='
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|='"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 42))  // token='|='
+        )
+        {
+            D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'|='"));
+            _res = _PyPegen_augoperator ( p , BitOr );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|='"));
+    }
+    { // '^='
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'^='"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 43))  // token='^='
+        )
+        {
+            D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'^='"));
+            _res = _PyPegen_augoperator ( p , BitXor );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'^='"));
+    }
+    { // '<<='
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<<='"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 44))  // token='<<='
+        )
+        {
+            D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<<='"));
+            _res = _PyPegen_augoperator ( p , LShift );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<<='"));
+    }
+    { // '>>='
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>>='"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 45))  // token='>>='
+        )
+        {
+            D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>>='"));
+            _res = _PyPegen_augoperator ( p , RShift );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>>='"));
+    }
+    { // '**='
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**='"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 46))  // token='**='
+        )
+        {
+            D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**='"));
+            _res = _PyPegen_augoperator ( p , Pow );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**='"));
+    }
+    { // '//='
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'//='"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 48))  // token='//='
+        )
+        {
+            D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'//='"));
+            _res = _PyPegen_augoperator ( p , FloorDiv );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'//='"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// global_stmt: 'global' ','.NAME+
+static stmt_ty
+global_stmt_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    stmt_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // 'global' ','.NAME+
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> global_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+"));
+        Token * _keyword;
+        asdl_expr_seq* a;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 508))  // token='global'
+            &&
+            (a = (asdl_expr_seq*)_gather_25_rule(p))  // ','.NAME+
+        )
+        {
+            D(fprintf(stderr, "%*c+ global_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Global ( CHECK ( asdl_identifier_seq * , _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s global_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'global' ','.NAME+"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// nonlocal_stmt: 'nonlocal' ','.NAME+
+static stmt_ty
+nonlocal_stmt_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    stmt_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // 'nonlocal' ','.NAME+
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> nonlocal_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+"));
+        Token * _keyword;
+        asdl_expr_seq* a;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 509))  // token='nonlocal'
+            &&
+            (a = (asdl_expr_seq*)_gather_27_rule(p))  // ','.NAME+
+        )
+        {
+            D(fprintf(stderr, "%*c+ nonlocal_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Nonlocal ( CHECK ( asdl_identifier_seq * , _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s nonlocal_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'nonlocal' ','.NAME+"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// yield_stmt: yield_expr
+static stmt_ty
+yield_stmt_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    stmt_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // yield_expr
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> yield_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
+        expr_ty y;
+        if (
+            (y = yield_expr_rule(p))  // yield_expr
+        )
+        {
+            D(fprintf(stderr, "%*c+ yield_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Expr ( y , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s yield_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// assert_stmt: 'assert' expression [',' expression]
+static stmt_ty
+assert_stmt_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    stmt_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // 'assert' expression [',' expression]
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> assert_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]"));
+        Token * _keyword;
+        expr_ty a;
+        void *b;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 505))  // token='assert'
+            &&
+            (a = expression_rule(p))  // expression
+            &&
+            (b = _tmp_29_rule(p), !p->error_indicator)  // [',' expression]
+        )
+        {
+            D(fprintf(stderr, "%*c+ assert_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Assert ( a , b , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s assert_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'assert' expression [',' expression]"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// del_stmt: 'del' del_targets &(';' | NEWLINE) | invalid_del_stmt
+static stmt_ty
+del_stmt_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    stmt_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // 'del' del_targets &(';' | NEWLINE)
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'del' del_targets &(';' | NEWLINE)"));
+        Token * _keyword;
+        asdl_expr_seq* a;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 503))  // token='del'
+            &&
+            (a = del_targets_rule(p))  // del_targets
+            &&
+            _PyPegen_lookahead(1, _tmp_30_rule, p)
+        )
+        {
+            D(fprintf(stderr, "%*c+ del_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'del' del_targets &(';' | NEWLINE)"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Delete ( a , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s del_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'del' del_targets &(';' | NEWLINE)"));
+    }
+    if (p->call_invalid_rules) { // invalid_del_stmt
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_del_stmt"));
+        void *invalid_del_stmt_var;
+        if (
+            (invalid_del_stmt_var = invalid_del_stmt_rule(p))  // invalid_del_stmt
+        )
+        {
+            D(fprintf(stderr, "%*c+ del_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_del_stmt"));
+            _res = invalid_del_stmt_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s del_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_del_stmt"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// import_stmt: import_name | import_from
+static stmt_ty
+import_stmt_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    stmt_ty _res = NULL;
+    int _mark = p->mark;
+    { // import_name
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> import_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_name"));
+        stmt_ty import_name_var;
+        if (
+            (import_name_var = import_name_rule(p))  // import_name
+        )
+        {
+            D(fprintf(stderr, "%*c+ import_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_name"));
+            _res = import_name_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_name"));
+    }
+    { // import_from
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> import_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from"));
+        stmt_ty import_from_var;
+        if (
+            (import_from_var = import_from_rule(p))  // import_from
+        )
+        {
+            D(fprintf(stderr, "%*c+ import_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from"));
+            _res = import_from_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// import_name: 'import' dotted_as_names
+static stmt_ty
+import_name_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    stmt_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // 'import' dotted_as_names
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> import_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import' dotted_as_names"));
+        Token * _keyword;
+        asdl_alias_seq* a;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 513))  // token='import'
+            &&
+            (a = dotted_as_names_rule(p))  // dotted_as_names
+        )
+        {
+            D(fprintf(stderr, "%*c+ import_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import' dotted_as_names"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Import ( a , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s import_name[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import' dotted_as_names"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// import_from:
+//     | 'from' (('.' | '...'))* dotted_name 'import' import_from_targets
+//     | 'from' (('.' | '...'))+ 'import' import_from_targets
+static stmt_ty
+import_from_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    stmt_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // 'from' (('.' | '...'))* dotted_name 'import' import_from_targets
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> import_from[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets"));
+        Token * _keyword;
+        Token * _keyword_1;
+        asdl_seq * a;
+        expr_ty b;
+        asdl_alias_seq* c;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 514))  // token='from'
+            &&
+            (a = _loop0_31_rule(p))  // (('.' | '...'))*
+            &&
+            (b = dotted_name_rule(p))  // dotted_name
+            &&
+            (_keyword_1 = _PyPegen_expect_token(p, 513))  // token='import'
+            &&
+            (c = import_from_targets_rule(p))  // import_from_targets
+        )
+        {
+            D(fprintf(stderr, "%*c+ import_from[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_ImportFrom ( b -> v . Name . id , c , _PyPegen_seq_count_dots ( a ) , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s import_from[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets"));
+    }
+    { // 'from' (('.' | '...'))+ 'import' import_from_targets
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> import_from[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets"));
+        Token * _keyword;
+        Token * _keyword_1;
+        asdl_seq * a;
+        asdl_alias_seq* b;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 514))  // token='from'
+            &&
+            (a = _loop1_32_rule(p))  // (('.' | '...'))+
+            &&
+            (_keyword_1 = _PyPegen_expect_token(p, 513))  // token='import'
+            &&
+            (b = import_from_targets_rule(p))  // import_from_targets
+        )
+        {
+            D(fprintf(stderr, "%*c+ import_from[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_ImportFrom ( NULL , b , _PyPegen_seq_count_dots ( a ) , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s import_from[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// import_from_targets:
+//     | '(' import_from_as_names ','? ')'
+//     | import_from_as_names !','
+//     | '*'
+//     | invalid_import_from_targets
+static asdl_alias_seq*
+import_from_targets_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_alias_seq* _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // '(' import_from_as_names ','? ')'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' import_from_as_names ','? ')'"));
+        Token * _literal;
+        Token * _literal_1;
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        asdl_alias_seq* a;
+        if (
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+            &&
+            (a = import_from_as_names_rule(p))  // import_from_as_names
+            &&
+            (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator)  // ','?
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
+        )
+        {
+            D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' import_from_as_names ','? ')'"));
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' import_from_as_names ','? ')'"));
+    }
+    { // import_from_as_names !','
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_names !','"));
+        asdl_alias_seq* import_from_as_names_var;
+        if (
+            (import_from_as_names_var = import_from_as_names_rule(p))  // import_from_as_names
+            &&
+            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12)  // token=','
+        )
+        {
+            D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names !','"));
+            _res = import_from_as_names_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names !','"));
+    }
+    { // '*'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*'"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 16))  // token='*'
+        )
+        {
+            D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = ( asdl_alias_seq * ) _PyPegen_singleton_seq ( p , CHECK ( alias_ty , _PyPegen_alias_for_star ( p , EXTRA ) ) );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*'"));
+    }
+    if (p->call_invalid_rules) { // invalid_import_from_targets
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_import_from_targets"));
+        void *invalid_import_from_targets_var;
+        if (
+            (invalid_import_from_targets_var = invalid_import_from_targets_rule(p))  // invalid_import_from_targets
+        )
+        {
+            D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_import_from_targets"));
+            _res = invalid_import_from_targets_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_import_from_targets"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// import_from_as_names: ','.import_from_as_name+
+static asdl_alias_seq*
+import_from_as_names_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_alias_seq* _res = NULL;
+    int _mark = p->mark;
+    { // ','.import_from_as_name+
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> import_from_as_names[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.import_from_as_name+"));
+        asdl_alias_seq* a;
+        if (
+            (a = (asdl_alias_seq*)_gather_33_rule(p))  // ','.import_from_as_name+
+        )
+        {
+            D(fprintf(stderr, "%*c+ import_from_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.import_from_as_name+"));
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s import_from_as_names[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.import_from_as_name+"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// import_from_as_name: NAME ['as' NAME]
+static alias_ty
+import_from_as_name_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    alias_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // NAME ['as' NAME]
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> import_from_as_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ['as' NAME]"));
+        expr_ty a;
+        void *b;
+        if (
+            (a = _PyPegen_name_token(p))  // NAME
+            &&
+            (b = _tmp_35_rule(p), !p->error_indicator)  // ['as' NAME]
+        )
+        {
+            D(fprintf(stderr, "%*c+ import_from_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ['as' NAME]"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s import_from_as_name[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ['as' NAME]"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// dotted_as_names: ','.dotted_as_name+
+static asdl_alias_seq*
+dotted_as_names_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_alias_seq* _res = NULL;
+    int _mark = p->mark;
+    { // ','.dotted_as_name+
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> dotted_as_names[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.dotted_as_name+"));
+        asdl_alias_seq* a;
+        if (
+            (a = (asdl_alias_seq*)_gather_36_rule(p))  // ','.dotted_as_name+
+        )
+        {
+            D(fprintf(stderr, "%*c+ dotted_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.dotted_as_name+"));
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s dotted_as_names[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.dotted_as_name+"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// dotted_as_name: dotted_name ['as' NAME]
+static alias_ty
+dotted_as_name_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    alias_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // dotted_name ['as' NAME]
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> dotted_as_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_name ['as' NAME]"));
+        expr_ty a;
+        void *b;
+        if (
+            (a = dotted_name_rule(p))  // dotted_name
+            &&
+            (b = _tmp_38_rule(p), !p->error_indicator)  // ['as' NAME]
+        )
+        {
+            D(fprintf(stderr, "%*c+ dotted_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name ['as' NAME]"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s dotted_as_name[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name ['as' NAME]"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// Left-recursive
+// dotted_name: dotted_name '.' NAME | NAME
+static expr_ty dotted_name_raw(Parser *);
+static expr_ty
+dotted_name_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    expr_ty _res = NULL;
+    if (_PyPegen_is_memoized(p, dotted_name_type, &_res)) {
+        p->level--;
+        return _res;
+    }
+    int _mark = p->mark;
+    int _resmark = p->mark;
+    while (1) {
+        int tmpvar_0 = _PyPegen_update_memo(p, _mark, dotted_name_type, _res);
+        if (tmpvar_0) {
+            p->level--;
+            return _res;
+        }
+        p->mark = _mark;
+        void *_raw = dotted_name_raw(p);
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        if (_raw == NULL || p->mark <= _resmark)
+            break;
+        _resmark = p->mark;
+        _res = _raw;
+    }
+    p->mark = _resmark;
+    p->level--;
+    return _res;
+}
+static expr_ty
+dotted_name_raw(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    { // dotted_name '.' NAME
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> dotted_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_name '.' NAME"));
+        Token * _literal;
+        expr_ty a;
+        expr_ty b;
+        if (
+            (a = dotted_name_rule(p))  // dotted_name
+            &&
+            (_literal = _PyPegen_expect_token(p, 23))  // token='.'
+            &&
+            (b = _PyPegen_name_token(p))  // NAME
+        )
+        {
+            D(fprintf(stderr, "%*c+ dotted_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name '.' NAME"));
+            _res = _PyPegen_join_names_with_dot ( p , a , b );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s dotted_name[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name '.' NAME"));
+    }
+    { // NAME
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> dotted_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
+        expr_ty name_var;
+        if (
+            (name_var = _PyPegen_name_token(p))  // NAME
+        )
+        {
+            D(fprintf(stderr, "%*c+ dotted_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
+            _res = name_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s dotted_name[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// if_stmt:
+//     | invalid_if_stmt
+//     | 'if' named_expression ':' block elif_stmt
+//     | 'if' named_expression ':' block else_block?
+static stmt_ty
+if_stmt_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    stmt_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    if (p->call_invalid_rules) { // invalid_if_stmt
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_if_stmt"));
+        void *invalid_if_stmt_var;
+        if (
+            (invalid_if_stmt_var = invalid_if_stmt_rule(p))  // invalid_if_stmt
+        )
+        {
+            D(fprintf(stderr, "%*c+ if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_if_stmt"));
+            _res = invalid_if_stmt_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_if_stmt"));
+    }
+    { // 'if' named_expression ':' block elif_stmt
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block elif_stmt"));
+        Token * _keyword;
+        Token * _literal;
+        expr_ty a;
+        asdl_stmt_seq* b;
+        stmt_ty c;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 510))  // token='if'
+            &&
+            (a = named_expression_rule(p))  // named_expression
+            &&
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (b = block_rule(p))  // block
+            &&
+            (c = elif_stmt_rule(p))  // elif_stmt
+        )
+        {
+            D(fprintf(stderr, "%*c+ if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block elif_stmt"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_If ( a , b , CHECK ( asdl_stmt_seq * , _PyPegen_singleton_seq ( p , c ) ) , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression ':' block elif_stmt"));
+    }
+    { // 'if' named_expression ':' block else_block?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block else_block?"));
+        Token * _keyword;
+        Token * _literal;
+        expr_ty a;
+        asdl_stmt_seq* b;
+        void *c;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 510))  // token='if'
+            &&
+            (a = named_expression_rule(p))  // named_expression
+            &&
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (b = block_rule(p))  // block
+            &&
+            (c = else_block_rule(p), !p->error_indicator)  // else_block?
+        )
+        {
+            D(fprintf(stderr, "%*c+ if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block else_block?"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_If ( a , b , c , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression ':' block else_block?"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// elif_stmt:
+//     | invalid_elif_stmt
+//     | 'elif' named_expression ':' block elif_stmt
+//     | 'elif' named_expression ':' block else_block?
+static stmt_ty
+elif_stmt_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    stmt_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    if (p->call_invalid_rules) { // invalid_elif_stmt
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_elif_stmt"));
+        void *invalid_elif_stmt_var;
+        if (
+            (invalid_elif_stmt_var = invalid_elif_stmt_rule(p))  // invalid_elif_stmt
+        )
+        {
+            D(fprintf(stderr, "%*c+ elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_elif_stmt"));
+            _res = invalid_elif_stmt_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_elif_stmt"));
+    }
+    { // 'elif' named_expression ':' block elif_stmt
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block elif_stmt"));
+        Token * _keyword;
+        Token * _literal;
+        expr_ty a;
+        asdl_stmt_seq* b;
+        stmt_ty c;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 515))  // token='elif'
+            &&
+            (a = named_expression_rule(p))  // named_expression
+            &&
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (b = block_rule(p))  // block
+            &&
+            (c = elif_stmt_rule(p))  // elif_stmt
+        )
+        {
+            D(fprintf(stderr, "%*c+ elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block elif_stmt"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_If ( a , b , CHECK ( asdl_stmt_seq * , _PyPegen_singleton_seq ( p , c ) ) , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression ':' block elif_stmt"));
+    }
+    { // 'elif' named_expression ':' block else_block?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block else_block?"));
+        Token * _keyword;
+        Token * _literal;
+        expr_ty a;
+        asdl_stmt_seq* b;
+        void *c;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 515))  // token='elif'
+            &&
+            (a = named_expression_rule(p))  // named_expression
+            &&
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (b = block_rule(p))  // block
+            &&
+            (c = else_block_rule(p), !p->error_indicator)  // else_block?
+        )
+        {
+            D(fprintf(stderr, "%*c+ elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block else_block?"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_If ( a , b , c , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression ':' block else_block?"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// else_block: invalid_else_stmt | 'else' &&':' block
+static asdl_stmt_seq*
+else_block_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_stmt_seq* _res = NULL;
+    int _mark = p->mark;
+    if (p->call_invalid_rules) { // invalid_else_stmt
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> else_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_else_stmt"));
+        void *invalid_else_stmt_var;
+        if (
+            (invalid_else_stmt_var = invalid_else_stmt_rule(p))  // invalid_else_stmt
+        )
+        {
+            D(fprintf(stderr, "%*c+ else_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_else_stmt"));
+            _res = invalid_else_stmt_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s else_block[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_else_stmt"));
+    }
+    { // 'else' &&':' block
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> else_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'else' &&':' block"));
+        Token * _keyword;
+        Token * _literal;
+        asdl_stmt_seq* b;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 516))  // token='else'
+            &&
+            (_literal = _PyPegen_expect_forced_token(p, 11, ":"))  // forced_token=':'
+            &&
+            (b = block_rule(p))  // block
+        )
+        {
+            D(fprintf(stderr, "%*c+ else_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'else' &&':' block"));
+            _res = b;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s else_block[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'else' &&':' block"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// while_stmt: invalid_while_stmt | 'while' named_expression ':' block else_block?
+static stmt_ty
+while_stmt_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    stmt_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    if (p->call_invalid_rules) { // invalid_while_stmt
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> while_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_while_stmt"));
+        void *invalid_while_stmt_var;
+        if (
+            (invalid_while_stmt_var = invalid_while_stmt_rule(p))  // invalid_while_stmt
+        )
+        {
+            D(fprintf(stderr, "%*c+ while_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_while_stmt"));
+            _res = invalid_while_stmt_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s while_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_while_stmt"));
+    }
+    { // 'while' named_expression ':' block else_block?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> while_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'while' named_expression ':' block else_block?"));
+        Token * _keyword;
+        Token * _literal;
+        expr_ty a;
+        asdl_stmt_seq* b;
+        void *c;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 512))  // token='while'
+            &&
+            (a = named_expression_rule(p))  // named_expression
+            &&
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (b = block_rule(p))  // block
+            &&
+            (c = else_block_rule(p), !p->error_indicator)  // else_block?
+        )
+        {
+            D(fprintf(stderr, "%*c+ while_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'while' named_expression ':' block else_block?"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_While ( a , b , c , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s while_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'while' named_expression ':' block else_block?"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// for_stmt:
+//     | invalid_for_stmt
+//     | 'for' star_targets 'in' ~ star_expressions &&':' TYPE_COMMENT? block else_block?
+//     | ASYNC 'for' star_targets 'in' ~ star_expressions &&':' TYPE_COMMENT? block else_block?
+//     | invalid_for_target
+static stmt_ty
+for_stmt_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    stmt_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    if (p->call_invalid_rules) { // invalid_for_stmt
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> for_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_for_stmt"));
+        void *invalid_for_stmt_var;
+        if (
+            (invalid_for_stmt_var = invalid_for_stmt_rule(p))  // invalid_for_stmt
+        )
+        {
+            D(fprintf(stderr, "%*c+ for_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_for_stmt"));
+            _res = invalid_for_stmt_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_for_stmt"));
+    }
+    { // 'for' star_targets 'in' ~ star_expressions &&':' TYPE_COMMENT? block else_block?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> for_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ star_expressions &&':' TYPE_COMMENT? block else_block?"));
+        int _cut_var = 0;
+        Token * _keyword;
+        Token * _keyword_1;
+        Token * _literal;
+        asdl_stmt_seq* b;
+        void *el;
+        expr_ty ex;
+        expr_ty t;
+        void *tc;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 517))  // token='for'
+            &&
+            (t = star_targets_rule(p))  // star_targets
+            &&
+            (_keyword_1 = _PyPegen_expect_token(p, 518))  // token='in'
+            &&
+            (_cut_var = 1)
+            &&
+            (ex = star_expressions_rule(p))  // star_expressions
+            &&
+            (_literal = _PyPegen_expect_forced_token(p, 11, ":"))  // forced_token=':'
+            &&
+            (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator)  // TYPE_COMMENT?
+            &&
+            (b = block_rule(p))  // block
+            &&
+            (el = else_block_rule(p), !p->error_indicator)  // else_block?
+        )
+        {
+            D(fprintf(stderr, "%*c+ for_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ star_expressions &&':' TYPE_COMMENT? block else_block?"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_For ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for' star_targets 'in' ~ star_expressions &&':' TYPE_COMMENT? block else_block?"));
+        if (_cut_var) {
+            p->level--;
+            return NULL;
         }
     }
+    { // ASYNC 'for' star_targets 'in' ~ star_expressions &&':' TYPE_COMMENT? block else_block?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> for_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ star_expressions &&':' TYPE_COMMENT? block else_block?"));
+        int _cut_var = 0;
+        Token * _keyword;
+        Token * _keyword_1;
+        Token * _literal;
+        Token * async_var;
+        asdl_stmt_seq* b;
+        void *el;
+        expr_ty ex;
+        expr_ty t;
+        void *tc;
+        if (
+            (async_var = _PyPegen_expect_token(p, ASYNC))  // token='ASYNC'
+            &&
+            (_keyword = _PyPegen_expect_token(p, 517))  // token='for'
+            &&
+            (t = star_targets_rule(p))  // star_targets
+            &&
+            (_keyword_1 = _PyPegen_expect_token(p, 518))  // token='in'
+            &&
+            (_cut_var = 1)
+            &&
+            (ex = star_expressions_rule(p))  // star_expressions
+            &&
+            (_literal = _PyPegen_expect_forced_token(p, 11, ":"))  // forced_token=':'
+            &&
+            (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator)  // TYPE_COMMENT?
+            &&
+            (b = block_rule(p))  // block
+            &&
+            (el = else_block_rule(p), !p->error_indicator)  // else_block?
+        )
+        {
+            D(fprintf(stderr, "%*c+ for_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ star_expressions &&':' TYPE_COMMENT? block else_block?"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = CHECK_VERSION ( stmt_ty , 5 , "Async for loops are" , _PyAST_AsyncFor ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ star_expressions &&':' TYPE_COMMENT? block else_block?"));
+        if (_cut_var) {
+            p->level--;
+            return NULL;
+        }
+    }
+    if (p->call_invalid_rules) { // invalid_for_target
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> for_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
+        void *invalid_for_target_var;
+        if (
+            (invalid_for_target_var = invalid_for_target_rule(p))  // invalid_for_target
+        )
+        {
+            D(fprintf(stderr, "%*c+ for_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
+            _res = invalid_for_target_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_for_target"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
 }
-#endif
-#endif /* future keyword */
 
-int
-PyParser_AddToken(parser_state *ps, int type, char *str,
-                  int lineno, int col_offset,
-                  int end_lineno, int end_col_offset,
-                  int *expected_ret)
+// with_stmt:
+//     | invalid_with_stmt_indent
+//     | 'with' '(' ','.with_item+ ','? ')' ':' block
+//     | 'with' ','.with_item+ ':' TYPE_COMMENT? block
+//     | ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block
+//     | ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block
+//     | invalid_with_stmt
+static stmt_ty
+with_stmt_rule(Parser *p)
 {
-    int ilabel;
-    int err;
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    stmt_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    if (p->call_invalid_rules) { // invalid_with_stmt_indent
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_with_stmt_indent"));
+        void *invalid_with_stmt_indent_var;
+        if (
+            (invalid_with_stmt_indent_var = invalid_with_stmt_indent_rule(p))  // invalid_with_stmt_indent
+        )
+        {
+            D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_with_stmt_indent"));
+            _res = invalid_with_stmt_indent_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_with_stmt_indent"));
+    }
+    { // 'with' '(' ','.with_item+ ','? ')' ':' block
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block"));
+        Token * _keyword;
+        Token * _literal;
+        Token * _literal_1;
+        Token * _literal_2;
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        asdl_withitem_seq* a;
+        asdl_stmt_seq* b;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 519))  // token='with'
+            &&
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+            &&
+            (a = (asdl_withitem_seq*)_gather_39_rule(p))  // ','.with_item+
+            &&
+            (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator)  // ','?
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
+            &&
+            (_literal_2 = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (b = block_rule(p))  // block
+        )
+        {
+            D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_With ( a , b , NULL , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block"));
+    }
+    { // 'with' ','.with_item+ ':' TYPE_COMMENT? block
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block"));
+        Token * _keyword;
+        Token * _literal;
+        asdl_withitem_seq* a;
+        asdl_stmt_seq* b;
+        void *tc;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 519))  // token='with'
+            &&
+            (a = (asdl_withitem_seq*)_gather_41_rule(p))  // ','.with_item+
+            &&
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator)  // TYPE_COMMENT?
+            &&
+            (b = block_rule(p))  // block
+        )
+        {
+            D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_With ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block"));
+    }
+    { // ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block"));
+        Token * _keyword;
+        Token * _literal;
+        Token * _literal_1;
+        Token * _literal_2;
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        asdl_withitem_seq* a;
+        Token * async_var;
+        asdl_stmt_seq* b;
+        if (
+            (async_var = _PyPegen_expect_token(p, ASYNC))  // token='ASYNC'
+            &&
+            (_keyword = _PyPegen_expect_token(p, 519))  // token='with'
+            &&
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+            &&
+            (a = (asdl_withitem_seq*)_gather_43_rule(p))  // ','.with_item+
+            &&
+            (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator)  // ','?
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
+            &&
+            (_literal_2 = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (b = block_rule(p))  // block
+        )
+        {
+            D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = CHECK_VERSION ( stmt_ty , 5 , "Async with statements are" , _PyAST_AsyncWith ( a , b , NULL , EXTRA ) );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block"));
+    }
+    { // ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block"));
+        Token * _keyword;
+        Token * _literal;
+        asdl_withitem_seq* a;
+        Token * async_var;
+        asdl_stmt_seq* b;
+        void *tc;
+        if (
+            (async_var = _PyPegen_expect_token(p, ASYNC))  // token='ASYNC'
+            &&
+            (_keyword = _PyPegen_expect_token(p, 519))  // token='with'
+            &&
+            (a = (asdl_withitem_seq*)_gather_45_rule(p))  // ','.with_item+
+            &&
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator)  // TYPE_COMMENT?
+            &&
+            (b = block_rule(p))  // block
+        )
+        {
+            D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = CHECK_VERSION ( stmt_ty , 5 , "Async with statements are" , _PyAST_AsyncWith ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block"));
+    }
+    if (p->call_invalid_rules) { // invalid_with_stmt
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_with_stmt"));
+        void *invalid_with_stmt_var;
+        if (
+            (invalid_with_stmt_var = invalid_with_stmt_rule(p))  // invalid_with_stmt
+        )
+        {
+            D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_with_stmt"));
+            _res = invalid_with_stmt_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_with_stmt"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
 
-    D(printf("Token %s/'%s' ... ", _PyParser_TokenNames[type], str));
+// with_item:
+//     | expression 'as' star_target &(',' | ')' | ':')
+//     | invalid_with_item
+//     | expression
+static withitem_ty
+with_item_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    withitem_ty _res = NULL;
+    int _mark = p->mark;
+    { // expression 'as' star_target &(',' | ')' | ':')
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression 'as' star_target &(',' | ')' | ':')"));
+        Token * _keyword;
+        expr_ty e;
+        expr_ty t;
+        if (
+            (e = expression_rule(p))  // expression
+            &&
+            (_keyword = _PyPegen_expect_token(p, 520))  // token='as'
+            &&
+            (t = star_target_rule(p))  // star_target
+            &&
+            _PyPegen_lookahead(1, _tmp_47_rule, p)
+        )
+        {
+            D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression 'as' star_target &(',' | ')' | ':')"));
+            _res = _PyAST_withitem ( e , t , p -> arena );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression 'as' star_target &(',' | ')' | ':')"));
+    }
+    if (p->call_invalid_rules) { // invalid_with_item
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_with_item"));
+        void *invalid_with_item_var;
+        if (
+            (invalid_with_item_var = invalid_with_item_rule(p))  // invalid_with_item
+        )
+        {
+            D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_with_item"));
+            _res = invalid_with_item_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_with_item"));
+    }
+    { // expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
+        expr_ty e;
+        if (
+            (e = expression_rule(p))  // expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
+            _res = _PyAST_withitem ( e , NULL , p -> arena );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
 
-    /* Find out which label this token is */
-    ilabel = classify(ps, type, str);
-    if (ilabel < 0)
-        return E_SYNTAX;
+// try_stmt:
+//     | invalid_try_stmt
+//     | 'try' &&':' block finally_block
+//     | 'try' &&':' block except_block+ else_block? finally_block?
+static stmt_ty
+try_stmt_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    stmt_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    if (p->call_invalid_rules) { // invalid_try_stmt
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_try_stmt"));
+        void *invalid_try_stmt_var;
+        if (
+            (invalid_try_stmt_var = invalid_try_stmt_rule(p))  // invalid_try_stmt
+        )
+        {
+            D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_try_stmt"));
+            _res = invalid_try_stmt_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_try_stmt"));
+    }
+    { // 'try' &&':' block finally_block
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' &&':' block finally_block"));
+        Token * _keyword;
+        Token * _literal;
+        asdl_stmt_seq* b;
+        asdl_stmt_seq* f;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 511))  // token='try'
+            &&
+            (_literal = _PyPegen_expect_forced_token(p, 11, ":"))  // forced_token=':'
+            &&
+            (b = block_rule(p))  // block
+            &&
+            (f = finally_block_rule(p))  // finally_block
+        )
+        {
+            D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' &&':' block finally_block"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Try ( b , NULL , NULL , f , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' &&':' block finally_block"));
+    }
+    { // 'try' &&':' block except_block+ else_block? finally_block?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' &&':' block except_block+ else_block? finally_block?"));
+        Token * _keyword;
+        Token * _literal;
+        asdl_stmt_seq* b;
+        void *el;
+        asdl_excepthandler_seq* ex;
+        void *f;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 511))  // token='try'
+            &&
+            (_literal = _PyPegen_expect_forced_token(p, 11, ":"))  // forced_token=':'
+            &&
+            (b = block_rule(p))  // block
+            &&
+            (ex = (asdl_excepthandler_seq*)_loop1_48_rule(p))  // except_block+
+            &&
+            (el = else_block_rule(p), !p->error_indicator)  // else_block?
+            &&
+            (f = finally_block_rule(p), !p->error_indicator)  // finally_block?
+        )
+        {
+            D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' &&':' block except_block+ else_block? finally_block?"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Try ( b , ex , el , f , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' &&':' block except_block+ else_block? finally_block?"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
 
-    /* Loop until the token is shifted or an error occurred */
-    for (;;) {
-        /* Fetch the current dfa and state */
-        const dfa *d = ps->p_stack.s_top->s_dfa;
-        state *s = &d->d_state[ps->p_stack.s_top->s_state];
+// except_block:
+//     | invalid_except_stmt_indent
+//     | 'except' expression ['as' NAME] ':' block
+//     | 'except' ':' block
+//     | invalid_except_stmt
+static excepthandler_ty
+except_block_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    excepthandler_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    if (p->call_invalid_rules) { // invalid_except_stmt_indent
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_except_stmt_indent"));
+        void *invalid_except_stmt_indent_var;
+        if (
+            (invalid_except_stmt_indent_var = invalid_except_stmt_indent_rule(p))  // invalid_except_stmt_indent
+        )
+        {
+            D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_except_stmt_indent"));
+            _res = invalid_except_stmt_indent_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_except_stmt_indent"));
+    }
+    { // 'except' expression ['as' NAME] ':' block
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
+        Token * _keyword;
+        Token * _literal;
+        asdl_stmt_seq* b;
+        expr_ty e;
+        void *t;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 521))  // token='except'
+            &&
+            (e = expression_rule(p))  // expression
+            &&
+            (t = _tmp_49_rule(p), !p->error_indicator)  // ['as' NAME]
+            &&
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (b = block_rule(p))  // block
+        )
+        {
+            D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_ExceptHandler ( e , ( t ) ? ( ( expr_ty ) t ) -> v . Name . id : NULL , b , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
+    }
+    { // 'except' ':' block
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' ':' block"));
+        Token * _keyword;
+        Token * _literal;
+        asdl_stmt_seq* b;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 521))  // token='except'
+            &&
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (b = block_rule(p))  // block
+        )
+        {
+            D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' ':' block"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_ExceptHandler ( NULL , NULL , b , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' ':' block"));
+    }
+    if (p->call_invalid_rules) { // invalid_except_stmt
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_except_stmt"));
+        void *invalid_except_stmt_var;
+        if (
+            (invalid_except_stmt_var = invalid_except_stmt_rule(p))  // invalid_except_stmt
+        )
+        {
+            D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_except_stmt"));
+            _res = invalid_except_stmt_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_except_stmt"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
 
-        D(printf(" DFA '%s', state %d:",
-            d->d_name, ps->p_stack.s_top->s_state));
+// finally_block: invalid_finally_stmt | 'finally' &&':' block
+static asdl_stmt_seq*
+finally_block_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_stmt_seq* _res = NULL;
+    int _mark = p->mark;
+    if (p->call_invalid_rules) { // invalid_finally_stmt
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> finally_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_finally_stmt"));
+        void *invalid_finally_stmt_var;
+        if (
+            (invalid_finally_stmt_var = invalid_finally_stmt_rule(p))  // invalid_finally_stmt
+        )
+        {
+            D(fprintf(stderr, "%*c+ finally_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_finally_stmt"));
+            _res = invalid_finally_stmt_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s finally_block[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_finally_stmt"));
+    }
+    { // 'finally' &&':' block
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> finally_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'finally' &&':' block"));
+        Token * _keyword;
+        Token * _literal;
+        asdl_stmt_seq* a;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 522))  // token='finally'
+            &&
+            (_literal = _PyPegen_expect_forced_token(p, 11, ":"))  // forced_token=':'
+            &&
+            (a = block_rule(p))  // block
+        )
+        {
+            D(fprintf(stderr, "%*c+ finally_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'finally' &&':' block"));
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s finally_block[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'finally' &&':' block"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
 
-        /* Check accelerator */
-        if (s->s_lower <= ilabel && ilabel < s->s_upper) {
-            int x = s->s_accel[ilabel - s->s_lower];
-            if (x != -1) {
-                if (x & (1<<7)) {
-                    /* Push non-terminal */
-                    int nt = (x >> 8) + NT_OFFSET;
-                    int arrow = x & ((1<<7)-1);
-                    if (nt == func_body_suite && !(ps->p_flags & PyCF_TYPE_COMMENTS)) {
-                        /* When parsing type comments is not requested,
-                           we can provide better errors about bad indentation
-                           by using 'suite' for the body of a funcdef */
-                        D(printf(" [switch func_body_suite to suite]"));
-                        nt = suite;
-                    }
-                    const dfa *d1 = PyGrammar_FindDFA(
-                        ps->p_grammar, nt);
-                    if ((err = push(&ps->p_stack, nt, d1,
-                        arrow, lineno, col_offset,
-                        end_lineno, end_col_offset)) > 0) {
-                        D(printf(" MemError: push\n"));
-                        return err;
-                    }
-                    D(printf(" Push '%s'\n", d1->d_name));
-                    continue;
+// match_stmt:
+//     | "match" subject_expr ':' NEWLINE INDENT case_block+ DEDENT
+//     | invalid_match_stmt
+static stmt_ty
+match_stmt_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    stmt_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // "match" subject_expr ':' NEWLINE INDENT case_block+ DEDENT
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> match_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr ':' NEWLINE INDENT case_block+ DEDENT"));
+        expr_ty _keyword;
+        Token * _literal;
+        asdl_match_case_seq* cases;
+        Token * dedent_var;
+        Token * indent_var;
+        Token * newline_var;
+        expr_ty subject;
+        if (
+            (_keyword = _PyPegen_expect_soft_keyword(p, "match"))  // soft_keyword='"match"'
+            &&
+            (subject = subject_expr_rule(p))  // subject_expr
+            &&
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+            &&
+            (indent_var = _PyPegen_expect_token(p, INDENT))  // token='INDENT'
+            &&
+            (cases = (asdl_match_case_seq*)_loop1_50_rule(p))  // case_block+
+            &&
+            (dedent_var = _PyPegen_expect_token(p, DEDENT))  // token='DEDENT'
+        )
+        {
+            D(fprintf(stderr, "%*c+ match_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr ':' NEWLINE INDENT case_block+ DEDENT"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = CHECK_VERSION ( stmt_ty , 10 , "Pattern matching is" , _PyAST_Match ( subject , cases , EXTRA ) );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s match_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"match\" subject_expr ':' NEWLINE INDENT case_block+ DEDENT"));
+    }
+    if (p->call_invalid_rules) { // invalid_match_stmt
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> match_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_match_stmt"));
+        void *invalid_match_stmt_var;
+        if (
+            (invalid_match_stmt_var = invalid_match_stmt_rule(p))  // invalid_match_stmt
+        )
+        {
+            D(fprintf(stderr, "%*c+ match_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_match_stmt"));
+            _res = invalid_match_stmt_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s match_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_match_stmt"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// subject_expr: star_named_expression ',' star_named_expressions? | named_expression
+static expr_ty
+subject_expr_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // star_named_expression ',' star_named_expressions?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> subject_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
+        Token * _literal;
+        expr_ty value;
+        void *values;
+        if (
+            (value = star_named_expression_rule(p))  // star_named_expression
+            &&
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (values = star_named_expressions_rule(p), !p->error_indicator)  // star_named_expressions?
+        )
+        {
+            D(fprintf(stderr, "%*c+ subject_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , value , values ) ) , Load , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s subject_expr[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
+    }
+    { // named_expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> subject_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression"));
+        expr_ty named_expression_var;
+        if (
+            (named_expression_var = named_expression_rule(p))  // named_expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ subject_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression"));
+            _res = named_expression_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s subject_expr[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// case_block: invalid_case_block | "case" patterns guard? ':' block
+static match_case_ty
+case_block_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    match_case_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->call_invalid_rules) { // invalid_case_block
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> case_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_case_block"));
+        void *invalid_case_block_var;
+        if (
+            (invalid_case_block_var = invalid_case_block_rule(p))  // invalid_case_block
+        )
+        {
+            D(fprintf(stderr, "%*c+ case_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_case_block"));
+            _res = invalid_case_block_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s case_block[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_case_block"));
+    }
+    { // "case" patterns guard? ':' block
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> case_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? ':' block"));
+        expr_ty _keyword;
+        Token * _literal;
+        asdl_stmt_seq* body;
+        void *guard;
+        pattern_ty pattern;
+        if (
+            (_keyword = _PyPegen_expect_soft_keyword(p, "case"))  // soft_keyword='"case"'
+            &&
+            (pattern = patterns_rule(p))  // patterns
+            &&
+            (guard = guard_rule(p), !p->error_indicator)  // guard?
+            &&
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (body = block_rule(p))  // block
+        )
+        {
+            D(fprintf(stderr, "%*c+ case_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? ':' block"));
+            _res = _PyAST_match_case ( pattern , guard , body , p -> arena );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s case_block[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"case\" patterns guard? ':' block"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// guard: 'if' named_expression
+static expr_ty
+guard_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    { // 'if' named_expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> guard[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression"));
+        Token * _keyword;
+        expr_ty guard;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 510))  // token='if'
+            &&
+            (guard = named_expression_rule(p))  // named_expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ guard[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression"));
+            _res = guard;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s guard[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// patterns: open_sequence_pattern | pattern
+static pattern_ty
+patterns_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    pattern_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // open_sequence_pattern
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> patterns[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "open_sequence_pattern"));
+        asdl_pattern_seq* patterns;
+        if (
+            (patterns = (asdl_pattern_seq*)open_sequence_pattern_rule(p))  // open_sequence_pattern
+        )
+        {
+            D(fprintf(stderr, "%*c+ patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "open_sequence_pattern"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_MatchSequence ( patterns , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s patterns[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "open_sequence_pattern"));
+    }
+    { // pattern
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> patterns[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern"));
+        pattern_ty pattern_var;
+        if (
+            (pattern_var = pattern_rule(p))  // pattern
+        )
+        {
+            D(fprintf(stderr, "%*c+ patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern"));
+            _res = pattern_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s patterns[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// pattern: as_pattern | or_pattern
+static pattern_ty
+pattern_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    pattern_ty _res = NULL;
+    int _mark = p->mark;
+    { // as_pattern
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "as_pattern"));
+        pattern_ty as_pattern_var;
+        if (
+            (as_pattern_var = as_pattern_rule(p))  // as_pattern
+        )
+        {
+            D(fprintf(stderr, "%*c+ pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "as_pattern"));
+            _res = as_pattern_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "as_pattern"));
+    }
+    { // or_pattern
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "or_pattern"));
+        pattern_ty or_pattern_var;
+        if (
+            (or_pattern_var = or_pattern_rule(p))  // or_pattern
+        )
+        {
+            D(fprintf(stderr, "%*c+ pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "or_pattern"));
+            _res = or_pattern_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "or_pattern"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// as_pattern: or_pattern 'as' pattern_capture_target | invalid_as_pattern
+static pattern_ty
+as_pattern_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    pattern_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // or_pattern 'as' pattern_capture_target
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> as_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' pattern_capture_target"));
+        Token * _keyword;
+        pattern_ty pattern;
+        expr_ty target;
+        if (
+            (pattern = or_pattern_rule(p))  // or_pattern
+            &&
+            (_keyword = _PyPegen_expect_token(p, 520))  // token='as'
+            &&
+            (target = pattern_capture_target_rule(p))  // pattern_capture_target
+        )
+        {
+            D(fprintf(stderr, "%*c+ as_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' pattern_capture_target"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_MatchAs ( pattern , target -> v . Name . id , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s as_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "or_pattern 'as' pattern_capture_target"));
+    }
+    if (p->call_invalid_rules) { // invalid_as_pattern
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> as_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_as_pattern"));
+        void *invalid_as_pattern_var;
+        if (
+            (invalid_as_pattern_var = invalid_as_pattern_rule(p))  // invalid_as_pattern
+        )
+        {
+            D(fprintf(stderr, "%*c+ as_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_as_pattern"));
+            _res = invalid_as_pattern_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s as_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_as_pattern"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// or_pattern: '|'.closed_pattern+
+static pattern_ty
+or_pattern_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    pattern_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // '|'.closed_pattern+
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> or_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|'.closed_pattern+"));
+        asdl_pattern_seq* patterns;
+        if (
+            (patterns = (asdl_pattern_seq*)_gather_51_rule(p))  // '|'.closed_pattern+
+        )
+        {
+            D(fprintf(stderr, "%*c+ or_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'|'.closed_pattern+"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = asdl_seq_LEN ( patterns ) == 1 ? asdl_seq_GET ( patterns , 0 ) : _PyAST_MatchOr ( patterns , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s or_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|'.closed_pattern+"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// closed_pattern:
+//     | literal_pattern
+//     | capture_pattern
+//     | wildcard_pattern
+//     | value_pattern
+//     | group_pattern
+//     | sequence_pattern
+//     | mapping_pattern
+//     | class_pattern
+static pattern_ty
+closed_pattern_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    pattern_ty _res = NULL;
+    int _mark = p->mark;
+    { // literal_pattern
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_pattern"));
+        pattern_ty literal_pattern_var;
+        if (
+            (literal_pattern_var = literal_pattern_rule(p))  // literal_pattern
+        )
+        {
+            D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "literal_pattern"));
+            _res = literal_pattern_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "literal_pattern"));
+    }
+    { // capture_pattern
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "capture_pattern"));
+        pattern_ty capture_pattern_var;
+        if (
+            (capture_pattern_var = capture_pattern_rule(p))  // capture_pattern
+        )
+        {
+            D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "capture_pattern"));
+            _res = capture_pattern_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "capture_pattern"));
+    }
+    { // wildcard_pattern
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "wildcard_pattern"));
+        pattern_ty wildcard_pattern_var;
+        if (
+            (wildcard_pattern_var = wildcard_pattern_rule(p))  // wildcard_pattern
+        )
+        {
+            D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "wildcard_pattern"));
+            _res = wildcard_pattern_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "wildcard_pattern"));
+    }
+    { // value_pattern
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "value_pattern"));
+        pattern_ty value_pattern_var;
+        if (
+            (value_pattern_var = value_pattern_rule(p))  // value_pattern
+        )
+        {
+            D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "value_pattern"));
+            _res = value_pattern_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "value_pattern"));
+    }
+    { // group_pattern
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group_pattern"));
+        pattern_ty group_pattern_var;
+        if (
+            (group_pattern_var = group_pattern_rule(p))  // group_pattern
+        )
+        {
+            D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group_pattern"));
+            _res = group_pattern_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group_pattern"));
+    }
+    { // sequence_pattern
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sequence_pattern"));
+        pattern_ty sequence_pattern_var;
+        if (
+            (sequence_pattern_var = sequence_pattern_rule(p))  // sequence_pattern
+        )
+        {
+            D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sequence_pattern"));
+            _res = sequence_pattern_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sequence_pattern"));
+    }
+    { // mapping_pattern
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "mapping_pattern"));
+        pattern_ty mapping_pattern_var;
+        if (
+            (mapping_pattern_var = mapping_pattern_rule(p))  // mapping_pattern
+        )
+        {
+            D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "mapping_pattern"));
+            _res = mapping_pattern_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "mapping_pattern"));
+    }
+    { // class_pattern
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> closed_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "class_pattern"));
+        pattern_ty class_pattern_var;
+        if (
+            (class_pattern_var = class_pattern_rule(p))  // class_pattern
+        )
+        {
+            D(fprintf(stderr, "%*c+ closed_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "class_pattern"));
+            _res = class_pattern_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s closed_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "class_pattern"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// literal_pattern:
+//     | signed_number !('+' | '-')
+//     | complex_number
+//     | strings
+//     | 'None'
+//     | 'True'
+//     | 'False'
+static pattern_ty
+literal_pattern_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    pattern_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // signed_number !('+' | '-')
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "signed_number !('+' | '-')"));
+        expr_ty value;
+        if (
+            (value = signed_number_rule(p))  // signed_number
+            &&
+            _PyPegen_lookahead(0, _tmp_53_rule, p)
+        )
+        {
+            D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "signed_number !('+' | '-')"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_MatchValue ( value , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "signed_number !('+' | '-')"));
+    }
+    { // complex_number
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "complex_number"));
+        expr_ty value;
+        if (
+            (value = complex_number_rule(p))  // complex_number
+        )
+        {
+            D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "complex_number"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_MatchValue ( value , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "complex_number"));
+    }
+    { // strings
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "strings"));
+        expr_ty value;
+        if (
+            (value = strings_rule(p))  // strings
+        )
+        {
+            D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "strings"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_MatchValue ( value , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "strings"));
+    }
+    { // 'None'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'"));
+        Token * _keyword;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 523))  // token='None'
+        )
+        {
+            D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_MatchSingleton ( Py_None , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'"));
+    }
+    { // 'True'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'"));
+        Token * _keyword;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 524))  // token='True'
+        )
+        {
+            D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_MatchSingleton ( Py_True , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'"));
+    }
+    { // 'False'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'"));
+        Token * _keyword;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 525))  // token='False'
+        )
+        {
+            D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_MatchSingleton ( Py_False , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s literal_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// literal_expr:
+//     | signed_number !('+' | '-')
+//     | complex_number
+//     | strings
+//     | 'None'
+//     | 'True'
+//     | 'False'
+static expr_ty
+literal_expr_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // signed_number !('+' | '-')
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> literal_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "signed_number !('+' | '-')"));
+        expr_ty signed_number_var;
+        if (
+            (signed_number_var = signed_number_rule(p))  // signed_number
+            &&
+            _PyPegen_lookahead(0, _tmp_54_rule, p)
+        )
+        {
+            D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "signed_number !('+' | '-')"));
+            _res = signed_number_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s literal_expr[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "signed_number !('+' | '-')"));
+    }
+    { // complex_number
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> literal_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "complex_number"));
+        expr_ty complex_number_var;
+        if (
+            (complex_number_var = complex_number_rule(p))  // complex_number
+        )
+        {
+            D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "complex_number"));
+            _res = complex_number_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s literal_expr[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "complex_number"));
+    }
+    { // strings
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> literal_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "strings"));
+        expr_ty strings_var;
+        if (
+            (strings_var = strings_rule(p))  // strings
+        )
+        {
+            D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "strings"));
+            _res = strings_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s literal_expr[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "strings"));
+    }
+    { // 'None'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> literal_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'"));
+        Token * _keyword;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 523))  // token='None'
+        )
+        {
+            D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Constant ( Py_None , NULL , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s literal_expr[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'"));
+    }
+    { // 'True'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> literal_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'"));
+        Token * _keyword;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 524))  // token='True'
+        )
+        {
+            D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Constant ( Py_True , NULL , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s literal_expr[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'"));
+    }
+    { // 'False'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> literal_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'"));
+        Token * _keyword;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 525))  // token='False'
+        )
+        {
+            D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Constant ( Py_False , NULL , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s literal_expr[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// complex_number:
+//     | signed_real_number '+' imaginary_number
+//     | signed_real_number '-' imaginary_number
+static expr_ty
+complex_number_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // signed_real_number '+' imaginary_number
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> complex_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "signed_real_number '+' imaginary_number"));
+        Token * _literal;
+        expr_ty imag;
+        expr_ty real;
+        if (
+            (real = signed_real_number_rule(p))  // signed_real_number
+            &&
+            (_literal = _PyPegen_expect_token(p, 14))  // token='+'
+            &&
+            (imag = imaginary_number_rule(p))  // imaginary_number
+        )
+        {
+            D(fprintf(stderr, "%*c+ complex_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "signed_real_number '+' imaginary_number"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_BinOp ( real , Add , imag , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s complex_number[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "signed_real_number '+' imaginary_number"));
+    }
+    { // signed_real_number '-' imaginary_number
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> complex_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "signed_real_number '-' imaginary_number"));
+        Token * _literal;
+        expr_ty imag;
+        expr_ty real;
+        if (
+            (real = signed_real_number_rule(p))  // signed_real_number
+            &&
+            (_literal = _PyPegen_expect_token(p, 15))  // token='-'
+            &&
+            (imag = imaginary_number_rule(p))  // imaginary_number
+        )
+        {
+            D(fprintf(stderr, "%*c+ complex_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "signed_real_number '-' imaginary_number"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_BinOp ( real , Sub , imag , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s complex_number[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "signed_real_number '-' imaginary_number"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// signed_number: NUMBER | '-' NUMBER
+static expr_ty
+signed_number_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // NUMBER
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> signed_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER"));
+        expr_ty number_var;
+        if (
+            (number_var = _PyPegen_number_token(p))  // NUMBER
+        )
+        {
+            D(fprintf(stderr, "%*c+ signed_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER"));
+            _res = number_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s signed_number[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER"));
+    }
+    { // '-' NUMBER
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> signed_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-' NUMBER"));
+        Token * _literal;
+        expr_ty number;
+        if (
+            (_literal = _PyPegen_expect_token(p, 15))  // token='-'
+            &&
+            (number = _PyPegen_number_token(p))  // NUMBER
+        )
+        {
+            D(fprintf(stderr, "%*c+ signed_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-' NUMBER"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_UnaryOp ( USub , number , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s signed_number[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-' NUMBER"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// signed_real_number: real_number | '-' real_number
+static expr_ty
+signed_real_number_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // real_number
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> signed_real_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "real_number"));
+        expr_ty real_number_var;
+        if (
+            (real_number_var = real_number_rule(p))  // real_number
+        )
+        {
+            D(fprintf(stderr, "%*c+ signed_real_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "real_number"));
+            _res = real_number_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s signed_real_number[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "real_number"));
+    }
+    { // '-' real_number
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> signed_real_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-' real_number"));
+        Token * _literal;
+        expr_ty real;
+        if (
+            (_literal = _PyPegen_expect_token(p, 15))  // token='-'
+            &&
+            (real = real_number_rule(p))  // real_number
+        )
+        {
+            D(fprintf(stderr, "%*c+ signed_real_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-' real_number"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_UnaryOp ( USub , real , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s signed_real_number[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-' real_number"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// real_number: NUMBER
+static expr_ty
+real_number_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    { // NUMBER
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> real_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER"));
+        expr_ty real;
+        if (
+            (real = _PyPegen_number_token(p))  // NUMBER
+        )
+        {
+            D(fprintf(stderr, "%*c+ real_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER"));
+            _res = _PyPegen_ensure_real ( p , real );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s real_number[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// imaginary_number: NUMBER
+static expr_ty
+imaginary_number_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    { // NUMBER
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> imaginary_number[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER"));
+        expr_ty imag;
+        if (
+            (imag = _PyPegen_number_token(p))  // NUMBER
+        )
+        {
+            D(fprintf(stderr, "%*c+ imaginary_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER"));
+            _res = _PyPegen_ensure_imaginary ( p , imag );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s imaginary_number[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// capture_pattern: pattern_capture_target
+static pattern_ty
+capture_pattern_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    pattern_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // pattern_capture_target
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> capture_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern_capture_target"));
+        expr_ty target;
+        if (
+            (target = pattern_capture_target_rule(p))  // pattern_capture_target
+        )
+        {
+            D(fprintf(stderr, "%*c+ capture_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern_capture_target"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_MatchAs ( NULL , target -> v . Name . id , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s capture_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern_capture_target"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// pattern_capture_target: !"_" NAME !('.' | '(' | '=')
+static expr_ty
+pattern_capture_target_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    { // !"_" NAME !('.' | '(' | '=')
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> pattern_capture_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!\"_\" NAME !('.' | '(' | '=')"));
+        expr_ty name;
+        if (
+            _PyPegen_lookahead_with_string(0, _PyPegen_expect_soft_keyword, p, "_")
+            &&
+            (name = _PyPegen_name_token(p))  // NAME
+            &&
+            _PyPegen_lookahead(0, _tmp_55_rule, p)
+        )
+        {
+            D(fprintf(stderr, "%*c+ pattern_capture_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!\"_\" NAME !('.' | '(' | '=')"));
+            _res = _PyPegen_set_expr_context ( p , name , Store );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s pattern_capture_target[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!\"_\" NAME !('.' | '(' | '=')"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// wildcard_pattern: "_"
+static pattern_ty
+wildcard_pattern_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    pattern_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // "_"
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> wildcard_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"_\""));
+        expr_ty _keyword;
+        if (
+            (_keyword = _PyPegen_expect_soft_keyword(p, "_"))  // soft_keyword='"_"'
+        )
+        {
+            D(fprintf(stderr, "%*c+ wildcard_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"_\""));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_MatchAs ( NULL , NULL , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s wildcard_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"_\""));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// value_pattern: attr !('.' | '(' | '=')
+static pattern_ty
+value_pattern_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    pattern_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // attr !('.' | '(' | '=')
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "attr !('.' | '(' | '=')"));
+        expr_ty attr;
+        if (
+            (attr = attr_rule(p))  // attr
+            &&
+            _PyPegen_lookahead(0, _tmp_56_rule, p)
+        )
+        {
+            D(fprintf(stderr, "%*c+ value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "attr !('.' | '(' | '=')"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_MatchValue ( attr , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s value_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "attr !('.' | '(' | '=')"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// Left-recursive
+// attr: name_or_attr '.' NAME
+static expr_ty attr_raw(Parser *);
+static expr_ty
+attr_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    expr_ty _res = NULL;
+    if (_PyPegen_is_memoized(p, attr_type, &_res)) {
+        p->level--;
+        return _res;
+    }
+    int _mark = p->mark;
+    int _resmark = p->mark;
+    while (1) {
+        int tmpvar_1 = _PyPegen_update_memo(p, _mark, attr_type, _res);
+        if (tmpvar_1) {
+            p->level--;
+            return _res;
+        }
+        p->mark = _mark;
+        void *_raw = attr_raw(p);
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        if (_raw == NULL || p->mark <= _resmark)
+            break;
+        _resmark = p->mark;
+        _res = _raw;
+    }
+    p->mark = _resmark;
+    p->level--;
+    return _res;
+}
+static expr_ty
+attr_raw(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // name_or_attr '.' NAME
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> attr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '.' NAME"));
+        Token * _literal;
+        expr_ty attr;
+        expr_ty value;
+        if (
+            (value = name_or_attr_rule(p))  // name_or_attr
+            &&
+            (_literal = _PyPegen_expect_token(p, 23))  // token='.'
+            &&
+            (attr = _PyPegen_name_token(p))  // NAME
+        )
+        {
+            D(fprintf(stderr, "%*c+ attr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '.' NAME"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Attribute ( value , attr -> v . Name . id , Load , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s attr[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '.' NAME"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// Left-recursive
+// name_or_attr: attr | NAME
+static expr_ty
+name_or_attr_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    { // attr
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> name_or_attr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "attr"));
+        expr_ty attr_var;
+        if (
+            (attr_var = attr_rule(p))  // attr
+        )
+        {
+            D(fprintf(stderr, "%*c+ name_or_attr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "attr"));
+            _res = attr_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s name_or_attr[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "attr"));
+    }
+    { // NAME
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> name_or_attr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
+        expr_ty name_var;
+        if (
+            (name_var = _PyPegen_name_token(p))  // NAME
+        )
+        {
+            D(fprintf(stderr, "%*c+ name_or_attr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
+            _res = name_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s name_or_attr[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// group_pattern: '(' pattern ')'
+static pattern_ty
+group_pattern_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    pattern_ty _res = NULL;
+    int _mark = p->mark;
+    { // '(' pattern ')'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> group_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' pattern ')'"));
+        Token * _literal;
+        Token * _literal_1;
+        pattern_ty pattern;
+        if (
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+            &&
+            (pattern = pattern_rule(p))  // pattern
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
+        )
+        {
+            D(fprintf(stderr, "%*c+ group_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' pattern ')'"));
+            _res = pattern;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s group_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' pattern ')'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// sequence_pattern: '[' maybe_sequence_pattern? ']' | '(' open_sequence_pattern? ')'
+static pattern_ty
+sequence_pattern_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    pattern_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // '[' maybe_sequence_pattern? ']'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' maybe_sequence_pattern? ']'"));
+        Token * _literal;
+        Token * _literal_1;
+        void *patterns;
+        if (
+            (_literal = _PyPegen_expect_token(p, 9))  // token='['
+            &&
+            (patterns = maybe_sequence_pattern_rule(p), !p->error_indicator)  // maybe_sequence_pattern?
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 10))  // token=']'
+        )
+        {
+            D(fprintf(stderr, "%*c+ sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' maybe_sequence_pattern? ']'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_MatchSequence ( patterns , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' maybe_sequence_pattern? ']'"));
+    }
+    { // '(' open_sequence_pattern? ')'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' open_sequence_pattern? ')'"));
+        Token * _literal;
+        Token * _literal_1;
+        void *patterns;
+        if (
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+            &&
+            (patterns = open_sequence_pattern_rule(p), !p->error_indicator)  // open_sequence_pattern?
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
+        )
+        {
+            D(fprintf(stderr, "%*c+ sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' open_sequence_pattern? ')'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_MatchSequence ( patterns , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' open_sequence_pattern? ')'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// open_sequence_pattern: maybe_star_pattern ',' maybe_sequence_pattern?
+static asdl_seq*
+open_sequence_pattern_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq* _res = NULL;
+    int _mark = p->mark;
+    { // maybe_star_pattern ',' maybe_sequence_pattern?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> open_sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern ',' maybe_sequence_pattern?"));
+        Token * _literal;
+        pattern_ty pattern;
+        void *patterns;
+        if (
+            (pattern = maybe_star_pattern_rule(p))  // maybe_star_pattern
+            &&
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (patterns = maybe_sequence_pattern_rule(p), !p->error_indicator)  // maybe_sequence_pattern?
+        )
+        {
+            D(fprintf(stderr, "%*c+ open_sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern ',' maybe_sequence_pattern?"));
+            _res = _PyPegen_seq_insert_in_front ( p , pattern , patterns );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s open_sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "maybe_star_pattern ',' maybe_sequence_pattern?"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// maybe_sequence_pattern: ','.maybe_star_pattern+ ','?
+static asdl_seq*
+maybe_sequence_pattern_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq* _res = NULL;
+    int _mark = p->mark;
+    { // ','.maybe_star_pattern+ ','?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> maybe_sequence_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.maybe_star_pattern+ ','?"));
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        asdl_seq * patterns;
+        if (
+            (patterns = _gather_57_rule(p))  // ','.maybe_star_pattern+
+            &&
+            (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator)  // ','?
+        )
+        {
+            D(fprintf(stderr, "%*c+ maybe_sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.maybe_star_pattern+ ','?"));
+            _res = patterns;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s maybe_sequence_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.maybe_star_pattern+ ','?"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// maybe_star_pattern: star_pattern | pattern
+static pattern_ty
+maybe_star_pattern_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    pattern_ty _res = NULL;
+    int _mark = p->mark;
+    { // star_pattern
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> maybe_star_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_pattern"));
+        pattern_ty star_pattern_var;
+        if (
+            (star_pattern_var = star_pattern_rule(p))  // star_pattern
+        )
+        {
+            D(fprintf(stderr, "%*c+ maybe_star_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_pattern"));
+            _res = star_pattern_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s maybe_star_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_pattern"));
+    }
+    { // pattern
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> maybe_star_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern"));
+        pattern_ty pattern_var;
+        if (
+            (pattern_var = pattern_rule(p))  // pattern
+        )
+        {
+            D(fprintf(stderr, "%*c+ maybe_star_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern"));
+            _res = pattern_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s maybe_star_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// star_pattern: '*' pattern_capture_target | '*' wildcard_pattern
+static pattern_ty
+star_pattern_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    pattern_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // '*' pattern_capture_target
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> star_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' pattern_capture_target"));
+        Token * _literal;
+        expr_ty target;
+        if (
+            (_literal = _PyPegen_expect_token(p, 16))  // token='*'
+            &&
+            (target = pattern_capture_target_rule(p))  // pattern_capture_target
+        )
+        {
+            D(fprintf(stderr, "%*c+ star_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' pattern_capture_target"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_MatchStar ( target -> v . Name . id , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s star_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' pattern_capture_target"));
+    }
+    { // '*' wildcard_pattern
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> star_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' wildcard_pattern"));
+        Token * _literal;
+        pattern_ty wildcard_pattern_var;
+        if (
+            (_literal = _PyPegen_expect_token(p, 16))  // token='*'
+            &&
+            (wildcard_pattern_var = wildcard_pattern_rule(p))  // wildcard_pattern
+        )
+        {
+            D(fprintf(stderr, "%*c+ star_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' wildcard_pattern"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_MatchStar ( NULL , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s star_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' wildcard_pattern"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// mapping_pattern:
+//     | '{' '}'
+//     | '{' double_star_pattern ','? '}'
+//     | '{' items_pattern ',' double_star_pattern ','? '}'
+//     | '{' items_pattern ','? '}'
+static pattern_ty
+mapping_pattern_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    pattern_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // '{' '}'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> mapping_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' '}'"));
+        Token * _literal;
+        Token * _literal_1;
+        if (
+            (_literal = _PyPegen_expect_token(p, 25))  // token='{'
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 26))  // token='}'
+        )
+        {
+            D(fprintf(stderr, "%*c+ mapping_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '}'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_MatchMapping ( NULL , NULL , NULL , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s mapping_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' '}'"));
+    }
+    { // '{' double_star_pattern ','? '}'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> mapping_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' double_star_pattern ','? '}'"));
+        Token * _literal;
+        Token * _literal_1;
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        expr_ty rest;
+        if (
+            (_literal = _PyPegen_expect_token(p, 25))  // token='{'
+            &&
+            (rest = double_star_pattern_rule(p))  // double_star_pattern
+            &&
+            (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator)  // ','?
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 26))  // token='}'
+        )
+        {
+            D(fprintf(stderr, "%*c+ mapping_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' double_star_pattern ','? '}'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_MatchMapping ( NULL , NULL , rest -> v . Name . id , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s mapping_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' double_star_pattern ','? '}'"));
+    }
+    { // '{' items_pattern ',' double_star_pattern ','? '}'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> mapping_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' items_pattern ',' double_star_pattern ','? '}'"));
+        Token * _literal;
+        Token * _literal_1;
+        Token * _literal_2;
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        asdl_seq* items;
+        expr_ty rest;
+        if (
+            (_literal = _PyPegen_expect_token(p, 25))  // token='{'
+            &&
+            (items = items_pattern_rule(p))  // items_pattern
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (rest = double_star_pattern_rule(p))  // double_star_pattern
+            &&
+            (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator)  // ','?
+            &&
+            (_literal_2 = _PyPegen_expect_token(p, 26))  // token='}'
+        )
+        {
+            D(fprintf(stderr, "%*c+ mapping_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' items_pattern ',' double_star_pattern ','? '}'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_MatchMapping ( CHECK ( asdl_expr_seq * , _PyPegen_get_pattern_keys ( p , items ) ) , CHECK ( asdl_pattern_seq * , _PyPegen_get_patterns ( p , items ) ) , rest -> v . Name . id , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s mapping_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' items_pattern ',' double_star_pattern ','? '}'"));
+    }
+    { // '{' items_pattern ','? '}'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> mapping_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' items_pattern ','? '}'"));
+        Token * _literal;
+        Token * _literal_1;
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        asdl_seq* items;
+        if (
+            (_literal = _PyPegen_expect_token(p, 25))  // token='{'
+            &&
+            (items = items_pattern_rule(p))  // items_pattern
+            &&
+            (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator)  // ','?
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 26))  // token='}'
+        )
+        {
+            D(fprintf(stderr, "%*c+ mapping_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' items_pattern ','? '}'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_MatchMapping ( CHECK ( asdl_expr_seq * , _PyPegen_get_pattern_keys ( p , items ) ) , CHECK ( asdl_pattern_seq * , _PyPegen_get_patterns ( p , items ) ) , NULL , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s mapping_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' items_pattern ','? '}'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// items_pattern: ','.key_value_pattern+
+static asdl_seq*
+items_pattern_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq* _res = NULL;
+    int _mark = p->mark;
+    { // ','.key_value_pattern+
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> items_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.key_value_pattern+"));
+        asdl_seq * _gather_59_var;
+        if (
+            (_gather_59_var = _gather_59_rule(p))  // ','.key_value_pattern+
+        )
+        {
+            D(fprintf(stderr, "%*c+ items_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.key_value_pattern+"));
+            _res = _gather_59_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s items_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.key_value_pattern+"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// key_value_pattern: (literal_expr | attr) ':' pattern
+static KeyPatternPair*
+key_value_pattern_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    KeyPatternPair* _res = NULL;
+    int _mark = p->mark;
+    { // (literal_expr | attr) ':' pattern
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> key_value_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(literal_expr | attr) ':' pattern"));
+        Token * _literal;
+        void *key;
+        pattern_ty pattern;
+        if (
+            (key = _tmp_61_rule(p))  // literal_expr | attr
+            &&
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (pattern = pattern_rule(p))  // pattern
+        )
+        {
+            D(fprintf(stderr, "%*c+ key_value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(literal_expr | attr) ':' pattern"));
+            _res = _PyPegen_key_pattern_pair ( p , key , pattern );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s key_value_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(literal_expr | attr) ':' pattern"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// double_star_pattern: '**' pattern_capture_target
+static expr_ty
+double_star_pattern_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    { // '**' pattern_capture_target
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> double_star_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' pattern_capture_target"));
+        Token * _literal;
+        expr_ty target;
+        if (
+            (_literal = _PyPegen_expect_token(p, 35))  // token='**'
+            &&
+            (target = pattern_capture_target_rule(p))  // pattern_capture_target
+        )
+        {
+            D(fprintf(stderr, "%*c+ double_star_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' pattern_capture_target"));
+            _res = target;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s double_star_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' pattern_capture_target"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// class_pattern:
+//     | name_or_attr '(' ')'
+//     | name_or_attr '(' positional_patterns ','? ')'
+//     | name_or_attr '(' keyword_patterns ','? ')'
+//     | name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')'
+//     | invalid_class_pattern
+static pattern_ty
+class_pattern_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    pattern_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // name_or_attr '(' ')'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ')'"));
+        Token * _literal;
+        Token * _literal_1;
+        expr_ty cls;
+        if (
+            (cls = name_or_attr_rule(p))  // name_or_attr
+            &&
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
+        )
+        {
+            D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' ')'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_MatchClass ( cls , NULL , NULL , NULL , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' ')'"));
+    }
+    { // name_or_attr '(' positional_patterns ','? ')'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' positional_patterns ','? ')'"));
+        Token * _literal;
+        Token * _literal_1;
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        expr_ty cls;
+        asdl_pattern_seq* patterns;
+        if (
+            (cls = name_or_attr_rule(p))  // name_or_attr
+            &&
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+            &&
+            (patterns = positional_patterns_rule(p))  // positional_patterns
+            &&
+            (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator)  // ','?
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
+        )
+        {
+            D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' positional_patterns ','? ')'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_MatchClass ( cls , patterns , NULL , NULL , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' positional_patterns ','? ')'"));
+    }
+    { // name_or_attr '(' keyword_patterns ','? ')'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' keyword_patterns ','? ')'"));
+        Token * _literal;
+        Token * _literal_1;
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        expr_ty cls;
+        asdl_seq* keywords;
+        if (
+            (cls = name_or_attr_rule(p))  // name_or_attr
+            &&
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+            &&
+            (keywords = keyword_patterns_rule(p))  // keyword_patterns
+            &&
+            (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator)  // ','?
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
+        )
+        {
+            D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' keyword_patterns ','? ')'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_MatchClass ( cls , NULL , CHECK ( asdl_identifier_seq * , _PyPegen_map_names_to_ids ( p , CHECK ( asdl_expr_seq * , _PyPegen_get_pattern_keys ( p , keywords ) ) ) ) , CHECK ( asdl_pattern_seq * , _PyPegen_get_patterns ( p , keywords ) ) , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' keyword_patterns ','? ')'"));
+    }
+    { // name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')'"));
+        Token * _literal;
+        Token * _literal_1;
+        Token * _literal_2;
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        expr_ty cls;
+        asdl_seq* keywords;
+        asdl_pattern_seq* patterns;
+        if (
+            (cls = name_or_attr_rule(p))  // name_or_attr
+            &&
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+            &&
+            (patterns = positional_patterns_rule(p))  // positional_patterns
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (keywords = keyword_patterns_rule(p))  // keyword_patterns
+            &&
+            (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator)  // ','?
+            &&
+            (_literal_2 = _PyPegen_expect_token(p, 8))  // token=')'
+        )
+        {
+            D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_MatchClass ( cls , patterns , CHECK ( asdl_identifier_seq * , _PyPegen_map_names_to_ids ( p , CHECK ( asdl_expr_seq * , _PyPegen_get_pattern_keys ( p , keywords ) ) ) ) , CHECK ( asdl_pattern_seq * , _PyPegen_get_patterns ( p , keywords ) ) , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' positional_patterns ',' keyword_patterns ','? ')'"));
+    }
+    if (p->call_invalid_rules) { // invalid_class_pattern
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_class_pattern"));
+        void *invalid_class_pattern_var;
+        if (
+            (invalid_class_pattern_var = invalid_class_pattern_rule(p))  // invalid_class_pattern
+        )
+        {
+            D(fprintf(stderr, "%*c+ class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_class_pattern"));
+            _res = invalid_class_pattern_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s class_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_class_pattern"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// positional_patterns: ','.pattern+
+static asdl_pattern_seq*
+positional_patterns_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_pattern_seq* _res = NULL;
+    int _mark = p->mark;
+    { // ','.pattern+
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> positional_patterns[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.pattern+"));
+        asdl_pattern_seq* args;
+        if (
+            (args = (asdl_pattern_seq*)_gather_62_rule(p))  // ','.pattern+
+        )
+        {
+            D(fprintf(stderr, "%*c+ positional_patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.pattern+"));
+            _res = args;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s positional_patterns[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.pattern+"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// keyword_patterns: ','.keyword_pattern+
+static asdl_seq*
+keyword_patterns_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq* _res = NULL;
+    int _mark = p->mark;
+    { // ','.keyword_pattern+
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> keyword_patterns[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.keyword_pattern+"));
+        asdl_seq * _gather_64_var;
+        if (
+            (_gather_64_var = _gather_64_rule(p))  // ','.keyword_pattern+
+        )
+        {
+            D(fprintf(stderr, "%*c+ keyword_patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.keyword_pattern+"));
+            _res = _gather_64_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s keyword_patterns[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.keyword_pattern+"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// keyword_pattern: NAME '=' pattern
+static KeyPatternPair*
+keyword_pattern_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    KeyPatternPair* _res = NULL;
+    int _mark = p->mark;
+    { // NAME '=' pattern
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> keyword_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' pattern"));
+        Token * _literal;
+        expr_ty arg;
+        pattern_ty value;
+        if (
+            (arg = _PyPegen_name_token(p))  // NAME
+            &&
+            (_literal = _PyPegen_expect_token(p, 22))  // token='='
+            &&
+            (value = pattern_rule(p))  // pattern
+        )
+        {
+            D(fprintf(stderr, "%*c+ keyword_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' pattern"));
+            _res = _PyPegen_key_pattern_pair ( p , arg , value );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s keyword_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' pattern"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// return_stmt: 'return' star_expressions?
+static stmt_ty
+return_stmt_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    stmt_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // 'return' star_expressions?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> return_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?"));
+        Token * _keyword;
+        void *a;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 500))  // token='return'
+            &&
+            (a = star_expressions_rule(p), !p->error_indicator)  // star_expressions?
+        )
+        {
+            D(fprintf(stderr, "%*c+ return_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Return ( a , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s return_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'return' star_expressions?"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// raise_stmt: 'raise' expression ['from' expression] | 'raise'
+static stmt_ty
+raise_stmt_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    stmt_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // 'raise' expression ['from' expression]
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]"));
+        Token * _keyword;
+        expr_ty a;
+        void *b;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 501))  // token='raise'
+            &&
+            (a = expression_rule(p))  // expression
+            &&
+            (b = _tmp_66_rule(p), !p->error_indicator)  // ['from' expression]
+        )
+        {
+            D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Raise ( a , b , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise' expression ['from' expression]"));
+    }
+    { // 'raise'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise'"));
+        Token * _keyword;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 501))  // token='raise'
+        )
+        {
+            D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Raise ( NULL , NULL , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// function_def: decorators function_def_raw | function_def_raw
+static stmt_ty
+function_def_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    stmt_ty _res = NULL;
+    int _mark = p->mark;
+    { // decorators function_def_raw
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw"));
+        asdl_expr_seq* d;
+        stmt_ty f;
+        if (
+            (d = decorators_rule(p))  // decorators
+            &&
+            (f = function_def_raw_rule(p))  // function_def_raw
+        )
+        {
+            D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw"));
+            _res = _PyPegen_function_def_decorators ( p , d , f );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators function_def_raw"));
+    }
+    { // function_def_raw
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "function_def_raw"));
+        stmt_ty function_def_raw_var;
+        if (
+            (function_def_raw_var = function_def_raw_rule(p))  // function_def_raw
+        )
+        {
+            D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "function_def_raw"));
+            _res = function_def_raw_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "function_def_raw"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// function_def_raw:
+//     | invalid_def_raw
+//     | 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block
+//     | ASYNC 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block
+static stmt_ty
+function_def_raw_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    stmt_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    if (p->call_invalid_rules) { // invalid_def_raw
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_def_raw"));
+        void *invalid_def_raw_var;
+        if (
+            (invalid_def_raw_var = invalid_def_raw_rule(p))  // invalid_def_raw
+        )
+        {
+            D(fprintf(stderr, "%*c+ function_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_def_raw"));
+            _res = invalid_def_raw_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_def_raw"));
+    }
+    { // 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block"));
+        Token * _keyword;
+        Token * _literal;
+        Token * _literal_1;
+        Token * _literal_2;
+        void *a;
+        asdl_stmt_seq* b;
+        expr_ty n;
+        void *params;
+        void *tc;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 526))  // token='def'
+            &&
+            (n = _PyPegen_name_token(p))  // NAME
+            &&
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+            &&
+            (params = params_rule(p), !p->error_indicator)  // params?
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
+            &&
+            (a = _tmp_67_rule(p), !p->error_indicator)  // ['->' expression]
+            &&
+            (_literal_2 = _PyPegen_expect_forced_token(p, 11, ":"))  // forced_token=':'
+            &&
+            (tc = func_type_comment_rule(p), !p->error_indicator)  // func_type_comment?
+            &&
+            (b = block_rule(p))  // block
+        )
+        {
+            D(fprintf(stderr, "%*c+ function_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_FunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( arguments_ty , _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block"));
+    }
+    { // ASYNC 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block"));
+        Token * _keyword;
+        Token * _literal;
+        Token * _literal_1;
+        Token * _literal_2;
+        void *a;
+        Token * async_var;
+        asdl_stmt_seq* b;
+        expr_ty n;
+        void *params;
+        void *tc;
+        if (
+            (async_var = _PyPegen_expect_token(p, ASYNC))  // token='ASYNC'
+            &&
+            (_keyword = _PyPegen_expect_token(p, 526))  // token='def'
+            &&
+            (n = _PyPegen_name_token(p))  // NAME
+            &&
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+            &&
+            (params = params_rule(p), !p->error_indicator)  // params?
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
+            &&
+            (a = _tmp_68_rule(p), !p->error_indicator)  // ['->' expression]
+            &&
+            (_literal_2 = _PyPegen_expect_forced_token(p, 11, ":"))  // forced_token=':'
+            &&
+            (tc = func_type_comment_rule(p), !p->error_indicator)  // func_type_comment?
+            &&
+            (b = block_rule(p))  // block
+        )
+        {
+            D(fprintf(stderr, "%*c+ function_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = CHECK_VERSION ( stmt_ty , 5 , "Async functions are" , _PyAST_AsyncFunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( arguments_ty , _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// func_type_comment:
+//     | NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
+//     | invalid_double_type_comments
+//     | TYPE_COMMENT
+static Token*
+func_type_comment_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    Token* _res = NULL;
+    int _mark = p->mark;
+    { // NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
+        Token * newline_var;
+        Token * t;
+        if (
+            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+            &&
+            (t = _PyPegen_expect_token(p, TYPE_COMMENT))  // token='TYPE_COMMENT'
+            &&
+            _PyPegen_lookahead(1, _tmp_69_rule, p)
+        )
+        {
+            D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
+            _res = t;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
+    }
+    if (p->call_invalid_rules) { // invalid_double_type_comments
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments"));
+        void *invalid_double_type_comments_var;
+        if (
+            (invalid_double_type_comments_var = invalid_double_type_comments_rule(p))  // invalid_double_type_comments
+        )
+        {
+            D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments"));
+            _res = invalid_double_type_comments_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_double_type_comments"));
+    }
+    { // TYPE_COMMENT
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT"));
+        Token * type_comment_var;
+        if (
+            (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT))  // token='TYPE_COMMENT'
+        )
+        {
+            D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT"));
+            _res = type_comment_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// params: invalid_parameters | parameters
+static arguments_ty
+params_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    arguments_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->call_invalid_rules) { // invalid_parameters
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_parameters"));
+        void *invalid_parameters_var;
+        if (
+            (invalid_parameters_var = invalid_parameters_rule(p))  // invalid_parameters
+        )
+        {
+            D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_parameters"));
+            _res = invalid_parameters_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_parameters"));
+    }
+    { // parameters
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "parameters"));
+        arguments_ty parameters_var;
+        if (
+            (parameters_var = parameters_rule(p))  // parameters
+        )
+        {
+            D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "parameters"));
+            _res = parameters_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "parameters"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// parameters:
+//     | slash_no_default param_no_default* param_with_default* star_etc?
+//     | slash_with_default param_with_default* star_etc?
+//     | param_no_default+ param_with_default* star_etc?
+//     | param_with_default+ star_etc?
+//     | star_etc
+static arguments_ty
+parameters_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    arguments_ty _res = NULL;
+    int _mark = p->mark;
+    { // slash_no_default param_no_default* param_with_default* star_etc?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?"));
+        asdl_arg_seq* a;
+        asdl_arg_seq* b;
+        asdl_seq * c;
+        void *d;
+        if (
+            (a = slash_no_default_rule(p))  // slash_no_default
+            &&
+            (b = (asdl_arg_seq*)_loop0_70_rule(p))  // param_no_default*
+            &&
+            (c = _loop0_71_rule(p))  // param_with_default*
+            &&
+            (d = star_etc_rule(p), !p->error_indicator)  // star_etc?
+        )
+        {
+            D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?"));
+            _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?"));
+    }
+    { // slash_with_default param_with_default* star_etc?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
+        SlashWithDefault* a;
+        asdl_seq * b;
+        void *c;
+        if (
+            (a = slash_with_default_rule(p))  // slash_with_default
+            &&
+            (b = _loop0_72_rule(p))  // param_with_default*
+            &&
+            (c = star_etc_rule(p), !p->error_indicator)  // star_etc?
+        )
+        {
+            D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
+            _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
+    }
+    { // param_no_default+ param_with_default* star_etc?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
+        asdl_arg_seq* a;
+        asdl_seq * b;
+        void *c;
+        if (
+            (a = (asdl_arg_seq*)_loop1_73_rule(p))  // param_no_default+
+            &&
+            (b = _loop0_74_rule(p))  // param_with_default*
+            &&
+            (c = star_etc_rule(p), !p->error_indicator)  // star_etc?
+        )
+        {
+            D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
+            _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
+    }
+    { // param_with_default+ star_etc?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?"));
+        asdl_seq * a;
+        void *b;
+        if (
+            (a = _loop1_75_rule(p))  // param_with_default+
+            &&
+            (b = star_etc_rule(p), !p->error_indicator)  // star_etc?
+        )
+        {
+            D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?"));
+            _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+ star_etc?"));
+    }
+    { // star_etc
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_etc"));
+        StarEtc* a;
+        if (
+            (a = star_etc_rule(p))  // star_etc
+        )
+        {
+            D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_etc"));
+            _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_etc"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// slash_no_default: param_no_default+ '/' ',' | param_no_default+ '/' &')'
+static asdl_arg_seq*
+slash_no_default_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_arg_seq* _res = NULL;
+    int _mark = p->mark;
+    { // param_no_default+ '/' ','
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','"));
+        Token * _literal;
+        Token * _literal_1;
+        asdl_arg_seq* a;
+        if (
+            (a = (asdl_arg_seq*)_loop1_76_rule(p))  // param_no_default+
+            &&
+            (_literal = _PyPegen_expect_token(p, 17))  // token='/'
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 12))  // token=','
+        )
+        {
+            D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','"));
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' ','"));
+    }
+    { // param_no_default+ '/' &')'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'"));
+        Token * _literal;
+        asdl_arg_seq* a;
+        if (
+            (a = (asdl_arg_seq*)_loop1_77_rule(p))  // param_no_default+
+            &&
+            (_literal = _PyPegen_expect_token(p, 17))  // token='/'
+            &&
+            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)  // token=')'
+        )
+        {
+            D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'"));
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' &')'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// slash_with_default:
+//     | param_no_default* param_with_default+ '/' ','
+//     | param_no_default* param_with_default+ '/' &')'
+static SlashWithDefault*
+slash_with_default_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    SlashWithDefault* _res = NULL;
+    int _mark = p->mark;
+    { // param_no_default* param_with_default+ '/' ','
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
+        Token * _literal;
+        Token * _literal_1;
+        asdl_seq * a;
+        asdl_seq * b;
+        if (
+            (a = _loop0_78_rule(p))  // param_no_default*
+            &&
+            (b = _loop1_79_rule(p))  // param_with_default+
+            &&
+            (_literal = _PyPegen_expect_token(p, 17))  // token='/'
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 12))  // token=','
+        )
+        {
+            D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
+            _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
+    }
+    { // param_no_default* param_with_default+ '/' &')'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
+        Token * _literal;
+        asdl_seq * a;
+        asdl_seq * b;
+        if (
+            (a = _loop0_80_rule(p))  // param_no_default*
+            &&
+            (b = _loop1_81_rule(p))  // param_with_default+
+            &&
+            (_literal = _PyPegen_expect_token(p, 17))  // token='/'
+            &&
+            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)  // token=')'
+        )
+        {
+            D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
+            _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// star_etc:
+//     | '*' param_no_default param_maybe_default* kwds?
+//     | '*' ',' param_maybe_default+ kwds?
+//     | kwds
+//     | invalid_star_etc
+static StarEtc*
+star_etc_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    StarEtc* _res = NULL;
+    int _mark = p->mark;
+    { // '*' param_no_default param_maybe_default* kwds?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
+        Token * _literal;
+        arg_ty a;
+        asdl_seq * b;
+        void *c;
+        if (
+            (_literal = _PyPegen_expect_token(p, 16))  // token='*'
+            &&
+            (a = param_no_default_rule(p))  // param_no_default
+            &&
+            (b = _loop0_82_rule(p))  // param_maybe_default*
+            &&
+            (c = kwds_rule(p), !p->error_indicator)  // kwds?
+        )
+        {
+            D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
+            _res = _PyPegen_star_etc ( p , a , b , c );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
+    }
+    { // '*' ',' param_maybe_default+ kwds?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
+        Token * _literal;
+        Token * _literal_1;
+        asdl_seq * b;
+        void *c;
+        if (
+            (_literal = _PyPegen_expect_token(p, 16))  // token='*'
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (b = _loop1_83_rule(p))  // param_maybe_default+
+            &&
+            (c = kwds_rule(p), !p->error_indicator)  // kwds?
+        )
+        {
+            D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
+            _res = _PyPegen_star_etc ( p , NULL , b , c );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
+    }
+    { // kwds
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwds"));
+        arg_ty a;
+        if (
+            (a = kwds_rule(p))  // kwds
+        )
+        {
+            D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwds"));
+            _res = _PyPegen_star_etc ( p , NULL , NULL , a );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwds"));
+    }
+    if (p->call_invalid_rules) { // invalid_star_etc
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_star_etc"));
+        void *invalid_star_etc_var;
+        if (
+            (invalid_star_etc_var = invalid_star_etc_rule(p))  // invalid_star_etc
+        )
+        {
+            D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_star_etc"));
+            _res = invalid_star_etc_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_star_etc"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// kwds: '**' param_no_default
+static arg_ty
+kwds_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    arg_ty _res = NULL;
+    int _mark = p->mark;
+    { // '**' param_no_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' param_no_default"));
+        Token * _literal;
+        arg_ty a;
+        if (
+            (_literal = _PyPegen_expect_token(p, 35))  // token='**'
+            &&
+            (a = param_no_default_rule(p))  // param_no_default
+        )
+        {
+            D(fprintf(stderr, "%*c+ kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' param_no_default"));
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s kwds[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' param_no_default"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// param_no_default: param ',' TYPE_COMMENT? | param TYPE_COMMENT? &')'
+static arg_ty
+param_no_default_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    arg_ty _res = NULL;
+    int _mark = p->mark;
+    { // param ',' TYPE_COMMENT?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?"));
+        Token * _literal;
+        arg_ty a;
+        void *tc;
+        if (
+            (a = param_rule(p))  // param
+            &&
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator)  // TYPE_COMMENT?
+        )
+        {
+            D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?"));
+            _res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param ',' TYPE_COMMENT?"));
+    }
+    { // param TYPE_COMMENT? &')'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'"));
+        arg_ty a;
+        void *tc;
+        if (
+            (a = param_rule(p))  // param
+            &&
+            (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator)  // TYPE_COMMENT?
+            &&
+            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)  // token=')'
+        )
+        {
+            D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'"));
+            _res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param TYPE_COMMENT? &')'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// param_with_default: param default ',' TYPE_COMMENT? | param default TYPE_COMMENT? &')'
+static NameDefaultPair*
+param_with_default_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    NameDefaultPair* _res = NULL;
+    int _mark = p->mark;
+    { // param default ',' TYPE_COMMENT?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?"));
+        Token * _literal;
+        arg_ty a;
+        expr_ty c;
+        void *tc;
+        if (
+            (a = param_rule(p))  // param
+            &&
+            (c = default_rule(p))  // default
+            &&
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator)  // TYPE_COMMENT?
+        )
+        {
+            D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?"));
+            _res = _PyPegen_name_default_pair ( p , a , c , tc );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default ',' TYPE_COMMENT?"));
+    }
+    { // param default TYPE_COMMENT? &')'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'"));
+        arg_ty a;
+        expr_ty c;
+        void *tc;
+        if (
+            (a = param_rule(p))  // param
+            &&
+            (c = default_rule(p))  // default
+            &&
+            (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator)  // TYPE_COMMENT?
+            &&
+            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)  // token=')'
+        )
+        {
+            D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'"));
+            _res = _PyPegen_name_default_pair ( p , a , c , tc );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default TYPE_COMMENT? &')'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// param_maybe_default:
+//     | param default? ',' TYPE_COMMENT?
+//     | param default? TYPE_COMMENT? &')'
+static NameDefaultPair*
+param_maybe_default_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    NameDefaultPair* _res = NULL;
+    int _mark = p->mark;
+    { // param default? ',' TYPE_COMMENT?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
+        Token * _literal;
+        arg_ty a;
+        void *c;
+        void *tc;
+        if (
+            (a = param_rule(p))  // param
+            &&
+            (c = default_rule(p), !p->error_indicator)  // default?
+            &&
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator)  // TYPE_COMMENT?
+        )
+        {
+            D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
+            _res = _PyPegen_name_default_pair ( p , a , c , tc );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
+    }
+    { // param default? TYPE_COMMENT? &')'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
+        arg_ty a;
+        void *c;
+        void *tc;
+        if (
+            (a = param_rule(p))  // param
+            &&
+            (c = default_rule(p), !p->error_indicator)  // default?
+            &&
+            (tc = _PyPegen_expect_token(p, TYPE_COMMENT), !p->error_indicator)  // TYPE_COMMENT?
+            &&
+            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)  // token=')'
+        )
+        {
+            D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
+            _res = _PyPegen_name_default_pair ( p , a , c , tc );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// param: NAME annotation?
+static arg_ty
+param_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    arg_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // NAME annotation?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME annotation?"));
+        expr_ty a;
+        void *b;
+        if (
+            (a = _PyPegen_name_token(p))  // NAME
+            &&
+            (b = annotation_rule(p), !p->error_indicator)  // annotation?
+        )
+        {
+            D(fprintf(stderr, "%*c+ param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME annotation?"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_arg ( a -> v . Name . id , b , NULL , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s param[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME annotation?"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// annotation: ':' expression
+static expr_ty
+annotation_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    { // ':' expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> annotation[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression"));
+        Token * _literal;
+        expr_ty a;
+        if (
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (a = expression_rule(p))  // expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression"));
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s annotation[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// default: '=' expression
+static expr_ty
+default_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    { // '=' expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' expression"));
+        Token * _literal;
+        expr_ty a;
+        if (
+            (_literal = _PyPegen_expect_token(p, 22))  // token='='
+            &&
+            (a = expression_rule(p))  // expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' expression"));
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s default[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' expression"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// decorators: (('@' named_expression NEWLINE))+
+static asdl_expr_seq*
+decorators_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_expr_seq* _res = NULL;
+    int _mark = p->mark;
+    { // (('@' named_expression NEWLINE))+
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> decorators[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+"));
+        asdl_expr_seq* a;
+        if (
+            (a = (asdl_expr_seq*)_loop1_84_rule(p))  // (('@' named_expression NEWLINE))+
+        )
+        {
+            D(fprintf(stderr, "%*c+ decorators[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+"));
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s decorators[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(('@' named_expression NEWLINE))+"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// class_def: decorators class_def_raw | class_def_raw
+static stmt_ty
+class_def_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    stmt_ty _res = NULL;
+    int _mark = p->mark;
+    { // decorators class_def_raw
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw"));
+        asdl_expr_seq* a;
+        stmt_ty b;
+        if (
+            (a = decorators_rule(p))  // decorators
+            &&
+            (b = class_def_raw_rule(p))  // class_def_raw
+        )
+        {
+            D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw"));
+            _res = _PyPegen_class_def_decorators ( p , a , b );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators class_def_raw"));
+    }
+    { // class_def_raw
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "class_def_raw"));
+        stmt_ty class_def_raw_var;
+        if (
+            (class_def_raw_var = class_def_raw_rule(p))  // class_def_raw
+        )
+        {
+            D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "class_def_raw"));
+            _res = class_def_raw_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "class_def_raw"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// class_def_raw: invalid_class_def_raw | 'class' NAME ['(' arguments? ')'] &&':' block
+static stmt_ty
+class_def_raw_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    stmt_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    if (p->call_invalid_rules) { // invalid_class_def_raw
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> class_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_class_def_raw"));
+        void *invalid_class_def_raw_var;
+        if (
+            (invalid_class_def_raw_var = invalid_class_def_raw_rule(p))  // invalid_class_def_raw
+        )
+        {
+            D(fprintf(stderr, "%*c+ class_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_class_def_raw"));
+            _res = invalid_class_def_raw_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s class_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_class_def_raw"));
+    }
+    { // 'class' NAME ['(' arguments? ')'] &&':' block
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> class_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] &&':' block"));
+        Token * _keyword;
+        Token * _literal;
+        expr_ty a;
+        void *b;
+        asdl_stmt_seq* c;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 527))  // token='class'
+            &&
+            (a = _PyPegen_name_token(p))  // NAME
+            &&
+            (b = _tmp_85_rule(p), !p->error_indicator)  // ['(' arguments? ')']
+            &&
+            (_literal = _PyPegen_expect_forced_token(p, 11, ":"))  // forced_token=':'
+            &&
+            (c = block_rule(p))  // block
+        )
+        {
+            D(fprintf(stderr, "%*c+ class_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] &&':' block"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_ClassDef ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , c , NULL , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s class_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class' NAME ['(' arguments? ')'] &&':' block"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// block: NEWLINE INDENT statements DEDENT | simple_stmts | invalid_block
+static asdl_stmt_seq*
+block_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_stmt_seq* _res = NULL;
+    if (_PyPegen_is_memoized(p, block_type, &_res)) {
+        p->level--;
+        return _res;
+    }
+    int _mark = p->mark;
+    { // NEWLINE INDENT statements DEDENT
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
+        asdl_stmt_seq* a;
+        Token * dedent_var;
+        Token * indent_var;
+        Token * newline_var;
+        if (
+            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+            &&
+            (indent_var = _PyPegen_expect_token(p, INDENT))  // token='INDENT'
+            &&
+            (a = statements_rule(p))  // statements
+            &&
+            (dedent_var = _PyPegen_expect_token(p, DEDENT))  // token='DEDENT'
+        )
+        {
+            D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
+    }
+    { // simple_stmts
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmts"));
+        asdl_stmt_seq* simple_stmts_var;
+        if (
+            (simple_stmts_var = simple_stmts_rule(p))  // simple_stmts
+        )
+        {
+            D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmts"));
+            _res = simple_stmts_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmts"));
+    }
+    if (p->call_invalid_rules) { // invalid_block
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_block"));
+        void *invalid_block_var;
+        if (
+            (invalid_block_var = invalid_block_rule(p))  // invalid_block
+        )
+        {
+            D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_block"));
+            _res = invalid_block_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_block"));
+    }
+    _res = NULL;
+  done:
+    _PyPegen_insert_memo(p, _mark, block_type, _res);
+    p->level--;
+    return _res;
+}
+
+// star_expressions:
+//     | star_expression ((',' star_expression))+ ','?
+//     | star_expression ','
+//     | star_expression
+static expr_ty
+star_expressions_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // star_expression ((',' star_expression))+ ','?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        expr_ty a;
+        asdl_seq * b;
+        if (
+            (a = star_expression_rule(p))  // star_expression
+            &&
+            (b = _loop1_86_rule(p))  // ((',' star_expression))+
+            &&
+            (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator)  // ','?
+        )
+        {
+            D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
+    }
+    { // star_expression ','
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ','"));
+        Token * _literal;
+        expr_ty a;
+        if (
+            (a = star_expression_rule(p))  // star_expression
+            &&
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+        )
+        {
+            D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ','"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ','"));
+    }
+    { // star_expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression"));
+        expr_ty star_expression_var;
+        if (
+            (star_expression_var = star_expression_rule(p))  // star_expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression"));
+            _res = star_expression_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// star_expression: '*' bitwise_or | expression
+static expr_ty
+star_expression_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    if (_PyPegen_is_memoized(p, star_expression_type, &_res)) {
+        p->level--;
+        return _res;
+    }
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // '*' bitwise_or
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
+        Token * _literal;
+        expr_ty a;
+        if (
+            (_literal = _PyPegen_expect_token(p, 16))  // token='*'
+            &&
+            (a = bitwise_or_rule(p))  // bitwise_or
+        )
+        {
+            D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Starred ( a , Load , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or"));
+    }
+    { // expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
+        expr_ty expression_var;
+        if (
+            (expression_var = expression_rule(p))  // expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
+            _res = expression_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
+    }
+    _res = NULL;
+  done:
+    _PyPegen_insert_memo(p, _mark, star_expression_type, _res);
+    p->level--;
+    return _res;
+}
+
+// star_named_expressions: ','.star_named_expression+ ','?
+static asdl_expr_seq*
+star_named_expressions_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_expr_seq* _res = NULL;
+    int _mark = p->mark;
+    { // ','.star_named_expression+ ','?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> star_named_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?"));
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        asdl_expr_seq* a;
+        if (
+            (a = (asdl_expr_seq*)_gather_87_rule(p))  // ','.star_named_expression+
+            &&
+            (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator)  // ','?
+        )
+        {
+            D(fprintf(stderr, "%*c+ star_named_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?"));
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s star_named_expressions[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_named_expression+ ','?"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// star_named_expression: '*' bitwise_or | named_expression
+static expr_ty
+star_named_expression_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // '*' bitwise_or
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
+        Token * _literal;
+        expr_ty a;
+        if (
+            (_literal = _PyPegen_expect_token(p, 16))  // token='*'
+            &&
+            (a = bitwise_or_rule(p))  // bitwise_or
+        )
+        {
+            D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Starred ( a , Load , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or"));
+    }
+    { // named_expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression"));
+        expr_ty named_expression_var;
+        if (
+            (named_expression_var = named_expression_rule(p))  // named_expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression"));
+            _res = named_expression_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// assignment_expression: NAME ':=' ~ expression
+static expr_ty
+assignment_expression_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // NAME ':=' ~ expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> assignment_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':=' ~ expression"));
+        int _cut_var = 0;
+        Token * _literal;
+        expr_ty a;
+        expr_ty b;
+        if (
+            (a = _PyPegen_name_token(p))  // NAME
+            &&
+            (_literal = _PyPegen_expect_token(p, 53))  // token=':='
+            &&
+            (_cut_var = 1)
+            &&
+            (b = expression_rule(p))  // expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ assignment_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ':=' ~ expression"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_NamedExpr ( CHECK ( expr_ty , _PyPegen_set_expr_context ( p , a , Store ) ) , b , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s assignment_expression[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':=' ~ expression"));
+        if (_cut_var) {
+            p->level--;
+            return NULL;
+        }
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// named_expression: assignment_expression | invalid_named_expression | expression !':='
+static expr_ty
+named_expression_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    { // assignment_expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "assignment_expression"));
+        expr_ty assignment_expression_var;
+        if (
+            (assignment_expression_var = assignment_expression_rule(p))  // assignment_expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "assignment_expression"));
+            _res = assignment_expression_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "assignment_expression"));
+    }
+    if (p->call_invalid_rules) { // invalid_named_expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_named_expression"));
+        void *invalid_named_expression_var;
+        if (
+            (invalid_named_expression_var = invalid_named_expression_rule(p))  // invalid_named_expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_named_expression"));
+            _res = invalid_named_expression_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_named_expression"));
+    }
+    { // expression !':='
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !':='"));
+        expr_ty expression_var;
+        if (
+            (expression_var = expression_rule(p))  // expression
+            &&
+            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53)  // token=':='
+        )
+        {
+            D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression !':='"));
+            _res = expression_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression !':='"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// annotated_rhs: yield_expr | star_expressions
+static expr_ty
+annotated_rhs_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    { // yield_expr
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
+        expr_ty yield_expr_var;
+        if (
+            (yield_expr_var = yield_expr_rule(p))  // yield_expr
+        )
+        {
+            D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
+            _res = yield_expr_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
+    }
+    { // star_expressions
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
+        expr_ty star_expressions_var;
+        if (
+            (star_expressions_var = star_expressions_rule(p))  // star_expressions
+        )
+        {
+            D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
+            _res = star_expressions_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// expressions: expression ((',' expression))+ ','? | expression ',' | expression
+static expr_ty
+expressions_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // expression ((',' expression))+ ','?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?"));
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        expr_ty a;
+        asdl_seq * b;
+        if (
+            (a = expression_rule(p))  // expression
+            &&
+            (b = _loop1_89_rule(p))  // ((',' expression))+
+            &&
+            (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator)  // ','?
+        )
+        {
+            D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ((',' expression))+ ','?"));
+    }
+    { // expression ','
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ','"));
+        Token * _literal;
+        expr_ty a;
+        if (
+            (a = expression_rule(p))  // expression
+            &&
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+        )
+        {
+            D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ','"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ','"));
+    }
+    { // expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
+        expr_ty expression_var;
+        if (
+            (expression_var = expression_rule(p))  // expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
+            _res = expression_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// expression:
+//     | invalid_expression
+//     | invalid_legacy_expression
+//     | disjunction 'if' disjunction 'else' expression
+//     | disjunction
+//     | lambdef
+static expr_ty
+expression_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    if (_PyPegen_is_memoized(p, expression_type, &_res)) {
+        p->level--;
+        return _res;
+    }
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    if (p->call_invalid_rules) { // invalid_expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_expression"));
+        void *invalid_expression_var;
+        if (
+            (invalid_expression_var = invalid_expression_rule(p))  // invalid_expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_expression"));
+            _res = invalid_expression_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_expression"));
+    }
+    if (p->call_invalid_rules) { // invalid_legacy_expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_legacy_expression"));
+        void *invalid_legacy_expression_var;
+        if (
+            (invalid_legacy_expression_var = invalid_legacy_expression_rule(p))  // invalid_legacy_expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_legacy_expression"));
+            _res = invalid_legacy_expression_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_legacy_expression"));
+    }
+    { // disjunction 'if' disjunction 'else' expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
+        Token * _keyword;
+        Token * _keyword_1;
+        expr_ty a;
+        expr_ty b;
+        expr_ty c;
+        if (
+            (a = disjunction_rule(p))  // disjunction
+            &&
+            (_keyword = _PyPegen_expect_token(p, 510))  // token='if'
+            &&
+            (b = disjunction_rule(p))  // disjunction
+            &&
+            (_keyword_1 = _PyPegen_expect_token(p, 516))  // token='else'
+            &&
+            (c = expression_rule(p))  // expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_IfExp ( b , a , c , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
+    }
+    { // disjunction
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction"));
+        expr_ty disjunction_var;
+        if (
+            (disjunction_var = disjunction_rule(p))  // disjunction
+        )
+        {
+            D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction"));
+            _res = disjunction_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction"));
+    }
+    { // lambdef
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambdef"));
+        expr_ty lambdef_var;
+        if (
+            (lambdef_var = lambdef_rule(p))  // lambdef
+        )
+        {
+            D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambdef"));
+            _res = lambdef_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambdef"));
+    }
+    _res = NULL;
+  done:
+    _PyPegen_insert_memo(p, _mark, expression_type, _res);
+    p->level--;
+    return _res;
+}
+
+// lambdef: 'lambda' lambda_params? ':' expression
+static expr_ty
+lambdef_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // 'lambda' lambda_params? ':' expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> lambdef[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression"));
+        Token * _keyword;
+        Token * _literal;
+        void *a;
+        expr_ty b;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 528))  // token='lambda'
+            &&
+            (a = lambda_params_rule(p), !p->error_indicator)  // lambda_params?
+            &&
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (b = expression_rule(p))  // expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ lambdef[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Lambda ( ( a ) ? a : CHECK ( arguments_ty , _PyPegen_empty_arguments ( p ) ) , b , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s lambdef[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'lambda' lambda_params? ':' expression"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// lambda_params: invalid_lambda_parameters | lambda_parameters
+static arguments_ty
+lambda_params_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    arguments_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->call_invalid_rules) { // invalid_lambda_parameters
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_parameters"));
+        void *invalid_lambda_parameters_var;
+        if (
+            (invalid_lambda_parameters_var = invalid_lambda_parameters_rule(p))  // invalid_lambda_parameters
+        )
+        {
+            D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_parameters"));
+            _res = invalid_lambda_parameters_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_parameters"));
+    }
+    { // lambda_parameters
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_parameters"));
+        arguments_ty lambda_parameters_var;
+        if (
+            (lambda_parameters_var = lambda_parameters_rule(p))  // lambda_parameters
+        )
+        {
+            D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_parameters"));
+            _res = lambda_parameters_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_parameters"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// lambda_parameters:
+//     | lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?
+//     | lambda_slash_with_default lambda_param_with_default* lambda_star_etc?
+//     | lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?
+//     | lambda_param_with_default+ lambda_star_etc?
+//     | lambda_star_etc
+static arguments_ty
+lambda_parameters_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    arguments_ty _res = NULL;
+    int _mark = p->mark;
+    { // lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?"));
+        asdl_arg_seq* a;
+        asdl_arg_seq* b;
+        asdl_seq * c;
+        void *d;
+        if (
+            (a = lambda_slash_no_default_rule(p))  // lambda_slash_no_default
+            &&
+            (b = (asdl_arg_seq*)_loop0_90_rule(p))  // lambda_param_no_default*
+            &&
+            (c = _loop0_91_rule(p))  // lambda_param_with_default*
+            &&
+            (d = lambda_star_etc_rule(p), !p->error_indicator)  // lambda_star_etc?
+        )
+        {
+            D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?"));
+            _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?"));
+    }
+    { // lambda_slash_with_default lambda_param_with_default* lambda_star_etc?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?"));
+        SlashWithDefault* a;
+        asdl_seq * b;
+        void *c;
+        if (
+            (a = lambda_slash_with_default_rule(p))  // lambda_slash_with_default
+            &&
+            (b = _loop0_92_rule(p))  // lambda_param_with_default*
+            &&
+            (c = lambda_star_etc_rule(p), !p->error_indicator)  // lambda_star_etc?
+        )
+        {
+            D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?"));
+            _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?"));
+    }
+    { // lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?"));
+        asdl_arg_seq* a;
+        asdl_seq * b;
+        void *c;
+        if (
+            (a = (asdl_arg_seq*)_loop1_93_rule(p))  // lambda_param_no_default+
+            &&
+            (b = _loop0_94_rule(p))  // lambda_param_with_default*
+            &&
+            (c = lambda_star_etc_rule(p), !p->error_indicator)  // lambda_star_etc?
+        )
+        {
+            D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?"));
+            _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?"));
+    }
+    { // lambda_param_with_default+ lambda_star_etc?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
+        asdl_seq * a;
+        void *b;
+        if (
+            (a = _loop1_95_rule(p))  // lambda_param_with_default+
+            &&
+            (b = lambda_star_etc_rule(p), !p->error_indicator)  // lambda_star_etc?
+        )
+        {
+            D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
+            _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
+    }
+    { // lambda_star_etc
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_star_etc"));
+        StarEtc* a;
+        if (
+            (a = lambda_star_etc_rule(p))  // lambda_star_etc
+        )
+        {
+            D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_star_etc"));
+            _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_star_etc"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// lambda_slash_no_default:
+//     | lambda_param_no_default+ '/' ','
+//     | lambda_param_no_default+ '/' &':'
+static asdl_arg_seq*
+lambda_slash_no_default_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_arg_seq* _res = NULL;
+    int _mark = p->mark;
+    { // lambda_param_no_default+ '/' ','
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','"));
+        Token * _literal;
+        Token * _literal_1;
+        asdl_arg_seq* a;
+        if (
+            (a = (asdl_arg_seq*)_loop1_96_rule(p))  // lambda_param_no_default+
+            &&
+            (_literal = _PyPegen_expect_token(p, 17))  // token='/'
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 12))  // token=','
+        )
+        {
+            D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','"));
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' ','"));
+    }
+    { // lambda_param_no_default+ '/' &':'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
+        Token * _literal;
+        asdl_arg_seq* a;
+        if (
+            (a = (asdl_arg_seq*)_loop1_97_rule(p))  // lambda_param_no_default+
+            &&
+            (_literal = _PyPegen_expect_token(p, 17))  // token='/'
+            &&
+            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11)  // token=':'
+        )
+        {
+            D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// lambda_slash_with_default:
+//     | lambda_param_no_default* lambda_param_with_default+ '/' ','
+//     | lambda_param_no_default* lambda_param_with_default+ '/' &':'
+static SlashWithDefault*
+lambda_slash_with_default_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    SlashWithDefault* _res = NULL;
+    int _mark = p->mark;
+    { // lambda_param_no_default* lambda_param_with_default+ '/' ','
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> lambda_slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','"));
+        Token * _literal;
+        Token * _literal_1;
+        asdl_seq * a;
+        asdl_seq * b;
+        if (
+            (a = _loop0_98_rule(p))  // lambda_param_no_default*
+            &&
+            (b = _loop1_99_rule(p))  // lambda_param_with_default+
+            &&
+            (_literal = _PyPegen_expect_token(p, 17))  // token='/'
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 12))  // token=','
+        )
+        {
+            D(fprintf(stderr, "%*c+ lambda_slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','"));
+            _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','"));
+    }
+    { // lambda_param_no_default* lambda_param_with_default+ '/' &':'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> lambda_slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'"));
+        Token * _literal;
+        asdl_seq * a;
+        asdl_seq * b;
+        if (
+            (a = _loop0_100_rule(p))  // lambda_param_no_default*
+            &&
+            (b = _loop1_101_rule(p))  // lambda_param_with_default+
+            &&
+            (_literal = _PyPegen_expect_token(p, 17))  // token='/'
+            &&
+            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11)  // token=':'
+        )
+        {
+            D(fprintf(stderr, "%*c+ lambda_slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'"));
+            _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// lambda_star_etc:
+//     | '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?
+//     | '*' ',' lambda_param_maybe_default+ lambda_kwds?
+//     | lambda_kwds
+//     | invalid_lambda_star_etc
+static StarEtc*
+lambda_star_etc_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    StarEtc* _res = NULL;
+    int _mark = p->mark;
+    { // '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?"));
+        Token * _literal;
+        arg_ty a;
+        asdl_seq * b;
+        void *c;
+        if (
+            (_literal = _PyPegen_expect_token(p, 16))  // token='*'
+            &&
+            (a = lambda_param_no_default_rule(p))  // lambda_param_no_default
+            &&
+            (b = _loop0_102_rule(p))  // lambda_param_maybe_default*
+            &&
+            (c = lambda_kwds_rule(p), !p->error_indicator)  // lambda_kwds?
+        )
+        {
+            D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?"));
+            _res = _PyPegen_star_etc ( p , a , b , c );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?"));
+    }
+    { // '*' ',' lambda_param_maybe_default+ lambda_kwds?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
+        Token * _literal;
+        Token * _literal_1;
+        asdl_seq * b;
+        void *c;
+        if (
+            (_literal = _PyPegen_expect_token(p, 16))  // token='*'
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (b = _loop1_103_rule(p))  // lambda_param_maybe_default+
+            &&
+            (c = lambda_kwds_rule(p), !p->error_indicator)  // lambda_kwds?
+        )
+        {
+            D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
+            _res = _PyPegen_star_etc ( p , NULL , b , c );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
+    }
+    { // lambda_kwds
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_kwds"));
+        arg_ty a;
+        if (
+            (a = lambda_kwds_rule(p))  // lambda_kwds
+        )
+        {
+            D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_kwds"));
+            _res = _PyPegen_star_etc ( p , NULL , NULL , a );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_kwds"));
+    }
+    if (p->call_invalid_rules) { // invalid_lambda_star_etc
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc"));
+        void *invalid_lambda_star_etc_var;
+        if (
+            (invalid_lambda_star_etc_var = invalid_lambda_star_etc_rule(p))  // invalid_lambda_star_etc
+        )
+        {
+            D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc"));
+            _res = invalid_lambda_star_etc_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_star_etc"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// lambda_kwds: '**' lambda_param_no_default
+static arg_ty
+lambda_kwds_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    arg_ty _res = NULL;
+    int _mark = p->mark;
+    { // '**' lambda_param_no_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> lambda_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default"));
+        Token * _literal;
+        arg_ty a;
+        if (
+            (_literal = _PyPegen_expect_token(p, 35))  // token='**'
+            &&
+            (a = lambda_param_no_default_rule(p))  // lambda_param_no_default
+        )
+        {
+            D(fprintf(stderr, "%*c+ lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default"));
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s lambda_kwds[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' lambda_param_no_default"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// lambda_param_no_default: lambda_param ',' | lambda_param &':'
+static arg_ty
+lambda_param_no_default_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    arg_ty _res = NULL;
+    int _mark = p->mark;
+    { // lambda_param ','
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param ','"));
+        Token * _literal;
+        arg_ty a;
+        if (
+            (a = lambda_param_rule(p))  // lambda_param
+            &&
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+        )
+        {
+            D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param ','"));
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param ','"));
+    }
+    { // lambda_param &':'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param &':'"));
+        arg_ty a;
+        if (
+            (a = lambda_param_rule(p))  // lambda_param
+            &&
+            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11)  // token=':'
+        )
+        {
+            D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param &':'"));
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param &':'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// lambda_param_with_default: lambda_param default ',' | lambda_param default &':'
+static NameDefaultPair*
+lambda_param_with_default_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    NameDefaultPair* _res = NULL;
+    int _mark = p->mark;
+    { // lambda_param default ','
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default ','"));
+        Token * _literal;
+        arg_ty a;
+        expr_ty c;
+        if (
+            (a = lambda_param_rule(p))  // lambda_param
+            &&
+            (c = default_rule(p))  // default
+            &&
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+        )
+        {
+            D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default ','"));
+            _res = _PyPegen_name_default_pair ( p , a , c , NULL );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default ','"));
+    }
+    { // lambda_param default &':'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'"));
+        arg_ty a;
+        expr_ty c;
+        if (
+            (a = lambda_param_rule(p))  // lambda_param
+            &&
+            (c = default_rule(p))  // default
+            &&
+            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11)  // token=':'
+        )
+        {
+            D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'"));
+            _res = _PyPegen_name_default_pair ( p , a , c , NULL );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default &':'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// lambda_param_maybe_default: lambda_param default? ',' | lambda_param default? &':'
+static NameDefaultPair*
+lambda_param_maybe_default_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    NameDefaultPair* _res = NULL;
+    int _mark = p->mark;
+    { // lambda_param default? ','
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','"));
+        Token * _literal;
+        arg_ty a;
+        void *c;
+        if (
+            (a = lambda_param_rule(p))  // lambda_param
+            &&
+            (c = default_rule(p), !p->error_indicator)  // default?
+            &&
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+        )
+        {
+            D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','"));
+            _res = _PyPegen_name_default_pair ( p , a , c , NULL );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? ','"));
+    }
+    { // lambda_param default? &':'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'"));
+        arg_ty a;
+        void *c;
+        if (
+            (a = lambda_param_rule(p))  // lambda_param
+            &&
+            (c = default_rule(p), !p->error_indicator)  // default?
+            &&
+            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11)  // token=':'
+        )
+        {
+            D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'"));
+            _res = _PyPegen_name_default_pair ( p , a , c , NULL );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? &':'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// lambda_param: NAME
+static arg_ty
+lambda_param_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    arg_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // NAME
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> lambda_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
+        expr_ty a;
+        if (
+            (a = _PyPegen_name_token(p))  // NAME
+        )
+        {
+            D(fprintf(stderr, "%*c+ lambda_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_arg ( a -> v . Name . id , NULL , NULL , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s lambda_param[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// disjunction: conjunction (('or' conjunction))+ | conjunction
+static expr_ty
+disjunction_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    if (_PyPegen_is_memoized(p, disjunction_type, &_res)) {
+        p->level--;
+        return _res;
+    }
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // conjunction (('or' conjunction))+
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+"));
+        expr_ty a;
+        asdl_seq * b;
+        if (
+            (a = conjunction_rule(p))  // conjunction
+            &&
+            (b = _loop1_104_rule(p))  // (('or' conjunction))+
+        )
+        {
+            D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_BoolOp ( Or , CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction (('or' conjunction))+"));
+    }
+    { // conjunction
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction"));
+        expr_ty conjunction_var;
+        if (
+            (conjunction_var = conjunction_rule(p))  // conjunction
+        )
+        {
+            D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction"));
+            _res = conjunction_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction"));
+    }
+    _res = NULL;
+  done:
+    _PyPegen_insert_memo(p, _mark, disjunction_type, _res);
+    p->level--;
+    return _res;
+}
+
+// conjunction: inversion (('and' inversion))+ | inversion
+static expr_ty
+conjunction_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    if (_PyPegen_is_memoized(p, conjunction_type, &_res)) {
+        p->level--;
+        return _res;
+    }
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // inversion (('and' inversion))+
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+"));
+        expr_ty a;
+        asdl_seq * b;
+        if (
+            (a = inversion_rule(p))  // inversion
+            &&
+            (b = _loop1_105_rule(p))  // (('and' inversion))+
+        )
+        {
+            D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_BoolOp ( And , CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion (('and' inversion))+"));
+    }
+    { // inversion
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion"));
+        expr_ty inversion_var;
+        if (
+            (inversion_var = inversion_rule(p))  // inversion
+        )
+        {
+            D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion"));
+            _res = inversion_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion"));
+    }
+    _res = NULL;
+  done:
+    _PyPegen_insert_memo(p, _mark, conjunction_type, _res);
+    p->level--;
+    return _res;
+}
+
+// inversion: 'not' inversion | comparison
+static expr_ty
+inversion_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    if (_PyPegen_is_memoized(p, inversion_type, &_res)) {
+        p->level--;
+        return _res;
+    }
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // 'not' inversion
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' inversion"));
+        Token * _keyword;
+        expr_ty a;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 529))  // token='not'
+            &&
+            (a = inversion_rule(p))  // inversion
+        )
+        {
+            D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' inversion"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_UnaryOp ( Not , a , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' inversion"));
+    }
+    { // comparison
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "comparison"));
+        expr_ty comparison_var;
+        if (
+            (comparison_var = comparison_rule(p))  // comparison
+        )
+        {
+            D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "comparison"));
+            _res = comparison_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "comparison"));
+    }
+    _res = NULL;
+  done:
+    _PyPegen_insert_memo(p, _mark, inversion_type, _res);
+    p->level--;
+    return _res;
+}
+
+// comparison: bitwise_or compare_op_bitwise_or_pair+ | bitwise_or
+static expr_ty
+comparison_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // bitwise_or compare_op_bitwise_or_pair+
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
+        expr_ty a;
+        asdl_seq * b;
+        if (
+            (a = bitwise_or_rule(p))  // bitwise_or
+            &&
+            (b = _loop1_106_rule(p))  // compare_op_bitwise_or_pair+
+        )
+        {
+            D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Compare ( a , CHECK ( asdl_int_seq * , _PyPegen_get_cmpops ( p , b ) ) , CHECK ( asdl_expr_seq * , _PyPegen_get_exprs ( p , b ) ) , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
+    }
+    { // bitwise_or
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or"));
+        expr_ty bitwise_or_var;
+        if (
+            (bitwise_or_var = bitwise_or_rule(p))  // bitwise_or
+        )
+        {
+            D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or"));
+            _res = bitwise_or_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// compare_op_bitwise_or_pair:
+//     | eq_bitwise_or
+//     | noteq_bitwise_or
+//     | lte_bitwise_or
+//     | lt_bitwise_or
+//     | gte_bitwise_or
+//     | gt_bitwise_or
+//     | notin_bitwise_or
+//     | in_bitwise_or
+//     | isnot_bitwise_or
+//     | is_bitwise_or
+static CmpopExprPair*
+compare_op_bitwise_or_pair_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    CmpopExprPair* _res = NULL;
+    int _mark = p->mark;
+    { // eq_bitwise_or
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "eq_bitwise_or"));
+        CmpopExprPair* eq_bitwise_or_var;
+        if (
+            (eq_bitwise_or_var = eq_bitwise_or_rule(p))  // eq_bitwise_or
+        )
+        {
+            D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "eq_bitwise_or"));
+            _res = eq_bitwise_or_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "eq_bitwise_or"));
+    }
+    { // noteq_bitwise_or
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "noteq_bitwise_or"));
+        CmpopExprPair* noteq_bitwise_or_var;
+        if (
+            (noteq_bitwise_or_var = noteq_bitwise_or_rule(p))  // noteq_bitwise_or
+        )
+        {
+            D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "noteq_bitwise_or"));
+            _res = noteq_bitwise_or_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "noteq_bitwise_or"));
+    }
+    { // lte_bitwise_or
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lte_bitwise_or"));
+        CmpopExprPair* lte_bitwise_or_var;
+        if (
+            (lte_bitwise_or_var = lte_bitwise_or_rule(p))  // lte_bitwise_or
+        )
+        {
+            D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lte_bitwise_or"));
+            _res = lte_bitwise_or_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lte_bitwise_or"));
+    }
+    { // lt_bitwise_or
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lt_bitwise_or"));
+        CmpopExprPair* lt_bitwise_or_var;
+        if (
+            (lt_bitwise_or_var = lt_bitwise_or_rule(p))  // lt_bitwise_or
+        )
+        {
+            D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lt_bitwise_or"));
+            _res = lt_bitwise_or_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lt_bitwise_or"));
+    }
+    { // gte_bitwise_or
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "gte_bitwise_or"));
+        CmpopExprPair* gte_bitwise_or_var;
+        if (
+            (gte_bitwise_or_var = gte_bitwise_or_rule(p))  // gte_bitwise_or
+        )
+        {
+            D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gte_bitwise_or"));
+            _res = gte_bitwise_or_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gte_bitwise_or"));
+    }
+    { // gt_bitwise_or
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "gt_bitwise_or"));
+        CmpopExprPair* gt_bitwise_or_var;
+        if (
+            (gt_bitwise_or_var = gt_bitwise_or_rule(p))  // gt_bitwise_or
+        )
+        {
+            D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gt_bitwise_or"));
+            _res = gt_bitwise_or_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gt_bitwise_or"));
+    }
+    { // notin_bitwise_or
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "notin_bitwise_or"));
+        CmpopExprPair* notin_bitwise_or_var;
+        if (
+            (notin_bitwise_or_var = notin_bitwise_or_rule(p))  // notin_bitwise_or
+        )
+        {
+            D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "notin_bitwise_or"));
+            _res = notin_bitwise_or_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "notin_bitwise_or"));
+    }
+    { // in_bitwise_or
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "in_bitwise_or"));
+        CmpopExprPair* in_bitwise_or_var;
+        if (
+            (in_bitwise_or_var = in_bitwise_or_rule(p))  // in_bitwise_or
+        )
+        {
+            D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "in_bitwise_or"));
+            _res = in_bitwise_or_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "in_bitwise_or"));
+    }
+    { // isnot_bitwise_or
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "isnot_bitwise_or"));
+        CmpopExprPair* isnot_bitwise_or_var;
+        if (
+            (isnot_bitwise_or_var = isnot_bitwise_or_rule(p))  // isnot_bitwise_or
+        )
+        {
+            D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "isnot_bitwise_or"));
+            _res = isnot_bitwise_or_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "isnot_bitwise_or"));
+    }
+    { // is_bitwise_or
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "is_bitwise_or"));
+        CmpopExprPair* is_bitwise_or_var;
+        if (
+            (is_bitwise_or_var = is_bitwise_or_rule(p))  // is_bitwise_or
+        )
+        {
+            D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "is_bitwise_or"));
+            _res = is_bitwise_or_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "is_bitwise_or"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// eq_bitwise_or: '==' bitwise_or
+static CmpopExprPair*
+eq_bitwise_or_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    CmpopExprPair* _res = NULL;
+    int _mark = p->mark;
+    { // '==' bitwise_or
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> eq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or"));
+        Token * _literal;
+        expr_ty a;
+        if (
+            (_literal = _PyPegen_expect_token(p, 27))  // token='=='
+            &&
+            (a = bitwise_or_rule(p))  // bitwise_or
+        )
+        {
+            D(fprintf(stderr, "%*c+ eq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or"));
+            _res = _PyPegen_cmpop_expr_pair ( p , Eq , a );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s eq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'==' bitwise_or"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// noteq_bitwise_or: ('!=') bitwise_or
+static CmpopExprPair*
+noteq_bitwise_or_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    CmpopExprPair* _res = NULL;
+    int _mark = p->mark;
+    { // ('!=') bitwise_or
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> noteq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or"));
+        void *_tmp_107_var;
+        expr_ty a;
+        if (
+            (_tmp_107_var = _tmp_107_rule(p))  // '!='
+            &&
+            (a = bitwise_or_rule(p))  // bitwise_or
+        )
+        {
+            D(fprintf(stderr, "%*c+ noteq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or"));
+            _res = _PyPegen_cmpop_expr_pair ( p , NotEq , a );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s noteq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('!=') bitwise_or"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// lte_bitwise_or: '<=' bitwise_or
+static CmpopExprPair*
+lte_bitwise_or_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    CmpopExprPair* _res = NULL;
+    int _mark = p->mark;
+    { // '<=' bitwise_or
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> lte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or"));
+        Token * _literal;
+        expr_ty a;
+        if (
+            (_literal = _PyPegen_expect_token(p, 29))  // token='<='
+            &&
+            (a = bitwise_or_rule(p))  // bitwise_or
+        )
+        {
+            D(fprintf(stderr, "%*c+ lte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or"));
+            _res = _PyPegen_cmpop_expr_pair ( p , LtE , a );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s lte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<=' bitwise_or"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// lt_bitwise_or: '<' bitwise_or
+static CmpopExprPair*
+lt_bitwise_or_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    CmpopExprPair* _res = NULL;
+    int _mark = p->mark;
+    { // '<' bitwise_or
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> lt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or"));
+        Token * _literal;
+        expr_ty a;
+        if (
+            (_literal = _PyPegen_expect_token(p, 20))  // token='<'
+            &&
+            (a = bitwise_or_rule(p))  // bitwise_or
+        )
+        {
+            D(fprintf(stderr, "%*c+ lt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or"));
+            _res = _PyPegen_cmpop_expr_pair ( p , Lt , a );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s lt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<' bitwise_or"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// gte_bitwise_or: '>=' bitwise_or
+static CmpopExprPair*
+gte_bitwise_or_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    CmpopExprPair* _res = NULL;
+    int _mark = p->mark;
+    { // '>=' bitwise_or
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> gte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or"));
+        Token * _literal;
+        expr_ty a;
+        if (
+            (_literal = _PyPegen_expect_token(p, 30))  // token='>='
+            &&
+            (a = bitwise_or_rule(p))  // bitwise_or
+        )
+        {
+            D(fprintf(stderr, "%*c+ gte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or"));
+            _res = _PyPegen_cmpop_expr_pair ( p , GtE , a );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s gte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>=' bitwise_or"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// gt_bitwise_or: '>' bitwise_or
+static CmpopExprPair*
+gt_bitwise_or_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    CmpopExprPair* _res = NULL;
+    int _mark = p->mark;
+    { // '>' bitwise_or
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> gt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or"));
+        Token * _literal;
+        expr_ty a;
+        if (
+            (_literal = _PyPegen_expect_token(p, 21))  // token='>'
+            &&
+            (a = bitwise_or_rule(p))  // bitwise_or
+        )
+        {
+            D(fprintf(stderr, "%*c+ gt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or"));
+            _res = _PyPegen_cmpop_expr_pair ( p , Gt , a );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s gt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>' bitwise_or"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// notin_bitwise_or: 'not' 'in' bitwise_or
+static CmpopExprPair*
+notin_bitwise_or_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    CmpopExprPair* _res = NULL;
+    int _mark = p->mark;
+    { // 'not' 'in' bitwise_or
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> notin_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or"));
+        Token * _keyword;
+        Token * _keyword_1;
+        expr_ty a;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 529))  // token='not'
+            &&
+            (_keyword_1 = _PyPegen_expect_token(p, 518))  // token='in'
+            &&
+            (a = bitwise_or_rule(p))  // bitwise_or
+        )
+        {
+            D(fprintf(stderr, "%*c+ notin_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or"));
+            _res = _PyPegen_cmpop_expr_pair ( p , NotIn , a );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s notin_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' 'in' bitwise_or"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// in_bitwise_or: 'in' bitwise_or
+static CmpopExprPair*
+in_bitwise_or_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    CmpopExprPair* _res = NULL;
+    int _mark = p->mark;
+    { // 'in' bitwise_or
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> in_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or"));
+        Token * _keyword;
+        expr_ty a;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 518))  // token='in'
+            &&
+            (a = bitwise_or_rule(p))  // bitwise_or
+        )
+        {
+            D(fprintf(stderr, "%*c+ in_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or"));
+            _res = _PyPegen_cmpop_expr_pair ( p , In , a );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s in_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'in' bitwise_or"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// isnot_bitwise_or: 'is' 'not' bitwise_or
+static CmpopExprPair*
+isnot_bitwise_or_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    CmpopExprPair* _res = NULL;
+    int _mark = p->mark;
+    { // 'is' 'not' bitwise_or
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> isnot_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or"));
+        Token * _keyword;
+        Token * _keyword_1;
+        expr_ty a;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 530))  // token='is'
+            &&
+            (_keyword_1 = _PyPegen_expect_token(p, 529))  // token='not'
+            &&
+            (a = bitwise_or_rule(p))  // bitwise_or
+        )
+        {
+            D(fprintf(stderr, "%*c+ isnot_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or"));
+            _res = _PyPegen_cmpop_expr_pair ( p , IsNot , a );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s isnot_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' 'not' bitwise_or"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// is_bitwise_or: 'is' bitwise_or
+static CmpopExprPair*
+is_bitwise_or_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    CmpopExprPair* _res = NULL;
+    int _mark = p->mark;
+    { // 'is' bitwise_or
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> is_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or"));
+        Token * _keyword;
+        expr_ty a;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 530))  // token='is'
+            &&
+            (a = bitwise_or_rule(p))  // bitwise_or
+        )
+        {
+            D(fprintf(stderr, "%*c+ is_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or"));
+            _res = _PyPegen_cmpop_expr_pair ( p , Is , a );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s is_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' bitwise_or"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// Left-recursive
+// bitwise_or: bitwise_or '|' bitwise_xor | bitwise_xor
+static expr_ty bitwise_or_raw(Parser *);
+static expr_ty
+bitwise_or_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    expr_ty _res = NULL;
+    if (_PyPegen_is_memoized(p, bitwise_or_type, &_res)) {
+        p->level--;
+        return _res;
+    }
+    int _mark = p->mark;
+    int _resmark = p->mark;
+    while (1) {
+        int tmpvar_2 = _PyPegen_update_memo(p, _mark, bitwise_or_type, _res);
+        if (tmpvar_2) {
+            p->level--;
+            return _res;
+        }
+        p->mark = _mark;
+        void *_raw = bitwise_or_raw(p);
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        if (_raw == NULL || p->mark <= _resmark)
+            break;
+        _resmark = p->mark;
+        _res = _raw;
+    }
+    p->mark = _resmark;
+    p->level--;
+    return _res;
+}
+static expr_ty
+bitwise_or_raw(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // bitwise_or '|' bitwise_xor
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor"));
+        Token * _literal;
+        expr_ty a;
+        expr_ty b;
+        if (
+            (a = bitwise_or_rule(p))  // bitwise_or
+            &&
+            (_literal = _PyPegen_expect_token(p, 18))  // token='|'
+            &&
+            (b = bitwise_xor_rule(p))  // bitwise_xor
+        )
+        {
+            D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_BinOp ( a , BitOr , b , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or '|' bitwise_xor"));
+    }
+    { // bitwise_xor
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor"));
+        expr_ty bitwise_xor_var;
+        if (
+            (bitwise_xor_var = bitwise_xor_rule(p))  // bitwise_xor
+        )
+        {
+            D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor"));
+            _res = bitwise_xor_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// Left-recursive
+// bitwise_xor: bitwise_xor '^' bitwise_and | bitwise_and
+static expr_ty bitwise_xor_raw(Parser *);
+static expr_ty
+bitwise_xor_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    expr_ty _res = NULL;
+    if (_PyPegen_is_memoized(p, bitwise_xor_type, &_res)) {
+        p->level--;
+        return _res;
+    }
+    int _mark = p->mark;
+    int _resmark = p->mark;
+    while (1) {
+        int tmpvar_3 = _PyPegen_update_memo(p, _mark, bitwise_xor_type, _res);
+        if (tmpvar_3) {
+            p->level--;
+            return _res;
+        }
+        p->mark = _mark;
+        void *_raw = bitwise_xor_raw(p);
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        if (_raw == NULL || p->mark <= _resmark)
+            break;
+        _resmark = p->mark;
+        _res = _raw;
+    }
+    p->mark = _resmark;
+    p->level--;
+    return _res;
+}
+static expr_ty
+bitwise_xor_raw(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // bitwise_xor '^' bitwise_and
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and"));
+        Token * _literal;
+        expr_ty a;
+        expr_ty b;
+        if (
+            (a = bitwise_xor_rule(p))  // bitwise_xor
+            &&
+            (_literal = _PyPegen_expect_token(p, 32))  // token='^'
+            &&
+            (b = bitwise_and_rule(p))  // bitwise_and
+        )
+        {
+            D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_BinOp ( a , BitXor , b , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor '^' bitwise_and"));
+    }
+    { // bitwise_and
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and"));
+        expr_ty bitwise_and_var;
+        if (
+            (bitwise_and_var = bitwise_and_rule(p))  // bitwise_and
+        )
+        {
+            D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and"));
+            _res = bitwise_and_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// Left-recursive
+// bitwise_and: bitwise_and '&' shift_expr | shift_expr
+static expr_ty bitwise_and_raw(Parser *);
+static expr_ty
+bitwise_and_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    expr_ty _res = NULL;
+    if (_PyPegen_is_memoized(p, bitwise_and_type, &_res)) {
+        p->level--;
+        return _res;
+    }
+    int _mark = p->mark;
+    int _resmark = p->mark;
+    while (1) {
+        int tmpvar_4 = _PyPegen_update_memo(p, _mark, bitwise_and_type, _res);
+        if (tmpvar_4) {
+            p->level--;
+            return _res;
+        }
+        p->mark = _mark;
+        void *_raw = bitwise_and_raw(p);
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        if (_raw == NULL || p->mark <= _resmark)
+            break;
+        _resmark = p->mark;
+        _res = _raw;
+    }
+    p->mark = _resmark;
+    p->level--;
+    return _res;
+}
+static expr_ty
+bitwise_and_raw(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // bitwise_and '&' shift_expr
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr"));
+        Token * _literal;
+        expr_ty a;
+        expr_ty b;
+        if (
+            (a = bitwise_and_rule(p))  // bitwise_and
+            &&
+            (_literal = _PyPegen_expect_token(p, 19))  // token='&'
+            &&
+            (b = shift_expr_rule(p))  // shift_expr
+        )
+        {
+            D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_BinOp ( a , BitAnd , b , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and '&' shift_expr"));
+    }
+    { // shift_expr
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr"));
+        expr_ty shift_expr_var;
+        if (
+            (shift_expr_var = shift_expr_rule(p))  // shift_expr
+        )
+        {
+            D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr"));
+            _res = shift_expr_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// Left-recursive
+// shift_expr: shift_expr '<<' sum | shift_expr '>>' sum | sum
+static expr_ty shift_expr_raw(Parser *);
+static expr_ty
+shift_expr_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    expr_ty _res = NULL;
+    if (_PyPegen_is_memoized(p, shift_expr_type, &_res)) {
+        p->level--;
+        return _res;
+    }
+    int _mark = p->mark;
+    int _resmark = p->mark;
+    while (1) {
+        int tmpvar_5 = _PyPegen_update_memo(p, _mark, shift_expr_type, _res);
+        if (tmpvar_5) {
+            p->level--;
+            return _res;
+        }
+        p->mark = _mark;
+        void *_raw = shift_expr_raw(p);
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        if (_raw == NULL || p->mark <= _resmark)
+            break;
+        _resmark = p->mark;
+        _res = _raw;
+    }
+    p->mark = _resmark;
+    p->level--;
+    return _res;
+}
+static expr_ty
+shift_expr_raw(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // shift_expr '<<' sum
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum"));
+        Token * _literal;
+        expr_ty a;
+        expr_ty b;
+        if (
+            (a = shift_expr_rule(p))  // shift_expr
+            &&
+            (_literal = _PyPegen_expect_token(p, 33))  // token='<<'
+            &&
+            (b = sum_rule(p))  // sum
+        )
+        {
+            D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_BinOp ( a , LShift , b , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '<<' sum"));
+    }
+    { // shift_expr '>>' sum
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum"));
+        Token * _literal;
+        expr_ty a;
+        expr_ty b;
+        if (
+            (a = shift_expr_rule(p))  // shift_expr
+            &&
+            (_literal = _PyPegen_expect_token(p, 34))  // token='>>'
+            &&
+            (b = sum_rule(p))  // sum
+        )
+        {
+            D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_BinOp ( a , RShift , b , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '>>' sum"));
+    }
+    { // sum
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum"));
+        expr_ty sum_var;
+        if (
+            (sum_var = sum_rule(p))  // sum
+        )
+        {
+            D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum"));
+            _res = sum_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// Left-recursive
+// sum: sum '+' term | sum '-' term | term
+static expr_ty sum_raw(Parser *);
+static expr_ty
+sum_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    expr_ty _res = NULL;
+    if (_PyPegen_is_memoized(p, sum_type, &_res)) {
+        p->level--;
+        return _res;
+    }
+    int _mark = p->mark;
+    int _resmark = p->mark;
+    while (1) {
+        int tmpvar_6 = _PyPegen_update_memo(p, _mark, sum_type, _res);
+        if (tmpvar_6) {
+            p->level--;
+            return _res;
+        }
+        p->mark = _mark;
+        void *_raw = sum_raw(p);
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        if (_raw == NULL || p->mark <= _resmark)
+            break;
+        _resmark = p->mark;
+        _res = _raw;
+    }
+    p->mark = _resmark;
+    p->level--;
+    return _res;
+}
+static expr_ty
+sum_raw(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // sum '+' term
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '+' term"));
+        Token * _literal;
+        expr_ty a;
+        expr_ty b;
+        if (
+            (a = sum_rule(p))  // sum
+            &&
+            (_literal = _PyPegen_expect_token(p, 14))  // token='+'
+            &&
+            (b = term_rule(p))  // term
+        )
+        {
+            D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '+' term"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_BinOp ( a , Add , b , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '+' term"));
+    }
+    { // sum '-' term
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '-' term"));
+        Token * _literal;
+        expr_ty a;
+        expr_ty b;
+        if (
+            (a = sum_rule(p))  // sum
+            &&
+            (_literal = _PyPegen_expect_token(p, 15))  // token='-'
+            &&
+            (b = term_rule(p))  // term
+        )
+        {
+            D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '-' term"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_BinOp ( a , Sub , b , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '-' term"));
+    }
+    { // term
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term"));
+        expr_ty term_var;
+        if (
+            (term_var = term_rule(p))  // term
+        )
+        {
+            D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term"));
+            _res = term_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// Left-recursive
+// term:
+//     | term '*' factor
+//     | term '/' factor
+//     | term '//' factor
+//     | term '%' factor
+//     | term '@' factor
+//     | factor
+static expr_ty term_raw(Parser *);
+static expr_ty
+term_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    expr_ty _res = NULL;
+    if (_PyPegen_is_memoized(p, term_type, &_res)) {
+        p->level--;
+        return _res;
+    }
+    int _mark = p->mark;
+    int _resmark = p->mark;
+    while (1) {
+        int tmpvar_7 = _PyPegen_update_memo(p, _mark, term_type, _res);
+        if (tmpvar_7) {
+            p->level--;
+            return _res;
+        }
+        p->mark = _mark;
+        void *_raw = term_raw(p);
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        if (_raw == NULL || p->mark <= _resmark)
+            break;
+        _resmark = p->mark;
+        _res = _raw;
+    }
+    p->mark = _resmark;
+    p->level--;
+    return _res;
+}
+static expr_ty
+term_raw(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // term '*' factor
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '*' factor"));
+        Token * _literal;
+        expr_ty a;
+        expr_ty b;
+        if (
+            (a = term_rule(p))  // term
+            &&
+            (_literal = _PyPegen_expect_token(p, 16))  // token='*'
+            &&
+            (b = factor_rule(p))  // factor
+        )
+        {
+            D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '*' factor"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_BinOp ( a , Mult , b , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '*' factor"));
+    }
+    { // term '/' factor
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '/' factor"));
+        Token * _literal;
+        expr_ty a;
+        expr_ty b;
+        if (
+            (a = term_rule(p))  // term
+            &&
+            (_literal = _PyPegen_expect_token(p, 17))  // token='/'
+            &&
+            (b = factor_rule(p))  // factor
+        )
+        {
+            D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '/' factor"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_BinOp ( a , Div , b , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '/' factor"));
+    }
+    { // term '//' factor
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '//' factor"));
+        Token * _literal;
+        expr_ty a;
+        expr_ty b;
+        if (
+            (a = term_rule(p))  // term
+            &&
+            (_literal = _PyPegen_expect_token(p, 47))  // token='//'
+            &&
+            (b = factor_rule(p))  // factor
+        )
+        {
+            D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '//' factor"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_BinOp ( a , FloorDiv , b , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '//' factor"));
+    }
+    { // term '%' factor
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '%' factor"));
+        Token * _literal;
+        expr_ty a;
+        expr_ty b;
+        if (
+            (a = term_rule(p))  // term
+            &&
+            (_literal = _PyPegen_expect_token(p, 24))  // token='%'
+            &&
+            (b = factor_rule(p))  // factor
+        )
+        {
+            D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '%' factor"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_BinOp ( a , Mod , b , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '%' factor"));
+    }
+    { // term '@' factor
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '@' factor"));
+        Token * _literal;
+        expr_ty a;
+        expr_ty b;
+        if (
+            (a = term_rule(p))  // term
+            &&
+            (_literal = _PyPegen_expect_token(p, 49))  // token='@'
+            &&
+            (b = factor_rule(p))  // factor
+        )
+        {
+            D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '@' factor"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = CHECK_VERSION ( expr_ty , 5 , "The '@' operator is" , _PyAST_BinOp ( a , MatMult , b , EXTRA ) );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '@' factor"));
+    }
+    { // factor
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "factor"));
+        expr_ty factor_var;
+        if (
+            (factor_var = factor_rule(p))  // factor
+        )
+        {
+            D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "factor"));
+            _res = factor_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "factor"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// factor: '+' factor | '-' factor | '~' factor | power
+static expr_ty
+factor_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    if (_PyPegen_is_memoized(p, factor_type, &_res)) {
+        p->level--;
+        return _res;
+    }
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // '+' factor
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+' factor"));
+        Token * _literal;
+        expr_ty a;
+        if (
+            (_literal = _PyPegen_expect_token(p, 14))  // token='+'
+            &&
+            (a = factor_rule(p))  // factor
+        )
+        {
+            D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+' factor"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_UnaryOp ( UAdd , a , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+' factor"));
+    }
+    { // '-' factor
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-' factor"));
+        Token * _literal;
+        expr_ty a;
+        if (
+            (_literal = _PyPegen_expect_token(p, 15))  // token='-'
+            &&
+            (a = factor_rule(p))  // factor
+        )
+        {
+            D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-' factor"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_UnaryOp ( USub , a , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-' factor"));
+    }
+    { // '~' factor
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'~' factor"));
+        Token * _literal;
+        expr_ty a;
+        if (
+            (_literal = _PyPegen_expect_token(p, 31))  // token='~'
+            &&
+            (a = factor_rule(p))  // factor
+        )
+        {
+            D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'~' factor"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_UnaryOp ( Invert , a , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'~' factor"));
+    }
+    { // power
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "power"));
+        expr_ty power_var;
+        if (
+            (power_var = power_rule(p))  // power
+        )
+        {
+            D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "power"));
+            _res = power_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "power"));
+    }
+    _res = NULL;
+  done:
+    _PyPegen_insert_memo(p, _mark, factor_type, _res);
+    p->level--;
+    return _res;
+}
+
+// power: await_primary '**' factor | await_primary
+static expr_ty
+power_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // await_primary '**' factor
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor"));
+        Token * _literal;
+        expr_ty a;
+        expr_ty b;
+        if (
+            (a = await_primary_rule(p))  // await_primary
+            &&
+            (_literal = _PyPegen_expect_token(p, 35))  // token='**'
+            &&
+            (b = factor_rule(p))  // factor
+        )
+        {
+            D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_BinOp ( a , Pow , b , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary '**' factor"));
+    }
+    { // await_primary
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary"));
+        expr_ty await_primary_var;
+        if (
+            (await_primary_var = await_primary_rule(p))  // await_primary
+        )
+        {
+            D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary"));
+            _res = await_primary_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// await_primary: AWAIT primary | primary
+static expr_ty
+await_primary_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    if (_PyPegen_is_memoized(p, await_primary_type, &_res)) {
+        p->level--;
+        return _res;
+    }
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // AWAIT primary
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "AWAIT primary"));
+        expr_ty a;
+        Token * await_var;
+        if (
+            (await_var = _PyPegen_expect_token(p, AWAIT))  // token='AWAIT'
+            &&
+            (a = primary_rule(p))  // primary
+        )
+        {
+            D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "AWAIT primary"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = CHECK_VERSION ( expr_ty , 5 , "Await expressions are" , _PyAST_Await ( a , EXTRA ) );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "AWAIT primary"));
+    }
+    { // primary
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary"));
+        expr_ty primary_var;
+        if (
+            (primary_var = primary_rule(p))  // primary
+        )
+        {
+            D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary"));
+            _res = primary_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary"));
+    }
+    _res = NULL;
+  done:
+    _PyPegen_insert_memo(p, _mark, await_primary_type, _res);
+    p->level--;
+    return _res;
+}
+
+// Left-recursive
+// primary:
+//     | primary '.' NAME
+//     | primary genexp
+//     | primary '(' arguments? ')'
+//     | primary '[' slices ']'
+//     | atom
+static expr_ty primary_raw(Parser *);
+static expr_ty
+primary_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    expr_ty _res = NULL;
+    if (_PyPegen_is_memoized(p, primary_type, &_res)) {
+        p->level--;
+        return _res;
+    }
+    int _mark = p->mark;
+    int _resmark = p->mark;
+    while (1) {
+        int tmpvar_8 = _PyPegen_update_memo(p, _mark, primary_type, _res);
+        if (tmpvar_8) {
+            p->level--;
+            return _res;
+        }
+        p->mark = _mark;
+        void *_raw = primary_raw(p);
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        if (_raw == NULL || p->mark <= _resmark)
+            break;
+        _resmark = p->mark;
+        _res = _raw;
+    }
+    p->mark = _resmark;
+    p->level--;
+    return _res;
+}
+static expr_ty
+primary_raw(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // primary '.' NAME
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '.' NAME"));
+        Token * _literal;
+        expr_ty a;
+        expr_ty b;
+        if (
+            (a = primary_rule(p))  // primary
+            &&
+            (_literal = _PyPegen_expect_token(p, 23))  // token='.'
+            &&
+            (b = _PyPegen_name_token(p))  // NAME
+        )
+        {
+            D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '.' NAME"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Attribute ( a , b -> v . Name . id , Load , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '.' NAME"));
+    }
+    { // primary genexp
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary genexp"));
+        expr_ty a;
+        expr_ty b;
+        if (
+            (a = primary_rule(p))  // primary
+            &&
+            (b = genexp_rule(p))  // genexp
+        )
+        {
+            D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary genexp"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Call ( a , CHECK ( asdl_expr_seq * , ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary genexp"));
+    }
+    { // primary '(' arguments? ')'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'"));
+        Token * _literal;
+        Token * _literal_1;
+        expr_ty a;
+        void *b;
+        if (
+            (a = primary_rule(p))  // primary
+            &&
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+            &&
+            (b = arguments_rule(p), !p->error_indicator)  // arguments?
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
+        )
+        {
+            D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '(' arguments? ')'"));
+    }
+    { // primary '[' slices ']'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'"));
+        Token * _literal;
+        Token * _literal_1;
+        expr_ty a;
+        expr_ty b;
+        if (
+            (a = primary_rule(p))  // primary
+            &&
+            (_literal = _PyPegen_expect_token(p, 9))  // token='['
+            &&
+            (b = slices_rule(p))  // slices
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 10))  // token=']'
+        )
+        {
+            D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Subscript ( a , b , Load , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '[' slices ']'"));
+    }
+    { // atom
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom"));
+        expr_ty atom_var;
+        if (
+            (atom_var = atom_rule(p))  // atom
+        )
+        {
+            D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom"));
+            _res = atom_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// slices: slice !',' | ','.slice+ ','?
+static expr_ty
+slices_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // slice !','
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice !','"));
+        expr_ty a;
+        if (
+            (a = slice_rule(p))  // slice
+            &&
+            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12)  // token=','
+        )
+        {
+            D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice !','"));
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice !','"));
+    }
+    { // ','.slice+ ','?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.slice+ ','?"));
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        asdl_expr_seq* a;
+        if (
+            (a = (asdl_expr_seq*)_gather_108_rule(p))  // ','.slice+
+            &&
+            (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator)  // ','?
+        )
+        {
+            D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.slice+ ','?"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Tuple ( a , Load , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.slice+ ','?"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// slice: expression? ':' expression? [':' expression?] | named_expression
+static expr_ty
+slice_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // expression? ':' expression? [':' expression?]
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]"));
+        Token * _literal;
+        void *a;
+        void *b;
+        void *c;
+        if (
+            (a = expression_rule(p), !p->error_indicator)  // expression?
+            &&
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (b = expression_rule(p), !p->error_indicator)  // expression?
+            &&
+            (c = _tmp_110_rule(p), !p->error_indicator)  // [':' expression?]
+        )
+        {
+            D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Slice ( a , b , c , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression? ':' expression? [':' expression?]"));
+    }
+    { // named_expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression"));
+        expr_ty a;
+        if (
+            (a = named_expression_rule(p))  // named_expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression"));
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// atom:
+//     | NAME
+//     | 'True'
+//     | 'False'
+//     | 'None'
+//     | &STRING strings
+//     | NUMBER
+//     | &'(' (tuple | group | genexp)
+//     | &'[' (list | listcomp)
+//     | &'{' (dict | set | dictcomp | setcomp)
+//     | '...'
+static expr_ty
+atom_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // NAME
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
+        expr_ty name_var;
+        if (
+            (name_var = _PyPegen_name_token(p))  // NAME
+        )
+        {
+            D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
+            _res = name_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
+    }
+    { // 'True'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'"));
+        Token * _keyword;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 524))  // token='True'
+        )
+        {
+            D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Constant ( Py_True , NULL , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'"));
+    }
+    { // 'False'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'"));
+        Token * _keyword;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 525))  // token='False'
+        )
+        {
+            D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Constant ( Py_False , NULL , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'"));
+    }
+    { // 'None'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'"));
+        Token * _keyword;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 523))  // token='None'
+        )
+        {
+            D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Constant ( Py_None , NULL , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'"));
+    }
+    { // &STRING strings
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&STRING strings"));
+        expr_ty strings_var;
+        if (
+            _PyPegen_lookahead(1, _PyPegen_string_token, p)
+            &&
+            (strings_var = strings_rule(p))  // strings
+        )
+        {
+            D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&STRING strings"));
+            _res = strings_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&STRING strings"));
+    }
+    { // NUMBER
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER"));
+        expr_ty number_var;
+        if (
+            (number_var = _PyPegen_number_token(p))  // NUMBER
+        )
+        {
+            D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER"));
+            _res = number_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER"));
+    }
+    { // &'(' (tuple | group | genexp)
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)"));
+        void *_tmp_111_var;
+        if (
+            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7)  // token='('
+            &&
+            (_tmp_111_var = _tmp_111_rule(p))  // tuple | group | genexp
+        )
+        {
+            D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)"));
+            _res = _tmp_111_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'(' (tuple | group | genexp)"));
+    }
+    { // &'[' (list | listcomp)
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)"));
+        void *_tmp_112_var;
+        if (
+            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9)  // token='['
+            &&
+            (_tmp_112_var = _tmp_112_rule(p))  // list | listcomp
+        )
+        {
+            D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)"));
+            _res = _tmp_112_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'[' (list | listcomp)"));
+    }
+    { // &'{' (dict | set | dictcomp | setcomp)
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)"));
+        void *_tmp_113_var;
+        if (
+            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25)  // token='{'
+            &&
+            (_tmp_113_var = _tmp_113_rule(p))  // dict | set | dictcomp | setcomp
+        )
+        {
+            D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)"));
+            _res = _tmp_113_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)"));
+    }
+    { // '...'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 52))  // token='...'
+        )
+        {
+            D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Constant ( Py_Ellipsis , NULL , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// strings: STRING+
+static expr_ty
+strings_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    if (_PyPegen_is_memoized(p, strings_type, &_res)) {
+        p->level--;
+        return _res;
+    }
+    int _mark = p->mark;
+    { // STRING+
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> strings[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING+"));
+        asdl_seq * a;
+        if (
+            (a = _loop1_114_rule(p))  // STRING+
+        )
+        {
+            D(fprintf(stderr, "%*c+ strings[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "STRING+"));
+            _res = _PyPegen_concatenate_strings ( p , a );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s strings[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING+"));
+    }
+    _res = NULL;
+  done:
+    _PyPegen_insert_memo(p, _mark, strings_type, _res);
+    p->level--;
+    return _res;
+}
+
+// list: '[' star_named_expressions? ']'
+static expr_ty
+list_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // '[' star_named_expressions? ']'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> list[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'"));
+        Token * _literal;
+        Token * _literal_1;
+        void *a;
+        if (
+            (_literal = _PyPegen_expect_token(p, 9))  // token='['
+            &&
+            (a = star_named_expressions_rule(p), !p->error_indicator)  // star_named_expressions?
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 10))  // token=']'
+        )
+        {
+            D(fprintf(stderr, "%*c+ list[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_List ( a , Load , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s list[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_named_expressions? ']'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// listcomp: '[' named_expression for_if_clauses ']' | invalid_comprehension
+static expr_ty
+listcomp_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // '[' named_expression for_if_clauses ']'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' named_expression for_if_clauses ']'"));
+        Token * _literal;
+        Token * _literal_1;
+        expr_ty a;
+        asdl_comprehension_seq* b;
+        if (
+            (_literal = _PyPegen_expect_token(p, 9))  // token='['
+            &&
+            (a = named_expression_rule(p))  // named_expression
+            &&
+            (b = for_if_clauses_rule(p))  // for_if_clauses
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 10))  // token=']'
+        )
+        {
+            D(fprintf(stderr, "%*c+ listcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' named_expression for_if_clauses ']'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_ListComp ( a , b , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' named_expression for_if_clauses ']'"));
+    }
+    if (p->call_invalid_rules) { // invalid_comprehension
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
+        void *invalid_comprehension_var;
+        if (
+            (invalid_comprehension_var = invalid_comprehension_rule(p))  // invalid_comprehension
+        )
+        {
+            D(fprintf(stderr, "%*c+ listcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
+            _res = invalid_comprehension_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// tuple: '(' [star_named_expression ',' star_named_expressions?] ')'
+static expr_ty
+tuple_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // '(' [star_named_expression ',' star_named_expressions?] ')'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> tuple[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
+        Token * _literal;
+        Token * _literal_1;
+        void *a;
+        if (
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+            &&
+            (a = _tmp_115_rule(p), !p->error_indicator)  // [star_named_expression ',' star_named_expressions?]
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
+        )
+        {
+            D(fprintf(stderr, "%*c+ tuple[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Tuple ( a , Load , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s tuple[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// group: '(' (yield_expr | named_expression) ')' | invalid_group
+static expr_ty
+group_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    { // '(' (yield_expr | named_expression) ')'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
+        Token * _literal;
+        Token * _literal_1;
+        void *a;
+        if (
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+            &&
+            (a = _tmp_116_rule(p))  // yield_expr | named_expression
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
+        )
+        {
+            D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
+    }
+    if (p->call_invalid_rules) { // invalid_group
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_group"));
+        void *invalid_group_var;
+        if (
+            (invalid_group_var = invalid_group_rule(p))  // invalid_group
+        )
+        {
+            D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_group"));
+            _res = invalid_group_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_group"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// genexp:
+//     | '(' (assignment_expression | expression !':=') for_if_clauses ')'
+//     | invalid_comprehension
+static expr_ty
+genexp_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // '(' (assignment_expression | expression !':=') for_if_clauses ')'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' (assignment_expression | expression !':=') for_if_clauses ')'"));
+        Token * _literal;
+        Token * _literal_1;
+        void *a;
+        asdl_comprehension_seq* b;
+        if (
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+            &&
+            (a = _tmp_117_rule(p))  // assignment_expression | expression !':='
+            &&
+            (b = for_if_clauses_rule(p))  // for_if_clauses
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
+        )
+        {
+            D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' (assignment_expression | expression !':=') for_if_clauses ')'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_GeneratorExp ( a , b , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' (assignment_expression | expression !':=') for_if_clauses ')'"));
+    }
+    if (p->call_invalid_rules) { // invalid_comprehension
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
+        void *invalid_comprehension_var;
+        if (
+            (invalid_comprehension_var = invalid_comprehension_rule(p))  // invalid_comprehension
+        )
+        {
+            D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
+            _res = invalid_comprehension_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// set: '{' star_named_expressions '}'
+static expr_ty
+set_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // '{' star_named_expressions '}'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> set[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' star_named_expressions '}'"));
+        Token * _literal;
+        Token * _literal_1;
+        asdl_expr_seq* a;
+        if (
+            (_literal = _PyPegen_expect_token(p, 25))  // token='{'
+            &&
+            (a = star_named_expressions_rule(p))  // star_named_expressions
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 26))  // token='}'
+        )
+        {
+            D(fprintf(stderr, "%*c+ set[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' star_named_expressions '}'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Set ( a , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s set[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' star_named_expressions '}'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// setcomp: '{' named_expression for_if_clauses '}' | invalid_comprehension
+static expr_ty
+setcomp_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // '{' named_expression for_if_clauses '}'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' named_expression for_if_clauses '}'"));
+        Token * _literal;
+        Token * _literal_1;
+        expr_ty a;
+        asdl_comprehension_seq* b;
+        if (
+            (_literal = _PyPegen_expect_token(p, 25))  // token='{'
+            &&
+            (a = named_expression_rule(p))  // named_expression
+            &&
+            (b = for_if_clauses_rule(p))  // for_if_clauses
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 26))  // token='}'
+        )
+        {
+            D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' named_expression for_if_clauses '}'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_SetComp ( a , b , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' named_expression for_if_clauses '}'"));
+    }
+    if (p->call_invalid_rules) { // invalid_comprehension
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
+        void *invalid_comprehension_var;
+        if (
+            (invalid_comprehension_var = invalid_comprehension_rule(p))  // invalid_comprehension
+        )
+        {
+            D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
+            _res = invalid_comprehension_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// dict: '{' double_starred_kvpairs? '}' | '{' invalid_double_starred_kvpairs '}'
+static expr_ty
+dict_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // '{' double_starred_kvpairs? '}'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> dict[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
+        Token * _literal;
+        Token * _literal_1;
+        void *a;
+        if (
+            (_literal = _PyPegen_expect_token(p, 25))  // token='{'
+            &&
+            (a = double_starred_kvpairs_rule(p), !p->error_indicator)  // double_starred_kvpairs?
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 26))  // token='}'
+        )
+        {
+            D(fprintf(stderr, "%*c+ dict[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Dict ( CHECK ( asdl_expr_seq * , _PyPegen_get_keys ( p , a ) ) , CHECK ( asdl_expr_seq * , _PyPegen_get_values ( p , a ) ) , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s dict[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
+    }
+    { // '{' invalid_double_starred_kvpairs '}'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> dict[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' invalid_double_starred_kvpairs '}'"));
+        Token * _literal;
+        Token * _literal_1;
+        void *invalid_double_starred_kvpairs_var;
+        if (
+            (_literal = _PyPegen_expect_token(p, 25))  // token='{'
+            &&
+            (invalid_double_starred_kvpairs_var = invalid_double_starred_kvpairs_rule(p))  // invalid_double_starred_kvpairs
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 26))  // token='}'
+        )
+        {
+            D(fprintf(stderr, "%*c+ dict[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' invalid_double_starred_kvpairs '}'"));
+            _res = _PyPegen_dummy_name(p, _literal, invalid_double_starred_kvpairs_var, _literal_1);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s dict[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' invalid_double_starred_kvpairs '}'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// dictcomp: '{' kvpair for_if_clauses '}' | invalid_dict_comprehension
+static expr_ty
+dictcomp_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // '{' kvpair for_if_clauses '}'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
+        Token * _literal;
+        Token * _literal_1;
+        KeyValuePair* a;
+        asdl_comprehension_seq* b;
+        if (
+            (_literal = _PyPegen_expect_token(p, 25))  // token='{'
+            &&
+            (a = kvpair_rule(p))  // kvpair
+            &&
+            (b = for_if_clauses_rule(p))  // for_if_clauses
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 26))  // token='}'
+        )
+        {
+            D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_DictComp ( a -> key , a -> value , b , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
+    }
+    if (p->call_invalid_rules) { // invalid_dict_comprehension
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension"));
+        void *invalid_dict_comprehension_var;
+        if (
+            (invalid_dict_comprehension_var = invalid_dict_comprehension_rule(p))  // invalid_dict_comprehension
+        )
+        {
+            D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension"));
+            _res = invalid_dict_comprehension_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_dict_comprehension"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// double_starred_kvpairs: ','.double_starred_kvpair+ ','?
+static asdl_seq*
+double_starred_kvpairs_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq* _res = NULL;
+    int _mark = p->mark;
+    { // ','.double_starred_kvpair+ ','?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> double_starred_kvpairs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?"));
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        asdl_seq * a;
+        if (
+            (a = _gather_118_rule(p))  // ','.double_starred_kvpair+
+            &&
+            (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator)  // ','?
+        )
+        {
+            D(fprintf(stderr, "%*c+ double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?"));
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s double_starred_kvpairs[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.double_starred_kvpair+ ','?"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// double_starred_kvpair: '**' bitwise_or | kvpair
+static KeyValuePair*
+double_starred_kvpair_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    KeyValuePair* _res = NULL;
+    int _mark = p->mark;
+    { // '**' bitwise_or
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or"));
+        Token * _literal;
+        expr_ty a;
+        if (
+            (_literal = _PyPegen_expect_token(p, 35))  // token='**'
+            &&
+            (a = bitwise_or_rule(p))  // bitwise_or
+        )
+        {
+            D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or"));
+            _res = _PyPegen_key_value_pair ( p , NULL , a );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' bitwise_or"));
+    }
+    { // kvpair
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kvpair"));
+        KeyValuePair* kvpair_var;
+        if (
+            (kvpair_var = kvpair_rule(p))  // kvpair
+        )
+        {
+            D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kvpair"));
+            _res = kvpair_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kvpair"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// kvpair: expression ':' expression
+static KeyValuePair*
+kvpair_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    KeyValuePair* _res = NULL;
+    int _mark = p->mark;
+    { // expression ':' expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
+        Token * _literal;
+        expr_ty a;
+        expr_ty b;
+        if (
+            (a = expression_rule(p))  // expression
+            &&
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (b = expression_rule(p))  // expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
+            _res = _PyPegen_key_value_pair ( p , a , b );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s kvpair[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// for_if_clauses: for_if_clause+
+static asdl_comprehension_seq*
+for_if_clauses_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_comprehension_seq* _res = NULL;
+    int _mark = p->mark;
+    { // for_if_clause+
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> for_if_clauses[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause+"));
+        asdl_comprehension_seq* a;
+        if (
+            (a = (asdl_comprehension_seq*)_loop1_120_rule(p))  // for_if_clause+
+        )
+        {
+            D(fprintf(stderr, "%*c+ for_if_clauses[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "for_if_clause+"));
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s for_if_clauses[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause+"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// for_if_clause:
+//     | ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
+//     | 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
+//     | invalid_for_target
+static comprehension_ty
+for_if_clause_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    comprehension_ty _res = NULL;
+    int _mark = p->mark;
+    { // ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
+        int _cut_var = 0;
+        Token * _keyword;
+        Token * _keyword_1;
+        expr_ty a;
+        Token * async_var;
+        expr_ty b;
+        asdl_expr_seq* c;
+        if (
+            (async_var = _PyPegen_expect_token(p, ASYNC))  // token='ASYNC'
+            &&
+            (_keyword = _PyPegen_expect_token(p, 517))  // token='for'
+            &&
+            (a = star_targets_rule(p))  // star_targets
+            &&
+            (_keyword_1 = _PyPegen_expect_token(p, 518))  // token='in'
+            &&
+            (_cut_var = 1)
+            &&
+            (b = disjunction_rule(p))  // disjunction
+            &&
+            (c = (asdl_expr_seq*)_loop0_121_rule(p))  // (('if' disjunction))*
+        )
+        {
+            D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
+            _res = CHECK_VERSION ( comprehension_ty , 6 , "Async comprehensions are" , _PyAST_comprehension ( a , b , c , 1 , p -> arena ) );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
+        if (_cut_var) {
+            p->level--;
+            return NULL;
+        }
+    }
+    { // 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
+        int _cut_var = 0;
+        Token * _keyword;
+        Token * _keyword_1;
+        expr_ty a;
+        expr_ty b;
+        asdl_expr_seq* c;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 517))  // token='for'
+            &&
+            (a = star_targets_rule(p))  // star_targets
+            &&
+            (_keyword_1 = _PyPegen_expect_token(p, 518))  // token='in'
+            &&
+            (_cut_var = 1)
+            &&
+            (b = disjunction_rule(p))  // disjunction
+            &&
+            (c = (asdl_expr_seq*)_loop0_122_rule(p))  // (('if' disjunction))*
+        )
+        {
+            D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
+            _res = _PyAST_comprehension ( a , b , c , 0 , p -> arena );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
+        if (_cut_var) {
+            p->level--;
+            return NULL;
+        }
+    }
+    if (p->call_invalid_rules) { // invalid_for_target
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
+        void *invalid_for_target_var;
+        if (
+            (invalid_for_target_var = invalid_for_target_rule(p))  // invalid_for_target
+        )
+        {
+            D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
+            _res = invalid_for_target_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_for_target"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// yield_expr: 'yield' 'from' expression | 'yield' star_expressions?
+static expr_ty
+yield_expr_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // 'yield' 'from' expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression"));
+        Token * _keyword;
+        Token * _keyword_1;
+        expr_ty a;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 504))  // token='yield'
+            &&
+            (_keyword_1 = _PyPegen_expect_token(p, 514))  // token='from'
+            &&
+            (a = expression_rule(p))  // expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_YieldFrom ( a , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' 'from' expression"));
+    }
+    { // 'yield' star_expressions?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?"));
+        Token * _keyword;
+        void *a;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 504))  // token='yield'
+            &&
+            (a = star_expressions_rule(p), !p->error_indicator)  // star_expressions?
+        )
+        {
+            D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Yield ( a , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' star_expressions?"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// arguments: args ','? &')' | invalid_arguments
+static expr_ty
+arguments_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    if (_PyPegen_is_memoized(p, arguments_type, &_res)) {
+        p->level--;
+        return _res;
+    }
+    int _mark = p->mark;
+    { // args ','? &')'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ','? &')'"));
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        expr_ty a;
+        if (
+            (a = args_rule(p))  // args
+            &&
+            (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator)  // ','?
+            &&
+            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)  // token=')'
+        )
+        {
+            D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ','? &')'"));
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ','? &')'"));
+    }
+    if (p->call_invalid_rules) { // invalid_arguments
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_arguments"));
+        void *invalid_arguments_var;
+        if (
+            (invalid_arguments_var = invalid_arguments_rule(p))  // invalid_arguments
+        )
+        {
+            D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_arguments"));
+            _res = invalid_arguments_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_arguments"));
+    }
+    _res = NULL;
+  done:
+    _PyPegen_insert_memo(p, _mark, arguments_type, _res);
+    p->level--;
+    return _res;
+}
+
+// args:
+//     | ','.(starred_expression | (assignment_expression | expression !':=') !'=')+ [',' kwargs]
+//     | kwargs
+static expr_ty
+args_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // ','.(starred_expression | (assignment_expression | expression !':=') !'=')+ [',' kwargs]
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.(starred_expression | (assignment_expression | expression !':=') !'=')+ [',' kwargs]"));
+        asdl_expr_seq* a;
+        void *b;
+        if (
+            (a = (asdl_expr_seq*)_gather_123_rule(p))  // ','.(starred_expression | (assignment_expression | expression !':=') !'=')+
+            &&
+            (b = _tmp_125_rule(p), !p->error_indicator)  // [',' kwargs]
+        )
+        {
+            D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.(starred_expression | (assignment_expression | expression !':=') !'=')+ [',' kwargs]"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyPegen_collect_call_seqs ( p , a , b , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.(starred_expression | (assignment_expression | expression !':=') !'=')+ [',' kwargs]"));
+    }
+    { // kwargs
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwargs"));
+        asdl_seq* a;
+        if (
+            (a = kwargs_rule(p))  // kwargs
+        )
+        {
+            D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwargs"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Call ( _PyPegen_dummy_name ( p ) , CHECK_NULL_ALLOWED ( asdl_expr_seq * , _PyPegen_seq_extract_starred_exprs ( p , a ) ) , CHECK_NULL_ALLOWED ( asdl_keyword_seq * , _PyPegen_seq_delete_starred_exprs ( p , a ) ) , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwargs"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// kwargs:
+//     | ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+
+//     | ','.kwarg_or_starred+
+//     | ','.kwarg_or_double_starred+
+static asdl_seq*
+kwargs_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq* _res = NULL;
+    int _mark = p->mark;
+    { // ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
+        Token * _literal;
+        asdl_seq * a;
+        asdl_seq * b;
+        if (
+            (a = _gather_126_rule(p))  // ','.kwarg_or_starred+
+            &&
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (b = _gather_128_rule(p))  // ','.kwarg_or_double_starred+
+        )
+        {
+            D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
+            _res = _PyPegen_join_sequences ( p , a , b );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
+    }
+    { // ','.kwarg_or_starred+
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+"));
+        asdl_seq * _gather_130_var;
+        if (
+            (_gather_130_var = _gather_130_rule(p))  // ','.kwarg_or_starred+
+        )
+        {
+            D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+"));
+            _res = _gather_130_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+"));
+    }
+    { // ','.kwarg_or_double_starred+
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+"));
+        asdl_seq * _gather_132_var;
+        if (
+            (_gather_132_var = _gather_132_rule(p))  // ','.kwarg_or_double_starred+
+        )
+        {
+            D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+"));
+            _res = _gather_132_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_double_starred+"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// starred_expression: '*' expression
+static expr_ty
+starred_expression_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // '*' expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> starred_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression"));
+        Token * _literal;
+        expr_ty a;
+        if (
+            (_literal = _PyPegen_expect_token(p, 16))  // token='*'
+            &&
+            (a = expression_rule(p))  // expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ starred_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Starred ( a , Load , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s starred_expression[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// kwarg_or_starred: invalid_kwarg | NAME '=' expression | starred_expression
+static KeywordOrStarred*
+kwarg_or_starred_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    KeywordOrStarred* _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    if (p->call_invalid_rules) { // invalid_kwarg
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
+        void *invalid_kwarg_var;
+        if (
+            (invalid_kwarg_var = invalid_kwarg_rule(p))  // invalid_kwarg
+        )
+        {
+            D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
+            _res = invalid_kwarg_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg"));
+    }
+    { // NAME '=' expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
+        Token * _literal;
+        expr_ty a;
+        expr_ty b;
+        if (
+            (a = _PyPegen_name_token(p))  // NAME
+            &&
+            (_literal = _PyPegen_expect_token(p, 22))  // token='='
+            &&
+            (b = expression_rule(p))  // expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyPegen_keyword_or_starred ( p , CHECK ( keyword_ty , _PyAST_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression"));
+    }
+    { // starred_expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression"));
+        expr_ty a;
+        if (
+            (a = starred_expression_rule(p))  // starred_expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression"));
+            _res = _PyPegen_keyword_or_starred ( p , a , 0 );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// kwarg_or_double_starred: invalid_kwarg | NAME '=' expression | '**' expression
+static KeywordOrStarred*
+kwarg_or_double_starred_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    KeywordOrStarred* _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    if (p->call_invalid_rules) { // invalid_kwarg
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
+        void *invalid_kwarg_var;
+        if (
+            (invalid_kwarg_var = invalid_kwarg_rule(p))  // invalid_kwarg
+        )
+        {
+            D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
+            _res = invalid_kwarg_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg"));
+    }
+    { // NAME '=' expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
+        Token * _literal;
+        expr_ty a;
+        expr_ty b;
+        if (
+            (a = _PyPegen_name_token(p))  // NAME
+            &&
+            (_literal = _PyPegen_expect_token(p, 22))  // token='='
+            &&
+            (b = expression_rule(p))  // expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyPegen_keyword_or_starred ( p , CHECK ( keyword_ty , _PyAST_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression"));
+    }
+    { // '**' expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression"));
+        Token * _literal;
+        expr_ty a;
+        if (
+            (_literal = _PyPegen_expect_token(p, 35))  // token='**'
+            &&
+            (a = expression_rule(p))  // expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyPegen_keyword_or_starred ( p , CHECK ( keyword_ty , _PyAST_keyword ( NULL , a , EXTRA ) ) , 1 );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// star_targets: star_target !',' | star_target ((',' star_target))* ','?
+static expr_ty
+star_targets_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // star_target !','
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target !','"));
+        expr_ty a;
+        if (
+            (a = star_target_rule(p))  // star_target
+            &&
+            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12)  // token=','
+        )
+        {
+            D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target !','"));
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target !','"));
+    }
+    { // star_target ((',' star_target))* ','?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?"));
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        expr_ty a;
+        asdl_seq * b;
+        if (
+            (a = star_target_rule(p))  // star_target
+            &&
+            (b = _loop0_134_rule(p))  // ((',' star_target))*
+            &&
+            (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator)  // ','?
+        )
+        {
+            D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , a , b ) ) , Store , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target ((',' star_target))* ','?"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// star_targets_list_seq: ','.star_target+ ','?
+static asdl_expr_seq*
+star_targets_list_seq_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_expr_seq* _res = NULL;
+    int _mark = p->mark;
+    { // ','.star_target+ ','?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> star_targets_list_seq[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?"));
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        asdl_expr_seq* a;
+        if (
+            (a = (asdl_expr_seq*)_gather_135_rule(p))  // ','.star_target+
+            &&
+            (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator)  // ','?
+        )
+        {
+            D(fprintf(stderr, "%*c+ star_targets_list_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?"));
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s star_targets_list_seq[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_target+ ','?"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// star_targets_tuple_seq: star_target ((',' star_target))+ ','? | star_target ','
+static asdl_expr_seq*
+star_targets_tuple_seq_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_expr_seq* _res = NULL;
+    int _mark = p->mark;
+    { // star_target ((',' star_target))+ ','?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> star_targets_tuple_seq[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))+ ','?"));
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        expr_ty a;
+        asdl_seq * b;
+        if (
+            (a = star_target_rule(p))  // star_target
+            &&
+            (b = _loop1_137_rule(p))  // ((',' star_target))+
+            &&
+            (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator)  // ','?
+        )
+        {
+            D(fprintf(stderr, "%*c+ star_targets_tuple_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))+ ','?"));
+            _res = ( asdl_expr_seq * ) _PyPegen_seq_insert_in_front ( p , a , b );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s star_targets_tuple_seq[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target ((',' star_target))+ ','?"));
+    }
+    { // star_target ','
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> star_targets_tuple_seq[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target ','"));
+        Token * _literal;
+        expr_ty a;
+        if (
+            (a = star_target_rule(p))  // star_target
+            &&
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+        )
+        {
+            D(fprintf(stderr, "%*c+ star_targets_tuple_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target ','"));
+            _res = ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , a );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s star_targets_tuple_seq[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target ','"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// star_target: '*' (!'*' star_target) | target_with_star_atom
+static expr_ty
+star_target_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    if (_PyPegen_is_memoized(p, star_target_type, &_res)) {
+        p->level--;
+        return _res;
+    }
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // '*' (!'*' star_target)
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)"));
+        Token * _literal;
+        void *a;
+        if (
+            (_literal = _PyPegen_expect_token(p, 16))  // token='*'
+            &&
+            (a = _tmp_138_rule(p))  // !'*' star_target
+        )
+        {
+            D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Starred ( CHECK ( expr_ty , _PyPegen_set_expr_context ( p , a , Store ) ) , Store , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (!'*' star_target)"));
+    }
+    { // target_with_star_atom
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "target_with_star_atom"));
+        expr_ty target_with_star_atom_var;
+        if (
+            (target_with_star_atom_var = target_with_star_atom_rule(p))  // target_with_star_atom
+        )
+        {
+            D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "target_with_star_atom"));
+            _res = target_with_star_atom_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target_with_star_atom"));
+    }
+    _res = NULL;
+  done:
+    _PyPegen_insert_memo(p, _mark, star_target_type, _res);
+    p->level--;
+    return _res;
+}
+
+// target_with_star_atom:
+//     | t_primary '.' NAME !t_lookahead
+//     | t_primary '[' slices ']' !t_lookahead
+//     | star_atom
+static expr_ty
+target_with_star_atom_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    if (_PyPegen_is_memoized(p, target_with_star_atom_type, &_res)) {
+        p->level--;
+        return _res;
+    }
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // t_primary '.' NAME !t_lookahead
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> target_with_star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
+        Token * _literal;
+        expr_ty a;
+        expr_ty b;
+        if (
+            (a = t_primary_rule(p))  // t_primary
+            &&
+            (_literal = _PyPegen_expect_token(p, 23))  // token='.'
+            &&
+            (b = _PyPegen_name_token(p))  // NAME
+            &&
+            _PyPegen_lookahead(0, t_lookahead_rule, p)
+        )
+        {
+            D(fprintf(stderr, "%*c+ target_with_star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Attribute ( a , b -> v . Name . id , Store , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s target_with_star_atom[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
+    }
+    { // t_primary '[' slices ']' !t_lookahead
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> target_with_star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
+        Token * _literal;
+        Token * _literal_1;
+        expr_ty a;
+        expr_ty b;
+        if (
+            (a = t_primary_rule(p))  // t_primary
+            &&
+            (_literal = _PyPegen_expect_token(p, 9))  // token='['
+            &&
+            (b = slices_rule(p))  // slices
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 10))  // token=']'
+            &&
+            _PyPegen_lookahead(0, t_lookahead_rule, p)
+        )
+        {
+            D(fprintf(stderr, "%*c+ target_with_star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Subscript ( a , b , Store , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s target_with_star_atom[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
+    }
+    { // star_atom
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> target_with_star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_atom"));
+        expr_ty star_atom_var;
+        if (
+            (star_atom_var = star_atom_rule(p))  // star_atom
+        )
+        {
+            D(fprintf(stderr, "%*c+ target_with_star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_atom"));
+            _res = star_atom_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s target_with_star_atom[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_atom"));
+    }
+    _res = NULL;
+  done:
+    _PyPegen_insert_memo(p, _mark, target_with_star_atom_type, _res);
+    p->level--;
+    return _res;
+}
+
+// star_atom:
+//     | NAME
+//     | '(' target_with_star_atom ')'
+//     | '(' star_targets_tuple_seq? ')'
+//     | '[' star_targets_list_seq? ']'
+static expr_ty
+star_atom_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // NAME
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
+        expr_ty a;
+        if (
+            (a = _PyPegen_name_token(p))  // NAME
+        )
+        {
+            D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
+            _res = _PyPegen_set_expr_context ( p , a , Store );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
+    }
+    { // '(' target_with_star_atom ')'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' target_with_star_atom ')'"));
+        Token * _literal;
+        Token * _literal_1;
+        expr_ty a;
+        if (
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+            &&
+            (a = target_with_star_atom_rule(p))  // target_with_star_atom
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
+        )
+        {
+            D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' target_with_star_atom ')'"));
+            _res = _PyPegen_set_expr_context ( p , a , Store );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' target_with_star_atom ')'"));
+    }
+    { // '(' star_targets_tuple_seq? ')'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' star_targets_tuple_seq? ')'"));
+        Token * _literal;
+        Token * _literal_1;
+        void *a;
+        if (
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+            &&
+            (a = star_targets_tuple_seq_rule(p), !p->error_indicator)  // star_targets_tuple_seq?
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
+        )
+        {
+            D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' star_targets_tuple_seq? ')'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Tuple ( a , Store , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' star_targets_tuple_seq? ')'"));
+    }
+    { // '[' star_targets_list_seq? ']'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_targets_list_seq? ']'"));
+        Token * _literal;
+        Token * _literal_1;
+        void *a;
+        if (
+            (_literal = _PyPegen_expect_token(p, 9))  // token='['
+            &&
+            (a = star_targets_list_seq_rule(p), !p->error_indicator)  // star_targets_list_seq?
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 10))  // token=']'
+        )
+        {
+            D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_targets_list_seq? ']'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_List ( a , Store , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_targets_list_seq? ']'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// single_target: single_subscript_attribute_target | NAME | '(' single_target ')'
+static expr_ty
+single_target_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    { // single_subscript_attribute_target
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
+        expr_ty single_subscript_attribute_target_var;
+        if (
+            (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p))  // single_subscript_attribute_target
+        )
+        {
+            D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
+            _res = single_subscript_attribute_target_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target"));
+    }
+    { // NAME
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
+        expr_ty a;
+        if (
+            (a = _PyPegen_name_token(p))  // NAME
+        )
+        {
+            D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
+            _res = _PyPegen_set_expr_context ( p , a , Store );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
+    }
+    { // '(' single_target ')'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
+        Token * _literal;
+        Token * _literal_1;
+        expr_ty a;
+        if (
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+            &&
+            (a = single_target_rule(p))  // single_target
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
+        )
+        {
+            D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// single_subscript_attribute_target:
+//     | t_primary '.' NAME !t_lookahead
+//     | t_primary '[' slices ']' !t_lookahead
+static expr_ty
+single_subscript_attribute_target_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // t_primary '.' NAME !t_lookahead
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
+        Token * _literal;
+        expr_ty a;
+        expr_ty b;
+        if (
+            (a = t_primary_rule(p))  // t_primary
+            &&
+            (_literal = _PyPegen_expect_token(p, 23))  // token='.'
+            &&
+            (b = _PyPegen_name_token(p))  // NAME
+            &&
+            _PyPegen_lookahead(0, t_lookahead_rule, p)
+        )
+        {
+            D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Attribute ( a , b -> v . Name . id , Store , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
+    }
+    { // t_primary '[' slices ']' !t_lookahead
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
+        Token * _literal;
+        Token * _literal_1;
+        expr_ty a;
+        expr_ty b;
+        if (
+            (a = t_primary_rule(p))  // t_primary
+            &&
+            (_literal = _PyPegen_expect_token(p, 9))  // token='['
+            &&
+            (b = slices_rule(p))  // slices
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 10))  // token=']'
+            &&
+            _PyPegen_lookahead(0, t_lookahead_rule, p)
+        )
+        {
+            D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Subscript ( a , b , Store , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// del_targets: ','.del_target+ ','?
+static asdl_expr_seq*
+del_targets_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_expr_seq* _res = NULL;
+    int _mark = p->mark;
+    { // ','.del_target+ ','?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> del_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?"));
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        asdl_expr_seq* a;
+        if (
+            (a = (asdl_expr_seq*)_gather_139_rule(p))  // ','.del_target+
+            &&
+            (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator)  // ','?
+        )
+        {
+            D(fprintf(stderr, "%*c+ del_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?"));
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s del_targets[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.del_target+ ','?"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// del_target:
+//     | t_primary '.' NAME !t_lookahead
+//     | t_primary '[' slices ']' !t_lookahead
+//     | del_t_atom
+static expr_ty
+del_target_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    if (_PyPegen_is_memoized(p, del_target_type, &_res)) {
+        p->level--;
+        return _res;
+    }
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // t_primary '.' NAME !t_lookahead
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
+        Token * _literal;
+        expr_ty a;
+        expr_ty b;
+        if (
+            (a = t_primary_rule(p))  // t_primary
+            &&
+            (_literal = _PyPegen_expect_token(p, 23))  // token='.'
+            &&
+            (b = _PyPegen_name_token(p))  // NAME
+            &&
+            _PyPegen_lookahead(0, t_lookahead_rule, p)
+        )
+        {
+            D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Attribute ( a , b -> v . Name . id , Del , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
+    }
+    { // t_primary '[' slices ']' !t_lookahead
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
+        Token * _literal;
+        Token * _literal_1;
+        expr_ty a;
+        expr_ty b;
+        if (
+            (a = t_primary_rule(p))  // t_primary
+            &&
+            (_literal = _PyPegen_expect_token(p, 9))  // token='['
+            &&
+            (b = slices_rule(p))  // slices
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 10))  // token=']'
+            &&
+            _PyPegen_lookahead(0, t_lookahead_rule, p)
+        )
+        {
+            D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Subscript ( a , b , Del , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
+    }
+    { // del_t_atom
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_t_atom"));
+        expr_ty del_t_atom_var;
+        if (
+            (del_t_atom_var = del_t_atom_rule(p))  // del_t_atom
+        )
+        {
+            D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_t_atom"));
+            _res = del_t_atom_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_t_atom"));
+    }
+    _res = NULL;
+  done:
+    _PyPegen_insert_memo(p, _mark, del_target_type, _res);
+    p->level--;
+    return _res;
+}
+
+// del_t_atom: NAME | '(' del_target ')' | '(' del_targets? ')' | '[' del_targets? ']'
+static expr_ty
+del_t_atom_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // NAME
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
+        expr_ty a;
+        if (
+            (a = _PyPegen_name_token(p))  // NAME
+        )
+        {
+            D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
+            _res = _PyPegen_set_expr_context ( p , a , Del );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
+    }
+    { // '(' del_target ')'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'"));
+        Token * _literal;
+        Token * _literal_1;
+        expr_ty a;
+        if (
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+            &&
+            (a = del_target_rule(p))  // del_target
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
+        )
+        {
+            D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'"));
+            _res = _PyPegen_set_expr_context ( p , a , Del );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_target ')'"));
+    }
+    { // '(' del_targets? ')'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'"));
+        Token * _literal;
+        Token * _literal_1;
+        void *a;
+        if (
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+            &&
+            (a = del_targets_rule(p), !p->error_indicator)  // del_targets?
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
+        )
+        {
+            D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Tuple ( a , Del , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_targets? ')'"));
+    }
+    { // '[' del_targets? ']'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'"));
+        Token * _literal;
+        Token * _literal_1;
+        void *a;
+        if (
+            (_literal = _PyPegen_expect_token(p, 9))  // token='['
+            &&
+            (a = del_targets_rule(p), !p->error_indicator)  // del_targets?
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 10))  // token=']'
+        )
+        {
+            D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_List ( a , Del , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' del_targets? ']'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// Left-recursive
+// t_primary:
+//     | t_primary '.' NAME &t_lookahead
+//     | t_primary '[' slices ']' &t_lookahead
+//     | t_primary genexp &t_lookahead
+//     | t_primary '(' arguments? ')' &t_lookahead
+//     | atom &t_lookahead
+static expr_ty t_primary_raw(Parser *);
+static expr_ty
+t_primary_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    expr_ty _res = NULL;
+    if (_PyPegen_is_memoized(p, t_primary_type, &_res)) {
+        p->level--;
+        return _res;
+    }
+    int _mark = p->mark;
+    int _resmark = p->mark;
+    while (1) {
+        int tmpvar_9 = _PyPegen_update_memo(p, _mark, t_primary_type, _res);
+        if (tmpvar_9) {
+            p->level--;
+            return _res;
+        }
+        p->mark = _mark;
+        void *_raw = t_primary_raw(p);
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        if (_raw == NULL || p->mark <= _resmark)
+            break;
+        _resmark = p->mark;
+        _res = _raw;
+    }
+    p->mark = _resmark;
+    p->level--;
+    return _res;
+}
+static expr_ty
+t_primary_raw(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // t_primary '.' NAME &t_lookahead
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
+        Token * _literal;
+        expr_ty a;
+        expr_ty b;
+        if (
+            (a = t_primary_rule(p))  // t_primary
+            &&
+            (_literal = _PyPegen_expect_token(p, 23))  // token='.'
+            &&
+            (b = _PyPegen_name_token(p))  // NAME
+            &&
+            _PyPegen_lookahead(1, t_lookahead_rule, p)
+        )
+        {
+            D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Attribute ( a , b -> v . Name . id , Load , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
+    }
+    { // t_primary '[' slices ']' &t_lookahead
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
+        Token * _literal;
+        Token * _literal_1;
+        expr_ty a;
+        expr_ty b;
+        if (
+            (a = t_primary_rule(p))  // t_primary
+            &&
+            (_literal = _PyPegen_expect_token(p, 9))  // token='['
+            &&
+            (b = slices_rule(p))  // slices
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 10))  // token=']'
+            &&
+            _PyPegen_lookahead(1, t_lookahead_rule, p)
+        )
+        {
+            D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Subscript ( a , b , Load , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
+    }
+    { // t_primary genexp &t_lookahead
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead"));
+        expr_ty a;
+        expr_ty b;
+        if (
+            (a = t_primary_rule(p))  // t_primary
+            &&
+            (b = genexp_rule(p))  // genexp
+            &&
+            _PyPegen_lookahead(1, t_lookahead_rule, p)
+        )
+        {
+            D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Call ( a , CHECK ( asdl_expr_seq * , ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary genexp &t_lookahead"));
+    }
+    { // t_primary '(' arguments? ')' &t_lookahead
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
+        Token * _literal;
+        Token * _literal_1;
+        expr_ty a;
+        void *b;
+        if (
+            (a = t_primary_rule(p))  // t_primary
+            &&
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+            &&
+            (b = arguments_rule(p), !p->error_indicator)  // arguments?
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
+            &&
+            _PyPegen_lookahead(1, t_lookahead_rule, p)
+        )
+        {
+            D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
+    }
+    { // atom &t_lookahead
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead"));
+        expr_ty a;
+        if (
+            (a = atom_rule(p))  // atom
+            &&
+            _PyPegen_lookahead(1, t_lookahead_rule, p)
+        )
+        {
+            D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead"));
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom &t_lookahead"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// t_lookahead: '(' | '[' | '.'
+static void *
+t_lookahead_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // '('
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+        )
+        {
+            D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('"));
+    }
+    { // '['
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 9))  // token='['
+        )
+        {
+            D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['"));
+    }
+    { // '.'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 23))  // token='.'
+        )
+        {
+            D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_arguments:
+//     | args ',' '*'
+//     | expression for_if_clauses ',' [args | expression for_if_clauses]
+//     | NAME '=' expression for_if_clauses
+//     | args for_if_clauses
+//     | args ',' expression for_if_clauses
+//     | args ',' args
+static void *
+invalid_arguments_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // args ',' '*'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' '*'"));
+        Token * _literal;
+        Token * _literal_1;
+        expr_ty a;
+        if (
+            (a = args_rule(p))  // args
+            &&
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 16))  // token='*'
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' '*'"));
+            _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "iterable argument unpacking follows keyword argument unpacking" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' '*'"));
+    }
+    { // expression for_if_clauses ',' [args | expression for_if_clauses]
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]"));
+        Token * _literal;
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        expr_ty a;
+        asdl_comprehension_seq* b;
+        if (
+            (a = expression_rule(p))  // expression
+            &&
+            (b = for_if_clauses_rule(p))  // for_if_clauses
+            &&
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (_opt_var = _tmp_141_rule(p), !p->error_indicator)  // [args | expression for_if_clauses]
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]"));
+            _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , PyPegen_last_item ( b , comprehension_ty ) -> target , "Generator expression must be parenthesized" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]"));
+    }
+    { // NAME '=' expression for_if_clauses
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression for_if_clauses"));
+        expr_ty a;
+        Token * b;
+        expr_ty expression_var;
+        asdl_comprehension_seq* for_if_clauses_var;
+        if (
+            (a = _PyPegen_name_token(p))  // NAME
+            &&
+            (b = _PyPegen_expect_token(p, 22))  // token='='
+            &&
+            (expression_var = expression_rule(p))  // expression
+            &&
+            (for_if_clauses_var = for_if_clauses_rule(p))  // for_if_clauses
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression for_if_clauses"));
+            _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "invalid syntax. Maybe you meant '==' or ':=' instead of '='?" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression for_if_clauses"));
+    }
+    { // args for_if_clauses
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args for_if_clauses"));
+        expr_ty a;
+        asdl_comprehension_seq* b;
+        if (
+            (a = args_rule(p))  // args
+            &&
+            (b = for_if_clauses_rule(p))  // for_if_clauses
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args for_if_clauses"));
+            _res = _PyPegen_nonparen_genexp_in_call ( p , a , b );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args for_if_clauses"));
+    }
+    { // args ',' expression for_if_clauses
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' expression for_if_clauses"));
+        Token * _literal;
+        expr_ty a;
+        expr_ty args_var;
+        asdl_comprehension_seq* b;
+        if (
+            (args_var = args_rule(p))  // args
+            &&
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (a = expression_rule(p))  // expression
+            &&
+            (b = for_if_clauses_rule(p))  // for_if_clauses
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' expression for_if_clauses"));
+            _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , asdl_seq_GET ( b , b -> size - 1 ) -> target , "Generator expression must be parenthesized" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' expression for_if_clauses"));
+    }
+    { // args ',' args
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' args"));
+        Token * _literal;
+        expr_ty a;
+        expr_ty args_var;
+        if (
+            (a = args_rule(p))  // args
+            &&
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (args_var = args_rule(p))  // args
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' args"));
+            _res = _PyPegen_arguments_parsing_error ( p , a );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' args"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_kwarg:
+//     | ('True' | 'False' | 'None') '='
+//     | NAME '=' expression for_if_clauses
+//     | !(NAME '=') expression '='
+static void *
+invalid_kwarg_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // ('True' | 'False' | 'None') '='
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_kwarg[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('True' | 'False' | 'None') '='"));
+        Token* a;
+        Token * b;
+        if (
+            (a = (Token*)_tmp_142_rule(p))  // 'True' | 'False' | 'None'
+            &&
+            (b = _PyPegen_expect_token(p, 22))  // token='='
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('True' | 'False' | 'None') '='"));
+            _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "cannot assign to %s" , PyBytes_AS_STRING ( a -> bytes ) );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_kwarg[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('True' | 'False' | 'None') '='"));
+    }
+    { // NAME '=' expression for_if_clauses
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_kwarg[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression for_if_clauses"));
+        expr_ty a;
+        Token * b;
+        expr_ty expression_var;
+        asdl_comprehension_seq* for_if_clauses_var;
+        if (
+            (a = _PyPegen_name_token(p))  // NAME
+            &&
+            (b = _PyPegen_expect_token(p, 22))  // token='='
+            &&
+            (expression_var = expression_rule(p))  // expression
+            &&
+            (for_if_clauses_var = for_if_clauses_rule(p))  // for_if_clauses
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression for_if_clauses"));
+            _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "invalid syntax. Maybe you meant '==' or ':=' instead of '='?" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_kwarg[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression for_if_clauses"));
+    }
+    { // !(NAME '=') expression '='
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_kwarg[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!(NAME '=') expression '='"));
+        expr_ty a;
+        Token * b;
+        if (
+            _PyPegen_lookahead(0, _tmp_143_rule, p)
+            &&
+            (a = expression_rule(p))  // expression
+            &&
+            (b = _PyPegen_expect_token(p, 22))  // token='='
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!(NAME '=') expression '='"));
+            _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "expression cannot contain assignment, perhaps you meant \"==\"?" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_kwarg[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!(NAME '=') expression '='"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// expression_without_invalid:
+//     | disjunction 'if' disjunction 'else' expression
+//     | disjunction
+//     | lambdef
+static expr_ty
+expression_without_invalid_rule(Parser *p)
+{
+    int _prev_call_invalid = p->call_invalid_rules;
+    p->call_invalid_rules = 0;
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->call_invalid_rules = _prev_call_invalid;
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+        p->error_indicator = 1;
+        p->call_invalid_rules = _prev_call_invalid;
+        p->level--;
+        return NULL;
+    }
+    int _start_lineno = p->tokens[_mark]->lineno;
+    UNUSED(_start_lineno); // Only used by EXTRA macro
+    int _start_col_offset = p->tokens[_mark]->col_offset;
+    UNUSED(_start_col_offset); // Only used by EXTRA macro
+    { // disjunction 'if' disjunction 'else' expression
+        if (p->error_indicator) {
+            p->call_invalid_rules = _prev_call_invalid;
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> expression_without_invalid[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
+        Token * _keyword;
+        Token * _keyword_1;
+        expr_ty a;
+        expr_ty b;
+        expr_ty c;
+        if (
+            (a = disjunction_rule(p))  // disjunction
+            &&
+            (_keyword = _PyPegen_expect_token(p, 510))  // token='if'
+            &&
+            (b = disjunction_rule(p))  // disjunction
+            &&
+            (_keyword_1 = _PyPegen_expect_token(p, 516))  // token='else'
+            &&
+            (c = expression_rule(p))  // expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ expression_without_invalid[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
+            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+            if (_token == NULL) {
+                p->call_invalid_rules = _prev_call_invalid;
+                p->level--;
+                return NULL;
+            }
+            int _end_lineno = _token->end_lineno;
+            UNUSED(_end_lineno); // Only used by EXTRA macro
+            int _end_col_offset = _token->end_col_offset;
+            UNUSED(_end_col_offset); // Only used by EXTRA macro
+            _res = _PyAST_IfExp ( b , a , c , EXTRA );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->call_invalid_rules = _prev_call_invalid;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s expression_without_invalid[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
+    }
+    { // disjunction
+        if (p->error_indicator) {
+            p->call_invalid_rules = _prev_call_invalid;
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> expression_without_invalid[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction"));
+        expr_ty disjunction_var;
+        if (
+            (disjunction_var = disjunction_rule(p))  // disjunction
+        )
+        {
+            D(fprintf(stderr, "%*c+ expression_without_invalid[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction"));
+            _res = disjunction_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s expression_without_invalid[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction"));
+    }
+    { // lambdef
+        if (p->error_indicator) {
+            p->call_invalid_rules = _prev_call_invalid;
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> expression_without_invalid[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambdef"));
+        expr_ty lambdef_var;
+        if (
+            (lambdef_var = lambdef_rule(p))  // lambdef
+        )
+        {
+            D(fprintf(stderr, "%*c+ expression_without_invalid[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambdef"));
+            _res = lambdef_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s expression_without_invalid[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambdef"));
+    }
+    _res = NULL;
+  done:
+    p->call_invalid_rules = _prev_call_invalid;
+    p->level--;
+    return _res;
+}
+
+// invalid_legacy_expression: NAME !'(' star_expressions
+static void *
+invalid_legacy_expression_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // NAME !'(' star_expressions
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_legacy_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME !'(' star_expressions"));
+        expr_ty a;
+        expr_ty b;
+        if (
+            (a = _PyPegen_name_token(p))  // NAME
+            &&
+            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 7)  // token='('
+            &&
+            (b = star_expressions_rule(p))  // star_expressions
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_legacy_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME !'(' star_expressions"));
+            _res = _PyPegen_check_legacy_stmt ( p , a ) ? RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "Missing parentheses in call to '%U'. Did you mean %U(...)?" , a -> v . Name . id , a -> v . Name . id ) : NULL;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_legacy_expression[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME !'(' star_expressions"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_expression:
+//     | !(NAME STRING | SOFT_KEYWORD) disjunction expression_without_invalid
+//     | disjunction 'if' disjunction !('else' | ':')
+static void *
+invalid_expression_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // !(NAME STRING | SOFT_KEYWORD) disjunction expression_without_invalid
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!(NAME STRING | SOFT_KEYWORD) disjunction expression_without_invalid"));
+        expr_ty a;
+        expr_ty b;
+        if (
+            _PyPegen_lookahead(0, _tmp_144_rule, p)
+            &&
+            (a = disjunction_rule(p))  // disjunction
+            &&
+            (b = expression_without_invalid_rule(p))  // expression_without_invalid
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!(NAME STRING | SOFT_KEYWORD) disjunction expression_without_invalid"));
+            _res = _PyPegen_check_legacy_stmt ( p , a ) ? NULL : p -> tokens [ p -> mark - 1 ] -> level == 0 ? NULL : RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "invalid syntax. Perhaps you forgot a comma?" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_expression[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!(NAME STRING | SOFT_KEYWORD) disjunction expression_without_invalid"));
+    }
+    { // disjunction 'if' disjunction !('else' | ':')
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction !('else' | ':')"));
+        Token * _keyword;
+        expr_ty a;
+        expr_ty b;
+        if (
+            (a = disjunction_rule(p))  // disjunction
+            &&
+            (_keyword = _PyPegen_expect_token(p, 510))  // token='if'
+            &&
+            (b = disjunction_rule(p))  // disjunction
+            &&
+            _PyPegen_lookahead(0, _tmp_145_rule, p)
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction !('else' | ':')"));
+            _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "expected 'else' after 'if' expression" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_expression[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction 'if' disjunction !('else' | ':')"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_named_expression:
+//     | expression ':=' expression
+//     | NAME '=' bitwise_or !('=' | ':=')
+//     | !(list | tuple | genexp | 'True' | 'None' | 'False') bitwise_or '=' bitwise_or !('=' | ':=')
+static void *
+invalid_named_expression_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    if (_PyPegen_is_memoized(p, invalid_named_expression_type, &_res)) {
+        p->level--;
+        return _res;
+    }
+    int _mark = p->mark;
+    { // expression ':=' expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':=' expression"));
+        Token * _literal;
+        expr_ty a;
+        expr_ty expression_var;
+        if (
+            (a = expression_rule(p))  // expression
+            &&
+            (_literal = _PyPegen_expect_token(p, 53))  // token=':='
+            &&
+            (expression_var = expression_rule(p))  // expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':=' expression"));
+            _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use assignment expressions with %s" , _PyPegen_get_expr_name ( a ) );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':=' expression"));
+    }
+    { // NAME '=' bitwise_or !('=' | ':=')
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' bitwise_or !('=' | ':=')"));
+        Token * _literal;
+        expr_ty a;
+        expr_ty b;
+        if (
+            (a = _PyPegen_name_token(p))  // NAME
+            &&
+            (_literal = _PyPegen_expect_token(p, 22))  // token='='
+            &&
+            (b = bitwise_or_rule(p))  // bitwise_or
+            &&
+            _PyPegen_lookahead(0, _tmp_146_rule, p)
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' bitwise_or !('=' | ':=')"));
+            _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "invalid syntax. Maybe you meant '==' or ':=' instead of '='?" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' bitwise_or !('=' | ':=')"));
+    }
+    { // !(list | tuple | genexp | 'True' | 'None' | 'False') bitwise_or '=' bitwise_or !('=' | ':=')
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!(list | tuple | genexp | 'True' | 'None' | 'False') bitwise_or '=' bitwise_or !('=' | ':=')"));
+        expr_ty a;
+        Token * b;
+        expr_ty bitwise_or_var;
+        if (
+            _PyPegen_lookahead(0, _tmp_147_rule, p)
+            &&
+            (a = bitwise_or_rule(p))  // bitwise_or
+            &&
+            (b = _PyPegen_expect_token(p, 22))  // token='='
+            &&
+            (bitwise_or_var = bitwise_or_rule(p))  // bitwise_or
+            &&
+            _PyPegen_lookahead(0, _tmp_148_rule, p)
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!(list | tuple | genexp | 'True' | 'None' | 'False') bitwise_or '=' bitwise_or !('=' | ':=')"));
+            _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot assign to %s here. Maybe you meant '==' instead of '='?" , _PyPegen_get_expr_name ( a ) );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!(list | tuple | genexp | 'True' | 'None' | 'False') bitwise_or '=' bitwise_or !('=' | ':=')"));
+    }
+    _res = NULL;
+  done:
+    _PyPegen_insert_memo(p, _mark, invalid_named_expression_type, _res);
+    p->level--;
+    return _res;
+}
+
+// invalid_assignment:
+//     | invalid_ann_assign_target ':' expression
+//     | star_named_expression ',' star_named_expressions* ':' expression
+//     | expression ':' expression
+//     | ((star_targets '='))* star_expressions '='
+//     | ((star_targets '='))* yield_expr '='
+//     | star_expressions augassign (yield_expr | star_expressions)
+static void *
+invalid_assignment_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // invalid_ann_assign_target ':' expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_ann_assign_target ':' expression"));
+        Token * _literal;
+        expr_ty a;
+        expr_ty expression_var;
+        if (
+            (a = invalid_ann_assign_target_rule(p))  // invalid_ann_assign_target
+            &&
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (expression_var = expression_rule(p))  // expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_ann_assign_target ':' expression"));
+            _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not %s) can be annotated" , _PyPegen_get_expr_name ( a ) );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_ann_assign_target ':' expression"));
+    }
+    { // star_named_expression ',' star_named_expressions* ':' expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression"));
+        Token * _literal;
+        Token * _literal_1;
+        asdl_seq * _loop0_149_var;
+        expr_ty a;
+        expr_ty expression_var;
+        if (
+            (a = star_named_expression_rule(p))  // star_named_expression
+            &&
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (_loop0_149_var = _loop0_149_rule(p))  // star_named_expressions*
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (expression_var = expression_rule(p))  // expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression"));
+            _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not tuple) can be annotated" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression"));
+    }
+    { // expression ':' expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
+        Token * _literal;
+        expr_ty a;
+        expr_ty expression_var;
+        if (
+            (a = expression_rule(p))  // expression
+            &&
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (expression_var = expression_rule(p))  // expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
+            _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "illegal target for annotation" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression"));
+    }
+    { // ((star_targets '='))* star_expressions '='
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* star_expressions '='"));
+        Token * _literal;
+        asdl_seq * _loop0_150_var;
+        expr_ty a;
+        if (
+            (_loop0_150_var = _loop0_150_rule(p))  // ((star_targets '='))*
+            &&
+            (a = star_expressions_rule(p))  // star_expressions
+            &&
+            (_literal = _PyPegen_expect_token(p, 22))  // token='='
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* star_expressions '='"));
+            _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( STAR_TARGETS , a );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))* star_expressions '='"));
+    }
+    { // ((star_targets '='))* yield_expr '='
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='"));
+        Token * _literal;
+        asdl_seq * _loop0_151_var;
+        expr_ty a;
+        if (
+            (_loop0_151_var = _loop0_151_rule(p))  // ((star_targets '='))*
+            &&
+            (a = yield_expr_rule(p))  // yield_expr
+            &&
+            (_literal = _PyPegen_expect_token(p, 22))  // token='='
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='"));
+            _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "assignment to yield expression not possible" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))* yield_expr '='"));
+    }
+    { // star_expressions augassign (yield_expr | star_expressions)
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)"));
+        void *_tmp_152_var;
+        expr_ty a;
+        AugOperator* augassign_var;
+        if (
+            (a = star_expressions_rule(p))  // star_expressions
+            &&
+            (augassign_var = augassign_rule(p))  // augassign
+            &&
+            (_tmp_152_var = _tmp_152_rule(p))  // yield_expr | star_expressions
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)"));
+            _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "'%s' is an illegal expression for augmented assignment" , _PyPegen_get_expr_name ( a ) );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_ann_assign_target: list | tuple | '(' invalid_ann_assign_target ')'
+static expr_ty
+invalid_ann_assign_target_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    expr_ty _res = NULL;
+    int _mark = p->mark;
+    { // list
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list"));
+        expr_ty list_var;
+        if (
+            (list_var = list_rule(p))  // list
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list"));
+            _res = list_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list"));
+    }
+    { // tuple
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple"));
+        expr_ty tuple_var;
+        if (
+            (tuple_var = tuple_rule(p))  // tuple
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple"));
+            _res = tuple_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple"));
+    }
+    { // '(' invalid_ann_assign_target ')'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' invalid_ann_assign_target ')'"));
+        Token * _literal;
+        Token * _literal_1;
+        expr_ty a;
+        if (
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+            &&
+            (a = invalid_ann_assign_target_rule(p))  // invalid_ann_assign_target
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' invalid_ann_assign_target ')'"));
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' invalid_ann_assign_target ')'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_del_stmt: 'del' star_expressions
+static void *
+invalid_del_stmt_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // 'del' star_expressions
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'del' star_expressions"));
+        Token * _keyword;
+        expr_ty a;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 503))  // token='del'
+            &&
+            (a = star_expressions_rule(p))  // star_expressions
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_del_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'del' star_expressions"));
+            _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( DEL_TARGETS , a );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_del_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'del' star_expressions"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_block: NEWLINE !INDENT
+static void *
+invalid_block_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // NEWLINE !INDENT
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT"));
+        Token * newline_var;
+        if (
+            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+            &&
+            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT)  // token=INDENT
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT"));
+            _res = RAISE_INDENTATION_ERROR ( "expected an indented block" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_block[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE !INDENT"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_comprehension:
+//     | ('[' | '(' | '{') starred_expression for_if_clauses
+//     | ('[' | '{') star_named_expression ',' star_named_expressions for_if_clauses
+//     | ('[' | '{') star_named_expression ',' for_if_clauses
+static void *
+invalid_comprehension_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // ('[' | '(' | '{') starred_expression for_if_clauses
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses"));
+        void *_tmp_153_var;
+        expr_ty a;
+        asdl_comprehension_seq* for_if_clauses_var;
+        if (
+            (_tmp_153_var = _tmp_153_rule(p))  // '[' | '(' | '{'
+            &&
+            (a = starred_expression_rule(p))  // starred_expression
+            &&
+            (for_if_clauses_var = for_if_clauses_rule(p))  // for_if_clauses
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses"));
+            _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "iterable unpacking cannot be used in comprehension" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_comprehension[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses"));
+    }
+    { // ('[' | '{') star_named_expression ',' star_named_expressions for_if_clauses
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '{') star_named_expression ',' star_named_expressions for_if_clauses"));
+        Token * _literal;
+        void *_tmp_154_var;
+        expr_ty a;
+        asdl_expr_seq* b;
+        asdl_comprehension_seq* for_if_clauses_var;
+        if (
+            (_tmp_154_var = _tmp_154_rule(p))  // '[' | '{'
+            &&
+            (a = star_named_expression_rule(p))  // star_named_expression
+            &&
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (b = star_named_expressions_rule(p))  // star_named_expressions
+            &&
+            (for_if_clauses_var = for_if_clauses_rule(p))  // for_if_clauses
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('[' | '{') star_named_expression ',' star_named_expressions for_if_clauses"));
+            _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , PyPegen_last_item ( b , expr_ty ) , "did you forget parentheses around the comprehension target?" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_comprehension[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('[' | '{') star_named_expression ',' star_named_expressions for_if_clauses"));
+    }
+    { // ('[' | '{') star_named_expression ',' for_if_clauses
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '{') star_named_expression ',' for_if_clauses"));
+        void *_tmp_155_var;
+        expr_ty a;
+        Token * b;
+        asdl_comprehension_seq* for_if_clauses_var;
+        if (
+            (_tmp_155_var = _tmp_155_rule(p))  // '[' | '{'
+            &&
+            (a = star_named_expression_rule(p))  // star_named_expression
+            &&
+            (b = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (for_if_clauses_var = for_if_clauses_rule(p))  // for_if_clauses
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('[' | '{') star_named_expression ',' for_if_clauses"));
+            _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "did you forget parentheses around the comprehension target?" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_comprehension[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('[' | '{') star_named_expression ',' for_if_clauses"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_dict_comprehension: '{' '**' bitwise_or for_if_clauses '}'
+static void *
+invalid_dict_comprehension_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // '{' '**' bitwise_or for_if_clauses '}'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_dict_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
+        Token * _literal;
+        Token * _literal_1;
+        Token * a;
+        expr_ty bitwise_or_var;
+        asdl_comprehension_seq* for_if_clauses_var;
+        if (
+            (_literal = _PyPegen_expect_token(p, 25))  // token='{'
+            &&
+            (a = _PyPegen_expect_token(p, 35))  // token='**'
+            &&
+            (bitwise_or_var = bitwise_or_rule(p))  // bitwise_or
+            &&
+            (for_if_clauses_var = for_if_clauses_rule(p))  // for_if_clauses
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 26))  // token='}'
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_dict_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
+            _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "dict unpacking cannot be used in dict comprehension" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_dict_comprehension[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_parameters: param_no_default* invalid_parameters_helper param_no_default
+static void *
+invalid_parameters_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // param_no_default* invalid_parameters_helper param_no_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* invalid_parameters_helper param_no_default"));
+        asdl_seq * _loop0_156_var;
+        arg_ty a;
+        void *invalid_parameters_helper_var;
+        if (
+            (_loop0_156_var = _loop0_156_rule(p))  // param_no_default*
+            &&
+            (invalid_parameters_helper_var = invalid_parameters_helper_rule(p))  // invalid_parameters_helper
+            &&
+            (a = param_no_default_rule(p))  // param_no_default
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* invalid_parameters_helper param_no_default"));
+            _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "non-default argument follows default argument" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_parameters[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* invalid_parameters_helper param_no_default"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_parameters_helper: slash_with_default | param_with_default+
+static void *
+invalid_parameters_helper_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // slash_with_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_parameters_helper[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default"));
+        SlashWithDefault* a;
+        if (
+            (a = slash_with_default_rule(p))  // slash_with_default
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_parameters_helper[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default"));
+            _res = _PyPegen_singleton_seq ( p , a );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_parameters_helper[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default"));
+    }
+    { // param_with_default+
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_parameters_helper[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+"));
+        asdl_seq * _loop1_157_var;
+        if (
+            (_loop1_157_var = _loop1_157_rule(p))  // param_with_default+
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_parameters_helper[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+"));
+            _res = _loop1_157_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_parameters_helper[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_lambda_parameters:
+//     | lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default
+static void *
+invalid_lambda_parameters_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default"));
+        asdl_seq * _loop0_158_var;
+        arg_ty a;
+        void *invalid_lambda_parameters_helper_var;
+        if (
+            (_loop0_158_var = _loop0_158_rule(p))  // lambda_param_no_default*
+            &&
+            (invalid_lambda_parameters_helper_var = invalid_lambda_parameters_helper_rule(p))  // invalid_lambda_parameters_helper
+            &&
+            (a = lambda_param_no_default_rule(p))  // lambda_param_no_default
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default"));
+            _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "non-default argument follows default argument" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_lambda_parameters_helper:
+//     | lambda_slash_with_default
+//     | lambda_param_with_default+
+static void *
+invalid_lambda_parameters_helper_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // lambda_slash_with_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_lambda_parameters_helper[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default"));
+        SlashWithDefault* a;
+        if (
+            (a = lambda_slash_with_default_rule(p))  // lambda_slash_with_default
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_lambda_parameters_helper[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default"));
+            _res = _PyPegen_singleton_seq ( p , a );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_lambda_parameters_helper[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default"));
+    }
+    { // lambda_param_with_default+
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_lambda_parameters_helper[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+"));
+        asdl_seq * _loop1_159_var;
+        if (
+            (_loop1_159_var = _loop1_159_rule(p))  // lambda_param_with_default+
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_lambda_parameters_helper[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+"));
+            _res = _loop1_159_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_lambda_parameters_helper[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_star_etc: '*' (')' | ',' (')' | '**')) | '*' ',' TYPE_COMMENT
+static void *
+invalid_star_etc_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // '*' (')' | ',' (')' | '**'))
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
+        void *_tmp_160_var;
+        Token * a;
+        if (
+            (a = _PyPegen_expect_token(p, 16))  // token='*'
+            &&
+            (_tmp_160_var = _tmp_160_rule(p))  // ')' | ',' (')' | '**')
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
+            _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "named arguments must follow bare *" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
+    }
+    { // '*' ',' TYPE_COMMENT
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT"));
+        Token * _literal;
+        Token * _literal_1;
+        Token * type_comment_var;
+        if (
+            (_literal = _PyPegen_expect_token(p, 16))  // token='*'
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT))  // token='TYPE_COMMENT'
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT"));
+            _res = RAISE_SYNTAX_ERROR ( "bare * has associated type comment" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' TYPE_COMMENT"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_lambda_star_etc: '*' (':' | ',' (':' | '**'))
+static void *
+invalid_lambda_star_etc_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // '*' (':' | ',' (':' | '**'))
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
+        Token * _literal;
+        void *_tmp_161_var;
+        if (
+            (_literal = _PyPegen_expect_token(p, 16))  // token='*'
+            &&
+            (_tmp_161_var = _tmp_161_rule(p))  // ':' | ',' (':' | '**')
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
+            _res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_double_type_comments: TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT
+static void *
+invalid_double_type_comments_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_double_type_comments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT"));
+        Token * indent_var;
+        Token * newline_var;
+        Token * newline_var_1;
+        Token * type_comment_var;
+        Token * type_comment_var_1;
+        if (
+            (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT))  // token='TYPE_COMMENT'
+            &&
+            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+            &&
+            (type_comment_var_1 = _PyPegen_expect_token(p, TYPE_COMMENT))  // token='TYPE_COMMENT'
+            &&
+            (newline_var_1 = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+            &&
+            (indent_var = _PyPegen_expect_token(p, INDENT))  // token='INDENT'
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_double_type_comments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT"));
+            _res = RAISE_SYNTAX_ERROR ( "Cannot have two type comments on def" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_double_type_comments[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_with_item: expression 'as' expression &(',' | ')' | ':')
+static void *
+invalid_with_item_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // expression 'as' expression &(',' | ')' | ':')
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression 'as' expression &(',' | ')' | ':')"));
+        Token * _keyword;
+        expr_ty a;
+        expr_ty expression_var;
+        if (
+            (expression_var = expression_rule(p))  // expression
+            &&
+            (_keyword = _PyPegen_expect_token(p, 520))  // token='as'
+            &&
+            (a = expression_rule(p))  // expression
+            &&
+            _PyPegen_lookahead(1, _tmp_162_rule, p)
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression 'as' expression &(',' | ')' | ':')"));
+            _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( STAR_TARGETS , a );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_with_item[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression 'as' expression &(',' | ')' | ':')"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_for_target: ASYNC? 'for' star_expressions
+static void *
+invalid_for_target_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // ASYNC? 'for' star_expressions
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_for_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC? 'for' star_expressions"));
+        Token * _keyword;
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        expr_ty a;
+        if (
+            (_opt_var = _PyPegen_expect_token(p, ASYNC), !p->error_indicator)  // ASYNC?
+            &&
+            (_keyword = _PyPegen_expect_token(p, 517))  // token='for'
+            &&
+            (a = star_expressions_rule(p))  // star_expressions
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_for_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC? 'for' star_expressions"));
+            _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( FOR_TARGETS , a );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_for_target[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC? 'for' star_expressions"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_group: '(' starred_expression ')' | '(' '**' expression ')'
+static void *
+invalid_group_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // '(' starred_expression ')'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' starred_expression ')'"));
+        Token * _literal;
+        Token * _literal_1;
+        expr_ty a;
+        if (
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+            &&
+            (a = starred_expression_rule(p))  // starred_expression
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' starred_expression ')'"));
+            _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use starred expression here" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_group[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' starred_expression ')'"));
+    }
+    { // '(' '**' expression ')'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' '**' expression ')'"));
+        Token * _literal;
+        Token * _literal_1;
+        Token * a;
+        expr_ty expression_var;
+        if (
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+            &&
+            (a = _PyPegen_expect_token(p, 35))  // token='**'
+            &&
+            (expression_var = expression_rule(p))  // expression
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' '**' expression ')'"));
+            _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use double starred expression here" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_group[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' '**' expression ')'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_import_from_targets: import_from_as_names ',' NEWLINE
+static void *
+invalid_import_from_targets_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // import_from_as_names ',' NEWLINE
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_names ',' NEWLINE"));
+        Token * _literal;
+        asdl_alias_seq* import_from_as_names_var;
+        Token * newline_var;
+        if (
+            (import_from_as_names_var = import_from_as_names_rule(p))  // import_from_as_names
+            &&
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names ',' NEWLINE"));
+            _res = RAISE_SYNTAX_ERROR ( "trailing comma not allowed without surrounding parentheses" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names ',' NEWLINE"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_with_stmt:
+//     | ASYNC? 'with' ','.(expression ['as' star_target])+ &&':'
+//     | ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' &&':'
+static void *
+invalid_with_stmt_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // ASYNC? 'with' ','.(expression ['as' star_target])+ &&':'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC? 'with' ','.(expression ['as' star_target])+ &&':'"));
+        asdl_seq * _gather_163_var;
+        Token * _keyword;
+        Token * _literal;
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        if (
+            (_opt_var = _PyPegen_expect_token(p, ASYNC), !p->error_indicator)  // ASYNC?
+            &&
+            (_keyword = _PyPegen_expect_token(p, 519))  // token='with'
+            &&
+            (_gather_163_var = _gather_163_rule(p))  // ','.(expression ['as' star_target])+
+            &&
+            (_literal = _PyPegen_expect_forced_token(p, 11, ":"))  // forced_token=':'
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC? 'with' ','.(expression ['as' star_target])+ &&':'"));
+            _res = _PyPegen_dummy_name(p, _opt_var, _keyword, _gather_163_var, _literal);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC? 'with' ','.(expression ['as' star_target])+ &&':'"));
+    }
+    { // ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' &&':'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' &&':'"));
+        asdl_seq * _gather_165_var;
+        Token * _keyword;
+        Token * _literal;
+        Token * _literal_1;
+        Token * _literal_2;
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        void *_opt_var_1;
+        UNUSED(_opt_var_1); // Silence compiler warnings
+        if (
+            (_opt_var = _PyPegen_expect_token(p, ASYNC), !p->error_indicator)  // ASYNC?
+            &&
+            (_keyword = _PyPegen_expect_token(p, 519))  // token='with'
+            &&
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+            &&
+            (_gather_165_var = _gather_165_rule(p))  // ','.(expressions ['as' star_target])+
+            &&
+            (_opt_var_1 = _PyPegen_expect_token(p, 12), !p->error_indicator)  // ','?
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
+            &&
+            (_literal_2 = _PyPegen_expect_forced_token(p, 11, ":"))  // forced_token=':'
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' &&':'"));
+            _res = _PyPegen_dummy_name(p, _opt_var, _keyword, _literal, _gather_165_var, _opt_var_1, _literal_1, _literal_2);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' &&':'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_with_stmt_indent:
+//     | ASYNC? 'with' ','.(expression ['as' star_target])+ ':' NEWLINE !INDENT
+//     | ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' ':' NEWLINE !INDENT
+static void *
+invalid_with_stmt_indent_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // ASYNC? 'with' ','.(expression ['as' star_target])+ ':' NEWLINE !INDENT
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_with_stmt_indent[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC? 'with' ','.(expression ['as' star_target])+ ':' NEWLINE !INDENT"));
+        asdl_seq * _gather_167_var;
+        Token * _literal;
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        Token * a;
+        Token * newline_var;
+        if (
+            (_opt_var = _PyPegen_expect_token(p, ASYNC), !p->error_indicator)  // ASYNC?
+            &&
+            (a = _PyPegen_expect_token(p, 519))  // token='with'
+            &&
+            (_gather_167_var = _gather_167_rule(p))  // ','.(expression ['as' star_target])+
+            &&
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+            &&
+            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT)  // token=INDENT
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_with_stmt_indent[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC? 'with' ','.(expression ['as' star_target])+ ':' NEWLINE !INDENT"));
+            _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'with' statement on line %d" , a -> lineno );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_with_stmt_indent[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC? 'with' ','.(expression ['as' star_target])+ ':' NEWLINE !INDENT"));
+    }
+    { // ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' ':' NEWLINE !INDENT
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_with_stmt_indent[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' ':' NEWLINE !INDENT"));
+        asdl_seq * _gather_169_var;
+        Token * _literal;
+        Token * _literal_1;
+        Token * _literal_2;
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        void *_opt_var_1;
+        UNUSED(_opt_var_1); // Silence compiler warnings
+        Token * a;
+        Token * newline_var;
+        if (
+            (_opt_var = _PyPegen_expect_token(p, ASYNC), !p->error_indicator)  // ASYNC?
+            &&
+            (a = _PyPegen_expect_token(p, 519))  // token='with'
+            &&
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+            &&
+            (_gather_169_var = _gather_169_rule(p))  // ','.(expressions ['as' star_target])+
+            &&
+            (_opt_var_1 = _PyPegen_expect_token(p, 12), !p->error_indicator)  // ','?
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
+            &&
+            (_literal_2 = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+            &&
+            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT)  // token=INDENT
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_with_stmt_indent[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' ':' NEWLINE !INDENT"));
+            _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'with' statement on line %d" , a -> lineno );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_with_stmt_indent[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' ':' NEWLINE !INDENT"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_try_stmt: 'try' ':' NEWLINE !INDENT | 'try' ':' block !('except' | 'finally')
+static void *
+invalid_try_stmt_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // 'try' ':' NEWLINE !INDENT
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' NEWLINE !INDENT"));
+        Token * _literal;
+        Token * a;
+        Token * newline_var;
+        if (
+            (a = _PyPegen_expect_token(p, 511))  // token='try'
+            &&
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+            &&
+            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT)  // token=INDENT
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' NEWLINE !INDENT"));
+            _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'try' statement on line %d" , a -> lineno );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' NEWLINE !INDENT"));
+    }
+    { // 'try' ':' block !('except' | 'finally')
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' block !('except' | 'finally')"));
+        Token * _keyword;
+        Token * _literal;
+        asdl_stmt_seq* block_var;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 511))  // token='try'
+            &&
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (block_var = block_rule(p))  // block
+            &&
+            _PyPegen_lookahead(0, _tmp_171_rule, p)
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block !('except' | 'finally')"));
+            _res = RAISE_SYNTAX_ERROR ( "expected 'except' or 'finally' block" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block !('except' | 'finally')"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_except_stmt:
+//     | 'except' expression ',' expressions ['as' NAME] ':'
+//     | 'except' expression ['as' NAME] NEWLINE
+//     | 'except' NEWLINE
+static void *
+invalid_except_stmt_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // 'except' expression ',' expressions ['as' NAME] ':'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_except_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ',' expressions ['as' NAME] ':'"));
+        Token * _keyword;
+        Token * _literal;
+        Token * _literal_1;
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        expr_ty a;
+        expr_ty expressions_var;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 521))  // token='except'
+            &&
+            (a = expression_rule(p))  // expression
+            &&
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (expressions_var = expressions_rule(p))  // expressions
+            &&
+            (_opt_var = _tmp_172_rule(p), !p->error_indicator)  // ['as' NAME]
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 11))  // token=':'
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_except_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ',' expressions ['as' NAME] ':'"));
+            _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( a , "multiple exception types must be parenthesized" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_except_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ',' expressions ['as' NAME] ':'"));
+    }
+    { // 'except' expression ['as' NAME] NEWLINE
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_except_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] NEWLINE"));
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        Token * a;
+        expr_ty expression_var;
+        Token * newline_var;
+        if (
+            (a = _PyPegen_expect_token(p, 521))  // token='except'
+            &&
+            (expression_var = expression_rule(p))  // expression
+            &&
+            (_opt_var = _tmp_173_rule(p), !p->error_indicator)  // ['as' NAME]
+            &&
+            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_except_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] NEWLINE"));
+            _res = RAISE_SYNTAX_ERROR ( "expected ':'" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_except_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ['as' NAME] NEWLINE"));
+    }
+    { // 'except' NEWLINE
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_except_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' NEWLINE"));
+        Token * a;
+        Token * newline_var;
+        if (
+            (a = _PyPegen_expect_token(p, 521))  // token='except'
+            &&
+            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_except_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' NEWLINE"));
+            _res = RAISE_SYNTAX_ERROR ( "expected ':'" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_except_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' NEWLINE"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_finally_stmt: 'finally' ':' NEWLINE !INDENT
+static void *
+invalid_finally_stmt_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // 'finally' ':' NEWLINE !INDENT
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_finally_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'finally' ':' NEWLINE !INDENT"));
+        Token * _literal;
+        Token * a;
+        Token * newline_var;
+        if (
+            (a = _PyPegen_expect_token(p, 522))  // token='finally'
+            &&
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+            &&
+            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT)  // token=INDENT
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_finally_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'finally' ':' NEWLINE !INDENT"));
+            _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'finally' statement on line %d" , a -> lineno );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_finally_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'finally' ':' NEWLINE !INDENT"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_except_stmt_indent:
+//     | 'except' expression ['as' NAME] ':' NEWLINE !INDENT
+//     | 'except' ':' NEWLINE !INDENT
+static void *
+invalid_except_stmt_indent_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // 'except' expression ['as' NAME] ':' NEWLINE !INDENT
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_except_stmt_indent[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' NEWLINE !INDENT"));
+        Token * _literal;
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        Token * a;
+        expr_ty expression_var;
+        Token * newline_var;
+        if (
+            (a = _PyPegen_expect_token(p, 521))  // token='except'
+            &&
+            (expression_var = expression_rule(p))  // expression
+            &&
+            (_opt_var = _tmp_174_rule(p), !p->error_indicator)  // ['as' NAME]
+            &&
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+            &&
+            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT)  // token=INDENT
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_except_stmt_indent[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' NEWLINE !INDENT"));
+            _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'except' statement on line %d" , a -> lineno );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_except_stmt_indent[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ['as' NAME] ':' NEWLINE !INDENT"));
+    }
+    { // 'except' ':' NEWLINE !INDENT
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_except_stmt_indent[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' ':' NEWLINE !INDENT"));
+        Token * _literal;
+        Token * a;
+        Token * newline_var;
+        if (
+            (a = _PyPegen_expect_token(p, 521))  // token='except'
+            &&
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+            &&
+            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT)  // token=INDENT
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_except_stmt_indent[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' ':' NEWLINE !INDENT"));
+            _res = RAISE_SYNTAX_ERROR ( "expected an indented block after except statement on line %d" , a -> lineno );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_except_stmt_indent[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' ':' NEWLINE !INDENT"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_match_stmt:
+//     | "match" subject_expr !':'
+//     | "match" subject_expr ':' NEWLINE !INDENT
+static void *
+invalid_match_stmt_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // "match" subject_expr !':'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_match_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr !':'"));
+        expr_ty _keyword;
+        expr_ty subject_expr_var;
+        if (
+            (_keyword = _PyPegen_expect_soft_keyword(p, "match"))  // soft_keyword='"match"'
+            &&
+            (subject_expr_var = subject_expr_rule(p))  // subject_expr
+            &&
+            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 11)  // token=':'
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_match_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr !':'"));
+            _res = CHECK_VERSION ( void * , 10 , "Pattern matching is" , RAISE_SYNTAX_ERROR ( "expected ':'" ) );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_match_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"match\" subject_expr !':'"));
+    }
+    { // "match" subject_expr ':' NEWLINE !INDENT
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_match_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr ':' NEWLINE !INDENT"));
+        Token * _literal;
+        expr_ty a;
+        Token * newline_var;
+        expr_ty subject;
+        if (
+            (a = _PyPegen_expect_soft_keyword(p, "match"))  // soft_keyword='"match"'
+            &&
+            (subject = subject_expr_rule(p))  // subject_expr
+            &&
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+            &&
+            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT)  // token=INDENT
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_match_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr ':' NEWLINE !INDENT"));
+            _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'match' statement on line %d" , a -> lineno );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_match_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"match\" subject_expr ':' NEWLINE !INDENT"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_case_block:
+//     | "case" patterns guard? !':'
+//     | "case" patterns guard? ':' NEWLINE !INDENT
+static void *
+invalid_case_block_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // "case" patterns guard? !':'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_case_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? !':'"));
+        expr_ty _keyword;
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        pattern_ty patterns_var;
+        if (
+            (_keyword = _PyPegen_expect_soft_keyword(p, "case"))  // soft_keyword='"case"'
+            &&
+            (patterns_var = patterns_rule(p))  // patterns
+            &&
+            (_opt_var = guard_rule(p), !p->error_indicator)  // guard?
+            &&
+            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 11)  // token=':'
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_case_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? !':'"));
+            _res = RAISE_SYNTAX_ERROR ( "expected ':'" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_case_block[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"case\" patterns guard? !':'"));
+    }
+    { // "case" patterns guard? ':' NEWLINE !INDENT
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_case_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? ':' NEWLINE !INDENT"));
+        Token * _literal;
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        expr_ty a;
+        Token * newline_var;
+        pattern_ty patterns_var;
+        if (
+            (a = _PyPegen_expect_soft_keyword(p, "case"))  // soft_keyword='"case"'
+            &&
+            (patterns_var = patterns_rule(p))  // patterns
+            &&
+            (_opt_var = guard_rule(p), !p->error_indicator)  // guard?
+            &&
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+            &&
+            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT)  // token=INDENT
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_case_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? ':' NEWLINE !INDENT"));
+            _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'case' statement on line %d" , a -> lineno );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_case_block[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "\"case\" patterns guard? ':' NEWLINE !INDENT"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_as_pattern: or_pattern 'as' "_" | or_pattern 'as' !NAME expression
+static void *
+invalid_as_pattern_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // or_pattern 'as' "_"
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_as_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' \"_\""));
+        Token * _keyword;
+        expr_ty a;
+        pattern_ty or_pattern_var;
+        if (
+            (or_pattern_var = or_pattern_rule(p))  // or_pattern
+            &&
+            (_keyword = _PyPegen_expect_token(p, 520))  // token='as'
+            &&
+            (a = _PyPegen_expect_soft_keyword(p, "_"))  // soft_keyword='"_"'
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_as_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' \"_\""));
+            _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use '_' as a target" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_as_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "or_pattern 'as' \"_\""));
+    }
+    { // or_pattern 'as' !NAME expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_as_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' !NAME expression"));
+        Token * _keyword;
+        expr_ty a;
+        pattern_ty or_pattern_var;
+        if (
+            (or_pattern_var = or_pattern_rule(p))  // or_pattern
+            &&
+            (_keyword = _PyPegen_expect_token(p, 520))  // token='as'
+            &&
+            _PyPegen_lookahead_with_name(0, _PyPegen_name_token, p)
+            &&
+            (a = expression_rule(p))  // expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_as_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' !NAME expression"));
+            _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "invalid pattern target" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_as_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "or_pattern 'as' !NAME expression"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_class_pattern: name_or_attr '(' invalid_class_argument_pattern
+static void *
+invalid_class_pattern_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // name_or_attr '(' invalid_class_argument_pattern
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_class_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' invalid_class_argument_pattern"));
+        Token * _literal;
+        asdl_pattern_seq* a;
+        expr_ty name_or_attr_var;
+        if (
+            (name_or_attr_var = name_or_attr_rule(p))  // name_or_attr
+            &&
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+            &&
+            (a = invalid_class_argument_pattern_rule(p))  // invalid_class_argument_pattern
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' invalid_class_argument_pattern"));
+            _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( PyPegen_first_item ( a , pattern_ty ) , PyPegen_last_item ( a , pattern_ty ) , "positional patterns follow keyword patterns" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_class_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "name_or_attr '(' invalid_class_argument_pattern"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_class_argument_pattern:
+//     | [positional_patterns ','] keyword_patterns ',' positional_patterns
+static asdl_pattern_seq*
+invalid_class_argument_pattern_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_pattern_seq* _res = NULL;
+    int _mark = p->mark;
+    { // [positional_patterns ','] keyword_patterns ',' positional_patterns
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_class_argument_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "[positional_patterns ','] keyword_patterns ',' positional_patterns"));
+        Token * _literal;
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        asdl_pattern_seq* a;
+        asdl_seq* keyword_patterns_var;
+        if (
+            (_opt_var = _tmp_175_rule(p), !p->error_indicator)  // [positional_patterns ',']
+            &&
+            (keyword_patterns_var = keyword_patterns_rule(p))  // keyword_patterns
+            &&
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (a = positional_patterns_rule(p))  // positional_patterns
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_class_argument_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "[positional_patterns ','] keyword_patterns ',' positional_patterns"));
+            _res = a;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_class_argument_pattern[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "[positional_patterns ','] keyword_patterns ',' positional_patterns"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_if_stmt:
+//     | 'if' named_expression NEWLINE
+//     | 'if' named_expression ':' NEWLINE !INDENT
+static void *
+invalid_if_stmt_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // 'if' named_expression NEWLINE
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression NEWLINE"));
+        Token * _keyword;
+        expr_ty named_expression_var;
+        Token * newline_var;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 510))  // token='if'
+            &&
+            (named_expression_var = named_expression_rule(p))  // named_expression
+            &&
+            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression NEWLINE"));
+            _res = RAISE_SYNTAX_ERROR ( "expected ':'" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_if_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression NEWLINE"));
+    }
+    { // 'if' named_expression ':' NEWLINE !INDENT
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' NEWLINE !INDENT"));
+        Token * _literal;
+        Token * a;
+        expr_ty a_1;
+        Token * newline_var;
+        if (
+            (a = _PyPegen_expect_token(p, 510))  // token='if'
+            &&
+            (a_1 = named_expression_rule(p))  // named_expression
+            &&
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+            &&
+            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT)  // token=INDENT
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' NEWLINE !INDENT"));
+            _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'if' statement on line %d" , a -> lineno );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_if_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression ':' NEWLINE !INDENT"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_elif_stmt:
+//     | 'elif' named_expression NEWLINE
+//     | 'elif' named_expression ':' NEWLINE !INDENT
+static void *
+invalid_elif_stmt_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // 'elif' named_expression NEWLINE
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression NEWLINE"));
+        Token * _keyword;
+        expr_ty named_expression_var;
+        Token * newline_var;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 515))  // token='elif'
+            &&
+            (named_expression_var = named_expression_rule(p))  // named_expression
+            &&
+            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression NEWLINE"));
+            _res = RAISE_SYNTAX_ERROR ( "expected ':'" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_elif_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression NEWLINE"));
+    }
+    { // 'elif' named_expression ':' NEWLINE !INDENT
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' NEWLINE !INDENT"));
+        Token * _literal;
+        Token * a;
+        expr_ty named_expression_var;
+        Token * newline_var;
+        if (
+            (a = _PyPegen_expect_token(p, 515))  // token='elif'
+            &&
+            (named_expression_var = named_expression_rule(p))  // named_expression
+            &&
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+            &&
+            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT)  // token=INDENT
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' NEWLINE !INDENT"));
+            _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'elif' statement on line %d" , a -> lineno );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_elif_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression ':' NEWLINE !INDENT"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_else_stmt: 'else' ':' NEWLINE !INDENT
+static void *
+invalid_else_stmt_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // 'else' ':' NEWLINE !INDENT
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_else_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'else' ':' NEWLINE !INDENT"));
+        Token * _literal;
+        Token * a;
+        Token * newline_var;
+        if (
+            (a = _PyPegen_expect_token(p, 516))  // token='else'
+            &&
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+            &&
+            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT)  // token=INDENT
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_else_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'else' ':' NEWLINE !INDENT"));
+            _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'else' statement on line %d" , a -> lineno );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_else_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'else' ':' NEWLINE !INDENT"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_while_stmt:
+//     | 'while' named_expression NEWLINE
+//     | 'while' named_expression ':' NEWLINE !INDENT
+static void *
+invalid_while_stmt_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // 'while' named_expression NEWLINE
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_while_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'while' named_expression NEWLINE"));
+        Token * _keyword;
+        expr_ty named_expression_var;
+        Token * newline_var;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 512))  // token='while'
+            &&
+            (named_expression_var = named_expression_rule(p))  // named_expression
+            &&
+            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_while_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'while' named_expression NEWLINE"));
+            _res = RAISE_SYNTAX_ERROR ( "expected ':'" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_while_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'while' named_expression NEWLINE"));
+    }
+    { // 'while' named_expression ':' NEWLINE !INDENT
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_while_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'while' named_expression ':' NEWLINE !INDENT"));
+        Token * _literal;
+        Token * a;
+        expr_ty named_expression_var;
+        Token * newline_var;
+        if (
+            (a = _PyPegen_expect_token(p, 512))  // token='while'
+            &&
+            (named_expression_var = named_expression_rule(p))  // named_expression
+            &&
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+            &&
+            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT)  // token=INDENT
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_while_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'while' named_expression ':' NEWLINE !INDENT"));
+            _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'while' statement on line %d" , a -> lineno );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_while_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'while' named_expression ':' NEWLINE !INDENT"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_for_stmt: ASYNC? 'for' star_targets 'in' star_expressions ':' NEWLINE !INDENT
+static void *
+invalid_for_stmt_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // ASYNC? 'for' star_targets 'in' star_expressions ':' NEWLINE !INDENT
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_for_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC? 'for' star_targets 'in' star_expressions ':' NEWLINE !INDENT"));
+        Token * _keyword;
+        Token * _literal;
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        Token * a;
+        Token * newline_var;
+        expr_ty star_expressions_var;
+        expr_ty star_targets_var;
+        if (
+            (_opt_var = _PyPegen_expect_token(p, ASYNC), !p->error_indicator)  // ASYNC?
+            &&
+            (a = _PyPegen_expect_token(p, 517))  // token='for'
+            &&
+            (star_targets_var = star_targets_rule(p))  // star_targets
+            &&
+            (_keyword = _PyPegen_expect_token(p, 518))  // token='in'
+            &&
+            (star_expressions_var = star_expressions_rule(p))  // star_expressions
+            &&
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+            &&
+            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT)  // token=INDENT
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_for_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC? 'for' star_targets 'in' star_expressions ':' NEWLINE !INDENT"));
+            _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'for' statement on line %d" , a -> lineno );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC? 'for' star_targets 'in' star_expressions ':' NEWLINE !INDENT"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_def_raw:
+//     | ASYNC? 'def' NAME '(' params? ')' ['->' expression] ':' NEWLINE !INDENT
+static void *
+invalid_def_raw_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // ASYNC? 'def' NAME '(' params? ')' ['->' expression] ':' NEWLINE !INDENT
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC? 'def' NAME '(' params? ')' ['->' expression] ':' NEWLINE !INDENT"));
+        Token * _literal;
+        Token * _literal_1;
+        Token * _literal_2;
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        void *_opt_var_1;
+        UNUSED(_opt_var_1); // Silence compiler warnings
+        void *_opt_var_2;
+        UNUSED(_opt_var_2); // Silence compiler warnings
+        Token * a;
+        expr_ty name_var;
+        Token * newline_var;
+        if (
+            (_opt_var = _PyPegen_expect_token(p, ASYNC), !p->error_indicator)  // ASYNC?
+            &&
+            (a = _PyPegen_expect_token(p, 526))  // token='def'
+            &&
+            (name_var = _PyPegen_name_token(p))  // NAME
+            &&
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+            &&
+            (_opt_var_1 = params_rule(p), !p->error_indicator)  // params?
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
+            &&
+            (_opt_var_2 = _tmp_176_rule(p), !p->error_indicator)  // ['->' expression]
+            &&
+            (_literal_2 = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+            &&
+            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT)  // token=INDENT
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC? 'def' NAME '(' params? ')' ['->' expression] ':' NEWLINE !INDENT"));
+            _res = RAISE_INDENTATION_ERROR ( "expected an indented block after function definition on line %d" , a -> lineno );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC? 'def' NAME '(' params? ')' ['->' expression] ':' NEWLINE !INDENT"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_class_def_raw: 'class' NAME ['(' arguments? ')'] ':' NEWLINE !INDENT
+static void *
+invalid_class_def_raw_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // 'class' NAME ['(' arguments? ')'] ':' NEWLINE !INDENT
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_class_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' NEWLINE !INDENT"));
+        Token * _literal;
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        Token * a;
+        expr_ty name_var;
+        Token * newline_var;
+        if (
+            (a = _PyPegen_expect_token(p, 527))  // token='class'
+            &&
+            (name_var = _PyPegen_name_token(p))  // NAME
+            &&
+            (_opt_var = _tmp_177_rule(p), !p->error_indicator)  // ['(' arguments? ')']
+            &&
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+            &&
+            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT)  // token=INDENT
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_class_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' NEWLINE !INDENT"));
+            _res = RAISE_INDENTATION_ERROR ( "expected an indented block after class definition on line %d" , a -> lineno );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_class_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' NEWLINE !INDENT"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_double_starred_kvpairs:
+//     | ','.double_starred_kvpair+ ',' invalid_kvpair
+//     | expression ':' '*' bitwise_or
+//     | expression ':' &('}' | ',')
+static void *
+invalid_double_starred_kvpairs_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // ','.double_starred_kvpair+ ',' invalid_kvpair
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_double_starred_kvpairs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ',' invalid_kvpair"));
+        asdl_seq * _gather_178_var;
+        Token * _literal;
+        void *invalid_kvpair_var;
+        if (
+            (_gather_178_var = _gather_178_rule(p))  // ','.double_starred_kvpair+
+            &&
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (invalid_kvpair_var = invalid_kvpair_rule(p))  // invalid_kvpair
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ',' invalid_kvpair"));
+            _res = _PyPegen_dummy_name(p, _gather_178_var, _literal, invalid_kvpair_var);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_double_starred_kvpairs[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.double_starred_kvpair+ ',' invalid_kvpair"));
+    }
+    { // expression ':' '*' bitwise_or
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_double_starred_kvpairs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' '*' bitwise_or"));
+        Token * _literal;
+        Token * a;
+        expr_ty bitwise_or_var;
+        expr_ty expression_var;
+        if (
+            (expression_var = expression_rule(p))  // expression
+            &&
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (a = _PyPegen_expect_token(p, 16))  // token='*'
+            &&
+            (bitwise_or_var = bitwise_or_rule(p))  // bitwise_or
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' '*' bitwise_or"));
+            _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( a , "cannot use a starred expression in a dictionary value" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_double_starred_kvpairs[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' '*' bitwise_or"));
+    }
+    { // expression ':' &('}' | ',')
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_double_starred_kvpairs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' &('}' | ',')"));
+        Token * a;
+        expr_ty expression_var;
+        if (
+            (expression_var = expression_rule(p))  // expression
+            &&
+            (a = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            _PyPegen_lookahead(1, _tmp_180_rule, p)
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' &('}' | ',')"));
+            _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expression expected after dictionary key and ':'" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_double_starred_kvpairs[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' &('}' | ',')"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// invalid_kvpair: expression !(':') | expression ':' '*' bitwise_or | expression ':'
+static void *
+invalid_kvpair_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // expression !(':')
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !(':')"));
+        expr_ty a;
+        if (
+            (a = expression_rule(p))  // expression
+            &&
+            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 11)  // token=(':')
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression !(':')"));
+            _res = RAISE_ERROR_KNOWN_LOCATION ( p , PyExc_SyntaxError , a -> lineno , a -> end_col_offset - 1 , a -> end_lineno , - 1 , "':' expected after dictionary key" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_kvpair[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression !(':')"));
+    }
+    { // expression ':' '*' bitwise_or
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' '*' bitwise_or"));
+        Token * _literal;
+        Token * a;
+        expr_ty bitwise_or_var;
+        expr_ty expression_var;
+        if (
+            (expression_var = expression_rule(p))  // expression
+            &&
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (a = _PyPegen_expect_token(p, 16))  // token='*'
+            &&
+            (bitwise_or_var = bitwise_or_rule(p))  // bitwise_or
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' '*' bitwise_or"));
+            _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( a , "cannot use a starred expression in a dictionary value" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_kvpair[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' '*' bitwise_or"));
+    }
+    { // expression ':'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> invalid_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':'"));
+        Token * a;
+        expr_ty expression_var;
+        if (
+            (expression_var = expression_rule(p))  // expression
+            &&
+            (a = _PyPegen_expect_token(p, 11))  // token=':'
+        )
+        {
+            D(fprintf(stderr, "%*c+ invalid_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':'"));
+            _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expression expected after dictionary key and ':'" );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s invalid_kvpair[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop0_1: NEWLINE
+static asdl_seq *
+_loop0_1_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // NEWLINE
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_1[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
+        Token * newline_var;
+        while (
+            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+        )
+        {
+            _res = newline_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
                 }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_1[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_1_type, _seq);
+    p->level--;
+    return _seq;
+}
 
-                /* Shift the token */
-                if ((err = shift(&ps->p_stack, type, str,
-                                x, lineno, col_offset,
-                                end_lineno, end_col_offset)) > 0) {
-                    D(printf(" MemError: shift.\n"));
-                    return err;
+// _loop0_2: NEWLINE
+static asdl_seq *
+_loop0_2_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // NEWLINE
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_2[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
+        Token * newline_var;
+        while (
+            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+        )
+        {
+            _res = newline_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
                 }
-                D(printf(" Shift.\n"));
-                /* Pop while we are in an accept-only state */
-                while (s = &d->d_state
-                                [ps->p_stack.s_top->s_state],
-                    s->s_accept && s->s_narcs == 1) {
-                    D(printf("  DFA '%s', state %d: "
-                             "Direct pop.\n",
-                             d->d_name,
-                             ps->p_stack.s_top->s_state));
-#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD
-#if 0
-                    if (d->d_name[0] == 'i' &&
-                        strcmp(d->d_name,
-                           "import_stmt") == 0)
-                        future_hack(ps);
-#endif
-#endif
-                    s_pop(&ps->p_stack);
-                    if (s_empty(&ps->p_stack)) {
-                        D(printf("  ACCEPT.\n"));
-                        return E_DONE;
-                    }
-                    d = ps->p_stack.s_top->s_dfa;
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_2[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_2_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop0_4: ',' expression
+static asdl_seq *
+_loop0_4_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ',' expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_4[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
+        Token * _literal;
+        expr_ty elem;
+        while (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (elem = expression_rule(p))  // expression
+        )
+        {
+            _res = elem;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                PyMem_Free(_children);
+                p->level--;
+                return NULL;
+            }
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
                 }
-                return E_OK;
+                _children = _new_children;
             }
+            _children[_n++] = _res;
+            _mark = p->mark;
         }
-
-        if (s->s_accept) {
-#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD
-#if 0
-            if (d->d_name[0] == 'i' &&
-                strcmp(d->d_name, "import_stmt") == 0)
-                future_hack(ps);
-#endif
-#endif
-            /* Pop this dfa and try again */
-            s_pop(&ps->p_stack);
-            D(printf(" Pop ...\n"));
-            if (s_empty(&ps->p_stack)) {
-                D(printf(" Error: bottom of stack.\n"));
-                return E_SYNTAX;
-            }
-            continue;
-        }
-
-        /* Stuck, report syntax error */
-        D(printf(" Error.\n"));
-        if (expected_ret) {
-            if (s->s_lower == s->s_upper - 1) {
-                /* Only one possible expected token */
-                *expected_ret = ps->p_grammar->
-                    g_ll.ll_label[s->s_lower].lb_type;
-            }
-            else
-                *expected_ret = -1;
-        }
-        return E_SYNTAX;
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_4[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
     }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_4_type, _seq);
+    p->level--;
+    return _seq;
 }
 
-
-#ifdef Py_DEBUG
-
-/* DEBUG OUTPUT */
-
-void
-dumptree(grammar *g, node *n)
+// _gather_3: expression _loop0_4
+static asdl_seq *
+_gather_3_rule(Parser *p)
 {
-    int i;
-
-    if (n == NULL)
-        printf("NIL");
-    else {
-        label l;
-        l.lb_type = TYPE(n);
-        l.lb_str = STR(n);
-        printf("%s", PyGrammar_LabelRepr(&l));
-        if (ISNONTERMINAL(TYPE(n))) {
-            printf("(");
-            for (i = 0; i < NCH(n); i++) {
-                if (i > 0)
-                    printf(",");
-                dumptree(g, CHILD(n, i));
-            }
-            printf(")");
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq * _res = NULL;
+    int _mark = p->mark;
+    { // expression _loop0_4
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
         }
+        D(fprintf(stderr, "%*c> _gather_3[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_4"));
+        expr_ty elem;
+        asdl_seq * seq;
+        if (
+            (elem = expression_rule(p))  // expression
+            &&
+            (seq = _loop0_4_rule(p))  // _loop0_4
+        )
+        {
+            D(fprintf(stderr, "%*c+ _gather_3[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_4"));
+            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _gather_3[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_4"));
     }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
 }
 
-void
-showtree(grammar *g, node *n)
+// _loop0_6: ',' expression
+static asdl_seq *
+_loop0_6_rule(Parser *p)
 {
-    int i;
-
-    if (n == NULL)
-        return;
-    if (ISNONTERMINAL(TYPE(n))) {
-        for (i = 0; i < NCH(n); i++)
-            showtree(g, CHILD(n, i));
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
     }
-    else if (ISTERMINAL(TYPE(n))) {
-        printf("%s", _PyParser_TokenNames[TYPE(n)]);
-        if (TYPE(n) == NUMBER || TYPE(n) == NAME)
-            printf("(%s)", STR(n));
-        printf(" ");
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
     }
-    else
-        printf("? ");
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ',' expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_6[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
+        Token * _literal;
+        expr_ty elem;
+        while (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (elem = expression_rule(p))  // expression
+        )
+        {
+            _res = elem;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                PyMem_Free(_children);
+                p->level--;
+                return NULL;
+            }
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_6[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_6_type, _seq);
+    p->level--;
+    return _seq;
 }
 
-void
-printtree(parser_state *ps)
+// _gather_5: expression _loop0_6
+static asdl_seq *
+_gather_5_rule(Parser *p)
 {
-    if (Py_DebugFlag) {
-        printf("Parse tree:\n");
-        dumptree(ps->p_grammar, ps->p_tree);
-        printf("\n");
-        printf("Tokens:\n");
-        showtree(ps->p_grammar, ps->p_tree);
-        printf("\n");
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
     }
-    printf("Listing:\n");
-    PyNode_ListTree(ps->p_tree);
-    printf("\n");
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq * _res = NULL;
+    int _mark = p->mark;
+    { // expression _loop0_6
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _gather_5[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_6"));
+        expr_ty elem;
+        asdl_seq * seq;
+        if (
+            (elem = expression_rule(p))  // expression
+            &&
+            (seq = _loop0_6_rule(p))  // _loop0_6
+        )
+        {
+            D(fprintf(stderr, "%*c+ _gather_5[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_6"));
+            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _gather_5[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_6"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
 }
 
-#endif /* Py_DEBUG */
+// _loop0_8: ',' expression
+static asdl_seq *
+_loop0_8_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ',' expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_8[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
+        Token * _literal;
+        expr_ty elem;
+        while (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (elem = expression_rule(p))  // expression
+        )
+        {
+            _res = elem;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                PyMem_Free(_children);
+                p->level--;
+                return NULL;
+            }
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_8[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_8_type, _seq);
+    p->level--;
+    return _seq;
+}
 
-/*
+// _gather_7: expression _loop0_8
+static asdl_seq *
+_gather_7_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq * _res = NULL;
+    int _mark = p->mark;
+    { // expression _loop0_8
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _gather_7[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_8"));
+        expr_ty elem;
+        asdl_seq * seq;
+        if (
+            (elem = expression_rule(p))  // expression
+            &&
+            (seq = _loop0_8_rule(p))  // _loop0_8
+        )
+        {
+            D(fprintf(stderr, "%*c+ _gather_7[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_8"));
+            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _gather_7[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_8"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
 
-Description
------------
+// _loop0_10: ',' expression
+static asdl_seq *
+_loop0_10_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ',' expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_10[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
+        Token * _literal;
+        expr_ty elem;
+        while (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (elem = expression_rule(p))  // expression
+        )
+        {
+            _res = elem;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                PyMem_Free(_children);
+                p->level--;
+                return NULL;
+            }
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_10[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_10_type, _seq);
+    p->level--;
+    return _seq;
+}
 
-The parser's interface is different than usual: the function addtoken()
-must be called for each token in the input.  This makes it possible to
-turn it into an incremental parsing system later.  The parsing system
-constructs a parse tree as it goes.
+// _gather_9: expression _loop0_10
+static asdl_seq *
+_gather_9_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq * _res = NULL;
+    int _mark = p->mark;
+    { // expression _loop0_10
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _gather_9[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_10"));
+        expr_ty elem;
+        asdl_seq * seq;
+        if (
+            (elem = expression_rule(p))  // expression
+            &&
+            (seq = _loop0_10_rule(p))  // _loop0_10
+        )
+        {
+            D(fprintf(stderr, "%*c+ _gather_9[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_10"));
+            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _gather_9[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_10"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
 
-A parsing rule is represented as a Deterministic Finite-state Automaton
-(DFA).  A node in a DFA represents a state of the parser; an arc represents
-a transition.  Transitions are either labeled with terminal symbols or
-with non-terminals.  When the parser decides to follow an arc labeled
-with a non-terminal, it is invoked recursively with the DFA representing
-the parsing rule for that as its initial state; when that DFA accepts,
-the parser that invoked it continues.  The parse tree constructed by the
-recursively called parser is inserted as a child in the current parse tree.
+// _loop1_11: statement
+static asdl_seq *
+_loop1_11_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // statement
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop1_11[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement"));
+        asdl_stmt_seq* statement_var;
+        while (
+            (statement_var = statement_rule(p))  // statement
+        )
+        {
+            _res = statement_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop1_11[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement"));
+    }
+    if (_n == 0 || p->error_indicator) {
+        PyMem_Free(_children);
+        p->level--;
+        return NULL;
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop1_11_type, _seq);
+    p->level--;
+    return _seq;
+}
 
-The DFA's can be constructed automatically from a more conventional
-language description.  An extended LL(1) grammar (ELL(1)) is suitable.
-Certain restrictions make the parser's life easier: rules that can produce
-the empty string should be outlawed (there are other ways to put loops
-or optional parts in the language).  To avoid the need to construct
-FIRST sets, we can require that all but the last alternative of a rule
-(really: arc going out of a DFA's state) must begin with a terminal
-symbol.
+// _loop0_13: ';' simple_stmt
+static asdl_seq *
+_loop0_13_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ';' simple_stmt
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_13[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';' simple_stmt"));
+        Token * _literal;
+        stmt_ty elem;
+        while (
+            (_literal = _PyPegen_expect_token(p, 13))  // token=';'
+            &&
+            (elem = simple_stmt_rule(p))  // simple_stmt
+        )
+        {
+            _res = elem;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                PyMem_Free(_children);
+                p->level--;
+                return NULL;
+            }
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_13[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';' simple_stmt"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_13_type, _seq);
+    p->level--;
+    return _seq;
+}
 
-As an example, consider this grammar:
+// _gather_12: simple_stmt _loop0_13
+static asdl_seq *
+_gather_12_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq * _res = NULL;
+    int _mark = p->mark;
+    { // simple_stmt _loop0_13
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _gather_12[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt _loop0_13"));
+        stmt_ty elem;
+        asdl_seq * seq;
+        if (
+            (elem = simple_stmt_rule(p))  // simple_stmt
+            &&
+            (seq = _loop0_13_rule(p))  // _loop0_13
+        )
+        {
+            D(fprintf(stderr, "%*c+ _gather_12[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt _loop0_13"));
+            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _gather_12[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt _loop0_13"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
 
-expr:   term (OP term)*
-term:   CONSTANT | '(' expr ')'
+// _tmp_14: 'import' | 'from'
+static void *
+_tmp_14_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // 'import'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import'"));
+        Token * _keyword;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 513))  // token='import'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_14[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import'"));
+            _res = _keyword;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import'"));
+    }
+    { // 'from'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from'"));
+        Token * _keyword;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 514))  // token='from'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_14[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from'"));
+            _res = _keyword;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
 
-The DFA corresponding to the rule for expr is:
+// _tmp_15: 'def' | '@' | ASYNC
+static void *
+_tmp_15_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // 'def'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def'"));
+        Token * _keyword;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 526))  // token='def'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'def'"));
+            _res = _keyword;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def'"));
+    }
+    { // '@'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 49))  // token='@'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'"));
+    }
+    { // ASYNC
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
+        Token * async_var;
+        if (
+            (async_var = _PyPegen_expect_token(p, ASYNC))  // token='ASYNC'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
+            _res = async_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
 
-------->.---term-->.------->
-    ^          |
-    |          |
-    \----OP----/
+// _tmp_16: 'class' | '@'
+static void *
+_tmp_16_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // 'class'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class'"));
+        Token * _keyword;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 527))  // token='class'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class'"));
+            _res = _keyword;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class'"));
+    }
+    { // '@'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 49))  // token='@'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
 
-The parse tree generated for the input a+b is:
+// _tmp_17: 'with' | ASYNC
+static void *
+_tmp_17_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // 'with'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with'"));
+        Token * _keyword;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 519))  // token='with'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with'"));
+            _res = _keyword;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with'"));
+    }
+    { // ASYNC
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
+        Token * async_var;
+        if (
+            (async_var = _PyPegen_expect_token(p, ASYNC))  // token='ASYNC'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
+            _res = async_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
 
-(expr: (term: (NAME: a)), (OP: +), (term: (NAME: b)))
+// _tmp_18: 'for' | ASYNC
+static void *
+_tmp_18_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // 'for'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for'"));
+        Token * _keyword;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 517))  // token='for'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_18[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for'"));
+            _res = _keyword;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for'"));
+    }
+    { // ASYNC
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
+        Token * async_var;
+        if (
+            (async_var = _PyPegen_expect_token(p, ASYNC))  // token='ASYNC'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_18[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
+            _res = async_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
 
-*/
+// _tmp_19: '=' annotated_rhs
+static void *
+_tmp_19_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // '=' annotated_rhs
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_19[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
+        Token * _literal;
+        expr_ty d;
+        if (
+            (_literal = _PyPegen_expect_token(p, 22))  // token='='
+            &&
+            (d = annotated_rhs_rule(p))  // annotated_rhs
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_19[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
+            _res = d;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_19[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_20: '(' single_target ')' | single_subscript_attribute_target
+static void *
+_tmp_20_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // '(' single_target ')'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
+        Token * _literal;
+        Token * _literal_1;
+        expr_ty b;
+        if (
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+            &&
+            (b = single_target_rule(p))  // single_target
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_20[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
+            _res = b;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'"));
+    }
+    { // single_subscript_attribute_target
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
+        expr_ty single_subscript_attribute_target_var;
+        if (
+            (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p))  // single_subscript_attribute_target
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_20[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
+            _res = single_subscript_attribute_target_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_21: '=' annotated_rhs
+static void *
+_tmp_21_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // '=' annotated_rhs
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_21[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
+        Token * _literal;
+        expr_ty d;
+        if (
+            (_literal = _PyPegen_expect_token(p, 22))  // token='='
+            &&
+            (d = annotated_rhs_rule(p))  // annotated_rhs
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_21[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
+            _res = d;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_21[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop1_22: (star_targets '=')
+static asdl_seq *
+_loop1_22_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // (star_targets '=')
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop1_22[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
+        void *_tmp_181_var;
+        while (
+            (_tmp_181_var = _tmp_181_rule(p))  // star_targets '='
+        )
+        {
+            _res = _tmp_181_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop1_22[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
+    }
+    if (_n == 0 || p->error_indicator) {
+        PyMem_Free(_children);
+        p->level--;
+        return NULL;
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop1_22_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _tmp_23: yield_expr | star_expressions
+static void *
+_tmp_23_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // yield_expr
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
+        expr_ty yield_expr_var;
+        if (
+            (yield_expr_var = yield_expr_rule(p))  // yield_expr
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
+            _res = yield_expr_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
+    }
+    { // star_expressions
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
+        expr_ty star_expressions_var;
+        if (
+            (star_expressions_var = star_expressions_rule(p))  // star_expressions
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
+            _res = star_expressions_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_24: yield_expr | star_expressions
+static void *
+_tmp_24_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // yield_expr
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
+        expr_ty yield_expr_var;
+        if (
+            (yield_expr_var = yield_expr_rule(p))  // yield_expr
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
+            _res = yield_expr_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
+    }
+    { // star_expressions
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
+        expr_ty star_expressions_var;
+        if (
+            (star_expressions_var = star_expressions_rule(p))  // star_expressions
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
+            _res = star_expressions_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop0_26: ',' NAME
+static asdl_seq *
+_loop0_26_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ',' NAME
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_26[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME"));
+        Token * _literal;
+        expr_ty elem;
+        while (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (elem = _PyPegen_name_token(p))  // NAME
+        )
+        {
+            _res = elem;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                PyMem_Free(_children);
+                p->level--;
+                return NULL;
+            }
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_26[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_26_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _gather_25: NAME _loop0_26
+static asdl_seq *
+_gather_25_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq * _res = NULL;
+    int _mark = p->mark;
+    { // NAME _loop0_26
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _gather_25[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26"));
+        expr_ty elem;
+        asdl_seq * seq;
+        if (
+            (elem = _PyPegen_name_token(p))  // NAME
+            &&
+            (seq = _loop0_26_rule(p))  // _loop0_26
+        )
+        {
+            D(fprintf(stderr, "%*c+ _gather_25[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26"));
+            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _gather_25[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_26"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop0_28: ',' NAME
+static asdl_seq *
+_loop0_28_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ',' NAME
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_28[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME"));
+        Token * _literal;
+        expr_ty elem;
+        while (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (elem = _PyPegen_name_token(p))  // NAME
+        )
+        {
+            _res = elem;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                PyMem_Free(_children);
+                p->level--;
+                return NULL;
+            }
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_28[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_28_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _gather_27: NAME _loop0_28
+static asdl_seq *
+_gather_27_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq * _res = NULL;
+    int _mark = p->mark;
+    { // NAME _loop0_28
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _gather_27[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28"));
+        expr_ty elem;
+        asdl_seq * seq;
+        if (
+            (elem = _PyPegen_name_token(p))  // NAME
+            &&
+            (seq = _loop0_28_rule(p))  // _loop0_28
+        )
+        {
+            D(fprintf(stderr, "%*c+ _gather_27[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28"));
+            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _gather_27[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_28"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_29: ',' expression
+static void *
+_tmp_29_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // ',' expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_29[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
+        Token * _literal;
+        expr_ty z;
+        if (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (z = expression_rule(p))  // expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_29[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression"));
+            _res = z;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_29[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_30: ';' | NEWLINE
+static void *
+_tmp_30_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // ';'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 13))  // token=';'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_30[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_30[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'"));
+    }
+    { // NEWLINE
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
+        Token * newline_var;
+        if (
+            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_30[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
+            _res = newline_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_30[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop0_31: ('.' | '...')
+static asdl_seq *
+_loop0_31_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ('.' | '...')
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_31[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')"));
+        void *_tmp_182_var;
+        while (
+            (_tmp_182_var = _tmp_182_rule(p))  // '.' | '...'
+        )
+        {
+            _res = _tmp_182_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_31[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_31_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop1_32: ('.' | '...')
+static asdl_seq *
+_loop1_32_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ('.' | '...')
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop1_32[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')"));
+        void *_tmp_183_var;
+        while (
+            (_tmp_183_var = _tmp_183_rule(p))  // '.' | '...'
+        )
+        {
+            _res = _tmp_183_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop1_32[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')"));
+    }
+    if (_n == 0 || p->error_indicator) {
+        PyMem_Free(_children);
+        p->level--;
+        return NULL;
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop1_32_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop0_34: ',' import_from_as_name
+static asdl_seq *
+_loop0_34_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ',' import_from_as_name
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_34[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' import_from_as_name"));
+        Token * _literal;
+        alias_ty elem;
+        while (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (elem = import_from_as_name_rule(p))  // import_from_as_name
+        )
+        {
+            _res = elem;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                PyMem_Free(_children);
+                p->level--;
+                return NULL;
+            }
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_34[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' import_from_as_name"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_34_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _gather_33: import_from_as_name _loop0_34
+static asdl_seq *
+_gather_33_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq * _res = NULL;
+    int _mark = p->mark;
+    { // import_from_as_name _loop0_34
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _gather_33[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_name _loop0_34"));
+        alias_ty elem;
+        asdl_seq * seq;
+        if (
+            (elem = import_from_as_name_rule(p))  // import_from_as_name
+            &&
+            (seq = _loop0_34_rule(p))  // _loop0_34
+        )
+        {
+            D(fprintf(stderr, "%*c+ _gather_33[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_name _loop0_34"));
+            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _gather_33[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_name _loop0_34"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_35: 'as' NAME
+static void *
+_tmp_35_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // 'as' NAME
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_35[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
+        Token * _keyword;
+        expr_ty z;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 520))  // token='as'
+            &&
+            (z = _PyPegen_name_token(p))  // NAME
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_35[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
+            _res = z;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_35[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop0_37: ',' dotted_as_name
+static asdl_seq *
+_loop0_37_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ',' dotted_as_name
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_37[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' dotted_as_name"));
+        Token * _literal;
+        alias_ty elem;
+        while (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (elem = dotted_as_name_rule(p))  // dotted_as_name
+        )
+        {
+            _res = elem;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                PyMem_Free(_children);
+                p->level--;
+                return NULL;
+            }
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_37[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' dotted_as_name"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_37_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _gather_36: dotted_as_name _loop0_37
+static asdl_seq *
+_gather_36_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq * _res = NULL;
+    int _mark = p->mark;
+    { // dotted_as_name _loop0_37
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _gather_36[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_as_name _loop0_37"));
+        alias_ty elem;
+        asdl_seq * seq;
+        if (
+            (elem = dotted_as_name_rule(p))  // dotted_as_name
+            &&
+            (seq = _loop0_37_rule(p))  // _loop0_37
+        )
+        {
+            D(fprintf(stderr, "%*c+ _gather_36[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_as_name _loop0_37"));
+            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _gather_36[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_as_name _loop0_37"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_38: 'as' NAME
+static void *
+_tmp_38_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // 'as' NAME
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_38[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
+        Token * _keyword;
+        expr_ty z;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 520))  // token='as'
+            &&
+            (z = _PyPegen_name_token(p))  // NAME
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_38[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
+            _res = z;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_38[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop0_40: ',' with_item
+static asdl_seq *
+_loop0_40_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ',' with_item
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_40[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
+        Token * _literal;
+        withitem_ty elem;
+        while (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (elem = with_item_rule(p))  // with_item
+        )
+        {
+            _res = elem;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                PyMem_Free(_children);
+                p->level--;
+                return NULL;
+            }
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_40[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_40_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _gather_39: with_item _loop0_40
+static asdl_seq *
+_gather_39_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq * _res = NULL;
+    int _mark = p->mark;
+    { // with_item _loop0_40
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _gather_39[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_40"));
+        withitem_ty elem;
+        asdl_seq * seq;
+        if (
+            (elem = with_item_rule(p))  // with_item
+            &&
+            (seq = _loop0_40_rule(p))  // _loop0_40
+        )
+        {
+            D(fprintf(stderr, "%*c+ _gather_39[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_40"));
+            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _gather_39[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_40"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop0_42: ',' with_item
+static asdl_seq *
+_loop0_42_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ',' with_item
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_42[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
+        Token * _literal;
+        withitem_ty elem;
+        while (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (elem = with_item_rule(p))  // with_item
+        )
+        {
+            _res = elem;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                PyMem_Free(_children);
+                p->level--;
+                return NULL;
+            }
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_42[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_42_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _gather_41: with_item _loop0_42
+static asdl_seq *
+_gather_41_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq * _res = NULL;
+    int _mark = p->mark;
+    { // with_item _loop0_42
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _gather_41[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_42"));
+        withitem_ty elem;
+        asdl_seq * seq;
+        if (
+            (elem = with_item_rule(p))  // with_item
+            &&
+            (seq = _loop0_42_rule(p))  // _loop0_42
+        )
+        {
+            D(fprintf(stderr, "%*c+ _gather_41[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_42"));
+            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _gather_41[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_42"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop0_44: ',' with_item
+static asdl_seq *
+_loop0_44_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ',' with_item
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_44[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
+        Token * _literal;
+        withitem_ty elem;
+        while (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (elem = with_item_rule(p))  // with_item
+        )
+        {
+            _res = elem;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                PyMem_Free(_children);
+                p->level--;
+                return NULL;
+            }
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_44[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_44_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _gather_43: with_item _loop0_44
+static asdl_seq *
+_gather_43_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq * _res = NULL;
+    int _mark = p->mark;
+    { // with_item _loop0_44
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _gather_43[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_44"));
+        withitem_ty elem;
+        asdl_seq * seq;
+        if (
+            (elem = with_item_rule(p))  // with_item
+            &&
+            (seq = _loop0_44_rule(p))  // _loop0_44
+        )
+        {
+            D(fprintf(stderr, "%*c+ _gather_43[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_44"));
+            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _gather_43[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_44"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop0_46: ',' with_item
+static asdl_seq *
+_loop0_46_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ',' with_item
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_46[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
+        Token * _literal;
+        withitem_ty elem;
+        while (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (elem = with_item_rule(p))  // with_item
+        )
+        {
+            _res = elem;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                PyMem_Free(_children);
+                p->level--;
+                return NULL;
+            }
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_46[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_46_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _gather_45: with_item _loop0_46
+static asdl_seq *
+_gather_45_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq * _res = NULL;
+    int _mark = p->mark;
+    { // with_item _loop0_46
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _gather_45[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_46"));
+        withitem_ty elem;
+        asdl_seq * seq;
+        if (
+            (elem = with_item_rule(p))  // with_item
+            &&
+            (seq = _loop0_46_rule(p))  // _loop0_46
+        )
+        {
+            D(fprintf(stderr, "%*c+ _gather_45[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_46"));
+            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _gather_45[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_46"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_47: ',' | ')' | ':'
+static void *
+_tmp_47_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // ','
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','"));
+    }
+    { // ')'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 8))  // token=')'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
+    }
+    { // ':'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop1_48: except_block
+static asdl_seq *
+_loop1_48_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // except_block
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop1_48[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "except_block"));
+        excepthandler_ty except_block_var;
+        while (
+            (except_block_var = except_block_rule(p))  // except_block
+        )
+        {
+            _res = except_block_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop1_48[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_block"));
+    }
+    if (_n == 0 || p->error_indicator) {
+        PyMem_Free(_children);
+        p->level--;
+        return NULL;
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop1_48_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _tmp_49: 'as' NAME
+static void *
+_tmp_49_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // 'as' NAME
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_49[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
+        Token * _keyword;
+        expr_ty z;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 520))  // token='as'
+            &&
+            (z = _PyPegen_name_token(p))  // NAME
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_49[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
+            _res = z;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_49[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop1_50: case_block
+static asdl_seq *
+_loop1_50_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // case_block
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop1_50[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "case_block"));
+        match_case_ty case_block_var;
+        while (
+            (case_block_var = case_block_rule(p))  // case_block
+        )
+        {
+            _res = case_block_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop1_50[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "case_block"));
+    }
+    if (_n == 0 || p->error_indicator) {
+        PyMem_Free(_children);
+        p->level--;
+        return NULL;
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop1_50_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop0_52: '|' closed_pattern
+static asdl_seq *
+_loop0_52_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // '|' closed_pattern
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_52[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|' closed_pattern"));
+        Token * _literal;
+        pattern_ty elem;
+        while (
+            (_literal = _PyPegen_expect_token(p, 18))  // token='|'
+            &&
+            (elem = closed_pattern_rule(p))  // closed_pattern
+        )
+        {
+            _res = elem;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                PyMem_Free(_children);
+                p->level--;
+                return NULL;
+            }
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_52[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|' closed_pattern"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_52_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _gather_51: closed_pattern _loop0_52
+static asdl_seq *
+_gather_51_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq * _res = NULL;
+    int _mark = p->mark;
+    { // closed_pattern _loop0_52
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _gather_51[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "closed_pattern _loop0_52"));
+        pattern_ty elem;
+        asdl_seq * seq;
+        if (
+            (elem = closed_pattern_rule(p))  // closed_pattern
+            &&
+            (seq = _loop0_52_rule(p))  // _loop0_52
+        )
+        {
+            D(fprintf(stderr, "%*c+ _gather_51[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "closed_pattern _loop0_52"));
+            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _gather_51[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "closed_pattern _loop0_52"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_53: '+' | '-'
+static void *
+_tmp_53_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // '+'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+'"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 14))  // token='+'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_53[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+'"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_53[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+'"));
+    }
+    { // '-'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-'"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 15))  // token='-'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_53[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-'"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_53[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_54: '+' | '-'
+static void *
+_tmp_54_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // '+'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+'"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 14))  // token='+'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_54[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+'"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_54[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+'"));
+    }
+    { // '-'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-'"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 15))  // token='-'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_54[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-'"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_54[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_55: '.' | '(' | '='
+static void *
+_tmp_55_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // '.'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 23))  // token='.'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_55[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_55[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
+    }
+    { // '('
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_55[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_55[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('"));
+    }
+    { // '='
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 22))  // token='='
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_55[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_55[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'='"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_56: '.' | '(' | '='
+static void *
+_tmp_56_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // '.'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 23))  // token='.'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_56[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_56[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
+    }
+    { // '('
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_56[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_56[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('"));
+    }
+    { // '='
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 22))  // token='='
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_56[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_56[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'='"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop0_58: ',' maybe_star_pattern
+static asdl_seq *
+_loop0_58_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ',' maybe_star_pattern
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_58[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' maybe_star_pattern"));
+        Token * _literal;
+        pattern_ty elem;
+        while (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (elem = maybe_star_pattern_rule(p))  // maybe_star_pattern
+        )
+        {
+            _res = elem;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                PyMem_Free(_children);
+                p->level--;
+                return NULL;
+            }
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_58[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' maybe_star_pattern"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_58_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _gather_57: maybe_star_pattern _loop0_58
+static asdl_seq *
+_gather_57_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq * _res = NULL;
+    int _mark = p->mark;
+    { // maybe_star_pattern _loop0_58
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _gather_57[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern _loop0_58"));
+        pattern_ty elem;
+        asdl_seq * seq;
+        if (
+            (elem = maybe_star_pattern_rule(p))  // maybe_star_pattern
+            &&
+            (seq = _loop0_58_rule(p))  // _loop0_58
+        )
+        {
+            D(fprintf(stderr, "%*c+ _gather_57[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern _loop0_58"));
+            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _gather_57[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "maybe_star_pattern _loop0_58"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop0_60: ',' key_value_pattern
+static asdl_seq *
+_loop0_60_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ',' key_value_pattern
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_60[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' key_value_pattern"));
+        Token * _literal;
+        KeyPatternPair* elem;
+        while (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (elem = key_value_pattern_rule(p))  // key_value_pattern
+        )
+        {
+            _res = elem;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                PyMem_Free(_children);
+                p->level--;
+                return NULL;
+            }
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_60[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' key_value_pattern"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_60_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _gather_59: key_value_pattern _loop0_60
+static asdl_seq *
+_gather_59_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq * _res = NULL;
+    int _mark = p->mark;
+    { // key_value_pattern _loop0_60
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _gather_59[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_60"));
+        KeyPatternPair* elem;
+        asdl_seq * seq;
+        if (
+            (elem = key_value_pattern_rule(p))  // key_value_pattern
+            &&
+            (seq = _loop0_60_rule(p))  // _loop0_60
+        )
+        {
+            D(fprintf(stderr, "%*c+ _gather_59[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_60"));
+            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _gather_59[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "key_value_pattern _loop0_60"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_61: literal_expr | attr
+static void *
+_tmp_61_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // literal_expr
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_61[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_expr"));
+        expr_ty literal_expr_var;
+        if (
+            (literal_expr_var = literal_expr_rule(p))  // literal_expr
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_61[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "literal_expr"));
+            _res = literal_expr_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_61[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "literal_expr"));
+    }
+    { // attr
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_61[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "attr"));
+        expr_ty attr_var;
+        if (
+            (attr_var = attr_rule(p))  // attr
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_61[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "attr"));
+            _res = attr_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_61[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "attr"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop0_63: ',' pattern
+static asdl_seq *
+_loop0_63_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ',' pattern
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_63[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern"));
+        Token * _literal;
+        pattern_ty elem;
+        while (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (elem = pattern_rule(p))  // pattern
+        )
+        {
+            _res = elem;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                PyMem_Free(_children);
+                p->level--;
+                return NULL;
+            }
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_63[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_63_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _gather_62: pattern _loop0_63
+static asdl_seq *
+_gather_62_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq * _res = NULL;
+    int _mark = p->mark;
+    { // pattern _loop0_63
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _gather_62[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_63"));
+        pattern_ty elem;
+        asdl_seq * seq;
+        if (
+            (elem = pattern_rule(p))  // pattern
+            &&
+            (seq = _loop0_63_rule(p))  // _loop0_63
+        )
+        {
+            D(fprintf(stderr, "%*c+ _gather_62[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_63"));
+            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _gather_62[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_63"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop0_65: ',' keyword_pattern
+static asdl_seq *
+_loop0_65_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ',' keyword_pattern
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern"));
+        Token * _literal;
+        KeyPatternPair* elem;
+        while (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (elem = keyword_pattern_rule(p))  // keyword_pattern
+        )
+        {
+            _res = elem;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                PyMem_Free(_children);
+                p->level--;
+                return NULL;
+            }
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_65[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' keyword_pattern"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_65_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _gather_64: keyword_pattern _loop0_65
+static asdl_seq *
+_gather_64_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq * _res = NULL;
+    int _mark = p->mark;
+    { // keyword_pattern _loop0_65
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _gather_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_65"));
+        KeyPatternPair* elem;
+        asdl_seq * seq;
+        if (
+            (elem = keyword_pattern_rule(p))  // keyword_pattern
+            &&
+            (seq = _loop0_65_rule(p))  // _loop0_65
+        )
+        {
+            D(fprintf(stderr, "%*c+ _gather_64[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_65"));
+            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _gather_64[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern _loop0_65"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_66: 'from' expression
+static void *
+_tmp_66_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // 'from' expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' expression"));
+        Token * _keyword;
+        expr_ty z;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 514))  // token='from'
+            &&
+            (z = expression_rule(p))  // expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_66[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' expression"));
+            _res = z;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_66[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' expression"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_67: '->' expression
+static void *
+_tmp_67_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // '->' expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression"));
+        Token * _literal;
+        expr_ty z;
+        if (
+            (_literal = _PyPegen_expect_token(p, 51))  // token='->'
+            &&
+            (z = expression_rule(p))  // expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_67[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression"));
+            _res = z;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_67[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_68: '->' expression
+static void *
+_tmp_68_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // '->' expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression"));
+        Token * _literal;
+        expr_ty z;
+        if (
+            (_literal = _PyPegen_expect_token(p, 51))  // token='->'
+            &&
+            (z = expression_rule(p))  // expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_68[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression"));
+            _res = z;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_68[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_69: NEWLINE INDENT
+static void *
+_tmp_69_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // NEWLINE INDENT
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT"));
+        Token * indent_var;
+        Token * newline_var;
+        if (
+            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+            &&
+            (indent_var = _PyPegen_expect_token(p, INDENT))  // token='INDENT'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT"));
+            _res = _PyPegen_dummy_name(p, newline_var, indent_var);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_69[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop0_70: param_no_default
+static asdl_seq *
+_loop0_70_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // param_no_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_70[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
+        arg_ty param_no_default_var;
+        while (
+            (param_no_default_var = param_no_default_rule(p))  // param_no_default
+        )
+        {
+            _res = param_no_default_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_70[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_70_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop0_71: param_with_default
+static asdl_seq *
+_loop0_71_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // param_with_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
+        NameDefaultPair* param_with_default_var;
+        while (
+            (param_with_default_var = param_with_default_rule(p))  // param_with_default
+        )
+        {
+            _res = param_with_default_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_71[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_71_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop0_72: param_with_default
+static asdl_seq *
+_loop0_72_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // param_with_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
+        NameDefaultPair* param_with_default_var;
+        while (
+            (param_with_default_var = param_with_default_rule(p))  // param_with_default
+        )
+        {
+            _res = param_with_default_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_72[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_72_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop1_73: param_no_default
+static asdl_seq *
+_loop1_73_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // param_no_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop1_73[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
+        arg_ty param_no_default_var;
+        while (
+            (param_no_default_var = param_no_default_rule(p))  // param_no_default
+        )
+        {
+            _res = param_no_default_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop1_73[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
+    }
+    if (_n == 0 || p->error_indicator) {
+        PyMem_Free(_children);
+        p->level--;
+        return NULL;
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop1_73_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop0_74: param_with_default
+static asdl_seq *
+_loop0_74_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // param_with_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_74[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
+        NameDefaultPair* param_with_default_var;
+        while (
+            (param_with_default_var = param_with_default_rule(p))  // param_with_default
+        )
+        {
+            _res = param_with_default_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_74[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_74_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop1_75: param_with_default
+static asdl_seq *
+_loop1_75_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // param_with_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop1_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
+        NameDefaultPair* param_with_default_var;
+        while (
+            (param_with_default_var = param_with_default_rule(p))  // param_with_default
+        )
+        {
+            _res = param_with_default_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop1_75[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
+    }
+    if (_n == 0 || p->error_indicator) {
+        PyMem_Free(_children);
+        p->level--;
+        return NULL;
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop1_75_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop1_76: param_no_default
+static asdl_seq *
+_loop1_76_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // param_no_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop1_76[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
+        arg_ty param_no_default_var;
+        while (
+            (param_no_default_var = param_no_default_rule(p))  // param_no_default
+        )
+        {
+            _res = param_no_default_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop1_76[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
+    }
+    if (_n == 0 || p->error_indicator) {
+        PyMem_Free(_children);
+        p->level--;
+        return NULL;
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop1_76_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop1_77: param_no_default
+static asdl_seq *
+_loop1_77_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // param_no_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop1_77[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
+        arg_ty param_no_default_var;
+        while (
+            (param_no_default_var = param_no_default_rule(p))  // param_no_default
+        )
+        {
+            _res = param_no_default_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop1_77[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
+    }
+    if (_n == 0 || p->error_indicator) {
+        PyMem_Free(_children);
+        p->level--;
+        return NULL;
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop1_77_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop0_78: param_no_default
+static asdl_seq *
+_loop0_78_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // param_no_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_78[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
+        arg_ty param_no_default_var;
+        while (
+            (param_no_default_var = param_no_default_rule(p))  // param_no_default
+        )
+        {
+            _res = param_no_default_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_78[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_78_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop1_79: param_with_default
+static asdl_seq *
+_loop1_79_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // param_with_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop1_79[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
+        NameDefaultPair* param_with_default_var;
+        while (
+            (param_with_default_var = param_with_default_rule(p))  // param_with_default
+        )
+        {
+            _res = param_with_default_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop1_79[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
+    }
+    if (_n == 0 || p->error_indicator) {
+        PyMem_Free(_children);
+        p->level--;
+        return NULL;
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop1_79_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop0_80: param_no_default
+static asdl_seq *
+_loop0_80_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // param_no_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_80[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
+        arg_ty param_no_default_var;
+        while (
+            (param_no_default_var = param_no_default_rule(p))  // param_no_default
+        )
+        {
+            _res = param_no_default_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_80[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_80_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop1_81: param_with_default
+static asdl_seq *
+_loop1_81_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // param_with_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop1_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
+        NameDefaultPair* param_with_default_var;
+        while (
+            (param_with_default_var = param_with_default_rule(p))  // param_with_default
+        )
+        {
+            _res = param_with_default_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop1_81[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
+    }
+    if (_n == 0 || p->error_indicator) {
+        PyMem_Free(_children);
+        p->level--;
+        return NULL;
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop1_81_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop0_82: param_maybe_default
+static asdl_seq *
+_loop0_82_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // param_maybe_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default"));
+        NameDefaultPair* param_maybe_default_var;
+        while (
+            (param_maybe_default_var = param_maybe_default_rule(p))  // param_maybe_default
+        )
+        {
+            _res = param_maybe_default_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_82[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_82_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop1_83: param_maybe_default
+static asdl_seq *
+_loop1_83_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // param_maybe_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop1_83[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default"));
+        NameDefaultPair* param_maybe_default_var;
+        while (
+            (param_maybe_default_var = param_maybe_default_rule(p))  // param_maybe_default
+        )
+        {
+            _res = param_maybe_default_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop1_83[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default"));
+    }
+    if (_n == 0 || p->error_indicator) {
+        PyMem_Free(_children);
+        p->level--;
+        return NULL;
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop1_83_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop1_84: ('@' named_expression NEWLINE)
+static asdl_seq *
+_loop1_84_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ('@' named_expression NEWLINE)
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop1_84[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)"));
+        void *_tmp_184_var;
+        while (
+            (_tmp_184_var = _tmp_184_rule(p))  // '@' named_expression NEWLINE
+        )
+        {
+            _res = _tmp_184_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop1_84[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('@' named_expression NEWLINE)"));
+    }
+    if (_n == 0 || p->error_indicator) {
+        PyMem_Free(_children);
+        p->level--;
+        return NULL;
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop1_84_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _tmp_85: '(' arguments? ')'
+static void *
+_tmp_85_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // '(' arguments? ')'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_85[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'"));
+        Token * _literal;
+        Token * _literal_1;
+        void *z;
+        if (
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+            &&
+            (z = arguments_rule(p), !p->error_indicator)  // arguments?
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_85[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'"));
+            _res = z;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_85[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' arguments? ')'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop1_86: (',' star_expression)
+static asdl_seq *
+_loop1_86_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // (',' star_expression)
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop1_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)"));
+        void *_tmp_185_var;
+        while (
+            (_tmp_185_var = _tmp_185_rule(p))  // ',' star_expression
+        )
+        {
+            _res = _tmp_185_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop1_86[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_expression)"));
+    }
+    if (_n == 0 || p->error_indicator) {
+        PyMem_Free(_children);
+        p->level--;
+        return NULL;
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop1_86_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop0_88: ',' star_named_expression
+static asdl_seq *
+_loop0_88_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ',' star_named_expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_named_expression"));
+        Token * _literal;
+        expr_ty elem;
+        while (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (elem = star_named_expression_rule(p))  // star_named_expression
+        )
+        {
+            _res = elem;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                PyMem_Free(_children);
+                p->level--;
+                return NULL;
+            }
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_88[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_named_expression"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_88_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _gather_87: star_named_expression _loop0_88
+static asdl_seq *
+_gather_87_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq * _res = NULL;
+    int _mark = p->mark;
+    { // star_named_expression _loop0_88
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _gather_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_88"));
+        expr_ty elem;
+        asdl_seq * seq;
+        if (
+            (elem = star_named_expression_rule(p))  // star_named_expression
+            &&
+            (seq = _loop0_88_rule(p))  // _loop0_88
+        )
+        {
+            D(fprintf(stderr, "%*c+ _gather_87[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_88"));
+            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _gather_87[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_88"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop1_89: (',' expression)
+static asdl_seq *
+_loop1_89_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // (',' expression)
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop1_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)"));
+        void *_tmp_186_var;
+        while (
+            (_tmp_186_var = _tmp_186_rule(p))  // ',' expression
+        )
+        {
+            _res = _tmp_186_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop1_89[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' expression)"));
+    }
+    if (_n == 0 || p->error_indicator) {
+        PyMem_Free(_children);
+        p->level--;
+        return NULL;
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop1_89_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop0_90: lambda_param_no_default
+static asdl_seq *
+_loop0_90_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // lambda_param_no_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
+        arg_ty lambda_param_no_default_var;
+        while (
+            (lambda_param_no_default_var = lambda_param_no_default_rule(p))  // lambda_param_no_default
+        )
+        {
+            _res = lambda_param_no_default_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_90[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_90_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop0_91: lambda_param_with_default
+static asdl_seq *
+_loop0_91_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // lambda_param_with_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
+        NameDefaultPair* lambda_param_with_default_var;
+        while (
+            (lambda_param_with_default_var = lambda_param_with_default_rule(p))  // lambda_param_with_default
+        )
+        {
+            _res = lambda_param_with_default_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_91[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_91_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop0_92: lambda_param_with_default
+static asdl_seq *
+_loop0_92_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // lambda_param_with_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_92[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
+        NameDefaultPair* lambda_param_with_default_var;
+        while (
+            (lambda_param_with_default_var = lambda_param_with_default_rule(p))  // lambda_param_with_default
+        )
+        {
+            _res = lambda_param_with_default_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_92[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_92_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop1_93: lambda_param_no_default
+static asdl_seq *
+_loop1_93_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // lambda_param_no_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop1_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
+        arg_ty lambda_param_no_default_var;
+        while (
+            (lambda_param_no_default_var = lambda_param_no_default_rule(p))  // lambda_param_no_default
+        )
+        {
+            _res = lambda_param_no_default_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop1_93[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
+    }
+    if (_n == 0 || p->error_indicator) {
+        PyMem_Free(_children);
+        p->level--;
+        return NULL;
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop1_93_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop0_94: lambda_param_with_default
+static asdl_seq *
+_loop0_94_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // lambda_param_with_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_94[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
+        NameDefaultPair* lambda_param_with_default_var;
+        while (
+            (lambda_param_with_default_var = lambda_param_with_default_rule(p))  // lambda_param_with_default
+        )
+        {
+            _res = lambda_param_with_default_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_94[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_94_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop1_95: lambda_param_with_default
+static asdl_seq *
+_loop1_95_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // lambda_param_with_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop1_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
+        NameDefaultPair* lambda_param_with_default_var;
+        while (
+            (lambda_param_with_default_var = lambda_param_with_default_rule(p))  // lambda_param_with_default
+        )
+        {
+            _res = lambda_param_with_default_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop1_95[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
+    }
+    if (_n == 0 || p->error_indicator) {
+        PyMem_Free(_children);
+        p->level--;
+        return NULL;
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop1_95_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop1_96: lambda_param_no_default
+static asdl_seq *
+_loop1_96_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // lambda_param_no_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop1_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
+        arg_ty lambda_param_no_default_var;
+        while (
+            (lambda_param_no_default_var = lambda_param_no_default_rule(p))  // lambda_param_no_default
+        )
+        {
+            _res = lambda_param_no_default_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop1_96[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
+    }
+    if (_n == 0 || p->error_indicator) {
+        PyMem_Free(_children);
+        p->level--;
+        return NULL;
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop1_96_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop1_97: lambda_param_no_default
+static asdl_seq *
+_loop1_97_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // lambda_param_no_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop1_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
+        arg_ty lambda_param_no_default_var;
+        while (
+            (lambda_param_no_default_var = lambda_param_no_default_rule(p))  // lambda_param_no_default
+        )
+        {
+            _res = lambda_param_no_default_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop1_97[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
+    }
+    if (_n == 0 || p->error_indicator) {
+        PyMem_Free(_children);
+        p->level--;
+        return NULL;
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop1_97_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop0_98: lambda_param_no_default
+static asdl_seq *
+_loop0_98_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // lambda_param_no_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
+        arg_ty lambda_param_no_default_var;
+        while (
+            (lambda_param_no_default_var = lambda_param_no_default_rule(p))  // lambda_param_no_default
+        )
+        {
+            _res = lambda_param_no_default_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_98[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_98_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop1_99: lambda_param_with_default
+static asdl_seq *
+_loop1_99_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // lambda_param_with_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop1_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
+        NameDefaultPair* lambda_param_with_default_var;
+        while (
+            (lambda_param_with_default_var = lambda_param_with_default_rule(p))  // lambda_param_with_default
+        )
+        {
+            _res = lambda_param_with_default_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop1_99[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
+    }
+    if (_n == 0 || p->error_indicator) {
+        PyMem_Free(_children);
+        p->level--;
+        return NULL;
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop1_99_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop0_100: lambda_param_no_default
+static asdl_seq *
+_loop0_100_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // lambda_param_no_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_100[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
+        arg_ty lambda_param_no_default_var;
+        while (
+            (lambda_param_no_default_var = lambda_param_no_default_rule(p))  // lambda_param_no_default
+        )
+        {
+            _res = lambda_param_no_default_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_100[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_100_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop1_101: lambda_param_with_default
+static asdl_seq *
+_loop1_101_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // lambda_param_with_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop1_101[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
+        NameDefaultPair* lambda_param_with_default_var;
+        while (
+            (lambda_param_with_default_var = lambda_param_with_default_rule(p))  // lambda_param_with_default
+        )
+        {
+            _res = lambda_param_with_default_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop1_101[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
+    }
+    if (_n == 0 || p->error_indicator) {
+        PyMem_Free(_children);
+        p->level--;
+        return NULL;
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop1_101_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop0_102: lambda_param_maybe_default
+static asdl_seq *
+_loop0_102_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // lambda_param_maybe_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default"));
+        NameDefaultPair* lambda_param_maybe_default_var;
+        while (
+            (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p))  // lambda_param_maybe_default
+        )
+        {
+            _res = lambda_param_maybe_default_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_102[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_102_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop1_103: lambda_param_maybe_default
+static asdl_seq *
+_loop1_103_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // lambda_param_maybe_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop1_103[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default"));
+        NameDefaultPair* lambda_param_maybe_default_var;
+        while (
+            (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p))  // lambda_param_maybe_default
+        )
+        {
+            _res = lambda_param_maybe_default_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop1_103[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default"));
+    }
+    if (_n == 0 || p->error_indicator) {
+        PyMem_Free(_children);
+        p->level--;
+        return NULL;
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop1_103_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop1_104: ('or' conjunction)
+static asdl_seq *
+_loop1_104_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ('or' conjunction)
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop1_104[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)"));
+        void *_tmp_187_var;
+        while (
+            (_tmp_187_var = _tmp_187_rule(p))  // 'or' conjunction
+        )
+        {
+            _res = _tmp_187_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop1_104[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('or' conjunction)"));
+    }
+    if (_n == 0 || p->error_indicator) {
+        PyMem_Free(_children);
+        p->level--;
+        return NULL;
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop1_104_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop1_105: ('and' inversion)
+static asdl_seq *
+_loop1_105_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ('and' inversion)
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop1_105[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)"));
+        void *_tmp_188_var;
+        while (
+            (_tmp_188_var = _tmp_188_rule(p))  // 'and' inversion
+        )
+        {
+            _res = _tmp_188_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop1_105[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('and' inversion)"));
+    }
+    if (_n == 0 || p->error_indicator) {
+        PyMem_Free(_children);
+        p->level--;
+        return NULL;
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop1_105_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop1_106: compare_op_bitwise_or_pair
+static asdl_seq *
+_loop1_106_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // compare_op_bitwise_or_pair
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop1_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compare_op_bitwise_or_pair"));
+        CmpopExprPair* compare_op_bitwise_or_pair_var;
+        while (
+            (compare_op_bitwise_or_pair_var = compare_op_bitwise_or_pair_rule(p))  // compare_op_bitwise_or_pair
+        )
+        {
+            _res = compare_op_bitwise_or_pair_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop1_106[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compare_op_bitwise_or_pair"));
+    }
+    if (_n == 0 || p->error_indicator) {
+        PyMem_Free(_children);
+        p->level--;
+        return NULL;
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop1_106_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _tmp_107: '!='
+static void *
+_tmp_107_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // '!='
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='"));
+        Token * tok;
+        if (
+            (tok = _PyPegen_expect_token(p, 28))  // token='!='
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_107[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='"));
+            _res = _PyPegen_check_barry_as_flufl ( p , tok ) ? NULL : tok;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_107[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!='"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop0_109: ',' slice
+static asdl_seq *
+_loop0_109_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ',' slice
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' slice"));
+        Token * _literal;
+        expr_ty elem;
+        while (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (elem = slice_rule(p))  // slice
+        )
+        {
+            _res = elem;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                PyMem_Free(_children);
+                p->level--;
+                return NULL;
+            }
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_109[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' slice"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_109_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _gather_108: slice _loop0_109
+static asdl_seq *
+_gather_108_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq * _res = NULL;
+    int _mark = p->mark;
+    { // slice _loop0_109
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _gather_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice _loop0_109"));
+        expr_ty elem;
+        asdl_seq * seq;
+        if (
+            (elem = slice_rule(p))  // slice
+            &&
+            (seq = _loop0_109_rule(p))  // _loop0_109
+        )
+        {
+            D(fprintf(stderr, "%*c+ _gather_108[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice _loop0_109"));
+            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _gather_108[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice _loop0_109"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_110: ':' expression?
+static void *
+_tmp_110_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // ':' expression?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?"));
+        Token * _literal;
+        void *d;
+        if (
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+            &&
+            (d = expression_rule(p), !p->error_indicator)  // expression?
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_110[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?"));
+            _res = d;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_110[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression?"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_111: tuple | group | genexp
+static void *
+_tmp_111_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // tuple
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple"));
+        expr_ty tuple_var;
+        if (
+            (tuple_var = tuple_rule(p))  // tuple
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_111[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple"));
+            _res = tuple_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_111[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple"));
+    }
+    { // group
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group"));
+        expr_ty group_var;
+        if (
+            (group_var = group_rule(p))  // group
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_111[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group"));
+            _res = group_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_111[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group"));
+    }
+    { // genexp
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp"));
+        expr_ty genexp_var;
+        if (
+            (genexp_var = genexp_rule(p))  // genexp
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_111[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp"));
+            _res = genexp_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_111[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "genexp"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_112: list | listcomp
+static void *
+_tmp_112_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // list
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list"));
+        expr_ty list_var;
+        if (
+            (list_var = list_rule(p))  // list
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_112[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list"));
+            _res = list_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_112[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list"));
+    }
+    { // listcomp
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp"));
+        expr_ty listcomp_var;
+        if (
+            (listcomp_var = listcomp_rule(p))  // listcomp
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_112[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "listcomp"));
+            _res = listcomp_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_112[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "listcomp"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_113: dict | set | dictcomp | setcomp
+static void *
+_tmp_113_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // dict
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict"));
+        expr_ty dict_var;
+        if (
+            (dict_var = dict_rule(p))  // dict
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dict"));
+            _res = dict_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_113[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dict"));
+    }
+    { // set
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set"));
+        expr_ty set_var;
+        if (
+            (set_var = set_rule(p))  // set
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set"));
+            _res = set_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_113[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "set"));
+    }
+    { // dictcomp
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp"));
+        expr_ty dictcomp_var;
+        if (
+            (dictcomp_var = dictcomp_rule(p))  // dictcomp
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dictcomp"));
+            _res = dictcomp_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_113[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dictcomp"));
+    }
+    { // setcomp
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp"));
+        expr_ty setcomp_var;
+        if (
+            (setcomp_var = setcomp_rule(p))  // setcomp
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "setcomp"));
+            _res = setcomp_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_113[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "setcomp"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop1_114: STRING
+static asdl_seq *
+_loop1_114_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // STRING
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop1_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING"));
+        expr_ty string_var;
+        while (
+            (string_var = _PyPegen_string_token(p))  // STRING
+        )
+        {
+            _res = string_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop1_114[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING"));
+    }
+    if (_n == 0 || p->error_indicator) {
+        PyMem_Free(_children);
+        p->level--;
+        return NULL;
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop1_114_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _tmp_115: star_named_expression ',' star_named_expressions?
+static void *
+_tmp_115_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // star_named_expression ',' star_named_expressions?
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
+        Token * _literal;
+        expr_ty y;
+        void *z;
+        if (
+            (y = star_named_expression_rule(p))  // star_named_expression
+            &&
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (z = star_named_expressions_rule(p), !p->error_indicator)  // star_named_expressions?
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_115[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
+            _res = _PyPegen_seq_insert_in_front ( p , y , z );
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_115[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_116: yield_expr | named_expression
+static void *
+_tmp_116_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // yield_expr
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
+        expr_ty yield_expr_var;
+        if (
+            (yield_expr_var = yield_expr_rule(p))  // yield_expr
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_116[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
+            _res = yield_expr_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_116[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
+    }
+    { // named_expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression"));
+        expr_ty named_expression_var;
+        if (
+            (named_expression_var = named_expression_rule(p))  // named_expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_116[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression"));
+            _res = named_expression_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_116[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_117: assignment_expression | expression !':='
+static void *
+_tmp_117_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // assignment_expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "assignment_expression"));
+        expr_ty assignment_expression_var;
+        if (
+            (assignment_expression_var = assignment_expression_rule(p))  // assignment_expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "assignment_expression"));
+            _res = assignment_expression_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_117[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "assignment_expression"));
+    }
+    { // expression !':='
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !':='"));
+        expr_ty expression_var;
+        if (
+            (expression_var = expression_rule(p))  // expression
+            &&
+            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53)  // token=':='
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression !':='"));
+            _res = expression_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_117[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression !':='"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop0_119: ',' double_starred_kvpair
+static asdl_seq *
+_loop0_119_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ',' double_starred_kvpair
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair"));
+        Token * _literal;
+        KeyValuePair* elem;
+        while (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (elem = double_starred_kvpair_rule(p))  // double_starred_kvpair
+        )
+        {
+            _res = elem;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                PyMem_Free(_children);
+                p->level--;
+                return NULL;
+            }
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_119[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_119_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _gather_118: double_starred_kvpair _loop0_119
+static asdl_seq *
+_gather_118_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq * _res = NULL;
+    int _mark = p->mark;
+    { // double_starred_kvpair _loop0_119
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _gather_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_119"));
+        KeyValuePair* elem;
+        asdl_seq * seq;
+        if (
+            (elem = double_starred_kvpair_rule(p))  // double_starred_kvpair
+            &&
+            (seq = _loop0_119_rule(p))  // _loop0_119
+        )
+        {
+            D(fprintf(stderr, "%*c+ _gather_118[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_119"));
+            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _gather_118[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_119"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop1_120: for_if_clause
+static asdl_seq *
+_loop1_120_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // for_if_clause
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop1_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause"));
+        comprehension_ty for_if_clause_var;
+        while (
+            (for_if_clause_var = for_if_clause_rule(p))  // for_if_clause
+        )
+        {
+            _res = for_if_clause_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop1_120[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause"));
+    }
+    if (_n == 0 || p->error_indicator) {
+        PyMem_Free(_children);
+        p->level--;
+        return NULL;
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop1_120_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop0_121: ('if' disjunction)
+static asdl_seq *
+_loop0_121_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ('if' disjunction)
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)"));
+        void *_tmp_189_var;
+        while (
+            (_tmp_189_var = _tmp_189_rule(p))  // 'if' disjunction
+        )
+        {
+            _res = _tmp_189_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_121[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_121_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop0_122: ('if' disjunction)
+static asdl_seq *
+_loop0_122_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ('if' disjunction)
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)"));
+        void *_tmp_190_var;
+        while (
+            (_tmp_190_var = _tmp_190_rule(p))  // 'if' disjunction
+        )
+        {
+            _res = _tmp_190_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_122[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_122_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop0_124: ',' (starred_expression | (assignment_expression | expression !':=') !'=')
+static asdl_seq *
+_loop0_124_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ',' (starred_expression | (assignment_expression | expression !':=') !'=')
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (starred_expression | (assignment_expression | expression !':=') !'=')"));
+        Token * _literal;
+        void *elem;
+        while (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (elem = _tmp_191_rule(p))  // starred_expression | (assignment_expression | expression !':=') !'='
+        )
+        {
+            _res = elem;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                PyMem_Free(_children);
+                p->level--;
+                return NULL;
+            }
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_124[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (starred_expression | (assignment_expression | expression !':=') !'=')"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_124_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _gather_123:
+//     | (starred_expression | (assignment_expression | expression !':=') !'=') _loop0_124
+static asdl_seq *
+_gather_123_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq * _res = NULL;
+    int _mark = p->mark;
+    { // (starred_expression | (assignment_expression | expression !':=') !'=') _loop0_124
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _gather_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(starred_expression | (assignment_expression | expression !':=') !'=') _loop0_124"));
+        void *elem;
+        asdl_seq * seq;
+        if (
+            (elem = _tmp_191_rule(p))  // starred_expression | (assignment_expression | expression !':=') !'='
+            &&
+            (seq = _loop0_124_rule(p))  // _loop0_124
+        )
+        {
+            D(fprintf(stderr, "%*c+ _gather_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(starred_expression | (assignment_expression | expression !':=') !'=') _loop0_124"));
+            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _gather_123[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(starred_expression | (assignment_expression | expression !':=') !'=') _loop0_124"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_125: ',' kwargs
+static void *
+_tmp_125_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // ',' kwargs
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwargs"));
+        Token * _literal;
+        asdl_seq* k;
+        if (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (k = kwargs_rule(p))  // kwargs
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' kwargs"));
+            _res = k;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwargs"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop0_127: ',' kwarg_or_starred
+static asdl_seq *
+_loop0_127_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ',' kwarg_or_starred
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred"));
+        Token * _literal;
+        KeywordOrStarred* elem;
+        while (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (elem = kwarg_or_starred_rule(p))  // kwarg_or_starred
+        )
+        {
+            _res = elem;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                PyMem_Free(_children);
+                p->level--;
+                return NULL;
+            }
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_127[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_127_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _gather_126: kwarg_or_starred _loop0_127
+static asdl_seq *
+_gather_126_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq * _res = NULL;
+    int _mark = p->mark;
+    { // kwarg_or_starred _loop0_127
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _gather_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_127"));
+        KeywordOrStarred* elem;
+        asdl_seq * seq;
+        if (
+            (elem = kwarg_or_starred_rule(p))  // kwarg_or_starred
+            &&
+            (seq = _loop0_127_rule(p))  // _loop0_127
+        )
+        {
+            D(fprintf(stderr, "%*c+ _gather_126[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_127"));
+            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _gather_126[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_127"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop0_129: ',' kwarg_or_double_starred
+static asdl_seq *
+_loop0_129_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ',' kwarg_or_double_starred
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred"));
+        Token * _literal;
+        KeywordOrStarred* elem;
+        while (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (elem = kwarg_or_double_starred_rule(p))  // kwarg_or_double_starred
+        )
+        {
+            _res = elem;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                PyMem_Free(_children);
+                p->level--;
+                return NULL;
+            }
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_129[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_129_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _gather_128: kwarg_or_double_starred _loop0_129
+static asdl_seq *
+_gather_128_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq * _res = NULL;
+    int _mark = p->mark;
+    { // kwarg_or_double_starred _loop0_129
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _gather_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_129"));
+        KeywordOrStarred* elem;
+        asdl_seq * seq;
+        if (
+            (elem = kwarg_or_double_starred_rule(p))  // kwarg_or_double_starred
+            &&
+            (seq = _loop0_129_rule(p))  // _loop0_129
+        )
+        {
+            D(fprintf(stderr, "%*c+ _gather_128[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_129"));
+            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _gather_128[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_129"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop0_131: ',' kwarg_or_starred
+static asdl_seq *
+_loop0_131_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ',' kwarg_or_starred
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred"));
+        Token * _literal;
+        KeywordOrStarred* elem;
+        while (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (elem = kwarg_or_starred_rule(p))  // kwarg_or_starred
+        )
+        {
+            _res = elem;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                PyMem_Free(_children);
+                p->level--;
+                return NULL;
+            }
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_131[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_131_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _gather_130: kwarg_or_starred _loop0_131
+static asdl_seq *
+_gather_130_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq * _res = NULL;
+    int _mark = p->mark;
+    { // kwarg_or_starred _loop0_131
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _gather_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_131"));
+        KeywordOrStarred* elem;
+        asdl_seq * seq;
+        if (
+            (elem = kwarg_or_starred_rule(p))  // kwarg_or_starred
+            &&
+            (seq = _loop0_131_rule(p))  // _loop0_131
+        )
+        {
+            D(fprintf(stderr, "%*c+ _gather_130[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_131"));
+            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _gather_130[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_131"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop0_133: ',' kwarg_or_double_starred
+static asdl_seq *
+_loop0_133_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ',' kwarg_or_double_starred
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred"));
+        Token * _literal;
+        KeywordOrStarred* elem;
+        while (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (elem = kwarg_or_double_starred_rule(p))  // kwarg_or_double_starred
+        )
+        {
+            _res = elem;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                PyMem_Free(_children);
+                p->level--;
+                return NULL;
+            }
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_133[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_133_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _gather_132: kwarg_or_double_starred _loop0_133
+static asdl_seq *
+_gather_132_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq * _res = NULL;
+    int _mark = p->mark;
+    { // kwarg_or_double_starred _loop0_133
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _gather_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_133"));
+        KeywordOrStarred* elem;
+        asdl_seq * seq;
+        if (
+            (elem = kwarg_or_double_starred_rule(p))  // kwarg_or_double_starred
+            &&
+            (seq = _loop0_133_rule(p))  // _loop0_133
+        )
+        {
+            D(fprintf(stderr, "%*c+ _gather_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_133"));
+            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _gather_132[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_133"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop0_134: (',' star_target)
+static asdl_seq *
+_loop0_134_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // (',' star_target)
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)"));
+        void *_tmp_192_var;
+        while (
+            (_tmp_192_var = _tmp_192_rule(p))  // ',' star_target
+        )
+        {
+            _res = _tmp_192_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_134[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_134_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop0_136: ',' star_target
+static asdl_seq *
+_loop0_136_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ',' star_target
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target"));
+        Token * _literal;
+        expr_ty elem;
+        while (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (elem = star_target_rule(p))  // star_target
+        )
+        {
+            _res = elem;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                PyMem_Free(_children);
+                p->level--;
+                return NULL;
+            }
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_136[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_136_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _gather_135: star_target _loop0_136
+static asdl_seq *
+_gather_135_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq * _res = NULL;
+    int _mark = p->mark;
+    { // star_target _loop0_136
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _gather_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target _loop0_136"));
+        expr_ty elem;
+        asdl_seq * seq;
+        if (
+            (elem = star_target_rule(p))  // star_target
+            &&
+            (seq = _loop0_136_rule(p))  // _loop0_136
+        )
+        {
+            D(fprintf(stderr, "%*c+ _gather_135[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target _loop0_136"));
+            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _gather_135[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_136"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop1_137: (',' star_target)
+static asdl_seq *
+_loop1_137_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // (',' star_target)
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop1_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)"));
+        void *_tmp_193_var;
+        while (
+            (_tmp_193_var = _tmp_193_rule(p))  // ',' star_target
+        )
+        {
+            _res = _tmp_193_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop1_137[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)"));
+    }
+    if (_n == 0 || p->error_indicator) {
+        PyMem_Free(_children);
+        p->level--;
+        return NULL;
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop1_137_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _tmp_138: !'*' star_target
+static void *
+_tmp_138_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // !'*' star_target
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target"));
+        expr_ty star_target_var;
+        if (
+            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 16)  // token='*'
+            &&
+            (star_target_var = star_target_rule(p))  // star_target
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!'*' star_target"));
+            _res = star_target_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_138[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!'*' star_target"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop0_140: ',' del_target
+static asdl_seq *
+_loop0_140_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ',' del_target
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target"));
+        Token * _literal;
+        expr_ty elem;
+        while (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (elem = del_target_rule(p))  // del_target
+        )
+        {
+            _res = elem;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                PyMem_Free(_children);
+                p->level--;
+                return NULL;
+            }
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_140[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' del_target"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_140_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _gather_139: del_target _loop0_140
+static asdl_seq *
+_gather_139_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq * _res = NULL;
+    int _mark = p->mark;
+    { // del_target _loop0_140
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _gather_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_target _loop0_140"));
+        expr_ty elem;
+        asdl_seq * seq;
+        if (
+            (elem = del_target_rule(p))  // del_target
+            &&
+            (seq = _loop0_140_rule(p))  // _loop0_140
+        )
+        {
+            D(fprintf(stderr, "%*c+ _gather_139[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_target _loop0_140"));
+            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _gather_139[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_140"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_141: args | expression for_if_clauses
+static void *
+_tmp_141_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // args
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args"));
+        expr_ty args_var;
+        if (
+            (args_var = args_rule(p))  // args
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args"));
+            _res = args_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args"));
+    }
+    { // expression for_if_clauses
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses"));
+        expr_ty expression_var;
+        asdl_comprehension_seq* for_if_clauses_var;
+        if (
+            (expression_var = expression_rule(p))  // expression
+            &&
+            (for_if_clauses_var = for_if_clauses_rule(p))  // for_if_clauses
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses"));
+            _res = _PyPegen_dummy_name(p, expression_var, for_if_clauses_var);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_142: 'True' | 'False' | 'None'
+static void *
+_tmp_142_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // 'True'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'"));
+        Token * _keyword;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 524))  // token='True'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_142[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'"));
+            _res = _keyword;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_142[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'"));
+    }
+    { // 'False'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'"));
+        Token * _keyword;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 525))  // token='False'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_142[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'"));
+            _res = _keyword;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_142[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'"));
+    }
+    { // 'None'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'"));
+        Token * _keyword;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 523))  // token='None'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_142[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'"));
+            _res = _keyword;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_142[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_143: NAME '='
+static void *
+_tmp_143_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // NAME '='
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '='"));
+        Token * _literal;
+        expr_ty name_var;
+        if (
+            (name_var = _PyPegen_name_token(p))  // NAME
+            &&
+            (_literal = _PyPegen_expect_token(p, 22))  // token='='
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '='"));
+            _res = _PyPegen_dummy_name(p, name_var, _literal);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_143[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '='"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_144: NAME STRING | SOFT_KEYWORD
+static void *
+_tmp_144_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // NAME STRING
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME STRING"));
+        expr_ty name_var;
+        expr_ty string_var;
+        if (
+            (name_var = _PyPegen_name_token(p))  // NAME
+            &&
+            (string_var = _PyPegen_string_token(p))  // STRING
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME STRING"));
+            _res = _PyPegen_dummy_name(p, name_var, string_var);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME STRING"));
+    }
+    { // SOFT_KEYWORD
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "SOFT_KEYWORD"));
+        expr_ty soft_keyword_var;
+        if (
+            (soft_keyword_var = _PyPegen_soft_keyword_token(p))  // SOFT_KEYWORD
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "SOFT_KEYWORD"));
+            _res = soft_keyword_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "SOFT_KEYWORD"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_145: 'else' | ':'
+static void *
+_tmp_145_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // 'else'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'else'"));
+        Token * _keyword;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 516))  // token='else'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'else'"));
+            _res = _keyword;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'else'"));
+    }
+    { // ':'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_146: '=' | ':='
+static void *
+_tmp_146_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // '='
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 22))  // token='='
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'='"));
+    }
+    { // ':='
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':='"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 53))  // token=':='
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':='"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':='"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_147: list | tuple | genexp | 'True' | 'None' | 'False'
+static void *
+_tmp_147_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // list
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list"));
+        expr_ty list_var;
+        if (
+            (list_var = list_rule(p))  // list
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list"));
+            _res = list_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list"));
+    }
+    { // tuple
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple"));
+        expr_ty tuple_var;
+        if (
+            (tuple_var = tuple_rule(p))  // tuple
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple"));
+            _res = tuple_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple"));
+    }
+    { // genexp
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp"));
+        expr_ty genexp_var;
+        if (
+            (genexp_var = genexp_rule(p))  // genexp
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp"));
+            _res = genexp_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "genexp"));
+    }
+    { // 'True'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'"));
+        Token * _keyword;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 524))  // token='True'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'"));
+            _res = _keyword;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'"));
+    }
+    { // 'None'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'"));
+        Token * _keyword;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 523))  // token='None'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'"));
+            _res = _keyword;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'"));
+    }
+    { // 'False'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'"));
+        Token * _keyword;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 525))  // token='False'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'"));
+            _res = _keyword;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_148: '=' | ':='
+static void *
+_tmp_148_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // '='
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 22))  // token='='
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'='"));
+    }
+    { // ':='
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':='"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 53))  // token=':='
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':='"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':='"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop0_149: star_named_expressions
+static asdl_seq *
+_loop0_149_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // star_named_expressions
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions"));
+        asdl_expr_seq* star_named_expressions_var;
+        while (
+            (star_named_expressions_var = star_named_expressions_rule(p))  // star_named_expressions
+        )
+        {
+            _res = star_named_expressions_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_149[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expressions"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_149_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop0_150: (star_targets '=')
+static asdl_seq *
+_loop0_150_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // (star_targets '=')
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
+        void *_tmp_194_var;
+        while (
+            (_tmp_194_var = _tmp_194_rule(p))  // star_targets '='
+        )
+        {
+            _res = _tmp_194_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_150[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_150_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop0_151: (star_targets '=')
+static asdl_seq *
+_loop0_151_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // (star_targets '=')
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
+        void *_tmp_195_var;
+        while (
+            (_tmp_195_var = _tmp_195_rule(p))  // star_targets '='
+        )
+        {
+            _res = _tmp_195_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_151[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_151_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _tmp_152: yield_expr | star_expressions
+static void *
+_tmp_152_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // yield_expr
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
+        expr_ty yield_expr_var;
+        if (
+            (yield_expr_var = yield_expr_rule(p))  // yield_expr
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_152[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
+            _res = yield_expr_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
+    }
+    { // star_expressions
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
+        expr_ty star_expressions_var;
+        if (
+            (star_expressions_var = star_expressions_rule(p))  // star_expressions
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_152[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
+            _res = star_expressions_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_153: '[' | '(' | '{'
+static void *
+_tmp_153_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // '['
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 9))  // token='['
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['"));
+    }
+    { // '('
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('"));
+    }
+    { // '{'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 25))  // token='{'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_154: '[' | '{'
+static void *
+_tmp_154_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // '['
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 9))  // token='['
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['"));
+    }
+    { // '{'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 25))  // token='{'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_155: '[' | '{'
+static void *
+_tmp_155_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // '['
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 9))  // token='['
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['"));
+    }
+    { // '{'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 25))  // token='{'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop0_156: param_no_default
+static asdl_seq *
+_loop0_156_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // param_no_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
+        arg_ty param_no_default_var;
+        while (
+            (param_no_default_var = param_no_default_rule(p))  // param_no_default
+        )
+        {
+            _res = param_no_default_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_156[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_156_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop1_157: param_with_default
+static asdl_seq *
+_loop1_157_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // param_with_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop1_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
+        NameDefaultPair* param_with_default_var;
+        while (
+            (param_with_default_var = param_with_default_rule(p))  // param_with_default
+        )
+        {
+            _res = param_with_default_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop1_157[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
+    }
+    if (_n == 0 || p->error_indicator) {
+        PyMem_Free(_children);
+        p->level--;
+        return NULL;
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop1_157_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop0_158: lambda_param_no_default
+static asdl_seq *
+_loop0_158_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // lambda_param_no_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
+        arg_ty lambda_param_no_default_var;
+        while (
+            (lambda_param_no_default_var = lambda_param_no_default_rule(p))  // lambda_param_no_default
+        )
+        {
+            _res = lambda_param_no_default_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_158[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_158_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _loop1_159: lambda_param_with_default
+static asdl_seq *
+_loop1_159_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // lambda_param_with_default
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop1_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
+        NameDefaultPair* lambda_param_with_default_var;
+        while (
+            (lambda_param_with_default_var = lambda_param_with_default_rule(p))  // lambda_param_with_default
+        )
+        {
+            _res = lambda_param_with_default_var;
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop1_159[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
+    }
+    if (_n == 0 || p->error_indicator) {
+        PyMem_Free(_children);
+        p->level--;
+        return NULL;
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop1_159_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _tmp_160: ')' | ',' (')' | '**')
+static void *
+_tmp_160_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // ')'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 8))  // token=')'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_160[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_160[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
+    }
+    { // ',' (')' | '**')
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')"));
+        Token * _literal;
+        void *_tmp_196_var;
+        if (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (_tmp_196_var = _tmp_196_rule(p))  // ')' | '**'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_160[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')"));
+            _res = _PyPegen_dummy_name(p, _literal, _tmp_196_var);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_160[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (')' | '**')"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_161: ':' | ',' (':' | '**')
+static void *
+_tmp_161_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // ':'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
+    }
+    { // ',' (':' | '**')
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')"));
+        Token * _literal;
+        void *_tmp_197_var;
+        if (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (_tmp_197_var = _tmp_197_rule(p))  // ':' | '**'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')"));
+            _res = _PyPegen_dummy_name(p, _literal, _tmp_197_var);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (':' | '**')"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_162: ',' | ')' | ':'
+static void *
+_tmp_162_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // ','
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','"));
+    }
+    { // ')'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 8))  // token=')'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
+    }
+    { // ':'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop0_164: ',' (expression ['as' star_target])
+static asdl_seq *
+_loop0_164_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ',' (expression ['as' star_target])
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (expression ['as' star_target])"));
+        Token * _literal;
+        void *elem;
+        while (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (elem = _tmp_198_rule(p))  // expression ['as' star_target]
+        )
+        {
+            _res = elem;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                PyMem_Free(_children);
+                p->level--;
+                return NULL;
+            }
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_164[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (expression ['as' star_target])"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_164_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _gather_163: (expression ['as' star_target]) _loop0_164
+static asdl_seq *
+_gather_163_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq * _res = NULL;
+    int _mark = p->mark;
+    { // (expression ['as' star_target]) _loop0_164
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _gather_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(expression ['as' star_target]) _loop0_164"));
+        void *elem;
+        asdl_seq * seq;
+        if (
+            (elem = _tmp_198_rule(p))  // expression ['as' star_target]
+            &&
+            (seq = _loop0_164_rule(p))  // _loop0_164
+        )
+        {
+            D(fprintf(stderr, "%*c+ _gather_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(expression ['as' star_target]) _loop0_164"));
+            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _gather_163[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(expression ['as' star_target]) _loop0_164"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop0_166: ',' (expressions ['as' star_target])
+static asdl_seq *
+_loop0_166_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ',' (expressions ['as' star_target])
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_166[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (expressions ['as' star_target])"));
+        Token * _literal;
+        void *elem;
+        while (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (elem = _tmp_199_rule(p))  // expressions ['as' star_target]
+        )
+        {
+            _res = elem;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                PyMem_Free(_children);
+                p->level--;
+                return NULL;
+            }
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_166[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (expressions ['as' star_target])"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_166_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _gather_165: (expressions ['as' star_target]) _loop0_166
+static asdl_seq *
+_gather_165_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq * _res = NULL;
+    int _mark = p->mark;
+    { // (expressions ['as' star_target]) _loop0_166
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _gather_165[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(expressions ['as' star_target]) _loop0_166"));
+        void *elem;
+        asdl_seq * seq;
+        if (
+            (elem = _tmp_199_rule(p))  // expressions ['as' star_target]
+            &&
+            (seq = _loop0_166_rule(p))  // _loop0_166
+        )
+        {
+            D(fprintf(stderr, "%*c+ _gather_165[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(expressions ['as' star_target]) _loop0_166"));
+            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _gather_165[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(expressions ['as' star_target]) _loop0_166"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop0_168: ',' (expression ['as' star_target])
+static asdl_seq *
+_loop0_168_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ',' (expression ['as' star_target])
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_168[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (expression ['as' star_target])"));
+        Token * _literal;
+        void *elem;
+        while (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (elem = _tmp_200_rule(p))  // expression ['as' star_target]
+        )
+        {
+            _res = elem;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                PyMem_Free(_children);
+                p->level--;
+                return NULL;
+            }
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_168[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (expression ['as' star_target])"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_168_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _gather_167: (expression ['as' star_target]) _loop0_168
+static asdl_seq *
+_gather_167_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq * _res = NULL;
+    int _mark = p->mark;
+    { // (expression ['as' star_target]) _loop0_168
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _gather_167[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(expression ['as' star_target]) _loop0_168"));
+        void *elem;
+        asdl_seq * seq;
+        if (
+            (elem = _tmp_200_rule(p))  // expression ['as' star_target]
+            &&
+            (seq = _loop0_168_rule(p))  // _loop0_168
+        )
+        {
+            D(fprintf(stderr, "%*c+ _gather_167[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(expression ['as' star_target]) _loop0_168"));
+            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _gather_167[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(expression ['as' star_target]) _loop0_168"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop0_170: ',' (expressions ['as' star_target])
+static asdl_seq *
+_loop0_170_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ',' (expressions ['as' star_target])
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_170[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (expressions ['as' star_target])"));
+        Token * _literal;
+        void *elem;
+        while (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (elem = _tmp_201_rule(p))  // expressions ['as' star_target]
+        )
+        {
+            _res = elem;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                PyMem_Free(_children);
+                p->level--;
+                return NULL;
+            }
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_170[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (expressions ['as' star_target])"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_170_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _gather_169: (expressions ['as' star_target]) _loop0_170
+static asdl_seq *
+_gather_169_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq * _res = NULL;
+    int _mark = p->mark;
+    { // (expressions ['as' star_target]) _loop0_170
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _gather_169[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(expressions ['as' star_target]) _loop0_170"));
+        void *elem;
+        asdl_seq * seq;
+        if (
+            (elem = _tmp_201_rule(p))  // expressions ['as' star_target]
+            &&
+            (seq = _loop0_170_rule(p))  // _loop0_170
+        )
+        {
+            D(fprintf(stderr, "%*c+ _gather_169[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(expressions ['as' star_target]) _loop0_170"));
+            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _gather_169[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(expressions ['as' star_target]) _loop0_170"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_171: 'except' | 'finally'
+static void *
+_tmp_171_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // 'except'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_171[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except'"));
+        Token * _keyword;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 521))  // token='except'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_171[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except'"));
+            _res = _keyword;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_171[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except'"));
+    }
+    { // 'finally'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_171[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'finally'"));
+        Token * _keyword;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 522))  // token='finally'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_171[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'finally'"));
+            _res = _keyword;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_171[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'finally'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_172: 'as' NAME
+static void *
+_tmp_172_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // 'as' NAME
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_172[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
+        Token * _keyword;
+        expr_ty name_var;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 520))  // token='as'
+            &&
+            (name_var = _PyPegen_name_token(p))  // NAME
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_172[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
+            _res = _PyPegen_dummy_name(p, _keyword, name_var);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_172[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_173: 'as' NAME
+static void *
+_tmp_173_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // 'as' NAME
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_173[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
+        Token * _keyword;
+        expr_ty name_var;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 520))  // token='as'
+            &&
+            (name_var = _PyPegen_name_token(p))  // NAME
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_173[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
+            _res = _PyPegen_dummy_name(p, _keyword, name_var);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_173[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_174: 'as' NAME
+static void *
+_tmp_174_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // 'as' NAME
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_174[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
+        Token * _keyword;
+        expr_ty name_var;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 520))  // token='as'
+            &&
+            (name_var = _PyPegen_name_token(p))  // NAME
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_174[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
+            _res = _PyPegen_dummy_name(p, _keyword, name_var);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_174[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_175: positional_patterns ','
+static void *
+_tmp_175_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // positional_patterns ','
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_175[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "positional_patterns ','"));
+        Token * _literal;
+        asdl_pattern_seq* positional_patterns_var;
+        if (
+            (positional_patterns_var = positional_patterns_rule(p))  // positional_patterns
+            &&
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_175[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "positional_patterns ','"));
+            _res = _PyPegen_dummy_name(p, positional_patterns_var, _literal);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_175[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "positional_patterns ','"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_176: '->' expression
+static void *
+_tmp_176_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // '->' expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_176[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression"));
+        Token * _literal;
+        expr_ty expression_var;
+        if (
+            (_literal = _PyPegen_expect_token(p, 51))  // token='->'
+            &&
+            (expression_var = expression_rule(p))  // expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_176[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression"));
+            _res = _PyPegen_dummy_name(p, _literal, expression_var);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_176[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_177: '(' arguments? ')'
+static void *
+_tmp_177_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // '(' arguments? ')'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_177[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'"));
+        Token * _literal;
+        Token * _literal_1;
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        if (
+            (_literal = _PyPegen_expect_token(p, 7))  // token='('
+            &&
+            (_opt_var = arguments_rule(p), !p->error_indicator)  // arguments?
+            &&
+            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_177[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'"));
+            _res = _PyPegen_dummy_name(p, _literal, _opt_var, _literal_1);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_177[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' arguments? ')'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _loop0_179: ',' double_starred_kvpair
+static asdl_seq *
+_loop0_179_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void *_res = NULL;
+    int _mark = p->mark;
+    int _start_mark = p->mark;
+    void **_children = PyMem_Malloc(sizeof(void *));
+    if (!_children) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    Py_ssize_t _children_capacity = 1;
+    Py_ssize_t _n = 0;
+    { // ',' double_starred_kvpair
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _loop0_179[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair"));
+        Token * _literal;
+        KeyValuePair* elem;
+        while (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (elem = double_starred_kvpair_rule(p))  // double_starred_kvpair
+        )
+        {
+            _res = elem;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                PyMem_Free(_children);
+                p->level--;
+                return NULL;
+            }
+            if (_n == _children_capacity) {
+                _children_capacity *= 2;
+                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+                if (!_new_children) {
+                    p->error_indicator = 1;
+                    PyErr_NoMemory();
+                    p->level--;
+                    return NULL;
+                }
+                _children = _new_children;
+            }
+            _children[_n++] = _res;
+            _mark = p->mark;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _loop0_179[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair"));
+    }
+    asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+    if (!_seq) {
+        PyMem_Free(_children);
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+        p->level--;
+        return NULL;
+    }
+    for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+    PyMem_Free(_children);
+    _PyPegen_insert_memo(p, _start_mark, _loop0_179_type, _seq);
+    p->level--;
+    return _seq;
+}
+
+// _gather_178: double_starred_kvpair _loop0_179
+static asdl_seq *
+_gather_178_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    asdl_seq * _res = NULL;
+    int _mark = p->mark;
+    { // double_starred_kvpair _loop0_179
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _gather_178[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_179"));
+        KeyValuePair* elem;
+        asdl_seq * seq;
+        if (
+            (elem = double_starred_kvpair_rule(p))  // double_starred_kvpair
+            &&
+            (seq = _loop0_179_rule(p))  // _loop0_179
+        )
+        {
+            D(fprintf(stderr, "%*c+ _gather_178[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_179"));
+            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _gather_178[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_179"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_180: '}' | ','
+static void *
+_tmp_180_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // '}'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_180[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'}'"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 26))  // token='}'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_180[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'}'"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_180[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'}'"));
+    }
+    { // ','
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_180[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_180[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_180[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_181: star_targets '='
+static void *
+_tmp_181_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // star_targets '='
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_181[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
+        Token * _literal;
+        expr_ty z;
+        if (
+            (z = star_targets_rule(p))  // star_targets
+            &&
+            (_literal = _PyPegen_expect_token(p, 22))  // token='='
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_181[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
+            _res = z;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_181[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_182: '.' | '...'
+static void *
+_tmp_182_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // '.'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_182[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 23))  // token='.'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_182[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_182[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
+    }
+    { // '...'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_182[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 52))  // token='...'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_182[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_182[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_183: '.' | '...'
+static void *
+_tmp_183_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // '.'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_183[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 23))  // token='.'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_183[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_183[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
+    }
+    { // '...'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_183[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 52))  // token='...'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_183[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_183[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_184: '@' named_expression NEWLINE
+static void *
+_tmp_184_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // '@' named_expression NEWLINE
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_184[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE"));
+        Token * _literal;
+        expr_ty f;
+        Token * newline_var;
+        if (
+            (_literal = _PyPegen_expect_token(p, 49))  // token='@'
+            &&
+            (f = named_expression_rule(p))  // named_expression
+            &&
+            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_184[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE"));
+            _res = f;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_184[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@' named_expression NEWLINE"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_185: ',' star_expression
+static void *
+_tmp_185_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // ',' star_expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_185[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression"));
+        Token * _literal;
+        expr_ty c;
+        if (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (c = star_expression_rule(p))  // star_expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_185[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression"));
+            _res = c;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_185[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_186: ',' expression
+static void *
+_tmp_186_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // ',' expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_186[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
+        Token * _literal;
+        expr_ty c;
+        if (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (c = expression_rule(p))  // expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_186[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression"));
+            _res = c;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_186[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_187: 'or' conjunction
+static void *
+_tmp_187_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // 'or' conjunction
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_187[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction"));
+        Token * _keyword;
+        expr_ty c;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 531))  // token='or'
+            &&
+            (c = conjunction_rule(p))  // conjunction
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_187[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction"));
+            _res = c;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_187[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'or' conjunction"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_188: 'and' inversion
+static void *
+_tmp_188_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // 'and' inversion
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_188[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion"));
+        Token * _keyword;
+        expr_ty c;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 532))  // token='and'
+            &&
+            (c = inversion_rule(p))  // inversion
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_188[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion"));
+            _res = c;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_188[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'and' inversion"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_189: 'if' disjunction
+static void *
+_tmp_189_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // 'if' disjunction
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_189[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
+        Token * _keyword;
+        expr_ty z;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 510))  // token='if'
+            &&
+            (z = disjunction_rule(p))  // disjunction
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_189[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
+            _res = z;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_189[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_190: 'if' disjunction
+static void *
+_tmp_190_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // 'if' disjunction
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_190[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
+        Token * _keyword;
+        expr_ty z;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 510))  // token='if'
+            &&
+            (z = disjunction_rule(p))  // disjunction
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_190[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
+            _res = z;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_190[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_191: starred_expression | (assignment_expression | expression !':=') !'='
+static void *
+_tmp_191_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // starred_expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_191[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression"));
+        expr_ty starred_expression_var;
+        if (
+            (starred_expression_var = starred_expression_rule(p))  // starred_expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_191[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression"));
+            _res = starred_expression_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_191[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression"));
+    }
+    { // (assignment_expression | expression !':=') !'='
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_191[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(assignment_expression | expression !':=') !'='"));
+        void *_tmp_202_var;
+        if (
+            (_tmp_202_var = _tmp_202_rule(p))  // assignment_expression | expression !':='
+            &&
+            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22)  // token='='
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_191[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(assignment_expression | expression !':=') !'='"));
+            _res = _tmp_202_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_191[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(assignment_expression | expression !':=') !'='"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_192: ',' star_target
+static void *
+_tmp_192_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // ',' star_target
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_192[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target"));
+        Token * _literal;
+        expr_ty c;
+        if (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (c = star_target_rule(p))  // star_target
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_192[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target"));
+            _res = c;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_192[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_193: ',' star_target
+static void *
+_tmp_193_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // ',' star_target
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_193[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target"));
+        Token * _literal;
+        expr_ty c;
+        if (
+            (_literal = _PyPegen_expect_token(p, 12))  // token=','
+            &&
+            (c = star_target_rule(p))  // star_target
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_193[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target"));
+            _res = c;
+            if (_res == NULL && PyErr_Occurred()) {
+                p->error_indicator = 1;
+                p->level--;
+                return NULL;
+            }
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_193[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_194: star_targets '='
+static void *
+_tmp_194_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // star_targets '='
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_194[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
+        Token * _literal;
+        expr_ty star_targets_var;
+        if (
+            (star_targets_var = star_targets_rule(p))  // star_targets
+            &&
+            (_literal = _PyPegen_expect_token(p, 22))  // token='='
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_194[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
+            _res = _PyPegen_dummy_name(p, star_targets_var, _literal);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_194[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_195: star_targets '='
+static void *
+_tmp_195_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // star_targets '='
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_195[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
+        Token * _literal;
+        expr_ty star_targets_var;
+        if (
+            (star_targets_var = star_targets_rule(p))  // star_targets
+            &&
+            (_literal = _PyPegen_expect_token(p, 22))  // token='='
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_195[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
+            _res = _PyPegen_dummy_name(p, star_targets_var, _literal);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_195[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_196: ')' | '**'
+static void *
+_tmp_196_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // ')'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_196[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 8))  // token=')'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_196[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_196[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
+    }
+    { // '**'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_196[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 35))  // token='**'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_196[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_196[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_197: ':' | '**'
+static void *
+_tmp_197_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // ':'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_197[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_197[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_197[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
+    }
+    { // '**'
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_197[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'"));
+        Token * _literal;
+        if (
+            (_literal = _PyPegen_expect_token(p, 35))  // token='**'
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_197[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'"));
+            _res = _literal;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_197[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_198: expression ['as' star_target]
+static void *
+_tmp_198_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // expression ['as' star_target]
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_198[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]"));
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        expr_ty expression_var;
+        if (
+            (expression_var = expression_rule(p))  // expression
+            &&
+            (_opt_var = _tmp_203_rule(p), !p->error_indicator)  // ['as' star_target]
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_198[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]"));
+            _res = _PyPegen_dummy_name(p, expression_var, _opt_var);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_198[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ['as' star_target]"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_199: expressions ['as' star_target]
+static void *
+_tmp_199_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // expressions ['as' star_target]
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_199[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]"));
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        expr_ty expressions_var;
+        if (
+            (expressions_var = expressions_rule(p))  // expressions
+            &&
+            (_opt_var = _tmp_204_rule(p), !p->error_indicator)  // ['as' star_target]
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_199[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]"));
+            _res = _PyPegen_dummy_name(p, expressions_var, _opt_var);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_199[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expressions ['as' star_target]"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_200: expression ['as' star_target]
+static void *
+_tmp_200_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // expression ['as' star_target]
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_200[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]"));
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        expr_ty expression_var;
+        if (
+            (expression_var = expression_rule(p))  // expression
+            &&
+            (_opt_var = _tmp_205_rule(p), !p->error_indicator)  // ['as' star_target]
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_200[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]"));
+            _res = _PyPegen_dummy_name(p, expression_var, _opt_var);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_200[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ['as' star_target]"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_201: expressions ['as' star_target]
+static void *
+_tmp_201_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // expressions ['as' star_target]
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_201[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]"));
+        void *_opt_var;
+        UNUSED(_opt_var); // Silence compiler warnings
+        expr_ty expressions_var;
+        if (
+            (expressions_var = expressions_rule(p))  // expressions
+            &&
+            (_opt_var = _tmp_206_rule(p), !p->error_indicator)  // ['as' star_target]
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_201[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]"));
+            _res = _PyPegen_dummy_name(p, expressions_var, _opt_var);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_201[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expressions ['as' star_target]"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_202: assignment_expression | expression !':='
+static void *
+_tmp_202_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // assignment_expression
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_202[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "assignment_expression"));
+        expr_ty assignment_expression_var;
+        if (
+            (assignment_expression_var = assignment_expression_rule(p))  // assignment_expression
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_202[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "assignment_expression"));
+            _res = assignment_expression_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_202[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "assignment_expression"));
+    }
+    { // expression !':='
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_202[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !':='"));
+        expr_ty expression_var;
+        if (
+            (expression_var = expression_rule(p))  // expression
+            &&
+            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53)  // token=':='
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_202[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression !':='"));
+            _res = expression_var;
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_202[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression !':='"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_203: 'as' star_target
+static void *
+_tmp_203_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // 'as' star_target
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_203[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target"));
+        Token * _keyword;
+        expr_ty star_target_var;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 520))  // token='as'
+            &&
+            (star_target_var = star_target_rule(p))  // star_target
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_203[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' star_target"));
+            _res = _PyPegen_dummy_name(p, _keyword, star_target_var);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_203[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' star_target"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_204: 'as' star_target
+static void *
+_tmp_204_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // 'as' star_target
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_204[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target"));
+        Token * _keyword;
+        expr_ty star_target_var;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 520))  // token='as'
+            &&
+            (star_target_var = star_target_rule(p))  // star_target
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_204[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' star_target"));
+            _res = _PyPegen_dummy_name(p, _keyword, star_target_var);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_204[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' star_target"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_205: 'as' star_target
+static void *
+_tmp_205_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // 'as' star_target
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_205[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target"));
+        Token * _keyword;
+        expr_ty star_target_var;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 520))  // token='as'
+            &&
+            (star_target_var = star_target_rule(p))  // star_target
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_205[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' star_target"));
+            _res = _PyPegen_dummy_name(p, _keyword, star_target_var);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_205[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' star_target"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+// _tmp_206: 'as' star_target
+static void *
+_tmp_206_rule(Parser *p)
+{
+    if (p->level++ == MAXSTACK) {
+        p->error_indicator = 1;
+        PyErr_NoMemory();
+    }
+    if (p->error_indicator) {
+        p->level--;
+        return NULL;
+    }
+    void * _res = NULL;
+    int _mark = p->mark;
+    { // 'as' star_target
+        if (p->error_indicator) {
+            p->level--;
+            return NULL;
+        }
+        D(fprintf(stderr, "%*c> _tmp_206[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target"));
+        Token * _keyword;
+        expr_ty star_target_var;
+        if (
+            (_keyword = _PyPegen_expect_token(p, 520))  // token='as'
+            &&
+            (star_target_var = star_target_rule(p))  // star_target
+        )
+        {
+            D(fprintf(stderr, "%*c+ _tmp_206[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' star_target"));
+            _res = _PyPegen_dummy_name(p, _keyword, star_target_var);
+            goto done;
+        }
+        p->mark = _mark;
+        D(fprintf(stderr, "%*c%s _tmp_206[%d-%d]: %s failed!\n", p->level, ' ',
+                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' star_target"));
+    }
+    _res = NULL;
+  done:
+    p->level--;
+    return _res;
+}
+
+void *
+_PyPegen_parse(Parser *p)
+{
+    // Initialize keywords
+    p->keywords = reserved_keywords;
+    p->n_keyword_lists = n_keyword_lists;
+    p->soft_keywords = soft_keywords;
+
+    // Run parser
+    void *result = NULL;
+    if (p->start_rule == Py_file_input) {
+        result = file_rule(p);
+    } else if (p->start_rule == Py_single_input) {
+        result = interactive_rule(p);
+    } else if (p->start_rule == Py_eval_input) {
+        result = eval_rule(p);
+    } else if (p->start_rule == Py_func_type_input) {
+        result = func_type_rule(p);
+    } else if (p->start_rule == Py_fstring_input) {
+        result = fstring_rule(p);
+    }
+
+    return result;
+}
+
+// The end
diff --git a/Parser/parser.h b/Parser/parser.h
deleted file mode 100644
index b16075e..0000000
--- a/Parser/parser.h
+++ /dev/null
@@ -1,49 +0,0 @@
-#ifndef Py_PARSER_H
-#define Py_PARSER_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* Parser interface */
-
-#define MAXSTACK 1700
-
-typedef struct {
-    int              s_state;       /* State in current DFA */
-    const dfa       *s_dfa;         /* Current DFA */
-    struct _node    *s_parent;      /* Where to add next node */
-} stackentry;
-
-typedef struct {
-    stackentry      *s_top;         /* Top entry */
-    stackentry       s_base[MAXSTACK];/* Array of stack entries */
-                                    /* NB The stack grows down */
-} stack;
-
-typedef struct {
-    stack           p_stack;        /* Stack of parser states */
-    grammar         *p_grammar;     /* Grammar to use */
-    node            *p_tree;        /* Top of parse tree */
-#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD
-    unsigned long   p_flags;        /* see co_flags in Include/code.h */
-#endif
-} parser_state;
-
-parser_state *PyParser_New(grammar *g, int start);
-void PyParser_Delete(parser_state *ps);
-int PyParser_AddToken(parser_state *ps, int type, char *str,
-                      int lineno, int col_offset,
-                      int end_lineno, int end_col_offset,
-                      int *expected_ret);
-void PyGrammar_AddAccelerators(grammar *g);
-
-
-#define showtree _Py_showtree
-#define printtree _Py_printtree
-#define dumptree _Py_dumptree
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* !Py_PARSER_H */
diff --git a/Parser/parsetok.c b/Parser/parsetok.c
deleted file mode 100644
index 1ecb2c4..0000000
--- a/Parser/parsetok.c
+++ /dev/null
@@ -1,486 +0,0 @@
-
-/* Parser-tokenizer link implementation */
-
-#include "Python.h"
-#include "tokenizer.h"
-#include "node.h"
-#include "grammar.h"
-#include "parser.h"
-#include "parsetok.h"
-#include "errcode.h"
-#include "graminit.h"
-
-
-/* Forward */
-static node *parsetok(struct tok_state *, grammar *, int, perrdetail *, int *);
-static int initerr(perrdetail *err_ret, PyObject * filename);
-
-typedef struct {
-    struct {
-        int lineno;
-        char *comment;
-    } *items;
-    size_t size;
-    size_t num_items;
-} growable_comment_array;
-
-static int
-growable_comment_array_init(growable_comment_array *arr, size_t initial_size) {
-    assert(initial_size > 0);
-    arr->items = malloc(initial_size * sizeof(*arr->items));
-    arr->size = initial_size;
-    arr->num_items = 0;
-
-    return arr->items != NULL;
-}
-
-static int
-growable_comment_array_add(growable_comment_array *arr, int lineno, char *comment) {
-    if (arr->num_items >= arr->size) {
-        size_t new_size = arr->size * 2;
-        void *new_items_array = realloc(arr->items, new_size * sizeof(*arr->items));
-        if (!new_items_array) {
-            return 0;
-        }
-        arr->items = new_items_array;
-        arr->size = new_size;
-    }
-
-    arr->items[arr->num_items].lineno = lineno;
-    arr->items[arr->num_items].comment = comment;
-    arr->num_items++;
-    return 1;
-}
-
-static void
-growable_comment_array_deallocate(growable_comment_array *arr) {
-    for (unsigned i = 0; i < arr->num_items; i++) {
-        PyObject_FREE(arr->items[i].comment);
-    }
-    free(arr->items);
-}
-
-/* Parse input coming from a string.  Return error code, print some errors. */
-node *
-PyParser_ParseString(const char *s, grammar *g, int start, perrdetail *err_ret)
-{
-    return PyParser_ParseStringFlagsFilename(s, NULL, g, start, err_ret, 0);
-}
-
-node *
-PyParser_ParseStringFlags(const char *s, grammar *g, int start,
-                          perrdetail *err_ret, int flags)
-{
-    return PyParser_ParseStringFlagsFilename(s, NULL,
-                                             g, start, err_ret, flags);
-}
-
-node *
-PyParser_ParseStringFlagsFilename(const char *s, const char *filename,
-                          grammar *g, int start,
-                          perrdetail *err_ret, int flags)
-{
-    int iflags = flags;
-    return PyParser_ParseStringFlagsFilenameEx(s, filename, g, start,
-                                               err_ret, &iflags);
-}
-
-node *
-PyParser_ParseStringObject(const char *s, PyObject *filename,
-                           grammar *g, int start,
-                           perrdetail *err_ret, int *flags)
-{
-    struct tok_state *tok;
-    int exec_input = start == file_input;
-
-    if (initerr(err_ret, filename) < 0)
-        return NULL;
-
-    if (PySys_Audit("compile", "yO", s, err_ret->filename) < 0) {
-        err_ret->error = E_ERROR;
-        return NULL;
-    }
-
-    if (*flags & PyPARSE_IGNORE_COOKIE)
-        tok = PyTokenizer_FromUTF8(s, exec_input);
-    else
-        tok = PyTokenizer_FromString(s, exec_input);
-    if (tok == NULL) {
-        err_ret->error = PyErr_Occurred() ? E_DECODE : E_NOMEM;
-        return NULL;
-    }
-    if (*flags & PyPARSE_TYPE_COMMENTS) {
-        tok->type_comments = 1;
-    }
-
-    Py_INCREF(err_ret->filename);
-    tok->filename = err_ret->filename;
-    if (*flags & PyPARSE_ASYNC_HACKS)
-        tok->async_hacks = 1;
-    return parsetok(tok, g, start, err_ret, flags);
-}
-
-node *
-PyParser_ParseStringFlagsFilenameEx(const char *s, const char *filename_str,
-                          grammar *g, int start,
-                          perrdetail *err_ret, int *flags)
-{
-    node *n;
-    PyObject *filename = NULL;
-    if (filename_str != NULL) {
-        filename = PyUnicode_DecodeFSDefault(filename_str);
-        if (filename == NULL) {
-            err_ret->error = E_ERROR;
-            return NULL;
-        }
-    }
-    n = PyParser_ParseStringObject(s, filename, g, start, err_ret, flags);
-    Py_XDECREF(filename);
-    return n;
-}
-
-/* Parse input coming from a file.  Return error code, print some errors. */
-
-node *
-PyParser_ParseFile(FILE *fp, const char *filename, grammar *g, int start,
-                   const char *ps1, const char *ps2,
-                   perrdetail *err_ret)
-{
-    return PyParser_ParseFileFlags(fp, filename, NULL,
-                                   g, start, ps1, ps2, err_ret, 0);
-}
-
-node *
-PyParser_ParseFileFlags(FILE *fp, const char *filename, const char *enc,
-                        grammar *g, int start,
-                        const char *ps1, const char *ps2,
-                        perrdetail *err_ret, int flags)
-{
-    int iflags = flags;
-    return PyParser_ParseFileFlagsEx(fp, filename, enc, g, start, ps1,
-                                     ps2, err_ret, &iflags);
-}
-
-node *
-PyParser_ParseFileObject(FILE *fp, PyObject *filename,
-                         const char *enc, grammar *g, int start,
-                         const char *ps1, const char *ps2,
-                         perrdetail *err_ret, int *flags)
-{
-    struct tok_state *tok;
-
-    if (initerr(err_ret, filename) < 0)
-        return NULL;
-
-    if (PySys_Audit("compile", "OO", Py_None, err_ret->filename) < 0) {
-        return NULL;
-    }
-
-    if ((tok = PyTokenizer_FromFile(fp, enc, ps1, ps2)) == NULL) {
-        err_ret->error = E_NOMEM;
-        return NULL;
-    }
-    if (*flags & PyPARSE_TYPE_COMMENTS) {
-        tok->type_comments = 1;
-    }
-    Py_INCREF(err_ret->filename);
-    tok->filename = err_ret->filename;
-    return parsetok(tok, g, start, err_ret, flags);
-}
-
-node *
-PyParser_ParseFileFlagsEx(FILE *fp, const char *filename,
-                          const char *enc, grammar *g, int start,
-                          const char *ps1, const char *ps2,
-                          perrdetail *err_ret, int *flags)
-{
-    node *n;
-    PyObject *fileobj = NULL;
-    if (filename != NULL) {
-        fileobj = PyUnicode_DecodeFSDefault(filename);
-        if (fileobj == NULL) {
-            err_ret->error = E_ERROR;
-            return NULL;
-        }
-    }
-    n = PyParser_ParseFileObject(fp, fileobj, enc, g,
-                                 start, ps1, ps2, err_ret, flags);
-    Py_XDECREF(fileobj);
-    return n;
-}
-
-/* Parse input coming from the given tokenizer structure.
-   Return error code. */
-
-static node *
-parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret,
-         int *flags)
-{
-    parser_state *ps;
-    node *n;
-    int started = 0;
-    int col_offset, end_col_offset;
-    growable_comment_array type_ignores;
-
-    if (!growable_comment_array_init(&type_ignores, 10)) {
-        err_ret->error = E_NOMEM;
-        PyTokenizer_Free(tok);
-        return NULL;
-    }
-
-    if ((ps = PyParser_New(g, start)) == NULL) {
-        err_ret->error = E_NOMEM;
-        growable_comment_array_deallocate(&type_ignores);
-        PyTokenizer_Free(tok);
-        return NULL;
-    }
-#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD
-    if (*flags & PyPARSE_BARRY_AS_BDFL)
-        ps->p_flags |= CO_FUTURE_BARRY_AS_BDFL;
-    if (*flags & PyPARSE_TYPE_COMMENTS)
-        ps->p_flags |= PyCF_TYPE_COMMENTS;
-#endif
-
-    for (;;) {
-        const char *a, *b;
-        int type;
-        size_t len;
-        char *str;
-        col_offset = -1;
-        int lineno;
-        const char *line_start;
-
-        type = PyTokenizer_Get(tok, &a, &b);
-
-        len = (a != NULL && b != NULL) ? b - a : 0;
-        str = (char *) PyObject_MALLOC(len + 1);
-        if (str == NULL) {
-            err_ret->error = E_NOMEM;
-            break;
-        }
-        if (len > 0)
-            strncpy(str, a, len);
-        str[len] = '\0';
-
-#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD
-        if (type == NOTEQUAL) {
-            if (!(ps->p_flags & CO_FUTURE_BARRY_AS_BDFL) &&
-                            strcmp(str, "!=")) {
-                PyObject_FREE(str);
-                err_ret->error = E_SYNTAX;
-                break;
-            }
-            else if ((ps->p_flags & CO_FUTURE_BARRY_AS_BDFL) &&
-                            strcmp(str, "<>")) {
-                PyObject_FREE(str);
-                err_ret->expected = NOTEQUAL;
-                err_ret->error = E_SYNTAX;
-                break;
-            }
-        }
-#endif
-
-        /* Nodes of type STRING, especially multi line strings
-           must be handled differently in order to get both
-           the starting line number and the column offset right.
-           (cf. issue 16806) */
-        lineno = type == STRING ? tok->first_lineno : tok->lineno;
-        line_start = type == STRING ? tok->multi_line_start : tok->line_start;
-        if (a != NULL && a >= line_start) {
-            col_offset = Py_SAFE_DOWNCAST(a - line_start,
-                                          intptr_t, int);
-        }
-        else {
-            col_offset = -1;
-        }
-
-        if (b != NULL && b >= tok->line_start) {
-            end_col_offset = Py_SAFE_DOWNCAST(b - tok->line_start,
-                                              intptr_t, int);
-        }
-        else {
-            end_col_offset = -1;
-        }
-
-        if (type == TYPE_IGNORE) {
-            if (!growable_comment_array_add(&type_ignores, tok->lineno, str)) {
-                err_ret->error = E_NOMEM;
-                break;
-            }
-            continue;
-        }
-
-        if (type == ERRORTOKEN) {
-            err_ret->error = tok->done;
-            break;
-        }
-        if (type == ENDMARKER && started) {
-            type = NEWLINE; /* Add an extra newline */
-            started = 0;
-            /* Add the right number of dedent tokens,
-               except if a certain flag is given --
-               codeop.py uses this. */
-            if (tok->indent &&
-                !(*flags & PyPARSE_DONT_IMPLY_DEDENT))
-            {
-                tok->pendin = -tok->indent;
-                tok->indent = 0;
-            }
-        }
-        else {
-            started = 1;
-        }
-
-        if ((err_ret->error =
-             PyParser_AddToken(ps, (int)type, str,
-                               lineno, col_offset, tok->lineno, end_col_offset,
-                               &(err_ret->expected))) != E_OK) {
-            if (tok->done == E_EOF && !ISWHITESPACE(type)) {
-                tok->done = E_SYNTAX;
-            }
-            if (err_ret->error != E_DONE) {
-                PyObject_FREE(str);
-                err_ret->token = type;
-            }
-            break;
-        }
-    }
-
-    if (err_ret->error == E_DONE) {
-        n = ps->p_tree;
-        ps->p_tree = NULL;
-
-        if (n->n_type == file_input) {
-            /* Put type_ignore nodes in the ENDMARKER of file_input. */
-            int num;
-            node *ch;
-            size_t i;
-
-            num = NCH(n);
-            ch = CHILD(n, num - 1);
-            REQ(ch, ENDMARKER);
-
-            for (i = 0; i < type_ignores.num_items; i++) {
-                int res = PyNode_AddChild(ch, TYPE_IGNORE, type_ignores.items[i].comment,
-                                          type_ignores.items[i].lineno, 0,
-                                          type_ignores.items[i].lineno, 0);
-                if (res != 0) {
-                    err_ret->error = res;
-                    PyNode_Free(n);
-                    n = NULL;
-                    break;
-                }
-                type_ignores.items[i].comment = NULL;
-            }
-        }
-
-        /* Check that the source for a single input statement really
-           is a single statement by looking at what is left in the
-           buffer after parsing.  Trailing whitespace and comments
-           are OK.  */
-        if (err_ret->error == E_DONE && start == single_input) {
-            const char *cur = tok->cur;
-            char c = *tok->cur;
-
-            for (;;) {
-                while (c == ' ' || c == '\t' || c == '\n' || c == '\014')
-                    c = *++cur;
-
-                if (!c)
-                    break;
-
-                if (c != '#') {
-                    err_ret->error = E_BADSINGLE;
-                    PyNode_Free(n);
-                    n = NULL;
-                    break;
-                }
-
-                /* Suck up comment. */
-                while (c && c != '\n')
-                    c = *++cur;
-            }
-        }
-    }
-    else
-        n = NULL;
-
-    growable_comment_array_deallocate(&type_ignores);
-
-#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD
-    *flags = ps->p_flags;
-#endif
-    PyParser_Delete(ps);
-
-    if (n == NULL) {
-        if (tok->done == E_EOF)
-            err_ret->error = E_EOF;
-        err_ret->lineno = tok->lineno;
-        if (tok->buf != NULL) {
-            size_t len;
-            assert(tok->cur - tok->buf < INT_MAX);
-            /* if we've managed to parse a token, point the offset to its start,
-             * else use the current reading position of the tokenizer
-             */
-            err_ret->offset = col_offset != -1 ? col_offset + 1 : ((int)(tok->cur - tok->buf));
-            len = tok->inp - tok->buf;
-            err_ret->text = (char *) PyObject_MALLOC(len + 1);
-            if (err_ret->text != NULL) {
-                if (len > 0)
-                    strncpy(err_ret->text, tok->buf, len);
-                err_ret->text[len] = '\0';
-            }
-        }
-    } else if (tok->encoding != NULL) {
-        /* 'nodes->n_str' uses PyObject_*, while 'tok->encoding' was
-         * allocated using PyMem_
-         */
-        node* r = PyNode_New(encoding_decl);
-        if (r)
-            r->n_str = PyObject_MALLOC(strlen(tok->encoding)+1);
-        if (!r || !r->n_str) {
-            err_ret->error = E_NOMEM;
-            if (r)
-                PyObject_FREE(r);
-            n = NULL;
-            goto done;
-        }
-        strcpy(r->n_str, tok->encoding);
-        PyMem_FREE(tok->encoding);
-        tok->encoding = NULL;
-        r->n_nchildren = 1;
-        r->n_child = n;
-        n = r;
-    }
-
-done:
-    PyTokenizer_Free(tok);
-
-    if (n != NULL) {
-        _PyNode_FinalizeEndPos(n);
-    }
-    return n;
-}
-
-static int
-initerr(perrdetail *err_ret, PyObject *filename)
-{
-    err_ret->error = E_OK;
-    err_ret->lineno = 0;
-    err_ret->offset = 0;
-    err_ret->text = NULL;
-    err_ret->token = -1;
-    err_ret->expected = -1;
-    if (filename) {
-        Py_INCREF(filename);
-        err_ret->filename = filename;
-    }
-    else {
-        err_ret->filename = PyUnicode_FromString("<string>");
-        if (err_ret->filename == NULL) {
-            err_ret->error = E_ERROR;
-            return -1;
-        }
-    }
-    return 0;
-}
diff --git a/Parser/peg_api.c b/Parser/peg_api.c
new file mode 100644
index 0000000..1487ac4
--- /dev/null
+++ b/Parser/peg_api.c
@@ -0,0 +1,28 @@
+#include "Python.h"
+
+#include "tokenizer.h"
+#include "pegen.h"
+
+mod_ty
+_PyParser_ASTFromString(const char *str, PyObject* filename, int mode,
+                        PyCompilerFlags *flags, PyArena *arena)
+{
+    if (PySys_Audit("compile", "yO", str, filename) < 0) {
+        return NULL;
+    }
+
+    mod_ty result = _PyPegen_run_parser_from_string(str, mode, filename, flags, arena);
+    return result;
+}
+
+mod_ty
+_PyParser_ASTFromFile(FILE *fp, PyObject *filename_ob, const char *enc,
+                      int mode, const char *ps1, const char* ps2,
+                      PyCompilerFlags *flags, int *errcode, PyArena *arena)
+{
+    if (PySys_Audit("compile", "OO", Py_None, filename_ob) < 0) {
+        return NULL;
+    }
+    return _PyPegen_run_parser_from_file_pointer(fp, mode, filename_ob, enc, ps1, ps2,
+                                        flags, errcode, arena);
+}
diff --git a/Parser/pegen/pegen.c b/Parser/pegen.c
similarity index 63%
rename from Parser/pegen/pegen.c
rename to Parser/pegen.c
index 4e742a5..df17476 100644
--- a/Parser/pegen/pegen.c
+++ b/Parser/pegen.c
@@ -1,19 +1,19 @@
 #include <Python.h>
+#include "pycore_ast.h"           // _PyAST_Validate(),
 #include <errcode.h>
-#include "../tokenizer.h"
+#include "tokenizer.h"
 
 #include "pegen.h"
-#include "parse_string.h"
-#include "ast.h"
+#include "string_parser.h"
 
 PyObject *
-_PyPegen_new_type_comment(Parser *p, char *s)
+_PyPegen_new_type_comment(Parser *p, const char *s)
 {
     PyObject *res = PyUnicode_DecodeUTF8(s, strlen(s), NULL);
     if (res == NULL) {
         return NULL;
     }
-    if (PyArena_AddPyObject(p->arena, res) < 0) {
+    if (_PyArena_AddPyObject(p->arena, res) < 0) {
         Py_DECREF(res);
         return NULL;
     }
@@ -26,7 +26,7 @@
     if (tc == NULL) {
         return a;
     }
-    char *bytes = PyBytes_AsString(tc->bytes);
+    const char *bytes = PyBytes_AsString(tc->bytes);
     if (bytes == NULL) {
         return NULL;
     }
@@ -34,9 +34,9 @@
     if (tco == NULL) {
         return NULL;
     }
-    return arg(a->arg, a->annotation, tco,
-               a->lineno, a->col_offset, a->end_lineno, a->end_col_offset,
-               p->arena);
+    return _PyAST_arg(a->arg, a->annotation, tco,
+                      a->lineno, a->col_offset, a->end_lineno, a->end_col_offset,
+                      p->arena);
 }
 
 static int
@@ -66,7 +66,7 @@
     assert(t->bytes != NULL);
     assert(t->type == NOTEQUAL);
 
-    char* tok_str = PyBytes_AS_STRING(t->bytes);
+    const char* tok_str = PyBytes_AS_STRING(t->bytes);
     if (p->flags & PyPARSE_BARRY_AS_BDFL && strcmp(tok_str, "<>") != 0) {
         RAISE_SYNTAX_ERROR("with Barry as BDFL, use '<>' instead of '!='");
         return -1;
@@ -77,8 +77,22 @@
     return 0;
 }
 
+int
+_PyPegen_check_legacy_stmt(Parser *p, expr_ty name) {
+    if (name->kind != Name_kind) {
+        return 0;
+    }
+    const char* candidates[2] = {"print", "exec"};
+    for (int i=0; i<2; i++) {
+        if (PyUnicode_CompareWithASCIIString(name->v.Name.id, candidates[i]) == 0) {
+            return 1;
+        }
+    }
+    return 0;
+}
+
 PyObject *
-_PyPegen_new_identifier(Parser *p, char *n)
+_PyPegen_new_identifier(Parser *p, const char *n)
 {
     PyObject *id = PyUnicode_DecodeUTF8(n, strlen(n), NULL);
     if (!id) {
@@ -121,7 +135,7 @@
         id = id2;
     }
     PyUnicode_InternInPlace(&id);
-    if (PyArena_AddPyObject(p->arena, id) < 0)
+    if (_PyArena_AddPyObject(p->arena, id) < 0)
     {
         Py_DECREF(id);
         goto error;
@@ -146,7 +160,11 @@
     if (!str) {
         return 0;
     }
-    assert(col_offset >= 0 && (unsigned long)col_offset <= strlen(str));
+    Py_ssize_t len = strlen(str);
+    if (col_offset > len + 1) {
+        col_offset = len + 1;
+    }
+    assert(col_offset >= 0);
     PyObject *text = PyUnicode_DecodeUTF8(str, col_offset, "replace");
     if (!text) {
         return 0;
@@ -180,7 +198,7 @@
         case BoolOp_kind:
         case BinOp_kind:
         case UnaryOp_kind:
-            return "operator";
+            return "expression";
         case GeneratorExp_kind:
             return "generator expression";
         case Yield_kind:
@@ -195,7 +213,7 @@
         case DictComp_kind:
             return "dict comprehension";
         case Dict_kind:
-            return "dict display";
+            return "dict literal";
         case Set_kind:
             return "set display";
         case JoinedStr_kind:
@@ -213,7 +231,7 @@
                 return "True";
             }
             if (value == Py_Ellipsis) {
-                return "Ellipsis";
+                return "ellipsis";
             }
             return "literal";
         }
@@ -265,10 +283,21 @@
     return -1;
 }
 
+static inline void
+raise_unclosed_parentheses_error(Parser *p) {
+       int error_lineno = p->tok->parenlinenostack[p->tok->level-1];
+       int error_col = p->tok->parencolstack[p->tok->level-1];
+       RAISE_ERROR_KNOWN_LOCATION(p, PyExc_SyntaxError,
+                                  error_lineno, error_col, error_lineno, -1,
+                                  "'%c' was never closed",
+                                  p->tok->parenstack[p->tok->level-1]);
+}
+
 static void
 raise_tokenizer_init_error(PyObject *filename)
 {
     if (!(PyErr_ExceptionMatches(PyExc_LookupError)
+          || PyErr_ExceptionMatches(PyExc_SyntaxError)
           || PyErr_ExceptionMatches(PyExc_ValueError)
           || PyErr_ExceptionMatches(PyExc_UnicodeDecodeError))) {
         return;
@@ -313,18 +342,17 @@
 
     const char *msg = NULL;
     PyObject* errtype = PyExc_SyntaxError;
+    Py_ssize_t col_offset = -1;
     switch (p->tok->done) {
         case E_TOKEN:
             msg = "invalid token";
             break;
-        case E_EOFS:
-            RAISE_SYNTAX_ERROR("EOF while scanning triple-quoted string literal");
-            return -1;
-        case E_EOLS:
-            RAISE_SYNTAX_ERROR("EOL while scanning string literal");
-            return -1;
         case E_EOF:
-            RAISE_SYNTAX_ERROR("unexpected EOF while parsing");
+            if (p->tok->level) {
+                raise_unclosed_parentheses_error(p);
+            } else {
+                RAISE_SYNTAX_ERROR("unexpected EOF while parsing");
+            }
             return -1;
         case E_DEDENT:
             RAISE_INDENTATION_ERROR("unindent does not match any outer indentation level");
@@ -345,44 +373,93 @@
             errtype = PyExc_IndentationError;
             msg = "too many levels of indentation";
             break;
-        case E_LINECONT:
+        case E_LINECONT: {
+            col_offset = p->tok->cur - p->tok->buf - 1;
             msg = "unexpected character after line continuation character";
             break;
+        }
         default:
             msg = "unknown parsing error";
     }
 
-    PyErr_Format(errtype, msg);
-    // There is no reliable column information for this error
-    PyErr_SyntaxLocationObject(p->tok->filename, p->tok->lineno, 0);
-
+    RAISE_ERROR_KNOWN_LOCATION(p, errtype, p->tok->lineno,
+                               col_offset >= 0 ? col_offset : 0,
+                               p->tok->lineno, -1, msg);
     return -1;
 }
 
 void *
 _PyPegen_raise_error(Parser *p, PyObject *errtype, const char *errmsg, ...)
 {
+    if (p->fill == 0) {
+        va_list va;
+        va_start(va, errmsg);
+        _PyPegen_raise_error_known_location(p, errtype, 0, 0, 0, -1, errmsg, va);
+        va_end(va);
+        return NULL;
+    }
+
     Token *t = p->known_err_token != NULL ? p->known_err_token : p->tokens[p->fill - 1];
     Py_ssize_t col_offset;
+    Py_ssize_t end_col_offset = -1;
     if (t->col_offset == -1) {
-        col_offset = Py_SAFE_DOWNCAST(p->tok->cur - p->tok->buf,
-                                      intptr_t, int);
+        if (p->tok->cur == p->tok->buf) {
+            col_offset = 0;
+        } else {
+            const char* start = p->tok->buf  ? p->tok->line_start : p->tok->buf;
+            col_offset = Py_SAFE_DOWNCAST(p->tok->cur - start, intptr_t, int);
+        }
     } else {
         col_offset = t->col_offset + 1;
     }
 
+    if (t->end_col_offset != -1) {
+        end_col_offset = t->end_col_offset + 1;
+    }
+
     va_list va;
     va_start(va, errmsg);
-    _PyPegen_raise_error_known_location(p, errtype, t->lineno,
-                                        col_offset, errmsg, va);
+    _PyPegen_raise_error_known_location(p, errtype, t->lineno, col_offset, t->end_lineno, end_col_offset, errmsg, va);
     va_end(va);
 
     return NULL;
 }
 
+static PyObject *
+get_error_line(Parser *p, Py_ssize_t lineno)
+{
+    /* If the file descriptor is interactive, the source lines of the current
+     * (multi-line) statement are stored in p->tok->interactive_src_start.
+     * If not, we're parsing from a string, which means that the whole source
+     * is stored in p->tok->str. */
+    assert((p->tok->fp == NULL && p->tok->str != NULL) || p->tok->fp == stdin);
+
+    char *cur_line = p->tok->fp_interactive ? p->tok->interactive_src_start : p->tok->str;
+    assert(cur_line != NULL);
+    const char* buf_end = p->tok->fp_interactive ? p->tok->interactive_src_end : p->tok->inp;
+
+    Py_ssize_t relative_lineno = p->starting_lineno ? lineno - p->starting_lineno + 1 : lineno;
+
+    for (int i = 0; i < relative_lineno - 1; i++) {
+        char *new_line = strchr(cur_line, '\n') + 1;
+        assert(new_line != NULL && new_line <= buf_end);
+        if (new_line == NULL || new_line > buf_end) {
+            break;
+        }
+        cur_line = new_line;
+    }
+
+    char *next_newline;
+    if ((next_newline = strchr(cur_line, '\n')) == NULL) { // This is the last line
+        next_newline = cur_line + strlen(cur_line);
+    }
+    return PyUnicode_DecodeUTF8(cur_line, next_newline - cur_line, "replace");
+}
+
 void *
 _PyPegen_raise_error_known_location(Parser *p, PyObject *errtype,
                                     Py_ssize_t lineno, Py_ssize_t col_offset,
+                                    Py_ssize_t end_lineno, Py_ssize_t end_col_offset,
                                     const char *errmsg, va_list va)
 {
     PyObject *value = NULL;
@@ -391,11 +468,18 @@
     PyObject *tmp = NULL;
     p->error_indicator = 1;
 
+    if (end_lineno == CURRENT_POS) {
+        end_lineno = p->tok->lineno;
+    }
+    if (end_col_offset == CURRENT_POS) {
+        end_col_offset = p->tok->cur - p->tok->line_start;
+    }
+
     if (p->start_rule == Py_fstring_input) {
         const char *fstring_msg = "f-string: ";
         Py_ssize_t len = strlen(fstring_msg) + strlen(errmsg);
 
-        char *new_errmsg = PyMem_RawMalloc(len + 1); // Lengths of both strings plus NULL character
+        char *new_errmsg = PyMem_Malloc(len + 1); // Lengths of both strings plus NULL character
         if (!new_errmsg) {
             return (void *) PyErr_NoMemory();
         }
@@ -411,13 +495,34 @@
         goto error;
     }
 
-    if (p->start_rule == Py_file_input) {
-        error_line = PyErr_ProgramTextObject(p->tok->filename, (int) lineno);
+    if (p->tok->fp_interactive) {
+        error_line = get_error_line(p, lineno);
+    }
+    else if (p->start_rule == Py_file_input) {
+        error_line = _PyErr_ProgramDecodedTextObject(p->tok->filename,
+                                                     (int) lineno, p->tok->encoding);
     }
 
     if (!error_line) {
-        Py_ssize_t size = p->tok->inp - p->tok->buf;
-        error_line = PyUnicode_DecodeUTF8(p->tok->buf, size, "replace");
+        /* PyErr_ProgramTextObject was not called or returned NULL. If it was not called,
+           then we need to find the error line from some other source, because
+           p->start_rule != Py_file_input. If it returned NULL, then it either unexpectedly
+           failed or we're parsing from a string or the REPL. There's a third edge case where
+           we're actually parsing from a file, which has an E_EOF SyntaxError and in that case
+           `PyErr_ProgramTextObject` fails because lineno points to last_file_line + 1, which
+           does not physically exist */
+        assert(p->tok->fp == NULL || p->tok->fp == stdin || p->tok->done == E_EOF);
+
+        if (p->tok->lineno <= lineno && p->tok->inp > p->tok->buf) {
+            Py_ssize_t size = p->tok->inp - p->tok->buf;
+            error_line = PyUnicode_DecodeUTF8(p->tok->buf, size, "replace");
+        }
+        else if (p->tok->fp == NULL || p->tok->fp == stdin) {
+            error_line = get_error_line(p, lineno);
+        }
+        else {
+            error_line = PyUnicode_FromStringAndSize("", 0);
+        }
         if (!error_line) {
             goto error;
         }
@@ -425,14 +530,19 @@
 
     if (p->start_rule == Py_fstring_input) {
         col_offset -= p->starting_col_offset;
+        end_col_offset -= p->starting_col_offset;
     }
+
     Py_ssize_t col_number = col_offset;
+    Py_ssize_t end_col_number = end_col_offset;
 
     if (p->tok->encoding != NULL) {
         col_number = byte_offset_to_character_offset(error_line, col_offset);
+        end_col_number = end_col_number > 0 ?
+                         byte_offset_to_character_offset(error_line, end_col_offset) :
+                         end_col_number;
     }
-
-    tmp = Py_BuildValue("(OiiN)", p->tok->filename, lineno, col_number, error_line);
+    tmp = Py_BuildValue("(OiiNii)", p->tok->filename, lineno, col_number, error_line, end_lineno, end_col_number);
     if (!tmp) {
         goto error;
     }
@@ -446,7 +556,7 @@
     Py_DECREF(errstr);
     Py_DECREF(value);
     if (p->start_rule == Py_fstring_input) {
-        PyMem_RawFree((void *)errmsg);
+        PyMem_Free((void *)errmsg);
     }
     return NULL;
 
@@ -454,7 +564,7 @@
     Py_XDECREF(errstr);
     Py_XDECREF(error_line);
     if (p->start_rule == Py_fstring_input) {
-        PyMem_RawFree((void *)errmsg);
+        PyMem_Free((void *)errmsg);
     }
     return NULL;
 }
@@ -476,7 +586,7 @@
 _PyPegen_insert_memo(Parser *p, int mark, int type, void *node)
 {
     // Insert in front
-    Memo *m = PyArena_Malloc(p->arena, sizeof(Memo));
+    Memo *m = _PyArena_Malloc(p->arena, sizeof(Memo));
     if (m == NULL) {
         return -1;
     }
@@ -518,7 +628,7 @@
     if (!id) {
         return NULL;
     }
-    cache = Name(id, Load, 1, 0, 1, 0, p->arena);
+    cache = _PyAST_Name(id, Load, 1, 0, 1, 0, p->arena);
     return cache;
 }
 
@@ -575,6 +685,66 @@
     PyMem_Free(arr->items);
 }
 
+static int
+initialize_token(Parser *p, Token *token, const char *start, const char *end, int token_type) {
+    assert(token != NULL);
+
+    token->type = (token_type == NAME) ? _get_keyword_or_name_type(p, start, (int)(end - start)) : token_type;
+    token->bytes = PyBytes_FromStringAndSize(start, end - start);
+    if (token->bytes == NULL) {
+        return -1;
+    }
+
+    if (_PyArena_AddPyObject(p->arena, token->bytes) < 0) {
+        Py_DECREF(token->bytes);
+        return -1;
+    }
+
+    token->level = p->tok->level;
+
+    const char *line_start = token_type == STRING ? p->tok->multi_line_start : p->tok->line_start;
+    int lineno = token_type == STRING ? p->tok->first_lineno : p->tok->lineno;
+    int end_lineno = p->tok->lineno;
+
+    int col_offset = (start != NULL && start >= line_start) ? (int)(start - line_start) : -1;
+    int end_col_offset = (end != NULL && end >= p->tok->line_start) ? (int)(end - p->tok->line_start) : -1;
+
+    token->lineno = lineno;
+    token->col_offset = p->tok->lineno == p->starting_lineno ? p->starting_col_offset + col_offset : col_offset;
+    token->end_lineno = end_lineno;
+    token->end_col_offset = p->tok->lineno == p->starting_lineno ? p->starting_col_offset + end_col_offset : end_col_offset;
+
+    p->fill += 1;
+
+    if (token_type == ERRORTOKEN && p->tok->done == E_DECODE) {
+        return raise_decode_error(p);
+    }
+
+    return (token_type == ERRORTOKEN ? tokenizer_error(p) : 0);
+}
+
+static int
+_resize_tokens_array(Parser *p) {
+    int newsize = p->size * 2;
+    Token **new_tokens = PyMem_Realloc(p->tokens, newsize * sizeof(Token *));
+    if (new_tokens == NULL) {
+        PyErr_NoMemory();
+        return -1;
+    }
+    p->tokens = new_tokens;
+
+    for (int i = p->size; i < newsize; i++) {
+        p->tokens[i] = PyMem_Calloc(1, sizeof(Token));
+        if (p->tokens[i] == NULL) {
+            p->size = i; // Needed, in order to cleanup correctly after parser fails
+            PyErr_NoMemory();
+            return -1;
+        }
+    }
+    p->size = newsize;
+    return 0;
+}
+
 int
 _PyPegen_fill_token(Parser *p)
 {
@@ -600,7 +770,8 @@
         type = PyTokenizer_Get(p->tok, &start, &end);
     }
 
-    if (type == ENDMARKER && p->start_rule == Py_single_input && p->parsing_started) {
+    // If we have reached the end and we are in single input mode we need to insert a newline and reset the parsing
+    if (p->start_rule == Py_single_input && type == ENDMARKER && p->parsing_started) {
         type = NEWLINE; /* Add an extra newline */
         p->parsing_started = 0;
 
@@ -613,65 +784,17 @@
         p->parsing_started = 1;
     }
 
-    if (p->fill == p->size) {
-        int newsize = p->size * 2;
-        Token **new_tokens = PyMem_Realloc(p->tokens, newsize * sizeof(Token *));
-        if (new_tokens == NULL) {
-            PyErr_NoMemory();
-            return -1;
-        }
-        p->tokens = new_tokens;
-
-        for (int i = p->size; i < newsize; i++) {
-            p->tokens[i] = PyMem_Malloc(sizeof(Token));
-            if (p->tokens[i] == NULL) {
-                p->size = i; // Needed, in order to cleanup correctly after parser fails
-                PyErr_NoMemory();
-                return -1;
-            }
-            memset(p->tokens[i], '\0', sizeof(Token));
-        }
-        p->size = newsize;
+    // Check if we are at the limit of the token array capacity and resize if needed
+    if ((p->fill == p->size) && (_resize_tokens_array(p) != 0)) {
+        return -1;
     }
 
     Token *t = p->tokens[p->fill];
-    t->type = (type == NAME) ? _get_keyword_or_name_type(p, start, (int)(end - start)) : type;
-    t->bytes = PyBytes_FromStringAndSize(start, end - start);
-    if (t->bytes == NULL) {
-        return -1;
-    }
-    PyArena_AddPyObject(p->arena, t->bytes);
-
-    int lineno = type == STRING ? p->tok->first_lineno : p->tok->lineno;
-    const char *line_start = type == STRING ? p->tok->multi_line_start : p->tok->line_start;
-    int end_lineno = p->tok->lineno;
-    int col_offset = -1;
-    int end_col_offset = -1;
-    if (start != NULL && start >= line_start) {
-        col_offset = (int)(start - line_start);
-    }
-    if (end != NULL && end >= p->tok->line_start) {
-        end_col_offset = (int)(end - p->tok->line_start);
-    }
-
-    t->lineno = p->starting_lineno + lineno;
-    t->col_offset = p->tok->lineno == 1 ? p->starting_col_offset + col_offset : col_offset;
-    t->end_lineno = p->starting_lineno + end_lineno;
-    t->end_col_offset = p->tok->lineno == 1 ? p->starting_col_offset + end_col_offset : end_col_offset;
-
-    p->fill += 1;
-
-    if (type == ERRORTOKEN) {
-        if (p->tok->done == E_DECODE) {
-            return raise_decode_error(p);
-        }
-        return tokenizer_error(p);
-
-    }
-
-    return 0;
+    return initialize_token(p, t, start, end, type);
 }
 
+
+#if defined(Py_DEBUG)
 // Instrumentation to count the effectiveness of memoization.
 // The array counts the number of tokens skipped by memoization,
 // indexed by type.
@@ -708,6 +831,7 @@
     }
     return ret;
 }
+#endif
 
 int  // bool
 _PyPegen_is_memoized(Parser *p, int type, void *pres)
@@ -723,6 +847,7 @@
 
     for (Memo *m = t->memo; m != NULL; m = m->next) {
         if (m->type == type) {
+#if defined(PY_DEBUG)
             if (0 <= type && type < NSTATISTICS) {
                 long count = m->mark - p->mark;
                 // A memoized negative result counts for one.
@@ -731,6 +856,7 @@
                 }
                 memo_statistics[type] += count;
             }
+#endif
             p->mark = m->mark;
             *(void **)(pres) = m->node;
             return 1;
@@ -792,6 +918,28 @@
     return t;
 }
 
+Token *
+_PyPegen_expect_forced_token(Parser *p, int type, const char* expected) {
+
+    if (p->error_indicator == 1) {
+        return NULL;
+    }
+
+    if (p->mark == p->fill) {
+        if (_PyPegen_fill_token(p) < 0) {
+            p->error_indicator = 1;
+            return NULL;
+        }
+    }
+    Token *t = p->tokens[p->mark];
+    if (t->type != type) {
+        RAISE_SYNTAX_ERROR_KNOWN_LOCATION(t, "expected '%s'", expected);
+        return NULL;
+    }
+    p->mark += 1;
+    return t;
+}
+
 expr_ty
 _PyPegen_expect_soft_keyword(Parser *p, const char *keyword)
 {
@@ -805,7 +953,7 @@
     if (t->type != NAME) {
         return NULL;
     }
-    char* s = PyBytes_AsString(t->bytes);
+    const char *s = PyBytes_AsString(t->bytes);
     if (!s) {
         p->error_indicator = 1;
         return NULL;
@@ -830,14 +978,13 @@
     return token;
 }
 
-expr_ty
-_PyPegen_name_token(Parser *p)
+static expr_ty
+_PyPegen_name_from_token(Parser *p, Token* t)
 {
-    Token *t = _PyPegen_expect_token(p, NAME);
     if (t == NULL) {
         return NULL;
     }
-    char* s = PyBytes_AsString(t->bytes);
+    const char *s = PyBytes_AsString(t->bytes);
     if (!s) {
         p->error_indicator = 1;
         return NULL;
@@ -847,8 +994,16 @@
         p->error_indicator = 1;
         return NULL;
     }
-    return Name(id, Load, t->lineno, t->col_offset, t->end_lineno, t->end_col_offset,
-                p->arena);
+    return _PyAST_Name(id, Load, t->lineno, t->col_offset, t->end_lineno,
+                       t->end_col_offset, p->arena);
+}
+
+
+expr_ty
+_PyPegen_name_token(Parser *p)
+{
+    Token *t = _PyPegen_expect_token(p, NAME);
+    return _PyPegen_name_from_token(p, t);
 }
 
 void *
@@ -857,6 +1012,23 @@
     return _PyPegen_expect_token(p, STRING);
 }
 
+
+expr_ty _PyPegen_soft_keyword_token(Parser *p) {
+    Token *t = _PyPegen_expect_token(p, NAME);
+    if (t == NULL) {
+        return NULL;
+    }
+    char *the_token;
+    Py_ssize_t size;
+    PyBytes_AsStringAndSize(t->bytes, &the_token, &size);
+    for (char **keyword = p->soft_keywords; *keyword != NULL; keyword++) {
+        if (strncmp(*keyword, the_token, size) == 0) {
+            return _PyPegen_name_from_token(p, t);
+        }
+    }
+    return NULL;
+}
+
 static PyObject *
 parsenumber_raw(const char *s)
 {
@@ -938,7 +1110,7 @@
         return NULL;
     }
 
-    char *num_raw = PyBytes_AsString(t->bytes);
+    const char *num_raw = PyBytes_AsString(t->bytes);
     if (num_raw == NULL) {
         p->error_indicator = 1;
         return NULL;
@@ -957,25 +1129,14 @@
         return NULL;
     }
 
-    if (PyArena_AddPyObject(p->arena, c) < 0) {
+    if (_PyArena_AddPyObject(p->arena, c) < 0) {
         Py_DECREF(c);
         p->error_indicator = 1;
         return NULL;
     }
 
-    return Constant(c, NULL, t->lineno, t->col_offset, t->end_lineno, t->end_col_offset,
-                    p->arena);
-}
-
-static int // bool
-newline_in_string(Parser *p, const char *cur)
-{
-    for (const char *c = cur; c >= p->tok->buf; c--) {
-        if (*c == '\'' || *c == '"') {
-            return 1;
-        }
-    }
-    return 0;
+    return _PyAST_Constant(c, NULL, t->lineno, t->col_offset, t->end_lineno,
+                           t->end_col_offset, p->arena);
 }
 
 /* Check that the source for a single input statement really is a single
@@ -984,14 +1145,7 @@
 static int // bool
 bad_single_statement(Parser *p)
 {
-    const char *cur = strchr(p->tok->buf, '\n');
-
-    /* Newlines are allowed if preceded by a line continuation character
-       or if they appear inside a string. */
-    if (!cur || (cur != p->tok->buf && *(cur - 1) == '\\')
-             || newline_in_string(p, cur)) {
-        return 0;
-    }
+    char *cur = p->tok->cur;
     char c = *cur;
 
     for (;;) {
@@ -1048,6 +1202,9 @@
     if ((flags->cf_flags & PyCF_ONLY_AST) && flags->cf_feature_version < 7) {
         parser_flags |= PyPARSE_ASYNC_HACKS;
     }
+    if (flags->cf_flags & PyCF_ALLOW_INCOMPLETE_INPUT) {
+        parser_flags |= PyPARSE_ALLOW_INCOMPLETE_INPUT;
+    }
     return parser_flags;
 }
 
@@ -1065,6 +1222,7 @@
     p->tok = tok;
     p->keywords = NULL;
     p->n_keyword_lists = -1;
+    p->soft_keywords = NULL;
     p->tokens = PyMem_Malloc(sizeof(Token *));
     if (!p->tokens) {
         PyMem_Free(p);
@@ -1101,7 +1259,6 @@
     p->known_err_token = NULL;
     p->level = 0;
     p->call_invalid_rules = 0;
-
     return p;
 }
 
@@ -1113,23 +1270,109 @@
     }
     p->mark = 0;
     p->call_invalid_rules = 1;
+    // Don't try to get extra tokens in interactive mode when trying to
+    // raise specialized errors in the second pass.
+    p->tok->interactive_underflow = IUNDERFLOW_STOP;
+}
+
+static int
+_PyPegen_check_tokenizer_errors(Parser *p) {
+    // Tokenize the whole input to see if there are any tokenization
+    // errors such as mistmatching parentheses. These will get priority
+    // over generic syntax errors only if the line number of the error is
+    // before the one that we had for the generic error.
+
+    // We don't want to tokenize to the end for interactive input
+    if (p->tok->prompt != NULL) {
+        return 0;
+    }
+
+    PyObject *type, *value, *traceback;
+    PyErr_Fetch(&type, &value, &traceback);
+
+    Token *current_token = p->known_err_token != NULL ? p->known_err_token : p->tokens[p->fill - 1];
+    Py_ssize_t current_err_line = current_token->lineno;
+
+    int ret = 0;
+
+    for (;;) {
+        const char *start;
+        const char *end;
+        switch (PyTokenizer_Get(p->tok, &start, &end)) {
+            case ERRORTOKEN:
+                if (p->tok->level != 0) {
+                    int error_lineno = p->tok->parenlinenostack[p->tok->level-1];
+                    if (current_err_line > error_lineno) {
+                        raise_unclosed_parentheses_error(p);
+                        ret = -1;
+                        goto exit;
+                    }
+                }
+                break;
+            case ENDMARKER:
+                break;
+            default:
+                continue;
+        }
+        break;
+    }
+
+
+exit:
+    if (PyErr_Occurred()) {
+        Py_XDECREF(value);
+        Py_XDECREF(type);
+        Py_XDECREF(traceback);
+    } else {
+        PyErr_Restore(type, value, traceback);
+    }
+    return ret;
+}
+
+
+static inline int
+_is_end_of_source(Parser *p) {
+    int err = p->tok->done;
+    return err == E_EOF || err == E_EOFS || err == E_EOLS;
 }
 
 void *
 _PyPegen_run_parser(Parser *p)
 {
     void *res = _PyPegen_parse(p);
+    assert(p->level == 0);
     if (res == NULL) {
+        if ((p->flags & PyPARSE_ALLOW_INCOMPLETE_INPUT) &&  _is_end_of_source(p)) {
+            PyErr_Clear();
+            return RAISE_SYNTAX_ERROR("incomplete input");
+        }
+        if (PyErr_Occurred() && !PyErr_ExceptionMatches(PyExc_SyntaxError)) {
+            return NULL;
+        }
+        // Make a second parser pass. In this pass we activate heavier and slower checks
+        // to produce better error messages and more complete diagnostics. Extra "invalid_*"
+        // rules will be active during parsing.
+        Token *last_token = p->tokens[p->fill - 1];
         reset_parser_state(p);
         _PyPegen_parse(p);
         if (PyErr_Occurred()) {
+            // Prioritize tokenizer errors to custom syntax errors raised
+            // on the second phase only if the errors come from the parser.
+            int is_tok_ok = (p->tok->done == E_DONE || p->tok->done == E_OK);
+            if (is_tok_ok && PyErr_ExceptionMatches(PyExc_SyntaxError)) {
+                _PyPegen_check_tokenizer_errors(p);
+            }
             return NULL;
         }
         if (p->fill == 0) {
             RAISE_SYNTAX_ERROR("error at start before reading any input");
         }
-        else if (p->tok->done == E_EOF) {
-            RAISE_SYNTAX_ERROR("unexpected EOF while parsing");
+        else if (last_token->type == ERRORTOKEN && p->tok->done == E_EOF) {
+            if (p->tok->level) {
+                raise_unclosed_parentheses_error(p);
+            } else {
+                RAISE_SYNTAX_ERROR("unexpected EOF while parsing");
+            }
         }
         else {
             if (p->tokens[p->fill-1]->type == INDENT) {
@@ -1139,7 +1382,14 @@
                 RAISE_INDENTATION_ERROR("unexpected unindent");
             }
             else {
-                RAISE_SYNTAX_ERROR("invalid syntax");
+                // Use the last token we found on the first pass to avoid reporting
+                // incorrect locations for generic syntax errors just because we reached
+                // further away when trying to find specific syntax errors in the second
+                // pass.
+                RAISE_SYNTAX_ERROR_KNOWN_LOCATION(last_token, "invalid syntax");
+                // _PyPegen_check_tokenizer_errors will override the existing
+                // generic SyntaxError we just raised if errors are found.
+                _PyPegen_check_tokenizer_errors(p);
             }
         }
         return NULL;
@@ -1150,12 +1400,15 @@
         return RAISE_SYNTAX_ERROR("multiple statements found while compiling a single statement");
     }
 
-#if defined(Py_DEBUG) && defined(Py_BUILD_CORE)
+    // test_peg_generator defines _Py_TEST_PEGEN to not call PyAST_Validate()
+#if defined(Py_DEBUG) && !defined(_Py_TEST_PEGEN)
     if (p->start_rule == Py_single_input ||
         p->start_rule == Py_file_input ||
         p->start_rule == Py_eval_input)
     {
-        assert(PyAST_Validate(res));
+        if (!_PyAST_Validate(res)) {
+            return NULL;
+        }
     }
 #endif
     return res;
@@ -1174,6 +1427,10 @@
         }
         return NULL;
     }
+    if (!tok->fp || ps1 != NULL || ps2 != NULL ||
+        PyUnicode_CompareWithASCIIString(filename_ob, "<stdin>") == 0) {
+        tok->fp_interactive = 1;
+    }
     // This transfers the ownership to the tokenizer
     tok->filename = filename_ob;
     Py_INCREF(filename_ob);
@@ -1197,30 +1454,13 @@
 }
 
 mod_ty
-_PyPegen_run_parser_from_file(const char *filename, int start_rule,
-                     PyObject *filename_ob, PyCompilerFlags *flags, PyArena *arena)
-{
-    FILE *fp = fopen(filename, "rb");
-    if (fp == NULL) {
-        PyErr_SetFromErrnoWithFilename(PyExc_OSError, filename);
-        return NULL;
-    }
-
-    mod_ty result = _PyPegen_run_parser_from_file_pointer(fp, start_rule, filename_ob,
-                                                 NULL, NULL, NULL, flags, NULL, arena);
-
-    fclose(fp);
-    return result;
-}
-
-mod_ty
 _PyPegen_run_parser_from_string(const char *str, int start_rule, PyObject *filename_ob,
                        PyCompilerFlags *flags, PyArena *arena)
 {
     int exec_input = start_rule == Py_file_input;
 
     struct tok_state *tok;
-    if (flags == NULL || flags->cf_flags & PyCF_IGNORE_COOKIE) {
+    if (flags != NULL && flags->cf_flags & PyCF_IGNORE_COOKIE) {
         tok = PyTokenizer_FromUTF8(str, exec_input);
     } else {
         tok = PyTokenizer_FromString(str, exec_input);
@@ -1255,7 +1495,7 @@
     return result;
 }
 
-void *
+asdl_stmt_seq*
 _PyPegen_interactive_exit(Parser *p)
 {
     if (p->errcode) {
@@ -1269,11 +1509,11 @@
 _PyPegen_singleton_seq(Parser *p, void *a)
 {
     assert(a != NULL);
-    asdl_seq *seq = _Py_asdl_seq_new(1, p->arena);
+    asdl_seq *seq = (asdl_seq*)_Py_asdl_generic_seq_new(1, p->arena);
     if (!seq) {
         return NULL;
     }
-    asdl_seq_SET(seq, 0, a);
+    asdl_seq_SET_UNTYPED(seq, 0, a);
     return seq;
 }
 
@@ -1286,14 +1526,14 @@
         return _PyPegen_singleton_seq(p, a);
     }
 
-    asdl_seq *new_seq = _Py_asdl_seq_new(asdl_seq_LEN(seq) + 1, p->arena);
+    asdl_seq *new_seq = (asdl_seq*)_Py_asdl_generic_seq_new(asdl_seq_LEN(seq) + 1, p->arena);
     if (!new_seq) {
         return NULL;
     }
 
-    asdl_seq_SET(new_seq, 0, a);
+    asdl_seq_SET_UNTYPED(new_seq, 0, a);
     for (Py_ssize_t i = 1, l = asdl_seq_LEN(new_seq); i < l; i++) {
-        asdl_seq_SET(new_seq, i, asdl_seq_GET(seq, i - 1));
+        asdl_seq_SET_UNTYPED(new_seq, i, asdl_seq_GET_UNTYPED(seq, i - 1));
     }
     return new_seq;
 }
@@ -1307,15 +1547,15 @@
         return _PyPegen_singleton_seq(p, a);
     }
 
-    asdl_seq *new_seq = _Py_asdl_seq_new(asdl_seq_LEN(seq) + 1, p->arena);
+    asdl_seq *new_seq = (asdl_seq*)_Py_asdl_generic_seq_new(asdl_seq_LEN(seq) + 1, p->arena);
     if (!new_seq) {
         return NULL;
     }
 
     for (Py_ssize_t i = 0, l = asdl_seq_LEN(new_seq); i + 1 < l; i++) {
-        asdl_seq_SET(new_seq, i, asdl_seq_GET(seq, i));
+        asdl_seq_SET_UNTYPED(new_seq, i, asdl_seq_GET_UNTYPED(seq, i));
     }
-    asdl_seq_SET(new_seq, asdl_seq_LEN(new_seq) - 1, a);
+    asdl_seq_SET_UNTYPED(new_seq, asdl_seq_LEN(new_seq) - 1, a);
     return new_seq;
 }
 
@@ -1324,7 +1564,7 @@
 {
     Py_ssize_t size = 0;
     for (Py_ssize_t i = 0, l = asdl_seq_LEN(seqs); i < l; i++) {
-        asdl_seq *inner_seq = asdl_seq_GET(seqs, i);
+        asdl_seq *inner_seq = asdl_seq_GET_UNTYPED(seqs, i);
         size += asdl_seq_LEN(inner_seq);
     }
     return size;
@@ -1337,16 +1577,16 @@
     Py_ssize_t flattened_seq_size = _get_flattened_seq_size(seqs);
     assert(flattened_seq_size > 0);
 
-    asdl_seq *flattened_seq = _Py_asdl_seq_new(flattened_seq_size, p->arena);
+    asdl_seq *flattened_seq = (asdl_seq*)_Py_asdl_generic_seq_new(flattened_seq_size, p->arena);
     if (!flattened_seq) {
         return NULL;
     }
 
     int flattened_seq_idx = 0;
     for (Py_ssize_t i = 0, l = asdl_seq_LEN(seqs); i < l; i++) {
-        asdl_seq *inner_seq = asdl_seq_GET(seqs, i);
+        asdl_seq *inner_seq = asdl_seq_GET_UNTYPED(seqs, i);
         for (Py_ssize_t j = 0, li = asdl_seq_LEN(inner_seq); j < li; j++) {
-            asdl_seq_SET(flattened_seq, flattened_seq_idx++, asdl_seq_GET(inner_seq, j));
+            asdl_seq_SET_UNTYPED(flattened_seq, flattened_seq_idx++, asdl_seq_GET_UNTYPED(inner_seq, j));
         }
     }
     assert(flattened_seq_idx == flattened_seq_size);
@@ -1354,6 +1594,20 @@
     return flattened_seq;
 }
 
+void *
+_PyPegen_seq_last_item(asdl_seq *seq)
+{
+    Py_ssize_t len = asdl_seq_LEN(seq);
+    return asdl_seq_GET_UNTYPED(seq, len - 1);
+}
+
+void *
+_PyPegen_seq_first_item(asdl_seq *seq)
+{
+    return asdl_seq_GET_UNTYPED(seq, 0);
+}
+
+
 /* Creates a new name of the form <first_name>.<second_name> */
 expr_ty
 _PyPegen_join_names_with_dot(Parser *p, expr_ty first_name, expr_ty second_name)
@@ -1401,12 +1655,12 @@
         return NULL;
     }
     PyUnicode_InternInPlace(&uni);
-    if (PyArena_AddPyObject(p->arena, uni) < 0) {
+    if (_PyArena_AddPyObject(p->arena, uni) < 0) {
         Py_DECREF(uni);
         return NULL;
     }
 
-    return _Py_Name(uni, Load, EXTRA_EXPR(first_name, second_name));
+    return _PyAST_Name(uni, Load, EXTRA_EXPR(first_name, second_name));
 }
 
 /* Counts the total number of dots in seq's tokens */
@@ -1415,7 +1669,7 @@
 {
     int number_of_dots = 0;
     for (Py_ssize_t i = 0, l = asdl_seq_LEN(seq); i < l; i++) {
-        Token *current_expr = asdl_seq_GET(seq, i);
+        Token *current_expr = asdl_seq_GET_UNTYPED(seq, i);
         switch (current_expr->type) {
             case ELLIPSIS:
                 number_of_dots += 3;
@@ -1433,27 +1687,27 @@
 
 /* Creates an alias with '*' as the identifier name */
 alias_ty
-_PyPegen_alias_for_star(Parser *p)
-{
+_PyPegen_alias_for_star(Parser *p, int lineno, int col_offset, int end_lineno,
+                        int end_col_offset, PyArena *arena) {
     PyObject *str = PyUnicode_InternFromString("*");
     if (!str) {
         return NULL;
     }
-    if (PyArena_AddPyObject(p->arena, str) < 0) {
+    if (_PyArena_AddPyObject(p->arena, str) < 0) {
         Py_DECREF(str);
         return NULL;
     }
-    return alias(str, NULL, p->arena);
+    return _PyAST_alias(str, NULL, lineno, col_offset, end_lineno, end_col_offset, arena);
 }
 
 /* Creates a new asdl_seq* with the identifiers of all the names in seq */
-asdl_seq *
-_PyPegen_map_names_to_ids(Parser *p, asdl_seq *seq)
+asdl_identifier_seq *
+_PyPegen_map_names_to_ids(Parser *p, asdl_expr_seq *seq)
 {
     Py_ssize_t len = asdl_seq_LEN(seq);
     assert(len > 0);
 
-    asdl_seq *new_seq = _Py_asdl_seq_new(len, p->arena);
+    asdl_identifier_seq *new_seq = _Py_asdl_identifier_seq_new(len, p->arena);
     if (!new_seq) {
         return NULL;
     }
@@ -1469,7 +1723,7 @@
 _PyPegen_cmpop_expr_pair(Parser *p, cmpop_ty cmpop, expr_ty expr)
 {
     assert(expr != NULL);
-    CmpopExprPair *a = PyArena_Malloc(p->arena, sizeof(CmpopExprPair));
+    CmpopExprPair *a = _PyArena_Malloc(p->arena, sizeof(CmpopExprPair));
     if (!a) {
         return NULL;
     }
@@ -1489,39 +1743,39 @@
         return NULL;
     }
     for (Py_ssize_t i = 0; i < len; i++) {
-        CmpopExprPair *pair = asdl_seq_GET(seq, i);
+        CmpopExprPair *pair = asdl_seq_GET_UNTYPED(seq, i);
         asdl_seq_SET(new_seq, i, pair->cmpop);
     }
     return new_seq;
 }
 
-asdl_seq *
+asdl_expr_seq *
 _PyPegen_get_exprs(Parser *p, asdl_seq *seq)
 {
     Py_ssize_t len = asdl_seq_LEN(seq);
     assert(len > 0);
 
-    asdl_seq *new_seq = _Py_asdl_seq_new(len, p->arena);
+    asdl_expr_seq *new_seq = _Py_asdl_expr_seq_new(len, p->arena);
     if (!new_seq) {
         return NULL;
     }
     for (Py_ssize_t i = 0; i < len; i++) {
-        CmpopExprPair *pair = asdl_seq_GET(seq, i);
+        CmpopExprPair *pair = asdl_seq_GET_UNTYPED(seq, i);
         asdl_seq_SET(new_seq, i, pair->expr);
     }
     return new_seq;
 }
 
 /* Creates an asdl_seq* where all the elements have been changed to have ctx as context */
-static asdl_seq *
-_set_seq_context(Parser *p, asdl_seq *seq, expr_context_ty ctx)
+static asdl_expr_seq *
+_set_seq_context(Parser *p, asdl_expr_seq *seq, expr_context_ty ctx)
 {
     Py_ssize_t len = asdl_seq_LEN(seq);
     if (len == 0) {
         return NULL;
     }
 
-    asdl_seq *new_seq = _Py_asdl_seq_new(len, p->arena);
+    asdl_expr_seq *new_seq = _Py_asdl_expr_seq_new(len, p->arena);
     if (!new_seq) {
         return NULL;
     }
@@ -1535,37 +1789,46 @@
 static expr_ty
 _set_name_context(Parser *p, expr_ty e, expr_context_ty ctx)
 {
-    return _Py_Name(e->v.Name.id, ctx, EXTRA_EXPR(e, e));
+    return _PyAST_Name(e->v.Name.id, ctx, EXTRA_EXPR(e, e));
 }
 
 static expr_ty
 _set_tuple_context(Parser *p, expr_ty e, expr_context_ty ctx)
 {
-    return _Py_Tuple(_set_seq_context(p, e->v.Tuple.elts, ctx), ctx, EXTRA_EXPR(e, e));
+    return _PyAST_Tuple(
+            _set_seq_context(p, e->v.Tuple.elts, ctx),
+            ctx,
+            EXTRA_EXPR(e, e));
 }
 
 static expr_ty
 _set_list_context(Parser *p, expr_ty e, expr_context_ty ctx)
 {
-    return _Py_List(_set_seq_context(p, e->v.List.elts, ctx), ctx, EXTRA_EXPR(e, e));
+    return _PyAST_List(
+            _set_seq_context(p, e->v.List.elts, ctx),
+            ctx,
+            EXTRA_EXPR(e, e));
 }
 
 static expr_ty
 _set_subscript_context(Parser *p, expr_ty e, expr_context_ty ctx)
 {
-    return _Py_Subscript(e->v.Subscript.value, e->v.Subscript.slice, ctx, EXTRA_EXPR(e, e));
+    return _PyAST_Subscript(e->v.Subscript.value, e->v.Subscript.slice,
+                            ctx, EXTRA_EXPR(e, e));
 }
 
 static expr_ty
 _set_attribute_context(Parser *p, expr_ty e, expr_context_ty ctx)
 {
-    return _Py_Attribute(e->v.Attribute.value, e->v.Attribute.attr, ctx, EXTRA_EXPR(e, e));
+    return _PyAST_Attribute(e->v.Attribute.value, e->v.Attribute.attr,
+                            ctx, EXTRA_EXPR(e, e));
 }
 
 static expr_ty
 _set_starred_context(Parser *p, expr_ty e, expr_context_ty ctx)
 {
-    return _Py_Starred(_PyPegen_set_expr_context(p, e->v.Starred.value, ctx), ctx, EXTRA_EXPR(e, e));
+    return _PyAST_Starred(_PyPegen_set_expr_context(p, e->v.Starred.value, ctx),
+                          ctx, EXTRA_EXPR(e, e));
 }
 
 /* Creates an `expr_ty` equivalent to `expr` but with `ctx` as context */
@@ -1604,7 +1867,7 @@
 KeyValuePair *
 _PyPegen_key_value_pair(Parser *p, expr_ty key, expr_ty value)
 {
-    KeyValuePair *a = PyArena_Malloc(p->arena, sizeof(KeyValuePair));
+    KeyValuePair *a = _PyArena_Malloc(p->arena, sizeof(KeyValuePair));
     if (!a) {
         return NULL;
     }
@@ -1614,42 +1877,87 @@
 }
 
 /* Extracts all keys from an asdl_seq* of KeyValuePair*'s */
-asdl_seq *
+asdl_expr_seq *
 _PyPegen_get_keys(Parser *p, asdl_seq *seq)
 {
     Py_ssize_t len = asdl_seq_LEN(seq);
-    asdl_seq *new_seq = _Py_asdl_seq_new(len, p->arena);
+    asdl_expr_seq *new_seq = _Py_asdl_expr_seq_new(len, p->arena);
     if (!new_seq) {
         return NULL;
     }
     for (Py_ssize_t i = 0; i < len; i++) {
-        KeyValuePair *pair = asdl_seq_GET(seq, i);
+        KeyValuePair *pair = asdl_seq_GET_UNTYPED(seq, i);
         asdl_seq_SET(new_seq, i, pair->key);
     }
     return new_seq;
 }
 
 /* Extracts all values from an asdl_seq* of KeyValuePair*'s */
-asdl_seq *
+asdl_expr_seq *
 _PyPegen_get_values(Parser *p, asdl_seq *seq)
 {
     Py_ssize_t len = asdl_seq_LEN(seq);
-    asdl_seq *new_seq = _Py_asdl_seq_new(len, p->arena);
+    asdl_expr_seq *new_seq = _Py_asdl_expr_seq_new(len, p->arena);
     if (!new_seq) {
         return NULL;
     }
     for (Py_ssize_t i = 0; i < len; i++) {
-        KeyValuePair *pair = asdl_seq_GET(seq, i);
+        KeyValuePair *pair = asdl_seq_GET_UNTYPED(seq, i);
         asdl_seq_SET(new_seq, i, pair->value);
     }
     return new_seq;
 }
 
+/* Constructs a KeyPatternPair that is used when parsing mapping & class patterns */
+KeyPatternPair *
+_PyPegen_key_pattern_pair(Parser *p, expr_ty key, pattern_ty pattern)
+{
+    KeyPatternPair *a = _PyArena_Malloc(p->arena, sizeof(KeyPatternPair));
+    if (!a) {
+        return NULL;
+    }
+    a->key = key;
+    a->pattern = pattern;
+    return a;
+}
+
+/* Extracts all keys from an asdl_seq* of KeyPatternPair*'s */
+asdl_expr_seq *
+_PyPegen_get_pattern_keys(Parser *p, asdl_seq *seq)
+{
+    Py_ssize_t len = asdl_seq_LEN(seq);
+    asdl_expr_seq *new_seq = _Py_asdl_expr_seq_new(len, p->arena);
+    if (!new_seq) {
+        return NULL;
+    }
+    for (Py_ssize_t i = 0; i < len; i++) {
+        KeyPatternPair *pair = asdl_seq_GET_UNTYPED(seq, i);
+        asdl_seq_SET(new_seq, i, pair->key);
+    }
+    return new_seq;
+}
+
+/* Extracts all patterns from an asdl_seq* of KeyPatternPair*'s */
+asdl_pattern_seq *
+_PyPegen_get_patterns(Parser *p, asdl_seq *seq)
+{
+    Py_ssize_t len = asdl_seq_LEN(seq);
+    asdl_pattern_seq *new_seq = _Py_asdl_pattern_seq_new(len, p->arena);
+    if (!new_seq) {
+        return NULL;
+    }
+    for (Py_ssize_t i = 0; i < len; i++) {
+        KeyPatternPair *pair = asdl_seq_GET_UNTYPED(seq, i);
+        asdl_seq_SET(new_seq, i, pair->pattern);
+    }
+    return new_seq;
+}
+
 /* Constructs a NameDefaultPair */
 NameDefaultPair *
 _PyPegen_name_default_pair(Parser *p, arg_ty arg, expr_ty value, Token *tc)
 {
-    NameDefaultPair *a = PyArena_Malloc(p->arena, sizeof(NameDefaultPair));
+    NameDefaultPair *a = _PyArena_Malloc(p->arena, sizeof(NameDefaultPair));
     if (!a) {
         return NULL;
     }
@@ -1660,9 +1968,9 @@
 
 /* Constructs a SlashWithDefault */
 SlashWithDefault *
-_PyPegen_slash_with_default(Parser *p, asdl_seq *plain_names, asdl_seq *names_with_defaults)
+_PyPegen_slash_with_default(Parser *p, asdl_arg_seq *plain_names, asdl_seq *names_with_defaults)
 {
-    SlashWithDefault *a = PyArena_Malloc(p->arena, sizeof(SlashWithDefault));
+    SlashWithDefault *a = _PyArena_Malloc(p->arena, sizeof(SlashWithDefault));
     if (!a) {
         return NULL;
     }
@@ -1675,7 +1983,7 @@
 StarEtc *
 _PyPegen_star_etc(Parser *p, arg_ty vararg, asdl_seq *kwonlyargs, arg_ty kwarg)
 {
-    StarEtc *a = PyArena_Malloc(p->arena, sizeof(StarEtc));
+    StarEtc *a = _PyArena_Malloc(p->arena, sizeof(StarEtc));
     if (!a) {
         return NULL;
     }
@@ -1690,140 +1998,182 @@
 {
     Py_ssize_t first_len = asdl_seq_LEN(a);
     Py_ssize_t second_len = asdl_seq_LEN(b);
-    asdl_seq *new_seq = _Py_asdl_seq_new(first_len + second_len, p->arena);
+    asdl_seq *new_seq = (asdl_seq*)_Py_asdl_generic_seq_new(first_len + second_len, p->arena);
     if (!new_seq) {
         return NULL;
     }
 
     int k = 0;
     for (Py_ssize_t i = 0; i < first_len; i++) {
-        asdl_seq_SET(new_seq, k++, asdl_seq_GET(a, i));
+        asdl_seq_SET_UNTYPED(new_seq, k++, asdl_seq_GET_UNTYPED(a, i));
     }
     for (Py_ssize_t i = 0; i < second_len; i++) {
-        asdl_seq_SET(new_seq, k++, asdl_seq_GET(b, i));
+        asdl_seq_SET_UNTYPED(new_seq, k++, asdl_seq_GET_UNTYPED(b, i));
     }
 
     return new_seq;
 }
 
-static asdl_seq *
+static asdl_arg_seq*
 _get_names(Parser *p, asdl_seq *names_with_defaults)
 {
     Py_ssize_t len = asdl_seq_LEN(names_with_defaults);
-    asdl_seq *seq = _Py_asdl_seq_new(len, p->arena);
+    asdl_arg_seq *seq = _Py_asdl_arg_seq_new(len, p->arena);
     if (!seq) {
         return NULL;
     }
     for (Py_ssize_t i = 0; i < len; i++) {
-        NameDefaultPair *pair = asdl_seq_GET(names_with_defaults, i);
+        NameDefaultPair *pair = asdl_seq_GET_UNTYPED(names_with_defaults, i);
         asdl_seq_SET(seq, i, pair->arg);
     }
     return seq;
 }
 
-static asdl_seq *
+static asdl_expr_seq *
 _get_defaults(Parser *p, asdl_seq *names_with_defaults)
 {
     Py_ssize_t len = asdl_seq_LEN(names_with_defaults);
-    asdl_seq *seq = _Py_asdl_seq_new(len, p->arena);
+    asdl_expr_seq *seq = _Py_asdl_expr_seq_new(len, p->arena);
     if (!seq) {
         return NULL;
     }
     for (Py_ssize_t i = 0; i < len; i++) {
-        NameDefaultPair *pair = asdl_seq_GET(names_with_defaults, i);
+        NameDefaultPair *pair = asdl_seq_GET_UNTYPED(names_with_defaults, i);
         asdl_seq_SET(seq, i, pair->value);
     }
     return seq;
 }
 
-/* Constructs an arguments_ty object out of all the parsed constructs in the parameters rule */
-arguments_ty
-_PyPegen_make_arguments(Parser *p, asdl_seq *slash_without_default,
-                        SlashWithDefault *slash_with_default, asdl_seq *plain_names,
-                        asdl_seq *names_with_default, StarEtc *star_etc)
-{
-    asdl_seq *posonlyargs;
+static int
+_make_posonlyargs(Parser *p,
+                  asdl_arg_seq *slash_without_default,
+                  SlashWithDefault *slash_with_default,
+                  asdl_arg_seq **posonlyargs) {
     if (slash_without_default != NULL) {
-        posonlyargs = slash_without_default;
+        *posonlyargs = slash_without_default;
     }
     else if (slash_with_default != NULL) {
-        asdl_seq *slash_with_default_names =
-            _get_names(p, slash_with_default->names_with_defaults);
+        asdl_arg_seq *slash_with_default_names =
+                _get_names(p, slash_with_default->names_with_defaults);
         if (!slash_with_default_names) {
-            return NULL;
+            return -1;
         }
-        posonlyargs = _PyPegen_join_sequences(p, slash_with_default->plain_names, slash_with_default_names);
-        if (!posonlyargs) {
-            return NULL;
-        }
+        *posonlyargs = (asdl_arg_seq*)_PyPegen_join_sequences(
+                p,
+                (asdl_seq*)slash_with_default->plain_names,
+                (asdl_seq*)slash_with_default_names);
     }
     else {
-        posonlyargs = _Py_asdl_seq_new(0, p->arena);
-        if (!posonlyargs) {
-            return NULL;
-        }
+        *posonlyargs = _Py_asdl_arg_seq_new(0, p->arena);
     }
+    return *posonlyargs == NULL ? -1 : 0;
+}
 
-    asdl_seq *posargs;
+static int
+_make_posargs(Parser *p,
+              asdl_arg_seq *plain_names,
+              asdl_seq *names_with_default,
+              asdl_arg_seq **posargs) {
     if (plain_names != NULL && names_with_default != NULL) {
-        asdl_seq *names_with_default_names = _get_names(p, names_with_default);
+        asdl_arg_seq *names_with_default_names = _get_names(p, names_with_default);
         if (!names_with_default_names) {
-            return NULL;
+            return -1;
         }
-        posargs = _PyPegen_join_sequences(p, plain_names, names_with_default_names);
-        if (!posargs) {
-            return NULL;
-        }
+        *posargs = (asdl_arg_seq*)_PyPegen_join_sequences(
+                p,(asdl_seq*)plain_names, (asdl_seq*)names_with_default_names);
     }
     else if (plain_names == NULL && names_with_default != NULL) {
-        posargs = _get_names(p, names_with_default);
-        if (!posargs) {
-            return NULL;
-        }
+        *posargs = _get_names(p, names_with_default);
     }
     else if (plain_names != NULL && names_with_default == NULL) {
-        posargs = plain_names;
+        *posargs = plain_names;
     }
     else {
-        posargs = _Py_asdl_seq_new(0, p->arena);
-        if (!posargs) {
-            return NULL;
-        }
+        *posargs = _Py_asdl_arg_seq_new(0, p->arena);
     }
+    return *posargs == NULL ? -1 : 0;
+}
 
-    asdl_seq *posdefaults;
+static int
+_make_posdefaults(Parser *p,
+                  SlashWithDefault *slash_with_default,
+                  asdl_seq *names_with_default,
+                  asdl_expr_seq **posdefaults) {
     if (slash_with_default != NULL && names_with_default != NULL) {
-        asdl_seq *slash_with_default_values =
-            _get_defaults(p, slash_with_default->names_with_defaults);
+        asdl_expr_seq *slash_with_default_values =
+                _get_defaults(p, slash_with_default->names_with_defaults);
         if (!slash_with_default_values) {
-            return NULL;
+            return -1;
         }
-        asdl_seq *names_with_default_values = _get_defaults(p, names_with_default);
+        asdl_expr_seq *names_with_default_values = _get_defaults(p, names_with_default);
         if (!names_with_default_values) {
-            return NULL;
+            return -1;
         }
-        posdefaults = _PyPegen_join_sequences(p, slash_with_default_values, names_with_default_values);
-        if (!posdefaults) {
-            return NULL;
-        }
+        *posdefaults = (asdl_expr_seq*)_PyPegen_join_sequences(
+                p,
+                (asdl_seq*)slash_with_default_values,
+                (asdl_seq*)names_with_default_values);
     }
     else if (slash_with_default == NULL && names_with_default != NULL) {
-        posdefaults = _get_defaults(p, names_with_default);
-        if (!posdefaults) {
-            return NULL;
-        }
+        *posdefaults = _get_defaults(p, names_with_default);
     }
     else if (slash_with_default != NULL && names_with_default == NULL) {
-        posdefaults = _get_defaults(p, slash_with_default->names_with_defaults);
-        if (!posdefaults) {
-            return NULL;
-        }
+        *posdefaults = _get_defaults(p, slash_with_default->names_with_defaults);
     }
     else {
-        posdefaults = _Py_asdl_seq_new(0, p->arena);
-        if (!posdefaults) {
-            return NULL;
-        }
+        *posdefaults = _Py_asdl_expr_seq_new(0, p->arena);
+    }
+    return *posdefaults == NULL ? -1 : 0;
+}
+
+static int
+_make_kwargs(Parser *p, StarEtc *star_etc,
+             asdl_arg_seq **kwonlyargs,
+             asdl_expr_seq **kwdefaults) {
+    if (star_etc != NULL && star_etc->kwonlyargs != NULL) {
+        *kwonlyargs = _get_names(p, star_etc->kwonlyargs);
+    }
+    else {
+        *kwonlyargs = _Py_asdl_arg_seq_new(0, p->arena);
+    }
+
+    if (*kwonlyargs == NULL) {
+        return -1;
+    }
+
+    if (star_etc != NULL && star_etc->kwonlyargs != NULL) {
+        *kwdefaults = _get_defaults(p, star_etc->kwonlyargs);
+    }
+    else {
+        *kwdefaults = _Py_asdl_expr_seq_new(0, p->arena);
+    }
+
+    if (*kwdefaults == NULL) {
+        return -1;
+    }
+
+    return 0;
+}
+
+/* Constructs an arguments_ty object out of all the parsed constructs in the parameters rule */
+arguments_ty
+_PyPegen_make_arguments(Parser *p, asdl_arg_seq *slash_without_default,
+                        SlashWithDefault *slash_with_default, asdl_arg_seq *plain_names,
+                        asdl_seq *names_with_default, StarEtc *star_etc)
+{
+    asdl_arg_seq *posonlyargs;
+    if (_make_posonlyargs(p, slash_without_default, slash_with_default, &posonlyargs) == -1) {
+        return NULL;
+    }
+
+    asdl_arg_seq *posargs;
+    if (_make_posargs(p, plain_names, names_with_default, &posargs) == -1) {
+        return NULL;
+    }
+
+    asdl_expr_seq *posdefaults;
+    if (_make_posdefaults(p,slash_with_default, names_with_default, &posdefaults) == -1) {
+        return NULL;
     }
 
     arg_ty vararg = NULL;
@@ -1831,32 +2181,10 @@
         vararg = star_etc->vararg;
     }
 
-    asdl_seq *kwonlyargs;
-    if (star_etc != NULL && star_etc->kwonlyargs != NULL) {
-        kwonlyargs = _get_names(p, star_etc->kwonlyargs);
-        if (!kwonlyargs) {
-            return NULL;
-        }
-    }
-    else {
-        kwonlyargs = _Py_asdl_seq_new(0, p->arena);
-        if (!kwonlyargs) {
-            return NULL;
-        }
-    }
-
-    asdl_seq *kwdefaults;
-    if (star_etc != NULL && star_etc->kwonlyargs != NULL) {
-        kwdefaults = _get_defaults(p, star_etc->kwonlyargs);
-        if (!kwdefaults) {
-            return NULL;
-        }
-    }
-    else {
-        kwdefaults = _Py_asdl_seq_new(0, p->arena);
-        if (!kwdefaults) {
-            return NULL;
-        }
+    asdl_arg_seq *kwonlyargs;
+    asdl_expr_seq *kwdefaults;
+    if (_make_kwargs(p, star_etc, &kwonlyargs, &kwdefaults) == -1) {
+        return NULL;
     }
 
     arg_ty kwarg = NULL;
@@ -1864,45 +2192,46 @@
         kwarg = star_etc->kwarg;
     }
 
-    return _Py_arguments(posonlyargs, posargs, vararg, kwonlyargs, kwdefaults, kwarg,
-                         posdefaults, p->arena);
+    return _PyAST_arguments(posonlyargs, posargs, vararg, kwonlyargs,
+                            kwdefaults, kwarg, posdefaults, p->arena);
 }
 
+
 /* Constructs an empty arguments_ty object, that gets used when a function accepts no
  * arguments. */
 arguments_ty
 _PyPegen_empty_arguments(Parser *p)
 {
-    asdl_seq *posonlyargs = _Py_asdl_seq_new(0, p->arena);
+    asdl_arg_seq *posonlyargs = _Py_asdl_arg_seq_new(0, p->arena);
     if (!posonlyargs) {
         return NULL;
     }
-    asdl_seq *posargs = _Py_asdl_seq_new(0, p->arena);
+    asdl_arg_seq *posargs = _Py_asdl_arg_seq_new(0, p->arena);
     if (!posargs) {
         return NULL;
     }
-    asdl_seq *posdefaults = _Py_asdl_seq_new(0, p->arena);
+    asdl_expr_seq *posdefaults = _Py_asdl_expr_seq_new(0, p->arena);
     if (!posdefaults) {
         return NULL;
     }
-    asdl_seq *kwonlyargs = _Py_asdl_seq_new(0, p->arena);
+    asdl_arg_seq *kwonlyargs = _Py_asdl_arg_seq_new(0, p->arena);
     if (!kwonlyargs) {
         return NULL;
     }
-    asdl_seq *kwdefaults = _Py_asdl_seq_new(0, p->arena);
+    asdl_expr_seq *kwdefaults = _Py_asdl_expr_seq_new(0, p->arena);
     if (!kwdefaults) {
         return NULL;
     }
 
-    return _Py_arguments(posonlyargs, posargs, NULL, kwonlyargs, kwdefaults, NULL, kwdefaults,
-                         p->arena);
+    return _PyAST_arguments(posonlyargs, posargs, NULL, kwonlyargs,
+                            kwdefaults, NULL, posdefaults, p->arena);
 }
 
 /* Encapsulates the value of an operator_ty into an AugOperator struct */
 AugOperator *
 _PyPegen_augoperator(Parser *p, operator_ty kind)
 {
-    AugOperator *a = PyArena_Malloc(p->arena, sizeof(AugOperator));
+    AugOperator *a = _PyArena_Malloc(p->arena, sizeof(AugOperator));
     if (!a) {
         return NULL;
     }
@@ -1912,11 +2241,11 @@
 
 /* Construct a FunctionDef equivalent to function_def, but with decorators */
 stmt_ty
-_PyPegen_function_def_decorators(Parser *p, asdl_seq *decorators, stmt_ty function_def)
+_PyPegen_function_def_decorators(Parser *p, asdl_expr_seq *decorators, stmt_ty function_def)
 {
     assert(function_def != NULL);
     if (function_def->kind == AsyncFunctionDef_kind) {
-        return _Py_AsyncFunctionDef(
+        return _PyAST_AsyncFunctionDef(
             function_def->v.FunctionDef.name, function_def->v.FunctionDef.args,
             function_def->v.FunctionDef.body, decorators, function_def->v.FunctionDef.returns,
             function_def->v.FunctionDef.type_comment, function_def->lineno,
@@ -1924,30 +2253,32 @@
             p->arena);
     }
 
-    return _Py_FunctionDef(function_def->v.FunctionDef.name, function_def->v.FunctionDef.args,
-                           function_def->v.FunctionDef.body, decorators,
-                           function_def->v.FunctionDef.returns,
-                           function_def->v.FunctionDef.type_comment, function_def->lineno,
-                           function_def->col_offset, function_def->end_lineno,
-                           function_def->end_col_offset, p->arena);
+    return _PyAST_FunctionDef(
+        function_def->v.FunctionDef.name, function_def->v.FunctionDef.args,
+        function_def->v.FunctionDef.body, decorators,
+        function_def->v.FunctionDef.returns,
+        function_def->v.FunctionDef.type_comment, function_def->lineno,
+        function_def->col_offset, function_def->end_lineno,
+        function_def->end_col_offset, p->arena);
 }
 
 /* Construct a ClassDef equivalent to class_def, but with decorators */
 stmt_ty
-_PyPegen_class_def_decorators(Parser *p, asdl_seq *decorators, stmt_ty class_def)
+_PyPegen_class_def_decorators(Parser *p, asdl_expr_seq *decorators, stmt_ty class_def)
 {
     assert(class_def != NULL);
-    return _Py_ClassDef(class_def->v.ClassDef.name, class_def->v.ClassDef.bases,
-                        class_def->v.ClassDef.keywords, class_def->v.ClassDef.body, decorators,
-                        class_def->lineno, class_def->col_offset, class_def->end_lineno,
-                        class_def->end_col_offset, p->arena);
+    return _PyAST_ClassDef(
+        class_def->v.ClassDef.name, class_def->v.ClassDef.bases,
+        class_def->v.ClassDef.keywords, class_def->v.ClassDef.body, decorators,
+        class_def->lineno, class_def->col_offset, class_def->end_lineno,
+        class_def->end_col_offset, p->arena);
 }
 
 /* Construct a KeywordOrStarred */
 KeywordOrStarred *
 _PyPegen_keyword_or_starred(Parser *p, void *element, int is_keyword)
 {
-    KeywordOrStarred *a = PyArena_Malloc(p->arena, sizeof(KeywordOrStarred));
+    KeywordOrStarred *a = _PyArena_Malloc(p->arena, sizeof(KeywordOrStarred));
     if (!a) {
         return NULL;
     }
@@ -1962,7 +2293,7 @@
 {
     int n = 0;
     for (Py_ssize_t i = 0, l = asdl_seq_LEN(seq); i < l; i++) {
-        KeywordOrStarred *k = asdl_seq_GET(seq, i);
+        KeywordOrStarred *k = asdl_seq_GET_UNTYPED(seq, i);
         if (!k->is_keyword) {
             n++;
         }
@@ -1971,21 +2302,21 @@
 }
 
 /* Extract the starred expressions of an asdl_seq* of KeywordOrStarred*s */
-asdl_seq *
+asdl_expr_seq *
 _PyPegen_seq_extract_starred_exprs(Parser *p, asdl_seq *kwargs)
 {
     int new_len = _seq_number_of_starred_exprs(kwargs);
     if (new_len == 0) {
         return NULL;
     }
-    asdl_seq *new_seq = _Py_asdl_seq_new(new_len, p->arena);
+    asdl_expr_seq *new_seq = _Py_asdl_expr_seq_new(new_len, p->arena);
     if (!new_seq) {
         return NULL;
     }
 
     int idx = 0;
     for (Py_ssize_t i = 0, len = asdl_seq_LEN(kwargs); i < len; i++) {
-        KeywordOrStarred *k = asdl_seq_GET(kwargs, i);
+        KeywordOrStarred *k = asdl_seq_GET_UNTYPED(kwargs, i);
         if (!k->is_keyword) {
             asdl_seq_SET(new_seq, idx++, k->element);
         }
@@ -1994,7 +2325,7 @@
 }
 
 /* Return a new asdl_seq* with only the keywords in kwargs */
-asdl_seq *
+asdl_keyword_seq*
 _PyPegen_seq_delete_starred_exprs(Parser *p, asdl_seq *kwargs)
 {
     Py_ssize_t len = asdl_seq_LEN(kwargs);
@@ -2002,14 +2333,14 @@
     if (new_len == 0) {
         return NULL;
     }
-    asdl_seq *new_seq = _Py_asdl_seq_new(new_len, p->arena);
+    asdl_keyword_seq *new_seq = _Py_asdl_keyword_seq_new(new_len, p->arena);
     if (!new_seq) {
         return NULL;
     }
 
     int idx = 0;
     for (Py_ssize_t i = 0; i < len; i++) {
-        KeywordOrStarred *k = asdl_seq_GET(kwargs, i);
+        KeywordOrStarred *k = asdl_seq_GET_UNTYPED(kwargs, i);
         if (k->is_keyword) {
             asdl_seq_SET(new_seq, idx++, k->element);
         }
@@ -2023,8 +2354,8 @@
     Py_ssize_t len = asdl_seq_LEN(strings);
     assert(len > 0);
 
-    Token *first = asdl_seq_GET(strings, 0);
-    Token *last = asdl_seq_GET(strings, len - 1);
+    Token *first = asdl_seq_GET_UNTYPED(strings, 0);
+    Token *last = asdl_seq_GET_UNTYPED(strings, len - 1);
 
     int bytesmode = 0;
     PyObject *bytes_str = NULL;
@@ -2033,7 +2364,7 @@
     _PyPegen_FstringParser_Init(&state);
 
     for (Py_ssize_t i = 0; i < len; i++) {
-        Token *t = asdl_seq_GET(strings, i);
+        Token *t = asdl_seq_GET_UNTYPED(strings, i);
 
         int this_bytesmode;
         int this_rawmode;
@@ -2088,11 +2419,12 @@
     }
 
     if (bytesmode) {
-        if (PyArena_AddPyObject(p->arena, bytes_str) < 0) {
+        if (_PyArena_AddPyObject(p->arena, bytes_str) < 0) {
             goto error;
         }
-        return Constant(bytes_str, NULL, first->lineno, first->col_offset, last->end_lineno,
-                        last->end_col_offset, p->arena);
+        return _PyAST_Constant(bytes_str, NULL, first->lineno,
+                               first->col_offset, last->end_lineno,
+                               last->end_col_offset, p->arena);
     }
 
     return _PyPegen_FstringParser_Finish(p, &state, first, last);
@@ -2106,13 +2438,33 @@
     return NULL;
 }
 
+expr_ty
+_PyPegen_ensure_imaginary(Parser *p, expr_ty exp)
+{
+    if (exp->kind != Constant_kind || !PyComplex_CheckExact(exp->v.Constant.value)) {
+        RAISE_SYNTAX_ERROR_KNOWN_LOCATION(exp, "imaginary number required in complex literal");
+        return NULL;
+    }
+    return exp;
+}
+
+expr_ty
+_PyPegen_ensure_real(Parser *p, expr_ty exp)
+{
+    if (exp->kind != Constant_kind || PyComplex_CheckExact(exp->v.Constant.value)) {
+        RAISE_SYNTAX_ERROR_KNOWN_LOCATION(exp, "real number required in complex literal");
+        return NULL;
+    }
+    return exp;
+}
+
 mod_ty
-_PyPegen_make_module(Parser *p, asdl_seq *a) {
-    asdl_seq *type_ignores = NULL;
+_PyPegen_make_module(Parser *p, asdl_stmt_seq *a) {
+    asdl_type_ignore_seq *type_ignores = NULL;
     Py_ssize_t num = p->type_ignore_comments.num_items;
     if (num > 0) {
         // Turn the raw (comment, lineno) pairs into TypeIgnore objects in the arena
-        type_ignores = _Py_asdl_seq_new(num, p->arena);
+        type_ignores = _Py_asdl_type_ignore_seq_new(num, p->arena);
         if (type_ignores == NULL) {
             return NULL;
         }
@@ -2121,14 +2473,15 @@
             if (tag == NULL) {
                 return NULL;
             }
-            type_ignore_ty ti = TypeIgnore(p->type_ignore_comments.items[i].lineno, tag, p->arena);
+            type_ignore_ty ti = _PyAST_TypeIgnore(p->type_ignore_comments.items[i].lineno,
+                                                  tag, p->arena);
             if (ti == NULL) {
                 return NULL;
             }
             asdl_seq_SET(type_ignores, i, ti);
         }
     }
-    return Module(a, type_ignores, p->arena);
+    return _PyAST_Module(a, type_ignores, p->arena);
 }
 
 // Error reporting helpers
@@ -2141,9 +2494,9 @@
     }
 
 #define VISIT_CONTAINER(CONTAINER, TYPE) do { \
-        Py_ssize_t len = asdl_seq_LEN(CONTAINER->v.TYPE.elts);\
+        Py_ssize_t len = asdl_seq_LEN((CONTAINER)->v.TYPE.elts);\
         for (Py_ssize_t i = 0; i < len; i++) {\
-            expr_ty other = asdl_seq_GET(CONTAINER->v.TYPE.elts, i);\
+            expr_ty other = asdl_seq_GET((CONTAINER)->v.TYPE.elts, i);\
             expr_ty child = _PyPegen_get_invalid_target(other, targets_type);\
             if (child != NULL) {\
                 return child;\
@@ -2209,8 +2562,17 @@
     return RAISE_SYNTAX_ERROR(msg);
 }
 
+
+static inline expr_ty
+_PyPegen_get_last_comprehension_item(comprehension_ty comprehension) {
+    if (comprehension->ifs == NULL || asdl_seq_LEN(comprehension->ifs) == 0) {
+        return comprehension->iter;
+    }
+    return PyPegen_last_item(comprehension->ifs, expr_ty);
+}
+
 void *
-_PyPegen_nonparen_genexp_in_call(Parser *p, expr_ty args)
+_PyPegen_nonparen_genexp_in_call(Parser *p, expr_ty args, asdl_comprehension_seq *comprehensions)
 {
     /* The rule that calls this function is 'args for_if_clauses'.
        For the input f(L, x for x in y), L and x are in args and
@@ -2224,33 +2586,36 @@
         return NULL;
     }
 
-    return RAISE_SYNTAX_ERROR_KNOWN_LOCATION(
+    comprehension_ty last_comprehension = PyPegen_last_item(comprehensions, comprehension_ty);
+
+    return RAISE_SYNTAX_ERROR_KNOWN_RANGE(
         (expr_ty) asdl_seq_GET(args->v.Call.args, len - 1),
+        _PyPegen_get_last_comprehension_item(last_comprehension),
         "Generator expression must be parenthesized"
     );
 }
 
 
-expr_ty _PyPegen_collect_call_seqs(Parser *p, asdl_seq *a, asdl_seq *b,
+expr_ty _PyPegen_collect_call_seqs(Parser *p, asdl_expr_seq *a, asdl_seq *b,
                      int lineno, int col_offset, int end_lineno,
                      int end_col_offset, PyArena *arena) {
     Py_ssize_t args_len = asdl_seq_LEN(a);
     Py_ssize_t total_len = args_len;
 
     if (b == NULL) {
-        return _Py_Call(_PyPegen_dummy_name(p), a, NULL, lineno, col_offset,
+        return _PyAST_Call(_PyPegen_dummy_name(p), a, NULL, lineno, col_offset,
                         end_lineno, end_col_offset, arena);
 
     }
 
-    asdl_seq *starreds = _PyPegen_seq_extract_starred_exprs(p, b);
-    asdl_seq *keywords = _PyPegen_seq_delete_starred_exprs(p, b);
+    asdl_expr_seq *starreds = _PyPegen_seq_extract_starred_exprs(p, b);
+    asdl_keyword_seq *keywords = _PyPegen_seq_delete_starred_exprs(p, b);
 
     if (starreds) {
         total_len += asdl_seq_LEN(starreds);
     }
 
-    asdl_seq *args = _Py_asdl_seq_new(total_len, arena);
+    asdl_expr_seq *args = _Py_asdl_expr_seq_new(total_len, arena);
 
     Py_ssize_t i = 0;
     for (i = 0; i < args_len; i++) {
@@ -2260,8 +2625,6 @@
         asdl_seq_SET(args, i, asdl_seq_GET(starreds, i - args_len));
     }
 
-    return _Py_Call(_PyPegen_dummy_name(p), args, keywords, lineno,
-                    col_offset, end_lineno, end_col_offset, arena);
-
-
+    return _PyAST_Call(_PyPegen_dummy_name(p), args, keywords, lineno,
+                       col_offset, end_lineno, end_col_offset, arena);
 }
diff --git a/Parser/pegen/pegen.h b/Parser/pegen.h
similarity index 66%
rename from Parser/pegen/pegen.h
rename to Parser/pegen.h
index a2f524a..0e5a057 100644
--- a/Parser/pegen/pegen.h
+++ b/Parser/pegen.h
@@ -4,8 +4,7 @@
 #define PY_SSIZE_T_CLEAN
 #include <Python.h>
 #include <token.h>
-#include <Python-ast.h>
-#include <pyarena.h>
+#include <pycore_ast.h>
 
 #if 0
 #define PyPARSE_YIELD_IS_KEYWORD        0x0001
@@ -23,6 +22,7 @@
 #define PyPARSE_BARRY_AS_BDFL 0x0020
 #define PyPARSE_TYPE_COMMENTS 0x0040
 #define PyPARSE_ASYNC_HACKS   0x0080
+#define PyPARSE_ALLOW_INCOMPLETE_INPUT 0x0100
 
 typedef struct _memo {
     int type;
@@ -34,6 +34,7 @@
 typedef struct {
     int type;
     PyObject *bytes;
+    int level;
     int lineno, col_offset, end_lineno, end_col_offset;
     Memo *memo;
 } Token;
@@ -60,6 +61,7 @@
     int fill, size;
     PyArena *arena;
     KeywordToken **keywords;
+    char **soft_keywords;
     int n_keyword_lists;
     int start_rule;
     int *errcode;
@@ -87,12 +89,17 @@
 } KeyValuePair;
 
 typedef struct {
+    expr_ty key;
+    pattern_ty pattern;
+} KeyPatternPair;
+
+typedef struct {
     arg_ty arg;
     expr_ty value;
 } NameDefaultPair;
 
 typedef struct {
-    asdl_seq *plain_names;
+    asdl_arg_seq *plain_names;
     asdl_seq *names_with_defaults; // asdl_seq* of NameDefaultsPair's
 } SlashWithDefault;
 
@@ -102,29 +109,31 @@
     arg_ty kwarg;
 } StarEtc;
 
-typedef struct {
-    operator_ty kind;
-} AugOperator;
-
+typedef struct { operator_ty kind; } AugOperator;
 typedef struct {
     void *element;
     int is_keyword;
 } KeywordOrStarred;
 
+#if defined(Py_DEBUG)
 void _PyPegen_clear_memo_statistics(void);
 PyObject *_PyPegen_get_memo_statistics(void);
+#endif
 
 int _PyPegen_insert_memo(Parser *p, int mark, int type, void *node);
 int _PyPegen_update_memo(Parser *p, int mark, int type, void *node);
 int _PyPegen_is_memoized(Parser *p, int type, void *pres);
 
+
 int _PyPegen_lookahead_with_name(int, expr_ty (func)(Parser *), Parser *);
-int _PyPegen_lookahead_with_string(int , expr_ty (func)(Parser *, const char*), Parser *, const char*);
 int _PyPegen_lookahead_with_int(int, Token *(func)(Parser *, int), Parser *, int);
+int _PyPegen_lookahead_with_string(int , expr_ty (func)(Parser *, const char*), Parser *, const char*);
 int _PyPegen_lookahead(int, void *(func)(Parser *), Parser *);
 
 Token *_PyPegen_expect_token(Parser *p, int type);
+Token *_PyPegen_expect_forced_token(Parser *p, int type, const char* expected);
 expr_ty _PyPegen_expect_soft_keyword(Parser *p, const char *keyword);
+expr_ty _PyPegen_soft_keyword_token(Parser *p);
 Token *_PyPegen_get_last_nonnwhitespace_token(Parser *);
 int _PyPegen_fill_token(Parser *p);
 expr_ty _PyPegen_name_token(Parser *p);
@@ -134,29 +143,44 @@
 void *_PyPegen_raise_error(Parser *p, PyObject *errtype, const char *errmsg, ...);
 void *_PyPegen_raise_error_known_location(Parser *p, PyObject *errtype,
                                           Py_ssize_t lineno, Py_ssize_t col_offset,
+                                          Py_ssize_t end_lineno, Py_ssize_t end_col_offset,
                                           const char *errmsg, va_list va);
 void *_PyPegen_dummy_name(Parser *p, ...);
 
+void * _PyPegen_seq_last_item(asdl_seq *seq);
+#define PyPegen_last_item(seq, type) ((type)_PyPegen_seq_last_item((asdl_seq*)seq))
+
+void * _PyPegen_seq_first_item(asdl_seq *seq);
+#define PyPegen_first_item(seq, type) ((type)_PyPegen_seq_first_item((asdl_seq*)seq))
+
+#define CURRENT_POS (-5)
+
 Py_LOCAL_INLINE(void *)
-RAISE_ERROR_KNOWN_LOCATION(Parser *p, PyObject *errtype, int lineno,
-                           int col_offset, const char *errmsg, ...)
+RAISE_ERROR_KNOWN_LOCATION(Parser *p, PyObject *errtype,
+                           Py_ssize_t lineno, Py_ssize_t col_offset,
+                           Py_ssize_t end_lineno, Py_ssize_t end_col_offset,
+                           const char *errmsg, ...)
 {
     va_list va;
     va_start(va, errmsg);
-    _PyPegen_raise_error_known_location(p, errtype, lineno, col_offset + 1,
-                                        errmsg, va);
+    Py_ssize_t _col_offset = (col_offset == CURRENT_POS ? CURRENT_POS : col_offset + 1);
+    Py_ssize_t _end_col_offset = (end_col_offset == CURRENT_POS ? CURRENT_POS : end_col_offset + 1);
+    _PyPegen_raise_error_known_location(p, errtype, lineno, _col_offset, end_lineno, _end_col_offset, errmsg, va);
     va_end(va);
     return NULL;
 }
 
-
 #define UNUSED(expr) do { (void)(expr); } while (0)
-#define EXTRA_EXPR(head, tail) head->lineno, head->col_offset, tail->end_lineno, tail->end_col_offset, p->arena
+#define EXTRA_EXPR(head, tail) head->lineno, (head)->col_offset, (tail)->end_lineno, (tail)->end_col_offset, p->arena
 #define EXTRA _start_lineno, _start_col_offset, _end_lineno, _end_col_offset, p->arena
 #define RAISE_SYNTAX_ERROR(msg, ...) _PyPegen_raise_error(p, PyExc_SyntaxError, msg, ##__VA_ARGS__)
 #define RAISE_INDENTATION_ERROR(msg, ...) _PyPegen_raise_error(p, PyExc_IndentationError, msg, ##__VA_ARGS__)
+#define RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, msg, ...) \
+    RAISE_ERROR_KNOWN_LOCATION(p, PyExc_SyntaxError, (a)->lineno, (a)->col_offset, (b)->end_lineno, (b)->end_col_offset, msg, ##__VA_ARGS__)
 #define RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, msg, ...) \
-    RAISE_ERROR_KNOWN_LOCATION(p, PyExc_SyntaxError, (a)->lineno, (a)->col_offset, msg, ##__VA_ARGS__)
+    RAISE_ERROR_KNOWN_LOCATION(p, PyExc_SyntaxError, (a)->lineno, (a)->col_offset, (a)->end_lineno, (a)->end_col_offset, msg, ##__VA_ARGS__)
+#define RAISE_SYNTAX_ERROR_STARTING_FROM(a, msg, ...) \
+    RAISE_ERROR_KNOWN_LOCATION(p, PyExc_SyntaxError, (a)->lineno, (a)->col_offset, CURRENT_POS, CURRENT_POS, msg, ##__VA_ARGS__)
 
 Py_LOCAL_INLINE(void *)
 CHECK_CALL(Parser *p, void *result)
@@ -179,10 +203,10 @@
     return result;
 }
 
-#define CHECK(result) CHECK_CALL(p, result)
-#define CHECK_NULL_ALLOWED(result) CHECK_CALL_NULL_ALLOWED(p, result)
+#define CHECK(type, result) ((type) CHECK_CALL(p, result))
+#define CHECK_NULL_ALLOWED(type, result) ((type) CHECK_CALL_NULL_ALLOWED(p, result))
 
-PyObject *_PyPegen_new_type_comment(Parser *, char *);
+PyObject *_PyPegen_new_type_comment(Parser *, const char *);
 
 Py_LOCAL_INLINE(PyObject *)
 NEW_TYPE_COMMENT(Parser *p, Token *tc)
@@ -190,7 +214,7 @@
     if (tc == NULL) {
         return NULL;
     }
-    char *bytes = PyBytes_AsString(tc->bytes);
+    const char *bytes = PyBytes_AsString(tc->bytes);
     if (bytes == NULL) {
         goto error;
     }
@@ -219,52 +243,57 @@
     return node;
 }
 
-#define CHECK_VERSION(version, msg, node) INVALID_VERSION_CHECK(p, version, msg, node)
+#define CHECK_VERSION(type, version, msg, node) ((type) INVALID_VERSION_CHECK(p, version, msg, node))
 
 arg_ty _PyPegen_add_type_comment_to_arg(Parser *, arg_ty, Token *);
-PyObject *_PyPegen_new_identifier(Parser *, char *);
+PyObject *_PyPegen_new_identifier(Parser *, const char *);
 Parser *_PyPegen_Parser_New(struct tok_state *, int, int, int, int *, PyArena *);
 void _PyPegen_Parser_Free(Parser *);
 mod_ty _PyPegen_run_parser_from_file_pointer(FILE *, int, PyObject *, const char *,
                                     const char *, const char *, PyCompilerFlags *, int *, PyArena *);
 void *_PyPegen_run_parser(Parser *);
-mod_ty _PyPegen_run_parser_from_file(const char *, int, PyObject *, PyCompilerFlags *, PyArena *);
 mod_ty _PyPegen_run_parser_from_string(const char *, int, PyObject *, PyCompilerFlags *, PyArena *);
-void *_PyPegen_interactive_exit(Parser *);
+asdl_stmt_seq *_PyPegen_interactive_exit(Parser *);
 asdl_seq *_PyPegen_singleton_seq(Parser *, void *);
 asdl_seq *_PyPegen_seq_insert_in_front(Parser *, void *, asdl_seq *);
 asdl_seq *_PyPegen_seq_append_to_end(Parser *, asdl_seq *, void *);
 asdl_seq *_PyPegen_seq_flatten(Parser *, asdl_seq *);
 expr_ty _PyPegen_join_names_with_dot(Parser *, expr_ty, expr_ty);
 int _PyPegen_seq_count_dots(asdl_seq *);
-alias_ty _PyPegen_alias_for_star(Parser *);
-asdl_seq *_PyPegen_map_names_to_ids(Parser *, asdl_seq *);
+alias_ty _PyPegen_alias_for_star(Parser *, int, int, int, int, PyArena *);
+asdl_identifier_seq *_PyPegen_map_names_to_ids(Parser *, asdl_expr_seq *);
 CmpopExprPair *_PyPegen_cmpop_expr_pair(Parser *, cmpop_ty, expr_ty);
 asdl_int_seq *_PyPegen_get_cmpops(Parser *p, asdl_seq *);
-asdl_seq *_PyPegen_get_exprs(Parser *, asdl_seq *);
+asdl_expr_seq *_PyPegen_get_exprs(Parser *, asdl_seq *);
 expr_ty _PyPegen_set_expr_context(Parser *, expr_ty, expr_context_ty);
 KeyValuePair *_PyPegen_key_value_pair(Parser *, expr_ty, expr_ty);
-asdl_seq *_PyPegen_get_keys(Parser *, asdl_seq *);
-asdl_seq *_PyPegen_get_values(Parser *, asdl_seq *);
+asdl_expr_seq *_PyPegen_get_keys(Parser *, asdl_seq *);
+asdl_expr_seq *_PyPegen_get_values(Parser *, asdl_seq *);
+KeyPatternPair *_PyPegen_key_pattern_pair(Parser *, expr_ty, pattern_ty);
+asdl_expr_seq *_PyPegen_get_pattern_keys(Parser *, asdl_seq *);
+asdl_pattern_seq *_PyPegen_get_patterns(Parser *, asdl_seq *);
 NameDefaultPair *_PyPegen_name_default_pair(Parser *, arg_ty, expr_ty, Token *);
-SlashWithDefault *_PyPegen_slash_with_default(Parser *, asdl_seq *, asdl_seq *);
+SlashWithDefault *_PyPegen_slash_with_default(Parser *, asdl_arg_seq *, asdl_seq *);
 StarEtc *_PyPegen_star_etc(Parser *, arg_ty, asdl_seq *, arg_ty);
-arguments_ty _PyPegen_make_arguments(Parser *, asdl_seq *, SlashWithDefault *,
-                            asdl_seq *, asdl_seq *, StarEtc *);
+arguments_ty _PyPegen_make_arguments(Parser *, asdl_arg_seq *, SlashWithDefault *,
+                                     asdl_arg_seq *, asdl_seq *, StarEtc *);
 arguments_ty _PyPegen_empty_arguments(Parser *);
 AugOperator *_PyPegen_augoperator(Parser*, operator_ty type);
-stmt_ty _PyPegen_function_def_decorators(Parser *, asdl_seq *, stmt_ty);
-stmt_ty _PyPegen_class_def_decorators(Parser *, asdl_seq *, stmt_ty);
+stmt_ty _PyPegen_function_def_decorators(Parser *, asdl_expr_seq *, stmt_ty);
+stmt_ty _PyPegen_class_def_decorators(Parser *, asdl_expr_seq *, stmt_ty);
 KeywordOrStarred *_PyPegen_keyword_or_starred(Parser *, void *, int);
-asdl_seq *_PyPegen_seq_extract_starred_exprs(Parser *, asdl_seq *);
-asdl_seq *_PyPegen_seq_delete_starred_exprs(Parser *, asdl_seq *);
-expr_ty _PyPegen_collect_call_seqs(Parser *, asdl_seq *, asdl_seq *,
+asdl_expr_seq *_PyPegen_seq_extract_starred_exprs(Parser *, asdl_seq *);
+asdl_keyword_seq *_PyPegen_seq_delete_starred_exprs(Parser *, asdl_seq *);
+expr_ty _PyPegen_collect_call_seqs(Parser *, asdl_expr_seq *, asdl_seq *,
                      int lineno, int col_offset, int end_lineno,
                      int end_col_offset, PyArena *arena);
 expr_ty _PyPegen_concatenate_strings(Parser *p, asdl_seq *);
+expr_ty _PyPegen_ensure_imaginary(Parser *p, expr_ty);
+expr_ty _PyPegen_ensure_real(Parser *p, expr_ty);
 asdl_seq *_PyPegen_join_sequences(Parser *, asdl_seq *, asdl_seq *);
 int _PyPegen_check_barry_as_flufl(Parser *, Token *);
-mod_ty _PyPegen_make_module(Parser *, asdl_seq *);
+int _PyPegen_check_legacy_stmt(Parser *p, expr_ty t);
+mod_ty _PyPegen_make_module(Parser *, asdl_stmt_seq *);
 
 // Error reporting helpers
 typedef enum {
@@ -278,7 +307,7 @@
 Py_LOCAL_INLINE(void *)
 _RAISE_SYNTAX_ERROR_INVALID_TARGET(Parser *p, TARGETS_TYPE type, void *e)
 {
-    expr_ty invalid_target = CHECK_NULL_ALLOWED(_PyPegen_get_invalid_target(e, type));
+    expr_ty invalid_target = CHECK_NULL_ALLOWED(expr_ty, _PyPegen_get_invalid_target(e, type));
     if (invalid_target != NULL) {
         const char *msg;
         if (type == STAR_TARGETS || type == FOR_TARGETS) {
@@ -292,12 +321,13 @@
             msg,
             _PyPegen_get_expr_name(invalid_target)
         );
+        return RAISE_SYNTAX_ERROR_KNOWN_LOCATION(invalid_target, "invalid syntax");
     }
-    return RAISE_SYNTAX_ERROR("invalid syntax");
+    return NULL;
 }
 
 void *_PyPegen_arguments_parsing_error(Parser *, expr_ty);
-void *_PyPegen_nonparen_genexp_in_call(Parser *p, expr_ty args);
+void *_PyPegen_nonparen_genexp_in_call(Parser *p, expr_ty args, asdl_comprehension_seq *comprehensions);
 
 
 // Generated function in parse.c - function definition in python.gram
diff --git a/Parser/pegen/parse.c b/Parser/pegen/parse.c
deleted file mode 100644
index 0eb61db..0000000
--- a/Parser/pegen/parse.c
+++ /dev/null
@@ -1,24774 +0,0 @@
-// @generated by pegen.py from ./Grammar/python.gram
-#include "pegen.h"
-
-#if defined(Py_DEBUG) && defined(Py_BUILD_CORE)
-extern int Py_DebugFlag;
-#define D(x) if (Py_DebugFlag) x;
-#else
-#define D(x)
-#endif
-static const int n_keyword_lists = 15;
-static KeywordToken *reserved_keywords[] = {
-    (KeywordToken[]) {{NULL, -1}},
-    (KeywordToken[]) {{NULL, -1}},
-    (KeywordToken[]) {
-        {"if", 510},
-        {"in", 518},
-        {"as", 520},
-        {"is", 527},
-        {"or", 532},
-        {NULL, -1},
-    },
-    (KeywordToken[]) {
-        {"del", 503},
-        {"try", 511},
-        {"for", 517},
-        {"def", 523},
-        {"not", 526},
-        {"and", 533},
-        {NULL, -1},
-    },
-    (KeywordToken[]) {
-        {"pass", 502},
-        {"from", 514},
-        {"elif", 515},
-        {"else", 516},
-        {"with", 519},
-        {"True", 528},
-        {"None", 530},
-        {NULL, -1},
-    },
-    (KeywordToken[]) {
-        {"raise", 501},
-        {"yield", 504},
-        {"break", 506},
-        {"while", 512},
-        {"class", 524},
-        {"False", 529},
-        {NULL, -1},
-    },
-    (KeywordToken[]) {
-        {"return", 500},
-        {"assert", 505},
-        {"global", 508},
-        {"import", 513},
-        {"except", 521},
-        {"lambda", 525},
-        {NULL, -1},
-    },
-    (KeywordToken[]) {
-        {"finally", 522},
-        {NULL, -1},
-    },
-    (KeywordToken[]) {
-        {"continue", 507},
-        {"nonlocal", 509},
-        {NULL, -1},
-    },
-    (KeywordToken[]) {{NULL, -1}},
-    (KeywordToken[]) {{NULL, -1}},
-    (KeywordToken[]) {{NULL, -1}},
-    (KeywordToken[]) {{NULL, -1}},
-    (KeywordToken[]) {{NULL, -1}},
-    (KeywordToken[]) {
-        {"__peg_parser__", 531},
-        {NULL, -1},
-    },
-};
-#define file_type 1000
-#define interactive_type 1001
-#define eval_type 1002
-#define func_type_type 1003
-#define fstring_type 1004
-#define type_expressions_type 1005
-#define statements_type 1006
-#define statement_type 1007
-#define statement_newline_type 1008
-#define simple_stmt_type 1009
-#define small_stmt_type 1010
-#define compound_stmt_type 1011
-#define assignment_type 1012
-#define augassign_type 1013
-#define global_stmt_type 1014
-#define nonlocal_stmt_type 1015
-#define yield_stmt_type 1016
-#define assert_stmt_type 1017
-#define del_stmt_type 1018
-#define import_stmt_type 1019
-#define import_name_type 1020
-#define import_from_type 1021
-#define import_from_targets_type 1022
-#define import_from_as_names_type 1023
-#define import_from_as_name_type 1024
-#define dotted_as_names_type 1025
-#define dotted_as_name_type 1026
-#define dotted_name_type 1027  // Left-recursive
-#define if_stmt_type 1028
-#define elif_stmt_type 1029
-#define else_block_type 1030
-#define while_stmt_type 1031
-#define for_stmt_type 1032
-#define with_stmt_type 1033
-#define with_item_type 1034
-#define try_stmt_type 1035
-#define except_block_type 1036
-#define finally_block_type 1037
-#define return_stmt_type 1038
-#define raise_stmt_type 1039
-#define function_def_type 1040
-#define function_def_raw_type 1041
-#define func_type_comment_type 1042
-#define params_type 1043
-#define parameters_type 1044
-#define slash_no_default_type 1045
-#define slash_with_default_type 1046
-#define star_etc_type 1047
-#define kwds_type 1048
-#define param_no_default_type 1049
-#define param_with_default_type 1050
-#define param_maybe_default_type 1051
-#define param_type 1052
-#define annotation_type 1053
-#define default_type 1054
-#define decorators_type 1055
-#define class_def_type 1056
-#define class_def_raw_type 1057
-#define block_type 1058
-#define star_expressions_type 1059
-#define star_expression_type 1060
-#define star_named_expressions_type 1061
-#define star_named_expression_type 1062
-#define named_expression_type 1063
-#define annotated_rhs_type 1064
-#define expressions_type 1065
-#define expression_type 1066
-#define lambdef_type 1067
-#define lambda_params_type 1068
-#define lambda_parameters_type 1069
-#define lambda_slash_no_default_type 1070
-#define lambda_slash_with_default_type 1071
-#define lambda_star_etc_type 1072
-#define lambda_kwds_type 1073
-#define lambda_param_no_default_type 1074
-#define lambda_param_with_default_type 1075
-#define lambda_param_maybe_default_type 1076
-#define lambda_param_type 1077
-#define disjunction_type 1078
-#define conjunction_type 1079
-#define inversion_type 1080
-#define comparison_type 1081
-#define compare_op_bitwise_or_pair_type 1082
-#define eq_bitwise_or_type 1083
-#define noteq_bitwise_or_type 1084
-#define lte_bitwise_or_type 1085
-#define lt_bitwise_or_type 1086
-#define gte_bitwise_or_type 1087
-#define gt_bitwise_or_type 1088
-#define notin_bitwise_or_type 1089
-#define in_bitwise_or_type 1090
-#define isnot_bitwise_or_type 1091
-#define is_bitwise_or_type 1092
-#define bitwise_or_type 1093  // Left-recursive
-#define bitwise_xor_type 1094  // Left-recursive
-#define bitwise_and_type 1095  // Left-recursive
-#define shift_expr_type 1096  // Left-recursive
-#define sum_type 1097  // Left-recursive
-#define term_type 1098  // Left-recursive
-#define factor_type 1099
-#define power_type 1100
-#define await_primary_type 1101
-#define primary_type 1102  // Left-recursive
-#define slices_type 1103
-#define slice_type 1104
-#define atom_type 1105
-#define strings_type 1106
-#define list_type 1107
-#define listcomp_type 1108
-#define tuple_type 1109
-#define group_type 1110
-#define genexp_type 1111
-#define set_type 1112
-#define setcomp_type 1113
-#define dict_type 1114
-#define dictcomp_type 1115
-#define double_starred_kvpairs_type 1116
-#define double_starred_kvpair_type 1117
-#define kvpair_type 1118
-#define for_if_clauses_type 1119
-#define for_if_clause_type 1120
-#define yield_expr_type 1121
-#define arguments_type 1122
-#define args_type 1123
-#define kwargs_type 1124
-#define starred_expression_type 1125
-#define kwarg_or_starred_type 1126
-#define kwarg_or_double_starred_type 1127
-#define star_targets_type 1128
-#define star_targets_seq_type 1129
-#define star_target_type 1130
-#define star_atom_type 1131
-#define single_target_type 1132
-#define single_subscript_attribute_target_type 1133
-#define del_targets_type 1134
-#define del_target_type 1135
-#define del_t_atom_type 1136
-#define targets_type 1137
-#define target_type 1138
-#define t_primary_type 1139  // Left-recursive
-#define t_lookahead_type 1140
-#define t_atom_type 1141
-#define invalid_arguments_type 1142
-#define invalid_kwarg_type 1143
-#define invalid_named_expression_type 1144
-#define invalid_assignment_type 1145
-#define invalid_ann_assign_target_type 1146
-#define invalid_del_stmt_type 1147
-#define invalid_block_type 1148
-#define invalid_primary_type 1149  // Left-recursive
-#define invalid_comprehension_type 1150
-#define invalid_dict_comprehension_type 1151
-#define invalid_parameters_type 1152
-#define invalid_lambda_parameters_type 1153
-#define invalid_star_etc_type 1154
-#define invalid_lambda_star_etc_type 1155
-#define invalid_double_type_comments_type 1156
-#define invalid_with_item_type 1157
-#define invalid_for_target_type 1158
-#define invalid_group_type 1159
-#define invalid_import_from_targets_type 1160
-#define _loop0_1_type 1161
-#define _loop0_2_type 1162
-#define _loop0_4_type 1163
-#define _gather_3_type 1164
-#define _loop0_6_type 1165
-#define _gather_5_type 1166
-#define _loop0_8_type 1167
-#define _gather_7_type 1168
-#define _loop0_10_type 1169
-#define _gather_9_type 1170
-#define _loop1_11_type 1171
-#define _loop0_13_type 1172
-#define _gather_12_type 1173
-#define _tmp_14_type 1174
-#define _tmp_15_type 1175
-#define _tmp_16_type 1176
-#define _tmp_17_type 1177
-#define _tmp_18_type 1178
-#define _tmp_19_type 1179
-#define _tmp_20_type 1180
-#define _tmp_21_type 1181
-#define _loop1_22_type 1182
-#define _tmp_23_type 1183
-#define _tmp_24_type 1184
-#define _loop0_26_type 1185
-#define _gather_25_type 1186
-#define _loop0_28_type 1187
-#define _gather_27_type 1188
-#define _tmp_29_type 1189
-#define _tmp_30_type 1190
-#define _loop0_31_type 1191
-#define _loop1_32_type 1192
-#define _loop0_34_type 1193
-#define _gather_33_type 1194
-#define _tmp_35_type 1195
-#define _loop0_37_type 1196
-#define _gather_36_type 1197
-#define _tmp_38_type 1198
-#define _loop0_40_type 1199
-#define _gather_39_type 1200
-#define _loop0_42_type 1201
-#define _gather_41_type 1202
-#define _loop0_44_type 1203
-#define _gather_43_type 1204
-#define _loop0_46_type 1205
-#define _gather_45_type 1206
-#define _tmp_47_type 1207
-#define _loop1_48_type 1208
-#define _tmp_49_type 1209
-#define _tmp_50_type 1210
-#define _tmp_51_type 1211
-#define _tmp_52_type 1212
-#define _tmp_53_type 1213
-#define _loop0_54_type 1214
-#define _loop0_55_type 1215
-#define _loop0_56_type 1216
-#define _loop1_57_type 1217
-#define _loop0_58_type 1218
-#define _loop1_59_type 1219
-#define _loop1_60_type 1220
-#define _loop1_61_type 1221
-#define _loop0_62_type 1222
-#define _loop1_63_type 1223
-#define _loop0_64_type 1224
-#define _loop1_65_type 1225
-#define _loop0_66_type 1226
-#define _loop1_67_type 1227
-#define _loop1_68_type 1228
-#define _tmp_69_type 1229
-#define _loop1_70_type 1230
-#define _loop0_72_type 1231
-#define _gather_71_type 1232
-#define _loop1_73_type 1233
-#define _loop0_74_type 1234
-#define _loop0_75_type 1235
-#define _loop0_76_type 1236
-#define _loop1_77_type 1237
-#define _loop0_78_type 1238
-#define _loop1_79_type 1239
-#define _loop1_80_type 1240
-#define _loop1_81_type 1241
-#define _loop0_82_type 1242
-#define _loop1_83_type 1243
-#define _loop0_84_type 1244
-#define _loop1_85_type 1245
-#define _loop0_86_type 1246
-#define _loop1_87_type 1247
-#define _loop1_88_type 1248
-#define _loop1_89_type 1249
-#define _loop1_90_type 1250
-#define _tmp_91_type 1251
-#define _loop0_93_type 1252
-#define _gather_92_type 1253
-#define _tmp_94_type 1254
-#define _tmp_95_type 1255
-#define _tmp_96_type 1256
-#define _tmp_97_type 1257
-#define _loop1_98_type 1258
-#define _tmp_99_type 1259
-#define _tmp_100_type 1260
-#define _loop0_102_type 1261
-#define _gather_101_type 1262
-#define _loop1_103_type 1263
-#define _loop0_104_type 1264
-#define _loop0_105_type 1265
-#define _loop0_107_type 1266
-#define _gather_106_type 1267
-#define _tmp_108_type 1268
-#define _loop0_110_type 1269
-#define _gather_109_type 1270
-#define _loop0_112_type 1271
-#define _gather_111_type 1272
-#define _loop0_114_type 1273
-#define _gather_113_type 1274
-#define _loop0_116_type 1275
-#define _gather_115_type 1276
-#define _loop0_117_type 1277
-#define _loop0_119_type 1278
-#define _gather_118_type 1279
-#define _tmp_120_type 1280
-#define _loop0_122_type 1281
-#define _gather_121_type 1282
-#define _loop0_124_type 1283
-#define _gather_123_type 1284
-#define _tmp_125_type 1285
-#define _loop0_126_type 1286
-#define _loop0_127_type 1287
-#define _loop0_128_type 1288
-#define _tmp_129_type 1289
-#define _tmp_130_type 1290
-#define _loop0_131_type 1291
-#define _tmp_132_type 1292
-#define _loop0_133_type 1293
-#define _tmp_134_type 1294
-#define _tmp_135_type 1295
-#define _tmp_136_type 1296
-#define _tmp_137_type 1297
-#define _tmp_138_type 1298
-#define _tmp_139_type 1299
-#define _tmp_140_type 1300
-#define _tmp_141_type 1301
-#define _tmp_142_type 1302
-#define _tmp_143_type 1303
-#define _tmp_144_type 1304
-#define _tmp_145_type 1305
-#define _tmp_146_type 1306
-#define _tmp_147_type 1307
-#define _tmp_148_type 1308
-#define _tmp_149_type 1309
-#define _tmp_150_type 1310
-#define _loop1_151_type 1311
-#define _loop1_152_type 1312
-#define _tmp_153_type 1313
-#define _tmp_154_type 1314
-
-static mod_ty file_rule(Parser *p);
-static mod_ty interactive_rule(Parser *p);
-static mod_ty eval_rule(Parser *p);
-static mod_ty func_type_rule(Parser *p);
-static expr_ty fstring_rule(Parser *p);
-static asdl_seq* type_expressions_rule(Parser *p);
-static asdl_seq* statements_rule(Parser *p);
-static asdl_seq* statement_rule(Parser *p);
-static asdl_seq* statement_newline_rule(Parser *p);
-static asdl_seq* simple_stmt_rule(Parser *p);
-static stmt_ty small_stmt_rule(Parser *p);
-static stmt_ty compound_stmt_rule(Parser *p);
-static stmt_ty assignment_rule(Parser *p);
-static AugOperator* augassign_rule(Parser *p);
-static stmt_ty global_stmt_rule(Parser *p);
-static stmt_ty nonlocal_stmt_rule(Parser *p);
-static stmt_ty yield_stmt_rule(Parser *p);
-static stmt_ty assert_stmt_rule(Parser *p);
-static stmt_ty del_stmt_rule(Parser *p);
-static stmt_ty import_stmt_rule(Parser *p);
-static stmt_ty import_name_rule(Parser *p);
-static stmt_ty import_from_rule(Parser *p);
-static asdl_seq* import_from_targets_rule(Parser *p);
-static asdl_seq* import_from_as_names_rule(Parser *p);
-static alias_ty import_from_as_name_rule(Parser *p);
-static asdl_seq* dotted_as_names_rule(Parser *p);
-static alias_ty dotted_as_name_rule(Parser *p);
-static expr_ty dotted_name_rule(Parser *p);
-static stmt_ty if_stmt_rule(Parser *p);
-static stmt_ty elif_stmt_rule(Parser *p);
-static asdl_seq* else_block_rule(Parser *p);
-static stmt_ty while_stmt_rule(Parser *p);
-static stmt_ty for_stmt_rule(Parser *p);
-static stmt_ty with_stmt_rule(Parser *p);
-static withitem_ty with_item_rule(Parser *p);
-static stmt_ty try_stmt_rule(Parser *p);
-static excepthandler_ty except_block_rule(Parser *p);
-static asdl_seq* finally_block_rule(Parser *p);
-static stmt_ty return_stmt_rule(Parser *p);
-static stmt_ty raise_stmt_rule(Parser *p);
-static stmt_ty function_def_rule(Parser *p);
-static stmt_ty function_def_raw_rule(Parser *p);
-static Token* func_type_comment_rule(Parser *p);
-static arguments_ty params_rule(Parser *p);
-static arguments_ty parameters_rule(Parser *p);
-static asdl_seq* slash_no_default_rule(Parser *p);
-static SlashWithDefault* slash_with_default_rule(Parser *p);
-static StarEtc* star_etc_rule(Parser *p);
-static arg_ty kwds_rule(Parser *p);
-static arg_ty param_no_default_rule(Parser *p);
-static NameDefaultPair* param_with_default_rule(Parser *p);
-static NameDefaultPair* param_maybe_default_rule(Parser *p);
-static arg_ty param_rule(Parser *p);
-static expr_ty annotation_rule(Parser *p);
-static expr_ty default_rule(Parser *p);
-static asdl_seq* decorators_rule(Parser *p);
-static stmt_ty class_def_rule(Parser *p);
-static stmt_ty class_def_raw_rule(Parser *p);
-static asdl_seq* block_rule(Parser *p);
-static expr_ty star_expressions_rule(Parser *p);
-static expr_ty star_expression_rule(Parser *p);
-static asdl_seq* star_named_expressions_rule(Parser *p);
-static expr_ty star_named_expression_rule(Parser *p);
-static expr_ty named_expression_rule(Parser *p);
-static expr_ty annotated_rhs_rule(Parser *p);
-static expr_ty expressions_rule(Parser *p);
-static expr_ty expression_rule(Parser *p);
-static expr_ty lambdef_rule(Parser *p);
-static arguments_ty lambda_params_rule(Parser *p);
-static arguments_ty lambda_parameters_rule(Parser *p);
-static asdl_seq* lambda_slash_no_default_rule(Parser *p);
-static SlashWithDefault* lambda_slash_with_default_rule(Parser *p);
-static StarEtc* lambda_star_etc_rule(Parser *p);
-static arg_ty lambda_kwds_rule(Parser *p);
-static arg_ty lambda_param_no_default_rule(Parser *p);
-static NameDefaultPair* lambda_param_with_default_rule(Parser *p);
-static NameDefaultPair* lambda_param_maybe_default_rule(Parser *p);
-static arg_ty lambda_param_rule(Parser *p);
-static expr_ty disjunction_rule(Parser *p);
-static expr_ty conjunction_rule(Parser *p);
-static expr_ty inversion_rule(Parser *p);
-static expr_ty comparison_rule(Parser *p);
-static CmpopExprPair* compare_op_bitwise_or_pair_rule(Parser *p);
-static CmpopExprPair* eq_bitwise_or_rule(Parser *p);
-static CmpopExprPair* noteq_bitwise_or_rule(Parser *p);
-static CmpopExprPair* lte_bitwise_or_rule(Parser *p);
-static CmpopExprPair* lt_bitwise_or_rule(Parser *p);
-static CmpopExprPair* gte_bitwise_or_rule(Parser *p);
-static CmpopExprPair* gt_bitwise_or_rule(Parser *p);
-static CmpopExprPair* notin_bitwise_or_rule(Parser *p);
-static CmpopExprPair* in_bitwise_or_rule(Parser *p);
-static CmpopExprPair* isnot_bitwise_or_rule(Parser *p);
-static CmpopExprPair* is_bitwise_or_rule(Parser *p);
-static expr_ty bitwise_or_rule(Parser *p);
-static expr_ty bitwise_xor_rule(Parser *p);
-static expr_ty bitwise_and_rule(Parser *p);
-static expr_ty shift_expr_rule(Parser *p);
-static expr_ty sum_rule(Parser *p);
-static expr_ty term_rule(Parser *p);
-static expr_ty factor_rule(Parser *p);
-static expr_ty power_rule(Parser *p);
-static expr_ty await_primary_rule(Parser *p);
-static expr_ty primary_rule(Parser *p);
-static expr_ty slices_rule(Parser *p);
-static expr_ty slice_rule(Parser *p);
-static expr_ty atom_rule(Parser *p);
-static expr_ty strings_rule(Parser *p);
-static expr_ty list_rule(Parser *p);
-static expr_ty listcomp_rule(Parser *p);
-static expr_ty tuple_rule(Parser *p);
-static expr_ty group_rule(Parser *p);
-static expr_ty genexp_rule(Parser *p);
-static expr_ty set_rule(Parser *p);
-static expr_ty setcomp_rule(Parser *p);
-static expr_ty dict_rule(Parser *p);
-static expr_ty dictcomp_rule(Parser *p);
-static asdl_seq* double_starred_kvpairs_rule(Parser *p);
-static KeyValuePair* double_starred_kvpair_rule(Parser *p);
-static KeyValuePair* kvpair_rule(Parser *p);
-static asdl_seq* for_if_clauses_rule(Parser *p);
-static comprehension_ty for_if_clause_rule(Parser *p);
-static expr_ty yield_expr_rule(Parser *p);
-static expr_ty arguments_rule(Parser *p);
-static expr_ty args_rule(Parser *p);
-static asdl_seq* kwargs_rule(Parser *p);
-static expr_ty starred_expression_rule(Parser *p);
-static KeywordOrStarred* kwarg_or_starred_rule(Parser *p);
-static KeywordOrStarred* kwarg_or_double_starred_rule(Parser *p);
-static expr_ty star_targets_rule(Parser *p);
-static asdl_seq* star_targets_seq_rule(Parser *p);
-static expr_ty star_target_rule(Parser *p);
-static expr_ty star_atom_rule(Parser *p);
-static expr_ty single_target_rule(Parser *p);
-static expr_ty single_subscript_attribute_target_rule(Parser *p);
-static asdl_seq* del_targets_rule(Parser *p);
-static expr_ty del_target_rule(Parser *p);
-static expr_ty del_t_atom_rule(Parser *p);
-static asdl_seq* targets_rule(Parser *p);
-static expr_ty target_rule(Parser *p);
-static expr_ty t_primary_rule(Parser *p);
-static void *t_lookahead_rule(Parser *p);
-static expr_ty t_atom_rule(Parser *p);
-static void *invalid_arguments_rule(Parser *p);
-static void *invalid_kwarg_rule(Parser *p);
-static void *invalid_named_expression_rule(Parser *p);
-static void *invalid_assignment_rule(Parser *p);
-static expr_ty invalid_ann_assign_target_rule(Parser *p);
-static void *invalid_del_stmt_rule(Parser *p);
-static void *invalid_block_rule(Parser *p);
-static void *invalid_primary_rule(Parser *p);
-static void *invalid_comprehension_rule(Parser *p);
-static void *invalid_dict_comprehension_rule(Parser *p);
-static void *invalid_parameters_rule(Parser *p);
-static void *invalid_lambda_parameters_rule(Parser *p);
-static void *invalid_star_etc_rule(Parser *p);
-static void *invalid_lambda_star_etc_rule(Parser *p);
-static void *invalid_double_type_comments_rule(Parser *p);
-static void *invalid_with_item_rule(Parser *p);
-static void *invalid_for_target_rule(Parser *p);
-static void *invalid_group_rule(Parser *p);
-static void *invalid_import_from_targets_rule(Parser *p);
-static asdl_seq *_loop0_1_rule(Parser *p);
-static asdl_seq *_loop0_2_rule(Parser *p);
-static asdl_seq *_loop0_4_rule(Parser *p);
-static asdl_seq *_gather_3_rule(Parser *p);
-static asdl_seq *_loop0_6_rule(Parser *p);
-static asdl_seq *_gather_5_rule(Parser *p);
-static asdl_seq *_loop0_8_rule(Parser *p);
-static asdl_seq *_gather_7_rule(Parser *p);
-static asdl_seq *_loop0_10_rule(Parser *p);
-static asdl_seq *_gather_9_rule(Parser *p);
-static asdl_seq *_loop1_11_rule(Parser *p);
-static asdl_seq *_loop0_13_rule(Parser *p);
-static asdl_seq *_gather_12_rule(Parser *p);
-static void *_tmp_14_rule(Parser *p);
-static void *_tmp_15_rule(Parser *p);
-static void *_tmp_16_rule(Parser *p);
-static void *_tmp_17_rule(Parser *p);
-static void *_tmp_18_rule(Parser *p);
-static void *_tmp_19_rule(Parser *p);
-static void *_tmp_20_rule(Parser *p);
-static void *_tmp_21_rule(Parser *p);
-static asdl_seq *_loop1_22_rule(Parser *p);
-static void *_tmp_23_rule(Parser *p);
-static void *_tmp_24_rule(Parser *p);
-static asdl_seq *_loop0_26_rule(Parser *p);
-static asdl_seq *_gather_25_rule(Parser *p);
-static asdl_seq *_loop0_28_rule(Parser *p);
-static asdl_seq *_gather_27_rule(Parser *p);
-static void *_tmp_29_rule(Parser *p);
-static void *_tmp_30_rule(Parser *p);
-static asdl_seq *_loop0_31_rule(Parser *p);
-static asdl_seq *_loop1_32_rule(Parser *p);
-static asdl_seq *_loop0_34_rule(Parser *p);
-static asdl_seq *_gather_33_rule(Parser *p);
-static void *_tmp_35_rule(Parser *p);
-static asdl_seq *_loop0_37_rule(Parser *p);
-static asdl_seq *_gather_36_rule(Parser *p);
-static void *_tmp_38_rule(Parser *p);
-static asdl_seq *_loop0_40_rule(Parser *p);
-static asdl_seq *_gather_39_rule(Parser *p);
-static asdl_seq *_loop0_42_rule(Parser *p);
-static asdl_seq *_gather_41_rule(Parser *p);
-static asdl_seq *_loop0_44_rule(Parser *p);
-static asdl_seq *_gather_43_rule(Parser *p);
-static asdl_seq *_loop0_46_rule(Parser *p);
-static asdl_seq *_gather_45_rule(Parser *p);
-static void *_tmp_47_rule(Parser *p);
-static asdl_seq *_loop1_48_rule(Parser *p);
-static void *_tmp_49_rule(Parser *p);
-static void *_tmp_50_rule(Parser *p);
-static void *_tmp_51_rule(Parser *p);
-static void *_tmp_52_rule(Parser *p);
-static void *_tmp_53_rule(Parser *p);
-static asdl_seq *_loop0_54_rule(Parser *p);
-static asdl_seq *_loop0_55_rule(Parser *p);
-static asdl_seq *_loop0_56_rule(Parser *p);
-static asdl_seq *_loop1_57_rule(Parser *p);
-static asdl_seq *_loop0_58_rule(Parser *p);
-static asdl_seq *_loop1_59_rule(Parser *p);
-static asdl_seq *_loop1_60_rule(Parser *p);
-static asdl_seq *_loop1_61_rule(Parser *p);
-static asdl_seq *_loop0_62_rule(Parser *p);
-static asdl_seq *_loop1_63_rule(Parser *p);
-static asdl_seq *_loop0_64_rule(Parser *p);
-static asdl_seq *_loop1_65_rule(Parser *p);
-static asdl_seq *_loop0_66_rule(Parser *p);
-static asdl_seq *_loop1_67_rule(Parser *p);
-static asdl_seq *_loop1_68_rule(Parser *p);
-static void *_tmp_69_rule(Parser *p);
-static asdl_seq *_loop1_70_rule(Parser *p);
-static asdl_seq *_loop0_72_rule(Parser *p);
-static asdl_seq *_gather_71_rule(Parser *p);
-static asdl_seq *_loop1_73_rule(Parser *p);
-static asdl_seq *_loop0_74_rule(Parser *p);
-static asdl_seq *_loop0_75_rule(Parser *p);
-static asdl_seq *_loop0_76_rule(Parser *p);
-static asdl_seq *_loop1_77_rule(Parser *p);
-static asdl_seq *_loop0_78_rule(Parser *p);
-static asdl_seq *_loop1_79_rule(Parser *p);
-static asdl_seq *_loop1_80_rule(Parser *p);
-static asdl_seq *_loop1_81_rule(Parser *p);
-static asdl_seq *_loop0_82_rule(Parser *p);
-static asdl_seq *_loop1_83_rule(Parser *p);
-static asdl_seq *_loop0_84_rule(Parser *p);
-static asdl_seq *_loop1_85_rule(Parser *p);
-static asdl_seq *_loop0_86_rule(Parser *p);
-static asdl_seq *_loop1_87_rule(Parser *p);
-static asdl_seq *_loop1_88_rule(Parser *p);
-static asdl_seq *_loop1_89_rule(Parser *p);
-static asdl_seq *_loop1_90_rule(Parser *p);
-static void *_tmp_91_rule(Parser *p);
-static asdl_seq *_loop0_93_rule(Parser *p);
-static asdl_seq *_gather_92_rule(Parser *p);
-static void *_tmp_94_rule(Parser *p);
-static void *_tmp_95_rule(Parser *p);
-static void *_tmp_96_rule(Parser *p);
-static void *_tmp_97_rule(Parser *p);
-static asdl_seq *_loop1_98_rule(Parser *p);
-static void *_tmp_99_rule(Parser *p);
-static void *_tmp_100_rule(Parser *p);
-static asdl_seq *_loop0_102_rule(Parser *p);
-static asdl_seq *_gather_101_rule(Parser *p);
-static asdl_seq *_loop1_103_rule(Parser *p);
-static asdl_seq *_loop0_104_rule(Parser *p);
-static asdl_seq *_loop0_105_rule(Parser *p);
-static asdl_seq *_loop0_107_rule(Parser *p);
-static asdl_seq *_gather_106_rule(Parser *p);
-static void *_tmp_108_rule(Parser *p);
-static asdl_seq *_loop0_110_rule(Parser *p);
-static asdl_seq *_gather_109_rule(Parser *p);
-static asdl_seq *_loop0_112_rule(Parser *p);
-static asdl_seq *_gather_111_rule(Parser *p);
-static asdl_seq *_loop0_114_rule(Parser *p);
-static asdl_seq *_gather_113_rule(Parser *p);
-static asdl_seq *_loop0_116_rule(Parser *p);
-static asdl_seq *_gather_115_rule(Parser *p);
-static asdl_seq *_loop0_117_rule(Parser *p);
-static asdl_seq *_loop0_119_rule(Parser *p);
-static asdl_seq *_gather_118_rule(Parser *p);
-static void *_tmp_120_rule(Parser *p);
-static asdl_seq *_loop0_122_rule(Parser *p);
-static asdl_seq *_gather_121_rule(Parser *p);
-static asdl_seq *_loop0_124_rule(Parser *p);
-static asdl_seq *_gather_123_rule(Parser *p);
-static void *_tmp_125_rule(Parser *p);
-static asdl_seq *_loop0_126_rule(Parser *p);
-static asdl_seq *_loop0_127_rule(Parser *p);
-static asdl_seq *_loop0_128_rule(Parser *p);
-static void *_tmp_129_rule(Parser *p);
-static void *_tmp_130_rule(Parser *p);
-static asdl_seq *_loop0_131_rule(Parser *p);
-static void *_tmp_132_rule(Parser *p);
-static asdl_seq *_loop0_133_rule(Parser *p);
-static void *_tmp_134_rule(Parser *p);
-static void *_tmp_135_rule(Parser *p);
-static void *_tmp_136_rule(Parser *p);
-static void *_tmp_137_rule(Parser *p);
-static void *_tmp_138_rule(Parser *p);
-static void *_tmp_139_rule(Parser *p);
-static void *_tmp_140_rule(Parser *p);
-static void *_tmp_141_rule(Parser *p);
-static void *_tmp_142_rule(Parser *p);
-static void *_tmp_143_rule(Parser *p);
-static void *_tmp_144_rule(Parser *p);
-static void *_tmp_145_rule(Parser *p);
-static void *_tmp_146_rule(Parser *p);
-static void *_tmp_147_rule(Parser *p);
-static void *_tmp_148_rule(Parser *p);
-static void *_tmp_149_rule(Parser *p);
-static void *_tmp_150_rule(Parser *p);
-static asdl_seq *_loop1_151_rule(Parser *p);
-static asdl_seq *_loop1_152_rule(Parser *p);
-static void *_tmp_153_rule(Parser *p);
-static void *_tmp_154_rule(Parser *p);
-
-
-// file: statements? $
-static mod_ty
-file_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    mod_ty _res = NULL;
-    int _mark = p->mark;
-    { // statements? $
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> file[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statements? $"));
-        void *a;
-        Token * endmarker_var;
-        if (
-            (a = statements_rule(p), 1)  // statements?
-            &&
-            (endmarker_var = _PyPegen_expect_token(p, ENDMARKER))  // token='ENDMARKER'
-        )
-        {
-            D(fprintf(stderr, "%*c+ file[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statements? $"));
-            _res = _PyPegen_make_module ( p , a );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s file[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statements? $"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// interactive: statement_newline
-static mod_ty
-interactive_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    mod_ty _res = NULL;
-    int _mark = p->mark;
-    { // statement_newline
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> interactive[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement_newline"));
-        asdl_seq* a;
-        if (
-            (a = statement_newline_rule(p))  // statement_newline
-        )
-        {
-            D(fprintf(stderr, "%*c+ interactive[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statement_newline"));
-            _res = Interactive ( a , p -> arena );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s interactive[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement_newline"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// eval: expressions NEWLINE* $
-static mod_ty
-eval_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    mod_ty _res = NULL;
-    int _mark = p->mark;
-    { // expressions NEWLINE* $
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> eval[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expressions NEWLINE* $"));
-        asdl_seq * _loop0_1_var;
-        expr_ty a;
-        Token * endmarker_var;
-        if (
-            (a = expressions_rule(p))  // expressions
-            &&
-            (_loop0_1_var = _loop0_1_rule(p))  // NEWLINE*
-            &&
-            (endmarker_var = _PyPegen_expect_token(p, ENDMARKER))  // token='ENDMARKER'
-        )
-        {
-            D(fprintf(stderr, "%*c+ eval[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expressions NEWLINE* $"));
-            _res = Expression ( a , p -> arena );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s eval[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expressions NEWLINE* $"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// func_type: '(' type_expressions? ')' '->' expression NEWLINE* $
-static mod_ty
-func_type_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    mod_ty _res = NULL;
-    int _mark = p->mark;
-    { // '(' type_expressions? ')' '->' expression NEWLINE* $
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> func_type[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $"));
-        Token * _literal;
-        Token * _literal_1;
-        Token * _literal_2;
-        asdl_seq * _loop0_2_var;
-        void *a;
-        expr_ty b;
-        Token * endmarker_var;
-        if (
-            (_literal = _PyPegen_expect_token(p, 7))  // token='('
-            &&
-            (a = type_expressions_rule(p), 1)  // type_expressions?
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
-            &&
-            (_literal_2 = _PyPegen_expect_token(p, 51))  // token='->'
-            &&
-            (b = expression_rule(p))  // expression
-            &&
-            (_loop0_2_var = _loop0_2_rule(p))  // NEWLINE*
-            &&
-            (endmarker_var = _PyPegen_expect_token(p, ENDMARKER))  // token='ENDMARKER'
-        )
-        {
-            D(fprintf(stderr, "%*c+ func_type[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $"));
-            _res = FunctionType ( a , b , p -> arena );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s func_type[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// fstring: star_expressions
-static expr_ty
-fstring_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    { // star_expressions
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> fstring[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
-        expr_ty star_expressions_var;
-        if (
-            (star_expressions_var = star_expressions_rule(p))  // star_expressions
-        )
-        {
-            D(fprintf(stderr, "%*c+ fstring[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
-            _res = star_expressions_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s fstring[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// type_expressions:
-//     | ','.expression+ ',' '*' expression ',' '**' expression
-//     | ','.expression+ ',' '*' expression
-//     | ','.expression+ ',' '**' expression
-//     | '*' expression ',' '**' expression
-//     | '*' expression
-//     | '**' expression
-//     | ','.expression+
-static asdl_seq*
-type_expressions_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq* _res = NULL;
-    int _mark = p->mark;
-    { // ','.expression+ ',' '*' expression ',' '**' expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
-        Token * _literal;
-        Token * _literal_1;
-        Token * _literal_2;
-        Token * _literal_3;
-        asdl_seq * a;
-        expr_ty b;
-        expr_ty c;
-        if (
-            (a = _gather_3_rule(p))  // ','.expression+
-            &&
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 16))  // token='*'
-            &&
-            (b = expression_rule(p))  // expression
-            &&
-            (_literal_2 = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (_literal_3 = _PyPegen_expect_token(p, 35))  // token='**'
-            &&
-            (c = expression_rule(p))  // expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
-            _res = _PyPegen_seq_append_to_end ( p , CHECK ( _PyPegen_seq_append_to_end ( p , a , b ) ) , c );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
-    }
-    { // ','.expression+ ',' '*' expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression"));
-        Token * _literal;
-        Token * _literal_1;
-        asdl_seq * a;
-        expr_ty b;
-        if (
-            (a = _gather_5_rule(p))  // ','.expression+
-            &&
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 16))  // token='*'
-            &&
-            (b = expression_rule(p))  // expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression"));
-            _res = _PyPegen_seq_append_to_end ( p , a , b );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '*' expression"));
-    }
-    { // ','.expression+ ',' '**' expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '**' expression"));
-        Token * _literal;
-        Token * _literal_1;
-        asdl_seq * a;
-        expr_ty b;
-        if (
-            (a = _gather_7_rule(p))  // ','.expression+
-            &&
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 35))  // token='**'
-            &&
-            (b = expression_rule(p))  // expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '**' expression"));
-            _res = _PyPegen_seq_append_to_end ( p , a , b );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '**' expression"));
-    }
-    { // '*' expression ',' '**' expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression ',' '**' expression"));
-        Token * _literal;
-        Token * _literal_1;
-        Token * _literal_2;
-        expr_ty a;
-        expr_ty b;
-        if (
-            (_literal = _PyPegen_expect_token(p, 16))  // token='*'
-            &&
-            (a = expression_rule(p))  // expression
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (_literal_2 = _PyPegen_expect_token(p, 35))  // token='**'
-            &&
-            (b = expression_rule(p))  // expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression ',' '**' expression"));
-            _res = _PyPegen_seq_append_to_end ( p , CHECK ( _PyPegen_singleton_seq ( p , a ) ) , b );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression ',' '**' expression"));
-    }
-    { // '*' expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression"));
-        Token * _literal;
-        expr_ty a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 16))  // token='*'
-            &&
-            (a = expression_rule(p))  // expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression"));
-            _res = _PyPegen_singleton_seq ( p , a );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression"));
-    }
-    { // '**' expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression"));
-        Token * _literal;
-        expr_ty a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 35))  // token='**'
-            &&
-            (a = expression_rule(p))  // expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression"));
-            _res = _PyPegen_singleton_seq ( p , a );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression"));
-    }
-    { // ','.expression+
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+"));
-        asdl_seq * _gather_9_var;
-        if (
-            (_gather_9_var = _gather_9_rule(p))  // ','.expression+
-        )
-        {
-            D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+"));
-            _res = _gather_9_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// statements: statement+
-static asdl_seq*
-statements_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq* _res = NULL;
-    int _mark = p->mark;
-    { // statement+
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> statements[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement+"));
-        asdl_seq * a;
-        if (
-            (a = _loop1_11_rule(p))  // statement+
-        )
-        {
-            D(fprintf(stderr, "%*c+ statements[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statement+"));
-            _res = _PyPegen_seq_flatten ( p , a );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s statements[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement+"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// statement: compound_stmt | simple_stmt
-static asdl_seq*
-statement_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq* _res = NULL;
-    int _mark = p->mark;
-    { // compound_stmt
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> statement[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compound_stmt"));
-        stmt_ty a;
-        if (
-            (a = compound_stmt_rule(p))  // compound_stmt
-        )
-        {
-            D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "compound_stmt"));
-            _res = _PyPegen_singleton_seq ( p , a );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s statement[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compound_stmt"));
-    }
-    { // simple_stmt
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> statement[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
-        asdl_seq* simple_stmt_var;
-        if (
-            (simple_stmt_var = simple_stmt_rule(p))  // simple_stmt
-        )
-        {
-            D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
-            _res = simple_stmt_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s statement[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// statement_newline: compound_stmt NEWLINE | simple_stmt | NEWLINE | $
-static asdl_seq*
-statement_newline_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq* _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // compound_stmt NEWLINE
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compound_stmt NEWLINE"));
-        stmt_ty a;
-        Token * newline_var;
-        if (
-            (a = compound_stmt_rule(p))  // compound_stmt
-            &&
-            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
-        )
-        {
-            D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "compound_stmt NEWLINE"));
-            _res = _PyPegen_singleton_seq ( p , a );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compound_stmt NEWLINE"));
-    }
-    { // simple_stmt
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
-        asdl_seq* simple_stmt_var;
-        if (
-            (simple_stmt_var = simple_stmt_rule(p))  // simple_stmt
-        )
-        {
-            D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
-            _res = simple_stmt_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt"));
-    }
-    { // NEWLINE
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
-        Token * newline_var;
-        if (
-            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
-        )
-        {
-            D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _PyPegen_singleton_seq ( p , CHECK ( _Py_Pass ( EXTRA ) ) );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
-    }
-    { // $
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> statement_newline[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "$"));
-        Token * endmarker_var;
-        if (
-            (endmarker_var = _PyPegen_expect_token(p, ENDMARKER))  // token='ENDMARKER'
-        )
-        {
-            D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "$"));
-            _res = _PyPegen_interactive_exit ( p );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "$"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// simple_stmt: small_stmt !';' NEWLINE | ';'.small_stmt+ ';'? NEWLINE
-static asdl_seq*
-simple_stmt_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq* _res = NULL;
-    int _mark = p->mark;
-    { // small_stmt !';' NEWLINE
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "small_stmt !';' NEWLINE"));
-        stmt_ty a;
-        Token * newline_var;
-        if (
-            (a = small_stmt_rule(p))  // small_stmt
-            &&
-            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 13)  // token=';'
-            &&
-            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
-        )
-        {
-            D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "small_stmt !';' NEWLINE"));
-            _res = _PyPegen_singleton_seq ( p , a );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "small_stmt !';' NEWLINE"));
-    }
-    { // ';'.small_stmt+ ';'? NEWLINE
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'.small_stmt+ ';'? NEWLINE"));
-        void *_opt_var;
-        UNUSED(_opt_var); // Silence compiler warnings
-        asdl_seq * a;
-        Token * newline_var;
-        if (
-            (a = _gather_12_rule(p))  // ';'.small_stmt+
-            &&
-            (_opt_var = _PyPegen_expect_token(p, 13), 1)  // ';'?
-            &&
-            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
-        )
-        {
-            D(fprintf(stderr, "%*c+ simple_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'.small_stmt+ ';'? NEWLINE"));
-            _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'.small_stmt+ ';'? NEWLINE"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// small_stmt:
-//     | assignment
-//     | star_expressions
-//     | &'return' return_stmt
-//     | &('import' | 'from') import_stmt
-//     | &'raise' raise_stmt
-//     | 'pass'
-//     | &'del' del_stmt
-//     | &'yield' yield_stmt
-//     | &'assert' assert_stmt
-//     | 'break'
-//     | 'continue'
-//     | &'global' global_stmt
-//     | &'nonlocal' nonlocal_stmt
-static stmt_ty
-small_stmt_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    stmt_ty _res = NULL;
-    if (_PyPegen_is_memoized(p, small_stmt_type, &_res)) {
-        D(p->level--);
-        return _res;
-    }
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // assignment
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "assignment"));
-        stmt_ty assignment_var;
-        if (
-            (assignment_var = assignment_rule(p))  // assignment
-        )
-        {
-            D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "assignment"));
-            _res = assignment_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "assignment"));
-    }
-    { // star_expressions
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
-        expr_ty e;
-        if (
-            (e = star_expressions_rule(p))  // star_expressions
-        )
-        {
-            D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Expr ( e , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
-    }
-    { // &'return' return_stmt
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'return' return_stmt"));
-        stmt_ty return_stmt_var;
-        if (
-            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 500)  // token='return'
-            &&
-            (return_stmt_var = return_stmt_rule(p))  // return_stmt
-        )
-        {
-            D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'return' return_stmt"));
-            _res = return_stmt_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'return' return_stmt"));
-    }
-    { // &('import' | 'from') import_stmt
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('import' | 'from') import_stmt"));
-        stmt_ty import_stmt_var;
-        if (
-            _PyPegen_lookahead(1, _tmp_14_rule, p)
-            &&
-            (import_stmt_var = import_stmt_rule(p))  // import_stmt
-        )
-        {
-            D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('import' | 'from') import_stmt"));
-            _res = import_stmt_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('import' | 'from') import_stmt"));
-    }
-    { // &'raise' raise_stmt
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'raise' raise_stmt"));
-        stmt_ty raise_stmt_var;
-        if (
-            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 501)  // token='raise'
-            &&
-            (raise_stmt_var = raise_stmt_rule(p))  // raise_stmt
-        )
-        {
-            D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'raise' raise_stmt"));
-            _res = raise_stmt_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'raise' raise_stmt"));
-    }
-    { // 'pass'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'pass'"));
-        Token * _keyword;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 502))  // token='pass'
-        )
-        {
-            D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'pass'"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Pass ( EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'pass'"));
-    }
-    { // &'del' del_stmt
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'del' del_stmt"));
-        stmt_ty del_stmt_var;
-        if (
-            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 503)  // token='del'
-            &&
-            (del_stmt_var = del_stmt_rule(p))  // del_stmt
-        )
-        {
-            D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'del' del_stmt"));
-            _res = del_stmt_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'del' del_stmt"));
-    }
-    { // &'yield' yield_stmt
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'yield' yield_stmt"));
-        stmt_ty yield_stmt_var;
-        if (
-            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 504)  // token='yield'
-            &&
-            (yield_stmt_var = yield_stmt_rule(p))  // yield_stmt
-        )
-        {
-            D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'yield' yield_stmt"));
-            _res = yield_stmt_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'yield' yield_stmt"));
-    }
-    { // &'assert' assert_stmt
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'assert' assert_stmt"));
-        stmt_ty assert_stmt_var;
-        if (
-            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 505)  // token='assert'
-            &&
-            (assert_stmt_var = assert_stmt_rule(p))  // assert_stmt
-        )
-        {
-            D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'assert' assert_stmt"));
-            _res = assert_stmt_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'assert' assert_stmt"));
-    }
-    { // 'break'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'break'"));
-        Token * _keyword;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 506))  // token='break'
-        )
-        {
-            D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'break'"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Break ( EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'break'"));
-    }
-    { // 'continue'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'continue'"));
-        Token * _keyword;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 507))  // token='continue'
-        )
-        {
-            D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'continue'"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Continue ( EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'continue'"));
-    }
-    { // &'global' global_stmt
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'global' global_stmt"));
-        stmt_ty global_stmt_var;
-        if (
-            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 508)  // token='global'
-            &&
-            (global_stmt_var = global_stmt_rule(p))  // global_stmt
-        )
-        {
-            D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'global' global_stmt"));
-            _res = global_stmt_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'global' global_stmt"));
-    }
-    { // &'nonlocal' nonlocal_stmt
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> small_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'nonlocal' nonlocal_stmt"));
-        stmt_ty nonlocal_stmt_var;
-        if (
-            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 509)  // token='nonlocal'
-            &&
-            (nonlocal_stmt_var = nonlocal_stmt_rule(p))  // nonlocal_stmt
-        )
-        {
-            D(fprintf(stderr, "%*c+ small_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'nonlocal' nonlocal_stmt"));
-            _res = nonlocal_stmt_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'nonlocal' nonlocal_stmt"));
-    }
-    _res = NULL;
-  done:
-    _PyPegen_insert_memo(p, _mark, small_stmt_type, _res);
-    D(p->level--);
-    return _res;
-}
-
-// compound_stmt:
-//     | &('def' | '@' | ASYNC) function_def
-//     | &'if' if_stmt
-//     | &('class' | '@') class_def
-//     | &('with' | ASYNC) with_stmt
-//     | &('for' | ASYNC) for_stmt
-//     | &'try' try_stmt
-//     | &'while' while_stmt
-static stmt_ty
-compound_stmt_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    stmt_ty _res = NULL;
-    int _mark = p->mark;
-    { // &('def' | '@' | ASYNC) function_def
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('def' | '@' | ASYNC) function_def"));
-        stmt_ty function_def_var;
-        if (
-            _PyPegen_lookahead(1, _tmp_15_rule, p)
-            &&
-            (function_def_var = function_def_rule(p))  // function_def
-        )
-        {
-            D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('def' | '@' | ASYNC) function_def"));
-            _res = function_def_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('def' | '@' | ASYNC) function_def"));
-    }
-    { // &'if' if_stmt
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'if' if_stmt"));
-        stmt_ty if_stmt_var;
-        if (
-            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 510)  // token='if'
-            &&
-            (if_stmt_var = if_stmt_rule(p))  // if_stmt
-        )
-        {
-            D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'if' if_stmt"));
-            _res = if_stmt_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'if' if_stmt"));
-    }
-    { // &('class' | '@') class_def
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('class' | '@') class_def"));
-        stmt_ty class_def_var;
-        if (
-            _PyPegen_lookahead(1, _tmp_16_rule, p)
-            &&
-            (class_def_var = class_def_rule(p))  // class_def
-        )
-        {
-            D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('class' | '@') class_def"));
-            _res = class_def_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('class' | '@') class_def"));
-    }
-    { // &('with' | ASYNC) with_stmt
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('with' | ASYNC) with_stmt"));
-        stmt_ty with_stmt_var;
-        if (
-            _PyPegen_lookahead(1, _tmp_17_rule, p)
-            &&
-            (with_stmt_var = with_stmt_rule(p))  // with_stmt
-        )
-        {
-            D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('with' | ASYNC) with_stmt"));
-            _res = with_stmt_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('with' | ASYNC) with_stmt"));
-    }
-    { // &('for' | ASYNC) for_stmt
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('for' | ASYNC) for_stmt"));
-        stmt_ty for_stmt_var;
-        if (
-            _PyPegen_lookahead(1, _tmp_18_rule, p)
-            &&
-            (for_stmt_var = for_stmt_rule(p))  // for_stmt
-        )
-        {
-            D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&('for' | ASYNC) for_stmt"));
-            _res = for_stmt_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('for' | ASYNC) for_stmt"));
-    }
-    { // &'try' try_stmt
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'try' try_stmt"));
-        stmt_ty try_stmt_var;
-        if (
-            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 511)  // token='try'
-            &&
-            (try_stmt_var = try_stmt_rule(p))  // try_stmt
-        )
-        {
-            D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'try' try_stmt"));
-            _res = try_stmt_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'try' try_stmt"));
-    }
-    { // &'while' while_stmt
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'while' while_stmt"));
-        stmt_ty while_stmt_var;
-        if (
-            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 512)  // token='while'
-            &&
-            (while_stmt_var = while_stmt_rule(p))  // while_stmt
-        )
-        {
-            D(fprintf(stderr, "%*c+ compound_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'while' while_stmt"));
-            _res = while_stmt_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'while' while_stmt"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// assignment:
-//     | NAME ':' expression ['=' annotated_rhs]
-//     | ('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]
-//     | ((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?
-//     | single_target augassign ~ (yield_expr | star_expressions)
-//     | invalid_assignment
-static stmt_ty
-assignment_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    stmt_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // NAME ':' expression ['=' annotated_rhs]
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]"));
-        Token * _literal;
-        expr_ty a;
-        expr_ty b;
-        void *c;
-        if (
-            (a = _PyPegen_name_token(p))  // NAME
-            &&
-            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
-            &&
-            (b = expression_rule(p))  // expression
-            &&
-            (c = _tmp_19_rule(p), 1)  // ['=' annotated_rhs]
-        )
-        {
-            D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = CHECK_VERSION ( 6 , "Variable annotation syntax is" , _Py_AnnAssign ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , b , c , 1 , EXTRA ) );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]"));
-    }
-    { // ('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]"));
-        Token * _literal;
-        void *a;
-        expr_ty b;
-        void *c;
-        if (
-            (a = _tmp_20_rule(p))  // '(' single_target ')' | single_subscript_attribute_target
-            &&
-            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
-            &&
-            (b = expression_rule(p))  // expression
-            &&
-            (c = _tmp_21_rule(p), 1)  // ['=' annotated_rhs]
-        )
-        {
-            D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = CHECK_VERSION ( 6 , "Variable annotations syntax is" , _Py_AnnAssign ( a , b , c , 0 , EXTRA ) );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]"));
-    }
-    { // ((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?"));
-        asdl_seq * a;
-        void *b;
-        void *tc;
-        if (
-            (a = _loop1_22_rule(p))  // ((star_targets '='))+
-            &&
-            (b = _tmp_23_rule(p))  // yield_expr | star_expressions
-            &&
-            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22)  // token='='
-            &&
-            (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)  // TYPE_COMMENT?
-        )
-        {
-            D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Assign ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?"));
-    }
-    { // single_target augassign ~ (yield_expr | star_expressions)
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_target augassign ~ (yield_expr | star_expressions)"));
-        int _cut_var = 0;
-        expr_ty a;
-        AugOperator* b;
-        void *c;
-        if (
-            (a = single_target_rule(p))  // single_target
-            &&
-            (b = augassign_rule(p))  // augassign
-            &&
-            (_cut_var = 1)
-            &&
-            (c = _tmp_24_rule(p))  // yield_expr | star_expressions
-        )
-        {
-            D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_target augassign ~ (yield_expr | star_expressions)"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_AugAssign ( a , b -> kind , c , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_target augassign ~ (yield_expr | star_expressions)"));
-        if (_cut_var) {
-            D(p->level--);
-            return NULL;
-        }
-    }
-    if (p->call_invalid_rules) { // invalid_assignment
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_assignment"));
-        void *invalid_assignment_var;
-        if (
-            (invalid_assignment_var = invalid_assignment_rule(p))  // invalid_assignment
-        )
-        {
-            D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_assignment"));
-            _res = invalid_assignment_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_assignment"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// augassign:
-//     | '+='
-//     | '-='
-//     | '*='
-//     | '@='
-//     | '/='
-//     | '%='
-//     | '&='
-//     | '|='
-//     | '^='
-//     | '<<='
-//     | '>>='
-//     | '**='
-//     | '//='
-static AugOperator*
-augassign_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    AugOperator* _res = NULL;
-    int _mark = p->mark;
-    { // '+='
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+='"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 36))  // token='+='
-        )
-        {
-            D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+='"));
-            _res = _PyPegen_augoperator ( p , Add );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+='"));
-    }
-    { // '-='
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-='"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 37))  // token='-='
-        )
-        {
-            D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-='"));
-            _res = _PyPegen_augoperator ( p , Sub );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-='"));
-    }
-    { // '*='
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*='"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 38))  // token='*='
-        )
-        {
-            D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*='"));
-            _res = _PyPegen_augoperator ( p , Mult );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*='"));
-    }
-    { // '@='
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@='"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 50))  // token='@='
-        )
-        {
-            D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@='"));
-            _res = CHECK_VERSION ( 5 , "The '@' operator is" , _PyPegen_augoperator ( p , MatMult ) );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@='"));
-    }
-    { // '/='
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'/='"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 39))  // token='/='
-        )
-        {
-            D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'/='"));
-            _res = _PyPegen_augoperator ( p , Div );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'/='"));
-    }
-    { // '%='
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'%='"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 40))  // token='%='
-        )
-        {
-            D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'%='"));
-            _res = _PyPegen_augoperator ( p , Mod );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'%='"));
-    }
-    { // '&='
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'&='"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 41))  // token='&='
-        )
-        {
-            D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'&='"));
-            _res = _PyPegen_augoperator ( p , BitAnd );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'&='"));
-    }
-    { // '|='
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|='"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 42))  // token='|='
-        )
-        {
-            D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'|='"));
-            _res = _PyPegen_augoperator ( p , BitOr );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|='"));
-    }
-    { // '^='
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'^='"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 43))  // token='^='
-        )
-        {
-            D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'^='"));
-            _res = _PyPegen_augoperator ( p , BitXor );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'^='"));
-    }
-    { // '<<='
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<<='"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 44))  // token='<<='
-        )
-        {
-            D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<<='"));
-            _res = _PyPegen_augoperator ( p , LShift );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<<='"));
-    }
-    { // '>>='
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>>='"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 45))  // token='>>='
-        )
-        {
-            D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>>='"));
-            _res = _PyPegen_augoperator ( p , RShift );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>>='"));
-    }
-    { // '**='
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**='"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 46))  // token='**='
-        )
-        {
-            D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**='"));
-            _res = _PyPegen_augoperator ( p , Pow );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**='"));
-    }
-    { // '//='
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> augassign[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'//='"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 48))  // token='//='
-        )
-        {
-            D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'//='"));
-            _res = _PyPegen_augoperator ( p , FloorDiv );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'//='"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// global_stmt: 'global' ','.NAME+
-static stmt_ty
-global_stmt_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    stmt_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // 'global' ','.NAME+
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> global_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+"));
-        Token * _keyword;
-        asdl_seq * a;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 508))  // token='global'
-            &&
-            (a = _gather_25_rule(p))  // ','.NAME+
-        )
-        {
-            D(fprintf(stderr, "%*c+ global_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Global ( CHECK ( _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s global_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'global' ','.NAME+"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// nonlocal_stmt: 'nonlocal' ','.NAME+
-static stmt_ty
-nonlocal_stmt_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    stmt_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // 'nonlocal' ','.NAME+
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> nonlocal_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+"));
-        Token * _keyword;
-        asdl_seq * a;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 509))  // token='nonlocal'
-            &&
-            (a = _gather_27_rule(p))  // ','.NAME+
-        )
-        {
-            D(fprintf(stderr, "%*c+ nonlocal_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Nonlocal ( CHECK ( _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s nonlocal_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'nonlocal' ','.NAME+"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// yield_stmt: yield_expr
-static stmt_ty
-yield_stmt_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    stmt_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // yield_expr
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> yield_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
-        expr_ty y;
-        if (
-            (y = yield_expr_rule(p))  // yield_expr
-        )
-        {
-            D(fprintf(stderr, "%*c+ yield_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Expr ( y , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s yield_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// assert_stmt: 'assert' expression [',' expression]
-static stmt_ty
-assert_stmt_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    stmt_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // 'assert' expression [',' expression]
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> assert_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]"));
-        Token * _keyword;
-        expr_ty a;
-        void *b;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 505))  // token='assert'
-            &&
-            (a = expression_rule(p))  // expression
-            &&
-            (b = _tmp_29_rule(p), 1)  // [',' expression]
-        )
-        {
-            D(fprintf(stderr, "%*c+ assert_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Assert ( a , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s assert_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'assert' expression [',' expression]"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// del_stmt: 'del' del_targets &(';' | NEWLINE) | invalid_del_stmt
-static stmt_ty
-del_stmt_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    stmt_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // 'del' del_targets &(';' | NEWLINE)
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'del' del_targets &(';' | NEWLINE)"));
-        Token * _keyword;
-        asdl_seq* a;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 503))  // token='del'
-            &&
-            (a = del_targets_rule(p))  // del_targets
-            &&
-            _PyPegen_lookahead(1, _tmp_30_rule, p)
-        )
-        {
-            D(fprintf(stderr, "%*c+ del_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'del' del_targets &(';' | NEWLINE)"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Delete ( a , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s del_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'del' del_targets &(';' | NEWLINE)"));
-    }
-    if (p->call_invalid_rules) { // invalid_del_stmt
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_del_stmt"));
-        void *invalid_del_stmt_var;
-        if (
-            (invalid_del_stmt_var = invalid_del_stmt_rule(p))  // invalid_del_stmt
-        )
-        {
-            D(fprintf(stderr, "%*c+ del_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_del_stmt"));
-            _res = invalid_del_stmt_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s del_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_del_stmt"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// import_stmt: import_name | import_from
-static stmt_ty
-import_stmt_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    stmt_ty _res = NULL;
-    int _mark = p->mark;
-    { // import_name
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> import_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_name"));
-        stmt_ty import_name_var;
-        if (
-            (import_name_var = import_name_rule(p))  // import_name
-        )
-        {
-            D(fprintf(stderr, "%*c+ import_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_name"));
-            _res = import_name_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_name"));
-    }
-    { // import_from
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> import_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from"));
-        stmt_ty import_from_var;
-        if (
-            (import_from_var = import_from_rule(p))  // import_from
-        )
-        {
-            D(fprintf(stderr, "%*c+ import_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from"));
-            _res = import_from_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// import_name: 'import' dotted_as_names
-static stmt_ty
-import_name_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    stmt_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // 'import' dotted_as_names
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> import_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import' dotted_as_names"));
-        Token * _keyword;
-        asdl_seq* a;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 513))  // token='import'
-            &&
-            (a = dotted_as_names_rule(p))  // dotted_as_names
-        )
-        {
-            D(fprintf(stderr, "%*c+ import_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import' dotted_as_names"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Import ( a , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s import_name[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import' dotted_as_names"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// import_from:
-//     | 'from' (('.' | '...'))* dotted_name 'import' import_from_targets
-//     | 'from' (('.' | '...'))+ 'import' import_from_targets
-static stmt_ty
-import_from_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    stmt_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // 'from' (('.' | '...'))* dotted_name 'import' import_from_targets
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> import_from[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets"));
-        Token * _keyword;
-        Token * _keyword_1;
-        asdl_seq * a;
-        expr_ty b;
-        asdl_seq* c;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 514))  // token='from'
-            &&
-            (a = _loop0_31_rule(p))  // (('.' | '...'))*
-            &&
-            (b = dotted_name_rule(p))  // dotted_name
-            &&
-            (_keyword_1 = _PyPegen_expect_token(p, 513))  // token='import'
-            &&
-            (c = import_from_targets_rule(p))  // import_from_targets
-        )
-        {
-            D(fprintf(stderr, "%*c+ import_from[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_ImportFrom ( b -> v . Name . id , c , _PyPegen_seq_count_dots ( a ) , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s import_from[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' (('.' | '...'))* dotted_name 'import' import_from_targets"));
-    }
-    { // 'from' (('.' | '...'))+ 'import' import_from_targets
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> import_from[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets"));
-        Token * _keyword;
-        Token * _keyword_1;
-        asdl_seq * a;
-        asdl_seq* b;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 514))  // token='from'
-            &&
-            (a = _loop1_32_rule(p))  // (('.' | '...'))+
-            &&
-            (_keyword_1 = _PyPegen_expect_token(p, 513))  // token='import'
-            &&
-            (b = import_from_targets_rule(p))  // import_from_targets
-        )
-        {
-            D(fprintf(stderr, "%*c+ import_from[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_ImportFrom ( NULL , b , _PyPegen_seq_count_dots ( a ) , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s import_from[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// import_from_targets:
-//     | '(' import_from_as_names ','? ')'
-//     | import_from_as_names !','
-//     | '*'
-//     | invalid_import_from_targets
-static asdl_seq*
-import_from_targets_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq* _res = NULL;
-    int _mark = p->mark;
-    { // '(' import_from_as_names ','? ')'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' import_from_as_names ','? ')'"));
-        Token * _literal;
-        Token * _literal_1;
-        void *_opt_var;
-        UNUSED(_opt_var); // Silence compiler warnings
-        asdl_seq* a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 7))  // token='('
-            &&
-            (a = import_from_as_names_rule(p))  // import_from_as_names
-            &&
-            (_opt_var = _PyPegen_expect_token(p, 12), 1)  // ','?
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
-        )
-        {
-            D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' import_from_as_names ','? ')'"));
-            _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' import_from_as_names ','? ')'"));
-    }
-    { // import_from_as_names !','
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_names !','"));
-        asdl_seq* import_from_as_names_var;
-        if (
-            (import_from_as_names_var = import_from_as_names_rule(p))  // import_from_as_names
-            &&
-            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12)  // token=','
-        )
-        {
-            D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names !','"));
-            _res = import_from_as_names_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names !','"));
-    }
-    { // '*'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*'"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 16))  // token='*'
-        )
-        {
-            D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*'"));
-            _res = _PyPegen_singleton_seq ( p , CHECK ( _PyPegen_alias_for_star ( p ) ) );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*'"));
-    }
-    if (p->call_invalid_rules) { // invalid_import_from_targets
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_import_from_targets"));
-        void *invalid_import_from_targets_var;
-        if (
-            (invalid_import_from_targets_var = invalid_import_from_targets_rule(p))  // invalid_import_from_targets
-        )
-        {
-            D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_import_from_targets"));
-            _res = invalid_import_from_targets_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_import_from_targets"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// import_from_as_names: ','.import_from_as_name+
-static asdl_seq*
-import_from_as_names_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq* _res = NULL;
-    int _mark = p->mark;
-    { // ','.import_from_as_name+
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> import_from_as_names[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.import_from_as_name+"));
-        asdl_seq * a;
-        if (
-            (a = _gather_33_rule(p))  // ','.import_from_as_name+
-        )
-        {
-            D(fprintf(stderr, "%*c+ import_from_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.import_from_as_name+"));
-            _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s import_from_as_names[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.import_from_as_name+"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// import_from_as_name: NAME ['as' NAME]
-static alias_ty
-import_from_as_name_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    alias_ty _res = NULL;
-    int _mark = p->mark;
-    { // NAME ['as' NAME]
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> import_from_as_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ['as' NAME]"));
-        expr_ty a;
-        void *b;
-        if (
-            (a = _PyPegen_name_token(p))  // NAME
-            &&
-            (b = _tmp_35_rule(p), 1)  // ['as' NAME]
-        )
-        {
-            D(fprintf(stderr, "%*c+ import_from_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ['as' NAME]"));
-            _res = _Py_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , p -> arena );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s import_from_as_name[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ['as' NAME]"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// dotted_as_names: ','.dotted_as_name+
-static asdl_seq*
-dotted_as_names_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq* _res = NULL;
-    int _mark = p->mark;
-    { // ','.dotted_as_name+
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> dotted_as_names[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.dotted_as_name+"));
-        asdl_seq * a;
-        if (
-            (a = _gather_36_rule(p))  // ','.dotted_as_name+
-        )
-        {
-            D(fprintf(stderr, "%*c+ dotted_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.dotted_as_name+"));
-            _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s dotted_as_names[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.dotted_as_name+"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// dotted_as_name: dotted_name ['as' NAME]
-static alias_ty
-dotted_as_name_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    alias_ty _res = NULL;
-    int _mark = p->mark;
-    { // dotted_name ['as' NAME]
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> dotted_as_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_name ['as' NAME]"));
-        expr_ty a;
-        void *b;
-        if (
-            (a = dotted_name_rule(p))  // dotted_name
-            &&
-            (b = _tmp_38_rule(p), 1)  // ['as' NAME]
-        )
-        {
-            D(fprintf(stderr, "%*c+ dotted_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name ['as' NAME]"));
-            _res = _Py_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , p -> arena );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s dotted_as_name[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name ['as' NAME]"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// Left-recursive
-// dotted_name: dotted_name '.' NAME | NAME
-static expr_ty dotted_name_raw(Parser *);
-static expr_ty
-dotted_name_rule(Parser *p)
-{
-    D(p->level++);
-    expr_ty _res = NULL;
-    if (_PyPegen_is_memoized(p, dotted_name_type, &_res)) {
-        D(p->level--);
-        return _res;
-    }
-    int _mark = p->mark;
-    int _resmark = p->mark;
-    while (1) {
-        int tmpvar_0 = _PyPegen_update_memo(p, _mark, dotted_name_type, _res);
-        if (tmpvar_0) {
-            D(p->level--);
-            return _res;
-        }
-        p->mark = _mark;
-        void *_raw = dotted_name_raw(p);
-        if (p->error_indicator)
-            return NULL;
-        if (_raw == NULL || p->mark <= _resmark)
-            break;
-        _resmark = p->mark;
-        _res = _raw;
-    }
-    p->mark = _resmark;
-    D(p->level--);
-    return _res;
-}
-static expr_ty
-dotted_name_raw(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    { // dotted_name '.' NAME
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> dotted_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_name '.' NAME"));
-        Token * _literal;
-        expr_ty a;
-        expr_ty b;
-        if (
-            (a = dotted_name_rule(p))  // dotted_name
-            &&
-            (_literal = _PyPegen_expect_token(p, 23))  // token='.'
-            &&
-            (b = _PyPegen_name_token(p))  // NAME
-        )
-        {
-            D(fprintf(stderr, "%*c+ dotted_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name '.' NAME"));
-            _res = _PyPegen_join_names_with_dot ( p , a , b );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s dotted_name[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name '.' NAME"));
-    }
-    { // NAME
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> dotted_name[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
-        expr_ty name_var;
-        if (
-            (name_var = _PyPegen_name_token(p))  // NAME
-        )
-        {
-            D(fprintf(stderr, "%*c+ dotted_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
-            _res = name_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s dotted_name[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// if_stmt:
-//     | 'if' named_expression ':' block elif_stmt
-//     | 'if' named_expression ':' block else_block?
-static stmt_ty
-if_stmt_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    stmt_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // 'if' named_expression ':' block elif_stmt
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block elif_stmt"));
-        Token * _keyword;
-        Token * _literal;
-        expr_ty a;
-        asdl_seq* b;
-        stmt_ty c;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 510))  // token='if'
-            &&
-            (a = named_expression_rule(p))  // named_expression
-            &&
-            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
-            &&
-            (b = block_rule(p))  // block
-            &&
-            (c = elif_stmt_rule(p))  // elif_stmt
-        )
-        {
-            D(fprintf(stderr, "%*c+ if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block elif_stmt"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_If ( a , b , CHECK ( _PyPegen_singleton_seq ( p , c ) ) , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression ':' block elif_stmt"));
-    }
-    { // 'if' named_expression ':' block else_block?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> if_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block else_block?"));
-        Token * _keyword;
-        Token * _literal;
-        expr_ty a;
-        asdl_seq* b;
-        void *c;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 510))  // token='if'
-            &&
-            (a = named_expression_rule(p))  // named_expression
-            &&
-            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
-            &&
-            (b = block_rule(p))  // block
-            &&
-            (c = else_block_rule(p), 1)  // else_block?
-        )
-        {
-            D(fprintf(stderr, "%*c+ if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' block else_block?"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_If ( a , b , c , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' named_expression ':' block else_block?"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// elif_stmt:
-//     | 'elif' named_expression ':' block elif_stmt
-//     | 'elif' named_expression ':' block else_block?
-static stmt_ty
-elif_stmt_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    stmt_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // 'elif' named_expression ':' block elif_stmt
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block elif_stmt"));
-        Token * _keyword;
-        Token * _literal;
-        expr_ty a;
-        asdl_seq* b;
-        stmt_ty c;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 515))  // token='elif'
-            &&
-            (a = named_expression_rule(p))  // named_expression
-            &&
-            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
-            &&
-            (b = block_rule(p))  // block
-            &&
-            (c = elif_stmt_rule(p))  // elif_stmt
-        )
-        {
-            D(fprintf(stderr, "%*c+ elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block elif_stmt"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_If ( a , b , CHECK ( _PyPegen_singleton_seq ( p , c ) ) , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression ':' block elif_stmt"));
-    }
-    { // 'elif' named_expression ':' block else_block?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> elif_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block else_block?"));
-        Token * _keyword;
-        Token * _literal;
-        expr_ty a;
-        asdl_seq* b;
-        void *c;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 515))  // token='elif'
-            &&
-            (a = named_expression_rule(p))  // named_expression
-            &&
-            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
-            &&
-            (b = block_rule(p))  // block
-            &&
-            (c = else_block_rule(p), 1)  // else_block?
-        )
-        {
-            D(fprintf(stderr, "%*c+ elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' block else_block?"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_If ( a , b , c , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'elif' named_expression ':' block else_block?"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// else_block: 'else' ':' block
-static asdl_seq*
-else_block_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq* _res = NULL;
-    int _mark = p->mark;
-    { // 'else' ':' block
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> else_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'else' ':' block"));
-        Token * _keyword;
-        Token * _literal;
-        asdl_seq* b;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 516))  // token='else'
-            &&
-            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
-            &&
-            (b = block_rule(p))  // block
-        )
-        {
-            D(fprintf(stderr, "%*c+ else_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'else' ':' block"));
-            _res = b;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s else_block[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'else' ':' block"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// while_stmt: 'while' named_expression ':' block else_block?
-static stmt_ty
-while_stmt_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    stmt_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // 'while' named_expression ':' block else_block?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> while_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'while' named_expression ':' block else_block?"));
-        Token * _keyword;
-        Token * _literal;
-        expr_ty a;
-        asdl_seq* b;
-        void *c;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 512))  // token='while'
-            &&
-            (a = named_expression_rule(p))  // named_expression
-            &&
-            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
-            &&
-            (b = block_rule(p))  // block
-            &&
-            (c = else_block_rule(p), 1)  // else_block?
-        )
-        {
-            D(fprintf(stderr, "%*c+ while_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'while' named_expression ':' block else_block?"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_While ( a , b , c , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s while_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'while' named_expression ':' block else_block?"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// for_stmt:
-//     | 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
-//     | ASYNC 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
-//     | invalid_for_target
-static stmt_ty
-for_stmt_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    stmt_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> for_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
-        int _cut_var = 0;
-        Token * _keyword;
-        Token * _keyword_1;
-        Token * _literal;
-        asdl_seq* b;
-        void *el;
-        expr_ty ex;
-        expr_ty t;
-        void *tc;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 517))  // token='for'
-            &&
-            (t = star_targets_rule(p))  // star_targets
-            &&
-            (_keyword_1 = _PyPegen_expect_token(p, 518))  // token='in'
-            &&
-            (_cut_var = 1)
-            &&
-            (ex = star_expressions_rule(p))  // star_expressions
-            &&
-            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
-            &&
-            (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)  // TYPE_COMMENT?
-            &&
-            (b = block_rule(p))  // block
-            &&
-            (el = else_block_rule(p), 1)  // else_block?
-        )
-        {
-            D(fprintf(stderr, "%*c+ for_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_For ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
-        if (_cut_var) {
-            D(p->level--);
-            return NULL;
-        }
-    }
-    { // ASYNC 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> for_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
-        int _cut_var = 0;
-        Token * _keyword;
-        Token * _keyword_1;
-        Token * _literal;
-        Token * async_var;
-        asdl_seq* b;
-        void *el;
-        expr_ty ex;
-        expr_ty t;
-        void *tc;
-        if (
-            (async_var = _PyPegen_expect_token(p, ASYNC))  // token='ASYNC'
-            &&
-            (_keyword = _PyPegen_expect_token(p, 517))  // token='for'
-            &&
-            (t = star_targets_rule(p))  // star_targets
-            &&
-            (_keyword_1 = _PyPegen_expect_token(p, 518))  // token='in'
-            &&
-            (_cut_var = 1)
-            &&
-            (ex = star_expressions_rule(p))  // star_expressions
-            &&
-            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
-            &&
-            (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)  // TYPE_COMMENT?
-            &&
-            (b = block_rule(p))  // block
-            &&
-            (el = else_block_rule(p), 1)  // else_block?
-        )
-        {
-            D(fprintf(stderr, "%*c+ for_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = CHECK_VERSION ( 5 , "Async for loops are" , _Py_AsyncFor ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ star_expressions ':' TYPE_COMMENT? block else_block?"));
-        if (_cut_var) {
-            D(p->level--);
-            return NULL;
-        }
-    }
-    if (p->call_invalid_rules) { // invalid_for_target
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> for_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
-        void *invalid_for_target_var;
-        if (
-            (invalid_for_target_var = invalid_for_target_rule(p))  // invalid_for_target
-        )
-        {
-            D(fprintf(stderr, "%*c+ for_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
-            _res = invalid_for_target_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_for_target"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// with_stmt:
-//     | 'with' '(' ','.with_item+ ','? ')' ':' block
-//     | 'with' ','.with_item+ ':' TYPE_COMMENT? block
-//     | ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block
-//     | ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block
-static stmt_ty
-with_stmt_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    stmt_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // 'with' '(' ','.with_item+ ','? ')' ':' block
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block"));
-        Token * _keyword;
-        Token * _literal;
-        Token * _literal_1;
-        Token * _literal_2;
-        void *_opt_var;
-        UNUSED(_opt_var); // Silence compiler warnings
-        asdl_seq * a;
-        asdl_seq* b;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 519))  // token='with'
-            &&
-            (_literal = _PyPegen_expect_token(p, 7))  // token='('
-            &&
-            (a = _gather_39_rule(p))  // ','.with_item+
-            &&
-            (_opt_var = _PyPegen_expect_token(p, 12), 1)  // ','?
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
-            &&
-            (_literal_2 = _PyPegen_expect_token(p, 11))  // token=':'
-            &&
-            (b = block_rule(p))  // block
-        )
-        {
-            D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_With ( a , b , NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block"));
-    }
-    { // 'with' ','.with_item+ ':' TYPE_COMMENT? block
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block"));
-        Token * _keyword;
-        Token * _literal;
-        asdl_seq * a;
-        asdl_seq* b;
-        void *tc;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 519))  // token='with'
-            &&
-            (a = _gather_41_rule(p))  // ','.with_item+
-            &&
-            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
-            &&
-            (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)  // TYPE_COMMENT?
-            &&
-            (b = block_rule(p))  // block
-        )
-        {
-            D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_With ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with' ','.with_item+ ':' TYPE_COMMENT? block"));
-    }
-    { // ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block"));
-        Token * _keyword;
-        Token * _literal;
-        Token * _literal_1;
-        Token * _literal_2;
-        void *_opt_var;
-        UNUSED(_opt_var); // Silence compiler warnings
-        asdl_seq * a;
-        Token * async_var;
-        asdl_seq* b;
-        if (
-            (async_var = _PyPegen_expect_token(p, ASYNC))  // token='ASYNC'
-            &&
-            (_keyword = _PyPegen_expect_token(p, 519))  // token='with'
-            &&
-            (_literal = _PyPegen_expect_token(p, 7))  // token='('
-            &&
-            (a = _gather_43_rule(p))  // ','.with_item+
-            &&
-            (_opt_var = _PyPegen_expect_token(p, 12), 1)  // ','?
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
-            &&
-            (_literal_2 = _PyPegen_expect_token(p, 11))  // token=':'
-            &&
-            (b = block_rule(p))  // block
-        )
-        {
-            D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = CHECK_VERSION ( 5 , "Async with statements are" , _Py_AsyncWith ( a , b , NULL , EXTRA ) );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block"));
-    }
-    { // ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block"));
-        Token * _keyword;
-        Token * _literal;
-        asdl_seq * a;
-        Token * async_var;
-        asdl_seq* b;
-        void *tc;
-        if (
-            (async_var = _PyPegen_expect_token(p, ASYNC))  // token='ASYNC'
-            &&
-            (_keyword = _PyPegen_expect_token(p, 519))  // token='with'
-            &&
-            (a = _gather_45_rule(p))  // ','.with_item+
-            &&
-            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
-            &&
-            (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)  // TYPE_COMMENT?
-            &&
-            (b = block_rule(p))  // block
-        )
-        {
-            D(fprintf(stderr, "%*c+ with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = CHECK_VERSION ( 5 , "Async with statements are" , _Py_AsyncWith ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// with_item:
-//     | expression 'as' star_target &(',' | ')' | ':')
-//     | invalid_with_item
-//     | expression
-static withitem_ty
-with_item_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    withitem_ty _res = NULL;
-    int _mark = p->mark;
-    { // expression 'as' star_target &(',' | ')' | ':')
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression 'as' star_target &(',' | ')' | ':')"));
-        Token * _keyword;
-        expr_ty e;
-        expr_ty t;
-        if (
-            (e = expression_rule(p))  // expression
-            &&
-            (_keyword = _PyPegen_expect_token(p, 520))  // token='as'
-            &&
-            (t = star_target_rule(p))  // star_target
-            &&
-            _PyPegen_lookahead(1, _tmp_47_rule, p)
-        )
-        {
-            D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression 'as' star_target &(',' | ')' | ':')"));
-            _res = _Py_withitem ( e , t , p -> arena );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression 'as' star_target &(',' | ')' | ':')"));
-    }
-    if (p->call_invalid_rules) { // invalid_with_item
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_with_item"));
-        void *invalid_with_item_var;
-        if (
-            (invalid_with_item_var = invalid_with_item_rule(p))  // invalid_with_item
-        )
-        {
-            D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_with_item"));
-            _res = invalid_with_item_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_with_item"));
-    }
-    { // expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
-        expr_ty e;
-        if (
-            (e = expression_rule(p))  // expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
-            _res = _Py_withitem ( e , NULL , p -> arena );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// try_stmt:
-//     | 'try' ':' block finally_block
-//     | 'try' ':' block except_block+ else_block? finally_block?
-static stmt_ty
-try_stmt_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    stmt_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // 'try' ':' block finally_block
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' block finally_block"));
-        Token * _keyword;
-        Token * _literal;
-        asdl_seq* b;
-        asdl_seq* f;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 511))  // token='try'
-            &&
-            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
-            &&
-            (b = block_rule(p))  // block
-            &&
-            (f = finally_block_rule(p))  // finally_block
-        )
-        {
-            D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block finally_block"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Try ( b , NULL , NULL , f , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block finally_block"));
-    }
-    { // 'try' ':' block except_block+ else_block? finally_block?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' block except_block+ else_block? finally_block?"));
-        Token * _keyword;
-        Token * _literal;
-        asdl_seq* b;
-        void *el;
-        asdl_seq * ex;
-        void *f;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 511))  // token='try'
-            &&
-            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
-            &&
-            (b = block_rule(p))  // block
-            &&
-            (ex = _loop1_48_rule(p))  // except_block+
-            &&
-            (el = else_block_rule(p), 1)  // else_block?
-            &&
-            (f = finally_block_rule(p), 1)  // finally_block?
-        )
-        {
-            D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block except_block+ else_block? finally_block?"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Try ( b , ex , el , f , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block except_block+ else_block? finally_block?"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// except_block: 'except' expression ['as' NAME] ':' block | 'except' ':' block
-static excepthandler_ty
-except_block_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    excepthandler_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // 'except' expression ['as' NAME] ':' block
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
-        Token * _keyword;
-        Token * _literal;
-        asdl_seq* b;
-        expr_ty e;
-        void *t;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 521))  // token='except'
-            &&
-            (e = expression_rule(p))  // expression
-            &&
-            (t = _tmp_49_rule(p), 1)  // ['as' NAME]
-            &&
-            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
-            &&
-            (b = block_rule(p))  // block
-        )
-        {
-            D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_ExceptHandler ( e , ( t ) ? ( ( expr_ty ) t ) -> v . Name . id : NULL , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ['as' NAME] ':' block"));
-    }
-    { // 'except' ':' block
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' ':' block"));
-        Token * _keyword;
-        Token * _literal;
-        asdl_seq* b;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 521))  // token='except'
-            &&
-            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
-            &&
-            (b = block_rule(p))  // block
-        )
-        {
-            D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' ':' block"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_ExceptHandler ( NULL , NULL , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' ':' block"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// finally_block: 'finally' ':' block
-static asdl_seq*
-finally_block_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq* _res = NULL;
-    int _mark = p->mark;
-    { // 'finally' ':' block
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> finally_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'finally' ':' block"));
-        Token * _keyword;
-        Token * _literal;
-        asdl_seq* a;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 522))  // token='finally'
-            &&
-            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
-            &&
-            (a = block_rule(p))  // block
-        )
-        {
-            D(fprintf(stderr, "%*c+ finally_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'finally' ':' block"));
-            _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s finally_block[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'finally' ':' block"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// return_stmt: 'return' star_expressions?
-static stmt_ty
-return_stmt_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    stmt_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // 'return' star_expressions?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> return_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?"));
-        Token * _keyword;
-        void *a;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 500))  // token='return'
-            &&
-            (a = star_expressions_rule(p), 1)  // star_expressions?
-        )
-        {
-            D(fprintf(stderr, "%*c+ return_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Return ( a , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s return_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'return' star_expressions?"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// raise_stmt: 'raise' expression ['from' expression] | 'raise'
-static stmt_ty
-raise_stmt_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    stmt_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // 'raise' expression ['from' expression]
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]"));
-        Token * _keyword;
-        expr_ty a;
-        void *b;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 501))  // token='raise'
-            &&
-            (a = expression_rule(p))  // expression
-            &&
-            (b = _tmp_50_rule(p), 1)  // ['from' expression]
-        )
-        {
-            D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Raise ( a , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise' expression ['from' expression]"));
-    }
-    { // 'raise'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise'"));
-        Token * _keyword;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 501))  // token='raise'
-        )
-        {
-            D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise'"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Raise ( NULL , NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise'"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// function_def: decorators function_def_raw | function_def_raw
-static stmt_ty
-function_def_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    stmt_ty _res = NULL;
-    int _mark = p->mark;
-    { // decorators function_def_raw
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw"));
-        asdl_seq* d;
-        stmt_ty f;
-        if (
-            (d = decorators_rule(p))  // decorators
-            &&
-            (f = function_def_raw_rule(p))  // function_def_raw
-        )
-        {
-            D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw"));
-            _res = _PyPegen_function_def_decorators ( p , d , f );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators function_def_raw"));
-    }
-    { // function_def_raw
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "function_def_raw"));
-        stmt_ty function_def_raw_var;
-        if (
-            (function_def_raw_var = function_def_raw_rule(p))  // function_def_raw
-        )
-        {
-            D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "function_def_raw"));
-            _res = function_def_raw_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "function_def_raw"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// function_def_raw:
-//     | 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
-//     | ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
-static stmt_ty
-function_def_raw_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    stmt_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
-        Token * _keyword;
-        Token * _literal;
-        Token * _literal_1;
-        Token * _literal_2;
-        void *a;
-        asdl_seq* b;
-        expr_ty n;
-        void *params;
-        void *tc;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 523))  // token='def'
-            &&
-            (n = _PyPegen_name_token(p))  // NAME
-            &&
-            (_literal = _PyPegen_expect_token(p, 7))  // token='('
-            &&
-            (params = params_rule(p), 1)  // params?
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
-            &&
-            (a = _tmp_51_rule(p), 1)  // ['->' expression]
-            &&
-            (_literal_2 = _PyPegen_expect_token(p, 11))  // token=':'
-            &&
-            (tc = func_type_comment_rule(p), 1)  // func_type_comment?
-            &&
-            (b = block_rule(p))  // block
-        )
-        {
-            D(fprintf(stderr, "%*c+ function_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_FunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
-    }
-    { // ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
-        Token * _keyword;
-        Token * _literal;
-        Token * _literal_1;
-        Token * _literal_2;
-        void *a;
-        Token * async_var;
-        asdl_seq* b;
-        expr_ty n;
-        void *params;
-        void *tc;
-        if (
-            (async_var = _PyPegen_expect_token(p, ASYNC))  // token='ASYNC'
-            &&
-            (_keyword = _PyPegen_expect_token(p, 523))  // token='def'
-            &&
-            (n = _PyPegen_name_token(p))  // NAME
-            &&
-            (_literal = _PyPegen_expect_token(p, 7))  // token='('
-            &&
-            (params = params_rule(p), 1)  // params?
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
-            &&
-            (a = _tmp_52_rule(p), 1)  // ['->' expression]
-            &&
-            (_literal_2 = _PyPegen_expect_token(p, 11))  // token=':'
-            &&
-            (tc = func_type_comment_rule(p), 1)  // func_type_comment?
-            &&
-            (b = block_rule(p))  // block
-        )
-        {
-            D(fprintf(stderr, "%*c+ function_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = CHECK_VERSION ( 5 , "Async functions are" , _Py_AsyncFunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// func_type_comment:
-//     | NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
-//     | invalid_double_type_comments
-//     | TYPE_COMMENT
-static Token*
-func_type_comment_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    Token* _res = NULL;
-    int _mark = p->mark;
-    { // NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
-        Token * newline_var;
-        Token * t;
-        if (
-            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
-            &&
-            (t = _PyPegen_expect_token(p, TYPE_COMMENT))  // token='TYPE_COMMENT'
-            &&
-            _PyPegen_lookahead(1, _tmp_53_rule, p)
-        )
-        {
-            D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
-            _res = t;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
-    }
-    if (p->call_invalid_rules) { // invalid_double_type_comments
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments"));
-        void *invalid_double_type_comments_var;
-        if (
-            (invalid_double_type_comments_var = invalid_double_type_comments_rule(p))  // invalid_double_type_comments
-        )
-        {
-            D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments"));
-            _res = invalid_double_type_comments_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_double_type_comments"));
-    }
-    { // TYPE_COMMENT
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT"));
-        Token * type_comment_var;
-        if (
-            (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT))  // token='TYPE_COMMENT'
-        )
-        {
-            D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT"));
-            _res = type_comment_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// params: invalid_parameters | parameters
-static arguments_ty
-params_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    arguments_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->call_invalid_rules) { // invalid_parameters
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_parameters"));
-        void *invalid_parameters_var;
-        if (
-            (invalid_parameters_var = invalid_parameters_rule(p))  // invalid_parameters
-        )
-        {
-            D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_parameters"));
-            _res = invalid_parameters_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_parameters"));
-    }
-    { // parameters
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "parameters"));
-        arguments_ty parameters_var;
-        if (
-            (parameters_var = parameters_rule(p))  // parameters
-        )
-        {
-            D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "parameters"));
-            _res = parameters_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "parameters"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// parameters:
-//     | slash_no_default param_no_default* param_with_default* star_etc?
-//     | slash_with_default param_with_default* star_etc?
-//     | param_no_default+ param_with_default* star_etc?
-//     | param_with_default+ star_etc?
-//     | star_etc
-static arguments_ty
-parameters_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    arguments_ty _res = NULL;
-    int _mark = p->mark;
-    { // slash_no_default param_no_default* param_with_default* star_etc?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?"));
-        asdl_seq* a;
-        asdl_seq * b;
-        asdl_seq * c;
-        void *d;
-        if (
-            (a = slash_no_default_rule(p))  // slash_no_default
-            &&
-            (b = _loop0_54_rule(p))  // param_no_default*
-            &&
-            (c = _loop0_55_rule(p))  // param_with_default*
-            &&
-            (d = star_etc_rule(p), 1)  // star_etc?
-        )
-        {
-            D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?"));
-            _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?"));
-    }
-    { // slash_with_default param_with_default* star_etc?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
-        SlashWithDefault* a;
-        asdl_seq * b;
-        void *c;
-        if (
-            (a = slash_with_default_rule(p))  // slash_with_default
-            &&
-            (b = _loop0_56_rule(p))  // param_with_default*
-            &&
-            (c = star_etc_rule(p), 1)  // star_etc?
-        )
-        {
-            D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
-            _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
-    }
-    { // param_no_default+ param_with_default* star_etc?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
-        asdl_seq * a;
-        asdl_seq * b;
-        void *c;
-        if (
-            (a = _loop1_57_rule(p))  // param_no_default+
-            &&
-            (b = _loop0_58_rule(p))  // param_with_default*
-            &&
-            (c = star_etc_rule(p), 1)  // star_etc?
-        )
-        {
-            D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
-            _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
-    }
-    { // param_with_default+ star_etc?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?"));
-        asdl_seq * a;
-        void *b;
-        if (
-            (a = _loop1_59_rule(p))  // param_with_default+
-            &&
-            (b = star_etc_rule(p), 1)  // star_etc?
-        )
-        {
-            D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?"));
-            _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+ star_etc?"));
-    }
-    { // star_etc
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_etc"));
-        StarEtc* a;
-        if (
-            (a = star_etc_rule(p))  // star_etc
-        )
-        {
-            D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_etc"));
-            _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_etc"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// slash_no_default: param_no_default+ '/' ',' | param_no_default+ '/' &')'
-static asdl_seq*
-slash_no_default_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq* _res = NULL;
-    int _mark = p->mark;
-    { // param_no_default+ '/' ','
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','"));
-        Token * _literal;
-        Token * _literal_1;
-        asdl_seq * a;
-        if (
-            (a = _loop1_60_rule(p))  // param_no_default+
-            &&
-            (_literal = _PyPegen_expect_token(p, 17))  // token='/'
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 12))  // token=','
-        )
-        {
-            D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','"));
-            _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' ','"));
-    }
-    { // param_no_default+ '/' &')'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'"));
-        Token * _literal;
-        asdl_seq * a;
-        if (
-            (a = _loop1_61_rule(p))  // param_no_default+
-            &&
-            (_literal = _PyPegen_expect_token(p, 17))  // token='/'
-            &&
-            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)  // token=')'
-        )
-        {
-            D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'"));
-            _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' &')'"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// slash_with_default:
-//     | param_no_default* param_with_default+ '/' ','
-//     | param_no_default* param_with_default+ '/' &')'
-static SlashWithDefault*
-slash_with_default_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    SlashWithDefault* _res = NULL;
-    int _mark = p->mark;
-    { // param_no_default* param_with_default+ '/' ','
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
-        Token * _literal;
-        Token * _literal_1;
-        asdl_seq * a;
-        asdl_seq * b;
-        if (
-            (a = _loop0_62_rule(p))  // param_no_default*
-            &&
-            (b = _loop1_63_rule(p))  // param_with_default+
-            &&
-            (_literal = _PyPegen_expect_token(p, 17))  // token='/'
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 12))  // token=','
-        )
-        {
-            D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
-            _res = _PyPegen_slash_with_default ( p , a , b );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
-    }
-    { // param_no_default* param_with_default+ '/' &')'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
-        Token * _literal;
-        asdl_seq * a;
-        asdl_seq * b;
-        if (
-            (a = _loop0_64_rule(p))  // param_no_default*
-            &&
-            (b = _loop1_65_rule(p))  // param_with_default+
-            &&
-            (_literal = _PyPegen_expect_token(p, 17))  // token='/'
-            &&
-            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)  // token=')'
-        )
-        {
-            D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
-            _res = _PyPegen_slash_with_default ( p , a , b );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// star_etc:
-//     | '*' param_no_default param_maybe_default* kwds?
-//     | '*' ',' param_maybe_default+ kwds?
-//     | kwds
-//     | invalid_star_etc
-static StarEtc*
-star_etc_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    StarEtc* _res = NULL;
-    int _mark = p->mark;
-    { // '*' param_no_default param_maybe_default* kwds?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
-        Token * _literal;
-        arg_ty a;
-        asdl_seq * b;
-        void *c;
-        if (
-            (_literal = _PyPegen_expect_token(p, 16))  // token='*'
-            &&
-            (a = param_no_default_rule(p))  // param_no_default
-            &&
-            (b = _loop0_66_rule(p))  // param_maybe_default*
-            &&
-            (c = kwds_rule(p), 1)  // kwds?
-        )
-        {
-            D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
-            _res = _PyPegen_star_etc ( p , a , b , c );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
-    }
-    { // '*' ',' param_maybe_default+ kwds?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
-        Token * _literal;
-        Token * _literal_1;
-        asdl_seq * b;
-        void *c;
-        if (
-            (_literal = _PyPegen_expect_token(p, 16))  // token='*'
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (b = _loop1_67_rule(p))  // param_maybe_default+
-            &&
-            (c = kwds_rule(p), 1)  // kwds?
-        )
-        {
-            D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
-            _res = _PyPegen_star_etc ( p , NULL , b , c );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
-    }
-    { // kwds
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwds"));
-        arg_ty a;
-        if (
-            (a = kwds_rule(p))  // kwds
-        )
-        {
-            D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwds"));
-            _res = _PyPegen_star_etc ( p , NULL , NULL , a );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwds"));
-    }
-    if (p->call_invalid_rules) { // invalid_star_etc
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_star_etc"));
-        void *invalid_star_etc_var;
-        if (
-            (invalid_star_etc_var = invalid_star_etc_rule(p))  // invalid_star_etc
-        )
-        {
-            D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_star_etc"));
-            _res = invalid_star_etc_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_star_etc"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// kwds: '**' param_no_default
-static arg_ty
-kwds_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    arg_ty _res = NULL;
-    int _mark = p->mark;
-    { // '**' param_no_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' param_no_default"));
-        Token * _literal;
-        arg_ty a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 35))  // token='**'
-            &&
-            (a = param_no_default_rule(p))  // param_no_default
-        )
-        {
-            D(fprintf(stderr, "%*c+ kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' param_no_default"));
-            _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s kwds[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' param_no_default"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// param_no_default: param ',' TYPE_COMMENT? | param TYPE_COMMENT? &')'
-static arg_ty
-param_no_default_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    arg_ty _res = NULL;
-    int _mark = p->mark;
-    { // param ',' TYPE_COMMENT?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?"));
-        Token * _literal;
-        arg_ty a;
-        void *tc;
-        if (
-            (a = param_rule(p))  // param
-            &&
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)  // TYPE_COMMENT?
-        )
-        {
-            D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?"));
-            _res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param ',' TYPE_COMMENT?"));
-    }
-    { // param TYPE_COMMENT? &')'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'"));
-        arg_ty a;
-        void *tc;
-        if (
-            (a = param_rule(p))  // param
-            &&
-            (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)  // TYPE_COMMENT?
-            &&
-            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)  // token=')'
-        )
-        {
-            D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'"));
-            _res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param TYPE_COMMENT? &')'"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// param_with_default: param default ',' TYPE_COMMENT? | param default TYPE_COMMENT? &')'
-static NameDefaultPair*
-param_with_default_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    NameDefaultPair* _res = NULL;
-    int _mark = p->mark;
-    { // param default ',' TYPE_COMMENT?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?"));
-        Token * _literal;
-        arg_ty a;
-        expr_ty c;
-        void *tc;
-        if (
-            (a = param_rule(p))  // param
-            &&
-            (c = default_rule(p))  // default
-            &&
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)  // TYPE_COMMENT?
-        )
-        {
-            D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?"));
-            _res = _PyPegen_name_default_pair ( p , a , c , tc );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default ',' TYPE_COMMENT?"));
-    }
-    { // param default TYPE_COMMENT? &')'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'"));
-        arg_ty a;
-        expr_ty c;
-        void *tc;
-        if (
-            (a = param_rule(p))  // param
-            &&
-            (c = default_rule(p))  // default
-            &&
-            (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)  // TYPE_COMMENT?
-            &&
-            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)  // token=')'
-        )
-        {
-            D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'"));
-            _res = _PyPegen_name_default_pair ( p , a , c , tc );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default TYPE_COMMENT? &')'"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// param_maybe_default:
-//     | param default? ',' TYPE_COMMENT?
-//     | param default? TYPE_COMMENT? &')'
-static NameDefaultPair*
-param_maybe_default_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    NameDefaultPair* _res = NULL;
-    int _mark = p->mark;
-    { // param default? ',' TYPE_COMMENT?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
-        Token * _literal;
-        arg_ty a;
-        void *c;
-        void *tc;
-        if (
-            (a = param_rule(p))  // param
-            &&
-            (c = default_rule(p), 1)  // default?
-            &&
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)  // TYPE_COMMENT?
-        )
-        {
-            D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
-            _res = _PyPegen_name_default_pair ( p , a , c , tc );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
-    }
-    { // param default? TYPE_COMMENT? &')'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
-        arg_ty a;
-        void *c;
-        void *tc;
-        if (
-            (a = param_rule(p))  // param
-            &&
-            (c = default_rule(p), 1)  // default?
-            &&
-            (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)  // TYPE_COMMENT?
-            &&
-            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)  // token=')'
-        )
-        {
-            D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
-            _res = _PyPegen_name_default_pair ( p , a , c , tc );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// param: NAME annotation?
-static arg_ty
-param_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    arg_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // NAME annotation?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME annotation?"));
-        expr_ty a;
-        void *b;
-        if (
-            (a = _PyPegen_name_token(p))  // NAME
-            &&
-            (b = annotation_rule(p), 1)  // annotation?
-        )
-        {
-            D(fprintf(stderr, "%*c+ param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME annotation?"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_arg ( a -> v . Name . id , b , NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s param[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME annotation?"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// annotation: ':' expression
-static expr_ty
-annotation_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    { // ':' expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> annotation[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression"));
-        Token * _literal;
-        expr_ty a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
-            &&
-            (a = expression_rule(p))  // expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression"));
-            _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s annotation[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// default: '=' expression
-static expr_ty
-default_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    { // '=' expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' expression"));
-        Token * _literal;
-        expr_ty a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 22))  // token='='
-            &&
-            (a = expression_rule(p))  // expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' expression"));
-            _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s default[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' expression"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// decorators: (('@' named_expression NEWLINE))+
-static asdl_seq*
-decorators_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq* _res = NULL;
-    int _mark = p->mark;
-    { // (('@' named_expression NEWLINE))+
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> decorators[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+"));
-        asdl_seq * a;
-        if (
-            (a = _loop1_68_rule(p))  // (('@' named_expression NEWLINE))+
-        )
-        {
-            D(fprintf(stderr, "%*c+ decorators[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+"));
-            _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s decorators[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(('@' named_expression NEWLINE))+"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// class_def: decorators class_def_raw | class_def_raw
-static stmt_ty
-class_def_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    stmt_ty _res = NULL;
-    int _mark = p->mark;
-    { // decorators class_def_raw
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw"));
-        asdl_seq* a;
-        stmt_ty b;
-        if (
-            (a = decorators_rule(p))  // decorators
-            &&
-            (b = class_def_raw_rule(p))  // class_def_raw
-        )
-        {
-            D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw"));
-            _res = _PyPegen_class_def_decorators ( p , a , b );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators class_def_raw"));
-    }
-    { // class_def_raw
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "class_def_raw"));
-        stmt_ty class_def_raw_var;
-        if (
-            (class_def_raw_var = class_def_raw_rule(p))  // class_def_raw
-        )
-        {
-            D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "class_def_raw"));
-            _res = class_def_raw_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "class_def_raw"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// class_def_raw: 'class' NAME ['(' arguments? ')'] ':' block
-static stmt_ty
-class_def_raw_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    stmt_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // 'class' NAME ['(' arguments? ')'] ':' block
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> class_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block"));
-        Token * _keyword;
-        Token * _literal;
-        expr_ty a;
-        void *b;
-        asdl_seq* c;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 524))  // token='class'
-            &&
-            (a = _PyPegen_name_token(p))  // NAME
-            &&
-            (b = _tmp_69_rule(p), 1)  // ['(' arguments? ')']
-            &&
-            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
-            &&
-            (c = block_rule(p))  // block
-        )
-        {
-            D(fprintf(stderr, "%*c+ class_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_ClassDef ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , c , NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s class_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// block: NEWLINE INDENT statements DEDENT | simple_stmt | invalid_block
-static asdl_seq*
-block_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq* _res = NULL;
-    if (_PyPegen_is_memoized(p, block_type, &_res)) {
-        D(p->level--);
-        return _res;
-    }
-    int _mark = p->mark;
-    { // NEWLINE INDENT statements DEDENT
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
-        asdl_seq* a;
-        Token * dedent_var;
-        Token * indent_var;
-        Token * newline_var;
-        if (
-            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
-            &&
-            (indent_var = _PyPegen_expect_token(p, INDENT))  // token='INDENT'
-            &&
-            (a = statements_rule(p))  // statements
-            &&
-            (dedent_var = _PyPegen_expect_token(p, DEDENT))  // token='DEDENT'
-        )
-        {
-            D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
-            _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
-    }
-    { // simple_stmt
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
-        asdl_seq* simple_stmt_var;
-        if (
-            (simple_stmt_var = simple_stmt_rule(p))  // simple_stmt
-        )
-        {
-            D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt"));
-            _res = simple_stmt_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt"));
-    }
-    if (p->call_invalid_rules) { // invalid_block
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_block"));
-        void *invalid_block_var;
-        if (
-            (invalid_block_var = invalid_block_rule(p))  // invalid_block
-        )
-        {
-            D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_block"));
-            _res = invalid_block_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_block"));
-    }
-    _res = NULL;
-  done:
-    _PyPegen_insert_memo(p, _mark, block_type, _res);
-    D(p->level--);
-    return _res;
-}
-
-// star_expressions:
-//     | star_expression ((',' star_expression))+ ','?
-//     | star_expression ','
-//     | star_expression
-static expr_ty
-star_expressions_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // star_expression ((',' star_expression))+ ','?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
-        void *_opt_var;
-        UNUSED(_opt_var); // Silence compiler warnings
-        expr_ty a;
-        asdl_seq * b;
-        if (
-            (a = star_expression_rule(p))  // star_expression
-            &&
-            (b = _loop1_70_rule(p))  // ((',' star_expression))+
-            &&
-            (_opt_var = _PyPegen_expect_token(p, 12), 1)  // ','?
-        )
-        {
-            D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ((',' star_expression))+ ','?"));
-    }
-    { // star_expression ','
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression ','"));
-        Token * _literal;
-        expr_ty a;
-        if (
-            (a = star_expression_rule(p))  // star_expression
-            &&
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-        )
-        {
-            D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression ','"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Tuple ( CHECK ( _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ','"));
-    }
-    { // star_expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> star_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expression"));
-        expr_ty star_expression_var;
-        if (
-            (star_expression_var = star_expression_rule(p))  // star_expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ star_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expression"));
-            _res = star_expression_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// star_expression: '*' bitwise_or | expression
-static expr_ty
-star_expression_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    if (_PyPegen_is_memoized(p, star_expression_type, &_res)) {
-        D(p->level--);
-        return _res;
-    }
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // '*' bitwise_or
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
-        Token * _literal;
-        expr_ty a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 16))  // token='*'
-            &&
-            (a = bitwise_or_rule(p))  // bitwise_or
-        )
-        {
-            D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Starred ( a , Load , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or"));
-    }
-    { // expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> star_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
-        expr_ty expression_var;
-        if (
-            (expression_var = expression_rule(p))  // expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ star_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
-            _res = expression_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
-    }
-    _res = NULL;
-  done:
-    _PyPegen_insert_memo(p, _mark, star_expression_type, _res);
-    D(p->level--);
-    return _res;
-}
-
-// star_named_expressions: ','.star_named_expression+ ','?
-static asdl_seq*
-star_named_expressions_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq* _res = NULL;
-    int _mark = p->mark;
-    { // ','.star_named_expression+ ','?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> star_named_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?"));
-        void *_opt_var;
-        UNUSED(_opt_var); // Silence compiler warnings
-        asdl_seq * a;
-        if (
-            (a = _gather_71_rule(p))  // ','.star_named_expression+
-            &&
-            (_opt_var = _PyPegen_expect_token(p, 12), 1)  // ','?
-        )
-        {
-            D(fprintf(stderr, "%*c+ star_named_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?"));
-            _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s star_named_expressions[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_named_expression+ ','?"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// star_named_expression: '*' bitwise_or | named_expression
-static expr_ty
-star_named_expression_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // '*' bitwise_or
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
-        Token * _literal;
-        expr_ty a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 16))  // token='*'
-            &&
-            (a = bitwise_or_rule(p))  // bitwise_or
-        )
-        {
-            D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' bitwise_or"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Starred ( a , Load , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or"));
-    }
-    { // named_expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> star_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression"));
-        expr_ty named_expression_var;
-        if (
-            (named_expression_var = named_expression_rule(p))  // named_expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ star_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression"));
-            _res = named_expression_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// named_expression: NAME ':=' ~ expression | expression !':=' | invalid_named_expression
-static expr_ty
-named_expression_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // NAME ':=' ~ expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME ':=' ~ expression"));
-        int _cut_var = 0;
-        Token * _literal;
-        expr_ty a;
-        expr_ty b;
-        if (
-            (a = _PyPegen_name_token(p))  // NAME
-            &&
-            (_literal = _PyPegen_expect_token(p, 53))  // token=':='
-            &&
-            (_cut_var = 1)
-            &&
-            (b = expression_rule(p))  // expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ':=' ~ expression"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_NamedExpr ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':=' ~ expression"));
-        if (_cut_var) {
-            D(p->level--);
-            return NULL;
-        }
-    }
-    { // expression !':='
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !':='"));
-        expr_ty expression_var;
-        if (
-            (expression_var = expression_rule(p))  // expression
-            &&
-            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53)  // token=':='
-        )
-        {
-            D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression !':='"));
-            _res = expression_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression !':='"));
-    }
-    if (p->call_invalid_rules) { // invalid_named_expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_named_expression"));
-        void *invalid_named_expression_var;
-        if (
-            (invalid_named_expression_var = invalid_named_expression_rule(p))  // invalid_named_expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_named_expression"));
-            _res = invalid_named_expression_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_named_expression"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// annotated_rhs: yield_expr | star_expressions
-static expr_ty
-annotated_rhs_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    { // yield_expr
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
-        expr_ty yield_expr_var;
-        if (
-            (yield_expr_var = yield_expr_rule(p))  // yield_expr
-        )
-        {
-            D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
-            _res = yield_expr_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
-    }
-    { // star_expressions
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
-        expr_ty star_expressions_var;
-        if (
-            (star_expressions_var = star_expressions_rule(p))  // star_expressions
-        )
-        {
-            D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
-            _res = star_expressions_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// expressions: expression ((',' expression))+ ','? | expression ',' | expression
-static expr_ty
-expressions_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // expression ((',' expression))+ ','?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?"));
-        void *_opt_var;
-        UNUSED(_opt_var); // Silence compiler warnings
-        expr_ty a;
-        asdl_seq * b;
-        if (
-            (a = expression_rule(p))  // expression
-            &&
-            (b = _loop1_73_rule(p))  // ((',' expression))+
-            &&
-            (_opt_var = _PyPegen_expect_token(p, 12), 1)  // ','?
-        )
-        {
-            D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ((',' expression))+ ','?"));
-    }
-    { // expression ','
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ','"));
-        Token * _literal;
-        expr_ty a;
-        if (
-            (a = expression_rule(p))  // expression
-            &&
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-        )
-        {
-            D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ','"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Tuple ( CHECK ( _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ','"));
-    }
-    { // expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
-        expr_ty expression_var;
-        if (
-            (expression_var = expression_rule(p))  // expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
-            _res = expression_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// expression: disjunction 'if' disjunction 'else' expression | disjunction | lambdef
-static expr_ty
-expression_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    if (_PyPegen_is_memoized(p, expression_type, &_res)) {
-        D(p->level--);
-        return _res;
-    }
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // disjunction 'if' disjunction 'else' expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
-        Token * _keyword;
-        Token * _keyword_1;
-        expr_ty a;
-        expr_ty b;
-        expr_ty c;
-        if (
-            (a = disjunction_rule(p))  // disjunction
-            &&
-            (_keyword = _PyPegen_expect_token(p, 510))  // token='if'
-            &&
-            (b = disjunction_rule(p))  // disjunction
-            &&
-            (_keyword_1 = _PyPegen_expect_token(p, 516))  // token='else'
-            &&
-            (c = expression_rule(p))  // expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_IfExp ( b , a , c , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
-    }
-    { // disjunction
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction"));
-        expr_ty disjunction_var;
-        if (
-            (disjunction_var = disjunction_rule(p))  // disjunction
-        )
-        {
-            D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction"));
-            _res = disjunction_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction"));
-    }
-    { // lambdef
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambdef"));
-        expr_ty lambdef_var;
-        if (
-            (lambdef_var = lambdef_rule(p))  // lambdef
-        )
-        {
-            D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambdef"));
-            _res = lambdef_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambdef"));
-    }
-    _res = NULL;
-  done:
-    _PyPegen_insert_memo(p, _mark, expression_type, _res);
-    D(p->level--);
-    return _res;
-}
-
-// lambdef: 'lambda' lambda_params? ':' expression
-static expr_ty
-lambdef_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // 'lambda' lambda_params? ':' expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> lambdef[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression"));
-        Token * _keyword;
-        Token * _literal;
-        void *a;
-        expr_ty b;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 525))  // token='lambda'
-            &&
-            (a = lambda_params_rule(p), 1)  // lambda_params?
-            &&
-            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
-            &&
-            (b = expression_rule(p))  // expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ lambdef[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Lambda ( ( a ) ? a : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s lambdef[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'lambda' lambda_params? ':' expression"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// lambda_params: invalid_lambda_parameters | lambda_parameters
-static arguments_ty
-lambda_params_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    arguments_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->call_invalid_rules) { // invalid_lambda_parameters
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_parameters"));
-        void *invalid_lambda_parameters_var;
-        if (
-            (invalid_lambda_parameters_var = invalid_lambda_parameters_rule(p))  // invalid_lambda_parameters
-        )
-        {
-            D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_parameters"));
-            _res = invalid_lambda_parameters_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_parameters"));
-    }
-    { // lambda_parameters
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_parameters"));
-        arguments_ty lambda_parameters_var;
-        if (
-            (lambda_parameters_var = lambda_parameters_rule(p))  // lambda_parameters
-        )
-        {
-            D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_parameters"));
-            _res = lambda_parameters_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_parameters"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// lambda_parameters:
-//     | lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?
-//     | lambda_slash_with_default lambda_param_with_default* lambda_star_etc?
-//     | lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?
-//     | lambda_param_with_default+ lambda_star_etc?
-//     | lambda_star_etc
-static arguments_ty
-lambda_parameters_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    arguments_ty _res = NULL;
-    int _mark = p->mark;
-    { // lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?"));
-        asdl_seq* a;
-        asdl_seq * b;
-        asdl_seq * c;
-        void *d;
-        if (
-            (a = lambda_slash_no_default_rule(p))  // lambda_slash_no_default
-            &&
-            (b = _loop0_74_rule(p))  // lambda_param_no_default*
-            &&
-            (c = _loop0_75_rule(p))  // lambda_param_with_default*
-            &&
-            (d = lambda_star_etc_rule(p), 1)  // lambda_star_etc?
-        )
-        {
-            D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?"));
-            _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?"));
-    }
-    { // lambda_slash_with_default lambda_param_with_default* lambda_star_etc?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?"));
-        SlashWithDefault* a;
-        asdl_seq * b;
-        void *c;
-        if (
-            (a = lambda_slash_with_default_rule(p))  // lambda_slash_with_default
-            &&
-            (b = _loop0_76_rule(p))  // lambda_param_with_default*
-            &&
-            (c = lambda_star_etc_rule(p), 1)  // lambda_star_etc?
-        )
-        {
-            D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?"));
-            _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?"));
-    }
-    { // lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?"));
-        asdl_seq * a;
-        asdl_seq * b;
-        void *c;
-        if (
-            (a = _loop1_77_rule(p))  // lambda_param_no_default+
-            &&
-            (b = _loop0_78_rule(p))  // lambda_param_with_default*
-            &&
-            (c = lambda_star_etc_rule(p), 1)  // lambda_star_etc?
-        )
-        {
-            D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?"));
-            _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?"));
-    }
-    { // lambda_param_with_default+ lambda_star_etc?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
-        asdl_seq * a;
-        void *b;
-        if (
-            (a = _loop1_79_rule(p))  // lambda_param_with_default+
-            &&
-            (b = lambda_star_etc_rule(p), 1)  // lambda_star_etc?
-        )
-        {
-            D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
-            _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
-    }
-    { // lambda_star_etc
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_star_etc"));
-        StarEtc* a;
-        if (
-            (a = lambda_star_etc_rule(p))  // lambda_star_etc
-        )
-        {
-            D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_star_etc"));
-            _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_star_etc"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// lambda_slash_no_default:
-//     | lambda_param_no_default+ '/' ','
-//     | lambda_param_no_default+ '/' &':'
-static asdl_seq*
-lambda_slash_no_default_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq* _res = NULL;
-    int _mark = p->mark;
-    { // lambda_param_no_default+ '/' ','
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','"));
-        Token * _literal;
-        Token * _literal_1;
-        asdl_seq * a;
-        if (
-            (a = _loop1_80_rule(p))  // lambda_param_no_default+
-            &&
-            (_literal = _PyPegen_expect_token(p, 17))  // token='/'
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 12))  // token=','
-        )
-        {
-            D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','"));
-            _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' ','"));
-    }
-    { // lambda_param_no_default+ '/' &':'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
-        Token * _literal;
-        asdl_seq * a;
-        if (
-            (a = _loop1_81_rule(p))  // lambda_param_no_default+
-            &&
-            (_literal = _PyPegen_expect_token(p, 17))  // token='/'
-            &&
-            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11)  // token=':'
-        )
-        {
-            D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
-            _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// lambda_slash_with_default:
-//     | lambda_param_no_default* lambda_param_with_default+ '/' ','
-//     | lambda_param_no_default* lambda_param_with_default+ '/' &':'
-static SlashWithDefault*
-lambda_slash_with_default_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    SlashWithDefault* _res = NULL;
-    int _mark = p->mark;
-    { // lambda_param_no_default* lambda_param_with_default+ '/' ','
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> lambda_slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','"));
-        Token * _literal;
-        Token * _literal_1;
-        asdl_seq * a;
-        asdl_seq * b;
-        if (
-            (a = _loop0_82_rule(p))  // lambda_param_no_default*
-            &&
-            (b = _loop1_83_rule(p))  // lambda_param_with_default+
-            &&
-            (_literal = _PyPegen_expect_token(p, 17))  // token='/'
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 12))  // token=','
-        )
-        {
-            D(fprintf(stderr, "%*c+ lambda_slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','"));
-            _res = _PyPegen_slash_with_default ( p , a , b );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','"));
-    }
-    { // lambda_param_no_default* lambda_param_with_default+ '/' &':'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> lambda_slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'"));
-        Token * _literal;
-        asdl_seq * a;
-        asdl_seq * b;
-        if (
-            (a = _loop0_84_rule(p))  // lambda_param_no_default*
-            &&
-            (b = _loop1_85_rule(p))  // lambda_param_with_default+
-            &&
-            (_literal = _PyPegen_expect_token(p, 17))  // token='/'
-            &&
-            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11)  // token=':'
-        )
-        {
-            D(fprintf(stderr, "%*c+ lambda_slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'"));
-            _res = _PyPegen_slash_with_default ( p , a , b );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// lambda_star_etc:
-//     | '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?
-//     | '*' ',' lambda_param_maybe_default+ lambda_kwds?
-//     | lambda_kwds
-//     | invalid_lambda_star_etc
-static StarEtc*
-lambda_star_etc_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    StarEtc* _res = NULL;
-    int _mark = p->mark;
-    { // '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?"));
-        Token * _literal;
-        arg_ty a;
-        asdl_seq * b;
-        void *c;
-        if (
-            (_literal = _PyPegen_expect_token(p, 16))  // token='*'
-            &&
-            (a = lambda_param_no_default_rule(p))  // lambda_param_no_default
-            &&
-            (b = _loop0_86_rule(p))  // lambda_param_maybe_default*
-            &&
-            (c = lambda_kwds_rule(p), 1)  // lambda_kwds?
-        )
-        {
-            D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?"));
-            _res = _PyPegen_star_etc ( p , a , b , c );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?"));
-    }
-    { // '*' ',' lambda_param_maybe_default+ lambda_kwds?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
-        Token * _literal;
-        Token * _literal_1;
-        asdl_seq * b;
-        void *c;
-        if (
-            (_literal = _PyPegen_expect_token(p, 16))  // token='*'
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (b = _loop1_87_rule(p))  // lambda_param_maybe_default+
-            &&
-            (c = lambda_kwds_rule(p), 1)  // lambda_kwds?
-        )
-        {
-            D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
-            _res = _PyPegen_star_etc ( p , NULL , b , c );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
-    }
-    { // lambda_kwds
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_kwds"));
-        arg_ty a;
-        if (
-            (a = lambda_kwds_rule(p))  // lambda_kwds
-        )
-        {
-            D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_kwds"));
-            _res = _PyPegen_star_etc ( p , NULL , NULL , a );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_kwds"));
-    }
-    if (p->call_invalid_rules) { // invalid_lambda_star_etc
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc"));
-        void *invalid_lambda_star_etc_var;
-        if (
-            (invalid_lambda_star_etc_var = invalid_lambda_star_etc_rule(p))  // invalid_lambda_star_etc
-        )
-        {
-            D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc"));
-            _res = invalid_lambda_star_etc_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_star_etc"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// lambda_kwds: '**' lambda_param_no_default
-static arg_ty
-lambda_kwds_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    arg_ty _res = NULL;
-    int _mark = p->mark;
-    { // '**' lambda_param_no_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> lambda_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default"));
-        Token * _literal;
-        arg_ty a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 35))  // token='**'
-            &&
-            (a = lambda_param_no_default_rule(p))  // lambda_param_no_default
-        )
-        {
-            D(fprintf(stderr, "%*c+ lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default"));
-            _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s lambda_kwds[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' lambda_param_no_default"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// lambda_param_no_default: lambda_param ',' | lambda_param &':'
-static arg_ty
-lambda_param_no_default_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    arg_ty _res = NULL;
-    int _mark = p->mark;
-    { // lambda_param ','
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param ','"));
-        Token * _literal;
-        arg_ty a;
-        if (
-            (a = lambda_param_rule(p))  // lambda_param
-            &&
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-        )
-        {
-            D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param ','"));
-            _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param ','"));
-    }
-    { // lambda_param &':'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param &':'"));
-        arg_ty a;
-        if (
-            (a = lambda_param_rule(p))  // lambda_param
-            &&
-            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11)  // token=':'
-        )
-        {
-            D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param &':'"));
-            _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param &':'"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// lambda_param_with_default: lambda_param default ',' | lambda_param default &':'
-static NameDefaultPair*
-lambda_param_with_default_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    NameDefaultPair* _res = NULL;
-    int _mark = p->mark;
-    { // lambda_param default ','
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default ','"));
-        Token * _literal;
-        arg_ty a;
-        expr_ty c;
-        if (
-            (a = lambda_param_rule(p))  // lambda_param
-            &&
-            (c = default_rule(p))  // default
-            &&
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-        )
-        {
-            D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default ','"));
-            _res = _PyPegen_name_default_pair ( p , a , c , NULL );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default ','"));
-    }
-    { // lambda_param default &':'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'"));
-        arg_ty a;
-        expr_ty c;
-        if (
-            (a = lambda_param_rule(p))  // lambda_param
-            &&
-            (c = default_rule(p))  // default
-            &&
-            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11)  // token=':'
-        )
-        {
-            D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'"));
-            _res = _PyPegen_name_default_pair ( p , a , c , NULL );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default &':'"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// lambda_param_maybe_default: lambda_param default? ',' | lambda_param default? &':'
-static NameDefaultPair*
-lambda_param_maybe_default_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    NameDefaultPair* _res = NULL;
-    int _mark = p->mark;
-    { // lambda_param default? ','
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','"));
-        Token * _literal;
-        arg_ty a;
-        void *c;
-        if (
-            (a = lambda_param_rule(p))  // lambda_param
-            &&
-            (c = default_rule(p), 1)  // default?
-            &&
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-        )
-        {
-            D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','"));
-            _res = _PyPegen_name_default_pair ( p , a , c , NULL );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? ','"));
-    }
-    { // lambda_param default? &':'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'"));
-        arg_ty a;
-        void *c;
-        if (
-            (a = lambda_param_rule(p))  // lambda_param
-            &&
-            (c = default_rule(p), 1)  // default?
-            &&
-            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11)  // token=':'
-        )
-        {
-            D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'"));
-            _res = _PyPegen_name_default_pair ( p , a , c , NULL );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? &':'"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// lambda_param: NAME
-static arg_ty
-lambda_param_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    arg_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // NAME
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> lambda_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
-        expr_ty a;
-        if (
-            (a = _PyPegen_name_token(p))  // NAME
-        )
-        {
-            D(fprintf(stderr, "%*c+ lambda_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_arg ( a -> v . Name . id , NULL , NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s lambda_param[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// disjunction: conjunction (('or' conjunction))+ | conjunction
-static expr_ty
-disjunction_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    if (_PyPegen_is_memoized(p, disjunction_type, &_res)) {
-        D(p->level--);
-        return _res;
-    }
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // conjunction (('or' conjunction))+
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+"));
-        expr_ty a;
-        asdl_seq * b;
-        if (
-            (a = conjunction_rule(p))  // conjunction
-            &&
-            (b = _loop1_88_rule(p))  // (('or' conjunction))+
-        )
-        {
-            D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_BoolOp ( Or , CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction (('or' conjunction))+"));
-    }
-    { // conjunction
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> disjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "conjunction"));
-        expr_ty conjunction_var;
-        if (
-            (conjunction_var = conjunction_rule(p))  // conjunction
-        )
-        {
-            D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction"));
-            _res = conjunction_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction"));
-    }
-    _res = NULL;
-  done:
-    _PyPegen_insert_memo(p, _mark, disjunction_type, _res);
-    D(p->level--);
-    return _res;
-}
-
-// conjunction: inversion (('and' inversion))+ | inversion
-static expr_ty
-conjunction_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    if (_PyPegen_is_memoized(p, conjunction_type, &_res)) {
-        D(p->level--);
-        return _res;
-    }
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // inversion (('and' inversion))+
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+"));
-        expr_ty a;
-        asdl_seq * b;
-        if (
-            (a = inversion_rule(p))  // inversion
-            &&
-            (b = _loop1_89_rule(p))  // (('and' inversion))+
-        )
-        {
-            D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_BoolOp ( And , CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion (('and' inversion))+"));
-    }
-    { // inversion
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> conjunction[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "inversion"));
-        expr_ty inversion_var;
-        if (
-            (inversion_var = inversion_rule(p))  // inversion
-        )
-        {
-            D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion"));
-            _res = inversion_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion"));
-    }
-    _res = NULL;
-  done:
-    _PyPegen_insert_memo(p, _mark, conjunction_type, _res);
-    D(p->level--);
-    return _res;
-}
-
-// inversion: 'not' inversion | comparison
-static expr_ty
-inversion_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    if (_PyPegen_is_memoized(p, inversion_type, &_res)) {
-        D(p->level--);
-        return _res;
-    }
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // 'not' inversion
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' inversion"));
-        Token * _keyword;
-        expr_ty a;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 526))  // token='not'
-            &&
-            (a = inversion_rule(p))  // inversion
-        )
-        {
-            D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' inversion"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_UnaryOp ( Not , a , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' inversion"));
-    }
-    { // comparison
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> inversion[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "comparison"));
-        expr_ty comparison_var;
-        if (
-            (comparison_var = comparison_rule(p))  // comparison
-        )
-        {
-            D(fprintf(stderr, "%*c+ inversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "comparison"));
-            _res = comparison_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "comparison"));
-    }
-    _res = NULL;
-  done:
-    _PyPegen_insert_memo(p, _mark, inversion_type, _res);
-    D(p->level--);
-    return _res;
-}
-
-// comparison: bitwise_or compare_op_bitwise_or_pair+ | bitwise_or
-static expr_ty
-comparison_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // bitwise_or compare_op_bitwise_or_pair+
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
-        expr_ty a;
-        asdl_seq * b;
-        if (
-            (a = bitwise_or_rule(p))  // bitwise_or
-            &&
-            (b = _loop1_90_rule(p))  // compare_op_bitwise_or_pair+
-        )
-        {
-            D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Compare ( a , CHECK ( _PyPegen_get_cmpops ( p , b ) ) , CHECK ( _PyPegen_get_exprs ( p , b ) ) , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
-    }
-    { // bitwise_or
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> comparison[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or"));
-        expr_ty bitwise_or_var;
-        if (
-            (bitwise_or_var = bitwise_or_rule(p))  // bitwise_or
-        )
-        {
-            D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or"));
-            _res = bitwise_or_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// compare_op_bitwise_or_pair:
-//     | eq_bitwise_or
-//     | noteq_bitwise_or
-//     | lte_bitwise_or
-//     | lt_bitwise_or
-//     | gte_bitwise_or
-//     | gt_bitwise_or
-//     | notin_bitwise_or
-//     | in_bitwise_or
-//     | isnot_bitwise_or
-//     | is_bitwise_or
-static CmpopExprPair*
-compare_op_bitwise_or_pair_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    CmpopExprPair* _res = NULL;
-    int _mark = p->mark;
-    { // eq_bitwise_or
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "eq_bitwise_or"));
-        CmpopExprPair* eq_bitwise_or_var;
-        if (
-            (eq_bitwise_or_var = eq_bitwise_or_rule(p))  // eq_bitwise_or
-        )
-        {
-            D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "eq_bitwise_or"));
-            _res = eq_bitwise_or_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "eq_bitwise_or"));
-    }
-    { // noteq_bitwise_or
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "noteq_bitwise_or"));
-        CmpopExprPair* noteq_bitwise_or_var;
-        if (
-            (noteq_bitwise_or_var = noteq_bitwise_or_rule(p))  // noteq_bitwise_or
-        )
-        {
-            D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "noteq_bitwise_or"));
-            _res = noteq_bitwise_or_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "noteq_bitwise_or"));
-    }
-    { // lte_bitwise_or
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lte_bitwise_or"));
-        CmpopExprPair* lte_bitwise_or_var;
-        if (
-            (lte_bitwise_or_var = lte_bitwise_or_rule(p))  // lte_bitwise_or
-        )
-        {
-            D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lte_bitwise_or"));
-            _res = lte_bitwise_or_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lte_bitwise_or"));
-    }
-    { // lt_bitwise_or
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lt_bitwise_or"));
-        CmpopExprPair* lt_bitwise_or_var;
-        if (
-            (lt_bitwise_or_var = lt_bitwise_or_rule(p))  // lt_bitwise_or
-        )
-        {
-            D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lt_bitwise_or"));
-            _res = lt_bitwise_or_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lt_bitwise_or"));
-    }
-    { // gte_bitwise_or
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "gte_bitwise_or"));
-        CmpopExprPair* gte_bitwise_or_var;
-        if (
-            (gte_bitwise_or_var = gte_bitwise_or_rule(p))  // gte_bitwise_or
-        )
-        {
-            D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gte_bitwise_or"));
-            _res = gte_bitwise_or_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gte_bitwise_or"));
-    }
-    { // gt_bitwise_or
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "gt_bitwise_or"));
-        CmpopExprPair* gt_bitwise_or_var;
-        if (
-            (gt_bitwise_or_var = gt_bitwise_or_rule(p))  // gt_bitwise_or
-        )
-        {
-            D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "gt_bitwise_or"));
-            _res = gt_bitwise_or_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gt_bitwise_or"));
-    }
-    { // notin_bitwise_or
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "notin_bitwise_or"));
-        CmpopExprPair* notin_bitwise_or_var;
-        if (
-            (notin_bitwise_or_var = notin_bitwise_or_rule(p))  // notin_bitwise_or
-        )
-        {
-            D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "notin_bitwise_or"));
-            _res = notin_bitwise_or_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "notin_bitwise_or"));
-    }
-    { // in_bitwise_or
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "in_bitwise_or"));
-        CmpopExprPair* in_bitwise_or_var;
-        if (
-            (in_bitwise_or_var = in_bitwise_or_rule(p))  // in_bitwise_or
-        )
-        {
-            D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "in_bitwise_or"));
-            _res = in_bitwise_or_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "in_bitwise_or"));
-    }
-    { // isnot_bitwise_or
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "isnot_bitwise_or"));
-        CmpopExprPair* isnot_bitwise_or_var;
-        if (
-            (isnot_bitwise_or_var = isnot_bitwise_or_rule(p))  // isnot_bitwise_or
-        )
-        {
-            D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "isnot_bitwise_or"));
-            _res = isnot_bitwise_or_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "isnot_bitwise_or"));
-    }
-    { // is_bitwise_or
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> compare_op_bitwise_or_pair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "is_bitwise_or"));
-        CmpopExprPair* is_bitwise_or_var;
-        if (
-            (is_bitwise_or_var = is_bitwise_or_rule(p))  // is_bitwise_or
-        )
-        {
-            D(fprintf(stderr, "%*c+ compare_op_bitwise_or_pair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "is_bitwise_or"));
-            _res = is_bitwise_or_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "is_bitwise_or"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// eq_bitwise_or: '==' bitwise_or
-static CmpopExprPair*
-eq_bitwise_or_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    CmpopExprPair* _res = NULL;
-    int _mark = p->mark;
-    { // '==' bitwise_or
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> eq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or"));
-        Token * _literal;
-        expr_ty a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 27))  // token='=='
-            &&
-            (a = bitwise_or_rule(p))  // bitwise_or
-        )
-        {
-            D(fprintf(stderr, "%*c+ eq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or"));
-            _res = _PyPegen_cmpop_expr_pair ( p , Eq , a );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s eq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'==' bitwise_or"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// noteq_bitwise_or: ('!=') bitwise_or
-static CmpopExprPair*
-noteq_bitwise_or_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    CmpopExprPair* _res = NULL;
-    int _mark = p->mark;
-    { // ('!=') bitwise_or
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> noteq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or"));
-        void *_tmp_91_var;
-        expr_ty a;
-        if (
-            (_tmp_91_var = _tmp_91_rule(p))  // '!='
-            &&
-            (a = bitwise_or_rule(p))  // bitwise_or
-        )
-        {
-            D(fprintf(stderr, "%*c+ noteq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or"));
-            _res = _PyPegen_cmpop_expr_pair ( p , NotEq , a );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s noteq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('!=') bitwise_or"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// lte_bitwise_or: '<=' bitwise_or
-static CmpopExprPair*
-lte_bitwise_or_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    CmpopExprPair* _res = NULL;
-    int _mark = p->mark;
-    { // '<=' bitwise_or
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> lte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or"));
-        Token * _literal;
-        expr_ty a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 29))  // token='<='
-            &&
-            (a = bitwise_or_rule(p))  // bitwise_or
-        )
-        {
-            D(fprintf(stderr, "%*c+ lte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or"));
-            _res = _PyPegen_cmpop_expr_pair ( p , LtE , a );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s lte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<=' bitwise_or"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// lt_bitwise_or: '<' bitwise_or
-static CmpopExprPair*
-lt_bitwise_or_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    CmpopExprPair* _res = NULL;
-    int _mark = p->mark;
-    { // '<' bitwise_or
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> lt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or"));
-        Token * _literal;
-        expr_ty a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 20))  // token='<'
-            &&
-            (a = bitwise_or_rule(p))  // bitwise_or
-        )
-        {
-            D(fprintf(stderr, "%*c+ lt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or"));
-            _res = _PyPegen_cmpop_expr_pair ( p , Lt , a );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s lt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<' bitwise_or"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// gte_bitwise_or: '>=' bitwise_or
-static CmpopExprPair*
-gte_bitwise_or_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    CmpopExprPair* _res = NULL;
-    int _mark = p->mark;
-    { // '>=' bitwise_or
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> gte_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or"));
-        Token * _literal;
-        expr_ty a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 30))  // token='>='
-            &&
-            (a = bitwise_or_rule(p))  // bitwise_or
-        )
-        {
-            D(fprintf(stderr, "%*c+ gte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or"));
-            _res = _PyPegen_cmpop_expr_pair ( p , GtE , a );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s gte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>=' bitwise_or"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// gt_bitwise_or: '>' bitwise_or
-static CmpopExprPair*
-gt_bitwise_or_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    CmpopExprPair* _res = NULL;
-    int _mark = p->mark;
-    { // '>' bitwise_or
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> gt_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or"));
-        Token * _literal;
-        expr_ty a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 21))  // token='>'
-            &&
-            (a = bitwise_or_rule(p))  // bitwise_or
-        )
-        {
-            D(fprintf(stderr, "%*c+ gt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or"));
-            _res = _PyPegen_cmpop_expr_pair ( p , Gt , a );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s gt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>' bitwise_or"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// notin_bitwise_or: 'not' 'in' bitwise_or
-static CmpopExprPair*
-notin_bitwise_or_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    CmpopExprPair* _res = NULL;
-    int _mark = p->mark;
-    { // 'not' 'in' bitwise_or
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> notin_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or"));
-        Token * _keyword;
-        Token * _keyword_1;
-        expr_ty a;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 526))  // token='not'
-            &&
-            (_keyword_1 = _PyPegen_expect_token(p, 518))  // token='in'
-            &&
-            (a = bitwise_or_rule(p))  // bitwise_or
-        )
-        {
-            D(fprintf(stderr, "%*c+ notin_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or"));
-            _res = _PyPegen_cmpop_expr_pair ( p , NotIn , a );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s notin_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' 'in' bitwise_or"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// in_bitwise_or: 'in' bitwise_or
-static CmpopExprPair*
-in_bitwise_or_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    CmpopExprPair* _res = NULL;
-    int _mark = p->mark;
-    { // 'in' bitwise_or
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> in_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or"));
-        Token * _keyword;
-        expr_ty a;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 518))  // token='in'
-            &&
-            (a = bitwise_or_rule(p))  // bitwise_or
-        )
-        {
-            D(fprintf(stderr, "%*c+ in_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or"));
-            _res = _PyPegen_cmpop_expr_pair ( p , In , a );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s in_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'in' bitwise_or"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// isnot_bitwise_or: 'is' 'not' bitwise_or
-static CmpopExprPair*
-isnot_bitwise_or_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    CmpopExprPair* _res = NULL;
-    int _mark = p->mark;
-    { // 'is' 'not' bitwise_or
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> isnot_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or"));
-        Token * _keyword;
-        Token * _keyword_1;
-        expr_ty a;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 527))  // token='is'
-            &&
-            (_keyword_1 = _PyPegen_expect_token(p, 526))  // token='not'
-            &&
-            (a = bitwise_or_rule(p))  // bitwise_or
-        )
-        {
-            D(fprintf(stderr, "%*c+ isnot_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or"));
-            _res = _PyPegen_cmpop_expr_pair ( p , IsNot , a );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s isnot_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' 'not' bitwise_or"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// is_bitwise_or: 'is' bitwise_or
-static CmpopExprPair*
-is_bitwise_or_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    CmpopExprPair* _res = NULL;
-    int _mark = p->mark;
-    { // 'is' bitwise_or
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> is_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or"));
-        Token * _keyword;
-        expr_ty a;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 527))  // token='is'
-            &&
-            (a = bitwise_or_rule(p))  // bitwise_or
-        )
-        {
-            D(fprintf(stderr, "%*c+ is_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or"));
-            _res = _PyPegen_cmpop_expr_pair ( p , Is , a );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s is_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' bitwise_or"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// Left-recursive
-// bitwise_or: bitwise_or '|' bitwise_xor | bitwise_xor
-static expr_ty bitwise_or_raw(Parser *);
-static expr_ty
-bitwise_or_rule(Parser *p)
-{
-    D(p->level++);
-    expr_ty _res = NULL;
-    if (_PyPegen_is_memoized(p, bitwise_or_type, &_res)) {
-        D(p->level--);
-        return _res;
-    }
-    int _mark = p->mark;
-    int _resmark = p->mark;
-    while (1) {
-        int tmpvar_1 = _PyPegen_update_memo(p, _mark, bitwise_or_type, _res);
-        if (tmpvar_1) {
-            D(p->level--);
-            return _res;
-        }
-        p->mark = _mark;
-        void *_raw = bitwise_or_raw(p);
-        if (p->error_indicator)
-            return NULL;
-        if (_raw == NULL || p->mark <= _resmark)
-            break;
-        _resmark = p->mark;
-        _res = _raw;
-    }
-    p->mark = _resmark;
-    D(p->level--);
-    return _res;
-}
-static expr_ty
-bitwise_or_raw(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // bitwise_or '|' bitwise_xor
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor"));
-        Token * _literal;
-        expr_ty a;
-        expr_ty b;
-        if (
-            (a = bitwise_or_rule(p))  // bitwise_or
-            &&
-            (_literal = _PyPegen_expect_token(p, 18))  // token='|'
-            &&
-            (b = bitwise_xor_rule(p))  // bitwise_xor
-        )
-        {
-            D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or '|' bitwise_xor"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_BinOp ( a , BitOr , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or '|' bitwise_xor"));
-    }
-    { // bitwise_xor
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor"));
-        expr_ty bitwise_xor_var;
-        if (
-            (bitwise_xor_var = bitwise_xor_rule(p))  // bitwise_xor
-        )
-        {
-            D(fprintf(stderr, "%*c+ bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor"));
-            _res = bitwise_xor_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// Left-recursive
-// bitwise_xor: bitwise_xor '^' bitwise_and | bitwise_and
-static expr_ty bitwise_xor_raw(Parser *);
-static expr_ty
-bitwise_xor_rule(Parser *p)
-{
-    D(p->level++);
-    expr_ty _res = NULL;
-    if (_PyPegen_is_memoized(p, bitwise_xor_type, &_res)) {
-        D(p->level--);
-        return _res;
-    }
-    int _mark = p->mark;
-    int _resmark = p->mark;
-    while (1) {
-        int tmpvar_2 = _PyPegen_update_memo(p, _mark, bitwise_xor_type, _res);
-        if (tmpvar_2) {
-            D(p->level--);
-            return _res;
-        }
-        p->mark = _mark;
-        void *_raw = bitwise_xor_raw(p);
-        if (p->error_indicator)
-            return NULL;
-        if (_raw == NULL || p->mark <= _resmark)
-            break;
-        _resmark = p->mark;
-        _res = _raw;
-    }
-    p->mark = _resmark;
-    D(p->level--);
-    return _res;
-}
-static expr_ty
-bitwise_xor_raw(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // bitwise_xor '^' bitwise_and
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and"));
-        Token * _literal;
-        expr_ty a;
-        expr_ty b;
-        if (
-            (a = bitwise_xor_rule(p))  // bitwise_xor
-            &&
-            (_literal = _PyPegen_expect_token(p, 32))  // token='^'
-            &&
-            (b = bitwise_and_rule(p))  // bitwise_and
-        )
-        {
-            D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_xor '^' bitwise_and"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_BinOp ( a , BitXor , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor '^' bitwise_and"));
-    }
-    { // bitwise_and
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> bitwise_xor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and"));
-        expr_ty bitwise_and_var;
-        if (
-            (bitwise_and_var = bitwise_and_rule(p))  // bitwise_and
-        )
-        {
-            D(fprintf(stderr, "%*c+ bitwise_xor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and"));
-            _res = bitwise_and_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// Left-recursive
-// bitwise_and: bitwise_and '&' shift_expr | shift_expr
-static expr_ty bitwise_and_raw(Parser *);
-static expr_ty
-bitwise_and_rule(Parser *p)
-{
-    D(p->level++);
-    expr_ty _res = NULL;
-    if (_PyPegen_is_memoized(p, bitwise_and_type, &_res)) {
-        D(p->level--);
-        return _res;
-    }
-    int _mark = p->mark;
-    int _resmark = p->mark;
-    while (1) {
-        int tmpvar_3 = _PyPegen_update_memo(p, _mark, bitwise_and_type, _res);
-        if (tmpvar_3) {
-            D(p->level--);
-            return _res;
-        }
-        p->mark = _mark;
-        void *_raw = bitwise_and_raw(p);
-        if (p->error_indicator)
-            return NULL;
-        if (_raw == NULL || p->mark <= _resmark)
-            break;
-        _resmark = p->mark;
-        _res = _raw;
-    }
-    p->mark = _resmark;
-    D(p->level--);
-    return _res;
-}
-static expr_ty
-bitwise_and_raw(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // bitwise_and '&' shift_expr
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr"));
-        Token * _literal;
-        expr_ty a;
-        expr_ty b;
-        if (
-            (a = bitwise_and_rule(p))  // bitwise_and
-            &&
-            (_literal = _PyPegen_expect_token(p, 19))  // token='&'
-            &&
-            (b = shift_expr_rule(p))  // shift_expr
-        )
-        {
-            D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_and '&' shift_expr"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_BinOp ( a , BitAnd , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and '&' shift_expr"));
-    }
-    { // shift_expr
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> bitwise_and[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr"));
-        expr_ty shift_expr_var;
-        if (
-            (shift_expr_var = shift_expr_rule(p))  // shift_expr
-        )
-        {
-            D(fprintf(stderr, "%*c+ bitwise_and[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr"));
-            _res = shift_expr_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// Left-recursive
-// shift_expr: shift_expr '<<' sum | shift_expr '>>' sum | sum
-static expr_ty shift_expr_raw(Parser *);
-static expr_ty
-shift_expr_rule(Parser *p)
-{
-    D(p->level++);
-    expr_ty _res = NULL;
-    if (_PyPegen_is_memoized(p, shift_expr_type, &_res)) {
-        D(p->level--);
-        return _res;
-    }
-    int _mark = p->mark;
-    int _resmark = p->mark;
-    while (1) {
-        int tmpvar_4 = _PyPegen_update_memo(p, _mark, shift_expr_type, _res);
-        if (tmpvar_4) {
-            D(p->level--);
-            return _res;
-        }
-        p->mark = _mark;
-        void *_raw = shift_expr_raw(p);
-        if (p->error_indicator)
-            return NULL;
-        if (_raw == NULL || p->mark <= _resmark)
-            break;
-        _resmark = p->mark;
-        _res = _raw;
-    }
-    p->mark = _resmark;
-    D(p->level--);
-    return _res;
-}
-static expr_ty
-shift_expr_raw(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // shift_expr '<<' sum
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum"));
-        Token * _literal;
-        expr_ty a;
-        expr_ty b;
-        if (
-            (a = shift_expr_rule(p))  // shift_expr
-            &&
-            (_literal = _PyPegen_expect_token(p, 33))  // token='<<'
-            &&
-            (b = sum_rule(p))  // sum
-        )
-        {
-            D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '<<' sum"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_BinOp ( a , LShift , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '<<' sum"));
-    }
-    { // shift_expr '>>' sum
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum"));
-        Token * _literal;
-        expr_ty a;
-        expr_ty b;
-        if (
-            (a = shift_expr_rule(p))  // shift_expr
-            &&
-            (_literal = _PyPegen_expect_token(p, 34))  // token='>>'
-            &&
-            (b = sum_rule(p))  // sum
-        )
-        {
-            D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "shift_expr '>>' sum"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_BinOp ( a , RShift , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '>>' sum"));
-    }
-    { // sum
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> shift_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum"));
-        expr_ty sum_var;
-        if (
-            (sum_var = sum_rule(p))  // sum
-        )
-        {
-            D(fprintf(stderr, "%*c+ shift_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum"));
-            _res = sum_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// Left-recursive
-// sum: sum '+' term | sum '-' term | term
-static expr_ty sum_raw(Parser *);
-static expr_ty
-sum_rule(Parser *p)
-{
-    D(p->level++);
-    expr_ty _res = NULL;
-    if (_PyPegen_is_memoized(p, sum_type, &_res)) {
-        D(p->level--);
-        return _res;
-    }
-    int _mark = p->mark;
-    int _resmark = p->mark;
-    while (1) {
-        int tmpvar_5 = _PyPegen_update_memo(p, _mark, sum_type, _res);
-        if (tmpvar_5) {
-            D(p->level--);
-            return _res;
-        }
-        p->mark = _mark;
-        void *_raw = sum_raw(p);
-        if (p->error_indicator)
-            return NULL;
-        if (_raw == NULL || p->mark <= _resmark)
-            break;
-        _resmark = p->mark;
-        _res = _raw;
-    }
-    p->mark = _resmark;
-    D(p->level--);
-    return _res;
-}
-static expr_ty
-sum_raw(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // sum '+' term
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '+' term"));
-        Token * _literal;
-        expr_ty a;
-        expr_ty b;
-        if (
-            (a = sum_rule(p))  // sum
-            &&
-            (_literal = _PyPegen_expect_token(p, 14))  // token='+'
-            &&
-            (b = term_rule(p))  // term
-        )
-        {
-            D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '+' term"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_BinOp ( a , Add , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '+' term"));
-    }
-    { // sum '-' term
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "sum '-' term"));
-        Token * _literal;
-        expr_ty a;
-        expr_ty b;
-        if (
-            (a = sum_rule(p))  // sum
-            &&
-            (_literal = _PyPegen_expect_token(p, 15))  // token='-'
-            &&
-            (b = term_rule(p))  // term
-        )
-        {
-            D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum '-' term"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_BinOp ( a , Sub , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '-' term"));
-    }
-    { // term
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> sum[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term"));
-        expr_ty term_var;
-        if (
-            (term_var = term_rule(p))  // term
-        )
-        {
-            D(fprintf(stderr, "%*c+ sum[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term"));
-            _res = term_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// Left-recursive
-// term:
-//     | term '*' factor
-//     | term '/' factor
-//     | term '//' factor
-//     | term '%' factor
-//     | term '@' factor
-//     | factor
-static expr_ty term_raw(Parser *);
-static expr_ty
-term_rule(Parser *p)
-{
-    D(p->level++);
-    expr_ty _res = NULL;
-    if (_PyPegen_is_memoized(p, term_type, &_res)) {
-        D(p->level--);
-        return _res;
-    }
-    int _mark = p->mark;
-    int _resmark = p->mark;
-    while (1) {
-        int tmpvar_6 = _PyPegen_update_memo(p, _mark, term_type, _res);
-        if (tmpvar_6) {
-            D(p->level--);
-            return _res;
-        }
-        p->mark = _mark;
-        void *_raw = term_raw(p);
-        if (p->error_indicator)
-            return NULL;
-        if (_raw == NULL || p->mark <= _resmark)
-            break;
-        _resmark = p->mark;
-        _res = _raw;
-    }
-    p->mark = _resmark;
-    D(p->level--);
-    return _res;
-}
-static expr_ty
-term_raw(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // term '*' factor
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '*' factor"));
-        Token * _literal;
-        expr_ty a;
-        expr_ty b;
-        if (
-            (a = term_rule(p))  // term
-            &&
-            (_literal = _PyPegen_expect_token(p, 16))  // token='*'
-            &&
-            (b = factor_rule(p))  // factor
-        )
-        {
-            D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '*' factor"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_BinOp ( a , Mult , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '*' factor"));
-    }
-    { // term '/' factor
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '/' factor"));
-        Token * _literal;
-        expr_ty a;
-        expr_ty b;
-        if (
-            (a = term_rule(p))  // term
-            &&
-            (_literal = _PyPegen_expect_token(p, 17))  // token='/'
-            &&
-            (b = factor_rule(p))  // factor
-        )
-        {
-            D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '/' factor"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_BinOp ( a , Div , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '/' factor"));
-    }
-    { // term '//' factor
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '//' factor"));
-        Token * _literal;
-        expr_ty a;
-        expr_ty b;
-        if (
-            (a = term_rule(p))  // term
-            &&
-            (_literal = _PyPegen_expect_token(p, 47))  // token='//'
-            &&
-            (b = factor_rule(p))  // factor
-        )
-        {
-            D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '//' factor"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_BinOp ( a , FloorDiv , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '//' factor"));
-    }
-    { // term '%' factor
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '%' factor"));
-        Token * _literal;
-        expr_ty a;
-        expr_ty b;
-        if (
-            (a = term_rule(p))  // term
-            &&
-            (_literal = _PyPegen_expect_token(p, 24))  // token='%'
-            &&
-            (b = factor_rule(p))  // factor
-        )
-        {
-            D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '%' factor"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_BinOp ( a , Mod , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '%' factor"));
-    }
-    { // term '@' factor
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "term '@' factor"));
-        Token * _literal;
-        expr_ty a;
-        expr_ty b;
-        if (
-            (a = term_rule(p))  // term
-            &&
-            (_literal = _PyPegen_expect_token(p, 49))  // token='@'
-            &&
-            (b = factor_rule(p))  // factor
-        )
-        {
-            D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "term '@' factor"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = CHECK_VERSION ( 5 , "The '@' operator is" , _Py_BinOp ( a , MatMult , b , EXTRA ) );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '@' factor"));
-    }
-    { // factor
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> term[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "factor"));
-        expr_ty factor_var;
-        if (
-            (factor_var = factor_rule(p))  // factor
-        )
-        {
-            D(fprintf(stderr, "%*c+ term[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "factor"));
-            _res = factor_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "factor"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// factor: '+' factor | '-' factor | '~' factor | power
-static expr_ty
-factor_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    if (_PyPegen_is_memoized(p, factor_type, &_res)) {
-        D(p->level--);
-        return _res;
-    }
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // '+' factor
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+' factor"));
-        Token * _literal;
-        expr_ty a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 14))  // token='+'
-            &&
-            (a = factor_rule(p))  // factor
-        )
-        {
-            D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+' factor"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_UnaryOp ( UAdd , a , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+' factor"));
-    }
-    { // '-' factor
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-' factor"));
-        Token * _literal;
-        expr_ty a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 15))  // token='-'
-            &&
-            (a = factor_rule(p))  // factor
-        )
-        {
-            D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-' factor"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_UnaryOp ( USub , a , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-' factor"));
-    }
-    { // '~' factor
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'~' factor"));
-        Token * _literal;
-        expr_ty a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 31))  // token='~'
-            &&
-            (a = factor_rule(p))  // factor
-        )
-        {
-            D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'~' factor"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_UnaryOp ( Invert , a , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'~' factor"));
-    }
-    { // power
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> factor[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "power"));
-        expr_ty power_var;
-        if (
-            (power_var = power_rule(p))  // power
-        )
-        {
-            D(fprintf(stderr, "%*c+ factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "power"));
-            _res = power_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "power"));
-    }
-    _res = NULL;
-  done:
-    _PyPegen_insert_memo(p, _mark, factor_type, _res);
-    D(p->level--);
-    return _res;
-}
-
-// power: await_primary '**' factor | await_primary
-static expr_ty
-power_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // await_primary '**' factor
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor"));
-        Token * _literal;
-        expr_ty a;
-        expr_ty b;
-        if (
-            (a = await_primary_rule(p))  // await_primary
-            &&
-            (_literal = _PyPegen_expect_token(p, 35))  // token='**'
-            &&
-            (b = factor_rule(p))  // factor
-        )
-        {
-            D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary '**' factor"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_BinOp ( a , Pow , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary '**' factor"));
-    }
-    { // await_primary
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> power[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "await_primary"));
-        expr_ty await_primary_var;
-        if (
-            (await_primary_var = await_primary_rule(p))  // await_primary
-        )
-        {
-            D(fprintf(stderr, "%*c+ power[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "await_primary"));
-            _res = await_primary_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// await_primary: AWAIT primary | primary
-static expr_ty
-await_primary_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    if (_PyPegen_is_memoized(p, await_primary_type, &_res)) {
-        D(p->level--);
-        return _res;
-    }
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // AWAIT primary
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "AWAIT primary"));
-        expr_ty a;
-        Token * await_var;
-        if (
-            (await_var = _PyPegen_expect_token(p, AWAIT))  // token='AWAIT'
-            &&
-            (a = primary_rule(p))  // primary
-        )
-        {
-            D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "AWAIT primary"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = CHECK_VERSION ( 5 , "Await expressions are" , _Py_Await ( a , EXTRA ) );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "AWAIT primary"));
-    }
-    { // primary
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> await_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary"));
-        expr_ty primary_var;
-        if (
-            (primary_var = primary_rule(p))  // primary
-        )
-        {
-            D(fprintf(stderr, "%*c+ await_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary"));
-            _res = primary_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary"));
-    }
-    _res = NULL;
-  done:
-    _PyPegen_insert_memo(p, _mark, await_primary_type, _res);
-    D(p->level--);
-    return _res;
-}
-
-// Left-recursive
-// primary:
-//     | invalid_primary
-//     | primary '.' NAME
-//     | primary genexp
-//     | primary '(' arguments? ')'
-//     | primary '[' slices ']'
-//     | atom
-static expr_ty primary_raw(Parser *);
-static expr_ty
-primary_rule(Parser *p)
-{
-    D(p->level++);
-    expr_ty _res = NULL;
-    if (_PyPegen_is_memoized(p, primary_type, &_res)) {
-        D(p->level--);
-        return _res;
-    }
-    int _mark = p->mark;
-    int _resmark = p->mark;
-    while (1) {
-        int tmpvar_7 = _PyPegen_update_memo(p, _mark, primary_type, _res);
-        if (tmpvar_7) {
-            D(p->level--);
-            return _res;
-        }
-        p->mark = _mark;
-        void *_raw = primary_raw(p);
-        if (p->error_indicator)
-            return NULL;
-        if (_raw == NULL || p->mark <= _resmark)
-            break;
-        _resmark = p->mark;
-        _res = _raw;
-    }
-    p->mark = _resmark;
-    D(p->level--);
-    return _res;
-}
-static expr_ty
-primary_raw(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    if (p->call_invalid_rules) { // invalid_primary
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_primary"));
-        void *invalid_primary_var;
-        if (
-            (invalid_primary_var = invalid_primary_rule(p))  // invalid_primary
-        )
-        {
-            D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_primary"));
-            _res = invalid_primary_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_primary"));
-    }
-    { // primary '.' NAME
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '.' NAME"));
-        Token * _literal;
-        expr_ty a;
-        expr_ty b;
-        if (
-            (a = primary_rule(p))  // primary
-            &&
-            (_literal = _PyPegen_expect_token(p, 23))  // token='.'
-            &&
-            (b = _PyPegen_name_token(p))  // NAME
-        )
-        {
-            D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '.' NAME"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '.' NAME"));
-    }
-    { // primary genexp
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary genexp"));
-        expr_ty a;
-        expr_ty b;
-        if (
-            (a = primary_rule(p))  // primary
-            &&
-            (b = genexp_rule(p))  // genexp
-        )
-        {
-            D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary genexp"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Call ( a , CHECK ( _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary genexp"));
-    }
-    { // primary '(' arguments? ')'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'"));
-        Token * _literal;
-        Token * _literal_1;
-        expr_ty a;
-        void *b;
-        if (
-            (a = primary_rule(p))  // primary
-            &&
-            (_literal = _PyPegen_expect_token(p, 7))  // token='('
-            &&
-            (b = arguments_rule(p), 1)  // arguments?
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
-        )
-        {
-            D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '(' arguments? ')'"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '(' arguments? ')'"));
-    }
-    { // primary '[' slices ']'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'"));
-        Token * _literal;
-        Token * _literal_1;
-        expr_ty a;
-        expr_ty b;
-        if (
-            (a = primary_rule(p))  // primary
-            &&
-            (_literal = _PyPegen_expect_token(p, 9))  // token='['
-            &&
-            (b = slices_rule(p))  // slices
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 10))  // token=']'
-        )
-        {
-            D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '[' slices ']'"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Subscript ( a , b , Load , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '[' slices ']'"));
-    }
-    { // atom
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom"));
-        expr_ty atom_var;
-        if (
-            (atom_var = atom_rule(p))  // atom
-        )
-        {
-            D(fprintf(stderr, "%*c+ primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom"));
-            _res = atom_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// slices: slice !',' | ','.slice+ ','?
-static expr_ty
-slices_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // slice !','
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice !','"));
-        expr_ty a;
-        if (
-            (a = slice_rule(p))  // slice
-            &&
-            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12)  // token=','
-        )
-        {
-            D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice !','"));
-            _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice !','"));
-    }
-    { // ','.slice+ ','?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> slices[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.slice+ ','?"));
-        void *_opt_var;
-        UNUSED(_opt_var); // Silence compiler warnings
-        asdl_seq * a;
-        if (
-            (a = _gather_92_rule(p))  // ','.slice+
-            &&
-            (_opt_var = _PyPegen_expect_token(p, 12), 1)  // ','?
-        )
-        {
-            D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.slice+ ','?"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Tuple ( a , Load , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.slice+ ','?"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// slice: expression? ':' expression? [':' expression?] | expression
-static expr_ty
-slice_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // expression? ':' expression? [':' expression?]
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]"));
-        Token * _literal;
-        void *a;
-        void *b;
-        void *c;
-        if (
-            (a = expression_rule(p), 1)  // expression?
-            &&
-            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
-            &&
-            (b = expression_rule(p), 1)  // expression?
-            &&
-            (c = _tmp_94_rule(p), 1)  // [':' expression?]
-        )
-        {
-            D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Slice ( a , b , c , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression? ':' expression? [':' expression?]"));
-    }
-    { // expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
-        expr_ty a;
-        if (
-            (a = expression_rule(p))  // expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
-            _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// atom:
-//     | NAME
-//     | 'True'
-//     | 'False'
-//     | 'None'
-//     | '__peg_parser__'
-//     | &STRING strings
-//     | NUMBER
-//     | &'(' (tuple | group | genexp)
-//     | &'[' (list | listcomp)
-//     | &'{' (dict | set | dictcomp | setcomp)
-//     | '...'
-static expr_ty
-atom_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // NAME
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
-        expr_ty name_var;
-        if (
-            (name_var = _PyPegen_name_token(p))  // NAME
-        )
-        {
-            D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
-            _res = name_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
-    }
-    { // 'True'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'"));
-        Token * _keyword;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 528))  // token='True'
-        )
-        {
-            D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Constant ( Py_True , NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'"));
-    }
-    { // 'False'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'"));
-        Token * _keyword;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 529))  // token='False'
-        )
-        {
-            D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Constant ( Py_False , NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'"));
-    }
-    { // 'None'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'"));
-        Token * _keyword;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 530))  // token='None'
-        )
-        {
-            D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Constant ( Py_None , NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'"));
-    }
-    { // '__peg_parser__'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'__peg_parser__'"));
-        Token * _keyword;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 531))  // token='__peg_parser__'
-        )
-        {
-            D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'__peg_parser__'"));
-            _res = RAISE_SYNTAX_ERROR ( "You found it!" );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'__peg_parser__'"));
-    }
-    { // &STRING strings
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&STRING strings"));
-        expr_ty strings_var;
-        if (
-            _PyPegen_lookahead(1, _PyPegen_string_token, p)
-            &&
-            (strings_var = strings_rule(p))  // strings
-        )
-        {
-            D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&STRING strings"));
-            _res = strings_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&STRING strings"));
-    }
-    { // NUMBER
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NUMBER"));
-        expr_ty number_var;
-        if (
-            (number_var = _PyPegen_number_token(p))  // NUMBER
-        )
-        {
-            D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER"));
-            _res = number_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER"));
-    }
-    { // &'(' (tuple | group | genexp)
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)"));
-        void *_tmp_95_var;
-        if (
-            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7)  // token='('
-            &&
-            (_tmp_95_var = _tmp_95_rule(p))  // tuple | group | genexp
-        )
-        {
-            D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)"));
-            _res = _tmp_95_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'(' (tuple | group | genexp)"));
-    }
-    { // &'[' (list | listcomp)
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)"));
-        void *_tmp_96_var;
-        if (
-            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9)  // token='['
-            &&
-            (_tmp_96_var = _tmp_96_rule(p))  // list | listcomp
-        )
-        {
-            D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)"));
-            _res = _tmp_96_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'[' (list | listcomp)"));
-    }
-    { // &'{' (dict | set | dictcomp | setcomp)
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)"));
-        void *_tmp_97_var;
-        if (
-            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25)  // token='{'
-            &&
-            (_tmp_97_var = _tmp_97_rule(p))  // dict | set | dictcomp | setcomp
-        )
-        {
-            D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)"));
-            _res = _tmp_97_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)"));
-    }
-    { // '...'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 52))  // token='...'
-        )
-        {
-            D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Constant ( Py_Ellipsis , NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// strings: STRING+
-static expr_ty
-strings_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    if (_PyPegen_is_memoized(p, strings_type, &_res)) {
-        D(p->level--);
-        return _res;
-    }
-    int _mark = p->mark;
-    { // STRING+
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> strings[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING+"));
-        asdl_seq * a;
-        if (
-            (a = _loop1_98_rule(p))  // STRING+
-        )
-        {
-            D(fprintf(stderr, "%*c+ strings[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "STRING+"));
-            _res = _PyPegen_concatenate_strings ( p , a );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s strings[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING+"));
-    }
-    _res = NULL;
-  done:
-    _PyPegen_insert_memo(p, _mark, strings_type, _res);
-    D(p->level--);
-    return _res;
-}
-
-// list: '[' star_named_expressions? ']'
-static expr_ty
-list_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // '[' star_named_expressions? ']'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> list[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'"));
-        Token * _literal;
-        Token * _literal_1;
-        void *a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 9))  // token='['
-            &&
-            (a = star_named_expressions_rule(p), 1)  // star_named_expressions?
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 10))  // token=']'
-        )
-        {
-            D(fprintf(stderr, "%*c+ list[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_List ( a , Load , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s list[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_named_expressions? ']'"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// listcomp: '[' named_expression ~ for_if_clauses ']' | invalid_comprehension
-static expr_ty
-listcomp_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // '[' named_expression ~ for_if_clauses ']'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' named_expression ~ for_if_clauses ']'"));
-        int _cut_var = 0;
-        Token * _literal;
-        Token * _literal_1;
-        expr_ty a;
-        asdl_seq* b;
-        if (
-            (_literal = _PyPegen_expect_token(p, 9))  // token='['
-            &&
-            (a = named_expression_rule(p))  // named_expression
-            &&
-            (_cut_var = 1)
-            &&
-            (b = for_if_clauses_rule(p))  // for_if_clauses
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 10))  // token=']'
-        )
-        {
-            D(fprintf(stderr, "%*c+ listcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' named_expression ~ for_if_clauses ']'"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_ListComp ( a , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' named_expression ~ for_if_clauses ']'"));
-        if (_cut_var) {
-            D(p->level--);
-            return NULL;
-        }
-    }
-    if (p->call_invalid_rules) { // invalid_comprehension
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
-        void *invalid_comprehension_var;
-        if (
-            (invalid_comprehension_var = invalid_comprehension_rule(p))  // invalid_comprehension
-        )
-        {
-            D(fprintf(stderr, "%*c+ listcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
-            _res = invalid_comprehension_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// tuple: '(' [star_named_expression ',' star_named_expressions?] ')'
-static expr_ty
-tuple_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // '(' [star_named_expression ',' star_named_expressions?] ')'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> tuple[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
-        Token * _literal;
-        Token * _literal_1;
-        void *a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 7))  // token='('
-            &&
-            (a = _tmp_99_rule(p), 1)  // [star_named_expression ',' star_named_expressions?]
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
-        )
-        {
-            D(fprintf(stderr, "%*c+ tuple[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Tuple ( a , Load , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s tuple[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// group: '(' (yield_expr | named_expression) ')' | invalid_group
-static expr_ty
-group_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    { // '(' (yield_expr | named_expression) ')'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
-        Token * _literal;
-        Token * _literal_1;
-        void *a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 7))  // token='('
-            &&
-            (a = _tmp_100_rule(p))  // yield_expr | named_expression
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
-        )
-        {
-            D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
-            _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
-    }
-    if (p->call_invalid_rules) { // invalid_group
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_group"));
-        void *invalid_group_var;
-        if (
-            (invalid_group_var = invalid_group_rule(p))  // invalid_group
-        )
-        {
-            D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_group"));
-            _res = invalid_group_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_group"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// genexp: '(' named_expression ~ for_if_clauses ')' | invalid_comprehension
-static expr_ty
-genexp_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // '(' named_expression ~ for_if_clauses ')'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' named_expression ~ for_if_clauses ')'"));
-        int _cut_var = 0;
-        Token * _literal;
-        Token * _literal_1;
-        expr_ty a;
-        asdl_seq* b;
-        if (
-            (_literal = _PyPegen_expect_token(p, 7))  // token='('
-            &&
-            (a = named_expression_rule(p))  // named_expression
-            &&
-            (_cut_var = 1)
-            &&
-            (b = for_if_clauses_rule(p))  // for_if_clauses
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
-        )
-        {
-            D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' named_expression ~ for_if_clauses ')'"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_GeneratorExp ( a , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' named_expression ~ for_if_clauses ')'"));
-        if (_cut_var) {
-            D(p->level--);
-            return NULL;
-        }
-    }
-    if (p->call_invalid_rules) { // invalid_comprehension
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
-        void *invalid_comprehension_var;
-        if (
-            (invalid_comprehension_var = invalid_comprehension_rule(p))  // invalid_comprehension
-        )
-        {
-            D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
-            _res = invalid_comprehension_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// set: '{' star_named_expressions '}'
-static expr_ty
-set_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // '{' star_named_expressions '}'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> set[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' star_named_expressions '}'"));
-        Token * _literal;
-        Token * _literal_1;
-        asdl_seq* a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 25))  // token='{'
-            &&
-            (a = star_named_expressions_rule(p))  // star_named_expressions
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 26))  // token='}'
-        )
-        {
-            D(fprintf(stderr, "%*c+ set[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' star_named_expressions '}'"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Set ( a , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s set[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' star_named_expressions '}'"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// setcomp: '{' named_expression ~ for_if_clauses '}' | invalid_comprehension
-static expr_ty
-setcomp_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // '{' named_expression ~ for_if_clauses '}'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' named_expression ~ for_if_clauses '}'"));
-        int _cut_var = 0;
-        Token * _literal;
-        Token * _literal_1;
-        expr_ty a;
-        asdl_seq* b;
-        if (
-            (_literal = _PyPegen_expect_token(p, 25))  // token='{'
-            &&
-            (a = named_expression_rule(p))  // named_expression
-            &&
-            (_cut_var = 1)
-            &&
-            (b = for_if_clauses_rule(p))  // for_if_clauses
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 26))  // token='}'
-        )
-        {
-            D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' named_expression ~ for_if_clauses '}'"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_SetComp ( a , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' named_expression ~ for_if_clauses '}'"));
-        if (_cut_var) {
-            D(p->level--);
-            return NULL;
-        }
-    }
-    if (p->call_invalid_rules) { // invalid_comprehension
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
-        void *invalid_comprehension_var;
-        if (
-            (invalid_comprehension_var = invalid_comprehension_rule(p))  // invalid_comprehension
-        )
-        {
-            D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
-            _res = invalid_comprehension_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// dict: '{' double_starred_kvpairs? '}'
-static expr_ty
-dict_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // '{' double_starred_kvpairs? '}'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> dict[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
-        Token * _literal;
-        Token * _literal_1;
-        void *a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 25))  // token='{'
-            &&
-            (a = double_starred_kvpairs_rule(p), 1)  // double_starred_kvpairs?
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 26))  // token='}'
-        )
-        {
-            D(fprintf(stderr, "%*c+ dict[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Dict ( CHECK ( _PyPegen_get_keys ( p , a ) ) , CHECK ( _PyPegen_get_values ( p , a ) ) , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s dict[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// dictcomp: '{' kvpair for_if_clauses '}' | invalid_dict_comprehension
-static expr_ty
-dictcomp_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // '{' kvpair for_if_clauses '}'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
-        Token * _literal;
-        Token * _literal_1;
-        KeyValuePair* a;
-        asdl_seq* b;
-        if (
-            (_literal = _PyPegen_expect_token(p, 25))  // token='{'
-            &&
-            (a = kvpair_rule(p))  // kvpair
-            &&
-            (b = for_if_clauses_rule(p))  // for_if_clauses
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 26))  // token='}'
-        )
-        {
-            D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_DictComp ( a -> key , a -> value , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
-    }
-    if (p->call_invalid_rules) { // invalid_dict_comprehension
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension"));
-        void *invalid_dict_comprehension_var;
-        if (
-            (invalid_dict_comprehension_var = invalid_dict_comprehension_rule(p))  // invalid_dict_comprehension
-        )
-        {
-            D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension"));
-            _res = invalid_dict_comprehension_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_dict_comprehension"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// double_starred_kvpairs: ','.double_starred_kvpair+ ','?
-static asdl_seq*
-double_starred_kvpairs_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq* _res = NULL;
-    int _mark = p->mark;
-    { // ','.double_starred_kvpair+ ','?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> double_starred_kvpairs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?"));
-        void *_opt_var;
-        UNUSED(_opt_var); // Silence compiler warnings
-        asdl_seq * a;
-        if (
-            (a = _gather_101_rule(p))  // ','.double_starred_kvpair+
-            &&
-            (_opt_var = _PyPegen_expect_token(p, 12), 1)  // ','?
-        )
-        {
-            D(fprintf(stderr, "%*c+ double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?"));
-            _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s double_starred_kvpairs[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.double_starred_kvpair+ ','?"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// double_starred_kvpair: '**' bitwise_or | kvpair
-static KeyValuePair*
-double_starred_kvpair_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    KeyValuePair* _res = NULL;
-    int _mark = p->mark;
-    { // '**' bitwise_or
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or"));
-        Token * _literal;
-        expr_ty a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 35))  // token='**'
-            &&
-            (a = bitwise_or_rule(p))  // bitwise_or
-        )
-        {
-            D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or"));
-            _res = _PyPegen_key_value_pair ( p , NULL , a );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' bitwise_or"));
-    }
-    { // kvpair
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> double_starred_kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kvpair"));
-        KeyValuePair* kvpair_var;
-        if (
-            (kvpair_var = kvpair_rule(p))  // kvpair
-        )
-        {
-            D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kvpair"));
-            _res = kvpair_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kvpair"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// kvpair: expression ':' expression
-static KeyValuePair*
-kvpair_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    KeyValuePair* _res = NULL;
-    int _mark = p->mark;
-    { // expression ':' expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> kvpair[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
-        Token * _literal;
-        expr_ty a;
-        expr_ty b;
-        if (
-            (a = expression_rule(p))  // expression
-            &&
-            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
-            &&
-            (b = expression_rule(p))  // expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
-            _res = _PyPegen_key_value_pair ( p , a , b );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s kvpair[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// for_if_clauses: for_if_clause+
-static asdl_seq*
-for_if_clauses_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq* _res = NULL;
-    int _mark = p->mark;
-    { // for_if_clause+
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> for_if_clauses[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause+"));
-        asdl_seq * _loop1_103_var;
-        if (
-            (_loop1_103_var = _loop1_103_rule(p))  // for_if_clause+
-        )
-        {
-            D(fprintf(stderr, "%*c+ for_if_clauses[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "for_if_clause+"));
-            _res = _loop1_103_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s for_if_clauses[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause+"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// for_if_clause:
-//     | ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
-//     | 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
-//     | invalid_for_target
-static comprehension_ty
-for_if_clause_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    comprehension_ty _res = NULL;
-    int _mark = p->mark;
-    { // ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
-        int _cut_var = 0;
-        Token * _keyword;
-        Token * _keyword_1;
-        expr_ty a;
-        Token * async_var;
-        expr_ty b;
-        asdl_seq * c;
-        if (
-            (async_var = _PyPegen_expect_token(p, ASYNC))  // token='ASYNC'
-            &&
-            (_keyword = _PyPegen_expect_token(p, 517))  // token='for'
-            &&
-            (a = star_targets_rule(p))  // star_targets
-            &&
-            (_keyword_1 = _PyPegen_expect_token(p, 518))  // token='in'
-            &&
-            (_cut_var = 1)
-            &&
-            (b = disjunction_rule(p))  // disjunction
-            &&
-            (c = _loop0_104_rule(p))  // (('if' disjunction))*
-        )
-        {
-            D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
-            _res = CHECK_VERSION ( 6 , "Async comprehensions are" , _Py_comprehension ( a , b , c , 1 , p -> arena ) );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
-        if (_cut_var) {
-            D(p->level--);
-            return NULL;
-        }
-    }
-    { // 'for' star_targets 'in' ~ disjunction (('if' disjunction))*
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
-        int _cut_var = 0;
-        Token * _keyword;
-        Token * _keyword_1;
-        expr_ty a;
-        expr_ty b;
-        asdl_seq * c;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 517))  // token='for'
-            &&
-            (a = star_targets_rule(p))  // star_targets
-            &&
-            (_keyword_1 = _PyPegen_expect_token(p, 518))  // token='in'
-            &&
-            (_cut_var = 1)
-            &&
-            (b = disjunction_rule(p))  // disjunction
-            &&
-            (c = _loop0_105_rule(p))  // (('if' disjunction))*
-        )
-        {
-            D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
-            _res = _Py_comprehension ( a , b , c , 0 , p -> arena );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
-        if (_cut_var) {
-            D(p->level--);
-            return NULL;
-        }
-    }
-    if (p->call_invalid_rules) { // invalid_for_target
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> for_if_clause[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
-        void *invalid_for_target_var;
-        if (
-            (invalid_for_target_var = invalid_for_target_rule(p))  // invalid_for_target
-        )
-        {
-            D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_for_target"));
-            _res = invalid_for_target_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_for_target"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// yield_expr: 'yield' 'from' expression | 'yield' star_expressions?
-static expr_ty
-yield_expr_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // 'yield' 'from' expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression"));
-        Token * _keyword;
-        Token * _keyword_1;
-        expr_ty a;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 504))  // token='yield'
-            &&
-            (_keyword_1 = _PyPegen_expect_token(p, 514))  // token='from'
-            &&
-            (a = expression_rule(p))  // expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_YieldFrom ( a , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' 'from' expression"));
-    }
-    { // 'yield' star_expressions?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?"));
-        Token * _keyword;
-        void *a;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 504))  // token='yield'
-            &&
-            (a = star_expressions_rule(p), 1)  // star_expressions?
-        )
-        {
-            D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Yield ( a , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' star_expressions?"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// arguments: args ','? &')' | invalid_arguments
-static expr_ty
-arguments_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    if (_PyPegen_is_memoized(p, arguments_type, &_res)) {
-        D(p->level--);
-        return _res;
-    }
-    int _mark = p->mark;
-    { // args ','? &')'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ','? &')'"));
-        void *_opt_var;
-        UNUSED(_opt_var); // Silence compiler warnings
-        expr_ty a;
-        if (
-            (a = args_rule(p))  // args
-            &&
-            (_opt_var = _PyPegen_expect_token(p, 12), 1)  // ','?
-            &&
-            _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)  // token=')'
-        )
-        {
-            D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ','? &')'"));
-            _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ','? &')'"));
-    }
-    if (p->call_invalid_rules) { // invalid_arguments
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_arguments"));
-        void *invalid_arguments_var;
-        if (
-            (invalid_arguments_var = invalid_arguments_rule(p))  // invalid_arguments
-        )
-        {
-            D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_arguments"));
-            _res = invalid_arguments_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_arguments"));
-    }
-    _res = NULL;
-  done:
-    _PyPegen_insert_memo(p, _mark, arguments_type, _res);
-    D(p->level--);
-    return _res;
-}
-
-// args: ','.(starred_expression | named_expression !'=')+ [',' kwargs] | kwargs
-static expr_ty
-args_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // ','.(starred_expression | named_expression !'=')+ [',' kwargs]
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.(starred_expression | named_expression !'=')+ [',' kwargs]"));
-        asdl_seq * a;
-        void *b;
-        if (
-            (a = _gather_106_rule(p))  // ','.(starred_expression | named_expression !'=')+
-            &&
-            (b = _tmp_108_rule(p), 1)  // [',' kwargs]
-        )
-        {
-            D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.(starred_expression | named_expression !'=')+ [',' kwargs]"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _PyPegen_collect_call_seqs ( p , a , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.(starred_expression | named_expression !'=')+ [',' kwargs]"));
-    }
-    { // kwargs
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> args[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwargs"));
-        asdl_seq* a;
-        if (
-            (a = kwargs_rule(p))  // kwargs
-        )
-        {
-            D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwargs"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Call ( _PyPegen_dummy_name ( p ) , CHECK_NULL_ALLOWED ( _PyPegen_seq_extract_starred_exprs ( p , a ) ) , CHECK_NULL_ALLOWED ( _PyPegen_seq_delete_starred_exprs ( p , a ) ) , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwargs"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// kwargs:
-//     | ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+
-//     | ','.kwarg_or_starred+
-//     | ','.kwarg_or_double_starred+
-static asdl_seq*
-kwargs_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq* _res = NULL;
-    int _mark = p->mark;
-    { // ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
-        Token * _literal;
-        asdl_seq * a;
-        asdl_seq * b;
-        if (
-            (a = _gather_109_rule(p))  // ','.kwarg_or_starred+
-            &&
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (b = _gather_111_rule(p))  // ','.kwarg_or_double_starred+
-        )
-        {
-            D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
-            _res = _PyPegen_join_sequences ( p , a , b );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
-    }
-    { // ','.kwarg_or_starred+
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+"));
-        asdl_seq * _gather_113_var;
-        if (
-            (_gather_113_var = _gather_113_rule(p))  // ','.kwarg_or_starred+
-        )
-        {
-            D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+"));
-            _res = _gather_113_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+"));
-    }
-    { // ','.kwarg_or_double_starred+
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+"));
-        asdl_seq * _gather_115_var;
-        if (
-            (_gather_115_var = _gather_115_rule(p))  // ','.kwarg_or_double_starred+
-        )
-        {
-            D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+"));
-            _res = _gather_115_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_double_starred+"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// starred_expression: '*' expression
-static expr_ty
-starred_expression_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // '*' expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> starred_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression"));
-        Token * _literal;
-        expr_ty a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 16))  // token='*'
-            &&
-            (a = expression_rule(p))  // expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ starred_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Starred ( a , Load , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s starred_expression[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// kwarg_or_starred: NAME '=' expression | starred_expression | invalid_kwarg
-static KeywordOrStarred*
-kwarg_or_starred_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    KeywordOrStarred* _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // NAME '=' expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
-        Token * _literal;
-        expr_ty a;
-        expr_ty b;
-        if (
-            (a = _PyPegen_name_token(p))  // NAME
-            &&
-            (_literal = _PyPegen_expect_token(p, 22))  // token='='
-            &&
-            (b = expression_rule(p))  // expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression"));
-    }
-    { // starred_expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression"));
-        expr_ty a;
-        if (
-            (a = starred_expression_rule(p))  // starred_expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression"));
-            _res = _PyPegen_keyword_or_starred ( p , a , 0 );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression"));
-    }
-    if (p->call_invalid_rules) { // invalid_kwarg
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> kwarg_or_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
-        void *invalid_kwarg_var;
-        if (
-            (invalid_kwarg_var = invalid_kwarg_rule(p))  // invalid_kwarg
-        )
-        {
-            D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
-            _res = invalid_kwarg_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// kwarg_or_double_starred: NAME '=' expression | '**' expression | invalid_kwarg
-static KeywordOrStarred*
-kwarg_or_double_starred_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    KeywordOrStarred* _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // NAME '=' expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
-        Token * _literal;
-        expr_ty a;
-        expr_ty b;
-        if (
-            (a = _PyPegen_name_token(p))  // NAME
-            &&
-            (_literal = _PyPegen_expect_token(p, 22))  // token='='
-            &&
-            (b = expression_rule(p))  // expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression"));
-    }
-    { // '**' expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression"));
-        Token * _literal;
-        expr_ty a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 35))  // token='**'
-            &&
-            (a = expression_rule(p))  // expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( NULL , a , EXTRA ) ) , 1 );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression"));
-    }
-    if (p->call_invalid_rules) { // invalid_kwarg
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> kwarg_or_double_starred[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
-        void *invalid_kwarg_var;
-        if (
-            (invalid_kwarg_var = invalid_kwarg_rule(p))  // invalid_kwarg
-        )
-        {
-            D(fprintf(stderr, "%*c+ kwarg_or_double_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_kwarg"));
-            _res = invalid_kwarg_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// star_targets: star_target !',' | star_target ((',' star_target))* ','?
-static expr_ty
-star_targets_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // star_target !','
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target !','"));
-        expr_ty a;
-        if (
-            (a = star_target_rule(p))  // star_target
-            &&
-            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12)  // token=','
-        )
-        {
-            D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target !','"));
-            _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target !','"));
-    }
-    { // star_target ((',' star_target))* ','?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> star_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?"));
-        void *_opt_var;
-        UNUSED(_opt_var); // Silence compiler warnings
-        expr_ty a;
-        asdl_seq * b;
-        if (
-            (a = star_target_rule(p))  // star_target
-            &&
-            (b = _loop0_117_rule(p))  // ((',' star_target))*
-            &&
-            (_opt_var = _PyPegen_expect_token(p, 12), 1)  // ','?
-        )
-        {
-            D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))* ','?"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Store , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target ((',' star_target))* ','?"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// star_targets_seq: ','.star_target+ ','?
-static asdl_seq*
-star_targets_seq_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq* _res = NULL;
-    int _mark = p->mark;
-    { // ','.star_target+ ','?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> star_targets_seq[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?"));
-        void *_opt_var;
-        UNUSED(_opt_var); // Silence compiler warnings
-        asdl_seq * a;
-        if (
-            (a = _gather_118_rule(p))  // ','.star_target+
-            &&
-            (_opt_var = _PyPegen_expect_token(p, 12), 1)  // ','?
-        )
-        {
-            D(fprintf(stderr, "%*c+ star_targets_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?"));
-            _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s star_targets_seq[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_target+ ','?"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// star_target:
-//     | '*' (!'*' star_target)
-//     | t_primary '.' NAME !t_lookahead
-//     | t_primary '[' slices ']' !t_lookahead
-//     | star_atom
-static expr_ty
-star_target_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    if (_PyPegen_is_memoized(p, star_target_type, &_res)) {
-        D(p->level--);
-        return _res;
-    }
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // '*' (!'*' star_target)
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)"));
-        Token * _literal;
-        void *a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 16))  // token='*'
-            &&
-            (a = _tmp_120_rule(p))  // !'*' star_target
-        )
-        {
-            D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Starred ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , Store , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (!'*' star_target)"));
-    }
-    { // t_primary '.' NAME !t_lookahead
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
-        Token * _literal;
-        expr_ty a;
-        expr_ty b;
-        if (
-            (a = t_primary_rule(p))  // t_primary
-            &&
-            (_literal = _PyPegen_expect_token(p, 23))  // token='.'
-            &&
-            (b = _PyPegen_name_token(p))  // NAME
-            &&
-            _PyPegen_lookahead(0, t_lookahead_rule, p)
-        )
-        {
-            D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
-    }
-    { // t_primary '[' slices ']' !t_lookahead
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
-        Token * _literal;
-        Token * _literal_1;
-        expr_ty a;
-        expr_ty b;
-        if (
-            (a = t_primary_rule(p))  // t_primary
-            &&
-            (_literal = _PyPegen_expect_token(p, 9))  // token='['
-            &&
-            (b = slices_rule(p))  // slices
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 10))  // token=']'
-            &&
-            _PyPegen_lookahead(0, t_lookahead_rule, p)
-        )
-        {
-            D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Subscript ( a , b , Store , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
-    }
-    { // star_atom
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> star_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_atom"));
-        expr_ty star_atom_var;
-        if (
-            (star_atom_var = star_atom_rule(p))  // star_atom
-        )
-        {
-            D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_atom"));
-            _res = star_atom_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_atom"));
-    }
-    _res = NULL;
-  done:
-    _PyPegen_insert_memo(p, _mark, star_target_type, _res);
-    D(p->level--);
-    return _res;
-}
-
-// star_atom:
-//     | NAME
-//     | '(' star_target ')'
-//     | '(' star_targets_seq? ')'
-//     | '[' star_targets_seq? ']'
-static expr_ty
-star_atom_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // NAME
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
-        expr_ty a;
-        if (
-            (a = _PyPegen_name_token(p))  // NAME
-        )
-        {
-            D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
-            _res = _PyPegen_set_expr_context ( p , a , Store );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
-    }
-    { // '(' star_target ')'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' star_target ')'"));
-        Token * _literal;
-        Token * _literal_1;
-        expr_ty a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 7))  // token='('
-            &&
-            (a = star_target_rule(p))  // star_target
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
-        )
-        {
-            D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' star_target ')'"));
-            _res = _PyPegen_set_expr_context ( p , a , Store );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' star_target ')'"));
-    }
-    { // '(' star_targets_seq? ')'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' star_targets_seq? ')'"));
-        Token * _literal;
-        Token * _literal_1;
-        void *a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 7))  // token='('
-            &&
-            (a = star_targets_seq_rule(p), 1)  // star_targets_seq?
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
-        )
-        {
-            D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' star_targets_seq? ')'"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Tuple ( a , Store , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' star_targets_seq? ')'"));
-    }
-    { // '[' star_targets_seq? ']'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> star_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_targets_seq? ']'"));
-        Token * _literal;
-        Token * _literal_1;
-        void *a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 9))  // token='['
-            &&
-            (a = star_targets_seq_rule(p), 1)  // star_targets_seq?
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 10))  // token=']'
-        )
-        {
-            D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_targets_seq? ']'"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_List ( a , Store , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_targets_seq? ']'"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// single_target: single_subscript_attribute_target | NAME | '(' single_target ')'
-static expr_ty
-single_target_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    { // single_subscript_attribute_target
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
-        expr_ty single_subscript_attribute_target_var;
-        if (
-            (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p))  // single_subscript_attribute_target
-        )
-        {
-            D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
-            _res = single_subscript_attribute_target_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target"));
-    }
-    { // NAME
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
-        expr_ty a;
-        if (
-            (a = _PyPegen_name_token(p))  // NAME
-        )
-        {
-            D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
-            _res = _PyPegen_set_expr_context ( p , a , Store );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
-    }
-    { // '(' single_target ')'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> single_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
-        Token * _literal;
-        Token * _literal_1;
-        expr_ty a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 7))  // token='('
-            &&
-            (a = single_target_rule(p))  // single_target
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
-        )
-        {
-            D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
-            _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// single_subscript_attribute_target:
-//     | t_primary '.' NAME !t_lookahead
-//     | t_primary '[' slices ']' !t_lookahead
-static expr_ty
-single_subscript_attribute_target_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // t_primary '.' NAME !t_lookahead
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
-        Token * _literal;
-        expr_ty a;
-        expr_ty b;
-        if (
-            (a = t_primary_rule(p))  // t_primary
-            &&
-            (_literal = _PyPegen_expect_token(p, 23))  // token='.'
-            &&
-            (b = _PyPegen_name_token(p))  // NAME
-            &&
-            _PyPegen_lookahead(0, t_lookahead_rule, p)
-        )
-        {
-            D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
-    }
-    { // t_primary '[' slices ']' !t_lookahead
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> single_subscript_attribute_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
-        Token * _literal;
-        Token * _literal_1;
-        expr_ty a;
-        expr_ty b;
-        if (
-            (a = t_primary_rule(p))  // t_primary
-            &&
-            (_literal = _PyPegen_expect_token(p, 9))  // token='['
-            &&
-            (b = slices_rule(p))  // slices
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 10))  // token=']'
-            &&
-            _PyPegen_lookahead(0, t_lookahead_rule, p)
-        )
-        {
-            D(fprintf(stderr, "%*c+ single_subscript_attribute_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Subscript ( a , b , Store , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// del_targets: ','.del_target+ ','?
-static asdl_seq*
-del_targets_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq* _res = NULL;
-    int _mark = p->mark;
-    { // ','.del_target+ ','?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> del_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?"));
-        void *_opt_var;
-        UNUSED(_opt_var); // Silence compiler warnings
-        asdl_seq * a;
-        if (
-            (a = _gather_121_rule(p))  // ','.del_target+
-            &&
-            (_opt_var = _PyPegen_expect_token(p, 12), 1)  // ','?
-        )
-        {
-            D(fprintf(stderr, "%*c+ del_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?"));
-            _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s del_targets[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.del_target+ ','?"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// del_target:
-//     | t_primary '.' NAME !t_lookahead
-//     | t_primary '[' slices ']' !t_lookahead
-//     | del_t_atom
-static expr_ty
-del_target_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    if (_PyPegen_is_memoized(p, del_target_type, &_res)) {
-        D(p->level--);
-        return _res;
-    }
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // t_primary '.' NAME !t_lookahead
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
-        Token * _literal;
-        expr_ty a;
-        expr_ty b;
-        if (
-            (a = t_primary_rule(p))  // t_primary
-            &&
-            (_literal = _PyPegen_expect_token(p, 23))  // token='.'
-            &&
-            (b = _PyPegen_name_token(p))  // NAME
-            &&
-            _PyPegen_lookahead(0, t_lookahead_rule, p)
-        )
-        {
-            D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Attribute ( a , b -> v . Name . id , Del , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
-    }
-    { // t_primary '[' slices ']' !t_lookahead
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
-        Token * _literal;
-        Token * _literal_1;
-        expr_ty a;
-        expr_ty b;
-        if (
-            (a = t_primary_rule(p))  // t_primary
-            &&
-            (_literal = _PyPegen_expect_token(p, 9))  // token='['
-            &&
-            (b = slices_rule(p))  // slices
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 10))  // token=']'
-            &&
-            _PyPegen_lookahead(0, t_lookahead_rule, p)
-        )
-        {
-            D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Subscript ( a , b , Del , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
-    }
-    { // del_t_atom
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> del_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_t_atom"));
-        expr_ty del_t_atom_var;
-        if (
-            (del_t_atom_var = del_t_atom_rule(p))  // del_t_atom
-        )
-        {
-            D(fprintf(stderr, "%*c+ del_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_t_atom"));
-            _res = del_t_atom_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_t_atom"));
-    }
-    _res = NULL;
-  done:
-    _PyPegen_insert_memo(p, _mark, del_target_type, _res);
-    D(p->level--);
-    return _res;
-}
-
-// del_t_atom: NAME | '(' del_target ')' | '(' del_targets? ')' | '[' del_targets? ']'
-static expr_ty
-del_t_atom_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // NAME
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
-        expr_ty a;
-        if (
-            (a = _PyPegen_name_token(p))  // NAME
-        )
-        {
-            D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
-            _res = _PyPegen_set_expr_context ( p , a , Del );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
-    }
-    { // '(' del_target ')'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'"));
-        Token * _literal;
-        Token * _literal_1;
-        expr_ty a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 7))  // token='('
-            &&
-            (a = del_target_rule(p))  // del_target
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
-        )
-        {
-            D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'"));
-            _res = _PyPegen_set_expr_context ( p , a , Del );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_target ')'"));
-    }
-    { // '(' del_targets? ')'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'"));
-        Token * _literal;
-        Token * _literal_1;
-        void *a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 7))  // token='('
-            &&
-            (a = del_targets_rule(p), 1)  // del_targets?
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
-        )
-        {
-            D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_targets? ')'"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Tuple ( a , Del , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_targets? ')'"));
-    }
-    { // '[' del_targets? ']'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> del_t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'"));
-        Token * _literal;
-        Token * _literal_1;
-        void *a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 9))  // token='['
-            &&
-            (a = del_targets_rule(p), 1)  // del_targets?
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 10))  // token=']'
-        )
-        {
-            D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' del_targets? ']'"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_List ( a , Del , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' del_targets? ']'"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// targets: ','.target+ ','?
-static asdl_seq*
-targets_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq* _res = NULL;
-    int _mark = p->mark;
-    { // ','.target+ ','?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.target+ ','?"));
-        void *_opt_var;
-        UNUSED(_opt_var); // Silence compiler warnings
-        asdl_seq * a;
-        if (
-            (a = _gather_123_rule(p))  // ','.target+
-            &&
-            (_opt_var = _PyPegen_expect_token(p, 12), 1)  // ','?
-        )
-        {
-            D(fprintf(stderr, "%*c+ targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.target+ ','?"));
-            _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s targets[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.target+ ','?"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// target:
-//     | t_primary '.' NAME !t_lookahead
-//     | t_primary '[' slices ']' !t_lookahead
-//     | t_atom
-static expr_ty
-target_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    if (_PyPegen_is_memoized(p, target_type, &_res)) {
-        D(p->level--);
-        return _res;
-    }
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // t_primary '.' NAME !t_lookahead
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
-        Token * _literal;
-        expr_ty a;
-        expr_ty b;
-        if (
-            (a = t_primary_rule(p))  // t_primary
-            &&
-            (_literal = _PyPegen_expect_token(p, 23))  // token='.'
-            &&
-            (b = _PyPegen_name_token(p))  // NAME
-            &&
-            _PyPegen_lookahead(0, t_lookahead_rule, p)
-        )
-        {
-            D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead"));
-    }
-    { // t_primary '[' slices ']' !t_lookahead
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
-        Token * _literal;
-        Token * _literal_1;
-        expr_ty a;
-        expr_ty b;
-        if (
-            (a = t_primary_rule(p))  // t_primary
-            &&
-            (_literal = _PyPegen_expect_token(p, 9))  // token='['
-            &&
-            (b = slices_rule(p))  // slices
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 10))  // token=']'
-            &&
-            _PyPegen_lookahead(0, t_lookahead_rule, p)
-        )
-        {
-            D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Subscript ( a , b , Store , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead"));
-    }
-    { // t_atom
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_atom"));
-        expr_ty t_atom_var;
-        if (
-            (t_atom_var = t_atom_rule(p))  // t_atom
-        )
-        {
-            D(fprintf(stderr, "%*c+ target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_atom"));
-            _res = t_atom_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_atom"));
-    }
-    _res = NULL;
-  done:
-    _PyPegen_insert_memo(p, _mark, target_type, _res);
-    D(p->level--);
-    return _res;
-}
-
-// Left-recursive
-// t_primary:
-//     | t_primary '.' NAME &t_lookahead
-//     | t_primary '[' slices ']' &t_lookahead
-//     | t_primary genexp &t_lookahead
-//     | t_primary '(' arguments? ')' &t_lookahead
-//     | atom &t_lookahead
-static expr_ty t_primary_raw(Parser *);
-static expr_ty
-t_primary_rule(Parser *p)
-{
-    D(p->level++);
-    expr_ty _res = NULL;
-    if (_PyPegen_is_memoized(p, t_primary_type, &_res)) {
-        D(p->level--);
-        return _res;
-    }
-    int _mark = p->mark;
-    int _resmark = p->mark;
-    while (1) {
-        int tmpvar_8 = _PyPegen_update_memo(p, _mark, t_primary_type, _res);
-        if (tmpvar_8) {
-            D(p->level--);
-            return _res;
-        }
-        p->mark = _mark;
-        void *_raw = t_primary_raw(p);
-        if (p->error_indicator)
-            return NULL;
-        if (_raw == NULL || p->mark <= _resmark)
-            break;
-        _resmark = p->mark;
-        _res = _raw;
-    }
-    p->mark = _resmark;
-    D(p->level--);
-    return _res;
-}
-static expr_ty
-t_primary_raw(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // t_primary '.' NAME &t_lookahead
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
-        Token * _literal;
-        expr_ty a;
-        expr_ty b;
-        if (
-            (a = t_primary_rule(p))  // t_primary
-            &&
-            (_literal = _PyPegen_expect_token(p, 23))  // token='.'
-            &&
-            (b = _PyPegen_name_token(p))  // NAME
-            &&
-            _PyPegen_lookahead(1, t_lookahead_rule, p)
-        )
-        {
-            D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
-    }
-    { // t_primary '[' slices ']' &t_lookahead
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
-        Token * _literal;
-        Token * _literal_1;
-        expr_ty a;
-        expr_ty b;
-        if (
-            (a = t_primary_rule(p))  // t_primary
-            &&
-            (_literal = _PyPegen_expect_token(p, 9))  // token='['
-            &&
-            (b = slices_rule(p))  // slices
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 10))  // token=']'
-            &&
-            _PyPegen_lookahead(1, t_lookahead_rule, p)
-        )
-        {
-            D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Subscript ( a , b , Load , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
-    }
-    { // t_primary genexp &t_lookahead
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead"));
-        expr_ty a;
-        expr_ty b;
-        if (
-            (a = t_primary_rule(p))  // t_primary
-            &&
-            (b = genexp_rule(p))  // genexp
-            &&
-            _PyPegen_lookahead(1, t_lookahead_rule, p)
-        )
-        {
-            D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Call ( a , CHECK ( _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary genexp &t_lookahead"));
-    }
-    { // t_primary '(' arguments? ')' &t_lookahead
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
-        Token * _literal;
-        Token * _literal_1;
-        expr_ty a;
-        void *b;
-        if (
-            (a = t_primary_rule(p))  // t_primary
-            &&
-            (_literal = _PyPegen_expect_token(p, 7))  // token='('
-            &&
-            (b = arguments_rule(p), 1)  // arguments?
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
-            &&
-            _PyPegen_lookahead(1, t_lookahead_rule, p)
-        )
-        {
-            D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
-    }
-    { // atom &t_lookahead
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead"));
-        expr_ty a;
-        if (
-            (a = atom_rule(p))  // atom
-            &&
-            _PyPegen_lookahead(1, t_lookahead_rule, p)
-        )
-        {
-            D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead"));
-            _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom &t_lookahead"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// t_lookahead: '(' | '[' | '.'
-static void *
-t_lookahead_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // '('
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 7))  // token='('
-        )
-        {
-            D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('"));
-            _res = _literal;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('"));
-    }
-    { // '['
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 9))  // token='['
-        )
-        {
-            D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['"));
-            _res = _literal;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['"));
-    }
-    { // '.'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 23))  // token='.'
-        )
-        {
-            D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
-            _res = _literal;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// t_atom: NAME | '(' target ')' | '(' targets? ')' | '[' targets? ']'
-static expr_ty
-t_atom_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
-        p->error_indicator = 1;
-        D(p->level--);
-        return NULL;
-    }
-    int _start_lineno = p->tokens[_mark]->lineno;
-    UNUSED(_start_lineno); // Only used by EXTRA macro
-    int _start_col_offset = p->tokens[_mark]->col_offset;
-    UNUSED(_start_col_offset); // Only used by EXTRA macro
-    { // NAME
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
-        expr_ty a;
-        if (
-            (a = _PyPegen_name_token(p))  // NAME
-        )
-        {
-            D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
-            _res = _PyPegen_set_expr_context ( p , a , Store );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
-    }
-    { // '(' target ')'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' target ')'"));
-        Token * _literal;
-        Token * _literal_1;
-        expr_ty a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 7))  // token='('
-            &&
-            (a = target_rule(p))  // target
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
-        )
-        {
-            D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' target ')'"));
-            _res = _PyPegen_set_expr_context ( p , a , Store );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' target ')'"));
-    }
-    { // '(' targets? ')'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' targets? ')'"));
-        Token * _literal;
-        Token * _literal_1;
-        void *b;
-        if (
-            (_literal = _PyPegen_expect_token(p, 7))  // token='('
-            &&
-            (b = targets_rule(p), 1)  // targets?
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
-        )
-        {
-            D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' targets? ')'"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_Tuple ( b , Store , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' targets? ')'"));
-    }
-    { // '[' targets? ']'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> t_atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' targets? ']'"));
-        Token * _literal;
-        Token * _literal_1;
-        void *b;
-        if (
-            (_literal = _PyPegen_expect_token(p, 9))  // token='['
-            &&
-            (b = targets_rule(p), 1)  // targets?
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 10))  // token=']'
-        )
-        {
-            D(fprintf(stderr, "%*c+ t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' targets? ']'"));
-            Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
-            if (_token == NULL) {
-                D(p->level--);
-                return NULL;
-            }
-            int _end_lineno = _token->end_lineno;
-            UNUSED(_end_lineno); // Only used by EXTRA macro
-            int _end_col_offset = _token->end_col_offset;
-            UNUSED(_end_col_offset); // Only used by EXTRA macro
-            _res = _Py_List ( b , Store , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' targets? ']'"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// invalid_arguments:
-//     | args ',' '*'
-//     | expression for_if_clauses ',' [args | expression for_if_clauses]
-//     | args for_if_clauses
-//     | args ',' expression for_if_clauses
-//     | args ',' args
-static void *
-invalid_arguments_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // args ',' '*'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' '*'"));
-        Token * _literal;
-        Token * _literal_1;
-        expr_ty args_var;
-        if (
-            (args_var = args_rule(p))  // args
-            &&
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 16))  // token='*'
-        )
-        {
-            D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' '*'"));
-            _res = RAISE_SYNTAX_ERROR ( "iterable argument unpacking follows keyword argument unpacking" );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' '*'"));
-    }
-    { // expression for_if_clauses ',' [args | expression for_if_clauses]
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]"));
-        Token * _literal;
-        void *_opt_var;
-        UNUSED(_opt_var); // Silence compiler warnings
-        expr_ty a;
-        asdl_seq* for_if_clauses_var;
-        if (
-            (a = expression_rule(p))  // expression
-            &&
-            (for_if_clauses_var = for_if_clauses_rule(p))  // for_if_clauses
-            &&
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (_opt_var = _tmp_125_rule(p), 1)  // [args | expression for_if_clauses]
-        )
-        {
-            D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]"));
-            _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "Generator expression must be parenthesized" );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]"));
-    }
-    { // args for_if_clauses
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args for_if_clauses"));
-        expr_ty a;
-        asdl_seq* for_if_clauses_var;
-        if (
-            (a = args_rule(p))  // args
-            &&
-            (for_if_clauses_var = for_if_clauses_rule(p))  // for_if_clauses
-        )
-        {
-            D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args for_if_clauses"));
-            _res = _PyPegen_nonparen_genexp_in_call ( p , a );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args for_if_clauses"));
-    }
-    { // args ',' expression for_if_clauses
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' expression for_if_clauses"));
-        Token * _literal;
-        expr_ty a;
-        expr_ty args_var;
-        asdl_seq* for_if_clauses_var;
-        if (
-            (args_var = args_rule(p))  // args
-            &&
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (a = expression_rule(p))  // expression
-            &&
-            (for_if_clauses_var = for_if_clauses_rule(p))  // for_if_clauses
-        )
-        {
-            D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' expression for_if_clauses"));
-            _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "Generator expression must be parenthesized" );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' expression for_if_clauses"));
-    }
-    { // args ',' args
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> invalid_arguments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args ',' args"));
-        Token * _literal;
-        expr_ty a;
-        expr_ty args_var;
-        if (
-            (a = args_rule(p))  // args
-            &&
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (args_var = args_rule(p))  // args
-        )
-        {
-            D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' args"));
-            _res = _PyPegen_arguments_parsing_error ( p , a );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s invalid_arguments[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' args"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// invalid_kwarg: expression '='
-static void *
-invalid_kwarg_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // expression '='
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> invalid_kwarg[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression '='"));
-        Token * _literal;
-        expr_ty a;
-        if (
-            (a = expression_rule(p))  // expression
-            &&
-            (_literal = _PyPegen_expect_token(p, 22))  // token='='
-        )
-        {
-            D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression '='"));
-            _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expression cannot contain assignment, perhaps you meant \"==\"?" );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s invalid_kwarg[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression '='"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// invalid_named_expression: expression ':=' expression
-static void *
-invalid_named_expression_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // expression ':=' expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> invalid_named_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':=' expression"));
-        Token * _literal;
-        expr_ty a;
-        expr_ty expression_var;
-        if (
-            (a = expression_rule(p))  // expression
-            &&
-            (_literal = _PyPegen_expect_token(p, 53))  // token=':='
-            &&
-            (expression_var = expression_rule(p))  // expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ invalid_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':=' expression"));
-            _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use assignment expressions with %s" , _PyPegen_get_expr_name ( a ) );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s invalid_named_expression[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':=' expression"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// invalid_assignment:
-//     | invalid_ann_assign_target ':' expression
-//     | star_named_expression ',' star_named_expressions* ':' expression
-//     | expression ':' expression
-//     | ((star_targets '='))* star_expressions '='
-//     | ((star_targets '='))* yield_expr '='
-//     | star_expressions augassign (yield_expr | star_expressions)
-static void *
-invalid_assignment_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // invalid_ann_assign_target ':' expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_ann_assign_target ':' expression"));
-        Token * _literal;
-        expr_ty a;
-        expr_ty expression_var;
-        if (
-            (a = invalid_ann_assign_target_rule(p))  // invalid_ann_assign_target
-            &&
-            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
-            &&
-            (expression_var = expression_rule(p))  // expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_ann_assign_target ':' expression"));
-            _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not %s) can be annotated" , _PyPegen_get_expr_name ( a ) );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_ann_assign_target ':' expression"));
-    }
-    { // star_named_expression ',' star_named_expressions* ':' expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression"));
-        Token * _literal;
-        Token * _literal_1;
-        asdl_seq * _loop0_126_var;
-        expr_ty a;
-        expr_ty expression_var;
-        if (
-            (a = star_named_expression_rule(p))  // star_named_expression
-            &&
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (_loop0_126_var = _loop0_126_rule(p))  // star_named_expressions*
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 11))  // token=':'
-            &&
-            (expression_var = expression_rule(p))  // expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression"));
-            _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not tuple) can be annotated" );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression"));
-    }
-    { // expression ':' expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
-        Token * _literal;
-        expr_ty a;
-        expr_ty expression_var;
-        if (
-            (a = expression_rule(p))  // expression
-            &&
-            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
-            &&
-            (expression_var = expression_rule(p))  // expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
-            _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "illegal target for annotation" );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression"));
-    }
-    { // ((star_targets '='))* star_expressions '='
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* star_expressions '='"));
-        Token * _literal;
-        asdl_seq * _loop0_127_var;
-        expr_ty a;
-        if (
-            (_loop0_127_var = _loop0_127_rule(p))  // ((star_targets '='))*
-            &&
-            (a = star_expressions_rule(p))  // star_expressions
-            &&
-            (_literal = _PyPegen_expect_token(p, 22))  // token='='
-        )
-        {
-            D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* star_expressions '='"));
-            _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( STAR_TARGETS , a );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))* star_expressions '='"));
-    }
-    { // ((star_targets '='))* yield_expr '='
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='"));
-        Token * _literal;
-        asdl_seq * _loop0_128_var;
-        expr_ty a;
-        if (
-            (_loop0_128_var = _loop0_128_rule(p))  // ((star_targets '='))*
-            &&
-            (a = yield_expr_rule(p))  // yield_expr
-            &&
-            (_literal = _PyPegen_expect_token(p, 22))  // token='='
-        )
-        {
-            D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='"));
-            _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "assignment to yield expression not possible" );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))* yield_expr '='"));
-    }
-    { // star_expressions augassign (yield_expr | star_expressions)
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)"));
-        void *_tmp_129_var;
-        expr_ty a;
-        AugOperator* augassign_var;
-        if (
-            (a = star_expressions_rule(p))  // star_expressions
-            &&
-            (augassign_var = augassign_rule(p))  // augassign
-            &&
-            (_tmp_129_var = _tmp_129_rule(p))  // yield_expr | star_expressions
-        )
-        {
-            D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)"));
-            _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "'%s' is an illegal expression for augmented assignment" , _PyPegen_get_expr_name ( a ) );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// invalid_ann_assign_target: list | tuple | '(' invalid_ann_assign_target ')'
-static expr_ty
-invalid_ann_assign_target_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    expr_ty _res = NULL;
-    int _mark = p->mark;
-    { // list
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list"));
-        expr_ty list_var;
-        if (
-            (list_var = list_rule(p))  // list
-        )
-        {
-            D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list"));
-            _res = list_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list"));
-    }
-    { // tuple
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple"));
-        expr_ty tuple_var;
-        if (
-            (tuple_var = tuple_rule(p))  // tuple
-        )
-        {
-            D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple"));
-            _res = tuple_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple"));
-    }
-    { // '(' invalid_ann_assign_target ')'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> invalid_ann_assign_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' invalid_ann_assign_target ')'"));
-        Token * _literal;
-        Token * _literal_1;
-        expr_ty a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 7))  // token='('
-            &&
-            (a = invalid_ann_assign_target_rule(p))  // invalid_ann_assign_target
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
-        )
-        {
-            D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' invalid_ann_assign_target ')'"));
-            _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s invalid_ann_assign_target[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' invalid_ann_assign_target ')'"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// invalid_del_stmt: 'del' star_expressions
-static void *
-invalid_del_stmt_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // 'del' star_expressions
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> invalid_del_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'del' star_expressions"));
-        Token * _keyword;
-        expr_ty a;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 503))  // token='del'
-            &&
-            (a = star_expressions_rule(p))  // star_expressions
-        )
-        {
-            D(fprintf(stderr, "%*c+ invalid_del_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'del' star_expressions"));
-            _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( DEL_TARGETS , a );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s invalid_del_stmt[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'del' star_expressions"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// invalid_block: NEWLINE !INDENT
-static void *
-invalid_block_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // NEWLINE !INDENT
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> invalid_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT"));
-        Token * newline_var;
-        if (
-            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
-            &&
-            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT)  // token=INDENT
-        )
-        {
-            D(fprintf(stderr, "%*c+ invalid_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT"));
-            _res = RAISE_INDENTATION_ERROR ( "expected an indented block" );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s invalid_block[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE !INDENT"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// Left-recursive
-// invalid_primary: primary '{'
-static void *
-invalid_primary_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // primary '{'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> invalid_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "primary '{'"));
-        Token * a;
-        expr_ty primary_var;
-        if (
-            (primary_var = primary_rule(p))  // primary
-            &&
-            (a = _PyPegen_expect_token(p, 25))  // token='{'
-        )
-        {
-            D(fprintf(stderr, "%*c+ invalid_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "primary '{'"));
-            _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "invalid syntax" );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s invalid_primary[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '{'"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// invalid_comprehension: ('[' | '(' | '{') starred_expression for_if_clauses
-static void *
-invalid_comprehension_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // ('[' | '(' | '{') starred_expression for_if_clauses
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses"));
-        void *_tmp_130_var;
-        expr_ty a;
-        asdl_seq* for_if_clauses_var;
-        if (
-            (_tmp_130_var = _tmp_130_rule(p))  // '[' | '(' | '{'
-            &&
-            (a = starred_expression_rule(p))  // starred_expression
-            &&
-            (for_if_clauses_var = for_if_clauses_rule(p))  // for_if_clauses
-        )
-        {
-            D(fprintf(stderr, "%*c+ invalid_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses"));
-            _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "iterable unpacking cannot be used in comprehension" );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s invalid_comprehension[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// invalid_dict_comprehension: '{' '**' bitwise_or for_if_clauses '}'
-static void *
-invalid_dict_comprehension_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // '{' '**' bitwise_or for_if_clauses '}'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> invalid_dict_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
-        Token * _literal;
-        Token * _literal_1;
-        Token * a;
-        expr_ty bitwise_or_var;
-        asdl_seq* for_if_clauses_var;
-        if (
-            (_literal = _PyPegen_expect_token(p, 25))  // token='{'
-            &&
-            (a = _PyPegen_expect_token(p, 35))  // token='**'
-            &&
-            (bitwise_or_var = bitwise_or_rule(p))  // bitwise_or
-            &&
-            (for_if_clauses_var = for_if_clauses_rule(p))  // for_if_clauses
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 26))  // token='}'
-        )
-        {
-            D(fprintf(stderr, "%*c+ invalid_dict_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
-            _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "dict unpacking cannot be used in dict comprehension" );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s invalid_dict_comprehension[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// invalid_parameters:
-//     | param_no_default* (slash_with_default | param_with_default+) param_no_default
-static void *
-invalid_parameters_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // param_no_default* (slash_with_default | param_with_default+) param_no_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* (slash_with_default | param_with_default+) param_no_default"));
-        asdl_seq * _loop0_131_var;
-        void *_tmp_132_var;
-        arg_ty param_no_default_var;
-        if (
-            (_loop0_131_var = _loop0_131_rule(p))  // param_no_default*
-            &&
-            (_tmp_132_var = _tmp_132_rule(p))  // slash_with_default | param_with_default+
-            &&
-            (param_no_default_var = param_no_default_rule(p))  // param_no_default
-        )
-        {
-            D(fprintf(stderr, "%*c+ invalid_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* (slash_with_default | param_with_default+) param_no_default"));
-            _res = RAISE_SYNTAX_ERROR ( "non-default argument follows default argument" );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s invalid_parameters[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* (slash_with_default | param_with_default+) param_no_default"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// invalid_lambda_parameters:
-//     | lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default
-static void *
-invalid_lambda_parameters_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> invalid_lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default"));
-        asdl_seq * _loop0_133_var;
-        void *_tmp_134_var;
-        arg_ty lambda_param_no_default_var;
-        if (
-            (_loop0_133_var = _loop0_133_rule(p))  // lambda_param_no_default*
-            &&
-            (_tmp_134_var = _tmp_134_rule(p))  // lambda_slash_with_default | lambda_param_with_default+
-            &&
-            (lambda_param_no_default_var = lambda_param_no_default_rule(p))  // lambda_param_no_default
-        )
-        {
-            D(fprintf(stderr, "%*c+ invalid_lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default"));
-            _res = RAISE_SYNTAX_ERROR ( "non-default argument follows default argument" );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s invalid_lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// invalid_star_etc: '*' (')' | ',' (')' | '**')) | '*' ',' TYPE_COMMENT
-static void *
-invalid_star_etc_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // '*' (')' | ',' (')' | '**'))
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
-        Token * _literal;
-        void *_tmp_135_var;
-        if (
-            (_literal = _PyPegen_expect_token(p, 16))  // token='*'
-            &&
-            (_tmp_135_var = _tmp_135_rule(p))  // ')' | ',' (')' | '**')
-        )
-        {
-            D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
-            _res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
-    }
-    { // '*' ',' TYPE_COMMENT
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT"));
-        Token * _literal;
-        Token * _literal_1;
-        Token * type_comment_var;
-        if (
-            (_literal = _PyPegen_expect_token(p, 16))  // token='*'
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT))  // token='TYPE_COMMENT'
-        )
-        {
-            D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT"));
-            _res = RAISE_SYNTAX_ERROR ( "bare * has associated type comment" );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' TYPE_COMMENT"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// invalid_lambda_star_etc: '*' (':' | ',' (':' | '**'))
-static void *
-invalid_lambda_star_etc_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // '*' (':' | ',' (':' | '**'))
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> invalid_lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
-        Token * _literal;
-        void *_tmp_136_var;
-        if (
-            (_literal = _PyPegen_expect_token(p, 16))  // token='*'
-            &&
-            (_tmp_136_var = _tmp_136_rule(p))  // ':' | ',' (':' | '**')
-        )
-        {
-            D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
-            _res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s invalid_lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// invalid_double_type_comments: TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT
-static void *
-invalid_double_type_comments_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> invalid_double_type_comments[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT"));
-        Token * indent_var;
-        Token * newline_var;
-        Token * newline_var_1;
-        Token * type_comment_var;
-        Token * type_comment_var_1;
-        if (
-            (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT))  // token='TYPE_COMMENT'
-            &&
-            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
-            &&
-            (type_comment_var_1 = _PyPegen_expect_token(p, TYPE_COMMENT))  // token='TYPE_COMMENT'
-            &&
-            (newline_var_1 = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
-            &&
-            (indent_var = _PyPegen_expect_token(p, INDENT))  // token='INDENT'
-        )
-        {
-            D(fprintf(stderr, "%*c+ invalid_double_type_comments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT"));
-            _res = RAISE_SYNTAX_ERROR ( "Cannot have two type comments on def" );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s invalid_double_type_comments[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// invalid_with_item: expression 'as' expression
-static void *
-invalid_with_item_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // expression 'as' expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> invalid_with_item[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression 'as' expression"));
-        Token * _keyword;
-        expr_ty a;
-        expr_ty expression_var;
-        if (
-            (expression_var = expression_rule(p))  // expression
-            &&
-            (_keyword = _PyPegen_expect_token(p, 520))  // token='as'
-            &&
-            (a = expression_rule(p))  // expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ invalid_with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression 'as' expression"));
-            _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( STAR_TARGETS , a );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s invalid_with_item[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression 'as' expression"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// invalid_for_target: ASYNC? 'for' star_expressions
-static void *
-invalid_for_target_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // ASYNC? 'for' star_expressions
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> invalid_for_target[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC? 'for' star_expressions"));
-        Token * _keyword;
-        void *_opt_var;
-        UNUSED(_opt_var); // Silence compiler warnings
-        expr_ty a;
-        if (
-            (_opt_var = _PyPegen_expect_token(p, ASYNC), 1)  // ASYNC?
-            &&
-            (_keyword = _PyPegen_expect_token(p, 517))  // token='for'
-            &&
-            (a = star_expressions_rule(p))  // star_expressions
-        )
-        {
-            D(fprintf(stderr, "%*c+ invalid_for_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC? 'for' star_expressions"));
-            _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( FOR_TARGETS , a );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s invalid_for_target[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC? 'for' star_expressions"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// invalid_group: '(' starred_expression ')'
-static void *
-invalid_group_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // '(' starred_expression ')'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> invalid_group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' starred_expression ')'"));
-        Token * _literal;
-        Token * _literal_1;
-        expr_ty a;
-        if (
-            (_literal = _PyPegen_expect_token(p, 7))  // token='('
-            &&
-            (a = starred_expression_rule(p))  // starred_expression
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
-        )
-        {
-            D(fprintf(stderr, "%*c+ invalid_group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' starred_expression ')'"));
-            _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "can't use starred expression here" );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s invalid_group[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' starred_expression ')'"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// invalid_import_from_targets: import_from_as_names ','
-static void *
-invalid_import_from_targets_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // import_from_as_names ','
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> invalid_import_from_targets[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_names ','"));
-        Token * _literal;
-        asdl_seq* import_from_as_names_var;
-        if (
-            (import_from_as_names_var = import_from_as_names_rule(p))  // import_from_as_names
-            &&
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-        )
-        {
-            D(fprintf(stderr, "%*c+ invalid_import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names ','"));
-            _res = RAISE_SYNTAX_ERROR ( "trailing comma not allowed without surrounding parentheses" );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s invalid_import_from_targets[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names ','"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _loop0_1: NEWLINE
-static asdl_seq *
-_loop0_1_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // NEWLINE
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_1[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
-        Token * newline_var;
-        while (
-            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
-        )
-        {
-            _res = newline_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_1[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_1_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop0_2: NEWLINE
-static asdl_seq *
-_loop0_2_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // NEWLINE
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_2[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
-        Token * newline_var;
-        while (
-            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
-        )
-        {
-            _res = newline_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_2[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_2_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop0_4: ',' expression
-static asdl_seq *
-_loop0_4_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // ',' expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_4[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
-        Token * _literal;
-        expr_ty elem;
-        while (
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (elem = expression_rule(p))  // expression
-        )
-        {
-            _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                PyMem_Free(_children);
-                D(p->level--);
-                return NULL;
-            }
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_4[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_4_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _gather_3: expression _loop0_4
-static asdl_seq *
-_gather_3_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq * _res = NULL;
-    int _mark = p->mark;
-    { // expression _loop0_4
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _gather_3[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_4"));
-        expr_ty elem;
-        asdl_seq * seq;
-        if (
-            (elem = expression_rule(p))  // expression
-            &&
-            (seq = _loop0_4_rule(p))  // _loop0_4
-        )
-        {
-            D(fprintf(stderr, "%*c+ _gather_3[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_4"));
-            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _gather_3[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_4"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _loop0_6: ',' expression
-static asdl_seq *
-_loop0_6_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // ',' expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_6[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
-        Token * _literal;
-        expr_ty elem;
-        while (
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (elem = expression_rule(p))  // expression
-        )
-        {
-            _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                PyMem_Free(_children);
-                D(p->level--);
-                return NULL;
-            }
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_6[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_6_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _gather_5: expression _loop0_6
-static asdl_seq *
-_gather_5_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq * _res = NULL;
-    int _mark = p->mark;
-    { // expression _loop0_6
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _gather_5[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_6"));
-        expr_ty elem;
-        asdl_seq * seq;
-        if (
-            (elem = expression_rule(p))  // expression
-            &&
-            (seq = _loop0_6_rule(p))  // _loop0_6
-        )
-        {
-            D(fprintf(stderr, "%*c+ _gather_5[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_6"));
-            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _gather_5[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_6"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _loop0_8: ',' expression
-static asdl_seq *
-_loop0_8_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // ',' expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_8[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
-        Token * _literal;
-        expr_ty elem;
-        while (
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (elem = expression_rule(p))  // expression
-        )
-        {
-            _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                PyMem_Free(_children);
-                D(p->level--);
-                return NULL;
-            }
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_8[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_8_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _gather_7: expression _loop0_8
-static asdl_seq *
-_gather_7_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq * _res = NULL;
-    int _mark = p->mark;
-    { // expression _loop0_8
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _gather_7[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_8"));
-        expr_ty elem;
-        asdl_seq * seq;
-        if (
-            (elem = expression_rule(p))  // expression
-            &&
-            (seq = _loop0_8_rule(p))  // _loop0_8
-        )
-        {
-            D(fprintf(stderr, "%*c+ _gather_7[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_8"));
-            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _gather_7[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_8"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _loop0_10: ',' expression
-static asdl_seq *
-_loop0_10_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // ',' expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_10[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
-        Token * _literal;
-        expr_ty elem;
-        while (
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (elem = expression_rule(p))  // expression
-        )
-        {
-            _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                PyMem_Free(_children);
-                D(p->level--);
-                return NULL;
-            }
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_10[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_10_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _gather_9: expression _loop0_10
-static asdl_seq *
-_gather_9_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq * _res = NULL;
-    int _mark = p->mark;
-    { // expression _loop0_10
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _gather_9[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_10"));
-        expr_ty elem;
-        asdl_seq * seq;
-        if (
-            (elem = expression_rule(p))  // expression
-            &&
-            (seq = _loop0_10_rule(p))  // _loop0_10
-        )
-        {
-            D(fprintf(stderr, "%*c+ _gather_9[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_10"));
-            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _gather_9[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_10"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _loop1_11: statement
-static asdl_seq *
-_loop1_11_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // statement
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop1_11[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement"));
-        asdl_seq* statement_var;
-        while (
-            (statement_var = statement_rule(p))  // statement
-        )
-        {
-            _res = statement_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop1_11[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement"));
-    }
-    if (_n == 0 || p->error_indicator) {
-        PyMem_Free(_children);
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop1_11_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop0_13: ';' small_stmt
-static asdl_seq *
-_loop0_13_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // ';' small_stmt
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_13[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';' small_stmt"));
-        Token * _literal;
-        stmt_ty elem;
-        while (
-            (_literal = _PyPegen_expect_token(p, 13))  // token=';'
-            &&
-            (elem = small_stmt_rule(p))  // small_stmt
-        )
-        {
-            _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                PyMem_Free(_children);
-                D(p->level--);
-                return NULL;
-            }
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_13[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';' small_stmt"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_13_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _gather_12: small_stmt _loop0_13
-static asdl_seq *
-_gather_12_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq * _res = NULL;
-    int _mark = p->mark;
-    { // small_stmt _loop0_13
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _gather_12[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "small_stmt _loop0_13"));
-        stmt_ty elem;
-        asdl_seq * seq;
-        if (
-            (elem = small_stmt_rule(p))  // small_stmt
-            &&
-            (seq = _loop0_13_rule(p))  // _loop0_13
-        )
-        {
-            D(fprintf(stderr, "%*c+ _gather_12[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "small_stmt _loop0_13"));
-            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _gather_12[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "small_stmt _loop0_13"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_14: 'import' | 'from'
-static void *
-_tmp_14_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // 'import'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import'"));
-        Token * _keyword;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 513))  // token='import'
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_14[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import'"));
-            _res = _keyword;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import'"));
-    }
-    { // 'from'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from'"));
-        Token * _keyword;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 514))  // token='from'
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_14[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from'"));
-            _res = _keyword;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from'"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_15: 'def' | '@' | ASYNC
-static void *
-_tmp_15_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // 'def'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def'"));
-        Token * _keyword;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 523))  // token='def'
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'def'"));
-            _res = _keyword;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def'"));
-    }
-    { // '@'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 49))  // token='@'
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'"));
-            _res = _literal;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'"));
-    }
-    { // ASYNC
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
-        Token * async_var;
-        if (
-            (async_var = _PyPegen_expect_token(p, ASYNC))  // token='ASYNC'
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
-            _res = async_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_16: 'class' | '@'
-static void *
-_tmp_16_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // 'class'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class'"));
-        Token * _keyword;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 524))  // token='class'
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class'"));
-            _res = _keyword;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class'"));
-    }
-    { // '@'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 49))  // token='@'
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'"));
-            _res = _literal;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_17: 'with' | ASYNC
-static void *
-_tmp_17_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // 'with'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with'"));
-        Token * _keyword;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 519))  // token='with'
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with'"));
-            _res = _keyword;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with'"));
-    }
-    { // ASYNC
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
-        Token * async_var;
-        if (
-            (async_var = _PyPegen_expect_token(p, ASYNC))  // token='ASYNC'
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
-            _res = async_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_18: 'for' | ASYNC
-static void *
-_tmp_18_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // 'for'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for'"));
-        Token * _keyword;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 517))  // token='for'
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_18[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for'"));
-            _res = _keyword;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for'"));
-    }
-    { // ASYNC
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
-        Token * async_var;
-        if (
-            (async_var = _PyPegen_expect_token(p, ASYNC))  // token='ASYNC'
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_18[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
-            _res = async_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_19: '=' annotated_rhs
-static void *
-_tmp_19_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // '=' annotated_rhs
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_19[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
-        Token * _literal;
-        expr_ty d;
-        if (
-            (_literal = _PyPegen_expect_token(p, 22))  // token='='
-            &&
-            (d = annotated_rhs_rule(p))  // annotated_rhs
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_19[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
-            _res = d;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_19[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_20: '(' single_target ')' | single_subscript_attribute_target
-static void *
-_tmp_20_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // '(' single_target ')'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
-        Token * _literal;
-        Token * _literal_1;
-        expr_ty b;
-        if (
-            (_literal = _PyPegen_expect_token(p, 7))  // token='('
-            &&
-            (b = single_target_rule(p))  // single_target
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_20[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
-            _res = b;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'"));
-    }
-    { // single_subscript_attribute_target
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
-        expr_ty single_subscript_attribute_target_var;
-        if (
-            (single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p))  // single_subscript_attribute_target
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_20[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
-            _res = single_subscript_attribute_target_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_21: '=' annotated_rhs
-static void *
-_tmp_21_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // '=' annotated_rhs
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_21[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
-        Token * _literal;
-        expr_ty d;
-        if (
-            (_literal = _PyPegen_expect_token(p, 22))  // token='='
-            &&
-            (d = annotated_rhs_rule(p))  // annotated_rhs
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_21[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
-            _res = d;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_21[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _loop1_22: (star_targets '=')
-static asdl_seq *
-_loop1_22_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // (star_targets '=')
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop1_22[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
-        void *_tmp_137_var;
-        while (
-            (_tmp_137_var = _tmp_137_rule(p))  // star_targets '='
-        )
-        {
-            _res = _tmp_137_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop1_22[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
-    }
-    if (_n == 0 || p->error_indicator) {
-        PyMem_Free(_children);
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop1_22_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _tmp_23: yield_expr | star_expressions
-static void *
-_tmp_23_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // yield_expr
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
-        expr_ty yield_expr_var;
-        if (
-            (yield_expr_var = yield_expr_rule(p))  // yield_expr
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
-            _res = yield_expr_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
-    }
-    { // star_expressions
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
-        expr_ty star_expressions_var;
-        if (
-            (star_expressions_var = star_expressions_rule(p))  // star_expressions
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
-            _res = star_expressions_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_24: yield_expr | star_expressions
-static void *
-_tmp_24_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // yield_expr
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
-        expr_ty yield_expr_var;
-        if (
-            (yield_expr_var = yield_expr_rule(p))  // yield_expr
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
-            _res = yield_expr_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
-    }
-    { // star_expressions
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
-        expr_ty star_expressions_var;
-        if (
-            (star_expressions_var = star_expressions_rule(p))  // star_expressions
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
-            _res = star_expressions_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _loop0_26: ',' NAME
-static asdl_seq *
-_loop0_26_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // ',' NAME
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_26[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME"));
-        Token * _literal;
-        expr_ty elem;
-        while (
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (elem = _PyPegen_name_token(p))  // NAME
-        )
-        {
-            _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                PyMem_Free(_children);
-                D(p->level--);
-                return NULL;
-            }
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_26[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_26_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _gather_25: NAME _loop0_26
-static asdl_seq *
-_gather_25_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq * _res = NULL;
-    int _mark = p->mark;
-    { // NAME _loop0_26
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _gather_25[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26"));
-        expr_ty elem;
-        asdl_seq * seq;
-        if (
-            (elem = _PyPegen_name_token(p))  // NAME
-            &&
-            (seq = _loop0_26_rule(p))  // _loop0_26
-        )
-        {
-            D(fprintf(stderr, "%*c+ _gather_25[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26"));
-            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _gather_25[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_26"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _loop0_28: ',' NAME
-static asdl_seq *
-_loop0_28_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // ',' NAME
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_28[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME"));
-        Token * _literal;
-        expr_ty elem;
-        while (
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (elem = _PyPegen_name_token(p))  // NAME
-        )
-        {
-            _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                PyMem_Free(_children);
-                D(p->level--);
-                return NULL;
-            }
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_28[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_28_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _gather_27: NAME _loop0_28
-static asdl_seq *
-_gather_27_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq * _res = NULL;
-    int _mark = p->mark;
-    { // NAME _loop0_28
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _gather_27[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28"));
-        expr_ty elem;
-        asdl_seq * seq;
-        if (
-            (elem = _PyPegen_name_token(p))  // NAME
-            &&
-            (seq = _loop0_28_rule(p))  // _loop0_28
-        )
-        {
-            D(fprintf(stderr, "%*c+ _gather_27[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28"));
-            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _gather_27[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_28"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_29: ',' expression
-static void *
-_tmp_29_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // ',' expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_29[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
-        Token * _literal;
-        expr_ty z;
-        if (
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (z = expression_rule(p))  // expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_29[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression"));
-            _res = z;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_29[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_30: ';' | NEWLINE
-static void *
-_tmp_30_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // ';'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 13))  // token=';'
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_30[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'"));
-            _res = _literal;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_30[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'"));
-    }
-    { // NEWLINE
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
-        Token * newline_var;
-        if (
-            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_30[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
-            _res = newline_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_30[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _loop0_31: ('.' | '...')
-static asdl_seq *
-_loop0_31_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // ('.' | '...')
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_31[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')"));
-        void *_tmp_138_var;
-        while (
-            (_tmp_138_var = _tmp_138_rule(p))  // '.' | '...'
-        )
-        {
-            _res = _tmp_138_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_31[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_31_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop1_32: ('.' | '...')
-static asdl_seq *
-_loop1_32_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // ('.' | '...')
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop1_32[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')"));
-        void *_tmp_139_var;
-        while (
-            (_tmp_139_var = _tmp_139_rule(p))  // '.' | '...'
-        )
-        {
-            _res = _tmp_139_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop1_32[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')"));
-    }
-    if (_n == 0 || p->error_indicator) {
-        PyMem_Free(_children);
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop1_32_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop0_34: ',' import_from_as_name
-static asdl_seq *
-_loop0_34_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // ',' import_from_as_name
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_34[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' import_from_as_name"));
-        Token * _literal;
-        alias_ty elem;
-        while (
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (elem = import_from_as_name_rule(p))  // import_from_as_name
-        )
-        {
-            _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                PyMem_Free(_children);
-                D(p->level--);
-                return NULL;
-            }
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_34[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' import_from_as_name"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_34_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _gather_33: import_from_as_name _loop0_34
-static asdl_seq *
-_gather_33_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq * _res = NULL;
-    int _mark = p->mark;
-    { // import_from_as_name _loop0_34
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _gather_33[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_name _loop0_34"));
-        alias_ty elem;
-        asdl_seq * seq;
-        if (
-            (elem = import_from_as_name_rule(p))  // import_from_as_name
-            &&
-            (seq = _loop0_34_rule(p))  // _loop0_34
-        )
-        {
-            D(fprintf(stderr, "%*c+ _gather_33[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_name _loop0_34"));
-            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _gather_33[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_name _loop0_34"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_35: 'as' NAME
-static void *
-_tmp_35_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // 'as' NAME
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_35[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
-        Token * _keyword;
-        expr_ty z;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 520))  // token='as'
-            &&
-            (z = _PyPegen_name_token(p))  // NAME
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_35[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
-            _res = z;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_35[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _loop0_37: ',' dotted_as_name
-static asdl_seq *
-_loop0_37_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // ',' dotted_as_name
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_37[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' dotted_as_name"));
-        Token * _literal;
-        alias_ty elem;
-        while (
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (elem = dotted_as_name_rule(p))  // dotted_as_name
-        )
-        {
-            _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                PyMem_Free(_children);
-                D(p->level--);
-                return NULL;
-            }
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_37[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' dotted_as_name"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_37_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _gather_36: dotted_as_name _loop0_37
-static asdl_seq *
-_gather_36_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq * _res = NULL;
-    int _mark = p->mark;
-    { // dotted_as_name _loop0_37
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _gather_36[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_as_name _loop0_37"));
-        alias_ty elem;
-        asdl_seq * seq;
-        if (
-            (elem = dotted_as_name_rule(p))  // dotted_as_name
-            &&
-            (seq = _loop0_37_rule(p))  // _loop0_37
-        )
-        {
-            D(fprintf(stderr, "%*c+ _gather_36[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_as_name _loop0_37"));
-            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _gather_36[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_as_name _loop0_37"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_38: 'as' NAME
-static void *
-_tmp_38_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // 'as' NAME
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_38[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
-        Token * _keyword;
-        expr_ty z;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 520))  // token='as'
-            &&
-            (z = _PyPegen_name_token(p))  // NAME
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_38[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
-            _res = z;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_38[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _loop0_40: ',' with_item
-static asdl_seq *
-_loop0_40_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // ',' with_item
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_40[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
-        Token * _literal;
-        withitem_ty elem;
-        while (
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (elem = with_item_rule(p))  // with_item
-        )
-        {
-            _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                PyMem_Free(_children);
-                D(p->level--);
-                return NULL;
-            }
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_40[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_40_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _gather_39: with_item _loop0_40
-static asdl_seq *
-_gather_39_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq * _res = NULL;
-    int _mark = p->mark;
-    { // with_item _loop0_40
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _gather_39[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_40"));
-        withitem_ty elem;
-        asdl_seq * seq;
-        if (
-            (elem = with_item_rule(p))  // with_item
-            &&
-            (seq = _loop0_40_rule(p))  // _loop0_40
-        )
-        {
-            D(fprintf(stderr, "%*c+ _gather_39[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_40"));
-            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _gather_39[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_40"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _loop0_42: ',' with_item
-static asdl_seq *
-_loop0_42_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // ',' with_item
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_42[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
-        Token * _literal;
-        withitem_ty elem;
-        while (
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (elem = with_item_rule(p))  // with_item
-        )
-        {
-            _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                PyMem_Free(_children);
-                D(p->level--);
-                return NULL;
-            }
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_42[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_42_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _gather_41: with_item _loop0_42
-static asdl_seq *
-_gather_41_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq * _res = NULL;
-    int _mark = p->mark;
-    { // with_item _loop0_42
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _gather_41[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_42"));
-        withitem_ty elem;
-        asdl_seq * seq;
-        if (
-            (elem = with_item_rule(p))  // with_item
-            &&
-            (seq = _loop0_42_rule(p))  // _loop0_42
-        )
-        {
-            D(fprintf(stderr, "%*c+ _gather_41[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_42"));
-            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _gather_41[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_42"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _loop0_44: ',' with_item
-static asdl_seq *
-_loop0_44_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // ',' with_item
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_44[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
-        Token * _literal;
-        withitem_ty elem;
-        while (
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (elem = with_item_rule(p))  // with_item
-        )
-        {
-            _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                PyMem_Free(_children);
-                D(p->level--);
-                return NULL;
-            }
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_44[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_44_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _gather_43: with_item _loop0_44
-static asdl_seq *
-_gather_43_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq * _res = NULL;
-    int _mark = p->mark;
-    { // with_item _loop0_44
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _gather_43[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_44"));
-        withitem_ty elem;
-        asdl_seq * seq;
-        if (
-            (elem = with_item_rule(p))  // with_item
-            &&
-            (seq = _loop0_44_rule(p))  // _loop0_44
-        )
-        {
-            D(fprintf(stderr, "%*c+ _gather_43[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_44"));
-            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _gather_43[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_44"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _loop0_46: ',' with_item
-static asdl_seq *
-_loop0_46_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // ',' with_item
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_46[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
-        Token * _literal;
-        withitem_ty elem;
-        while (
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (elem = with_item_rule(p))  // with_item
-        )
-        {
-            _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                PyMem_Free(_children);
-                D(p->level--);
-                return NULL;
-            }
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_46[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_46_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _gather_45: with_item _loop0_46
-static asdl_seq *
-_gather_45_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq * _res = NULL;
-    int _mark = p->mark;
-    { // with_item _loop0_46
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _gather_45[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_46"));
-        withitem_ty elem;
-        asdl_seq * seq;
-        if (
-            (elem = with_item_rule(p))  // with_item
-            &&
-            (seq = _loop0_46_rule(p))  // _loop0_46
-        )
-        {
-            D(fprintf(stderr, "%*c+ _gather_45[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_46"));
-            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _gather_45[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_46"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_47: ',' | ')' | ':'
-static void *
-_tmp_47_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // ','
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','"));
-            _res = _literal;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','"));
-    }
-    { // ')'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 8))  // token=')'
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
-            _res = _literal;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
-    }
-    { // ':'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
-            _res = _literal;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _loop1_48: except_block
-static asdl_seq *
-_loop1_48_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // except_block
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop1_48[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "except_block"));
-        excepthandler_ty except_block_var;
-        while (
-            (except_block_var = except_block_rule(p))  // except_block
-        )
-        {
-            _res = except_block_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop1_48[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_block"));
-    }
-    if (_n == 0 || p->error_indicator) {
-        PyMem_Free(_children);
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop1_48_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _tmp_49: 'as' NAME
-static void *
-_tmp_49_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // 'as' NAME
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_49[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
-        Token * _keyword;
-        expr_ty z;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 520))  // token='as'
-            &&
-            (z = _PyPegen_name_token(p))  // NAME
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_49[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
-            _res = z;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_49[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_50: 'from' expression
-static void *
-_tmp_50_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // 'from' expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_50[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' expression"));
-        Token * _keyword;
-        expr_ty z;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 514))  // token='from'
-            &&
-            (z = expression_rule(p))  // expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_50[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' expression"));
-            _res = z;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_50[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' expression"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_51: '->' expression
-static void *
-_tmp_51_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // '->' expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_51[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression"));
-        Token * _literal;
-        expr_ty z;
-        if (
-            (_literal = _PyPegen_expect_token(p, 51))  // token='->'
-            &&
-            (z = expression_rule(p))  // expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_51[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression"));
-            _res = z;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_51[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_52: '->' expression
-static void *
-_tmp_52_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // '->' expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_52[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression"));
-        Token * _literal;
-        expr_ty z;
-        if (
-            (_literal = _PyPegen_expect_token(p, 51))  // token='->'
-            &&
-            (z = expression_rule(p))  // expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_52[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression"));
-            _res = z;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_52[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_53: NEWLINE INDENT
-static void *
-_tmp_53_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // NEWLINE INDENT
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT"));
-        Token * indent_var;
-        Token * newline_var;
-        if (
-            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
-            &&
-            (indent_var = _PyPegen_expect_token(p, INDENT))  // token='INDENT'
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_53[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT"));
-            _res = _PyPegen_dummy_name(p, newline_var, indent_var);
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_53[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _loop0_54: param_no_default
-static asdl_seq *
-_loop0_54_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // param_no_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
-        arg_ty param_no_default_var;
-        while (
-            (param_no_default_var = param_no_default_rule(p))  // param_no_default
-        )
-        {
-            _res = param_no_default_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_54[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_54_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop0_55: param_with_default
-static asdl_seq *
-_loop0_55_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // param_with_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
-        NameDefaultPair* param_with_default_var;
-        while (
-            (param_with_default_var = param_with_default_rule(p))  // param_with_default
-        )
-        {
-            _res = param_with_default_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_55[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_55_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop0_56: param_with_default
-static asdl_seq *
-_loop0_56_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // param_with_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
-        NameDefaultPair* param_with_default_var;
-        while (
-            (param_with_default_var = param_with_default_rule(p))  // param_with_default
-        )
-        {
-            _res = param_with_default_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_56[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_56_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop1_57: param_no_default
-static asdl_seq *
-_loop1_57_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // param_no_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop1_57[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
-        arg_ty param_no_default_var;
-        while (
-            (param_no_default_var = param_no_default_rule(p))  // param_no_default
-        )
-        {
-            _res = param_no_default_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop1_57[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
-    }
-    if (_n == 0 || p->error_indicator) {
-        PyMem_Free(_children);
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop1_57_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop0_58: param_with_default
-static asdl_seq *
-_loop0_58_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // param_with_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_58[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
-        NameDefaultPair* param_with_default_var;
-        while (
-            (param_with_default_var = param_with_default_rule(p))  // param_with_default
-        )
-        {
-            _res = param_with_default_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_58[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_58_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop1_59: param_with_default
-static asdl_seq *
-_loop1_59_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // param_with_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop1_59[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
-        NameDefaultPair* param_with_default_var;
-        while (
-            (param_with_default_var = param_with_default_rule(p))  // param_with_default
-        )
-        {
-            _res = param_with_default_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop1_59[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
-    }
-    if (_n == 0 || p->error_indicator) {
-        PyMem_Free(_children);
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop1_59_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop1_60: param_no_default
-static asdl_seq *
-_loop1_60_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // param_no_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop1_60[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
-        arg_ty param_no_default_var;
-        while (
-            (param_no_default_var = param_no_default_rule(p))  // param_no_default
-        )
-        {
-            _res = param_no_default_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop1_60[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
-    }
-    if (_n == 0 || p->error_indicator) {
-        PyMem_Free(_children);
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop1_60_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop1_61: param_no_default
-static asdl_seq *
-_loop1_61_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // param_no_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop1_61[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
-        arg_ty param_no_default_var;
-        while (
-            (param_no_default_var = param_no_default_rule(p))  // param_no_default
-        )
-        {
-            _res = param_no_default_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop1_61[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
-    }
-    if (_n == 0 || p->error_indicator) {
-        PyMem_Free(_children);
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop1_61_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop0_62: param_no_default
-static asdl_seq *
-_loop0_62_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // param_no_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_62[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
-        arg_ty param_no_default_var;
-        while (
-            (param_no_default_var = param_no_default_rule(p))  // param_no_default
-        )
-        {
-            _res = param_no_default_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_62[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_62_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop1_63: param_with_default
-static asdl_seq *
-_loop1_63_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // param_with_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop1_63[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
-        NameDefaultPair* param_with_default_var;
-        while (
-            (param_with_default_var = param_with_default_rule(p))  // param_with_default
-        )
-        {
-            _res = param_with_default_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop1_63[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
-    }
-    if (_n == 0 || p->error_indicator) {
-        PyMem_Free(_children);
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop1_63_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop0_64: param_no_default
-static asdl_seq *
-_loop0_64_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // param_no_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
-        arg_ty param_no_default_var;
-        while (
-            (param_no_default_var = param_no_default_rule(p))  // param_no_default
-        )
-        {
-            _res = param_no_default_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_64[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_64_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop1_65: param_with_default
-static asdl_seq *
-_loop1_65_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // param_with_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop1_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
-        NameDefaultPair* param_with_default_var;
-        while (
-            (param_with_default_var = param_with_default_rule(p))  // param_with_default
-        )
-        {
-            _res = param_with_default_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop1_65[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
-    }
-    if (_n == 0 || p->error_indicator) {
-        PyMem_Free(_children);
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop1_65_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop0_66: param_maybe_default
-static asdl_seq *
-_loop0_66_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // param_maybe_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default"));
-        NameDefaultPair* param_maybe_default_var;
-        while (
-            (param_maybe_default_var = param_maybe_default_rule(p))  // param_maybe_default
-        )
-        {
-            _res = param_maybe_default_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_66[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_66_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop1_67: param_maybe_default
-static asdl_seq *
-_loop1_67_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // param_maybe_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop1_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default"));
-        NameDefaultPair* param_maybe_default_var;
-        while (
-            (param_maybe_default_var = param_maybe_default_rule(p))  // param_maybe_default
-        )
-        {
-            _res = param_maybe_default_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop1_67[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default"));
-    }
-    if (_n == 0 || p->error_indicator) {
-        PyMem_Free(_children);
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop1_67_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop1_68: ('@' named_expression NEWLINE)
-static asdl_seq *
-_loop1_68_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // ('@' named_expression NEWLINE)
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop1_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)"));
-        void *_tmp_140_var;
-        while (
-            (_tmp_140_var = _tmp_140_rule(p))  // '@' named_expression NEWLINE
-        )
-        {
-            _res = _tmp_140_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop1_68[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('@' named_expression NEWLINE)"));
-    }
-    if (_n == 0 || p->error_indicator) {
-        PyMem_Free(_children);
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop1_68_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _tmp_69: '(' arguments? ')'
-static void *
-_tmp_69_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // '(' arguments? ')'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'"));
-        Token * _literal;
-        Token * _literal_1;
-        void *z;
-        if (
-            (_literal = _PyPegen_expect_token(p, 7))  // token='('
-            &&
-            (z = arguments_rule(p), 1)  // arguments?
-            &&
-            (_literal_1 = _PyPegen_expect_token(p, 8))  // token=')'
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'"));
-            _res = z;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_69[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' arguments? ')'"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _loop1_70: (',' star_expression)
-static asdl_seq *
-_loop1_70_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // (',' star_expression)
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop1_70[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)"));
-        void *_tmp_141_var;
-        while (
-            (_tmp_141_var = _tmp_141_rule(p))  // ',' star_expression
-        )
-        {
-            _res = _tmp_141_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop1_70[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_expression)"));
-    }
-    if (_n == 0 || p->error_indicator) {
-        PyMem_Free(_children);
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop1_70_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop0_72: ',' star_named_expression
-static asdl_seq *
-_loop0_72_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // ',' star_named_expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_named_expression"));
-        Token * _literal;
-        expr_ty elem;
-        while (
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (elem = star_named_expression_rule(p))  // star_named_expression
-        )
-        {
-            _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                PyMem_Free(_children);
-                D(p->level--);
-                return NULL;
-            }
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_72[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_named_expression"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_72_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _gather_71: star_named_expression _loop0_72
-static asdl_seq *
-_gather_71_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq * _res = NULL;
-    int _mark = p->mark;
-    { // star_named_expression _loop0_72
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _gather_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_72"));
-        expr_ty elem;
-        asdl_seq * seq;
-        if (
-            (elem = star_named_expression_rule(p))  // star_named_expression
-            &&
-            (seq = _loop0_72_rule(p))  // _loop0_72
-        )
-        {
-            D(fprintf(stderr, "%*c+ _gather_71[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_72"));
-            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _gather_71[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_72"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _loop1_73: (',' expression)
-static asdl_seq *
-_loop1_73_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // (',' expression)
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop1_73[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)"));
-        void *_tmp_142_var;
-        while (
-            (_tmp_142_var = _tmp_142_rule(p))  // ',' expression
-        )
-        {
-            _res = _tmp_142_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop1_73[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' expression)"));
-    }
-    if (_n == 0 || p->error_indicator) {
-        PyMem_Free(_children);
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop1_73_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop0_74: lambda_param_no_default
-static asdl_seq *
-_loop0_74_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // lambda_param_no_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_74[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
-        arg_ty lambda_param_no_default_var;
-        while (
-            (lambda_param_no_default_var = lambda_param_no_default_rule(p))  // lambda_param_no_default
-        )
-        {
-            _res = lambda_param_no_default_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_74[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_74_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop0_75: lambda_param_with_default
-static asdl_seq *
-_loop0_75_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // lambda_param_with_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
-        NameDefaultPair* lambda_param_with_default_var;
-        while (
-            (lambda_param_with_default_var = lambda_param_with_default_rule(p))  // lambda_param_with_default
-        )
-        {
-            _res = lambda_param_with_default_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_75[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_75_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop0_76: lambda_param_with_default
-static asdl_seq *
-_loop0_76_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // lambda_param_with_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_76[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
-        NameDefaultPair* lambda_param_with_default_var;
-        while (
-            (lambda_param_with_default_var = lambda_param_with_default_rule(p))  // lambda_param_with_default
-        )
-        {
-            _res = lambda_param_with_default_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_76[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_76_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop1_77: lambda_param_no_default
-static asdl_seq *
-_loop1_77_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // lambda_param_no_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop1_77[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
-        arg_ty lambda_param_no_default_var;
-        while (
-            (lambda_param_no_default_var = lambda_param_no_default_rule(p))  // lambda_param_no_default
-        )
-        {
-            _res = lambda_param_no_default_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop1_77[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
-    }
-    if (_n == 0 || p->error_indicator) {
-        PyMem_Free(_children);
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop1_77_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop0_78: lambda_param_with_default
-static asdl_seq *
-_loop0_78_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // lambda_param_with_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_78[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
-        NameDefaultPair* lambda_param_with_default_var;
-        while (
-            (lambda_param_with_default_var = lambda_param_with_default_rule(p))  // lambda_param_with_default
-        )
-        {
-            _res = lambda_param_with_default_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_78[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_78_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop1_79: lambda_param_with_default
-static asdl_seq *
-_loop1_79_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // lambda_param_with_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop1_79[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
-        NameDefaultPair* lambda_param_with_default_var;
-        while (
-            (lambda_param_with_default_var = lambda_param_with_default_rule(p))  // lambda_param_with_default
-        )
-        {
-            _res = lambda_param_with_default_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop1_79[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
-    }
-    if (_n == 0 || p->error_indicator) {
-        PyMem_Free(_children);
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop1_79_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop1_80: lambda_param_no_default
-static asdl_seq *
-_loop1_80_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // lambda_param_no_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop1_80[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
-        arg_ty lambda_param_no_default_var;
-        while (
-            (lambda_param_no_default_var = lambda_param_no_default_rule(p))  // lambda_param_no_default
-        )
-        {
-            _res = lambda_param_no_default_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop1_80[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
-    }
-    if (_n == 0 || p->error_indicator) {
-        PyMem_Free(_children);
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop1_80_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop1_81: lambda_param_no_default
-static asdl_seq *
-_loop1_81_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // lambda_param_no_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop1_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
-        arg_ty lambda_param_no_default_var;
-        while (
-            (lambda_param_no_default_var = lambda_param_no_default_rule(p))  // lambda_param_no_default
-        )
-        {
-            _res = lambda_param_no_default_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop1_81[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
-    }
-    if (_n == 0 || p->error_indicator) {
-        PyMem_Free(_children);
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop1_81_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop0_82: lambda_param_no_default
-static asdl_seq *
-_loop0_82_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // lambda_param_no_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
-        arg_ty lambda_param_no_default_var;
-        while (
-            (lambda_param_no_default_var = lambda_param_no_default_rule(p))  // lambda_param_no_default
-        )
-        {
-            _res = lambda_param_no_default_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_82[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_82_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop1_83: lambda_param_with_default
-static asdl_seq *
-_loop1_83_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // lambda_param_with_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop1_83[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
-        NameDefaultPair* lambda_param_with_default_var;
-        while (
-            (lambda_param_with_default_var = lambda_param_with_default_rule(p))  // lambda_param_with_default
-        )
-        {
-            _res = lambda_param_with_default_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop1_83[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
-    }
-    if (_n == 0 || p->error_indicator) {
-        PyMem_Free(_children);
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop1_83_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop0_84: lambda_param_no_default
-static asdl_seq *
-_loop0_84_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // lambda_param_no_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_84[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
-        arg_ty lambda_param_no_default_var;
-        while (
-            (lambda_param_no_default_var = lambda_param_no_default_rule(p))  // lambda_param_no_default
-        )
-        {
-            _res = lambda_param_no_default_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_84[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_84_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop1_85: lambda_param_with_default
-static asdl_seq *
-_loop1_85_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // lambda_param_with_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop1_85[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
-        NameDefaultPair* lambda_param_with_default_var;
-        while (
-            (lambda_param_with_default_var = lambda_param_with_default_rule(p))  // lambda_param_with_default
-        )
-        {
-            _res = lambda_param_with_default_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop1_85[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
-    }
-    if (_n == 0 || p->error_indicator) {
-        PyMem_Free(_children);
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop1_85_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop0_86: lambda_param_maybe_default
-static asdl_seq *
-_loop0_86_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // lambda_param_maybe_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default"));
-        NameDefaultPair* lambda_param_maybe_default_var;
-        while (
-            (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p))  // lambda_param_maybe_default
-        )
-        {
-            _res = lambda_param_maybe_default_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_86[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_86_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop1_87: lambda_param_maybe_default
-static asdl_seq *
-_loop1_87_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // lambda_param_maybe_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop1_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default"));
-        NameDefaultPair* lambda_param_maybe_default_var;
-        while (
-            (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p))  // lambda_param_maybe_default
-        )
-        {
-            _res = lambda_param_maybe_default_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop1_87[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default"));
-    }
-    if (_n == 0 || p->error_indicator) {
-        PyMem_Free(_children);
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop1_87_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop1_88: ('or' conjunction)
-static asdl_seq *
-_loop1_88_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // ('or' conjunction)
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop1_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)"));
-        void *_tmp_143_var;
-        while (
-            (_tmp_143_var = _tmp_143_rule(p))  // 'or' conjunction
-        )
-        {
-            _res = _tmp_143_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop1_88[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('or' conjunction)"));
-    }
-    if (_n == 0 || p->error_indicator) {
-        PyMem_Free(_children);
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop1_88_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop1_89: ('and' inversion)
-static asdl_seq *
-_loop1_89_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // ('and' inversion)
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop1_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)"));
-        void *_tmp_144_var;
-        while (
-            (_tmp_144_var = _tmp_144_rule(p))  // 'and' inversion
-        )
-        {
-            _res = _tmp_144_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop1_89[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('and' inversion)"));
-    }
-    if (_n == 0 || p->error_indicator) {
-        PyMem_Free(_children);
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop1_89_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop1_90: compare_op_bitwise_or_pair
-static asdl_seq *
-_loop1_90_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // compare_op_bitwise_or_pair
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop1_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compare_op_bitwise_or_pair"));
-        CmpopExprPair* compare_op_bitwise_or_pair_var;
-        while (
-            (compare_op_bitwise_or_pair_var = compare_op_bitwise_or_pair_rule(p))  // compare_op_bitwise_or_pair
-        )
-        {
-            _res = compare_op_bitwise_or_pair_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop1_90[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compare_op_bitwise_or_pair"));
-    }
-    if (_n == 0 || p->error_indicator) {
-        PyMem_Free(_children);
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop1_90_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _tmp_91: '!='
-static void *
-_tmp_91_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // '!='
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='"));
-        Token * tok;
-        if (
-            (tok = _PyPegen_expect_token(p, 28))  // token='!='
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_91[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='"));
-            _res = _PyPegen_check_barry_as_flufl ( p , tok ) ? NULL : tok;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_91[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!='"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _loop0_93: ',' slice
-static asdl_seq *
-_loop0_93_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // ',' slice
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' slice"));
-        Token * _literal;
-        expr_ty elem;
-        while (
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (elem = slice_rule(p))  // slice
-        )
-        {
-            _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                PyMem_Free(_children);
-                D(p->level--);
-                return NULL;
-            }
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_93[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' slice"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_93_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _gather_92: slice _loop0_93
-static asdl_seq *
-_gather_92_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq * _res = NULL;
-    int _mark = p->mark;
-    { // slice _loop0_93
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _gather_92[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice _loop0_93"));
-        expr_ty elem;
-        asdl_seq * seq;
-        if (
-            (elem = slice_rule(p))  // slice
-            &&
-            (seq = _loop0_93_rule(p))  // _loop0_93
-        )
-        {
-            D(fprintf(stderr, "%*c+ _gather_92[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice _loop0_93"));
-            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _gather_92[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice _loop0_93"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_94: ':' expression?
-static void *
-_tmp_94_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // ':' expression?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_94[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?"));
-        Token * _literal;
-        void *d;
-        if (
-            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
-            &&
-            (d = expression_rule(p), 1)  // expression?
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_94[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?"));
-            _res = d;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_94[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression?"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_95: tuple | group | genexp
-static void *
-_tmp_95_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // tuple
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple"));
-        expr_ty tuple_var;
-        if (
-            (tuple_var = tuple_rule(p))  // tuple
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_95[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple"));
-            _res = tuple_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_95[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple"));
-    }
-    { // group
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group"));
-        expr_ty group_var;
-        if (
-            (group_var = group_rule(p))  // group
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_95[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group"));
-            _res = group_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_95[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group"));
-    }
-    { // genexp
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp"));
-        expr_ty genexp_var;
-        if (
-            (genexp_var = genexp_rule(p))  // genexp
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_95[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp"));
-            _res = genexp_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_95[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "genexp"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_96: list | listcomp
-static void *
-_tmp_96_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // list
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list"));
-        expr_ty list_var;
-        if (
-            (list_var = list_rule(p))  // list
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_96[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list"));
-            _res = list_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_96[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list"));
-    }
-    { // listcomp
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp"));
-        expr_ty listcomp_var;
-        if (
-            (listcomp_var = listcomp_rule(p))  // listcomp
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_96[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "listcomp"));
-            _res = listcomp_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_96[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "listcomp"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_97: dict | set | dictcomp | setcomp
-static void *
-_tmp_97_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // dict
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict"));
-        expr_ty dict_var;
-        if (
-            (dict_var = dict_rule(p))  // dict
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dict"));
-            _res = dict_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dict"));
-    }
-    { // set
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set"));
-        expr_ty set_var;
-        if (
-            (set_var = set_rule(p))  // set
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set"));
-            _res = set_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "set"));
-    }
-    { // dictcomp
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp"));
-        expr_ty dictcomp_var;
-        if (
-            (dictcomp_var = dictcomp_rule(p))  // dictcomp
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dictcomp"));
-            _res = dictcomp_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dictcomp"));
-    }
-    { // setcomp
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp"));
-        expr_ty setcomp_var;
-        if (
-            (setcomp_var = setcomp_rule(p))  // setcomp
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_97[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "setcomp"));
-            _res = setcomp_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "setcomp"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _loop1_98: STRING
-static asdl_seq *
-_loop1_98_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // STRING
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop1_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING"));
-        expr_ty string_var;
-        while (
-            (string_var = _PyPegen_string_token(p))  // STRING
-        )
-        {
-            _res = string_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop1_98[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING"));
-    }
-    if (_n == 0 || p->error_indicator) {
-        PyMem_Free(_children);
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop1_98_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _tmp_99: star_named_expression ',' star_named_expressions?
-static void *
-_tmp_99_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // star_named_expression ',' star_named_expressions?
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
-        Token * _literal;
-        expr_ty y;
-        void *z;
-        if (
-            (y = star_named_expression_rule(p))  // star_named_expression
-            &&
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (z = star_named_expressions_rule(p), 1)  // star_named_expressions?
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_99[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
-            _res = _PyPegen_seq_insert_in_front ( p , y , z );
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_99[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_100: yield_expr | named_expression
-static void *
-_tmp_100_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // yield_expr
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_100[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
-        expr_ty yield_expr_var;
-        if (
-            (yield_expr_var = yield_expr_rule(p))  // yield_expr
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_100[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
-            _res = yield_expr_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_100[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
-    }
-    { // named_expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_100[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression"));
-        expr_ty named_expression_var;
-        if (
-            (named_expression_var = named_expression_rule(p))  // named_expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_100[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression"));
-            _res = named_expression_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_100[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _loop0_102: ',' double_starred_kvpair
-static asdl_seq *
-_loop0_102_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // ',' double_starred_kvpair
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair"));
-        Token * _literal;
-        KeyValuePair* elem;
-        while (
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (elem = double_starred_kvpair_rule(p))  // double_starred_kvpair
-        )
-        {
-            _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                PyMem_Free(_children);
-                D(p->level--);
-                return NULL;
-            }
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_102[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_102_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _gather_101: double_starred_kvpair _loop0_102
-static asdl_seq *
-_gather_101_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq * _res = NULL;
-    int _mark = p->mark;
-    { // double_starred_kvpair _loop0_102
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _gather_101[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_102"));
-        KeyValuePair* elem;
-        asdl_seq * seq;
-        if (
-            (elem = double_starred_kvpair_rule(p))  // double_starred_kvpair
-            &&
-            (seq = _loop0_102_rule(p))  // _loop0_102
-        )
-        {
-            D(fprintf(stderr, "%*c+ _gather_101[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_102"));
-            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _gather_101[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_102"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _loop1_103: for_if_clause
-static asdl_seq *
-_loop1_103_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // for_if_clause
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop1_103[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause"));
-        comprehension_ty for_if_clause_var;
-        while (
-            (for_if_clause_var = for_if_clause_rule(p))  // for_if_clause
-        )
-        {
-            _res = for_if_clause_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop1_103[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause"));
-    }
-    if (_n == 0 || p->error_indicator) {
-        PyMem_Free(_children);
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop1_103_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop0_104: ('if' disjunction)
-static asdl_seq *
-_loop0_104_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // ('if' disjunction)
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_104[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)"));
-        void *_tmp_145_var;
-        while (
-            (_tmp_145_var = _tmp_145_rule(p))  // 'if' disjunction
-        )
-        {
-            _res = _tmp_145_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_104[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_104_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop0_105: ('if' disjunction)
-static asdl_seq *
-_loop0_105_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // ('if' disjunction)
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_105[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)"));
-        void *_tmp_146_var;
-        while (
-            (_tmp_146_var = _tmp_146_rule(p))  // 'if' disjunction
-        )
-        {
-            _res = _tmp_146_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_105[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_105_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop0_107: ',' (starred_expression | named_expression !'=')
-static asdl_seq *
-_loop0_107_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // ',' (starred_expression | named_expression !'=')
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (starred_expression | named_expression !'=')"));
-        Token * _literal;
-        void *elem;
-        while (
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (elem = _tmp_147_rule(p))  // starred_expression | named_expression !'='
-        )
-        {
-            _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                PyMem_Free(_children);
-                D(p->level--);
-                return NULL;
-            }
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_107[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (starred_expression | named_expression !'=')"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_107_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _gather_106: (starred_expression | named_expression !'=') _loop0_107
-static asdl_seq *
-_gather_106_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq * _res = NULL;
-    int _mark = p->mark;
-    { // (starred_expression | named_expression !'=') _loop0_107
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _gather_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_107"));
-        void *elem;
-        asdl_seq * seq;
-        if (
-            (elem = _tmp_147_rule(p))  // starred_expression | named_expression !'='
-            &&
-            (seq = _loop0_107_rule(p))  // _loop0_107
-        )
-        {
-            D(fprintf(stderr, "%*c+ _gather_106[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_107"));
-            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _gather_106[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(starred_expression | named_expression !'=') _loop0_107"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_108: ',' kwargs
-static void *
-_tmp_108_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // ',' kwargs
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwargs"));
-        Token * _literal;
-        asdl_seq* k;
-        if (
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (k = kwargs_rule(p))  // kwargs
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_108[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' kwargs"));
-            _res = k;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_108[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwargs"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _loop0_110: ',' kwarg_or_starred
-static asdl_seq *
-_loop0_110_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // ',' kwarg_or_starred
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred"));
-        Token * _literal;
-        KeywordOrStarred* elem;
-        while (
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (elem = kwarg_or_starred_rule(p))  // kwarg_or_starred
-        )
-        {
-            _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                PyMem_Free(_children);
-                D(p->level--);
-                return NULL;
-            }
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_110[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_110_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _gather_109: kwarg_or_starred _loop0_110
-static asdl_seq *
-_gather_109_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq * _res = NULL;
-    int _mark = p->mark;
-    { // kwarg_or_starred _loop0_110
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _gather_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_110"));
-        KeywordOrStarred* elem;
-        asdl_seq * seq;
-        if (
-            (elem = kwarg_or_starred_rule(p))  // kwarg_or_starred
-            &&
-            (seq = _loop0_110_rule(p))  // _loop0_110
-        )
-        {
-            D(fprintf(stderr, "%*c+ _gather_109[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_110"));
-            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _gather_109[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_110"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _loop0_112: ',' kwarg_or_double_starred
-static asdl_seq *
-_loop0_112_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // ',' kwarg_or_double_starred
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred"));
-        Token * _literal;
-        KeywordOrStarred* elem;
-        while (
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (elem = kwarg_or_double_starred_rule(p))  // kwarg_or_double_starred
-        )
-        {
-            _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                PyMem_Free(_children);
-                D(p->level--);
-                return NULL;
-            }
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_112[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_112_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _gather_111: kwarg_or_double_starred _loop0_112
-static asdl_seq *
-_gather_111_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq * _res = NULL;
-    int _mark = p->mark;
-    { // kwarg_or_double_starred _loop0_112
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _gather_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_112"));
-        KeywordOrStarred* elem;
-        asdl_seq * seq;
-        if (
-            (elem = kwarg_or_double_starred_rule(p))  // kwarg_or_double_starred
-            &&
-            (seq = _loop0_112_rule(p))  // _loop0_112
-        )
-        {
-            D(fprintf(stderr, "%*c+ _gather_111[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_112"));
-            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _gather_111[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_112"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _loop0_114: ',' kwarg_or_starred
-static asdl_seq *
-_loop0_114_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // ',' kwarg_or_starred
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred"));
-        Token * _literal;
-        KeywordOrStarred* elem;
-        while (
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (elem = kwarg_or_starred_rule(p))  // kwarg_or_starred
-        )
-        {
-            _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                PyMem_Free(_children);
-                D(p->level--);
-                return NULL;
-            }
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_114[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_114_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _gather_113: kwarg_or_starred _loop0_114
-static asdl_seq *
-_gather_113_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq * _res = NULL;
-    int _mark = p->mark;
-    { // kwarg_or_starred _loop0_114
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _gather_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_114"));
-        KeywordOrStarred* elem;
-        asdl_seq * seq;
-        if (
-            (elem = kwarg_or_starred_rule(p))  // kwarg_or_starred
-            &&
-            (seq = _loop0_114_rule(p))  // _loop0_114
-        )
-        {
-            D(fprintf(stderr, "%*c+ _gather_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_114"));
-            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _gather_113[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_114"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _loop0_116: ',' kwarg_or_double_starred
-static asdl_seq *
-_loop0_116_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // ',' kwarg_or_double_starred
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred"));
-        Token * _literal;
-        KeywordOrStarred* elem;
-        while (
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (elem = kwarg_or_double_starred_rule(p))  // kwarg_or_double_starred
-        )
-        {
-            _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                PyMem_Free(_children);
-                D(p->level--);
-                return NULL;
-            }
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_116[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_116_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _gather_115: kwarg_or_double_starred _loop0_116
-static asdl_seq *
-_gather_115_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq * _res = NULL;
-    int _mark = p->mark;
-    { // kwarg_or_double_starred _loop0_116
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _gather_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_116"));
-        KeywordOrStarred* elem;
-        asdl_seq * seq;
-        if (
-            (elem = kwarg_or_double_starred_rule(p))  // kwarg_or_double_starred
-            &&
-            (seq = _loop0_116_rule(p))  // _loop0_116
-        )
-        {
-            D(fprintf(stderr, "%*c+ _gather_115[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_116"));
-            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _gather_115[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_116"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _loop0_117: (',' star_target)
-static asdl_seq *
-_loop0_117_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // (',' star_target)
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)"));
-        void *_tmp_148_var;
-        while (
-            (_tmp_148_var = _tmp_148_rule(p))  // ',' star_target
-        )
-        {
-            _res = _tmp_148_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_117[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_117_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop0_119: ',' star_target
-static asdl_seq *
-_loop0_119_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // ',' star_target
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target"));
-        Token * _literal;
-        expr_ty elem;
-        while (
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (elem = star_target_rule(p))  // star_target
-        )
-        {
-            _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                PyMem_Free(_children);
-                D(p->level--);
-                return NULL;
-            }
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_119[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_119_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _gather_118: star_target _loop0_119
-static asdl_seq *
-_gather_118_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq * _res = NULL;
-    int _mark = p->mark;
-    { // star_target _loop0_119
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _gather_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target _loop0_119"));
-        expr_ty elem;
-        asdl_seq * seq;
-        if (
-            (elem = star_target_rule(p))  // star_target
-            &&
-            (seq = _loop0_119_rule(p))  // _loop0_119
-        )
-        {
-            D(fprintf(stderr, "%*c+ _gather_118[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target _loop0_119"));
-            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _gather_118[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_119"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_120: !'*' star_target
-static void *
-_tmp_120_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // !'*' star_target
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target"));
-        expr_ty star_target_var;
-        if (
-            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 16)  // token='*'
-            &&
-            (star_target_var = star_target_rule(p))  // star_target
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_120[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!'*' star_target"));
-            _res = star_target_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_120[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!'*' star_target"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _loop0_122: ',' del_target
-static asdl_seq *
-_loop0_122_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // ',' del_target
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target"));
-        Token * _literal;
-        expr_ty elem;
-        while (
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (elem = del_target_rule(p))  // del_target
-        )
-        {
-            _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                PyMem_Free(_children);
-                D(p->level--);
-                return NULL;
-            }
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_122[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' del_target"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_122_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _gather_121: del_target _loop0_122
-static asdl_seq *
-_gather_121_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq * _res = NULL;
-    int _mark = p->mark;
-    { // del_target _loop0_122
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _gather_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_target _loop0_122"));
-        expr_ty elem;
-        asdl_seq * seq;
-        if (
-            (elem = del_target_rule(p))  // del_target
-            &&
-            (seq = _loop0_122_rule(p))  // _loop0_122
-        )
-        {
-            D(fprintf(stderr, "%*c+ _gather_121[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_target _loop0_122"));
-            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _gather_121[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_122"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _loop0_124: ',' target
-static asdl_seq *
-_loop0_124_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // ',' target
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' target"));
-        Token * _literal;
-        expr_ty elem;
-        while (
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (elem = target_rule(p))  // target
-        )
-        {
-            _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                PyMem_Free(_children);
-                D(p->level--);
-                return NULL;
-            }
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_124[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' target"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_124_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _gather_123: target _loop0_124
-static asdl_seq *
-_gather_123_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq * _res = NULL;
-    int _mark = p->mark;
-    { // target _loop0_124
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _gather_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "target _loop0_124"));
-        expr_ty elem;
-        asdl_seq * seq;
-        if (
-            (elem = target_rule(p))  // target
-            &&
-            (seq = _loop0_124_rule(p))  // _loop0_124
-        )
-        {
-            D(fprintf(stderr, "%*c+ _gather_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "target _loop0_124"));
-            _res = _PyPegen_seq_insert_in_front(p, elem, seq);
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _gather_123[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target _loop0_124"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_125: args | expression for_if_clauses
-static void *
-_tmp_125_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // args
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args"));
-        expr_ty args_var;
-        if (
-            (args_var = args_rule(p))  // args
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args"));
-            _res = args_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args"));
-    }
-    { // expression for_if_clauses
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses"));
-        expr_ty expression_var;
-        asdl_seq* for_if_clauses_var;
-        if (
-            (expression_var = expression_rule(p))  // expression
-            &&
-            (for_if_clauses_var = for_if_clauses_rule(p))  // for_if_clauses
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses"));
-            _res = _PyPegen_dummy_name(p, expression_var, for_if_clauses_var);
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _loop0_126: star_named_expressions
-static asdl_seq *
-_loop0_126_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // star_named_expressions
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions"));
-        asdl_seq* star_named_expressions_var;
-        while (
-            (star_named_expressions_var = star_named_expressions_rule(p))  // star_named_expressions
-        )
-        {
-            _res = star_named_expressions_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_126[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expressions"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_126_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop0_127: (star_targets '=')
-static asdl_seq *
-_loop0_127_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // (star_targets '=')
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
-        void *_tmp_149_var;
-        while (
-            (_tmp_149_var = _tmp_149_rule(p))  // star_targets '='
-        )
-        {
-            _res = _tmp_149_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_127[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_127_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop0_128: (star_targets '=')
-static asdl_seq *
-_loop0_128_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // (star_targets '=')
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
-        void *_tmp_150_var;
-        while (
-            (_tmp_150_var = _tmp_150_rule(p))  // star_targets '='
-        )
-        {
-            _res = _tmp_150_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_128[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_128_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _tmp_129: yield_expr | star_expressions
-static void *
-_tmp_129_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // yield_expr
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
-        expr_ty yield_expr_var;
-        if (
-            (yield_expr_var = yield_expr_rule(p))  // yield_expr
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_129[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
-            _res = yield_expr_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_129[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
-    }
-    { // star_expressions
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
-        expr_ty star_expressions_var;
-        if (
-            (star_expressions_var = star_expressions_rule(p))  // star_expressions
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_129[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
-            _res = star_expressions_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_129[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_130: '[' | '(' | '{'
-static void *
-_tmp_130_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // '['
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 9))  // token='['
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_130[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['"));
-            _res = _literal;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_130[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['"));
-    }
-    { // '('
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 7))  // token='('
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_130[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('"));
-            _res = _literal;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_130[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('"));
-    }
-    { // '{'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 25))  // token='{'
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_130[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'"));
-            _res = _literal;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_130[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _loop0_131: param_no_default
-static asdl_seq *
-_loop0_131_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // param_no_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
-        arg_ty param_no_default_var;
-        while (
-            (param_no_default_var = param_no_default_rule(p))  // param_no_default
-        )
-        {
-            _res = param_no_default_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_131[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_131_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _tmp_132: slash_with_default | param_with_default+
-static void *
-_tmp_132_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // slash_with_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default"));
-        SlashWithDefault* slash_with_default_var;
-        if (
-            (slash_with_default_var = slash_with_default_rule(p))  // slash_with_default
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default"));
-            _res = slash_with_default_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_132[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default"));
-    }
-    { // param_with_default+
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+"));
-        asdl_seq * _loop1_151_var;
-        if (
-            (_loop1_151_var = _loop1_151_rule(p))  // param_with_default+
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+"));
-            _res = _loop1_151_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_132[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _loop0_133: lambda_param_no_default
-static asdl_seq *
-_loop0_133_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // lambda_param_no_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop0_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
-        arg_ty lambda_param_no_default_var;
-        while (
-            (lambda_param_no_default_var = lambda_param_no_default_rule(p))  // lambda_param_no_default
-        )
-        {
-            _res = lambda_param_no_default_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop0_133[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop0_133_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _tmp_134: lambda_slash_with_default | lambda_param_with_default+
-static void *
-_tmp_134_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // lambda_slash_with_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default"));
-        SlashWithDefault* lambda_slash_with_default_var;
-        if (
-            (lambda_slash_with_default_var = lambda_slash_with_default_rule(p))  // lambda_slash_with_default
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_134[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default"));
-            _res = lambda_slash_with_default_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_134[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default"));
-    }
-    { // lambda_param_with_default+
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+"));
-        asdl_seq * _loop1_152_var;
-        if (
-            (_loop1_152_var = _loop1_152_rule(p))  // lambda_param_with_default+
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_134[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+"));
-            _res = _loop1_152_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_134[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_135: ')' | ',' (')' | '**')
-static void *
-_tmp_135_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // ')'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 8))  // token=')'
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_135[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
-            _res = _literal;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_135[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
-    }
-    { // ',' (')' | '**')
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')"));
-        Token * _literal;
-        void *_tmp_153_var;
-        if (
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (_tmp_153_var = _tmp_153_rule(p))  // ')' | '**'
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_135[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')"));
-            _res = _PyPegen_dummy_name(p, _literal, _tmp_153_var);
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_135[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (')' | '**')"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_136: ':' | ',' (':' | '**')
-static void *
-_tmp_136_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // ':'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
-            _res = _literal;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_136[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
-    }
-    { // ',' (':' | '**')
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')"));
-        Token * _literal;
-        void *_tmp_154_var;
-        if (
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (_tmp_154_var = _tmp_154_rule(p))  // ':' | '**'
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')"));
-            _res = _PyPegen_dummy_name(p, _literal, _tmp_154_var);
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_136[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (':' | '**')"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_137: star_targets '='
-static void *
-_tmp_137_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // star_targets '='
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
-        Token * _literal;
-        expr_ty z;
-        if (
-            (z = star_targets_rule(p))  // star_targets
-            &&
-            (_literal = _PyPegen_expect_token(p, 22))  // token='='
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
-            _res = z;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_137[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_138: '.' | '...'
-static void *
-_tmp_138_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // '.'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 23))  // token='.'
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
-            _res = _literal;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_138[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
-    }
-    { // '...'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 52))  // token='...'
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'"));
-            _res = _literal;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_138[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_139: '.' | '...'
-static void *
-_tmp_139_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // '.'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 23))  // token='.'
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_139[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
-            _res = _literal;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_139[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
-    }
-    { // '...'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 52))  // token='...'
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_139[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'"));
-            _res = _literal;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_139[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_140: '@' named_expression NEWLINE
-static void *
-_tmp_140_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // '@' named_expression NEWLINE
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE"));
-        Token * _literal;
-        expr_ty f;
-        Token * newline_var;
-        if (
-            (_literal = _PyPegen_expect_token(p, 49))  // token='@'
-            &&
-            (f = named_expression_rule(p))  // named_expression
-            &&
-            (newline_var = _PyPegen_expect_token(p, NEWLINE))  // token='NEWLINE'
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_140[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE"));
-            _res = f;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_140[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@' named_expression NEWLINE"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_141: ',' star_expression
-static void *
-_tmp_141_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // ',' star_expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression"));
-        Token * _literal;
-        expr_ty c;
-        if (
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (c = star_expression_rule(p))  // star_expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression"));
-            _res = c;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_142: ',' expression
-static void *
-_tmp_142_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // ',' expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
-        Token * _literal;
-        expr_ty c;
-        if (
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (c = expression_rule(p))  // expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_142[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression"));
-            _res = c;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_142[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_143: 'or' conjunction
-static void *
-_tmp_143_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // 'or' conjunction
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction"));
-        Token * _keyword;
-        expr_ty c;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 532))  // token='or'
-            &&
-            (c = conjunction_rule(p))  // conjunction
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction"));
-            _res = c;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_143[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'or' conjunction"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_144: 'and' inversion
-static void *
-_tmp_144_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // 'and' inversion
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion"));
-        Token * _keyword;
-        expr_ty c;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 533))  // token='and'
-            &&
-            (c = inversion_rule(p))  // inversion
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion"));
-            _res = c;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'and' inversion"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_145: 'if' disjunction
-static void *
-_tmp_145_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // 'if' disjunction
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
-        Token * _keyword;
-        expr_ty z;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 510))  // token='if'
-            &&
-            (z = disjunction_rule(p))  // disjunction
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
-            _res = z;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_146: 'if' disjunction
-static void *
-_tmp_146_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // 'if' disjunction
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
-        Token * _keyword;
-        expr_ty z;
-        if (
-            (_keyword = _PyPegen_expect_token(p, 510))  // token='if'
-            &&
-            (z = disjunction_rule(p))  // disjunction
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
-            _res = z;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_147: starred_expression | named_expression !'='
-static void *
-_tmp_147_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // starred_expression
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression"));
-        expr_ty starred_expression_var;
-        if (
-            (starred_expression_var = starred_expression_rule(p))  // starred_expression
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression"));
-            _res = starred_expression_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression"));
-    }
-    { // named_expression !'='
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression !'='"));
-        expr_ty named_expression_var;
-        if (
-            (named_expression_var = named_expression_rule(p))  // named_expression
-            &&
-            _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22)  // token='='
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression !'='"));
-            _res = named_expression_var;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression !'='"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_148: ',' star_target
-static void *
-_tmp_148_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // ',' star_target
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target"));
-        Token * _literal;
-        expr_ty c;
-        if (
-            (_literal = _PyPegen_expect_token(p, 12))  // token=','
-            &&
-            (c = star_target_rule(p))  // star_target
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target"));
-            _res = c;
-            if (_res == NULL && PyErr_Occurred()) {
-                p->error_indicator = 1;
-                D(p->level--);
-                return NULL;
-            }
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_149: star_targets '='
-static void *
-_tmp_149_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // star_targets '='
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
-        Token * _literal;
-        expr_ty star_targets_var;
-        if (
-            (star_targets_var = star_targets_rule(p))  // star_targets
-            &&
-            (_literal = _PyPegen_expect_token(p, 22))  // token='='
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
-            _res = _PyPegen_dummy_name(p, star_targets_var, _literal);
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_150: star_targets '='
-static void *
-_tmp_150_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // star_targets '='
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
-        Token * _literal;
-        expr_ty star_targets_var;
-        if (
-            (star_targets_var = star_targets_rule(p))  // star_targets
-            &&
-            (_literal = _PyPegen_expect_token(p, 22))  // token='='
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
-            _res = _PyPegen_dummy_name(p, star_targets_var, _literal);
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _loop1_151: param_with_default
-static asdl_seq *
-_loop1_151_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // param_with_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop1_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
-        NameDefaultPair* param_with_default_var;
-        while (
-            (param_with_default_var = param_with_default_rule(p))  // param_with_default
-        )
-        {
-            _res = param_with_default_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop1_151[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
-    }
-    if (_n == 0 || p->error_indicator) {
-        PyMem_Free(_children);
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop1_151_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _loop1_152: lambda_param_with_default
-static asdl_seq *
-_loop1_152_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void *_res = NULL;
-    int _mark = p->mark;
-    int _start_mark = p->mark;
-    void **_children = PyMem_Malloc(sizeof(void *));
-    if (!_children) {
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    ssize_t _children_capacity = 1;
-    ssize_t _n = 0;
-    { // lambda_param_with_default
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _loop1_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
-        NameDefaultPair* lambda_param_with_default_var;
-        while (
-            (lambda_param_with_default_var = lambda_param_with_default_rule(p))  // lambda_param_with_default
-        )
-        {
-            _res = lambda_param_with_default_var;
-            if (_n == _children_capacity) {
-                _children_capacity *= 2;
-                void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
-                if (!_new_children) {
-                    p->error_indicator = 1;
-                    PyErr_NoMemory();
-                    D(p->level--);
-                    return NULL;
-                }
-                _children = _new_children;
-            }
-            _children[_n++] = _res;
-            _mark = p->mark;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _loop1_152[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
-    }
-    if (_n == 0 || p->error_indicator) {
-        PyMem_Free(_children);
-        D(p->level--);
-        return NULL;
-    }
-    asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
-    if (!_seq) {
-        PyMem_Free(_children);
-        p->error_indicator = 1;
-        PyErr_NoMemory();
-        D(p->level--);
-        return NULL;
-    }
-    for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
-    PyMem_Free(_children);
-    _PyPegen_insert_memo(p, _start_mark, _loop1_152_type, _seq);
-    D(p->level--);
-    return _seq;
-}
-
-// _tmp_153: ')' | '**'
-static void *
-_tmp_153_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // ')'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 8))  // token=')'
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
-            _res = _literal;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
-    }
-    { // '**'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 35))  // token='**'
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'"));
-            _res = _literal;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-// _tmp_154: ':' | '**'
-static void *
-_tmp_154_rule(Parser *p)
-{
-    D(p->level++);
-    if (p->error_indicator) {
-        D(p->level--);
-        return NULL;
-    }
-    void * _res = NULL;
-    int _mark = p->mark;
-    { // ':'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 11))  // token=':'
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
-            _res = _literal;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
-    }
-    { // '**'
-        if (p->error_indicator) {
-            D(p->level--);
-            return NULL;
-        }
-        D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'"));
-        Token * _literal;
-        if (
-            (_literal = _PyPegen_expect_token(p, 35))  // token='**'
-        )
-        {
-            D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'"));
-            _res = _literal;
-            goto done;
-        }
-        p->mark = _mark;
-        D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ',
-                  p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'"));
-    }
-    _res = NULL;
-  done:
-    D(p->level--);
-    return _res;
-}
-
-void *
-_PyPegen_parse(Parser *p)
-{
-    // Initialize keywords
-    p->keywords = reserved_keywords;
-    p->n_keyword_lists = n_keyword_lists;
-
-    // Run parser
-    void *result = NULL;
-    if (p->start_rule == Py_file_input) {
-        result = file_rule(p);
-    } else if (p->start_rule == Py_single_input) {
-        result = interactive_rule(p);
-    } else if (p->start_rule == Py_eval_input) {
-        result = eval_rule(p);
-    } else if (p->start_rule == Py_func_type_input) {
-        result = func_type_rule(p);
-    } else if (p->start_rule == Py_fstring_input) {
-        result = fstring_rule(p);
-    }
-
-    return result;
-}
-
-// The end
diff --git a/Parser/pegen/peg_api.c b/Parser/pegen/peg_api.c
deleted file mode 100644
index 5e71ecd..0000000
--- a/Parser/pegen/peg_api.c
+++ /dev/null
@@ -1,54 +0,0 @@
-#include "pegen_interface.h"
-
-#include "../tokenizer.h"
-#include "pegen.h"
-
-mod_ty
-PyPegen_ASTFromString(const char *str, const char *filename, int mode,
-                      PyCompilerFlags *flags, PyArena *arena)
-{
-    PyObject *filename_ob = PyUnicode_FromString(filename);
-    if (filename_ob == NULL) {
-        return NULL;
-    }
-    mod_ty result = PyPegen_ASTFromStringObject(str, filename_ob, mode, flags, arena);
-    Py_XDECREF(filename_ob);
-    return result;
-}
-
-mod_ty
-PyPegen_ASTFromStringObject(const char *str, PyObject* filename, int mode,
-                            PyCompilerFlags *flags, PyArena *arena)
-{
-    if (PySys_Audit("compile", "yO", str, filename) < 0) {
-        return NULL;
-    }
-
-    mod_ty result = _PyPegen_run_parser_from_string(str, mode, filename, flags, arena);
-    return result;
-}
-
-mod_ty
-PyPegen_ASTFromFilename(const char *filename, int mode, PyCompilerFlags *flags, PyArena *arena)
-{
-    PyObject *filename_ob = PyUnicode_FromString(filename);
-    if (filename_ob == NULL) {
-        return NULL;
-    }
-
-    mod_ty result = _PyPegen_run_parser_from_file(filename, mode, filename_ob, flags, arena);
-    Py_XDECREF(filename_ob);
-    return result;
-}
-
-mod_ty
-PyPegen_ASTFromFileObject(FILE *fp, PyObject *filename_ob, int mode,
-                          const char *enc, const char *ps1, const char* ps2,
-                          PyCompilerFlags *flags, int *errcode, PyArena *arena)
-{
-    if (PySys_Audit("compile", "OO", Py_None, filename_ob) < 0) {
-        return NULL;
-    }
-    return _PyPegen_run_parser_from_file_pointer(fp, mode, filename_ob, enc, ps1, ps2,
-                                        flags, errcode, arena);
-}
diff --git a/Parser/pgen/__init__.py b/Parser/pgen/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/Parser/pgen/__init__.py
+++ /dev/null
diff --git a/Parser/pgen/__main__.py b/Parser/pgen/__main__.py
deleted file mode 100644
index d3780a7..0000000
--- a/Parser/pgen/__main__.py
+++ /dev/null
@@ -1,43 +0,0 @@
-import argparse
-
-from .pgen import ParserGenerator
-
-
-def main():
-    parser = argparse.ArgumentParser(description="Parser generator main program.")
-    parser.add_argument(
-        "grammar", type=str, help="The file with the grammar definition in EBNF format"
-    )
-    parser.add_argument("tokens", type=str, help="The file with the token definitions")
-    parser.add_argument(
-        "graminit_h",
-        type=argparse.FileType("w"),
-        help="The path to write the grammar's non-terminals as #defines",
-    )
-    parser.add_argument(
-        "graminit_c",
-        type=argparse.FileType("w"),
-        help="The path to write the grammar as initialized data",
-    )
-
-    parser.add_argument("--verbose", "-v", action="count")
-    parser.add_argument(
-        "--graph",
-        type=argparse.FileType("w"),
-        action="store",
-        metavar="GRAPH_OUTPUT_FILE",
-        help="Dumps a DOT representation of the generated automata in a file",
-    )
-
-    args = parser.parse_args()
-
-    p = ParserGenerator(
-        args.grammar, args.tokens, verbose=args.verbose, graph_file=args.graph
-    )
-    grammar = p.make_grammar()
-    grammar.produce_graminit_h(args.graminit_h.write)
-    grammar.produce_graminit_c(args.graminit_c.write)
-
-
-if __name__ == "__main__":
-    main()
diff --git a/Parser/pgen/automata.py b/Parser/pgen/automata.py
deleted file mode 100644
index f2ed221..0000000
--- a/Parser/pgen/automata.py
+++ /dev/null
@@ -1,400 +0,0 @@
-"""Classes representing state-machine concepts"""
-
-class NFA:
-    """A non deterministic finite automata
-
-    A non deterministic automata is a form of a finite state
-    machine. An NFA's rules are less restrictive than a DFA.
-    The NFA rules are:
-
-      * A transition can be non-deterministic and can result in
-        nothing, one, or two or more states.
-
-      * An epsilon transition consuming empty input is valid.
-        Transitions consuming labeled symbols are also permitted.
-
-    This class assumes that there is only one starting state and one
-    accepting (ending) state.
-
-    Attributes:
-        name (str): The name of the rule the NFA is representing.
-        start (NFAState): The starting state.
-        end (NFAState): The ending state
-    """
-
-    def __init__(self, start, end):
-        self.name = start.rule_name
-        self.start = start
-        self.end = end
-
-    def __repr__(self):
-        return "NFA(start={}, end={})".format(self.start, self.end)
-
-    def dump(self, writer=print):
-        """Dump a graphical representation of the NFA"""
-        todo = [self.start]
-        for i, state in enumerate(todo):
-            writer("  State", i, state is self.end and "(final)" or "")
-            for arc in state.arcs:
-                label = arc.label
-                next = arc.target
-                if next in todo:
-                    j = todo.index(next)
-                else:
-                    j = len(todo)
-                    todo.append(next)
-                if label is None:
-                    writer("    -> %d" % j)
-                else:
-                    writer("    %s -> %d" % (label, j))
-
-    def dump_graph(self, writer):
-        """Dump a DOT representation of the NFA"""
-        writer('digraph %s_nfa {\n' % self.name)
-        todo = [self.start]
-        for i, state in enumerate(todo):
-            writer(' %d [label="State %d %s"];\n' % (i, i, state is self.end and "(final)" or ""))
-            for arc in state.arcs:
-                label = arc.label
-                next = arc.target
-                if next in todo:
-                    j = todo.index(next)
-                else:
-                    j = len(todo)
-                    todo.append(next)
-                if label is None:
-                    writer(" %d -> %d [style=dotted label=ε];\n" % (i, j))
-                else:
-                    writer(" %d -> %d [label=%s];\n" % (i, j, label.replace("'", '"')))
-        writer('}\n')
-
-
-class NFAArc:
-    """An arc representing a transition between two NFA states.
-
-    NFA states can be connected via two ways:
-
-        * A label transition: An input equal to the label must
-          be consumed to perform the transition.
-        * An epsilon transition: The transition can be taken without
-          consuming any input symbol.
-
-        Attributes:
-            target (NFAState): The ending state of the transition arc.
-            label (Optional[str]): The label that must be consumed to make
-                the transition. An epsilon transition is represented
-                using `None`.
-    """
-
-    def __init__(self, target, label):
-        self.target = target
-        self.label = label
-
-    def __repr__(self):
-        return "<%s: %s>" % (self.__class__.__name__, self.label)
-
-
-class NFAState:
-    """A state of a NFA, non deterministic finite automata.
-
-    Attributes:
-        target (rule_name): The name of the rule used to represent the NFA's
-            ending state after a transition.
-        arcs (Dict[Optional[str], NFAState]): A mapping representing transitions
-            between the current NFA state and another NFA state via following
-            a label.
-    """
-
-    def __init__(self, rule_name):
-        self.rule_name = rule_name
-        self.arcs = []
-
-    def add_arc(self, target, label=None):
-        """Add a new arc to connect the state to a target state within the NFA
-
-        The method adds a new arc to the list of arcs available as transitions
-        from the present state. An optional label indicates a named transition
-        that consumes an input while the absence of a label represents an epsilon
-        transition.
-
-        Attributes:
-            target (NFAState): The end of the transition that the arc represents.
-            label (Optional[str]): The label that must be consumed for making
-                the transition. If the label is not provided the transition is assumed
-                to be an epsilon-transition.
-        """
-        assert label is None or isinstance(label, str)
-        assert isinstance(target, NFAState)
-        self.arcs.append(NFAArc(target, label))
-
-    def __repr__(self):
-        return "<%s: from %s>" % (self.__class__.__name__, self.rule_name)
-
-
-class DFA:
-    """A deterministic finite automata
-
-    A deterministic finite automata is a form of a finite state machine
-    that obeys the following rules:
-
-       * Each of the transitions is uniquely determined by
-         the source state and input symbol
-       * Reading an input symbol is required for each state
-         transition (no epsilon transitions).
-
-    The finite-state machine will accept or reject a string of symbols
-    and only produces a unique computation of the automaton for each input
-    string. The DFA must have a unique starting state (represented as the first
-    element in the list of states) but can have multiple final states.
-
-    Attributes:
-        name (str): The name of the rule the DFA is representing.
-        states (List[DFAState]): A collection of DFA states.
-    """
-
-    def __init__(self, name, states):
-        self.name = name
-        self.states = states
-
-    @classmethod
-    def from_nfa(cls, nfa):
-        """Constructs a DFA from a NFA using the Rabin–Scott construction algorithm.
-
-        To simulate the operation of a DFA on a given input string, it's
-        necessary to keep track of a single state at any time, or more precisely,
-        the state that the automaton will reach after seeing a prefix of the
-        input. In contrast, to simulate an NFA, it's necessary to keep track of
-        a set of states: all of the states that the automaton could reach after
-        seeing the same prefix of the input, according to the nondeterministic
-        choices made by the automaton. There are two possible sources of
-        non-determinism:
-
-        1) Multiple (one or more) transitions with the same label
-
-                         'A'     +-------+
-                    +----------->+ State +----------->+
-                    |            |   2   |
-            +-------+            +-------+
-            | State |
-            |   1   |            +-------+
-            +-------+            | State |
-                    +----------->+   3   +----------->+
-                         'A'     +-------+
-
-        2) Epsilon transitions (transitions that can be taken without consuming any input)
-
-            +-------+            +-------+
-            | State |     ε      | State |
-            |   1   +----------->+   2   +----------->+
-            +-------+            +-------+
-
-        Looking at the first case above, we can't determine which transition should be
-        followed when given an input A. We could choose whether or not to follow the
-        transition while in the second case the problem is that we can choose both to
-        follow the transition or not doing it. To solve this problem we can imagine that
-        we follow all possibilities at the same time and we construct new states from the
-        set of all possible reachable states. For every case in the previous example:
-
-
-        1) For multiple transitions with the same label we colapse all of the
-           final states under the same one
-
-            +-------+            +-------+
-            | State |     'A'    | State |
-            |   1   +----------->+  2-3  +----------->+
-            +-------+            +-------+
-
-        2) For epsilon transitions we collapse all epsilon-reachable states
-           into the same one
-
-            +-------+
-            | State |
-            |  1-2  +----------->
-            +-------+
-
-        Because the DFA states consist of sets of NFA states, an n-state NFA
-        may be converted to a DFA with at most 2**n states. Notice that the
-        constructed DFA is not minimal and can be simplified or reduced
-        afterwards.
-
-        Parameters:
-            name (NFA): The NFA to transform to DFA.
-        """
-        assert isinstance(nfa, NFA)
-
-        def add_closure(nfa_state, base_nfa_set):
-            """Calculate the epsilon-closure of a given state
-
-            Add to the *base_nfa_set* all the states that are
-            reachable from *nfa_state* via epsilon-transitions.
-            """
-            assert isinstance(nfa_state, NFAState)
-            if nfa_state in base_nfa_set:
-                return
-            base_nfa_set.add(nfa_state)
-            for nfa_arc in nfa_state.arcs:
-                if nfa_arc.label is None:
-                    add_closure(nfa_arc.target, base_nfa_set)
-
-        # Calculate the epsilon-closure of the starting state
-        base_nfa_set = set()
-        add_closure(nfa.start, base_nfa_set)
-
-        # Start by visiting the NFA starting state (there is only one).
-        states = [DFAState(nfa.name, base_nfa_set, nfa.end)]
-
-        for state in states:  # NB states grow while we're iterating
-
-            # Find transitions from the current state to other reachable states
-            # and store them in mapping that correlates the label to all the
-            # possible reachable states that can be obtained by consuming a
-            # token equal to the label. Each set of all the states that can
-            # be reached after following a label will be the a DFA state.
-            arcs = {}
-            for nfa_state in state.nfa_set:
-                for nfa_arc in nfa_state.arcs:
-                    if nfa_arc.label is not None:
-                        nfa_set = arcs.setdefault(nfa_arc.label, set())
-                        # All states that can be reached by epsilon-transitions
-                        # are also included in the set of reachable states.
-                        add_closure(nfa_arc.target, nfa_set)
-
-            # Now create new DFAs by visiting all posible transitions between
-            # the current DFA state and the new power-set states (each nfa_set)
-            # via the different labels. As the nodes are appended to *states* this
-            # is performing a breadth-first search traversal over the power-set of
-            # the states of the original NFA.
-            for label, nfa_set in sorted(arcs.items()):
-                for exisisting_state in states:
-                    if exisisting_state.nfa_set == nfa_set:
-                        # The DFA state already exists for this rule.
-                        next_state = exisisting_state
-                        break
-                else:
-                    next_state = DFAState(nfa.name, nfa_set, nfa.end)
-                    states.append(next_state)
-
-                # Add a transition between the current DFA state and the new
-                # DFA state (the power-set state) via the current label.
-                state.add_arc(next_state, label)
-
-        return cls(nfa.name, states)
-
-    def __iter__(self):
-        return iter(self.states)
-
-    def simplify(self):
-        """Attempt to reduce the number of states of the DFA
-
-        Transform the DFA into an equivalent DFA that has fewer states. Two
-        classes of states can be removed or merged from the original DFA without
-        affecting the language it accepts to minimize it:
-
-            * Unreachable states can not be reached from the initial
-              state of the DFA, for any input string.
-            * Nondistinguishable states are those that cannot be distinguished
-              from one another for any input string.
-
-        This algorithm does not achieve the optimal fully-reduced solution, but it
-        works well enough for the particularities of the Python grammar. The
-        algorithm repeatedly looks for two states that have the same set of
-        arcs (same labels pointing to the same nodes) and unifies them, until
-        things stop changing.
-        """
-        changes = True
-        while changes:
-            changes = False
-            for i, state_i in enumerate(self.states):
-                for j in range(i + 1, len(self.states)):
-                    state_j = self.states[j]
-                    if state_i == state_j:
-                        del self.states[j]
-                        for state in self.states:
-                            state.unifystate(state_j, state_i)
-                        changes = True
-                        break
-
-    def dump(self, writer=print):
-        """Dump a graphical representation of the DFA"""
-        for i, state in enumerate(self.states):
-            writer("  State", i, state.is_final and "(final)" or "")
-            for label, next in sorted(state.arcs.items()):
-                writer("    %s -> %d" % (label, self.states.index(next)))
-
-    def dump_graph(self, writer):
-        """Dump a DOT representation of the DFA"""
-        writer('digraph %s_dfa {\n' % self.name)
-        for i, state in enumerate(self.states):
-            writer(' %d [label="State %d %s"];\n' % (i, i, state.is_final and "(final)" or ""))
-            for label, next in sorted(state.arcs.items()):
-                writer(" %d -> %d [label=%s];\n" % (i, self.states.index(next), label.replace("'", '"')))
-        writer('}\n')
-
-
-class DFAState(object):
-    """A state of a DFA
-
-    Attributes:
-        rule_name (rule_name): The name of the DFA rule containing the represented state.
-        nfa_set (Set[NFAState]): The set of NFA states used to create this state.
-        final (bool): True if the state represents an accepting state of the DFA
-            containing this state.
-        arcs (Dict[label, DFAState]): A mapping representing transitions between
-            the current DFA state and another DFA state via following a label.
-    """
-
-    def __init__(self, rule_name, nfa_set, final):
-        assert isinstance(nfa_set, set)
-        assert isinstance(next(iter(nfa_set)), NFAState)
-        assert isinstance(final, NFAState)
-        self.rule_name = rule_name
-        self.nfa_set = nfa_set
-        self.arcs = {}  # map from terminals/nonterminals to DFAState
-        self.is_final = final in nfa_set
-
-    def add_arc(self, target, label):
-        """Add a new arc to the current state.
-
-        Parameters:
-            target (DFAState): The DFA state at the end of the arc.
-            label (str): The label respresenting the token that must be consumed
-                to perform this transition.
-        """
-        assert isinstance(label, str)
-        assert label not in self.arcs
-        assert isinstance(target, DFAState)
-        self.arcs[label] = target
-
-    def unifystate(self, old, new):
-        """Replace all arcs from the current node to *old* with *new*.
-
-        Parameters:
-            old (DFAState): The  DFA state to remove from all existing arcs.
-            new (DFAState): The DFA state to replace in all existing arcs.
-        """
-        for label, next_ in self.arcs.items():
-            if next_ is old:
-                self.arcs[label] = new
-
-    def __eq__(self, other):
-        # The nfa_set does not matter for  equality
-        assert isinstance(other, DFAState)
-        if self.is_final != other.is_final:
-            return False
-        # We cannot just return self.arcs == other.arcs because that
-        # would invoke this method recursively if there are any cycles.
-        if len(self.arcs) != len(other.arcs):
-            return False
-        for label, next_ in self.arcs.items():
-            if next_ is not other.arcs.get(label):
-                return False
-        return True
-
-    __hash__ = None  # For Py3 compatibility.
-
-    def __repr__(self):
-        return "<%s: %s is_final=%s>" % (
-            self.__class__.__name__,
-            self.rule_name,
-            self.is_final,
-        )
diff --git a/Parser/pgen/grammar.py b/Parser/pgen/grammar.py
deleted file mode 100644
index ce40e16..0000000
--- a/Parser/pgen/grammar.py
+++ /dev/null
@@ -1,147 +0,0 @@
-import collections
-
-
-class Grammar:
-    """Pgen parsing tables class.
-
-    The instance variables are as follows:
-
-    symbol2number -- a dict mapping symbol names to numbers.  Symbol
-                     numbers are always 256 or higher, to distinguish
-                     them from token numbers, which are between 0 and
-                     255 (inclusive).
-
-    number2symbol -- a dict mapping numbers to symbol names;
-                     these two are each other's inverse.
-
-    states        -- a list of DFAs, where each DFA is a list of
-                     states, each state is a list of arcs, and each
-                     arc is a (i, j) pair where i is a label and j is
-                     a state number.  The DFA number is the index into
-                     this list.  (This name is slightly confusing.)
-                     Final states are represented by a special arc of
-                     the form (0, j) where j is its own state number.
-
-    dfas          -- a dict mapping symbol numbers to (DFA, first)
-                     pairs, where DFA is an item from the states list
-                     above, and first is a set of tokens that can
-                     begin this grammar rule.
-
-    labels        -- a list of (x, y) pairs where x is either a token
-                     number or a symbol number, and y is either None
-                     or a string; the strings are keywords.  The label
-                     number is the index in this list; label numbers
-                     are used to mark state transitions (arcs) in the
-                     DFAs.
-
-    start         -- the number of the grammar's start symbol.
-
-    keywords      -- a dict mapping keyword strings to arc labels.
-
-    tokens        -- a dict mapping token numbers to arc labels.
-
-    """
-
-    def __init__(self):
-        self.symbol2number = collections.OrderedDict()
-        self.number2symbol = collections.OrderedDict()
-        self.states = []
-        self.dfas = collections.OrderedDict()
-        self.labels = [(0, "EMPTY")]
-        self.keywords = collections.OrderedDict()
-        self.tokens = collections.OrderedDict()
-        self.symbol2label = collections.OrderedDict()
-        self.start = 256
-
-    def produce_graminit_h(self, writer):
-        writer("/* Generated by Parser/pgen */\n\n")
-        for number, symbol in self.number2symbol.items():
-            writer("#define {} {}\n".format(symbol, number))
-
-    def produce_graminit_c(self, writer):
-        writer("/* Generated by Parser/pgen */\n\n")
-
-        writer('#include "exports.h"\n')
-        writer('#include "grammar.h"\n')
-        writer("Py_EXPORTED_SYMBOL grammar _PyParser_Grammar;\n")
-
-        self.print_dfas(writer)
-        self.print_labels(writer)
-
-        writer("Py_EXPORTED_SYMBOL grammar _PyParser_Grammar = {\n")
-        writer("    {n_dfas},\n".format(n_dfas=len(self.dfas)))
-        writer("    dfas,\n")
-        writer("    {{{n_labels}, labels}},\n".format(n_labels=len(self.labels)))
-        writer("    {start_number}\n".format(start_number=self.start))
-        writer("};\n")
-
-    def print_labels(self, writer):
-        writer(
-            "static const label labels[{n_labels}] = {{\n".format(
-                n_labels=len(self.labels)
-            )
-        )
-        for label, name in self.labels:
-            label_name = '"{}"'.format(name) if name is not None else 0
-            writer(
-                "    {{{label}, {label_name}}},\n".format(
-                    label=label, label_name=label_name
-                )
-            )
-        writer("};\n")
-
-    def print_dfas(self, writer):
-        self.print_states(writer)
-        writer("static const dfa dfas[{}] = {{\n".format(len(self.dfas)))
-        for dfaindex, dfa_elem in enumerate(self.dfas.items()):
-            symbol, (dfa, first_sets) = dfa_elem
-            writer(
-                '    {{{dfa_symbol}, "{symbol_name}", '.format(
-                    dfa_symbol=symbol, symbol_name=self.number2symbol[symbol]
-                )
-                + "{n_states}, states_{dfa_index},\n".format(
-                    n_states=len(dfa), dfa_index=dfaindex
-                )
-                + '     "'
-            )
-
-            bitset = bytearray((len(self.labels) >> 3) + 1)
-            for token in first_sets:
-                bitset[token >> 3] |= 1 << (token & 7)
-            for byte in bitset:
-                writer("\\%03o" % (byte & 0xFF))
-            writer('"},\n')
-        writer("};\n")
-
-    def print_states(self, write):
-        for dfaindex, dfa in enumerate(self.states):
-            self.print_arcs(write, dfaindex, dfa)
-            write(
-                "static state states_{dfa_index}[{n_states}] = {{\n".format(
-                    dfa_index=dfaindex, n_states=len(dfa)
-                )
-            )
-            for stateindex, state in enumerate(dfa):
-                narcs = len(state)
-                write(
-                    "    {{{n_arcs}, arcs_{dfa_index}_{state_index}}},\n".format(
-                        n_arcs=narcs, dfa_index=dfaindex, state_index=stateindex
-                    )
-                )
-            write("};\n")
-
-    def print_arcs(self, write, dfaindex, states):
-        for stateindex, state in enumerate(states):
-            narcs = len(state)
-            write(
-                "static const arc arcs_{dfa_index}_{state_index}[{n_arcs}] = {{\n".format(
-                    dfa_index=dfaindex, state_index=stateindex, n_arcs=narcs
-                )
-            )
-            for a, b in state:
-                write(
-                    "    {{{from_label}, {to_state}}},\n".format(
-                        from_label=a, to_state=b
-                    )
-                )
-            write("};\n")
diff --git a/Parser/pgen/keywordgen.py b/Parser/pgen/keywordgen.py
deleted file mode 100644
index f0234a8..0000000
--- a/Parser/pgen/keywordgen.py
+++ /dev/null
@@ -1,59 +0,0 @@
-"""Generate Lib/keyword.py from the Grammar and Tokens files using pgen"""
-
-import argparse
-
-from .pgen import ParserGenerator
-
-TEMPLATE = r'''
-"""Keywords (from "Grammar/Grammar")
-
-This file is automatically generated; please don't muck it up!
-
-To update the symbols in this file, 'cd' to the top directory of
-the python source tree and run:
-
-    python3 -m Parser.pgen.keywordgen Grammar/Grammar \
-                                      Grammar/Tokens \
-                                      Lib/keyword.py
-
-Alternatively, you can run 'make regen-keyword'.
-"""
-
-__all__ = ["iskeyword", "kwlist"]
-
-kwlist = [
-    {keywords}
-]
-
-iskeyword = frozenset(kwlist).__contains__
-'''.lstrip()
-
-EXTRA_KEYWORDS = ["async", "await"]
-
-
-def main():
-    parser = argparse.ArgumentParser(
-        description="Generate the Lib/keywords.py " "file from the grammar."
-    )
-    parser.add_argument(
-        "grammar", type=str, help="The file with the grammar definition in EBNF format"
-    )
-    parser.add_argument("tokens", type=str, help="The file with the token definitions")
-    parser.add_argument(
-        "keyword_file",
-        type=argparse.FileType("w"),
-        help="The path to write the keyword definitions",
-    )
-    args = parser.parse_args()
-    p = ParserGenerator(args.grammar, args.tokens)
-    grammar = p.make_grammar()
-
-    with args.keyword_file as thefile:
-        all_keywords = sorted(list(grammar.keywords) + EXTRA_KEYWORDS)
-
-        keywords = ",\n    ".join(map(repr, all_keywords))
-        thefile.write(TEMPLATE.format(keywords=keywords))
-
-
-if __name__ == "__main__":
-    main()
diff --git a/Parser/pgen/metaparser.py b/Parser/pgen/metaparser.py
deleted file mode 100644
index 074a083..0000000
--- a/Parser/pgen/metaparser.py
+++ /dev/null
@@ -1,152 +0,0 @@
-"""Parser for the Python metagrammar"""
-
-import io
-import tokenize  # from stdlib
-
-from .automata import NFA, NFAState
-
-
-class GrammarParser:
-    """Parser for Python grammar files."""
-
-    _translation_table = {
-        tokenize.NAME: "NAME",
-        tokenize.STRING: "STRING",
-        tokenize.NEWLINE: "NEWLINE",
-        tokenize.NL: "NL",
-        tokenize.OP: "OP",
-        tokenize.ENDMARKER: "ENDMARKER",
-        tokenize.COMMENT: "COMMENT",
-    }
-
-    def __init__(self, grammar):
-        self.grammar = grammar
-        grammar_adaptor = io.StringIO(grammar)
-        self.generator = tokenize.generate_tokens(grammar_adaptor.readline)
-        self._gettoken()  # Initialize lookahead
-        self._current_rule_name = None
-
-    def parse(self):
-        """Turn the grammar into a collection of NFAs"""
-        # grammar: (NEWLINE | rule)* ENDMARKER
-        while self.type != tokenize.ENDMARKER:
-            while self.type == tokenize.NEWLINE:
-                self._gettoken()
-            # rule: NAME ':' rhs NEWLINE
-            self._current_rule_name = self._expect(tokenize.NAME)
-            self._expect(tokenize.OP, ":")
-            a, z = self._parse_rhs()
-            self._expect(tokenize.NEWLINE)
-
-            yield NFA(a, z)
-
-    def _parse_rhs(self):
-        # rhs: items ('|' items)*
-        a, z = self._parse_items()
-        if self.value != "|":
-            return a, z
-        else:
-            aa = NFAState(self._current_rule_name)
-            zz = NFAState(self._current_rule_name)
-            while True:
-                # Allow to transit directly to the previous state and connect the end of the
-                # previous state to the end of the current one, effectively allowing to skip
-                # the current state.
-                aa.add_arc(a)
-                z.add_arc(zz)
-                if self.value != "|":
-                    break
-
-                self._gettoken()
-                a, z = self._parse_items()
-            return aa, zz
-
-    def _parse_items(self):
-        # items: item+
-        a, b = self._parse_item()
-        while self.type in (tokenize.NAME, tokenize.STRING) or self.value in ("(", "["):
-            c, d = self._parse_item()
-            # Allow a transition between the end of the previous state
-            # and the beginning of the new one, connecting all the items
-            # together. In this way we can only reach the end if we visit
-            # all the items.
-            b.add_arc(c)
-            b = d
-        return a, b
-
-    def _parse_item(self):
-        # item: '[' rhs ']' | atom ['+' | '*']
-        if self.value == "[":
-            self._gettoken()
-            a, z = self._parse_rhs()
-            self._expect(tokenize.OP, "]")
-            # Make a transition from the beginning to the end so it is possible to
-            # advance for free to the next state of this item # without consuming
-            # anything from the rhs.
-            a.add_arc(z)
-            return a, z
-        else:
-            a, z = self._parse_atom()
-            value = self.value
-            if value not in ("+", "*"):
-                return a, z
-            self._gettoken()
-            z.add_arc(a)
-            if value == "+":
-                # Create a cycle to the beginning so we go back to the old state in this
-                # item and repeat.
-                return a, z
-            else:
-                # The end state is the same as the beginning, so we can cycle arbitrarily
-                # and end in the beginning if necessary.
-                return a, a
-
-    def _parse_atom(self):
-        # atom: '(' rhs ')' | NAME | STRING
-        if self.value == "(":
-            self._gettoken()
-            a, z = self._parse_rhs()
-            self._expect(tokenize.OP, ")")
-            return a, z
-        elif self.type in (tokenize.NAME, tokenize.STRING):
-            a = NFAState(self._current_rule_name)
-            z = NFAState(self._current_rule_name)
-            # We can transit to the next state only if we consume the value.
-            a.add_arc(z, self.value)
-            self._gettoken()
-            return a, z
-        else:
-            self._raise_error(
-                "expected (...) or NAME or STRING, got {} ({})",
-                self._translation_table.get(self.type, self.type),
-                self.value,
-            )
-
-    def _expect(self, type_, value=None):
-        if self.type != type_:
-            self._raise_error(
-                "expected {}, got {} ({})",
-                self._translation_table.get(type_, type_),
-                self._translation_table.get(self.type, self.type),
-                self.value,
-            )
-        if value is not None and self.value != value:
-            self._raise_error("expected {}, got {}", value, self.value)
-        value = self.value
-        self._gettoken()
-        return value
-
-    def _gettoken(self):
-        tup = next(self.generator)
-        while tup[0] in (tokenize.COMMENT, tokenize.NL):
-            tup = next(self.generator)
-        self.type, self.value, self.begin, self.end, self.line = tup
-
-    def _raise_error(self, msg, *args):
-        if args:
-            try:
-                msg = msg.format(*args)
-            except Exception:
-                msg = " ".join([msg] + list(map(str, args)))
-        line = self.grammar.splitlines()[self.begin[0] - 1]
-        raise SyntaxError(msg, ("<grammar>", self.begin[0], self.begin[1], line))
diff --git a/Parser/pgen/pgen.py b/Parser/pgen/pgen.py
deleted file mode 100644
index 03032d4..0000000
--- a/Parser/pgen/pgen.py
+++ /dev/null
@@ -1,310 +0,0 @@
-"""Python parser generator
-
-
-This parser generator transforms a Python grammar file into parsing tables
-that can be consumed by Python's LL(1) parser written in C.
-
-Concepts
---------
-
-* An LL(1) parser (Left-to-right, Leftmost derivation, 1 token-lookahead) is a
-  top-down parser for a subset of context-free languages. It parses the input
-  from Left to right, performing Leftmost derivation of the sentence, and can
-  only use 1 token of lookahead when parsing a sentence.
-
-* A parsing table is a collection of data that a generic implementation of the
-  LL(1) parser consumes to know how to parse a given context-free grammar. In
-  this case the collection of data involves Deterministic Finite Automatons,
-  calculated first sets, keywords and transition labels.
-
-* A grammar is defined by production rules (or just 'productions') that specify
-  which symbols may replace which other symbols; these rules may be used to
-  generate strings, or to parse them. Each such rule has a head, or left-hand
-  side, which consists of the string that may be replaced, and a body, or
-  right-hand side, which consists of a string that may replace it. In the
-  Python grammar, rules are written in the form
-
-  rule_name: rule_description;
-
-  meaning the rule 'a: b' specifies that a can be replaced by b. A context-free
-  grammar is a grammar in which the left-hand side of each production rule
-  consists of only a single nonterminal symbol. Context-free grammars can
-  always be recognized by a Non-Deterministic Automatons.
-
-* Terminal symbols are literal symbols which may appear in the outputs of the
-  production rules of the grammar and which cannot be changed using the rules
-  of the grammar. Applying the rules recursively to a source string of symbols
-  will usually terminate in a final output string consisting only of terminal
-  symbols.
-
-* Nonterminal symbols are those symbols which can be replaced. The grammar
-  includes a start symbol a designated member of the set of nonterminals from
-  which all the strings in the language may be derived by successive
-  applications of the production rules.
-
-* The language defined by the grammar is defined as the set of terminal strings
-  that can be derived using the production rules.
-
-* The first sets of a rule (FIRST(rule)) are defined to be the set of terminals
-  that can appear in the first position of any string derived from the rule.
-  This is useful for LL(1) parsers as the parser is only allowed to look at the
-  next token in the input to know which rule needs to parse. For example, given
-  this grammar:
-
-  start: '(' A | B ')'
-  A: 'a' '<'
-  B: 'b' '<'
-
-  and the input '(b<)' the parser can only look at 'b' to know if it needs
-  to parse A o B. Because FIRST(A) = {'a'} and FIRST(B) = {'b'} it knows
-  that needs to continue parsing rule B because only that rule can start
-  with 'b'.
-
-Description
------------
-
-The input for the parser generator is a grammar in extended BNF form (using *
-for repetition, + for at-least-once repetition, [] for optional parts, | for
-alternatives and () for grouping).
-
-Each rule in the grammar file is considered as a regular expression in its
-own right. It is turned into a Non-deterministic Finite Automaton (NFA),
-which is then turned into a Deterministic Finite Automaton (DFA), which is
-then optimized to reduce the number of states. See [Aho&Ullman 77] chapter 3,
-or similar compiler books (this technique is more often used for lexical
-analyzers).
-
-The DFA's are used by the parser as parsing tables in a special way that's
-probably unique. Before they are usable, the FIRST sets of all non-terminals
-are computed so the LL(1) parser consuming the parsing tables can distinguish
-between different transitions.
-Reference
----------
-
-[Aho&Ullman 77]
-    Aho&Ullman, Principles of Compiler Design, Addison-Wesley 1977
-    (first edition)
-"""
-
-from ast import literal_eval
-import collections
-
-from . import grammar, token
-from .automata import DFA
-from .metaparser import GrammarParser
-
-import enum
-
-
-class LabelType(enum.Enum):
-    NONTERMINAL = 0
-    NAMED_TOKEN = 1
-    KEYWORD = 2
-    OPERATOR = 3
-    NONE = 4
-
-
-class Label(str):
-    def __init__(self, value):
-        self.type = self._get_type()
-
-    def _get_type(self):
-        if self[0].isalpha():
-            if self.upper() == self:
-                # NAMED tokens (ASYNC, NAME...) are all uppercase by convention
-                return LabelType.NAMED_TOKEN
-            else:
-                # If is not uppercase it must be a non terminal.
-                return LabelType.NONTERMINAL
-        else:
-            # Keywords and operators are wrapped in quotes
-            assert self[0] == self[-1] in ('"', "'"), self
-            value = literal_eval(self)
-            if value[0].isalpha():
-                return LabelType.KEYWORD
-            else:
-                return LabelType.OPERATOR
-
-    def __repr__(self):
-        return "{}({})".format(self.type, super().__repr__())
-
-
-class ParserGenerator(object):
-    def __init__(self, grammar_file, token_file, verbose=False, graph_file=None):
-        with open(grammar_file) as f:
-            self.grammar = f.read()
-        with open(token_file) as tok_file:
-            token_lines = tok_file.readlines()
-        self.tokens = dict(token.generate_tokens(token_lines))
-        self.opmap = dict(token.generate_opmap(token_lines))
-        # Manually add <> so it does not collide with !=
-        self.opmap["<>"] = "NOTEQUAL"
-        self.verbose = verbose
-        self.filename = grammar_file
-        self.graph_file = graph_file
-        self.dfas, self.startsymbol = self.create_dfas()
-        self.first = {}  # map from symbol name to set of tokens
-        self.calculate_first_sets()
-
-    def create_dfas(self):
-        rule_to_dfas = collections.OrderedDict()
-        start_nonterminal = None
-        for nfa in GrammarParser(self.grammar).parse():
-            if self.verbose:
-                print("Dump of NFA for", nfa.name)
-                nfa.dump()
-            if self.graph_file is not None:
-                nfa.dump_graph(self.graph_file.write)
-            dfa = DFA.from_nfa(nfa)
-            if self.verbose:
-                print("Dump of DFA for", dfa.name)
-                dfa.dump()
-            dfa.simplify()
-            if self.graph_file is not None:
-                dfa.dump_graph(self.graph_file.write)
-            rule_to_dfas[dfa.name] = dfa
-
-            if start_nonterminal is None:
-                start_nonterminal = dfa.name
-
-        return rule_to_dfas, start_nonterminal
-
-    def make_grammar(self):
-        c = grammar.Grammar()
-        c.all_labels = set()
-        names = list(self.dfas.keys())
-        names.remove(self.startsymbol)
-        names.insert(0, self.startsymbol)
-        for name in names:
-            i = 256 + len(c.symbol2number)
-            c.symbol2number[Label(name)] = i
-            c.number2symbol[i] = Label(name)
-            c.all_labels.add(name)
-        for name in names:
-            self.make_label(c, name)
-            dfa = self.dfas[name]
-            states = []
-            for state in dfa:
-                arcs = []
-                for label, next in sorted(state.arcs.items()):
-                    c.all_labels.add(label)
-                    arcs.append((self.make_label(c, label), dfa.states.index(next)))
-                if state.is_final:
-                    arcs.append((0, dfa.states.index(state)))
-                states.append(arcs)
-            c.states.append(states)
-            c.dfas[c.symbol2number[name]] = (states, self.make_first_sets(c, name))
-        c.start = c.symbol2number[self.startsymbol]
-
-        if self.verbose:
-            print("")
-            print("Grammar summary")
-            print("===============")
-
-            print("- {n_labels} labels".format(n_labels=len(c.labels)))
-            print("- {n_dfas} dfas".format(n_dfas=len(c.dfas)))
-            print("- {n_tokens} tokens".format(n_tokens=len(c.tokens)))
-            print("- {n_keywords} keywords".format(n_keywords=len(c.keywords)))
-            print(
-                "- Start symbol: {start_symbol}".format(
-                    start_symbol=c.number2symbol[c.start]
-                )
-            )
-        return c
-
-    def make_first_sets(self, c, name):
-        rawfirst = self.first[name]
-        first = set()
-        for label in sorted(rawfirst):
-            ilabel = self.make_label(c, label)
-            ##assert ilabel not in first # XXX failed on <> ... !=
-            first.add(ilabel)
-        return first
-
-    def make_label(self, c, label):
-        label = Label(label)
-        ilabel = len(c.labels)
-
-        if label.type == LabelType.NONTERMINAL:
-            if label in c.symbol2label:
-                return c.symbol2label[label]
-            else:
-                c.labels.append((c.symbol2number[label], None))
-                c.symbol2label[label] = ilabel
-                return ilabel
-        elif label.type == LabelType.NAMED_TOKEN:
-            # A named token (NAME, NUMBER, STRING)
-            itoken = self.tokens.get(label, None)
-            assert isinstance(itoken, int), label
-            assert itoken in self.tokens.values(), label
-            if itoken in c.tokens:
-                return c.tokens[itoken]
-            else:
-                c.labels.append((itoken, None))
-                c.tokens[itoken] = ilabel
-                return ilabel
-        elif label.type == LabelType.KEYWORD:
-            # A keyword
-            value = literal_eval(label)
-            if value in c.keywords:
-                return c.keywords[value]
-            else:
-                c.labels.append((self.tokens["NAME"], value))
-                c.keywords[value] = ilabel
-                return ilabel
-        elif label.type == LabelType.OPERATOR:
-            # An operator (any non-numeric token)
-            value = literal_eval(label)
-            tok_name = self.opmap[value]  # Fails if unknown token
-            itoken = self.tokens[tok_name]
-            if itoken in c.tokens:
-                return c.tokens[itoken]
-            else:
-                c.labels.append((itoken, None))
-                c.tokens[itoken] = ilabel
-                return ilabel
-        else:
-            raise ValueError("Cannot categorize label {}".format(label))
-
-    def calculate_first_sets(self):
-        names = list(self.dfas.keys())
-        for name in names:
-            if name not in self.first:
-                self.calculate_first_sets_for_rule(name)
-
-            if self.verbose:
-                print("First set for {dfa_name}".format(dfa_name=name))
-                for item in self.first[name]:
-                    print("    - {terminal}".format(terminal=item))
-
-    def calculate_first_sets_for_rule(self, name):
-        dfa = self.dfas[name]
-        self.first[name] = None  # dummy to detect left recursion
-        state = dfa.states[0]
-        totalset = set()
-        overlapcheck = {}
-        for label, next in state.arcs.items():
-            if label in self.dfas:
-                if label in self.first:
-                    fset = self.first[label]
-                    if fset is None:
-                        raise ValueError("recursion for rule %r" % name)
-                else:
-                    self.calculate_first_sets_for_rule(label)
-                    fset = self.first[label]
-                totalset.update(fset)
-                overlapcheck[label] = fset
-            else:
-                totalset.add(label)
-                overlapcheck[label] = {label}
-        inverse = {}
-        for label, itsfirst in overlapcheck.items():
-            for symbol in itsfirst:
-                if symbol in inverse:
-                    raise ValueError(
-                        "rule %s is ambiguous; %s is in the"
-                        " first sets of %s as well as %s"
-                        % (name, symbol, label, inverse[symbol])
-                    )
-                inverse[symbol] = label
-        self.first[name] = totalset
diff --git a/Parser/pgen/token.py b/Parser/pgen/token.py
deleted file mode 100644
index 2cff62c..0000000
--- a/Parser/pgen/token.py
+++ /dev/null
@@ -1,38 +0,0 @@
-import itertools
-
-
-def generate_tokens(tokens):
-    numbers = itertools.count(0)
-    for line in tokens:
-        line = line.strip()
-
-        if not line or line.startswith("#"):
-            continue
-
-        name = line.split()[0]
-        yield (name, next(numbers))
-
-    yield ("N_TOKENS", next(numbers))
-    yield ("NT_OFFSET", 256)
-
-
-def generate_opmap(tokens):
-    for line in tokens:
-        line = line.strip()
-
-        if not line or line.startswith("#"):
-            continue
-
-        pieces = line.split()
-
-        if len(pieces) != 2:
-            continue
-
-        name, op = pieces
-        yield (op.strip("'"), name)
-
-    # Yield independently <>. This is needed so it does not collide
-    # with the token generation in "generate_tokens" because if this
-    # symbol is included in Grammar/Tokens, it will collide with !=
-    # as it has the same name (NOTEQUAL).
-    yield ("<>", "NOTEQUAL")
diff --git a/Parser/pegen/parse_string.c b/Parser/string_parser.c
similarity index 88%
rename from Parser/pegen/parse_string.c
rename to Parser/string_parser.c
index fb0c4af..dac8dbb 100644
--- a/Parser/pegen/parse_string.c
+++ b/Parser/string_parser.c
@@ -2,22 +2,17 @@
 
 #include <Python.h>
 
-#include "../tokenizer.h"
+#include "tokenizer.h"
 #include "pegen.h"
-#include "parse_string.h"
+#include "string_parser.h"
 
 //// STRING HANDLING FUNCTIONS ////
 
-// These functions are ported directly from Python/ast.c with some modifications
-// to account for the use of "Parser *p", the fact that don't have parser nodes
-// to pass around and the usage of some specialized APIs present only in this
-// file (like "_PyPegen_raise_syntax_error").
-
 static int
 warn_invalid_escape_sequence(Parser *p, unsigned char first_invalid_escape_char, Token *t)
 {
     PyObject *msg =
-        PyUnicode_FromFormat("invalid escape sequence \\%c", first_invalid_escape_char);
+        PyUnicode_FromFormat("invalid escape sequence '\\%c'", first_invalid_escape_char);
     if (msg == NULL) {
         return -1;
     }
@@ -32,7 +27,7 @@
                since _PyPegen_raise_error uses p->tokens[p->fill - 1] for the
                error location, if p->known_err_token is not set. */
             p->known_err_token = t;
-            RAISE_SYNTAX_ERROR("invalid escape sequence \\%c", first_invalid_escape_char);
+            RAISE_SYNTAX_ERROR("invalid escape sequence '\\%c'", first_invalid_escape_char);
         }
         Py_DECREF(msg);
         return -1;
@@ -92,7 +87,7 @@
         if (*s & 0x80) {
             PyObject *w;
             int kind;
-            void *data;
+            const void *data;
             Py_ssize_t w_len;
             Py_ssize_t i;
             w = decode_utf8(&s, end);
@@ -120,7 +115,7 @@
     s = buf;
 
     const char *first_invalid_escape;
-    v = _PyUnicode_DecodeUnicodeEscape(s, len, NULL, &first_invalid_escape);
+    v = _PyUnicode_DecodeUnicodeEscapeInternal(s, len, NULL, NULL, &first_invalid_escape);
 
     if (v != NULL && first_invalid_escape != NULL) {
         if (warn_invalid_escape_sequence(parser, *first_invalid_escape, t) < 0) {
@@ -255,7 +250,7 @@
             if (Py_CHARMASK(*ch) >= 0x80) {
                 RAISE_SYNTAX_ERROR(
                                    "bytes can only contain ASCII "
-                                   "literal characters.");
+                                   "literal characters");
                 return -1;
             }
         }
@@ -284,49 +279,48 @@
 /* Fix locations for the given node and its children.
 
    `parent` is the enclosing node.
+   `expr_start` is the starting position of the expression (pointing to the open brace).
    `n` is the node which locations are going to be fixed relative to parent.
    `expr_str` is the child node's string representation, including braces.
 */
 static bool
-fstring_find_expr_location(Token *parent, char *expr_str, int *p_lines, int *p_cols)
+fstring_find_expr_location(Token *parent, const char* expr_start, char *expr_str, int *p_lines, int *p_cols)
 {
     *p_lines = 0;
     *p_cols = 0;
+    assert(expr_start != NULL && *expr_start == '{');
     if (parent && parent->bytes) {
-        char *parent_str = PyBytes_AsString(parent->bytes);
+        const char *parent_str = PyBytes_AsString(parent->bytes);
         if (!parent_str) {
             return false;
         }
-        char *substr = strstr(parent_str, expr_str);
-        if (substr) {
-            // The following is needed, in order to correctly shift the column
-            // offset, in the case that (disregarding any whitespace) a newline
-            // immediately follows the opening curly brace of the fstring expression.
-            bool newline_after_brace = 1;
-            char *start = substr + 1;
-            while (start && *start != '}' && *start != '\n') {
-                if (*start != ' ' && *start != '\t' && *start != '\f') {
-                    newline_after_brace = 0;
-                    break;
-                }
-                start++;
+        // The following is needed, in order to correctly shift the column
+        // offset, in the case that (disregarding any whitespace) a newline
+        // immediately follows the opening curly brace of the fstring expression.
+        bool newline_after_brace = 1;
+        const char *start = expr_start + 1;
+        while (start && *start != '}' && *start != '\n') {
+            if (*start != ' ' && *start != '\t' && *start != '\f') {
+                newline_after_brace = 0;
+                break;
             }
+            start++;
+        }
 
-            // Account for the characters from the last newline character to our
-            // left until the beginning of substr.
-            if (!newline_after_brace) {
-                start = substr;
-                while (start > parent_str && *start != '\n') {
-                    start--;
-                }
-                *p_cols += (int)(substr - start);
+        // Account for the characters from the last newline character to our
+        // left until the beginning of expr_start.
+        if (!newline_after_brace) {
+            start = expr_start;
+            while (start > parent_str && *start != '\n') {
+                start--;
             }
-            /* adjust the start based on the number of newlines encountered
-               before the f-string expression */
-            for (char* p = parent_str; p < substr; p++) {
-                if (*p == '\n') {
-                    (*p_lines)++;
-                }
+            *p_cols += (int)(expr_start - start);
+        }
+        /* adjust the start based on the number of newlines encountered
+           before the f-string expression */
+        for (const char *p = parent_str; p < expr_start; p++) {
+            if (*p == '\n') {
+                (*p_lines)++;
             }
         }
     }
@@ -370,7 +364,7 @@
 
     len = expr_end - expr_start;
     /* Allocate 3 extra bytes: open paren, close paren, null byte. */
-    str = PyMem_Malloc(len + 3);
+    str = PyMem_Calloc(len + 3, sizeof(char));
     if (str == NULL) {
         PyErr_NoMemory();
         return NULL;
@@ -378,18 +372,11 @@
 
     // The call to fstring_find_expr_location is responsible for finding the column offset
     // the generated AST nodes need to be shifted to the right, which is equal to the number
-    // of the f-string characters before the expression starts. In order to correctly compute
-    // this offset, strstr gets called in fstring_find_expr_location which only succeeds
-    // if curly braces appear before and after the f-string expression (exactly like they do
-    // in the f-string itself), hence the following lines.
-    str[0] = '{';
+    // of the f-string characters before the expression starts.
     memcpy(str+1, expr_start, len);
-    str[len+1] = '}';
-    str[len+2] = 0;
-
     int lines, cols;
-    if (!fstring_find_expr_location(t, str, &lines, &cols)) {
-        PyMem_FREE(str);
+    if (!fstring_find_expr_location(t, expr_start-1, str+1, &lines, &cols)) {
+        PyMem_Free(str);
         return NULL;
     }
 
@@ -405,12 +392,15 @@
         return NULL;
     }
     Py_INCREF(p->tok->filename);
+
     tok->filename = p->tok->filename;
+    tok->lineno = t->lineno + lines - 1;
 
     Parser *p2 = _PyPegen_Parser_New(tok, Py_fstring_input, p->flags, p->feature_version,
                                      NULL, p->arena);
-    p2->starting_lineno = t->lineno + lines - 1;
-    p2->starting_col_offset = p->tok->first_lineno == p->tok->lineno ? t->col_offset + cols : cols;
+
+    p2->starting_lineno = t->lineno + lines;
+    p2->starting_col_offset = t->col_offset + cols;
 
     expr = _PyPegen_run_parser(p2);
 
@@ -452,12 +442,23 @@
         if (!raw && ch == '\\' && s < end) {
             ch = *s++;
             if (ch == 'N') {
+                /* We need to look at and skip matching braces for "\N{name}"
+                   sequences because otherwise we'll think the opening '{'
+                   starts an expression, which is not the case with "\N".
+                   Keep looking for either a matched '{' '}' pair, or the end
+                   of the string. */
+
                 if (s < end && *s++ == '{') {
                     while (s < end && *s++ != '}') {
                     }
                     continue;
                 }
-                break;
+
+                /* This is an invalid "\N" sequence, since it's a "\N" not
+                   followed by a "{".  Just keep parsing this literal.  This
+                   error will be caught later by
+                   decode_unicode_with_escapes(). */
+                continue;
             }
             if (ch == '{' && warn_invalid_escape_sequence(p, ch, t) < 0) {
                 return -1;
@@ -501,7 +502,8 @@
             *literal = PyUnicode_DecodeUTF8Stateful(literal_start,
                                                     s - literal_start,
                                                     NULL, NULL);
-        } else {
+        }
+        else {
             *literal = decode_unicode_with_escapes(p, literal_start,
                                                    s - literal_start, t);
         }
@@ -664,12 +666,12 @@
                     *str += 1;
                     continue;
                 }
-                /* Don't get out of the loop for these, if they're single
-                   chars (not part of 2-char tokens). If by themselves, they
-                   don't end an expression (unlike say '!'). */
-                if (ch == '>' || ch == '<') {
-                    continue;
-                }
+            }
+            /* Don't get out of the loop for these, if they're single
+               chars (not part of 2-char tokens). If by themselves, they
+               don't end an expression (unlike say '!'). */
+            if (ch == '>' || ch == '<') {
+                continue;
             }
 
             /* Normal way out of this loop. */
@@ -696,10 +698,10 @@
         }
     }
     expr_end = *str;
-    /* If we leave this loop in a string or with mismatched parens, we
-       don't care. We'll get a syntax error when compiling the
-       expression. But, we can produce a better error message, so
-       let's just do that.*/
+    /* If we leave the above loop in a string or with mismatched parens, we
+       don't really care. We'll get a syntax error when compiling the
+       expression. But, we can produce a better error message, so let's just
+       do that.*/
     if (quote_char) {
         RAISE_SYNTAX_ERROR("f-string: unterminated string");
         goto error;
@@ -802,10 +804,11 @@
     /* And now create the FormattedValue node that represents this
        entire expression with the conversion and format spec. */
     //TODO: Fix this
-    *expression = FormattedValue(simple_expression, conversion,
-                                 format_spec, first_token->lineno,
-                                 first_token->col_offset, last_token->end_lineno,
-                                 last_token->end_col_offset, p->arena);
+    *expression = _PyAST_FormattedValue(simple_expression, conversion,
+                                        format_spec, first_token->lineno,
+                                        first_token->col_offset,
+                                        last_token->end_lineno,
+                                        last_token->end_col_offset, p->arena);
     if (!*expression) {
         goto error;
     }
@@ -978,15 +981,15 @@
     l->size = -1;
 }
 
-static asdl_seq *
+static asdl_expr_seq *
 ExprList_Finish(ExprList *l, PyArena *arena)
 {
-    asdl_seq *seq;
+    asdl_expr_seq *seq;
 
     ExprList_check_invariants(l);
 
     /* Allocate the asdl_seq and copy the expressions in to it. */
-    seq = _Py_asdl_seq_new(l->size, arena);
+    seq = _Py_asdl_expr_seq_new(l->size, arena);
     if (seq) {
         Py_ssize_t i;
         for (i = 0; i < l->size; i++) {
@@ -1036,7 +1039,7 @@
     PyObject *kind = NULL;
     *str = NULL;
     assert(PyUnicode_CheckExact(s));
-    if (PyArena_AddPyObject(p->arena, s) < 0) {
+    if (_PyArena_AddPyObject(p->arena, s) < 0) {
         Py_DECREF(s);
         return NULL;
     }
@@ -1049,8 +1052,9 @@
         return NULL;
     }
 
-    return Constant(s, kind, first_token->lineno, first_token->col_offset,
-                    last_token->end_lineno, last_token->end_col_offset, p->arena);
+    return _PyAST_Constant(s, kind, first_token->lineno, first_token->col_offset,
+                           last_token->end_lineno, last_token->end_col_offset,
+                           p->arena);
 
 }
 
@@ -1175,7 +1179,7 @@
 _PyPegen_FstringParser_Finish(Parser *p, FstringParser *state, Token* first_token,
                      Token *last_token)
 {
-    asdl_seq *seq;
+    asdl_expr_seq *seq;
 
     FstringParser_check_invariants(state);
 
@@ -1209,8 +1213,9 @@
         goto error;
     }
 
-    return _Py_JoinedStr(seq, first_token->lineno, first_token->col_offset,
-                         last_token->end_lineno, last_token->end_col_offset, p->arena);
+    return _PyAST_JoinedStr(seq, first_token->lineno, first_token->col_offset,
+                            last_token->end_lineno, last_token->end_col_offset,
+                            p->arena);
 
 error:
     _PyPegen_FstringParser_Dealloc(state);
diff --git a/Parser/pegen/parse_string.h b/Parser/string_parser.h
similarity index 97%
rename from Parser/pegen/parse_string.h
rename to Parser/string_parser.h
index cd85bd5..4a22f3d 100644
--- a/Parser/pegen/parse_string.h
+++ b/Parser/string_parser.h
@@ -2,7 +2,7 @@
 #define STRINGS_H
 
 #include <Python.h>
-#include <Python-ast.h>
+#include <pycore_ast.h>
 #include "pegen.h"
 
 #define EXPRLIST_N_CACHED  64
diff --git a/Parser/token.c b/Parser/token.c
index a489668..74bca0e 100644
--- a/Parser/token.c
+++ b/Parser/token.c
@@ -65,6 +65,7 @@
     "ASYNC",
     "TYPE_IGNORE",
     "TYPE_COMMENT",
+    "SOFT_KEYWORD",
     "<ERRORTOKEN>",
     "<COMMENT>",
     "<NL>",
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index f3c1d9b..267ccec 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -13,7 +13,6 @@
 #include "unicodeobject.h"
 #include "bytesobject.h"
 #include "fileobject.h"
-#include "codecs.h"
 #include "abstract.h"
 
 /* Alternate tab spacing */
@@ -40,7 +39,7 @@
 static struct tok_state *tok_new(void);
 static int tok_nextc(struct tok_state *tok);
 static void tok_backup(struct tok_state *tok, int c);
-
+static int syntaxerror(struct tok_state *tok, const char *format, ...);
 
 /* Spaces in this constant are treated as "zero or more spaces or tabs" when
    tokenizing. */
@@ -51,11 +50,14 @@
 static struct tok_state *
 tok_new(void)
 {
-    struct tok_state *tok = (struct tok_state *)PyMem_MALLOC(
+    struct tok_state *tok = (struct tok_state *)PyMem_Malloc(
                                             sizeof(struct tok_state));
     if (tok == NULL)
         return NULL;
     tok->buf = tok->cur = tok->inp = NULL;
+    tok->fp_interactive = 0;
+    tok->interactive_src_start = NULL;
+    tok->interactive_src_end = NULL;
     tok->start = NULL;
     tok->end = NULL;
     tok->done = E_OK;
@@ -64,7 +66,6 @@
     tok->tabsize = TABSIZE;
     tok->indent = 0;
     tok->indstack[0] = 0;
-
     tok->atbol = 1;
     tok->pendin = 0;
     tok->prompt = tok->nextprompt = NULL;
@@ -73,7 +74,6 @@
     tok->altindstack[0] = 0;
     tok->decoding_state = STATE_INIT;
     tok->decoding_erred = 0;
-    tok->read_coding_spec = 0;
     tok->enc = NULL;
     tok->encoding = NULL;
     tok->cont_line = 0;
@@ -81,19 +81,19 @@
     tok->decoding_readline = NULL;
     tok->decoding_buffer = NULL;
     tok->type_comments = 0;
-
     tok->async_hacks = 0;
     tok->async_def = 0;
     tok->async_def_indent = 0;
     tok->async_def_nl = 0;
-
+    tok->interactive_underflow = IUNDERFLOW_NORMAL;
+    tok->str = NULL;
     return tok;
 }
 
 static char *
 new_string(const char *s, Py_ssize_t len, struct tok_state *tok)
 {
-    char* result = (char *)PyMem_MALLOC(len + 1);
+    char* result = (char *)PyMem_Malloc(len + 1);
     if (!result) {
         tok->done = E_NOMEM;
         return NULL;
@@ -108,7 +108,7 @@
 {
     tok->decoding_erred = 1;
     if (tok->fp != NULL && tok->buf != NULL) /* see PyTokenizer_Free */
-        PyMem_FREE(tok->buf);
+        PyMem_Free(tok->buf);
     tok->buf = tok->cur = tok->inp = NULL;
     tok->start = NULL;
     tok->end = NULL;
@@ -163,14 +163,14 @@
     }
     for (; i < size - 6; i++) { /* XXX inefficient search */
         const char* t = s + i;
-        if (strncmp(t, "coding", 6) == 0) {
+        if (memcmp(t, "coding", 6) == 0) {
             const char* begin = NULL;
             t += 6;
             if (t[0] != ':' && t[0] != '=')
                 continue;
             do {
                 t++;
-            } while (t[0] == '\x20' || t[0] == '\t');
+            } while (t[0] == ' ' || t[0] == '\t');
 
             begin = t;
             while (Py_ISALNUM(t[0]) ||
@@ -184,7 +184,7 @@
                     return 0;
                 q = get_normal_name(r);
                 if (r != q) {
-                    PyMem_FREE(r);
+                    PyMem_Free(r);
                     r = new_string(q, strlen(q), tok);
                     if (!r)
                         return 0;
@@ -207,15 +207,14 @@
                   int set_readline(struct tok_state *, const char *))
 {
     char *cs;
-    int r = 1;
-
     if (tok->cont_line) {
         /* It's a continuation line, so it can't be a coding spec. */
-        tok->read_coding_spec = 1;
+        tok->decoding_state = STATE_NORMAL;
         return 1;
     }
-    if (!get_coding_spec(line, &cs, size, tok))
+    if (!get_coding_spec(line, &cs, size, tok)) {
         return 0;
+    }
     if (!cs) {
         Py_ssize_t i;
         for (i = 0; i < size; i++) {
@@ -224,37 +223,33 @@
             if (line[i] != ' ' && line[i] != '\t' && line[i] != '\014') {
                 /* Stop checking coding spec after a line containing
                  * anything except a comment. */
-                tok->read_coding_spec = 1;
+                tok->decoding_state = STATE_NORMAL;
                 break;
             }
         }
         return 1;
     }
-    tok->read_coding_spec = 1;
+    tok->decoding_state = STATE_NORMAL;
     if (tok->encoding == NULL) {
-        assert(tok->decoding_state == STATE_RAW);
-        if (strcmp(cs, "utf-8") == 0) {
-            tok->encoding = cs;
-        } else {
-            r = set_readline(tok, cs);
-            if (r) {
-                tok->encoding = cs;
-                tok->decoding_state = STATE_NORMAL;
-            }
-            else {
-                PyErr_Format(PyExc_SyntaxError,
-                             "encoding problem: %s", cs);
-                PyMem_FREE(cs);
-            }
+        assert(tok->decoding_readline == NULL);
+        if (strcmp(cs, "utf-8") != 0 && !set_readline(tok, cs)) {
+            error_ret(tok);
+            PyErr_Format(PyExc_SyntaxError, "encoding problem: %s", cs);
+            PyMem_Free(cs);
+            return 0;
         }
+        tok->encoding = cs;
     } else {                /* then, compare cs with BOM */
-        r = (strcmp(tok->encoding, cs) == 0);
-        if (!r)
+        if (strcmp(tok->encoding, cs) != 0) {
+            error_ret(tok);
             PyErr_Format(PyExc_SyntaxError,
                          "encoding problem: %s with BOM", cs);
-        PyMem_FREE(cs);
+            PyMem_Free(cs);
+            return 0;
+        }
+        PyMem_Free(cs);
     }
-    return r;
+    return 1;
 }
 
 /* See whether the file starts with a BOM. If it does,
@@ -269,7 +264,7 @@
 {
     int ch1, ch2, ch3;
     ch1 = get_char(tok);
-    tok->decoding_state = STATE_RAW;
+    tok->decoding_state = STATE_SEEK_CODING;
     if (ch1 == EOF) {
         return 1;
     } else if (ch1 == 0xEF) {
@@ -315,7 +310,7 @@
         return 1;
     }
     if (tok->encoding != NULL)
-        PyMem_FREE(tok->encoding);
+        PyMem_Free(tok->encoding);
     tok->encoding = new_string("utf-8", 5, tok);
     if (!tok->encoding)
         return 0;
@@ -323,6 +318,36 @@
     return 1;
 }
 
+static int
+tok_concatenate_interactive_new_line(struct tok_state *tok, const char *line) {
+    assert(tok->fp_interactive);
+
+    if (!line) {
+        return 0;
+    }
+
+    Py_ssize_t current_size = tok->interactive_src_end - tok->interactive_src_start;
+    Py_ssize_t line_size = strlen(line);
+    char* new_str = tok->interactive_src_start;
+
+    new_str = PyMem_Realloc(new_str, current_size + line_size + 1);
+    if (!new_str) {
+        if (tok->interactive_src_start) {
+            PyMem_Free(tok->interactive_src_start);
+        }
+        tok->interactive_src_start = NULL;
+        tok->interactive_src_end = NULL;
+        tok->done = E_NOMEM;
+        return -1;
+    }
+    strcpy(new_str + current_size, line);
+
+    tok->interactive_src_start = new_str;
+    tok->interactive_src_end = new_str + current_size + line_size;
+    return 0;
+}
+
+
 /* Read a line of text from TOK into S, using the stream in TOK.
    Return NULL on failure, else S.
 
@@ -330,73 +355,77 @@
      1) NULL: need to call tok->decoding_readline to get a new line
      2) PyUnicodeObject *: decoding_feof has called tok->decoding_readline and
        stored the result in tok->decoding_buffer
-     3) PyByteArrayObject *: previous call to fp_readl did not have enough room
+     3) PyByteArrayObject *: previous call to tok_readline_recode did not have enough room
        (in the s buffer) to copy entire contents of the line read
        by tok->decoding_readline.  tok->decoding_buffer has the overflow.
-       In this case, fp_readl is called in a loop (with an expanded buffer)
+       In this case, tok_readline_recode is called in a loop (with an expanded buffer)
        until the buffer ends with a '\n' (or until the end of the file is
-       reached): see tok_nextc and its calls to decoding_fgets.
+       reached): see tok_nextc and its calls to tok_reserve_buf.
 */
 
-static char *
-fp_readl(char *s, int size, struct tok_state *tok)
+static int
+tok_reserve_buf(struct tok_state *tok, Py_ssize_t size)
 {
-    PyObject* bufobj;
-    const char *buf;
+    Py_ssize_t cur = tok->cur - tok->buf;
+    Py_ssize_t oldsize = tok->inp - tok->buf;
+    Py_ssize_t newsize = oldsize + Py_MAX(size, oldsize >> 1);
+    if (newsize > tok->end - tok->buf) {
+        char *newbuf = tok->buf;
+        Py_ssize_t start = tok->start == NULL ? -1 : tok->start - tok->buf;
+        Py_ssize_t line_start = tok->start == NULL ? -1 : tok->line_start - tok->buf;
+        Py_ssize_t multi_line_start = tok->multi_line_start - tok->buf;
+        newbuf = (char *)PyMem_Realloc(newbuf, newsize);
+        if (newbuf == NULL) {
+            tok->done = E_NOMEM;
+            return 0;
+        }
+        tok->buf = newbuf;
+        tok->cur = tok->buf + cur;
+        tok->inp = tok->buf + oldsize;
+        tok->end = tok->buf + newsize;
+        tok->start = start < 0 ? NULL : tok->buf + start;
+        tok->line_start = line_start < 0 ? NULL : tok->buf + line_start;
+        tok->multi_line_start = multi_line_start < 0 ? NULL : tok->buf + multi_line_start;
+    }
+    return 1;
+}
+
+static int
+tok_readline_recode(struct tok_state *tok) {
+    PyObject *line;
+    const  char *buf;
     Py_ssize_t buflen;
-
-    /* Ask for one less byte so we can terminate it */
-    assert(size > 0);
-    size--;
-
-    if (tok->decoding_buffer) {
-        bufobj = tok->decoding_buffer;
-        Py_INCREF(bufobj);
-    }
-    else
-    {
-        bufobj = _PyObject_CallNoArg(tok->decoding_readline);
-        if (bufobj == NULL)
-            goto error;
-    }
-    if (PyUnicode_CheckExact(bufobj))
-    {
-        buf = PyUnicode_AsUTF8AndSize(bufobj, &buflen);
-        if (buf == NULL) {
+    line = tok->decoding_buffer;
+    if (line == NULL) {
+        line = PyObject_CallNoArgs(tok->decoding_readline);
+        if (line == NULL) {
+            error_ret(tok);
             goto error;
         }
     }
-    else
-    {
-        buf = PyByteArray_AsString(bufobj);
-        if (buf == NULL) {
-            goto error;
-        }
-        buflen = PyByteArray_GET_SIZE(bufobj);
-    }
-
-    Py_XDECREF(tok->decoding_buffer);
-    if (buflen > size) {
-        /* Too many chars, the rest goes into tok->decoding_buffer */
-        tok->decoding_buffer = PyByteArray_FromStringAndSize(buf+size,
-                                                         buflen-size);
-        if (tok->decoding_buffer == NULL)
-            goto error;
-        buflen = size;
-    }
-    else
+    else {
         tok->decoding_buffer = NULL;
-
-    memcpy(s, buf, buflen);
-    s[buflen] = '\0';
-    if (buflen == 0) /* EOF */
-        s = NULL;
-    Py_DECREF(bufobj);
-    return s;
-
+    }
+    buf = PyUnicode_AsUTF8AndSize(line, &buflen);
+    if (buf == NULL) {
+        error_ret(tok);
+        goto error;
+    }
+    if (!tok_reserve_buf(tok, buflen + 1)) {
+        goto error;
+    }
+    memcpy(tok->inp, buf, buflen);
+    tok->inp += buflen;
+    *tok->inp = '\0';
+    if (tok->fp_interactive &&
+        tok_concatenate_interactive_new_line(tok, buf) == -1) {
+        goto error;
+    }
+    Py_DECREF(line);
+    return 1;
 error:
-    Py_XDECREF(bufobj);
-    return error_ret(tok);
+    Py_XDECREF(line);
+    return 0;
 }
 
 /* Set the readline function for TOK to a StreamReader's
@@ -497,82 +526,30 @@
     return length;
 }
 
-/* Read a line of input from TOK. Determine encoding
-   if necessary.  */
-
-static char *
-decoding_fgets(char *s, int size, struct tok_state *tok)
+static int
+ensure_utf8(char *line, struct tok_state *tok)
 {
-    char *line = NULL;
     int badchar = 0;
-    for (;;) {
-        if (tok->decoding_state == STATE_NORMAL) {
-            /* We already have a codec associated with
-               this input. */
-            line = fp_readl(s, size, tok);
+    unsigned char *c;
+    int length;
+    for (c = (unsigned char *)line; *c; c += length) {
+        if (!(length = valid_utf8(c))) {
+            badchar = *c;
             break;
-        } else if (tok->decoding_state == STATE_RAW) {
-            /* We want a 'raw' read. */
-            line = Py_UniversalNewlineFgets(s, size,
-                                            tok->fp, NULL);
-            break;
-        } else {
-            /* We have not yet determined the encoding.
-               If an encoding is found, use the file-pointer
-               reader functions from now on. */
-            if (!check_bom(fp_getc, fp_ungetc, fp_setreadl, tok))
-                return error_ret(tok);
-            assert(tok->decoding_state != STATE_INIT);
         }
     }
-    if (line != NULL && tok->lineno < 2 && !tok->read_coding_spec) {
-        if (!check_coding_spec(line, strlen(line), tok, fp_setreadl)) {
-            return error_ret(tok);
-        }
-    }
-    /* The default encoding is UTF-8, so make sure we don't have any
-       non-UTF-8 sequences in it. */
-    if (line && !tok->encoding) {
-        unsigned char *c;
-        int length;
-        for (c = (unsigned char *)line; *c; c += length)
-            if (!(length = valid_utf8(c))) {
-                badchar = *c;
-                break;
-            }
-    }
     if (badchar) {
         /* Need to add 1 to the line number, since this line
-           has not been counted, yet.  */
+       has not been counted, yet.  */
         PyErr_Format(PyExc_SyntaxError,
-                "Non-UTF-8 code starting with '\\x%.2x' "
-                "in file %U on line %i, "
-                "but no encoding declared; "
-                "see http://python.org/dev/peps/pep-0263/ for details",
-                badchar, tok->filename, tok->lineno + 1);
-        return error_ret(tok);
+                     "Non-UTF-8 code starting with '\\x%.2x' "
+                     "in file %U on line %i, "
+                     "but no encoding declared; "
+                     "see https://python.org/dev/peps/pep-0263/ for details",
+                     badchar, tok->filename, tok->lineno + 1);
+        return 0;
     }
-    return line;
-}
-
-static int
-decoding_feof(struct tok_state *tok)
-{
-    if (tok->decoding_state != STATE_NORMAL) {
-        return feof(tok->fp);
-    } else {
-        PyObject* buf = tok->decoding_buffer;
-        if (buf == NULL) {
-            buf = _PyObject_CallNoArg(tok->decoding_readline);
-            if (buf == NULL) {
-                error_ret(tok);
-                return 1;
-            } else {
-                tok->decoding_buffer = buf;
-            }
-        }
-        return PyObject_Length(buf) == 0;
-    }
+    return 1;
 }
 
 /* Fetch a byte from TOK, using the string buffer. */
@@ -620,7 +597,7 @@
     size_t needed_length = strlen(s) + 2, final_length;
     char *buf, *current;
     char c = '\0';
-    buf = PyMem_MALLOC(needed_length);
+    buf = PyMem_Malloc(needed_length);
     if (buf == NULL) {
         tok->done = E_NOMEM;
         return NULL;
@@ -651,9 +628,9 @@
     final_length = current - buf + 1;
     if (final_length < needed_length && final_length) {
         /* should never fail */
-        char* result = PyMem_REALLOC(buf, final_length);
+        char* result = PyMem_Realloc(buf, final_length);
         if (result == NULL) {
-            PyMem_FREE(buf);
+            PyMem_Free(buf);
         }
         buf = result;
     }
@@ -700,12 +677,13 @@
     /* need to check line 1 and 2 separately since check_coding_spec
        assumes a single line as input */
     if (newl[0]) {
-        if (!check_coding_spec(str, newl[0] - str, tok, buf_setreadl))
-            return error_ret(tok);
-        if (tok->enc == NULL && !tok->read_coding_spec && newl[1]) {
+        if (!check_coding_spec(str, newl[0] - str, tok, buf_setreadl)) {
+            return NULL;
+        }
+        if (tok->enc == NULL && tok->decoding_state != STATE_NORMAL && newl[1]) {
             if (!check_coding_spec(newl[0]+1, newl[1] - newl[0],
                                    tok, buf_setreadl))
-                return error_ret(tok);
+                return NULL;
         }
     }
     if (tok->enc != NULL) {
@@ -741,6 +719,8 @@
     return tok;
 }
 
+/* Set up tokenizer for UTF-8 string */
+
 struct tok_state *
 PyTokenizer_FromUTF8(const char *str, int exec_input)
 {
@@ -753,16 +733,14 @@
         PyTokenizer_Free(tok);
         return NULL;
     }
-    tok->decoding_state = STATE_RAW;
-    tok->read_coding_spec = 1;
+    tok->decoding_state = STATE_NORMAL;
     tok->enc = NULL;
     tok->str = translated;
-    tok->encoding = (char *)PyMem_MALLOC(6);
+    tok->encoding = new_string("utf-8", 5, tok);
     if (!tok->encoding) {
         PyTokenizer_Free(tok);
         return NULL;
     }
-    strcpy(tok->encoding, "utf-8");
 
     tok->buf = tok->cur = tok->inp = translated;
     tok->end = translated;
@@ -778,7 +756,7 @@
     struct tok_state *tok = tok_new();
     if (tok == NULL)
         return NULL;
-    if ((tok->buf = (char *)PyMem_MALLOC(BUFSIZ)) == NULL) {
+    if ((tok->buf = (char *)PyMem_Malloc(BUFSIZ)) == NULL) {
         PyTokenizer_Free(tok);
         return NULL;
     }
@@ -790,237 +768,296 @@
     if (enc != NULL) {
         /* Must copy encoding declaration since it
            gets copied into the parse tree. */
-        tok->encoding = PyMem_MALLOC(strlen(enc)+1);
+        tok->encoding = new_string(enc, strlen(enc), tok);
         if (!tok->encoding) {
             PyTokenizer_Free(tok);
             return NULL;
         }
-        strcpy(tok->encoding, enc);
         tok->decoding_state = STATE_NORMAL;
     }
     return tok;
 }
 
-
 /* Free a tok_state structure */
 
 void
 PyTokenizer_Free(struct tok_state *tok)
 {
-    if (tok->encoding != NULL)
-        PyMem_FREE(tok->encoding);
+    if (tok->encoding != NULL) {
+        PyMem_Free(tok->encoding);
+    }
     Py_XDECREF(tok->decoding_readline);
     Py_XDECREF(tok->decoding_buffer);
     Py_XDECREF(tok->filename);
-    if (tok->fp != NULL && tok->buf != NULL)
-        PyMem_FREE(tok->buf);
-    if (tok->input)
-        PyMem_FREE(tok->input);
-    PyMem_FREE(tok);
+    if (tok->fp != NULL && tok->buf != NULL) {
+        PyMem_Free(tok->buf);
+    }
+    if (tok->input) {
+        PyMem_Free(tok->input);
+    }
+    if (tok->interactive_src_start != NULL) {
+        PyMem_Free(tok->interactive_src_start);
+    }
+    PyMem_Free(tok);
 }
 
+static int
+tok_readline_raw(struct tok_state *tok)
+{
+    do {
+        if (!tok_reserve_buf(tok, BUFSIZ)) {
+            return 0;
+        }
+        char *line = Py_UniversalNewlineFgets(tok->inp,
+                                              (int)(tok->end - tok->inp),
+                                              tok->fp, NULL);
+        if (line == NULL) {
+            return 1;
+        }
+        if (tok->fp_interactive &&
+            tok_concatenate_interactive_new_line(tok, line) == -1) {
+            return 0;
+        }
+        tok->inp = strchr(tok->inp, '\0');
+        if (tok->inp == tok->buf) {
+            return 0;
+        }
+    } while (tok->inp[-1] != '\n');
+    return 1;
+}
+
+static int
+tok_underflow_string(struct tok_state *tok) {
+    char *end = strchr(tok->inp, '\n');
+    if (end != NULL) {
+        end++;
+    }
+    else {
+        end = strchr(tok->inp, '\0');
+        if (end == tok->inp) {
+            tok->done = E_EOF;
+            return 0;
+        }
+    }
+    if (tok->start == NULL) {
+        tok->buf = tok->cur;
+    }
+    tok->line_start = tok->cur;
+    tok->lineno++;
+    tok->inp = end;
+    return 1;
+}
+
+static int
+tok_underflow_interactive(struct tok_state *tok) {
+    if (tok->interactive_underflow == IUNDERFLOW_STOP) {
+        tok->done = E_INTERACT_STOP;
+        return 1;
+    }
+    char *newtok = PyOS_Readline(tok->fp ? tok->fp : stdin, stdout, tok->prompt);
+    if (newtok != NULL) {
+        char *translated = translate_newlines(newtok, 0, tok);
+        PyMem_Free(newtok);
+        if (translated == NULL) {
+            return 0;
+        }
+        newtok = translated;
+    }
+    if (tok->encoding && newtok && *newtok) {
+        /* Recode to UTF-8 */
+        Py_ssize_t buflen;
+        const char* buf;
+        PyObject *u = translate_into_utf8(newtok, tok->encoding);
+        PyMem_Free(newtok);
+        if (u == NULL) {
+            tok->done = E_DECODE;
+            return 0;
+        }
+        buflen = PyBytes_GET_SIZE(u);
+        buf = PyBytes_AS_STRING(u);
+        newtok = PyMem_Malloc(buflen+1);
+        if (newtok == NULL) {
+            Py_DECREF(u);
+            tok->done = E_NOMEM;
+            return 0;
+        }
+        strcpy(newtok, buf);
+        Py_DECREF(u);
+    }
+    if (tok->fp_interactive &&
+        tok_concatenate_interactive_new_line(tok, newtok) == -1) {
+        PyMem_Free(newtok);
+        return 0;
+    }
+    if (tok->nextprompt != NULL) {
+        tok->prompt = tok->nextprompt;
+    }
+    if (newtok == NULL) {
+        tok->done = E_INTR;
+    }
+    else if (*newtok == '\0') {
+        PyMem_Free(newtok);
+        tok->done = E_EOF;
+    }
+    else if (tok->start != NULL) {
+        Py_ssize_t cur_multi_line_start = tok->multi_line_start - tok->buf;
+        size_t size = strlen(newtok);
+        tok->lineno++;
+        if (!tok_reserve_buf(tok, size + 1)) {
+            PyMem_Free(tok->buf);
+            tok->buf = NULL;
+            PyMem_Free(newtok);
+            return 0;
+        }
+        memcpy(tok->cur, newtok, size + 1);
+        PyMem_Free(newtok);
+        tok->inp += size;
+        tok->multi_line_start = tok->buf + cur_multi_line_start;
+    }
+    else {
+        tok->lineno++;
+        PyMem_Free(tok->buf);
+        tok->buf = newtok;
+        tok->cur = tok->buf;
+        tok->line_start = tok->buf;
+        tok->inp = strchr(tok->buf, '\0');
+        tok->end = tok->inp + 1;
+    }
+    if (tok->done != E_OK) {
+        if (tok->prompt != NULL) {
+            PySys_WriteStderr("\n");
+        }
+        return 0;
+    }
+    return 1;
+}
+
+static int
+tok_underflow_file(struct tok_state *tok) {
+    if (tok->start == NULL) {
+        tok->cur = tok->inp = tok->buf;
+    }
+    if (tok->decoding_state == STATE_INIT) {
+        /* We have not yet determined the encoding.
+           If an encoding is found, use the file-pointer
+           reader functions from now on. */
+        if (!check_bom(fp_getc, fp_ungetc, fp_setreadl, tok)) {
+            error_ret(tok);
+            return 0;
+        }
+        assert(tok->decoding_state != STATE_INIT);
+    }
+    /* Read until '\n' or EOF */
+    if (tok->decoding_readline != NULL) {
+        /* We already have a codec associated with this input. */
+        if (!tok_readline_recode(tok)) {
+            return 0;
+        }
+    }
+    else {
+        /* We want a 'raw' read. */
+        if (!tok_readline_raw(tok)) {
+            return 0;
+        }
+    }
+    if (tok->inp == tok->cur) {
+        tok->done = E_EOF;
+        return 0;
+    }
+    if (tok->inp[-1] != '\n') {
+        /* Last line does not end in \n, fake one */
+        *tok->inp++ = '\n';
+        *tok->inp = '\0';
+    }
+
+    tok->lineno++;
+    if (tok->decoding_state != STATE_NORMAL) {
+        if (tok->lineno > 2) {
+            tok->decoding_state = STATE_NORMAL;
+        }
+        else if (!check_coding_spec(tok->cur, strlen(tok->cur),
+                                    tok, fp_setreadl))
+        {
+            return 0;
+        }
+    }
+    /* The default encoding is UTF-8, so make sure we don't have any
+       non-UTF-8 sequences in it. */
+    if (!tok->encoding && !ensure_utf8(tok->cur, tok)) {
+        error_ret(tok);
+        return 0;
+    }
+    assert(tok->done == E_OK);
+    return tok->done == E_OK;
+}
+
+#if defined(Py_DEBUG)
+static void
+print_escape(FILE *f, const char *s, Py_ssize_t size)
+{
+    if (s == NULL) {
+        fputs("NULL", f);
+        return;
+    }
+    putc('"', f);
+    while (size-- > 0) {
+        unsigned char c = *s++;
+        switch (c) {
+            case '\n': fputs("\\n", f); break;
+            case '\r': fputs("\\r", f); break;
+            case '\t': fputs("\\t", f); break;
+            case '\f': fputs("\\f", f); break;
+            case '\'': fputs("\\'", f); break;
+            case '"': fputs("\\\"", f); break;
+            default:
+                if (0x20 <= c && c <= 0x7f)
+                    putc(c, f);
+                else
+                    fprintf(f, "\\x%02x", c);
+        }
+    }
+    putc('"', f);
+}
+#endif
+
 /* Get next char, updating state; error code goes into tok->done */
 
 static int
 tok_nextc(struct tok_state *tok)
 {
+    int rc;
     for (;;) {
         if (tok->cur != tok->inp) {
             return Py_CHARMASK(*tok->cur++); /* Fast path */
         }
-        if (tok->done != E_OK)
-            return EOF;
-        if (tok->fp == NULL) {
-            char *end = strchr(tok->inp, '\n');
-            if (end != NULL)
-                end++;
-            else {
-                end = strchr(tok->inp, '\0');
-                if (end == tok->inp) {
-                    tok->done = E_EOF;
-                    return EOF;
-                }
-            }
-            if (tok->start == NULL)
-                tok->buf = tok->cur;
-            tok->line_start = tok->cur;
-            tok->lineno++;
-            tok->inp = end;
-            return Py_CHARMASK(*tok->cur++);
+        if (tok->done != E_OK) {
+           return EOF;
         }
-        if (tok->prompt != NULL) {
-            char *newtok = PyOS_Readline(stdin, stdout, tok->prompt);
-            if (newtok != NULL) {
-                char *translated = translate_newlines(newtok, 0, tok);
-                PyMem_FREE(newtok);
-                if (translated == NULL)
-                    return EOF;
-                newtok = translated;
-            }
-            if (tok->encoding && newtok && *newtok) {
-                /* Recode to UTF-8 */
-                Py_ssize_t buflen;
-                const char* buf;
-                PyObject *u = translate_into_utf8(newtok, tok->encoding);
-                PyMem_FREE(newtok);
-                if (!u) {
-                    tok->done = E_DECODE;
-                    return EOF;
-                }
-                buflen = PyBytes_GET_SIZE(u);
-                buf = PyBytes_AS_STRING(u);
-                newtok = PyMem_MALLOC(buflen+1);
-                if (newtok == NULL) {
-                    Py_DECREF(u);
-                    tok->done = E_NOMEM;
-                    return EOF;
-                }
-                strcpy(newtok, buf);
-                Py_DECREF(u);
-            }
-            if (tok->nextprompt != NULL)
-                tok->prompt = tok->nextprompt;
-            if (newtok == NULL)
-                tok->done = E_INTR;
-            else if (*newtok == '\0') {
-                PyMem_FREE(newtok);
-                tok->done = E_EOF;
-            }
-            else if (tok->start != NULL) {
-                size_t start = tok->start - tok->buf;
-                size_t oldlen = tok->cur - tok->buf;
-                size_t newlen = oldlen + strlen(newtok);
-                Py_ssize_t cur_multi_line_start = tok->multi_line_start - tok->buf;
-                char *buf = tok->buf;
-                buf = (char *)PyMem_REALLOC(buf, newlen+1);
-                tok->lineno++;
-                if (buf == NULL) {
-                    PyMem_FREE(tok->buf);
-                    tok->buf = NULL;
-                    PyMem_FREE(newtok);
-                    tok->done = E_NOMEM;
-                    return EOF;
-                }
-                tok->buf = buf;
-                tok->cur = tok->buf + oldlen;
-                tok->multi_line_start = tok->buf + cur_multi_line_start;
-                tok->line_start = tok->cur;
-                strcpy(tok->buf + oldlen, newtok);
-                PyMem_FREE(newtok);
-                tok->inp = tok->buf + newlen;
-                tok->end = tok->inp + 1;
-                tok->start = tok->buf + start;
-            }
-            else {
-                tok->lineno++;
-                if (tok->buf != NULL)
-                    PyMem_FREE(tok->buf);
-                tok->buf = newtok;
-                tok->cur = tok->buf;
-                tok->line_start = tok->buf;
-                tok->inp = strchr(tok->buf, '\0');
-                tok->end = tok->inp + 1;
-            }
+        if (tok->fp == NULL) {
+            rc = tok_underflow_string(tok);
+        }
+        else if (tok->prompt != NULL) {
+            rc = tok_underflow_interactive(tok);
         }
         else {
-            int done = 0;
-            Py_ssize_t cur = 0;
-            char *pt;
-            if (tok->start == NULL) {
-                if (tok->buf == NULL) {
-                    tok->buf = (char *)
-                        PyMem_MALLOC(BUFSIZ);
-                    if (tok->buf == NULL) {
-                        tok->done = E_NOMEM;
-                        return EOF;
-                    }
-                    tok->end = tok->buf + BUFSIZ;
-                }
-                if (decoding_fgets(tok->buf, (int)(tok->end - tok->buf),
-                          tok) == NULL) {
-                    if (!tok->decoding_erred)
-                        tok->done = E_EOF;
-                    done = 1;
-                }
-                else {
-                    tok->done = E_OK;
-                    tok->inp = strchr(tok->buf, '\0');
-                    done = tok->inp == tok->buf || tok->inp[-1] == '\n';
-                }
-            }
-            else {
-                cur = tok->cur - tok->buf;
-                if (decoding_feof(tok)) {
-                    tok->done = E_EOF;
-                    done = 1;
-                }
-                else
-                    tok->done = E_OK;
-            }
-            tok->lineno++;
-            /* Read until '\n' or EOF */
-            while (!done) {
-                Py_ssize_t curstart = tok->start == NULL ? -1 :
-                          tok->start - tok->buf;
-                Py_ssize_t cur_multi_line_start = tok->multi_line_start - tok->buf;
-                Py_ssize_t curvalid = tok->inp - tok->buf;
-                Py_ssize_t newsize = curvalid + BUFSIZ;
-                char *newbuf = tok->buf;
-                newbuf = (char *)PyMem_REALLOC(newbuf,
-                                               newsize);
-                if (newbuf == NULL) {
-                    tok->done = E_NOMEM;
-                    tok->cur = tok->inp;
-                    return EOF;
-                }
-                tok->buf = newbuf;
-                tok->cur = tok->buf + cur;
-                tok->multi_line_start = tok->buf + cur_multi_line_start;
-                tok->line_start = tok->cur;
-                tok->inp = tok->buf + curvalid;
-                tok->end = tok->buf + newsize;
-                tok->start = curstart < 0 ? NULL :
-                         tok->buf + curstart;
-                if (decoding_fgets(tok->inp,
-                               (int)(tok->end - tok->inp),
-                               tok) == NULL) {
-                    /* Break out early on decoding
-                       errors, as tok->buf will be NULL
-                     */
-                    if (tok->decoding_erred)
-                        return EOF;
-                    /* Last line does not end in \n,
-                       fake one */
-                    if (tok->inp[-1] != '\n')
-                        strcpy(tok->inp, "\n");
-                }
-                tok->inp = strchr(tok->inp, '\0');
-                done = tok->inp[-1] == '\n';
-            }
-            if (tok->buf != NULL) {
-                tok->cur = tok->buf + cur;
-                tok->line_start = tok->cur;
-                /* replace "\r\n" with "\n" */
-                /* For Mac leave the \r, giving a syntax error */
-                pt = tok->inp - 2;
-                if (pt >= tok->buf && *pt == '\r') {
-                    *pt++ = '\n';
-                    *pt = '\0';
-                    tok->inp = pt;
-                }
-            }
+            rc = tok_underflow_file(tok);
         }
-        if (tok->done != E_OK) {
-            if (tok->prompt != NULL)
-                PySys_WriteStderr("\n");
+#if defined(Py_DEBUG)
+        if (Py_DebugFlag) {
+            fprintf(stderr, "line[%d] = ", tok->lineno);
+            print_escape(stderr, tok->cur, tok->inp - tok->cur);
+            fprintf(stderr, "  tok->done = %d\n", tok->done);
+        }
+#endif
+        if (!rc) {
             tok->cur = tok->inp;
             return EOF;
         }
+        tok->line_start = tok->cur;
     }
-    /*NOTREACHED*/
+    Py_UNREACHABLE();
 }
 
-
 /* Back-up one character */
 
 static void
@@ -1030,25 +1067,19 @@
         if (--tok->cur < tok->buf) {
             Py_FatalError("tokenizer beginning of buffer");
         }
-        if (*tok->cur != c) {
-            *tok->cur = c;
+        if ((int)(unsigned char)*tok->cur != c) {
+            Py_FatalError("tok_backup: wrong character");
         }
     }
 }
 
-
 static int
-syntaxerror(struct tok_state *tok, const char *format, ...)
+_syntaxerror_range(struct tok_state *tok, const char *format,
+                   int col_offset, int end_col_offset,
+                   va_list vargs)
 {
     PyObject *errmsg, *errtext, *args;
-    va_list vargs;
-#ifdef HAVE_STDARG_PROTOTYPES
-    va_start(vargs, format);
-#else
-    va_start(vargs);
-#endif
     errmsg = PyUnicode_FromFormatV(format, vargs);
-    va_end(vargs);
     if (!errmsg) {
         goto error;
     }
@@ -1058,7 +1089,14 @@
     if (!errtext) {
         goto error;
     }
-    int offset = (int)PyUnicode_GET_LENGTH(errtext);
+
+    if (col_offset == -1) {
+        col_offset = (int)PyUnicode_GET_LENGTH(errtext);
+    }
+    if (end_col_offset == -1) {
+        end_col_offset = col_offset;
+    }
+
     Py_ssize_t line_len = strcspn(tok->line_start, "\n");
     if (line_len != tok->cur - tok->line_start) {
         Py_DECREF(errtext);
@@ -1069,8 +1107,8 @@
         goto error;
     }
 
-    args = Py_BuildValue("(O(OiiN))", errmsg,
-                         tok->filename, tok->lineno, offset, errtext);
+    args = Py_BuildValue("(O(OiiNii))", errmsg, tok->filename, tok->lineno,
+                         col_offset, errtext, tok->lineno, end_col_offset);
     if (args) {
         PyErr_SetObject(PyExc_SyntaxError, args);
         Py_DECREF(args);
@@ -1083,6 +1121,38 @@
 }
 
 static int
+syntaxerror(struct tok_state *tok, const char *format, ...)
+{
+    va_list vargs;
+#ifdef HAVE_STDARG_PROTOTYPES
+    va_start(vargs, format);
+#else
+    va_start(vargs);
+#endif
+    int ret = _syntaxerror_range(tok, format, -1, -1, vargs);
+    va_end(vargs);
+    return ret;
+}
+
+static int
+syntaxerror_known_range(struct tok_state *tok,
+                        int col_offset, int end_col_offset,
+                        const char *format, ...)
+{
+    va_list vargs;
+#ifdef HAVE_STDARG_PROTOTYPES
+    va_start(vargs, format);
+#else
+    va_start(vargs);
+#endif
+    int ret = _syntaxerror_range(tok, format, col_offset, end_col_offset, vargs);
+    va_end(vargs);
+    return ret;
+}
+
+
+
+static int
 indenterror(struct tok_state *tok)
 {
     tok->done = E_TABSPACE;
@@ -1090,6 +1160,116 @@
     return ERRORTOKEN;
 }
 
+static int
+parser_warn(struct tok_state *tok, const char *format, ...)
+{
+    PyObject *errmsg;
+    va_list vargs;
+#ifdef HAVE_STDARG_PROTOTYPES
+    va_start(vargs, format);
+#else
+    va_start(vargs);
+#endif
+    errmsg = PyUnicode_FromFormatV(format, vargs);
+    va_end(vargs);
+    if (!errmsg) {
+        goto error;
+    }
+
+    if (PyErr_WarnExplicitObject(PyExc_DeprecationWarning, errmsg, tok->filename,
+                                 tok->lineno, NULL, NULL) < 0) {
+        if (PyErr_ExceptionMatches(PyExc_DeprecationWarning)) {
+            /* Replace the DeprecationWarning exception with a SyntaxError
+               to get a more accurate error report */
+            PyErr_Clear();
+            syntaxerror(tok, "%U", errmsg);
+        }
+        goto error;
+    }
+    Py_DECREF(errmsg);
+    return 0;
+
+error:
+    Py_XDECREF(errmsg);
+    tok->done = E_ERROR;
+    return -1;
+}
+
+static int
+lookahead(struct tok_state *tok, const char *test)
+{
+    const char *s = test;
+    int res = 0;
+    while (1) {
+        int c = tok_nextc(tok);
+        if (*s == 0) {
+            res = !is_potential_identifier_char(c);
+        }
+        else if (c == *s) {
+            s++;
+            continue;
+        }
+
+        tok_backup(tok, c);
+        while (s != test) {
+            tok_backup(tok, *--s);
+        }
+        return res;
+    }
+}
+
+static int
+verify_end_of_number(struct tok_state *tok, int c, const char *kind)
+{
+    /* Emit a deprecation warning only if the numeric literal is immediately
+     * followed by one of keywords which can occurr after a numeric literal
+     * in valid code: "and", "else", "for", "if", "in", "is" and "or".
+     * It allows to gradually deprecate existing valid code without adding
+     * warning before error in most cases of invalid numeric literal (which
+     * would be confusiong and break existing tests).
+     * Raise a syntax error with slighly better message than plain
+     * "invalid syntax" if the numeric literal is immediately followed by
+     * other keyword or identifier.
+     */
+    int r = 0;
+    if (c == 'a') {
+        r = lookahead(tok, "nd");
+    }
+    else if (c == 'e') {
+        r = lookahead(tok, "lse");
+    }
+    else if (c == 'f') {
+        r = lookahead(tok, "or");
+    }
+    else if (c == 'i') {
+        int c2 = tok_nextc(tok);
+        if (c2 == 'f' || c2 == 'n' || c2 == 's') {
+            r = 1;
+        }
+        tok_backup(tok, c2);
+    }
+    else if (c == 'o') {
+        r = lookahead(tok, "r");
+    }
+    else if (c == 'n') {
+        r = lookahead(tok, "ot");
+    }
+    if (r) {
+        tok_backup(tok, c);
+        if (parser_warn(tok, "invalid %s literal", kind)) {
+            return 0;
+        }
+        tok_nextc(tok);
+    }
+    else /* In future releases, only error will remain. */
+    if (is_potential_identifier_char(c)) {
+        tok_backup(tok, c);
+        syntaxerror(tok, "invalid %s literal", kind);
+        return 0;
+    }
+    return 1;
+}
+
 /* Verify that the identifier follows PEP 3131.
    All identifier strings are guaranteed to be "ready" unicode objects.
  */
@@ -1170,6 +1350,24 @@
 
 /* Get next token, after space stripping etc. */
 
+static inline int
+tok_continuation_line(struct tok_state *tok) {
+    int c = tok_nextc(tok);
+    if (c != '\n') {
+        tok->done = E_LINECONT;
+        return -1;
+    }
+    c = tok_nextc(tok);
+    if (c == EOF) {
+        tok->done = E_EOF;
+        tok->cur = tok->inp;
+        return -1;
+    } else {
+        tok_backup(tok, c);
+    }
+    return c;
+}
+
 static int
 tok_get(struct tok_state *tok, const char **p_start, const char **p_end)
 {
@@ -1186,6 +1384,7 @@
         int col = 0;
         int altcol = 0;
         tok->atbol = 0;
+        int cont_line_col = 0;
         for (;;) {
             c = tok_nextc(tok);
             if (c == ' ') {
@@ -1198,14 +1397,23 @@
             else if (c == '\014')  {/* Control-L (formfeed) */
                 col = altcol = 0; /* For Emacs users */
             }
+            else if (c == '\\') {
+                // Indentation cannot be split over multiple physical lines
+                // using backslashes. This means that if we found a backslash
+                // preceded by whitespace, **the first one we find** determines
+                // the level of indentation of whatever comes next.
+                cont_line_col = cont_line_col ? cont_line_col : col;
+                if ((c = tok_continuation_line(tok)) == -1) {
+                    return ERRORTOKEN;
+                }
+            }
             else {
                 break;
             }
         }
         tok_backup(tok, c);
-        if (c == '#' || c == '\n' || c == '\\') {
+        if (c == '#' || c == '\n') {
             /* Lines with only whitespace and/or comments
-               and/or a line continuation character
                shouldn't affect the indentation and are
                not passed to the parser as NEWLINE tokens,
                except *totally* empty lines in interactive
@@ -1226,6 +1434,8 @@
                may need to skip to the end of a comment */
         }
         if (!blankline && tok->level == 0) {
+            col = cont_line_col ? cont_line_col : col;
+            altcol = cont_line_col ? cont_line_col : altcol;
             if (col == tok->indstack[tok->indent]) {
                 /* No change */
                 if (altcol != tok->altindstack[tok->indent]) {
@@ -1373,8 +1583,15 @@
         }
     }
 
+    if (tok->done == E_INTERACT_STOP) {
+        return ENDMARKER;
+    }
+
     /* Check for EOF and errors now */
     if (c == EOF) {
+        if (tok->level) {
+            return ERRORTOKEN;
+        }
         return tok->done == E_EOF ? ENDMARKER : ERRORTOKEN;
     }
 
@@ -1531,6 +1748,9 @@
                         c = tok_nextc(tok);
                     } while (isxdigit(c));
                 } while (c == '_');
+                if (!verify_end_of_number(tok, c, "hexadecimal")) {
+                    return ERRORTOKEN;
+                }
             }
             else if (c == 'o' || c == 'O') {
                 /* Octal */
@@ -1540,12 +1760,12 @@
                         c = tok_nextc(tok);
                     }
                     if (c < '0' || c >= '8') {
-                        tok_backup(tok, c);
                         if (isdigit(c)) {
                             return syntaxerror(tok,
                                     "invalid digit '%c' in octal literal", c);
                         }
                         else {
+                            tok_backup(tok, c);
                             return syntaxerror(tok, "invalid octal literal");
                         }
                     }
@@ -1557,6 +1777,9 @@
                     return syntaxerror(tok,
                             "invalid digit '%c' in octal literal", c);
                 }
+                if (!verify_end_of_number(tok, c, "octal")) {
+                    return ERRORTOKEN;
+                }
             }
             else if (c == 'b' || c == 'B') {
                 /* Binary */
@@ -1566,12 +1789,12 @@
                         c = tok_nextc(tok);
                     }
                     if (c != '0' && c != '1') {
-                        tok_backup(tok, c);
                         if (isdigit(c)) {
                             return syntaxerror(tok,
                                     "invalid digit '%c' in binary literal", c);
                         }
                         else {
+                            tok_backup(tok, c);
                             return syntaxerror(tok, "invalid binary literal");
                         }
                     }
@@ -1583,6 +1806,9 @@
                     return syntaxerror(tok,
                             "invalid digit '%c' in binary literal", c);
                 }
+                if (!verify_end_of_number(tok, c, "binary")) {
+                    return ERRORTOKEN;
+                }
             }
             else {
                 int nonzero = 0;
@@ -1601,6 +1827,7 @@
                     }
                     c = tok_nextc(tok);
                 }
+                char* zeros_end = tok->cur;
                 if (isdigit(c)) {
                     nonzero = 1;
                     c = tok_decimal_tail(tok);
@@ -1621,10 +1848,15 @@
                 else if (nonzero) {
                     /* Old-style octal: now disallowed. */
                     tok_backup(tok, c);
-                    return syntaxerror(tok,
-                                       "leading zeros in decimal integer "
-                                       "literals are not permitted; "
-                                       "use an 0o prefix for octal integers");
+                    return syntaxerror_known_range(
+                            tok, (int)(tok->start + 1 - tok->line_start),
+                            (int)(zeros_end - tok->line_start),
+                            "leading zeros in decimal integer "
+                            "literals are not permitted; "
+                            "use an 0o prefix for octal integers");
+                }
+                if (!verify_end_of_number(tok, c, "decimal")) {
+                    return ERRORTOKEN;
                 }
             }
         }
@@ -1661,6 +1893,9 @@
                         }
                     } else if (!isdigit(c)) {
                         tok_backup(tok, c);
+                        if (!verify_end_of_number(tok, e, "decimal")) {
+                            return ERRORTOKEN;
+                        }
                         tok_backup(tok, e);
                         *p_start = tok->start;
                         *p_end = tok->cur;
@@ -1675,6 +1910,12 @@
                     /* Imaginary part */
         imaginary:
                     c = tok_nextc(tok);
+                    if (!verify_end_of_number(tok, c, "imaginary")) {
+                        return ERRORTOKEN;
+                    }
+                }
+                else if (!verify_end_of_number(tok, c, "decimal")) {
+                    return ERRORTOKEN;
                 }
             }
         }
@@ -1716,20 +1957,32 @@
         /* Get rest of string */
         while (end_quote_size != quote_size) {
             c = tok_nextc(tok);
-            if (c == EOF) {
+            if (c == EOF || (quote_size == 1 && c == '\n')) {
+                assert(tok->multi_line_start != NULL);
+                // shift the tok_state's location into
+                // the start of string, and report the error
+                // from the initial quote character
+                tok->cur = (char *)tok->start;
+                tok->cur++;
+                tok->line_start = tok->multi_line_start;
+                int start = tok->lineno;
+                tok->lineno = tok->first_lineno;
                 if (quote_size == 3) {
-                    tok->done = E_EOFS;
+                    syntaxerror(tok, "unterminated triple-quoted string literal"
+                                     " (detected at line %d)", start);
+                    if (c != '\n') {
+                        tok->done = E_EOFS;
+                    }
+                    return ERRORTOKEN;
                 }
                 else {
-                    tok->done = E_EOLS;
+                    syntaxerror(tok, "unterminated string literal (detected at"
+                                     " line %d)", start);
+                    if (c != '\n') {
+                        tok->done = E_EOLS;
+                    }
+                    return ERRORTOKEN;
                 }
-                tok->cur = tok->inp;
-                return ERRORTOKEN;
-            }
-            if (quote_size == 1 && c == '\n') {
-                tok->done = E_EOLS;
-                tok->cur = tok->inp;
-                return ERRORTOKEN;
             }
             if (c == quote) {
                 end_quote_size += 1;
@@ -1749,20 +2002,9 @@
 
     /* Line continuation */
     if (c == '\\') {
-        c = tok_nextc(tok);
-        if (c != '\n') {
-            tok->done = E_LINECONT;
-            tok->cur = tok->inp;
+        if ((c = tok_continuation_line(tok)) == -1) {
             return ERRORTOKEN;
         }
-        c = tok_nextc(tok);
-        if (c == EOF) {
-            tok->done = E_EOF;
-            tok->cur = tok->inp;
-            return ERRORTOKEN;
-        } else {
-            tok_backup(tok, c);
-        }
         tok->cont_line = 1;
         goto again; /* Read next line */
     }
@@ -1797,6 +2039,7 @@
         }
         tok->parenstack[tok->level] = c;
         tok->parenlinenostack[tok->level] = tok->lineno;
+        tok->parencolstack[tok->level] = (int)(tok->start - tok->line_start);
         tok->level++;
         break;
     case ')':
@@ -1851,7 +2094,7 @@
    encoding in the first or second line of the file (in which case the encoding
    should be assumed to be UTF-8).
 
-   The char* returned is malloc'ed via PyMem_MALLOC() and thus must be freed
+   The char* returned is malloc'ed via PyMem_Malloc() and thus must be freed
    by the caller. */
 
 char *
@@ -1894,9 +2137,10 @@
     }
     fclose(fp);
     if (tok->encoding) {
-        encoding = (char *)PyMem_MALLOC(strlen(tok->encoding) + 1);
-        if (encoding)
+        encoding = (char *)PyMem_Malloc(strlen(tok->encoding) + 1);
+        if (encoding) {
             strcpy(encoding, tok->encoding);
+        }
     }
     PyTokenizer_Free(tok);
     return encoding;
@@ -1913,9 +2157,9 @@
 void
 tok_dump(int type, char *start, char *end)
 {
-    printf("%s", _PyParser_TokenNames[type]);
+    fprintf(stderr, "%s", _PyParser_TokenNames[type]);
     if (type == NAME || type == NUMBER || type == STRING || type == OP)
-        printf("(%.*s)", (int)(end - start), start);
+        fprintf(stderr, "(%.*s)", (int)(end - start), start);
 }
 
 #endif
diff --git a/Parser/tokenizer.h b/Parser/tokenizer.h
index 5660ea3..61f0a61 100644
--- a/Parser/tokenizer.h
+++ b/Parser/tokenizer.h
@@ -15,8 +15,16 @@
 
 enum decoding_state {
     STATE_INIT,
-    STATE_RAW,
-    STATE_NORMAL        /* have a codec associated with input */
+    STATE_SEEK_CODING,
+    STATE_NORMAL
+};
+
+enum interactive_underflow_t {
+    /* Normal mode of operation: return a new token when asked in interactie mode */
+    IUNDERFLOW_NORMAL,
+    /* Forcefully return ENDMARKER when asked for a new token in interactive mode. This
+     * can be used to prevent the tokenizer to prompt the user for new tokens */
+    IUNDERFLOW_STOP,
 };
 
 /* Tokenizer state */
@@ -26,6 +34,9 @@
     char *buf;          /* Input buffer, or NULL; malloc'ed if fp != NULL */
     char *cur;          /* Next character in buffer */
     char *inp;          /* End of data in buffer */
+    int fp_interactive; /* If the file descriptor is interactive */
+    char *interactive_src_start; /* The start of the source parsed so far in interactive mode */
+    char *interactive_src_end; /* The end of the source parsed so far in interactive mode */
     const char *end;    /* End of input buffer if buf != NULL */
     const char *start;  /* Start of current token if not NULL */
     int done;           /* E_OK normally, E_EOF at EOF, otherwise error code */
@@ -44,13 +55,13 @@
             /* Used to allow free continuations inside them */
     char parenstack[MAXLEVEL];
     int parenlinenostack[MAXLEVEL];
+    int parencolstack[MAXLEVEL];
     PyObject *filename;
     /* Stuff for checking on different tab sizes */
     int altindstack[MAXINDENT];         /* Stack of alternate indents */
     /* Stuff for PEP 0263 */
     enum decoding_state decoding_state;
     int decoding_erred;         /* whether erred in decoding  */
-    int read_coding_spec;       /* whether 'coding:...' has been read  */
     char *encoding;         /* Source encoding. */
     int cont_line;          /* whether we are in a continuation line. */
     const char* line_start;     /* pointer to start of current line */
@@ -60,7 +71,7 @@
     PyObject *decoding_readline; /* open(...).readline */
     PyObject *decoding_buffer;
     const char* enc;        /* Encoding for the current str. */
-    char* str;
+    char* str;          /* Source string being tokenized (if tokenizing from a string)*/
     char* input;       /* Tokenizer's newline translated copy of the string. */
 
     int type_comments;      /* Whether to look for type comments */
@@ -71,6 +82,8 @@
     int async_def_indent; /* Indentation level of the outermost 'async def'. */
     int async_def_nl;     /* =1 if the outermost 'async def' had at least one
                              NEWLINE token after it. */
+    /* How to proceed when asked for a new token in interactive mode */
+    enum interactive_underflow_t interactive_underflow;
 };
 
 extern struct tok_state *PyTokenizer_FromString(const char *, int);
diff --git a/Programs/_testembed.c b/Programs/_testembed.c
index 3bf0c37..b7d4675 100644
--- a/Programs/_testembed.c
+++ b/Programs/_testembed.c
@@ -22,6 +22,9 @@
 /* Use path starting with "./" avoids a search along the PATH */
 #define PROGRAM_NAME L"./_testembed"
 
+#define INIT_LOOPS 16
+
+
 static void _testembed_Py_Initialize(void)
 {
     Py_SetProgramName(PROGRAM_NAME);
@@ -54,9 +57,8 @@
 {
     PyThreadState *mainstate, *substate;
     PyGILState_STATE gilstate;
-    int i, j;
 
-    for (i=0; i<15; i++) {
+    for (int i=1; i <= INIT_LOOPS; i++) {
         printf("--- Pass %d ---\n", i);
         _testembed_Py_Initialize();
         mainstate = PyThreadState_Get();
@@ -67,7 +69,7 @@
         print_subinterp();
         PyThreadState_Swap(NULL);
 
-        for (j=0; j<3; j++) {
+        for (int j=0; j<3; j++) {
             substate = Py_NewInterpreter();
             print_subinterp();
             Py_EndInterpreter(substate);
@@ -83,6 +85,20 @@
     return 0;
 }
 
+#define EMBEDDED_EXT_NAME "embedded_ext"
+
+static PyModuleDef embedded_ext = {
+    PyModuleDef_HEAD_INIT,
+    .m_name = EMBEDDED_EXT_NAME,
+    .m_size = 0,
+};
+
+static PyObject*
+PyInit_embedded_ext(void)
+{
+    return PyModule_Create(&embedded_ext);
+}
+
 /*****************************************************
  * Test forcing a particular IO encoding
  *****************************************************/
@@ -485,9 +501,6 @@
 
     config.install_signal_handlers = 0;
 
-    putenv("PYTHONOLDPARSER=1");
-    config._use_peg_parser = 0;
-
     /* FIXME: test use_environment */
 
     putenv("PYTHONHASHSEED=42");
@@ -674,7 +687,6 @@
     putenv("PYTHONNOUSERSITE=1");
     putenv("PYTHONFAULTHANDLER=1");
     putenv("PYTHONIOENCODING=iso8859-1:replace");
-    putenv("PYTHONOLDPARSER=1");
     putenv("PYTHONPLATLIBDIR=env_platlibdir");
 }
 
@@ -1530,6 +1542,55 @@
 }
 
 
+static int tune_config(void)
+{
+    PyConfig config;
+    PyConfig_InitPythonConfig(&config);
+    if (_PyInterpreterState_GetConfigCopy(&config) < 0) {
+        PyConfig_Clear(&config);
+        PyErr_Print();
+        return -1;
+    }
+
+    config.bytes_warning = 2;
+
+    if (_PyInterpreterState_SetConfig(&config) < 0) {
+        PyConfig_Clear(&config);
+        return -1;
+    }
+    PyConfig_Clear(&config);
+    return 0;
+}
+
+
+static int test_init_set_config(void)
+{
+    // Initialize core
+    PyConfig config;
+    PyConfig_InitIsolatedConfig(&config);
+    config_set_string(&config, &config.program_name, PROGRAM_NAME);
+    config._init_main = 0;
+    config.bytes_warning = 0;
+    init_from_config_clear(&config);
+
+    // Tune the configuration using _PyInterpreterState_SetConfig()
+    if (tune_config() < 0) {
+        PyErr_Print();
+        return 1;
+    }
+
+    // Finish initialization: main part
+    PyStatus status = _Py_InitializeMain();
+    if (PyStatus_Exception(status)) {
+        Py_ExitStatusException(status);
+    }
+
+    dump_config();
+    Py_Finalize();
+    return 0;
+}
+
+
 static void configure_init_main(PyConfig *config)
 {
     wchar_t* argv[] = {
@@ -1601,15 +1662,26 @@
 }
 
 
+static int test_run_main_loop(void)
+{
+    // bpo-40413: Calling Py_InitializeFromConfig()+Py_RunMain() multiple
+    // times must not crash.
+    for (int i=0; i<5; i++) {
+        int exitcode = test_run_main();
+        if (exitcode != 0) {
+            return exitcode;
+        }
+    }
+    return 0;
+}
+
+
 static int test_get_argc_argv(void)
 {
     PyConfig config;
     PyConfig_InitPythonConfig(&config);
 
-    wchar_t *argv[] = {L"python3", L"-c",
-                       (L"import sys; "
-                        L"print(f'Py_RunMain(): sys.argv={sys.argv}')"),
-                       L"arg2"};
+    wchar_t *argv[] = {L"python3", L"-c", L"pass", L"arg2"};
     config_set_argv(&config, Py_ARRAY_LENGTH(argv), argv);
     config_set_string(&config, &config.program_name, L"./python3");
 
@@ -1641,6 +1713,88 @@
 }
 
 
+static int test_unicode_id_init(void)
+{
+    // bpo-42882: Test that _PyUnicode_FromId() works
+    // when Python is initialized multiples times.
+    _Py_IDENTIFIER(test_unicode_id_init);
+
+    // Initialize Python once without using the identifier
+    _testembed_Py_Initialize();
+    Py_Finalize();
+
+    // Now initialize Python multiple times and use the identifier.
+    // The first _PyUnicode_FromId() call initializes the identifier index.
+    for (int i=0; i<3; i++) {
+        _testembed_Py_Initialize();
+
+        PyObject *str1, *str2;
+
+        str1 = _PyUnicode_FromId(&PyId_test_unicode_id_init);
+        assert(str1 != NULL);
+        assert(Py_REFCNT(str1) == 1);
+
+        str2 = PyUnicode_FromString("test_unicode_id_init");
+        assert(str2 != NULL);
+
+        assert(PyUnicode_Compare(str1, str2) == 0);
+
+        // str1 is a borrowed reference
+        Py_DECREF(str2);
+
+        Py_Finalize();
+    }
+    return 0;
+}
+
+
+// List frozen modules.
+// Command used by Tools/scripts/generate_stdlib_module_names.py script.
+static int list_frozen(void)
+{
+    const struct _frozen *p;
+    for (p = PyImport_FrozenModules; ; p++) {
+        if (p->name == NULL)
+            break;
+        printf("%s\n", p->name);
+    }
+    return 0;
+}
+
+
+static int test_repeated_init_and_inittab(void)
+{
+    // bpo-44441: Py_RunMain() must reset PyImport_Inittab at exit.
+    // It must be possible to call PyImport_AppendInittab() or
+    // PyImport_ExtendInittab() before each Python initialization.
+    for (int i=1; i <= INIT_LOOPS; i++) {
+        printf("--- Pass %d ---\n", i);
+
+        // Call PyImport_AppendInittab() at each iteration
+        if (PyImport_AppendInittab(EMBEDDED_EXT_NAME,
+                                   &PyInit_embedded_ext) != 0) {
+            fprintf(stderr, "PyImport_AppendInittab() failed\n");
+            return 1;
+        }
+
+        // Initialize Python
+        wchar_t* argv[] = {PROGRAM_NAME, L"-c", L"pass"};
+        PyConfig config;
+        PyConfig_InitPythonConfig(&config);
+        config.isolated = 1;
+        config_set_argv(&config, Py_ARRAY_LENGTH(argv), argv);
+        init_from_config_clear(&config);
+
+        // Py_RunMain() calls _PyImport_Fini2() which resets PyImport_Inittab
+        int exitcode = Py_RunMain();
+        if (exitcode != 0) {
+            return exitcode;
+        }
+    }
+    return 0;
+}
+
+
 /* *********************************************************
  * List of test cases and the function that implements it.
  *
@@ -1660,8 +1814,10 @@
 };
 
 static struct TestCase TestCases[] = {
+    // Python initialization
     {"test_forced_io_encoding", test_forced_io_encoding},
     {"test_repeated_init_and_subinterpreters", test_repeated_init_and_subinterpreters},
+    {"test_repeated_init_and_inittab", test_repeated_init_and_inittab},
     {"test_pre_initialization_api", test_pre_initialization_api},
     {"test_pre_initialization_sys_options", test_pre_initialization_sys_options},
     {"test_bpo20891", test_bpo20891},
@@ -1697,9 +1853,12 @@
     {"test_init_setpath_config", test_init_setpath_config},
     {"test_init_setpythonhome", test_init_setpythonhome},
     {"test_init_warnoptions", test_init_warnoptions},
+    {"test_init_set_config", test_init_set_config},
     {"test_run_main", test_run_main},
+    {"test_run_main_loop", test_run_main_loop},
     {"test_get_argc_argv", test_get_argc_argv},
 
+    // Audit
     {"test_open_code_hook", test_open_code_hook},
     {"test_audit", test_audit},
     {"test_audit_subinterpreter", test_audit_subinterpreter},
@@ -1708,6 +1867,12 @@
     {"test_audit_run_interactivehook", test_audit_run_interactivehook},
     {"test_audit_run_startup", test_audit_run_startup},
     {"test_audit_run_stdin", test_audit_run_stdin},
+
+    // Specific C API
+    {"test_unicode_id_init", test_unicode_id_init},
+
+    // Command
+    {"list_frozen", list_frozen},
     {NULL, NULL}
 };
 
diff --git a/Python/Python-ast.c b/Python/Python-ast.c
index 5367cb3..2f84cad 100644
--- a/Python/Python-ast.c
+++ b/Python/Python-ast.c
@@ -1,258 +1,31 @@
-/* File automatically generated by Parser/asdl_c.py. */
-
-#include <stddef.h>
+// File automatically generated by Parser/asdl_c.py.
 
 #include "Python.h"
-#include "Python-ast.h"
-#include "structmember.h"         // PyMemberDef
-
-typedef struct {
-    int initialized;
-    PyObject *AST_type;
-    PyObject *Add_singleton;
-    PyObject *Add_type;
-    PyObject *And_singleton;
-    PyObject *And_type;
-    PyObject *AnnAssign_type;
-    PyObject *Assert_type;
-    PyObject *Assign_type;
-    PyObject *AsyncFor_type;
-    PyObject *AsyncFunctionDef_type;
-    PyObject *AsyncWith_type;
-    PyObject *Attribute_type;
-    PyObject *AugAssign_type;
-    PyObject *Await_type;
-    PyObject *BinOp_type;
-    PyObject *BitAnd_singleton;
-    PyObject *BitAnd_type;
-    PyObject *BitOr_singleton;
-    PyObject *BitOr_type;
-    PyObject *BitXor_singleton;
-    PyObject *BitXor_type;
-    PyObject *BoolOp_type;
-    PyObject *Break_type;
-    PyObject *Call_type;
-    PyObject *ClassDef_type;
-    PyObject *Compare_type;
-    PyObject *Constant_type;
-    PyObject *Continue_type;
-    PyObject *Del_singleton;
-    PyObject *Del_type;
-    PyObject *Delete_type;
-    PyObject *DictComp_type;
-    PyObject *Dict_type;
-    PyObject *Div_singleton;
-    PyObject *Div_type;
-    PyObject *Eq_singleton;
-    PyObject *Eq_type;
-    PyObject *ExceptHandler_type;
-    PyObject *Expr_type;
-    PyObject *Expression_type;
-    PyObject *FloorDiv_singleton;
-    PyObject *FloorDiv_type;
-    PyObject *For_type;
-    PyObject *FormattedValue_type;
-    PyObject *FunctionDef_type;
-    PyObject *FunctionType_type;
-    PyObject *GeneratorExp_type;
-    PyObject *Global_type;
-    PyObject *GtE_singleton;
-    PyObject *GtE_type;
-    PyObject *Gt_singleton;
-    PyObject *Gt_type;
-    PyObject *IfExp_type;
-    PyObject *If_type;
-    PyObject *ImportFrom_type;
-    PyObject *Import_type;
-    PyObject *In_singleton;
-    PyObject *In_type;
-    PyObject *Interactive_type;
-    PyObject *Invert_singleton;
-    PyObject *Invert_type;
-    PyObject *IsNot_singleton;
-    PyObject *IsNot_type;
-    PyObject *Is_singleton;
-    PyObject *Is_type;
-    PyObject *JoinedStr_type;
-    PyObject *LShift_singleton;
-    PyObject *LShift_type;
-    PyObject *Lambda_type;
-    PyObject *ListComp_type;
-    PyObject *List_type;
-    PyObject *Load_singleton;
-    PyObject *Load_type;
-    PyObject *LtE_singleton;
-    PyObject *LtE_type;
-    PyObject *Lt_singleton;
-    PyObject *Lt_type;
-    PyObject *MatMult_singleton;
-    PyObject *MatMult_type;
-    PyObject *Mod_singleton;
-    PyObject *Mod_type;
-    PyObject *Module_type;
-    PyObject *Mult_singleton;
-    PyObject *Mult_type;
-    PyObject *Name_type;
-    PyObject *NamedExpr_type;
-    PyObject *Nonlocal_type;
-    PyObject *NotEq_singleton;
-    PyObject *NotEq_type;
-    PyObject *NotIn_singleton;
-    PyObject *NotIn_type;
-    PyObject *Not_singleton;
-    PyObject *Not_type;
-    PyObject *Or_singleton;
-    PyObject *Or_type;
-    PyObject *Pass_type;
-    PyObject *Pow_singleton;
-    PyObject *Pow_type;
-    PyObject *RShift_singleton;
-    PyObject *RShift_type;
-    PyObject *Raise_type;
-    PyObject *Return_type;
-    PyObject *SetComp_type;
-    PyObject *Set_type;
-    PyObject *Slice_type;
-    PyObject *Starred_type;
-    PyObject *Store_singleton;
-    PyObject *Store_type;
-    PyObject *Sub_singleton;
-    PyObject *Sub_type;
-    PyObject *Subscript_type;
-    PyObject *Try_type;
-    PyObject *Tuple_type;
-    PyObject *TypeIgnore_type;
-    PyObject *UAdd_singleton;
-    PyObject *UAdd_type;
-    PyObject *USub_singleton;
-    PyObject *USub_type;
-    PyObject *UnaryOp_type;
-    PyObject *While_type;
-    PyObject *With_type;
-    PyObject *YieldFrom_type;
-    PyObject *Yield_type;
-    PyObject *__dict__;
-    PyObject *__doc__;
-    PyObject *__module__;
-    PyObject *_attributes;
-    PyObject *_fields;
-    PyObject *alias_type;
-    PyObject *annotation;
-    PyObject *arg;
-    PyObject *arg_type;
-    PyObject *args;
-    PyObject *argtypes;
-    PyObject *arguments_type;
-    PyObject *asname;
-    PyObject *ast;
-    PyObject *attr;
-    PyObject *bases;
-    PyObject *body;
-    PyObject *boolop_type;
-    PyObject *cause;
-    PyObject *cmpop_type;
-    PyObject *col_offset;
-    PyObject *comparators;
-    PyObject *comprehension_type;
-    PyObject *context_expr;
-    PyObject *conversion;
-    PyObject *ctx;
-    PyObject *decorator_list;
-    PyObject *defaults;
-    PyObject *elt;
-    PyObject *elts;
-    PyObject *end_col_offset;
-    PyObject *end_lineno;
-    PyObject *exc;
-    PyObject *excepthandler_type;
-    PyObject *expr_context_type;
-    PyObject *expr_type;
-    PyObject *finalbody;
-    PyObject *format_spec;
-    PyObject *func;
-    PyObject *generators;
-    PyObject *handlers;
-    PyObject *id;
-    PyObject *ifs;
-    PyObject *is_async;
-    PyObject *items;
-    PyObject *iter;
-    PyObject *key;
-    PyObject *keys;
-    PyObject *keyword_type;
-    PyObject *keywords;
-    PyObject *kind;
-    PyObject *kw_defaults;
-    PyObject *kwarg;
-    PyObject *kwonlyargs;
-    PyObject *left;
-    PyObject *level;
-    PyObject *lineno;
-    PyObject *lower;
-    PyObject *mod_type;
-    PyObject *module;
-    PyObject *msg;
-    PyObject *name;
-    PyObject *names;
-    PyObject *op;
-    PyObject *operand;
-    PyObject *operator_type;
-    PyObject *ops;
-    PyObject *optional_vars;
-    PyObject *orelse;
-    PyObject *posonlyargs;
-    PyObject *returns;
-    PyObject *right;
-    PyObject *simple;
-    PyObject *slice;
-    PyObject *step;
-    PyObject *stmt_type;
-    PyObject *tag;
-    PyObject *target;
-    PyObject *targets;
-    PyObject *test;
-    PyObject *type;
-    PyObject *type_comment;
-    PyObject *type_ignore_type;
-    PyObject *type_ignores;
-    PyObject *unaryop_type;
-    PyObject *upper;
-    PyObject *value;
-    PyObject *values;
-    PyObject *vararg;
-    PyObject *withitem_type;
-} astmodulestate;
-
+#include "pycore_ast.h"
+#include "pycore_ast_state.h"       // struct ast_state
+#include "pycore_interp.h"          // _PyInterpreterState.ast
+#include "pycore_pystate.h"         // _PyInterpreterState_GET()
+#include "structmember.h"
+#include <stddef.h>
 
 // Forward declaration
-static int init_types(astmodulestate *state);
+static int init_types(struct ast_state *state);
 
-// bpo-41194, bpo-41261, bpo-41631: The _ast module uses a global state.
-static astmodulestate global_ast_state = {0};
-
-static astmodulestate*
-get_global_ast_state(void)
+static struct ast_state*
+get_ast_state(void)
 {
-    astmodulestate* state = &global_ast_state;
+    PyInterpreterState *interp = _PyInterpreterState_GET();
+    struct ast_state *state = &interp->ast;
     if (!init_types(state)) {
         return NULL;
     }
     return state;
 }
 
-static astmodulestate*
-get_ast_state(PyObject* Py_UNUSED(module))
+void _PyAST_Fini(PyInterpreterState *interp)
 {
-    astmodulestate* state = get_global_ast_state();
-    // get_ast_state() must only be called after _ast module is imported,
-    // and astmodule_exec() calls init_types()
-    assert(state != NULL);
-    return state;
-}
+    struct ast_state *state = &interp->ast;
 
-void _PyAST_Fini(void)
-{
-    astmodulestate* state = &global_ast_state;
     Py_CLEAR(state->AST_type);
     Py_CLEAR(state->Add_singleton);
     Py_CLEAR(state->Add_type);
@@ -332,6 +105,15 @@
     Py_CLEAR(state->Lt_type);
     Py_CLEAR(state->MatMult_singleton);
     Py_CLEAR(state->MatMult_type);
+    Py_CLEAR(state->MatchAs_type);
+    Py_CLEAR(state->MatchClass_type);
+    Py_CLEAR(state->MatchMapping_type);
+    Py_CLEAR(state->MatchOr_type);
+    Py_CLEAR(state->MatchSequence_type);
+    Py_CLEAR(state->MatchSingleton_type);
+    Py_CLEAR(state->MatchStar_type);
+    Py_CLEAR(state->MatchValue_type);
+    Py_CLEAR(state->Match_type);
     Py_CLEAR(state->Mod_singleton);
     Py_CLEAR(state->Mod_type);
     Py_CLEAR(state->Module_type);
@@ -378,6 +160,7 @@
     Py_CLEAR(state->Yield_type);
     Py_CLEAR(state->__dict__);
     Py_CLEAR(state->__doc__);
+    Py_CLEAR(state->__match_args__);
     Py_CLEAR(state->__module__);
     Py_CLEAR(state->_attributes);
     Py_CLEAR(state->_fields);
@@ -394,7 +177,9 @@
     Py_CLEAR(state->bases);
     Py_CLEAR(state->body);
     Py_CLEAR(state->boolop_type);
+    Py_CLEAR(state->cases);
     Py_CLEAR(state->cause);
+    Py_CLEAR(state->cls);
     Py_CLEAR(state->cmpop_type);
     Py_CLEAR(state->col_offset);
     Py_CLEAR(state->comparators);
@@ -416,6 +201,7 @@
     Py_CLEAR(state->format_spec);
     Py_CLEAR(state->func);
     Py_CLEAR(state->generators);
+    Py_CLEAR(state->guard);
     Py_CLEAR(state->handlers);
     Py_CLEAR(state->id);
     Py_CLEAR(state->ifs);
@@ -429,11 +215,14 @@
     Py_CLEAR(state->kind);
     Py_CLEAR(state->kw_defaults);
     Py_CLEAR(state->kwarg);
+    Py_CLEAR(state->kwd_attrs);
+    Py_CLEAR(state->kwd_patterns);
     Py_CLEAR(state->kwonlyargs);
     Py_CLEAR(state->left);
     Py_CLEAR(state->level);
     Py_CLEAR(state->lineno);
     Py_CLEAR(state->lower);
+    Py_CLEAR(state->match_case_type);
     Py_CLEAR(state->mod_type);
     Py_CLEAR(state->module);
     Py_CLEAR(state->msg);
@@ -445,13 +234,18 @@
     Py_CLEAR(state->ops);
     Py_CLEAR(state->optional_vars);
     Py_CLEAR(state->orelse);
+    Py_CLEAR(state->pattern);
+    Py_CLEAR(state->pattern_type);
+    Py_CLEAR(state->patterns);
     Py_CLEAR(state->posonlyargs);
+    Py_CLEAR(state->rest);
     Py_CLEAR(state->returns);
     Py_CLEAR(state->right);
     Py_CLEAR(state->simple);
     Py_CLEAR(state->slice);
     Py_CLEAR(state->step);
     Py_CLEAR(state->stmt_type);
+    Py_CLEAR(state->subject);
     Py_CLEAR(state->tag);
     Py_CLEAR(state->target);
     Py_CLEAR(state->targets);
@@ -467,13 +261,18 @@
     Py_CLEAR(state->vararg);
     Py_CLEAR(state->withitem_type);
 
+#if !defined(NDEBUG)
+    state->initialized = -1;
+#else
     state->initialized = 0;
+#endif
 }
 
-static int init_identifiers(astmodulestate *state)
+static int init_identifiers(struct ast_state *state)
 {
     if ((state->__dict__ = PyUnicode_InternFromString("__dict__")) == NULL) return 0;
     if ((state->__doc__ = PyUnicode_InternFromString("__doc__")) == NULL) return 0;
+    if ((state->__match_args__ = PyUnicode_InternFromString("__match_args__")) == NULL) return 0;
     if ((state->__module__ = PyUnicode_InternFromString("__module__")) == NULL) return 0;
     if ((state->_attributes = PyUnicode_InternFromString("_attributes")) == NULL) return 0;
     if ((state->_fields = PyUnicode_InternFromString("_fields")) == NULL) return 0;
@@ -486,7 +285,9 @@
     if ((state->attr = PyUnicode_InternFromString("attr")) == NULL) return 0;
     if ((state->bases = PyUnicode_InternFromString("bases")) == NULL) return 0;
     if ((state->body = PyUnicode_InternFromString("body")) == NULL) return 0;
+    if ((state->cases = PyUnicode_InternFromString("cases")) == NULL) return 0;
     if ((state->cause = PyUnicode_InternFromString("cause")) == NULL) return 0;
+    if ((state->cls = PyUnicode_InternFromString("cls")) == NULL) return 0;
     if ((state->col_offset = PyUnicode_InternFromString("col_offset")) == NULL) return 0;
     if ((state->comparators = PyUnicode_InternFromString("comparators")) == NULL) return 0;
     if ((state->context_expr = PyUnicode_InternFromString("context_expr")) == NULL) return 0;
@@ -503,6 +304,7 @@
     if ((state->format_spec = PyUnicode_InternFromString("format_spec")) == NULL) return 0;
     if ((state->func = PyUnicode_InternFromString("func")) == NULL) return 0;
     if ((state->generators = PyUnicode_InternFromString("generators")) == NULL) return 0;
+    if ((state->guard = PyUnicode_InternFromString("guard")) == NULL) return 0;
     if ((state->handlers = PyUnicode_InternFromString("handlers")) == NULL) return 0;
     if ((state->id = PyUnicode_InternFromString("id")) == NULL) return 0;
     if ((state->ifs = PyUnicode_InternFromString("ifs")) == NULL) return 0;
@@ -515,6 +317,8 @@
     if ((state->kind = PyUnicode_InternFromString("kind")) == NULL) return 0;
     if ((state->kw_defaults = PyUnicode_InternFromString("kw_defaults")) == NULL) return 0;
     if ((state->kwarg = PyUnicode_InternFromString("kwarg")) == NULL) return 0;
+    if ((state->kwd_attrs = PyUnicode_InternFromString("kwd_attrs")) == NULL) return 0;
+    if ((state->kwd_patterns = PyUnicode_InternFromString("kwd_patterns")) == NULL) return 0;
     if ((state->kwonlyargs = PyUnicode_InternFromString("kwonlyargs")) == NULL) return 0;
     if ((state->left = PyUnicode_InternFromString("left")) == NULL) return 0;
     if ((state->level = PyUnicode_InternFromString("level")) == NULL) return 0;
@@ -529,12 +333,16 @@
     if ((state->ops = PyUnicode_InternFromString("ops")) == NULL) return 0;
     if ((state->optional_vars = PyUnicode_InternFromString("optional_vars")) == NULL) return 0;
     if ((state->orelse = PyUnicode_InternFromString("orelse")) == NULL) return 0;
+    if ((state->pattern = PyUnicode_InternFromString("pattern")) == NULL) return 0;
+    if ((state->patterns = PyUnicode_InternFromString("patterns")) == NULL) return 0;
     if ((state->posonlyargs = PyUnicode_InternFromString("posonlyargs")) == NULL) return 0;
+    if ((state->rest = PyUnicode_InternFromString("rest")) == NULL) return 0;
     if ((state->returns = PyUnicode_InternFromString("returns")) == NULL) return 0;
     if ((state->right = PyUnicode_InternFromString("right")) == NULL) return 0;
     if ((state->simple = PyUnicode_InternFromString("simple")) == NULL) return 0;
     if ((state->slice = PyUnicode_InternFromString("slice")) == NULL) return 0;
     if ((state->step = PyUnicode_InternFromString("step")) == NULL) return 0;
+    if ((state->subject = PyUnicode_InternFromString("subject")) == NULL) return 0;
     if ((state->tag = PyUnicode_InternFromString("tag")) == NULL) return 0;
     if ((state->target = PyUnicode_InternFromString("target")) == NULL) return 0;
     if ((state->targets = PyUnicode_InternFromString("targets")) == NULL) return 0;
@@ -549,7 +357,21 @@
     return 1;
 };
 
-static PyObject* ast2obj_mod(astmodulestate *state, void*);
+GENERATE_ASDL_SEQ_CONSTRUCTOR(mod, mod_ty)
+GENERATE_ASDL_SEQ_CONSTRUCTOR(stmt, stmt_ty)
+GENERATE_ASDL_SEQ_CONSTRUCTOR(expr, expr_ty)
+GENERATE_ASDL_SEQ_CONSTRUCTOR(comprehension, comprehension_ty)
+GENERATE_ASDL_SEQ_CONSTRUCTOR(excepthandler, excepthandler_ty)
+GENERATE_ASDL_SEQ_CONSTRUCTOR(arguments, arguments_ty)
+GENERATE_ASDL_SEQ_CONSTRUCTOR(arg, arg_ty)
+GENERATE_ASDL_SEQ_CONSTRUCTOR(keyword, keyword_ty)
+GENERATE_ASDL_SEQ_CONSTRUCTOR(alias, alias_ty)
+GENERATE_ASDL_SEQ_CONSTRUCTOR(withitem, withitem_ty)
+GENERATE_ASDL_SEQ_CONSTRUCTOR(match_case, match_case_ty)
+GENERATE_ASDL_SEQ_CONSTRUCTOR(pattern, pattern_ty)
+GENERATE_ASDL_SEQ_CONSTRUCTOR(type_ignore, type_ignore_ty)
+
+static PyObject* ast2obj_mod(struct ast_state *state, void*);
 static const char * const Module_fields[]={
     "body",
     "type_ignores",
@@ -570,7 +392,7 @@
     "end_lineno",
     "end_col_offset",
 };
-static PyObject* ast2obj_stmt(astmodulestate *state, void*);
+static PyObject* ast2obj_stmt(struct ast_state *state, void*);
 static const char * const FunctionDef_fields[]={
     "name",
     "args",
@@ -650,6 +472,10 @@
     "body",
     "type_comment",
 };
+static const char * const Match_fields[]={
+    "subject",
+    "cases",
+};
 static const char * const Raise_fields[]={
     "exc",
     "cause",
@@ -687,7 +513,7 @@
     "end_lineno",
     "end_col_offset",
 };
-static PyObject* ast2obj_expr(astmodulestate *state, void*);
+static PyObject* ast2obj_expr(struct ast_state *state, void*);
 static const char * const BoolOp_fields[]={
     "op",
     "values",
@@ -800,12 +626,12 @@
     "upper",
     "step",
 };
-static PyObject* ast2obj_expr_context(astmodulestate *state, expr_context_ty);
-static PyObject* ast2obj_boolop(astmodulestate *state, boolop_ty);
-static PyObject* ast2obj_operator(astmodulestate *state, operator_ty);
-static PyObject* ast2obj_unaryop(astmodulestate *state, unaryop_ty);
-static PyObject* ast2obj_cmpop(astmodulestate *state, cmpop_ty);
-static PyObject* ast2obj_comprehension(astmodulestate *state, void*);
+static PyObject* ast2obj_expr_context(struct ast_state *state, expr_context_ty);
+static PyObject* ast2obj_boolop(struct ast_state *state, boolop_ty);
+static PyObject* ast2obj_operator(struct ast_state *state, operator_ty);
+static PyObject* ast2obj_unaryop(struct ast_state *state, unaryop_ty);
+static PyObject* ast2obj_cmpop(struct ast_state *state, cmpop_ty);
+static PyObject* ast2obj_comprehension(struct ast_state *state, void*);
 static const char * const comprehension_fields[]={
     "target",
     "iter",
@@ -818,13 +644,13 @@
     "end_lineno",
     "end_col_offset",
 };
-static PyObject* ast2obj_excepthandler(astmodulestate *state, void*);
+static PyObject* ast2obj_excepthandler(struct ast_state *state, void*);
 static const char * const ExceptHandler_fields[]={
     "type",
     "name",
     "body",
 };
-static PyObject* ast2obj_arguments(astmodulestate *state, void*);
+static PyObject* ast2obj_arguments(struct ast_state *state, void*);
 static const char * const arguments_fields[]={
     "posonlyargs",
     "args",
@@ -834,7 +660,7 @@
     "kwarg",
     "defaults",
 };
-static PyObject* ast2obj_arg(astmodulestate *state, void*);
+static PyObject* ast2obj_arg(struct ast_state *state, void*);
 static const char * const arg_attributes[] = {
     "lineno",
     "col_offset",
@@ -846,7 +672,7 @@
     "annotation",
     "type_comment",
 };
-static PyObject* ast2obj_keyword(astmodulestate *state, void*);
+static PyObject* ast2obj_keyword(struct ast_state *state, void*);
 static const char * const keyword_attributes[] = {
     "lineno",
     "col_offset",
@@ -857,17 +683,66 @@
     "arg",
     "value",
 };
-static PyObject* ast2obj_alias(astmodulestate *state, void*);
+static PyObject* ast2obj_alias(struct ast_state *state, void*);
+static const char * const alias_attributes[] = {
+    "lineno",
+    "col_offset",
+    "end_lineno",
+    "end_col_offset",
+};
 static const char * const alias_fields[]={
     "name",
     "asname",
 };
-static PyObject* ast2obj_withitem(astmodulestate *state, void*);
+static PyObject* ast2obj_withitem(struct ast_state *state, void*);
 static const char * const withitem_fields[]={
     "context_expr",
     "optional_vars",
 };
-static PyObject* ast2obj_type_ignore(astmodulestate *state, void*);
+static PyObject* ast2obj_match_case(struct ast_state *state, void*);
+static const char * const match_case_fields[]={
+    "pattern",
+    "guard",
+    "body",
+};
+static const char * const pattern_attributes[] = {
+    "lineno",
+    "col_offset",
+    "end_lineno",
+    "end_col_offset",
+};
+static PyObject* ast2obj_pattern(struct ast_state *state, void*);
+static const char * const MatchValue_fields[]={
+    "value",
+};
+static const char * const MatchSingleton_fields[]={
+    "value",
+};
+static const char * const MatchSequence_fields[]={
+    "patterns",
+};
+static const char * const MatchMapping_fields[]={
+    "keys",
+    "patterns",
+    "rest",
+};
+static const char * const MatchClass_fields[]={
+    "cls",
+    "patterns",
+    "kwd_attrs",
+    "kwd_patterns",
+};
+static const char * const MatchStar_fields[]={
+    "name",
+};
+static const char * const MatchAs_fields[]={
+    "pattern",
+    "name",
+};
+static const char * const MatchOr_fields[]={
+    "patterns",
+};
+static PyObject* ast2obj_type_ignore(struct ast_state *state, void*);
 static const char * const TypeIgnore_fields[]={
     "lineno",
     "tag",
@@ -911,7 +786,7 @@
 static int
 ast_type_init(PyObject *self, PyObject *args, PyObject *kw)
 {
-    astmodulestate *state = get_global_ast_state();
+    struct ast_state *state = get_ast_state();
     if (state == NULL) {
         return -1;
     }
@@ -987,7 +862,7 @@
 static PyObject *
 ast_type_reduce(PyObject *self, PyObject *unused)
 {
-    astmodulestate *state = get_global_ast_state();
+    struct ast_state *state = get_ast_state();
     if (state == NULL) {
         return NULL;
     }
@@ -1042,7 +917,7 @@
 };
 
 static PyObject *
-make_type(astmodulestate *state, const char *type, PyObject* base,
+make_type(struct ast_state *state, const char *type, PyObject* base,
           const char* const* fields, int num_fields, const char *doc)
 {
     PyObject *fnames, *result;
@@ -1057,9 +932,10 @@
         }
         PyTuple_SET_ITEM(fnames, i, field);
     }
-    result = PyObject_CallFunction((PyObject*)&PyType_Type, "s(O){OOOOOs}",
+    result = PyObject_CallFunction((PyObject*)&PyType_Type, "s(O){OOOOOOOs}",
                     type, base,
                     state->_fields, fnames,
+                    state->__match_args__, fnames,
                     state->__module__,
                     state->ast,
                     state->__doc__, doc);
@@ -1068,7 +944,7 @@
 }
 
 static int
-add_attributes(astmodulestate *state, PyObject *type, const char * const *attrs, int num_fields)
+add_attributes(struct ast_state *state, PyObject *type, const char * const *attrs, int num_fields)
 {
     int i, result;
     PyObject *s, *l = PyTuple_New(num_fields);
@@ -1089,7 +965,7 @@
 
 /* Conversion AST -> Python */
 
-static PyObject* ast2obj_list(astmodulestate *state, asdl_seq *seq, PyObject* (*func)(astmodulestate *state, void*))
+static PyObject* ast2obj_list(struct ast_state *state, asdl_seq *seq, PyObject* (*func)(struct ast_state *state, void*))
 {
     Py_ssize_t i, n = asdl_seq_LEN(seq);
     PyObject *result = PyList_New(n);
@@ -1097,7 +973,7 @@
     if (!result)
         return NULL;
     for (i = 0; i < n; i++) {
-        value = func(state, asdl_seq_GET(seq, i));
+        value = func(state, asdl_seq_GET_UNTYPED(seq, i));
         if (!value) {
             Py_DECREF(result);
             return NULL;
@@ -1107,7 +983,7 @@
     return result;
 }
 
-static PyObject* ast2obj_object(astmodulestate *Py_UNUSED(state), void *o)
+static PyObject* ast2obj_object(struct ast_state *Py_UNUSED(state), void *o)
 {
     if (!o)
         o = Py_None;
@@ -1118,19 +994,19 @@
 #define ast2obj_identifier ast2obj_object
 #define ast2obj_string ast2obj_object
 
-static PyObject* ast2obj_int(astmodulestate *Py_UNUSED(state), long b)
+static PyObject* ast2obj_int(struct ast_state *Py_UNUSED(state), long b)
 {
     return PyLong_FromLong(b);
 }
 
 /* Conversion Python -> AST */
 
-static int obj2ast_object(astmodulestate *Py_UNUSED(state), PyObject* obj, PyObject** out, PyArena* arena)
+static int obj2ast_object(struct ast_state *Py_UNUSED(state), PyObject* obj, PyObject** out, PyArena* arena)
 {
     if (obj == Py_None)
         obj = NULL;
     if (obj) {
-        if (PyArena_AddPyObject(arena, obj) < 0) {
+        if (_PyArena_AddPyObject(arena, obj) < 0) {
             *out = NULL;
             return -1;
         }
@@ -1140,9 +1016,9 @@
     return 0;
 }
 
-static int obj2ast_constant(astmodulestate *Py_UNUSED(state), PyObject* obj, PyObject** out, PyArena* arena)
+static int obj2ast_constant(struct ast_state *Py_UNUSED(state), PyObject* obj, PyObject** out, PyArena* arena)
 {
-    if (PyArena_AddPyObject(arena, obj) < 0) {
+    if (_PyArena_AddPyObject(arena, obj) < 0) {
         *out = NULL;
         return -1;
     }
@@ -1151,7 +1027,7 @@
     return 0;
 }
 
-static int obj2ast_identifier(astmodulestate *state, PyObject* obj, PyObject** out, PyArena* arena)
+static int obj2ast_identifier(struct ast_state *state, PyObject* obj, PyObject** out, PyArena* arena)
 {
     if (!PyUnicode_CheckExact(obj) && obj != Py_None) {
         PyErr_SetString(PyExc_TypeError, "AST identifier must be of type str");
@@ -1160,7 +1036,7 @@
     return obj2ast_object(state, obj, out, arena);
 }
 
-static int obj2ast_string(astmodulestate *state, PyObject* obj, PyObject** out, PyArena* arena)
+static int obj2ast_string(struct ast_state *state, PyObject* obj, PyObject** out, PyArena* arena)
 {
     if (!PyUnicode_CheckExact(obj) && !PyBytes_CheckExact(obj)) {
         PyErr_SetString(PyExc_TypeError, "AST string must be of type str");
@@ -1169,7 +1045,7 @@
     return obj2ast_object(state, obj, out, arena);
 }
 
-static int obj2ast_int(astmodulestate* Py_UNUSED(state), PyObject* obj, int* out, PyArena* arena)
+static int obj2ast_int(struct ast_state* Py_UNUSED(state), PyObject* obj, int* out, PyArena* arena)
 {
     int i;
     if (!PyLong_Check(obj)) {
@@ -1184,12 +1060,13 @@
     return 0;
 }
 
-static int add_ast_fields(astmodulestate *state)
+static int add_ast_fields(struct ast_state *state)
 {
     PyObject *empty_tuple;
     empty_tuple = PyTuple_New(0);
     if (!empty_tuple ||
         PyObject_SetAttrString(state->AST_type, "_fields", empty_tuple) < 0 ||
+        PyObject_SetAttrString(state->AST_type, "__match_args__", empty_tuple) < 0 ||
         PyObject_SetAttrString(state->AST_type, "_attributes", empty_tuple) < 0) {
         Py_XDECREF(empty_tuple);
         return -1;
@@ -1199,13 +1076,27 @@
 }
 
 
-static int init_types(astmodulestate *state)
+
+static int
+init_types(struct ast_state *state)
 {
-    if (state->initialized) return 1;
-    if (init_identifiers(state) < 0) return 0;
+    // init_types() must not be called after _PyAST_Fini()
+    // has been called
+    assert(state->initialized >= 0);
+
+    if (state->initialized) {
+        return 1;
+    }
+    if (init_identifiers(state) < 0) {
+        return 0;
+    }
     state->AST_type = PyType_FromSpec(&AST_type_spec);
-    if (!state->AST_type) return 0;
-    if (add_ast_fields(state) < 0) return 0;
+    if (!state->AST_type) {
+        return 0;
+    }
+    if (add_ast_fields(state) < 0) {
+        return 0;
+    }
     state->mod_type = make_type(state, "mod", state->AST_type, NULL, 0,
         "mod = Module(stmt* body, type_ignore* type_ignores)\n"
         "    | Interactive(stmt* body)\n"
@@ -1245,6 +1136,7 @@
         "     | If(expr test, stmt* body, stmt* orelse)\n"
         "     | With(withitem* items, stmt* body, string? type_comment)\n"
         "     | AsyncWith(withitem* items, stmt* body, string? type_comment)\n"
+        "     | Match(expr subject, match_case* cases)\n"
         "     | Raise(expr? exc, expr? cause)\n"
         "     | Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)\n"
         "     | Assert(expr test, expr? msg)\n"
@@ -1347,6 +1239,10 @@
     if (PyObject_SetAttr(state->AsyncWith_type, state->type_comment, Py_None)
         == -1)
         return 0;
+    state->Match_type = make_type(state, "Match", state->stmt_type,
+                                  Match_fields, 2,
+        "Match(expr subject, match_case* cases)");
+    if (!state->Match_type) return 0;
     state->Raise_type = make_type(state, "Raise", state->stmt_type,
                                   Raise_fields, 2,
         "Raise(expr? exc, expr? cause)");
@@ -1416,7 +1312,7 @@
         "     | YieldFrom(expr value)\n"
         "     | Compare(expr left, cmpop* ops, expr* comparators)\n"
         "     | Call(expr func, expr* args, keyword* keywords)\n"
-        "     | FormattedValue(expr value, int? conversion, expr? format_spec)\n"
+        "     | FormattedValue(expr value, int conversion, expr? format_spec)\n"
         "     | JoinedStr(expr* values)\n"
         "     | Constant(constant value, string? kind)\n"
         "     | Attribute(expr value, identifier attr, expr_context ctx)\n"
@@ -1506,11 +1402,8 @@
     state->FormattedValue_type = make_type(state, "FormattedValue",
                                            state->expr_type,
                                            FormattedValue_fields, 3,
-        "FormattedValue(expr value, int? conversion, expr? format_spec)");
+        "FormattedValue(expr value, int conversion, expr? format_spec)");
     if (!state->FormattedValue_type) return 0;
-    if (PyObject_SetAttr(state->FormattedValue_type, state->conversion,
-        Py_None) == -1)
-        return 0;
     if (PyObject_SetAttr(state->FormattedValue_type, state->format_spec,
         Py_None) == -1)
         return 0;
@@ -1853,9 +1746,15 @@
                                   alias_fields, 2,
         "alias(identifier name, identifier? asname)");
     if (!state->alias_type) return 0;
-    if (!add_attributes(state, state->alias_type, NULL, 0)) return 0;
+    if (!add_attributes(state, state->alias_type, alias_attributes, 4)) return
+        0;
     if (PyObject_SetAttr(state->alias_type, state->asname, Py_None) == -1)
         return 0;
+    if (PyObject_SetAttr(state->alias_type, state->end_lineno, Py_None) == -1)
+        return 0;
+    if (PyObject_SetAttr(state->alias_type, state->end_col_offset, Py_None) ==
+        -1)
+        return 0;
     state->withitem_type = make_type(state, "withitem", state->AST_type,
                                      withitem_fields, 2,
         "withitem(expr context_expr, expr? optional_vars)");
@@ -1864,6 +1763,70 @@
     if (PyObject_SetAttr(state->withitem_type, state->optional_vars, Py_None)
         == -1)
         return 0;
+    state->match_case_type = make_type(state, "match_case", state->AST_type,
+                                       match_case_fields, 3,
+        "match_case(pattern pattern, expr? guard, stmt* body)");
+    if (!state->match_case_type) return 0;
+    if (!add_attributes(state, state->match_case_type, NULL, 0)) return 0;
+    if (PyObject_SetAttr(state->match_case_type, state->guard, Py_None) == -1)
+        return 0;
+    state->pattern_type = make_type(state, "pattern", state->AST_type, NULL, 0,
+        "pattern = MatchValue(expr value)\n"
+        "        | MatchSingleton(constant value)\n"
+        "        | MatchSequence(pattern* patterns)\n"
+        "        | MatchMapping(expr* keys, pattern* patterns, identifier? rest)\n"
+        "        | MatchClass(expr cls, pattern* patterns, identifier* kwd_attrs, pattern* kwd_patterns)\n"
+        "        | MatchStar(identifier? name)\n"
+        "        | MatchAs(pattern? pattern, identifier? name)\n"
+        "        | MatchOr(pattern* patterns)");
+    if (!state->pattern_type) return 0;
+    if (!add_attributes(state, state->pattern_type, pattern_attributes, 4))
+        return 0;
+    state->MatchValue_type = make_type(state, "MatchValue",
+                                       state->pattern_type, MatchValue_fields,
+                                       1,
+        "MatchValue(expr value)");
+    if (!state->MatchValue_type) return 0;
+    state->MatchSingleton_type = make_type(state, "MatchSingleton",
+                                           state->pattern_type,
+                                           MatchSingleton_fields, 1,
+        "MatchSingleton(constant value)");
+    if (!state->MatchSingleton_type) return 0;
+    state->MatchSequence_type = make_type(state, "MatchSequence",
+                                          state->pattern_type,
+                                          MatchSequence_fields, 1,
+        "MatchSequence(pattern* patterns)");
+    if (!state->MatchSequence_type) return 0;
+    state->MatchMapping_type = make_type(state, "MatchMapping",
+                                         state->pattern_type,
+                                         MatchMapping_fields, 3,
+        "MatchMapping(expr* keys, pattern* patterns, identifier? rest)");
+    if (!state->MatchMapping_type) return 0;
+    if (PyObject_SetAttr(state->MatchMapping_type, state->rest, Py_None) == -1)
+        return 0;
+    state->MatchClass_type = make_type(state, "MatchClass",
+                                       state->pattern_type, MatchClass_fields,
+                                       4,
+        "MatchClass(expr cls, pattern* patterns, identifier* kwd_attrs, pattern* kwd_patterns)");
+    if (!state->MatchClass_type) return 0;
+    state->MatchStar_type = make_type(state, "MatchStar", state->pattern_type,
+                                      MatchStar_fields, 1,
+        "MatchStar(identifier? name)");
+    if (!state->MatchStar_type) return 0;
+    if (PyObject_SetAttr(state->MatchStar_type, state->name, Py_None) == -1)
+        return 0;
+    state->MatchAs_type = make_type(state, "MatchAs", state->pattern_type,
+                                    MatchAs_fields, 2,
+        "MatchAs(pattern? pattern, identifier? name)");
+    if (!state->MatchAs_type) return 0;
+    if (PyObject_SetAttr(state->MatchAs_type, state->pattern, Py_None) == -1)
+        return 0;
+    if (PyObject_SetAttr(state->MatchAs_type, state->name, Py_None) == -1)
+        return 0;
+    state->MatchOr_type = make_type(state, "MatchOr", state->pattern_type,
+                                    MatchOr_fields, 1,
+        "MatchOr(pattern* patterns)");
+    if (!state->MatchOr_type) return 0;
     state->type_ignore_type = make_type(state, "type_ignore", state->AST_type,
                                         NULL, 0,
         "type_ignore = TypeIgnore(int lineno, string tag)");
@@ -1874,48 +1837,54 @@
                                        TypeIgnore_fields, 2,
         "TypeIgnore(int lineno, string tag)");
     if (!state->TypeIgnore_type) return 0;
+
     state->initialized = 1;
     return 1;
 }
 
-static int obj2ast_mod(astmodulestate *state, PyObject* obj, mod_ty* out,
+static int obj2ast_mod(struct ast_state *state, PyObject* obj, mod_ty* out,
                        PyArena* arena);
-static int obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out,
+static int obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out,
                         PyArena* arena);
-static int obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out,
+static int obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out,
                         PyArena* arena);
-static int obj2ast_expr_context(astmodulestate *state, PyObject* obj,
+static int obj2ast_expr_context(struct ast_state *state, PyObject* obj,
                                 expr_context_ty* out, PyArena* arena);
-static int obj2ast_boolop(astmodulestate *state, PyObject* obj, boolop_ty* out,
-                          PyArena* arena);
-static int obj2ast_operator(astmodulestate *state, PyObject* obj, operator_ty*
-                            out, PyArena* arena);
-static int obj2ast_unaryop(astmodulestate *state, PyObject* obj, unaryop_ty*
+static int obj2ast_boolop(struct ast_state *state, PyObject* obj, boolop_ty*
+                          out, PyArena* arena);
+static int obj2ast_operator(struct ast_state *state, PyObject* obj,
+                            operator_ty* out, PyArena* arena);
+static int obj2ast_unaryop(struct ast_state *state, PyObject* obj, unaryop_ty*
                            out, PyArena* arena);
-static int obj2ast_cmpop(astmodulestate *state, PyObject* obj, cmpop_ty* out,
+static int obj2ast_cmpop(struct ast_state *state, PyObject* obj, cmpop_ty* out,
                          PyArena* arena);
-static int obj2ast_comprehension(astmodulestate *state, PyObject* obj,
+static int obj2ast_comprehension(struct ast_state *state, PyObject* obj,
                                  comprehension_ty* out, PyArena* arena);
-static int obj2ast_excepthandler(astmodulestate *state, PyObject* obj,
+static int obj2ast_excepthandler(struct ast_state *state, PyObject* obj,
                                  excepthandler_ty* out, PyArena* arena);
-static int obj2ast_arguments(astmodulestate *state, PyObject* obj,
+static int obj2ast_arguments(struct ast_state *state, PyObject* obj,
                              arguments_ty* out, PyArena* arena);
-static int obj2ast_arg(astmodulestate *state, PyObject* obj, arg_ty* out,
+static int obj2ast_arg(struct ast_state *state, PyObject* obj, arg_ty* out,
                        PyArena* arena);
-static int obj2ast_keyword(astmodulestate *state, PyObject* obj, keyword_ty*
+static int obj2ast_keyword(struct ast_state *state, PyObject* obj, keyword_ty*
                            out, PyArena* arena);
-static int obj2ast_alias(astmodulestate *state, PyObject* obj, alias_ty* out,
+static int obj2ast_alias(struct ast_state *state, PyObject* obj, alias_ty* out,
                          PyArena* arena);
-static int obj2ast_withitem(astmodulestate *state, PyObject* obj, withitem_ty*
-                            out, PyArena* arena);
-static int obj2ast_type_ignore(astmodulestate *state, PyObject* obj,
+static int obj2ast_withitem(struct ast_state *state, PyObject* obj,
+                            withitem_ty* out, PyArena* arena);
+static int obj2ast_match_case(struct ast_state *state, PyObject* obj,
+                              match_case_ty* out, PyArena* arena);
+static int obj2ast_pattern(struct ast_state *state, PyObject* obj, pattern_ty*
+                           out, PyArena* arena);
+static int obj2ast_type_ignore(struct ast_state *state, PyObject* obj,
                                type_ignore_ty* out, PyArena* arena);
 
 mod_ty
-Module(asdl_seq * body, asdl_seq * type_ignores, PyArena *arena)
+_PyAST_Module(asdl_stmt_seq * body, asdl_type_ignore_seq * type_ignores,
+              PyArena *arena)
 {
     mod_ty p;
-    p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (mod_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = Module_kind;
@@ -1925,10 +1894,10 @@
 }
 
 mod_ty
-Interactive(asdl_seq * body, PyArena *arena)
+_PyAST_Interactive(asdl_stmt_seq * body, PyArena *arena)
 {
     mod_ty p;
-    p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (mod_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = Interactive_kind;
@@ -1937,7 +1906,7 @@
 }
 
 mod_ty
-Expression(expr_ty body, PyArena *arena)
+_PyAST_Expression(expr_ty body, PyArena *arena)
 {
     mod_ty p;
     if (!body) {
@@ -1945,7 +1914,7 @@
                         "field 'body' is required for Expression");
         return NULL;
     }
-    p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (mod_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = Expression_kind;
@@ -1954,7 +1923,7 @@
 }
 
 mod_ty
-FunctionType(asdl_seq * argtypes, expr_ty returns, PyArena *arena)
+_PyAST_FunctionType(asdl_expr_seq * argtypes, expr_ty returns, PyArena *arena)
 {
     mod_ty p;
     if (!returns) {
@@ -1962,7 +1931,7 @@
                         "field 'returns' is required for FunctionType");
         return NULL;
     }
-    p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (mod_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = FunctionType_kind;
@@ -1972,9 +1941,10 @@
 }
 
 stmt_ty
-FunctionDef(identifier name, arguments_ty args, asdl_seq * body, asdl_seq *
-            decorator_list, expr_ty returns, string type_comment, int lineno,
-            int col_offset, int end_lineno, int end_col_offset, PyArena *arena)
+_PyAST_FunctionDef(identifier name, arguments_ty args, asdl_stmt_seq * body,
+                   asdl_expr_seq * decorator_list, expr_ty returns, string
+                   type_comment, int lineno, int col_offset, int end_lineno,
+                   int end_col_offset, PyArena *arena)
 {
     stmt_ty p;
     if (!name) {
@@ -1987,7 +1957,7 @@
                         "field 'args' is required for FunctionDef");
         return NULL;
     }
-    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = FunctionDef_kind;
@@ -2005,10 +1975,10 @@
 }
 
 stmt_ty
-AsyncFunctionDef(identifier name, arguments_ty args, asdl_seq * body, asdl_seq
-                 * decorator_list, expr_ty returns, string type_comment, int
-                 lineno, int col_offset, int end_lineno, int end_col_offset,
-                 PyArena *arena)
+_PyAST_AsyncFunctionDef(identifier name, arguments_ty args, asdl_stmt_seq *
+                        body, asdl_expr_seq * decorator_list, expr_ty returns,
+                        string type_comment, int lineno, int col_offset, int
+                        end_lineno, int end_col_offset, PyArena *arena)
 {
     stmt_ty p;
     if (!name) {
@@ -2021,7 +1991,7 @@
                         "field 'args' is required for AsyncFunctionDef");
         return NULL;
     }
-    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = AsyncFunctionDef_kind;
@@ -2039,9 +2009,10 @@
 }
 
 stmt_ty
-ClassDef(identifier name, asdl_seq * bases, asdl_seq * keywords, asdl_seq *
-         body, asdl_seq * decorator_list, int lineno, int col_offset, int
-         end_lineno, int end_col_offset, PyArena *arena)
+_PyAST_ClassDef(identifier name, asdl_expr_seq * bases, asdl_keyword_seq *
+                keywords, asdl_stmt_seq * body, asdl_expr_seq * decorator_list,
+                int lineno, int col_offset, int end_lineno, int end_col_offset,
+                PyArena *arena)
 {
     stmt_ty p;
     if (!name) {
@@ -2049,7 +2020,7 @@
                         "field 'name' is required for ClassDef");
         return NULL;
     }
-    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = ClassDef_kind;
@@ -2066,11 +2037,11 @@
 }
 
 stmt_ty
-Return(expr_ty value, int lineno, int col_offset, int end_lineno, int
-       end_col_offset, PyArena *arena)
+_PyAST_Return(expr_ty value, int lineno, int col_offset, int end_lineno, int
+              end_col_offset, PyArena *arena)
 {
     stmt_ty p;
-    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = Return_kind;
@@ -2083,11 +2054,11 @@
 }
 
 stmt_ty
-Delete(asdl_seq * targets, int lineno, int col_offset, int end_lineno, int
-       end_col_offset, PyArena *arena)
+_PyAST_Delete(asdl_expr_seq * targets, int lineno, int col_offset, int
+              end_lineno, int end_col_offset, PyArena *arena)
 {
     stmt_ty p;
-    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = Delete_kind;
@@ -2100,8 +2071,9 @@
 }
 
 stmt_ty
-Assign(asdl_seq * targets, expr_ty value, string type_comment, int lineno, int
-       col_offset, int end_lineno, int end_col_offset, PyArena *arena)
+_PyAST_Assign(asdl_expr_seq * targets, expr_ty value, string type_comment, int
+              lineno, int col_offset, int end_lineno, int end_col_offset,
+              PyArena *arena)
 {
     stmt_ty p;
     if (!value) {
@@ -2109,7 +2081,7 @@
                         "field 'value' is required for Assign");
         return NULL;
     }
-    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = Assign_kind;
@@ -2124,8 +2096,8 @@
 }
 
 stmt_ty
-AugAssign(expr_ty target, operator_ty op, expr_ty value, int lineno, int
-          col_offset, int end_lineno, int end_col_offset, PyArena *arena)
+_PyAST_AugAssign(expr_ty target, operator_ty op, expr_ty value, int lineno, int
+                 col_offset, int end_lineno, int end_col_offset, PyArena *arena)
 {
     stmt_ty p;
     if (!target) {
@@ -2143,7 +2115,7 @@
                         "field 'value' is required for AugAssign");
         return NULL;
     }
-    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = AugAssign_kind;
@@ -2158,9 +2130,9 @@
 }
 
 stmt_ty
-AnnAssign(expr_ty target, expr_ty annotation, expr_ty value, int simple, int
-          lineno, int col_offset, int end_lineno, int end_col_offset, PyArena
-          *arena)
+_PyAST_AnnAssign(expr_ty target, expr_ty annotation, expr_ty value, int simple,
+                 int lineno, int col_offset, int end_lineno, int
+                 end_col_offset, PyArena *arena)
 {
     stmt_ty p;
     if (!target) {
@@ -2173,7 +2145,7 @@
                         "field 'annotation' is required for AnnAssign");
         return NULL;
     }
-    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = AnnAssign_kind;
@@ -2189,9 +2161,9 @@
 }
 
 stmt_ty
-For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * orelse, string
-    type_comment, int lineno, int col_offset, int end_lineno, int
-    end_col_offset, PyArena *arena)
+_PyAST_For(expr_ty target, expr_ty iter, asdl_stmt_seq * body, asdl_stmt_seq *
+           orelse, string type_comment, int lineno, int col_offset, int
+           end_lineno, int end_col_offset, PyArena *arena)
 {
     stmt_ty p;
     if (!target) {
@@ -2204,7 +2176,7 @@
                         "field 'iter' is required for For");
         return NULL;
     }
-    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = For_kind;
@@ -2221,9 +2193,9 @@
 }
 
 stmt_ty
-AsyncFor(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * orelse,
-         string type_comment, int lineno, int col_offset, int end_lineno, int
-         end_col_offset, PyArena *arena)
+_PyAST_AsyncFor(expr_ty target, expr_ty iter, asdl_stmt_seq * body,
+                asdl_stmt_seq * orelse, string type_comment, int lineno, int
+                col_offset, int end_lineno, int end_col_offset, PyArena *arena)
 {
     stmt_ty p;
     if (!target) {
@@ -2236,7 +2208,7 @@
                         "field 'iter' is required for AsyncFor");
         return NULL;
     }
-    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = AsyncFor_kind;
@@ -2253,8 +2225,9 @@
 }
 
 stmt_ty
-While(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, int
-      col_offset, int end_lineno, int end_col_offset, PyArena *arena)
+_PyAST_While(expr_ty test, asdl_stmt_seq * body, asdl_stmt_seq * orelse, int
+             lineno, int col_offset, int end_lineno, int end_col_offset,
+             PyArena *arena)
 {
     stmt_ty p;
     if (!test) {
@@ -2262,7 +2235,7 @@
                         "field 'test' is required for While");
         return NULL;
     }
-    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = While_kind;
@@ -2277,8 +2250,9 @@
 }
 
 stmt_ty
-If(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, int
-   col_offset, int end_lineno, int end_col_offset, PyArena *arena)
+_PyAST_If(expr_ty test, asdl_stmt_seq * body, asdl_stmt_seq * orelse, int
+          lineno, int col_offset, int end_lineno, int end_col_offset, PyArena
+          *arena)
 {
     stmt_ty p;
     if (!test) {
@@ -2286,7 +2260,7 @@
                         "field 'test' is required for If");
         return NULL;
     }
-    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = If_kind;
@@ -2301,11 +2275,12 @@
 }
 
 stmt_ty
-With(asdl_seq * items, asdl_seq * body, string type_comment, int lineno, int
-     col_offset, int end_lineno, int end_col_offset, PyArena *arena)
+_PyAST_With(asdl_withitem_seq * items, asdl_stmt_seq * body, string
+            type_comment, int lineno, int col_offset, int end_lineno, int
+            end_col_offset, PyArena *arena)
 {
     stmt_ty p;
-    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = With_kind;
@@ -2320,11 +2295,12 @@
 }
 
 stmt_ty
-AsyncWith(asdl_seq * items, asdl_seq * body, string type_comment, int lineno,
-          int col_offset, int end_lineno, int end_col_offset, PyArena *arena)
+_PyAST_AsyncWith(asdl_withitem_seq * items, asdl_stmt_seq * body, string
+                 type_comment, int lineno, int col_offset, int end_lineno, int
+                 end_col_offset, PyArena *arena)
 {
     stmt_ty p;
-    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = AsyncWith_kind;
@@ -2339,11 +2315,34 @@
 }
 
 stmt_ty
-Raise(expr_ty exc, expr_ty cause, int lineno, int col_offset, int end_lineno,
-      int end_col_offset, PyArena *arena)
+_PyAST_Match(expr_ty subject, asdl_match_case_seq * cases, int lineno, int
+             col_offset, int end_lineno, int end_col_offset, PyArena *arena)
 {
     stmt_ty p;
-    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+    if (!subject) {
+        PyErr_SetString(PyExc_ValueError,
+                        "field 'subject' is required for Match");
+        return NULL;
+    }
+    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
+    if (!p)
+        return NULL;
+    p->kind = Match_kind;
+    p->v.Match.subject = subject;
+    p->v.Match.cases = cases;
+    p->lineno = lineno;
+    p->col_offset = col_offset;
+    p->end_lineno = end_lineno;
+    p->end_col_offset = end_col_offset;
+    return p;
+}
+
+stmt_ty
+_PyAST_Raise(expr_ty exc, expr_ty cause, int lineno, int col_offset, int
+             end_lineno, int end_col_offset, PyArena *arena)
+{
+    stmt_ty p;
+    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = Raise_kind;
@@ -2357,12 +2356,12 @@
 }
 
 stmt_ty
-Try(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse, asdl_seq *
-    finalbody, int lineno, int col_offset, int end_lineno, int end_col_offset,
-    PyArena *arena)
+_PyAST_Try(asdl_stmt_seq * body, asdl_excepthandler_seq * handlers,
+           asdl_stmt_seq * orelse, asdl_stmt_seq * finalbody, int lineno, int
+           col_offset, int end_lineno, int end_col_offset, PyArena *arena)
 {
     stmt_ty p;
-    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = Try_kind;
@@ -2378,8 +2377,8 @@
 }
 
 stmt_ty
-Assert(expr_ty test, expr_ty msg, int lineno, int col_offset, int end_lineno,
-       int end_col_offset, PyArena *arena)
+_PyAST_Assert(expr_ty test, expr_ty msg, int lineno, int col_offset, int
+              end_lineno, int end_col_offset, PyArena *arena)
 {
     stmt_ty p;
     if (!test) {
@@ -2387,7 +2386,7 @@
                         "field 'test' is required for Assert");
         return NULL;
     }
-    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = Assert_kind;
@@ -2401,11 +2400,11 @@
 }
 
 stmt_ty
-Import(asdl_seq * names, int lineno, int col_offset, int end_lineno, int
-       end_col_offset, PyArena *arena)
+_PyAST_Import(asdl_alias_seq * names, int lineno, int col_offset, int
+              end_lineno, int end_col_offset, PyArena *arena)
 {
     stmt_ty p;
-    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = Import_kind;
@@ -2418,11 +2417,12 @@
 }
 
 stmt_ty
-ImportFrom(identifier module, asdl_seq * names, int level, int lineno, int
-           col_offset, int end_lineno, int end_col_offset, PyArena *arena)
+_PyAST_ImportFrom(identifier module, asdl_alias_seq * names, int level, int
+                  lineno, int col_offset, int end_lineno, int end_col_offset,
+                  PyArena *arena)
 {
     stmt_ty p;
-    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = ImportFrom_kind;
@@ -2437,11 +2437,11 @@
 }
 
 stmt_ty
-Global(asdl_seq * names, int lineno, int col_offset, int end_lineno, int
-       end_col_offset, PyArena *arena)
+_PyAST_Global(asdl_identifier_seq * names, int lineno, int col_offset, int
+              end_lineno, int end_col_offset, PyArena *arena)
 {
     stmt_ty p;
-    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = Global_kind;
@@ -2454,11 +2454,11 @@
 }
 
 stmt_ty
-Nonlocal(asdl_seq * names, int lineno, int col_offset, int end_lineno, int
-         end_col_offset, PyArena *arena)
+_PyAST_Nonlocal(asdl_identifier_seq * names, int lineno, int col_offset, int
+                end_lineno, int end_col_offset, PyArena *arena)
 {
     stmt_ty p;
-    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = Nonlocal_kind;
@@ -2471,8 +2471,8 @@
 }
 
 stmt_ty
-Expr(expr_ty value, int lineno, int col_offset, int end_lineno, int
-     end_col_offset, PyArena *arena)
+_PyAST_Expr(expr_ty value, int lineno, int col_offset, int end_lineno, int
+            end_col_offset, PyArena *arena)
 {
     stmt_ty p;
     if (!value) {
@@ -2480,7 +2480,7 @@
                         "field 'value' is required for Expr");
         return NULL;
     }
-    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = Expr_kind;
@@ -2493,11 +2493,11 @@
 }
 
 stmt_ty
-Pass(int lineno, int col_offset, int end_lineno, int end_col_offset, PyArena
-     *arena)
+_PyAST_Pass(int lineno, int col_offset, int end_lineno, int end_col_offset,
+            PyArena *arena)
 {
     stmt_ty p;
-    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = Pass_kind;
@@ -2509,11 +2509,11 @@
 }
 
 stmt_ty
-Break(int lineno, int col_offset, int end_lineno, int end_col_offset, PyArena
-      *arena)
+_PyAST_Break(int lineno, int col_offset, int end_lineno, int end_col_offset,
+             PyArena *arena)
 {
     stmt_ty p;
-    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = Break_kind;
@@ -2525,11 +2525,11 @@
 }
 
 stmt_ty
-Continue(int lineno, int col_offset, int end_lineno, int end_col_offset,
-         PyArena *arena)
+_PyAST_Continue(int lineno, int col_offset, int end_lineno, int end_col_offset,
+                PyArena *arena)
 {
     stmt_ty p;
-    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = Continue_kind;
@@ -2541,8 +2541,8 @@
 }
 
 expr_ty
-BoolOp(boolop_ty op, asdl_seq * values, int lineno, int col_offset, int
-       end_lineno, int end_col_offset, PyArena *arena)
+_PyAST_BoolOp(boolop_ty op, asdl_expr_seq * values, int lineno, int col_offset,
+              int end_lineno, int end_col_offset, PyArena *arena)
 {
     expr_ty p;
     if (!op) {
@@ -2550,7 +2550,7 @@
                         "field 'op' is required for BoolOp");
         return NULL;
     }
-    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = BoolOp_kind;
@@ -2564,8 +2564,8 @@
 }
 
 expr_ty
-NamedExpr(expr_ty target, expr_ty value, int lineno, int col_offset, int
-          end_lineno, int end_col_offset, PyArena *arena)
+_PyAST_NamedExpr(expr_ty target, expr_ty value, int lineno, int col_offset, int
+                 end_lineno, int end_col_offset, PyArena *arena)
 {
     expr_ty p;
     if (!target) {
@@ -2578,7 +2578,7 @@
                         "field 'value' is required for NamedExpr");
         return NULL;
     }
-    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = NamedExpr_kind;
@@ -2592,8 +2592,8 @@
 }
 
 expr_ty
-BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno, int col_offset,
-      int end_lineno, int end_col_offset, PyArena *arena)
+_PyAST_BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno, int
+             col_offset, int end_lineno, int end_col_offset, PyArena *arena)
 {
     expr_ty p;
     if (!left) {
@@ -2611,7 +2611,7 @@
                         "field 'right' is required for BinOp");
         return NULL;
     }
-    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = BinOp_kind;
@@ -2626,8 +2626,8 @@
 }
 
 expr_ty
-UnaryOp(unaryop_ty op, expr_ty operand, int lineno, int col_offset, int
-        end_lineno, int end_col_offset, PyArena *arena)
+_PyAST_UnaryOp(unaryop_ty op, expr_ty operand, int lineno, int col_offset, int
+               end_lineno, int end_col_offset, PyArena *arena)
 {
     expr_ty p;
     if (!op) {
@@ -2640,7 +2640,7 @@
                         "field 'operand' is required for UnaryOp");
         return NULL;
     }
-    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = UnaryOp_kind;
@@ -2654,8 +2654,8 @@
 }
 
 expr_ty
-Lambda(arguments_ty args, expr_ty body, int lineno, int col_offset, int
-       end_lineno, int end_col_offset, PyArena *arena)
+_PyAST_Lambda(arguments_ty args, expr_ty body, int lineno, int col_offset, int
+              end_lineno, int end_col_offset, PyArena *arena)
 {
     expr_ty p;
     if (!args) {
@@ -2668,7 +2668,7 @@
                         "field 'body' is required for Lambda");
         return NULL;
     }
-    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = Lambda_kind;
@@ -2682,8 +2682,8 @@
 }
 
 expr_ty
-IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int col_offset,
-      int end_lineno, int end_col_offset, PyArena *arena)
+_PyAST_IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int
+             col_offset, int end_lineno, int end_col_offset, PyArena *arena)
 {
     expr_ty p;
     if (!test) {
@@ -2701,7 +2701,7 @@
                         "field 'orelse' is required for IfExp");
         return NULL;
     }
-    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = IfExp_kind;
@@ -2716,11 +2716,11 @@
 }
 
 expr_ty
-Dict(asdl_seq * keys, asdl_seq * values, int lineno, int col_offset, int
-     end_lineno, int end_col_offset, PyArena *arena)
+_PyAST_Dict(asdl_expr_seq * keys, asdl_expr_seq * values, int lineno, int
+            col_offset, int end_lineno, int end_col_offset, PyArena *arena)
 {
     expr_ty p;
-    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = Dict_kind;
@@ -2734,11 +2734,11 @@
 }
 
 expr_ty
-Set(asdl_seq * elts, int lineno, int col_offset, int end_lineno, int
-    end_col_offset, PyArena *arena)
+_PyAST_Set(asdl_expr_seq * elts, int lineno, int col_offset, int end_lineno,
+           int end_col_offset, PyArena *arena)
 {
     expr_ty p;
-    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = Set_kind;
@@ -2751,8 +2751,9 @@
 }
 
 expr_ty
-ListComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, int
-         end_lineno, int end_col_offset, PyArena *arena)
+_PyAST_ListComp(expr_ty elt, asdl_comprehension_seq * generators, int lineno,
+                int col_offset, int end_lineno, int end_col_offset, PyArena
+                *arena)
 {
     expr_ty p;
     if (!elt) {
@@ -2760,7 +2761,7 @@
                         "field 'elt' is required for ListComp");
         return NULL;
     }
-    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = ListComp_kind;
@@ -2774,8 +2775,9 @@
 }
 
 expr_ty
-SetComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, int
-        end_lineno, int end_col_offset, PyArena *arena)
+_PyAST_SetComp(expr_ty elt, asdl_comprehension_seq * generators, int lineno,
+               int col_offset, int end_lineno, int end_col_offset, PyArena
+               *arena)
 {
     expr_ty p;
     if (!elt) {
@@ -2783,7 +2785,7 @@
                         "field 'elt' is required for SetComp");
         return NULL;
     }
-    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = SetComp_kind;
@@ -2797,8 +2799,9 @@
 }
 
 expr_ty
-DictComp(expr_ty key, expr_ty value, asdl_seq * generators, int lineno, int
-         col_offset, int end_lineno, int end_col_offset, PyArena *arena)
+_PyAST_DictComp(expr_ty key, expr_ty value, asdl_comprehension_seq *
+                generators, int lineno, int col_offset, int end_lineno, int
+                end_col_offset, PyArena *arena)
 {
     expr_ty p;
     if (!key) {
@@ -2811,7 +2814,7 @@
                         "field 'value' is required for DictComp");
         return NULL;
     }
-    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = DictComp_kind;
@@ -2826,8 +2829,9 @@
 }
 
 expr_ty
-GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset,
-             int end_lineno, int end_col_offset, PyArena *arena)
+_PyAST_GeneratorExp(expr_ty elt, asdl_comprehension_seq * generators, int
+                    lineno, int col_offset, int end_lineno, int end_col_offset,
+                    PyArena *arena)
 {
     expr_ty p;
     if (!elt) {
@@ -2835,7 +2839,7 @@
                         "field 'elt' is required for GeneratorExp");
         return NULL;
     }
-    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = GeneratorExp_kind;
@@ -2849,8 +2853,8 @@
 }
 
 expr_ty
-Await(expr_ty value, int lineno, int col_offset, int end_lineno, int
-      end_col_offset, PyArena *arena)
+_PyAST_Await(expr_ty value, int lineno, int col_offset, int end_lineno, int
+             end_col_offset, PyArena *arena)
 {
     expr_ty p;
     if (!value) {
@@ -2858,7 +2862,7 @@
                         "field 'value' is required for Await");
         return NULL;
     }
-    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = Await_kind;
@@ -2871,11 +2875,11 @@
 }
 
 expr_ty
-Yield(expr_ty value, int lineno, int col_offset, int end_lineno, int
-      end_col_offset, PyArena *arena)
+_PyAST_Yield(expr_ty value, int lineno, int col_offset, int end_lineno, int
+             end_col_offset, PyArena *arena)
 {
     expr_ty p;
-    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = Yield_kind;
@@ -2888,8 +2892,8 @@
 }
 
 expr_ty
-YieldFrom(expr_ty value, int lineno, int col_offset, int end_lineno, int
-          end_col_offset, PyArena *arena)
+_PyAST_YieldFrom(expr_ty value, int lineno, int col_offset, int end_lineno, int
+                 end_col_offset, PyArena *arena)
 {
     expr_ty p;
     if (!value) {
@@ -2897,7 +2901,7 @@
                         "field 'value' is required for YieldFrom");
         return NULL;
     }
-    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = YieldFrom_kind;
@@ -2910,8 +2914,9 @@
 }
 
 expr_ty
-Compare(expr_ty left, asdl_int_seq * ops, asdl_seq * comparators, int lineno,
-        int col_offset, int end_lineno, int end_col_offset, PyArena *arena)
+_PyAST_Compare(expr_ty left, asdl_int_seq * ops, asdl_expr_seq * comparators,
+               int lineno, int col_offset, int end_lineno, int end_col_offset,
+               PyArena *arena)
 {
     expr_ty p;
     if (!left) {
@@ -2919,7 +2924,7 @@
                         "field 'left' is required for Compare");
         return NULL;
     }
-    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = Compare_kind;
@@ -2934,8 +2939,9 @@
 }
 
 expr_ty
-Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, int lineno, int
-     col_offset, int end_lineno, int end_col_offset, PyArena *arena)
+_PyAST_Call(expr_ty func, asdl_expr_seq * args, asdl_keyword_seq * keywords,
+            int lineno, int col_offset, int end_lineno, int end_col_offset,
+            PyArena *arena)
 {
     expr_ty p;
     if (!func) {
@@ -2943,7 +2949,7 @@
                         "field 'func' is required for Call");
         return NULL;
     }
-    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = Call_kind;
@@ -2958,9 +2964,9 @@
 }
 
 expr_ty
-FormattedValue(expr_ty value, int conversion, expr_ty format_spec, int lineno,
-               int col_offset, int end_lineno, int end_col_offset, PyArena
-               *arena)
+_PyAST_FormattedValue(expr_ty value, int conversion, expr_ty format_spec, int
+                      lineno, int col_offset, int end_lineno, int
+                      end_col_offset, PyArena *arena)
 {
     expr_ty p;
     if (!value) {
@@ -2968,7 +2974,7 @@
                         "field 'value' is required for FormattedValue");
         return NULL;
     }
-    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = FormattedValue_kind;
@@ -2983,11 +2989,11 @@
 }
 
 expr_ty
-JoinedStr(asdl_seq * values, int lineno, int col_offset, int end_lineno, int
-          end_col_offset, PyArena *arena)
+_PyAST_JoinedStr(asdl_expr_seq * values, int lineno, int col_offset, int
+                 end_lineno, int end_col_offset, PyArena *arena)
 {
     expr_ty p;
-    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = JoinedStr_kind;
@@ -3000,8 +3006,8 @@
 }
 
 expr_ty
-Constant(constant value, string kind, int lineno, int col_offset, int
-         end_lineno, int end_col_offset, PyArena *arena)
+_PyAST_Constant(constant value, string kind, int lineno, int col_offset, int
+                end_lineno, int end_col_offset, PyArena *arena)
 {
     expr_ty p;
     if (!value) {
@@ -3009,7 +3015,7 @@
                         "field 'value' is required for Constant");
         return NULL;
     }
-    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = Constant_kind;
@@ -3023,8 +3029,9 @@
 }
 
 expr_ty
-Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int lineno, int
-          col_offset, int end_lineno, int end_col_offset, PyArena *arena)
+_PyAST_Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int
+                 lineno, int col_offset, int end_lineno, int end_col_offset,
+                 PyArena *arena)
 {
     expr_ty p;
     if (!value) {
@@ -3042,7 +3049,7 @@
                         "field 'ctx' is required for Attribute");
         return NULL;
     }
-    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = Attribute_kind;
@@ -3057,8 +3064,9 @@
 }
 
 expr_ty
-Subscript(expr_ty value, expr_ty slice, expr_context_ty ctx, int lineno, int
-          col_offset, int end_lineno, int end_col_offset, PyArena *arena)
+_PyAST_Subscript(expr_ty value, expr_ty slice, expr_context_ty ctx, int lineno,
+                 int col_offset, int end_lineno, int end_col_offset, PyArena
+                 *arena)
 {
     expr_ty p;
     if (!value) {
@@ -3076,7 +3084,7 @@
                         "field 'ctx' is required for Subscript");
         return NULL;
     }
-    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = Subscript_kind;
@@ -3091,8 +3099,8 @@
 }
 
 expr_ty
-Starred(expr_ty value, expr_context_ty ctx, int lineno, int col_offset, int
-        end_lineno, int end_col_offset, PyArena *arena)
+_PyAST_Starred(expr_ty value, expr_context_ty ctx, int lineno, int col_offset,
+               int end_lineno, int end_col_offset, PyArena *arena)
 {
     expr_ty p;
     if (!value) {
@@ -3105,7 +3113,7 @@
                         "field 'ctx' is required for Starred");
         return NULL;
     }
-    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = Starred_kind;
@@ -3119,8 +3127,8 @@
 }
 
 expr_ty
-Name(identifier id, expr_context_ty ctx, int lineno, int col_offset, int
-     end_lineno, int end_col_offset, PyArena *arena)
+_PyAST_Name(identifier id, expr_context_ty ctx, int lineno, int col_offset, int
+            end_lineno, int end_col_offset, PyArena *arena)
 {
     expr_ty p;
     if (!id) {
@@ -3133,7 +3141,7 @@
                         "field 'ctx' is required for Name");
         return NULL;
     }
-    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = Name_kind;
@@ -3147,8 +3155,8 @@
 }
 
 expr_ty
-List(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, int
-     end_lineno, int end_col_offset, PyArena *arena)
+_PyAST_List(asdl_expr_seq * elts, expr_context_ty ctx, int lineno, int
+            col_offset, int end_lineno, int end_col_offset, PyArena *arena)
 {
     expr_ty p;
     if (!ctx) {
@@ -3156,7 +3164,7 @@
                         "field 'ctx' is required for List");
         return NULL;
     }
-    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = List_kind;
@@ -3170,8 +3178,8 @@
 }
 
 expr_ty
-Tuple(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, int
-      end_lineno, int end_col_offset, PyArena *arena)
+_PyAST_Tuple(asdl_expr_seq * elts, expr_context_ty ctx, int lineno, int
+             col_offset, int end_lineno, int end_col_offset, PyArena *arena)
 {
     expr_ty p;
     if (!ctx) {
@@ -3179,7 +3187,7 @@
                         "field 'ctx' is required for Tuple");
         return NULL;
     }
-    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = Tuple_kind;
@@ -3193,11 +3201,11 @@
 }
 
 expr_ty
-Slice(expr_ty lower, expr_ty upper, expr_ty step, int lineno, int col_offset,
-      int end_lineno, int end_col_offset, PyArena *arena)
+_PyAST_Slice(expr_ty lower, expr_ty upper, expr_ty step, int lineno, int
+             col_offset, int end_lineno, int end_col_offset, PyArena *arena)
 {
     expr_ty p;
-    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (expr_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = Slice_kind;
@@ -3212,8 +3220,8 @@
 }
 
 comprehension_ty
-comprehension(expr_ty target, expr_ty iter, asdl_seq * ifs, int is_async,
-              PyArena *arena)
+_PyAST_comprehension(expr_ty target, expr_ty iter, asdl_expr_seq * ifs, int
+                     is_async, PyArena *arena)
 {
     comprehension_ty p;
     if (!target) {
@@ -3226,7 +3234,7 @@
                         "field 'iter' is required for comprehension");
         return NULL;
     }
-    p = (comprehension_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (comprehension_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->target = target;
@@ -3237,11 +3245,12 @@
 }
 
 excepthandler_ty
-ExceptHandler(expr_ty type, identifier name, asdl_seq * body, int lineno, int
-              col_offset, int end_lineno, int end_col_offset, PyArena *arena)
+_PyAST_ExceptHandler(expr_ty type, identifier name, asdl_stmt_seq * body, int
+                     lineno, int col_offset, int end_lineno, int
+                     end_col_offset, PyArena *arena)
 {
     excepthandler_ty p;
-    p = (excepthandler_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (excepthandler_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = ExceptHandler_kind;
@@ -3256,12 +3265,13 @@
 }
 
 arguments_ty
-arguments(asdl_seq * posonlyargs, asdl_seq * args, arg_ty vararg, asdl_seq *
-          kwonlyargs, asdl_seq * kw_defaults, arg_ty kwarg, asdl_seq *
-          defaults, PyArena *arena)
+_PyAST_arguments(asdl_arg_seq * posonlyargs, asdl_arg_seq * args, arg_ty
+                 vararg, asdl_arg_seq * kwonlyargs, asdl_expr_seq *
+                 kw_defaults, arg_ty kwarg, asdl_expr_seq * defaults, PyArena
+                 *arena)
 {
     arguments_ty p;
-    p = (arguments_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (arguments_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->posonlyargs = posonlyargs;
@@ -3275,8 +3285,8 @@
 }
 
 arg_ty
-arg(identifier arg, expr_ty annotation, string type_comment, int lineno, int
-    col_offset, int end_lineno, int end_col_offset, PyArena *arena)
+_PyAST_arg(identifier arg, expr_ty annotation, string type_comment, int lineno,
+           int col_offset, int end_lineno, int end_col_offset, PyArena *arena)
 {
     arg_ty p;
     if (!arg) {
@@ -3284,7 +3294,7 @@
                         "field 'arg' is required for arg");
         return NULL;
     }
-    p = (arg_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (arg_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->arg = arg;
@@ -3298,8 +3308,8 @@
 }
 
 keyword_ty
-keyword(identifier arg, expr_ty value, int lineno, int col_offset, int
-        end_lineno, int end_col_offset, PyArena *arena)
+_PyAST_keyword(identifier arg, expr_ty value, int lineno, int col_offset, int
+               end_lineno, int end_col_offset, PyArena *arena)
 {
     keyword_ty p;
     if (!value) {
@@ -3307,7 +3317,7 @@
                         "field 'value' is required for keyword");
         return NULL;
     }
-    p = (keyword_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (keyword_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->arg = arg;
@@ -3320,7 +3330,8 @@
 }
 
 alias_ty
-alias(identifier name, identifier asname, PyArena *arena)
+_PyAST_alias(identifier name, identifier asname, int lineno, int col_offset,
+             int end_lineno, int end_col_offset, PyArena *arena)
 {
     alias_ty p;
     if (!name) {
@@ -3328,16 +3339,20 @@
                         "field 'name' is required for alias");
         return NULL;
     }
-    p = (alias_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (alias_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->name = name;
     p->asname = asname;
+    p->lineno = lineno;
+    p->col_offset = col_offset;
+    p->end_lineno = end_lineno;
+    p->end_col_offset = end_col_offset;
     return p;
 }
 
 withitem_ty
-withitem(expr_ty context_expr, expr_ty optional_vars, PyArena *arena)
+_PyAST_withitem(expr_ty context_expr, expr_ty optional_vars, PyArena *arena)
 {
     withitem_ty p;
     if (!context_expr) {
@@ -3345,7 +3360,7 @@
                         "field 'context_expr' is required for withitem");
         return NULL;
     }
-    p = (withitem_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (withitem_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->context_expr = context_expr;
@@ -3353,8 +3368,187 @@
     return p;
 }
 
+match_case_ty
+_PyAST_match_case(pattern_ty pattern, expr_ty guard, asdl_stmt_seq * body,
+                  PyArena *arena)
+{
+    match_case_ty p;
+    if (!pattern) {
+        PyErr_SetString(PyExc_ValueError,
+                        "field 'pattern' is required for match_case");
+        return NULL;
+    }
+    p = (match_case_ty)_PyArena_Malloc(arena, sizeof(*p));
+    if (!p)
+        return NULL;
+    p->pattern = pattern;
+    p->guard = guard;
+    p->body = body;
+    return p;
+}
+
+pattern_ty
+_PyAST_MatchValue(expr_ty value, int lineno, int col_offset, int end_lineno,
+                  int end_col_offset, PyArena *arena)
+{
+    pattern_ty p;
+    if (!value) {
+        PyErr_SetString(PyExc_ValueError,
+                        "field 'value' is required for MatchValue");
+        return NULL;
+    }
+    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
+    if (!p)
+        return NULL;
+    p->kind = MatchValue_kind;
+    p->v.MatchValue.value = value;
+    p->lineno = lineno;
+    p->col_offset = col_offset;
+    p->end_lineno = end_lineno;
+    p->end_col_offset = end_col_offset;
+    return p;
+}
+
+pattern_ty
+_PyAST_MatchSingleton(constant value, int lineno, int col_offset, int
+                      end_lineno, int end_col_offset, PyArena *arena)
+{
+    pattern_ty p;
+    if (!value) {
+        PyErr_SetString(PyExc_ValueError,
+                        "field 'value' is required for MatchSingleton");
+        return NULL;
+    }
+    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
+    if (!p)
+        return NULL;
+    p->kind = MatchSingleton_kind;
+    p->v.MatchSingleton.value = value;
+    p->lineno = lineno;
+    p->col_offset = col_offset;
+    p->end_lineno = end_lineno;
+    p->end_col_offset = end_col_offset;
+    return p;
+}
+
+pattern_ty
+_PyAST_MatchSequence(asdl_pattern_seq * patterns, int lineno, int col_offset,
+                     int end_lineno, int end_col_offset, PyArena *arena)
+{
+    pattern_ty p;
+    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
+    if (!p)
+        return NULL;
+    p->kind = MatchSequence_kind;
+    p->v.MatchSequence.patterns = patterns;
+    p->lineno = lineno;
+    p->col_offset = col_offset;
+    p->end_lineno = end_lineno;
+    p->end_col_offset = end_col_offset;
+    return p;
+}
+
+pattern_ty
+_PyAST_MatchMapping(asdl_expr_seq * keys, asdl_pattern_seq * patterns,
+                    identifier rest, int lineno, int col_offset, int
+                    end_lineno, int end_col_offset, PyArena *arena)
+{
+    pattern_ty p;
+    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
+    if (!p)
+        return NULL;
+    p->kind = MatchMapping_kind;
+    p->v.MatchMapping.keys = keys;
+    p->v.MatchMapping.patterns = patterns;
+    p->v.MatchMapping.rest = rest;
+    p->lineno = lineno;
+    p->col_offset = col_offset;
+    p->end_lineno = end_lineno;
+    p->end_col_offset = end_col_offset;
+    return p;
+}
+
+pattern_ty
+_PyAST_MatchClass(expr_ty cls, asdl_pattern_seq * patterns, asdl_identifier_seq
+                  * kwd_attrs, asdl_pattern_seq * kwd_patterns, int lineno, int
+                  col_offset, int end_lineno, int end_col_offset, PyArena
+                  *arena)
+{
+    pattern_ty p;
+    if (!cls) {
+        PyErr_SetString(PyExc_ValueError,
+                        "field 'cls' is required for MatchClass");
+        return NULL;
+    }
+    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
+    if (!p)
+        return NULL;
+    p->kind = MatchClass_kind;
+    p->v.MatchClass.cls = cls;
+    p->v.MatchClass.patterns = patterns;
+    p->v.MatchClass.kwd_attrs = kwd_attrs;
+    p->v.MatchClass.kwd_patterns = kwd_patterns;
+    p->lineno = lineno;
+    p->col_offset = col_offset;
+    p->end_lineno = end_lineno;
+    p->end_col_offset = end_col_offset;
+    return p;
+}
+
+pattern_ty
+_PyAST_MatchStar(identifier name, int lineno, int col_offset, int end_lineno,
+                 int end_col_offset, PyArena *arena)
+{
+    pattern_ty p;
+    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
+    if (!p)
+        return NULL;
+    p->kind = MatchStar_kind;
+    p->v.MatchStar.name = name;
+    p->lineno = lineno;
+    p->col_offset = col_offset;
+    p->end_lineno = end_lineno;
+    p->end_col_offset = end_col_offset;
+    return p;
+}
+
+pattern_ty
+_PyAST_MatchAs(pattern_ty pattern, identifier name, int lineno, int col_offset,
+               int end_lineno, int end_col_offset, PyArena *arena)
+{
+    pattern_ty p;
+    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
+    if (!p)
+        return NULL;
+    p->kind = MatchAs_kind;
+    p->v.MatchAs.pattern = pattern;
+    p->v.MatchAs.name = name;
+    p->lineno = lineno;
+    p->col_offset = col_offset;
+    p->end_lineno = end_lineno;
+    p->end_col_offset = end_col_offset;
+    return p;
+}
+
+pattern_ty
+_PyAST_MatchOr(asdl_pattern_seq * patterns, int lineno, int col_offset, int
+               end_lineno, int end_col_offset, PyArena *arena)
+{
+    pattern_ty p;
+    p = (pattern_ty)_PyArena_Malloc(arena, sizeof(*p));
+    if (!p)
+        return NULL;
+    p->kind = MatchOr_kind;
+    p->v.MatchOr.patterns = patterns;
+    p->lineno = lineno;
+    p->col_offset = col_offset;
+    p->end_lineno = end_lineno;
+    p->end_col_offset = end_col_offset;
+    return p;
+}
+
 type_ignore_ty
-TypeIgnore(int lineno, string tag, PyArena *arena)
+_PyAST_TypeIgnore(int lineno, string tag, PyArena *arena)
 {
     type_ignore_ty p;
     if (!tag) {
@@ -3362,7 +3556,7 @@
                         "field 'tag' is required for TypeIgnore");
         return NULL;
     }
-    p = (type_ignore_ty)PyArena_Malloc(arena, sizeof(*p));
+    p = (type_ignore_ty)_PyArena_Malloc(arena, sizeof(*p));
     if (!p)
         return NULL;
     p->kind = TypeIgnore_kind;
@@ -3373,7 +3567,7 @@
 
 
 PyObject*
-ast2obj_mod(astmodulestate *state, void* _o)
+ast2obj_mod(struct ast_state *state, void* _o)
 {
     mod_ty o = (mod_ty)_o;
     PyObject *result = NULL, *value = NULL;
@@ -3386,12 +3580,12 @@
         tp = (PyTypeObject *)state->Module_type;
         result = PyType_GenericNew(tp, NULL, NULL);
         if (!result) goto failed;
-        value = ast2obj_list(state, o->v.Module.body, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Module.body, ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->body, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.Module.type_ignores,
+        value = ast2obj_list(state, (asdl_seq*)o->v.Module.type_ignores,
                              ast2obj_type_ignore);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->type_ignores, value) == -1)
@@ -3402,7 +3596,8 @@
         tp = (PyTypeObject *)state->Interactive_type;
         result = PyType_GenericNew(tp, NULL, NULL);
         if (!result) goto failed;
-        value = ast2obj_list(state, o->v.Interactive.body, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Interactive.body,
+                             ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->body, value) == -1)
             goto failed;
@@ -3422,7 +3617,8 @@
         tp = (PyTypeObject *)state->FunctionType_type;
         result = PyType_GenericNew(tp, NULL, NULL);
         if (!result) goto failed;
-        value = ast2obj_list(state, o->v.FunctionType.argtypes, ast2obj_expr);
+        value = ast2obj_list(state, (asdl_seq*)o->v.FunctionType.argtypes,
+                             ast2obj_expr);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->argtypes, value) == -1)
             goto failed;
@@ -3442,7 +3638,7 @@
 }
 
 PyObject*
-ast2obj_stmt(astmodulestate *state, void* _o)
+ast2obj_stmt(struct ast_state *state, void* _o)
 {
     stmt_ty o = (stmt_ty)_o;
     PyObject *result = NULL, *value = NULL;
@@ -3465,12 +3661,13 @@
         if (PyObject_SetAttr(result, state->args, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.FunctionDef.body, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.FunctionDef.body,
+                             ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->body, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.FunctionDef.decorator_list,
+        value = ast2obj_list(state, (asdl_seq*)o->v.FunctionDef.decorator_list,
                              ast2obj_expr);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->decorator_list, value) == -1)
@@ -3501,12 +3698,14 @@
         if (PyObject_SetAttr(result, state->args, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.AsyncFunctionDef.body, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.AsyncFunctionDef.body,
+                             ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->body, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.AsyncFunctionDef.decorator_list,
+        value = ast2obj_list(state,
+                             (asdl_seq*)o->v.AsyncFunctionDef.decorator_list,
                              ast2obj_expr);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->decorator_list, value) == -1)
@@ -3532,22 +3731,26 @@
         if (PyObject_SetAttr(result, state->name, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.ClassDef.bases, ast2obj_expr);
+        value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.bases,
+                             ast2obj_expr);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->bases, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.ClassDef.keywords, ast2obj_keyword);
+        value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.keywords,
+                             ast2obj_keyword);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->keywords, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.ClassDef.body, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.body,
+                             ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->body, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.ClassDef.decorator_list, ast2obj_expr);
+        value = ast2obj_list(state, (asdl_seq*)o->v.ClassDef.decorator_list,
+                             ast2obj_expr);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->decorator_list, value) == -1)
             goto failed;
@@ -3567,7 +3770,8 @@
         tp = (PyTypeObject *)state->Delete_type;
         result = PyType_GenericNew(tp, NULL, NULL);
         if (!result) goto failed;
-        value = ast2obj_list(state, o->v.Delete.targets, ast2obj_expr);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Delete.targets,
+                             ast2obj_expr);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->targets, value) == -1)
             goto failed;
@@ -3577,7 +3781,8 @@
         tp = (PyTypeObject *)state->Assign_type;
         result = PyType_GenericNew(tp, NULL, NULL);
         if (!result) goto failed;
-        value = ast2obj_list(state, o->v.Assign.targets, ast2obj_expr);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Assign.targets,
+                             ast2obj_expr);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->targets, value) == -1)
             goto failed;
@@ -3652,12 +3857,12 @@
         if (PyObject_SetAttr(result, state->iter, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.For.body, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.For.body, ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->body, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.For.orelse, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.For.orelse, ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->orelse, value) == -1)
             goto failed;
@@ -3682,12 +3887,14 @@
         if (PyObject_SetAttr(result, state->iter, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.AsyncFor.body, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.AsyncFor.body,
+                             ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->body, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.AsyncFor.orelse, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.AsyncFor.orelse,
+                             ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->orelse, value) == -1)
             goto failed;
@@ -3707,12 +3914,12 @@
         if (PyObject_SetAttr(result, state->test, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.While.body, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.While.body, ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->body, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.While.orelse, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.While.orelse, ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->orelse, value) == -1)
             goto failed;
@@ -3727,12 +3934,12 @@
         if (PyObject_SetAttr(result, state->test, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.If.body, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.If.body, ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->body, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.If.orelse, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.If.orelse, ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->orelse, value) == -1)
             goto failed;
@@ -3742,12 +3949,13 @@
         tp = (PyTypeObject *)state->With_type;
         result = PyType_GenericNew(tp, NULL, NULL);
         if (!result) goto failed;
-        value = ast2obj_list(state, o->v.With.items, ast2obj_withitem);
+        value = ast2obj_list(state, (asdl_seq*)o->v.With.items,
+                             ast2obj_withitem);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->items, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.With.body, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.With.body, ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->body, value) == -1)
             goto failed;
@@ -3762,12 +3970,14 @@
         tp = (PyTypeObject *)state->AsyncWith_type;
         result = PyType_GenericNew(tp, NULL, NULL);
         if (!result) goto failed;
-        value = ast2obj_list(state, o->v.AsyncWith.items, ast2obj_withitem);
+        value = ast2obj_list(state, (asdl_seq*)o->v.AsyncWith.items,
+                             ast2obj_withitem);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->items, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.AsyncWith.body, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.AsyncWith.body,
+                             ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->body, value) == -1)
             goto failed;
@@ -3778,6 +3988,22 @@
             goto failed;
         Py_DECREF(value);
         break;
+    case Match_kind:
+        tp = (PyTypeObject *)state->Match_type;
+        result = PyType_GenericNew(tp, NULL, NULL);
+        if (!result) goto failed;
+        value = ast2obj_expr(state, o->v.Match.subject);
+        if (!value) goto failed;
+        if (PyObject_SetAttr(result, state->subject, value) == -1)
+            goto failed;
+        Py_DECREF(value);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Match.cases,
+                             ast2obj_match_case);
+        if (!value) goto failed;
+        if (PyObject_SetAttr(result, state->cases, value) == -1)
+            goto failed;
+        Py_DECREF(value);
+        break;
     case Raise_kind:
         tp = (PyTypeObject *)state->Raise_type;
         result = PyType_GenericNew(tp, NULL, NULL);
@@ -3797,22 +4023,24 @@
         tp = (PyTypeObject *)state->Try_type;
         result = PyType_GenericNew(tp, NULL, NULL);
         if (!result) goto failed;
-        value = ast2obj_list(state, o->v.Try.body, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Try.body, ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->body, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.Try.handlers, ast2obj_excepthandler);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Try.handlers,
+                             ast2obj_excepthandler);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->handlers, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.Try.orelse, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Try.orelse, ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->orelse, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.Try.finalbody, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Try.finalbody,
+                             ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->finalbody, value) == -1)
             goto failed;
@@ -3837,7 +4065,8 @@
         tp = (PyTypeObject *)state->Import_type;
         result = PyType_GenericNew(tp, NULL, NULL);
         if (!result) goto failed;
-        value = ast2obj_list(state, o->v.Import.names, ast2obj_alias);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Import.names,
+                             ast2obj_alias);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->names, value) == -1)
             goto failed;
@@ -3852,7 +4081,8 @@
         if (PyObject_SetAttr(result, state->module, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.ImportFrom.names, ast2obj_alias);
+        value = ast2obj_list(state, (asdl_seq*)o->v.ImportFrom.names,
+                             ast2obj_alias);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->names, value) == -1)
             goto failed;
@@ -3867,7 +4097,8 @@
         tp = (PyTypeObject *)state->Global_type;
         result = PyType_GenericNew(tp, NULL, NULL);
         if (!result) goto failed;
-        value = ast2obj_list(state, o->v.Global.names, ast2obj_identifier);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Global.names,
+                             ast2obj_identifier);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->names, value) == -1)
             goto failed;
@@ -3877,7 +4108,8 @@
         tp = (PyTypeObject *)state->Nonlocal_type;
         result = PyType_GenericNew(tp, NULL, NULL);
         if (!result) goto failed;
-        value = ast2obj_list(state, o->v.Nonlocal.names, ast2obj_identifier);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Nonlocal.names,
+                             ast2obj_identifier);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->names, value) == -1)
             goto failed;
@@ -3937,7 +4169,7 @@
 }
 
 PyObject*
-ast2obj_expr(astmodulestate *state, void* _o)
+ast2obj_expr(struct ast_state *state, void* _o)
 {
     expr_ty o = (expr_ty)_o;
     PyObject *result = NULL, *value = NULL;
@@ -3955,7 +4187,8 @@
         if (PyObject_SetAttr(result, state->op, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.BoolOp.values, ast2obj_expr);
+        value = ast2obj_list(state, (asdl_seq*)o->v.BoolOp.values,
+                             ast2obj_expr);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->values, value) == -1)
             goto failed;
@@ -4050,12 +4283,12 @@
         tp = (PyTypeObject *)state->Dict_type;
         result = PyType_GenericNew(tp, NULL, NULL);
         if (!result) goto failed;
-        value = ast2obj_list(state, o->v.Dict.keys, ast2obj_expr);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Dict.keys, ast2obj_expr);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->keys, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.Dict.values, ast2obj_expr);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Dict.values, ast2obj_expr);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->values, value) == -1)
             goto failed;
@@ -4065,7 +4298,7 @@
         tp = (PyTypeObject *)state->Set_type;
         result = PyType_GenericNew(tp, NULL, NULL);
         if (!result) goto failed;
-        value = ast2obj_list(state, o->v.Set.elts, ast2obj_expr);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Set.elts, ast2obj_expr);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->elts, value) == -1)
             goto failed;
@@ -4080,7 +4313,7 @@
         if (PyObject_SetAttr(result, state->elt, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.ListComp.generators,
+        value = ast2obj_list(state, (asdl_seq*)o->v.ListComp.generators,
                              ast2obj_comprehension);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->generators, value) == -1)
@@ -4096,7 +4329,7 @@
         if (PyObject_SetAttr(result, state->elt, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.SetComp.generators,
+        value = ast2obj_list(state, (asdl_seq*)o->v.SetComp.generators,
                              ast2obj_comprehension);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->generators, value) == -1)
@@ -4117,7 +4350,7 @@
         if (PyObject_SetAttr(result, state->value, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.DictComp.generators,
+        value = ast2obj_list(state, (asdl_seq*)o->v.DictComp.generators,
                              ast2obj_comprehension);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->generators, value) == -1)
@@ -4133,7 +4366,7 @@
         if (PyObject_SetAttr(result, state->elt, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.GeneratorExp.generators,
+        value = ast2obj_list(state, (asdl_seq*)o->v.GeneratorExp.generators,
                              ast2obj_comprehension);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->generators, value) == -1)
@@ -4190,7 +4423,8 @@
         if (PyObject_SetAttr(result, state->ops, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.Compare.comparators, ast2obj_expr);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Compare.comparators,
+                             ast2obj_expr);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->comparators, value) == -1)
             goto failed;
@@ -4205,12 +4439,13 @@
         if (PyObject_SetAttr(result, state->func, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.Call.args, ast2obj_expr);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Call.args, ast2obj_expr);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->args, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.Call.keywords, ast2obj_keyword);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Call.keywords,
+                             ast2obj_keyword);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->keywords, value) == -1)
             goto failed;
@@ -4240,7 +4475,8 @@
         tp = (PyTypeObject *)state->JoinedStr_type;
         result = PyType_GenericNew(tp, NULL, NULL);
         if (!result) goto failed;
-        value = ast2obj_list(state, o->v.JoinedStr.values, ast2obj_expr);
+        value = ast2obj_list(state, (asdl_seq*)o->v.JoinedStr.values,
+                             ast2obj_expr);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->values, value) == -1)
             goto failed;
@@ -4335,7 +4571,7 @@
         tp = (PyTypeObject *)state->List_type;
         result = PyType_GenericNew(tp, NULL, NULL);
         if (!result) goto failed;
-        value = ast2obj_list(state, o->v.List.elts, ast2obj_expr);
+        value = ast2obj_list(state, (asdl_seq*)o->v.List.elts, ast2obj_expr);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->elts, value) == -1)
             goto failed;
@@ -4350,7 +4586,7 @@
         tp = (PyTypeObject *)state->Tuple_type;
         result = PyType_GenericNew(tp, NULL, NULL);
         if (!result) goto failed;
-        value = ast2obj_list(state, o->v.Tuple.elts, ast2obj_expr);
+        value = ast2obj_list(state, (asdl_seq*)o->v.Tuple.elts, ast2obj_expr);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->elts, value) == -1)
             goto failed;
@@ -4409,7 +4645,7 @@
     return NULL;
 }
 
-PyObject* ast2obj_expr_context(astmodulestate *state, expr_context_ty o)
+PyObject* ast2obj_expr_context(struct ast_state *state, expr_context_ty o)
 {
     switch(o) {
         case Load:
@@ -4424,7 +4660,7 @@
     }
     Py_UNREACHABLE();
 }
-PyObject* ast2obj_boolop(astmodulestate *state, boolop_ty o)
+PyObject* ast2obj_boolop(struct ast_state *state, boolop_ty o)
 {
     switch(o) {
         case And:
@@ -4436,7 +4672,7 @@
     }
     Py_UNREACHABLE();
 }
-PyObject* ast2obj_operator(astmodulestate *state, operator_ty o)
+PyObject* ast2obj_operator(struct ast_state *state, operator_ty o)
 {
     switch(o) {
         case Add:
@@ -4481,7 +4717,7 @@
     }
     Py_UNREACHABLE();
 }
-PyObject* ast2obj_unaryop(astmodulestate *state, unaryop_ty o)
+PyObject* ast2obj_unaryop(struct ast_state *state, unaryop_ty o)
 {
     switch(o) {
         case Invert:
@@ -4499,7 +4735,7 @@
     }
     Py_UNREACHABLE();
 }
-PyObject* ast2obj_cmpop(astmodulestate *state, cmpop_ty o)
+PyObject* ast2obj_cmpop(struct ast_state *state, cmpop_ty o)
 {
     switch(o) {
         case Eq:
@@ -4536,7 +4772,7 @@
     Py_UNREACHABLE();
 }
 PyObject*
-ast2obj_comprehension(astmodulestate *state, void* _o)
+ast2obj_comprehension(struct ast_state *state, void* _o)
 {
     comprehension_ty o = (comprehension_ty)_o;
     PyObject *result = NULL, *value = NULL;
@@ -4557,7 +4793,7 @@
     if (PyObject_SetAttr(result, state->iter, value) == -1)
         goto failed;
     Py_DECREF(value);
-    value = ast2obj_list(state, o->ifs, ast2obj_expr);
+    value = ast2obj_list(state, (asdl_seq*)o->ifs, ast2obj_expr);
     if (!value) goto failed;
     if (PyObject_SetAttr(result, state->ifs, value) == -1)
         goto failed;
@@ -4575,7 +4811,7 @@
 }
 
 PyObject*
-ast2obj_excepthandler(astmodulestate *state, void* _o)
+ast2obj_excepthandler(struct ast_state *state, void* _o)
 {
     excepthandler_ty o = (excepthandler_ty)_o;
     PyObject *result = NULL, *value = NULL;
@@ -4598,7 +4834,8 @@
         if (PyObject_SetAttr(result, state->name, value) == -1)
             goto failed;
         Py_DECREF(value);
-        value = ast2obj_list(state, o->v.ExceptHandler.body, ast2obj_stmt);
+        value = ast2obj_list(state, (asdl_seq*)o->v.ExceptHandler.body,
+                             ast2obj_stmt);
         if (!value) goto failed;
         if (PyObject_SetAttr(result, state->body, value) == -1)
             goto failed;
@@ -4633,7 +4870,7 @@
 }
 
 PyObject*
-ast2obj_arguments(astmodulestate *state, void* _o)
+ast2obj_arguments(struct ast_state *state, void* _o)
 {
     arguments_ty o = (arguments_ty)_o;
     PyObject *result = NULL, *value = NULL;
@@ -4644,12 +4881,12 @@
     tp = (PyTypeObject *)state->arguments_type;
     result = PyType_GenericNew(tp, NULL, NULL);
     if (!result) return NULL;
-    value = ast2obj_list(state, o->posonlyargs, ast2obj_arg);
+    value = ast2obj_list(state, (asdl_seq*)o->posonlyargs, ast2obj_arg);
     if (!value) goto failed;
     if (PyObject_SetAttr(result, state->posonlyargs, value) == -1)
         goto failed;
     Py_DECREF(value);
-    value = ast2obj_list(state, o->args, ast2obj_arg);
+    value = ast2obj_list(state, (asdl_seq*)o->args, ast2obj_arg);
     if (!value) goto failed;
     if (PyObject_SetAttr(result, state->args, value) == -1)
         goto failed;
@@ -4659,12 +4896,12 @@
     if (PyObject_SetAttr(result, state->vararg, value) == -1)
         goto failed;
     Py_DECREF(value);
-    value = ast2obj_list(state, o->kwonlyargs, ast2obj_arg);
+    value = ast2obj_list(state, (asdl_seq*)o->kwonlyargs, ast2obj_arg);
     if (!value) goto failed;
     if (PyObject_SetAttr(result, state->kwonlyargs, value) == -1)
         goto failed;
     Py_DECREF(value);
-    value = ast2obj_list(state, o->kw_defaults, ast2obj_expr);
+    value = ast2obj_list(state, (asdl_seq*)o->kw_defaults, ast2obj_expr);
     if (!value) goto failed;
     if (PyObject_SetAttr(result, state->kw_defaults, value) == -1)
         goto failed;
@@ -4674,7 +4911,7 @@
     if (PyObject_SetAttr(result, state->kwarg, value) == -1)
         goto failed;
     Py_DECREF(value);
-    value = ast2obj_list(state, o->defaults, ast2obj_expr);
+    value = ast2obj_list(state, (asdl_seq*)o->defaults, ast2obj_expr);
     if (!value) goto failed;
     if (PyObject_SetAttr(result, state->defaults, value) == -1)
         goto failed;
@@ -4687,7 +4924,7 @@
 }
 
 PyObject*
-ast2obj_arg(astmodulestate *state, void* _o)
+ast2obj_arg(struct ast_state *state, void* _o)
 {
     arg_ty o = (arg_ty)_o;
     PyObject *result = NULL, *value = NULL;
@@ -4741,7 +4978,7 @@
 }
 
 PyObject*
-ast2obj_keyword(astmodulestate *state, void* _o)
+ast2obj_keyword(struct ast_state *state, void* _o)
 {
     keyword_ty o = (keyword_ty)_o;
     PyObject *result = NULL, *value = NULL;
@@ -4790,7 +5027,7 @@
 }
 
 PyObject*
-ast2obj_alias(astmodulestate *state, void* _o)
+ast2obj_alias(struct ast_state *state, void* _o)
 {
     alias_ty o = (alias_ty)_o;
     PyObject *result = NULL, *value = NULL;
@@ -4811,6 +5048,26 @@
     if (PyObject_SetAttr(result, state->asname, value) == -1)
         goto failed;
     Py_DECREF(value);
+    value = ast2obj_int(state, o->lineno);
+    if (!value) goto failed;
+    if (PyObject_SetAttr(result, state->lineno, value) < 0)
+        goto failed;
+    Py_DECREF(value);
+    value = ast2obj_int(state, o->col_offset);
+    if (!value) goto failed;
+    if (PyObject_SetAttr(result, state->col_offset, value) < 0)
+        goto failed;
+    Py_DECREF(value);
+    value = ast2obj_int(state, o->end_lineno);
+    if (!value) goto failed;
+    if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
+        goto failed;
+    Py_DECREF(value);
+    value = ast2obj_int(state, o->end_col_offset);
+    if (!value) goto failed;
+    if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
+        goto failed;
+    Py_DECREF(value);
     return result;
 failed:
     Py_XDECREF(value);
@@ -4819,7 +5076,7 @@
 }
 
 PyObject*
-ast2obj_withitem(astmodulestate *state, void* _o)
+ast2obj_withitem(struct ast_state *state, void* _o)
 {
     withitem_ty o = (withitem_ty)_o;
     PyObject *result = NULL, *value = NULL;
@@ -4848,7 +5105,196 @@
 }
 
 PyObject*
-ast2obj_type_ignore(astmodulestate *state, void* _o)
+ast2obj_match_case(struct ast_state *state, void* _o)
+{
+    match_case_ty o = (match_case_ty)_o;
+    PyObject *result = NULL, *value = NULL;
+    PyTypeObject *tp;
+    if (!o) {
+        Py_RETURN_NONE;
+    }
+    tp = (PyTypeObject *)state->match_case_type;
+    result = PyType_GenericNew(tp, NULL, NULL);
+    if (!result) return NULL;
+    value = ast2obj_pattern(state, o->pattern);
+    if (!value) goto failed;
+    if (PyObject_SetAttr(result, state->pattern, value) == -1)
+        goto failed;
+    Py_DECREF(value);
+    value = ast2obj_expr(state, o->guard);
+    if (!value) goto failed;
+    if (PyObject_SetAttr(result, state->guard, value) == -1)
+        goto failed;
+    Py_DECREF(value);
+    value = ast2obj_list(state, (asdl_seq*)o->body, ast2obj_stmt);
+    if (!value) goto failed;
+    if (PyObject_SetAttr(result, state->body, value) == -1)
+        goto failed;
+    Py_DECREF(value);
+    return result;
+failed:
+    Py_XDECREF(value);
+    Py_XDECREF(result);
+    return NULL;
+}
+
+PyObject*
+ast2obj_pattern(struct ast_state *state, void* _o)
+{
+    pattern_ty o = (pattern_ty)_o;
+    PyObject *result = NULL, *value = NULL;
+    PyTypeObject *tp;
+    if (!o) {
+        Py_RETURN_NONE;
+    }
+    switch (o->kind) {
+    case MatchValue_kind:
+        tp = (PyTypeObject *)state->MatchValue_type;
+        result = PyType_GenericNew(tp, NULL, NULL);
+        if (!result) goto failed;
+        value = ast2obj_expr(state, o->v.MatchValue.value);
+        if (!value) goto failed;
+        if (PyObject_SetAttr(result, state->value, value) == -1)
+            goto failed;
+        Py_DECREF(value);
+        break;
+    case MatchSingleton_kind:
+        tp = (PyTypeObject *)state->MatchSingleton_type;
+        result = PyType_GenericNew(tp, NULL, NULL);
+        if (!result) goto failed;
+        value = ast2obj_constant(state, o->v.MatchSingleton.value);
+        if (!value) goto failed;
+        if (PyObject_SetAttr(result, state->value, value) == -1)
+            goto failed;
+        Py_DECREF(value);
+        break;
+    case MatchSequence_kind:
+        tp = (PyTypeObject *)state->MatchSequence_type;
+        result = PyType_GenericNew(tp, NULL, NULL);
+        if (!result) goto failed;
+        value = ast2obj_list(state, (asdl_seq*)o->v.MatchSequence.patterns,
+                             ast2obj_pattern);
+        if (!value) goto failed;
+        if (PyObject_SetAttr(result, state->patterns, value) == -1)
+            goto failed;
+        Py_DECREF(value);
+        break;
+    case MatchMapping_kind:
+        tp = (PyTypeObject *)state->MatchMapping_type;
+        result = PyType_GenericNew(tp, NULL, NULL);
+        if (!result) goto failed;
+        value = ast2obj_list(state, (asdl_seq*)o->v.MatchMapping.keys,
+                             ast2obj_expr);
+        if (!value) goto failed;
+        if (PyObject_SetAttr(result, state->keys, value) == -1)
+            goto failed;
+        Py_DECREF(value);
+        value = ast2obj_list(state, (asdl_seq*)o->v.MatchMapping.patterns,
+                             ast2obj_pattern);
+        if (!value) goto failed;
+        if (PyObject_SetAttr(result, state->patterns, value) == -1)
+            goto failed;
+        Py_DECREF(value);
+        value = ast2obj_identifier(state, o->v.MatchMapping.rest);
+        if (!value) goto failed;
+        if (PyObject_SetAttr(result, state->rest, value) == -1)
+            goto failed;
+        Py_DECREF(value);
+        break;
+    case MatchClass_kind:
+        tp = (PyTypeObject *)state->MatchClass_type;
+        result = PyType_GenericNew(tp, NULL, NULL);
+        if (!result) goto failed;
+        value = ast2obj_expr(state, o->v.MatchClass.cls);
+        if (!value) goto failed;
+        if (PyObject_SetAttr(result, state->cls, value) == -1)
+            goto failed;
+        Py_DECREF(value);
+        value = ast2obj_list(state, (asdl_seq*)o->v.MatchClass.patterns,
+                             ast2obj_pattern);
+        if (!value) goto failed;
+        if (PyObject_SetAttr(result, state->patterns, value) == -1)
+            goto failed;
+        Py_DECREF(value);
+        value = ast2obj_list(state, (asdl_seq*)o->v.MatchClass.kwd_attrs,
+                             ast2obj_identifier);
+        if (!value) goto failed;
+        if (PyObject_SetAttr(result, state->kwd_attrs, value) == -1)
+            goto failed;
+        Py_DECREF(value);
+        value = ast2obj_list(state, (asdl_seq*)o->v.MatchClass.kwd_patterns,
+                             ast2obj_pattern);
+        if (!value) goto failed;
+        if (PyObject_SetAttr(result, state->kwd_patterns, value) == -1)
+            goto failed;
+        Py_DECREF(value);
+        break;
+    case MatchStar_kind:
+        tp = (PyTypeObject *)state->MatchStar_type;
+        result = PyType_GenericNew(tp, NULL, NULL);
+        if (!result) goto failed;
+        value = ast2obj_identifier(state, o->v.MatchStar.name);
+        if (!value) goto failed;
+        if (PyObject_SetAttr(result, state->name, value) == -1)
+            goto failed;
+        Py_DECREF(value);
+        break;
+    case MatchAs_kind:
+        tp = (PyTypeObject *)state->MatchAs_type;
+        result = PyType_GenericNew(tp, NULL, NULL);
+        if (!result) goto failed;
+        value = ast2obj_pattern(state, o->v.MatchAs.pattern);
+        if (!value) goto failed;
+        if (PyObject_SetAttr(result, state->pattern, value) == -1)
+            goto failed;
+        Py_DECREF(value);
+        value = ast2obj_identifier(state, o->v.MatchAs.name);
+        if (!value) goto failed;
+        if (PyObject_SetAttr(result, state->name, value) == -1)
+            goto failed;
+        Py_DECREF(value);
+        break;
+    case MatchOr_kind:
+        tp = (PyTypeObject *)state->MatchOr_type;
+        result = PyType_GenericNew(tp, NULL, NULL);
+        if (!result) goto failed;
+        value = ast2obj_list(state, (asdl_seq*)o->v.MatchOr.patterns,
+                             ast2obj_pattern);
+        if (!value) goto failed;
+        if (PyObject_SetAttr(result, state->patterns, value) == -1)
+            goto failed;
+        Py_DECREF(value);
+        break;
+    }
+    value = ast2obj_int(state, o->lineno);
+    if (!value) goto failed;
+    if (PyObject_SetAttr(result, state->lineno, value) < 0)
+        goto failed;
+    Py_DECREF(value);
+    value = ast2obj_int(state, o->col_offset);
+    if (!value) goto failed;
+    if (PyObject_SetAttr(result, state->col_offset, value) < 0)
+        goto failed;
+    Py_DECREF(value);
+    value = ast2obj_int(state, o->end_lineno);
+    if (!value) goto failed;
+    if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
+        goto failed;
+    Py_DECREF(value);
+    value = ast2obj_int(state, o->end_col_offset);
+    if (!value) goto failed;
+    if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
+        goto failed;
+    Py_DECREF(value);
+    return result;
+failed:
+    Py_XDECREF(value);
+    Py_XDECREF(result);
+    return NULL;
+}
+
+PyObject*
+ast2obj_type_ignore(struct ast_state *state, void* _o)
 {
     type_ignore_ty o = (type_ignore_ty)_o;
     PyObject *result = NULL, *value = NULL;
@@ -4882,7 +5328,7 @@
 
 
 int
-obj2ast_mod(astmodulestate *state, PyObject* obj, mod_ty* out, PyArena* arena)
+obj2ast_mod(struct ast_state *state, PyObject* obj, mod_ty* out, PyArena* arena)
 {
     int isinstance;
 
@@ -4899,8 +5345,8 @@
         return 1;
     }
     if (isinstance) {
-        asdl_seq* body;
-        asdl_seq* type_ignores;
+        asdl_stmt_seq* body;
+        asdl_type_ignore_seq* type_ignores;
 
         if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) {
             return 1;
@@ -4918,13 +5364,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            body = _Py_asdl_seq_new(len, arena);
+            body = _Py_asdl_stmt_seq_new(len, arena);
             if (body == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'Module' node")) {
+                    goto failed;
+                }
                 res = obj2ast_stmt(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -4951,13 +5401,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            type_ignores = _Py_asdl_seq_new(len, arena);
+            type_ignores = _Py_asdl_type_ignore_seq_new(len, arena);
             if (type_ignores == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 type_ignore_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'Module' node")) {
+                    goto failed;
+                }
                 res = obj2ast_type_ignore(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -4968,7 +5422,7 @@
             }
             Py_CLEAR(tmp);
         }
-        *out = Module(body, type_ignores, arena);
+        *out = _PyAST_Module(body, type_ignores, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -4978,7 +5432,7 @@
         return 1;
     }
     if (isinstance) {
-        asdl_seq* body;
+        asdl_stmt_seq* body;
 
         if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) {
             return 1;
@@ -4996,13 +5450,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            body = _Py_asdl_seq_new(len, arena);
+            body = _Py_asdl_stmt_seq_new(len, arena);
             if (body == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'Interactive' node")) {
+                    goto failed;
+                }
                 res = obj2ast_stmt(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -5013,7 +5471,7 @@
             }
             Py_CLEAR(tmp);
         }
-        *out = Interactive(body, arena);
+        *out = _PyAST_Interactive(body, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -5034,11 +5492,15 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'Expression' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &body, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
-        *out = Expression(body, arena);
+        *out = _PyAST_Expression(body, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -5048,7 +5510,7 @@
         return 1;
     }
     if (isinstance) {
-        asdl_seq* argtypes;
+        asdl_expr_seq* argtypes;
         expr_ty returns;
 
         if (_PyObject_LookupAttr(obj, state->argtypes, &tmp) < 0) {
@@ -5067,13 +5529,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            argtypes = _Py_asdl_seq_new(len, arena);
+            argtypes = _Py_asdl_expr_seq_new(len, arena);
             if (argtypes == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 expr_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'FunctionType' node")) {
+                    goto failed;
+                }
                 res = obj2ast_expr(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -5093,11 +5559,15 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'FunctionType' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &returns, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
-        *out = FunctionType(argtypes, returns, arena);
+        *out = _PyAST_FunctionType(argtypes, returns, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -5109,7 +5579,8 @@
 }
 
 int
-obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
+obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena*
+             arena)
 {
     int isinstance;
 
@@ -5133,7 +5604,11 @@
     }
     else {
         int res;
+        if (Py_EnterRecursiveCall(" while traversing 'stmt' node")) {
+            goto failed;
+        }
         res = obj2ast_int(state, tmp, &lineno, arena);
+        Py_LeaveRecursiveCall();
         if (res != 0) goto failed;
         Py_CLEAR(tmp);
     }
@@ -5146,7 +5621,11 @@
     }
     else {
         int res;
+        if (Py_EnterRecursiveCall(" while traversing 'stmt' node")) {
+            goto failed;
+        }
         res = obj2ast_int(state, tmp, &col_offset, arena);
+        Py_LeaveRecursiveCall();
         if (res != 0) goto failed;
         Py_CLEAR(tmp);
     }
@@ -5159,7 +5638,11 @@
     }
     else {
         int res;
+        if (Py_EnterRecursiveCall(" while traversing 'stmt' node")) {
+            goto failed;
+        }
         res = obj2ast_int(state, tmp, &end_lineno, arena);
+        Py_LeaveRecursiveCall();
         if (res != 0) goto failed;
         Py_CLEAR(tmp);
     }
@@ -5172,7 +5655,11 @@
     }
     else {
         int res;
+        if (Py_EnterRecursiveCall(" while traversing 'stmt' node")) {
+            goto failed;
+        }
         res = obj2ast_int(state, tmp, &end_col_offset, arena);
+        Py_LeaveRecursiveCall();
         if (res != 0) goto failed;
         Py_CLEAR(tmp);
     }
@@ -5184,8 +5671,8 @@
     if (isinstance) {
         identifier name;
         arguments_ty args;
-        asdl_seq* body;
-        asdl_seq* decorator_list;
+        asdl_stmt_seq* body;
+        asdl_expr_seq* decorator_list;
         expr_ty returns;
         string type_comment;
 
@@ -5198,7 +5685,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'FunctionDef' node")) {
+                goto failed;
+            }
             res = obj2ast_identifier(state, tmp, &name, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -5211,7 +5702,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'FunctionDef' node")) {
+                goto failed;
+            }
             res = obj2ast_arguments(state, tmp, &args, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -5231,13 +5726,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            body = _Py_asdl_seq_new(len, arena);
+            body = _Py_asdl_stmt_seq_new(len, arena);
             if (body == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'FunctionDef' node")) {
+                    goto failed;
+                }
                 res = obj2ast_stmt(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -5264,13 +5763,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            decorator_list = _Py_asdl_seq_new(len, arena);
+            decorator_list = _Py_asdl_expr_seq_new(len, arena);
             if (decorator_list == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 expr_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'FunctionDef' node")) {
+                    goto failed;
+                }
                 res = obj2ast_expr(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -5290,7 +5793,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'FunctionDef' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &returns, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -5303,13 +5810,17 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'FunctionDef' node")) {
+                goto failed;
+            }
             res = obj2ast_string(state, tmp, &type_comment, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
-        *out = FunctionDef(name, args, body, decorator_list, returns,
-                           type_comment, lineno, col_offset, end_lineno,
-                           end_col_offset, arena);
+        *out = _PyAST_FunctionDef(name, args, body, decorator_list, returns,
+                                  type_comment, lineno, col_offset, end_lineno,
+                                  end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -5321,8 +5832,8 @@
     if (isinstance) {
         identifier name;
         arguments_ty args;
-        asdl_seq* body;
-        asdl_seq* decorator_list;
+        asdl_stmt_seq* body;
+        asdl_expr_seq* decorator_list;
         expr_ty returns;
         string type_comment;
 
@@ -5335,7 +5846,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'AsyncFunctionDef' node")) {
+                goto failed;
+            }
             res = obj2ast_identifier(state, tmp, &name, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -5348,7 +5863,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'AsyncFunctionDef' node")) {
+                goto failed;
+            }
             res = obj2ast_arguments(state, tmp, &args, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -5368,13 +5887,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            body = _Py_asdl_seq_new(len, arena);
+            body = _Py_asdl_stmt_seq_new(len, arena);
             if (body == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'AsyncFunctionDef' node")) {
+                    goto failed;
+                }
                 res = obj2ast_stmt(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -5401,13 +5924,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            decorator_list = _Py_asdl_seq_new(len, arena);
+            decorator_list = _Py_asdl_expr_seq_new(len, arena);
             if (decorator_list == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 expr_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'AsyncFunctionDef' node")) {
+                    goto failed;
+                }
                 res = obj2ast_expr(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -5427,7 +5954,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'AsyncFunctionDef' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &returns, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -5440,13 +5971,18 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'AsyncFunctionDef' node")) {
+                goto failed;
+            }
             res = obj2ast_string(state, tmp, &type_comment, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
-        *out = AsyncFunctionDef(name, args, body, decorator_list, returns,
-                                type_comment, lineno, col_offset, end_lineno,
-                                end_col_offset, arena);
+        *out = _PyAST_AsyncFunctionDef(name, args, body, decorator_list,
+                                       returns, type_comment, lineno,
+                                       col_offset, end_lineno, end_col_offset,
+                                       arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -5457,10 +5993,10 @@
     }
     if (isinstance) {
         identifier name;
-        asdl_seq* bases;
-        asdl_seq* keywords;
-        asdl_seq* body;
-        asdl_seq* decorator_list;
+        asdl_expr_seq* bases;
+        asdl_keyword_seq* keywords;
+        asdl_stmt_seq* body;
+        asdl_expr_seq* decorator_list;
 
         if (_PyObject_LookupAttr(obj, state->name, &tmp) < 0) {
             return 1;
@@ -5471,7 +6007,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'ClassDef' node")) {
+                goto failed;
+            }
             res = obj2ast_identifier(state, tmp, &name, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -5491,13 +6031,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            bases = _Py_asdl_seq_new(len, arena);
+            bases = _Py_asdl_expr_seq_new(len, arena);
             if (bases == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 expr_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'ClassDef' node")) {
+                    goto failed;
+                }
                 res = obj2ast_expr(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -5524,13 +6068,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            keywords = _Py_asdl_seq_new(len, arena);
+            keywords = _Py_asdl_keyword_seq_new(len, arena);
             if (keywords == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 keyword_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'ClassDef' node")) {
+                    goto failed;
+                }
                 res = obj2ast_keyword(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -5557,13 +6105,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            body = _Py_asdl_seq_new(len, arena);
+            body = _Py_asdl_stmt_seq_new(len, arena);
             if (body == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'ClassDef' node")) {
+                    goto failed;
+                }
                 res = obj2ast_stmt(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -5590,13 +6142,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            decorator_list = _Py_asdl_seq_new(len, arena);
+            decorator_list = _Py_asdl_expr_seq_new(len, arena);
             if (decorator_list == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 expr_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'ClassDef' node")) {
+                    goto failed;
+                }
                 res = obj2ast_expr(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -5607,8 +6163,9 @@
             }
             Py_CLEAR(tmp);
         }
-        *out = ClassDef(name, bases, keywords, body, decorator_list, lineno,
-                        col_offset, end_lineno, end_col_offset, arena);
+        *out = _PyAST_ClassDef(name, bases, keywords, body, decorator_list,
+                               lineno, col_offset, end_lineno, end_col_offset,
+                               arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -5629,12 +6186,16 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'Return' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &value, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
-        *out = Return(value, lineno, col_offset, end_lineno, end_col_offset,
-                      arena);
+        *out = _PyAST_Return(value, lineno, col_offset, end_lineno,
+                             end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -5644,7 +6205,7 @@
         return 1;
     }
     if (isinstance) {
-        asdl_seq* targets;
+        asdl_expr_seq* targets;
 
         if (_PyObject_LookupAttr(obj, state->targets, &tmp) < 0) {
             return 1;
@@ -5662,13 +6223,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            targets = _Py_asdl_seq_new(len, arena);
+            targets = _Py_asdl_expr_seq_new(len, arena);
             if (targets == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 expr_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'Delete' node")) {
+                    goto failed;
+                }
                 res = obj2ast_expr(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -5679,8 +6244,8 @@
             }
             Py_CLEAR(tmp);
         }
-        *out = Delete(targets, lineno, col_offset, end_lineno, end_col_offset,
-                      arena);
+        *out = _PyAST_Delete(targets, lineno, col_offset, end_lineno,
+                             end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -5690,7 +6255,7 @@
         return 1;
     }
     if (isinstance) {
-        asdl_seq* targets;
+        asdl_expr_seq* targets;
         expr_ty value;
         string type_comment;
 
@@ -5710,13 +6275,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            targets = _Py_asdl_seq_new(len, arena);
+            targets = _Py_asdl_expr_seq_new(len, arena);
             if (targets == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 expr_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'Assign' node")) {
+                    goto failed;
+                }
                 res = obj2ast_expr(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -5736,7 +6305,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'Assign' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &value, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -5749,12 +6322,16 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'Assign' node")) {
+                goto failed;
+            }
             res = obj2ast_string(state, tmp, &type_comment, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
-        *out = Assign(targets, value, type_comment, lineno, col_offset,
-                      end_lineno, end_col_offset, arena);
+        *out = _PyAST_Assign(targets, value, type_comment, lineno, col_offset,
+                             end_lineno, end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -5777,7 +6354,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'AugAssign' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &target, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -5790,7 +6371,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'AugAssign' node")) {
+                goto failed;
+            }
             res = obj2ast_operator(state, tmp, &op, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -5803,12 +6388,16 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'AugAssign' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &value, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
-        *out = AugAssign(target, op, value, lineno, col_offset, end_lineno,
-                         end_col_offset, arena);
+        *out = _PyAST_AugAssign(target, op, value, lineno, col_offset,
+                                end_lineno, end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -5832,7 +6421,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'AnnAssign' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &target, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -5845,7 +6438,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'AnnAssign' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &annotation, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -5858,7 +6455,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'AnnAssign' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &value, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -5871,12 +6472,16 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'AnnAssign' node")) {
+                goto failed;
+            }
             res = obj2ast_int(state, tmp, &simple, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
-        *out = AnnAssign(target, annotation, value, simple, lineno, col_offset,
-                         end_lineno, end_col_offset, arena);
+        *out = _PyAST_AnnAssign(target, annotation, value, simple, lineno,
+                                col_offset, end_lineno, end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -5888,8 +6493,8 @@
     if (isinstance) {
         expr_ty target;
         expr_ty iter;
-        asdl_seq* body;
-        asdl_seq* orelse;
+        asdl_stmt_seq* body;
+        asdl_stmt_seq* orelse;
         string type_comment;
 
         if (_PyObject_LookupAttr(obj, state->target, &tmp) < 0) {
@@ -5901,7 +6506,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'For' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &target, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -5914,7 +6523,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'For' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &iter, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -5934,13 +6547,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            body = _Py_asdl_seq_new(len, arena);
+            body = _Py_asdl_stmt_seq_new(len, arena);
             if (body == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'For' node")) {
+                    goto failed;
+                }
                 res = obj2ast_stmt(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -5967,13 +6584,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            orelse = _Py_asdl_seq_new(len, arena);
+            orelse = _Py_asdl_stmt_seq_new(len, arena);
             if (orelse == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'For' node")) {
+                    goto failed;
+                }
                 res = obj2ast_stmt(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -5993,12 +6614,16 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'For' node")) {
+                goto failed;
+            }
             res = obj2ast_string(state, tmp, &type_comment, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
-        *out = For(target, iter, body, orelse, type_comment, lineno,
-                   col_offset, end_lineno, end_col_offset, arena);
+        *out = _PyAST_For(target, iter, body, orelse, type_comment, lineno,
+                          col_offset, end_lineno, end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -6010,8 +6635,8 @@
     if (isinstance) {
         expr_ty target;
         expr_ty iter;
-        asdl_seq* body;
-        asdl_seq* orelse;
+        asdl_stmt_seq* body;
+        asdl_stmt_seq* orelse;
         string type_comment;
 
         if (_PyObject_LookupAttr(obj, state->target, &tmp) < 0) {
@@ -6023,7 +6648,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'AsyncFor' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &target, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -6036,7 +6665,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'AsyncFor' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &iter, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -6056,13 +6689,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            body = _Py_asdl_seq_new(len, arena);
+            body = _Py_asdl_stmt_seq_new(len, arena);
             if (body == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'AsyncFor' node")) {
+                    goto failed;
+                }
                 res = obj2ast_stmt(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -6089,13 +6726,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            orelse = _Py_asdl_seq_new(len, arena);
+            orelse = _Py_asdl_stmt_seq_new(len, arena);
             if (orelse == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'AsyncFor' node")) {
+                    goto failed;
+                }
                 res = obj2ast_stmt(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -6115,12 +6756,17 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'AsyncFor' node")) {
+                goto failed;
+            }
             res = obj2ast_string(state, tmp, &type_comment, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
-        *out = AsyncFor(target, iter, body, orelse, type_comment, lineno,
-                        col_offset, end_lineno, end_col_offset, arena);
+        *out = _PyAST_AsyncFor(target, iter, body, orelse, type_comment,
+                               lineno, col_offset, end_lineno, end_col_offset,
+                               arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -6131,8 +6777,8 @@
     }
     if (isinstance) {
         expr_ty test;
-        asdl_seq* body;
-        asdl_seq* orelse;
+        asdl_stmt_seq* body;
+        asdl_stmt_seq* orelse;
 
         if (_PyObject_LookupAttr(obj, state->test, &tmp) < 0) {
             return 1;
@@ -6143,7 +6789,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'While' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &test, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -6163,13 +6813,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            body = _Py_asdl_seq_new(len, arena);
+            body = _Py_asdl_stmt_seq_new(len, arena);
             if (body == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'While' node")) {
+                    goto failed;
+                }
                 res = obj2ast_stmt(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -6196,13 +6850,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            orelse = _Py_asdl_seq_new(len, arena);
+            orelse = _Py_asdl_stmt_seq_new(len, arena);
             if (orelse == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'While' node")) {
+                    goto failed;
+                }
                 res = obj2ast_stmt(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -6213,8 +6871,8 @@
             }
             Py_CLEAR(tmp);
         }
-        *out = While(test, body, orelse, lineno, col_offset, end_lineno,
-                     end_col_offset, arena);
+        *out = _PyAST_While(test, body, orelse, lineno, col_offset, end_lineno,
+                            end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -6225,8 +6883,8 @@
     }
     if (isinstance) {
         expr_ty test;
-        asdl_seq* body;
-        asdl_seq* orelse;
+        asdl_stmt_seq* body;
+        asdl_stmt_seq* orelse;
 
         if (_PyObject_LookupAttr(obj, state->test, &tmp) < 0) {
             return 1;
@@ -6237,7 +6895,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'If' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &test, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -6257,13 +6919,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            body = _Py_asdl_seq_new(len, arena);
+            body = _Py_asdl_stmt_seq_new(len, arena);
             if (body == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'If' node")) {
+                    goto failed;
+                }
                 res = obj2ast_stmt(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -6290,13 +6956,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            orelse = _Py_asdl_seq_new(len, arena);
+            orelse = _Py_asdl_stmt_seq_new(len, arena);
             if (orelse == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'If' node")) {
+                    goto failed;
+                }
                 res = obj2ast_stmt(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -6307,8 +6977,8 @@
             }
             Py_CLEAR(tmp);
         }
-        *out = If(test, body, orelse, lineno, col_offset, end_lineno,
-                  end_col_offset, arena);
+        *out = _PyAST_If(test, body, orelse, lineno, col_offset, end_lineno,
+                         end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -6318,8 +6988,8 @@
         return 1;
     }
     if (isinstance) {
-        asdl_seq* items;
-        asdl_seq* body;
+        asdl_withitem_seq* items;
+        asdl_stmt_seq* body;
         string type_comment;
 
         if (_PyObject_LookupAttr(obj, state->items, &tmp) < 0) {
@@ -6338,13 +7008,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            items = _Py_asdl_seq_new(len, arena);
+            items = _Py_asdl_withitem_seq_new(len, arena);
             if (items == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 withitem_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'With' node")) {
+                    goto failed;
+                }
                 res = obj2ast_withitem(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -6371,13 +7045,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            body = _Py_asdl_seq_new(len, arena);
+            body = _Py_asdl_stmt_seq_new(len, arena);
             if (body == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'With' node")) {
+                    goto failed;
+                }
                 res = obj2ast_stmt(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -6397,12 +7075,16 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'With' node")) {
+                goto failed;
+            }
             res = obj2ast_string(state, tmp, &type_comment, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
-        *out = With(items, body, type_comment, lineno, col_offset, end_lineno,
-                    end_col_offset, arena);
+        *out = _PyAST_With(items, body, type_comment, lineno, col_offset,
+                           end_lineno, end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -6412,8 +7094,8 @@
         return 1;
     }
     if (isinstance) {
-        asdl_seq* items;
-        asdl_seq* body;
+        asdl_withitem_seq* items;
+        asdl_stmt_seq* body;
         string type_comment;
 
         if (_PyObject_LookupAttr(obj, state->items, &tmp) < 0) {
@@ -6432,13 +7114,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            items = _Py_asdl_seq_new(len, arena);
+            items = _Py_asdl_withitem_seq_new(len, arena);
             if (items == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 withitem_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'AsyncWith' node")) {
+                    goto failed;
+                }
                 res = obj2ast_withitem(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -6465,13 +7151,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            body = _Py_asdl_seq_new(len, arena);
+            body = _Py_asdl_stmt_seq_new(len, arena);
             if (body == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'AsyncWith' node")) {
+                    goto failed;
+                }
                 res = obj2ast_stmt(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -6491,12 +7181,84 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'AsyncWith' node")) {
+                goto failed;
+            }
             res = obj2ast_string(state, tmp, &type_comment, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
-        *out = AsyncWith(items, body, type_comment, lineno, col_offset,
-                         end_lineno, end_col_offset, arena);
+        *out = _PyAST_AsyncWith(items, body, type_comment, lineno, col_offset,
+                                end_lineno, end_col_offset, arena);
+        if (*out == NULL) goto failed;
+        return 0;
+    }
+    tp = state->Match_type;
+    isinstance = PyObject_IsInstance(obj, tp);
+    if (isinstance == -1) {
+        return 1;
+    }
+    if (isinstance) {
+        expr_ty subject;
+        asdl_match_case_seq* cases;
+
+        if (_PyObject_LookupAttr(obj, state->subject, &tmp) < 0) {
+            return 1;
+        }
+        if (tmp == NULL) {
+            PyErr_SetString(PyExc_TypeError, "required field \"subject\" missing from Match");
+            return 1;
+        }
+        else {
+            int res;
+            if (Py_EnterRecursiveCall(" while traversing 'Match' node")) {
+                goto failed;
+            }
+            res = obj2ast_expr(state, tmp, &subject, arena);
+            Py_LeaveRecursiveCall();
+            if (res != 0) goto failed;
+            Py_CLEAR(tmp);
+        }
+        if (_PyObject_LookupAttr(obj, state->cases, &tmp) < 0) {
+            return 1;
+        }
+        if (tmp == NULL) {
+            PyErr_SetString(PyExc_TypeError, "required field \"cases\" missing from Match");
+            return 1;
+        }
+        else {
+            int res;
+            Py_ssize_t len;
+            Py_ssize_t i;
+            if (!PyList_Check(tmp)) {
+                PyErr_Format(PyExc_TypeError, "Match field \"cases\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
+                goto failed;
+            }
+            len = PyList_GET_SIZE(tmp);
+            cases = _Py_asdl_match_case_seq_new(len, arena);
+            if (cases == NULL) goto failed;
+            for (i = 0; i < len; i++) {
+                match_case_ty val;
+                PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
+                Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'Match' node")) {
+                    goto failed;
+                }
+                res = obj2ast_match_case(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
+                Py_DECREF(tmp2);
+                if (res != 0) goto failed;
+                if (len != PyList_GET_SIZE(tmp)) {
+                    PyErr_SetString(PyExc_RuntimeError, "Match field \"cases\" changed size during iteration");
+                    goto failed;
+                }
+                asdl_seq_SET(cases, i, val);
+            }
+            Py_CLEAR(tmp);
+        }
+        *out = _PyAST_Match(subject, cases, lineno, col_offset, end_lineno,
+                            end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -6518,7 +7280,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'Raise' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &exc, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -6531,12 +7297,16 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'Raise' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &cause, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
-        *out = Raise(exc, cause, lineno, col_offset, end_lineno,
-                     end_col_offset, arena);
+        *out = _PyAST_Raise(exc, cause, lineno, col_offset, end_lineno,
+                            end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -6546,10 +7316,10 @@
         return 1;
     }
     if (isinstance) {
-        asdl_seq* body;
-        asdl_seq* handlers;
-        asdl_seq* orelse;
-        asdl_seq* finalbody;
+        asdl_stmt_seq* body;
+        asdl_excepthandler_seq* handlers;
+        asdl_stmt_seq* orelse;
+        asdl_stmt_seq* finalbody;
 
         if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) {
             return 1;
@@ -6567,13 +7337,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            body = _Py_asdl_seq_new(len, arena);
+            body = _Py_asdl_stmt_seq_new(len, arena);
             if (body == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'Try' node")) {
+                    goto failed;
+                }
                 res = obj2ast_stmt(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -6600,13 +7374,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            handlers = _Py_asdl_seq_new(len, arena);
+            handlers = _Py_asdl_excepthandler_seq_new(len, arena);
             if (handlers == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 excepthandler_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'Try' node")) {
+                    goto failed;
+                }
                 res = obj2ast_excepthandler(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -6633,13 +7411,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            orelse = _Py_asdl_seq_new(len, arena);
+            orelse = _Py_asdl_stmt_seq_new(len, arena);
             if (orelse == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'Try' node")) {
+                    goto failed;
+                }
                 res = obj2ast_stmt(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -6666,13 +7448,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            finalbody = _Py_asdl_seq_new(len, arena);
+            finalbody = _Py_asdl_stmt_seq_new(len, arena);
             if (finalbody == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'Try' node")) {
+                    goto failed;
+                }
                 res = obj2ast_stmt(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -6683,8 +7469,8 @@
             }
             Py_CLEAR(tmp);
         }
-        *out = Try(body, handlers, orelse, finalbody, lineno, col_offset,
-                   end_lineno, end_col_offset, arena);
+        *out = _PyAST_Try(body, handlers, orelse, finalbody, lineno,
+                          col_offset, end_lineno, end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -6706,7 +7492,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'Assert' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &test, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -6719,12 +7509,16 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'Assert' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &msg, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
-        *out = Assert(test, msg, lineno, col_offset, end_lineno,
-                      end_col_offset, arena);
+        *out = _PyAST_Assert(test, msg, lineno, col_offset, end_lineno,
+                             end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -6734,7 +7528,7 @@
         return 1;
     }
     if (isinstance) {
-        asdl_seq* names;
+        asdl_alias_seq* names;
 
         if (_PyObject_LookupAttr(obj, state->names, &tmp) < 0) {
             return 1;
@@ -6752,13 +7546,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            names = _Py_asdl_seq_new(len, arena);
+            names = _Py_asdl_alias_seq_new(len, arena);
             if (names == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 alias_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'Import' node")) {
+                    goto failed;
+                }
                 res = obj2ast_alias(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -6769,8 +7567,8 @@
             }
             Py_CLEAR(tmp);
         }
-        *out = Import(names, lineno, col_offset, end_lineno, end_col_offset,
-                      arena);
+        *out = _PyAST_Import(names, lineno, col_offset, end_lineno,
+                             end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -6781,7 +7579,7 @@
     }
     if (isinstance) {
         identifier module;
-        asdl_seq* names;
+        asdl_alias_seq* names;
         int level;
 
         if (_PyObject_LookupAttr(obj, state->module, &tmp) < 0) {
@@ -6793,7 +7591,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'ImportFrom' node")) {
+                goto failed;
+            }
             res = obj2ast_identifier(state, tmp, &module, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -6813,13 +7615,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            names = _Py_asdl_seq_new(len, arena);
+            names = _Py_asdl_alias_seq_new(len, arena);
             if (names == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 alias_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'ImportFrom' node")) {
+                    goto failed;
+                }
                 res = obj2ast_alias(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -6839,12 +7645,16 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'ImportFrom' node")) {
+                goto failed;
+            }
             res = obj2ast_int(state, tmp, &level, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
-        *out = ImportFrom(module, names, level, lineno, col_offset, end_lineno,
-                          end_col_offset, arena);
+        *out = _PyAST_ImportFrom(module, names, level, lineno, col_offset,
+                                 end_lineno, end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -6854,7 +7664,7 @@
         return 1;
     }
     if (isinstance) {
-        asdl_seq* names;
+        asdl_identifier_seq* names;
 
         if (_PyObject_LookupAttr(obj, state->names, &tmp) < 0) {
             return 1;
@@ -6872,13 +7682,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            names = _Py_asdl_seq_new(len, arena);
+            names = _Py_asdl_identifier_seq_new(len, arena);
             if (names == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 identifier val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'Global' node")) {
+                    goto failed;
+                }
                 res = obj2ast_identifier(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -6889,8 +7703,8 @@
             }
             Py_CLEAR(tmp);
         }
-        *out = Global(names, lineno, col_offset, end_lineno, end_col_offset,
-                      arena);
+        *out = _PyAST_Global(names, lineno, col_offset, end_lineno,
+                             end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -6900,7 +7714,7 @@
         return 1;
     }
     if (isinstance) {
-        asdl_seq* names;
+        asdl_identifier_seq* names;
 
         if (_PyObject_LookupAttr(obj, state->names, &tmp) < 0) {
             return 1;
@@ -6918,13 +7732,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            names = _Py_asdl_seq_new(len, arena);
+            names = _Py_asdl_identifier_seq_new(len, arena);
             if (names == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 identifier val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'Nonlocal' node")) {
+                    goto failed;
+                }
                 res = obj2ast_identifier(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -6935,8 +7753,8 @@
             }
             Py_CLEAR(tmp);
         }
-        *out = Nonlocal(names, lineno, col_offset, end_lineno, end_col_offset,
-                        arena);
+        *out = _PyAST_Nonlocal(names, lineno, col_offset, end_lineno,
+                               end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -6957,12 +7775,16 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'Expr' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &value, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
-        *out = Expr(value, lineno, col_offset, end_lineno, end_col_offset,
-                    arena);
+        *out = _PyAST_Expr(value, lineno, col_offset, end_lineno,
+                           end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -6973,7 +7795,8 @@
     }
     if (isinstance) {
 
-        *out = Pass(lineno, col_offset, end_lineno, end_col_offset, arena);
+        *out = _PyAST_Pass(lineno, col_offset, end_lineno, end_col_offset,
+                           arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -6984,7 +7807,8 @@
     }
     if (isinstance) {
 
-        *out = Break(lineno, col_offset, end_lineno, end_col_offset, arena);
+        *out = _PyAST_Break(lineno, col_offset, end_lineno, end_col_offset,
+                            arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -6995,7 +7819,8 @@
     }
     if (isinstance) {
 
-        *out = Continue(lineno, col_offset, end_lineno, end_col_offset, arena);
+        *out = _PyAST_Continue(lineno, col_offset, end_lineno, end_col_offset,
+                               arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -7007,7 +7832,8 @@
 }
 
 int
-obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
+obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena*
+             arena)
 {
     int isinstance;
 
@@ -7031,7 +7857,11 @@
     }
     else {
         int res;
+        if (Py_EnterRecursiveCall(" while traversing 'expr' node")) {
+            goto failed;
+        }
         res = obj2ast_int(state, tmp, &lineno, arena);
+        Py_LeaveRecursiveCall();
         if (res != 0) goto failed;
         Py_CLEAR(tmp);
     }
@@ -7044,7 +7874,11 @@
     }
     else {
         int res;
+        if (Py_EnterRecursiveCall(" while traversing 'expr' node")) {
+            goto failed;
+        }
         res = obj2ast_int(state, tmp, &col_offset, arena);
+        Py_LeaveRecursiveCall();
         if (res != 0) goto failed;
         Py_CLEAR(tmp);
     }
@@ -7057,7 +7891,11 @@
     }
     else {
         int res;
+        if (Py_EnterRecursiveCall(" while traversing 'expr' node")) {
+            goto failed;
+        }
         res = obj2ast_int(state, tmp, &end_lineno, arena);
+        Py_LeaveRecursiveCall();
         if (res != 0) goto failed;
         Py_CLEAR(tmp);
     }
@@ -7070,7 +7908,11 @@
     }
     else {
         int res;
+        if (Py_EnterRecursiveCall(" while traversing 'expr' node")) {
+            goto failed;
+        }
         res = obj2ast_int(state, tmp, &end_col_offset, arena);
+        Py_LeaveRecursiveCall();
         if (res != 0) goto failed;
         Py_CLEAR(tmp);
     }
@@ -7081,7 +7923,7 @@
     }
     if (isinstance) {
         boolop_ty op;
-        asdl_seq* values;
+        asdl_expr_seq* values;
 
         if (_PyObject_LookupAttr(obj, state->op, &tmp) < 0) {
             return 1;
@@ -7092,7 +7934,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'BoolOp' node")) {
+                goto failed;
+            }
             res = obj2ast_boolop(state, tmp, &op, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -7112,13 +7958,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            values = _Py_asdl_seq_new(len, arena);
+            values = _Py_asdl_expr_seq_new(len, arena);
             if (values == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 expr_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'BoolOp' node")) {
+                    goto failed;
+                }
                 res = obj2ast_expr(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -7129,8 +7979,8 @@
             }
             Py_CLEAR(tmp);
         }
-        *out = BoolOp(op, values, lineno, col_offset, end_lineno,
-                      end_col_offset, arena);
+        *out = _PyAST_BoolOp(op, values, lineno, col_offset, end_lineno,
+                             end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -7152,7 +8002,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'NamedExpr' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &target, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -7165,12 +8019,16 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'NamedExpr' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &value, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
-        *out = NamedExpr(target, value, lineno, col_offset, end_lineno,
-                         end_col_offset, arena);
+        *out = _PyAST_NamedExpr(target, value, lineno, col_offset, end_lineno,
+                                end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -7193,7 +8051,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'BinOp' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &left, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -7206,7 +8068,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'BinOp' node")) {
+                goto failed;
+            }
             res = obj2ast_operator(state, tmp, &op, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -7219,12 +8085,16 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'BinOp' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &right, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
-        *out = BinOp(left, op, right, lineno, col_offset, end_lineno,
-                     end_col_offset, arena);
+        *out = _PyAST_BinOp(left, op, right, lineno, col_offset, end_lineno,
+                            end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -7246,7 +8116,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'UnaryOp' node")) {
+                goto failed;
+            }
             res = obj2ast_unaryop(state, tmp, &op, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -7259,12 +8133,16 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'UnaryOp' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &operand, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
-        *out = UnaryOp(op, operand, lineno, col_offset, end_lineno,
-                       end_col_offset, arena);
+        *out = _PyAST_UnaryOp(op, operand, lineno, col_offset, end_lineno,
+                              end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -7286,7 +8164,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'Lambda' node")) {
+                goto failed;
+            }
             res = obj2ast_arguments(state, tmp, &args, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -7299,12 +8181,16 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'Lambda' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &body, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
-        *out = Lambda(args, body, lineno, col_offset, end_lineno,
-                      end_col_offset, arena);
+        *out = _PyAST_Lambda(args, body, lineno, col_offset, end_lineno,
+                             end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -7327,7 +8213,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'IfExp' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &test, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -7340,7 +8230,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'IfExp' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &body, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -7353,12 +8247,16 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'IfExp' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &orelse, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
-        *out = IfExp(test, body, orelse, lineno, col_offset, end_lineno,
-                     end_col_offset, arena);
+        *out = _PyAST_IfExp(test, body, orelse, lineno, col_offset, end_lineno,
+                            end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -7368,8 +8266,8 @@
         return 1;
     }
     if (isinstance) {
-        asdl_seq* keys;
-        asdl_seq* values;
+        asdl_expr_seq* keys;
+        asdl_expr_seq* values;
 
         if (_PyObject_LookupAttr(obj, state->keys, &tmp) < 0) {
             return 1;
@@ -7387,13 +8285,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            keys = _Py_asdl_seq_new(len, arena);
+            keys = _Py_asdl_expr_seq_new(len, arena);
             if (keys == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 expr_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'Dict' node")) {
+                    goto failed;
+                }
                 res = obj2ast_expr(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -7420,13 +8322,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            values = _Py_asdl_seq_new(len, arena);
+            values = _Py_asdl_expr_seq_new(len, arena);
             if (values == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 expr_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'Dict' node")) {
+                    goto failed;
+                }
                 res = obj2ast_expr(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -7437,8 +8343,8 @@
             }
             Py_CLEAR(tmp);
         }
-        *out = Dict(keys, values, lineno, col_offset, end_lineno,
-                    end_col_offset, arena);
+        *out = _PyAST_Dict(keys, values, lineno, col_offset, end_lineno,
+                           end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -7448,7 +8354,7 @@
         return 1;
     }
     if (isinstance) {
-        asdl_seq* elts;
+        asdl_expr_seq* elts;
 
         if (_PyObject_LookupAttr(obj, state->elts, &tmp) < 0) {
             return 1;
@@ -7466,13 +8372,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            elts = _Py_asdl_seq_new(len, arena);
+            elts = _Py_asdl_expr_seq_new(len, arena);
             if (elts == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 expr_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'Set' node")) {
+                    goto failed;
+                }
                 res = obj2ast_expr(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -7483,7 +8393,8 @@
             }
             Py_CLEAR(tmp);
         }
-        *out = Set(elts, lineno, col_offset, end_lineno, end_col_offset, arena);
+        *out = _PyAST_Set(elts, lineno, col_offset, end_lineno, end_col_offset,
+                          arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -7494,7 +8405,7 @@
     }
     if (isinstance) {
         expr_ty elt;
-        asdl_seq* generators;
+        asdl_comprehension_seq* generators;
 
         if (_PyObject_LookupAttr(obj, state->elt, &tmp) < 0) {
             return 1;
@@ -7505,7 +8416,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'ListComp' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &elt, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -7525,13 +8440,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            generators = _Py_asdl_seq_new(len, arena);
+            generators = _Py_asdl_comprehension_seq_new(len, arena);
             if (generators == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 comprehension_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'ListComp' node")) {
+                    goto failed;
+                }
                 res = obj2ast_comprehension(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -7542,8 +8461,8 @@
             }
             Py_CLEAR(tmp);
         }
-        *out = ListComp(elt, generators, lineno, col_offset, end_lineno,
-                        end_col_offset, arena);
+        *out = _PyAST_ListComp(elt, generators, lineno, col_offset, end_lineno,
+                               end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -7554,7 +8473,7 @@
     }
     if (isinstance) {
         expr_ty elt;
-        asdl_seq* generators;
+        asdl_comprehension_seq* generators;
 
         if (_PyObject_LookupAttr(obj, state->elt, &tmp) < 0) {
             return 1;
@@ -7565,7 +8484,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'SetComp' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &elt, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -7585,13 +8508,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            generators = _Py_asdl_seq_new(len, arena);
+            generators = _Py_asdl_comprehension_seq_new(len, arena);
             if (generators == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 comprehension_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'SetComp' node")) {
+                    goto failed;
+                }
                 res = obj2ast_comprehension(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -7602,8 +8529,8 @@
             }
             Py_CLEAR(tmp);
         }
-        *out = SetComp(elt, generators, lineno, col_offset, end_lineno,
-                       end_col_offset, arena);
+        *out = _PyAST_SetComp(elt, generators, lineno, col_offset, end_lineno,
+                              end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -7615,7 +8542,7 @@
     if (isinstance) {
         expr_ty key;
         expr_ty value;
-        asdl_seq* generators;
+        asdl_comprehension_seq* generators;
 
         if (_PyObject_LookupAttr(obj, state->key, &tmp) < 0) {
             return 1;
@@ -7626,7 +8553,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'DictComp' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &key, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -7639,7 +8570,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'DictComp' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &value, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -7659,13 +8594,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            generators = _Py_asdl_seq_new(len, arena);
+            generators = _Py_asdl_comprehension_seq_new(len, arena);
             if (generators == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 comprehension_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'DictComp' node")) {
+                    goto failed;
+                }
                 res = obj2ast_comprehension(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -7676,8 +8615,8 @@
             }
             Py_CLEAR(tmp);
         }
-        *out = DictComp(key, value, generators, lineno, col_offset, end_lineno,
-                        end_col_offset, arena);
+        *out = _PyAST_DictComp(key, value, generators, lineno, col_offset,
+                               end_lineno, end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -7688,7 +8627,7 @@
     }
     if (isinstance) {
         expr_ty elt;
-        asdl_seq* generators;
+        asdl_comprehension_seq* generators;
 
         if (_PyObject_LookupAttr(obj, state->elt, &tmp) < 0) {
             return 1;
@@ -7699,7 +8638,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'GeneratorExp' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &elt, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -7719,13 +8662,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            generators = _Py_asdl_seq_new(len, arena);
+            generators = _Py_asdl_comprehension_seq_new(len, arena);
             if (generators == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 comprehension_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'GeneratorExp' node")) {
+                    goto failed;
+                }
                 res = obj2ast_comprehension(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -7736,8 +8683,8 @@
             }
             Py_CLEAR(tmp);
         }
-        *out = GeneratorExp(elt, generators, lineno, col_offset, end_lineno,
-                            end_col_offset, arena);
+        *out = _PyAST_GeneratorExp(elt, generators, lineno, col_offset,
+                                   end_lineno, end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -7758,12 +8705,16 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'Await' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &value, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
-        *out = Await(value, lineno, col_offset, end_lineno, end_col_offset,
-                     arena);
+        *out = _PyAST_Await(value, lineno, col_offset, end_lineno,
+                            end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -7784,12 +8735,16 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'Yield' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &value, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
-        *out = Yield(value, lineno, col_offset, end_lineno, end_col_offset,
-                     arena);
+        *out = _PyAST_Yield(value, lineno, col_offset, end_lineno,
+                            end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -7810,12 +8765,16 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'YieldFrom' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &value, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
-        *out = YieldFrom(value, lineno, col_offset, end_lineno, end_col_offset,
-                         arena);
+        *out = _PyAST_YieldFrom(value, lineno, col_offset, end_lineno,
+                                end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -7827,7 +8786,7 @@
     if (isinstance) {
         expr_ty left;
         asdl_int_seq* ops;
-        asdl_seq* comparators;
+        asdl_expr_seq* comparators;
 
         if (_PyObject_LookupAttr(obj, state->left, &tmp) < 0) {
             return 1;
@@ -7838,7 +8797,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'Compare' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &left, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -7864,7 +8827,11 @@
                 cmpop_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'Compare' node")) {
+                    goto failed;
+                }
                 res = obj2ast_cmpop(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -7891,13 +8858,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            comparators = _Py_asdl_seq_new(len, arena);
+            comparators = _Py_asdl_expr_seq_new(len, arena);
             if (comparators == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 expr_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'Compare' node")) {
+                    goto failed;
+                }
                 res = obj2ast_expr(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -7908,8 +8879,8 @@
             }
             Py_CLEAR(tmp);
         }
-        *out = Compare(left, ops, comparators, lineno, col_offset, end_lineno,
-                       end_col_offset, arena);
+        *out = _PyAST_Compare(left, ops, comparators, lineno, col_offset,
+                              end_lineno, end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -7920,8 +8891,8 @@
     }
     if (isinstance) {
         expr_ty func;
-        asdl_seq* args;
-        asdl_seq* keywords;
+        asdl_expr_seq* args;
+        asdl_keyword_seq* keywords;
 
         if (_PyObject_LookupAttr(obj, state->func, &tmp) < 0) {
             return 1;
@@ -7932,7 +8903,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'Call' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &func, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -7952,13 +8927,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            args = _Py_asdl_seq_new(len, arena);
+            args = _Py_asdl_expr_seq_new(len, arena);
             if (args == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 expr_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'Call' node")) {
+                    goto failed;
+                }
                 res = obj2ast_expr(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -7985,13 +8964,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            keywords = _Py_asdl_seq_new(len, arena);
+            keywords = _Py_asdl_keyword_seq_new(len, arena);
             if (keywords == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 keyword_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'Call' node")) {
+                    goto failed;
+                }
                 res = obj2ast_keyword(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -8002,8 +8985,8 @@
             }
             Py_CLEAR(tmp);
         }
-        *out = Call(func, args, keywords, lineno, col_offset, end_lineno,
-                    end_col_offset, arena);
+        *out = _PyAST_Call(func, args, keywords, lineno, col_offset,
+                           end_lineno, end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -8026,20 +9009,28 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'FormattedValue' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &value, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
         if (_PyObject_LookupAttr(obj, state->conversion, &tmp) < 0) {
             return 1;
         }
-        if (tmp == NULL || tmp == Py_None) {
-            Py_CLEAR(tmp);
-            conversion = 0;
+        if (tmp == NULL) {
+            PyErr_SetString(PyExc_TypeError, "required field \"conversion\" missing from FormattedValue");
+            return 1;
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'FormattedValue' node")) {
+                goto failed;
+            }
             res = obj2ast_int(state, tmp, &conversion, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -8052,12 +9043,17 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'FormattedValue' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &format_spec, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
-        *out = FormattedValue(value, conversion, format_spec, lineno,
-                              col_offset, end_lineno, end_col_offset, arena);
+        *out = _PyAST_FormattedValue(value, conversion, format_spec, lineno,
+                                     col_offset, end_lineno, end_col_offset,
+                                     arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -8067,7 +9063,7 @@
         return 1;
     }
     if (isinstance) {
-        asdl_seq* values;
+        asdl_expr_seq* values;
 
         if (_PyObject_LookupAttr(obj, state->values, &tmp) < 0) {
             return 1;
@@ -8085,13 +9081,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            values = _Py_asdl_seq_new(len, arena);
+            values = _Py_asdl_expr_seq_new(len, arena);
             if (values == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 expr_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'JoinedStr' node")) {
+                    goto failed;
+                }
                 res = obj2ast_expr(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -8102,8 +9102,8 @@
             }
             Py_CLEAR(tmp);
         }
-        *out = JoinedStr(values, lineno, col_offset, end_lineno,
-                         end_col_offset, arena);
+        *out = _PyAST_JoinedStr(values, lineno, col_offset, end_lineno,
+                                end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -8125,7 +9125,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'Constant' node")) {
+                goto failed;
+            }
             res = obj2ast_constant(state, tmp, &value, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -8138,12 +9142,16 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'Constant' node")) {
+                goto failed;
+            }
             res = obj2ast_string(state, tmp, &kind, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
-        *out = Constant(value, kind, lineno, col_offset, end_lineno,
-                        end_col_offset, arena);
+        *out = _PyAST_Constant(value, kind, lineno, col_offset, end_lineno,
+                               end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -8166,7 +9174,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'Attribute' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &value, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -8179,7 +9191,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'Attribute' node")) {
+                goto failed;
+            }
             res = obj2ast_identifier(state, tmp, &attr, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -8192,12 +9208,16 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'Attribute' node")) {
+                goto failed;
+            }
             res = obj2ast_expr_context(state, tmp, &ctx, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
-        *out = Attribute(value, attr, ctx, lineno, col_offset, end_lineno,
-                         end_col_offset, arena);
+        *out = _PyAST_Attribute(value, attr, ctx, lineno, col_offset,
+                                end_lineno, end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -8220,7 +9240,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'Subscript' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &value, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -8233,7 +9257,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'Subscript' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &slice, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -8246,12 +9274,16 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'Subscript' node")) {
+                goto failed;
+            }
             res = obj2ast_expr_context(state, tmp, &ctx, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
-        *out = Subscript(value, slice, ctx, lineno, col_offset, end_lineno,
-                         end_col_offset, arena);
+        *out = _PyAST_Subscript(value, slice, ctx, lineno, col_offset,
+                                end_lineno, end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -8273,7 +9305,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'Starred' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &value, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -8286,12 +9322,16 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'Starred' node")) {
+                goto failed;
+            }
             res = obj2ast_expr_context(state, tmp, &ctx, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
-        *out = Starred(value, ctx, lineno, col_offset, end_lineno,
-                       end_col_offset, arena);
+        *out = _PyAST_Starred(value, ctx, lineno, col_offset, end_lineno,
+                              end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -8313,7 +9353,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'Name' node")) {
+                goto failed;
+            }
             res = obj2ast_identifier(state, tmp, &id, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -8326,12 +9370,16 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'Name' node")) {
+                goto failed;
+            }
             res = obj2ast_expr_context(state, tmp, &ctx, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
-        *out = Name(id, ctx, lineno, col_offset, end_lineno, end_col_offset,
-                    arena);
+        *out = _PyAST_Name(id, ctx, lineno, col_offset, end_lineno,
+                           end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -8341,7 +9389,7 @@
         return 1;
     }
     if (isinstance) {
-        asdl_seq* elts;
+        asdl_expr_seq* elts;
         expr_context_ty ctx;
 
         if (_PyObject_LookupAttr(obj, state->elts, &tmp) < 0) {
@@ -8360,13 +9408,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            elts = _Py_asdl_seq_new(len, arena);
+            elts = _Py_asdl_expr_seq_new(len, arena);
             if (elts == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 expr_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'List' node")) {
+                    goto failed;
+                }
                 res = obj2ast_expr(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -8386,12 +9438,16 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'List' node")) {
+                goto failed;
+            }
             res = obj2ast_expr_context(state, tmp, &ctx, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
-        *out = List(elts, ctx, lineno, col_offset, end_lineno, end_col_offset,
-                    arena);
+        *out = _PyAST_List(elts, ctx, lineno, col_offset, end_lineno,
+                           end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -8401,7 +9457,7 @@
         return 1;
     }
     if (isinstance) {
-        asdl_seq* elts;
+        asdl_expr_seq* elts;
         expr_context_ty ctx;
 
         if (_PyObject_LookupAttr(obj, state->elts, &tmp) < 0) {
@@ -8420,13 +9476,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            elts = _Py_asdl_seq_new(len, arena);
+            elts = _Py_asdl_expr_seq_new(len, arena);
             if (elts == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 expr_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'Tuple' node")) {
+                    goto failed;
+                }
                 res = obj2ast_expr(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -8446,12 +9506,16 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'Tuple' node")) {
+                goto failed;
+            }
             res = obj2ast_expr_context(state, tmp, &ctx, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
-        *out = Tuple(elts, ctx, lineno, col_offset, end_lineno, end_col_offset,
-                     arena);
+        *out = _PyAST_Tuple(elts, ctx, lineno, col_offset, end_lineno,
+                            end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -8474,7 +9538,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'Slice' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &lower, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -8487,7 +9555,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'Slice' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &upper, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -8500,12 +9572,16 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'Slice' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &step, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
-        *out = Slice(lower, upper, step, lineno, col_offset, end_lineno,
-                     end_col_offset, arena);
+        *out = _PyAST_Slice(lower, upper, step, lineno, col_offset, end_lineno,
+                            end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -8517,7 +9593,7 @@
 }
 
 int
-obj2ast_expr_context(astmodulestate *state, PyObject* obj, expr_context_ty*
+obj2ast_expr_context(struct ast_state *state, PyObject* obj, expr_context_ty*
                      out, PyArena* arena)
 {
     int isinstance;
@@ -8552,7 +9628,7 @@
 }
 
 int
-obj2ast_boolop(astmodulestate *state, PyObject* obj, boolop_ty* out, PyArena*
+obj2ast_boolop(struct ast_state *state, PyObject* obj, boolop_ty* out, PyArena*
                arena)
 {
     int isinstance;
@@ -8579,7 +9655,7 @@
 }
 
 int
-obj2ast_operator(astmodulestate *state, PyObject* obj, operator_ty* out,
+obj2ast_operator(struct ast_state *state, PyObject* obj, operator_ty* out,
                  PyArena* arena)
 {
     int isinstance;
@@ -8694,8 +9770,8 @@
 }
 
 int
-obj2ast_unaryop(astmodulestate *state, PyObject* obj, unaryop_ty* out, PyArena*
-                arena)
+obj2ast_unaryop(struct ast_state *state, PyObject* obj, unaryop_ty* out,
+                PyArena* arena)
 {
     int isinstance;
 
@@ -8737,7 +9813,7 @@
 }
 
 int
-obj2ast_cmpop(astmodulestate *state, PyObject* obj, cmpop_ty* out, PyArena*
+obj2ast_cmpop(struct ast_state *state, PyObject* obj, cmpop_ty* out, PyArena*
               arena)
 {
     int isinstance;
@@ -8828,13 +9904,13 @@
 }
 
 int
-obj2ast_comprehension(astmodulestate *state, PyObject* obj, comprehension_ty*
+obj2ast_comprehension(struct ast_state *state, PyObject* obj, comprehension_ty*
                       out, PyArena* arena)
 {
     PyObject* tmp = NULL;
     expr_ty target;
     expr_ty iter;
-    asdl_seq* ifs;
+    asdl_expr_seq* ifs;
     int is_async;
 
     if (_PyObject_LookupAttr(obj, state->target, &tmp) < 0) {
@@ -8846,7 +9922,11 @@
     }
     else {
         int res;
+        if (Py_EnterRecursiveCall(" while traversing 'comprehension' node")) {
+            goto failed;
+        }
         res = obj2ast_expr(state, tmp, &target, arena);
+        Py_LeaveRecursiveCall();
         if (res != 0) goto failed;
         Py_CLEAR(tmp);
     }
@@ -8859,7 +9939,11 @@
     }
     else {
         int res;
+        if (Py_EnterRecursiveCall(" while traversing 'comprehension' node")) {
+            goto failed;
+        }
         res = obj2ast_expr(state, tmp, &iter, arena);
+        Py_LeaveRecursiveCall();
         if (res != 0) goto failed;
         Py_CLEAR(tmp);
     }
@@ -8879,13 +9963,17 @@
             goto failed;
         }
         len = PyList_GET_SIZE(tmp);
-        ifs = _Py_asdl_seq_new(len, arena);
+        ifs = _Py_asdl_expr_seq_new(len, arena);
         if (ifs == NULL) goto failed;
         for (i = 0; i < len; i++) {
             expr_ty val;
             PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
             Py_INCREF(tmp2);
+            if (Py_EnterRecursiveCall(" while traversing 'comprehension' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp2, &val, arena);
+            Py_LeaveRecursiveCall();
             Py_DECREF(tmp2);
             if (res != 0) goto failed;
             if (len != PyList_GET_SIZE(tmp)) {
@@ -8905,11 +9993,15 @@
     }
     else {
         int res;
+        if (Py_EnterRecursiveCall(" while traversing 'comprehension' node")) {
+            goto failed;
+        }
         res = obj2ast_int(state, tmp, &is_async, arena);
+        Py_LeaveRecursiveCall();
         if (res != 0) goto failed;
         Py_CLEAR(tmp);
     }
-    *out = comprehension(target, iter, ifs, is_async, arena);
+    *out = _PyAST_comprehension(target, iter, ifs, is_async, arena);
     return 0;
 failed:
     Py_XDECREF(tmp);
@@ -8917,7 +10009,7 @@
 }
 
 int
-obj2ast_excepthandler(astmodulestate *state, PyObject* obj, excepthandler_ty*
+obj2ast_excepthandler(struct ast_state *state, PyObject* obj, excepthandler_ty*
                       out, PyArena* arena)
 {
     int isinstance;
@@ -8942,7 +10034,11 @@
     }
     else {
         int res;
+        if (Py_EnterRecursiveCall(" while traversing 'excepthandler' node")) {
+            goto failed;
+        }
         res = obj2ast_int(state, tmp, &lineno, arena);
+        Py_LeaveRecursiveCall();
         if (res != 0) goto failed;
         Py_CLEAR(tmp);
     }
@@ -8955,7 +10051,11 @@
     }
     else {
         int res;
+        if (Py_EnterRecursiveCall(" while traversing 'excepthandler' node")) {
+            goto failed;
+        }
         res = obj2ast_int(state, tmp, &col_offset, arena);
+        Py_LeaveRecursiveCall();
         if (res != 0) goto failed;
         Py_CLEAR(tmp);
     }
@@ -8968,7 +10068,11 @@
     }
     else {
         int res;
+        if (Py_EnterRecursiveCall(" while traversing 'excepthandler' node")) {
+            goto failed;
+        }
         res = obj2ast_int(state, tmp, &end_lineno, arena);
+        Py_LeaveRecursiveCall();
         if (res != 0) goto failed;
         Py_CLEAR(tmp);
     }
@@ -8981,7 +10085,11 @@
     }
     else {
         int res;
+        if (Py_EnterRecursiveCall(" while traversing 'excepthandler' node")) {
+            goto failed;
+        }
         res = obj2ast_int(state, tmp, &end_col_offset, arena);
+        Py_LeaveRecursiveCall();
         if (res != 0) goto failed;
         Py_CLEAR(tmp);
     }
@@ -8993,7 +10101,7 @@
     if (isinstance) {
         expr_ty type;
         identifier name;
-        asdl_seq* body;
+        asdl_stmt_seq* body;
 
         if (_PyObject_LookupAttr(obj, state->type, &tmp) < 0) {
             return 1;
@@ -9004,7 +10112,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'ExceptHandler' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp, &type, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -9017,7 +10129,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'ExceptHandler' node")) {
+                goto failed;
+            }
             res = obj2ast_identifier(state, tmp, &name, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -9037,13 +10153,17 @@
                 goto failed;
             }
             len = PyList_GET_SIZE(tmp);
-            body = _Py_asdl_seq_new(len, arena);
+            body = _Py_asdl_stmt_seq_new(len, arena);
             if (body == NULL) goto failed;
             for (i = 0; i < len; i++) {
                 stmt_ty val;
                 PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
                 Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'ExceptHandler' node")) {
+                    goto failed;
+                }
                 res = obj2ast_stmt(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
                 Py_DECREF(tmp2);
                 if (res != 0) goto failed;
                 if (len != PyList_GET_SIZE(tmp)) {
@@ -9054,8 +10174,8 @@
             }
             Py_CLEAR(tmp);
         }
-        *out = ExceptHandler(type, name, body, lineno, col_offset, end_lineno,
-                             end_col_offset, arena);
+        *out = _PyAST_ExceptHandler(type, name, body, lineno, col_offset,
+                                    end_lineno, end_col_offset, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -9067,17 +10187,17 @@
 }
 
 int
-obj2ast_arguments(astmodulestate *state, PyObject* obj, arguments_ty* out,
+obj2ast_arguments(struct ast_state *state, PyObject* obj, arguments_ty* out,
                   PyArena* arena)
 {
     PyObject* tmp = NULL;
-    asdl_seq* posonlyargs;
-    asdl_seq* args;
+    asdl_arg_seq* posonlyargs;
+    asdl_arg_seq* args;
     arg_ty vararg;
-    asdl_seq* kwonlyargs;
-    asdl_seq* kw_defaults;
+    asdl_arg_seq* kwonlyargs;
+    asdl_expr_seq* kw_defaults;
     arg_ty kwarg;
-    asdl_seq* defaults;
+    asdl_expr_seq* defaults;
 
     if (_PyObject_LookupAttr(obj, state->posonlyargs, &tmp) < 0) {
         return 1;
@@ -9095,13 +10215,17 @@
             goto failed;
         }
         len = PyList_GET_SIZE(tmp);
-        posonlyargs = _Py_asdl_seq_new(len, arena);
+        posonlyargs = _Py_asdl_arg_seq_new(len, arena);
         if (posonlyargs == NULL) goto failed;
         for (i = 0; i < len; i++) {
             arg_ty val;
             PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
             Py_INCREF(tmp2);
+            if (Py_EnterRecursiveCall(" while traversing 'arguments' node")) {
+                goto failed;
+            }
             res = obj2ast_arg(state, tmp2, &val, arena);
+            Py_LeaveRecursiveCall();
             Py_DECREF(tmp2);
             if (res != 0) goto failed;
             if (len != PyList_GET_SIZE(tmp)) {
@@ -9128,13 +10252,17 @@
             goto failed;
         }
         len = PyList_GET_SIZE(tmp);
-        args = _Py_asdl_seq_new(len, arena);
+        args = _Py_asdl_arg_seq_new(len, arena);
         if (args == NULL) goto failed;
         for (i = 0; i < len; i++) {
             arg_ty val;
             PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
             Py_INCREF(tmp2);
+            if (Py_EnterRecursiveCall(" while traversing 'arguments' node")) {
+                goto failed;
+            }
             res = obj2ast_arg(state, tmp2, &val, arena);
+            Py_LeaveRecursiveCall();
             Py_DECREF(tmp2);
             if (res != 0) goto failed;
             if (len != PyList_GET_SIZE(tmp)) {
@@ -9154,7 +10282,11 @@
     }
     else {
         int res;
+        if (Py_EnterRecursiveCall(" while traversing 'arguments' node")) {
+            goto failed;
+        }
         res = obj2ast_arg(state, tmp, &vararg, arena);
+        Py_LeaveRecursiveCall();
         if (res != 0) goto failed;
         Py_CLEAR(tmp);
     }
@@ -9174,13 +10306,17 @@
             goto failed;
         }
         len = PyList_GET_SIZE(tmp);
-        kwonlyargs = _Py_asdl_seq_new(len, arena);
+        kwonlyargs = _Py_asdl_arg_seq_new(len, arena);
         if (kwonlyargs == NULL) goto failed;
         for (i = 0; i < len; i++) {
             arg_ty val;
             PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
             Py_INCREF(tmp2);
+            if (Py_EnterRecursiveCall(" while traversing 'arguments' node")) {
+                goto failed;
+            }
             res = obj2ast_arg(state, tmp2, &val, arena);
+            Py_LeaveRecursiveCall();
             Py_DECREF(tmp2);
             if (res != 0) goto failed;
             if (len != PyList_GET_SIZE(tmp)) {
@@ -9207,13 +10343,17 @@
             goto failed;
         }
         len = PyList_GET_SIZE(tmp);
-        kw_defaults = _Py_asdl_seq_new(len, arena);
+        kw_defaults = _Py_asdl_expr_seq_new(len, arena);
         if (kw_defaults == NULL) goto failed;
         for (i = 0; i < len; i++) {
             expr_ty val;
             PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
             Py_INCREF(tmp2);
+            if (Py_EnterRecursiveCall(" while traversing 'arguments' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp2, &val, arena);
+            Py_LeaveRecursiveCall();
             Py_DECREF(tmp2);
             if (res != 0) goto failed;
             if (len != PyList_GET_SIZE(tmp)) {
@@ -9233,7 +10373,11 @@
     }
     else {
         int res;
+        if (Py_EnterRecursiveCall(" while traversing 'arguments' node")) {
+            goto failed;
+        }
         res = obj2ast_arg(state, tmp, &kwarg, arena);
+        Py_LeaveRecursiveCall();
         if (res != 0) goto failed;
         Py_CLEAR(tmp);
     }
@@ -9253,13 +10397,17 @@
             goto failed;
         }
         len = PyList_GET_SIZE(tmp);
-        defaults = _Py_asdl_seq_new(len, arena);
+        defaults = _Py_asdl_expr_seq_new(len, arena);
         if (defaults == NULL) goto failed;
         for (i = 0; i < len; i++) {
             expr_ty val;
             PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
             Py_INCREF(tmp2);
+            if (Py_EnterRecursiveCall(" while traversing 'arguments' node")) {
+                goto failed;
+            }
             res = obj2ast_expr(state, tmp2, &val, arena);
+            Py_LeaveRecursiveCall();
             Py_DECREF(tmp2);
             if (res != 0) goto failed;
             if (len != PyList_GET_SIZE(tmp)) {
@@ -9270,8 +10418,8 @@
         }
         Py_CLEAR(tmp);
     }
-    *out = arguments(posonlyargs, args, vararg, kwonlyargs, kw_defaults, kwarg,
-                     defaults, arena);
+    *out = _PyAST_arguments(posonlyargs, args, vararg, kwonlyargs, kw_defaults,
+                            kwarg, defaults, arena);
     return 0;
 failed:
     Py_XDECREF(tmp);
@@ -9279,7 +10427,7 @@
 }
 
 int
-obj2ast_arg(astmodulestate *state, PyObject* obj, arg_ty* out, PyArena* arena)
+obj2ast_arg(struct ast_state *state, PyObject* obj, arg_ty* out, PyArena* arena)
 {
     PyObject* tmp = NULL;
     identifier arg;
@@ -9299,7 +10447,11 @@
     }
     else {
         int res;
+        if (Py_EnterRecursiveCall(" while traversing 'arg' node")) {
+            goto failed;
+        }
         res = obj2ast_identifier(state, tmp, &arg, arena);
+        Py_LeaveRecursiveCall();
         if (res != 0) goto failed;
         Py_CLEAR(tmp);
     }
@@ -9312,7 +10464,11 @@
     }
     else {
         int res;
+        if (Py_EnterRecursiveCall(" while traversing 'arg' node")) {
+            goto failed;
+        }
         res = obj2ast_expr(state, tmp, &annotation, arena);
+        Py_LeaveRecursiveCall();
         if (res != 0) goto failed;
         Py_CLEAR(tmp);
     }
@@ -9325,7 +10481,11 @@
     }
     else {
         int res;
+        if (Py_EnterRecursiveCall(" while traversing 'arg' node")) {
+            goto failed;
+        }
         res = obj2ast_string(state, tmp, &type_comment, arena);
+        Py_LeaveRecursiveCall();
         if (res != 0) goto failed;
         Py_CLEAR(tmp);
     }
@@ -9338,7 +10498,11 @@
     }
     else {
         int res;
+        if (Py_EnterRecursiveCall(" while traversing 'arg' node")) {
+            goto failed;
+        }
         res = obj2ast_int(state, tmp, &lineno, arena);
+        Py_LeaveRecursiveCall();
         if (res != 0) goto failed;
         Py_CLEAR(tmp);
     }
@@ -9351,7 +10515,11 @@
     }
     else {
         int res;
+        if (Py_EnterRecursiveCall(" while traversing 'arg' node")) {
+            goto failed;
+        }
         res = obj2ast_int(state, tmp, &col_offset, arena);
+        Py_LeaveRecursiveCall();
         if (res != 0) goto failed;
         Py_CLEAR(tmp);
     }
@@ -9364,7 +10532,11 @@
     }
     else {
         int res;
+        if (Py_EnterRecursiveCall(" while traversing 'arg' node")) {
+            goto failed;
+        }
         res = obj2ast_int(state, tmp, &end_lineno, arena);
+        Py_LeaveRecursiveCall();
         if (res != 0) goto failed;
         Py_CLEAR(tmp);
     }
@@ -9377,12 +10549,16 @@
     }
     else {
         int res;
+        if (Py_EnterRecursiveCall(" while traversing 'arg' node")) {
+            goto failed;
+        }
         res = obj2ast_int(state, tmp, &end_col_offset, arena);
+        Py_LeaveRecursiveCall();
         if (res != 0) goto failed;
         Py_CLEAR(tmp);
     }
-    *out = arg(arg, annotation, type_comment, lineno, col_offset, end_lineno,
-               end_col_offset, arena);
+    *out = _PyAST_arg(arg, annotation, type_comment, lineno, col_offset,
+                      end_lineno, end_col_offset, arena);
     return 0;
 failed:
     Py_XDECREF(tmp);
@@ -9390,8 +10566,8 @@
 }
 
 int
-obj2ast_keyword(astmodulestate *state, PyObject* obj, keyword_ty* out, PyArena*
-                arena)
+obj2ast_keyword(struct ast_state *state, PyObject* obj, keyword_ty* out,
+                PyArena* arena)
 {
     PyObject* tmp = NULL;
     identifier arg;
@@ -9410,7 +10586,11 @@
     }
     else {
         int res;
+        if (Py_EnterRecursiveCall(" while traversing 'keyword' node")) {
+            goto failed;
+        }
         res = obj2ast_identifier(state, tmp, &arg, arena);
+        Py_LeaveRecursiveCall();
         if (res != 0) goto failed;
         Py_CLEAR(tmp);
     }
@@ -9423,7 +10603,11 @@
     }
     else {
         int res;
+        if (Py_EnterRecursiveCall(" while traversing 'keyword' node")) {
+            goto failed;
+        }
         res = obj2ast_expr(state, tmp, &value, arena);
+        Py_LeaveRecursiveCall();
         if (res != 0) goto failed;
         Py_CLEAR(tmp);
     }
@@ -9436,7 +10620,11 @@
     }
     else {
         int res;
+        if (Py_EnterRecursiveCall(" while traversing 'keyword' node")) {
+            goto failed;
+        }
         res = obj2ast_int(state, tmp, &lineno, arena);
+        Py_LeaveRecursiveCall();
         if (res != 0) goto failed;
         Py_CLEAR(tmp);
     }
@@ -9449,7 +10637,11 @@
     }
     else {
         int res;
+        if (Py_EnterRecursiveCall(" while traversing 'keyword' node")) {
+            goto failed;
+        }
         res = obj2ast_int(state, tmp, &col_offset, arena);
+        Py_LeaveRecursiveCall();
         if (res != 0) goto failed;
         Py_CLEAR(tmp);
     }
@@ -9462,7 +10654,11 @@
     }
     else {
         int res;
+        if (Py_EnterRecursiveCall(" while traversing 'keyword' node")) {
+            goto failed;
+        }
         res = obj2ast_int(state, tmp, &end_lineno, arena);
+        Py_LeaveRecursiveCall();
         if (res != 0) goto failed;
         Py_CLEAR(tmp);
     }
@@ -9475,12 +10671,16 @@
     }
     else {
         int res;
+        if (Py_EnterRecursiveCall(" while traversing 'keyword' node")) {
+            goto failed;
+        }
         res = obj2ast_int(state, tmp, &end_col_offset, arena);
+        Py_LeaveRecursiveCall();
         if (res != 0) goto failed;
         Py_CLEAR(tmp);
     }
-    *out = keyword(arg, value, lineno, col_offset, end_lineno, end_col_offset,
-                   arena);
+    *out = _PyAST_keyword(arg, value, lineno, col_offset, end_lineno,
+                          end_col_offset, arena);
     return 0;
 failed:
     Py_XDECREF(tmp);
@@ -9488,12 +10688,16 @@
 }
 
 int
-obj2ast_alias(astmodulestate *state, PyObject* obj, alias_ty* out, PyArena*
+obj2ast_alias(struct ast_state *state, PyObject* obj, alias_ty* out, PyArena*
               arena)
 {
     PyObject* tmp = NULL;
     identifier name;
     identifier asname;
+    int lineno;
+    int col_offset;
+    int end_lineno;
+    int end_col_offset;
 
     if (_PyObject_LookupAttr(obj, state->name, &tmp) < 0) {
         return 1;
@@ -9504,7 +10708,11 @@
     }
     else {
         int res;
+        if (Py_EnterRecursiveCall(" while traversing 'alias' node")) {
+            goto failed;
+        }
         res = obj2ast_identifier(state, tmp, &name, arena);
+        Py_LeaveRecursiveCall();
         if (res != 0) goto failed;
         Py_CLEAR(tmp);
     }
@@ -9517,11 +10725,84 @@
     }
     else {
         int res;
+        if (Py_EnterRecursiveCall(" while traversing 'alias' node")) {
+            goto failed;
+        }
         res = obj2ast_identifier(state, tmp, &asname, arena);
+        Py_LeaveRecursiveCall();
         if (res != 0) goto failed;
         Py_CLEAR(tmp);
     }
-    *out = alias(name, asname, arena);
+    if (_PyObject_LookupAttr(obj, state->lineno, &tmp) < 0) {
+        return 1;
+    }
+    if (tmp == NULL) {
+        PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from alias");
+        return 1;
+    }
+    else {
+        int res;
+        if (Py_EnterRecursiveCall(" while traversing 'alias' node")) {
+            goto failed;
+        }
+        res = obj2ast_int(state, tmp, &lineno, arena);
+        Py_LeaveRecursiveCall();
+        if (res != 0) goto failed;
+        Py_CLEAR(tmp);
+    }
+    if (_PyObject_LookupAttr(obj, state->col_offset, &tmp) < 0) {
+        return 1;
+    }
+    if (tmp == NULL) {
+        PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from alias");
+        return 1;
+    }
+    else {
+        int res;
+        if (Py_EnterRecursiveCall(" while traversing 'alias' node")) {
+            goto failed;
+        }
+        res = obj2ast_int(state, tmp, &col_offset, arena);
+        Py_LeaveRecursiveCall();
+        if (res != 0) goto failed;
+        Py_CLEAR(tmp);
+    }
+    if (_PyObject_LookupAttr(obj, state->end_lineno, &tmp) < 0) {
+        return 1;
+    }
+    if (tmp == NULL || tmp == Py_None) {
+        Py_CLEAR(tmp);
+        end_lineno = 0;
+    }
+    else {
+        int res;
+        if (Py_EnterRecursiveCall(" while traversing 'alias' node")) {
+            goto failed;
+        }
+        res = obj2ast_int(state, tmp, &end_lineno, arena);
+        Py_LeaveRecursiveCall();
+        if (res != 0) goto failed;
+        Py_CLEAR(tmp);
+    }
+    if (_PyObject_LookupAttr(obj, state->end_col_offset, &tmp) < 0) {
+        return 1;
+    }
+    if (tmp == NULL || tmp == Py_None) {
+        Py_CLEAR(tmp);
+        end_col_offset = 0;
+    }
+    else {
+        int res;
+        if (Py_EnterRecursiveCall(" while traversing 'alias' node")) {
+            goto failed;
+        }
+        res = obj2ast_int(state, tmp, &end_col_offset, arena);
+        Py_LeaveRecursiveCall();
+        if (res != 0) goto failed;
+        Py_CLEAR(tmp);
+    }
+    *out = _PyAST_alias(name, asname, lineno, col_offset, end_lineno,
+                        end_col_offset, arena);
     return 0;
 failed:
     Py_XDECREF(tmp);
@@ -9529,7 +10810,7 @@
 }
 
 int
-obj2ast_withitem(astmodulestate *state, PyObject* obj, withitem_ty* out,
+obj2ast_withitem(struct ast_state *state, PyObject* obj, withitem_ty* out,
                  PyArena* arena)
 {
     PyObject* tmp = NULL;
@@ -9545,7 +10826,11 @@
     }
     else {
         int res;
+        if (Py_EnterRecursiveCall(" while traversing 'withitem' node")) {
+            goto failed;
+        }
         res = obj2ast_expr(state, tmp, &context_expr, arena);
+        Py_LeaveRecursiveCall();
         if (res != 0) goto failed;
         Py_CLEAR(tmp);
     }
@@ -9558,11 +10843,15 @@
     }
     else {
         int res;
+        if (Py_EnterRecursiveCall(" while traversing 'withitem' node")) {
+            goto failed;
+        }
         res = obj2ast_expr(state, tmp, &optional_vars, arena);
+        Py_LeaveRecursiveCall();
         if (res != 0) goto failed;
         Py_CLEAR(tmp);
     }
-    *out = withitem(context_expr, optional_vars, arena);
+    *out = _PyAST_withitem(context_expr, optional_vars, arena);
     return 0;
 failed:
     Py_XDECREF(tmp);
@@ -9570,8 +10859,676 @@
 }
 
 int
-obj2ast_type_ignore(astmodulestate *state, PyObject* obj, type_ignore_ty* out,
-                    PyArena* arena)
+obj2ast_match_case(struct ast_state *state, PyObject* obj, match_case_ty* out,
+                   PyArena* arena)
+{
+    PyObject* tmp = NULL;
+    pattern_ty pattern;
+    expr_ty guard;
+    asdl_stmt_seq* body;
+
+    if (_PyObject_LookupAttr(obj, state->pattern, &tmp) < 0) {
+        return 1;
+    }
+    if (tmp == NULL) {
+        PyErr_SetString(PyExc_TypeError, "required field \"pattern\" missing from match_case");
+        return 1;
+    }
+    else {
+        int res;
+        if (Py_EnterRecursiveCall(" while traversing 'match_case' node")) {
+            goto failed;
+        }
+        res = obj2ast_pattern(state, tmp, &pattern, arena);
+        Py_LeaveRecursiveCall();
+        if (res != 0) goto failed;
+        Py_CLEAR(tmp);
+    }
+    if (_PyObject_LookupAttr(obj, state->guard, &tmp) < 0) {
+        return 1;
+    }
+    if (tmp == NULL || tmp == Py_None) {
+        Py_CLEAR(tmp);
+        guard = NULL;
+    }
+    else {
+        int res;
+        if (Py_EnterRecursiveCall(" while traversing 'match_case' node")) {
+            goto failed;
+        }
+        res = obj2ast_expr(state, tmp, &guard, arena);
+        Py_LeaveRecursiveCall();
+        if (res != 0) goto failed;
+        Py_CLEAR(tmp);
+    }
+    if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) {
+        return 1;
+    }
+    if (tmp == NULL) {
+        PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from match_case");
+        return 1;
+    }
+    else {
+        int res;
+        Py_ssize_t len;
+        Py_ssize_t i;
+        if (!PyList_Check(tmp)) {
+            PyErr_Format(PyExc_TypeError, "match_case field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
+            goto failed;
+        }
+        len = PyList_GET_SIZE(tmp);
+        body = _Py_asdl_stmt_seq_new(len, arena);
+        if (body == NULL) goto failed;
+        for (i = 0; i < len; i++) {
+            stmt_ty val;
+            PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
+            Py_INCREF(tmp2);
+            if (Py_EnterRecursiveCall(" while traversing 'match_case' node")) {
+                goto failed;
+            }
+            res = obj2ast_stmt(state, tmp2, &val, arena);
+            Py_LeaveRecursiveCall();
+            Py_DECREF(tmp2);
+            if (res != 0) goto failed;
+            if (len != PyList_GET_SIZE(tmp)) {
+                PyErr_SetString(PyExc_RuntimeError, "match_case field \"body\" changed size during iteration");
+                goto failed;
+            }
+            asdl_seq_SET(body, i, val);
+        }
+        Py_CLEAR(tmp);
+    }
+    *out = _PyAST_match_case(pattern, guard, body, arena);
+    return 0;
+failed:
+    Py_XDECREF(tmp);
+    return 1;
+}
+
+int
+obj2ast_pattern(struct ast_state *state, PyObject* obj, pattern_ty* out,
+                PyArena* arena)
+{
+    int isinstance;
+
+    PyObject *tmp = NULL;
+    PyObject *tp;
+    int lineno;
+    int col_offset;
+    int end_lineno;
+    int end_col_offset;
+
+    if (obj == Py_None) {
+        *out = NULL;
+        return 0;
+    }
+    if (_PyObject_LookupAttr(obj, state->lineno, &tmp) < 0) {
+        return 1;
+    }
+    if (tmp == NULL) {
+        PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from pattern");
+        return 1;
+    }
+    else {
+        int res;
+        if (Py_EnterRecursiveCall(" while traversing 'pattern' node")) {
+            goto failed;
+        }
+        res = obj2ast_int(state, tmp, &lineno, arena);
+        Py_LeaveRecursiveCall();
+        if (res != 0) goto failed;
+        Py_CLEAR(tmp);
+    }
+    if (_PyObject_LookupAttr(obj, state->col_offset, &tmp) < 0) {
+        return 1;
+    }
+    if (tmp == NULL) {
+        PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from pattern");
+        return 1;
+    }
+    else {
+        int res;
+        if (Py_EnterRecursiveCall(" while traversing 'pattern' node")) {
+            goto failed;
+        }
+        res = obj2ast_int(state, tmp, &col_offset, arena);
+        Py_LeaveRecursiveCall();
+        if (res != 0) goto failed;
+        Py_CLEAR(tmp);
+    }
+    if (_PyObject_LookupAttr(obj, state->end_lineno, &tmp) < 0) {
+        return 1;
+    }
+    if (tmp == NULL) {
+        PyErr_SetString(PyExc_TypeError, "required field \"end_lineno\" missing from pattern");
+        return 1;
+    }
+    else {
+        int res;
+        if (Py_EnterRecursiveCall(" while traversing 'pattern' node")) {
+            goto failed;
+        }
+        res = obj2ast_int(state, tmp, &end_lineno, arena);
+        Py_LeaveRecursiveCall();
+        if (res != 0) goto failed;
+        Py_CLEAR(tmp);
+    }
+    if (_PyObject_LookupAttr(obj, state->end_col_offset, &tmp) < 0) {
+        return 1;
+    }
+    if (tmp == NULL) {
+        PyErr_SetString(PyExc_TypeError, "required field \"end_col_offset\" missing from pattern");
+        return 1;
+    }
+    else {
+        int res;
+        if (Py_EnterRecursiveCall(" while traversing 'pattern' node")) {
+            goto failed;
+        }
+        res = obj2ast_int(state, tmp, &end_col_offset, arena);
+        Py_LeaveRecursiveCall();
+        if (res != 0) goto failed;
+        Py_CLEAR(tmp);
+    }
+    tp = state->MatchValue_type;
+    isinstance = PyObject_IsInstance(obj, tp);
+    if (isinstance == -1) {
+        return 1;
+    }
+    if (isinstance) {
+        expr_ty value;
+
+        if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) {
+            return 1;
+        }
+        if (tmp == NULL) {
+            PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from MatchValue");
+            return 1;
+        }
+        else {
+            int res;
+            if (Py_EnterRecursiveCall(" while traversing 'MatchValue' node")) {
+                goto failed;
+            }
+            res = obj2ast_expr(state, tmp, &value, arena);
+            Py_LeaveRecursiveCall();
+            if (res != 0) goto failed;
+            Py_CLEAR(tmp);
+        }
+        *out = _PyAST_MatchValue(value, lineno, col_offset, end_lineno,
+                                 end_col_offset, arena);
+        if (*out == NULL) goto failed;
+        return 0;
+    }
+    tp = state->MatchSingleton_type;
+    isinstance = PyObject_IsInstance(obj, tp);
+    if (isinstance == -1) {
+        return 1;
+    }
+    if (isinstance) {
+        constant value;
+
+        if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) {
+            return 1;
+        }
+        if (tmp == NULL) {
+            PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from MatchSingleton");
+            return 1;
+        }
+        else {
+            int res;
+            if (Py_EnterRecursiveCall(" while traversing 'MatchSingleton' node")) {
+                goto failed;
+            }
+            res = obj2ast_constant(state, tmp, &value, arena);
+            Py_LeaveRecursiveCall();
+            if (res != 0) goto failed;
+            Py_CLEAR(tmp);
+        }
+        *out = _PyAST_MatchSingleton(value, lineno, col_offset, end_lineno,
+                                     end_col_offset, arena);
+        if (*out == NULL) goto failed;
+        return 0;
+    }
+    tp = state->MatchSequence_type;
+    isinstance = PyObject_IsInstance(obj, tp);
+    if (isinstance == -1) {
+        return 1;
+    }
+    if (isinstance) {
+        asdl_pattern_seq* patterns;
+
+        if (_PyObject_LookupAttr(obj, state->patterns, &tmp) < 0) {
+            return 1;
+        }
+        if (tmp == NULL) {
+            PyErr_SetString(PyExc_TypeError, "required field \"patterns\" missing from MatchSequence");
+            return 1;
+        }
+        else {
+            int res;
+            Py_ssize_t len;
+            Py_ssize_t i;
+            if (!PyList_Check(tmp)) {
+                PyErr_Format(PyExc_TypeError, "MatchSequence field \"patterns\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
+                goto failed;
+            }
+            len = PyList_GET_SIZE(tmp);
+            patterns = _Py_asdl_pattern_seq_new(len, arena);
+            if (patterns == NULL) goto failed;
+            for (i = 0; i < len; i++) {
+                pattern_ty val;
+                PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
+                Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'MatchSequence' node")) {
+                    goto failed;
+                }
+                res = obj2ast_pattern(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
+                Py_DECREF(tmp2);
+                if (res != 0) goto failed;
+                if (len != PyList_GET_SIZE(tmp)) {
+                    PyErr_SetString(PyExc_RuntimeError, "MatchSequence field \"patterns\" changed size during iteration");
+                    goto failed;
+                }
+                asdl_seq_SET(patterns, i, val);
+            }
+            Py_CLEAR(tmp);
+        }
+        *out = _PyAST_MatchSequence(patterns, lineno, col_offset, end_lineno,
+                                    end_col_offset, arena);
+        if (*out == NULL) goto failed;
+        return 0;
+    }
+    tp = state->MatchMapping_type;
+    isinstance = PyObject_IsInstance(obj, tp);
+    if (isinstance == -1) {
+        return 1;
+    }
+    if (isinstance) {
+        asdl_expr_seq* keys;
+        asdl_pattern_seq* patterns;
+        identifier rest;
+
+        if (_PyObject_LookupAttr(obj, state->keys, &tmp) < 0) {
+            return 1;
+        }
+        if (tmp == NULL) {
+            PyErr_SetString(PyExc_TypeError, "required field \"keys\" missing from MatchMapping");
+            return 1;
+        }
+        else {
+            int res;
+            Py_ssize_t len;
+            Py_ssize_t i;
+            if (!PyList_Check(tmp)) {
+                PyErr_Format(PyExc_TypeError, "MatchMapping field \"keys\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
+                goto failed;
+            }
+            len = PyList_GET_SIZE(tmp);
+            keys = _Py_asdl_expr_seq_new(len, arena);
+            if (keys == NULL) goto failed;
+            for (i = 0; i < len; i++) {
+                expr_ty val;
+                PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
+                Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'MatchMapping' node")) {
+                    goto failed;
+                }
+                res = obj2ast_expr(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
+                Py_DECREF(tmp2);
+                if (res != 0) goto failed;
+                if (len != PyList_GET_SIZE(tmp)) {
+                    PyErr_SetString(PyExc_RuntimeError, "MatchMapping field \"keys\" changed size during iteration");
+                    goto failed;
+                }
+                asdl_seq_SET(keys, i, val);
+            }
+            Py_CLEAR(tmp);
+        }
+        if (_PyObject_LookupAttr(obj, state->patterns, &tmp) < 0) {
+            return 1;
+        }
+        if (tmp == NULL) {
+            PyErr_SetString(PyExc_TypeError, "required field \"patterns\" missing from MatchMapping");
+            return 1;
+        }
+        else {
+            int res;
+            Py_ssize_t len;
+            Py_ssize_t i;
+            if (!PyList_Check(tmp)) {
+                PyErr_Format(PyExc_TypeError, "MatchMapping field \"patterns\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
+                goto failed;
+            }
+            len = PyList_GET_SIZE(tmp);
+            patterns = _Py_asdl_pattern_seq_new(len, arena);
+            if (patterns == NULL) goto failed;
+            for (i = 0; i < len; i++) {
+                pattern_ty val;
+                PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
+                Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'MatchMapping' node")) {
+                    goto failed;
+                }
+                res = obj2ast_pattern(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
+                Py_DECREF(tmp2);
+                if (res != 0) goto failed;
+                if (len != PyList_GET_SIZE(tmp)) {
+                    PyErr_SetString(PyExc_RuntimeError, "MatchMapping field \"patterns\" changed size during iteration");
+                    goto failed;
+                }
+                asdl_seq_SET(patterns, i, val);
+            }
+            Py_CLEAR(tmp);
+        }
+        if (_PyObject_LookupAttr(obj, state->rest, &tmp) < 0) {
+            return 1;
+        }
+        if (tmp == NULL || tmp == Py_None) {
+            Py_CLEAR(tmp);
+            rest = NULL;
+        }
+        else {
+            int res;
+            if (Py_EnterRecursiveCall(" while traversing 'MatchMapping' node")) {
+                goto failed;
+            }
+            res = obj2ast_identifier(state, tmp, &rest, arena);
+            Py_LeaveRecursiveCall();
+            if (res != 0) goto failed;
+            Py_CLEAR(tmp);
+        }
+        *out = _PyAST_MatchMapping(keys, patterns, rest, lineno, col_offset,
+                                   end_lineno, end_col_offset, arena);
+        if (*out == NULL) goto failed;
+        return 0;
+    }
+    tp = state->MatchClass_type;
+    isinstance = PyObject_IsInstance(obj, tp);
+    if (isinstance == -1) {
+        return 1;
+    }
+    if (isinstance) {
+        expr_ty cls;
+        asdl_pattern_seq* patterns;
+        asdl_identifier_seq* kwd_attrs;
+        asdl_pattern_seq* kwd_patterns;
+
+        if (_PyObject_LookupAttr(obj, state->cls, &tmp) < 0) {
+            return 1;
+        }
+        if (tmp == NULL) {
+            PyErr_SetString(PyExc_TypeError, "required field \"cls\" missing from MatchClass");
+            return 1;
+        }
+        else {
+            int res;
+            if (Py_EnterRecursiveCall(" while traversing 'MatchClass' node")) {
+                goto failed;
+            }
+            res = obj2ast_expr(state, tmp, &cls, arena);
+            Py_LeaveRecursiveCall();
+            if (res != 0) goto failed;
+            Py_CLEAR(tmp);
+        }
+        if (_PyObject_LookupAttr(obj, state->patterns, &tmp) < 0) {
+            return 1;
+        }
+        if (tmp == NULL) {
+            PyErr_SetString(PyExc_TypeError, "required field \"patterns\" missing from MatchClass");
+            return 1;
+        }
+        else {
+            int res;
+            Py_ssize_t len;
+            Py_ssize_t i;
+            if (!PyList_Check(tmp)) {
+                PyErr_Format(PyExc_TypeError, "MatchClass field \"patterns\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
+                goto failed;
+            }
+            len = PyList_GET_SIZE(tmp);
+            patterns = _Py_asdl_pattern_seq_new(len, arena);
+            if (patterns == NULL) goto failed;
+            for (i = 0; i < len; i++) {
+                pattern_ty val;
+                PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
+                Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'MatchClass' node")) {
+                    goto failed;
+                }
+                res = obj2ast_pattern(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
+                Py_DECREF(tmp2);
+                if (res != 0) goto failed;
+                if (len != PyList_GET_SIZE(tmp)) {
+                    PyErr_SetString(PyExc_RuntimeError, "MatchClass field \"patterns\" changed size during iteration");
+                    goto failed;
+                }
+                asdl_seq_SET(patterns, i, val);
+            }
+            Py_CLEAR(tmp);
+        }
+        if (_PyObject_LookupAttr(obj, state->kwd_attrs, &tmp) < 0) {
+            return 1;
+        }
+        if (tmp == NULL) {
+            PyErr_SetString(PyExc_TypeError, "required field \"kwd_attrs\" missing from MatchClass");
+            return 1;
+        }
+        else {
+            int res;
+            Py_ssize_t len;
+            Py_ssize_t i;
+            if (!PyList_Check(tmp)) {
+                PyErr_Format(PyExc_TypeError, "MatchClass field \"kwd_attrs\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
+                goto failed;
+            }
+            len = PyList_GET_SIZE(tmp);
+            kwd_attrs = _Py_asdl_identifier_seq_new(len, arena);
+            if (kwd_attrs == NULL) goto failed;
+            for (i = 0; i < len; i++) {
+                identifier val;
+                PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
+                Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'MatchClass' node")) {
+                    goto failed;
+                }
+                res = obj2ast_identifier(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
+                Py_DECREF(tmp2);
+                if (res != 0) goto failed;
+                if (len != PyList_GET_SIZE(tmp)) {
+                    PyErr_SetString(PyExc_RuntimeError, "MatchClass field \"kwd_attrs\" changed size during iteration");
+                    goto failed;
+                }
+                asdl_seq_SET(kwd_attrs, i, val);
+            }
+            Py_CLEAR(tmp);
+        }
+        if (_PyObject_LookupAttr(obj, state->kwd_patterns, &tmp) < 0) {
+            return 1;
+        }
+        if (tmp == NULL) {
+            PyErr_SetString(PyExc_TypeError, "required field \"kwd_patterns\" missing from MatchClass");
+            return 1;
+        }
+        else {
+            int res;
+            Py_ssize_t len;
+            Py_ssize_t i;
+            if (!PyList_Check(tmp)) {
+                PyErr_Format(PyExc_TypeError, "MatchClass field \"kwd_patterns\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
+                goto failed;
+            }
+            len = PyList_GET_SIZE(tmp);
+            kwd_patterns = _Py_asdl_pattern_seq_new(len, arena);
+            if (kwd_patterns == NULL) goto failed;
+            for (i = 0; i < len; i++) {
+                pattern_ty val;
+                PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
+                Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'MatchClass' node")) {
+                    goto failed;
+                }
+                res = obj2ast_pattern(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
+                Py_DECREF(tmp2);
+                if (res != 0) goto failed;
+                if (len != PyList_GET_SIZE(tmp)) {
+                    PyErr_SetString(PyExc_RuntimeError, "MatchClass field \"kwd_patterns\" changed size during iteration");
+                    goto failed;
+                }
+                asdl_seq_SET(kwd_patterns, i, val);
+            }
+            Py_CLEAR(tmp);
+        }
+        *out = _PyAST_MatchClass(cls, patterns, kwd_attrs, kwd_patterns,
+                                 lineno, col_offset, end_lineno,
+                                 end_col_offset, arena);
+        if (*out == NULL) goto failed;
+        return 0;
+    }
+    tp = state->MatchStar_type;
+    isinstance = PyObject_IsInstance(obj, tp);
+    if (isinstance == -1) {
+        return 1;
+    }
+    if (isinstance) {
+        identifier name;
+
+        if (_PyObject_LookupAttr(obj, state->name, &tmp) < 0) {
+            return 1;
+        }
+        if (tmp == NULL || tmp == Py_None) {
+            Py_CLEAR(tmp);
+            name = NULL;
+        }
+        else {
+            int res;
+            if (Py_EnterRecursiveCall(" while traversing 'MatchStar' node")) {
+                goto failed;
+            }
+            res = obj2ast_identifier(state, tmp, &name, arena);
+            Py_LeaveRecursiveCall();
+            if (res != 0) goto failed;
+            Py_CLEAR(tmp);
+        }
+        *out = _PyAST_MatchStar(name, lineno, col_offset, end_lineno,
+                                end_col_offset, arena);
+        if (*out == NULL) goto failed;
+        return 0;
+    }
+    tp = state->MatchAs_type;
+    isinstance = PyObject_IsInstance(obj, tp);
+    if (isinstance == -1) {
+        return 1;
+    }
+    if (isinstance) {
+        pattern_ty pattern;
+        identifier name;
+
+        if (_PyObject_LookupAttr(obj, state->pattern, &tmp) < 0) {
+            return 1;
+        }
+        if (tmp == NULL || tmp == Py_None) {
+            Py_CLEAR(tmp);
+            pattern = NULL;
+        }
+        else {
+            int res;
+            if (Py_EnterRecursiveCall(" while traversing 'MatchAs' node")) {
+                goto failed;
+            }
+            res = obj2ast_pattern(state, tmp, &pattern, arena);
+            Py_LeaveRecursiveCall();
+            if (res != 0) goto failed;
+            Py_CLEAR(tmp);
+        }
+        if (_PyObject_LookupAttr(obj, state->name, &tmp) < 0) {
+            return 1;
+        }
+        if (tmp == NULL || tmp == Py_None) {
+            Py_CLEAR(tmp);
+            name = NULL;
+        }
+        else {
+            int res;
+            if (Py_EnterRecursiveCall(" while traversing 'MatchAs' node")) {
+                goto failed;
+            }
+            res = obj2ast_identifier(state, tmp, &name, arena);
+            Py_LeaveRecursiveCall();
+            if (res != 0) goto failed;
+            Py_CLEAR(tmp);
+        }
+        *out = _PyAST_MatchAs(pattern, name, lineno, col_offset, end_lineno,
+                              end_col_offset, arena);
+        if (*out == NULL) goto failed;
+        return 0;
+    }
+    tp = state->MatchOr_type;
+    isinstance = PyObject_IsInstance(obj, tp);
+    if (isinstance == -1) {
+        return 1;
+    }
+    if (isinstance) {
+        asdl_pattern_seq* patterns;
+
+        if (_PyObject_LookupAttr(obj, state->patterns, &tmp) < 0) {
+            return 1;
+        }
+        if (tmp == NULL) {
+            PyErr_SetString(PyExc_TypeError, "required field \"patterns\" missing from MatchOr");
+            return 1;
+        }
+        else {
+            int res;
+            Py_ssize_t len;
+            Py_ssize_t i;
+            if (!PyList_Check(tmp)) {
+                PyErr_Format(PyExc_TypeError, "MatchOr field \"patterns\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp)));
+                goto failed;
+            }
+            len = PyList_GET_SIZE(tmp);
+            patterns = _Py_asdl_pattern_seq_new(len, arena);
+            if (patterns == NULL) goto failed;
+            for (i = 0; i < len; i++) {
+                pattern_ty val;
+                PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
+                Py_INCREF(tmp2);
+                if (Py_EnterRecursiveCall(" while traversing 'MatchOr' node")) {
+                    goto failed;
+                }
+                res = obj2ast_pattern(state, tmp2, &val, arena);
+                Py_LeaveRecursiveCall();
+                Py_DECREF(tmp2);
+                if (res != 0) goto failed;
+                if (len != PyList_GET_SIZE(tmp)) {
+                    PyErr_SetString(PyExc_RuntimeError, "MatchOr field \"patterns\" changed size during iteration");
+                    goto failed;
+                }
+                asdl_seq_SET(patterns, i, val);
+            }
+            Py_CLEAR(tmp);
+        }
+        *out = _PyAST_MatchOr(patterns, lineno, col_offset, end_lineno,
+                              end_col_offset, arena);
+        if (*out == NULL) goto failed;
+        return 0;
+    }
+
+    PyErr_Format(PyExc_TypeError, "expected some sort of pattern, but got %R", obj);
+    failed:
+    Py_XDECREF(tmp);
+    return 1;
+}
+
+int
+obj2ast_type_ignore(struct ast_state *state, PyObject* obj, type_ignore_ty*
+                    out, PyArena* arena)
 {
     int isinstance;
 
@@ -9600,7 +11557,11 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'TypeIgnore' node")) {
+                goto failed;
+            }
             res = obj2ast_int(state, tmp, &lineno, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
@@ -9613,11 +11574,15 @@
         }
         else {
             int res;
+            if (Py_EnterRecursiveCall(" while traversing 'TypeIgnore' node")) {
+                goto failed;
+            }
             res = obj2ast_string(state, tmp, &tag, arena);
+            Py_LeaveRecursiveCall();
             if (res != 0) goto failed;
             Py_CLEAR(tmp);
         }
-        *out = TypeIgnore(lineno, tag, arena);
+        *out = _PyAST_TypeIgnore(lineno, tag, arena);
         if (*out == NULL) goto failed;
         return 0;
     }
@@ -9632,15 +11597,13 @@
 static int
 astmodule_exec(PyObject *m)
 {
-    astmodulestate *state = get_ast_state(m);
-
-    if (!init_types(state)) {
+    struct ast_state *state = get_ast_state();
+    if (state == NULL) {
         return -1;
     }
-    if (PyModule_AddObject(m, "AST", state->AST_type) < 0) {
+    if (PyModule_AddObjectRef(m, "AST", state->AST_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->AST_type);
     if (PyModule_AddIntMacro(m, PyCF_ALLOW_TOP_LEVEL_AWAIT) < 0) {
         return -1;
     }
@@ -9650,432 +11613,368 @@
     if (PyModule_AddIntMacro(m, PyCF_TYPE_COMMENTS) < 0) {
         return -1;
     }
-    if (PyModule_AddObject(m, "mod", state->mod_type) < 0) {
+    if (PyModule_AddObjectRef(m, "mod", state->mod_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->mod_type);
-    if (PyModule_AddObject(m, "Module", state->Module_type) < 0) {
+    if (PyModule_AddObjectRef(m, "Module", state->Module_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->Module_type);
-    if (PyModule_AddObject(m, "Interactive", state->Interactive_type) < 0) {
+    if (PyModule_AddObjectRef(m, "Interactive", state->Interactive_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->Interactive_type);
-    if (PyModule_AddObject(m, "Expression", state->Expression_type) < 0) {
+    if (PyModule_AddObjectRef(m, "Expression", state->Expression_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->Expression_type);
-    if (PyModule_AddObject(m, "FunctionType", state->FunctionType_type) < 0) {
+    if (PyModule_AddObjectRef(m, "FunctionType", state->FunctionType_type) < 0)
+        {
         return -1;
     }
-    Py_INCREF(state->FunctionType_type);
-    if (PyModule_AddObject(m, "stmt", state->stmt_type) < 0) {
+    if (PyModule_AddObjectRef(m, "stmt", state->stmt_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->stmt_type);
-    if (PyModule_AddObject(m, "FunctionDef", state->FunctionDef_type) < 0) {
+    if (PyModule_AddObjectRef(m, "FunctionDef", state->FunctionDef_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->FunctionDef_type);
-    if (PyModule_AddObject(m, "AsyncFunctionDef", state->AsyncFunctionDef_type)
+    if (PyModule_AddObjectRef(m, "AsyncFunctionDef",
+        state->AsyncFunctionDef_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "ClassDef", state->ClassDef_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "Return", state->Return_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "Delete", state->Delete_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "Assign", state->Assign_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "AugAssign", state->AugAssign_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "AnnAssign", state->AnnAssign_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "For", state->For_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "AsyncFor", state->AsyncFor_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "While", state->While_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "If", state->If_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "With", state->With_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "AsyncWith", state->AsyncWith_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "Match", state->Match_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "Raise", state->Raise_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "Try", state->Try_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "Assert", state->Assert_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "Import", state->Import_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "ImportFrom", state->ImportFrom_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "Global", state->Global_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "Nonlocal", state->Nonlocal_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "Expr", state->Expr_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "Pass", state->Pass_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "Break", state->Break_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "Continue", state->Continue_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "expr", state->expr_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "BoolOp", state->BoolOp_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "NamedExpr", state->NamedExpr_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "BinOp", state->BinOp_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "UnaryOp", state->UnaryOp_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "Lambda", state->Lambda_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "IfExp", state->IfExp_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "Dict", state->Dict_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "Set", state->Set_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "ListComp", state->ListComp_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "SetComp", state->SetComp_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "DictComp", state->DictComp_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "GeneratorExp", state->GeneratorExp_type) < 0)
+        {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "Await", state->Await_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "Yield", state->Yield_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "YieldFrom", state->YieldFrom_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "Compare", state->Compare_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "Call", state->Call_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "FormattedValue", state->FormattedValue_type)
         < 0) {
         return -1;
     }
-    Py_INCREF(state->AsyncFunctionDef_type);
-    if (PyModule_AddObject(m, "ClassDef", state->ClassDef_type) < 0) {
+    if (PyModule_AddObjectRef(m, "JoinedStr", state->JoinedStr_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->ClassDef_type);
-    if (PyModule_AddObject(m, "Return", state->Return_type) < 0) {
+    if (PyModule_AddObjectRef(m, "Constant", state->Constant_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->Return_type);
-    if (PyModule_AddObject(m, "Delete", state->Delete_type) < 0) {
+    if (PyModule_AddObjectRef(m, "Attribute", state->Attribute_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->Delete_type);
-    if (PyModule_AddObject(m, "Assign", state->Assign_type) < 0) {
+    if (PyModule_AddObjectRef(m, "Subscript", state->Subscript_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->Assign_type);
-    if (PyModule_AddObject(m, "AugAssign", state->AugAssign_type) < 0) {
+    if (PyModule_AddObjectRef(m, "Starred", state->Starred_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->AugAssign_type);
-    if (PyModule_AddObject(m, "AnnAssign", state->AnnAssign_type) < 0) {
+    if (PyModule_AddObjectRef(m, "Name", state->Name_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->AnnAssign_type);
-    if (PyModule_AddObject(m, "For", state->For_type) < 0) {
+    if (PyModule_AddObjectRef(m, "List", state->List_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->For_type);
-    if (PyModule_AddObject(m, "AsyncFor", state->AsyncFor_type) < 0) {
+    if (PyModule_AddObjectRef(m, "Tuple", state->Tuple_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->AsyncFor_type);
-    if (PyModule_AddObject(m, "While", state->While_type) < 0) {
+    if (PyModule_AddObjectRef(m, "Slice", state->Slice_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->While_type);
-    if (PyModule_AddObject(m, "If", state->If_type) < 0) {
+    if (PyModule_AddObjectRef(m, "expr_context", state->expr_context_type) < 0)
+        {
         return -1;
     }
-    Py_INCREF(state->If_type);
-    if (PyModule_AddObject(m, "With", state->With_type) < 0) {
+    if (PyModule_AddObjectRef(m, "Load", state->Load_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->With_type);
-    if (PyModule_AddObject(m, "AsyncWith", state->AsyncWith_type) < 0) {
+    if (PyModule_AddObjectRef(m, "Store", state->Store_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->AsyncWith_type);
-    if (PyModule_AddObject(m, "Raise", state->Raise_type) < 0) {
+    if (PyModule_AddObjectRef(m, "Del", state->Del_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->Raise_type);
-    if (PyModule_AddObject(m, "Try", state->Try_type) < 0) {
+    if (PyModule_AddObjectRef(m, "boolop", state->boolop_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->Try_type);
-    if (PyModule_AddObject(m, "Assert", state->Assert_type) < 0) {
+    if (PyModule_AddObjectRef(m, "And", state->And_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->Assert_type);
-    if (PyModule_AddObject(m, "Import", state->Import_type) < 0) {
+    if (PyModule_AddObjectRef(m, "Or", state->Or_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->Import_type);
-    if (PyModule_AddObject(m, "ImportFrom", state->ImportFrom_type) < 0) {
+    if (PyModule_AddObjectRef(m, "operator", state->operator_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->ImportFrom_type);
-    if (PyModule_AddObject(m, "Global", state->Global_type) < 0) {
+    if (PyModule_AddObjectRef(m, "Add", state->Add_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->Global_type);
-    if (PyModule_AddObject(m, "Nonlocal", state->Nonlocal_type) < 0) {
+    if (PyModule_AddObjectRef(m, "Sub", state->Sub_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->Nonlocal_type);
-    if (PyModule_AddObject(m, "Expr", state->Expr_type) < 0) {
+    if (PyModule_AddObjectRef(m, "Mult", state->Mult_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->Expr_type);
-    if (PyModule_AddObject(m, "Pass", state->Pass_type) < 0) {
+    if (PyModule_AddObjectRef(m, "MatMult", state->MatMult_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->Pass_type);
-    if (PyModule_AddObject(m, "Break", state->Break_type) < 0) {
+    if (PyModule_AddObjectRef(m, "Div", state->Div_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->Break_type);
-    if (PyModule_AddObject(m, "Continue", state->Continue_type) < 0) {
+    if (PyModule_AddObjectRef(m, "Mod", state->Mod_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->Continue_type);
-    if (PyModule_AddObject(m, "expr", state->expr_type) < 0) {
+    if (PyModule_AddObjectRef(m, "Pow", state->Pow_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->expr_type);
-    if (PyModule_AddObject(m, "BoolOp", state->BoolOp_type) < 0) {
+    if (PyModule_AddObjectRef(m, "LShift", state->LShift_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->BoolOp_type);
-    if (PyModule_AddObject(m, "NamedExpr", state->NamedExpr_type) < 0) {
+    if (PyModule_AddObjectRef(m, "RShift", state->RShift_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->NamedExpr_type);
-    if (PyModule_AddObject(m, "BinOp", state->BinOp_type) < 0) {
+    if (PyModule_AddObjectRef(m, "BitOr", state->BitOr_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->BinOp_type);
-    if (PyModule_AddObject(m, "UnaryOp", state->UnaryOp_type) < 0) {
+    if (PyModule_AddObjectRef(m, "BitXor", state->BitXor_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->UnaryOp_type);
-    if (PyModule_AddObject(m, "Lambda", state->Lambda_type) < 0) {
+    if (PyModule_AddObjectRef(m, "BitAnd", state->BitAnd_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->Lambda_type);
-    if (PyModule_AddObject(m, "IfExp", state->IfExp_type) < 0) {
+    if (PyModule_AddObjectRef(m, "FloorDiv", state->FloorDiv_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->IfExp_type);
-    if (PyModule_AddObject(m, "Dict", state->Dict_type) < 0) {
+    if (PyModule_AddObjectRef(m, "unaryop", state->unaryop_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->Dict_type);
-    if (PyModule_AddObject(m, "Set", state->Set_type) < 0) {
+    if (PyModule_AddObjectRef(m, "Invert", state->Invert_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->Set_type);
-    if (PyModule_AddObject(m, "ListComp", state->ListComp_type) < 0) {
+    if (PyModule_AddObjectRef(m, "Not", state->Not_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->ListComp_type);
-    if (PyModule_AddObject(m, "SetComp", state->SetComp_type) < 0) {
+    if (PyModule_AddObjectRef(m, "UAdd", state->UAdd_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->SetComp_type);
-    if (PyModule_AddObject(m, "DictComp", state->DictComp_type) < 0) {
+    if (PyModule_AddObjectRef(m, "USub", state->USub_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->DictComp_type);
-    if (PyModule_AddObject(m, "GeneratorExp", state->GeneratorExp_type) < 0) {
+    if (PyModule_AddObjectRef(m, "cmpop", state->cmpop_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->GeneratorExp_type);
-    if (PyModule_AddObject(m, "Await", state->Await_type) < 0) {
+    if (PyModule_AddObjectRef(m, "Eq", state->Eq_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->Await_type);
-    if (PyModule_AddObject(m, "Yield", state->Yield_type) < 0) {
+    if (PyModule_AddObjectRef(m, "NotEq", state->NotEq_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->Yield_type);
-    if (PyModule_AddObject(m, "YieldFrom", state->YieldFrom_type) < 0) {
+    if (PyModule_AddObjectRef(m, "Lt", state->Lt_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->YieldFrom_type);
-    if (PyModule_AddObject(m, "Compare", state->Compare_type) < 0) {
+    if (PyModule_AddObjectRef(m, "LtE", state->LtE_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->Compare_type);
-    if (PyModule_AddObject(m, "Call", state->Call_type) < 0) {
+    if (PyModule_AddObjectRef(m, "Gt", state->Gt_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->Call_type);
-    if (PyModule_AddObject(m, "FormattedValue", state->FormattedValue_type) <
+    if (PyModule_AddObjectRef(m, "GtE", state->GtE_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "Is", state->Is_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "IsNot", state->IsNot_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "In", state->In_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "NotIn", state->NotIn_type) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(m, "comprehension", state->comprehension_type) <
         0) {
         return -1;
     }
-    Py_INCREF(state->FormattedValue_type);
-    if (PyModule_AddObject(m, "JoinedStr", state->JoinedStr_type) < 0) {
+    if (PyModule_AddObjectRef(m, "excepthandler", state->excepthandler_type) <
+        0) {
         return -1;
     }
-    Py_INCREF(state->JoinedStr_type);
-    if (PyModule_AddObject(m, "Constant", state->Constant_type) < 0) {
+    if (PyModule_AddObjectRef(m, "ExceptHandler", state->ExceptHandler_type) <
+        0) {
         return -1;
     }
-    Py_INCREF(state->Constant_type);
-    if (PyModule_AddObject(m, "Attribute", state->Attribute_type) < 0) {
+    if (PyModule_AddObjectRef(m, "arguments", state->arguments_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->Attribute_type);
-    if (PyModule_AddObject(m, "Subscript", state->Subscript_type) < 0) {
+    if (PyModule_AddObjectRef(m, "arg", state->arg_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->Subscript_type);
-    if (PyModule_AddObject(m, "Starred", state->Starred_type) < 0) {
+    if (PyModule_AddObjectRef(m, "keyword", state->keyword_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->Starred_type);
-    if (PyModule_AddObject(m, "Name", state->Name_type) < 0) {
+    if (PyModule_AddObjectRef(m, "alias", state->alias_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->Name_type);
-    if (PyModule_AddObject(m, "List", state->List_type) < 0) {
+    if (PyModule_AddObjectRef(m, "withitem", state->withitem_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->List_type);
-    if (PyModule_AddObject(m, "Tuple", state->Tuple_type) < 0) {
+    if (PyModule_AddObjectRef(m, "match_case", state->match_case_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->Tuple_type);
-    if (PyModule_AddObject(m, "Slice", state->Slice_type) < 0) {
+    if (PyModule_AddObjectRef(m, "pattern", state->pattern_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->Slice_type);
-    if (PyModule_AddObject(m, "expr_context", state->expr_context_type) < 0) {
+    if (PyModule_AddObjectRef(m, "MatchValue", state->MatchValue_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->expr_context_type);
-    if (PyModule_AddObject(m, "Load", state->Load_type) < 0) {
+    if (PyModule_AddObjectRef(m, "MatchSingleton", state->MatchSingleton_type)
+        < 0) {
         return -1;
     }
-    Py_INCREF(state->Load_type);
-    if (PyModule_AddObject(m, "Store", state->Store_type) < 0) {
+    if (PyModule_AddObjectRef(m, "MatchSequence", state->MatchSequence_type) <
+        0) {
         return -1;
     }
-    Py_INCREF(state->Store_type);
-    if (PyModule_AddObject(m, "Del", state->Del_type) < 0) {
+    if (PyModule_AddObjectRef(m, "MatchMapping", state->MatchMapping_type) < 0)
+        {
         return -1;
     }
-    Py_INCREF(state->Del_type);
-    if (PyModule_AddObject(m, "boolop", state->boolop_type) < 0) {
+    if (PyModule_AddObjectRef(m, "MatchClass", state->MatchClass_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->boolop_type);
-    if (PyModule_AddObject(m, "And", state->And_type) < 0) {
+    if (PyModule_AddObjectRef(m, "MatchStar", state->MatchStar_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->And_type);
-    if (PyModule_AddObject(m, "Or", state->Or_type) < 0) {
+    if (PyModule_AddObjectRef(m, "MatchAs", state->MatchAs_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->Or_type);
-    if (PyModule_AddObject(m, "operator", state->operator_type) < 0) {
+    if (PyModule_AddObjectRef(m, "MatchOr", state->MatchOr_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->operator_type);
-    if (PyModule_AddObject(m, "Add", state->Add_type) < 0) {
+    if (PyModule_AddObjectRef(m, "type_ignore", state->type_ignore_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->Add_type);
-    if (PyModule_AddObject(m, "Sub", state->Sub_type) < 0) {
+    if (PyModule_AddObjectRef(m, "TypeIgnore", state->TypeIgnore_type) < 0) {
         return -1;
     }
-    Py_INCREF(state->Sub_type);
-    if (PyModule_AddObject(m, "Mult", state->Mult_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->Mult_type);
-    if (PyModule_AddObject(m, "MatMult", state->MatMult_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->MatMult_type);
-    if (PyModule_AddObject(m, "Div", state->Div_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->Div_type);
-    if (PyModule_AddObject(m, "Mod", state->Mod_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->Mod_type);
-    if (PyModule_AddObject(m, "Pow", state->Pow_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->Pow_type);
-    if (PyModule_AddObject(m, "LShift", state->LShift_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->LShift_type);
-    if (PyModule_AddObject(m, "RShift", state->RShift_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->RShift_type);
-    if (PyModule_AddObject(m, "BitOr", state->BitOr_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->BitOr_type);
-    if (PyModule_AddObject(m, "BitXor", state->BitXor_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->BitXor_type);
-    if (PyModule_AddObject(m, "BitAnd", state->BitAnd_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->BitAnd_type);
-    if (PyModule_AddObject(m, "FloorDiv", state->FloorDiv_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->FloorDiv_type);
-    if (PyModule_AddObject(m, "unaryop", state->unaryop_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->unaryop_type);
-    if (PyModule_AddObject(m, "Invert", state->Invert_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->Invert_type);
-    if (PyModule_AddObject(m, "Not", state->Not_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->Not_type);
-    if (PyModule_AddObject(m, "UAdd", state->UAdd_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->UAdd_type);
-    if (PyModule_AddObject(m, "USub", state->USub_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->USub_type);
-    if (PyModule_AddObject(m, "cmpop", state->cmpop_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->cmpop_type);
-    if (PyModule_AddObject(m, "Eq", state->Eq_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->Eq_type);
-    if (PyModule_AddObject(m, "NotEq", state->NotEq_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->NotEq_type);
-    if (PyModule_AddObject(m, "Lt", state->Lt_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->Lt_type);
-    if (PyModule_AddObject(m, "LtE", state->LtE_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->LtE_type);
-    if (PyModule_AddObject(m, "Gt", state->Gt_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->Gt_type);
-    if (PyModule_AddObject(m, "GtE", state->GtE_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->GtE_type);
-    if (PyModule_AddObject(m, "Is", state->Is_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->Is_type);
-    if (PyModule_AddObject(m, "IsNot", state->IsNot_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->IsNot_type);
-    if (PyModule_AddObject(m, "In", state->In_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->In_type);
-    if (PyModule_AddObject(m, "NotIn", state->NotIn_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->NotIn_type);
-    if (PyModule_AddObject(m, "comprehension", state->comprehension_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->comprehension_type);
-    if (PyModule_AddObject(m, "excepthandler", state->excepthandler_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->excepthandler_type);
-    if (PyModule_AddObject(m, "ExceptHandler", state->ExceptHandler_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->ExceptHandler_type);
-    if (PyModule_AddObject(m, "arguments", state->arguments_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->arguments_type);
-    if (PyModule_AddObject(m, "arg", state->arg_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->arg_type);
-    if (PyModule_AddObject(m, "keyword", state->keyword_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->keyword_type);
-    if (PyModule_AddObject(m, "alias", state->alias_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->alias_type);
-    if (PyModule_AddObject(m, "withitem", state->withitem_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->withitem_type);
-    if (PyModule_AddObject(m, "type_ignore", state->type_ignore_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->type_ignore_type);
-    if (PyModule_AddObject(m, "TypeIgnore", state->TypeIgnore_type) < 0) {
-        return -1;
-    }
-    Py_INCREF(state->TypeIgnore_type);
     return 0;
 }
 
@@ -10087,7 +11986,7 @@
 static struct PyModuleDef _astmodule = {
     PyModuleDef_HEAD_INIT,
     .m_name = "_ast",
-    // The _ast module uses a global state (global_ast_state).
+    // The _ast module uses a per-interpreter state (PyInterpreterState.ast)
     .m_size = 0,
     .m_slots = astmodule_slots,
 };
@@ -10101,7 +12000,7 @@
 
 PyObject* PyAST_mod2obj(mod_ty t)
 {
-    astmodulestate *state = get_global_ast_state();
+    struct ast_state *state = get_ast_state();
     if (state == NULL) {
         return NULL;
     }
@@ -10118,7 +12017,11 @@
         return NULL;
     }
 
-    astmodulestate *state = get_global_ast_state();
+    struct ast_state *state = get_ast_state();
+    if (state == NULL) {
+        return NULL;
+    }
+
     PyObject *req_type[3];
     req_type[0] = state->Module_type;
     req_type[1] = state->Expression_type;
@@ -10144,7 +12047,7 @@
 
 int PyAST_Check(PyObject* obj)
 {
-    astmodulestate *state = get_global_ast_state();
+    struct ast_state *state = get_ast_state();
     if (state == NULL) {
         return -1;
     }
diff --git a/Python/_warnings.c b/Python/_warnings.c
index 91a78fe..2c9a2a7 100644
--- a/Python/_warnings.c
+++ b/Python/_warnings.c
@@ -1,6 +1,7 @@
 #include "Python.h"
 #include "pycore_initconfig.h"
 #include "pycore_interp.h"        // PyInterpreterState.warnings
+#include "pycore_long.h"          // _PyLong_GetZero()
 #include "pycore_pyerrors.h"
 #include "pycore_pystate.h"       // _PyThreadState_GET()
 #include "frameobject.h"          // PyFrame_GetBack()
@@ -23,23 +24,20 @@
 
 typedef struct _warnings_runtime_state WarningsState;
 
-/* Forward declaration of the _warnings module definition. */
-static struct PyModuleDef warningsmodule;
-
 _Py_IDENTIFIER(__name__);
 
 /* Given a module object, get its per-module state. */
 static WarningsState *
 warnings_get_state(void)
 {
-    PyThreadState *tstate = _PyThreadState_GET();
-    if (tstate == NULL) {
-        _PyErr_SetString(tstate, PyExc_RuntimeError,
-                          "warnings_get_state: could not identify "
-                          "current interpreter");
+    PyInterpreterState *interp = _PyInterpreterState_GET();
+    if (interp == NULL) {
+        PyErr_SetString(PyExc_RuntimeError,
+                        "warnings_get_state: could not identify "
+                        "current interpreter");
         return NULL;
     }
-    return &tstate->interp->warnings;
+    return &interp->warnings;
 }
 
 /* Clear the given warnings module state. */
@@ -68,13 +66,12 @@
             return NULL;
         }
     } else {
-        modname_obj = Py_None;
-        Py_INCREF(modname_obj);
+        modname_obj = Py_NewRef(Py_None);
     }
 
     /* This assumes the line number is zero for now. */
     PyObject *filter = PyTuple_Pack(5, action_str, Py_None,
-                                    category, modname_obj, _PyLong_Zero);
+                                    category, modname_obj, _PyLong_GetZero());
     Py_DECREF(modname_obj);
     return filter;
 }
@@ -116,37 +113,34 @@
 }
 
 /* Initialize the given warnings module state. */
-static int
-warnings_init_state(WarningsState *st)
+int
+_PyWarnings_InitState(PyInterpreterState *interp)
 {
+    WarningsState *st = &interp->warnings;
+
     if (st->filters == NULL) {
         st->filters = init_filters();
         if (st->filters == NULL) {
-            goto error;
+            return -1;
         }
     }
 
     if (st->once_registry == NULL) {
         st->once_registry = PyDict_New();
         if (st->once_registry == NULL) {
-            goto error;
+            return -1;
         }
     }
 
     if (st->default_action == NULL) {
         st->default_action = PyUnicode_FromString("default");
         if (st->default_action == NULL) {
-            goto error;
+            return -1;
         }
     }
 
     st->filters_version = 0;
-
     return 0;
-
-error:
-    warnings_clear_state(st);
-    return -1;
 }
 
 
@@ -475,7 +469,7 @@
     int rc;
 
     if (add_zero)
-        altkey = PyTuple_Pack(3, text, category, _PyLong_Zero);
+        altkey = PyTuple_Pack(3, text, category, _PyLong_GetZero());
     else
         altkey = PyTuple_Pack(2, text, category);
 
@@ -854,7 +848,7 @@
     }
 
     if (f == NULL) {
-        globals = _PyInterpreterState_GET()->sysdict;
+        globals = tstate->interp->sysdict;
         *filename = PyUnicode_FromString("sys");
         *lineno = 1;
     }
@@ -1356,70 +1350,45 @@
 };
 
 
-static struct PyModuleDef warningsmodule = {
-        PyModuleDef_HEAD_INIT,
-        MODULE_NAME,            /* m_name */
-        warnings__doc__,        /* m_doc */
-        0,                      /* m_size */
-        warnings_functions,     /* m_methods */
-        NULL,                   /* m_reload */
-        NULL,                   /* m_traverse */
-        NULL,                   /* m_clear */
-        NULL                    /* m_free */
+static int
+warnings_module_exec(PyObject *module)
+{
+    WarningsState *st = warnings_get_state();
+    if (st == NULL) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(module, "filters", st->filters) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(module, "_onceregistry", st->once_registry) < 0) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(module, "_defaultaction", st->default_action) < 0) {
+        return -1;
+    }
+    return 0;
+}
+
+
+static PyModuleDef_Slot warnings_slots[] = {
+    {Py_mod_exec, warnings_module_exec},
+    {0, NULL}
 };
 
-
-PyStatus
-_PyWarnings_InitState(PyThreadState *tstate)
-{
-    if (warnings_init_state(&tstate->interp->warnings) < 0) {
-        return _PyStatus_ERR("can't initialize warnings");
-    }
-    return _PyStatus_OK();
-}
+static struct PyModuleDef warnings_module = {
+    PyModuleDef_HEAD_INIT,
+    .m_name = MODULE_NAME,
+    .m_doc = warnings__doc__,
+    .m_size = 0,
+    .m_methods = warnings_functions,
+    .m_slots = warnings_slots,
+};
 
 
 PyMODINIT_FUNC
 _PyWarnings_Init(void)
 {
-    PyObject *m;
-
-    m = PyModule_Create(&warningsmodule);
-    if (m == NULL) {
-        return NULL;
-    }
-
-    WarningsState *st = warnings_get_state();
-    if (st == NULL) {
-        goto error;
-    }
-    if (warnings_init_state(st) < 0) {
-        goto error;
-    }
-
-    Py_INCREF(st->filters);
-    if (PyModule_AddObject(m, "filters", st->filters) < 0) {
-        goto error;
-    }
-
-    Py_INCREF(st->once_registry);
-    if (PyModule_AddObject(m, "_onceregistry", st->once_registry) < 0) {
-        goto error;
-    }
-
-    Py_INCREF(st->default_action);
-    if (PyModule_AddObject(m, "_defaultaction", st->default_action) < 0) {
-        goto error;
-    }
-
-    return m;
-
-error:
-    if (st != NULL) {
-        warnings_clear_state(st);
-    }
-    Py_DECREF(m);
-    return NULL;
+    return PyModuleDef_Init(&warnings_module);
 }
 
 // We need this to ensure that warnings still work until late in finalization.
diff --git a/Python/asdl.c b/Python/asdl.c
index c211078..a7f2180 100644
--- a/Python/asdl.c
+++ b/Python/asdl.c
@@ -1,64 +1,6 @@
 #include "Python.h"
-#include "asdl.h"
+#include "pycore_asdl.h"
 
-asdl_seq *
-_Py_asdl_seq_new(Py_ssize_t size, PyArena *arena)
-{
-    asdl_seq *seq = NULL;
-    size_t n;
-
-    /* check size is sane */
-    if (size < 0 ||
-        (size && (((size_t)size - 1) > (SIZE_MAX / sizeof(void *))))) {
-        PyErr_NoMemory();
-        return NULL;
-    }
-    n = (size ? (sizeof(void *) * (size - 1)) : 0);
-
-    /* check if size can be added safely */
-    if (n > SIZE_MAX - sizeof(asdl_seq)) {
-        PyErr_NoMemory();
-        return NULL;
-    }
-    n += sizeof(asdl_seq);
-
-    seq = (asdl_seq *)PyArena_Malloc(arena, n);
-    if (!seq) {
-        PyErr_NoMemory();
-        return NULL;
-    }
-    memset(seq, 0, n);
-    seq->size = size;
-    return seq;
-}
-
-asdl_int_seq *
-_Py_asdl_int_seq_new(Py_ssize_t size, PyArena *arena)
-{
-    asdl_int_seq *seq = NULL;
-    size_t n;
-
-    /* check size is sane */
-    if (size < 0 ||
-        (size && (((size_t)size - 1) > (SIZE_MAX / sizeof(void *))))) {
-            PyErr_NoMemory();
-            return NULL;
-    }
-    n = (size ? (sizeof(void *) * (size - 1)) : 0);
-
-    /* check if size can be added safely */
-    if (n > SIZE_MAX - sizeof(asdl_seq)) {
-        PyErr_NoMemory();
-        return NULL;
-    }
-    n += sizeof(asdl_seq);
-
-    seq = (asdl_int_seq *)PyArena_Malloc(arena, n);
-    if (!seq) {
-        PyErr_NoMemory();
-        return NULL;
-    }
-    memset(seq, 0, n);
-    seq->size = size;
-    return seq;
-}
+GENERATE_ASDL_SEQ_CONSTRUCTOR(generic, void*);
+GENERATE_ASDL_SEQ_CONSTRUCTOR(identifier, PyObject*);
+GENERATE_ASDL_SEQ_CONSTRUCTOR(int, int);
diff --git a/Python/ast.c b/Python/ast.c
index c7ba4d9..2113124 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -1,25 +1,26 @@
 /*
- * This file includes functions to transform a concrete syntax tree (CST) to
- * an abstract syntax tree (AST). The main function is PyAST_FromNode().
- *
+ * This file exposes PyAST_Validate interface to check the integrity
+ * of the given abstract syntax tree (potentially constructed manually).
  */
 #include "Python.h"
-#include "Python-ast.h"
-#include "node.h"
-#include "ast.h"
-#include "token.h"
-#include "pythonrun.h"
+#include "pycore_ast.h"           // asdl_stmt_seq
+#include "pycore_pystate.h"       // _PyThreadState_GET()
 
 #include <assert.h>
 #include <stdbool.h>
 
-#define MAXLEVEL 200    /* Max parentheses level */
+struct validator {
+    int recursion_depth;            /* current recursion depth */
+    int recursion_limit;            /* recursion limit */
+};
 
-static int validate_stmts(asdl_seq *);
-static int validate_exprs(asdl_seq *, expr_context_ty, int);
-static int validate_nonempty_seq(asdl_seq *, const char *, const char *);
-static int validate_stmt(stmt_ty);
-static int validate_expr(expr_ty, expr_context_ty);
+static int validate_stmts(struct validator *, asdl_stmt_seq *);
+static int validate_exprs(struct validator *, asdl_expr_seq *, expr_context_ty, int);
+static int validate_patterns(struct validator *, asdl_pattern_seq *, int);
+static int _validate_nonempty_seq(asdl_seq *, const char *, const char *);
+static int validate_stmt(struct validator *, stmt_ty);
+static int validate_expr(struct validator *, expr_ty, expr_context_ty);
+static int validate_pattern(struct validator *, pattern_ty, int);
 
 static int
 validate_name(PyObject *name)
@@ -33,7 +34,7 @@
     };
     for (int i = 0; forbidden[i] != NULL; i++) {
         if (_PyUnicode_EqualToASCIIString(name, forbidden[i])) {
-            PyErr_Format(PyExc_ValueError, "Name node can't be used with '%s' constant", forbidden[i]);
+            PyErr_Format(PyExc_ValueError, "identifier field can't represent '%s' constant", forbidden[i]);
             return 0;
         }
     }
@@ -41,7 +42,7 @@
 }
 
 static int
-validate_comprehension(asdl_seq *gens)
+validate_comprehension(struct validator *state, asdl_comprehension_seq *gens)
 {
     Py_ssize_t i;
     if (!asdl_seq_LEN(gens)) {
@@ -50,31 +51,31 @@
     }
     for (i = 0; i < asdl_seq_LEN(gens); i++) {
         comprehension_ty comp = asdl_seq_GET(gens, i);
-        if (!validate_expr(comp->target, Store) ||
-            !validate_expr(comp->iter, Load) ||
-            !validate_exprs(comp->ifs, Load, 0))
+        if (!validate_expr(state, comp->target, Store) ||
+            !validate_expr(state, comp->iter, Load) ||
+            !validate_exprs(state, comp->ifs, Load, 0))
             return 0;
     }
     return 1;
 }
 
 static int
-validate_keywords(asdl_seq *keywords)
+validate_keywords(struct validator *state, asdl_keyword_seq *keywords)
 {
     Py_ssize_t i;
     for (i = 0; i < asdl_seq_LEN(keywords); i++)
-        if (!validate_expr(((keyword_ty)asdl_seq_GET(keywords, i))->value, Load))
+        if (!validate_expr(state, (asdl_seq_GET(keywords, i))->value, Load))
             return 0;
     return 1;
 }
 
 static int
-validate_args(asdl_seq *args)
+validate_args(struct validator *state, asdl_arg_seq *args)
 {
     Py_ssize_t i;
     for (i = 0; i < asdl_seq_LEN(args); i++) {
         arg_ty arg = asdl_seq_GET(args, i);
-        if (arg->annotation && !validate_expr(arg->annotation, Load))
+        if (arg->annotation && !validate_expr(state, arg->annotation, Load))
             return 0;
     }
     return 1;
@@ -90,25 +91,25 @@
         return "Store";
     case Del:
         return "Del";
-    default:
-        Py_UNREACHABLE();
+    // No default case so compiler emits warning for unhandled cases
     }
+    Py_UNREACHABLE();
 }
 
 static int
-validate_arguments(arguments_ty args)
+validate_arguments(struct validator *state, arguments_ty args)
 {
-    if (!validate_args(args->posonlyargs) || !validate_args(args->args)) {
+    if (!validate_args(state, args->posonlyargs) || !validate_args(state, args->args)) {
         return 0;
     }
     if (args->vararg && args->vararg->annotation
-        && !validate_expr(args->vararg->annotation, Load)) {
+        && !validate_expr(state, args->vararg->annotation, Load)) {
             return 0;
     }
-    if (!validate_args(args->kwonlyargs))
+    if (!validate_args(state, args->kwonlyargs))
         return 0;
     if (args->kwarg && args->kwarg->annotation
-        && !validate_expr(args->kwarg->annotation, Load)) {
+        && !validate_expr(state, args->kwarg->annotation, Load)) {
             return 0;
     }
     if (asdl_seq_LEN(args->defaults) > asdl_seq_LEN(args->posonlyargs) + asdl_seq_LEN(args->args)) {
@@ -120,11 +121,11 @@
                         "kw_defaults on arguments");
         return 0;
     }
-    return validate_exprs(args->defaults, Load, 0) && validate_exprs(args->kw_defaults, Load, 1);
+    return validate_exprs(state, args->defaults, Load, 0) && validate_exprs(state, args->kw_defaults, Load, 1);
 }
 
 static int
-validate_constant(PyObject *value)
+validate_constant(struct validator *state, PyObject *value)
 {
     if (value == Py_None || value == Py_Ellipsis)
         return 1;
@@ -138,9 +139,13 @@
         return 1;
 
     if (PyTuple_CheckExact(value) || PyFrozenSet_CheckExact(value)) {
-        PyObject *it;
+        if (++state->recursion_depth > state->recursion_limit) {
+            PyErr_SetString(PyExc_RecursionError,
+                            "maximum recursion depth exceeded during compilation");
+            return 0;
+        }
 
-        it = PyObject_GetIter(value);
+        PyObject *it = PyObject_GetIter(value);
         if (it == NULL)
             return 0;
 
@@ -154,7 +159,7 @@
                 break;
             }
 
-            if (!validate_constant(item)) {
+            if (!validate_constant(state, item)) {
                 Py_DECREF(it);
                 Py_DECREF(item);
                 return 0;
@@ -163,6 +168,7 @@
         }
 
         Py_DECREF(it);
+        --state->recursion_depth;
         return 1;
     }
 
@@ -175,8 +181,14 @@
 }
 
 static int
-validate_expr(expr_ty exp, expr_context_ty ctx)
+validate_expr(struct validator *state, expr_ty exp, expr_context_ty ctx)
 {
+    int ret = -1;
+    if (++state->recursion_depth > state->recursion_limit) {
+        PyErr_SetString(PyExc_RecursionError,
+                        "maximum recursion depth exceeded during compilation");
+        return 0;
+    }
     int check_ctx = 1;
     expr_context_ty actual_ctx;
 
@@ -226,19 +238,24 @@
             PyErr_SetString(PyExc_ValueError, "BoolOp with less than 2 values");
             return 0;
         }
-        return validate_exprs(exp->v.BoolOp.values, Load, 0);
+        ret = validate_exprs(state, exp->v.BoolOp.values, Load, 0);
+        break;
     case BinOp_kind:
-        return validate_expr(exp->v.BinOp.left, Load) &&
-            validate_expr(exp->v.BinOp.right, Load);
+        ret = validate_expr(state, exp->v.BinOp.left, Load) &&
+            validate_expr(state, exp->v.BinOp.right, Load);
+        break;
     case UnaryOp_kind:
-        return validate_expr(exp->v.UnaryOp.operand, Load);
+        ret = validate_expr(state, exp->v.UnaryOp.operand, Load);
+        break;
     case Lambda_kind:
-        return validate_arguments(exp->v.Lambda.args) &&
-            validate_expr(exp->v.Lambda.body, Load);
+        ret = validate_arguments(state, exp->v.Lambda.args) &&
+            validate_expr(state, exp->v.Lambda.body, Load);
+        break;
     case IfExp_kind:
-        return validate_expr(exp->v.IfExp.test, Load) &&
-            validate_expr(exp->v.IfExp.body, Load) &&
-            validate_expr(exp->v.IfExp.orelse, Load);
+        ret = validate_expr(state, exp->v.IfExp.test, Load) &&
+            validate_expr(state, exp->v.IfExp.body, Load) &&
+            validate_expr(state, exp->v.IfExp.orelse, Load);
+        break;
     case Dict_kind:
         if (asdl_seq_LEN(exp->v.Dict.keys) != asdl_seq_LEN(exp->v.Dict.values)) {
             PyErr_SetString(PyExc_ValueError,
@@ -247,28 +264,35 @@
         }
         /* null_ok=1 for keys expressions to allow dict unpacking to work in
            dict literals, i.e. ``{**{a:b}}`` */
-        return validate_exprs(exp->v.Dict.keys, Load, /*null_ok=*/ 1) &&
-            validate_exprs(exp->v.Dict.values, Load, /*null_ok=*/ 0);
+        ret = validate_exprs(state, exp->v.Dict.keys, Load, /*null_ok=*/ 1) &&
+            validate_exprs(state, exp->v.Dict.values, Load, /*null_ok=*/ 0);
+        break;
     case Set_kind:
-        return validate_exprs(exp->v.Set.elts, Load, 0);
+        ret = validate_exprs(state, exp->v.Set.elts, Load, 0);
+        break;
 #define COMP(NAME) \
         case NAME ## _kind: \
-            return validate_comprehension(exp->v.NAME.generators) && \
-                validate_expr(exp->v.NAME.elt, Load);
+            ret = validate_comprehension(state, exp->v.NAME.generators) && \
+                validate_expr(state, exp->v.NAME.elt, Load); \
+            break;
     COMP(ListComp)
     COMP(SetComp)
     COMP(GeneratorExp)
 #undef COMP
     case DictComp_kind:
-        return validate_comprehension(exp->v.DictComp.generators) &&
-            validate_expr(exp->v.DictComp.key, Load) &&
-            validate_expr(exp->v.DictComp.value, Load);
+        ret = validate_comprehension(state, exp->v.DictComp.generators) &&
+            validate_expr(state, exp->v.DictComp.key, Load) &&
+            validate_expr(state, exp->v.DictComp.value, Load);
+        break;
     case Yield_kind:
-        return !exp->v.Yield.value || validate_expr(exp->v.Yield.value, Load);
+        ret = !exp->v.Yield.value || validate_expr(state, exp->v.Yield.value, Load);
+        break;
     case YieldFrom_kind:
-        return validate_expr(exp->v.YieldFrom.value, Load);
+        ret = validate_expr(state, exp->v.YieldFrom.value, Load);
+        break;
     case Await_kind:
-        return validate_expr(exp->v.Await.value, Load);
+        ret = validate_expr(state, exp->v.Await.value, Load);
+        break;
     case Compare_kind:
         if (!asdl_seq_LEN(exp->v.Compare.comparators)) {
             PyErr_SetString(PyExc_ValueError, "Compare with no comparators");
@@ -280,98 +304,411 @@
                             "of comparators and operands");
             return 0;
         }
-        return validate_exprs(exp->v.Compare.comparators, Load, 0) &&
-            validate_expr(exp->v.Compare.left, Load);
+        ret = validate_exprs(state, exp->v.Compare.comparators, Load, 0) &&
+            validate_expr(state, exp->v.Compare.left, Load);
+        break;
     case Call_kind:
-        return validate_expr(exp->v.Call.func, Load) &&
-            validate_exprs(exp->v.Call.args, Load, 0) &&
-            validate_keywords(exp->v.Call.keywords);
+        ret = validate_expr(state, exp->v.Call.func, Load) &&
+            validate_exprs(state, exp->v.Call.args, Load, 0) &&
+            validate_keywords(state, exp->v.Call.keywords);
+        break;
     case Constant_kind:
-        if (!validate_constant(exp->v.Constant.value)) {
+        if (!validate_constant(state, exp->v.Constant.value)) {
             return 0;
         }
-        return 1;
+        ret = 1;
+        break;
     case JoinedStr_kind:
-        return validate_exprs(exp->v.JoinedStr.values, Load, 0);
+        ret = validate_exprs(state, exp->v.JoinedStr.values, Load, 0);
+        break;
     case FormattedValue_kind:
-        if (validate_expr(exp->v.FormattedValue.value, Load) == 0)
+        if (validate_expr(state, exp->v.FormattedValue.value, Load) == 0)
             return 0;
-        if (exp->v.FormattedValue.format_spec)
-            return validate_expr(exp->v.FormattedValue.format_spec, Load);
-        return 1;
+        if (exp->v.FormattedValue.format_spec) {
+            ret = validate_expr(state, exp->v.FormattedValue.format_spec, Load);
+            break;
+        }
+        ret = 1;
+        break;
     case Attribute_kind:
-        return validate_expr(exp->v.Attribute.value, Load);
+        ret = validate_expr(state, exp->v.Attribute.value, Load);
+        break;
     case Subscript_kind:
-        return validate_expr(exp->v.Subscript.slice, Load) &&
-            validate_expr(exp->v.Subscript.value, Load);
+        ret = validate_expr(state, exp->v.Subscript.slice, Load) &&
+            validate_expr(state, exp->v.Subscript.value, Load);
+        break;
     case Starred_kind:
-        return validate_expr(exp->v.Starred.value, ctx);
+        ret = validate_expr(state, exp->v.Starred.value, ctx);
+        break;
     case Slice_kind:
-        return (!exp->v.Slice.lower || validate_expr(exp->v.Slice.lower, Load)) &&
-            (!exp->v.Slice.upper || validate_expr(exp->v.Slice.upper, Load)) &&
-            (!exp->v.Slice.step || validate_expr(exp->v.Slice.step, Load));
+        ret = (!exp->v.Slice.lower || validate_expr(state, exp->v.Slice.lower, Load)) &&
+            (!exp->v.Slice.upper || validate_expr(state, exp->v.Slice.upper, Load)) &&
+            (!exp->v.Slice.step || validate_expr(state, exp->v.Slice.step, Load));
+        break;
     case List_kind:
-        return validate_exprs(exp->v.List.elts, ctx, 0);
+        ret = validate_exprs(state, exp->v.List.elts, ctx, 0);
+        break;
     case Tuple_kind:
-        return validate_exprs(exp->v.Tuple.elts, ctx, 0);
+        ret = validate_exprs(state, exp->v.Tuple.elts, ctx, 0);
+        break;
     case NamedExpr_kind:
-        return validate_expr(exp->v.NamedExpr.value, Load);
+        ret = validate_expr(state, exp->v.NamedExpr.value, Load);
+        break;
     /* This last case doesn't have any checking. */
     case Name_kind:
-        return 1;
+        ret = 1;
+        break;
+    // No default case so compiler emits warning for unhandled cases
     }
-    PyErr_SetString(PyExc_SystemError, "unexpected expression");
+    if (ret < 0) {
+        PyErr_SetString(PyExc_SystemError, "unexpected expression");
+        ret = 0;
+    }
+    state->recursion_depth--;
+    return ret;
+}
+
+
+// Note: the ensure_literal_* functions are only used to validate a restricted
+//       set of non-recursive literals that have already been checked with
+//       validate_expr, so they don't accept the validator state
+static int
+ensure_literal_number(expr_ty exp, bool allow_real, bool allow_imaginary)
+{
+    assert(exp->kind == Constant_kind);
+    PyObject *value = exp->v.Constant.value;
+    return (allow_real && PyFloat_CheckExact(value)) ||
+           (allow_real && PyLong_CheckExact(value)) ||
+           (allow_imaginary && PyComplex_CheckExact(value));
+}
+
+static int
+ensure_literal_negative(expr_ty exp, bool allow_real, bool allow_imaginary)
+{
+    assert(exp->kind == UnaryOp_kind);
+    // Must be negation ...
+    if (exp->v.UnaryOp.op != USub) {
+        return 0;
+    }
+    // ... of a constant ...
+    expr_ty operand = exp->v.UnaryOp.operand;
+    if (operand->kind != Constant_kind) {
+        return 0;
+    }
+    // ... number
+    return ensure_literal_number(operand, allow_real, allow_imaginary);
+}
+
+static int
+ensure_literal_complex(expr_ty exp)
+{
+    assert(exp->kind == BinOp_kind);
+    expr_ty left = exp->v.BinOp.left;
+    expr_ty right = exp->v.BinOp.right;
+    // Ensure op is addition or subtraction
+    if (exp->v.BinOp.op != Add && exp->v.BinOp.op != Sub) {
+        return 0;
+    }
+    // Check LHS is a real number (potentially signed)
+    switch (left->kind)
+    {
+        case Constant_kind:
+            if (!ensure_literal_number(left, /*real=*/true, /*imaginary=*/false)) {
+                return 0;
+            }
+            break;
+        case UnaryOp_kind:
+            if (!ensure_literal_negative(left, /*real=*/true, /*imaginary=*/false)) {
+                return 0;
+            }
+            break;
+        default:
+            return 0;
+    }
+    // Check RHS is an imaginary number (no separate sign allowed)
+    switch (right->kind)
+    {
+        case Constant_kind:
+            if (!ensure_literal_number(right, /*real=*/false, /*imaginary=*/true)) {
+                return 0;
+            }
+            break;
+        default:
+            return 0;
+    }
+    return 1;
+}
+
+static int
+validate_pattern_match_value(struct validator *state, expr_ty exp)
+{
+    if (!validate_expr(state, exp, Load)) {
+        return 0;
+    }
+
+    switch (exp->kind)
+    {
+        case Constant_kind:
+            /* Ellipsis and immutable sequences are not allowed.
+               For True, False and None, MatchSingleton() should
+               be used */
+            if (!validate_expr(state, exp, Load)) {
+                return 0;
+            }
+            PyObject *literal = exp->v.Constant.value;
+            if (PyLong_CheckExact(literal) || PyFloat_CheckExact(literal) ||
+                PyBytes_CheckExact(literal) || PyComplex_CheckExact(literal) ||
+                PyUnicode_CheckExact(literal)) {
+                return 1;
+            }
+            PyErr_SetString(PyExc_ValueError,
+                            "unexpected constant inside of a literal pattern");
+            return 0;
+        case Attribute_kind:
+            // Constants and attribute lookups are always permitted
+            return 1;
+        case UnaryOp_kind:
+            // Negated numbers are permitted (whether real or imaginary)
+            // Compiler will complain if AST folding doesn't create a constant
+            if (ensure_literal_negative(exp, /*real=*/true, /*imaginary=*/true)) {
+                return 1;
+            }
+            break;
+        case BinOp_kind:
+            // Complex literals are permitted
+            // Compiler will complain if AST folding doesn't create a constant
+            if (ensure_literal_complex(exp)) {
+                return 1;
+            }
+            break;
+        case JoinedStr_kind:
+            // Handled in the later stages
+            return 1;
+        default:
+            break;
+    }
+    PyErr_SetString(PyExc_ValueError,
+                    "patterns may only match literals and attribute lookups");
     return 0;
 }
 
 static int
-validate_nonempty_seq(asdl_seq *seq, const char *what, const char *owner)
+validate_capture(PyObject *name)
+{
+    if (_PyUnicode_EqualToASCIIString(name, "_")) {
+        PyErr_Format(PyExc_ValueError, "can't capture name '_' in patterns");
+        return 0;
+    }
+    return validate_name(name);
+}
+
+static int
+validate_pattern(struct validator *state, pattern_ty p, int star_ok)
+{
+    int ret = -1;
+    if (++state->recursion_depth > state->recursion_limit) {
+        PyErr_SetString(PyExc_RecursionError,
+                        "maximum recursion depth exceeded during compilation");
+        return 0;
+    }
+    switch (p->kind) {
+        case MatchValue_kind:
+            ret = validate_pattern_match_value(state, p->v.MatchValue.value);
+            break;
+        case MatchSingleton_kind:
+            ret = p->v.MatchSingleton.value == Py_None || PyBool_Check(p->v.MatchSingleton.value);
+            if (!ret) {
+                PyErr_SetString(PyExc_ValueError,
+                                "MatchSingleton can only contain True, False and None");
+            }
+            break;
+        case MatchSequence_kind:
+            ret = validate_patterns(state, p->v.MatchSequence.patterns, /*star_ok=*/1);
+            break;
+        case MatchMapping_kind:
+            if (asdl_seq_LEN(p->v.MatchMapping.keys) != asdl_seq_LEN(p->v.MatchMapping.patterns)) {
+                PyErr_SetString(PyExc_ValueError,
+                                "MatchMapping doesn't have the same number of keys as patterns");
+                ret = 0;
+                break;
+            }
+
+            if (p->v.MatchMapping.rest && !validate_capture(p->v.MatchMapping.rest)) {
+                ret = 0;
+                break;
+            }
+
+            asdl_expr_seq *keys = p->v.MatchMapping.keys;
+            for (Py_ssize_t i = 0; i < asdl_seq_LEN(keys); i++) {
+                expr_ty key = asdl_seq_GET(keys, i);
+                if (key->kind == Constant_kind) {
+                    PyObject *literal = key->v.Constant.value;
+                    if (literal == Py_None || PyBool_Check(literal)) {
+                        /* validate_pattern_match_value will ensure the key
+                           doesn't contain True, False and None but it is
+                           syntactically valid, so we will pass those on in
+                           a special case. */
+                        continue;
+                    }
+                }
+                if (!validate_pattern_match_value(state, key)) {
+                    ret = 0;
+                    break;
+                }
+            }
+
+            ret = validate_patterns(state, p->v.MatchMapping.patterns, /*star_ok=*/0);
+            break;
+        case MatchClass_kind:
+            if (asdl_seq_LEN(p->v.MatchClass.kwd_attrs) != asdl_seq_LEN(p->v.MatchClass.kwd_patterns)) {
+                PyErr_SetString(PyExc_ValueError,
+                                "MatchClass doesn't have the same number of keyword attributes as patterns");
+                ret = 0;
+                break;
+            }
+            if (!validate_expr(state, p->v.MatchClass.cls, Load)) {
+                ret = 0;
+                break;
+            }
+
+            expr_ty cls = p->v.MatchClass.cls;
+            while (1) {
+                if (cls->kind == Name_kind) {
+                    break;
+                }
+                else if (cls->kind == Attribute_kind) {
+                    cls = cls->v.Attribute.value;
+                    continue;
+                }
+                else {
+                    PyErr_SetString(PyExc_ValueError,
+                                    "MatchClass cls field can only contain Name or Attribute nodes.");
+                    ret = 0;
+                    break;
+                }
+            }
+
+            for (Py_ssize_t i = 0; i < asdl_seq_LEN(p->v.MatchClass.kwd_attrs); i++) {
+                PyObject *identifier = asdl_seq_GET(p->v.MatchClass.kwd_attrs, i);
+                if (!validate_name(identifier)) {
+                    ret = 0;
+                    break;
+                }
+            }
+
+            if (!validate_patterns(state, p->v.MatchClass.patterns, /*star_ok=*/0)) {
+                ret = 0;
+                break;
+            }
+
+            ret = validate_patterns(state, p->v.MatchClass.kwd_patterns, /*star_ok=*/0);
+            break;
+        case MatchStar_kind:
+            if (!star_ok) {
+                PyErr_SetString(PyExc_ValueError, "can't use MatchStar here");
+                ret = 0;
+                break;
+            }
+            ret = p->v.MatchStar.name == NULL || validate_capture(p->v.MatchStar.name);
+            break;
+        case MatchAs_kind:
+            if (p->v.MatchAs.name && !validate_capture(p->v.MatchAs.name)) {
+                ret = 0;
+                break;
+            }
+            if (p->v.MatchAs.pattern == NULL) {
+                ret = 1;
+            }
+            else if (p->v.MatchAs.name == NULL) {
+                PyErr_SetString(PyExc_ValueError,
+                                "MatchAs must specify a target name if a pattern is given");
+                ret = 0;
+            }
+            else {
+                ret = validate_pattern(state, p->v.MatchAs.pattern, /*star_ok=*/0);
+            }
+            break;
+        case MatchOr_kind:
+            if (asdl_seq_LEN(p->v.MatchOr.patterns) < 2) {
+                PyErr_SetString(PyExc_ValueError,
+                                "MatchOr requires at least 2 patterns");
+                ret = 0;
+                break;
+            }
+            ret = validate_patterns(state, p->v.MatchOr.patterns, /*star_ok=*/0);
+            break;
+    // No default case, so the compiler will emit a warning if new pattern
+    // kinds are added without being handled here
+    }
+    if (ret < 0) {
+        PyErr_SetString(PyExc_SystemError, "unexpected pattern");
+        ret = 0;
+    }
+    state->recursion_depth--;
+    return ret;
+}
+
+static int
+_validate_nonempty_seq(asdl_seq *seq, const char *what, const char *owner)
 {
     if (asdl_seq_LEN(seq))
         return 1;
     PyErr_Format(PyExc_ValueError, "empty %s on %s", what, owner);
     return 0;
 }
+#define validate_nonempty_seq(seq, what, owner) _validate_nonempty_seq((asdl_seq*)seq, what, owner)
 
 static int
-validate_assignlist(asdl_seq *targets, expr_context_ty ctx)
+validate_assignlist(struct validator *state, asdl_expr_seq *targets, expr_context_ty ctx)
 {
     return validate_nonempty_seq(targets, "targets", ctx == Del ? "Delete" : "Assign") &&
-        validate_exprs(targets, ctx, 0);
+        validate_exprs(state, targets, ctx, 0);
 }
 
 static int
-validate_body(asdl_seq *body, const char *owner)
+validate_body(struct validator *state, asdl_stmt_seq *body, const char *owner)
 {
-    return validate_nonempty_seq(body, "body", owner) && validate_stmts(body);
+    return validate_nonempty_seq(body, "body", owner) && validate_stmts(state, body);
 }
 
 static int
-validate_stmt(stmt_ty stmt)
+validate_stmt(struct validator *state, stmt_ty stmt)
 {
+    int ret = -1;
     Py_ssize_t i;
+    if (++state->recursion_depth > state->recursion_limit) {
+        PyErr_SetString(PyExc_RecursionError,
+                        "maximum recursion depth exceeded during compilation");
+        return 0;
+    }
     switch (stmt->kind) {
     case FunctionDef_kind:
-        return validate_body(stmt->v.FunctionDef.body, "FunctionDef") &&
-            validate_arguments(stmt->v.FunctionDef.args) &&
-            validate_exprs(stmt->v.FunctionDef.decorator_list, Load, 0) &&
+        ret = validate_body(state, stmt->v.FunctionDef.body, "FunctionDef") &&
+            validate_arguments(state, stmt->v.FunctionDef.args) &&
+            validate_exprs(state, stmt->v.FunctionDef.decorator_list, Load, 0) &&
             (!stmt->v.FunctionDef.returns ||
-             validate_expr(stmt->v.FunctionDef.returns, Load));
+             validate_expr(state, stmt->v.FunctionDef.returns, Load));
+        break;
     case ClassDef_kind:
-        return validate_body(stmt->v.ClassDef.body, "ClassDef") &&
-            validate_exprs(stmt->v.ClassDef.bases, Load, 0) &&
-            validate_keywords(stmt->v.ClassDef.keywords) &&
-            validate_exprs(stmt->v.ClassDef.decorator_list, Load, 0);
+        ret = validate_body(state, stmt->v.ClassDef.body, "ClassDef") &&
+            validate_exprs(state, stmt->v.ClassDef.bases, Load, 0) &&
+            validate_keywords(state, stmt->v.ClassDef.keywords) &&
+            validate_exprs(state, stmt->v.ClassDef.decorator_list, Load, 0);
+        break;
     case Return_kind:
-        return !stmt->v.Return.value || validate_expr(stmt->v.Return.value, Load);
+        ret = !stmt->v.Return.value || validate_expr(state, stmt->v.Return.value, Load);
+        break;
     case Delete_kind:
-        return validate_assignlist(stmt->v.Delete.targets, Del);
+        ret = validate_assignlist(state, stmt->v.Delete.targets, Del);
+        break;
     case Assign_kind:
-        return validate_assignlist(stmt->v.Assign.targets, Store) &&
-            validate_expr(stmt->v.Assign.value, Load);
+        ret = validate_assignlist(state, stmt->v.Assign.targets, Store) &&
+            validate_expr(state, stmt->v.Assign.value, Load);
+        break;
     case AugAssign_kind:
-        return validate_expr(stmt->v.AugAssign.target, Store) &&
-            validate_expr(stmt->v.AugAssign.value, Load);
+        ret = validate_expr(state, stmt->v.AugAssign.target, Store) &&
+            validate_expr(state, stmt->v.AugAssign.value, Load);
+        break;
     case AnnAssign_kind:
         if (stmt->v.AnnAssign.target->kind != Name_kind &&
             stmt->v.AnnAssign.simple) {
@@ -379,60 +716,84 @@
                             "AnnAssign with simple non-Name target");
             return 0;
         }
-        return validate_expr(stmt->v.AnnAssign.target, Store) &&
+        ret = validate_expr(state, stmt->v.AnnAssign.target, Store) &&
                (!stmt->v.AnnAssign.value ||
-                validate_expr(stmt->v.AnnAssign.value, Load)) &&
-               validate_expr(stmt->v.AnnAssign.annotation, Load);
+                validate_expr(state, stmt->v.AnnAssign.value, Load)) &&
+               validate_expr(state, stmt->v.AnnAssign.annotation, Load);
+        break;
     case For_kind:
-        return validate_expr(stmt->v.For.target, Store) &&
-            validate_expr(stmt->v.For.iter, Load) &&
-            validate_body(stmt->v.For.body, "For") &&
-            validate_stmts(stmt->v.For.orelse);
+        ret = validate_expr(state, stmt->v.For.target, Store) &&
+            validate_expr(state, stmt->v.For.iter, Load) &&
+            validate_body(state, stmt->v.For.body, "For") &&
+            validate_stmts(state, stmt->v.For.orelse);
+        break;
     case AsyncFor_kind:
-        return validate_expr(stmt->v.AsyncFor.target, Store) &&
-            validate_expr(stmt->v.AsyncFor.iter, Load) &&
-            validate_body(stmt->v.AsyncFor.body, "AsyncFor") &&
-            validate_stmts(stmt->v.AsyncFor.orelse);
+        ret = validate_expr(state, stmt->v.AsyncFor.target, Store) &&
+            validate_expr(state, stmt->v.AsyncFor.iter, Load) &&
+            validate_body(state, stmt->v.AsyncFor.body, "AsyncFor") &&
+            validate_stmts(state, stmt->v.AsyncFor.orelse);
+        break;
     case While_kind:
-        return validate_expr(stmt->v.While.test, Load) &&
-            validate_body(stmt->v.While.body, "While") &&
-            validate_stmts(stmt->v.While.orelse);
+        ret = validate_expr(state, stmt->v.While.test, Load) &&
+            validate_body(state, stmt->v.While.body, "While") &&
+            validate_stmts(state, stmt->v.While.orelse);
+        break;
     case If_kind:
-        return validate_expr(stmt->v.If.test, Load) &&
-            validate_body(stmt->v.If.body, "If") &&
-            validate_stmts(stmt->v.If.orelse);
+        ret = validate_expr(state, stmt->v.If.test, Load) &&
+            validate_body(state, stmt->v.If.body, "If") &&
+            validate_stmts(state, stmt->v.If.orelse);
+        break;
     case With_kind:
         if (!validate_nonempty_seq(stmt->v.With.items, "items", "With"))
             return 0;
         for (i = 0; i < asdl_seq_LEN(stmt->v.With.items); i++) {
             withitem_ty item = asdl_seq_GET(stmt->v.With.items, i);
-            if (!validate_expr(item->context_expr, Load) ||
-                (item->optional_vars && !validate_expr(item->optional_vars, Store)))
+            if (!validate_expr(state, item->context_expr, Load) ||
+                (item->optional_vars && !validate_expr(state, item->optional_vars, Store)))
                 return 0;
         }
-        return validate_body(stmt->v.With.body, "With");
+        ret = validate_body(state, stmt->v.With.body, "With");
+        break;
     case AsyncWith_kind:
         if (!validate_nonempty_seq(stmt->v.AsyncWith.items, "items", "AsyncWith"))
             return 0;
         for (i = 0; i < asdl_seq_LEN(stmt->v.AsyncWith.items); i++) {
             withitem_ty item = asdl_seq_GET(stmt->v.AsyncWith.items, i);
-            if (!validate_expr(item->context_expr, Load) ||
-                (item->optional_vars && !validate_expr(item->optional_vars, Store)))
+            if (!validate_expr(state, item->context_expr, Load) ||
+                (item->optional_vars && !validate_expr(state, item->optional_vars, Store)))
                 return 0;
         }
-        return validate_body(stmt->v.AsyncWith.body, "AsyncWith");
+        ret = validate_body(state, stmt->v.AsyncWith.body, "AsyncWith");
+        break;
+    case Match_kind:
+        if (!validate_expr(state, stmt->v.Match.subject, Load)
+            || !validate_nonempty_seq(stmt->v.Match.cases, "cases", "Match")) {
+            return 0;
+        }
+        for (i = 0; i < asdl_seq_LEN(stmt->v.Match.cases); i++) {
+            match_case_ty m = asdl_seq_GET(stmt->v.Match.cases, i);
+            if (!validate_pattern(state, m->pattern, /*star_ok=*/0)
+                || (m->guard && !validate_expr(state, m->guard, Load))
+                || !validate_body(state, m->body, "match_case")) {
+                return 0;
+            }
+        }
+        ret = 1;
+        break;
     case Raise_kind:
         if (stmt->v.Raise.exc) {
-            return validate_expr(stmt->v.Raise.exc, Load) &&
-                (!stmt->v.Raise.cause || validate_expr(stmt->v.Raise.cause, Load));
+            ret = validate_expr(state, stmt->v.Raise.exc, Load) &&
+                (!stmt->v.Raise.cause || validate_expr(state, stmt->v.Raise.cause, Load));
+            break;
         }
         if (stmt->v.Raise.cause) {
             PyErr_SetString(PyExc_ValueError, "Raise with cause but no exception");
             return 0;
         }
-        return 1;
+        ret = 1;
+        break;
     case Try_kind:
-        if (!validate_body(stmt->v.Try.body, "Try"))
+        if (!validate_body(state, stmt->v.Try.body, "Try"))
             return 0;
         if (!asdl_seq_LEN(stmt->v.Try.handlers) &&
             !asdl_seq_LEN(stmt->v.Try.finalbody)) {
@@ -447,55 +808,68 @@
         for (i = 0; i < asdl_seq_LEN(stmt->v.Try.handlers); i++) {
             excepthandler_ty handler = asdl_seq_GET(stmt->v.Try.handlers, i);
             if ((handler->v.ExceptHandler.type &&
-                 !validate_expr(handler->v.ExceptHandler.type, Load)) ||
-                !validate_body(handler->v.ExceptHandler.body, "ExceptHandler"))
+                 !validate_expr(state, handler->v.ExceptHandler.type, Load)) ||
+                !validate_body(state, handler->v.ExceptHandler.body, "ExceptHandler"))
                 return 0;
         }
-        return (!asdl_seq_LEN(stmt->v.Try.finalbody) ||
-                validate_stmts(stmt->v.Try.finalbody)) &&
+        ret = (!asdl_seq_LEN(stmt->v.Try.finalbody) ||
+                validate_stmts(state, stmt->v.Try.finalbody)) &&
             (!asdl_seq_LEN(stmt->v.Try.orelse) ||
-             validate_stmts(stmt->v.Try.orelse));
+             validate_stmts(state, stmt->v.Try.orelse));
+        break;
     case Assert_kind:
-        return validate_expr(stmt->v.Assert.test, Load) &&
-            (!stmt->v.Assert.msg || validate_expr(stmt->v.Assert.msg, Load));
+        ret = validate_expr(state, stmt->v.Assert.test, Load) &&
+            (!stmt->v.Assert.msg || validate_expr(state, stmt->v.Assert.msg, Load));
+        break;
     case Import_kind:
-        return validate_nonempty_seq(stmt->v.Import.names, "names", "Import");
+        ret = validate_nonempty_seq(stmt->v.Import.names, "names", "Import");
+        break;
     case ImportFrom_kind:
         if (stmt->v.ImportFrom.level < 0) {
             PyErr_SetString(PyExc_ValueError, "Negative ImportFrom level");
             return 0;
         }
-        return validate_nonempty_seq(stmt->v.ImportFrom.names, "names", "ImportFrom");
+        ret = validate_nonempty_seq(stmt->v.ImportFrom.names, "names", "ImportFrom");
+        break;
     case Global_kind:
-        return validate_nonempty_seq(stmt->v.Global.names, "names", "Global");
+        ret = validate_nonempty_seq(stmt->v.Global.names, "names", "Global");
+        break;
     case Nonlocal_kind:
-        return validate_nonempty_seq(stmt->v.Nonlocal.names, "names", "Nonlocal");
+        ret = validate_nonempty_seq(stmt->v.Nonlocal.names, "names", "Nonlocal");
+        break;
     case Expr_kind:
-        return validate_expr(stmt->v.Expr.value, Load);
+        ret = validate_expr(state, stmt->v.Expr.value, Load);
+        break;
     case AsyncFunctionDef_kind:
-        return validate_body(stmt->v.AsyncFunctionDef.body, "AsyncFunctionDef") &&
-            validate_arguments(stmt->v.AsyncFunctionDef.args) &&
-            validate_exprs(stmt->v.AsyncFunctionDef.decorator_list, Load, 0) &&
+        ret = validate_body(state, stmt->v.AsyncFunctionDef.body, "AsyncFunctionDef") &&
+            validate_arguments(state, stmt->v.AsyncFunctionDef.args) &&
+            validate_exprs(state, stmt->v.AsyncFunctionDef.decorator_list, Load, 0) &&
             (!stmt->v.AsyncFunctionDef.returns ||
-             validate_expr(stmt->v.AsyncFunctionDef.returns, Load));
+             validate_expr(state, stmt->v.AsyncFunctionDef.returns, Load));
+        break;
     case Pass_kind:
     case Break_kind:
     case Continue_kind:
-        return 1;
-    default:
-        PyErr_SetString(PyExc_SystemError, "unexpected statement");
-        return 0;
+        ret = 1;
+        break;
+    // No default case so compiler emits warning for unhandled cases
     }
+    if (ret < 0) {
+        PyErr_SetString(PyExc_SystemError, "unexpected statement");
+        ret = 0;
+    }
+    state->recursion_depth--;
+    return ret;
 }
 
 static int
-validate_stmts(asdl_seq *seq)
+validate_stmts(struct validator *state, asdl_stmt_seq *seq)
 {
     Py_ssize_t i;
     for (i = 0; i < asdl_seq_LEN(seq); i++) {
         stmt_ty stmt = asdl_seq_GET(seq, i);
         if (stmt) {
-            if (!validate_stmt(stmt))
+            if (!validate_stmt(state, stmt))
                 return 0;
         }
         else {
@@ -508,13 +882,13 @@
 }
 
 static int
-validate_exprs(asdl_seq *exprs, expr_context_ty ctx, int null_ok)
+validate_exprs(struct validator *state, asdl_expr_seq *exprs, expr_context_ty ctx, int null_ok)
 {
     Py_ssize_t i;
     for (i = 0; i < asdl_seq_LEN(exprs); i++) {
         expr_ty expr = asdl_seq_GET(exprs, i);
         if (expr) {
-            if (!validate_expr(expr, ctx))
+            if (!validate_expr(state, expr, ctx))
                 return 0;
         }
         else if (!null_ok) {
@@ -527,5326 +901,83 @@
     return 1;
 }
 
-int
-PyAST_Validate(mod_ty mod)
+static int
+validate_patterns(struct validator *state, asdl_pattern_seq *patterns, int star_ok)
 {
-    int res = 0;
+    Py_ssize_t i;
+    for (i = 0; i < asdl_seq_LEN(patterns); i++) {
+        pattern_ty pattern = asdl_seq_GET(patterns, i);
+        if (!validate_pattern(state, pattern, star_ok)) {
+            return 0;
+        }
+    }
+    return 1;
+}
+
+
+/* See comments in symtable.c. */
+#define COMPILER_STACK_FRAME_SCALE 3
+
+int
+_PyAST_Validate(mod_ty mod)
+{
+    int res = -1;
+    struct validator state;
+    PyThreadState *tstate;
+    int recursion_limit = Py_GetRecursionLimit();
+    int starting_recursion_depth;
+
+    /* Setup recursion depth check counters */
+    tstate = _PyThreadState_GET();
+    if (!tstate) {
+        return 0;
+    }
+    /* Be careful here to prevent overflow. */
+    starting_recursion_depth = (tstate->recursion_depth < INT_MAX / COMPILER_STACK_FRAME_SCALE) ?
+        tstate->recursion_depth * COMPILER_STACK_FRAME_SCALE : tstate->recursion_depth;
+    state.recursion_depth = starting_recursion_depth;
+    state.recursion_limit = (recursion_limit < INT_MAX / COMPILER_STACK_FRAME_SCALE) ?
+        recursion_limit * COMPILER_STACK_FRAME_SCALE : recursion_limit;
 
     switch (mod->kind) {
     case Module_kind:
-        res = validate_stmts(mod->v.Module.body);
+        res = validate_stmts(&state, mod->v.Module.body);
         break;
     case Interactive_kind:
-        res = validate_stmts(mod->v.Interactive.body);
+        res = validate_stmts(&state, mod->v.Interactive.body);
         break;
     case Expression_kind:
-        res = validate_expr(mod->v.Expression.body, Load);
+        res = validate_expr(&state, mod->v.Expression.body, Load);
         break;
-    default:
+    case FunctionType_kind:
+        res = validate_exprs(&state, mod->v.FunctionType.argtypes, Load, /*null_ok=*/0) &&
+              validate_expr(&state, mod->v.FunctionType.returns, Load);
+        break;
+    // No default case so compiler emits warning for unhandled cases
+    }
+
+    if (res < 0) {
         PyErr_SetString(PyExc_SystemError, "impossible module node");
-        res = 0;
-        break;
+        return 0;
+    }
+
+    /* Check that the recursion depth counting balanced correctly */
+    if (res && state.recursion_depth != starting_recursion_depth) {
+        PyErr_Format(PyExc_SystemError,
+            "AST validator recursion depth mismatch (before=%d, after=%d)",
+            starting_recursion_depth, state.recursion_depth);
+        return 0;
     }
     return res;
 }
 
-/* This is done here, so defines like "test" don't interfere with AST use above. */
-#include "grammar.h"
-#include "parsetok.h"
-#include "graminit.h"
-
-/* Data structure used internally */
-struct compiling {
-    PyArena *c_arena; /* Arena for allocating memory. */
-    PyObject *c_filename; /* filename */
-    PyObject *c_normalize; /* Normalization function from unicodedata. */
-    int c_feature_version; /* Latest minor version of Python for allowed features */
-};
-
-static asdl_seq *seq_for_testlist(struct compiling *, const node *);
-static expr_ty ast_for_expr(struct compiling *, const node *);
-static stmt_ty ast_for_stmt(struct compiling *, const node *);
-static asdl_seq *ast_for_suite(struct compiling *c, const node *n);
-static asdl_seq *ast_for_exprlist(struct compiling *, const node *,
-                                  expr_context_ty);
-static expr_ty ast_for_testlist(struct compiling *, const node *);
-static stmt_ty ast_for_classdef(struct compiling *, const node *, asdl_seq *);
-
-static stmt_ty ast_for_with_stmt(struct compiling *, const node *, bool);
-static stmt_ty ast_for_for_stmt(struct compiling *, const node *, bool);
-
-/* Note different signature for ast_for_call */
-static expr_ty ast_for_call(struct compiling *, const node *, expr_ty,
-                            const node *, const node *, const node *);
-
-static PyObject *parsenumber(struct compiling *, const char *);
-static expr_ty parsestrplus(struct compiling *, const node *n);
-static void get_last_end_pos(asdl_seq *, int *, int *);
-
-#define COMP_GENEXP   0
-#define COMP_LISTCOMP 1
-#define COMP_SETCOMP  2
-
-static int
-init_normalization(struct compiling *c)
-{
-    PyObject *m = PyImport_ImportModuleNoBlock("unicodedata");
-    if (!m)
-        return 0;
-    c->c_normalize = PyObject_GetAttrString(m, "normalize");
-    Py_DECREF(m);
-    if (!c->c_normalize)
-        return 0;
-    return 1;
-}
-
-static identifier
-new_identifier(const char *n, struct compiling *c)
-{
-    PyObject *id = PyUnicode_DecodeUTF8(n, strlen(n), NULL);
-    if (!id)
-        return NULL;
-    /* PyUnicode_DecodeUTF8 should always return a ready string. */
-    assert(PyUnicode_IS_READY(id));
-    /* Check whether there are non-ASCII characters in the
-       identifier; if so, normalize to NFKC. */
-    if (!PyUnicode_IS_ASCII(id)) {
-        PyObject *id2;
-        if (!c->c_normalize && !init_normalization(c)) {
-            Py_DECREF(id);
-            return NULL;
-        }
-        PyObject *form = PyUnicode_InternFromString("NFKC");
-        if (form == NULL) {
-            Py_DECREF(id);
-            return NULL;
-        }
-        PyObject *args[2] = {form, id};
-        id2 = _PyObject_FastCall(c->c_normalize, args, 2);
-        Py_DECREF(id);
-        Py_DECREF(form);
-        if (!id2)
-            return NULL;
-        if (!PyUnicode_Check(id2)) {
-            PyErr_Format(PyExc_TypeError,
-                         "unicodedata.normalize() must return a string, not "
-                         "%.200s",
-                         _PyType_Name(Py_TYPE(id2)));
-            Py_DECREF(id2);
-            return NULL;
-        }
-        id = id2;
-    }
-    PyUnicode_InternInPlace(&id);
-    if (PyArena_AddPyObject(c->c_arena, id) < 0) {
-        Py_DECREF(id);
-        return NULL;
-    }
-    return id;
-}
-
-#define NEW_IDENTIFIER(n) new_identifier(STR(n), c)
-
-static int
-ast_error(struct compiling *c, const node *n, const char *errmsg, ...)
-{
-    PyObject *value, *errstr, *loc, *tmp;
-    va_list va;
-
-    va_start(va, errmsg);
-    errstr = PyUnicode_FromFormatV(errmsg, va);
-    va_end(va);
-    if (!errstr) {
-        return 0;
-    }
-    loc = PyErr_ProgramTextObject(c->c_filename, LINENO(n));
-    if (!loc) {
-        Py_INCREF(Py_None);
-        loc = Py_None;
-    }
-    tmp = Py_BuildValue("(OiiN)", c->c_filename, LINENO(n), n->n_col_offset + 1, loc);
-    if (!tmp) {
-        Py_DECREF(errstr);
-        return 0;
-    }
-    value = PyTuple_Pack(2, errstr, tmp);
-    Py_DECREF(errstr);
-    Py_DECREF(tmp);
-    if (value) {
-        PyErr_SetObject(PyExc_SyntaxError, value);
-        Py_DECREF(value);
-    }
-    return 0;
-}
-
-/* num_stmts() returns number of contained statements.
-
-   Use this routine to determine how big a sequence is needed for
-   the statements in a parse tree.  Its raison d'etre is this bit of
-   grammar:
-
-   stmt: simple_stmt | compound_stmt
-   simple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE
-
-   A simple_stmt can contain multiple small_stmt elements joined
-   by semicolons.  If the arg is a simple_stmt, the number of
-   small_stmt elements is returned.
-*/
-
-static string
-new_type_comment(const char *s, struct compiling *c)
-{
-    PyObject *res = PyUnicode_DecodeUTF8(s, strlen(s), NULL);
-    if (res == NULL)
-        return NULL;
-    if (PyArena_AddPyObject(c->c_arena, res) < 0) {
-        Py_DECREF(res);
-        return NULL;
-    }
-    return res;
-}
-#define NEW_TYPE_COMMENT(n) new_type_comment(STR(n), c)
-
-static int
-num_stmts(const node *n)
-{
-    int i, l;
-    node *ch;
-
-    switch (TYPE(n)) {
-        case single_input:
-            if (TYPE(CHILD(n, 0)) == NEWLINE)
-                return 0;
-            else
-                return num_stmts(CHILD(n, 0));
-        case file_input:
-            l = 0;
-            for (i = 0; i < NCH(n); i++) {
-                ch = CHILD(n, i);
-                if (TYPE(ch) == stmt)
-                    l += num_stmts(ch);
-            }
-            return l;
-        case stmt:
-            return num_stmts(CHILD(n, 0));
-        case compound_stmt:
-            return 1;
-        case simple_stmt:
-            return NCH(n) / 2; /* Divide by 2 to remove count of semi-colons */
-        case suite:
-        case func_body_suite:
-            /* func_body_suite: simple_stmt | NEWLINE [TYPE_COMMENT NEWLINE] INDENT stmt+ DEDENT */
-            /* suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT */
-            if (NCH(n) == 1)
-                return num_stmts(CHILD(n, 0));
-            else {
-                i = 2;
-                l = 0;
-                if (TYPE(CHILD(n, 1)) == TYPE_COMMENT)
-                    i += 2;
-                for (; i < (NCH(n) - 1); i++)
-                    l += num_stmts(CHILD(n, i));
-                return l;
-            }
-        default: {
-            _Py_FatalErrorFormat(__func__, "Non-statement found: %d %d",
-                                 TYPE(n), NCH(n));
-        }
-    }
-    Py_UNREACHABLE();
-}
-
-/* Transform the CST rooted at node * to the appropriate AST
-*/
-
-mod_ty
-PyAST_FromNodeObject(const node *n, PyCompilerFlags *flags,
-                     PyObject *filename, PyArena *arena)
-{
-    int i, j, k, num;
-    asdl_seq *stmts = NULL;
-    asdl_seq *type_ignores = NULL;
-    stmt_ty s;
-    node *ch;
-    struct compiling c;
-    mod_ty res = NULL;
-    asdl_seq *argtypes = NULL;
-    expr_ty ret, arg;
-
-    c.c_arena = arena;
-    /* borrowed reference */
-    c.c_filename = filename;
-    c.c_normalize = NULL;
-    c.c_feature_version = flags && (flags->cf_flags & PyCF_ONLY_AST) ?
-        flags->cf_feature_version : PY_MINOR_VERSION;
-
-    if (TYPE(n) == encoding_decl)
-        n = CHILD(n, 0);
-
-    k = 0;
-    switch (TYPE(n)) {
-        case file_input:
-            stmts = _Py_asdl_seq_new(num_stmts(n), arena);
-            if (!stmts)
-                goto out;
-            for (i = 0; i < NCH(n) - 1; i++) {
-                ch = CHILD(n, i);
-                if (TYPE(ch) == NEWLINE)
-                    continue;
-                REQ(ch, stmt);
-                num = num_stmts(ch);
-                if (num == 1) {
-                    s = ast_for_stmt(&c, ch);
-                    if (!s)
-                        goto out;
-                    asdl_seq_SET(stmts, k++, s);
-                }
-                else {
-                    ch = CHILD(ch, 0);
-                    REQ(ch, simple_stmt);
-                    for (j = 0; j < num; j++) {
-                        s = ast_for_stmt(&c, CHILD(ch, j * 2));
-                        if (!s)
-                            goto out;
-                        asdl_seq_SET(stmts, k++, s);
-                    }
-                }
-            }
-
-            /* Type ignores are stored under the ENDMARKER in file_input. */
-            ch = CHILD(n, NCH(n) - 1);
-            REQ(ch, ENDMARKER);
-            num = NCH(ch);
-            type_ignores = _Py_asdl_seq_new(num, arena);
-            if (!type_ignores)
-                goto out;
-
-            for (i = 0; i < num; i++) {
-                string type_comment = new_type_comment(STR(CHILD(ch, i)), &c);
-                if (!type_comment)
-                    goto out;
-                type_ignore_ty ti = TypeIgnore(LINENO(CHILD(ch, i)), type_comment, arena);
-                if (!ti)
-                   goto out;
-               asdl_seq_SET(type_ignores, i, ti);
-            }
-
-            res = Module(stmts, type_ignores, arena);
-            break;
-        case eval_input: {
-            expr_ty testlist_ast;
-
-            /* XXX Why not comp_for here? */
-            testlist_ast = ast_for_testlist(&c, CHILD(n, 0));
-            if (!testlist_ast)
-                goto out;
-            res = Expression(testlist_ast, arena);
-            break;
-        }
-        case single_input:
-            if (TYPE(CHILD(n, 0)) == NEWLINE) {
-                stmts = _Py_asdl_seq_new(1, arena);
-                if (!stmts)
-                    goto out;
-                asdl_seq_SET(stmts, 0, Pass(n->n_lineno, n->n_col_offset,
-                                            n->n_end_lineno, n->n_end_col_offset,
-                                            arena));
-                if (!asdl_seq_GET(stmts, 0))
-                    goto out;
-                res = Interactive(stmts, arena);
-            }
-            else {
-                n = CHILD(n, 0);
-                num = num_stmts(n);
-                stmts = _Py_asdl_seq_new(num, arena);
-                if (!stmts)
-                    goto out;
-                if (num == 1) {
-                    s = ast_for_stmt(&c, n);
-                    if (!s)
-                        goto out;
-                    asdl_seq_SET(stmts, 0, s);
-                }
-                else {
-                    /* Only a simple_stmt can contain multiple statements. */
-                    REQ(n, simple_stmt);
-                    for (i = 0; i < NCH(n); i += 2) {
-                        if (TYPE(CHILD(n, i)) == NEWLINE)
-                            break;
-                        s = ast_for_stmt(&c, CHILD(n, i));
-                        if (!s)
-                            goto out;
-                        asdl_seq_SET(stmts, i / 2, s);
-                    }
-                }
-
-                res = Interactive(stmts, arena);
-            }
-            break;
-        case func_type_input:
-            n = CHILD(n, 0);
-            REQ(n, func_type);
-
-            if (TYPE(CHILD(n, 1)) == typelist) {
-                ch = CHILD(n, 1);
-                /* this is overly permissive -- we don't pay any attention to
-                 * stars on the args -- just parse them into an ordered list */
-                num = 0;
-                for (i = 0; i < NCH(ch); i++) {
-                    if (TYPE(CHILD(ch, i)) == test) {
-                        num++;
-                    }
-                }
-
-                argtypes = _Py_asdl_seq_new(num, arena);
-                if (!argtypes)
-                    goto out;
-
-                j = 0;
-                for (i = 0; i < NCH(ch); i++) {
-                    if (TYPE(CHILD(ch, i)) == test) {
-                        arg = ast_for_expr(&c, CHILD(ch, i));
-                        if (!arg)
-                            goto out;
-                        asdl_seq_SET(argtypes, j++, arg);
-                    }
-                }
-            }
-            else {
-                argtypes = _Py_asdl_seq_new(0, arena);
-                if (!argtypes)
-                    goto out;
-            }
-
-            ret = ast_for_expr(&c, CHILD(n, NCH(n) - 1));
-            if (!ret)
-                goto out;
-            res = FunctionType(argtypes, ret, arena);
-            break;
-        default:
-            PyErr_Format(PyExc_SystemError,
-                         "invalid node %d for PyAST_FromNode", TYPE(n));
-            goto out;
-    }
- out:
-    if (c.c_normalize) {
-        Py_DECREF(c.c_normalize);
-    }
-    return res;
-}
-
-mod_ty
-PyAST_FromNode(const node *n, PyCompilerFlags *flags, const char *filename_str,
-               PyArena *arena)
-{
-    mod_ty mod;
-    PyObject *filename;
-    filename = PyUnicode_DecodeFSDefault(filename_str);
-    if (filename == NULL)
-        return NULL;
-    mod = PyAST_FromNodeObject(n, flags, filename, arena);
-    Py_DECREF(filename);
-    return mod;
-
-}
-
-/* Return the AST repr. of the operator represented as syntax (|, ^, etc.)
-*/
-
-static operator_ty
-get_operator(struct compiling *c, const node *n)
-{
-    switch (TYPE(n)) {
-        case VBAR:
-            return BitOr;
-        case CIRCUMFLEX:
-            return BitXor;
-        case AMPER:
-            return BitAnd;
-        case LEFTSHIFT:
-            return LShift;
-        case RIGHTSHIFT:
-            return RShift;
-        case PLUS:
-            return Add;
-        case MINUS:
-            return Sub;
-        case STAR:
-            return Mult;
-        case AT:
-            if (c->c_feature_version < 5) {
-                ast_error(c, n,
-                          "The '@' operator is only supported in Python 3.5 and greater");
-                return (operator_ty)0;
-            }
-            return MatMult;
-        case SLASH:
-            return Div;
-        case DOUBLESLASH:
-            return FloorDiv;
-        case PERCENT:
-            return Mod;
-        default:
-            return (operator_ty)0;
-    }
-}
-
-static const char * const FORBIDDEN[] = {
-    "None",
-    "True",
-    "False",
-    "__debug__",
-    NULL,
-};
-
-static int
-forbidden_name(struct compiling *c, identifier name, const node *n,
-               int full_checks)
-{
-    assert(PyUnicode_Check(name));
-    const char * const *p = FORBIDDEN;
-    if (!full_checks) {
-        /* In most cases, the parser will protect True, False, and None
-           from being assign to. */
-        p += 3;
-    }
-    for (; *p; p++) {
-        if (_PyUnicode_EqualToASCIIString(name, *p)) {
-            ast_error(c, n, "cannot assign to %U", name);
-            return 1;
-        }
-    }
-    return 0;
-}
-
-static expr_ty
-copy_location(expr_ty e, const node *n, const node *end)
-{
-    if (e) {
-        e->lineno = LINENO(n);
-        e->col_offset = n->n_col_offset;
-        e->end_lineno = end->n_end_lineno;
-        e->end_col_offset = end->n_end_col_offset;
-    }
-    return e;
-}
-
-static const char *
-get_expr_name(expr_ty e)
-{
-    switch (e->kind) {
-        case Attribute_kind:
-            return "attribute";
-        case Subscript_kind:
-            return "subscript";
-        case Starred_kind:
-            return "starred";
-        case Name_kind:
-            return "name";
-        case List_kind:
-            return "list";
-        case Tuple_kind:
-            return "tuple";
-        case Lambda_kind:
-            return "lambda";
-        case Call_kind:
-            return "function call";
-        case BoolOp_kind:
-        case BinOp_kind:
-        case UnaryOp_kind:
-            return "operator";
-        case GeneratorExp_kind:
-            return "generator expression";
-        case Yield_kind:
-        case YieldFrom_kind:
-            return "yield expression";
-        case Await_kind:
-            return "await expression";
-        case ListComp_kind:
-            return "list comprehension";
-        case SetComp_kind:
-            return "set comprehension";
-        case DictComp_kind:
-            return "dict comprehension";
-        case Dict_kind:
-            return "dict display";
-        case Set_kind:
-            return "set display";
-        case JoinedStr_kind:
-        case FormattedValue_kind:
-            return "f-string expression";
-        case Constant_kind: {
-            PyObject *value = e->v.Constant.value;
-            if (value == Py_None) {
-                return "None";
-            }
-            if (value == Py_False) {
-                return "False";
-            }
-            if (value == Py_True) {
-                return "True";
-            }
-            if (value == Py_Ellipsis) {
-                return "Ellipsis";
-            }
-            return "literal";
-        }
-        case Compare_kind:
-            return "comparison";
-        case IfExp_kind:
-            return "conditional expression";
-        case NamedExpr_kind:
-            return "named expression";
-        default:
-            PyErr_Format(PyExc_SystemError,
-                         "unexpected expression in assignment %d (line %d)",
-                         e->kind, e->lineno);
-            return NULL;
-    }
-}
-
-/* Set the context ctx for expr_ty e, recursively traversing e.
-
-   Only sets context for expr kinds that "can appear in assignment context"
-   (according to ../Parser/Python.asdl).  For other expr kinds, it sets
-   an appropriate syntax error and returns false.
-*/
-
-static int
-set_context(struct compiling *c, expr_ty e, expr_context_ty ctx, const node *n)
-{
-    asdl_seq *s = NULL;
-
-    /* Expressions in an augmented assignment have a Store context. */
-
-    switch (e->kind) {
-        case Attribute_kind:
-            e->v.Attribute.ctx = ctx;
-            if (ctx == Store && forbidden_name(c, e->v.Attribute.attr, n, 1))
-                return 0;
-            break;
-        case Subscript_kind:
-            e->v.Subscript.ctx = ctx;
-            break;
-        case Starred_kind:
-            e->v.Starred.ctx = ctx;
-            if (!set_context(c, e->v.Starred.value, ctx, n))
-                return 0;
-            break;
-        case Name_kind:
-            if (ctx == Store) {
-                if (forbidden_name(c, e->v.Name.id, n, 0))
-                    return 0; /* forbidden_name() calls ast_error() */
-            }
-            e->v.Name.ctx = ctx;
-            break;
-        case List_kind:
-            e->v.List.ctx = ctx;
-            s = e->v.List.elts;
-            break;
-        case Tuple_kind:
-            e->v.Tuple.ctx = ctx;
-            s = e->v.Tuple.elts;
-            break;
-        default: {
-            const char *expr_name = get_expr_name(e);
-            if (expr_name != NULL) {
-                ast_error(c, n, "cannot %s %s",
-                          ctx == Store ? "assign to" : "delete",
-                          expr_name);
-            }
-            return 0;
-        }
-    }
-
-    /* If the LHS is a list or tuple, we need to set the assignment
-       context for all the contained elements.
-    */
-    if (s) {
-        Py_ssize_t i;
-
-        for (i = 0; i < asdl_seq_LEN(s); i++) {
-            if (!set_context(c, (expr_ty)asdl_seq_GET(s, i), ctx, n))
-                return 0;
-        }
-    }
-    return 1;
-}
-
-static operator_ty
-ast_for_augassign(struct compiling *c, const node *n)
-{
-    REQ(n, augassign);
-    n = CHILD(n, 0);
-    switch (STR(n)[0]) {
-        case '+':
-            return Add;
-        case '-':
-            return Sub;
-        case '/':
-            if (STR(n)[1] == '/')
-                return FloorDiv;
-            else
-                return Div;
-        case '%':
-            return Mod;
-        case '<':
-            return LShift;
-        case '>':
-            return RShift;
-        case '&':
-            return BitAnd;
-        case '^':
-            return BitXor;
-        case '|':
-            return BitOr;
-        case '*':
-            if (STR(n)[1] == '*')
-                return Pow;
-            else
-                return Mult;
-        case '@':
-            if (c->c_feature_version < 5) {
-                ast_error(c, n,
-                          "The '@' operator is only supported in Python 3.5 and greater");
-                return (operator_ty)0;
-            }
-            return MatMult;
-        default:
-            PyErr_Format(PyExc_SystemError, "invalid augassign: %s", STR(n));
-            return (operator_ty)0;
-    }
-}
-
-static cmpop_ty
-ast_for_comp_op(struct compiling *c, const node *n)
-{
-    /* comp_op: '<'|'>'|'=='|'>='|'<='|'!='|'in'|'not' 'in'|'is'
-               |'is' 'not'
-    */
-    REQ(n, comp_op);
-    if (NCH(n) == 1) {
-        n = CHILD(n, 0);
-        switch (TYPE(n)) {
-            case LESS:
-                return Lt;
-            case GREATER:
-                return Gt;
-            case EQEQUAL:                       /* == */
-                return Eq;
-            case LESSEQUAL:
-                return LtE;
-            case GREATEREQUAL:
-                return GtE;
-            case NOTEQUAL:
-                return NotEq;
-            case NAME:
-                if (strcmp(STR(n), "in") == 0)
-                    return In;
-                if (strcmp(STR(n), "is") == 0)
-                    return Is;
-                /* fall through */
-            default:
-                PyErr_Format(PyExc_SystemError, "invalid comp_op: %s",
-                             STR(n));
-                return (cmpop_ty)0;
-        }
-    }
-    else if (NCH(n) == 2) {
-        /* handle "not in" and "is not" */
-        switch (TYPE(CHILD(n, 0))) {
-            case NAME:
-                if (strcmp(STR(CHILD(n, 1)), "in") == 0)
-                    return NotIn;
-                if (strcmp(STR(CHILD(n, 0)), "is") == 0)
-                    return IsNot;
-                /* fall through */
-            default:
-                PyErr_Format(PyExc_SystemError, "invalid comp_op: %s %s",
-                             STR(CHILD(n, 0)), STR(CHILD(n, 1)));
-                return (cmpop_ty)0;
-        }
-    }
-    PyErr_Format(PyExc_SystemError, "invalid comp_op: has %d children",
-                 NCH(n));
-    return (cmpop_ty)0;
-}
-
-static asdl_seq *
-seq_for_testlist(struct compiling *c, const node *n)
-{
-    /* testlist: test (',' test)* [',']
-       testlist_star_expr: test|star_expr (',' test|star_expr)* [',']
-    */
-    asdl_seq *seq;
-    expr_ty expression;
-    int i;
-    assert(TYPE(n) == testlist || TYPE(n) == testlist_star_expr || TYPE(n) == testlist_comp);
-
-    seq = _Py_asdl_seq_new((NCH(n) + 1) / 2, c->c_arena);
-    if (!seq)
-        return NULL;
-
-    for (i = 0; i < NCH(n); i += 2) {
-        const node *ch = CHILD(n, i);
-        assert(TYPE(ch) == test || TYPE(ch) == test_nocond || TYPE(ch) == star_expr || TYPE(ch) == namedexpr_test);
-
-        expression = ast_for_expr(c, ch);
-        if (!expression)
-            return NULL;
-
-        assert(i / 2 < seq->size);
-        asdl_seq_SET(seq, i / 2, expression);
-    }
-    return seq;
-}
-
-static arg_ty
-ast_for_arg(struct compiling *c, const node *n)
-{
-    identifier name;
-    expr_ty annotation = NULL;
-    node *ch;
-    arg_ty ret;
-
-    assert(TYPE(n) == tfpdef || TYPE(n) == vfpdef);
-    ch = CHILD(n, 0);
-    name = NEW_IDENTIFIER(ch);
-    if (!name)
-        return NULL;
-    if (forbidden_name(c, name, ch, 0))
-        return NULL;
-
-    if (NCH(n) == 3 && TYPE(CHILD(n, 1)) == COLON) {
-        annotation = ast_for_expr(c, CHILD(n, 2));
-        if (!annotation)
-            return NULL;
-    }
-
-    ret = arg(name, annotation, NULL, LINENO(n), n->n_col_offset,
-              n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-    if (!ret)
-        return NULL;
-    return ret;
-}
-
-/* returns -1 if failed to handle keyword only arguments
-   returns new position to keep processing if successful
-               (',' tfpdef ['=' test])*
-                     ^^^
-   start pointing here
- */
-static int
-handle_keywordonly_args(struct compiling *c, const node *n, int start,
-                        asdl_seq *kwonlyargs, asdl_seq *kwdefaults)
-{
-    PyObject *argname;
-    node *ch;
-    expr_ty expression, annotation;
-    arg_ty arg = NULL;
-    int i = start;
-    int j = 0; /* index for kwdefaults and kwonlyargs */
-
-    if (kwonlyargs == NULL) {
-        ast_error(c, CHILD(n, start), "named arguments must follow bare *");
-        return -1;
-    }
-    assert(kwdefaults != NULL);
-    while (i < NCH(n)) {
-        ch = CHILD(n, i);
-        switch (TYPE(ch)) {
-            case vfpdef:
-            case tfpdef:
-                if (i + 1 < NCH(n) && TYPE(CHILD(n, i + 1)) == EQUAL) {
-                    expression = ast_for_expr(c, CHILD(n, i + 2));
-                    if (!expression)
-                        goto error;
-                    asdl_seq_SET(kwdefaults, j, expression);
-                    i += 2; /* '=' and test */
-                }
-                else { /* setting NULL if no default value exists */
-                    asdl_seq_SET(kwdefaults, j, NULL);
-                }
-                if (NCH(ch) == 3) {
-                    /* ch is NAME ':' test */
-                    annotation = ast_for_expr(c, CHILD(ch, 2));
-                    if (!annotation)
-                        goto error;
-                }
-                else {
-                    annotation = NULL;
-                }
-                ch = CHILD(ch, 0);
-                argname = NEW_IDENTIFIER(ch);
-                if (!argname)
-                    goto error;
-                if (forbidden_name(c, argname, ch, 0))
-                    goto error;
-                arg = arg(argname, annotation, NULL, LINENO(ch), ch->n_col_offset,
-                          ch->n_end_lineno, ch->n_end_col_offset,
-                          c->c_arena);
-                if (!arg)
-                    goto error;
-                asdl_seq_SET(kwonlyargs, j++, arg);
-                i += 1; /* the name */
-                if (i < NCH(n) && TYPE(CHILD(n, i)) == COMMA)
-                    i += 1; /* the comma, if present */
-                break;
-            case TYPE_COMMENT:
-                /* arg will be equal to the last argument processed */
-                arg->type_comment = NEW_TYPE_COMMENT(ch);
-                if (!arg->type_comment)
-                    goto error;
-                i += 1;
-                break;
-            case DOUBLESTAR:
-                return i;
-            default:
-                ast_error(c, ch, "unexpected node");
-                goto error;
-        }
-    }
-    return i;
- error:
-    return -1;
-}
-
-/* Create AST for argument list. */
-
-static arguments_ty
-ast_for_arguments(struct compiling *c, const node *n)
-{
-    /* This function handles both typedargslist (function definition)
-       and varargslist (lambda definition).
-
-       parameters: '(' [typedargslist] ')'
-
-       The following definition for typedarglist is equivalent to this set of rules:
-
-         arguments = argument (',' [TYPE_COMMENT] argument)*
-         argument = tfpdef ['=' test]
-         kwargs = '**' tfpdef [','] [TYPE_COMMENT]
-         args = '*' [tfpdef]
-         kwonly_kwargs = (',' [TYPE_COMMENT] argument)* (TYPE_COMMENT | [','
-                         [TYPE_COMMENT] [kwargs]])
-         args_kwonly_kwargs = args kwonly_kwargs | kwargs
-         poskeyword_args_kwonly_kwargs = arguments ( TYPE_COMMENT | [','
-                                         [TYPE_COMMENT] [args_kwonly_kwargs]])
-         typedargslist_no_posonly  = poskeyword_args_kwonly_kwargs | args_kwonly_kwargs
-         typedarglist = (arguments ',' [TYPE_COMMENT] '/' [',' [[TYPE_COMMENT]
-                        typedargslist_no_posonly]])|(typedargslist_no_posonly)"
-
-       typedargslist: ( (tfpdef ['=' test] (',' [TYPE_COMMENT] tfpdef ['=' test])*
-           ',' [TYPE_COMMENT] '/' [',' [ [TYPE_COMMENT] tfpdef ['=' test] ( ','
-           [TYPE_COMMENT] tfpdef ['=' test])* (TYPE_COMMENT | [',' [TYPE_COMMENT] [ '*'
-           [tfpdef] (',' [TYPE_COMMENT] tfpdef ['=' test])* (TYPE_COMMENT | [','
-           [TYPE_COMMENT] ['**' tfpdef [','] [TYPE_COMMENT]]]) | '**' tfpdef [',']
-           [TYPE_COMMENT]]]) | '*' [tfpdef] (',' [TYPE_COMMENT] tfpdef ['=' test])*
-           (TYPE_COMMENT | [',' [TYPE_COMMENT] ['**' tfpdef [','] [TYPE_COMMENT]]]) |
-           '**' tfpdef [','] [TYPE_COMMENT]]] ) |  (tfpdef ['=' test] (','
-           [TYPE_COMMENT] tfpdef ['=' test])* (TYPE_COMMENT | [',' [TYPE_COMMENT] [ '*'
-           [tfpdef] (',' [TYPE_COMMENT] tfpdef ['=' test])* (TYPE_COMMENT | [','
-           [TYPE_COMMENT] ['**' tfpdef [','] [TYPE_COMMENT]]]) | '**' tfpdef [',']
-           [TYPE_COMMENT]]]) | '*' [tfpdef] (',' [TYPE_COMMENT] tfpdef ['=' test])*
-           (TYPE_COMMENT | [',' [TYPE_COMMENT] ['**' tfpdef [','] [TYPE_COMMENT]]]) |
-           '**' tfpdef [','] [TYPE_COMMENT]))
-
-       tfpdef: NAME [':' test]
-
-       The following definition for varargslist is equivalent to this set of rules:
-
-         arguments = argument (',' argument )*
-         argument = vfpdef ['=' test]
-         kwargs = '**' vfpdef [',']
-         args = '*' [vfpdef]
-         kwonly_kwargs = (',' argument )* [',' [kwargs]]
-         args_kwonly_kwargs = args kwonly_kwargs | kwargs
-         poskeyword_args_kwonly_kwargs = arguments [',' [args_kwonly_kwargs]]
-         vararglist_no_posonly = poskeyword_args_kwonly_kwargs | args_kwonly_kwargs
-         varargslist = arguments ',' '/' [','[(vararglist_no_posonly)]] |
-                       (vararglist_no_posonly)
-
-       varargslist: vfpdef ['=' test ](',' vfpdef ['=' test])* ',' '/' [',' [ (vfpdef ['='
-           test] (',' vfpdef ['=' test])* [',' [ '*' [vfpdef] (',' vfpdef ['=' test])* [','
-           ['**' vfpdef [',']]] | '**' vfpdef [',']]] | '*' [vfpdef] (',' vfpdef ['=' test])*
-           [',' ['**' vfpdef [',']]] | '**' vfpdef [',']) ]] | (vfpdef ['=' test] (',' vfpdef
-           ['=' test])* [',' [ '*' [vfpdef] (',' vfpdef ['=' test])* [',' ['**' vfpdef [',']]]
-           | '**' vfpdef [',']]] | '*' [vfpdef] (',' vfpdef ['=' test])* [',' ['**' vfpdef
-           [',']]] | '**' vfpdef [','])
-
-       vfpdef: NAME
-
-    */
-    int i, j, k, l, nposonlyargs=0, nposargs = 0, nkwonlyargs = 0;
-    int nposdefaults = 0, found_default = 0;
-    asdl_seq *posonlyargs, *posargs, *posdefaults, *kwonlyargs, *kwdefaults;
-    arg_ty vararg = NULL, kwarg = NULL;
-    arg_ty arg = NULL;
-    node *ch;
-
-    if (TYPE(n) == parameters) {
-        if (NCH(n) == 2) /* () as argument list */
-            return arguments(NULL, NULL, NULL, NULL, NULL, NULL, NULL, c->c_arena);
-        n = CHILD(n, 1);
-    }
-    assert(TYPE(n) == typedargslist || TYPE(n) == varargslist);
-
-    /* First count the number of positional args & defaults.  The
-       variable i is the loop index for this for loop and the next.
-       The next loop picks up where the first leaves off.
-    */
-    for (i = 0; i < NCH(n); i++) {
-        ch = CHILD(n, i);
-        if (TYPE(ch) == STAR) {
-            /* skip star */
-            i++;
-            if (i < NCH(n) && /* skip argument following star */
-                (TYPE(CHILD(n, i)) == tfpdef ||
-                 TYPE(CHILD(n, i)) == vfpdef)) {
-                i++;
-            }
-            break;
-        }
-        if (TYPE(ch) == DOUBLESTAR) break;
-        if (TYPE(ch) == vfpdef || TYPE(ch) == tfpdef) nposargs++;
-        if (TYPE(ch) == EQUAL) nposdefaults++;
-        if (TYPE(ch) == SLASH ) {
-            nposonlyargs = nposargs;
-            nposargs = 0;
-        }
-    }
-    /* count the number of keyword only args &
-       defaults for keyword only args */
-    for ( ; i < NCH(n); ++i) {
-        ch = CHILD(n, i);
-        if (TYPE(ch) == DOUBLESTAR) break;
-        if (TYPE(ch) == tfpdef || TYPE(ch) == vfpdef) nkwonlyargs++;
-    }
-    posonlyargs = (nposonlyargs ? _Py_asdl_seq_new(nposonlyargs, c->c_arena) : NULL);
-    if (!posonlyargs && nposonlyargs) {
-        return NULL;
-    }
-    posargs = (nposargs ? _Py_asdl_seq_new(nposargs, c->c_arena) : NULL);
-    if (!posargs && nposargs)
-        return NULL;
-    kwonlyargs = (nkwonlyargs ?
-                   _Py_asdl_seq_new(nkwonlyargs, c->c_arena) : NULL);
-    if (!kwonlyargs && nkwonlyargs)
-        return NULL;
-    posdefaults = (nposdefaults ?
-                    _Py_asdl_seq_new(nposdefaults, c->c_arena) : NULL);
-    if (!posdefaults && nposdefaults)
-        return NULL;
-    /* The length of kwonlyargs and kwdefaults are same
-       since we set NULL as default for keyword only argument w/o default
-       - we have sequence data structure, but no dictionary */
-    kwdefaults = (nkwonlyargs ?
-                   _Py_asdl_seq_new(nkwonlyargs, c->c_arena) : NULL);
-    if (!kwdefaults && nkwonlyargs)
-        return NULL;
-
-    /* tfpdef: NAME [':' test]
-       vfpdef: NAME
-    */
-    i = 0;
-    j = 0;  /* index for defaults */
-    k = 0;  /* index for args */
-    l = 0;  /* index for posonlyargs */
-    while (i < NCH(n)) {
-        ch = CHILD(n, i);
-        switch (TYPE(ch)) {
-            case tfpdef:
-            case vfpdef:
-                /* XXX Need to worry about checking if TYPE(CHILD(n, i+1)) is
-                   anything other than EQUAL or a comma? */
-                /* XXX Should NCH(n) check be made a separate check? */
-                if (i + 1 < NCH(n) && TYPE(CHILD(n, i + 1)) == EQUAL) {
-                    expr_ty expression = ast_for_expr(c, CHILD(n, i + 2));
-                    if (!expression)
-                        return NULL;
-                    assert(posdefaults != NULL);
-                    asdl_seq_SET(posdefaults, j++, expression);
-                    i += 2;
-                    found_default = 1;
-                }
-                else if (found_default) {
-                    ast_error(c, n,
-                              "non-default argument follows default argument");
-                    return NULL;
-                }
-                arg = ast_for_arg(c, ch);
-                if (!arg)
-                    return NULL;
-                if (l < nposonlyargs) {
-                    asdl_seq_SET(posonlyargs, l++, arg);
-                } else {
-                    asdl_seq_SET(posargs, k++, arg);
-                }
-                i += 1; /* the name */
-                if (i < NCH(n) && TYPE(CHILD(n, i)) == COMMA)
-                    i += 1; /* the comma, if present */
-                break;
-             case SLASH:
-                /* Advance the slash and the comma. If there are more names
-                 * after the slash there will be a comma so we are advancing
-                 * the correct number of nodes. If the slash is the last item,
-                 * we will be advancing an extra token but then * i > NCH(n)
-                 * and the enclosing while will finish correctly. */
-                i += 2;
-                break;
-            case STAR:
-                if (i+1 >= NCH(n) ||
-                    (i+2 == NCH(n) && (TYPE(CHILD(n, i+1)) == COMMA
-                                       || TYPE(CHILD(n, i+1)) == TYPE_COMMENT))) {
-                    ast_error(c, CHILD(n, i),
-                              "named arguments must follow bare *");
-                    return NULL;
-                }
-                ch = CHILD(n, i+1);  /* tfpdef or COMMA */
-                if (TYPE(ch) == COMMA) {
-                    int res = 0;
-                    i += 2; /* now follows keyword only arguments */
-
-                    if (i < NCH(n) && TYPE(CHILD(n, i)) == TYPE_COMMENT) {
-                        ast_error(c, CHILD(n, i),
-                                  "bare * has associated type comment");
-                        return NULL;
-                    }
-
-                    res = handle_keywordonly_args(c, n, i,
-                                                  kwonlyargs, kwdefaults);
-                    if (res == -1) return NULL;
-                    i = res; /* res has new position to process */
-                }
-                else {
-                    vararg = ast_for_arg(c, ch);
-                    if (!vararg)
-                        return NULL;
-
-                i += 2; /* the star and the name */
-                if (i < NCH(n) && TYPE(CHILD(n, i)) == COMMA)
-                    i += 1; /* the comma, if present */
-
-                if (i < NCH(n) && TYPE(CHILD(n, i)) == TYPE_COMMENT) {
-                        vararg->type_comment = NEW_TYPE_COMMENT(CHILD(n, i));
-                        if (!vararg->type_comment)
-                            return NULL;
-                        i += 1;
-                    }
-
-                    if (i < NCH(n) && (TYPE(CHILD(n, i)) == tfpdef
-                                    || TYPE(CHILD(n, i)) == vfpdef)) {
-                        int res = 0;
-                        res = handle_keywordonly_args(c, n, i,
-                                                      kwonlyargs, kwdefaults);
-                        if (res == -1) return NULL;
-                        i = res; /* res has new position to process */
-                    }
-                }
-                break;
-            case DOUBLESTAR:
-                ch = CHILD(n, i+1);  /* tfpdef */
-                assert(TYPE(ch) == tfpdef || TYPE(ch) == vfpdef);
-                kwarg = ast_for_arg(c, ch);
-                if (!kwarg)
-                    return NULL;
-                i += 2; /* the double star and the name */
-                if (i < NCH(n) && TYPE(CHILD(n, i)) == COMMA)
-                    i += 1; /* the comma, if present */
-                break;
-            case TYPE_COMMENT:
-                assert(i);
-
-                if (kwarg)
-                    arg = kwarg;
-
-                /* arg will be equal to the last argument processed */
-                arg->type_comment = NEW_TYPE_COMMENT(ch);
-                if (!arg->type_comment)
-                    return NULL;
-                i += 1;
-                break;
-            default:
-                PyErr_Format(PyExc_SystemError,
-                             "unexpected node in varargslist: %d @ %d",
-                             TYPE(ch), i);
-                return NULL;
-        }
-    }
-    return arguments(posonlyargs, posargs, vararg, kwonlyargs, kwdefaults, kwarg, posdefaults, c->c_arena);
-}
-
-static expr_ty
-ast_for_decorator(struct compiling *c, const node *n)
-{
-    /* decorator: '@' namedexpr_test NEWLINE */
-
-    REQ(n, decorator);
-    REQ(CHILD(n, 0), AT);
-    REQ(CHILD(n, 2), NEWLINE);
-
-    return ast_for_expr(c, CHILD(n, 1));
-}
-
-static asdl_seq*
-ast_for_decorators(struct compiling *c, const node *n)
-{
-    asdl_seq* decorator_seq;
-    expr_ty d;
-    int i;
-
-    REQ(n, decorators);
-    decorator_seq = _Py_asdl_seq_new(NCH(n), c->c_arena);
-    if (!decorator_seq)
-        return NULL;
-
-    for (i = 0; i < NCH(n); i++) {
-        d = ast_for_decorator(c, CHILD(n, i));
-        if (!d)
-            return NULL;
-        asdl_seq_SET(decorator_seq, i, d);
-    }
-    return decorator_seq;
-}
-
-static stmt_ty
-ast_for_funcdef_impl(struct compiling *c, const node *n0,
-                     asdl_seq *decorator_seq, bool is_async)
-{
-    /* funcdef: 'def' NAME parameters ['->' test] ':' [TYPE_COMMENT] suite */
-    const node * const n = is_async ? CHILD(n0, 1) : n0;
-    identifier name;
-    arguments_ty args;
-    asdl_seq *body;
-    expr_ty returns = NULL;
-    int name_i = 1;
-    int end_lineno, end_col_offset;
-    node *tc;
-    string type_comment = NULL;
-
-    if (is_async && c->c_feature_version < 5) {
-        ast_error(c, n,
-                  "Async functions are only supported in Python 3.5 and greater");
-        return NULL;
-    }
-
-    REQ(n, funcdef);
-
-    name = NEW_IDENTIFIER(CHILD(n, name_i));
-    if (!name)
-        return NULL;
-    if (forbidden_name(c, name, CHILD(n, name_i), 0))
-        return NULL;
-    args = ast_for_arguments(c, CHILD(n, name_i + 1));
-    if (!args)
-        return NULL;
-    if (TYPE(CHILD(n, name_i+2)) == RARROW) {
-        returns = ast_for_expr(c, CHILD(n, name_i + 3));
-        if (!returns)
-            return NULL;
-        name_i += 2;
-    }
-    if (TYPE(CHILD(n, name_i + 3)) == TYPE_COMMENT) {
-        type_comment = NEW_TYPE_COMMENT(CHILD(n, name_i + 3));
-        if (!type_comment)
-            return NULL;
-        name_i += 1;
-    }
-    body = ast_for_suite(c, CHILD(n, name_i + 3));
-    if (!body)
-        return NULL;
-    get_last_end_pos(body, &end_lineno, &end_col_offset);
-
-    if (NCH(CHILD(n, name_i + 3)) > 1) {
-        /* Check if the suite has a type comment in it. */
-        tc = CHILD(CHILD(n, name_i + 3), 1);
-
-        if (TYPE(tc) == TYPE_COMMENT) {
-            if (type_comment != NULL) {
-                ast_error(c, n, "Cannot have two type comments on def");
-                return NULL;
-            }
-            type_comment = NEW_TYPE_COMMENT(tc);
-            if (!type_comment)
-                return NULL;
-        }
-    }
-
-    if (is_async)
-        return AsyncFunctionDef(name, args, body, decorator_seq, returns, type_comment,
-                                LINENO(n0), n0->n_col_offset, end_lineno, end_col_offset, c->c_arena);
-    else
-        return FunctionDef(name, args, body, decorator_seq, returns, type_comment,
-                           LINENO(n), n->n_col_offset, end_lineno, end_col_offset, c->c_arena);
-}
-
-static stmt_ty
-ast_for_async_funcdef(struct compiling *c, const node *n, asdl_seq *decorator_seq)
-{
-    /* async_funcdef: ASYNC funcdef */
-    REQ(n, async_funcdef);
-    REQ(CHILD(n, 0), ASYNC);
-    REQ(CHILD(n, 1), funcdef);
-
-    return ast_for_funcdef_impl(c, n, decorator_seq,
-                                true /* is_async */);
-}
-
-static stmt_ty
-ast_for_funcdef(struct compiling *c, const node *n, asdl_seq *decorator_seq)
-{
-    /* funcdef: 'def' NAME parameters ['->' test] ':' suite */
-    return ast_for_funcdef_impl(c, n, decorator_seq,
-                                false /* is_async */);
-}
-
-
-static stmt_ty
-ast_for_async_stmt(struct compiling *c, const node *n)
-{
-    /* async_stmt: ASYNC (funcdef | with_stmt | for_stmt) */
-    REQ(n, async_stmt);
-    REQ(CHILD(n, 0), ASYNC);
-
-    switch (TYPE(CHILD(n, 1))) {
-        case funcdef:
-            return ast_for_funcdef_impl(c, n, NULL,
-                                        true /* is_async */);
-        case with_stmt:
-            return ast_for_with_stmt(c, n,
-                                     true /* is_async */);
-
-        case for_stmt:
-            return ast_for_for_stmt(c, n,
-                                    true /* is_async */);
-
-        default:
-            PyErr_Format(PyExc_SystemError,
-                         "invalid async stament: %s",
-                         STR(CHILD(n, 1)));
-            return NULL;
-    }
-}
-
-static stmt_ty
-ast_for_decorated(struct compiling *c, const node *n)
-{
-    /* decorated: decorators (classdef | funcdef | async_funcdef) */
-    stmt_ty thing = NULL;
-    asdl_seq *decorator_seq = NULL;
-
-    REQ(n, decorated);
-
-    decorator_seq = ast_for_decorators(c, CHILD(n, 0));
-    if (!decorator_seq)
-      return NULL;
-
-    assert(TYPE(CHILD(n, 1)) == funcdef ||
-           TYPE(CHILD(n, 1)) == async_funcdef ||
-           TYPE(CHILD(n, 1)) == classdef);
-
-    if (TYPE(CHILD(n, 1)) == funcdef) {
-      thing = ast_for_funcdef(c, CHILD(n, 1), decorator_seq);
-    } else if (TYPE(CHILD(n, 1)) == classdef) {
-      thing = ast_for_classdef(c, CHILD(n, 1), decorator_seq);
-    } else if (TYPE(CHILD(n, 1)) == async_funcdef) {
-      thing = ast_for_async_funcdef(c, CHILD(n, 1), decorator_seq);
-    }
-    return thing;
-}
-
-static expr_ty
-ast_for_namedexpr(struct compiling *c, const node *n)
-{
-    /* namedexpr_test: test [':=' test]
-       argument: ( test [comp_for] |
-            test ':=' test |
-            test '=' test |
-            '**' test |
-            '*' test )
-    */
-    expr_ty target, value;
-
-    target = ast_for_expr(c, CHILD(n, 0));
-    if (!target)
-        return NULL;
-
-    value = ast_for_expr(c, CHILD(n, 2));
-    if (!value)
-        return NULL;
-
-    if (target->kind != Name_kind) {
-        const char *expr_name = get_expr_name(target);
-        if (expr_name != NULL) {
-            ast_error(c, n, "cannot use assignment expressions with %s", expr_name);
-        }
-        return NULL;
-    }
-
-    if (!set_context(c, target, Store, n))
-        return NULL;
-
-    return NamedExpr(target, value, LINENO(n), n->n_col_offset, n->n_end_lineno,
-                     n->n_end_col_offset, c->c_arena);
-}
-
-static expr_ty
-ast_for_lambdef(struct compiling *c, const node *n)
-{
-    /* lambdef: 'lambda' [varargslist] ':' test
-       lambdef_nocond: 'lambda' [varargslist] ':' test_nocond */
-    arguments_ty args;
-    expr_ty expression;
-
-    if (NCH(n) == 3) {
-        args = arguments(NULL, NULL, NULL, NULL, NULL, NULL, NULL, c->c_arena);
-        if (!args)
-            return NULL;
-        expression = ast_for_expr(c, CHILD(n, 2));
-        if (!expression)
-            return NULL;
-    }
-    else {
-        args = ast_for_arguments(c, CHILD(n, 1));
-        if (!args)
-            return NULL;
-        expression = ast_for_expr(c, CHILD(n, 3));
-        if (!expression)
-            return NULL;
-    }
-
-    return Lambda(args, expression, LINENO(n), n->n_col_offset,
-                  n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-}
-
-static expr_ty
-ast_for_ifexpr(struct compiling *c, const node *n)
-{
-    /* test: or_test 'if' or_test 'else' test */
-    expr_ty expression, body, orelse;
-
-    assert(NCH(n) == 5);
-    body = ast_for_expr(c, CHILD(n, 0));
-    if (!body)
-        return NULL;
-    expression = ast_for_expr(c, CHILD(n, 2));
-    if (!expression)
-        return NULL;
-    orelse = ast_for_expr(c, CHILD(n, 4));
-    if (!orelse)
-        return NULL;
-    return IfExp(expression, body, orelse, LINENO(n), n->n_col_offset,
-                 n->n_end_lineno, n->n_end_col_offset,
-                 c->c_arena);
-}
-
-/*
-   Count the number of 'for' loops in a comprehension.
-
-   Helper for ast_for_comprehension().
-*/
-
-static int
-count_comp_fors(struct compiling *c, const node *n)
-{
-    int n_fors = 0;
-
-  count_comp_for:
-    n_fors++;
-    REQ(n, comp_for);
-    if (NCH(n) == 2) {
-        REQ(CHILD(n, 0), ASYNC);
-        n = CHILD(n, 1);
-    }
-    else if (NCH(n) == 1) {
-        n = CHILD(n, 0);
-    }
-    else {
-        goto error;
-    }
-    if (NCH(n) == (5)) {
-        n = CHILD(n, 4);
-    }
-    else {
-        return n_fors;
-    }
-  count_comp_iter:
-    REQ(n, comp_iter);
-    n = CHILD(n, 0);
-    if (TYPE(n) == comp_for)
-        goto count_comp_for;
-    else if (TYPE(n) == comp_if) {
-        if (NCH(n) == 3) {
-            n = CHILD(n, 2);
-            goto count_comp_iter;
-        }
-        else
-            return n_fors;
-    }
-
-  error:
-    /* Should never be reached */
-    PyErr_SetString(PyExc_SystemError,
-                    "logic error in count_comp_fors");
-    return -1;
-}
-
-/* Count the number of 'if' statements in a comprehension.
-
-   Helper for ast_for_comprehension().
-*/
-
-static int
-count_comp_ifs(struct compiling *c, const node *n)
-{
-    int n_ifs = 0;
-
-    while (1) {
-        REQ(n, comp_iter);
-        if (TYPE(CHILD(n, 0)) == comp_for)
-            return n_ifs;
-        n = CHILD(n, 0);
-        REQ(n, comp_if);
-        n_ifs++;
-        if (NCH(n) == 2)
-            return n_ifs;
-        n = CHILD(n, 2);
-    }
-}
-
-static asdl_seq *
-ast_for_comprehension(struct compiling *c, const node *n)
-{
-    int i, n_fors;
-    asdl_seq *comps;
-
-    n_fors = count_comp_fors(c, n);
-    if (n_fors == -1)
-        return NULL;
-
-    comps = _Py_asdl_seq_new(n_fors, c->c_arena);
-    if (!comps)
-        return NULL;
-
-    for (i = 0; i < n_fors; i++) {
-        comprehension_ty comp;
-        asdl_seq *t;
-        expr_ty expression, first;
-        node *for_ch;
-        node *sync_n;
-        int is_async = 0;
-
-        REQ(n, comp_for);
-
-        if (NCH(n) == 2) {
-            is_async = 1;
-            REQ(CHILD(n, 0), ASYNC);
-            sync_n = CHILD(n, 1);
-        }
-        else {
-            sync_n = CHILD(n, 0);
-        }
-        REQ(sync_n, sync_comp_for);
-
-        /* Async comprehensions only allowed in Python 3.6 and greater */
-        if (is_async && c->c_feature_version < 6) {
-            ast_error(c, n,
-                      "Async comprehensions are only supported in Python 3.6 and greater");
-            return NULL;
-        }
-
-        for_ch = CHILD(sync_n, 1);
-        t = ast_for_exprlist(c, for_ch, Store);
-        if (!t)
-            return NULL;
-        expression = ast_for_expr(c, CHILD(sync_n, 3));
-        if (!expression)
-            return NULL;
-
-        /* Check the # of children rather than the length of t, since
-           (x for x, in ...) has 1 element in t, but still requires a Tuple. */
-        first = (expr_ty)asdl_seq_GET(t, 0);
-        if (NCH(for_ch) == 1)
-            comp = comprehension(first, expression, NULL,
-                                 is_async, c->c_arena);
-        else
-            comp = comprehension(Tuple(t, Store, first->lineno, first->col_offset,
-                                       for_ch->n_end_lineno, for_ch->n_end_col_offset,
-                                       c->c_arena),
-                                 expression, NULL, is_async, c->c_arena);
-        if (!comp)
-            return NULL;
-
-        if (NCH(sync_n) == 5) {
-            int j, n_ifs;
-            asdl_seq *ifs;
-
-            n = CHILD(sync_n, 4);
-            n_ifs = count_comp_ifs(c, n);
-            if (n_ifs == -1)
-                return NULL;
-
-            ifs = _Py_asdl_seq_new(n_ifs, c->c_arena);
-            if (!ifs)
-                return NULL;
-
-            for (j = 0; j < n_ifs; j++) {
-                REQ(n, comp_iter);
-                n = CHILD(n, 0);
-                REQ(n, comp_if);
-
-                expression = ast_for_expr(c, CHILD(n, 1));
-                if (!expression)
-                    return NULL;
-                asdl_seq_SET(ifs, j, expression);
-                if (NCH(n) == 3)
-                    n = CHILD(n, 2);
-            }
-            /* on exit, must guarantee that n is a comp_for */
-            if (TYPE(n) == comp_iter)
-                n = CHILD(n, 0);
-            comp->ifs = ifs;
-        }
-        asdl_seq_SET(comps, i, comp);
-    }
-    return comps;
-}
-
-static expr_ty
-ast_for_itercomp(struct compiling *c, const node *n, int type)
-{
-    /* testlist_comp: (test|star_expr)
-     *                ( comp_for | (',' (test|star_expr))* [','] ) */
-    expr_ty elt;
-    asdl_seq *comps;
-    node *ch;
-
-    assert(NCH(n) > 1);
-
-    ch = CHILD(n, 0);
-    elt = ast_for_expr(c, ch);
-    if (!elt)
-        return NULL;
-    if (elt->kind == Starred_kind) {
-        ast_error(c, ch, "iterable unpacking cannot be used in comprehension");
-        return NULL;
-    }
-
-    comps = ast_for_comprehension(c, CHILD(n, 1));
-    if (!comps)
-        return NULL;
-
-    if (type == COMP_GENEXP)
-        return GeneratorExp(elt, comps, LINENO(n), n->n_col_offset,
-                            n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-    else if (type == COMP_LISTCOMP)
-        return ListComp(elt, comps, LINENO(n), n->n_col_offset,
-                        n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-    else if (type == COMP_SETCOMP)
-        return SetComp(elt, comps, LINENO(n), n->n_col_offset,
-                       n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-    else
-        /* Should never happen */
-        return NULL;
-}
-
-/* Fills in the key, value pair corresponding to the dict element.  In case
- * of an unpacking, key is NULL.  *i is advanced by the number of ast
- * elements.  Iff successful, nonzero is returned.
- */
-static int
-ast_for_dictelement(struct compiling *c, const node *n, int *i,
-                    expr_ty *key, expr_ty *value)
-{
-    expr_ty expression;
-    if (TYPE(CHILD(n, *i)) == DOUBLESTAR) {
-        assert(NCH(n) - *i >= 2);
-
-        expression = ast_for_expr(c, CHILD(n, *i + 1));
-        if (!expression)
-            return 0;
-        *key = NULL;
-        *value = expression;
-
-        *i += 2;
-    }
-    else {
-        assert(NCH(n) - *i >= 3);
-
-        expression = ast_for_expr(c, CHILD(n, *i));
-        if (!expression)
-            return 0;
-        *key = expression;
-
-        REQ(CHILD(n, *i + 1), COLON);
-
-        expression = ast_for_expr(c, CHILD(n, *i + 2));
-        if (!expression)
-            return 0;
-        *value = expression;
-
-        *i += 3;
-    }
-    return 1;
-}
-
-static expr_ty
-ast_for_dictcomp(struct compiling *c, const node *n)
-{
-    expr_ty key, value;
-    asdl_seq *comps;
-    int i = 0;
-
-    if (!ast_for_dictelement(c, n, &i, &key, &value))
-        return NULL;
-    assert(key);
-    assert(NCH(n) - i >= 1);
-
-    comps = ast_for_comprehension(c, CHILD(n, i));
-    if (!comps)
-        return NULL;
-
-    return DictComp(key, value, comps, LINENO(n), n->n_col_offset,
-                    n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-}
-
-static expr_ty
-ast_for_dictdisplay(struct compiling *c, const node *n)
-{
-    int i;
-    int j;
-    int size;
-    asdl_seq *keys, *values;
-
-    size = (NCH(n) + 1) / 3; /* +1 in case no trailing comma */
-    keys = _Py_asdl_seq_new(size, c->c_arena);
-    if (!keys)
-        return NULL;
-
-    values = _Py_asdl_seq_new(size, c->c_arena);
-    if (!values)
-        return NULL;
-
-    j = 0;
-    for (i = 0; i < NCH(n); i++) {
-        expr_ty key, value;
-
-        if (!ast_for_dictelement(c, n, &i, &key, &value))
-            return NULL;
-        asdl_seq_SET(keys, j, key);
-        asdl_seq_SET(values, j, value);
-
-        j++;
-    }
-    keys->size = j;
-    values->size = j;
-    return Dict(keys, values, LINENO(n), n->n_col_offset,
-                n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-}
-
-static expr_ty
-ast_for_genexp(struct compiling *c, const node *n)
-{
-    assert(TYPE(n) == (testlist_comp) || TYPE(n) == (argument));
-    return ast_for_itercomp(c, n, COMP_GENEXP);
-}
-
-static expr_ty
-ast_for_listcomp(struct compiling *c, const node *n)
-{
-    assert(TYPE(n) == (testlist_comp));
-    return ast_for_itercomp(c, n, COMP_LISTCOMP);
-}
-
-static expr_ty
-ast_for_setcomp(struct compiling *c, const node *n)
-{
-    assert(TYPE(n) == (dictorsetmaker));
-    return ast_for_itercomp(c, n, COMP_SETCOMP);
-}
-
-static expr_ty
-ast_for_setdisplay(struct compiling *c, const node *n)
-{
-    int i;
-    int size;
-    asdl_seq *elts;
-
-    assert(TYPE(n) == (dictorsetmaker));
-    size = (NCH(n) + 1) / 2; /* +1 in case no trailing comma */
-    elts = _Py_asdl_seq_new(size, c->c_arena);
-    if (!elts)
-        return NULL;
-    for (i = 0; i < NCH(n); i += 2) {
-        expr_ty expression;
-        expression = ast_for_expr(c, CHILD(n, i));
-        if (!expression)
-            return NULL;
-        asdl_seq_SET(elts, i / 2, expression);
-    }
-    return Set(elts, LINENO(n), n->n_col_offset,
-               n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-}
-
-static expr_ty
-ast_for_atom(struct compiling *c, const node *n)
-{
-    /* atom: '(' [yield_expr|testlist_comp] ')' | '[' [testlist_comp] ']'
-       | '{' [dictmaker|testlist_comp] '}' | NAME | NUMBER | STRING+
-       | '...' | 'None' | 'True' | 'False'
-    */
-    node *ch = CHILD(n, 0);
-
-    switch (TYPE(ch)) {
-    case NAME: {
-        PyObject *name;
-        const char *s = STR(ch);
-        size_t len = strlen(s);
-        if (len >= 4 && len <= 5) {
-            if (!strcmp(s, "None"))
-                return Constant(Py_None, NULL, LINENO(n), n->n_col_offset,
-                                n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-            if (!strcmp(s, "True"))
-                return Constant(Py_True, NULL, LINENO(n), n->n_col_offset,
-                                n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-            if (!strcmp(s, "False"))
-                return Constant(Py_False, NULL, LINENO(n), n->n_col_offset,
-                                n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-        }
-        name = new_identifier(s, c);
-        if (!name)
-            return NULL;
-        /* All names start in Load context, but may later be changed. */
-        return Name(name, Load, LINENO(n), n->n_col_offset,
-                    n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-    }
-    case STRING: {
-        expr_ty str = parsestrplus(c, n);
-        if (!str) {
-            const char *errtype = NULL;
-            if (PyErr_ExceptionMatches(PyExc_UnicodeError))
-                errtype = "unicode error";
-            else if (PyErr_ExceptionMatches(PyExc_ValueError))
-                errtype = "value error";
-            if (errtype) {
-                PyObject *type, *value, *tback, *errstr;
-                PyErr_Fetch(&type, &value, &tback);
-                errstr = PyObject_Str(value);
-                if (errstr) {
-                    ast_error(c, n, "(%s) %U", errtype, errstr);
-                    Py_DECREF(errstr);
-                }
-                else {
-                    PyErr_Clear();
-                    ast_error(c, n, "(%s) unknown error", errtype);
-                }
-                Py_DECREF(type);
-                Py_XDECREF(value);
-                Py_XDECREF(tback);
-            }
-            return NULL;
-        }
-        return str;
-    }
-    case NUMBER: {
-        PyObject *pynum;
-        /* Underscores in numeric literals are only allowed in Python 3.6 or greater */
-        /* Check for underscores here rather than in parse_number so we can report a line number on error */
-        if (c->c_feature_version < 6 && strchr(STR(ch), '_') != NULL) {
-            ast_error(c, ch,
-                      "Underscores in numeric literals are only supported in Python 3.6 and greater");
-            return NULL;
-        }
-        pynum = parsenumber(c, STR(ch));
-        if (!pynum)
-            return NULL;
-
-        if (PyArena_AddPyObject(c->c_arena, pynum) < 0) {
-            Py_DECREF(pynum);
-            return NULL;
-        }
-        return Constant(pynum, NULL, LINENO(n), n->n_col_offset,
-                        n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-    }
-    case ELLIPSIS: /* Ellipsis */
-        return Constant(Py_Ellipsis, NULL, LINENO(n), n->n_col_offset,
-                        n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-    case LPAR: /* some parenthesized expressions */
-        ch = CHILD(n, 1);
-
-        if (TYPE(ch) == RPAR)
-            return Tuple(NULL, Load, LINENO(n), n->n_col_offset,
-                         n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-
-        if (TYPE(ch) == yield_expr)
-            return ast_for_expr(c, ch);
-
-        /* testlist_comp: test ( comp_for | (',' test)* [','] ) */
-        if (NCH(ch) == 1) {
-            return ast_for_testlist(c, ch);
-        }
-
-        if (TYPE(CHILD(ch, 1)) == comp_for) {
-            return copy_location(ast_for_genexp(c, ch), n, n);
-        }
-        else {
-            return copy_location(ast_for_testlist(c, ch), n, n);
-        }
-    case LSQB: /* list (or list comprehension) */
-        ch = CHILD(n, 1);
-
-        if (TYPE(ch) == RSQB)
-            return List(NULL, Load, LINENO(n), n->n_col_offset,
-                        n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-
-        REQ(ch, testlist_comp);
-        if (NCH(ch) == 1 || TYPE(CHILD(ch, 1)) == COMMA) {
-            asdl_seq *elts = seq_for_testlist(c, ch);
-            if (!elts)
-                return NULL;
-
-            return List(elts, Load, LINENO(n), n->n_col_offset,
-                        n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-        }
-        else {
-            return copy_location(ast_for_listcomp(c, ch), n, n);
-        }
-    case LBRACE: {
-        /* dictorsetmaker: ( ((test ':' test | '**' test)
-         *                    (comp_for | (',' (test ':' test | '**' test))* [','])) |
-         *                   ((test | '*' test)
-         *                    (comp_for | (',' (test | '*' test))* [','])) ) */
-        expr_ty res;
-        ch = CHILD(n, 1);
-        if (TYPE(ch) == RBRACE) {
-            /* It's an empty dict. */
-            return Dict(NULL, NULL, LINENO(n), n->n_col_offset,
-                        n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-        }
-        else {
-            int is_dict = (TYPE(CHILD(ch, 0)) == DOUBLESTAR);
-            if (NCH(ch) == 1 ||
-                    (NCH(ch) > 1 &&
-                     TYPE(CHILD(ch, 1)) == COMMA)) {
-                /* It's a set display. */
-                res = ast_for_setdisplay(c, ch);
-            }
-            else if (NCH(ch) > 1 &&
-                    TYPE(CHILD(ch, 1)) == comp_for) {
-                /* It's a set comprehension. */
-                res = ast_for_setcomp(c, ch);
-            }
-            else if (NCH(ch) > 3 - is_dict &&
-                    TYPE(CHILD(ch, 3 - is_dict)) == comp_for) {
-                /* It's a dictionary comprehension. */
-                if (is_dict) {
-                    ast_error(c, n,
-                              "dict unpacking cannot be used in dict comprehension");
-                    return NULL;
-                }
-                res = ast_for_dictcomp(c, ch);
-            }
-            else {
-                /* It's a dictionary display. */
-                res = ast_for_dictdisplay(c, ch);
-            }
-            return copy_location(res, n, n);
-        }
-    }
-    default:
-        PyErr_Format(PyExc_SystemError, "unhandled atom %d", TYPE(ch));
-        return NULL;
-    }
-}
-
-static expr_ty
-ast_for_slice(struct compiling *c, const node *n)
-{
-    node *ch;
-    expr_ty lower = NULL, upper = NULL, step = NULL;
-
-    REQ(n, subscript);
-
-    /*
-       subscript: test | [test] ':' [test] [sliceop]
-       sliceop: ':' [test]
-    */
-    ch = CHILD(n, 0);
-    if (NCH(n) == 1 && TYPE(ch) == test) {
-        return ast_for_expr(c, ch);
-    }
-
-    if (TYPE(ch) == test) {
-        lower = ast_for_expr(c, ch);
-        if (!lower)
-            return NULL;
-    }
-
-    /* If there's an upper bound it's in the second or third position. */
-    if (TYPE(ch) == COLON) {
-        if (NCH(n) > 1) {
-            node *n2 = CHILD(n, 1);
-
-            if (TYPE(n2) == test) {
-                upper = ast_for_expr(c, n2);
-                if (!upper)
-                    return NULL;
-            }
-        }
-    } else if (NCH(n) > 2) {
-        node *n2 = CHILD(n, 2);
-
-        if (TYPE(n2) == test) {
-            upper = ast_for_expr(c, n2);
-            if (!upper)
-                return NULL;
-        }
-    }
-
-    ch = CHILD(n, NCH(n) - 1);
-    if (TYPE(ch) == sliceop) {
-        if (NCH(ch) != 1) {
-            ch = CHILD(ch, 1);
-            if (TYPE(ch) == test) {
-                step = ast_for_expr(c, ch);
-                if (!step)
-                    return NULL;
-            }
-        }
-    }
-
-    return Slice(lower, upper, step, LINENO(n), n->n_col_offset,
-                 n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-}
-
-static expr_ty
-ast_for_binop(struct compiling *c, const node *n)
-{
-    /* Must account for a sequence of expressions.
-       How should A op B op C by represented?
-       BinOp(BinOp(A, op, B), op, C).
-    */
-
-    int i, nops;
-    expr_ty expr1, expr2, result;
-    operator_ty newoperator;
-
-    expr1 = ast_for_expr(c, CHILD(n, 0));
-    if (!expr1)
-        return NULL;
-
-    expr2 = ast_for_expr(c, CHILD(n, 2));
-    if (!expr2)
-        return NULL;
-
-    newoperator = get_operator(c, CHILD(n, 1));
-    if (!newoperator)
-        return NULL;
-
-    result = BinOp(expr1, newoperator, expr2, LINENO(n), n->n_col_offset,
-                   CHILD(n, 2)->n_end_lineno, CHILD(n, 2)->n_end_col_offset,
-                   c->c_arena);
-    if (!result)
-        return NULL;
-
-    nops = (NCH(n) - 1) / 2;
-    for (i = 1; i < nops; i++) {
-        expr_ty tmp_result, tmp;
-        const node* next_oper = CHILD(n, i * 2 + 1);
-
-        newoperator = get_operator(c, next_oper);
-        if (!newoperator)
-            return NULL;
-
-        tmp = ast_for_expr(c, CHILD(n, i * 2 + 2));
-        if (!tmp)
-            return NULL;
-
-        tmp_result = BinOp(result, newoperator, tmp,
-                           LINENO(n), n->n_col_offset,
-                           CHILD(n, i * 2 + 2)->n_end_lineno,
-                           CHILD(n, i * 2 + 2)->n_end_col_offset,
-                           c->c_arena);
-        if (!tmp_result)
-            return NULL;
-        result = tmp_result;
-    }
-    return result;
-}
-
-static expr_ty
-ast_for_trailer(struct compiling *c, const node *n, expr_ty left_expr, const node *start)
-{
-    /* trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME
-       subscriptlist: subscript (',' subscript)* [',']
-       subscript: '.' '.' '.' | test | [test] ':' [test] [sliceop]
-     */
-    const node *n_copy = n;
-    REQ(n, trailer);
-    if (TYPE(CHILD(n, 0)) == LPAR) {
-        if (NCH(n) == 2)
-            return Call(left_expr, NULL, NULL, LINENO(start), start->n_col_offset,
-                        n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-        else
-            return ast_for_call(c, CHILD(n, 1), left_expr,
-                                start, CHILD(n, 0), CHILD(n, 2));
-    }
-    else if (TYPE(CHILD(n, 0)) == DOT) {
-        PyObject *attr_id = NEW_IDENTIFIER(CHILD(n, 1));
-        if (!attr_id)
-            return NULL;
-        return Attribute(left_expr, attr_id, Load,
-                         LINENO(start), start->n_col_offset,
-                         n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-    }
-    else {
-        REQ(CHILD(n, 0), LSQB);
-        REQ(CHILD(n, 2), RSQB);
-        n = CHILD(n, 1);
-        if (NCH(n) == 1) {
-            expr_ty slc = ast_for_slice(c, CHILD(n, 0));
-            if (!slc)
-                return NULL;
-            return Subscript(left_expr, slc, Load, LINENO(start), start->n_col_offset,
-                             n_copy->n_end_lineno, n_copy->n_end_col_offset,
-                             c->c_arena);
-        }
-        else {
-            int j;
-            expr_ty slc, e;
-            asdl_seq *elts;
-            elts = _Py_asdl_seq_new((NCH(n) + 1) / 2, c->c_arena);
-            if (!elts)
-                return NULL;
-            for (j = 0; j < NCH(n); j += 2) {
-                slc = ast_for_slice(c, CHILD(n, j));
-                if (!slc)
-                    return NULL;
-                asdl_seq_SET(elts, j / 2, slc);
-            }
-            e = Tuple(elts, Load, LINENO(n), n->n_col_offset,
-                      n->n_end_lineno, n->n_end_col_offset,
-                      c->c_arena);
-            if (!e)
-                return NULL;
-            return Subscript(left_expr, e,
-                             Load, LINENO(start), start->n_col_offset,
-                             n_copy->n_end_lineno, n_copy->n_end_col_offset,
-                             c->c_arena);
-        }
-    }
-}
-
-static expr_ty
-ast_for_factor(struct compiling *c, const node *n)
-{
-    expr_ty expression;
-
-    expression = ast_for_expr(c, CHILD(n, 1));
-    if (!expression)
-        return NULL;
-
-    switch (TYPE(CHILD(n, 0))) {
-        case PLUS:
-            return UnaryOp(UAdd, expression, LINENO(n), n->n_col_offset,
-                           n->n_end_lineno, n->n_end_col_offset,
-                           c->c_arena);
-        case MINUS:
-            return UnaryOp(USub, expression, LINENO(n), n->n_col_offset,
-                           n->n_end_lineno, n->n_end_col_offset,
-                           c->c_arena);
-        case TILDE:
-            return UnaryOp(Invert, expression, LINENO(n), n->n_col_offset,
-                           n->n_end_lineno, n->n_end_col_offset,
-                           c->c_arena);
-    }
-    PyErr_Format(PyExc_SystemError, "unhandled factor: %d",
-                 TYPE(CHILD(n, 0)));
-    return NULL;
-}
-
-static expr_ty
-ast_for_atom_expr(struct compiling *c, const node *n)
-{
-    int i, nch, start = 0;
-    expr_ty e;
-
-    REQ(n, atom_expr);
-    nch = NCH(n);
-
-    if (TYPE(CHILD(n, 0)) == AWAIT) {
-        if (c->c_feature_version < 5) {
-            ast_error(c, n,
-                      "Await expressions are only supported in Python 3.5 and greater");
-            return NULL;
-        }
-        start = 1;
-        assert(nch > 1);
-    }
-
-    e = ast_for_atom(c, CHILD(n, start));
-    if (!e)
-        return NULL;
-    if (nch == 1)
-        return e;
-    if (start && nch == 2) {
-        return Await(e, LINENO(n), n->n_col_offset,
-                     n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-    }
-
-    for (i = start + 1; i < nch; i++) {
-        node *ch = CHILD(n, i);
-        if (TYPE(ch) != trailer)
-            break;
-        e = ast_for_trailer(c, ch, e, CHILD(n, start));
-        if (!e)
-            return NULL;
-    }
-
-    if (start) {
-        /* there was an 'await' */
-        return Await(e, LINENO(n), n->n_col_offset,
-                     n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-    }
-    else {
-        return e;
-    }
-}
-
-static expr_ty
-ast_for_power(struct compiling *c, const node *n)
-{
-    /* power: atom trailer* ('**' factor)*
-     */
-    expr_ty e;
-    REQ(n, power);
-    e = ast_for_atom_expr(c, CHILD(n, 0));
-    if (!e)
-        return NULL;
-    if (NCH(n) == 1)
-        return e;
-    if (TYPE(CHILD(n, NCH(n) - 1)) == factor) {
-        expr_ty f = ast_for_expr(c, CHILD(n, NCH(n) - 1));
-        if (!f)
-            return NULL;
-        e = BinOp(e, Pow, f, LINENO(n), n->n_col_offset,
-                  n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-    }
-    return e;
-}
-
-static expr_ty
-ast_for_starred(struct compiling *c, const node *n)
-{
-    expr_ty tmp;
-    REQ(n, star_expr);
-
-    tmp = ast_for_expr(c, CHILD(n, 1));
-    if (!tmp)
-        return NULL;
-
-    /* The Load context is changed later. */
-    return Starred(tmp, Load, LINENO(n), n->n_col_offset,
-                   n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-}
-
-
-/* Do not name a variable 'expr'!  Will cause a compile error.
-*/
-
-static expr_ty
-ast_for_expr(struct compiling *c, const node *n)
-{
-    /* handle the full range of simple expressions
-       namedexpr_test: test [':=' test]
-       test: or_test ['if' or_test 'else' test] | lambdef
-       test_nocond: or_test | lambdef_nocond
-       or_test: and_test ('or' and_test)*
-       and_test: not_test ('and' not_test)*
-       not_test: 'not' not_test | comparison
-       comparison: expr (comp_op expr)*
-       expr: xor_expr ('|' xor_expr)*
-       xor_expr: and_expr ('^' and_expr)*
-       and_expr: shift_expr ('&' shift_expr)*
-       shift_expr: arith_expr (('<<'|'>>') arith_expr)*
-       arith_expr: term (('+'|'-') term)*
-       term: factor (('*'|'@'|'/'|'%'|'//') factor)*
-       factor: ('+'|'-'|'~') factor | power
-       power: atom_expr ['**' factor]
-       atom_expr: [AWAIT] atom trailer*
-       yield_expr: 'yield' [yield_arg]
-    */
-
-    asdl_seq *seq;
-    int i;
-
- loop:
-    switch (TYPE(n)) {
-        case namedexpr_test:
-            if (NCH(n) == 3)
-                return ast_for_namedexpr(c, n);
-            /* Fallthrough */
-        case test:
-        case test_nocond:
-            if (TYPE(CHILD(n, 0)) == lambdef ||
-                TYPE(CHILD(n, 0)) == lambdef_nocond)
-                return ast_for_lambdef(c, CHILD(n, 0));
-            else if (NCH(n) > 1)
-                return ast_for_ifexpr(c, n);
-            /* Fallthrough */
-        case or_test:
-        case and_test:
-            if (NCH(n) == 1) {
-                n = CHILD(n, 0);
-                goto loop;
-            }
-            seq = _Py_asdl_seq_new((NCH(n) + 1) / 2, c->c_arena);
-            if (!seq)
-                return NULL;
-            for (i = 0; i < NCH(n); i += 2) {
-                expr_ty e = ast_for_expr(c, CHILD(n, i));
-                if (!e)
-                    return NULL;
-                asdl_seq_SET(seq, i / 2, e);
-            }
-            if (!strcmp(STR(CHILD(n, 1)), "and"))
-                return BoolOp(And, seq, LINENO(n), n->n_col_offset,
-                              n->n_end_lineno, n->n_end_col_offset,
-                              c->c_arena);
-            assert(!strcmp(STR(CHILD(n, 1)), "or"));
-            return BoolOp(Or, seq, LINENO(n), n->n_col_offset,
-                          n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-        case not_test:
-            if (NCH(n) == 1) {
-                n = CHILD(n, 0);
-                goto loop;
-            }
-            else {
-                expr_ty expression = ast_for_expr(c, CHILD(n, 1));
-                if (!expression)
-                    return NULL;
-
-                return UnaryOp(Not, expression, LINENO(n), n->n_col_offset,
-                               n->n_end_lineno, n->n_end_col_offset,
-                               c->c_arena);
-            }
-        case comparison:
-            if (NCH(n) == 1) {
-                n = CHILD(n, 0);
-                goto loop;
-            }
-            else {
-                expr_ty expression;
-                asdl_int_seq *ops;
-                asdl_seq *cmps;
-                ops = _Py_asdl_int_seq_new(NCH(n) / 2, c->c_arena);
-                if (!ops)
-                    return NULL;
-                cmps = _Py_asdl_seq_new(NCH(n) / 2, c->c_arena);
-                if (!cmps) {
-                    return NULL;
-                }
-                for (i = 1; i < NCH(n); i += 2) {
-                    cmpop_ty newoperator;
-
-                    newoperator = ast_for_comp_op(c, CHILD(n, i));
-                    if (!newoperator) {
-                        return NULL;
-                    }
-
-                    expression = ast_for_expr(c, CHILD(n, i + 1));
-                    if (!expression) {
-                        return NULL;
-                    }
-
-                    asdl_seq_SET(ops, i / 2, newoperator);
-                    asdl_seq_SET(cmps, i / 2, expression);
-                }
-                expression = ast_for_expr(c, CHILD(n, 0));
-                if (!expression) {
-                    return NULL;
-                }
-
-                return Compare(expression, ops, cmps, LINENO(n), n->n_col_offset,
-                               n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-            }
-
-        case star_expr:
-            return ast_for_starred(c, n);
-        /* The next five cases all handle BinOps.  The main body of code
-           is the same in each case, but the switch turned inside out to
-           reuse the code for each type of operator.
-         */
-        case expr:
-        case xor_expr:
-        case and_expr:
-        case shift_expr:
-        case arith_expr:
-        case term:
-            if (NCH(n) == 1) {
-                n = CHILD(n, 0);
-                goto loop;
-            }
-            return ast_for_binop(c, n);
-        case yield_expr: {
-            node *an = NULL;
-            node *en = NULL;
-            int is_from = 0;
-            expr_ty exp = NULL;
-            if (NCH(n) > 1)
-                an = CHILD(n, 1); /* yield_arg */
-            if (an) {
-                en = CHILD(an, NCH(an) - 1);
-                if (NCH(an) == 2) {
-                    is_from = 1;
-                    exp = ast_for_expr(c, en);
-                }
-                else
-                    exp = ast_for_testlist(c, en);
-                if (!exp)
-                    return NULL;
-            }
-            if (is_from)
-                return YieldFrom(exp, LINENO(n), n->n_col_offset,
-                                 n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-            return Yield(exp, LINENO(n), n->n_col_offset,
-                         n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-        }
-        case factor:
-            if (NCH(n) == 1) {
-                n = CHILD(n, 0);
-                goto loop;
-            }
-            return ast_for_factor(c, n);
-        case power:
-            return ast_for_power(c, n);
-        default:
-            PyErr_Format(PyExc_SystemError, "unhandled expr: %d", TYPE(n));
-            return NULL;
-    }
-    /* should never get here unless if error is set */
-    return NULL;
-}
-
-static expr_ty
-ast_for_call(struct compiling *c, const node *n, expr_ty func,
-             const node *start, const node *maybegenbeg, const node *closepar)
-{
-    /*
-      arglist: argument (',' argument)*  [',']
-      argument: ( test [comp_for] | '*' test | test '=' test | '**' test )
-    */
-
-    int i, nargs, nkeywords;
-    int ndoublestars;
-    asdl_seq *args;
-    asdl_seq *keywords;
-
-    REQ(n, arglist);
-
-    nargs = 0;
-    nkeywords = 0;
-    for (i = 0; i < NCH(n); i++) {
-        node *ch = CHILD(n, i);
-        if (TYPE(ch) == argument) {
-            if (NCH(ch) == 1)
-                nargs++;
-            else if (TYPE(CHILD(ch, 1)) == comp_for) {
-                nargs++;
-                if (!maybegenbeg) {
-                    ast_error(c, ch, "invalid syntax");
-                    return NULL;
-                }
-                if (NCH(n) > 1) {
-                    ast_error(c, ch, "Generator expression must be parenthesized");
-                    return NULL;
-                }
-            }
-            else if (TYPE(CHILD(ch, 0)) == STAR)
-                nargs++;
-            else if (TYPE(CHILD(ch, 1)) == COLONEQUAL) {
-                nargs++;
-            }
-            else
-                /* TYPE(CHILD(ch, 0)) == DOUBLESTAR or keyword argument */
-                nkeywords++;
-        }
-    }
-
-    args = _Py_asdl_seq_new(nargs, c->c_arena);
-    if (!args)
-        return NULL;
-    keywords = _Py_asdl_seq_new(nkeywords, c->c_arena);
-    if (!keywords)
-        return NULL;
-
-    nargs = 0;  /* positional arguments + iterable argument unpackings */
-    nkeywords = 0;  /* keyword arguments + keyword argument unpackings */
-    ndoublestars = 0;  /* just keyword argument unpackings */
-    for (i = 0; i < NCH(n); i++) {
-        node *ch = CHILD(n, i);
-        if (TYPE(ch) == argument) {
-            expr_ty e;
-            node *chch = CHILD(ch, 0);
-            if (NCH(ch) == 1) {
-                /* a positional argument */
-                if (nkeywords) {
-                    if (ndoublestars) {
-                        ast_error(c, chch,
-                                  "positional argument follows "
-                                  "keyword argument unpacking");
-                    }
-                    else {
-                        ast_error(c, chch,
-                                  "positional argument follows "
-                                  "keyword argument");
-                    }
-                    return NULL;
-                }
-                e = ast_for_expr(c, chch);
-                if (!e)
-                    return NULL;
-                asdl_seq_SET(args, nargs++, e);
-            }
-            else if (TYPE(chch) == STAR) {
-                /* an iterable argument unpacking */
-                expr_ty starred;
-                if (ndoublestars) {
-                    ast_error(c, chch,
-                              "iterable argument unpacking follows "
-                              "keyword argument unpacking");
-                    return NULL;
-                }
-                e = ast_for_expr(c, CHILD(ch, 1));
-                if (!e)
-                    return NULL;
-                starred = Starred(e, Load, LINENO(chch),
-                        chch->n_col_offset,
-                        e->end_lineno, e->end_col_offset,
-                        c->c_arena);
-                if (!starred)
-                    return NULL;
-                asdl_seq_SET(args, nargs++, starred);
-
-            }
-            else if (TYPE(chch) == DOUBLESTAR) {
-                /* a keyword argument unpacking */
-                keyword_ty kw;
-                i++;
-                e = ast_for_expr(c, CHILD(ch, 1));
-                if (!e)
-                    return NULL;
-                kw = keyword(NULL, e, chch->n_lineno, chch->n_col_offset,
-                             e->end_lineno, e->end_col_offset, c->c_arena);
-                asdl_seq_SET(keywords, nkeywords++, kw);
-                ndoublestars++;
-            }
-            else if (TYPE(CHILD(ch, 1)) == comp_for) {
-                /* the lone generator expression */
-                e = copy_location(ast_for_genexp(c, ch), maybegenbeg, closepar);
-                if (!e)
-                    return NULL;
-                asdl_seq_SET(args, nargs++, e);
-            }
-            else if (TYPE(CHILD(ch, 1)) == COLONEQUAL) {
-                /* treat colon equal as positional argument */
-                if (nkeywords) {
-                    if (ndoublestars) {
-                        ast_error(c, chch,
-                                  "positional argument follows "
-                                  "keyword argument unpacking");
-                    }
-                    else {
-                        ast_error(c, chch,
-                                  "positional argument follows "
-                                  "keyword argument");
-                    }
-                    return NULL;
-                }
-                e = ast_for_namedexpr(c, ch);
-                if (!e)
-                    return NULL;
-                asdl_seq_SET(args, nargs++, e);
-            }
-            else {
-                /* a keyword argument */
-                keyword_ty kw;
-                identifier key;
-
-                // To remain LL(1), the grammar accepts any test (basically, any
-                // expression) in the keyword slot of a call site.  So, we need
-                // to manually enforce that the keyword is a NAME here.
-                static const int name_tree[] = {
-                    test,
-                    or_test,
-                    and_test,
-                    not_test,
-                    comparison,
-                    expr,
-                    xor_expr,
-                    and_expr,
-                    shift_expr,
-                    arith_expr,
-                    term,
-                    factor,
-                    power,
-                    atom_expr,
-                    atom,
-                    0,
-                };
-                node *expr_node = chch;
-                for (int i = 0; name_tree[i]; i++) {
-                    if (TYPE(expr_node) != name_tree[i])
-                        break;
-                    if (NCH(expr_node) != 1)
-                        break;
-                    expr_node = CHILD(expr_node, 0);
-                }
-                if (TYPE(expr_node) != NAME) {
-                    ast_error(c, chch,
-                              "expression cannot contain assignment, "
-                              "perhaps you meant \"==\"?");
-                    return NULL;
-                }
-                key = new_identifier(STR(expr_node), c);
-                if (key == NULL) {
-                    return NULL;
-                }
-                if (forbidden_name(c, key, chch, 1)) {
-                    return NULL;
-                }
-                e = ast_for_expr(c, CHILD(ch, 2));
-                if (!e)
-                    return NULL;
-                kw = keyword(key, e, chch->n_lineno, chch->n_col_offset,
-                             e->end_lineno, e->end_col_offset, c->c_arena);
-
-                if (!kw)
-                    return NULL;
-                asdl_seq_SET(keywords, nkeywords++, kw);
-            }
-        }
-    }
-
-    return Call(func, args, keywords, LINENO(start), start->n_col_offset,
-                closepar->n_end_lineno, closepar->n_end_col_offset, c->c_arena);
-}
-
-static expr_ty
-ast_for_testlist(struct compiling *c, const node* n)
-{
-    /* testlist_comp: test (comp_for | (',' test)* [',']) */
-    /* testlist: test (',' test)* [','] */
-    assert(NCH(n) > 0);
-    if (TYPE(n) == testlist_comp) {
-        if (NCH(n) > 1)
-            assert(TYPE(CHILD(n, 1)) != comp_for);
-    }
-    else {
-        assert(TYPE(n) == testlist ||
-               TYPE(n) == testlist_star_expr);
-    }
-    if (NCH(n) == 1)
-        return ast_for_expr(c, CHILD(n, 0));
-    else {
-        asdl_seq *tmp = seq_for_testlist(c, n);
-        if (!tmp)
-            return NULL;
-        return Tuple(tmp, Load, LINENO(n), n->n_col_offset,
-                     n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-    }
-}
-
-static stmt_ty
-ast_for_expr_stmt(struct compiling *c, const node *n)
-{
-    REQ(n, expr_stmt);
-    /* expr_stmt: testlist_star_expr (annassign | augassign (yield_expr|testlist) |
-                     [('=' (yield_expr|testlist_star_expr))+ [TYPE_COMMENT]] )
-       annassign: ':' test ['=' (yield_expr|testlist)]
-       testlist_star_expr: (test|star_expr) (',' (test|star_expr))* [',']
-       augassign: ('+=' | '-=' | '*=' | '@=' | '/=' | '%=' | '&=' | '|=' | '^=' |
-                   '<<=' | '>>=' | '**=' | '//=')
-       test: ... here starts the operator precedence dance
-     */
-    int num = NCH(n);
-
-    if (num == 1) {
-        expr_ty e = ast_for_testlist(c, CHILD(n, 0));
-        if (!e)
-            return NULL;
-
-        return Expr(e, LINENO(n), n->n_col_offset,
-                    n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-    }
-    else if (TYPE(CHILD(n, 1)) == augassign) {
-        expr_ty expr1, expr2;
-        operator_ty newoperator;
-        node *ch = CHILD(n, 0);
-
-        expr1 = ast_for_testlist(c, ch);
-        if (!expr1)
-            return NULL;
-        /* Augmented assignments can only have a name, a subscript, or an
-          attribute on the left, though, so we have to explicitly check for
-          those. */
-        switch (expr1->kind) {
-            case Name_kind:
-            case Attribute_kind:
-            case Subscript_kind:
-                break;
-            default:
-                ast_error(c, ch, "'%s' is an illegal expression for augmented assignment",
-                          get_expr_name(expr1));
-                return NULL;
-        }
-
-        /* set_context checks that most expressions are not the left side. */
-        if(!set_context(c, expr1, Store, ch)) {
-            return NULL;
-        }
-
-        ch = CHILD(n, 2);
-        if (TYPE(ch) == testlist)
-            expr2 = ast_for_testlist(c, ch);
-        else
-            expr2 = ast_for_expr(c, ch);
-        if (!expr2)
-            return NULL;
-
-        newoperator = ast_for_augassign(c, CHILD(n, 1));
-        if (!newoperator)
-            return NULL;
-
-        return AugAssign(expr1, newoperator, expr2, LINENO(n), n->n_col_offset,
-                         n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-    }
-    else if (TYPE(CHILD(n, 1)) == annassign) {
-        expr_ty expr1, expr2, expr3;
-        node *ch = CHILD(n, 0);
-        node *deep, *ann = CHILD(n, 1);
-        int simple = 1;
-
-        /* AnnAssigns are only allowed in Python 3.6 or greater */
-        if (c->c_feature_version < 6) {
-            ast_error(c, ch,
-                      "Variable annotation syntax is only supported in Python 3.6 and greater");
-            return NULL;
-        }
-
-        /* we keep track of parens to qualify (x) as expression not name */
-        deep = ch;
-        while (NCH(deep) == 1) {
-            deep = CHILD(deep, 0);
-        }
-        if (NCH(deep) > 0 && TYPE(CHILD(deep, 0)) == LPAR) {
-            simple = 0;
-        }
-        expr1 = ast_for_testlist(c, ch);
-        if (!expr1) {
-            return NULL;
-        }
-        switch (expr1->kind) {
-            case Name_kind:
-                if (forbidden_name(c, expr1->v.Name.id, n, 0)) {
-                    return NULL;
-                }
-                expr1->v.Name.ctx = Store;
-                break;
-            case Attribute_kind:
-                if (forbidden_name(c, expr1->v.Attribute.attr, n, 1)) {
-                    return NULL;
-                }
-                expr1->v.Attribute.ctx = Store;
-                break;
-            case Subscript_kind:
-                expr1->v.Subscript.ctx = Store;
-                break;
-            case List_kind:
-                ast_error(c, ch,
-                          "only single target (not list) can be annotated");
-                return NULL;
-            case Tuple_kind:
-                ast_error(c, ch,
-                          "only single target (not tuple) can be annotated");
-                return NULL;
-            default:
-                ast_error(c, ch,
-                          "illegal target for annotation");
-                return NULL;
-        }
-
-        if (expr1->kind != Name_kind) {
-            simple = 0;
-        }
-        ch = CHILD(ann, 1);
-        expr2 = ast_for_expr(c, ch);
-        if (!expr2) {
-            return NULL;
-        }
-        if (NCH(ann) == 2) {
-            return AnnAssign(expr1, expr2, NULL, simple,
-                             LINENO(n), n->n_col_offset,
-                             n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-        }
-        else {
-            ch = CHILD(ann, 3);
-            if (TYPE(ch) == testlist_star_expr) {
-                expr3 = ast_for_testlist(c, ch);
-            }
-            else {
-                expr3 = ast_for_expr(c, ch);
-            }
-            if (!expr3) {
-                return NULL;
-            }
-            return AnnAssign(expr1, expr2, expr3, simple,
-                             LINENO(n), n->n_col_offset,
-                             n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-        }
-    }
-    else {
-        int i, nch_minus_type, has_type_comment;
-        asdl_seq *targets;
-        node *value;
-        expr_ty expression;
-        string type_comment;
-
-        /* a normal assignment */
-        REQ(CHILD(n, 1), EQUAL);
-
-        has_type_comment = TYPE(CHILD(n, num - 1)) == TYPE_COMMENT;
-        nch_minus_type = num - has_type_comment;
-
-        targets = _Py_asdl_seq_new(nch_minus_type / 2, c->c_arena);
-        if (!targets)
-            return NULL;
-        for (i = 0; i < nch_minus_type - 2; i += 2) {
-            expr_ty e;
-            node *ch = CHILD(n, i);
-            if (TYPE(ch) == yield_expr) {
-                ast_error(c, ch, "assignment to yield expression not possible");
-                return NULL;
-            }
-            e = ast_for_testlist(c, ch);
-            if (!e)
-              return NULL;
-
-            /* set context to assign */
-            if (!set_context(c, e, Store, CHILD(n, i)))
-              return NULL;
-
-            asdl_seq_SET(targets, i / 2, e);
-        }
-        value = CHILD(n, nch_minus_type - 1);
-        if (TYPE(value) == testlist_star_expr)
-            expression = ast_for_testlist(c, value);
-        else
-            expression = ast_for_expr(c, value);
-        if (!expression)
-            return NULL;
-        if (has_type_comment) {
-            type_comment = NEW_TYPE_COMMENT(CHILD(n, nch_minus_type));
-            if (!type_comment)
-                return NULL;
-        }
-        else
-            type_comment = NULL;
-        return Assign(targets, expression, type_comment, LINENO(n), n->n_col_offset,
-                      n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-    }
-}
-
-
-static asdl_seq *
-ast_for_exprlist(struct compiling *c, const node *n, expr_context_ty context)
-{
-    asdl_seq *seq;
-    int i;
-    expr_ty e;
-
-    REQ(n, exprlist);
-
-    seq = _Py_asdl_seq_new((NCH(n) + 1) / 2, c->c_arena);
-    if (!seq)
-        return NULL;
-    for (i = 0; i < NCH(n); i += 2) {
-        e = ast_for_expr(c, CHILD(n, i));
-        if (!e)
-            return NULL;
-        asdl_seq_SET(seq, i / 2, e);
-        if (context && !set_context(c, e, context, CHILD(n, i)))
-            return NULL;
-    }
-    return seq;
-}
-
-static stmt_ty
-ast_for_del_stmt(struct compiling *c, const node *n)
-{
-    asdl_seq *expr_list;
-
-    /* del_stmt: 'del' exprlist */
-    REQ(n, del_stmt);
-
-    expr_list = ast_for_exprlist(c, CHILD(n, 1), Del);
-    if (!expr_list)
-        return NULL;
-    return Delete(expr_list, LINENO(n), n->n_col_offset,
-                  n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-}
-
-static stmt_ty
-ast_for_flow_stmt(struct compiling *c, const node *n)
-{
-    /*
-      flow_stmt: break_stmt | continue_stmt | return_stmt | raise_stmt
-                 | yield_stmt
-      break_stmt: 'break'
-      continue_stmt: 'continue'
-      return_stmt: 'return' [testlist]
-      yield_stmt: yield_expr
-      yield_expr: 'yield' testlist | 'yield' 'from' test
-      raise_stmt: 'raise' [test [',' test [',' test]]]
-    */
-    node *ch;
-
-    REQ(n, flow_stmt);
-    ch = CHILD(n, 0);
-    switch (TYPE(ch)) {
-        case break_stmt:
-            return Break(LINENO(n), n->n_col_offset,
-                         n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-        case continue_stmt:
-            return Continue(LINENO(n), n->n_col_offset,
-                            n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-        case yield_stmt: { /* will reduce to yield_expr */
-            expr_ty exp = ast_for_expr(c, CHILD(ch, 0));
-            if (!exp)
-                return NULL;
-            return Expr(exp, LINENO(n), n->n_col_offset,
-                        n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-        }
-        case return_stmt:
-            if (NCH(ch) == 1)
-                return Return(NULL, LINENO(n), n->n_col_offset,
-                              n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-            else {
-                expr_ty expression = ast_for_testlist(c, CHILD(ch, 1));
-                if (!expression)
-                    return NULL;
-                return Return(expression, LINENO(n), n->n_col_offset,
-                              n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-            }
-        case raise_stmt:
-            if (NCH(ch) == 1)
-                return Raise(NULL, NULL, LINENO(n), n->n_col_offset,
-                             n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-            else if (NCH(ch) >= 2) {
-                expr_ty cause = NULL;
-                expr_ty expression = ast_for_expr(c, CHILD(ch, 1));
-                if (!expression)
-                    return NULL;
-                if (NCH(ch) == 4) {
-                    cause = ast_for_expr(c, CHILD(ch, 3));
-                    if (!cause)
-                        return NULL;
-                }
-                return Raise(expression, cause, LINENO(n), n->n_col_offset,
-                             n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-            }
-            /* fall through */
-        default:
-            PyErr_Format(PyExc_SystemError,
-                         "unexpected flow_stmt: %d", TYPE(ch));
-            return NULL;
-    }
-}
-
-static alias_ty
-alias_for_import_name(struct compiling *c, const node *n, int store)
-{
-    /*
-      import_as_name: NAME ['as' NAME]
-      dotted_as_name: dotted_name ['as' NAME]
-      dotted_name: NAME ('.' NAME)*
-    */
-    identifier str, name;
-
- loop:
-    switch (TYPE(n)) {
-        case import_as_name: {
-            node *name_node = CHILD(n, 0);
-            str = NULL;
-            name = NEW_IDENTIFIER(name_node);
-            if (!name)
-                return NULL;
-            if (NCH(n) == 3) {
-                node *str_node = CHILD(n, 2);
-                str = NEW_IDENTIFIER(str_node);
-                if (!str)
-                    return NULL;
-                if (store && forbidden_name(c, str, str_node, 0))
-                    return NULL;
-            }
-            else {
-                if (forbidden_name(c, name, name_node, 0))
-                    return NULL;
-            }
-            return alias(name, str, c->c_arena);
-        }
-        case dotted_as_name:
-            if (NCH(n) == 1) {
-                n = CHILD(n, 0);
-                goto loop;
-            }
-            else {
-                node *asname_node = CHILD(n, 2);
-                alias_ty a = alias_for_import_name(c, CHILD(n, 0), 0);
-                if (!a)
-                    return NULL;
-                assert(!a->asname);
-                a->asname = NEW_IDENTIFIER(asname_node);
-                if (!a->asname)
-                    return NULL;
-                if (forbidden_name(c, a->asname, asname_node, 0))
-                    return NULL;
-                return a;
-            }
-        case dotted_name:
-            if (NCH(n) == 1) {
-                node *name_node = CHILD(n, 0);
-                name = NEW_IDENTIFIER(name_node);
-                if (!name)
-                    return NULL;
-                if (store && forbidden_name(c, name, name_node, 0))
-                    return NULL;
-                return alias(name, NULL, c->c_arena);
-            }
-            else {
-                /* Create a string of the form "a.b.c" */
-                int i;
-                size_t len;
-                char *s;
-                PyObject *uni;
-
-                len = 0;
-                for (i = 0; i < NCH(n); i += 2)
-                    /* length of string plus one for the dot */
-                    len += strlen(STR(CHILD(n, i))) + 1;
-                len--; /* the last name doesn't have a dot */
-                str = PyBytes_FromStringAndSize(NULL, len);
-                if (!str)
-                    return NULL;
-                s = PyBytes_AS_STRING(str);
-                if (!s)
-                    return NULL;
-                for (i = 0; i < NCH(n); i += 2) {
-                    char *sch = STR(CHILD(n, i));
-                    strcpy(s, STR(CHILD(n, i)));
-                    s += strlen(sch);
-                    *s++ = '.';
-                }
-                --s;
-                *s = '\0';
-                uni = PyUnicode_DecodeUTF8(PyBytes_AS_STRING(str),
-                                           PyBytes_GET_SIZE(str),
-                                           NULL);
-                Py_DECREF(str);
-                if (!uni)
-                    return NULL;
-                str = uni;
-                PyUnicode_InternInPlace(&str);
-                if (PyArena_AddPyObject(c->c_arena, str) < 0) {
-                    Py_DECREF(str);
-                    return NULL;
-                }
-                return alias(str, NULL, c->c_arena);
-            }
-        case STAR:
-            str = PyUnicode_InternFromString("*");
-            if (!str)
-                return NULL;
-            if (PyArena_AddPyObject(c->c_arena, str) < 0) {
-                Py_DECREF(str);
-                return NULL;
-            }
-            return alias(str, NULL, c->c_arena);
-        default:
-            PyErr_Format(PyExc_SystemError,
-                         "unexpected import name: %d", TYPE(n));
-            return NULL;
-    }
-}
-
-static stmt_ty
-ast_for_import_stmt(struct compiling *c, const node *n)
-{
-    /*
-      import_stmt: import_name | import_from
-      import_name: 'import' dotted_as_names
-      import_from: 'from' (('.' | '...')* dotted_name | ('.' | '...')+)
-                   'import' ('*' | '(' import_as_names ')' | import_as_names)
-    */
-    int lineno;
-    int col_offset;
-    int i;
-    asdl_seq *aliases;
-
-    REQ(n, import_stmt);
-    lineno = LINENO(n);
-    col_offset = n->n_col_offset;
-    n = CHILD(n, 0);
-    if (TYPE(n) == import_name) {
-        n = CHILD(n, 1);
-        REQ(n, dotted_as_names);
-        aliases = _Py_asdl_seq_new((NCH(n) + 1) / 2, c->c_arena);
-        if (!aliases)
-                return NULL;
-        for (i = 0; i < NCH(n); i += 2) {
-            alias_ty import_alias = alias_for_import_name(c, CHILD(n, i), 1);
-            if (!import_alias)
-                return NULL;
-            asdl_seq_SET(aliases, i / 2, import_alias);
-        }
-        // Even though n is modified above, the end position is not changed
-        return Import(aliases, lineno, col_offset,
-                      n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-    }
-    else if (TYPE(n) == import_from) {
-        int n_children;
-        int idx, ndots = 0;
-        const node *n_copy = n;
-        alias_ty mod = NULL;
-        identifier modname = NULL;
-
-       /* Count the number of dots (for relative imports) and check for the
-          optional module name */
-        for (idx = 1; idx < NCH(n); idx++) {
-            if (TYPE(CHILD(n, idx)) == dotted_name) {
-                mod = alias_for_import_name(c, CHILD(n, idx), 0);
-                if (!mod)
-                    return NULL;
-                idx++;
-                break;
-            } else if (TYPE(CHILD(n, idx)) == ELLIPSIS) {
-                /* three consecutive dots are tokenized as one ELLIPSIS */
-                ndots += 3;
-                continue;
-            } else if (TYPE(CHILD(n, idx)) != DOT) {
-                break;
-            }
-            ndots++;
-        }
-        idx++; /* skip over the 'import' keyword */
-        switch (TYPE(CHILD(n, idx))) {
-        case STAR:
-            /* from ... import * */
-            n = CHILD(n, idx);
-            n_children = 1;
-            break;
-        case LPAR:
-            /* from ... import (x, y, z) */
-            n = CHILD(n, idx + 1);
-            n_children = NCH(n);
-            break;
-        case import_as_names:
-            /* from ... import x, y, z */
-            n = CHILD(n, idx);
-            n_children = NCH(n);
-            if (n_children % 2 == 0) {
-                ast_error(c, n,
-                          "trailing comma not allowed without"
-                          " surrounding parentheses");
-                return NULL;
-            }
-            break;
-        default:
-            ast_error(c, n, "Unexpected node-type in from-import");
-            return NULL;
-        }
-
-        aliases = _Py_asdl_seq_new((n_children + 1) / 2, c->c_arena);
-        if (!aliases)
-            return NULL;
-
-        /* handle "from ... import *" special b/c there's no children */
-        if (TYPE(n) == STAR) {
-            alias_ty import_alias = alias_for_import_name(c, n, 1);
-            if (!import_alias)
-                return NULL;
-            asdl_seq_SET(aliases, 0, import_alias);
-        }
-        else {
-            for (i = 0; i < NCH(n); i += 2) {
-                alias_ty import_alias = alias_for_import_name(c, CHILD(n, i), 1);
-                if (!import_alias)
-                    return NULL;
-                asdl_seq_SET(aliases, i / 2, import_alias);
-            }
-        }
-        if (mod != NULL)
-            modname = mod->name;
-        return ImportFrom(modname, aliases, ndots, lineno, col_offset,
-                          n_copy->n_end_lineno, n_copy->n_end_col_offset,
-                          c->c_arena);
-    }
-    PyErr_Format(PyExc_SystemError,
-                 "unknown import statement: starts with command '%s'",
-                 STR(CHILD(n, 0)));
-    return NULL;
-}
-
-static stmt_ty
-ast_for_global_stmt(struct compiling *c, const node *n)
-{
-    /* global_stmt: 'global' NAME (',' NAME)* */
-    identifier name;
-    asdl_seq *s;
-    int i;
-
-    REQ(n, global_stmt);
-    s = _Py_asdl_seq_new(NCH(n) / 2, c->c_arena);
-    if (!s)
-        return NULL;
-    for (i = 1; i < NCH(n); i += 2) {
-        name = NEW_IDENTIFIER(CHILD(n, i));
-        if (!name)
-            return NULL;
-        asdl_seq_SET(s, i / 2, name);
-    }
-    return Global(s, LINENO(n), n->n_col_offset,
-                  n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-}
-
-static stmt_ty
-ast_for_nonlocal_stmt(struct compiling *c, const node *n)
-{
-    /* nonlocal_stmt: 'nonlocal' NAME (',' NAME)* */
-    identifier name;
-    asdl_seq *s;
-    int i;
-
-    REQ(n, nonlocal_stmt);
-    s = _Py_asdl_seq_new(NCH(n) / 2, c->c_arena);
-    if (!s)
-        return NULL;
-    for (i = 1; i < NCH(n); i += 2) {
-        name = NEW_IDENTIFIER(CHILD(n, i));
-        if (!name)
-            return NULL;
-        asdl_seq_SET(s, i / 2, name);
-    }
-    return Nonlocal(s, LINENO(n), n->n_col_offset,
-                    n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-}
-
-static stmt_ty
-ast_for_assert_stmt(struct compiling *c, const node *n)
-{
-    /* assert_stmt: 'assert' test [',' test] */
-    REQ(n, assert_stmt);
-    if (NCH(n) == 2) {
-        expr_ty expression = ast_for_expr(c, CHILD(n, 1));
-        if (!expression)
-            return NULL;
-        return Assert(expression, NULL, LINENO(n), n->n_col_offset,
-                      n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-    }
-    else if (NCH(n) == 4) {
-        expr_ty expr1, expr2;
-
-        expr1 = ast_for_expr(c, CHILD(n, 1));
-        if (!expr1)
-            return NULL;
-        expr2 = ast_for_expr(c, CHILD(n, 3));
-        if (!expr2)
-            return NULL;
-
-        return Assert(expr1, expr2, LINENO(n), n->n_col_offset,
-                      n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-    }
-    PyErr_Format(PyExc_SystemError,
-                 "improper number of parts to 'assert' statement: %d",
-                 NCH(n));
-    return NULL;
-}
-
-static asdl_seq *
-ast_for_suite(struct compiling *c, const node *n)
-{
-    /* suite: simple_stmt | NEWLINE [TYPE_COMMENT NEWLINE] INDENT stmt+ DEDENT */
-    asdl_seq *seq;
-    stmt_ty s;
-    int i, total, num, end, pos = 0;
-    node *ch;
-
-    if (TYPE(n) != func_body_suite) {
-        REQ(n, suite);
-    }
-
-    total = num_stmts(n);
-    seq = _Py_asdl_seq_new(total, c->c_arena);
-    if (!seq)
-        return NULL;
-    if (TYPE(CHILD(n, 0)) == simple_stmt) {
-        n = CHILD(n, 0);
-        /* simple_stmt always ends with a NEWLINE,
-           and may have a trailing SEMI
-        */
-        end = NCH(n) - 1;
-        if (TYPE(CHILD(n, end - 1)) == SEMI)
-            end--;
-        /* loop by 2 to skip semi-colons */
-        for (i = 0; i < end; i += 2) {
-            ch = CHILD(n, i);
-            s = ast_for_stmt(c, ch);
-            if (!s)
-                return NULL;
-            asdl_seq_SET(seq, pos++, s);
-        }
-    }
-    else {
-        i = 2;
-        if (TYPE(CHILD(n, 1)) == TYPE_COMMENT) {
-            i += 2;
-            REQ(CHILD(n, 2), NEWLINE);
-        }
-
-        for (; i < (NCH(n) - 1); i++) {
-            ch = CHILD(n, i);
-            REQ(ch, stmt);
-            num = num_stmts(ch);
-            if (num == 1) {
-                /* small_stmt or compound_stmt with only one child */
-                s = ast_for_stmt(c, ch);
-                if (!s)
-                    return NULL;
-                asdl_seq_SET(seq, pos++, s);
-            }
-            else {
-                int j;
-                ch = CHILD(ch, 0);
-                REQ(ch, simple_stmt);
-                for (j = 0; j < NCH(ch); j += 2) {
-                    /* statement terminates with a semi-colon ';' */
-                    if (NCH(CHILD(ch, j)) == 0) {
-                        assert((j + 1) == NCH(ch));
-                        break;
-                    }
-                    s = ast_for_stmt(c, CHILD(ch, j));
-                    if (!s)
-                        return NULL;
-                    asdl_seq_SET(seq, pos++, s);
-                }
-            }
-        }
-    }
-    assert(pos == seq->size);
-    return seq;
-}
-
-static void
-get_last_end_pos(asdl_seq *s, int *end_lineno, int *end_col_offset)
-{
-    Py_ssize_t tot = asdl_seq_LEN(s);
-    // There must be no empty suites.
-    assert(tot > 0);
-    stmt_ty last = asdl_seq_GET(s, tot - 1);
-    *end_lineno = last->end_lineno;
-    *end_col_offset = last->end_col_offset;
-}
-
-static stmt_ty
-ast_for_if_stmt(struct compiling *c, const node *n)
-{
-    /* if_stmt: 'if' test ':' suite ('elif' test ':' suite)*
-       ['else' ':' suite]
-    */
-    char *s;
-    int end_lineno, end_col_offset;
-
-    REQ(n, if_stmt);
-
-    if (NCH(n) == 4) {
-        expr_ty expression;
-        asdl_seq *suite_seq;
-
-        expression = ast_for_expr(c, CHILD(n, 1));
-        if (!expression)
-            return NULL;
-        suite_seq = ast_for_suite(c, CHILD(n, 3));
-        if (!suite_seq)
-            return NULL;
-        get_last_end_pos(suite_seq, &end_lineno, &end_col_offset);
-
-        return If(expression, suite_seq, NULL, LINENO(n), n->n_col_offset,
-                  end_lineno, end_col_offset, c->c_arena);
-    }
-
-    s = STR(CHILD(n, 4));
-    /* s[2], the third character in the string, will be
-       's' for el_s_e, or
-       'i' for el_i_f
-    */
-    if (s[2] == 's') {
-        expr_ty expression;
-        asdl_seq *seq1, *seq2;
-
-        expression = ast_for_expr(c, CHILD(n, 1));
-        if (!expression)
-            return NULL;
-        seq1 = ast_for_suite(c, CHILD(n, 3));
-        if (!seq1)
-            return NULL;
-        seq2 = ast_for_suite(c, CHILD(n, 6));
-        if (!seq2)
-            return NULL;
-        get_last_end_pos(seq2, &end_lineno, &end_col_offset);
-
-        return If(expression, seq1, seq2, LINENO(n), n->n_col_offset,
-                  end_lineno, end_col_offset, c->c_arena);
-    }
-    else if (s[2] == 'i') {
-        int i, n_elif, has_else = 0;
-        expr_ty expression;
-        asdl_seq *suite_seq;
-        asdl_seq *orelse = NULL;
-        n_elif = NCH(n) - 4;
-        /* must reference the child n_elif+1 since 'else' token is third,
-           not fourth, child from the end. */
-        if (TYPE(CHILD(n, (n_elif + 1))) == NAME
-            && STR(CHILD(n, (n_elif + 1)))[2] == 's') {
-            has_else = 1;
-            n_elif -= 3;
-        }
-        n_elif /= 4;
-
-        if (has_else) {
-            asdl_seq *suite_seq2;
-
-            orelse = _Py_asdl_seq_new(1, c->c_arena);
-            if (!orelse)
-                return NULL;
-            expression = ast_for_expr(c, CHILD(n, NCH(n) - 6));
-            if (!expression)
-                return NULL;
-            suite_seq = ast_for_suite(c, CHILD(n, NCH(n) - 4));
-            if (!suite_seq)
-                return NULL;
-            suite_seq2 = ast_for_suite(c, CHILD(n, NCH(n) - 1));
-            if (!suite_seq2)
-                return NULL;
-            get_last_end_pos(suite_seq2, &end_lineno, &end_col_offset);
-
-            asdl_seq_SET(orelse, 0,
-                         If(expression, suite_seq, suite_seq2,
-                            LINENO(CHILD(n, NCH(n) - 7)),
-                            CHILD(n, NCH(n) - 7)->n_col_offset,
-                            end_lineno, end_col_offset, c->c_arena));
-            /* the just-created orelse handled the last elif */
-            n_elif--;
-        }
-
-        for (i = 0; i < n_elif; i++) {
-            int off = 5 + (n_elif - i - 1) * 4;
-            asdl_seq *newobj = _Py_asdl_seq_new(1, c->c_arena);
-            if (!newobj)
-                return NULL;
-            expression = ast_for_expr(c, CHILD(n, off));
-            if (!expression)
-                return NULL;
-            suite_seq = ast_for_suite(c, CHILD(n, off + 2));
-            if (!suite_seq)
-                return NULL;
-
-            if (orelse != NULL) {
-                get_last_end_pos(orelse, &end_lineno, &end_col_offset);
-            } else {
-                get_last_end_pos(suite_seq, &end_lineno, &end_col_offset);
-            }
-            asdl_seq_SET(newobj, 0,
-                         If(expression, suite_seq, orelse,
-                            LINENO(CHILD(n, off - 1)),
-                            CHILD(n, off - 1)->n_col_offset,
-                            end_lineno, end_col_offset, c->c_arena));
-            orelse = newobj;
-        }
-        expression = ast_for_expr(c, CHILD(n, 1));
-        if (!expression)
-            return NULL;
-        suite_seq = ast_for_suite(c, CHILD(n, 3));
-        if (!suite_seq)
-            return NULL;
-        get_last_end_pos(orelse, &end_lineno, &end_col_offset);
-        return If(expression, suite_seq, orelse,
-                  LINENO(n), n->n_col_offset,
-                  end_lineno, end_col_offset, c->c_arena);
-    }
-
-    PyErr_Format(PyExc_SystemError,
-                 "unexpected token in 'if' statement: %s", s);
-    return NULL;
-}
-
-static stmt_ty
-ast_for_while_stmt(struct compiling *c, const node *n)
-{
-    /* while_stmt: 'while' test ':' suite ['else' ':' suite] */
-    REQ(n, while_stmt);
-    int end_lineno, end_col_offset;
-
-    if (NCH(n) == 4) {
-        expr_ty expression;
-        asdl_seq *suite_seq;
-
-        expression = ast_for_expr(c, CHILD(n, 1));
-        if (!expression)
-            return NULL;
-        suite_seq = ast_for_suite(c, CHILD(n, 3));
-        if (!suite_seq)
-            return NULL;
-        get_last_end_pos(suite_seq, &end_lineno, &end_col_offset);
-        return While(expression, suite_seq, NULL, LINENO(n), n->n_col_offset,
-                     end_lineno, end_col_offset, c->c_arena);
-    }
-    else if (NCH(n) == 7) {
-        expr_ty expression;
-        asdl_seq *seq1, *seq2;
-
-        expression = ast_for_expr(c, CHILD(n, 1));
-        if (!expression)
-            return NULL;
-        seq1 = ast_for_suite(c, CHILD(n, 3));
-        if (!seq1)
-            return NULL;
-        seq2 = ast_for_suite(c, CHILD(n, 6));
-        if (!seq2)
-            return NULL;
-        get_last_end_pos(seq2, &end_lineno, &end_col_offset);
-
-        return While(expression, seq1, seq2, LINENO(n), n->n_col_offset,
-                     end_lineno, end_col_offset, c->c_arena);
-    }
-
-    PyErr_Format(PyExc_SystemError,
-                 "wrong number of tokens for 'while' statement: %d",
-                 NCH(n));
-    return NULL;
-}
-
-static stmt_ty
-ast_for_for_stmt(struct compiling *c, const node *n0, bool is_async)
-{
-    const node * const n = is_async ? CHILD(n0, 1) : n0;
-    asdl_seq *_target, *seq = NULL, *suite_seq;
-    expr_ty expression;
-    expr_ty target, first;
-    const node *node_target;
-    int end_lineno, end_col_offset;
-    int has_type_comment;
-    string type_comment;
-
-    if (is_async && c->c_feature_version < 5) {
-        ast_error(c, n,
-                  "Async for loops are only supported in Python 3.5 and greater");
-        return NULL;
-    }
-
-    /* for_stmt: 'for' exprlist 'in' testlist ':' [TYPE_COMMENT] suite ['else' ':' suite] */
-    REQ(n, for_stmt);
-
-    has_type_comment = TYPE(CHILD(n, 5)) == TYPE_COMMENT;
-
-    if (NCH(n) == 9 + has_type_comment) {
-        seq = ast_for_suite(c, CHILD(n, 8 + has_type_comment));
-        if (!seq)
-            return NULL;
-    }
-
-    node_target = CHILD(n, 1);
-    _target = ast_for_exprlist(c, node_target, Store);
-    if (!_target)
-        return NULL;
-    /* Check the # of children rather than the length of _target, since
-       for x, in ... has 1 element in _target, but still requires a Tuple. */
-    first = (expr_ty)asdl_seq_GET(_target, 0);
-    if (NCH(node_target) == 1)
-        target = first;
-    else
-        target = Tuple(_target, Store, first->lineno, first->col_offset,
-                       node_target->n_end_lineno, node_target->n_end_col_offset,
-                       c->c_arena);
-
-    expression = ast_for_testlist(c, CHILD(n, 3));
-    if (!expression)
-        return NULL;
-    suite_seq = ast_for_suite(c, CHILD(n, 5 + has_type_comment));
-    if (!suite_seq)
-        return NULL;
-
-    if (seq != NULL) {
-        get_last_end_pos(seq, &end_lineno, &end_col_offset);
-    } else {
-        get_last_end_pos(suite_seq, &end_lineno, &end_col_offset);
-    }
-
-    if (has_type_comment) {
-        type_comment = NEW_TYPE_COMMENT(CHILD(n, 5));
-        if (!type_comment)
-            return NULL;
-    }
-    else
-        type_comment = NULL;
-
-    if (is_async)
-        return AsyncFor(target, expression, suite_seq, seq, type_comment,
-                        LINENO(n0), n0->n_col_offset,
-                        end_lineno, end_col_offset, c->c_arena);
-    else
-        return For(target, expression, suite_seq, seq, type_comment,
-                   LINENO(n), n->n_col_offset,
-                   end_lineno, end_col_offset, c->c_arena);
-}
-
-static excepthandler_ty
-ast_for_except_clause(struct compiling *c, const node *exc, node *body)
-{
-    /* except_clause: 'except' [test ['as' test]] */
-    int end_lineno, end_col_offset;
-    REQ(exc, except_clause);
-    REQ(body, suite);
-
-    if (NCH(exc) == 1) {
-        asdl_seq *suite_seq = ast_for_suite(c, body);
-        if (!suite_seq)
-            return NULL;
-        get_last_end_pos(suite_seq, &end_lineno, &end_col_offset);
-
-        return ExceptHandler(NULL, NULL, suite_seq, LINENO(exc),
-                             exc->n_col_offset,
-                             end_lineno, end_col_offset, c->c_arena);
-    }
-    else if (NCH(exc) == 2) {
-        expr_ty expression;
-        asdl_seq *suite_seq;
-
-        expression = ast_for_expr(c, CHILD(exc, 1));
-        if (!expression)
-            return NULL;
-        suite_seq = ast_for_suite(c, body);
-        if (!suite_seq)
-            return NULL;
-        get_last_end_pos(suite_seq, &end_lineno, &end_col_offset);
-
-        return ExceptHandler(expression, NULL, suite_seq, LINENO(exc),
-                             exc->n_col_offset,
-                             end_lineno, end_col_offset, c->c_arena);
-    }
-    else if (NCH(exc) == 4) {
-        asdl_seq *suite_seq;
-        expr_ty expression;
-        identifier e = NEW_IDENTIFIER(CHILD(exc, 3));
-        if (!e)
-            return NULL;
-        if (forbidden_name(c, e, CHILD(exc, 3), 0))
-            return NULL;
-        expression = ast_for_expr(c, CHILD(exc, 1));
-        if (!expression)
-            return NULL;
-        suite_seq = ast_for_suite(c, body);
-        if (!suite_seq)
-            return NULL;
-        get_last_end_pos(suite_seq, &end_lineno, &end_col_offset);
-
-        return ExceptHandler(expression, e, suite_seq, LINENO(exc),
-                             exc->n_col_offset,
-                             end_lineno, end_col_offset, c->c_arena);
-    }
-
-    PyErr_Format(PyExc_SystemError,
-                 "wrong number of children for 'except' clause: %d",
-                 NCH(exc));
-    return NULL;
-}
-
-static stmt_ty
-ast_for_try_stmt(struct compiling *c, const node *n)
-{
-    const int nch = NCH(n);
-    int end_lineno, end_col_offset, n_except = (nch - 3)/3;
-    asdl_seq *body, *handlers = NULL, *orelse = NULL, *finally = NULL;
-    excepthandler_ty last_handler;
-
-    REQ(n, try_stmt);
-
-    body = ast_for_suite(c, CHILD(n, 2));
-    if (body == NULL)
-        return NULL;
-
-    if (TYPE(CHILD(n, nch - 3)) == NAME) {
-        if (strcmp(STR(CHILD(n, nch - 3)), "finally") == 0) {
-            if (nch >= 9 && TYPE(CHILD(n, nch - 6)) == NAME) {
-                /* we can assume it's an "else",
-                   because nch >= 9 for try-else-finally and
-                   it would otherwise have a type of except_clause */
-                orelse = ast_for_suite(c, CHILD(n, nch - 4));
-                if (orelse == NULL)
-                    return NULL;
-                n_except--;
-            }
-
-            finally = ast_for_suite(c, CHILD(n, nch - 1));
-            if (finally == NULL)
-                return NULL;
-            n_except--;
-        }
-        else {
-            /* we can assume it's an "else",
-               otherwise it would have a type of except_clause */
-            orelse = ast_for_suite(c, CHILD(n, nch - 1));
-            if (orelse == NULL)
-                return NULL;
-            n_except--;
-        }
-    }
-    else if (TYPE(CHILD(n, nch - 3)) != except_clause) {
-        ast_error(c, n, "malformed 'try' statement");
-        return NULL;
-    }
-
-    if (n_except > 0) {
-        int i;
-        /* process except statements to create a try ... except */
-        handlers = _Py_asdl_seq_new(n_except, c->c_arena);
-        if (handlers == NULL)
-            return NULL;
-
-        for (i = 0; i < n_except; i++) {
-            excepthandler_ty e = ast_for_except_clause(c, CHILD(n, 3 + i * 3),
-                                                       CHILD(n, 5 + i * 3));
-            if (!e)
-                return NULL;
-            asdl_seq_SET(handlers, i, e);
-        }
-    }
-
-    assert(finally != NULL || asdl_seq_LEN(handlers));
-        if (finally != NULL) {
-        // finally is always last
-        get_last_end_pos(finally, &end_lineno, &end_col_offset);
-    } else if (orelse != NULL) {
-        // otherwise else is last
-        get_last_end_pos(orelse, &end_lineno, &end_col_offset);
-    } else {
-        // inline the get_last_end_pos logic due to layout mismatch
-        last_handler = (excepthandler_ty) asdl_seq_GET(handlers, n_except - 1);
-        end_lineno = last_handler->end_lineno;
-        end_col_offset = last_handler->end_col_offset;
-    }
-    return Try(body, handlers, orelse, finally, LINENO(n), n->n_col_offset,
-               end_lineno, end_col_offset, c->c_arena);
-}
-
-/* with_item: test ['as' expr] */
-static withitem_ty
-ast_for_with_item(struct compiling *c, const node *n)
-{
-    expr_ty context_expr, optional_vars = NULL;
-
-    REQ(n, with_item);
-    context_expr = ast_for_expr(c, CHILD(n, 0));
-    if (!context_expr)
-        return NULL;
-    if (NCH(n) == 3) {
-        optional_vars = ast_for_expr(c, CHILD(n, 2));
-
-        if (!optional_vars) {
-            return NULL;
-        }
-        if (!set_context(c, optional_vars, Store, n)) {
-            return NULL;
-        }
-    }
-
-    return withitem(context_expr, optional_vars, c->c_arena);
-}
-
-/* with_stmt: 'with' with_item (',' with_item)*  ':' [TYPE_COMMENT] suite */
-static stmt_ty
-ast_for_with_stmt(struct compiling *c, const node *n0, bool is_async)
-{
-    const node * const n = is_async ? CHILD(n0, 1) : n0;
-    int i, n_items, nch_minus_type, has_type_comment, end_lineno, end_col_offset;
-    asdl_seq *items, *body;
-    string type_comment;
-
-    if (is_async && c->c_feature_version < 5) {
-        ast_error(c, n,
-                  "Async with statements are only supported in Python 3.5 and greater");
-        return NULL;
-    }
-
-    REQ(n, with_stmt);
-
-    has_type_comment = TYPE(CHILD(n, NCH(n) - 2)) == TYPE_COMMENT;
-    nch_minus_type = NCH(n) - has_type_comment;
-
-    n_items = (nch_minus_type - 2) / 2;
-    items = _Py_asdl_seq_new(n_items, c->c_arena);
-    if (!items)
-        return NULL;
-    for (i = 1; i < nch_minus_type - 2; i += 2) {
-        withitem_ty item = ast_for_with_item(c, CHILD(n, i));
-        if (!item)
-            return NULL;
-        asdl_seq_SET(items, (i - 1) / 2, item);
-    }
-
-    body = ast_for_suite(c, CHILD(n, NCH(n) - 1));
-    if (!body)
-        return NULL;
-    get_last_end_pos(body, &end_lineno, &end_col_offset);
-
-    if (has_type_comment) {
-        type_comment = NEW_TYPE_COMMENT(CHILD(n, NCH(n) - 2));
-        if (!type_comment)
-            return NULL;
-    }
-    else
-        type_comment = NULL;
-
-    if (is_async)
-        return AsyncWith(items, body, type_comment, LINENO(n0), n0->n_col_offset,
-                         end_lineno, end_col_offset, c->c_arena);
-    else
-        return With(items, body, type_comment, LINENO(n), n->n_col_offset,
-                    end_lineno, end_col_offset, c->c_arena);
-}
-
-static stmt_ty
-ast_for_classdef(struct compiling *c, const node *n, asdl_seq *decorator_seq)
-{
-    /* classdef: 'class' NAME ['(' arglist ')'] ':' suite */
-    PyObject *classname;
-    asdl_seq *s;
-    expr_ty call;
-    int end_lineno, end_col_offset;
-
-    REQ(n, classdef);
-
-    if (NCH(n) == 4) { /* class NAME ':' suite */
-        s = ast_for_suite(c, CHILD(n, 3));
-        if (!s)
-            return NULL;
-        get_last_end_pos(s, &end_lineno, &end_col_offset);
-
-        classname = NEW_IDENTIFIER(CHILD(n, 1));
-        if (!classname)
-            return NULL;
-        if (forbidden_name(c, classname, CHILD(n, 3), 0))
-            return NULL;
-        return ClassDef(classname, NULL, NULL, s, decorator_seq,
-                        LINENO(n), n->n_col_offset,
-                        end_lineno, end_col_offset, c->c_arena);
-    }
-
-    if (TYPE(CHILD(n, 3)) == RPAR) { /* class NAME '(' ')' ':' suite */
-        s = ast_for_suite(c, CHILD(n, 5));
-        if (!s)
-            return NULL;
-        get_last_end_pos(s, &end_lineno, &end_col_offset);
-
-        classname = NEW_IDENTIFIER(CHILD(n, 1));
-        if (!classname)
-            return NULL;
-        if (forbidden_name(c, classname, CHILD(n, 3), 0))
-            return NULL;
-        return ClassDef(classname, NULL, NULL, s, decorator_seq,
-                        LINENO(n), n->n_col_offset,
-                        end_lineno, end_col_offset, c->c_arena);
-    }
-
-    /* class NAME '(' arglist ')' ':' suite */
-    /* build up a fake Call node so we can extract its pieces */
-    {
-        PyObject *dummy_name;
-        expr_ty dummy;
-        dummy_name = NEW_IDENTIFIER(CHILD(n, 1));
-        if (!dummy_name)
-            return NULL;
-        dummy = Name(dummy_name, Load, LINENO(n), n->n_col_offset,
-                     CHILD(n, 1)->n_end_lineno, CHILD(n, 1)->n_end_col_offset,
-                     c->c_arena);
-        call = ast_for_call(c, CHILD(n, 3), dummy,
-                            CHILD(n, 1), NULL, CHILD(n, 4));
-        if (!call)
-            return NULL;
-    }
-    s = ast_for_suite(c, CHILD(n, 6));
-    if (!s)
-        return NULL;
-    get_last_end_pos(s, &end_lineno, &end_col_offset);
-
-    classname = NEW_IDENTIFIER(CHILD(n, 1));
-    if (!classname)
-        return NULL;
-    if (forbidden_name(c, classname, CHILD(n, 1), 0))
-        return NULL;
-
-    return ClassDef(classname, call->v.Call.args, call->v.Call.keywords, s,
-                    decorator_seq, LINENO(n), n->n_col_offset,
-                    end_lineno, end_col_offset, c->c_arena);
-}
-
-static stmt_ty
-ast_for_stmt(struct compiling *c, const node *n)
-{
-    if (TYPE(n) == stmt) {
-        assert(NCH(n) == 1);
-        n = CHILD(n, 0);
-    }
-    if (TYPE(n) == simple_stmt) {
-        assert(num_stmts(n) == 1);
-        n = CHILD(n, 0);
-    }
-    if (TYPE(n) == small_stmt) {
-        n = CHILD(n, 0);
-        /* small_stmt: expr_stmt | del_stmt | pass_stmt | flow_stmt
-                  | import_stmt | global_stmt | nonlocal_stmt | assert_stmt
-        */
-        switch (TYPE(n)) {
-            case expr_stmt:
-                return ast_for_expr_stmt(c, n);
-            case del_stmt:
-                return ast_for_del_stmt(c, n);
-            case pass_stmt:
-                return Pass(LINENO(n), n->n_col_offset,
-                            n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-            case flow_stmt:
-                return ast_for_flow_stmt(c, n);
-            case import_stmt:
-                return ast_for_import_stmt(c, n);
-            case global_stmt:
-                return ast_for_global_stmt(c, n);
-            case nonlocal_stmt:
-                return ast_for_nonlocal_stmt(c, n);
-            case assert_stmt:
-                return ast_for_assert_stmt(c, n);
-            default:
-                PyErr_Format(PyExc_SystemError,
-                             "unhandled small_stmt: TYPE=%d NCH=%d\n",
-                             TYPE(n), NCH(n));
-                return NULL;
-        }
-    }
-    else {
-        /* compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt
-                        | funcdef | classdef | decorated | async_stmt
-        */
-        node *ch = CHILD(n, 0);
-        REQ(n, compound_stmt);
-        switch (TYPE(ch)) {
-            case if_stmt:
-                return ast_for_if_stmt(c, ch);
-            case while_stmt:
-                return ast_for_while_stmt(c, ch);
-            case for_stmt:
-                return ast_for_for_stmt(c, ch, 0);
-            case try_stmt:
-                return ast_for_try_stmt(c, ch);
-            case with_stmt:
-                return ast_for_with_stmt(c, ch, 0);
-            case funcdef:
-                return ast_for_funcdef(c, ch, NULL);
-            case classdef:
-                return ast_for_classdef(c, ch, NULL);
-            case decorated:
-                return ast_for_decorated(c, ch);
-            case async_stmt:
-                return ast_for_async_stmt(c, ch);
-            default:
-                PyErr_Format(PyExc_SystemError,
-                             "unhandled compound_stmt: TYPE=%d NCH=%d\n",
-                             TYPE(n), NCH(n));
-                return NULL;
-        }
-    }
-}
-
-static PyObject *
-parsenumber_raw(struct compiling *c, const char *s)
-{
-    const char *end;
-    long x;
-    double dx;
-    Py_complex compl;
-    int imflag;
-
-    assert(s != NULL);
-    errno = 0;
-    end = s + strlen(s) - 1;
-    imflag = *end == 'j' || *end == 'J';
-    if (s[0] == '0') {
-        x = (long) PyOS_strtoul(s, (char **)&end, 0);
-        if (x < 0 && errno == 0) {
-            return PyLong_FromString(s, (char **)0, 0);
-        }
-    }
-    else
-        x = PyOS_strtol(s, (char **)&end, 0);
-    if (*end == '\0') {
-        if (errno != 0)
-            return PyLong_FromString(s, (char **)0, 0);
-        return PyLong_FromLong(x);
-    }
-    /* XXX Huge floats may silently fail */
-    if (imflag) {
-        compl.real = 0.;
-        compl.imag = PyOS_string_to_double(s, (char **)&end, NULL);
-        if (compl.imag == -1.0 && PyErr_Occurred())
-            return NULL;
-        return PyComplex_FromCComplex(compl);
-    }
-    else
-    {
-        dx = PyOS_string_to_double(s, NULL, NULL);
-        if (dx == -1.0 && PyErr_Occurred())
-            return NULL;
-        return PyFloat_FromDouble(dx);
-    }
-}
-
-static PyObject *
-parsenumber(struct compiling *c, const char *s)
-{
-    char *dup, *end;
-    PyObject *res = NULL;
-
-    assert(s != NULL);
-
-    if (strchr(s, '_') == NULL) {
-        return parsenumber_raw(c, s);
-    }
-    /* Create a duplicate without underscores. */
-    dup = PyMem_Malloc(strlen(s) + 1);
-    if (dup == NULL) {
-        return PyErr_NoMemory();
-    }
-    end = dup;
-    for (; *s; s++) {
-        if (*s != '_') {
-            *end++ = *s;
-        }
-    }
-    *end = '\0';
-    res = parsenumber_raw(c, dup);
-    PyMem_Free(dup);
-    return res;
-}
-
-static PyObject *
-decode_utf8(struct compiling *c, const char **sPtr, const char *end)
-{
-    const char *s, *t;
-    t = s = *sPtr;
-    /* while (s < end && *s != '\\') s++; */ /* inefficient for u".." */
-    while (s < end && (*s & 0x80)) s++;
-    *sPtr = s;
-    return PyUnicode_DecodeUTF8(t, s - t, NULL);
-}
-
-static int
-warn_invalid_escape_sequence(struct compiling *c, const node *n,
-                             unsigned char first_invalid_escape_char)
-{
-    PyObject *msg = PyUnicode_FromFormat("invalid escape sequence \\%c",
-                                         first_invalid_escape_char);
-    if (msg == NULL) {
-        return -1;
-    }
-    if (PyErr_WarnExplicitObject(PyExc_DeprecationWarning, msg,
-                                   c->c_filename, LINENO(n),
-                                   NULL, NULL) < 0)
-    {
-        if (PyErr_ExceptionMatches(PyExc_DeprecationWarning)) {
-            /* Replace the DeprecationWarning exception with a SyntaxError
-               to get a more accurate error report */
-            PyErr_Clear();
-            ast_error(c, n, "%U", msg);
-        }
-        Py_DECREF(msg);
-        return -1;
-    }
-    Py_DECREF(msg);
-    return 0;
-}
-
-static PyObject *
-decode_unicode_with_escapes(struct compiling *c, const node *n, const char *s,
-                            size_t len)
-{
-    PyObject *v, *u;
-    char *buf;
-    char *p;
-    const char *end;
-
-    /* check for integer overflow */
-    if (len > SIZE_MAX / 6)
-        return NULL;
-    /* "ä" (2 bytes) may become "\U000000E4" (10 bytes), or 1:5
-       "\ä" (3 bytes) may become "\u005c\U000000E4" (16 bytes), or ~1:6 */
-    u = PyBytes_FromStringAndSize((char *)NULL, len * 6);
-    if (u == NULL)
-        return NULL;
-    p = buf = PyBytes_AsString(u);
-    end = s + len;
-    while (s < end) {
-        if (*s == '\\') {
-            *p++ = *s++;
-            if (s >= end || *s & 0x80) {
-                strcpy(p, "u005c");
-                p += 5;
-                if (s >= end)
-                    break;
-            }
-        }
-        if (*s & 0x80) { /* XXX inefficient */
-            PyObject *w;
-            int kind;
-            const void *data;
-            Py_ssize_t len, i;
-            w = decode_utf8(c, &s, end);
-            if (w == NULL) {
-                Py_DECREF(u);
-                return NULL;
-            }
-            kind = PyUnicode_KIND(w);
-            data = PyUnicode_DATA(w);
-            len = PyUnicode_GET_LENGTH(w);
-            for (i = 0; i < len; i++) {
-                Py_UCS4 chr = PyUnicode_READ(kind, data, i);
-                sprintf(p, "\\U%08x", chr);
-                p += 10;
-            }
-            /* Should be impossible to overflow */
-            assert(p - buf <= PyBytes_GET_SIZE(u));
-            Py_DECREF(w);
-        } else {
-            *p++ = *s++;
-        }
-    }
-    len = p - buf;
-    s = buf;
-
-    const char *first_invalid_escape;
-    v = _PyUnicode_DecodeUnicodeEscape(s, len, NULL, &first_invalid_escape);
-
-    if (v != NULL && first_invalid_escape != NULL) {
-        if (warn_invalid_escape_sequence(c, n, *first_invalid_escape) < 0) {
-            /* We have not decref u before because first_invalid_escape points
-               inside u. */
-            Py_XDECREF(u);
-            Py_DECREF(v);
-            return NULL;
-        }
-    }
-    Py_XDECREF(u);
-    return v;
-}
-
-static PyObject *
-decode_bytes_with_escapes(struct compiling *c, const node *n, const char *s,
-                          size_t len)
-{
-    const char *first_invalid_escape;
-    PyObject *result = _PyBytes_DecodeEscape(s, len, NULL,
-                                             &first_invalid_escape);
-    if (result == NULL)
-        return NULL;
-
-    if (first_invalid_escape != NULL) {
-        if (warn_invalid_escape_sequence(c, n, *first_invalid_escape) < 0) {
-            Py_DECREF(result);
-            return NULL;
-        }
-    }
-    return result;
-}
-
-/* Shift locations for the given node and all its children by adding `lineno`
-   and `col_offset` to existing locations. */
-static void fstring_shift_node_locations(node *n, int lineno, int col_offset)
-{
-    n->n_col_offset = n->n_col_offset + col_offset;
-    n->n_end_col_offset = n->n_end_col_offset + col_offset;
-    for (int i = 0; i < NCH(n); ++i) {
-        if (n->n_lineno && n->n_lineno < CHILD(n, i)->n_lineno) {
-            /* Shifting column offsets unnecessary if there's been newlines. */
-            col_offset = 0;
-        }
-        fstring_shift_node_locations(CHILD(n, i), lineno, col_offset);
-    }
-    n->n_lineno = n->n_lineno + lineno;
-    n->n_end_lineno = n->n_end_lineno + lineno;
-}
-
-/* Fix locations for the given node and its children.
-
-   `parent` is the enclosing node.
-   `n` is the node which locations are going to be fixed relative to parent.
-   `expr_str` is the child node's string representation, including braces.
-*/
-static void
-fstring_fix_node_location(const node *parent, node *n, char *expr_str)
-{
-    char *substr = NULL;
-    char *start;
-    int lines = LINENO(parent) - 1;
-    int cols = parent->n_col_offset;
-    /* Find the full fstring to fix location information in `n`. */
-    while (parent && parent->n_type != STRING)
-        parent = parent->n_child;
-    if (parent && parent->n_str) {
-        substr = strstr(parent->n_str, expr_str);
-        if (substr) {
-            start = substr;
-            while (start > parent->n_str) {
-                if (start[0] == '\n')
-                    break;
-                start--;
-            }
-            cols += (int)(substr - start);
-            /* adjust the start based on the number of newlines encountered
-               before the f-string expression */
-            for (char* p = parent->n_str; p < substr; p++) {
-                if (*p == '\n') {
-                    lines++;
-                }
-            }
-        }
-    }
-    fstring_shift_node_locations(n, lines, cols);
-}
-
-/* Compile this expression in to an expr_ty.  Add parens around the
-   expression, in order to allow leading spaces in the expression. */
-static expr_ty
-fstring_compile_expr(const char *expr_start, const char *expr_end,
-                     struct compiling *c, const node *n)
-
-{
-    node *mod_n;
-    mod_ty mod;
-    char *str;
-    Py_ssize_t len;
-    const char *s;
-
-    assert(expr_end >= expr_start);
-    assert(*(expr_start-1) == '{');
-    assert(*expr_end == '}' || *expr_end == '!' || *expr_end == ':' ||
-           *expr_end == '=');
-
-    /* If the substring is all whitespace, it's an error.  We need to catch this
-       here, and not when we call PyParser_SimpleParseStringFlagsFilename,
-       because turning the expression '' in to '()' would go from being invalid
-       to valid. */
-    for (s = expr_start; s != expr_end; s++) {
-        char c = *s;
-        /* The Python parser ignores only the following whitespace
-           characters (\r already is converted to \n). */
-        if (!(c == ' ' || c == '\t' || c == '\n' || c == '\f')) {
-            break;
-        }
-    }
-    if (s == expr_end) {
-        ast_error(c, n, "f-string: empty expression not allowed");
-        return NULL;
-    }
-
-    len = expr_end - expr_start;
-    /* Allocate 3 extra bytes: open paren, close paren, null byte. */
-    str = PyMem_Malloc(len + 3);
-    if (str == NULL) {
-        PyErr_NoMemory();
-        return NULL;
-    }
-
-    str[0] = '(';
-    memcpy(str+1, expr_start, len);
-    str[len+1] = ')';
-    str[len+2] = 0;
-
-    PyCompilerFlags cf = _PyCompilerFlags_INIT;
-    cf.cf_flags = PyCF_ONLY_AST;
-    mod_n = PyParser_SimpleParseStringFlagsFilename(str, "<fstring>",
-                                                    Py_eval_input, 0);
-    if (!mod_n) {
-        PyMem_Free(str);
-        return NULL;
-    }
-    /* Reuse str to find the correct column offset. */
-    str[0] = '{';
-    str[len+1] = '}';
-    fstring_fix_node_location(n, mod_n, str);
-    mod = PyAST_FromNode(mod_n, &cf, "<fstring>", c->c_arena);
-    PyMem_Free(str);
-    PyNode_Free(mod_n);
-    if (!mod)
-        return NULL;
-    return mod->v.Expression.body;
-}
-
-/* Return -1 on error.
-
-   Return 0 if we reached the end of the literal.
-
-   Return 1 if we haven't reached the end of the literal, but we want
-   the caller to process the literal up to this point. Used for
-   doubled braces.
-*/
-static int
-fstring_find_literal(const char **str, const char *end, int raw,
-                     PyObject **literal, int recurse_lvl,
-                     struct compiling *c, const node *n)
-{
-    /* Get any literal string. It ends when we hit an un-doubled left
-       brace (which isn't part of a unicode name escape such as
-       "\N{EULER CONSTANT}"), or the end of the string. */
-
-    const char *s = *str;
-    const char *literal_start = s;
-    int result = 0;
-
-    assert(*literal == NULL);
-    while (s < end) {
-        char ch = *s++;
-        if (!raw && ch == '\\' && s < end) {
-            ch = *s++;
-            if (ch == 'N') {
-                if (s < end && *s++ == '{') {
-                    while (s < end && *s++ != '}') {
-                    }
-                    continue;
-                }
-                break;
-            }
-            if (ch == '{' && warn_invalid_escape_sequence(c, n, ch) < 0) {
-                return -1;
-            }
-        }
-        if (ch == '{' || ch == '}') {
-            /* Check for doubled braces, but only at the top level. If
-               we checked at every level, then f'{0:{3}}' would fail
-               with the two closing braces. */
-            if (recurse_lvl == 0) {
-                if (s < end && *s == ch) {
-                    /* We're going to tell the caller that the literal ends
-                       here, but that they should continue scanning. But also
-                       skip over the second brace when we resume scanning. */
-                    *str = s + 1;
-                    result = 1;
-                    goto done;
-                }
-
-                /* Where a single '{' is the start of a new expression, a
-                   single '}' is not allowed. */
-                if (ch == '}') {
-                    *str = s - 1;
-                    ast_error(c, n, "f-string: single '}' is not allowed");
-                    return -1;
-                }
-            }
-            /* We're either at a '{', which means we're starting another
-               expression; or a '}', which means we're at the end of this
-               f-string (for a nested format_spec). */
-            s--;
-            break;
-        }
-    }
-    *str = s;
-    assert(s <= end);
-    assert(s == end || *s == '{' || *s == '}');
-done:
-    if (literal_start != s) {
-        if (raw)
-            *literal = PyUnicode_DecodeUTF8Stateful(literal_start,
-                                                    s - literal_start,
-                                                    NULL, NULL);
-        else
-            *literal = decode_unicode_with_escapes(c, n, literal_start,
-                                                   s - literal_start);
-        if (!*literal)
-            return -1;
-    }
-    return result;
-}
-
-/* Forward declaration because parsing is recursive. */
-static expr_ty
-fstring_parse(const char **str, const char *end, int raw, int recurse_lvl,
-              struct compiling *c, const node *n);
-
-/* Parse the f-string at *str, ending at end.  We know *str starts an
-   expression (so it must be a '{'). Returns the FormattedValue node, which
-   includes the expression, conversion character, format_spec expression, and
-   optionally the text of the expression (if = is used).
-
-   Note that I don't do a perfect job here: I don't make sure that a
-   closing brace doesn't match an opening paren, for example. It
-   doesn't need to error on all invalid expressions, just correctly
-   find the end of all valid ones. Any errors inside the expression
-   will be caught when we parse it later.
-
-   *expression is set to the expression.  For an '=' "debug" expression,
-   *expr_text is set to the debug text (the original text of the expression,
-   including the '=' and any whitespace around it, as a string object).  If
-   not a debug expression, *expr_text set to NULL. */
-static int
-fstring_find_expr(const char **str, const char *end, int raw, int recurse_lvl,
-                  PyObject **expr_text, expr_ty *expression,
-                  struct compiling *c, const node *n)
-{
-    /* Return -1 on error, else 0. */
-
-    const char *expr_start;
-    const char *expr_end;
-    expr_ty simple_expression;
-    expr_ty format_spec = NULL; /* Optional format specifier. */
-    int conversion = -1; /* The conversion char.  Use default if not
-                            specified, or !r if using = and no format
-                            spec. */
-
-    /* 0 if we're not in a string, else the quote char we're trying to
-       match (single or double quote). */
-    char quote_char = 0;
-
-    /* If we're inside a string, 1=normal, 3=triple-quoted. */
-    int string_type = 0;
-
-    /* Keep track of nesting level for braces/parens/brackets in
-       expressions. */
-    Py_ssize_t nested_depth = 0;
-    char parenstack[MAXLEVEL];
-
-    *expr_text = NULL;
-
-    /* Can only nest one level deep. */
-    if (recurse_lvl >= 2) {
-        ast_error(c, n, "f-string: expressions nested too deeply");
-        goto error;
-    }
-
-    /* The first char must be a left brace, or we wouldn't have gotten
-       here. Skip over it. */
-    assert(**str == '{');
-    *str += 1;
-
-    expr_start = *str;
-    for (; *str < end; (*str)++) {
-        char ch;
-
-        /* Loop invariants. */
-        assert(nested_depth >= 0);
-        assert(*str >= expr_start && *str < end);
-        if (quote_char)
-            assert(string_type == 1 || string_type == 3);
-        else
-            assert(string_type == 0);
-
-        ch = **str;
-        /* Nowhere inside an expression is a backslash allowed. */
-        if (ch == '\\') {
-            /* Error: can't include a backslash character, inside
-               parens or strings or not. */
-            ast_error(c, n,
-                      "f-string expression part "
-                      "cannot include a backslash");
-            goto error;
-        }
-        if (quote_char) {
-            /* We're inside a string. See if we're at the end. */
-            /* This code needs to implement the same non-error logic
-               as tok_get from tokenizer.c, at the letter_quote
-               label. To actually share that code would be a
-               nightmare. But, it's unlikely to change and is small,
-               so duplicate it here. Note we don't need to catch all
-               of the errors, since they'll be caught when parsing the
-               expression. We just need to match the non-error
-               cases. Thus we can ignore \n in single-quoted strings,
-               for example. Or non-terminated strings. */
-            if (ch == quote_char) {
-                /* Does this match the string_type (single or triple
-                   quoted)? */
-                if (string_type == 3) {
-                    if (*str+2 < end && *(*str+1) == ch && *(*str+2) == ch) {
-                        /* We're at the end of a triple quoted string. */
-                        *str += 2;
-                        string_type = 0;
-                        quote_char = 0;
-                        continue;
-                    }
-                } else {
-                    /* We're at the end of a normal string. */
-                    quote_char = 0;
-                    string_type = 0;
-                    continue;
-                }
-            }
-        } else if (ch == '\'' || ch == '"') {
-            /* Is this a triple quoted string? */
-            if (*str+2 < end && *(*str+1) == ch && *(*str+2) == ch) {
-                string_type = 3;
-                *str += 2;
-            } else {
-                /* Start of a normal string. */
-                string_type = 1;
-            }
-            /* Start looking for the end of the string. */
-            quote_char = ch;
-        } else if (ch == '[' || ch == '{' || ch == '(') {
-            if (nested_depth >= MAXLEVEL) {
-                ast_error(c, n, "f-string: too many nested parenthesis");
-                goto error;
-            }
-            parenstack[nested_depth] = ch;
-            nested_depth++;
-        } else if (ch == '#') {
-            /* Error: can't include a comment character, inside parens
-               or not. */
-            ast_error(c, n, "f-string expression part cannot include '#'");
-            goto error;
-        } else if (nested_depth == 0 &&
-                   (ch == '!' || ch == ':' || ch == '}' ||
-                    ch == '=' || ch == '>' || ch == '<')) {
-            /* See if there's a next character. */
-            if (*str+1 < end) {
-                char next = *(*str+1);
-
-                /* For "!=". since '=' is not an allowed conversion character,
-                   nothing is lost in this test. */
-                if ((ch == '!' && next == '=') ||   /* != */
-                    (ch == '=' && next == '=') ||   /* == */
-                    (ch == '<' && next == '=') ||   /* <= */
-                    (ch == '>' && next == '=')      /* >= */
-                    ) {
-                    *str += 1;
-                    continue;
-                }
-                /* Don't get out of the loop for these, if they're single
-                   chars (not part of 2-char tokens). If by themselves, they
-                   don't end an expression (unlike say '!'). */
-                if (ch == '>' || ch == '<') {
-                    continue;
-                }
-            }
-
-            /* Normal way out of this loop. */
-            break;
-        } else if (ch == ']' || ch == '}' || ch == ')') {
-            if (!nested_depth) {
-                ast_error(c, n, "f-string: unmatched '%c'", ch);
-                goto error;
-            }
-            nested_depth--;
-            int opening = parenstack[nested_depth];
-            if (!((opening == '(' && ch == ')') ||
-                  (opening == '[' && ch == ']') ||
-                  (opening == '{' && ch == '}')))
-            {
-                ast_error(c, n,
-                          "f-string: closing parenthesis '%c' "
-                          "does not match opening parenthesis '%c'",
-                          ch, opening);
-                goto error;
-            }
-        } else {
-            /* Just consume this char and loop around. */
-        }
-    }
-    expr_end = *str;
-    /* If we leave this loop in a string or with mismatched parens, we
-       don't care. We'll get a syntax error when compiling the
-       expression. But, we can produce a better error message, so
-       let's just do that.*/
-    if (quote_char) {
-        ast_error(c, n, "f-string: unterminated string");
-        goto error;
-    }
-    if (nested_depth) {
-        int opening = parenstack[nested_depth - 1];
-        ast_error(c, n, "f-string: unmatched '%c'", opening);
-        goto error;
-    }
-
-    if (*str >= end)
-        goto unexpected_end_of_string;
-
-    /* Compile the expression as soon as possible, so we show errors
-       related to the expression before errors related to the
-       conversion or format_spec. */
-    simple_expression = fstring_compile_expr(expr_start, expr_end, c, n);
-    if (!simple_expression)
-        goto error;
-
-    /* Check for =, which puts the text value of the expression in
-       expr_text. */
-    if (**str == '=') {
-        if (c->c_feature_version < 8) {
-            ast_error(c, n,
-                      "f-string: self documenting expressions are "
-                      "only supported in Python 3.8 and greater");
-            goto error;
-        }
-        *str += 1;
-
-        /* Skip over ASCII whitespace.  No need to test for end of string
-           here, since we know there's at least a trailing quote somewhere
-           ahead. */
-        while (Py_ISSPACE(**str)) {
-            *str += 1;
-        }
-
-        /* Set *expr_text to the text of the expression. */
-        *expr_text = PyUnicode_FromStringAndSize(expr_start, *str-expr_start);
-        if (!*expr_text) {
-            goto error;
-        }
-    }
-
-    /* Check for a conversion char, if present. */
-    if (**str == '!') {
-        *str += 1;
-        if (*str >= end)
-            goto unexpected_end_of_string;
-
-        conversion = **str;
-        *str += 1;
-
-        /* Validate the conversion. */
-        if (!(conversion == 's' || conversion == 'r' || conversion == 'a')) {
-            ast_error(c, n,
-                      "f-string: invalid conversion character: "
-                      "expected 's', 'r', or 'a'");
-            goto error;
-        }
-
-    }
-
-    /* Check for the format spec, if present. */
-    if (*str >= end)
-        goto unexpected_end_of_string;
-    if (**str == ':') {
-        *str += 1;
-        if (*str >= end)
-            goto unexpected_end_of_string;
-
-        /* Parse the format spec. */
-        format_spec = fstring_parse(str, end, raw, recurse_lvl+1, c, n);
-        if (!format_spec)
-            goto error;
-    }
-
-    if (*str >= end || **str != '}')
-        goto unexpected_end_of_string;
-
-    /* We're at a right brace. Consume it. */
-    assert(*str < end);
-    assert(**str == '}');
-    *str += 1;
-
-    /* If we're in = mode (detected by non-NULL expr_text), and have no format
-       spec and no explicit conversion, set the conversion to 'r'. */
-    if (*expr_text && format_spec == NULL && conversion == -1) {
-        conversion = 'r';
-    }
-
-    /* And now create the FormattedValue node that represents this
-       entire expression with the conversion and format spec. */
-    *expression = FormattedValue(simple_expression, conversion,
-                                 format_spec, LINENO(n),
-                                 n->n_col_offset, n->n_end_lineno,
-                                 n->n_end_col_offset, c->c_arena);
-    if (!*expression)
-        goto error;
-
-    return 0;
-
-unexpected_end_of_string:
-    ast_error(c, n, "f-string: expecting '}'");
-    /* Falls through to error. */
-
-error:
-    Py_XDECREF(*expr_text);
-    return -1;
-
-}
-
-/* Return -1 on error.
-
-   Return 0 if we have a literal (possible zero length) and an
-   expression (zero length if at the end of the string.
-
-   Return 1 if we have a literal, but no expression, and we want the
-   caller to call us again. This is used to deal with doubled
-   braces.
-
-   When called multiple times on the string 'a{{b{0}c', this function
-   will return:
-
-   1. the literal 'a{' with no expression, and a return value
-      of 1. Despite the fact that there's no expression, the return
-      value of 1 means we're not finished yet.
-
-   2. the literal 'b' and the expression '0', with a return value of
-      0. The fact that there's an expression means we're not finished.
-
-   3. literal 'c' with no expression and a return value of 0. The
-      combination of the return value of 0 with no expression means
-      we're finished.
-*/
-static int
-fstring_find_literal_and_expr(const char **str, const char *end, int raw,
-                              int recurse_lvl, PyObject **literal,
-                              PyObject **expr_text, expr_ty *expression,
-                              struct compiling *c, const node *n)
-{
-    int result;
-
-    assert(*literal == NULL && *expression == NULL);
-
-    /* Get any literal string. */
-    result = fstring_find_literal(str, end, raw, literal, recurse_lvl, c, n);
-    if (result < 0)
-        goto error;
-
-    assert(result == 0 || result == 1);
-
-    if (result == 1)
-        /* We have a literal, but don't look at the expression. */
-        return 1;
-
-    if (*str >= end || **str == '}')
-        /* We're at the end of the string or the end of a nested
-           f-string: no expression. The top-level error case where we
-           expect to be at the end of the string but we're at a '}' is
-           handled later. */
-        return 0;
-
-    /* We must now be the start of an expression, on a '{'. */
-    assert(**str == '{');
-
-    if (fstring_find_expr(str, end, raw, recurse_lvl, expr_text,
-                          expression, c, n) < 0)
-        goto error;
-
-    return 0;
-
-error:
-    Py_CLEAR(*literal);
-    return -1;
-}
-
-#define EXPRLIST_N_CACHED  64
-
-typedef struct {
-    /* Incrementally build an array of expr_ty, so be used in an
-       asdl_seq. Cache some small but reasonably sized number of
-       expr_ty's, and then after that start dynamically allocating,
-       doubling the number allocated each time. Note that the f-string
-       f'{0}a{1}' contains 3 expr_ty's: 2 FormattedValue's, and one
-       Constant for the literal 'a'. So you add expr_ty's about twice as
-       fast as you add expressions in an f-string. */
-
-    Py_ssize_t allocated;  /* Number we've allocated. */
-    Py_ssize_t size;       /* Number we've used. */
-    expr_ty    *p;         /* Pointer to the memory we're actually
-                              using. Will point to 'data' until we
-                              start dynamically allocating. */
-    expr_ty    data[EXPRLIST_N_CACHED];
-} ExprList;
-
-#ifdef NDEBUG
-#define ExprList_check_invariants(l)
-#else
-static void
-ExprList_check_invariants(ExprList *l)
-{
-    /* Check our invariants. Make sure this object is "live", and
-       hasn't been deallocated. */
-    assert(l->size >= 0);
-    assert(l->p != NULL);
-    if (l->size <= EXPRLIST_N_CACHED)
-        assert(l->data == l->p);
-}
-#endif
-
-static void
-ExprList_Init(ExprList *l)
-{
-    l->allocated = EXPRLIST_N_CACHED;
-    l->size = 0;
-
-    /* Until we start allocating dynamically, p points to data. */
-    l->p = l->data;
-
-    ExprList_check_invariants(l);
-}
-
-static int
-ExprList_Append(ExprList *l, expr_ty exp)
-{
-    ExprList_check_invariants(l);
-    if (l->size >= l->allocated) {
-        /* We need to alloc (or realloc) the memory. */
-        Py_ssize_t new_size = l->allocated * 2;
-
-        /* See if we've ever allocated anything dynamically. */
-        if (l->p == l->data) {
-            Py_ssize_t i;
-            /* We're still using the cached data. Switch to
-               alloc-ing. */
-            l->p = PyMem_Malloc(sizeof(expr_ty) * new_size);
-            if (!l->p)
-                return -1;
-            /* Copy the cached data into the new buffer. */
-            for (i = 0; i < l->size; i++)
-                l->p[i] = l->data[i];
-        } else {
-            /* Just realloc. */
-            expr_ty *tmp = PyMem_Realloc(l->p, sizeof(expr_ty) * new_size);
-            if (!tmp) {
-                PyMem_Free(l->p);
-                l->p = NULL;
-                return -1;
-            }
-            l->p = tmp;
-        }
-
-        l->allocated = new_size;
-        assert(l->allocated == 2 * l->size);
-    }
-
-    l->p[l->size++] = exp;
-
-    ExprList_check_invariants(l);
-    return 0;
-}
-
-static void
-ExprList_Dealloc(ExprList *l)
-{
-    ExprList_check_invariants(l);
-
-    /* If there's been an error, or we've never dynamically allocated,
-       do nothing. */
-    if (!l->p || l->p == l->data) {
-        /* Do nothing. */
-    } else {
-        /* We have dynamically allocated. Free the memory. */
-        PyMem_Free(l->p);
-    }
-    l->p = NULL;
-    l->size = -1;
-}
-
-static asdl_seq *
-ExprList_Finish(ExprList *l, PyArena *arena)
-{
-    asdl_seq *seq;
-
-    ExprList_check_invariants(l);
-
-    /* Allocate the asdl_seq and copy the expressions in to it. */
-    seq = _Py_asdl_seq_new(l->size, arena);
-    if (seq) {
-        Py_ssize_t i;
-        for (i = 0; i < l->size; i++)
-            asdl_seq_SET(seq, i, l->p[i]);
-    }
-    ExprList_Dealloc(l);
-    return seq;
-}
-
-/* The FstringParser is designed to add a mix of strings and
-   f-strings, and concat them together as needed. Ultimately, it
-   generates an expr_ty. */
-typedef struct {
-    PyObject *last_str;
-    ExprList expr_list;
-    int fmode;
-} FstringParser;
-
-#ifdef NDEBUG
-#define FstringParser_check_invariants(state)
-#else
-static void
-FstringParser_check_invariants(FstringParser *state)
-{
-    if (state->last_str)
-        assert(PyUnicode_CheckExact(state->last_str));
-    ExprList_check_invariants(&state->expr_list);
-}
-#endif
-
-static void
-FstringParser_Init(FstringParser *state)
-{
-    state->last_str = NULL;
-    state->fmode = 0;
-    ExprList_Init(&state->expr_list);
-    FstringParser_check_invariants(state);
-}
-
-static void
-FstringParser_Dealloc(FstringParser *state)
-{
-    FstringParser_check_invariants(state);
-
-    Py_XDECREF(state->last_str);
-    ExprList_Dealloc(&state->expr_list);
-}
-
-/* Constants for the following */
-static PyObject *u_kind;
-
-/* Compute 'kind' field for string Constant (either 'u' or None) */
-static PyObject *
-make_kind(struct compiling *c, const node *n)
-{
-    char *s = NULL;
-    PyObject *kind = NULL;
-
-    /* Find the first string literal, if any */
-    while (TYPE(n) != STRING) {
-        if (NCH(n) == 0)
-            return NULL;
-        n = CHILD(n, 0);
-    }
-    REQ(n, STRING);
-
-    /* If it starts with 'u', return a PyUnicode "u" string */
-    s = STR(n);
-    if (s && *s == 'u') {
-        if (!u_kind) {
-            u_kind = PyUnicode_InternFromString("u");
-            if (!u_kind)
-                return NULL;
-        }
-        kind = u_kind;
-        if (PyArena_AddPyObject(c->c_arena, kind) < 0) {
-            return NULL;
-        }
-        Py_INCREF(kind);
-    }
-    return kind;
-}
-
-/* Make a Constant node, but decref the PyUnicode object being added. */
-static expr_ty
-make_str_node_and_del(PyObject **str, struct compiling *c, const node* n)
-{
-    PyObject *s = *str;
-    PyObject *kind = NULL;
-    *str = NULL;
-    assert(PyUnicode_CheckExact(s));
-    if (PyArena_AddPyObject(c->c_arena, s) < 0) {
-        Py_DECREF(s);
-        return NULL;
-    }
-    kind = make_kind(c, n);
-    if (kind == NULL && PyErr_Occurred())
-        return NULL;
-    return Constant(s, kind, LINENO(n), n->n_col_offset,
-                    n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-}
-
-/* Add a non-f-string (that is, a regular literal string). str is
-   decref'd. */
-static int
-FstringParser_ConcatAndDel(FstringParser *state, PyObject *str)
-{
-    FstringParser_check_invariants(state);
-
-    assert(PyUnicode_CheckExact(str));
-
-    if (PyUnicode_GET_LENGTH(str) == 0) {
-        Py_DECREF(str);
-        return 0;
-    }
-
-    if (!state->last_str) {
-        /* We didn't have a string before, so just remember this one. */
-        state->last_str = str;
-    } else {
-        /* Concatenate this with the previous string. */
-        PyUnicode_AppendAndDel(&state->last_str, str);
-        if (!state->last_str)
-            return -1;
-    }
-    FstringParser_check_invariants(state);
-    return 0;
-}
-
-/* Parse an f-string. The f-string is in *str to end, with no
-   'f' or quotes. */
-static int
-FstringParser_ConcatFstring(FstringParser *state, const char **str,
-                            const char *end, int raw, int recurse_lvl,
-                            struct compiling *c, const node *n)
-{
-    FstringParser_check_invariants(state);
-    state->fmode = 1;
-
-    /* Parse the f-string. */
-    while (1) {
-        PyObject *literal = NULL;
-        PyObject *expr_text = NULL;
-        expr_ty expression = NULL;
-
-        /* If there's a zero length literal in front of the
-           expression, literal will be NULL. If we're at the end of
-           the f-string, expression will be NULL (unless result == 1,
-           see below). */
-        int result = fstring_find_literal_and_expr(str, end, raw, recurse_lvl,
-                                                   &literal, &expr_text,
-                                                   &expression, c, n);
-        if (result < 0)
-            return -1;
-
-        /* Add the literal, if any. */
-        if (literal && FstringParser_ConcatAndDel(state, literal) < 0) {
-            Py_XDECREF(expr_text);
-            return -1;
-        }
-        /* Add the expr_text, if any. */
-        if (expr_text && FstringParser_ConcatAndDel(state, expr_text) < 0) {
-            return -1;
-        }
-
-        /* We've dealt with the literal and expr_text, their ownership has
-           been transferred to the state object.  Don't look at them again. */
-
-        /* See if we should just loop around to get the next literal
-           and expression, while ignoring the expression this
-           time. This is used for un-doubling braces, as an
-           optimization. */
-        if (result == 1)
-            continue;
-
-        if (!expression)
-            /* We're done with this f-string. */
-            break;
-
-        /* We know we have an expression. Convert any existing string
-           to a Constant node. */
-        if (!state->last_str) {
-            /* Do nothing. No previous literal. */
-        } else {
-            /* Convert the existing last_str literal to a Constant node. */
-            expr_ty str = make_str_node_and_del(&state->last_str, c, n);
-            if (!str || ExprList_Append(&state->expr_list, str) < 0)
-                return -1;
-        }
-
-        if (ExprList_Append(&state->expr_list, expression) < 0)
-            return -1;
-    }
-
-    /* If recurse_lvl is zero, then we must be at the end of the
-       string. Otherwise, we must be at a right brace. */
-
-    if (recurse_lvl == 0 && *str < end-1) {
-        ast_error(c, n, "f-string: unexpected end of string");
-        return -1;
-    }
-    if (recurse_lvl != 0 && **str != '}') {
-        ast_error(c, n, "f-string: expecting '}'");
-        return -1;
-    }
-
-    FstringParser_check_invariants(state);
-    return 0;
-}
-
-/* Convert the partial state reflected in last_str and expr_list to an
-   expr_ty. The expr_ty can be a Constant, or a JoinedStr. */
-static expr_ty
-FstringParser_Finish(FstringParser *state, struct compiling *c,
-                     const node *n)
-{
-    asdl_seq *seq;
-
-    FstringParser_check_invariants(state);
-
-    /* If we're just a constant string with no expressions, return
-       that. */
-    if (!state->fmode) {
-        assert(!state->expr_list.size);
-        if (!state->last_str) {
-            /* Create a zero length string. */
-            state->last_str = PyUnicode_FromStringAndSize(NULL, 0);
-            if (!state->last_str)
-                goto error;
-        }
-        return make_str_node_and_del(&state->last_str, c, n);
-    }
-
-    /* Create a Constant node out of last_str, if needed. It will be the
-       last node in our expression list. */
-    if (state->last_str) {
-        expr_ty str = make_str_node_and_del(&state->last_str, c, n);
-        if (!str || ExprList_Append(&state->expr_list, str) < 0)
-            goto error;
-    }
-    /* This has already been freed. */
-    assert(state->last_str == NULL);
-
-    seq = ExprList_Finish(&state->expr_list, c->c_arena);
-    if (!seq)
-        goto error;
-
-    return JoinedStr(seq, LINENO(n), n->n_col_offset,
-                     n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-
-error:
-    FstringParser_Dealloc(state);
-    return NULL;
-}
-
-/* Given an f-string (with no 'f' or quotes) that's in *str and ends
-   at end, parse it into an expr_ty.  Return NULL on error.  Adjust
-   str to point past the parsed portion. */
-static expr_ty
-fstring_parse(const char **str, const char *end, int raw, int recurse_lvl,
-              struct compiling *c, const node *n)
-{
-    FstringParser state;
-
-    FstringParser_Init(&state);
-    if (FstringParser_ConcatFstring(&state, str, end, raw, recurse_lvl,
-                                    c, n) < 0) {
-        FstringParser_Dealloc(&state);
-        return NULL;
-    }
-
-    return FstringParser_Finish(&state, c, n);
-}
-
-/* n is a Python string literal, including the bracketing quote
-   characters, and r, b, u, &/or f prefixes (if any), and embedded
-   escape sequences (if any). parsestr parses it, and sets *result to
-   decoded Python string object.  If the string is an f-string, set
-   *fstr and *fstrlen to the unparsed string object.  Return 0 if no
-   errors occurred.
-*/
-static int
-parsestr(struct compiling *c, const node *n, int *bytesmode, int *rawmode,
-         PyObject **result, const char **fstr, Py_ssize_t *fstrlen)
-{
-    size_t len;
-    const char *s = STR(n);
-    int quote = Py_CHARMASK(*s);
-    int fmode = 0;
-    *bytesmode = 0;
-    *rawmode = 0;
-    *result = NULL;
-    *fstr = NULL;
-    if (Py_ISALPHA(quote)) {
-        while (!*bytesmode || !*rawmode) {
-            if (quote == 'b' || quote == 'B') {
-                quote = *++s;
-                *bytesmode = 1;
-            }
-            else if (quote == 'u' || quote == 'U') {
-                quote = *++s;
-            }
-            else if (quote == 'r' || quote == 'R') {
-                quote = *++s;
-                *rawmode = 1;
-            }
-            else if (quote == 'f' || quote == 'F') {
-                quote = *++s;
-                fmode = 1;
-            }
-            else {
-                break;
-            }
-        }
-    }
-
-    /* fstrings are only allowed in Python 3.6 and greater */
-    if (fmode && c->c_feature_version < 6) {
-        ast_error(c, n, "Format strings are only supported in Python 3.6 and greater");
-        return -1;
-    }
-
-    if (fmode && *bytesmode) {
-        PyErr_BadInternalCall();
-        return -1;
-    }
-    if (quote != '\'' && quote != '\"') {
-        PyErr_BadInternalCall();
-        return -1;
-    }
-    /* Skip the leading quote char. */
-    s++;
-    len = strlen(s);
-    if (len > INT_MAX) {
-        PyErr_SetString(PyExc_OverflowError,
-                        "string to parse is too long");
-        return -1;
-    }
-    if (s[--len] != quote) {
-        /* Last quote char must match the first. */
-        PyErr_BadInternalCall();
-        return -1;
-    }
-    if (len >= 4 && s[0] == quote && s[1] == quote) {
-        /* A triple quoted string. We've already skipped one quote at
-           the start and one at the end of the string. Now skip the
-           two at the start. */
-        s += 2;
-        len -= 2;
-        /* And check that the last two match. */
-        if (s[--len] != quote || s[--len] != quote) {
-            PyErr_BadInternalCall();
-            return -1;
-        }
-    }
-
-    if (fmode) {
-        /* Just return the bytes. The caller will parse the resulting
-           string. */
-        *fstr = s;
-        *fstrlen = len;
-        return 0;
-    }
-
-    /* Not an f-string. */
-    /* Avoid invoking escape decoding routines if possible. */
-    *rawmode = *rawmode || strchr(s, '\\') == NULL;
-    if (*bytesmode) {
-        /* Disallow non-ASCII characters. */
-        const char *ch;
-        for (ch = s; *ch; ch++) {
-            if (Py_CHARMASK(*ch) >= 0x80) {
-                ast_error(c, n,
-                          "bytes can only contain ASCII "
-                          "literal characters.");
-                return -1;
-            }
-        }
-        if (*rawmode)
-            *result = PyBytes_FromStringAndSize(s, len);
-        else
-            *result = decode_bytes_with_escapes(c, n, s, len);
-    } else {
-        if (*rawmode)
-            *result = PyUnicode_DecodeUTF8Stateful(s, len, NULL, NULL);
-        else
-            *result = decode_unicode_with_escapes(c, n, s, len);
-    }
-    return *result == NULL ? -1 : 0;
-}
-
-/* Accepts a STRING+ atom, and produces an expr_ty node. Run through
-   each STRING atom, and process it as needed. For bytes, just
-   concatenate them together, and the result will be a Constant node. For
-   normal strings and f-strings, concatenate them together. The result
-   will be a Constant node if there were no f-strings; a FormattedValue
-   node if there's just an f-string (with no leading or trailing
-   literals), or a JoinedStr node if there are multiple f-strings or
-   any literals involved. */
-static expr_ty
-parsestrplus(struct compiling *c, const node *n)
-{
-    int bytesmode = 0;
-    PyObject *bytes_str = NULL;
-    int i;
-
-    FstringParser state;
-    FstringParser_Init(&state);
-
-    for (i = 0; i < NCH(n); i++) {
-        int this_bytesmode;
-        int this_rawmode;
-        PyObject *s;
-        const char *fstr;
-        Py_ssize_t fstrlen = -1;  /* Silence a compiler warning. */
-
-        REQ(CHILD(n, i), STRING);
-        if (parsestr(c, CHILD(n, i), &this_bytesmode, &this_rawmode, &s,
-                     &fstr, &fstrlen) != 0)
-            goto error;
-
-        /* Check that we're not mixing bytes with unicode. */
-        if (i != 0 && bytesmode != this_bytesmode) {
-            ast_error(c, n, "cannot mix bytes and nonbytes literals");
-            /* s is NULL if the current string part is an f-string. */
-            Py_XDECREF(s);
-            goto error;
-        }
-        bytesmode = this_bytesmode;
-
-        if (fstr != NULL) {
-            int result;
-            assert(s == NULL && !bytesmode);
-            /* This is an f-string. Parse and concatenate it. */
-            result = FstringParser_ConcatFstring(&state, &fstr, fstr+fstrlen,
-                                                 this_rawmode, 0, c, n);
-            if (result < 0)
-                goto error;
-        } else {
-            /* A string or byte string. */
-            assert(s != NULL && fstr == NULL);
-
-            assert(bytesmode ? PyBytes_CheckExact(s) :
-                   PyUnicode_CheckExact(s));
-
-            if (bytesmode) {
-                /* For bytes, concat as we go. */
-                if (i == 0) {
-                    /* First time, just remember this value. */
-                    bytes_str = s;
-                } else {
-                    PyBytes_ConcatAndDel(&bytes_str, s);
-                    if (!bytes_str)
-                        goto error;
-                }
-            } else {
-                /* This is a regular string. Concatenate it. */
-                if (FstringParser_ConcatAndDel(&state, s) < 0)
-                    goto error;
-            }
-        }
-    }
-    if (bytesmode) {
-        /* Just return the bytes object and we're done. */
-        if (PyArena_AddPyObject(c->c_arena, bytes_str) < 0)
-            goto error;
-        return Constant(bytes_str, NULL, LINENO(n), n->n_col_offset,
-                        n->n_end_lineno, n->n_end_col_offset, c->c_arena);
-    }
-
-    /* We're not a bytes string, bytes_str should never have been set. */
-    assert(bytes_str == NULL);
-
-    return FstringParser_Finish(&state, c, n);
-
-error:
-    Py_XDECREF(bytes_str);
-    FstringParser_Dealloc(&state);
-    return NULL;
-}
-
 PyObject *
-_PyAST_GetDocString(asdl_seq *body)
+_PyAST_GetDocString(asdl_stmt_seq *body)
 {
     if (!asdl_seq_LEN(body)) {
         return NULL;
     }
-    stmt_ty st = (stmt_ty)asdl_seq_GET(body, 0);
+    stmt_ty st = asdl_seq_GET(body, 0);
     if (st->kind != Expr_kind) {
         return NULL;
     }
diff --git a/Python/ast_opt.c b/Python/ast_opt.c
index ff786d6..c1fdea3 100644
--- a/Python/ast_opt.c
+++ b/Python/ast_opt.c
@@ -1,12 +1,15 @@
 /* AST Optimizer */
 #include "Python.h"
-#include "Python-ast.h"
-#include "ast.h"
+#include "pycore_ast.h"           // _PyAST_GetDocString()
+#include "pycore_compile.h"       // _PyASTOptimizeState
+#include "pycore_pystate.h"       // _PyThreadState_GET()
 
 
 static int
 make_const(expr_ty node, PyObject *val, PyArena *arena)
 {
+    // Even if no new value was calculated, make_const may still
+    // need to clear an error (e.g. for division by zero)
     if (val == NULL) {
         if (PyErr_ExceptionMatches(PyExc_KeyboardInterrupt)) {
             return 0;
@@ -14,7 +17,7 @@
         PyErr_Clear();
         return 1;
     }
-    if (PyArena_AddPyObject(arena, val) < 0) {
+    if (_PyArena_AddPyObject(arena, val) < 0) {
         Py_DECREF(val);
         return 0;
     }
@@ -49,7 +52,7 @@
                of !=. Detecting such cases doesn't seem worthwhile.
                Python uses </> for 'is subset'/'is superset' operations on sets.
                They don't satisfy not folding laws. */
-            int op = asdl_seq_GET(arg->v.Compare.ops, 0);
+            cmpop_ty op = asdl_seq_GET(arg->v.Compare.ops, 0);
             switch (op) {
             case Is:
                 op = IsNot;
@@ -63,8 +66,17 @@
             case NotIn:
                 op = In;
                 break;
-            default:
-                op = 0;
+            // The remaining comparison operators can't be safely inverted
+            case Eq:
+            case NotEq:
+            case Lt:
+            case LtE:
+            case Gt:
+            case GtE:
+                op = 0; // The AST enums leave "0" free as an "unused" marker
+                break;
+            // No default case, so the compiler will emit a warning if new
+            // comparison operators are added without being handled here
             }
             if (op) {
                 asdl_seq_SET(arg->v.Compare.ops, 0, op);
@@ -224,7 +236,7 @@
 
     PyObject *lv = lhs->v.Constant.value;
     PyObject *rv = rhs->v.Constant.value;
-    PyObject *newval;
+    PyObject *newval = NULL;
 
     switch (node->v.BinOp.op) {
     case Add:
@@ -263,15 +275,18 @@
     case BitAnd:
         newval = PyNumber_And(lv, rv);
         break;
-    default: // Unknown operator
+    // No builtin constants implement the following operators
+    case MatMult:
         return 1;
+    // No default case, so the compiler will emit a warning if new binary
+    // operators are added without being handled here
     }
 
     return make_const(node, newval, arena);
 }
 
 static PyObject*
-make_const_tuple(asdl_seq *elts)
+make_const_tuple(asdl_expr_seq *elts)
 {
     for (int i = 0; i < asdl_seq_LEN(elts); i++) {
         expr_ty e = (expr_ty)asdl_seq_GET(elts, i);
@@ -337,7 +352,7 @@
     PyObject *newval;
     if (arg->kind == List_kind) {
         /* First change a list into tuple. */
-        asdl_seq *elts = arg->v.List.elts;
+        asdl_expr_seq *elts = arg->v.List.elts;
         Py_ssize_t n = asdl_seq_LEN(elts);
         for (Py_ssize_t i = 0; i < n; i++) {
             expr_ty e = (expr_ty)asdl_seq_GET(elts, i);
@@ -368,7 +383,7 @@
 fold_compare(expr_ty node, PyArena *arena, _PyASTOptimizeState *state)
 {
     asdl_int_seq *ops;
-    asdl_seq *args;
+    asdl_expr_seq *args;
     Py_ssize_t i;
 
     ops = node->v.Compare.ops;
@@ -395,6 +410,9 @@
 static int astfold_arg(arg_ty node_, PyArena *ctx_, _PyASTOptimizeState *state);
 static int astfold_withitem(withitem_ty node_, PyArena *ctx_, _PyASTOptimizeState *state);
 static int astfold_excepthandler(excepthandler_ty node_, PyArena *ctx_, _PyASTOptimizeState *state);
+static int astfold_match_case(match_case_ty node_, PyArena *ctx_, _PyASTOptimizeState *state);
+static int astfold_pattern(pattern_ty node_, PyArena *ctx_, _PyASTOptimizeState *state);
+
 #define CALL(FUNC, TYPE, ARG) \
     if (!FUNC((ARG), ctx_, state)) \
         return 0;
@@ -405,9 +423,9 @@
 
 #define CALL_SEQ(FUNC, TYPE, ARG) { \
     int i; \
-    asdl_seq *seq = (ARG); /* avoid variable capture */ \
+    asdl_ ## TYPE ## _seq *seq = (ARG); /* avoid variable capture */ \
     for (i = 0; i < asdl_seq_LEN(seq); i++) { \
-        TYPE elt = (TYPE)asdl_seq_GET(seq, i); \
+        TYPE ## _ty elt = (TYPE ## _ty)asdl_seq_GET(seq, i); \
         if (elt != NULL && !FUNC(elt, ctx_, state)) \
             return 0; \
     } \
@@ -424,19 +442,20 @@
 }
 
 static int
-astfold_body(asdl_seq *stmts, PyArena *ctx_, _PyASTOptimizeState *state)
+astfold_body(asdl_stmt_seq *stmts, PyArena *ctx_, _PyASTOptimizeState *state)
 {
     int docstring = _PyAST_GetDocString(stmts) != NULL;
-    CALL_SEQ(astfold_stmt, stmt_ty, stmts);
+    CALL_SEQ(astfold_stmt, stmt, stmts);
     if (!docstring && _PyAST_GetDocString(stmts) != NULL) {
         stmt_ty st = (stmt_ty)asdl_seq_GET(stmts, 0);
-        asdl_seq *values = _Py_asdl_seq_new(1, ctx_);
+        asdl_expr_seq *values = _Py_asdl_expr_seq_new(1, ctx_);
         if (!values) {
             return 0;
         }
         asdl_seq_SET(values, 0, st->v.Expr.value);
-        expr_ty expr = JoinedStr(values, st->lineno, st->col_offset,
-                                 st->end_lineno, st->end_col_offset, ctx_);
+        expr_ty expr = _PyAST_JoinedStr(values, st->lineno, st->col_offset,
+                                        st->end_lineno, st->end_col_offset,
+                                        ctx_);
         if (!expr) {
             return 0;
         }
@@ -453,13 +472,16 @@
         CALL(astfold_body, asdl_seq, node_->v.Module.body);
         break;
     case Interactive_kind:
-        CALL_SEQ(astfold_stmt, stmt_ty, node_->v.Interactive.body);
+        CALL_SEQ(astfold_stmt, stmt, node_->v.Interactive.body);
         break;
     case Expression_kind:
         CALL(astfold_expr, expr_ty, node_->v.Expression.body);
         break;
-    default:
+    // The following top level nodes don't participate in constant folding
+    case FunctionType_kind:
         break;
+    // No default case, so the compiler will emit a warning if new top level
+    // compilation nodes are added without being handled here
     }
     return 1;
 }
@@ -467,9 +489,14 @@
 static int
 astfold_expr(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state)
 {
+    if (++state->recursion_depth > state->recursion_limit) {
+        PyErr_SetString(PyExc_RecursionError,
+                        "maximum recursion depth exceeded during compilation");
+        return 0;
+    }
     switch (node_->kind) {
     case BoolOp_kind:
-        CALL_SEQ(astfold_expr, expr_ty, node_->v.BoolOp.values);
+        CALL_SEQ(astfold_expr, expr, node_->v.BoolOp.values);
         break;
     case BinOp_kind:
         CALL(astfold_expr, expr_ty, node_->v.BinOp.left);
@@ -490,28 +517,28 @@
         CALL(astfold_expr, expr_ty, node_->v.IfExp.orelse);
         break;
     case Dict_kind:
-        CALL_SEQ(astfold_expr, expr_ty, node_->v.Dict.keys);
-        CALL_SEQ(astfold_expr, expr_ty, node_->v.Dict.values);
+        CALL_SEQ(astfold_expr, expr, node_->v.Dict.keys);
+        CALL_SEQ(astfold_expr, expr, node_->v.Dict.values);
         break;
     case Set_kind:
-        CALL_SEQ(astfold_expr, expr_ty, node_->v.Set.elts);
+        CALL_SEQ(astfold_expr, expr, node_->v.Set.elts);
         break;
     case ListComp_kind:
         CALL(astfold_expr, expr_ty, node_->v.ListComp.elt);
-        CALL_SEQ(astfold_comprehension, comprehension_ty, node_->v.ListComp.generators);
+        CALL_SEQ(astfold_comprehension, comprehension, node_->v.ListComp.generators);
         break;
     case SetComp_kind:
         CALL(astfold_expr, expr_ty, node_->v.SetComp.elt);
-        CALL_SEQ(astfold_comprehension, comprehension_ty, node_->v.SetComp.generators);
+        CALL_SEQ(astfold_comprehension, comprehension, node_->v.SetComp.generators);
         break;
     case DictComp_kind:
         CALL(astfold_expr, expr_ty, node_->v.DictComp.key);
         CALL(astfold_expr, expr_ty, node_->v.DictComp.value);
-        CALL_SEQ(astfold_comprehension, comprehension_ty, node_->v.DictComp.generators);
+        CALL_SEQ(astfold_comprehension, comprehension, node_->v.DictComp.generators);
         break;
     case GeneratorExp_kind:
         CALL(astfold_expr, expr_ty, node_->v.GeneratorExp.elt);
-        CALL_SEQ(astfold_comprehension, comprehension_ty, node_->v.GeneratorExp.generators);
+        CALL_SEQ(astfold_comprehension, comprehension, node_->v.GeneratorExp.generators);
         break;
     case Await_kind:
         CALL(astfold_expr, expr_ty, node_->v.Await.value);
@@ -524,20 +551,20 @@
         break;
     case Compare_kind:
         CALL(astfold_expr, expr_ty, node_->v.Compare.left);
-        CALL_SEQ(astfold_expr, expr_ty, node_->v.Compare.comparators);
+        CALL_SEQ(astfold_expr, expr, node_->v.Compare.comparators);
         CALL(fold_compare, expr_ty, node_);
         break;
     case Call_kind:
         CALL(astfold_expr, expr_ty, node_->v.Call.func);
-        CALL_SEQ(astfold_expr, expr_ty, node_->v.Call.args);
-        CALL_SEQ(astfold_keyword, keyword_ty, node_->v.Call.keywords);
+        CALL_SEQ(astfold_expr, expr, node_->v.Call.args);
+        CALL_SEQ(astfold_keyword, keyword, node_->v.Call.keywords);
         break;
     case FormattedValue_kind:
         CALL(astfold_expr, expr_ty, node_->v.FormattedValue.value);
         CALL_OPT(astfold_expr, expr_ty, node_->v.FormattedValue.format_spec);
         break;
     case JoinedStr_kind:
-        CALL_SEQ(astfold_expr, expr_ty, node_->v.JoinedStr.values);
+        CALL_SEQ(astfold_expr, expr, node_->v.JoinedStr.values);
         break;
     case Attribute_kind:
         CALL(astfold_expr, expr_ty, node_->v.Attribute.value);
@@ -556,21 +583,29 @@
         CALL_OPT(astfold_expr, expr_ty, node_->v.Slice.step);
         break;
     case List_kind:
-        CALL_SEQ(astfold_expr, expr_ty, node_->v.List.elts);
+        CALL_SEQ(astfold_expr, expr, node_->v.List.elts);
         break;
     case Tuple_kind:
-        CALL_SEQ(astfold_expr, expr_ty, node_->v.Tuple.elts);
+        CALL_SEQ(astfold_expr, expr, node_->v.Tuple.elts);
         CALL(fold_tuple, expr_ty, node_);
         break;
     case Name_kind:
         if (node_->v.Name.ctx == Load &&
                 _PyUnicode_EqualToASCIIString(node_->v.Name.id, "__debug__")) {
+            state->recursion_depth--;
             return make_const(node_, PyBool_FromLong(!state->optimize), ctx_);
         }
         break;
-    default:
+    case NamedExpr_kind:
+        CALL(astfold_expr, expr_ty, node_->v.NamedExpr.value);
         break;
+    case Constant_kind:
+        // Already a constant, nothing further to do
+        break;
+    // No default case, so the compiler will emit a warning if new expression
+    // kinds are added without being handled here
     }
+    state->recursion_depth--;
     return 1;
 }
 
@@ -586,7 +621,7 @@
 {
     CALL(astfold_expr, expr_ty, node_->target);
     CALL(astfold_expr, expr_ty, node_->iter);
-    CALL_SEQ(astfold_expr, expr_ty, node_->ifs);
+    CALL_SEQ(astfold_expr, expr, node_->ifs);
 
     CALL(fold_iter, expr_ty, node_->iter);
     return 1;
@@ -595,13 +630,13 @@
 static int
 astfold_arguments(arguments_ty node_, PyArena *ctx_, _PyASTOptimizeState *state)
 {
-    CALL_SEQ(astfold_arg, arg_ty, node_->posonlyargs);
-    CALL_SEQ(astfold_arg, arg_ty, node_->args);
+    CALL_SEQ(astfold_arg, arg, node_->posonlyargs);
+    CALL_SEQ(astfold_arg, arg, node_->args);
     CALL_OPT(astfold_arg, arg_ty, node_->vararg);
-    CALL_SEQ(astfold_arg, arg_ty, node_->kwonlyargs);
-    CALL_SEQ(astfold_expr, expr_ty, node_->kw_defaults);
+    CALL_SEQ(astfold_arg, arg, node_->kwonlyargs);
+    CALL_SEQ(astfold_expr, expr, node_->kw_defaults);
     CALL_OPT(astfold_arg, arg_ty, node_->kwarg);
-    CALL_SEQ(astfold_expr, expr_ty, node_->defaults);
+    CALL_SEQ(astfold_expr, expr, node_->defaults);
     return 1;
 }
 
@@ -617,11 +652,16 @@
 static int
 astfold_stmt(stmt_ty node_, PyArena *ctx_, _PyASTOptimizeState *state)
 {
+    if (++state->recursion_depth > state->recursion_limit) {
+        PyErr_SetString(PyExc_RecursionError,
+                        "maximum recursion depth exceeded during compilation");
+        return 0;
+    }
     switch (node_->kind) {
     case FunctionDef_kind:
         CALL(astfold_arguments, arguments_ty, node_->v.FunctionDef.args);
         CALL(astfold_body, asdl_seq, node_->v.FunctionDef.body);
-        CALL_SEQ(astfold_expr, expr_ty, node_->v.FunctionDef.decorator_list);
+        CALL_SEQ(astfold_expr, expr, node_->v.FunctionDef.decorator_list);
         if (!(state->ff_features & CO_FUTURE_ANNOTATIONS)) {
             CALL_OPT(astfold_expr, expr_ty, node_->v.FunctionDef.returns);
         }
@@ -629,25 +669,25 @@
     case AsyncFunctionDef_kind:
         CALL(astfold_arguments, arguments_ty, node_->v.AsyncFunctionDef.args);
         CALL(astfold_body, asdl_seq, node_->v.AsyncFunctionDef.body);
-        CALL_SEQ(astfold_expr, expr_ty, node_->v.AsyncFunctionDef.decorator_list);
+        CALL_SEQ(astfold_expr, expr, node_->v.AsyncFunctionDef.decorator_list);
         if (!(state->ff_features & CO_FUTURE_ANNOTATIONS)) {
             CALL_OPT(astfold_expr, expr_ty, node_->v.AsyncFunctionDef.returns);
         }
         break;
     case ClassDef_kind:
-        CALL_SEQ(astfold_expr, expr_ty, node_->v.ClassDef.bases);
-        CALL_SEQ(astfold_keyword, keyword_ty, node_->v.ClassDef.keywords);
+        CALL_SEQ(astfold_expr, expr, node_->v.ClassDef.bases);
+        CALL_SEQ(astfold_keyword, keyword, node_->v.ClassDef.keywords);
         CALL(astfold_body, asdl_seq, node_->v.ClassDef.body);
-        CALL_SEQ(astfold_expr, expr_ty, node_->v.ClassDef.decorator_list);
+        CALL_SEQ(astfold_expr, expr, node_->v.ClassDef.decorator_list);
         break;
     case Return_kind:
         CALL_OPT(astfold_expr, expr_ty, node_->v.Return.value);
         break;
     case Delete_kind:
-        CALL_SEQ(astfold_expr, expr_ty, node_->v.Delete.targets);
+        CALL_SEQ(astfold_expr, expr, node_->v.Delete.targets);
         break;
     case Assign_kind:
-        CALL_SEQ(astfold_expr, expr_ty, node_->v.Assign.targets);
+        CALL_SEQ(astfold_expr, expr, node_->v.Assign.targets);
         CALL(astfold_expr, expr_ty, node_->v.Assign.value);
         break;
     case AugAssign_kind:
@@ -664,44 +704,44 @@
     case For_kind:
         CALL(astfold_expr, expr_ty, node_->v.For.target);
         CALL(astfold_expr, expr_ty, node_->v.For.iter);
-        CALL_SEQ(astfold_stmt, stmt_ty, node_->v.For.body);
-        CALL_SEQ(astfold_stmt, stmt_ty, node_->v.For.orelse);
+        CALL_SEQ(astfold_stmt, stmt, node_->v.For.body);
+        CALL_SEQ(astfold_stmt, stmt, node_->v.For.orelse);
 
         CALL(fold_iter, expr_ty, node_->v.For.iter);
         break;
     case AsyncFor_kind:
         CALL(astfold_expr, expr_ty, node_->v.AsyncFor.target);
         CALL(astfold_expr, expr_ty, node_->v.AsyncFor.iter);
-        CALL_SEQ(astfold_stmt, stmt_ty, node_->v.AsyncFor.body);
-        CALL_SEQ(astfold_stmt, stmt_ty, node_->v.AsyncFor.orelse);
+        CALL_SEQ(astfold_stmt, stmt, node_->v.AsyncFor.body);
+        CALL_SEQ(astfold_stmt, stmt, node_->v.AsyncFor.orelse);
         break;
     case While_kind:
         CALL(astfold_expr, expr_ty, node_->v.While.test);
-        CALL_SEQ(astfold_stmt, stmt_ty, node_->v.While.body);
-        CALL_SEQ(astfold_stmt, stmt_ty, node_->v.While.orelse);
+        CALL_SEQ(astfold_stmt, stmt, node_->v.While.body);
+        CALL_SEQ(astfold_stmt, stmt, node_->v.While.orelse);
         break;
     case If_kind:
         CALL(astfold_expr, expr_ty, node_->v.If.test);
-        CALL_SEQ(astfold_stmt, stmt_ty, node_->v.If.body);
-        CALL_SEQ(astfold_stmt, stmt_ty, node_->v.If.orelse);
+        CALL_SEQ(astfold_stmt, stmt, node_->v.If.body);
+        CALL_SEQ(astfold_stmt, stmt, node_->v.If.orelse);
         break;
     case With_kind:
-        CALL_SEQ(astfold_withitem, withitem_ty, node_->v.With.items);
-        CALL_SEQ(astfold_stmt, stmt_ty, node_->v.With.body);
+        CALL_SEQ(astfold_withitem, withitem, node_->v.With.items);
+        CALL_SEQ(astfold_stmt, stmt, node_->v.With.body);
         break;
     case AsyncWith_kind:
-        CALL_SEQ(astfold_withitem, withitem_ty, node_->v.AsyncWith.items);
-        CALL_SEQ(astfold_stmt, stmt_ty, node_->v.AsyncWith.body);
+        CALL_SEQ(astfold_withitem, withitem, node_->v.AsyncWith.items);
+        CALL_SEQ(astfold_stmt, stmt, node_->v.AsyncWith.body);
         break;
     case Raise_kind:
         CALL_OPT(astfold_expr, expr_ty, node_->v.Raise.exc);
         CALL_OPT(astfold_expr, expr_ty, node_->v.Raise.cause);
         break;
     case Try_kind:
-        CALL_SEQ(astfold_stmt, stmt_ty, node_->v.Try.body);
-        CALL_SEQ(astfold_excepthandler, excepthandler_ty, node_->v.Try.handlers);
-        CALL_SEQ(astfold_stmt, stmt_ty, node_->v.Try.orelse);
-        CALL_SEQ(astfold_stmt, stmt_ty, node_->v.Try.finalbody);
+        CALL_SEQ(astfold_stmt, stmt, node_->v.Try.body);
+        CALL_SEQ(astfold_excepthandler, excepthandler, node_->v.Try.handlers);
+        CALL_SEQ(astfold_stmt, stmt, node_->v.Try.orelse);
+        CALL_SEQ(astfold_stmt, stmt, node_->v.Try.finalbody);
         break;
     case Assert_kind:
         CALL(astfold_expr, expr_ty, node_->v.Assert.test);
@@ -710,9 +750,23 @@
     case Expr_kind:
         CALL(astfold_expr, expr_ty, node_->v.Expr.value);
         break;
-    default:
+    case Match_kind:
+        CALL(astfold_expr, expr_ty, node_->v.Match.subject);
+        CALL_SEQ(astfold_match_case, match_case, node_->v.Match.cases);
         break;
+    // The following statements don't contain any subexpressions to be folded
+    case Import_kind:
+    case ImportFrom_kind:
+    case Global_kind:
+    case Nonlocal_kind:
+    case Pass_kind:
+    case Break_kind:
+    case Continue_kind:
+        break;
+    // No default case, so the compiler will emit a warning if new statement
+    // kinds are added without being handled here
     }
+    state->recursion_depth--;
     return 1;
 }
 
@@ -722,10 +776,10 @@
     switch (node_->kind) {
     case ExceptHandler_kind:
         CALL_OPT(astfold_expr, expr_ty, node_->v.ExceptHandler.type);
-        CALL_SEQ(astfold_stmt, stmt_ty, node_->v.ExceptHandler.body);
+        CALL_SEQ(astfold_stmt, stmt, node_->v.ExceptHandler.body);
         break;
-    default:
-        break;
+    // No default case, so the compiler will emit a warning if new handler
+    // kinds are added without being handled here
     }
     return 1;
 }
@@ -738,15 +792,98 @@
     return 1;
 }
 
+static int
+astfold_pattern(pattern_ty node_, PyArena *ctx_, _PyASTOptimizeState *state)
+{
+    // Currently, this is really only used to form complex/negative numeric
+    // constants in MatchValue and MatchMapping nodes
+    // We still recurse into all subexpressions and subpatterns anyway
+    if (++state->recursion_depth > state->recursion_limit) {
+        PyErr_SetString(PyExc_RecursionError,
+                        "maximum recursion depth exceeded during compilation");
+        return 0;
+    }
+    switch (node_->kind) {
+        case MatchValue_kind:
+            CALL(astfold_expr, expr_ty, node_->v.MatchValue.value);
+            break;
+        case MatchSingleton_kind:
+            break;
+        case MatchSequence_kind:
+            CALL_SEQ(astfold_pattern, pattern, node_->v.MatchSequence.patterns);
+            break;
+        case MatchMapping_kind:
+            CALL_SEQ(astfold_expr, expr, node_->v.MatchMapping.keys);
+            CALL_SEQ(astfold_pattern, pattern, node_->v.MatchMapping.patterns);
+            break;
+        case MatchClass_kind:
+            CALL(astfold_expr, expr_ty, node_->v.MatchClass.cls);
+            CALL_SEQ(astfold_pattern, pattern, node_->v.MatchClass.patterns);
+            CALL_SEQ(astfold_pattern, pattern, node_->v.MatchClass.kwd_patterns);
+            break;
+        case MatchStar_kind:
+            break;
+        case MatchAs_kind:
+            if (node_->v.MatchAs.pattern) {
+                CALL(astfold_pattern, pattern_ty, node_->v.MatchAs.pattern);
+            }
+            break;
+        case MatchOr_kind:
+            CALL_SEQ(astfold_pattern, pattern, node_->v.MatchOr.patterns);
+            break;
+    // No default case, so the compiler will emit a warning if new pattern
+    // kinds are added without being handled here
+    }
+    state->recursion_depth--;
+    return 1;
+}
+
+static int
+astfold_match_case(match_case_ty node_, PyArena *ctx_, _PyASTOptimizeState *state)
+{
+    CALL(astfold_pattern, expr_ty, node_->pattern);
+    CALL_OPT(astfold_expr, expr_ty, node_->guard);
+    CALL_SEQ(astfold_stmt, stmt, node_->body);
+    return 1;
+}
+
 #undef CALL
 #undef CALL_OPT
 #undef CALL_SEQ
 #undef CALL_INT_SEQ
 
+/* See comments in symtable.c. */
+#define COMPILER_STACK_FRAME_SCALE 3
+
 int
 _PyAST_Optimize(mod_ty mod, PyArena *arena, _PyASTOptimizeState *state)
 {
+    PyThreadState *tstate;
+    int recursion_limit = Py_GetRecursionLimit();
+    int starting_recursion_depth;
+
+    /* Setup recursion depth check counters */
+    tstate = _PyThreadState_GET();
+    if (!tstate) {
+        return 0;
+    }
+    /* Be careful here to prevent overflow. */
+    starting_recursion_depth = (tstate->recursion_depth < INT_MAX / COMPILER_STACK_FRAME_SCALE) ?
+        tstate->recursion_depth * COMPILER_STACK_FRAME_SCALE : tstate->recursion_depth;
+    state->recursion_depth = starting_recursion_depth;
+    state->recursion_limit = (recursion_limit < INT_MAX / COMPILER_STACK_FRAME_SCALE) ?
+        recursion_limit * COMPILER_STACK_FRAME_SCALE : recursion_limit;
+
     int ret = astfold_mod(mod, arena, state);
     assert(ret || PyErr_Occurred());
+
+    /* Check that the recursion depth counting balanced correctly */
+    if (ret && state->recursion_depth != starting_recursion_depth) {
+        PyErr_Format(PyExc_SystemError,
+            "AST optimizer recursion depth mismatch (before=%d, after=%d)",
+            starting_recursion_depth, state->recursion_depth);
+        return 0;
+    }
+
     return ret;
 }
diff --git a/Python/ast_unparse.c b/Python/ast_unparse.c
index e699751..126e904 100644
--- a/Python/ast_unparse.c
+++ b/Python/ast_unparse.c
@@ -1,7 +1,12 @@
-#include <float.h>   /* DBL_MAX_10_EXP */
-#include <stdbool.h>
 #include "Python.h"
-#include "Python-ast.h"
+#include "pycore_ast.h"           // expr_ty
+#include <float.h>                // DBL_MAX_10_EXP
+#include <stdbool.h>
+
+/* This limited unparser is used to convert annotations back to strings
+ * during compilation rather than being a full AST unparser.
+ * See ast.unparse for a full unparser (written in Python)
+ */
 
 static PyObject *_str_open_br;
 static PyObject *_str_dbl_open_br;
@@ -117,7 +122,7 @@
 append_ast_boolop(_PyUnicodeWriter *writer, expr_ty e, int level)
 {
     Py_ssize_t i, value_count;
-    asdl_seq *values;
+    asdl_expr_seq *values;
     const char *op = (e->v.BoolOp.op == And) ? " and " : " or ";
     int pr = (e->v.BoolOp.op == And) ? PR_AND : PR_OR;
 
@@ -398,7 +403,7 @@
 }
 
 static int
-append_ast_comprehensions(_PyUnicodeWriter *writer, asdl_seq *comprehensions)
+append_ast_comprehensions(_PyUnicodeWriter *writer, asdl_comprehension_seq *comprehensions)
 {
     Py_ssize_t i, gen_count;
     gen_count = asdl_seq_LEN(comprehensions);
@@ -453,7 +458,7 @@
 {
     const char *op;
     Py_ssize_t i, comparator_count;
-    asdl_seq *comparators;
+    asdl_expr_seq *comparators;
     asdl_int_seq *ops;
 
     APPEND_STR_IF(level > PR_CMP, "(");
@@ -612,7 +617,7 @@
 /* Build body separately to enable wrapping the entire stream of Strs,
    Constants and FormattedValues in one opening and one closing quote. */
 static PyObject *
-build_fstring_body(asdl_seq *values, bool is_format_spec)
+build_fstring_body(asdl_expr_seq *values, bool is_format_spec)
 {
     Py_ssize_t i, value_count;
     _PyUnicodeWriter body_writer;
@@ -912,11 +917,11 @@
         return append_ast_tuple(writer, e, level);
     case NamedExpr_kind:
         return append_named_expr(writer, e, level);
-    default:
-        PyErr_SetString(PyExc_SystemError,
-                        "unknown expression kind");
-        return -1;
+    // No default so compiler emits a warning for unhandled cases
     }
+    PyErr_SetString(PyExc_SystemError,
+                    "unknown expression kind");
+    return -1;
 }
 
 static int
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 199b09c..b0162e5 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -2,12 +2,13 @@
 
 #include "Python.h"
 #include <ctype.h>
-#include "ast.h"
-#undef Yield   /* undefine macro conflicting with <winbase.h> */
-#include "pycore_object.h"
-#include "pycore_pyerrors.h"
-#include "pycore_pystate.h"      // _PyThreadState_GET()
-#include "pycore_tupleobject.h"
+#include "pycore_ast.h"           // _PyAST_Validate()
+#include "pycore_compile.h"       // _PyAST_Compile()
+#include "pycore_object.h"        // _Py_AddToAllObjects()
+#include "pycore_pyerrors.h"      // _PyErr_NoMemory()
+#include "pycore_pystate.h"       // _PyThreadState_GET()
+#include "pycore_tuple.h"         // _PyTuple_FromArray()
+#include "pycore_ceval.h"         // _PyEval_Vector()
 
 _Py_IDENTIFIER(__builtins__);
 _Py_IDENTIFIER(__dict__);
@@ -71,6 +72,7 @@
             /* If this is a first successful replacement, create new_bases list and
                copy previously encountered bases. */
             if (!(new_bases = PyList_New(i))) {
+                Py_DECREF(new_base);
                 goto error;
             }
             for (j = 0; j < i; j++) {
@@ -81,6 +83,7 @@
         }
         j = PyList_GET_SIZE(new_bases);
         if (PyList_SetSlice(new_bases, j, j, new_base) < 0) {
+            Py_DECREF(new_base);
             goto error;
         }
         Py_DECREF(new_base);
@@ -102,8 +105,9 @@
 builtin___build_class__(PyObject *self, PyObject *const *args, Py_ssize_t nargs,
                         PyObject *kwnames)
 {
-    PyObject *func, *name, *bases, *mkw, *meta, *winner, *prep, *ns, *orig_bases;
-    PyObject *cls = NULL, *cell = NULL;
+    PyObject *func, *name, *winner, *prep;
+    PyObject *cls = NULL, *cell = NULL, *ns = NULL, *meta = NULL, *orig_bases = NULL;
+    PyObject *mkw = NULL, *bases = NULL;
     int isclass = 0;   /* initialize to prevent gcc warning */
 
     if (nargs < 2) {
@@ -140,26 +144,20 @@
     else {
         mkw = _PyStack_AsDict(args + nargs, kwnames);
         if (mkw == NULL) {
-            Py_DECREF(bases);
-            return NULL;
+            goto error;
         }
 
         meta = _PyDict_GetItemIdWithError(mkw, &PyId_metaclass);
         if (meta != NULL) {
             Py_INCREF(meta);
             if (_PyDict_DelItemId(mkw, &PyId_metaclass) < 0) {
-                Py_DECREF(meta);
-                Py_DECREF(mkw);
-                Py_DECREF(bases);
-                return NULL;
+                goto error;
             }
             /* metaclass is explicitly given, check if it's indeed a class */
             isclass = PyType_Check(meta);
         }
         else if (PyErr_Occurred()) {
-            Py_DECREF(mkw);
-            Py_DECREF(bases);
-            return NULL;
+            goto error;
         }
     }
     if (meta == NULL) {
@@ -182,10 +180,7 @@
         winner = (PyObject *)_PyType_CalculateMetaclass((PyTypeObject *)meta,
                                                         bases);
         if (winner == NULL) {
-            Py_DECREF(meta);
-            Py_XDECREF(mkw);
-            Py_DECREF(bases);
-            return NULL;
+            goto error;
         }
         if (winner != meta) {
             Py_DECREF(meta);
@@ -207,10 +202,7 @@
         Py_DECREF(prep);
     }
     if (ns == NULL) {
-        Py_DECREF(meta);
-        Py_XDECREF(mkw);
-        Py_DECREF(bases);
-        return NULL;
+        goto error;
     }
     if (!PyMapping_Check(ns)) {
         PyErr_Format(PyExc_TypeError,
@@ -219,9 +211,9 @@
                      Py_TYPE(ns)->tp_name);
         goto error;
     }
-    cell = PyEval_EvalCodeEx(PyFunction_GET_CODE(func), PyFunction_GET_GLOBALS(func), ns,
-                             NULL, 0, NULL, 0, NULL, 0, NULL,
-                             PyFunction_GET_CLOSURE(func));
+    PyFrameConstructor *f =  PyFunction_AS_FRAME_CONSTRUCTOR(func);
+    PyThreadState *tstate = PyThreadState_GET();
+    cell = _PyEval_Vector(tstate, f, ns, NULL, 0, NULL);
     if (cell != NULL) {
         if (bases != orig_bases) {
             if (PyMapping_SetItemString(ns, "__orig_bases__", orig_bases) < 0) {
@@ -251,13 +243,13 @@
     }
 error:
     Py_XDECREF(cell);
-    Py_DECREF(ns);
-    Py_DECREF(meta);
+    Py_XDECREF(ns);
+    Py_XDECREF(meta);
     Py_XDECREF(mkw);
-    Py_DECREF(bases);
     if (bases != orig_bases) {
         Py_DECREF(orig_bases);
     }
+    Py_DECREF(bases);
     return cls;
 }
 
@@ -532,8 +524,40 @@
         Py_DECREF(it);
         return NULL;
     }
-    Py_INCREF(func);
-    lz->func = func;
+
+    lz->func = Py_NewRef(func);
+    lz->it = it;
+
+    return (PyObject *)lz;
+}
+
+static PyObject *
+filter_vectorcall(PyObject *type, PyObject * const*args,
+                size_t nargsf, PyObject *kwnames)
+{
+    PyTypeObject *tp = (PyTypeObject *)type;
+    if (tp == &PyFilter_Type && !_PyArg_NoKwnames("filter", kwnames)) {
+        return NULL;
+    }
+
+    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
+    if (!_PyArg_CheckPositional("filter", nargs, 2, 2)) {
+        return NULL;
+    }
+
+    PyObject *it = PyObject_GetIter(args[1]);
+    if (it == NULL) {
+        return NULL;
+    }
+
+    filterobject *lz = (filterobject *)tp->tp_alloc(tp, 0);
+
+    if (lz == NULL) {
+        Py_DECREF(it);
+        return NULL;
+    }
+
+    lz->func = Py_NewRef(args[0]);
     lz->it = it;
 
     return (PyObject *)lz;
@@ -652,6 +676,7 @@
     PyType_GenericAlloc,                /* tp_alloc */
     filter_new,                         /* tp_new */
     PyObject_GC_Del,                    /* tp_free */
+    .tp_vectorcall = (vectorcallfunc)filter_vectorcall
 };
 
 
@@ -793,21 +818,17 @@
             PyArena *arena;
             mod_ty mod;
 
-            arena = PyArena_New();
+            arena = _PyArena_New();
             if (arena == NULL)
                 goto error;
             mod = PyAST_obj2mod(source, arena, compile_mode);
-            if (mod == NULL) {
-                PyArena_Free(arena);
+            if (mod == NULL || !_PyAST_Validate(mod)) {
+                _PyArena_Free(arena);
                 goto error;
             }
-            if (!PyAST_Validate(mod)) {
-                PyArena_Free(arena);
-                goto error;
-            }
-            result = (PyObject*)PyAST_CompileObject(mod, filename,
-                                                    &cf, optimize, arena);
-            PyArena_Free(arena);
+            result = (PyObject*)_PyAST_Compile(mod, filename,
+                                               &cf, optimize, arena);
+            _PyArena_Free(arena);
         }
         goto finally;
     }
@@ -924,12 +945,12 @@
         return NULL;
     }
 
-    if (_PyDict_GetItemIdWithError(globals, &PyId___builtins__) == NULL) {
-        if (_PyDict_SetItemId(globals, &PyId___builtins__,
-                              PyEval_GetBuiltins()) != 0)
-            return NULL;
+    int r = _PyDict_ContainsId(globals, &PyId___builtins__);
+    if (r == 0) {
+        r = _PyDict_SetItemId(globals, &PyId___builtins__,
+                              PyEval_GetBuiltins());
     }
-    else if (PyErr_Occurred()) {
+    if (r < 0) {
         return NULL;
     }
 
@@ -1012,12 +1033,12 @@
             Py_TYPE(locals)->tp_name);
         return NULL;
     }
-    if (_PyDict_GetItemIdWithError(globals, &PyId___builtins__) == NULL) {
-        if (_PyDict_SetItemId(globals, &PyId___builtins__,
-                              PyEval_GetBuiltins()) != 0)
-            return NULL;
+    int r = _PyDict_ContainsId(globals, &PyId___builtins__);
+    if (r == 0) {
+        r = _PyDict_SetItemId(globals, &PyId___builtins__,
+                              PyEval_GetBuiltins());
     }
-    else if (PyErr_Occurred()) {
+    if (r < 0) {
         return NULL;
     }
 
@@ -1229,8 +1250,48 @@
     }
     lz->iters = iters;
     func = PyTuple_GET_ITEM(args, 0);
-    Py_INCREF(func);
-    lz->func = func;
+    lz->func = Py_NewRef(func);
+
+    return (PyObject *)lz;
+}
+
+static PyObject *
+map_vectorcall(PyObject *type, PyObject * const*args,
+                size_t nargsf, PyObject *kwnames)
+{
+    PyTypeObject *tp = (PyTypeObject *)type;
+    if (tp == &PyMap_Type && !_PyArg_NoKwnames("map", kwnames)) {
+        return NULL;
+    }
+
+    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
+    if (nargs < 2) {
+        PyErr_SetString(PyExc_TypeError,
+           "map() must have at least two arguments.");
+        return NULL;
+    }
+
+    PyObject *iters = PyTuple_New(nargs-1);
+    if (iters == NULL) {
+        return NULL;
+    }
+
+    for (int i=1; i<nargs; i++) {
+        PyObject *it = PyObject_GetIter(args[i]);
+        if (it == NULL) {
+            Py_DECREF(iters);
+            return NULL;
+        }
+        PyTuple_SET_ITEM(iters, i-1, it);
+    }
+
+    mapobject *lz = (mapobject *)tp->tp_alloc(tp, 0);
+    if (lz == NULL) {
+        Py_DECREF(iters);
+        return NULL;
+    }
+    lz->iters = iters;
+    lz->func = Py_NewRef(args[0]);
 
     return (PyObject *)lz;
 }
@@ -1368,6 +1429,7 @@
     PyType_GenericAlloc,                /* tp_alloc */
     map_new,                            /* tp_new */
     PyObject_GC_Del,                    /* tp_free */
+    .tp_vectorcall = (vectorcallfunc)map_vectorcall
 };
 
 
@@ -1536,6 +1598,62 @@
 
 
 /*[clinic input]
+aiter as builtin_aiter
+
+    async_iterable: object
+    /
+
+Return an AsyncIterator for an AsyncIterable object.
+[clinic start generated code]*/
+
+static PyObject *
+builtin_aiter(PyObject *module, PyObject *async_iterable)
+/*[clinic end generated code: output=1bae108d86f7960e input=473993d0cacc7d23]*/
+{
+    return PyObject_GetAIter(async_iterable);
+}
+
+PyObject *PyAnextAwaitable_New(PyObject *, PyObject *);
+
+/*[clinic input]
+anext as builtin_anext
+
+    aiterator: object
+    default: object = NULL
+    /
+
+Return the next item from the async iterator.
+[clinic start generated code]*/
+
+static PyObject *
+builtin_anext_impl(PyObject *module, PyObject *aiterator,
+                   PyObject *default_value)
+/*[clinic end generated code: output=f02c060c163a81fa input=699d11f4e38eca24]*/
+{
+    PyTypeObject *t;
+    PyObject *awaitable;
+
+    t = Py_TYPE(aiterator);
+    if (t->tp_as_async == NULL || t->tp_as_async->am_anext == NULL) {
+        PyErr_Format(PyExc_TypeError,
+            "'%.200s' object is not an async iterator",
+            t->tp_name);
+        return NULL;
+    }
+
+    awaitable = (*t->tp_as_async->am_anext)(aiterator);
+    if (default_value == NULL) {
+        return awaitable;
+    }
+
+    PyObject* new_awaitable = PyAnextAwaitable_New(
+            awaitable, default_value);
+    Py_DECREF(awaitable);
+    return new_awaitable;
+}
+
+
+/*[clinic input]
 len as builtin_len
 
     obj: object
@@ -2089,7 +2207,7 @@
         Py_DECREF(stdin_encoding);
         Py_DECREF(stdin_errors);
         Py_XDECREF(po);
-        PyMem_FREE(s);
+        PyMem_Free(s);
 
         if (result != NULL) {
             if (PySys_Audit("builtins.input/result", "O", result) < 0) {
@@ -2494,17 +2612,17 @@
     class_or_tuple: object
     /
 
-Return whether 'cls' is a derived from another class or is the same class.
+Return whether 'cls' is derived from another class or is the same class.
 
 A tuple, as in ``issubclass(x, (A, B, ...))``, may be given as the target to
 check against. This is equivalent to ``issubclass(x, A) or issubclass(x, B)
-or ...`` etc.
+or ...``.
 [clinic start generated code]*/
 
 static PyObject *
 builtin_issubclass_impl(PyObject *module, PyObject *cls,
                         PyObject *class_or_tuple)
-/*[clinic end generated code: output=358412410cd7a250 input=af5f35e9ceaddaf6]*/
+/*[clinic end generated code: output=358412410cd7a250 input=a24b9f3d58c370d6]*/
 {
     int retval;
 
@@ -2517,9 +2635,10 @@
 
 typedef struct {
     PyObject_HEAD
-    Py_ssize_t          tuplesize;
-    PyObject *ittuple;                  /* tuple of iterators */
+    Py_ssize_t tuplesize;
+    PyObject *ittuple;     /* tuple of iterators */
     PyObject *result;
+    int strict;
 } zipobject;
 
 static PyObject *
@@ -2530,9 +2649,21 @@
     PyObject *ittuple;  /* tuple of iterators */
     PyObject *result;
     Py_ssize_t tuplesize;
+    int strict = 0;
 
-    if (type == &PyZip_Type && !_PyArg_NoKeywords("zip", kwds))
-        return NULL;
+    if (kwds) {
+        PyObject *empty = PyTuple_New(0);
+        if (empty == NULL) {
+            return NULL;
+        }
+        static char *kwlist[] = {"strict", NULL};
+        int parsed = PyArg_ParseTupleAndKeywords(
+                empty, kwds, "|$p:zip", kwlist, &strict);
+        Py_DECREF(empty);
+        if (!parsed) {
+            return NULL;
+        }
+    }
 
     /* args must be a tuple */
     assert(PyTuple_Check(args));
@@ -2573,6 +2704,7 @@
     lz->ittuple = ittuple;
     lz->tuplesize = tuplesize;
     lz->result = result;
+    lz->strict = strict;
 
     return (PyObject *)lz;
 }
@@ -2613,12 +2745,20 @@
             item = (*Py_TYPE(it)->tp_iternext)(it);
             if (item == NULL) {
                 Py_DECREF(result);
+                if (lz->strict) {
+                    goto check;
+                }
                 return NULL;
             }
             olditem = PyTuple_GET_ITEM(result, i);
             PyTuple_SET_ITEM(result, i, item);
             Py_DECREF(olditem);
         }
+        // bpo-42536: The GC may have untracked this result tuple. Since we're
+        // recycling it, make sure it's tracked again:
+        if (!_PyObject_GC_IS_TRACKED(result)) {
+            _PyObject_GC_TRACK(result);
+        }
     } else {
         result = PyTuple_New(tuplesize);
         if (result == NULL)
@@ -2628,28 +2768,85 @@
             item = (*Py_TYPE(it)->tp_iternext)(it);
             if (item == NULL) {
                 Py_DECREF(result);
+                if (lz->strict) {
+                    goto check;
+                }
                 return NULL;
             }
             PyTuple_SET_ITEM(result, i, item);
         }
     }
     return result;
+check:
+    if (PyErr_Occurred()) {
+        if (!PyErr_ExceptionMatches(PyExc_StopIteration)) {
+            // next() on argument i raised an exception (not StopIteration)
+            return NULL;
+        }
+        PyErr_Clear();
+    }
+    if (i) {
+        // ValueError: zip() argument 2 is shorter than argument 1
+        // ValueError: zip() argument 3 is shorter than arguments 1-2
+        const char* plural = i == 1 ? " " : "s 1-";
+        return PyErr_Format(PyExc_ValueError,
+                            "zip() argument %d is shorter than argument%s%d",
+                            i + 1, plural, i);
+    }
+    for (i = 1; i < tuplesize; i++) {
+        it = PyTuple_GET_ITEM(lz->ittuple, i);
+        item = (*Py_TYPE(it)->tp_iternext)(it);
+        if (item) {
+            Py_DECREF(item);
+            const char* plural = i == 1 ? " " : "s 1-";
+            return PyErr_Format(PyExc_ValueError,
+                                "zip() argument %d is longer than argument%s%d",
+                                i + 1, plural, i);
+        }
+        if (PyErr_Occurred()) {
+            if (!PyErr_ExceptionMatches(PyExc_StopIteration)) {
+                // next() on argument i raised an exception (not StopIteration)
+                return NULL;
+            }
+            PyErr_Clear();
+        }
+        // Argument i is exhausted. So far so good...
+    }
+    // All arguments are exhausted. Success!
+    return NULL;
 }
 
 static PyObject *
 zip_reduce(zipobject *lz, PyObject *Py_UNUSED(ignored))
 {
     /* Just recreate the zip with the internal iterator tuple */
-    return Py_BuildValue("OO", Py_TYPE(lz), lz->ittuple);
+    if (lz->strict) {
+        return PyTuple_Pack(3, Py_TYPE(lz), lz->ittuple, Py_True);
+    }
+    return PyTuple_Pack(2, Py_TYPE(lz), lz->ittuple);
+}
+
+PyDoc_STRVAR(setstate_doc, "Set state information for unpickling.");
+
+static PyObject *
+zip_setstate(zipobject *lz, PyObject *state)
+{
+    int strict = PyObject_IsTrue(state);
+    if (strict < 0) {
+        return NULL;
+    }
+    lz->strict = strict;
+    Py_RETURN_NONE;
 }
 
 static PyMethodDef zip_methods[] = {
     {"__reduce__",   (PyCFunction)zip_reduce,   METH_NOARGS, reduce_doc},
-    {NULL,           NULL}           /* sentinel */
+    {"__setstate__", (PyCFunction)zip_setstate, METH_O,      setstate_doc},
+    {NULL}  /* sentinel */
 };
 
 PyDoc_STRVAR(zip_doc,
-"zip(*iterables) --> A zip object yielding tuples until an input is exhausted.\n\
+"zip(*iterables, strict=False) --> Yield tuples until an input is exhausted.\n\
 \n\
    >>> list(zip('abcdefg', range(3), range(4)))\n\
    [('a', 0, 0), ('b', 1, 1), ('c', 2, 2)]\n\
@@ -2657,7 +2854,10 @@
 The zip object yields n-length tuples, where n is the number of iterables\n\
 passed as positional arguments to zip().  The i-th element in every tuple\n\
 comes from the i-th iterable argument to zip().  This continues until the\n\
-shortest argument is exhausted.");
+shortest argument is exhausted.\n\
+\n\
+If strict is true and one of the arguments is exhausted before the others,\n\
+raise a ValueError.");
 
 PyTypeObject PyZip_Type = {
     PyVarObject_HEAD_INIT(&PyType_Type, 0)
@@ -2733,11 +2933,13 @@
     BUILTIN_ISINSTANCE_METHODDEF
     BUILTIN_ISSUBCLASS_METHODDEF
     {"iter",            (PyCFunction)(void(*)(void))builtin_iter,       METH_FASTCALL, iter_doc},
+    BUILTIN_AITER_METHODDEF
     BUILTIN_LEN_METHODDEF
     BUILTIN_LOCALS_METHODDEF
     {"max",             (PyCFunction)(void(*)(void))builtin_max,        METH_VARARGS | METH_KEYWORDS, max_doc},
     {"min",             (PyCFunction)(void(*)(void))builtin_min,        METH_VARARGS | METH_KEYWORDS, min_doc},
     {"next",            (PyCFunction)(void(*)(void))builtin_next,       METH_FASTCALL, next_doc},
+    BUILTIN_ANEXT_METHODDEF
     BUILTIN_OCT_METHODDEF
     BUILTIN_ORD_METHODDEF
     BUILTIN_POW_METHODDEF
@@ -2770,11 +2972,11 @@
 
 
 PyObject *
-_PyBuiltin_Init(PyThreadState *tstate)
+_PyBuiltin_Init(PyInterpreterState *interp)
 {
     PyObject *mod, *dict, *debug;
 
-    const PyConfig *config = _PyInterpreterState_GetConfig(tstate->interp);
+    const PyConfig *config = _PyInterpreterState_GetConfig(interp);
 
     if (PyType_Ready(&PyFilter_Type) < 0 ||
         PyType_Ready(&PyMap_Type) < 0 ||
diff --git a/Python/bootstrap_hash.c b/Python/bootstrap_hash.c
index a212f69..e189ce0 100644
--- a/Python/bootstrap_hash.c
+++ b/Python/bootstrap_hash.c
@@ -25,7 +25,7 @@
 #  include <sanitizer/msan_interface.h>
 #endif
 
-#if defined(__APPLE__) && defined(__has_builtin) 
+#if defined(__APPLE__) && defined(__has_builtin)
 #  if __has_builtin(__builtin_available)
 #    define HAVE_GETENTRYPY_GETRANDOM_RUNTIME __builtin_available(macOS 10.12, iOS 10.10, tvOS 10.0, watchOS 3.0, *)
 #  endif
@@ -221,7 +221,7 @@
 
 #if defined(__APPLE__) && defined(__has_attribute) && __has_attribute(availability)
 static int
-py_getentropy(char *buffer, Py_ssize_t size, int raise) 
+py_getentropy(char *buffer, Py_ssize_t size, int raise)
         __attribute__((availability(macos,introduced=10.12)))
         __attribute__((availability(ios,introduced=10.0)))
         __attribute__((availability(tvos,introduced=10.0)))
diff --git a/Python/ceval.c b/Python/ceval.c
index 91e879e..21674e0 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -1,4 +1,3 @@
-
 /* Execute compiled code */
 
 /* XXX TO DO:
@@ -7,21 +6,22 @@
    */
 
 /* enable more aggressive intra-module optimizations, where available */
+/* affects both release and debug builds - see bpo-43271 */
 #define PY_LOCAL_AGGRESSIVE
 
 #include "Python.h"
 #include "pycore_abstract.h"      // _PyIndex_Check()
-#include "pycore_call.h"
-#include "pycore_ceval.h"
-#include "pycore_code.h"
-#include "pycore_initconfig.h"
-#include "pycore_object.h"
-#include "pycore_pyerrors.h"
-#include "pycore_pylifecycle.h"
+#include "pycore_call.h"          // _PyObject_FastCallDictTstate()
+#include "pycore_ceval.h"         // _PyEval_SignalAsyncExc()
+#include "pycore_code.h"          // _PyCode_InitOpcache()
+#include "pycore_initconfig.h"    // _PyStatus_OK()
+#include "pycore_object.h"        // _PyObject_GC_TRACK()
+#include "pycore_pyerrors.h"      // _PyErr_Fetch()
+#include "pycore_pylifecycle.h"   // _PyErr_Print()
 #include "pycore_pymem.h"         // _PyMem_IsPtrFreed()
 #include "pycore_pystate.h"       // _PyInterpreterState_GET()
-#include "pycore_sysmodule.h"
-#include "pycore_tupleobject.h"
+#include "pycore_sysmodule.h"     // _PySys_Audit()
+#include "pycore_tuple.h"         // _PyTuple_ITEMS()
 
 #include "code.h"
 #include "dictobject.h"
@@ -29,9 +29,17 @@
 #include "opcode.h"
 #include "pydtrace.h"
 #include "setobject.h"
+#include "structmember.h"         // struct PyMemberDef, T_OFFSET_EX
 
 #include <ctype.h>
 
+typedef struct {
+    PyCodeObject *code; // The code object for the bounds. May be NULL.
+    PyCodeAddressRange bounds; // Only valid if code != NULL.
+    CFrame cframe;
+} PyTraceInfo;
+
+
 #ifdef Py_DEBUG
 /* For debugging the interpreter: */
 #define LLTRACE  1      /* Low-level trace feature */
@@ -46,10 +54,10 @@
 
 /* Forward declarations */
 Py_LOCAL_INLINE(PyObject *) call_function(
-    PyThreadState *tstate, PyObject ***pp_stack,
+    PyThreadState *tstate, PyTraceInfo *, PyObject ***pp_stack,
     Py_ssize_t oparg, PyObject *kwnames);
 static PyObject * do_call_core(
-    PyThreadState *tstate, PyObject *func,
+    PyThreadState *tstate, PyTraceInfo *, PyObject *func,
     PyObject *callargs, PyObject *kwdict);
 
 #ifdef LLTRACE
@@ -58,16 +66,19 @@
 #endif
 static int call_trace(Py_tracefunc, PyObject *,
                       PyThreadState *, PyFrameObject *,
+                      PyTraceInfo *,
                       int, PyObject *);
 static int call_trace_protected(Py_tracefunc, PyObject *,
                                 PyThreadState *, PyFrameObject *,
+                                PyTraceInfo *,
                                 int, PyObject *);
 static void call_exc_trace(Py_tracefunc, PyObject *,
-                           PyThreadState *, PyFrameObject *);
+                           PyThreadState *, PyFrameObject *,
+                           PyTraceInfo *trace_info);
 static int maybe_call_line_trace(Py_tracefunc, PyObject *,
                                  PyThreadState *, PyFrameObject *,
-                                 int *, int *, int *);
-static void maybe_dtrace_line(PyFrameObject *, int *, int *, int *);
+                                 PyTraceInfo *, int);
+static void maybe_dtrace_line(PyFrameObject *, PyTraceInfo *, int);
 static void dtrace_function_entry(PyFrameObject *);
 static void dtrace_function_return(PyFrameObject *);
 
@@ -103,16 +114,19 @@
 #endif
 
 /* per opcode cache */
-#ifdef Py_DEBUG
-// --with-pydebug is used to find memory leak.  opcache makes it harder.
-// So we disable opcache when Py_DEBUG is defined.
-// See bpo-37146
-#define OPCACHE_MIN_RUNS 0  /* disable opcache */
-#else
-#define OPCACHE_MIN_RUNS 1024  /* create opcache when code executed this time */
-#endif
+static int opcache_min_runs = 1024;  /* create opcache when code executed this many times */
+#define OPCODE_CACHE_MAX_TRIES 20
 #define OPCACHE_STATS 0  /* Enable stats */
 
+// This function allows to deactivate the opcode cache. As different cache mechanisms may hold
+// references, this can mess with the reference leak detector functionality so the cache needs
+// to be deactivated in such scenarios to avoid false positives. See bpo-3714 for more information.
+void
+_PyEval_DeactivateOpCache(void)
+{
+    opcache_min_runs = 0;
+}
+
 #if OPCACHE_STATS
 static size_t opcache_code_objects = 0;
 static size_t opcache_code_objects_extra_mem = 0;
@@ -120,6 +134,12 @@
 static size_t opcache_global_opts = 0;
 static size_t opcache_global_hits = 0;
 static size_t opcache_global_misses = 0;
+
+static size_t opcache_attr_opts = 0;
+static size_t opcache_attr_hits = 0;
+static size_t opcache_attr_misses = 0;
+static size_t opcache_attr_deopts = 0;
+static size_t opcache_attr_total = 0;
 #endif
 
 
@@ -254,8 +274,22 @@
                        "(the current Python thread state is NULL)");
 }
 
+#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+int
+_PyEval_ThreadsInitialized(PyInterpreterState *interp)
+{
+    return gil_created(&interp->ceval.gil);
+}
 
 int
+PyEval_ThreadsInitialized(void)
+{
+    // Fatal error if there is no current interpreter
+    PyInterpreterState *interp = PyInterpreterState_Get();
+    return _PyEval_ThreadsInitialized(interp);
+}
+#else
+int
 _PyEval_ThreadsInitialized(_PyRuntimeState *runtime)
 {
     return gil_created(&runtime->ceval.gil);
@@ -267,18 +301,25 @@
     _PyRuntimeState *runtime = &_PyRuntime;
     return _PyEval_ThreadsInitialized(runtime);
 }
+#endif
 
 PyStatus
 _PyEval_InitGIL(PyThreadState *tstate)
 {
-    if (!_Py_IsMainInterpreter(tstate)) {
+#ifndef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+    if (!_Py_IsMainInterpreter(tstate->interp)) {
         /* Currently, the GIL is shared by all interpreters,
            and only the main interpreter is responsible to create
            and destroy it. */
         return _PyStatus_OK();
     }
+#endif
 
+#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+    struct _gil_runtime_state *gil = &tstate->interp->ceval.gil;
+#else
     struct _gil_runtime_state *gil = &tstate->interp->runtime->ceval.gil;
+#endif
     assert(!gil_created(gil));
 
     PyThread_init_thread();
@@ -291,16 +332,22 @@
 }
 
 void
-_PyEval_FiniGIL(PyThreadState *tstate)
+_PyEval_FiniGIL(PyInterpreterState *interp)
 {
-    if (!_Py_IsMainInterpreter(tstate)) {
+#ifndef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+    if (!_Py_IsMainInterpreter(interp)) {
         /* Currently, the GIL is shared by all interpreters,
            and only the main interpreter is responsible to create
            and destroy it. */
         return;
     }
+#endif
 
-    struct _gil_runtime_state *gil = &tstate->interp->runtime->ceval.gil;
+#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+    struct _gil_runtime_state *gil = &interp->ceval.gil;
+#else
+    struct _gil_runtime_state *gil = &interp->runtime->ceval.gil;
+#endif
     if (!gil_created(gil)) {
         /* First Py_InitializeFromConfig() call: the GIL doesn't exist
            yet: do nothing. */
@@ -343,6 +390,25 @@
             opcache_global_opts);
 
     fprintf(stderr, "\n");
+
+    fprintf(stderr, "-- Opcode cache LOAD_ATTR hits     = %zd (%d%%)\n",
+            opcache_attr_hits,
+            (int) (100.0 * opcache_attr_hits /
+                opcache_attr_total));
+
+    fprintf(stderr, "-- Opcode cache LOAD_ATTR misses   = %zd (%d%%)\n",
+            opcache_attr_misses,
+            (int) (100.0 * opcache_attr_misses /
+                opcache_attr_total));
+
+    fprintf(stderr, "-- Opcode cache LOAD_ATTR opts     = %zd\n",
+            opcache_attr_opts);
+
+    fprintf(stderr, "-- Opcode cache LOAD_ATTR deopts   = %zd\n",
+            opcache_attr_deopts);
+
+    fprintf(stderr, "-- Opcode cache LOAD_ATTR total    = %zd\n",
+            opcache_attr_total);
 #endif
 }
 
@@ -385,9 +451,13 @@
     take_gil(tstate);
 
     struct _gilstate_runtime_state *gilstate = &tstate->interp->runtime->gilstate;
+#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+    (void)_PyThreadState_Swap(gilstate, tstate);
+#else
     if (_PyThreadState_Swap(gilstate, tstate) != NULL) {
         Py_FatalError("non-NULL old thread state");
     }
+#endif
 }
 
 void
@@ -407,19 +477,20 @@
 
 #ifdef HAVE_FORK
 /* This function is called from PyOS_AfterFork_Child to destroy all threads
- * which are not running in the child process, and clear internal locks
- * which might be held by those threads.
- */
-
-void
-_PyEval_ReInitThreads(_PyRuntimeState *runtime)
+   which are not running in the child process, and clear internal locks
+   which might be held by those threads. */
+PyStatus
+_PyEval_ReInitThreads(PyThreadState *tstate)
 {
-    PyThreadState *tstate = _PyRuntimeState_GetThreadState(runtime);
-    _Py_EnsureTstateNotNULL(tstate);
+    _PyRuntimeState *runtime = tstate->interp->runtime;
 
+#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+    struct _gil_runtime_state *gil = &tstate->interp->ceval.gil;
+#else
     struct _gil_runtime_state *gil = &runtime->ceval.gil;
+#endif
     if (!gil_created(gil)) {
-        return;
+        return _PyStatus_OK();
     }
     recreate_gil(gil);
 
@@ -427,11 +498,12 @@
 
     struct _pending_calls *pending = &tstate->interp->ceval.pending;
     if (_PyThread_at_fork_reinit(&pending->lock) < 0) {
-        Py_FatalError("Can't initialize threads for pending calls");
+        return _PyStatus_ERR("Can't reinitialize pending calls lock");
     }
 
     /* Destroy all threads except the current one */
     _PyThreadState_DeleteExcept(runtime, tstate);
+    return _PyStatus_OK();
 }
 #endif
 
@@ -439,22 +511,30 @@
    raised. */
 
 void
-_PyEval_SignalAsyncExc(PyThreadState *tstate)
+_PyEval_SignalAsyncExc(PyInterpreterState *interp)
 {
-    assert(is_tstate_valid(tstate));
-    SIGNAL_ASYNC_EXC(tstate->interp);
+    SIGNAL_ASYNC_EXC(interp);
 }
 
 PyThreadState *
 PyEval_SaveThread(void)
 {
     _PyRuntimeState *runtime = &_PyRuntime;
+#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+    PyThreadState *old_tstate = _PyThreadState_GET();
+    PyThreadState *tstate = _PyThreadState_Swap(&runtime->gilstate, old_tstate);
+#else
     PyThreadState *tstate = _PyThreadState_Swap(&runtime->gilstate, NULL);
+#endif
     _Py_EnsureTstateNotNULL(tstate);
 
     struct _ceval_runtime_state *ceval = &runtime->ceval;
     struct _ceval_state *ceval2 = &tstate->interp->ceval;
+#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+    assert(gil_created(&ceval2->gil));
+#else
     assert(gil_created(&ceval->gil));
+#endif
     drop_gil(ceval, ceval2, tstate);
     return tstate;
 }
@@ -618,10 +698,8 @@
 }
 
 static int
-make_pending_calls(PyThreadState *tstate)
+make_pending_calls(PyInterpreterState *interp)
 {
-    assert(is_tstate_valid(tstate));
-
     /* only execute pending calls on main thread */
     if (!_Py_ThreadCanHandlePendingCalls()) {
         return 0;
@@ -636,11 +714,11 @@
 
     /* unsignal before starting to call callbacks, so that any callback
        added in-between re-signals */
-    UNSIGNAL_PENDING_CALLS(tstate->interp);
+    UNSIGNAL_PENDING_CALLS(interp);
     int res = 0;
 
     /* perform a bounded number of calls, in case of recursion */
-    struct _pending_calls *pending = &tstate->interp->ceval.pending;
+    struct _pending_calls *pending = &interp->ceval.pending;
     for (int i=0; i<NPENDINGCALLS; i++) {
         int (*func)(void *) = NULL;
         void *arg = NULL;
@@ -665,7 +743,7 @@
 
 error:
     busy = 0;
-    SIGNAL_PENDING_CALLS(tstate->interp);
+    SIGNAL_PENDING_CALLS(interp);
     return res;
 }
 
@@ -673,6 +751,7 @@
 _Py_FinishPendingCalls(PyThreadState *tstate)
 {
     assert(PyGILState_Check());
+    assert(is_tstate_valid(tstate));
 
     struct _pending_calls *pending = &tstate->interp->ceval.pending;
 
@@ -680,7 +759,7 @@
         return;
     }
 
-    if (make_pending_calls(tstate) < 0) {
+    if (make_pending_calls(tstate->interp) < 0) {
         PyObject *exc, *val, *tb;
         _PyErr_Fetch(tstate, &exc, &val, &tb);
         PyErr_BadInternalCall();
@@ -697,6 +776,7 @@
     assert(PyGILState_Check());
 
     PyThreadState *tstate = _PyThreadState_GET();
+    assert(is_tstate_valid(tstate));
 
     /* Python signal handler doesn't really queue a callback: it only signals
        that a signal was received, see _PyEval_SignalReceived(). */
@@ -705,7 +785,7 @@
         return res;
     }
 
-    res = make_pending_calls(tstate);
+    res = make_pending_calls(tstate->interp);
     if (res != 0) {
         return res;
     }
@@ -716,16 +796,15 @@
 /* The interpreter's recursion limit */
 
 #ifndef Py_DEFAULT_RECURSION_LIMIT
-#define Py_DEFAULT_RECURSION_LIMIT 1000
+#  define Py_DEFAULT_RECURSION_LIMIT 1000
 #endif
 
-int _Py_CheckRecursionLimit = Py_DEFAULT_RECURSION_LIMIT;
-
 void
 _PyEval_InitRuntimeState(struct _ceval_runtime_state *ceval)
 {
-    _Py_CheckRecursionLimit = Py_DEFAULT_RECURSION_LIMIT;
+#ifndef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
     _gil_initialize(&ceval->gil);
+#endif
 }
 
 int
@@ -741,6 +820,10 @@
         return -1;
     }
 
+#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+    _gil_initialize(&ceval->gil);
+#endif
+
     return 0;
 }
 
@@ -757,8 +840,8 @@
 int
 Py_GetRecursionLimit(void)
 {
-    PyThreadState *tstate = _PyThreadState_GET();
-    return tstate->interp->ceval.recursion_limit;
+    PyInterpreterState *interp = _PyInterpreterState_GET();
+    return interp->ceval.recursion_limit;
 }
 
 void
@@ -766,14 +849,11 @@
 {
     PyThreadState *tstate = _PyThreadState_GET();
     tstate->interp->ceval.recursion_limit = new_limit;
-    if (_Py_IsMainInterpreter(tstate)) {
-        _Py_CheckRecursionLimit = new_limit;
-    }
 }
 
 /* The function _Py_EnterRecursiveCall() only calls _Py_CheckRecursiveCall()
-   if the recursion_depth reaches _Py_CheckRecursionLimit.
-   If USE_STACKCHECK, the macro decrements _Py_CheckRecursionLimit
+   if the recursion_depth reaches recursion_limit.
+   If USE_STACKCHECK, the macro decrements recursion_limit
    to guarantee that _Py_CheckRecursiveCall() is regularly called.
    Without USE_STACKCHECK, there is no need for this. */
 int
@@ -788,47 +868,270 @@
         _PyErr_SetString(tstate, PyExc_MemoryError, "Stack overflow");
         return -1;
     }
-    if (_Py_IsMainInterpreter(tstate)) {
-        /* Needed for ABI backwards-compatibility (see bpo-31857) */
-        _Py_CheckRecursionLimit = recursion_limit;
-    }
 #endif
-    if (tstate->recursion_critical)
-        /* Somebody asked that we don't check for recursion. */
-        return 0;
-    if (tstate->overflowed) {
+    if (tstate->recursion_headroom) {
         if (tstate->recursion_depth > recursion_limit + 50) {
             /* Overflowing while handling an overflow. Give up. */
             Py_FatalError("Cannot recover from stack overflow.");
         }
-        return 0;
     }
-    if (tstate->recursion_depth > recursion_limit) {
-        --tstate->recursion_depth;
-        tstate->overflowed = 1;
-        _PyErr_Format(tstate, PyExc_RecursionError,
-                      "maximum recursion depth exceeded%s",
-                      where);
-        return -1;
+    else {
+        if (tstate->recursion_depth > recursion_limit) {
+            tstate->recursion_headroom++;
+            _PyErr_Format(tstate, PyExc_RecursionError,
+                        "maximum recursion depth exceeded%s",
+                        where);
+            tstate->recursion_headroom--;
+            --tstate->recursion_depth;
+            return -1;
+        }
     }
     return 0;
 }
 
+
+// PEP 634: Structural Pattern Matching
+
+
+// Return a tuple of values corresponding to keys, with error checks for
+// duplicate/missing keys.
+static PyObject*
+match_keys(PyThreadState *tstate, PyObject *map, PyObject *keys)
+{
+    assert(PyTuple_CheckExact(keys));
+    Py_ssize_t nkeys = PyTuple_GET_SIZE(keys);
+    if (!nkeys) {
+        // No keys means no items.
+        return PyTuple_New(0);
+    }
+    PyObject *seen = NULL;
+    PyObject *dummy = NULL;
+    PyObject *values = NULL;
+    // We use the two argument form of map.get(key, default) for two reasons:
+    // - Atomically check for a key and get its value without error handling.
+    // - Don't cause key creation or resizing in dict subclasses like
+    //   collections.defaultdict that define __missing__ (or similar).
+    _Py_IDENTIFIER(get);
+    PyObject *get = _PyObject_GetAttrId(map, &PyId_get);
+    if (get == NULL) {
+        goto fail;
+    }
+    seen = PySet_New(NULL);
+    if (seen == NULL) {
+        goto fail;
+    }
+    // dummy = object()
+    dummy = _PyObject_CallNoArg((PyObject *)&PyBaseObject_Type);
+    if (dummy == NULL) {
+        goto fail;
+    }
+    values = PyList_New(0);
+    if (values == NULL) {
+        goto fail;
+    }
+    for (Py_ssize_t i = 0; i < nkeys; i++) {
+        PyObject *key = PyTuple_GET_ITEM(keys, i);
+        if (PySet_Contains(seen, key) || PySet_Add(seen, key)) {
+            if (!_PyErr_Occurred(tstate)) {
+                // Seen it before!
+                _PyErr_Format(tstate, PyExc_ValueError,
+                              "mapping pattern checks duplicate key (%R)", key);
+            }
+            goto fail;
+        }
+        PyObject *value = PyObject_CallFunctionObjArgs(get, key, dummy, NULL);
+        if (value == NULL) {
+            goto fail;
+        }
+        if (value == dummy) {
+            // key not in map!
+            Py_DECREF(value);
+            Py_DECREF(values);
+            // Return None:
+            Py_INCREF(Py_None);
+            values = Py_None;
+            goto done;
+        }
+        PyList_Append(values, value);
+        Py_DECREF(value);
+    }
+    Py_SETREF(values, PyList_AsTuple(values));
+    // Success:
+done:
+    Py_DECREF(get);
+    Py_DECREF(seen);
+    Py_DECREF(dummy);
+    return values;
+fail:
+    Py_XDECREF(get);
+    Py_XDECREF(seen);
+    Py_XDECREF(dummy);
+    Py_XDECREF(values);
+    return NULL;
+}
+
+// Extract a named attribute from the subject, with additional bookkeeping to
+// raise TypeErrors for repeated lookups. On failure, return NULL (with no
+// error set). Use _PyErr_Occurred(tstate) to disambiguate.
+static PyObject*
+match_class_attr(PyThreadState *tstate, PyObject *subject, PyObject *type,
+                 PyObject *name, PyObject *seen)
+{
+    assert(PyUnicode_CheckExact(name));
+    assert(PySet_CheckExact(seen));
+    if (PySet_Contains(seen, name) || PySet_Add(seen, name)) {
+        if (!_PyErr_Occurred(tstate)) {
+            // Seen it before!
+            _PyErr_Format(tstate, PyExc_TypeError,
+                          "%s() got multiple sub-patterns for attribute %R",
+                          ((PyTypeObject*)type)->tp_name, name);
+        }
+        return NULL;
+    }
+    PyObject *attr = PyObject_GetAttr(subject, name);
+    if (attr == NULL && _PyErr_ExceptionMatches(tstate, PyExc_AttributeError)) {
+        _PyErr_Clear(tstate);
+    }
+    return attr;
+}
+
+// On success (match), return a tuple of extracted attributes. On failure (no
+// match), return NULL. Use _PyErr_Occurred(tstate) to disambiguate.
+static PyObject*
+match_class(PyThreadState *tstate, PyObject *subject, PyObject *type,
+            Py_ssize_t nargs, PyObject *kwargs)
+{
+    if (!PyType_Check(type)) {
+        const char *e = "called match pattern must be a type";
+        _PyErr_Format(tstate, PyExc_TypeError, e);
+        return NULL;
+    }
+    assert(PyTuple_CheckExact(kwargs));
+    // First, an isinstance check:
+    if (PyObject_IsInstance(subject, type) <= 0) {
+        return NULL;
+    }
+    // So far so good:
+    PyObject *seen = PySet_New(NULL);
+    if (seen == NULL) {
+        return NULL;
+    }
+    PyObject *attrs = PyList_New(0);
+    if (attrs == NULL) {
+        Py_DECREF(seen);
+        return NULL;
+    }
+    // NOTE: From this point on, goto fail on failure:
+    PyObject *match_args = NULL;
+    // First, the positional subpatterns:
+    if (nargs) {
+        int match_self = 0;
+        match_args = PyObject_GetAttrString(type, "__match_args__");
+        if (match_args) {
+            if (!PyTuple_CheckExact(match_args)) {
+                const char *e = "%s.__match_args__ must be a tuple (got %s)";
+                _PyErr_Format(tstate, PyExc_TypeError, e,
+                              ((PyTypeObject *)type)->tp_name,
+                              Py_TYPE(match_args)->tp_name);
+                goto fail;
+            }
+        }
+        else if (_PyErr_ExceptionMatches(tstate, PyExc_AttributeError)) {
+            _PyErr_Clear(tstate);
+            // _Py_TPFLAGS_MATCH_SELF is only acknowledged if the type does not
+            // define __match_args__. This is natural behavior for subclasses:
+            // it's as if __match_args__ is some "magic" value that is lost as
+            // soon as they redefine it.
+            match_args = PyTuple_New(0);
+            match_self = PyType_HasFeature((PyTypeObject*)type,
+                                            _Py_TPFLAGS_MATCH_SELF);
+        }
+        else {
+            goto fail;
+        }
+        assert(PyTuple_CheckExact(match_args));
+        Py_ssize_t allowed = match_self ? 1 : PyTuple_GET_SIZE(match_args);
+        if (allowed < nargs) {
+            const char *plural = (allowed == 1) ? "" : "s";
+            _PyErr_Format(tstate, PyExc_TypeError,
+                          "%s() accepts %d positional sub-pattern%s (%d given)",
+                          ((PyTypeObject*)type)->tp_name,
+                          allowed, plural, nargs);
+            goto fail;
+        }
+        if (match_self) {
+            // Easy. Copy the subject itself, and move on to kwargs.
+            PyList_Append(attrs, subject);
+        }
+        else {
+            for (Py_ssize_t i = 0; i < nargs; i++) {
+                PyObject *name = PyTuple_GET_ITEM(match_args, i);
+                if (!PyUnicode_CheckExact(name)) {
+                    _PyErr_Format(tstate, PyExc_TypeError,
+                                  "__match_args__ elements must be strings "
+                                  "(got %s)", Py_TYPE(name)->tp_name);
+                    goto fail;
+                }
+                PyObject *attr = match_class_attr(tstate, subject, type, name,
+                                                  seen);
+                if (attr == NULL) {
+                    goto fail;
+                }
+                PyList_Append(attrs, attr);
+                Py_DECREF(attr);
+            }
+        }
+        Py_CLEAR(match_args);
+    }
+    // Finally, the keyword subpatterns:
+    for (Py_ssize_t i = 0; i < PyTuple_GET_SIZE(kwargs); i++) {
+        PyObject *name = PyTuple_GET_ITEM(kwargs, i);
+        PyObject *attr = match_class_attr(tstate, subject, type, name, seen);
+        if (attr == NULL) {
+            goto fail;
+        }
+        PyList_Append(attrs, attr);
+        Py_DECREF(attr);
+    }
+    Py_SETREF(attrs, PyList_AsTuple(attrs));
+    Py_DECREF(seen);
+    return attrs;
+fail:
+    // We really don't care whether an error was raised or not... that's our
+    // caller's problem. All we know is that the match failed.
+    Py_XDECREF(match_args);
+    Py_DECREF(seen);
+    Py_DECREF(attrs);
+    return NULL;
+}
+
+
 static int do_raise(PyThreadState *tstate, PyObject *exc, PyObject *cause);
 static int unpack_iterable(PyThreadState *, PyObject *, int, int, PyObject **);
 
-#define _Py_TracingPossible(ceval) ((ceval)->tracing_possible)
-
 
 PyObject *
 PyEval_EvalCode(PyObject *co, PyObject *globals, PyObject *locals)
 {
-    return PyEval_EvalCodeEx(co,
-                      globals, locals,
-                      (PyObject **)NULL, 0,
-                      (PyObject **)NULL, 0,
-                      (PyObject **)NULL, 0,
-                      NULL, NULL);
+    PyThreadState *tstate = PyThreadState_GET();
+    if (locals == NULL) {
+        locals = globals;
+    }
+    PyObject *builtins = _PyEval_BuiltinsFromGlobals(tstate, globals); // borrowed ref
+    if (builtins == NULL) {
+        return NULL;
+    }
+    PyFrameConstructor desc = {
+        .fc_globals = globals,
+        .fc_builtins = builtins,
+        .fc_name = ((PyCodeObject *)co)->co_name,
+        .fc_qualname = ((PyCodeObject *)co)->co_name,
+        .fc_code = co,
+        .fc_defaults = NULL,
+        .fc_kwdefaults = NULL,
+        .fc_closure = NULL
+    };
+    return _PyEval_Vector(tstate, &desc, locals, NULL, 0, NULL);
 }
 
 
@@ -868,7 +1171,7 @@
     /* Pending calls */
     struct _ceval_state *ceval2 = &tstate->interp->ceval;
     if (_Py_atomic_load_relaxed(&ceval2->pending.calls_to_do)) {
-        if (make_pending_calls(tstate) != 0) {
+        if (make_pending_calls(tstate->interp) != 0) {
             return -1;
         }
     }
@@ -885,9 +1188,13 @@
 
         take_gil(tstate);
 
+#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+        (void)_PyThreadState_Swap(&runtime->gilstate, tstate);
+#else
         if (_PyThreadState_Swap(&runtime->gilstate, tstate) != NULL) {
             Py_FatalError("orphan tstate");
         }
+#endif
     }
 
     /* Check for asynchronous exception. */
@@ -914,41 +1221,6 @@
     return 0;
 }
 
-PyObject* _Py_HOT_FUNCTION
-_PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag)
-{
-    _Py_EnsureTstateNotNULL(tstate);
-
-#ifdef DXPAIRS
-    int lastopcode = 0;
-#endif
-    PyObject **stack_pointer;  /* Next free slot in value stack */
-    const _Py_CODEUNIT *next_instr;
-    int opcode;        /* Current opcode */
-    int oparg;         /* Current opcode argument, if any */
-    PyObject **fastlocals, **freevars;
-    PyObject *retval = NULL;            /* Return value */
-    struct _ceval_state * const ceval2 = &tstate->interp->ceval;
-    _Py_atomic_int * const eval_breaker = &ceval2->eval_breaker;
-    PyCodeObject *co;
-
-    /* when tracing we set things up so that
-
-           not (instr_lb <= current_bytecode_offset < instr_ub)
-
-       is true when the line being executed has changed.  The
-       initial values are such as to make this false the first
-       time it is tested. */
-    int instr_ub = -1, instr_lb = 0, instr_prev = -1;
-
-    const _Py_CODEUNIT *first_instr;
-    PyObject *names;
-    PyObject *consts;
-    _PyOpcache *co_opcache;
-
-#ifdef LLTRACE
-    _Py_IDENTIFIER(__ltrace__);
-#endif
 
 /* Computed GOTOs, or
        the-optimization-commonly-but-improperly-known-as-"threaded code"
@@ -989,6 +1261,23 @@
    -fno-crossjumping).
 */
 
+/* Use macros rather than inline functions, to make it as clear as possible
+ * to the C compiler that the tracing check is a simple test then branch.
+ * We want to be sure that the compiler knows this before it generates
+ * the CFG.
+ */
+#ifdef LLTRACE
+#define OR_LLTRACE || lltrace
+#else
+#define OR_LLTRACE
+#endif
+
+#ifdef WITH_DTRACE
+#define OR_DTRACE_LINE || PyDTrace_LINE_ENABLED()
+#else
+#define OR_DTRACE_LINE
+#endif
+
 #ifdef DYNAMIC_EXECUTION_PROFILE
 #undef USE_COMPUTED_GOTOS
 #define USE_COMPUTED_GOTOS 0
@@ -1007,50 +1296,28 @@
 #endif
 
 #if USE_COMPUTED_GOTOS
-/* Import the static jump table */
-#include "opcode_targets.h"
-
-#define TARGET(op) \
-    op: \
-    TARGET_##op
-
-#ifdef LLTRACE
-#define FAST_DISPATCH() \
-    { \
-        if (!lltrace && !_Py_TracingPossible(ceval2) && !PyDTrace_LINE_ENABLED()) { \
-            f->f_lasti = INSTR_OFFSET(); \
-            NEXTOPARG(); \
-            goto *opcode_targets[opcode]; \
-        } \
-        goto fast_next_opcode; \
-    }
-#else
-#define FAST_DISPATCH() \
-    { \
-        if (!_Py_TracingPossible(ceval2) && !PyDTrace_LINE_ENABLED()) { \
-            f->f_lasti = INSTR_OFFSET(); \
-            NEXTOPARG(); \
-            goto *opcode_targets[opcode]; \
-        } \
-        goto fast_next_opcode; \
-    }
-#endif
-
+#define TARGET(op) op: TARGET_##op
 #define DISPATCH() \
     { \
-        if (!_Py_atomic_load_relaxed(eval_breaker)) { \
-            FAST_DISPATCH(); \
+        if (trace_info.cframe.use_tracing OR_DTRACE_LINE OR_LLTRACE) { \
+            goto tracing_dispatch; \
         } \
-        continue; \
+        f->f_lasti = INSTR_OFFSET(); \
+        NEXTOPARG(); \
+        goto *opcode_targets[opcode]; \
     }
-
 #else
 #define TARGET(op) op
-#define FAST_DISPATCH() goto fast_next_opcode
-#define DISPATCH() continue
+#define DISPATCH() goto predispatch;
 #endif
 
 
+#define CHECK_EVAL_BREAKER() \
+    if (_Py_atomic_load_relaxed(eval_breaker)) { \
+        continue; \
+    }
+
+
 /* Tuple access macros */
 
 #ifndef Py_DEBUG
@@ -1062,16 +1329,15 @@
 /* Code access macros */
 
 /* The integer overflow is checked by an assertion below. */
-#define INSTR_OFFSET()  \
-    (sizeof(_Py_CODEUNIT) * (int)(next_instr - first_instr))
+#define INSTR_OFFSET() ((int)(next_instr - first_instr))
 #define NEXTOPARG()  do { \
         _Py_CODEUNIT word = *next_instr; \
         opcode = _Py_OPCODE(word); \
         oparg = _Py_OPARG(word); \
         next_instr++; \
     } while (0)
-#define JUMPTO(x)       (next_instr = first_instr + (x) / sizeof(_Py_CODEUNIT))
-#define JUMPBY(x)       (next_instr += (x) / sizeof(_Py_CODEUNIT))
+#define JUMPTO(x)       (next_instr = first_instr + (x))
+#define JUMPBY(x)       (next_instr += (x))
 
 /* OpCode prediction macros
     Some opcodes tend to come in pairs thus making it possible to
@@ -1133,7 +1399,6 @@
 #define SET_SECOND(v)     (stack_pointer[-2] = (v))
 #define SET_THIRD(v)      (stack_pointer[-3] = (v))
 #define SET_FOURTH(v)     (stack_pointer[-4] = (v))
-#define SET_VALUE(n, v)   (stack_pointer[-(n)] = (v))
 #define BASIC_STACKADJ(n) (stack_pointer += n)
 #define BASIC_PUSH(v)     (*stack_pointer++ = (v))
 #define BASIC_POP()       (*--stack_pointer)
@@ -1214,16 +1479,43 @@
     do { \
         co_opcache = NULL; \
         if (co->co_opcache != NULL) { \
-            unsigned char co_opt_offset = \
+            unsigned char co_opcache_offset = \
                 co->co_opcache_map[next_instr - first_instr]; \
-            if (co_opt_offset > 0) { \
-                assert(co_opt_offset <= co->co_opcache_size); \
-                co_opcache = &co->co_opcache[co_opt_offset - 1]; \
+            if (co_opcache_offset > 0) { \
+                assert(co_opcache_offset <= co->co_opcache_size); \
+                co_opcache = &co->co_opcache[co_opcache_offset - 1]; \
                 assert(co_opcache != NULL); \
             } \
         } \
     } while (0)
 
+#define OPCACHE_DEOPT() \
+    do { \
+        if (co_opcache != NULL) { \
+            co_opcache->optimized = -1; \
+            unsigned char co_opcache_offset = \
+                co->co_opcache_map[next_instr - first_instr]; \
+            assert(co_opcache_offset <= co->co_opcache_size); \
+            co->co_opcache_map[co_opcache_offset] = 0; \
+            co_opcache = NULL; \
+        } \
+    } while (0)
+
+#define OPCACHE_DEOPT_LOAD_ATTR() \
+    do { \
+        if (co_opcache != NULL) { \
+            OPCACHE_STAT_ATTR_DEOPT(); \
+            OPCACHE_DEOPT(); \
+        } \
+    } while (0)
+
+#define OPCACHE_MAYBE_DEOPT_LOAD_ATTR() \
+    do { \
+        if (co_opcache != NULL && --co_opcache->optimized <= 0) { \
+            OPCACHE_DEOPT_LOAD_ATTR(); \
+        } \
+    } while (0)
+
 #if OPCACHE_STATS
 
 #define OPCACHE_STAT_GLOBAL_HIT() \
@@ -1241,24 +1533,99 @@
         if (co->co_opcache != NULL) opcache_global_opts++; \
     } while (0)
 
+#define OPCACHE_STAT_ATTR_HIT() \
+    do { \
+        if (co->co_opcache != NULL) opcache_attr_hits++; \
+    } while (0)
+
+#define OPCACHE_STAT_ATTR_MISS() \
+    do { \
+        if (co->co_opcache != NULL) opcache_attr_misses++; \
+    } while (0)
+
+#define OPCACHE_STAT_ATTR_OPT() \
+    do { \
+        if (co->co_opcache!= NULL) opcache_attr_opts++; \
+    } while (0)
+
+#define OPCACHE_STAT_ATTR_DEOPT() \
+    do { \
+        if (co->co_opcache != NULL) opcache_attr_deopts++; \
+    } while (0)
+
+#define OPCACHE_STAT_ATTR_TOTAL() \
+    do { \
+        if (co->co_opcache != NULL) opcache_attr_total++; \
+    } while (0)
+
 #else /* OPCACHE_STATS */
 
 #define OPCACHE_STAT_GLOBAL_HIT()
 #define OPCACHE_STAT_GLOBAL_MISS()
 #define OPCACHE_STAT_GLOBAL_OPT()
 
+#define OPCACHE_STAT_ATTR_HIT()
+#define OPCACHE_STAT_ATTR_MISS()
+#define OPCACHE_STAT_ATTR_OPT()
+#define OPCACHE_STAT_ATTR_DEOPT()
+#define OPCACHE_STAT_ATTR_TOTAL()
+
 #endif
 
-/* Start of code */
 
-    /* push frame */
+PyObject* _Py_HOT_FUNCTION
+_PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag)
+{
+    _Py_EnsureTstateNotNULL(tstate);
+
+#if USE_COMPUTED_GOTOS
+/* Import the static jump table */
+#include "opcode_targets.h"
+#endif
+
+#ifdef DXPAIRS
+    int lastopcode = 0;
+#endif
+    PyObject **stack_pointer;  /* Next free slot in value stack */
+    const _Py_CODEUNIT *next_instr;
+    int opcode;        /* Current opcode */
+    int oparg;         /* Current opcode argument, if any */
+    PyObject **fastlocals, **freevars;
+    PyObject *retval = NULL;            /* Return value */
+    _Py_atomic_int * const eval_breaker = &tstate->interp->ceval.eval_breaker;
+    PyCodeObject *co;
+
+    const _Py_CODEUNIT *first_instr;
+    PyObject *names;
+    PyObject *consts;
+    _PyOpcache *co_opcache;
+
+#ifdef LLTRACE
+    _Py_IDENTIFIER(__ltrace__);
+#endif
+
     if (_Py_EnterRecursiveCall(tstate, "")) {
         return NULL;
     }
 
-    tstate->frame = f;
+    PyTraceInfo trace_info;
+    /* Mark trace_info as uninitialized */
+    trace_info.code = NULL;
 
-    if (tstate->use_tracing) {
+    /* WARNING: Because the CFrame lives on the C stack,
+     * but can be accessed from a heap allocated object (tstate)
+     * strict stack discipline must be maintained.
+     */
+    CFrame *prev_cframe = tstate->cframe;
+    trace_info.cframe.use_tracing = prev_cframe->use_tracing;
+    trace_info.cframe.previous = prev_cframe;
+    tstate->cframe = &trace_info.cframe;
+
+    /* push frame */
+    tstate->frame = f;
+    co = f->f_code;
+
+    if (trace_info.cframe.use_tracing) {
         if (tstate->c_tracefunc != NULL) {
             /* tstate->c_tracefunc, if defined, is a
                function that will be called on *every* entry
@@ -1275,7 +1642,8 @@
                whenever an exception is detected. */
             if (call_trace_protected(tstate->c_tracefunc,
                                      tstate->c_traceobj,
-                                     tstate, f, PyTrace_CALL, Py_None)) {
+                                     tstate, f, &trace_info,
+                                     PyTrace_CALL, Py_None)) {
                 /* Trace function raised an error */
                 goto exit_eval_frame;
             }
@@ -1285,7 +1653,8 @@
                return itself and isn't called for "line" events */
             if (call_trace_protected(tstate->c_profilefunc,
                                      tstate->c_profileobj,
-                                     tstate, f, PyTrace_CALL, Py_None)) {
+                                     tstate, f, &trace_info,
+                                     PyTrace_CALL, Py_None)) {
                 /* Profile function raised an error */
                 goto exit_eval_frame;
             }
@@ -1295,7 +1664,6 @@
     if (PyDTrace_FUNCTION_ENTRY_ENABLED())
         dtrace_function_entry(f);
 
-    co = f->f_code;
     names = co->co_names;
     consts = co->co_consts;
     fastlocals = f->f_localsplus;
@@ -1321,19 +1689,20 @@
        to the beginning of the combined pair.)
     */
     assert(f->f_lasti >= -1);
-    next_instr = first_instr;
-    if (f->f_lasti >= 0) {
-        assert(f->f_lasti % sizeof(_Py_CODEUNIT) == 0);
-        next_instr += f->f_lasti / sizeof(_Py_CODEUNIT) + 1;
-    }
-    stack_pointer = f->f_stacktop;
-    assert(stack_pointer != NULL);
-    f->f_stacktop = NULL;       /* remains NULL unless yield suspends frame */
-    f->f_executing = 1;
+    next_instr = first_instr + f->f_lasti + 1;
+    stack_pointer = f->f_valuestack + f->f_stackdepth;
+    /* Set f->f_stackdepth to -1.
+     * Update when returning or calling trace function.
+       Having f_stackdepth <= 0 ensures that invalid
+       values are not visible to the cycle GC.
+       We choose -1 rather than 0 to assist debugging.
+     */
+    f->f_stackdepth = -1;
+    f->f_state = FRAME_EXECUTING;
 
-    if (co->co_opcache_flag < OPCACHE_MIN_RUNS) {
+    if (co->co_opcache_flag < opcache_min_runs) {
         co->co_opcache_flag++;
-        if (co->co_opcache_flag == OPCACHE_MIN_RUNS) {
+        if (co->co_opcache_flag == opcache_min_runs) {
             if (_PyCode_InitOpcache(co) < 0) {
                 goto exit_eval_frame;
             }
@@ -1347,11 +1716,18 @@
     }
 
 #ifdef LLTRACE
-    lltrace = _PyDict_GetItemId(f->f_globals, &PyId___ltrace__) != NULL;
+    {
+        int r = _PyDict_ContainsId(f->f_globals, &PyId___ltrace__);
+        if (r < 0) {
+            goto exit_eval_frame;
+        }
+        lltrace = r;
+    }
 #endif
 
-    if (throwflag) /* support for generator.throw() */
+    if (throwflag) { /* support for generator.throw() */
         goto error;
+    }
 
 #ifdef Py_DEBUG
     /* _PyEval_EvalFrameDefault() must not be called with an exception set,
@@ -1376,10 +1752,10 @@
 
         if (_Py_atomic_load_relaxed(eval_breaker)) {
             opcode = _Py_OPCODE(*next_instr);
-            if (opcode == SETUP_FINALLY ||
-                opcode == SETUP_WITH ||
-                opcode == BEFORE_ASYNC_WITH ||
-                opcode == YIELD_FROM) {
+            if (opcode != SETUP_FINALLY &&
+                opcode != SETUP_WITH &&
+                opcode != BEFORE_ASYNC_WITH &&
+                opcode != YIELD_FROM) {
                 /* Few cases where we skip running signal handlers and other
                    pending calls:
                    - If we're about to enter the 'with:'. It will prevent
@@ -1396,55 +1772,45 @@
                      running the signal handler and raising KeyboardInterrupt
                      (see bpo-30039).
                 */
-                goto fast_next_opcode;
-            }
-
-            if (eval_frame_handle_pending(tstate) != 0) {
-                goto error;
-            }
+                if (eval_frame_handle_pending(tstate) != 0) {
+                    goto error;
+                }
+             }
         }
 
-    fast_next_opcode:
+    tracing_dispatch:
+    {
+        int instr_prev = f->f_lasti;
         f->f_lasti = INSTR_OFFSET();
+        NEXTOPARG();
 
         if (PyDTrace_LINE_ENABLED())
-            maybe_dtrace_line(f, &instr_lb, &instr_ub, &instr_prev);
+            maybe_dtrace_line(f, &trace_info, instr_prev);
 
         /* line-by-line tracing support */
 
-        if (_Py_TracingPossible(ceval2) &&
+        if (trace_info.cframe.use_tracing &&
             tstate->c_tracefunc != NULL && !tstate->tracing) {
             int err;
-            /* see maybe_call_line_trace
+            /* see maybe_call_line_trace()
                for expository comments */
-            f->f_stacktop = stack_pointer;
+            f->f_stackdepth = (int)(stack_pointer - f->f_valuestack);
 
             err = maybe_call_line_trace(tstate->c_tracefunc,
                                         tstate->c_traceobj,
                                         tstate, f,
-                                        &instr_lb, &instr_ub, &instr_prev);
+                                        &trace_info, instr_prev);
             /* Reload possibly changed frame fields */
             JUMPTO(f->f_lasti);
-            if (f->f_stacktop != NULL) {
-                stack_pointer = f->f_stacktop;
-                f->f_stacktop = NULL;
-            }
-            if (err)
+            stack_pointer = f->f_valuestack+f->f_stackdepth;
+            f->f_stackdepth = -1;
+            if (err) {
                 /* trace function raised an exception */
                 goto error;
+            }
+            NEXTOPARG();
         }
-
-        /* Extract opcode and argument */
-
-        NEXTOPARG();
-    dispatch_opcode:
-#ifdef DYNAMIC_EXECUTION_PROFILE
-#ifdef DXPAIRS
-        dxpairs[lastopcode][opcode]++;
-        lastopcode = opcode;
-#endif
-        dxp[opcode]++;
-#endif
+    }
 
 #ifdef LLTRACE
         /* Instruction tracing */
@@ -1460,15 +1826,33 @@
             }
         }
 #endif
+#if USE_COMPUTED_GOTOS == 0
+    goto dispatch_opcode;
+
+    predispatch:
+        if (trace_info.cframe.use_tracing OR_DTRACE_LINE OR_LLTRACE) {
+            goto tracing_dispatch;
+        }
+        f->f_lasti = INSTR_OFFSET();
+        NEXTOPARG();
+#endif
+    dispatch_opcode:
+#ifdef DYNAMIC_EXECUTION_PROFILE
+#ifdef DXPAIRS
+        dxpairs[lastopcode][opcode]++;
+        lastopcode = opcode;
+#endif
+        dxp[opcode]++;
+#endif
 
         switch (opcode) {
 
         /* BEWARE!
            It is essential that any operation that fails must goto error
-           and that all operation that succeed call [FAST_]DISPATCH() ! */
+           and that all operation that succeed call DISPATCH() ! */
 
         case TARGET(NOP): {
-            FAST_DISPATCH();
+            DISPATCH();
         }
 
         case TARGET(LOAD_FAST): {
@@ -1481,7 +1865,7 @@
             }
             Py_INCREF(value);
             PUSH(value);
-            FAST_DISPATCH();
+            DISPATCH();
         }
 
         case TARGET(LOAD_CONST): {
@@ -1489,20 +1873,20 @@
             PyObject *value = GETITEM(consts, oparg);
             Py_INCREF(value);
             PUSH(value);
-            FAST_DISPATCH();
+            DISPATCH();
         }
 
         case TARGET(STORE_FAST): {
             PREDICTED(STORE_FAST);
             PyObject *value = POP();
             SETLOCAL(oparg, value);
-            FAST_DISPATCH();
+            DISPATCH();
         }
 
         case TARGET(POP_TOP): {
             PyObject *value = POP();
             Py_DECREF(value);
-            FAST_DISPATCH();
+            DISPATCH();
         }
 
         case TARGET(ROT_TWO): {
@@ -1510,7 +1894,7 @@
             PyObject *second = SECOND();
             SET_TOP(second);
             SET_SECOND(top);
-            FAST_DISPATCH();
+            DISPATCH();
         }
 
         case TARGET(ROT_THREE): {
@@ -1520,7 +1904,7 @@
             SET_TOP(second);
             SET_SECOND(third);
             SET_THIRD(top);
-            FAST_DISPATCH();
+            DISPATCH();
         }
 
         case TARGET(ROT_FOUR): {
@@ -1532,14 +1916,14 @@
             SET_SECOND(third);
             SET_THIRD(fourth);
             SET_FOURTH(top);
-            FAST_DISPATCH();
+            DISPATCH();
         }
 
         case TARGET(DUP_TOP): {
             PyObject *top = TOP();
             Py_INCREF(top);
             PUSH(top);
-            FAST_DISPATCH();
+            DISPATCH();
         }
 
         case TARGET(DUP_TOP_TWO): {
@@ -1550,7 +1934,7 @@
             STACK_GROW(2);
             SET_TOP(top);
             SET_SECOND(second);
-            FAST_DISPATCH();
+            DISPATCH();
         }
 
         case TARGET(UNARY_POSITIVE): {
@@ -1685,7 +2069,7 @@
             PyObject *right = POP();
             PyObject *left = TOP();
             PyObject *sum;
-            /* NOTE(haypo): Please don't try to micro-optimize int+int on
+            /* NOTE(vstinner): Please don't try to micro-optimize int+int on
                CPython using bytecode, it is simply worthless.
                See http://bugs.python.org/issue21955 and
                http://bugs.python.org/issue10044 for the discussion. In short,
@@ -2053,6 +2437,8 @@
             retval = POP();
             assert(f->f_iblock == 0);
             assert(EMPTY());
+            f->f_state = FRAME_RETURNED;
+            f->f_stackdepth = 0;
             goto exiting;
         }
 
@@ -2195,34 +2581,52 @@
         case TARGET(YIELD_FROM): {
             PyObject *v = POP();
             PyObject *receiver = TOP();
-            int err;
-            if (PyGen_CheckExact(receiver) || PyCoro_CheckExact(receiver)) {
-                retval = _PyGen_Send((PyGenObject *)receiver, v);
+            PySendResult gen_status;
+            if (tstate->c_tracefunc == NULL) {
+                gen_status = PyIter_Send(receiver, v, &retval);
             } else {
                 _Py_IDENTIFIER(send);
-                if (v == Py_None)
+                if (Py_IsNone(v) && PyIter_Check(receiver)) {
                     retval = Py_TYPE(receiver)->tp_iternext(receiver);
-                else
+                }
+                else {
                     retval = _PyObject_CallMethodIdOneArg(receiver, &PyId_send, v);
+                }
+                if (retval == NULL) {
+                    if (tstate->c_tracefunc != NULL
+                            && _PyErr_ExceptionMatches(tstate, PyExc_StopIteration))
+                        call_exc_trace(tstate->c_tracefunc, tstate->c_traceobj, tstate, f, &trace_info);
+                    if (_PyGen_FetchStopIterationValue(&retval) == 0) {
+                        gen_status = PYGEN_RETURN;
+                    }
+                    else {
+                        gen_status = PYGEN_ERROR;
+                    }
+                }
+                else {
+                    gen_status = PYGEN_NEXT;
+                }
             }
             Py_DECREF(v);
-            if (retval == NULL) {
-                PyObject *val;
-                if (tstate->c_tracefunc != NULL
-                        && _PyErr_ExceptionMatches(tstate, PyExc_StopIteration))
-                    call_exc_trace(tstate->c_tracefunc, tstate->c_traceobj, tstate, f);
-                err = _PyGen_FetchStopIterationValue(&val);
-                if (err < 0)
-                    goto error;
+            if (gen_status == PYGEN_ERROR) {
+                assert (retval == NULL);
+                goto error;
+            }
+            if (gen_status == PYGEN_RETURN) {
+                assert (retval != NULL);
+
                 Py_DECREF(receiver);
-                SET_TOP(val);
+                SET_TOP(retval);
+                retval = NULL;
                 DISPATCH();
             }
+            assert (gen_status == PYGEN_NEXT);
             /* receiver remains on stack, retval is value to be yielded */
-            f->f_stacktop = stack_pointer;
             /* and repeat... */
-            assert(f->f_lasti >= (int)sizeof(_Py_CODEUNIT));
-            f->f_lasti -= sizeof(_Py_CODEUNIT);
+            assert(f->f_lasti > 0);
+            f->f_lasti -= 1;
+            f->f_state = FRAME_SUSPENDED;
+            f->f_stackdepth = (int)(stack_pointer - f->f_valuestack);
             goto exiting;
         }
 
@@ -2238,11 +2642,19 @@
                 }
                 retval = w;
             }
-
-            f->f_stacktop = stack_pointer;
+            f->f_state = FRAME_SUSPENDED;
+            f->f_stackdepth = (int)(stack_pointer - f->f_valuestack);
             goto exiting;
         }
 
+        case TARGET(GEN_START): {
+            PyObject *none = POP();
+            assert(none == Py_None);
+            assert(oparg < 3);
+            Py_DECREF(none);
+            DISPATCH();
+        }
+
         case TARGET(POP_EXCEPT): {
             PyObject *type, *value, *traceback;
             _PyErr_StackItem *exc_info;
@@ -2268,12 +2680,15 @@
         }
 
         case TARGET(POP_BLOCK): {
-            PREDICTED(POP_BLOCK);
             PyFrame_BlockPop(f);
             DISPATCH();
         }
 
         case TARGET(RERAISE): {
+            assert(f->f_iblock > 0);
+            if (oparg) {
+                f->f_lasti = f->f_blockstack[f->f_iblock-1].b_handler;
+            }
             PyObject *exc = POP();
             PyObject *val = POP();
             PyObject *tb = POP();
@@ -2292,7 +2707,7 @@
                 UNWIND_EXCEPT_HANDLER(b);
                 Py_DECREF(POP());
                 JUMPBY(oparg);
-                FAST_DISPATCH();
+                DISPATCH();
             }
             else {
                 PyObject *val = POP();
@@ -2306,7 +2721,7 @@
             PyObject *value = PyExc_AssertionError;
             Py_INCREF(value);
             PUSH(value);
-            FAST_DISPATCH();
+            DISPATCH();
         }
 
         case TARGET(LOAD_BUILD_CLASS): {
@@ -2569,7 +2984,7 @@
                                        (PyDictObject *)f->f_builtins,
                                        name);
                 if (v == NULL) {
-                    if (!_PyErr_OCCURRED()) {
+                    if (!_PyErr_Occurred(tstate)) {
                         /* _PyDict_LoadGlobal() returns NULL without raising
                          * an exception if the key doesn't exist */
                         format_exc_check_arg(tstate, PyExc_NameError,
@@ -2991,7 +3406,190 @@
         case TARGET(LOAD_ATTR): {
             PyObject *name = GETITEM(names, oparg);
             PyObject *owner = TOP();
-            PyObject *res = PyObject_GetAttr(owner, name);
+
+            PyTypeObject *type = Py_TYPE(owner);
+            PyObject *res;
+            PyObject **dictptr;
+            PyObject *dict;
+            _PyOpCodeOpt_LoadAttr *la;
+
+            OPCACHE_STAT_ATTR_TOTAL();
+
+            OPCACHE_CHECK();
+            if (co_opcache != NULL && PyType_HasFeature(type, Py_TPFLAGS_VALID_VERSION_TAG))
+            {
+                if (co_opcache->optimized > 0) {
+                    // Fast path -- cache hit makes LOAD_ATTR ~30% faster.
+                    la = &co_opcache->u.la;
+                    if (la->type == type && la->tp_version_tag == type->tp_version_tag)
+                    {
+                        // Hint >= 0 is a dict index; hint == -1 is a dict miss.
+                        // Hint < -1 is an inverted slot offset: offset is strictly > 0,
+                        // so ~offset is strictly < -1 (assuming 2's complement).
+                        if (la->hint < -1) {
+                            // Even faster path -- slot hint.
+                            Py_ssize_t offset = ~la->hint;
+                            // fprintf(stderr, "Using hint for offset %zd\n", offset);
+                            char *addr = (char *)owner + offset;
+                            res = *(PyObject **)addr;
+                            if (res != NULL) {
+                                Py_INCREF(res);
+                                SET_TOP(res);
+                                Py_DECREF(owner);
+                                DISPATCH();
+                            }
+                            // Else slot is NULL.  Fall through to slow path to raise AttributeError(name).
+                            // Don't DEOPT, since the slot is still there.
+                        } else {
+                            // Fast path for dict.
+                            assert(type->tp_dict != NULL);
+                            assert(type->tp_dictoffset > 0);
+
+                            dictptr = (PyObject **) ((char *)owner + type->tp_dictoffset);
+                            dict = *dictptr;
+                            if (dict != NULL && PyDict_CheckExact(dict)) {
+                                Py_ssize_t hint = la->hint;
+                                Py_INCREF(dict);
+                                res = NULL;
+                                assert(!_PyErr_Occurred(tstate));
+                                la->hint = _PyDict_GetItemHint((PyDictObject*)dict, name, hint, &res);
+                                if (res != NULL) {
+                                    assert(la->hint >= 0);
+                                    if (la->hint == hint && hint >= 0) {
+                                        // Our hint has helped -- cache hit.
+                                        OPCACHE_STAT_ATTR_HIT();
+                                    } else {
+                                        // The hint we provided didn't work.
+                                        // Maybe next time?
+                                        OPCACHE_MAYBE_DEOPT_LOAD_ATTR();
+                                    }
+
+                                    Py_INCREF(res);
+                                    SET_TOP(res);
+                                    Py_DECREF(owner);
+                                    Py_DECREF(dict);
+                                    DISPATCH();
+                                }
+                                else {
+                                    _PyErr_Clear(tstate);
+                                    // This attribute can be missing sometimes;
+                                    // we don't want to optimize this lookup.
+                                    OPCACHE_DEOPT_LOAD_ATTR();
+                                    Py_DECREF(dict);
+                                }
+                            }
+                            else {
+                                // There is no dict, or __dict__ doesn't satisfy PyDict_CheckExact.
+                                OPCACHE_DEOPT_LOAD_ATTR();
+                            }
+                        }
+                    }
+                    else {
+                        // The type of the object has either been updated,
+                        // or is different.  Maybe it will stabilize?
+                        OPCACHE_MAYBE_DEOPT_LOAD_ATTR();
+                    }
+                    OPCACHE_STAT_ATTR_MISS();
+                }
+
+                if (co_opcache != NULL && // co_opcache can be NULL after a DEOPT() call.
+                    type->tp_getattro == PyObject_GenericGetAttr)
+                {
+                    if (type->tp_dict == NULL) {
+                        if (PyType_Ready(type) < 0) {
+                            Py_DECREF(owner);
+                            SET_TOP(NULL);
+                            goto error;
+                        }
+                    }
+                    PyObject *descr = _PyType_Lookup(type, name);
+                    if (descr != NULL) {
+                        // We found an attribute with a data-like descriptor.
+                        PyTypeObject *dtype = Py_TYPE(descr);
+                        if (dtype == &PyMemberDescr_Type) {  // It's a slot
+                            PyMemberDescrObject *member = (PyMemberDescrObject *)descr;
+                            struct PyMemberDef *dmem = member->d_member;
+                            if (dmem->type == T_OBJECT_EX) {
+                                Py_ssize_t offset = dmem->offset;
+                                assert(offset > 0);  // 0 would be confused with dict hint == -1 (miss).
+
+                                if (co_opcache->optimized == 0) {
+                                    // First time we optimize this opcode.
+                                    OPCACHE_STAT_ATTR_OPT();
+                                    co_opcache->optimized = OPCODE_CACHE_MAX_TRIES;
+                                    // fprintf(stderr, "Setting hint for %s, offset %zd\n", dmem->name, offset);
+                                }
+
+                                la = &co_opcache->u.la;
+                                la->type = type;
+                                la->tp_version_tag = type->tp_version_tag;
+                                la->hint = ~offset;
+
+                                char *addr = (char *)owner + offset;
+                                res = *(PyObject **)addr;
+                                if (res != NULL) {
+                                    Py_INCREF(res);
+                                    Py_DECREF(owner);
+                                    SET_TOP(res);
+
+                                    DISPATCH();
+                                }
+                                // Else slot is NULL.  Fall through to slow path to raise AttributeError(name).
+                            }
+                            // Else it's a slot of a different type.  We don't handle those.
+                        }
+                        // Else it's some other kind of descriptor that we don't handle.
+                        OPCACHE_DEOPT_LOAD_ATTR();
+                    }
+                    else if (type->tp_dictoffset > 0) {
+                        // We found an instance with a __dict__.
+                        dictptr = (PyObject **) ((char *)owner + type->tp_dictoffset);
+                        dict = *dictptr;
+
+                        if (dict != NULL && PyDict_CheckExact(dict)) {
+                            Py_INCREF(dict);
+                            res = NULL;
+                            assert(!_PyErr_Occurred(tstate));
+                            Py_ssize_t hint = _PyDict_GetItemHint((PyDictObject*)dict, name, -1, &res);
+                            if (res != NULL) {
+                                Py_INCREF(res);
+                                Py_DECREF(dict);
+                                Py_DECREF(owner);
+                                SET_TOP(res);
+
+                                if (co_opcache->optimized == 0) {
+                                    // First time we optimize this opcode.
+                                    OPCACHE_STAT_ATTR_OPT();
+                                    co_opcache->optimized = OPCODE_CACHE_MAX_TRIES;
+                                }
+
+                                la = &co_opcache->u.la;
+                                la->type = type;
+                                la->tp_version_tag = type->tp_version_tag;
+                                assert(hint >= 0);
+                                la->hint = hint;
+
+                                DISPATCH();
+                            }
+                            else {
+                                _PyErr_Clear(tstate);
+                            }
+                            Py_DECREF(dict);
+                        } else {
+                            // There is no dict, or __dict__ doesn't satisfy PyDict_CheckExact.
+                            OPCACHE_DEOPT_LOAD_ATTR();
+                        }
+                    } else {
+                        // The object's class does not have a tp_dictoffset we can use.
+                        OPCACHE_DEOPT_LOAD_ATTR();
+                    }
+                } else if (type->tp_getattro != PyObject_GenericGetAttr) {
+                    OPCACHE_DEOPT_LOAD_ATTR();
+                }
+            }
+
+            // Slow path.
+            res = PyObject_GetAttr(owner, name);
             Py_DECREF(owner);
             SET_TOP(res);
             if (res == NULL)
@@ -3017,7 +3615,7 @@
         case TARGET(IS_OP): {
             PyObject *right = POP();
             PyObject *left = TOP();
-            int res = (left == right)^oparg;
+            int res = Py_Is(left, right) ^ oparg;
             PyObject *b = res ? Py_True : Py_False;
             Py_INCREF(b);
             SET_TOP(b);
@@ -3025,7 +3623,7 @@
             Py_DECREF(right);
             PREDICT(POP_JUMP_IF_FALSE);
             PREDICT(POP_JUMP_IF_TRUE);
-            FAST_DISPATCH();
+            DISPATCH();
         }
 
         case TARGET(CONTAINS_OP): {
@@ -3042,7 +3640,7 @@
             PUSH(b);
             PREDICT(POP_JUMP_IF_FALSE);
             PREDICT(POP_JUMP_IF_TRUE);
-            FAST_DISPATCH();
+            DISPATCH();
         }
 
 #define CANNOT_CATCH_MSG "catching classes that do not inherit from "\
@@ -3139,28 +3737,31 @@
 
         case TARGET(JUMP_FORWARD): {
             JUMPBY(oparg);
-            FAST_DISPATCH();
+            DISPATCH();
         }
 
         case TARGET(POP_JUMP_IF_FALSE): {
             PREDICTED(POP_JUMP_IF_FALSE);
             PyObject *cond = POP();
             int err;
-            if (cond == Py_True) {
+            if (Py_IsTrue(cond)) {
                 Py_DECREF(cond);
-                FAST_DISPATCH();
+                DISPATCH();
             }
-            if (cond == Py_False) {
+            if (Py_IsFalse(cond)) {
                 Py_DECREF(cond);
                 JUMPTO(oparg);
-                FAST_DISPATCH();
+                CHECK_EVAL_BREAKER();
+                DISPATCH();
             }
             err = PyObject_IsTrue(cond);
             Py_DECREF(cond);
             if (err > 0)
                 ;
-            else if (err == 0)
+            else if (err == 0) {
                 JUMPTO(oparg);
+                CHECK_EVAL_BREAKER();
+            }
             else
                 goto error;
             DISPATCH();
@@ -3170,19 +3771,21 @@
             PREDICTED(POP_JUMP_IF_TRUE);
             PyObject *cond = POP();
             int err;
-            if (cond == Py_False) {
+            if (Py_IsFalse(cond)) {
                 Py_DECREF(cond);
-                FAST_DISPATCH();
+                DISPATCH();
             }
-            if (cond == Py_True) {
+            if (Py_IsTrue(cond)) {
                 Py_DECREF(cond);
                 JUMPTO(oparg);
-                FAST_DISPATCH();
+                CHECK_EVAL_BREAKER();
+                DISPATCH();
             }
             err = PyObject_IsTrue(cond);
             Py_DECREF(cond);
             if (err > 0) {
                 JUMPTO(oparg);
+                CHECK_EVAL_BREAKER();
             }
             else if (err == 0)
                 ;
@@ -3194,14 +3797,14 @@
         case TARGET(JUMP_IF_FALSE_OR_POP): {
             PyObject *cond = TOP();
             int err;
-            if (cond == Py_True) {
+            if (Py_IsTrue(cond)) {
                 STACK_SHRINK(1);
                 Py_DECREF(cond);
-                FAST_DISPATCH();
+                DISPATCH();
             }
-            if (cond == Py_False) {
+            if (Py_IsFalse(cond)) {
                 JUMPTO(oparg);
-                FAST_DISPATCH();
+                DISPATCH();
             }
             err = PyObject_IsTrue(cond);
             if (err > 0) {
@@ -3218,14 +3821,14 @@
         case TARGET(JUMP_IF_TRUE_OR_POP): {
             PyObject *cond = TOP();
             int err;
-            if (cond == Py_False) {
+            if (Py_IsFalse(cond)) {
                 STACK_SHRINK(1);
                 Py_DECREF(cond);
-                FAST_DISPATCH();
+                DISPATCH();
             }
-            if (cond == Py_True) {
+            if (Py_IsTrue(cond)) {
                 JUMPTO(oparg);
-                FAST_DISPATCH();
+                DISPATCH();
             }
             err = PyObject_IsTrue(cond);
             if (err > 0) {
@@ -3243,18 +3846,110 @@
         case TARGET(JUMP_ABSOLUTE): {
             PREDICTED(JUMP_ABSOLUTE);
             JUMPTO(oparg);
-#if FAST_LOOPS
-            /* Enabling this path speeds-up all while and for-loops by bypassing
-               the per-loop checks for signals.  By default, this should be turned-off
-               because it prevents detection of a control-break in tight loops like
-               "while 1: pass".  Compile with this option turned-on when you need
-               the speed-up and do not need break checking inside tight loops (ones
-               that contain only instructions ending with FAST_DISPATCH).
-            */
-            FAST_DISPATCH();
-#else
+            CHECK_EVAL_BREAKER();
             DISPATCH();
-#endif
+        }
+
+        case TARGET(GET_LEN): {
+            // PUSH(len(TOS))
+            Py_ssize_t len_i = PyObject_Length(TOP());
+            if (len_i < 0) {
+                goto error;
+            }
+            PyObject *len_o = PyLong_FromSsize_t(len_i);
+            if (len_o == NULL) {
+                goto error;
+            }
+            PUSH(len_o);
+            DISPATCH();
+        }
+
+        case TARGET(MATCH_CLASS): {
+            // Pop TOS. On success, set TOS to True and TOS1 to a tuple of
+            // attributes. On failure, set TOS to False.
+            PyObject *names = POP();
+            PyObject *type = TOP();
+            PyObject *subject = SECOND();
+            assert(PyTuple_CheckExact(names));
+            PyObject *attrs = match_class(tstate, subject, type, oparg, names);
+            Py_DECREF(names);
+            if (attrs) {
+                // Success!
+                assert(PyTuple_CheckExact(attrs));
+                Py_DECREF(subject);
+                SET_SECOND(attrs);
+            }
+            else if (_PyErr_Occurred(tstate)) {
+                goto error;
+            }
+            Py_DECREF(type);
+            SET_TOP(PyBool_FromLong(!!attrs));
+            DISPATCH();
+        }
+
+        case TARGET(MATCH_MAPPING): {
+            PyObject *subject = TOP();
+            int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_MAPPING;
+            PyObject *res = match ? Py_True : Py_False;
+            Py_INCREF(res);
+            PUSH(res);
+            DISPATCH();
+        }
+
+        case TARGET(MATCH_SEQUENCE): {
+            PyObject *subject = TOP();
+            int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_SEQUENCE;
+            PyObject *res = match ? Py_True : Py_False;
+            Py_INCREF(res);
+            PUSH(res);
+            DISPATCH();
+        }
+
+        case TARGET(MATCH_KEYS): {
+            // On successful match for all keys, PUSH(values) and PUSH(True).
+            // Otherwise, PUSH(None) and PUSH(False).
+            PyObject *keys = TOP();
+            PyObject *subject = SECOND();
+            PyObject *values_or_none = match_keys(tstate, subject, keys);
+            if (values_or_none == NULL) {
+                goto error;
+            }
+            PUSH(values_or_none);
+            if (Py_IsNone(values_or_none)) {
+                Py_INCREF(Py_False);
+                PUSH(Py_False);
+                DISPATCH();
+            }
+            assert(PyTuple_CheckExact(values_or_none));
+            Py_INCREF(Py_True);
+            PUSH(Py_True);
+            DISPATCH();
+        }
+
+        case TARGET(COPY_DICT_WITHOUT_KEYS): {
+            // rest = dict(TOS1)
+            // for key in TOS:
+            //     del rest[key]
+            // SET_TOP(rest)
+            PyObject *keys = TOP();
+            PyObject *subject = SECOND();
+            PyObject *rest = PyDict_New();
+            if (rest == NULL || PyDict_Update(rest, subject)) {
+                Py_XDECREF(rest);
+                goto error;
+            }
+            // This may seem a bit inefficient, but keys is rarely big enough to
+            // actually impact runtime.
+            assert(PyTuple_CheckExact(keys));
+            for (Py_ssize_t i = 0; i < PyTuple_GET_SIZE(keys); i++) {
+                if (PyDict_DelItem(rest, PyTuple_GET_ITEM(keys, i))) {
+                    Py_DECREF(rest);
+                    goto error;
+                }
+            }
+            Py_DECREF(keys);
+            SET_TOP(rest);
+            DISPATCH();
         }
 
         case TARGET(GET_ITER): {
@@ -3315,7 +4010,7 @@
                     goto error;
                 }
                 else if (tstate->c_tracefunc != NULL) {
-                    call_exc_trace(tstate->c_tracefunc, tstate->c_traceobj, tstate, f);
+                    call_exc_trace(tstate->c_tracefunc, tstate->c_traceobj, tstate, f, &trace_info);
                 }
                 _PyErr_Clear(tstate);
             }
@@ -3323,7 +4018,6 @@
             STACK_SHRINK(1);
             Py_DECREF(iter);
             JUMPBY(oparg);
-            PREDICT(POP_BLOCK);
             DISPATCH();
         }
 
@@ -3412,7 +4106,7 @@
             exc = TOP();
             val = SECOND();
             tb = THIRD();
-            assert(exc != Py_None);
+            assert(!Py_IsNone(exc));
             assert(!PyLong_Check(exc));
             exit_func = PEEK(7);
             PyObject *stack[4] = {NULL, exc, val, tb};
@@ -3484,7 +4178,7 @@
                    `callable` will be POPed by call_function.
                    NULL will will be POPed manually later.
                 */
-                res = call_function(tstate, &sp, oparg, NULL);
+                res = call_function(tstate, &trace_info, &sp, oparg, NULL);
                 stack_pointer = sp;
                 (void)POP(); /* POP the NULL. */
             }
@@ -3501,13 +4195,14 @@
                   We'll be passing `oparg + 1` to call_function, to
                   make it accept the `self` as a first argument.
                 */
-                res = call_function(tstate, &sp, oparg + 1, NULL);
+                res = call_function(tstate, &trace_info, &sp, oparg + 1, NULL);
                 stack_pointer = sp;
             }
 
             PUSH(res);
             if (res == NULL)
                 goto error;
+            CHECK_EVAL_BREAKER();
             DISPATCH();
         }
 
@@ -3515,12 +4210,13 @@
             PREDICTED(CALL_FUNCTION);
             PyObject **sp, *res;
             sp = stack_pointer;
-            res = call_function(tstate, &sp, oparg, NULL);
+            res = call_function(tstate, &trace_info, &sp, oparg, NULL);
             stack_pointer = sp;
             PUSH(res);
             if (res == NULL) {
                 goto error;
             }
+            CHECK_EVAL_BREAKER();
             DISPATCH();
         }
 
@@ -3532,7 +4228,7 @@
             assert(PyTuple_GET_SIZE(names) <= oparg);
             /* We assume without checking that names contains only strings */
             sp = stack_pointer;
-            res = call_function(tstate, &sp, oparg, names);
+            res = call_function(tstate, &trace_info, &sp, oparg, names);
             stack_pointer = sp;
             PUSH(res);
             Py_DECREF(names);
@@ -3540,6 +4236,7 @@
             if (res == NULL) {
                 goto error;
             }
+            CHECK_EVAL_BREAKER();
             DISPATCH();
         }
 
@@ -3577,7 +4274,7 @@
             }
             assert(PyTuple_CheckExact(callargs));
 
-            result = do_call_core(tstate, func, callargs, kwargs);
+            result = do_call_core(tstate, &trace_info, func, callargs, kwargs);
             Py_DECREF(func);
             Py_DECREF(callargs);
             Py_XDECREF(kwargs);
@@ -3586,6 +4283,7 @@
             if (result == NULL) {
                 goto error;
             }
+            CHECK_EVAL_BREAKER();
             DISPATCH();
         }
 
@@ -3603,10 +4301,10 @@
 
             if (oparg & 0x08) {
                 assert(PyTuple_CheckExact(TOP()));
-                func ->func_closure = POP();
+                func->func_closure = POP();
             }
             if (oparg & 0x04) {
-                assert(PyDict_CheckExact(TOP()));
+                assert(PyTuple_CheckExact(TOP()));
                 func->func_annotations = POP();
             }
             if (oparg & 0x02) {
@@ -3700,6 +4398,14 @@
             DISPATCH();
         }
 
+        case TARGET(ROT_N): {
+            PyObject *top = TOP();
+            memmove(&PEEK(oparg - 1), &PEEK(oparg),
+                    sizeof(PyObject*) * (oparg - 1));
+            PEEK(oparg) = top;
+            DISPATCH();
+        }
+
         case TARGET(EXTENDED_ARG): {
             int oldoparg = oparg;
             NEXTOPARG();
@@ -3739,11 +4445,15 @@
         /* Log traceback info. */
         PyTraceBack_Here(f);
 
-        if (tstate->c_tracefunc != NULL)
+        if (tstate->c_tracefunc != NULL) {
+            /* Make sure state is set to FRAME_EXECUTING for tracing */
+            assert(f->f_state == FRAME_EXECUTING);
+            f->f_state = FRAME_UNWINDING;
             call_exc_trace(tstate->c_tracefunc, tstate->c_traceobj,
-                           tstate, f);
-
+                           tstate, f, &trace_info);
+        }
 exception_unwind:
+        f->f_state = FRAME_UNWINDING;
         /* Unwind stacks if an exception occurred */
         while (f->f_iblock > 0) {
             /* Pop the current block. */
@@ -3759,7 +4469,7 @@
                 int handler = b->b_handler;
                 _PyErr_StackItem *exc_info = tstate->exc_info;
                 /* Beware, this invalidates all b->b_* fields */
-                PyFrame_BlockSetup(f, EXCEPT_HANDLER, -1, STACK_LEVEL());
+                PyFrame_BlockSetup(f, EXCEPT_HANDLER, f->f_lasti, STACK_LEVEL());
                 PUSH(exc_info->exc_traceback);
                 PUSH(exc_info->exc_value);
                 if (exc_info->exc_type != NULL) {
@@ -3791,17 +4501,8 @@
                 PUSH(val);
                 PUSH(exc);
                 JUMPTO(handler);
-                if (_Py_TracingPossible(ceval2)) {
-                    int needs_new_execution_window = (f->f_lasti < instr_lb || f->f_lasti >= instr_ub);
-                    int needs_line_update = (f->f_lasti == instr_lb || f->f_lasti < instr_prev);
-                    /* Make sure that we trace line after exception if we are in a new execution
-                     * window or we don't need a line update and we are not in the first instruction
-                     * of the line. */
-                    if (needs_new_execution_window || (!needs_line_update && instr_lb > 0)) {
-                        instr_prev = INT_MAX;
-                    }
-                }
                 /* Resume normal execution */
+                f->f_state = FRAME_EXECUTING;
                 goto main_loop;
             }
         } /* unwind stack */
@@ -3818,18 +4519,19 @@
         PyObject *o = POP();
         Py_XDECREF(o);
     }
-
+    f->f_stackdepth = 0;
+    f->f_state = FRAME_RAISED;
 exiting:
-    if (tstate->use_tracing) {
+    if (trace_info.cframe.use_tracing) {
         if (tstate->c_tracefunc) {
             if (call_trace_protected(tstate->c_tracefunc, tstate->c_traceobj,
-                                     tstate, f, PyTrace_RETURN, retval)) {
+                                     tstate, f, &trace_info, PyTrace_RETURN, retval)) {
                 Py_CLEAR(retval);
             }
         }
         if (tstate->c_profilefunc) {
             if (call_trace_protected(tstate->c_profilefunc, tstate->c_profileobj,
-                                     tstate, f, PyTrace_RETURN, retval)) {
+                                     tstate, f, &trace_info, PyTrace_RETURN, retval)) {
                 Py_CLEAR(retval);
             }
         }
@@ -3837,10 +4539,13 @@
 
     /* pop frame */
 exit_eval_frame:
+    /* Restore previous cframe */
+    tstate->cframe = trace_info.cframe.previous;
+    tstate->cframe->use_tracing = trace_info.cframe.use_tracing;
+
     if (PyDTrace_FUNCTION_RETURN_ENABLED())
         dtrace_function_return(f);
     _Py_LeaveRecursiveCall(tstate);
-    f->f_executing = 0;
     tstate->frame = f->f_back;
 
     return _Py_CheckFunctionResult(tstate, NULL, retval, __func__);
@@ -3848,7 +4553,7 @@
 
 static void
 format_missing(PyThreadState *tstate, const char *kind,
-               PyCodeObject *co, PyObject *names)
+               PyCodeObject *co, PyObject *names, PyObject *qualname)
 {
     int err;
     Py_ssize_t len = PyList_GET_SIZE(names);
@@ -3901,7 +4606,7 @@
         return;
     _PyErr_Format(tstate, PyExc_TypeError,
                   "%U() missing %i required %s argument%s: %U",
-                  co->co_name,
+                  qualname,
                   len,
                   kind,
                   len == 1 ? "" : "s",
@@ -3912,7 +4617,7 @@
 static void
 missing_arguments(PyThreadState *tstate, PyCodeObject *co,
                   Py_ssize_t missing, Py_ssize_t defcount,
-                  PyObject **fastlocals)
+                  PyObject **fastlocals, PyObject *qualname)
 {
     Py_ssize_t i, j = 0;
     Py_ssize_t start, end;
@@ -3944,14 +4649,14 @@
         }
     }
     assert(j == missing);
-    format_missing(tstate, kind, co, missing_names);
+    format_missing(tstate, kind, co, missing_names, qualname);
     Py_DECREF(missing_names);
 }
 
 static void
 too_many_positional(PyThreadState *tstate, PyCodeObject *co,
-                    Py_ssize_t given, Py_ssize_t defcount,
-                    PyObject **fastlocals)
+                    Py_ssize_t given, PyObject *defaults,
+                    PyObject **fastlocals, PyObject *qualname)
 {
     int plural;
     Py_ssize_t kwonly_given = 0;
@@ -3966,6 +4671,7 @@
             kwonly_given++;
         }
     }
+    Py_ssize_t defcount = defaults == NULL ? 0 : PyTuple_GET_SIZE(defaults);
     if (defcount) {
         Py_ssize_t atleast = co_argcount - defcount;
         plural = 1;
@@ -3995,7 +4701,7 @@
     }
     _PyErr_Format(tstate, PyExc_TypeError,
                   "%U() takes %U positional argument%s but %zd%U %s given",
-                  co->co_name,
+                  qualname,
                   sig,
                   plural ? "s" : "",
                   given,
@@ -4007,7 +4713,8 @@
 
 static int
 positional_only_passed_as_keyword(PyThreadState *tstate, PyCodeObject *co,
-                                  Py_ssize_t kwcount, PyObject* const* kwnames)
+                                  Py_ssize_t kwcount, PyObject* kwnames,
+                                  PyObject *qualname)
 {
     int posonly_conflicts = 0;
     PyObject* posonly_names = PyList_New(0);
@@ -4017,7 +4724,7 @@
 
         for (int k2=0; k2<kwcount; k2++){
             /* Compare the pointers first and fallback to PyObject_RichCompareBool*/
-            PyObject* kwname = kwnames[k2];
+            PyObject* kwname = PyTuple_GET_ITEM(kwnames, k2);
             if (kwname == posonly_name){
                 if(PyList_Append(posonly_names, kwname) != 0) {
                     goto fail;
@@ -4052,7 +4759,7 @@
         _PyErr_Format(tstate, PyExc_TypeError,
                       "%U() got some positional-only arguments passed"
                       " as keyword arguments: '%U'",
-                      co->co_name, error_names);
+                      qualname, error_names);
         Py_DECREF(error_names);
         goto fail;
     }
@@ -4066,46 +4773,30 @@
 
 }
 
-/* This is gonna seem *real weird*, but if you put some other code between
-   PyEval_EvalFrame() and _PyEval_EvalFrameDefault() you will need to adjust
-   the test in the if statements in Misc/gdbinit (pystack and pystackv). */
 
-PyObject *
-_PyEval_EvalCode(PyThreadState *tstate,
-           PyObject *_co, PyObject *globals, PyObject *locals,
+PyFrameObject *
+_PyEval_MakeFrameVector(PyThreadState *tstate,
+           PyFrameConstructor *con, PyObject *locals,
            PyObject *const *args, Py_ssize_t argcount,
-           PyObject *const *kwnames, PyObject *const *kwargs,
-           Py_ssize_t kwcount, int kwstep,
-           PyObject *const *defs, Py_ssize_t defcount,
-           PyObject *kwdefs, PyObject *closure,
-           PyObject *name, PyObject *qualname)
+           PyObject *kwnames)
 {
     assert(is_tstate_valid(tstate));
 
-    PyCodeObject* co = (PyCodeObject*)_co;
-    PyFrameObject *f;
-    PyObject *retval = NULL;
-    PyObject **fastlocals, **freevars;
-    PyObject *x, *u;
+    PyCodeObject *co = (PyCodeObject*)con->fc_code;
+    assert(con->fc_defaults == NULL || PyTuple_CheckExact(con->fc_defaults));
     const Py_ssize_t total_args = co->co_argcount + co->co_kwonlyargcount;
-    Py_ssize_t i, j, n;
-    PyObject *kwdict;
-
-    if (globals == NULL) {
-        _PyErr_SetString(tstate, PyExc_SystemError,
-                         "PyEval_EvalCodeEx: NULL globals");
-        return NULL;
-    }
 
     /* Create the frame */
-    f = _PyFrame_New_NoTrack(tstate, co, globals, locals);
+    PyFrameObject *f = _PyFrame_New_NoTrack(tstate, con, locals);
     if (f == NULL) {
         return NULL;
     }
-    fastlocals = f->f_localsplus;
-    freevars = f->f_localsplus + co->co_nlocals;
+    PyObject **fastlocals = f->f_localsplus;
+    PyObject **freevars = f->f_localsplus + co->co_nlocals;
 
     /* Create a dictionary for keyword parameters (**kwags) */
+    PyObject *kwdict;
+    Py_ssize_t i;
     if (co->co_flags & CO_VARKEYWORDS) {
         kwdict = PyDict_New();
         if (kwdict == NULL)
@@ -4121,6 +4812,7 @@
     }
 
     /* Copy all positional arguments into local variables */
+    Py_ssize_t j, n;
     if (argcount > co->co_argcount) {
         n = co->co_argcount;
     }
@@ -4128,97 +4820,102 @@
         n = argcount;
     }
     for (j = 0; j < n; j++) {
-        x = args[j];
+        PyObject *x = args[j];
         Py_INCREF(x);
         SETLOCAL(j, x);
     }
 
     /* Pack other positional arguments into the *args argument */
     if (co->co_flags & CO_VARARGS) {
-        u = _PyTuple_FromArray(args + n, argcount - n);
+        PyObject *u = _PyTuple_FromArray(args + n, argcount - n);
         if (u == NULL) {
             goto fail;
         }
         SETLOCAL(total_args, u);
     }
 
-    /* Handle keyword arguments passed as two strided arrays */
-    kwcount *= kwstep;
-    for (i = 0; i < kwcount; i += kwstep) {
-        PyObject **co_varnames;
-        PyObject *keyword = kwnames[i];
-        PyObject *value = kwargs[i];
-        Py_ssize_t j;
+    /* Handle keyword arguments */
+    if (kwnames != NULL) {
+        Py_ssize_t kwcount = PyTuple_GET_SIZE(kwnames);
+        for (i = 0; i < kwcount; i++) {
+            PyObject **co_varnames;
+            PyObject *keyword = PyTuple_GET_ITEM(kwnames, i);
+            PyObject *value = args[i+argcount];
+            Py_ssize_t j;
 
-        if (keyword == NULL || !PyUnicode_Check(keyword)) {
-            _PyErr_Format(tstate, PyExc_TypeError,
-                          "%U() keywords must be strings",
-                          co->co_name);
-            goto fail;
-        }
-
-        /* Speed hack: do raw pointer compares. As names are
-           normally interned this should almost always hit. */
-        co_varnames = ((PyTupleObject *)(co->co_varnames))->ob_item;
-        for (j = co->co_posonlyargcount; j < total_args; j++) {
-            PyObject *name = co_varnames[j];
-            if (name == keyword) {
-                goto kw_found;
-            }
-        }
-
-        /* Slow fallback, just in case */
-        for (j = co->co_posonlyargcount; j < total_args; j++) {
-            PyObject *name = co_varnames[j];
-            int cmp = PyObject_RichCompareBool( keyword, name, Py_EQ);
-            if (cmp > 0) {
-                goto kw_found;
-            }
-            else if (cmp < 0) {
-                goto fail;
-            }
-        }
-
-        assert(j >= total_args);
-        if (kwdict == NULL) {
-
-            if (co->co_posonlyargcount
-                && positional_only_passed_as_keyword(tstate, co,
-                                                     kwcount, kwnames))
-            {
+            if (keyword == NULL || !PyUnicode_Check(keyword)) {
+                _PyErr_Format(tstate, PyExc_TypeError,
+                            "%U() keywords must be strings",
+                          con->fc_qualname);
                 goto fail;
             }
 
-            _PyErr_Format(tstate, PyExc_TypeError,
-                          "%U() got an unexpected keyword argument '%S'",
-                          co->co_name, keyword);
-            goto fail;
-        }
+            /* Speed hack: do raw pointer compares. As names are
+            normally interned this should almost always hit. */
+            co_varnames = ((PyTupleObject *)(co->co_varnames))->ob_item;
+            for (j = co->co_posonlyargcount; j < total_args; j++) {
+                PyObject *varname = co_varnames[j];
+                if (varname == keyword) {
+                    goto kw_found;
+                }
+            }
 
-        if (PyDict_SetItem(kwdict, keyword, value) == -1) {
-            goto fail;
-        }
-        continue;
+            /* Slow fallback, just in case */
+            for (j = co->co_posonlyargcount; j < total_args; j++) {
+                PyObject *varname = co_varnames[j];
+                int cmp = PyObject_RichCompareBool( keyword, varname, Py_EQ);
+                if (cmp > 0) {
+                    goto kw_found;
+                }
+                else if (cmp < 0) {
+                    goto fail;
+                }
+            }
 
-      kw_found:
-        if (GETLOCAL(j) != NULL) {
-            _PyErr_Format(tstate, PyExc_TypeError,
-                          "%U() got multiple values for argument '%S'",
-                          co->co_name, keyword);
-            goto fail;
+            assert(j >= total_args);
+            if (kwdict == NULL) {
+
+                if (co->co_posonlyargcount
+                    && positional_only_passed_as_keyword(tstate, co,
+                                                        kwcount, kwnames,
+                                                     con->fc_qualname))
+                {
+                    goto fail;
+                }
+
+                _PyErr_Format(tstate, PyExc_TypeError,
+                            "%U() got an unexpected keyword argument '%S'",
+                          con->fc_qualname, keyword);
+                goto fail;
+            }
+
+            if (PyDict_SetItem(kwdict, keyword, value) == -1) {
+                goto fail;
+            }
+            continue;
+
+        kw_found:
+            if (GETLOCAL(j) != NULL) {
+                _PyErr_Format(tstate, PyExc_TypeError,
+                            "%U() got multiple values for argument '%S'",
+                          con->fc_qualname, keyword);
+                goto fail;
+            }
+            Py_INCREF(value);
+            SETLOCAL(j, value);
         }
-        Py_INCREF(value);
-        SETLOCAL(j, value);
     }
 
     /* Check the number of positional arguments */
     if ((argcount > co->co_argcount) && !(co->co_flags & CO_VARARGS)) {
-        too_many_positional(tstate, co, argcount, defcount, fastlocals);
+        too_many_positional(tstate, co, argcount, con->fc_defaults, fastlocals,
+                            con->fc_qualname);
         goto fail;
     }
 
     /* Add missing positional arguments (copy default values from defs) */
     if (argcount < co->co_argcount) {
+        Py_ssize_t defcount = con->fc_defaults == NULL ? 0 : PyTuple_GET_SIZE(con->fc_defaults);
         Py_ssize_t m = co->co_argcount - defcount;
         Py_ssize_t missing = 0;
         for (i = argcount; i < m; i++) {
@@ -4227,18 +4924,22 @@
             }
         }
         if (missing) {
-            missing_arguments(tstate, co, missing, defcount, fastlocals);
+            missing_arguments(tstate, co, missing, defcount, fastlocals,
+                              con->fc_qualname);
             goto fail;
         }
         if (n > m)
             i = n - m;
         else
             i = 0;
-        for (; i < defcount; i++) {
-            if (GETLOCAL(m+i) == NULL) {
-                PyObject *def = defs[i];
-                Py_INCREF(def);
-                SETLOCAL(m+i, def);
+        if (defcount) {
+            PyObject **defs = &PyTuple_GET_ITEM(con->fc_defaults, 0);
+            for (; i < defcount; i++) {
+                if (GETLOCAL(m+i) == NULL) {
+                    PyObject *def = defs[i];
+                    Py_INCREF(def);
+                    SETLOCAL(m+i, def);
+                }
             }
         }
     }
@@ -4247,12 +4948,11 @@
     if (co->co_kwonlyargcount > 0) {
         Py_ssize_t missing = 0;
         for (i = co->co_argcount; i < total_args; i++) {
-            PyObject *name;
             if (GETLOCAL(i) != NULL)
                 continue;
-            name = PyTuple_GET_ITEM(co->co_varnames, i);
-            if (kwdefs != NULL) {
-                PyObject *def = PyDict_GetItemWithError(kwdefs, name);
+            PyObject *varname = PyTuple_GET_ITEM(co->co_varnames, i);
+            if (con->fc_kwdefaults != NULL) {
+                PyObject *def = PyDict_GetItemWithError(con->fc_kwdefaults, varname);
                 if (def) {
                     Py_INCREF(def);
                     SETLOCAL(i, def);
@@ -4265,7 +4965,8 @@
             missing++;
         }
         if (missing) {
-            missing_arguments(tstate, co, missing, -1, fastlocals);
+            missing_arguments(tstate, co, missing, -1, fastlocals,
+                              con->fc_qualname);
             goto fail;
         }
     }
@@ -4292,39 +4993,12 @@
 
     /* Copy closure variables to free variables */
     for (i = 0; i < PyTuple_GET_SIZE(co->co_freevars); ++i) {
-        PyObject *o = PyTuple_GET_ITEM(closure, i);
+        PyObject *o = PyTuple_GET_ITEM(con->fc_closure, i);
         Py_INCREF(o);
         freevars[PyTuple_GET_SIZE(co->co_cellvars) + i] = o;
     }
 
-    /* Handle generator/coroutine/asynchronous generator */
-    if (co->co_flags & (CO_GENERATOR | CO_COROUTINE | CO_ASYNC_GENERATOR)) {
-        PyObject *gen;
-        int is_coro = co->co_flags & CO_COROUTINE;
-
-        /* Don't need to keep the reference to f_back, it will be set
-         * when the generator is resumed. */
-        Py_CLEAR(f->f_back);
-
-        /* Create a new generator that owns the ready to run frame
-         * and return that as the value. */
-        if (is_coro) {
-            gen = PyCoro_New(f, name, qualname);
-        } else if (co->co_flags & CO_ASYNC_GENERATOR) {
-            gen = PyAsyncGen_New(f, name, qualname);
-        } else {
-            gen = PyGen_NewWithQualName(f, name, qualname);
-        }
-        if (gen == NULL) {
-            return NULL;
-        }
-
-        _PyObject_GC_TRACK(f);
-
-        return gen;
-    }
-
-    retval = _PyEval_EvalFrame(tstate, f, 0);
+    return f;
 
 fail: /* Jump here from prelude on failure */
 
@@ -4342,29 +5016,72 @@
         Py_DECREF(f);
         --tstate->recursion_depth;
     }
+    return NULL;
+}
+
+static PyObject *
+make_coro(PyFrameConstructor *con, PyFrameObject *f)
+{
+    assert (((PyCodeObject *)con->fc_code)->co_flags & (CO_GENERATOR | CO_COROUTINE | CO_ASYNC_GENERATOR));
+    PyObject *gen;
+    int is_coro = ((PyCodeObject *)con->fc_code)->co_flags & CO_COROUTINE;
+
+    /* Don't need to keep the reference to f_back, it will be set
+        * when the generator is resumed. */
+    Py_CLEAR(f->f_back);
+
+    /* Create a new generator that owns the ready to run frame
+        * and return that as the value. */
+    if (is_coro) {
+            gen = PyCoro_New(f, con->fc_name, con->fc_qualname);
+    } else if (((PyCodeObject *)con->fc_code)->co_flags & CO_ASYNC_GENERATOR) {
+            gen = PyAsyncGen_New(f, con->fc_name, con->fc_qualname);
+    } else {
+            gen = PyGen_NewWithQualName(f, con->fc_name, con->fc_qualname);
+    }
+    if (gen == NULL) {
+        return NULL;
+    }
+
+    _PyObject_GC_TRACK(f);
+
+    return gen;
+}
+
+PyObject *
+_PyEval_Vector(PyThreadState *tstate, PyFrameConstructor *con,
+               PyObject *locals,
+               PyObject* const* args, size_t argcount,
+               PyObject *kwnames)
+{
+    PyFrameObject *f = _PyEval_MakeFrameVector(
+        tstate, con, locals, args, argcount, kwnames);
+    if (f == NULL) {
+        return NULL;
+    }
+    if (((PyCodeObject *)con->fc_code)->co_flags & (CO_GENERATOR | CO_COROUTINE | CO_ASYNC_GENERATOR)) {
+        return make_coro(con, f);
+    }
+    PyObject *retval = _PyEval_EvalFrame(tstate, f, 0);
+
+    /* decref'ing the frame can cause __del__ methods to get invoked,
+       which can call back into Python.  While we're done with the
+       current Python frame (f), the associated C stack is still in use,
+       so recursion_depth must be boosted for the duration.
+    */
+    if (Py_REFCNT(f) > 1) {
+        Py_DECREF(f);
+        _PyObject_GC_TRACK(f);
+    }
+    else {
+        ++tstate->recursion_depth;
+        Py_DECREF(f);
+        --tstate->recursion_depth;
+    }
     return retval;
 }
 
-
-PyObject *
-_PyEval_EvalCodeWithName(PyObject *_co, PyObject *globals, PyObject *locals,
-           PyObject *const *args, Py_ssize_t argcount,
-           PyObject *const *kwnames, PyObject *const *kwargs,
-           Py_ssize_t kwcount, int kwstep,
-           PyObject *const *defs, Py_ssize_t defcount,
-           PyObject *kwdefs, PyObject *closure,
-           PyObject *name, PyObject *qualname)
-{
-    PyThreadState *tstate = _PyThreadState_GET();
-    return _PyEval_EvalCode(tstate, _co, globals, locals,
-               args, argcount,
-               kwnames, kwargs,
-               kwcount, kwstep,
-               defs, defcount,
-               kwdefs, closure,
-               name, qualname);
-}
-
+/* Legacy API */
 PyObject *
 PyEval_EvalCodeEx(PyObject *_co, PyObject *globals, PyObject *locals,
                   PyObject *const *args, int argcount,
@@ -4372,15 +5089,70 @@
                   PyObject *const *defs, int defcount,
                   PyObject *kwdefs, PyObject *closure)
 {
-    return _PyEval_EvalCodeWithName(_co, globals, locals,
-                                    args, argcount,
-                                    kws, kws != NULL ? kws + 1 : NULL,
-                                    kwcount, 2,
-                                    defs, defcount,
-                                    kwdefs, closure,
-                                    NULL, NULL);
+    PyThreadState *tstate = _PyThreadState_GET();
+    PyObject *res = NULL;
+    PyObject *defaults = _PyTuple_FromArray(defs, defcount);
+    if (defaults == NULL) {
+        return NULL;
+    }
+    PyObject *builtins = _PyEval_BuiltinsFromGlobals(tstate, globals); // borrowed ref
+    if (builtins == NULL) {
+        Py_DECREF(defaults);
+        return NULL;
+    }
+    if (locals == NULL) {
+        locals = globals;
+    }
+    PyObject *kwnames = NULL;
+    PyObject *const *allargs;
+    PyObject **newargs = NULL;
+    if (kwcount == 0) {
+        allargs = args;
+    }
+    else {
+        kwnames = PyTuple_New(kwcount);
+        if (kwnames == NULL) {
+            goto fail;
+        }
+        newargs = PyMem_Malloc(sizeof(PyObject *)*(kwcount+argcount));
+        if (newargs == NULL) {
+            goto fail;
+        }
+        for (int i = 0; i < argcount; i++) {
+            newargs[i] = args[i];
+        }
+        for (int i = 0; i < kwcount; i++) {
+            Py_INCREF(kws[2*i]);
+            PyTuple_SET_ITEM(kwnames, i, kws[2*i]);
+            newargs[argcount+i] = kws[2*i+1];
+        }
+        allargs = newargs;
+    }
+    for (int i = 0; i < kwcount; i++) {
+        Py_INCREF(kws[2*i]);
+        PyTuple_SET_ITEM(kwnames, i, kws[2*i]);
+    }
+    PyFrameConstructor constr = {
+        .fc_globals = globals,
+        .fc_builtins = builtins,
+        .fc_name = ((PyCodeObject *)_co)->co_name,
+        .fc_qualname = ((PyCodeObject *)_co)->co_name,
+        .fc_code = _co,
+        .fc_defaults = defaults,
+        .fc_kwdefaults = kwdefs,
+        .fc_closure = closure
+    };
+    res = _PyEval_Vector(tstate, &constr, locals,
+                         allargs, argcount,
+                         kwnames);
+fail:
+    Py_XDECREF(kwnames);
+    PyMem_Free(newargs);
+    Py_DECREF(defaults);
+    return res;
 }
 
+
 static PyObject *
 special_lookup(PyThreadState *tstate, PyObject *o, _Py_Identifier *id)
 {
@@ -4408,7 +5180,7 @@
         type = exc_info->exc_type;
         value = exc_info->exc_value;
         tb = exc_info->exc_traceback;
-        if (type == Py_None || type == NULL) {
+        if (Py_IsNone(type) || type == NULL) {
             _PyErr_SetString(tstate, PyExc_RuntimeError,
                              "No active exception to reraise");
             return 0;
@@ -4466,7 +5238,7 @@
         else if (PyExceptionInstance_Check(cause)) {
             fixed_cause = cause;
         }
-        else if (cause == Py_None) {
+        else if (Py_IsNone(cause)) {
             Py_DECREF(cause);
             fixed_cause = NULL;
         }
@@ -4592,24 +5364,28 @@
     return 0;
 }
 
-
 #ifdef LLTRACE
 static int
 prtrace(PyThreadState *tstate, PyObject *v, const char *str)
 {
     printf("%s ", str);
+    PyObject *type, *value, *traceback;
+    PyErr_Fetch(&type, &value, &traceback);
     if (PyObject_Print(v, stdout, 0) != 0) {
         /* Don't know what else to do */
         _PyErr_Clear(tstate);
     }
     printf("\n");
+    PyErr_Restore(type, value, traceback);
     return 1;
 }
 #endif
 
 static void
 call_exc_trace(Py_tracefunc func, PyObject *self,
-               PyThreadState *tstate, PyFrameObject *f)
+               PyThreadState *tstate,
+               PyFrameObject *f,
+               PyTraceInfo *trace_info)
 {
     PyObject *type, *value, *traceback, *orig_traceback, *arg;
     int err;
@@ -4625,7 +5401,7 @@
         _PyErr_Restore(tstate, type, value, orig_traceback);
         return;
     }
-    err = call_trace(func, self, tstate, f, PyTrace_EXCEPTION, arg);
+    err = call_trace(func, self, tstate, f, trace_info, PyTrace_EXCEPTION, arg);
     Py_DECREF(arg);
     if (err == 0) {
         _PyErr_Restore(tstate, type, value, orig_traceback);
@@ -4640,12 +5416,13 @@
 static int
 call_trace_protected(Py_tracefunc func, PyObject *obj,
                      PyThreadState *tstate, PyFrameObject *frame,
+                     PyTraceInfo *trace_info,
                      int what, PyObject *arg)
 {
     PyObject *type, *value, *traceback;
     int err;
     _PyErr_Fetch(tstate, &type, &value, &traceback);
-    err = call_trace(func, obj, tstate, frame, what, arg);
+    err = call_trace(func, obj, tstate, frame, trace_info, what, arg);
     if (err == 0)
     {
         _PyErr_Restore(tstate, type, value, traceback);
@@ -4659,18 +5436,36 @@
     }
 }
 
+static void
+initialize_trace_info(PyTraceInfo *trace_info, PyFrameObject *frame)
+{
+    if (trace_info->code != frame->f_code) {
+        trace_info->code = frame->f_code;
+        _PyCode_InitAddressRange(frame->f_code, &trace_info->bounds);
+    }
+}
+
 static int
 call_trace(Py_tracefunc func, PyObject *obj,
            PyThreadState *tstate, PyFrameObject *frame,
+           PyTraceInfo *trace_info,
            int what, PyObject *arg)
 {
     int result;
     if (tstate->tracing)
         return 0;
     tstate->tracing++;
-    tstate->use_tracing = 0;
+    tstate->cframe->use_tracing = 0;
+    if (frame->f_lasti < 0) {
+        frame->f_lineno = frame->f_code->co_firstlineno;
+    }
+    else {
+        initialize_trace_info(trace_info, frame);
+        frame->f_lineno = _PyCode_CheckLineNumber(frame->f_lasti*sizeof(_Py_CODEUNIT), &trace_info->bounds);
+    }
     result = func(obj, frame, what, arg);
-    tstate->use_tracing = ((tstate->c_tracefunc != NULL)
+    frame->f_lineno = 0;
+    tstate->cframe->use_tracing = ((tstate->c_tracefunc != NULL)
                            || (tstate->c_profilefunc != NULL));
     tstate->tracing--;
     return result;
@@ -4681,15 +5476,15 @@
 {
     PyThreadState *tstate = _PyThreadState_GET();
     int save_tracing = tstate->tracing;
-    int save_use_tracing = tstate->use_tracing;
+    int save_use_tracing = tstate->cframe->use_tracing;
     PyObject *result;
 
     tstate->tracing = 0;
-    tstate->use_tracing = ((tstate->c_tracefunc != NULL)
+    tstate->cframe->use_tracing = ((tstate->c_tracefunc != NULL)
                            || (tstate->c_profilefunc != NULL));
     result = PyObject_Call(func, args, NULL);
     tstate->tracing = save_tracing;
-    tstate->use_tracing = save_use_tracing;
+    tstate->cframe->use_tracing = save_use_tracing;
     return result;
 }
 
@@ -4697,36 +5492,27 @@
 static int
 maybe_call_line_trace(Py_tracefunc func, PyObject *obj,
                       PyThreadState *tstate, PyFrameObject *frame,
-                      int *instr_lb, int *instr_ub, int *instr_prev)
+                      PyTraceInfo *trace_info, int instr_prev)
 {
     int result = 0;
-    int line = frame->f_lineno;
 
-    /* If the last instruction executed isn't in the current
-       instruction window, reset the window.
-    */
-    if (frame->f_lasti < *instr_lb || frame->f_lasti >= *instr_ub) {
-        PyAddrPair bounds;
-        line = _PyCode_CheckLineNumber(frame->f_code, frame->f_lasti,
-                                       &bounds);
-        *instr_lb = bounds.ap_lower;
-        *instr_ub = bounds.ap_upper;
-    }
     /* If the last instruction falls at the start of a line or if it
        represents a jump backwards, update the frame's line number and
        then call the trace function if we're tracing source lines.
     */
-    if ((frame->f_lasti == *instr_lb || frame->f_lasti < *instr_prev)) {
-        frame->f_lineno = line;
-        if (frame->f_trace_lines) {
-            result = call_trace(func, obj, tstate, frame, PyTrace_LINE, Py_None);
+    initialize_trace_info(trace_info, frame);
+    int lastline = _PyCode_CheckLineNumber(instr_prev*sizeof(_Py_CODEUNIT), &trace_info->bounds);
+    int line = _PyCode_CheckLineNumber(frame->f_lasti*sizeof(_Py_CODEUNIT), &trace_info->bounds);
+    if (line != -1 && frame->f_trace_lines) {
+        /* Trace backward edges or if line number has changed */
+        if (frame->f_lasti < instr_prev || line != lastline) {
+            result = call_trace(func, obj, tstate, frame, trace_info, PyTrace_LINE, Py_None);
         }
     }
     /* Always emit an opcode event if we're tracing all opcodes. */
     if (frame->f_trace_opcodes) {
-        result = call_trace(func, obj, tstate, frame, PyTrace_OPCODE, Py_None);
+        result = call_trace(func, obj, tstate, frame, trace_info, PyTrace_OPCODE, Py_None);
     }
-    *instr_prev = frame->f_lasti;
     return result;
 }
 
@@ -4749,7 +5535,7 @@
     tstate->c_profilefunc = NULL;
     tstate->c_profileobj = NULL;
     /* Must make sure that tracing is not ignored if 'profileobj' is freed */
-    tstate->use_tracing = tstate->c_tracefunc != NULL;
+    tstate->cframe->use_tracing = tstate->c_tracefunc != NULL;
     Py_XDECREF(profileobj);
 
     Py_XINCREF(arg);
@@ -4757,7 +5543,7 @@
     tstate->c_profilefunc = func;
 
     /* Flag that tracing or profiling is turned on */
-    tstate->use_tracing = (func != NULL) || (tstate->c_tracefunc != NULL);
+    tstate->cframe->use_tracing = (func != NULL) || (tstate->c_tracefunc != NULL);
     return 0;
 }
 
@@ -4785,14 +5571,12 @@
         return -1;
     }
 
-    struct _ceval_state *ceval2 = &tstate->interp->ceval;
     PyObject *traceobj = tstate->c_traceobj;
-    ceval2->tracing_possible += (func != NULL) - (tstate->c_tracefunc != NULL);
 
     tstate->c_tracefunc = NULL;
     tstate->c_traceobj = NULL;
     /* Must make sure that profiling is not ignored if 'traceobj' is freed */
-    tstate->use_tracing = (tstate->c_profilefunc != NULL);
+    tstate->cframe->use_tracing = (tstate->c_profilefunc != NULL);
     Py_XDECREF(traceobj);
 
     Py_XINCREF(arg);
@@ -4800,7 +5584,7 @@
     tstate->c_tracefunc = func;
 
     /* Flag that tracing or profiling is turned on */
-    tstate->use_tracing = ((func != NULL)
+    tstate->cframe->use_tracing = ((func != NULL)
                            || (tstate->c_profilefunc != NULL));
 
     return 0;
@@ -4881,14 +5665,20 @@
 }
 
 PyObject *
+_PyEval_GetBuiltins(PyThreadState *tstate)
+{
+    PyFrameObject *frame = tstate->frame;
+    if (frame != NULL) {
+        return frame->f_builtins;
+    }
+    return tstate->interp->builtins;
+}
+
+PyObject *
 PyEval_GetBuiltins(void)
 {
     PyThreadState *tstate = _PyThreadState_GET();
-    PyFrameObject *current_frame = tstate->frame;
-    if (current_frame == NULL)
-        return tstate->interp->builtins;
-    else
-        return current_frame->f_builtins;
+    return _PyEval_GetBuiltins(tstate);
 }
 
 /* Convenience function to get a builtin from its name */
@@ -4989,9 +5779,9 @@
 }
 
 #define C_TRACE(x, call) \
-if (tstate->use_tracing && tstate->c_profilefunc) { \
+if (trace_info->cframe.use_tracing && tstate->c_profilefunc) { \
     if (call_trace(tstate->c_profilefunc, tstate->c_profileobj, \
-        tstate, tstate->frame, \
+        tstate, tstate->frame, trace_info, \
         PyTrace_C_CALL, func)) { \
         x = NULL; \
     } \
@@ -5001,13 +5791,13 @@
             if (x == NULL) { \
                 call_trace_protected(tstate->c_profilefunc, \
                     tstate->c_profileobj, \
-                    tstate, tstate->frame, \
+                    tstate, tstate->frame, trace_info, \
                     PyTrace_C_EXCEPTION, func); \
                 /* XXX should pass (type, value, tb) */ \
             } else { \
                 if (call_trace(tstate->c_profilefunc, \
                     tstate->c_profileobj, \
-                    tstate, tstate->frame, \
+                    tstate, tstate->frame, trace_info, \
                     PyTrace_C_RETURN, func)) { \
                     Py_DECREF(x); \
                     x = NULL; \
@@ -5022,6 +5812,7 @@
 
 static PyObject *
 trace_call_function(PyThreadState *tstate,
+                    PyTraceInfo *trace_info,
                     PyObject *func,
                     PyObject **args, Py_ssize_t nargs,
                     PyObject *kwnames)
@@ -5056,7 +5847,11 @@
 /* Issue #29227: Inline call_function() into _PyEval_EvalFrameDefault()
    to reduce the stack consumption. */
 Py_LOCAL_INLINE(PyObject *) _Py_HOT_FUNCTION
-call_function(PyThreadState *tstate, PyObject ***pp_stack, Py_ssize_t oparg, PyObject *kwnames)
+call_function(PyThreadState *tstate,
+              PyTraceInfo *trace_info,
+              PyObject ***pp_stack,
+              Py_ssize_t oparg,
+              PyObject *kwnames)
 {
     PyObject **pfunc = (*pp_stack) - oparg - 1;
     PyObject *func = *pfunc;
@@ -5065,8 +5860,8 @@
     Py_ssize_t nargs = oparg - nkwargs;
     PyObject **stack = (*pp_stack) - nargs - nkwargs;
 
-    if (tstate->use_tracing) {
-        x = trace_call_function(tstate, func, stack, nargs, kwnames);
+    if (trace_info->cframe.use_tracing) {
+        x = trace_call_function(tstate, trace_info, func, stack, nargs, kwnames);
     }
     else {
         x = PyObject_Vectorcall(func, stack, nargs | PY_VECTORCALL_ARGUMENTS_OFFSET, kwnames);
@@ -5084,7 +5879,11 @@
 }
 
 static PyObject *
-do_call_core(PyThreadState *tstate, PyObject *func, PyObject *callargs, PyObject *kwdict)
+do_call_core(PyThreadState *tstate,
+             PyTraceInfo *trace_info,
+             PyObject *func,
+             PyObject *callargs,
+             PyObject *kwdict)
 {
     PyObject *result;
 
@@ -5094,7 +5893,7 @@
     }
     else if (Py_IS_TYPE(func, &PyMethodDescr_Type)) {
         Py_ssize_t nargs = PyTuple_GET_SIZE(callargs);
-        if (nargs > 0 && tstate->use_tracing) {
+        if (nargs > 0 && trace_info->cframe.use_tracing) {
             /* We need to create a temporary bound method as argument
                for profiling.
 
@@ -5130,7 +5929,7 @@
 _PyEval_SliceIndex(PyObject *v, Py_ssize_t *pi)
 {
     PyThreadState *tstate = _PyThreadState_GET();
-    if (v != Py_None) {
+    if (!Py_IsNone(v)) {
         Py_ssize_t x;
         if (_PyIndex_Check(v)) {
             x = PyNumber_AsSsize_t(v, NULL);
@@ -5454,6 +6253,23 @@
         return;
 
     _PyErr_Format(tstate, exc, format_str, obj_str);
+
+    if (exc == PyExc_NameError) {
+        // Include the name in the NameError exceptions to offer suggestions later.
+        _Py_IDENTIFIER(name);
+        PyObject *type, *value, *traceback;
+        PyErr_Fetch(&type, &value, &traceback);
+        PyErr_NormalizeException(&type, &value, &traceback);
+        if (PyErr_GivenExceptionMatches(value, PyExc_NameError)) {
+            PyNameErrorObject* exc = (PyNameErrorObject*) value;
+            if (exc->name == NULL) {
+                // We do not care if this fails because we are going to restore the
+                // NameError anyway.
+                (void)_PyObject_SetAttrId(value, &PyId_name, obj);
+            }
+        }
+        PyErr_Restore(type, value, traceback);
+    }
 }
 
 static void
@@ -5621,7 +6437,7 @@
     PyCodeObject *code = f->f_code;
     filename = PyUnicode_AsUTF8(code->co_filename);
     funcname = PyUnicode_AsUTF8(code->co_name);
-    lineno = PyCode_Addr2Line(code, f->f_lasti);
+    lineno = PyFrame_GetLineNumber(f);
 
     PyDTrace_FUNCTION_ENTRY(filename, funcname, lineno);
 }
@@ -5636,7 +6452,7 @@
     PyCodeObject *code = f->f_code;
     filename = PyUnicode_AsUTF8(code->co_filename);
     funcname = PyUnicode_AsUTF8(code->co_name);
-    lineno = PyCode_Addr2Line(code, f->f_lasti);
+    lineno = PyFrame_GetLineNumber(f);
 
     PyDTrace_FUNCTION_RETURN(filename, funcname, lineno);
 }
@@ -5644,35 +6460,30 @@
 /* DTrace equivalent of maybe_call_line_trace. */
 static void
 maybe_dtrace_line(PyFrameObject *frame,
-                  int *instr_lb, int *instr_ub, int *instr_prev)
+                  PyTraceInfo *trace_info, int instr_prev)
 {
-    int line = frame->f_lineno;
     const char *co_filename, *co_name;
 
     /* If the last instruction executed isn't in the current
        instruction window, reset the window.
     */
-    if (frame->f_lasti < *instr_lb || frame->f_lasti >= *instr_ub) {
-        PyAddrPair bounds;
-        line = _PyCode_CheckLineNumber(frame->f_code, frame->f_lasti,
-                                       &bounds);
-        *instr_lb = bounds.ap_lower;
-        *instr_ub = bounds.ap_upper;
-    }
+    initialize_trace_info(trace_info, frame);
+    int line = _PyCode_CheckLineNumber(frame->f_lasti*sizeof(_Py_CODEUNIT), &trace_info->bounds);
     /* If the last instruction falls at the start of a line or if
        it represents a jump backwards, update the frame's line
        number and call the trace function. */
-    if (frame->f_lasti == *instr_lb || frame->f_lasti < *instr_prev) {
-        frame->f_lineno = line;
-        co_filename = PyUnicode_AsUTF8(frame->f_code->co_filename);
-        if (!co_filename)
-            co_filename = "?";
-        co_name = PyUnicode_AsUTF8(frame->f_code->co_name);
-        if (!co_name)
-            co_name = "?";
-        PyDTrace_LINE(co_filename, co_name, line);
+    if (line != frame->f_lineno || frame->f_lasti < instr_prev) {
+        if (line != -1) {
+            frame->f_lineno = line;
+            co_filename = PyUnicode_AsUTF8(frame->f_code->co_filename);
+            if (!co_filename)
+                co_filename = "?";
+            co_name = PyUnicode_AsUTF8(frame->f_code->co_name);
+            if (!co_name)
+                co_name = "?";
+            PyDTrace_LINE(co_filename, co_name, line);
+        }
     }
-    *instr_prev = frame->f_lasti;
 }
 
 
diff --git a/Python/ceval_gil.h b/Python/ceval_gil.h
index 3510675..9b8b432 100644
--- a/Python/ceval_gil.h
+++ b/Python/ceval_gil.h
@@ -144,7 +144,11 @@
 drop_gil(struct _ceval_runtime_state *ceval, struct _ceval_state *ceval2,
          PyThreadState *tstate)
 {
+#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+    struct _gil_runtime_state *gil = &ceval2->gil;
+#else
     struct _gil_runtime_state *gil = &ceval->gil;
+#endif
     if (!_Py_atomic_load_relaxed(&gil->locked)) {
         Py_FatalError("drop_gil: GIL is not locked");
     }
@@ -228,7 +232,11 @@
     PyInterpreterState *interp = tstate->interp;
     struct _ceval_runtime_state *ceval = &interp->runtime->ceval;
     struct _ceval_state *ceval2 = &interp->ceval;
+#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+    struct _gil_runtime_state *gil = &ceval2->gil;
+#else
     struct _gil_runtime_state *gil = &ceval->gil;
+#endif
 
     /* Check that _PyEval_InitThreads() was called to create the lock */
     assert(gil_created(gil));
@@ -310,7 +318,7 @@
 
     /* Don't access tstate if the thread must exit */
     if (tstate->async_exc != NULL) {
-        _PyEval_SignalAsyncExc(tstate);
+        _PyEval_SignalAsyncExc(tstate->interp);
     }
 
     MUTEX_UNLOCK(gil->mutex);
@@ -320,12 +328,22 @@
 
 void _PyEval_SetSwitchInterval(unsigned long microseconds)
 {
+#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+    PyInterpreterState *interp = PyInterpreterState_Get();
+    struct _gil_runtime_state *gil = &interp->ceval.gil;
+#else
     struct _gil_runtime_state *gil = &_PyRuntime.ceval.gil;
+#endif
     gil->interval = microseconds;
 }
 
 unsigned long _PyEval_GetSwitchInterval()
 {
+#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+    PyInterpreterState *interp = PyInterpreterState_Get();
+    struct _gil_runtime_state *gil = &interp->ceval.gil;
+#else
     struct _gil_runtime_state *gil = &_PyRuntime.ceval.gil;
+#endif
     return gil->interval;
 }
diff --git a/Python/clinic/_warnings.c.h b/Python/clinic/_warnings.c.h
index 67ab0e3..ad6b9a8 100644
--- a/Python/clinic/_warnings.c.h
+++ b/Python/clinic/_warnings.c.h
@@ -43,14 +43,9 @@
         }
     }
     if (args[2]) {
-        if (PyFloat_Check(args[2])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         {
             Py_ssize_t ival = -1;
-            PyObject *iobj = PyNumber_Index(args[2]);
+            PyObject *iobj = _PyNumber_Index(args[2]);
             if (iobj != NULL) {
                 ival = PyLong_AsSsize_t(iobj);
                 Py_DECREF(iobj);
@@ -71,4 +66,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=b7bb54c73b5433ec input=a9049054013a1b77]*/
+/*[clinic end generated code: output=eb9997fa998fdbad input=a9049054013a1b77]*/
diff --git a/Python/clinic/bltinmodule.c.h b/Python/clinic/bltinmodule.c.h
index d15af1f..545f5b5 100644
--- a/Python/clinic/bltinmodule.c.h
+++ b/Python/clinic/bltinmodule.c.h
@@ -134,11 +134,6 @@
     PyObject *return_value = NULL;
     int i;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     i = _PyLong_AsInt(arg);
     if (i == -1 && PyErr_Occurred()) {
         goto exit;
@@ -216,11 +211,6 @@
         goto skip_optional_pos;
     }
     if (args[3]) {
-        if (PyFloat_Check(args[3])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         flags = _PyLong_AsInt(args[3]);
         if (flags == -1 && PyErr_Occurred()) {
             goto exit;
@@ -230,11 +220,6 @@
         }
     }
     if (args[4]) {
-        if (PyFloat_Check(args[4])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         dont_inherit = _PyLong_AsInt(args[4]);
         if (dont_inherit == -1 && PyErr_Occurred()) {
             goto exit;
@@ -244,11 +229,6 @@
         }
     }
     if (args[5]) {
-        if (PyFloat_Check(args[5])) {
-            PyErr_SetString(PyExc_TypeError,
-                            "integer argument expected, got float" );
-            goto exit;
-        }
         optimize = _PyLong_AsInt(args[5]);
         if (optimize == -1 && PyErr_Occurred()) {
             goto exit;
@@ -261,11 +241,6 @@
     if (!noptargs) {
         goto skip_optional_kwonly;
     }
-    if (PyFloat_Check(args[6])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     feature_version = _PyLong_AsInt(args[6]);
     if (feature_version == -1 && PyErr_Occurred()) {
         goto exit;
@@ -555,6 +530,50 @@
 #define BUILTIN_HEX_METHODDEF    \
     {"hex", (PyCFunction)builtin_hex, METH_O, builtin_hex__doc__},
 
+PyDoc_STRVAR(builtin_aiter__doc__,
+"aiter($module, async_iterable, /)\n"
+"--\n"
+"\n"
+"Return an AsyncIterator for an AsyncIterable object.");
+
+#define BUILTIN_AITER_METHODDEF    \
+    {"aiter", (PyCFunction)builtin_aiter, METH_O, builtin_aiter__doc__},
+
+PyDoc_STRVAR(builtin_anext__doc__,
+"anext($module, aiterator, default=<unrepresentable>, /)\n"
+"--\n"
+"\n"
+"Return the next item from the async iterator.");
+
+#define BUILTIN_ANEXT_METHODDEF    \
+    {"anext", (PyCFunction)(void(*)(void))builtin_anext, METH_FASTCALL, builtin_anext__doc__},
+
+static PyObject *
+builtin_anext_impl(PyObject *module, PyObject *aiterator,
+                   PyObject *default_value);
+
+static PyObject *
+builtin_anext(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+    PyObject *return_value = NULL;
+    PyObject *aiterator;
+    PyObject *default_value = NULL;
+
+    if (!_PyArg_CheckPositional("anext", nargs, 1, 2)) {
+        goto exit;
+    }
+    aiterator = args[0];
+    if (nargs < 2) {
+        goto skip_optional;
+    }
+    default_value = args[1];
+skip_optional:
+    return_value = builtin_anext_impl(module, aiterator, default_value);
+
+exit:
+    return return_value;
+}
+
 PyDoc_STRVAR(builtin_len__doc__,
 "len($module, obj, /)\n"
 "--\n"
@@ -825,11 +844,11 @@
 "issubclass($module, cls, class_or_tuple, /)\n"
 "--\n"
 "\n"
-"Return whether \'cls\' is a derived from another class or is the same class.\n"
+"Return whether \'cls\' is derived from another class or is the same class.\n"
 "\n"
 "A tuple, as in ``issubclass(x, (A, B, ...))``, may be given as the target to\n"
 "check against. This is equivalent to ``issubclass(x, A) or issubclass(x, B)\n"
-"or ...`` etc.");
+"or ...``.");
 
 #define BUILTIN_ISSUBCLASS_METHODDEF    \
     {"issubclass", (PyCFunction)(void(*)(void))builtin_issubclass, METH_FASTCALL, builtin_issubclass__doc__},
@@ -855,4 +874,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=29686a89b739d600 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=da9ae459e9233259 input=a9049054013a1b77]*/
diff --git a/Python/clinic/import.c.h b/Python/clinic/import.c.h
index e4867f3..4e013cc 100644
--- a/Python/clinic/import.c.h
+++ b/Python/clinic/import.c.h
@@ -420,11 +420,6 @@
     if (!args) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     key = PyLong_AsLong(args[0]);
     if (key == -1 && PyErr_Occurred()) {
         goto exit;
@@ -454,4 +449,4 @@
 #ifndef _IMP_EXEC_DYNAMIC_METHODDEF
     #define _IMP_EXEC_DYNAMIC_METHODDEF
 #endif /* !defined(_IMP_EXEC_DYNAMIC_METHODDEF) */
-/*[clinic end generated code: output=3dc495e9c64d944e input=a9049054013a1b77]*/
+/*[clinic end generated code: output=7c31c433af88af6b input=a9049054013a1b77]*/
diff --git a/Python/clinic/marshal.c.h b/Python/clinic/marshal.c.h
index 05d4830..f80d5ef 100644
--- a/Python/clinic/marshal.c.h
+++ b/Python/clinic/marshal.c.h
@@ -42,11 +42,6 @@
     if (nargs < 3) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     version = _PyLong_AsInt(args[2]);
     if (version == -1 && PyErr_Occurred()) {
         goto exit;
@@ -111,11 +106,6 @@
     if (nargs < 2) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[1])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     version = _PyLong_AsInt(args[1]);
     if (version == -1 && PyErr_Occurred()) {
         goto exit;
@@ -165,4 +155,4 @@
 
     return return_value;
 }
-/*[clinic end generated code: output=a859dabe8b0afeb6 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=68b78f38bfe0c06d input=a9049054013a1b77]*/
diff --git a/Python/clinic/sysmodule.c.h b/Python/clinic/sysmodule.c.h
index 4615eba..04c8481 100644
--- a/Python/clinic/sysmodule.c.h
+++ b/Python/clinic/sysmodule.c.h
@@ -372,11 +372,6 @@
     PyObject *return_value = NULL;
     int new_limit;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     new_limit = _PyLong_AsInt(arg);
     if (new_limit == -1 && PyErr_Occurred()) {
         goto exit;
@@ -417,11 +412,6 @@
     if (!args) {
         goto exit;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     depth = _PyLong_AsInt(args[0]);
     if (depth == -1 && PyErr_Occurred()) {
         goto exit;
@@ -590,11 +580,6 @@
     PyObject *return_value = NULL;
     int new_val;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     new_val = _PyLong_AsInt(arg);
     if (new_val == -1 && PyErr_Occurred()) {
         goto exit;
@@ -650,11 +635,6 @@
     PyObject *return_value = NULL;
     int flag;
 
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     flag = _PyLong_AsInt(arg);
     if (flag == -1 && PyErr_Occurred()) {
         goto exit;
@@ -790,11 +770,6 @@
     if (nargs < 1) {
         goto skip_optional;
     }
-    if (PyFloat_Check(args[0])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     depth = _PyLong_AsInt(args[0]);
     if (depth == -1 && PyErr_Occurred()) {
         goto exit;
@@ -826,6 +801,26 @@
     return sys__current_frames_impl(module);
 }
 
+PyDoc_STRVAR(sys__current_exceptions__doc__,
+"_current_exceptions($module, /)\n"
+"--\n"
+"\n"
+"Return a dict mapping each thread\'s identifier to its current raised exception.\n"
+"\n"
+"This function should be used for specialized purposes only.");
+
+#define SYS__CURRENT_EXCEPTIONS_METHODDEF    \
+    {"_current_exceptions", (PyCFunction)sys__current_exceptions, METH_NOARGS, sys__current_exceptions__doc__},
+
+static PyObject *
+sys__current_exceptions_impl(PyObject *module);
+
+static PyObject *
+sys__current_exceptions(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+    return sys__current_exceptions_impl(module);
+}
+
 PyDoc_STRVAR(sys_call_tracing__doc__,
 "call_tracing($module, func, args, /)\n"
 "--\n"
@@ -943,6 +938,24 @@
 
 #endif /* defined(ANDROID_API_LEVEL) */
 
+PyDoc_STRVAR(sys__deactivate_opcache__doc__,
+"_deactivate_opcache($module, /)\n"
+"--\n"
+"\n"
+"Deactivate the opcode cache permanently");
+
+#define SYS__DEACTIVATE_OPCACHE_METHODDEF    \
+    {"_deactivate_opcache", (PyCFunction)sys__deactivate_opcache, METH_NOARGS, sys__deactivate_opcache__doc__},
+
+static PyObject *
+sys__deactivate_opcache_impl(PyObject *module);
+
+static PyObject *
+sys__deactivate_opcache(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+    return sys__deactivate_opcache_impl(module);
+}
+
 #ifndef SYS_GETWINDOWSVERSION_METHODDEF
     #define SYS_GETWINDOWSVERSION_METHODDEF
 #endif /* !defined(SYS_GETWINDOWSVERSION_METHODDEF) */
@@ -970,4 +983,4 @@
 #ifndef SYS_GETANDROIDAPILEVEL_METHODDEF
     #define SYS_GETANDROIDAPILEVEL_METHODDEF
 #endif /* !defined(SYS_GETANDROIDAPILEVEL_METHODDEF) */
-/*[clinic end generated code: output=39eb34a01fb9a919 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=68c62b9ca317a0c8 input=a9049054013a1b77]*/
diff --git a/Python/clinic/traceback.c.h b/Python/clinic/traceback.c.h
index 04daf2a..404a0c4 100644
--- a/Python/clinic/traceback.c.h
+++ b/Python/clinic/traceback.c.h
@@ -36,20 +36,10 @@
         goto exit;
     }
     tb_frame = (PyFrameObject *)fastargs[1];
-    if (PyFloat_Check(fastargs[2])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     tb_lasti = _PyLong_AsInt(fastargs[2]);
     if (tb_lasti == -1 && PyErr_Occurred()) {
         goto exit;
     }
-    if (PyFloat_Check(fastargs[3])) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        goto exit;
-    }
     tb_lineno = _PyLong_AsInt(fastargs[3]);
     if (tb_lineno == -1 && PyErr_Occurred()) {
         goto exit;
@@ -59,4 +49,4 @@
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=3def6c06248feed8 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=403778d7af5ebef9 input=a9049054013a1b77]*/
diff --git a/Python/codecs.c b/Python/codecs.c
index 0f18c27..fa329ce 100644
--- a/Python/codecs.c
+++ b/Python/codecs.c
@@ -11,7 +11,7 @@
 #include "Python.h"
 #include "pycore_interp.h"        // PyInterpreterState.codec_search_path
 #include "pycore_pystate.h"       // _PyInterpreterState_GET()
-#include "ucnhash.h"
+#include "pycore_ucnhash.h"       // _PyUnicode_Name_CAPI
 #include <ctype.h>
 
 const char *Py_hexdigits = "0123456789abcdef";
@@ -50,6 +50,31 @@
     return -1;
 }
 
+int
+PyCodec_Unregister(PyObject *search_function)
+{
+    PyInterpreterState *interp = PyInterpreterState_Get();
+    PyObject *codec_search_path = interp->codec_search_path;
+    /* Do nothing if codec_search_path is not created yet or was cleared. */
+    if (codec_search_path == NULL) {
+        return 0;
+    }
+
+    assert(PyList_CheckExact(codec_search_path));
+    Py_ssize_t n = PyList_GET_SIZE(codec_search_path);
+    for (Py_ssize_t i = 0; i < n; i++) {
+        PyObject *item = PyList_GET_ITEM(codec_search_path, i);
+        if (item == search_function) {
+            if (interp->codec_search_cache != NULL) {
+                assert(PyDict_CheckExact(interp->codec_search_cache));
+                PyDict_Clear(interp->codec_search_cache);
+            }
+            return PyList_SetSlice(codec_search_path, i, i+1, NULL);
+        }
+    }
+    return 0;
+}
+
 extern int _Py_normalize_encoding(const char *, char *, size_t);
 
 /* Convert a string to a normalized Python string(decoded from UTF-8): all characters are
@@ -183,31 +208,6 @@
     return NULL;
 }
 
-int _PyCodec_Forget(const char *encoding)
-{
-    PyObject *v;
-    int result;
-
-    PyInterpreterState *interp = _PyInterpreterState_GET();
-    if (interp->codec_search_path == NULL) {
-        return -1;
-    }
-
-    /* Convert the encoding to a normalized Python string: all
-       characters are converted to lower case, spaces and hyphens are
-       replaced with underscores. */
-    v = normalizestring(encoding);
-    if (v == NULL) {
-        return -1;
-    }
-
-    /* Drop the named codec from the internal cache */
-    result = PyDict_DelItem(interp->codec_search_cache, v);
-    Py_DECREF(v);
-
-    return result;
-}
-
 /* Codec registry encoding check API. */
 
 int PyCodec_KnownEncoding(const char *encoding)
@@ -954,7 +954,7 @@
     return Py_BuildValue("(Nn)", res, end);
 }
 
-static _PyUnicode_Name_CAPI *ucnhash_CAPI = NULL;
+static _PyUnicode_Name_CAPI *ucnhash_capi = NULL;
 
 PyObject *PyCodec_NameReplaceErrors(PyObject *exc)
 {
@@ -976,17 +976,18 @@
             return NULL;
         if (!(object = PyUnicodeEncodeError_GetObject(exc)))
             return NULL;
-        if (!ucnhash_CAPI) {
+        if (!ucnhash_capi) {
             /* load the unicode data module */
-            ucnhash_CAPI = (_PyUnicode_Name_CAPI *)PyCapsule_Import(
+            ucnhash_capi = (_PyUnicode_Name_CAPI *)PyCapsule_Import(
                                             PyUnicodeData_CAPSULE_NAME, 1);
-            if (!ucnhash_CAPI)
+            if (!ucnhash_capi) {
                 return NULL;
+            }
         }
         for (i = start, ressize = 0; i < end; ++i) {
             /* object is guaranteed to be "ready" */
             c = PyUnicode_READ_CHAR(object, i);
-            if (ucnhash_CAPI->getname(NULL, c, buffer, sizeof(buffer), 1)) {
+            if (ucnhash_capi->getname(c, buffer, sizeof(buffer), 1)) {
                 replsize = 1+1+1+(int)strlen(buffer)+1;
             }
             else if (c >= 0x10000) {
@@ -1009,7 +1010,7 @@
             i < end; ++i) {
             c = PyUnicode_READ_CHAR(object, i);
             *outp++ = '\\';
-            if (ucnhash_CAPI->getname(NULL, c, buffer, sizeof(buffer), 1)) {
+            if (ucnhash_capi->getname(c, buffer, sizeof(buffer), 1)) {
                 *outp++ = 'N';
                 *outp++ = '{';
                 strcpy((char *)outp, buffer);
diff --git a/Python/compile.c b/Python/compile.c
index 722d52d..f012406 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -1,7 +1,7 @@
 /*
  * This file compiles an abstract syntax tree (AST) into Python bytecode.
  *
- * The primary entry point is PyAST_Compile(), which returns a
+ * The primary entry point is _PyAST_Compile(), which returns a
  * PyCodeObject.  The compiler makes several passes to build the code
  * object:
  *   1. Checks for future statements.  See future.c
@@ -9,7 +9,7 @@
  *   3. Generate code for basic blocks.  See compiler_mod() in this file.
  *   4. Assemble the basic blocks into final code.  See assemble() in
  *      this file.
- *   5. Optimize the byte code (peephole optimizations).  See peephole.c
+ *   5. Optimize the byte code (peephole optimizations).
  *
  * Note that compiler_mod() suggests module, but the module ast type
  * (mod_ty) has cases for expressions and interactive statements.
@@ -21,14 +21,19 @@
  * objects.
  */
 
-#include "Python.h"
+#include <stdbool.h>
 
-#include "Python-ast.h"
-#include "ast.h"
-#include "code.h"
-#include "symtable.h"
-#include "opcode.h"
-#include "wordcode_helpers.h"
+#include "Python.h"
+#include "pycore_ast.h"           // _PyAST_GetDocString()
+#include "pycore_compile.h"       // _PyFuture_FromAST()
+#include "pycore_pymem.h"         // _PyMem_IsPtrFreed()
+#include "pycore_long.h"          // _PyLong_GetZero()
+#include "pycore_symtable.h"      // PySTEntryObject
+
+#define NEED_OPCODE_JUMP_TABLES
+#include "opcode.h"               // EXTENDED_ARG
+#include "wordcode_helpers.h"     // instrsize()
+
 
 #define DEFAULT_BLOCK_SIZE 16
 #define DEFAULT_BLOCKS 8
@@ -40,19 +45,67 @@
 #define COMP_SETCOMP  2
 #define COMP_DICTCOMP 3
 
+/* A soft limit for stack use, to avoid excessive
+ * memory use for large constants, etc.
+ *
+ * The value 30 is plucked out of thin air.
+ * Code that could use more stack than this is
+ * rare, so the exact value is unimportant.
+ */
+#define STACK_USE_GUIDELINE 30
+
+/* If we exceed this limit, it should
+ * be considered a compiler bug.
+ * Currently it should be impossible
+ * to exceed STACK_USE_GUIDELINE * 100,
+ * as 100 is the maximum parse depth.
+ * For performance reasons we will
+ * want to reduce this to a
+ * few hundred in the future.
+ *
+ * NOTE: Whatever MAX_ALLOWED_STACK_USE is
+ * set to, it should never restrict what Python
+ * we can write, just how we compile it.
+ */
+#define MAX_ALLOWED_STACK_USE (STACK_USE_GUIDELINE * 100)
+
 #define IS_TOP_LEVEL_AWAIT(c) ( \
         (c->c_flags->cf_flags & PyCF_ALLOW_TOP_LEVEL_AWAIT) \
         && (c->u->u_ste->ste_type == ModuleBlock))
 
 struct instr {
-    unsigned i_jabs : 1;
-    unsigned i_jrel : 1;
     unsigned char i_opcode;
     int i_oparg;
     struct basicblock_ *i_target; /* target block (if jump instruction) */
     int i_lineno;
 };
 
+#define LOG_BITS_PER_INT 5
+#define MASK_LOW_LOG_BITS 31
+
+static inline int
+is_bit_set_in_table(uint32_t *table, int bitindex) {
+    /* Is the relevant bit set in the relevant word? */
+    /* 256 bits fit into 8 32-bits words.
+     * Word is indexed by (bitindex>>ln(size of int in bits)).
+     * Bit within word is the low bits of bitindex.
+     */
+    uint32_t word = table[bitindex >> LOG_BITS_PER_INT];
+    return (word >> (bitindex & MASK_LOW_LOG_BITS)) & 1;
+}
+
+static inline int
+is_relative_jump(struct instr *i)
+{
+    return is_bit_set_in_table(_PyOpcode_RelativeJump, i->i_opcode);
+}
+
+static inline int
+is_jump(struct instr *i)
+{
+    return is_bit_set_in_table(_PyOpcode_Jump, i->i_opcode);
+}
+
 typedef struct basicblock_ {
     /* Each basicblock in a compilation unit is linked via b_list in the
        reverse order that the block are allocated.  b_list points to the next
@@ -67,10 +120,16 @@
     /* If b_next is non-NULL, it is a pointer to the next
        block reached by normal control flow. */
     struct basicblock_ *b_next;
-    /* b_seen is used to perform a DFS of basicblocks. */
-    unsigned b_seen : 1;
     /* b_return is true if a RETURN_VALUE opcode is inserted. */
     unsigned b_return : 1;
+    /* Number of predecssors that a block has. */
+    int b_predecessors;
+    /* Basic block has no fall through (it ends with a return, raise or jump) */
+    unsigned b_nofallthrough : 1;
+    /* Basic block exits scope (it ends with a return or raise) */
+    unsigned b_exit : 1;
+    /* Used by compiler passes to mark whether they have visited a basic block. */
+    unsigned b_visited : 1;
     /* depth of stack upon entry of block, computed by stackdepth() */
     int b_startdepth;
     /* instruction offset for block, computed by assemble_jump_offsets() */
@@ -85,7 +144,8 @@
 */
 
 enum fblocktype { WHILE_LOOP, FOR_LOOP, TRY_EXCEPT, FINALLY_TRY, FINALLY_END,
-                  WITH, ASYNC_WITH, HANDLER_CLEANUP, POP_VALUE, EXCEPTION_HANDLER };
+                  WITH, ASYNC_WITH, HANDLER_CLEANUP, POP_VALUE, EXCEPTION_HANDLER,
+                  ASYNC_COMPREHENSION_GENERATOR };
 
 struct fblockinfo {
     enum fblocktype fb_type;
@@ -141,6 +201,8 @@
     int u_firstlineno; /* the first lineno of the block */
     int u_lineno;          /* the lineno for the current stmt */
     int u_col_offset;      /* the offset of the current stmt */
+    int u_end_lineno;      /* the end line of the current stmt */
+    int u_end_col_offset;  /* the end offset of the current stmt */
 };
 
 /* This struct captures the global state of a compilation.
@@ -164,12 +226,6 @@
     int c_optimize;              /* optimization level */
     int c_interactive;           /* true if in interactive mode */
     int c_nestlevel;
-    int c_do_not_emit_bytecode;  /* The compiler won't emit any bytecode
-                                    if this value is different from zero.
-                                    This can be used to temporarily visit
-                                    nodes without emitting bytecode to
-                                    check only errors. */
-
     PyObject *c_const_cache;     /* Python dict holding all constants,
                                     including names tuple */
     struct compiler_unit *u; /* compiler state for current block */
@@ -177,14 +233,40 @@
     PyArena *c_arena;            /* pointer to memory allocation arena */
 };
 
+typedef struct {
+    // A list of strings corresponding to name captures. It is used to track:
+    // - Repeated name assignments in the same pattern.
+    // - Different name assignments in alternatives.
+    // - The order of name assignments in alternatives.
+    PyObject *stores;
+    // If 0, any name captures against our subject will raise.
+    int allow_irrefutable;
+    // An array of blocks to jump to on failure. Jumping to fail_pop[i] will pop
+    // i items off of the stack. The end result looks like this (with each block
+    // falling through to the next):
+    // fail_pop[4]: POP_TOP
+    // fail_pop[3]: POP_TOP
+    // fail_pop[2]: POP_TOP
+    // fail_pop[1]: POP_TOP
+    // fail_pop[0]: NOP
+    basicblock **fail_pop;
+    // The current length of fail_pop.
+    Py_ssize_t fail_pop_size;
+    // The number of items on top of the stack that need to *stay* on top of the
+    // stack. Variable captures go beneath these. All of them will be popped on
+    // failure.
+    Py_ssize_t on_top;
+} pattern_context;
+
 static int compiler_enter_scope(struct compiler *, identifier, int, void *, int);
 static void compiler_free(struct compiler *);
 static basicblock *compiler_new_block(struct compiler *);
 static int compiler_next_instr(basicblock *);
 static int compiler_addop(struct compiler *, int);
 static int compiler_addop_i(struct compiler *, int, Py_ssize_t);
-static int compiler_addop_j(struct compiler *, int, basicblock *, int);
-static int compiler_error(struct compiler *, const char *);
+static int compiler_addop_j(struct compiler *, int, basicblock *);
+static int compiler_addop_j_noline(struct compiler *, int, basicblock *);
+static int compiler_error(struct compiler *, const char *, ...);
 static int compiler_warn(struct compiler *, const char *, ...);
 static int compiler_nameop(struct compiler *, identifier, expr_context_ty);
 
@@ -198,30 +280,35 @@
 static int compiler_slice(struct compiler *, expr_ty);
 
 static int inplace_binop(operator_ty);
-static int are_all_items_const(asdl_seq *, Py_ssize_t, Py_ssize_t);
-static int expr_constant(expr_ty);
+static int are_all_items_const(asdl_expr_seq *, Py_ssize_t, Py_ssize_t);
+
 
 static int compiler_with(struct compiler *, stmt_ty, int);
 static int compiler_async_with(struct compiler *, stmt_ty, int);
 static int compiler_async_for(struct compiler *, stmt_ty);
 static int compiler_call_helper(struct compiler *c, int n,
-                                asdl_seq *args,
-                                asdl_seq *keywords);
+                                asdl_expr_seq *args,
+                                asdl_keyword_seq *keywords);
 static int compiler_try_except(struct compiler *, stmt_ty);
 static int compiler_set_qualname(struct compiler *);
 
 static int compiler_sync_comprehension_generator(
                                       struct compiler *c,
-                                      asdl_seq *generators, int gen_index,
+                                      asdl_comprehension_seq *generators, int gen_index,
                                       int depth,
                                       expr_ty elt, expr_ty val, int type);
 
 static int compiler_async_comprehension_generator(
                                       struct compiler *c,
-                                      asdl_seq *generators, int gen_index,
+                                      asdl_comprehension_seq *generators, int gen_index,
                                       int depth,
                                       expr_ty elt, expr_ty val, int type);
 
+static int compiler_pattern(struct compiler *, pattern_ty, pattern_context *);
+static int compiler_match(struct compiler *, stmt_ty);
+static int compiler_pattern_subpattern(struct compiler *, pattern_ty,
+                                       pattern_context *);
+
 static PyCodeObject *assemble(struct compiler *, int addNone);
 static PyObject *__doc__, *__annotations__;
 
@@ -315,8 +402,8 @@
 }
 
 PyCodeObject *
-PyAST_CompileObject(mod_ty mod, PyObject *filename, PyCompilerFlags *flags,
-                   int optimize, PyArena *arena)
+_PyAST_Compile(mod_ty mod, PyObject *filename, PyCompilerFlags *flags,
+               int optimize, PyArena *arena)
 {
     struct compiler c;
     PyCodeObject *co = NULL;
@@ -338,7 +425,7 @@
     Py_INCREF(filename);
     c.c_filename = filename;
     c.c_arena = arena;
-    c.c_future = PyFuture_FromASTObject(mod, filename);
+    c.c_future = _PyFuture_FromAST(mod, filename);
     if (c.c_future == NULL)
         goto finally;
     if (!flags) {
@@ -350,7 +437,6 @@
     c.c_flags = flags;
     c.c_optimize = (optimize == -1) ? _Py_GetConfig()->optimization_level : optimize;
     c.c_nestlevel = 0;
-    c.c_do_not_emit_bytecode = 0;
 
     _PyASTOptimizeState state;
     state.optimize = c.c_optimize;
@@ -360,7 +446,7 @@
         goto finally;
     }
 
-    c.c_st = PySymtable_BuildObject(mod, filename, c.c_future);
+    c.c_st = _PySymtable_Build(mod, filename, c.c_future);
     if (c.c_st == NULL) {
         if (!PyErr_Occurred())
             PyErr_SetString(PyExc_SystemError, "no symtable");
@@ -375,41 +461,11 @@
     return co;
 }
 
-PyCodeObject *
-PyAST_CompileEx(mod_ty mod, const char *filename_str, PyCompilerFlags *flags,
-                int optimize, PyArena *arena)
-{
-    PyObject *filename;
-    PyCodeObject *co;
-    filename = PyUnicode_DecodeFSDefault(filename_str);
-    if (filename == NULL)
-        return NULL;
-    co = PyAST_CompileObject(mod, filename, flags, optimize, arena);
-    Py_DECREF(filename);
-    return co;
-
-}
-
-PyCodeObject *
-PyNode_Compile(struct _node *n, const char *filename)
-{
-    PyCodeObject *co = NULL;
-    mod_ty mod;
-    PyArena *arena = PyArena_New();
-    if (!arena)
-        return NULL;
-    mod = PyAST_FromNode(n, NULL, filename, arena);
-    if (mod)
-        co = PyAST_Compile(mod, filename, NULL, arena);
-    PyArena_Free(arena);
-    return co;
-}
-
 static void
 compiler_free(struct compiler *c)
 {
     if (c->c_st)
-        PySymtable_Free(c->c_st);
+        _PySymtable_Free(c->c_st);
     if (c->c_future)
         PyObject_Free(c->c_future);
     Py_XDECREF(c->c_filename);
@@ -480,8 +536,8 @@
         /* XXX this should probably be a macro in symtable.h */
         long vi;
         k = PyList_GET_ITEM(sorted_keys, key_i);
-        v = PyDict_GetItem(src, k);
-        assert(PyLong_Check(v));
+        v = PyDict_GetItemWithError(src, k);
+        assert(v && PyLong_Check(v));
         vi = PyLong_AS_LONG(v);
         scope = (vi >> SCOPE_OFFSET) & SCOPE_MASK;
 
@@ -511,12 +567,10 @@
 {
     basicblock *block;
     for (block = u->u_blocks; block != NULL; block = block->b_list) {
-        assert((uintptr_t)block != 0xcbcbcbcbU);
-        assert((uintptr_t)block != 0xfbfbfbfbU);
-        assert((uintptr_t)block != 0xdbdbdbdbU);
+        assert(!_PyMem_IsPtrFreed(block));
         if (block->b_instr != NULL) {
             assert(block->b_ialloc > 0);
-            assert(block->b_iused > 0);
+            assert(block->b_iused >= 0);
             assert(block->b_ialloc >= block->b_iused);
         }
         else {
@@ -594,7 +648,7 @@
             compiler_unit_free(u);
             return 0;
         }
-        res = PyDict_SetItem(u->u_cellvars, name, _PyLong_Zero);
+        res = PyDict_SetItem(u->u_cellvars, name, _PyLong_GetZero());
         if (res < 0) {
             compiler_unit_free(u);
             return 0;
@@ -613,6 +667,8 @@
     u->u_firstlineno = lineno;
     u->u_lineno = 0;
     u->u_col_offset = 0;
+    u->u_end_lineno = 0;
+    u->u_end_col_offset = 0;
     u->u_consts = PyDict_New();
     if (!u->u_consts) {
         compiler_unit_free(u);
@@ -658,25 +714,30 @@
 static void
 compiler_exit_scope(struct compiler *c)
 {
-    Py_ssize_t n;
-    PyObject *capsule;
+    // Don't call PySequence_DelItem() with an exception raised
+    PyObject *exc_type, *exc_val, *exc_tb;
+    PyErr_Fetch(&exc_type, &exc_val, &exc_tb);
 
     c->c_nestlevel--;
     compiler_unit_free(c->u);
     /* Restore c->u to the parent unit. */
-    n = PyList_GET_SIZE(c->c_stack) - 1;
+    Py_ssize_t n = PyList_GET_SIZE(c->c_stack) - 1;
     if (n >= 0) {
-        capsule = PyList_GET_ITEM(c->c_stack, n);
+        PyObject *capsule = PyList_GET_ITEM(c->c_stack, n);
         c->u = (struct compiler_unit *)PyCapsule_GetPointer(capsule, CAPSULE_NAME);
         assert(c->u);
         /* we are deleting from a list so this really shouldn't fail */
-        if (PySequence_DelItem(c->c_stack, n) < 0)
-            Py_FatalError("compiler_exit_scope()");
+        if (PySequence_DelItem(c->c_stack, n) < 0) {
+            _PyErr_WriteUnraisableMsg("on removing the last compiler "
+                                      "stack item", NULL);
+        }
         compiler_unit_check(c->u);
     }
-    else
+    else {
         c->u = NULL;
+    }
 
+    PyErr_Restore(exc_type, exc_val, exc_tb);
 }
 
 static int
@@ -707,7 +768,7 @@
             mangled = _Py_Mangle(parent->u_private, u->u_name);
             if (!mangled)
                 return 0;
-            scope = PyST_GetScope(parent->u_ste, mangled);
+            scope = _PyST_GetScope(parent->u_ste, mangled);
             Py_DECREF(mangled);
             assert(scope != GLOBAL_IMPLICIT);
             if (scope == GLOBAL_EXPLICIT)
@@ -798,6 +859,29 @@
     return block;
 }
 
+static basicblock *
+compiler_copy_block(struct compiler *c, basicblock *block)
+{
+    /* Cannot copy a block if it has a fallthrough, since
+     * a block can only have one fallthrough predecessor.
+     */
+    assert(block->b_nofallthrough);
+    basicblock *result = compiler_new_block(c);
+    if (result == NULL) {
+        return NULL;
+    }
+    for (int i = 0; i < block->b_iused; i++) {
+        int n = compiler_next_instr(result);
+        if (n < 0) {
+            return NULL;
+        }
+        result->b_instr[n] = block->b_instr[i];
+    }
+    result->b_exit = block->b_exit;
+    result->b_nofallthrough = 1;
+    return result;
+}
+
 /* Returns the offset of the next instruction in the current block's
    b_instr array.  Resizes the b_instr as necessary.
    Returns -1 on failure.
@@ -855,7 +939,9 @@
 
 #define SET_LOC(c, x)                           \
     (c)->u->u_lineno = (x)->lineno;             \
-    (c)->u->u_col_offset = (x)->col_offset;
+    (c)->u->u_col_offset = (x)->col_offset;     \
+    (c)->u->u_end_lineno = (x)->end_lineno;     \
+    (c)->u->u_end_col_offset = (x)->end_col_offset;
 
 /* Return the stack effect of opcode with argument oparg.
 
@@ -866,8 +952,6 @@
    * 1 -- when jump
    * -1 -- maximal
  */
-/* XXX Make the stack effect of WITH_CLEANUP_START and
-   WITH_CLEANUP_FINISH deterministic. */
 static int
 stack_effect(int opcode, int oparg, int jump)
 {
@@ -1111,11 +1195,25 @@
             return 1;
         case LIST_TO_TUPLE:
             return 0;
+        case GEN_START:
+            return -1;
         case LIST_EXTEND:
         case SET_UPDATE:
         case DICT_MERGE:
         case DICT_UPDATE:
             return -1;
+        case COPY_DICT_WITHOUT_KEYS:
+            return 0;
+        case MATCH_CLASS:
+            return -1;
+        case GET_LEN:
+        case MATCH_MAPPING:
+        case MATCH_SEQUENCE:
+            return 1;
+        case MATCH_KEYS:
+            return 2;
+        case ROT_N:
+            return 0;
         default:
             return PY_INVALID_STACK_EFFECT;
     }
@@ -1139,15 +1237,12 @@
 */
 
 static int
-compiler_addop(struct compiler *c, int opcode)
+compiler_addop_line(struct compiler *c, int opcode, int line)
 {
     basicblock *b;
     struct instr *i;
     int off;
     assert(!HAS_ARG(opcode));
-    if (c->c_do_not_emit_bytecode) {
-        return 1;
-    }
     off = compiler_next_instr(c->u->u_curblock);
     if (off < 0)
         return 0;
@@ -1157,10 +1252,23 @@
     i->i_oparg = 0;
     if (opcode == RETURN_VALUE)
         b->b_return = 1;
-    i->i_lineno = c->u->u_lineno;
+    i->i_lineno = line;
     return 1;
 }
 
+static int
+compiler_addop(struct compiler *c, int opcode)
+{
+    return compiler_addop_line(c, opcode, c->u->u_lineno);
+}
+
+static int
+compiler_addop_noline(struct compiler *c, int opcode)
+{
+    return compiler_addop_line(c, opcode, -1);
+}
+
+
 static Py_ssize_t
 compiler_add_o(PyObject *dict, PyObject *o)
 {
@@ -1301,10 +1409,6 @@
 static Py_ssize_t
 compiler_add_const(struct compiler *c, PyObject *o)
 {
-    if (c->c_do_not_emit_bytecode) {
-        return 0;
-    }
-
     PyObject *key = merge_consts_recursive(c, o);
     if (key == NULL) {
         return -1;
@@ -1318,10 +1422,6 @@
 static int
 compiler_addop_load_const(struct compiler *c, PyObject *o)
 {
-    if (c->c_do_not_emit_bytecode) {
-        return 1;
-    }
-
     Py_ssize_t arg = compiler_add_const(c, o);
     if (arg < 0)
         return 0;
@@ -1332,10 +1432,6 @@
 compiler_addop_o(struct compiler *c, int opcode, PyObject *dict,
                      PyObject *o)
 {
-    if (c->c_do_not_emit_bytecode) {
-        return 1;
-    }
-
     Py_ssize_t arg = compiler_add_o(dict, o);
     if (arg < 0)
         return 0;
@@ -1348,10 +1444,6 @@
 {
     Py_ssize_t arg;
 
-    if (c->c_do_not_emit_bytecode) {
-        return 1;
-    }
-
     PyObject *mangled = _Py_Mangle(c->u->u_private, o);
     if (!mangled)
         return 0;
@@ -1367,15 +1459,11 @@
 */
 
 static int
-compiler_addop_i(struct compiler *c, int opcode, Py_ssize_t oparg)
+compiler_addop_i_line(struct compiler *c, int opcode, Py_ssize_t oparg, int lineno)
 {
     struct instr *i;
     int off;
 
-    if (c->c_do_not_emit_bytecode) {
-        return 1;
-    }
-
     /* oparg value is unsigned, but a signed C int is usually used to store
        it in the C code (like Python/ceval.c).
 
@@ -1392,36 +1480,51 @@
     i = &c->u->u_curblock->b_instr[off];
     i->i_opcode = opcode;
     i->i_oparg = Py_SAFE_DOWNCAST(oparg, Py_ssize_t, int);
-    i->i_lineno = c->u->u_lineno;
+    i->i_lineno = lineno;
     return 1;
 }
 
 static int
-compiler_addop_j(struct compiler *c, int opcode, basicblock *b, int absolute)
+compiler_addop_i(struct compiler *c, int opcode, Py_ssize_t oparg)
 {
-    struct instr *i;
-    int off;
+    return compiler_addop_i_line(c, opcode, oparg, c->u->u_lineno);
+}
 
-    if (c->c_do_not_emit_bytecode) {
-        return 1;
-    }
+static int
+compiler_addop_i_noline(struct compiler *c, int opcode, Py_ssize_t oparg)
+{
+    return compiler_addop_i_line(c, opcode, oparg, -1);
+}
 
+static int add_jump_to_block(basicblock *b, int opcode, int lineno, basicblock *target)
+{
     assert(HAS_ARG(opcode));
     assert(b != NULL);
-    off = compiler_next_instr(c->u->u_curblock);
-    if (off < 0)
+    assert(target != NULL);
+
+    int off = compiler_next_instr(b);
+    struct instr *i = &b->b_instr[off];
+    if (off < 0) {
         return 0;
-    i = &c->u->u_curblock->b_instr[off];
+    }
     i->i_opcode = opcode;
-    i->i_target = b;
-    if (absolute)
-        i->i_jabs = 1;
-    else
-        i->i_jrel = 1;
-    i->i_lineno = c->u->u_lineno;
+    i->i_target = target;
+    i->i_lineno = lineno;
     return 1;
 }
 
+static int
+compiler_addop_j(struct compiler *c, int opcode, basicblock *b)
+{
+    return add_jump_to_block(c->u->u_curblock, opcode, c->u->u_lineno, b);
+}
+
+static int
+compiler_addop_j_noline(struct compiler *c, int opcode, basicblock *b)
+{
+    return add_jump_to_block(c->u->u_curblock, opcode, -1, b);
+}
+
 /* NEXT_BLOCK() creates an implicit jump from the current block
    to the new block.
 
@@ -1438,6 +1541,11 @@
         return 0; \
 }
 
+#define ADDOP_NOLINE(C, OP) { \
+    if (!compiler_addop_noline((C), (OP))) \
+        return 0; \
+}
+
 #define ADDOP_IN_SCOPE(C, OP) { \
     if (!compiler_addop((C), (OP))) { \
         compiler_exit_scope(c); \
@@ -1464,12 +1572,14 @@
 }
 
 #define ADDOP_O(C, OP, O, TYPE) { \
+    assert((OP) != LOAD_CONST); /* use ADDOP_LOAD_CONST */ \
     if (!compiler_addop_o((C), (OP), (C)->u->u_ ## TYPE, (O))) \
         return 0; \
 }
 
 /* Same as ADDOP_O, but steals a reference. */
 #define ADDOP_N(C, OP, O, TYPE) { \
+    assert((OP) != LOAD_CONST); /* use ADDOP_LOAD_CONST_NEW */ \
     if (!compiler_addop_o((C), (OP), (C)->u->u_ ## TYPE, (O))) { \
         Py_DECREF((O)); \
         return 0; \
@@ -1487,16 +1597,23 @@
         return 0; \
 }
 
-#define ADDOP_JABS(C, OP, O) { \
-    if (!compiler_addop_j((C), (OP), (O), 1)) \
+#define ADDOP_I_NOLINE(C, OP, O) { \
+    if (!compiler_addop_i_noline((C), (OP), (O))) \
         return 0; \
 }
 
-#define ADDOP_JREL(C, OP, O) { \
-    if (!compiler_addop_j((C), (OP), (O), 0)) \
+#define ADDOP_JUMP(C, OP, O) { \
+    if (!compiler_addop_j((C), (OP), (O))) \
         return 0; \
 }
 
+/* Add a jump with no line number.
+ * Used for artificial jumps that have no corresponding
+ * token in the source code. */
+#define ADDOP_JUMP_NOLINE(C, OP, O) { \
+    if (!compiler_addop_j_noline((C), (OP), (O))) \
+        return 0; \
+}
 
 #define ADDOP_COMPARE(C, CMP) { \
     if (!compiler_addcompare((C), (cmpop_ty)(CMP))) \
@@ -1526,7 +1643,7 @@
 
 #define VISIT_SEQ(C, TYPE, SEQ) { \
     int _i; \
-    asdl_seq *seq = (SEQ); /* avoid variable capture */ \
+    asdl_ ## TYPE ## _seq *seq = (SEQ); /* avoid variable capture */ \
     for (_i = 0; _i < asdl_seq_LEN(seq); _i++) { \
         TYPE ## _ty elt = (TYPE ## _ty)asdl_seq_GET(seq, _i); \
         if (!compiler_visit_ ## TYPE((C), elt)) \
@@ -1536,7 +1653,7 @@
 
 #define VISIT_SEQ_IN_SCOPE(C, TYPE, SEQ) { \
     int _i; \
-    asdl_seq *seq = (SEQ); /* avoid variable capture */ \
+    asdl_ ## TYPE ## _seq *seq = (SEQ); /* avoid variable capture */ \
     for (_i = 0; _i < asdl_seq_LEN(seq); _i++) { \
         TYPE ## _ty elt = (TYPE ## _ty)asdl_seq_GET(seq, _i); \
         if (!compiler_visit_ ## TYPE((C), elt)) { \
@@ -1546,21 +1663,15 @@
     } \
 }
 
-/* These macros allows to check only for errors and not emmit bytecode
- * while visiting nodes.
-*/
-
-#define BEGIN_DO_NOT_EMIT_BYTECODE { \
-    c->c_do_not_emit_bytecode++;
-
-#define END_DO_NOT_EMIT_BYTECODE \
-    c->c_do_not_emit_bytecode--; \
-}
+#define RETURN_IF_FALSE(X)  \
+    if (!(X)) {             \
+        return 0;           \
+    }
 
 /* Search if variable annotations are present statically in a block. */
 
 static int
-find_ann(asdl_seq *stmts)
+find_ann(asdl_stmt_seq *stmts)
 {
     int i, j, res = 0;
     stmt_ty st;
@@ -1646,7 +1757,7 @@
 
 static int
 compiler_call_exit_with_nones(struct compiler *c) {
-    ADDOP_O(c, LOAD_CONST, Py_None, consts);
+    ADDOP_LOAD_CONST(c, Py_None);
     ADDOP(c, DUP_TOP);
     ADDOP(c, DUP_TOP);
     ADDOP_I(c, CALL_FUNCTION, 3);
@@ -1665,6 +1776,7 @@
     switch (info->fb_type) {
         case WHILE_LOOP:
         case EXCEPTION_HANDLER:
+        case ASYNC_COMPREHENSION_GENERATOR:
             return 1;
 
         case FOR_LOOP:
@@ -1680,19 +1792,22 @@
             return 1;
 
         case FINALLY_TRY:
+            /* This POP_BLOCK gets the line number of the unwinding statement */
             ADDOP(c, POP_BLOCK);
             if (preserve_tos) {
                 if (!compiler_push_fblock(c, POP_VALUE, NULL, NULL, NULL)) {
                     return 0;
                 }
             }
-            /* Emit the finally block, restoring the line number when done */
-            int saved_lineno = c->u->u_lineno;
+            /* Emit the finally block */
             VISIT_SEQ(c, stmt, info->fb_datum);
-            c->u->u_lineno = saved_lineno;
             if (preserve_tos) {
                 compiler_pop_fblock(c, POP_VALUE, NULL);
             }
+            /* The finally block should appear to execute after the
+             * statement causing the unwinding, so make the unwinding
+             * instruction artificial */
+            c->u->u_lineno = -1;
             return 1;
 
         case FINALLY_END:
@@ -1710,6 +1825,7 @@
 
         case WITH:
         case ASYNC_WITH:
+            SET_LOC(c, (stmt_ty)info->fb_datum);
             ADDOP(c, POP_BLOCK);
             if (preserve_tos) {
                 ADDOP(c, ROT_TWO);
@@ -1723,6 +1839,10 @@
                 ADDOP(c, YIELD_FROM);
             }
             ADDOP(c, POP_TOP);
+            /* The exit block should appear to execute after the
+             * statement causing the unwinding, so make the unwinding
+             * instruction artificial */
+            c->u->u_lineno = -1;
             return 1;
 
         case HANDLER_CLEANUP:
@@ -1778,7 +1898,7 @@
    and for annotations. */
 
 static int
-compiler_body(struct compiler *c, asdl_seq *stmts)
+compiler_body(struct compiler *c, asdl_stmt_seq *stmts)
 {
     int i = 0;
     stmt_ty st;
@@ -1827,7 +1947,7 @@
             return NULL;
     }
     /* Use 0 for firstlineno initially, will fixup in assemble(). */
-    if (!compiler_enter_scope(c, module, COMPILER_SCOPE_MODULE, mod, 0))
+    if (!compiler_enter_scope(c, module, COMPILER_SCOPE_MODULE, mod, 1))
         return NULL;
     switch (mod->kind) {
     case Module_kind:
@@ -1841,8 +1961,7 @@
             ADDOP(c, SETUP_ANNOTATIONS);
         }
         c->c_interactive = 1;
-        VISIT_SEQ_IN_SCOPE(c, stmt,
-                                mod->v.Interactive.body);
+        VISIT_SEQ_IN_SCOPE(c, stmt, mod->v.Interactive.body);
         break;
     case Expression_kind:
         VISIT_IN_SCOPE(c, expr, mod->v.Expression.body);
@@ -1871,19 +1990,17 @@
     if (c->u->u_scope_type == COMPILER_SCOPE_CLASS &&
         _PyUnicode_EqualToASCIIString(name, "__class__"))
         return CELL;
-    scope = PyST_GetScope(c->u->u_ste, name);
+    scope = _PyST_GetScope(c->u->u_ste, name);
     if (scope == 0) {
-        _Py_FatalErrorFormat(__func__,
-           "unknown scope for %.100s in %.100s(%s)\n"
-           "symbols: %s\nlocals: %s\nglobals: %s",
-           PyUnicode_AsUTF8(name),
-           PyUnicode_AsUTF8(c->u->u_name),
-           PyUnicode_AsUTF8(PyObject_Repr(c->u->u_ste->ste_id)),
-           PyUnicode_AsUTF8(PyObject_Repr(c->u->u_ste->ste_symbols)),
-           PyUnicode_AsUTF8(PyObject_Repr(c->u->u_varnames)),
-           PyUnicode_AsUTF8(PyObject_Repr(c->u->u_names)));
+        PyErr_Format(PyExc_SystemError,
+                     "_PyST_GetScope(name=%R) failed: "
+                     "unknown scope in unit %S (%R); "
+                     "symbols: %R; locals: %R; globals: %R",
+                     name,
+                     c->u->u_name, c->u->u_ste->ste_id,
+                     c->u->u_ste->ste_symbols, c->u->u_varnames, c->u->u_names);
+        return -1;
     }
-
     return scope;
 }
 
@@ -1891,14 +2008,15 @@
 compiler_lookup_arg(PyObject *dict, PyObject *name)
 {
     PyObject *v;
-    v = PyDict_GetItem(dict, name);
+    v = PyDict_GetItemWithError(dict, name);
     if (v == NULL)
         return -1;
     return PyLong_AS_LONG(v);
 }
 
 static int
-compiler_make_closure(struct compiler *c, PyCodeObject *co, Py_ssize_t flags, PyObject *qualname)
+compiler_make_closure(struct compiler *c, PyCodeObject *co, Py_ssize_t flags,
+                      PyObject *qualname)
 {
     Py_ssize_t i, free = PyCode_GetNumFree(co);
     if (qualname == NULL)
@@ -1910,7 +2028,6 @@
                LOAD_DEREF but LOAD_CLOSURE is needed.
             */
             PyObject *name = PyTuple_GET_ITEM(co->co_freevars, i);
-            int arg, reftype;
 
             /* Special case: If a class contains a method with a
                free variable that has the same name as a method,
@@ -1918,20 +2035,27 @@
                class.  It should be handled by the closure, as
                well as by the normal name lookup logic.
             */
-            reftype = get_ref_type(c, name);
-            if (reftype == CELL)
+            int reftype = get_ref_type(c, name);
+            if (reftype == -1) {
+                return 0;
+            }
+            int arg;
+            if (reftype == CELL) {
                 arg = compiler_lookup_arg(c->u->u_cellvars, name);
-            else /* (reftype == FREE) */
+            }
+            else {
                 arg = compiler_lookup_arg(c->u->u_freevars, name);
+            }
             if (arg == -1) {
-                _Py_FatalErrorFormat(__func__,
-                    "lookup %s in %s %d %d\n"
-                    "freevars of %s: %s\n",
-                    PyUnicode_AsUTF8(PyObject_Repr(name)),
-                    PyUnicode_AsUTF8(c->u->u_name),
-                    reftype, arg,
-                    PyUnicode_AsUTF8(co->co_name),
-                    PyUnicode_AsUTF8(PyObject_Repr(co->co_freevars)));
+                PyErr_Format(PyExc_SystemError,
+                    "compiler_lookup_arg(name=%R) with reftype=%d failed in %S; "
+                    "freevars of code %S: %R",
+                    name,
+                    reftype,
+                    c->u->u_name,
+                    co->co_name,
+                    co->co_freevars);
+                return 0;
             }
             ADDOP_I(c, LOAD_CLOSURE, arg);
         }
@@ -1945,7 +2069,7 @@
 }
 
 static int
-compiler_decorators(struct compiler *c, asdl_seq* decos)
+compiler_decorators(struct compiler *c, asdl_expr_seq* decos)
 {
     int i;
 
@@ -1959,8 +2083,8 @@
 }
 
 static int
-compiler_visit_kwonlydefaults(struct compiler *c, asdl_seq *kwonlyargs,
-                              asdl_seq *kw_defaults)
+compiler_visit_kwonlydefaults(struct compiler *c, asdl_arg_seq *kwonlyargs,
+                              asdl_expr_seq *kw_defaults)
 {
     /* Push a dict of keyword-only default values.
 
@@ -2024,31 +2148,32 @@
 
 static int
 compiler_visit_argannotation(struct compiler *c, identifier id,
-    expr_ty annotation, PyObject *names)
+    expr_ty annotation, Py_ssize_t *annotations_len)
 {
-    if (annotation) {
-        PyObject *mangled;
-        if (c->c_future->ff_features & CO_FUTURE_ANNOTATIONS) {
-            VISIT(c, annexpr, annotation)
-        }
-        else {
-            VISIT(c, expr, annotation);
-        }
-        mangled = _Py_Mangle(c->u->u_private, id);
-        if (!mangled)
-            return 0;
-        if (PyList_Append(names, mangled) < 0) {
-            Py_DECREF(mangled);
-            return 0;
-        }
-        Py_DECREF(mangled);
+    if (!annotation) {
+        return 1;
     }
+
+    PyObject *mangled = _Py_Mangle(c->u->u_private, id);
+    if (!mangled) {
+        return 0;
+    }
+    ADDOP_LOAD_CONST(c, mangled);
+    Py_DECREF(mangled);
+
+    if (c->c_future->ff_features & CO_FUTURE_ANNOTATIONS) {
+        VISIT(c, annexpr, annotation)
+    }
+    else {
+        VISIT(c, expr, annotation);
+    }
+    *annotations_len += 2;
     return 1;
 }
 
 static int
-compiler_visit_argannotations(struct compiler *c, asdl_seq* args,
-                              PyObject *names)
+compiler_visit_argannotations(struct compiler *c, asdl_arg_seq* args,
+                              Py_ssize_t *annotations_len)
 {
     int i;
     for (i = 0; i < asdl_seq_LEN(args); i++) {
@@ -2057,7 +2182,7 @@
                         c,
                         arg->arg,
                         arg->annotation,
-                        names))
+                        annotations_len))
             return 0;
     }
     return 1;
@@ -2067,58 +2192,44 @@
 compiler_visit_annotations(struct compiler *c, arguments_ty args,
                            expr_ty returns)
 {
-    /* Push arg annotation dict.
+    /* Push arg annotation names and values.
        The expressions are evaluated out-of-order wrt the source code.
 
-       Return 0 on error, -1 if no dict pushed, 1 if a dict is pushed.
+       Return 0 on error, -1 if no annotations pushed, 1 if a annotations is pushed.
        */
     static identifier return_str;
-    PyObject *names;
-    Py_ssize_t len;
-    names = PyList_New(0);
-    if (!names)
-        return 0;
+    Py_ssize_t annotations_len = 0;
 
-    if (!compiler_visit_argannotations(c, args->args, names))
-        goto error;
-    if (!compiler_visit_argannotations(c, args->posonlyargs, names))
-        goto error;
+    if (!compiler_visit_argannotations(c, args->args, &annotations_len))
+        return 0;
+    if (!compiler_visit_argannotations(c, args->posonlyargs, &annotations_len))
+        return 0;
     if (args->vararg && args->vararg->annotation &&
         !compiler_visit_argannotation(c, args->vararg->arg,
-                                     args->vararg->annotation, names))
-        goto error;
-    if (!compiler_visit_argannotations(c, args->kwonlyargs, names))
-        goto error;
+                                     args->vararg->annotation, &annotations_len))
+        return 0;
+    if (!compiler_visit_argannotations(c, args->kwonlyargs, &annotations_len))
+        return 0;
     if (args->kwarg && args->kwarg->annotation &&
         !compiler_visit_argannotation(c, args->kwarg->arg,
-                                     args->kwarg->annotation, names))
-        goto error;
+                                     args->kwarg->annotation, &annotations_len))
+        return 0;
 
     if (!return_str) {
         return_str = PyUnicode_InternFromString("return");
         if (!return_str)
-            goto error;
+            return 0;
     }
-    if (!compiler_visit_argannotation(c, return_str, returns, names)) {
-        goto error;
+    if (!compiler_visit_argannotation(c, return_str, returns, &annotations_len)) {
+        return 0;
     }
 
-    len = PyList_GET_SIZE(names);
-    if (len) {
-        PyObject *keytuple = PyList_AsTuple(names);
-        Py_DECREF(names);
-        ADDOP_LOAD_CONST_NEW(c, keytuple);
-        ADDOP_I(c, BUILD_CONST_KEY_MAP, len);
+    if (annotations_len) {
+        ADDOP_I(c, BUILD_TUPLE, annotations_len);
         return 1;
     }
-    else {
-        Py_DECREF(names);
-        return -1;
-    }
 
-error:
-    Py_DECREF(names);
-    return 0;
+    return -1;
 }
 
 static int
@@ -2159,6 +2270,10 @@
         compiler_error(c, "cannot assign to __debug__");
         return 1;
     }
+    if (ctx == Del && _PyUnicode_EqualToASCIIString(name, "__debug__")) {
+        compiler_error(c, "cannot delete __debug__");
+        return 1;
+    }
     return 0;
 }
 
@@ -2173,7 +2288,7 @@
 }
 
 static int
-compiler_check_debug_args_seq(struct compiler *c, asdl_seq *args)
+compiler_check_debug_args_seq(struct compiler *c, asdl_arg_seq *args)
 {
     if (args != NULL) {
         for (Py_ssize_t i = 0, n = asdl_seq_LEN(args); i < n; i++) {
@@ -2208,8 +2323,8 @@
     arguments_ty args;
     expr_ty returns;
     identifier name;
-    asdl_seq* decos;
-    asdl_seq *body;
+    asdl_expr_seq* decos;
+    asdl_stmt_seq *body;
     Py_ssize_t i, funcflags;
     int annotations;
     int scope_type;
@@ -2277,7 +2392,9 @@
     c->u->u_argcount = asdl_seq_LEN(args->args);
     c->u->u_posonlyargcount = asdl_seq_LEN(args->posonlyargs);
     c->u->u_kwonlyargcount = asdl_seq_LEN(args->kwonlyargs);
-    VISIT_SEQ_IN_SCOPE(c, stmt, body);
+    for (i = docstring ? 1 : 0; i < asdl_seq_LEN(body); i++) {
+        VISIT_IN_SCOPE(c, stmt, (stmt_ty)asdl_seq_GET(body, i));
+    }
     co = assemble(c, 1);
     qualname = c->u->u_qualname;
     Py_INCREF(qualname);
@@ -2288,7 +2405,11 @@
         return 0;
     }
 
-    compiler_make_closure(c, co, funcflags, qualname);
+    if (!compiler_make_closure(c, co, funcflags, qualname)) {
+        Py_DECREF(qualname);
+        Py_DECREF(co);
+        return 0;
+    }
     Py_DECREF(qualname);
     Py_DECREF(co);
 
@@ -2306,7 +2427,7 @@
     PyCodeObject *co;
     PyObject *str;
     int i, firstlineno;
-    asdl_seq* decos = s->v.ClassDef.decorator_list;
+    asdl_expr_seq *decos = s->v.ClassDef.decorator_list;
 
     if (!compiler_decorators(c, decos))
         return 0;
@@ -2319,9 +2440,8 @@
     /* ultimately generate code for:
          <name> = __build_class__(<func>, <name>, *<bases>, **<keywords>)
        where:
-         <func> is a function/closure created from the class body;
-            it has a single argument (__locals__) where the dict
-            (or MutableSequence) representing the locals is passed
+         <func> is a zero arg function/closure created from the class body.
+            It mutates its locals to build the class namespace.
          <name> is the class name
          <bases> is the positional arguments and *varargs argument
          <keywords> is the keyword arguments and **kwds argument
@@ -2367,6 +2487,8 @@
             compiler_exit_scope(c);
             return 0;
         }
+        /* The following code is artificial */
+        c->u->u_lineno = -1;
         /* Return __classcell__ if it is referenced, otherwise return None */
         if (c->u->u_ste->ste_needs_class_closure) {
             /* Store __classcell__ into class namespace & return it */
@@ -2411,16 +2533,17 @@
     ADDOP(c, LOAD_BUILD_CLASS);
 
     /* 3. load a function (or closure) made from the code object */
-    compiler_make_closure(c, co, 0, NULL);
+    if (!compiler_make_closure(c, co, 0, NULL)) {
+        Py_DECREF(co);
+        return 0;
+    }
     Py_DECREF(co);
 
     /* 4. load class name */
     ADDOP_LOAD_CONST(c, s->v.ClassDef.name);
 
     /* 5. generate the rest of the code for the call */
-    if (!compiler_call_helper(c, 2,
-                              s->v.ClassDef.bases,
-                              s->v.ClassDef.keywords))
+    if (!compiler_call_helper(c, 2, s->v.ClassDef.bases, s->v.ClassDef.keywords))
         return 0;
 
     /* 6. apply decorators */
@@ -2528,7 +2651,7 @@
         /* fallback to general implementation */
         break;
     case BoolOp_kind: {
-        asdl_seq *s = e->v.BoolOp.values;
+        asdl_expr_seq *s = e->v.BoolOp.values;
         Py_ssize_t i, n = asdl_seq_LEN(s) - 1;
         assert(n >= 0);
         int cond2 = e->v.BoolOp.op == Or;
@@ -2560,7 +2683,7 @@
             return 0;
         if (!compiler_jump_if(c, e->v.IfExp.body, next, cond))
             return 0;
-        ADDOP_JREL(c, JUMP_FORWARD, end);
+        ADDOP_JUMP_NOLINE(c, JUMP_FORWARD, end);
         compiler_use_next_block(c, next2);
         if (!compiler_jump_if(c, e->v.IfExp.orelse, next, cond))
             return 0;
@@ -2583,20 +2706,21 @@
                 ADDOP(c, DUP_TOP);
                 ADDOP(c, ROT_THREE);
                 ADDOP_COMPARE(c, asdl_seq_GET(e->v.Compare.ops, i));
-                ADDOP_JABS(c, POP_JUMP_IF_FALSE, cleanup);
+                ADDOP_JUMP(c, POP_JUMP_IF_FALSE, cleanup);
                 NEXT_BLOCK(c);
             }
             VISIT(c, expr, (expr_ty)asdl_seq_GET(e->v.Compare.comparators, n));
             ADDOP_COMPARE(c, asdl_seq_GET(e->v.Compare.ops, n));
-            ADDOP_JABS(c, cond ? POP_JUMP_IF_TRUE : POP_JUMP_IF_FALSE, next);
+            ADDOP_JUMP(c, cond ? POP_JUMP_IF_TRUE : POP_JUMP_IF_FALSE, next);
+            NEXT_BLOCK(c);
             basicblock *end = compiler_new_block(c);
             if (end == NULL)
                 return 0;
-            ADDOP_JREL(c, JUMP_FORWARD, end);
+            ADDOP_JUMP_NOLINE(c, JUMP_FORWARD, end);
             compiler_use_next_block(c, cleanup);
             ADDOP(c, POP_TOP);
             if (!cond) {
-                ADDOP_JREL(c, JUMP_FORWARD, next);
+                ADDOP_JUMP_NOLINE(c, JUMP_FORWARD, next);
             }
             compiler_use_next_block(c, end);
             return 1;
@@ -2611,7 +2735,8 @@
 
     /* general implementation */
     VISIT(c, expr, e);
-    ADDOP_JABS(c, cond ? POP_JUMP_IF_TRUE : POP_JUMP_IF_FALSE, next);
+    ADDOP_JUMP(c, cond ? POP_JUMP_IF_TRUE : POP_JUMP_IF_FALSE, next);
+    NEXT_BLOCK(c);
     return 1;
 }
 
@@ -2630,7 +2755,7 @@
     if (!compiler_jump_if(c, e->v.IfExp.test, next, 0))
         return 0;
     VISIT(c, expr, e->v.IfExp.body);
-    ADDOP_JREL(c, JUMP_FORWARD, end);
+    ADDOP_JUMP_NOLINE(c, JUMP_FORWARD, end);
     compiler_use_next_block(c, next);
     VISIT(c, expr, e->v.IfExp.orelse);
     compiler_use_next_block(c, end);
@@ -2684,10 +2809,16 @@
     qualname = c->u->u_qualname;
     Py_INCREF(qualname);
     compiler_exit_scope(c);
-    if (co == NULL)
+    if (co == NULL) {
+        Py_DECREF(qualname);
         return 0;
+    }
 
-    compiler_make_closure(c, co, funcflags, qualname);
+    if (!compiler_make_closure(c, co, funcflags, qualname)) {
+        Py_DECREF(qualname);
+        Py_DECREF(co);
+        return 0;
+    }
     Py_DECREF(qualname);
     Py_DECREF(co);
 
@@ -2698,48 +2829,28 @@
 compiler_if(struct compiler *c, stmt_ty s)
 {
     basicblock *end, *next;
-    int constant;
     assert(s->kind == If_kind);
     end = compiler_new_block(c);
-    if (end == NULL)
+    if (end == NULL) {
         return 0;
-
-    constant = expr_constant(s->v.If.test);
-    /* constant = 0: "if 0"
-     * constant = 1: "if 1", "if 2", ...
-     * constant = -1: rest */
-    if (constant == 0) {
-        BEGIN_DO_NOT_EMIT_BYTECODE
-        VISIT_SEQ(c, stmt, s->v.If.body);
-        END_DO_NOT_EMIT_BYTECODE
-        if (s->v.If.orelse) {
-            VISIT_SEQ(c, stmt, s->v.If.orelse);
-        }
-    } else if (constant == 1) {
-        VISIT_SEQ(c, stmt, s->v.If.body);
-        if (s->v.If.orelse) {
-            BEGIN_DO_NOT_EMIT_BYTECODE
-            VISIT_SEQ(c, stmt, s->v.If.orelse);
-            END_DO_NOT_EMIT_BYTECODE
-        }
-    } else {
-        if (asdl_seq_LEN(s->v.If.orelse)) {
-            next = compiler_new_block(c);
-            if (next == NULL)
-                return 0;
-        }
-        else {
-            next = end;
-        }
-        if (!compiler_jump_if(c, s->v.If.test, next, 0)) {
+    }
+    if (asdl_seq_LEN(s->v.If.orelse)) {
+        next = compiler_new_block(c);
+        if (next == NULL) {
             return 0;
         }
-        VISIT_SEQ(c, stmt, s->v.If.body);
-        if (asdl_seq_LEN(s->v.If.orelse)) {
-            ADDOP_JREL(c, JUMP_FORWARD, end);
-            compiler_use_next_block(c, next);
-            VISIT_SEQ(c, stmt, s->v.If.orelse);
-        }
+    }
+    else {
+        next = end;
+    }
+    if (!compiler_jump_if(c, s->v.If.test, next, 0)) {
+        return 0;
+    }
+    VISIT_SEQ(c, stmt, s->v.If.body);
+    if (asdl_seq_LEN(s->v.If.orelse)) {
+        ADDOP_JUMP_NOLINE(c, JUMP_FORWARD, end);
+        compiler_use_next_block(c, next);
+        VISIT_SEQ(c, stmt, s->v.If.orelse);
     }
     compiler_use_next_block(c, end);
     return 1;
@@ -2748,12 +2859,13 @@
 static int
 compiler_for(struct compiler *c, stmt_ty s)
 {
-    basicblock *start, *cleanup, *end;
+    basicblock *start, *body, *cleanup, *end;
 
     start = compiler_new_block(c);
+    body = compiler_new_block(c);
     cleanup = compiler_new_block(c);
     end = compiler_new_block(c);
-    if (start == NULL || end == NULL || cleanup == NULL) {
+    if (start == NULL || body == NULL || end == NULL || cleanup == NULL) {
         return 0;
     }
     if (!compiler_push_fblock(c, FOR_LOOP, start, end, NULL)) {
@@ -2762,10 +2874,13 @@
     VISIT(c, expr, s->v.For.iter);
     ADDOP(c, GET_ITER);
     compiler_use_next_block(c, start);
-    ADDOP_JREL(c, FOR_ITER, cleanup);
+    ADDOP_JUMP(c, FOR_ITER, cleanup);
+    compiler_use_next_block(c, body);
     VISIT(c, expr, s->v.For.target);
     VISIT_SEQ(c, stmt, s->v.For.body);
-    ADDOP_JABS(c, JUMP_ABSOLUTE, start);
+    /* Mark jump as artificial */
+    c->u->u_lineno = -1;
+    ADDOP_JUMP(c, JUMP_ABSOLUTE, start);
     compiler_use_next_block(c, cleanup);
 
     compiler_pop_fblock(c, FOR_LOOP, start);
@@ -2801,7 +2916,7 @@
         return 0;
     }
     /* SETUP_FINALLY to guard the __anext__ call */
-    ADDOP_JREL(c, SETUP_FINALLY, except);
+    ADDOP_JUMP(c, SETUP_FINALLY, except);
     ADDOP(c, GET_ANEXT);
     ADDOP_LOAD_CONST(c, Py_None);
     ADDOP(c, YIELD_FROM);
@@ -2810,12 +2925,16 @@
     /* Success block for __anext__ */
     VISIT(c, expr, s->v.AsyncFor.target);
     VISIT_SEQ(c, stmt, s->v.AsyncFor.body);
-    ADDOP_JABS(c, JUMP_ABSOLUTE, start);
+    ADDOP_JUMP(c, JUMP_ABSOLUTE, start);
 
     compiler_pop_fblock(c, FOR_LOOP, start);
 
     /* Except block for __anext__ */
     compiler_use_next_block(c, except);
+
+    /* Use same line number as the iterator,
+     * as the END_ASYNC_FOR succeeds the `for`, not the body. */
+    SET_LOC(c, s->v.AsyncFor.iter);
     ADDOP(c, END_ASYNC_FOR);
 
     /* `else` block */
@@ -2829,63 +2948,35 @@
 static int
 compiler_while(struct compiler *c, stmt_ty s)
 {
-    basicblock *loop, *orelse, *end, *anchor = NULL;
-    int constant = expr_constant(s->v.While.test);
-
-    if (constant == 0) {
-        BEGIN_DO_NOT_EMIT_BYTECODE
-        // Push a dummy block so the VISIT_SEQ knows that we are
-        // inside a while loop so it can correctly evaluate syntax
-        // errors.
-        if (!compiler_push_fblock(c, WHILE_LOOP, NULL, NULL, NULL)) {
-            return 0;
-        }
-        VISIT_SEQ(c, stmt, s->v.While.body);
-        // Remove the dummy block now that is not needed.
-        compiler_pop_fblock(c, WHILE_LOOP, NULL);
-        END_DO_NOT_EMIT_BYTECODE
-        if (s->v.While.orelse) {
-            VISIT_SEQ(c, stmt, s->v.While.orelse);
-        }
-        return 1;
-    }
+    basicblock *loop, *body, *end, *anchor = NULL;
     loop = compiler_new_block(c);
+    body = compiler_new_block(c);
+    anchor = compiler_new_block(c);
     end = compiler_new_block(c);
-    if (constant == -1) {
-        anchor = compiler_new_block(c);
-        if (anchor == NULL)
-            return 0;
-    }
-    if (loop == NULL || end == NULL)
+    if (loop == NULL || body == NULL || anchor == NULL || end == NULL) {
         return 0;
-    if (s->v.While.orelse) {
-        orelse = compiler_new_block(c);
-        if (orelse == NULL)
-            return 0;
     }
-    else
-        orelse = NULL;
-
     compiler_use_next_block(c, loop);
-    if (!compiler_push_fblock(c, WHILE_LOOP, loop, end, NULL))
+    if (!compiler_push_fblock(c, WHILE_LOOP, loop, end, NULL)) {
         return 0;
-    if (constant == -1) {
-        if (!compiler_jump_if(c, s->v.While.test, anchor, 0))
-            return 0;
     }
+    if (!compiler_jump_if(c, s->v.While.test, anchor, 0)) {
+        return 0;
+    }
+
+    compiler_use_next_block(c, body);
     VISIT_SEQ(c, stmt, s->v.While.body);
-    ADDOP_JABS(c, JUMP_ABSOLUTE, loop);
+    SET_LOC(c, s);
+    if (!compiler_jump_if(c, s->v.While.test, body, 1)) {
+        return 0;
+    }
 
-    /* XXX should the two POP instructions be in a separate block
-       if there is no else clause ?
-    */
-
-    if (constant == -1)
-        compiler_use_next_block(c, anchor);
     compiler_pop_fblock(c, WHILE_LOOP, loop);
 
-    if (orelse != NULL) /* what if orelse is just pass? */
+    compiler_use_next_block(c, anchor);
+    if (s->v.While.orelse) {
         VISIT_SEQ(c, stmt, s->v.While.orelse);
+    }
     compiler_use_next_block(c, end);
 
     return 1;
@@ -2906,16 +2997,28 @@
     }
     if (preserve_tos) {
         VISIT(c, expr, s->v.Return.value);
+    } else {
+        /* Emit instruction with line number for return value */
+        if (s->v.Return.value != NULL) {
+            SET_LOC(c, s->v.Return.value);
+            ADDOP(c, NOP);
+        }
     }
+    if (s->v.Return.value == NULL || s->v.Return.value->lineno != s->lineno) {
+        SET_LOC(c, s);
+        ADDOP(c, NOP);
+    }
+
     if (!compiler_unwind_fblock_stack(c, preserve_tos, NULL))
         return 0;
     if (s->v.Return.value == NULL) {
         ADDOP_LOAD_CONST(c, Py_None);
     }
     else if (!preserve_tos) {
-        VISIT(c, expr, s->v.Return.value);
+        ADDOP_LOAD_CONST(c, s->v.Return.value->v.Constant.value);
     }
     ADDOP(c, RETURN_VALUE);
+    NEXT_BLOCK(c);
 
     return 1;
 }
@@ -2924,6 +3027,8 @@
 compiler_break(struct compiler *c)
 {
     struct fblockinfo *loop = NULL;
+    /* Emit instruction with line number */
+    ADDOP(c, NOP);
     if (!compiler_unwind_fblock_stack(c, 0, &loop)) {
         return 0;
     }
@@ -2933,7 +3038,8 @@
     if (!compiler_unwind_fblock(c, loop, 0)) {
         return 0;
     }
-    ADDOP_JABS(c, JUMP_ABSOLUTE, loop->fb_exit);
+    ADDOP_JUMP(c, JUMP_ABSOLUTE, loop->fb_exit);
+    NEXT_BLOCK(c);
     return 1;
 }
 
@@ -2941,13 +3047,16 @@
 compiler_continue(struct compiler *c)
 {
     struct fblockinfo *loop = NULL;
+    /* Emit instruction with line number */
+    ADDOP(c, NOP);
     if (!compiler_unwind_fblock_stack(c, 0, &loop)) {
         return 0;
     }
     if (loop == NULL) {
         return compiler_error(c, "'continue' not properly in loop");
     }
-    ADDOP_JABS(c, JUMP_ABSOLUTE, loop->fb_block);
+    ADDOP_JUMP(c, JUMP_ABSOLUTE, loop->fb_block);
+    NEXT_BLOCK(c)
     return 1;
 }
 
@@ -2993,7 +3102,7 @@
         return 0;
 
     /* `try` block */
-    ADDOP_JREL(c, SETUP_FINALLY, end);
+    ADDOP_JUMP(c, SETUP_FINALLY, end);
     compiler_use_next_block(c, body);
     if (!compiler_push_fblock(c, FINALLY_TRY, body, end, s->v.Try.finalbody))
         return 0;
@@ -3004,17 +3113,17 @@
     else {
         VISIT_SEQ(c, stmt, s->v.Try.body);
     }
-    ADDOP(c, POP_BLOCK);
+    ADDOP_NOLINE(c, POP_BLOCK);
     compiler_pop_fblock(c, FINALLY_TRY, body);
     VISIT_SEQ(c, stmt, s->v.Try.finalbody);
-    ADDOP_JREL(c, JUMP_FORWARD, exit);
+    ADDOP_JUMP_NOLINE(c, JUMP_FORWARD, exit);
     /* `finally` block */
     compiler_use_next_block(c, end);
     if (!compiler_push_fblock(c, FINALLY_END, end, NULL, NULL))
         return 0;
     VISIT_SEQ(c, stmt, s->v.Try.finalbody);
     compiler_pop_fblock(c, FINALLY_END, end);
-    ADDOP(c, RERAISE);
+    ADDOP_I(c, RERAISE, 0);
     compiler_use_next_block(c, exit);
     return 1;
 }
@@ -3061,14 +3170,14 @@
     end = compiler_new_block(c);
     if (body == NULL || except == NULL || orelse == NULL || end == NULL)
         return 0;
-    ADDOP_JREL(c, SETUP_FINALLY, except);
+    ADDOP_JUMP(c, SETUP_FINALLY, except);
     compiler_use_next_block(c, body);
     if (!compiler_push_fblock(c, TRY_EXCEPT, body, NULL, NULL))
         return 0;
     VISIT_SEQ(c, stmt, s->v.Try.body);
-    ADDOP(c, POP_BLOCK);
     compiler_pop_fblock(c, TRY_EXCEPT, body);
-    ADDOP_JREL(c, JUMP_FORWARD, orelse);
+    ADDOP_NOLINE(c, POP_BLOCK);
+    ADDOP_JUMP_NOLINE(c, JUMP_FORWARD, orelse);
     n = asdl_seq_LEN(s->v.Try.handlers);
     compiler_use_next_block(c, except);
     /* Runtime will push a block here, so we need to account for that */
@@ -3077,16 +3186,17 @@
     for (i = 0; i < n; i++) {
         excepthandler_ty handler = (excepthandler_ty)asdl_seq_GET(
             s->v.Try.handlers, i);
+        SET_LOC(c, handler);
         if (!handler->v.ExceptHandler.type && i < n-1)
             return compiler_error(c, "default 'except:' must be last");
-        SET_LOC(c, handler);
         except = compiler_new_block(c);
         if (except == NULL)
             return 0;
         if (handler->v.ExceptHandler.type) {
             ADDOP(c, DUP_TOP);
             VISIT(c, expr, handler->v.ExceptHandler.type);
-            ADDOP_JABS(c, JUMP_IF_NOT_EXC_MATCH, except);
+            ADDOP_JUMP(c, JUMP_IF_NOT_EXC_MATCH, except);
+            NEXT_BLOCK(c);
         }
         ADDOP(c, POP_TOP);
         if (handler->v.ExceptHandler.name) {
@@ -3113,7 +3223,7 @@
             */
 
             /* second try: */
-            ADDOP_JREL(c, SETUP_FINALLY, cleanup_end);
+            ADDOP_JUMP(c, SETUP_FINALLY, cleanup_end);
             compiler_use_next_block(c, cleanup_body);
             if (!compiler_push_fblock(c, HANDLER_CLEANUP, cleanup_body, NULL, handler->v.ExceptHandler.name))
                 return 0;
@@ -3121,23 +3231,25 @@
             /* second # body */
             VISIT_SEQ(c, stmt, handler->v.ExceptHandler.body);
             compiler_pop_fblock(c, HANDLER_CLEANUP, cleanup_body);
+            /* name = None; del name; # Mark as artificial */
+            c->u->u_lineno = -1;
             ADDOP(c, POP_BLOCK);
             ADDOP(c, POP_EXCEPT);
-            /* name = None; del name */
             ADDOP_LOAD_CONST(c, Py_None);
             compiler_nameop(c, handler->v.ExceptHandler.name, Store);
             compiler_nameop(c, handler->v.ExceptHandler.name, Del);
-            ADDOP_JREL(c, JUMP_FORWARD, end);
+            ADDOP_JUMP(c, JUMP_FORWARD, end);
 
             /* except: */
             compiler_use_next_block(c, cleanup_end);
 
-            /* name = None; del name */
+            /* name = None; del name; # Mark as artificial */
+            c->u->u_lineno = -1;
             ADDOP_LOAD_CONST(c, Py_None);
             compiler_nameop(c, handler->v.ExceptHandler.name, Store);
             compiler_nameop(c, handler->v.ExceptHandler.name, Del);
 
-            ADDOP(c, RERAISE);
+            ADDOP_I(c, RERAISE, 1);
         }
         else {
             basicblock *cleanup_body;
@@ -3153,13 +3265,16 @@
                 return 0;
             VISIT_SEQ(c, stmt, handler->v.ExceptHandler.body);
             compiler_pop_fblock(c, HANDLER_CLEANUP, cleanup_body);
+            c->u->u_lineno = -1;
             ADDOP(c, POP_EXCEPT);
-            ADDOP_JREL(c, JUMP_FORWARD, end);
+            ADDOP_JUMP(c, JUMP_FORWARD, end);
         }
         compiler_use_next_block(c, except);
     }
     compiler_pop_fblock(c, EXCEPTION_HANDLER, NULL);
-    ADDOP(c, RERAISE);
+    /* Mark as artificial */
+    c->u->u_lineno = -1;
+    ADDOP_I(c, RERAISE, 0);
     compiler_use_next_block(c, orelse);
     VISIT_SEQ(c, stmt, s->v.Try.orelse);
     compiler_use_next_block(c, end);
@@ -3227,11 +3342,12 @@
      */
     Py_ssize_t i, n = asdl_seq_LEN(s->v.Import.names);
 
+    PyObject *zero = _PyLong_GetZero();  // borrowed reference
     for (i = 0; i < n; i++) {
         alias_ty alias = (alias_ty)asdl_seq_GET(s->v.Import.names, i);
         int r;
 
-        ADDOP_LOAD_CONST(c, _PyLong_Zero);
+        ADDOP_LOAD_CONST(c, zero);
         ADDOP_LOAD_CONST(c, Py_None);
         ADDOP_NAME(c, IMPORT_NAME, alias->name, names);
 
@@ -3329,10 +3445,12 @@
 {
     basicblock *end;
 
-    if (c->c_optimize)
-        return 1;
-    if (s->v.Assert.test->kind == Tuple_kind &&
-        asdl_seq_LEN(s->v.Assert.test->v.Tuple.elts) > 0)
+    /* Always emit a warning if the test is a non-zero length tuple */
+    if ((s->v.Assert.test->kind == Tuple_kind &&
+        asdl_seq_LEN(s->v.Assert.test->v.Tuple.elts) > 0) ||
+        (s->v.Assert.test->kind == Constant_kind &&
+         PyTuple_Check(s->v.Assert.test->v.Constant.value) &&
+         PyTuple_Size(s->v.Assert.test->v.Constant.value) > 0))
     {
         if (!compiler_warn(c, "assertion is always true, "
                               "perhaps remove parentheses?"))
@@ -3340,6 +3458,8 @@
             return 0;
         }
     }
+    if (c->c_optimize)
+        return 1;
     end = compiler_new_block(c);
     if (end == NULL)
         return 0;
@@ -3366,10 +3486,13 @@
 
     if (value->kind == Constant_kind) {
         /* ignore constant statement */
+        ADDOP(c, NOP);
         return 1;
     }
 
     VISIT(c, expr, value);
+    /* Mark POP_TOP as artificial */
+    c->u->u_lineno = -1;
     ADDOP(c, POP_TOP);
     return 1;
 }
@@ -3412,6 +3535,8 @@
         return compiler_while(c, s);
     case If_kind:
         return compiler_if(c, s);
+    case Match_kind:
+        return compiler_match(c, s);
     case Raise_kind:
         n = 0;
         if (s->v.Raise.exc) {
@@ -3423,6 +3548,7 @@
             }
         }
         ADDOP_I(c, RAISE_VARARGS, (int)n);
+        NEXT_BLOCK(c);
         break;
     case Try_kind:
         return compiler_try(c, s);
@@ -3438,6 +3564,7 @@
     case Expr_kind:
         return compiler_visit_stmt_expr(c, s->v.Expr.value);
     case Pass_kind:
+        ADDOP(c, NOP);
         break;
     case Break_kind:
         return compiler_break(c);
@@ -3572,7 +3699,7 @@
 
     op = 0;
     optype = OP_NAME;
-    scope = PyST_GetScope(c->u->u_ste, mangled);
+    scope = _PyST_GetScope(c->u->u_ste, mangled);
     switch (scope) {
     case FREE:
         dict = c->u->u_freevars;
@@ -3649,7 +3776,7 @@
     basicblock *end;
     int jumpi;
     Py_ssize_t i, n;
-    asdl_seq *s;
+    asdl_expr_seq *s;
 
     assert(e->kind == BoolOp_kind);
     if (e->v.BoolOp.op == And)
@@ -3664,7 +3791,12 @@
     assert(n >= 0);
     for (i = 0; i < n; ++i) {
         VISIT(c, expr, (expr_ty)asdl_seq_GET(s, i));
-        ADDOP_JABS(c, jumpi, end);
+        ADDOP_JUMP(c, jumpi, end);
+        basicblock *next = compiler_new_block(c);
+        if (next == NULL) {
+            return 0;
+        }
+        compiler_use_next_block(c, next);
     }
     VISIT(c, expr, (expr_ty)asdl_seq_GET(s, n));
     compiler_use_next_block(c, end);
@@ -3672,18 +3804,17 @@
 }
 
 static int
-starunpack_helper(struct compiler *c, asdl_seq *elts, int pushed,
+starunpack_helper(struct compiler *c, asdl_expr_seq *elts, int pushed,
                   int build, int add, int extend, int tuple)
 {
     Py_ssize_t n = asdl_seq_LEN(elts);
-    Py_ssize_t i, seen_star = 0;
     if (n > 2 && are_all_items_const(elts, 0, n)) {
         PyObject *folded = PyTuple_New(n);
         if (folded == NULL) {
             return 0;
         }
         PyObject *val;
-        for (i = 0; i < n; i++) {
+        for (Py_ssize_t i = 0; i < n; i++) {
             val = ((expr_ty)asdl_seq_GET(elts, i))->v.Constant.value;
             Py_INCREF(val);
             PyTuple_SET_ITEM(folded, i, val);
@@ -3704,38 +3835,16 @@
         return 1;
     }
 
-    for (i = 0; i < n; i++) {
+    int big = n+pushed > STACK_USE_GUIDELINE;
+    int seen_star = 0;
+    for (Py_ssize_t i = 0; i < n; i++) {
         expr_ty elt = asdl_seq_GET(elts, i);
         if (elt->kind == Starred_kind) {
             seen_star = 1;
         }
     }
-    if (seen_star) {
-        seen_star = 0;
-        for (i = 0; i < n; i++) {
-            expr_ty elt = asdl_seq_GET(elts, i);
-            if (elt->kind == Starred_kind) {
-                if (seen_star == 0) {
-                    ADDOP_I(c, build, i+pushed);
-                    seen_star = 1;
-                }
-                VISIT(c, expr, elt->v.Starred.value);
-                ADDOP_I(c, extend, 1);
-            }
-            else {
-                VISIT(c, expr, elt);
-                if (seen_star) {
-                    ADDOP_I(c, add, 1);
-                }
-            }
-        }
-        assert(seen_star);
-        if (tuple) {
-            ADDOP(c, LIST_TO_TUPLE);
-        }
-    }
-    else {
-        for (i = 0; i < n; i++) {
+    if (!seen_star && !big) {
+        for (Py_ssize_t i = 0; i < n; i++) {
             expr_ty elt = asdl_seq_GET(elts, i);
             VISIT(c, expr, elt);
         }
@@ -3744,17 +3853,43 @@
         } else {
             ADDOP_I(c, build, n+pushed);
         }
+        return 1;
+    }
+    int sequence_built = 0;
+    if (big) {
+        ADDOP_I(c, build, pushed);
+        sequence_built = 1;
+    }
+    for (Py_ssize_t i = 0; i < n; i++) {
+        expr_ty elt = asdl_seq_GET(elts, i);
+        if (elt->kind == Starred_kind) {
+            if (sequence_built == 0) {
+                ADDOP_I(c, build, i+pushed);
+                sequence_built = 1;
+            }
+            VISIT(c, expr, elt->v.Starred.value);
+            ADDOP_I(c, extend, 1);
+        }
+        else {
+            VISIT(c, expr, elt);
+            if (sequence_built) {
+                ADDOP_I(c, add, 1);
+            }
+        }
+    }
+    assert(sequence_built);
+    if (tuple) {
+        ADDOP(c, LIST_TO_TUPLE);
     }
     return 1;
 }
 
 static int
-assignment_helper(struct compiler *c, asdl_seq *elts)
+unpack_helper(struct compiler *c, asdl_expr_seq *elts)
 {
     Py_ssize_t n = asdl_seq_LEN(elts);
-    Py_ssize_t i;
     int seen_star = 0;
-    for (i = 0; i < n; i++) {
+    for (Py_ssize_t i = 0; i < n; i++) {
         expr_ty elt = asdl_seq_GET(elts, i);
         if (elt->kind == Starred_kind && !seen_star) {
             if ((i >= (1 << 8)) ||
@@ -3773,7 +3908,15 @@
     if (!seen_star) {
         ADDOP_I(c, UNPACK_SEQUENCE, n);
     }
-    for (i = 0; i < n; i++) {
+    return 1;
+}
+
+static int
+assignment_helper(struct compiler *c, asdl_expr_seq *elts)
+{
+    Py_ssize_t n = asdl_seq_LEN(elts);
+    RETURN_IF_FALSE(unpack_helper(c, elts));
+    for (Py_ssize_t i = 0; i < n; i++) {
         expr_ty elt = asdl_seq_GET(elts, i);
         VISIT(c, expr, elt->kind != Starred_kind ? elt : elt->v.Starred.value);
     }
@@ -3783,7 +3926,7 @@
 static int
 compiler_list(struct compiler *c, expr_ty e)
 {
-    asdl_seq *elts = e->v.List.elts;
+    asdl_expr_seq *elts = e->v.List.elts;
     if (e->v.List.ctx == Store) {
         return assignment_helper(c, elts);
     }
@@ -3799,7 +3942,7 @@
 static int
 compiler_tuple(struct compiler *c, expr_ty e)
 {
-    asdl_seq *elts = e->v.Tuple.elts;
+    asdl_expr_seq *elts = e->v.Tuple.elts;
     if (e->v.Tuple.ctx == Store) {
         return assignment_helper(c, elts);
     }
@@ -3820,7 +3963,7 @@
 }
 
 static int
-are_all_items_const(asdl_seq *seq, Py_ssize_t begin, Py_ssize_t end)
+are_all_items_const(asdl_expr_seq *seq, Py_ssize_t begin, Py_ssize_t end)
 {
     Py_ssize_t i;
     for (i = begin; i < end; i++) {
@@ -3836,7 +3979,8 @@
 {
     Py_ssize_t i, n = end - begin;
     PyObject *keys, *key;
-    if (n > 1 && are_all_items_const(e->v.Dict.keys, begin, end)) {
+    int big = n*2 > STACK_USE_GUIDELINE;
+    if (n > 1 && !big && are_all_items_const(e->v.Dict.keys, begin, end)) {
         for (i = begin; i < end; i++) {
             VISIT(c, expr, (expr_ty)asdl_seq_GET(e->v.Dict.values, i));
         }
@@ -3851,12 +3995,19 @@
         }
         ADDOP_LOAD_CONST_NEW(c, keys);
         ADDOP_I(c, BUILD_CONST_KEY_MAP, n);
+        return 1;
     }
-    else {
-        for (i = begin; i < end; i++) {
-            VISIT(c, expr, (expr_ty)asdl_seq_GET(e->v.Dict.keys, i));
-            VISIT(c, expr, (expr_ty)asdl_seq_GET(e->v.Dict.values, i));
+    if (big) {
+        ADDOP_I(c, BUILD_MAP, 0);
+    }
+    for (i = begin; i < end; i++) {
+        VISIT(c, expr, (expr_ty)asdl_seq_GET(e->v.Dict.keys, i));
+        VISIT(c, expr, (expr_ty)asdl_seq_GET(e->v.Dict.values, i));
+        if (big) {
+            ADDOP_I(c, MAP_ADD, 1);
         }
+    }
+    if (!big) {
         ADDOP_I(c, BUILD_MAP, n);
     }
     return 1;
@@ -3892,7 +4043,7 @@
             ADDOP_I(c, DICT_UPDATE, 1);
         }
         else {
-            if (elements == 0xFFFF) {
+            if (elements*2 > STACK_USE_GUIDELINE) {
                 if (!compiler_subdict(c, e, i - elements, i + 1)) {
                     return 0;
                 }
@@ -3947,7 +4098,7 @@
             ADDOP(c, DUP_TOP);
             ADDOP(c, ROT_THREE);
             ADDOP_COMPARE(c, asdl_seq_GET(e->v.Compare.ops, i));
-            ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, cleanup);
+            ADDOP_JUMP(c, JUMP_IF_FALSE_OR_POP, cleanup);
             NEXT_BLOCK(c);
         }
         VISIT(c, expr, (expr_ty)asdl_seq_GET(e->v.Compare.comparators, n));
@@ -3955,7 +4106,7 @@
         basicblock *end = compiler_new_block(c);
         if (end == NULL)
             return 0;
-        ADDOP_JREL(c, JUMP_FORWARD, end);
+        ADDOP_JUMP_NOLINE(c, JUMP_FORWARD, end);
         compiler_use_next_block(c, cleanup);
         ADDOP(c, ROT_TWO);
         ADDOP(c, POP_TOP);
@@ -4083,16 +4234,20 @@
 {
     Py_ssize_t argsl, i;
     expr_ty meth = e->v.Call.func;
-    asdl_seq *args = e->v.Call.args;
+    asdl_expr_seq *args = e->v.Call.args;
 
     /* Check that the call node is an attribute access, and that
        the call doesn't have keyword parameters. */
     if (meth->kind != Attribute_kind || meth->v.Attribute.ctx != Load ||
-            asdl_seq_LEN(e->v.Call.keywords))
+            asdl_seq_LEN(e->v.Call.keywords)) {
         return -1;
-
-    /* Check that there are no *varargs types of arguments. */
+    }
+    /* Check that there aren't too many arguments */
     argsl = asdl_seq_LEN(args);
+    if (argsl >= STACK_USE_GUIDELINE) {
+        return -1;
+    }
+    /* Check that there are no *varargs types of arguments. */
     for (i = 0; i < argsl; i++) {
         expr_ty elt = asdl_seq_GET(args, i);
         if (elt->kind == Starred_kind) {
@@ -4102,14 +4257,17 @@
 
     /* Alright, we can optimize the code. */
     VISIT(c, expr, meth->v.Attribute.value);
+    int old_lineno = c->u->u_lineno;
+    c->u->u_lineno = meth->end_lineno;
     ADDOP_NAME(c, LOAD_METHOD, meth->v.Attribute.attr, names);
     VISIT_SEQ(c, expr, e->v.Call.args);
     ADDOP_I(c, CALL_METHOD, asdl_seq_LEN(e->v.Call.args));
+    c->u->u_lineno = old_lineno;
     return 1;
 }
 
 static int
-validate_keywords(struct compiler *c, asdl_seq *keywords)
+validate_keywords(struct compiler *c, asdl_keyword_seq *keywords)
 {
     Py_ssize_t nkeywords = asdl_seq_LEN(keywords);
     for (Py_ssize_t i = 0; i < nkeywords; i++) {
@@ -4123,13 +4281,8 @@
         for (Py_ssize_t j = i + 1; j < nkeywords; j++) {
             keyword_ty other = ((keyword_ty)asdl_seq_GET(keywords, j));
             if (other->arg && !PyUnicode_Compare(key->arg, other->arg)) {
-                PyObject *msg = PyUnicode_FromFormat("keyword argument repeated: %U", key->arg);
-                if (msg == NULL) {
-                    return -1;
-                }
-                c->u->u_col_offset = other->col_offset;
-                compiler_error(c, PyUnicode_AsUTF8(msg));
-                Py_DECREF(msg);
+                SET_LOC(c, other);
+                compiler_error(c, "keyword argument repeated: %U", key->arg);
                 return -1;
             }
         }
@@ -4156,9 +4309,29 @@
 static int
 compiler_joined_str(struct compiler *c, expr_ty e)
 {
-    VISIT_SEQ(c, expr, e->v.JoinedStr.values);
-    if (asdl_seq_LEN(e->v.JoinedStr.values) != 1)
-        ADDOP_I(c, BUILD_STRING, asdl_seq_LEN(e->v.JoinedStr.values));
+
+    Py_ssize_t value_count = asdl_seq_LEN(e->v.JoinedStr.values);
+    if (value_count > STACK_USE_GUIDELINE) {
+        ADDOP_LOAD_CONST_NEW(c, _PyUnicode_FromASCII("", 0));
+        PyObject *join = _PyUnicode_FromASCII("join", 4);
+        if (join == NULL) {
+            return 0;
+        }
+        ADDOP_NAME(c, LOAD_METHOD, join, names);
+        Py_DECREF(join);
+        ADDOP_I(c, BUILD_LIST, 0);
+        for (Py_ssize_t i = 0; i < asdl_seq_LEN(e->v.JoinedStr.values); i++) {
+            VISIT(c, expr, asdl_seq_GET(e->v.JoinedStr.values, i));
+            ADDOP_I(c, LIST_APPEND, 1);
+        }
+        ADDOP_I(c, CALL_METHOD, 1);
+    }
+    else {
+        VISIT_SEQ(c, expr, e->v.JoinedStr.values);
+        if (asdl_seq_LEN(e->v.JoinedStr.values) != 1) {
+            ADDOP_I(c, BUILD_STRING, asdl_seq_LEN(e->v.JoinedStr.values));
+        }
+    }
     return 1;
 }
 
@@ -4209,13 +4382,14 @@
 }
 
 static int
-compiler_subkwargs(struct compiler *c, asdl_seq *keywords, Py_ssize_t begin, Py_ssize_t end)
+compiler_subkwargs(struct compiler *c, asdl_keyword_seq *keywords, Py_ssize_t begin, Py_ssize_t end)
 {
     Py_ssize_t i, n = end - begin;
     keyword_ty kw;
     PyObject *keys, *key;
     assert(n > 0);
-    if (n > 1) {
+    int big = n*2 > STACK_USE_GUIDELINE;
+    if (n > 1 && !big) {
         for (i = begin; i < end; i++) {
             kw = asdl_seq_GET(keywords, i);
             VISIT(c, expr, kw->value);
@@ -4231,14 +4405,20 @@
         }
         ADDOP_LOAD_CONST_NEW(c, keys);
         ADDOP_I(c, BUILD_CONST_KEY_MAP, n);
+        return 1;
     }
-    else {
-        /* a for loop only executes once */
-        for (i = begin; i < end; i++) {
-            kw = asdl_seq_GET(keywords, i);
-            ADDOP_LOAD_CONST(c, kw->arg);
-            VISIT(c, expr, kw->value);
+    if (big) {
+        ADDOP_I_NOLINE(c, BUILD_MAP, 0);
+    }
+    for (i = begin; i < end; i++) {
+        kw = asdl_seq_GET(keywords, i);
+        ADDOP_LOAD_CONST(c, kw->arg);
+        VISIT(c, expr, kw->value);
+        if (big) {
+            ADDOP_I_NOLINE(c, MAP_ADD, 1);
         }
+    }
+    if (!big) {
         ADDOP_I(c, BUILD_MAP, n);
     }
     return 1;
@@ -4248,8 +4428,8 @@
 static int
 compiler_call_helper(struct compiler *c,
                      int n, /* Args already pushed */
-                     asdl_seq *args,
-                     asdl_seq *keywords)
+                     asdl_expr_seq *args,
+                     asdl_keyword_seq *keywords)
 {
     Py_ssize_t i, nseen, nelts, nkwelts;
 
@@ -4260,6 +4440,9 @@
     nelts = asdl_seq_LEN(args);
     nkwelts = asdl_seq_LEN(keywords);
 
+    if (nelts + nkwelts*2 > STACK_USE_GUIDELINE) {
+         goto ex_call;
+    }
     for (i = 0; i < nelts; i++) {
         expr_ty elt = asdl_seq_GET(args, i);
         if (elt->kind == Starred_kind) {
@@ -4374,7 +4557,7 @@
 
 static int
 compiler_comprehension_generator(struct compiler *c,
-                                 asdl_seq *generators, int gen_index,
+                                 asdl_comprehension_seq *generators, int gen_index,
                                  int depth,
                                  expr_ty elt, expr_ty val, int type)
 {
@@ -4391,7 +4574,7 @@
 
 static int
 compiler_sync_comprehension_generator(struct compiler *c,
-                                      asdl_seq *generators, int gen_index,
+                                      asdl_comprehension_seq *generators, int gen_index,
                                       int depth,
                                       expr_ty elt, expr_ty val, int type)
 {
@@ -4423,7 +4606,7 @@
         /* Fast path for the temporary variable assignment idiom:
              for y in [f(x)]
          */
-        asdl_seq *elts;
+        asdl_expr_seq *elts;
         switch (gen->iter->kind) {
             case List_kind:
                 elts = gen->iter->v.List.elts;
@@ -4449,7 +4632,7 @@
     if (start) {
         depth++;
         compiler_use_next_block(c, start);
-        ADDOP_JREL(c, FOR_ITER, anchor);
+        ADDOP_JUMP(c, FOR_ITER, anchor);
         NEXT_BLOCK(c);
     }
     VISIT(c, expr, gen->target);
@@ -4501,7 +4684,7 @@
     }
     compiler_use_next_block(c, if_cleanup);
     if (start) {
-        ADDOP_JABS(c, JUMP_ABSOLUTE, start);
+        ADDOP_JUMP(c, JUMP_ABSOLUTE, start);
         compiler_use_next_block(c, anchor);
     }
 
@@ -4510,7 +4693,7 @@
 
 static int
 compiler_async_comprehension_generator(struct compiler *c,
-                                      asdl_seq *generators, int gen_index,
+                                      asdl_comprehension_seq *generators, int gen_index,
                                       int depth,
                                       expr_ty elt, expr_ty val, int type)
 {
@@ -4539,8 +4722,13 @@
     }
 
     compiler_use_next_block(c, start);
+    /* Runtime will push a block here, so we need to account for that */
+    if (!compiler_push_fblock(c, ASYNC_COMPREHENSION_GENERATOR, start,
+                              NULL, NULL)) {
+        return 0;
+    }
 
-    ADDOP_JREL(c, SETUP_FINALLY, except);
+    ADDOP_JUMP(c, SETUP_FINALLY, except);
     ADDOP(c, GET_ANEXT);
     ADDOP_LOAD_CONST(c, Py_None);
     ADDOP(c, YIELD_FROM);
@@ -4591,7 +4779,9 @@
         }
     }
     compiler_use_next_block(c, if_cleanup);
-    ADDOP_JABS(c, JUMP_ABSOLUTE, start);
+    ADDOP_JUMP(c, JUMP_ABSOLUTE, start);
+
+    compiler_pop_fblock(c, ASYNC_COMPREHENSION_GENERATOR, start);
 
     compiler_use_next_block(c, except);
     ADDOP(c, END_ASYNC_FOR);
@@ -4601,7 +4791,7 @@
 
 static int
 compiler_comprehension(struct compiler *c, expr_ty e, int type,
-                       identifier name, asdl_seq *generators, expr_ty elt,
+                       identifier name, asdl_comprehension_seq *generators, expr_ty elt,
                        expr_ty val)
 {
     PyCodeObject *co = NULL;
@@ -4619,6 +4809,7 @@
     {
         goto error;
     }
+    SET_LOC(c, e);
 
     is_async_generator = c->u->u_ste->ste_coroutine;
 
@@ -4667,8 +4858,9 @@
     if (co == NULL)
         goto error;
 
-    if (!compiler_make_closure(c, co, 0, qualname))
+    if (!compiler_make_closure(c, co, 0, qualname)) {
         goto error;
+    }
     Py_DECREF(qualname);
     Py_DECREF(co);
 
@@ -4773,22 +4965,14 @@
  */
 
 static int
-expr_constant(expr_ty e)
-{
-    if (e->kind == Constant_kind) {
-        return PyObject_IsTrue(e->v.Constant.value);
-    }
-    return -1;
-}
-
-static int
 compiler_with_except_finish(struct compiler *c) {
     basicblock *exit;
     exit = compiler_new_block(c);
     if (exit == NULL)
         return 0;
-    ADDOP_JABS(c, POP_JUMP_IF_TRUE, exit);
-    ADDOP(c, RERAISE);
+    ADDOP_JUMP(c, POP_JUMP_IF_TRUE, exit);
+    NEXT_BLOCK(c);
+    ADDOP_I(c, RERAISE, 1);
     compiler_use_next_block(c, exit);
     ADDOP(c, POP_TOP);
     ADDOP(c, POP_TOP);
@@ -4849,11 +5033,11 @@
     ADDOP_LOAD_CONST(c, Py_None);
     ADDOP(c, YIELD_FROM);
 
-    ADDOP_JREL(c, SETUP_ASYNC_WITH, final);
+    ADDOP_JUMP(c, SETUP_ASYNC_WITH, final);
 
     /* SETUP_ASYNC_WITH pushes a finally block. */
     compiler_use_next_block(c, block);
-    if (!compiler_push_fblock(c, ASYNC_WITH, block, final, NULL)) {
+    if (!compiler_push_fblock(c, ASYNC_WITH, block, final, s)) {
         return 0;
     }
 
@@ -4879,19 +5063,19 @@
     /* For successful outcome:
      * call __exit__(None, None, None)
      */
+    SET_LOC(c, s);
     if(!compiler_call_exit_with_nones(c))
         return 0;
     ADDOP(c, GET_AWAITABLE);
-    ADDOP_O(c, LOAD_CONST, Py_None, consts);
+    ADDOP_LOAD_CONST(c, Py_None);
     ADDOP(c, YIELD_FROM);
 
     ADDOP(c, POP_TOP);
 
-    ADDOP_JABS(c, JUMP_ABSOLUTE, exit);
+    ADDOP_JUMP(c, JUMP_ABSOLUTE, exit);
 
     /* For exceptional outcome: */
     compiler_use_next_block(c, final);
-
     ADDOP(c, WITH_EXCEPT_START);
     ADDOP(c, GET_AWAITABLE);
     ADDOP_LOAD_CONST(c, Py_None);
@@ -4941,11 +5125,11 @@
     /* Evaluate EXPR */
     VISIT(c, expr, item->context_expr);
     /* Will push bound __exit__ */
-    ADDOP_JREL(c, SETUP_WITH, final);
+    ADDOP_JUMP(c, SETUP_WITH, final);
 
     /* SETUP_WITH pushes a finally block. */
     compiler_use_next_block(c, block);
-    if (!compiler_push_fblock(c, WITH, block, final, NULL)) {
+    if (!compiler_push_fblock(c, WITH, block, final, s)) {
         return 0;
     }
 
@@ -4964,6 +5148,9 @@
     else if (!compiler_with(c, s, pos))
             return 0;
 
+
+    /* Mark all following code as artificial */
+    c->u->u_lineno = -1;
     ADDOP(c, POP_BLOCK);
     compiler_pop_fblock(c, WITH, block);
 
@@ -4972,14 +5159,14 @@
     /* For successful outcome:
      * call __exit__(None, None, None)
      */
+    SET_LOC(c, s);
     if (!compiler_call_exit_with_nones(c))
         return 0;
     ADDOP(c, POP_TOP);
-    ADDOP_JREL(c, JUMP_FORWARD, exit);
+    ADDOP_JUMP(c, JUMP_FORWARD, exit);
 
     /* For exceptional outcome: */
     compiler_use_next_block(c, final);
-
     ADDOP(c, WITH_EXCEPT_START);
     compiler_with_except_finish(c);
 
@@ -5079,12 +5266,21 @@
         VISIT(c, expr, e->v.Attribute.value);
         switch (e->v.Attribute.ctx) {
         case Load:
+        {
+            int old_lineno = c->u->u_lineno;
+            c->u->u_lineno = e->end_lineno;
             ADDOP_NAME(c, LOAD_ATTR, e->v.Attribute.attr, names);
+            c->u->u_lineno = old_lineno;
             break;
+        }
         case Store:
-            if (forbidden_name(c, e->v.Attribute.attr, e->v.Attribute.ctx))
+            if (forbidden_name(c, e->v.Attribute.attr, e->v.Attribute.ctx)) {
                 return 0;
+            }
+            int old_lineno = c->u->u_lineno;
+            c->u->u_lineno = e->end_lineno;
             ADDOP_NAME(c, STORE_ATTR, e->v.Attribute.attr, names);
+            c->u->u_lineno = old_lineno;
             break;
         case Del:
             ADDOP_NAME(c, DELETE_ATTR, e->v.Attribute.attr, names);
@@ -5122,11 +5318,15 @@
 compiler_visit_expr(struct compiler *c, expr_ty e)
 {
     int old_lineno = c->u->u_lineno;
+    int old_end_lineno = c->u->u_end_lineno;
     int old_col_offset = c->u->u_col_offset;
+    int old_end_col_offset = c->u->u_end_col_offset;
     SET_LOC(c, e);
     int res = compiler_visit_expr1(c, e);
     c->u->u_lineno = old_lineno;
+    c->u->u_end_lineno = old_end_lineno;
     c->u->u_col_offset = old_col_offset;
+    c->u->u_end_col_offset = old_end_col_offset;
     return res;
 }
 
@@ -5137,14 +5337,19 @@
     expr_ty e = s->v.AugAssign.target;
 
     int old_lineno = c->u->u_lineno;
+    int old_end_lineno = c->u->u_end_lineno;
     int old_col_offset = c->u->u_col_offset;
+    int old_end_col_offset = c->u->u_end_col_offset;
     SET_LOC(c, e);
 
     switch (e->kind) {
     case Attribute_kind:
         VISIT(c, expr, e->v.Attribute.value);
         ADDOP(c, DUP_TOP);
+        int old_lineno = c->u->u_lineno;
+        c->u->u_lineno = e->end_lineno;
         ADDOP_NAME(c, LOAD_ATTR, e->v.Attribute.attr, names);
+        c->u->u_lineno = old_lineno;
         break;
     case Subscript_kind:
         VISIT(c, expr, e->v.Subscript.value);
@@ -5164,7 +5369,9 @@
     }
 
     c->u->u_lineno = old_lineno;
+    c->u->u_end_lineno = old_end_lineno;
     c->u->u_col_offset = old_col_offset;
+    c->u->u_end_col_offset = old_end_col_offset;
 
     VISIT(c, expr, s->v.AugAssign.value);
     ADDOP(c, inplace_binop(s->v.AugAssign.op));
@@ -5173,6 +5380,7 @@
 
     switch (e->kind) {
     case Attribute_kind:
+        c->u->u_lineno = e->end_lineno;
         ADDOP(c, ROT_TWO);
         ADDOP_NAME(c, STORE_ATTR, e->v.Attribute.attr, names);
         break;
@@ -5199,6 +5407,12 @@
 static int
 check_annotation(struct compiler *c, stmt_ty s)
 {
+    /* Annotations of complex targets does not produce anything
+       under annotations future */
+    if (c->c_future->ff_features & CO_FUTURE_ANNOTATIONS) {
+        return 1;
+    }
+
     /* Annotations are only evaluated in a module or class. */
     if (c->u->u_scope_type == COMPILER_SCOPE_MODULE ||
         c->u->u_scope_type == COMPILER_SCOPE_CLASS) {
@@ -5225,7 +5439,7 @@
         return 1;
     case Tuple_kind: {
         /* extended slice */
-        asdl_seq *elts = e->v.Tuple.elts;
+        asdl_expr_seq *elts = e->v.Tuple.elts;
         Py_ssize_t i, n = asdl_seq_LEN(elts);
         for (i = 0; i < n; i++) {
             if (!check_ann_subscr(c, asdl_seq_GET(elts, i))) {
@@ -5305,28 +5519,35 @@
 */
 
 static int
-compiler_error(struct compiler *c, const char *errstr)
+compiler_error(struct compiler *c, const char *format, ...)
 {
-    PyObject *loc;
-    PyObject *u = NULL, *v = NULL;
-
-    loc = PyErr_ProgramTextObject(c->c_filename, c->u->u_lineno);
-    if (!loc) {
+    va_list vargs;
+#ifdef HAVE_STDARG_PROTOTYPES
+    va_start(vargs, format);
+#else
+    va_start(vargs);
+#endif
+    PyObject *msg = PyUnicode_FromFormatV(format, vargs);
+    va_end(vargs);
+    if (msg == NULL) {
+        return 0;
+    }
+    PyObject *loc = PyErr_ProgramTextObject(c->c_filename, c->u->u_lineno);
+    if (loc == NULL) {
         Py_INCREF(Py_None);
         loc = Py_None;
     }
-    u = Py_BuildValue("(OiiO)", c->c_filename, c->u->u_lineno,
-                      c->u->u_col_offset + 1, loc);
-    if (!u)
+    PyObject *args = Py_BuildValue("O(OiiOii)", msg, c->c_filename,
+                                   c->u->u_lineno, c->u->u_col_offset + 1, loc,
+                                   c->u->u_end_lineno, c->u->u_end_col_offset + 1);
+    Py_DECREF(msg);
+    if (args == NULL) {
         goto exit;
-    v = Py_BuildValue("(zO)", errstr, u);
-    if (!v)
-        goto exit;
-    PyErr_SetObject(PyExc_SyntaxError, v);
+    }
+    PyErr_SetObject(PyExc_SyntaxError, args);
  exit:
     Py_DECREF(loc);
-    Py_XDECREF(u);
-    Py_XDECREF(v);
+    Py_XDECREF(args);
     return 0;
 }
 
@@ -5421,6 +5642,812 @@
     return 1;
 }
 
+
+// PEP 634: Structural Pattern Matching
+
+// To keep things simple, all compiler_pattern_* and pattern_helper_* routines
+// follow the convention of consuming TOS (the subject for the given pattern)
+// and calling jump_to_fail_pop on failure (no match).
+
+// When calling into these routines, it's important that pc->on_top be kept
+// updated to reflect the current number of items that we are using on the top
+// of the stack: they will be popped on failure, and any name captures will be
+// stored *underneath* them on success. This lets us defer all names stores
+// until the *entire* pattern matches.
+
+#define WILDCARD_CHECK(N) \
+    ((N)->kind == MatchAs_kind && !(N)->v.MatchAs.name)
+
+#define WILDCARD_STAR_CHECK(N) \
+    ((N)->kind == MatchStar_kind && !(N)->v.MatchStar.name)
+
+// Limit permitted subexpressions, even if the parser & AST validator let them through
+#define MATCH_VALUE_EXPR(N) \
+    ((N)->kind == Constant_kind || (N)->kind == Attribute_kind)
+
+// Allocate or resize pc->fail_pop to allow for n items to be popped on failure.
+static int
+ensure_fail_pop(struct compiler *c, pattern_context *pc, Py_ssize_t n)
+{
+    Py_ssize_t size = n + 1;
+    if (size <= pc->fail_pop_size) {
+        return 1;
+    }
+    Py_ssize_t needed = sizeof(basicblock*) * size;
+    basicblock **resized = PyObject_Realloc(pc->fail_pop, needed);
+    if (resized == NULL) {
+        PyErr_NoMemory();
+        return 0;
+    }
+    pc->fail_pop = resized;
+    while (pc->fail_pop_size < size) {
+        basicblock *new_block;
+        RETURN_IF_FALSE(new_block = compiler_new_block(c));
+        pc->fail_pop[pc->fail_pop_size++] = new_block;
+    }
+    return 1;
+}
+
+// Use op to jump to the correct fail_pop block.
+static int
+jump_to_fail_pop(struct compiler *c, pattern_context *pc, int op)
+{
+    // Pop any items on the top of the stack, plus any objects we were going to
+    // capture on success:
+    Py_ssize_t pops = pc->on_top + PyList_GET_SIZE(pc->stores);
+    RETURN_IF_FALSE(ensure_fail_pop(c, pc, pops));
+    ADDOP_JUMP(c, op, pc->fail_pop[pops]);
+    NEXT_BLOCK(c);
+    return 1;
+}
+
+// Build all of the fail_pop blocks and reset fail_pop.
+static int
+emit_and_reset_fail_pop(struct compiler *c, pattern_context *pc)
+{
+    if (!pc->fail_pop_size) {
+        assert(pc->fail_pop == NULL);
+        NEXT_BLOCK(c);
+        return 1;
+    }
+    while (--pc->fail_pop_size) {
+        compiler_use_next_block(c, pc->fail_pop[pc->fail_pop_size]);
+        if (!compiler_addop(c, POP_TOP)) {
+            pc->fail_pop_size = 0;
+            PyObject_Free(pc->fail_pop);
+            pc->fail_pop = NULL;
+            return 0;
+        }
+    }
+    compiler_use_next_block(c, pc->fail_pop[0]);
+    PyObject_Free(pc->fail_pop);
+    pc->fail_pop = NULL;
+    return 1;
+}
+
+static int
+compiler_error_duplicate_store(struct compiler *c, identifier n)
+{
+    return compiler_error(c, "multiple assignments to name %R in pattern", n);
+}
+
+static int
+pattern_helper_store_name(struct compiler *c, identifier n, pattern_context *pc)
+{
+    if (n == NULL) {
+        ADDOP(c, POP_TOP);
+        return 1;
+    }
+    if (forbidden_name(c, n, Store)) {
+        return 0;
+    }
+    // Can't assign to the same name twice:
+    int duplicate = PySequence_Contains(pc->stores, n);
+    if (duplicate < 0) {
+        return 0;
+    }
+    if (duplicate) {
+        return compiler_error_duplicate_store(c, n);
+    }
+    // Rotate this object underneath any items we need to preserve:
+    ADDOP_I(c, ROT_N, pc->on_top + PyList_GET_SIZE(pc->stores) + 1);
+    return !PyList_Append(pc->stores, n);
+}
+
+
+static int
+pattern_unpack_helper(struct compiler *c, asdl_pattern_seq *elts)
+{
+    Py_ssize_t n = asdl_seq_LEN(elts);
+    int seen_star = 0;
+    for (Py_ssize_t i = 0; i < n; i++) {
+        pattern_ty elt = asdl_seq_GET(elts, i);
+        if (elt->kind == MatchStar_kind && !seen_star) {
+            if ((i >= (1 << 8)) ||
+                (n-i-1 >= (INT_MAX >> 8)))
+                return compiler_error(c,
+                    "too many expressions in "
+                    "star-unpacking sequence pattern");
+            ADDOP_I(c, UNPACK_EX, (i + ((n-i-1) << 8)));
+            seen_star = 1;
+        }
+        else if (elt->kind == MatchStar_kind) {
+            return compiler_error(c,
+                "multiple starred expressions in sequence pattern");
+        }
+    }
+    if (!seen_star) {
+        ADDOP_I(c, UNPACK_SEQUENCE, n);
+    }
+    return 1;
+}
+
+static int
+pattern_helper_sequence_unpack(struct compiler *c, asdl_pattern_seq *patterns,
+                               Py_ssize_t star, pattern_context *pc)
+{
+    RETURN_IF_FALSE(pattern_unpack_helper(c, patterns));
+    Py_ssize_t size = asdl_seq_LEN(patterns);
+    // We've now got a bunch of new subjects on the stack. They need to remain
+    // there after each subpattern match:
+    pc->on_top += size;
+    for (Py_ssize_t i = 0; i < size; i++) {
+        // One less item to keep track of each time we loop through:
+        pc->on_top--;
+        pattern_ty pattern = asdl_seq_GET(patterns, i);
+        RETURN_IF_FALSE(compiler_pattern_subpattern(c, pattern, pc));
+    }
+    return 1;
+}
+
+// Like pattern_helper_sequence_unpack, but uses BINARY_SUBSCR instead of
+// UNPACK_SEQUENCE / UNPACK_EX. This is more efficient for patterns with a
+// starred wildcard like [first, *_] / [first, *_, last] / [*_, last] / etc.
+static int
+pattern_helper_sequence_subscr(struct compiler *c, asdl_pattern_seq *patterns,
+                               Py_ssize_t star, pattern_context *pc)
+{
+    // We need to keep the subject around for extracting elements:
+    pc->on_top++;
+    Py_ssize_t size = asdl_seq_LEN(patterns);
+    for (Py_ssize_t i = 0; i < size; i++) {
+        pattern_ty pattern = asdl_seq_GET(patterns, i);
+        if (WILDCARD_CHECK(pattern)) {
+            continue;
+        }
+        if (i == star) {
+            assert(WILDCARD_STAR_CHECK(pattern));
+            continue;
+        }
+        ADDOP(c, DUP_TOP);
+        if (i < star) {
+            ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(i));
+        }
+        else {
+            // The subject may not support negative indexing! Compute a
+            // nonnegative index:
+            ADDOP(c, GET_LEN);
+            ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size - i));
+            ADDOP(c, BINARY_SUBTRACT);
+        }
+        ADDOP(c, BINARY_SUBSCR);
+        RETURN_IF_FALSE(compiler_pattern_subpattern(c, pattern, pc));
+    }
+    // Pop the subject, we're done with it:
+    pc->on_top--;
+    ADDOP(c, POP_TOP);
+    return 1;
+}
+
+// Like compiler_pattern, but turn off checks for irrefutability.
+static int
+compiler_pattern_subpattern(struct compiler *c, pattern_ty p, pattern_context *pc)
+{
+    int allow_irrefutable = pc->allow_irrefutable;
+    pc->allow_irrefutable = 1;
+    RETURN_IF_FALSE(compiler_pattern(c, p, pc));
+    pc->allow_irrefutable = allow_irrefutable;
+    return 1;
+}
+
+static int
+compiler_pattern_as(struct compiler *c, pattern_ty p, pattern_context *pc)
+{
+    assert(p->kind == MatchAs_kind);
+    if (p->v.MatchAs.pattern == NULL) {
+        // An irrefutable match:
+        if (!pc->allow_irrefutable) {
+            if (p->v.MatchAs.name) {
+                const char *e = "name capture %R makes remaining patterns unreachable";
+                return compiler_error(c, e, p->v.MatchAs.name);
+            }
+            const char *e = "wildcard makes remaining patterns unreachable";
+            return compiler_error(c, e);
+        }
+        return pattern_helper_store_name(c, p->v.MatchAs.name, pc);
+    }
+    // Need to make a copy for (possibly) storing later:
+    pc->on_top++;
+    ADDOP(c, DUP_TOP);
+    RETURN_IF_FALSE(compiler_pattern(c, p->v.MatchAs.pattern, pc));
+    // Success! Store it:
+    pc->on_top--;
+    RETURN_IF_FALSE(pattern_helper_store_name(c, p->v.MatchAs.name, pc));
+    return 1;
+}
+
+static int
+compiler_pattern_star(struct compiler *c, pattern_ty p, pattern_context *pc)
+{
+    assert(p->kind == MatchStar_kind);
+    RETURN_IF_FALSE(pattern_helper_store_name(c, p->v.MatchStar.name, pc));
+    return 1;
+}
+
+static int
+validate_kwd_attrs(struct compiler *c, asdl_identifier_seq *attrs, asdl_pattern_seq* patterns)
+{
+    // Any errors will point to the pattern rather than the arg name as the
+    // parser is only supplying identifiers rather than Name or keyword nodes
+    Py_ssize_t nattrs = asdl_seq_LEN(attrs);
+    for (Py_ssize_t i = 0; i < nattrs; i++) {
+        identifier attr = ((identifier)asdl_seq_GET(attrs, i));
+        SET_LOC(c, ((pattern_ty) asdl_seq_GET(patterns, i)));
+        if (forbidden_name(c, attr, Store)) {
+            return -1;
+        }
+        for (Py_ssize_t j = i + 1; j < nattrs; j++) {
+            identifier other = ((identifier)asdl_seq_GET(attrs, j));
+            if (!PyUnicode_Compare(attr, other)) {
+                SET_LOC(c, ((pattern_ty) asdl_seq_GET(patterns, j)));
+                compiler_error(c, "attribute name repeated in class pattern: %U", attr);
+                return -1;
+            }
+        }
+    }
+    return 0;
+}
+
+static int
+compiler_pattern_class(struct compiler *c, pattern_ty p, pattern_context *pc)
+{
+    assert(p->kind == MatchClass_kind);
+    asdl_pattern_seq *patterns = p->v.MatchClass.patterns;
+    asdl_identifier_seq *kwd_attrs = p->v.MatchClass.kwd_attrs;
+    asdl_pattern_seq *kwd_patterns = p->v.MatchClass.kwd_patterns;
+    Py_ssize_t nargs = asdl_seq_LEN(patterns);
+    Py_ssize_t nattrs = asdl_seq_LEN(kwd_attrs);
+    Py_ssize_t nkwd_patterns = asdl_seq_LEN(kwd_patterns);
+    if (nattrs != nkwd_patterns) {
+        // AST validator shouldn't let this happen, but if it does,
+        // just fail, don't crash out of the interpreter
+        const char * e = "kwd_attrs (%d) / kwd_patterns (%d) length mismatch in class pattern";
+        return compiler_error(c, e, nattrs, nkwd_patterns);
+    }
+    if (INT_MAX < nargs || INT_MAX < nargs + nattrs - 1) {
+        const char *e = "too many sub-patterns in class pattern %R";
+        return compiler_error(c, e, p->v.MatchClass.cls);
+    }
+    if (nattrs) {
+        RETURN_IF_FALSE(!validate_kwd_attrs(c, kwd_attrs, kwd_patterns));
+        SET_LOC(c, p);
+    }
+    VISIT(c, expr, p->v.MatchClass.cls);
+    PyObject *attr_names;
+    RETURN_IF_FALSE(attr_names = PyTuple_New(nattrs));
+    Py_ssize_t i;
+    for (i = 0; i < nattrs; i++) {
+        PyObject *name = asdl_seq_GET(kwd_attrs, i);
+        Py_INCREF(name);
+        PyTuple_SET_ITEM(attr_names, i, name);
+    }
+    ADDOP_LOAD_CONST_NEW(c, attr_names);
+    ADDOP_I(c, MATCH_CLASS, nargs);
+    // TOS is now a tuple of (nargs + nattrs) attributes. Preserve it:
+    pc->on_top++;
+    RETURN_IF_FALSE(jump_to_fail_pop(c, pc, POP_JUMP_IF_FALSE));
+    for (i = 0; i < nargs + nattrs; i++) {
+        pattern_ty pattern;
+        if (i < nargs) {
+            // Positional:
+            pattern = asdl_seq_GET(patterns, i);
+        }
+        else {
+            // Keyword:
+            pattern = asdl_seq_GET(kwd_patterns, i - nargs);
+        }
+        if (WILDCARD_CHECK(pattern)) {
+            continue;
+        }
+        // Get the i-th attribute, and match it against the i-th pattern:
+        ADDOP(c, DUP_TOP);
+        ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(i));
+        ADDOP(c, BINARY_SUBSCR);
+        RETURN_IF_FALSE(compiler_pattern_subpattern(c, pattern, pc));
+    }
+    // Success! Pop the tuple of attributes:
+    pc->on_top--;
+    ADDOP(c, POP_TOP);
+    return 1;
+}
+
+static int
+compiler_pattern_mapping(struct compiler *c, pattern_ty p, pattern_context *pc)
+{
+    assert(p->kind == MatchMapping_kind);
+    asdl_expr_seq *keys = p->v.MatchMapping.keys;
+    asdl_pattern_seq *patterns = p->v.MatchMapping.patterns;
+    Py_ssize_t size = asdl_seq_LEN(keys);
+    Py_ssize_t npatterns = asdl_seq_LEN(patterns);
+    if (size != npatterns) {
+        // AST validator shouldn't let this happen, but if it does,
+        // just fail, don't crash out of the interpreter
+        const char * e = "keys (%d) / patterns (%d) length mismatch in mapping pattern";
+        return compiler_error(c, e, size, npatterns);
+    }
+    // We have a double-star target if "rest" is set
+    PyObject *star_target = p->v.MatchMapping.rest;
+    // We need to keep the subject on top during the mapping and length checks:
+    pc->on_top++;
+    ADDOP(c, MATCH_MAPPING);
+    RETURN_IF_FALSE(jump_to_fail_pop(c, pc, POP_JUMP_IF_FALSE));
+    if (!size && !star_target) {
+        // If the pattern is just "{}", we're done! Pop the subject:
+        pc->on_top--;
+        ADDOP(c, POP_TOP);
+        return 1;
+    }
+    if (size) {
+        // If the pattern has any keys in it, perform a length check:
+        ADDOP(c, GET_LEN);
+        ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size));
+        ADDOP_COMPARE(c, GtE);
+        RETURN_IF_FALSE(jump_to_fail_pop(c, pc, POP_JUMP_IF_FALSE));
+    }
+    if (INT_MAX < size - 1) {
+        return compiler_error(c, "too many sub-patterns in mapping pattern");
+    }
+    // Collect all of the keys into a tuple for MATCH_KEYS and
+    // COPY_DICT_WITHOUT_KEYS. They can either be dotted names or literals:
+
+    // Maintaining a set of Constant_kind kind keys allows us to raise a
+    // SyntaxError in the case of duplicates.
+    PyObject *seen = PySet_New(NULL);
+    if (seen == NULL) {
+        return 0;
+    }
+
+    // NOTE: goto error on failure in the loop below to avoid leaking `seen`
+    for (Py_ssize_t i = 0; i < size; i++) {
+        expr_ty key = asdl_seq_GET(keys, i);
+        if (key == NULL) {
+            const char *e = "can't use NULL keys in MatchMapping "
+                            "(set 'rest' parameter instead)";
+            SET_LOC(c, ((pattern_ty) asdl_seq_GET(patterns, i)));
+            compiler_error(c, e);
+            goto error;
+        }
+
+        if (key->kind == Constant_kind) {
+            int in_seen = PySet_Contains(seen, key->v.Constant.value);
+            if (in_seen < 0) {
+                goto error;
+            }
+            if (in_seen) {
+                const char *e = "mapping pattern checks duplicate key (%R)";
+                compiler_error(c, e, key->v.Constant.value);
+                goto error;
+            }
+            if (PySet_Add(seen, key->v.Constant.value)) {
+                goto error;
+            }
+        }
+
+        else if (key->kind != Attribute_kind) {
+            const char *e = "mapping pattern keys may only match literals and attribute lookups";
+            compiler_error(c, e);
+            goto error;
+        }
+        if (!compiler_visit_expr(c, key)) {
+            goto error;
+        }
+    }
+
+    // all keys have been checked; there are no duplicates
+    Py_DECREF(seen);
+
+    ADDOP_I(c, BUILD_TUPLE, size);
+    ADDOP(c, MATCH_KEYS);
+    // There's now a tuple of keys and a tuple of values on top of the subject:
+    pc->on_top += 2;
+    RETURN_IF_FALSE(jump_to_fail_pop(c, pc, POP_JUMP_IF_FALSE));
+    // So far so good. Use that tuple of values on the stack to match
+    // sub-patterns against:
+    for (Py_ssize_t i = 0; i < size; i++) {
+        pattern_ty pattern = asdl_seq_GET(patterns, i);
+        if (WILDCARD_CHECK(pattern)) {
+            continue;
+        }
+        ADDOP(c, DUP_TOP);
+        ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(i));
+        ADDOP(c, BINARY_SUBSCR);
+        RETURN_IF_FALSE(compiler_pattern_subpattern(c, pattern, pc));
+    }
+    // If we get this far, it's a match! We're done with the tuple of values,
+    // and whatever happens next should consume the tuple of keys underneath it:
+    pc->on_top -= 2;
+    ADDOP(c, POP_TOP);
+    if (star_target) {
+        // If we have a starred name, bind a dict of remaining items to it:
+        ADDOP(c, COPY_DICT_WITHOUT_KEYS);
+        RETURN_IF_FALSE(pattern_helper_store_name(c, star_target, pc));
+    }
+    else {
+        // Otherwise, we don't care about this tuple of keys anymore:
+        ADDOP(c, POP_TOP);
+    }
+    // Pop the subject:
+    pc->on_top--;
+    ADDOP(c, POP_TOP);
+    return 1;
+
+error:
+    Py_DECREF(seen);
+    return 0;
+}
+
+static int
+compiler_pattern_or(struct compiler *c, pattern_ty p, pattern_context *pc)
+{
+    assert(p->kind == MatchOr_kind);
+    basicblock *end;
+    RETURN_IF_FALSE(end = compiler_new_block(c));
+    Py_ssize_t size = asdl_seq_LEN(p->v.MatchOr.patterns);
+    assert(size > 1);
+    // We're going to be messing with pc. Keep the original info handy:
+    pattern_context old_pc = *pc;
+    Py_INCREF(pc->stores);
+    // control is the list of names bound by the first alternative. It is used
+    // for checking different name bindings in alternatives, and for correcting
+    // the order in which extracted elements are placed on the stack.
+    PyObject *control = NULL;
+    // NOTE: We can't use returning macros anymore! goto error on error.
+    for (Py_ssize_t i = 0; i < size; i++) {
+        pattern_ty alt = asdl_seq_GET(p->v.MatchOr.patterns, i);
+        SET_LOC(c, alt);
+        PyObject *pc_stores = PyList_New(0);
+        if (pc_stores == NULL) {
+            goto error;
+        }
+        Py_SETREF(pc->stores, pc_stores);
+        // An irrefutable sub-pattern must be last, if it is allowed at all:
+        pc->allow_irrefutable = (i == size - 1) && old_pc.allow_irrefutable;
+        pc->fail_pop = NULL;
+        pc->fail_pop_size = 0;
+        pc->on_top = 0;
+        if (!compiler_addop(c, DUP_TOP) || !compiler_pattern(c, alt, pc)) {
+            goto error;
+        }
+        // Success!
+        Py_ssize_t nstores = PyList_GET_SIZE(pc->stores);
+        if (!i) {
+            // This is the first alternative, so save its stores as a "control"
+            // for the others (they can't bind a different set of names, and
+            // might need to be reordered):
+            assert(control == NULL);
+            control = pc->stores;
+            Py_INCREF(control);
+        }
+        else if (nstores != PyList_GET_SIZE(control)) {
+            goto diff;
+        }
+        else if (nstores) {
+            // There were captures. Check to see if we differ from control:
+            Py_ssize_t icontrol = nstores;
+            while (icontrol--) {
+                PyObject *name = PyList_GET_ITEM(control, icontrol);
+                Py_ssize_t istores = PySequence_Index(pc->stores, name);
+                if (istores < 0) {
+                    PyErr_Clear();
+                    goto diff;
+                }
+                if (icontrol != istores) {
+                    // Reorder the names on the stack to match the order of the
+                    // names in control. There's probably a better way of doing
+                    // this; the current solution is potentially very
+                    // inefficient when each alternative subpattern binds lots
+                    // of names in different orders. It's fine for reasonable
+                    // cases, though.
+                    assert(istores < icontrol);
+                    Py_ssize_t rotations = istores + 1;
+                    // Perform the same rotation on pc->stores:
+                    PyObject *rotated = PyList_GetSlice(pc->stores, 0,
+                                                        rotations);
+                    if (rotated == NULL ||
+                        PyList_SetSlice(pc->stores, 0, rotations, NULL) ||
+                        PyList_SetSlice(pc->stores, icontrol - istores,
+                                        icontrol - istores, rotated))
+                    {
+                        Py_XDECREF(rotated);
+                        goto error;
+                    }
+                    Py_DECREF(rotated);
+                    // That just did:
+                    // rotated = pc_stores[:rotations]
+                    // del pc_stores[:rotations]
+                    // pc_stores[icontrol-istores:icontrol-istores] = rotated
+                    // Do the same thing to the stack, using several ROT_Ns:
+                    while (rotations--) {
+                        if (!compiler_addop_i(c, ROT_N, icontrol + 1)) {
+                            goto error;
+                        }
+                    }
+                }
+            }
+        }
+        assert(control);
+        if (!compiler_addop_j(c, JUMP_FORWARD, end) ||
+            !compiler_next_block(c) ||
+            !emit_and_reset_fail_pop(c, pc))
+        {
+            goto error;
+        }
+    }
+    Py_DECREF(pc->stores);
+    *pc = old_pc;
+    Py_INCREF(pc->stores);
+    // Need to NULL this for the PyObject_Free call in the error block.
+    old_pc.fail_pop = NULL;
+    // No match. Pop the remaining copy of the subject and fail:
+    if (!compiler_addop(c, POP_TOP) || !jump_to_fail_pop(c, pc, JUMP_FORWARD)) {
+        goto error;
+    }
+    compiler_use_next_block(c, end);
+    Py_ssize_t nstores = PyList_GET_SIZE(control);
+    // There's a bunch of stuff on the stack between any where the new stores
+    // are and where they need to be:
+    // - The other stores.
+    // - A copy of the subject.
+    // - Anything else that may be on top of the stack.
+    // - Any previous stores we've already stashed away on the stack.
+    Py_ssize_t nrots = nstores + 1 + pc->on_top + PyList_GET_SIZE(pc->stores);
+    for (Py_ssize_t i = 0; i < nstores; i++) {
+        // Rotate this capture to its proper place on the stack:
+        if (!compiler_addop_i(c, ROT_N, nrots)) {
+            goto error;
+        }
+        // Update the list of previous stores with this new name, checking for
+        // duplicates:
+        PyObject *name = PyList_GET_ITEM(control, i);
+        int dupe = PySequence_Contains(pc->stores, name);
+        if (dupe < 0) {
+            goto error;
+        }
+        if (dupe) {
+            compiler_error_duplicate_store(c, name);
+            goto error;
+        }
+        if (PyList_Append(pc->stores, name)) {
+            goto error;
+        }
+    }
+    Py_DECREF(old_pc.stores);
+    Py_DECREF(control);
+    // NOTE: Returning macros are safe again.
+    // Pop the copy of the subject:
+    ADDOP(c, POP_TOP);
+    return 1;
+diff:
+    compiler_error(c, "alternative patterns bind different names");
+error:
+    PyObject_Free(old_pc.fail_pop);
+    Py_DECREF(old_pc.stores);
+    Py_XDECREF(control);
+    return 0;
+}
+
+
+static int
+compiler_pattern_sequence(struct compiler *c, pattern_ty p, pattern_context *pc)
+{
+    assert(p->kind == MatchSequence_kind);
+    asdl_pattern_seq *patterns = p->v.MatchSequence.patterns;
+    Py_ssize_t size = asdl_seq_LEN(patterns);
+    Py_ssize_t star = -1;
+    int only_wildcard = 1;
+    int star_wildcard = 0;
+    // Find a starred name, if it exists. There may be at most one:
+    for (Py_ssize_t i = 0; i < size; i++) {
+        pattern_ty pattern = asdl_seq_GET(patterns, i);
+        if (pattern->kind == MatchStar_kind) {
+            if (star >= 0) {
+                const char *e = "multiple starred names in sequence pattern";
+                return compiler_error(c, e);
+            }
+            star_wildcard = WILDCARD_STAR_CHECK(pattern);
+            only_wildcard &= star_wildcard;
+            star = i;
+            continue;
+        }
+        only_wildcard &= WILDCARD_CHECK(pattern);
+    }
+    // We need to keep the subject on top during the sequence and length checks:
+    pc->on_top++;
+    ADDOP(c, MATCH_SEQUENCE);
+    RETURN_IF_FALSE(jump_to_fail_pop(c, pc, POP_JUMP_IF_FALSE));
+    if (star < 0) {
+        // No star: len(subject) == size
+        ADDOP(c, GET_LEN);
+        ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size));
+        ADDOP_COMPARE(c, Eq);
+        RETURN_IF_FALSE(jump_to_fail_pop(c, pc, POP_JUMP_IF_FALSE));
+    }
+    else if (size > 1) {
+        // Star: len(subject) >= size - 1
+        ADDOP(c, GET_LEN);
+        ADDOP_LOAD_CONST_NEW(c, PyLong_FromSsize_t(size - 1));
+        ADDOP_COMPARE(c, GtE);
+        RETURN_IF_FALSE(jump_to_fail_pop(c, pc, POP_JUMP_IF_FALSE));
+    }
+    // Whatever comes next should consume the subject:
+    pc->on_top--;
+    if (only_wildcard) {
+        // Patterns like: [] / [_] / [_, _] / [*_] / [_, *_] / [_, _, *_] / etc.
+        ADDOP(c, POP_TOP);
+    }
+    else if (star_wildcard) {
+        RETURN_IF_FALSE(pattern_helper_sequence_subscr(c, patterns, star, pc));
+    }
+    else {
+        RETURN_IF_FALSE(pattern_helper_sequence_unpack(c, patterns, star, pc));
+    }
+    return 1;
+}
+
+static int
+compiler_pattern_value(struct compiler *c, pattern_ty p, pattern_context *pc)
+{
+    assert(p->kind == MatchValue_kind);
+    expr_ty value = p->v.MatchValue.value;
+    if (!MATCH_VALUE_EXPR(value)) {
+        const char *e = "patterns may only match literals and attribute lookups";
+        return compiler_error(c, e);
+    }
+    VISIT(c, expr, value);
+    ADDOP_COMPARE(c, Eq);
+    RETURN_IF_FALSE(jump_to_fail_pop(c, pc, POP_JUMP_IF_FALSE));
+    return 1;
+}
+
+static int
+compiler_pattern_singleton(struct compiler *c, pattern_ty p, pattern_context *pc)
+{
+    assert(p->kind == MatchSingleton_kind);
+    ADDOP_LOAD_CONST(c, p->v.MatchSingleton.value);
+    ADDOP_COMPARE(c, Is);
+    RETURN_IF_FALSE(jump_to_fail_pop(c, pc, POP_JUMP_IF_FALSE));
+    return 1;
+}
+
+static int
+compiler_pattern(struct compiler *c, pattern_ty p, pattern_context *pc)
+{
+    SET_LOC(c, p);
+    switch (p->kind) {
+        case MatchValue_kind:
+            return compiler_pattern_value(c, p, pc);
+        case MatchSingleton_kind:
+            return compiler_pattern_singleton(c, p, pc);
+        case MatchSequence_kind:
+            return compiler_pattern_sequence(c, p, pc);
+        case MatchMapping_kind:
+            return compiler_pattern_mapping(c, p, pc);
+        case MatchClass_kind:
+            return compiler_pattern_class(c, p, pc);
+        case MatchStar_kind:
+            return compiler_pattern_star(c, p, pc);
+        case MatchAs_kind:
+            return compiler_pattern_as(c, p, pc);
+        case MatchOr_kind:
+            return compiler_pattern_or(c, p, pc);
+    }
+    // AST validator shouldn't let this happen, but if it does,
+    // just fail, don't crash out of the interpreter
+    const char *e = "invalid match pattern node in AST (kind=%d)";
+    return compiler_error(c, e, p->kind);
+}
+
+static int
+compiler_match_inner(struct compiler *c, stmt_ty s, pattern_context *pc)
+{
+    VISIT(c, expr, s->v.Match.subject);
+    basicblock *end;
+    RETURN_IF_FALSE(end = compiler_new_block(c));
+    Py_ssize_t cases = asdl_seq_LEN(s->v.Match.cases);
+    assert(cases > 0);
+    match_case_ty m = asdl_seq_GET(s->v.Match.cases, cases - 1);
+    int has_default = WILDCARD_CHECK(m->pattern) && 1 < cases;
+    for (Py_ssize_t i = 0; i < cases - has_default; i++) {
+        m = asdl_seq_GET(s->v.Match.cases, i);
+        SET_LOC(c, m->pattern);
+        // Only copy the subject if we're *not* on the last case:
+        if (i != cases - has_default - 1) {
+            ADDOP(c, DUP_TOP);
+        }
+        RETURN_IF_FALSE(pc->stores = PyList_New(0));
+        // Irrefutable cases must be either guarded, last, or both:
+        pc->allow_irrefutable = m->guard != NULL || i == cases - 1;
+        pc->fail_pop = NULL;
+        pc->fail_pop_size = 0;
+        pc->on_top = 0;
+        // NOTE: Can't use returning macros here (they'll leak pc->stores)!
+        if (!compiler_pattern(c, m->pattern, pc)) {
+            Py_DECREF(pc->stores);
+            return 0;
+        }
+        assert(!pc->on_top);
+        // It's a match! Store all of the captured names (they're on the stack).
+        Py_ssize_t nstores = PyList_GET_SIZE(pc->stores);
+        for (Py_ssize_t n = 0; n < nstores; n++) {
+            PyObject *name = PyList_GET_ITEM(pc->stores, n);
+            if (!compiler_nameop(c, name, Store)) {
+                Py_DECREF(pc->stores);
+                return 0;
+            }
+        }
+        Py_DECREF(pc->stores);
+        // NOTE: Returning macros are safe again.
+        if (m->guard) {
+            RETURN_IF_FALSE(ensure_fail_pop(c, pc, 0));
+            RETURN_IF_FALSE(compiler_jump_if(c, m->guard, pc->fail_pop[0], 0));
+        }
+        // Success! Pop the subject off, we're done with it:
+        if (i != cases - has_default - 1) {
+            ADDOP(c, POP_TOP);
+        }
+        VISIT_SEQ(c, stmt, m->body);
+        ADDOP_JUMP(c, JUMP_FORWARD, end);
+        // If the pattern fails to match, we want the line number of the
+        // cleanup to be associated with the failed pattern, not the last line
+        // of the body
+        SET_LOC(c, m->pattern);
+        RETURN_IF_FALSE(emit_and_reset_fail_pop(c, pc));
+    }
+    if (has_default) {
+        // A trailing "case _" is common, and lets us save a bit of redundant
+        // pushing and popping in the loop above:
+        m = asdl_seq_GET(s->v.Match.cases, cases - 1);
+        SET_LOC(c, m->pattern);
+        if (cases == 1) {
+            // No matches. Done with the subject:
+            ADDOP(c, POP_TOP);
+        }
+        else {
+            // Show line coverage for default case (it doesn't create bytecode)
+            ADDOP(c, NOP);
+        }
+        if (m->guard) {
+            RETURN_IF_FALSE(compiler_jump_if(c, m->guard, end, 0));
+        }
+        VISIT_SEQ(c, stmt, m->body);
+    }
+    compiler_use_next_block(c, end);
+    return 1;
+}
+
+static int
+compiler_match(struct compiler *c, stmt_ty s)
+{
+    pattern_context pc;
+    pc.fail_pop = NULL;
+    int result = compiler_match_inner(c, s, &pc);
+    PyObject_Free(pc.fail_pop);
+    return result;
+}
+
+#undef WILDCARD_CHECK
+#undef WILDCARD_STAR_CHECK
+
 /* End of the compiler section, beginning of the assembler section */
 
 /* do depth-first search of basic block graph, starting with block.
@@ -5433,39 +6460,14 @@
     PyObject *a_bytecode;  /* string containing bytecode */
     int a_offset;              /* offset into bytecode */
     int a_nblocks;             /* number of reachable blocks */
-    basicblock **a_postorder; /* list of blocks in dfs postorder */
     PyObject *a_lnotab;    /* string containing lnotab */
     int a_lnotab_off;      /* offset into lnotab */
-    int a_lineno;              /* last lineno of emitted instruction */
-    int a_lineno_off;      /* bytecode offset of last lineno */
+    int a_prevlineno;     /* lineno of last emitted line in line table */
+    int a_lineno;          /* lineno of last emitted instruction */
+    int a_lineno_start;    /* bytecode start offset of current lineno */
+    basicblock *a_entry;
 };
 
-static void
-dfs(struct compiler *c, basicblock *b, struct assembler *a, int end)
-{
-    int i, j;
-
-    /* Get rid of recursion for normal control flow.
-       Since the number of blocks is limited, unused space in a_postorder
-       (from a_nblocks to end) can be used as a stack for still not ordered
-       blocks. */
-    for (j = end; b && !b->b_seen; b = b->b_next) {
-        b->b_seen = 1;
-        assert(a->a_nblocks < j);
-        a->a_postorder[--j] = b;
-    }
-    while (j < end) {
-        b = a->a_postorder[j++];
-        for (i = 0; i < b->b_iused; i++) {
-            struct instr *instr = &b->b_instr[i];
-            if (instr->i_jrel || instr->i_jabs)
-                dfs(c, instr->i_target, a, j);
-        }
-        assert(a->a_nblocks < j);
-        a->a_postorder[a->a_nblocks++] = b;
-    }
-}
-
 Py_LOCAL_INLINE(void)
 stackdepth_push(basicblock ***sp, basicblock *b, int depth)
 {
@@ -5491,8 +6493,7 @@
         entryblock = b;
         nblocks++;
     }
-    if (!entryblock)
-        return 0;
+    assert(entryblock!= NULL);
     stack = (basicblock **)PyObject_Malloc(sizeof(basicblock *) * nblocks);
     if (!stack) {
         PyErr_NoMemory();
@@ -5500,7 +6501,11 @@
     }
 
     sp = stack;
-    stackdepth_push(&sp, entryblock, 0);
+    if (c->u->u_ste->ste_generator || c->u->u_ste->ste_coroutine) {
+        stackdepth_push(&sp, entryblock, 1);
+    } else {
+        stackdepth_push(&sp, entryblock, 0);
+    }
     while (sp != stack) {
         b = *--sp;
         int depth = b->b_startdepth;
@@ -5510,15 +6515,17 @@
             struct instr *instr = &b->b_instr[i];
             int effect = stack_effect(instr->i_opcode, instr->i_oparg, 0);
             if (effect == PY_INVALID_STACK_EFFECT) {
-                _Py_FatalErrorFormat(__func__,
-                    "opcode = %d", instr->i_opcode);
+                PyErr_Format(PyExc_SystemError,
+                             "compiler stack_effect(opcode=%d, arg=%i) failed",
+                             instr->i_opcode, instr->i_oparg);
+                return -1;
             }
             int new_depth = depth + effect;
             if (new_depth > maxdepth) {
                 maxdepth = new_depth;
             }
             assert(depth >= 0); /* invalid code or bug in stackdepth() */
-            if (instr->i_jrel || instr->i_jabs) {
+            if (is_jump(instr)) {
                 effect = stack_effect(instr->i_opcode, instr->i_oparg, 1);
                 assert(effect != PY_INVALID_STACK_EFFECT);
                 int target_depth = depth + effect;
@@ -5541,6 +6548,7 @@
             }
         }
         if (next != NULL) {
+            assert(b->b_nofallthrough == 0);
             stackdepth_push(&sp, next, depth);
         }
     }
@@ -5552,24 +6560,25 @@
 assemble_init(struct assembler *a, int nblocks, int firstlineno)
 {
     memset(a, 0, sizeof(struct assembler));
-    a->a_lineno = firstlineno;
+    a->a_prevlineno = a->a_lineno = firstlineno;
+    a->a_lnotab = NULL;
     a->a_bytecode = PyBytes_FromStringAndSize(NULL, DEFAULT_CODE_SIZE);
-    if (!a->a_bytecode)
-        return 0;
+    if (a->a_bytecode == NULL) {
+        goto error;
+    }
     a->a_lnotab = PyBytes_FromStringAndSize(NULL, DEFAULT_LNOTAB_SIZE);
-    if (!a->a_lnotab)
-        return 0;
+    if (a->a_lnotab == NULL) {
+        goto error;
+    }
     if ((size_t)nblocks > SIZE_MAX / sizeof(basicblock *)) {
         PyErr_NoMemory();
-        return 0;
-    }
-    a->a_postorder = (basicblock **)PyObject_Malloc(
-                                        sizeof(basicblock *) * nblocks);
-    if (!a->a_postorder) {
-        PyErr_NoMemory();
-        return 0;
+        goto error;
     }
     return 1;
+error:
+    Py_XDECREF(a->a_bytecode);
+    Py_XDECREF(a->a_lnotab);
+    return 0;
 }
 
 static void
@@ -5577,8 +6586,6 @@
 {
     Py_XDECREF(a->a_bytecode);
     Py_XDECREF(a->a_lnotab);
-    if (a->a_postorder)
-        PyObject_Free(a->a_postorder);
 }
 
 static int
@@ -5592,114 +6599,81 @@
     return size;
 }
 
-/* Appends a pair to the end of the line number table, a_lnotab, representing
-   the instruction's bytecode offset and line number.  See
-   Objects/lnotab_notes.txt for the description of the line number table. */
-
 static int
-assemble_lnotab(struct assembler *a, struct instr *i)
+assemble_emit_linetable_pair(struct assembler *a, int bdelta, int ldelta)
 {
-    int d_bytecode, d_lineno;
-    Py_ssize_t len;
-    unsigned char *lnotab;
-
-    d_lineno = i->i_lineno - a->a_lineno;
-    if (d_lineno == 0) {
-        return 1;
-    }
-
-    d_bytecode = (a->a_offset - a->a_lineno_off) * sizeof(_Py_CODEUNIT);
-    assert(d_bytecode >= 0);
-
-    if (d_bytecode > 255) {
-        int j, nbytes, ncodes = d_bytecode / 255;
-        nbytes = a->a_lnotab_off + 2 * ncodes;
-        len = PyBytes_GET_SIZE(a->a_lnotab);
-        if (nbytes >= len) {
-            if ((len <= INT_MAX / 2) && (len * 2 < nbytes))
-                len = nbytes;
-            else if (len <= INT_MAX / 2)
-                len *= 2;
-            else {
-                PyErr_NoMemory();
-                return 0;
-            }
-            if (_PyBytes_Resize(&a->a_lnotab, len) < 0)
-                return 0;
-        }
-        lnotab = (unsigned char *)
-                   PyBytes_AS_STRING(a->a_lnotab) + a->a_lnotab_off;
-        for (j = 0; j < ncodes; j++) {
-            *lnotab++ = 255;
-            *lnotab++ = 0;
-        }
-        d_bytecode -= ncodes * 255;
-        a->a_lnotab_off += ncodes * 2;
-    }
-    assert(0 <= d_bytecode && d_bytecode <= 255);
-
-    if (d_lineno < -128 || 127 < d_lineno) {
-        int j, nbytes, ncodes, k;
-        if (d_lineno < 0) {
-            k = -128;
-            /* use division on positive numbers */
-            ncodes = (-d_lineno) / 128;
-        }
-        else {
-            k = 127;
-            ncodes = d_lineno / 127;
-        }
-        d_lineno -= ncodes * k;
-        assert(ncodes >= 1);
-        nbytes = a->a_lnotab_off + 2 * ncodes;
-        len = PyBytes_GET_SIZE(a->a_lnotab);
-        if (nbytes >= len) {
-            if ((len <= INT_MAX / 2) && len * 2 < nbytes)
-                len = nbytes;
-            else if (len <= INT_MAX / 2)
-                len *= 2;
-            else {
-                PyErr_NoMemory();
-                return 0;
-            }
-            if (_PyBytes_Resize(&a->a_lnotab, len) < 0)
-                return 0;
-        }
-        lnotab = (unsigned char *)
-                   PyBytes_AS_STRING(a->a_lnotab) + a->a_lnotab_off;
-        *lnotab++ = d_bytecode;
-        *lnotab++ = k;
-        d_bytecode = 0;
-        for (j = 1; j < ncodes; j++) {
-            *lnotab++ = 0;
-            *lnotab++ = k;
-        }
-        a->a_lnotab_off += ncodes * 2;
-    }
-    assert(-128 <= d_lineno && d_lineno <= 127);
-
-    len = PyBytes_GET_SIZE(a->a_lnotab);
+    Py_ssize_t len = PyBytes_GET_SIZE(a->a_lnotab);
     if (a->a_lnotab_off + 2 >= len) {
         if (_PyBytes_Resize(&a->a_lnotab, len * 2) < 0)
             return 0;
     }
-    lnotab = (unsigned char *)
-                    PyBytes_AS_STRING(a->a_lnotab) + a->a_lnotab_off;
-
+    unsigned char *lnotab = (unsigned char *) PyBytes_AS_STRING(a->a_lnotab);
+    lnotab += a->a_lnotab_off;
     a->a_lnotab_off += 2;
-    if (d_bytecode) {
-        *lnotab++ = d_bytecode;
-        *lnotab++ = d_lineno;
-    }
-    else {      /* First line of a block; def stmt, etc. */
-        *lnotab++ = 0;
-        *lnotab++ = d_lineno;
-    }
-    a->a_lineno = i->i_lineno;
-    a->a_lineno_off = a->a_offset;
+    *lnotab++ = bdelta;
+    *lnotab++ = ldelta;
     return 1;
 }
 
+/* Appends a range to the end of the line number table. See
+ *  Objects/lnotab_notes.txt for the description of the line number table. */
+
+static int
+assemble_line_range(struct assembler *a)
+{
+    int ldelta, bdelta;
+    bdelta =  (a->a_offset - a->a_lineno_start) * sizeof(_Py_CODEUNIT);
+    if (bdelta == 0) {
+        return 1;
+    }
+    if (a->a_lineno < 0) {
+        ldelta = -128;
+    }
+    else {
+        ldelta = a->a_lineno - a->a_prevlineno;
+        a->a_prevlineno = a->a_lineno;
+        while (ldelta > 127) {
+            if (!assemble_emit_linetable_pair(a, 0, 127)) {
+                return 0;
+            }
+            ldelta -= 127;
+        }
+        while (ldelta < -127) {
+            if (!assemble_emit_linetable_pair(a, 0, -127)) {
+                return 0;
+            }
+            ldelta += 127;
+        }
+    }
+    assert(-128 <= ldelta && ldelta < 128);
+    while (bdelta > 254) {
+        if (!assemble_emit_linetable_pair(a, 254, ldelta)) {
+            return 0;
+        }
+        ldelta = a->a_lineno < 0 ? -128 : 0;
+        bdelta -= 254;
+    }
+    if (!assemble_emit_linetable_pair(a, bdelta, ldelta)) {
+        return 0;
+    }
+    a->a_lineno_start = a->a_offset;
+    return 1;
+}
+
+static int
+assemble_lnotab(struct assembler *a, struct instr *i)
+{
+    if (i->i_lineno == a->a_lineno) {
+        return 1;
+    }
+    if (!assemble_line_range(a)) {
+        return 0;
+    }
+    a->a_lineno = i->i_lineno;
+    return 1;
+}
+
+
 /* assemble_emit()
    Extend the bytecode with a new instruction.
    Update lnotab if necessary.
@@ -5729,6 +6703,31 @@
 }
 
 static void
+normalize_jumps(struct assembler *a)
+{
+    for (basicblock *b = a->a_entry; b != NULL; b = b->b_next) {
+        b->b_visited = 0;
+    }
+    for (basicblock *b = a->a_entry; b != NULL; b = b->b_next) {
+        b->b_visited = 1;
+        if (b->b_iused == 0) {
+            continue;
+        }
+        struct instr *last = &b->b_instr[b->b_iused-1];
+        if (last->i_opcode == JUMP_ABSOLUTE) {
+            if (last->i_target->b_visited == 0) {
+                last->i_opcode = JUMP_FORWARD;
+            }
+        }
+        if (last->i_opcode == JUMP_FORWARD) {
+            if (last->i_target->b_visited == 1) {
+                last->i_opcode = JUMP_ABSOLUTE;
+            }
+        }
+    }
+}
+
+static void
 assemble_jump_offsets(struct assembler *a, struct compiler *c)
 {
     basicblock *b;
@@ -5739,8 +6738,7 @@
        Replace block pointer with position in bytecode. */
     do {
         totsize = 0;
-        for (i = a->a_nblocks - 1; i >= 0; i--) {
-            b = a->a_postorder[i];
+        for (basicblock *b = a->a_entry; b != NULL; b = b->b_next) {
             bsize = blocksize(b);
             b->b_offset = totsize;
             totsize += bsize;
@@ -5756,12 +6754,11 @@
                    the jump instruction.
                 */
                 bsize += isize;
-                if (instr->i_jabs || instr->i_jrel) {
+                if (is_jump(instr)) {
                     instr->i_oparg = instr->i_target->b_offset;
-                    if (instr->i_jrel) {
+                    if (is_relative_jump(instr)) {
                         instr->i_oparg -= bsize;
                     }
-                    instr->i_oparg *= sizeof(_Py_CODEUNIT);
                     if (instrsize(instr->i_oparg) != isize) {
                         extended_arg_recompile = 1;
                     }
@@ -5816,7 +6813,7 @@
         return NULL;
     while (PyDict_Next(dict, &pos, &k, &v)) {
         i = PyLong_AS_LONG(v);
-        /* The keys of the dictionary can be tuples wrapping a contant.
+        /* The keys of the dictionary can be tuples wrapping a constant.
          * (see compiler_add_o and _PyCode_ConstantKey). In that case
          * the object we want is always second. */
         if (PyTuple_CheckExact(k)) {
@@ -5863,14 +6860,12 @@
     return flags;
 }
 
-// Merge *tuple* with constant cache.
+// Merge *obj* with constant cache.
 // Unlike merge_consts_recursive(), this function doesn't work recursively.
 static int
-merge_const_tuple(struct compiler *c, PyObject **tuple)
+merge_const_one(struct compiler *c, PyObject **obj)
 {
-    assert(PyTuple_CheckExact(*tuple));
-
-    PyObject *key = _PyCode_ConstantKey(*tuple);
+    PyObject *key = _PyCode_ConstantKey(*obj);
     if (key == NULL) {
         return 0;
     }
@@ -5881,40 +6876,40 @@
     if (t == NULL) {
         return 0;
     }
-    if (t == key) {  // tuple is new constant.
+    if (t == key) {  // obj is new constant.
         return 1;
     }
 
-    PyObject *u = PyTuple_GET_ITEM(t, 1);
-    Py_INCREF(u);
-    Py_DECREF(*tuple);
-    *tuple = u;
+    if (PyTuple_CheckExact(t)) {
+        // t is still borrowed reference
+        t = PyTuple_GET_ITEM(t, 1);
+    }
+
+    Py_INCREF(t);
+    Py_DECREF(*obj);
+    *obj = t;
     return 1;
 }
 
 static PyCodeObject *
-makecode(struct compiler *c, struct assembler *a)
+makecode(struct compiler *c, struct assembler *a, PyObject *consts)
 {
-    PyObject *tmp;
     PyCodeObject *co = NULL;
-    PyObject *consts = NULL;
     PyObject *names = NULL;
     PyObject *varnames = NULL;
     PyObject *name = NULL;
     PyObject *freevars = NULL;
     PyObject *cellvars = NULL;
-    PyObject *bytecode = NULL;
     Py_ssize_t nlocals;
     int nlocals_int;
     int flags;
     int posorkeywordargcount, posonlyargcount, kwonlyargcount, maxdepth;
 
-    consts = consts_dict_keys_inorder(c->u->u_consts);
     names = dict_keys_inorder(c->u->u_names, 0);
     varnames = dict_keys_inorder(c->u->u_varnames, 0);
-    if (!consts || !names || !varnames)
+    if (!names || !varnames) {
         goto error;
-
+    }
     cellvars = dict_keys_inorder(c->u->u_cellvars, 0);
     if (!cellvars)
         goto error;
@@ -5922,10 +6917,10 @@
     if (!freevars)
         goto error;
 
-    if (!merge_const_tuple(c, &names) ||
-            !merge_const_tuple(c, &varnames) ||
-            !merge_const_tuple(c, &cellvars) ||
-            !merge_const_tuple(c, &freevars))
+    if (!merge_const_one(c, &names) ||
+            !merge_const_one(c, &varnames) ||
+            !merge_const_one(c, &cellvars) ||
+            !merge_const_one(c, &freevars))
     {
         goto error;
     }
@@ -5938,16 +6933,12 @@
     if (flags < 0)
         goto error;
 
-    bytecode = PyCode_Optimize(a->a_bytecode, consts, names, a->a_lnotab);
-    if (!bytecode)
+    consts = PyList_AsTuple(consts); /* PyCode_New requires a tuple */
+    if (consts == NULL) {
         goto error;
-
-    tmp = PyList_AsTuple(consts); /* PyCode_New requires a tuple */
-    if (!tmp)
-        goto error;
-    Py_DECREF(consts);
-    consts = tmp;
-    if (!merge_const_tuple(c, &consts)) {
+    }
+    if (!merge_const_one(c, &consts)) {
+        Py_DECREF(consts);
         goto error;
     }
 
@@ -5956,21 +6947,28 @@
     kwonlyargcount = Py_SAFE_DOWNCAST(c->u->u_kwonlyargcount, Py_ssize_t, int);
     maxdepth = stackdepth(c);
     if (maxdepth < 0) {
+        Py_DECREF(consts);
+        goto error;
+    }
+    if (maxdepth > MAX_ALLOWED_STACK_USE) {
+        PyErr_Format(PyExc_SystemError,
+                     "excessive stack use: stack is %d deep",
+                     maxdepth);
+        Py_DECREF(consts);
         goto error;
     }
     co = PyCode_NewWithPosOnlyArgs(posonlyargcount+posorkeywordargcount,
                                    posonlyargcount, kwonlyargcount, nlocals_int,
-                                   maxdepth, flags, bytecode, consts, names,
+                                   maxdepth, flags, a->a_bytecode, consts, names,
                                    varnames, freevars, cellvars, c->c_filename,
                                    c->u->u_name, c->u->u_firstlineno, a->a_lnotab);
+    Py_DECREF(consts);
  error:
-    Py_XDECREF(consts);
     Py_XDECREF(names);
     Py_XDECREF(varnames);
     Py_XDECREF(name);
     Py_XDECREF(freevars);
     Py_XDECREF(cellvars);
-    Py_XDECREF(bytecode);
     return co;
 }
 
@@ -5978,10 +6976,11 @@
 /* For debugging purposes only */
 #if 0
 static void
-dump_instr(const struct instr *i)
+dump_instr(struct instr *i)
 {
-    const char *jrel = i->i_jrel ? "jrel " : "";
-    const char *jabs = i->i_jabs ? "jabs " : "";
+    const char *jrel = (is_relative_jump(i)) ? "jrel " : "";
+    const char *jabs = (is_jump(i) && !is_relative_jump(i))? "jabs " : "";
+
     char arg[128];
 
     *arg = '\0';
@@ -5995,10 +6994,9 @@
 static void
 dump_basicblock(const basicblock *b)
 {
-    const char *seen = b->b_seen ? "seen " : "";
     const char *b_return = b->b_return ? "return " : "";
-    fprintf(stderr, "used: %d, depth: %d, offset: %d %s%s\n",
-        b->b_iused, b->b_startdepth, b->b_offset, seen, b_return);
+    fprintf(stderr, "used: %d, depth: %d, offset: %d %s\n",
+        b->b_iused, b->b_startdepth, b->b_offset, b_return);
     if (b->b_instr) {
         int i;
         for (i = 0; i < b->b_iused; i++) {
@@ -6009,69 +7007,910 @@
 }
 #endif
 
+
+static int
+normalize_basic_block(basicblock *bb);
+
+static int
+optimize_cfg(struct compiler *c, struct assembler *a, PyObject *consts);
+
+static int
+trim_unused_consts(struct compiler *c, struct assembler *a, PyObject *consts);
+
+/* Duplicates exit BBs, so that line numbers can be propagated to them */
+static int
+duplicate_exits_without_lineno(struct compiler *c);
+
+static int
+extend_block(basicblock *bb);
+
+static int
+insert_generator_prefix(struct compiler *c, basicblock *entryblock) {
+
+    int flags = compute_code_flags(c);
+    if (flags < 0) {
+        return -1;
+    }
+    int kind;
+    if (flags & (CO_GENERATOR | CO_COROUTINE | CO_ASYNC_GENERATOR)) {
+        if (flags & CO_COROUTINE) {
+            kind = 1;
+        }
+        else if (flags & CO_ASYNC_GENERATOR) {
+            kind = 2;
+        }
+        else {
+            kind = 0;
+        }
+    }
+    else {
+        return 0;
+    }
+    if (compiler_next_instr(entryblock) < 0) {
+        return -1;
+    }
+    for (int i = entryblock->b_iused-1; i > 0; i--) {
+        entryblock->b_instr[i] = entryblock->b_instr[i-1];
+    }
+    entryblock->b_instr[0].i_opcode = GEN_START;
+    entryblock->b_instr[0].i_oparg = kind;
+    entryblock->b_instr[0].i_lineno = -1;
+    entryblock->b_instr[0].i_target = NULL;
+    return 0;
+}
+
+/* Make sure that all returns have a line number, even if early passes
+ * have failed to propagate a correct line number.
+ * The resulting line number may not be correct according to PEP 626,
+ * but should be "good enough", and no worse than in older versions. */
+static void
+guarantee_lineno_for_exits(struct assembler *a, int firstlineno) {
+    int lineno = firstlineno;
+    assert(lineno > 0);
+    for (basicblock *b = a->a_entry; b != NULL; b = b->b_next) {
+        if (b->b_iused == 0) {
+            continue;
+        }
+        struct instr *last = &b->b_instr[b->b_iused-1];
+        if (last->i_lineno < 0) {
+            if (last->i_opcode == RETURN_VALUE) {
+                for (int i = 0; i < b->b_iused; i++) {
+                    assert(b->b_instr[i].i_lineno < 0);
+
+                    b->b_instr[i].i_lineno = lineno;
+                }
+            }
+        }
+        else {
+            lineno = last->i_lineno;
+        }
+    }
+}
+
+static void
+propagate_line_numbers(struct assembler *a);
+
 static PyCodeObject *
 assemble(struct compiler *c, int addNone)
 {
     basicblock *b, *entryblock;
     struct assembler a;
-    int i, j, nblocks;
+    int j, nblocks;
     PyCodeObject *co = NULL;
+    PyObject *consts = NULL;
 
     /* Make sure every block that falls off the end returns None.
        XXX NEXT_BLOCK() isn't quite right, because if the last
        block ends with a jump or return b_next shouldn't set.
      */
     if (!c->u->u_curblock->b_return) {
-        NEXT_BLOCK(c);
+        c->u->u_lineno = -1;
         if (addNone)
             ADDOP_LOAD_CONST(c, Py_None);
         ADDOP(c, RETURN_VALUE);
     }
 
+    for (basicblock *b = c->u->u_blocks; b != NULL; b = b->b_list) {
+        if (normalize_basic_block(b)) {
+            return NULL;
+        }
+    }
+
+    for (basicblock *b = c->u->u_blocks; b != NULL; b = b->b_list) {
+        if (extend_block(b)) {
+            return NULL;
+        }
+    }
+
     nblocks = 0;
     entryblock = NULL;
     for (b = c->u->u_blocks; b != NULL; b = b->b_list) {
         nblocks++;
         entryblock = b;
     }
+    assert(entryblock != NULL);
+
+    if (insert_generator_prefix(c, entryblock)) {
+        goto error;
+    }
 
     /* Set firstlineno if it wasn't explicitly set. */
     if (!c->u->u_firstlineno) {
-        if (entryblock && entryblock->b_instr && entryblock->b_instr->i_lineno)
+        if (entryblock->b_instr && entryblock->b_instr->i_lineno)
             c->u->u_firstlineno = entryblock->b_instr->i_lineno;
-        else
+       else
             c->u->u_firstlineno = 1;
     }
+
     if (!assemble_init(&a, nblocks, c->u->u_firstlineno))
         goto error;
-    dfs(c, entryblock, &a, nblocks);
+    a.a_entry = entryblock;
+    a.a_nblocks = nblocks;
+
+    consts = consts_dict_keys_inorder(c->u->u_consts);
+    if (consts == NULL) {
+        goto error;
+    }
+
+    if (optimize_cfg(c, &a, consts)) {
+        goto error;
+    }
+    if (duplicate_exits_without_lineno(c)) {
+        return NULL;
+    }
+    if (trim_unused_consts(c, &a, consts)) {
+        goto error;
+    }
+    propagate_line_numbers(&a);
+    guarantee_lineno_for_exits(&a, c->u->u_firstlineno);
+
+    /* Order of basic blocks must have been determined by now */
+    normalize_jumps(&a);
 
     /* Can't modify the bytecode after computing jump offsets. */
     assemble_jump_offsets(&a, c);
 
-    /* Emit code in reverse postorder from dfs. */
-    for (i = a.a_nblocks - 1; i >= 0; i--) {
-        b = a.a_postorder[i];
+    /* Emit code. */
+    for(b = entryblock; b != NULL; b = b->b_next) {
         for (j = 0; j < b->b_iused; j++)
             if (!assemble_emit(&a, &b->b_instr[j]))
                 goto error;
     }
+    if (!assemble_line_range(&a)) {
+        return 0;
+    }
 
-    if (_PyBytes_Resize(&a.a_lnotab, a.a_lnotab_off) < 0)
+    if (_PyBytes_Resize(&a.a_lnotab, a.a_lnotab_off) < 0) {
         goto error;
-    if (_PyBytes_Resize(&a.a_bytecode, a.a_offset * sizeof(_Py_CODEUNIT)) < 0)
+    }
+    if (!merge_const_one(c, &a.a_lnotab)) {
         goto error;
+    }
+    if (_PyBytes_Resize(&a.a_bytecode, a.a_offset * sizeof(_Py_CODEUNIT)) < 0) {
+        goto error;
+    }
+    if (!merge_const_one(c, &a.a_bytecode)) {
+        goto error;
+    }
 
-    co = makecode(c, &a);
+    co = makecode(c, &a, consts);
  error:
+    Py_XDECREF(consts);
     assemble_free(&a);
     return co;
 }
 
-#undef PyAST_Compile
-PyCodeObject *
-PyAST_Compile(mod_ty mod, const char *filename, PyCompilerFlags *flags,
-              PyArena *arena)
+/* Replace LOAD_CONST c1, LOAD_CONST c2 ... LOAD_CONST cn, BUILD_TUPLE n
+   with    LOAD_CONST (c1, c2, ... cn).
+   The consts table must still be in list form so that the
+   new constant (c1, c2, ... cn) can be appended.
+   Called with codestr pointing to the first LOAD_CONST.
+*/
+static int
+fold_tuple_on_constants(struct compiler *c,
+                        struct instr *inst,
+                        int n, PyObject *consts)
 {
-    return PyAST_CompileEx(mod, filename, flags, -1, arena);
+    /* Pre-conditions */
+    assert(PyList_CheckExact(consts));
+    assert(inst[n].i_opcode == BUILD_TUPLE);
+    assert(inst[n].i_oparg == n);
+
+    for (int i = 0; i < n; i++) {
+        if (inst[i].i_opcode != LOAD_CONST) {
+            return 0;
+        }
+    }
+
+    /* Buildup new tuple of constants */
+    PyObject *newconst = PyTuple_New(n);
+    if (newconst == NULL) {
+        return -1;
+    }
+    for (int i = 0; i < n; i++) {
+        int arg = inst[i].i_oparg;
+        PyObject *constant = PyList_GET_ITEM(consts, arg);
+        Py_INCREF(constant);
+        PyTuple_SET_ITEM(newconst, i, constant);
+    }
+    if (merge_const_one(c, &newconst) == 0) {
+        Py_DECREF(newconst);
+        return -1;
+    }
+
+    Py_ssize_t index;
+    for (index = 0; index < PyList_GET_SIZE(consts); index++) {
+        if (PyList_GET_ITEM(consts, index) == newconst) {
+            break;
+        }
+    }
+    if (index == PyList_GET_SIZE(consts)) {
+        if ((size_t)index >= (size_t)INT_MAX - 1) {
+            Py_DECREF(newconst);
+            PyErr_SetString(PyExc_OverflowError, "too many constants");
+            return -1;
+        }
+        if (PyList_Append(consts, newconst)) {
+            Py_DECREF(newconst);
+            return -1;
+        }
+    }
+    Py_DECREF(newconst);
+    for (int i = 0; i < n; i++) {
+        inst[i].i_opcode = NOP;
+    }
+    inst[n].i_opcode = LOAD_CONST;
+    inst[n].i_oparg = (int)index;
+    return 0;
+}
+
+
+// Eliminate n * ROT_N(n).
+static void
+fold_rotations(struct instr *inst, int n)
+{
+    for (int i = 0; i < n; i++) {
+        int rot;
+        switch (inst[i].i_opcode) {
+            case ROT_N:
+                rot = inst[i].i_oparg;
+                break;
+            case ROT_FOUR:
+                rot = 4;
+                break;
+            case ROT_THREE:
+                rot = 3;
+                break;
+            case ROT_TWO:
+                rot = 2;
+                break;
+            default:
+                return;
+        }
+        if (rot != n) {
+            return;
+        }
+    }
+    for (int i = 0; i < n; i++) {
+        inst[i].i_opcode = NOP;
+    }
+}
+
+// Attempt to eliminate jumps to jumps by updating inst to jump to
+// target->i_target using the provided opcode. Return whether or not the
+// optimization was successful.
+static bool
+jump_thread(struct instr *inst, struct instr *target, int opcode)
+{
+    assert(is_jump(inst));
+    assert(is_jump(target));
+    // bpo-45773: If inst->i_target == target->i_target, then nothing actually
+    // changes (and we fall into an infinite loop):
+    if (inst->i_lineno == target->i_lineno &&
+        inst->i_target != target->i_target)
+    {
+        inst->i_target = target->i_target;
+        inst->i_opcode = opcode;
+        return true;
+    }
+    return false;
+}
+
+/* Maximum size of basic block that should be copied in optimizer */
+#define MAX_COPY_SIZE 4
+
+/* Optimization */
+static int
+optimize_basic_block(struct compiler *c, basicblock *bb, PyObject *consts)
+{
+    assert(PyList_CheckExact(consts));
+    struct instr nop;
+    nop.i_opcode = NOP;
+    struct instr *target;
+    for (int i = 0; i < bb->b_iused; i++) {
+        struct instr *inst = &bb->b_instr[i];
+        int oparg = inst->i_oparg;
+        int nextop = i+1 < bb->b_iused ? bb->b_instr[i+1].i_opcode : 0;
+        if (is_jump(inst)) {
+            /* Skip over empty basic blocks. */
+            while (inst->i_target->b_iused == 0) {
+                inst->i_target = inst->i_target->b_next;
+            }
+            target = &inst->i_target->b_instr[0];
+        }
+        else {
+            target = &nop;
+        }
+        switch (inst->i_opcode) {
+            /* Remove LOAD_CONST const; conditional jump */
+            case LOAD_CONST:
+            {
+                PyObject* cnt;
+                int is_true;
+                int jump_if_true;
+                switch(nextop) {
+                    case POP_JUMP_IF_FALSE:
+                    case POP_JUMP_IF_TRUE:
+                        cnt = PyList_GET_ITEM(consts, oparg);
+                        is_true = PyObject_IsTrue(cnt);
+                        if (is_true == -1) {
+                            goto error;
+                        }
+                        inst->i_opcode = NOP;
+                        jump_if_true = nextop == POP_JUMP_IF_TRUE;
+                        if (is_true == jump_if_true) {
+                            bb->b_instr[i+1].i_opcode = JUMP_ABSOLUTE;
+                            bb->b_nofallthrough = 1;
+                        }
+                        else {
+                            bb->b_instr[i+1].i_opcode = NOP;
+                        }
+                        break;
+                    case JUMP_IF_FALSE_OR_POP:
+                    case JUMP_IF_TRUE_OR_POP:
+                        cnt = PyList_GET_ITEM(consts, oparg);
+                        is_true = PyObject_IsTrue(cnt);
+                        if (is_true == -1) {
+                            goto error;
+                        }
+                        jump_if_true = nextop == JUMP_IF_TRUE_OR_POP;
+                        if (is_true == jump_if_true) {
+                            bb->b_instr[i+1].i_opcode = JUMP_ABSOLUTE;
+                            bb->b_nofallthrough = 1;
+                        }
+                        else {
+                            inst->i_opcode = NOP;
+                            bb->b_instr[i+1].i_opcode = NOP;
+                        }
+                        break;
+                }
+                break;
+            }
+
+                /* Try to fold tuples of constants.
+                   Skip over BUILD_SEQN 1 UNPACK_SEQN 1.
+                   Replace BUILD_SEQN 2 UNPACK_SEQN 2 with ROT2.
+                   Replace BUILD_SEQN 3 UNPACK_SEQN 3 with ROT3 ROT2. */
+            case BUILD_TUPLE:
+                if (nextop == UNPACK_SEQUENCE && oparg == bb->b_instr[i+1].i_oparg) {
+                    switch(oparg) {
+                        case 1:
+                            inst->i_opcode = NOP;
+                            bb->b_instr[i+1].i_opcode = NOP;
+                            break;
+                        case 2:
+                            inst->i_opcode = ROT_TWO;
+                            bb->b_instr[i+1].i_opcode = NOP;
+                            break;
+                        case 3:
+                            inst->i_opcode = ROT_THREE;
+                            bb->b_instr[i+1].i_opcode = ROT_TWO;
+                    }
+                    break;
+                }
+                if (i >= oparg) {
+                    if (fold_tuple_on_constants(c, inst-oparg, oparg, consts)) {
+                        goto error;
+                    }
+                }
+                break;
+
+                /* Simplify conditional jump to conditional jump where the
+                   result of the first test implies the success of a similar
+                   test or the failure of the opposite test.
+                   Arises in code like:
+                   "a and b or c"
+                   "(a and b) and c"
+                   "(a or b) or c"
+                   "(a or b) and c"
+                   x:JUMP_IF_FALSE_OR_POP y   y:JUMP_IF_FALSE_OR_POP z
+                      -->  x:JUMP_IF_FALSE_OR_POP z
+                   x:JUMP_IF_FALSE_OR_POP y   y:JUMP_IF_TRUE_OR_POP z
+                      -->  x:POP_JUMP_IF_FALSE y+1
+                   where y+1 is the instruction following the second test.
+                */
+            case JUMP_IF_FALSE_OR_POP:
+                switch (target->i_opcode) {
+                    case POP_JUMP_IF_FALSE:
+                        i -= jump_thread(inst, target, POP_JUMP_IF_FALSE);
+                        break;
+                    case JUMP_ABSOLUTE:
+                    case JUMP_FORWARD:
+                    case JUMP_IF_FALSE_OR_POP:
+                        i -= jump_thread(inst, target, JUMP_IF_FALSE_OR_POP);
+                        break;
+                    case JUMP_IF_TRUE_OR_POP:
+                    case POP_JUMP_IF_TRUE:
+                        if (inst->i_lineno == target->i_lineno) {
+                            // We don't need to bother checking for loops here,
+                            // since a block's b_next cannot point to itself:
+                            assert(inst->i_target != inst->i_target->b_next);
+                            inst->i_opcode = POP_JUMP_IF_FALSE;
+                            inst->i_target = inst->i_target->b_next;
+                            --i;
+                        }
+                        break;
+                }
+                break;
+            case JUMP_IF_TRUE_OR_POP:
+                switch (target->i_opcode) {
+                    case POP_JUMP_IF_TRUE:
+                        i -= jump_thread(inst, target, POP_JUMP_IF_TRUE);
+                        break;
+                    case JUMP_ABSOLUTE:
+                    case JUMP_FORWARD:
+                    case JUMP_IF_TRUE_OR_POP:
+                        i -= jump_thread(inst, target, JUMP_IF_TRUE_OR_POP);
+                        break;
+                    case JUMP_IF_FALSE_OR_POP:
+                    case POP_JUMP_IF_FALSE:
+                        if (inst->i_lineno == target->i_lineno) {
+                            // We don't need to bother checking for loops here,
+                            // since a block's b_next cannot point to itself:
+                            assert(inst->i_target != inst->i_target->b_next);
+                            inst->i_opcode = POP_JUMP_IF_TRUE;
+                            inst->i_target = inst->i_target->b_next;
+                            --i;
+                        }
+                        break;
+                }
+                break;
+            case POP_JUMP_IF_FALSE:
+                switch (target->i_opcode) {
+                    case JUMP_ABSOLUTE:
+                    case JUMP_FORWARD:
+                        i -= jump_thread(inst, target, POP_JUMP_IF_FALSE);
+                }
+                break;
+            case POP_JUMP_IF_TRUE:
+                switch (target->i_opcode) {
+                    case JUMP_ABSOLUTE:
+                    case JUMP_FORWARD:
+                        i -= jump_thread(inst, target, POP_JUMP_IF_TRUE);
+                }
+                break;
+            case JUMP_ABSOLUTE:
+            case JUMP_FORWARD:
+                switch (target->i_opcode) {
+                    case JUMP_ABSOLUTE:
+                    case JUMP_FORWARD:
+                        i -= jump_thread(inst, target, JUMP_ABSOLUTE);
+                }
+                break;
+            case FOR_ITER:
+                if (target->i_opcode == JUMP_FORWARD) {
+                    i -= jump_thread(inst, target, FOR_ITER);
+                }
+                break;
+            case ROT_N:
+                switch (oparg) {
+                    case 0:
+                    case 1:
+                        inst->i_opcode = NOP;
+                        continue;
+                    case 2:
+                        inst->i_opcode = ROT_TWO;
+                        break;
+                    case 3:
+                        inst->i_opcode = ROT_THREE;
+                        break;
+                    case 4:
+                        inst->i_opcode = ROT_FOUR;
+                        break;
+                }
+                if (i >= oparg - 1) {
+                    fold_rotations(inst - oparg + 1, oparg);
+                }
+                break;
+        }
+    }
+    return 0;
+error:
+    return -1;
+}
+
+/* If this block ends with an unconditional jump to an exit block,
+ * then remove the jump and extend this block with the target.
+ */
+static int
+extend_block(basicblock *bb) {
+    if (bb->b_iused == 0) {
+        return 0;
+    }
+    struct instr *last = &bb->b_instr[bb->b_iused-1];
+    if (last->i_opcode != JUMP_ABSOLUTE && last->i_opcode != JUMP_FORWARD) {
+        return 0;
+    }
+    if (last->i_target->b_exit && last->i_target->b_iused <= MAX_COPY_SIZE) {
+        basicblock *to_copy = last->i_target;
+        last->i_opcode = NOP;
+        for (int i = 0; i < to_copy->b_iused; i++) {
+            int index = compiler_next_instr(bb);
+            if (index < 0) {
+                return -1;
+            }
+            bb->b_instr[index] = to_copy->b_instr[i];
+        }
+        bb->b_exit = 1;
+    }
+    return 0;
+}
+
+static void
+clean_basic_block(basicblock *bb, int prev_lineno) {
+    /* Remove NOPs when legal to do so. */
+    int dest = 0;
+    for (int src = 0; src < bb->b_iused; src++) {
+        int lineno = bb->b_instr[src].i_lineno;
+        if (bb->b_instr[src].i_opcode == NOP) {
+            /* Eliminate no-op if it doesn't have a line number */
+            if (lineno < 0) {
+                continue;
+            }
+            /* or, if the previous instruction had the same line number. */
+            if (prev_lineno == lineno) {
+                continue;
+            }
+            /* or, if the next instruction has same line number or no line number */
+            if (src < bb->b_iused - 1) {
+                int next_lineno = bb->b_instr[src+1].i_lineno;
+                if (next_lineno < 0 || next_lineno == lineno) {
+                    bb->b_instr[src+1].i_lineno = lineno;
+                    continue;
+                }
+            }
+            else {
+                basicblock* next = bb->b_next;
+                while (next && next->b_iused == 0) {
+                    next = next->b_next;
+                }
+                /* or if last instruction in BB and next BB has same line number */
+                if (next) {
+                    if (lineno == next->b_instr[0].i_lineno) {
+                        continue;
+                    }
+                }
+            }
+
+        }
+        if (dest != src) {
+            bb->b_instr[dest] = bb->b_instr[src];
+        }
+        dest++;
+        prev_lineno = lineno;
+    }
+    assert(dest <= bb->b_iused);
+    bb->b_iused = dest;
+}
+
+static int
+normalize_basic_block(basicblock *bb) {
+    /* Mark blocks as exit and/or nofallthrough.
+     Raise SystemError if CFG is malformed. */
+    for (int i = 0; i < bb->b_iused; i++) {
+        switch(bb->b_instr[i].i_opcode) {
+            case RETURN_VALUE:
+            case RAISE_VARARGS:
+            case RERAISE:
+                bb->b_exit = 1;
+                bb->b_nofallthrough = 1;
+                break;
+            case JUMP_ABSOLUTE:
+            case JUMP_FORWARD:
+                bb->b_nofallthrough = 1;
+                /* fall through */
+            case POP_JUMP_IF_FALSE:
+            case POP_JUMP_IF_TRUE:
+            case JUMP_IF_FALSE_OR_POP:
+            case JUMP_IF_TRUE_OR_POP:
+            case FOR_ITER:
+                if (i != bb->b_iused-1) {
+                    PyErr_SetString(PyExc_SystemError, "malformed control flow graph.");
+                    return -1;
+                }
+                /* Skip over empty basic blocks. */
+                while (bb->b_instr[i].i_target->b_iused == 0) {
+                    bb->b_instr[i].i_target = bb->b_instr[i].i_target->b_next;
+                }
+
+        }
+    }
+    return 0;
+}
+
+static int
+mark_reachable(struct assembler *a) {
+    basicblock **stack, **sp;
+    sp = stack = (basicblock **)PyObject_Malloc(sizeof(basicblock *) * a->a_nblocks);
+    if (stack == NULL) {
+        return -1;
+    }
+    a->a_entry->b_predecessors = 1;
+    *sp++ = a->a_entry;
+    while (sp > stack) {
+        basicblock *b = *(--sp);
+        if (b->b_next && !b->b_nofallthrough) {
+            if (b->b_next->b_predecessors == 0) {
+                *sp++ = b->b_next;
+            }
+            b->b_next->b_predecessors++;
+        }
+        for (int i = 0; i < b->b_iused; i++) {
+            basicblock *target;
+            if (is_jump(&b->b_instr[i])) {
+                target = b->b_instr[i].i_target;
+                if (target->b_predecessors == 0) {
+                    *sp++ = target;
+                }
+                target->b_predecessors++;
+            }
+        }
+    }
+    PyObject_Free(stack);
+    return 0;
+}
+
+static void
+eliminate_empty_basic_blocks(basicblock *entry) {
+    /* Eliminate empty blocks */
+    for (basicblock *b = entry; b != NULL; b = b->b_next) {
+        basicblock *next = b->b_next;
+        if (next) {
+            while (next->b_iused == 0 && next->b_next) {
+                next = next->b_next;
+            }
+            b->b_next = next;
+        }
+    }
+    for (basicblock *b = entry; b != NULL; b = b->b_next) {
+        if (b->b_iused == 0) {
+            continue;
+        }
+        if (is_jump(&b->b_instr[b->b_iused-1])) {
+            basicblock *target = b->b_instr[b->b_iused-1].i_target;
+            while (target->b_iused == 0) {
+                target = target->b_next;
+            }
+            b->b_instr[b->b_iused-1].i_target = target;
+        }
+    }
+}
+
+
+/* If an instruction has no line number, but it's predecessor in the BB does,
+ * then copy the line number. If a successor block has no line number, and only
+ * one predecessor, then inherit the line number.
+ * This ensures that all exit blocks (with one predecessor) receive a line number.
+ * Also reduces the size of the line number table,
+ * but has no impact on the generated line number events.
+ */
+static void
+propagate_line_numbers(struct assembler *a) {
+    for (basicblock *b = a->a_entry; b != NULL; b = b->b_next) {
+        if (b->b_iused == 0) {
+            continue;
+        }
+        int prev_lineno = -1;
+        for (int i = 0; i < b->b_iused; i++) {
+            if (b->b_instr[i].i_lineno < 0) {
+                b->b_instr[i].i_lineno = prev_lineno;
+            }
+            else {
+                prev_lineno = b->b_instr[i].i_lineno;
+            }
+        }
+        if (!b->b_nofallthrough && b->b_next->b_predecessors == 1) {
+            assert(b->b_next->b_iused);
+            if (b->b_next->b_instr[0].i_lineno < 0) {
+                b->b_next->b_instr[0].i_lineno = prev_lineno;
+            }
+        }
+        if (is_jump(&b->b_instr[b->b_iused-1])) {
+            switch (b->b_instr[b->b_iused-1].i_opcode) {
+                /* Note: Only actual jumps, not exception handlers */
+                case SETUP_ASYNC_WITH:
+                case SETUP_WITH:
+                case SETUP_FINALLY:
+                    continue;
+            }
+            basicblock *target = b->b_instr[b->b_iused-1].i_target;
+            if (target->b_predecessors == 1) {
+                if (target->b_instr[0].i_lineno < 0) {
+                    target->b_instr[0].i_lineno = prev_lineno;
+                }
+            }
+        }
+    }
+}
+
+/* Perform optimizations on a control flow graph.
+   The consts object should still be in list form to allow new constants
+   to be appended.
+
+   All transformations keep the code size the same or smaller.
+   For those that reduce size, the gaps are initially filled with
+   NOPs.  Later those NOPs are removed.
+*/
+
+static int
+optimize_cfg(struct compiler *c, struct assembler *a, PyObject *consts)
+{
+    for (basicblock *b = a->a_entry; b != NULL; b = b->b_next) {
+        if (optimize_basic_block(c, b, consts)) {
+            return -1;
+        }
+        clean_basic_block(b, -1);
+        assert(b->b_predecessors == 0);
+    }
+    for (basicblock *b = c->u->u_blocks; b != NULL; b = b->b_list) {
+        if (extend_block(b)) {
+            return -1;
+        }
+    }
+    if (mark_reachable(a)) {
+        return -1;
+    }
+    /* Delete unreachable instructions */
+    for (basicblock *b = a->a_entry; b != NULL; b = b->b_next) {
+       if (b->b_predecessors == 0) {
+            b->b_iused = 0;
+            b->b_nofallthrough = 0;
+       }
+    }
+    basicblock *pred = NULL;
+    for (basicblock *b = a->a_entry; b != NULL; b = b->b_next) {
+        int prev_lineno = -1;
+        if (pred && pred->b_iused) {
+            prev_lineno = pred->b_instr[pred->b_iused-1].i_lineno;
+        }
+        clean_basic_block(b, prev_lineno);
+        pred = b->b_nofallthrough ? NULL : b;
+    }
+    eliminate_empty_basic_blocks(a->a_entry);
+    /* Delete jump instructions made redundant by previous step. If a non-empty
+       block ends with a jump instruction, check if the next non-empty block
+       reached through normal flow control is the target of that jump. If it
+       is, then the jump instruction is redundant and can be deleted.
+    */
+    int maybe_empty_blocks = 0;
+    for (basicblock *b = a->a_entry; b != NULL; b = b->b_next) {
+        if (b->b_iused > 0) {
+            struct instr *b_last_instr = &b->b_instr[b->b_iused - 1];
+            if (b_last_instr->i_opcode == JUMP_ABSOLUTE ||
+                b_last_instr->i_opcode == JUMP_FORWARD) {
+                if (b_last_instr->i_target == b->b_next) {
+                    assert(b->b_next->b_iused);
+                    b->b_nofallthrough = 0;
+                    b_last_instr->i_opcode = NOP;
+                    clean_basic_block(b, -1);
+                    maybe_empty_blocks = 1;
+                }
+            }
+        }
+    }
+    if (maybe_empty_blocks) {
+        eliminate_empty_basic_blocks(a->a_entry);
+    }
+    return 0;
+}
+
+// Remove trailing unused constants.
+static int
+trim_unused_consts(struct compiler *c, struct assembler *a, PyObject *consts)
+{
+    assert(PyList_CheckExact(consts));
+
+    // The first constant may be docstring; keep it always.
+    int max_const_index = 0;
+    for (basicblock *b = a->a_entry; b != NULL; b = b->b_next) {
+        for (int i = 0; i < b->b_iused; i++) {
+            if (b->b_instr[i].i_opcode == LOAD_CONST &&
+                    b->b_instr[i].i_oparg > max_const_index) {
+                max_const_index = b->b_instr[i].i_oparg;
+            }
+        }
+    }
+    if (max_const_index+1 < PyList_GET_SIZE(consts)) {
+        //fprintf(stderr, "removing trailing consts: max=%d, size=%d\n",
+        //        max_const_index, (int)PyList_GET_SIZE(consts));
+        if (PyList_SetSlice(consts, max_const_index+1,
+                            PyList_GET_SIZE(consts), NULL) < 0) {
+            return 1;
+        }
+    }
+    return 0;
+}
+
+static inline int
+is_exit_without_lineno(basicblock *b) {
+    return b->b_exit && b->b_instr[0].i_lineno < 0;
+}
+
+/* PEP 626 mandates that the f_lineno of a frame is correct
+ * after a frame terminates. It would be prohibitively expensive
+ * to continuously update the f_lineno field at runtime,
+ * so we make sure that all exiting instruction (raises and returns)
+ * have a valid line number, allowing us to compute f_lineno lazily.
+ * We can do this by duplicating the exit blocks without line number
+ * so that none have more than one predecessor. We can then safely
+ * copy the line number from the sole predecessor block.
+ */
+static int
+duplicate_exits_without_lineno(struct compiler *c)
+{
+    /* Copy all exit blocks without line number that are targets of a jump.
+     */
+    for (basicblock *b = c->u->u_blocks; b != NULL; b = b->b_list) {
+        if (b->b_iused > 0 && is_jump(&b->b_instr[b->b_iused-1])) {
+            switch (b->b_instr[b->b_iused-1].i_opcode) {
+                /* Note: Only actual jumps, not exception handlers */
+                case SETUP_ASYNC_WITH:
+                case SETUP_WITH:
+                case SETUP_FINALLY:
+                    continue;
+            }
+            basicblock *target = b->b_instr[b->b_iused-1].i_target;
+            if (is_exit_without_lineno(target) && target->b_predecessors > 1) {
+                basicblock *new_target = compiler_copy_block(c, target);
+                if (new_target == NULL) {
+                    return -1;
+                }
+                new_target->b_instr[0].i_lineno = b->b_instr[b->b_iused-1].i_lineno;
+                b->b_instr[b->b_iused-1].i_target = new_target;
+                target->b_predecessors--;
+                new_target->b_predecessors = 1;
+                new_target->b_next = target->b_next;
+                target->b_next = new_target;
+            }
+        }
+    }
+    /* Eliminate empty blocks */
+    for (basicblock *b = c->u->u_blocks; b != NULL; b = b->b_list) {
+        while (b->b_next && b->b_next->b_iused == 0) {
+            b->b_next = b->b_next->b_next;
+        }
+    }
+    /* Any remaining reachable exit blocks without line number can only be reached by
+     * fall through, and thus can only have a single predecessor */
+    for (basicblock *b = c->u->u_blocks; b != NULL; b = b->b_list) {
+        if (!b->b_nofallthrough && b->b_next && b->b_iused > 0) {
+            if (is_exit_without_lineno(b->b_next)) {
+                assert(b->b_next->b_iused > 0);
+                b->b_next->b_instr[0].i_lineno = b->b_instr[b->b_iused-1].i_lineno;
+            }
+        }
+    }
+    return 0;
+}
+
+
+/* Retained for API compatibility.
+ * Optimization is now done in optimize_cfg */
+
+PyObject *
+PyCode_Optimize(PyObject *code, PyObject* Py_UNUSED(consts),
+                PyObject *Py_UNUSED(names), PyObject *Py_UNUSED(lnotab_obj))
+{
+    Py_INCREF(code);
+    return code;
 }
diff --git a/Python/condvar.h b/Python/condvar.h
index 8cba19b..e5df7ff 100644
--- a/Python/condvar.h
+++ b/Python/condvar.h
@@ -99,7 +99,7 @@
    http://birrell.org/andrew/papers/ImplementingCVs.pdf
 
    Generic emulations of the pthread_cond_* API using
-   earlier Win32 functions can be found on the Web.
+   earlier Win32 functions can be found on the web.
    The following read can be give background information to these issues,
    but the implementations are all broken in some way.
    http://www.cse.wustl.edu/~schmidt/win32-cv-1.html
diff --git a/Python/context.c b/Python/context.c
index bacc701..bf2ba93 100644
--- a/Python/context.c
+++ b/Python/context.c
@@ -10,8 +10,6 @@
 
 
 #define CONTEXT_FREELIST_MAXLEN 255
-static PyContext *ctx_freelist = NULL;
-static int ctx_freelist_len = 0;
 
 
 #include "clinic/context.c.h"
@@ -68,6 +66,14 @@
 contextvar_del(PyContextVar *var);
 
 
+static struct _Py_context_state *
+get_context_state(void)
+{
+    PyInterpreterState *interp = _PyInterpreterState_GET();
+    return &interp->context;
+}
+
+
 PyObject *
 _PyContext_NewHamtForTests(void)
 {
@@ -334,11 +340,16 @@
 static inline PyContext *
 _context_alloc(void)
 {
+    struct _Py_context_state *state = get_context_state();
     PyContext *ctx;
-    if (ctx_freelist_len) {
-        ctx_freelist_len--;
-        ctx = ctx_freelist;
-        ctx_freelist = (PyContext *)ctx->ctx_weakreflist;
+#ifdef Py_DEBUG
+    // _context_alloc() must not be called after _PyContext_Fini()
+    assert(state->numfree != -1);
+#endif
+    if (state->numfree) {
+        state->numfree--;
+        ctx = state->freelist;
+        state->freelist = (PyContext *)ctx->ctx_weakreflist;
         ctx->ctx_weakreflist = NULL;
         _Py_NewReference((PyObject *)ctx);
     }
@@ -458,10 +469,15 @@
     }
     (void)context_tp_clear(self);
 
-    if (ctx_freelist_len < CONTEXT_FREELIST_MAXLEN) {
-        ctx_freelist_len++;
-        self->ctx_weakreflist = (PyObject *)ctx_freelist;
-        ctx_freelist = self;
+    struct _Py_context_state *state = get_context_state();
+#ifdef Py_DEBUG
+    // _context_alloc() must not be called after _PyContext_Fini()
+    assert(state->numfree != -1);
+#endif
+    if (state->numfree < CONTEXT_FREELIST_MAXLEN) {
+        state->numfree++;
+        self->ctx_weakreflist = (PyObject *)state->freelist;
+        state->freelist = self;
     }
     else {
         Py_TYPE(self)->tp_free(self);
@@ -687,7 +703,7 @@
 
 PyTypeObject PyContext_Type = {
     PyVarObject_HEAD_INIT(&PyType_Type, 0)
-    "Context",
+    "_contextvars.Context",
     sizeof(PyContext),
     .tp_methods = PyContext_methods,
     .tp_as_mapping = &PyContext_as_mapping,
@@ -1040,7 +1056,7 @@
 
 PyTypeObject PyContextVar_Type = {
     PyVarObject_HEAD_INIT(&PyType_Type, 0)
-    "ContextVar",
+    "_contextvars.ContextVar",
     sizeof(PyContextVar),
     .tp_methods = PyContextVar_methods,
     .tp_members = PyContextVar_members,
@@ -1181,7 +1197,7 @@
 
 PyTypeObject PyContextToken_Type = {
     PyVarObject_HEAD_INIT(&PyType_Type, 0)
-    "Token",
+    "_contextvars.Token",
     sizeof(PyContextToken),
     .tp_methods = PyContextTokenType_methods,
     .tp_getset = PyContextTokenType_getsetlist,
@@ -1271,11 +1287,12 @@
 
 
 void
-_PyContext_ClearFreeList(void)
+_PyContext_ClearFreeList(PyInterpreterState *interp)
 {
-    for (; ctx_freelist_len; ctx_freelist_len--) {
-        PyContext *ctx = ctx_freelist;
-        ctx_freelist = (PyContext *)ctx->ctx_weakreflist;
+    struct _Py_context_state *state = &interp->context;
+    for (; state->numfree; state->numfree--) {
+        PyContext *ctx = state->freelist;
+        state->freelist = (PyContext *)ctx->ctx_weakreflist;
         ctx->ctx_weakreflist = NULL;
         PyObject_GC_Del(ctx);
     }
@@ -1283,10 +1300,16 @@
 
 
 void
-_PyContext_Fini(void)
+_PyContext_Fini(PyInterpreterState *interp)
 {
-    Py_CLEAR(_token_missing);
-    _PyContext_ClearFreeList();
+    if (_Py_IsMainInterpreter(interp)) {
+        Py_CLEAR(_token_missing);
+    }
+    _PyContext_ClearFreeList(interp);
+#ifdef Py_DEBUG
+    struct _Py_context_state *state = &interp->context;
+    state->numfree = -1;
+#endif
     _PyHamt_Fini();
 }
 
diff --git a/Python/dynload_aix.c b/Python/dynload_aix.c
deleted file mode 100644
index 97f7698..0000000
--- a/Python/dynload_aix.c
+++ /dev/null
@@ -1,190 +0,0 @@
-
-/* Support for dynamic loading of extension modules */
-
-#include "Python.h"
-#include "importdl.h"
-
-#include <errno.h>      /*  for global errno      */
-#include <string.h>     /*  for strerror()        */
-#include <stdlib.h>     /*  for malloc(), free()  */
-#include <sys/ldr.h>
-
-
-#ifdef AIX_GENUINE_CPLUSPLUS
-#include <load.h>
-#define aix_load loadAndInit
-#else
-#define aix_load load
-#endif
-
-
-extern char *Py_GetProgramName(void);
-
-typedef struct Module {
-    struct Module *next;
-    void          *entry;
-} Module, *ModulePtr;
-
-const char *_PyImport_DynLoadFiletab[] = {".so", NULL};
-
-static int
-aix_getoldmodules(void **modlistptr)
-{
-    ModulePtr       modptr, prevmodptr;
-    struct ld_info  *ldiptr;
-    char            *ldibuf;
-    int             errflag, bufsize = 1024;
-    unsigned int    offset;
-    char *progname = Py_GetProgramName();
-
-    /*
-    -- Get the list of loaded modules into ld_info structures.
-    */
-    if ((ldibuf = malloc(bufsize)) == NULL) {
-        PyErr_SetString(PyExc_ImportError, strerror(errno));
-        return -1;
-    }
-    while ((errflag = loadquery(L_GETINFO, ldibuf, bufsize)) == -1
-           && errno == ENOMEM) {
-        free(ldibuf);
-        bufsize += 1024;
-        if ((ldibuf = malloc(bufsize)) == NULL) {
-            PyErr_SetString(PyExc_ImportError, strerror(errno));
-            return -1;
-        }
-    }
-    if (errflag == -1) {
-        PyErr_SetString(PyExc_ImportError, strerror(errno));
-        return -1;
-    }
-    /*
-    -- Make the modules list from the ld_info structures.
-    */
-    ldiptr = (struct ld_info *)ldibuf;
-    prevmodptr = NULL;
-    do {
-        if (strstr(progname, ldiptr->ldinfo_filename) == NULL &&
-            strstr(ldiptr->ldinfo_filename, "python") == NULL) {
-            /*
-            -- Extract only the modules belonging to the main
-            -- executable + those containing "python" as a
-            -- substring (like the "python[version]" binary or
-            -- "libpython[version].a" in case it's a shared lib).
-            */
-            offset = (unsigned int)ldiptr->ldinfo_next;
-            ldiptr = (struct ld_info *)((char*)ldiptr + offset);
-            continue;
-        }
-        if ((modptr = (ModulePtr)malloc(sizeof(Module))) == NULL) {
-            PyErr_SetString(PyExc_ImportError, strerror(errno));
-            while (*modlistptr) {
-                modptr = (ModulePtr)*modlistptr;
-                *modlistptr = (void *)modptr->next;
-                free(modptr);
-            }
-            return -1;
-        }
-        modptr->entry = ldiptr->ldinfo_dataorg;
-        modptr->next  = NULL;
-        if (prevmodptr == NULL)
-            *modlistptr = (void *)modptr;
-        else
-            prevmodptr->next = modptr;
-        prevmodptr = modptr;
-        offset = (unsigned int)ldiptr->ldinfo_next;
-        ldiptr = (struct ld_info *)((char*)ldiptr + offset);
-    } while (offset);
-    free(ldibuf);
-    return 0;
-}
-
-
-static void
-aix_loaderror(const char *pathname)
-{
-
-    char *message[1024], errbuf[1024];
-    PyObject *pathname_ob = NULL;
-    PyObject *errbuf_ob = NULL;
-    int i,j;
-
-    struct errtab {
-        int errNo;
-        char *errstr;
-    } load_errtab[] = {
-        {L_ERROR_TOOMANY,               "too many errors, rest skipped."},
-        {L_ERROR_NOLIB,                 "can't load library:"},
-        {L_ERROR_UNDEF,                 "can't find symbol in library:"},
-        {L_ERROR_RLDBAD,
-         "RLD index out of range or bad relocation type:"},
-        {L_ERROR_FORMAT,                "not a valid, executable xcoff file:"},
-        {L_ERROR_MEMBER,
-         "file not an archive or does not contain requested member:"},
-        {L_ERROR_TYPE,                  "symbol table mismatch:"},
-        {L_ERROR_ALIGN,                 "text alignment in file is wrong."},
-        {L_ERROR_SYSTEM,                "System error:"},
-        {L_ERROR_ERRNO,                 NULL}
-    };
-
-#define ERRBUF_APPEND(s) strncat(errbuf, s, sizeof(errbuf)-strlen(errbuf)-1)
-
-    PyOS_snprintf(errbuf, sizeof(errbuf), "from module %.200s ", pathname);
-
-    if (!loadquery(L_GETMESSAGES, &message[0], sizeof(message))) {
-        ERRBUF_APPEND(strerror(errno));
-        ERRBUF_APPEND("\n");
-    }
-    for(i = 0; message[i] && *message[i]; i++) {
-        int nerr = atoi(message[i]);
-        for (j=0; j < Py_ARRAY_LENGTH(load_errtab); j++) {
-            if (nerr == load_errtab[j].errNo && load_errtab[j].errstr)
-            ERRBUF_APPEND(load_errtab[j].errstr);
-        }
-        while (Py_ISDIGIT(*message[i])) message[i]++ ;
-        ERRBUF_APPEND(message[i]);
-        ERRBUF_APPEND("\n");
-    }
-    /* Subtract 1 from the length to trim off trailing newline */
-    errbuf_ob = PyUnicode_DecodeLocaleAndSize(errbuf, strlen(errbuf)-1, "surrogateescape");
-    if (errbuf_ob == NULL)
-        return;
-    pathname_ob = PyUnicode_DecodeFSDefault(pathname);
-    if (pathname_ob == NULL) {
-        Py_DECREF(errbuf_ob);
-        return;
-    }
-    PyErr_SetImportError(errbuf_ob, NULL, pathname_ob);
-    Py_DECREF(pathname_ob);
-    Py_DECREF(errbuf_ob);
-    return;
-}
-
-
-dl_funcptr _PyImport_FindSharedFuncptr(const char *prefix,
-                                       const char *shortname,
-                                       const char *pathname, FILE *fp)
-{
-    dl_funcptr p;
-
-    /*
-    -- Invoke load() with L_NOAUTODEFER leaving the imported symbols
-    -- of the shared module unresolved. Thus we have to resolve them
-    -- explicitly with loadbind. The new module is loaded, then we
-    -- resolve its symbols using the list of already loaded modules
-    -- (only those that belong to the python executable). Get these
-    -- with loadquery(L_GETINFO).
-    */
-
-    static void *staticmodlistptr = NULL;
-
-    if (!staticmodlistptr)
-        if (aix_getoldmodules(&staticmodlistptr) == -1)
-            return NULL;
-    p = (dl_funcptr) aix_load((char *)pathname, L_NOAUTODEFER, 0);
-    if (p == NULL) {
-        aix_loaderror(pathname);
-        return NULL;
-    }
-
-    return p;
-}
diff --git a/Python/dynload_dl.c b/Python/dynload_dl.c
deleted file mode 100644
index 2bec645..0000000
--- a/Python/dynload_dl.c
+++ /dev/null
@@ -1,23 +0,0 @@
-
-/* Support for dynamic loading of extension modules */
-
-#include "dl.h"
-
-#include "Python.h"
-#include "importdl.h"
-
-
-extern char *Py_GetProgramName(void);
-
-const char *_PyImport_DynLoadFiletab[] = {".o", NULL};
-
-
-dl_funcptr _PyImport_FindSharedFuncptr(const char *prefix,
-                                       const char *shortname,
-                                       const char *pathname, FILE *fp)
-{
-    char funcname[258];
-
-    PyOS_snprintf(funcname, sizeof(funcname), "%.20s_%.200s", prefix, shortname);
-    return dl_loadmod(Py_GetProgramName(), pathname, funcname);
-}
diff --git a/Python/dynload_hpux.c b/Python/dynload_hpux.c
index e36d608..a533730 100644
--- a/Python/dynload_hpux.c
+++ b/Python/dynload_hpux.c
@@ -13,7 +13,7 @@
 #define FUNCNAME_PATTERN "%.20s_%.200s"
 #endif
 
-const char *_PyImport_DynLoadFiletab[] = {SHLIB_EXT, NULL};
+const char *_PyImport_DynLoadFiletab[] = {SHLIB_EXT, ".sl", NULL};
 
 dl_funcptr _PyImport_FindSharedFuncptr(const char *prefix,
                                        const char *shortname,
diff --git a/Python/dynload_win.c b/Python/dynload_win.c
index 8431c5b..5702ab2 100644
--- a/Python/dynload_win.c
+++ b/Python/dynload_win.c
@@ -166,11 +166,14 @@
 {
     dl_funcptr p;
     char funcname[258], *import_python;
-    const wchar_t *wpathname;
 
     _Py_CheckPython3();
 
-    wpathname = _PyUnicode_AsUnicode(pathname);
+#if USE_UNICODE_WCHAR_CACHE
+    const wchar_t *wpathname = _PyUnicode_AsUnicode(pathname);
+#else /* USE_UNICODE_WCHAR_CACHE */
+    wchar_t *wpathname = PyUnicode_AsWideCharString(pathname, NULL);
+#endif /* USE_UNICODE_WCHAR_CACHE */
     if (wpathname == NULL)
         return NULL;
 
@@ -192,6 +195,9 @@
                               LOAD_LIBRARY_SEARCH_DEFAULT_DIRS |
                               LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR);
         Py_END_ALLOW_THREADS
+#if !USE_UNICODE_WCHAR_CACHE
+        PyMem_Free(wpathname);
+#endif /* USE_UNICODE_WCHAR_CACHE */
 
         /* restore old error mode settings */
         SetErrorMode(old_mode);
diff --git a/Python/errors.c b/Python/errors.c
index 87af39d..bc1b55e 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -3,6 +3,7 @@
 
 #include "Python.h"
 #include "pycore_initconfig.h"
+#include "pycore_object.h"        // _PyType_GetQualName
 #include "pycore_pyerrors.h"
 #include "pycore_pystate.h"    // _PyThreadState_GET()
 #include "pycore_sysmodule.h"
@@ -85,17 +86,29 @@
 }
 
 static PyObject*
-_PyErr_CreateException(PyObject *exception, PyObject *value)
+_PyErr_CreateException(PyObject *exception_type, PyObject *value)
 {
+    PyObject *exc;
+
     if (value == NULL || value == Py_None) {
-        return _PyObject_CallNoArg(exception);
+        exc = _PyObject_CallNoArg(exception_type);
     }
     else if (PyTuple_Check(value)) {
-        return PyObject_Call(exception, value, NULL);
+        exc = PyObject_Call(exception_type, value, NULL);
     }
     else {
-        return PyObject_CallOneArg(exception, value);
+        exc = PyObject_CallOneArg(exception_type, value);
     }
+
+    if (exc != NULL && !PyExceptionInstance_Check(exc)) {
+        PyErr_Format(PyExc_TypeError,
+                     "calling %R should have returned an instance of "
+                     "BaseException, not %s",
+                     exception_type, Py_TYPE(exc)->tp_name);
+        Py_CLEAR(exc);
+    }
+
+    return exc;
 }
 
 void
@@ -136,12 +149,16 @@
             value = fixed_value;
         }
 
-        /* Avoid reference cycles through the context chain.
+        /* Avoid creating new reference cycles through the
+           context chain, while taking care not to hang on
+           pre-existing ones.
            This is O(chain length) but context chains are
            usually very short. Sensitive readers may try
            to inline the call to PyException_GetContext. */
         if (exc_value != value) {
             PyObject *o = exc_value, *context;
+            PyObject *slow_o = o;  /* Floyd's cycle detection algo */
+            int slow_update_toggle = 0;
             while ((context = PyException_GetContext(o))) {
                 Py_DECREF(context);
                 if (context == value) {
@@ -149,6 +166,16 @@
                     break;
                 }
                 o = context;
+                if (o == slow_o) {
+                    /* pre-existing cycle - all exceptions on the
+                       path were visited and checked.  */
+                    break;
+                }
+                if (slow_update_toggle) {
+                    slow_o = PyException_GetContext(slow_o);
+                    Py_DECREF(slow_o);
+                }
+                slow_update_toggle = !slow_update_toggle;
             }
             PyException_SetContext(value, exc_value);
         }
@@ -290,12 +317,14 @@
                           PyObject **val, PyObject **tb)
 {
     int recursion_depth = 0;
+    tstate->recursion_headroom++;
     PyObject *type, *value, *initial_tb;
 
   restart:
     type = *exc;
     if (type == NULL) {
         /* There was no exception, so nothing to do. */
+        tstate->recursion_headroom--;
         return;
     }
 
@@ -347,6 +376,7 @@
     }
     *exc = type;
     *val = value;
+    tstate->recursion_headroom--;
     return;
 
   error:
@@ -1079,7 +1109,6 @@
 {
     PyThreadState *tstate = _PyThreadState_GET();
     PyObject *modulename = NULL;
-    PyObject *classname = NULL;
     PyObject *mydict = NULL;
     PyObject *bases = NULL;
     PyObject *result = NULL;
@@ -1099,10 +1128,11 @@
             goto failure;
     }
 
-    if (_PyDict_GetItemIdWithError(dict, &PyId___module__) == NULL) {
-        if (_PyErr_Occurred(tstate)) {
-            goto failure;
-        }
+    int r = _PyDict_ContainsId(dict, &PyId___module__);
+    if (r < 0) {
+        goto failure;
+    }
+    if (r == 0) {
         modulename = PyUnicode_FromStringAndSize(name,
                                              (Py_ssize_t)(dot-name));
         if (modulename == NULL)
@@ -1125,7 +1155,6 @@
   failure:
     Py_XDECREF(bases);
     Py_XDECREF(mydict);
-    Py_XDECREF(classname);
     Py_XDECREF(modulename);
     return result;
 }
@@ -1190,7 +1219,7 @@
 
 
 PyStatus
-_PyErr_Init(void)
+_PyErr_InitTypes(void)
 {
     if (UnraisableHookArgsType.tp_name == NULL) {
         if (PyStructSequence_InitType2(&UnraisableHookArgsType,
@@ -1295,46 +1324,45 @@
     }
 
     assert(PyExceptionClass_Check(exc_type));
-    const char *className = PyExceptionClass_Name(exc_type);
-    if (className != NULL) {
-        const char *dot = strrchr(className, '.');
-        if (dot != NULL) {
-            className = dot+1;
-        }
-    }
 
-    PyObject *moduleName = _PyObject_GetAttrId(exc_type, &PyId___module__);
-    if (moduleName == NULL || !PyUnicode_Check(moduleName)) {
-        Py_XDECREF(moduleName);
+    PyObject *modulename = _PyObject_GetAttrId(exc_type, &PyId___module__);
+    if (modulename == NULL || !PyUnicode_Check(modulename)) {
+        Py_XDECREF(modulename);
         _PyErr_Clear(tstate);
         if (PyFile_WriteString("<unknown>", file) < 0) {
             return -1;
         }
     }
     else {
-        if (!_PyUnicode_EqualToASCIIId(moduleName, &PyId_builtins)) {
-            if (PyFile_WriteObject(moduleName, file, Py_PRINT_RAW) < 0) {
-                Py_DECREF(moduleName);
+        if (!_PyUnicode_EqualToASCIIId(modulename, &PyId_builtins)) {
+            if (PyFile_WriteObject(modulename, file, Py_PRINT_RAW) < 0) {
+                Py_DECREF(modulename);
                 return -1;
             }
-            Py_DECREF(moduleName);
+            Py_DECREF(modulename);
             if (PyFile_WriteString(".", file) < 0) {
                 return -1;
             }
         }
         else {
-            Py_DECREF(moduleName);
+            Py_DECREF(modulename);
         }
     }
-    if (className == NULL) {
+
+    PyObject *qualname = _PyType_GetQualName((PyTypeObject *)exc_type);
+    if (qualname == NULL || !PyUnicode_Check(qualname)) {
+        Py_XDECREF(qualname);
+        _PyErr_Clear(tstate);
         if (PyFile_WriteString("<unknown>", file) < 0) {
             return -1;
         }
     }
     else {
-        if (PyFile_WriteString(className, file) < 0) {
+        if (PyFile_WriteObject(qualname, file, Py_PRINT_RAW) < 0) {
+            Py_DECREF(qualname);
             return -1;
         }
+        Py_DECREF(qualname);
     }
 
     if (exc_value && exc_value != Py_None) {
@@ -1532,9 +1560,6 @@
 }
 
 
-extern PyObject *PyModule_GetWarningsModule(void);
-
-
 void
 PyErr_SyntaxLocation(const char *filename, int lineno)
 {
@@ -1546,14 +1571,17 @@
    If the exception is not a SyntaxError, also sets additional attributes
    to make printing of exceptions believe it is a syntax error. */
 
-void
-PyErr_SyntaxLocationObject(PyObject *filename, int lineno, int col_offset)
+static void
+PyErr_SyntaxLocationObjectEx(PyObject *filename, int lineno, int col_offset,
+                             int end_lineno, int end_col_offset)
 {
     PyObject *exc, *v, *tb, *tmp;
     _Py_IDENTIFIER(filename);
     _Py_IDENTIFIER(lineno);
+    _Py_IDENTIFIER(end_lineno);
     _Py_IDENTIFIER(msg);
     _Py_IDENTIFIER(offset);
+    _Py_IDENTIFIER(end_offset);
     _Py_IDENTIFIER(print_file_and_line);
     _Py_IDENTIFIER(text);
     PyThreadState *tstate = _PyThreadState_GET();
@@ -1583,6 +1611,32 @@
         _PyErr_Clear(tstate);
     }
     Py_XDECREF(tmp);
+
+    tmp = NULL;
+    if (end_lineno >= 0) {
+        tmp = PyLong_FromLong(end_lineno);
+        if (tmp == NULL) {
+            _PyErr_Clear(tstate);
+        }
+    }
+    if (_PyObject_SetAttrId(v, &PyId_end_lineno, tmp ? tmp : Py_None)) {
+        _PyErr_Clear(tstate);
+    }
+    Py_XDECREF(tmp);
+
+    tmp = NULL;
+    if (end_col_offset >= 0) {
+        tmp = PyLong_FromLong(end_col_offset);
+        if (tmp == NULL) {
+            _PyErr_Clear(tstate);
+        }
+    }
+    if (_PyObject_SetAttrId(v, &PyId_end_offset, tmp ? tmp : Py_None)) {
+        _PyErr_Clear(tstate);
+    }
+    Py_XDECREF(tmp);
+
+    tmp = NULL;
     if (filename != NULL) {
         if (_PyObject_SetAttrId(v, &PyId_filename, filename)) {
             _PyErr_Clear(tstate);
@@ -1595,9 +1649,18 @@
             }
             Py_DECREF(tmp);
         }
+        else {
+            _PyErr_Clear(tstate);
+        }
     }
     if (exc != PyExc_SyntaxError) {
-        if (!_PyObject_HasAttrId(v, &PyId_msg)) {
+        if (_PyObject_LookupAttrId(v, &PyId_msg, &tmp) < 0) {
+            _PyErr_Clear(tstate);
+        }
+        else if (tmp) {
+            Py_DECREF(tmp);
+        }
+        else {
             tmp = PyObject_Str(v);
             if (tmp) {
                 if (_PyObject_SetAttrId(v, &PyId_msg, tmp)) {
@@ -1609,7 +1672,13 @@
                 _PyErr_Clear(tstate);
             }
         }
-        if (!_PyObject_HasAttrId(v, &PyId_print_file_and_line)) {
+        if (_PyObject_LookupAttrId(v, &PyId_print_file_and_line, &tmp) < 0) {
+            _PyErr_Clear(tstate);
+        }
+        else if (tmp) {
+            Py_DECREF(tmp);
+        }
+        else {
             if (_PyObject_SetAttrId(v, &PyId_print_file_and_line,
                                     Py_None)) {
                 _PyErr_Clear(tstate);
@@ -1620,6 +1689,17 @@
 }
 
 void
+PyErr_SyntaxLocationObject(PyObject *filename, int lineno, int col_offset) {
+    PyErr_SyntaxLocationObjectEx(filename, lineno, col_offset, lineno, -1);
+}
+
+void
+PyErr_RangedSyntaxLocationObject(PyObject *filename, int lineno, int col_offset,
+                                 int end_lineno, int end_col_offset) {
+    PyErr_SyntaxLocationObjectEx(filename, lineno, col_offset, end_lineno, end_col_offset);
+}
+
+void
 PyErr_SyntaxLocationEx(const char *filename, int lineno, int col_offset)
 {
     PyThreadState *tstate = _PyThreadState_GET();
@@ -1644,7 +1724,7 @@
    functionality in tb_displayline() in traceback.c. */
 
 static PyObject *
-err_programtext(PyThreadState *tstate, FILE *fp, int lineno)
+err_programtext(PyThreadState *tstate, FILE *fp, int lineno, const char* encoding)
 {
     int i;
     char linebuf[1000];
@@ -1672,7 +1752,11 @@
     fclose(fp);
     if (i == lineno) {
         PyObject *res;
-        res = PyUnicode_FromString(linebuf);
+        if (encoding != NULL) {
+            res = PyUnicode_Decode(linebuf, strlen(linebuf), encoding, "replace");
+        } else {
+            res = PyUnicode_FromString(linebuf);
+        }
         if (res == NULL)
             _PyErr_Clear(tstate);
         return res;
@@ -1683,17 +1767,22 @@
 PyObject *
 PyErr_ProgramText(const char *filename, int lineno)
 {
-    FILE *fp;
-    if (filename == NULL || *filename == '\0' || lineno <= 0) {
+    if (filename == NULL) {
         return NULL;
     }
-    PyThreadState *tstate = _PyThreadState_GET();
-    fp = _Py_fopen(filename, "r" PY_STDIOTEXTMODE);
-    return err_programtext(tstate, fp, lineno);
+
+    PyObject *filename_obj = PyUnicode_DecodeFSDefault(filename);
+    if (filename_obj == NULL) {
+        PyErr_Clear();
+        return NULL;
+    }
+    PyObject *res = PyErr_ProgramTextObject(filename_obj, lineno);
+    Py_DECREF(filename_obj);
+    return res;
 }
 
 PyObject *
-PyErr_ProgramTextObject(PyObject *filename, int lineno)
+_PyErr_ProgramDecodedTextObject(PyObject *filename, int lineno, const char* encoding)
 {
     if (filename == NULL || lineno <= 0) {
         return NULL;
@@ -1705,7 +1794,13 @@
         _PyErr_Clear(tstate);
         return NULL;
     }
-    return err_programtext(tstate, fp, lineno);
+    return err_programtext(tstate, fp, lineno, encoding);
+}
+
+PyObject *
+PyErr_ProgramTextObject(PyObject *filename, int lineno)
+{
+    return _PyErr_ProgramDecodedTextObject(filename, lineno, NULL);
 }
 
 #ifdef __cplusplus
diff --git a/Python/fileutils.c b/Python/fileutils.c
index 397ac34..c3144ee 100644
--- a/Python/fileutils.c
+++ b/Python/fileutils.c
@@ -1,5 +1,6 @@
 #include "Python.h"
-#include "pycore_fileutils.h"
+#include "pycore_fileutils.h"     // fileutils definitions
+#include "pycore_runtime.h"       // _PyRuntime
 #include "osdefs.h"               // SEP
 #include <locale.h>
 
@@ -17,6 +18,10 @@
 #include <sys/ioctl.h>
 #endif
 
+#ifdef HAVE_NON_UNICODE_WCHAR_T_REPRESENTATION
+#include <iconv.h>
+#endif
+
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
 #endif /* HAVE_FCNTL_H */
@@ -33,6 +38,13 @@
 int _Py_open_cloexec_works = -1;
 #endif
 
+// The value must be the same in unicodeobject.c.
+#define MAX_UNICODE 0x10ffff
+
+// mbstowcs() and mbrtowc() errors
+static const size_t DECODE_ERROR = ((size_t)-1);
+static const size_t INCOMPLETE_CHARACTER = (size_t)-2;
+
 
 static int
 get_surrogateescape(_Py_error_handler errors, int *surrogateescape)
@@ -54,17 +66,17 @@
 PyObject *
 _Py_device_encoding(int fd)
 {
-#if defined(MS_WINDOWS)
-    UINT cp;
-#endif
     int valid;
+    Py_BEGIN_ALLOW_THREADS
     _Py_BEGIN_SUPPRESS_IPH
     valid = isatty(fd);
     _Py_END_SUPPRESS_IPH
+    Py_END_ALLOW_THREADS
     if (!valid)
         Py_RETURN_NONE;
 
 #if defined(MS_WINDOWS)
+    UINT cp;
     if (fd == 0)
         cp = GetConsoleCP();
     else if (fd == 1 || fd == 2)
@@ -73,18 +85,73 @@
         cp = 0;
     /* GetConsoleCP() and GetConsoleOutputCP() return 0 if the application
        has no console */
-    if (cp != 0)
-        return PyUnicode_FromFormat("cp%u", (unsigned int)cp);
-#elif defined(CODESET)
-    {
-        char *codeset = nl_langinfo(CODESET);
-        if (codeset != NULL && codeset[0] != 0)
-            return PyUnicode_FromString(codeset);
+    if (cp == 0) {
+        Py_RETURN_NONE;
     }
+
+    return PyUnicode_FromFormat("cp%u", (unsigned int)cp);
+#else
+    return _Py_GetLocaleEncodingObject();
 #endif
-    Py_RETURN_NONE;
 }
 
+
+static size_t
+is_valid_wide_char(wchar_t ch)
+{
+#ifdef HAVE_NON_UNICODE_WCHAR_T_REPRESENTATION
+    /* Oracle Solaris doesn't use Unicode code points as wchar_t encoding
+       for non-Unicode locales, which makes values higher than MAX_UNICODE
+       possibly valid. */
+    return 1;
+#endif
+    if (Py_UNICODE_IS_SURROGATE(ch)) {
+        // Reject lone surrogate characters
+        return 0;
+    }
+    if (ch > MAX_UNICODE) {
+        // bpo-35883: Reject characters outside [U+0000; U+10ffff] range.
+        // The glibc mbstowcs() UTF-8 decoder does not respect the RFC 3629,
+        // it creates characters outside the [U+0000; U+10ffff] range:
+        // https://sourceware.org/bugzilla/show_bug.cgi?id=2373
+        return 0;
+    }
+    return 1;
+}
+
+
+static size_t
+_Py_mbstowcs(wchar_t *dest, const char *src, size_t n)
+{
+    size_t count = mbstowcs(dest, src, n);
+    if (dest != NULL && count != DECODE_ERROR) {
+        for (size_t i=0; i < count; i++) {
+            wchar_t ch = dest[i];
+            if (!is_valid_wide_char(ch)) {
+                return DECODE_ERROR;
+            }
+        }
+    }
+    return count;
+}
+
+
+#ifdef HAVE_MBRTOWC
+static size_t
+_Py_mbrtowc(wchar_t *pwc, const char *str, size_t len, mbstate_t *pmbs)
+{
+    assert(pwc != NULL);
+    size_t count = mbrtowc(pwc, str, len, pmbs);
+    if (count != 0 && count != DECODE_ERROR && count != INCOMPLETE_CHARACTER) {
+        if (!is_valid_wide_char(*pwc)) {
+            return DECODE_ERROR;
+        }
+    }
+    return count;
+}
+#endif
+
+
 #if !defined(_Py_FORCE_UTF8_FS_ENCODING) && !defined(MS_WINDOWS)
 
 #define USE_FORCE_ASCII
@@ -151,9 +218,9 @@
         size_t res;
 
         ch = (unsigned char)0xA7;
-        res = mbstowcs(&wch, (char*)&ch, 1);
-        if (res != (size_t)-1 && wch == L'\xA7') {
-            /* On HP-UX withe C locale or the POSIX locale,
+        res = _Py_mbstowcs(&wch, (char*)&ch, 1);
+        if (res != DECODE_ERROR && wch == L'\xA7') {
+            /* On HP-UX with C locale or the POSIX locale,
                nl_langinfo(CODESET) announces "roman8", whereas mbstowcs() uses
                Latin1 encoding in practice. Force ASCII in this case.
 
@@ -199,8 +266,8 @@
 
         unsigned uch = (unsigned char)i;
         ch[0] = (char)uch;
-        res = mbstowcs(wch, ch, 1);
-        if (res != (size_t)-1) {
+        res = _Py_mbstowcs(wch, ch, 1);
+        if (res != DECODE_ERROR) {
             /* decoding a non-ASCII character from the locale encoding succeed:
                the locale encoding is not ASCII, force ASCII */
             return 1;
@@ -390,9 +457,9 @@
      */
     argsize = strlen(arg);
 #else
-    argsize = mbstowcs(NULL, arg, 0);
+    argsize = _Py_mbstowcs(NULL, arg, 0);
 #endif
-    if (argsize != (size_t)-1) {
+    if (argsize != DECODE_ERROR) {
         if (argsize > PY_SSIZE_T_MAX / sizeof(wchar_t) - 1) {
             return -1;
         }
@@ -401,21 +468,13 @@
             return -1;
         }
 
-        count = mbstowcs(res, arg, argsize + 1);
-        if (count != (size_t)-1) {
-            wchar_t *tmp;
-            /* Only use the result if it contains no
-               surrogate characters. */
-            for (tmp = res; *tmp != 0 &&
-                         !Py_UNICODE_IS_SURROGATE(*tmp); tmp++)
-                ;
-            if (*tmp == 0) {
-                if (wlen != NULL) {
-                    *wlen = count;
-                }
-                *wstr = res;
-                return 0;
+        count = _Py_mbstowcs(res, arg, argsize + 1);
+        if (count != DECODE_ERROR) {
+            *wstr = res;
+            if (wlen != NULL) {
+                *wlen = count;
             }
+            return 0;
         }
         PyMem_RawFree(res);
     }
@@ -439,13 +498,13 @@
     out = res;
     memset(&mbs, 0, sizeof mbs);
     while (argsize) {
-        size_t converted = mbrtowc(out, (char*)in, argsize, &mbs);
+        size_t converted = _Py_mbrtowc(out, (char*)in, argsize, &mbs);
         if (converted == 0) {
             /* Reached end of string; null char stored. */
             break;
         }
 
-        if (converted == (size_t)-2) {
+        if (converted == INCOMPLETE_CHARACTER) {
             /* Incomplete character. This should never happen,
                since we provide everything that we have -
                unless there is a bug in the C library, or I
@@ -453,32 +512,22 @@
             goto decode_error;
         }
 
-        if (converted == (size_t)-1) {
+        if (converted == DECODE_ERROR) {
             if (!surrogateescape) {
                 goto decode_error;
             }
 
-            /* Conversion error. Escape as UTF-8b, and start over
-               in the initial shift state. */
+            /* Decoding error. Escape as UTF-8b, and start over in the initial
+               shift state. */
             *out++ = 0xdc00 + *in++;
             argsize--;
             memset(&mbs, 0, sizeof mbs);
             continue;
         }
 
-        if (Py_UNICODE_IS_SURROGATE(*out)) {
-            if (!surrogateescape) {
-                goto decode_error;
-            }
+        // _Py_mbrtowc() reject lone surrogate characters
+        assert(!Py_UNICODE_IS_SURROGATE(*out));
 
-            /* Surrogate character.  Escape the original
-               byte sequence with surrogateescape. */
-            argsize -= converted;
-            while (converted--) {
-                *out++ = 0xdc00 + *in++;
-            }
-            continue;
-        }
         /* successfully converted some bytes */
         in += converted;
         argsize -= converted;
@@ -655,7 +704,7 @@
                 else {
                     converted = wcstombs(NULL, buf, 0);
                 }
-                if (converted == (size_t)-1) {
+                if (converted == DECODE_ERROR) {
                     goto encode_error;
                 }
                 if (bytes != NULL) {
@@ -820,6 +869,168 @@
 }
 
 
+// Get the current locale encoding name:
+//
+// - Return "UTF-8" if _Py_FORCE_UTF8_LOCALE macro is defined (ex: on Android)
+// - Return "UTF-8" if the UTF-8 Mode is enabled
+// - On Windows, return the ANSI code page (ex: "cp1250")
+// - Return "UTF-8" if nl_langinfo(CODESET) returns an empty string.
+// - Otherwise, return nl_langinfo(CODESET).
+//
+// Return NULL on memory allocation failure.
+//
+// See also config_get_locale_encoding()
+wchar_t*
+_Py_GetLocaleEncoding(void)
+{
+#ifdef _Py_FORCE_UTF8_LOCALE
+    // On Android langinfo.h and CODESET are missing,
+    // and UTF-8 is always used in mbstowcs() and wcstombs().
+    return _PyMem_RawWcsdup(L"UTF-8");
+#else
+    const PyPreConfig *preconfig = &_PyRuntime.preconfig;
+    if (preconfig->utf8_mode) {
+        return _PyMem_RawWcsdup(L"UTF-8");
+    }
+
+#ifdef MS_WINDOWS
+    wchar_t encoding[23];
+    unsigned int ansi_codepage = GetACP();
+    swprintf(encoding, Py_ARRAY_LENGTH(encoding), L"cp%u", ansi_codepage);
+    encoding[Py_ARRAY_LENGTH(encoding) - 1] = 0;
+    return _PyMem_RawWcsdup(encoding);
+#else
+    const char *encoding = nl_langinfo(CODESET);
+    if (!encoding || encoding[0] == '\0') {
+        // Use UTF-8 if nl_langinfo() returns an empty string. It can happen on
+        // macOS if the LC_CTYPE locale is not supported.
+        return _PyMem_RawWcsdup(L"UTF-8");
+    }
+
+    wchar_t *wstr;
+    int res = decode_current_locale(encoding, &wstr, NULL,
+                                    NULL, _Py_ERROR_SURROGATEESCAPE);
+    if (res < 0) {
+        return NULL;
+    }
+    return wstr;
+#endif  // !MS_WINDOWS
+
+#endif  // !_Py_FORCE_UTF8_LOCALE
+}
+
+
+PyObject *
+_Py_GetLocaleEncodingObject(void)
+{
+    wchar_t *encoding = _Py_GetLocaleEncoding();
+    if (encoding == NULL) {
+        PyErr_NoMemory();
+        return NULL;
+    }
+
+    PyObject *str = PyUnicode_FromWideChar(encoding, -1);
+    PyMem_RawFree(encoding);
+    return str;
+}
+
+#ifdef HAVE_NON_UNICODE_WCHAR_T_REPRESENTATION
+
+/* Check whether current locale uses Unicode as internal wchar_t form. */
+int
+_Py_LocaleUsesNonUnicodeWchar(void)
+{
+    /* Oracle Solaris uses non-Unicode internal wchar_t form for
+       non-Unicode locales and hence needs conversion to UTF first. */
+    char* codeset = nl_langinfo(CODESET);
+    if (!codeset) {
+        return 0;
+    }
+    /* 646 refers to ISO/IEC 646 standard that corresponds to ASCII encoding */
+    return (strcmp(codeset, "UTF-8") != 0 && strcmp(codeset, "646") != 0);
+}
+
+static wchar_t *
+_Py_ConvertWCharForm(const wchar_t *source, Py_ssize_t size,
+                     const char *tocode, const char *fromcode)
+{
+    Py_BUILD_ASSERT(sizeof(wchar_t) == 4);
+
+    /* Ensure we won't overflow the size. */
+    if (size > (PY_SSIZE_T_MAX / (Py_ssize_t)sizeof(wchar_t))) {
+        PyErr_NoMemory();
+        return NULL;
+    }
+
+    /* the string doesn't have to be NULL terminated */
+    wchar_t* target = PyMem_Malloc(size * sizeof(wchar_t));
+    if (target == NULL) {
+        PyErr_NoMemory();
+        return NULL;
+    }
+
+    iconv_t cd = iconv_open(tocode, fromcode);
+    if (cd == (iconv_t)-1) {
+        PyErr_Format(PyExc_ValueError, "iconv_open() failed");
+        PyMem_Free(target);
+        return NULL;
+    }
+
+    char *inbuf = (char *) source;
+    char *outbuf = (char *) target;
+    size_t inbytesleft = sizeof(wchar_t) * size;
+    size_t outbytesleft = inbytesleft;
+
+    size_t ret = iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
+    if (ret == DECODE_ERROR) {
+        PyErr_Format(PyExc_ValueError, "iconv() failed");
+        PyMem_Free(target);
+        iconv_close(cd);
+        return NULL;
+    }
+
+    iconv_close(cd);
+    return target;
+}
+
+/* Convert a wide character string to the UCS-4 encoded string. This
+   is necessary on systems where internal form of wchar_t are not Unicode
+   code points (e.g. Oracle Solaris).
+
+   Return a pointer to a newly allocated string, use PyMem_Free() to free
+   the memory. Return NULL and raise exception on conversion or memory
+   allocation error. */
+wchar_t *
+_Py_DecodeNonUnicodeWchar(const wchar_t *native, Py_ssize_t size)
+{
+    return _Py_ConvertWCharForm(native, size, "UCS-4-INTERNAL", "wchar_t");
+}
+
+/* Convert a UCS-4 encoded string to native wide character string. This
+   is necessary on systems where internal form of wchar_t are not Unicode
+   code points (e.g. Oracle Solaris).
+
+   The conversion is done in place. This can be done because both wchar_t
+   and UCS-4 use 4-byte encoding, and one wchar_t symbol always correspond
+   to a single UCS-4 symbol and vice versa. (This is true for Oracle Solaris,
+   which is currently the only system using these functions; it doesn't have
+   to be for other systems).
+
+   Return 0 on success. Return -1 and raise exception on conversion
+   or memory allocation error. */
+int
+_Py_EncodeNonUnicodeWchar_InPlace(wchar_t *unicode, Py_ssize_t size)
+{
+    wchar_t* result = _Py_ConvertWCharForm(unicode, size, "wchar_t", "UCS-4-INTERNAL");
+    if (!result) {
+        return -1;
+    }
+    memcpy(unicode, result, size * sizeof(wchar_t));
+    PyMem_Free(result);
+    return 0;
+}
+#endif /* HAVE_NON_UNICODE_WCHAR_T_REPRESENTATION */
+
 #ifdef MS_WINDOWS
 static __int64 secs_between_epochs = 11644473600; /* Seconds between 1.1.1601 and 1.1.1970 */
 
@@ -913,9 +1124,7 @@
     HANDLE h;
     int type;
 
-    _Py_BEGIN_SUPPRESS_IPH
-    h = (HANDLE)_get_osfhandle(fd);
-    _Py_END_SUPPRESS_IPH
+    h = _Py_get_osfhandle_noraise(fd);
 
     if (h == INVALID_HANDLE_VALUE) {
         /* errno is already set by _get_osfhandle, but we also set
@@ -1008,15 +1217,21 @@
 #ifdef MS_WINDOWS
     int err;
     struct _stat wstatbuf;
-    const wchar_t *wpath;
 
-    wpath = _PyUnicode_AsUnicode(path);
+#if USE_UNICODE_WCHAR_CACHE
+    const wchar_t *wpath = _PyUnicode_AsUnicode(path);
+#else /* USE_UNICODE_WCHAR_CACHE */
+    wchar_t *wpath = PyUnicode_AsWideCharString(path, NULL);
+#endif /* USE_UNICODE_WCHAR_CACHE */
     if (wpath == NULL)
         return -2;
 
     err = _wstat(wpath, &wstatbuf);
     if (!err)
         statbuf->st_mode = wstatbuf.st_mode;
+#if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free(wpath);
+#endif /* USE_UNICODE_WCHAR_CACHE */
     return err;
 #else
     int ret;
@@ -1048,9 +1263,7 @@
     HANDLE handle;
     DWORD flags;
 
-    _Py_BEGIN_SUPPRESS_IPH
-    handle = (HANDLE)_get_osfhandle(fd);
-    _Py_END_SUPPRESS_IPH
+    handle = _Py_get_osfhandle_noraise(fd);
     if (handle == INVALID_HANDLE_VALUE) {
         if (raise)
             PyErr_SetFromErrno(PyExc_OSError);
@@ -1121,9 +1334,7 @@
     }
 
 #ifdef MS_WINDOWS
-    _Py_BEGIN_SUPPRESS_IPH
-    handle = (HANDLE)_get_osfhandle(fd);
-    _Py_END_SUPPRESS_IPH
+    handle = _Py_get_osfhandle_noraise(fd);
     if (handle == INVALID_HANDLE_VALUE) {
         if (raise)
             PyErr_SetFromErrno(PyExc_OSError);
@@ -1165,6 +1376,14 @@
             return 0;
         }
 
+#ifdef O_PATH
+        if (errno == EBADF) {
+            // bpo-44849: On Linux and FreeBSD, ioctl(FIOCLEX) fails with EBADF
+            // on O_PATH file descriptors. Fall through to the fcntl()
+            // implementation.
+        }
+        else
+#endif
         if (errno != ENOTTY && errno != EACCES) {
             if (raise)
                 PyErr_SetFromErrno(PyExc_OSError);
@@ -1364,7 +1583,7 @@
     char cmode[10];
     size_t r;
     r = wcstombs(cmode, mode, 10);
-    if (r == (size_t)-1 || r >= 10) {
+    if (r == DECODE_ERROR || r >= 10) {
         errno = EINVAL;
         return NULL;
     }
@@ -1386,33 +1605,6 @@
     return f;
 }
 
-/* Wrapper to fopen().
-
-   The file descriptor is created non-inheritable.
-
-   If interrupted by a signal, fail with EINTR. */
-FILE*
-_Py_fopen(const char *pathname, const char *mode)
-{
-    PyObject *pathname_obj = PyUnicode_DecodeFSDefault(pathname);
-    if (pathname_obj == NULL) {
-        return NULL;
-    }
-    if (PySys_Audit("open", "Osi", pathname_obj, mode, 0) < 0) {
-        Py_DECREF(pathname_obj);
-        return NULL;
-    }
-    Py_DECREF(pathname_obj);
-
-    FILE *f = fopen(pathname, mode);
-    if (f == NULL)
-        return NULL;
-    if (make_non_inheritable(fileno(f)) < 0) {
-        fclose(f);
-        return NULL;
-    }
-    return f;
-}
 
 /* Open a file. Call _wfopen() on Windows, or encode the path to the filesystem
    encoding and call fopen() otherwise.
@@ -1433,7 +1625,6 @@
     FILE *f;
     int async_err = 0;
 #ifdef MS_WINDOWS
-    const wchar_t *wpath;
     wchar_t wmode[10];
     int usize;
 
@@ -1448,7 +1639,11 @@
                      Py_TYPE(path));
         return NULL;
     }
-    wpath = _PyUnicode_AsUnicode(path);
+#if USE_UNICODE_WCHAR_CACHE
+    const wchar_t *wpath = _PyUnicode_AsUnicode(path);
+#else /* USE_UNICODE_WCHAR_CACHE */
+    wchar_t *wpath = PyUnicode_AsWideCharString(path, NULL);
+#endif /* USE_UNICODE_WCHAR_CACHE */
     if (wpath == NULL)
         return NULL;
 
@@ -1456,6 +1651,9 @@
                                 wmode, Py_ARRAY_LENGTH(wmode));
     if (usize == 0) {
         PyErr_SetFromWindowsErr(0);
+#if !USE_UNICODE_WCHAR_CACHE
+        PyMem_Free(wpath);
+#endif /* USE_UNICODE_WCHAR_CACHE */
         return NULL;
     }
 
@@ -1465,6 +1663,9 @@
         Py_END_ALLOW_THREADS
     } while (f == NULL
              && errno == EINTR && !(async_err = PyErr_CheckSignals()));
+#if !USE_UNICODE_WCHAR_CACHE
+    PyMem_Free(wpath);
+#endif /* USE_UNICODE_WCHAR_CACHE */
 #else
     PyObject *bytes;
     const char *path_bytes;
@@ -1577,12 +1778,22 @@
 
     _Py_BEGIN_SUPPRESS_IPH
 #ifdef MS_WINDOWS
-    if (count > 32767 && isatty(fd)) {
+    if (count > 32767) {
         /* Issue #11395: the Windows console returns an error (12: not
            enough space error) on writing into stdout if stdout mode is
            binary and the length is greater than 66,000 bytes (or less,
            depending on heap usage). */
-        count = 32767;
+        if (gil_held) {
+            Py_BEGIN_ALLOW_THREADS
+            if (isatty(fd)) {
+                count = 32767;
+            }
+            Py_END_ALLOW_THREADS
+        } else {
+            if (isatty(fd)) {
+                count = 32767;
+            }
+        }
     }
 #endif
     if (count > _PY_WRITE_MAX) {
@@ -1908,13 +2119,9 @@
     assert(PyGILState_Check());
 
 #ifdef MS_WINDOWS
-    _Py_BEGIN_SUPPRESS_IPH
-    handle = (HANDLE)_get_osfhandle(fd);
-    _Py_END_SUPPRESS_IPH
-    if (handle == INVALID_HANDLE_VALUE) {
-        PyErr_SetFromErrno(PyExc_OSError);
+    handle = _Py_get_osfhandle(fd);
+    if (handle == INVALID_HANDLE_VALUE)
         return -1;
-    }
 
     Py_BEGIN_ALLOW_THREADS
     _Py_BEGIN_SUPPRESS_IPH
@@ -1992,7 +2199,9 @@
 int
 _Py_set_blocking(int fd, int blocking)
 {
-#if defined(HAVE_SYS_IOCTL_H) && defined(FIONBIO)
+/* bpo-41462: On VxWorks, ioctl(FIONBIO) only works on sockets.
+   Use fcntl() instead. */
+#if defined(HAVE_SYS_IOCTL_H) && defined(FIONBIO) && !defined(__VXWORKS__)
     int arg = !blocking;
     if (ioctl(fd, FIONBIO, &arg) < 0)
         goto error;
@@ -2022,8 +2231,47 @@
     PyErr_SetFromErrno(PyExc_OSError);
     return -1;
 }
-#endif
+#else   /* MS_WINDOWS */
+void*
+_Py_get_osfhandle_noraise(int fd)
+{
+    void *handle;
+    _Py_BEGIN_SUPPRESS_IPH
+    handle = (void*)_get_osfhandle(fd);
+    _Py_END_SUPPRESS_IPH
+    return handle;
+}
 
+void*
+_Py_get_osfhandle(int fd)
+{
+    void *handle = _Py_get_osfhandle_noraise(fd);
+    if (handle == INVALID_HANDLE_VALUE)
+        PyErr_SetFromErrno(PyExc_OSError);
+
+    return handle;
+}
+
+int
+_Py_open_osfhandle_noraise(void *handle, int flags)
+{
+    int fd;
+    _Py_BEGIN_SUPPRESS_IPH
+    fd = _open_osfhandle((intptr_t)handle, flags);
+    _Py_END_SUPPRESS_IPH
+    return fd;
+}
+
+int
+_Py_open_osfhandle(void *handle, int flags)
+{
+    int fd = _Py_open_osfhandle_noraise(handle, flags);
+    if (fd == -1)
+        PyErr_SetFromErrno(PyExc_OSError);
+
+    return fd;
+}
+#endif  /* MS_WINDOWS */
 
 int
 _Py_GetLocaleconvNumeric(struct lconv *lc,
@@ -2102,3 +2350,79 @@
 
 #undef GET_LOCALE_STRING
 }
+
+/* Our selection logic for which function to use is as follows:
+ * 1. If close_range(2) is available, always prefer that; it's better for
+ *    contiguous ranges like this than fdwalk(3) which entails iterating over
+ *    the entire fd space and simply doing nothing for those outside the range.
+ * 2. If closefrom(2) is available, we'll attempt to use that next if we're
+ *    closing up to sysconf(_SC_OPEN_MAX).
+ * 2a. Fallback to fdwalk(3) if we're not closing up to sysconf(_SC_OPEN_MAX),
+ *    as that will be more performant if the range happens to have any chunk of
+ *    non-opened fd in the middle.
+ * 2b. If fdwalk(3) isn't available, just do a plain close(2) loop.
+ */
+#ifdef __FreeBSD__
+#  define USE_CLOSEFROM
+#endif /* __FreeBSD__ */
+
+#ifdef HAVE_FDWALK
+#  define USE_FDWALK
+#endif /* HAVE_FDWALK */
+
+#ifdef USE_FDWALK
+static int
+_fdwalk_close_func(void *lohi, int fd)
+{
+    int lo = ((int *)lohi)[0];
+    int hi = ((int *)lohi)[1];
+
+    if (fd >= hi) {
+        return 1;
+    }
+    else if (fd >= lo) {
+        /* Ignore errors */
+        (void)close(fd);
+    }
+    return 0;
+}
+#endif /* USE_FDWALK */
+
+/* Closes all file descriptors in [first, last], ignoring errors. */
+void
+_Py_closerange(int first, int last)
+{
+    first = Py_MAX(first, 0);
+    _Py_BEGIN_SUPPRESS_IPH
+#ifdef HAVE_CLOSE_RANGE
+    if (close_range(first, last, 0) == 0 || errno != ENOSYS) {
+        /* Any errors encountered while closing file descriptors are ignored;
+         * ENOSYS means no kernel support, though,
+         * so we'll fallback to the other methods. */
+    }
+    else
+#endif /* HAVE_CLOSE_RANGE */
+#ifdef USE_CLOSEFROM
+    if (last >= sysconf(_SC_OPEN_MAX)) {
+        /* Any errors encountered while closing file descriptors are ignored */
+        closefrom(first);
+    }
+    else
+#endif /* USE_CLOSEFROM */
+#ifdef USE_FDWALK
+    {
+        int lohi[2];
+        lohi[0] = first;
+        lohi[1] = last + 1;
+        fdwalk(_fdwalk_close_func, lohi);
+    }
+#else
+    {
+        for (int i = first; i <= last; i++) {
+            /* Ignore errors */
+            (void)close(i);
+        }
+    }
+#endif /* USE_FDWALK */
+    _Py_END_SUPPRESS_IPH
+}
diff --git a/Python/formatter_unicode.c b/Python/formatter_unicode.c
index ed95f26..7b5a7bd 100644
--- a/Python/formatter_unicode.c
+++ b/Python/formatter_unicode.c
@@ -219,7 +219,7 @@
     /* The special case for 0-padding (backwards compat) */
     if (!fill_char_specified && end-pos >= 1 && READ_spec(pos) == '0') {
         format->fill_char = '0';
-        if (!align_specified) {
+        if (!align_specified && default_align == '>') {
             format->align = '=';
         }
         ++pos;
@@ -773,8 +773,14 @@
 
     /* sign is not allowed on strings */
     if (format->sign != '\0') {
-        PyErr_SetString(PyExc_ValueError,
-                        "Sign not allowed in string format specifier");
+        if (format->sign == ' ') {
+            PyErr_SetString(PyExc_ValueError,
+                "Space not allowed in string format specifier");
+        }
+        else {
+            PyErr_SetString(PyExc_ValueError,
+                "Sign not allowed in string format specifier");
+        }
         goto done;
     }
 
diff --git a/Python/frozen.c b/Python/frozen.c
index 228a110..7f433ff 100644
--- a/Python/frozen.c
+++ b/Python/frozen.c
@@ -1,5 +1,5 @@
 
-/* Dummy frozen modules initializer */
+/* Frozen modules initializer */
 
 #include "Python.h"
 #include "importlib.h"
@@ -10,23 +10,12 @@
    define a single frozen module, __hello__.  Loading it will print
    some famous words... */
 
-/* To regenerate this data after the bytecode or marshal format has changed,
-   go to ../Tools/freeze/ and freeze the flag.py file; then copy and paste
-   the appropriate bytes from M___main__.c. */
+/* Run "make regen-frozen" to regen the file below (e.g. after a bytecode
+ * format change).  The include file defines _Py_M__hello as an array of bytes.
+ */
+#include "frozen_hello.h"
 
-static unsigned char M___hello__[] = {
-    227,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,2,0,0,0,64,0,0,0,115,16,0,0,0,100,0,
-    90,0,101,1,100,1,131,1,1,0,100,2,83,0,41,3,
-    84,122,12,72,101,108,108,111,32,119,111,114,108,100,33,78,
-    41,2,218,11,105,110,105,116,105,97,108,105,122,101,100,218,
-    5,112,114,105,110,116,169,0,114,3,0,0,0,114,3,0,
-    0,0,250,20,84,111,111,108,115,47,102,114,101,101,122,101,
-    47,102,108,97,103,46,112,121,218,8,60,109,111,100,117,108,
-    101,62,1,0,0,0,115,2,0,0,0,4,1,
-};
-
-#define SIZE (int)sizeof(M___hello__)
+#define SIZE (int)sizeof(_Py_M__hello)
 
 static const struct _frozen _PyImport_FrozenModules[] = {
     /* importlib */
@@ -37,10 +26,10 @@
     {"zipimport", _Py_M__zipimport,
         (int)sizeof(_Py_M__zipimport)},
     /* Test module */
-    {"__hello__", M___hello__, SIZE},
+    {"__hello__", _Py_M__hello, SIZE},
     /* Test package (negative size indicates package-ness) */
-    {"__phello__", M___hello__, -SIZE},
-    {"__phello__.spam", M___hello__, SIZE},
+    {"__phello__", _Py_M__hello, -SIZE},
+    {"__phello__.spam", _Py_M__hello, SIZE},
     {0, 0, 0} /* sentinel */
 };
 
diff --git a/Python/frozen_hello.h b/Python/frozen_hello.h
new file mode 100644
index 0000000..5448c80
--- /dev/null
+++ b/Python/frozen_hello.h
@@ -0,0 +1,12 @@
+/* Auto-generated by Programs/_freeze_importlib.c */
+const unsigned char _Py_M__hello[] = {
+    99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,2,0,0,0,64,0,0,0,115,16,0,0,0,100,0,
+    90,0,101,1,100,1,131,1,1,0,100,2,83,0,41,3,
+    84,122,12,72,101,108,108,111,32,119,111,114,108,100,33,78,
+    41,2,90,11,105,110,105,116,105,97,108,105,122,101,100,218,
+    5,112,114,105,110,116,169,0,114,1,0,0,0,114,1,0,
+    0,0,122,14,60,102,114,111,122,101,110,32,104,101,108,108,
+    111,62,218,8,60,109,111,100,117,108,101,62,1,0,0,0,
+    115,4,0,0,0,4,0,12,1,
+};
diff --git a/Python/future.c b/Python/future.c
index 1663a38..d465608 100644
--- a/Python/future.c
+++ b/Python/future.c
@@ -1,11 +1,5 @@
 #include "Python.h"
-#include "Python-ast.h"
-#include "node.h"
-#include "token.h"
-#include "graminit.h"
-#include "code.h"
-#include "symtable.h"
-#include "ast.h"
+#include "pycore_ast.h"           // _PyAST_GetDocString()
 
 #define UNDEFINED_FUTURE_FEATURE "future feature %.100s is not defined"
 #define ERR_LATE_FUTURE \
@@ -15,11 +9,10 @@
 future_check_features(PyFutureFeatures *ff, stmt_ty s, PyObject *filename)
 {
     int i;
-    asdl_seq *names;
 
     assert(s->kind == ImportFrom_kind);
 
-    names = s->v.ImportFrom.names;
+    asdl_alias_seq *names = s->v.ImportFrom.names;
     for (i = 0; i < asdl_seq_LEN(names); i++) {
         alias_ty name = (alias_ty)asdl_seq_GET(names, i);
         const char *feature = PyUnicode_AsUTF8(name->name);
@@ -123,7 +116,7 @@
 
 
 PyFutureFeatures *
-PyFuture_FromASTObject(mod_ty mod, PyObject *filename)
+_PyFuture_FromAST(mod_ty mod, PyObject *filename)
 {
     PyFutureFeatures *ff;
 
@@ -141,18 +134,3 @@
     }
     return ff;
 }
-
-
-PyFutureFeatures *
-PyFuture_FromAST(mod_ty mod, const char *filename_str)
-{
-    PyFutureFeatures *ff;
-    PyObject *filename;
-
-    filename = PyUnicode_DecodeFSDefault(filename_str);
-    if (filename == NULL)
-        return NULL;
-    ff = PyFuture_FromASTObject(mod, filename);
-    Py_DECREF(filename);
-    return ff;
-}
diff --git a/Python/getargs.c b/Python/getargs.c
index d4a531a..d5e0835 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -2,7 +2,7 @@
 /* New getargs implementation */
 
 #include "Python.h"
-#include "pycore_tupleobject.h"
+#include "pycore_tuple.h"         // _PyTuple_ITEMS()
 
 #include <ctype.h>
 #include <float.h>
@@ -202,7 +202,7 @@
 cleanup_ptr(PyObject *self, void *ptr)
 {
     if (ptr) {
-        PyMem_FREE(ptr);
+        PyMem_Free(ptr);
     }
     return 0;
 }
@@ -246,7 +246,7 @@
       }
     }
     if (freelist->entries_malloced)
-        PyMem_FREE(freelist->entries);
+        PyMem_Free(freelist->entries);
     return retval;
 }
 
@@ -452,7 +452,7 @@
         }
         if (iarg != 0) {
             PyOS_snprintf(p, sizeof(buf) - (p - buf),
-                          "argument %" PY_FORMAT_SIZE_T "d", iarg);
+                          "argument %zd", iarg);
             i = 0;
             p += strlen(p);
             while (i < 32 && levels[i] > 0 && (int)(p-buf) < 220) {
@@ -540,15 +540,14 @@
         levels[0] = 0;
         if (toplevel) {
             PyOS_snprintf(msgbuf, bufsize,
-                          "expected %d argument%s, not %" PY_FORMAT_SIZE_T "d",
+                          "expected %d argument%s, not %zd",
                           n,
                           n == 1 ? "" : "s",
                           len);
         }
         else {
             PyOS_snprintf(msgbuf, bufsize,
-                          "must be sequence of length %d, "
-                          "not %" PY_FORMAT_SIZE_T "d",
+                          "must be sequence of length %d, not %zd",
                           n, len);
         }
         return msgbuf;
@@ -643,22 +642,6 @@
 
 #define CONV_UNICODE "(unicode conversion error)"
 
-/* Explicitly check for float arguments when integers are expected.
-   Return 1 for error, 0 if ok.
-   XXX Should be removed after the end of the deprecation period in
-   _PyLong_FromNbIndexOrNbInt. */
-static int
-float_argument_error(PyObject *arg)
-{
-    if (PyFloat_Check(arg)) {
-        PyErr_SetString(PyExc_TypeError,
-                        "integer argument expected, got float" );
-        return 1;
-    }
-    else
-        return 0;
-}
-
 /* Convert a non-tuple argument.  Return NULL if conversion went OK,
    or a string with a message describing the failure.  The message is
    formatted as "must be <desired type>, not <actual type>".
@@ -672,29 +655,14 @@
 convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
               char *msgbuf, size_t bufsize, freelist_t *freelist)
 {
-    /* For # codes */
-#define FETCH_SIZE      int *q=NULL;Py_ssize_t *q2=NULL;\
-    if (flags & FLAG_SIZE_T) q2=va_arg(*p_va, Py_ssize_t*); \
-    else { \
-        if (PyErr_WarnEx(PyExc_DeprecationWarning, \
-                    "PY_SSIZE_T_CLEAN will be required for '#' formats", 1)) { \
-            return NULL; \
-        } \
-        q=va_arg(*p_va, int*); \
-    }
-#define STORE_SIZE(s)   \
-    if (flags & FLAG_SIZE_T) \
-        *q2=s; \
-    else { \
-        if (INT_MAX < s) { \
-            PyErr_SetString(PyExc_OverflowError, \
-                "size does not fit in an int"); \
-            return converterr("", arg, msgbuf, bufsize); \
-        } \
-        *q = (int)s; \
-    }
-#define BUFFER_LEN      ((flags & FLAG_SIZE_T) ? *q2:*q)
 #define RETURN_ERR_OCCURRED return msgbuf
+    /* For # codes */
+#define REQUIRE_PY_SSIZE_T_CLEAN \
+    if (!(flags & FLAG_SIZE_T)) { \
+        PyErr_SetString(PyExc_SystemError, \
+                        "PY_SSIZE_T_CLEAN macro must be defined for '#' formats"); \
+        RETURN_ERR_OCCURRED; \
+    }
 
     const char *format = *p_format;
     char c = *format++;
@@ -704,10 +672,7 @@
 
     case 'b': { /* unsigned byte -- very short int */
         char *p = va_arg(*p_va, char *);
-        long ival;
-        if (float_argument_error(arg))
-            RETURN_ERR_OCCURRED;
-        ival = PyLong_AsLong(arg);
+        long ival = PyLong_AsLong(arg);
         if (ival == -1 && PyErr_Occurred())
             RETURN_ERR_OCCURRED;
         else if (ival < 0) {
@@ -728,11 +693,8 @@
     case 'B': {/* byte sized bitfield - both signed and unsigned
                   values allowed */
         char *p = va_arg(*p_va, char *);
-        long ival;
-        if (float_argument_error(arg))
-            RETURN_ERR_OCCURRED;
-        ival = PyLong_AsUnsignedLongMask(arg);
-        if (ival == -1 && PyErr_Occurred())
+        unsigned long ival = PyLong_AsUnsignedLongMask(arg);
+        if (ival == (unsigned long)-1 && PyErr_Occurred())
             RETURN_ERR_OCCURRED;
         else
             *p = (unsigned char) ival;
@@ -741,10 +703,7 @@
 
     case 'h': {/* signed short int */
         short *p = va_arg(*p_va, short *);
-        long ival;
-        if (float_argument_error(arg))
-            RETURN_ERR_OCCURRED;
-        ival = PyLong_AsLong(arg);
+        long ival = PyLong_AsLong(arg);
         if (ival == -1 && PyErr_Occurred())
             RETURN_ERR_OCCURRED;
         else if (ival < SHRT_MIN) {
@@ -765,11 +724,8 @@
     case 'H': { /* short int sized bitfield, both signed and
                    unsigned allowed */
         unsigned short *p = va_arg(*p_va, unsigned short *);
-        long ival;
-        if (float_argument_error(arg))
-            RETURN_ERR_OCCURRED;
-        ival = PyLong_AsUnsignedLongMask(arg);
-        if (ival == -1 && PyErr_Occurred())
+        unsigned long ival = PyLong_AsUnsignedLongMask(arg);
+        if (ival == (unsigned long)-1 && PyErr_Occurred())
             RETURN_ERR_OCCURRED;
         else
             *p = (unsigned short) ival;
@@ -778,10 +734,7 @@
 
     case 'i': {/* signed int */
         int *p = va_arg(*p_va, int *);
-        long ival;
-        if (float_argument_error(arg))
-            RETURN_ERR_OCCURRED;
-        ival = PyLong_AsLong(arg);
+        long ival = PyLong_AsLong(arg);
         if (ival == -1 && PyErr_Occurred())
             RETURN_ERR_OCCURRED;
         else if (ival > INT_MAX) {
@@ -802,14 +755,11 @@
     case 'I': { /* int sized bitfield, both signed and
                    unsigned allowed */
         unsigned int *p = va_arg(*p_va, unsigned int *);
-        unsigned int ival;
-        if (float_argument_error(arg))
-            RETURN_ERR_OCCURRED;
-        ival = (unsigned int)PyLong_AsUnsignedLongMask(arg);
-        if (ival == (unsigned int)-1 && PyErr_Occurred())
+        unsigned long ival = PyLong_AsUnsignedLongMask(arg);
+        if (ival == (unsigned long)-1 && PyErr_Occurred())
             RETURN_ERR_OCCURRED;
         else
-            *p = ival;
+            *p = (unsigned int) ival;
         break;
     }
 
@@ -818,9 +768,7 @@
         PyObject *iobj;
         Py_ssize_t *p = va_arg(*p_va, Py_ssize_t *);
         Py_ssize_t ival = -1;
-        if (float_argument_error(arg))
-            RETURN_ERR_OCCURRED;
-        iobj = PyNumber_Index(arg);
+        iobj = _PyNumber_Index(arg);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
@@ -832,10 +780,7 @@
     }
     case 'l': {/* long int */
         long *p = va_arg(*p_va, long *);
-        long ival;
-        if (float_argument_error(arg))
-            RETURN_ERR_OCCURRED;
-        ival = PyLong_AsLong(arg);
+        long ival = PyLong_AsLong(arg);
         if (ival == -1 && PyErr_Occurred())
             RETURN_ERR_OCCURRED;
         else
@@ -856,10 +801,7 @@
 
     case 'L': {/* long long */
         long long *p = va_arg( *p_va, long long * );
-        long long ival;
-        if (float_argument_error(arg))
-            RETURN_ERR_OCCURRED;
-        ival = PyLong_AsLongLong(arg);
+        long long ival = PyLong_AsLongLong(arg);
         if (ival == (long long)-1 && PyErr_Occurred())
             RETURN_ERR_OCCURRED;
         else
@@ -974,8 +916,9 @@
         if (count < 0)
             return converterr(buf, arg, msgbuf, bufsize);
         if (*format == '#') {
-            FETCH_SIZE;
-            STORE_SIZE(count);
+            REQUIRE_PY_SSIZE_T_CLEAN;
+            Py_ssize_t *psize = va_arg(*p_va, Py_ssize_t*);
+            *psize = count;
             format++;
         } else {
             if (strlen(*p) != (size_t)count) {
@@ -1017,11 +960,12 @@
         } else if (*format == '#') { /* a string or read-only bytes-like object */
             /* "s#" or "z#" */
             const void **p = (const void **)va_arg(*p_va, const char **);
-            FETCH_SIZE;
+            REQUIRE_PY_SSIZE_T_CLEAN;
+            Py_ssize_t *psize = va_arg(*p_va, Py_ssize_t*);
 
             if (c == 'z' && arg == Py_None) {
                 *p = NULL;
-                STORE_SIZE(0);
+                *psize = 0;
             }
             else if (PyUnicode_Check(arg)) {
                 Py_ssize_t len;
@@ -1030,7 +974,7 @@
                     return converterr(CONV_UNICODE,
                                       arg, msgbuf, bufsize);
                 *p = sarg;
-                STORE_SIZE(len);
+                *psize = len;
             }
             else { /* read-only bytes-like object */
                 /* XXX Really? */
@@ -1038,7 +982,7 @@
                 Py_ssize_t count = convertbuffer(arg, p, &buf);
                 if (count < 0)
                     return converterr(buf, arg, msgbuf, bufsize);
-                STORE_SIZE(count);
+                *psize = count;
             }
             format++;
         } else {
@@ -1070,25 +1014,29 @@
     case 'u': /* raw unicode buffer (Py_UNICODE *) */
     case 'Z': /* raw unicode buffer or None */
     {
-        // TODO: Raise DeprecationWarning
+        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
+                "getargs: The '%c' format is deprecated. Use 'U' instead.", c)) {
+            return NULL;
+        }
 _Py_COMP_DIAG_PUSH
 _Py_COMP_DIAG_IGNORE_DEPR_DECLS
         Py_UNICODE **p = va_arg(*p_va, Py_UNICODE **);
 
         if (*format == '#') {
             /* "u#" or "Z#" */
-            FETCH_SIZE;
+            REQUIRE_PY_SSIZE_T_CLEAN;
+            Py_ssize_t *psize = va_arg(*p_va, Py_ssize_t*);
 
             if (c == 'Z' && arg == Py_None) {
                 *p = NULL;
-                STORE_SIZE(0);
+                *psize = 0;
             }
             else if (PyUnicode_Check(arg)) {
                 Py_ssize_t len;
                 *p = PyUnicode_AsUnicodeAndSize(arg, &len);
                 if (*p == NULL)
                     RETURN_ERR_OCCURRED;
-                STORE_SIZE(len);
+                *psize = len;
             }
             else
                 return converterr(c == 'Z' ? "str or None" : "str",
@@ -1203,22 +1151,11 @@
                trailing 0-byte
 
             */
-            int *q = NULL; Py_ssize_t *q2 = NULL;
-            if (flags & FLAG_SIZE_T) {
-                q2 = va_arg(*p_va, Py_ssize_t*);
-            }
-            else {
-                if (PyErr_WarnEx(PyExc_DeprecationWarning,
-                            "PY_SSIZE_T_CLEAN will be required for '#' formats", 1))
-                {
-                    Py_DECREF(s);
-                    return NULL;
-                }
-                q = va_arg(*p_va, int*);
-            }
+            REQUIRE_PY_SSIZE_T_CLEAN;
+            Py_ssize_t *psize = va_arg(*p_va, Py_ssize_t*);
 
             format++;
-            if (q == NULL && q2 == NULL) {
+            if (psize == NULL) {
                 Py_DECREF(s);
                 return converterr(
                     "(buffer_len is NULL)",
@@ -1238,30 +1175,20 @@
                         arg, msgbuf, bufsize);
                 }
             } else {
-                if (size + 1 > BUFFER_LEN) {
+                if (size + 1 > *psize) {
                     Py_DECREF(s);
                     PyErr_Format(PyExc_ValueError,
                                  "encoded string too long "
                                  "(%zd, maximum length %zd)",
-                                 (Py_ssize_t)size, (Py_ssize_t)(BUFFER_LEN-1));
+                                 (Py_ssize_t)size, (Py_ssize_t)(*psize - 1));
                     RETURN_ERR_OCCURRED;
                 }
             }
             memcpy(*buffer, ptr, size+1);
 
-            if (flags & FLAG_SIZE_T) {
-                *q2 = size;
-            }
-            else {
-                if (INT_MAX < size) {
-                    Py_DECREF(s);
-                    PyErr_SetString(PyExc_OverflowError,
-                                    "size does not fit in an int");
-                    return converterr("", arg, msgbuf, bufsize);
-                }
-                *q = (int)size;
-            }
-        } else {
+            *psize = size;
+        }
+        else {
             /* Using a 0-terminated buffer:
 
                - the encoded string has to be 0-terminated
@@ -1399,9 +1326,7 @@
     *p_format = format;
     return NULL;
 
-#undef FETCH_SIZE
-#undef STORE_SIZE
-#undef BUFFER_LEN
+#undef REQUIRE_PY_SSIZE_T_CLEAN
 #undef RETURN_ERR_OCCURRED
 }
 
@@ -2607,15 +2532,12 @@
             }
             if (*format == '#') {
                 if (p_va != NULL) {
-                    if (flags & FLAG_SIZE_T)
-                        (void) va_arg(*p_va, Py_ssize_t *);
-                    else {
-                        if (PyErr_WarnEx(PyExc_DeprecationWarning,
-                                    "PY_SSIZE_T_CLEAN will be required for '#' formats", 1)) {
-                            return NULL;
-                        }
-                        (void) va_arg(*p_va, int *);
+                    if (!(flags & FLAG_SIZE_T)) {
+                        PyErr_SetString(PyExc_SystemError,
+                                "PY_SSIZE_T_CLEAN macro must be defined for '#' formats");
+                        return NULL;
                     }
+                    (void) va_arg(*p_va, Py_ssize_t *);
                 }
                 format++;
             } else if ((c == 's' || c == 'z' || c == 'y' || c == 'w')
diff --git a/Python/getcompiler.c b/Python/getcompiler.c
index 59c0dbf..a5d2623 100644
--- a/Python/getcompiler.c
+++ b/Python/getcompiler.c
@@ -8,9 +8,9 @@
 // Note the __clang__ conditional has to come before the __GNUC__ one because
 // clang pretends to be GCC.
 #if defined(__clang__)
-#define COMPILER "\n[Clang " __clang_version__ "]"
+#define COMPILER "[Clang " __clang_version__ "]"
 #elif defined(__GNUC__)
-#define COMPILER "\n[GCC " __VERSION__ "]"
+#define COMPILER "[GCC " __VERSION__ "]"
 // Generic fallbacks.
 #elif defined(__cplusplus)
 #define COMPILER "[C++]"
diff --git a/Python/getcopyright.c b/Python/getcopyright.c
index 299ccc0..88d1d05 100644
--- a/Python/getcopyright.c
+++ b/Python/getcopyright.c
@@ -4,7 +4,7 @@
 
 static const char cprt[] =
 "\
-Copyright (c) 2001-2020 Python Software Foundation.\n\
+Copyright (c) 2001-2022 Python Software Foundation.\n\
 All Rights Reserved.\n\
 \n\
 Copyright (c) 2000 BeOpen.com.\n\
diff --git a/Python/graminit.c b/Python/graminit.c
deleted file mode 100644
index b7aa528..0000000
--- a/Python/graminit.c
+++ /dev/null
@@ -1,2688 +0,0 @@
-/* Generated by Parser/pgen */
-
-#include "exports.h"
-#include "grammar.h"
-Py_EXPORTED_SYMBOL grammar _PyParser_Grammar;
-static const arc arcs_0_0[3] = {
-    {2, 1},
-    {3, 2},
-    {4, 1},
-};
-static const arc arcs_0_1[1] = {
-    {0, 1},
-};
-static const arc arcs_0_2[1] = {
-    {2, 1},
-};
-static state states_0[3] = {
-    {3, arcs_0_0},
-    {1, arcs_0_1},
-    {1, arcs_0_2},
-};
-static const arc arcs_1_0[3] = {
-    {44, 1},
-    {2, 0},
-    {45, 0},
-};
-static const arc arcs_1_1[1] = {
-    {0, 1},
-};
-static state states_1[2] = {
-    {3, arcs_1_0},
-    {1, arcs_1_1},
-};
-static const arc arcs_2_0[1] = {
-    {47, 1},
-};
-static const arc arcs_2_1[2] = {
-    {44, 2},
-    {2, 1},
-};
-static const arc arcs_2_2[1] = {
-    {0, 2},
-};
-static state states_2[3] = {
-    {1, arcs_2_0},
-    {2, arcs_2_1},
-    {1, arcs_2_2},
-};
-static const arc arcs_3_0[1] = {
-    {10, 1},
-};
-static const arc arcs_3_1[1] = {
-    {49, 2},
-};
-static const arc arcs_3_2[1] = {
-    {2, 3},
-};
-static const arc arcs_3_3[1] = {
-    {0, 3},
-};
-static state states_3[4] = {
-    {1, arcs_3_0},
-    {1, arcs_3_1},
-    {1, arcs_3_2},
-    {1, arcs_3_3},
-};
-static const arc arcs_4_0[1] = {
-    {48, 1},
-};
-static const arc arcs_4_1[2] = {
-    {48, 1},
-    {0, 1},
-};
-static state states_4[2] = {
-    {1, arcs_4_0},
-    {2, arcs_4_1},
-};
-static const arc arcs_5_0[1] = {
-    {50, 1},
-};
-static const arc arcs_5_1[3] = {
-    {52, 2},
-    {53, 2},
-    {54, 2},
-};
-static const arc arcs_5_2[1] = {
-    {0, 2},
-};
-static state states_5[3] = {
-    {1, arcs_5_0},
-    {3, arcs_5_1},
-    {1, arcs_5_2},
-};
-static const arc arcs_6_0[1] = {
-    {38, 1},
-};
-static const arc arcs_6_1[1] = {
-    {54, 2},
-};
-static const arc arcs_6_2[1] = {
-    {0, 2},
-};
-static state states_6[3] = {
-    {1, arcs_6_0},
-    {1, arcs_6_1},
-    {1, arcs_6_2},
-};
-static const arc arcs_7_0[1] = {
-    {19, 1},
-};
-static const arc arcs_7_1[1] = {
-    {40, 2},
-};
-static const arc arcs_7_2[1] = {
-    {55, 3},
-};
-static const arc arcs_7_3[2] = {
-    {56, 4},
-    {57, 5},
-};
-static const arc arcs_7_4[1] = {
-    {58, 6},
-};
-static const arc arcs_7_5[2] = {
-    {59, 7},
-    {60, 8},
-};
-static const arc arcs_7_6[1] = {
-    {57, 5},
-};
-static const arc arcs_7_7[1] = {
-    {60, 8},
-};
-static const arc arcs_7_8[1] = {
-    {0, 8},
-};
-static state states_7[9] = {
-    {1, arcs_7_0},
-    {1, arcs_7_1},
-    {1, arcs_7_2},
-    {2, arcs_7_3},
-    {1, arcs_7_4},
-    {2, arcs_7_5},
-    {1, arcs_7_6},
-    {1, arcs_7_7},
-    {1, arcs_7_8},
-};
-static const arc arcs_8_0[1] = {
-    {5, 1},
-};
-static const arc arcs_8_1[2] = {
-    {61, 2},
-    {62, 3},
-};
-static const arc arcs_8_2[1] = {
-    {0, 2},
-};
-static const arc arcs_8_3[1] = {
-    {61, 2},
-};
-static state states_8[4] = {
-    {1, arcs_8_0},
-    {2, arcs_8_1},
-    {1, arcs_8_2},
-    {1, arcs_8_3},
-};
-static const arc arcs_9_0[3] = {
-    {6, 1},
-    {63, 2},
-    {64, 3},
-};
-static const arc arcs_9_1[4] = {
-    {65, 4},
-    {59, 5},
-    {64, 6},
-    {0, 1},
-};
-static const arc arcs_9_2[1] = {
-    {64, 7},
-};
-static const arc arcs_9_3[4] = {
-    {65, 8},
-    {66, 9},
-    {59, 5},
-    {0, 3},
-};
-static const arc arcs_9_4[4] = {
-    {63, 2},
-    {59, 10},
-    {64, 11},
-    {0, 4},
-};
-static const arc arcs_9_5[1] = {
-    {0, 5},
-};
-static const arc arcs_9_6[3] = {
-    {65, 4},
-    {59, 5},
-    {0, 6},
-};
-static const arc arcs_9_7[3] = {
-    {65, 12},
-    {59, 5},
-    {0, 7},
-};
-static const arc arcs_9_8[6] = {
-    {6, 13},
-    {63, 2},
-    {67, 14},
-    {59, 15},
-    {64, 3},
-    {0, 8},
-};
-static const arc arcs_9_9[1] = {
-    {58, 16},
-};
-static const arc arcs_9_10[3] = {
-    {63, 2},
-    {64, 11},
-    {0, 10},
-};
-static const arc arcs_9_11[4] = {
-    {65, 4},
-    {66, 17},
-    {59, 5},
-    {0, 11},
-};
-static const arc arcs_9_12[2] = {
-    {59, 5},
-    {0, 12},
-};
-static const arc arcs_9_13[4] = {
-    {65, 18},
-    {59, 5},
-    {64, 19},
-    {0, 13},
-};
-static const arc arcs_9_14[2] = {
-    {65, 20},
-    {0, 14},
-};
-static const arc arcs_9_15[5] = {
-    {6, 13},
-    {63, 2},
-    {67, 14},
-    {64, 3},
-    {0, 15},
-};
-static const arc arcs_9_16[3] = {
-    {65, 8},
-    {59, 5},
-    {0, 16},
-};
-static const arc arcs_9_17[1] = {
-    {58, 6},
-};
-static const arc arcs_9_18[4] = {
-    {63, 2},
-    {59, 21},
-    {64, 22},
-    {0, 18},
-};
-static const arc arcs_9_19[3] = {
-    {65, 18},
-    {59, 5},
-    {0, 19},
-};
-static const arc arcs_9_20[5] = {
-    {6, 23},
-    {63, 2},
-    {59, 24},
-    {64, 25},
-    {0, 20},
-};
-static const arc arcs_9_21[3] = {
-    {63, 2},
-    {64, 22},
-    {0, 21},
-};
-static const arc arcs_9_22[4] = {
-    {65, 18},
-    {66, 26},
-    {59, 5},
-    {0, 22},
-};
-static const arc arcs_9_23[4] = {
-    {65, 27},
-    {59, 5},
-    {64, 28},
-    {0, 23},
-};
-static const arc arcs_9_24[1] = {
-    {64, 25},
-};
-static const arc arcs_9_25[4] = {
-    {65, 29},
-    {66, 30},
-    {59, 5},
-    {0, 25},
-};
-static const arc arcs_9_26[1] = {
-    {58, 19},
-};
-static const arc arcs_9_27[4] = {
-    {63, 2},
-    {59, 31},
-    {64, 32},
-    {0, 27},
-};
-static const arc arcs_9_28[3] = {
-    {65, 27},
-    {59, 5},
-    {0, 28},
-};
-static const arc arcs_9_29[5] = {
-    {6, 33},
-    {63, 2},
-    {59, 34},
-    {64, 25},
-    {0, 29},
-};
-static const arc arcs_9_30[1] = {
-    {58, 35},
-};
-static const arc arcs_9_31[3] = {
-    {63, 2},
-    {64, 32},
-    {0, 31},
-};
-static const arc arcs_9_32[4] = {
-    {65, 27},
-    {66, 36},
-    {59, 5},
-    {0, 32},
-};
-static const arc arcs_9_33[4] = {
-    {65, 37},
-    {59, 5},
-    {64, 38},
-    {0, 33},
-};
-static const arc arcs_9_34[4] = {
-    {6, 33},
-    {63, 2},
-    {64, 25},
-    {0, 34},
-};
-static const arc arcs_9_35[3] = {
-    {65, 29},
-    {59, 5},
-    {0, 35},
-};
-static const arc arcs_9_36[1] = {
-    {58, 28},
-};
-static const arc arcs_9_37[4] = {
-    {63, 2},
-    {59, 39},
-    {64, 40},
-    {0, 37},
-};
-static const arc arcs_9_38[3] = {
-    {65, 37},
-    {59, 5},
-    {0, 38},
-};
-static const arc arcs_9_39[3] = {
-    {63, 2},
-    {64, 40},
-    {0, 39},
-};
-static const arc arcs_9_40[4] = {
-    {65, 37},
-    {66, 41},
-    {59, 5},
-    {0, 40},
-};
-static const arc arcs_9_41[1] = {
-    {58, 38},
-};
-static state states_9[42] = {
-    {3, arcs_9_0},
-    {4, arcs_9_1},
-    {1, arcs_9_2},
-    {4, arcs_9_3},
-    {4, arcs_9_4},
-    {1, arcs_9_5},
-    {3, arcs_9_6},
-    {3, arcs_9_7},
-    {6, arcs_9_8},
-    {1, arcs_9_9},
-    {3, arcs_9_10},
-    {4, arcs_9_11},
-    {2, arcs_9_12},
-    {4, arcs_9_13},
-    {2, arcs_9_14},
-    {5, arcs_9_15},
-    {3, arcs_9_16},
-    {1, arcs_9_17},
-    {4, arcs_9_18},
-    {3, arcs_9_19},
-    {5, arcs_9_20},
-    {3, arcs_9_21},
-    {4, arcs_9_22},
-    {4, arcs_9_23},
-    {1, arcs_9_24},
-    {4, arcs_9_25},
-    {1, arcs_9_26},
-    {4, arcs_9_27},
-    {3, arcs_9_28},
-    {5, arcs_9_29},
-    {1, arcs_9_30},
-    {3, arcs_9_31},
-    {4, arcs_9_32},
-    {4, arcs_9_33},
-    {4, arcs_9_34},
-    {3, arcs_9_35},
-    {1, arcs_9_36},
-    {4, arcs_9_37},
-    {3, arcs_9_38},
-    {3, arcs_9_39},
-    {4, arcs_9_40},
-    {1, arcs_9_41},
-};
-static const arc arcs_10_0[1] = {
-    {40, 1},
-};
-static const arc arcs_10_1[2] = {
-    {57, 2},
-    {0, 1},
-};
-static const arc arcs_10_2[1] = {
-    {58, 3},
-};
-static const arc arcs_10_3[1] = {
-    {0, 3},
-};
-static state states_10[4] = {
-    {1, arcs_10_0},
-    {2, arcs_10_1},
-    {1, arcs_10_2},
-    {1, arcs_10_3},
-};
-static const arc arcs_11_0[3] = {
-    {6, 1},
-    {63, 2},
-    {69, 3},
-};
-static const arc arcs_11_1[3] = {
-    {65, 4},
-    {69, 5},
-    {0, 1},
-};
-static const arc arcs_11_2[1] = {
-    {69, 6},
-};
-static const arc arcs_11_3[3] = {
-    {65, 7},
-    {66, 8},
-    {0, 3},
-};
-static const arc arcs_11_4[3] = {
-    {63, 2},
-    {69, 9},
-    {0, 4},
-};
-static const arc arcs_11_5[2] = {
-    {65, 4},
-    {0, 5},
-};
-static const arc arcs_11_6[2] = {
-    {65, 10},
-    {0, 6},
-};
-static const arc arcs_11_7[5] = {
-    {6, 11},
-    {63, 2},
-    {67, 12},
-    {69, 3},
-    {0, 7},
-};
-static const arc arcs_11_8[1] = {
-    {58, 13},
-};
-static const arc arcs_11_9[3] = {
-    {65, 4},
-    {66, 14},
-    {0, 9},
-};
-static const arc arcs_11_10[1] = {
-    {0, 10},
-};
-static const arc arcs_11_11[3] = {
-    {65, 15},
-    {69, 16},
-    {0, 11},
-};
-static const arc arcs_11_12[2] = {
-    {65, 17},
-    {0, 12},
-};
-static const arc arcs_11_13[2] = {
-    {65, 7},
-    {0, 13},
-};
-static const arc arcs_11_14[1] = {
-    {58, 5},
-};
-static const arc arcs_11_15[3] = {
-    {63, 2},
-    {69, 18},
-    {0, 15},
-};
-static const arc arcs_11_16[2] = {
-    {65, 15},
-    {0, 16},
-};
-static const arc arcs_11_17[4] = {
-    {6, 19},
-    {63, 2},
-    {69, 20},
-    {0, 17},
-};
-static const arc arcs_11_18[3] = {
-    {65, 15},
-    {66, 21},
-    {0, 18},
-};
-static const arc arcs_11_19[3] = {
-    {65, 22},
-    {69, 23},
-    {0, 19},
-};
-static const arc arcs_11_20[3] = {
-    {65, 24},
-    {66, 25},
-    {0, 20},
-};
-static const arc arcs_11_21[1] = {
-    {58, 16},
-};
-static const arc arcs_11_22[3] = {
-    {63, 2},
-    {69, 26},
-    {0, 22},
-};
-static const arc arcs_11_23[2] = {
-    {65, 22},
-    {0, 23},
-};
-static const arc arcs_11_24[4] = {
-    {6, 27},
-    {63, 2},
-    {69, 20},
-    {0, 24},
-};
-static const arc arcs_11_25[1] = {
-    {58, 28},
-};
-static const arc arcs_11_26[3] = {
-    {65, 22},
-    {66, 29},
-    {0, 26},
-};
-static const arc arcs_11_27[3] = {
-    {65, 30},
-    {69, 31},
-    {0, 27},
-};
-static const arc arcs_11_28[2] = {
-    {65, 24},
-    {0, 28},
-};
-static const arc arcs_11_29[1] = {
-    {58, 23},
-};
-static const arc arcs_11_30[3] = {
-    {63, 2},
-    {69, 32},
-    {0, 30},
-};
-static const arc arcs_11_31[2] = {
-    {65, 30},
-    {0, 31},
-};
-static const arc arcs_11_32[3] = {
-    {65, 30},
-    {66, 33},
-    {0, 32},
-};
-static const arc arcs_11_33[1] = {
-    {58, 31},
-};
-static state states_11[34] = {
-    {3, arcs_11_0},
-    {3, arcs_11_1},
-    {1, arcs_11_2},
-    {3, arcs_11_3},
-    {3, arcs_11_4},
-    {2, arcs_11_5},
-    {2, arcs_11_6},
-    {5, arcs_11_7},
-    {1, arcs_11_8},
-    {3, arcs_11_9},
-    {1, arcs_11_10},
-    {3, arcs_11_11},
-    {2, arcs_11_12},
-    {2, arcs_11_13},
-    {1, arcs_11_14},
-    {3, arcs_11_15},
-    {2, arcs_11_16},
-    {4, arcs_11_17},
-    {3, arcs_11_18},
-    {3, arcs_11_19},
-    {3, arcs_11_20},
-    {1, arcs_11_21},
-    {3, arcs_11_22},
-    {2, arcs_11_23},
-    {4, arcs_11_24},
-    {1, arcs_11_25},
-    {3, arcs_11_26},
-    {3, arcs_11_27},
-    {2, arcs_11_28},
-    {1, arcs_11_29},
-    {3, arcs_11_30},
-    {2, arcs_11_31},
-    {3, arcs_11_32},
-    {1, arcs_11_33},
-};
-static const arc arcs_12_0[1] = {
-    {40, 1},
-};
-static const arc arcs_12_1[1] = {
-    {0, 1},
-};
-static state states_12[2] = {
-    {1, arcs_12_0},
-    {1, arcs_12_1},
-};
-static const arc arcs_13_0[2] = {
-    {3, 1},
-    {4, 1},
-};
-static const arc arcs_13_1[1] = {
-    {0, 1},
-};
-static state states_13[2] = {
-    {2, arcs_13_0},
-    {1, arcs_13_1},
-};
-static const arc arcs_14_0[1] = {
-    {70, 1},
-};
-static const arc arcs_14_1[2] = {
-    {71, 2},
-    {2, 3},
-};
-static const arc arcs_14_2[2] = {
-    {2, 3},
-    {70, 1},
-};
-static const arc arcs_14_3[1] = {
-    {0, 3},
-};
-static state states_14[4] = {
-    {1, arcs_14_0},
-    {2, arcs_14_1},
-    {2, arcs_14_2},
-    {1, arcs_14_3},
-};
-static const arc arcs_15_0[8] = {
-    {72, 1},
-    {73, 1},
-    {74, 1},
-    {75, 1},
-    {76, 1},
-    {77, 1},
-    {78, 1},
-    {79, 1},
-};
-static const arc arcs_15_1[1] = {
-    {0, 1},
-};
-static state states_15[2] = {
-    {8, arcs_15_0},
-    {1, arcs_15_1},
-};
-static const arc arcs_16_0[1] = {
-    {80, 1},
-};
-static const arc arcs_16_1[4] = {
-    {66, 2},
-    {81, 3},
-    {82, 4},
-    {0, 1},
-};
-static const arc arcs_16_2[2] = {
-    {80, 5},
-    {83, 5},
-};
-static const arc arcs_16_3[1] = {
-    {0, 3},
-};
-static const arc arcs_16_4[2] = {
-    {47, 3},
-    {83, 3},
-};
-static const arc arcs_16_5[3] = {
-    {66, 2},
-    {59, 3},
-    {0, 5},
-};
-static state states_16[6] = {
-    {1, arcs_16_0},
-    {4, arcs_16_1},
-    {2, arcs_16_2},
-    {1, arcs_16_3},
-    {2, arcs_16_4},
-    {3, arcs_16_5},
-};
-static const arc arcs_17_0[1] = {
-    {57, 1},
-};
-static const arc arcs_17_1[1] = {
-    {58, 2},
-};
-static const arc arcs_17_2[2] = {
-    {66, 3},
-    {0, 2},
-};
-static const arc arcs_17_3[2] = {
-    {80, 4},
-    {83, 4},
-};
-static const arc arcs_17_4[1] = {
-    {0, 4},
-};
-static state states_17[5] = {
-    {1, arcs_17_0},
-    {1, arcs_17_1},
-    {2, arcs_17_2},
-    {2, arcs_17_3},
-    {1, arcs_17_4},
-};
-static const arc arcs_18_0[2] = {
-    {84, 1},
-    {58, 1},
-};
-static const arc arcs_18_1[2] = {
-    {65, 2},
-    {0, 1},
-};
-static const arc arcs_18_2[3] = {
-    {84, 1},
-    {58, 1},
-    {0, 2},
-};
-static state states_18[3] = {
-    {2, arcs_18_0},
-    {2, arcs_18_1},
-    {3, arcs_18_2},
-};
-static const arc arcs_19_0[13] = {
-    {85, 1},
-    {86, 1},
-    {87, 1},
-    {88, 1},
-    {89, 1},
-    {90, 1},
-    {91, 1},
-    {92, 1},
-    {93, 1},
-    {94, 1},
-    {95, 1},
-    {96, 1},
-    {97, 1},
-};
-static const arc arcs_19_1[1] = {
-    {0, 1},
-};
-static state states_19[2] = {
-    {13, arcs_19_0},
-    {1, arcs_19_1},
-};
-static const arc arcs_20_0[1] = {
-    {20, 1},
-};
-static const arc arcs_20_1[1] = {
-    {98, 2},
-};
-static const arc arcs_20_2[1] = {
-    {0, 2},
-};
-static state states_20[3] = {
-    {1, arcs_20_0},
-    {1, arcs_20_1},
-    {1, arcs_20_2},
-};
-static const arc arcs_21_0[1] = {
-    {29, 1},
-};
-static const arc arcs_21_1[1] = {
-    {0, 1},
-};
-static state states_21[2] = {
-    {1, arcs_21_0},
-    {1, arcs_21_1},
-};
-static const arc arcs_22_0[5] = {
-    {99, 1},
-    {100, 1},
-    {101, 1},
-    {102, 1},
-    {103, 1},
-};
-static const arc arcs_22_1[1] = {
-    {0, 1},
-};
-static state states_22[2] = {
-    {5, arcs_22_0},
-    {1, arcs_22_1},
-};
-static const arc arcs_23_0[1] = {
-    {16, 1},
-};
-static const arc arcs_23_1[1] = {
-    {0, 1},
-};
-static state states_23[2] = {
-    {1, arcs_23_0},
-    {1, arcs_23_1},
-};
-static const arc arcs_24_0[1] = {
-    {18, 1},
-};
-static const arc arcs_24_1[1] = {
-    {0, 1},
-};
-static state states_24[2] = {
-    {1, arcs_24_0},
-    {1, arcs_24_1},
-};
-static const arc arcs_25_0[1] = {
-    {31, 1},
-};
-static const arc arcs_25_1[2] = {
-    {80, 2},
-    {0, 1},
-};
-static const arc arcs_25_2[1] = {
-    {0, 2},
-};
-static state states_25[3] = {
-    {1, arcs_25_0},
-    {2, arcs_25_1},
-    {1, arcs_25_2},
-};
-static const arc arcs_26_0[1] = {
-    {83, 1},
-};
-static const arc arcs_26_1[1] = {
-    {0, 1},
-};
-static state states_26[2] = {
-    {1, arcs_26_0},
-    {1, arcs_26_1},
-};
-static const arc arcs_27_0[1] = {
-    {30, 1},
-};
-static const arc arcs_27_1[2] = {
-    {58, 2},
-    {0, 1},
-};
-static const arc arcs_27_2[2] = {
-    {22, 3},
-    {0, 2},
-};
-static const arc arcs_27_3[1] = {
-    {58, 4},
-};
-static const arc arcs_27_4[1] = {
-    {0, 4},
-};
-static state states_27[5] = {
-    {1, arcs_27_0},
-    {2, arcs_27_1},
-    {2, arcs_27_2},
-    {1, arcs_27_3},
-    {1, arcs_27_4},
-};
-static const arc arcs_28_0[2] = {
-    {104, 1},
-    {105, 1},
-};
-static const arc arcs_28_1[1] = {
-    {0, 1},
-};
-static state states_28[2] = {
-    {2, arcs_28_0},
-    {1, arcs_28_1},
-};
-static const arc arcs_29_0[1] = {
-    {25, 1},
-};
-static const arc arcs_29_1[1] = {
-    {106, 2},
-};
-static const arc arcs_29_2[1] = {
-    {0, 2},
-};
-static state states_29[3] = {
-    {1, arcs_29_0},
-    {1, arcs_29_1},
-    {1, arcs_29_2},
-};
-static const arc arcs_30_0[1] = {
-    {22, 1},
-};
-static const arc arcs_30_1[3] = {
-    {107, 2},
-    {9, 2},
-    {108, 3},
-};
-static const arc arcs_30_2[4] = {
-    {107, 2},
-    {9, 2},
-    {25, 4},
-    {108, 3},
-};
-static const arc arcs_30_3[1] = {
-    {25, 4},
-};
-static const arc arcs_30_4[3] = {
-    {5, 5},
-    {6, 6},
-    {109, 6},
-};
-static const arc arcs_30_5[1] = {
-    {109, 7},
-};
-static const arc arcs_30_6[1] = {
-    {0, 6},
-};
-static const arc arcs_30_7[1] = {
-    {61, 6},
-};
-static state states_30[8] = {
-    {1, arcs_30_0},
-    {3, arcs_30_1},
-    {4, arcs_30_2},
-    {1, arcs_30_3},
-    {3, arcs_30_4},
-    {1, arcs_30_5},
-    {1, arcs_30_6},
-    {1, arcs_30_7},
-};
-static const arc arcs_31_0[1] = {
-    {40, 1},
-};
-static const arc arcs_31_1[2] = {
-    {111, 2},
-    {0, 1},
-};
-static const arc arcs_31_2[1] = {
-    {40, 3},
-};
-static const arc arcs_31_3[1] = {
-    {0, 3},
-};
-static state states_31[4] = {
-    {1, arcs_31_0},
-    {2, arcs_31_1},
-    {1, arcs_31_2},
-    {1, arcs_31_3},
-};
-static const arc arcs_32_0[1] = {
-    {108, 1},
-};
-static const arc arcs_32_1[2] = {
-    {111, 2},
-    {0, 1},
-};
-static const arc arcs_32_2[1] = {
-    {40, 3},
-};
-static const arc arcs_32_3[1] = {
-    {0, 3},
-};
-static state states_32[4] = {
-    {1, arcs_32_0},
-    {2, arcs_32_1},
-    {1, arcs_32_2},
-    {1, arcs_32_3},
-};
-static const arc arcs_33_0[1] = {
-    {110, 1},
-};
-static const arc arcs_33_1[2] = {
-    {65, 2},
-    {0, 1},
-};
-static const arc arcs_33_2[2] = {
-    {110, 1},
-    {0, 2},
-};
-static state states_33[3] = {
-    {1, arcs_33_0},
-    {2, arcs_33_1},
-    {2, arcs_33_2},
-};
-static const arc arcs_34_0[1] = {
-    {112, 1},
-};
-static const arc arcs_34_1[2] = {
-    {65, 0},
-    {0, 1},
-};
-static state states_34[2] = {
-    {1, arcs_34_0},
-    {2, arcs_34_1},
-};
-static const arc arcs_35_0[1] = {
-    {40, 1},
-};
-static const arc arcs_35_1[2] = {
-    {107, 0},
-    {0, 1},
-};
-static state states_35[2] = {
-    {1, arcs_35_0},
-    {2, arcs_35_1},
-};
-static const arc arcs_36_0[1] = {
-    {23, 1},
-};
-static const arc arcs_36_1[1] = {
-    {40, 2},
-};
-static const arc arcs_36_2[2] = {
-    {65, 1},
-    {0, 2},
-};
-static state states_36[3] = {
-    {1, arcs_36_0},
-    {1, arcs_36_1},
-    {2, arcs_36_2},
-};
-static const arc arcs_37_0[1] = {
-    {27, 1},
-};
-static const arc arcs_37_1[1] = {
-    {40, 2},
-};
-static const arc arcs_37_2[2] = {
-    {65, 1},
-    {0, 2},
-};
-static state states_37[3] = {
-    {1, arcs_37_0},
-    {1, arcs_37_1},
-    {2, arcs_37_2},
-};
-static const arc arcs_38_0[1] = {
-    {15, 1},
-};
-static const arc arcs_38_1[1] = {
-    {58, 2},
-};
-static const arc arcs_38_2[2] = {
-    {65, 3},
-    {0, 2},
-};
-static const arc arcs_38_3[1] = {
-    {58, 4},
-};
-static const arc arcs_38_4[1] = {
-    {0, 4},
-};
-static state states_38[5] = {
-    {1, arcs_38_0},
-    {1, arcs_38_1},
-    {2, arcs_38_2},
-    {1, arcs_38_3},
-    {1, arcs_38_4},
-};
-static const arc arcs_39_0[9] = {
-    {113, 1},
-    {53, 1},
-    {51, 1},
-    {114, 1},
-    {54, 1},
-    {115, 1},
-    {116, 1},
-    {117, 1},
-    {118, 1},
-};
-static const arc arcs_39_1[1] = {
-    {0, 1},
-};
-static state states_39[2] = {
-    {9, arcs_39_0},
-    {1, arcs_39_1},
-};
-static const arc arcs_40_0[1] = {
-    {38, 1},
-};
-static const arc arcs_40_1[3] = {
-    {114, 2},
-    {54, 2},
-    {118, 2},
-};
-static const arc arcs_40_2[1] = {
-    {0, 2},
-};
-static state states_40[3] = {
-    {1, arcs_40_0},
-    {3, arcs_40_1},
-    {1, arcs_40_2},
-};
-static const arc arcs_41_0[1] = {
-    {24, 1},
-};
-static const arc arcs_41_1[1] = {
-    {49, 2},
-};
-static const arc arcs_41_2[1] = {
-    {57, 3},
-};
-static const arc arcs_41_3[1] = {
-    {119, 4},
-};
-static const arc arcs_41_4[3] = {
-    {120, 1},
-    {121, 5},
-    {0, 4},
-};
-static const arc arcs_41_5[1] = {
-    {57, 6},
-};
-static const arc arcs_41_6[1] = {
-    {119, 7},
-};
-static const arc arcs_41_7[1] = {
-    {0, 7},
-};
-static state states_41[8] = {
-    {1, arcs_41_0},
-    {1, arcs_41_1},
-    {1, arcs_41_2},
-    {1, arcs_41_3},
-    {3, arcs_41_4},
-    {1, arcs_41_5},
-    {1, arcs_41_6},
-    {1, arcs_41_7},
-};
-static const arc arcs_42_0[1] = {
-    {33, 1},
-};
-static const arc arcs_42_1[1] = {
-    {49, 2},
-};
-static const arc arcs_42_2[1] = {
-    {57, 3},
-};
-static const arc arcs_42_3[1] = {
-    {119, 4},
-};
-static const arc arcs_42_4[2] = {
-    {121, 5},
-    {0, 4},
-};
-static const arc arcs_42_5[1] = {
-    {57, 6},
-};
-static const arc arcs_42_6[1] = {
-    {119, 7},
-};
-static const arc arcs_42_7[1] = {
-    {0, 7},
-};
-static state states_42[8] = {
-    {1, arcs_42_0},
-    {1, arcs_42_1},
-    {1, arcs_42_2},
-    {1, arcs_42_3},
-    {2, arcs_42_4},
-    {1, arcs_42_5},
-    {1, arcs_42_6},
-    {1, arcs_42_7},
-};
-static const arc arcs_43_0[1] = {
-    {21, 1},
-};
-static const arc arcs_43_1[1] = {
-    {98, 2},
-};
-static const arc arcs_43_2[1] = {
-    {122, 3},
-};
-static const arc arcs_43_3[1] = {
-    {47, 4},
-};
-static const arc arcs_43_4[1] = {
-    {57, 5},
-};
-static const arc arcs_43_5[2] = {
-    {59, 6},
-    {119, 7},
-};
-static const arc arcs_43_6[1] = {
-    {119, 7},
-};
-static const arc arcs_43_7[2] = {
-    {121, 8},
-    {0, 7},
-};
-static const arc arcs_43_8[1] = {
-    {57, 9},
-};
-static const arc arcs_43_9[1] = {
-    {119, 10},
-};
-static const arc arcs_43_10[1] = {
-    {0, 10},
-};
-static state states_43[11] = {
-    {1, arcs_43_0},
-    {1, arcs_43_1},
-    {1, arcs_43_2},
-    {1, arcs_43_3},
-    {1, arcs_43_4},
-    {2, arcs_43_5},
-    {1, arcs_43_6},
-    {2, arcs_43_7},
-    {1, arcs_43_8},
-    {1, arcs_43_9},
-    {1, arcs_43_10},
-};
-static const arc arcs_44_0[1] = {
-    {32, 1},
-};
-static const arc arcs_44_1[1] = {
-    {57, 2},
-};
-static const arc arcs_44_2[1] = {
-    {119, 3},
-};
-static const arc arcs_44_3[2] = {
-    {123, 4},
-    {124, 5},
-};
-static const arc arcs_44_4[1] = {
-    {57, 6},
-};
-static const arc arcs_44_5[1] = {
-    {57, 7},
-};
-static const arc arcs_44_6[1] = {
-    {119, 8},
-};
-static const arc arcs_44_7[1] = {
-    {119, 9},
-};
-static const arc arcs_44_8[1] = {
-    {0, 8},
-};
-static const arc arcs_44_9[4] = {
-    {121, 10},
-    {123, 4},
-    {124, 5},
-    {0, 9},
-};
-static const arc arcs_44_10[1] = {
-    {57, 11},
-};
-static const arc arcs_44_11[1] = {
-    {119, 12},
-};
-static const arc arcs_44_12[2] = {
-    {123, 4},
-    {0, 12},
-};
-static state states_44[13] = {
-    {1, arcs_44_0},
-    {1, arcs_44_1},
-    {1, arcs_44_2},
-    {2, arcs_44_3},
-    {1, arcs_44_4},
-    {1, arcs_44_5},
-    {1, arcs_44_6},
-    {1, arcs_44_7},
-    {1, arcs_44_8},
-    {4, arcs_44_9},
-    {1, arcs_44_10},
-    {1, arcs_44_11},
-    {2, arcs_44_12},
-};
-static const arc arcs_45_0[1] = {
-    {34, 1},
-};
-static const arc arcs_45_1[1] = {
-    {125, 2},
-};
-static const arc arcs_45_2[2] = {
-    {65, 1},
-    {57, 3},
-};
-static const arc arcs_45_3[2] = {
-    {59, 4},
-    {119, 5},
-};
-static const arc arcs_45_4[1] = {
-    {119, 5},
-};
-static const arc arcs_45_5[1] = {
-    {0, 5},
-};
-static state states_45[6] = {
-    {1, arcs_45_0},
-    {1, arcs_45_1},
-    {2, arcs_45_2},
-    {2, arcs_45_3},
-    {1, arcs_45_4},
-    {1, arcs_45_5},
-};
-static const arc arcs_46_0[1] = {
-    {58, 1},
-};
-static const arc arcs_46_1[2] = {
-    {111, 2},
-    {0, 1},
-};
-static const arc arcs_46_2[1] = {
-    {126, 3},
-};
-static const arc arcs_46_3[1] = {
-    {0, 3},
-};
-static state states_46[4] = {
-    {1, arcs_46_0},
-    {2, arcs_46_1},
-    {1, arcs_46_2},
-    {1, arcs_46_3},
-};
-static const arc arcs_47_0[1] = {
-    {127, 1},
-};
-static const arc arcs_47_1[2] = {
-    {58, 2},
-    {0, 1},
-};
-static const arc arcs_47_2[2] = {
-    {111, 3},
-    {0, 2},
-};
-static const arc arcs_47_3[1] = {
-    {40, 4},
-};
-static const arc arcs_47_4[1] = {
-    {0, 4},
-};
-static state states_47[5] = {
-    {1, arcs_47_0},
-    {2, arcs_47_1},
-    {2, arcs_47_2},
-    {1, arcs_47_3},
-    {1, arcs_47_4},
-};
-static const arc arcs_48_0[2] = {
-    {2, 1},
-    {4, 2},
-};
-static const arc arcs_48_1[1] = {
-    {128, 3},
-};
-static const arc arcs_48_2[1] = {
-    {0, 2},
-};
-static const arc arcs_48_3[1] = {
-    {45, 4},
-};
-static const arc arcs_48_4[2] = {
-    {129, 2},
-    {45, 4},
-};
-static state states_48[5] = {
-    {2, arcs_48_0},
-    {1, arcs_48_1},
-    {1, arcs_48_2},
-    {1, arcs_48_3},
-    {2, arcs_48_4},
-};
-static const arc arcs_49_0[1] = {
-    {58, 1},
-};
-static const arc arcs_49_1[2] = {
-    {130, 2},
-    {0, 1},
-};
-static const arc arcs_49_2[1] = {
-    {58, 3},
-};
-static const arc arcs_49_3[1] = {
-    {0, 3},
-};
-static state states_49[4] = {
-    {1, arcs_49_0},
-    {2, arcs_49_1},
-    {1, arcs_49_2},
-    {1, arcs_49_3},
-};
-static const arc arcs_50_0[2] = {
-    {131, 1},
-    {132, 2},
-};
-static const arc arcs_50_1[1] = {
-    {0, 1},
-};
-static const arc arcs_50_2[2] = {
-    {24, 3},
-    {0, 2},
-};
-static const arc arcs_50_3[1] = {
-    {132, 4},
-};
-static const arc arcs_50_4[1] = {
-    {121, 5},
-};
-static const arc arcs_50_5[1] = {
-    {58, 1},
-};
-static state states_50[6] = {
-    {2, arcs_50_0},
-    {1, arcs_50_1},
-    {2, arcs_50_2},
-    {1, arcs_50_3},
-    {1, arcs_50_4},
-    {1, arcs_50_5},
-};
-static const arc arcs_51_0[2] = {
-    {134, 1},
-    {132, 1},
-};
-static const arc arcs_51_1[1] = {
-    {0, 1},
-};
-static state states_51[2] = {
-    {2, arcs_51_0},
-    {1, arcs_51_1},
-};
-static const arc arcs_52_0[1] = {
-    {26, 1},
-};
-static const arc arcs_52_1[2] = {
-    {57, 2},
-    {68, 3},
-};
-static const arc arcs_52_2[1] = {
-    {58, 4},
-};
-static const arc arcs_52_3[1] = {
-    {57, 2},
-};
-static const arc arcs_52_4[1] = {
-    {0, 4},
-};
-static state states_52[5] = {
-    {1, arcs_52_0},
-    {2, arcs_52_1},
-    {1, arcs_52_2},
-    {1, arcs_52_3},
-    {1, arcs_52_4},
-};
-static const arc arcs_53_0[1] = {
-    {26, 1},
-};
-static const arc arcs_53_1[2] = {
-    {57, 2},
-    {68, 3},
-};
-static const arc arcs_53_2[1] = {
-    {133, 4},
-};
-static const arc arcs_53_3[1] = {
-    {57, 2},
-};
-static const arc arcs_53_4[1] = {
-    {0, 4},
-};
-static state states_53[5] = {
-    {1, arcs_53_0},
-    {2, arcs_53_1},
-    {1, arcs_53_2},
-    {1, arcs_53_3},
-    {1, arcs_53_4},
-};
-static const arc arcs_54_0[1] = {
-    {135, 1},
-};
-static const arc arcs_54_1[2] = {
-    {136, 0},
-    {0, 1},
-};
-static state states_54[2] = {
-    {1, arcs_54_0},
-    {2, arcs_54_1},
-};
-static const arc arcs_55_0[1] = {
-    {137, 1},
-};
-static const arc arcs_55_1[2] = {
-    {138, 0},
-    {0, 1},
-};
-static state states_55[2] = {
-    {1, arcs_55_0},
-    {2, arcs_55_1},
-};
-static const arc arcs_56_0[2] = {
-    {28, 1},
-    {139, 2},
-};
-static const arc arcs_56_1[1] = {
-    {137, 2},
-};
-static const arc arcs_56_2[1] = {
-    {0, 2},
-};
-static state states_56[3] = {
-    {2, arcs_56_0},
-    {1, arcs_56_1},
-    {1, arcs_56_2},
-};
-static const arc arcs_57_0[1] = {
-    {126, 1},
-};
-static const arc arcs_57_1[2] = {
-    {140, 0},
-    {0, 1},
-};
-static state states_57[2] = {
-    {1, arcs_57_0},
-    {2, arcs_57_1},
-};
-static const arc arcs_58_0[10] = {
-    {141, 1},
-    {142, 1},
-    {143, 1},
-    {141, 1},
-    {144, 1},
-    {145, 1},
-    {146, 1},
-    {122, 1},
-    {147, 2},
-    {28, 3},
-};
-static const arc arcs_58_1[1] = {
-    {0, 1},
-};
-static const arc arcs_58_2[2] = {
-    {28, 1},
-    {0, 2},
-};
-static const arc arcs_58_3[1] = {
-    {122, 1},
-};
-static state states_58[4] = {
-    {10, arcs_58_0},
-    {1, arcs_58_1},
-    {2, arcs_58_2},
-    {1, arcs_58_3},
-};
-static const arc arcs_59_0[1] = {
-    {6, 1},
-};
-static const arc arcs_59_1[1] = {
-    {126, 2},
-};
-static const arc arcs_59_2[1] = {
-    {0, 2},
-};
-static state states_59[3] = {
-    {1, arcs_59_0},
-    {1, arcs_59_1},
-    {1, arcs_59_2},
-};
-static const arc arcs_60_0[1] = {
-    {148, 1},
-};
-static const arc arcs_60_1[2] = {
-    {149, 0},
-    {0, 1},
-};
-static state states_60[2] = {
-    {1, arcs_60_0},
-    {2, arcs_60_1},
-};
-static const arc arcs_61_0[1] = {
-    {150, 1},
-};
-static const arc arcs_61_1[2] = {
-    {151, 0},
-    {0, 1},
-};
-static state states_61[2] = {
-    {1, arcs_61_0},
-    {2, arcs_61_1},
-};
-static const arc arcs_62_0[1] = {
-    {152, 1},
-};
-static const arc arcs_62_1[2] = {
-    {153, 0},
-    {0, 1},
-};
-static state states_62[2] = {
-    {1, arcs_62_0},
-    {2, arcs_62_1},
-};
-static const arc arcs_63_0[1] = {
-    {154, 1},
-};
-static const arc arcs_63_1[3] = {
-    {155, 0},
-    {156, 0},
-    {0, 1},
-};
-static state states_63[2] = {
-    {1, arcs_63_0},
-    {3, arcs_63_1},
-};
-static const arc arcs_64_0[1] = {
-    {157, 1},
-};
-static const arc arcs_64_1[3] = {
-    {7, 0},
-    {8, 0},
-    {0, 1},
-};
-static state states_64[2] = {
-    {1, arcs_64_0},
-    {3, arcs_64_1},
-};
-static const arc arcs_65_0[1] = {
-    {158, 1},
-};
-static const arc arcs_65_1[6] = {
-    {159, 0},
-    {6, 0},
-    {67, 0},
-    {160, 0},
-    {10, 0},
-    {0, 1},
-};
-static state states_65[2] = {
-    {1, arcs_65_0},
-    {6, arcs_65_1},
-};
-static const arc arcs_66_0[4] = {
-    {7, 1},
-    {8, 1},
-    {37, 1},
-    {161, 2},
-};
-static const arc arcs_66_1[1] = {
-    {158, 2},
-};
-static const arc arcs_66_2[1] = {
-    {0, 2},
-};
-static state states_66[3] = {
-    {4, arcs_66_0},
-    {1, arcs_66_1},
-    {1, arcs_66_2},
-};
-static const arc arcs_67_0[1] = {
-    {162, 1},
-};
-static const arc arcs_67_1[2] = {
-    {63, 2},
-    {0, 1},
-};
-static const arc arcs_67_2[1] = {
-    {158, 3},
-};
-static const arc arcs_67_3[1] = {
-    {0, 3},
-};
-static state states_67[4] = {
-    {1, arcs_67_0},
-    {2, arcs_67_1},
-    {1, arcs_67_2},
-    {1, arcs_67_3},
-};
-static const arc arcs_68_0[2] = {
-    {39, 1},
-    {163, 2},
-};
-static const arc arcs_68_1[1] = {
-    {163, 2},
-};
-static const arc arcs_68_2[2] = {
-    {164, 2},
-    {0, 2},
-};
-static state states_68[3] = {
-    {2, arcs_68_0},
-    {1, arcs_68_1},
-    {2, arcs_68_2},
-};
-static const arc arcs_69_0[10] = {
-    {5, 1},
-    {9, 2},
-    {11, 2},
-    {12, 2},
-    {13, 2},
-    {14, 3},
-    {36, 4},
-    {40, 2},
-    {41, 2},
-    {42, 5},
-};
-static const arc arcs_69_1[3] = {
-    {61, 2},
-    {165, 6},
-    {83, 6},
-};
-static const arc arcs_69_2[1] = {
-    {0, 2},
-};
-static const arc arcs_69_3[2] = {
-    {166, 2},
-    {165, 7},
-};
-static const arc arcs_69_4[2] = {
-    {167, 2},
-    {168, 8},
-};
-static const arc arcs_69_5[2] = {
-    {42, 5},
-    {0, 5},
-};
-static const arc arcs_69_6[1] = {
-    {61, 2},
-};
-static const arc arcs_69_7[1] = {
-    {166, 2},
-};
-static const arc arcs_69_8[1] = {
-    {167, 2},
-};
-static state states_69[9] = {
-    {10, arcs_69_0},
-    {3, arcs_69_1},
-    {1, arcs_69_2},
-    {2, arcs_69_3},
-    {2, arcs_69_4},
-    {2, arcs_69_5},
-    {1, arcs_69_6},
-    {1, arcs_69_7},
-    {1, arcs_69_8},
-};
-static const arc arcs_70_0[2] = {
-    {49, 1},
-    {84, 1},
-};
-static const arc arcs_70_1[3] = {
-    {65, 2},
-    {169, 3},
-    {0, 1},
-};
-static const arc arcs_70_2[3] = {
-    {49, 4},
-    {84, 4},
-    {0, 2},
-};
-static const arc arcs_70_3[1] = {
-    {0, 3},
-};
-static const arc arcs_70_4[2] = {
-    {65, 2},
-    {0, 4},
-};
-static state states_70[5] = {
-    {2, arcs_70_0},
-    {3, arcs_70_1},
-    {3, arcs_70_2},
-    {1, arcs_70_3},
-    {2, arcs_70_4},
-};
-static const arc arcs_71_0[3] = {
-    {5, 1},
-    {107, 2},
-    {14, 3},
-};
-static const arc arcs_71_1[2] = {
-    {61, 4},
-    {170, 5},
-};
-static const arc arcs_71_2[1] = {
-    {40, 4},
-};
-static const arc arcs_71_3[1] = {
-    {171, 6},
-};
-static const arc arcs_71_4[1] = {
-    {0, 4},
-};
-static const arc arcs_71_5[1] = {
-    {61, 4},
-};
-static const arc arcs_71_6[1] = {
-    {166, 4},
-};
-static state states_71[7] = {
-    {3, arcs_71_0},
-    {2, arcs_71_1},
-    {1, arcs_71_2},
-    {1, arcs_71_3},
-    {1, arcs_71_4},
-    {1, arcs_71_5},
-    {1, arcs_71_6},
-};
-static const arc arcs_72_0[1] = {
-    {172, 1},
-};
-static const arc arcs_72_1[2] = {
-    {65, 2},
-    {0, 1},
-};
-static const arc arcs_72_2[2] = {
-    {172, 1},
-    {0, 2},
-};
-static state states_72[3] = {
-    {1, arcs_72_0},
-    {2, arcs_72_1},
-    {2, arcs_72_2},
-};
-static const arc arcs_73_0[2] = {
-    {57, 1},
-    {58, 2},
-};
-static const arc arcs_73_1[3] = {
-    {173, 3},
-    {58, 4},
-    {0, 1},
-};
-static const arc arcs_73_2[2] = {
-    {57, 1},
-    {0, 2},
-};
-static const arc arcs_73_3[1] = {
-    {0, 3},
-};
-static const arc arcs_73_4[2] = {
-    {173, 3},
-    {0, 4},
-};
-static state states_73[5] = {
-    {2, arcs_73_0},
-    {3, arcs_73_1},
-    {2, arcs_73_2},
-    {1, arcs_73_3},
-    {2, arcs_73_4},
-};
-static const arc arcs_74_0[1] = {
-    {57, 1},
-};
-static const arc arcs_74_1[2] = {
-    {58, 2},
-    {0, 1},
-};
-static const arc arcs_74_2[1] = {
-    {0, 2},
-};
-static state states_74[3] = {
-    {1, arcs_74_0},
-    {2, arcs_74_1},
-    {1, arcs_74_2},
-};
-static const arc arcs_75_0[2] = {
-    {126, 1},
-    {84, 1},
-};
-static const arc arcs_75_1[2] = {
-    {65, 2},
-    {0, 1},
-};
-static const arc arcs_75_2[3] = {
-    {126, 1},
-    {84, 1},
-    {0, 2},
-};
-static state states_75[3] = {
-    {2, arcs_75_0},
-    {2, arcs_75_1},
-    {3, arcs_75_2},
-};
-static const arc arcs_76_0[1] = {
-    {58, 1},
-};
-static const arc arcs_76_1[2] = {
-    {65, 2},
-    {0, 1},
-};
-static const arc arcs_76_2[2] = {
-    {58, 1},
-    {0, 2},
-};
-static state states_76[3] = {
-    {1, arcs_76_0},
-    {2, arcs_76_1},
-    {2, arcs_76_2},
-};
-static const arc arcs_77_0[3] = {
-    {63, 1},
-    {84, 2},
-    {58, 3},
-};
-static const arc arcs_77_1[1] = {
-    {126, 4},
-};
-static const arc arcs_77_2[3] = {
-    {65, 5},
-    {169, 6},
-    {0, 2},
-};
-static const arc arcs_77_3[4] = {
-    {65, 5},
-    {57, 7},
-    {169, 6},
-    {0, 3},
-};
-static const arc arcs_77_4[3] = {
-    {65, 8},
-    {169, 6},
-    {0, 4},
-};
-static const arc arcs_77_5[3] = {
-    {84, 9},
-    {58, 9},
-    {0, 5},
-};
-static const arc arcs_77_6[1] = {
-    {0, 6},
-};
-static const arc arcs_77_7[1] = {
-    {58, 4},
-};
-static const arc arcs_77_8[3] = {
-    {63, 10},
-    {58, 11},
-    {0, 8},
-};
-static const arc arcs_77_9[2] = {
-    {65, 5},
-    {0, 9},
-};
-static const arc arcs_77_10[1] = {
-    {126, 12},
-};
-static const arc arcs_77_11[1] = {
-    {57, 13},
-};
-static const arc arcs_77_12[2] = {
-    {65, 8},
-    {0, 12},
-};
-static const arc arcs_77_13[1] = {
-    {58, 12},
-};
-static state states_77[14] = {
-    {3, arcs_77_0},
-    {1, arcs_77_1},
-    {3, arcs_77_2},
-    {4, arcs_77_3},
-    {3, arcs_77_4},
-    {3, arcs_77_5},
-    {1, arcs_77_6},
-    {1, arcs_77_7},
-    {3, arcs_77_8},
-    {2, arcs_77_9},
-    {1, arcs_77_10},
-    {1, arcs_77_11},
-    {2, arcs_77_12},
-    {1, arcs_77_13},
-};
-static const arc arcs_78_0[1] = {
-    {17, 1},
-};
-static const arc arcs_78_1[1] = {
-    {40, 2},
-};
-static const arc arcs_78_2[2] = {
-    {5, 3},
-    {57, 4},
-};
-static const arc arcs_78_3[2] = {
-    {61, 5},
-    {170, 6},
-};
-static const arc arcs_78_4[1] = {
-    {119, 7},
-};
-static const arc arcs_78_5[1] = {
-    {57, 4},
-};
-static const arc arcs_78_6[1] = {
-    {61, 5},
-};
-static const arc arcs_78_7[1] = {
-    {0, 7},
-};
-static state states_78[8] = {
-    {1, arcs_78_0},
-    {1, arcs_78_1},
-    {2, arcs_78_2},
-    {2, arcs_78_3},
-    {1, arcs_78_4},
-    {1, arcs_78_5},
-    {1, arcs_78_6},
-    {1, arcs_78_7},
-};
-static const arc arcs_79_0[1] = {
-    {174, 1},
-};
-static const arc arcs_79_1[2] = {
-    {65, 2},
-    {0, 1},
-};
-static const arc arcs_79_2[2] = {
-    {174, 1},
-    {0, 2},
-};
-static state states_79[3] = {
-    {1, arcs_79_0},
-    {2, arcs_79_1},
-    {2, arcs_79_2},
-};
-static const arc arcs_80_0[3] = {
-    {6, 1},
-    {63, 1},
-    {58, 2},
-};
-static const arc arcs_80_1[1] = {
-    {58, 3},
-};
-static const arc arcs_80_2[4] = {
-    {130, 1},
-    {66, 1},
-    {169, 3},
-    {0, 2},
-};
-static const arc arcs_80_3[1] = {
-    {0, 3},
-};
-static state states_80[4] = {
-    {3, arcs_80_0},
-    {1, arcs_80_1},
-    {4, arcs_80_2},
-    {1, arcs_80_3},
-};
-static const arc arcs_81_0[2] = {
-    {169, 1},
-    {176, 1},
-};
-static const arc arcs_81_1[1] = {
-    {0, 1},
-};
-static state states_81[2] = {
-    {2, arcs_81_0},
-    {1, arcs_81_1},
-};
-static const arc arcs_82_0[1] = {
-    {21, 1},
-};
-static const arc arcs_82_1[1] = {
-    {98, 2},
-};
-static const arc arcs_82_2[1] = {
-    {122, 3},
-};
-static const arc arcs_82_3[1] = {
-    {132, 4},
-};
-static const arc arcs_82_4[2] = {
-    {175, 5},
-    {0, 4},
-};
-static const arc arcs_82_5[1] = {
-    {0, 5},
-};
-static state states_82[6] = {
-    {1, arcs_82_0},
-    {1, arcs_82_1},
-    {1, arcs_82_2},
-    {1, arcs_82_3},
-    {2, arcs_82_4},
-    {1, arcs_82_5},
-};
-static const arc arcs_83_0[2] = {
-    {38, 1},
-    {177, 2},
-};
-static const arc arcs_83_1[1] = {
-    {177, 2},
-};
-static const arc arcs_83_2[1] = {
-    {0, 2},
-};
-static state states_83[3] = {
-    {2, arcs_83_0},
-    {1, arcs_83_1},
-    {1, arcs_83_2},
-};
-static const arc arcs_84_0[1] = {
-    {24, 1},
-};
-static const arc arcs_84_1[1] = {
-    {133, 2},
-};
-static const arc arcs_84_2[2] = {
-    {175, 3},
-    {0, 2},
-};
-static const arc arcs_84_3[1] = {
-    {0, 3},
-};
-static state states_84[4] = {
-    {1, arcs_84_0},
-    {1, arcs_84_1},
-    {2, arcs_84_2},
-    {1, arcs_84_3},
-};
-static const arc arcs_85_0[1] = {
-    {40, 1},
-};
-static const arc arcs_85_1[1] = {
-    {0, 1},
-};
-static state states_85[2] = {
-    {1, arcs_85_0},
-    {1, arcs_85_1},
-};
-static const arc arcs_86_0[1] = {
-    {35, 1},
-};
-static const arc arcs_86_1[2] = {
-    {179, 2},
-    {0, 1},
-};
-static const arc arcs_86_2[1] = {
-    {0, 2},
-};
-static state states_86[3] = {
-    {1, arcs_86_0},
-    {2, arcs_86_1},
-    {1, arcs_86_2},
-};
-static const arc arcs_87_0[2] = {
-    {22, 1},
-    {80, 2},
-};
-static const arc arcs_87_1[1] = {
-    {58, 2},
-};
-static const arc arcs_87_2[1] = {
-    {0, 2},
-};
-static state states_87[3] = {
-    {2, arcs_87_0},
-    {1, arcs_87_1},
-    {1, arcs_87_2},
-};
-static const arc arcs_88_0[2] = {
-    {2, 1},
-    {4, 2},
-};
-static const arc arcs_88_1[2] = {
-    {128, 3},
-    {59, 4},
-};
-static const arc arcs_88_2[1] = {
-    {0, 2},
-};
-static const arc arcs_88_3[1] = {
-    {45, 5},
-};
-static const arc arcs_88_4[1] = {
-    {2, 6},
-};
-static const arc arcs_88_5[2] = {
-    {129, 2},
-    {45, 5},
-};
-static const arc arcs_88_6[1] = {
-    {128, 3},
-};
-static state states_88[7] = {
-    {2, arcs_88_0},
-    {2, arcs_88_1},
-    {1, arcs_88_2},
-    {1, arcs_88_3},
-    {1, arcs_88_4},
-    {2, arcs_88_5},
-    {1, arcs_88_6},
-};
-static const arc arcs_89_0[1] = {
-    {181, 1},
-};
-static const arc arcs_89_1[2] = {
-    {44, 2},
-    {2, 1},
-};
-static const arc arcs_89_2[1] = {
-    {0, 2},
-};
-static state states_89[3] = {
-    {1, arcs_89_0},
-    {2, arcs_89_1},
-    {1, arcs_89_2},
-};
-static const arc arcs_90_0[1] = {
-    {5, 1},
-};
-static const arc arcs_90_1[2] = {
-    {61, 2},
-    {182, 3},
-};
-static const arc arcs_90_2[1] = {
-    {56, 4},
-};
-static const arc arcs_90_3[1] = {
-    {61, 2},
-};
-static const arc arcs_90_4[1] = {
-    {58, 5},
-};
-static const arc arcs_90_5[1] = {
-    {0, 5},
-};
-static state states_90[6] = {
-    {1, arcs_90_0},
-    {2, arcs_90_1},
-    {1, arcs_90_2},
-    {1, arcs_90_3},
-    {1, arcs_90_4},
-    {1, arcs_90_5},
-};
-static const arc arcs_91_0[3] = {
-    {6, 1},
-    {63, 2},
-    {58, 3},
-};
-static const arc arcs_91_1[3] = {
-    {65, 4},
-    {58, 5},
-    {0, 1},
-};
-static const arc arcs_91_2[1] = {
-    {58, 6},
-};
-static const arc arcs_91_3[2] = {
-    {65, 7},
-    {0, 3},
-};
-static const arc arcs_91_4[2] = {
-    {63, 2},
-    {58, 5},
-};
-static const arc arcs_91_5[2] = {
-    {65, 4},
-    {0, 5},
-};
-static const arc arcs_91_6[1] = {
-    {0, 6},
-};
-static const arc arcs_91_7[4] = {
-    {6, 8},
-    {63, 2},
-    {58, 3},
-    {0, 7},
-};
-static const arc arcs_91_8[3] = {
-    {65, 9},
-    {58, 10},
-    {0, 8},
-};
-static const arc arcs_91_9[2] = {
-    {63, 2},
-    {58, 10},
-};
-static const arc arcs_91_10[2] = {
-    {65, 9},
-    {0, 10},
-};
-static state states_91[11] = {
-    {3, arcs_91_0},
-    {3, arcs_91_1},
-    {1, arcs_91_2},
-    {2, arcs_91_3},
-    {2, arcs_91_4},
-    {2, arcs_91_5},
-    {1, arcs_91_6},
-    {4, arcs_91_7},
-    {3, arcs_91_8},
-    {2, arcs_91_9},
-    {2, arcs_91_10},
-};
-static const dfa dfas[92] = {
-    {256, "single_input", 3, states_0,
-     "\344\377\377\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {257, "file_input", 2, states_1,
-     "\344\377\377\377\377\027\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {258, "eval_input", 3, states_2,
-     "\240\173\000\024\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {259, "decorator", 4, states_3,
-     "\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {260, "decorators", 2, states_4,
-     "\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {261, "decorated", 3, states_5,
-     "\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {262, "async_funcdef", 3, states_6,
-     "\000\000\000\000\100\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {263, "funcdef", 9, states_7,
-     "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {264, "parameters", 4, states_8,
-     "\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {265, "typedargslist", 42, states_9,
-     "\100\000\000\000\000\001\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {266, "tfpdef", 4, states_10,
-     "\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {267, "varargslist", 34, states_11,
-     "\100\000\000\000\000\001\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {268, "vfpdef", 2, states_12,
-     "\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {269, "stmt", 2, states_13,
-     "\340\377\377\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {270, "simple_stmt", 4, states_14,
-     "\340\373\325\376\270\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {271, "small_stmt", 2, states_15,
-     "\340\373\325\376\270\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {272, "expr_stmt", 6, states_16,
-     "\340\173\000\024\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {273, "annassign", 5, states_17,
-     "\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {274, "testlist_star_expr", 3, states_18,
-     "\340\173\000\024\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {275, "augassign", 2, states_19,
-     "\000\000\000\000\000\000\000\000\000\000\340\377\003\000\000\000\000\000\000\000\000\000\000"},
-    {276, "del_stmt", 3, states_20,
-     "\000\000\020\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {277, "pass_stmt", 2, states_21,
-     "\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {278, "flow_stmt", 2, states_22,
-     "\000\000\005\300\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {279, "break_stmt", 2, states_23,
-     "\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {280, "continue_stmt", 2, states_24,
-     "\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {281, "return_stmt", 3, states_25,
-     "\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {282, "yield_stmt", 2, states_26,
-     "\000\000\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {283, "raise_stmt", 5, states_27,
-     "\000\000\000\100\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {284, "import_stmt", 2, states_28,
-     "\000\000\100\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {285, "import_name", 3, states_29,
-     "\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {286, "import_from", 8, states_30,
-     "\000\000\100\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {287, "import_as_name", 4, states_31,
-     "\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {288, "dotted_as_name", 4, states_32,
-     "\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {289, "import_as_names", 3, states_33,
-     "\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {290, "dotted_as_names", 2, states_34,
-     "\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {291, "dotted_name", 2, states_35,
-     "\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {292, "global_stmt", 3, states_36,
-     "\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {293, "nonlocal_stmt", 3, states_37,
-     "\000\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {294, "assert_stmt", 5, states_38,
-     "\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {295, "compound_stmt", 2, states_39,
-     "\000\004\052\001\107\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {296, "async_stmt", 3, states_40,
-     "\000\000\000\000\100\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {297, "if_stmt", 8, states_41,
-     "\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {298, "while_stmt", 8, states_42,
-     "\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {299, "for_stmt", 11, states_43,
-     "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {300, "try_stmt", 13, states_44,
-     "\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {301, "with_stmt", 6, states_45,
-     "\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {302, "with_item", 4, states_46,
-     "\240\173\000\024\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {303, "except_clause", 5, states_47,
-     "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000"},
-    {304, "suite", 5, states_48,
-     "\344\373\325\376\270\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {305, "namedexpr_test", 4, states_49,
-     "\240\173\000\024\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {306, "test", 6, states_50,
-     "\240\173\000\024\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {307, "test_nocond", 2, states_51,
-     "\240\173\000\024\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {308, "lambdef", 5, states_52,
-     "\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {309, "lambdef_nocond", 5, states_53,
-     "\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {310, "or_test", 2, states_54,
-     "\240\173\000\020\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {311, "and_test", 2, states_55,
-     "\240\173\000\020\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {312, "not_test", 3, states_56,
-     "\240\173\000\020\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {313, "comparison", 2, states_57,
-     "\240\173\000\000\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {314, "comp_op", 4, states_58,
-     "\000\000\000\020\000\000\000\000\000\000\000\000\000\000\000\004\000\340\017\000\000\000\000"},
-    {315, "star_expr", 3, states_59,
-     "\100\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {316, "expr", 2, states_60,
-     "\240\173\000\000\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {317, "xor_expr", 2, states_61,
-     "\240\173\000\000\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {318, "and_expr", 2, states_62,
-     "\240\173\000\000\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {319, "shift_expr", 2, states_63,
-     "\240\173\000\000\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {320, "arith_expr", 2, states_64,
-     "\240\173\000\000\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {321, "term", 2, states_65,
-     "\240\173\000\000\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {322, "factor", 3, states_66,
-     "\240\173\000\000\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {323, "power", 4, states_67,
-     "\040\172\000\000\220\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {324, "atom_expr", 3, states_68,
-     "\040\172\000\000\220\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {325, "atom", 9, states_69,
-     "\040\172\000\000\020\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {326, "testlist_comp", 5, states_70,
-     "\340\173\000\024\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {327, "trailer", 7, states_71,
-     "\040\100\000\000\000\000\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\000"},
-    {328, "subscriptlist", 3, states_72,
-     "\240\173\000\024\260\007\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {329, "subscript", 5, states_73,
-     "\240\173\000\024\260\007\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {330, "sliceop", 3, states_74,
-     "\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {331, "exprlist", 3, states_75,
-     "\340\173\000\000\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {332, "testlist", 3, states_76,
-     "\240\173\000\024\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {333, "dictorsetmaker", 14, states_77,
-     "\340\173\000\024\260\007\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {334, "classdef", 8, states_78,
-     "\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {335, "arglist", 3, states_79,
-     "\340\173\000\024\260\007\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {336, "argument", 4, states_80,
-     "\340\173\000\024\260\007\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {337, "comp_iter", 2, states_81,
-     "\000\000\040\001\100\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {338, "sync_comp_for", 6, states_82,
-     "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {339, "comp_for", 3, states_83,
-     "\000\000\040\000\100\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {340, "comp_if", 4, states_84,
-     "\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {341, "encoding_decl", 2, states_85,
-     "\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {342, "yield_expr", 3, states_86,
-     "\000\000\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {343, "yield_arg", 3, states_87,
-     "\340\173\100\024\260\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {344, "func_body_suite", 7, states_88,
-     "\344\373\325\376\270\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {345, "func_type_input", 3, states_89,
-     "\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {346, "func_type", 6, states_90,
-     "\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-    {347, "typelist", 11, states_91,
-     "\340\173\000\024\260\007\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-};
-static const label labels[183] = {
-    {0, "EMPTY"},
-    {256, 0},
-    {4, 0},
-    {295, 0},
-    {270, 0},
-    {7, 0},
-    {16, 0},
-    {14, 0},
-    {15, 0},
-    {52, 0},
-    {49, 0},
-    {1, "False"},
-    {1, "None"},
-    {1, "True"},
-    {9, 0},
-    {1, "assert"},
-    {1, "break"},
-    {1, "class"},
-    {1, "continue"},
-    {1, "def"},
-    {1, "del"},
-    {1, "for"},
-    {1, "from"},
-    {1, "global"},
-    {1, "if"},
-    {1, "import"},
-    {1, "lambda"},
-    {1, "nonlocal"},
-    {1, "not"},
-    {1, "pass"},
-    {1, "raise"},
-    {1, "return"},
-    {1, "try"},
-    {1, "while"},
-    {1, "with"},
-    {1, "yield"},
-    {25, 0},
-    {31, 0},
-    {56, 0},
-    {55, 0},
-    {1, 0},
-    {2, 0},
-    {3, 0},
-    {257, 0},
-    {0, 0},
-    {269, 0},
-    {258, 0},
-    {332, 0},
-    {259, 0},
-    {305, 0},
-    {260, 0},
-    {261, 0},
-    {262, 0},
-    {334, 0},
-    {263, 0},
-    {264, 0},
-    {51, 0},
-    {11, 0},
-    {306, 0},
-    {58, 0},
-    {344, 0},
-    {8, 0},
-    {265, 0},
-    {35, 0},
-    {266, 0},
-    {12, 0},
-    {22, 0},
-    {17, 0},
-    {267, 0},
-    {268, 0},
-    {271, 0},
-    {13, 0},
-    {294, 0},
-    {276, 0},
-    {272, 0},
-    {278, 0},
-    {292, 0},
-    {284, 0},
-    {293, 0},
-    {277, 0},
-    {274, 0},
-    {273, 0},
-    {275, 0},
-    {342, 0},
-    {315, 0},
-    {40, 0},
-    {41, 0},
-    {46, 0},
-    {38, 0},
-    {36, 0},
-    {37, 0},
-    {48, 0},
-    {39, 0},
-    {44, 0},
-    {45, 0},
-    {50, 0},
-    {43, 0},
-    {42, 0},
-    {331, 0},
-    {279, 0},
-    {280, 0},
-    {283, 0},
-    {281, 0},
-    {282, 0},
-    {286, 0},
-    {285, 0},
-    {290, 0},
-    {23, 0},
-    {291, 0},
-    {289, 0},
-    {287, 0},
-    {1, "as"},
-    {288, 0},
-    {296, 0},
-    {299, 0},
-    {297, 0},
-    {300, 0},
-    {298, 0},
-    {301, 0},
-    {304, 0},
-    {1, "elif"},
-    {1, "else"},
-    {1, "in"},
-    {1, "finally"},
-    {303, 0},
-    {302, 0},
-    {316, 0},
-    {1, "except"},
-    {5, 0},
-    {6, 0},
-    {53, 0},
-    {308, 0},
-    {310, 0},
-    {307, 0},
-    {309, 0},
-    {311, 0},
-    {1, "or"},
-    {312, 0},
-    {1, "and"},
-    {313, 0},
-    {314, 0},
-    {28, 0},
-    {20, 0},
-    {29, 0},
-    {27, 0},
-    {21, 0},
-    {30, 0},
-    {1, "is"},
-    {317, 0},
-    {18, 0},
-    {318, 0},
-    {32, 0},
-    {319, 0},
-    {19, 0},
-    {320, 0},
-    {33, 0},
-    {34, 0},
-    {321, 0},
-    {322, 0},
-    {24, 0},
-    {47, 0},
-    {323, 0},
-    {324, 0},
-    {325, 0},
-    {327, 0},
-    {326, 0},
-    {10, 0},
-    {26, 0},
-    {333, 0},
-    {339, 0},
-    {335, 0},
-    {328, 0},
-    {329, 0},
-    {330, 0},
-    {336, 0},
-    {337, 0},
-    {340, 0},
-    {338, 0},
-    {341, 0},
-    {343, 0},
-    {345, 0},
-    {346, 0},
-    {347, 0},
-};
-Py_EXPORTED_SYMBOL grammar _PyParser_Grammar = {
-    92,
-    dfas,
-    {183, labels},
-    256
-};
diff --git a/Python/hamt.c b/Python/hamt.c
index 8801c5e..e272e88 100644
--- a/Python/hamt.c
+++ b/Python/hamt.c
@@ -1,5 +1,6 @@
 #include "Python.h"
 
+#include "pycore_bitutils.h"      // _Py_popcount32
 #include "pycore_hamt.h"
 #include "pycore_object.h"        // _PyObject_GC_TRACK()
 #include <stddef.h>               // offsetof()
@@ -434,29 +435,9 @@
 }
 
 static inline uint32_t
-hamt_bitcount(uint32_t i)
-{
-    /* We could use native popcount instruction but that would
-       require to either add configure flags to enable SSE4.2
-       support or to detect it dynamically.  Otherwise, we have
-       a risk of CPython not working properly on older hardware.
-
-       In practice, there's no observable difference in
-       performance between using a popcount instruction or the
-       following fallback code.
-
-       The algorithm is copied from:
-       https://graphics.stanford.edu/~seander/bithacks.html
-    */
-    i = i - ((i >> 1) & 0x55555555);
-    i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
-    return (((i + (i >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24;
-}
-
-static inline uint32_t
 hamt_bitindex(uint32_t bitmap, uint32_t bit)
 {
-    return hamt_bitcount(bitmap & (bit - 1));
+    return (uint32_t)_Py_popcount32(bitmap & (bit - 1));
 }
 
 
@@ -820,7 +801,7 @@
     else {
         /* There was no key before with the same (shift,hash). */
 
-        uint32_t n = hamt_bitcount(self->b_bitmap);
+        uint32_t n = (uint32_t)_Py_popcount32(self->b_bitmap);
 
         if (n >= 16) {
             /* When we have a situation where we want to store more
diff --git a/Python/import.c b/Python/import.c
index 5e39a2f..acfe969 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -2,8 +2,7 @@
 
 #include "Python.h"
 
-#include "Python-ast.h"
-#undef Yield   /* undefine macro conflicting with <winbase.h> */
+#include "pycore_import.h"        // _PyImport_BootstrapImp()
 #include "pycore_initconfig.h"
 #include "pycore_pyerrors.h"
 #include "pycore_pyhash.h"
@@ -52,43 +51,6 @@
 /* Initialize things */
 
 PyStatus
-_PyImportHooks_Init(PyThreadState *tstate)
-{
-    PyObject *v, *path_hooks = NULL;
-    int err = 0;
-
-    /* adding sys.path_hooks and sys.path_importer_cache */
-    v = PyList_New(0);
-    if (v == NULL)
-        goto error;
-    err = PySys_SetObject("meta_path", v);
-    Py_DECREF(v);
-    if (err)
-        goto error;
-    v = PyDict_New();
-    if (v == NULL)
-        goto error;
-    err = PySys_SetObject("path_importer_cache", v);
-    Py_DECREF(v);
-    if (err)
-        goto error;
-    path_hooks = PyList_New(0);
-    if (path_hooks == NULL)
-        goto error;
-    err = PySys_SetObject("path_hooks", path_hooks);
-    if (err) {
-        goto error;
-    }
-    Py_DECREF(path_hooks);
-    return _PyStatus_OK();
-
-  error:
-    _PyErr_Print(tstate);
-    return _PyStatus_ERR("initializing sys.meta_path, sys.path_hooks, "
-                        "or path_importer_cache failed");
-}
-
-PyStatus
 _PyImportZip_Init(PyThreadState *tstate)
 {
     PyObject *path_hooks, *zipimport;
@@ -148,7 +110,7 @@
    in different threads to return with a partially loaded module.
    These calls are serialized by the global interpreter lock. */
 
-static PyThread_type_lock import_lock = 0;
+static PyThread_type_lock import_lock = NULL;
 static unsigned long import_lock_thread = PYTHREAD_INVALID_THREAD_ID;
 static int import_lock_level = 0;
 
@@ -171,7 +133,7 @@
         !PyThread_acquire_lock(import_lock, 0))
     {
         PyThreadState *tstate = PyEval_SaveThread();
-        PyThread_acquire_lock(import_lock, 1);
+        PyThread_acquire_lock(import_lock, WAIT_LOCK);
         PyEval_RestoreThread(tstate);
     }
     assert(import_lock_level == 0);
@@ -197,33 +159,30 @@
 }
 
 #ifdef HAVE_FORK
-/* This function is called from PyOS_AfterFork_Child to ensure that newly
+/* This function is called from PyOS_AfterFork_Child() to ensure that newly
    created child processes do not share locks with the parent.
    We now acquire the import lock around fork() calls but on some platforms
    (Solaris 9 and earlier? see isue7242) that still left us with problems. */
-
-void
+PyStatus
 _PyImport_ReInitLock(void)
 {
     if (import_lock != NULL) {
         if (_PyThread_at_fork_reinit(&import_lock) < 0) {
-            _Py_FatalErrorFunc(__func__, "failed to create a new lock");
+            return _PyStatus_ERR("failed to create a new lock");
         }
     }
+
     if (import_lock_level > 1) {
         /* Forked as a side effect of import */
         unsigned long me = PyThread_get_thread_ident();
-        /* The following could fail if the lock is already held, but forking as
-           a side-effect of an import is a) rare, b) nuts, and c) difficult to
-           do thanks to the lock only being held when doing individual module
-           locks per import. */
-        PyThread_acquire_lock(import_lock, NOWAIT_LOCK);
+        PyThread_acquire_lock(import_lock, WAIT_LOCK);
         import_lock_thread = me;
         import_lock_level--;
     } else {
         import_lock_thread = PYTHREAD_INVALID_THREAD_ID;
         import_lock_level = 0;
     }
+    return _PyStatus_OK();
 }
 #endif
 
@@ -296,6 +255,9 @@
     PyMemAllocatorEx old_alloc;
     _PyMem_SetDefaultAllocator(PYMEM_DOMAIN_RAW, &old_alloc);
 
+    // Reset PyImport_Inittab
+    PyImport_Inittab = _PyImport_Inittab;
+
     /* Free memory allocated by PyImport_ExtendInittab() */
     PyMem_RawFree(inittab_copy);
     inittab_copy = NULL;
@@ -340,16 +302,16 @@
 int
 _PyImport_SetModule(PyObject *name, PyObject *m)
 {
-    PyThreadState *tstate = _PyThreadState_GET();
-    PyObject *modules = tstate->interp->modules;
+    PyInterpreterState *interp = _PyInterpreterState_GET();
+    PyObject *modules = interp->modules;
     return PyObject_SetItem(modules, name, m);
 }
 
 int
 _PyImport_SetModuleString(const char *name, PyObject *m)
 {
-    PyThreadState *tstate = _PyThreadState_GET();
-    PyObject *modules = tstate->interp->modules;
+    PyInterpreterState *interp = _PyInterpreterState_GET();
+    PyObject *modules = interp->modules;
     return PyMapping_SetItemString(modules, name, m);
 }
 
@@ -381,9 +343,8 @@
 
 
 static int
-import_ensure_initialized(PyThreadState *tstate, PyObject *mod, PyObject *name)
+import_ensure_initialized(PyInterpreterState *interp, PyObject *mod, PyObject *name)
 {
-    PyInterpreterState *interp = tstate->interp;
     PyObject *spec;
 
     _Py_IDENTIFIER(_lock_unlock_module);
@@ -409,233 +370,6 @@
 }
 
 
-/* List of names to clear in sys */
-static const char * const sys_deletes[] = {
-    "path", "argv", "ps1", "ps2",
-    "last_type", "last_value", "last_traceback",
-    "path_hooks", "path_importer_cache", "meta_path",
-    "__interactivehook__",
-    NULL
-};
-
-static const char * const sys_files[] = {
-    "stdin", "__stdin__",
-    "stdout", "__stdout__",
-    "stderr", "__stderr__",
-    NULL
-};
-
-/* Un-initialize things, as good as we can */
-
-void
-_PyImport_Cleanup(PyThreadState *tstate)
-{
-    PyInterpreterState *interp = tstate->interp;
-    PyObject *modules = interp->modules;
-    if (modules == NULL) {
-        /* Already done */
-        return;
-    }
-
-    /* Delete some special variables first.  These are common
-       places where user values hide and people complain when their
-       destructors fail.  Since the modules containing them are
-       deleted *last* of all, they would come too late in the normal
-       destruction order.  Sigh. */
-
-    /* XXX Perhaps these precautions are obsolete. Who knows? */
-
-    int verbose = _PyInterpreterState_GetConfig(interp)->verbose;
-    if (verbose) {
-        PySys_WriteStderr("# clear builtins._\n");
-    }
-    if (PyDict_SetItemString(interp->builtins, "_", Py_None) < 0) {
-        PyErr_WriteUnraisable(NULL);
-    }
-
-    const char * const *p;
-    for (p = sys_deletes; *p != NULL; p++) {
-        if (verbose) {
-            PySys_WriteStderr("# clear sys.%s\n", *p);
-        }
-        if (PyDict_SetItemString(interp->sysdict, *p, Py_None) < 0) {
-            PyErr_WriteUnraisable(NULL);
-        }
-    }
-    for (p = sys_files; *p != NULL; p+=2) {
-        if (verbose) {
-            PySys_WriteStderr("# restore sys.%s\n", *p);
-        }
-        PyObject *value = _PyDict_GetItemStringWithError(interp->sysdict,
-                                                         *(p+1));
-        if (value == NULL) {
-            if (_PyErr_Occurred(tstate)) {
-                PyErr_WriteUnraisable(NULL);
-            }
-            value = Py_None;
-        }
-        if (PyDict_SetItemString(interp->sysdict, *p, value) < 0) {
-            PyErr_WriteUnraisable(NULL);
-        }
-    }
-
-    /* We prepare a list which will receive (name, weakref) tuples of
-       modules when they are removed from sys.modules.  The name is used
-       for diagnosis messages (in verbose mode), while the weakref helps
-       detect those modules which have been held alive. */
-    PyObject *weaklist = PyList_New(0);
-    if (weaklist == NULL) {
-        PyErr_WriteUnraisable(NULL);
-    }
-
-#define STORE_MODULE_WEAKREF(name, mod) \
-    if (weaklist != NULL) { \
-        PyObject *wr = PyWeakref_NewRef(mod, NULL); \
-        if (wr) { \
-            PyObject *tup = PyTuple_Pack(2, name, wr); \
-            if (!tup || PyList_Append(weaklist, tup) < 0) { \
-                PyErr_WriteUnraisable(NULL); \
-            } \
-            Py_XDECREF(tup); \
-            Py_DECREF(wr); \
-        } \
-        else { \
-            PyErr_WriteUnraisable(NULL); \
-        } \
-    }
-#define CLEAR_MODULE(name, mod) \
-    if (PyModule_Check(mod)) { \
-        if (verbose && PyUnicode_Check(name)) { \
-            PySys_FormatStderr("# cleanup[2] removing %U\n", name); \
-        } \
-        STORE_MODULE_WEAKREF(name, mod); \
-        if (PyObject_SetItem(modules, name, Py_None) < 0) { \
-            PyErr_WriteUnraisable(NULL); \
-        } \
-    }
-
-    /* Remove all modules from sys.modules, hoping that garbage collection
-       can reclaim most of them. */
-    if (PyDict_CheckExact(modules)) {
-        Py_ssize_t pos = 0;
-        PyObject *key, *value;
-        while (PyDict_Next(modules, &pos, &key, &value)) {
-            CLEAR_MODULE(key, value);
-        }
-    }
-    else {
-        PyObject *iterator = PyObject_GetIter(modules);
-        if (iterator == NULL) {
-            PyErr_WriteUnraisable(NULL);
-        }
-        else {
-            PyObject *key;
-            while ((key = PyIter_Next(iterator))) {
-                PyObject *value = PyObject_GetItem(modules, key);
-                if (value == NULL) {
-                    PyErr_WriteUnraisable(NULL);
-                    continue;
-                }
-                CLEAR_MODULE(key, value);
-                Py_DECREF(value);
-                Py_DECREF(key);
-            }
-            if (PyErr_Occurred()) {
-                PyErr_WriteUnraisable(NULL);
-            }
-            Py_DECREF(iterator);
-        }
-    }
-
-    /* Clear the modules dict. */
-    if (PyDict_CheckExact(modules)) {
-        PyDict_Clear(modules);
-    }
-    else {
-        _Py_IDENTIFIER(clear);
-        if (_PyObject_CallMethodIdNoArgs(modules, &PyId_clear) == NULL) {
-            PyErr_WriteUnraisable(NULL);
-        }
-    }
-    /* Restore the original builtins dict, to ensure that any
-       user data gets cleared. */
-    PyObject *dict = PyDict_Copy(interp->builtins);
-    if (dict == NULL) {
-        PyErr_WriteUnraisable(NULL);
-    }
-    PyDict_Clear(interp->builtins);
-    if (PyDict_Update(interp->builtins, interp->builtins_copy)) {
-        _PyErr_Clear(tstate);
-    }
-    Py_XDECREF(dict);
-    /* Collect references */
-    _PyGC_CollectNoFail();
-    /* Dump GC stats before it's too late, since it uses the warnings
-       machinery. */
-    _PyGC_DumpShutdownStats(tstate);
-
-    /* Now, if there are any modules left alive, clear their globals to
-       minimize potential leaks.  All C extension modules actually end
-       up here, since they are kept alive in the interpreter state.
-
-       The special treatment of "builtins" here is because even
-       when it's not referenced as a module, its dictionary is
-       referenced by almost every module's __builtins__.  Since
-       deleting a module clears its dictionary (even if there are
-       references left to it), we need to delete the "builtins"
-       module last.  Likewise, we don't delete sys until the very
-       end because it is implicitly referenced (e.g. by print). */
-    if (weaklist != NULL) {
-        Py_ssize_t i;
-        /* Since dict is ordered in CPython 3.6+, modules are saved in
-           importing order.  First clear modules imported later. */
-        for (i = PyList_GET_SIZE(weaklist) - 1; i >= 0; i--) {
-            PyObject *tup = PyList_GET_ITEM(weaklist, i);
-            PyObject *name = PyTuple_GET_ITEM(tup, 0);
-            PyObject *mod = PyWeakref_GET_OBJECT(PyTuple_GET_ITEM(tup, 1));
-            if (mod == Py_None)
-                continue;
-            assert(PyModule_Check(mod));
-            dict = PyModule_GetDict(mod);
-            if (dict == interp->builtins || dict == interp->sysdict)
-                continue;
-            Py_INCREF(mod);
-            if (verbose && PyUnicode_Check(name)) {
-                PySys_FormatStderr("# cleanup[3] wiping %U\n", name);
-            }
-            _PyModule_Clear(mod);
-            Py_DECREF(mod);
-        }
-        Py_DECREF(weaklist);
-    }
-
-    /* Next, delete sys and builtins (in that order) */
-    if (verbose) {
-        PySys_FormatStderr("# cleanup[3] wiping sys\n");
-    }
-    _PyModule_ClearDict(interp->sysdict);
-    if (verbose) {
-        PySys_FormatStderr("# cleanup[3] wiping builtins\n");
-    }
-    _PyModule_ClearDict(interp->builtins);
-
-    /* Clear module dict copies stored in the interpreter state */
-    _PyInterpreterState_ClearModules(interp);
-
-    /* Clear and delete the modules directory.  Actual modules will
-       still be there only if imported during the execution of some
-       destructor. */
-    interp->modules = NULL;
-    Py_DECREF(modules);
-
-    /* Once more */
-    _PyGC_CollectNoFail();
-
-#undef CLEAR_MODULE
-#undef STORE_MODULE_WEAKREF
-}
-
-
 /* Helper for pythonrun.c -- return magic number and tag. */
 
 long
@@ -675,7 +409,7 @@
    modules.  A copy of the module's dictionary is stored by calling
    _PyImport_FixupExtensionObject() immediately after the module initialization
    function succeeds.  A copy can be retrieved from there by calling
-   _PyImport_FindExtensionObject().
+   import_find_extension().
 
    Modules which do support multiple initialization set their m_size
    field to a non-negative number (indicating the size of the
@@ -707,7 +441,9 @@
         return -1;
     }
 
-    if (_Py_IsMainInterpreter(tstate)) {
+    // bpo-44050: Extensions and def->m_base.m_copy can be updated
+    // when the extension module doesn't support sub-interpreters.
+    if (_Py_IsMainInterpreter(tstate->interp) || def->m_size == -1) {
         if (def->m_size == -1) {
             if (def->m_base.m_copy) {
                 /* Somebody already imported the module,
@@ -788,10 +524,14 @@
         if (mod == NULL)
             return NULL;
         mdict = PyModule_GetDict(mod);
-        if (mdict == NULL)
+        if (mdict == NULL) {
+            Py_DECREF(mod);
             return NULL;
-        if (PyDict_Update(mdict, def->m_base.m_copy))
+        }
+        if (PyDict_Update(mdict, def->m_base.m_copy)) {
+            Py_DECREF(mod);
             return NULL;
+        }
     }
     else {
         if (def->m_base.m_init == NULL)
@@ -803,10 +543,10 @@
             Py_DECREF(mod);
             return NULL;
         }
-        Py_DECREF(mod);
     }
     if (_PyState_AddModule(tstate, mod, def) < 0) {
         PyMapping_DelItem(modules, name);
+        Py_DECREF(mod);
         return NULL;
     }
 
@@ -822,27 +562,23 @@
 _PyImport_FindExtensionObject(PyObject *name, PyObject *filename)
 {
     PyThreadState *tstate = _PyThreadState_GET();
-    return import_find_extension(tstate, name, filename);
+    PyObject *mod = import_find_extension(tstate, name, filename);
+    if (mod) {
+        PyObject *ref = PyWeakref_NewRef(mod, NULL);
+        Py_DECREF(mod);
+        if (ref == NULL) {
+            return NULL;
+        }
+        mod = PyWeakref_GetObject(ref);
+        Py_DECREF(ref);
+    }
+    return mod; /* borrowed reference */
 }
 
 
-PyObject *
-_PyImport_FindBuiltin(PyThreadState *tstate, const char *name)
-{
-    PyObject *res, *nameobj;
-    nameobj = PyUnicode_InternFromString(name);
-    if (nameobj == NULL)
-        return NULL;
-    res = import_find_extension(tstate, nameobj, nameobj);
-    Py_DECREF(nameobj);
-    return res;
-}
-
 /* Get the module object corresponding to a module name.
    First check the modules dictionary if there's one there,
-   if not, create a new one and insert it in the modules dictionary.
-   Because the former action is most common, THIS DOES NOT RETURN A
-   'NEW' REFERENCE! */
+   if not, create a new one and insert it in the modules dictionary. */
 
 static PyObject *
 import_add_module(PyThreadState *tstate, PyObject *name)
@@ -857,6 +593,7 @@
     PyObject *m;
     if (PyDict_CheckExact(modules)) {
         m = PyDict_GetItemWithError(modules, name);
+        Py_XINCREF(m);
     }
     else {
         m = PyObject_GetItem(modules, name);
@@ -872,6 +609,7 @@
     if (m != NULL && PyModule_Check(m)) {
         return m;
     }
+    Py_XDECREF(m);
     m = PyModule_NewObject(name);
     if (m == NULL)
         return NULL;
@@ -879,7 +617,6 @@
         Py_DECREF(m);
         return NULL;
     }
-    Py_DECREF(m); /* Yes, it still exists, in modules! */
 
     return m;
 }
@@ -888,7 +625,17 @@
 PyImport_AddModuleObject(PyObject *name)
 {
     PyThreadState *tstate = _PyThreadState_GET();
-    return import_add_module(tstate, name);
+    PyObject *mod = import_add_module(tstate, name);
+    if (mod) {
+        PyObject *ref = PyWeakref_NewRef(mod, NULL);
+        Py_DECREF(mod);
+        if (ref == NULL) {
+            return NULL;
+        }
+        mod = PyWeakref_GetObject(ref);
+        Py_DECREF(ref);
+    }
+    return mod; /* borrowed reference */
 }
 
 
@@ -1013,7 +760,7 @@
 module_dict_for_exec(PyThreadState *tstate, PyObject *name)
 {
     _Py_IDENTIFIER(__builtins__);
-    PyObject *m, *d = NULL;
+    PyObject *m, *d;
 
     m = import_add_module(tstate, name);
     if (m == NULL)
@@ -1021,17 +768,20 @@
     /* If the module is being reloaded, we get the old module back
        and re-use its dict to exec the new code. */
     d = PyModule_GetDict(m);
-    if (_PyDict_GetItemIdWithError(d, &PyId___builtins__) == NULL) {
-        if (_PyErr_Occurred(tstate) ||
-            _PyDict_SetItemId(d, &PyId___builtins__,
-                              PyEval_GetBuiltins()) != 0)
-        {
-            remove_module(tstate, name);
-            return NULL;
-        }
+    int r = _PyDict_ContainsId(d, &PyId___builtins__);
+    if (r == 0) {
+        r = _PyDict_SetItemId(d, &PyId___builtins__,
+                              PyEval_GetBuiltins());
+    }
+    if (r < 0) {
+        remove_module(tstate, name);
+        Py_DECREF(m);
+        return NULL;
     }
 
-    return d;  /* Return a borrowed reference. */
+    Py_INCREF(d);
+    Py_DECREF(m);
+    return d;
 }
 
 static PyObject *
@@ -1075,8 +825,10 @@
     }
     external = PyObject_GetAttrString(tstate->interp->importlib,
                                       "_bootstrap_external");
-    if (external == NULL)
+    if (external == NULL) {
+        Py_DECREF(d);
         return NULL;
+    }
     res = _PyObject_CallMethodIdObjArgs(external,
                                         &PyId__fix_up_module,
                                         d, name, pathname, cpathname, NULL);
@@ -1085,6 +837,7 @@
         Py_DECREF(res);
         res = exec_code_in_module(tstate, name, d, co);
     }
+    Py_DECREF(d);
     return res;
 }
 
@@ -1178,8 +931,7 @@
    that can handle the path item. Return None if no hook could;
    this tells our caller that the path based finder could not find
    a finder for this path item. Cache the result in
-   path_importer_cache.
-   Returns a borrowed reference. */
+   path_importer_cache. */
 
 static PyObject *
 get_path_importer(PyThreadState *tstate, PyObject *path_importer_cache,
@@ -1197,8 +949,10 @@
         return NULL; /* Shouldn't happen */
 
     importer = PyDict_GetItemWithError(path_importer_cache, p);
-    if (importer != NULL || _PyErr_Occurred(tstate))
+    if (importer != NULL || _PyErr_Occurred(tstate)) {
+        Py_XINCREF(importer);
         return importer;
+    }
 
     /* set path_importer_cache[p] to None to avoid recursion */
     if (PyDict_SetItem(path_importer_cache, p, Py_None) != 0)
@@ -1218,13 +972,11 @@
         _PyErr_Clear(tstate);
     }
     if (importer == NULL) {
-        return Py_None;
+        Py_RETURN_NONE;
     }
-    if (importer != NULL) {
-        int err = PyDict_SetItem(path_importer_cache, p, importer);
+    if (PyDict_SetItem(path_importer_cache, p, importer) < 0) {
         Py_DECREF(importer);
-        if (err != 0)
-            return NULL;
+        return NULL;
     }
     return importer;
 }
@@ -1233,18 +985,61 @@
 PyImport_GetImporter(PyObject *path)
 {
     PyThreadState *tstate = _PyThreadState_GET();
-    PyObject *importer=NULL, *path_importer_cache=NULL, *path_hooks=NULL;
-
-    path_importer_cache = PySys_GetObject("path_importer_cache");
-    path_hooks = PySys_GetObject("path_hooks");
-    if (path_importer_cache != NULL && path_hooks != NULL) {
-        importer = get_path_importer(tstate, path_importer_cache,
-                                     path_hooks, path);
+    PyObject *path_importer_cache = PySys_GetObject("path_importer_cache");
+    PyObject *path_hooks = PySys_GetObject("path_hooks");
+    if (path_importer_cache == NULL || path_hooks == NULL) {
+        return NULL;
     }
-    Py_XINCREF(importer); /* get_path_importer returns a borrowed reference */
-    return importer;
+    return get_path_importer(tstate, path_importer_cache, path_hooks, path);
 }
 
+static PyObject*
+create_builtin(PyThreadState *tstate, PyObject *name, PyObject *spec)
+{
+    PyObject *mod = import_find_extension(tstate, name, name);
+    if (mod || _PyErr_Occurred(tstate)) {
+        return mod;
+    }
+
+    PyObject *modules = tstate->interp->modules;
+    for (struct _inittab *p = PyImport_Inittab; p->name != NULL; p++) {
+        if (_PyUnicode_EqualToASCIIString(name, p->name)) {
+            if (p->initfunc == NULL) {
+                /* Cannot re-init internal module ("sys" or "builtins") */
+                return PyImport_AddModuleObject(name);
+            }
+
+            mod = (*p->initfunc)();
+            if (mod == NULL) {
+                return NULL;
+            }
+
+            if (PyObject_TypeCheck(mod, &PyModuleDef_Type)) {
+                return PyModule_FromDefAndSpec((PyModuleDef*)mod, spec);
+            }
+            else {
+                /* Remember pointer to module init function. */
+                PyModuleDef *def = PyModule_GetDef(mod);
+                if (def == NULL) {
+                    return NULL;
+                }
+
+                def->m_base.m_init = p->initfunc;
+                if (_PyImport_FixupExtensionObject(mod, name, name,
+                                                   modules) < 0) {
+                    return NULL;
+                }
+                return mod;
+            }
+        }
+    }
+
+    // not found
+    Py_RETURN_NONE;
+}
+
+
+
 /*[clinic input]
 _imp.create_builtin
 
@@ -1259,67 +1054,15 @@
 /*[clinic end generated code: output=ace7ff22271e6f39 input=37f966f890384e47]*/
 {
     PyThreadState *tstate = _PyThreadState_GET();
-    struct _inittab *p;
-    PyObject *name;
-    const char *namestr;
-    PyObject *mod;
 
-    name = PyObject_GetAttrString(spec, "name");
+    PyObject *name = PyObject_GetAttrString(spec, "name");
     if (name == NULL) {
         return NULL;
     }
 
-    mod = _PyImport_FindExtensionObject(name, name);
-    if (mod || _PyErr_Occurred(tstate)) {
-        Py_DECREF(name);
-        Py_XINCREF(mod);
-        return mod;
-    }
-
-    namestr = PyUnicode_AsUTF8(name);
-    if (namestr == NULL) {
-        Py_DECREF(name);
-        return NULL;
-    }
-
-    PyObject *modules = tstate->interp->modules;
-    for (p = PyImport_Inittab; p->name != NULL; p++) {
-        PyModuleDef *def;
-        if (_PyUnicode_EqualToASCIIString(name, p->name)) {
-            if (p->initfunc == NULL) {
-                /* Cannot re-init internal module ("sys" or "builtins") */
-                mod = PyImport_AddModule(namestr);
-                Py_DECREF(name);
-                return mod;
-            }
-            mod = (*p->initfunc)();
-            if (mod == NULL) {
-                Py_DECREF(name);
-                return NULL;
-            }
-            if (PyObject_TypeCheck(mod, &PyModuleDef_Type)) {
-                Py_DECREF(name);
-                return PyModule_FromDefAndSpec((PyModuleDef*)mod, spec);
-            } else {
-                /* Remember pointer to module init function. */
-                def = PyModule_GetDef(mod);
-                if (def == NULL) {
-                    Py_DECREF(name);
-                    return NULL;
-                }
-                def->m_base.m_init = p->initfunc;
-                if (_PyImport_FixupExtensionObject(mod, name, name,
-                                                   modules) < 0) {
-                    Py_DECREF(name);
-                    return NULL;
-                }
-                Py_DECREF(name);
-                return mod;
-            }
-        }
-    }
+    PyObject *mod = create_builtin(tstate, name, spec);
     Py_DECREF(name);
-    Py_RETURN_NONE;
+    return mod;
 }
 
 
@@ -1435,10 +1178,12 @@
         d = PyModule_GetDict(m);
         l = PyList_New(0);
         if (l == NULL) {
+            Py_DECREF(m);
             goto err_return;
         }
         err = PyDict_SetItemString(d, "__path__", l);
         Py_DECREF(l);
+        Py_DECREF(m);
         if (err != 0)
             goto err_return;
     }
@@ -1447,6 +1192,7 @@
         goto err_return;
     }
     m = exec_code_in_module(tstate, name, d, co);
+    Py_DECREF(d);
     if (m == NULL) {
         goto err_return;
     }
@@ -1663,10 +1409,14 @@
             goto error;
         }
 
-        if (_PyDict_GetItemIdWithError(globals, &PyId___path__) == NULL) {
+        int haspath = _PyDict_ContainsId(globals, &PyId___path__);
+        if (haspath < 0) {
+            goto error;
+        }
+        if (!haspath) {
             Py_ssize_t dot;
 
-            if (_PyErr_Occurred(tstate) || PyUnicode_READY(package) < 0) {
+            if (PyUnicode_READY(package) < 0) {
                 goto error;
             }
 
@@ -1799,7 +1549,7 @@
 
     mod = import_get_module(tstate, name);
     if (mod != NULL && mod != Py_None) {
-        if (import_ensure_initialized(tstate, mod, name) < 0) {
+        if (import_ensure_initialized(tstate->interp, mod, name) < 0) {
             Py_DECREF(mod);
             remove_importlib_frames(tstate);
             return NULL;
@@ -1863,7 +1613,7 @@
     }
 
     if (mod != NULL && mod != Py_None) {
-        if (import_ensure_initialized(tstate, mod, name) < 0) {
+        if (import_ensure_initialized(tstate->interp, mod, abs_name) < 0) {
             goto error;
         }
     }
@@ -2014,26 +1764,29 @@
 PyObject *
 PyImport_Import(PyObject *module_name)
 {
+    _Py_IDENTIFIER(__import__);
+    _Py_IDENTIFIER(__builtins__);
+
     PyThreadState *tstate = _PyThreadState_GET();
-    static PyObject *silly_list = NULL;
-    static PyObject *builtins_str = NULL;
-    static PyObject *import_str = NULL;
     PyObject *globals = NULL;
     PyObject *import = NULL;
     PyObject *builtins = NULL;
     PyObject *r = NULL;
 
     /* Initialize constant string objects */
-    if (silly_list == NULL) {
-        import_str = PyUnicode_InternFromString("__import__");
-        if (import_str == NULL)
-            return NULL;
-        builtins_str = PyUnicode_InternFromString("__builtins__");
-        if (builtins_str == NULL)
-            return NULL;
-        silly_list = PyList_New(0);
-        if (silly_list == NULL)
-            return NULL;
+    PyObject *import_str = _PyUnicode_FromId(&PyId___import__); // borrowed ref
+    if (import_str == NULL) {
+        return NULL;
+    }
+
+    PyObject *builtins_str = _PyUnicode_FromId(&PyId___builtins__); // borrowed ref
+    if (builtins_str == NULL) {
+        return NULL;
+    }
+
+    PyObject *from_list = PyList_New(0);
+    if (from_list == NULL) {
+        goto err;
     }
 
     /* Get the builtins from current globals */
@@ -2048,8 +1801,9 @@
         /* No globals -- use standard builtins, and fake globals */
         builtins = PyImport_ImportModuleLevel("builtins",
                                               NULL, NULL, NULL, 0);
-        if (builtins == NULL)
-            return NULL;
+        if (builtins == NULL) {
+            goto err;
+        }
         globals = Py_BuildValue("{OO}", builtins_str, builtins);
         if (globals == NULL)
             goto err;
@@ -2071,7 +1825,7 @@
        Always use absolute import here.
        Calling for side-effect of import. */
     r = PyObject_CallFunction(import, "OOOOi", module_name, globals,
-                              globals, silly_list, 0, NULL);
+                              globals, from_list, 0, NULL);
     if (r == NULL)
         goto err;
     Py_DECREF(r);
@@ -2085,6 +1839,7 @@
     Py_XDECREF(globals);
     Py_XDECREF(builtins);
     Py_XDECREF(import);
+    Py_XDECREF(from_list);
 
     return r;
 }
@@ -2141,7 +1896,6 @@
 {
     PyThreadState *tstate = _PyThreadState_GET();
     int ret;
-    PyObject *m;
 
     ret = PyImport_ImportFrozenModuleObject(name);
     if (ret < 0)
@@ -2149,9 +1903,7 @@
     if (ret == 0) {
         Py_RETURN_NONE;
     }
-    m = import_add_module(tstate, name);
-    Py_XINCREF(m);
-    return m;
+    return import_add_module(tstate, name);
 }
 
 /*[clinic input]
@@ -2275,11 +2027,11 @@
         return NULL;
     }
 
-    mod = _PyImport_FindExtensionObject(name, path);
+    PyThreadState *tstate = _PyThreadState_GET();
+    mod = import_find_extension(tstate, name, path);
     if (mod != NULL || PyErr_Occurred()) {
         Py_DECREF(name);
         Py_DECREF(path);
-        Py_XINCREF(mod);
         return mod;
     }
 
@@ -2390,46 +2142,88 @@
 };
 
 
-static struct PyModuleDef impmodule = {
+static int
+imp_module_exec(PyObject *module)
+{
+    const wchar_t *mode = _Py_GetConfig()->check_hash_pycs_mode;
+    PyObject *pyc_mode = PyUnicode_FromWideChar(mode, -1);
+    if (pyc_mode == NULL) {
+        return -1;
+    }
+    if (PyModule_AddObjectRef(module, "check_hash_based_pycs", pyc_mode) < 0) {
+        Py_DECREF(pyc_mode);
+        return -1;
+    }
+    Py_DECREF(pyc_mode);
+
+    return 0;
+}
+
+
+static PyModuleDef_Slot imp_slots[] = {
+    {Py_mod_exec, imp_module_exec},
+    {0, NULL}
+};
+
+static struct PyModuleDef imp_module = {
     PyModuleDef_HEAD_INIT,
-    "_imp",
-    doc_imp,
-    0,
-    imp_methods,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    .m_name = "_imp",
+    .m_doc = doc_imp,
+    .m_size = 0,
+    .m_methods = imp_methods,
+    .m_slots = imp_slots,
 };
 
 PyMODINIT_FUNC
 PyInit__imp(void)
 {
-    PyObject *m, *d;
+    return PyModuleDef_Init(&imp_module);
+}
 
-    m = PyModule_Create(&impmodule);
-    if (m == NULL) {
-        goto failure;
-    }
-    d = PyModule_GetDict(m);
-    if (d == NULL) {
-        goto failure;
+
+// Import the _imp extension by calling manually _imp.create_builtin() and
+// _imp.exec_builtin() since importlib is not initialized yet. Initializing
+// importlib requires the _imp module: this function fix the bootstrap issue.
+PyObject*
+_PyImport_BootstrapImp(PyThreadState *tstate)
+{
+    PyObject *name = PyUnicode_FromString("_imp");
+    if (name == NULL) {
+        return NULL;
     }
 
-    const wchar_t *mode = _Py_GetConfig()->check_hash_pycs_mode;
-    PyObject *pyc_mode = PyUnicode_FromWideChar(mode, -1);
-    if (pyc_mode == NULL) {
-        goto failure;
+    // Mock a ModuleSpec object just good enough for PyModule_FromDefAndSpec():
+    // an object with just a name attribute.
+    //
+    // _imp.__spec__ is overridden by importlib._bootstrap._instal() anyway.
+    PyObject *attrs = Py_BuildValue("{sO}", "name", name);
+    if (attrs == NULL) {
+        goto error;
     }
-    if (PyDict_SetItemString(d, "check_hash_based_pycs", pyc_mode) < 0) {
-        Py_DECREF(pyc_mode);
-        goto failure;
+    PyObject *spec = _PyNamespace_New(attrs);
+    Py_DECREF(attrs);
+    if (spec == NULL) {
+        goto error;
     }
-    Py_DECREF(pyc_mode);
 
-    return m;
-  failure:
-    Py_XDECREF(m);
+    // Create the _imp module from its definition.
+    PyObject *mod = create_builtin(tstate, name, spec);
+    Py_CLEAR(name);
+    Py_DECREF(spec);
+    if (mod == NULL) {
+        goto error;
+    }
+    assert(mod != Py_None);  // not found
+
+    // Execute the _imp module: call imp_module_exec().
+    if (exec_builtin_or_dynamic(mod) < 0) {
+        Py_DECREF(mod);
+        goto error;
+    }
+    return mod;
+
+error:
+    Py_XDECREF(name);
     return NULL;
 }
 
diff --git a/Python/importdl.c b/Python/importdl.c
index fbeb9fb..6d25547 100644
--- a/Python/importdl.c
+++ b/Python/importdl.c
@@ -42,6 +42,9 @@
 
     /* Get the short name (substring after last dot) */
     name_len = PyUnicode_GetLength(name);
+    if (name_len < 0) {
+        return NULL;
+    }
     lastdot = PyUnicode_FindChar(name, '.', 0, name_len, -1);
     if (lastdot < -1) {
         return NULL;
@@ -121,7 +124,7 @@
 
     if (PySys_Audit("import", "OOOOO", name_unicode, path,
                     Py_None, Py_None, Py_None) < 0) {
-        return NULL;
+        goto error;
     }
 
 #ifdef MS_WINDOWS
@@ -204,7 +207,7 @@
         /* don't allow legacy init for non-ASCII module names */
         PyErr_Format(
             PyExc_SystemError,
-            "initialization of * did not return PyModuleDef",
+            "initialization of %s did not return PyModuleDef",
             name_buf);
         goto error;
     }
@@ -220,10 +223,9 @@
     def->m_base.m_init = p0;
 
     /* Remember the filename as the __file__ attribute */
-    if (PyModule_AddObject(m, "__file__", path) < 0)
+    if (PyModule_AddObjectRef(m, "__file__", path) < 0) {
         PyErr_Clear(); /* Not important enough to report */
-    else
-        Py_INCREF(path);
+    }
 
     PyObject *modules = PyImport_GetModuleDict();
     if (_PyImport_FixupExtensionObject(m, name_unicode, path, modules) < 0)
diff --git a/Python/importlib.h b/Python/importlib.h
index 1fb877a..dd1a9f1 100644
--- a/Python/importlib.h
+++ b/Python/importlib.h
@@ -1,537 +1,561 @@
 /* Auto-generated by Programs/_freeze_importlib.c */
 const unsigned char _Py_M__importlib_bootstrap[] = {
     99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,4,0,0,0,64,0,0,0,115,194,1,0,0,100,0,
-    90,0,100,1,97,1,100,2,100,3,132,0,90,2,100,4,
-    100,5,132,0,90,3,105,0,90,4,105,0,90,5,71,0,
-    100,6,100,7,132,0,100,7,101,6,131,3,90,7,71,0,
-    100,8,100,9,132,0,100,9,131,2,90,8,71,0,100,10,
-    100,11,132,0,100,11,131,2,90,9,71,0,100,12,100,13,
-    132,0,100,13,131,2,90,10,100,14,100,15,132,0,90,11,
-    100,16,100,17,132,0,90,12,100,18,100,19,132,0,90,13,
-    100,20,100,21,156,1,100,22,100,23,132,2,90,14,100,24,
-    100,25,132,0,90,15,100,26,100,27,132,0,90,16,100,28,
-    100,29,132,0,90,17,100,30,100,31,132,0,90,18,71,0,
-    100,32,100,33,132,0,100,33,131,2,90,19,100,1,100,1,
-    100,34,156,2,100,35,100,36,132,2,90,20,100,94,100,37,
-    100,38,132,1,90,21,100,39,100,40,156,1,100,41,100,42,
-    132,2,90,22,100,43,100,44,132,0,90,23,100,45,100,46,
-    132,0,90,24,100,47,100,48,132,0,90,25,100,49,100,50,
-    132,0,90,26,100,51,100,52,132,0,90,27,100,53,100,54,
-    132,0,90,28,71,0,100,55,100,56,132,0,100,56,131,2,
-    90,29,71,0,100,57,100,58,132,0,100,58,131,2,90,30,
-    71,0,100,59,100,60,132,0,100,60,131,2,90,31,100,61,
-    100,62,132,0,90,32,100,63,100,64,132,0,90,33,100,95,
-    100,65,100,66,132,1,90,34,100,67,100,68,132,0,90,35,
-    100,69,90,36,101,36,100,70,23,0,90,37,100,71,100,72,
-    132,0,90,38,101,39,131,0,90,40,100,73,100,74,132,0,
-    90,41,100,96,100,76,100,77,132,1,90,42,100,39,100,78,
-    156,1,100,79,100,80,132,2,90,43,100,81,100,82,132,0,
-    90,44,100,97,100,84,100,85,132,1,90,45,100,86,100,87,
-    132,0,90,46,100,88,100,89,132,0,90,47,100,90,100,91,
-    132,0,90,48,100,92,100,93,132,0,90,49,100,1,83,0,
-    41,98,97,83,1,0,0,67,111,114,101,32,105,109,112,108,
-    101,109,101,110,116,97,116,105,111,110,32,111,102,32,105,109,
-    112,111,114,116,46,10,10,84,104,105,115,32,109,111,100,117,
-    108,101,32,105,115,32,78,79,84,32,109,101,97,110,116,32,
-    116,111,32,98,101,32,100,105,114,101,99,116,108,121,32,105,
-    109,112,111,114,116,101,100,33,32,73,116,32,104,97,115,32,
-    98,101,101,110,32,100,101,115,105,103,110,101,100,32,115,117,
-    99,104,10,116,104,97,116,32,105,116,32,99,97,110,32,98,
-    101,32,98,111,111,116,115,116,114,97,112,112,101,100,32,105,
-    110,116,111,32,80,121,116,104,111,110,32,97,115,32,116,104,
-    101,32,105,109,112,108,101,109,101,110,116,97,116,105,111,110,
-    32,111,102,32,105,109,112,111,114,116,46,32,65,115,10,115,
-    117,99,104,32,105,116,32,114,101,113,117,105,114,101,115,32,
-    116,104,101,32,105,110,106,101,99,116,105,111,110,32,111,102,
-    32,115,112,101,99,105,102,105,99,32,109,111,100,117,108,101,
-    115,32,97,110,100,32,97,116,116,114,105,98,117,116,101,115,
-    32,105,110,32,111,114,100,101,114,32,116,111,10,119,111,114,
-    107,46,32,79,110,101,32,115,104,111,117,108,100,32,117,115,
-    101,32,105,109,112,111,114,116,108,105,98,32,97,115,32,116,
-    104,101,32,112,117,98,108,105,99,45,102,97,99,105,110,103,
-    32,118,101,114,115,105,111,110,32,111,102,32,116,104,105,115,
-    32,109,111,100,117,108,101,46,10,10,78,99,2,0,0,0,
-    0,0,0,0,0,0,0,0,3,0,0,0,7,0,0,0,
-    67,0,0,0,115,56,0,0,0,100,1,68,0,93,32,125,
-    2,116,0,124,1,124,2,131,2,114,4,116,1,124,0,124,
-    2,116,2,124,1,124,2,131,2,131,3,1,0,113,4,124,
-    0,106,3,160,4,124,1,106,3,161,1,1,0,100,2,83,
-    0,41,3,122,47,83,105,109,112,108,101,32,115,117,98,115,
-    116,105,116,117,116,101,32,102,111,114,32,102,117,110,99,116,
-    111,111,108,115,46,117,112,100,97,116,101,95,119,114,97,112,
-    112,101,114,46,41,4,218,10,95,95,109,111,100,117,108,101,
-    95,95,218,8,95,95,110,97,109,101,95,95,218,12,95,95,
-    113,117,97,108,110,97,109,101,95,95,218,7,95,95,100,111,
-    99,95,95,78,41,5,218,7,104,97,115,97,116,116,114,218,
-    7,115,101,116,97,116,116,114,218,7,103,101,116,97,116,116,
-    114,218,8,95,95,100,105,99,116,95,95,218,6,117,112,100,
-    97,116,101,41,3,90,3,110,101,119,90,3,111,108,100,218,
-    7,114,101,112,108,97,99,101,169,0,114,10,0,0,0,250,
-    29,60,102,114,111,122,101,110,32,105,109,112,111,114,116,108,
-    105,98,46,95,98,111,111,116,115,116,114,97,112,62,218,5,
-    95,119,114,97,112,27,0,0,0,115,8,0,0,0,0,2,
-    8,1,10,1,20,1,114,12,0,0,0,99,1,0,0,0,
-    0,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,
-    67,0,0,0,115,12,0,0,0,116,0,116,1,131,1,124,
-    0,131,1,83,0,169,1,78,41,2,218,4,116,121,112,101,
-    218,3,115,121,115,169,1,218,4,110,97,109,101,114,10,0,
-    0,0,114,10,0,0,0,114,11,0,0,0,218,11,95,110,
-    101,119,95,109,111,100,117,108,101,35,0,0,0,115,2,0,
-    0,0,0,1,114,18,0,0,0,99,0,0,0,0,0,0,
-    0,0,0,0,0,0,0,0,0,0,1,0,0,0,64,0,
-    0,0,115,12,0,0,0,101,0,90,1,100,0,90,2,100,
-    1,83,0,41,2,218,14,95,68,101,97,100,108,111,99,107,
-    69,114,114,111,114,78,41,3,114,1,0,0,0,114,0,0,
-    0,0,114,2,0,0,0,114,10,0,0,0,114,10,0,0,
-    0,114,10,0,0,0,114,11,0,0,0,114,19,0,0,0,
-    48,0,0,0,115,2,0,0,0,8,1,114,19,0,0,0,
+    0,4,0,0,0,64,0,0,0,115,214,1,0,0,100,0,
+    90,0,100,1,100,2,132,0,90,1,100,3,90,2,100,3,
+    90,3,100,3,90,4,100,3,97,5,100,4,100,5,132,0,
+    90,6,100,6,100,7,132,0,90,7,105,0,90,8,105,0,
+    90,9,71,0,100,8,100,9,132,0,100,9,101,10,131,3,
+    90,11,71,0,100,10,100,11,132,0,100,11,131,2,90,12,
+    71,0,100,12,100,13,132,0,100,13,131,2,90,13,71,0,
+    100,14,100,15,132,0,100,15,131,2,90,14,100,16,100,17,
+    132,0,90,15,100,18,100,19,132,0,90,16,100,20,100,21,
+    132,0,90,17,100,22,100,23,156,1,100,24,100,25,132,2,
+    90,18,100,26,100,27,132,0,90,19,100,28,100,29,132,0,
+    90,20,100,30,100,31,132,0,90,21,100,32,100,33,132,0,
+    90,22,71,0,100,34,100,35,132,0,100,35,131,2,90,23,
+    100,3,100,3,100,36,156,2,100,37,100,38,132,2,90,24,
+    100,96,100,39,100,40,132,1,90,25,100,41,100,42,156,1,
+    100,43,100,44,132,2,90,26,100,45,100,46,132,0,90,27,
+    100,47,100,48,132,0,90,28,100,49,100,50,132,0,90,29,
+    100,51,100,52,132,0,90,30,100,53,100,54,132,0,90,31,
+    100,55,100,56,132,0,90,32,71,0,100,57,100,58,132,0,
+    100,58,131,2,90,33,71,0,100,59,100,60,132,0,100,60,
+    131,2,90,34,71,0,100,61,100,62,132,0,100,62,131,2,
+    90,35,100,63,100,64,132,0,90,36,100,65,100,66,132,0,
+    90,37,100,97,100,67,100,68,132,1,90,38,100,69,100,70,
+    132,0,90,39,100,71,90,40,101,40,100,72,23,0,90,41,
+    100,73,100,74,132,0,90,42,101,43,131,0,90,44,100,75,
+    100,76,132,0,90,45,100,98,100,78,100,79,132,1,90,46,
+    100,41,100,80,156,1,100,81,100,82,132,2,90,47,100,83,
+    100,84,132,0,90,48,100,99,100,86,100,87,132,1,90,49,
+    100,88,100,89,132,0,90,50,100,90,100,91,132,0,90,51,
+    100,92,100,93,132,0,90,52,100,94,100,95,132,0,90,53,
+    100,3,83,0,41,100,97,83,1,0,0,67,111,114,101,32,
+    105,109,112,108,101,109,101,110,116,97,116,105,111,110,32,111,
+    102,32,105,109,112,111,114,116,46,10,10,84,104,105,115,32,
+    109,111,100,117,108,101,32,105,115,32,78,79,84,32,109,101,
+    97,110,116,32,116,111,32,98,101,32,100,105,114,101,99,116,
+    108,121,32,105,109,112,111,114,116,101,100,33,32,73,116,32,
+    104,97,115,32,98,101,101,110,32,100,101,115,105,103,110,101,
+    100,32,115,117,99,104,10,116,104,97,116,32,105,116,32,99,
+    97,110,32,98,101,32,98,111,111,116,115,116,114,97,112,112,
+    101,100,32,105,110,116,111,32,80,121,116,104,111,110,32,97,
+    115,32,116,104,101,32,105,109,112,108,101,109,101,110,116,97,
+    116,105,111,110,32,111,102,32,105,109,112,111,114,116,46,32,
+    65,115,10,115,117,99,104,32,105,116,32,114,101,113,117,105,
+    114,101,115,32,116,104,101,32,105,110,106,101,99,116,105,111,
+    110,32,111,102,32,115,112,101,99,105,102,105,99,32,109,111,
+    100,117,108,101,115,32,97,110,100,32,97,116,116,114,105,98,
+    117,116,101,115,32,105,110,32,111,114,100,101,114,32,116,111,
+    10,119,111,114,107,46,32,79,110,101,32,115,104,111,117,108,
+    100,32,117,115,101,32,105,109,112,111,114,116,108,105,98,32,
+    97,115,32,116,104,101,32,112,117,98,108,105,99,45,102,97,
+    99,105,110,103,32,118,101,114,115,105,111,110,32,111,102,32,
+    116,104,105,115,32,109,111,100,117,108,101,46,10,10,99,1,
+    0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,8,
+    0,0,0,67,0,0,0,115,38,0,0,0,122,4,124,0,
+    106,0,87,0,83,0,4,0,116,1,121,18,1,0,1,0,
+    1,0,116,2,124,0,131,1,106,0,6,0,89,0,83,0,
+    119,0,169,1,78,41,3,218,12,95,95,113,117,97,108,110,
+    97,109,101,95,95,218,14,65,116,116,114,105,98,117,116,101,
+    69,114,114,111,114,218,4,116,121,112,101,41,1,218,3,111,
+    98,106,169,0,114,5,0,0,0,250,29,60,102,114,111,122,
+    101,110,32,105,109,112,111,114,116,108,105,98,46,95,98,111,
+    111,116,115,116,114,97,112,62,218,12,95,111,98,106,101,99,
+    116,95,110,97,109,101,23,0,0,0,115,10,0,0,0,2,
+    1,8,1,12,1,14,1,2,255,114,7,0,0,0,78,99,
+    2,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,
+    7,0,0,0,67,0,0,0,115,56,0,0,0,100,1,68,
+    0,93,16,125,2,116,0,124,1,124,2,131,2,114,18,116,
+    1,124,0,124,2,116,2,124,1,124,2,131,2,131,3,1,
+    0,113,2,124,0,106,3,160,4,124,1,106,3,161,1,1,
+    0,100,2,83,0,41,3,122,47,83,105,109,112,108,101,32,
+    115,117,98,115,116,105,116,117,116,101,32,102,111,114,32,102,
+    117,110,99,116,111,111,108,115,46,117,112,100,97,116,101,95,
+    119,114,97,112,112,101,114,46,41,4,218,10,95,95,109,111,
+    100,117,108,101,95,95,218,8,95,95,110,97,109,101,95,95,
+    114,1,0,0,0,218,7,95,95,100,111,99,95,95,78,41,
+    5,218,7,104,97,115,97,116,116,114,218,7,115,101,116,97,
+    116,116,114,218,7,103,101,116,97,116,116,114,218,8,95,95,
+    100,105,99,116,95,95,218,6,117,112,100,97,116,101,41,3,
+    90,3,110,101,119,90,3,111,108,100,218,7,114,101,112,108,
+    97,99,101,114,5,0,0,0,114,5,0,0,0,114,6,0,
+    0,0,218,5,95,119,114,97,112,40,0,0,0,115,10,0,
+    0,0,8,2,10,1,18,1,2,128,18,1,114,17,0,0,
+    0,99,1,0,0,0,0,0,0,0,0,0,0,0,1,0,
+    0,0,2,0,0,0,67,0,0,0,115,12,0,0,0,116,
+    0,116,1,131,1,124,0,131,1,83,0,114,0,0,0,0,
+    41,2,114,3,0,0,0,218,3,115,121,115,169,1,218,4,
+    110,97,109,101,114,5,0,0,0,114,5,0,0,0,114,6,
+    0,0,0,218,11,95,110,101,119,95,109,111,100,117,108,101,
+    48,0,0,0,115,2,0,0,0,12,1,114,21,0,0,0,
     99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,2,0,0,0,64,0,0,0,115,56,0,0,0,101,0,
-    90,1,100,0,90,2,100,1,90,3,100,2,100,3,132,0,
-    90,4,100,4,100,5,132,0,90,5,100,6,100,7,132,0,
-    90,6,100,8,100,9,132,0,90,7,100,10,100,11,132,0,
-    90,8,100,12,83,0,41,13,218,11,95,77,111,100,117,108,
-    101,76,111,99,107,122,169,65,32,114,101,99,117,114,115,105,
-    118,101,32,108,111,99,107,32,105,109,112,108,101,109,101,110,
-    116,97,116,105,111,110,32,119,104,105,99,104,32,105,115,32,
-    97,98,108,101,32,116,111,32,100,101,116,101,99,116,32,100,
-    101,97,100,108,111,99,107,115,10,32,32,32,32,40,101,46,
-    103,46,32,116,104,114,101,97,100,32,49,32,116,114,121,105,
-    110,103,32,116,111,32,116,97,107,101,32,108,111,99,107,115,
-    32,65,32,116,104,101,110,32,66,44,32,97,110,100,32,116,
-    104,114,101,97,100,32,50,32,116,114,121,105,110,103,32,116,
-    111,10,32,32,32,32,116,97,107,101,32,108,111,99,107,115,
-    32,66,32,116,104,101,110,32,65,41,46,10,32,32,32,32,
-    99,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,
-    0,2,0,0,0,67,0,0,0,115,48,0,0,0,116,0,
-    160,1,161,0,124,0,95,2,116,0,160,1,161,0,124,0,
-    95,3,124,1,124,0,95,4,100,0,124,0,95,5,100,1,
-    124,0,95,6,100,1,124,0,95,7,100,0,83,0,169,2,
-    78,233,0,0,0,0,41,8,218,7,95,116,104,114,101,97,
-    100,90,13,97,108,108,111,99,97,116,101,95,108,111,99,107,
-    218,4,108,111,99,107,218,6,119,97,107,101,117,112,114,17,
-    0,0,0,218,5,111,119,110,101,114,218,5,99,111,117,110,
-    116,218,7,119,97,105,116,101,114,115,169,2,218,4,115,101,
-    108,102,114,17,0,0,0,114,10,0,0,0,114,10,0,0,
-    0,114,11,0,0,0,218,8,95,95,105,110,105,116,95,95,
-    58,0,0,0,115,12,0,0,0,0,1,10,1,10,1,6,
-    1,6,1,6,1,122,20,95,77,111,100,117,108,101,76,111,
-    99,107,46,95,95,105,110,105,116,95,95,99,1,0,0,0,
-    0,0,0,0,0,0,0,0,5,0,0,0,3,0,0,0,
-    67,0,0,0,115,88,0,0,0,116,0,160,1,161,0,125,
-    1,124,0,106,2,125,2,116,3,131,0,125,3,116,4,160,
-    5,124,2,161,1,125,4,124,4,100,0,117,0,114,42,100,
-    1,83,0,124,4,106,2,125,2,124,2,124,1,107,2,114,
-    60,100,2,83,0,124,2,124,3,118,0,114,72,100,1,83,
-    0,124,3,160,6,124,2,161,1,1,0,113,20,100,0,83,
-    0,41,3,78,70,84,41,7,114,23,0,0,0,218,9,103,
-    101,116,95,105,100,101,110,116,114,26,0,0,0,218,3,115,
-    101,116,218,12,95,98,108,111,99,107,105,110,103,95,111,110,
-    218,3,103,101,116,218,3,97,100,100,41,5,114,30,0,0,
-    0,90,2,109,101,218,3,116,105,100,90,4,115,101,101,110,
-    114,24,0,0,0,114,10,0,0,0,114,10,0,0,0,114,
-    11,0,0,0,218,12,104,97,115,95,100,101,97,100,108,111,
-    99,107,66,0,0,0,115,24,0,0,0,0,2,8,1,6,
-    1,6,2,10,1,8,1,4,1,6,1,8,1,4,1,8,
-    6,4,1,122,24,95,77,111,100,117,108,101,76,111,99,107,
-    46,104,97,115,95,100,101,97,100,108,111,99,107,99,1,0,
-    0,0,0,0,0,0,0,0,0,0,2,0,0,0,8,0,
-    0,0,67,0,0,0,115,210,0,0,0,116,0,160,1,161,
-    0,125,1,124,0,116,2,124,1,60,0,122,180,124,0,106,
-    3,143,126,1,0,124,0,106,4,100,1,107,2,115,46,124,
-    0,106,5,124,1,107,2,114,90,124,1,124,0,95,5,124,
-    0,4,0,106,4,100,2,55,0,2,0,95,4,87,0,100,
-    3,4,0,4,0,131,3,1,0,87,0,116,2,124,1,61,
-    0,100,4,83,0,124,0,160,6,161,0,114,110,116,7,100,
-    5,124,0,22,0,131,1,130,1,124,0,106,8,160,9,100,
-    6,161,1,114,136,124,0,4,0,106,10,100,2,55,0,2,
-    0,95,10,87,0,100,3,4,0,4,0,131,3,1,0,110,
-    16,49,0,115,156,48,0,1,0,1,0,1,0,89,0,1,
-    0,124,0,106,8,160,9,161,0,1,0,124,0,106,8,160,
-    11,161,0,1,0,113,18,87,0,116,2,124,1,61,0,110,
-    8,116,2,124,1,61,0,48,0,100,3,83,0,41,7,122,
-    185,10,32,32,32,32,32,32,32,32,65,99,113,117,105,114,
-    101,32,116,104,101,32,109,111,100,117,108,101,32,108,111,99,
-    107,46,32,32,73,102,32,97,32,112,111,116,101,110,116,105,
-    97,108,32,100,101,97,100,108,111,99,107,32,105,115,32,100,
-    101,116,101,99,116,101,100,44,10,32,32,32,32,32,32,32,
-    32,97,32,95,68,101,97,100,108,111,99,107,69,114,114,111,
-    114,32,105,115,32,114,97,105,115,101,100,46,10,32,32,32,
-    32,32,32,32,32,79,116,104,101,114,119,105,115,101,44,32,
-    116,104,101,32,108,111,99,107,32,105,115,32,97,108,119,97,
-    121,115,32,97,99,113,117,105,114,101,100,32,97,110,100,32,
-    84,114,117,101,32,105,115,32,114,101,116,117,114,110,101,100,
-    46,10,32,32,32,32,32,32,32,32,114,22,0,0,0,233,
-    1,0,0,0,78,84,122,23,100,101,97,100,108,111,99,107,
-    32,100,101,116,101,99,116,101,100,32,98,121,32,37,114,70,
-    41,12,114,23,0,0,0,114,32,0,0,0,114,34,0,0,
-    0,114,24,0,0,0,114,27,0,0,0,114,26,0,0,0,
-    114,38,0,0,0,114,19,0,0,0,114,25,0,0,0,218,
-    7,97,99,113,117,105,114,101,114,28,0,0,0,218,7,114,
-    101,108,101,97,115,101,169,2,114,30,0,0,0,114,37,0,
-    0,0,114,10,0,0,0,114,10,0,0,0,114,11,0,0,
-    0,114,40,0,0,0,87,0,0,0,115,34,0,0,0,0,
-    6,8,1,8,1,2,2,8,1,20,1,6,1,14,1,14,
-    9,6,247,4,1,8,1,12,1,12,1,44,2,10,1,14,
-    2,122,19,95,77,111,100,117,108,101,76,111,99,107,46,97,
-    99,113,117,105,114,101,99,1,0,0,0,0,0,0,0,0,
-    0,0,0,2,0,0,0,8,0,0,0,67,0,0,0,115,
-    142,0,0,0,116,0,160,1,161,0,125,1,124,0,106,2,
-    143,108,1,0,124,0,106,3,124,1,107,3,114,34,116,4,
-    100,1,131,1,130,1,124,0,106,5,100,2,107,4,115,48,
-    74,0,130,1,124,0,4,0,106,5,100,3,56,0,2,0,
-    95,5,124,0,106,5,100,2,107,2,114,108,100,0,124,0,
-    95,3,124,0,106,6,114,108,124,0,4,0,106,6,100,3,
-    56,0,2,0,95,6,124,0,106,7,160,8,161,0,1,0,
-    87,0,100,0,4,0,4,0,131,3,1,0,110,16,49,0,
-    115,128,48,0,1,0,1,0,1,0,89,0,1,0,100,0,
-    83,0,41,4,78,250,31,99,97,110,110,111,116,32,114,101,
-    108,101,97,115,101,32,117,110,45,97,99,113,117,105,114,101,
-    100,32,108,111,99,107,114,22,0,0,0,114,39,0,0,0,
-    41,9,114,23,0,0,0,114,32,0,0,0,114,24,0,0,
-    0,114,26,0,0,0,218,12,82,117,110,116,105,109,101,69,
-    114,114,111,114,114,27,0,0,0,114,28,0,0,0,114,25,
-    0,0,0,114,41,0,0,0,114,42,0,0,0,114,10,0,
-    0,0,114,10,0,0,0,114,11,0,0,0,114,41,0,0,
-    0,112,0,0,0,115,22,0,0,0,0,1,8,1,8,1,
-    10,1,8,1,14,1,14,1,10,1,6,1,6,1,14,1,
-    122,19,95,77,111,100,117,108,101,76,111,99,107,46,114,101,
-    108,101,97,115,101,99,1,0,0,0,0,0,0,0,0,0,
-    0,0,1,0,0,0,5,0,0,0,67,0,0,0,115,18,
-    0,0,0,100,1,160,0,124,0,106,1,116,2,124,0,131,
-    1,161,2,83,0,41,2,78,122,23,95,77,111,100,117,108,
-    101,76,111,99,107,40,123,33,114,125,41,32,97,116,32,123,
-    125,169,3,218,6,102,111,114,109,97,116,114,17,0,0,0,
-    218,2,105,100,169,1,114,30,0,0,0,114,10,0,0,0,
-    114,10,0,0,0,114,11,0,0,0,218,8,95,95,114,101,
-    112,114,95,95,125,0,0,0,115,2,0,0,0,0,1,122,
-    20,95,77,111,100,117,108,101,76,111,99,107,46,95,95,114,
-    101,112,114,95,95,78,41,9,114,1,0,0,0,114,0,0,
-    0,0,114,2,0,0,0,114,3,0,0,0,114,31,0,0,
-    0,114,38,0,0,0,114,40,0,0,0,114,41,0,0,0,
-    114,49,0,0,0,114,10,0,0,0,114,10,0,0,0,114,
-    10,0,0,0,114,11,0,0,0,114,20,0,0,0,52,0,
-    0,0,115,12,0,0,0,8,1,4,5,8,8,8,21,8,
-    25,8,13,114,20,0,0,0,99,0,0,0,0,0,0,0,
-    0,0,0,0,0,0,0,0,0,2,0,0,0,64,0,0,
-    0,115,48,0,0,0,101,0,90,1,100,0,90,2,100,1,
-    90,3,100,2,100,3,132,0,90,4,100,4,100,5,132,0,
-    90,5,100,6,100,7,132,0,90,6,100,8,100,9,132,0,
-    90,7,100,10,83,0,41,11,218,16,95,68,117,109,109,121,
-    77,111,100,117,108,101,76,111,99,107,122,86,65,32,115,105,
-    109,112,108,101,32,95,77,111,100,117,108,101,76,111,99,107,
-    32,101,113,117,105,118,97,108,101,110,116,32,102,111,114,32,
-    80,121,116,104,111,110,32,98,117,105,108,100,115,32,119,105,
-    116,104,111,117,116,10,32,32,32,32,109,117,108,116,105,45,
-    116,104,114,101,97,100,105,110,103,32,115,117,112,112,111,114,
-    116,46,99,2,0,0,0,0,0,0,0,0,0,0,0,2,
-    0,0,0,2,0,0,0,67,0,0,0,115,16,0,0,0,
-    124,1,124,0,95,0,100,1,124,0,95,1,100,0,83,0,
-    114,21,0,0,0,41,2,114,17,0,0,0,114,27,0,0,
-    0,114,29,0,0,0,114,10,0,0,0,114,10,0,0,0,
-    114,11,0,0,0,114,31,0,0,0,133,0,0,0,115,4,
-    0,0,0,0,1,6,1,122,25,95,68,117,109,109,121,77,
-    111,100,117,108,101,76,111,99,107,46,95,95,105,110,105,116,
-    95,95,99,1,0,0,0,0,0,0,0,0,0,0,0,1,
-    0,0,0,3,0,0,0,67,0,0,0,115,18,0,0,0,
-    124,0,4,0,106,0,100,1,55,0,2,0,95,0,100,2,
-    83,0,41,3,78,114,39,0,0,0,84,41,1,114,27,0,
-    0,0,114,48,0,0,0,114,10,0,0,0,114,10,0,0,
-    0,114,11,0,0,0,114,40,0,0,0,137,0,0,0,115,
-    4,0,0,0,0,1,14,1,122,24,95,68,117,109,109,121,
-    77,111,100,117,108,101,76,111,99,107,46,97,99,113,117,105,
-    114,101,99,1,0,0,0,0,0,0,0,0,0,0,0,1,
-    0,0,0,3,0,0,0,67,0,0,0,115,36,0,0,0,
-    124,0,106,0,100,1,107,2,114,18,116,1,100,2,131,1,
-    130,1,124,0,4,0,106,0,100,3,56,0,2,0,95,0,
-    100,0,83,0,41,4,78,114,22,0,0,0,114,43,0,0,
-    0,114,39,0,0,0,41,2,114,27,0,0,0,114,44,0,
-    0,0,114,48,0,0,0,114,10,0,0,0,114,10,0,0,
-    0,114,11,0,0,0,114,41,0,0,0,141,0,0,0,115,
-    6,0,0,0,0,1,10,1,8,1,122,24,95,68,117,109,
-    109,121,77,111,100,117,108,101,76,111,99,107,46,114,101,108,
-    101,97,115,101,99,1,0,0,0,0,0,0,0,0,0,0,
-    0,1,0,0,0,5,0,0,0,67,0,0,0,115,18,0,
-    0,0,100,1,160,0,124,0,106,1,116,2,124,0,131,1,
-    161,2,83,0,41,2,78,122,28,95,68,117,109,109,121,77,
-    111,100,117,108,101,76,111,99,107,40,123,33,114,125,41,32,
-    97,116,32,123,125,114,45,0,0,0,114,48,0,0,0,114,
-    10,0,0,0,114,10,0,0,0,114,11,0,0,0,114,49,
-    0,0,0,146,0,0,0,115,2,0,0,0,0,1,122,25,
+    0,1,0,0,0,64,0,0,0,115,12,0,0,0,101,0,
+    90,1,100,0,90,2,100,1,83,0,41,2,218,14,95,68,
+    101,97,100,108,111,99,107,69,114,114,111,114,78,41,3,114,
+    9,0,0,0,114,8,0,0,0,114,1,0,0,0,114,5,
+    0,0,0,114,5,0,0,0,114,5,0,0,0,114,6,0,
+    0,0,114,22,0,0,0,61,0,0,0,115,4,0,0,0,
+    8,0,4,1,114,22,0,0,0,99,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,2,0,0,0,64,0,
+    0,0,115,56,0,0,0,101,0,90,1,100,0,90,2,100,
+    1,90,3,100,2,100,3,132,0,90,4,100,4,100,5,132,
+    0,90,5,100,6,100,7,132,0,90,6,100,8,100,9,132,
+    0,90,7,100,10,100,11,132,0,90,8,100,12,83,0,41,
+    13,218,11,95,77,111,100,117,108,101,76,111,99,107,122,169,
+    65,32,114,101,99,117,114,115,105,118,101,32,108,111,99,107,
+    32,105,109,112,108,101,109,101,110,116,97,116,105,111,110,32,
+    119,104,105,99,104,32,105,115,32,97,98,108,101,32,116,111,
+    32,100,101,116,101,99,116,32,100,101,97,100,108,111,99,107,
+    115,10,32,32,32,32,40,101,46,103,46,32,116,104,114,101,
+    97,100,32,49,32,116,114,121,105,110,103,32,116,111,32,116,
+    97,107,101,32,108,111,99,107,115,32,65,32,116,104,101,110,
+    32,66,44,32,97,110,100,32,116,104,114,101,97,100,32,50,
+    32,116,114,121,105,110,103,32,116,111,10,32,32,32,32,116,
+    97,107,101,32,108,111,99,107,115,32,66,32,116,104,101,110,
+    32,65,41,46,10,32,32,32,32,99,2,0,0,0,0,0,
+    0,0,0,0,0,0,2,0,0,0,2,0,0,0,67,0,
+    0,0,115,48,0,0,0,116,0,160,1,161,0,124,0,95,
+    2,116,0,160,1,161,0,124,0,95,3,124,1,124,0,95,
+    4,100,0,124,0,95,5,100,1,124,0,95,6,100,1,124,
+    0,95,7,100,0,83,0,169,2,78,233,0,0,0,0,41,
+    8,218,7,95,116,104,114,101,97,100,90,13,97,108,108,111,
+    99,97,116,101,95,108,111,99,107,218,4,108,111,99,107,218,
+    6,119,97,107,101,117,112,114,20,0,0,0,218,5,111,119,
+    110,101,114,218,5,99,111,117,110,116,218,7,119,97,105,116,
+    101,114,115,169,2,218,4,115,101,108,102,114,20,0,0,0,
+    114,5,0,0,0,114,5,0,0,0,114,6,0,0,0,218,
+    8,95,95,105,110,105,116,95,95,71,0,0,0,115,12,0,
+    0,0,10,1,10,1,6,1,6,1,6,1,10,1,122,20,
+    95,77,111,100,117,108,101,76,111,99,107,46,95,95,105,110,
+    105,116,95,95,99,1,0,0,0,0,0,0,0,0,0,0,
+    0,5,0,0,0,3,0,0,0,67,0,0,0,115,86,0,
+    0,0,116,0,160,1,161,0,125,1,124,0,106,2,125,2,
+    116,3,131,0,125,3,9,0,116,4,160,5,124,2,161,1,
+    125,4,124,4,100,0,117,0,114,22,100,2,83,0,124,4,
+    106,2,125,2,124,2,124,1,107,2,114,31,100,1,83,0,
+    124,2,124,3,118,0,114,37,100,2,83,0,124,3,160,6,
+    124,2,161,1,1,0,113,11,41,3,78,84,70,41,7,114,
+    26,0,0,0,218,9,103,101,116,95,105,100,101,110,116,114,
+    29,0,0,0,218,3,115,101,116,218,12,95,98,108,111,99,
+    107,105,110,103,95,111,110,218,3,103,101,116,218,3,97,100,
+    100,41,5,114,33,0,0,0,90,2,109,101,218,3,116,105,
+    100,90,4,115,101,101,110,114,27,0,0,0,114,5,0,0,
+    0,114,5,0,0,0,114,6,0,0,0,218,12,104,97,115,
+    95,100,101,97,100,108,111,99,107,79,0,0,0,115,28,0,
+    0,0,8,2,6,1,6,1,2,1,10,1,8,1,4,1,
+    6,1,8,1,4,1,8,1,4,6,10,1,2,242,122,24,
+    95,77,111,100,117,108,101,76,111,99,107,46,104,97,115,95,
+    100,101,97,100,108,111,99,107,99,1,0,0,0,0,0,0,
+    0,0,0,0,0,2,0,0,0,8,0,0,0,67,0,0,
+    0,115,200,0,0,0,116,0,160,1,161,0,125,1,124,0,
+    116,2,124,1,60,0,122,87,9,0,124,0,106,3,143,64,
+    1,0,124,0,106,4,100,2,107,2,115,24,124,0,106,5,
+    124,1,107,2,114,47,124,1,124,0,95,5,124,0,4,0,
+    106,4,100,3,55,0,2,0,95,4,9,0,87,0,100,4,
+    4,0,4,0,131,3,1,0,87,0,116,2,124,1,61,0,
+    100,1,83,0,124,0,160,6,161,0,114,57,116,7,100,5,
+    124,0,22,0,131,1,130,1,124,0,106,8,160,9,100,6,
+    161,1,114,70,124,0,4,0,106,10,100,3,55,0,2,0,
+    95,10,87,0,100,4,4,0,4,0,131,3,1,0,110,8,
+    49,0,115,80,119,1,1,0,1,0,1,0,89,0,1,0,
+    124,0,106,8,160,9,161,0,1,0,124,0,106,8,160,11,
+    161,0,1,0,113,10,116,2,124,1,61,0,119,0,41,7,
+    122,185,10,32,32,32,32,32,32,32,32,65,99,113,117,105,
+    114,101,32,116,104,101,32,109,111,100,117,108,101,32,108,111,
+    99,107,46,32,32,73,102,32,97,32,112,111,116,101,110,116,
+    105,97,108,32,100,101,97,100,108,111,99,107,32,105,115,32,
+    100,101,116,101,99,116,101,100,44,10,32,32,32,32,32,32,
+    32,32,97,32,95,68,101,97,100,108,111,99,107,69,114,114,
+    111,114,32,105,115,32,114,97,105,115,101,100,46,10,32,32,
+    32,32,32,32,32,32,79,116,104,101,114,119,105,115,101,44,
+    32,116,104,101,32,108,111,99,107,32,105,115,32,97,108,119,
+    97,121,115,32,97,99,113,117,105,114,101,100,32,97,110,100,
+    32,84,114,117,101,32,105,115,32,114,101,116,117,114,110,101,
+    100,46,10,32,32,32,32,32,32,32,32,84,114,25,0,0,
+    0,233,1,0,0,0,78,122,23,100,101,97,100,108,111,99,
+    107,32,100,101,116,101,99,116,101,100,32,98,121,32,37,114,
+    70,41,12,114,26,0,0,0,114,35,0,0,0,114,37,0,
+    0,0,114,27,0,0,0,114,30,0,0,0,114,29,0,0,
+    0,114,41,0,0,0,114,22,0,0,0,114,28,0,0,0,
+    218,7,97,99,113,117,105,114,101,114,31,0,0,0,218,7,
+    114,101,108,101,97,115,101,169,2,114,33,0,0,0,114,40,
+    0,0,0,114,5,0,0,0,114,5,0,0,0,114,6,0,
+    0,0,114,43,0,0,0,100,0,0,0,115,42,0,0,0,
+    8,6,8,1,2,1,2,1,8,1,20,1,6,1,14,1,
+    2,1,14,252,10,13,8,248,12,1,12,1,14,1,2,128,
+    28,248,10,10,10,1,2,244,8,14,122,19,95,77,111,100,
+    117,108,101,76,111,99,107,46,97,99,113,117,105,114,101,99,
+    1,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,
+    8,0,0,0,67,0,0,0,115,176,0,0,0,116,0,160,
+    1,161,0,125,1,124,0,106,2,143,71,1,0,124,0,106,
+    3,124,1,107,3,114,17,116,4,100,1,131,1,130,1,124,
+    0,106,5,100,2,107,4,115,24,74,0,130,1,124,0,4,
+    0,106,5,100,3,56,0,2,0,95,5,124,0,106,5,100,
+    2,107,2,114,62,100,0,124,0,95,3,124,0,106,6,114,
+    70,124,0,4,0,106,6,100,3,56,0,2,0,95,6,124,
+    0,106,7,160,8,161,0,1,0,87,0,100,0,4,0,4,
+    0,131,3,1,0,100,0,83,0,87,0,100,0,4,0,4,
+    0,131,3,1,0,100,0,83,0,87,0,100,0,4,0,4,
+    0,131,3,1,0,100,0,83,0,49,0,115,81,119,1,1,
+    0,1,0,1,0,89,0,1,0,100,0,83,0,41,4,78,
+    250,31,99,97,110,110,111,116,32,114,101,108,101,97,115,101,
+    32,117,110,45,97,99,113,117,105,114,101,100,32,108,111,99,
+    107,114,25,0,0,0,114,42,0,0,0,41,9,114,26,0,
+    0,0,114,35,0,0,0,114,27,0,0,0,114,29,0,0,
+    0,218,12,82,117,110,116,105,109,101,69,114,114,111,114,114,
+    30,0,0,0,114,31,0,0,0,114,28,0,0,0,114,44,
+    0,0,0,114,45,0,0,0,114,5,0,0,0,114,5,0,
+    0,0,114,6,0,0,0,114,44,0,0,0,125,0,0,0,
+    115,32,0,0,0,8,1,8,1,10,1,8,1,14,1,14,
+    1,10,1,6,1,6,1,14,1,12,1,14,247,2,5,14,
+    251,2,7,34,249,122,19,95,77,111,100,117,108,101,76,111,
+    99,107,46,114,101,108,101,97,115,101,99,1,0,0,0,0,
+    0,0,0,0,0,0,0,1,0,0,0,5,0,0,0,67,
+    0,0,0,243,18,0,0,0,100,1,160,0,124,0,106,1,
+    116,2,124,0,131,1,161,2,83,0,41,2,78,122,23,95,
+    77,111,100,117,108,101,76,111,99,107,40,123,33,114,125,41,
+    32,97,116,32,123,125,169,3,218,6,102,111,114,109,97,116,
+    114,20,0,0,0,218,2,105,100,169,1,114,33,0,0,0,
+    114,5,0,0,0,114,5,0,0,0,114,6,0,0,0,218,
+    8,95,95,114,101,112,114,95,95,138,0,0,0,243,2,0,
+    0,0,18,1,122,20,95,77,111,100,117,108,101,76,111,99,
+    107,46,95,95,114,101,112,114,95,95,78,41,9,114,9,0,
+    0,0,114,8,0,0,0,114,1,0,0,0,114,10,0,0,
+    0,114,34,0,0,0,114,41,0,0,0,114,43,0,0,0,
+    114,44,0,0,0,114,53,0,0,0,114,5,0,0,0,114,
+    5,0,0,0,114,5,0,0,0,114,6,0,0,0,114,23,
+    0,0,0,65,0,0,0,115,14,0,0,0,8,0,4,1,
+    8,5,8,8,8,21,8,25,12,13,114,23,0,0,0,99,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    2,0,0,0,64,0,0,0,115,48,0,0,0,101,0,90,
+    1,100,0,90,2,100,1,90,3,100,2,100,3,132,0,90,
+    4,100,4,100,5,132,0,90,5,100,6,100,7,132,0,90,
+    6,100,8,100,9,132,0,90,7,100,10,83,0,41,11,218,
+    16,95,68,117,109,109,121,77,111,100,117,108,101,76,111,99,
+    107,122,86,65,32,115,105,109,112,108,101,32,95,77,111,100,
+    117,108,101,76,111,99,107,32,101,113,117,105,118,97,108,101,
+    110,116,32,102,111,114,32,80,121,116,104,111,110,32,98,117,
+    105,108,100,115,32,119,105,116,104,111,117,116,10,32,32,32,
+    32,109,117,108,116,105,45,116,104,114,101,97,100,105,110,103,
+    32,115,117,112,112,111,114,116,46,99,2,0,0,0,0,0,
+    0,0,0,0,0,0,2,0,0,0,2,0,0,0,67,0,
+    0,0,115,16,0,0,0,124,1,124,0,95,0,100,1,124,
+    0,95,1,100,0,83,0,114,24,0,0,0,41,2,114,20,
+    0,0,0,114,30,0,0,0,114,32,0,0,0,114,5,0,
+    0,0,114,5,0,0,0,114,6,0,0,0,114,34,0,0,
+    0,146,0,0,0,243,4,0,0,0,6,1,10,1,122,25,
     95,68,117,109,109,121,77,111,100,117,108,101,76,111,99,107,
-    46,95,95,114,101,112,114,95,95,78,41,8,114,1,0,0,
-    0,114,0,0,0,0,114,2,0,0,0,114,3,0,0,0,
-    114,31,0,0,0,114,40,0,0,0,114,41,0,0,0,114,
-    49,0,0,0,114,10,0,0,0,114,10,0,0,0,114,10,
-    0,0,0,114,11,0,0,0,114,50,0,0,0,129,0,0,
-    0,115,10,0,0,0,8,1,4,3,8,4,8,4,8,5,
-    114,50,0,0,0,99,0,0,0,0,0,0,0,0,0,0,
-    0,0,0,0,0,0,2,0,0,0,64,0,0,0,115,36,
-    0,0,0,101,0,90,1,100,0,90,2,100,1,100,2,132,
-    0,90,3,100,3,100,4,132,0,90,4,100,5,100,6,132,
-    0,90,5,100,7,83,0,41,8,218,18,95,77,111,100,117,
-    108,101,76,111,99,107,77,97,110,97,103,101,114,99,2,0,
-    0,0,0,0,0,0,0,0,0,0,2,0,0,0,2,0,
-    0,0,67,0,0,0,115,16,0,0,0,124,1,124,0,95,
-    0,100,0,124,0,95,1,100,0,83,0,114,13,0,0,0,
-    41,2,218,5,95,110,97,109,101,218,5,95,108,111,99,107,
-    114,29,0,0,0,114,10,0,0,0,114,10,0,0,0,114,
-    11,0,0,0,114,31,0,0,0,152,0,0,0,115,4,0,
-    0,0,0,1,6,1,122,27,95,77,111,100,117,108,101,76,
-    111,99,107,77,97,110,97,103,101,114,46,95,95,105,110,105,
-    116,95,95,99,1,0,0,0,0,0,0,0,0,0,0,0,
-    1,0,0,0,2,0,0,0,67,0,0,0,115,26,0,0,
-    0,116,0,124,0,106,1,131,1,124,0,95,2,124,0,106,
-    2,160,3,161,0,1,0,100,0,83,0,114,13,0,0,0,
-    41,4,218,16,95,103,101,116,95,109,111,100,117,108,101,95,
-    108,111,99,107,114,52,0,0,0,114,53,0,0,0,114,40,
-    0,0,0,114,48,0,0,0,114,10,0,0,0,114,10,0,
-    0,0,114,11,0,0,0,218,9,95,95,101,110,116,101,114,
-    95,95,156,0,0,0,115,4,0,0,0,0,1,12,1,122,
-    28,95,77,111,100,117,108,101,76,111,99,107,77,97,110,97,
-    103,101,114,46,95,95,101,110,116,101,114,95,95,99,1,0,
-    0,0,0,0,0,0,0,0,0,0,3,0,0,0,2,0,
-    0,0,79,0,0,0,115,14,0,0,0,124,0,106,0,160,
-    1,161,0,1,0,100,0,83,0,114,13,0,0,0,41,2,
-    114,53,0,0,0,114,41,0,0,0,41,3,114,30,0,0,
-    0,218,4,97,114,103,115,90,6,107,119,97,114,103,115,114,
-    10,0,0,0,114,10,0,0,0,114,11,0,0,0,218,8,
-    95,95,101,120,105,116,95,95,160,0,0,0,115,2,0,0,
-    0,0,1,122,27,95,77,111,100,117,108,101,76,111,99,107,
-    77,97,110,97,103,101,114,46,95,95,101,120,105,116,95,95,
-    78,41,6,114,1,0,0,0,114,0,0,0,0,114,2,0,
-    0,0,114,31,0,0,0,114,55,0,0,0,114,57,0,0,
-    0,114,10,0,0,0,114,10,0,0,0,114,10,0,0,0,
-    114,11,0,0,0,114,51,0,0,0,150,0,0,0,115,6,
-    0,0,0,8,2,8,4,8,4,114,51,0,0,0,99,1,
-    0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,8,
-    0,0,0,67,0,0,0,115,136,0,0,0,116,0,160,1,
-    161,0,1,0,122,112,122,14,116,2,124,0,25,0,131,0,
-    125,1,87,0,110,22,4,0,116,3,121,46,1,0,1,0,
-    1,0,100,1,125,1,89,0,110,2,48,0,124,1,100,1,
-    117,0,114,110,116,4,100,1,117,0,114,74,116,5,124,0,
-    131,1,125,1,110,8,116,6,124,0,131,1,125,1,124,0,
-    102,1,100,2,100,3,132,1,125,2,116,7,160,8,124,1,
-    124,2,161,2,116,2,124,0,60,0,87,0,116,0,160,9,
-    161,0,1,0,110,10,116,0,160,9,161,0,1,0,48,0,
-    124,1,83,0,41,4,122,139,71,101,116,32,111,114,32,99,
-    114,101,97,116,101,32,116,104,101,32,109,111,100,117,108,101,
-    32,108,111,99,107,32,102,111,114,32,97,32,103,105,118,101,
-    110,32,109,111,100,117,108,101,32,110,97,109,101,46,10,10,
-    32,32,32,32,65,99,113,117,105,114,101,47,114,101,108,101,
-    97,115,101,32,105,110,116,101,114,110,97,108,108,121,32,116,
-    104,101,32,103,108,111,98,97,108,32,105,109,112,111,114,116,
-    32,108,111,99,107,32,116,111,32,112,114,111,116,101,99,116,
-    10,32,32,32,32,95,109,111,100,117,108,101,95,108,111,99,
-    107,115,46,78,99,2,0,0,0,0,0,0,0,0,0,0,
-    0,2,0,0,0,8,0,0,0,83,0,0,0,115,56,0,
-    0,0,116,0,160,1,161,0,1,0,122,32,116,2,160,3,
-    124,1,161,1,124,0,117,0,114,30,116,2,124,1,61,0,
-    87,0,116,0,160,4,161,0,1,0,110,10,116,0,160,4,
-    161,0,1,0,48,0,100,0,83,0,114,13,0,0,0,41,
-    5,218,4,95,105,109,112,218,12,97,99,113,117,105,114,101,
-    95,108,111,99,107,218,13,95,109,111,100,117,108,101,95,108,
-    111,99,107,115,114,35,0,0,0,218,12,114,101,108,101,97,
-    115,101,95,108,111,99,107,41,2,218,3,114,101,102,114,17,
-    0,0,0,114,10,0,0,0,114,10,0,0,0,114,11,0,
-    0,0,218,2,99,98,185,0,0,0,115,10,0,0,0,0,
-    1,8,1,2,4,14,1,8,2,122,28,95,103,101,116,95,
-    109,111,100,117,108,101,95,108,111,99,107,46,60,108,111,99,
-    97,108,115,62,46,99,98,41,10,114,58,0,0,0,114,59,
-    0,0,0,114,60,0,0,0,218,8,75,101,121,69,114,114,
-    111,114,114,23,0,0,0,114,50,0,0,0,114,20,0,0,
-    0,218,8,95,119,101,97,107,114,101,102,114,62,0,0,0,
-    114,61,0,0,0,41,3,114,17,0,0,0,114,24,0,0,
-    0,114,63,0,0,0,114,10,0,0,0,114,10,0,0,0,
-    114,11,0,0,0,114,54,0,0,0,166,0,0,0,115,28,
-    0,0,0,0,6,8,1,2,1,2,1,14,1,12,1,10,
-    2,8,1,8,1,10,2,8,2,12,11,18,2,20,2,114,
-    54,0,0,0,99,1,0,0,0,0,0,0,0,0,0,0,
-    0,2,0,0,0,8,0,0,0,67,0,0,0,115,52,0,
-    0,0,116,0,124,0,131,1,125,1,122,12,124,1,160,1,
-    161,0,1,0,87,0,110,18,4,0,116,2,121,38,1,0,
-    1,0,1,0,89,0,110,10,48,0,124,1,160,3,161,0,
-    1,0,100,1,83,0,41,2,122,189,65,99,113,117,105,114,
-    101,115,32,116,104,101,110,32,114,101,108,101,97,115,101,115,
-    32,116,104,101,32,109,111,100,117,108,101,32,108,111,99,107,
-    32,102,111,114,32,97,32,103,105,118,101,110,32,109,111,100,
-    117,108,101,32,110,97,109,101,46,10,10,32,32,32,32,84,
-    104,105,115,32,105,115,32,117,115,101,100,32,116,111,32,101,
-    110,115,117,114,101,32,97,32,109,111,100,117,108,101,32,105,
-    115,32,99,111,109,112,108,101,116,101,108,121,32,105,110,105,
-    116,105,97,108,105,122,101,100,44,32,105,110,32,116,104,101,
-    10,32,32,32,32,101,118,101,110,116,32,105,116,32,105,115,
-    32,98,101,105,110,103,32,105,109,112,111,114,116,101,100,32,
-    98,121,32,97,110,111,116,104,101,114,32,116,104,114,101,97,
-    100,46,10,32,32,32,32,78,41,4,114,54,0,0,0,114,
-    40,0,0,0,114,19,0,0,0,114,41,0,0,0,41,2,
-    114,17,0,0,0,114,24,0,0,0,114,10,0,0,0,114,
-    10,0,0,0,114,11,0,0,0,218,19,95,108,111,99,107,
-    95,117,110,108,111,99,107,95,109,111,100,117,108,101,203,0,
-    0,0,115,12,0,0,0,0,6,8,1,2,1,12,1,12,
-    3,6,2,114,66,0,0,0,99,1,0,0,0,0,0,0,
-    0,0,0,0,0,3,0,0,0,4,0,0,0,79,0,0,
-    0,115,14,0,0,0,124,0,124,1,105,0,124,2,164,1,
-    142,1,83,0,41,1,97,46,1,0,0,114,101,109,111,118,
-    101,95,105,109,112,111,114,116,108,105,98,95,102,114,97,109,
-    101,115,32,105,110,32,105,109,112,111,114,116,46,99,32,119,
-    105,108,108,32,97,108,119,97,121,115,32,114,101,109,111,118,
-    101,32,115,101,113,117,101,110,99,101,115,10,32,32,32,32,
-    111,102,32,105,109,112,111,114,116,108,105,98,32,102,114,97,
-    109,101,115,32,116,104,97,116,32,101,110,100,32,119,105,116,
-    104,32,97,32,99,97,108,108,32,116,111,32,116,104,105,115,
-    32,102,117,110,99,116,105,111,110,10,10,32,32,32,32,85,
-    115,101,32,105,116,32,105,110,115,116,101,97,100,32,111,102,
-    32,97,32,110,111,114,109,97,108,32,99,97,108,108,32,105,
-    110,32,112,108,97,99,101,115,32,119,104,101,114,101,32,105,
-    110,99,108,117,100,105,110,103,32,116,104,101,32,105,109,112,
-    111,114,116,108,105,98,10,32,32,32,32,102,114,97,109,101,
-    115,32,105,110,116,114,111,100,117,99,101,115,32,117,110,119,
-    97,110,116,101,100,32,110,111,105,115,101,32,105,110,116,111,
-    32,116,104,101,32,116,114,97,99,101,98,97,99,107,32,40,
-    101,46,103,46,32,119,104,101,110,32,101,120,101,99,117,116,
-    105,110,103,10,32,32,32,32,109,111,100,117,108,101,32,99,
-    111,100,101,41,10,32,32,32,32,114,10,0,0,0,41,3,
-    218,1,102,114,56,0,0,0,90,4,107,119,100,115,114,10,
-    0,0,0,114,10,0,0,0,114,11,0,0,0,218,25,95,
-    99,97,108,108,95,119,105,116,104,95,102,114,97,109,101,115,
-    95,114,101,109,111,118,101,100,220,0,0,0,115,2,0,0,
-    0,0,8,114,68,0,0,0,114,39,0,0,0,41,1,218,
-    9,118,101,114,98,111,115,105,116,121,99,1,0,0,0,0,
-    0,0,0,1,0,0,0,3,0,0,0,4,0,0,0,71,
-    0,0,0,115,54,0,0,0,116,0,106,1,106,2,124,1,
-    107,5,114,50,124,0,160,3,100,1,161,1,115,30,100,2,
-    124,0,23,0,125,0,116,4,124,0,106,5,124,2,142,0,
-    116,0,106,6,100,3,141,2,1,0,100,4,83,0,41,5,
-    122,61,80,114,105,110,116,32,116,104,101,32,109,101,115,115,
-    97,103,101,32,116,111,32,115,116,100,101,114,114,32,105,102,
-    32,45,118,47,80,89,84,72,79,78,86,69,82,66,79,83,
-    69,32,105,115,32,116,117,114,110,101,100,32,111,110,46,41,
-    2,250,1,35,122,7,105,109,112,111,114,116,32,122,2,35,
-    32,41,1,90,4,102,105,108,101,78,41,7,114,15,0,0,
-    0,218,5,102,108,97,103,115,218,7,118,101,114,98,111,115,
-    101,218,10,115,116,97,114,116,115,119,105,116,104,218,5,112,
-    114,105,110,116,114,46,0,0,0,218,6,115,116,100,101,114,
-    114,41,3,218,7,109,101,115,115,97,103,101,114,69,0,0,
-    0,114,56,0,0,0,114,10,0,0,0,114,10,0,0,0,
-    114,11,0,0,0,218,16,95,118,101,114,98,111,115,101,95,
-    109,101,115,115,97,103,101,231,0,0,0,115,8,0,0,0,
-    0,2,12,1,10,1,8,1,114,77,0,0,0,99,1,0,
-    0,0,0,0,0,0,0,0,0,0,2,0,0,0,3,0,
-    0,0,3,0,0,0,115,26,0,0,0,135,0,102,1,100,
-    1,100,2,132,8,125,1,116,0,124,1,136,0,131,2,1,
-    0,124,1,83,0,41,3,122,49,68,101,99,111,114,97,116,
-    111,114,32,116,111,32,118,101,114,105,102,121,32,116,104,101,
-    32,110,97,109,101,100,32,109,111,100,117,108,101,32,105,115,
-    32,98,117,105,108,116,45,105,110,46,99,2,0,0,0,0,
-    0,0,0,0,0,0,0,2,0,0,0,4,0,0,0,19,
-    0,0,0,115,38,0,0,0,124,1,116,0,106,1,118,1,
-    114,28,116,2,100,1,160,3,124,1,161,1,124,1,100,2,
-    141,2,130,1,136,0,124,0,124,1,131,2,83,0,41,3,
-    78,250,29,123,33,114,125,32,105,115,32,110,111,116,32,97,
-    32,98,117,105,108,116,45,105,110,32,109,111,100,117,108,101,
-    114,16,0,0,0,41,4,114,15,0,0,0,218,20,98,117,
-    105,108,116,105,110,95,109,111,100,117,108,101,95,110,97,109,
-    101,115,218,11,73,109,112,111,114,116,69,114,114,111,114,114,
-    46,0,0,0,169,2,114,30,0,0,0,218,8,102,117,108,
-    108,110,97,109,101,169,1,218,3,102,120,110,114,10,0,0,
-    0,114,11,0,0,0,218,25,95,114,101,113,117,105,114,101,
-    115,95,98,117,105,108,116,105,110,95,119,114,97,112,112,101,
-    114,241,0,0,0,115,10,0,0,0,0,1,10,1,10,1,
-    2,255,6,2,122,52,95,114,101,113,117,105,114,101,115,95,
-    98,117,105,108,116,105,110,46,60,108,111,99,97,108,115,62,
-    46,95,114,101,113,117,105,114,101,115,95,98,117,105,108,116,
-    105,110,95,119,114,97,112,112,101,114,169,1,114,12,0,0,
-    0,41,2,114,84,0,0,0,114,85,0,0,0,114,10,0,
-    0,0,114,83,0,0,0,114,11,0,0,0,218,17,95,114,
-    101,113,117,105,114,101,115,95,98,117,105,108,116,105,110,239,
-    0,0,0,115,6,0,0,0,0,2,12,5,10,1,114,87,
-    0,0,0,99,1,0,0,0,0,0,0,0,0,0,0,0,
-    2,0,0,0,3,0,0,0,3,0,0,0,115,26,0,0,
-    0,135,0,102,1,100,1,100,2,132,8,125,1,116,0,124,
-    1,136,0,131,2,1,0,124,1,83,0,41,3,122,47,68,
-    101,99,111,114,97,116,111,114,32,116,111,32,118,101,114,105,
-    102,121,32,116,104,101,32,110,97,109,101,100,32,109,111,100,
-    117,108,101,32,105,115,32,102,114,111,122,101,110,46,99,2,
-    0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,4,
-    0,0,0,19,0,0,0,115,38,0,0,0,116,0,160,1,
-    124,1,161,1,115,28,116,2,100,1,160,3,124,1,161,1,
-    124,1,100,2,141,2,130,1,136,0,124,0,124,1,131,2,
-    83,0,169,3,78,122,27,123,33,114,125,32,105,115,32,110,
-    111,116,32,97,32,102,114,111,122,101,110,32,109,111,100,117,
-    108,101,114,16,0,0,0,41,4,114,58,0,0,0,218,9,
-    105,115,95,102,114,111,122,101,110,114,80,0,0,0,114,46,
-    0,0,0,114,81,0,0,0,114,83,0,0,0,114,10,0,
-    0,0,114,11,0,0,0,218,24,95,114,101,113,117,105,114,
-    101,115,95,102,114,111,122,101,110,95,119,114,97,112,112,101,
-    114,252,0,0,0,115,10,0,0,0,0,1,10,1,10,1,
-    2,255,6,2,122,50,95,114,101,113,117,105,114,101,115,95,
-    102,114,111,122,101,110,46,60,108,111,99,97,108,115,62,46,
-    95,114,101,113,117,105,114,101,115,95,102,114,111,122,101,110,
-    95,119,114,97,112,112,101,114,114,86,0,0,0,41,2,114,
-    84,0,0,0,114,90,0,0,0,114,10,0,0,0,114,83,
-    0,0,0,114,11,0,0,0,218,16,95,114,101,113,117,105,
-    114,101,115,95,102,114,111,122,101,110,250,0,0,0,115,6,
-    0,0,0,0,2,12,5,10,1,114,91,0,0,0,99,2,
-    0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,3,
-    0,0,0,67,0,0,0,115,62,0,0,0,116,0,124,1,
-    124,0,131,2,125,2,124,1,116,1,106,2,118,0,114,50,
-    116,1,106,2,124,1,25,0,125,3,116,3,124,2,124,3,
-    131,2,1,0,116,1,106,2,124,1,25,0,83,0,116,4,
-    124,2,131,1,83,0,100,1,83,0,41,2,122,128,76,111,
-    97,100,32,116,104,101,32,115,112,101,99,105,102,105,101,100,
-    32,109,111,100,117,108,101,32,105,110,116,111,32,115,121,115,
-    46,109,111,100,117,108,101,115,32,97,110,100,32,114,101,116,
-    117,114,110,32,105,116,46,10,10,32,32,32,32,84,104,105,
-    115,32,109,101,116,104,111,100,32,105,115,32,100,101,112,114,
-    101,99,97,116,101,100,46,32,32,85,115,101,32,108,111,97,
-    100,101,114,46,101,120,101,99,95,109,111,100,117,108,101,32,
-    105,110,115,116,101,97,100,46,10,10,32,32,32,32,78,41,
-    5,218,16,115,112,101,99,95,102,114,111,109,95,108,111,97,
-    100,101,114,114,15,0,0,0,218,7,109,111,100,117,108,101,
-    115,218,5,95,101,120,101,99,218,5,95,108,111,97,100,41,
-    4,114,30,0,0,0,114,82,0,0,0,218,4,115,112,101,
-    99,218,6,109,111,100,117,108,101,114,10,0,0,0,114,10,
-    0,0,0,114,11,0,0,0,218,17,95,108,111,97,100,95,
-    109,111,100,117,108,101,95,115,104,105,109,6,1,0,0,115,
-    12,0,0,0,0,6,10,1,10,1,10,1,10,1,10,2,
-    114,98,0,0,0,99,1,0,0,0,0,0,0,0,0,0,
-    0,0,5,0,0,0,8,0,0,0,67,0,0,0,115,218,
-    0,0,0,116,0,124,0,100,1,100,0,131,3,125,1,116,
-    1,124,1,100,2,131,2,114,54,122,12,124,1,160,2,124,
-    0,161,1,87,0,83,0,4,0,116,3,121,52,1,0,1,
-    0,1,0,89,0,110,2,48,0,122,10,124,0,106,4,125,
-    2,87,0,110,18,4,0,116,5,121,82,1,0,1,0,1,
-    0,89,0,110,18,48,0,124,2,100,0,117,1,114,100,116,
-    6,124,2,131,1,83,0,122,10,124,0,106,7,125,3,87,
-    0,110,22,4,0,116,5,121,132,1,0,1,0,1,0,100,
-    3,125,3,89,0,110,2,48,0,122,10,124,0,106,8,125,
-    4,87,0,110,56,4,0,116,5,121,200,1,0,1,0,1,
-    0,124,1,100,0,117,0,114,180,100,4,160,9,124,3,161,
-    1,6,0,89,0,83,0,100,5,160,9,124,3,124,1,161,
-    2,6,0,89,0,83,0,89,0,110,14,48,0,100,6,160,
-    9,124,3,124,4,161,2,83,0,100,0,83,0,41,7,78,
-    218,10,95,95,108,111,97,100,101,114,95,95,218,11,109,111,
-    100,117,108,101,95,114,101,112,114,250,1,63,250,13,60,109,
-    111,100,117,108,101,32,123,33,114,125,62,250,20,60,109,111,
-    100,117,108,101,32,123,33,114,125,32,40,123,33,114,125,41,
-    62,250,23,60,109,111,100,117,108,101,32,123,33,114,125,32,
-    102,114,111,109,32,123,33,114,125,62,41,10,114,6,0,0,
-    0,114,4,0,0,0,114,100,0,0,0,218,9,69,120,99,
-    101,112,116,105,111,110,218,8,95,95,115,112,101,99,95,95,
-    218,14,65,116,116,114,105,98,117,116,101,69,114,114,111,114,
-    218,22,95,109,111,100,117,108,101,95,114,101,112,114,95,102,
-    114,111,109,95,115,112,101,99,114,1,0,0,0,218,8,95,
-    95,102,105,108,101,95,95,114,46,0,0,0,41,5,114,97,
-    0,0,0,218,6,108,111,97,100,101,114,114,96,0,0,0,
-    114,17,0,0,0,218,8,102,105,108,101,110,97,109,101,114,
-    10,0,0,0,114,10,0,0,0,114,11,0,0,0,218,12,
-    95,109,111,100,117,108,101,95,114,101,112,114,22,1,0,0,
-    115,46,0,0,0,0,2,12,1,10,4,2,1,12,1,12,
-    1,6,1,2,1,10,1,12,1,6,2,8,1,8,4,2,
-    1,10,1,12,1,10,1,2,1,10,1,12,1,8,1,14,
-    2,22,2,114,112,0,0,0,99,0,0,0,0,0,0,0,
+    46,95,95,105,110,105,116,95,95,99,1,0,0,0,0,0,
+    0,0,0,0,0,0,1,0,0,0,3,0,0,0,67,0,
+    0,0,115,18,0,0,0,124,0,4,0,106,0,100,1,55,
+    0,2,0,95,0,100,2,83,0,41,3,78,114,42,0,0,
+    0,84,41,1,114,30,0,0,0,114,52,0,0,0,114,5,
+    0,0,0,114,5,0,0,0,114,6,0,0,0,114,43,0,
+    0,0,150,0,0,0,115,4,0,0,0,14,1,4,1,122,
+    24,95,68,117,109,109,121,77,111,100,117,108,101,76,111,99,
+    107,46,97,99,113,117,105,114,101,99,1,0,0,0,0,0,
+    0,0,0,0,0,0,1,0,0,0,3,0,0,0,67,0,
+    0,0,115,36,0,0,0,124,0,106,0,100,1,107,2,114,
+    9,116,1,100,2,131,1,130,1,124,0,4,0,106,0,100,
+    3,56,0,2,0,95,0,100,0,83,0,41,4,78,114,25,
+    0,0,0,114,46,0,0,0,114,42,0,0,0,41,2,114,
+    30,0,0,0,114,47,0,0,0,114,52,0,0,0,114,5,
+    0,0,0,114,5,0,0,0,114,6,0,0,0,114,44,0,
+    0,0,154,0,0,0,115,6,0,0,0,10,1,8,1,18,
+    1,122,24,95,68,117,109,109,121,77,111,100,117,108,101,76,
+    111,99,107,46,114,101,108,101,97,115,101,99,1,0,0,0,
+    0,0,0,0,0,0,0,0,1,0,0,0,5,0,0,0,
+    67,0,0,0,114,48,0,0,0,41,2,78,122,28,95,68,
+    117,109,109,121,77,111,100,117,108,101,76,111,99,107,40,123,
+    33,114,125,41,32,97,116,32,123,125,114,49,0,0,0,114,
+    52,0,0,0,114,5,0,0,0,114,5,0,0,0,114,6,
+    0,0,0,114,53,0,0,0,159,0,0,0,114,54,0,0,
+    0,122,25,95,68,117,109,109,121,77,111,100,117,108,101,76,
+    111,99,107,46,95,95,114,101,112,114,95,95,78,41,8,114,
+    9,0,0,0,114,8,0,0,0,114,1,0,0,0,114,10,
+    0,0,0,114,34,0,0,0,114,43,0,0,0,114,44,0,
+    0,0,114,53,0,0,0,114,5,0,0,0,114,5,0,0,
+    0,114,5,0,0,0,114,6,0,0,0,114,55,0,0,0,
+    142,0,0,0,115,12,0,0,0,8,0,4,1,8,3,8,
+    4,8,4,12,5,114,55,0,0,0,99,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,64,
+    0,0,0,115,36,0,0,0,101,0,90,1,100,0,90,2,
+    100,1,100,2,132,0,90,3,100,3,100,4,132,0,90,4,
+    100,5,100,6,132,0,90,5,100,7,83,0,41,8,218,18,
+    95,77,111,100,117,108,101,76,111,99,107,77,97,110,97,103,
+    101,114,99,2,0,0,0,0,0,0,0,0,0,0,0,2,
+    0,0,0,2,0,0,0,67,0,0,0,115,16,0,0,0,
+    124,1,124,0,95,0,100,0,124,0,95,1,100,0,83,0,
+    114,0,0,0,0,41,2,218,5,95,110,97,109,101,218,5,
+    95,108,111,99,107,114,32,0,0,0,114,5,0,0,0,114,
+    5,0,0,0,114,6,0,0,0,114,34,0,0,0,165,0,
+    0,0,114,56,0,0,0,122,27,95,77,111,100,117,108,101,
+    76,111,99,107,77,97,110,97,103,101,114,46,95,95,105,110,
+    105,116,95,95,99,1,0,0,0,0,0,0,0,0,0,0,
+    0,1,0,0,0,2,0,0,0,67,0,0,0,115,26,0,
+    0,0,116,0,124,0,106,1,131,1,124,0,95,2,124,0,
+    106,2,160,3,161,0,1,0,100,0,83,0,114,0,0,0,
+    0,41,4,218,16,95,103,101,116,95,109,111,100,117,108,101,
+    95,108,111,99,107,114,58,0,0,0,114,59,0,0,0,114,
+    43,0,0,0,114,52,0,0,0,114,5,0,0,0,114,5,
+    0,0,0,114,6,0,0,0,218,9,95,95,101,110,116,101,
+    114,95,95,169,0,0,0,115,4,0,0,0,12,1,14,1,
+    122,28,95,77,111,100,117,108,101,76,111,99,107,77,97,110,
+    97,103,101,114,46,95,95,101,110,116,101,114,95,95,99,1,
+    0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,2,
+    0,0,0,79,0,0,0,115,14,0,0,0,124,0,106,0,
+    160,1,161,0,1,0,100,0,83,0,114,0,0,0,0,41,
+    2,114,59,0,0,0,114,44,0,0,0,41,3,114,33,0,
+    0,0,218,4,97,114,103,115,90,6,107,119,97,114,103,115,
+    114,5,0,0,0,114,5,0,0,0,114,6,0,0,0,218,
+    8,95,95,101,120,105,116,95,95,173,0,0,0,115,2,0,
+    0,0,14,1,122,27,95,77,111,100,117,108,101,76,111,99,
+    107,77,97,110,97,103,101,114,46,95,95,101,120,105,116,95,
+    95,78,41,6,114,9,0,0,0,114,8,0,0,0,114,1,
+    0,0,0,114,34,0,0,0,114,61,0,0,0,114,63,0,
+    0,0,114,5,0,0,0,114,5,0,0,0,114,5,0,0,
+    0,114,6,0,0,0,114,57,0,0,0,163,0,0,0,115,
+    8,0,0,0,8,0,8,2,8,4,12,4,114,57,0,0,
+    0,99,1,0,0,0,0,0,0,0,0,0,0,0,3,0,
+    0,0,8,0,0,0,67,0,0,0,115,148,0,0,0,116,
+    0,160,1,161,0,1,0,122,64,122,7,116,2,124,0,25,
+    0,131,0,125,1,87,0,110,11,4,0,116,3,121,23,1,
+    0,1,0,1,0,100,1,125,1,89,0,110,1,119,0,124,
+    1,100,1,117,0,114,62,116,4,100,1,117,0,114,37,116,
+    5,124,0,131,1,125,1,110,4,116,6,124,0,131,1,125,
+    1,124,0,102,1,100,2,100,3,132,1,125,2,116,7,160,
+    8,124,1,124,2,161,2,116,2,124,0,60,0,87,0,116,
+    0,160,9,161,0,1,0,124,1,83,0,87,0,116,0,160,
+    9,161,0,1,0,124,1,83,0,116,0,160,9,161,0,1,
+    0,119,0,41,4,122,139,71,101,116,32,111,114,32,99,114,
+    101,97,116,101,32,116,104,101,32,109,111,100,117,108,101,32,
+    108,111,99,107,32,102,111,114,32,97,32,103,105,118,101,110,
+    32,109,111,100,117,108,101,32,110,97,109,101,46,10,10,32,
+    32,32,32,65,99,113,117,105,114,101,47,114,101,108,101,97,
+    115,101,32,105,110,116,101,114,110,97,108,108,121,32,116,104,
+    101,32,103,108,111,98,97,108,32,105,109,112,111,114,116,32,
+    108,111,99,107,32,116,111,32,112,114,111,116,101,99,116,10,
+    32,32,32,32,95,109,111,100,117,108,101,95,108,111,99,107,
+    115,46,78,99,2,0,0,0,0,0,0,0,0,0,0,0,
+    2,0,0,0,8,0,0,0,83,0,0,0,115,68,0,0,
+    0,116,0,160,1,161,0,1,0,122,24,116,2,160,3,124,
+    1,161,1,124,0,117,0,114,22,116,2,124,1,61,0,87,
+    0,116,0,160,4,161,0,1,0,100,0,83,0,87,0,116,
+    0,160,4,161,0,1,0,100,0,83,0,116,0,160,4,161,
+    0,1,0,119,0,114,0,0,0,0,41,5,218,4,95,105,
+    109,112,218,12,97,99,113,117,105,114,101,95,108,111,99,107,
+    218,13,95,109,111,100,117,108,101,95,108,111,99,107,115,114,
+    38,0,0,0,218,12,114,101,108,101,97,115,101,95,108,111,
+    99,107,41,2,218,3,114,101,102,114,20,0,0,0,114,5,
+    0,0,0,114,5,0,0,0,114,6,0,0,0,218,2,99,
+    98,198,0,0,0,115,14,0,0,0,8,1,2,1,14,4,
+    8,1,12,2,2,253,22,3,122,28,95,103,101,116,95,109,
+    111,100,117,108,101,95,108,111,99,107,46,60,108,111,99,97,
+    108,115,62,46,99,98,41,10,114,64,0,0,0,114,65,0,
+    0,0,114,66,0,0,0,218,8,75,101,121,69,114,114,111,
+    114,114,26,0,0,0,114,55,0,0,0,114,23,0,0,0,
+    218,8,95,119,101,97,107,114,101,102,114,68,0,0,0,114,
+    67,0,0,0,41,3,114,20,0,0,0,114,27,0,0,0,
+    114,69,0,0,0,114,5,0,0,0,114,5,0,0,0,114,
+    6,0,0,0,114,60,0,0,0,179,0,0,0,115,38,0,
+    0,0,8,6,2,1,2,1,14,1,12,1,8,1,2,255,
+    8,3,8,1,10,1,8,2,12,2,18,11,8,2,4,2,
+    2,235,8,19,4,2,10,254,114,60,0,0,0,99,1,0,
+    0,0,0,0,0,0,0,0,0,0,2,0,0,0,8,0,
+    0,0,67,0,0,0,115,54,0,0,0,116,0,124,0,131,
+    1,125,1,122,6,124,1,160,1,161,0,1,0,87,0,110,
+    10,4,0,116,2,121,20,1,0,1,0,1,0,89,0,100,
+    1,83,0,119,0,124,1,160,3,161,0,1,0,100,1,83,
+    0,41,2,122,189,65,99,113,117,105,114,101,115,32,116,104,
+    101,110,32,114,101,108,101,97,115,101,115,32,116,104,101,32,
+    109,111,100,117,108,101,32,108,111,99,107,32,102,111,114,32,
+    97,32,103,105,118,101,110,32,109,111,100,117,108,101,32,110,
+    97,109,101,46,10,10,32,32,32,32,84,104,105,115,32,105,
+    115,32,117,115,101,100,32,116,111,32,101,110,115,117,114,101,
+    32,97,32,109,111,100,117,108,101,32,105,115,32,99,111,109,
+    112,108,101,116,101,108,121,32,105,110,105,116,105,97,108,105,
+    122,101,100,44,32,105,110,32,116,104,101,10,32,32,32,32,
+    101,118,101,110,116,32,105,116,32,105,115,32,98,101,105,110,
+    103,32,105,109,112,111,114,116,101,100,32,98,121,32,97,110,
+    111,116,104,101,114,32,116,104,114,101,97,100,46,10,32,32,
+    32,32,78,41,4,114,60,0,0,0,114,43,0,0,0,114,
+    22,0,0,0,114,44,0,0,0,41,2,114,20,0,0,0,
+    114,27,0,0,0,114,5,0,0,0,114,5,0,0,0,114,
+    6,0,0,0,218,19,95,108,111,99,107,95,117,110,108,111,
+    99,107,95,109,111,100,117,108,101,216,0,0,0,115,14,0,
+    0,0,8,6,2,1,12,1,12,1,6,3,2,253,12,5,
+    114,72,0,0,0,99,1,0,0,0,0,0,0,0,0,0,
+    0,0,3,0,0,0,4,0,0,0,79,0,0,0,115,14,
+    0,0,0,124,0,124,1,105,0,124,2,164,1,142,1,83,
+    0,41,1,97,46,1,0,0,114,101,109,111,118,101,95,105,
+    109,112,111,114,116,108,105,98,95,102,114,97,109,101,115,32,
+    105,110,32,105,109,112,111,114,116,46,99,32,119,105,108,108,
+    32,97,108,119,97,121,115,32,114,101,109,111,118,101,32,115,
+    101,113,117,101,110,99,101,115,10,32,32,32,32,111,102,32,
+    105,109,112,111,114,116,108,105,98,32,102,114,97,109,101,115,
+    32,116,104,97,116,32,101,110,100,32,119,105,116,104,32,97,
+    32,99,97,108,108,32,116,111,32,116,104,105,115,32,102,117,
+    110,99,116,105,111,110,10,10,32,32,32,32,85,115,101,32,
+    105,116,32,105,110,115,116,101,97,100,32,111,102,32,97,32,
+    110,111,114,109,97,108,32,99,97,108,108,32,105,110,32,112,
+    108,97,99,101,115,32,119,104,101,114,101,32,105,110,99,108,
+    117,100,105,110,103,32,116,104,101,32,105,109,112,111,114,116,
+    108,105,98,10,32,32,32,32,102,114,97,109,101,115,32,105,
+    110,116,114,111,100,117,99,101,115,32,117,110,119,97,110,116,
+    101,100,32,110,111,105,115,101,32,105,110,116,111,32,116,104,
+    101,32,116,114,97,99,101,98,97,99,107,32,40,101,46,103,
+    46,32,119,104,101,110,32,101,120,101,99,117,116,105,110,103,
+    10,32,32,32,32,109,111,100,117,108,101,32,99,111,100,101,
+    41,10,32,32,32,32,114,5,0,0,0,41,3,218,1,102,
+    114,62,0,0,0,90,4,107,119,100,115,114,5,0,0,0,
+    114,5,0,0,0,114,6,0,0,0,218,25,95,99,97,108,
+    108,95,119,105,116,104,95,102,114,97,109,101,115,95,114,101,
+    109,111,118,101,100,233,0,0,0,115,2,0,0,0,14,8,
+    114,74,0,0,0,114,42,0,0,0,41,1,218,9,118,101,
+    114,98,111,115,105,116,121,99,1,0,0,0,0,0,0,0,
+    1,0,0,0,3,0,0,0,4,0,0,0,71,0,0,0,
+    115,58,0,0,0,116,0,106,1,106,2,124,1,107,5,114,
+    27,124,0,160,3,100,1,161,1,115,15,100,2,124,0,23,
+    0,125,0,116,4,124,0,106,5,124,2,142,0,116,0,106,
+    6,100,3,141,2,1,0,100,4,83,0,100,4,83,0,41,
+    5,122,61,80,114,105,110,116,32,116,104,101,32,109,101,115,
+    115,97,103,101,32,116,111,32,115,116,100,101,114,114,32,105,
+    102,32,45,118,47,80,89,84,72,79,78,86,69,82,66,79,
+    83,69,32,105,115,32,116,117,114,110,101,100,32,111,110,46,
+    41,2,250,1,35,122,7,105,109,112,111,114,116,32,122,2,
+    35,32,41,1,90,4,102,105,108,101,78,41,7,114,18,0,
+    0,0,218,5,102,108,97,103,115,218,7,118,101,114,98,111,
+    115,101,218,10,115,116,97,114,116,115,119,105,116,104,218,5,
+    112,114,105,110,116,114,50,0,0,0,218,6,115,116,100,101,
+    114,114,41,3,218,7,109,101,115,115,97,103,101,114,75,0,
+    0,0,114,62,0,0,0,114,5,0,0,0,114,5,0,0,
+    0,114,6,0,0,0,218,16,95,118,101,114,98,111,115,101,
+    95,109,101,115,115,97,103,101,244,0,0,0,115,10,0,0,
+    0,12,2,10,1,8,1,24,1,4,253,114,83,0,0,0,
+    99,1,0,0,0,0,0,0,0,0,0,0,0,2,0,0,
+    0,3,0,0,0,3,0,0,0,243,26,0,0,0,135,0,
+    102,1,100,1,100,2,132,8,125,1,116,0,124,1,136,0,
+    131,2,1,0,124,1,83,0,41,3,122,49,68,101,99,111,
+    114,97,116,111,114,32,116,111,32,118,101,114,105,102,121,32,
+    116,104,101,32,110,97,109,101,100,32,109,111,100,117,108,101,
+    32,105,115,32,98,117,105,108,116,45,105,110,46,99,2,0,
+    0,0,0,0,0,0,0,0,0,0,2,0,0,0,4,0,
+    0,0,19,0,0,0,115,38,0,0,0,124,1,116,0,106,
+    1,118,1,114,14,116,2,100,1,160,3,124,1,161,1,124,
+    1,100,2,141,2,130,1,136,0,124,0,124,1,131,2,83,
+    0,41,3,78,250,29,123,33,114,125,32,105,115,32,110,111,
+    116,32,97,32,98,117,105,108,116,45,105,110,32,109,111,100,
+    117,108,101,114,19,0,0,0,41,4,114,18,0,0,0,218,
+    20,98,117,105,108,116,105,110,95,109,111,100,117,108,101,95,
+    110,97,109,101,115,218,11,73,109,112,111,114,116,69,114,114,
+    111,114,114,50,0,0,0,169,2,114,33,0,0,0,218,8,
+    102,117,108,108,110,97,109,101,169,1,218,3,102,120,110,114,
+    5,0,0,0,114,6,0,0,0,218,25,95,114,101,113,117,
+    105,114,101,115,95,98,117,105,108,116,105,110,95,119,114,97,
+    112,112,101,114,254,0,0,0,243,10,0,0,0,10,1,10,
+    1,2,1,6,255,10,2,122,52,95,114,101,113,117,105,114,
+    101,115,95,98,117,105,108,116,105,110,46,60,108,111,99,97,
+    108,115,62,46,95,114,101,113,117,105,114,101,115,95,98,117,
+    105,108,116,105,110,95,119,114,97,112,112,101,114,169,1,114,
+    17,0,0,0,41,2,114,91,0,0,0,114,92,0,0,0,
+    114,5,0,0,0,114,90,0,0,0,114,6,0,0,0,218,
+    17,95,114,101,113,117,105,114,101,115,95,98,117,105,108,116,
+    105,110,252,0,0,0,243,6,0,0,0,12,2,10,5,4,
+    1,114,95,0,0,0,99,1,0,0,0,0,0,0,0,0,
+    0,0,0,2,0,0,0,3,0,0,0,3,0,0,0,114,
+    84,0,0,0,41,3,122,47,68,101,99,111,114,97,116,111,
+    114,32,116,111,32,118,101,114,105,102,121,32,116,104,101,32,
+    110,97,109,101,100,32,109,111,100,117,108,101,32,105,115,32,
+    102,114,111,122,101,110,46,99,2,0,0,0,0,0,0,0,
+    0,0,0,0,2,0,0,0,4,0,0,0,19,0,0,0,
+    115,38,0,0,0,116,0,160,1,124,1,161,1,115,14,116,
+    2,100,1,160,3,124,1,161,1,124,1,100,2,141,2,130,
+    1,136,0,124,0,124,1,131,2,83,0,169,3,78,122,27,
+    123,33,114,125,32,105,115,32,110,111,116,32,97,32,102,114,
+    111,122,101,110,32,109,111,100,117,108,101,114,19,0,0,0,
+    41,4,114,64,0,0,0,218,9,105,115,95,102,114,111,122,
+    101,110,114,87,0,0,0,114,50,0,0,0,114,88,0,0,
+    0,114,90,0,0,0,114,5,0,0,0,114,6,0,0,0,
+    218,24,95,114,101,113,117,105,114,101,115,95,102,114,111,122,
+    101,110,95,119,114,97,112,112,101,114,9,1,0,0,114,93,
+    0,0,0,122,50,95,114,101,113,117,105,114,101,115,95,102,
+    114,111,122,101,110,46,60,108,111,99,97,108,115,62,46,95,
+    114,101,113,117,105,114,101,115,95,102,114,111,122,101,110,95,
+    119,114,97,112,112,101,114,114,94,0,0,0,41,2,114,91,
+    0,0,0,114,99,0,0,0,114,5,0,0,0,114,90,0,
+    0,0,114,6,0,0,0,218,16,95,114,101,113,117,105,114,
+    101,115,95,102,114,111,122,101,110,7,1,0,0,114,96,0,
+    0,0,114,100,0,0,0,99,2,0,0,0,0,0,0,0,
+    0,0,0,0,5,0,0,0,4,0,0,0,67,0,0,0,
+    115,74,0,0,0,100,1,125,2,116,0,160,1,124,2,116,
+    2,161,2,1,0,116,3,124,1,124,0,131,2,125,3,124,
+    1,116,4,106,5,118,0,114,33,116,4,106,5,124,1,25,
+    0,125,4,116,6,124,3,124,4,131,2,1,0,116,4,106,
+    5,124,1,25,0,83,0,116,7,124,3,131,1,83,0,41,
+    2,122,130,76,111,97,100,32,116,104,101,32,115,112,101,99,
+    105,102,105,101,100,32,109,111,100,117,108,101,32,105,110,116,
+    111,32,115,121,115,46,109,111,100,117,108,101,115,32,97,110,
+    100,32,114,101,116,117,114,110,32,105,116,46,10,10,32,32,
+    32,32,84,104,105,115,32,109,101,116,104,111,100,32,105,115,
+    32,100,101,112,114,101,99,97,116,101,100,46,32,32,85,115,
+    101,32,108,111,97,100,101,114,46,101,120,101,99,95,109,111,
+    100,117,108,101,40,41,32,105,110,115,116,101,97,100,46,10,
+    10,32,32,32,32,122,103,116,104,101,32,108,111,97,100,95,
+    109,111,100,117,108,101,40,41,32,109,101,116,104,111,100,32,
+    105,115,32,100,101,112,114,101,99,97,116,101,100,32,97,110,
+    100,32,115,108,97,116,101,100,32,102,111,114,32,114,101,109,
+    111,118,97,108,32,105,110,32,80,121,116,104,111,110,32,51,
+    46,49,50,59,32,117,115,101,32,101,120,101,99,95,109,111,
+    100,117,108,101,40,41,32,105,110,115,116,101,97,100,41,8,
+    218,9,95,119,97,114,110,105,110,103,115,218,4,119,97,114,
+    110,218,18,68,101,112,114,101,99,97,116,105,111,110,87,97,
+    114,110,105,110,103,218,16,115,112,101,99,95,102,114,111,109,
+    95,108,111,97,100,101,114,114,18,0,0,0,218,7,109,111,
+    100,117,108,101,115,218,5,95,101,120,101,99,218,5,95,108,
+    111,97,100,41,5,114,33,0,0,0,114,89,0,0,0,218,
+    3,109,115,103,218,4,115,112,101,99,218,6,109,111,100,117,
+    108,101,114,5,0,0,0,114,5,0,0,0,114,6,0,0,
+    0,218,17,95,108,111,97,100,95,109,111,100,117,108,101,95,
+    115,104,105,109,19,1,0,0,115,16,0,0,0,4,6,12,
+    2,10,1,10,1,10,1,10,1,10,1,8,2,114,111,0,
+    0,0,99,1,0,0,0,0,0,0,0,0,0,0,0,5,
+    0,0,0,8,0,0,0,67,0,0,0,115,188,0,0,0,
+    116,0,124,0,100,1,100,2,131,3,125,1,116,0,124,0,
+    100,3,100,2,131,3,4,0,125,2,114,18,116,1,124,2,
+    131,1,83,0,116,2,124,1,100,4,131,2,114,39,122,6,
+    124,1,160,3,124,0,161,1,87,0,83,0,4,0,116,4,
+    121,38,1,0,1,0,1,0,89,0,110,1,119,0,122,5,
+    124,0,106,5,125,3,87,0,110,11,4,0,116,6,121,55,
+    1,0,1,0,1,0,100,5,125,3,89,0,110,1,119,0,
+    122,5,124,0,106,7,125,4,87,0,110,26,4,0,116,6,
+    121,87,1,0,1,0,1,0,124,1,100,2,117,0,114,79,
+    100,6,160,8,124,3,161,1,6,0,89,0,83,0,100,7,
+    160,8,124,3,124,1,161,2,6,0,89,0,83,0,119,0,
+    100,8,160,8,124,3,124,4,161,2,83,0,41,9,122,44,
+    84,104,101,32,105,109,112,108,101,109,101,110,116,97,116,105,
+    111,110,32,111,102,32,77,111,100,117,108,101,84,121,112,101,
+    46,95,95,114,101,112,114,95,95,40,41,46,218,10,95,95,
+    108,111,97,100,101,114,95,95,78,218,8,95,95,115,112,101,
+    99,95,95,218,11,109,111,100,117,108,101,95,114,101,112,114,
+    250,1,63,250,13,60,109,111,100,117,108,101,32,123,33,114,
+    125,62,250,20,60,109,111,100,117,108,101,32,123,33,114,125,
+    32,40,123,33,114,125,41,62,250,23,60,109,111,100,117,108,
+    101,32,123,33,114,125,32,102,114,111,109,32,123,33,114,125,
+    62,41,9,114,13,0,0,0,218,22,95,109,111,100,117,108,
+    101,95,114,101,112,114,95,102,114,111,109,95,115,112,101,99,
+    114,11,0,0,0,114,114,0,0,0,218,9,69,120,99,101,
+    112,116,105,111,110,114,9,0,0,0,114,2,0,0,0,218,
+    8,95,95,102,105,108,101,95,95,114,50,0,0,0,41,5,
+    114,110,0,0,0,218,6,108,111,97,100,101,114,114,109,0,
+    0,0,114,20,0,0,0,218,8,102,105,108,101,110,97,109,
+    101,114,5,0,0,0,114,5,0,0,0,114,6,0,0,0,
+    218,12,95,109,111,100,117,108,101,95,114,101,112,114,38,1,
+    0,0,115,44,0,0,0,12,2,16,1,8,1,10,1,2,
+    1,12,1,12,1,4,1,2,255,2,3,10,1,12,1,8,
+    1,2,255,2,2,10,1,12,1,8,1,14,1,16,2,2,
+    252,12,6,114,124,0,0,0,99,0,0,0,0,0,0,0,
     0,0,0,0,0,0,0,0,0,4,0,0,0,64,0,0,
     0,115,114,0,0,0,101,0,90,1,100,0,90,2,100,1,
     90,3,100,2,100,2,100,2,100,3,156,3,100,4,100,5,
@@ -640,25 +664,25 @@
     99,3,0,0,0,0,0,0,0,3,0,0,0,6,0,0,
     0,2,0,0,0,67,0,0,0,115,54,0,0,0,124,1,
     124,0,95,0,124,2,124,0,95,1,124,3,124,0,95,2,
-    124,4,124,0,95,3,124,5,114,32,103,0,110,2,100,0,
+    124,4,124,0,95,3,124,5,114,16,103,0,110,1,100,0,
     124,0,95,4,100,1,124,0,95,5,100,0,124,0,95,6,
-    100,0,83,0,41,2,78,70,41,7,114,17,0,0,0,114,
-    110,0,0,0,114,114,0,0,0,114,115,0,0,0,218,26,
+    100,0,83,0,41,2,78,70,41,7,114,20,0,0,0,114,
+    122,0,0,0,114,126,0,0,0,114,127,0,0,0,218,26,
     115,117,98,109,111,100,117,108,101,95,115,101,97,114,99,104,
     95,108,111,99,97,116,105,111,110,115,218,13,95,115,101,116,
     95,102,105,108,101,97,116,116,114,218,7,95,99,97,99,104,
-    101,100,41,6,114,30,0,0,0,114,17,0,0,0,114,110,
-    0,0,0,114,114,0,0,0,114,115,0,0,0,114,116,0,
-    0,0,114,10,0,0,0,114,10,0,0,0,114,11,0,0,
-    0,114,31,0,0,0,95,1,0,0,115,14,0,0,0,0,
-    2,6,1,6,1,6,1,6,1,14,3,6,1,122,19,77,
+    101,100,41,6,114,33,0,0,0,114,20,0,0,0,114,122,
+    0,0,0,114,126,0,0,0,114,127,0,0,0,114,128,0,
+    0,0,114,5,0,0,0,114,5,0,0,0,114,6,0,0,
+    0,114,34,0,0,0,101,1,0,0,115,14,0,0,0,6,
+    2,6,1,6,1,6,1,14,1,6,3,10,1,122,19,77,
     111,100,117,108,101,83,112,101,99,46,95,95,105,110,105,116,
     95,95,99,1,0,0,0,0,0,0,0,0,0,0,0,2,
     0,0,0,6,0,0,0,67,0,0,0,115,102,0,0,0,
     100,1,160,0,124,0,106,1,161,1,100,2,160,0,124,0,
     106,2,161,1,103,2,125,1,124,0,106,3,100,0,117,1,
-    114,52,124,1,160,4,100,3,160,0,124,0,106,3,161,1,
-    161,1,1,0,124,0,106,5,100,0,117,1,114,80,124,1,
+    114,26,124,1,160,4,100,3,160,0,124,0,106,3,161,1,
+    161,1,1,0,124,0,106,5,100,0,117,1,114,40,124,1,
     160,4,100,4,160,0,124,0,106,5,161,1,161,1,1,0,
     100,5,160,0,124,0,106,6,106,7,100,6,160,8,124,1,
     161,1,161,2,83,0,41,7,78,122,9,110,97,109,101,61,
@@ -666,1147 +690,1196 @@
     125,122,11,111,114,105,103,105,110,61,123,33,114,125,122,29,
     115,117,98,109,111,100,117,108,101,95,115,101,97,114,99,104,
     95,108,111,99,97,116,105,111,110,115,61,123,125,122,6,123,
-    125,40,123,125,41,122,2,44,32,41,9,114,46,0,0,0,
-    114,17,0,0,0,114,110,0,0,0,114,114,0,0,0,218,
-    6,97,112,112,101,110,100,114,117,0,0,0,218,9,95,95,
-    99,108,97,115,115,95,95,114,1,0,0,0,218,4,106,111,
-    105,110,41,2,114,30,0,0,0,114,56,0,0,0,114,10,
-    0,0,0,114,10,0,0,0,114,11,0,0,0,114,49,0,
-    0,0,107,1,0,0,115,20,0,0,0,0,1,10,1,10,
-    255,4,2,10,1,18,1,10,1,8,1,4,255,6,2,122,
+    125,40,123,125,41,122,2,44,32,41,9,114,50,0,0,0,
+    114,20,0,0,0,114,122,0,0,0,114,126,0,0,0,218,
+    6,97,112,112,101,110,100,114,129,0,0,0,218,9,95,95,
+    99,108,97,115,115,95,95,114,9,0,0,0,218,4,106,111,
+    105,110,41,2,114,33,0,0,0,114,62,0,0,0,114,5,
+    0,0,0,114,5,0,0,0,114,6,0,0,0,114,53,0,
+    0,0,113,1,0,0,115,20,0,0,0,10,1,10,1,4,
+    255,10,2,18,1,10,1,6,1,8,1,4,255,22,2,122,
     19,77,111,100,117,108,101,83,112,101,99,46,95,95,114,101,
     112,114,95,95,99,2,0,0,0,0,0,0,0,0,0,0,
-    0,3,0,0,0,8,0,0,0,67,0,0,0,115,106,0,
-    0,0,124,0,106,0,125,2,122,72,124,0,106,1,124,1,
-    106,1,107,2,111,76,124,0,106,2,124,1,106,2,107,2,
-    111,76,124,0,106,3,124,1,106,3,107,2,111,76,124,2,
-    124,1,106,0,107,2,111,76,124,0,106,4,124,1,106,4,
-    107,2,111,76,124,0,106,5,124,1,106,5,107,2,87,0,
-    83,0,4,0,116,6,121,100,1,0,1,0,1,0,116,7,
-    6,0,89,0,83,0,48,0,100,0,83,0,114,13,0,0,
-    0,41,8,114,117,0,0,0,114,17,0,0,0,114,110,0,
-    0,0,114,114,0,0,0,218,6,99,97,99,104,101,100,218,
-    12,104,97,115,95,108,111,99,97,116,105,111,110,114,107,0,
-    0,0,218,14,78,111,116,73,109,112,108,101,109,101,110,116,
-    101,100,41,3,114,30,0,0,0,90,5,111,116,104,101,114,
-    90,4,115,109,115,108,114,10,0,0,0,114,10,0,0,0,
-    114,11,0,0,0,218,6,95,95,101,113,95,95,117,1,0,
-    0,115,30,0,0,0,0,1,6,1,2,1,12,1,10,255,
-    2,2,10,254,2,3,8,253,2,4,10,252,2,5,10,251,
-    4,6,12,1,122,17,77,111,100,117,108,101,83,112,101,99,
-    46,95,95,101,113,95,95,99,1,0,0,0,0,0,0,0,
-    0,0,0,0,1,0,0,0,3,0,0,0,67,0,0,0,
-    115,58,0,0,0,124,0,106,0,100,0,117,0,114,52,124,
-    0,106,1,100,0,117,1,114,52,124,0,106,2,114,52,116,
-    3,100,0,117,0,114,38,116,4,130,1,116,3,160,5,124,
-    0,106,1,161,1,124,0,95,0,124,0,106,0,83,0,114,
-    13,0,0,0,41,6,114,119,0,0,0,114,114,0,0,0,
-    114,118,0,0,0,218,19,95,98,111,111,116,115,116,114,97,
-    112,95,101,120,116,101,114,110,97,108,218,19,78,111,116,73,
-    109,112,108,101,109,101,110,116,101,100,69,114,114,111,114,90,
-    11,95,103,101,116,95,99,97,99,104,101,100,114,48,0,0,
-    0,114,10,0,0,0,114,10,0,0,0,114,11,0,0,0,
-    114,123,0,0,0,129,1,0,0,115,12,0,0,0,0,2,
-    10,1,16,1,8,1,4,1,14,1,122,17,77,111,100,117,
-    108,101,83,112,101,99,46,99,97,99,104,101,100,99,2,0,
-    0,0,0,0,0,0,0,0,0,0,2,0,0,0,2,0,
-    0,0,67,0,0,0,115,10,0,0,0,124,1,124,0,95,
-    0,100,0,83,0,114,13,0,0,0,41,1,114,119,0,0,
-    0,41,2,114,30,0,0,0,114,123,0,0,0,114,10,0,
-    0,0,114,10,0,0,0,114,11,0,0,0,114,123,0,0,
-    0,138,1,0,0,115,2,0,0,0,0,2,99,1,0,0,
-    0,0,0,0,0,0,0,0,0,1,0,0,0,3,0,0,
-    0,67,0,0,0,115,36,0,0,0,124,0,106,0,100,1,
-    117,0,114,26,124,0,106,1,160,2,100,2,161,1,100,3,
-    25,0,83,0,124,0,106,1,83,0,100,1,83,0,41,4,
-    122,32,84,104,101,32,110,97,109,101,32,111,102,32,116,104,
-    101,32,109,111,100,117,108,101,39,115,32,112,97,114,101,110,
-    116,46,78,218,1,46,114,22,0,0,0,41,3,114,117,0,
-    0,0,114,17,0,0,0,218,10,114,112,97,114,116,105,116,
-    105,111,110,114,48,0,0,0,114,10,0,0,0,114,10,0,
-    0,0,114,11,0,0,0,218,6,112,97,114,101,110,116,142,
-    1,0,0,115,6,0,0,0,0,3,10,1,16,2,122,17,
-    77,111,100,117,108,101,83,112,101,99,46,112,97,114,101,110,
-    116,99,1,0,0,0,0,0,0,0,0,0,0,0,1,0,
-    0,0,1,0,0,0,67,0,0,0,115,6,0,0,0,124,
-    0,106,0,83,0,114,13,0,0,0,41,1,114,118,0,0,
-    0,114,48,0,0,0,114,10,0,0,0,114,10,0,0,0,
-    114,11,0,0,0,114,124,0,0,0,150,1,0,0,115,2,
-    0,0,0,0,2,122,23,77,111,100,117,108,101,83,112,101,
-    99,46,104,97,115,95,108,111,99,97,116,105,111,110,99,2,
-    0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,2,
-    0,0,0,67,0,0,0,115,14,0,0,0,116,0,124,1,
-    131,1,124,0,95,1,100,0,83,0,114,13,0,0,0,41,
-    2,218,4,98,111,111,108,114,118,0,0,0,41,2,114,30,
-    0,0,0,218,5,118,97,108,117,101,114,10,0,0,0,114,
-    10,0,0,0,114,11,0,0,0,114,124,0,0,0,154,1,
-    0,0,115,2,0,0,0,0,2,41,12,114,1,0,0,0,
-    114,0,0,0,0,114,2,0,0,0,114,3,0,0,0,114,
-    31,0,0,0,114,49,0,0,0,114,126,0,0,0,218,8,
-    112,114,111,112,101,114,116,121,114,123,0,0,0,218,6,115,
-    101,116,116,101,114,114,131,0,0,0,114,124,0,0,0,114,
-    10,0,0,0,114,10,0,0,0,114,10,0,0,0,114,11,
-    0,0,0,114,113,0,0,0,58,1,0,0,115,32,0,0,
-    0,8,1,4,36,4,1,2,255,12,12,8,10,8,12,2,
-    1,10,8,4,1,10,3,2,1,10,7,2,1,10,3,4,
-    1,114,113,0,0,0,169,2,114,114,0,0,0,114,116,0,
-    0,0,99,2,0,0,0,0,0,0,0,2,0,0,0,6,
-    0,0,0,8,0,0,0,67,0,0,0,115,152,0,0,0,
-    116,0,124,1,100,1,131,2,114,74,116,1,100,2,117,0,
-    114,22,116,2,130,1,116,1,106,3,125,4,124,3,100,2,
-    117,0,114,48,124,4,124,0,124,1,100,3,141,2,83,0,
-    124,3,114,56,103,0,110,2,100,2,125,5,124,4,124,0,
-    124,1,124,5,100,4,141,3,83,0,124,3,100,2,117,0,
-    114,136,116,0,124,1,100,5,131,2,114,132,122,14,124,1,
-    160,4,124,0,161,1,125,3,87,0,113,136,4,0,116,5,
-    121,128,1,0,1,0,1,0,100,2,125,3,89,0,113,136,
-    48,0,110,4,100,6,125,3,116,6,124,0,124,1,124,2,
-    124,3,100,7,141,4,83,0,41,8,122,53,82,101,116,117,
-    114,110,32,97,32,109,111,100,117,108,101,32,115,112,101,99,
-    32,98,97,115,101,100,32,111,110,32,118,97,114,105,111,117,
-    115,32,108,111,97,100,101,114,32,109,101,116,104,111,100,115,
-    46,90,12,103,101,116,95,102,105,108,101,110,97,109,101,78,
-    41,1,114,110,0,0,0,41,2,114,110,0,0,0,114,117,
-    0,0,0,114,116,0,0,0,70,114,136,0,0,0,41,7,
-    114,4,0,0,0,114,127,0,0,0,114,128,0,0,0,218,
-    23,115,112,101,99,95,102,114,111,109,95,102,105,108,101,95,
-    108,111,99,97,116,105,111,110,114,116,0,0,0,114,80,0,
-    0,0,114,113,0,0,0,41,6,114,17,0,0,0,114,110,
-    0,0,0,114,114,0,0,0,114,116,0,0,0,114,137,0,
-    0,0,90,6,115,101,97,114,99,104,114,10,0,0,0,114,
-    10,0,0,0,114,11,0,0,0,114,92,0,0,0,159,1,
-    0,0,115,36,0,0,0,0,2,10,1,8,1,4,1,6,
-    2,8,1,12,1,12,1,6,1,2,255,6,3,8,1,10,
-    1,2,1,14,1,12,1,12,3,4,2,114,92,0,0,0,
-    99,3,0,0,0,0,0,0,0,0,0,0,0,8,0,0,
-    0,8,0,0,0,67,0,0,0,115,42,1,0,0,122,10,
-    124,0,106,0,125,3,87,0,110,18,4,0,116,1,121,28,
-    1,0,1,0,1,0,89,0,110,14,48,0,124,3,100,0,
-    117,1,114,42,124,3,83,0,124,0,106,2,125,4,124,1,
-    100,0,117,0,114,86,122,10,124,0,106,3,125,1,87,0,
-    110,18,4,0,116,1,121,84,1,0,1,0,1,0,89,0,
-    110,2,48,0,122,10,124,0,106,4,125,5,87,0,110,22,
-    4,0,116,1,121,118,1,0,1,0,1,0,100,0,125,5,
-    89,0,110,2,48,0,124,2,100,0,117,0,114,176,124,5,
-    100,0,117,0,114,172,122,10,124,1,106,5,125,2,87,0,
-    113,176,4,0,116,1,121,168,1,0,1,0,1,0,100,0,
-    125,2,89,0,113,176,48,0,110,4,124,5,125,2,122,10,
-    124,0,106,6,125,6,87,0,110,22,4,0,116,1,121,208,
-    1,0,1,0,1,0,100,0,125,6,89,0,110,2,48,0,
-    122,14,116,7,124,0,106,8,131,1,125,7,87,0,110,22,
-    4,0,116,1,121,246,1,0,1,0,1,0,100,0,125,7,
-    89,0,110,2,48,0,116,9,124,4,124,1,124,2,100,1,
-    141,3,125,3,124,5,100,0,117,0,144,1,114,20,100,2,
-    110,2,100,3,124,3,95,10,124,6,124,3,95,11,124,7,
-    124,3,95,12,124,3,83,0,41,4,78,169,1,114,114,0,
-    0,0,70,84,41,13,114,106,0,0,0,114,107,0,0,0,
-    114,1,0,0,0,114,99,0,0,0,114,109,0,0,0,218,
-    7,95,79,82,73,71,73,78,218,10,95,95,99,97,99,104,
-    101,100,95,95,218,4,108,105,115,116,218,8,95,95,112,97,
-    116,104,95,95,114,113,0,0,0,114,118,0,0,0,114,123,
-    0,0,0,114,117,0,0,0,41,8,114,97,0,0,0,114,
-    110,0,0,0,114,114,0,0,0,114,96,0,0,0,114,17,
-    0,0,0,90,8,108,111,99,97,116,105,111,110,114,123,0,
-    0,0,114,117,0,0,0,114,10,0,0,0,114,10,0,0,
-    0,114,11,0,0,0,218,17,95,115,112,101,99,95,102,114,
-    111,109,95,109,111,100,117,108,101,185,1,0,0,115,72,0,
-    0,0,0,2,2,1,10,1,12,1,6,2,8,1,4,2,
-    6,1,8,1,2,1,10,1,12,2,6,1,2,1,10,1,
-    12,1,10,1,8,1,8,1,2,1,10,1,12,1,12,2,
-    4,1,2,1,10,1,12,1,10,1,2,1,14,1,12,1,
-    10,2,14,1,20,1,6,1,6,1,114,143,0,0,0,70,
-    169,1,218,8,111,118,101,114,114,105,100,101,99,2,0,0,
-    0,0,0,0,0,1,0,0,0,5,0,0,0,8,0,0,
-    0,67,0,0,0,115,210,1,0,0,124,2,115,20,116,0,
-    124,1,100,1,100,0,131,3,100,0,117,0,114,52,122,12,
-    124,0,106,1,124,1,95,2,87,0,110,18,4,0,116,3,
-    121,50,1,0,1,0,1,0,89,0,110,2,48,0,124,2,
-    115,72,116,0,124,1,100,2,100,0,131,3,100,0,117,0,
-    114,174,124,0,106,4,125,3,124,3,100,0,117,0,114,144,
-    124,0,106,5,100,0,117,1,114,144,116,6,100,0,117,0,
-    114,108,116,7,130,1,116,6,106,8,125,4,124,4,160,9,
-    124,4,161,1,125,3,124,0,106,5,124,3,95,10,124,3,
-    124,0,95,4,100,0,124,1,95,11,122,10,124,3,124,1,
-    95,12,87,0,110,18,4,0,116,3,121,172,1,0,1,0,
-    1,0,89,0,110,2,48,0,124,2,115,194,116,0,124,1,
-    100,3,100,0,131,3,100,0,117,0,114,226,122,12,124,0,
-    106,13,124,1,95,14,87,0,110,18,4,0,116,3,121,224,
-    1,0,1,0,1,0,89,0,110,2,48,0,122,10,124,0,
-    124,1,95,15,87,0,110,18,4,0,116,3,121,254,1,0,
-    1,0,1,0,89,0,110,2,48,0,124,2,144,1,115,24,
-    116,0,124,1,100,4,100,0,131,3,100,0,117,0,144,1,
-    114,70,124,0,106,5,100,0,117,1,144,1,114,70,122,12,
-    124,0,106,5,124,1,95,16,87,0,110,20,4,0,116,3,
-    144,1,121,68,1,0,1,0,1,0,89,0,110,2,48,0,
-    124,0,106,17,144,1,114,206,124,2,144,1,115,102,116,0,
-    124,1,100,5,100,0,131,3,100,0,117,0,144,1,114,136,
-    122,12,124,0,106,18,124,1,95,11,87,0,110,20,4,0,
-    116,3,144,1,121,134,1,0,1,0,1,0,89,0,110,2,
-    48,0,124,2,144,1,115,160,116,0,124,1,100,6,100,0,
-    131,3,100,0,117,0,144,1,114,206,124,0,106,19,100,0,
-    117,1,144,1,114,206,122,12,124,0,106,19,124,1,95,20,
-    87,0,110,20,4,0,116,3,144,1,121,204,1,0,1,0,
-    1,0,89,0,110,2,48,0,124,1,83,0,41,7,78,114,
-    1,0,0,0,114,99,0,0,0,218,11,95,95,112,97,99,
-    107,97,103,101,95,95,114,142,0,0,0,114,109,0,0,0,
-    114,140,0,0,0,41,21,114,6,0,0,0,114,17,0,0,
-    0,114,1,0,0,0,114,107,0,0,0,114,110,0,0,0,
-    114,117,0,0,0,114,127,0,0,0,114,128,0,0,0,218,
+    0,3,0,0,0,8,0,0,0,67,0,0,0,115,102,0,
+    0,0,124,0,106,0,125,2,122,36,124,0,106,1,124,1,
+    106,1,107,2,111,38,124,0,106,2,124,1,106,2,107,2,
+    111,38,124,0,106,3,124,1,106,3,107,2,111,38,124,2,
+    124,1,106,0,107,2,111,38,124,0,106,4,124,1,106,4,
+    107,2,111,38,124,0,106,5,124,1,106,5,107,2,87,0,
+    83,0,4,0,116,6,121,50,1,0,1,0,1,0,116,7,
+    6,0,89,0,83,0,119,0,114,0,0,0,0,41,8,114,
+    129,0,0,0,114,20,0,0,0,114,122,0,0,0,114,126,
+    0,0,0,218,6,99,97,99,104,101,100,218,12,104,97,115,
+    95,108,111,99,97,116,105,111,110,114,2,0,0,0,218,14,
+    78,111,116,73,109,112,108,101,109,101,110,116,101,100,41,3,
+    114,33,0,0,0,90,5,111,116,104,101,114,90,4,115,109,
+    115,108,114,5,0,0,0,114,5,0,0,0,114,6,0,0,
+    0,218,6,95,95,101,113,95,95,123,1,0,0,115,32,0,
+    0,0,6,1,2,1,12,1,10,1,2,255,10,2,2,254,
+    8,3,2,253,10,4,2,252,10,5,4,251,12,6,8,1,
+    2,255,122,17,77,111,100,117,108,101,83,112,101,99,46,95,
+    95,101,113,95,95,99,1,0,0,0,0,0,0,0,0,0,
+    0,0,1,0,0,0,3,0,0,0,67,0,0,0,115,58,
+    0,0,0,124,0,106,0,100,0,117,0,114,26,124,0,106,
+    1,100,0,117,1,114,26,124,0,106,2,114,26,116,3,100,
+    0,117,0,114,19,116,4,130,1,116,3,160,5,124,0,106,
+    1,161,1,124,0,95,0,124,0,106,0,83,0,114,0,0,
+    0,0,41,6,114,131,0,0,0,114,126,0,0,0,114,130,
+    0,0,0,218,19,95,98,111,111,116,115,116,114,97,112,95,
+    101,120,116,101,114,110,97,108,218,19,78,111,116,73,109,112,
+    108,101,109,101,110,116,101,100,69,114,114,111,114,90,11,95,
+    103,101,116,95,99,97,99,104,101,100,114,52,0,0,0,114,
+    5,0,0,0,114,5,0,0,0,114,6,0,0,0,114,135,
+    0,0,0,135,1,0,0,115,12,0,0,0,10,2,16,1,
+    8,1,4,1,14,1,6,1,122,17,77,111,100,117,108,101,
+    83,112,101,99,46,99,97,99,104,101,100,99,2,0,0,0,
+    0,0,0,0,0,0,0,0,2,0,0,0,2,0,0,0,
+    67,0,0,0,115,10,0,0,0,124,1,124,0,95,0,100,
+    0,83,0,114,0,0,0,0,41,1,114,131,0,0,0,41,
+    2,114,33,0,0,0,114,135,0,0,0,114,5,0,0,0,
+    114,5,0,0,0,114,6,0,0,0,114,135,0,0,0,144,
+    1,0,0,115,2,0,0,0,10,2,99,1,0,0,0,0,
+    0,0,0,0,0,0,0,1,0,0,0,3,0,0,0,67,
+    0,0,0,115,32,0,0,0,124,0,106,0,100,1,117,0,
+    114,13,124,0,106,1,160,2,100,2,161,1,100,3,25,0,
+    83,0,124,0,106,1,83,0,41,4,122,32,84,104,101,32,
+    110,97,109,101,32,111,102,32,116,104,101,32,109,111,100,117,
+    108,101,39,115,32,112,97,114,101,110,116,46,78,218,1,46,
+    114,25,0,0,0,41,3,114,129,0,0,0,114,20,0,0,
+    0,218,10,114,112,97,114,116,105,116,105,111,110,114,52,0,
+    0,0,114,5,0,0,0,114,5,0,0,0,114,6,0,0,
+    0,218,6,112,97,114,101,110,116,148,1,0,0,115,6,0,
+    0,0,10,3,16,1,6,2,122,17,77,111,100,117,108,101,
+    83,112,101,99,46,112,97,114,101,110,116,99,1,0,0,0,
+    0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,
+    67,0,0,0,115,6,0,0,0,124,0,106,0,83,0,114,
+    0,0,0,0,41,1,114,130,0,0,0,114,52,0,0,0,
+    114,5,0,0,0,114,5,0,0,0,114,6,0,0,0,114,
+    136,0,0,0,156,1,0,0,115,2,0,0,0,6,2,122,
+    23,77,111,100,117,108,101,83,112,101,99,46,104,97,115,95,
+    108,111,99,97,116,105,111,110,99,2,0,0,0,0,0,0,
+    0,0,0,0,0,2,0,0,0,2,0,0,0,67,0,0,
+    0,115,14,0,0,0,116,0,124,1,131,1,124,0,95,1,
+    100,0,83,0,114,0,0,0,0,41,2,218,4,98,111,111,
+    108,114,130,0,0,0,41,2,114,33,0,0,0,218,5,118,
+    97,108,117,101,114,5,0,0,0,114,5,0,0,0,114,6,
+    0,0,0,114,136,0,0,0,160,1,0,0,115,2,0,0,
+    0,14,2,41,12,114,9,0,0,0,114,8,0,0,0,114,
+    1,0,0,0,114,10,0,0,0,114,34,0,0,0,114,53,
+    0,0,0,114,138,0,0,0,218,8,112,114,111,112,101,114,
+    116,121,114,135,0,0,0,218,6,115,101,116,116,101,114,114,
+    143,0,0,0,114,136,0,0,0,114,5,0,0,0,114,5,
+    0,0,0,114,5,0,0,0,114,6,0,0,0,114,125,0,
+    0,0,64,1,0,0,115,34,0,0,0,8,0,4,1,4,
+    36,2,1,12,255,8,12,8,10,2,12,10,1,4,8,10,
+    1,2,3,10,1,2,7,10,1,4,3,14,1,114,125,0,
+    0,0,169,2,114,126,0,0,0,114,128,0,0,0,99,2,
+    0,0,0,0,0,0,0,2,0,0,0,6,0,0,0,8,
+    0,0,0,67,0,0,0,115,150,0,0,0,116,0,124,1,
+    100,1,131,2,114,37,116,1,100,2,117,0,114,11,116,2,
+    130,1,116,1,106,3,125,4,124,3,100,2,117,0,114,24,
+    124,4,124,0,124,1,100,3,141,2,83,0,124,3,114,28,
+    103,0,110,1,100,2,125,5,124,4,124,0,124,1,124,5,
+    100,4,141,3,83,0,124,3,100,2,117,0,114,67,116,0,
+    124,1,100,5,131,2,114,65,122,7,124,1,160,4,124,0,
+    161,1,125,3,87,0,110,13,4,0,116,5,121,64,1,0,
+    1,0,1,0,100,2,125,3,89,0,110,3,119,0,100,6,
+    125,3,116,6,124,0,124,1,124,2,124,3,100,7,141,4,
+    83,0,41,8,122,53,82,101,116,117,114,110,32,97,32,109,
+    111,100,117,108,101,32,115,112,101,99,32,98,97,115,101,100,
+    32,111,110,32,118,97,114,105,111,117,115,32,108,111,97,100,
+    101,114,32,109,101,116,104,111,100,115,46,90,12,103,101,116,
+    95,102,105,108,101,110,97,109,101,78,41,1,114,122,0,0,
+    0,41,2,114,122,0,0,0,114,129,0,0,0,114,128,0,
+    0,0,70,114,148,0,0,0,41,7,114,11,0,0,0,114,
+    139,0,0,0,114,140,0,0,0,218,23,115,112,101,99,95,
+    102,114,111,109,95,102,105,108,101,95,108,111,99,97,116,105,
+    111,110,114,128,0,0,0,114,87,0,0,0,114,125,0,0,
+    0,41,6,114,20,0,0,0,114,122,0,0,0,114,126,0,
+    0,0,114,128,0,0,0,114,149,0,0,0,90,6,115,101,
+    97,114,99,104,114,5,0,0,0,114,5,0,0,0,114,6,
+    0,0,0,114,104,0,0,0,165,1,0,0,115,38,0,0,
+    0,10,2,8,1,4,1,6,1,8,2,12,1,12,1,6,
+    1,2,1,6,255,8,3,10,1,2,1,14,1,12,1,8,
+    1,2,255,4,4,16,2,114,104,0,0,0,99,3,0,0,
+    0,0,0,0,0,0,0,0,0,8,0,0,0,8,0,0,
+    0,67,0,0,0,115,38,1,0,0,122,5,124,0,106,0,
+    125,3,87,0,110,9,4,0,116,1,121,14,1,0,1,0,
+    1,0,89,0,110,7,119,0,124,3,100,0,117,1,114,21,
+    124,3,83,0,124,0,106,2,125,4,124,1,100,0,117,0,
+    114,43,122,5,124,0,106,3,125,1,87,0,110,9,4,0,
+    116,1,121,42,1,0,1,0,1,0,89,0,110,1,119,0,
+    122,5,124,0,106,4,125,5,87,0,110,11,4,0,116,1,
+    121,59,1,0,1,0,1,0,100,0,125,5,89,0,110,1,
+    119,0,124,2,100,0,117,0,114,87,124,5,100,0,117,0,
+    114,85,122,5,124,1,106,5,125,2,87,0,110,13,4,0,
+    116,1,121,84,1,0,1,0,1,0,100,0,125,2,89,0,
+    110,3,119,0,124,5,125,2,122,5,124,0,106,6,125,6,
+    87,0,110,11,4,0,116,1,121,103,1,0,1,0,1,0,
+    100,0,125,6,89,0,110,1,119,0,122,7,116,7,124,0,
+    106,8,131,1,125,7,87,0,110,11,4,0,116,1,121,122,
+    1,0,1,0,1,0,100,0,125,7,89,0,110,1,119,0,
+    116,9,124,4,124,1,124,2,100,1,141,3,125,3,124,5,
+    100,0,117,0,114,136,100,2,110,1,100,3,124,3,95,10,
+    124,6,124,3,95,11,124,7,124,3,95,12,124,3,83,0,
+    41,4,78,169,1,114,126,0,0,0,70,84,41,13,114,113,
+    0,0,0,114,2,0,0,0,114,9,0,0,0,114,112,0,
+    0,0,114,121,0,0,0,218,7,95,79,82,73,71,73,78,
+    218,10,95,95,99,97,99,104,101,100,95,95,218,4,108,105,
+    115,116,218,8,95,95,112,97,116,104,95,95,114,125,0,0,
+    0,114,130,0,0,0,114,135,0,0,0,114,129,0,0,0,
+    41,8,114,110,0,0,0,114,122,0,0,0,114,126,0,0,
+    0,114,109,0,0,0,114,20,0,0,0,90,8,108,111,99,
+    97,116,105,111,110,114,135,0,0,0,114,129,0,0,0,114,
+    5,0,0,0,114,5,0,0,0,114,6,0,0,0,218,17,
+    95,115,112,101,99,95,102,114,111,109,95,109,111,100,117,108,
+    101,191,1,0,0,115,84,0,0,0,2,2,10,1,12,1,
+    4,1,2,255,8,3,4,1,6,2,8,1,2,1,10,1,
+    12,1,4,2,2,254,2,3,10,1,12,1,8,1,2,255,
+    8,2,8,1,2,1,10,1,12,1,8,1,2,255,4,3,
+    2,1,10,1,12,1,8,1,2,255,2,2,14,1,12,1,
+    8,1,2,255,14,3,18,1,6,1,6,1,4,1,114,155,
+    0,0,0,70,169,1,218,8,111,118,101,114,114,105,100,101,
+    99,2,0,0,0,0,0,0,0,1,0,0,0,5,0,0,
+    0,8,0,0,0,67,0,0,0,115,190,1,0,0,124,2,
+    115,10,116,0,124,1,100,1,100,0,131,3,100,0,117,0,
+    114,26,122,6,124,0,106,1,124,1,95,2,87,0,110,9,
+    4,0,116,3,121,25,1,0,1,0,1,0,89,0,110,1,
+    119,0,124,2,115,36,116,0,124,1,100,2,100,0,131,3,
+    100,0,117,0,114,87,124,0,106,4,125,3,124,3,100,0,
+    117,0,114,72,124,0,106,5,100,0,117,1,114,72,116,6,
+    100,0,117,0,114,54,116,7,130,1,116,6,106,8,125,4,
+    124,4,160,9,124,4,161,1,125,3,124,0,106,5,124,3,
+    95,10,124,3,124,0,95,4,100,0,124,1,95,11,122,5,
+    124,3,124,1,95,12,87,0,110,9,4,0,116,3,121,86,
+    1,0,1,0,1,0,89,0,110,1,119,0,124,2,115,97,
+    116,0,124,1,100,3,100,0,131,3,100,0,117,0,114,113,
+    122,6,124,0,106,13,124,1,95,14,87,0,110,9,4,0,
+    116,3,121,112,1,0,1,0,1,0,89,0,110,1,119,0,
+    122,5,124,0,124,1,95,15,87,0,110,9,4,0,116,3,
+    121,127,1,0,1,0,1,0,89,0,110,1,119,0,124,2,
+    115,138,116,0,124,1,100,4,100,0,131,3,100,0,117,0,
+    114,159,124,0,106,5,100,0,117,1,114,159,122,6,124,0,
+    106,5,124,1,95,16,87,0,110,9,4,0,116,3,121,158,
+    1,0,1,0,1,0,89,0,110,1,119,0,124,0,106,17,
+    114,221,124,2,115,172,116,0,124,1,100,5,100,0,131,3,
+    100,0,117,0,114,188,122,6,124,0,106,18,124,1,95,11,
+    87,0,110,9,4,0,116,3,121,187,1,0,1,0,1,0,
+    89,0,110,1,119,0,124,2,115,198,116,0,124,1,100,6,
+    100,0,131,3,100,0,117,0,114,221,124,0,106,19,100,0,
+    117,1,114,221,122,7,124,0,106,19,124,1,95,20,87,0,
+    124,1,83,0,4,0,116,3,121,220,1,0,1,0,1,0,
+    89,0,124,1,83,0,119,0,124,1,83,0,41,7,78,114,
+    9,0,0,0,114,112,0,0,0,218,11,95,95,112,97,99,
+    107,97,103,101,95,95,114,154,0,0,0,114,121,0,0,0,
+    114,152,0,0,0,41,21,114,13,0,0,0,114,20,0,0,
+    0,114,9,0,0,0,114,2,0,0,0,114,122,0,0,0,
+    114,129,0,0,0,114,139,0,0,0,114,140,0,0,0,218,
     16,95,78,97,109,101,115,112,97,99,101,76,111,97,100,101,
     114,218,7,95,95,110,101,119,95,95,90,5,95,112,97,116,
-    104,114,109,0,0,0,114,99,0,0,0,114,131,0,0,0,
-    114,146,0,0,0,114,106,0,0,0,114,142,0,0,0,114,
-    124,0,0,0,114,114,0,0,0,114,123,0,0,0,114,140,
-    0,0,0,41,5,114,96,0,0,0,114,97,0,0,0,114,
-    145,0,0,0,114,110,0,0,0,114,147,0,0,0,114,10,
-    0,0,0,114,10,0,0,0,114,11,0,0,0,218,18,95,
+    104,114,121,0,0,0,114,112,0,0,0,114,143,0,0,0,
+    114,158,0,0,0,114,113,0,0,0,114,154,0,0,0,114,
+    136,0,0,0,114,126,0,0,0,114,135,0,0,0,114,152,
+    0,0,0,41,5,114,109,0,0,0,114,110,0,0,0,114,
+    157,0,0,0,114,122,0,0,0,114,159,0,0,0,114,5,
+    0,0,0,114,5,0,0,0,114,6,0,0,0,218,18,95,
     105,110,105,116,95,109,111,100,117,108,101,95,97,116,116,114,
-    115,230,1,0,0,115,96,0,0,0,0,4,20,1,2,1,
-    12,1,12,1,6,2,20,1,6,1,8,2,10,1,8,1,
-    4,1,6,2,10,1,8,1,6,11,6,1,2,1,10,1,
-    12,1,6,2,20,1,2,1,12,1,12,1,6,2,2,1,
-    10,1,12,1,6,2,24,1,12,1,2,1,12,1,14,1,
-    6,2,8,1,24,1,2,1,12,1,14,1,6,2,24,1,
-    12,1,2,1,12,1,14,1,6,1,114,149,0,0,0,99,
-    1,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,
-    3,0,0,0,67,0,0,0,115,82,0,0,0,100,1,125,
-    1,116,0,124,0,106,1,100,2,131,2,114,30,124,0,106,
-    1,160,2,124,0,161,1,125,1,110,20,116,0,124,0,106,
-    1,100,3,131,2,114,50,116,3,100,4,131,1,130,1,124,
-    1,100,1,117,0,114,68,116,4,124,0,106,5,131,1,125,
-    1,116,6,124,0,124,1,131,2,1,0,124,1,83,0,41,
-    5,122,43,67,114,101,97,116,101,32,97,32,109,111,100,117,
-    108,101,32,98,97,115,101,100,32,111,110,32,116,104,101,32,
-    112,114,111,118,105,100,101,100,32,115,112,101,99,46,78,218,
-    13,99,114,101,97,116,101,95,109,111,100,117,108,101,218,11,
-    101,120,101,99,95,109,111,100,117,108,101,122,66,108,111,97,
-    100,101,114,115,32,116,104,97,116,32,100,101,102,105,110,101,
-    32,101,120,101,99,95,109,111,100,117,108,101,40,41,32,109,
-    117,115,116,32,97,108,115,111,32,100,101,102,105,110,101,32,
-    99,114,101,97,116,101,95,109,111,100,117,108,101,40,41,41,
-    7,114,4,0,0,0,114,110,0,0,0,114,150,0,0,0,
-    114,80,0,0,0,114,18,0,0,0,114,17,0,0,0,114,
-    149,0,0,0,169,2,114,96,0,0,0,114,97,0,0,0,
-    114,10,0,0,0,114,10,0,0,0,114,11,0,0,0,218,
-    16,109,111,100,117,108,101,95,102,114,111,109,95,115,112,101,
-    99,46,2,0,0,115,18,0,0,0,0,3,4,1,12,3,
-    14,1,12,1,8,2,8,1,10,1,10,1,114,153,0,0,
+    115,236,1,0,0,115,114,0,0,0,20,4,2,1,12,1,
+    12,1,4,1,2,255,20,3,6,1,8,1,10,2,8,1,
+    4,1,6,1,10,2,8,1,6,1,6,11,2,1,10,1,
+    12,1,4,1,2,255,20,3,2,1,12,1,12,1,4,1,
+    2,255,2,3,10,1,12,1,4,1,2,255,20,3,10,1,
+    2,1,12,1,12,1,4,1,2,255,6,3,20,1,2,1,
+    12,1,12,1,4,1,2,255,20,3,10,1,2,1,10,1,
+    4,3,12,254,2,1,4,1,2,254,4,2,114,161,0,0,
     0,99,1,0,0,0,0,0,0,0,0,0,0,0,2,0,
-    0,0,4,0,0,0,67,0,0,0,115,106,0,0,0,124,
-    0,106,0,100,1,117,0,114,14,100,2,110,4,124,0,106,
-    0,125,1,124,0,106,1,100,1,117,0,114,66,124,0,106,
-    2,100,1,117,0,114,50,100,3,160,3,124,1,161,1,83,
-    0,100,4,160,3,124,1,124,0,106,2,161,2,83,0,110,
-    36,124,0,106,4,114,86,100,5,160,3,124,1,124,0,106,
+    0,0,3,0,0,0,67,0,0,0,115,82,0,0,0,100,
+    1,125,1,116,0,124,0,106,1,100,2,131,2,114,15,124,
+    0,106,1,160,2,124,0,161,1,125,1,110,10,116,0,124,
+    0,106,1,100,3,131,2,114,25,116,3,100,4,131,1,130,
+    1,124,1,100,1,117,0,114,34,116,4,124,0,106,5,131,
+    1,125,1,116,6,124,0,124,1,131,2,1,0,124,1,83,
+    0,41,5,122,43,67,114,101,97,116,101,32,97,32,109,111,
+    100,117,108,101,32,98,97,115,101,100,32,111,110,32,116,104,
+    101,32,112,114,111,118,105,100,101,100,32,115,112,101,99,46,
+    78,218,13,99,114,101,97,116,101,95,109,111,100,117,108,101,
+    218,11,101,120,101,99,95,109,111,100,117,108,101,122,66,108,
+    111,97,100,101,114,115,32,116,104,97,116,32,100,101,102,105,
+    110,101,32,101,120,101,99,95,109,111,100,117,108,101,40,41,
+    32,109,117,115,116,32,97,108,115,111,32,100,101,102,105,110,
+    101,32,99,114,101,97,116,101,95,109,111,100,117,108,101,40,
+    41,41,7,114,11,0,0,0,114,122,0,0,0,114,162,0,
+    0,0,114,87,0,0,0,114,21,0,0,0,114,20,0,0,
+    0,114,161,0,0,0,169,2,114,109,0,0,0,114,110,0,
+    0,0,114,5,0,0,0,114,5,0,0,0,114,6,0,0,
+    0,218,16,109,111,100,117,108,101,95,102,114,111,109,95,115,
+    112,101,99,52,2,0,0,115,18,0,0,0,4,3,12,1,
+    14,3,12,1,8,1,8,2,10,1,10,1,4,1,114,165,
+    0,0,0,99,1,0,0,0,0,0,0,0,0,0,0,0,
+    2,0,0,0,4,0,0,0,67,0,0,0,115,100,0,0,
+    0,124,0,106,0,100,1,117,0,114,7,100,2,110,2,124,
+    0,106,0,125,1,124,0,106,1,100,1,117,0,114,32,124,
+    0,106,2,100,1,117,0,114,25,100,3,160,3,124,1,161,
+    1,83,0,100,4,160,3,124,1,124,0,106,2,161,2,83,
+    0,124,0,106,4,114,42,100,5,160,3,124,1,124,0,106,
     1,161,2,83,0,100,6,160,3,124,0,106,0,124,0,106,
-    1,161,2,83,0,100,1,83,0,41,7,122,38,82,101,116,
-    117,114,110,32,116,104,101,32,114,101,112,114,32,116,111,32,
-    117,115,101,32,102,111,114,32,116,104,101,32,109,111,100,117,
-    108,101,46,78,114,101,0,0,0,114,102,0,0,0,114,103,
-    0,0,0,114,104,0,0,0,250,18,60,109,111,100,117,108,
-    101,32,123,33,114,125,32,40,123,125,41,62,41,5,114,17,
-    0,0,0,114,114,0,0,0,114,110,0,0,0,114,46,0,
-    0,0,114,124,0,0,0,41,2,114,96,0,0,0,114,17,
-    0,0,0,114,10,0,0,0,114,10,0,0,0,114,11,0,
-    0,0,114,108,0,0,0,63,2,0,0,115,16,0,0,0,
-    0,3,20,1,10,1,10,1,10,2,16,2,6,1,14,2,
-    114,108,0,0,0,99,2,0,0,0,0,0,0,0,0,0,
-    0,0,4,0,0,0,10,0,0,0,67,0,0,0,115,250,
-    0,0,0,124,0,106,0,125,2,116,1,124,2,131,1,143,
-    216,1,0,116,2,106,3,160,4,124,2,161,1,124,1,117,
-    1,114,54,100,1,160,5,124,2,161,1,125,3,116,6,124,
-    3,124,2,100,2,141,2,130,1,122,132,124,0,106,7,100,
-    3,117,0,114,106,124,0,106,8,100,3,117,0,114,90,116,
-    6,100,4,124,0,106,0,100,2,141,2,130,1,116,9,124,
-    0,124,1,100,5,100,6,141,3,1,0,110,52,116,9,124,
-    0,124,1,100,5,100,6,141,3,1,0,116,10,124,0,106,
-    7,100,7,131,2,115,146,124,0,106,7,160,11,124,2,161,
-    1,1,0,110,12,124,0,106,7,160,12,124,1,161,1,1,
-    0,87,0,116,2,106,3,160,13,124,0,106,0,161,1,125,
-    1,124,1,116,2,106,3,124,0,106,0,60,0,110,28,116,
-    2,106,3,160,13,124,0,106,0,161,1,125,1,124,1,116,
-    2,106,3,124,0,106,0,60,0,48,0,87,0,100,3,4,
-    0,4,0,131,3,1,0,110,16,49,0,115,236,48,0,1,
-    0,1,0,1,0,89,0,1,0,124,1,83,0,41,8,122,
-    70,69,120,101,99,117,116,101,32,116,104,101,32,115,112,101,
-    99,39,115,32,115,112,101,99,105,102,105,101,100,32,109,111,
-    100,117,108,101,32,105,110,32,97,110,32,101,120,105,115,116,
-    105,110,103,32,109,111,100,117,108,101,39,115,32,110,97,109,
-    101,115,112,97,99,101,46,122,30,109,111,100,117,108,101,32,
-    123,33,114,125,32,110,111,116,32,105,110,32,115,121,115,46,
-    109,111,100,117,108,101,115,114,16,0,0,0,78,250,14,109,
-    105,115,115,105,110,103,32,108,111,97,100,101,114,84,114,144,
-    0,0,0,114,151,0,0,0,41,14,114,17,0,0,0,114,
-    51,0,0,0,114,15,0,0,0,114,93,0,0,0,114,35,
-    0,0,0,114,46,0,0,0,114,80,0,0,0,114,110,0,
-    0,0,114,117,0,0,0,114,149,0,0,0,114,4,0,0,
-    0,218,11,108,111,97,100,95,109,111,100,117,108,101,114,151,
-    0,0,0,218,3,112,111,112,41,4,114,96,0,0,0,114,
-    97,0,0,0,114,17,0,0,0,218,3,109,115,103,114,10,
-    0,0,0,114,10,0,0,0,114,11,0,0,0,114,94,0,
-    0,0,80,2,0,0,115,38,0,0,0,0,2,6,1,10,
-    1,16,1,10,1,12,1,2,1,10,1,10,1,14,2,16,
-    2,14,1,12,4,14,2,14,4,14,1,14,255,14,1,44,
-    1,114,94,0,0,0,99,1,0,0,0,0,0,0,0,0,
-    0,0,0,2,0,0,0,8,0,0,0,67,0,0,0,115,
-    20,1,0,0,122,18,124,0,106,0,160,1,124,0,106,2,
-    161,1,1,0,87,0,110,52,1,0,1,0,1,0,124,0,
-    106,2,116,3,106,4,118,0,114,64,116,3,106,4,160,5,
-    124,0,106,2,161,1,125,1,124,1,116,3,106,4,124,0,
-    106,2,60,0,130,0,89,0,110,2,48,0,116,3,106,4,
-    160,5,124,0,106,2,161,1,125,1,124,1,116,3,106,4,
-    124,0,106,2,60,0,116,6,124,1,100,1,100,0,131,3,
-    100,0,117,0,114,146,122,12,124,0,106,0,124,1,95,7,
-    87,0,110,18,4,0,116,8,121,144,1,0,1,0,1,0,
-    89,0,110,2,48,0,116,6,124,1,100,2,100,0,131,3,
-    100,0,117,0,114,222,122,40,124,1,106,9,124,1,95,10,
-    116,11,124,1,100,3,131,2,115,200,124,0,106,2,160,12,
-    100,4,161,1,100,5,25,0,124,1,95,10,87,0,110,18,
-    4,0,116,8,121,220,1,0,1,0,1,0,89,0,110,2,
-    48,0,116,6,124,1,100,6,100,0,131,3,100,0,117,0,
-    144,1,114,16,122,10,124,0,124,1,95,13,87,0,110,20,
-    4,0,116,8,144,1,121,14,1,0,1,0,1,0,89,0,
-    110,2,48,0,124,1,83,0,41,7,78,114,99,0,0,0,
-    114,146,0,0,0,114,142,0,0,0,114,129,0,0,0,114,
-    22,0,0,0,114,106,0,0,0,41,14,114,110,0,0,0,
-    114,156,0,0,0,114,17,0,0,0,114,15,0,0,0,114,
-    93,0,0,0,114,157,0,0,0,114,6,0,0,0,114,99,
-    0,0,0,114,107,0,0,0,114,1,0,0,0,114,146,0,
-    0,0,114,4,0,0,0,114,130,0,0,0,114,106,0,0,
-    0,114,152,0,0,0,114,10,0,0,0,114,10,0,0,0,
-    114,11,0,0,0,218,25,95,108,111,97,100,95,98,97,99,
-    107,119,97,114,100,95,99,111,109,112,97,116,105,98,108,101,
-    110,2,0,0,115,54,0,0,0,0,4,2,1,18,1,6,
-    1,12,1,14,1,12,1,8,3,14,1,12,1,16,1,2,
-    1,12,1,12,1,6,1,16,1,2,4,8,1,10,1,22,
-    1,12,1,6,1,18,1,2,1,10,1,14,1,6,1,114,
-    159,0,0,0,99,1,0,0,0,0,0,0,0,0,0,0,
-    0,2,0,0,0,11,0,0,0,67,0,0,0,115,224,0,
-    0,0,124,0,106,0,100,0,117,1,114,30,116,1,124,0,
-    106,0,100,1,131,2,115,30,116,2,124,0,131,1,83,0,
-    116,3,124,0,131,1,125,1,100,2,124,0,95,4,122,166,
-    124,1,116,5,106,6,124,0,106,7,60,0,122,52,124,0,
-    106,0,100,0,117,0,114,96,124,0,106,8,100,0,117,0,
-    114,108,116,9,100,3,124,0,106,7,100,4,141,2,130,1,
-    110,12,124,0,106,0,160,10,124,1,161,1,1,0,87,0,
-    110,48,1,0,1,0,1,0,122,14,116,5,106,6,124,0,
-    106,7,61,0,87,0,110,18,4,0,116,11,121,150,1,0,
-    1,0,1,0,89,0,110,2,48,0,130,0,89,0,110,2,
-    48,0,116,5,106,6,160,12,124,0,106,7,161,1,125,1,
-    124,1,116,5,106,6,124,0,106,7,60,0,116,13,100,5,
-    124,0,106,7,124,0,106,0,131,3,1,0,87,0,100,6,
-    124,0,95,4,110,8,100,6,124,0,95,4,48,0,124,1,
-    83,0,41,7,78,114,151,0,0,0,84,114,155,0,0,0,
-    114,16,0,0,0,122,18,105,109,112,111,114,116,32,123,33,
-    114,125,32,35,32,123,33,114,125,70,41,14,114,110,0,0,
-    0,114,4,0,0,0,114,159,0,0,0,114,153,0,0,0,
-    90,13,95,105,110,105,116,105,97,108,105,122,105,110,103,114,
-    15,0,0,0,114,93,0,0,0,114,17,0,0,0,114,117,
-    0,0,0,114,80,0,0,0,114,151,0,0,0,114,64,0,
-    0,0,114,157,0,0,0,114,77,0,0,0,114,152,0,0,
-    0,114,10,0,0,0,114,10,0,0,0,114,11,0,0,0,
-    218,14,95,108,111,97,100,95,117,110,108,111,99,107,101,100,
-    147,2,0,0,115,46,0,0,0,0,2,10,2,12,1,8,
-    2,8,5,6,1,2,1,12,1,2,1,10,1,10,1,16,
-    3,16,1,6,1,2,1,14,1,12,1,6,1,8,5,14,
-    1,12,1,18,2,16,2,114,160,0,0,0,99,1,0,0,
-    0,0,0,0,0,0,0,0,0,1,0,0,0,8,0,0,
-    0,67,0,0,0,115,54,0,0,0,116,0,124,0,106,1,
-    131,1,143,24,1,0,116,2,124,0,131,1,87,0,2,0,
-    100,1,4,0,4,0,131,3,1,0,83,0,49,0,115,40,
-    48,0,1,0,1,0,1,0,89,0,1,0,100,1,83,0,
-    41,2,122,191,82,101,116,117,114,110,32,97,32,110,101,119,
-    32,109,111,100,117,108,101,32,111,98,106,101,99,116,44,32,
-    108,111,97,100,101,100,32,98,121,32,116,104,101,32,115,112,
-    101,99,39,115,32,108,111,97,100,101,114,46,10,10,32,32,
-    32,32,84,104,101,32,109,111,100,117,108,101,32,105,115,32,
-    110,111,116,32,97,100,100,101,100,32,116,111,32,105,116,115,
-    32,112,97,114,101,110,116,46,10,10,32,32,32,32,73,102,
-    32,97,32,109,111,100,117,108,101,32,105,115,32,97,108,114,
-    101,97,100,121,32,105,110,32,115,121,115,46,109,111,100,117,
-    108,101,115,44,32,116,104,97,116,32,101,120,105,115,116,105,
-    110,103,32,109,111,100,117,108,101,32,103,101,116,115,10,32,
-    32,32,32,99,108,111,98,98,101,114,101,100,46,10,10,32,
-    32,32,32,78,41,3,114,51,0,0,0,114,17,0,0,0,
-    114,160,0,0,0,41,1,114,96,0,0,0,114,10,0,0,
-    0,114,10,0,0,0,114,11,0,0,0,114,95,0,0,0,
-    189,2,0,0,115,4,0,0,0,0,9,12,1,114,95,0,
-    0,0,99,0,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,0,0,4,0,0,0,64,0,0,0,115,140,0,0,0,
-    101,0,90,1,100,0,90,2,100,1,90,3,100,2,90,4,
-    101,5,100,3,100,4,132,0,131,1,90,6,101,7,100,20,
-    100,6,100,7,132,1,131,1,90,8,101,7,100,21,100,8,
-    100,9,132,1,131,1,90,9,101,7,100,10,100,11,132,0,
-    131,1,90,10,101,7,100,12,100,13,132,0,131,1,90,11,
-    101,7,101,12,100,14,100,15,132,0,131,1,131,1,90,13,
-    101,7,101,12,100,16,100,17,132,0,131,1,131,1,90,14,
-    101,7,101,12,100,18,100,19,132,0,131,1,131,1,90,15,
-    101,7,101,16,131,1,90,17,100,5,83,0,41,22,218,15,
-    66,117,105,108,116,105,110,73,109,112,111,114,116,101,114,122,
-    144,77,101,116,97,32,112,97,116,104,32,105,109,112,111,114,
-    116,32,102,111,114,32,98,117,105,108,116,45,105,110,32,109,
-    111,100,117,108,101,115,46,10,10,32,32,32,32,65,108,108,
-    32,109,101,116,104,111,100,115,32,97,114,101,32,101,105,116,
-    104,101,114,32,99,108,97,115,115,32,111,114,32,115,116,97,
-    116,105,99,32,109,101,116,104,111,100,115,32,116,111,32,97,
-    118,111,105,100,32,116,104,101,32,110,101,101,100,32,116,111,
-    10,32,32,32,32,105,110,115,116,97,110,116,105,97,116,101,
-    32,116,104,101,32,99,108,97,115,115,46,10,10,32,32,32,
-    32,122,8,98,117,105,108,116,45,105,110,99,1,0,0,0,
-    0,0,0,0,0,0,0,0,1,0,0,0,5,0,0,0,
-    67,0,0,0,115,22,0,0,0,100,1,124,0,106,0,155,
-    2,100,2,116,1,106,2,155,0,100,3,157,5,83,0,41,
-    4,250,115,82,101,116,117,114,110,32,114,101,112,114,32,102,
-    111,114,32,116,104,101,32,109,111,100,117,108,101,46,10,10,
-    32,32,32,32,32,32,32,32,84,104,101,32,109,101,116,104,
-    111,100,32,105,115,32,100,101,112,114,101,99,97,116,101,100,
-    46,32,32,84,104,101,32,105,109,112,111,114,116,32,109,97,
-    99,104,105,110,101,114,121,32,100,111,101,115,32,116,104,101,
-    32,106,111,98,32,105,116,115,101,108,102,46,10,10,32,32,
-    32,32,32,32,32,32,122,8,60,109,111,100,117,108,101,32,
-    122,2,32,40,122,2,41,62,41,3,114,1,0,0,0,114,
-    161,0,0,0,114,139,0,0,0,41,1,114,97,0,0,0,
-    114,10,0,0,0,114,10,0,0,0,114,11,0,0,0,114,
-    100,0,0,0,215,2,0,0,115,2,0,0,0,0,7,122,
-    27,66,117,105,108,116,105,110,73,109,112,111,114,116,101,114,
-    46,109,111,100,117,108,101,95,114,101,112,114,78,99,4,0,
-    0,0,0,0,0,0,0,0,0,0,4,0,0,0,5,0,
-    0,0,67,0,0,0,115,46,0,0,0,124,2,100,0,117,
-    1,114,12,100,0,83,0,116,0,160,1,124,1,161,1,114,
-    38,116,2,124,1,124,0,124,0,106,3,100,1,141,3,83,
-    0,100,0,83,0,100,0,83,0,169,2,78,114,138,0,0,
-    0,41,4,114,58,0,0,0,90,10,105,115,95,98,117,105,
-    108,116,105,110,114,92,0,0,0,114,139,0,0,0,169,4,
-    218,3,99,108,115,114,82,0,0,0,218,4,112,97,116,104,
-    218,6,116,97,114,103,101,116,114,10,0,0,0,114,10,0,
-    0,0,114,11,0,0,0,218,9,102,105,110,100,95,115,112,
-    101,99,224,2,0,0,115,10,0,0,0,0,2,8,1,4,
-    1,10,1,16,2,122,25,66,117,105,108,116,105,110,73,109,
-    112,111,114,116,101,114,46,102,105,110,100,95,115,112,101,99,
-    99,3,0,0,0,0,0,0,0,0,0,0,0,4,0,0,
-    0,4,0,0,0,67,0,0,0,115,30,0,0,0,124,0,
-    160,0,124,1,124,2,161,2,125,3,124,3,100,1,117,1,
-    114,26,124,3,106,1,83,0,100,1,83,0,41,2,122,175,
-    70,105,110,100,32,116,104,101,32,98,117,105,108,116,45,105,
-    110,32,109,111,100,117,108,101,46,10,10,32,32,32,32,32,
-    32,32,32,73,102,32,39,112,97,116,104,39,32,105,115,32,
-    101,118,101,114,32,115,112,101,99,105,102,105,101,100,32,116,
-    104,101,110,32,116,104,101,32,115,101,97,114,99,104,32,105,
-    115,32,99,111,110,115,105,100,101,114,101,100,32,97,32,102,
-    97,105,108,117,114,101,46,10,10,32,32,32,32,32,32,32,
-    32,84,104,105,115,32,109,101,116,104,111,100,32,105,115,32,
-    100,101,112,114,101,99,97,116,101,100,46,32,32,85,115,101,
-    32,102,105,110,100,95,115,112,101,99,40,41,32,105,110,115,
-    116,101,97,100,46,10,10,32,32,32,32,32,32,32,32,78,
-    41,2,114,168,0,0,0,114,110,0,0,0,41,4,114,165,
-    0,0,0,114,82,0,0,0,114,166,0,0,0,114,96,0,
-    0,0,114,10,0,0,0,114,10,0,0,0,114,11,0,0,
-    0,218,11,102,105,110,100,95,109,111,100,117,108,101,233,2,
-    0,0,115,4,0,0,0,0,9,12,1,122,27,66,117,105,
-    108,116,105,110,73,109,112,111,114,116,101,114,46,102,105,110,
-    100,95,109,111,100,117,108,101,99,2,0,0,0,0,0,0,
-    0,0,0,0,0,2,0,0,0,4,0,0,0,67,0,0,
-    0,115,46,0,0,0,124,1,106,0,116,1,106,2,118,1,
-    114,34,116,3,100,1,160,4,124,1,106,0,161,1,124,1,
-    106,0,100,2,141,2,130,1,116,5,116,6,106,7,124,1,
-    131,2,83,0,41,3,122,24,67,114,101,97,116,101,32,97,
-    32,98,117,105,108,116,45,105,110,32,109,111,100,117,108,101,
-    114,78,0,0,0,114,16,0,0,0,41,8,114,17,0,0,
-    0,114,15,0,0,0,114,79,0,0,0,114,80,0,0,0,
-    114,46,0,0,0,114,68,0,0,0,114,58,0,0,0,90,
-    14,99,114,101,97,116,101,95,98,117,105,108,116,105,110,41,
-    2,114,30,0,0,0,114,96,0,0,0,114,10,0,0,0,
-    114,10,0,0,0,114,11,0,0,0,114,150,0,0,0,245,
-    2,0,0,115,10,0,0,0,0,3,12,1,12,1,4,255,
-    6,2,122,29,66,117,105,108,116,105,110,73,109,112,111,114,
-    116,101,114,46,99,114,101,97,116,101,95,109,111,100,117,108,
-    101,99,2,0,0,0,0,0,0,0,0,0,0,0,2,0,
-    0,0,3,0,0,0,67,0,0,0,115,16,0,0,0,116,
-    0,116,1,106,2,124,1,131,2,1,0,100,1,83,0,41,
-    2,122,22,69,120,101,99,32,97,32,98,117,105,108,116,45,
-    105,110,32,109,111,100,117,108,101,78,41,3,114,68,0,0,
-    0,114,58,0,0,0,90,12,101,120,101,99,95,98,117,105,
-    108,116,105,110,41,2,114,30,0,0,0,114,97,0,0,0,
-    114,10,0,0,0,114,10,0,0,0,114,11,0,0,0,114,
-    151,0,0,0,253,2,0,0,115,2,0,0,0,0,3,122,
-    27,66,117,105,108,116,105,110,73,109,112,111,114,116,101,114,
-    46,101,120,101,99,95,109,111,100,117,108,101,99,2,0,0,
-    0,0,0,0,0,0,0,0,0,2,0,0,0,1,0,0,
-    0,67,0,0,0,115,4,0,0,0,100,1,83,0,41,2,
-    122,57,82,101,116,117,114,110,32,78,111,110,101,32,97,115,
-    32,98,117,105,108,116,45,105,110,32,109,111,100,117,108,101,
-    115,32,100,111,32,110,111,116,32,104,97,118,101,32,99,111,
-    100,101,32,111,98,106,101,99,116,115,46,78,114,10,0,0,
-    0,169,2,114,165,0,0,0,114,82,0,0,0,114,10,0,
-    0,0,114,10,0,0,0,114,11,0,0,0,218,8,103,101,
-    116,95,99,111,100,101,2,3,0,0,115,2,0,0,0,0,
-    4,122,24,66,117,105,108,116,105,110,73,109,112,111,114,116,
-    101,114,46,103,101,116,95,99,111,100,101,99,2,0,0,0,
-    0,0,0,0,0,0,0,0,2,0,0,0,1,0,0,0,
-    67,0,0,0,115,4,0,0,0,100,1,83,0,41,2,122,
-    56,82,101,116,117,114,110,32,78,111,110,101,32,97,115,32,
+    1,161,2,83,0,41,7,122,38,82,101,116,117,114,110,32,
+    116,104,101,32,114,101,112,114,32,116,111,32,117,115,101,32,
+    102,111,114,32,116,104,101,32,109,111,100,117,108,101,46,78,
+    114,115,0,0,0,114,116,0,0,0,114,117,0,0,0,114,
+    118,0,0,0,250,18,60,109,111,100,117,108,101,32,123,33,
+    114,125,32,40,123,125,41,62,41,5,114,20,0,0,0,114,
+    126,0,0,0,114,122,0,0,0,114,50,0,0,0,114,136,
+    0,0,0,41,2,114,109,0,0,0,114,20,0,0,0,114,
+    5,0,0,0,114,5,0,0,0,114,6,0,0,0,114,119,
+    0,0,0,69,2,0,0,115,16,0,0,0,20,3,10,1,
+    10,1,10,1,14,2,6,2,14,1,16,2,114,119,0,0,
+    0,99,2,0,0,0,0,0,0,0,0,0,0,0,4,0,
+    0,0,10,0,0,0,67,0,0,0,115,24,1,0,0,124,
+    0,106,0,125,2,116,1,124,2,131,1,143,123,1,0,116,
+    2,106,3,160,4,124,2,161,1,124,1,117,1,114,27,100,
+    1,160,5,124,2,161,1,125,3,116,6,124,3,124,2,100,
+    2,141,2,130,1,122,80,124,0,106,7,100,3,117,0,114,
+    53,124,0,106,8,100,3,117,0,114,45,116,6,100,4,124,
+    0,106,0,100,2,141,2,130,1,116,9,124,0,124,1,100,
+    5,100,6,141,3,1,0,110,40,116,9,124,0,124,1,100,
+    5,100,6,141,3,1,0,116,10,124,0,106,7,100,7,131,
+    2,115,87,116,11,124,0,106,7,131,1,155,0,100,8,157,
+    2,125,3,116,12,160,13,124,3,116,14,161,2,1,0,124,
+    0,106,7,160,15,124,2,161,1,1,0,110,6,124,0,106,
+    7,160,16,124,1,161,1,1,0,87,0,116,2,106,3,160,
+    17,124,0,106,0,161,1,125,1,124,1,116,2,106,3,124,
+    0,106,0,60,0,110,14,116,2,106,3,160,17,124,0,106,
+    0,161,1,125,1,124,1,116,2,106,3,124,0,106,0,60,
+    0,119,0,87,0,100,3,4,0,4,0,131,3,1,0,124,
+    1,83,0,49,0,115,133,119,1,1,0,1,0,1,0,89,
+    0,1,0,124,1,83,0,41,9,122,70,69,120,101,99,117,
+    116,101,32,116,104,101,32,115,112,101,99,39,115,32,115,112,
+    101,99,105,102,105,101,100,32,109,111,100,117,108,101,32,105,
+    110,32,97,110,32,101,120,105,115,116,105,110,103,32,109,111,
+    100,117,108,101,39,115,32,110,97,109,101,115,112,97,99,101,
+    46,122,30,109,111,100,117,108,101,32,123,33,114,125,32,110,
+    111,116,32,105,110,32,115,121,115,46,109,111,100,117,108,101,
+    115,114,19,0,0,0,78,250,14,109,105,115,115,105,110,103,
+    32,108,111,97,100,101,114,84,114,156,0,0,0,114,163,0,
+    0,0,250,55,46,101,120,101,99,95,109,111,100,117,108,101,
+    40,41,32,110,111,116,32,102,111,117,110,100,59,32,102,97,
+    108,108,105,110,103,32,98,97,99,107,32,116,111,32,108,111,
+    97,100,95,109,111,100,117,108,101,40,41,41,18,114,20,0,
+    0,0,114,57,0,0,0,114,18,0,0,0,114,105,0,0,
+    0,114,38,0,0,0,114,50,0,0,0,114,87,0,0,0,
+    114,122,0,0,0,114,129,0,0,0,114,161,0,0,0,114,
+    11,0,0,0,114,7,0,0,0,114,101,0,0,0,114,102,
+    0,0,0,218,13,73,109,112,111,114,116,87,97,114,110,105,
+    110,103,218,11,108,111,97,100,95,109,111,100,117,108,101,114,
+    163,0,0,0,218,3,112,111,112,41,4,114,109,0,0,0,
+    114,110,0,0,0,114,20,0,0,0,114,108,0,0,0,114,
+    5,0,0,0,114,5,0,0,0,114,6,0,0,0,114,106,
+    0,0,0,86,2,0,0,115,50,0,0,0,6,2,10,1,
+    16,1,10,1,12,1,2,1,10,1,10,1,14,1,16,2,
+    14,2,12,1,16,1,12,2,14,1,12,2,2,128,14,4,
+    14,1,14,255,16,1,10,233,4,24,16,232,4,24,114,106,
+    0,0,0,99,1,0,0,0,0,0,0,0,0,0,0,0,
+    2,0,0,0,8,0,0,0,67,0,0,0,115,14,1,0,
+    0,122,9,124,0,106,0,160,1,124,0,106,2,161,1,1,
+    0,87,0,110,23,1,0,1,0,1,0,124,0,106,2,116,
+    3,106,4,118,0,114,32,116,3,106,4,160,5,124,0,106,
+    2,161,1,125,1,124,1,116,3,106,4,124,0,106,2,60,
+    0,130,0,116,3,106,4,160,5,124,0,106,2,161,1,125,
+    1,124,1,116,3,106,4,124,0,106,2,60,0,116,6,124,
+    1,100,1,100,0,131,3,100,0,117,0,114,70,122,6,124,
+    0,106,0,124,1,95,7,87,0,110,9,4,0,116,8,121,
+    69,1,0,1,0,1,0,89,0,110,1,119,0,116,6,124,
+    1,100,2,100,0,131,3,100,0,117,0,114,108,122,20,124,
+    1,106,9,124,1,95,10,116,11,124,1,100,3,131,2,115,
+    97,124,0,106,2,160,12,100,4,161,1,100,5,25,0,124,
+    1,95,10,87,0,110,9,4,0,116,8,121,107,1,0,1,
+    0,1,0,89,0,110,1,119,0,116,6,124,1,100,6,100,
+    0,131,3,100,0,117,0,114,133,122,6,124,0,124,1,95,
+    13,87,0,124,1,83,0,4,0,116,8,121,132,1,0,1,
+    0,1,0,89,0,124,1,83,0,119,0,124,1,83,0,41,
+    7,78,114,112,0,0,0,114,158,0,0,0,114,154,0,0,
+    0,114,141,0,0,0,114,25,0,0,0,114,113,0,0,0,
+    41,14,114,122,0,0,0,114,170,0,0,0,114,20,0,0,
+    0,114,18,0,0,0,114,105,0,0,0,114,171,0,0,0,
+    114,13,0,0,0,114,112,0,0,0,114,2,0,0,0,114,
+    9,0,0,0,114,158,0,0,0,114,11,0,0,0,114,142,
+    0,0,0,114,113,0,0,0,114,164,0,0,0,114,5,0,
+    0,0,114,5,0,0,0,114,6,0,0,0,218,25,95,108,
+    111,97,100,95,98,97,99,107,119,97,114,100,95,99,111,109,
+    112,97,116,105,98,108,101,116,2,0,0,115,66,0,0,0,
+    2,3,18,1,6,1,12,1,14,1,12,1,2,1,14,3,
+    12,1,16,1,2,1,12,1,12,1,4,1,2,255,16,2,
+    2,1,8,4,10,1,18,1,4,128,12,1,4,1,2,255,
+    16,2,2,1,8,1,4,3,12,254,2,1,4,1,2,254,
+    4,2,114,172,0,0,0,99,1,0,0,0,0,0,0,0,
+    0,0,0,0,3,0,0,0,11,0,0,0,67,0,0,0,
+    115,242,0,0,0,124,0,106,0,100,0,117,1,114,29,116,
+    1,124,0,106,0,100,1,131,2,115,29,116,2,124,0,106,
+    0,131,1,155,0,100,2,157,2,125,1,116,3,160,4,124,
+    1,116,5,161,2,1,0,116,6,124,0,131,1,83,0,116,
+    7,124,0,131,1,125,2,100,3,124,0,95,8,122,80,124,
+    2,116,9,106,10,124,0,106,11,60,0,122,26,124,0,106,
+    0,100,0,117,0,114,62,124,0,106,12,100,0,117,0,114,
+    61,116,13,100,4,124,0,106,11,100,5,141,2,130,1,110,
+    6,124,0,106,0,160,14,124,2,161,1,1,0,87,0,110,
+    20,1,0,1,0,1,0,122,7,116,9,106,10,124,0,106,
+    11,61,0,87,0,130,0,4,0,116,15,121,89,1,0,1,
+    0,1,0,89,0,130,0,119,0,116,9,106,10,160,16,124,
+    0,106,11,161,1,125,2,124,2,116,9,106,10,124,0,106,
+    11,60,0,116,17,100,6,124,0,106,11,124,0,106,0,131,
+    3,1,0,87,0,100,7,124,0,95,8,124,2,83,0,100,
+    7,124,0,95,8,119,0,41,8,78,114,163,0,0,0,114,
+    168,0,0,0,84,114,167,0,0,0,114,19,0,0,0,122,
+    18,105,109,112,111,114,116,32,123,33,114,125,32,35,32,123,
+    33,114,125,70,41,18,114,122,0,0,0,114,11,0,0,0,
+    114,7,0,0,0,114,101,0,0,0,114,102,0,0,0,114,
+    169,0,0,0,114,172,0,0,0,114,165,0,0,0,90,13,
+    95,105,110,105,116,105,97,108,105,122,105,110,103,114,18,0,
+    0,0,114,105,0,0,0,114,20,0,0,0,114,129,0,0,
+    0,114,87,0,0,0,114,163,0,0,0,114,70,0,0,0,
+    114,171,0,0,0,114,83,0,0,0,41,3,114,109,0,0,
+    0,114,108,0,0,0,114,110,0,0,0,114,5,0,0,0,
+    114,5,0,0,0,114,6,0,0,0,218,14,95,108,111,97,
+    100,95,117,110,108,111,99,107,101,100,152,2,0,0,115,60,
+    0,0,0,10,2,12,2,16,1,12,2,8,1,8,2,6,
+    5,2,1,12,1,2,1,10,1,10,1,14,1,2,255,12,
+    4,4,128,6,1,2,1,12,1,2,3,12,254,2,1,2,
+    1,2,254,14,7,12,1,18,1,6,2,4,2,8,254,114,
+    173,0,0,0,99,1,0,0,0,0,0,0,0,0,0,0,
+    0,1,0,0,0,8,0,0,0,67,0,0,0,115,54,0,
+    0,0,116,0,124,0,106,1,131,1,143,12,1,0,116,2,
+    124,0,131,1,87,0,2,0,100,1,4,0,4,0,131,3,
+    1,0,83,0,49,0,115,20,119,1,1,0,1,0,1,0,
+    89,0,1,0,100,1,83,0,41,2,122,191,82,101,116,117,
+    114,110,32,97,32,110,101,119,32,109,111,100,117,108,101,32,
+    111,98,106,101,99,116,44,32,108,111,97,100,101,100,32,98,
+    121,32,116,104,101,32,115,112,101,99,39,115,32,108,111,97,
+    100,101,114,46,10,10,32,32,32,32,84,104,101,32,109,111,
+    100,117,108,101,32,105,115,32,110,111,116,32,97,100,100,101,
+    100,32,116,111,32,105,116,115,32,112,97,114,101,110,116,46,
+    10,10,32,32,32,32,73,102,32,97,32,109,111,100,117,108,
+    101,32,105,115,32,97,108,114,101,97,100,121,32,105,110,32,
+    115,121,115,46,109,111,100,117,108,101,115,44,32,116,104,97,
+    116,32,101,120,105,115,116,105,110,103,32,109,111,100,117,108,
+    101,32,103,101,116,115,10,32,32,32,32,99,108,111,98,98,
+    101,114,101,100,46,10,10,32,32,32,32,78,41,3,114,57,
+    0,0,0,114,20,0,0,0,114,173,0,0,0,169,1,114,
+    109,0,0,0,114,5,0,0,0,114,5,0,0,0,114,6,
+    0,0,0,114,107,0,0,0,197,2,0,0,115,6,0,0,
+    0,12,9,6,1,36,255,114,107,0,0,0,99,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,
+    0,64,0,0,0,115,140,0,0,0,101,0,90,1,100,0,
+    90,2,100,1,90,3,100,2,90,4,101,5,100,3,100,4,
+    132,0,131,1,90,6,101,7,100,20,100,6,100,7,132,1,
+    131,1,90,8,101,7,100,21,100,8,100,9,132,1,131,1,
+    90,9,101,5,100,10,100,11,132,0,131,1,90,10,101,5,
+    100,12,100,13,132,0,131,1,90,11,101,7,101,12,100,14,
+    100,15,132,0,131,1,131,1,90,13,101,7,101,12,100,16,
+    100,17,132,0,131,1,131,1,90,14,101,7,101,12,100,18,
+    100,19,132,0,131,1,131,1,90,15,101,7,101,16,131,1,
+    90,17,100,5,83,0,41,22,218,15,66,117,105,108,116,105,
+    110,73,109,112,111,114,116,101,114,122,144,77,101,116,97,32,
+    112,97,116,104,32,105,109,112,111,114,116,32,102,111,114,32,
     98,117,105,108,116,45,105,110,32,109,111,100,117,108,101,115,
-    32,100,111,32,110,111,116,32,104,97,118,101,32,115,111,117,
-    114,99,101,32,99,111,100,101,46,78,114,10,0,0,0,114,
-    170,0,0,0,114,10,0,0,0,114,10,0,0,0,114,11,
-    0,0,0,218,10,103,101,116,95,115,111,117,114,99,101,8,
-    3,0,0,115,2,0,0,0,0,4,122,26,66,117,105,108,
+    46,10,10,32,32,32,32,65,108,108,32,109,101,116,104,111,
+    100,115,32,97,114,101,32,101,105,116,104,101,114,32,99,108,
+    97,115,115,32,111,114,32,115,116,97,116,105,99,32,109,101,
+    116,104,111,100,115,32,116,111,32,97,118,111,105,100,32,116,
+    104,101,32,110,101,101,100,32,116,111,10,32,32,32,32,105,
+    110,115,116,97,110,116,105,97,116,101,32,116,104,101,32,99,
+    108,97,115,115,46,10,10,32,32,32,32,122,8,98,117,105,
+    108,116,45,105,110,99,1,0,0,0,0,0,0,0,0,0,
+    0,0,1,0,0,0,5,0,0,0,67,0,0,0,115,34,
+    0,0,0,116,0,160,1,100,1,116,2,161,2,1,0,100,
+    2,124,0,106,3,155,2,100,3,116,4,106,5,155,0,100,
+    4,157,5,83,0,41,5,250,115,82,101,116,117,114,110,32,
+    114,101,112,114,32,102,111,114,32,116,104,101,32,109,111,100,
+    117,108,101,46,10,10,32,32,32,32,32,32,32,32,84,104,
+    101,32,109,101,116,104,111,100,32,105,115,32,100,101,112,114,
+    101,99,97,116,101,100,46,32,32,84,104,101,32,105,109,112,
+    111,114,116,32,109,97,99,104,105,110,101,114,121,32,100,111,
+    101,115,32,116,104,101,32,106,111,98,32,105,116,115,101,108,
+    102,46,10,10,32,32,32,32,32,32,32,32,122,81,66,117,
+    105,108,116,105,110,73,109,112,111,114,116,101,114,46,109,111,
+    100,117,108,101,95,114,101,112,114,40,41,32,105,115,32,100,
+    101,112,114,101,99,97,116,101,100,32,97,110,100,32,115,108,
+    97,116,101,100,32,102,111,114,32,114,101,109,111,118,97,108,
+    32,105,110,32,80,121,116,104,111,110,32,51,46,49,50,122,
+    8,60,109,111,100,117,108,101,32,122,2,32,40,122,2,41,
+    62,41,6,114,101,0,0,0,114,102,0,0,0,114,103,0,
+    0,0,114,9,0,0,0,114,175,0,0,0,114,151,0,0,
+    0,169,1,114,110,0,0,0,114,5,0,0,0,114,5,0,
+    0,0,114,6,0,0,0,114,114,0,0,0,223,2,0,0,
+    115,8,0,0,0,6,7,2,1,4,255,22,2,122,27,66,
+    117,105,108,116,105,110,73,109,112,111,114,116,101,114,46,109,
+    111,100,117,108,101,95,114,101,112,114,78,99,4,0,0,0,
+    0,0,0,0,0,0,0,0,4,0,0,0,5,0,0,0,
+    67,0,0,0,115,42,0,0,0,124,2,100,0,117,1,114,
+    6,100,0,83,0,116,0,160,1,124,1,161,1,114,19,116,
+    2,124,1,124,0,124,0,106,3,100,1,141,3,83,0,100,
+    0,83,0,169,2,78,114,150,0,0,0,41,4,114,64,0,
+    0,0,90,10,105,115,95,98,117,105,108,116,105,110,114,104,
+    0,0,0,114,151,0,0,0,169,4,218,3,99,108,115,114,
+    89,0,0,0,218,4,112,97,116,104,218,6,116,97,114,103,
+    101,116,114,5,0,0,0,114,5,0,0,0,114,6,0,0,
+    0,218,9,102,105,110,100,95,115,112,101,99,234,2,0,0,
+    115,10,0,0,0,8,2,4,1,10,1,16,1,4,2,122,
+    25,66,117,105,108,116,105,110,73,109,112,111,114,116,101,114,
+    46,102,105,110,100,95,115,112,101,99,99,3,0,0,0,0,
+    0,0,0,0,0,0,0,4,0,0,0,4,0,0,0,67,
+    0,0,0,115,42,0,0,0,116,0,160,1,100,1,116,2,
+    161,2,1,0,124,0,160,3,124,1,124,2,161,2,125,3,
+    124,3,100,2,117,1,114,19,124,3,106,4,83,0,100,2,
+    83,0,41,3,122,175,70,105,110,100,32,116,104,101,32,98,
+    117,105,108,116,45,105,110,32,109,111,100,117,108,101,46,10,
+    10,32,32,32,32,32,32,32,32,73,102,32,39,112,97,116,
+    104,39,32,105,115,32,101,118,101,114,32,115,112,101,99,105,
+    102,105,101,100,32,116,104,101,110,32,116,104,101,32,115,101,
+    97,114,99,104,32,105,115,32,99,111,110,115,105,100,101,114,
+    101,100,32,97,32,102,97,105,108,117,114,101,46,10,10,32,
+    32,32,32,32,32,32,32,84,104,105,115,32,109,101,116,104,
+    111,100,32,105,115,32,100,101,112,114,101,99,97,116,101,100,
+    46,32,32,85,115,101,32,102,105,110,100,95,115,112,101,99,
+    40,41,32,105,110,115,116,101,97,100,46,10,10,32,32,32,
+    32,32,32,32,32,122,106,66,117,105,108,116,105,110,73,109,
+    112,111,114,116,101,114,46,102,105,110,100,95,109,111,100,117,
+    108,101,40,41,32,105,115,32,100,101,112,114,101,99,97,116,
+    101,100,32,97,110,100,32,115,108,97,116,101,100,32,102,111,
+    114,32,114,101,109,111,118,97,108,32,105,110,32,80,121,116,
+    104,111,110,32,51,46,49,50,59,32,117,115,101,32,102,105,
+    110,100,95,115,112,101,99,40,41,32,105,110,115,116,101,97,
+    100,78,41,5,114,101,0,0,0,114,102,0,0,0,114,103,
+    0,0,0,114,183,0,0,0,114,122,0,0,0,41,4,114,
+    180,0,0,0,114,89,0,0,0,114,181,0,0,0,114,109,
+    0,0,0,114,5,0,0,0,114,5,0,0,0,114,6,0,
+    0,0,218,11,102,105,110,100,95,109,111,100,117,108,101,243,
+    2,0,0,115,10,0,0,0,6,9,2,2,4,254,12,3,
+    18,1,122,27,66,117,105,108,116,105,110,73,109,112,111,114,
+    116,101,114,46,102,105,110,100,95,109,111,100,117,108,101,99,
+    1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,
+    4,0,0,0,67,0,0,0,115,46,0,0,0,124,0,106,
+    0,116,1,106,2,118,1,114,17,116,3,100,1,160,4,124,
+    0,106,0,161,1,124,0,106,0,100,2,141,2,130,1,116,
+    5,116,6,106,7,124,0,131,2,83,0,41,3,122,24,67,
+    114,101,97,116,101,32,97,32,98,117,105,108,116,45,105,110,
+    32,109,111,100,117,108,101,114,85,0,0,0,114,19,0,0,
+    0,41,8,114,20,0,0,0,114,18,0,0,0,114,86,0,
+    0,0,114,87,0,0,0,114,50,0,0,0,114,74,0,0,
+    0,114,64,0,0,0,90,14,99,114,101,97,116,101,95,98,
+    117,105,108,116,105,110,114,174,0,0,0,114,5,0,0,0,
+    114,5,0,0,0,114,6,0,0,0,114,162,0,0,0,2,
+    3,0,0,115,10,0,0,0,12,3,12,1,4,1,6,255,
+    12,2,122,29,66,117,105,108,116,105,110,73,109,112,111,114,
+    116,101,114,46,99,114,101,97,116,101,95,109,111,100,117,108,
+    101,99,1,0,0,0,0,0,0,0,0,0,0,0,1,0,
+    0,0,3,0,0,0,67,0,0,0,115,16,0,0,0,116,
+    0,116,1,106,2,124,0,131,2,1,0,100,1,83,0,41,
+    2,122,22,69,120,101,99,32,97,32,98,117,105,108,116,45,
+    105,110,32,109,111,100,117,108,101,78,41,3,114,74,0,0,
+    0,114,64,0,0,0,90,12,101,120,101,99,95,98,117,105,
+    108,116,105,110,114,177,0,0,0,114,5,0,0,0,114,5,
+    0,0,0,114,6,0,0,0,114,163,0,0,0,10,3,0,
+    0,115,2,0,0,0,16,3,122,27,66,117,105,108,116,105,
+    110,73,109,112,111,114,116,101,114,46,101,120,101,99,95,109,
+    111,100,117,108,101,99,2,0,0,0,0,0,0,0,0,0,
+    0,0,2,0,0,0,1,0,0,0,67,0,0,0,243,4,
+    0,0,0,100,1,83,0,41,2,122,57,82,101,116,117,114,
+    110,32,78,111,110,101,32,97,115,32,98,117,105,108,116,45,
+    105,110,32,109,111,100,117,108,101,115,32,100,111,32,110,111,
+    116,32,104,97,118,101,32,99,111,100,101,32,111,98,106,101,
+    99,116,115,46,78,114,5,0,0,0,169,2,114,180,0,0,
+    0,114,89,0,0,0,114,5,0,0,0,114,5,0,0,0,
+    114,6,0,0,0,218,8,103,101,116,95,99,111,100,101,15,
+    3,0,0,243,2,0,0,0,4,4,122,24,66,117,105,108,
     116,105,110,73,109,112,111,114,116,101,114,46,103,101,116,95,
-    115,111,117,114,99,101,99,2,0,0,0,0,0,0,0,0,
-    0,0,0,2,0,0,0,1,0,0,0,67,0,0,0,115,
-    4,0,0,0,100,1,83,0,41,2,122,52,82,101,116,117,
-    114,110,32,70,97,108,115,101,32,97,115,32,98,117,105,108,
-    116,45,105,110,32,109,111,100,117,108,101,115,32,97,114,101,
-    32,110,101,118,101,114,32,112,97,99,107,97,103,101,115,46,
-    70,114,10,0,0,0,114,170,0,0,0,114,10,0,0,0,
-    114,10,0,0,0,114,11,0,0,0,114,116,0,0,0,14,
-    3,0,0,115,2,0,0,0,0,4,122,26,66,117,105,108,
-    116,105,110,73,109,112,111,114,116,101,114,46,105,115,95,112,
-    97,99,107,97,103,101,41,2,78,78,41,1,78,41,18,114,
-    1,0,0,0,114,0,0,0,0,114,2,0,0,0,114,3,
-    0,0,0,114,139,0,0,0,218,12,115,116,97,116,105,99,
-    109,101,116,104,111,100,114,100,0,0,0,218,11,99,108,97,
-    115,115,109,101,116,104,111,100,114,168,0,0,0,114,169,0,
-    0,0,114,150,0,0,0,114,151,0,0,0,114,87,0,0,
-    0,114,171,0,0,0,114,172,0,0,0,114,116,0,0,0,
-    114,98,0,0,0,114,156,0,0,0,114,10,0,0,0,114,
-    10,0,0,0,114,10,0,0,0,114,11,0,0,0,114,161,
-    0,0,0,204,2,0,0,115,44,0,0,0,8,2,4,7,
-    4,2,2,1,10,8,2,1,12,8,2,1,12,11,2,1,
-    10,7,2,1,10,4,2,1,2,1,12,4,2,1,2,1,
-    12,4,2,1,2,1,12,4,114,161,0,0,0,99,0,0,
-    0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,
-    0,0,64,0,0,0,115,144,0,0,0,101,0,90,1,100,
-    0,90,2,100,1,90,3,100,2,90,4,101,5,100,3,100,
-    4,132,0,131,1,90,6,101,7,100,22,100,6,100,7,132,
-    1,131,1,90,8,101,7,100,23,100,8,100,9,132,1,131,
-    1,90,9,101,7,100,10,100,11,132,0,131,1,90,10,101,
-    5,100,12,100,13,132,0,131,1,90,11,101,7,100,14,100,
-    15,132,0,131,1,90,12,101,7,101,13,100,16,100,17,132,
-    0,131,1,131,1,90,14,101,7,101,13,100,18,100,19,132,
-    0,131,1,131,1,90,15,101,7,101,13,100,20,100,21,132,
-    0,131,1,131,1,90,16,100,5,83,0,41,24,218,14,70,
-    114,111,122,101,110,73,109,112,111,114,116,101,114,122,142,77,
-    101,116,97,32,112,97,116,104,32,105,109,112,111,114,116,32,
-    102,111,114,32,102,114,111,122,101,110,32,109,111,100,117,108,
-    101,115,46,10,10,32,32,32,32,65,108,108,32,109,101,116,
-    104,111,100,115,32,97,114,101,32,101,105,116,104,101,114,32,
-    99,108,97,115,115,32,111,114,32,115,116,97,116,105,99,32,
-    109,101,116,104,111,100,115,32,116,111,32,97,118,111,105,100,
-    32,116,104,101,32,110,101,101,100,32,116,111,10,32,32,32,
-    32,105,110,115,116,97,110,116,105,97,116,101,32,116,104,101,
-    32,99,108,97,115,115,46,10,10,32,32,32,32,90,6,102,
-    114,111,122,101,110,99,1,0,0,0,0,0,0,0,0,0,
-    0,0,1,0,0,0,4,0,0,0,67,0,0,0,115,16,
-    0,0,0,100,1,160,0,124,0,106,1,116,2,106,3,161,
-    2,83,0,41,2,114,162,0,0,0,114,154,0,0,0,41,
-    4,114,46,0,0,0,114,1,0,0,0,114,175,0,0,0,
-    114,139,0,0,0,41,1,218,1,109,114,10,0,0,0,114,
-    10,0,0,0,114,11,0,0,0,114,100,0,0,0,34,3,
-    0,0,115,2,0,0,0,0,7,122,26,70,114,111,122,101,
-    110,73,109,112,111,114,116,101,114,46,109,111,100,117,108,101,
-    95,114,101,112,114,78,99,4,0,0,0,0,0,0,0,0,
-    0,0,0,4,0,0,0,5,0,0,0,67,0,0,0,115,
-    34,0,0,0,116,0,160,1,124,1,161,1,114,26,116,2,
-    124,1,124,0,124,0,106,3,100,1,141,3,83,0,100,0,
-    83,0,100,0,83,0,114,163,0,0,0,41,4,114,58,0,
-    0,0,114,89,0,0,0,114,92,0,0,0,114,139,0,0,
-    0,114,164,0,0,0,114,10,0,0,0,114,10,0,0,0,
-    114,11,0,0,0,114,168,0,0,0,43,3,0,0,115,6,
-    0,0,0,0,2,10,1,16,2,122,24,70,114,111,122,101,
+    99,111,100,101,99,2,0,0,0,0,0,0,0,0,0,0,
+    0,2,0,0,0,1,0,0,0,67,0,0,0,114,185,0,
+    0,0,41,2,122,56,82,101,116,117,114,110,32,78,111,110,
+    101,32,97,115,32,98,117,105,108,116,45,105,110,32,109,111,
+    100,117,108,101,115,32,100,111,32,110,111,116,32,104,97,118,
+    101,32,115,111,117,114,99,101,32,99,111,100,101,46,78,114,
+    5,0,0,0,114,186,0,0,0,114,5,0,0,0,114,5,
+    0,0,0,114,6,0,0,0,218,10,103,101,116,95,115,111,
+    117,114,99,101,21,3,0,0,114,188,0,0,0,122,26,66,
+    117,105,108,116,105,110,73,109,112,111,114,116,101,114,46,103,
+    101,116,95,115,111,117,114,99,101,99,2,0,0,0,0,0,
+    0,0,0,0,0,0,2,0,0,0,1,0,0,0,67,0,
+    0,0,114,185,0,0,0,41,2,122,52,82,101,116,117,114,
+    110,32,70,97,108,115,101,32,97,115,32,98,117,105,108,116,
+    45,105,110,32,109,111,100,117,108,101,115,32,97,114,101,32,
+    110,101,118,101,114,32,112,97,99,107,97,103,101,115,46,70,
+    114,5,0,0,0,114,186,0,0,0,114,5,0,0,0,114,
+    5,0,0,0,114,6,0,0,0,114,128,0,0,0,27,3,
+    0,0,114,188,0,0,0,122,26,66,117,105,108,116,105,110,
+    73,109,112,111,114,116,101,114,46,105,115,95,112,97,99,107,
+    97,103,101,169,2,78,78,114,0,0,0,0,41,18,114,9,
+    0,0,0,114,8,0,0,0,114,1,0,0,0,114,10,0,
+    0,0,114,151,0,0,0,218,12,115,116,97,116,105,99,109,
+    101,116,104,111,100,114,114,0,0,0,218,11,99,108,97,115,
+    115,109,101,116,104,111,100,114,183,0,0,0,114,184,0,0,
+    0,114,162,0,0,0,114,163,0,0,0,114,95,0,0,0,
+    114,187,0,0,0,114,189,0,0,0,114,128,0,0,0,114,
+    111,0,0,0,114,170,0,0,0,114,5,0,0,0,114,5,
+    0,0,0,114,5,0,0,0,114,6,0,0,0,114,175,0,
+    0,0,212,2,0,0,115,46,0,0,0,8,0,4,2,4,
+    7,2,2,10,1,2,10,12,1,2,8,12,1,2,14,10,
+    1,2,7,10,1,2,4,2,1,12,1,2,4,2,1,12,
+    1,2,4,2,1,12,1,12,4,114,175,0,0,0,99,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
+    0,0,0,64,0,0,0,115,144,0,0,0,101,0,90,1,
+    100,0,90,2,100,1,90,3,100,2,90,4,101,5,100,3,
+    100,4,132,0,131,1,90,6,101,7,100,22,100,6,100,7,
+    132,1,131,1,90,8,101,7,100,23,100,8,100,9,132,1,
+    131,1,90,9,101,5,100,10,100,11,132,0,131,1,90,10,
+    101,5,100,12,100,13,132,0,131,1,90,11,101,7,100,14,
+    100,15,132,0,131,1,90,12,101,7,101,13,100,16,100,17,
+    132,0,131,1,131,1,90,14,101,7,101,13,100,18,100,19,
+    132,0,131,1,131,1,90,15,101,7,101,13,100,20,100,21,
+    132,0,131,1,131,1,90,16,100,5,83,0,41,24,218,14,
+    70,114,111,122,101,110,73,109,112,111,114,116,101,114,122,142,
+    77,101,116,97,32,112,97,116,104,32,105,109,112,111,114,116,
+    32,102,111,114,32,102,114,111,122,101,110,32,109,111,100,117,
+    108,101,115,46,10,10,32,32,32,32,65,108,108,32,109,101,
+    116,104,111,100,115,32,97,114,101,32,101,105,116,104,101,114,
+    32,99,108,97,115,115,32,111,114,32,115,116,97,116,105,99,
+    32,109,101,116,104,111,100,115,32,116,111,32,97,118,111,105,
+    100,32,116,104,101,32,110,101,101,100,32,116,111,10,32,32,
+    32,32,105,110,115,116,97,110,116,105,97,116,101,32,116,104,
+    101,32,99,108,97,115,115,46,10,10,32,32,32,32,90,6,
+    102,114,111,122,101,110,99,1,0,0,0,0,0,0,0,0,
+    0,0,0,1,0,0,0,4,0,0,0,67,0,0,0,115,
+    28,0,0,0,116,0,160,1,100,1,116,2,161,2,1,0,
+    100,2,160,3,124,0,106,4,116,5,106,6,161,2,83,0,
+    41,3,114,176,0,0,0,122,80,70,114,111,122,101,110,73,
+    109,112,111,114,116,101,114,46,109,111,100,117,108,101,95,114,
+    101,112,114,40,41,32,105,115,32,100,101,112,114,101,99,97,
+    116,101,100,32,97,110,100,32,115,108,97,116,101,100,32,102,
+    111,114,32,114,101,109,111,118,97,108,32,105,110,32,80,121,
+    116,104,111,110,32,51,46,49,50,114,166,0,0,0,41,7,
+    114,101,0,0,0,114,102,0,0,0,114,103,0,0,0,114,
+    50,0,0,0,114,9,0,0,0,114,193,0,0,0,114,151,
+    0,0,0,41,1,218,1,109,114,5,0,0,0,114,5,0,
+    0,0,114,6,0,0,0,114,114,0,0,0,47,3,0,0,
+    115,8,0,0,0,6,7,2,1,4,255,16,2,122,26,70,
+    114,111,122,101,110,73,109,112,111,114,116,101,114,46,109,111,
+    100,117,108,101,95,114,101,112,114,78,99,4,0,0,0,0,
+    0,0,0,0,0,0,0,4,0,0,0,5,0,0,0,67,
+    0,0,0,115,30,0,0,0,116,0,160,1,124,1,161,1,
+    114,13,116,2,124,1,124,0,124,0,106,3,100,1,141,3,
+    83,0,100,0,83,0,114,178,0,0,0,41,4,114,64,0,
+    0,0,114,98,0,0,0,114,104,0,0,0,114,151,0,0,
+    0,114,179,0,0,0,114,5,0,0,0,114,5,0,0,0,
+    114,6,0,0,0,114,183,0,0,0,58,3,0,0,115,6,
+    0,0,0,10,2,16,1,4,2,122,24,70,114,111,122,101,
     110,73,109,112,111,114,116,101,114,46,102,105,110,100,95,115,
     112,101,99,99,3,0,0,0,0,0,0,0,0,0,0,0,
-    3,0,0,0,3,0,0,0,67,0,0,0,115,18,0,0,
-    0,116,0,160,1,124,1,161,1,114,14,124,0,83,0,100,
-    1,83,0,41,2,122,93,70,105,110,100,32,97,32,102,114,
-    111,122,101,110,32,109,111,100,117,108,101,46,10,10,32,32,
-    32,32,32,32,32,32,84,104,105,115,32,109,101,116,104,111,
-    100,32,105,115,32,100,101,112,114,101,99,97,116,101,100,46,
-    32,32,85,115,101,32,102,105,110,100,95,115,112,101,99,40,
-    41,32,105,110,115,116,101,97,100,46,10,10,32,32,32,32,
-    32,32,32,32,78,41,2,114,58,0,0,0,114,89,0,0,
-    0,41,3,114,165,0,0,0,114,82,0,0,0,114,166,0,
-    0,0,114,10,0,0,0,114,10,0,0,0,114,11,0,0,
-    0,114,169,0,0,0,50,3,0,0,115,2,0,0,0,0,
-    7,122,26,70,114,111,122,101,110,73,109,112,111,114,116,101,
-    114,46,102,105,110,100,95,109,111,100,117,108,101,99,2,0,
-    0,0,0,0,0,0,0,0,0,0,2,0,0,0,1,0,
-    0,0,67,0,0,0,115,4,0,0,0,100,1,83,0,41,
-    2,122,42,85,115,101,32,100,101,102,97,117,108,116,32,115,
-    101,109,97,110,116,105,99,115,32,102,111,114,32,109,111,100,
-    117,108,101,32,99,114,101,97,116,105,111,110,46,78,114,10,
-    0,0,0,41,2,114,165,0,0,0,114,96,0,0,0,114,
-    10,0,0,0,114,10,0,0,0,114,11,0,0,0,114,150,
-    0,0,0,59,3,0,0,115,2,0,0,0,0,2,122,28,
-    70,114,111,122,101,110,73,109,112,111,114,116,101,114,46,99,
-    114,101,97,116,101,95,109,111,100,117,108,101,99,1,0,0,
-    0,0,0,0,0,0,0,0,0,3,0,0,0,4,0,0,
-    0,67,0,0,0,115,64,0,0,0,124,0,106,0,106,1,
-    125,1,116,2,160,3,124,1,161,1,115,36,116,4,100,1,
-    160,5,124,1,161,1,124,1,100,2,141,2,130,1,116,6,
-    116,2,106,7,124,1,131,2,125,2,116,8,124,2,124,0,
-    106,9,131,2,1,0,100,0,83,0,114,88,0,0,0,41,
-    10,114,106,0,0,0,114,17,0,0,0,114,58,0,0,0,
-    114,89,0,0,0,114,80,0,0,0,114,46,0,0,0,114,
-    68,0,0,0,218,17,103,101,116,95,102,114,111,122,101,110,
-    95,111,98,106,101,99,116,218,4,101,120,101,99,114,7,0,
-    0,0,41,3,114,97,0,0,0,114,17,0,0,0,218,4,
-    99,111,100,101,114,10,0,0,0,114,10,0,0,0,114,11,
-    0,0,0,114,151,0,0,0,63,3,0,0,115,14,0,0,
-    0,0,2,8,1,10,1,10,1,2,255,6,2,12,1,122,
-    26,70,114,111,122,101,110,73,109,112,111,114,116,101,114,46,
-    101,120,101,99,95,109,111,100,117,108,101,99,2,0,0,0,
-    0,0,0,0,0,0,0,0,2,0,0,0,3,0,0,0,
-    67,0,0,0,115,10,0,0,0,116,0,124,0,124,1,131,
-    2,83,0,41,1,122,95,76,111,97,100,32,97,32,102,114,
-    111,122,101,110,32,109,111,100,117,108,101,46,10,10,32,32,
-    32,32,32,32,32,32,84,104,105,115,32,109,101,116,104,111,
-    100,32,105,115,32,100,101,112,114,101,99,97,116,101,100,46,
-    32,32,85,115,101,32,101,120,101,99,95,109,111,100,117,108,
-    101,40,41,32,105,110,115,116,101,97,100,46,10,10,32,32,
-    32,32,32,32,32,32,41,1,114,98,0,0,0,114,170,0,
-    0,0,114,10,0,0,0,114,10,0,0,0,114,11,0,0,
-    0,114,156,0,0,0,72,3,0,0,115,2,0,0,0,0,
-    7,122,26,70,114,111,122,101,110,73,109,112,111,114,116,101,
-    114,46,108,111,97,100,95,109,111,100,117,108,101,99,2,0,
-    0,0,0,0,0,0,0,0,0,0,2,0,0,0,3,0,
-    0,0,67,0,0,0,115,10,0,0,0,116,0,160,1,124,
-    1,161,1,83,0,41,1,122,45,82,101,116,117,114,110,32,
-    116,104,101,32,99,111,100,101,32,111,98,106,101,99,116,32,
-    102,111,114,32,116,104,101,32,102,114,111,122,101,110,32,109,
-    111,100,117,108,101,46,41,2,114,58,0,0,0,114,177,0,
-    0,0,114,170,0,0,0,114,10,0,0,0,114,10,0,0,
-    0,114,11,0,0,0,114,171,0,0,0,81,3,0,0,115,
-    2,0,0,0,0,4,122,23,70,114,111,122,101,110,73,109,
-    112,111,114,116,101,114,46,103,101,116,95,99,111,100,101,99,
-    2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,
-    1,0,0,0,67,0,0,0,115,4,0,0,0,100,1,83,
-    0,41,2,122,54,82,101,116,117,114,110,32,78,111,110,101,
-    32,97,115,32,102,114,111,122,101,110,32,109,111,100,117,108,
-    101,115,32,100,111,32,110,111,116,32,104,97,118,101,32,115,
-    111,117,114,99,101,32,99,111,100,101,46,78,114,10,0,0,
-    0,114,170,0,0,0,114,10,0,0,0,114,10,0,0,0,
-    114,11,0,0,0,114,172,0,0,0,87,3,0,0,115,2,
-    0,0,0,0,4,122,25,70,114,111,122,101,110,73,109,112,
-    111,114,116,101,114,46,103,101,116,95,115,111,117,114,99,101,
+    3,0,0,0,4,0,0,0,67,0,0,0,115,30,0,0,
+    0,116,0,160,1,100,1,116,2,161,2,1,0,116,3,160,
+    4,124,1,161,1,114,13,124,0,83,0,100,2,83,0,41,
+    3,122,93,70,105,110,100,32,97,32,102,114,111,122,101,110,
+    32,109,111,100,117,108,101,46,10,10,32,32,32,32,32,32,
+    32,32,84,104,105,115,32,109,101,116,104,111,100,32,105,115,
+    32,100,101,112,114,101,99,97,116,101,100,46,32,32,85,115,
+    101,32,102,105,110,100,95,115,112,101,99,40,41,32,105,110,
+    115,116,101,97,100,46,10,10,32,32,32,32,32,32,32,32,
+    122,105,70,114,111,122,101,110,73,109,112,111,114,116,101,114,
+    46,102,105,110,100,95,109,111,100,117,108,101,40,41,32,105,
+    115,32,100,101,112,114,101,99,97,116,101,100,32,97,110,100,
+    32,115,108,97,116,101,100,32,102,111,114,32,114,101,109,111,
+    118,97,108,32,105,110,32,80,121,116,104,111,110,32,51,46,
+    49,50,59,32,117,115,101,32,102,105,110,100,95,115,112,101,
+    99,40,41,32,105,110,115,116,101,97,100,78,41,5,114,101,
+    0,0,0,114,102,0,0,0,114,103,0,0,0,114,64,0,
+    0,0,114,98,0,0,0,41,3,114,180,0,0,0,114,89,
+    0,0,0,114,181,0,0,0,114,5,0,0,0,114,5,0,
+    0,0,114,6,0,0,0,114,184,0,0,0,65,3,0,0,
+    115,8,0,0,0,6,7,2,2,4,254,18,3,122,26,70,
+    114,111,122,101,110,73,109,112,111,114,116,101,114,46,102,105,
+    110,100,95,109,111,100,117,108,101,99,1,0,0,0,0,0,
+    0,0,0,0,0,0,1,0,0,0,1,0,0,0,67,0,
+    0,0,114,185,0,0,0,41,2,122,42,85,115,101,32,100,
+    101,102,97,117,108,116,32,115,101,109,97,110,116,105,99,115,
+    32,102,111,114,32,109,111,100,117,108,101,32,99,114,101,97,
+    116,105,111,110,46,78,114,5,0,0,0,114,174,0,0,0,
+    114,5,0,0,0,114,5,0,0,0,114,6,0,0,0,114,
+    162,0,0,0,77,3,0,0,115,2,0,0,0,4,0,122,
+    28,70,114,111,122,101,110,73,109,112,111,114,116,101,114,46,
+    99,114,101,97,116,101,95,109,111,100,117,108,101,99,1,0,
+    0,0,0,0,0,0,0,0,0,0,3,0,0,0,4,0,
+    0,0,67,0,0,0,115,64,0,0,0,124,0,106,0,106,
+    1,125,1,116,2,160,3,124,1,161,1,115,18,116,4,100,
+    1,160,5,124,1,161,1,124,1,100,2,141,2,130,1,116,
+    6,116,2,106,7,124,1,131,2,125,2,116,8,124,2,124,
+    0,106,9,131,2,1,0,100,0,83,0,114,97,0,0,0,
+    41,10,114,113,0,0,0,114,20,0,0,0,114,64,0,0,
+    0,114,98,0,0,0,114,87,0,0,0,114,50,0,0,0,
+    114,74,0,0,0,218,17,103,101,116,95,102,114,111,122,101,
+    110,95,111,98,106,101,99,116,218,4,101,120,101,99,114,14,
+    0,0,0,41,3,114,110,0,0,0,114,20,0,0,0,218,
+    4,99,111,100,101,114,5,0,0,0,114,5,0,0,0,114,
+    6,0,0,0,114,163,0,0,0,81,3,0,0,115,14,0,
+    0,0,8,2,10,1,10,1,2,1,6,255,12,2,16,1,
+    122,26,70,114,111,122,101,110,73,109,112,111,114,116,101,114,
+    46,101,120,101,99,95,109,111,100,117,108,101,99,2,0,0,
+    0,0,0,0,0,0,0,0,0,2,0,0,0,3,0,0,
+    0,67,0,0,0,115,10,0,0,0,116,0,124,0,124,1,
+    131,2,83,0,41,1,122,95,76,111,97,100,32,97,32,102,
+    114,111,122,101,110,32,109,111,100,117,108,101,46,10,10,32,
+    32,32,32,32,32,32,32,84,104,105,115,32,109,101,116,104,
+    111,100,32,105,115,32,100,101,112,114,101,99,97,116,101,100,
+    46,32,32,85,115,101,32,101,120,101,99,95,109,111,100,117,
+    108,101,40,41,32,105,110,115,116,101,97,100,46,10,10,32,
+    32,32,32,32,32,32,32,41,1,114,111,0,0,0,114,186,
+    0,0,0,114,5,0,0,0,114,5,0,0,0,114,6,0,
+    0,0,114,170,0,0,0,90,3,0,0,115,2,0,0,0,
+    10,8,122,26,70,114,111,122,101,110,73,109,112,111,114,116,
+    101,114,46,108,111,97,100,95,109,111,100,117,108,101,99,2,
+    0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,3,
+    0,0,0,67,0,0,0,243,10,0,0,0,116,0,160,1,
+    124,1,161,1,83,0,41,1,122,45,82,101,116,117,114,110,
+    32,116,104,101,32,99,111,100,101,32,111,98,106,101,99,116,
+    32,102,111,114,32,116,104,101,32,102,114,111,122,101,110,32,
+    109,111,100,117,108,101,46,41,2,114,64,0,0,0,114,195,
+    0,0,0,114,186,0,0,0,114,5,0,0,0,114,5,0,
+    0,0,114,6,0,0,0,114,187,0,0,0,100,3,0,0,
+    243,2,0,0,0,10,4,122,23,70,114,111,122,101,110,73,
+    109,112,111,114,116,101,114,46,103,101,116,95,99,111,100,101,
     99,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,
-    0,3,0,0,0,67,0,0,0,115,10,0,0,0,116,0,
-    160,1,124,1,161,1,83,0,41,1,122,46,82,101,116,117,
-    114,110,32,84,114,117,101,32,105,102,32,116,104,101,32,102,
-    114,111,122,101,110,32,109,111,100,117,108,101,32,105,115,32,
-    97,32,112,97,99,107,97,103,101,46,41,2,114,58,0,0,
-    0,90,17,105,115,95,102,114,111,122,101,110,95,112,97,99,
-    107,97,103,101,114,170,0,0,0,114,10,0,0,0,114,10,
-    0,0,0,114,11,0,0,0,114,116,0,0,0,93,3,0,
-    0,115,2,0,0,0,0,4,122,25,70,114,111,122,101,110,
-    73,109,112,111,114,116,101,114,46,105,115,95,112,97,99,107,
-    97,103,101,41,2,78,78,41,1,78,41,17,114,1,0,0,
-    0,114,0,0,0,0,114,2,0,0,0,114,3,0,0,0,
-    114,139,0,0,0,114,173,0,0,0,114,100,0,0,0,114,
-    174,0,0,0,114,168,0,0,0,114,169,0,0,0,114,150,
-    0,0,0,114,151,0,0,0,114,156,0,0,0,114,91,0,
-    0,0,114,171,0,0,0,114,172,0,0,0,114,116,0,0,
-    0,114,10,0,0,0,114,10,0,0,0,114,10,0,0,0,
-    114,11,0,0,0,114,175,0,0,0,23,3,0,0,115,46,
-    0,0,0,8,2,4,7,4,2,2,1,10,8,2,1,12,
-    6,2,1,12,8,2,1,10,3,2,1,10,8,2,1,10,
-    8,2,1,2,1,12,4,2,1,2,1,12,4,2,1,2,
-    1,114,175,0,0,0,99,0,0,0,0,0,0,0,0,0,
-    0,0,0,0,0,0,0,2,0,0,0,64,0,0,0,115,
-    32,0,0,0,101,0,90,1,100,0,90,2,100,1,90,3,
-    100,2,100,3,132,0,90,4,100,4,100,5,132,0,90,5,
-    100,6,83,0,41,7,218,18,95,73,109,112,111,114,116,76,
-    111,99,107,67,111,110,116,101,120,116,122,36,67,111,110,116,
-    101,120,116,32,109,97,110,97,103,101,114,32,102,111,114,32,
-    116,104,101,32,105,109,112,111,114,116,32,108,111,99,107,46,
-    99,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,
-    0,2,0,0,0,67,0,0,0,115,12,0,0,0,116,0,
-    160,1,161,0,1,0,100,1,83,0,41,2,122,24,65,99,
-    113,117,105,114,101,32,116,104,101,32,105,109,112,111,114,116,
-    32,108,111,99,107,46,78,41,2,114,58,0,0,0,114,59,
-    0,0,0,114,48,0,0,0,114,10,0,0,0,114,10,0,
-    0,0,114,11,0,0,0,114,55,0,0,0,106,3,0,0,
-    115,2,0,0,0,0,2,122,28,95,73,109,112,111,114,116,
-    76,111,99,107,67,111,110,116,101,120,116,46,95,95,101,110,
-    116,101,114,95,95,99,4,0,0,0,0,0,0,0,0,0,
-    0,0,4,0,0,0,2,0,0,0,67,0,0,0,115,12,
-    0,0,0,116,0,160,1,161,0,1,0,100,1,83,0,41,
-    2,122,60,82,101,108,101,97,115,101,32,116,104,101,32,105,
-    109,112,111,114,116,32,108,111,99,107,32,114,101,103,97,114,
-    100,108,101,115,115,32,111,102,32,97,110,121,32,114,97,105,
-    115,101,100,32,101,120,99,101,112,116,105,111,110,115,46,78,
-    41,2,114,58,0,0,0,114,61,0,0,0,41,4,114,30,
-    0,0,0,218,8,101,120,99,95,116,121,112,101,218,9,101,
-    120,99,95,118,97,108,117,101,218,13,101,120,99,95,116,114,
-    97,99,101,98,97,99,107,114,10,0,0,0,114,10,0,0,
-    0,114,11,0,0,0,114,57,0,0,0,110,3,0,0,115,
-    2,0,0,0,0,2,122,27,95,73,109,112,111,114,116,76,
-    111,99,107,67,111,110,116,101,120,116,46,95,95,101,120,105,
-    116,95,95,78,41,6,114,1,0,0,0,114,0,0,0,0,
-    114,2,0,0,0,114,3,0,0,0,114,55,0,0,0,114,
-    57,0,0,0,114,10,0,0,0,114,10,0,0,0,114,10,
-    0,0,0,114,11,0,0,0,114,180,0,0,0,102,3,0,
-    0,115,6,0,0,0,8,2,4,2,8,4,114,180,0,0,
-    0,99,3,0,0,0,0,0,0,0,0,0,0,0,5,0,
-    0,0,5,0,0,0,67,0,0,0,115,64,0,0,0,124,
-    1,160,0,100,1,124,2,100,2,24,0,161,2,125,3,116,
-    1,124,3,131,1,124,2,107,0,114,36,116,2,100,3,131,
-    1,130,1,124,3,100,4,25,0,125,4,124,0,114,60,100,
-    5,160,3,124,4,124,0,161,2,83,0,124,4,83,0,41,
-    6,122,50,82,101,115,111,108,118,101,32,97,32,114,101,108,
-    97,116,105,118,101,32,109,111,100,117,108,101,32,110,97,109,
-    101,32,116,111,32,97,110,32,97,98,115,111,108,117,116,101,
-    32,111,110,101,46,114,129,0,0,0,114,39,0,0,0,122,
-    50,97,116,116,101,109,112,116,101,100,32,114,101,108,97,116,
-    105,118,101,32,105,109,112,111,114,116,32,98,101,121,111,110,
-    100,32,116,111,112,45,108,101,118,101,108,32,112,97,99,107,
-    97,103,101,114,22,0,0,0,250,5,123,125,46,123,125,41,
-    4,218,6,114,115,112,108,105,116,218,3,108,101,110,114,80,
-    0,0,0,114,46,0,0,0,41,5,114,17,0,0,0,218,
-    7,112,97,99,107,97,103,101,218,5,108,101,118,101,108,90,
-    4,98,105,116,115,90,4,98,97,115,101,114,10,0,0,0,
-    114,10,0,0,0,114,11,0,0,0,218,13,95,114,101,115,
-    111,108,118,101,95,110,97,109,101,115,3,0,0,115,10,0,
-    0,0,0,2,16,1,12,1,8,1,8,1,114,189,0,0,
-    0,99,3,0,0,0,0,0,0,0,0,0,0,0,4,0,
-    0,0,4,0,0,0,67,0,0,0,115,34,0,0,0,124,
-    0,160,0,124,1,124,2,161,2,125,3,124,3,100,0,117,
-    0,114,24,100,0,83,0,116,1,124,1,124,3,131,2,83,
-    0,114,13,0,0,0,41,2,114,169,0,0,0,114,92,0,
-    0,0,41,4,218,6,102,105,110,100,101,114,114,17,0,0,
-    0,114,166,0,0,0,114,110,0,0,0,114,10,0,0,0,
-    114,10,0,0,0,114,11,0,0,0,218,17,95,102,105,110,
-    100,95,115,112,101,99,95,108,101,103,97,99,121,124,3,0,
-    0,115,8,0,0,0,0,3,12,1,8,1,4,1,114,191,
-    0,0,0,99,3,0,0,0,0,0,0,0,0,0,0,0,
-    10,0,0,0,10,0,0,0,67,0,0,0,115,32,1,0,
-    0,116,0,106,1,125,3,124,3,100,1,117,0,114,22,116,
-    2,100,2,131,1,130,1,124,3,115,38,116,3,160,4,100,
-    3,116,5,161,2,1,0,124,0,116,0,106,6,118,0,125,
-    4,124,3,68,0,93,230,125,5,116,7,131,0,143,94,1,
-    0,122,10,124,5,106,8,125,6,87,0,110,54,4,0,116,
-    9,121,128,1,0,1,0,1,0,116,10,124,5,124,0,124,
-    1,131,3,125,7,124,7,100,1,117,0,114,124,89,0,87,
-    0,100,1,4,0,4,0,131,3,1,0,113,52,89,0,110,
-    14,48,0,124,6,124,0,124,1,124,2,131,3,125,7,87,
-    0,100,1,4,0,4,0,131,3,1,0,110,16,49,0,115,
-    162,48,0,1,0,1,0,1,0,89,0,1,0,124,7,100,
-    1,117,1,114,52,124,4,144,1,115,18,124,0,116,0,106,
-    6,118,0,144,1,114,18,116,0,106,6,124,0,25,0,125,
-    8,122,10,124,8,106,11,125,9,87,0,110,26,4,0,116,
-    9,121,244,1,0,1,0,1,0,124,7,6,0,89,0,2,
-    0,1,0,83,0,48,0,124,9,100,1,117,0,144,1,114,
-    8,124,7,2,0,1,0,83,0,124,9,2,0,1,0,83,
-    0,113,52,124,7,2,0,1,0,83,0,113,52,100,1,83,
-    0,41,4,122,21,70,105,110,100,32,97,32,109,111,100,117,
-    108,101,39,115,32,115,112,101,99,46,78,122,53,115,121,115,
-    46,109,101,116,97,95,112,97,116,104,32,105,115,32,78,111,
-    110,101,44,32,80,121,116,104,111,110,32,105,115,32,108,105,
-    107,101,108,121,32,115,104,117,116,116,105,110,103,32,100,111,
-    119,110,122,22,115,121,115,46,109,101,116,97,95,112,97,116,
-    104,32,105,115,32,101,109,112,116,121,41,12,114,15,0,0,
-    0,218,9,109,101,116,97,95,112,97,116,104,114,80,0,0,
-    0,218,9,95,119,97,114,110,105,110,103,115,218,4,119,97,
-    114,110,218,13,73,109,112,111,114,116,87,97,114,110,105,110,
-    103,114,93,0,0,0,114,180,0,0,0,114,168,0,0,0,
-    114,107,0,0,0,114,191,0,0,0,114,106,0,0,0,41,
-    10,114,17,0,0,0,114,166,0,0,0,114,167,0,0,0,
-    114,192,0,0,0,90,9,105,115,95,114,101,108,111,97,100,
-    114,190,0,0,0,114,168,0,0,0,114,96,0,0,0,114,
-    97,0,0,0,114,106,0,0,0,114,10,0,0,0,114,10,
-    0,0,0,114,11,0,0,0,218,10,95,102,105,110,100,95,
-    115,112,101,99,133,3,0,0,115,54,0,0,0,0,2,6,
-    1,8,2,8,3,4,1,12,5,10,1,8,1,8,1,2,
-    1,10,1,12,1,12,1,8,1,22,2,42,1,8,2,18,
-    1,10,1,2,1,10,1,12,4,14,2,10,1,8,2,10,
-    2,10,2,114,196,0,0,0,99,3,0,0,0,0,0,0,
-    0,0,0,0,0,3,0,0,0,5,0,0,0,67,0,0,
-    0,115,108,0,0,0,116,0,124,0,116,1,131,2,115,28,
-    116,2,100,1,160,3,116,4,124,0,131,1,161,1,131,1,
-    130,1,124,2,100,2,107,0,114,44,116,5,100,3,131,1,
-    130,1,124,2,100,2,107,4,114,84,116,0,124,1,116,1,
-    131,2,115,72,116,2,100,4,131,1,130,1,110,12,124,1,
-    115,84,116,6,100,5,131,1,130,1,124,0,115,104,124,2,
-    100,2,107,2,114,104,116,5,100,6,131,1,130,1,100,7,
-    83,0,41,8,122,28,86,101,114,105,102,121,32,97,114,103,
-    117,109,101,110,116,115,32,97,114,101,32,34,115,97,110,101,
-    34,46,122,31,109,111,100,117,108,101,32,110,97,109,101,32,
-    109,117,115,116,32,98,101,32,115,116,114,44,32,110,111,116,
-    32,123,125,114,22,0,0,0,122,18,108,101,118,101,108,32,
-    109,117,115,116,32,98,101,32,62,61,32,48,122,31,95,95,
-    112,97,99,107,97,103,101,95,95,32,110,111,116,32,115,101,
-    116,32,116,111,32,97,32,115,116,114,105,110,103,122,54,97,
-    116,116,101,109,112,116,101,100,32,114,101,108,97,116,105,118,
-    101,32,105,109,112,111,114,116,32,119,105,116,104,32,110,111,
-    32,107,110,111,119,110,32,112,97,114,101,110,116,32,112,97,
-    99,107,97,103,101,122,17,69,109,112,116,121,32,109,111,100,
-    117,108,101,32,110,97,109,101,78,41,7,218,10,105,115,105,
-    110,115,116,97,110,99,101,218,3,115,116,114,218,9,84,121,
-    112,101,69,114,114,111,114,114,46,0,0,0,114,14,0,0,
-    0,218,10,86,97,108,117,101,69,114,114,111,114,114,80,0,
-    0,0,169,3,114,17,0,0,0,114,187,0,0,0,114,188,
-    0,0,0,114,10,0,0,0,114,10,0,0,0,114,11,0,
-    0,0,218,13,95,115,97,110,105,116,121,95,99,104,101,99,
-    107,180,3,0,0,115,22,0,0,0,0,2,10,1,18,1,
-    8,1,8,1,8,1,10,1,10,1,4,1,8,2,12,1,
-    114,202,0,0,0,122,16,78,111,32,109,111,100,117,108,101,
-    32,110,97,109,101,100,32,122,4,123,33,114,125,99,2,0,
-    0,0,0,0,0,0,0,0,0,0,9,0,0,0,8,0,
-    0,0,67,0,0,0,115,22,1,0,0,100,0,125,2,124,
-    0,160,0,100,1,161,1,100,2,25,0,125,3,124,3,114,
-    132,124,3,116,1,106,2,118,1,114,42,116,3,124,1,124,
-    3,131,2,1,0,124,0,116,1,106,2,118,0,114,62,116,
-    1,106,2,124,0,25,0,83,0,116,1,106,2,124,3,25,
-    0,125,4,122,10,124,4,106,4,125,2,87,0,110,48,4,
-    0,116,5,121,130,1,0,1,0,1,0,116,6,100,3,23,
-    0,160,7,124,0,124,3,161,2,125,5,116,8,124,5,124,
-    0,100,4,141,2,100,0,130,2,89,0,110,2,48,0,116,
-    9,124,0,124,2,131,2,125,6,124,6,100,0,117,0,114,
-    170,116,8,116,6,160,7,124,0,161,1,124,0,100,4,141,
-    2,130,1,110,8,116,10,124,6,131,1,125,7,124,3,144,
-    1,114,18,116,1,106,2,124,3,25,0,125,4,124,0,160,
-    0,100,1,161,1,100,5,25,0,125,8,122,16,116,11,124,
-    4,124,8,124,7,131,3,1,0,87,0,110,48,4,0,116,
-    5,144,1,121,16,1,0,1,0,1,0,100,6,124,3,155,
-    2,100,7,124,8,155,2,157,4,125,5,116,12,160,13,124,
-    5,116,14,161,2,1,0,89,0,110,2,48,0,124,7,83,
-    0,41,8,78,114,129,0,0,0,114,22,0,0,0,122,23,
-    59,32,123,33,114,125,32,105,115,32,110,111,116,32,97,32,
-    112,97,99,107,97,103,101,114,16,0,0,0,233,2,0,0,
-    0,122,27,67,97,110,110,111,116,32,115,101,116,32,97,110,
-    32,97,116,116,114,105,98,117,116,101,32,111,110,32,122,18,
-    32,102,111,114,32,99,104,105,108,100,32,109,111,100,117,108,
-    101,32,41,15,114,130,0,0,0,114,15,0,0,0,114,93,
-    0,0,0,114,68,0,0,0,114,142,0,0,0,114,107,0,
-    0,0,218,8,95,69,82,82,95,77,83,71,114,46,0,0,
-    0,218,19,77,111,100,117,108,101,78,111,116,70,111,117,110,
-    100,69,114,114,111,114,114,196,0,0,0,114,160,0,0,0,
-    114,5,0,0,0,114,193,0,0,0,114,194,0,0,0,114,
-    195,0,0,0,41,9,114,17,0,0,0,218,7,105,109,112,
-    111,114,116,95,114,166,0,0,0,114,131,0,0,0,90,13,
-    112,97,114,101,110,116,95,109,111,100,117,108,101,114,158,0,
-    0,0,114,96,0,0,0,114,97,0,0,0,90,5,99,104,
-    105,108,100,114,10,0,0,0,114,10,0,0,0,114,11,0,
-    0,0,218,23,95,102,105,110,100,95,97,110,100,95,108,111,
-    97,100,95,117,110,108,111,99,107,101,100,199,3,0,0,115,
-    52,0,0,0,0,1,4,1,14,1,4,1,10,1,10,2,
-    10,1,10,1,10,1,2,1,10,1,12,1,16,1,20,1,
-    10,1,8,1,20,2,8,1,6,2,10,1,14,1,2,1,
-    16,1,14,1,16,1,18,1,114,207,0,0,0,99,2,0,
-    0,0,0,0,0,0,0,0,0,0,4,0,0,0,8,0,
-    0,0,67,0,0,0,115,128,0,0,0,116,0,124,0,131,
-    1,143,62,1,0,116,1,106,2,160,3,124,0,116,4,161,
-    2,125,2,124,2,116,4,117,0,114,56,116,5,124,0,124,
-    1,131,2,87,0,2,0,100,1,4,0,4,0,131,3,1,
-    0,83,0,87,0,100,1,4,0,4,0,131,3,1,0,110,
-    16,49,0,115,76,48,0,1,0,1,0,1,0,89,0,1,
-    0,124,2,100,1,117,0,114,116,100,2,160,6,124,0,161,
-    1,125,3,116,7,124,3,124,0,100,3,141,2,130,1,116,
-    8,124,0,131,1,1,0,124,2,83,0,41,4,122,25,70,
-    105,110,100,32,97,110,100,32,108,111,97,100,32,116,104,101,
-    32,109,111,100,117,108,101,46,78,122,40,105,109,112,111,114,
-    116,32,111,102,32,123,125,32,104,97,108,116,101,100,59,32,
-    78,111,110,101,32,105,110,32,115,121,115,46,109,111,100,117,
-    108,101,115,114,16,0,0,0,41,9,114,51,0,0,0,114,
-    15,0,0,0,114,93,0,0,0,114,35,0,0,0,218,14,
-    95,78,69,69,68,83,95,76,79,65,68,73,78,71,114,207,
-    0,0,0,114,46,0,0,0,114,205,0,0,0,114,66,0,
-    0,0,41,4,114,17,0,0,0,114,206,0,0,0,114,97,
-    0,0,0,114,76,0,0,0,114,10,0,0,0,114,10,0,
-    0,0,114,11,0,0,0,218,14,95,102,105,110,100,95,97,
-    110,100,95,108,111,97,100,234,3,0,0,115,22,0,0,0,
-    0,2,10,1,14,1,8,1,54,2,8,1,4,1,2,255,
-    4,2,12,2,8,1,114,209,0,0,0,114,22,0,0,0,
-    99,3,0,0,0,0,0,0,0,0,0,0,0,3,0,0,
-    0,4,0,0,0,67,0,0,0,115,42,0,0,0,116,0,
-    124,0,124,1,124,2,131,3,1,0,124,2,100,1,107,4,
-    114,32,116,1,124,0,124,1,124,2,131,3,125,0,116,2,
-    124,0,116,3,131,2,83,0,41,2,97,50,1,0,0,73,
-    109,112,111,114,116,32,97,110,100,32,114,101,116,117,114,110,
-    32,116,104,101,32,109,111,100,117,108,101,32,98,97,115,101,
-    100,32,111,110,32,105,116,115,32,110,97,109,101,44,32,116,
-    104,101,32,112,97,99,107,97,103,101,32,116,104,101,32,99,
-    97,108,108,32,105,115,10,32,32,32,32,98,101,105,110,103,
-    32,109,97,100,101,32,102,114,111,109,44,32,97,110,100,32,
-    116,104,101,32,108,101,118,101,108,32,97,100,106,117,115,116,
-    109,101,110,116,46,10,10,32,32,32,32,84,104,105,115,32,
-    102,117,110,99,116,105,111,110,32,114,101,112,114,101,115,101,
-    110,116,115,32,116,104,101,32,103,114,101,97,116,101,115,116,
-    32,99,111,109,109,111,110,32,100,101,110,111,109,105,110,97,
-    116,111,114,32,111,102,32,102,117,110,99,116,105,111,110,97,
-    108,105,116,121,10,32,32,32,32,98,101,116,119,101,101,110,
-    32,105,109,112,111,114,116,95,109,111,100,117,108,101,32,97,
-    110,100,32,95,95,105,109,112,111,114,116,95,95,46,32,84,
-    104,105,115,32,105,110,99,108,117,100,101,115,32,115,101,116,
-    116,105,110,103,32,95,95,112,97,99,107,97,103,101,95,95,
-    32,105,102,10,32,32,32,32,116,104,101,32,108,111,97,100,
-    101,114,32,100,105,100,32,110,111,116,46,10,10,32,32,32,
-    32,114,22,0,0,0,41,4,114,202,0,0,0,114,189,0,
-    0,0,114,209,0,0,0,218,11,95,103,99,100,95,105,109,
-    112,111,114,116,114,201,0,0,0,114,10,0,0,0,114,10,
-    0,0,0,114,11,0,0,0,114,210,0,0,0,250,3,0,
-    0,115,8,0,0,0,0,9,12,1,8,1,12,1,114,210,
-    0,0,0,169,1,218,9,114,101,99,117,114,115,105,118,101,
-    99,3,0,0,0,0,0,0,0,1,0,0,0,8,0,0,
-    0,11,0,0,0,67,0,0,0,115,232,0,0,0,124,1,
-    68,0,93,222,125,4,116,0,124,4,116,1,131,2,115,66,
-    124,3,114,34,124,0,106,2,100,1,23,0,125,5,110,4,
-    100,2,125,5,116,3,100,3,124,5,155,0,100,4,116,4,
-    124,4,131,1,106,2,155,0,157,4,131,1,130,1,113,4,
-    124,4,100,5,107,2,114,108,124,3,115,226,116,5,124,0,
-    100,6,131,2,114,226,116,6,124,0,124,0,106,7,124,2,
-    100,7,100,8,141,4,1,0,113,4,116,5,124,0,124,4,
-    131,2,115,4,100,9,160,8,124,0,106,2,124,4,161,2,
-    125,6,122,14,116,9,124,2,124,6,131,2,1,0,87,0,
-    113,4,4,0,116,10,121,224,1,0,125,7,1,0,122,54,
-    124,7,106,11,124,6,107,2,114,202,116,12,106,13,160,14,
-    124,6,116,15,161,2,100,10,117,1,114,202,87,0,89,0,
-    100,10,125,7,126,7,113,4,130,0,87,0,89,0,100,10,
-    125,7,126,7,113,4,100,10,125,7,126,7,48,0,48,0,
-    113,4,124,0,83,0,41,11,122,238,70,105,103,117,114,101,
-    32,111,117,116,32,119,104,97,116,32,95,95,105,109,112,111,
-    114,116,95,95,32,115,104,111,117,108,100,32,114,101,116,117,
-    114,110,46,10,10,32,32,32,32,84,104,101,32,105,109,112,
-    111,114,116,95,32,112,97,114,97,109,101,116,101,114,32,105,
-    115,32,97,32,99,97,108,108,97,98,108,101,32,119,104,105,
-    99,104,32,116,97,107,101,115,32,116,104,101,32,110,97,109,
-    101,32,111,102,32,109,111,100,117,108,101,32,116,111,10,32,
-    32,32,32,105,109,112,111,114,116,46,32,73,116,32,105,115,
-    32,114,101,113,117,105,114,101,100,32,116,111,32,100,101,99,
-    111,117,112,108,101,32,116,104,101,32,102,117,110,99,116,105,
-    111,110,32,102,114,111,109,32,97,115,115,117,109,105,110,103,
-    32,105,109,112,111,114,116,108,105,98,39,115,10,32,32,32,
-    32,105,109,112,111,114,116,32,105,109,112,108,101,109,101,110,
-    116,97,116,105,111,110,32,105,115,32,100,101,115,105,114,101,
-    100,46,10,10,32,32,32,32,122,8,46,95,95,97,108,108,
-    95,95,122,13,96,96,102,114,111,109,32,108,105,115,116,39,
-    39,122,8,73,116,101,109,32,105,110,32,122,18,32,109,117,
-    115,116,32,98,101,32,115,116,114,44,32,110,111,116,32,250,
-    1,42,218,7,95,95,97,108,108,95,95,84,114,211,0,0,
-    0,114,184,0,0,0,78,41,16,114,197,0,0,0,114,198,
-    0,0,0,114,1,0,0,0,114,199,0,0,0,114,14,0,
-    0,0,114,4,0,0,0,218,16,95,104,97,110,100,108,101,
-    95,102,114,111,109,108,105,115,116,114,214,0,0,0,114,46,
-    0,0,0,114,68,0,0,0,114,205,0,0,0,114,17,0,
-    0,0,114,15,0,0,0,114,93,0,0,0,114,35,0,0,
-    0,114,208,0,0,0,41,8,114,97,0,0,0,218,8,102,
-    114,111,109,108,105,115,116,114,206,0,0,0,114,212,0,0,
-    0,218,1,120,90,5,119,104,101,114,101,90,9,102,114,111,
-    109,95,110,97,109,101,90,3,101,120,99,114,10,0,0,0,
-    114,10,0,0,0,114,11,0,0,0,114,215,0,0,0,9,
-    4,0,0,115,48,0,0,0,0,10,8,1,10,1,4,1,
-    12,2,4,1,10,1,8,255,10,2,8,1,14,1,10,1,
-    2,255,8,2,10,1,14,1,2,1,14,1,14,4,10,1,
-    16,255,2,2,12,1,26,1,114,215,0,0,0,99,1,0,
-    0,0,0,0,0,0,0,0,0,0,3,0,0,0,6,0,
-    0,0,67,0,0,0,115,146,0,0,0,124,0,160,0,100,
-    1,161,1,125,1,124,0,160,0,100,2,161,1,125,2,124,
-    1,100,3,117,1,114,82,124,2,100,3,117,1,114,78,124,
-    1,124,2,106,1,107,3,114,78,116,2,106,3,100,4,124,
-    1,155,2,100,5,124,2,106,1,155,2,100,6,157,5,116,
-    4,100,7,100,8,141,3,1,0,124,1,83,0,124,2,100,
-    3,117,1,114,96,124,2,106,1,83,0,116,2,106,3,100,
-    9,116,4,100,7,100,8,141,3,1,0,124,0,100,10,25,
-    0,125,1,100,11,124,0,118,1,114,142,124,1,160,5,100,
-    12,161,1,100,13,25,0,125,1,124,1,83,0,41,14,122,
-    167,67,97,108,99,117,108,97,116,101,32,119,104,97,116,32,
-    95,95,112,97,99,107,97,103,101,95,95,32,115,104,111,117,
-    108,100,32,98,101,46,10,10,32,32,32,32,95,95,112,97,
-    99,107,97,103,101,95,95,32,105,115,32,110,111,116,32,103,
-    117,97,114,97,110,116,101,101,100,32,116,111,32,98,101,32,
-    100,101,102,105,110,101,100,32,111,114,32,99,111,117,108,100,
-    32,98,101,32,115,101,116,32,116,111,32,78,111,110,101,10,
-    32,32,32,32,116,111,32,114,101,112,114,101,115,101,110,116,
-    32,116,104,97,116,32,105,116,115,32,112,114,111,112,101,114,
-    32,118,97,108,117,101,32,105,115,32,117,110,107,110,111,119,
-    110,46,10,10,32,32,32,32,114,146,0,0,0,114,106,0,
-    0,0,78,122,32,95,95,112,97,99,107,97,103,101,95,95,
-    32,33,61,32,95,95,115,112,101,99,95,95,46,112,97,114,
-    101,110,116,32,40,122,4,32,33,61,32,250,1,41,233,3,
-    0,0,0,41,1,90,10,115,116,97,99,107,108,101,118,101,
-    108,122,89,99,97,110,39,116,32,114,101,115,111,108,118,101,
-    32,112,97,99,107,97,103,101,32,102,114,111,109,32,95,95,
-    115,112,101,99,95,95,32,111,114,32,95,95,112,97,99,107,
-    97,103,101,95,95,44,32,102,97,108,108,105,110,103,32,98,
-    97,99,107,32,111,110,32,95,95,110,97,109,101,95,95,32,
-    97,110,100,32,95,95,112,97,116,104,95,95,114,1,0,0,
-    0,114,142,0,0,0,114,129,0,0,0,114,22,0,0,0,
-    41,6,114,35,0,0,0,114,131,0,0,0,114,193,0,0,
-    0,114,194,0,0,0,114,195,0,0,0,114,130,0,0,0,
-    41,3,218,7,103,108,111,98,97,108,115,114,187,0,0,0,
-    114,96,0,0,0,114,10,0,0,0,114,10,0,0,0,114,
-    11,0,0,0,218,17,95,99,97,108,99,95,95,95,112,97,
-    99,107,97,103,101,95,95,46,4,0,0,115,42,0,0,0,
-    0,7,10,1,10,1,8,1,18,1,6,1,2,255,4,1,
-    4,255,6,2,4,254,6,3,4,1,8,1,6,2,6,2,
-    4,254,6,3,8,1,8,1,14,1,114,221,0,0,0,114,
-    10,0,0,0,99,5,0,0,0,0,0,0,0,0,0,0,
-    0,9,0,0,0,5,0,0,0,67,0,0,0,115,180,0,
-    0,0,124,4,100,1,107,2,114,18,116,0,124,0,131,1,
-    125,5,110,36,124,1,100,2,117,1,114,30,124,1,110,2,
-    105,0,125,6,116,1,124,6,131,1,125,7,116,0,124,0,
-    124,7,124,4,131,3,125,5,124,3,115,150,124,4,100,1,
-    107,2,114,84,116,0,124,0,160,2,100,3,161,1,100,1,
-    25,0,131,1,83,0,124,0,115,92,124,5,83,0,116,3,
-    124,0,131,1,116,3,124,0,160,2,100,3,161,1,100,1,
-    25,0,131,1,24,0,125,8,116,4,106,5,124,5,106,6,
-    100,2,116,3,124,5,106,6,131,1,124,8,24,0,133,2,
-    25,0,25,0,83,0,110,26,116,7,124,5,100,4,131,2,
-    114,172,116,8,124,5,124,3,116,0,131,3,83,0,124,5,
-    83,0,100,2,83,0,41,5,97,215,1,0,0,73,109,112,
-    111,114,116,32,97,32,109,111,100,117,108,101,46,10,10,32,
-    32,32,32,84,104,101,32,39,103,108,111,98,97,108,115,39,
-    32,97,114,103,117,109,101,110,116,32,105,115,32,117,115,101,
-    100,32,116,111,32,105,110,102,101,114,32,119,104,101,114,101,
-    32,116,104,101,32,105,109,112,111,114,116,32,105,115,32,111,
-    99,99,117,114,114,105,110,103,32,102,114,111,109,10,32,32,
-    32,32,116,111,32,104,97,110,100,108,101,32,114,101,108,97,
-    116,105,118,101,32,105,109,112,111,114,116,115,46,32,84,104,
-    101,32,39,108,111,99,97,108,115,39,32,97,114,103,117,109,
-    101,110,116,32,105,115,32,105,103,110,111,114,101,100,46,32,
-    84,104,101,10,32,32,32,32,39,102,114,111,109,108,105,115,
-    116,39,32,97,114,103,117,109,101,110,116,32,115,112,101,99,
-    105,102,105,101,115,32,119,104,97,116,32,115,104,111,117,108,
-    100,32,101,120,105,115,116,32,97,115,32,97,116,116,114,105,
-    98,117,116,101,115,32,111,110,32,116,104,101,32,109,111,100,
-    117,108,101,10,32,32,32,32,98,101,105,110,103,32,105,109,
-    112,111,114,116,101,100,32,40,101,46,103,46,32,96,96,102,
-    114,111,109,32,109,111,100,117,108,101,32,105,109,112,111,114,
-    116,32,60,102,114,111,109,108,105,115,116,62,96,96,41,46,
-    32,32,84,104,101,32,39,108,101,118,101,108,39,10,32,32,
-    32,32,97,114,103,117,109,101,110,116,32,114,101,112,114,101,
-    115,101,110,116,115,32,116,104,101,32,112,97,99,107,97,103,
-    101,32,108,111,99,97,116,105,111,110,32,116,111,32,105,109,
-    112,111,114,116,32,102,114,111,109,32,105,110,32,97,32,114,
-    101,108,97,116,105,118,101,10,32,32,32,32,105,109,112,111,
-    114,116,32,40,101,46,103,46,32,96,96,102,114,111,109,32,
-    46,46,112,107,103,32,105,109,112,111,114,116,32,109,111,100,
-    96,96,32,119,111,117,108,100,32,104,97,118,101,32,97,32,
-    39,108,101,118,101,108,39,32,111,102,32,50,41,46,10,10,
-    32,32,32,32,114,22,0,0,0,78,114,129,0,0,0,114,
-    142,0,0,0,41,9,114,210,0,0,0,114,221,0,0,0,
-    218,9,112,97,114,116,105,116,105,111,110,114,186,0,0,0,
-    114,15,0,0,0,114,93,0,0,0,114,1,0,0,0,114,
-    4,0,0,0,114,215,0,0,0,41,9,114,17,0,0,0,
-    114,220,0,0,0,218,6,108,111,99,97,108,115,114,216,0,
-    0,0,114,188,0,0,0,114,97,0,0,0,90,8,103,108,
-    111,98,97,108,115,95,114,187,0,0,0,90,7,99,117,116,
-    95,111,102,102,114,10,0,0,0,114,10,0,0,0,114,11,
-    0,0,0,218,10,95,95,105,109,112,111,114,116,95,95,73,
-    4,0,0,115,30,0,0,0,0,11,8,1,10,2,16,1,
-    8,1,12,1,4,3,8,1,18,1,4,1,4,4,26,3,
-    32,1,10,1,12,2,114,224,0,0,0,99,1,0,0,0,
+    0,1,0,0,0,67,0,0,0,114,185,0,0,0,41,2,
+    122,54,82,101,116,117,114,110,32,78,111,110,101,32,97,115,
+    32,102,114,111,122,101,110,32,109,111,100,117,108,101,115,32,
+    100,111,32,110,111,116,32,104,97,118,101,32,115,111,117,114,
+    99,101,32,99,111,100,101,46,78,114,5,0,0,0,114,186,
+    0,0,0,114,5,0,0,0,114,5,0,0,0,114,6,0,
+    0,0,114,189,0,0,0,106,3,0,0,114,188,0,0,0,
+    122,25,70,114,111,122,101,110,73,109,112,111,114,116,101,114,
+    46,103,101,116,95,115,111,117,114,99,101,99,2,0,0,0,
     0,0,0,0,0,0,0,0,2,0,0,0,3,0,0,0,
-    67,0,0,0,115,38,0,0,0,116,0,160,1,124,0,161,
-    1,125,1,124,1,100,0,117,0,114,30,116,2,100,1,124,
-    0,23,0,131,1,130,1,116,3,124,1,131,1,83,0,41,
-    2,78,122,25,110,111,32,98,117,105,108,116,45,105,110,32,
-    109,111,100,117,108,101,32,110,97,109,101,100,32,41,4,114,
-    161,0,0,0,114,168,0,0,0,114,80,0,0,0,114,160,
-    0,0,0,41,2,114,17,0,0,0,114,96,0,0,0,114,
-    10,0,0,0,114,10,0,0,0,114,11,0,0,0,218,18,
-    95,98,117,105,108,116,105,110,95,102,114,111,109,95,110,97,
-    109,101,110,4,0,0,115,8,0,0,0,0,1,10,1,8,
-    1,12,1,114,225,0,0,0,99,2,0,0,0,0,0,0,
-    0,0,0,0,0,10,0,0,0,5,0,0,0,67,0,0,
-    0,115,166,0,0,0,124,1,97,0,124,0,97,1,116,2,
-    116,1,131,1,125,2,116,1,106,3,160,4,161,0,68,0,
-    93,72,92,2,125,3,125,4,116,5,124,4,124,2,131,2,
-    114,26,124,3,116,1,106,6,118,0,114,60,116,7,125,5,
-    110,18,116,0,160,8,124,3,161,1,114,26,116,9,125,5,
-    110,2,113,26,116,10,124,4,124,5,131,2,125,6,116,11,
-    124,6,124,4,131,2,1,0,113,26,116,1,106,3,116,12,
-    25,0,125,7,100,1,68,0,93,46,125,8,124,8,116,1,
-    106,3,118,1,114,138,116,13,124,8,131,1,125,9,110,10,
-    116,1,106,3,124,8,25,0,125,9,116,14,124,7,124,8,
-    124,9,131,3,1,0,113,114,100,2,83,0,41,3,122,250,
-    83,101,116,117,112,32,105,109,112,111,114,116,108,105,98,32,
-    98,121,32,105,109,112,111,114,116,105,110,103,32,110,101,101,
-    100,101,100,32,98,117,105,108,116,45,105,110,32,109,111,100,
-    117,108,101,115,32,97,110,100,32,105,110,106,101,99,116,105,
-    110,103,32,116,104,101,109,10,32,32,32,32,105,110,116,111,
-    32,116,104,101,32,103,108,111,98,97,108,32,110,97,109,101,
-    115,112,97,99,101,46,10,10,32,32,32,32,65,115,32,115,
-    121,115,32,105,115,32,110,101,101,100,101,100,32,102,111,114,
-    32,115,121,115,46,109,111,100,117,108,101,115,32,97,99,99,
-    101,115,115,32,97,110,100,32,95,105,109,112,32,105,115,32,
-    110,101,101,100,101,100,32,116,111,32,108,111,97,100,32,98,
-    117,105,108,116,45,105,110,10,32,32,32,32,109,111,100,117,
-    108,101,115,44,32,116,104,111,115,101,32,116,119,111,32,109,
-    111,100,117,108,101,115,32,109,117,115,116,32,98,101,32,101,
-    120,112,108,105,99,105,116,108,121,32,112,97,115,115,101,100,
-    32,105,110,46,10,10,32,32,32,32,41,3,114,23,0,0,
-    0,114,193,0,0,0,114,65,0,0,0,78,41,15,114,58,
-    0,0,0,114,15,0,0,0,114,14,0,0,0,114,93,0,
-    0,0,218,5,105,116,101,109,115,114,197,0,0,0,114,79,
-    0,0,0,114,161,0,0,0,114,89,0,0,0,114,175,0,
-    0,0,114,143,0,0,0,114,149,0,0,0,114,1,0,0,
-    0,114,225,0,0,0,114,5,0,0,0,41,10,218,10,115,
-    121,115,95,109,111,100,117,108,101,218,11,95,105,109,112,95,
-    109,111,100,117,108,101,90,11,109,111,100,117,108,101,95,116,
-    121,112,101,114,17,0,0,0,114,97,0,0,0,114,110,0,
-    0,0,114,96,0,0,0,90,11,115,101,108,102,95,109,111,
-    100,117,108,101,90,12,98,117,105,108,116,105,110,95,110,97,
-    109,101,90,14,98,117,105,108,116,105,110,95,109,111,100,117,
-    108,101,114,10,0,0,0,114,10,0,0,0,114,11,0,0,
-    0,218,6,95,115,101,116,117,112,117,4,0,0,115,36,0,
-    0,0,0,9,4,1,4,3,8,1,18,1,10,1,10,1,
-    6,1,10,1,6,2,2,1,10,1,12,3,10,1,8,1,
-    10,1,10,2,10,1,114,229,0,0,0,99,2,0,0,0,
-    0,0,0,0,0,0,0,0,2,0,0,0,3,0,0,0,
-    67,0,0,0,115,38,0,0,0,116,0,124,0,124,1,131,
-    2,1,0,116,1,106,2,160,3,116,4,161,1,1,0,116,
-    1,106,2,160,3,116,5,161,1,1,0,100,1,83,0,41,
-    2,122,48,73,110,115,116,97,108,108,32,105,109,112,111,114,
-    116,101,114,115,32,102,111,114,32,98,117,105,108,116,105,110,
-    32,97,110,100,32,102,114,111,122,101,110,32,109,111,100,117,
-    108,101,115,78,41,6,114,229,0,0,0,114,15,0,0,0,
-    114,192,0,0,0,114,120,0,0,0,114,161,0,0,0,114,
-    175,0,0,0,41,2,114,227,0,0,0,114,228,0,0,0,
-    114,10,0,0,0,114,10,0,0,0,114,11,0,0,0,218,
-    8,95,105,110,115,116,97,108,108,152,4,0,0,115,6,0,
-    0,0,0,2,10,2,12,1,114,230,0,0,0,99,0,0,
-    0,0,0,0,0,0,0,0,0,0,1,0,0,0,4,0,
-    0,0,67,0,0,0,115,32,0,0,0,100,1,100,2,108,
-    0,125,0,124,0,97,1,124,0,160,2,116,3,106,4,116,
-    5,25,0,161,1,1,0,100,2,83,0,41,3,122,57,73,
-    110,115,116,97,108,108,32,105,109,112,111,114,116,101,114,115,
-    32,116,104,97,116,32,114,101,113,117,105,114,101,32,101,120,
-    116,101,114,110,97,108,32,102,105,108,101,115,121,115,116,101,
-    109,32,97,99,99,101,115,115,114,22,0,0,0,78,41,6,
-    218,26,95,102,114,111,122,101,110,95,105,109,112,111,114,116,
-    108,105,98,95,101,120,116,101,114,110,97,108,114,127,0,0,
-    0,114,230,0,0,0,114,15,0,0,0,114,93,0,0,0,
-    114,1,0,0,0,41,1,114,231,0,0,0,114,10,0,0,
-    0,114,10,0,0,0,114,11,0,0,0,218,27,95,105,110,
-    115,116,97,108,108,95,101,120,116,101,114,110,97,108,95,105,
-    109,112,111,114,116,101,114,115,160,4,0,0,115,6,0,0,
-    0,0,3,8,1,4,1,114,232,0,0,0,41,2,78,78,
-    41,1,78,41,2,78,114,22,0,0,0,41,4,78,78,114,
-    10,0,0,0,114,22,0,0,0,41,50,114,3,0,0,0,
-    114,127,0,0,0,114,12,0,0,0,114,18,0,0,0,114,
-    60,0,0,0,114,34,0,0,0,114,44,0,0,0,114,19,
-    0,0,0,114,20,0,0,0,114,50,0,0,0,114,51,0,
-    0,0,114,54,0,0,0,114,66,0,0,0,114,68,0,0,
-    0,114,77,0,0,0,114,87,0,0,0,114,91,0,0,0,
-    114,98,0,0,0,114,112,0,0,0,114,113,0,0,0,114,
-    92,0,0,0,114,143,0,0,0,114,149,0,0,0,114,153,
-    0,0,0,114,108,0,0,0,114,94,0,0,0,114,159,0,
-    0,0,114,160,0,0,0,114,95,0,0,0,114,161,0,0,
-    0,114,175,0,0,0,114,180,0,0,0,114,189,0,0,0,
-    114,191,0,0,0,114,196,0,0,0,114,202,0,0,0,90,
-    15,95,69,82,82,95,77,83,71,95,80,82,69,70,73,88,
-    114,204,0,0,0,114,207,0,0,0,218,6,111,98,106,101,
-    99,116,114,208,0,0,0,114,209,0,0,0,114,210,0,0,
-    0,114,215,0,0,0,114,221,0,0,0,114,224,0,0,0,
-    114,225,0,0,0,114,229,0,0,0,114,230,0,0,0,114,
-    232,0,0,0,114,10,0,0,0,114,10,0,0,0,114,10,
-    0,0,0,114,11,0,0,0,218,8,60,109,111,100,117,108,
-    101,62,1,0,0,0,115,94,0,0,0,4,24,4,2,8,
-    8,8,8,4,2,4,3,16,4,14,77,14,21,14,16,8,
-    37,8,17,8,11,14,8,8,11,8,12,8,16,8,36,14,
-    101,16,26,10,45,14,72,8,17,8,17,8,30,8,37,8,
-    42,8,15,14,75,14,79,14,13,8,9,8,9,10,47,8,
-    16,4,1,8,2,8,32,6,3,8,16,10,15,14,37,8,
-    27,10,37,8,7,8,35,8,8,
+    67,0,0,0,114,198,0,0,0,41,1,122,46,82,101,116,
+    117,114,110,32,84,114,117,101,32,105,102,32,116,104,101,32,
+    102,114,111,122,101,110,32,109,111,100,117,108,101,32,105,115,
+    32,97,32,112,97,99,107,97,103,101,46,41,2,114,64,0,
+    0,0,90,17,105,115,95,102,114,111,122,101,110,95,112,97,
+    99,107,97,103,101,114,186,0,0,0,114,5,0,0,0,114,
+    5,0,0,0,114,6,0,0,0,114,128,0,0,0,112,3,
+    0,0,114,199,0,0,0,122,25,70,114,111,122,101,110,73,
+    109,112,111,114,116,101,114,46,105,115,95,112,97,99,107,97,
+    103,101,114,190,0,0,0,114,0,0,0,0,41,17,114,9,
+    0,0,0,114,8,0,0,0,114,1,0,0,0,114,10,0,
+    0,0,114,151,0,0,0,114,191,0,0,0,114,114,0,0,
+    0,114,192,0,0,0,114,183,0,0,0,114,184,0,0,0,
+    114,162,0,0,0,114,163,0,0,0,114,170,0,0,0,114,
+    100,0,0,0,114,187,0,0,0,114,189,0,0,0,114,128,
+    0,0,0,114,5,0,0,0,114,5,0,0,0,114,5,0,
+    0,0,114,6,0,0,0,114,193,0,0,0,36,3,0,0,
+    115,48,0,0,0,8,0,4,2,4,7,2,2,10,1,2,
+    10,12,1,2,6,12,1,2,11,10,1,2,3,10,1,2,
+    8,10,1,2,9,2,1,12,1,2,4,2,1,12,1,2,
+    4,2,1,16,1,114,193,0,0,0,99,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,64,
+    0,0,0,115,32,0,0,0,101,0,90,1,100,0,90,2,
+    100,1,90,3,100,2,100,3,132,0,90,4,100,4,100,5,
+    132,0,90,5,100,6,83,0,41,7,218,18,95,73,109,112,
+    111,114,116,76,111,99,107,67,111,110,116,101,120,116,122,36,
+    67,111,110,116,101,120,116,32,109,97,110,97,103,101,114,32,
+    102,111,114,32,116,104,101,32,105,109,112,111,114,116,32,108,
+    111,99,107,46,99,1,0,0,0,0,0,0,0,0,0,0,
+    0,1,0,0,0,2,0,0,0,67,0,0,0,243,12,0,
+    0,0,116,0,160,1,161,0,1,0,100,1,83,0,41,2,
+    122,24,65,99,113,117,105,114,101,32,116,104,101,32,105,109,
+    112,111,114,116,32,108,111,99,107,46,78,41,2,114,64,0,
+    0,0,114,65,0,0,0,114,52,0,0,0,114,5,0,0,
+    0,114,5,0,0,0,114,6,0,0,0,114,61,0,0,0,
+    125,3,0,0,243,2,0,0,0,12,2,122,28,95,73,109,
+    112,111,114,116,76,111,99,107,67,111,110,116,101,120,116,46,
+    95,95,101,110,116,101,114,95,95,99,4,0,0,0,0,0,
+    0,0,0,0,0,0,4,0,0,0,2,0,0,0,67,0,
+    0,0,114,201,0,0,0,41,2,122,60,82,101,108,101,97,
+    115,101,32,116,104,101,32,105,109,112,111,114,116,32,108,111,
+    99,107,32,114,101,103,97,114,100,108,101,115,115,32,111,102,
+    32,97,110,121,32,114,97,105,115,101,100,32,101,120,99,101,
+    112,116,105,111,110,115,46,78,41,2,114,64,0,0,0,114,
+    67,0,0,0,41,4,114,33,0,0,0,218,8,101,120,99,
+    95,116,121,112,101,218,9,101,120,99,95,118,97,108,117,101,
+    218,13,101,120,99,95,116,114,97,99,101,98,97,99,107,114,
+    5,0,0,0,114,5,0,0,0,114,6,0,0,0,114,63,
+    0,0,0,129,3,0,0,114,202,0,0,0,122,27,95,73,
+    109,112,111,114,116,76,111,99,107,67,111,110,116,101,120,116,
+    46,95,95,101,120,105,116,95,95,78,41,6,114,9,0,0,
+    0,114,8,0,0,0,114,1,0,0,0,114,10,0,0,0,
+    114,61,0,0,0,114,63,0,0,0,114,5,0,0,0,114,
+    5,0,0,0,114,5,0,0,0,114,6,0,0,0,114,200,
+    0,0,0,121,3,0,0,115,8,0,0,0,8,0,4,2,
+    8,2,12,4,114,200,0,0,0,99,3,0,0,0,0,0,
+    0,0,0,0,0,0,5,0,0,0,5,0,0,0,67,0,
+    0,0,115,64,0,0,0,124,1,160,0,100,1,124,2,100,
+    2,24,0,161,2,125,3,116,1,124,3,131,1,124,2,107,
+    0,114,18,116,2,100,3,131,1,130,1,124,3,100,4,25,
+    0,125,4,124,0,114,30,100,5,160,3,124,4,124,0,161,
+    2,83,0,124,4,83,0,41,6,122,50,82,101,115,111,108,
+    118,101,32,97,32,114,101,108,97,116,105,118,101,32,109,111,
+    100,117,108,101,32,110,97,109,101,32,116,111,32,97,110,32,
+    97,98,115,111,108,117,116,101,32,111,110,101,46,114,141,0,
+    0,0,114,42,0,0,0,122,50,97,116,116,101,109,112,116,
+    101,100,32,114,101,108,97,116,105,118,101,32,105,109,112,111,
+    114,116,32,98,101,121,111,110,100,32,116,111,112,45,108,101,
+    118,101,108,32,112,97,99,107,97,103,101,114,25,0,0,0,
+    250,5,123,125,46,123,125,41,4,218,6,114,115,112,108,105,
+    116,218,3,108,101,110,114,87,0,0,0,114,50,0,0,0,
+    41,5,114,20,0,0,0,218,7,112,97,99,107,97,103,101,
+    218,5,108,101,118,101,108,90,4,98,105,116,115,90,4,98,
+    97,115,101,114,5,0,0,0,114,5,0,0,0,114,6,0,
+    0,0,218,13,95,114,101,115,111,108,118,101,95,110,97,109,
+    101,134,3,0,0,115,10,0,0,0,16,2,12,1,8,1,
+    8,1,20,1,114,211,0,0,0,99,3,0,0,0,0,0,
+    0,0,0,0,0,0,5,0,0,0,4,0,0,0,67,0,
+    0,0,115,60,0,0,0,116,0,124,0,131,1,155,0,100,
+    1,157,2,125,3,116,1,160,2,124,3,116,3,161,2,1,
+    0,124,0,160,4,124,1,124,2,161,2,125,4,124,4,100,
+    0,117,0,114,25,100,0,83,0,116,5,124,1,124,4,131,
+    2,83,0,41,2,78,122,53,46,102,105,110,100,95,115,112,
+    101,99,40,41,32,110,111,116,32,102,111,117,110,100,59,32,
+    102,97,108,108,105,110,103,32,98,97,99,107,32,116,111,32,
+    102,105,110,100,95,109,111,100,117,108,101,40,41,41,6,114,
+    7,0,0,0,114,101,0,0,0,114,102,0,0,0,114,169,
+    0,0,0,114,184,0,0,0,114,104,0,0,0,41,5,218,
+    6,102,105,110,100,101,114,114,20,0,0,0,114,181,0,0,
+    0,114,108,0,0,0,114,122,0,0,0,114,5,0,0,0,
+    114,5,0,0,0,114,6,0,0,0,218,17,95,102,105,110,
+    100,95,115,112,101,99,95,108,101,103,97,99,121,143,3,0,
+    0,115,12,0,0,0,14,1,12,2,12,1,8,1,4,1,
+    10,1,114,213,0,0,0,99,3,0,0,0,0,0,0,0,
+    0,0,0,0,10,0,0,0,10,0,0,0,67,0,0,0,
+    115,24,1,0,0,116,0,106,1,125,3,124,3,100,1,117,
+    0,114,11,116,2,100,2,131,1,130,1,124,3,115,19,116,
+    3,160,4,100,3,116,5,161,2,1,0,124,0,116,0,106,
+    6,118,0,125,4,124,3,68,0,93,111,125,5,116,7,131,
+    0,143,47,1,0,122,5,124,5,106,8,125,6,87,0,110,
+    27,4,0,116,9,121,64,1,0,1,0,1,0,116,10,124,
+    5,124,0,124,1,131,3,125,7,124,7,100,1,117,0,114,
+    62,89,0,87,0,100,1,4,0,4,0,131,3,1,0,113,
+    26,89,0,110,7,119,0,124,6,124,0,124,1,124,2,131,
+    3,125,7,87,0,100,1,4,0,4,0,131,3,1,0,110,
+    8,49,0,115,81,119,1,1,0,1,0,1,0,89,0,1,
+    0,124,7,100,1,117,1,114,137,124,4,115,133,124,0,116,
+    0,106,6,118,0,114,133,116,0,106,6,124,0,25,0,125,
+    8,122,5,124,8,106,11,125,9,87,0,110,13,4,0,116,
+    9,121,120,1,0,1,0,1,0,124,7,6,0,89,0,2,
+    0,1,0,83,0,119,0,124,9,100,1,117,0,114,129,124,
+    7,2,0,1,0,83,0,124,9,2,0,1,0,83,0,124,
+    7,2,0,1,0,83,0,113,26,100,1,83,0,41,4,122,
+    21,70,105,110,100,32,97,32,109,111,100,117,108,101,39,115,
+    32,115,112,101,99,46,78,122,53,115,121,115,46,109,101,116,
+    97,95,112,97,116,104,32,105,115,32,78,111,110,101,44,32,
+    80,121,116,104,111,110,32,105,115,32,108,105,107,101,108,121,
+    32,115,104,117,116,116,105,110,103,32,100,111,119,110,122,22,
+    115,121,115,46,109,101,116,97,95,112,97,116,104,32,105,115,
+    32,101,109,112,116,121,41,12,114,18,0,0,0,218,9,109,
+    101,116,97,95,112,97,116,104,114,87,0,0,0,114,101,0,
+    0,0,114,102,0,0,0,114,169,0,0,0,114,105,0,0,
+    0,114,200,0,0,0,114,183,0,0,0,114,2,0,0,0,
+    114,213,0,0,0,114,113,0,0,0,41,10,114,20,0,0,
+    0,114,181,0,0,0,114,182,0,0,0,114,214,0,0,0,
+    90,9,105,115,95,114,101,108,111,97,100,114,212,0,0,0,
+    114,183,0,0,0,114,109,0,0,0,114,110,0,0,0,114,
+    113,0,0,0,114,5,0,0,0,114,5,0,0,0,114,6,
+    0,0,0,218,10,95,102,105,110,100,95,115,112,101,99,153,
+    3,0,0,115,68,0,0,0,6,2,8,1,8,2,4,3,
+    12,1,10,5,8,1,8,1,2,1,10,1,12,1,12,1,
+    8,1,2,1,14,250,4,5,2,254,12,5,2,128,28,248,
+    8,9,14,2,10,1,2,1,10,1,12,1,12,4,2,252,
+    8,6,8,1,8,2,8,2,2,239,4,19,114,215,0,0,
+    0,99,3,0,0,0,0,0,0,0,0,0,0,0,3,0,
+    0,0,5,0,0,0,67,0,0,0,115,110,0,0,0,116,
+    0,124,0,116,1,131,2,115,14,116,2,100,1,160,3,116,
+    4,124,0,131,1,161,1,131,1,130,1,124,2,100,2,107,
+    0,114,22,116,5,100,3,131,1,130,1,124,2,100,2,107,
+    4,114,41,116,0,124,1,116,1,131,2,115,35,116,2,100,
+    4,131,1,130,1,124,1,115,41,116,6,100,5,131,1,130,
+    1,124,0,115,51,124,2,100,2,107,2,114,53,116,5,100,
+    6,131,1,130,1,100,7,83,0,100,7,83,0,41,8,122,
+    28,86,101,114,105,102,121,32,97,114,103,117,109,101,110,116,
+    115,32,97,114,101,32,34,115,97,110,101,34,46,122,31,109,
+    111,100,117,108,101,32,110,97,109,101,32,109,117,115,116,32,
+    98,101,32,115,116,114,44,32,110,111,116,32,123,125,114,25,
+    0,0,0,122,18,108,101,118,101,108,32,109,117,115,116,32,
+    98,101,32,62,61,32,48,122,31,95,95,112,97,99,107,97,
+    103,101,95,95,32,110,111,116,32,115,101,116,32,116,111,32,
+    97,32,115,116,114,105,110,103,122,54,97,116,116,101,109,112,
+    116,101,100,32,114,101,108,97,116,105,118,101,32,105,109,112,
+    111,114,116,32,119,105,116,104,32,110,111,32,107,110,111,119,
+    110,32,112,97,114,101,110,116,32,112,97,99,107,97,103,101,
+    122,17,69,109,112,116,121,32,109,111,100,117,108,101,32,110,
+    97,109,101,78,41,7,218,10,105,115,105,110,115,116,97,110,
+    99,101,218,3,115,116,114,218,9,84,121,112,101,69,114,114,
+    111,114,114,50,0,0,0,114,3,0,0,0,218,10,86,97,
+    108,117,101,69,114,114,111,114,114,87,0,0,0,169,3,114,
+    20,0,0,0,114,209,0,0,0,114,210,0,0,0,114,5,
+    0,0,0,114,5,0,0,0,114,6,0,0,0,218,13,95,
+    115,97,110,105,116,121,95,99,104,101,99,107,200,3,0,0,
+    115,24,0,0,0,10,2,18,1,8,1,8,1,8,1,10,
+    1,8,1,4,1,8,1,12,2,8,1,8,255,114,221,0,
+    0,0,122,16,78,111,32,109,111,100,117,108,101,32,110,97,
+    109,101,100,32,122,4,123,33,114,125,99,2,0,0,0,0,
+    0,0,0,0,0,0,0,9,0,0,0,8,0,0,0,67,
+    0,0,0,115,16,1,0,0,100,0,125,2,124,0,160,0,
+    100,1,161,1,100,2,25,0,125,3,124,3,114,64,124,3,
+    116,1,106,2,118,1,114,21,116,3,124,1,124,3,131,2,
+    1,0,124,0,116,1,106,2,118,0,114,31,116,1,106,2,
+    124,0,25,0,83,0,116,1,106,2,124,3,25,0,125,4,
+    122,5,124,4,106,4,125,2,87,0,110,22,4,0,116,5,
+    121,63,1,0,1,0,1,0,116,6,100,3,23,0,160,7,
+    124,0,124,3,161,2,125,5,116,8,124,5,124,0,100,4,
+    141,2,100,0,130,2,119,0,116,9,124,0,124,2,131,2,
+    125,6,124,6,100,0,117,0,114,82,116,8,116,6,160,7,
+    124,0,161,1,124,0,100,4,141,2,130,1,116,10,124,6,
+    131,1,125,7,124,3,114,134,116,1,106,2,124,3,25,0,
+    125,4,124,0,160,0,100,1,161,1,100,5,25,0,125,8,
+    122,9,116,11,124,4,124,8,124,7,131,3,1,0,87,0,
+    124,7,83,0,4,0,116,5,121,133,1,0,1,0,1,0,
+    100,6,124,3,155,2,100,7,124,8,155,2,157,4,125,5,
+    116,12,160,13,124,5,116,14,161,2,1,0,89,0,124,7,
+    83,0,119,0,124,7,83,0,41,8,78,114,141,0,0,0,
+    114,25,0,0,0,122,23,59,32,123,33,114,125,32,105,115,
+    32,110,111,116,32,97,32,112,97,99,107,97,103,101,114,19,
+    0,0,0,233,2,0,0,0,122,27,67,97,110,110,111,116,
+    32,115,101,116,32,97,110,32,97,116,116,114,105,98,117,116,
+    101,32,111,110,32,122,18,32,102,111,114,32,99,104,105,108,
+    100,32,109,111,100,117,108,101,32,41,15,114,142,0,0,0,
+    114,18,0,0,0,114,105,0,0,0,114,74,0,0,0,114,
+    154,0,0,0,114,2,0,0,0,218,8,95,69,82,82,95,
+    77,83,71,114,50,0,0,0,218,19,77,111,100,117,108,101,
+    78,111,116,70,111,117,110,100,69,114,114,111,114,114,215,0,
+    0,0,114,173,0,0,0,114,12,0,0,0,114,101,0,0,
+    0,114,102,0,0,0,114,169,0,0,0,41,9,114,20,0,
+    0,0,218,7,105,109,112,111,114,116,95,114,181,0,0,0,
+    114,143,0,0,0,90,13,112,97,114,101,110,116,95,109,111,
+    100,117,108,101,114,108,0,0,0,114,109,0,0,0,114,110,
+    0,0,0,90,5,99,104,105,108,100,114,5,0,0,0,114,
+    5,0,0,0,114,6,0,0,0,218,23,95,102,105,110,100,
+    95,97,110,100,95,108,111,97,100,95,117,110,108,111,99,107,
+    101,100,219,3,0,0,115,60,0,0,0,4,1,14,1,4,
+    1,10,1,10,1,10,2,10,1,10,1,2,1,10,1,12,
+    1,16,1,14,1,2,254,10,3,8,1,18,1,8,2,4,
+    1,10,2,14,1,2,1,14,1,4,4,12,253,16,1,14,
+    1,4,1,2,253,4,3,114,226,0,0,0,99,2,0,0,
+    0,0,0,0,0,0,0,0,0,4,0,0,0,8,0,0,
+    0,67,0,0,0,115,128,0,0,0,116,0,124,0,131,1,
+    143,31,1,0,116,1,106,2,160,3,124,0,116,4,161,2,
+    125,2,124,2,116,4,117,0,114,28,116,5,124,0,124,1,
+    131,2,87,0,2,0,100,1,4,0,4,0,131,3,1,0,
+    83,0,87,0,100,1,4,0,4,0,131,3,1,0,110,8,
+    49,0,115,38,119,1,1,0,1,0,1,0,89,0,1,0,
+    124,2,100,1,117,0,114,58,100,2,160,6,124,0,161,1,
+    125,3,116,7,124,3,124,0,100,3,141,2,130,1,116,8,
+    124,0,131,1,1,0,124,2,83,0,41,4,122,25,70,105,
+    110,100,32,97,110,100,32,108,111,97,100,32,116,104,101,32,
+    109,111,100,117,108,101,46,78,122,40,105,109,112,111,114,116,
+    32,111,102,32,123,125,32,104,97,108,116,101,100,59,32,78,
+    111,110,101,32,105,110,32,115,121,115,46,109,111,100,117,108,
+    101,115,114,19,0,0,0,41,9,114,57,0,0,0,114,18,
+    0,0,0,114,105,0,0,0,114,38,0,0,0,218,14,95,
+    78,69,69,68,83,95,76,79,65,68,73,78,71,114,226,0,
+    0,0,114,50,0,0,0,114,224,0,0,0,114,72,0,0,
+    0,41,4,114,20,0,0,0,114,225,0,0,0,114,110,0,
+    0,0,114,82,0,0,0,114,5,0,0,0,114,5,0,0,
+    0,114,6,0,0,0,218,14,95,102,105,110,100,95,97,110,
+    100,95,108,111,97,100,254,3,0,0,115,28,0,0,0,10,
+    2,14,1,8,1,8,1,16,253,2,2,28,254,8,5,2,
+    1,6,1,2,255,12,2,8,2,4,1,114,228,0,0,0,
+    114,25,0,0,0,99,3,0,0,0,0,0,0,0,0,0,
+    0,0,3,0,0,0,4,0,0,0,67,0,0,0,115,42,
+    0,0,0,116,0,124,0,124,1,124,2,131,3,1,0,124,
+    2,100,1,107,4,114,16,116,1,124,0,124,1,124,2,131,
+    3,125,0,116,2,124,0,116,3,131,2,83,0,41,2,97,
+    50,1,0,0,73,109,112,111,114,116,32,97,110,100,32,114,
+    101,116,117,114,110,32,116,104,101,32,109,111,100,117,108,101,
+    32,98,97,115,101,100,32,111,110,32,105,116,115,32,110,97,
+    109,101,44,32,116,104,101,32,112,97,99,107,97,103,101,32,
+    116,104,101,32,99,97,108,108,32,105,115,10,32,32,32,32,
+    98,101,105,110,103,32,109,97,100,101,32,102,114,111,109,44,
+    32,97,110,100,32,116,104,101,32,108,101,118,101,108,32,97,
+    100,106,117,115,116,109,101,110,116,46,10,10,32,32,32,32,
+    84,104,105,115,32,102,117,110,99,116,105,111,110,32,114,101,
+    112,114,101,115,101,110,116,115,32,116,104,101,32,103,114,101,
+    97,116,101,115,116,32,99,111,109,109,111,110,32,100,101,110,
+    111,109,105,110,97,116,111,114,32,111,102,32,102,117,110,99,
+    116,105,111,110,97,108,105,116,121,10,32,32,32,32,98,101,
+    116,119,101,101,110,32,105,109,112,111,114,116,95,109,111,100,
+    117,108,101,32,97,110,100,32,95,95,105,109,112,111,114,116,
+    95,95,46,32,84,104,105,115,32,105,110,99,108,117,100,101,
+    115,32,115,101,116,116,105,110,103,32,95,95,112,97,99,107,
+    97,103,101,95,95,32,105,102,10,32,32,32,32,116,104,101,
+    32,108,111,97,100,101,114,32,100,105,100,32,110,111,116,46,
+    10,10,32,32,32,32,114,25,0,0,0,41,4,114,221,0,
+    0,0,114,211,0,0,0,114,228,0,0,0,218,11,95,103,
+    99,100,95,105,109,112,111,114,116,114,220,0,0,0,114,5,
+    0,0,0,114,5,0,0,0,114,6,0,0,0,114,229,0,
+    0,0,14,4,0,0,115,8,0,0,0,12,9,8,1,12,
+    1,10,1,114,229,0,0,0,169,1,218,9,114,101,99,117,
+    114,115,105,118,101,99,3,0,0,0,0,0,0,0,1,0,
+    0,0,8,0,0,0,11,0,0,0,67,0,0,0,115,218,
+    0,0,0,124,1,68,0,93,104,125,4,116,0,124,4,116,
+    1,131,2,115,32,124,3,114,17,124,0,106,2,100,1,23,
+    0,125,5,110,2,100,2,125,5,116,3,100,3,124,5,155,
+    0,100,4,116,4,124,4,131,1,106,2,155,0,157,4,131,
+    1,130,1,124,4,100,5,107,2,114,53,124,3,115,52,116,
+    5,124,0,100,6,131,2,114,52,116,6,124,0,124,0,106,
+    7,124,2,100,7,100,8,141,4,1,0,113,2,116,5,124,
+    0,124,4,131,2,115,106,100,9,160,8,124,0,106,2,124,
+    4,161,2,125,6,122,7,116,9,124,2,124,6,131,2,1,
+    0,87,0,113,2,4,0,116,10,121,105,1,0,125,7,1,
+    0,122,21,124,7,106,11,124,6,107,2,114,100,116,12,106,
+    13,160,14,124,6,116,15,161,2,100,10,117,1,114,100,87,
+    0,89,0,100,10,125,7,126,7,113,2,130,0,100,10,125,
+    7,126,7,119,1,119,0,113,2,124,0,83,0,41,11,122,
+    238,70,105,103,117,114,101,32,111,117,116,32,119,104,97,116,
+    32,95,95,105,109,112,111,114,116,95,95,32,115,104,111,117,
+    108,100,32,114,101,116,117,114,110,46,10,10,32,32,32,32,
+    84,104,101,32,105,109,112,111,114,116,95,32,112,97,114,97,
+    109,101,116,101,114,32,105,115,32,97,32,99,97,108,108,97,
+    98,108,101,32,119,104,105,99,104,32,116,97,107,101,115,32,
+    116,104,101,32,110,97,109,101,32,111,102,32,109,111,100,117,
+    108,101,32,116,111,10,32,32,32,32,105,109,112,111,114,116,
+    46,32,73,116,32,105,115,32,114,101,113,117,105,114,101,100,
+    32,116,111,32,100,101,99,111,117,112,108,101,32,116,104,101,
+    32,102,117,110,99,116,105,111,110,32,102,114,111,109,32,97,
+    115,115,117,109,105,110,103,32,105,109,112,111,114,116,108,105,
+    98,39,115,10,32,32,32,32,105,109,112,111,114,116,32,105,
+    109,112,108,101,109,101,110,116,97,116,105,111,110,32,105,115,
+    32,100,101,115,105,114,101,100,46,10,10,32,32,32,32,122,
+    8,46,95,95,97,108,108,95,95,122,13,96,96,102,114,111,
+    109,32,108,105,115,116,39,39,122,8,73,116,101,109,32,105,
+    110,32,122,18,32,109,117,115,116,32,98,101,32,115,116,114,
+    44,32,110,111,116,32,250,1,42,218,7,95,95,97,108,108,
+    95,95,84,114,230,0,0,0,114,206,0,0,0,78,41,16,
+    114,216,0,0,0,114,217,0,0,0,114,9,0,0,0,114,
+    218,0,0,0,114,3,0,0,0,114,11,0,0,0,218,16,
+    95,104,97,110,100,108,101,95,102,114,111,109,108,105,115,116,
+    114,233,0,0,0,114,50,0,0,0,114,74,0,0,0,114,
+    224,0,0,0,114,20,0,0,0,114,18,0,0,0,114,105,
+    0,0,0,114,38,0,0,0,114,227,0,0,0,41,8,114,
+    110,0,0,0,218,8,102,114,111,109,108,105,115,116,114,225,
+    0,0,0,114,231,0,0,0,218,1,120,90,5,119,104,101,
+    114,101,90,9,102,114,111,109,95,110,97,109,101,90,3,101,
+    120,99,114,5,0,0,0,114,5,0,0,0,114,6,0,0,
+    0,114,234,0,0,0,29,4,0,0,115,56,0,0,0,8,
+    10,10,1,4,1,12,1,4,2,10,1,8,1,8,255,8,
+    2,14,1,10,1,2,1,6,255,2,128,10,2,14,1,2,
+    1,14,1,14,1,10,4,16,1,2,255,12,2,2,1,8,
+    128,2,249,2,252,4,12,114,234,0,0,0,99,1,0,0,
+    0,0,0,0,0,0,0,0,0,3,0,0,0,6,0,0,
+    0,67,0,0,0,115,146,0,0,0,124,0,160,0,100,1,
+    161,1,125,1,124,0,160,0,100,2,161,1,125,2,124,1,
+    100,3,117,1,114,41,124,2,100,3,117,1,114,39,124,1,
+    124,2,106,1,107,3,114,39,116,2,106,3,100,4,124,1,
+    155,2,100,5,124,2,106,1,155,2,100,6,157,5,116,4,
+    100,7,100,8,141,3,1,0,124,1,83,0,124,2,100,3,
+    117,1,114,48,124,2,106,1,83,0,116,2,106,3,100,9,
+    116,4,100,7,100,8,141,3,1,0,124,0,100,10,25,0,
+    125,1,100,11,124,0,118,1,114,71,124,1,160,5,100,12,
+    161,1,100,13,25,0,125,1,124,1,83,0,41,14,122,167,
+    67,97,108,99,117,108,97,116,101,32,119,104,97,116,32,95,
+    95,112,97,99,107,97,103,101,95,95,32,115,104,111,117,108,
+    100,32,98,101,46,10,10,32,32,32,32,95,95,112,97,99,
+    107,97,103,101,95,95,32,105,115,32,110,111,116,32,103,117,
+    97,114,97,110,116,101,101,100,32,116,111,32,98,101,32,100,
+    101,102,105,110,101,100,32,111,114,32,99,111,117,108,100,32,
+    98,101,32,115,101,116,32,116,111,32,78,111,110,101,10,32,
+    32,32,32,116,111,32,114,101,112,114,101,115,101,110,116,32,
+    116,104,97,116,32,105,116,115,32,112,114,111,112,101,114,32,
+    118,97,108,117,101,32,105,115,32,117,110,107,110,111,119,110,
+    46,10,10,32,32,32,32,114,158,0,0,0,114,113,0,0,
+    0,78,122,32,95,95,112,97,99,107,97,103,101,95,95,32,
+    33,61,32,95,95,115,112,101,99,95,95,46,112,97,114,101,
+    110,116,32,40,122,4,32,33,61,32,250,1,41,233,3,0,
+    0,0,41,1,90,10,115,116,97,99,107,108,101,118,101,108,
+    122,89,99,97,110,39,116,32,114,101,115,111,108,118,101,32,
+    112,97,99,107,97,103,101,32,102,114,111,109,32,95,95,115,
+    112,101,99,95,95,32,111,114,32,95,95,112,97,99,107,97,
+    103,101,95,95,44,32,102,97,108,108,105,110,103,32,98,97,
+    99,107,32,111,110,32,95,95,110,97,109,101,95,95,32,97,
+    110,100,32,95,95,112,97,116,104,95,95,114,9,0,0,0,
+    114,154,0,0,0,114,141,0,0,0,114,25,0,0,0,41,
+    6,114,38,0,0,0,114,143,0,0,0,114,101,0,0,0,
+    114,102,0,0,0,114,169,0,0,0,114,142,0,0,0,41,
+    3,218,7,103,108,111,98,97,108,115,114,209,0,0,0,114,
+    109,0,0,0,114,5,0,0,0,114,5,0,0,0,114,6,
+    0,0,0,218,17,95,99,97,108,99,95,95,95,112,97,99,
+    107,97,103,101,95,95,66,4,0,0,115,42,0,0,0,10,
+    7,10,1,8,1,18,1,6,1,2,1,4,255,4,1,6,
+    255,4,2,6,254,4,3,8,1,6,1,6,2,4,2,6,
+    254,8,3,8,1,14,1,4,1,114,240,0,0,0,114,5,
+    0,0,0,99,5,0,0,0,0,0,0,0,0,0,0,0,
+    9,0,0,0,5,0,0,0,67,0,0,0,115,174,0,0,
+    0,124,4,100,1,107,2,114,9,116,0,124,0,131,1,125,
+    5,110,18,124,1,100,2,117,1,114,15,124,1,110,1,105,
+    0,125,6,116,1,124,6,131,1,125,7,116,0,124,0,124,
+    7,124,4,131,3,125,5,124,3,115,74,124,4,100,1,107,
+    2,114,42,116,0,124,0,160,2,100,3,161,1,100,1,25,
+    0,131,1,83,0,124,0,115,46,124,5,83,0,116,3,124,
+    0,131,1,116,3,124,0,160,2,100,3,161,1,100,1,25,
+    0,131,1,24,0,125,8,116,4,106,5,124,5,106,6,100,
+    2,116,3,124,5,106,6,131,1,124,8,24,0,133,2,25,
+    0,25,0,83,0,116,7,124,5,100,4,131,2,114,85,116,
+    8,124,5,124,3,116,0,131,3,83,0,124,5,83,0,41,
+    5,97,215,1,0,0,73,109,112,111,114,116,32,97,32,109,
+    111,100,117,108,101,46,10,10,32,32,32,32,84,104,101,32,
+    39,103,108,111,98,97,108,115,39,32,97,114,103,117,109,101,
+    110,116,32,105,115,32,117,115,101,100,32,116,111,32,105,110,
+    102,101,114,32,119,104,101,114,101,32,116,104,101,32,105,109,
+    112,111,114,116,32,105,115,32,111,99,99,117,114,114,105,110,
+    103,32,102,114,111,109,10,32,32,32,32,116,111,32,104,97,
+    110,100,108,101,32,114,101,108,97,116,105,118,101,32,105,109,
+    112,111,114,116,115,46,32,84,104,101,32,39,108,111,99,97,
+    108,115,39,32,97,114,103,117,109,101,110,116,32,105,115,32,
+    105,103,110,111,114,101,100,46,32,84,104,101,10,32,32,32,
+    32,39,102,114,111,109,108,105,115,116,39,32,97,114,103,117,
+    109,101,110,116,32,115,112,101,99,105,102,105,101,115,32,119,
+    104,97,116,32,115,104,111,117,108,100,32,101,120,105,115,116,
+    32,97,115,32,97,116,116,114,105,98,117,116,101,115,32,111,
+    110,32,116,104,101,32,109,111,100,117,108,101,10,32,32,32,
+    32,98,101,105,110,103,32,105,109,112,111,114,116,101,100,32,
+    40,101,46,103,46,32,96,96,102,114,111,109,32,109,111,100,
+    117,108,101,32,105,109,112,111,114,116,32,60,102,114,111,109,
+    108,105,115,116,62,96,96,41,46,32,32,84,104,101,32,39,
+    108,101,118,101,108,39,10,32,32,32,32,97,114,103,117,109,
+    101,110,116,32,114,101,112,114,101,115,101,110,116,115,32,116,
+    104,101,32,112,97,99,107,97,103,101,32,108,111,99,97,116,
+    105,111,110,32,116,111,32,105,109,112,111,114,116,32,102,114,
+    111,109,32,105,110,32,97,32,114,101,108,97,116,105,118,101,
+    10,32,32,32,32,105,109,112,111,114,116,32,40,101,46,103,
+    46,32,96,96,102,114,111,109,32,46,46,112,107,103,32,105,
+    109,112,111,114,116,32,109,111,100,96,96,32,119,111,117,108,
+    100,32,104,97,118,101,32,97,32,39,108,101,118,101,108,39,
+    32,111,102,32,50,41,46,10,10,32,32,32,32,114,25,0,
+    0,0,78,114,141,0,0,0,114,154,0,0,0,41,9,114,
+    229,0,0,0,114,240,0,0,0,218,9,112,97,114,116,105,
+    116,105,111,110,114,208,0,0,0,114,18,0,0,0,114,105,
+    0,0,0,114,9,0,0,0,114,11,0,0,0,114,234,0,
+    0,0,41,9,114,20,0,0,0,114,239,0,0,0,218,6,
+    108,111,99,97,108,115,114,235,0,0,0,114,210,0,0,0,
+    114,110,0,0,0,90,8,103,108,111,98,97,108,115,95,114,
+    209,0,0,0,90,7,99,117,116,95,111,102,102,114,5,0,
+    0,0,114,5,0,0,0,114,6,0,0,0,218,10,95,95,
+    105,109,112,111,114,116,95,95,93,4,0,0,115,30,0,0,
+    0,8,11,10,1,16,2,8,1,12,1,4,1,8,3,18,
+    1,4,1,4,1,26,4,30,3,10,1,12,1,4,2,114,
+    243,0,0,0,99,1,0,0,0,0,0,0,0,0,0,0,
+    0,2,0,0,0,3,0,0,0,67,0,0,0,115,38,0,
+    0,0,116,0,160,1,124,0,161,1,125,1,124,1,100,0,
+    117,0,114,15,116,2,100,1,124,0,23,0,131,1,130,1,
+    116,3,124,1,131,1,83,0,41,2,78,122,25,110,111,32,
+    98,117,105,108,116,45,105,110,32,109,111,100,117,108,101,32,
+    110,97,109,101,100,32,41,4,114,175,0,0,0,114,183,0,
+    0,0,114,87,0,0,0,114,173,0,0,0,41,2,114,20,
+    0,0,0,114,109,0,0,0,114,5,0,0,0,114,5,0,
+    0,0,114,6,0,0,0,218,18,95,98,117,105,108,116,105,
+    110,95,102,114,111,109,95,110,97,109,101,130,4,0,0,115,
+    8,0,0,0,10,1,8,1,12,1,8,1,114,244,0,0,
+    0,99,2,0,0,0,0,0,0,0,0,0,0,0,10,0,
+    0,0,5,0,0,0,67,0,0,0,115,166,0,0,0,124,
+    1,97,0,124,0,97,1,116,2,116,1,131,1,125,2,116,
+    1,106,3,160,4,161,0,68,0,93,36,92,2,125,3,125,
+    4,116,5,124,4,124,2,131,2,114,49,124,3,116,1,106,
+    6,118,0,114,30,116,7,125,5,110,9,116,0,160,8,124,
+    3,161,1,114,38,116,9,125,5,110,1,113,13,116,10,124,
+    4,124,5,131,2,125,6,116,11,124,6,124,4,131,2,1,
+    0,113,13,116,1,106,3,116,12,25,0,125,7,100,1,68,
+    0,93,23,125,8,124,8,116,1,106,3,118,1,114,69,116,
+    13,124,8,131,1,125,9,110,5,116,1,106,3,124,8,25,
+    0,125,9,116,14,124,7,124,8,124,9,131,3,1,0,113,
+    57,100,2,83,0,41,3,122,250,83,101,116,117,112,32,105,
+    109,112,111,114,116,108,105,98,32,98,121,32,105,109,112,111,
+    114,116,105,110,103,32,110,101,101,100,101,100,32,98,117,105,
+    108,116,45,105,110,32,109,111,100,117,108,101,115,32,97,110,
+    100,32,105,110,106,101,99,116,105,110,103,32,116,104,101,109,
+    10,32,32,32,32,105,110,116,111,32,116,104,101,32,103,108,
+    111,98,97,108,32,110,97,109,101,115,112,97,99,101,46,10,
+    10,32,32,32,32,65,115,32,115,121,115,32,105,115,32,110,
+    101,101,100,101,100,32,102,111,114,32,115,121,115,46,109,111,
+    100,117,108,101,115,32,97,99,99,101,115,115,32,97,110,100,
+    32,95,105,109,112,32,105,115,32,110,101,101,100,101,100,32,
+    116,111,32,108,111,97,100,32,98,117,105,108,116,45,105,110,
+    10,32,32,32,32,109,111,100,117,108,101,115,44,32,116,104,
+    111,115,101,32,116,119,111,32,109,111,100,117,108,101,115,32,
+    109,117,115,116,32,98,101,32,101,120,112,108,105,99,105,116,
+    108,121,32,112,97,115,115,101,100,32,105,110,46,10,10,32,
+    32,32,32,41,3,114,26,0,0,0,114,101,0,0,0,114,
+    71,0,0,0,78,41,15,114,64,0,0,0,114,18,0,0,
+    0,114,3,0,0,0,114,105,0,0,0,218,5,105,116,101,
+    109,115,114,216,0,0,0,114,86,0,0,0,114,175,0,0,
+    0,114,98,0,0,0,114,193,0,0,0,114,155,0,0,0,
+    114,161,0,0,0,114,9,0,0,0,114,244,0,0,0,114,
+    12,0,0,0,41,10,218,10,115,121,115,95,109,111,100,117,
+    108,101,218,11,95,105,109,112,95,109,111,100,117,108,101,90,
+    11,109,111,100,117,108,101,95,116,121,112,101,114,20,0,0,
+    0,114,110,0,0,0,114,122,0,0,0,114,109,0,0,0,
+    90,11,115,101,108,102,95,109,111,100,117,108,101,90,12,98,
+    117,105,108,116,105,110,95,110,97,109,101,90,14,98,117,105,
+    108,116,105,110,95,109,111,100,117,108,101,114,5,0,0,0,
+    114,5,0,0,0,114,6,0,0,0,218,6,95,115,101,116,
+    117,112,137,4,0,0,115,40,0,0,0,4,9,4,1,8,
+    3,18,1,10,1,10,1,6,1,10,1,6,1,2,2,10,
+    1,10,1,2,128,10,3,8,1,10,1,10,1,10,2,14,
+    1,4,251,114,248,0,0,0,99,2,0,0,0,0,0,0,
+    0,0,0,0,0,2,0,0,0,3,0,0,0,67,0,0,
+    0,115,38,0,0,0,116,0,124,0,124,1,131,2,1,0,
+    116,1,106,2,160,3,116,4,161,1,1,0,116,1,106,2,
+    160,3,116,5,161,1,1,0,100,1,83,0,41,2,122,48,
+    73,110,115,116,97,108,108,32,105,109,112,111,114,116,101,114,
+    115,32,102,111,114,32,98,117,105,108,116,105,110,32,97,110,
+    100,32,102,114,111,122,101,110,32,109,111,100,117,108,101,115,
+    78,41,6,114,248,0,0,0,114,18,0,0,0,114,214,0,
+    0,0,114,132,0,0,0,114,175,0,0,0,114,193,0,0,
+    0,41,2,114,246,0,0,0,114,247,0,0,0,114,5,0,
+    0,0,114,5,0,0,0,114,6,0,0,0,218,8,95,105,
+    110,115,116,97,108,108,172,4,0,0,115,6,0,0,0,10,
+    2,12,2,16,1,114,249,0,0,0,99,0,0,0,0,0,
+    0,0,0,0,0,0,0,1,0,0,0,4,0,0,0,67,
+    0,0,0,115,32,0,0,0,100,1,100,2,108,0,125,0,
+    124,0,97,1,124,0,160,2,116,3,106,4,116,5,25,0,
+    161,1,1,0,100,2,83,0,41,3,122,57,73,110,115,116,
+    97,108,108,32,105,109,112,111,114,116,101,114,115,32,116,104,
+    97,116,32,114,101,113,117,105,114,101,32,101,120,116,101,114,
+    110,97,108,32,102,105,108,101,115,121,115,116,101,109,32,97,
+    99,99,101,115,115,114,25,0,0,0,78,41,6,218,26,95,
+    102,114,111,122,101,110,95,105,109,112,111,114,116,108,105,98,
+    95,101,120,116,101,114,110,97,108,114,139,0,0,0,114,249,
+    0,0,0,114,18,0,0,0,114,105,0,0,0,114,9,0,
+    0,0,41,1,114,250,0,0,0,114,5,0,0,0,114,5,
+    0,0,0,114,6,0,0,0,218,27,95,105,110,115,116,97,
+    108,108,95,101,120,116,101,114,110,97,108,95,105,109,112,111,
+    114,116,101,114,115,180,4,0,0,115,6,0,0,0,8,3,
+    4,1,20,1,114,251,0,0,0,114,190,0,0,0,114,0,
+    0,0,0,114,24,0,0,0,41,4,78,78,114,5,0,0,
+    0,114,25,0,0,0,41,54,114,10,0,0,0,114,7,0,
+    0,0,114,26,0,0,0,114,101,0,0,0,114,71,0,0,
+    0,114,139,0,0,0,114,17,0,0,0,114,21,0,0,0,
+    114,66,0,0,0,114,37,0,0,0,114,47,0,0,0,114,
+    22,0,0,0,114,23,0,0,0,114,55,0,0,0,114,57,
+    0,0,0,114,60,0,0,0,114,72,0,0,0,114,74,0,
+    0,0,114,83,0,0,0,114,95,0,0,0,114,100,0,0,
+    0,114,111,0,0,0,114,124,0,0,0,114,125,0,0,0,
+    114,104,0,0,0,114,155,0,0,0,114,161,0,0,0,114,
+    165,0,0,0,114,119,0,0,0,114,106,0,0,0,114,172,
+    0,0,0,114,173,0,0,0,114,107,0,0,0,114,175,0,
+    0,0,114,193,0,0,0,114,200,0,0,0,114,211,0,0,
+    0,114,213,0,0,0,114,215,0,0,0,114,221,0,0,0,
+    90,15,95,69,82,82,95,77,83,71,95,80,82,69,70,73,
+    88,114,223,0,0,0,114,226,0,0,0,218,6,111,98,106,
+    101,99,116,114,227,0,0,0,114,228,0,0,0,114,229,0,
+    0,0,114,234,0,0,0,114,240,0,0,0,114,243,0,0,
+    0,114,244,0,0,0,114,248,0,0,0,114,249,0,0,0,
+    114,251,0,0,0,114,5,0,0,0,114,5,0,0,0,114,
+    5,0,0,0,114,6,0,0,0,218,8,60,109,111,100,117,
+    108,101,62,1,0,0,0,115,104,0,0,0,4,0,8,22,
+    4,9,4,1,4,1,4,3,8,3,8,8,4,8,4,2,
+    16,3,14,4,14,77,14,21,8,16,8,37,8,17,14,11,
+    8,8,8,11,8,12,8,19,14,26,16,101,10,26,14,45,
+    8,72,8,17,8,17,8,30,8,36,8,45,14,15,14,80,
+    14,85,8,13,8,9,10,10,8,47,4,16,8,1,8,2,
+    6,32,8,3,10,16,14,15,8,37,10,27,8,37,8,7,
+    8,35,12,8,
 };
diff --git a/Python/importlib_external.h b/Python/importlib_external.h
index a8d5d9a..dcf5505 100644
--- a/Python/importlib_external.h
+++ b/Python/importlib_external.h
@@ -1,1129 +1,1223 @@
 /* Auto-generated by Programs/_freeze_importlib.c */
 const unsigned char _Py_M__importlib_bootstrap_external[] = {
     99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,5,0,0,0,64,0,0,0,115,32,2,0,0,100,0,
-    90,0,100,1,90,1,100,2,90,2,101,2,101,1,23,0,
-    90,3,100,3,100,4,132,0,90,4,100,5,100,6,132,0,
-    90,5,100,7,100,8,132,0,90,6,100,9,100,10,132,0,
-    90,7,100,11,100,12,132,0,90,8,100,13,100,14,132,0,
-    90,9,100,15,100,16,132,0,90,10,100,17,100,18,132,0,
-    90,11,100,19,100,20,132,0,90,12,100,21,100,22,132,0,
-    90,13,100,23,100,24,132,0,90,14,100,101,100,26,100,27,
-    132,1,90,15,101,16,101,15,106,17,131,1,90,18,100,28,
-    160,19,100,29,100,30,161,2,100,31,23,0,90,20,101,21,
-    160,22,101,20,100,30,161,2,90,23,100,32,90,24,100,33,
-    90,25,100,34,103,1,90,26,100,35,103,1,90,27,101,27,
-    4,0,90,28,90,29,100,102,100,36,100,37,156,1,100,38,
-    100,39,132,3,90,30,100,40,100,41,132,0,90,31,100,42,
-    100,43,132,0,90,32,100,44,100,45,132,0,90,33,100,46,
-    100,47,132,0,90,34,100,48,100,49,132,0,90,35,100,50,
-    100,51,132,0,90,36,100,52,100,53,132,0,90,37,100,54,
-    100,55,132,0,90,38,100,56,100,57,132,0,90,39,100,103,
-    100,58,100,59,132,1,90,40,100,104,100,61,100,62,132,1,
-    90,41,100,105,100,64,100,65,132,1,90,42,100,66,100,67,
-    132,0,90,43,101,44,131,0,90,45,100,106,100,36,101,45,
-    100,68,156,2,100,69,100,70,132,3,90,46,71,0,100,71,
-    100,72,132,0,100,72,131,2,90,47,71,0,100,73,100,74,
-    132,0,100,74,131,2,90,48,71,0,100,75,100,76,132,0,
-    100,76,101,48,131,3,90,49,71,0,100,77,100,78,132,0,
-    100,78,131,2,90,50,71,0,100,79,100,80,132,0,100,80,
-    101,50,101,49,131,4,90,51,71,0,100,81,100,82,132,0,
-    100,82,101,50,101,48,131,4,90,52,103,0,90,53,71,0,
-    100,83,100,84,132,0,100,84,101,50,101,48,131,4,90,54,
-    71,0,100,85,100,86,132,0,100,86,131,2,90,55,71,0,
-    100,87,100,88,132,0,100,88,131,2,90,56,71,0,100,89,
-    100,90,132,0,100,90,131,2,90,57,71,0,100,91,100,92,
-    132,0,100,92,131,2,90,58,100,107,100,93,100,94,132,1,
-    90,59,100,95,100,96,132,0,90,60,100,97,100,98,132,0,
-    90,61,100,99,100,100,132,0,90,62,100,36,83,0,41,108,
-    97,94,1,0,0,67,111,114,101,32,105,109,112,108,101,109,
-    101,110,116,97,116,105,111,110,32,111,102,32,112,97,116,104,
-    45,98,97,115,101,100,32,105,109,112,111,114,116,46,10,10,
-    84,104,105,115,32,109,111,100,117,108,101,32,105,115,32,78,
-    79,84,32,109,101,97,110,116,32,116,111,32,98,101,32,100,
-    105,114,101,99,116,108,121,32,105,109,112,111,114,116,101,100,
-    33,32,73,116,32,104,97,115,32,98,101,101,110,32,100,101,
-    115,105,103,110,101,100,32,115,117,99,104,10,116,104,97,116,
-    32,105,116,32,99,97,110,32,98,101,32,98,111,111,116,115,
-    116,114,97,112,112,101,100,32,105,110,116,111,32,80,121,116,
-    104,111,110,32,97,115,32,116,104,101,32,105,109,112,108,101,
-    109,101,110,116,97,116,105,111,110,32,111,102,32,105,109,112,
-    111,114,116,46,32,65,115,10,115,117,99,104,32,105,116,32,
-    114,101,113,117,105,114,101,115,32,116,104,101,32,105,110,106,
-    101,99,116,105,111,110,32,111,102,32,115,112,101,99,105,102,
-    105,99,32,109,111,100,117,108,101,115,32,97,110,100,32,97,
-    116,116,114,105,98,117,116,101,115,32,105,110,32,111,114,100,
-    101,114,32,116,111,10,119,111,114,107,46,32,79,110,101,32,
-    115,104,111,117,108,100,32,117,115,101,32,105,109,112,111,114,
-    116,108,105,98,32,97,115,32,116,104,101,32,112,117,98,108,
-    105,99,45,102,97,99,105,110,103,32,118,101,114,115,105,111,
-    110,32,111,102,32,116,104,105,115,32,109,111,100,117,108,101,
-    46,10,10,41,1,218,3,119,105,110,41,2,90,6,99,121,
-    103,119,105,110,90,6,100,97,114,119,105,110,99,0,0,0,
-    0,0,0,0,0,0,0,0,0,1,0,0,0,3,0,0,
-    0,3,0,0,0,115,60,0,0,0,116,0,106,1,160,2,
-    116,3,161,1,114,48,116,0,106,1,160,2,116,4,161,1,
-    114,30,100,1,137,0,110,4,100,2,137,0,135,0,102,1,
-    100,3,100,4,132,8,125,0,110,8,100,5,100,4,132,0,
-    125,0,124,0,83,0,41,6,78,90,12,80,89,84,72,79,
-    78,67,65,83,69,79,75,115,12,0,0,0,80,89,84,72,
-    79,78,67,65,83,69,79,75,99,0,0,0,0,0,0,0,
-    0,0,0,0,0,0,0,0,0,2,0,0,0,19,0,0,
-    0,115,20,0,0,0,116,0,106,1,106,2,12,0,111,18,
-    136,0,116,3,106,4,118,0,83,0,41,1,122,94,84,114,
-    117,101,32,105,102,32,102,105,108,101,110,97,109,101,115,32,
-    109,117,115,116,32,98,101,32,99,104,101,99,107,101,100,32,
-    99,97,115,101,45,105,110,115,101,110,115,105,116,105,118,101,
-    108,121,32,97,110,100,32,105,103,110,111,114,101,32,101,110,
-    118,105,114,111,110,109,101,110,116,32,102,108,97,103,115,32,
-    97,114,101,32,110,111,116,32,115,101,116,46,41,5,218,3,
-    115,121,115,218,5,102,108,97,103,115,218,18,105,103,110,111,
-    114,101,95,101,110,118,105,114,111,110,109,101,110,116,218,3,
-    95,111,115,90,7,101,110,118,105,114,111,110,169,0,169,1,
-    218,3,107,101,121,114,5,0,0,0,250,38,60,102,114,111,
-    122,101,110,32,105,109,112,111,114,116,108,105,98,46,95,98,
-    111,111,116,115,116,114,97,112,95,101,120,116,101,114,110,97,
-    108,62,218,11,95,114,101,108,97,120,95,99,97,115,101,36,
-    0,0,0,115,2,0,0,0,0,2,122,37,95,109,97,107,
-    101,95,114,101,108,97,120,95,99,97,115,101,46,60,108,111,
-    99,97,108,115,62,46,95,114,101,108,97,120,95,99,97,115,
-    101,99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,0,1,0,0,0,83,0,0,0,115,4,0,0,0,100,
-    1,83,0,41,2,122,53,84,114,117,101,32,105,102,32,102,
-    105,108,101,110,97,109,101,115,32,109,117,115,116,32,98,101,
-    32,99,104,101,99,107,101,100,32,99,97,115,101,45,105,110,
-    115,101,110,115,105,116,105,118,101,108,121,46,70,114,5,0,
-    0,0,114,5,0,0,0,114,5,0,0,0,114,5,0,0,
-    0,114,8,0,0,0,114,9,0,0,0,40,0,0,0,115,
-    2,0,0,0,0,2,41,5,114,1,0,0,0,218,8,112,
-    108,97,116,102,111,114,109,218,10,115,116,97,114,116,115,119,
-    105,116,104,218,27,95,67,65,83,69,95,73,78,83,69,78,
-    83,73,84,73,86,69,95,80,76,65,84,70,79,82,77,83,
-    218,35,95,67,65,83,69,95,73,78,83,69,78,83,73,84,
-    73,86,69,95,80,76,65,84,70,79,82,77,83,95,83,84,
-    82,95,75,69,89,41,1,114,9,0,0,0,114,5,0,0,
-    0,114,6,0,0,0,114,8,0,0,0,218,16,95,109,97,
-    107,101,95,114,101,108,97,120,95,99,97,115,101,29,0,0,
-    0,115,14,0,0,0,0,1,12,1,12,1,6,2,4,2,
-    14,4,8,3,114,14,0,0,0,99,1,0,0,0,0,0,
-    0,0,0,0,0,0,1,0,0,0,4,0,0,0,67,0,
-    0,0,115,20,0,0,0,116,0,124,0,131,1,100,1,64,
-    0,160,1,100,2,100,3,161,2,83,0,41,4,122,42,67,
-    111,110,118,101,114,116,32,97,32,51,50,45,98,105,116,32,
-    105,110,116,101,103,101,114,32,116,111,32,108,105,116,116,108,
-    101,45,101,110,100,105,97,110,46,236,3,0,0,0,255,127,
-    255,127,3,0,233,4,0,0,0,218,6,108,105,116,116,108,
-    101,41,2,218,3,105,110,116,218,8,116,111,95,98,121,116,
-    101,115,41,1,218,1,120,114,5,0,0,0,114,5,0,0,
-    0,114,8,0,0,0,218,12,95,112,97,99,107,95,117,105,
-    110,116,51,50,46,0,0,0,115,2,0,0,0,0,2,114,
-    21,0,0,0,99,1,0,0,0,0,0,0,0,0,0,0,
-    0,1,0,0,0,4,0,0,0,67,0,0,0,115,28,0,
-    0,0,116,0,124,0,131,1,100,1,107,2,115,16,74,0,
-    130,1,116,1,160,2,124,0,100,2,161,2,83,0,41,3,
-    122,47,67,111,110,118,101,114,116,32,52,32,98,121,116,101,
-    115,32,105,110,32,108,105,116,116,108,101,45,101,110,100,105,
-    97,110,32,116,111,32,97,110,32,105,110,116,101,103,101,114,
-    46,114,16,0,0,0,114,17,0,0,0,169,3,218,3,108,
-    101,110,114,18,0,0,0,218,10,102,114,111,109,95,98,121,
-    116,101,115,169,1,218,4,100,97,116,97,114,5,0,0,0,
-    114,5,0,0,0,114,8,0,0,0,218,14,95,117,110,112,
-    97,99,107,95,117,105,110,116,51,50,51,0,0,0,115,4,
-    0,0,0,0,2,16,1,114,27,0,0,0,99,1,0,0,
-    0,0,0,0,0,0,0,0,0,1,0,0,0,4,0,0,
-    0,67,0,0,0,115,28,0,0,0,116,0,124,0,131,1,
-    100,1,107,2,115,16,74,0,130,1,116,1,160,2,124,0,
-    100,2,161,2,83,0,41,3,122,47,67,111,110,118,101,114,
-    116,32,50,32,98,121,116,101,115,32,105,110,32,108,105,116,
-    116,108,101,45,101,110,100,105,97,110,32,116,111,32,97,110,
-    32,105,110,116,101,103,101,114,46,233,2,0,0,0,114,17,
-    0,0,0,114,22,0,0,0,114,25,0,0,0,114,5,0,
-    0,0,114,5,0,0,0,114,8,0,0,0,218,14,95,117,
-    110,112,97,99,107,95,117,105,110,116,49,54,56,0,0,0,
-    115,4,0,0,0,0,2,16,1,114,29,0,0,0,99,0,
-    0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,4,
-    0,0,0,71,0,0,0,115,20,0,0,0,116,0,160,1,
-    100,1,100,2,132,0,124,0,68,0,131,1,161,1,83,0,
-    41,3,122,31,82,101,112,108,97,99,101,109,101,110,116,32,
-    102,111,114,32,111,115,46,112,97,116,104,46,106,111,105,110,
-    40,41,46,99,1,0,0,0,0,0,0,0,0,0,0,0,
-    2,0,0,0,5,0,0,0,83,0,0,0,115,26,0,0,
-    0,103,0,124,0,93,18,125,1,124,1,114,4,124,1,160,
-    0,116,1,161,1,145,2,113,4,83,0,114,5,0,0,0,
-    41,2,218,6,114,115,116,114,105,112,218,15,112,97,116,104,
-    95,115,101,112,97,114,97,116,111,114,115,41,2,218,2,46,
-    48,218,4,112,97,114,116,114,5,0,0,0,114,5,0,0,
-    0,114,8,0,0,0,218,10,60,108,105,115,116,99,111,109,
-    112,62,64,0,0,0,115,4,0,0,0,6,1,6,255,122,
-    30,95,112,97,116,104,95,106,111,105,110,46,60,108,111,99,
-    97,108,115,62,46,60,108,105,115,116,99,111,109,112,62,41,
-    2,218,8,112,97,116,104,95,115,101,112,218,4,106,111,105,
-    110,41,1,218,10,112,97,116,104,95,112,97,114,116,115,114,
-    5,0,0,0,114,5,0,0,0,114,8,0,0,0,218,10,
-    95,112,97,116,104,95,106,111,105,110,62,0,0,0,115,6,
-    0,0,0,0,2,10,1,2,255,114,38,0,0,0,99,1,
-    0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,5,
-    0,0,0,67,0,0,0,115,96,0,0,0,116,0,116,1,
-    131,1,100,1,107,2,114,36,124,0,160,2,116,3,161,1,
-    92,3,125,1,125,2,125,3,124,1,124,3,102,2,83,0,
-    116,4,124,0,131,1,68,0,93,42,125,4,124,4,116,1,
-    118,0,114,44,124,0,106,5,124,4,100,1,100,2,141,2,
-    92,2,125,1,125,3,124,1,124,3,102,2,2,0,1,0,
-    83,0,113,44,100,3,124,0,102,2,83,0,41,4,122,32,
-    82,101,112,108,97,99,101,109,101,110,116,32,102,111,114,32,
-    111,115,46,112,97,116,104,46,115,112,108,105,116,40,41,46,
-    233,1,0,0,0,41,1,90,8,109,97,120,115,112,108,105,
-    116,218,0,41,6,114,23,0,0,0,114,31,0,0,0,218,
-    10,114,112,97,114,116,105,116,105,111,110,114,35,0,0,0,
-    218,8,114,101,118,101,114,115,101,100,218,6,114,115,112,108,
-    105,116,41,5,218,4,112,97,116,104,90,5,102,114,111,110,
-    116,218,1,95,218,4,116,97,105,108,114,20,0,0,0,114,
-    5,0,0,0,114,5,0,0,0,114,8,0,0,0,218,11,
-    95,112,97,116,104,95,115,112,108,105,116,68,0,0,0,115,
-    16,0,0,0,0,2,12,1,16,1,8,1,12,1,8,1,
-    18,1,14,1,114,47,0,0,0,99,1,0,0,0,0,0,
-    0,0,0,0,0,0,1,0,0,0,3,0,0,0,67,0,
-    0,0,115,10,0,0,0,116,0,160,1,124,0,161,1,83,
-    0,41,1,122,126,83,116,97,116,32,116,104,101,32,112,97,
-    116,104,46,10,10,32,32,32,32,77,97,100,101,32,97,32,
-    115,101,112,97,114,97,116,101,32,102,117,110,99,116,105,111,
-    110,32,116,111,32,109,97,107,101,32,105,116,32,101,97,115,
-    105,101,114,32,116,111,32,111,118,101,114,114,105,100,101,32,
-    105,110,32,101,120,112,101,114,105,109,101,110,116,115,10,32,
-    32,32,32,40,101,46,103,46,32,99,97,99,104,101,32,115,
-    116,97,116,32,114,101,115,117,108,116,115,41,46,10,10,32,
-    32,32,32,41,2,114,4,0,0,0,90,4,115,116,97,116,
-    169,1,114,44,0,0,0,114,5,0,0,0,114,5,0,0,
-    0,114,8,0,0,0,218,10,95,112,97,116,104,95,115,116,
-    97,116,80,0,0,0,115,2,0,0,0,0,7,114,49,0,
-    0,0,99,2,0,0,0,0,0,0,0,0,0,0,0,3,
-    0,0,0,8,0,0,0,67,0,0,0,115,48,0,0,0,
-    122,12,116,0,124,0,131,1,125,2,87,0,110,20,4,0,
-    116,1,121,32,1,0,1,0,1,0,89,0,100,1,83,0,
-    48,0,124,2,106,2,100,2,64,0,124,1,107,2,83,0,
-    41,3,122,49,84,101,115,116,32,119,104,101,116,104,101,114,
-    32,116,104,101,32,112,97,116,104,32,105,115,32,116,104,101,
-    32,115,112,101,99,105,102,105,101,100,32,109,111,100,101,32,
-    116,121,112,101,46,70,105,0,240,0,0,41,3,114,49,0,
-    0,0,218,7,79,83,69,114,114,111,114,218,7,115,116,95,
-    109,111,100,101,41,3,114,44,0,0,0,218,4,109,111,100,
-    101,90,9,115,116,97,116,95,105,110,102,111,114,5,0,0,
-    0,114,5,0,0,0,114,8,0,0,0,218,18,95,112,97,
-    116,104,95,105,115,95,109,111,100,101,95,116,121,112,101,90,
-    0,0,0,115,10,0,0,0,0,2,2,1,12,1,12,1,
-    8,1,114,53,0,0,0,99,1,0,0,0,0,0,0,0,
-    0,0,0,0,1,0,0,0,3,0,0,0,67,0,0,0,
-    115,10,0,0,0,116,0,124,0,100,1,131,2,83,0,41,
-    2,122,31,82,101,112,108,97,99,101,109,101,110,116,32,102,
-    111,114,32,111,115,46,112,97,116,104,46,105,115,102,105,108,
-    101,46,105,0,128,0,0,41,1,114,53,0,0,0,114,48,
-    0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,
-    0,0,218,12,95,112,97,116,104,95,105,115,102,105,108,101,
-    99,0,0,0,115,2,0,0,0,0,2,114,54,0,0,0,
-    99,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,
-    0,3,0,0,0,67,0,0,0,115,22,0,0,0,124,0,
-    115,12,116,0,160,1,161,0,125,0,116,2,124,0,100,1,
-    131,2,83,0,41,2,122,30,82,101,112,108,97,99,101,109,
-    101,110,116,32,102,111,114,32,111,115,46,112,97,116,104,46,
-    105,115,100,105,114,46,105,0,64,0,0,41,3,114,4,0,
-    0,0,218,6,103,101,116,99,119,100,114,53,0,0,0,114,
-    48,0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,
-    0,0,0,218,11,95,112,97,116,104,95,105,115,100,105,114,
-    104,0,0,0,115,6,0,0,0,0,2,4,1,8,1,114,
-    56,0,0,0,99,1,0,0,0,0,0,0,0,0,0,0,
-    0,1,0,0,0,3,0,0,0,67,0,0,0,115,26,0,
-    0,0,124,0,160,0,116,1,161,1,112,24,124,0,100,1,
-    100,2,133,2,25,0,116,2,118,0,83,0,41,3,122,142,
-    82,101,112,108,97,99,101,109,101,110,116,32,102,111,114,32,
-    111,115,46,112,97,116,104,46,105,115,97,98,115,46,10,10,
-    32,32,32,32,67,111,110,115,105,100,101,114,115,32,97,32,
-    87,105,110,100,111,119,115,32,100,114,105,118,101,45,114,101,
-    108,97,116,105,118,101,32,112,97,116,104,32,40,110,111,32,
-    100,114,105,118,101,44,32,98,117,116,32,115,116,97,114,116,
-    115,32,119,105,116,104,32,115,108,97,115,104,41,32,116,111,
-    10,32,32,32,32,115,116,105,108,108,32,98,101,32,34,97,
-    98,115,111,108,117,116,101,34,46,10,32,32,32,32,114,39,
-    0,0,0,233,3,0,0,0,41,3,114,11,0,0,0,114,
-    31,0,0,0,218,20,95,112,97,116,104,115,101,112,115,95,
-    119,105,116,104,95,99,111,108,111,110,114,48,0,0,0,114,
-    5,0,0,0,114,5,0,0,0,114,8,0,0,0,218,11,
-    95,112,97,116,104,95,105,115,97,98,115,111,0,0,0,115,
-    2,0,0,0,0,6,114,59,0,0,0,233,182,1,0,0,
-    99,3,0,0,0,0,0,0,0,0,0,0,0,6,0,0,
-    0,11,0,0,0,67,0,0,0,115,178,0,0,0,100,1,
-    160,0,124,0,116,1,124,0,131,1,161,2,125,3,116,2,
-    160,3,124,3,116,2,106,4,116,2,106,5,66,0,116,2,
-    106,6,66,0,124,2,100,2,64,0,161,3,125,4,122,70,
-    116,7,160,8,124,4,100,3,161,2,143,26,125,5,124,5,
-    160,9,124,1,161,1,1,0,87,0,100,4,4,0,4,0,
-    131,3,1,0,110,16,49,0,115,94,48,0,1,0,1,0,
-    1,0,89,0,1,0,116,2,160,10,124,3,124,0,161,2,
-    1,0,87,0,110,54,4,0,116,11,121,172,1,0,1,0,
-    1,0,122,14,116,2,160,12,124,3,161,1,1,0,87,0,
-    110,18,4,0,116,11,121,164,1,0,1,0,1,0,89,0,
-    110,2,48,0,130,0,89,0,110,2,48,0,100,4,83,0,
-    41,5,122,162,66,101,115,116,45,101,102,102,111,114,116,32,
-    102,117,110,99,116,105,111,110,32,116,111,32,119,114,105,116,
-    101,32,100,97,116,97,32,116,111,32,97,32,112,97,116,104,
-    32,97,116,111,109,105,99,97,108,108,121,46,10,32,32,32,
-    32,66,101,32,112,114,101,112,97,114,101,100,32,116,111,32,
-    104,97,110,100,108,101,32,97,32,70,105,108,101,69,120,105,
-    115,116,115,69,114,114,111,114,32,105,102,32,99,111,110,99,
-    117,114,114,101,110,116,32,119,114,105,116,105,110,103,32,111,
-    102,32,116,104,101,10,32,32,32,32,116,101,109,112,111,114,
-    97,114,121,32,102,105,108,101,32,105,115,32,97,116,116,101,
-    109,112,116,101,100,46,250,5,123,125,46,123,125,114,60,0,
-    0,0,90,2,119,98,78,41,13,218,6,102,111,114,109,97,
-    116,218,2,105,100,114,4,0,0,0,90,4,111,112,101,110,
-    90,6,79,95,69,88,67,76,90,7,79,95,67,82,69,65,
-    84,90,8,79,95,87,82,79,78,76,89,218,3,95,105,111,
-    218,6,70,105,108,101,73,79,218,5,119,114,105,116,101,218,
-    7,114,101,112,108,97,99,101,114,50,0,0,0,90,6,117,
-    110,108,105,110,107,41,6,114,44,0,0,0,114,26,0,0,
-    0,114,52,0,0,0,90,8,112,97,116,104,95,116,109,112,
-    90,2,102,100,218,4,102,105,108,101,114,5,0,0,0,114,
-    5,0,0,0,114,8,0,0,0,218,13,95,119,114,105,116,
-    101,95,97,116,111,109,105,99,120,0,0,0,115,28,0,0,
-    0,0,5,16,1,6,1,22,255,4,2,2,3,14,1,40,
-    1,16,1,12,1,2,1,14,1,12,1,6,1,114,69,0,
-    0,0,105,97,13,0,0,114,28,0,0,0,114,17,0,0,
-    0,115,2,0,0,0,13,10,90,11,95,95,112,121,99,97,
-    99,104,101,95,95,122,4,111,112,116,45,122,3,46,112,121,
-    122,4,46,112,121,99,78,41,1,218,12,111,112,116,105,109,
-    105,122,97,116,105,111,110,99,2,0,0,0,0,0,0,0,
-    1,0,0,0,12,0,0,0,5,0,0,0,67,0,0,0,
-    115,88,1,0,0,124,1,100,1,117,1,114,52,116,0,160,
-    1,100,2,116,2,161,2,1,0,124,2,100,1,117,1,114,
-    40,100,3,125,3,116,3,124,3,131,1,130,1,124,1,114,
-    48,100,4,110,2,100,5,125,2,116,4,160,5,124,0,161,
-    1,125,0,116,6,124,0,131,1,92,2,125,4,125,5,124,
-    5,160,7,100,6,161,1,92,3,125,6,125,7,125,8,116,
-    8,106,9,106,10,125,9,124,9,100,1,117,0,114,114,116,
-    11,100,7,131,1,130,1,100,4,160,12,124,6,114,126,124,
-    6,110,2,124,8,124,7,124,9,103,3,161,1,125,10,124,
-    2,100,1,117,0,114,172,116,8,106,13,106,14,100,8,107,
-    2,114,164,100,4,125,2,110,8,116,8,106,13,106,14,125,
-    2,116,15,124,2,131,1,125,2,124,2,100,4,107,3,114,
-    224,124,2,160,16,161,0,115,210,116,17,100,9,160,18,124,
-    2,161,1,131,1,130,1,100,10,160,18,124,10,116,19,124,
-    2,161,3,125,10,124,10,116,20,100,8,25,0,23,0,125,
-    11,116,8,106,21,100,1,117,1,144,1,114,76,116,22,124,
-    4,131,1,144,1,115,16,116,23,116,4,160,24,161,0,124,
-    4,131,2,125,4,124,4,100,5,25,0,100,11,107,2,144,
-    1,114,56,124,4,100,8,25,0,116,25,118,1,144,1,114,
-    56,124,4,100,12,100,1,133,2,25,0,125,4,116,23,116,
-    8,106,21,124,4,160,26,116,25,161,1,124,11,131,3,83,
-    0,116,23,124,4,116,27,124,11,131,3,83,0,41,13,97,
-    254,2,0,0,71,105,118,101,110,32,116,104,101,32,112,97,
-    116,104,32,116,111,32,97,32,46,112,121,32,102,105,108,101,
-    44,32,114,101,116,117,114,110,32,116,104,101,32,112,97,116,
-    104,32,116,111,32,105,116,115,32,46,112,121,99,32,102,105,
-    108,101,46,10,10,32,32,32,32,84,104,101,32,46,112,121,
-    32,102,105,108,101,32,100,111,101,115,32,110,111,116,32,110,
-    101,101,100,32,116,111,32,101,120,105,115,116,59,32,116,104,
-    105,115,32,115,105,109,112,108,121,32,114,101,116,117,114,110,
-    115,32,116,104,101,32,112,97,116,104,32,116,111,32,116,104,
-    101,10,32,32,32,32,46,112,121,99,32,102,105,108,101,32,
-    99,97,108,99,117,108,97,116,101,100,32,97,115,32,105,102,
-    32,116,104,101,32,46,112,121,32,102,105,108,101,32,119,101,
-    114,101,32,105,109,112,111,114,116,101,100,46,10,10,32,32,
-    32,32,84,104,101,32,39,111,112,116,105,109,105,122,97,116,
-    105,111,110,39,32,112,97,114,97,109,101,116,101,114,32,99,
-    111,110,116,114,111,108,115,32,116,104,101,32,112,114,101,115,
-    117,109,101,100,32,111,112,116,105,109,105,122,97,116,105,111,
-    110,32,108,101,118,101,108,32,111,102,10,32,32,32,32,116,
-    104,101,32,98,121,116,101,99,111,100,101,32,102,105,108,101,
-    46,32,73,102,32,39,111,112,116,105,109,105,122,97,116,105,
-    111,110,39,32,105,115,32,110,111,116,32,78,111,110,101,44,
-    32,116,104,101,32,115,116,114,105,110,103,32,114,101,112,114,
-    101,115,101,110,116,97,116,105,111,110,10,32,32,32,32,111,
-    102,32,116,104,101,32,97,114,103,117,109,101,110,116,32,105,
-    115,32,116,97,107,101,110,32,97,110,100,32,118,101,114,105,
-    102,105,101,100,32,116,111,32,98,101,32,97,108,112,104,97,
-    110,117,109,101,114,105,99,32,40,101,108,115,101,32,86,97,
-    108,117,101,69,114,114,111,114,10,32,32,32,32,105,115,32,
-    114,97,105,115,101,100,41,46,10,10,32,32,32,32,84,104,
-    101,32,100,101,98,117,103,95,111,118,101,114,114,105,100,101,
-    32,112,97,114,97,109,101,116,101,114,32,105,115,32,100,101,
-    112,114,101,99,97,116,101,100,46,32,73,102,32,100,101,98,
-    117,103,95,111,118,101,114,114,105,100,101,32,105,115,32,110,
-    111,116,32,78,111,110,101,44,10,32,32,32,32,97,32,84,
-    114,117,101,32,118,97,108,117,101,32,105,115,32,116,104,101,
-    32,115,97,109,101,32,97,115,32,115,101,116,116,105,110,103,
-    32,39,111,112,116,105,109,105,122,97,116,105,111,110,39,32,
-    116,111,32,116,104,101,32,101,109,112,116,121,32,115,116,114,
-    105,110,103,10,32,32,32,32,119,104,105,108,101,32,97,32,
-    70,97,108,115,101,32,118,97,108,117,101,32,105,115,32,101,
-    113,117,105,118,97,108,101,110,116,32,116,111,32,115,101,116,
-    116,105,110,103,32,39,111,112,116,105,109,105,122,97,116,105,
-    111,110,39,32,116,111,32,39,49,39,46,10,10,32,32,32,
-    32,73,102,32,115,121,115,46,105,109,112,108,101,109,101,110,
-    116,97,116,105,111,110,46,99,97,99,104,101,95,116,97,103,
-    32,105,115,32,78,111,110,101,32,116,104,101,110,32,78,111,
-    116,73,109,112,108,101,109,101,110,116,101,100,69,114,114,111,
-    114,32,105,115,32,114,97,105,115,101,100,46,10,10,32,32,
-    32,32,78,122,70,116,104,101,32,100,101,98,117,103,95,111,
-    118,101,114,114,105,100,101,32,112,97,114,97,109,101,116,101,
-    114,32,105,115,32,100,101,112,114,101,99,97,116,101,100,59,
-    32,117,115,101,32,39,111,112,116,105,109,105,122,97,116,105,
-    111,110,39,32,105,110,115,116,101,97,100,122,50,100,101,98,
-    117,103,95,111,118,101,114,114,105,100,101,32,111,114,32,111,
-    112,116,105,109,105,122,97,116,105,111,110,32,109,117,115,116,
-    32,98,101,32,115,101,116,32,116,111,32,78,111,110,101,114,
-    40,0,0,0,114,39,0,0,0,218,1,46,250,36,115,121,
-    115,46,105,109,112,108,101,109,101,110,116,97,116,105,111,110,
-    46,99,97,99,104,101,95,116,97,103,32,105,115,32,78,111,
-    110,101,233,0,0,0,0,122,24,123,33,114,125,32,105,115,
-    32,110,111,116,32,97,108,112,104,97,110,117,109,101,114,105,
-    99,122,7,123,125,46,123,125,123,125,250,1,58,114,28,0,
-    0,0,41,28,218,9,95,119,97,114,110,105,110,103,115,218,
-    4,119,97,114,110,218,18,68,101,112,114,101,99,97,116,105,
-    111,110,87,97,114,110,105,110,103,218,9,84,121,112,101,69,
-    114,114,111,114,114,4,0,0,0,218,6,102,115,112,97,116,
-    104,114,47,0,0,0,114,41,0,0,0,114,1,0,0,0,
-    218,14,105,109,112,108,101,109,101,110,116,97,116,105,111,110,
-    218,9,99,97,99,104,101,95,116,97,103,218,19,78,111,116,
-    73,109,112,108,101,109,101,110,116,101,100,69,114,114,111,114,
-    114,36,0,0,0,114,2,0,0,0,218,8,111,112,116,105,
-    109,105,122,101,218,3,115,116,114,218,7,105,115,97,108,110,
-    117,109,218,10,86,97,108,117,101,69,114,114,111,114,114,62,
-    0,0,0,218,4,95,79,80,84,218,17,66,89,84,69,67,
-    79,68,69,95,83,85,70,70,73,88,69,83,218,14,112,121,
-    99,97,99,104,101,95,112,114,101,102,105,120,114,59,0,0,
-    0,114,38,0,0,0,114,55,0,0,0,114,31,0,0,0,
-    218,6,108,115,116,114,105,112,218,8,95,80,89,67,65,67,
-    72,69,41,12,114,44,0,0,0,90,14,100,101,98,117,103,
-    95,111,118,101,114,114,105,100,101,114,70,0,0,0,218,7,
-    109,101,115,115,97,103,101,218,4,104,101,97,100,114,46,0,
-    0,0,90,4,98,97,115,101,218,3,115,101,112,218,4,114,
-    101,115,116,90,3,116,97,103,90,15,97,108,109,111,115,116,
-    95,102,105,108,101,110,97,109,101,218,8,102,105,108,101,110,
-    97,109,101,114,5,0,0,0,114,5,0,0,0,114,8,0,
-    0,0,218,17,99,97,99,104,101,95,102,114,111,109,95,115,
-    111,117,114,99,101,45,1,0,0,115,72,0,0,0,0,18,
-    8,1,6,1,2,255,4,2,8,1,4,1,8,1,12,1,
-    10,1,12,1,16,1,8,1,8,1,8,1,24,1,8,1,
-    12,1,6,2,8,1,8,1,8,1,8,1,14,1,14,1,
-    12,1,12,9,10,1,14,5,28,1,12,4,2,1,4,1,
-    8,1,2,253,4,5,114,97,0,0,0,99,1,0,0,0,
-    0,0,0,0,0,0,0,0,10,0,0,0,5,0,0,0,
-    67,0,0,0,115,46,1,0,0,116,0,106,1,106,2,100,
-    1,117,0,114,20,116,3,100,2,131,1,130,1,116,4,160,
-    5,124,0,161,1,125,0,116,6,124,0,131,1,92,2,125,
-    1,125,2,100,3,125,3,116,0,106,7,100,1,117,1,114,
-    102,116,0,106,7,160,8,116,9,161,1,125,4,124,1,160,
-    10,124,4,116,11,23,0,161,1,114,102,124,1,116,12,124,
-    4,131,1,100,1,133,2,25,0,125,1,100,4,125,3,124,
-    3,115,144,116,6,124,1,131,1,92,2,125,1,125,5,124,
-    5,116,13,107,3,114,144,116,14,116,13,155,0,100,5,124,
-    0,155,2,157,3,131,1,130,1,124,2,160,15,100,6,161,
-    1,125,6,124,6,100,7,118,1,114,178,116,14,100,8,124,
-    2,155,2,157,2,131,1,130,1,110,92,124,6,100,9,107,
-    2,144,1,114,14,124,2,160,16,100,6,100,10,161,2,100,
-    11,25,0,125,7,124,7,160,10,116,17,161,1,115,228,116,
-    14,100,12,116,17,155,2,157,2,131,1,130,1,124,7,116,
-    12,116,17,131,1,100,1,133,2,25,0,125,8,124,8,160,
-    18,161,0,144,1,115,14,116,14,100,13,124,7,155,2,100,
-    14,157,3,131,1,130,1,124,2,160,19,100,6,161,1,100,
-    15,25,0,125,9,116,20,124,1,124,9,116,21,100,15,25,
-    0,23,0,131,2,83,0,41,16,97,110,1,0,0,71,105,
-    118,101,110,32,116,104,101,32,112,97,116,104,32,116,111,32,
-    97,32,46,112,121,99,46,32,102,105,108,101,44,32,114,101,
-    116,117,114,110,32,116,104,101,32,112,97,116,104,32,116,111,
-    32,105,116,115,32,46,112,121,32,102,105,108,101,46,10,10,
-    32,32,32,32,84,104,101,32,46,112,121,99,32,102,105,108,
-    101,32,100,111,101,115,32,110,111,116,32,110,101,101,100,32,
-    116,111,32,101,120,105,115,116,59,32,116,104,105,115,32,115,
-    105,109,112,108,121,32,114,101,116,117,114,110,115,32,116,104,
-    101,32,112,97,116,104,32,116,111,10,32,32,32,32,116,104,
-    101,32,46,112,121,32,102,105,108,101,32,99,97,108,99,117,
-    108,97,116,101,100,32,116,111,32,99,111,114,114,101,115,112,
-    111,110,100,32,116,111,32,116,104,101,32,46,112,121,99,32,
-    102,105,108,101,46,32,32,73,102,32,112,97,116,104,32,100,
-    111,101,115,10,32,32,32,32,110,111,116,32,99,111,110,102,
-    111,114,109,32,116,111,32,80,69,80,32,51,49,52,55,47,
-    52,56,56,32,102,111,114,109,97,116,44,32,86,97,108,117,
-    101,69,114,114,111,114,32,119,105,108,108,32,98,101,32,114,
-    97,105,115,101,100,46,32,73,102,10,32,32,32,32,115,121,
-    115,46,105,109,112,108,101,109,101,110,116,97,116,105,111,110,
-    46,99,97,99,104,101,95,116,97,103,32,105,115,32,78,111,
-    110,101,32,116,104,101,110,32,78,111,116,73,109,112,108,101,
-    109,101,110,116,101,100,69,114,114,111,114,32,105,115,32,114,
-    97,105,115,101,100,46,10,10,32,32,32,32,78,114,72,0,
-    0,0,70,84,122,31,32,110,111,116,32,98,111,116,116,111,
-    109,45,108,101,118,101,108,32,100,105,114,101,99,116,111,114,
-    121,32,105,110,32,114,71,0,0,0,62,2,0,0,0,114,
-    28,0,0,0,114,57,0,0,0,122,29,101,120,112,101,99,
-    116,101,100,32,111,110,108,121,32,50,32,111,114,32,51,32,
-    100,111,116,115,32,105,110,32,114,57,0,0,0,114,28,0,
-    0,0,233,254,255,255,255,122,53,111,112,116,105,109,105,122,
-    97,116,105,111,110,32,112,111,114,116,105,111,110,32,111,102,
-    32,102,105,108,101,110,97,109,101,32,100,111,101,115,32,110,
-    111,116,32,115,116,97,114,116,32,119,105,116,104,32,122,19,
-    111,112,116,105,109,105,122,97,116,105,111,110,32,108,101,118,
-    101,108,32,122,29,32,105,115,32,110,111,116,32,97,110,32,
-    97,108,112,104,97,110,117,109,101,114,105,99,32,118,97,108,
-    117,101,114,73,0,0,0,41,22,114,1,0,0,0,114,80,
-    0,0,0,114,81,0,0,0,114,82,0,0,0,114,4,0,
-    0,0,114,79,0,0,0,114,47,0,0,0,114,89,0,0,
-    0,114,30,0,0,0,114,31,0,0,0,114,11,0,0,0,
-    114,35,0,0,0,114,23,0,0,0,114,91,0,0,0,114,
-    86,0,0,0,218,5,99,111,117,110,116,114,43,0,0,0,
-    114,87,0,0,0,114,85,0,0,0,218,9,112,97,114,116,
-    105,116,105,111,110,114,38,0,0,0,218,15,83,79,85,82,
-    67,69,95,83,85,70,70,73,88,69,83,41,10,114,44,0,
-    0,0,114,93,0,0,0,90,16,112,121,99,97,99,104,101,
-    95,102,105,108,101,110,97,109,101,90,23,102,111,117,110,100,
-    95,105,110,95,112,121,99,97,99,104,101,95,112,114,101,102,
-    105,120,90,13,115,116,114,105,112,112,101,100,95,112,97,116,
-    104,90,7,112,121,99,97,99,104,101,90,9,100,111,116,95,
-    99,111,117,110,116,114,70,0,0,0,90,9,111,112,116,95,
-    108,101,118,101,108,90,13,98,97,115,101,95,102,105,108,101,
-    110,97,109,101,114,5,0,0,0,114,5,0,0,0,114,8,
-    0,0,0,218,17,115,111,117,114,99,101,95,102,114,111,109,
-    95,99,97,99,104,101,116,1,0,0,115,60,0,0,0,0,
-    9,12,1,8,1,10,1,12,1,4,1,10,1,12,1,14,
-    1,16,1,4,1,4,1,12,1,8,1,8,1,2,255,8,
-    2,10,1,8,1,16,1,10,1,16,1,10,1,4,1,2,
-    255,8,2,16,1,10,1,16,2,14,1,114,102,0,0,0,
-    99,1,0,0,0,0,0,0,0,0,0,0,0,5,0,0,
-    0,9,0,0,0,67,0,0,0,115,124,0,0,0,116,0,
-    124,0,131,1,100,1,107,2,114,16,100,2,83,0,124,0,
-    160,1,100,3,161,1,92,3,125,1,125,2,125,3,124,1,
-    114,56,124,3,160,2,161,0,100,4,100,5,133,2,25,0,
-    100,6,107,3,114,60,124,0,83,0,122,12,116,3,124,0,
-    131,1,125,4,87,0,110,34,4,0,116,4,116,5,102,2,
-    121,106,1,0,1,0,1,0,124,0,100,2,100,5,133,2,
-    25,0,125,4,89,0,110,2,48,0,116,6,124,4,131,1,
-    114,120,124,4,83,0,124,0,83,0,41,7,122,188,67,111,
-    110,118,101,114,116,32,97,32,98,121,116,101,99,111,100,101,
-    32,102,105,108,101,32,112,97,116,104,32,116,111,32,97,32,
-    115,111,117,114,99,101,32,112,97,116,104,32,40,105,102,32,
-    112,111,115,115,105,98,108,101,41,46,10,10,32,32,32,32,
-    84,104,105,115,32,102,117,110,99,116,105,111,110,32,101,120,
-    105,115,116,115,32,112,117,114,101,108,121,32,102,111,114,32,
-    98,97,99,107,119,97,114,100,115,45,99,111,109,112,97,116,
-    105,98,105,108,105,116,121,32,102,111,114,10,32,32,32,32,
-    80,121,73,109,112,111,114,116,95,69,120,101,99,67,111,100,
-    101,77,111,100,117,108,101,87,105,116,104,70,105,108,101,110,
-    97,109,101,115,40,41,32,105,110,32,116,104,101,32,67,32,
-    65,80,73,46,10,10,32,32,32,32,114,73,0,0,0,78,
-    114,71,0,0,0,233,253,255,255,255,233,255,255,255,255,90,
-    2,112,121,41,7,114,23,0,0,0,114,41,0,0,0,218,
-    5,108,111,119,101,114,114,102,0,0,0,114,82,0,0,0,
-    114,86,0,0,0,114,54,0,0,0,41,5,218,13,98,121,
-    116,101,99,111,100,101,95,112,97,116,104,114,95,0,0,0,
-    114,45,0,0,0,90,9,101,120,116,101,110,115,105,111,110,
-    218,11,115,111,117,114,99,101,95,112,97,116,104,114,5,0,
-    0,0,114,5,0,0,0,114,8,0,0,0,218,15,95,103,
-    101,116,95,115,111,117,114,99,101,102,105,108,101,156,1,0,
-    0,115,20,0,0,0,0,7,12,1,4,1,16,1,24,1,
-    4,1,2,1,12,1,16,1,18,1,114,108,0,0,0,99,
-    1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,
-    8,0,0,0,67,0,0,0,115,72,0,0,0,124,0,160,
-    0,116,1,116,2,131,1,161,1,114,46,122,10,116,3,124,
-    0,131,1,87,0,83,0,4,0,116,4,121,42,1,0,1,
-    0,1,0,89,0,113,68,48,0,110,22,124,0,160,0,116,
-    1,116,5,131,1,161,1,114,64,124,0,83,0,100,0,83,
-    0,100,0,83,0,169,1,78,41,6,218,8,101,110,100,115,
-    119,105,116,104,218,5,116,117,112,108,101,114,101,0,0,0,
-    114,97,0,0,0,114,82,0,0,0,114,88,0,0,0,41,
-    1,114,96,0,0,0,114,5,0,0,0,114,5,0,0,0,
-    114,8,0,0,0,218,11,95,103,101,116,95,99,97,99,104,
-    101,100,175,1,0,0,115,16,0,0,0,0,1,14,1,2,
-    1,10,1,12,1,8,1,14,1,4,2,114,112,0,0,0,
+    0,5,0,0,0,64,0,0,0,115,250,2,0,0,100,0,
+    90,0,100,1,97,1,100,2,100,1,108,2,90,2,100,2,
+    100,1,108,3,90,3,100,2,100,1,108,4,90,4,100,2,
+    100,1,108,5,90,5,100,2,100,1,108,6,90,6,101,4,
+    106,7,100,3,107,2,90,8,101,8,114,40,100,2,100,1,
+    108,9,90,10,100,2,100,1,108,11,90,11,110,4,100,2,
+    100,1,108,12,90,10,101,8,114,51,100,4,100,5,103,2,
+    90,13,110,3,100,5,103,1,90,13,101,14,100,6,100,7,
+    132,0,101,13,68,0,131,1,131,1,115,65,74,0,130,1,
+    101,13,100,2,25,0,90,15,101,16,101,13,131,1,90,17,
+    100,8,160,18,101,13,161,1,90,13,100,9,100,10,132,0,
+    101,13,68,0,131,1,90,19,100,11,90,20,100,12,90,21,
+    101,21,101,20,23,0,90,22,100,13,100,14,132,0,90,23,
+    101,23,131,0,90,24,100,15,100,16,132,0,90,25,100,17,
+    100,18,132,0,90,26,100,19,100,20,132,0,90,27,101,8,
+    114,119,100,21,100,22,132,0,90,28,110,4,100,23,100,22,
+    132,0,90,28,100,24,100,25,132,0,90,29,100,26,100,27,
+    132,0,90,30,100,28,100,29,132,0,90,31,100,30,100,31,
+    132,0,90,32,100,32,100,33,132,0,90,33,101,8,114,150,
+    100,34,100,35,132,0,90,34,110,4,100,36,100,35,132,0,
+    90,34,100,112,100,38,100,39,132,1,90,35,101,36,101,35,
+    106,37,131,1,90,38,100,40,160,39,100,41,100,42,161,2,
+    100,43,23,0,90,40,101,41,160,42,101,40,100,42,161,2,
+    90,43,100,44,90,44,100,45,90,45,100,46,103,1,90,46,
+    101,8,114,192,101,46,160,47,100,47,161,1,1,0,101,2,
+    160,48,161,0,90,49,100,48,103,1,90,50,101,50,4,0,
+    90,51,90,52,100,113,100,1,100,49,156,1,100,50,100,51,
+    132,3,90,53,100,52,100,53,132,0,90,54,100,54,100,55,
+    132,0,90,55,100,56,100,57,132,0,90,56,100,58,100,59,
+    132,0,90,57,100,60,100,61,132,0,90,58,100,62,100,63,
+    132,0,90,59,100,64,100,65,132,0,90,60,100,66,100,67,
+    132,0,90,61,100,68,100,69,132,0,90,62,100,114,100,70,
+    100,71,132,1,90,63,100,115,100,72,100,73,132,1,90,64,
+    100,116,100,75,100,76,132,1,90,65,100,77,100,78,132,0,
+    90,66,101,67,131,0,90,68,100,113,100,1,101,68,100,79,
+    156,2,100,80,100,81,132,3,90,69,71,0,100,82,100,83,
+    132,0,100,83,131,2,90,70,71,0,100,84,100,85,132,0,
+    100,85,131,2,90,71,71,0,100,86,100,87,132,0,100,87,
+    101,71,131,3,90,72,71,0,100,88,100,89,132,0,100,89,
+    131,2,90,73,71,0,100,90,100,91,132,0,100,91,101,73,
+    101,72,131,4,90,74,71,0,100,92,100,93,132,0,100,93,
+    101,73,101,71,131,4,90,75,71,0,100,94,100,95,132,0,
+    100,95,101,73,101,71,131,4,90,76,71,0,100,96,100,97,
+    132,0,100,97,131,2,90,77,71,0,100,98,100,99,132,0,
+    100,99,131,2,90,78,71,0,100,100,100,101,132,0,100,101,
+    131,2,90,79,71,0,100,102,100,103,132,0,100,103,131,2,
+    90,80,100,113,100,104,100,105,132,1,90,81,100,106,100,107,
+    132,0,90,82,100,108,100,109,132,0,90,83,100,110,100,111,
+    132,0,90,84,100,1,83,0,41,117,97,94,1,0,0,67,
+    111,114,101,32,105,109,112,108,101,109,101,110,116,97,116,105,
+    111,110,32,111,102,32,112,97,116,104,45,98,97,115,101,100,
+    32,105,109,112,111,114,116,46,10,10,84,104,105,115,32,109,
+    111,100,117,108,101,32,105,115,32,78,79,84,32,109,101,97,
+    110,116,32,116,111,32,98,101,32,100,105,114,101,99,116,108,
+    121,32,105,109,112,111,114,116,101,100,33,32,73,116,32,104,
+    97,115,32,98,101,101,110,32,100,101,115,105,103,110,101,100,
+    32,115,117,99,104,10,116,104,97,116,32,105,116,32,99,97,
+    110,32,98,101,32,98,111,111,116,115,116,114,97,112,112,101,
+    100,32,105,110,116,111,32,80,121,116,104,111,110,32,97,115,
+    32,116,104,101,32,105,109,112,108,101,109,101,110,116,97,116,
+    105,111,110,32,111,102,32,105,109,112,111,114,116,46,32,65,
+    115,10,115,117,99,104,32,105,116,32,114,101,113,117,105,114,
+    101,115,32,116,104,101,32,105,110,106,101,99,116,105,111,110,
+    32,111,102,32,115,112,101,99,105,102,105,99,32,109,111,100,
+    117,108,101,115,32,97,110,100,32,97,116,116,114,105,98,117,
+    116,101,115,32,105,110,32,111,114,100,101,114,32,116,111,10,
+    119,111,114,107,46,32,79,110,101,32,115,104,111,117,108,100,
+    32,117,115,101,32,105,109,112,111,114,116,108,105,98,32,97,
+    115,32,116,104,101,32,112,117,98,108,105,99,45,102,97,99,
+    105,110,103,32,118,101,114,115,105,111,110,32,111,102,32,116,
+    104,105,115,32,109,111,100,117,108,101,46,10,10,78,233,0,
+    0,0,0,90,5,119,105,110,51,50,250,1,92,250,1,47,
     99,1,0,0,0,0,0,0,0,0,0,0,0,2,0,0,
-    0,8,0,0,0,67,0,0,0,115,50,0,0,0,122,14,
-    116,0,124,0,131,1,106,1,125,1,87,0,110,22,4,0,
-    116,2,121,36,1,0,1,0,1,0,100,1,125,1,89,0,
-    110,2,48,0,124,1,100,2,79,0,125,1,124,1,83,0,
+    0,3,0,0,0,99,0,0,0,115,28,0,0,0,129,0,
+    124,0,93,9,125,1,116,0,124,1,131,1,100,0,107,2,
+    86,0,1,0,113,2,100,1,83,0,41,2,233,1,0,0,
+    0,78,41,1,218,3,108,101,110,41,2,218,2,46,48,218,
+    3,115,101,112,169,0,114,7,0,0,0,250,38,60,102,114,
+    111,122,101,110,32,105,109,112,111,114,116,108,105,98,46,95,
+    98,111,111,116,115,116,114,97,112,95,101,120,116,101,114,110,
+    97,108,62,218,9,60,103,101,110,101,120,112,114,62,46,0,
+    0,0,115,4,0,0,0,2,128,26,0,114,9,0,0,0,
+    218,0,99,1,0,0,0,0,0,0,0,0,0,0,0,2,
+    0,0,0,4,0,0,0,67,0,0,0,115,22,0,0,0,
+    104,0,124,0,93,7,125,1,100,0,124,1,155,0,157,2,
+    146,2,113,2,83,0,41,1,250,1,58,114,7,0,0,0,
+    41,2,114,5,0,0,0,218,1,115,114,7,0,0,0,114,
+    7,0,0,0,114,8,0,0,0,218,9,60,115,101,116,99,
+    111,109,112,62,50,0,0,0,115,2,0,0,0,22,0,114,
+    13,0,0,0,41,1,218,3,119,105,110,41,2,90,6,99,
+    121,103,119,105,110,90,6,100,97,114,119,105,110,99,0,0,
+    0,0,0,0,0,0,0,0,0,0,1,0,0,0,3,0,
+    0,0,3,0,0,0,115,62,0,0,0,116,0,106,1,160,
+    2,116,3,161,1,114,25,116,0,106,1,160,2,116,4,161,
+    1,114,15,100,1,137,0,110,2,100,2,137,0,135,0,102,
+    1,100,3,100,4,132,8,125,0,124,0,83,0,100,5,100,
+    4,132,0,125,0,124,0,83,0,41,6,78,90,12,80,89,
+    84,72,79,78,67,65,83,69,79,75,115,12,0,0,0,80,
+    89,84,72,79,78,67,65,83,69,79,75,99,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,
+    19,0,0,0,115,20,0,0,0,116,0,106,1,106,2,12,
+    0,111,9,136,0,116,3,106,4,118,0,83,0,41,1,122,
+    94,84,114,117,101,32,105,102,32,102,105,108,101,110,97,109,
+    101,115,32,109,117,115,116,32,98,101,32,99,104,101,99,107,
+    101,100,32,99,97,115,101,45,105,110,115,101,110,115,105,116,
+    105,118,101,108,121,32,97,110,100,32,105,103,110,111,114,101,
+    32,101,110,118,105,114,111,110,109,101,110,116,32,102,108,97,
+    103,115,32,97,114,101,32,110,111,116,32,115,101,116,46,41,
+    5,218,3,115,121,115,218,5,102,108,97,103,115,218,18,105,
+    103,110,111,114,101,95,101,110,118,105,114,111,110,109,101,110,
+    116,218,3,95,111,115,90,7,101,110,118,105,114,111,110,114,
+    7,0,0,0,169,1,218,3,107,101,121,114,7,0,0,0,
+    114,8,0,0,0,218,11,95,114,101,108,97,120,95,99,97,
+    115,101,67,0,0,0,243,2,0,0,0,20,2,122,37,95,
+    109,97,107,101,95,114,101,108,97,120,95,99,97,115,101,46,
+    60,108,111,99,97,108,115,62,46,95,114,101,108,97,120,95,
+    99,97,115,101,99,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,1,0,0,0,83,0,0,0,243,4,0,
+    0,0,100,1,83,0,41,2,122,53,84,114,117,101,32,105,
+    102,32,102,105,108,101,110,97,109,101,115,32,109,117,115,116,
+    32,98,101,32,99,104,101,99,107,101,100,32,99,97,115,101,
+    45,105,110,115,101,110,115,105,116,105,118,101,108,121,46,70,
+    114,7,0,0,0,114,7,0,0,0,114,7,0,0,0,114,
+    7,0,0,0,114,8,0,0,0,114,21,0,0,0,71,0,
+    0,0,243,2,0,0,0,4,2,41,5,114,15,0,0,0,
+    218,8,112,108,97,116,102,111,114,109,218,10,115,116,97,114,
+    116,115,119,105,116,104,218,27,95,67,65,83,69,95,73,78,
+    83,69,78,83,73,84,73,86,69,95,80,76,65,84,70,79,
+    82,77,83,218,35,95,67,65,83,69,95,73,78,83,69,78,
+    83,73,84,73,86,69,95,80,76,65,84,70,79,82,77,83,
+    95,83,84,82,95,75,69,89,41,1,114,21,0,0,0,114,
+    7,0,0,0,114,19,0,0,0,114,8,0,0,0,218,16,
+    95,109,97,107,101,95,114,101,108,97,120,95,99,97,115,101,
+    60,0,0,0,115,16,0,0,0,12,1,12,1,6,1,4,
+    2,12,2,4,7,8,253,4,3,114,29,0,0,0,99,1,
+    0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,4,
+    0,0,0,67,0,0,0,115,20,0,0,0,116,0,124,0,
+    131,1,100,1,64,0,160,1,100,2,100,3,161,2,83,0,
+    41,4,122,42,67,111,110,118,101,114,116,32,97,32,51,50,
+    45,98,105,116,32,105,110,116,101,103,101,114,32,116,111,32,
+    108,105,116,116,108,101,45,101,110,100,105,97,110,46,236,3,
+    0,0,0,255,127,255,127,3,0,233,4,0,0,0,218,6,
+    108,105,116,116,108,101,41,2,218,3,105,110,116,218,8,116,
+    111,95,98,121,116,101,115,41,1,218,1,120,114,7,0,0,
+    0,114,7,0,0,0,114,8,0,0,0,218,12,95,112,97,
+    99,107,95,117,105,110,116,51,50,79,0,0,0,114,22,0,
+    0,0,114,36,0,0,0,99,1,0,0,0,0,0,0,0,
+    0,0,0,0,1,0,0,0,4,0,0,0,67,0,0,0,
+    243,28,0,0,0,116,0,124,0,131,1,100,1,107,2,115,
+    8,74,0,130,1,116,1,160,2,124,0,100,2,161,2,83,
+    0,41,3,122,47,67,111,110,118,101,114,116,32,52,32,98,
+    121,116,101,115,32,105,110,32,108,105,116,116,108,101,45,101,
+    110,100,105,97,110,32,116,111,32,97,110,32,105,110,116,101,
+    103,101,114,46,114,31,0,0,0,114,32,0,0,0,169,3,
+    114,4,0,0,0,114,33,0,0,0,218,10,102,114,111,109,
+    95,98,121,116,101,115,169,1,218,4,100,97,116,97,114,7,
+    0,0,0,114,7,0,0,0,114,8,0,0,0,218,14,95,
+    117,110,112,97,99,107,95,117,105,110,116,51,50,84,0,0,
+    0,243,4,0,0,0,16,2,12,1,114,42,0,0,0,99,
+    1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,
+    4,0,0,0,67,0,0,0,114,37,0,0,0,41,3,122,
+    47,67,111,110,118,101,114,116,32,50,32,98,121,116,101,115,
+    32,105,110,32,108,105,116,116,108,101,45,101,110,100,105,97,
+    110,32,116,111,32,97,110,32,105,110,116,101,103,101,114,46,
+    233,2,0,0,0,114,32,0,0,0,114,38,0,0,0,114,
+    40,0,0,0,114,7,0,0,0,114,7,0,0,0,114,8,
+    0,0,0,218,14,95,117,110,112,97,99,107,95,117,105,110,
+    116,49,54,89,0,0,0,114,43,0,0,0,114,45,0,0,
+    0,99,0,0,0,0,0,0,0,0,0,0,0,0,5,0,
+    0,0,4,0,0,0,71,0,0,0,115,228,0,0,0,124,
+    0,115,4,100,1,83,0,116,0,124,0,131,1,100,2,107,
+    2,114,14,124,0,100,3,25,0,83,0,100,1,125,1,103,
+    0,125,2,116,1,116,2,106,3,124,0,131,2,68,0,93,
+    61,92,2,125,3,125,4,124,3,160,4,116,5,161,1,115,
+    38,124,3,160,6,116,5,161,1,114,51,124,3,160,7,116,
+    8,161,1,112,44,124,1,125,1,116,9,124,4,23,0,103,
+    1,125,2,113,24,124,3,160,6,100,4,161,1,114,76,124,
+    1,160,10,161,0,124,3,160,10,161,0,107,3,114,70,124,
+    3,125,1,124,4,103,1,125,2,113,24,124,2,160,11,124,
+    4,161,1,1,0,113,24,124,3,112,79,124,1,125,1,124,
+    2,160,11,124,4,161,1,1,0,113,24,100,5,100,6,132,
+    0,124,2,68,0,131,1,125,2,116,0,124,2,131,1,100,
+    2,107,2,114,107,124,2,100,3,25,0,115,107,124,1,116,
+    9,23,0,83,0,124,1,116,9,160,12,124,2,161,1,23,
+    0,83,0,41,7,250,31,82,101,112,108,97,99,101,109,101,
+    110,116,32,102,111,114,32,111,115,46,112,97,116,104,46,106,
+    111,105,110,40,41,46,114,10,0,0,0,114,3,0,0,0,
+    114,0,0,0,0,114,11,0,0,0,99,1,0,0,0,0,
+    0,0,0,0,0,0,0,2,0,0,0,5,0,0,0,83,
+    0,0,0,243,26,0,0,0,103,0,124,0,93,9,125,1,
+    124,1,114,2,124,1,160,0,116,1,161,1,145,2,113,2,
+    83,0,114,7,0,0,0,169,2,218,6,114,115,116,114,105,
+    112,218,15,112,97,116,104,95,115,101,112,97,114,97,116,111,
+    114,115,169,2,114,5,0,0,0,218,1,112,114,7,0,0,
+    0,114,7,0,0,0,114,8,0,0,0,218,10,60,108,105,
+    115,116,99,111,109,112,62,119,0,0,0,115,2,0,0,0,
+    26,0,250,30,95,112,97,116,104,95,106,111,105,110,46,60,
+    108,111,99,97,108,115,62,46,60,108,105,115,116,99,111,109,
+    112,62,41,13,114,4,0,0,0,218,3,109,97,112,114,18,
+    0,0,0,218,15,95,112,97,116,104,95,115,112,108,105,116,
+    114,111,111,116,114,26,0,0,0,218,14,112,97,116,104,95,
+    115,101,112,95,116,117,112,108,101,218,8,101,110,100,115,119,
+    105,116,104,114,49,0,0,0,114,50,0,0,0,218,8,112,
+    97,116,104,95,115,101,112,218,8,99,97,115,101,102,111,108,
+    100,218,6,97,112,112,101,110,100,218,4,106,111,105,110,41,
+    5,218,10,112,97,116,104,95,112,97,114,116,115,218,4,114,
+    111,111,116,218,4,112,97,116,104,90,8,110,101,119,95,114,
+    111,111,116,218,4,116,97,105,108,114,7,0,0,0,114,7,
+    0,0,0,114,8,0,0,0,218,10,95,112,97,116,104,95,
+    106,111,105,110,96,0,0,0,115,42,0,0,0,4,2,4,
+    1,12,1,8,1,4,1,4,1,20,1,20,1,14,1,12,
+    1,10,1,16,1,4,3,8,1,12,2,8,2,12,1,14,
+    1,20,1,8,2,14,1,114,67,0,0,0,99,0,0,0,
+    0,0,0,0,0,0,0,0,0,1,0,0,0,4,0,0,
+    0,71,0,0,0,115,20,0,0,0,116,0,160,1,100,1,
+    100,2,132,0,124,0,68,0,131,1,161,1,83,0,41,3,
+    114,46,0,0,0,99,1,0,0,0,0,0,0,0,0,0,
+    0,0,2,0,0,0,5,0,0,0,83,0,0,0,114,47,
+    0,0,0,114,7,0,0,0,114,48,0,0,0,41,2,114,
+    5,0,0,0,218,4,112,97,114,116,114,7,0,0,0,114,
+    7,0,0,0,114,8,0,0,0,114,53,0,0,0,128,0,
+    0,0,115,6,0,0,0,6,0,4,1,16,255,114,54,0,
+    0,0,41,2,114,59,0,0,0,114,62,0,0,0,41,1,
+    114,63,0,0,0,114,7,0,0,0,114,7,0,0,0,114,
+    8,0,0,0,114,67,0,0,0,126,0,0,0,115,6,0,
+    0,0,10,2,2,1,8,255,99,1,0,0,0,0,0,0,
+    0,0,0,0,0,2,0,0,0,4,0,0,0,3,0,0,
+    0,115,66,0,0,0,116,0,135,0,102,1,100,1,100,2,
+    132,8,116,1,68,0,131,1,131,1,125,1,124,1,100,3,
+    107,0,114,19,100,4,136,0,102,2,83,0,136,0,100,5,
+    124,1,133,2,25,0,136,0,124,1,100,6,23,0,100,5,
+    133,2,25,0,102,2,83,0,41,7,122,32,82,101,112,108,
+    97,99,101,109,101,110,116,32,102,111,114,32,111,115,46,112,
+    97,116,104,46,115,112,108,105,116,40,41,46,99,1,0,0,
+    0,0,0,0,0,0,0,0,0,2,0,0,0,4,0,0,
+    0,51,0,0,0,115,26,0,0,0,129,0,124,0,93,8,
+    125,1,136,0,160,0,124,1,161,1,86,0,1,0,113,2,
+    100,0,83,0,169,1,78,41,1,218,5,114,102,105,110,100,
+    114,51,0,0,0,169,1,114,65,0,0,0,114,7,0,0,
+    0,114,8,0,0,0,114,9,0,0,0,134,0,0,0,115,
+    4,0,0,0,2,128,24,0,122,30,95,112,97,116,104,95,
+    115,112,108,105,116,46,60,108,111,99,97,108,115,62,46,60,
+    103,101,110,101,120,112,114,62,114,0,0,0,0,114,10,0,
+    0,0,78,114,3,0,0,0,41,2,218,3,109,97,120,114,
+    50,0,0,0,41,2,114,65,0,0,0,218,1,105,114,7,
+    0,0,0,114,71,0,0,0,114,8,0,0,0,218,11,95,
+    112,97,116,104,95,115,112,108,105,116,132,0,0,0,115,8,
+    0,0,0,22,2,8,1,8,1,28,1,114,74,0,0,0,
+    99,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,
+    0,3,0,0,0,67,0,0,0,115,10,0,0,0,116,0,
+    160,1,124,0,161,1,83,0,41,1,122,126,83,116,97,116,
+    32,116,104,101,32,112,97,116,104,46,10,10,32,32,32,32,
+    77,97,100,101,32,97,32,115,101,112,97,114,97,116,101,32,
+    102,117,110,99,116,105,111,110,32,116,111,32,109,97,107,101,
+    32,105,116,32,101,97,115,105,101,114,32,116,111,32,111,118,
+    101,114,114,105,100,101,32,105,110,32,101,120,112,101,114,105,
+    109,101,110,116,115,10,32,32,32,32,40,101,46,103,46,32,
+    99,97,99,104,101,32,115,116,97,116,32,114,101,115,117,108,
+    116,115,41,46,10,10,32,32,32,32,41,2,114,18,0,0,
+    0,90,4,115,116,97,116,114,71,0,0,0,114,7,0,0,
+    0,114,7,0,0,0,114,8,0,0,0,218,10,95,112,97,
+    116,104,95,115,116,97,116,140,0,0,0,115,2,0,0,0,
+    10,7,114,75,0,0,0,99,2,0,0,0,0,0,0,0,
+    0,0,0,0,3,0,0,0,8,0,0,0,67,0,0,0,
+    115,48,0,0,0,122,6,116,0,124,0,131,1,125,2,87,
+    0,110,10,4,0,116,1,121,16,1,0,1,0,1,0,89,
+    0,100,1,83,0,119,0,124,2,106,2,100,2,64,0,124,
+    1,107,2,83,0,41,3,122,49,84,101,115,116,32,119,104,
+    101,116,104,101,114,32,116,104,101,32,112,97,116,104,32,105,
+    115,32,116,104,101,32,115,112,101,99,105,102,105,101,100,32,
+    109,111,100,101,32,116,121,112,101,46,70,105,0,240,0,0,
+    41,3,114,75,0,0,0,218,7,79,83,69,114,114,111,114,
+    218,7,115,116,95,109,111,100,101,41,3,114,65,0,0,0,
+    218,4,109,111,100,101,90,9,115,116,97,116,95,105,110,102,
+    111,114,7,0,0,0,114,7,0,0,0,114,8,0,0,0,
+    218,18,95,112,97,116,104,95,105,115,95,109,111,100,101,95,
+    116,121,112,101,150,0,0,0,115,12,0,0,0,2,2,12,
+    1,12,1,6,1,2,255,14,2,114,79,0,0,0,99,1,
+    0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,3,
+    0,0,0,67,0,0,0,115,10,0,0,0,116,0,124,0,
+    100,1,131,2,83,0,41,2,122,31,82,101,112,108,97,99,
+    101,109,101,110,116,32,102,111,114,32,111,115,46,112,97,116,
+    104,46,105,115,102,105,108,101,46,105,0,128,0,0,41,1,
+    114,79,0,0,0,114,71,0,0,0,114,7,0,0,0,114,
+    7,0,0,0,114,8,0,0,0,218,12,95,112,97,116,104,
+    95,105,115,102,105,108,101,159,0,0,0,243,2,0,0,0,
+    10,2,114,80,0,0,0,99,1,0,0,0,0,0,0,0,
+    0,0,0,0,1,0,0,0,3,0,0,0,67,0,0,0,
+    115,22,0,0,0,124,0,115,6,116,0,160,1,161,0,125,
+    0,116,2,124,0,100,1,131,2,83,0,41,2,122,30,82,
+    101,112,108,97,99,101,109,101,110,116,32,102,111,114,32,111,
+    115,46,112,97,116,104,46,105,115,100,105,114,46,105,0,64,
+    0,0,41,3,114,18,0,0,0,218,6,103,101,116,99,119,
+    100,114,79,0,0,0,114,71,0,0,0,114,7,0,0,0,
+    114,7,0,0,0,114,8,0,0,0,218,11,95,112,97,116,
+    104,95,105,115,100,105,114,164,0,0,0,115,6,0,0,0,
+    4,2,8,1,10,1,114,83,0,0,0,99,1,0,0,0,
+    0,0,0,0,0,0,0,0,2,0,0,0,4,0,0,0,
+    67,0,0,0,115,62,0,0,0,124,0,115,4,100,1,83,
+    0,116,0,160,1,124,0,161,1,100,2,25,0,160,2,100,
+    3,100,4,161,2,125,1,116,3,124,1,131,1,100,5,107,
+    4,111,30,124,1,160,4,100,6,161,1,112,30,124,1,160,
+    5,100,4,161,1,83,0,41,7,250,30,82,101,112,108,97,
+    99,101,109,101,110,116,32,102,111,114,32,111,115,46,112,97,
+    116,104,46,105,115,97,98,115,46,70,114,0,0,0,0,114,
+    2,0,0,0,114,1,0,0,0,114,3,0,0,0,122,2,
+    92,92,41,6,114,18,0,0,0,114,56,0,0,0,218,7,
+    114,101,112,108,97,99,101,114,4,0,0,0,114,26,0,0,
+    0,114,58,0,0,0,41,2,114,65,0,0,0,114,64,0,
+    0,0,114,7,0,0,0,114,7,0,0,0,114,8,0,0,
+    0,218,11,95,112,97,116,104,95,105,115,97,98,115,172,0,
+    0,0,115,8,0,0,0,4,2,4,1,22,1,32,1,114,
+    86,0,0,0,99,1,0,0,0,0,0,0,0,0,0,0,
+    0,1,0,0,0,3,0,0,0,67,0,0,0,115,10,0,
+    0,0,124,0,160,0,116,1,161,1,83,0,41,1,114,84,
+    0,0,0,41,2,114,26,0,0,0,114,50,0,0,0,114,
+    71,0,0,0,114,7,0,0,0,114,7,0,0,0,114,8,
+    0,0,0,114,86,0,0,0,180,0,0,0,114,81,0,0,
+    0,233,182,1,0,0,99,3,0,0,0,0,0,0,0,0,
+    0,0,0,6,0,0,0,11,0,0,0,67,0,0,0,115,
+    170,0,0,0,100,1,160,0,124,0,116,1,124,0,131,1,
+    161,2,125,3,116,2,160,3,124,3,116,2,106,4,116,2,
+    106,5,66,0,116,2,106,6,66,0,124,2,100,2,64,0,
+    161,3,125,4,122,36,116,7,160,8,124,4,100,3,161,2,
+    143,13,125,5,124,5,160,9,124,1,161,1,1,0,87,0,
+    100,4,4,0,4,0,131,3,1,0,110,8,49,0,115,47,
+    119,1,1,0,1,0,1,0,89,0,1,0,116,2,160,10,
+    124,3,124,0,161,2,1,0,87,0,100,4,83,0,4,0,
+    116,11,121,84,1,0,1,0,1,0,122,7,116,2,160,12,
+    124,3,161,1,1,0,87,0,130,0,4,0,116,11,121,83,
+    1,0,1,0,1,0,89,0,130,0,119,0,119,0,41,5,
+    122,162,66,101,115,116,45,101,102,102,111,114,116,32,102,117,
+    110,99,116,105,111,110,32,116,111,32,119,114,105,116,101,32,
+    100,97,116,97,32,116,111,32,97,32,112,97,116,104,32,97,
+    116,111,109,105,99,97,108,108,121,46,10,32,32,32,32,66,
+    101,32,112,114,101,112,97,114,101,100,32,116,111,32,104,97,
+    110,100,108,101,32,97,32,70,105,108,101,69,120,105,115,116,
+    115,69,114,114,111,114,32,105,102,32,99,111,110,99,117,114,
+    114,101,110,116,32,119,114,105,116,105,110,103,32,111,102,32,
+    116,104,101,10,32,32,32,32,116,101,109,112,111,114,97,114,
+    121,32,102,105,108,101,32,105,115,32,97,116,116,101,109,112,
+    116,101,100,46,250,5,123,125,46,123,125,114,87,0,0,0,
+    90,2,119,98,78,41,13,218,6,102,111,114,109,97,116,218,
+    2,105,100,114,18,0,0,0,90,4,111,112,101,110,90,6,
+    79,95,69,88,67,76,90,7,79,95,67,82,69,65,84,90,
+    8,79,95,87,82,79,78,76,89,218,3,95,105,111,218,6,
+    70,105,108,101,73,79,218,5,119,114,105,116,101,114,85,0,
+    0,0,114,76,0,0,0,90,6,117,110,108,105,110,107,41,
+    6,114,65,0,0,0,114,41,0,0,0,114,78,0,0,0,
+    90,8,112,97,116,104,95,116,109,112,90,2,102,100,218,4,
+    102,105,108,101,114,7,0,0,0,114,7,0,0,0,114,8,
+    0,0,0,218,13,95,119,114,105,116,101,95,97,116,111,109,
+    105,99,185,0,0,0,115,36,0,0,0,16,5,6,1,22,
+    1,4,255,2,2,14,3,12,1,28,255,18,2,12,1,2,
+    1,12,1,2,3,12,254,2,1,2,1,2,254,2,253,114,
+    95,0,0,0,105,111,13,0,0,114,44,0,0,0,114,32,
+    0,0,0,115,2,0,0,0,13,10,90,11,95,95,112,121,
+    99,97,99,104,101,95,95,122,4,111,112,116,45,122,3,46,
+    112,121,122,4,46,112,121,119,122,4,46,112,121,99,41,1,
+    218,12,111,112,116,105,109,105,122,97,116,105,111,110,99,2,
+    0,0,0,0,0,0,0,1,0,0,0,12,0,0,0,5,
+    0,0,0,67,0,0,0,115,80,1,0,0,124,1,100,1,
+    117,1,114,26,116,0,160,1,100,2,116,2,161,2,1,0,
+    124,2,100,1,117,1,114,20,100,3,125,3,116,3,124,3,
+    131,1,130,1,124,1,114,24,100,4,110,1,100,5,125,2,
+    116,4,160,5,124,0,161,1,125,0,116,6,124,0,131,1,
+    92,2,125,4,125,5,124,5,160,7,100,6,161,1,92,3,
+    125,6,125,7,125,8,116,8,106,9,106,10,125,9,124,9,
+    100,1,117,0,114,57,116,11,100,7,131,1,130,1,100,4,
+    160,12,124,6,114,63,124,6,110,1,124,8,124,7,124,9,
+    103,3,161,1,125,10,124,2,100,1,117,0,114,86,116,8,
+    106,13,106,14,100,8,107,2,114,82,100,4,125,2,110,4,
+    116,8,106,13,106,14,125,2,116,15,124,2,131,1,125,2,
+    124,2,100,4,107,3,114,112,124,2,160,16,161,0,115,105,
+    116,17,100,9,160,18,124,2,161,1,131,1,130,1,100,10,
+    160,18,124,10,116,19,124,2,161,3,125,10,124,10,116,20,
+    100,8,25,0,23,0,125,11,116,8,106,21,100,1,117,1,
+    114,162,116,22,124,4,131,1,115,134,116,23,116,4,160,24,
+    161,0,124,4,131,2,125,4,124,4,100,5,25,0,100,11,
+    107,2,114,152,124,4,100,8,25,0,116,25,118,1,114,152,
+    124,4,100,12,100,1,133,2,25,0,125,4,116,23,116,8,
+    106,21,124,4,160,26,116,25,161,1,124,11,131,3,83,0,
+    116,23,124,4,116,27,124,11,131,3,83,0,41,13,97,254,
+    2,0,0,71,105,118,101,110,32,116,104,101,32,112,97,116,
+    104,32,116,111,32,97,32,46,112,121,32,102,105,108,101,44,
+    32,114,101,116,117,114,110,32,116,104,101,32,112,97,116,104,
+    32,116,111,32,105,116,115,32,46,112,121,99,32,102,105,108,
+    101,46,10,10,32,32,32,32,84,104,101,32,46,112,121,32,
+    102,105,108,101,32,100,111,101,115,32,110,111,116,32,110,101,
+    101,100,32,116,111,32,101,120,105,115,116,59,32,116,104,105,
+    115,32,115,105,109,112,108,121,32,114,101,116,117,114,110,115,
+    32,116,104,101,32,112,97,116,104,32,116,111,32,116,104,101,
+    10,32,32,32,32,46,112,121,99,32,102,105,108,101,32,99,
+    97,108,99,117,108,97,116,101,100,32,97,115,32,105,102,32,
+    116,104,101,32,46,112,121,32,102,105,108,101,32,119,101,114,
+    101,32,105,109,112,111,114,116,101,100,46,10,10,32,32,32,
+    32,84,104,101,32,39,111,112,116,105,109,105,122,97,116,105,
+    111,110,39,32,112,97,114,97,109,101,116,101,114,32,99,111,
+    110,116,114,111,108,115,32,116,104,101,32,112,114,101,115,117,
+    109,101,100,32,111,112,116,105,109,105,122,97,116,105,111,110,
+    32,108,101,118,101,108,32,111,102,10,32,32,32,32,116,104,
+    101,32,98,121,116,101,99,111,100,101,32,102,105,108,101,46,
+    32,73,102,32,39,111,112,116,105,109,105,122,97,116,105,111,
+    110,39,32,105,115,32,110,111,116,32,78,111,110,101,44,32,
+    116,104,101,32,115,116,114,105,110,103,32,114,101,112,114,101,
+    115,101,110,116,97,116,105,111,110,10,32,32,32,32,111,102,
+    32,116,104,101,32,97,114,103,117,109,101,110,116,32,105,115,
+    32,116,97,107,101,110,32,97,110,100,32,118,101,114,105,102,
+    105,101,100,32,116,111,32,98,101,32,97,108,112,104,97,110,
+    117,109,101,114,105,99,32,40,101,108,115,101,32,86,97,108,
+    117,101,69,114,114,111,114,10,32,32,32,32,105,115,32,114,
+    97,105,115,101,100,41,46,10,10,32,32,32,32,84,104,101,
+    32,100,101,98,117,103,95,111,118,101,114,114,105,100,101,32,
+    112,97,114,97,109,101,116,101,114,32,105,115,32,100,101,112,
+    114,101,99,97,116,101,100,46,32,73,102,32,100,101,98,117,
+    103,95,111,118,101,114,114,105,100,101,32,105,115,32,110,111,
+    116,32,78,111,110,101,44,10,32,32,32,32,97,32,84,114,
+    117,101,32,118,97,108,117,101,32,105,115,32,116,104,101,32,
+    115,97,109,101,32,97,115,32,115,101,116,116,105,110,103,32,
+    39,111,112,116,105,109,105,122,97,116,105,111,110,39,32,116,
+    111,32,116,104,101,32,101,109,112,116,121,32,115,116,114,105,
+    110,103,10,32,32,32,32,119,104,105,108,101,32,97,32,70,
+    97,108,115,101,32,118,97,108,117,101,32,105,115,32,101,113,
+    117,105,118,97,108,101,110,116,32,116,111,32,115,101,116,116,
+    105,110,103,32,39,111,112,116,105,109,105,122,97,116,105,111,
+    110,39,32,116,111,32,39,49,39,46,10,10,32,32,32,32,
+    73,102,32,115,121,115,46,105,109,112,108,101,109,101,110,116,
+    97,116,105,111,110,46,99,97,99,104,101,95,116,97,103,32,
+    105,115,32,78,111,110,101,32,116,104,101,110,32,78,111,116,
+    73,109,112,108,101,109,101,110,116,101,100,69,114,114,111,114,
+    32,105,115,32,114,97,105,115,101,100,46,10,10,32,32,32,
+    32,78,122,70,116,104,101,32,100,101,98,117,103,95,111,118,
+    101,114,114,105,100,101,32,112,97,114,97,109,101,116,101,114,
+    32,105,115,32,100,101,112,114,101,99,97,116,101,100,59,32,
+    117,115,101,32,39,111,112,116,105,109,105,122,97,116,105,111,
+    110,39,32,105,110,115,116,101,97,100,122,50,100,101,98,117,
+    103,95,111,118,101,114,114,105,100,101,32,111,114,32,111,112,
+    116,105,109,105,122,97,116,105,111,110,32,109,117,115,116,32,
+    98,101,32,115,101,116,32,116,111,32,78,111,110,101,114,10,
+    0,0,0,114,3,0,0,0,218,1,46,250,36,115,121,115,
+    46,105,109,112,108,101,109,101,110,116,97,116,105,111,110,46,
+    99,97,99,104,101,95,116,97,103,32,105,115,32,78,111,110,
+    101,114,0,0,0,0,122,24,123,33,114,125,32,105,115,32,
+    110,111,116,32,97,108,112,104,97,110,117,109,101,114,105,99,
+    122,7,123,125,46,123,125,123,125,114,11,0,0,0,114,44,
+    0,0,0,41,28,218,9,95,119,97,114,110,105,110,103,115,
+    218,4,119,97,114,110,218,18,68,101,112,114,101,99,97,116,
+    105,111,110,87,97,114,110,105,110,103,218,9,84,121,112,101,
+    69,114,114,111,114,114,18,0,0,0,218,6,102,115,112,97,
+    116,104,114,74,0,0,0,218,10,114,112,97,114,116,105,116,
+    105,111,110,114,15,0,0,0,218,14,105,109,112,108,101,109,
+    101,110,116,97,116,105,111,110,218,9,99,97,99,104,101,95,
+    116,97,103,218,19,78,111,116,73,109,112,108,101,109,101,110,
+    116,101,100,69,114,114,111,114,114,62,0,0,0,114,16,0,
+    0,0,218,8,111,112,116,105,109,105,122,101,218,3,115,116,
+    114,218,7,105,115,97,108,110,117,109,218,10,86,97,108,117,
+    101,69,114,114,111,114,114,89,0,0,0,218,4,95,79,80,
+    84,218,17,66,89,84,69,67,79,68,69,95,83,85,70,70,
+    73,88,69,83,218,14,112,121,99,97,99,104,101,95,112,114,
+    101,102,105,120,114,86,0,0,0,114,67,0,0,0,114,82,
+    0,0,0,114,50,0,0,0,218,6,108,115,116,114,105,112,
+    218,8,95,80,89,67,65,67,72,69,41,12,114,65,0,0,
+    0,90,14,100,101,98,117,103,95,111,118,101,114,114,105,100,
+    101,114,96,0,0,0,218,7,109,101,115,115,97,103,101,218,
+    4,104,101,97,100,114,66,0,0,0,90,4,98,97,115,101,
+    114,6,0,0,0,218,4,114,101,115,116,90,3,116,97,103,
+    90,15,97,108,109,111,115,116,95,102,105,108,101,110,97,109,
+    101,218,8,102,105,108,101,110,97,109,101,114,7,0,0,0,
+    114,7,0,0,0,114,8,0,0,0,218,17,99,97,99,104,
+    101,95,102,114,111,109,95,115,111,117,114,99,101,124,1,0,
+    0,115,72,0,0,0,8,18,6,1,2,1,4,255,8,2,
+    4,1,8,1,12,1,10,1,12,1,16,1,8,1,8,1,
+    8,1,24,1,8,1,12,1,6,1,8,2,8,1,8,1,
+    8,1,14,1,14,1,12,1,10,1,8,9,14,1,24,5,
+    12,1,2,4,4,1,8,1,2,1,4,253,12,5,114,121,
+    0,0,0,99,1,0,0,0,0,0,0,0,0,0,0,0,
+    10,0,0,0,5,0,0,0,67,0,0,0,115,40,1,0,
+    0,116,0,106,1,106,2,100,1,117,0,114,10,116,3,100,
+    2,131,1,130,1,116,4,160,5,124,0,161,1,125,0,116,
+    6,124,0,131,1,92,2,125,1,125,2,100,3,125,3,116,
+    0,106,7,100,1,117,1,114,51,116,0,106,7,160,8,116,
+    9,161,1,125,4,124,1,160,10,124,4,116,11,23,0,161,
+    1,114,51,124,1,116,12,124,4,131,1,100,1,133,2,25,
+    0,125,1,100,4,125,3,124,3,115,72,116,6,124,1,131,
+    1,92,2,125,1,125,5,124,5,116,13,107,3,114,72,116,
+    14,116,13,155,0,100,5,124,0,155,2,157,3,131,1,130,
+    1,124,2,160,15,100,6,161,1,125,6,124,6,100,7,118,
+    1,114,88,116,14,100,8,124,2,155,2,157,2,131,1,130,
+    1,124,6,100,9,107,2,114,132,124,2,160,16,100,6,100,
+    10,161,2,100,11,25,0,125,7,124,7,160,10,116,17,161,
+    1,115,112,116,14,100,12,116,17,155,2,157,2,131,1,130,
+    1,124,7,116,12,116,17,131,1,100,1,133,2,25,0,125,
+    8,124,8,160,18,161,0,115,132,116,14,100,13,124,7,155,
+    2,100,14,157,3,131,1,130,1,124,2,160,19,100,6,161,
+    1,100,15,25,0,125,9,116,20,124,1,124,9,116,21,100,
+    15,25,0,23,0,131,2,83,0,41,16,97,110,1,0,0,
+    71,105,118,101,110,32,116,104,101,32,112,97,116,104,32,116,
+    111,32,97,32,46,112,121,99,46,32,102,105,108,101,44,32,
+    114,101,116,117,114,110,32,116,104,101,32,112,97,116,104,32,
+    116,111,32,105,116,115,32,46,112,121,32,102,105,108,101,46,
+    10,10,32,32,32,32,84,104,101,32,46,112,121,99,32,102,
+    105,108,101,32,100,111,101,115,32,110,111,116,32,110,101,101,
+    100,32,116,111,32,101,120,105,115,116,59,32,116,104,105,115,
+    32,115,105,109,112,108,121,32,114,101,116,117,114,110,115,32,
+    116,104,101,32,112,97,116,104,32,116,111,10,32,32,32,32,
+    116,104,101,32,46,112,121,32,102,105,108,101,32,99,97,108,
+    99,117,108,97,116,101,100,32,116,111,32,99,111,114,114,101,
+    115,112,111,110,100,32,116,111,32,116,104,101,32,46,112,121,
+    99,32,102,105,108,101,46,32,32,73,102,32,112,97,116,104,
+    32,100,111,101,115,10,32,32,32,32,110,111,116,32,99,111,
+    110,102,111,114,109,32,116,111,32,80,69,80,32,51,49,52,
+    55,47,52,56,56,32,102,111,114,109,97,116,44,32,86,97,
+    108,117,101,69,114,114,111,114,32,119,105,108,108,32,98,101,
+    32,114,97,105,115,101,100,46,32,73,102,10,32,32,32,32,
+    115,121,115,46,105,109,112,108,101,109,101,110,116,97,116,105,
+    111,110,46,99,97,99,104,101,95,116,97,103,32,105,115,32,
+    78,111,110,101,32,116,104,101,110,32,78,111,116,73,109,112,
+    108,101,109,101,110,116,101,100,69,114,114,111,114,32,105,115,
+    32,114,97,105,115,101,100,46,10,10,32,32,32,32,78,114,
+    98,0,0,0,70,84,122,31,32,110,111,116,32,98,111,116,
+    116,111,109,45,108,101,118,101,108,32,100,105,114,101,99,116,
+    111,114,121,32,105,110,32,114,97,0,0,0,62,2,0,0,
+    0,114,44,0,0,0,233,3,0,0,0,122,29,101,120,112,
+    101,99,116,101,100,32,111,110,108,121,32,50,32,111,114,32,
+    51,32,100,111,116,115,32,105,110,32,114,122,0,0,0,114,
+    44,0,0,0,233,254,255,255,255,122,53,111,112,116,105,109,
+    105,122,97,116,105,111,110,32,112,111,114,116,105,111,110,32,
+    111,102,32,102,105,108,101,110,97,109,101,32,100,111,101,115,
+    32,110,111,116,32,115,116,97,114,116,32,119,105,116,104,32,
+    122,19,111,112,116,105,109,105,122,97,116,105,111,110,32,108,
+    101,118,101,108,32,122,29,32,105,115,32,110,111,116,32,97,
+    110,32,97,108,112,104,97,110,117,109,101,114,105,99,32,118,
+    97,108,117,101,114,0,0,0,0,41,22,114,15,0,0,0,
+    114,105,0,0,0,114,106,0,0,0,114,107,0,0,0,114,
+    18,0,0,0,114,103,0,0,0,114,74,0,0,0,114,114,
+    0,0,0,114,49,0,0,0,114,50,0,0,0,114,26,0,
+    0,0,114,59,0,0,0,114,4,0,0,0,114,116,0,0,
+    0,114,111,0,0,0,218,5,99,111,117,110,116,218,6,114,
+    115,112,108,105,116,114,112,0,0,0,114,110,0,0,0,218,
+    9,112,97,114,116,105,116,105,111,110,114,67,0,0,0,218,
+    15,83,79,85,82,67,69,95,83,85,70,70,73,88,69,83,
+    41,10,114,65,0,0,0,114,118,0,0,0,90,16,112,121,
+    99,97,99,104,101,95,102,105,108,101,110,97,109,101,90,23,
+    102,111,117,110,100,95,105,110,95,112,121,99,97,99,104,101,
+    95,112,114,101,102,105,120,90,13,115,116,114,105,112,112,101,
+    100,95,112,97,116,104,90,7,112,121,99,97,99,104,101,90,
+    9,100,111,116,95,99,111,117,110,116,114,96,0,0,0,90,
+    9,111,112,116,95,108,101,118,101,108,90,13,98,97,115,101,
+    95,102,105,108,101,110,97,109,101,114,7,0,0,0,114,7,
+    0,0,0,114,8,0,0,0,218,17,115,111,117,114,99,101,
+    95,102,114,111,109,95,99,97,99,104,101,195,1,0,0,115,
+    60,0,0,0,12,9,8,1,10,1,12,1,4,1,10,1,
+    12,1,14,1,16,1,4,1,4,1,12,1,8,1,8,1,
+    2,1,8,255,10,2,8,1,14,1,8,1,16,1,10,1,
+    4,1,2,1,8,255,16,2,8,1,16,1,14,2,18,1,
+    114,128,0,0,0,99,1,0,0,0,0,0,0,0,0,0,
+    0,0,5,0,0,0,9,0,0,0,67,0,0,0,115,124,
+    0,0,0,116,0,124,0,131,1,100,1,107,2,114,8,100,
+    2,83,0,124,0,160,1,100,3,161,1,92,3,125,1,125,
+    2,125,3,124,1,114,28,124,3,160,2,161,0,100,4,100,
+    5,133,2,25,0,100,6,107,3,114,30,124,0,83,0,122,
+    6,116,3,124,0,131,1,125,4,87,0,110,17,4,0,116,
+    4,116,5,102,2,121,53,1,0,1,0,1,0,124,0,100,
+    2,100,5,133,2,25,0,125,4,89,0,110,1,119,0,116,
+    6,124,4,131,1,114,60,124,4,83,0,124,0,83,0,41,
+    7,122,188,67,111,110,118,101,114,116,32,97,32,98,121,116,
+    101,99,111,100,101,32,102,105,108,101,32,112,97,116,104,32,
+    116,111,32,97,32,115,111,117,114,99,101,32,112,97,116,104,
+    32,40,105,102,32,112,111,115,115,105,98,108,101,41,46,10,
+    10,32,32,32,32,84,104,105,115,32,102,117,110,99,116,105,
+    111,110,32,101,120,105,115,116,115,32,112,117,114,101,108,121,
+    32,102,111,114,32,98,97,99,107,119,97,114,100,115,45,99,
+    111,109,112,97,116,105,98,105,108,105,116,121,32,102,111,114,
+    10,32,32,32,32,80,121,73,109,112,111,114,116,95,69,120,
+    101,99,67,111,100,101,77,111,100,117,108,101,87,105,116,104,
+    70,105,108,101,110,97,109,101,115,40,41,32,105,110,32,116,
+    104,101,32,67,32,65,80,73,46,10,10,32,32,32,32,114,
+    0,0,0,0,78,114,97,0,0,0,233,253,255,255,255,233,
+    255,255,255,255,90,2,112,121,41,7,114,4,0,0,0,114,
+    104,0,0,0,218,5,108,111,119,101,114,114,128,0,0,0,
+    114,107,0,0,0,114,111,0,0,0,114,80,0,0,0,41,
+    5,218,13,98,121,116,101,99,111,100,101,95,112,97,116,104,
+    114,119,0,0,0,218,1,95,90,9,101,120,116,101,110,115,
+    105,111,110,218,11,115,111,117,114,99,101,95,112,97,116,104,
+    114,7,0,0,0,114,7,0,0,0,114,8,0,0,0,218,
+    15,95,103,101,116,95,115,111,117,114,99,101,102,105,108,101,
+    235,1,0,0,115,22,0,0,0,12,7,4,1,16,1,24,
+    1,4,1,2,1,12,1,16,1,16,1,2,255,16,2,114,
+    135,0,0,0,99,1,0,0,0,0,0,0,0,0,0,0,
+    0,1,0,0,0,8,0,0,0,67,0,0,0,115,68,0,
+    0,0,124,0,160,0,116,1,116,2,131,1,161,1,114,23,
+    122,5,116,3,124,0,131,1,87,0,83,0,4,0,116,4,
+    121,22,1,0,1,0,1,0,89,0,100,0,83,0,119,0,
+    124,0,160,0,116,1,116,5,131,1,161,1,114,32,124,0,
+    83,0,100,0,83,0,114,69,0,0,0,41,6,114,58,0,
+    0,0,218,5,116,117,112,108,101,114,127,0,0,0,114,121,
+    0,0,0,114,107,0,0,0,114,113,0,0,0,41,1,114,
+    120,0,0,0,114,7,0,0,0,114,7,0,0,0,114,8,
+    0,0,0,218,11,95,103,101,116,95,99,97,99,104,101,100,
+    254,1,0,0,115,18,0,0,0,14,1,2,1,10,1,12,
+    1,6,1,2,255,14,2,4,1,4,2,114,137,0,0,0,
+    99,1,0,0,0,0,0,0,0,0,0,0,0,2,0,0,
+    0,8,0,0,0,67,0,0,0,115,50,0,0,0,122,7,
+    116,0,124,0,131,1,106,1,125,1,87,0,110,11,4,0,
+    116,2,121,18,1,0,1,0,1,0,100,1,125,1,89,0,
+    110,1,119,0,124,1,100,2,79,0,125,1,124,1,83,0,
     41,3,122,51,67,97,108,99,117,108,97,116,101,32,116,104,
     101,32,109,111,100,101,32,112,101,114,109,105,115,115,105,111,
     110,115,32,102,111,114,32,97,32,98,121,116,101,99,111,100,
-    101,32,102,105,108,101,46,114,60,0,0,0,233,128,0,0,
-    0,41,3,114,49,0,0,0,114,51,0,0,0,114,50,0,
-    0,0,41,2,114,44,0,0,0,114,52,0,0,0,114,5,
-    0,0,0,114,5,0,0,0,114,8,0,0,0,218,10,95,
-    99,97,108,99,95,109,111,100,101,187,1,0,0,115,12,0,
-    0,0,0,2,2,1,14,1,12,1,10,3,8,1,114,114,
-    0,0,0,99,1,0,0,0,0,0,0,0,0,0,0,0,
-    3,0,0,0,8,0,0,0,3,0,0,0,115,66,0,0,
-    0,100,6,135,0,102,1,100,2,100,3,132,9,125,1,122,
-    10,116,0,106,1,125,2,87,0,110,26,4,0,116,2,121,
-    50,1,0,1,0,1,0,100,4,100,5,132,0,125,2,89,
-    0,110,2,48,0,124,2,124,1,136,0,131,2,1,0,124,
-    1,83,0,41,7,122,252,68,101,99,111,114,97,116,111,114,
-    32,116,111,32,118,101,114,105,102,121,32,116,104,97,116,32,
-    116,104,101,32,109,111,100,117,108,101,32,98,101,105,110,103,
-    32,114,101,113,117,101,115,116,101,100,32,109,97,116,99,104,
-    101,115,32,116,104,101,32,111,110,101,32,116,104,101,10,32,
-    32,32,32,108,111,97,100,101,114,32,99,97,110,32,104,97,
-    110,100,108,101,46,10,10,32,32,32,32,84,104,101,32,102,
-    105,114,115,116,32,97,114,103,117,109,101,110,116,32,40,115,
-    101,108,102,41,32,109,117,115,116,32,100,101,102,105,110,101,
-    32,95,110,97,109,101,32,119,104,105,99,104,32,116,104,101,
-    32,115,101,99,111,110,100,32,97,114,103,117,109,101,110,116,
-    32,105,115,10,32,32,32,32,99,111,109,112,97,114,101,100,
-    32,97,103,97,105,110,115,116,46,32,73,102,32,116,104,101,
-    32,99,111,109,112,97,114,105,115,111,110,32,102,97,105,108,
-    115,32,116,104,101,110,32,73,109,112,111,114,116,69,114,114,
-    111,114,32,105,115,32,114,97,105,115,101,100,46,10,10,32,
-    32,32,32,78,99,2,0,0,0,0,0,0,0,0,0,0,
-    0,4,0,0,0,4,0,0,0,31,0,0,0,115,72,0,
-    0,0,124,1,100,0,117,0,114,16,124,0,106,0,125,1,
-    110,32,124,0,106,0,124,1,107,3,114,48,116,1,100,1,
-    124,0,106,0,124,1,102,2,22,0,124,1,100,2,141,2,
-    130,1,136,0,124,0,124,1,103,2,124,2,162,1,82,0,
-    105,0,124,3,164,1,142,1,83,0,41,3,78,122,30,108,
-    111,97,100,101,114,32,102,111,114,32,37,115,32,99,97,110,
-    110,111,116,32,104,97,110,100,108,101,32,37,115,169,1,218,
-    4,110,97,109,101,41,2,114,116,0,0,0,218,11,73,109,
-    112,111,114,116,69,114,114,111,114,41,4,218,4,115,101,108,
-    102,114,116,0,0,0,218,4,97,114,103,115,218,6,107,119,
-    97,114,103,115,169,1,218,6,109,101,116,104,111,100,114,5,
-    0,0,0,114,8,0,0,0,218,19,95,99,104,101,99,107,
-    95,110,97,109,101,95,119,114,97,112,112,101,114,207,1,0,
-    0,115,18,0,0,0,0,1,8,1,8,1,10,1,4,1,
-    8,255,2,1,2,255,6,2,122,40,95,99,104,101,99,107,
-    95,110,97,109,101,46,60,108,111,99,97,108,115,62,46,95,
-    99,104,101,99,107,95,110,97,109,101,95,119,114,97,112,112,
-    101,114,99,2,0,0,0,0,0,0,0,0,0,0,0,3,
-    0,0,0,7,0,0,0,83,0,0,0,115,56,0,0,0,
-    100,1,68,0,93,32,125,2,116,0,124,1,124,2,131,2,
-    114,4,116,1,124,0,124,2,116,2,124,1,124,2,131,2,
-    131,3,1,0,113,4,124,0,106,3,160,4,124,1,106,3,
-    161,1,1,0,100,0,83,0,41,2,78,41,4,218,10,95,
-    95,109,111,100,117,108,101,95,95,218,8,95,95,110,97,109,
-    101,95,95,218,12,95,95,113,117,97,108,110,97,109,101,95,
-    95,218,7,95,95,100,111,99,95,95,41,5,218,7,104,97,
-    115,97,116,116,114,218,7,115,101,116,97,116,116,114,218,7,
-    103,101,116,97,116,116,114,218,8,95,95,100,105,99,116,95,
-    95,218,6,117,112,100,97,116,101,41,3,90,3,110,101,119,
-    90,3,111,108,100,114,67,0,0,0,114,5,0,0,0,114,
-    5,0,0,0,114,8,0,0,0,218,5,95,119,114,97,112,
-    218,1,0,0,115,8,0,0,0,0,1,8,1,10,1,20,
-    1,122,26,95,99,104,101,99,107,95,110,97,109,101,46,60,
-    108,111,99,97,108,115,62,46,95,119,114,97,112,41,1,78,
-    41,3,218,10,95,98,111,111,116,115,116,114,97,112,114,133,
-    0,0,0,218,9,78,97,109,101,69,114,114,111,114,41,3,
-    114,122,0,0,0,114,123,0,0,0,114,133,0,0,0,114,
-    5,0,0,0,114,121,0,0,0,114,8,0,0,0,218,11,
-    95,99,104,101,99,107,95,110,97,109,101,199,1,0,0,115,
-    14,0,0,0,0,8,14,7,2,1,10,1,12,2,14,5,
-    10,1,114,136,0,0,0,99,2,0,0,0,0,0,0,0,
-    0,0,0,0,5,0,0,0,6,0,0,0,67,0,0,0,
-    115,60,0,0,0,124,0,160,0,124,1,161,1,92,2,125,
-    2,125,3,124,2,100,1,117,0,114,56,116,1,124,3,131,
-    1,114,56,100,2,125,4,116,2,160,3,124,4,160,4,124,
-    3,100,3,25,0,161,1,116,5,161,2,1,0,124,2,83,
-    0,41,4,122,155,84,114,121,32,116,111,32,102,105,110,100,
-    32,97,32,108,111,97,100,101,114,32,102,111,114,32,116,104,
-    101,32,115,112,101,99,105,102,105,101,100,32,109,111,100,117,
-    108,101,32,98,121,32,100,101,108,101,103,97,116,105,110,103,
-    32,116,111,10,32,32,32,32,115,101,108,102,46,102,105,110,
-    100,95,108,111,97,100,101,114,40,41,46,10,10,32,32,32,
-    32,84,104,105,115,32,109,101,116,104,111,100,32,105,115,32,
-    100,101,112,114,101,99,97,116,101,100,32,105,110,32,102,97,
-    118,111,114,32,111,102,32,102,105,110,100,101,114,46,102,105,
-    110,100,95,115,112,101,99,40,41,46,10,10,32,32,32,32,
-    78,122,44,78,111,116,32,105,109,112,111,114,116,105,110,103,
-    32,100,105,114,101,99,116,111,114,121,32,123,125,58,32,109,
-    105,115,115,105,110,103,32,95,95,105,110,105,116,95,95,114,
-    73,0,0,0,41,6,218,11,102,105,110,100,95,108,111,97,
-    100,101,114,114,23,0,0,0,114,75,0,0,0,114,76,0,
-    0,0,114,62,0,0,0,218,13,73,109,112,111,114,116,87,
-    97,114,110,105,110,103,41,5,114,118,0,0,0,218,8,102,
-    117,108,108,110,97,109,101,218,6,108,111,97,100,101,114,218,
-    8,112,111,114,116,105,111,110,115,218,3,109,115,103,114,5,
-    0,0,0,114,5,0,0,0,114,8,0,0,0,218,17,95,
-    102,105,110,100,95,109,111,100,117,108,101,95,115,104,105,109,
-    227,1,0,0,115,10,0,0,0,0,10,14,1,16,1,4,
-    1,22,1,114,143,0,0,0,99,3,0,0,0,0,0,0,
-    0,0,0,0,0,6,0,0,0,4,0,0,0,67,0,0,
-    0,115,166,0,0,0,124,0,100,1,100,2,133,2,25,0,
-    125,3,124,3,116,0,107,3,114,64,100,3,124,1,155,2,
-    100,4,124,3,155,2,157,4,125,4,116,1,160,2,100,5,
-    124,4,161,2,1,0,116,3,124,4,102,1,105,0,124,2,
-    164,1,142,1,130,1,116,4,124,0,131,1,100,6,107,0,
-    114,106,100,7,124,1,155,2,157,2,125,4,116,1,160,2,
-    100,5,124,4,161,2,1,0,116,5,124,4,131,1,130,1,
-    116,6,124,0,100,2,100,8,133,2,25,0,131,1,125,5,
-    124,5,100,9,64,0,114,162,100,10,124,5,155,2,100,11,
-    124,1,155,2,157,4,125,4,116,3,124,4,102,1,105,0,
-    124,2,164,1,142,1,130,1,124,5,83,0,41,12,97,84,
-    2,0,0,80,101,114,102,111,114,109,32,98,97,115,105,99,
-    32,118,97,108,105,100,105,116,121,32,99,104,101,99,107,105,
-    110,103,32,111,102,32,97,32,112,121,99,32,104,101,97,100,
-    101,114,32,97,110,100,32,114,101,116,117,114,110,32,116,104,
-    101,32,102,108,97,103,115,32,102,105,101,108,100,44,10,32,
-    32,32,32,119,104,105,99,104,32,100,101,116,101,114,109,105,
-    110,101,115,32,104,111,119,32,116,104,101,32,112,121,99,32,
-    115,104,111,117,108,100,32,98,101,32,102,117,114,116,104,101,
-    114,32,118,97,108,105,100,97,116,101,100,32,97,103,97,105,
-    110,115,116,32,116,104,101,32,115,111,117,114,99,101,46,10,
-    10,32,32,32,32,42,100,97,116,97,42,32,105,115,32,116,
-    104,101,32,99,111,110,116,101,110,116,115,32,111,102,32,116,
-    104,101,32,112,121,99,32,102,105,108,101,46,32,40,79,110,
-    108,121,32,116,104,101,32,102,105,114,115,116,32,49,54,32,
-    98,121,116,101,115,32,97,114,101,10,32,32,32,32,114,101,
-    113,117,105,114,101,100,44,32,116,104,111,117,103,104,46,41,
-    10,10,32,32,32,32,42,110,97,109,101,42,32,105,115,32,
-    116,104,101,32,110,97,109,101,32,111,102,32,116,104,101,32,
-    109,111,100,117,108,101,32,98,101,105,110,103,32,105,109,112,
-    111,114,116,101,100,46,32,73,116,32,105,115,32,117,115,101,
-    100,32,102,111,114,32,108,111,103,103,105,110,103,46,10,10,
-    32,32,32,32,42,101,120,99,95,100,101,116,97,105,108,115,
-    42,32,105,115,32,97,32,100,105,99,116,105,111,110,97,114,
-    121,32,112,97,115,115,101,100,32,116,111,32,73,109,112,111,
-    114,116,69,114,114,111,114,32,105,102,32,105,116,32,114,97,
-    105,115,101,100,32,102,111,114,10,32,32,32,32,105,109,112,
-    114,111,118,101,100,32,100,101,98,117,103,103,105,110,103,46,
-    10,10,32,32,32,32,73,109,112,111,114,116,69,114,114,111,
-    114,32,105,115,32,114,97,105,115,101,100,32,119,104,101,110,
-    32,116,104,101,32,109,97,103,105,99,32,110,117,109,98,101,
-    114,32,105,115,32,105,110,99,111,114,114,101,99,116,32,111,
-    114,32,119,104,101,110,32,116,104,101,32,102,108,97,103,115,
-    10,32,32,32,32,102,105,101,108,100,32,105,115,32,105,110,
-    118,97,108,105,100,46,32,69,79,70,69,114,114,111,114,32,
-    105,115,32,114,97,105,115,101,100,32,119,104,101,110,32,116,
-    104,101,32,100,97,116,97,32,105,115,32,102,111,117,110,100,
-    32,116,111,32,98,101,32,116,114,117,110,99,97,116,101,100,
-    46,10,10,32,32,32,32,78,114,16,0,0,0,122,20,98,
-    97,100,32,109,97,103,105,99,32,110,117,109,98,101,114,32,
-    105,110,32,122,2,58,32,250,2,123,125,233,16,0,0,0,
-    122,40,114,101,97,99,104,101,100,32,69,79,70,32,119,104,
-    105,108,101,32,114,101,97,100,105,110,103,32,112,121,99,32,
-    104,101,97,100,101,114,32,111,102,32,233,8,0,0,0,233,
-    252,255,255,255,122,14,105,110,118,97,108,105,100,32,102,108,
-    97,103,115,32,122,4,32,105,110,32,41,7,218,12,77,65,
-    71,73,67,95,78,85,77,66,69,82,114,134,0,0,0,218,
-    16,95,118,101,114,98,111,115,101,95,109,101,115,115,97,103,
-    101,114,117,0,0,0,114,23,0,0,0,218,8,69,79,70,
-    69,114,114,111,114,114,27,0,0,0,41,6,114,26,0,0,
-    0,114,116,0,0,0,218,11,101,120,99,95,100,101,116,97,
-    105,108,115,90,5,109,97,103,105,99,114,92,0,0,0,114,
-    2,0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,
-    0,0,0,218,13,95,99,108,97,115,115,105,102,121,95,112,
-    121,99,244,1,0,0,115,28,0,0,0,0,16,12,1,8,
-    1,16,1,12,1,16,1,12,1,10,1,12,1,8,1,16,
-    2,8,1,16,1,16,1,114,152,0,0,0,99,5,0,0,
-    0,0,0,0,0,0,0,0,0,6,0,0,0,4,0,0,
-    0,67,0,0,0,115,120,0,0,0,116,0,124,0,100,1,
-    100,2,133,2,25,0,131,1,124,1,100,3,64,0,107,3,
-    114,62,100,4,124,3,155,2,157,2,125,5,116,1,160,2,
-    100,5,124,5,161,2,1,0,116,3,124,5,102,1,105,0,
-    124,4,164,1,142,1,130,1,124,2,100,6,117,1,114,116,
-    116,0,124,0,100,2,100,7,133,2,25,0,131,1,124,2,
-    100,3,64,0,107,3,114,116,116,3,100,4,124,3,155,2,
-    157,2,102,1,105,0,124,4,164,1,142,1,130,1,100,6,
-    83,0,41,8,97,7,2,0,0,86,97,108,105,100,97,116,
-    101,32,97,32,112,121,99,32,97,103,97,105,110,115,116,32,
-    116,104,101,32,115,111,117,114,99,101,32,108,97,115,116,45,
-    109,111,100,105,102,105,101,100,32,116,105,109,101,46,10,10,
-    32,32,32,32,42,100,97,116,97,42,32,105,115,32,116,104,
-    101,32,99,111,110,116,101,110,116,115,32,111,102,32,116,104,
-    101,32,112,121,99,32,102,105,108,101,46,32,40,79,110,108,
-    121,32,116,104,101,32,102,105,114,115,116,32,49,54,32,98,
-    121,116,101,115,32,97,114,101,10,32,32,32,32,114,101,113,
-    117,105,114,101,100,46,41,10,10,32,32,32,32,42,115,111,
-    117,114,99,101,95,109,116,105,109,101,42,32,105,115,32,116,
-    104,101,32,108,97,115,116,32,109,111,100,105,102,105,101,100,
-    32,116,105,109,101,115,116,97,109,112,32,111,102,32,116,104,
-    101,32,115,111,117,114,99,101,32,102,105,108,101,46,10,10,
-    32,32,32,32,42,115,111,117,114,99,101,95,115,105,122,101,
-    42,32,105,115,32,78,111,110,101,32,111,114,32,116,104,101,
-    32,115,105,122,101,32,111,102,32,116,104,101,32,115,111,117,
-    114,99,101,32,102,105,108,101,32,105,110,32,98,121,116,101,
-    115,46,10,10,32,32,32,32,42,110,97,109,101,42,32,105,
-    115,32,116,104,101,32,110,97,109,101,32,111,102,32,116,104,
-    101,32,109,111,100,117,108,101,32,98,101,105,110,103,32,105,
-    109,112,111,114,116,101,100,46,32,73,116,32,105,115,32,117,
-    115,101,100,32,102,111,114,32,108,111,103,103,105,110,103,46,
-    10,10,32,32,32,32,42,101,120,99,95,100,101,116,97,105,
-    108,115,42,32,105,115,32,97,32,100,105,99,116,105,111,110,
-    97,114,121,32,112,97,115,115,101,100,32,116,111,32,73,109,
-    112,111,114,116,69,114,114,111,114,32,105,102,32,105,116,32,
-    114,97,105,115,101,100,32,102,111,114,10,32,32,32,32,105,
-    109,112,114,111,118,101,100,32,100,101,98,117,103,103,105,110,
-    103,46,10,10,32,32,32,32,65,110,32,73,109,112,111,114,
+    101,32,102,105,108,101,46,114,87,0,0,0,233,128,0,0,
+    0,41,3,114,75,0,0,0,114,77,0,0,0,114,76,0,
+    0,0,41,2,114,65,0,0,0,114,78,0,0,0,114,7,
+    0,0,0,114,7,0,0,0,114,8,0,0,0,218,10,95,
+    99,97,108,99,95,109,111,100,101,10,2,0,0,115,14,0,
+    0,0,2,2,14,1,12,1,8,1,2,255,8,4,4,1,
+    114,139,0,0,0,99,1,0,0,0,0,0,0,0,0,0,
+    0,0,3,0,0,0,4,0,0,0,3,0,0,0,115,52,
+    0,0,0,100,6,135,0,102,1,100,2,100,3,132,9,125,
+    1,116,0,100,1,117,1,114,15,116,0,106,1,125,2,110,
+    4,100,4,100,5,132,0,125,2,124,2,124,1,136,0,131,
+    2,1,0,124,1,83,0,41,7,122,252,68,101,99,111,114,
+    97,116,111,114,32,116,111,32,118,101,114,105,102,121,32,116,
+    104,97,116,32,116,104,101,32,109,111,100,117,108,101,32,98,
+    101,105,110,103,32,114,101,113,117,101,115,116,101,100,32,109,
+    97,116,99,104,101,115,32,116,104,101,32,111,110,101,32,116,
+    104,101,10,32,32,32,32,108,111,97,100,101,114,32,99,97,
+    110,32,104,97,110,100,108,101,46,10,10,32,32,32,32,84,
+    104,101,32,102,105,114,115,116,32,97,114,103,117,109,101,110,
+    116,32,40,115,101,108,102,41,32,109,117,115,116,32,100,101,
+    102,105,110,101,32,95,110,97,109,101,32,119,104,105,99,104,
+    32,116,104,101,32,115,101,99,111,110,100,32,97,114,103,117,
+    109,101,110,116,32,105,115,10,32,32,32,32,99,111,109,112,
+    97,114,101,100,32,97,103,97,105,110,115,116,46,32,73,102,
+    32,116,104,101,32,99,111,109,112,97,114,105,115,111,110,32,
+    102,97,105,108,115,32,116,104,101,110,32,73,109,112,111,114,
     116,69,114,114,111,114,32,105,115,32,114,97,105,115,101,100,
-    32,105,102,32,116,104,101,32,98,121,116,101,99,111,100,101,
-    32,105,115,32,115,116,97,108,101,46,10,10,32,32,32,32,
-    114,146,0,0,0,233,12,0,0,0,114,15,0,0,0,122,
-    22,98,121,116,101,99,111,100,101,32,105,115,32,115,116,97,
-    108,101,32,102,111,114,32,114,144,0,0,0,78,114,145,0,
-    0,0,41,4,114,27,0,0,0,114,134,0,0,0,114,149,
-    0,0,0,114,117,0,0,0,41,6,114,26,0,0,0,218,
-    12,115,111,117,114,99,101,95,109,116,105,109,101,218,11,115,
-    111,117,114,99,101,95,115,105,122,101,114,116,0,0,0,114,
-    151,0,0,0,114,92,0,0,0,114,5,0,0,0,114,5,
-    0,0,0,114,8,0,0,0,218,23,95,118,97,108,105,100,
-    97,116,101,95,116,105,109,101,115,116,97,109,112,95,112,121,
-    99,21,2,0,0,115,16,0,0,0,0,19,24,1,10,1,
-    12,1,16,1,8,1,22,255,2,2,114,156,0,0,0,99,
-    4,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,
-    4,0,0,0,67,0,0,0,115,42,0,0,0,124,0,100,
-    1,100,2,133,2,25,0,124,1,107,3,114,38,116,0,100,
-    3,124,2,155,2,157,2,102,1,105,0,124,3,164,1,142,
-    1,130,1,100,4,83,0,41,5,97,243,1,0,0,86,97,
-    108,105,100,97,116,101,32,97,32,104,97,115,104,45,98,97,
-    115,101,100,32,112,121,99,32,98,121,32,99,104,101,99,107,
-    105,110,103,32,116,104,101,32,114,101,97,108,32,115,111,117,
-    114,99,101,32,104,97,115,104,32,97,103,97,105,110,115,116,
-    32,116,104,101,32,111,110,101,32,105,110,10,32,32,32,32,
-    116,104,101,32,112,121,99,32,104,101,97,100,101,114,46,10,
-    10,32,32,32,32,42,100,97,116,97,42,32,105,115,32,116,
-    104,101,32,99,111,110,116,101,110,116,115,32,111,102,32,116,
-    104,101,32,112,121,99,32,102,105,108,101,46,32,40,79,110,
-    108,121,32,116,104,101,32,102,105,114,115,116,32,49,54,32,
-    98,121,116,101,115,32,97,114,101,10,32,32,32,32,114,101,
-    113,117,105,114,101,100,46,41,10,10,32,32,32,32,42,115,
-    111,117,114,99,101,95,104,97,115,104,42,32,105,115,32,116,
-    104,101,32,105,109,112,111,114,116,108,105,98,46,117,116,105,
-    108,46,115,111,117,114,99,101,95,104,97,115,104,40,41,32,
-    111,102,32,116,104,101,32,115,111,117,114,99,101,32,102,105,
-    108,101,46,10,10,32,32,32,32,42,110,97,109,101,42,32,
-    105,115,32,116,104,101,32,110,97,109,101,32,111,102,32,116,
-    104,101,32,109,111,100,117,108,101,32,98,101,105,110,103,32,
-    105,109,112,111,114,116,101,100,46,32,73,116,32,105,115,32,
-    117,115,101,100,32,102,111,114,32,108,111,103,103,105,110,103,
-    46,10,10,32,32,32,32,42,101,120,99,95,100,101,116,97,
-    105,108,115,42,32,105,115,32,97,32,100,105,99,116,105,111,
-    110,97,114,121,32,112,97,115,115,101,100,32,116,111,32,73,
-    109,112,111,114,116,69,114,114,111,114,32,105,102,32,105,116,
-    32,114,97,105,115,101,100,32,102,111,114,10,32,32,32,32,
-    105,109,112,114,111,118,101,100,32,100,101,98,117,103,103,105,
-    110,103,46,10,10,32,32,32,32,65,110,32,73,109,112,111,
-    114,116,69,114,114,111,114,32,105,115,32,114,97,105,115,101,
-    100,32,105,102,32,116,104,101,32,98,121,116,101,99,111,100,
-    101,32,105,115,32,115,116,97,108,101,46,10,10,32,32,32,
-    32,114,146,0,0,0,114,145,0,0,0,122,46,104,97,115,
-    104,32,105,110,32,98,121,116,101,99,111,100,101,32,100,111,
-    101,115,110,39,116,32,109,97,116,99,104,32,104,97,115,104,
-    32,111,102,32,115,111,117,114,99,101,32,78,41,1,114,117,
-    0,0,0,41,4,114,26,0,0,0,218,11,115,111,117,114,
-    99,101,95,104,97,115,104,114,116,0,0,0,114,151,0,0,
-    0,114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,
-    218,18,95,118,97,108,105,100,97,116,101,95,104,97,115,104,
-    95,112,121,99,49,2,0,0,115,12,0,0,0,0,17,16,
-    1,2,1,8,255,4,2,2,254,114,158,0,0,0,99,4,
-    0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,5,
-    0,0,0,67,0,0,0,115,80,0,0,0,116,0,160,1,
-    124,0,161,1,125,4,116,2,124,4,116,3,131,2,114,56,
-    116,4,160,5,100,1,124,2,161,2,1,0,124,3,100,2,
-    117,1,114,52,116,6,160,7,124,4,124,3,161,2,1,0,
-    124,4,83,0,116,8,100,3,160,9,124,2,161,1,124,1,
-    124,2,100,4,141,3,130,1,100,2,83,0,41,5,122,35,
-    67,111,109,112,105,108,101,32,98,121,116,101,99,111,100,101,
-    32,97,115,32,102,111,117,110,100,32,105,110,32,97,32,112,
-    121,99,46,122,21,99,111,100,101,32,111,98,106,101,99,116,
-    32,102,114,111,109,32,123,33,114,125,78,122,23,78,111,110,
-    45,99,111,100,101,32,111,98,106,101,99,116,32,105,110,32,
-    123,33,114,125,169,2,114,116,0,0,0,114,44,0,0,0,
-    41,10,218,7,109,97,114,115,104,97,108,90,5,108,111,97,
-    100,115,218,10,105,115,105,110,115,116,97,110,99,101,218,10,
-    95,99,111,100,101,95,116,121,112,101,114,134,0,0,0,114,
-    149,0,0,0,218,4,95,105,109,112,90,16,95,102,105,120,
-    95,99,111,95,102,105,108,101,110,97,109,101,114,117,0,0,
-    0,114,62,0,0,0,41,5,114,26,0,0,0,114,116,0,
-    0,0,114,106,0,0,0,114,107,0,0,0,218,4,99,111,
-    100,101,114,5,0,0,0,114,5,0,0,0,114,8,0,0,
-    0,218,17,95,99,111,109,112,105,108,101,95,98,121,116,101,
-    99,111,100,101,73,2,0,0,115,18,0,0,0,0,2,10,
-    1,10,1,12,1,8,1,12,1,4,2,10,1,4,255,114,
-    165,0,0,0,114,73,0,0,0,99,3,0,0,0,0,0,
-    0,0,0,0,0,0,4,0,0,0,5,0,0,0,67,0,
-    0,0,115,70,0,0,0,116,0,116,1,131,1,125,3,124,
-    3,160,2,116,3,100,1,131,1,161,1,1,0,124,3,160,
-    2,116,3,124,1,131,1,161,1,1,0,124,3,160,2,116,
-    3,124,2,131,1,161,1,1,0,124,3,160,2,116,4,160,
-    5,124,0,161,1,161,1,1,0,124,3,83,0,41,2,122,
-    43,80,114,111,100,117,99,101,32,116,104,101,32,100,97,116,
-    97,32,102,111,114,32,97,32,116,105,109,101,115,116,97,109,
-    112,45,98,97,115,101,100,32,112,121,99,46,114,73,0,0,
-    0,41,6,218,9,98,121,116,101,97,114,114,97,121,114,148,
-    0,0,0,218,6,101,120,116,101,110,100,114,21,0,0,0,
-    114,160,0,0,0,218,5,100,117,109,112,115,41,4,114,164,
-    0,0,0,218,5,109,116,105,109,101,114,155,0,0,0,114,
-    26,0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,
-    0,0,0,218,22,95,99,111,100,101,95,116,111,95,116,105,
-    109,101,115,116,97,109,112,95,112,121,99,86,2,0,0,115,
-    12,0,0,0,0,2,8,1,14,1,14,1,14,1,16,1,
-    114,170,0,0,0,84,99,3,0,0,0,0,0,0,0,0,
-    0,0,0,5,0,0,0,5,0,0,0,67,0,0,0,115,
-    80,0,0,0,116,0,116,1,131,1,125,3,100,1,124,2,
-    100,1,62,0,66,0,125,4,124,3,160,2,116,3,124,4,
-    131,1,161,1,1,0,116,4,124,1,131,1,100,2,107,2,
-    115,50,74,0,130,1,124,3,160,2,124,1,161,1,1,0,
-    124,3,160,2,116,5,160,6,124,0,161,1,161,1,1,0,
-    124,3,83,0,41,3,122,38,80,114,111,100,117,99,101,32,
-    116,104,101,32,100,97,116,97,32,102,111,114,32,97,32,104,
-    97,115,104,45,98,97,115,101,100,32,112,121,99,46,114,39,
-    0,0,0,114,146,0,0,0,41,7,114,166,0,0,0,114,
-    148,0,0,0,114,167,0,0,0,114,21,0,0,0,114,23,
-    0,0,0,114,160,0,0,0,114,168,0,0,0,41,5,114,
-    164,0,0,0,114,157,0,0,0,90,7,99,104,101,99,107,
-    101,100,114,26,0,0,0,114,2,0,0,0,114,5,0,0,
-    0,114,5,0,0,0,114,8,0,0,0,218,17,95,99,111,
-    100,101,95,116,111,95,104,97,115,104,95,112,121,99,96,2,
-    0,0,115,14,0,0,0,0,2,8,1,12,1,14,1,16,
-    1,10,1,16,1,114,171,0,0,0,99,1,0,0,0,0,
-    0,0,0,0,0,0,0,5,0,0,0,6,0,0,0,67,
-    0,0,0,115,62,0,0,0,100,1,100,2,108,0,125,1,
-    116,1,160,2,124,0,161,1,106,3,125,2,124,1,160,4,
-    124,2,161,1,125,3,116,1,160,5,100,2,100,3,161,2,
-    125,4,124,4,160,6,124,0,160,6,124,3,100,1,25,0,
-    161,1,161,1,83,0,41,4,122,121,68,101,99,111,100,101,
-    32,98,121,116,101,115,32,114,101,112,114,101,115,101,110,116,
-    105,110,103,32,115,111,117,114,99,101,32,99,111,100,101,32,
-    97,110,100,32,114,101,116,117,114,110,32,116,104,101,32,115,
-    116,114,105,110,103,46,10,10,32,32,32,32,85,110,105,118,
-    101,114,115,97,108,32,110,101,119,108,105,110,101,32,115,117,
-    112,112,111,114,116,32,105,115,32,117,115,101,100,32,105,110,
-    32,116,104,101,32,100,101,99,111,100,105,110,103,46,10,32,
-    32,32,32,114,73,0,0,0,78,84,41,7,218,8,116,111,
-    107,101,110,105,122,101,114,64,0,0,0,90,7,66,121,116,
-    101,115,73,79,90,8,114,101,97,100,108,105,110,101,90,15,
-    100,101,116,101,99,116,95,101,110,99,111,100,105,110,103,90,
-    25,73,110,99,114,101,109,101,110,116,97,108,78,101,119,108,
-    105,110,101,68,101,99,111,100,101,114,218,6,100,101,99,111,
-    100,101,41,5,218,12,115,111,117,114,99,101,95,98,121,116,
-    101,115,114,172,0,0,0,90,21,115,111,117,114,99,101,95,
-    98,121,116,101,115,95,114,101,97,100,108,105,110,101,218,8,
-    101,110,99,111,100,105,110,103,90,15,110,101,119,108,105,110,
-    101,95,100,101,99,111,100,101,114,114,5,0,0,0,114,5,
-    0,0,0,114,8,0,0,0,218,13,100,101,99,111,100,101,
-    95,115,111,117,114,99,101,107,2,0,0,115,10,0,0,0,
-    0,5,8,1,12,1,10,1,12,1,114,176,0,0,0,169,
-    2,114,140,0,0,0,218,26,115,117,98,109,111,100,117,108,
-    101,95,115,101,97,114,99,104,95,108,111,99,97,116,105,111,
-    110,115,99,2,0,0,0,0,0,0,0,2,0,0,0,9,
-    0,0,0,8,0,0,0,67,0,0,0,115,12,1,0,0,
-    124,1,100,1,117,0,114,58,100,2,125,1,116,0,124,2,
-    100,3,131,2,114,68,122,14,124,2,160,1,124,0,161,1,
-    125,1,87,0,113,68,4,0,116,2,121,54,1,0,1,0,
-    1,0,89,0,113,68,48,0,110,10,116,3,160,4,124,1,
-    161,1,125,1,116,5,106,6,124,0,124,2,124,1,100,4,
-    141,3,125,4,100,5,124,4,95,7,124,2,100,1,117,0,
-    114,152,116,8,131,0,68,0,93,42,92,2,125,5,125,6,
-    124,1,160,9,116,10,124,6,131,1,161,1,114,104,124,5,
-    124,0,124,1,131,2,125,2,124,2,124,4,95,11,1,0,
-    113,152,113,104,100,1,83,0,124,3,116,12,117,0,114,216,
-    116,0,124,2,100,6,131,2,114,222,122,14,124,2,160,13,
-    124,0,161,1,125,7,87,0,110,18,4,0,116,2,121,202,
-    1,0,1,0,1,0,89,0,113,222,48,0,124,7,114,222,
-    103,0,124,4,95,14,110,6,124,3,124,4,95,14,124,4,
-    106,14,103,0,107,2,144,1,114,8,124,1,144,1,114,8,
-    116,15,124,1,131,1,100,7,25,0,125,8,124,4,106,14,
-    160,16,124,8,161,1,1,0,124,4,83,0,41,8,97,61,
-    1,0,0,82,101,116,117,114,110,32,97,32,109,111,100,117,
-    108,101,32,115,112,101,99,32,98,97,115,101,100,32,111,110,
-    32,97,32,102,105,108,101,32,108,111,99,97,116,105,111,110,
-    46,10,10,32,32,32,32,84,111,32,105,110,100,105,99,97,
-    116,101,32,116,104,97,116,32,116,104,101,32,109,111,100,117,
-    108,101,32,105,115,32,97,32,112,97,99,107,97,103,101,44,
-    32,115,101,116,10,32,32,32,32,115,117,98,109,111,100,117,
-    108,101,95,115,101,97,114,99,104,95,108,111,99,97,116,105,
-    111,110,115,32,116,111,32,97,32,108,105,115,116,32,111,102,
-    32,100,105,114,101,99,116,111,114,121,32,112,97,116,104,115,
-    46,32,32,65,110,10,32,32,32,32,101,109,112,116,121,32,
-    108,105,115,116,32,105,115,32,115,117,102,102,105,99,105,101,
-    110,116,44,32,116,104,111,117,103,104,32,105,116,115,32,110,
-    111,116,32,111,116,104,101,114,119,105,115,101,32,117,115,101,
-    102,117,108,32,116,111,32,116,104,101,10,32,32,32,32,105,
-    109,112,111,114,116,32,115,121,115,116,101,109,46,10,10,32,
-    32,32,32,84,104,101,32,108,111,97,100,101,114,32,109,117,
-    115,116,32,116,97,107,101,32,97,32,115,112,101,99,32,97,
-    115,32,105,116,115,32,111,110,108,121,32,95,95,105,110,105,
-    116,95,95,40,41,32,97,114,103,46,10,10,32,32,32,32,
-    78,122,9,60,117,110,107,110,111,119,110,62,218,12,103,101,
-    116,95,102,105,108,101,110,97,109,101,169,1,218,6,111,114,
-    105,103,105,110,84,218,10,105,115,95,112,97,99,107,97,103,
-    101,114,73,0,0,0,41,17,114,128,0,0,0,114,179,0,
-    0,0,114,117,0,0,0,114,4,0,0,0,114,79,0,0,
-    0,114,134,0,0,0,218,10,77,111,100,117,108,101,83,112,
-    101,99,90,13,95,115,101,116,95,102,105,108,101,97,116,116,
-    114,218,27,95,103,101,116,95,115,117,112,112,111,114,116,101,
-    100,95,102,105,108,101,95,108,111,97,100,101,114,115,114,110,
-    0,0,0,114,111,0,0,0,114,140,0,0,0,218,9,95,
-    80,79,80,85,76,65,84,69,114,182,0,0,0,114,178,0,
-    0,0,114,47,0,0,0,218,6,97,112,112,101,110,100,41,
-    9,114,116,0,0,0,90,8,108,111,99,97,116,105,111,110,
-    114,140,0,0,0,114,178,0,0,0,218,4,115,112,101,99,
-    218,12,108,111,97,100,101,114,95,99,108,97,115,115,218,8,
-    115,117,102,102,105,120,101,115,114,182,0,0,0,90,7,100,
-    105,114,110,97,109,101,114,5,0,0,0,114,5,0,0,0,
-    114,8,0,0,0,218,23,115,112,101,99,95,102,114,111,109,
-    95,102,105,108,101,95,108,111,99,97,116,105,111,110,124,2,
-    0,0,115,62,0,0,0,0,12,8,4,4,1,10,2,2,
-    1,14,1,12,1,8,2,10,8,16,1,6,3,8,1,14,
-    1,14,1,10,1,6,1,6,2,4,3,8,2,10,1,2,
-    1,14,1,12,1,6,2,4,1,8,2,6,1,12,1,6,
-    1,12,1,12,2,114,190,0,0,0,99,0,0,0,0,0,
-    0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,64,
-    0,0,0,115,80,0,0,0,101,0,90,1,100,0,90,2,
-    100,1,90,3,100,2,90,4,100,3,90,5,100,4,90,6,
-    101,7,100,5,100,6,132,0,131,1,90,8,101,7,100,7,
-    100,8,132,0,131,1,90,9,101,7,100,14,100,10,100,11,
-    132,1,131,1,90,10,101,7,100,15,100,12,100,13,132,1,
-    131,1,90,11,100,9,83,0,41,16,218,21,87,105,110,100,
+    46,10,10,32,32,32,32,78,99,2,0,0,0,0,0,0,
+    0,0,0,0,0,4,0,0,0,4,0,0,0,31,0,0,
+    0,115,72,0,0,0,124,1,100,0,117,0,114,8,124,0,
+    106,0,125,1,110,16,124,0,106,0,124,1,107,3,114,24,
+    116,1,100,1,124,0,106,0,124,1,102,2,22,0,124,1,
+    100,2,141,2,130,1,136,0,124,0,124,1,103,2,124,2,
+    162,1,82,0,105,0,124,3,164,1,142,1,83,0,41,3,
+    78,122,30,108,111,97,100,101,114,32,102,111,114,32,37,115,
+    32,99,97,110,110,111,116,32,104,97,110,100,108,101,32,37,
+    115,169,1,218,4,110,97,109,101,41,2,114,141,0,0,0,
+    218,11,73,109,112,111,114,116,69,114,114,111,114,41,4,218,
+    4,115,101,108,102,114,141,0,0,0,218,4,97,114,103,115,
+    218,6,107,119,97,114,103,115,169,1,218,6,109,101,116,104,
+    111,100,114,7,0,0,0,114,8,0,0,0,218,19,95,99,
+    104,101,99,107,95,110,97,109,101,95,119,114,97,112,112,101,
+    114,30,2,0,0,115,18,0,0,0,8,1,8,1,10,1,
+    4,1,8,1,2,255,2,1,6,255,24,2,122,40,95,99,
+    104,101,99,107,95,110,97,109,101,46,60,108,111,99,97,108,
+    115,62,46,95,99,104,101,99,107,95,110,97,109,101,95,119,
+    114,97,112,112,101,114,99,2,0,0,0,0,0,0,0,0,
+    0,0,0,3,0,0,0,7,0,0,0,83,0,0,0,115,
+    56,0,0,0,100,1,68,0,93,16,125,2,116,0,124,1,
+    124,2,131,2,114,18,116,1,124,0,124,2,116,2,124,1,
+    124,2,131,2,131,3,1,0,113,2,124,0,106,3,160,4,
+    124,1,106,3,161,1,1,0,100,0,83,0,41,2,78,41,
+    4,218,10,95,95,109,111,100,117,108,101,95,95,218,8,95,
+    95,110,97,109,101,95,95,218,12,95,95,113,117,97,108,110,
+    97,109,101,95,95,218,7,95,95,100,111,99,95,95,41,5,
+    218,7,104,97,115,97,116,116,114,218,7,115,101,116,97,116,
+    116,114,218,7,103,101,116,97,116,116,114,218,8,95,95,100,
+    105,99,116,95,95,218,6,117,112,100,97,116,101,41,3,90,
+    3,110,101,119,90,3,111,108,100,114,85,0,0,0,114,7,
+    0,0,0,114,7,0,0,0,114,8,0,0,0,218,5,95,
+    119,114,97,112,43,2,0,0,115,10,0,0,0,8,1,10,
+    1,18,1,2,128,18,1,122,26,95,99,104,101,99,107,95,
+    110,97,109,101,46,60,108,111,99,97,108,115,62,46,95,119,
+    114,97,112,114,69,0,0,0,41,2,218,10,95,98,111,111,
+    116,115,116,114,97,112,114,158,0,0,0,41,3,114,147,0,
+    0,0,114,148,0,0,0,114,158,0,0,0,114,7,0,0,
+    0,114,146,0,0,0,114,8,0,0,0,218,11,95,99,104,
+    101,99,107,95,110,97,109,101,22,2,0,0,115,12,0,0,
+    0,14,8,8,10,8,1,8,2,10,6,4,1,114,160,0,
+    0,0,99,2,0,0,0,0,0,0,0,0,0,0,0,5,
+    0,0,0,6,0,0,0,67,0,0,0,115,72,0,0,0,
+    116,0,160,1,100,1,116,2,161,2,1,0,124,0,160,3,
+    124,1,161,1,92,2,125,2,125,3,124,2,100,2,117,0,
+    114,34,116,4,124,3,131,1,114,34,100,3,125,4,116,0,
+    160,1,124,4,160,5,124,3,100,4,25,0,161,1,116,6,
+    161,2,1,0,124,2,83,0,41,5,122,155,84,114,121,32,
+    116,111,32,102,105,110,100,32,97,32,108,111,97,100,101,114,
+    32,102,111,114,32,116,104,101,32,115,112,101,99,105,102,105,
+    101,100,32,109,111,100,117,108,101,32,98,121,32,100,101,108,
+    101,103,97,116,105,110,103,32,116,111,10,32,32,32,32,115,
+    101,108,102,46,102,105,110,100,95,108,111,97,100,101,114,40,
+    41,46,10,10,32,32,32,32,84,104,105,115,32,109,101,116,
+    104,111,100,32,105,115,32,100,101,112,114,101,99,97,116,101,
+    100,32,105,110,32,102,97,118,111,114,32,111,102,32,102,105,
+    110,100,101,114,46,102,105,110,100,95,115,112,101,99,40,41,
+    46,10,10,32,32,32,32,122,90,102,105,110,100,95,109,111,
+    100,117,108,101,40,41,32,105,115,32,100,101,112,114,101,99,
+    97,116,101,100,32,97,110,100,32,115,108,97,116,101,100,32,
+    102,111,114,32,114,101,109,111,118,97,108,32,105,110,32,80,
+    121,116,104,111,110,32,51,46,49,50,59,32,117,115,101,32,
+    102,105,110,100,95,115,112,101,99,40,41,32,105,110,115,116,
+    101,97,100,78,122,44,78,111,116,32,105,109,112,111,114,116,
+    105,110,103,32,100,105,114,101,99,116,111,114,121,32,123,125,
+    58,32,109,105,115,115,105,110,103,32,95,95,105,110,105,116,
+    95,95,114,0,0,0,0,41,7,114,99,0,0,0,114,100,
+    0,0,0,114,101,0,0,0,218,11,102,105,110,100,95,108,
+    111,97,100,101,114,114,4,0,0,0,114,89,0,0,0,218,
+    13,73,109,112,111,114,116,87,97,114,110,105,110,103,41,5,
+    114,143,0,0,0,218,8,102,117,108,108,110,97,109,101,218,
+    6,108,111,97,100,101,114,218,8,112,111,114,116,105,111,110,
+    115,218,3,109,115,103,114,7,0,0,0,114,7,0,0,0,
+    114,8,0,0,0,218,17,95,102,105,110,100,95,109,111,100,
+    117,108,101,95,115,104,105,109,53,2,0,0,115,16,0,0,
+    0,6,7,2,2,4,254,14,6,16,1,4,1,22,1,4,
+    1,114,167,0,0,0,99,3,0,0,0,0,0,0,0,0,
+    0,0,0,6,0,0,0,4,0,0,0,67,0,0,0,115,
+    166,0,0,0,124,0,100,1,100,2,133,2,25,0,125,3,
+    124,3,116,0,107,3,114,32,100,3,124,1,155,2,100,4,
+    124,3,155,2,157,4,125,4,116,1,160,2,100,5,124,4,
+    161,2,1,0,116,3,124,4,102,1,105,0,124,2,164,1,
+    142,1,130,1,116,4,124,0,131,1,100,6,107,0,114,53,
+    100,7,124,1,155,2,157,2,125,4,116,1,160,2,100,5,
+    124,4,161,2,1,0,116,5,124,4,131,1,130,1,116,6,
+    124,0,100,2,100,8,133,2,25,0,131,1,125,5,124,5,
+    100,9,64,0,114,81,100,10,124,5,155,2,100,11,124,1,
+    155,2,157,4,125,4,116,3,124,4,102,1,105,0,124,2,
+    164,1,142,1,130,1,124,5,83,0,41,12,97,84,2,0,
+    0,80,101,114,102,111,114,109,32,98,97,115,105,99,32,118,
+    97,108,105,100,105,116,121,32,99,104,101,99,107,105,110,103,
+    32,111,102,32,97,32,112,121,99,32,104,101,97,100,101,114,
+    32,97,110,100,32,114,101,116,117,114,110,32,116,104,101,32,
+    102,108,97,103,115,32,102,105,101,108,100,44,10,32,32,32,
+    32,119,104,105,99,104,32,100,101,116,101,114,109,105,110,101,
+    115,32,104,111,119,32,116,104,101,32,112,121,99,32,115,104,
+    111,117,108,100,32,98,101,32,102,117,114,116,104,101,114,32,
+    118,97,108,105,100,97,116,101,100,32,97,103,97,105,110,115,
+    116,32,116,104,101,32,115,111,117,114,99,101,46,10,10,32,
+    32,32,32,42,100,97,116,97,42,32,105,115,32,116,104,101,
+    32,99,111,110,116,101,110,116,115,32,111,102,32,116,104,101,
+    32,112,121,99,32,102,105,108,101,46,32,40,79,110,108,121,
+    32,116,104,101,32,102,105,114,115,116,32,49,54,32,98,121,
+    116,101,115,32,97,114,101,10,32,32,32,32,114,101,113,117,
+    105,114,101,100,44,32,116,104,111,117,103,104,46,41,10,10,
+    32,32,32,32,42,110,97,109,101,42,32,105,115,32,116,104,
+    101,32,110,97,109,101,32,111,102,32,116,104,101,32,109,111,
+    100,117,108,101,32,98,101,105,110,103,32,105,109,112,111,114,
+    116,101,100,46,32,73,116,32,105,115,32,117,115,101,100,32,
+    102,111,114,32,108,111,103,103,105,110,103,46,10,10,32,32,
+    32,32,42,101,120,99,95,100,101,116,97,105,108,115,42,32,
+    105,115,32,97,32,100,105,99,116,105,111,110,97,114,121,32,
+    112,97,115,115,101,100,32,116,111,32,73,109,112,111,114,116,
+    69,114,114,111,114,32,105,102,32,105,116,32,114,97,105,115,
+    101,100,32,102,111,114,10,32,32,32,32,105,109,112,114,111,
+    118,101,100,32,100,101,98,117,103,103,105,110,103,46,10,10,
+    32,32,32,32,73,109,112,111,114,116,69,114,114,111,114,32,
+    105,115,32,114,97,105,115,101,100,32,119,104,101,110,32,116,
+    104,101,32,109,97,103,105,99,32,110,117,109,98,101,114,32,
+    105,115,32,105,110,99,111,114,114,101,99,116,32,111,114,32,
+    119,104,101,110,32,116,104,101,32,102,108,97,103,115,10,32,
+    32,32,32,102,105,101,108,100,32,105,115,32,105,110,118,97,
+    108,105,100,46,32,69,79,70,69,114,114,111,114,32,105,115,
+    32,114,97,105,115,101,100,32,119,104,101,110,32,116,104,101,
+    32,100,97,116,97,32,105,115,32,102,111,117,110,100,32,116,
+    111,32,98,101,32,116,114,117,110,99,97,116,101,100,46,10,
+    10,32,32,32,32,78,114,31,0,0,0,122,20,98,97,100,
+    32,109,97,103,105,99,32,110,117,109,98,101,114,32,105,110,
+    32,122,2,58,32,250,2,123,125,233,16,0,0,0,122,40,
+    114,101,97,99,104,101,100,32,69,79,70,32,119,104,105,108,
+    101,32,114,101,97,100,105,110,103,32,112,121,99,32,104,101,
+    97,100,101,114,32,111,102,32,233,8,0,0,0,233,252,255,
+    255,255,122,14,105,110,118,97,108,105,100,32,102,108,97,103,
+    115,32,122,4,32,105,110,32,41,7,218,12,77,65,71,73,
+    67,95,78,85,77,66,69,82,114,159,0,0,0,218,16,95,
+    118,101,114,98,111,115,101,95,109,101,115,115,97,103,101,114,
+    142,0,0,0,114,4,0,0,0,218,8,69,79,70,69,114,
+    114,111,114,114,42,0,0,0,41,6,114,41,0,0,0,114,
+    141,0,0,0,218,11,101,120,99,95,100,101,116,97,105,108,
+    115,90,5,109,97,103,105,99,114,117,0,0,0,114,16,0,
+    0,0,114,7,0,0,0,114,7,0,0,0,114,8,0,0,
+    0,218,13,95,99,108,97,115,115,105,102,121,95,112,121,99,
+    73,2,0,0,115,28,0,0,0,12,16,8,1,16,1,12,
+    1,16,1,12,1,10,1,12,1,8,1,16,1,8,2,16,
+    1,16,1,4,1,114,176,0,0,0,99,5,0,0,0,0,
+    0,0,0,0,0,0,0,6,0,0,0,4,0,0,0,67,
+    0,0,0,115,124,0,0,0,116,0,124,0,100,1,100,2,
+    133,2,25,0,131,1,124,1,100,3,64,0,107,3,114,31,
+    100,4,124,3,155,2,157,2,125,5,116,1,160,2,100,5,
+    124,5,161,2,1,0,116,3,124,5,102,1,105,0,124,4,
+    164,1,142,1,130,1,124,2,100,6,117,1,114,58,116,0,
+    124,0,100,2,100,7,133,2,25,0,131,1,124,2,100,3,
+    64,0,107,3,114,60,116,3,100,4,124,3,155,2,157,2,
+    102,1,105,0,124,4,164,1,142,1,130,1,100,6,83,0,
+    100,6,83,0,41,8,97,7,2,0,0,86,97,108,105,100,
+    97,116,101,32,97,32,112,121,99,32,97,103,97,105,110,115,
+    116,32,116,104,101,32,115,111,117,114,99,101,32,108,97,115,
+    116,45,109,111,100,105,102,105,101,100,32,116,105,109,101,46,
+    10,10,32,32,32,32,42,100,97,116,97,42,32,105,115,32,
+    116,104,101,32,99,111,110,116,101,110,116,115,32,111,102,32,
+    116,104,101,32,112,121,99,32,102,105,108,101,46,32,40,79,
+    110,108,121,32,116,104,101,32,102,105,114,115,116,32,49,54,
+    32,98,121,116,101,115,32,97,114,101,10,32,32,32,32,114,
+    101,113,117,105,114,101,100,46,41,10,10,32,32,32,32,42,
+    115,111,117,114,99,101,95,109,116,105,109,101,42,32,105,115,
+    32,116,104,101,32,108,97,115,116,32,109,111,100,105,102,105,
+    101,100,32,116,105,109,101,115,116,97,109,112,32,111,102,32,
+    116,104,101,32,115,111,117,114,99,101,32,102,105,108,101,46,
+    10,10,32,32,32,32,42,115,111,117,114,99,101,95,115,105,
+    122,101,42,32,105,115,32,78,111,110,101,32,111,114,32,116,
+    104,101,32,115,105,122,101,32,111,102,32,116,104,101,32,115,
+    111,117,114,99,101,32,102,105,108,101,32,105,110,32,98,121,
+    116,101,115,46,10,10,32,32,32,32,42,110,97,109,101,42,
+    32,105,115,32,116,104,101,32,110,97,109,101,32,111,102,32,
+    116,104,101,32,109,111,100,117,108,101,32,98,101,105,110,103,
+    32,105,109,112,111,114,116,101,100,46,32,73,116,32,105,115,
+    32,117,115,101,100,32,102,111,114,32,108,111,103,103,105,110,
+    103,46,10,10,32,32,32,32,42,101,120,99,95,100,101,116,
+    97,105,108,115,42,32,105,115,32,97,32,100,105,99,116,105,
+    111,110,97,114,121,32,112,97,115,115,101,100,32,116,111,32,
+    73,109,112,111,114,116,69,114,114,111,114,32,105,102,32,105,
+    116,32,114,97,105,115,101,100,32,102,111,114,10,32,32,32,
+    32,105,109,112,114,111,118,101,100,32,100,101,98,117,103,103,
+    105,110,103,46,10,10,32,32,32,32,65,110,32,73,109,112,
+    111,114,116,69,114,114,111,114,32,105,115,32,114,97,105,115,
+    101,100,32,105,102,32,116,104,101,32,98,121,116,101,99,111,
+    100,101,32,105,115,32,115,116,97,108,101,46,10,10,32,32,
+    32,32,114,170,0,0,0,233,12,0,0,0,114,30,0,0,
+    0,122,22,98,121,116,101,99,111,100,101,32,105,115,32,115,
+    116,97,108,101,32,102,111,114,32,114,168,0,0,0,78,114,
+    169,0,0,0,41,4,114,42,0,0,0,114,159,0,0,0,
+    114,173,0,0,0,114,142,0,0,0,41,6,114,41,0,0,
+    0,218,12,115,111,117,114,99,101,95,109,116,105,109,101,218,
+    11,115,111,117,114,99,101,95,115,105,122,101,114,141,0,0,
+    0,114,175,0,0,0,114,117,0,0,0,114,7,0,0,0,
+    114,7,0,0,0,114,8,0,0,0,218,23,95,118,97,108,
+    105,100,97,116,101,95,116,105,109,101,115,116,97,109,112,95,
+    112,121,99,106,2,0,0,115,18,0,0,0,24,19,10,1,
+    12,1,16,1,8,1,22,1,2,255,22,2,8,254,114,180,
+    0,0,0,99,4,0,0,0,0,0,0,0,0,0,0,0,
+    4,0,0,0,4,0,0,0,67,0,0,0,115,42,0,0,
+    0,124,0,100,1,100,2,133,2,25,0,124,1,107,3,114,
+    19,116,0,100,3,124,2,155,2,157,2,102,1,105,0,124,
+    3,164,1,142,1,130,1,100,4,83,0,41,5,97,243,1,
+    0,0,86,97,108,105,100,97,116,101,32,97,32,104,97,115,
+    104,45,98,97,115,101,100,32,112,121,99,32,98,121,32,99,
+    104,101,99,107,105,110,103,32,116,104,101,32,114,101,97,108,
+    32,115,111,117,114,99,101,32,104,97,115,104,32,97,103,97,
+    105,110,115,116,32,116,104,101,32,111,110,101,32,105,110,10,
+    32,32,32,32,116,104,101,32,112,121,99,32,104,101,97,100,
+    101,114,46,10,10,32,32,32,32,42,100,97,116,97,42,32,
+    105,115,32,116,104,101,32,99,111,110,116,101,110,116,115,32,
+    111,102,32,116,104,101,32,112,121,99,32,102,105,108,101,46,
+    32,40,79,110,108,121,32,116,104,101,32,102,105,114,115,116,
+    32,49,54,32,98,121,116,101,115,32,97,114,101,10,32,32,
+    32,32,114,101,113,117,105,114,101,100,46,41,10,10,32,32,
+    32,32,42,115,111,117,114,99,101,95,104,97,115,104,42,32,
+    105,115,32,116,104,101,32,105,109,112,111,114,116,108,105,98,
+    46,117,116,105,108,46,115,111,117,114,99,101,95,104,97,115,
+    104,40,41,32,111,102,32,116,104,101,32,115,111,117,114,99,
+    101,32,102,105,108,101,46,10,10,32,32,32,32,42,110,97,
+    109,101,42,32,105,115,32,116,104,101,32,110,97,109,101,32,
+    111,102,32,116,104,101,32,109,111,100,117,108,101,32,98,101,
+    105,110,103,32,105,109,112,111,114,116,101,100,46,32,73,116,
+    32,105,115,32,117,115,101,100,32,102,111,114,32,108,111,103,
+    103,105,110,103,46,10,10,32,32,32,32,42,101,120,99,95,
+    100,101,116,97,105,108,115,42,32,105,115,32,97,32,100,105,
+    99,116,105,111,110,97,114,121,32,112,97,115,115,101,100,32,
+    116,111,32,73,109,112,111,114,116,69,114,114,111,114,32,105,
+    102,32,105,116,32,114,97,105,115,101,100,32,102,111,114,10,
+    32,32,32,32,105,109,112,114,111,118,101,100,32,100,101,98,
+    117,103,103,105,110,103,46,10,10,32,32,32,32,65,110,32,
+    73,109,112,111,114,116,69,114,114,111,114,32,105,115,32,114,
+    97,105,115,101,100,32,105,102,32,116,104,101,32,98,121,116,
+    101,99,111,100,101,32,105,115,32,115,116,97,108,101,46,10,
+    10,32,32,32,32,114,170,0,0,0,114,169,0,0,0,122,
+    46,104,97,115,104,32,105,110,32,98,121,116,101,99,111,100,
+    101,32,100,111,101,115,110,39,116,32,109,97,116,99,104,32,
+    104,97,115,104,32,111,102,32,115,111,117,114,99,101,32,78,
+    41,1,114,142,0,0,0,41,4,114,41,0,0,0,218,11,
+    115,111,117,114,99,101,95,104,97,115,104,114,141,0,0,0,
+    114,175,0,0,0,114,7,0,0,0,114,7,0,0,0,114,
+    8,0,0,0,218,18,95,118,97,108,105,100,97,116,101,95,
+    104,97,115,104,95,112,121,99,134,2,0,0,115,14,0,0,
+    0,16,17,2,1,8,1,4,255,2,2,6,254,4,255,114,
+    182,0,0,0,99,4,0,0,0,0,0,0,0,0,0,0,
+    0,5,0,0,0,5,0,0,0,67,0,0,0,115,76,0,
+    0,0,116,0,160,1,124,0,161,1,125,4,116,2,124,4,
+    116,3,131,2,114,28,116,4,160,5,100,1,124,2,161,2,
+    1,0,124,3,100,2,117,1,114,26,116,6,160,7,124,4,
+    124,3,161,2,1,0,124,4,83,0,116,8,100,3,160,9,
+    124,2,161,1,124,1,124,2,100,4,141,3,130,1,41,5,
+    122,35,67,111,109,112,105,108,101,32,98,121,116,101,99,111,
+    100,101,32,97,115,32,102,111,117,110,100,32,105,110,32,97,
+    32,112,121,99,46,122,21,99,111,100,101,32,111,98,106,101,
+    99,116,32,102,114,111,109,32,123,33,114,125,78,122,23,78,
+    111,110,45,99,111,100,101,32,111,98,106,101,99,116,32,105,
+    110,32,123,33,114,125,169,2,114,141,0,0,0,114,65,0,
+    0,0,41,10,218,7,109,97,114,115,104,97,108,90,5,108,
+    111,97,100,115,218,10,105,115,105,110,115,116,97,110,99,101,
+    218,10,95,99,111,100,101,95,116,121,112,101,114,159,0,0,
+    0,114,173,0,0,0,218,4,95,105,109,112,90,16,95,102,
+    105,120,95,99,111,95,102,105,108,101,110,97,109,101,114,142,
+    0,0,0,114,89,0,0,0,41,5,114,41,0,0,0,114,
+    141,0,0,0,114,132,0,0,0,114,134,0,0,0,218,4,
+    99,111,100,101,114,7,0,0,0,114,7,0,0,0,114,8,
+    0,0,0,218,17,95,99,111,109,112,105,108,101,95,98,121,
+    116,101,99,111,100,101,158,2,0,0,115,18,0,0,0,10,
+    2,10,1,12,1,8,1,12,1,4,1,10,2,4,1,6,
+    255,114,189,0,0,0,99,3,0,0,0,0,0,0,0,0,
+    0,0,0,4,0,0,0,5,0,0,0,67,0,0,0,115,
+    70,0,0,0,116,0,116,1,131,1,125,3,124,3,160,2,
+    116,3,100,1,131,1,161,1,1,0,124,3,160,2,116,3,
+    124,1,131,1,161,1,1,0,124,3,160,2,116,3,124,2,
+    131,1,161,1,1,0,124,3,160,2,116,4,160,5,124,0,
+    161,1,161,1,1,0,124,3,83,0,41,2,122,43,80,114,
+    111,100,117,99,101,32,116,104,101,32,100,97,116,97,32,102,
+    111,114,32,97,32,116,105,109,101,115,116,97,109,112,45,98,
+    97,115,101,100,32,112,121,99,46,114,0,0,0,0,41,6,
+    218,9,98,121,116,101,97,114,114,97,121,114,172,0,0,0,
+    218,6,101,120,116,101,110,100,114,36,0,0,0,114,184,0,
+    0,0,218,5,100,117,109,112,115,41,4,114,188,0,0,0,
+    218,5,109,116,105,109,101,114,179,0,0,0,114,41,0,0,
+    0,114,7,0,0,0,114,7,0,0,0,114,8,0,0,0,
+    218,22,95,99,111,100,101,95,116,111,95,116,105,109,101,115,
+    116,97,109,112,95,112,121,99,171,2,0,0,115,12,0,0,
+    0,8,2,14,1,14,1,14,1,16,1,4,1,114,194,0,
+    0,0,84,99,3,0,0,0,0,0,0,0,0,0,0,0,
+    5,0,0,0,5,0,0,0,67,0,0,0,115,80,0,0,
+    0,116,0,116,1,131,1,125,3,100,1,124,2,100,1,62,
+    0,66,0,125,4,124,3,160,2,116,3,124,4,131,1,161,
+    1,1,0,116,4,124,1,131,1,100,2,107,2,115,25,74,
+    0,130,1,124,3,160,2,124,1,161,1,1,0,124,3,160,
+    2,116,5,160,6,124,0,161,1,161,1,1,0,124,3,83,
+    0,41,3,122,38,80,114,111,100,117,99,101,32,116,104,101,
+    32,100,97,116,97,32,102,111,114,32,97,32,104,97,115,104,
+    45,98,97,115,101,100,32,112,121,99,46,114,3,0,0,0,
+    114,170,0,0,0,41,7,114,190,0,0,0,114,172,0,0,
+    0,114,191,0,0,0,114,36,0,0,0,114,4,0,0,0,
+    114,184,0,0,0,114,192,0,0,0,41,5,114,188,0,0,
+    0,114,181,0,0,0,90,7,99,104,101,99,107,101,100,114,
+    41,0,0,0,114,16,0,0,0,114,7,0,0,0,114,7,
+    0,0,0,114,8,0,0,0,218,17,95,99,111,100,101,95,
+    116,111,95,104,97,115,104,95,112,121,99,181,2,0,0,115,
+    14,0,0,0,8,2,12,1,14,1,16,1,10,1,16,1,
+    4,1,114,195,0,0,0,99,1,0,0,0,0,0,0,0,
+    0,0,0,0,5,0,0,0,6,0,0,0,67,0,0,0,
+    115,62,0,0,0,100,1,100,2,108,0,125,1,116,1,160,
+    2,124,0,161,1,106,3,125,2,124,1,160,4,124,2,161,
+    1,125,3,116,1,160,5,100,2,100,3,161,2,125,4,124,
+    4,160,6,124,0,160,6,124,3,100,1,25,0,161,1,161,
+    1,83,0,41,4,122,121,68,101,99,111,100,101,32,98,121,
+    116,101,115,32,114,101,112,114,101,115,101,110,116,105,110,103,
+    32,115,111,117,114,99,101,32,99,111,100,101,32,97,110,100,
+    32,114,101,116,117,114,110,32,116,104,101,32,115,116,114,105,
+    110,103,46,10,10,32,32,32,32,85,110,105,118,101,114,115,
+    97,108,32,110,101,119,108,105,110,101,32,115,117,112,112,111,
+    114,116,32,105,115,32,117,115,101,100,32,105,110,32,116,104,
+    101,32,100,101,99,111,100,105,110,103,46,10,32,32,32,32,
+    114,0,0,0,0,78,84,41,7,218,8,116,111,107,101,110,
+    105,122,101,114,91,0,0,0,90,7,66,121,116,101,115,73,
+    79,90,8,114,101,97,100,108,105,110,101,90,15,100,101,116,
+    101,99,116,95,101,110,99,111,100,105,110,103,90,25,73,110,
+    99,114,101,109,101,110,116,97,108,78,101,119,108,105,110,101,
+    68,101,99,111,100,101,114,218,6,100,101,99,111,100,101,41,
+    5,218,12,115,111,117,114,99,101,95,98,121,116,101,115,114,
+    196,0,0,0,90,21,115,111,117,114,99,101,95,98,121,116,
+    101,115,95,114,101,97,100,108,105,110,101,218,8,101,110,99,
+    111,100,105,110,103,90,15,110,101,119,108,105,110,101,95,100,
+    101,99,111,100,101,114,114,7,0,0,0,114,7,0,0,0,
+    114,8,0,0,0,218,13,100,101,99,111,100,101,95,115,111,
+    117,114,99,101,192,2,0,0,115,10,0,0,0,8,5,12,
+    1,10,1,12,1,20,1,114,200,0,0,0,169,2,114,164,
+    0,0,0,218,26,115,117,98,109,111,100,117,108,101,95,115,
+    101,97,114,99,104,95,108,111,99,97,116,105,111,110,115,99,
+    2,0,0,0,0,0,0,0,2,0,0,0,9,0,0,0,
+    8,0,0,0,67,0,0,0,115,54,1,0,0,124,1,100,
+    1,117,0,114,29,100,2,125,1,116,0,124,2,100,3,131,
+    2,114,28,122,7,124,2,160,1,124,0,161,1,125,1,87,
+    0,110,38,4,0,116,2,121,27,1,0,1,0,1,0,89,
+    0,110,30,119,0,110,28,116,3,160,4,124,1,161,1,125,
+    1,116,5,124,1,131,1,115,57,122,9,116,6,116,3,160,
+    7,161,0,124,1,131,2,125,1,87,0,110,9,4,0,116,
+    8,121,56,1,0,1,0,1,0,89,0,110,1,119,0,116,
+    9,106,10,124,0,124,2,124,1,100,4,141,3,125,4,100,
+    5,124,4,95,11,124,2,100,1,117,0,114,99,116,12,131,
+    0,68,0,93,21,92,2,125,5,125,6,124,1,160,13,116,
+    14,124,6,131,1,161,1,114,96,124,5,124,0,124,1,131,
+    2,125,2,124,2,124,4,95,15,1,0,110,3,113,75,100,
+    1,83,0,124,3,116,16,117,0,114,131,116,0,124,2,100,
+    6,131,2,114,130,122,7,124,2,160,17,124,0,161,1,125,
+    7,87,0,110,9,4,0,116,2,121,124,1,0,1,0,1,
+    0,89,0,110,10,119,0,124,7,114,130,103,0,124,4,95,
+    18,110,3,124,3,124,4,95,18,124,4,106,18,103,0,107,
+    2,114,153,124,1,114,153,116,19,124,1,131,1,100,7,25,
+    0,125,8,124,4,106,18,160,20,124,8,161,1,1,0,124,
+    4,83,0,41,8,97,61,1,0,0,82,101,116,117,114,110,
+    32,97,32,109,111,100,117,108,101,32,115,112,101,99,32,98,
+    97,115,101,100,32,111,110,32,97,32,102,105,108,101,32,108,
+    111,99,97,116,105,111,110,46,10,10,32,32,32,32,84,111,
+    32,105,110,100,105,99,97,116,101,32,116,104,97,116,32,116,
+    104,101,32,109,111,100,117,108,101,32,105,115,32,97,32,112,
+    97,99,107,97,103,101,44,32,115,101,116,10,32,32,32,32,
+    115,117,98,109,111,100,117,108,101,95,115,101,97,114,99,104,
+    95,108,111,99,97,116,105,111,110,115,32,116,111,32,97,32,
+    108,105,115,116,32,111,102,32,100,105,114,101,99,116,111,114,
+    121,32,112,97,116,104,115,46,32,32,65,110,10,32,32,32,
+    32,101,109,112,116,121,32,108,105,115,116,32,105,115,32,115,
+    117,102,102,105,99,105,101,110,116,44,32,116,104,111,117,103,
+    104,32,105,116,115,32,110,111,116,32,111,116,104,101,114,119,
+    105,115,101,32,117,115,101,102,117,108,32,116,111,32,116,104,
+    101,10,32,32,32,32,105,109,112,111,114,116,32,115,121,115,
+    116,101,109,46,10,10,32,32,32,32,84,104,101,32,108,111,
+    97,100,101,114,32,109,117,115,116,32,116,97,107,101,32,97,
+    32,115,112,101,99,32,97,115,32,105,116,115,32,111,110,108,
+    121,32,95,95,105,110,105,116,95,95,40,41,32,97,114,103,
+    46,10,10,32,32,32,32,78,122,9,60,117,110,107,110,111,
+    119,110,62,218,12,103,101,116,95,102,105,108,101,110,97,109,
+    101,169,1,218,6,111,114,105,103,105,110,84,218,10,105,115,
+    95,112,97,99,107,97,103,101,114,0,0,0,0,41,21,114,
+    153,0,0,0,114,203,0,0,0,114,142,0,0,0,114,18,
+    0,0,0,114,103,0,0,0,114,86,0,0,0,114,67,0,
+    0,0,114,82,0,0,0,114,76,0,0,0,114,159,0,0,
+    0,218,10,77,111,100,117,108,101,83,112,101,99,90,13,95,
+    115,101,116,95,102,105,108,101,97,116,116,114,218,27,95,103,
+    101,116,95,115,117,112,112,111,114,116,101,100,95,102,105,108,
+    101,95,108,111,97,100,101,114,115,114,58,0,0,0,114,136,
+    0,0,0,114,164,0,0,0,218,9,95,80,79,80,85,76,
+    65,84,69,114,206,0,0,0,114,202,0,0,0,114,74,0,
+    0,0,114,61,0,0,0,41,9,114,141,0,0,0,90,8,
+    108,111,99,97,116,105,111,110,114,164,0,0,0,114,202,0,
+    0,0,218,4,115,112,101,99,218,12,108,111,97,100,101,114,
+    95,99,108,97,115,115,218,8,115,117,102,102,105,120,101,115,
+    114,206,0,0,0,90,7,100,105,114,110,97,109,101,114,7,
+    0,0,0,114,7,0,0,0,114,8,0,0,0,218,23,115,
+    112,101,99,95,102,114,111,109,95,102,105,108,101,95,108,111,
+    99,97,116,105,111,110,209,2,0,0,115,84,0,0,0,8,
+    12,4,4,10,1,2,2,14,1,12,1,4,1,2,255,2,
+    252,10,7,8,1,2,1,18,1,12,1,4,1,2,255,16,
+    9,6,1,8,3,14,1,14,1,10,1,6,1,4,1,2,
+    253,4,5,8,3,10,2,2,1,14,1,12,1,4,1,2,
+    255,4,3,6,1,2,128,6,2,10,1,4,1,12,1,12,
+    1,4,2,114,213,0,0,0,99,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,4,0,0,0,64,0,0,
+    0,115,88,0,0,0,101,0,90,1,100,0,90,2,100,1,
+    90,3,100,2,90,4,100,3,90,5,101,6,111,15,100,4,
+    101,7,118,0,90,8,101,9,100,5,100,6,132,0,131,1,
+    90,10,101,11,100,7,100,8,132,0,131,1,90,12,101,11,
+    100,14,100,10,100,11,132,1,131,1,90,13,101,11,100,15,
+    100,12,100,13,132,1,131,1,90,14,100,9,83,0,41,16,
+    218,21,87,105,110,100,111,119,115,82,101,103,105,115,116,114,
+    121,70,105,110,100,101,114,122,62,77,101,116,97,32,112,97,
+    116,104,32,102,105,110,100,101,114,32,102,111,114,32,109,111,
+    100,117,108,101,115,32,100,101,99,108,97,114,101,100,32,105,
+    110,32,116,104,101,32,87,105,110,100,111,119,115,32,114,101,
+    103,105,115,116,114,121,46,122,59,83,111,102,116,119,97,114,
+    101,92,80,121,116,104,111,110,92,80,121,116,104,111,110,67,
+    111,114,101,92,123,115,121,115,95,118,101,114,115,105,111,110,
+    125,92,77,111,100,117,108,101,115,92,123,102,117,108,108,110,
+    97,109,101,125,122,65,83,111,102,116,119,97,114,101,92,80,
+    121,116,104,111,110,92,80,121,116,104,111,110,67,111,114,101,
+    92,123,115,121,115,95,118,101,114,115,105,111,110,125,92,77,
+    111,100,117,108,101,115,92,123,102,117,108,108,110,97,109,101,
+    125,92,68,101,98,117,103,122,6,95,100,46,112,121,100,99,
+    1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,
+    8,0,0,0,67,0,0,0,115,50,0,0,0,122,8,116,
+    0,160,1,116,0,106,2,124,0,161,2,87,0,83,0,4,
+    0,116,3,121,24,1,0,1,0,1,0,116,0,160,1,116,
+    0,106,4,124,0,161,2,6,0,89,0,83,0,119,0,114,
+    69,0,0,0,41,5,218,6,119,105,110,114,101,103,90,7,
+    79,112,101,110,75,101,121,90,17,72,75,69,89,95,67,85,
+    82,82,69,78,84,95,85,83,69,82,114,76,0,0,0,90,
+    18,72,75,69,89,95,76,79,67,65,76,95,77,65,67,72,
+    73,78,69,114,19,0,0,0,114,7,0,0,0,114,7,0,
+    0,0,114,8,0,0,0,218,14,95,111,112,101,110,95,114,
+    101,103,105,115,116,114,121,38,3,0,0,115,10,0,0,0,
+    2,2,16,1,12,1,18,1,2,255,122,36,87,105,110,100,
     111,119,115,82,101,103,105,115,116,114,121,70,105,110,100,101,
-    114,122,62,77,101,116,97,32,112,97,116,104,32,102,105,110,
-    100,101,114,32,102,111,114,32,109,111,100,117,108,101,115,32,
-    100,101,99,108,97,114,101,100,32,105,110,32,116,104,101,32,
-    87,105,110,100,111,119,115,32,114,101,103,105,115,116,114,121,
-    46,122,59,83,111,102,116,119,97,114,101,92,80,121,116,104,
-    111,110,92,80,121,116,104,111,110,67,111,114,101,92,123,115,
-    121,115,95,118,101,114,115,105,111,110,125,92,77,111,100,117,
-    108,101,115,92,123,102,117,108,108,110,97,109,101,125,122,65,
-    83,111,102,116,119,97,114,101,92,80,121,116,104,111,110,92,
-    80,121,116,104,111,110,67,111,114,101,92,123,115,121,115,95,
-    118,101,114,115,105,111,110,125,92,77,111,100,117,108,101,115,
-    92,123,102,117,108,108,110,97,109,101,125,92,68,101,98,117,
-    103,70,99,2,0,0,0,0,0,0,0,0,0,0,0,2,
-    0,0,0,8,0,0,0,67,0,0,0,115,54,0,0,0,
-    122,16,116,0,160,1,116,0,106,2,124,1,161,2,87,0,
-    83,0,4,0,116,3,121,48,1,0,1,0,1,0,116,0,
-    160,1,116,0,106,4,124,1,161,2,6,0,89,0,83,0,
-    48,0,100,0,83,0,114,109,0,0,0,41,5,218,6,119,
-    105,110,114,101,103,90,7,79,112,101,110,75,101,121,90,17,
-    72,75,69,89,95,67,85,82,82,69,78,84,95,85,83,69,
-    82,114,50,0,0,0,90,18,72,75,69,89,95,76,79,67,
-    65,76,95,77,65,67,72,73,78,69,41,2,218,3,99,108,
-    115,114,7,0,0,0,114,5,0,0,0,114,5,0,0,0,
-    114,8,0,0,0,218,14,95,111,112,101,110,95,114,101,103,
-    105,115,116,114,121,204,2,0,0,115,8,0,0,0,0,2,
-    2,1,16,1,12,1,122,36,87,105,110,100,111,119,115,82,
-    101,103,105,115,116,114,121,70,105,110,100,101,114,46,95,111,
-    112,101,110,95,114,101,103,105,115,116,114,121,99,2,0,0,
-    0,0,0,0,0,0,0,0,0,6,0,0,0,8,0,0,
-    0,67,0,0,0,115,132,0,0,0,124,0,106,0,114,14,
-    124,0,106,1,125,2,110,6,124,0,106,2,125,2,124,2,
-    106,3,124,1,100,1,116,4,106,5,100,0,100,2,133,2,
-    25,0,22,0,100,3,141,2,125,3,122,58,124,0,160,6,
-    124,3,161,1,143,28,125,4,116,7,160,8,124,4,100,4,
-    161,2,125,5,87,0,100,0,4,0,4,0,131,3,1,0,
-    110,16,49,0,115,94,48,0,1,0,1,0,1,0,89,0,
-    1,0,87,0,110,20,4,0,116,9,121,126,1,0,1,0,
-    1,0,89,0,100,0,83,0,48,0,124,5,83,0,41,5,
-    78,122,5,37,100,46,37,100,114,28,0,0,0,41,2,114,
-    139,0,0,0,90,11,115,121,115,95,118,101,114,115,105,111,
-    110,114,40,0,0,0,41,10,218,11,68,69,66,85,71,95,
-    66,85,73,76,68,218,18,82,69,71,73,83,84,82,89,95,
-    75,69,89,95,68,69,66,85,71,218,12,82,69,71,73,83,
-    84,82,89,95,75,69,89,114,62,0,0,0,114,1,0,0,
-    0,218,12,118,101,114,115,105,111,110,95,105,110,102,111,114,
-    194,0,0,0,114,192,0,0,0,90,10,81,117,101,114,121,
-    86,97,108,117,101,114,50,0,0,0,41,6,114,193,0,0,
-    0,114,139,0,0,0,90,12,114,101,103,105,115,116,114,121,
-    95,107,101,121,114,7,0,0,0,90,4,104,107,101,121,218,
-    8,102,105,108,101,112,97,116,104,114,5,0,0,0,114,5,
-    0,0,0,114,8,0,0,0,218,16,95,115,101,97,114,99,
-    104,95,114,101,103,105,115,116,114,121,211,2,0,0,115,24,
-    0,0,0,0,2,6,1,8,2,6,1,6,1,16,255,6,
-    2,2,1,12,1,46,1,12,1,8,1,122,38,87,105,110,
-    100,111,119,115,82,101,103,105,115,116,114,121,70,105,110,100,
-    101,114,46,95,115,101,97,114,99,104,95,114,101,103,105,115,
-    116,114,121,78,99,4,0,0,0,0,0,0,0,0,0,0,
-    0,8,0,0,0,8,0,0,0,67,0,0,0,115,120,0,
-    0,0,124,0,160,0,124,1,161,1,125,4,124,4,100,0,
-    117,0,114,22,100,0,83,0,122,12,116,1,124,4,131,1,
-    1,0,87,0,110,20,4,0,116,2,121,54,1,0,1,0,
-    1,0,89,0,100,0,83,0,48,0,116,3,131,0,68,0,
-    93,52,92,2,125,5,125,6,124,4,160,4,116,5,124,6,
-    131,1,161,1,114,62,116,6,106,7,124,1,124,5,124,1,
-    124,4,131,2,124,4,100,1,141,3,125,7,124,7,2,0,
-    1,0,83,0,113,62,100,0,83,0,41,2,78,114,180,0,
-    0,0,41,8,114,200,0,0,0,114,49,0,0,0,114,50,
-    0,0,0,114,184,0,0,0,114,110,0,0,0,114,111,0,
-    0,0,114,134,0,0,0,218,16,115,112,101,99,95,102,114,
-    111,109,95,108,111,97,100,101,114,41,8,114,193,0,0,0,
-    114,139,0,0,0,114,44,0,0,0,218,6,116,97,114,103,
-    101,116,114,199,0,0,0,114,140,0,0,0,114,189,0,0,
-    0,114,187,0,0,0,114,5,0,0,0,114,5,0,0,0,
-    114,8,0,0,0,218,9,102,105,110,100,95,115,112,101,99,
-    226,2,0,0,115,28,0,0,0,0,2,10,1,8,1,4,
-    1,2,1,12,1,12,1,8,1,14,1,14,1,6,1,8,
-    1,2,254,6,3,122,31,87,105,110,100,111,119,115,82,101,
-    103,105,115,116,114,121,70,105,110,100,101,114,46,102,105,110,
-    100,95,115,112,101,99,99,3,0,0,0,0,0,0,0,0,
-    0,0,0,4,0,0,0,4,0,0,0,67,0,0,0,115,
-    34,0,0,0,124,0,160,0,124,1,124,2,161,2,125,3,
-    124,3,100,1,117,1,114,26,124,3,106,1,83,0,100,1,
-    83,0,100,1,83,0,41,2,122,108,70,105,110,100,32,109,
-    111,100,117,108,101,32,110,97,109,101,100,32,105,110,32,116,
-    104,101,32,114,101,103,105,115,116,114,121,46,10,10,32,32,
-    32,32,32,32,32,32,84,104,105,115,32,109,101,116,104,111,
-    100,32,105,115,32,100,101,112,114,101,99,97,116,101,100,46,
-    32,32,85,115,101,32,101,120,101,99,95,109,111,100,117,108,
-    101,40,41,32,105,110,115,116,101,97,100,46,10,10,32,32,
-    32,32,32,32,32,32,78,169,2,114,203,0,0,0,114,140,
-    0,0,0,169,4,114,193,0,0,0,114,139,0,0,0,114,
-    44,0,0,0,114,187,0,0,0,114,5,0,0,0,114,5,
-    0,0,0,114,8,0,0,0,218,11,102,105,110,100,95,109,
-    111,100,117,108,101,242,2,0,0,115,8,0,0,0,0,7,
-    12,1,8,1,6,2,122,33,87,105,110,100,111,119,115,82,
-    101,103,105,115,116,114,121,70,105,110,100,101,114,46,102,105,
-    110,100,95,109,111,100,117,108,101,41,2,78,78,41,1,78,
-    41,12,114,125,0,0,0,114,124,0,0,0,114,126,0,0,
-    0,114,127,0,0,0,114,197,0,0,0,114,196,0,0,0,
-    114,195,0,0,0,218,11,99,108,97,115,115,109,101,116,104,
-    111,100,114,194,0,0,0,114,200,0,0,0,114,203,0,0,
-    0,114,206,0,0,0,114,5,0,0,0,114,5,0,0,0,
-    114,5,0,0,0,114,8,0,0,0,114,191,0,0,0,192,
-    2,0,0,115,28,0,0,0,8,2,4,3,2,255,2,4,
-    2,255,2,3,4,2,2,1,10,6,2,1,10,14,2,1,
-    12,15,2,1,114,191,0,0,0,99,0,0,0,0,0,0,
-    0,0,0,0,0,0,0,0,0,0,2,0,0,0,64,0,
-    0,0,115,48,0,0,0,101,0,90,1,100,0,90,2,100,
-    1,90,3,100,2,100,3,132,0,90,4,100,4,100,5,132,
-    0,90,5,100,6,100,7,132,0,90,6,100,8,100,9,132,
-    0,90,7,100,10,83,0,41,11,218,13,95,76,111,97,100,
-    101,114,66,97,115,105,99,115,122,83,66,97,115,101,32,99,
-    108,97,115,115,32,111,102,32,99,111,109,109,111,110,32,99,
-    111,100,101,32,110,101,101,100,101,100,32,98,121,32,98,111,
-    116,104,32,83,111,117,114,99,101,76,111,97,100,101,114,32,
-    97,110,100,10,32,32,32,32,83,111,117,114,99,101,108,101,
-    115,115,70,105,108,101,76,111,97,100,101,114,46,99,2,0,
-    0,0,0,0,0,0,0,0,0,0,5,0,0,0,4,0,
-    0,0,67,0,0,0,115,64,0,0,0,116,0,124,0,160,
-    1,124,1,161,1,131,1,100,1,25,0,125,2,124,2,160,
-    2,100,2,100,1,161,2,100,3,25,0,125,3,124,1,160,
-    3,100,2,161,1,100,4,25,0,125,4,124,3,100,5,107,
-    2,111,62,124,4,100,5,107,3,83,0,41,6,122,141,67,
-    111,110,99,114,101,116,101,32,105,109,112,108,101,109,101,110,
-    116,97,116,105,111,110,32,111,102,32,73,110,115,112,101,99,
-    116,76,111,97,100,101,114,46,105,115,95,112,97,99,107,97,
-    103,101,32,98,121,32,99,104,101,99,107,105,110,103,32,105,
-    102,10,32,32,32,32,32,32,32,32,116,104,101,32,112,97,
-    116,104,32,114,101,116,117,114,110,101,100,32,98,121,32,103,
-    101,116,95,102,105,108,101,110,97,109,101,32,104,97,115,32,
-    97,32,102,105,108,101,110,97,109,101,32,111,102,32,39,95,
-    95,105,110,105,116,95,95,46,112,121,39,46,114,39,0,0,
-    0,114,71,0,0,0,114,73,0,0,0,114,28,0,0,0,
-    218,8,95,95,105,110,105,116,95,95,41,4,114,47,0,0,
-    0,114,179,0,0,0,114,43,0,0,0,114,41,0,0,0,
-    41,5,114,118,0,0,0,114,139,0,0,0,114,96,0,0,
-    0,90,13,102,105,108,101,110,97,109,101,95,98,97,115,101,
-    90,9,116,97,105,108,95,110,97,109,101,114,5,0,0,0,
-    114,5,0,0,0,114,8,0,0,0,114,182,0,0,0,5,
-    3,0,0,115,8,0,0,0,0,3,18,1,16,1,14,1,
-    122,24,95,76,111,97,100,101,114,66,97,115,105,99,115,46,
-    105,115,95,112,97,99,107,97,103,101,99,2,0,0,0,0,
-    0,0,0,0,0,0,0,2,0,0,0,1,0,0,0,67,
-    0,0,0,115,4,0,0,0,100,1,83,0,169,2,122,42,
+    114,46,95,111,112,101,110,95,114,101,103,105,115,116,114,121,
+    99,2,0,0,0,0,0,0,0,0,0,0,0,6,0,0,
+    0,8,0,0,0,67,0,0,0,115,134,0,0,0,124,0,
+    106,0,114,7,124,0,106,1,125,2,110,3,124,0,106,2,
+    125,2,124,2,106,3,124,1,100,1,116,4,106,5,100,0,
+    100,2,133,2,25,0,22,0,100,3,141,2,125,3,122,32,
+    124,0,160,6,124,3,161,1,143,16,125,4,116,7,160,8,
+    124,4,100,4,161,2,125,5,87,0,100,0,4,0,4,0,
+    131,3,1,0,87,0,124,5,83,0,49,0,115,49,119,1,
+    1,0,1,0,1,0,89,0,1,0,87,0,124,5,83,0,
+    4,0,116,9,121,66,1,0,1,0,1,0,89,0,100,0,
+    83,0,119,0,41,5,78,122,5,37,100,46,37,100,114,44,
+    0,0,0,41,2,114,163,0,0,0,90,11,115,121,115,95,
+    118,101,114,115,105,111,110,114,10,0,0,0,41,10,218,11,
+    68,69,66,85,71,95,66,85,73,76,68,218,18,82,69,71,
+    73,83,84,82,89,95,75,69,89,95,68,69,66,85,71,218,
+    12,82,69,71,73,83,84,82,89,95,75,69,89,114,89,0,
+    0,0,114,15,0,0,0,218,12,118,101,114,115,105,111,110,
+    95,105,110,102,111,114,216,0,0,0,114,215,0,0,0,90,
+    10,81,117,101,114,121,86,97,108,117,101,114,76,0,0,0,
+    41,6,218,3,99,108,115,114,163,0,0,0,90,12,114,101,
+    103,105,115,116,114,121,95,107,101,121,114,20,0,0,0,90,
+    4,104,107,101,121,218,8,102,105,108,101,112,97,116,104,114,
+    7,0,0,0,114,7,0,0,0,114,8,0,0,0,218,16,
+    95,115,101,97,114,99,104,95,114,101,103,105,115,116,114,121,
+    45,3,0,0,115,32,0,0,0,6,2,8,1,6,2,6,
+    1,16,1,6,255,2,2,12,1,14,1,12,255,4,4,18,
+    252,4,4,12,254,6,1,2,255,122,38,87,105,110,100,111,
+    119,115,82,101,103,105,115,116,114,121,70,105,110,100,101,114,
+    46,95,115,101,97,114,99,104,95,114,101,103,105,115,116,114,
+    121,78,99,4,0,0,0,0,0,0,0,0,0,0,0,8,
+    0,0,0,8,0,0,0,67,0,0,0,115,120,0,0,0,
+    124,0,160,0,124,1,161,1,125,4,124,4,100,0,117,0,
+    114,11,100,0,83,0,122,6,116,1,124,4,131,1,1,0,
+    87,0,110,10,4,0,116,2,121,27,1,0,1,0,1,0,
+    89,0,100,0,83,0,119,0,116,3,131,0,68,0,93,26,
+    92,2,125,5,125,6,124,4,160,4,116,5,124,6,131,1,
+    161,1,114,57,116,6,106,7,124,1,124,5,124,1,124,4,
+    131,2,124,4,100,1,141,3,125,7,124,7,2,0,1,0,
+    83,0,113,31,100,0,83,0,41,2,78,114,204,0,0,0,
+    41,8,114,223,0,0,0,114,75,0,0,0,114,76,0,0,
+    0,114,208,0,0,0,114,58,0,0,0,114,136,0,0,0,
+    114,159,0,0,0,218,16,115,112,101,99,95,102,114,111,109,
+    95,108,111,97,100,101,114,41,8,114,221,0,0,0,114,163,
+    0,0,0,114,65,0,0,0,218,6,116,97,114,103,101,116,
+    114,222,0,0,0,114,164,0,0,0,114,212,0,0,0,114,
+    210,0,0,0,114,7,0,0,0,114,7,0,0,0,114,8,
+    0,0,0,218,9,102,105,110,100,95,115,112,101,99,60,3,
+    0,0,115,34,0,0,0,10,2,8,1,4,1,2,1,12,
+    1,12,1,6,1,2,255,14,2,14,1,6,1,8,1,2,
+    1,6,254,8,3,2,252,4,255,122,31,87,105,110,100,111,
+    119,115,82,101,103,105,115,116,114,121,70,105,110,100,101,114,
+    46,102,105,110,100,95,115,112,101,99,99,3,0,0,0,0,
+    0,0,0,0,0,0,0,4,0,0,0,4,0,0,0,67,
+    0,0,0,115,42,0,0,0,116,0,160,1,100,1,116,2,
+    161,2,1,0,124,0,160,3,124,1,124,2,161,2,125,3,
+    124,3,100,2,117,1,114,19,124,3,106,4,83,0,100,2,
+    83,0,41,3,122,106,70,105,110,100,32,109,111,100,117,108,
+    101,32,110,97,109,101,100,32,105,110,32,116,104,101,32,114,
+    101,103,105,115,116,114,121,46,10,10,32,32,32,32,32,32,
+    32,32,84,104,105,115,32,109,101,116,104,111,100,32,105,115,
+    32,100,101,112,114,101,99,97,116,101,100,46,32,32,85,115,
+    101,32,102,105,110,100,95,115,112,101,99,40,41,32,105,110,
+    115,116,101,97,100,46,10,10,32,32,32,32,32,32,32,32,
+    122,112,87,105,110,100,111,119,115,82,101,103,105,115,116,114,
+    121,70,105,110,100,101,114,46,102,105,110,100,95,109,111,100,
+    117,108,101,40,41,32,105,115,32,100,101,112,114,101,99,97,
+    116,101,100,32,97,110,100,32,115,108,97,116,101,100,32,102,
+    111,114,32,114,101,109,111,118,97,108,32,105,110,32,80,121,
+    116,104,111,110,32,51,46,49,50,59,32,117,115,101,32,102,
+    105,110,100,95,115,112,101,99,40,41,32,105,110,115,116,101,
+    97,100,78,169,5,114,99,0,0,0,114,100,0,0,0,114,
+    101,0,0,0,114,226,0,0,0,114,164,0,0,0,169,4,
+    114,221,0,0,0,114,163,0,0,0,114,65,0,0,0,114,
+    210,0,0,0,114,7,0,0,0,114,7,0,0,0,114,8,
+    0,0,0,218,11,102,105,110,100,95,109,111,100,117,108,101,
+    76,3,0,0,115,14,0,0,0,6,7,2,2,4,254,12,
+    3,8,1,6,1,4,2,122,33,87,105,110,100,111,119,115,
+    82,101,103,105,115,116,114,121,70,105,110,100,101,114,46,102,
+    105,110,100,95,109,111,100,117,108,101,169,2,78,78,114,69,
+    0,0,0,41,15,114,150,0,0,0,114,149,0,0,0,114,
+    151,0,0,0,114,152,0,0,0,114,219,0,0,0,114,218,
+    0,0,0,218,11,95,77,83,95,87,73,78,68,79,87,83,
+    218,18,69,88,84,69,78,83,73,79,78,95,83,85,70,70,
+    73,88,69,83,114,217,0,0,0,218,12,115,116,97,116,105,
+    99,109,101,116,104,111,100,114,216,0,0,0,218,11,99,108,
+    97,115,115,109,101,116,104,111,100,114,223,0,0,0,114,226,
+    0,0,0,114,229,0,0,0,114,7,0,0,0,114,7,0,
+    0,0,114,7,0,0,0,114,8,0,0,0,114,214,0,0,
+    0,26,3,0,0,115,30,0,0,0,8,0,4,2,2,3,
+    2,255,2,4,2,255,12,3,2,2,10,1,2,6,10,1,
+    2,14,12,1,2,15,16,1,114,214,0,0,0,99,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,
+    0,0,64,0,0,0,115,48,0,0,0,101,0,90,1,100,
+    0,90,2,100,1,90,3,100,2,100,3,132,0,90,4,100,
+    4,100,5,132,0,90,5,100,6,100,7,132,0,90,6,100,
+    8,100,9,132,0,90,7,100,10,83,0,41,11,218,13,95,
+    76,111,97,100,101,114,66,97,115,105,99,115,122,83,66,97,
+    115,101,32,99,108,97,115,115,32,111,102,32,99,111,109,109,
+    111,110,32,99,111,100,101,32,110,101,101,100,101,100,32,98,
+    121,32,98,111,116,104,32,83,111,117,114,99,101,76,111,97,
+    100,101,114,32,97,110,100,10,32,32,32,32,83,111,117,114,
+    99,101,108,101,115,115,70,105,108,101,76,111,97,100,101,114,
+    46,99,2,0,0,0,0,0,0,0,0,0,0,0,5,0,
+    0,0,4,0,0,0,67,0,0,0,115,64,0,0,0,116,
+    0,124,0,160,1,124,1,161,1,131,1,100,1,25,0,125,
+    2,124,2,160,2,100,2,100,1,161,2,100,3,25,0,125,
+    3,124,1,160,3,100,2,161,1,100,4,25,0,125,4,124,
+    3,100,5,107,2,111,31,124,4,100,5,107,3,83,0,41,
+    6,122,141,67,111,110,99,114,101,116,101,32,105,109,112,108,
+    101,109,101,110,116,97,116,105,111,110,32,111,102,32,73,110,
+    115,112,101,99,116,76,111,97,100,101,114,46,105,115,95,112,
+    97,99,107,97,103,101,32,98,121,32,99,104,101,99,107,105,
+    110,103,32,105,102,10,32,32,32,32,32,32,32,32,116,104,
+    101,32,112,97,116,104,32,114,101,116,117,114,110,101,100,32,
+    98,121,32,103,101,116,95,102,105,108,101,110,97,109,101,32,
+    104,97,115,32,97,32,102,105,108,101,110,97,109,101,32,111,
+    102,32,39,95,95,105,110,105,116,95,95,46,112,121,39,46,
+    114,3,0,0,0,114,97,0,0,0,114,0,0,0,0,114,
+    44,0,0,0,218,8,95,95,105,110,105,116,95,95,41,4,
+    114,74,0,0,0,114,203,0,0,0,114,125,0,0,0,114,
+    104,0,0,0,41,5,114,143,0,0,0,114,163,0,0,0,
+    114,120,0,0,0,90,13,102,105,108,101,110,97,109,101,95,
+    98,97,115,101,90,9,116,97,105,108,95,110,97,109,101,114,
+    7,0,0,0,114,7,0,0,0,114,8,0,0,0,114,206,
+    0,0,0,98,3,0,0,115,8,0,0,0,18,3,16,1,
+    14,1,16,1,122,24,95,76,111,97,100,101,114,66,97,115,
+    105,99,115,46,105,115,95,112,97,99,107,97,103,101,99,2,
+    0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,1,
+    0,0,0,67,0,0,0,114,23,0,0,0,169,2,122,42,
     85,115,101,32,100,101,102,97,117,108,116,32,115,101,109,97,
     110,116,105,99,115,32,102,111,114,32,109,111,100,117,108,101,
-    32,99,114,101,97,116,105,111,110,46,78,114,5,0,0,0,
-    169,2,114,118,0,0,0,114,187,0,0,0,114,5,0,0,
-    0,114,5,0,0,0,114,8,0,0,0,218,13,99,114,101,
-    97,116,101,95,109,111,100,117,108,101,13,3,0,0,115,2,
-    0,0,0,0,1,122,27,95,76,111,97,100,101,114,66,97,
+    32,99,114,101,97,116,105,111,110,46,78,114,7,0,0,0,
+    169,2,114,143,0,0,0,114,210,0,0,0,114,7,0,0,
+    0,114,7,0,0,0,114,8,0,0,0,218,13,99,114,101,
+    97,116,101,95,109,111,100,117,108,101,106,3,0,0,243,2,
+    0,0,0,4,0,122,27,95,76,111,97,100,101,114,66,97,
     115,105,99,115,46,99,114,101,97,116,101,95,109,111,100,117,
     108,101,99,2,0,0,0,0,0,0,0,0,0,0,0,3,
     0,0,0,5,0,0,0,67,0,0,0,115,56,0,0,0,
     124,0,160,0,124,1,106,1,161,1,125,2,124,2,100,1,
-    117,0,114,36,116,2,100,2,160,3,124,1,106,1,161,1,
+    117,0,114,18,116,2,100,2,160,3,124,1,106,1,161,1,
     131,1,130,1,116,4,160,5,116,6,124,2,124,1,106,7,
     161,3,1,0,100,1,83,0,41,3,122,19,69,120,101,99,
     117,116,101,32,116,104,101,32,109,111,100,117,108,101,46,78,
@@ -1131,1604 +1225,1547 @@
     100,117,108,101,32,123,33,114,125,32,119,104,101,110,32,103,
     101,116,95,99,111,100,101,40,41,32,114,101,116,117,114,110,
     115,32,78,111,110,101,41,8,218,8,103,101,116,95,99,111,
-    100,101,114,125,0,0,0,114,117,0,0,0,114,62,0,0,
-    0,114,134,0,0,0,218,25,95,99,97,108,108,95,119,105,
+    100,101,114,150,0,0,0,114,142,0,0,0,114,89,0,0,
+    0,114,159,0,0,0,218,25,95,99,97,108,108,95,119,105,
     116,104,95,102,114,97,109,101,115,95,114,101,109,111,118,101,
-    100,218,4,101,120,101,99,114,131,0,0,0,41,3,114,118,
-    0,0,0,218,6,109,111,100,117,108,101,114,164,0,0,0,
-    114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,218,
-    11,101,120,101,99,95,109,111,100,117,108,101,16,3,0,0,
-    115,12,0,0,0,0,2,12,1,8,1,6,1,4,255,6,
+    100,218,4,101,120,101,99,114,156,0,0,0,41,3,114,143,
+    0,0,0,218,6,109,111,100,117,108,101,114,188,0,0,0,
+    114,7,0,0,0,114,7,0,0,0,114,8,0,0,0,218,
+    11,101,120,101,99,95,109,111,100,117,108,101,109,3,0,0,
+    115,12,0,0,0,12,2,8,1,4,1,8,1,4,255,20,
     2,122,25,95,76,111,97,100,101,114,66,97,115,105,99,115,
     46,101,120,101,99,95,109,111,100,117,108,101,99,2,0,0,
     0,0,0,0,0,0,0,0,0,2,0,0,0,4,0,0,
     0,67,0,0,0,115,12,0,0,0,116,0,160,1,124,0,
     124,1,161,2,83,0,41,1,122,26,84,104,105,115,32,109,
-    111,100,117,108,101,32,105,115,32,100,101,112,114,101,99,97,
-    116,101,100,46,41,2,114,134,0,0,0,218,17,95,108,111,
+    101,116,104,111,100,32,105,115,32,100,101,112,114,101,99,97,
+    116,101,100,46,41,2,114,159,0,0,0,218,17,95,108,111,
     97,100,95,109,111,100,117,108,101,95,115,104,105,109,169,2,
-    114,118,0,0,0,114,139,0,0,0,114,5,0,0,0,114,
-    5,0,0,0,114,8,0,0,0,218,11,108,111,97,100,95,
-    109,111,100,117,108,101,24,3,0,0,115,2,0,0,0,0,
-    2,122,25,95,76,111,97,100,101,114,66,97,115,105,99,115,
+    114,143,0,0,0,114,163,0,0,0,114,7,0,0,0,114,
+    7,0,0,0,114,8,0,0,0,218,11,108,111,97,100,95,
+    109,111,100,117,108,101,117,3,0,0,115,2,0,0,0,12,
+    3,122,25,95,76,111,97,100,101,114,66,97,115,105,99,115,
     46,108,111,97,100,95,109,111,100,117,108,101,78,41,8,114,
-    125,0,0,0,114,124,0,0,0,114,126,0,0,0,114,127,
-    0,0,0,114,182,0,0,0,114,212,0,0,0,114,217,0,
-    0,0,114,220,0,0,0,114,5,0,0,0,114,5,0,0,
-    0,114,5,0,0,0,114,8,0,0,0,114,208,0,0,0,
-    0,3,0,0,115,10,0,0,0,8,2,4,3,8,8,8,
-    3,8,8,114,208,0,0,0,99,0,0,0,0,0,0,0,
-    0,0,0,0,0,0,0,0,0,3,0,0,0,64,0,0,
-    0,115,74,0,0,0,101,0,90,1,100,0,90,2,100,1,
-    100,2,132,0,90,3,100,3,100,4,132,0,90,4,100,5,
-    100,6,132,0,90,5,100,7,100,8,132,0,90,6,100,9,
-    100,10,132,0,90,7,100,11,100,12,156,1,100,13,100,14,
-    132,2,90,8,100,15,100,16,132,0,90,9,100,17,83,0,
-    41,18,218,12,83,111,117,114,99,101,76,111,97,100,101,114,
-    99,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,
-    0,1,0,0,0,67,0,0,0,115,8,0,0,0,116,0,
-    130,1,100,1,83,0,41,2,122,165,79,112,116,105,111,110,
-    97,108,32,109,101,116,104,111,100,32,116,104,97,116,32,114,
-    101,116,117,114,110,115,32,116,104,101,32,109,111,100,105,102,
-    105,99,97,116,105,111,110,32,116,105,109,101,32,40,97,110,
-    32,105,110,116,41,32,102,111,114,32,116,104,101,10,32,32,
-    32,32,32,32,32,32,115,112,101,99,105,102,105,101,100,32,
-    112,97,116,104,32,40,97,32,115,116,114,41,46,10,10,32,
-    32,32,32,32,32,32,32,82,97,105,115,101,115,32,79,83,
-    69,114,114,111,114,32,119,104,101,110,32,116,104,101,32,112,
-    97,116,104,32,99,97,110,110,111,116,32,98,101,32,104,97,
-    110,100,108,101,100,46,10,32,32,32,32,32,32,32,32,78,
-    41,1,114,50,0,0,0,169,2,114,118,0,0,0,114,44,
-    0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,
-    0,0,218,10,112,97,116,104,95,109,116,105,109,101,31,3,
-    0,0,115,2,0,0,0,0,6,122,23,83,111,117,114,99,
-    101,76,111,97,100,101,114,46,112,97,116,104,95,109,116,105,
-    109,101,99,2,0,0,0,0,0,0,0,0,0,0,0,2,
-    0,0,0,4,0,0,0,67,0,0,0,115,14,0,0,0,
-    100,1,124,0,160,0,124,1,161,1,105,1,83,0,41,2,
-    97,158,1,0,0,79,112,116,105,111,110,97,108,32,109,101,
-    116,104,111,100,32,114,101,116,117,114,110,105,110,103,32,97,
-    32,109,101,116,97,100,97,116,97,32,100,105,99,116,32,102,
-    111,114,32,116,104,101,32,115,112,101,99,105,102,105,101,100,
-    10,32,32,32,32,32,32,32,32,112,97,116,104,32,40,97,
-    32,115,116,114,41,46,10,10,32,32,32,32,32,32,32,32,
-    80,111,115,115,105,98,108,101,32,107,101,121,115,58,10,32,
-    32,32,32,32,32,32,32,45,32,39,109,116,105,109,101,39,
-    32,40,109,97,110,100,97,116,111,114,121,41,32,105,115,32,
-    116,104,101,32,110,117,109,101,114,105,99,32,116,105,109,101,
-    115,116,97,109,112,32,111,102,32,108,97,115,116,32,115,111,
-    117,114,99,101,10,32,32,32,32,32,32,32,32,32,32,99,
-    111,100,101,32,109,111,100,105,102,105,99,97,116,105,111,110,
-    59,10,32,32,32,32,32,32,32,32,45,32,39,115,105,122,
-    101,39,32,40,111,112,116,105,111,110,97,108,41,32,105,115,
-    32,116,104,101,32,115,105,122,101,32,105,110,32,98,121,116,
-    101,115,32,111,102,32,116,104,101,32,115,111,117,114,99,101,
-    32,99,111,100,101,46,10,10,32,32,32,32,32,32,32,32,
-    73,109,112,108,101,109,101,110,116,105,110,103,32,116,104,105,
-    115,32,109,101,116,104,111,100,32,97,108,108,111,119,115,32,
-    116,104,101,32,108,111,97,100,101,114,32,116,111,32,114,101,
-    97,100,32,98,121,116,101,99,111,100,101,32,102,105,108,101,
-    115,46,10,32,32,32,32,32,32,32,32,82,97,105,115,101,
-    115,32,79,83,69,114,114,111,114,32,119,104,101,110,32,116,
-    104,101,32,112,97,116,104,32,99,97,110,110,111,116,32,98,
-    101,32,104,97,110,100,108,101,100,46,10,32,32,32,32,32,
-    32,32,32,114,169,0,0,0,41,1,114,223,0,0,0,114,
-    222,0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,
-    0,0,0,218,10,112,97,116,104,95,115,116,97,116,115,39,
-    3,0,0,115,2,0,0,0,0,12,122,23,83,111,117,114,
-    99,101,76,111,97,100,101,114,46,112,97,116,104,95,115,116,
-    97,116,115,99,4,0,0,0,0,0,0,0,0,0,0,0,
-    4,0,0,0,4,0,0,0,67,0,0,0,115,12,0,0,
-    0,124,0,160,0,124,2,124,3,161,2,83,0,41,1,122,
-    228,79,112,116,105,111,110,97,108,32,109,101,116,104,111,100,
-    32,119,104,105,99,104,32,119,114,105,116,101,115,32,100,97,
-    116,97,32,40,98,121,116,101,115,41,32,116,111,32,97,32,
-    102,105,108,101,32,112,97,116,104,32,40,97,32,115,116,114,
-    41,46,10,10,32,32,32,32,32,32,32,32,73,109,112,108,
-    101,109,101,110,116,105,110,103,32,116,104,105,115,32,109,101,
-    116,104,111,100,32,97,108,108,111,119,115,32,102,111,114,32,
-    116,104,101,32,119,114,105,116,105,110,103,32,111,102,32,98,
-    121,116,101,99,111,100,101,32,102,105,108,101,115,46,10,10,
-    32,32,32,32,32,32,32,32,84,104,101,32,115,111,117,114,
-    99,101,32,112,97,116,104,32,105,115,32,110,101,101,100,101,
-    100,32,105,110,32,111,114,100,101,114,32,116,111,32,99,111,
-    114,114,101,99,116,108,121,32,116,114,97,110,115,102,101,114,
-    32,112,101,114,109,105,115,115,105,111,110,115,10,32,32,32,
-    32,32,32,32,32,41,1,218,8,115,101,116,95,100,97,116,
-    97,41,4,114,118,0,0,0,114,107,0,0,0,90,10,99,
-    97,99,104,101,95,112,97,116,104,114,26,0,0,0,114,5,
-    0,0,0,114,5,0,0,0,114,8,0,0,0,218,15,95,
-    99,97,99,104,101,95,98,121,116,101,99,111,100,101,53,3,
-    0,0,115,2,0,0,0,0,8,122,28,83,111,117,114,99,
-    101,76,111,97,100,101,114,46,95,99,97,99,104,101,95,98,
-    121,116,101,99,111,100,101,99,3,0,0,0,0,0,0,0,
-    0,0,0,0,3,0,0,0,1,0,0,0,67,0,0,0,
-    115,4,0,0,0,100,1,83,0,41,2,122,150,79,112,116,
-    105,111,110,97,108,32,109,101,116,104,111,100,32,119,104,105,
-    99,104,32,119,114,105,116,101,115,32,100,97,116,97,32,40,
-    98,121,116,101,115,41,32,116,111,32,97,32,102,105,108,101,
-    32,112,97,116,104,32,40,97,32,115,116,114,41,46,10,10,
-    32,32,32,32,32,32,32,32,73,109,112,108,101,109,101,110,
-    116,105,110,103,32,116,104,105,115,32,109,101,116,104,111,100,
-    32,97,108,108,111,119,115,32,102,111,114,32,116,104,101,32,
-    119,114,105,116,105,110,103,32,111,102,32,98,121,116,101,99,
-    111,100,101,32,102,105,108,101,115,46,10,32,32,32,32,32,
-    32,32,32,78,114,5,0,0,0,41,3,114,118,0,0,0,
-    114,44,0,0,0,114,26,0,0,0,114,5,0,0,0,114,
-    5,0,0,0,114,8,0,0,0,114,225,0,0,0,63,3,
-    0,0,115,2,0,0,0,0,1,122,21,83,111,117,114,99,
-    101,76,111,97,100,101,114,46,115,101,116,95,100,97,116,97,
-    99,2,0,0,0,0,0,0,0,0,0,0,0,5,0,0,
-    0,10,0,0,0,67,0,0,0,115,84,0,0,0,124,0,
-    160,0,124,1,161,1,125,2,122,14,124,0,160,1,124,2,
-    161,1,125,3,87,0,110,50,4,0,116,2,121,74,1,0,
-    125,4,1,0,122,26,116,3,100,1,124,1,100,2,141,2,
-    124,4,130,2,87,0,89,0,100,3,125,4,126,4,110,10,
-    100,3,125,4,126,4,48,0,48,0,116,4,124,3,131,1,
-    83,0,41,4,122,52,67,111,110,99,114,101,116,101,32,105,
-    109,112,108,101,109,101,110,116,97,116,105,111,110,32,111,102,
-    32,73,110,115,112,101,99,116,76,111,97,100,101,114,46,103,
-    101,116,95,115,111,117,114,99,101,46,122,39,115,111,117,114,
-    99,101,32,110,111,116,32,97,118,97,105,108,97,98,108,101,
-    32,116,104,114,111,117,103,104,32,103,101,116,95,100,97,116,
-    97,40,41,114,115,0,0,0,78,41,5,114,179,0,0,0,
-    218,8,103,101,116,95,100,97,116,97,114,50,0,0,0,114,
-    117,0,0,0,114,176,0,0,0,41,5,114,118,0,0,0,
-    114,139,0,0,0,114,44,0,0,0,114,174,0,0,0,218,
-    3,101,120,99,114,5,0,0,0,114,5,0,0,0,114,8,
-    0,0,0,218,10,103,101,116,95,115,111,117,114,99,101,70,
-    3,0,0,115,20,0,0,0,0,2,10,1,2,1,14,1,
-    14,1,4,1,2,255,4,1,2,255,24,2,122,23,83,111,
-    117,114,99,101,76,111,97,100,101,114,46,103,101,116,95,115,
-    111,117,114,99,101,114,104,0,0,0,41,1,218,9,95,111,
-    112,116,105,109,105,122,101,99,3,0,0,0,0,0,0,0,
-    1,0,0,0,4,0,0,0,8,0,0,0,67,0,0,0,
-    115,22,0,0,0,116,0,106,1,116,2,124,1,124,2,100,
-    1,100,2,124,3,100,3,141,6,83,0,41,4,122,130,82,
-    101,116,117,114,110,32,116,104,101,32,99,111,100,101,32,111,
-    98,106,101,99,116,32,99,111,109,112,105,108,101,100,32,102,
-    114,111,109,32,115,111,117,114,99,101,46,10,10,32,32,32,
-    32,32,32,32,32,84,104,101,32,39,100,97,116,97,39,32,
-    97,114,103,117,109,101,110,116,32,99,97,110,32,98,101,32,
-    97,110,121,32,111,98,106,101,99,116,32,116,121,112,101,32,
-    116,104,97,116,32,99,111,109,112,105,108,101,40,41,32,115,
-    117,112,112,111,114,116,115,46,10,32,32,32,32,32,32,32,
-    32,114,215,0,0,0,84,41,2,218,12,100,111,110,116,95,
-    105,110,104,101,114,105,116,114,83,0,0,0,41,3,114,134,
-    0,0,0,114,214,0,0,0,218,7,99,111,109,112,105,108,
-    101,41,4,114,118,0,0,0,114,26,0,0,0,114,44,0,
-    0,0,114,230,0,0,0,114,5,0,0,0,114,5,0,0,
-    0,114,8,0,0,0,218,14,115,111,117,114,99,101,95,116,
-    111,95,99,111,100,101,80,3,0,0,115,6,0,0,0,0,
-    5,12,1,4,255,122,27,83,111,117,114,99,101,76,111,97,
-    100,101,114,46,115,111,117,114,99,101,95,116,111,95,99,111,
-    100,101,99,2,0,0,0,0,0,0,0,0,0,0,0,15,
-    0,0,0,9,0,0,0,67,0,0,0,115,24,2,0,0,
-    124,0,160,0,124,1,161,1,125,2,100,1,125,3,100,1,
-    125,4,100,1,125,5,100,2,125,6,100,3,125,7,122,12,
-    116,1,124,2,131,1,125,8,87,0,110,24,4,0,116,2,
-    121,66,1,0,1,0,1,0,100,1,125,8,89,0,144,1,
-    110,42,48,0,122,14,124,0,160,3,124,2,161,1,125,9,
-    87,0,110,20,4,0,116,4,121,102,1,0,1,0,1,0,
-    89,0,144,1,110,6,48,0,116,5,124,9,100,4,25,0,
-    131,1,125,3,122,14,124,0,160,6,124,8,161,1,125,10,
-    87,0,110,18,4,0,116,4,121,148,1,0,1,0,1,0,
-    89,0,110,216,48,0,124,1,124,8,100,5,156,2,125,11,
-    122,148,116,7,124,10,124,1,124,11,131,3,125,12,116,8,
-    124,10,131,1,100,6,100,1,133,2,25,0,125,13,124,12,
-    100,7,64,0,100,8,107,3,125,6,124,6,144,1,114,30,
-    124,12,100,9,64,0,100,8,107,3,125,7,116,9,106,10,
-    100,10,107,3,144,1,114,50,124,7,115,248,116,9,106,10,
-    100,11,107,2,144,1,114,50,124,0,160,6,124,2,161,1,
-    125,4,116,9,160,11,116,12,124,4,161,2,125,5,116,13,
-    124,10,124,5,124,1,124,11,131,4,1,0,110,20,116,14,
-    124,10,124,3,124,9,100,12,25,0,124,1,124,11,131,5,
-    1,0,87,0,110,24,4,0,116,15,116,16,102,2,144,1,
-    121,76,1,0,1,0,1,0,89,0,110,32,48,0,116,17,
-    160,18,100,13,124,8,124,2,161,3,1,0,116,19,124,13,
-    124,1,124,8,124,2,100,14,141,4,83,0,124,4,100,1,
-    117,0,144,1,114,128,124,0,160,6,124,2,161,1,125,4,
-    124,0,160,20,124,4,124,2,161,2,125,14,116,17,160,18,
-    100,15,124,2,161,2,1,0,116,21,106,22,144,2,115,20,
-    124,8,100,1,117,1,144,2,114,20,124,3,100,1,117,1,
-    144,2,114,20,124,6,144,1,114,220,124,5,100,1,117,0,
-    144,1,114,206,116,9,160,11,124,4,161,1,125,5,116,23,
-    124,14,124,5,124,7,131,3,125,10,110,16,116,24,124,14,
-    124,3,116,25,124,4,131,1,131,3,125,10,122,18,124,0,
-    160,26,124,2,124,8,124,10,161,3,1,0,87,0,110,20,
-    4,0,116,2,144,2,121,18,1,0,1,0,1,0,89,0,
-    110,2,48,0,124,14,83,0,41,16,122,190,67,111,110,99,
-    114,101,116,101,32,105,109,112,108,101,109,101,110,116,97,116,
-    105,111,110,32,111,102,32,73,110,115,112,101,99,116,76,111,
-    97,100,101,114,46,103,101,116,95,99,111,100,101,46,10,10,
-    32,32,32,32,32,32,32,32,82,101,97,100,105,110,103,32,
-    111,102,32,98,121,116,101,99,111,100,101,32,114,101,113,117,
-    105,114,101,115,32,112,97,116,104,95,115,116,97,116,115,32,
-    116,111,32,98,101,32,105,109,112,108,101,109,101,110,116,101,
-    100,46,32,84,111,32,119,114,105,116,101,10,32,32,32,32,
-    32,32,32,32,98,121,116,101,99,111,100,101,44,32,115,101,
-    116,95,100,97,116,97,32,109,117,115,116,32,97,108,115,111,
-    32,98,101,32,105,109,112,108,101,109,101,110,116,101,100,46,
-    10,10,32,32,32,32,32,32,32,32,78,70,84,114,169,0,
-    0,0,114,159,0,0,0,114,145,0,0,0,114,39,0,0,
-    0,114,73,0,0,0,114,28,0,0,0,90,5,110,101,118,
-    101,114,90,6,97,108,119,97,121,115,218,4,115,105,122,101,
-    122,13,123,125,32,109,97,116,99,104,101,115,32,123,125,41,
-    3,114,116,0,0,0,114,106,0,0,0,114,107,0,0,0,
-    122,19,99,111,100,101,32,111,98,106,101,99,116,32,102,114,
-    111,109,32,123,125,41,27,114,179,0,0,0,114,97,0,0,
-    0,114,82,0,0,0,114,224,0,0,0,114,50,0,0,0,
-    114,18,0,0,0,114,227,0,0,0,114,152,0,0,0,218,
-    10,109,101,109,111,114,121,118,105,101,119,114,163,0,0,0,
-    90,21,99,104,101,99,107,95,104,97,115,104,95,98,97,115,
-    101,100,95,112,121,99,115,114,157,0,0,0,218,17,95,82,
-    65,87,95,77,65,71,73,67,95,78,85,77,66,69,82,114,
-    158,0,0,0,114,156,0,0,0,114,117,0,0,0,114,150,
-    0,0,0,114,134,0,0,0,114,149,0,0,0,114,165,0,
-    0,0,114,233,0,0,0,114,1,0,0,0,218,19,100,111,
-    110,116,95,119,114,105,116,101,95,98,121,116,101,99,111,100,
-    101,114,171,0,0,0,114,170,0,0,0,114,23,0,0,0,
-    114,226,0,0,0,41,15,114,118,0,0,0,114,139,0,0,
-    0,114,107,0,0,0,114,154,0,0,0,114,174,0,0,0,
-    114,157,0,0,0,90,10,104,97,115,104,95,98,97,115,101,
-    100,90,12,99,104,101,99,107,95,115,111,117,114,99,101,114,
-    106,0,0,0,218,2,115,116,114,26,0,0,0,114,151,0,
-    0,0,114,2,0,0,0,90,10,98,121,116,101,115,95,100,
-    97,116,97,90,11,99,111,100,101,95,111,98,106,101,99,116,
-    114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,114,
-    213,0,0,0,88,3,0,0,115,152,0,0,0,0,7,10,
-    1,4,1,4,1,4,1,4,1,4,1,2,1,12,1,12,
-    1,12,2,2,1,14,1,12,1,8,2,12,1,2,1,14,
-    1,12,1,6,3,2,1,2,254,6,4,2,1,12,1,16,
-    1,12,1,6,1,12,1,12,1,2,255,2,2,8,254,4,
-    3,10,1,4,1,2,1,2,254,4,4,8,1,2,255,6,
-    3,2,1,2,1,2,1,6,1,2,1,2,251,8,7,18,
-    1,6,2,8,1,2,255,4,2,6,1,2,1,2,254,6,
-    3,10,1,10,1,12,1,12,1,18,1,6,255,4,2,6,
-    1,10,1,10,1,14,2,6,1,6,255,4,2,2,1,18,
-    1,14,1,6,1,122,21,83,111,117,114,99,101,76,111,97,
-    100,101,114,46,103,101,116,95,99,111,100,101,78,41,10,114,
-    125,0,0,0,114,124,0,0,0,114,126,0,0,0,114,223,
-    0,0,0,114,224,0,0,0,114,226,0,0,0,114,225,0,
-    0,0,114,229,0,0,0,114,233,0,0,0,114,213,0,0,
-    0,114,5,0,0,0,114,5,0,0,0,114,5,0,0,0,
-    114,8,0,0,0,114,221,0,0,0,29,3,0,0,115,14,
-    0,0,0,8,2,8,8,8,14,8,10,8,7,8,10,14,
-    8,114,221,0,0,0,99,0,0,0,0,0,0,0,0,0,
-    0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,115,
-    124,0,0,0,101,0,90,1,100,0,90,2,100,1,90,3,
-    100,2,100,3,132,0,90,4,100,4,100,5,132,0,90,5,
-    100,6,100,7,132,0,90,6,101,7,135,0,102,1,100,8,
-    100,9,132,8,131,1,90,8,101,7,100,10,100,11,132,0,
-    131,1,90,9,100,12,100,13,132,0,90,10,101,7,100,14,
-    100,15,132,0,131,1,90,11,100,16,100,17,132,0,90,12,
-    100,18,100,19,132,0,90,13,100,20,100,21,132,0,90,14,
-    100,22,100,23,132,0,90,15,135,0,4,0,90,16,83,0,
-    41,24,218,10,70,105,108,101,76,111,97,100,101,114,122,103,
-    66,97,115,101,32,102,105,108,101,32,108,111,97,100,101,114,
-    32,99,108,97,115,115,32,119,104,105,99,104,32,105,109,112,
-    108,101,109,101,110,116,115,32,116,104,101,32,108,111,97,100,
-    101,114,32,112,114,111,116,111,99,111,108,32,109,101,116,104,
-    111,100,115,32,116,104,97,116,10,32,32,32,32,114,101,113,
-    117,105,114,101,32,102,105,108,101,32,115,121,115,116,101,109,
-    32,117,115,97,103,101,46,99,3,0,0,0,0,0,0,0,
-    0,0,0,0,3,0,0,0,2,0,0,0,67,0,0,0,
-    115,16,0,0,0,124,1,124,0,95,0,124,2,124,0,95,
-    1,100,1,83,0,41,2,122,75,67,97,99,104,101,32,116,
-    104,101,32,109,111,100,117,108,101,32,110,97,109,101,32,97,
-    110,100,32,116,104,101,32,112,97,116,104,32,116,111,32,116,
-    104,101,32,102,105,108,101,32,102,111,117,110,100,32,98,121,
-    32,116,104,101,10,32,32,32,32,32,32,32,32,102,105,110,
-    100,101,114,46,78,114,159,0,0,0,41,3,114,118,0,0,
-    0,114,139,0,0,0,114,44,0,0,0,114,5,0,0,0,
-    114,5,0,0,0,114,8,0,0,0,114,209,0,0,0,178,
-    3,0,0,115,4,0,0,0,0,3,6,1,122,19,70,105,
-    108,101,76,111,97,100,101,114,46,95,95,105,110,105,116,95,
-    95,99,2,0,0,0,0,0,0,0,0,0,0,0,2,0,
-    0,0,2,0,0,0,67,0,0,0,115,24,0,0,0,124,
-    0,106,0,124,1,106,0,107,2,111,22,124,0,106,1,124,
-    1,106,1,107,2,83,0,114,109,0,0,0,169,2,218,9,
-    95,95,99,108,97,115,115,95,95,114,131,0,0,0,169,2,
-    114,118,0,0,0,90,5,111,116,104,101,114,114,5,0,0,
-    0,114,5,0,0,0,114,8,0,0,0,218,6,95,95,101,
-    113,95,95,184,3,0,0,115,6,0,0,0,0,1,12,1,
-    10,255,122,17,70,105,108,101,76,111,97,100,101,114,46,95,
-    95,101,113,95,95,99,1,0,0,0,0,0,0,0,0,0,
-    0,0,1,0,0,0,3,0,0,0,67,0,0,0,115,20,
-    0,0,0,116,0,124,0,106,1,131,1,116,0,124,0,106,
-    2,131,1,65,0,83,0,114,109,0,0,0,169,3,218,4,
-    104,97,115,104,114,116,0,0,0,114,44,0,0,0,169,1,
-    114,118,0,0,0,114,5,0,0,0,114,5,0,0,0,114,
-    8,0,0,0,218,8,95,95,104,97,115,104,95,95,188,3,
-    0,0,115,2,0,0,0,0,1,122,19,70,105,108,101,76,
-    111,97,100,101,114,46,95,95,104,97,115,104,95,95,99,2,
-    0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,3,
-    0,0,0,3,0,0,0,115,16,0,0,0,116,0,116,1,
-    124,0,131,2,160,2,124,1,161,1,83,0,41,1,122,100,
-    76,111,97,100,32,97,32,109,111,100,117,108,101,32,102,114,
-    111,109,32,97,32,102,105,108,101,46,10,10,32,32,32,32,
-    32,32,32,32,84,104,105,115,32,109,101,116,104,111,100,32,
-    105,115,32,100,101,112,114,101,99,97,116,101,100,46,32,32,
-    85,115,101,32,101,120,101,99,95,109,111,100,117,108,101,40,
-    41,32,105,110,115,116,101,97,100,46,10,10,32,32,32,32,
-    32,32,32,32,41,3,218,5,115,117,112,101,114,114,239,0,
-    0,0,114,220,0,0,0,114,219,0,0,0,169,1,114,241,
-    0,0,0,114,5,0,0,0,114,8,0,0,0,114,220,0,
-    0,0,191,3,0,0,115,2,0,0,0,0,10,122,22,70,
-    105,108,101,76,111,97,100,101,114,46,108,111,97,100,95,109,
-    111,100,117,108,101,99,2,0,0,0,0,0,0,0,0,0,
-    0,0,2,0,0,0,1,0,0,0,67,0,0,0,115,6,
-    0,0,0,124,0,106,0,83,0,169,1,122,58,82,101,116,
-    117,114,110,32,116,104,101,32,112,97,116,104,32,116,111,32,
-    116,104,101,32,115,111,117,114,99,101,32,102,105,108,101,32,
-    97,115,32,102,111,117,110,100,32,98,121,32,116,104,101,32,
-    102,105,110,100,101,114,46,114,48,0,0,0,114,219,0,0,
-    0,114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,
-    114,179,0,0,0,203,3,0,0,115,2,0,0,0,0,3,
-    122,23,70,105,108,101,76,111,97,100,101,114,46,103,101,116,
-    95,102,105,108,101,110,97,109,101,99,2,0,0,0,0,0,
-    0,0,0,0,0,0,3,0,0,0,8,0,0,0,67,0,
-    0,0,115,126,0,0,0,116,0,124,0,116,1,116,2,102,
-    2,131,2,114,70,116,3,160,4,116,5,124,1,131,1,161,
-    1,143,24,125,2,124,2,160,6,161,0,87,0,2,0,100,
-    1,4,0,4,0,131,3,1,0,83,0,49,0,115,58,48,
-    0,1,0,1,0,1,0,89,0,1,0,110,52,116,3,160,
-    7,124,1,100,2,161,2,143,24,125,2,124,2,160,6,161,
-    0,87,0,2,0,100,1,4,0,4,0,131,3,1,0,83,
-    0,49,0,115,112,48,0,1,0,1,0,1,0,89,0,1,
-    0,100,1,83,0,41,3,122,39,82,101,116,117,114,110,32,
-    116,104,101,32,100,97,116,97,32,102,114,111,109,32,112,97,
-    116,104,32,97,115,32,114,97,119,32,98,121,116,101,115,46,
-    78,218,1,114,41,8,114,161,0,0,0,114,221,0,0,0,
-    218,19,69,120,116,101,110,115,105,111,110,70,105,108,101,76,
-    111,97,100,101,114,114,64,0,0,0,90,9,111,112,101,110,
-    95,99,111,100,101,114,84,0,0,0,90,4,114,101,97,100,
-    114,65,0,0,0,41,3,114,118,0,0,0,114,44,0,0,
-    0,114,68,0,0,0,114,5,0,0,0,114,5,0,0,0,
-    114,8,0,0,0,114,227,0,0,0,208,3,0,0,115,10,
-    0,0,0,0,2,14,1,16,1,40,2,14,1,122,19,70,
-    105,108,101,76,111,97,100,101,114,46,103,101,116,95,100,97,
-    116,97,99,2,0,0,0,0,0,0,0,0,0,0,0,2,
-    0,0,0,3,0,0,0,67,0,0,0,115,18,0,0,0,
-    124,0,160,0,124,1,161,1,114,14,124,0,83,0,100,0,
-    83,0,114,109,0,0,0,41,1,114,182,0,0,0,169,2,
-    114,118,0,0,0,114,216,0,0,0,114,5,0,0,0,114,
-    5,0,0,0,114,8,0,0,0,218,19,103,101,116,95,114,
-    101,115,111,117,114,99,101,95,114,101,97,100,101,114,219,3,
-    0,0,115,6,0,0,0,0,2,10,1,4,1,122,30,70,
-    105,108,101,76,111,97,100,101,114,46,103,101,116,95,114,101,
-    115,111,117,114,99,101,95,114,101,97,100,101,114,99,2,0,
-    0,0,0,0,0,0,0,0,0,0,3,0,0,0,4,0,
-    0,0,67,0,0,0,115,32,0,0,0,116,0,116,1,124,
-    0,106,2,131,1,100,1,25,0,124,1,131,2,125,2,116,
-    3,160,4,124,2,100,2,161,2,83,0,41,3,78,114,73,
-    0,0,0,114,251,0,0,0,41,5,114,38,0,0,0,114,
-    47,0,0,0,114,44,0,0,0,114,64,0,0,0,114,65,
-    0,0,0,169,3,114,118,0,0,0,90,8,114,101,115,111,
-    117,114,99,101,114,44,0,0,0,114,5,0,0,0,114,5,
-    0,0,0,114,8,0,0,0,218,13,111,112,101,110,95,114,
-    101,115,111,117,114,99,101,225,3,0,0,115,4,0,0,0,
-    0,1,20,1,122,24,70,105,108,101,76,111,97,100,101,114,
-    46,111,112,101,110,95,114,101,115,111,117,114,99,101,99,2,
-    0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,3,
-    0,0,0,67,0,0,0,115,38,0,0,0,124,0,160,0,
-    124,1,161,1,115,14,116,1,130,1,116,2,116,3,124,0,
-    106,4,131,1,100,1,25,0,124,1,131,2,125,2,124,2,
-    83,0,169,2,78,114,73,0,0,0,41,5,218,11,105,115,
-    95,114,101,115,111,117,114,99,101,218,17,70,105,108,101,78,
-    111,116,70,111,117,110,100,69,114,114,111,114,114,38,0,0,
-    0,114,47,0,0,0,114,44,0,0,0,114,255,0,0,0,
-    114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,218,
-    13,114,101,115,111,117,114,99,101,95,112,97,116,104,229,3,
-    0,0,115,8,0,0,0,0,1,10,1,4,1,20,1,122,
-    24,70,105,108,101,76,111,97,100,101,114,46,114,101,115,111,
-    117,114,99,101,95,112,97,116,104,99,2,0,0,0,0,0,
-    0,0,0,0,0,0,3,0,0,0,3,0,0,0,67,0,
-    0,0,115,40,0,0,0,116,0,124,1,118,0,114,12,100,
-    1,83,0,116,1,116,2,124,0,106,3,131,1,100,2,25,
-    0,124,1,131,2,125,2,116,4,124,2,131,1,83,0,41,
-    3,78,70,114,73,0,0,0,41,5,114,35,0,0,0,114,
-    38,0,0,0,114,47,0,0,0,114,44,0,0,0,114,54,
-    0,0,0,169,3,114,118,0,0,0,114,116,0,0,0,114,
-    44,0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,
-    0,0,0,114,2,1,0,0,235,3,0,0,115,8,0,0,
-    0,0,1,8,1,4,1,20,1,122,22,70,105,108,101,76,
-    111,97,100,101,114,46,105,115,95,114,101,115,111,117,114,99,
-    101,99,1,0,0,0,0,0,0,0,0,0,0,0,1,0,
-    0,0,5,0,0,0,67,0,0,0,115,24,0,0,0,116,
-    0,116,1,160,2,116,3,124,0,106,4,131,1,100,1,25,
-    0,161,1,131,1,83,0,114,1,1,0,0,41,5,218,4,
-    105,116,101,114,114,4,0,0,0,218,7,108,105,115,116,100,
-    105,114,114,47,0,0,0,114,44,0,0,0,114,246,0,0,
-    0,114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,
-    218,8,99,111,110,116,101,110,116,115,241,3,0,0,115,2,
-    0,0,0,0,1,122,19,70,105,108,101,76,111,97,100,101,
-    114,46,99,111,110,116,101,110,116,115,41,17,114,125,0,0,
-    0,114,124,0,0,0,114,126,0,0,0,114,127,0,0,0,
-    114,209,0,0,0,114,243,0,0,0,114,247,0,0,0,114,
-    136,0,0,0,114,220,0,0,0,114,179,0,0,0,114,227,
-    0,0,0,114,254,0,0,0,114,0,1,0,0,114,4,1,
-    0,0,114,2,1,0,0,114,8,1,0,0,90,13,95,95,
-    99,108,97,115,115,99,101,108,108,95,95,114,5,0,0,0,
-    114,5,0,0,0,114,249,0,0,0,114,8,0,0,0,114,
-    239,0,0,0,173,3,0,0,115,30,0,0,0,8,2,4,
-    3,8,6,8,4,8,3,2,1,14,11,2,1,10,4,8,
-    11,2,1,10,5,8,4,8,6,8,6,114,239,0,0,0,
-    99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,3,0,0,0,64,0,0,0,115,46,0,0,0,101,0,
-    90,1,100,0,90,2,100,1,90,3,100,2,100,3,132,0,
-    90,4,100,4,100,5,132,0,90,5,100,6,100,7,156,1,
-    100,8,100,9,132,2,90,6,100,10,83,0,41,11,218,16,
-    83,111,117,114,99,101,70,105,108,101,76,111,97,100,101,114,
-    122,62,67,111,110,99,114,101,116,101,32,105,109,112,108,101,
-    109,101,110,116,97,116,105,111,110,32,111,102,32,83,111,117,
-    114,99,101,76,111,97,100,101,114,32,117,115,105,110,103,32,
-    116,104,101,32,102,105,108,101,32,115,121,115,116,101,109,46,
-    99,2,0,0,0,0,0,0,0,0,0,0,0,3,0,0,
-    0,3,0,0,0,67,0,0,0,115,22,0,0,0,116,0,
-    124,1,131,1,125,2,124,2,106,1,124,2,106,2,100,1,
-    156,2,83,0,41,2,122,33,82,101,116,117,114,110,32,116,
-    104,101,32,109,101,116,97,100,97,116,97,32,102,111,114,32,
-    116,104,101,32,112,97,116,104,46,41,2,114,169,0,0,0,
-    114,234,0,0,0,41,3,114,49,0,0,0,218,8,115,116,
-    95,109,116,105,109,101,90,7,115,116,95,115,105,122,101,41,
-    3,114,118,0,0,0,114,44,0,0,0,114,238,0,0,0,
-    114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,114,
-    224,0,0,0,249,3,0,0,115,4,0,0,0,0,2,8,
-    1,122,27,83,111,117,114,99,101,70,105,108,101,76,111,97,
-    100,101,114,46,112,97,116,104,95,115,116,97,116,115,99,4,
-    0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,5,
-    0,0,0,67,0,0,0,115,24,0,0,0,116,0,124,1,
-    131,1,125,4,124,0,106,1,124,2,124,3,124,4,100,1,
-    141,3,83,0,41,2,78,169,1,218,5,95,109,111,100,101,
-    41,2,114,114,0,0,0,114,225,0,0,0,41,5,114,118,
-    0,0,0,114,107,0,0,0,114,106,0,0,0,114,26,0,
-    0,0,114,52,0,0,0,114,5,0,0,0,114,5,0,0,
-    0,114,8,0,0,0,114,226,0,0,0,254,3,0,0,115,
-    4,0,0,0,0,2,8,1,122,32,83,111,117,114,99,101,
-    70,105,108,101,76,111,97,100,101,114,46,95,99,97,99,104,
-    101,95,98,121,116,101,99,111,100,101,114,60,0,0,0,114,
-    11,1,0,0,99,3,0,0,0,0,0,0,0,1,0,0,
-    0,9,0,0,0,11,0,0,0,67,0,0,0,115,252,0,
-    0,0,116,0,124,1,131,1,92,2,125,4,125,5,103,0,
-    125,6,124,4,114,52,116,1,124,4,131,1,115,52,116,0,
-    124,4,131,1,92,2,125,4,125,7,124,6,160,2,124,7,
-    161,1,1,0,113,16,116,3,124,6,131,1,68,0,93,104,
-    125,7,116,4,124,4,124,7,131,2,125,4,122,14,116,5,
-    160,6,124,4,161,1,1,0,87,0,113,60,4,0,116,7,
-    121,110,1,0,1,0,1,0,89,0,113,60,89,0,113,60,
-    4,0,116,8,121,162,1,0,125,8,1,0,122,30,116,9,
-    160,10,100,1,124,4,124,8,161,3,1,0,87,0,89,0,
-    100,2,125,8,126,8,1,0,100,2,83,0,100,2,125,8,
-    126,8,48,0,48,0,113,60,122,28,116,11,124,1,124,2,
-    124,3,131,3,1,0,116,9,160,10,100,3,124,1,161,2,
-    1,0,87,0,110,52,4,0,116,8,144,0,121,246,1,0,
-    125,8,1,0,122,26,116,9,160,10,100,1,124,1,124,8,
-    161,3,1,0,87,0,89,0,100,2,125,8,126,8,110,10,
-    100,2,125,8,126,8,48,0,48,0,100,2,83,0,41,4,
-    122,27,87,114,105,116,101,32,98,121,116,101,115,32,100,97,
-    116,97,32,116,111,32,97,32,102,105,108,101,46,122,27,99,
-    111,117,108,100,32,110,111,116,32,99,114,101,97,116,101,32,
-    123,33,114,125,58,32,123,33,114,125,78,122,12,99,114,101,
-    97,116,101,100,32,123,33,114,125,41,12,114,47,0,0,0,
-    114,56,0,0,0,114,186,0,0,0,114,42,0,0,0,114,
-    38,0,0,0,114,4,0,0,0,90,5,109,107,100,105,114,
-    218,15,70,105,108,101,69,120,105,115,116,115,69,114,114,111,
-    114,114,50,0,0,0,114,134,0,0,0,114,149,0,0,0,
-    114,69,0,0,0,41,9,114,118,0,0,0,114,44,0,0,
-    0,114,26,0,0,0,114,12,1,0,0,218,6,112,97,114,
-    101,110,116,114,96,0,0,0,114,37,0,0,0,114,33,0,
-    0,0,114,228,0,0,0,114,5,0,0,0,114,5,0,0,
-    0,114,8,0,0,0,114,225,0,0,0,3,4,0,0,115,
-    46,0,0,0,0,2,12,1,4,2,12,1,12,1,12,2,
-    12,1,10,1,2,1,14,1,12,2,8,1,14,3,6,1,
-    4,255,4,2,28,1,2,1,12,1,16,1,16,2,8,1,
-    2,255,122,25,83,111,117,114,99,101,70,105,108,101,76,111,
-    97,100,101,114,46,115,101,116,95,100,97,116,97,78,41,7,
-    114,125,0,0,0,114,124,0,0,0,114,126,0,0,0,114,
-    127,0,0,0,114,224,0,0,0,114,226,0,0,0,114,225,
-    0,0,0,114,5,0,0,0,114,5,0,0,0,114,5,0,
-    0,0,114,8,0,0,0,114,9,1,0,0,245,3,0,0,
-    115,8,0,0,0,8,2,4,2,8,5,8,5,114,9,1,
-    0,0,99,0,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,0,0,2,0,0,0,64,0,0,0,115,32,0,0,0,
-    101,0,90,1,100,0,90,2,100,1,90,3,100,2,100,3,
-    132,0,90,4,100,4,100,5,132,0,90,5,100,6,83,0,
-    41,7,218,20,83,111,117,114,99,101,108,101,115,115,70,105,
-    108,101,76,111,97,100,101,114,122,45,76,111,97,100,101,114,
-    32,119,104,105,99,104,32,104,97,110,100,108,101,115,32,115,
-    111,117,114,99,101,108,101,115,115,32,102,105,108,101,32,105,
-    109,112,111,114,116,115,46,99,2,0,0,0,0,0,0,0,
-    0,0,0,0,5,0,0,0,5,0,0,0,67,0,0,0,
-    115,68,0,0,0,124,0,160,0,124,1,161,1,125,2,124,
-    0,160,1,124,2,161,1,125,3,124,1,124,2,100,1,156,
-    2,125,4,116,2,124,3,124,1,124,4,131,3,1,0,116,
-    3,116,4,124,3,131,1,100,2,100,0,133,2,25,0,124,
-    1,124,2,100,3,141,3,83,0,41,4,78,114,159,0,0,
-    0,114,145,0,0,0,41,2,114,116,0,0,0,114,106,0,
-    0,0,41,5,114,179,0,0,0,114,227,0,0,0,114,152,
-    0,0,0,114,165,0,0,0,114,235,0,0,0,41,5,114,
-    118,0,0,0,114,139,0,0,0,114,44,0,0,0,114,26,
-    0,0,0,114,151,0,0,0,114,5,0,0,0,114,5,0,
-    0,0,114,8,0,0,0,114,213,0,0,0,38,4,0,0,
-    115,22,0,0,0,0,1,10,1,10,4,2,1,2,254,6,
-    4,12,1,2,1,14,1,2,1,2,253,122,29,83,111,117,
-    114,99,101,108,101,115,115,70,105,108,101,76,111,97,100,101,
-    114,46,103,101,116,95,99,111,100,101,99,2,0,0,0,0,
-    0,0,0,0,0,0,0,2,0,0,0,1,0,0,0,67,
-    0,0,0,115,4,0,0,0,100,1,83,0,41,2,122,39,
-    82,101,116,117,114,110,32,78,111,110,101,32,97,115,32,116,
-    104,101,114,101,32,105,115,32,110,111,32,115,111,117,114,99,
-    101,32,99,111,100,101,46,78,114,5,0,0,0,114,219,0,
-    0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0,
-    0,114,229,0,0,0,54,4,0,0,115,2,0,0,0,0,
-    2,122,31,83,111,117,114,99,101,108,101,115,115,70,105,108,
+    150,0,0,0,114,149,0,0,0,114,151,0,0,0,114,152,
+    0,0,0,114,206,0,0,0,114,239,0,0,0,114,245,0,
+    0,0,114,248,0,0,0,114,7,0,0,0,114,7,0,0,
+    0,114,7,0,0,0,114,8,0,0,0,114,235,0,0,0,
+    93,3,0,0,115,12,0,0,0,8,0,4,2,8,3,8,
+    8,8,3,12,8,114,235,0,0,0,99,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,64,
+    0,0,0,115,74,0,0,0,101,0,90,1,100,0,90,2,
+    100,1,100,2,132,0,90,3,100,3,100,4,132,0,90,4,
+    100,5,100,6,132,0,90,5,100,7,100,8,132,0,90,6,
+    100,9,100,10,132,0,90,7,100,11,100,12,156,1,100,13,
+    100,14,132,2,90,8,100,15,100,16,132,0,90,9,100,17,
+    83,0,41,18,218,12,83,111,117,114,99,101,76,111,97,100,
+    101,114,99,2,0,0,0,0,0,0,0,0,0,0,0,2,
+    0,0,0,1,0,0,0,67,0,0,0,115,4,0,0,0,
+    116,0,130,1,41,1,122,165,79,112,116,105,111,110,97,108,
+    32,109,101,116,104,111,100,32,116,104,97,116,32,114,101,116,
+    117,114,110,115,32,116,104,101,32,109,111,100,105,102,105,99,
+    97,116,105,111,110,32,116,105,109,101,32,40,97,110,32,105,
+    110,116,41,32,102,111,114,32,116,104,101,10,32,32,32,32,
+    32,32,32,32,115,112,101,99,105,102,105,101,100,32,112,97,
+    116,104,32,40,97,32,115,116,114,41,46,10,10,32,32,32,
+    32,32,32,32,32,82,97,105,115,101,115,32,79,83,69,114,
+    114,111,114,32,119,104,101,110,32,116,104,101,32,112,97,116,
+    104,32,99,97,110,110,111,116,32,98,101,32,104,97,110,100,
+    108,101,100,46,10,32,32,32,32,32,32,32,32,41,1,114,
+    76,0,0,0,169,2,114,143,0,0,0,114,65,0,0,0,
+    114,7,0,0,0,114,7,0,0,0,114,8,0,0,0,218,
+    10,112,97,116,104,95,109,116,105,109,101,125,3,0,0,115,
+    2,0,0,0,4,6,122,23,83,111,117,114,99,101,76,111,
+    97,100,101,114,46,112,97,116,104,95,109,116,105,109,101,99,
+    2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,
+    4,0,0,0,67,0,0,0,115,14,0,0,0,100,1,124,
+    0,160,0,124,1,161,1,105,1,83,0,41,2,97,158,1,
+    0,0,79,112,116,105,111,110,97,108,32,109,101,116,104,111,
+    100,32,114,101,116,117,114,110,105,110,103,32,97,32,109,101,
+    116,97,100,97,116,97,32,100,105,99,116,32,102,111,114,32,
+    116,104,101,32,115,112,101,99,105,102,105,101,100,10,32,32,
+    32,32,32,32,32,32,112,97,116,104,32,40,97,32,115,116,
+    114,41,46,10,10,32,32,32,32,32,32,32,32,80,111,115,
+    115,105,98,108,101,32,107,101,121,115,58,10,32,32,32,32,
+    32,32,32,32,45,32,39,109,116,105,109,101,39,32,40,109,
+    97,110,100,97,116,111,114,121,41,32,105,115,32,116,104,101,
+    32,110,117,109,101,114,105,99,32,116,105,109,101,115,116,97,
+    109,112,32,111,102,32,108,97,115,116,32,115,111,117,114,99,
+    101,10,32,32,32,32,32,32,32,32,32,32,99,111,100,101,
+    32,109,111,100,105,102,105,99,97,116,105,111,110,59,10,32,
+    32,32,32,32,32,32,32,45,32,39,115,105,122,101,39,32,
+    40,111,112,116,105,111,110,97,108,41,32,105,115,32,116,104,
+    101,32,115,105,122,101,32,105,110,32,98,121,116,101,115,32,
+    111,102,32,116,104,101,32,115,111,117,114,99,101,32,99,111,
+    100,101,46,10,10,32,32,32,32,32,32,32,32,73,109,112,
+    108,101,109,101,110,116,105,110,103,32,116,104,105,115,32,109,
+    101,116,104,111,100,32,97,108,108,111,119,115,32,116,104,101,
+    32,108,111,97,100,101,114,32,116,111,32,114,101,97,100,32,
+    98,121,116,101,99,111,100,101,32,102,105,108,101,115,46,10,
+    32,32,32,32,32,32,32,32,82,97,105,115,101,115,32,79,
+    83,69,114,114,111,114,32,119,104,101,110,32,116,104,101,32,
+    112,97,116,104,32,99,97,110,110,111,116,32,98,101,32,104,
+    97,110,100,108,101,100,46,10,32,32,32,32,32,32,32,32,
+    114,193,0,0,0,41,1,114,251,0,0,0,114,250,0,0,
+    0,114,7,0,0,0,114,7,0,0,0,114,8,0,0,0,
+    218,10,112,97,116,104,95,115,116,97,116,115,133,3,0,0,
+    115,2,0,0,0,14,12,122,23,83,111,117,114,99,101,76,
+    111,97,100,101,114,46,112,97,116,104,95,115,116,97,116,115,
+    99,4,0,0,0,0,0,0,0,0,0,0,0,4,0,0,
+    0,4,0,0,0,67,0,0,0,115,12,0,0,0,124,0,
+    160,0,124,2,124,3,161,2,83,0,41,1,122,228,79,112,
+    116,105,111,110,97,108,32,109,101,116,104,111,100,32,119,104,
+    105,99,104,32,119,114,105,116,101,115,32,100,97,116,97,32,
+    40,98,121,116,101,115,41,32,116,111,32,97,32,102,105,108,
+    101,32,112,97,116,104,32,40,97,32,115,116,114,41,46,10,
+    10,32,32,32,32,32,32,32,32,73,109,112,108,101,109,101,
+    110,116,105,110,103,32,116,104,105,115,32,109,101,116,104,111,
+    100,32,97,108,108,111,119,115,32,102,111,114,32,116,104,101,
+    32,119,114,105,116,105,110,103,32,111,102,32,98,121,116,101,
+    99,111,100,101,32,102,105,108,101,115,46,10,10,32,32,32,
+    32,32,32,32,32,84,104,101,32,115,111,117,114,99,101,32,
+    112,97,116,104,32,105,115,32,110,101,101,100,101,100,32,105,
+    110,32,111,114,100,101,114,32,116,111,32,99,111,114,114,101,
+    99,116,108,121,32,116,114,97,110,115,102,101,114,32,112,101,
+    114,109,105,115,115,105,111,110,115,10,32,32,32,32,32,32,
+    32,32,41,1,218,8,115,101,116,95,100,97,116,97,41,4,
+    114,143,0,0,0,114,134,0,0,0,90,10,99,97,99,104,
+    101,95,112,97,116,104,114,41,0,0,0,114,7,0,0,0,
+    114,7,0,0,0,114,8,0,0,0,218,15,95,99,97,99,
+    104,101,95,98,121,116,101,99,111,100,101,147,3,0,0,115,
+    2,0,0,0,12,8,122,28,83,111,117,114,99,101,76,111,
+    97,100,101,114,46,95,99,97,99,104,101,95,98,121,116,101,
+    99,111,100,101,99,3,0,0,0,0,0,0,0,0,0,0,
+    0,3,0,0,0,1,0,0,0,67,0,0,0,114,23,0,
+    0,0,41,2,122,150,79,112,116,105,111,110,97,108,32,109,
+    101,116,104,111,100,32,119,104,105,99,104,32,119,114,105,116,
+    101,115,32,100,97,116,97,32,40,98,121,116,101,115,41,32,
+    116,111,32,97,32,102,105,108,101,32,112,97,116,104,32,40,
+    97,32,115,116,114,41,46,10,10,32,32,32,32,32,32,32,
+    32,73,109,112,108,101,109,101,110,116,105,110,103,32,116,104,
+    105,115,32,109,101,116,104,111,100,32,97,108,108,111,119,115,
+    32,102,111,114,32,116,104,101,32,119,114,105,116,105,110,103,
+    32,111,102,32,98,121,116,101,99,111,100,101,32,102,105,108,
+    101,115,46,10,32,32,32,32,32,32,32,32,78,114,7,0,
+    0,0,41,3,114,143,0,0,0,114,65,0,0,0,114,41,
+    0,0,0,114,7,0,0,0,114,7,0,0,0,114,8,0,
+    0,0,114,253,0,0,0,157,3,0,0,114,240,0,0,0,
+    122,21,83,111,117,114,99,101,76,111,97,100,101,114,46,115,
+    101,116,95,100,97,116,97,99,2,0,0,0,0,0,0,0,
+    0,0,0,0,5,0,0,0,10,0,0,0,67,0,0,0,
+    115,70,0,0,0,124,0,160,0,124,1,161,1,125,2,122,
+    10,124,0,160,1,124,2,161,1,125,3,87,0,116,4,124,
+    3,131,1,83,0,4,0,116,2,121,34,1,0,125,4,1,
+    0,122,7,116,3,100,1,124,1,100,2,141,2,124,4,130,
+    2,100,3,125,4,126,4,119,1,119,0,41,4,122,52,67,
+    111,110,99,114,101,116,101,32,105,109,112,108,101,109,101,110,
+    116,97,116,105,111,110,32,111,102,32,73,110,115,112,101,99,
+    116,76,111,97,100,101,114,46,103,101,116,95,115,111,117,114,
+    99,101,46,122,39,115,111,117,114,99,101,32,110,111,116,32,
+    97,118,97,105,108,97,98,108,101,32,116,104,114,111,117,103,
+    104,32,103,101,116,95,100,97,116,97,40,41,114,140,0,0,
+    0,78,41,5,114,203,0,0,0,218,8,103,101,116,95,100,
+    97,116,97,114,76,0,0,0,114,142,0,0,0,114,200,0,
+    0,0,41,5,114,143,0,0,0,114,163,0,0,0,114,65,
+    0,0,0,114,198,0,0,0,218,3,101,120,99,114,7,0,
+    0,0,114,7,0,0,0,114,8,0,0,0,218,10,103,101,
+    116,95,115,111,117,114,99,101,164,3,0,0,115,24,0,0,
+    0,10,2,2,1,12,1,8,4,14,253,4,1,2,1,4,
+    255,2,1,2,255,8,128,2,255,122,23,83,111,117,114,99,
     101,76,111,97,100,101,114,46,103,101,116,95,115,111,117,114,
-    99,101,78,41,6,114,125,0,0,0,114,124,0,0,0,114,
-    126,0,0,0,114,127,0,0,0,114,213,0,0,0,114,229,
-    0,0,0,114,5,0,0,0,114,5,0,0,0,114,5,0,
-    0,0,114,8,0,0,0,114,15,1,0,0,34,4,0,0,
-    115,6,0,0,0,8,2,4,2,8,16,114,15,1,0,0,
-    99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,3,0,0,0,64,0,0,0,115,92,0,0,0,101,0,
-    90,1,100,0,90,2,100,1,90,3,100,2,100,3,132,0,
-    90,4,100,4,100,5,132,0,90,5,100,6,100,7,132,0,
-    90,6,100,8,100,9,132,0,90,7,100,10,100,11,132,0,
-    90,8,100,12,100,13,132,0,90,9,100,14,100,15,132,0,
-    90,10,100,16,100,17,132,0,90,11,101,12,100,18,100,19,
-    132,0,131,1,90,13,100,20,83,0,41,21,114,252,0,0,
-    0,122,93,76,111,97,100,101,114,32,102,111,114,32,101,120,
-    116,101,110,115,105,111,110,32,109,111,100,117,108,101,115,46,
-    10,10,32,32,32,32,84,104,101,32,99,111,110,115,116,114,
-    117,99,116,111,114,32,105,115,32,100,101,115,105,103,110,101,
-    100,32,116,111,32,119,111,114,107,32,119,105,116,104,32,70,
-    105,108,101,70,105,110,100,101,114,46,10,10,32,32,32,32,
-    99,3,0,0,0,0,0,0,0,0,0,0,0,3,0,0,
-    0,2,0,0,0,67,0,0,0,115,16,0,0,0,124,1,
-    124,0,95,0,124,2,124,0,95,1,100,0,83,0,114,109,
-    0,0,0,114,159,0,0,0,114,5,1,0,0,114,5,0,
-    0,0,114,5,0,0,0,114,8,0,0,0,114,209,0,0,
-    0,71,4,0,0,115,4,0,0,0,0,1,6,1,122,28,
-    69,120,116,101,110,115,105,111,110,70,105,108,101,76,111,97,
+    99,101,114,130,0,0,0,41,1,218,9,95,111,112,116,105,
+    109,105,122,101,99,3,0,0,0,0,0,0,0,1,0,0,
+    0,4,0,0,0,8,0,0,0,67,0,0,0,115,22,0,
+    0,0,116,0,106,1,116,2,124,1,124,2,100,1,100,2,
+    124,3,100,3,141,6,83,0,41,4,122,130,82,101,116,117,
+    114,110,32,116,104,101,32,99,111,100,101,32,111,98,106,101,
+    99,116,32,99,111,109,112,105,108,101,100,32,102,114,111,109,
+    32,115,111,117,114,99,101,46,10,10,32,32,32,32,32,32,
+    32,32,84,104,101,32,39,100,97,116,97,39,32,97,114,103,
+    117,109,101,110,116,32,99,97,110,32,98,101,32,97,110,121,
+    32,111,98,106,101,99,116,32,116,121,112,101,32,116,104,97,
+    116,32,99,111,109,112,105,108,101,40,41,32,115,117,112,112,
+    111,114,116,115,46,10,32,32,32,32,32,32,32,32,114,243,
+    0,0,0,84,41,2,218,12,100,111,110,116,95,105,110,104,
+    101,114,105,116,114,108,0,0,0,41,3,114,159,0,0,0,
+    114,242,0,0,0,218,7,99,111,109,112,105,108,101,41,4,
+    114,143,0,0,0,114,41,0,0,0,114,65,0,0,0,114,
+    2,1,0,0,114,7,0,0,0,114,7,0,0,0,114,8,
+    0,0,0,218,14,115,111,117,114,99,101,95,116,111,95,99,
+    111,100,101,174,3,0,0,115,6,0,0,0,12,5,4,1,
+    6,255,122,27,83,111,117,114,99,101,76,111,97,100,101,114,
+    46,115,111,117,114,99,101,95,116,111,95,99,111,100,101,99,
+    2,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,
+    9,0,0,0,67,0,0,0,115,2,2,0,0,124,0,160,
+    0,124,1,161,1,125,2,100,1,125,3,100,1,125,4,100,
+    1,125,5,100,2,125,6,100,3,125,7,122,6,116,1,124,
+    2,131,1,125,8,87,0,110,11,4,0,116,2,121,32,1,
+    0,1,0,1,0,100,1,125,8,89,0,110,144,119,0,122,
+    7,124,0,160,3,124,2,161,1,125,9,87,0,110,9,4,
+    0,116,4,121,49,1,0,1,0,1,0,89,0,110,127,119,
+    0,116,5,124,9,100,4,25,0,131,1,125,3,122,7,124,
+    0,160,6,124,8,161,1,125,10,87,0,110,9,4,0,116,
+    4,121,72,1,0,1,0,1,0,89,0,110,104,119,0,124,
+    1,124,8,100,5,156,2,125,11,122,71,116,7,124,10,124,
+    1,124,11,131,3,125,12,116,8,124,10,131,1,100,6,100,
+    1,133,2,25,0,125,13,124,12,100,7,64,0,100,8,107,
+    3,125,6,124,6,114,138,124,12,100,9,64,0,100,8,107,
+    3,125,7,116,9,106,10,100,10,107,3,114,137,124,7,115,
+    119,116,9,106,10,100,11,107,2,114,137,124,0,160,6,124,
+    2,161,1,125,4,116,9,160,11,116,12,124,4,161,2,125,
+    5,116,13,124,10,124,5,124,1,124,11,131,4,1,0,110,
+    10,116,14,124,10,124,3,124,9,100,12,25,0,124,1,124,
+    11,131,5,1,0,87,0,110,11,4,0,116,15,116,16,102,
+    2,121,160,1,0,1,0,1,0,89,0,110,16,119,0,116,
+    17,160,18,100,13,124,8,124,2,161,3,1,0,116,19,124,
+    13,124,1,124,8,124,2,100,14,141,4,83,0,124,4,100,
+    1,117,0,114,185,124,0,160,6,124,2,161,1,125,4,124,
+    0,160,20,124,4,124,2,161,2,125,14,116,17,160,18,100,
+    15,124,2,161,2,1,0,116,21,106,22,115,255,124,8,100,
+    1,117,1,114,255,124,3,100,1,117,1,114,255,124,6,114,
+    226,124,5,100,1,117,0,114,219,116,9,160,11,124,4,161,
+    1,125,5,116,23,124,14,124,5,124,7,131,3,125,10,110,
+    8,116,24,124,14,124,3,116,25,124,4,131,1,131,3,125,
+    10,122,10,124,0,160,26,124,2,124,8,124,10,161,3,1,
+    0,87,0,124,14,83,0,4,0,116,2,121,254,1,0,1,
+    0,1,0,89,0,124,14,83,0,119,0,124,14,83,0,41,
+    16,122,190,67,111,110,99,114,101,116,101,32,105,109,112,108,
+    101,109,101,110,116,97,116,105,111,110,32,111,102,32,73,110,
+    115,112,101,99,116,76,111,97,100,101,114,46,103,101,116,95,
+    99,111,100,101,46,10,10,32,32,32,32,32,32,32,32,82,
+    101,97,100,105,110,103,32,111,102,32,98,121,116,101,99,111,
+    100,101,32,114,101,113,117,105,114,101,115,32,112,97,116,104,
+    95,115,116,97,116,115,32,116,111,32,98,101,32,105,109,112,
+    108,101,109,101,110,116,101,100,46,32,84,111,32,119,114,105,
+    116,101,10,32,32,32,32,32,32,32,32,98,121,116,101,99,
+    111,100,101,44,32,115,101,116,95,100,97,116,97,32,109,117,
+    115,116,32,97,108,115,111,32,98,101,32,105,109,112,108,101,
+    109,101,110,116,101,100,46,10,10,32,32,32,32,32,32,32,
+    32,78,70,84,114,193,0,0,0,114,183,0,0,0,114,169,
+    0,0,0,114,3,0,0,0,114,0,0,0,0,114,44,0,
+    0,0,90,5,110,101,118,101,114,90,6,97,108,119,97,121,
+    115,218,4,115,105,122,101,122,13,123,125,32,109,97,116,99,
+    104,101,115,32,123,125,41,3,114,141,0,0,0,114,132,0,
+    0,0,114,134,0,0,0,122,19,99,111,100,101,32,111,98,
+    106,101,99,116,32,102,114,111,109,32,123,125,41,27,114,203,
+    0,0,0,114,121,0,0,0,114,107,0,0,0,114,252,0,
+    0,0,114,76,0,0,0,114,33,0,0,0,114,255,0,0,
+    0,114,176,0,0,0,218,10,109,101,109,111,114,121,118,105,
+    101,119,114,187,0,0,0,90,21,99,104,101,99,107,95,104,
+    97,115,104,95,98,97,115,101,100,95,112,121,99,115,114,181,
+    0,0,0,218,17,95,82,65,87,95,77,65,71,73,67,95,
+    78,85,77,66,69,82,114,182,0,0,0,114,180,0,0,0,
+    114,142,0,0,0,114,174,0,0,0,114,159,0,0,0,114,
+    173,0,0,0,114,189,0,0,0,114,5,1,0,0,114,15,
+    0,0,0,218,19,100,111,110,116,95,119,114,105,116,101,95,
+    98,121,116,101,99,111,100,101,114,195,0,0,0,114,194,0,
+    0,0,114,4,0,0,0,114,254,0,0,0,41,15,114,143,
+    0,0,0,114,163,0,0,0,114,134,0,0,0,114,178,0,
+    0,0,114,198,0,0,0,114,181,0,0,0,90,10,104,97,
+    115,104,95,98,97,115,101,100,90,12,99,104,101,99,107,95,
+    115,111,117,114,99,101,114,132,0,0,0,218,2,115,116,114,
+    41,0,0,0,114,175,0,0,0,114,16,0,0,0,90,10,
+    98,121,116,101,115,95,100,97,116,97,90,11,99,111,100,101,
+    95,111,98,106,101,99,116,114,7,0,0,0,114,7,0,0,
+    0,114,8,0,0,0,114,241,0,0,0,182,3,0,0,115,
+    170,0,0,0,10,7,4,1,4,1,4,1,4,1,4,1,
+    2,1,12,1,12,1,8,1,2,255,2,3,14,1,12,1,
+    4,1,2,255,12,3,2,1,14,1,12,1,4,1,2,255,
+    2,4,2,1,6,254,2,4,12,1,16,1,12,1,4,1,
+    12,1,10,1,2,1,2,255,8,2,2,254,10,3,4,1,
+    2,1,2,1,4,254,8,4,2,1,4,255,2,128,2,3,
+    2,1,2,1,6,1,2,1,2,1,4,251,4,128,16,7,
+    4,1,2,255,8,3,2,1,4,255,6,2,2,1,2,1,
+    6,254,8,3,10,1,12,1,12,1,14,1,6,1,2,255,
+    4,2,8,1,10,1,14,1,6,2,6,1,4,255,2,2,
+    16,1,4,3,12,254,2,1,4,1,2,254,4,2,122,21,
+    83,111,117,114,99,101,76,111,97,100,101,114,46,103,101,116,
+    95,99,111,100,101,78,41,10,114,150,0,0,0,114,149,0,
+    0,0,114,151,0,0,0,114,251,0,0,0,114,252,0,0,
+    0,114,254,0,0,0,114,253,0,0,0,114,1,1,0,0,
+    114,5,1,0,0,114,241,0,0,0,114,7,0,0,0,114,
+    7,0,0,0,114,7,0,0,0,114,8,0,0,0,114,249,
+    0,0,0,123,3,0,0,115,16,0,0,0,8,0,8,2,
+    8,8,8,14,8,10,8,7,14,10,12,8,114,249,0,0,
+    0,99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,4,0,0,0,0,0,0,0,115,92,0,0,0,101,
+    0,90,1,100,0,90,2,100,1,90,3,100,2,100,3,132,
+    0,90,4,100,4,100,5,132,0,90,5,100,6,100,7,132,
+    0,90,6,101,7,135,0,102,1,100,8,100,9,132,8,131,
+    1,90,8,101,7,100,10,100,11,132,0,131,1,90,9,100,
+    12,100,13,132,0,90,10,101,7,100,14,100,15,132,0,131,
+    1,90,11,135,0,4,0,90,12,83,0,41,16,218,10,70,
+    105,108,101,76,111,97,100,101,114,122,103,66,97,115,101,32,
+    102,105,108,101,32,108,111,97,100,101,114,32,99,108,97,115,
+    115,32,119,104,105,99,104,32,105,109,112,108,101,109,101,110,
+    116,115,32,116,104,101,32,108,111,97,100,101,114,32,112,114,
+    111,116,111,99,111,108,32,109,101,116,104,111,100,115,32,116,
+    104,97,116,10,32,32,32,32,114,101,113,117,105,114,101,32,
+    102,105,108,101,32,115,121,115,116,101,109,32,117,115,97,103,
+    101,46,99,3,0,0,0,0,0,0,0,0,0,0,0,3,
+    0,0,0,2,0,0,0,67,0,0,0,115,16,0,0,0,
+    124,1,124,0,95,0,124,2,124,0,95,1,100,1,83,0,
+    41,2,122,75,67,97,99,104,101,32,116,104,101,32,109,111,
+    100,117,108,101,32,110,97,109,101,32,97,110,100,32,116,104,
+    101,32,112,97,116,104,32,116,111,32,116,104,101,32,102,105,
+    108,101,32,102,111,117,110,100,32,98,121,32,116,104,101,10,
+    32,32,32,32,32,32,32,32,102,105,110,100,101,114,46,78,
+    114,183,0,0,0,41,3,114,143,0,0,0,114,163,0,0,
+    0,114,65,0,0,0,114,7,0,0,0,114,7,0,0,0,
+    114,8,0,0,0,114,236,0,0,0,16,4,0,0,115,4,
+    0,0,0,6,3,10,1,122,19,70,105,108,101,76,111,97,
     100,101,114,46,95,95,105,110,105,116,95,95,99,2,0,0,
     0,0,0,0,0,0,0,0,0,2,0,0,0,2,0,0,
-    0,67,0,0,0,115,24,0,0,0,124,0,106,0,124,1,
-    106,0,107,2,111,22,124,0,106,1,124,1,106,1,107,2,
-    83,0,114,109,0,0,0,114,240,0,0,0,114,242,0,0,
-    0,114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,
-    114,243,0,0,0,75,4,0,0,115,6,0,0,0,0,1,
-    12,1,10,255,122,26,69,120,116,101,110,115,105,111,110,70,
+    0,67,0,0,0,243,24,0,0,0,124,0,106,0,124,1,
+    106,0,107,2,111,11,124,0,106,1,124,1,106,1,107,2,
+    83,0,114,69,0,0,0,169,2,218,9,95,95,99,108,97,
+    115,115,95,95,114,156,0,0,0,169,2,114,143,0,0,0,
+    90,5,111,116,104,101,114,114,7,0,0,0,114,7,0,0,
+    0,114,8,0,0,0,218,6,95,95,101,113,95,95,22,4,
+    0,0,243,6,0,0,0,12,1,10,1,2,255,122,17,70,
     105,108,101,76,111,97,100,101,114,46,95,95,101,113,95,95,
     99,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,
-    0,3,0,0,0,67,0,0,0,115,20,0,0,0,116,0,
+    0,3,0,0,0,67,0,0,0,243,20,0,0,0,116,0,
     124,0,106,1,131,1,116,0,124,0,106,2,131,1,65,0,
-    83,0,114,109,0,0,0,114,244,0,0,0,114,246,0,0,
-    0,114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,
-    114,247,0,0,0,79,4,0,0,115,2,0,0,0,0,1,
-    122,28,69,120,116,101,110,115,105,111,110,70,105,108,101,76,
-    111,97,100,101,114,46,95,95,104,97,115,104,95,95,99,2,
-    0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,5,
-    0,0,0,67,0,0,0,115,36,0,0,0,116,0,160,1,
-    116,2,106,3,124,1,161,2,125,2,116,0,160,4,100,1,
-    124,1,106,5,124,0,106,6,161,3,1,0,124,2,83,0,
-    41,2,122,38,67,114,101,97,116,101,32,97,110,32,117,110,
-    105,116,105,97,108,105,122,101,100,32,101,120,116,101,110,115,
-    105,111,110,32,109,111,100,117,108,101,122,38,101,120,116,101,
-    110,115,105,111,110,32,109,111,100,117,108,101,32,123,33,114,
-    125,32,108,111,97,100,101,100,32,102,114,111,109,32,123,33,
-    114,125,41,7,114,134,0,0,0,114,214,0,0,0,114,163,
-    0,0,0,90,14,99,114,101,97,116,101,95,100,121,110,97,
-    109,105,99,114,149,0,0,0,114,116,0,0,0,114,44,0,
-    0,0,41,3,114,118,0,0,0,114,187,0,0,0,114,216,
-    0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,
-    0,0,114,212,0,0,0,82,4,0,0,115,14,0,0,0,
-    0,2,4,1,6,255,4,2,6,1,8,255,4,2,122,33,
-    69,120,116,101,110,115,105,111,110,70,105,108,101,76,111,97,
-    100,101,114,46,99,114,101,97,116,101,95,109,111,100,117,108,
-    101,99,2,0,0,0,0,0,0,0,0,0,0,0,2,0,
-    0,0,5,0,0,0,67,0,0,0,115,36,0,0,0,116,
-    0,160,1,116,2,106,3,124,1,161,2,1,0,116,0,160,
-    4,100,1,124,0,106,5,124,0,106,6,161,3,1,0,100,
-    2,83,0,41,3,122,30,73,110,105,116,105,97,108,105,122,
-    101,32,97,110,32,101,120,116,101,110,115,105,111,110,32,109,
-    111,100,117,108,101,122,40,101,120,116,101,110,115,105,111,110,
-    32,109,111,100,117,108,101,32,123,33,114,125,32,101,120,101,
-    99,117,116,101,100,32,102,114,111,109,32,123,33,114,125,78,
-    41,7,114,134,0,0,0,114,214,0,0,0,114,163,0,0,
-    0,90,12,101,120,101,99,95,100,121,110,97,109,105,99,114,
-    149,0,0,0,114,116,0,0,0,114,44,0,0,0,114,253,
-    0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,
-    0,0,114,217,0,0,0,90,4,0,0,115,8,0,0,0,
-    0,2,14,1,6,1,8,255,122,31,69,120,116,101,110,115,
-    105,111,110,70,105,108,101,76,111,97,100,101,114,46,101,120,
-    101,99,95,109,111,100,117,108,101,99,2,0,0,0,0,0,
-    0,0,0,0,0,0,2,0,0,0,4,0,0,0,3,0,
-    0,0,115,36,0,0,0,116,0,124,0,106,1,131,1,100,
-    1,25,0,137,0,116,2,135,0,102,1,100,2,100,3,132,
-    8,116,3,68,0,131,1,131,1,83,0,41,4,122,49,82,
-    101,116,117,114,110,32,84,114,117,101,32,105,102,32,116,104,
-    101,32,101,120,116,101,110,115,105,111,110,32,109,111,100,117,
-    108,101,32,105,115,32,97,32,112,97,99,107,97,103,101,46,
-    114,39,0,0,0,99,1,0,0,0,0,0,0,0,0,0,
-    0,0,2,0,0,0,4,0,0,0,51,0,0,0,115,26,
-    0,0,0,124,0,93,18,125,1,136,0,100,0,124,1,23,
-    0,107,2,86,0,1,0,113,2,100,1,83,0,41,2,114,
-    209,0,0,0,78,114,5,0,0,0,169,2,114,32,0,0,
-    0,218,6,115,117,102,102,105,120,169,1,90,9,102,105,108,
-    101,95,110,97,109,101,114,5,0,0,0,114,8,0,0,0,
-    218,9,60,103,101,110,101,120,112,114,62,99,4,0,0,115,
-    4,0,0,0,4,1,2,255,122,49,69,120,116,101,110,115,
-    105,111,110,70,105,108,101,76,111,97,100,101,114,46,105,115,
-    95,112,97,99,107,97,103,101,46,60,108,111,99,97,108,115,
-    62,46,60,103,101,110,101,120,112,114,62,41,4,114,47,0,
-    0,0,114,44,0,0,0,218,3,97,110,121,218,18,69,88,
-    84,69,78,83,73,79,78,95,83,85,70,70,73,88,69,83,
-    114,219,0,0,0,114,5,0,0,0,114,18,1,0,0,114,
-    8,0,0,0,114,182,0,0,0,96,4,0,0,115,8,0,
-    0,0,0,2,14,1,12,1,2,255,122,30,69,120,116,101,
-    110,115,105,111,110,70,105,108,101,76,111,97,100,101,114,46,
-    105,115,95,112,97,99,107,97,103,101,99,2,0,0,0,0,
-    0,0,0,0,0,0,0,2,0,0,0,1,0,0,0,67,
-    0,0,0,115,4,0,0,0,100,1,83,0,41,2,122,63,
-    82,101,116,117,114,110,32,78,111,110,101,32,97,115,32,97,
-    110,32,101,120,116,101,110,115,105,111,110,32,109,111,100,117,
-    108,101,32,99,97,110,110,111,116,32,99,114,101,97,116,101,
-    32,97,32,99,111,100,101,32,111,98,106,101,99,116,46,78,
-    114,5,0,0,0,114,219,0,0,0,114,5,0,0,0,114,
-    5,0,0,0,114,8,0,0,0,114,213,0,0,0,102,4,
-    0,0,115,2,0,0,0,0,2,122,28,69,120,116,101,110,
-    115,105,111,110,70,105,108,101,76,111,97,100,101,114,46,103,
-    101,116,95,99,111,100,101,99,2,0,0,0,0,0,0,0,
-    0,0,0,0,2,0,0,0,1,0,0,0,67,0,0,0,
-    115,4,0,0,0,100,1,83,0,41,2,122,53,82,101,116,
-    117,114,110,32,78,111,110,101,32,97,115,32,101,120,116,101,
-    110,115,105,111,110,32,109,111,100,117,108,101,115,32,104,97,
-    118,101,32,110,111,32,115,111,117,114,99,101,32,99,111,100,
-    101,46,78,114,5,0,0,0,114,219,0,0,0,114,5,0,
-    0,0,114,5,0,0,0,114,8,0,0,0,114,229,0,0,
-    0,106,4,0,0,115,2,0,0,0,0,2,122,30,69,120,
-    116,101,110,115,105,111,110,70,105,108,101,76,111,97,100,101,
-    114,46,103,101,116,95,115,111,117,114,99,101,99,2,0,0,
-    0,0,0,0,0,0,0,0,0,2,0,0,0,1,0,0,
-    0,67,0,0,0,115,6,0,0,0,124,0,106,0,83,0,
-    114,250,0,0,0,114,48,0,0,0,114,219,0,0,0,114,
-    5,0,0,0,114,5,0,0,0,114,8,0,0,0,114,179,
-    0,0,0,110,4,0,0,115,2,0,0,0,0,3,122,32,
-    69,120,116,101,110,115,105,111,110,70,105,108,101,76,111,97,
-    100,101,114,46,103,101,116,95,102,105,108,101,110,97,109,101,
-    78,41,14,114,125,0,0,0,114,124,0,0,0,114,126,0,
-    0,0,114,127,0,0,0,114,209,0,0,0,114,243,0,0,
-    0,114,247,0,0,0,114,212,0,0,0,114,217,0,0,0,
-    114,182,0,0,0,114,213,0,0,0,114,229,0,0,0,114,
-    136,0,0,0,114,179,0,0,0,114,5,0,0,0,114,5,
-    0,0,0,114,5,0,0,0,114,8,0,0,0,114,252,0,
-    0,0,63,4,0,0,115,22,0,0,0,8,2,4,6,8,
-    4,8,4,8,3,8,8,8,6,8,6,8,4,8,4,2,
-    1,114,252,0,0,0,99,0,0,0,0,0,0,0,0,0,
-    0,0,0,0,0,0,0,2,0,0,0,64,0,0,0,115,
-    104,0,0,0,101,0,90,1,100,0,90,2,100,1,90,3,
-    100,2,100,3,132,0,90,4,100,4,100,5,132,0,90,5,
-    100,6,100,7,132,0,90,6,100,8,100,9,132,0,90,7,
-    100,10,100,11,132,0,90,8,100,12,100,13,132,0,90,9,
-    100,14,100,15,132,0,90,10,100,16,100,17,132,0,90,11,
-    100,18,100,19,132,0,90,12,100,20,100,21,132,0,90,13,
-    100,22,100,23,132,0,90,14,100,24,83,0,41,25,218,14,
-    95,78,97,109,101,115,112,97,99,101,80,97,116,104,97,38,
-    1,0,0,82,101,112,114,101,115,101,110,116,115,32,97,32,
-    110,97,109,101,115,112,97,99,101,32,112,97,99,107,97,103,
-    101,39,115,32,112,97,116,104,46,32,32,73,116,32,117,115,
-    101,115,32,116,104,101,32,109,111,100,117,108,101,32,110,97,
-    109,101,10,32,32,32,32,116,111,32,102,105,110,100,32,105,
-    116,115,32,112,97,114,101,110,116,32,109,111,100,117,108,101,
-    44,32,97,110,100,32,102,114,111,109,32,116,104,101,114,101,
-    32,105,116,32,108,111,111,107,115,32,117,112,32,116,104,101,
-    32,112,97,114,101,110,116,39,115,10,32,32,32,32,95,95,
-    112,97,116,104,95,95,46,32,32,87,104,101,110,32,116,104,
-    105,115,32,99,104,97,110,103,101,115,44,32,116,104,101,32,
-    109,111,100,117,108,101,39,115,32,111,119,110,32,112,97,116,
-    104,32,105,115,32,114,101,99,111,109,112,117,116,101,100,44,
-    10,32,32,32,32,117,115,105,110,103,32,112,97,116,104,95,
-    102,105,110,100,101,114,46,32,32,70,111,114,32,116,111,112,
-    45,108,101,118,101,108,32,109,111,100,117,108,101,115,44,32,
-    116,104,101,32,112,97,114,101,110,116,32,109,111,100,117,108,
-    101,39,115,32,112,97,116,104,10,32,32,32,32,105,115,32,
-    115,121,115,46,112,97,116,104,46,99,4,0,0,0,0,0,
-    0,0,0,0,0,0,4,0,0,0,3,0,0,0,67,0,
-    0,0,115,36,0,0,0,124,1,124,0,95,0,124,2,124,
-    0,95,1,116,2,124,0,160,3,161,0,131,1,124,0,95,
-    4,124,3,124,0,95,5,100,0,83,0,114,109,0,0,0,
-    41,6,218,5,95,110,97,109,101,218,5,95,112,97,116,104,
-    114,111,0,0,0,218,16,95,103,101,116,95,112,97,114,101,
-    110,116,95,112,97,116,104,218,17,95,108,97,115,116,95,112,
-    97,114,101,110,116,95,112,97,116,104,218,12,95,112,97,116,
-    104,95,102,105,110,100,101,114,169,4,114,118,0,0,0,114,
-    116,0,0,0,114,44,0,0,0,90,11,112,97,116,104,95,
-    102,105,110,100,101,114,114,5,0,0,0,114,5,0,0,0,
-    114,8,0,0,0,114,209,0,0,0,123,4,0,0,115,8,
-    0,0,0,0,1,6,1,6,1,14,1,122,23,95,78,97,
-    109,101,115,112,97,99,101,80,97,116,104,46,95,95,105,110,
-    105,116,95,95,99,1,0,0,0,0,0,0,0,0,0,0,
-    0,4,0,0,0,3,0,0,0,67,0,0,0,115,38,0,
-    0,0,124,0,106,0,160,1,100,1,161,1,92,3,125,1,
-    125,2,125,3,124,2,100,2,107,2,114,30,100,3,83,0,
-    124,1,100,4,102,2,83,0,41,5,122,62,82,101,116,117,
-    114,110,115,32,97,32,116,117,112,108,101,32,111,102,32,40,
-    112,97,114,101,110,116,45,109,111,100,117,108,101,45,110,97,
-    109,101,44,32,112,97,114,101,110,116,45,112,97,116,104,45,
-    97,116,116,114,45,110,97,109,101,41,114,71,0,0,0,114,
-    40,0,0,0,41,2,114,1,0,0,0,114,44,0,0,0,
-    90,8,95,95,112,97,116,104,95,95,41,2,114,23,1,0,
-    0,114,41,0,0,0,41,4,114,118,0,0,0,114,14,1,
-    0,0,218,3,100,111,116,90,2,109,101,114,5,0,0,0,
-    114,5,0,0,0,114,8,0,0,0,218,23,95,102,105,110,
-    100,95,112,97,114,101,110,116,95,112,97,116,104,95,110,97,
-    109,101,115,129,4,0,0,115,8,0,0,0,0,2,18,1,
-    8,2,4,3,122,38,95,78,97,109,101,115,112,97,99,101,
-    80,97,116,104,46,95,102,105,110,100,95,112,97,114,101,110,
-    116,95,112,97,116,104,95,110,97,109,101,115,99,1,0,0,
-    0,0,0,0,0,0,0,0,0,3,0,0,0,3,0,0,
-    0,67,0,0,0,115,28,0,0,0,124,0,160,0,161,0,
-    92,2,125,1,125,2,116,1,116,2,106,3,124,1,25,0,
-    124,2,131,2,83,0,114,109,0,0,0,41,4,114,30,1,
-    0,0,114,130,0,0,0,114,1,0,0,0,218,7,109,111,
-    100,117,108,101,115,41,3,114,118,0,0,0,90,18,112,97,
-    114,101,110,116,95,109,111,100,117,108,101,95,110,97,109,101,
-    90,14,112,97,116,104,95,97,116,116,114,95,110,97,109,101,
-    114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,114,
-    25,1,0,0,139,4,0,0,115,4,0,0,0,0,1,12,
-    1,122,31,95,78,97,109,101,115,112,97,99,101,80,97,116,
-    104,46,95,103,101,116,95,112,97,114,101,110,116,95,112,97,
-    116,104,99,1,0,0,0,0,0,0,0,0,0,0,0,3,
-    0,0,0,4,0,0,0,67,0,0,0,115,80,0,0,0,
-    116,0,124,0,160,1,161,0,131,1,125,1,124,1,124,0,
-    106,2,107,3,114,74,124,0,160,3,124,0,106,4,124,1,
-    161,2,125,2,124,2,100,0,117,1,114,68,124,2,106,5,
-    100,0,117,0,114,68,124,2,106,6,114,68,124,2,106,6,
-    124,0,95,7,124,1,124,0,95,2,124,0,106,7,83,0,
-    114,109,0,0,0,41,8,114,111,0,0,0,114,25,1,0,
-    0,114,26,1,0,0,114,27,1,0,0,114,23,1,0,0,
-    114,140,0,0,0,114,178,0,0,0,114,24,1,0,0,41,
-    3,114,118,0,0,0,90,11,112,97,114,101,110,116,95,112,
-    97,116,104,114,187,0,0,0,114,5,0,0,0,114,5,0,
-    0,0,114,8,0,0,0,218,12,95,114,101,99,97,108,99,
-    117,108,97,116,101,143,4,0,0,115,16,0,0,0,0,2,
-    12,1,10,1,14,3,18,1,6,1,8,1,6,1,122,27,
-    95,78,97,109,101,115,112,97,99,101,80,97,116,104,46,95,
-    114,101,99,97,108,99,117,108,97,116,101,99,1,0,0,0,
-    0,0,0,0,0,0,0,0,1,0,0,0,3,0,0,0,
-    67,0,0,0,115,12,0,0,0,116,0,124,0,160,1,161,
-    0,131,1,83,0,114,109,0,0,0,41,2,114,6,1,0,
-    0,114,32,1,0,0,114,246,0,0,0,114,5,0,0,0,
-    114,5,0,0,0,114,8,0,0,0,218,8,95,95,105,116,
-    101,114,95,95,156,4,0,0,115,2,0,0,0,0,1,122,
-    23,95,78,97,109,101,115,112,97,99,101,80,97,116,104,46,
-    95,95,105,116,101,114,95,95,99,2,0,0,0,0,0,0,
-    0,0,0,0,0,2,0,0,0,2,0,0,0,67,0,0,
-    0,115,12,0,0,0,124,0,160,0,161,0,124,1,25,0,
-    83,0,114,109,0,0,0,169,1,114,32,1,0,0,41,2,
-    114,118,0,0,0,218,5,105,110,100,101,120,114,5,0,0,
-    0,114,5,0,0,0,114,8,0,0,0,218,11,95,95,103,
-    101,116,105,116,101,109,95,95,159,4,0,0,115,2,0,0,
-    0,0,1,122,26,95,78,97,109,101,115,112,97,99,101,80,
-    97,116,104,46,95,95,103,101,116,105,116,101,109,95,95,99,
-    3,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,
-    3,0,0,0,67,0,0,0,115,14,0,0,0,124,2,124,
-    0,106,0,124,1,60,0,100,0,83,0,114,109,0,0,0,
-    41,1,114,24,1,0,0,41,3,114,118,0,0,0,114,35,
-    1,0,0,114,44,0,0,0,114,5,0,0,0,114,5,0,
-    0,0,114,8,0,0,0,218,11,95,95,115,101,116,105,116,
-    101,109,95,95,162,4,0,0,115,2,0,0,0,0,1,122,
-    26,95,78,97,109,101,115,112,97,99,101,80,97,116,104,46,
-    95,95,115,101,116,105,116,101,109,95,95,99,1,0,0,0,
-    0,0,0,0,0,0,0,0,1,0,0,0,3,0,0,0,
-    67,0,0,0,115,12,0,0,0,116,0,124,0,160,1,161,
-    0,131,1,83,0,114,109,0,0,0,41,2,114,23,0,0,
-    0,114,32,1,0,0,114,246,0,0,0,114,5,0,0,0,
-    114,5,0,0,0,114,8,0,0,0,218,7,95,95,108,101,
-    110,95,95,165,4,0,0,115,2,0,0,0,0,1,122,22,
-    95,78,97,109,101,115,112,97,99,101,80,97,116,104,46,95,
-    95,108,101,110,95,95,99,1,0,0,0,0,0,0,0,0,
-    0,0,0,1,0,0,0,3,0,0,0,67,0,0,0,115,
-    12,0,0,0,100,1,160,0,124,0,106,1,161,1,83,0,
-    41,2,78,122,20,95,78,97,109,101,115,112,97,99,101,80,
-    97,116,104,40,123,33,114,125,41,41,2,114,62,0,0,0,
-    114,24,1,0,0,114,246,0,0,0,114,5,0,0,0,114,
-    5,0,0,0,114,8,0,0,0,218,8,95,95,114,101,112,
-    114,95,95,168,4,0,0,115,2,0,0,0,0,1,122,23,
-    95,78,97,109,101,115,112,97,99,101,80,97,116,104,46,95,
-    95,114,101,112,114,95,95,99,2,0,0,0,0,0,0,0,
-    0,0,0,0,2,0,0,0,3,0,0,0,67,0,0,0,
-    115,12,0,0,0,124,1,124,0,160,0,161,0,118,0,83,
-    0,114,109,0,0,0,114,34,1,0,0,169,2,114,118,0,
-    0,0,218,4,105,116,101,109,114,5,0,0,0,114,5,0,
-    0,0,114,8,0,0,0,218,12,95,95,99,111,110,116,97,
-    105,110,115,95,95,171,4,0,0,115,2,0,0,0,0,1,
-    122,27,95,78,97,109,101,115,112,97,99,101,80,97,116,104,
-    46,95,95,99,111,110,116,97,105,110,115,95,95,99,2,0,
-    0,0,0,0,0,0,0,0,0,0,2,0,0,0,3,0,
-    0,0,67,0,0,0,115,16,0,0,0,124,0,106,0,160,
-    1,124,1,161,1,1,0,100,0,83,0,114,109,0,0,0,
-    41,2,114,24,1,0,0,114,186,0,0,0,114,40,1,0,
-    0,114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,
-    114,186,0,0,0,174,4,0,0,115,2,0,0,0,0,1,
-    122,21,95,78,97,109,101,115,112,97,99,101,80,97,116,104,
-    46,97,112,112,101,110,100,78,41,15,114,125,0,0,0,114,
-    124,0,0,0,114,126,0,0,0,114,127,0,0,0,114,209,
-    0,0,0,114,30,1,0,0,114,25,1,0,0,114,32,1,
-    0,0,114,33,1,0,0,114,36,1,0,0,114,37,1,0,
-    0,114,38,1,0,0,114,39,1,0,0,114,42,1,0,0,
-    114,186,0,0,0,114,5,0,0,0,114,5,0,0,0,114,
-    5,0,0,0,114,8,0,0,0,114,22,1,0,0,116,4,
-    0,0,115,24,0,0,0,8,1,4,6,8,6,8,10,8,
-    4,8,13,8,3,8,3,8,3,8,3,8,3,8,3,114,
-    22,1,0,0,99,0,0,0,0,0,0,0,0,0,0,0,
-    0,0,0,0,0,3,0,0,0,64,0,0,0,115,80,0,
-    0,0,101,0,90,1,100,0,90,2,100,1,100,2,132,0,
-    90,3,101,4,100,3,100,4,132,0,131,1,90,5,100,5,
-    100,6,132,0,90,6,100,7,100,8,132,0,90,7,100,9,
-    100,10,132,0,90,8,100,11,100,12,132,0,90,9,100,13,
-    100,14,132,0,90,10,100,15,100,16,132,0,90,11,100,17,
-    83,0,41,18,218,16,95,78,97,109,101,115,112,97,99,101,
-    76,111,97,100,101,114,99,4,0,0,0,0,0,0,0,0,
-    0,0,0,4,0,0,0,4,0,0,0,67,0,0,0,115,
-    18,0,0,0,116,0,124,1,124,2,124,3,131,3,124,0,
-    95,1,100,0,83,0,114,109,0,0,0,41,2,114,22,1,
-    0,0,114,24,1,0,0,114,28,1,0,0,114,5,0,0,
-    0,114,5,0,0,0,114,8,0,0,0,114,209,0,0,0,
-    180,4,0,0,115,2,0,0,0,0,1,122,25,95,78,97,
-    109,101,115,112,97,99,101,76,111,97,100,101,114,46,95,95,
-    105,110,105,116,95,95,99,2,0,0,0,0,0,0,0,0,
-    0,0,0,2,0,0,0,3,0,0,0,67,0,0,0,115,
-    12,0,0,0,100,1,160,0,124,1,106,1,161,1,83,0,
-    41,2,122,115,82,101,116,117,114,110,32,114,101,112,114,32,
-    102,111,114,32,116,104,101,32,109,111,100,117,108,101,46,10,
-    10,32,32,32,32,32,32,32,32,84,104,101,32,109,101,116,
-    104,111,100,32,105,115,32,100,101,112,114,101,99,97,116,101,
-    100,46,32,32,84,104,101,32,105,109,112,111,114,116,32,109,
-    97,99,104,105,110,101,114,121,32,100,111,101,115,32,116,104,
-    101,32,106,111,98,32,105,116,115,101,108,102,46,10,10,32,
-    32,32,32,32,32,32,32,122,25,60,109,111,100,117,108,101,
-    32,123,33,114,125,32,40,110,97,109,101,115,112,97,99,101,
-    41,62,41,2,114,62,0,0,0,114,125,0,0,0,41,2,
-    114,193,0,0,0,114,216,0,0,0,114,5,0,0,0,114,
-    5,0,0,0,114,8,0,0,0,218,11,109,111,100,117,108,
-    101,95,114,101,112,114,183,4,0,0,115,2,0,0,0,0,
-    7,122,28,95,78,97,109,101,115,112,97,99,101,76,111,97,
-    100,101,114,46,109,111,100,117,108,101,95,114,101,112,114,99,
-    2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,
-    1,0,0,0,67,0,0,0,115,4,0,0,0,100,1,83,
-    0,41,2,78,84,114,5,0,0,0,114,219,0,0,0,114,
-    5,0,0,0,114,5,0,0,0,114,8,0,0,0,114,182,
-    0,0,0,192,4,0,0,115,2,0,0,0,0,1,122,27,
-    95,78,97,109,101,115,112,97,99,101,76,111,97,100,101,114,
-    46,105,115,95,112,97,99,107,97,103,101,99,2,0,0,0,
-    0,0,0,0,0,0,0,0,2,0,0,0,1,0,0,0,
-    67,0,0,0,115,4,0,0,0,100,1,83,0,41,2,78,
-    114,40,0,0,0,114,5,0,0,0,114,219,0,0,0,114,
-    5,0,0,0,114,5,0,0,0,114,8,0,0,0,114,229,
-    0,0,0,195,4,0,0,115,2,0,0,0,0,1,122,27,
-    95,78,97,109,101,115,112,97,99,101,76,111,97,100,101,114,
-    46,103,101,116,95,115,111,117,114,99,101,99,2,0,0,0,
-    0,0,0,0,0,0,0,0,2,0,0,0,6,0,0,0,
-    67,0,0,0,115,16,0,0,0,116,0,100,1,100,2,100,
-    3,100,4,100,5,141,4,83,0,41,6,78,114,40,0,0,
-    0,122,8,60,115,116,114,105,110,103,62,114,215,0,0,0,
-    84,41,1,114,231,0,0,0,41,1,114,232,0,0,0,114,
-    219,0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,
-    0,0,0,114,213,0,0,0,198,4,0,0,115,2,0,0,
-    0,0,1,122,25,95,78,97,109,101,115,112,97,99,101,76,
-    111,97,100,101,114,46,103,101,116,95,99,111,100,101,99,2,
-    0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,1,
-    0,0,0,67,0,0,0,115,4,0,0,0,100,1,83,0,
-    114,210,0,0,0,114,5,0,0,0,114,211,0,0,0,114,
-    5,0,0,0,114,5,0,0,0,114,8,0,0,0,114,212,
-    0,0,0,201,4,0,0,115,2,0,0,0,0,1,122,30,
-    95,78,97,109,101,115,112,97,99,101,76,111,97,100,101,114,
-    46,99,114,101,97,116,101,95,109,111,100,117,108,101,99,2,
-    0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,1,
-    0,0,0,67,0,0,0,115,4,0,0,0,100,0,83,0,
-    114,109,0,0,0,114,5,0,0,0,114,253,0,0,0,114,
-    5,0,0,0,114,5,0,0,0,114,8,0,0,0,114,217,
-    0,0,0,204,4,0,0,115,2,0,0,0,0,1,122,28,
-    95,78,97,109,101,115,112,97,99,101,76,111,97,100,101,114,
-    46,101,120,101,99,95,109,111,100,117,108,101,99,2,0,0,
-    0,0,0,0,0,0,0,0,0,2,0,0,0,4,0,0,
-    0,67,0,0,0,115,26,0,0,0,116,0,160,1,100,1,
-    124,0,106,2,161,2,1,0,116,0,160,3,124,0,124,1,
-    161,2,83,0,41,2,122,98,76,111,97,100,32,97,32,110,
-    97,109,101,115,112,97,99,101,32,109,111,100,117,108,101,46,
-    10,10,32,32,32,32,32,32,32,32,84,104,105,115,32,109,
-    101,116,104,111,100,32,105,115,32,100,101,112,114,101,99,97,
-    116,101,100,46,32,32,85,115,101,32,101,120,101,99,95,109,
-    111,100,117,108,101,40,41,32,105,110,115,116,101,97,100,46,
-    10,10,32,32,32,32,32,32,32,32,122,38,110,97,109,101,
-    115,112,97,99,101,32,109,111,100,117,108,101,32,108,111,97,
-    100,101,100,32,119,105,116,104,32,112,97,116,104,32,123,33,
-    114,125,41,4,114,134,0,0,0,114,149,0,0,0,114,24,
-    1,0,0,114,218,0,0,0,114,219,0,0,0,114,5,0,
-    0,0,114,5,0,0,0,114,8,0,0,0,114,220,0,0,
-    0,207,4,0,0,115,8,0,0,0,0,7,6,1,4,255,
-    4,2,122,28,95,78,97,109,101,115,112,97,99,101,76,111,
-    97,100,101,114,46,108,111,97,100,95,109,111,100,117,108,101,
-    78,41,12,114,125,0,0,0,114,124,0,0,0,114,126,0,
-    0,0,114,209,0,0,0,114,207,0,0,0,114,44,1,0,
-    0,114,182,0,0,0,114,229,0,0,0,114,213,0,0,0,
-    114,212,0,0,0,114,217,0,0,0,114,220,0,0,0,114,
-    5,0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,
-    0,0,0,114,43,1,0,0,179,4,0,0,115,18,0,0,
-    0,8,1,8,3,2,1,10,8,8,3,8,3,8,3,8,
-    3,8,3,114,43,1,0,0,99,0,0,0,0,0,0,0,
-    0,0,0,0,0,0,0,0,0,4,0,0,0,64,0,0,
-    0,115,118,0,0,0,101,0,90,1,100,0,90,2,100,1,
-    90,3,101,4,100,2,100,3,132,0,131,1,90,5,101,4,
-    100,4,100,5,132,0,131,1,90,6,101,4,100,6,100,7,
-    132,0,131,1,90,7,101,4,100,8,100,9,132,0,131,1,
-    90,8,101,4,100,19,100,11,100,12,132,1,131,1,90,9,
-    101,4,100,20,100,13,100,14,132,1,131,1,90,10,101,4,
-    100,21,100,15,100,16,132,1,131,1,90,11,101,4,100,17,
-    100,18,132,0,131,1,90,12,100,10,83,0,41,22,218,10,
-    80,97,116,104,70,105,110,100,101,114,122,62,77,101,116,97,
-    32,112,97,116,104,32,102,105,110,100,101,114,32,102,111,114,
-    32,115,121,115,46,112,97,116,104,32,97,110,100,32,112,97,
-    99,107,97,103,101,32,95,95,112,97,116,104,95,95,32,97,
-    116,116,114,105,98,117,116,101,115,46,99,1,0,0,0,0,
-    0,0,0,0,0,0,0,3,0,0,0,4,0,0,0,67,
-    0,0,0,115,64,0,0,0,116,0,116,1,106,2,160,3,
-    161,0,131,1,68,0,93,44,92,2,125,1,125,2,124,2,
-    100,1,117,0,114,40,116,1,106,2,124,1,61,0,113,14,
-    116,4,124,2,100,2,131,2,114,14,124,2,160,5,161,0,
-    1,0,113,14,100,1,83,0,41,3,122,125,67,97,108,108,
-    32,116,104,101,32,105,110,118,97,108,105,100,97,116,101,95,
-    99,97,99,104,101,115,40,41,32,109,101,116,104,111,100,32,
-    111,110,32,97,108,108,32,112,97,116,104,32,101,110,116,114,
-    121,32,102,105,110,100,101,114,115,10,32,32,32,32,32,32,
-    32,32,115,116,111,114,101,100,32,105,110,32,115,121,115,46,
-    112,97,116,104,95,105,109,112,111,114,116,101,114,95,99,97,
-    99,104,101,115,32,40,119,104,101,114,101,32,105,109,112,108,
-    101,109,101,110,116,101,100,41,46,78,218,17,105,110,118,97,
-    108,105,100,97,116,101,95,99,97,99,104,101,115,41,6,218,
-    4,108,105,115,116,114,1,0,0,0,218,19,112,97,116,104,
-    95,105,109,112,111,114,116,101,114,95,99,97,99,104,101,218,
-    5,105,116,101,109,115,114,128,0,0,0,114,46,1,0,0,
-    41,3,114,193,0,0,0,114,116,0,0,0,218,6,102,105,
-    110,100,101,114,114,5,0,0,0,114,5,0,0,0,114,8,
-    0,0,0,114,46,1,0,0,225,4,0,0,115,10,0,0,
-    0,0,4,22,1,8,1,10,1,10,1,122,28,80,97,116,
-    104,70,105,110,100,101,114,46,105,110,118,97,108,105,100,97,
-    116,101,95,99,97,99,104,101,115,99,2,0,0,0,0,0,
-    0,0,0,0,0,0,3,0,0,0,9,0,0,0,67,0,
-    0,0,115,82,0,0,0,116,0,106,1,100,1,117,1,114,
-    28,116,0,106,1,115,28,116,2,160,3,100,2,116,4,161,
-    2,1,0,116,0,106,1,68,0,93,42,125,2,122,14,124,
-    2,124,1,131,1,87,0,2,0,1,0,83,0,4,0,116,
-    5,121,74,1,0,1,0,1,0,89,0,113,34,89,0,113,
-    34,48,0,113,34,100,1,83,0,41,3,122,46,83,101,97,
-    114,99,104,32,115,121,115,46,112,97,116,104,95,104,111,111,
-    107,115,32,102,111,114,32,97,32,102,105,110,100,101,114,32,
-    102,111,114,32,39,112,97,116,104,39,46,78,122,23,115,121,
-    115,46,112,97,116,104,95,104,111,111,107,115,32,105,115,32,
-    101,109,112,116,121,41,6,114,1,0,0,0,218,10,112,97,
-    116,104,95,104,111,111,107,115,114,75,0,0,0,114,76,0,
-    0,0,114,138,0,0,0,114,117,0,0,0,41,3,114,193,
-    0,0,0,114,44,0,0,0,90,4,104,111,111,107,114,5,
-    0,0,0,114,5,0,0,0,114,8,0,0,0,218,11,95,
-    112,97,116,104,95,104,111,111,107,115,235,4,0,0,115,16,
-    0,0,0,0,3,16,1,12,1,10,1,2,1,14,1,12,
-    1,12,2,122,22,80,97,116,104,70,105,110,100,101,114,46,
-    95,112,97,116,104,95,104,111,111,107,115,99,2,0,0,0,
-    0,0,0,0,0,0,0,0,3,0,0,0,8,0,0,0,
-    67,0,0,0,115,100,0,0,0,124,1,100,1,107,2,114,
-    42,122,12,116,0,160,1,161,0,125,1,87,0,110,20,4,
-    0,116,2,121,40,1,0,1,0,1,0,89,0,100,2,83,
-    0,48,0,122,14,116,3,106,4,124,1,25,0,125,2,87,
-    0,110,38,4,0,116,5,121,94,1,0,1,0,1,0,124,
-    0,160,6,124,1,161,1,125,2,124,2,116,3,106,4,124,
-    1,60,0,89,0,110,2,48,0,124,2,83,0,41,3,122,
-    210,71,101,116,32,116,104,101,32,102,105,110,100,101,114,32,
-    102,111,114,32,116,104,101,32,112,97,116,104,32,101,110,116,
-    114,121,32,102,114,111,109,32,115,121,115,46,112,97,116,104,
-    95,105,109,112,111,114,116,101,114,95,99,97,99,104,101,46,
-    10,10,32,32,32,32,32,32,32,32,73,102,32,116,104,101,
-    32,112,97,116,104,32,101,110,116,114,121,32,105,115,32,110,
-    111,116,32,105,110,32,116,104,101,32,99,97,99,104,101,44,
-    32,102,105,110,100,32,116,104,101,32,97,112,112,114,111,112,
-    114,105,97,116,101,32,102,105,110,100,101,114,10,32,32,32,
-    32,32,32,32,32,97,110,100,32,99,97,99,104,101,32,105,
-    116,46,32,73,102,32,110,111,32,102,105,110,100,101,114,32,
-    105,115,32,97,118,97,105,108,97,98,108,101,44,32,115,116,
-    111,114,101,32,78,111,110,101,46,10,10,32,32,32,32,32,
-    32,32,32,114,40,0,0,0,78,41,7,114,4,0,0,0,
-    114,55,0,0,0,114,3,1,0,0,114,1,0,0,0,114,
-    48,1,0,0,218,8,75,101,121,69,114,114,111,114,114,52,
-    1,0,0,41,3,114,193,0,0,0,114,44,0,0,0,114,
-    50,1,0,0,114,5,0,0,0,114,5,0,0,0,114,8,
-    0,0,0,218,20,95,112,97,116,104,95,105,109,112,111,114,
-    116,101,114,95,99,97,99,104,101,248,4,0,0,115,22,0,
-    0,0,0,8,8,1,2,1,12,1,12,3,8,1,2,1,
-    14,1,12,1,10,1,16,1,122,31,80,97,116,104,70,105,
-    110,100,101,114,46,95,112,97,116,104,95,105,109,112,111,114,
-    116,101,114,95,99,97,99,104,101,99,3,0,0,0,0,0,
-    0,0,0,0,0,0,6,0,0,0,4,0,0,0,67,0,
-    0,0,115,82,0,0,0,116,0,124,2,100,1,131,2,114,
-    26,124,2,160,1,124,1,161,1,92,2,125,3,125,4,110,
-    14,124,2,160,2,124,1,161,1,125,3,103,0,125,4,124,
-    3,100,0,117,1,114,60,116,3,160,4,124,1,124,3,161,
-    2,83,0,116,3,160,5,124,1,100,0,161,2,125,5,124,
-    4,124,5,95,6,124,5,83,0,41,2,78,114,137,0,0,
-    0,41,7,114,128,0,0,0,114,137,0,0,0,114,206,0,
-    0,0,114,134,0,0,0,114,201,0,0,0,114,183,0,0,
-    0,114,178,0,0,0,41,6,114,193,0,0,0,114,139,0,
-    0,0,114,50,1,0,0,114,140,0,0,0,114,141,0,0,
-    0,114,187,0,0,0,114,5,0,0,0,114,5,0,0,0,
-    114,8,0,0,0,218,16,95,108,101,103,97,99,121,95,103,
-    101,116,95,115,112,101,99,14,5,0,0,115,18,0,0,0,
-    0,4,10,1,16,2,10,1,4,1,8,1,12,1,12,1,
-    6,1,122,27,80,97,116,104,70,105,110,100,101,114,46,95,
-    108,101,103,97,99,121,95,103,101,116,95,115,112,101,99,78,
-    99,4,0,0,0,0,0,0,0,0,0,0,0,9,0,0,
-    0,5,0,0,0,67,0,0,0,115,166,0,0,0,103,0,
-    125,4,124,2,68,0,93,134,125,5,116,0,124,5,116,1,
-    116,2,102,2,131,2,115,28,113,8,124,0,160,3,124,5,
-    161,1,125,6,124,6,100,1,117,1,114,8,116,4,124,6,
-    100,2,131,2,114,70,124,6,160,5,124,1,124,3,161,2,
-    125,7,110,12,124,0,160,6,124,1,124,6,161,2,125,7,
-    124,7,100,1,117,0,114,92,113,8,124,7,106,7,100,1,
-    117,1,114,110,124,7,2,0,1,0,83,0,124,7,106,8,
-    125,8,124,8,100,1,117,0,114,132,116,9,100,3,131,1,
-    130,1,124,4,160,10,124,8,161,1,1,0,113,8,116,11,
-    160,12,124,1,100,1,161,2,125,7,124,4,124,7,95,8,
-    124,7,83,0,41,4,122,63,70,105,110,100,32,116,104,101,
-    32,108,111,97,100,101,114,32,111,114,32,110,97,109,101,115,
-    112,97,99,101,95,112,97,116,104,32,102,111,114,32,116,104,
-    105,115,32,109,111,100,117,108,101,47,112,97,99,107,97,103,
-    101,32,110,97,109,101,46,78,114,203,0,0,0,122,19,115,
-    112,101,99,32,109,105,115,115,105,110,103,32,108,111,97,100,
-    101,114,41,13,114,161,0,0,0,114,84,0,0,0,218,5,
-    98,121,116,101,115,114,54,1,0,0,114,128,0,0,0,114,
-    203,0,0,0,114,55,1,0,0,114,140,0,0,0,114,178,
-    0,0,0,114,117,0,0,0,114,167,0,0,0,114,134,0,
-    0,0,114,183,0,0,0,41,9,114,193,0,0,0,114,139,
-    0,0,0,114,44,0,0,0,114,202,0,0,0,218,14,110,
-    97,109,101,115,112,97,99,101,95,112,97,116,104,90,5,101,
-    110,116,114,121,114,50,1,0,0,114,187,0,0,0,114,141,
-    0,0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,
-    0,0,218,9,95,103,101,116,95,115,112,101,99,29,5,0,
-    0,115,40,0,0,0,0,5,4,1,8,1,14,1,2,1,
-    10,1,8,1,10,1,14,2,12,1,8,1,2,1,10,1,
-    8,1,6,1,8,1,8,5,12,2,12,1,6,1,122,20,
-    80,97,116,104,70,105,110,100,101,114,46,95,103,101,116,95,
-    115,112,101,99,99,4,0,0,0,0,0,0,0,0,0,0,
-    0,6,0,0,0,5,0,0,0,67,0,0,0,115,100,0,
-    0,0,124,2,100,1,117,0,114,14,116,0,106,1,125,2,
-    124,0,160,2,124,1,124,2,124,3,161,3,125,4,124,4,
-    100,1,117,0,114,40,100,1,83,0,124,4,106,3,100,1,
-    117,0,114,92,124,4,106,4,125,5,124,5,114,86,100,1,
-    124,4,95,5,116,6,124,1,124,5,124,0,106,2,131,3,
-    124,4,95,4,124,4,83,0,100,1,83,0,110,4,124,4,
-    83,0,100,1,83,0,41,2,122,141,84,114,121,32,116,111,
-    32,102,105,110,100,32,97,32,115,112,101,99,32,102,111,114,
-    32,39,102,117,108,108,110,97,109,101,39,32,111,110,32,115,
-    121,115,46,112,97,116,104,32,111,114,32,39,112,97,116,104,
-    39,46,10,10,32,32,32,32,32,32,32,32,84,104,101,32,
-    115,101,97,114,99,104,32,105,115,32,98,97,115,101,100,32,
-    111,110,32,115,121,115,46,112,97,116,104,95,104,111,111,107,
-    115,32,97,110,100,32,115,121,115,46,112,97,116,104,95,105,
-    109,112,111,114,116,101,114,95,99,97,99,104,101,46,10,32,
-    32,32,32,32,32,32,32,78,41,7,114,1,0,0,0,114,
-    44,0,0,0,114,58,1,0,0,114,140,0,0,0,114,178,
-    0,0,0,114,181,0,0,0,114,22,1,0,0,41,6,114,
-    193,0,0,0,114,139,0,0,0,114,44,0,0,0,114,202,
-    0,0,0,114,187,0,0,0,114,57,1,0,0,114,5,0,
-    0,0,114,5,0,0,0,114,8,0,0,0,114,203,0,0,
-    0,61,5,0,0,115,26,0,0,0,0,6,8,1,6,1,
-    14,1,8,1,4,1,10,1,6,1,4,3,6,1,16,1,
-    4,2,6,2,122,20,80,97,116,104,70,105,110,100,101,114,
-    46,102,105,110,100,95,115,112,101,99,99,3,0,0,0,0,
-    0,0,0,0,0,0,0,4,0,0,0,4,0,0,0,67,
-    0,0,0,115,30,0,0,0,124,0,160,0,124,1,124,2,
-    161,2,125,3,124,3,100,1,117,0,114,24,100,1,83,0,
-    124,3,106,1,83,0,41,2,122,170,102,105,110,100,32,116,
-    104,101,32,109,111,100,117,108,101,32,111,110,32,115,121,115,
-    46,112,97,116,104,32,111,114,32,39,112,97,116,104,39,32,
-    98,97,115,101,100,32,111,110,32,115,121,115,46,112,97,116,
-    104,95,104,111,111,107,115,32,97,110,100,10,32,32,32,32,
-    32,32,32,32,115,121,115,46,112,97,116,104,95,105,109,112,
-    111,114,116,101,114,95,99,97,99,104,101,46,10,10,32,32,
-    32,32,32,32,32,32,84,104,105,115,32,109,101,116,104,111,
-    100,32,105,115,32,100,101,112,114,101,99,97,116,101,100,46,
-    32,32,85,115,101,32,102,105,110,100,95,115,112,101,99,40,
-    41,32,105,110,115,116,101,97,100,46,10,10,32,32,32,32,
-    32,32,32,32,78,114,204,0,0,0,114,205,0,0,0,114,
-    5,0,0,0,114,5,0,0,0,114,8,0,0,0,114,206,
-    0,0,0,85,5,0,0,115,8,0,0,0,0,8,12,1,
-    8,1,4,1,122,22,80,97,116,104,70,105,110,100,101,114,
-    46,102,105,110,100,95,109,111,100,117,108,101,99,1,0,0,
-    0,0,0,0,0,0,0,0,0,4,0,0,0,4,0,0,
-    0,79,0,0,0,115,28,0,0,0,100,1,100,2,108,0,
-    109,1,125,3,1,0,124,3,106,2,124,1,105,0,124,2,
-    164,1,142,1,83,0,41,3,97,32,1,0,0,10,32,32,
-    32,32,32,32,32,32,70,105,110,100,32,100,105,115,116,114,
-    105,98,117,116,105,111,110,115,46,10,10,32,32,32,32,32,
-    32,32,32,82,101,116,117,114,110,32,97,110,32,105,116,101,
-    114,97,98,108,101,32,111,102,32,97,108,108,32,68,105,115,
-    116,114,105,98,117,116,105,111,110,32,105,110,115,116,97,110,
-    99,101,115,32,99,97,112,97,98,108,101,32,111,102,10,32,
-    32,32,32,32,32,32,32,108,111,97,100,105,110,103,32,116,
-    104,101,32,109,101,116,97,100,97,116,97,32,102,111,114,32,
-    112,97,99,107,97,103,101,115,32,109,97,116,99,104,105,110,
-    103,32,96,96,99,111,110,116,101,120,116,46,110,97,109,101,
-    96,96,10,32,32,32,32,32,32,32,32,40,111,114,32,97,
-    108,108,32,110,97,109,101,115,32,105,102,32,96,96,78,111,
-    110,101,96,96,32,105,110,100,105,99,97,116,101,100,41,32,
-    97,108,111,110,103,32,116,104,101,32,112,97,116,104,115,32,
-    105,110,32,116,104,101,32,108,105,115,116,10,32,32,32,32,
-    32,32,32,32,111,102,32,100,105,114,101,99,116,111,114,105,
-    101,115,32,96,96,99,111,110,116,101,120,116,46,112,97,116,
-    104,96,96,46,10,32,32,32,32,32,32,32,32,114,73,0,
-    0,0,41,1,218,18,77,101,116,97,100,97,116,97,80,97,
-    116,104,70,105,110,100,101,114,41,3,90,18,105,109,112,111,
-    114,116,108,105,98,46,109,101,116,97,100,97,116,97,114,59,
-    1,0,0,218,18,102,105,110,100,95,100,105,115,116,114,105,
-    98,117,116,105,111,110,115,41,4,114,193,0,0,0,114,119,
-    0,0,0,114,120,0,0,0,114,59,1,0,0,114,5,0,
-    0,0,114,5,0,0,0,114,8,0,0,0,114,60,1,0,
-    0,98,5,0,0,115,4,0,0,0,0,10,12,1,122,29,
-    80,97,116,104,70,105,110,100,101,114,46,102,105,110,100,95,
-    100,105,115,116,114,105,98,117,116,105,111,110,115,41,1,78,
-    41,2,78,78,41,1,78,41,13,114,125,0,0,0,114,124,
-    0,0,0,114,126,0,0,0,114,127,0,0,0,114,207,0,
-    0,0,114,46,1,0,0,114,52,1,0,0,114,54,1,0,
-    0,114,55,1,0,0,114,58,1,0,0,114,203,0,0,0,
-    114,206,0,0,0,114,60,1,0,0,114,5,0,0,0,114,
-    5,0,0,0,114,5,0,0,0,114,8,0,0,0,114,45,
-    1,0,0,221,4,0,0,115,34,0,0,0,8,2,4,2,
-    2,1,10,9,2,1,10,12,2,1,10,21,2,1,10,14,
-    2,1,12,31,2,1,12,23,2,1,12,12,2,1,114,45,
-    1,0,0,99,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,0,0,0,3,0,0,0,64,0,0,0,115,90,0,0,
-    0,101,0,90,1,100,0,90,2,100,1,90,3,100,2,100,
-    3,132,0,90,4,100,4,100,5,132,0,90,5,101,6,90,
-    7,100,6,100,7,132,0,90,8,100,8,100,9,132,0,90,
-    9,100,19,100,11,100,12,132,1,90,10,100,13,100,14,132,
-    0,90,11,101,12,100,15,100,16,132,0,131,1,90,13,100,
-    17,100,18,132,0,90,14,100,10,83,0,41,20,218,10,70,
-    105,108,101,70,105,110,100,101,114,122,172,70,105,108,101,45,
-    98,97,115,101,100,32,102,105,110,100,101,114,46,10,10,32,
-    32,32,32,73,110,116,101,114,97,99,116,105,111,110,115,32,
-    119,105,116,104,32,116,104,101,32,102,105,108,101,32,115,121,
-    115,116,101,109,32,97,114,101,32,99,97,99,104,101,100,32,
-    102,111,114,32,112,101,114,102,111,114,109,97,110,99,101,44,
-    32,98,101,105,110,103,10,32,32,32,32,114,101,102,114,101,
-    115,104,101,100,32,119,104,101,110,32,116,104,101,32,100,105,
-    114,101,99,116,111,114,121,32,116,104,101,32,102,105,110,100,
-    101,114,32,105,115,32,104,97,110,100,108,105,110,103,32,104,
-    97,115,32,98,101,101,110,32,109,111,100,105,102,105,101,100,
-    46,10,10,32,32,32,32,99,2,0,0,0,0,0,0,0,
-    0,0,0,0,5,0,0,0,6,0,0,0,7,0,0,0,
-    115,84,0,0,0,103,0,125,3,124,2,68,0,93,32,92,
-    2,137,0,125,4,124,3,160,0,135,0,102,1,100,1,100,
-    2,132,8,124,4,68,0,131,1,161,1,1,0,113,8,124,
-    3,124,0,95,1,124,1,112,54,100,3,124,0,95,2,100,
-    4,124,0,95,3,116,4,131,0,124,0,95,5,116,4,131,
-    0,124,0,95,6,100,5,83,0,41,6,122,154,73,110,105,
-    116,105,97,108,105,122,101,32,119,105,116,104,32,116,104,101,
-    32,112,97,116,104,32,116,111,32,115,101,97,114,99,104,32,
-    111,110,32,97,110,100,32,97,32,118,97,114,105,97,98,108,
-    101,32,110,117,109,98,101,114,32,111,102,10,32,32,32,32,
-    32,32,32,32,50,45,116,117,112,108,101,115,32,99,111,110,
-    116,97,105,110,105,110,103,32,116,104,101,32,108,111,97,100,
-    101,114,32,97,110,100,32,116,104,101,32,102,105,108,101,32,
-    115,117,102,102,105,120,101,115,32,116,104,101,32,108,111,97,
-    100,101,114,10,32,32,32,32,32,32,32,32,114,101,99,111,
-    103,110,105,122,101,115,46,99,1,0,0,0,0,0,0,0,
-    0,0,0,0,2,0,0,0,3,0,0,0,51,0,0,0,
-    115,22,0,0,0,124,0,93,14,125,1,124,1,136,0,102,
-    2,86,0,1,0,113,2,100,0,83,0,114,109,0,0,0,
-    114,5,0,0,0,114,16,1,0,0,169,1,114,140,0,0,
-    0,114,5,0,0,0,114,8,0,0,0,114,19,1,0,0,
-    127,5,0,0,243,0,0,0,0,122,38,70,105,108,101,70,
-    105,110,100,101,114,46,95,95,105,110,105,116,95,95,46,60,
-    108,111,99,97,108,115,62,46,60,103,101,110,101,120,112,114,
-    62,114,71,0,0,0,114,104,0,0,0,78,41,7,114,167,
-    0,0,0,218,8,95,108,111,97,100,101,114,115,114,44,0,
-    0,0,218,11,95,112,97,116,104,95,109,116,105,109,101,218,
-    3,115,101,116,218,11,95,112,97,116,104,95,99,97,99,104,
-    101,218,19,95,114,101,108,97,120,101,100,95,112,97,116,104,
-    95,99,97,99,104,101,41,5,114,118,0,0,0,114,44,0,
-    0,0,218,14,108,111,97,100,101,114,95,100,101,116,97,105,
-    108,115,90,7,108,111,97,100,101,114,115,114,189,0,0,0,
-    114,5,0,0,0,114,62,1,0,0,114,8,0,0,0,114,
-    209,0,0,0,121,5,0,0,115,16,0,0,0,0,4,4,
-    1,12,1,26,1,6,2,10,1,6,1,8,1,122,19,70,
-    105,108,101,70,105,110,100,101,114,46,95,95,105,110,105,116,
-    95,95,99,1,0,0,0,0,0,0,0,0,0,0,0,1,
-    0,0,0,2,0,0,0,67,0,0,0,115,10,0,0,0,
-    100,1,124,0,95,0,100,2,83,0,41,3,122,31,73,110,
-    118,97,108,105,100,97,116,101,32,116,104,101,32,100,105,114,
-    101,99,116,111,114,121,32,109,116,105,109,101,46,114,104,0,
-    0,0,78,41,1,114,65,1,0,0,114,246,0,0,0,114,
-    5,0,0,0,114,5,0,0,0,114,8,0,0,0,114,46,
-    1,0,0,135,5,0,0,115,2,0,0,0,0,2,122,28,
-    70,105,108,101,70,105,110,100,101,114,46,105,110,118,97,108,
-    105,100,97,116,101,95,99,97,99,104,101,115,99,2,0,0,
-    0,0,0,0,0,0,0,0,0,3,0,0,0,3,0,0,
-    0,67,0,0,0,115,42,0,0,0,124,0,160,0,124,1,
-    161,1,125,2,124,2,100,1,117,0,114,26,100,1,103,0,
-    102,2,83,0,124,2,106,1,124,2,106,2,112,38,103,0,
-    102,2,83,0,41,2,122,197,84,114,121,32,116,111,32,102,
-    105,110,100,32,97,32,108,111,97,100,101,114,32,102,111,114,
-    32,116,104,101,32,115,112,101,99,105,102,105,101,100,32,109,
-    111,100,117,108,101,44,32,111,114,32,116,104,101,32,110,97,
-    109,101,115,112,97,99,101,10,32,32,32,32,32,32,32,32,
-    112,97,99,107,97,103,101,32,112,111,114,116,105,111,110,115,
-    46,32,82,101,116,117,114,110,115,32,40,108,111,97,100,101,
-    114,44,32,108,105,115,116,45,111,102,45,112,111,114,116,105,
-    111,110,115,41,46,10,10,32,32,32,32,32,32,32,32,84,
+    83,0,114,69,0,0,0,169,3,218,4,104,97,115,104,114,
+    141,0,0,0,114,65,0,0,0,169,1,114,143,0,0,0,
+    114,7,0,0,0,114,7,0,0,0,114,8,0,0,0,218,
+    8,95,95,104,97,115,104,95,95,26,4,0,0,243,2,0,
+    0,0,20,1,122,19,70,105,108,101,76,111,97,100,101,114,
+    46,95,95,104,97,115,104,95,95,99,2,0,0,0,0,0,
+    0,0,0,0,0,0,2,0,0,0,3,0,0,0,3,0,
+    0,0,115,16,0,0,0,116,0,116,1,124,0,131,2,160,
+    2,124,1,161,1,83,0,41,1,122,100,76,111,97,100,32,
+    97,32,109,111,100,117,108,101,32,102,114,111,109,32,97,32,
+    102,105,108,101,46,10,10,32,32,32,32,32,32,32,32,84,
     104,105,115,32,109,101,116,104,111,100,32,105,115,32,100,101,
-    112,114,101,99,97,116,101,100,46,32,32,85,115,101,32,102,
-    105,110,100,95,115,112,101,99,40,41,32,105,110,115,116,101,
-    97,100,46,10,10,32,32,32,32,32,32,32,32,78,41,3,
-    114,203,0,0,0,114,140,0,0,0,114,178,0,0,0,41,
-    3,114,118,0,0,0,114,139,0,0,0,114,187,0,0,0,
-    114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,114,
-    137,0,0,0,141,5,0,0,115,8,0,0,0,0,7,10,
-    1,8,1,8,1,122,22,70,105,108,101,70,105,110,100,101,
-    114,46,102,105,110,100,95,108,111,97,100,101,114,99,6,0,
-    0,0,0,0,0,0,0,0,0,0,7,0,0,0,6,0,
-    0,0,67,0,0,0,115,26,0,0,0,124,1,124,2,124,
-    3,131,2,125,6,116,0,124,2,124,3,124,6,124,4,100,
-    1,141,4,83,0,41,2,78,114,177,0,0,0,41,1,114,
-    190,0,0,0,41,7,114,118,0,0,0,114,188,0,0,0,
-    114,139,0,0,0,114,44,0,0,0,90,4,115,109,115,108,
-    114,202,0,0,0,114,140,0,0,0,114,5,0,0,0,114,
-    5,0,0,0,114,8,0,0,0,114,58,1,0,0,153,5,
-    0,0,115,8,0,0,0,0,1,10,1,8,1,2,255,122,
-    20,70,105,108,101,70,105,110,100,101,114,46,95,103,101,116,
-    95,115,112,101,99,78,99,3,0,0,0,0,0,0,0,0,
-    0,0,0,14,0,0,0,8,0,0,0,67,0,0,0,115,
-    96,1,0,0,100,1,125,3,124,1,160,0,100,2,161,1,
-    100,3,25,0,125,4,122,24,116,1,124,0,106,2,112,34,
-    116,3,160,4,161,0,131,1,106,5,125,5,87,0,110,22,
-    4,0,116,6,121,64,1,0,1,0,1,0,100,4,125,5,
-    89,0,110,2,48,0,124,5,124,0,106,7,107,3,114,90,
-    124,0,160,8,161,0,1,0,124,5,124,0,95,7,116,9,
-    131,0,114,112,124,0,106,10,125,6,124,4,160,11,161,0,
-    125,7,110,10,124,0,106,12,125,6,124,4,125,7,124,7,
-    124,6,118,0,114,216,116,13,124,0,106,2,124,4,131,2,
-    125,8,124,0,106,14,68,0,93,58,92,2,125,9,125,10,
-    100,5,124,9,23,0,125,11,116,13,124,8,124,11,131,2,
-    125,12,116,15,124,12,131,1,114,148,124,0,160,16,124,10,
-    124,1,124,12,124,8,103,1,124,2,161,5,2,0,1,0,
-    83,0,113,148,116,17,124,8,131,1,125,3,124,0,106,14,
-    68,0,93,82,92,2,125,9,125,10,116,13,124,0,106,2,
-    124,4,124,9,23,0,131,2,125,12,116,18,106,19,100,6,
-    124,12,100,3,100,7,141,3,1,0,124,7,124,9,23,0,
-    124,6,118,0,114,222,116,15,124,12,131,1,114,222,124,0,
-    160,16,124,10,124,1,124,12,100,8,124,2,161,5,2,0,
-    1,0,83,0,113,222,124,3,144,1,114,92,116,18,160,19,
-    100,9,124,8,161,2,1,0,116,18,160,20,124,1,100,8,
-    161,2,125,13,124,8,103,1,124,13,95,21,124,13,83,0,
-    100,8,83,0,41,10,122,111,84,114,121,32,116,111,32,102,
-    105,110,100,32,97,32,115,112,101,99,32,102,111,114,32,116,
-    104,101,32,115,112,101,99,105,102,105,101,100,32,109,111,100,
-    117,108,101,46,10,10,32,32,32,32,32,32,32,32,82,101,
-    116,117,114,110,115,32,116,104,101,32,109,97,116,99,104,105,
-    110,103,32,115,112,101,99,44,32,111,114,32,78,111,110,101,
-    32,105,102,32,110,111,116,32,102,111,117,110,100,46,10,32,
-    32,32,32,32,32,32,32,70,114,71,0,0,0,114,28,0,
-    0,0,114,104,0,0,0,114,209,0,0,0,122,9,116,114,
-    121,105,110,103,32,123,125,41,1,90,9,118,101,114,98,111,
-    115,105,116,121,78,122,25,112,111,115,115,105,98,108,101,32,
-    110,97,109,101,115,112,97,99,101,32,102,111,114,32,123,125,
-    41,22,114,41,0,0,0,114,49,0,0,0,114,44,0,0,
-    0,114,4,0,0,0,114,55,0,0,0,114,10,1,0,0,
-    114,50,0,0,0,114,65,1,0,0,218,11,95,102,105,108,
-    108,95,99,97,99,104,101,114,9,0,0,0,114,68,1,0,
-    0,114,105,0,0,0,114,67,1,0,0,114,38,0,0,0,
-    114,64,1,0,0,114,54,0,0,0,114,58,1,0,0,114,
-    56,0,0,0,114,134,0,0,0,114,149,0,0,0,114,183,
-    0,0,0,114,178,0,0,0,41,14,114,118,0,0,0,114,
-    139,0,0,0,114,202,0,0,0,90,12,105,115,95,110,97,
-    109,101,115,112,97,99,101,90,11,116,97,105,108,95,109,111,
-    100,117,108,101,114,169,0,0,0,90,5,99,97,99,104,101,
-    90,12,99,97,99,104,101,95,109,111,100,117,108,101,90,9,
-    98,97,115,101,95,112,97,116,104,114,17,1,0,0,114,188,
-    0,0,0,90,13,105,110,105,116,95,102,105,108,101,110,97,
-    109,101,90,9,102,117,108,108,95,112,97,116,104,114,187,0,
-    0,0,114,5,0,0,0,114,5,0,0,0,114,8,0,0,
-    0,114,203,0,0,0,158,5,0,0,115,72,0,0,0,0,
-    5,4,1,14,1,2,1,24,1,12,1,10,1,10,1,8,
-    1,6,2,6,1,6,1,10,2,6,1,4,2,8,1,12,
-    1,14,1,8,1,10,1,8,1,26,4,8,2,14,1,16,
-    1,16,1,12,1,8,1,10,1,4,255,10,2,6,1,12,
-    1,12,1,8,1,4,1,122,20,70,105,108,101,70,105,110,
-    100,101,114,46,102,105,110,100,95,115,112,101,99,99,1,0,
-    0,0,0,0,0,0,0,0,0,0,9,0,0,0,10,0,
-    0,0,67,0,0,0,115,188,0,0,0,124,0,106,0,125,
-    1,122,22,116,1,160,2,124,1,112,22,116,1,160,3,161,
-    0,161,1,125,2,87,0,110,28,4,0,116,4,116,5,116,
-    6,102,3,121,56,1,0,1,0,1,0,103,0,125,2,89,
-    0,110,2,48,0,116,7,106,8,160,9,100,1,161,1,115,
-    82,116,10,124,2,131,1,124,0,95,11,110,74,116,10,131,
-    0,125,3,124,2,68,0,93,56,125,4,124,4,160,12,100,
-    2,161,1,92,3,125,5,125,6,125,7,124,6,114,134,100,
-    3,160,13,124,5,124,7,160,14,161,0,161,2,125,8,110,
-    4,124,5,125,8,124,3,160,15,124,8,161,1,1,0,113,
-    92,124,3,124,0,95,11,116,7,106,8,160,9,116,16,161,
-    1,114,184,100,4,100,5,132,0,124,2,68,0,131,1,124,
-    0,95,17,100,6,83,0,41,7,122,68,70,105,108,108,32,
-    116,104,101,32,99,97,99,104,101,32,111,102,32,112,111,116,
-    101,110,116,105,97,108,32,109,111,100,117,108,101,115,32,97,
-    110,100,32,112,97,99,107,97,103,101,115,32,102,111,114,32,
-    116,104,105,115,32,100,105,114,101,99,116,111,114,121,46,114,
-    0,0,0,0,114,71,0,0,0,114,61,0,0,0,99,1,
+    112,114,101,99,97,116,101,100,46,32,32,85,115,101,32,101,
+    120,101,99,95,109,111,100,117,108,101,40,41,32,105,110,115,
+    116,101,97,100,46,10,10,32,32,32,32,32,32,32,32,41,
+    3,218,5,115,117,112,101,114,114,11,1,0,0,114,248,0,
+    0,0,114,247,0,0,0,169,1,114,14,1,0,0,114,7,
+    0,0,0,114,8,0,0,0,114,248,0,0,0,29,4,0,
+    0,115,2,0,0,0,16,10,122,22,70,105,108,101,76,111,
+    97,100,101,114,46,108,111,97,100,95,109,111,100,117,108,101,
+    99,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,
+    0,1,0,0,0,67,0,0,0,243,6,0,0,0,124,0,
+    106,0,83,0,169,1,122,58,82,101,116,117,114,110,32,116,
+    104,101,32,112,97,116,104,32,116,111,32,116,104,101,32,115,
+    111,117,114,99,101,32,102,105,108,101,32,97,115,32,102,111,
+    117,110,100,32,98,121,32,116,104,101,32,102,105,110,100,101,
+    114,46,114,71,0,0,0,114,247,0,0,0,114,7,0,0,
+    0,114,7,0,0,0,114,8,0,0,0,114,203,0,0,0,
+    41,4,0,0,243,2,0,0,0,6,3,122,23,70,105,108,
+    101,76,111,97,100,101,114,46,103,101,116,95,102,105,108,101,
+    110,97,109,101,99,2,0,0,0,0,0,0,0,0,0,0,
+    0,3,0,0,0,8,0,0,0,67,0,0,0,115,128,0,
+    0,0,116,0,124,0,116,1,116,2,102,2,131,2,114,36,
+    116,3,160,4,116,5,124,1,131,1,161,1,143,12,125,2,
+    124,2,160,6,161,0,87,0,2,0,100,1,4,0,4,0,
+    131,3,1,0,83,0,49,0,115,29,119,1,1,0,1,0,
+    1,0,89,0,1,0,100,1,83,0,116,3,160,7,124,1,
+    100,2,161,2,143,12,125,2,124,2,160,6,161,0,87,0,
+    2,0,100,1,4,0,4,0,131,3,1,0,83,0,49,0,
+    115,57,119,1,1,0,1,0,1,0,89,0,1,0,100,1,
+    83,0,41,3,122,39,82,101,116,117,114,110,32,116,104,101,
+    32,100,97,116,97,32,102,114,111,109,32,112,97,116,104,32,
+    97,115,32,114,97,119,32,98,121,116,101,115,46,78,218,1,
+    114,41,8,114,185,0,0,0,114,249,0,0,0,218,19,69,
+    120,116,101,110,115,105,111,110,70,105,108,101,76,111,97,100,
+    101,114,114,91,0,0,0,90,9,111,112,101,110,95,99,111,
+    100,101,114,109,0,0,0,90,4,114,101,97,100,114,92,0,
+    0,0,41,3,114,143,0,0,0,114,65,0,0,0,114,94,
+    0,0,0,114,7,0,0,0,114,7,0,0,0,114,8,0,
+    0,0,114,255,0,0,0,46,4,0,0,115,14,0,0,0,
+    14,2,16,1,6,1,36,255,14,3,6,1,36,255,122,19,
+    70,105,108,101,76,111,97,100,101,114,46,103,101,116,95,100,
+    97,116,97,99,2,0,0,0,0,0,0,0,0,0,0,0,
+    3,0,0,0,2,0,0,0,67,0,0,0,115,20,0,0,
+    0,100,1,100,2,108,0,109,1,125,2,1,0,124,2,124,
+    0,131,1,83,0,41,3,78,114,0,0,0,0,41,1,218,
+    10,70,105,108,101,82,101,97,100,101,114,41,2,218,17,105,
+    109,112,111,114,116,108,105,98,46,114,101,97,100,101,114,115,
+    114,31,1,0,0,41,3,114,143,0,0,0,114,244,0,0,
+    0,114,31,1,0,0,114,7,0,0,0,114,7,0,0,0,
+    114,8,0,0,0,218,19,103,101,116,95,114,101,115,111,117,
+    114,99,101,95,114,101,97,100,101,114,55,4,0,0,115,4,
+    0,0,0,12,2,8,1,122,30,70,105,108,101,76,111,97,
+    100,101,114,46,103,101,116,95,114,101,115,111,117,114,99,101,
+    95,114,101,97,100,101,114,41,13,114,150,0,0,0,114,149,
+    0,0,0,114,151,0,0,0,114,152,0,0,0,114,236,0,
+    0,0,114,16,1,0,0,114,22,1,0,0,114,160,0,0,
+    0,114,248,0,0,0,114,203,0,0,0,114,255,0,0,0,
+    114,33,1,0,0,90,13,95,95,99,108,97,115,115,99,101,
+    108,108,95,95,114,7,0,0,0,114,7,0,0,0,114,25,
+    1,0,0,114,8,0,0,0,114,11,1,0,0,11,4,0,
+    0,115,24,0,0,0,8,0,4,2,8,3,8,6,8,4,
+    2,3,14,1,2,11,10,1,8,4,2,9,18,1,114,11,
+    1,0,0,99,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,3,0,0,0,64,0,0,0,115,46,0,0,
+    0,101,0,90,1,100,0,90,2,100,1,90,3,100,2,100,
+    3,132,0,90,4,100,4,100,5,132,0,90,5,100,6,100,
+    7,156,1,100,8,100,9,132,2,90,6,100,10,83,0,41,
+    11,218,16,83,111,117,114,99,101,70,105,108,101,76,111,97,
+    100,101,114,122,62,67,111,110,99,114,101,116,101,32,105,109,
+    112,108,101,109,101,110,116,97,116,105,111,110,32,111,102,32,
+    83,111,117,114,99,101,76,111,97,100,101,114,32,117,115,105,
+    110,103,32,116,104,101,32,102,105,108,101,32,115,121,115,116,
+    101,109,46,99,2,0,0,0,0,0,0,0,0,0,0,0,
+    3,0,0,0,3,0,0,0,67,0,0,0,115,22,0,0,
+    0,116,0,124,1,131,1,125,2,124,2,106,1,124,2,106,
+    2,100,1,156,2,83,0,41,2,122,33,82,101,116,117,114,
+    110,32,116,104,101,32,109,101,116,97,100,97,116,97,32,102,
+    111,114,32,116,104,101,32,112,97,116,104,46,41,2,114,193,
+    0,0,0,114,6,1,0,0,41,3,114,75,0,0,0,218,
+    8,115,116,95,109,116,105,109,101,90,7,115,116,95,115,105,
+    122,101,41,3,114,143,0,0,0,114,65,0,0,0,114,10,
+    1,0,0,114,7,0,0,0,114,7,0,0,0,114,8,0,
+    0,0,114,252,0,0,0,65,4,0,0,115,4,0,0,0,
+    8,2,14,1,122,27,83,111,117,114,99,101,70,105,108,101,
+    76,111,97,100,101,114,46,112,97,116,104,95,115,116,97,116,
+    115,99,4,0,0,0,0,0,0,0,0,0,0,0,5,0,
+    0,0,5,0,0,0,67,0,0,0,115,24,0,0,0,116,
+    0,124,1,131,1,125,4,124,0,106,1,124,2,124,3,124,
+    4,100,1,141,3,83,0,41,2,78,169,1,218,5,95,109,
+    111,100,101,41,2,114,139,0,0,0,114,253,0,0,0,41,
+    5,114,143,0,0,0,114,134,0,0,0,114,132,0,0,0,
+    114,41,0,0,0,114,78,0,0,0,114,7,0,0,0,114,
+    7,0,0,0,114,8,0,0,0,114,254,0,0,0,70,4,
+    0,0,115,4,0,0,0,8,2,16,1,122,32,83,111,117,
+    114,99,101,70,105,108,101,76,111,97,100,101,114,46,95,99,
+    97,99,104,101,95,98,121,116,101,99,111,100,101,114,87,0,
+    0,0,114,36,1,0,0,99,3,0,0,0,0,0,0,0,
+    1,0,0,0,9,0,0,0,11,0,0,0,67,0,0,0,
+    115,254,0,0,0,116,0,124,1,131,1,92,2,125,4,125,
+    5,103,0,125,6,124,4,114,31,116,1,124,4,131,1,115,
+    31,116,0,124,4,131,1,92,2,125,4,125,7,124,6,160,
+    2,124,7,161,1,1,0,124,4,114,31,116,1,124,4,131,
+    1,114,14,116,3,124,6,131,1,68,0,93,49,125,7,116,
+    4,124,4,124,7,131,2,125,4,122,7,116,5,160,6,124,
+    4,161,1,1,0,87,0,113,35,4,0,116,7,121,58,1,
+    0,1,0,1,0,89,0,113,35,4,0,116,8,121,84,1,
+    0,125,8,1,0,122,15,116,9,160,10,100,1,124,4,124,
+    8,161,3,1,0,87,0,89,0,100,2,125,8,126,8,1,
+    0,100,2,83,0,100,2,125,8,126,8,119,1,119,0,122,
+    15,116,11,124,1,124,2,124,3,131,3,1,0,116,9,160,
+    10,100,3,124,1,161,2,1,0,87,0,100,2,83,0,4,
+    0,116,8,121,126,1,0,125,8,1,0,122,14,116,9,160,
+    10,100,1,124,1,124,8,161,3,1,0,87,0,89,0,100,
+    2,125,8,126,8,100,2,83,0,100,2,125,8,126,8,119,
+    1,119,0,41,4,122,27,87,114,105,116,101,32,98,121,116,
+    101,115,32,100,97,116,97,32,116,111,32,97,32,102,105,108,
+    101,46,122,27,99,111,117,108,100,32,110,111,116,32,99,114,
+    101,97,116,101,32,123,33,114,125,58,32,123,33,114,125,78,
+    122,12,99,114,101,97,116,101,100,32,123,33,114,125,41,12,
+    114,74,0,0,0,114,83,0,0,0,114,61,0,0,0,218,
+    8,114,101,118,101,114,115,101,100,114,67,0,0,0,114,18,
+    0,0,0,90,5,109,107,100,105,114,218,15,70,105,108,101,
+    69,120,105,115,116,115,69,114,114,111,114,114,76,0,0,0,
+    114,159,0,0,0,114,173,0,0,0,114,95,0,0,0,41,
+    9,114,143,0,0,0,114,65,0,0,0,114,41,0,0,0,
+    114,37,1,0,0,218,6,112,97,114,101,110,116,114,120,0,
+    0,0,114,63,0,0,0,114,68,0,0,0,114,0,1,0,
+    0,114,7,0,0,0,114,7,0,0,0,114,8,0,0,0,
+    114,253,0,0,0,75,4,0,0,115,56,0,0,0,12,2,
+    4,1,12,2,12,1,10,1,12,254,12,4,10,1,2,1,
+    14,1,12,1,4,2,14,1,6,3,4,1,4,255,16,2,
+    8,128,2,251,2,6,12,1,18,1,14,1,8,2,2,1,
+    18,255,8,128,2,254,122,25,83,111,117,114,99,101,70,105,
+    108,101,76,111,97,100,101,114,46,115,101,116,95,100,97,116,
+    97,78,41,7,114,150,0,0,0,114,149,0,0,0,114,151,
+    0,0,0,114,152,0,0,0,114,252,0,0,0,114,254,0,
+    0,0,114,253,0,0,0,114,7,0,0,0,114,7,0,0,
+    0,114,7,0,0,0,114,8,0,0,0,114,34,1,0,0,
+    61,4,0,0,115,10,0,0,0,8,0,4,2,8,2,8,
+    5,18,5,114,34,1,0,0,99,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,2,0,0,0,64,0,0,
+    0,115,32,0,0,0,101,0,90,1,100,0,90,2,100,1,
+    90,3,100,2,100,3,132,0,90,4,100,4,100,5,132,0,
+    90,5,100,6,83,0,41,7,218,20,83,111,117,114,99,101,
+    108,101,115,115,70,105,108,101,76,111,97,100,101,114,122,45,
+    76,111,97,100,101,114,32,119,104,105,99,104,32,104,97,110,
+    100,108,101,115,32,115,111,117,114,99,101,108,101,115,115,32,
+    102,105,108,101,32,105,109,112,111,114,116,115,46,99,2,0,
+    0,0,0,0,0,0,0,0,0,0,5,0,0,0,5,0,
+    0,0,67,0,0,0,115,68,0,0,0,124,0,160,0,124,
+    1,161,1,125,2,124,0,160,1,124,2,161,1,125,3,124,
+    1,124,2,100,1,156,2,125,4,116,2,124,3,124,1,124,
+    4,131,3,1,0,116,3,116,4,124,3,131,1,100,2,100,
+    0,133,2,25,0,124,1,124,2,100,3,141,3,83,0,41,
+    4,78,114,183,0,0,0,114,169,0,0,0,41,2,114,141,
+    0,0,0,114,132,0,0,0,41,5,114,203,0,0,0,114,
+    255,0,0,0,114,176,0,0,0,114,189,0,0,0,114,7,
+    1,0,0,41,5,114,143,0,0,0,114,163,0,0,0,114,
+    65,0,0,0,114,41,0,0,0,114,175,0,0,0,114,7,
+    0,0,0,114,7,0,0,0,114,8,0,0,0,114,241,0,
+    0,0,110,4,0,0,115,22,0,0,0,10,1,10,1,2,
+    4,2,1,6,254,12,4,2,1,14,1,2,1,2,1,6,
+    253,122,29,83,111,117,114,99,101,108,101,115,115,70,105,108,
+    101,76,111,97,100,101,114,46,103,101,116,95,99,111,100,101,
+    99,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,
+    0,1,0,0,0,67,0,0,0,114,23,0,0,0,41,2,
+    122,39,82,101,116,117,114,110,32,78,111,110,101,32,97,115,
+    32,116,104,101,114,101,32,105,115,32,110,111,32,115,111,117,
+    114,99,101,32,99,111,100,101,46,78,114,7,0,0,0,114,
+    247,0,0,0,114,7,0,0,0,114,7,0,0,0,114,8,
+    0,0,0,114,1,1,0,0,126,4,0,0,114,24,0,0,
+    0,122,31,83,111,117,114,99,101,108,101,115,115,70,105,108,
+    101,76,111,97,100,101,114,46,103,101,116,95,115,111,117,114,
+    99,101,78,41,6,114,150,0,0,0,114,149,0,0,0,114,
+    151,0,0,0,114,152,0,0,0,114,241,0,0,0,114,1,
+    1,0,0,114,7,0,0,0,114,7,0,0,0,114,7,0,
+    0,0,114,8,0,0,0,114,41,1,0,0,106,4,0,0,
+    115,8,0,0,0,8,0,4,2,8,2,12,16,114,41,1,
+    0,0,99,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,3,0,0,0,64,0,0,0,115,92,0,0,0,
+    101,0,90,1,100,0,90,2,100,1,90,3,100,2,100,3,
+    132,0,90,4,100,4,100,5,132,0,90,5,100,6,100,7,
+    132,0,90,6,100,8,100,9,132,0,90,7,100,10,100,11,
+    132,0,90,8,100,12,100,13,132,0,90,9,100,14,100,15,
+    132,0,90,10,100,16,100,17,132,0,90,11,101,12,100,18,
+    100,19,132,0,131,1,90,13,100,20,83,0,41,21,114,30,
+    1,0,0,122,93,76,111,97,100,101,114,32,102,111,114,32,
+    101,120,116,101,110,115,105,111,110,32,109,111,100,117,108,101,
+    115,46,10,10,32,32,32,32,84,104,101,32,99,111,110,115,
+    116,114,117,99,116,111,114,32,105,115,32,100,101,115,105,103,
+    110,101,100,32,116,111,32,119,111,114,107,32,119,105,116,104,
+    32,70,105,108,101,70,105,110,100,101,114,46,10,10,32,32,
+    32,32,99,3,0,0,0,0,0,0,0,0,0,0,0,3,
+    0,0,0,2,0,0,0,67,0,0,0,115,16,0,0,0,
+    124,1,124,0,95,0,124,2,124,0,95,1,100,0,83,0,
+    114,69,0,0,0,114,183,0,0,0,41,3,114,143,0,0,
+    0,114,141,0,0,0,114,65,0,0,0,114,7,0,0,0,
+    114,7,0,0,0,114,8,0,0,0,114,236,0,0,0,139,
+    4,0,0,115,4,0,0,0,6,1,10,1,122,28,69,120,
+    116,101,110,115,105,111,110,70,105,108,101,76,111,97,100,101,
+    114,46,95,95,105,110,105,116,95,95,99,2,0,0,0,0,
+    0,0,0,0,0,0,0,2,0,0,0,2,0,0,0,67,
+    0,0,0,114,12,1,0,0,114,69,0,0,0,114,13,1,
+    0,0,114,15,1,0,0,114,7,0,0,0,114,7,0,0,
+    0,114,8,0,0,0,114,16,1,0,0,143,4,0,0,114,
+    17,1,0,0,122,26,69,120,116,101,110,115,105,111,110,70,
+    105,108,101,76,111,97,100,101,114,46,95,95,101,113,95,95,
+    99,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,
+    0,3,0,0,0,67,0,0,0,114,18,1,0,0,114,69,
+    0,0,0,114,19,1,0,0,114,21,1,0,0,114,7,0,
+    0,0,114,7,0,0,0,114,8,0,0,0,114,22,1,0,
+    0,147,4,0,0,114,23,1,0,0,122,28,69,120,116,101,
+    110,115,105,111,110,70,105,108,101,76,111,97,100,101,114,46,
+    95,95,104,97,115,104,95,95,99,2,0,0,0,0,0,0,
+    0,0,0,0,0,3,0,0,0,5,0,0,0,67,0,0,
+    0,115,36,0,0,0,116,0,160,1,116,2,106,3,124,1,
+    161,2,125,2,116,0,160,4,100,1,124,1,106,5,124,0,
+    106,6,161,3,1,0,124,2,83,0,41,2,122,38,67,114,
+    101,97,116,101,32,97,110,32,117,110,105,116,105,97,108,105,
+    122,101,100,32,101,120,116,101,110,115,105,111,110,32,109,111,
+    100,117,108,101,122,38,101,120,116,101,110,115,105,111,110,32,
+    109,111,100,117,108,101,32,123,33,114,125,32,108,111,97,100,
+    101,100,32,102,114,111,109,32,123,33,114,125,41,7,114,159,
+    0,0,0,114,242,0,0,0,114,187,0,0,0,90,14,99,
+    114,101,97,116,101,95,100,121,110,97,109,105,99,114,173,0,
+    0,0,114,141,0,0,0,114,65,0,0,0,41,3,114,143,
+    0,0,0,114,210,0,0,0,114,244,0,0,0,114,7,0,
+    0,0,114,7,0,0,0,114,8,0,0,0,114,239,0,0,
+    0,150,4,0,0,115,14,0,0,0,4,2,6,1,4,255,
+    6,2,8,1,4,255,4,2,122,33,69,120,116,101,110,115,
+    105,111,110,70,105,108,101,76,111,97,100,101,114,46,99,114,
+    101,97,116,101,95,109,111,100,117,108,101,99,2,0,0,0,
+    0,0,0,0,0,0,0,0,2,0,0,0,5,0,0,0,
+    67,0,0,0,115,36,0,0,0,116,0,160,1,116,2,106,
+    3,124,1,161,2,1,0,116,0,160,4,100,1,124,0,106,
+    5,124,0,106,6,161,3,1,0,100,2,83,0,41,3,122,
+    30,73,110,105,116,105,97,108,105,122,101,32,97,110,32,101,
+    120,116,101,110,115,105,111,110,32,109,111,100,117,108,101,122,
+    40,101,120,116,101,110,115,105,111,110,32,109,111,100,117,108,
+    101,32,123,33,114,125,32,101,120,101,99,117,116,101,100,32,
+    102,114,111,109,32,123,33,114,125,78,41,7,114,159,0,0,
+    0,114,242,0,0,0,114,187,0,0,0,90,12,101,120,101,
+    99,95,100,121,110,97,109,105,99,114,173,0,0,0,114,141,
+    0,0,0,114,65,0,0,0,169,2,114,143,0,0,0,114,
+    244,0,0,0,114,7,0,0,0,114,7,0,0,0,114,8,
+    0,0,0,114,245,0,0,0,158,4,0,0,115,8,0,0,
+    0,14,2,6,1,8,1,8,255,122,31,69,120,116,101,110,
+    115,105,111,110,70,105,108,101,76,111,97,100,101,114,46,101,
+    120,101,99,95,109,111,100,117,108,101,99,2,0,0,0,0,
+    0,0,0,0,0,0,0,2,0,0,0,4,0,0,0,3,
+    0,0,0,115,36,0,0,0,116,0,124,0,106,1,131,1,
+    100,1,25,0,137,0,116,2,135,0,102,1,100,2,100,3,
+    132,8,116,3,68,0,131,1,131,1,83,0,41,4,122,49,
+    82,101,116,117,114,110,32,84,114,117,101,32,105,102,32,116,
+    104,101,32,101,120,116,101,110,115,105,111,110,32,109,111,100,
+    117,108,101,32,105,115,32,97,32,112,97,99,107,97,103,101,
+    46,114,3,0,0,0,99,1,0,0,0,0,0,0,0,0,
+    0,0,0,2,0,0,0,4,0,0,0,51,0,0,0,115,
+    28,0,0,0,129,0,124,0,93,9,125,1,136,0,100,0,
+    124,1,23,0,107,2,86,0,1,0,113,2,100,1,83,0,
+    41,2,114,236,0,0,0,78,114,7,0,0,0,169,2,114,
+    5,0,0,0,218,6,115,117,102,102,105,120,169,1,90,9,
+    102,105,108,101,95,110,97,109,101,114,7,0,0,0,114,8,
+    0,0,0,114,9,0,0,0,167,4,0,0,115,8,0,0,
+    0,2,128,4,0,2,1,20,255,122,49,69,120,116,101,110,
+    115,105,111,110,70,105,108,101,76,111,97,100,101,114,46,105,
+    115,95,112,97,99,107,97,103,101,46,60,108,111,99,97,108,
+    115,62,46,60,103,101,110,101,120,112,114,62,41,4,114,74,
+    0,0,0,114,65,0,0,0,218,3,97,110,121,114,232,0,
+    0,0,114,247,0,0,0,114,7,0,0,0,114,45,1,0,
+    0,114,8,0,0,0,114,206,0,0,0,164,4,0,0,115,
+    8,0,0,0,14,2,12,1,2,1,8,255,122,30,69,120,
+    116,101,110,115,105,111,110,70,105,108,101,76,111,97,100,101,
+    114,46,105,115,95,112,97,99,107,97,103,101,99,2,0,0,
+    0,0,0,0,0,0,0,0,0,2,0,0,0,1,0,0,
+    0,67,0,0,0,114,23,0,0,0,41,2,122,63,82,101,
+    116,117,114,110,32,78,111,110,101,32,97,115,32,97,110,32,
+    101,120,116,101,110,115,105,111,110,32,109,111,100,117,108,101,
+    32,99,97,110,110,111,116,32,99,114,101,97,116,101,32,97,
+    32,99,111,100,101,32,111,98,106,101,99,116,46,78,114,7,
+    0,0,0,114,247,0,0,0,114,7,0,0,0,114,7,0,
+    0,0,114,8,0,0,0,114,241,0,0,0,170,4,0,0,
+    114,24,0,0,0,122,28,69,120,116,101,110,115,105,111,110,
+    70,105,108,101,76,111,97,100,101,114,46,103,101,116,95,99,
+    111,100,101,99,2,0,0,0,0,0,0,0,0,0,0,0,
+    2,0,0,0,1,0,0,0,67,0,0,0,114,23,0,0,
+    0,41,2,122,53,82,101,116,117,114,110,32,78,111,110,101,
+    32,97,115,32,101,120,116,101,110,115,105,111,110,32,109,111,
+    100,117,108,101,115,32,104,97,118,101,32,110,111,32,115,111,
+    117,114,99,101,32,99,111,100,101,46,78,114,7,0,0,0,
+    114,247,0,0,0,114,7,0,0,0,114,7,0,0,0,114,
+    8,0,0,0,114,1,1,0,0,174,4,0,0,114,24,0,
+    0,0,122,30,69,120,116,101,110,115,105,111,110,70,105,108,
+    101,76,111,97,100,101,114,46,103,101,116,95,115,111,117,114,
+    99,101,99,2,0,0,0,0,0,0,0,0,0,0,0,2,
+    0,0,0,1,0,0,0,67,0,0,0,114,26,1,0,0,
+    114,27,1,0,0,114,71,0,0,0,114,247,0,0,0,114,
+    7,0,0,0,114,7,0,0,0,114,8,0,0,0,114,203,
+    0,0,0,178,4,0,0,114,28,1,0,0,122,32,69,120,
+    116,101,110,115,105,111,110,70,105,108,101,76,111,97,100,101,
+    114,46,103,101,116,95,102,105,108,101,110,97,109,101,78,41,
+    14,114,150,0,0,0,114,149,0,0,0,114,151,0,0,0,
+    114,152,0,0,0,114,236,0,0,0,114,16,1,0,0,114,
+    22,1,0,0,114,239,0,0,0,114,245,0,0,0,114,206,
+    0,0,0,114,241,0,0,0,114,1,1,0,0,114,160,0,
+    0,0,114,203,0,0,0,114,7,0,0,0,114,7,0,0,
+    0,114,7,0,0,0,114,8,0,0,0,114,30,1,0,0,
+    131,4,0,0,115,24,0,0,0,8,0,4,2,8,6,8,
+    4,8,4,8,3,8,8,8,6,8,6,8,4,2,4,14,
+    1,114,30,1,0,0,99,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,2,0,0,0,64,0,0,0,115,
+    108,0,0,0,101,0,90,1,100,0,90,2,100,1,90,3,
+    100,2,90,4,100,3,100,4,132,0,90,5,100,5,100,6,
+    132,0,90,6,100,7,100,8,132,0,90,7,100,9,100,10,
+    132,0,90,8,100,11,100,12,132,0,90,9,100,13,100,14,
+    132,0,90,10,100,15,100,16,132,0,90,11,100,17,100,18,
+    132,0,90,12,100,19,100,20,132,0,90,13,100,21,100,22,
+    132,0,90,14,100,23,100,24,132,0,90,15,100,25,83,0,
+    41,26,218,14,95,78,97,109,101,115,112,97,99,101,80,97,
+    116,104,97,38,1,0,0,82,101,112,114,101,115,101,110,116,
+    115,32,97,32,110,97,109,101,115,112,97,99,101,32,112,97,
+    99,107,97,103,101,39,115,32,112,97,116,104,46,32,32,73,
+    116,32,117,115,101,115,32,116,104,101,32,109,111,100,117,108,
+    101,32,110,97,109,101,10,32,32,32,32,116,111,32,102,105,
+    110,100,32,105,116,115,32,112,97,114,101,110,116,32,109,111,
+    100,117,108,101,44,32,97,110,100,32,102,114,111,109,32,116,
+    104,101,114,101,32,105,116,32,108,111,111,107,115,32,117,112,
+    32,116,104,101,32,112,97,114,101,110,116,39,115,10,32,32,
+    32,32,95,95,112,97,116,104,95,95,46,32,32,87,104,101,
+    110,32,116,104,105,115,32,99,104,97,110,103,101,115,44,32,
+    116,104,101,32,109,111,100,117,108,101,39,115,32,111,119,110,
+    32,112,97,116,104,32,105,115,32,114,101,99,111,109,112,117,
+    116,101,100,44,10,32,32,32,32,117,115,105,110,103,32,112,
+    97,116,104,95,102,105,110,100,101,114,46,32,32,70,111,114,
+    32,116,111,112,45,108,101,118,101,108,32,109,111,100,117,108,
+    101,115,44,32,116,104,101,32,112,97,114,101,110,116,32,109,
+    111,100,117,108,101,39,115,32,112,97,116,104,10,32,32,32,
+    32,105,115,32,115,121,115,46,112,97,116,104,46,114,0,0,
+    0,0,99,4,0,0,0,0,0,0,0,0,0,0,0,4,
+    0,0,0,3,0,0,0,67,0,0,0,115,44,0,0,0,
+    124,1,124,0,95,0,124,2,124,0,95,1,116,2,124,0,
+    160,3,161,0,131,1,124,0,95,4,124,0,106,5,124,0,
+    95,6,124,3,124,0,95,7,100,0,83,0,114,69,0,0,
+    0,41,8,218,5,95,110,97,109,101,218,5,95,112,97,116,
+    104,114,136,0,0,0,218,16,95,103,101,116,95,112,97,114,
+    101,110,116,95,112,97,116,104,218,17,95,108,97,115,116,95,
+    112,97,114,101,110,116,95,112,97,116,104,218,6,95,101,112,
+    111,99,104,218,11,95,108,97,115,116,95,101,112,111,99,104,
+    218,12,95,112,97,116,104,95,102,105,110,100,101,114,169,4,
+    114,143,0,0,0,114,141,0,0,0,114,65,0,0,0,90,
+    11,112,97,116,104,95,102,105,110,100,101,114,114,7,0,0,
+    0,114,7,0,0,0,114,8,0,0,0,114,236,0,0,0,
+    195,4,0,0,115,10,0,0,0,6,1,6,1,14,1,8,
+    1,10,1,122,23,95,78,97,109,101,115,112,97,99,101,80,
+    97,116,104,46,95,95,105,110,105,116,95,95,99,1,0,0,
+    0,0,0,0,0,0,0,0,0,4,0,0,0,3,0,0,
+    0,67,0,0,0,115,38,0,0,0,124,0,106,0,160,1,
+    100,1,161,1,92,3,125,1,125,2,125,3,124,2,100,2,
+    107,2,114,15,100,3,83,0,124,1,100,4,102,2,83,0,
+    41,5,122,62,82,101,116,117,114,110,115,32,97,32,116,117,
+    112,108,101,32,111,102,32,40,112,97,114,101,110,116,45,109,
+    111,100,117,108,101,45,110,97,109,101,44,32,112,97,114,101,
+    110,116,45,112,97,116,104,45,97,116,116,114,45,110,97,109,
+    101,41,114,97,0,0,0,114,10,0,0,0,41,2,114,15,
+    0,0,0,114,65,0,0,0,90,8,95,95,112,97,116,104,
+    95,95,41,2,114,48,1,0,0,114,104,0,0,0,41,4,
+    114,143,0,0,0,114,40,1,0,0,218,3,100,111,116,90,
+    2,109,101,114,7,0,0,0,114,7,0,0,0,114,8,0,
+    0,0,218,23,95,102,105,110,100,95,112,97,114,101,110,116,
+    95,112,97,116,104,95,110,97,109,101,115,202,4,0,0,115,
+    8,0,0,0,18,2,8,1,4,2,8,3,122,38,95,78,
+    97,109,101,115,112,97,99,101,80,97,116,104,46,95,102,105,
+    110,100,95,112,97,114,101,110,116,95,112,97,116,104,95,110,
+    97,109,101,115,99,1,0,0,0,0,0,0,0,0,0,0,
+    0,3,0,0,0,3,0,0,0,67,0,0,0,115,28,0,
+    0,0,124,0,160,0,161,0,92,2,125,1,125,2,116,1,
+    116,2,106,3,124,1,25,0,124,2,131,2,83,0,114,69,
+    0,0,0,41,4,114,57,1,0,0,114,155,0,0,0,114,
+    15,0,0,0,218,7,109,111,100,117,108,101,115,41,3,114,
+    143,0,0,0,90,18,112,97,114,101,110,116,95,109,111,100,
+    117,108,101,95,110,97,109,101,90,14,112,97,116,104,95,97,
+    116,116,114,95,110,97,109,101,114,7,0,0,0,114,7,0,
+    0,0,114,8,0,0,0,114,50,1,0,0,212,4,0,0,
+    115,4,0,0,0,12,1,16,1,122,31,95,78,97,109,101,
+    115,112,97,99,101,80,97,116,104,46,95,103,101,116,95,112,
+    97,114,101,110,116,95,112,97,116,104,99,1,0,0,0,0,
+    0,0,0,0,0,0,0,3,0,0,0,4,0,0,0,67,
+    0,0,0,115,100,0,0,0,116,0,124,0,160,1,161,0,
+    131,1,125,1,124,1,124,0,106,2,107,3,115,17,124,0,
+    106,3,124,0,106,4,107,3,114,47,124,0,160,5,124,0,
+    106,6,124,1,161,2,125,2,124,2,100,0,117,1,114,40,
+    124,2,106,7,100,0,117,0,114,40,124,2,106,8,114,40,
+    124,2,106,8,124,0,95,9,124,1,124,0,95,2,124,0,
+    106,3,124,0,95,4,124,0,106,9,83,0,114,69,0,0,
+    0,41,10,114,136,0,0,0,114,50,1,0,0,114,51,1,
+    0,0,114,52,1,0,0,114,53,1,0,0,114,54,1,0,
+    0,114,48,1,0,0,114,164,0,0,0,114,202,0,0,0,
+    114,49,1,0,0,41,3,114,143,0,0,0,90,11,112,97,
+    114,101,110,116,95,112,97,116,104,114,210,0,0,0,114,7,
+    0,0,0,114,7,0,0,0,114,8,0,0,0,218,12,95,
+    114,101,99,97,108,99,117,108,97,116,101,216,4,0,0,115,
+    18,0,0,0,12,2,22,1,14,1,18,3,6,1,8,1,
+    6,1,8,1,6,1,122,27,95,78,97,109,101,115,112,97,
+    99,101,80,97,116,104,46,95,114,101,99,97,108,99,117,108,
+    97,116,101,99,1,0,0,0,0,0,0,0,0,0,0,0,
+    1,0,0,0,3,0,0,0,67,0,0,0,243,12,0,0,
+    0,116,0,124,0,160,1,161,0,131,1,83,0,114,69,0,
+    0,0,41,2,218,4,105,116,101,114,114,59,1,0,0,114,
+    21,1,0,0,114,7,0,0,0,114,7,0,0,0,114,8,
+    0,0,0,218,8,95,95,105,116,101,114,95,95,230,4,0,
+    0,243,2,0,0,0,12,1,122,23,95,78,97,109,101,115,
+    112,97,99,101,80,97,116,104,46,95,95,105,116,101,114,95,
+    95,99,2,0,0,0,0,0,0,0,0,0,0,0,2,0,
+    0,0,2,0,0,0,67,0,0,0,115,12,0,0,0,124,
+    0,160,0,161,0,124,1,25,0,83,0,114,69,0,0,0,
+    169,1,114,59,1,0,0,41,2,114,143,0,0,0,218,5,
+    105,110,100,101,120,114,7,0,0,0,114,7,0,0,0,114,
+    8,0,0,0,218,11,95,95,103,101,116,105,116,101,109,95,
+    95,233,4,0,0,114,63,1,0,0,122,26,95,78,97,109,
+    101,115,112,97,99,101,80,97,116,104,46,95,95,103,101,116,
+    105,116,101,109,95,95,99,3,0,0,0,0,0,0,0,0,
+    0,0,0,3,0,0,0,3,0,0,0,67,0,0,0,115,
+    14,0,0,0,124,2,124,0,106,0,124,1,60,0,100,0,
+    83,0,114,69,0,0,0,41,1,114,49,1,0,0,41,3,
+    114,143,0,0,0,114,65,1,0,0,114,65,0,0,0,114,
+    7,0,0,0,114,7,0,0,0,114,8,0,0,0,218,11,
+    95,95,115,101,116,105,116,101,109,95,95,236,4,0,0,115,
+    2,0,0,0,14,1,122,26,95,78,97,109,101,115,112,97,
+    99,101,80,97,116,104,46,95,95,115,101,116,105,116,101,109,
+    95,95,99,1,0,0,0,0,0,0,0,0,0,0,0,1,
+    0,0,0,3,0,0,0,67,0,0,0,114,60,1,0,0,
+    114,69,0,0,0,41,2,114,4,0,0,0,114,59,1,0,
+    0,114,21,1,0,0,114,7,0,0,0,114,7,0,0,0,
+    114,8,0,0,0,218,7,95,95,108,101,110,95,95,239,4,
+    0,0,114,63,1,0,0,122,22,95,78,97,109,101,115,112,
+    97,99,101,80,97,116,104,46,95,95,108,101,110,95,95,99,
+    1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,
+    3,0,0,0,67,0,0,0,243,12,0,0,0,100,1,160,
+    0,124,0,106,1,161,1,83,0,41,2,78,122,20,95,78,
+    97,109,101,115,112,97,99,101,80,97,116,104,40,123,33,114,
+    125,41,41,2,114,89,0,0,0,114,49,1,0,0,114,21,
+    1,0,0,114,7,0,0,0,114,7,0,0,0,114,8,0,
+    0,0,218,8,95,95,114,101,112,114,95,95,242,4,0,0,
+    114,63,1,0,0,122,23,95,78,97,109,101,115,112,97,99,
+    101,80,97,116,104,46,95,95,114,101,112,114,95,95,99,2,
+    0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,3,
+    0,0,0,67,0,0,0,115,12,0,0,0,124,1,124,0,
+    160,0,161,0,118,0,83,0,114,69,0,0,0,114,64,1,
+    0,0,169,2,114,143,0,0,0,218,4,105,116,101,109,114,
+    7,0,0,0,114,7,0,0,0,114,8,0,0,0,218,12,
+    95,95,99,111,110,116,97,105,110,115,95,95,245,4,0,0,
+    114,63,1,0,0,122,27,95,78,97,109,101,115,112,97,99,
+    101,80,97,116,104,46,95,95,99,111,110,116,97,105,110,115,
+    95,95,99,2,0,0,0,0,0,0,0,0,0,0,0,2,
+    0,0,0,3,0,0,0,67,0,0,0,115,16,0,0,0,
+    124,0,106,0,160,1,124,1,161,1,1,0,100,0,83,0,
+    114,69,0,0,0,41,2,114,49,1,0,0,114,61,0,0,
+    0,114,71,1,0,0,114,7,0,0,0,114,7,0,0,0,
+    114,8,0,0,0,114,61,0,0,0,248,4,0,0,243,2,
+    0,0,0,16,1,122,21,95,78,97,109,101,115,112,97,99,
+    101,80,97,116,104,46,97,112,112,101,110,100,78,41,16,114,
+    150,0,0,0,114,149,0,0,0,114,151,0,0,0,114,152,
+    0,0,0,114,52,1,0,0,114,236,0,0,0,114,57,1,
+    0,0,114,50,1,0,0,114,59,1,0,0,114,62,1,0,
+    0,114,66,1,0,0,114,67,1,0,0,114,68,1,0,0,
+    114,70,1,0,0,114,73,1,0,0,114,61,0,0,0,114,
+    7,0,0,0,114,7,0,0,0,114,7,0,0,0,114,8,
+    0,0,0,114,47,1,0,0,184,4,0,0,115,28,0,0,
+    0,8,0,4,1,4,8,8,2,8,7,8,10,8,4,8,
+    14,8,3,8,3,8,3,8,3,8,3,12,3,114,47,1,
+    0,0,99,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,3,0,0,0,64,0,0,0,115,88,0,0,0,
+    101,0,90,1,100,0,90,2,100,1,100,2,132,0,90,3,
+    101,4,100,3,100,4,132,0,131,1,90,5,100,5,100,6,
+    132,0,90,6,100,7,100,8,132,0,90,7,100,9,100,10,
+    132,0,90,8,100,11,100,12,132,0,90,9,100,13,100,14,
+    132,0,90,10,100,15,100,16,132,0,90,11,100,17,100,18,
+    132,0,90,12,100,19,83,0,41,20,218,16,95,78,97,109,
+    101,115,112,97,99,101,76,111,97,100,101,114,99,4,0,0,
+    0,0,0,0,0,0,0,0,0,4,0,0,0,4,0,0,
+    0,67,0,0,0,115,18,0,0,0,116,0,124,1,124,2,
+    124,3,131,3,124,0,95,1,100,0,83,0,114,69,0,0,
+    0,41,2,114,47,1,0,0,114,49,1,0,0,114,55,1,
+    0,0,114,7,0,0,0,114,7,0,0,0,114,8,0,0,
+    0,114,236,0,0,0,254,4,0,0,115,2,0,0,0,18,
+    1,122,25,95,78,97,109,101,115,112,97,99,101,76,111,97,
+    100,101,114,46,95,95,105,110,105,116,95,95,99,1,0,0,
+    0,0,0,0,0,0,0,0,0,1,0,0,0,4,0,0,
+    0,67,0,0,0,115,24,0,0,0,116,0,160,1,100,1,
+    116,2,161,2,1,0,100,2,160,3,124,0,106,4,161,1,
+    83,0,41,3,122,115,82,101,116,117,114,110,32,114,101,112,
+    114,32,102,111,114,32,116,104,101,32,109,111,100,117,108,101,
+    46,10,10,32,32,32,32,32,32,32,32,84,104,101,32,109,
+    101,116,104,111,100,32,105,115,32,100,101,112,114,101,99,97,
+    116,101,100,46,32,32,84,104,101,32,105,109,112,111,114,116,
+    32,109,97,99,104,105,110,101,114,121,32,100,111,101,115,32,
+    116,104,101,32,106,111,98,32,105,116,115,101,108,102,46,10,
+    10,32,32,32,32,32,32,32,32,122,82,95,78,97,109,101,
+    115,112,97,99,101,76,111,97,100,101,114,46,109,111,100,117,
+    108,101,95,114,101,112,114,40,41,32,105,115,32,100,101,112,
+    114,101,99,97,116,101,100,32,97,110,100,32,115,108,97,116,
+    101,100,32,102,111,114,32,114,101,109,111,118,97,108,32,105,
+    110,32,80,121,116,104,111,110,32,51,46,49,50,122,25,60,
+    109,111,100,117,108,101,32,123,33,114,125,32,40,110,97,109,
+    101,115,112,97,99,101,41,62,41,5,114,99,0,0,0,114,
+    100,0,0,0,114,101,0,0,0,114,89,0,0,0,114,150,
+    0,0,0,41,1,114,244,0,0,0,114,7,0,0,0,114,
+    7,0,0,0,114,8,0,0,0,218,11,109,111,100,117,108,
+    101,95,114,101,112,114,1,5,0,0,115,8,0,0,0,6,
+    7,2,1,4,255,12,2,122,28,95,78,97,109,101,115,112,
+    97,99,101,76,111,97,100,101,114,46,109,111,100,117,108,101,
+    95,114,101,112,114,99,2,0,0,0,0,0,0,0,0,0,
+    0,0,2,0,0,0,1,0,0,0,67,0,0,0,114,23,
+    0,0,0,41,2,78,84,114,7,0,0,0,114,247,0,0,
+    0,114,7,0,0,0,114,7,0,0,0,114,8,0,0,0,
+    114,206,0,0,0,12,5,0,0,243,2,0,0,0,4,1,
+    122,27,95,78,97,109,101,115,112,97,99,101,76,111,97,100,
+    101,114,46,105,115,95,112,97,99,107,97,103,101,99,2,0,
+    0,0,0,0,0,0,0,0,0,0,2,0,0,0,1,0,
+    0,0,67,0,0,0,114,23,0,0,0,41,2,78,114,10,
+    0,0,0,114,7,0,0,0,114,247,0,0,0,114,7,0,
+    0,0,114,7,0,0,0,114,8,0,0,0,114,1,1,0,
+    0,15,5,0,0,114,77,1,0,0,122,27,95,78,97,109,
+    101,115,112,97,99,101,76,111,97,100,101,114,46,103,101,116,
+    95,115,111,117,114,99,101,99,2,0,0,0,0,0,0,0,
+    0,0,0,0,2,0,0,0,6,0,0,0,67,0,0,0,
+    115,16,0,0,0,116,0,100,1,100,2,100,3,100,4,100,
+    5,141,4,83,0,41,6,78,114,10,0,0,0,122,8,60,
+    115,116,114,105,110,103,62,114,243,0,0,0,84,41,1,114,
+    3,1,0,0,41,1,114,4,1,0,0,114,247,0,0,0,
+    114,7,0,0,0,114,7,0,0,0,114,8,0,0,0,114,
+    241,0,0,0,18,5,0,0,114,74,1,0,0,122,25,95,
+    78,97,109,101,115,112,97,99,101,76,111,97,100,101,114,46,
+    103,101,116,95,99,111,100,101,99,2,0,0,0,0,0,0,
+    0,0,0,0,0,2,0,0,0,1,0,0,0,67,0,0,
+    0,114,23,0,0,0,114,237,0,0,0,114,7,0,0,0,
+    114,238,0,0,0,114,7,0,0,0,114,7,0,0,0,114,
+    8,0,0,0,114,239,0,0,0,21,5,0,0,114,240,0,
+    0,0,122,30,95,78,97,109,101,115,112,97,99,101,76,111,
+    97,100,101,114,46,99,114,101,97,116,101,95,109,111,100,117,
+    108,101,99,2,0,0,0,0,0,0,0,0,0,0,0,2,
+    0,0,0,1,0,0,0,67,0,0,0,115,4,0,0,0,
+    100,0,83,0,114,69,0,0,0,114,7,0,0,0,114,42,
+    1,0,0,114,7,0,0,0,114,7,0,0,0,114,8,0,
+    0,0,114,245,0,0,0,24,5,0,0,114,77,1,0,0,
+    122,28,95,78,97,109,101,115,112,97,99,101,76,111,97,100,
+    101,114,46,101,120,101,99,95,109,111,100,117,108,101,99,2,
     0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,4,
-    0,0,0,83,0,0,0,115,20,0,0,0,104,0,124,0,
-    93,12,125,1,124,1,160,0,161,0,146,2,113,4,83,0,
-    114,5,0,0,0,41,1,114,105,0,0,0,41,2,114,32,
-    0,0,0,90,2,102,110,114,5,0,0,0,114,5,0,0,
-    0,114,8,0,0,0,218,9,60,115,101,116,99,111,109,112,
-    62,235,5,0,0,114,63,1,0,0,122,41,70,105,108,101,
-    70,105,110,100,101,114,46,95,102,105,108,108,95,99,97,99,
-    104,101,46,60,108,111,99,97,108,115,62,46,60,115,101,116,
-    99,111,109,112,62,78,41,18,114,44,0,0,0,114,4,0,
-    0,0,114,7,1,0,0,114,55,0,0,0,114,3,1,0,
-    0,218,15,80,101,114,109,105,115,115,105,111,110,69,114,114,
-    111,114,218,18,78,111,116,65,68,105,114,101,99,116,111,114,
-    121,69,114,114,111,114,114,1,0,0,0,114,10,0,0,0,
-    114,11,0,0,0,114,66,1,0,0,114,67,1,0,0,114,
-    100,0,0,0,114,62,0,0,0,114,105,0,0,0,218,3,
-    97,100,100,114,12,0,0,0,114,68,1,0,0,41,9,114,
-    118,0,0,0,114,44,0,0,0,114,8,1,0,0,90,21,
-    108,111,119,101,114,95,115,117,102,102,105,120,95,99,111,110,
-    116,101,110,116,115,114,41,1,0,0,114,116,0,0,0,114,
-    29,1,0,0,114,17,1,0,0,90,8,110,101,119,95,110,
-    97,109,101,114,5,0,0,0,114,5,0,0,0,114,8,0,
-    0,0,114,70,1,0,0,206,5,0,0,115,34,0,0,0,
-    0,2,6,1,2,1,22,1,18,3,10,3,12,1,12,7,
-    6,1,8,1,16,1,4,1,18,2,4,1,12,1,6,1,
-    12,1,122,22,70,105,108,101,70,105,110,100,101,114,46,95,
-    102,105,108,108,95,99,97,99,104,101,99,1,0,0,0,0,
-    0,0,0,0,0,0,0,3,0,0,0,3,0,0,0,7,
-    0,0,0,115,18,0,0,0,135,0,135,1,102,2,100,1,
-    100,2,132,8,125,2,124,2,83,0,41,3,97,20,1,0,
-    0,65,32,99,108,97,115,115,32,109,101,116,104,111,100,32,
-    119,104,105,99,104,32,114,101,116,117,114,110,115,32,97,32,
-    99,108,111,115,117,114,101,32,116,111,32,117,115,101,32,111,
-    110,32,115,121,115,46,112,97,116,104,95,104,111,111,107,10,
-    32,32,32,32,32,32,32,32,119,104,105,99,104,32,119,105,
-    108,108,32,114,101,116,117,114,110,32,97,110,32,105,110,115,
-    116,97,110,99,101,32,117,115,105,110,103,32,116,104,101,32,
-    115,112,101,99,105,102,105,101,100,32,108,111,97,100,101,114,
-    115,32,97,110,100,32,116,104,101,32,112,97,116,104,10,32,
-    32,32,32,32,32,32,32,99,97,108,108,101,100,32,111,110,
-    32,116,104,101,32,99,108,111,115,117,114,101,46,10,10,32,
-    32,32,32,32,32,32,32,73,102,32,116,104,101,32,112,97,
-    116,104,32,99,97,108,108,101,100,32,111,110,32,116,104,101,
-    32,99,108,111,115,117,114,101,32,105,115,32,110,111,116,32,
-    97,32,100,105,114,101,99,116,111,114,121,44,32,73,109,112,
-    111,114,116,69,114,114,111,114,32,105,115,10,32,32,32,32,
-    32,32,32,32,114,97,105,115,101,100,46,10,10,32,32,32,
-    32,32,32,32,32,99,1,0,0,0,0,0,0,0,0,0,
-    0,0,1,0,0,0,4,0,0,0,19,0,0,0,115,36,
-    0,0,0,116,0,124,0,131,1,115,20,116,1,100,1,124,
-    0,100,2,141,2,130,1,136,0,124,0,103,1,136,1,162,
-    1,82,0,142,0,83,0,41,3,122,45,80,97,116,104,32,
-    104,111,111,107,32,102,111,114,32,105,109,112,111,114,116,108,
-    105,98,46,109,97,99,104,105,110,101,114,121,46,70,105,108,
-    101,70,105,110,100,101,114,46,122,30,111,110,108,121,32,100,
-    105,114,101,99,116,111,114,105,101,115,32,97,114,101,32,115,
-    117,112,112,111,114,116,101,100,114,48,0,0,0,41,2,114,
-    56,0,0,0,114,117,0,0,0,114,48,0,0,0,169,2,
-    114,193,0,0,0,114,69,1,0,0,114,5,0,0,0,114,
-    8,0,0,0,218,24,112,97,116,104,95,104,111,111,107,95,
-    102,111,114,95,70,105,108,101,70,105,110,100,101,114,247,5,
-    0,0,115,6,0,0,0,0,2,8,1,12,1,122,54,70,
+    0,0,0,67,0,0,0,115,26,0,0,0,116,0,160,1,
+    100,1,124,0,106,2,161,2,1,0,116,0,160,3,124,0,
+    124,1,161,2,83,0,41,2,122,98,76,111,97,100,32,97,
+    32,110,97,109,101,115,112,97,99,101,32,109,111,100,117,108,
+    101,46,10,10,32,32,32,32,32,32,32,32,84,104,105,115,
+    32,109,101,116,104,111,100,32,105,115,32,100,101,112,114,101,
+    99,97,116,101,100,46,32,32,85,115,101,32,101,120,101,99,
+    95,109,111,100,117,108,101,40,41,32,105,110,115,116,101,97,
+    100,46,10,10,32,32,32,32,32,32,32,32,122,38,110,97,
+    109,101,115,112,97,99,101,32,109,111,100,117,108,101,32,108,
+    111,97,100,101,100,32,119,105,116,104,32,112,97,116,104,32,
+    123,33,114,125,41,4,114,159,0,0,0,114,173,0,0,0,
+    114,49,1,0,0,114,246,0,0,0,114,247,0,0,0,114,
+    7,0,0,0,114,7,0,0,0,114,8,0,0,0,114,248,
+    0,0,0,27,5,0,0,115,8,0,0,0,6,7,4,1,
+    4,255,12,3,122,28,95,78,97,109,101,115,112,97,99,101,
+    76,111,97,100,101,114,46,108,111,97,100,95,109,111,100,117,
+    108,101,99,2,0,0,0,0,0,0,0,0,0,0,0,3,
+    0,0,0,2,0,0,0,67,0,0,0,115,22,0,0,0,
+    100,1,100,2,108,0,109,1,125,2,1,0,124,2,124,0,
+    106,2,131,1,83,0,41,3,78,114,0,0,0,0,41,1,
+    218,15,78,97,109,101,115,112,97,99,101,82,101,97,100,101,
+    114,41,3,114,32,1,0,0,114,78,1,0,0,114,49,1,
+    0,0,41,3,114,143,0,0,0,114,244,0,0,0,114,78,
+    1,0,0,114,7,0,0,0,114,7,0,0,0,114,8,0,
+    0,0,114,33,1,0,0,39,5,0,0,115,4,0,0,0,
+    12,1,10,1,122,36,95,78,97,109,101,115,112,97,99,101,
+    76,111,97,100,101,114,46,103,101,116,95,114,101,115,111,117,
+    114,99,101,95,114,101,97,100,101,114,78,41,13,114,150,0,
+    0,0,114,149,0,0,0,114,151,0,0,0,114,236,0,0,
+    0,114,233,0,0,0,114,76,1,0,0,114,206,0,0,0,
+    114,1,1,0,0,114,241,0,0,0,114,239,0,0,0,114,
+    245,0,0,0,114,248,0,0,0,114,33,1,0,0,114,7,
+    0,0,0,114,7,0,0,0,114,7,0,0,0,114,8,0,
+    0,0,114,75,1,0,0,253,4,0,0,115,22,0,0,0,
+    8,0,8,1,2,3,10,1,8,10,8,3,8,3,8,3,
+    8,3,8,3,12,12,114,75,1,0,0,99,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,
+    64,0,0,0,115,118,0,0,0,101,0,90,1,100,0,90,
+    2,100,1,90,3,101,4,100,2,100,3,132,0,131,1,90,
+    5,101,4,100,4,100,5,132,0,131,1,90,6,101,7,100,
+    6,100,7,132,0,131,1,90,8,101,7,100,8,100,9,132,
+    0,131,1,90,9,101,7,100,19,100,11,100,12,132,1,131,
+    1,90,10,101,7,100,20,100,13,100,14,132,1,131,1,90,
+    11,101,7,100,19,100,15,100,16,132,1,131,1,90,12,101,
+    4,100,17,100,18,132,0,131,1,90,13,100,10,83,0,41,
+    21,218,10,80,97,116,104,70,105,110,100,101,114,122,62,77,
+    101,116,97,32,112,97,116,104,32,102,105,110,100,101,114,32,
+    102,111,114,32,115,121,115,46,112,97,116,104,32,97,110,100,
+    32,112,97,99,107,97,103,101,32,95,95,112,97,116,104,95,
+    95,32,97,116,116,114,105,98,117,116,101,115,46,99,0,0,
+    0,0,0,0,0,0,0,0,0,0,2,0,0,0,4,0,
+    0,0,67,0,0,0,115,78,0,0,0,116,0,116,1,106,
+    2,160,3,161,0,131,1,68,0,93,22,92,2,125,0,125,
+    1,124,1,100,1,117,0,114,20,116,1,106,2,124,0,61,
+    0,113,7,116,4,124,1,100,2,131,2,114,29,124,1,160,
+    5,161,0,1,0,113,7,116,6,4,0,106,7,100,3,55,
+    0,2,0,95,7,100,1,83,0,41,4,122,125,67,97,108,
+    108,32,116,104,101,32,105,110,118,97,108,105,100,97,116,101,
+    95,99,97,99,104,101,115,40,41,32,109,101,116,104,111,100,
+    32,111,110,32,97,108,108,32,112,97,116,104,32,101,110,116,
+    114,121,32,102,105,110,100,101,114,115,10,32,32,32,32,32,
+    32,32,32,115,116,111,114,101,100,32,105,110,32,115,121,115,
+    46,112,97,116,104,95,105,109,112,111,114,116,101,114,95,99,
+    97,99,104,101,115,32,40,119,104,101,114,101,32,105,109,112,
+    108,101,109,101,110,116,101,100,41,46,78,218,17,105,110,118,
+    97,108,105,100,97,116,101,95,99,97,99,104,101,115,114,3,
+    0,0,0,41,8,218,4,108,105,115,116,114,15,0,0,0,
+    218,19,112,97,116,104,95,105,109,112,111,114,116,101,114,95,
+    99,97,99,104,101,218,5,105,116,101,109,115,114,153,0,0,
+    0,114,80,1,0,0,114,47,1,0,0,114,52,1,0,0,
+    41,2,114,141,0,0,0,218,6,102,105,110,100,101,114,114,
+    7,0,0,0,114,7,0,0,0,114,8,0,0,0,114,80,
+    1,0,0,50,5,0,0,115,14,0,0,0,22,4,8,1,
+    10,1,10,1,8,1,2,128,18,3,122,28,80,97,116,104,
+    70,105,110,100,101,114,46,105,110,118,97,108,105,100,97,116,
+    101,95,99,97,99,104,101,115,99,1,0,0,0,0,0,0,
+    0,0,0,0,0,2,0,0,0,9,0,0,0,67,0,0,
+    0,115,76,0,0,0,116,0,106,1,100,1,117,1,114,14,
+    116,0,106,1,115,14,116,2,160,3,100,2,116,4,161,2,
+    1,0,116,0,106,1,68,0,93,18,125,1,122,7,124,1,
+    124,0,131,1,87,0,2,0,1,0,83,0,4,0,116,5,
+    121,35,1,0,1,0,1,0,89,0,113,17,119,0,100,1,
+    83,0,41,3,122,46,83,101,97,114,99,104,32,115,121,115,
+    46,112,97,116,104,95,104,111,111,107,115,32,102,111,114,32,
+    97,32,102,105,110,100,101,114,32,102,111,114,32,39,112,97,
+    116,104,39,46,78,122,23,115,121,115,46,112,97,116,104,95,
+    104,111,111,107,115,32,105,115,32,101,109,112,116,121,41,6,
+    114,15,0,0,0,218,10,112,97,116,104,95,104,111,111,107,
+    115,114,99,0,0,0,114,100,0,0,0,114,162,0,0,0,
+    114,142,0,0,0,41,2,114,65,0,0,0,90,4,104,111,
+    111,107,114,7,0,0,0,114,7,0,0,0,114,8,0,0,
+    0,218,11,95,112,97,116,104,95,104,111,111,107,115,63,5,
+    0,0,115,18,0,0,0,16,3,12,1,10,1,2,1,14,
+    1,12,1,4,1,2,255,4,3,122,22,80,97,116,104,70,
+    105,110,100,101,114,46,95,112,97,116,104,95,104,111,111,107,
+    115,99,2,0,0,0,0,0,0,0,0,0,0,0,3,0,
+    0,0,8,0,0,0,67,0,0,0,115,100,0,0,0,124,
+    1,100,1,107,2,114,21,122,6,116,0,160,1,161,0,125,
+    1,87,0,110,10,4,0,116,2,121,20,1,0,1,0,1,
+    0,89,0,100,2,83,0,119,0,122,8,116,3,106,4,124,
+    1,25,0,125,2,87,0,124,2,83,0,4,0,116,5,121,
+    49,1,0,1,0,1,0,124,0,160,6,124,1,161,1,125,
+    2,124,2,116,3,106,4,124,1,60,0,89,0,124,2,83,
+    0,119,0,41,3,122,210,71,101,116,32,116,104,101,32,102,
+    105,110,100,101,114,32,102,111,114,32,116,104,101,32,112,97,
+    116,104,32,101,110,116,114,121,32,102,114,111,109,32,115,121,
+    115,46,112,97,116,104,95,105,109,112,111,114,116,101,114,95,
+    99,97,99,104,101,46,10,10,32,32,32,32,32,32,32,32,
+    73,102,32,116,104,101,32,112,97,116,104,32,101,110,116,114,
+    121,32,105,115,32,110,111,116,32,105,110,32,116,104,101,32,
+    99,97,99,104,101,44,32,102,105,110,100,32,116,104,101,32,
+    97,112,112,114,111,112,114,105,97,116,101,32,102,105,110,100,
+    101,114,10,32,32,32,32,32,32,32,32,97,110,100,32,99,
+    97,99,104,101,32,105,116,46,32,73,102,32,110,111,32,102,
+    105,110,100,101,114,32,105,115,32,97,118,97,105,108,97,98,
+    108,101,44,32,115,116,111,114,101,32,78,111,110,101,46,10,
+    10,32,32,32,32,32,32,32,32,114,10,0,0,0,78,41,
+    7,114,18,0,0,0,114,82,0,0,0,218,17,70,105,108,
+    101,78,111,116,70,111,117,110,100,69,114,114,111,114,114,15,
+    0,0,0,114,82,1,0,0,218,8,75,101,121,69,114,114,
+    111,114,114,86,1,0,0,41,3,114,221,0,0,0,114,65,
+    0,0,0,114,84,1,0,0,114,7,0,0,0,114,7,0,
+    0,0,114,8,0,0,0,218,20,95,112,97,116,104,95,105,
+    109,112,111,114,116,101,114,95,99,97,99,104,101,76,5,0,
+    0,115,28,0,0,0,8,8,2,1,12,1,12,1,6,3,
+    2,253,2,4,12,1,4,4,12,253,10,1,12,1,4,1,
+    2,253,122,31,80,97,116,104,70,105,110,100,101,114,46,95,
+    112,97,116,104,95,105,109,112,111,114,116,101,114,95,99,97,
+    99,104,101,99,3,0,0,0,0,0,0,0,0,0,0,0,
+    7,0,0,0,4,0,0,0,67,0,0,0,115,138,0,0,
+    0,116,0,124,2,100,1,131,2,114,27,116,1,160,2,124,
+    2,161,1,155,0,100,2,157,2,125,3,116,3,160,4,124,
+    3,116,5,161,2,1,0,124,2,160,6,124,1,161,1,92,
+    2,125,4,125,5,110,21,116,1,160,2,124,2,161,1,155,
+    0,100,3,157,2,125,3,116,3,160,4,124,3,116,5,161,
+    2,1,0,124,2,160,7,124,1,161,1,125,4,103,0,125,
+    5,124,4,100,0,117,1,114,58,116,1,160,8,124,1,124,
+    4,161,2,83,0,116,1,160,9,124,1,100,0,161,2,125,
+    6,124,5,124,6,95,10,124,6,83,0,41,4,78,114,161,
+    0,0,0,122,53,46,102,105,110,100,95,115,112,101,99,40,
+    41,32,110,111,116,32,102,111,117,110,100,59,32,102,97,108,
+    108,105,110,103,32,98,97,99,107,32,116,111,32,102,105,110,
+    100,95,108,111,97,100,101,114,40,41,122,53,46,102,105,110,
+    100,95,115,112,101,99,40,41,32,110,111,116,32,102,111,117,
+    110,100,59,32,102,97,108,108,105,110,103,32,98,97,99,107,
+    32,116,111,32,102,105,110,100,95,109,111,100,117,108,101,40,
+    41,41,11,114,153,0,0,0,114,159,0,0,0,90,12,95,
+    111,98,106,101,99,116,95,110,97,109,101,114,99,0,0,0,
+    114,100,0,0,0,114,162,0,0,0,114,161,0,0,0,114,
+    229,0,0,0,114,224,0,0,0,114,207,0,0,0,114,202,
+    0,0,0,41,7,114,221,0,0,0,114,163,0,0,0,114,
+    84,1,0,0,114,166,0,0,0,114,164,0,0,0,114,165,
+    0,0,0,114,210,0,0,0,114,7,0,0,0,114,7,0,
+    0,0,114,8,0,0,0,218,16,95,108,101,103,97,99,121,
+    95,103,101,116,95,115,112,101,99,98,5,0,0,115,26,0,
+    0,0,10,4,16,1,12,2,16,1,16,2,12,2,10,1,
+    4,1,8,1,12,1,12,1,6,1,4,1,122,27,80,97,
+    116,104,70,105,110,100,101,114,46,95,108,101,103,97,99,121,
+    95,103,101,116,95,115,112,101,99,78,99,4,0,0,0,0,
+    0,0,0,0,0,0,0,9,0,0,0,5,0,0,0,67,
+    0,0,0,115,166,0,0,0,103,0,125,4,124,2,68,0,
+    93,67,125,5,116,0,124,5,116,1,116,2,102,2,131,2,
+    115,14,113,4,124,0,160,3,124,5,161,1,125,6,124,6,
+    100,1,117,1,114,71,116,4,124,6,100,2,131,2,114,35,
+    124,6,160,5,124,1,124,3,161,2,125,7,110,6,124,0,
+    160,6,124,1,124,6,161,2,125,7,124,7,100,1,117,0,
+    114,46,113,4,124,7,106,7,100,1,117,1,114,55,124,7,
+    2,0,1,0,83,0,124,7,106,8,125,8,124,8,100,1,
+    117,0,114,66,116,9,100,3,131,1,130,1,124,4,160,10,
+    124,8,161,1,1,0,113,4,116,11,160,12,124,1,100,1,
+    161,2,125,7,124,4,124,7,95,8,124,7,83,0,41,4,
+    122,63,70,105,110,100,32,116,104,101,32,108,111,97,100,101,
+    114,32,111,114,32,110,97,109,101,115,112,97,99,101,95,112,
+    97,116,104,32,102,111,114,32,116,104,105,115,32,109,111,100,
+    117,108,101,47,112,97,99,107,97,103,101,32,110,97,109,101,
+    46,78,114,226,0,0,0,122,19,115,112,101,99,32,109,105,
+    115,115,105,110,103,32,108,111,97,100,101,114,41,13,114,185,
+    0,0,0,114,109,0,0,0,218,5,98,121,116,101,115,114,
+    89,1,0,0,114,153,0,0,0,114,226,0,0,0,114,90,
+    1,0,0,114,164,0,0,0,114,202,0,0,0,114,142,0,
+    0,0,114,191,0,0,0,114,159,0,0,0,114,207,0,0,
+    0,41,9,114,221,0,0,0,114,163,0,0,0,114,65,0,
+    0,0,114,225,0,0,0,218,14,110,97,109,101,115,112,97,
+    99,101,95,112,97,116,104,90,5,101,110,116,114,121,114,84,
+    1,0,0,114,210,0,0,0,114,165,0,0,0,114,7,0,
+    0,0,114,7,0,0,0,114,8,0,0,0,218,9,95,103,
+    101,116,95,115,112,101,99,119,5,0,0,115,42,0,0,0,
+    4,5,8,1,14,1,2,1,10,1,8,1,10,1,14,1,
+    12,2,8,1,2,1,10,1,8,1,6,1,8,1,8,1,
+    10,5,2,128,12,2,6,1,4,1,122,20,80,97,116,104,
+    70,105,110,100,101,114,46,95,103,101,116,95,115,112,101,99,
+    99,4,0,0,0,0,0,0,0,0,0,0,0,6,0,0,
+    0,5,0,0,0,67,0,0,0,115,94,0,0,0,124,2,
+    100,1,117,0,114,7,116,0,106,1,125,2,124,0,160,2,
+    124,1,124,2,124,3,161,3,125,4,124,4,100,1,117,0,
+    114,20,100,1,83,0,124,4,106,3,100,1,117,0,114,45,
+    124,4,106,4,125,5,124,5,114,43,100,1,124,4,95,5,
+    116,6,124,1,124,5,124,0,106,2,131,3,124,4,95,4,
+    124,4,83,0,100,1,83,0,124,4,83,0,41,2,122,141,
+    84,114,121,32,116,111,32,102,105,110,100,32,97,32,115,112,
+    101,99,32,102,111,114,32,39,102,117,108,108,110,97,109,101,
+    39,32,111,110,32,115,121,115,46,112,97,116,104,32,111,114,
+    32,39,112,97,116,104,39,46,10,10,32,32,32,32,32,32,
+    32,32,84,104,101,32,115,101,97,114,99,104,32,105,115,32,
+    98,97,115,101,100,32,111,110,32,115,121,115,46,112,97,116,
+    104,95,104,111,111,107,115,32,97,110,100,32,115,121,115,46,
+    112,97,116,104,95,105,109,112,111,114,116,101,114,95,99,97,
+    99,104,101,46,10,32,32,32,32,32,32,32,32,78,41,7,
+    114,15,0,0,0,114,65,0,0,0,114,93,1,0,0,114,
+    164,0,0,0,114,202,0,0,0,114,205,0,0,0,114,47,
+    1,0,0,41,6,114,221,0,0,0,114,163,0,0,0,114,
+    65,0,0,0,114,225,0,0,0,114,210,0,0,0,114,92,
+    1,0,0,114,7,0,0,0,114,7,0,0,0,114,8,0,
+    0,0,114,226,0,0,0,151,5,0,0,115,26,0,0,0,
+    8,6,6,1,14,1,8,1,4,1,10,1,6,1,4,1,
+    6,3,16,1,4,1,4,2,4,2,122,20,80,97,116,104,
+    70,105,110,100,101,114,46,102,105,110,100,95,115,112,101,99,
+    99,3,0,0,0,0,0,0,0,0,0,0,0,4,0,0,
+    0,4,0,0,0,67,0,0,0,115,42,0,0,0,116,0,
+    160,1,100,1,116,2,161,2,1,0,124,0,160,3,124,1,
+    124,2,161,2,125,3,124,3,100,2,117,0,114,18,100,2,
+    83,0,124,3,106,4,83,0,41,3,122,170,102,105,110,100,
+    32,116,104,101,32,109,111,100,117,108,101,32,111,110,32,115,
+    121,115,46,112,97,116,104,32,111,114,32,39,112,97,116,104,
+    39,32,98,97,115,101,100,32,111,110,32,115,121,115,46,112,
+    97,116,104,95,104,111,111,107,115,32,97,110,100,10,32,32,
+    32,32,32,32,32,32,115,121,115,46,112,97,116,104,95,105,
+    109,112,111,114,116,101,114,95,99,97,99,104,101,46,10,10,
+    32,32,32,32,32,32,32,32,84,104,105,115,32,109,101,116,
+    104,111,100,32,105,115,32,100,101,112,114,101,99,97,116,101,
+    100,46,32,32,85,115,101,32,102,105,110,100,95,115,112,101,
+    99,40,41,32,105,110,115,116,101,97,100,46,10,10,32,32,
+    32,32,32,32,32,32,122,101,80,97,116,104,70,105,110,100,
+    101,114,46,102,105,110,100,95,109,111,100,117,108,101,40,41,
+    32,105,115,32,100,101,112,114,101,99,97,116,101,100,32,97,
+    110,100,32,115,108,97,116,101,100,32,102,111,114,32,114,101,
+    109,111,118,97,108,32,105,110,32,80,121,116,104,111,110,32,
+    51,46,49,50,59,32,117,115,101,32,102,105,110,100,95,115,
+    112,101,99,40,41,32,105,110,115,116,101,97,100,78,114,227,
+    0,0,0,114,228,0,0,0,114,7,0,0,0,114,7,0,
+    0,0,114,8,0,0,0,114,229,0,0,0,175,5,0,0,
+    115,14,0,0,0,6,8,2,2,4,254,12,3,8,1,4,
+    1,6,1,122,22,80,97,116,104,70,105,110,100,101,114,46,
+    102,105,110,100,95,109,111,100,117,108,101,99,0,0,0,0,
+    0,0,0,0,0,0,0,0,3,0,0,0,4,0,0,0,
+    79,0,0,0,115,28,0,0,0,100,1,100,2,108,0,109,
+    1,125,2,1,0,124,2,106,2,124,0,105,0,124,1,164,
+    1,142,1,83,0,41,3,97,32,1,0,0,10,32,32,32,
+    32,32,32,32,32,70,105,110,100,32,100,105,115,116,114,105,
+    98,117,116,105,111,110,115,46,10,10,32,32,32,32,32,32,
+    32,32,82,101,116,117,114,110,32,97,110,32,105,116,101,114,
+    97,98,108,101,32,111,102,32,97,108,108,32,68,105,115,116,
+    114,105,98,117,116,105,111,110,32,105,110,115,116,97,110,99,
+    101,115,32,99,97,112,97,98,108,101,32,111,102,10,32,32,
+    32,32,32,32,32,32,108,111,97,100,105,110,103,32,116,104,
+    101,32,109,101,116,97,100,97,116,97,32,102,111,114,32,112,
+    97,99,107,97,103,101,115,32,109,97,116,99,104,105,110,103,
+    32,96,96,99,111,110,116,101,120,116,46,110,97,109,101,96,
+    96,10,32,32,32,32,32,32,32,32,40,111,114,32,97,108,
+    108,32,110,97,109,101,115,32,105,102,32,96,96,78,111,110,
+    101,96,96,32,105,110,100,105,99,97,116,101,100,41,32,97,
+    108,111,110,103,32,116,104,101,32,112,97,116,104,115,32,105,
+    110,32,116,104,101,32,108,105,115,116,10,32,32,32,32,32,
+    32,32,32,111,102,32,100,105,114,101,99,116,111,114,105,101,
+    115,32,96,96,99,111,110,116,101,120,116,46,112,97,116,104,
+    96,96,46,10,32,32,32,32,32,32,32,32,114,0,0,0,
+    0,41,1,218,18,77,101,116,97,100,97,116,97,80,97,116,
+    104,70,105,110,100,101,114,41,3,90,18,105,109,112,111,114,
+    116,108,105,98,46,109,101,116,97,100,97,116,97,114,94,1,
+    0,0,218,18,102,105,110,100,95,100,105,115,116,114,105,98,
+    117,116,105,111,110,115,41,3,114,144,0,0,0,114,145,0,
+    0,0,114,94,1,0,0,114,7,0,0,0,114,7,0,0,
+    0,114,8,0,0,0,114,95,1,0,0,191,5,0,0,115,
+    4,0,0,0,12,10,16,1,122,29,80,97,116,104,70,105,
+    110,100,101,114,46,102,105,110,100,95,100,105,115,116,114,105,
+    98,117,116,105,111,110,115,114,69,0,0,0,114,230,0,0,
+    0,41,14,114,150,0,0,0,114,149,0,0,0,114,151,0,
+    0,0,114,152,0,0,0,114,233,0,0,0,114,80,1,0,
+    0,114,86,1,0,0,114,234,0,0,0,114,89,1,0,0,
+    114,90,1,0,0,114,93,1,0,0,114,226,0,0,0,114,
+    229,0,0,0,114,95,1,0,0,114,7,0,0,0,114,7,
+    0,0,0,114,7,0,0,0,114,8,0,0,0,114,79,1,
+    0,0,46,5,0,0,115,36,0,0,0,8,0,4,2,2,
+    2,10,1,2,12,10,1,2,12,10,1,2,21,10,1,2,
+    20,12,1,2,31,12,1,2,23,12,1,2,15,14,1,114,
+    79,1,0,0,99,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,3,0,0,0,64,0,0,0,115,90,0,
+    0,0,101,0,90,1,100,0,90,2,100,1,90,3,100,2,
+    100,3,132,0,90,4,100,4,100,5,132,0,90,5,101,6,
+    90,7,100,6,100,7,132,0,90,8,100,8,100,9,132,0,
+    90,9,100,19,100,11,100,12,132,1,90,10,100,13,100,14,
+    132,0,90,11,101,12,100,15,100,16,132,0,131,1,90,13,
+    100,17,100,18,132,0,90,14,100,10,83,0,41,20,218,10,
+    70,105,108,101,70,105,110,100,101,114,122,172,70,105,108,101,
+    45,98,97,115,101,100,32,102,105,110,100,101,114,46,10,10,
+    32,32,32,32,73,110,116,101,114,97,99,116,105,111,110,115,
+    32,119,105,116,104,32,116,104,101,32,102,105,108,101,32,115,
+    121,115,116,101,109,32,97,114,101,32,99,97,99,104,101,100,
+    32,102,111,114,32,112,101,114,102,111,114,109,97,110,99,101,
+    44,32,98,101,105,110,103,10,32,32,32,32,114,101,102,114,
+    101,115,104,101,100,32,119,104,101,110,32,116,104,101,32,100,
+    105,114,101,99,116,111,114,121,32,116,104,101,32,102,105,110,
+    100,101,114,32,105,115,32,104,97,110,100,108,105,110,103,32,
+    104,97,115,32,98,101,101,110,32,109,111,100,105,102,105,101,
+    100,46,10,10,32,32,32,32,99,2,0,0,0,0,0,0,
+    0,0,0,0,0,5,0,0,0,6,0,0,0,7,0,0,
+    0,115,112,0,0,0,103,0,125,3,124,2,68,0,93,16,
+    92,2,137,0,125,4,124,3,160,0,135,0,102,1,100,1,
+    100,2,132,8,124,4,68,0,131,1,161,1,1,0,113,4,
+    124,3,124,0,95,1,124,1,112,27,100,3,124,0,95,2,
+    116,3,124,0,106,2,131,1,115,43,116,4,116,5,160,6,
+    161,0,124,0,106,2,131,2,124,0,95,2,100,4,124,0,
+    95,7,116,8,131,0,124,0,95,9,116,8,131,0,124,0,
+    95,10,100,5,83,0,41,6,122,154,73,110,105,116,105,97,
+    108,105,122,101,32,119,105,116,104,32,116,104,101,32,112,97,
+    116,104,32,116,111,32,115,101,97,114,99,104,32,111,110,32,
+    97,110,100,32,97,32,118,97,114,105,97,98,108,101,32,110,
+    117,109,98,101,114,32,111,102,10,32,32,32,32,32,32,32,
+    32,50,45,116,117,112,108,101,115,32,99,111,110,116,97,105,
+    110,105,110,103,32,116,104,101,32,108,111,97,100,101,114,32,
+    97,110,100,32,116,104,101,32,102,105,108,101,32,115,117,102,
+    102,105,120,101,115,32,116,104,101,32,108,111,97,100,101,114,
+    10,32,32,32,32,32,32,32,32,114,101,99,111,103,110,105,
+    122,101,115,46,99,1,0,0,0,0,0,0,0,0,0,0,
+    0,2,0,0,0,3,0,0,0,51,0,0,0,115,24,0,
+    0,0,129,0,124,0,93,7,125,1,124,1,136,0,102,2,
+    86,0,1,0,113,2,100,0,83,0,114,69,0,0,0,114,
+    7,0,0,0,114,43,1,0,0,169,1,114,164,0,0,0,
+    114,7,0,0,0,114,8,0,0,0,114,9,0,0,0,220,
+    5,0,0,115,4,0,0,0,2,128,22,0,122,38,70,105,
+    108,101,70,105,110,100,101,114,46,95,95,105,110,105,116,95,
+    95,46,60,108,111,99,97,108,115,62,46,60,103,101,110,101,
+    120,112,114,62,114,97,0,0,0,114,130,0,0,0,78,41,
+    11,114,191,0,0,0,218,8,95,108,111,97,100,101,114,115,
+    114,65,0,0,0,114,86,0,0,0,114,67,0,0,0,114,
+    18,0,0,0,114,82,0,0,0,218,11,95,112,97,116,104,
+    95,109,116,105,109,101,218,3,115,101,116,218,11,95,112,97,
+    116,104,95,99,97,99,104,101,218,19,95,114,101,108,97,120,
+    101,100,95,112,97,116,104,95,99,97,99,104,101,41,5,114,
+    143,0,0,0,114,65,0,0,0,218,14,108,111,97,100,101,
+    114,95,100,101,116,97,105,108,115,90,7,108,111,97,100,101,
+    114,115,114,212,0,0,0,114,7,0,0,0,114,97,1,0,
+    0,114,8,0,0,0,114,236,0,0,0,214,5,0,0,115,
+    20,0,0,0,4,4,12,1,26,1,6,1,10,2,10,1,
+    18,1,6,1,8,1,12,1,122,19,70,105,108,101,70,105,
+    110,100,101,114,46,95,95,105,110,105,116,95,95,99,1,0,
+    0,0,0,0,0,0,0,0,0,0,1,0,0,0,2,0,
+    0,0,67,0,0,0,115,10,0,0,0,100,1,124,0,95,
+    0,100,2,83,0,41,3,122,31,73,110,118,97,108,105,100,
+    97,116,101,32,116,104,101,32,100,105,114,101,99,116,111,114,
+    121,32,109,116,105,109,101,46,114,130,0,0,0,78,41,1,
+    114,99,1,0,0,114,21,1,0,0,114,7,0,0,0,114,
+    7,0,0,0,114,8,0,0,0,114,80,1,0,0,230,5,
+    0,0,114,81,0,0,0,122,28,70,105,108,101,70,105,110,
+    100,101,114,46,105,110,118,97,108,105,100,97,116,101,95,99,
+    97,99,104,101,115,99,2,0,0,0,0,0,0,0,0,0,
+    0,0,3,0,0,0,4,0,0,0,67,0,0,0,115,54,
+    0,0,0,116,0,160,1,100,1,116,2,161,2,1,0,124,
+    0,160,3,124,1,161,1,125,2,124,2,100,2,117,0,114,
+    19,100,2,103,0,102,2,83,0,124,2,106,4,124,2,106,
+    5,112,25,103,0,102,2,83,0,41,3,122,197,84,114,121,
+    32,116,111,32,102,105,110,100,32,97,32,108,111,97,100,101,
+    114,32,102,111,114,32,116,104,101,32,115,112,101,99,105,102,
+    105,101,100,32,109,111,100,117,108,101,44,32,111,114,32,116,
+    104,101,32,110,97,109,101,115,112,97,99,101,10,32,32,32,
+    32,32,32,32,32,112,97,99,107,97,103,101,32,112,111,114,
+    116,105,111,110,115,46,32,82,101,116,117,114,110,115,32,40,
+    108,111,97,100,101,114,44,32,108,105,115,116,45,111,102,45,
+    112,111,114,116,105,111,110,115,41,46,10,10,32,32,32,32,
+    32,32,32,32,84,104,105,115,32,109,101,116,104,111,100,32,
+    105,115,32,100,101,112,114,101,99,97,116,101,100,46,32,32,
+    85,115,101,32,102,105,110,100,95,115,112,101,99,40,41,32,
+    105,110,115,116,101,97,100,46,10,10,32,32,32,32,32,32,
+    32,32,122,101,70,105,108,101,70,105,110,100,101,114,46,102,
+    105,110,100,95,108,111,97,100,101,114,40,41,32,105,115,32,
+    100,101,112,114,101,99,97,116,101,100,32,97,110,100,32,115,
+    108,97,116,101,100,32,102,111,114,32,114,101,109,111,118,97,
+    108,32,105,110,32,80,121,116,104,111,110,32,51,46,49,50,
+    59,32,117,115,101,32,102,105,110,100,95,115,112,101,99,40,
+    41,32,105,110,115,116,101,97,100,78,41,6,114,99,0,0,
+    0,114,100,0,0,0,114,101,0,0,0,114,226,0,0,0,
+    114,164,0,0,0,114,202,0,0,0,41,3,114,143,0,0,
+    0,114,163,0,0,0,114,210,0,0,0,114,7,0,0,0,
+    114,7,0,0,0,114,8,0,0,0,114,161,0,0,0,236,
+    5,0,0,115,14,0,0,0,6,7,2,2,4,254,10,3,
+    8,1,8,1,16,1,122,22,70,105,108,101,70,105,110,100,
+    101,114,46,102,105,110,100,95,108,111,97,100,101,114,99,6,
+    0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,6,
+    0,0,0,67,0,0,0,115,26,0,0,0,124,1,124,2,
+    124,3,131,2,125,6,116,0,124,2,124,3,124,6,124,4,
+    100,1,141,4,83,0,41,2,78,114,201,0,0,0,41,1,
+    114,213,0,0,0,41,7,114,143,0,0,0,114,211,0,0,
+    0,114,163,0,0,0,114,65,0,0,0,90,4,115,109,115,
+    108,114,225,0,0,0,114,164,0,0,0,114,7,0,0,0,
+    114,7,0,0,0,114,8,0,0,0,114,93,1,0,0,251,
+    5,0,0,115,8,0,0,0,10,1,8,1,2,1,6,255,
+    122,20,70,105,108,101,70,105,110,100,101,114,46,95,103,101,
+    116,95,115,112,101,99,78,99,3,0,0,0,0,0,0,0,
+    0,0,0,0,14,0,0,0,9,0,0,0,67,0,0,0,
+    115,122,1,0,0,100,1,125,3,124,1,160,0,100,2,161,
+    1,100,3,25,0,125,4,122,12,116,1,124,0,106,2,112,
+    17,116,3,160,4,161,0,131,1,106,5,125,5,87,0,110,
+    11,4,0,116,6,121,32,1,0,1,0,1,0,100,4,125,
+    5,89,0,110,1,119,0,124,5,124,0,106,7,107,3,114,
+    45,124,0,160,8,161,0,1,0,124,5,124,0,95,7,116,
+    9,131,0,114,56,124,0,106,10,125,6,124,4,160,11,161,
+    0,125,7,110,5,124,0,106,12,125,6,124,4,125,7,124,
+    7,124,6,118,0,114,108,116,13,124,0,106,2,124,4,131,
+    2,125,8,124,0,106,14,68,0,93,29,92,2,125,9,125,
+    10,100,5,124,9,23,0,125,11,116,13,124,8,124,11,131,
+    2,125,12,116,15,124,12,131,1,114,103,124,0,160,16,124,
+    10,124,1,124,12,124,8,103,1,124,2,161,5,2,0,1,
+    0,83,0,113,74,116,17,124,8,131,1,125,3,124,0,106,
+    14,68,0,93,55,92,2,125,9,125,10,122,10,116,13,124,
+    0,106,2,124,4,124,9,23,0,131,2,125,12,87,0,110,
+    11,4,0,116,18,121,136,1,0,1,0,1,0,89,0,1,
+    0,100,6,83,0,119,0,116,19,106,20,100,7,124,12,100,
+    3,100,8,141,3,1,0,124,7,124,9,23,0,124,6,118,
+    0,114,166,116,15,124,12,131,1,114,166,124,0,160,16,124,
+    10,124,1,124,12,100,6,124,2,161,5,2,0,1,0,83,
+    0,113,111,124,3,114,187,116,19,160,20,100,9,124,8,161,
+    2,1,0,116,19,160,21,124,1,100,6,161,2,125,13,124,
+    8,103,1,124,13,95,22,124,13,83,0,100,6,83,0,41,
+    10,122,111,84,114,121,32,116,111,32,102,105,110,100,32,97,
+    32,115,112,101,99,32,102,111,114,32,116,104,101,32,115,112,
+    101,99,105,102,105,101,100,32,109,111,100,117,108,101,46,10,
+    10,32,32,32,32,32,32,32,32,82,101,116,117,114,110,115,
+    32,116,104,101,32,109,97,116,99,104,105,110,103,32,115,112,
+    101,99,44,32,111,114,32,78,111,110,101,32,105,102,32,110,
+    111,116,32,102,111,117,110,100,46,10,32,32,32,32,32,32,
+    32,32,70,114,97,0,0,0,114,44,0,0,0,114,130,0,
+    0,0,114,236,0,0,0,78,122,9,116,114,121,105,110,103,
+    32,123,125,41,1,90,9,118,101,114,98,111,115,105,116,121,
+    122,25,112,111,115,115,105,98,108,101,32,110,97,109,101,115,
+    112,97,99,101,32,102,111,114,32,123,125,41,23,114,104,0,
+    0,0,114,75,0,0,0,114,65,0,0,0,114,18,0,0,
+    0,114,82,0,0,0,114,35,1,0,0,114,76,0,0,0,
+    114,99,1,0,0,218,11,95,102,105,108,108,95,99,97,99,
+    104,101,114,21,0,0,0,114,102,1,0,0,114,131,0,0,
+    0,114,101,1,0,0,114,67,0,0,0,114,98,1,0,0,
+    114,80,0,0,0,114,93,1,0,0,114,83,0,0,0,114,
+    111,0,0,0,114,159,0,0,0,114,173,0,0,0,114,207,
+    0,0,0,114,202,0,0,0,41,14,114,143,0,0,0,114,
+    163,0,0,0,114,225,0,0,0,90,12,105,115,95,110,97,
+    109,101,115,112,97,99,101,90,11,116,97,105,108,95,109,111,
+    100,117,108,101,114,193,0,0,0,90,5,99,97,99,104,101,
+    90,12,99,97,99,104,101,95,109,111,100,117,108,101,90,9,
+    98,97,115,101,95,112,97,116,104,114,44,1,0,0,114,211,
+    0,0,0,90,13,105,110,105,116,95,102,105,108,101,110,97,
+    109,101,90,9,102,117,108,108,95,112,97,116,104,114,210,0,
+    0,0,114,7,0,0,0,114,7,0,0,0,114,8,0,0,
+    0,114,226,0,0,0,0,6,0,0,115,86,0,0,0,4,
+    5,14,1,2,1,24,1,12,1,8,1,2,255,10,2,8,
+    1,6,1,6,2,6,1,10,1,6,2,4,1,8,2,12,
+    1,14,1,8,1,10,1,8,1,24,1,2,255,8,5,14,
+    2,2,1,20,1,12,1,8,1,2,255,16,2,12,1,8,
+    1,10,1,4,1,8,255,2,128,4,2,12,1,12,1,8,
+    1,4,1,4,1,122,20,70,105,108,101,70,105,110,100,101,
+    114,46,102,105,110,100,95,115,112,101,99,99,1,0,0,0,
+    0,0,0,0,0,0,0,0,9,0,0,0,10,0,0,0,
+    67,0,0,0,115,192,0,0,0,124,0,106,0,125,1,122,
+    11,116,1,160,2,124,1,112,11,116,1,160,3,161,0,161,
+    1,125,2,87,0,110,14,4,0,116,4,116,5,116,6,102,
+    3,121,28,1,0,1,0,1,0,103,0,125,2,89,0,110,
+    1,119,0,116,7,106,8,160,9,100,1,161,1,115,41,116,
+    10,124,2,131,1,124,0,95,11,110,37,116,10,131,0,125,
+    3,124,2,68,0,93,28,125,4,124,4,160,12,100,2,161,
+    1,92,3,125,5,125,6,125,7,124,6,114,67,100,3,160,
+    13,124,5,124,7,160,14,161,0,161,2,125,8,110,2,124,
+    5,125,8,124,3,160,15,124,8,161,1,1,0,113,46,124,
+    3,124,0,95,11,116,7,106,8,160,9,116,16,161,1,114,
+    94,100,4,100,5,132,0,124,2,68,0,131,1,124,0,95,
+    17,100,6,83,0,100,6,83,0,41,7,122,68,70,105,108,
+    108,32,116,104,101,32,99,97,99,104,101,32,111,102,32,112,
+    111,116,101,110,116,105,97,108,32,109,111,100,117,108,101,115,
+    32,97,110,100,32,112,97,99,107,97,103,101,115,32,102,111,
+    114,32,116,104,105,115,32,100,105,114,101,99,116,111,114,121,
+    46,114,14,0,0,0,114,97,0,0,0,114,88,0,0,0,
+    99,1,0,0,0,0,0,0,0,0,0,0,0,2,0,0,
+    0,4,0,0,0,83,0,0,0,115,20,0,0,0,104,0,
+    124,0,93,6,125,1,124,1,160,0,161,0,146,2,113,2,
+    83,0,114,7,0,0,0,41,1,114,131,0,0,0,41,2,
+    114,5,0,0,0,90,2,102,110,114,7,0,0,0,114,7,
+    0,0,0,114,8,0,0,0,114,13,0,0,0,80,6,0,
+    0,115,2,0,0,0,20,0,122,41,70,105,108,101,70,105,
+    110,100,101,114,46,95,102,105,108,108,95,99,97,99,104,101,
+    46,60,108,111,99,97,108,115,62,46,60,115,101,116,99,111,
+    109,112,62,78,41,18,114,65,0,0,0,114,18,0,0,0,
+    90,7,108,105,115,116,100,105,114,114,82,0,0,0,114,87,
+    1,0,0,218,15,80,101,114,109,105,115,115,105,111,110,69,
+    114,114,111,114,218,18,78,111,116,65,68,105,114,101,99,116,
+    111,114,121,69,114,114,111,114,114,15,0,0,0,114,25,0,
+    0,0,114,26,0,0,0,114,100,1,0,0,114,101,1,0,
+    0,114,126,0,0,0,114,89,0,0,0,114,131,0,0,0,
+    218,3,97,100,100,114,27,0,0,0,114,102,1,0,0,41,
+    9,114,143,0,0,0,114,65,0,0,0,90,8,99,111,110,
+    116,101,110,116,115,90,21,108,111,119,101,114,95,115,117,102,
+    102,105,120,95,99,111,110,116,101,110,116,115,114,72,1,0,
+    0,114,141,0,0,0,114,56,1,0,0,114,44,1,0,0,
+    90,8,110,101,119,95,110,97,109,101,114,7,0,0,0,114,
+    7,0,0,0,114,8,0,0,0,114,104,1,0,0,51,6,
+    0,0,115,38,0,0,0,6,2,2,1,22,1,18,1,8,
+    3,2,253,12,6,12,1,6,7,8,1,16,1,4,1,18,
+    1,4,2,12,1,6,1,12,1,20,1,4,255,122,22,70,
+    105,108,101,70,105,110,100,101,114,46,95,102,105,108,108,95,
+    99,97,99,104,101,99,1,0,0,0,0,0,0,0,0,0,
+    0,0,3,0,0,0,3,0,0,0,7,0,0,0,115,18,
+    0,0,0,135,0,135,1,102,2,100,1,100,2,132,8,125,
+    2,124,2,83,0,41,3,97,20,1,0,0,65,32,99,108,
+    97,115,115,32,109,101,116,104,111,100,32,119,104,105,99,104,
+    32,114,101,116,117,114,110,115,32,97,32,99,108,111,115,117,
+    114,101,32,116,111,32,117,115,101,32,111,110,32,115,121,115,
+    46,112,97,116,104,95,104,111,111,107,10,32,32,32,32,32,
+    32,32,32,119,104,105,99,104,32,119,105,108,108,32,114,101,
+    116,117,114,110,32,97,110,32,105,110,115,116,97,110,99,101,
+    32,117,115,105,110,103,32,116,104,101,32,115,112,101,99,105,
+    102,105,101,100,32,108,111,97,100,101,114,115,32,97,110,100,
+    32,116,104,101,32,112,97,116,104,10,32,32,32,32,32,32,
+    32,32,99,97,108,108,101,100,32,111,110,32,116,104,101,32,
+    99,108,111,115,117,114,101,46,10,10,32,32,32,32,32,32,
+    32,32,73,102,32,116,104,101,32,112,97,116,104,32,99,97,
+    108,108,101,100,32,111,110,32,116,104,101,32,99,108,111,115,
+    117,114,101,32,105,115,32,110,111,116,32,97,32,100,105,114,
+    101,99,116,111,114,121,44,32,73,109,112,111,114,116,69,114,
+    114,111,114,32,105,115,10,32,32,32,32,32,32,32,32,114,
+    97,105,115,101,100,46,10,10,32,32,32,32,32,32,32,32,
+    99,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,
+    0,4,0,0,0,19,0,0,0,115,36,0,0,0,116,0,
+    124,0,131,1,115,10,116,1,100,1,124,0,100,2,141,2,
+    130,1,136,0,124,0,103,1,136,1,162,1,82,0,142,0,
+    83,0,41,3,122,45,80,97,116,104,32,104,111,111,107,32,
+    102,111,114,32,105,109,112,111,114,116,108,105,98,46,109,97,
+    99,104,105,110,101,114,121,46,70,105,108,101,70,105,110,100,
+    101,114,46,122,30,111,110,108,121,32,100,105,114,101,99,116,
+    111,114,105,101,115,32,97,114,101,32,115,117,112,112,111,114,
+    116,101,100,114,71,0,0,0,41,2,114,83,0,0,0,114,
+    142,0,0,0,114,71,0,0,0,169,2,114,221,0,0,0,
+    114,103,1,0,0,114,7,0,0,0,114,8,0,0,0,218,
+    24,112,97,116,104,95,104,111,111,107,95,102,111,114,95,70,
+    105,108,101,70,105,110,100,101,114,92,6,0,0,115,6,0,
+    0,0,8,2,12,1,16,1,122,54,70,105,108,101,70,105,
+    110,100,101,114,46,112,97,116,104,95,104,111,111,107,46,60,
+    108,111,99,97,108,115,62,46,112,97,116,104,95,104,111,111,
+    107,95,102,111,114,95,70,105,108,101,70,105,110,100,101,114,
+    114,7,0,0,0,41,3,114,221,0,0,0,114,103,1,0,
+    0,114,109,1,0,0,114,7,0,0,0,114,108,1,0,0,
+    114,8,0,0,0,218,9,112,97,116,104,95,104,111,111,107,
+    82,6,0,0,115,4,0,0,0,14,10,4,6,122,20,70,
     105,108,101,70,105,110,100,101,114,46,112,97,116,104,95,104,
-    111,111,107,46,60,108,111,99,97,108,115,62,46,112,97,116,
-    104,95,104,111,111,107,95,102,111,114,95,70,105,108,101,70,
-    105,110,100,101,114,114,5,0,0,0,41,3,114,193,0,0,
-    0,114,69,1,0,0,114,76,1,0,0,114,5,0,0,0,
-    114,75,1,0,0,114,8,0,0,0,218,9,112,97,116,104,
-    95,104,111,111,107,237,5,0,0,115,4,0,0,0,0,10,
-    14,6,122,20,70,105,108,101,70,105,110,100,101,114,46,112,
-    97,116,104,95,104,111,111,107,99,1,0,0,0,0,0,0,
-    0,0,0,0,0,1,0,0,0,3,0,0,0,67,0,0,
-    0,115,12,0,0,0,100,1,160,0,124,0,106,1,161,1,
-    83,0,41,2,78,122,16,70,105,108,101,70,105,110,100,101,
-    114,40,123,33,114,125,41,41,2,114,62,0,0,0,114,44,
-    0,0,0,114,246,0,0,0,114,5,0,0,0,114,5,0,
-    0,0,114,8,0,0,0,114,39,1,0,0,255,5,0,0,
-    115,2,0,0,0,0,1,122,19,70,105,108,101,70,105,110,
-    100,101,114,46,95,95,114,101,112,114,95,95,41,1,78,41,
-    15,114,125,0,0,0,114,124,0,0,0,114,126,0,0,0,
-    114,127,0,0,0,114,209,0,0,0,114,46,1,0,0,114,
-    143,0,0,0,114,206,0,0,0,114,137,0,0,0,114,58,
-    1,0,0,114,203,0,0,0,114,70,1,0,0,114,207,0,
-    0,0,114,77,1,0,0,114,39,1,0,0,114,5,0,0,
-    0,114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,
-    114,61,1,0,0,112,5,0,0,115,22,0,0,0,8,2,
-    4,7,8,14,8,4,4,2,8,12,8,5,10,48,8,31,
-    2,1,10,17,114,61,1,0,0,99,4,0,0,0,0,0,
-    0,0,0,0,0,0,6,0,0,0,8,0,0,0,67,0,
-    0,0,115,144,0,0,0,124,0,160,0,100,1,161,1,125,
-    4,124,0,160,0,100,2,161,1,125,5,124,4,115,66,124,
-    5,114,36,124,5,106,1,125,4,110,30,124,2,124,3,107,
-    2,114,56,116,2,124,1,124,2,131,2,125,4,110,10,116,
-    3,124,1,124,2,131,2,125,4,124,5,115,84,116,4,124,
-    1,124,2,124,4,100,3,141,3,125,5,122,36,124,5,124,
-    0,100,2,60,0,124,4,124,0,100,1,60,0,124,2,124,
-    0,100,4,60,0,124,3,124,0,100,5,60,0,87,0,110,
-    18,4,0,116,5,121,138,1,0,1,0,1,0,89,0,110,
-    2,48,0,100,0,83,0,41,6,78,218,10,95,95,108,111,
-    97,100,101,114,95,95,218,8,95,95,115,112,101,99,95,95,
-    114,62,1,0,0,90,8,95,95,102,105,108,101,95,95,90,
-    10,95,95,99,97,99,104,101,100,95,95,41,6,218,3,103,
-    101,116,114,140,0,0,0,114,15,1,0,0,114,9,1,0,
-    0,114,190,0,0,0,218,9,69,120,99,101,112,116,105,111,
-    110,41,6,90,2,110,115,114,116,0,0,0,90,8,112,97,
-    116,104,110,97,109,101,90,9,99,112,97,116,104,110,97,109,
-    101,114,140,0,0,0,114,187,0,0,0,114,5,0,0,0,
-    114,5,0,0,0,114,8,0,0,0,218,14,95,102,105,120,
-    95,117,112,95,109,111,100,117,108,101,5,6,0,0,115,34,
-    0,0,0,0,2,10,1,10,1,4,1,4,1,8,1,8,
-    1,12,2,10,1,4,1,14,1,2,1,8,1,8,1,8,
-    1,12,1,12,2,114,82,1,0,0,99,0,0,0,0,0,
-    0,0,0,0,0,0,0,3,0,0,0,3,0,0,0,67,
-    0,0,0,115,38,0,0,0,116,0,116,1,160,2,161,0,
-    102,2,125,0,116,3,116,4,102,2,125,1,116,5,116,6,
-    102,2,125,2,124,0,124,1,124,2,103,3,83,0,41,1,
-    122,95,82,101,116,117,114,110,115,32,97,32,108,105,115,116,
-    32,111,102,32,102,105,108,101,45,98,97,115,101,100,32,109,
-    111,100,117,108,101,32,108,111,97,100,101,114,115,46,10,10,
-    32,32,32,32,69,97,99,104,32,105,116,101,109,32,105,115,
-    32,97,32,116,117,112,108,101,32,40,108,111,97,100,101,114,
-    44,32,115,117,102,102,105,120,101,115,41,46,10,32,32,32,
-    32,41,7,114,252,0,0,0,114,163,0,0,0,218,18,101,
-    120,116,101,110,115,105,111,110,95,115,117,102,102,105,120,101,
-    115,114,9,1,0,0,114,101,0,0,0,114,15,1,0,0,
-    114,88,0,0,0,41,3,90,10,101,120,116,101,110,115,105,
-    111,110,115,90,6,115,111,117,114,99,101,90,8,98,121,116,
-    101,99,111,100,101,114,5,0,0,0,114,5,0,0,0,114,
-    8,0,0,0,114,184,0,0,0,28,6,0,0,115,8,0,
-    0,0,0,5,12,1,8,1,8,1,114,184,0,0,0,99,
-    1,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,
-    9,0,0,0,67,0,0,0,115,132,1,0,0,124,0,97,
-    0,116,0,106,1,97,1,116,0,106,2,97,2,116,1,106,
-    3,116,4,25,0,125,1,100,1,100,2,103,1,102,2,100,
-    3,100,4,100,2,103,2,102,2,102,2,125,2,124,2,68,
-    0,93,108,92,2,125,3,125,4,116,5,100,5,100,6,132,
-    0,124,4,68,0,131,1,131,1,115,82,74,0,130,1,124,
-    4,100,7,25,0,125,5,124,3,116,1,106,3,118,0,114,
-    116,116,1,106,3,124,3,25,0,125,6,1,0,113,170,113,
-    52,122,20,116,0,160,6,124,3,161,1,125,6,87,0,1,
-    0,113,170,87,0,113,52,4,0,116,7,121,158,1,0,1,
-    0,1,0,89,0,113,52,89,0,113,52,48,0,113,52,116,
-    7,100,8,131,1,130,1,116,8,124,1,100,9,124,6,131,
-    3,1,0,116,8,124,1,100,10,124,5,131,3,1,0,116,
-    8,124,1,100,11,100,12,160,9,124,4,161,1,131,3,1,
-    0,116,8,124,1,100,13,100,14,100,15,132,0,124,4,68,
-    0,131,1,131,3,1,0,103,0,100,16,162,1,125,7,124,
-    3,100,3,107,2,144,1,114,6,124,7,160,10,100,17,161,
-    1,1,0,124,7,68,0,93,52,125,8,124,8,116,1,106,
-    3,118,1,144,1,114,38,116,0,160,6,124,8,161,1,125,
-    9,110,10,116,1,106,3,124,8,25,0,125,9,116,8,124,
-    1,124,8,124,9,131,3,1,0,144,1,113,10,116,8,124,
-    1,100,18,116,11,131,0,131,3,1,0,116,12,160,13,116,
-    2,160,14,161,0,161,1,1,0,124,3,100,3,107,2,144,
-    1,114,128,116,15,160,10,100,19,161,1,1,0,100,20,116,
-    12,118,0,144,1,114,128,100,21,116,16,95,17,100,22,83,
-    0,41,23,122,205,83,101,116,117,112,32,116,104,101,32,112,
+    111,111,107,99,1,0,0,0,0,0,0,0,0,0,0,0,
+    1,0,0,0,3,0,0,0,67,0,0,0,114,69,1,0,
+    0,41,2,78,122,16,70,105,108,101,70,105,110,100,101,114,
+    40,123,33,114,125,41,41,2,114,89,0,0,0,114,65,0,
+    0,0,114,21,1,0,0,114,7,0,0,0,114,7,0,0,
+    0,114,8,0,0,0,114,70,1,0,0,100,6,0,0,114,
+    63,1,0,0,122,19,70,105,108,101,70,105,110,100,101,114,
+    46,95,95,114,101,112,114,95,95,114,69,0,0,0,41,15,
+    114,150,0,0,0,114,149,0,0,0,114,151,0,0,0,114,
+    152,0,0,0,114,236,0,0,0,114,80,1,0,0,114,167,
+    0,0,0,114,229,0,0,0,114,161,0,0,0,114,93,1,
+    0,0,114,226,0,0,0,114,104,1,0,0,114,234,0,0,
+    0,114,110,1,0,0,114,70,1,0,0,114,7,0,0,0,
+    114,7,0,0,0,114,7,0,0,0,114,8,0,0,0,114,
+    96,1,0,0,205,5,0,0,115,24,0,0,0,8,0,4,
+    2,8,7,8,16,4,4,8,2,8,15,10,5,8,51,2,
+    31,10,1,12,17,114,96,1,0,0,99,4,0,0,0,0,
+    0,0,0,0,0,0,0,6,0,0,0,8,0,0,0,67,
+    0,0,0,115,144,0,0,0,124,0,160,0,100,1,161,1,
+    125,4,124,0,160,0,100,2,161,1,125,5,124,4,115,33,
+    124,5,114,18,124,5,106,1,125,4,110,15,124,2,124,3,
+    107,2,114,28,116,2,124,1,124,2,131,2,125,4,110,5,
+    116,3,124,1,124,2,131,2,125,4,124,5,115,42,116,4,
+    124,1,124,2,124,4,100,3,141,3,125,5,122,19,124,5,
+    124,0,100,2,60,0,124,4,124,0,100,1,60,0,124,2,
+    124,0,100,4,60,0,124,3,124,0,100,5,60,0,87,0,
+    100,0,83,0,4,0,116,5,121,71,1,0,1,0,1,0,
+    89,0,100,0,83,0,119,0,41,6,78,218,10,95,95,108,
+    111,97,100,101,114,95,95,218,8,95,95,115,112,101,99,95,
+    95,114,97,1,0,0,90,8,95,95,102,105,108,101,95,95,
+    90,10,95,95,99,97,99,104,101,100,95,95,41,6,218,3,
+    103,101,116,114,164,0,0,0,114,41,1,0,0,114,34,1,
+    0,0,114,213,0,0,0,218,9,69,120,99,101,112,116,105,
+    111,110,41,6,90,2,110,115,114,141,0,0,0,90,8,112,
+    97,116,104,110,97,109,101,90,9,99,112,97,116,104,110,97,
+    109,101,114,164,0,0,0,114,210,0,0,0,114,7,0,0,
+    0,114,7,0,0,0,114,8,0,0,0,218,14,95,102,105,
+    120,95,117,112,95,109,111,100,117,108,101,106,6,0,0,115,
+    36,0,0,0,10,2,10,1,4,1,4,1,8,1,8,1,
+    12,1,10,2,4,1,14,1,2,1,8,1,8,1,8,1,
+    14,1,12,1,6,2,2,254,114,115,1,0,0,99,0,0,
+    0,0,0,0,0,0,0,0,0,0,3,0,0,0,3,0,
+    0,0,67,0,0,0,115,38,0,0,0,116,0,116,1,160,
+    2,161,0,102,2,125,0,116,3,116,4,102,2,125,1,116,
+    5,116,6,102,2,125,2,124,0,124,1,124,2,103,3,83,
+    0,41,1,122,95,82,101,116,117,114,110,115,32,97,32,108,
+    105,115,116,32,111,102,32,102,105,108,101,45,98,97,115,101,
+    100,32,109,111,100,117,108,101,32,108,111,97,100,101,114,115,
+    46,10,10,32,32,32,32,69,97,99,104,32,105,116,101,109,
+    32,105,115,32,97,32,116,117,112,108,101,32,40,108,111,97,
+    100,101,114,44,32,115,117,102,102,105,120,101,115,41,46,10,
+    32,32,32,32,41,7,114,30,1,0,0,114,187,0,0,0,
+    218,18,101,120,116,101,110,115,105,111,110,95,115,117,102,102,
+    105,120,101,115,114,34,1,0,0,114,127,0,0,0,114,41,
+    1,0,0,114,113,0,0,0,41,3,90,10,101,120,116,101,
+    110,115,105,111,110,115,90,6,115,111,117,114,99,101,90,8,
+    98,121,116,101,99,111,100,101,114,7,0,0,0,114,7,0,
+    0,0,114,8,0,0,0,114,208,0,0,0,129,6,0,0,
+    115,8,0,0,0,12,5,8,1,8,1,10,1,114,208,0,
+    0,0,99,1,0,0,0,0,0,0,0,0,0,0,0,1,
+    0,0,0,1,0,0,0,67,0,0,0,115,8,0,0,0,
+    124,0,97,0,100,0,83,0,114,69,0,0,0,41,1,114,
+    159,0,0,0,41,1,218,17,95,98,111,111,116,115,116,114,
+    97,112,95,109,111,100,117,108,101,114,7,0,0,0,114,7,
+    0,0,0,114,8,0,0,0,218,21,95,115,101,116,95,98,
+    111,111,116,115,116,114,97,112,95,109,111,100,117,108,101,140,
+    6,0,0,115,2,0,0,0,8,2,114,118,1,0,0,99,
+    1,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,
+    4,0,0,0,67,0,0,0,115,50,0,0,0,116,0,124,
+    0,131,1,1,0,116,1,131,0,125,1,116,2,106,3,160,
+    4,116,5,106,6,124,1,142,0,103,1,161,1,1,0,116,
+    2,106,7,160,8,116,9,161,1,1,0,100,1,83,0,41,
+    2,122,41,73,110,115,116,97,108,108,32,116,104,101,32,112,
     97,116,104,45,98,97,115,101,100,32,105,109,112,111,114,116,
-    101,114,115,32,102,111,114,32,105,109,112,111,114,116,108,105,
-    98,32,98,121,32,105,109,112,111,114,116,105,110,103,32,110,
-    101,101,100,101,100,10,32,32,32,32,98,117,105,108,116,45,
-    105,110,32,109,111,100,117,108,101,115,32,97,110,100,32,105,
-    110,106,101,99,116,105,110,103,32,116,104,101,109,32,105,110,
-    116,111,32,116,104,101,32,103,108,111,98,97,108,32,110,97,
-    109,101,115,112,97,99,101,46,10,10,32,32,32,32,79,116,
-    104,101,114,32,99,111,109,112,111,110,101,110,116,115,32,97,
-    114,101,32,101,120,116,114,97,99,116,101,100,32,102,114,111,
-    109,32,116,104,101,32,99,111,114,101,32,98,111,111,116,115,
-    116,114,97,112,32,109,111,100,117,108,101,46,10,10,32,32,
-    32,32,90,5,112,111,115,105,120,250,1,47,90,2,110,116,
-    250,1,92,99,1,0,0,0,0,0,0,0,0,0,0,0,
-    2,0,0,0,3,0,0,0,115,0,0,0,115,26,0,0,
-    0,124,0,93,18,125,1,116,0,124,1,131,1,100,0,107,
-    2,86,0,1,0,113,2,100,1,83,0,41,2,114,39,0,
-    0,0,78,41,1,114,23,0,0,0,41,2,114,32,0,0,
-    0,114,94,0,0,0,114,5,0,0,0,114,5,0,0,0,
-    114,8,0,0,0,114,19,1,0,0,57,6,0,0,114,63,
-    1,0,0,122,25,95,115,101,116,117,112,46,60,108,111,99,
-    97,108,115,62,46,60,103,101,110,101,120,112,114,62,114,73,
-    0,0,0,122,30,105,109,112,111,114,116,108,105,98,32,114,
-    101,113,117,105,114,101,115,32,112,111,115,105,120,32,111,114,
-    32,110,116,114,4,0,0,0,114,35,0,0,0,114,31,0,
-    0,0,114,40,0,0,0,114,58,0,0,0,99,1,0,0,
-    0,0,0,0,0,0,0,0,0,2,0,0,0,4,0,0,
-    0,83,0,0,0,115,22,0,0,0,104,0,124,0,93,14,
-    125,1,100,0,124,1,155,0,157,2,146,2,113,4,83,0,
-    41,1,114,74,0,0,0,114,5,0,0,0,41,2,114,32,
-    0,0,0,218,1,115,114,5,0,0,0,114,5,0,0,0,
-    114,8,0,0,0,114,71,1,0,0,74,6,0,0,114,63,
-    1,0,0,122,25,95,115,101,116,117,112,46,60,108,111,99,
-    97,108,115,62,46,60,115,101,116,99,111,109,112,62,41,3,
-    114,64,0,0,0,114,75,0,0,0,114,160,0,0,0,114,
-    192,0,0,0,114,9,0,0,0,122,4,46,112,121,119,122,
-    6,95,100,46,112,121,100,84,78,41,18,114,134,0,0,0,
-    114,1,0,0,0,114,163,0,0,0,114,31,1,0,0,114,
-    125,0,0,0,218,3,97,108,108,90,18,95,98,117,105,108,
-    116,105,110,95,102,114,111,109,95,110,97,109,101,114,117,0,
-    0,0,114,129,0,0,0,114,36,0,0,0,114,186,0,0,
-    0,114,14,0,0,0,114,21,1,0,0,114,167,0,0,0,
-    114,83,1,0,0,114,101,0,0,0,114,191,0,0,0,114,
-    195,0,0,0,41,10,218,17,95,98,111,111,116,115,116,114,
-    97,112,95,109,111,100,117,108,101,90,11,115,101,108,102,95,
-    109,111,100,117,108,101,90,10,111,115,95,100,101,116,97,105,
-    108,115,90,10,98,117,105,108,116,105,110,95,111,115,114,31,
-    0,0,0,114,35,0,0,0,90,9,111,115,95,109,111,100,
-    117,108,101,90,13,98,117,105,108,116,105,110,95,110,97,109,
-    101,115,90,12,98,117,105,108,116,105,110,95,110,97,109,101,
-    90,14,98,117,105,108,116,105,110,95,109,111,100,117,108,101,
-    114,5,0,0,0,114,5,0,0,0,114,8,0,0,0,218,
-    6,95,115,101,116,117,112,39,6,0,0,115,70,0,0,0,
-    0,8,4,1,6,1,6,2,10,3,22,1,12,2,22,1,
-    8,1,10,1,10,1,6,2,2,1,10,1,10,1,12,1,
-    12,2,8,2,12,1,12,1,18,1,22,3,8,1,10,1,
-    10,1,8,1,12,1,12,2,10,1,16,3,14,1,14,1,
-    10,1,10,1,10,1,114,89,1,0,0,99,1,0,0,0,
-    0,0,0,0,0,0,0,0,2,0,0,0,4,0,0,0,
-    67,0,0,0,115,50,0,0,0,116,0,124,0,131,1,1,
-    0,116,1,131,0,125,1,116,2,106,3,160,4,116,5,106,
-    6,124,1,142,0,103,1,161,1,1,0,116,2,106,7,160,
-    8,116,9,161,1,1,0,100,1,83,0,41,2,122,41,73,
-    110,115,116,97,108,108,32,116,104,101,32,112,97,116,104,45,
-    98,97,115,101,100,32,105,109,112,111,114,116,32,99,111,109,
-    112,111,110,101,110,116,115,46,78,41,10,114,89,1,0,0,
-    114,184,0,0,0,114,1,0,0,0,114,51,1,0,0,114,
-    167,0,0,0,114,61,1,0,0,114,77,1,0,0,218,9,
-    109,101,116,97,95,112,97,116,104,114,186,0,0,0,114,45,
-    1,0,0,41,2,114,88,1,0,0,90,17,115,117,112,112,
-    111,114,116,101,100,95,108,111,97,100,101,114,115,114,5,0,
-    0,0,114,5,0,0,0,114,8,0,0,0,218,8,95,105,
-    110,115,116,97,108,108,96,6,0,0,115,8,0,0,0,0,
-    2,8,1,6,1,20,1,114,91,1,0,0,41,1,114,60,
-    0,0,0,41,1,78,41,3,78,78,78,41,2,114,73,0,
-    0,0,114,73,0,0,0,41,1,84,41,1,78,41,1,78,
-    41,63,114,127,0,0,0,114,13,0,0,0,90,37,95,67,
-    65,83,69,95,73,78,83,69,78,83,73,84,73,86,69,95,
-    80,76,65,84,70,79,82,77,83,95,66,89,84,69,83,95,
-    75,69,89,114,12,0,0,0,114,14,0,0,0,114,21,0,
-    0,0,114,27,0,0,0,114,29,0,0,0,114,38,0,0,
-    0,114,47,0,0,0,114,49,0,0,0,114,53,0,0,0,
-    114,54,0,0,0,114,56,0,0,0,114,59,0,0,0,114,
-    69,0,0,0,218,4,116,121,112,101,218,8,95,95,99,111,
-    100,101,95,95,114,162,0,0,0,114,19,0,0,0,114,148,
-    0,0,0,114,18,0,0,0,114,24,0,0,0,114,236,0,
-    0,0,114,91,0,0,0,114,87,0,0,0,114,101,0,0,
-    0,114,88,0,0,0,90,23,68,69,66,85,71,95,66,89,
-    84,69,67,79,68,69,95,83,85,70,70,73,88,69,83,90,
-    27,79,80,84,73,77,73,90,69,68,95,66,89,84,69,67,
-    79,68,69,95,83,85,70,70,73,88,69,83,114,97,0,0,
-    0,114,102,0,0,0,114,108,0,0,0,114,112,0,0,0,
-    114,114,0,0,0,114,136,0,0,0,114,143,0,0,0,114,
-    152,0,0,0,114,156,0,0,0,114,158,0,0,0,114,165,
-    0,0,0,114,170,0,0,0,114,171,0,0,0,114,176,0,
-    0,0,218,6,111,98,106,101,99,116,114,185,0,0,0,114,
-    190,0,0,0,114,191,0,0,0,114,208,0,0,0,114,221,
-    0,0,0,114,239,0,0,0,114,9,1,0,0,114,15,1,
-    0,0,114,21,1,0,0,114,252,0,0,0,114,22,1,0,
-    0,114,43,1,0,0,114,45,1,0,0,114,61,1,0,0,
-    114,82,1,0,0,114,184,0,0,0,114,89,1,0,0,114,
-    91,1,0,0,114,5,0,0,0,114,5,0,0,0,114,5,
+    32,99,111,109,112,111,110,101,110,116,115,46,78,41,10,114,
+    118,1,0,0,114,208,0,0,0,114,15,0,0,0,114,85,
+    1,0,0,114,191,0,0,0,114,96,1,0,0,114,110,1,
+    0,0,218,9,109,101,116,97,95,112,97,116,104,114,61,0,
+    0,0,114,79,1,0,0,41,2,114,117,1,0,0,90,17,
+    115,117,112,112,111,114,116,101,100,95,108,111,97,100,101,114,
+    115,114,7,0,0,0,114,7,0,0,0,114,8,0,0,0,
+    218,8,95,105,110,115,116,97,108,108,145,6,0,0,115,8,
+    0,0,0,8,2,6,1,20,1,16,1,114,120,1,0,0,
+    41,1,114,87,0,0,0,114,69,0,0,0,41,3,78,78,
+    78,41,2,114,0,0,0,0,114,0,0,0,0,41,1,84,
+    41,85,114,152,0,0,0,114,159,0,0,0,114,187,0,0,
+    0,114,91,0,0,0,114,15,0,0,0,114,99,0,0,0,
+    114,184,0,0,0,114,25,0,0,0,114,231,0,0,0,90,
+    2,110,116,114,18,0,0,0,114,215,0,0,0,90,5,112,
+    111,115,105,120,114,50,0,0,0,218,3,97,108,108,114,59,
+    0,0,0,114,136,0,0,0,114,57,0,0,0,114,62,0,
+    0,0,90,20,95,112,97,116,104,115,101,112,115,95,119,105,
+    116,104,95,99,111,108,111,110,114,28,0,0,0,90,37,95,
+    67,65,83,69,95,73,78,83,69,78,83,73,84,73,86,69,
+    95,80,76,65,84,70,79,82,77,83,95,66,89,84,69,83,
+    95,75,69,89,114,27,0,0,0,114,29,0,0,0,114,21,
+    0,0,0,114,36,0,0,0,114,42,0,0,0,114,45,0,
+    0,0,114,67,0,0,0,114,74,0,0,0,114,75,0,0,
+    0,114,79,0,0,0,114,80,0,0,0,114,83,0,0,0,
+    114,86,0,0,0,114,95,0,0,0,218,4,116,121,112,101,
+    218,8,95,95,99,111,100,101,95,95,114,186,0,0,0,114,
+    34,0,0,0,114,172,0,0,0,114,33,0,0,0,114,39,
+    0,0,0,114,8,1,0,0,114,116,0,0,0,114,112,0,
+    0,0,114,127,0,0,0,114,61,0,0,0,114,116,1,0,
+    0,114,232,0,0,0,114,113,0,0,0,90,23,68,69,66,
+    85,71,95,66,89,84,69,67,79,68,69,95,83,85,70,70,
+    73,88,69,83,90,27,79,80,84,73,77,73,90,69,68,95,
+    66,89,84,69,67,79,68,69,95,83,85,70,70,73,88,69,
+    83,114,121,0,0,0,114,128,0,0,0,114,135,0,0,0,
+    114,137,0,0,0,114,139,0,0,0,114,160,0,0,0,114,
+    167,0,0,0,114,176,0,0,0,114,180,0,0,0,114,182,
+    0,0,0,114,189,0,0,0,114,194,0,0,0,114,195,0,
+    0,0,114,200,0,0,0,218,6,111,98,106,101,99,116,114,
+    209,0,0,0,114,213,0,0,0,114,214,0,0,0,114,235,
+    0,0,0,114,249,0,0,0,114,11,1,0,0,114,34,1,
+    0,0,114,41,1,0,0,114,30,1,0,0,114,47,1,0,
+    0,114,75,1,0,0,114,79,1,0,0,114,96,1,0,0,
+    114,115,1,0,0,114,208,0,0,0,114,118,1,0,0,114,
+    120,1,0,0,114,7,0,0,0,114,7,0,0,0,114,7,
     0,0,0,114,8,0,0,0,218,8,60,109,111,100,117,108,
-    101,62,1,0,0,0,115,126,0,0,0,4,22,4,1,4,
-    1,2,1,2,255,4,4,8,17,8,5,8,5,8,6,8,
-    6,8,12,8,10,8,9,8,5,8,7,8,9,10,22,10,
-    127,0,20,16,1,12,2,4,1,4,2,6,2,6,2,8,
-    2,16,71,8,40,8,19,8,12,8,12,8,28,8,17,8,
-    33,8,28,8,24,10,13,10,10,10,11,8,14,6,3,4,
-    1,2,255,12,68,14,64,14,29,16,127,0,17,14,72,18,
-    45,18,26,4,3,18,53,14,63,14,42,14,127,0,20,14,
-    127,0,22,10,23,8,11,8,57,
+    101,62,1,0,0,0,115,180,0,0,0,4,0,4,22,8,
+    3,8,1,8,1,8,1,8,1,10,3,4,1,8,1,10,
+    1,8,2,4,3,10,1,6,2,22,2,8,1,8,1,10,
+    1,14,1,4,4,4,1,2,1,2,1,4,255,8,4,6,
+    16,8,3,8,5,8,5,4,6,10,1,8,30,8,6,8,
+    8,8,10,8,9,8,5,4,7,10,1,8,8,10,5,10,
+    22,0,127,16,30,12,1,4,2,4,1,6,2,4,1,10,
+    1,8,2,6,2,8,2,16,2,8,71,8,40,8,19,8,
+    12,8,12,8,31,8,20,8,33,8,28,10,24,10,13,10,
+    10,8,11,6,14,4,3,2,1,12,255,14,73,14,67,16,
+    30,0,127,14,17,18,50,18,45,18,25,14,53,14,69,14,
+    49,0,127,14,32,0,127,10,30,8,23,8,11,12,5,
 };
diff --git a/Python/importlib_zipimport.h b/Python/importlib_zipimport.h
index 373b136..3c47684 100644
--- a/Python/importlib_zipimport.h
+++ b/Python/importlib_zipimport.h
@@ -1,257 +1,318 @@
 /* Auto-generated by Programs/_freeze_importlib.c */
 const unsigned char _Py_M__zipimport[] = {
     99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,4,0,0,0,64,0,0,0,115,82,1,0,0,100,0,
+    0,4,0,0,0,64,0,0,0,115,80,1,0,0,100,0,
     90,0,100,1,100,2,108,1,90,2,100,1,100,3,108,1,
     109,3,90,3,109,4,90,4,1,0,100,1,100,2,108,5,
     90,6,100,1,100,2,108,7,90,7,100,1,100,2,108,8,
     90,8,100,1,100,2,108,9,90,9,100,1,100,2,108,10,
-    90,10,100,1,100,2,108,11,90,11,100,4,100,5,103,2,
-    90,12,101,2,106,13,90,13,101,2,106,14,100,6,100,2,
-    133,2,25,0,90,15,71,0,100,7,100,4,132,0,100,4,
-    101,16,131,3,90,17,105,0,90,18,101,19,101,10,131,1,
-    90,20,100,8,90,21,100,9,90,22,100,10,90,23,71,0,
-    100,11,100,5,132,0,100,5,131,2,90,24,101,13,100,12,
-    23,0,100,13,100,13,102,3,101,13,100,14,23,0,100,15,
-    100,13,102,3,100,16,100,17,102,4,90,25,100,18,100,19,
-    132,0,90,26,100,20,100,21,132,0,90,27,100,22,100,23,
-    132,0,90,28,100,24,100,25,132,0,90,29,100,26,90,30,
-    100,15,97,31,100,27,100,28,132,0,90,32,100,29,100,30,
-    132,0,90,33,100,31,100,32,132,0,90,34,100,33,100,34,
-    132,0,90,35,101,19,101,35,106,36,131,1,90,37,100,35,
-    100,36,132,0,90,38,100,37,100,38,132,0,90,39,100,39,
-    100,40,132,0,90,40,100,41,100,42,132,0,90,41,100,43,
-    100,44,132,0,90,42,100,45,100,46,132,0,90,43,71,0,
-    100,47,100,48,132,0,100,48,131,2,90,44,100,2,83,0,
-    41,49,97,80,2,0,0,122,105,112,105,109,112,111,114,116,
-    32,112,114,111,118,105,100,101,115,32,115,117,112,112,111,114,
-    116,32,102,111,114,32,105,109,112,111,114,116,105,110,103,32,
-    80,121,116,104,111,110,32,109,111,100,117,108,101,115,32,102,
-    114,111,109,32,90,105,112,32,97,114,99,104,105,118,101,115,
-    46,10,10,84,104,105,115,32,109,111,100,117,108,101,32,101,
-    120,112,111,114,116,115,32,116,104,114,101,101,32,111,98,106,
-    101,99,116,115,58,10,45,32,122,105,112,105,109,112,111,114,
-    116,101,114,58,32,97,32,99,108,97,115,115,59,32,105,116,
-    115,32,99,111,110,115,116,114,117,99,116,111,114,32,116,97,
-    107,101,115,32,97,32,112,97,116,104,32,116,111,32,97,32,
-    90,105,112,32,97,114,99,104,105,118,101,46,10,45,32,90,
-    105,112,73,109,112,111,114,116,69,114,114,111,114,58,32,101,
-    120,99,101,112,116,105,111,110,32,114,97,105,115,101,100,32,
-    98,121,32,122,105,112,105,109,112,111,114,116,101,114,32,111,
-    98,106,101,99,116,115,46,32,73,116,39,115,32,97,10,32,
-    32,115,117,98,99,108,97,115,115,32,111,102,32,73,109,112,
-    111,114,116,69,114,114,111,114,44,32,115,111,32,105,116,32,
-    99,97,110,32,98,101,32,99,97,117,103,104,116,32,97,115,
-    32,73,109,112,111,114,116,69,114,114,111,114,44,32,116,111,
-    111,46,10,45,32,95,122,105,112,95,100,105,114,101,99,116,
-    111,114,121,95,99,97,99,104,101,58,32,97,32,100,105,99,
-    116,44,32,109,97,112,112,105,110,103,32,97,114,99,104,105,
-    118,101,32,112,97,116,104,115,32,116,111,32,122,105,112,32,
-    100,105,114,101,99,116,111,114,121,10,32,32,105,110,102,111,
-    32,100,105,99,116,115,44,32,97,115,32,117,115,101,100,32,
-    105,110,32,122,105,112,105,109,112,111,114,116,101,114,46,95,
-    102,105,108,101,115,46,10,10,73,116,32,105,115,32,117,115,
-    117,97,108,108,121,32,110,111,116,32,110,101,101,100,101,100,
-    32,116,111,32,117,115,101,32,116,104,101,32,122,105,112,105,
-    109,112,111,114,116,32,109,111,100,117,108,101,32,101,120,112,
-    108,105,99,105,116,108,121,59,32,105,116,32,105,115,10,117,
-    115,101,100,32,98,121,32,116,104,101,32,98,117,105,108,116,
-    105,110,32,105,109,112,111,114,116,32,109,101,99,104,97,110,
-    105,115,109,32,102,111,114,32,115,121,115,46,112,97,116,104,
-    32,105,116,101,109,115,32,116,104,97,116,32,97,114,101,32,
-    112,97,116,104,115,10,116,111,32,90,105,112,32,97,114,99,
-    104,105,118,101,115,46,10,233,0,0,0,0,78,41,2,218,
-    14,95,117,110,112,97,99,107,95,117,105,110,116,49,54,218,
-    14,95,117,110,112,97,99,107,95,117,105,110,116,51,50,218,
-    14,90,105,112,73,109,112,111,114,116,69,114,114,111,114,218,
-    11,122,105,112,105,109,112,111,114,116,101,114,233,1,0,0,
-    0,99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,0,1,0,0,0,64,0,0,0,115,12,0,0,0,101,
-    0,90,1,100,0,90,2,100,1,83,0,41,2,114,3,0,
-    0,0,78,41,3,218,8,95,95,110,97,109,101,95,95,218,
-    10,95,95,109,111,100,117,108,101,95,95,218,12,95,95,113,
-    117,97,108,110,97,109,101,95,95,169,0,114,9,0,0,0,
-    114,9,0,0,0,250,18,60,102,114,111,122,101,110,32,122,
-    105,112,105,109,112,111,114,116,62,114,3,0,0,0,33,0,
-    0,0,115,2,0,0,0,8,1,233,22,0,0,0,115,4,
+    90,10,100,1,100,2,108,11,90,11,100,1,100,2,108,12,
+    90,12,100,4,100,5,103,2,90,13,101,2,106,14,90,14,
+    101,2,106,15,100,6,100,2,133,2,25,0,90,16,71,0,
+    100,7,100,4,132,0,100,4,101,17,131,3,90,18,105,0,
+    90,19,101,20,101,10,131,1,90,21,100,8,90,22,100,9,
+    90,23,100,10,90,24,71,0,100,11,100,5,132,0,100,5,
+    101,2,106,25,131,3,90,26,101,14,100,12,23,0,100,13,
+    100,13,102,3,101,14,100,14,23,0,100,15,100,13,102,3,
+    100,16,100,17,102,4,90,27,100,18,100,19,132,0,90,28,
+    100,20,100,21,132,0,90,29,100,22,100,23,132,0,90,30,
+    100,24,100,25,132,0,90,31,100,26,90,32,100,15,97,33,
+    100,27,100,28,132,0,90,34,100,29,100,30,132,0,90,35,
+    100,31,100,32,132,0,90,36,100,33,100,34,132,0,90,37,
+    101,20,101,37,106,38,131,1,90,39,100,35,100,36,132,0,
+    90,40,100,37,100,38,132,0,90,41,100,39,100,40,132,0,
+    90,42,100,41,100,42,132,0,90,43,100,43,100,44,132,0,
+    90,44,100,45,100,46,132,0,90,45,100,2,83,0,41,47,
+    97,80,2,0,0,122,105,112,105,109,112,111,114,116,32,112,
+    114,111,118,105,100,101,115,32,115,117,112,112,111,114,116,32,
+    102,111,114,32,105,109,112,111,114,116,105,110,103,32,80,121,
+    116,104,111,110,32,109,111,100,117,108,101,115,32,102,114,111,
+    109,32,90,105,112,32,97,114,99,104,105,118,101,115,46,10,
+    10,84,104,105,115,32,109,111,100,117,108,101,32,101,120,112,
+    111,114,116,115,32,116,104,114,101,101,32,111,98,106,101,99,
+    116,115,58,10,45,32,122,105,112,105,109,112,111,114,116,101,
+    114,58,32,97,32,99,108,97,115,115,59,32,105,116,115,32,
+    99,111,110,115,116,114,117,99,116,111,114,32,116,97,107,101,
+    115,32,97,32,112,97,116,104,32,116,111,32,97,32,90,105,
+    112,32,97,114,99,104,105,118,101,46,10,45,32,90,105,112,
+    73,109,112,111,114,116,69,114,114,111,114,58,32,101,120,99,
+    101,112,116,105,111,110,32,114,97,105,115,101,100,32,98,121,
+    32,122,105,112,105,109,112,111,114,116,101,114,32,111,98,106,
+    101,99,116,115,46,32,73,116,39,115,32,97,10,32,32,115,
+    117,98,99,108,97,115,115,32,111,102,32,73,109,112,111,114,
+    116,69,114,114,111,114,44,32,115,111,32,105,116,32,99,97,
+    110,32,98,101,32,99,97,117,103,104,116,32,97,115,32,73,
+    109,112,111,114,116,69,114,114,111,114,44,32,116,111,111,46,
+    10,45,32,95,122,105,112,95,100,105,114,101,99,116,111,114,
+    121,95,99,97,99,104,101,58,32,97,32,100,105,99,116,44,
+    32,109,97,112,112,105,110,103,32,97,114,99,104,105,118,101,
+    32,112,97,116,104,115,32,116,111,32,122,105,112,32,100,105,
+    114,101,99,116,111,114,121,10,32,32,105,110,102,111,32,100,
+    105,99,116,115,44,32,97,115,32,117,115,101,100,32,105,110,
+    32,122,105,112,105,109,112,111,114,116,101,114,46,95,102,105,
+    108,101,115,46,10,10,73,116,32,105,115,32,117,115,117,97,
+    108,108,121,32,110,111,116,32,110,101,101,100,101,100,32,116,
+    111,32,117,115,101,32,116,104,101,32,122,105,112,105,109,112,
+    111,114,116,32,109,111,100,117,108,101,32,101,120,112,108,105,
+    99,105,116,108,121,59,32,105,116,32,105,115,10,117,115,101,
+    100,32,98,121,32,116,104,101,32,98,117,105,108,116,105,110,
+    32,105,109,112,111,114,116,32,109,101,99,104,97,110,105,115,
+    109,32,102,111,114,32,115,121,115,46,112,97,116,104,32,105,
+    116,101,109,115,32,116,104,97,116,32,97,114,101,32,112,97,
+    116,104,115,10,116,111,32,90,105,112,32,97,114,99,104,105,
+    118,101,115,46,10,233,0,0,0,0,78,41,2,218,14,95,
+    117,110,112,97,99,107,95,117,105,110,116,49,54,218,14,95,
+    117,110,112,97,99,107,95,117,105,110,116,51,50,218,14,90,
+    105,112,73,109,112,111,114,116,69,114,114,111,114,218,11,122,
+    105,112,105,109,112,111,114,116,101,114,233,1,0,0,0,99,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    1,0,0,0,64,0,0,0,115,12,0,0,0,101,0,90,
+    1,100,0,90,2,100,1,83,0,41,2,114,3,0,0,0,
+    78,41,3,218,8,95,95,110,97,109,101,95,95,218,10,95,
+    95,109,111,100,117,108,101,95,95,218,12,95,95,113,117,97,
+    108,110,97,109,101,95,95,169,0,114,9,0,0,0,114,9,
+    0,0,0,250,18,60,102,114,111,122,101,110,32,122,105,112,
+    105,109,112,111,114,116,62,114,3,0,0,0,34,0,0,0,
+    115,4,0,0,0,8,0,4,1,233,22,0,0,0,115,4,
     0,0,0,80,75,5,6,105,255,255,0,0,99,0,0,0,
     0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,
-    0,64,0,0,0,115,108,0,0,0,101,0,90,1,100,0,
-    90,2,100,1,90,3,100,2,100,3,132,0,90,4,100,25,
-    100,5,100,6,132,1,90,5,100,26,100,7,100,8,132,1,
-    90,6,100,9,100,10,132,0,90,7,100,11,100,12,132,0,
-    90,8,100,13,100,14,132,0,90,9,100,15,100,16,132,0,
-    90,10,100,17,100,18,132,0,90,11,100,19,100,20,132,0,
-    90,12,100,21,100,22,132,0,90,13,100,23,100,24,132,0,
-    90,14,100,4,83,0,41,27,114,4,0,0,0,97,255,1,
-    0,0,122,105,112,105,109,112,111,114,116,101,114,40,97,114,
-    99,104,105,118,101,112,97,116,104,41,32,45,62,32,122,105,
-    112,105,109,112,111,114,116,101,114,32,111,98,106,101,99,116,
-    10,10,32,32,32,32,67,114,101,97,116,101,32,97,32,110,
-    101,119,32,122,105,112,105,109,112,111,114,116,101,114,32,105,
-    110,115,116,97,110,99,101,46,32,39,97,114,99,104,105,118,
-    101,112,97,116,104,39,32,109,117,115,116,32,98,101,32,97,
-    32,112,97,116,104,32,116,111,10,32,32,32,32,97,32,122,
-    105,112,102,105,108,101,44,32,111,114,32,116,111,32,97,32,
-    115,112,101,99,105,102,105,99,32,112,97,116,104,32,105,110,
-    115,105,100,101,32,97,32,122,105,112,102,105,108,101,46,32,
-    70,111,114,32,101,120,97,109,112,108,101,44,32,105,116,32,
-    99,97,110,32,98,101,10,32,32,32,32,39,47,116,109,112,
-    47,109,121,105,109,112,111,114,116,46,122,105,112,39,44,32,
-    111,114,32,39,47,116,109,112,47,109,121,105,109,112,111,114,
-    116,46,122,105,112,47,109,121,100,105,114,101,99,116,111,114,
-    121,39,44,32,105,102,32,109,121,100,105,114,101,99,116,111,
-    114,121,32,105,115,32,97,10,32,32,32,32,118,97,108,105,
-    100,32,100,105,114,101,99,116,111,114,121,32,105,110,115,105,
-    100,101,32,116,104,101,32,97,114,99,104,105,118,101,46,10,
-    10,32,32,32,32,39,90,105,112,73,109,112,111,114,116,69,
-    114,114,111,114,32,105,115,32,114,97,105,115,101,100,32,105,
-    102,32,39,97,114,99,104,105,118,101,112,97,116,104,39,32,
-    100,111,101,115,110,39,116,32,112,111,105,110,116,32,116,111,
-    32,97,32,118,97,108,105,100,32,90,105,112,10,32,32,32,
-    32,97,114,99,104,105,118,101,46,10,10,32,32,32,32,84,
-    104,101,32,39,97,114,99,104,105,118,101,39,32,97,116,116,
-    114,105,98,117,116,101,32,111,102,32,122,105,112,105,109,112,
-    111,114,116,101,114,32,111,98,106,101,99,116,115,32,99,111,
-    110,116,97,105,110,115,32,116,104,101,32,110,97,109,101,32,
-    111,102,32,116,104,101,10,32,32,32,32,122,105,112,102,105,
-    108,101,32,116,97,114,103,101,116,101,100,46,10,32,32,32,
-    32,99,2,0,0,0,0,0,0,0,0,0,0,0,8,0,
-    0,0,9,0,0,0,67,0,0,0,115,32,1,0,0,116,
-    0,124,1,116,1,131,2,115,28,100,1,100,0,108,2,125,
-    2,124,2,160,3,124,1,161,1,125,1,124,1,115,44,116,
-    4,100,2,124,1,100,3,141,2,130,1,116,5,114,60,124,
-    1,160,6,116,5,116,7,161,2,125,1,103,0,125,3,122,
-    14,116,8,160,9,124,1,161,1,125,4,87,0,110,70,4,
-    0,116,10,116,11,102,2,121,148,1,0,1,0,1,0,116,
-    8,160,12,124,1,161,1,92,2,125,5,125,6,124,5,124,
-    1,107,2,114,130,116,4,100,4,124,1,100,3,141,2,130,
-    1,124,5,125,1,124,3,160,13,124,6,161,1,1,0,89,
-    0,113,64,48,0,124,4,106,14,100,5,64,0,100,6,107,
-    3,114,180,116,4,100,4,124,1,100,3,141,2,130,1,113,
-    180,113,64,122,12,116,15,124,1,25,0,125,7,87,0,110,
-    34,4,0,116,16,121,226,1,0,1,0,1,0,116,17,124,
-    1,131,1,125,7,124,7,116,15,124,1,60,0,89,0,110,
-    2,48,0,124,7,124,0,95,18,124,1,124,0,95,19,116,
-    8,106,20,124,3,100,0,100,0,100,7,133,3,25,0,142,
-    0,124,0,95,21,124,0,106,21,144,1,114,28,124,0,4,
-    0,106,21,116,7,55,0,2,0,95,21,100,0,83,0,41,
-    8,78,114,0,0,0,0,122,21,97,114,99,104,105,118,101,
-    32,112,97,116,104,32,105,115,32,101,109,112,116,121,169,1,
-    218,4,112,97,116,104,122,14,110,111,116,32,97,32,90,105,
-    112,32,102,105,108,101,105,0,240,0,0,105,0,128,0,0,
-    233,255,255,255,255,41,22,218,10,105,115,105,110,115,116,97,
-    110,99,101,218,3,115,116,114,218,2,111,115,90,8,102,115,
-    100,101,99,111,100,101,114,3,0,0,0,218,12,97,108,116,
-    95,112,97,116,104,95,115,101,112,218,7,114,101,112,108,97,
-    99,101,218,8,112,97,116,104,95,115,101,112,218,19,95,98,
-    111,111,116,115,116,114,97,112,95,101,120,116,101,114,110,97,
-    108,90,10,95,112,97,116,104,95,115,116,97,116,218,7,79,
-    83,69,114,114,111,114,218,10,86,97,108,117,101,69,114,114,
-    111,114,90,11,95,112,97,116,104,95,115,112,108,105,116,218,
-    6,97,112,112,101,110,100,90,7,115,116,95,109,111,100,101,
-    218,20,95,122,105,112,95,100,105,114,101,99,116,111,114,121,
-    95,99,97,99,104,101,218,8,75,101,121,69,114,114,111,114,
-    218,15,95,114,101,97,100,95,100,105,114,101,99,116,111,114,
-    121,218,6,95,102,105,108,101,115,218,7,97,114,99,104,105,
-    118,101,218,10,95,112,97,116,104,95,106,111,105,110,218,6,
-    112,114,101,102,105,120,41,8,218,4,115,101,108,102,114,13,
-    0,0,0,114,17,0,0,0,114,31,0,0,0,90,2,115,
-    116,90,7,100,105,114,110,97,109,101,90,8,98,97,115,101,
-    110,97,109,101,218,5,102,105,108,101,115,114,9,0,0,0,
-    114,9,0,0,0,114,10,0,0,0,218,8,95,95,105,110,
-    105,116,95,95,63,0,0,0,115,58,0,0,0,0,1,10,
-    1,8,1,10,1,4,1,12,1,4,1,12,2,4,2,2,
-    1,14,1,16,3,14,1,8,1,12,1,4,1,16,3,14,
-    2,12,1,4,2,2,1,12,1,12,1,8,1,14,1,6,
-    1,6,2,22,1,8,1,122,20,122,105,112,105,109,112,111,
-    114,116,101,114,46,95,95,105,110,105,116,95,95,78,99,3,
-    0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,4,
-    0,0,0,67,0,0,0,115,78,0,0,0,116,0,124,0,
-    124,1,131,2,125,3,124,3,100,1,117,1,114,26,124,0,
-    103,0,102,2,83,0,116,1,124,0,124,1,131,2,125,4,
-    116,2,124,0,124,4,131,2,114,70,100,1,124,0,106,3,
-    155,0,116,4,155,0,124,4,155,0,157,3,103,1,102,2,
-    83,0,100,1,103,0,102,2,83,0,41,2,97,239,1,0,
-    0,102,105,110,100,95,108,111,97,100,101,114,40,102,117,108,
-    108,110,97,109,101,44,32,112,97,116,104,61,78,111,110,101,
-    41,32,45,62,32,115,101,108,102,44,32,115,116,114,32,111,
-    114,32,78,111,110,101,46,10,10,32,32,32,32,32,32,32,
-    32,83,101,97,114,99,104,32,102,111,114,32,97,32,109,111,
-    100,117,108,101,32,115,112,101,99,105,102,105,101,100,32,98,
-    121,32,39,102,117,108,108,110,97,109,101,39,46,32,39,102,
-    117,108,108,110,97,109,101,39,32,109,117,115,116,32,98,101,
-    32,116,104,101,10,32,32,32,32,32,32,32,32,102,117,108,
-    108,121,32,113,117,97,108,105,102,105,101,100,32,40,100,111,
-    116,116,101,100,41,32,109,111,100,117,108,101,32,110,97,109,
-    101,46,32,73,116,32,114,101,116,117,114,110,115,32,116,104,
-    101,32,122,105,112,105,109,112,111,114,116,101,114,10,32,32,
-    32,32,32,32,32,32,105,110,115,116,97,110,99,101,32,105,
-    116,115,101,108,102,32,105,102,32,116,104,101,32,109,111,100,
-    117,108,101,32,119,97,115,32,102,111,117,110,100,44,32,97,
-    32,115,116,114,105,110,103,32,99,111,110,116,97,105,110,105,
-    110,103,32,116,104,101,10,32,32,32,32,32,32,32,32,102,
-    117,108,108,32,112,97,116,104,32,110,97,109,101,32,105,102,
-    32,105,116,39,115,32,112,111,115,115,105,98,108,121,32,97,
-    32,112,111,114,116,105,111,110,32,111,102,32,97,32,110,97,
-    109,101,115,112,97,99,101,32,112,97,99,107,97,103,101,44,
-    10,32,32,32,32,32,32,32,32,111,114,32,78,111,110,101,
-    32,111,116,104,101,114,119,105,115,101,46,32,84,104,101,32,
-    111,112,116,105,111,110,97,108,32,39,112,97,116,104,39,32,
-    97,114,103,117,109,101,110,116,32,105,115,32,105,103,110,111,
-    114,101,100,32,45,45,32,105,116,39,115,10,32,32,32,32,
-    32,32,32,32,116,104,101,114,101,32,102,111,114,32,99,111,
-    109,112,97,116,105,98,105,108,105,116,121,32,119,105,116,104,
-    32,116,104,101,32,105,109,112,111,114,116,101,114,32,112,114,
-    111,116,111,99,111,108,46,10,32,32,32,32,32,32,32,32,
-    78,41,5,218,16,95,103,101,116,95,109,111,100,117,108,101,
-    95,105,110,102,111,218,16,95,103,101,116,95,109,111,100,117,
-    108,101,95,112,97,116,104,218,7,95,105,115,95,100,105,114,
-    114,29,0,0,0,114,20,0,0,0,41,5,114,32,0,0,
-    0,218,8,102,117,108,108,110,97,109,101,114,13,0,0,0,
-    218,2,109,105,218,7,109,111,100,112,97,116,104,114,9,0,
-    0,0,114,9,0,0,0,114,10,0,0,0,218,11,102,105,
-    110,100,95,108,111,97,100,101,114,109,0,0,0,115,14,0,
-    0,0,0,10,10,1,8,2,8,7,10,1,10,4,24,2,
+    0,64,0,0,0,115,126,0,0,0,101,0,90,1,100,0,
+    90,2,100,1,90,3,100,2,100,3,132,0,90,4,100,29,
+    100,5,100,6,132,1,90,5,100,29,100,7,100,8,132,1,
+    90,6,100,29,100,9,100,10,132,1,90,7,100,11,100,12,
+    132,0,90,8,100,13,100,14,132,0,90,9,100,15,100,16,
+    132,0,90,10,100,17,100,18,132,0,90,11,100,19,100,20,
+    132,0,90,12,100,21,100,22,132,0,90,13,100,23,100,24,
+    132,0,90,14,100,25,100,26,132,0,90,15,100,27,100,28,
+    132,0,90,16,100,4,83,0,41,30,114,4,0,0,0,97,
+    255,1,0,0,122,105,112,105,109,112,111,114,116,101,114,40,
+    97,114,99,104,105,118,101,112,97,116,104,41,32,45,62,32,
+    122,105,112,105,109,112,111,114,116,101,114,32,111,98,106,101,
+    99,116,10,10,32,32,32,32,67,114,101,97,116,101,32,97,
+    32,110,101,119,32,122,105,112,105,109,112,111,114,116,101,114,
+    32,105,110,115,116,97,110,99,101,46,32,39,97,114,99,104,
+    105,118,101,112,97,116,104,39,32,109,117,115,116,32,98,101,
+    32,97,32,112,97,116,104,32,116,111,10,32,32,32,32,97,
+    32,122,105,112,102,105,108,101,44,32,111,114,32,116,111,32,
+    97,32,115,112,101,99,105,102,105,99,32,112,97,116,104,32,
+    105,110,115,105,100,101,32,97,32,122,105,112,102,105,108,101,
+    46,32,70,111,114,32,101,120,97,109,112,108,101,44,32,105,
+    116,32,99,97,110,32,98,101,10,32,32,32,32,39,47,116,
+    109,112,47,109,121,105,109,112,111,114,116,46,122,105,112,39,
+    44,32,111,114,32,39,47,116,109,112,47,109,121,105,109,112,
+    111,114,116,46,122,105,112,47,109,121,100,105,114,101,99,116,
+    111,114,121,39,44,32,105,102,32,109,121,100,105,114,101,99,
+    116,111,114,121,32,105,115,32,97,10,32,32,32,32,118,97,
+    108,105,100,32,100,105,114,101,99,116,111,114,121,32,105,110,
+    115,105,100,101,32,116,104,101,32,97,114,99,104,105,118,101,
+    46,10,10,32,32,32,32,39,90,105,112,73,109,112,111,114,
+    116,69,114,114,111,114,32,105,115,32,114,97,105,115,101,100,
+    32,105,102,32,39,97,114,99,104,105,118,101,112,97,116,104,
+    39,32,100,111,101,115,110,39,116,32,112,111,105,110,116,32,
+    116,111,32,97,32,118,97,108,105,100,32,90,105,112,10,32,
+    32,32,32,97,114,99,104,105,118,101,46,10,10,32,32,32,
+    32,84,104,101,32,39,97,114,99,104,105,118,101,39,32,97,
+    116,116,114,105,98,117,116,101,32,111,102,32,122,105,112,105,
+    109,112,111,114,116,101,114,32,111,98,106,101,99,116,115,32,
+    99,111,110,116,97,105,110,115,32,116,104,101,32,110,97,109,
+    101,32,111,102,32,116,104,101,10,32,32,32,32,122,105,112,
+    102,105,108,101,32,116,97,114,103,101,116,101,100,46,10,32,
+    32,32,32,99,2,0,0,0,0,0,0,0,0,0,0,0,
+    8,0,0,0,9,0,0,0,67,0,0,0,115,36,1,0,
+    0,116,0,124,1,116,1,131,2,115,14,100,1,100,0,108,
+    2,125,2,124,2,160,3,124,1,161,1,125,1,124,1,115,
+    22,116,4,100,2,124,1,100,3,141,2,130,1,116,5,114,
+    30,124,1,160,6,116,5,116,7,161,2,125,1,103,0,125,
+    3,9,0,122,7,116,8,160,9,124,1,161,1,125,4,87,
+    0,110,35,4,0,116,10,116,11,102,2,121,75,1,0,1,
+    0,1,0,116,8,160,12,124,1,161,1,92,2,125,5,125,
+    6,124,5,124,1,107,2,114,66,116,4,100,5,124,1,100,
+    3,141,2,130,1,124,5,125,1,124,3,160,13,124,6,161,
+    1,1,0,89,0,110,15,119,0,124,4,106,14,100,6,64,
+    0,100,7,107,3,114,89,116,4,100,5,124,1,100,3,141,
+    2,130,1,110,1,113,33,122,6,116,15,124,1,25,0,125,
+    7,87,0,110,17,4,0,116,16,121,114,1,0,1,0,1,
+    0,116,17,124,1,131,1,125,7,124,7,116,15,124,1,60,
+    0,89,0,110,1,119,0,124,7,124,0,95,18,124,1,124,
+    0,95,19,116,8,106,20,124,3,100,0,100,0,100,8,133,
+    3,25,0,142,0,124,0,95,21,124,0,106,21,114,144,124,
+    0,4,0,106,21,116,7,55,0,2,0,95,21,100,0,83,
+    0,100,0,83,0,41,9,78,114,0,0,0,0,122,21,97,
+    114,99,104,105,118,101,32,112,97,116,104,32,105,115,32,101,
+    109,112,116,121,169,1,218,4,112,97,116,104,84,122,14,110,
+    111,116,32,97,32,90,105,112,32,102,105,108,101,105,0,240,
+    0,0,105,0,128,0,0,233,255,255,255,255,41,22,218,10,
+    105,115,105,110,115,116,97,110,99,101,218,3,115,116,114,218,
+    2,111,115,90,8,102,115,100,101,99,111,100,101,114,3,0,
+    0,0,218,12,97,108,116,95,112,97,116,104,95,115,101,112,
+    218,7,114,101,112,108,97,99,101,218,8,112,97,116,104,95,
+    115,101,112,218,19,95,98,111,111,116,115,116,114,97,112,95,
+    101,120,116,101,114,110,97,108,90,10,95,112,97,116,104,95,
+    115,116,97,116,218,7,79,83,69,114,114,111,114,218,10,86,
+    97,108,117,101,69,114,114,111,114,90,11,95,112,97,116,104,
+    95,115,112,108,105,116,218,6,97,112,112,101,110,100,90,7,
+    115,116,95,109,111,100,101,218,20,95,122,105,112,95,100,105,
+    114,101,99,116,111,114,121,95,99,97,99,104,101,218,8,75,
+    101,121,69,114,114,111,114,218,15,95,114,101,97,100,95,100,
+    105,114,101,99,116,111,114,121,218,6,95,102,105,108,101,115,
+    218,7,97,114,99,104,105,118,101,218,10,95,112,97,116,104,
+    95,106,111,105,110,218,6,112,114,101,102,105,120,41,8,218,
+    4,115,101,108,102,114,13,0,0,0,114,17,0,0,0,114,
+    31,0,0,0,90,2,115,116,90,7,100,105,114,110,97,109,
+    101,90,8,98,97,115,101,110,97,109,101,218,5,102,105,108,
+    101,115,114,9,0,0,0,114,9,0,0,0,114,10,0,0,
+    0,218,8,95,95,105,110,105,116,95,95,64,0,0,0,115,
+    68,0,0,0,10,1,8,1,10,1,4,1,12,1,4,1,
+    12,1,4,2,2,1,2,1,14,1,16,1,14,3,8,1,
+    12,1,4,1,14,1,2,249,14,10,12,2,2,1,2,240,
+    2,18,12,1,12,1,8,1,12,1,2,254,6,3,6,1,
+    22,2,6,1,18,1,4,255,122,20,122,105,112,105,109,112,
+    111,114,116,101,114,46,95,95,105,110,105,116,95,95,78,99,
+    3,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,
+    4,0,0,0,67,0,0,0,115,90,0,0,0,116,0,160,
+    1,100,1,116,2,161,2,1,0,116,3,124,0,124,1,131,
+    2,125,3,124,3,100,2,117,1,114,19,124,0,103,0,102,
+    2,83,0,116,4,124,0,124,1,131,2,125,4,116,5,124,
+    0,124,4,131,2,114,41,100,2,124,0,106,6,155,0,116,
+    7,155,0,124,4,155,0,157,3,103,1,102,2,83,0,100,
+    2,103,0,102,2,83,0,41,3,97,47,2,0,0,102,105,
+    110,100,95,108,111,97,100,101,114,40,102,117,108,108,110,97,
+    109,101,44,32,112,97,116,104,61,78,111,110,101,41,32,45,
+    62,32,115,101,108,102,44,32,115,116,114,32,111,114,32,78,
+    111,110,101,46,10,10,32,32,32,32,32,32,32,32,83,101,
+    97,114,99,104,32,102,111,114,32,97,32,109,111,100,117,108,
+    101,32,115,112,101,99,105,102,105,101,100,32,98,121,32,39,
+    102,117,108,108,110,97,109,101,39,46,32,39,102,117,108,108,
+    110,97,109,101,39,32,109,117,115,116,32,98,101,32,116,104,
+    101,10,32,32,32,32,32,32,32,32,102,117,108,108,121,32,
+    113,117,97,108,105,102,105,101,100,32,40,100,111,116,116,101,
+    100,41,32,109,111,100,117,108,101,32,110,97,109,101,46,32,
+    73,116,32,114,101,116,117,114,110,115,32,116,104,101,32,122,
+    105,112,105,109,112,111,114,116,101,114,10,32,32,32,32,32,
+    32,32,32,105,110,115,116,97,110,99,101,32,105,116,115,101,
+    108,102,32,105,102,32,116,104,101,32,109,111,100,117,108,101,
+    32,119,97,115,32,102,111,117,110,100,44,32,97,32,115,116,
+    114,105,110,103,32,99,111,110,116,97,105,110,105,110,103,32,
+    116,104,101,10,32,32,32,32,32,32,32,32,102,117,108,108,
+    32,112,97,116,104,32,110,97,109,101,32,105,102,32,105,116,
+    39,115,32,112,111,115,115,105,98,108,121,32,97,32,112,111,
+    114,116,105,111,110,32,111,102,32,97,32,110,97,109,101,115,
+    112,97,99,101,32,112,97,99,107,97,103,101,44,10,32,32,
+    32,32,32,32,32,32,111,114,32,78,111,110,101,32,111,116,
+    104,101,114,119,105,115,101,46,32,84,104,101,32,111,112,116,
+    105,111,110,97,108,32,39,112,97,116,104,39,32,97,114,103,
+    117,109,101,110,116,32,105,115,32,105,103,110,111,114,101,100,
+    32,45,45,32,105,116,39,115,10,32,32,32,32,32,32,32,
+    32,116,104,101,114,101,32,102,111,114,32,99,111,109,112,97,
+    116,105,98,105,108,105,116,121,32,119,105,116,104,32,116,104,
+    101,32,105,109,112,111,114,116,101,114,32,112,114,111,116,111,
+    99,111,108,46,10,10,32,32,32,32,32,32,32,32,68,101,
+    112,114,101,99,97,116,101,100,32,115,105,110,99,101,32,80,
+    121,116,104,111,110,32,51,46,49,48,46,32,85,115,101,32,
+    102,105,110,100,95,115,112,101,99,40,41,32,105,110,115,116,
+    101,97,100,46,10,32,32,32,32,32,32,32,32,122,102,122,
+    105,112,105,109,112,111,114,116,101,114,46,102,105,110,100,95,
+    108,111,97,100,101,114,40,41,32,105,115,32,100,101,112,114,
+    101,99,97,116,101,100,32,97,110,100,32,115,108,97,116,101,
+    100,32,102,111,114,32,114,101,109,111,118,97,108,32,105,110,
+    32,80,121,116,104,111,110,32,51,46,49,50,59,32,117,115,
+    101,32,102,105,110,100,95,115,112,101,99,40,41,32,105,110,
+    115,116,101,97,100,78,41,8,218,9,95,119,97,114,110,105,
+    110,103,115,218,4,119,97,114,110,218,18,68,101,112,114,101,
+    99,97,116,105,111,110,87,97,114,110,105,110,103,218,16,95,
+    103,101,116,95,109,111,100,117,108,101,95,105,110,102,111,218,
+    16,95,103,101,116,95,109,111,100,117,108,101,95,112,97,116,
+    104,218,7,95,105,115,95,100,105,114,114,29,0,0,0,114,
+    20,0,0,0,41,5,114,32,0,0,0,218,8,102,117,108,
+    108,110,97,109,101,114,13,0,0,0,218,2,109,105,218,7,
+    109,111,100,112,97,116,104,114,9,0,0,0,114,9,0,0,
+    0,114,10,0,0,0,218,11,102,105,110,100,95,108,111,97,
+    100,101,114,110,0,0,0,115,20,0,0,0,6,12,2,2,
+    4,254,10,3,8,1,8,2,10,7,10,1,24,4,8,2,
     122,23,122,105,112,105,109,112,111,114,116,101,114,46,102,105,
     110,100,95,108,111,97,100,101,114,99,3,0,0,0,0,0,
     0,0,0,0,0,0,3,0,0,0,4,0,0,0,67,0,
-    0,0,115,16,0,0,0,124,0,160,0,124,1,124,2,161,
-    2,100,1,25,0,83,0,41,2,97,139,1,0,0,102,105,
-    110,100,95,109,111,100,117,108,101,40,102,117,108,108,110,97,
-    109,101,44,32,112,97,116,104,61,78,111,110,101,41,32,45,
-    62,32,115,101,108,102,32,111,114,32,78,111,110,101,46,10,
-    10,32,32,32,32,32,32,32,32,83,101,97,114,99,104,32,
-    102,111,114,32,97,32,109,111,100,117,108,101,32,115,112,101,
-    99,105,102,105,101,100,32,98,121,32,39,102,117,108,108,110,
-    97,109,101,39,46,32,39,102,117,108,108,110,97,109,101,39,
-    32,109,117,115,116,32,98,101,32,116,104,101,10,32,32,32,
-    32,32,32,32,32,102,117,108,108,121,32,113,117,97,108,105,
-    102,105,101,100,32,40,100,111,116,116,101,100,41,32,109,111,
-    100,117,108,101,32,110,97,109,101,46,32,73,116,32,114,101,
-    116,117,114,110,115,32,116,104,101,32,122,105,112,105,109,112,
-    111,114,116,101,114,10,32,32,32,32,32,32,32,32,105,110,
-    115,116,97,110,99,101,32,105,116,115,101,108,102,32,105,102,
-    32,116,104,101,32,109,111,100,117,108,101,32,119,97,115,32,
-    102,111,117,110,100,44,32,111,114,32,78,111,110,101,32,105,
-    102,32,105,116,32,119,97,115,110,39,116,46,10,32,32,32,
-    32,32,32,32,32,84,104,101,32,111,112,116,105,111,110,97,
-    108,32,39,112,97,116,104,39,32,97,114,103,117,109,101,110,
-    116,32,105,115,32,105,103,110,111,114,101,100,32,45,45,32,
-    105,116,39,115,32,116,104,101,114,101,32,102,111,114,32,99,
-    111,109,112,97,116,105,98,105,108,105,116,121,10,32,32,32,
-    32,32,32,32,32,119,105,116,104,32,116,104,101,32,105,109,
-    112,111,114,116,101,114,32,112,114,111,116,111,99,111,108,46,
-    10,32,32,32,32,32,32,32,32,114,0,0,0,0,41,1,
-    114,41,0,0,0,41,3,114,32,0,0,0,114,38,0,0,
-    0,114,13,0,0,0,114,9,0,0,0,114,9,0,0,0,
-    114,10,0,0,0,218,11,102,105,110,100,95,109,111,100,117,
-    108,101,141,0,0,0,115,2,0,0,0,0,9,122,23,122,
-    105,112,105,109,112,111,114,116,101,114,46,102,105,110,100,95,
-    109,111,100,117,108,101,99,2,0,0,0,0,0,0,0,0,
+    0,0,115,28,0,0,0,116,0,160,1,100,1,116,2,161,
+    2,1,0,124,0,160,3,124,1,124,2,161,2,100,2,25,
+    0,83,0,41,3,97,203,1,0,0,102,105,110,100,95,109,
+    111,100,117,108,101,40,102,117,108,108,110,97,109,101,44,32,
+    112,97,116,104,61,78,111,110,101,41,32,45,62,32,115,101,
+    108,102,32,111,114,32,78,111,110,101,46,10,10,32,32,32,
+    32,32,32,32,32,83,101,97,114,99,104,32,102,111,114,32,
+    97,32,109,111,100,117,108,101,32,115,112,101,99,105,102,105,
+    101,100,32,98,121,32,39,102,117,108,108,110,97,109,101,39,
+    46,32,39,102,117,108,108,110,97,109,101,39,32,109,117,115,
+    116,32,98,101,32,116,104,101,10,32,32,32,32,32,32,32,
+    32,102,117,108,108,121,32,113,117,97,108,105,102,105,101,100,
+    32,40,100,111,116,116,101,100,41,32,109,111,100,117,108,101,
+    32,110,97,109,101,46,32,73,116,32,114,101,116,117,114,110,
+    115,32,116,104,101,32,122,105,112,105,109,112,111,114,116,101,
+    114,10,32,32,32,32,32,32,32,32,105,110,115,116,97,110,
+    99,101,32,105,116,115,101,108,102,32,105,102,32,116,104,101,
+    32,109,111,100,117,108,101,32,119,97,115,32,102,111,117,110,
+    100,44,32,111,114,32,78,111,110,101,32,105,102,32,105,116,
+    32,119,97,115,110,39,116,46,10,32,32,32,32,32,32,32,
+    32,84,104,101,32,111,112,116,105,111,110,97,108,32,39,112,
+    97,116,104,39,32,97,114,103,117,109,101,110,116,32,105,115,
+    32,105,103,110,111,114,101,100,32,45,45,32,105,116,39,115,
+    32,116,104,101,114,101,32,102,111,114,32,99,111,109,112,97,
+    116,105,98,105,108,105,116,121,10,32,32,32,32,32,32,32,
+    32,119,105,116,104,32,116,104,101,32,105,109,112,111,114,116,
+    101,114,32,112,114,111,116,111,99,111,108,46,10,10,32,32,
+    32,32,32,32,32,32,68,101,112,114,101,99,97,116,101,100,
+    32,115,105,110,99,101,32,80,121,116,104,111,110,32,51,46,
+    49,48,46,32,85,115,101,32,102,105,110,100,95,115,112,101,
+    99,40,41,32,105,110,115,116,101,97,100,46,10,32,32,32,
+    32,32,32,32,32,122,102,122,105,112,105,109,112,111,114,116,
+    101,114,46,102,105,110,100,95,109,111,100,117,108,101,40,41,
+    32,105,115,32,100,101,112,114,101,99,97,116,101,100,32,97,
+    110,100,32,115,108,97,116,101,100,32,102,111,114,32,114,101,
+    109,111,118,97,108,32,105,110,32,80,121,116,104,111,110,32,
+    51,46,49,50,59,32,117,115,101,32,102,105,110,100,95,115,
+    112,101,99,40,41,32,105,110,115,116,101,97,100,114,0,0,
+    0,0,41,4,114,35,0,0,0,114,36,0,0,0,114,37,
+    0,0,0,114,44,0,0,0,41,3,114,32,0,0,0,114,
+    41,0,0,0,114,13,0,0,0,114,9,0,0,0,114,9,
+    0,0,0,114,10,0,0,0,218,11,102,105,110,100,95,109,
+    111,100,117,108,101,147,0,0,0,115,8,0,0,0,6,11,
+    2,2,4,254,16,3,122,23,122,105,112,105,109,112,111,114,
+    116,101,114,46,102,105,110,100,95,109,111,100,117,108,101,99,
+    3,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,
+    5,0,0,0,67,0,0,0,115,108,0,0,0,116,0,124,
+    0,124,1,131,2,125,3,124,3,100,1,117,1,114,17,116,
+    1,106,2,124,1,124,0,124,3,100,2,141,3,83,0,116,
+    3,124,0,124,1,131,2,125,4,116,4,124,0,124,4,131,
+    2,114,52,124,0,106,5,155,0,116,6,155,0,124,4,155,
+    0,157,3,125,5,116,1,106,7,124,1,100,1,100,3,100,
+    4,141,3,125,6,124,6,106,8,160,9,124,5,161,1,1,
+    0,124,6,83,0,100,1,83,0,41,5,122,107,67,114,101,
+    97,116,101,32,97,32,77,111,100,117,108,101,83,112,101,99,
+    32,102,111,114,32,116,104,101,32,115,112,101,99,105,102,105,
+    101,100,32,109,111,100,117,108,101,46,10,10,32,32,32,32,
+    32,32,32,32,82,101,116,117,114,110,115,32,78,111,110,101,
+    32,105,102,32,116,104,101,32,109,111,100,117,108,101,32,99,
+    97,110,110,111,116,32,98,101,32,102,111,117,110,100,46,10,
+    32,32,32,32,32,32,32,32,78,41,1,218,10,105,115,95,
+    112,97,99,107,97,103,101,84,41,3,218,4,110,97,109,101,
+    90,6,108,111,97,100,101,114,114,46,0,0,0,41,10,114,
+    38,0,0,0,218,10,95,98,111,111,116,115,116,114,97,112,
+    90,16,115,112,101,99,95,102,114,111,109,95,108,111,97,100,
+    101,114,114,39,0,0,0,114,40,0,0,0,114,29,0,0,
+    0,114,20,0,0,0,90,10,77,111,100,117,108,101,83,112,
+    101,99,90,26,115,117,98,109,111,100,117,108,101,95,115,101,
+    97,114,99,104,95,108,111,99,97,116,105,111,110,115,114,24,
+    0,0,0,41,7,114,32,0,0,0,114,41,0,0,0,90,
+    6,116,97,114,103,101,116,90,11,109,111,100,117,108,101,95,
+    105,110,102,111,114,43,0,0,0,114,13,0,0,0,90,4,
+    115,112,101,99,114,9,0,0,0,114,9,0,0,0,114,10,
+    0,0,0,218,9,102,105,110,100,95,115,112,101,99,163,0,
+    0,0,115,24,0,0,0,10,5,8,1,16,1,10,7,10,
+    1,18,4,8,1,2,1,6,255,12,2,4,1,4,2,122,
+    21,122,105,112,105,109,112,111,114,116,101,114,46,102,105,110,
+    100,95,115,112,101,99,99,2,0,0,0,0,0,0,0,0,
     0,0,0,5,0,0,0,3,0,0,0,67,0,0,0,115,
     20,0,0,0,116,0,124,0,124,1,131,2,92,3,125,2,
-    125,3,125,4,124,2,83,0,41,1,122,163,103,101,116,95,
+    125,3,125,4,124,2,83,0,41,1,122,166,103,101,116,95,
     99,111,100,101,40,102,117,108,108,110,97,109,101,41,32,45,
     62,32,99,111,100,101,32,111,98,106,101,99,116,46,10,10,
     32,32,32,32,32,32,32,32,82,101,116,117,114,110,32,116,
@@ -261,559 +322,584 @@
     105,112,73,109,112,111,114,116,69,114,114,111,114,10,32,32,
     32,32,32,32,32,32,105,102,32,116,104,101,32,109,111,100,
     117,108,101,32,99,111,117,108,100,110,39,116,32,98,101,32,
-    102,111,117,110,100,46,10,32,32,32,32,32,32,32,32,169,
-    1,218,16,95,103,101,116,95,109,111,100,117,108,101,95,99,
-    111,100,101,169,5,114,32,0,0,0,114,38,0,0,0,218,
-    4,99,111,100,101,218,9,105,115,112,97,99,107,97,103,101,
-    114,40,0,0,0,114,9,0,0,0,114,9,0,0,0,114,
-    10,0,0,0,218,8,103,101,116,95,99,111,100,101,153,0,
-    0,0,115,4,0,0,0,0,6,16,1,122,20,122,105,112,
-    105,109,112,111,114,116,101,114,46,103,101,116,95,99,111,100,
-    101,99,2,0,0,0,0,0,0,0,0,0,0,0,4,0,
-    0,0,8,0,0,0,67,0,0,0,115,116,0,0,0,116,
-    0,114,16,124,1,160,1,116,0,116,2,161,2,125,1,124,
-    1,125,2,124,1,160,3,124,0,106,4,116,2,23,0,161,
-    1,114,58,124,1,116,5,124,0,106,4,116,2,23,0,131,
-    1,100,1,133,2,25,0,125,2,122,14,124,0,106,6,124,
-    2,25,0,125,3,87,0,110,30,4,0,116,7,121,102,1,
-    0,1,0,1,0,116,8,100,2,100,3,124,2,131,3,130,
-    1,89,0,110,2,48,0,116,9,124,0,106,4,124,3,131,
-    2,83,0,41,4,122,154,103,101,116,95,100,97,116,97,40,
-    112,97,116,104,110,97,109,101,41,32,45,62,32,115,116,114,
-    105,110,103,32,119,105,116,104,32,102,105,108,101,32,100,97,
-    116,97,46,10,10,32,32,32,32,32,32,32,32,82,101,116,
-    117,114,110,32,116,104,101,32,100,97,116,97,32,97,115,115,
-    111,99,105,97,116,101,100,32,119,105,116,104,32,39,112,97,
-    116,104,110,97,109,101,39,46,32,82,97,105,115,101,32,79,
-    83,69,114,114,111,114,32,105,102,10,32,32,32,32,32,32,
-    32,32,116,104,101,32,102,105,108,101,32,119,97,115,110,39,
-    116,32,102,111,117,110,100,46,10,32,32,32,32,32,32,32,
-    32,78,114,0,0,0,0,218,0,41,10,114,18,0,0,0,
-    114,19,0,0,0,114,20,0,0,0,218,10,115,116,97,114,
-    116,115,119,105,116,104,114,29,0,0,0,218,3,108,101,110,
-    114,28,0,0,0,114,26,0,0,0,114,22,0,0,0,218,
-    9,95,103,101,116,95,100,97,116,97,41,4,114,32,0,0,
-    0,218,8,112,97,116,104,110,97,109,101,90,3,107,101,121,
-    218,9,116,111,99,95,101,110,116,114,121,114,9,0,0,0,
-    114,9,0,0,0,114,10,0,0,0,218,8,103,101,116,95,
-    100,97,116,97,163,0,0,0,115,20,0,0,0,0,6,4,
-    1,12,2,4,1,16,1,22,2,2,1,14,1,12,1,18,
-    1,122,20,122,105,112,105,109,112,111,114,116,101,114,46,103,
-    101,116,95,100,97,116,97,99,2,0,0,0,0,0,0,0,
-    0,0,0,0,5,0,0,0,3,0,0,0,67,0,0,0,
-    115,20,0,0,0,116,0,124,0,124,1,131,2,92,3,125,
-    2,125,3,125,4,124,4,83,0,41,1,122,106,103,101,116,
-    95,102,105,108,101,110,97,109,101,40,102,117,108,108,110,97,
-    109,101,41,32,45,62,32,102,105,108,101,110,97,109,101,32,
-    115,116,114,105,110,103,46,10,10,32,32,32,32,32,32,32,
-    32,82,101,116,117,114,110,32,116,104,101,32,102,105,108,101,
-    110,97,109,101,32,102,111,114,32,116,104,101,32,115,112,101,
-    99,105,102,105,101,100,32,109,111,100,117,108,101,46,10,32,
-    32,32,32,32,32,32,32,114,43,0,0,0,114,45,0,0,
-    0,114,9,0,0,0,114,9,0,0,0,114,10,0,0,0,
-    218,12,103,101,116,95,102,105,108,101,110,97,109,101,184,0,
-    0,0,115,4,0,0,0,0,7,16,1,122,24,122,105,112,
-    105,109,112,111,114,116,101,114,46,103,101,116,95,102,105,108,
-    101,110,97,109,101,99,2,0,0,0,0,0,0,0,0,0,
-    0,0,6,0,0,0,8,0,0,0,67,0,0,0,115,126,
-    0,0,0,116,0,124,0,124,1,131,2,125,2,124,2,100,
-    1,117,0,114,36,116,1,100,2,124,1,155,2,157,2,124,
-    1,100,3,141,2,130,1,116,2,124,0,124,1,131,2,125,
-    3,124,2,114,64,116,3,160,4,124,3,100,4,161,2,125,
-    4,110,10,124,3,155,0,100,5,157,2,125,4,122,14,124,
-    0,106,5,124,4,25,0,125,5,87,0,110,20,4,0,116,
-    6,121,108,1,0,1,0,1,0,89,0,100,1,83,0,48,
-    0,116,7,124,0,106,8,124,5,131,2,160,9,161,0,83,
-    0,41,6,122,253,103,101,116,95,115,111,117,114,99,101,40,
-    102,117,108,108,110,97,109,101,41,32,45,62,32,115,111,117,
-    114,99,101,32,115,116,114,105,110,103,46,10,10,32,32,32,
-    32,32,32,32,32,82,101,116,117,114,110,32,116,104,101,32,
-    115,111,117,114,99,101,32,99,111,100,101,32,102,111,114,32,
-    116,104,101,32,115,112,101,99,105,102,105,101,100,32,109,111,
-    100,117,108,101,46,32,82,97,105,115,101,32,90,105,112,73,
-    109,112,111,114,116,69,114,114,111,114,10,32,32,32,32,32,
-    32,32,32,105,102,32,116,104,101,32,109,111,100,117,108,101,
-    32,99,111,117,108,100,110,39,116,32,98,101,32,102,111,117,
-    110,100,44,32,114,101,116,117,114,110,32,78,111,110,101,32,
-    105,102,32,116,104,101,32,97,114,99,104,105,118,101,32,100,
-    111,101,115,10,32,32,32,32,32,32,32,32,99,111,110,116,
-    97,105,110,32,116,104,101,32,109,111,100,117,108,101,44,32,
-    98,117,116,32,104,97,115,32,110,111,32,115,111,117,114,99,
-    101,32,102,111,114,32,105,116,46,10,32,32,32,32,32,32,
-    32,32,78,250,18,99,97,110,39,116,32,102,105,110,100,32,
-    109,111,100,117,108,101,32,169,1,218,4,110,97,109,101,250,
-    11,95,95,105,110,105,116,95,95,46,112,121,250,3,46,112,
-    121,41,10,114,35,0,0,0,114,3,0,0,0,114,36,0,
-    0,0,114,21,0,0,0,114,30,0,0,0,114,28,0,0,
-    0,114,26,0,0,0,114,52,0,0,0,114,29,0,0,0,
-    218,6,100,101,99,111,100,101,41,6,114,32,0,0,0,114,
-    38,0,0,0,114,39,0,0,0,114,13,0,0,0,218,8,
-    102,117,108,108,112,97,116,104,114,54,0,0,0,114,9,0,
-    0,0,114,9,0,0,0,114,10,0,0,0,218,10,103,101,
-    116,95,115,111,117,114,99,101,195,0,0,0,115,24,0,0,
-    0,0,7,10,1,8,1,18,2,10,1,4,1,14,2,10,
-    2,2,1,14,1,12,2,8,1,122,22,122,105,112,105,109,
-    112,111,114,116,101,114,46,103,101,116,95,115,111,117,114,99,
-    101,99,2,0,0,0,0,0,0,0,0,0,0,0,3,0,
-    0,0,4,0,0,0,67,0,0,0,115,40,0,0,0,116,
+    105,109,112,111,114,116,101,100,46,10,32,32,32,32,32,32,
+    32,32,169,1,218,16,95,103,101,116,95,109,111,100,117,108,
+    101,95,99,111,100,101,169,5,114,32,0,0,0,114,41,0,
+    0,0,218,4,99,111,100,101,218,9,105,115,112,97,99,107,
+    97,103,101,114,43,0,0,0,114,9,0,0,0,114,9,0,
+    0,0,114,10,0,0,0,218,8,103,101,116,95,99,111,100,
+    101,190,0,0,0,115,4,0,0,0,16,6,4,1,122,20,
+    122,105,112,105,109,112,111,114,116,101,114,46,103,101,116,95,
+    99,111,100,101,99,2,0,0,0,0,0,0,0,0,0,0,
+    0,4,0,0,0,8,0,0,0,67,0,0,0,115,112,0,
+    0,0,116,0,114,8,124,1,160,1,116,0,116,2,161,2,
+    125,1,124,1,125,2,124,1,160,3,124,0,106,4,116,2,
+    23,0,161,1,114,29,124,1,116,5,124,0,106,4,116,2,
+    23,0,131,1,100,1,133,2,25,0,125,2,122,7,124,0,
+    106,6,124,2,25,0,125,3,87,0,110,13,4,0,116,7,
+    121,49,1,0,1,0,1,0,116,8,100,2,100,3,124,2,
+    131,3,130,1,119,0,116,9,124,0,106,4,124,3,131,2,
+    83,0,41,4,122,154,103,101,116,95,100,97,116,97,40,112,
+    97,116,104,110,97,109,101,41,32,45,62,32,115,116,114,105,
+    110,103,32,119,105,116,104,32,102,105,108,101,32,100,97,116,
+    97,46,10,10,32,32,32,32,32,32,32,32,82,101,116,117,
+    114,110,32,116,104,101,32,100,97,116,97,32,97,115,115,111,
+    99,105,97,116,101,100,32,119,105,116,104,32,39,112,97,116,
+    104,110,97,109,101,39,46,32,82,97,105,115,101,32,79,83,
+    69,114,114,111,114,32,105,102,10,32,32,32,32,32,32,32,
+    32,116,104,101,32,102,105,108,101,32,119,97,115,110,39,116,
+    32,102,111,117,110,100,46,10,32,32,32,32,32,32,32,32,
+    78,114,0,0,0,0,218,0,41,10,114,18,0,0,0,114,
+    19,0,0,0,114,20,0,0,0,218,10,115,116,97,114,116,
+    115,119,105,116,104,114,29,0,0,0,218,3,108,101,110,114,
+    28,0,0,0,114,26,0,0,0,114,22,0,0,0,218,9,
+    95,103,101,116,95,100,97,116,97,41,4,114,32,0,0,0,
+    218,8,112,97,116,104,110,97,109,101,90,3,107,101,121,218,
+    9,116,111,99,95,101,110,116,114,121,114,9,0,0,0,114,
+    9,0,0,0,114,10,0,0,0,218,8,103,101,116,95,100,
+    97,116,97,200,0,0,0,115,22,0,0,0,4,6,12,1,
+    4,2,16,1,22,1,2,2,14,1,12,1,12,1,2,255,
+    12,2,122,20,122,105,112,105,109,112,111,114,116,101,114,46,
+    103,101,116,95,100,97,116,97,99,2,0,0,0,0,0,0,
+    0,0,0,0,0,5,0,0,0,3,0,0,0,67,0,0,
+    0,115,20,0,0,0,116,0,124,0,124,1,131,2,92,3,
+    125,2,125,3,125,4,124,4,83,0,41,1,122,165,103,101,
+    116,95,102,105,108,101,110,97,109,101,40,102,117,108,108,110,
+    97,109,101,41,32,45,62,32,102,105,108,101,110,97,109,101,
+    32,115,116,114,105,110,103,46,10,10,32,32,32,32,32,32,
+    32,32,82,101,116,117,114,110,32,116,104,101,32,102,105,108,
+    101,110,97,109,101,32,102,111,114,32,116,104,101,32,115,112,
+    101,99,105,102,105,101,100,32,109,111,100,117,108,101,32,111,
+    114,32,114,97,105,115,101,32,90,105,112,73,109,112,111,114,
+    116,69,114,114,111,114,10,32,32,32,32,32,32,32,32,105,
+    102,32,105,116,32,99,111,117,108,100,110,39,116,32,98,101,
+    32,105,109,112,111,114,116,101,100,46,10,32,32,32,32,32,
+    32,32,32,114,50,0,0,0,114,52,0,0,0,114,9,0,
+    0,0,114,9,0,0,0,114,10,0,0,0,218,12,103,101,
+    116,95,102,105,108,101,110,97,109,101,221,0,0,0,115,4,
+    0,0,0,16,8,4,1,122,24,122,105,112,105,109,112,111,
+    114,116,101,114,46,103,101,116,95,102,105,108,101,110,97,109,
+    101,99,2,0,0,0,0,0,0,0,0,0,0,0,6,0,
+    0,0,8,0,0,0,67,0,0,0,115,126,0,0,0,116,
     0,124,0,124,1,131,2,125,2,124,2,100,1,117,0,114,
-    36,116,1,100,2,124,1,155,2,157,2,124,1,100,3,141,
-    2,130,1,124,2,83,0,41,4,122,171,105,115,95,112,97,
-    99,107,97,103,101,40,102,117,108,108,110,97,109,101,41,32,
-    45,62,32,98,111,111,108,46,10,10,32,32,32,32,32,32,
-    32,32,82,101,116,117,114,110,32,84,114,117,101,32,105,102,
-    32,116,104,101,32,109,111,100,117,108,101,32,115,112,101,99,
-    105,102,105,101,100,32,98,121,32,102,117,108,108,110,97,109,
-    101,32,105,115,32,97,32,112,97,99,107,97,103,101,46,10,
-    32,32,32,32,32,32,32,32,82,97,105,115,101,32,90,105,
-    112,73,109,112,111,114,116,69,114,114,111,114,32,105,102,32,
-    116,104,101,32,109,111,100,117,108,101,32,99,111,117,108,100,
-    110,39,116,32,98,101,32,102,111,117,110,100,46,10,32,32,
-    32,32,32,32,32,32,78,114,57,0,0,0,114,58,0,0,
-    0,41,2,114,35,0,0,0,114,3,0,0,0,41,3,114,
-    32,0,0,0,114,38,0,0,0,114,39,0,0,0,114,9,
-    0,0,0,114,9,0,0,0,114,10,0,0,0,218,10,105,
-    115,95,112,97,99,107,97,103,101,221,0,0,0,115,8,0,
-    0,0,0,6,10,1,8,1,18,1,122,22,122,105,112,105,
-    109,112,111,114,116,101,114,46,105,115,95,112,97,99,107,97,
-    103,101,99,2,0,0,0,0,0,0,0,0,0,0,0,8,
-    0,0,0,8,0,0,0,67,0,0,0,115,246,0,0,0,
-    116,0,124,0,124,1,131,2,92,3,125,2,125,3,125,4,
-    116,1,106,2,160,3,124,1,161,1,125,5,124,5,100,1,
-    117,0,115,46,116,4,124,5,116,5,131,2,115,64,116,5,
-    124,1,131,1,125,5,124,5,116,1,106,2,124,1,60,0,
-    124,0,124,5,95,6,122,84,124,3,114,108,116,7,124,0,
-    124,1,131,2,125,6,116,8,160,9,124,0,106,10,124,6,
-    161,2,125,7,124,7,103,1,124,5,95,11,116,12,124,5,
-    100,2,131,2,115,124,116,13,124,5,95,13,116,8,160,14,
-    124,5,106,15,124,1,124,4,161,3,1,0,116,16,124,2,
-    124,5,106,15,131,2,1,0,87,0,110,22,1,0,1,0,
-    1,0,116,1,106,2,124,1,61,0,130,0,89,0,110,2,
-    48,0,122,14,116,1,106,2,124,1,25,0,125,5,87,0,
-    110,34,4,0,116,17,121,226,1,0,1,0,1,0,116,18,
-    100,3,124,1,155,2,100,4,157,3,131,1,130,1,89,0,
-    110,2,48,0,116,19,160,20,100,5,124,1,124,4,161,3,
-    1,0,124,5,83,0,41,6,122,245,108,111,97,100,95,109,
-    111,100,117,108,101,40,102,117,108,108,110,97,109,101,41,32,
-    45,62,32,109,111,100,117,108,101,46,10,10,32,32,32,32,
-    32,32,32,32,76,111,97,100,32,116,104,101,32,109,111,100,
-    117,108,101,32,115,112,101,99,105,102,105,101,100,32,98,121,
-    32,39,102,117,108,108,110,97,109,101,39,46,32,39,102,117,
-    108,108,110,97,109,101,39,32,109,117,115,116,32,98,101,32,
-    116,104,101,10,32,32,32,32,32,32,32,32,102,117,108,108,
-    121,32,113,117,97,108,105,102,105,101,100,32,40,100,111,116,
-    116,101,100,41,32,109,111,100,117,108,101,32,110,97,109,101,
-    46,32,73,116,32,114,101,116,117,114,110,115,32,116,104,101,
-    32,105,109,112,111,114,116,101,100,10,32,32,32,32,32,32,
-    32,32,109,111,100,117,108,101,44,32,111,114,32,114,97,105,
-    115,101,115,32,90,105,112,73,109,112,111,114,116,69,114,114,
-    111,114,32,105,102,32,105,116,32,119,97,115,110,39,116,32,
-    102,111,117,110,100,46,10,32,32,32,32,32,32,32,32,78,
-    218,12,95,95,98,117,105,108,116,105,110,115,95,95,122,14,
-    76,111,97,100,101,100,32,109,111,100,117,108,101,32,122,25,
-    32,110,111,116,32,102,111,117,110,100,32,105,110,32,115,121,
-    115,46,109,111,100,117,108,101,115,122,30,105,109,112,111,114,
-    116,32,123,125,32,35,32,108,111,97,100,101,100,32,102,114,
-    111,109,32,90,105,112,32,123,125,41,21,114,44,0,0,0,
-    218,3,115,121,115,218,7,109,111,100,117,108,101,115,218,3,
-    103,101,116,114,15,0,0,0,218,12,95,109,111,100,117,108,
-    101,95,116,121,112,101,218,10,95,95,108,111,97,100,101,114,
-    95,95,114,36,0,0,0,114,21,0,0,0,114,30,0,0,
-    0,114,29,0,0,0,90,8,95,95,112,97,116,104,95,95,
-    218,7,104,97,115,97,116,116,114,114,66,0,0,0,90,14,
-    95,102,105,120,95,117,112,95,109,111,100,117,108,101,218,8,
-    95,95,100,105,99,116,95,95,218,4,101,120,101,99,114,26,
-    0,0,0,218,11,73,109,112,111,114,116,69,114,114,111,114,
-    218,10,95,98,111,111,116,115,116,114,97,112,218,16,95,118,
-    101,114,98,111,115,101,95,109,101,115,115,97,103,101,41,8,
-    114,32,0,0,0,114,38,0,0,0,114,46,0,0,0,114,
-    47,0,0,0,114,40,0,0,0,90,3,109,111,100,114,13,
-    0,0,0,114,63,0,0,0,114,9,0,0,0,114,9,0,
-    0,0,114,10,0,0,0,218,11,108,111,97,100,95,109,111,
-    100,117,108,101,234,0,0,0,115,48,0,0,0,0,7,16,
-    1,12,1,18,1,8,1,10,1,6,2,2,1,4,3,10,
-    1,14,1,8,2,10,1,6,1,16,1,16,1,6,1,8,
-    1,8,2,2,1,14,1,12,1,22,1,14,1,122,23,122,
-    105,112,105,109,112,111,114,116,101,114,46,108,111,97,100,95,
-    109,111,100,117,108,101,99,2,0,0,0,0,0,0,0,0,
-    0,0,0,3,0,0,0,8,0,0,0,67,0,0,0,115,
-    86,0,0,0,122,20,124,0,160,0,124,1,161,1,115,18,
-    87,0,100,1,83,0,87,0,110,20,4,0,116,1,121,40,
-    1,0,1,0,1,0,89,0,100,1,83,0,48,0,116,2,
-    106,3,115,76,100,2,100,3,108,4,109,5,125,2,1,0,
-    124,2,160,6,116,2,161,1,1,0,100,4,116,2,95,3,
-    116,2,124,0,124,1,131,2,83,0,41,5,122,204,82,101,
-    116,117,114,110,32,116,104,101,32,82,101,115,111,117,114,99,
-    101,82,101,97,100,101,114,32,102,111,114,32,97,32,112,97,
-    99,107,97,103,101,32,105,110,32,97,32,122,105,112,32,102,
-    105,108,101,46,10,10,32,32,32,32,32,32,32,32,73,102,
-    32,39,102,117,108,108,110,97,109,101,39,32,105,115,32,97,
-    32,112,97,99,107,97,103,101,32,119,105,116,104,105,110,32,
-    116,104,101,32,122,105,112,32,102,105,108,101,44,32,114,101,
-    116,117,114,110,32,116,104,101,10,32,32,32,32,32,32,32,
-    32,39,82,101,115,111,117,114,99,101,82,101,97,100,101,114,
-    39,32,111,98,106,101,99,116,32,102,111,114,32,116,104,101,
-    32,112,97,99,107,97,103,101,46,32,32,79,116,104,101,114,
-    119,105,115,101,32,114,101,116,117,114,110,32,78,111,110,101,
-    46,10,32,32,32,32,32,32,32,32,78,114,0,0,0,0,
-    41,1,218,14,82,101,115,111,117,114,99,101,82,101,97,100,
-    101,114,84,41,7,114,65,0,0,0,114,3,0,0,0,218,
-    24,95,90,105,112,73,109,112,111,114,116,82,101,115,111,117,
-    114,99,101,82,101,97,100,101,114,218,11,95,114,101,103,105,
-    115,116,101,114,101,100,90,13,105,109,112,111,114,116,108,105,
-    98,46,97,98,99,114,79,0,0,0,90,8,114,101,103,105,
-    115,116,101,114,41,3,114,32,0,0,0,114,38,0,0,0,
-    114,79,0,0,0,114,9,0,0,0,114,9,0,0,0,114,
-    10,0,0,0,218,19,103,101,116,95,114,101,115,111,117,114,
-    99,101,95,114,101,97,100,101,114,16,1,0,0,115,20,0,
-    0,0,0,6,2,1,10,1,10,1,12,1,8,1,6,1,
-    12,1,10,1,6,1,122,31,122,105,112,105,109,112,111,114,
-    116,101,114,46,103,101,116,95,114,101,115,111,117,114,99,101,
-    95,114,101,97,100,101,114,99,1,0,0,0,0,0,0,0,
-    0,0,0,0,1,0,0,0,5,0,0,0,67,0,0,0,
-    115,24,0,0,0,100,1,124,0,106,0,155,0,116,1,155,
-    0,124,0,106,2,155,0,100,2,157,5,83,0,41,3,78,
-    122,21,60,122,105,112,105,109,112,111,114,116,101,114,32,111,
-    98,106,101,99,116,32,34,122,2,34,62,41,3,114,29,0,
-    0,0,114,20,0,0,0,114,31,0,0,0,41,1,114,32,
+    18,116,1,100,2,124,1,155,2,157,2,124,1,100,3,141,
+    2,130,1,116,2,124,0,124,1,131,2,125,3,124,2,114,
+    32,116,3,160,4,124,3,100,4,161,2,125,4,110,5,124,
+    3,155,0,100,5,157,2,125,4,122,7,124,0,106,5,124,
+    4,25,0,125,5,87,0,110,10,4,0,116,6,121,54,1,
+    0,1,0,1,0,89,0,100,1,83,0,119,0,116,7,124,
+    0,106,8,124,5,131,2,160,9,161,0,83,0,41,6,122,
+    253,103,101,116,95,115,111,117,114,99,101,40,102,117,108,108,
+    110,97,109,101,41,32,45,62,32,115,111,117,114,99,101,32,
+    115,116,114,105,110,103,46,10,10,32,32,32,32,32,32,32,
+    32,82,101,116,117,114,110,32,116,104,101,32,115,111,117,114,
+    99,101,32,99,111,100,101,32,102,111,114,32,116,104,101,32,
+    115,112,101,99,105,102,105,101,100,32,109,111,100,117,108,101,
+    46,32,82,97,105,115,101,32,90,105,112,73,109,112,111,114,
+    116,69,114,114,111,114,10,32,32,32,32,32,32,32,32,105,
+    102,32,116,104,101,32,109,111,100,117,108,101,32,99,111,117,
+    108,100,110,39,116,32,98,101,32,102,111,117,110,100,44,32,
+    114,101,116,117,114,110,32,78,111,110,101,32,105,102,32,116,
+    104,101,32,97,114,99,104,105,118,101,32,100,111,101,115,10,
+    32,32,32,32,32,32,32,32,99,111,110,116,97,105,110,32,
+    116,104,101,32,109,111,100,117,108,101,44,32,98,117,116,32,
+    104,97,115,32,110,111,32,115,111,117,114,99,101,32,102,111,
+    114,32,105,116,46,10,32,32,32,32,32,32,32,32,78,250,
+    18,99,97,110,39,116,32,102,105,110,100,32,109,111,100,117,
+    108,101,32,169,1,114,47,0,0,0,250,11,95,95,105,110,
+    105,116,95,95,46,112,121,250,3,46,112,121,41,10,114,38,
+    0,0,0,114,3,0,0,0,114,39,0,0,0,114,21,0,
+    0,0,114,30,0,0,0,114,28,0,0,0,114,26,0,0,
+    0,114,59,0,0,0,114,29,0,0,0,218,6,100,101,99,
+    111,100,101,41,6,114,32,0,0,0,114,41,0,0,0,114,
+    42,0,0,0,114,13,0,0,0,218,8,102,117,108,108,112,
+    97,116,104,114,61,0,0,0,114,9,0,0,0,114,9,0,
+    0,0,114,10,0,0,0,218,10,103,101,116,95,115,111,117,
+    114,99,101,233,0,0,0,115,26,0,0,0,10,7,8,1,
+    18,1,10,2,4,1,14,1,10,2,2,2,14,1,12,1,
+    6,2,2,254,16,3,122,22,122,105,112,105,109,112,111,114,
+    116,101,114,46,103,101,116,95,115,111,117,114,99,101,99,2,
+    0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,4,
+    0,0,0,67,0,0,0,115,40,0,0,0,116,0,124,0,
+    124,1,131,2,125,2,124,2,100,1,117,0,114,18,116,1,
+    100,2,124,1,155,2,157,2,124,1,100,3,141,2,130,1,
+    124,2,83,0,41,4,122,171,105,115,95,112,97,99,107,97,
+    103,101,40,102,117,108,108,110,97,109,101,41,32,45,62,32,
+    98,111,111,108,46,10,10,32,32,32,32,32,32,32,32,82,
+    101,116,117,114,110,32,84,114,117,101,32,105,102,32,116,104,
+    101,32,109,111,100,117,108,101,32,115,112,101,99,105,102,105,
+    101,100,32,98,121,32,102,117,108,108,110,97,109,101,32,105,
+    115,32,97,32,112,97,99,107,97,103,101,46,10,32,32,32,
+    32,32,32,32,32,82,97,105,115,101,32,90,105,112,73,109,
+    112,111,114,116,69,114,114,111,114,32,105,102,32,116,104,101,
+    32,109,111,100,117,108,101,32,99,111,117,108,100,110,39,116,
+    32,98,101,32,102,111,117,110,100,46,10,32,32,32,32,32,
+    32,32,32,78,114,64,0,0,0,114,65,0,0,0,41,2,
+    114,38,0,0,0,114,3,0,0,0,41,3,114,32,0,0,
+    0,114,41,0,0,0,114,42,0,0,0,114,9,0,0,0,
+    114,9,0,0,0,114,10,0,0,0,114,46,0,0,0,3,
+    1,0,0,115,8,0,0,0,10,6,8,1,18,1,4,1,
+    122,22,122,105,112,105,109,112,111,114,116,101,114,46,105,115,
+    95,112,97,99,107,97,103,101,99,2,0,0,0,0,0,0,
+    0,0,0,0,0,9,0,0,0,8,0,0,0,67,0,0,
+    0,115,252,0,0,0,100,1,125,2,116,0,160,1,124,2,
+    116,2,161,2,1,0,116,3,124,0,124,1,131,2,92,3,
+    125,3,125,4,125,5,116,4,106,5,160,6,124,1,161,1,
+    125,6,124,6,100,2,117,0,115,31,116,7,124,6,116,8,
+    131,2,115,40,116,8,124,1,131,1,125,6,124,6,116,4,
+    106,5,124,1,60,0,124,0,124,6,95,9,122,42,124,4,
+    114,62,116,10,124,0,124,1,131,2,125,7,116,11,160,12,
+    124,0,106,13,124,7,161,2,125,8,124,8,103,1,124,6,
+    95,14,116,15,124,6,100,3,131,2,115,70,116,16,124,6,
+    95,16,116,11,160,17,124,6,106,18,124,1,124,5,161,3,
+    1,0,116,19,124,3,124,6,106,18,131,2,1,0,87,0,
+    110,8,1,0,1,0,1,0,116,4,106,5,124,1,61,0,
+    130,0,122,7,116,4,106,5,124,1,25,0,125,6,87,0,
+    110,15,4,0,116,20,121,116,1,0,1,0,1,0,116,21,
+    100,4,124,1,155,2,100,5,157,3,131,1,130,1,119,0,
+    116,22,160,23,100,6,124,1,124,5,161,3,1,0,124,6,
+    83,0,41,7,97,64,1,0,0,108,111,97,100,95,109,111,
+    100,117,108,101,40,102,117,108,108,110,97,109,101,41,32,45,
+    62,32,109,111,100,117,108,101,46,10,10,32,32,32,32,32,
+    32,32,32,76,111,97,100,32,116,104,101,32,109,111,100,117,
+    108,101,32,115,112,101,99,105,102,105,101,100,32,98,121,32,
+    39,102,117,108,108,110,97,109,101,39,46,32,39,102,117,108,
+    108,110,97,109,101,39,32,109,117,115,116,32,98,101,32,116,
+    104,101,10,32,32,32,32,32,32,32,32,102,117,108,108,121,
+    32,113,117,97,108,105,102,105,101,100,32,40,100,111,116,116,
+    101,100,41,32,109,111,100,117,108,101,32,110,97,109,101,46,
+    32,73,116,32,114,101,116,117,114,110,115,32,116,104,101,32,
+    105,109,112,111,114,116,101,100,10,32,32,32,32,32,32,32,
+    32,109,111,100,117,108,101,44,32,111,114,32,114,97,105,115,
+    101,115,32,90,105,112,73,109,112,111,114,116,69,114,114,111,
+    114,32,105,102,32,105,116,32,99,111,117,108,100,32,110,111,
+    116,32,98,101,32,105,109,112,111,114,116,101,100,46,10,10,
+    32,32,32,32,32,32,32,32,68,101,112,114,101,99,97,116,
+    101,100,32,115,105,110,99,101,32,80,121,116,104,111,110,32,
+    51,46,49,48,46,32,85,115,101,32,101,120,101,99,95,109,
+    111,100,117,108,101,40,41,32,105,110,115,116,101,97,100,46,
+    10,32,32,32,32,32,32,32,32,122,114,122,105,112,105,109,
+    112,111,114,116,46,122,105,112,105,109,112,111,114,116,101,114,
+    46,108,111,97,100,95,109,111,100,117,108,101,40,41,32,105,
+    115,32,100,101,112,114,101,99,97,116,101,100,32,97,110,100,
+    32,115,108,97,116,101,100,32,102,111,114,32,114,101,109,111,
+    118,97,108,32,105,110,32,80,121,116,104,111,110,32,51,46,
+    49,50,59,32,117,115,101,32,101,120,101,99,95,109,111,100,
+    117,108,101,40,41,32,105,110,115,116,101,97,100,78,218,12,
+    95,95,98,117,105,108,116,105,110,115,95,95,122,14,76,111,
+    97,100,101,100,32,109,111,100,117,108,101,32,122,25,32,110,
+    111,116,32,102,111,117,110,100,32,105,110,32,115,121,115,46,
+    109,111,100,117,108,101,115,122,30,105,109,112,111,114,116,32,
+    123,125,32,35,32,108,111,97,100,101,100,32,102,114,111,109,
+    32,90,105,112,32,123,125,41,24,114,35,0,0,0,114,36,
+    0,0,0,114,37,0,0,0,114,51,0,0,0,218,3,115,
+    121,115,218,7,109,111,100,117,108,101,115,218,3,103,101,116,
+    114,15,0,0,0,218,12,95,109,111,100,117,108,101,95,116,
+    121,112,101,218,10,95,95,108,111,97,100,101,114,95,95,114,
+    39,0,0,0,114,21,0,0,0,114,30,0,0,0,114,29,
+    0,0,0,90,8,95,95,112,97,116,104,95,95,218,7,104,
+    97,115,97,116,116,114,114,71,0,0,0,90,14,95,102,105,
+    120,95,117,112,95,109,111,100,117,108,101,218,8,95,95,100,
+    105,99,116,95,95,218,4,101,120,101,99,114,26,0,0,0,
+    218,11,73,109,112,111,114,116,69,114,114,111,114,114,48,0,
+    0,0,218,16,95,118,101,114,98,111,115,101,95,109,101,115,
+    115,97,103,101,41,9,114,32,0,0,0,114,41,0,0,0,
+    218,3,109,115,103,114,53,0,0,0,114,54,0,0,0,114,
+    43,0,0,0,90,3,109,111,100,114,13,0,0,0,114,69,
     0,0,0,114,9,0,0,0,114,9,0,0,0,114,10,0,
-    0,0,218,8,95,95,114,101,112,114,95,95,34,1,0,0,
-    115,2,0,0,0,0,1,122,20,122,105,112,105,109,112,111,
-    114,116,101,114,46,95,95,114,101,112,114,95,95,41,1,78,
-    41,1,78,41,15,114,6,0,0,0,114,7,0,0,0,114,
-    8,0,0,0,218,7,95,95,100,111,99,95,95,114,34,0,
-    0,0,114,41,0,0,0,114,42,0,0,0,114,48,0,0,
-    0,114,55,0,0,0,114,56,0,0,0,114,64,0,0,0,
-    114,65,0,0,0,114,78,0,0,0,114,82,0,0,0,114,
-    83,0,0,0,114,9,0,0,0,114,9,0,0,0,114,9,
-    0,0,0,114,10,0,0,0,114,4,0,0,0,45,0,0,
-    0,115,24,0,0,0,8,1,4,17,8,46,10,32,10,12,
-    8,10,8,21,8,11,8,26,8,13,8,38,8,18,122,12,
-    95,95,105,110,105,116,95,95,46,112,121,99,84,114,60,0,
-    0,0,70,41,3,122,4,46,112,121,99,84,70,41,3,114,
-    61,0,0,0,70,70,99,2,0,0,0,0,0,0,0,0,
-    0,0,0,2,0,0,0,4,0,0,0,67,0,0,0,115,
-    20,0,0,0,124,0,106,0,124,1,160,1,100,1,161,1,
-    100,2,25,0,23,0,83,0,41,3,78,218,1,46,233,2,
-    0,0,0,41,2,114,31,0,0,0,218,10,114,112,97,114,
-    116,105,116,105,111,110,41,2,114,32,0,0,0,114,38,0,
-    0,0,114,9,0,0,0,114,9,0,0,0,114,10,0,0,
-    0,114,36,0,0,0,52,1,0,0,115,2,0,0,0,0,
-    1,114,36,0,0,0,99,2,0,0,0,0,0,0,0,0,
-    0,0,0,3,0,0,0,2,0,0,0,67,0,0,0,115,
-    18,0,0,0,124,1,116,0,23,0,125,2,124,2,124,0,
-    106,1,118,0,83,0,169,1,78,41,2,114,20,0,0,0,
-    114,28,0,0,0,41,3,114,32,0,0,0,114,13,0,0,
-    0,90,7,100,105,114,112,97,116,104,114,9,0,0,0,114,
-    9,0,0,0,114,10,0,0,0,114,37,0,0,0,56,1,
-    0,0,115,4,0,0,0,0,4,8,2,114,37,0,0,0,
-    99,2,0,0,0,0,0,0,0,0,0,0,0,7,0,0,
-    0,4,0,0,0,67,0,0,0,115,56,0,0,0,116,0,
-    124,0,124,1,131,2,125,2,116,1,68,0,93,36,92,3,
-    125,3,125,4,125,5,124,2,124,3,23,0,125,6,124,6,
-    124,0,106,2,118,0,114,14,124,5,2,0,1,0,83,0,
-    113,14,100,0,83,0,114,88,0,0,0,41,3,114,36,0,
-    0,0,218,16,95,122,105,112,95,115,101,97,114,99,104,111,
-    114,100,101,114,114,28,0,0,0,41,7,114,32,0,0,0,
-    114,38,0,0,0,114,13,0,0,0,218,6,115,117,102,102,
-    105,120,218,10,105,115,98,121,116,101,99,111,100,101,114,47,
-    0,0,0,114,63,0,0,0,114,9,0,0,0,114,9,0,
-    0,0,114,10,0,0,0,114,35,0,0,0,65,1,0,0,
-    115,12,0,0,0,0,1,10,1,14,1,8,1,10,1,10,
-    1,114,35,0,0,0,99,1,0,0,0,0,0,0,0,0,
-    0,0,0,26,0,0,0,9,0,0,0,67,0,0,0,115,
-    2,5,0,0,122,14,116,0,160,1,124,0,161,1,125,1,
-    87,0,110,36,4,0,116,2,121,50,1,0,1,0,1,0,
-    116,3,100,1,124,0,155,2,157,2,124,0,100,2,141,2,
-    130,1,89,0,110,2,48,0,124,1,144,4,143,164,1,0,
-    122,36,124,1,160,4,116,5,11,0,100,3,161,2,1,0,
-    124,1,160,6,161,0,125,2,124,1,160,7,116,5,161,1,
-    125,3,87,0,110,36,4,0,116,2,121,132,1,0,1,0,
-    1,0,116,3,100,4,124,0,155,2,157,2,124,0,100,2,
-    141,2,130,1,89,0,110,2,48,0,116,8,124,3,131,1,
-    116,5,107,3,114,164,116,3,100,4,124,0,155,2,157,2,
+    0,0,218,11,108,111,97,100,95,109,111,100,117,108,101,16,
+    1,0,0,115,54,0,0,0,4,9,12,2,16,1,12,1,
+    18,1,8,1,10,1,6,1,2,2,4,1,10,3,14,1,
+    8,1,10,2,6,1,16,1,16,1,6,1,8,1,2,1,
+    2,2,14,1,12,1,16,1,2,255,14,2,4,1,122,23,
+    122,105,112,105,109,112,111,114,116,101,114,46,108,111,97,100,
+    95,109,111,100,117,108,101,99,2,0,0,0,0,0,0,0,
+    0,0,0,0,3,0,0,0,8,0,0,0,67,0,0,0,
+    115,64,0,0,0,122,10,124,0,160,0,124,1,161,1,115,
+    9,87,0,100,1,83,0,87,0,110,10,4,0,116,1,121,
+    20,1,0,1,0,1,0,89,0,100,1,83,0,119,0,100,
+    2,100,3,108,2,109,3,125,2,1,0,124,2,124,0,124,
+    1,131,2,83,0,41,4,122,204,82,101,116,117,114,110,32,
+    116,104,101,32,82,101,115,111,117,114,99,101,82,101,97,100,
+    101,114,32,102,111,114,32,97,32,112,97,99,107,97,103,101,
+    32,105,110,32,97,32,122,105,112,32,102,105,108,101,46,10,
+    10,32,32,32,32,32,32,32,32,73,102,32,39,102,117,108,
+    108,110,97,109,101,39,32,105,115,32,97,32,112,97,99,107,
+    97,103,101,32,119,105,116,104,105,110,32,116,104,101,32,122,
+    105,112,32,102,105,108,101,44,32,114,101,116,117,114,110,32,
+    116,104,101,10,32,32,32,32,32,32,32,32,39,82,101,115,
+    111,117,114,99,101,82,101,97,100,101,114,39,32,111,98,106,
+    101,99,116,32,102,111,114,32,116,104,101,32,112,97,99,107,
+    97,103,101,46,32,32,79,116,104,101,114,119,105,115,101,32,
+    114,101,116,117,114,110,32,78,111,110,101,46,10,32,32,32,
+    32,32,32,32,32,78,114,0,0,0,0,41,1,218,9,90,
+    105,112,82,101,97,100,101,114,41,4,114,46,0,0,0,114,
+    3,0,0,0,90,17,105,109,112,111,114,116,108,105,98,46,
+    114,101,97,100,101,114,115,114,84,0,0,0,41,3,114,32,
+    0,0,0,114,41,0,0,0,114,84,0,0,0,114,9,0,
+    0,0,114,9,0,0,0,114,10,0,0,0,218,19,103,101,
+    116,95,114,101,115,111,117,114,99,101,95,114,101,97,100,101,
+    114,59,1,0,0,115,18,0,0,0,2,6,10,1,6,1,
+    4,255,12,2,6,1,2,255,12,2,10,1,122,31,122,105,
+    112,105,109,112,111,114,116,101,114,46,103,101,116,95,114,101,
+    115,111,117,114,99,101,95,114,101,97,100,101,114,99,1,0,
+    0,0,0,0,0,0,0,0,0,0,1,0,0,0,8,0,
+    0,0,67,0,0,0,115,72,0,0,0,122,15,116,0,124,
+    0,106,1,131,1,124,0,95,2,124,0,106,2,116,3,124,
+    0,106,1,60,0,87,0,100,1,83,0,4,0,116,4,121,
+    35,1,0,1,0,1,0,116,3,160,5,124,0,106,1,100,
+    1,161,2,1,0,105,0,124,0,95,2,89,0,100,1,83,
+    0,119,0,41,2,122,41,82,101,108,111,97,100,32,116,104,
+    101,32,102,105,108,101,32,100,97,116,97,32,111,102,32,116,
+    104,101,32,97,114,99,104,105,118,101,32,112,97,116,104,46,
+    78,41,6,114,27,0,0,0,114,29,0,0,0,114,28,0,
+    0,0,114,25,0,0,0,114,3,0,0,0,218,3,112,111,
+    112,169,1,114,32,0,0,0,114,9,0,0,0,114,9,0,
+    0,0,114,10,0,0,0,218,17,105,110,118,97,108,105,100,
+    97,116,101,95,99,97,99,104,101,115,74,1,0,0,115,14,
+    0,0,0,2,2,12,1,18,1,12,1,14,1,12,1,2,
+    254,122,29,122,105,112,105,109,112,111,114,116,101,114,46,105,
+    110,118,97,108,105,100,97,116,101,95,99,97,99,104,101,115,
+    99,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,
+    0,5,0,0,0,67,0,0,0,115,24,0,0,0,100,1,
+    124,0,106,0,155,0,116,1,155,0,124,0,106,2,155,0,
+    100,2,157,5,83,0,41,3,78,122,21,60,122,105,112,105,
+    109,112,111,114,116,101,114,32,111,98,106,101,99,116,32,34,
+    122,2,34,62,41,3,114,29,0,0,0,114,20,0,0,0,
+    114,31,0,0,0,114,87,0,0,0,114,9,0,0,0,114,
+    9,0,0,0,114,10,0,0,0,218,8,95,95,114,101,112,
+    114,95,95,84,1,0,0,115,2,0,0,0,24,1,122,20,
+    122,105,112,105,109,112,111,114,116,101,114,46,95,95,114,101,
+    112,114,95,95,169,1,78,41,17,114,6,0,0,0,114,7,
+    0,0,0,114,8,0,0,0,218,7,95,95,100,111,99,95,
+    95,114,34,0,0,0,114,44,0,0,0,114,45,0,0,0,
+    114,49,0,0,0,114,55,0,0,0,114,62,0,0,0,114,
+    63,0,0,0,114,70,0,0,0,114,46,0,0,0,114,83,
+    0,0,0,114,85,0,0,0,114,88,0,0,0,114,89,0,
+    0,0,114,9,0,0,0,114,9,0,0,0,114,9,0,0,
+    0,114,10,0,0,0,114,4,0,0,0,46,0,0,0,115,
+    30,0,0,0,8,0,4,1,8,17,10,46,10,37,10,16,
+    8,27,8,10,8,21,8,12,8,26,8,13,8,43,8,15,
+    12,10,122,12,95,95,105,110,105,116,95,95,46,112,121,99,
+    84,114,66,0,0,0,70,41,3,122,4,46,112,121,99,84,
+    70,41,3,114,67,0,0,0,70,70,99,2,0,0,0,0,
+    0,0,0,0,0,0,0,2,0,0,0,4,0,0,0,67,
+    0,0,0,115,20,0,0,0,124,0,106,0,124,1,160,1,
+    100,1,161,1,100,2,25,0,23,0,83,0,41,3,78,218,
+    1,46,233,2,0,0,0,41,2,114,31,0,0,0,218,10,
+    114,112,97,114,116,105,116,105,111,110,41,2,114,32,0,0,
+    0,114,41,0,0,0,114,9,0,0,0,114,9,0,0,0,
+    114,10,0,0,0,114,39,0,0,0,102,1,0,0,115,2,
+    0,0,0,20,1,114,39,0,0,0,99,2,0,0,0,0,
+    0,0,0,0,0,0,0,3,0,0,0,2,0,0,0,67,
+    0,0,0,115,18,0,0,0,124,1,116,0,23,0,125,2,
+    124,2,124,0,106,1,118,0,83,0,114,90,0,0,0,41,
+    2,114,20,0,0,0,114,28,0,0,0,41,3,114,32,0,
+    0,0,114,13,0,0,0,90,7,100,105,114,112,97,116,104,
+    114,9,0,0,0,114,9,0,0,0,114,10,0,0,0,114,
+    40,0,0,0,106,1,0,0,115,4,0,0,0,8,4,10,
+    2,114,40,0,0,0,99,2,0,0,0,0,0,0,0,0,
+    0,0,0,7,0,0,0,4,0,0,0,67,0,0,0,115,
+    56,0,0,0,116,0,124,0,124,1,131,2,125,2,116,1,
+    68,0,93,18,92,3,125,3,125,4,125,5,124,2,124,3,
+    23,0,125,6,124,6,124,0,106,2,118,0,114,25,124,5,
+    2,0,1,0,83,0,113,7,100,0,83,0,114,90,0,0,
+    0,41,3,114,39,0,0,0,218,16,95,122,105,112,95,115,
+    101,97,114,99,104,111,114,100,101,114,114,28,0,0,0,41,
+    7,114,32,0,0,0,114,41,0,0,0,114,13,0,0,0,
+    218,6,115,117,102,102,105,120,218,10,105,115,98,121,116,101,
+    99,111,100,101,114,54,0,0,0,114,69,0,0,0,114,9,
+    0,0,0,114,9,0,0,0,114,10,0,0,0,114,38,0,
+    0,0,115,1,0,0,115,14,0,0,0,10,1,14,1,8,
+    1,10,1,8,1,2,255,4,2,114,38,0,0,0,99,1,
+    0,0,0,0,0,0,0,0,0,0,0,26,0,0,0,9,
+    0,0,0,67,0,0,0,115,220,4,0,0,122,7,116,0,
+    160,1,124,0,161,1,125,1,87,0,110,16,4,0,116,2,
+    121,23,1,0,1,0,1,0,116,3,100,1,124,0,155,2,
+    157,2,124,0,100,2,141,2,130,1,119,0,124,1,144,2,
+    143,65,1,0,122,18,124,1,160,4,116,5,11,0,100,3,
+    161,2,1,0,124,1,160,6,161,0,125,2,124,1,160,7,
+    116,5,161,1,125,3,87,0,110,16,4,0,116,2,121,62,
+    1,0,1,0,1,0,116,3,100,4,124,0,155,2,157,2,
+    124,0,100,2,141,2,130,1,119,0,116,8,124,3,131,1,
+    116,5,107,3,114,78,116,3,100,4,124,0,155,2,157,2,
     124,0,100,2,141,2,130,1,124,3,100,0,100,5,133,2,
-    25,0,116,9,107,3,144,1,114,170,122,24,124,1,160,4,
-    100,6,100,3,161,2,1,0,124,1,160,6,161,0,125,4,
-    87,0,110,36,4,0,116,2,121,242,1,0,1,0,1,0,
-    116,3,100,4,124,0,155,2,157,2,124,0,100,2,141,2,
-    130,1,89,0,110,2,48,0,116,10,124,4,116,11,24,0,
-    116,5,24,0,100,6,131,2,125,5,122,22,124,1,160,4,
-    124,5,161,1,1,0,124,1,160,7,161,0,125,6,87,0,
-    110,38,4,0,116,2,144,1,121,66,1,0,1,0,1,0,
-    116,3,100,4,124,0,155,2,157,2,124,0,100,2,141,2,
-    130,1,89,0,110,2,48,0,124,6,160,12,116,9,161,1,
-    125,7,124,7,100,6,107,0,144,1,114,106,116,3,100,7,
-    124,0,155,2,157,2,124,0,100,2,141,2,130,1,124,6,
-    124,7,124,7,116,5,23,0,133,2,25,0,125,3,116,8,
-    124,3,131,1,116,5,107,3,144,1,114,154,116,3,100,8,
+    25,0,116,9,107,3,114,201,122,12,124,1,160,4,100,6,
+    100,3,161,2,1,0,124,1,160,6,161,0,125,4,87,0,
+    110,16,4,0,116,2,121,114,1,0,1,0,1,0,116,3,
+    100,4,124,0,155,2,157,2,124,0,100,2,141,2,130,1,
+    119,0,116,10,124,4,116,11,24,0,116,5,24,0,100,6,
+    131,2,125,5,122,11,124,1,160,4,124,5,161,1,1,0,
+    124,1,160,7,161,0,125,6,87,0,110,16,4,0,116,2,
+    121,151,1,0,1,0,1,0,116,3,100,4,124,0,155,2,
+    157,2,124,0,100,2,141,2,130,1,119,0,124,6,160,12,
+    116,9,161,1,125,7,124,7,100,6,107,0,114,170,116,3,
+    100,7,124,0,155,2,157,2,124,0,100,2,141,2,130,1,
+    124,6,124,7,124,7,116,5,23,0,133,2,25,0,125,3,
+    116,8,124,3,131,1,116,5,107,3,114,193,116,3,100,8,
     124,0,155,2,157,2,124,0,100,2,141,2,130,1,124,4,
     116,8,124,6,131,1,24,0,124,7,23,0,125,2,116,13,
     124,3,100,9,100,10,133,2,25,0,131,1,125,8,116,13,
     124,3,100,10,100,11,133,2,25,0,131,1,125,9,124,2,
-    124,8,107,0,144,1,114,230,116,3,100,12,124,0,155,2,
-    157,2,124,0,100,2,141,2,130,1,124,2,124,9,107,0,
-    144,2,114,2,116,3,100,13,124,0,155,2,157,2,124,0,
-    100,2,141,2,130,1,124,2,124,8,56,0,125,2,124,2,
-    124,9,24,0,125,10,124,10,100,6,107,0,144,2,114,46,
-    116,3,100,14,124,0,155,2,157,2,124,0,100,2,141,2,
-    130,1,105,0,125,11,100,6,125,12,122,14,124,1,160,4,
-    124,2,161,1,1,0,87,0,110,38,4,0,116,2,144,2,
-    121,106,1,0,1,0,1,0,116,3,100,4,124,0,155,2,
-    157,2,124,0,100,2,141,2,130,1,89,0,110,2,48,0,
-    124,1,160,7,100,15,161,1,125,3,116,8,124,3,131,1,
-    100,5,107,0,144,2,114,140,116,14,100,16,131,1,130,1,
-    124,3,100,0,100,5,133,2,25,0,100,17,107,3,144,2,
-    114,162,144,4,113,208,116,8,124,3,131,1,100,15,107,3,
-    144,2,114,184,116,14,100,16,131,1,130,1,116,15,124,3,
-    100,18,100,19,133,2,25,0,131,1,125,13,116,15,124,3,
-    100,19,100,9,133,2,25,0,131,1,125,14,116,15,124,3,
-    100,9,100,20,133,2,25,0,131,1,125,15,116,15,124,3,
-    100,20,100,10,133,2,25,0,131,1,125,16,116,13,124,3,
-    100,10,100,11,133,2,25,0,131,1,125,17,116,13,124,3,
-    100,11,100,21,133,2,25,0,131,1,125,18,116,13,124,3,
-    100,21,100,22,133,2,25,0,131,1,125,4,116,15,124,3,
-    100,22,100,23,133,2,25,0,131,1,125,19,116,15,124,3,
-    100,23,100,24,133,2,25,0,131,1,125,20,116,15,124,3,
-    100,24,100,25,133,2,25,0,131,1,125,21,116,13,124,3,
-    100,26,100,15,133,2,25,0,131,1,125,22,124,19,124,20,
-    23,0,124,21,23,0,125,8,124,22,124,9,107,4,144,3,
-    114,144,116,3,100,27,124,0,155,2,157,2,124,0,100,2,
-    141,2,130,1,124,22,124,10,55,0,125,22,122,14,124,1,
-    160,7,124,19,161,1,125,23,87,0,110,38,4,0,116,2,
-    144,3,121,204,1,0,1,0,1,0,116,3,100,4,124,0,
-    155,2,157,2,124,0,100,2,141,2,130,1,89,0,110,2,
-    48,0,116,8,124,23,131,1,124,19,107,3,144,3,114,238,
-    116,3,100,4,124,0,155,2,157,2,124,0,100,2,141,2,
-    130,1,122,50,116,8,124,1,160,7,124,8,124,19,24,0,
-    161,1,131,1,124,8,124,19,24,0,107,3,144,4,114,30,
-    116,3,100,4,124,0,155,2,157,2,124,0,100,2,141,2,
-    130,1,87,0,110,38,4,0,116,2,144,4,121,70,1,0,
+    124,8,107,0,114,230,116,3,100,12,124,0,155,2,157,2,
+    124,0,100,2,141,2,130,1,124,2,124,9,107,0,114,243,
+    116,3,100,13,124,0,155,2,157,2,124,0,100,2,141,2,
+    130,1,124,2,124,8,56,0,125,2,124,2,124,9,24,0,
+    125,10,124,10,100,6,107,0,144,1,114,9,116,3,100,14,
+    124,0,155,2,157,2,124,0,100,2,141,2,130,1,105,0,
+    125,11,100,6,125,12,122,7,124,1,160,4,124,2,161,1,
+    1,0,87,0,110,17,4,0,116,2,144,1,121,37,1,0,
     1,0,1,0,116,3,100,4,124,0,155,2,157,2,124,0,
-    100,2,141,2,130,1,89,0,110,2,48,0,124,13,100,28,
-    64,0,144,4,114,92,124,23,160,16,161,0,125,23,110,52,
-    122,14,124,23,160,16,100,29,161,1,125,23,87,0,110,36,
-    4,0,116,17,144,4,121,142,1,0,1,0,1,0,124,23,
-    160,16,100,30,161,1,160,18,116,19,161,1,125,23,89,0,
-    110,2,48,0,124,23,160,20,100,31,116,21,161,2,125,23,
-    116,22,160,23,124,0,124,23,161,2,125,24,124,24,124,14,
-    124,18,124,4,124,22,124,15,124,16,124,17,102,8,125,25,
-    124,25,124,11,124,23,60,0,124,12,100,32,55,0,125,12,
-    144,2,113,108,87,0,100,0,4,0,4,0,131,3,1,0,
-    110,18,49,0,144,4,115,230,48,0,1,0,1,0,1,0,
-    89,0,1,0,116,24,160,25,100,33,124,12,124,0,161,3,
-    1,0,124,11,83,0,41,34,78,122,21,99,97,110,39,116,
-    32,111,112,101,110,32,90,105,112,32,102,105,108,101,58,32,
-    114,12,0,0,0,114,86,0,0,0,250,21,99,97,110,39,
-    116,32,114,101,97,100,32,90,105,112,32,102,105,108,101,58,
-    32,233,4,0,0,0,114,0,0,0,0,122,16,110,111,116,
-    32,97,32,90,105,112,32,102,105,108,101,58,32,122,18,99,
-    111,114,114,117,112,116,32,90,105,112,32,102,105,108,101,58,
-    32,233,12,0,0,0,233,16,0,0,0,233,20,0,0,0,
-    122,28,98,97,100,32,99,101,110,116,114,97,108,32,100,105,
-    114,101,99,116,111,114,121,32,115,105,122,101,58,32,122,30,
-    98,97,100,32,99,101,110,116,114,97,108,32,100,105,114,101,
-    99,116,111,114,121,32,111,102,102,115,101,116,58,32,122,38,
-    98,97,100,32,99,101,110,116,114,97,108,32,100,105,114,101,
-    99,116,111,114,121,32,115,105,122,101,32,111,114,32,111,102,
-    102,115,101,116,58,32,233,46,0,0,0,250,27,69,79,70,
-    32,114,101,97,100,32,119,104,101,114,101,32,110,111,116,32,
-    101,120,112,101,99,116,101,100,115,4,0,0,0,80,75,1,
-    2,233,8,0,0,0,233,10,0,0,0,233,14,0,0,0,
-    233,24,0,0,0,233,28,0,0,0,233,30,0,0,0,233,
-    32,0,0,0,233,34,0,0,0,233,42,0,0,0,122,25,
-    98,97,100,32,108,111,99,97,108,32,104,101,97,100,101,114,
-    32,111,102,102,115,101,116,58,32,105,0,8,0,0,218,5,
-    97,115,99,105,105,90,6,108,97,116,105,110,49,250,1,47,
-    114,5,0,0,0,122,33,122,105,112,105,109,112,111,114,116,
-    58,32,102,111,117,110,100,32,123,125,32,110,97,109,101,115,
-    32,105,110,32,123,33,114,125,41,26,218,3,95,105,111,218,
-    9,111,112,101,110,95,99,111,100,101,114,22,0,0,0,114,
-    3,0,0,0,218,4,115,101,101,107,218,20,69,78,68,95,
-    67,69,78,84,82,65,76,95,68,73,82,95,83,73,90,69,
-    90,4,116,101,108,108,218,4,114,101,97,100,114,51,0,0,
-    0,218,18,83,84,82,73,78,71,95,69,78,68,95,65,82,
-    67,72,73,86,69,218,3,109,97,120,218,15,77,65,88,95,
-    67,79,77,77,69,78,84,95,76,69,78,218,5,114,102,105,
-    110,100,114,2,0,0,0,218,8,69,79,70,69,114,114,111,
-    114,114,1,0,0,0,114,62,0,0,0,218,18,85,110,105,
-    99,111,100,101,68,101,99,111,100,101,69,114,114,111,114,218,
-    9,116,114,97,110,115,108,97,116,101,218,11,99,112,52,51,
-    55,95,116,97,98,108,101,114,19,0,0,0,114,20,0,0,
-    0,114,21,0,0,0,114,30,0,0,0,114,76,0,0,0,
-    114,77,0,0,0,41,26,114,29,0,0,0,218,2,102,112,
-    90,15,104,101,97,100,101,114,95,112,111,115,105,116,105,111,
-    110,218,6,98,117,102,102,101,114,218,9,102,105,108,101,95,
-    115,105,122,101,90,17,109,97,120,95,99,111,109,109,101,110,
-    116,95,115,116,97,114,116,218,4,100,97,116,97,90,3,112,
-    111,115,218,11,104,101,97,100,101,114,95,115,105,122,101,90,
-    13,104,101,97,100,101,114,95,111,102,102,115,101,116,90,10,
-    97,114,99,95,111,102,102,115,101,116,114,33,0,0,0,218,
-    5,99,111,117,110,116,218,5,102,108,97,103,115,218,8,99,
-    111,109,112,114,101,115,115,218,4,116,105,109,101,218,4,100,
-    97,116,101,218,3,99,114,99,218,9,100,97,116,97,95,115,
-    105,122,101,218,9,110,97,109,101,95,115,105,122,101,218,10,
-    101,120,116,114,97,95,115,105,122,101,90,12,99,111,109,109,
-    101,110,116,95,115,105,122,101,218,11,102,105,108,101,95,111,
-    102,102,115,101,116,114,59,0,0,0,114,13,0,0,0,218,
-    1,116,114,9,0,0,0,114,9,0,0,0,114,10,0,0,
-    0,114,27,0,0,0,96,1,0,0,115,212,0,0,0,0,
-    1,2,1,14,1,12,1,24,2,8,1,2,1,14,1,8,
-    1,14,1,12,1,24,1,12,1,18,1,18,3,2,1,12,
-    1,12,1,12,1,10,1,2,255,12,2,8,1,2,255,2,
-    1,2,255,4,2,2,1,10,1,12,1,14,1,10,1,2,
-    255,12,2,10,1,10,1,10,1,2,255,6,2,16,1,14,
-    1,10,1,2,255,6,2,16,2,16,1,16,1,10,1,18,
-    1,10,1,18,1,8,1,8,1,10,1,18,2,4,2,4,
-    1,2,1,14,1,14,1,24,2,10,1,14,1,8,2,18,
-    1,4,1,14,1,8,1,16,1,16,1,16,1,16,1,16,
-    1,16,1,16,1,16,1,16,1,16,1,16,1,12,1,10,
-    1,18,1,8,2,2,1,14,1,14,1,24,1,14,1,18,
-    4,2,1,28,1,22,1,14,1,24,2,10,2,10,3,2,
-    1,14,1,14,1,22,2,12,1,12,1,20,1,8,1,44,
-    1,14,1,114,27,0,0,0,117,190,1,0,0,0,1,2,
-    3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,
-    19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,
-    35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,
-    51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,
-    67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,
-    83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,
-    99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,
-    115,116,117,118,119,120,121,122,123,124,125,126,127,195,135,195,
-    188,195,169,195,162,195,164,195,160,195,165,195,167,195,170,195,
-    171,195,168,195,175,195,174,195,172,195,132,195,133,195,137,195,
-    166,195,134,195,180,195,182,195,178,195,187,195,185,195,191,195,
-    150,195,156,194,162,194,163,194,165,226,130,167,198,146,195,161,
-    195,173,195,179,195,186,195,177,195,145,194,170,194,186,194,191,
-    226,140,144,194,172,194,189,194,188,194,161,194,171,194,187,226,
-    150,145,226,150,146,226,150,147,226,148,130,226,148,164,226,149,
-    161,226,149,162,226,149,150,226,149,149,226,149,163,226,149,145,
-    226,149,151,226,149,157,226,149,156,226,149,155,226,148,144,226,
-    148,148,226,148,180,226,148,172,226,148,156,226,148,128,226,148,
-    188,226,149,158,226,149,159,226,149,154,226,149,148,226,149,169,
-    226,149,166,226,149,160,226,149,144,226,149,172,226,149,167,226,
-    149,168,226,149,164,226,149,165,226,149,153,226,149,152,226,149,
-    146,226,149,147,226,149,171,226,149,170,226,148,152,226,148,140,
-    226,150,136,226,150,132,226,150,140,226,150,144,226,150,128,206,
-    177,195,159,206,147,207,128,206,163,207,131,194,181,207,132,206,
-    166,206,152,206,169,206,180,226,136,158,207,134,206,181,226,136,
-    169,226,137,161,194,177,226,137,165,226,137,164,226,140,160,226,
-    140,161,195,183,226,137,136,194,176,226,136,153,194,183,226,136,
-    154,226,129,191,194,178,226,150,160,194,160,99,0,0,0,0,
-    0,0,0,0,0,0,0,0,1,0,0,0,8,0,0,0,
-    67,0,0,0,115,110,0,0,0,116,0,114,22,116,1,160,
-    2,100,1,161,1,1,0,116,3,100,2,131,1,130,1,100,
-    3,97,0,122,62,122,16,100,4,100,5,108,4,109,5,125,
-    0,1,0,87,0,110,36,4,0,116,6,121,80,1,0,1,
-    0,1,0,116,1,160,2,100,1,161,1,1,0,116,3,100,
-    2,131,1,130,1,89,0,110,2,48,0,87,0,100,6,97,
-    0,110,6,100,6,97,0,48,0,116,1,160,2,100,7,161,
-    1,1,0,124,0,83,0,41,8,78,122,27,122,105,112,105,
-    109,112,111,114,116,58,32,122,108,105,98,32,85,78,65,86,
-    65,73,76,65,66,76,69,250,41,99,97,110,39,116,32,100,
-    101,99,111,109,112,114,101,115,115,32,100,97,116,97,59,32,
-    122,108,105,98,32,110,111,116,32,97,118,97,105,108,97,98,
-    108,101,84,114,0,0,0,0,169,1,218,10,100,101,99,111,
-    109,112,114,101,115,115,70,122,25,122,105,112,105,109,112,111,
-    114,116,58,32,122,108,105,98,32,97,118,97,105,108,97,98,
-    108,101,41,7,218,15,95,105,109,112,111,114,116,105,110,103,
-    95,122,108,105,98,114,76,0,0,0,114,77,0,0,0,114,
-    3,0,0,0,90,4,122,108,105,98,114,141,0,0,0,218,
-    9,69,120,99,101,112,116,105,111,110,114,140,0,0,0,114,
-    9,0,0,0,114,9,0,0,0,114,10,0,0,0,218,20,
-    95,103,101,116,95,100,101,99,111,109,112,114,101,115,115,95,
-    102,117,110,99,254,1,0,0,115,24,0,0,0,0,2,4,
-    3,10,1,8,2,4,1,4,1,16,1,12,1,10,1,16,
-    2,12,2,10,1,114,144,0,0,0,99,2,0,0,0,0,
-    0,0,0,0,0,0,0,17,0,0,0,9,0,0,0,67,
-    0,0,0,115,144,1,0,0,124,1,92,8,125,2,125,3,
-    125,4,125,5,125,6,125,7,125,8,125,9,124,4,100,1,
-    107,0,114,36,116,0,100,2,131,1,130,1,116,1,160,2,
-    124,0,161,1,144,1,143,14,125,10,122,14,124,10,160,3,
-    124,6,161,1,1,0,87,0,110,36,4,0,116,4,121,100,
-    1,0,1,0,1,0,116,0,100,3,124,0,155,2,157,2,
-    124,0,100,4,141,2,130,1,89,0,110,2,48,0,124,10,
-    160,5,100,5,161,1,125,11,116,6,124,11,131,1,100,5,
-    107,3,114,132,116,7,100,6,131,1,130,1,124,11,100,0,
-    100,7,133,2,25,0,100,8,107,3,114,166,116,0,100,9,
-    124,0,155,2,157,2,124,0,100,4,141,2,130,1,116,8,
-    124,11,100,10,100,11,133,2,25,0,131,1,125,12,116,8,
-    124,11,100,11,100,5,133,2,25,0,131,1,125,13,100,5,
-    124,12,23,0,124,13,23,0,125,14,124,6,124,14,55,0,
-    125,6,122,14,124,10,160,3,124,6,161,1,1,0,87,0,
-    110,38,4,0,116,4,144,1,121,14,1,0,1,0,1,0,
-    116,0,100,3,124,0,155,2,157,2,124,0,100,4,141,2,
-    130,1,89,0,110,2,48,0,124,10,160,5,124,4,161,1,
-    125,15,116,6,124,15,131,1,124,4,107,3,144,1,114,48,
-    116,4,100,12,131,1,130,1,87,0,100,0,4,0,4,0,
-    131,3,1,0,110,18,49,0,144,1,115,70,48,0,1,0,
-    1,0,1,0,89,0,1,0,124,3,100,1,107,2,144,1,
-    114,94,124,15,83,0,122,10,116,9,131,0,125,16,87,0,
-    110,28,4,0,116,10,144,1,121,132,1,0,1,0,1,0,
-    116,0,100,13,131,1,130,1,89,0,110,2,48,0,124,16,
-    124,15,100,14,131,2,83,0,41,15,78,114,0,0,0,0,
-    122,18,110,101,103,97,116,105,118,101,32,100,97,116,97,32,
-    115,105,122,101,114,92,0,0,0,114,12,0,0,0,114,104,
-    0,0,0,114,98,0,0,0,114,93,0,0,0,115,4,0,
-    0,0,80,75,3,4,122,23,98,97,100,32,108,111,99,97,
-    108,32,102,105,108,101,32,104,101,97,100,101,114,58,32,233,
-    26,0,0,0,114,103,0,0,0,122,26,122,105,112,105,109,
-    112,111,114,116,58,32,99,97,110,39,116,32,114,101,97,100,
-    32,100,97,116,97,114,139,0,0,0,105,241,255,255,255,41,
-    11,114,3,0,0,0,114,110,0,0,0,114,111,0,0,0,
-    114,112,0,0,0,114,22,0,0,0,114,114,0,0,0,114,
-    51,0,0,0,114,119,0,0,0,114,1,0,0,0,114,144,
-    0,0,0,114,143,0,0,0,41,17,114,29,0,0,0,114,
-    54,0,0,0,90,8,100,97,116,97,112,97,116,104,114,130,
-    0,0,0,114,134,0,0,0,114,125,0,0,0,114,137,0,
-    0,0,114,131,0,0,0,114,132,0,0,0,114,133,0,0,
-    0,114,123,0,0,0,114,124,0,0,0,114,135,0,0,0,
-    114,136,0,0,0,114,127,0,0,0,90,8,114,97,119,95,
-    100,97,116,97,114,141,0,0,0,114,9,0,0,0,114,9,
-    0,0,0,114,10,0,0,0,114,52,0,0,0,19,2,0,
-    0,115,62,0,0,0,0,1,20,1,8,1,8,2,14,2,
-    2,1,14,1,12,1,24,1,10,1,12,1,8,2,16,2,
-    18,2,16,1,16,1,12,1,8,1,2,1,14,1,14,1,
-    24,1,10,1,14,1,40,2,10,2,4,3,2,1,10,1,
-    14,1,14,1,114,52,0,0,0,99,2,0,0,0,0,0,
-    0,0,0,0,0,0,2,0,0,0,3,0,0,0,67,0,
-    0,0,115,16,0,0,0,116,0,124,0,124,1,24,0,131,
-    1,100,1,107,1,83,0,41,2,78,114,5,0,0,0,41,
-    1,218,3,97,98,115,41,2,90,2,116,49,90,2,116,50,
-    114,9,0,0,0,114,9,0,0,0,114,10,0,0,0,218,
-    9,95,101,113,95,109,116,105,109,101,65,2,0,0,115,2,
-    0,0,0,0,2,114,147,0,0,0,99,5,0,0,0,0,
-    0,0,0,0,0,0,0,14,0,0,0,8,0,0,0,67,
-    0,0,0,115,56,1,0,0,124,3,124,2,100,1,156,2,
-    125,5,122,18,116,0,160,1,124,4,124,3,124,5,161,3,
-    125,6,87,0,110,20,4,0,116,2,121,48,1,0,1,0,
-    1,0,89,0,100,0,83,0,48,0,124,6,100,2,64,0,
-    100,3,107,3,125,7,124,7,114,178,124,6,100,4,64,0,
-    100,3,107,3,125,8,116,3,106,4,100,5,107,3,114,176,
-    124,8,115,102,116,3,106,4,100,6,107,2,114,176,116,5,
-    124,0,124,2,131,2,125,9,124,9,100,0,117,1,114,176,
-    116,3,160,6,116,0,106,7,124,9,161,2,125,10,122,20,
-    116,0,160,8,124,4,124,10,124,3,124,5,161,4,1,0,
-    87,0,110,20,4,0,116,2,121,174,1,0,1,0,1,0,
-    89,0,100,0,83,0,48,0,110,84,116,9,124,0,124,2,
-    131,2,92,2,125,11,125,12,124,11,144,1,114,6,116,10,
-    116,11,124,4,100,7,100,8,133,2,25,0,131,1,124,11,
-    131,2,114,242,116,11,124,4,100,8,100,9,133,2,25,0,
-    131,1,124,12,107,3,144,1,114,6,116,12,160,13,100,10,
-    124,3,155,2,157,2,161,1,1,0,100,0,83,0,116,14,
-    160,15,124,4,100,9,100,0,133,2,25,0,161,1,125,13,
-    116,16,124,13,116,17,131,2,144,1,115,52,116,18,100,11,
-    124,1,155,2,100,12,157,3,131,1,130,1,124,13,83,0,
-    41,13,78,41,2,114,59,0,0,0,114,13,0,0,0,114,
-    5,0,0,0,114,0,0,0,0,114,86,0,0,0,90,5,
-    110,101,118,101,114,90,6,97,108,119,97,121,115,114,99,0,
-    0,0,114,94,0,0,0,114,95,0,0,0,122,22,98,121,
-    116,101,99,111,100,101,32,105,115,32,115,116,97,108,101,32,
-    102,111,114,32,122,16,99,111,109,112,105,108,101,100,32,109,
-    111,100,117,108,101,32,122,21,32,105,115,32,110,111,116,32,
-    97,32,99,111,100,101,32,111,98,106,101,99,116,41,19,114,
-    21,0,0,0,90,13,95,99,108,97,115,115,105,102,121,95,
-    112,121,99,114,75,0,0,0,218,4,95,105,109,112,90,21,
+    100,2,141,2,130,1,119,0,9,0,124,1,160,7,100,16,
+    161,1,125,3,116,8,124,3,131,1,100,5,107,0,144,1,
+    114,55,116,14,100,17,131,1,130,1,124,3,100,0,100,5,
+    133,2,25,0,100,18,107,3,144,1,114,66,144,1,110,19,
+    116,8,124,3,131,1,100,16,107,3,144,1,114,77,116,14,
+    100,17,131,1,130,1,116,15,124,3,100,19,100,20,133,2,
+    25,0,131,1,125,13,116,15,124,3,100,20,100,9,133,2,
+    25,0,131,1,125,14,116,15,124,3,100,9,100,21,133,2,
+    25,0,131,1,125,15,116,15,124,3,100,21,100,10,133,2,
+    25,0,131,1,125,16,116,13,124,3,100,10,100,11,133,2,
+    25,0,131,1,125,17,116,13,124,3,100,11,100,22,133,2,
+    25,0,131,1,125,18,116,13,124,3,100,22,100,23,133,2,
+    25,0,131,1,125,4,116,15,124,3,100,23,100,24,133,2,
+    25,0,131,1,125,19,116,15,124,3,100,24,100,25,133,2,
+    25,0,131,1,125,20,116,15,124,3,100,25,100,26,133,2,
+    25,0,131,1,125,21,116,13,124,3,100,27,100,16,133,2,
+    25,0,131,1,125,22,124,19,124,20,23,0,124,21,23,0,
+    125,8,124,22,124,9,107,4,144,1,114,185,116,3,100,28,
+    124,0,155,2,157,2,124,0,100,2,141,2,130,1,124,22,
+    124,10,55,0,125,22,122,7,124,1,160,7,124,19,161,1,
+    125,23,87,0,110,17,4,0,116,2,144,1,121,213,1,0,
+    1,0,1,0,116,3,100,4,124,0,155,2,157,2,124,0,
+    100,2,141,2,130,1,119,0,116,8,124,23,131,1,124,19,
+    107,3,144,1,114,230,116,3,100,4,124,0,155,2,157,2,
+    124,0,100,2,141,2,130,1,122,25,116,8,124,1,160,7,
+    124,8,124,19,24,0,161,1,131,1,124,8,124,19,24,0,
+    107,3,144,1,114,254,116,3,100,4,124,0,155,2,157,2,
+    124,0,100,2,141,2,130,1,87,0,110,17,4,0,116,2,
+    144,2,121,16,1,0,1,0,1,0,116,3,100,4,124,0,
+    155,2,157,2,124,0,100,2,141,2,130,1,119,0,124,13,
+    100,29,64,0,144,2,114,27,124,23,160,16,161,0,125,23,
+    110,26,122,7,124,23,160,16,100,30,161,1,125,23,87,0,
+    110,18,4,0,116,17,144,2,121,52,1,0,1,0,1,0,
+    124,23,160,16,100,31,161,1,160,18,116,19,161,1,125,23,
+    89,0,110,1,119,0,124,23,160,20,100,32,116,21,161,2,
+    125,23,116,22,160,23,124,0,124,23,161,2,125,24,124,24,
+    124,14,124,18,124,4,124,22,124,15,124,16,124,17,102,8,
+    125,25,124,25,124,11,124,23,60,0,124,12,100,33,55,0,
+    125,12,144,1,113,39,87,0,100,0,4,0,4,0,131,3,
+    1,0,110,9,49,0,144,2,115,96,119,1,1,0,1,0,
+    1,0,89,0,1,0,116,24,160,25,100,34,124,12,124,0,
+    161,3,1,0,124,11,83,0,41,35,78,122,21,99,97,110,
+    39,116,32,111,112,101,110,32,90,105,112,32,102,105,108,101,
+    58,32,114,12,0,0,0,114,93,0,0,0,250,21,99,97,
+    110,39,116,32,114,101,97,100,32,90,105,112,32,102,105,108,
+    101,58,32,233,4,0,0,0,114,0,0,0,0,122,16,110,
+    111,116,32,97,32,90,105,112,32,102,105,108,101,58,32,122,
+    18,99,111,114,114,117,112,116,32,90,105,112,32,102,105,108,
+    101,58,32,233,12,0,0,0,233,16,0,0,0,233,20,0,
+    0,0,122,28,98,97,100,32,99,101,110,116,114,97,108,32,
+    100,105,114,101,99,116,111,114,121,32,115,105,122,101,58,32,
+    122,30,98,97,100,32,99,101,110,116,114,97,108,32,100,105,
+    114,101,99,116,111,114,121,32,111,102,102,115,101,116,58,32,
+    122,38,98,97,100,32,99,101,110,116,114,97,108,32,100,105,
+    114,101,99,116,111,114,121,32,115,105,122,101,32,111,114,32,
+    111,102,102,115,101,116,58,32,84,233,46,0,0,0,250,27,
+    69,79,70,32,114,101,97,100,32,119,104,101,114,101,32,110,
+    111,116,32,101,120,112,101,99,116,101,100,115,4,0,0,0,
+    80,75,1,2,233,8,0,0,0,233,10,0,0,0,233,14,
+    0,0,0,233,24,0,0,0,233,28,0,0,0,233,30,0,
+    0,0,233,32,0,0,0,233,34,0,0,0,233,42,0,0,
+    0,122,25,98,97,100,32,108,111,99,97,108,32,104,101,97,
+    100,101,114,32,111,102,102,115,101,116,58,32,105,0,8,0,
+    0,218,5,97,115,99,105,105,90,6,108,97,116,105,110,49,
+    250,1,47,114,5,0,0,0,122,33,122,105,112,105,109,112,
+    111,114,116,58,32,102,111,117,110,100,32,123,125,32,110,97,
+    109,101,115,32,105,110,32,123,33,114,125,41,26,218,3,95,
+    105,111,218,9,111,112,101,110,95,99,111,100,101,114,22,0,
+    0,0,114,3,0,0,0,218,4,115,101,101,107,218,20,69,
+    78,68,95,67,69,78,84,82,65,76,95,68,73,82,95,83,
+    73,90,69,90,4,116,101,108,108,218,4,114,101,97,100,114,
+    58,0,0,0,218,18,83,84,82,73,78,71,95,69,78,68,
+    95,65,82,67,72,73,86,69,218,3,109,97,120,218,15,77,
+    65,88,95,67,79,77,77,69,78,84,95,76,69,78,218,5,
+    114,102,105,110,100,114,2,0,0,0,218,8,69,79,70,69,
+    114,114,111,114,114,1,0,0,0,114,68,0,0,0,218,18,
+    85,110,105,99,111,100,101,68,101,99,111,100,101,69,114,114,
+    111,114,218,9,116,114,97,110,115,108,97,116,101,218,11,99,
+    112,52,51,55,95,116,97,98,108,101,114,19,0,0,0,114,
+    20,0,0,0,114,21,0,0,0,114,30,0,0,0,114,48,
+    0,0,0,114,81,0,0,0,41,26,114,29,0,0,0,218,
+    2,102,112,90,15,104,101,97,100,101,114,95,112,111,115,105,
+    116,105,111,110,218,6,98,117,102,102,101,114,218,9,102,105,
+    108,101,95,115,105,122,101,90,17,109,97,120,95,99,111,109,
+    109,101,110,116,95,115,116,97,114,116,218,4,100,97,116,97,
+    90,3,112,111,115,218,11,104,101,97,100,101,114,95,115,105,
+    122,101,90,13,104,101,97,100,101,114,95,111,102,102,115,101,
+    116,90,10,97,114,99,95,111,102,102,115,101,116,114,33,0,
+    0,0,218,5,99,111,117,110,116,218,5,102,108,97,103,115,
+    218,8,99,111,109,112,114,101,115,115,218,4,116,105,109,101,
+    218,4,100,97,116,101,218,3,99,114,99,218,9,100,97,116,
+    97,95,115,105,122,101,218,9,110,97,109,101,95,115,105,122,
+    101,218,10,101,120,116,114,97,95,115,105,122,101,90,12,99,
+    111,109,109,101,110,116,95,115,105,122,101,218,11,102,105,108,
+    101,95,111,102,102,115,101,116,114,47,0,0,0,114,13,0,
+    0,0,218,1,116,114,9,0,0,0,114,9,0,0,0,114,
+    10,0,0,0,114,27,0,0,0,146,1,0,0,115,238,0,
+    0,0,2,1,14,1,12,1,18,1,2,255,8,3,2,1,
+    14,1,8,1,14,1,12,1,18,1,2,255,12,2,18,1,
+    16,1,2,3,12,1,12,1,12,1,10,1,2,1,6,255,
+    2,255,8,3,2,1,2,255,2,1,4,255,2,2,10,1,
+    12,1,12,1,10,1,2,1,6,255,2,255,10,3,8,1,
+    10,1,2,1,6,255,16,2,12,1,10,1,2,1,6,255,
+    16,2,16,2,16,1,8,1,18,1,8,1,18,1,8,1,
+    8,1,10,1,18,1,4,2,4,2,2,1,14,1,14,1,
+    18,1,2,255,2,2,10,1,14,1,8,1,18,2,4,1,
+    14,1,8,1,16,1,16,1,16,1,16,1,16,1,16,1,
+    16,1,16,1,16,1,16,1,16,1,12,1,10,1,18,1,
+    8,1,2,2,14,1,14,1,18,1,2,255,14,2,18,1,
+    2,4,28,1,18,1,4,255,14,2,18,1,2,255,10,3,
+    10,2,2,3,14,1,14,1,20,1,2,255,12,3,12,1,
+    20,1,8,1,8,1,4,202,2,6,30,196,14,109,4,1,
+    114,27,0,0,0,117,190,1,0,0,0,1,2,3,4,5,
+    6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,
+    22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,
+    38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,
+    54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,
+    70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,
+    86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,
+    102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,
+    118,119,120,121,122,123,124,125,126,127,195,135,195,188,195,169,
+    195,162,195,164,195,160,195,165,195,167,195,170,195,171,195,168,
+    195,175,195,174,195,172,195,132,195,133,195,137,195,166,195,134,
+    195,180,195,182,195,178,195,187,195,185,195,191,195,150,195,156,
+    194,162,194,163,194,165,226,130,167,198,146,195,161,195,173,195,
+    179,195,186,195,177,195,145,194,170,194,186,194,191,226,140,144,
+    194,172,194,189,194,188,194,161,194,171,194,187,226,150,145,226,
+    150,146,226,150,147,226,148,130,226,148,164,226,149,161,226,149,
+    162,226,149,150,226,149,149,226,149,163,226,149,145,226,149,151,
+    226,149,157,226,149,156,226,149,155,226,148,144,226,148,148,226,
+    148,180,226,148,172,226,148,156,226,148,128,226,148,188,226,149,
+    158,226,149,159,226,149,154,226,149,148,226,149,169,226,149,166,
+    226,149,160,226,149,144,226,149,172,226,149,167,226,149,168,226,
+    149,164,226,149,165,226,149,153,226,149,152,226,149,146,226,149,
+    147,226,149,171,226,149,170,226,148,152,226,148,140,226,150,136,
+    226,150,132,226,150,140,226,150,144,226,150,128,206,177,195,159,
+    206,147,207,128,206,163,207,131,194,181,207,132,206,166,206,152,
+    206,169,206,180,226,136,158,207,134,206,181,226,136,169,226,137,
+    161,194,177,226,137,165,226,137,164,226,140,160,226,140,161,195,
+    183,226,137,136,194,176,226,136,153,194,183,226,136,154,226,129,
+    191,194,178,226,150,160,194,160,99,0,0,0,0,0,0,0,
+    0,0,0,0,0,1,0,0,0,8,0,0,0,67,0,0,
+    0,115,106,0,0,0,116,0,114,11,116,1,160,2,100,1,
+    161,1,1,0,116,3,100,2,131,1,130,1,100,3,97,0,
+    122,29,122,8,100,4,100,5,108,4,109,5,125,0,1,0,
+    87,0,110,16,4,0,116,6,121,38,1,0,1,0,1,0,
+    116,1,160,2,100,1,161,1,1,0,116,3,100,2,131,1,
+    130,1,119,0,87,0,100,6,97,0,110,3,100,6,97,0,
+    119,0,116,1,160,2,100,7,161,1,1,0,124,0,83,0,
+    41,8,78,122,27,122,105,112,105,109,112,111,114,116,58,32,
+    122,108,105,98,32,85,78,65,86,65,73,76,65,66,76,69,
+    250,41,99,97,110,39,116,32,100,101,99,111,109,112,114,101,
+    115,115,32,100,97,116,97,59,32,122,108,105,98,32,110,111,
+    116,32,97,118,97,105,108,97,98,108,101,84,114,0,0,0,
+    0,169,1,218,10,100,101,99,111,109,112,114,101,115,115,70,
+    122,25,122,105,112,105,109,112,111,114,116,58,32,122,108,105,
+    98,32,97,118,97,105,108,97,98,108,101,41,7,218,15,95,
+    105,109,112,111,114,116,105,110,103,95,122,108,105,98,114,48,
+    0,0,0,114,81,0,0,0,114,3,0,0,0,90,4,122,
+    108,105,98,114,147,0,0,0,218,9,69,120,99,101,112,116,
+    105,111,110,114,146,0,0,0,114,9,0,0,0,114,9,0,
+    0,0,114,10,0,0,0,218,20,95,103,101,116,95,100,101,
+    99,111,109,112,114,101,115,115,95,102,117,110,99,48,2,0,
+    0,115,28,0,0,0,4,2,10,3,8,1,4,2,4,1,
+    16,1,12,1,10,1,8,1,2,254,2,255,12,5,10,2,
+    4,1,114,150,0,0,0,99,2,0,0,0,0,0,0,0,
+    0,0,0,0,17,0,0,0,9,0,0,0,67,0,0,0,
+    115,120,1,0,0,124,1,92,8,125,2,125,3,125,4,125,
+    5,125,6,125,7,125,8,125,9,124,4,100,1,107,0,114,
+    18,116,0,100,2,131,1,130,1,116,1,160,2,124,0,161,
+    1,143,129,125,10,122,7,124,10,160,3,124,6,161,1,1,
+    0,87,0,110,16,4,0,116,4,121,47,1,0,1,0,1,
+    0,116,0,100,3,124,0,155,2,157,2,124,0,100,4,141,
+    2,130,1,119,0,124,10,160,5,100,5,161,1,125,11,116,
+    6,124,11,131,1,100,5,107,3,114,63,116,7,100,6,131,
+    1,130,1,124,11,100,0,100,7,133,2,25,0,100,8,107,
+    3,114,80,116,0,100,9,124,0,155,2,157,2,124,0,100,
+    4,141,2,130,1,116,8,124,11,100,10,100,11,133,2,25,
+    0,131,1,125,12,116,8,124,11,100,11,100,5,133,2,25,
+    0,131,1,125,13,100,5,124,12,23,0,124,13,23,0,125,
+    14,124,6,124,14,55,0,125,6,122,7,124,10,160,3,124,
+    6,161,1,1,0,87,0,110,16,4,0,116,4,121,129,1,
+    0,1,0,1,0,116,0,100,3,124,0,155,2,157,2,124,
+    0,100,4,141,2,130,1,119,0,124,10,160,5,124,4,161,
+    1,125,15,116,6,124,15,131,1,124,4,107,3,114,145,116,
+    4,100,12,131,1,130,1,87,0,100,0,4,0,4,0,131,
+    3,1,0,110,8,49,0,115,155,119,1,1,0,1,0,1,
+    0,89,0,1,0,124,3,100,1,107,2,114,166,124,15,83,
+    0,122,5,116,9,131,0,125,16,87,0,110,11,4,0,116,
+    10,121,182,1,0,1,0,1,0,116,0,100,13,131,1,130,
+    1,119,0,124,16,124,15,100,14,131,2,83,0,41,15,78,
+    114,0,0,0,0,122,18,110,101,103,97,116,105,118,101,32,
+    100,97,116,97,32,115,105,122,101,114,98,0,0,0,114,12,
+    0,0,0,114,110,0,0,0,114,104,0,0,0,114,99,0,
+    0,0,115,4,0,0,0,80,75,3,4,122,23,98,97,100,
+    32,108,111,99,97,108,32,102,105,108,101,32,104,101,97,100,
+    101,114,58,32,233,26,0,0,0,114,109,0,0,0,122,26,
+    122,105,112,105,109,112,111,114,116,58,32,99,97,110,39,116,
+    32,114,101,97,100,32,100,97,116,97,114,145,0,0,0,105,
+    241,255,255,255,41,11,114,3,0,0,0,114,116,0,0,0,
+    114,117,0,0,0,114,118,0,0,0,114,22,0,0,0,114,
+    120,0,0,0,114,58,0,0,0,114,125,0,0,0,114,1,
+    0,0,0,114,150,0,0,0,114,149,0,0,0,41,17,114,
+    29,0,0,0,114,61,0,0,0,90,8,100,97,116,97,112,
+    97,116,104,114,136,0,0,0,114,140,0,0,0,114,131,0,
+    0,0,114,143,0,0,0,114,137,0,0,0,114,138,0,0,
+    0,114,139,0,0,0,114,129,0,0,0,114,130,0,0,0,
+    114,141,0,0,0,114,142,0,0,0,114,133,0,0,0,90,
+    8,114,97,119,95,100,97,116,97,114,147,0,0,0,114,9,
+    0,0,0,114,9,0,0,0,114,10,0,0,0,114,59,0,
+    0,0,69,2,0,0,115,72,0,0,0,20,1,8,1,8,
+    1,12,2,2,2,14,1,12,1,18,1,2,255,10,2,12,
+    1,8,1,16,2,18,2,16,2,16,1,12,1,8,1,2,
+    1,14,1,12,1,18,1,2,255,10,2,12,1,8,1,2,
+    255,28,233,8,26,4,2,2,3,10,1,12,1,8,1,2,
+    255,10,2,114,59,0,0,0,99,2,0,0,0,0,0,0,
+    0,0,0,0,0,2,0,0,0,3,0,0,0,67,0,0,
+    0,115,16,0,0,0,116,0,124,0,124,1,24,0,131,1,
+    100,1,107,1,83,0,41,2,78,114,5,0,0,0,41,1,
+    218,3,97,98,115,41,2,90,2,116,49,90,2,116,50,114,
+    9,0,0,0,114,9,0,0,0,114,10,0,0,0,218,9,
+    95,101,113,95,109,116,105,109,101,115,2,0,0,115,2,0,
+    0,0,16,2,114,153,0,0,0,99,5,0,0,0,0,0,
+    0,0,0,0,0,0,14,0,0,0,6,0,0,0,67,0,
+    0,0,115,254,0,0,0,124,3,124,2,100,1,156,2,125,
+    5,116,0,160,1,124,4,124,3,124,5,161,3,125,6,124,
+    6,100,2,64,0,100,3,107,3,125,7,124,7,114,63,124,
+    6,100,4,64,0,100,3,107,3,125,8,116,2,106,3,100,
+    5,107,3,114,62,124,8,115,38,116,2,106,3,100,6,107,
+    2,114,62,116,4,124,0,124,2,131,2,125,9,124,9,100,
+    0,117,1,114,62,116,2,160,5,116,0,106,6,124,9,161,
+    2,125,10,116,0,160,7,124,4,124,10,124,3,124,5,161,
+    4,1,0,110,40,116,8,124,0,124,2,131,2,92,2,125,
+    11,125,12,124,11,114,103,116,9,116,10,124,4,100,7,100,
+    8,133,2,25,0,131,1,124,11,131,2,114,93,116,10,124,
+    4,100,8,100,9,133,2,25,0,131,1,124,12,107,3,114,
+    103,116,11,160,12,100,10,124,3,155,2,157,2,161,1,1,
+    0,100,0,83,0,116,13,160,14,124,4,100,9,100,0,133,
+    2,25,0,161,1,125,13,116,15,124,13,116,16,131,2,115,
+    125,116,17,100,11,124,1,155,2,100,12,157,3,131,1,130,
+    1,124,13,83,0,41,13,78,41,2,114,47,0,0,0,114,
+    13,0,0,0,114,5,0,0,0,114,0,0,0,0,114,93,
+    0,0,0,90,5,110,101,118,101,114,90,6,97,108,119,97,
+    121,115,114,105,0,0,0,114,100,0,0,0,114,101,0,0,
+    0,122,22,98,121,116,101,99,111,100,101,32,105,115,32,115,
+    116,97,108,101,32,102,111,114,32,122,16,99,111,109,112,105,
+    108,101,100,32,109,111,100,117,108,101,32,122,21,32,105,115,
+    32,110,111,116,32,97,32,99,111,100,101,32,111,98,106,101,
+    99,116,41,18,114,21,0,0,0,90,13,95,99,108,97,115,
+    115,105,102,121,95,112,121,99,218,4,95,105,109,112,90,21,
     99,104,101,99,107,95,104,97,115,104,95,98,97,115,101,100,
     95,112,121,99,115,218,15,95,103,101,116,95,112,121,99,95,
     115,111,117,114,99,101,218,11,115,111,117,114,99,101,95,104,
@@ -821,259 +907,157 @@
     78,85,77,66,69,82,90,18,95,118,97,108,105,100,97,116,
     101,95,104,97,115,104,95,112,121,99,218,29,95,103,101,116,
     95,109,116,105,109,101,95,97,110,100,95,115,105,122,101,95,
-    111,102,95,115,111,117,114,99,101,114,147,0,0,0,114,2,
-    0,0,0,114,76,0,0,0,114,77,0,0,0,218,7,109,
+    111,102,95,115,111,117,114,99,101,114,153,0,0,0,114,2,
+    0,0,0,114,48,0,0,0,114,81,0,0,0,218,7,109,
     97,114,115,104,97,108,90,5,108,111,97,100,115,114,15,0,
     0,0,218,10,95,99,111,100,101,95,116,121,112,101,218,9,
     84,121,112,101,69,114,114,111,114,41,14,114,32,0,0,0,
-    114,53,0,0,0,114,63,0,0,0,114,38,0,0,0,114,
-    126,0,0,0,90,11,101,120,99,95,100,101,116,97,105,108,
-    115,114,129,0,0,0,90,10,104,97,115,104,95,98,97,115,
+    114,60,0,0,0,114,69,0,0,0,114,41,0,0,0,114,
+    132,0,0,0,90,11,101,120,99,95,100,101,116,97,105,108,
+    115,114,135,0,0,0,90,10,104,97,115,104,95,98,97,115,
     101,100,90,12,99,104,101,99,107,95,115,111,117,114,99,101,
-    90,12,115,111,117,114,99,101,95,98,121,116,101,115,114,150,
+    90,12,115,111,117,114,99,101,95,98,121,116,101,115,114,156,
     0,0,0,90,12,115,111,117,114,99,101,95,109,116,105,109,
-    101,90,11,115,111,117,114,99,101,95,115,105,122,101,114,46,
+    101,90,11,115,111,117,114,99,101,95,115,105,122,101,114,53,
     0,0,0,114,9,0,0,0,114,9,0,0,0,114,10,0,
     0,0,218,15,95,117,110,109,97,114,115,104,97,108,95,99,
-    111,100,101,75,2,0,0,115,82,0,0,0,0,2,2,1,
-    2,254,6,5,2,1,18,1,12,1,8,2,12,1,4,1,
-    12,1,10,1,2,255,2,1,8,255,2,2,10,1,8,1,
-    4,1,4,1,2,254,4,5,2,1,4,1,8,255,8,2,
-    12,1,10,3,8,255,6,3,6,3,22,1,18,255,4,2,
-    4,1,8,255,4,2,4,2,18,1,12,1,16,1,114,155,
-    0,0,0,99,1,0,0,0,0,0,0,0,0,0,0,0,
-    1,0,0,0,4,0,0,0,67,0,0,0,115,28,0,0,
-    0,124,0,160,0,100,1,100,2,161,2,125,0,124,0,160,
-    0,100,3,100,2,161,2,125,0,124,0,83,0,41,4,78,
-    115,2,0,0,0,13,10,243,1,0,0,0,10,243,1,0,
-    0,0,13,41,1,114,19,0,0,0,41,1,218,6,115,111,
-    117,114,99,101,114,9,0,0,0,114,9,0,0,0,114,10,
-    0,0,0,218,23,95,110,111,114,109,97,108,105,122,101,95,
-    108,105,110,101,95,101,110,100,105,110,103,115,126,2,0,0,
-    115,6,0,0,0,0,1,12,1,12,1,114,159,0,0,0,
-    99,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,
-    0,6,0,0,0,67,0,0,0,115,24,0,0,0,116,0,
-    124,1,131,1,125,1,116,1,124,1,124,0,100,1,100,2,
-    100,3,141,4,83,0,41,4,78,114,74,0,0,0,84,41,
-    1,90,12,100,111,110,116,95,105,110,104,101,114,105,116,41,
-    2,114,159,0,0,0,218,7,99,111,109,112,105,108,101,41,
-    2,114,53,0,0,0,114,158,0,0,0,114,9,0,0,0,
-    114,9,0,0,0,114,10,0,0,0,218,15,95,99,111,109,
-    112,105,108,101,95,115,111,117,114,99,101,133,2,0,0,115,
-    4,0,0,0,0,1,8,1,114,161,0,0,0,99,2,0,
-    0,0,0,0,0,0,0,0,0,0,2,0,0,0,11,0,
-    0,0,67,0,0,0,115,68,0,0,0,116,0,160,1,124,
-    0,100,1,63,0,100,2,23,0,124,0,100,3,63,0,100,
-    4,64,0,124,0,100,5,64,0,124,1,100,6,63,0,124,
-    1,100,3,63,0,100,7,64,0,124,1,100,5,64,0,100,
-    8,20,0,100,9,100,9,100,9,102,9,161,1,83,0,41,
-    10,78,233,9,0,0,0,105,188,7,0,0,233,5,0,0,
-    0,233,15,0,0,0,233,31,0,0,0,233,11,0,0,0,
-    233,63,0,0,0,114,86,0,0,0,114,14,0,0,0,41,
-    2,114,131,0,0,0,90,6,109,107,116,105,109,101,41,2,
-    218,1,100,114,138,0,0,0,114,9,0,0,0,114,9,0,
-    0,0,114,10,0,0,0,218,14,95,112,97,114,115,101,95,
-    100,111,115,116,105,109,101,139,2,0,0,115,18,0,0,0,
-    0,1,4,1,10,1,10,1,6,1,6,1,10,1,10,1,
-    6,249,114,169,0,0,0,99,2,0,0,0,0,0,0,0,
-    0,0,0,0,6,0,0,0,10,0,0,0,67,0,0,0,
-    115,114,0,0,0,122,82,124,1,100,1,100,0,133,2,25,
-    0,100,2,118,0,115,22,74,0,130,1,124,1,100,0,100,
-    1,133,2,25,0,125,1,124,0,106,0,124,1,25,0,125,
-    2,124,2,100,3,25,0,125,3,124,2,100,4,25,0,125,
-    4,124,2,100,5,25,0,125,5,116,1,124,4,124,3,131,
-    2,124,5,102,2,87,0,83,0,4,0,116,2,116,3,116,
-    4,102,3,121,108,1,0,1,0,1,0,89,0,100,6,83,
-    0,48,0,100,0,83,0,41,7,78,114,14,0,0,0,169,
-    2,218,1,99,218,1,111,114,163,0,0,0,233,6,0,0,
-    0,233,3,0,0,0,41,2,114,0,0,0,0,114,0,0,
-    0,0,41,5,114,28,0,0,0,114,169,0,0,0,114,26,
-    0,0,0,218,10,73,110,100,101,120,69,114,114,111,114,114,
-    154,0,0,0,41,6,114,32,0,0,0,114,13,0,0,0,
-    114,54,0,0,0,114,131,0,0,0,114,132,0,0,0,90,
-    17,117,110,99,111,109,112,114,101,115,115,101,100,95,115,105,
-    122,101,114,9,0,0,0,114,9,0,0,0,114,10,0,0,
-    0,114,151,0,0,0,152,2,0,0,115,20,0,0,0,0,
-    1,2,2,20,1,12,1,10,3,8,1,8,1,8,1,16,
-    1,18,1,114,151,0,0,0,99,2,0,0,0,0,0,0,
-    0,0,0,0,0,3,0,0,0,8,0,0,0,67,0,0,
-    0,115,84,0,0,0,124,1,100,1,100,0,133,2,25,0,
-    100,2,118,0,115,20,74,0,130,1,124,1,100,0,100,1,
-    133,2,25,0,125,1,122,14,124,0,106,0,124,1,25,0,
-    125,2,87,0,110,20,4,0,116,1,121,66,1,0,1,0,
-    1,0,89,0,100,0,83,0,48,0,116,2,124,0,106,3,
-    124,2,131,2,83,0,100,0,83,0,41,3,78,114,14,0,
-    0,0,114,170,0,0,0,41,4,114,28,0,0,0,114,26,
-    0,0,0,114,52,0,0,0,114,29,0,0,0,41,3,114,
-    32,0,0,0,114,13,0,0,0,114,54,0,0,0,114,9,
-    0,0,0,114,9,0,0,0,114,10,0,0,0,114,149,0,
-    0,0,171,2,0,0,115,14,0,0,0,0,2,20,1,12,
-    2,2,1,14,1,12,1,8,2,114,149,0,0,0,99,2,
-    0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,9,
-    0,0,0,67,0,0,0,115,196,0,0,0,116,0,124,0,
-    124,1,131,2,125,2,116,1,68,0,93,158,92,3,125,3,
-    125,4,125,5,124,2,124,3,23,0,125,6,116,2,106,3,
-    100,1,124,0,106,4,116,5,124,6,100,2,100,3,141,5,
-    1,0,122,14,124,0,106,6,124,6,25,0,125,7,87,0,
-    110,18,4,0,116,7,121,86,1,0,1,0,1,0,89,0,
-    113,14,48,0,124,7,100,4,25,0,125,8,116,8,124,0,
-    106,4,124,7,131,2,125,9,124,4,114,130,116,9,124,0,
-    124,8,124,6,124,1,124,9,131,5,125,10,110,10,116,10,
-    124,8,124,9,131,2,125,10,124,10,100,0,117,0,114,150,
-    113,14,124,7,100,4,25,0,125,8,124,10,124,5,124,8,
-    102,3,2,0,1,0,83,0,113,14,116,11,100,5,124,1,
-    155,2,157,2,124,1,100,6,141,2,130,1,100,0,83,0,
-    41,7,78,122,13,116,114,121,105,110,103,32,123,125,123,125,
-    123,125,114,86,0,0,0,41,1,90,9,118,101,114,98,111,
-    115,105,116,121,114,0,0,0,0,114,57,0,0,0,114,58,
-    0,0,0,41,12,114,36,0,0,0,114,89,0,0,0,114,
-    76,0,0,0,114,77,0,0,0,114,29,0,0,0,114,20,
-    0,0,0,114,28,0,0,0,114,26,0,0,0,114,52,0,
-    0,0,114,155,0,0,0,114,161,0,0,0,114,3,0,0,
-    0,41,11,114,32,0,0,0,114,38,0,0,0,114,13,0,
-    0,0,114,90,0,0,0,114,91,0,0,0,114,47,0,0,
-    0,114,63,0,0,0,114,54,0,0,0,114,40,0,0,0,
-    114,126,0,0,0,114,46,0,0,0,114,9,0,0,0,114,
-    9,0,0,0,114,10,0,0,0,114,44,0,0,0,186,2,
-    0,0,115,36,0,0,0,0,1,10,1,14,1,8,1,22,
-    1,2,1,14,1,12,1,6,2,8,1,12,1,4,1,18,
-    2,10,1,8,3,2,1,8,1,16,2,114,44,0,0,0,
-    99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,2,0,0,0,64,0,0,0,115,60,0,0,0,101,0,
-    90,1,100,0,90,2,100,1,90,3,100,2,90,4,100,3,
-    100,4,132,0,90,5,100,5,100,6,132,0,90,6,100,7,
-    100,8,132,0,90,7,100,9,100,10,132,0,90,8,100,11,
-    100,12,132,0,90,9,100,13,83,0,41,14,114,80,0,0,
-    0,122,165,80,114,105,118,97,116,101,32,99,108,97,115,115,
-    32,117,115,101,100,32,116,111,32,115,117,112,112,111,114,116,
-    32,90,105,112,73,109,112,111,114,116,46,103,101,116,95,114,
-    101,115,111,117,114,99,101,95,114,101,97,100,101,114,40,41,
-    46,10,10,32,32,32,32,84,104,105,115,32,99,108,97,115,
-    115,32,105,115,32,97,108,108,111,119,101,100,32,116,111,32,
-    114,101,102,101,114,101,110,99,101,32,97,108,108,32,116,104,
-    101,32,105,110,110,97,114,100,115,32,97,110,100,32,112,114,
-    105,118,97,116,101,32,112,97,114,116,115,32,111,102,10,32,
-    32,32,32,116,104,101,32,122,105,112,105,109,112,111,114,116,
-    101,114,46,10,32,32,32,32,70,99,3,0,0,0,0,0,
-    0,0,0,0,0,0,3,0,0,0,2,0,0,0,67,0,
-    0,0,115,16,0,0,0,124,1,124,0,95,0,124,2,124,
-    0,95,1,100,0,83,0,114,88,0,0,0,41,2,114,4,
-    0,0,0,114,38,0,0,0,41,3,114,32,0,0,0,114,
-    4,0,0,0,114,38,0,0,0,114,9,0,0,0,114,9,
-    0,0,0,114,10,0,0,0,114,34,0,0,0,220,2,0,
-    0,115,4,0,0,0,0,1,6,1,122,33,95,90,105,112,
-    73,109,112,111,114,116,82,101,115,111,117,114,99,101,82,101,
-    97,100,101,114,46,95,95,105,110,105,116,95,95,99,2,0,
-    0,0,0,0,0,0,0,0,0,0,5,0,0,0,8,0,
-    0,0,67,0,0,0,115,90,0,0,0,124,0,106,0,160,
-    1,100,1,100,2,161,2,125,2,124,2,155,0,100,2,124,
-    1,155,0,157,3,125,3,100,3,100,4,108,2,109,3,125,
-    4,1,0,122,18,124,4,124,0,106,4,160,5,124,3,161,
-    1,131,1,87,0,83,0,4,0,116,6,121,84,1,0,1,
-    0,1,0,116,7,124,3,131,1,130,1,89,0,110,2,48,
-    0,100,0,83,0,41,5,78,114,85,0,0,0,114,109,0,
-    0,0,114,0,0,0,0,41,1,218,7,66,121,116,101,115,
-    73,79,41,8,114,38,0,0,0,114,19,0,0,0,90,2,
-    105,111,114,176,0,0,0,114,4,0,0,0,114,55,0,0,
-    0,114,22,0,0,0,218,17,70,105,108,101,78,111,116,70,
-    111,117,110,100,69,114,114,111,114,41,5,114,32,0,0,0,
-    218,8,114,101,115,111,117,114,99,101,218,16,102,117,108,108,
-    110,97,109,101,95,97,115,95,112,97,116,104,114,13,0,0,
-    0,114,176,0,0,0,114,9,0,0,0,114,9,0,0,0,
-    114,10,0,0,0,218,13,111,112,101,110,95,114,101,115,111,
-    117,114,99,101,224,2,0,0,115,14,0,0,0,0,1,14,
-    1,14,1,12,1,2,1,18,1,12,1,122,38,95,90,105,
-    112,73,109,112,111,114,116,82,101,115,111,117,114,99,101,82,
-    101,97,100,101,114,46,111,112,101,110,95,114,101,115,111,117,
-    114,99,101,99,2,0,0,0,0,0,0,0,0,0,0,0,
-    2,0,0,0,1,0,0,0,67,0,0,0,115,8,0,0,
-    0,116,0,130,1,100,0,83,0,114,88,0,0,0,41,1,
-    114,177,0,0,0,41,2,114,32,0,0,0,114,178,0,0,
+    111,100,101,123,2,0,0,115,72,0,0,0,2,2,2,1,
+    6,254,14,5,12,2,4,1,12,1,10,1,2,1,2,255,
+    8,1,2,255,10,2,8,1,4,1,4,1,2,1,4,254,
+    4,5,8,1,4,255,2,128,8,4,6,255,4,3,22,3,
+    18,1,2,255,4,2,8,1,4,255,4,2,18,2,10,1,
+    16,1,4,1,114,161,0,0,0,99,1,0,0,0,0,0,
+    0,0,0,0,0,0,1,0,0,0,4,0,0,0,67,0,
+    0,0,115,28,0,0,0,124,0,160,0,100,1,100,2,161,
+    2,125,0,124,0,160,0,100,3,100,2,161,2,125,0,124,
+    0,83,0,41,4,78,115,2,0,0,0,13,10,243,1,0,
+    0,0,10,243,1,0,0,0,13,41,1,114,19,0,0,0,
+    41,1,218,6,115,111,117,114,99,101,114,9,0,0,0,114,
+    9,0,0,0,114,10,0,0,0,218,23,95,110,111,114,109,
+    97,108,105,122,101,95,108,105,110,101,95,101,110,100,105,110,
+    103,115,168,2,0,0,115,6,0,0,0,12,1,12,1,4,
+    1,114,165,0,0,0,99,2,0,0,0,0,0,0,0,0,
+    0,0,0,2,0,0,0,6,0,0,0,67,0,0,0,115,
+    24,0,0,0,116,0,124,1,131,1,125,1,116,1,124,1,
+    124,0,100,1,100,2,100,3,141,4,83,0,41,4,78,114,
+    79,0,0,0,84,41,1,90,12,100,111,110,116,95,105,110,
+    104,101,114,105,116,41,2,114,165,0,0,0,218,7,99,111,
+    109,112,105,108,101,41,2,114,60,0,0,0,114,164,0,0,
     0,114,9,0,0,0,114,9,0,0,0,114,10,0,0,0,
-    218,13,114,101,115,111,117,114,99,101,95,112,97,116,104,233,
-    2,0,0,115,2,0,0,0,0,4,122,38,95,90,105,112,
-    73,109,112,111,114,116,82,101,115,111,117,114,99,101,82,101,
-    97,100,101,114,46,114,101,115,111,117,114,99,101,95,112,97,
-    116,104,99,2,0,0,0,0,0,0,0,0,0,0,0,4,
-    0,0,0,8,0,0,0,67,0,0,0,115,70,0,0,0,
-    124,0,106,0,160,1,100,1,100,2,161,2,125,2,124,2,
-    155,0,100,2,124,1,155,0,157,3,125,3,122,16,124,0,
-    106,2,160,3,124,3,161,1,1,0,87,0,110,20,4,0,
-    116,4,121,64,1,0,1,0,1,0,89,0,100,3,83,0,
-    48,0,100,4,83,0,41,5,78,114,85,0,0,0,114,109,
-    0,0,0,70,84,41,5,114,38,0,0,0,114,19,0,0,
-    0,114,4,0,0,0,114,55,0,0,0,114,22,0,0,0,
-    41,4,114,32,0,0,0,114,59,0,0,0,114,179,0,0,
-    0,114,13,0,0,0,114,9,0,0,0,114,9,0,0,0,
-    114,10,0,0,0,218,11,105,115,95,114,101,115,111,117,114,
-    99,101,239,2,0,0,115,14,0,0,0,0,3,14,1,14,
-    1,2,1,16,1,12,1,8,1,122,36,95,90,105,112,73,
-    109,112,111,114,116,82,101,115,111,117,114,99,101,82,101,97,
-    100,101,114,46,105,115,95,114,101,115,111,117,114,99,101,99,
-    1,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,
-    9,0,0,0,99,0,0,0,115,184,0,0,0,100,1,100,
-    2,108,0,109,1,125,1,1,0,124,1,124,0,106,2,160,
-    3,124,0,106,4,161,1,131,1,125,2,124,2,160,5,124,
-    0,106,2,106,6,161,1,125,3,124,3,106,7,100,3,107,
-    2,115,58,74,0,130,1,124,3,106,8,125,4,116,9,131,
-    0,125,5,124,0,106,2,106,10,68,0,93,100,125,6,122,
-    18,124,1,124,6,131,1,160,5,124,4,161,1,125,7,87,
-    0,110,22,4,0,116,11,121,122,1,0,1,0,1,0,89,
-    0,113,78,89,0,110,2,48,0,124,7,106,8,106,7,125,
-    8,116,12,124,8,131,1,100,1,107,2,114,154,124,7,106,
-    7,86,0,1,0,113,78,124,8,124,5,118,1,114,78,124,
-    5,160,13,124,8,161,1,1,0,124,8,86,0,1,0,113,
-    78,100,0,83,0,41,4,78,114,0,0,0,0,41,1,218,
-    4,80,97,116,104,114,60,0,0,0,41,14,90,7,112,97,
-    116,104,108,105,98,114,183,0,0,0,114,4,0,0,0,114,
-    56,0,0,0,114,38,0,0,0,90,11,114,101,108,97,116,
-    105,118,101,95,116,111,114,29,0,0,0,114,59,0,0,0,
-    90,6,112,97,114,101,110,116,218,3,115,101,116,114,28,0,
-    0,0,114,23,0,0,0,114,51,0,0,0,218,3,97,100,
-    100,41,9,114,32,0,0,0,114,183,0,0,0,90,13,102,
-    117,108,108,110,97,109,101,95,112,97,116,104,90,13,114,101,
-    108,97,116,105,118,101,95,112,97,116,104,90,12,112,97,99,
-    107,97,103,101,95,112,97,116,104,90,12,115,117,98,100,105,
-    114,115,95,115,101,101,110,218,8,102,105,108,101,110,97,109,
-    101,90,8,114,101,108,97,116,105,118,101,90,11,112,97,114,
-    101,110,116,95,110,97,109,101,114,9,0,0,0,114,9,0,
-    0,0,114,10,0,0,0,218,8,99,111,110,116,101,110,116,
-    115,250,2,0,0,115,34,0,0,0,0,8,12,1,18,1,
-    14,3,14,1,6,1,6,1,12,1,2,1,18,1,12,1,
-    10,5,8,1,12,1,10,1,8,1,10,1,122,33,95,90,
-    105,112,73,109,112,111,114,116,82,101,115,111,117,114,99,101,
-    82,101,97,100,101,114,46,99,111,110,116,101,110,116,115,78,
-    41,10,114,6,0,0,0,114,7,0,0,0,114,8,0,0,
-    0,114,84,0,0,0,114,81,0,0,0,114,34,0,0,0,
-    114,180,0,0,0,114,181,0,0,0,114,182,0,0,0,114,
-    187,0,0,0,114,9,0,0,0,114,9,0,0,0,114,9,
-    0,0,0,114,10,0,0,0,114,80,0,0,0,212,2,0,
-    0,115,14,0,0,0,8,1,4,5,4,2,8,4,8,9,
-    8,6,8,11,114,80,0,0,0,41,45,114,84,0,0,0,
-    90,26,95,102,114,111,122,101,110,95,105,109,112,111,114,116,
-    108,105,98,95,101,120,116,101,114,110,97,108,114,21,0,0,
-    0,114,1,0,0,0,114,2,0,0,0,90,17,95,102,114,
-    111,122,101,110,95,105,109,112,111,114,116,108,105,98,114,76,
-    0,0,0,114,148,0,0,0,114,110,0,0,0,114,152,0,
-    0,0,114,67,0,0,0,114,131,0,0,0,90,7,95,95,
-    97,108,108,95,95,114,20,0,0,0,90,15,112,97,116,104,
-    95,115,101,112,97,114,97,116,111,114,115,114,18,0,0,0,
-    114,75,0,0,0,114,3,0,0,0,114,25,0,0,0,218,
-    4,116,121,112,101,114,70,0,0,0,114,113,0,0,0,114,
-    115,0,0,0,114,117,0,0,0,114,4,0,0,0,114,89,
-    0,0,0,114,36,0,0,0,114,37,0,0,0,114,35,0,
-    0,0,114,27,0,0,0,114,122,0,0,0,114,142,0,0,
-    0,114,144,0,0,0,114,52,0,0,0,114,147,0,0,0,
-    114,155,0,0,0,218,8,95,95,99,111,100,101,95,95,114,
-    153,0,0,0,114,159,0,0,0,114,161,0,0,0,114,169,
-    0,0,0,114,151,0,0,0,114,149,0,0,0,114,44,0,
-    0,0,114,80,0,0,0,114,9,0,0,0,114,9,0,0,
-    0,114,9,0,0,0,114,10,0,0,0,218,8,60,109,111,
-    100,117,108,101,62,1,0,0,0,115,88,0,0,0,4,16,
-    8,1,16,1,8,1,8,1,8,1,8,1,8,1,8,2,
-    8,3,6,1,14,3,16,4,4,2,8,2,4,1,4,1,
-    4,2,14,127,0,127,0,1,12,1,12,1,2,1,2,252,
-    4,9,8,4,8,9,8,31,8,126,2,254,2,29,4,5,
-    8,21,8,46,8,10,8,46,10,5,8,7,8,6,8,13,
-    8,19,8,15,8,26,
+    218,15,95,99,111,109,112,105,108,101,95,115,111,117,114,99,
+    101,175,2,0,0,115,4,0,0,0,8,1,16,1,114,167,
+    0,0,0,99,2,0,0,0,0,0,0,0,0,0,0,0,
+    2,0,0,0,11,0,0,0,67,0,0,0,115,68,0,0,
+    0,116,0,160,1,124,0,100,1,63,0,100,2,23,0,124,
+    0,100,3,63,0,100,4,64,0,124,0,100,5,64,0,124,
+    1,100,6,63,0,124,1,100,3,63,0,100,7,64,0,124,
+    1,100,5,64,0,100,8,20,0,100,9,100,9,100,9,102,
+    9,161,1,83,0,41,10,78,233,9,0,0,0,105,188,7,
+    0,0,233,5,0,0,0,233,15,0,0,0,233,31,0,0,
+    0,233,11,0,0,0,233,63,0,0,0,114,93,0,0,0,
+    114,14,0,0,0,41,2,114,137,0,0,0,90,6,109,107,
+    116,105,109,101,41,2,218,1,100,114,144,0,0,0,114,9,
+    0,0,0,114,9,0,0,0,114,10,0,0,0,218,14,95,
+    112,97,114,115,101,95,100,111,115,116,105,109,101,181,2,0,
+    0,115,18,0,0,0,4,1,10,1,10,1,6,1,6,1,
+    10,1,10,1,6,1,6,249,114,175,0,0,0,99,2,0,
+    0,0,0,0,0,0,0,0,0,0,6,0,0,0,10,0,
+    0,0,67,0,0,0,115,110,0,0,0,122,41,124,1,100,
+    1,100,0,133,2,25,0,100,2,118,0,115,11,74,0,130,
+    1,124,1,100,0,100,1,133,2,25,0,125,1,124,0,106,
+    0,124,1,25,0,125,2,124,2,100,3,25,0,125,3,124,
+    2,100,4,25,0,125,4,124,2,100,5,25,0,125,5,116,
+    1,124,4,124,3,131,2,124,5,102,2,87,0,83,0,4,
+    0,116,2,116,3,116,4,102,3,121,54,1,0,1,0,1,
+    0,89,0,100,6,83,0,119,0,41,7,78,114,14,0,0,
+    0,169,2,218,1,99,218,1,111,114,169,0,0,0,233,6,
+    0,0,0,233,3,0,0,0,41,2,114,0,0,0,0,114,
+    0,0,0,0,41,5,114,28,0,0,0,114,175,0,0,0,
+    114,26,0,0,0,218,10,73,110,100,101,120,69,114,114,111,
+    114,114,160,0,0,0,41,6,114,32,0,0,0,114,13,0,
+    0,0,114,61,0,0,0,114,137,0,0,0,114,138,0,0,
+    0,90,17,117,110,99,111,109,112,114,101,115,115,101,100,95,
+    115,105,122,101,114,9,0,0,0,114,9,0,0,0,114,10,
+    0,0,0,114,157,0,0,0,194,2,0,0,115,22,0,0,
+    0,2,1,20,2,12,1,10,1,8,3,8,1,8,1,16,
+    1,18,1,6,1,2,255,114,157,0,0,0,99,2,0,0,
+    0,0,0,0,0,0,0,0,0,3,0,0,0,8,0,0,
+    0,67,0,0,0,115,80,0,0,0,124,1,100,1,100,0,
+    133,2,25,0,100,2,118,0,115,10,74,0,130,1,124,1,
+    100,0,100,1,133,2,25,0,125,1,122,7,124,0,106,0,
+    124,1,25,0,125,2,87,0,110,10,4,0,116,1,121,33,
+    1,0,1,0,1,0,89,0,100,0,83,0,119,0,116,2,
+    124,0,106,3,124,2,131,2,83,0,41,3,78,114,14,0,
+    0,0,114,176,0,0,0,41,4,114,28,0,0,0,114,26,
+    0,0,0,114,59,0,0,0,114,29,0,0,0,41,3,114,
+    32,0,0,0,114,13,0,0,0,114,61,0,0,0,114,9,
+    0,0,0,114,9,0,0,0,114,10,0,0,0,114,155,0,
+    0,0,213,2,0,0,115,16,0,0,0,20,2,12,1,2,
+    2,14,1,12,1,6,1,2,255,12,3,114,155,0,0,0,
+    99,2,0,0,0,0,0,0,0,0,0,0,0,14,0,0,
+    0,11,0,0,0,67,0,0,0,115,14,1,0,0,116,0,
+    124,0,124,1,131,2,125,2,100,0,125,3,116,1,68,0,
+    93,102,92,3,125,4,125,5,125,6,124,2,124,4,23,0,
+    125,7,116,2,106,3,100,1,124,0,106,4,116,5,124,7,
+    100,2,100,3,141,5,1,0,122,7,124,0,106,6,124,7,
+    25,0,125,8,87,0,110,9,4,0,116,7,121,45,1,0,
+    1,0,1,0,89,0,113,9,119,0,124,8,100,4,25,0,
+    125,9,116,8,124,0,106,4,124,8,131,2,125,10,100,0,
+    125,11,124,5,114,91,122,10,116,9,124,0,124,9,124,7,
+    124,1,124,10,131,5,125,11,87,0,110,25,4,0,116,10,
+    121,90,1,0,125,12,1,0,122,8,124,12,125,3,87,0,
+    89,0,100,0,125,12,126,12,110,10,100,0,125,12,126,12,
+    119,1,119,0,116,11,124,9,124,10,131,2,125,11,124,11,
+    100,0,117,0,114,101,113,9,124,8,100,4,25,0,125,9,
+    124,11,124,6,124,9,102,3,2,0,1,0,83,0,124,3,
+    114,126,100,5,124,3,155,0,157,2,125,13,116,12,124,13,
+    124,1,100,6,141,2,124,3,130,2,116,12,100,7,124,1,
+    155,2,157,2,124,1,100,6,141,2,130,1,41,8,78,122,
+    13,116,114,121,105,110,103,32,123,125,123,125,123,125,114,93,
+    0,0,0,41,1,90,9,118,101,114,98,111,115,105,116,121,
+    114,0,0,0,0,122,20,109,111,100,117,108,101,32,108,111,
+    97,100,32,102,97,105,108,101,100,58,32,114,65,0,0,0,
+    114,64,0,0,0,41,13,114,39,0,0,0,114,95,0,0,
+    0,114,48,0,0,0,114,81,0,0,0,114,29,0,0,0,
+    114,20,0,0,0,114,28,0,0,0,114,26,0,0,0,114,
+    59,0,0,0,114,161,0,0,0,114,80,0,0,0,114,167,
+    0,0,0,114,3,0,0,0,41,14,114,32,0,0,0,114,
+    41,0,0,0,114,13,0,0,0,90,12,105,109,112,111,114,
+    116,95,101,114,114,111,114,114,96,0,0,0,114,97,0,0,
+    0,114,54,0,0,0,114,69,0,0,0,114,61,0,0,0,
+    114,43,0,0,0,114,132,0,0,0,114,53,0,0,0,90,
+    3,101,120,99,114,82,0,0,0,114,9,0,0,0,114,9,
+    0,0,0,114,10,0,0,0,114,51,0,0,0,228,2,0,
+    0,115,58,0,0,0,10,1,4,1,14,1,8,1,22,1,
+    2,1,14,1,12,1,4,1,2,255,8,3,12,1,4,1,
+    4,1,2,1,20,1,14,1,16,1,8,128,2,255,10,3,
+    8,1,2,3,8,1,14,1,4,2,10,1,14,1,18,2,
+    114,51,0,0,0,41,46,114,91,0,0,0,90,26,95,102,
+    114,111,122,101,110,95,105,109,112,111,114,116,108,105,98,95,
+    101,120,116,101,114,110,97,108,114,21,0,0,0,114,1,0,
+    0,0,114,2,0,0,0,90,17,95,102,114,111,122,101,110,
+    95,105,109,112,111,114,116,108,105,98,114,48,0,0,0,114,
+    154,0,0,0,114,116,0,0,0,114,158,0,0,0,114,72,
+    0,0,0,114,137,0,0,0,114,35,0,0,0,90,7,95,
+    95,97,108,108,95,95,114,20,0,0,0,90,15,112,97,116,
+    104,95,115,101,112,97,114,97,116,111,114,115,114,18,0,0,
+    0,114,80,0,0,0,114,3,0,0,0,114,25,0,0,0,
+    218,4,116,121,112,101,114,75,0,0,0,114,119,0,0,0,
+    114,121,0,0,0,114,123,0,0,0,90,13,95,76,111,97,
+    100,101,114,66,97,115,105,99,115,114,4,0,0,0,114,95,
+    0,0,0,114,39,0,0,0,114,40,0,0,0,114,38,0,
+    0,0,114,27,0,0,0,114,128,0,0,0,114,148,0,0,
+    0,114,150,0,0,0,114,59,0,0,0,114,153,0,0,0,
+    114,161,0,0,0,218,8,95,95,99,111,100,101,95,95,114,
+    159,0,0,0,114,165,0,0,0,114,167,0,0,0,114,175,
+    0,0,0,114,157,0,0,0,114,155,0,0,0,114,51,0,
+    0,0,114,9,0,0,0,114,9,0,0,0,114,9,0,0,
+    0,114,10,0,0,0,218,8,60,109,111,100,117,108,101,62,
+    1,0,0,0,115,90,0,0,0,4,0,8,16,16,1,8,
+    1,8,1,8,1,8,1,8,1,8,1,8,1,8,2,6,
+    3,14,1,16,3,4,4,8,2,4,2,4,1,4,1,18,
+    2,0,127,0,127,12,50,12,1,2,1,2,1,4,252,8,
+    9,8,4,8,9,8,31,2,126,2,254,4,29,8,5,8,
+    21,8,46,8,8,10,40,8,5,8,7,8,6,8,13,8,
+    19,12,15,
 };
diff --git a/Python/initconfig.c b/Python/initconfig.c
index 3caed38..b298611 100644
--- a/Python/initconfig.c
+++ b/Python/initconfig.c
@@ -11,11 +11,7 @@
 
 #include "osdefs.h"               // DELIM
 #include <locale.h>               // setlocale()
-#ifdef HAVE_LANGINFO_H
-#  include <langinfo.h>           // nl_langinfo(CODESET)
-#endif
 #if defined(MS_WINDOWS) || defined(__CYGWIN__)
-#  include <windows.h>            // GetACP()
 #  ifdef HAVE_IO_H
 #    include <io.h>
 #  endif
@@ -73,7 +69,6 @@
 -X opt : set implementation-specific option. The following options are available:\n\
 \n\
          -X faulthandler: enable faulthandler\n\
-         -X oldparser: enable the traditional LL(1) parser; also PYTHONOLDPARSER\n\
          -X showrefcount: output the total reference count and number of used\n\
              memory blocks when the program finishes or after each statement in the\n\
              interactive interpreter. This only works on debug builds\n\
@@ -99,6 +94,7 @@
              otherwise activate automatically)\n\
          -X pycache_prefix=PATH: enable writing .pyc files to a parallel tree rooted at the\n\
              given directory instead of to the code tree\n\
+         -X warn_default_encoding: enable opt-in EncodingWarning for 'encoding=None'\n\
 \n\
 --check-hash-based-pycs always|default|never:\n\
     control how Python invalidates hash-based .pyc files\n\
@@ -134,7 +130,8 @@
 "PYTHONBREAKPOINT: if this variable is set to 0, it disables the default\n"
 "   debugger. It can be set to the callable of your debugger of choice.\n"
 "PYTHONDEVMODE: enable the development mode.\n"
-"PYTHONPYCACHEPREFIX: root directory for bytecode cache (pyc) files.\n";
+"PYTHONPYCACHEPREFIX: root directory for bytecode cache (pyc) files.\n"
+"PYTHONWARNDEFAULTENCODING: enable opt-in EncodingWarning for 'encoding=None'.\n";
 
 #if defined(MS_WINDOWS)
 #  define PYTHONHOMEHELP "<prefix>\\python{major}{minor}"
@@ -248,8 +245,9 @@
 
 PyStatus PyStatus_Error(const char *err_msg)
 {
+    assert(err_msg != NULL);
     return (PyStatus){._type = _PyStatus_TYPE_ERROR,
-                          .err_msg = err_msg};
+                      .err_msg = err_msg};
 }
 
 PyStatus PyStatus_NoMemory(void)
@@ -268,6 +266,23 @@
 int PyStatus_Exception(PyStatus status)
 { return _PyStatus_EXCEPTION(status); }
 
+PyObject*
+_PyErr_SetFromPyStatus(PyStatus status)
+{
+    if (!_PyStatus_IS_ERROR(status)) {
+        PyErr_Format(PyExc_SystemError,
+                     "%s() expects an error PyStatus",
+                     _PyStatus_GET_FUNC());
+    }
+    else if (status.func) {
+        PyErr_Format(PyExc_ValueError, "%s: %s", status.func, status.err_msg);
+    }
+    else {
+        PyErr_Format(PyExc_ValueError, "%s", status.err_msg);
+    }
+    return NULL;
+}
+
 
 /* --- PyWideStringList ------------------------------------------------ */
 
@@ -549,6 +564,7 @@
 }
 
 
+// _PyConfig_Write() calls _Py_SetArgcArgv() with PyConfig.orig_argv.
 void
 Py_GetArgcArgv(int *argc, wchar_t ***argv)
 {
@@ -564,6 +580,66 @@
      ? _PyStatus_ERR("cannot decode " NAME) \
      : _PyStatus_NO_MEMORY())
 
+#define MAX_HASH_SEED 4294967295UL
+
+
+#ifndef NDEBUG
+static int
+config_check_consistency(const PyConfig *config)
+{
+    /* Check config consistency */
+    assert(config->isolated >= 0);
+    assert(config->use_environment >= 0);
+    assert(config->dev_mode >= 0);
+    assert(config->install_signal_handlers >= 0);
+    assert(config->use_hash_seed >= 0);
+    assert(config->hash_seed <= MAX_HASH_SEED);
+    assert(config->faulthandler >= 0);
+    assert(config->tracemalloc >= 0);
+    assert(config->import_time >= 0);
+    assert(config->show_ref_count >= 0);
+    assert(config->dump_refs >= 0);
+    assert(config->malloc_stats >= 0);
+    assert(config->site_import >= 0);
+    assert(config->bytes_warning >= 0);
+    assert(config->warn_default_encoding >= 0);
+    assert(config->inspect >= 0);
+    assert(config->interactive >= 0);
+    assert(config->optimization_level >= 0);
+    assert(config->parser_debug >= 0);
+    assert(config->write_bytecode >= 0);
+    assert(config->verbose >= 0);
+    assert(config->quiet >= 0);
+    assert(config->user_site_directory >= 0);
+    assert(config->parse_argv >= 0);
+    assert(config->configure_c_stdio >= 0);
+    assert(config->buffered_stdio >= 0);
+    assert(config->program_name != NULL);
+    assert(_PyWideStringList_CheckConsistency(&config->orig_argv));
+    assert(_PyWideStringList_CheckConsistency(&config->argv));
+    /* sys.argv must be non-empty: empty argv is replaced with [''] */
+    assert(config->argv.length >= 1);
+    assert(_PyWideStringList_CheckConsistency(&config->xoptions));
+    assert(_PyWideStringList_CheckConsistency(&config->warnoptions));
+    assert(_PyWideStringList_CheckConsistency(&config->module_search_paths));
+    assert(config->module_search_paths_set >= 0);
+    assert(config->platlibdir != NULL);
+    assert(config->filesystem_encoding != NULL);
+    assert(config->filesystem_errors != NULL);
+    assert(config->stdio_encoding != NULL);
+    assert(config->stdio_errors != NULL);
+#ifdef MS_WINDOWS
+    assert(config->legacy_windows_stdio >= 0);
+#endif
+    /* -c and -m options are exclusive */
+    assert(!(config->run_command != NULL && config->run_module != NULL));
+    assert(config->check_hash_pycs_mode != NULL);
+    assert(config->_install_importlib >= 0);
+    assert(config->pathconfig_warnings >= 0);
+    return 1;
+}
+#endif
+
 
 /* Free memory allocated in config, but don't clear all attributes */
 void
@@ -603,7 +679,7 @@
     CLEAR(config->run_filename);
     CLEAR(config->check_hash_pycs_mode);
 
-    _PyWideStringList_Clear(&config->_orig_argv);
+    _PyWideStringList_Clear(&config->orig_argv);
 #undef CLEAR
 }
 
@@ -625,6 +701,7 @@
     config->parse_argv = 0;
     config->site_import = -1;
     config->bytes_warning = -1;
+    config->warn_default_encoding = 0;
     config->inspect = -1;
     config->interactive = -1;
     config->optimization_level = -1;
@@ -643,7 +720,6 @@
 #ifdef MS_WINDOWS
     config->legacy_windows_stdio = -1;
 #endif
-    config->_use_peg_parser = 1;
 }
 
 
@@ -769,7 +845,7 @@
    configured. */
 PyStatus
 PyConfig_SetBytesString(PyConfig *config, wchar_t **config_str,
-                           const char *str)
+                        const char *str)
 {
     return CONFIG_SET_BYTES_STR(config, config_str, str, "string");
 }
@@ -801,7 +877,6 @@
     COPY_ATTR(isolated);
     COPY_ATTR(use_environment);
     COPY_ATTR(dev_mode);
-    COPY_ATTR(_use_peg_parser);
     COPY_ATTR(install_signal_handlers);
     COPY_ATTR(use_hash_seed);
     COPY_ATTR(hash_seed);
@@ -835,6 +910,7 @@
 
     COPY_ATTR(site_import);
     COPY_ATTR(bytes_warning);
+    COPY_ATTR(warn_default_encoding);
     COPY_ATTR(inspect);
     COPY_ATTR(interactive);
     COPY_ATTR(optimization_level);
@@ -860,7 +936,7 @@
     COPY_ATTR(pathconfig_warnings);
     COPY_ATTR(_init_main);
     COPY_ATTR(_isolated_interpreter);
-    COPY_WSTRLIST(_orig_argv);
+    COPY_WSTRLIST(orig_argv);
 
 #undef COPY_ATTR
 #undef COPY_WSTR_ATTR
@@ -869,12 +945,10 @@
 }
 
 
-static PyObject *
-config_as_dict(const PyConfig *config)
+PyObject *
+_PyConfig_AsDict(const PyConfig *config)
 {
-    PyObject *dict;
-
-    dict = PyDict_New();
+    PyObject *dict = PyDict_New();
     if (dict == NULL) {
         return NULL;
     }
@@ -908,7 +982,6 @@
     SET_ITEM_INT(isolated);
     SET_ITEM_INT(use_environment);
     SET_ITEM_INT(dev_mode);
-    SET_ITEM_INT(_use_peg_parser);
     SET_ITEM_INT(install_signal_handlers);
     SET_ITEM_INT(use_hash_seed);
     SET_ITEM_UINT(hash_seed);
@@ -928,6 +1001,7 @@
     SET_ITEM_WSTRLIST(warnoptions);
     SET_ITEM_WSTR(pythonpath_env);
     SET_ITEM_WSTR(home);
+    SET_ITEM_INT(module_search_paths_set);
     SET_ITEM_WSTRLIST(module_search_paths);
     SET_ITEM_WSTR(executable);
     SET_ITEM_WSTR(base_executable);
@@ -938,6 +1012,7 @@
     SET_ITEM_WSTR(platlibdir);
     SET_ITEM_INT(site_import);
     SET_ITEM_INT(bytes_warning);
+    SET_ITEM_INT(warn_default_encoding);
     SET_ITEM_INT(inspect);
     SET_ITEM_INT(interactive);
     SET_ITEM_INT(optimization_level);
@@ -962,7 +1037,7 @@
     SET_ITEM_INT(pathconfig_warnings);
     SET_ITEM_INT(_init_main);
     SET_ITEM_INT(_isolated_interpreter);
-    SET_ITEM_WSTRLIST(_orig_argv);
+    SET_ITEM_WSTRLIST(orig_argv);
 
     return dict;
 
@@ -979,6 +1054,280 @@
 }
 
 
+static PyObject*
+config_dict_get(PyObject *dict, const char *name)
+{
+    PyObject *item = _PyDict_GetItemStringWithError(dict, name);
+    if (item == NULL && !PyErr_Occurred()) {
+        PyErr_Format(PyExc_ValueError, "missing config key: %s", name);
+        return NULL;
+    }
+    return item;
+}
+
+
+static void
+config_dict_invalid_value(const char *name)
+{
+    PyErr_Format(PyExc_ValueError, "invalid config value: %s", name);
+}
+
+
+static void
+config_dict_invalid_type(const char *name)
+{
+    PyErr_Format(PyExc_TypeError, "invalid config type: %s", name);
+}
+
+
+static int
+config_dict_get_int(PyObject *dict, const char *name, int *result)
+{
+    PyObject *item = config_dict_get(dict, name);
+    if (item == NULL) {
+        return -1;
+    }
+    int value = _PyLong_AsInt(item);
+    if (value == -1 && PyErr_Occurred()) {
+        if (PyErr_ExceptionMatches(PyExc_TypeError)) {
+            config_dict_invalid_type(name);
+        }
+        else if (PyErr_ExceptionMatches(PyExc_OverflowError)) {
+            config_dict_invalid_value(name);
+        }
+        return -1;
+    }
+    *result = value;
+    return 0;
+}
+
+
+static int
+config_dict_get_ulong(PyObject *dict, const char *name, unsigned long *result)
+{
+    PyObject *item = config_dict_get(dict, name);
+    if (item == NULL) {
+        return -1;
+    }
+    unsigned long value = PyLong_AsUnsignedLong(item);
+    if (value == (unsigned long)-1 && PyErr_Occurred()) {
+        if (PyErr_ExceptionMatches(PyExc_TypeError)) {
+            config_dict_invalid_type(name);
+        }
+        else if (PyErr_ExceptionMatches(PyExc_OverflowError)) {
+            config_dict_invalid_value(name);
+        }
+        return -1;
+    }
+    *result = value;
+    return 0;
+}
+
+
+static int
+config_dict_get_wstr(PyObject *dict, const char *name, PyConfig *config,
+                     wchar_t **result)
+{
+    PyObject *item = config_dict_get(dict, name);
+    if (item == NULL) {
+        return -1;
+    }
+    PyStatus status;
+    if (item == Py_None) {
+        status = PyConfig_SetString(config, result, NULL);
+    }
+    else if (!PyUnicode_Check(item)) {
+        config_dict_invalid_type(name);
+        return -1;
+    }
+    else {
+        wchar_t *wstr = PyUnicode_AsWideCharString(item, NULL);
+        if (wstr == NULL) {
+            return -1;
+        }
+        status = PyConfig_SetString(config, result, wstr);
+        PyMem_Free(wstr);
+    }
+    if (_PyStatus_EXCEPTION(status)) {
+        PyErr_NoMemory();
+        return -1;
+    }
+    return 0;
+}
+
+
+static int
+config_dict_get_wstrlist(PyObject *dict, const char *name, PyConfig *config,
+                         PyWideStringList *result)
+{
+    PyObject *list = config_dict_get(dict, name);
+    if (list == NULL) {
+        return -1;
+    }
+
+    if (!PyList_CheckExact(list)) {
+        config_dict_invalid_type(name);
+        return -1;
+    }
+
+    PyWideStringList wstrlist = _PyWideStringList_INIT;
+    for (Py_ssize_t i=0; i < PyList_GET_SIZE(list); i++) {
+        PyObject *item = PyList_GET_ITEM(list, i);
+
+        if (item == Py_None) {
+            config_dict_invalid_value(name);
+            goto error;
+        }
+        else if (!PyUnicode_Check(item)) {
+            config_dict_invalid_type(name);
+            goto error;
+        }
+        wchar_t *wstr = PyUnicode_AsWideCharString(item, NULL);
+        if (wstr == NULL) {
+            goto error;
+        }
+        PyStatus status = PyWideStringList_Append(&wstrlist, wstr);
+        PyMem_Free(wstr);
+        if (_PyStatus_EXCEPTION(status)) {
+            PyErr_NoMemory();
+            goto error;
+        }
+    }
+
+    if (_PyWideStringList_Copy(result, &wstrlist) < 0) {
+        PyErr_NoMemory();
+        goto error;
+    }
+    _PyWideStringList_Clear(&wstrlist);
+    return 0;
+
+error:
+    _PyWideStringList_Clear(&wstrlist);
+    return -1;
+}
+
+
+int
+_PyConfig_FromDict(PyConfig *config, PyObject *dict)
+{
+    if (!PyDict_Check(dict)) {
+        PyErr_SetString(PyExc_TypeError, "dict expected");
+        return -1;
+    }
+
+#define CHECK_VALUE(NAME, TEST) \
+    if (!(TEST)) { \
+        config_dict_invalid_value(NAME); \
+        return -1; \
+    }
+#define GET_UINT(KEY) \
+    do { \
+        if (config_dict_get_int(dict, #KEY, &config->KEY) < 0) { \
+            return -1; \
+        } \
+        CHECK_VALUE(#KEY, config->KEY >= 0); \
+    } while (0)
+#define GET_WSTR(KEY) \
+    do { \
+        if (config_dict_get_wstr(dict, #KEY, config, &config->KEY) < 0) { \
+            return -1; \
+        } \
+        CHECK_VALUE(#KEY, config->KEY != NULL); \
+    } while (0)
+#define GET_WSTR_OPT(KEY) \
+    do { \
+        if (config_dict_get_wstr(dict, #KEY, config, &config->KEY) < 0) { \
+            return -1; \
+        } \
+    } while (0)
+#define GET_WSTRLIST(KEY) \
+    do { \
+        if (config_dict_get_wstrlist(dict, #KEY, config, &config->KEY) < 0) { \
+            return -1; \
+        } \
+    } while (0)
+
+    GET_UINT(_config_init);
+    CHECK_VALUE("_config_init",
+                config->_config_init == _PyConfig_INIT_COMPAT
+                || config->_config_init == _PyConfig_INIT_PYTHON
+                || config->_config_init == _PyConfig_INIT_ISOLATED);
+    GET_UINT(isolated);
+    GET_UINT(use_environment);
+    GET_UINT(dev_mode);
+    GET_UINT(install_signal_handlers);
+    GET_UINT(use_hash_seed);
+    if (config_dict_get_ulong(dict, "hash_seed", &config->hash_seed) < 0) {
+        return -1;
+    }
+    CHECK_VALUE("hash_seed", config->hash_seed <= MAX_HASH_SEED);
+    GET_UINT(faulthandler);
+    GET_UINT(tracemalloc);
+    GET_UINT(import_time);
+    GET_UINT(show_ref_count);
+    GET_UINT(dump_refs);
+    GET_UINT(malloc_stats);
+    GET_WSTR(filesystem_encoding);
+    GET_WSTR(filesystem_errors);
+    GET_WSTR_OPT(pycache_prefix);
+    GET_UINT(parse_argv);
+    GET_WSTRLIST(orig_argv);
+    GET_WSTRLIST(argv);
+    GET_WSTRLIST(xoptions);
+    GET_WSTRLIST(warnoptions);
+    GET_UINT(site_import);
+    GET_UINT(bytes_warning);
+    GET_UINT(warn_default_encoding);
+    GET_UINT(inspect);
+    GET_UINT(interactive);
+    GET_UINT(optimization_level);
+    GET_UINT(parser_debug);
+    GET_UINT(write_bytecode);
+    GET_UINT(verbose);
+    GET_UINT(quiet);
+    GET_UINT(user_site_directory);
+    GET_UINT(configure_c_stdio);
+    GET_UINT(buffered_stdio);
+    GET_WSTR(stdio_encoding);
+    GET_WSTR(stdio_errors);
+#ifdef MS_WINDOWS
+    GET_UINT(legacy_windows_stdio);
+#endif
+    GET_WSTR(check_hash_pycs_mode);
+
+    GET_UINT(pathconfig_warnings);
+    GET_WSTR(program_name);
+    GET_WSTR_OPT(pythonpath_env);
+    GET_WSTR_OPT(home);
+    GET_WSTR(platlibdir);
+
+    // Path configuration output
+    GET_UINT(module_search_paths_set);
+    GET_WSTRLIST(module_search_paths);
+    GET_WSTR_OPT(executable);
+    GET_WSTR_OPT(base_executable);
+    GET_WSTR_OPT(prefix);
+    GET_WSTR_OPT(base_prefix);
+    GET_WSTR_OPT(exec_prefix);
+    GET_WSTR_OPT(base_exec_prefix);
+
+    GET_UINT(skip_source_first_line);
+    GET_WSTR_OPT(run_command);
+    GET_WSTR_OPT(run_module);
+    GET_WSTR_OPT(run_filename);
+
+    GET_UINT(_install_importlib);
+    GET_UINT(_init_main);
+    GET_UINT(_isolated_interpreter);
+
+#undef CHECK_VALUE
+#undef GET_UINT
+#undef GET_WSTR
+#undef GET_WSTR_OPT
+    return 0;
+}
+
+
 static const char*
 config_get_env(const PyConfig *config, const char *name)
 {
@@ -1246,7 +1595,6 @@
                               L"PYTHONHOME", "PYTHONHOME");
 }
 
-
 static PyStatus
 config_init_hash_seed(PyConfig *config)
 {
@@ -1260,7 +1608,7 @@
         errno = 0;
         seed = strtoul(seed_text, (char **)&endptr, 10);
         if (*endptr != '\0'
-            || seed > 4294967295UL
+            || seed > MAX_HASH_SEED
             || (errno == ERANGE && seed == ULONG_MAX))
         {
             return _PyStatus_ERR("PYTHONHASHSEED must be \"random\" "
@@ -1329,7 +1677,7 @@
 
 #ifdef MS_WINDOWS
     _Py_get_env_flag(use_env, &config->legacy_windows_stdio,
-                 "PYTHONLEGACYWINDOWSSTDIO");
+                     "PYTHONLEGACYWINDOWSSTDIO");
 #endif
 
     if (config_get_env(config, "PYTHONDUMPREFS")) {
@@ -1454,11 +1802,6 @@
         config->import_time = 1;
     }
 
-    if (config_get_env(config, "PYTHONOLDPARSER")
-       || config_get_xoption(config, L"oldparser")) {
-        config->_use_peg_parser = 0;
-    }
-
     PyStatus status;
     if (config->tracemalloc < 0) {
         status = config_init_tracemalloc(config);
@@ -1478,8 +1821,13 @@
 
 
 static const wchar_t *
-config_get_stdio_errors(void)
+config_get_stdio_errors(const PyPreConfig *preconfig)
 {
+    if (preconfig->utf8_mode) {
+        /* UTF-8 Mode uses UTF-8/surrogateescape */
+        return L"surrogateescape";
+    }
+
 #ifndef MS_WINDOWS
     const char *loc = setlocale(LC_CTYPE, NULL);
     if (loc != NULL) {
@@ -1504,26 +1852,18 @@
 }
 
 
+// See also config_get_fs_encoding()
 static PyStatus
-config_get_locale_encoding(PyConfig *config, wchar_t **locale_encoding)
+config_get_locale_encoding(PyConfig *config, const PyPreConfig *preconfig,
+                           wchar_t **locale_encoding)
 {
-#ifdef MS_WINDOWS
-    char encoding[20];
-    PyOS_snprintf(encoding, sizeof(encoding), "cp%u", GetACP());
-    return PyConfig_SetBytesString(config, locale_encoding, encoding);
-#elif defined(_Py_FORCE_UTF8_LOCALE)
-    return PyConfig_SetString(config, locale_encoding, L"utf-8");
-#else
-    const char *encoding = nl_langinfo(CODESET);
-    if (!encoding || encoding[0] == '\0') {
-        return _PyStatus_ERR("failed to get the locale encoding: "
-                             "nl_langinfo(CODESET) failed");
+    wchar_t *encoding = _Py_GetLocaleEncoding();
+    if (encoding == NULL) {
+        return _PyStatus_NO_MEMORY();
     }
-    /* nl_langinfo(CODESET) is decoded by Py_DecodeLocale() */
-    return CONFIG_SET_BYTES_STR(config,
-                                locale_encoding, encoding,
-                                "nl_langinfo(CODESET)");
-#endif
+    PyStatus status = PyConfig_SetString(config, locale_encoding, encoding);
+    PyMem_RawFree(encoding);
+    return status;
 }
 
 
@@ -1533,8 +1873,8 @@
 {
     PyStatus status;
 
-    /* If Py_SetStandardStreamEncoding() have been called, use these
-        parameters. */
+    /* If Py_SetStandardStreamEncoding() has been called, use its
+        arguments if they are not NULL. */
     if (config->stdio_encoding == NULL && _Py_StandardStreamEncoding != NULL) {
         status = CONFIG_SET_BYTES_STR(config, &config->stdio_encoding,
                                       _Py_StandardStreamEncoding,
@@ -1553,6 +1893,7 @@
         }
     }
 
+    // Exit if encoding and errors are defined
     if (config->stdio_encoding != NULL && config->stdio_errors != NULL) {
         return _PyStatus_OK();
     }
@@ -1608,33 +1949,16 @@
         PyMem_RawFree(pythonioencoding);
     }
 
-    /* UTF-8 Mode uses UTF-8/surrogateescape */
-    if (preconfig->utf8_mode) {
-        if (config->stdio_encoding == NULL) {
-            status = PyConfig_SetString(config, &config->stdio_encoding,
-                                        L"utf-8");
-            if (_PyStatus_EXCEPTION(status)) {
-                return status;
-            }
-        }
-        if (config->stdio_errors == NULL) {
-            status = PyConfig_SetString(config, &config->stdio_errors,
-                                        L"surrogateescape");
-            if (_PyStatus_EXCEPTION(status)) {
-                return status;
-            }
-        }
-    }
-
     /* Choose the default error handler based on the current locale. */
     if (config->stdio_encoding == NULL) {
-        status = config_get_locale_encoding(config, &config->stdio_encoding);
+        status = config_get_locale_encoding(config, preconfig,
+                                            &config->stdio_encoding);
         if (_PyStatus_EXCEPTION(status)) {
             return status;
         }
     }
     if (config->stdio_errors == NULL) {
-        const wchar_t *errors = config_get_stdio_errors();
+        const wchar_t *errors = config_get_stdio_errors(preconfig);
         assert(errors != NULL);
 
         status = PyConfig_SetString(config, &config->stdio_errors, errors);
@@ -1647,46 +1971,46 @@
 }
 
 
+// See also config_get_locale_encoding()
+static PyStatus
+config_get_fs_encoding(PyConfig *config, const PyPreConfig *preconfig,
+                       wchar_t **fs_encoding)
+{
+#ifdef _Py_FORCE_UTF8_FS_ENCODING
+    return PyConfig_SetString(config, fs_encoding, L"utf-8");
+#elif defined(MS_WINDOWS)
+    const wchar_t *encoding;
+    if (preconfig->legacy_windows_fs_encoding) {
+        // Legacy Windows filesystem encoding: mbcs/replace
+        encoding = L"mbcs";
+    }
+    else {
+        // Windows defaults to utf-8/surrogatepass (PEP 529)
+        encoding = L"utf-8";
+    }
+     return PyConfig_SetString(config, fs_encoding, encoding);
+#else  // !MS_WINDOWS
+    if (preconfig->utf8_mode) {
+        return PyConfig_SetString(config, fs_encoding, L"utf-8");
+    }
+
+    if (_Py_GetForceASCII()) {
+        return PyConfig_SetString(config, fs_encoding, L"ascii");
+    }
+
+    return config_get_locale_encoding(config, preconfig, fs_encoding);
+#endif  // !MS_WINDOWS
+}
+
+
 static PyStatus
 config_init_fs_encoding(PyConfig *config, const PyPreConfig *preconfig)
 {
     PyStatus status;
 
     if (config->filesystem_encoding == NULL) {
-#ifdef _Py_FORCE_UTF8_FS_ENCODING
-        status = PyConfig_SetString(config, &config->filesystem_encoding, L"utf-8");
-#else
-
-#ifdef MS_WINDOWS
-        if (preconfig->legacy_windows_fs_encoding) {
-            /* Legacy Windows filesystem encoding: mbcs/replace */
-            status = PyConfig_SetString(config, &config->filesystem_encoding,
-                                        L"mbcs");
-        }
-        else
-#endif
-        if (preconfig->utf8_mode) {
-            status = PyConfig_SetString(config, &config->filesystem_encoding,
-                                        L"utf-8");
-        }
-#ifndef MS_WINDOWS
-        else if (_Py_GetForceASCII()) {
-            status = PyConfig_SetString(config, &config->filesystem_encoding,
-                                        L"ascii");
-        }
-#endif
-        else {
-#ifdef MS_WINDOWS
-            /* Windows defaults to utf-8/surrogatepass (PEP 529). */
-            status = PyConfig_SetString(config, &config->filesystem_encoding,
-                                        L"utf-8");
-#else
-            status = config_get_locale_encoding(config,
-                                                &config->filesystem_encoding);
-#endif
-        }
-#endif   /* !_Py_FORCE_UTF8_FS_ENCODING */
-
+        status = config_get_fs_encoding(config, preconfig,
+                                        &config->filesystem_encoding);
         if (_PyStatus_EXCEPTION(status)) {
             return status;
         }
@@ -1714,7 +2038,7 @@
 
 
 static PyStatus
-config_read(PyConfig *config)
+config_read(PyConfig *config, int compute_path_config)
 {
     PyStatus status;
     const PyPreConfig *preconfig = &_PyRuntime.preconfig;
@@ -1759,7 +2083,7 @@
     }
 
     if (config->_install_importlib) {
-        status = _PyConfig_InitPathConfig(config);
+        status = _PyConfig_InitPathConfig(config, compute_path_config);
         if (_PyStatus_EXCEPTION(status)) {
             return status;
         }
@@ -1814,6 +2138,11 @@
         config->configure_c_stdio = 1;
     }
 
+    // Only parse arguments once.
+    if (config->parse_argv == 1) {
+        config->parse_argv = 2;
+    }
+
     return _PyStatus_OK();
 }
 
@@ -1874,8 +2203,8 @@
     preconfig->use_environment = config->use_environment;
     preconfig->dev_mode = config->dev_mode;
 
-    if (_Py_SetArgcArgv(config->_orig_argv.length,
-                        config->_orig_argv.items) < 0)
+    if (_Py_SetArgcArgv(config->orig_argv.length,
+                        config->orig_argv.items) < 0)
     {
         return _PyStatus_NO_MEMORY();
     }
@@ -2135,7 +2464,7 @@
 {
     /* config_init_warnoptions() add existing config warnoptions at the end:
        ensure that the new option is not already present in this list to
-       prevent change the options order whne config_init_warnoptions() is
+       prevent change the options order when config_init_warnoptions() is
        called twice. */
     if (_PyWideStringList_Find(&config->warnoptions, option)) {
         /* Already present: do nothing */
@@ -2304,7 +2633,7 @@
 {
     PyStatus status;
 
-    if (config->parse_argv) {
+    if (config->parse_argv == 1) {
         if (_PyWideStringList_Copy(&precmdline->argv, &config->argv) < 0) {
             return _PyStatus_NO_MEMORY();
         }
@@ -2382,7 +2711,7 @@
         }
     }
 
-    if (config->parse_argv) {
+    if (config->parse_argv == 1) {
         Py_ssize_t opt_index;
         status = config_parse_cmdline(config, &cmdline_warnoptions, &opt_index);
         if (_PyStatus_EXCEPTION(status)) {
@@ -2500,7 +2829,7 @@
 
    The only side effects are to modify config and to call _Py_SetArgcArgv(). */
 PyStatus
-PyConfig_Read(PyConfig *config)
+_PyConfig_Read(PyConfig *config, int compute_path_config)
 {
     PyStatus status;
 
@@ -2511,11 +2840,11 @@
 
     config_get_global_vars(config);
 
-    if (config->_orig_argv.length == 0
+    if (config->orig_argv.length == 0
         && !(config->argv.length == 1
              && wcscmp(config->argv.items[0], L"") == 0))
     {
-        if (_PyWideStringList_Copy(&config->_orig_argv, &config->argv) < 0) {
+        if (_PyWideStringList_Copy(&config->orig_argv, &config->argv) < 0) {
             return _PyStatus_NO_MEMORY();
         }
     }
@@ -2543,64 +2872,12 @@
         goto done;
     }
 
-    status = config_read(config);
+    status = config_read(config, compute_path_config);
     if (_PyStatus_EXCEPTION(status)) {
         goto done;
     }
 
-    /* Check config consistency */
-    assert(config->isolated >= 0);
-    assert(config->use_environment >= 0);
-    assert(config->dev_mode >= 0);
-    assert(config->_use_peg_parser >= 0);
-    assert(config->install_signal_handlers >= 0);
-    assert(config->use_hash_seed >= 0);
-    assert(config->faulthandler >= 0);
-    assert(config->tracemalloc >= 0);
-    assert(config->site_import >= 0);
-    assert(config->bytes_warning >= 0);
-    assert(config->inspect >= 0);
-    assert(config->interactive >= 0);
-    assert(config->optimization_level >= 0);
-    assert(config->parser_debug >= 0);
-    assert(config->write_bytecode >= 0);
-    assert(config->verbose >= 0);
-    assert(config->quiet >= 0);
-    assert(config->user_site_directory >= 0);
-    assert(config->parse_argv >= 0);
-    assert(config->configure_c_stdio >= 0);
-    assert(config->buffered_stdio >= 0);
-    assert(config->program_name != NULL);
-    assert(_PyWideStringList_CheckConsistency(&config->argv));
-    /* sys.argv must be non-empty: empty argv is replaced with [''] */
-    assert(config->argv.length >= 1);
-    assert(_PyWideStringList_CheckConsistency(&config->xoptions));
-    assert(_PyWideStringList_CheckConsistency(&config->warnoptions));
-    assert(_PyWideStringList_CheckConsistency(&config->module_search_paths));
-    if (config->_install_importlib) {
-        assert(config->module_search_paths_set != 0);
-        /* don't check config->module_search_paths */
-        assert(config->executable != NULL);
-        assert(config->base_executable != NULL);
-        assert(config->prefix != NULL);
-        assert(config->base_prefix != NULL);
-        assert(config->exec_prefix != NULL);
-        assert(config->base_exec_prefix != NULL);
-    }
-    assert(config->platlibdir != NULL);
-    assert(config->filesystem_encoding != NULL);
-    assert(config->filesystem_errors != NULL);
-    assert(config->stdio_encoding != NULL);
-    assert(config->stdio_errors != NULL);
-#ifdef MS_WINDOWS
-    assert(config->legacy_windows_stdio >= 0);
-#endif
-    /* -c and -m options are exclusive */
-    assert(!(config->run_command != NULL && config->run_module != NULL));
-    assert(config->check_hash_pycs_mode != NULL);
-    assert(config->_install_importlib >= 0);
-    assert(config->pathconfig_warnings >= 0);
-    assert(_PyWideStringList_CheckConsistency(&config->_orig_argv));
+    assert(config_check_consistency(config));
 
     status = _PyStatus_OK();
 
@@ -2610,6 +2887,13 @@
 }
 
 
+PyStatus
+PyConfig_Read(PyConfig *config)
+{
+    return _PyConfig_Read(config, 1);
+}
+
+
 PyObject*
 _Py_GetConfigsAsDict(void)
 {
@@ -2632,8 +2916,8 @@
     Py_CLEAR(dict);
 
     /* pre config */
-    PyThreadState *tstate = _PyThreadState_GET();
-    const PyPreConfig *pre_config = &tstate->interp->runtime->preconfig;
+    PyInterpreterState *interp = _PyInterpreterState_GET();
+    const PyPreConfig *pre_config = &interp->runtime->preconfig;
     dict = _PyPreConfig_AsDict(pre_config);
     if (dict == NULL) {
         goto error;
@@ -2644,8 +2928,8 @@
     Py_CLEAR(dict);
 
     /* core config */
-    const PyConfig *config = _PyInterpreterState_GetConfig(tstate->interp);
-    dict = config_as_dict(config);
+    const PyConfig *config = _PyInterpreterState_GetConfig(interp);
+    dict = _PyConfig_AsDict(config);
     if (dict == NULL) {
         goto error;
     }
@@ -2654,6 +2938,16 @@
     }
     Py_CLEAR(dict);
 
+    /* path config */
+    dict = _PyPathConfig_AsDict();
+    if (dict == NULL) {
+        goto error;
+    }
+    if (PyDict_SetItemString(result, "path_config", dict) < 0) {
+        goto error;
+    }
+    Py_CLEAR(dict);
+
     return result;
 
 error:
diff --git a/Python/marshal.c b/Python/marshal.c
index c4538bd..4125240 100644
--- a/Python/marshal.c
+++ b/Python/marshal.c
@@ -524,7 +524,7 @@
         w_object(co->co_filename, p);
         w_object(co->co_name, p);
         w_long(co->co_firstlineno, p);
-        w_object(co->co_lnotab, p);
+        w_object(co->co_linetable, p);
     }
     else if (PyObject_CheckBuffer(v)) {
         /* Write unknown bytes-like objects as a bytes object */
@@ -596,14 +596,18 @@
 {
     char buf[BUFSIZ];
     WFILE wf;
+    if (PySys_Audit("marshal.dumps", "Oi", x, version) < 0) {
+        return; /* caller must check PyErr_Occurred() */
+    }
     memset(&wf, 0, sizeof(wf));
     wf.fp = fp;
     wf.ptr = wf.buf = buf;
     wf.end = wf.ptr + sizeof(buf);
     wf.error = WFERR_OK;
     wf.version = version;
-    if (w_init_refs(&wf, version))
-        return; /* caller mush check PyErr_Occurred() */
+    if (w_init_refs(&wf, version)) {
+        return; /* caller must check PyErr_Occurred() */
+    }
     w_object(x, &wf);
     w_clear_refs(&wf);
     w_flush(&wf);
@@ -638,7 +642,7 @@
         return res;
     }
     if (p->buf == NULL) {
-        p->buf = PyMem_MALLOC(n);
+        p->buf = PyMem_Malloc(n);
         if (p->buf == NULL) {
             PyErr_NoMemory();
             return NULL;
@@ -646,7 +650,7 @@
         p->buf_size = n;
     }
     else if (p->buf_size < n) {
-        char *tmp = PyMem_REALLOC(p->buf, n);
+        char *tmp = PyMem_Realloc(p->buf, n);
         if (tmp == NULL) {
             PyErr_NoMemory();
             return NULL;
@@ -1312,7 +1316,7 @@
             PyObject *filename = NULL;
             PyObject *name = NULL;
             int firstlineno;
-            PyObject *lnotab = NULL;
+            PyObject *linetable = NULL;
 
             idx = r_ref_reserve(flag, p);
             if (idx < 0)
@@ -1367,22 +1371,16 @@
             firstlineno = (int)r_long(p);
             if (firstlineno == -1 && PyErr_Occurred())
                 break;
-            lnotab = r_object(p);
-            if (lnotab == NULL)
+            linetable = r_object(p);
+            if (linetable == NULL)
                 goto code_error;
 
-            if (PySys_Audit("code.__new__", "OOOiiiiii",
-                            code, filename, name, argcount, posonlyargcount,
-                            kwonlyargcount, nlocals, stacksize, flags) < 0) {
-                goto code_error;
-            }
-
             v = (PyObject *) PyCode_NewWithPosOnlyArgs(
                             argcount, posonlyargcount, kwonlyargcount,
                             nlocals, stacksize, flags,
                             code, consts, names, varnames,
                             freevars, cellvars, filename, name,
-                            firstlineno, lnotab);
+                            firstlineno, linetable);
             v = r_ref_insert(v, idx, flag, p);
 
           code_error:
@@ -1394,7 +1392,7 @@
             Py_XDECREF(cellvars);
             Py_XDECREF(filename);
             Py_XDECREF(name);
-            Py_XDECREF(lnotab);
+            Py_XDECREF(linetable);
         }
         retval = v;
         break;
@@ -1435,6 +1433,15 @@
         fprintf(stderr, "XXX readobject called with exception set\n");
         return NULL;
     }
+    if (p->ptr && p->end) {
+        if (PySys_Audit("marshal.loads", "y#", p->ptr, (Py_ssize_t)(p->end - p->ptr)) < 0) {
+            return NULL;
+        }
+    } else if (p->fp || p->readable) {
+        if (PySys_Audit("marshal.load", NULL) < 0) {
+            return NULL;
+        }
+    }
     v = r_object(p);
     if (v == NULL && !PyErr_Occurred())
         PyErr_SetString(PyExc_TypeError, "NULL object in marshal data for object");
@@ -1453,7 +1460,7 @@
     rf.buf = NULL;
     res = r_short(&rf);
     if (rf.buf != NULL)
-        PyMem_FREE(rf.buf);
+        PyMem_Free(rf.buf);
     return res;
 }
 
@@ -1468,7 +1475,7 @@
     rf.buf = NULL;
     res = r_long(&rf);
     if (rf.buf != NULL)
-        PyMem_FREE(rf.buf);
+        PyMem_Free(rf.buf);
     return res;
 }
 
@@ -1501,11 +1508,11 @@
     off_t filesize;
     filesize = getfilesize(fp);
     if (filesize > 0 && filesize <= REASONABLE_FILE_LIMIT) {
-        char* pBuf = (char *)PyMem_MALLOC(filesize);
+        char* pBuf = (char *)PyMem_Malloc(filesize);
         if (pBuf != NULL) {
             size_t n = fread(pBuf, 1, (size_t)filesize, fp);
             PyObject* v = PyMarshal_ReadObjectFromString(pBuf, n);
-            PyMem_FREE(pBuf);
+            PyMem_Free(pBuf);
             return v;
         }
 
@@ -1531,10 +1538,10 @@
     rf.refs = PyList_New(0);
     if (rf.refs == NULL)
         return NULL;
-    result = r_object(&rf);
+    result = read_object(&rf);
     Py_DECREF(rf.refs);
     if (rf.buf != NULL)
-        PyMem_FREE(rf.buf);
+        PyMem_Free(rf.buf);
     return result;
 }
 
@@ -1552,10 +1559,10 @@
     rf.refs = PyList_New(0);
     if (rf.refs == NULL)
         return NULL;
-    result = r_object(&rf);
+    result = read_object(&rf);
     Py_DECREF(rf.refs);
     if (rf.buf != NULL)
-        PyMem_FREE(rf.buf);
+        PyMem_Free(rf.buf);
     return result;
 }
 
@@ -1564,6 +1571,9 @@
 {
     WFILE wf;
 
+    if (PySys_Audit("marshal.dumps", "Oi", x, version) < 0) {
+        return NULL;
+    }
     memset(&wf, 0, sizeof(wf));
     wf.str = PyBytes_FromStringAndSize((char *)NULL, 50);
     if (wf.str == NULL)
@@ -1684,7 +1694,7 @@
             result = read_object(&rf);
             Py_DECREF(rf.refs);
             if (rf.buf != NULL)
-                PyMem_FREE(rf.buf);
+                PyMem_Free(rf.buf);
         } else
             result = NULL;
     }
@@ -1785,28 +1795,30 @@
 loads() -- read value from a bytes-like object");
 
 
+static int
+marshal_module_exec(PyObject *mod)
+{
+    if (PyModule_AddIntConstant(mod, "version", Py_MARSHAL_VERSION) < 0) {
+        return -1;
+    }
+    return 0;
+}
+
+static PyModuleDef_Slot marshalmodule_slots[] = {
+    {Py_mod_exec, marshal_module_exec},
+    {0, NULL}
+};
 
 static struct PyModuleDef marshalmodule = {
     PyModuleDef_HEAD_INIT,
-    "marshal",
-    module_doc,
-    0,
-    marshal_methods,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    .m_name = "marshal",
+    .m_doc = module_doc,
+    .m_methods = marshal_methods,
+    .m_slots = marshalmodule_slots,
 };
 
 PyMODINIT_FUNC
 PyMarshal_Init(void)
 {
-    PyObject *mod = PyModule_Create(&marshalmodule);
-    if (mod == NULL)
-        return NULL;
-    if (PyModule_AddIntConstant(mod, "version", Py_MARSHAL_VERSION) < 0) {
-        Py_DECREF(mod);
-        return NULL;
-    }
-    return mod;
+    return PyModuleDef_Init(&marshalmodule);
 }
diff --git a/Python/modsupport.c b/Python/modsupport.c
index 13482c6..8655daa 100644
--- a/Python/modsupport.c
+++ b/Python/modsupport.c
@@ -283,6 +283,13 @@
 static PyObject *
 do_mkvalue(const char **p_format, va_list *p_va, int flags)
 {
+#define ERROR_NEED_PY_SSIZE_T_CLEAN \
+    { \
+        PyErr_SetString(PyExc_SystemError, \
+                        "PY_SSIZE_T_CLEAN macro must be defined for '#' formats"); \
+        return NULL; \
+    }
+
     for (;;) {
         switch (*(*p_format)++) {
         case '(':
@@ -341,14 +348,12 @@
             Py_ssize_t n;
             if (**p_format == '#') {
                 ++*p_format;
-                if (flags & FLAG_SIZE_T)
+                if (flags & FLAG_SIZE_T) {
                     n = va_arg(*p_va, Py_ssize_t);
+                }
                 else {
                     n = va_arg(*p_va, int);
-                    if (PyErr_WarnEx(PyExc_DeprecationWarning,
-                                "PY_SSIZE_T_CLEAN will be required for '#' formats", 1)) {
-                        return NULL;
-                    }
+                    ERROR_NEED_PY_SSIZE_T_CLEAN;
                 }
             }
             else
@@ -394,14 +399,12 @@
             Py_ssize_t n;
             if (**p_format == '#') {
                 ++*p_format;
-                if (flags & FLAG_SIZE_T)
+                if (flags & FLAG_SIZE_T) {
                     n = va_arg(*p_va, Py_ssize_t);
+                }
                 else {
                     n = va_arg(*p_va, int);
-                    if (PyErr_WarnEx(PyExc_DeprecationWarning,
-                                "PY_SSIZE_T_CLEAN will be required for '#' formats", 1)) {
-                        return NULL;
-                    }
+                    ERROR_NEED_PY_SSIZE_T_CLEAN;
                 }
             }
             else
@@ -432,14 +435,12 @@
             Py_ssize_t n;
             if (**p_format == '#') {
                 ++*p_format;
-                if (flags & FLAG_SIZE_T)
+                if (flags & FLAG_SIZE_T) {
                     n = va_arg(*p_va, Py_ssize_t);
+                }
                 else {
                     n = va_arg(*p_va, int);
-                    if (PyErr_WarnEx(PyExc_DeprecationWarning,
-                                "PY_SSIZE_T_CLEAN will be required for '#' formats", 1)) {
-                        return NULL;
-                    }
+                    ERROR_NEED_PY_SSIZE_T_CLEAN;
                 }
             }
             else
@@ -507,6 +508,8 @@
 
         }
     }
+
+#undef ERROR_NEED_PY_SSIZE_T_CLEAN
 }
 
 
@@ -631,56 +634,70 @@
 
 
 int
-PyModule_AddObject(PyObject *m, const char *name, PyObject *o)
+PyModule_AddObjectRef(PyObject *mod, const char *name, PyObject *value)
 {
-    PyObject *dict;
-    if (!PyModule_Check(m)) {
+    if (!PyModule_Check(mod)) {
         PyErr_SetString(PyExc_TypeError,
-                    "PyModule_AddObject() needs module as first arg");
+                        "PyModule_AddObjectRef() first argument "
+                        "must be a module");
         return -1;
     }
-    if (!o) {
-        if (!PyErr_Occurred())
-            PyErr_SetString(PyExc_TypeError,
-                            "PyModule_AddObject() needs non-NULL value");
+    if (!value) {
+        if (!PyErr_Occurred()) {
+            PyErr_SetString(PyExc_SystemError,
+                            "PyModule_AddObjectRef() must be called "
+                            "with an exception raised if value is NULL");
+        }
         return -1;
     }
 
-    dict = PyModule_GetDict(m);
+    PyObject *dict = PyModule_GetDict(mod);
     if (dict == NULL) {
         /* Internal error -- modules must have a dict! */
         PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__",
-                     PyModule_GetName(m));
+                     PyModule_GetName(mod));
         return -1;
     }
-    if (PyDict_SetItemString(dict, name, o))
+
+    if (PyDict_SetItemString(dict, name, value)) {
         return -1;
-    Py_DECREF(o);
+    }
     return 0;
 }
 
+
+int
+PyModule_AddObject(PyObject *mod, const char *name, PyObject *value)
+{
+    int res = PyModule_AddObjectRef(mod, name, value);
+    if (res == 0) {
+        Py_DECREF(value);
+    }
+    return res;
+}
+
 int
 PyModule_AddIntConstant(PyObject *m, const char *name, long value)
 {
-    PyObject *o = PyLong_FromLong(value);
-    if (!o)
+    PyObject *obj = PyLong_FromLong(value);
+    if (!obj) {
         return -1;
-    if (PyModule_AddObject(m, name, o) == 0)
-        return 0;
-    Py_DECREF(o);
-    return -1;
+    }
+    int res = PyModule_AddObjectRef(m, name, obj);
+    Py_DECREF(obj);
+    return res;
 }
 
 int
 PyModule_AddStringConstant(PyObject *m, const char *name, const char *value)
 {
-    PyObject *o = PyUnicode_FromString(value);
-    if (!o)
+    PyObject *obj = PyUnicode_FromString(value);
+    if (!obj) {
         return -1;
-    if (PyModule_AddObject(m, name, o) == 0)
-        return 0;
-    Py_DECREF(o);
-    return -1;
+    }
+    int res = PyModule_AddObjectRef(m, name, obj);
+    Py_DECREF(obj);
+    return res;
 }
 
 int
@@ -693,11 +710,5 @@
     const char *name = _PyType_Name(type);
     assert(name != NULL);
 
-    Py_INCREF(type);
-    if (PyModule_AddObject(module, name, (PyObject *)type) < 0) {
-        Py_DECREF(type);
-        return -1;
-    }
-
-    return 0;
+    return PyModule_AddObjectRef(module, name, (PyObject *)type);
 }
diff --git a/Python/mysnprintf.c b/Python/mysnprintf.c
index 458ca14..cd69198 100644
--- a/Python/mysnprintf.c
+++ b/Python/mysnprintf.c
@@ -15,10 +15,6 @@
    PyOS_snprintf and PyOS_vsnprintf never write more than size bytes
    (including the trailing '\0') into str.
 
-   If the platform doesn't have vsnprintf, and the buffer size needed to
-   avoid truncation exceeds size by more than 512, Python aborts with a
-   Py_FatalError.
-
    Return value (rv):
 
     When 0 <= rv < size, the output conversion was unexceptional, and
@@ -37,6 +33,7 @@
     PyMem_Malloc couldn't obtain space for a temp buffer.
 
    CAUTION:  Unlike C99, str != NULL and size > 0 are required.
+   Also, size must be smaller than INT_MAX.
 */
 
 int
@@ -56,50 +53,22 @@
 {
     assert(str != NULL);
     assert(size > 0);
+    assert(size <= (INT_MAX - 1));
     assert(format != NULL);
 
     int len;  /* # bytes written, excluding \0 */
-#if defined(_MSC_VER) || defined(HAVE_SNPRINTF)
-#  define _PyOS_vsnprintf_EXTRA_SPACE 1
-#else
-#  define _PyOS_vsnprintf_EXTRA_SPACE 512
-    char *buffer;
-#endif
     /* We take a size_t as input but return an int.  Sanity check
      * our input so that it won't cause an overflow in the
-     * vsnprintf return value or the buffer malloc size.  */
-    if (size > INT_MAX - _PyOS_vsnprintf_EXTRA_SPACE) {
+     * vsnprintf return value.  */
+    if (size > INT_MAX - 1) {
         len = -666;
         goto Done;
     }
 
 #if defined(_MSC_VER)
     len = _vsnprintf(str, size, format, va);
-#elif defined(HAVE_SNPRINTF)
-    len = vsnprintf(str, size, format, va);
 #else
-    /* Emulate vsnprintf(). */
-    buffer = PyMem_MALLOC(size + _PyOS_vsnprintf_EXTRA_SPACE);
-    if (buffer == NULL) {
-        len = -666;
-        goto Done;
-    }
-
-    len = vsprintf(buffer, format, va);
-    if (len < 0) {
-        /* ignore the error */;
-    }
-    else if ((size_t)len >= size + _PyOS_vsnprintf_EXTRA_SPACE) {
-        _Py_FatalErrorFunc(__func__, "Buffer overflow");
-    }
-    else {
-        const size_t to_copy = (size_t)len < size ?
-                                (size_t)len : size - 1;
-        assert(to_copy < size);
-        memcpy(str, buffer, to_copy);
-        str[to_copy] = '\0';
-    }
-    PyMem_FREE(buffer);
+    len = vsnprintf(str, size, format, va);
 #endif
 
 Done:
@@ -107,5 +76,4 @@
         str[size-1] = '\0';
     }
     return len;
-#undef _PyOS_vsnprintf_EXTRA_SPACE
 }
diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h
index 538fdbe..951f8f8 100644
--- a/Python/opcode_targets.h
+++ b/Python/opcode_targets.h
@@ -29,6 +29,11 @@
     &&TARGET_BINARY_TRUE_DIVIDE,
     &&TARGET_INPLACE_FLOOR_DIVIDE,
     &&TARGET_INPLACE_TRUE_DIVIDE,
+    &&TARGET_GET_LEN,
+    &&TARGET_MATCH_MAPPING,
+    &&TARGET_MATCH_SEQUENCE,
+    &&TARGET_MATCH_KEYS,
+    &&TARGET_COPY_DICT_WITHOUT_KEYS,
     &&_unknown_opcode,
     &&_unknown_opcode,
     &&_unknown_opcode,
@@ -43,11 +48,6 @@
     &&_unknown_opcode,
     &&_unknown_opcode,
     &&_unknown_opcode,
-    &&_unknown_opcode,
-    &&_unknown_opcode,
-    &&_unknown_opcode,
-    &&_unknown_opcode,
-    &&TARGET_RERAISE,
     &&TARGET_WITH_EXCEPT_START,
     &&TARGET_GET_AITER,
     &&TARGET_GET_ANEXT,
@@ -98,7 +98,7 @@
     &&TARGET_DELETE_ATTR,
     &&TARGET_STORE_GLOBAL,
     &&TARGET_DELETE_GLOBAL,
-    &&_unknown_opcode,
+    &&TARGET_ROT_N,
     &&TARGET_LOAD_CONST,
     &&TARGET_LOAD_NAME,
     &&TARGET_BUILD_TUPLE,
@@ -118,7 +118,7 @@
     &&TARGET_LOAD_GLOBAL,
     &&TARGET_IS_OP,
     &&TARGET_CONTAINS_OP,
-    &&_unknown_opcode,
+    &&TARGET_RERAISE,
     &&_unknown_opcode,
     &&TARGET_JUMP_IF_NOT_EXC_MATCH,
     &&TARGET_SETUP_FINALLY,
@@ -128,7 +128,7 @@
     &&TARGET_DELETE_FAST,
     &&_unknown_opcode,
     &&_unknown_opcode,
-    &&_unknown_opcode,
+    &&TARGET_GEN_START,
     &&TARGET_RAISE_VARARGS,
     &&TARGET_CALL_FUNCTION,
     &&TARGET_MAKE_FUNCTION,
@@ -151,7 +151,7 @@
     &&_unknown_opcode,
     &&_unknown_opcode,
     &&_unknown_opcode,
-    &&_unknown_opcode,
+    &&TARGET_MATCH_CLASS,
     &&_unknown_opcode,
     &&TARGET_SETUP_ASYNC_WITH,
     &&TARGET_FORMAT_VALUE,
diff --git a/Python/pathconfig.c b/Python/pathconfig.c
index 9a30221..1017a57 100644
--- a/Python/pathconfig.c
+++ b/Python/pathconfig.c
@@ -186,6 +186,80 @@
     return status;
 }
 
+PyObject *
+_PyPathConfig_AsDict(void)
+{
+    PyObject *dict = PyDict_New();
+    if (dict == NULL) {
+        return NULL;
+    }
+
+#define SET_ITEM(KEY, EXPR) \
+        do { \
+            PyObject *obj = (EXPR); \
+            if (obj == NULL) { \
+                goto fail; \
+            } \
+            int res = PyDict_SetItemString(dict, KEY, obj); \
+            Py_DECREF(obj); \
+            if (res < 0) { \
+                goto fail; \
+            } \
+        } while (0)
+#define SET_ITEM_STR(KEY) \
+        SET_ITEM(#KEY, \
+            (_Py_path_config.KEY \
+             ? PyUnicode_FromWideChar(_Py_path_config.KEY, -1) \
+             : (Py_INCREF(Py_None), Py_None)))
+#define SET_ITEM_INT(KEY) \
+        SET_ITEM(#KEY, PyLong_FromLong(_Py_path_config.KEY))
+
+    SET_ITEM_STR(program_full_path);
+    SET_ITEM_STR(prefix);
+    SET_ITEM_STR(exec_prefix);
+    SET_ITEM_STR(module_search_path);
+    SET_ITEM_STR(program_name);
+    SET_ITEM_STR(home);
+#ifdef MS_WINDOWS
+    SET_ITEM_INT(isolated);
+    SET_ITEM_INT(site_import);
+    SET_ITEM_STR(base_executable);
+
+    {
+        wchar_t py3path[MAX_PATH];
+        HMODULE hPython3 = GetModuleHandleW(PY3_DLLNAME);
+        PyObject *obj;
+        if (hPython3
+            && GetModuleFileNameW(hPython3, py3path, Py_ARRAY_LENGTH(py3path)))
+        {
+            obj = PyUnicode_FromWideChar(py3path, -1);
+            if (obj == NULL) {
+                goto fail;
+            }
+        }
+        else {
+            obj = Py_None;
+            Py_INCREF(obj);
+        }
+        if (PyDict_SetItemString(dict, "python3_dll", obj) < 0) {
+            Py_DECREF(obj);
+            goto fail;
+        }
+        Py_DECREF(obj);
+    }
+#endif
+
+#undef SET_ITEM
+#undef SET_ITEM_STR
+#undef SET_ITEM_INT
+
+    return dict;
+
+fail:
+    Py_DECREF(dict);
+    return NULL;
+}
+
 
 PyStatus
 _PyConfig_WritePathConfig(const PyConfig *config)
@@ -258,7 +332,8 @@
    - _PyPathConfig_Calculate()
 */
 static PyStatus
-pathconfig_calculate(_PyPathConfig *pathconfig, const PyConfig *config)
+pathconfig_init(_PyPathConfig *pathconfig, const PyConfig *config,
+                int compute_path_config)
 {
     PyStatus status;
 
@@ -275,12 +350,9 @@
         goto done;
     }
 
-    if (_Py_path_config.module_search_path == NULL) {
+    if (compute_path_config) {
         status = _PyPathConfig_Calculate(pathconfig, config);
     }
-    else {
-        /* Py_SetPath() has been called: avoid _PyPathConfig_Calculate() */
-    }
 
 done:
     PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc);
@@ -289,17 +361,19 @@
 
 
 static PyStatus
-config_calculate_pathconfig(PyConfig *config)
+config_init_pathconfig(PyConfig *config, int compute_path_config)
 {
     _PyPathConfig pathconfig = _PyPathConfig_INIT;
     PyStatus status;
 
-    status = pathconfig_calculate(&pathconfig, config);
+    status = pathconfig_init(&pathconfig, config, compute_path_config);
     if (_PyStatus_EXCEPTION(status)) {
         goto done;
     }
 
-    if (!config->module_search_paths_set) {
+    if (!config->module_search_paths_set
+        && pathconfig.module_search_path != NULL)
+    {
         status = config_init_module_search_paths(config, &pathconfig);
         if (_PyStatus_EXCEPTION(status)) {
             goto done;
@@ -307,7 +381,7 @@
     }
 
 #define COPY_ATTR(PATH_ATTR, CONFIG_ATTR) \
-        if (config->CONFIG_ATTR == NULL) { \
+        if (config->CONFIG_ATTR == NULL && pathconfig.PATH_ATTR != NULL) { \
             if (copy_wstr(&config->CONFIG_ATTR, pathconfig.PATH_ATTR) < 0) { \
                 goto no_memory; \
             } \
@@ -331,7 +405,7 @@
 #undef COPY_ATTR
 
 #ifdef MS_WINDOWS
-    /* If a ._pth file is found: isolated and site_import are overriden */
+    /* If a ._pth file is found: isolated and site_import are overridden */
     if (pathconfig.isolated != -1) {
         config->isolated = pathconfig.isolated;
     }
@@ -353,7 +427,7 @@
 
 
 PyStatus
-_PyConfig_InitPathConfig(PyConfig *config)
+_PyConfig_InitPathConfig(PyConfig *config, int compute_path_config)
 {
     /* Do we need to calculate the path? */
     if (!config->module_search_paths_set
@@ -361,26 +435,26 @@
         || config->prefix == NULL
         || config->exec_prefix == NULL)
     {
-        PyStatus status = config_calculate_pathconfig(config);
+        PyStatus status = config_init_pathconfig(config, compute_path_config);
         if (_PyStatus_EXCEPTION(status)) {
             return status;
         }
     }
 
-    if (config->base_prefix == NULL) {
+    if (config->base_prefix == NULL && config->prefix != NULL) {
         if (copy_wstr(&config->base_prefix, config->prefix) < 0) {
             return _PyStatus_NO_MEMORY();
         }
     }
 
-    if (config->base_exec_prefix == NULL) {
+    if (config->base_exec_prefix == NULL && config->exec_prefix != NULL) {
         if (copy_wstr(&config->base_exec_prefix,
                       config->exec_prefix) < 0) {
             return _PyStatus_NO_MEMORY();
         }
     }
 
-    if (config->base_executable == NULL) {
+    if (config->base_executable == NULL && config->executable != NULL) {
         if (copy_wstr(&config->base_executable,
                       config->executable) < 0) {
             return _PyStatus_NO_MEMORY();
@@ -391,53 +465,6 @@
 }
 
 
-static PyStatus
-pathconfig_global_read(_PyPathConfig *pathconfig)
-{
-    PyConfig config;
-    _PyConfig_InitCompatConfig(&config);
-
-    /* Call _PyConfig_InitPathConfig() */
-    PyStatus status = PyConfig_Read(&config);
-    if (_PyStatus_EXCEPTION(status)) {
-        goto done;
-    }
-
-    status = pathconfig_set_from_config(pathconfig, &config);
-
-done:
-    PyConfig_Clear(&config);
-    return status;
-}
-
-
-static void
-pathconfig_global_init(void)
-{
-    PyStatus status;
-
-    if (_Py_path_config.module_search_path == NULL) {
-        status = pathconfig_global_read(&_Py_path_config);
-        if (_PyStatus_EXCEPTION(status)) {
-            Py_ExitStatusException(status);
-        }
-    }
-    else {
-        /* Global configuration already initialized */
-    }
-
-    assert(_Py_path_config.program_full_path != NULL);
-    assert(_Py_path_config.prefix != NULL);
-    assert(_Py_path_config.exec_prefix != NULL);
-    assert(_Py_path_config.module_search_path != NULL);
-    assert(_Py_path_config.program_name != NULL);
-    /* home can be NULL */
-#ifdef MS_WINDOWS
-    assert(_Py_path_config.base_executable != NULL);
-#endif
-}
-
-
 /* External interface */
 
 static void _Py_NO_RETURN
@@ -457,23 +484,17 @@
     PyMemAllocatorEx old_alloc;
     _PyMem_SetDefaultAllocator(PYMEM_DOMAIN_RAW, &old_alloc);
 
-    /* Getting the program full path calls pathconfig_global_init() */
-    wchar_t *program_full_path = _PyMem_RawWcsdup(Py_GetProgramFullPath());
-
-    PyMem_RawFree(_Py_path_config.program_full_path);
     PyMem_RawFree(_Py_path_config.prefix);
     PyMem_RawFree(_Py_path_config.exec_prefix);
     PyMem_RawFree(_Py_path_config.module_search_path);
 
-    _Py_path_config.program_full_path = program_full_path;
     _Py_path_config.prefix = _PyMem_RawWcsdup(L"");
     _Py_path_config.exec_prefix = _PyMem_RawWcsdup(L"");
     _Py_path_config.module_search_path = _PyMem_RawWcsdup(path);
 
     PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc);
 
-    if (_Py_path_config.program_full_path == NULL
-        || _Py_path_config.prefix == NULL
+    if (_Py_path_config.prefix == NULL
         || _Py_path_config.exec_prefix == NULL
         || _Py_path_config.module_search_path == NULL)
     {
@@ -547,7 +568,6 @@
 wchar_t *
 Py_GetPath(void)
 {
-    pathconfig_global_init();
     return _Py_path_config.module_search_path;
 }
 
@@ -555,7 +575,6 @@
 wchar_t *
 Py_GetPrefix(void)
 {
-    pathconfig_global_init();
     return _Py_path_config.prefix;
 }
 
@@ -563,7 +582,6 @@
 wchar_t *
 Py_GetExecPrefix(void)
 {
-    pathconfig_global_init();
     return _Py_path_config.exec_prefix;
 }
 
@@ -571,7 +589,6 @@
 wchar_t *
 Py_GetProgramFullPath(void)
 {
-    pathconfig_global_init();
     return _Py_path_config.program_full_path;
 }
 
@@ -579,7 +596,6 @@
 wchar_t*
 Py_GetPythonHome(void)
 {
-    pathconfig_global_init();
     return _Py_path_config.home;
 }
 
@@ -587,7 +603,6 @@
 wchar_t *
 Py_GetProgramName(void)
 {
-    pathconfig_global_init();
     return _Py_path_config.program_name;
 }
 
diff --git a/Python/peephole.c b/Python/peephole.c
deleted file mode 100644
index 6954c87..0000000
--- a/Python/peephole.c
+++ /dev/null
@@ -1,538 +0,0 @@
-/* Peephole optimizations for bytecode compiler. */
-
-#include "Python.h"
-
-#include "Python-ast.h"
-#include "node.h"
-#include "ast.h"
-#include "code.h"
-#include "symtable.h"
-#include "opcode.h"
-#include "wordcode_helpers.h"
-
-#define UNCONDITIONAL_JUMP(op)  (op==JUMP_ABSOLUTE || op==JUMP_FORWARD)
-#define CONDITIONAL_JUMP(op) (op==POP_JUMP_IF_FALSE || op==POP_JUMP_IF_TRUE \
-    || op==JUMP_IF_FALSE_OR_POP || op==JUMP_IF_TRUE_OR_POP)
-#define ABSOLUTE_JUMP(op) (op==JUMP_ABSOLUTE \
-    || op==POP_JUMP_IF_FALSE || op==POP_JUMP_IF_TRUE \
-    || op==JUMP_IF_FALSE_OR_POP || op==JUMP_IF_TRUE_OR_POP || op==JUMP_IF_NOT_EXC_MATCH)
-#define JUMPS_ON_TRUE(op) (op==POP_JUMP_IF_TRUE || op==JUMP_IF_TRUE_OR_POP)
-#define GETJUMPTGT(arr, i) (get_arg(arr, i) / sizeof(_Py_CODEUNIT) + \
-        (ABSOLUTE_JUMP(_Py_OPCODE(arr[i])) ? 0 : i+1))
-#define ISBASICBLOCK(blocks, start, end) \
-    (blocks[start]==blocks[end])
-
-
-/* Scans back N consecutive LOAD_CONST instructions, skipping NOPs,
-   returns index of the Nth last's LOAD_CONST's EXTENDED_ARG prefix.
-   Callers are responsible to check CONST_STACK_LEN beforehand.
-*/
-static Py_ssize_t
-lastn_const_start(const _Py_CODEUNIT *codestr, Py_ssize_t i, Py_ssize_t n)
-{
-    assert(n > 0);
-    for (;;) {
-        i--;
-        assert(i >= 0);
-        if (_Py_OPCODE(codestr[i]) == LOAD_CONST) {
-            if (!--n) {
-                while (i > 0 && _Py_OPCODE(codestr[i-1]) == EXTENDED_ARG) {
-                    i--;
-                }
-                return i;
-            }
-        }
-        else {
-            assert(_Py_OPCODE(codestr[i]) == EXTENDED_ARG);
-        }
-    }
-}
-
-/* Scans through EXTENDED ARGs, seeking the index of the effective opcode */
-static Py_ssize_t
-find_op(const _Py_CODEUNIT *codestr, Py_ssize_t codelen, Py_ssize_t i)
-{
-    while (i < codelen && _Py_OPCODE(codestr[i]) == EXTENDED_ARG) {
-        i++;
-    }
-    return i;
-}
-
-/* Given the index of the effective opcode,
-   scan back to construct the oparg with EXTENDED_ARG */
-static unsigned int
-get_arg(const _Py_CODEUNIT *codestr, Py_ssize_t i)
-{
-    _Py_CODEUNIT word;
-    unsigned int oparg = _Py_OPARG(codestr[i]);
-    if (i >= 1 && _Py_OPCODE(word = codestr[i-1]) == EXTENDED_ARG) {
-        oparg |= _Py_OPARG(word) << 8;
-        if (i >= 2 && _Py_OPCODE(word = codestr[i-2]) == EXTENDED_ARG) {
-            oparg |= _Py_OPARG(word) << 16;
-            if (i >= 3 && _Py_OPCODE(word = codestr[i-3]) == EXTENDED_ARG) {
-                oparg |= _Py_OPARG(word) << 24;
-            }
-        }
-    }
-    return oparg;
-}
-
-/* Fill the region with NOPs. */
-static void
-fill_nops(_Py_CODEUNIT *codestr, Py_ssize_t start, Py_ssize_t end)
-{
-    memset(codestr + start, NOP, (end - start) * sizeof(_Py_CODEUNIT));
-}
-
-/* Given the index of the effective opcode,
-   attempt to replace the argument, taking into account EXTENDED_ARG.
-   Returns -1 on failure, or the new op index on success */
-static Py_ssize_t
-set_arg(_Py_CODEUNIT *codestr, Py_ssize_t i, unsigned int oparg)
-{
-    unsigned int curarg = get_arg(codestr, i);
-    int curilen, newilen;
-    if (curarg == oparg)
-        return i;
-    curilen = instrsize(curarg);
-    newilen = instrsize(oparg);
-    if (curilen < newilen) {
-        return -1;
-    }
-
-    write_op_arg(codestr + i + 1 - curilen, _Py_OPCODE(codestr[i]), oparg, newilen);
-    fill_nops(codestr, i + 1 - curilen + newilen, i + 1);
-    return i-curilen+newilen;
-}
-
-/* Attempt to write op/arg at end of specified region of memory.
-   Preceding memory in the region is overwritten with NOPs.
-   Returns -1 on failure, op index on success */
-static Py_ssize_t
-copy_op_arg(_Py_CODEUNIT *codestr, Py_ssize_t i, unsigned char op,
-            unsigned int oparg, Py_ssize_t maxi)
-{
-    int ilen = instrsize(oparg);
-    if (i + ilen > maxi) {
-        return -1;
-    }
-    write_op_arg(codestr + maxi - ilen, op, oparg, ilen);
-    fill_nops(codestr, i, maxi - ilen);
-    return maxi - 1;
-}
-
-/* Replace LOAD_CONST c1, LOAD_CONST c2 ... LOAD_CONST cn, BUILD_TUPLE n
-   with    LOAD_CONST (c1, c2, ... cn).
-   The consts table must still be in list form so that the
-   new constant (c1, c2, ... cn) can be appended.
-   Called with codestr pointing to the first LOAD_CONST.
-*/
-static Py_ssize_t
-fold_tuple_on_constants(_Py_CODEUNIT *codestr, Py_ssize_t codelen,
-                        Py_ssize_t c_start, Py_ssize_t opcode_end,
-                        PyObject *consts, int n)
-{
-    /* Pre-conditions */
-    assert(PyList_CheckExact(consts));
-
-    /* Buildup new tuple of constants */
-    PyObject *newconst = PyTuple_New(n);
-    if (newconst == NULL) {
-        return -1;
-    }
-
-    for (Py_ssize_t i = 0, pos = c_start; i < n; i++, pos++) {
-        assert(pos < opcode_end);
-        pos = find_op(codestr, codelen, pos);
-        assert(_Py_OPCODE(codestr[pos]) == LOAD_CONST);
-
-        unsigned int arg = get_arg(codestr, pos);
-        PyObject *constant = PyList_GET_ITEM(consts, arg);
-        Py_INCREF(constant);
-        PyTuple_SET_ITEM(newconst, i, constant);
-    }
-
-    Py_ssize_t index = PyList_GET_SIZE(consts);
-#if SIZEOF_SIZE_T > SIZEOF_INT
-    if ((size_t)index >= UINT_MAX - 1) {
-        Py_DECREF(newconst);
-        PyErr_SetString(PyExc_OverflowError, "too many constants");
-        return -1;
-    }
-#endif
-
-    /* Append folded constant onto consts */
-    if (PyList_Append(consts, newconst)) {
-        Py_DECREF(newconst);
-        return -1;
-    }
-    Py_DECREF(newconst);
-
-    return copy_op_arg(codestr, c_start, LOAD_CONST,
-                       (unsigned int)index, opcode_end);
-}
-
-static unsigned int *
-markblocks(_Py_CODEUNIT *code, Py_ssize_t len)
-{
-    unsigned int *blocks = PyMem_New(unsigned int, len);
-    int i, j, opcode, blockcnt = 0;
-
-    if (blocks == NULL) {
-        PyErr_NoMemory();
-        return NULL;
-    }
-    memset(blocks, 0, len*sizeof(int));
-
-    /* Mark labels in the first pass */
-    for (i = 0; i < len; i++) {
-        opcode = _Py_OPCODE(code[i]);
-        switch (opcode) {
-            case FOR_ITER:
-            case JUMP_FORWARD:
-            case JUMP_IF_FALSE_OR_POP:
-            case JUMP_IF_TRUE_OR_POP:
-            case POP_JUMP_IF_FALSE:
-            case POP_JUMP_IF_TRUE:
-            case JUMP_IF_NOT_EXC_MATCH:
-            case JUMP_ABSOLUTE:
-            case SETUP_FINALLY:
-            case SETUP_WITH:
-            case SETUP_ASYNC_WITH:
-                j = GETJUMPTGT(code, i);
-                assert(j < len);
-                blocks[j] = 1;
-                break;
-        }
-    }
-    /* Build block numbers in the second pass */
-    for (i = 0; i < len; i++) {
-        blockcnt += blocks[i];          /* increment blockcnt over labels */
-        blocks[i] = blockcnt;
-    }
-    return blocks;
-}
-
-/* Perform basic peephole optimizations to components of a code object.
-   The consts object should still be in list form to allow new constants
-   to be appended.
-
-   To keep the optimizer simple, it bails when the lineno table has complex
-   encoding for gaps >= 255.
-
-   Optimizations are restricted to simple transformations occurring within a
-   single basic block.  All transformations keep the code size the same or
-   smaller.  For those that reduce size, the gaps are initially filled with
-   NOPs.  Later those NOPs are removed and the jump addresses retargeted in
-   a single pass. */
-
-PyObject *
-PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names,
-                PyObject *lnotab_obj)
-{
-    Py_ssize_t h, i, nexti, op_start, tgt;
-    unsigned int j, nops;
-    unsigned char opcode, nextop;
-    _Py_CODEUNIT *codestr = NULL;
-    unsigned char *lnotab;
-    unsigned int cum_orig_offset, last_offset;
-    Py_ssize_t tabsiz;
-    // Count runs of consecutive LOAD_CONSTs
-    unsigned int cumlc = 0, lastlc = 0;
-    unsigned int *blocks = NULL;
-
-    /* Bail out if an exception is set */
-    if (PyErr_Occurred())
-        goto exitError;
-
-    /* Bypass optimization when the lnotab table is too complex */
-    assert(PyBytes_Check(lnotab_obj));
-    lnotab = (unsigned char*)PyBytes_AS_STRING(lnotab_obj);
-    tabsiz = PyBytes_GET_SIZE(lnotab_obj);
-    assert(tabsiz == 0 || Py_REFCNT(lnotab_obj) == 1);
-
-    /* Don't optimize if lnotab contains instruction pointer delta larger
-       than +255 (encoded as multiple bytes), just to keep the peephole optimizer
-       simple. The optimizer leaves line number deltas unchanged. */
-
-    for (i = 0; i < tabsiz; i += 2) {
-        if (lnotab[i] == 255) {
-            goto exitUnchanged;
-        }
-    }
-
-    assert(PyBytes_Check(code));
-    Py_ssize_t codesize = PyBytes_GET_SIZE(code);
-    assert(codesize % sizeof(_Py_CODEUNIT) == 0);
-    Py_ssize_t codelen = codesize / sizeof(_Py_CODEUNIT);
-    if (codelen > INT_MAX) {
-        /* Python assembler is limited to INT_MAX: see assembler.a_offset in
-           compile.c. */
-        goto exitUnchanged;
-    }
-
-    /* Make a modifiable copy of the code string */
-    codestr = (_Py_CODEUNIT *)PyMem_Malloc(codesize);
-    if (codestr == NULL) {
-        PyErr_NoMemory();
-        goto exitError;
-    }
-    memcpy(codestr, PyBytes_AS_STRING(code), codesize);
-
-    blocks = markblocks(codestr, codelen);
-    if (blocks == NULL)
-        goto exitError;
-    assert(PyList_Check(consts));
-
-    for (i=find_op(codestr, codelen, 0) ; i<codelen ; i=nexti) {
-        opcode = _Py_OPCODE(codestr[i]);
-        op_start = i;
-        while (op_start >= 1 && _Py_OPCODE(codestr[op_start-1]) == EXTENDED_ARG) {
-            op_start--;
-        }
-
-        nexti = i + 1;
-        while (nexti < codelen && _Py_OPCODE(codestr[nexti]) == EXTENDED_ARG)
-            nexti++;
-        nextop = nexti < codelen ? _Py_OPCODE(codestr[nexti]) : 0;
-
-        lastlc = cumlc;
-        cumlc = 0;
-
-        switch (opcode) {
-                /* Skip over LOAD_CONST trueconst
-                   POP_JUMP_IF_FALSE xx.  This improves
-                   "while 1" performance.  */
-            case LOAD_CONST:
-                cumlc = lastlc + 1;
-                if (nextop != POP_JUMP_IF_FALSE  ||
-                    !ISBASICBLOCK(blocks, op_start, i + 1)) {
-                    break;
-                }
-                PyObject* cnt = PyList_GET_ITEM(consts, get_arg(codestr, i));
-                int is_true = PyObject_IsTrue(cnt);
-                if (is_true == -1) {
-                    goto exitError;
-                }
-                if (is_true == 1) {
-                    fill_nops(codestr, op_start, nexti + 1);
-                    cumlc = 0;
-                }
-                break;
-
-                /* Try to fold tuples of constants.
-                   Skip over BUILD_SEQN 1 UNPACK_SEQN 1.
-                   Replace BUILD_SEQN 2 UNPACK_SEQN 2 with ROT2.
-                   Replace BUILD_SEQN 3 UNPACK_SEQN 3 with ROT3 ROT2. */
-            case BUILD_TUPLE:
-                j = get_arg(codestr, i);
-                if (j > 0 && lastlc >= j) {
-                    h = lastn_const_start(codestr, op_start, j);
-                    if (ISBASICBLOCK(blocks, h, op_start)) {
-                        h = fold_tuple_on_constants(codestr, codelen,
-                                                    h, i+1, consts, j);
-                        break;
-                    }
-                }
-                if (nextop != UNPACK_SEQUENCE  ||
-                    !ISBASICBLOCK(blocks, op_start, i + 1) ||
-                    j != get_arg(codestr, nexti))
-                    break;
-                if (j < 2) {
-                    fill_nops(codestr, op_start, nexti + 1);
-                } else if (j == 2) {
-                    codestr[op_start] = PACKOPARG(ROT_TWO, 0);
-                    fill_nops(codestr, op_start + 1, nexti + 1);
-                } else if (j == 3) {
-                    codestr[op_start] = PACKOPARG(ROT_THREE, 0);
-                    codestr[op_start + 1] = PACKOPARG(ROT_TWO, 0);
-                    fill_nops(codestr, op_start + 2, nexti + 1);
-                }
-                break;
-
-                /* Simplify conditional jump to conditional jump where the
-                   result of the first test implies the success of a similar
-                   test or the failure of the opposite test.
-                   Arises in code like:
-                   "a and b or c"
-                   "(a and b) and c"
-                   "(a or b) or c"
-                   "(a or b) and c"
-                   x:JUMP_IF_FALSE_OR_POP y   y:JUMP_IF_FALSE_OR_POP z
-                      -->  x:JUMP_IF_FALSE_OR_POP z
-                   x:JUMP_IF_FALSE_OR_POP y   y:JUMP_IF_TRUE_OR_POP z
-                      -->  x:POP_JUMP_IF_FALSE y+1
-                   where y+1 is the instruction following the second test.
-                */
-            case JUMP_IF_FALSE_OR_POP:
-            case JUMP_IF_TRUE_OR_POP:
-                h = get_arg(codestr, i) / sizeof(_Py_CODEUNIT);
-                tgt = find_op(codestr, codelen, h);
-
-                j = _Py_OPCODE(codestr[tgt]);
-                if (CONDITIONAL_JUMP(j)) {
-                    /* NOTE: all possible jumps here are absolute. */
-                    if (JUMPS_ON_TRUE(j) == JUMPS_ON_TRUE(opcode)) {
-                        /* The second jump will be taken iff the first is.
-                           The current opcode inherits its target's
-                           stack effect */
-                        h = set_arg(codestr, i, get_arg(codestr, tgt));
-                    } else {
-                        /* The second jump is not taken if the first is (so
-                           jump past it), and all conditional jumps pop their
-                           argument when they're not taken (so change the
-                           first jump to pop its argument when it's taken). */
-                        Py_ssize_t arg = (tgt + 1);
-                        /* cannot overflow: codelen <= INT_MAX */
-                        assert((size_t)arg <= UINT_MAX / sizeof(_Py_CODEUNIT));
-                        arg *= sizeof(_Py_CODEUNIT);
-                        h = set_arg(codestr, i, (unsigned int)arg);
-                        j = opcode == JUMP_IF_TRUE_OR_POP ?
-                            POP_JUMP_IF_TRUE : POP_JUMP_IF_FALSE;
-                    }
-
-                    if (h >= 0) {
-                        nexti = h;
-                        codestr[nexti] = PACKOPARG(j, _Py_OPARG(codestr[nexti]));
-                        break;
-                    }
-                }
-                /* Intentional fallthrough */
-
-                /* Replace jumps to unconditional jumps */
-            case POP_JUMP_IF_FALSE:
-            case POP_JUMP_IF_TRUE:
-            case JUMP_FORWARD:
-            case JUMP_ABSOLUTE:
-                h = GETJUMPTGT(codestr, i);
-                tgt = find_op(codestr, codelen, h);
-                /* Replace JUMP_* to a RETURN into just a RETURN */
-                if (UNCONDITIONAL_JUMP(opcode) &&
-                    _Py_OPCODE(codestr[tgt]) == RETURN_VALUE) {
-                    codestr[op_start] = PACKOPARG(RETURN_VALUE, 0);
-                    fill_nops(codestr, op_start + 1, i + 1);
-                } else if (UNCONDITIONAL_JUMP(_Py_OPCODE(codestr[tgt]))) {
-                    size_t arg = GETJUMPTGT(codestr, tgt);
-                    if (opcode == JUMP_FORWARD) { /* JMP_ABS can go backwards */
-                        opcode = JUMP_ABSOLUTE;
-                    } else if (!ABSOLUTE_JUMP(opcode)) {
-                        if (arg < (size_t)(i + 1)) {
-                            break;           /* No backward relative jumps */
-                        }
-                        arg -= i + 1;          /* Calc relative jump addr */
-                    }
-                    /* cannot overflow: codelen <= INT_MAX */
-                    assert(arg <= (UINT_MAX / sizeof(_Py_CODEUNIT)));
-                    arg *= sizeof(_Py_CODEUNIT);
-                    copy_op_arg(codestr, op_start, opcode,
-                                (unsigned int)arg, i + 1);
-                }
-                break;
-
-                /* Remove unreachable ops after RETURN */
-            case RETURN_VALUE:
-                h = i + 1;
-                while (h < codelen && ISBASICBLOCK(blocks, i, h))
-                {
-                    /* Leave SETUP_FINALLY and RERAISE in place to help find block limits. */
-                    if (_Py_OPCODE(codestr[h]) == SETUP_FINALLY || _Py_OPCODE(codestr[h]) == RERAISE) {
-                        while (h > i + 1 &&
-                               _Py_OPCODE(codestr[h - 1]) == EXTENDED_ARG)
-                        {
-                            h--;
-                        }
-                        break;
-                    }
-                    h++;
-                }
-                if (h > i + 1) {
-                    fill_nops(codestr, i + 1, h);
-                    nexti = find_op(codestr, codelen, h);
-                }
-                break;
-        }
-    }
-
-    /* Fixup lnotab */
-    for (i = 0, nops = 0; i < codelen; i++) {
-        size_t block = (size_t)i - nops;
-        /* cannot overflow: codelen <= INT_MAX */
-        assert(block <= UINT_MAX);
-        /* original code offset => new code offset */
-        blocks[i] = (unsigned int)block;
-        if (_Py_OPCODE(codestr[i]) == NOP) {
-            nops++;
-        }
-    }
-    cum_orig_offset = 0;
-    last_offset = 0;
-    for (i=0 ; i < tabsiz ; i+=2) {
-        unsigned int offset_delta, new_offset;
-        cum_orig_offset += lnotab[i];
-        assert(cum_orig_offset % sizeof(_Py_CODEUNIT) == 0);
-        new_offset = blocks[cum_orig_offset / sizeof(_Py_CODEUNIT)] *
-                sizeof(_Py_CODEUNIT);
-        offset_delta = new_offset - last_offset;
-        assert(offset_delta <= 255);
-        lnotab[i] = (unsigned char)offset_delta;
-        last_offset = new_offset;
-    }
-
-    /* Remove NOPs and fixup jump targets */
-    for (op_start = i = h = 0; i < codelen; i++, op_start = i) {
-        j = _Py_OPARG(codestr[i]);
-        while (_Py_OPCODE(codestr[i]) == EXTENDED_ARG) {
-            i++;
-            j = j<<8 | _Py_OPARG(codestr[i]);
-        }
-        opcode = _Py_OPCODE(codestr[i]);
-        switch (opcode) {
-            case NOP:continue;
-
-            case JUMP_ABSOLUTE:
-            case POP_JUMP_IF_FALSE:
-            case POP_JUMP_IF_TRUE:
-            case JUMP_IF_FALSE_OR_POP:
-            case JUMP_IF_TRUE_OR_POP:
-            case JUMP_IF_NOT_EXC_MATCH:
-                j = blocks[j / sizeof(_Py_CODEUNIT)] * sizeof(_Py_CODEUNIT);
-                break;
-
-            case FOR_ITER:
-            case JUMP_FORWARD:
-            case SETUP_FINALLY:
-            case SETUP_WITH:
-            case SETUP_ASYNC_WITH:
-                j = blocks[j / sizeof(_Py_CODEUNIT) + i + 1] - blocks[i] - 1;
-                j *= sizeof(_Py_CODEUNIT);
-                break;
-        }
-        Py_ssize_t ilen = i - op_start + 1;
-        if (instrsize(j) > ilen) {
-            goto exitUnchanged;
-        }
-        /* If instrsize(j) < ilen, we'll emit EXTENDED_ARG 0 */
-        if (ilen > 4) {
-            /* Can only happen when PyCode_Optimize() is called with
-               malformed bytecode. */
-            goto exitUnchanged;
-        }
-        write_op_arg(codestr + h, opcode, j, (int)ilen);
-        h += ilen;
-    }
-    assert(h + (Py_ssize_t)nops == codelen);
-
-    PyMem_Free(blocks);
-    code = PyBytes_FromStringAndSize((char *)codestr, h * sizeof(_Py_CODEUNIT));
-    PyMem_Free(codestr);
-    return code;
-
- exitError:
-    code = NULL;
-
- exitUnchanged:
-    Py_XINCREF(code);
-    PyMem_Free(blocks);
-    PyMem_Free(codestr);
-    return code;
-}
diff --git a/Python/preconfig.c b/Python/preconfig.c
index 262738f..ae1cc3f 100644
--- a/Python/preconfig.c
+++ b/Python/preconfig.c
@@ -19,11 +19,6 @@
 
 /* --- File system encoding/errors -------------------------------- */
 
-/* The filesystem encoding is chosen by config_init_fs_encoding(),
-   see also initfsencoding().
-
-   Py_FileSystemDefaultEncoding and Py_FileSystemDefaultEncodeErrors
-   are encoded to UTF-8. */
 const char *Py_FileSystemDefaultEncoding = NULL;
 int Py_HasFileSystemDefaultEncoding = 0;
 const char *Py_FileSystemDefaultEncodeErrors = NULL;
@@ -44,7 +39,10 @@
 
 
 /* Set Py_FileSystemDefaultEncoding and Py_FileSystemDefaultEncodeErrors
-   global configuration variables. */
+   global configuration variables to PyConfig.filesystem_encoding and
+   PyConfig.filesystem_errors (encoded to UTF-8).
+
+   Function called by _PyUnicode_InitEncodings(). */
 int
 _Py_SetFileSystemEncoding(const char *encoding, const char *errors)
 {
@@ -171,6 +169,7 @@
     COPY_ATTR(isolated);
     COPY_ATTR(use_environment);
     COPY_ATTR(dev_mode);
+    COPY_ATTR(warn_default_encoding);
     return _PyStatus_OK();
 
 #undef COPY_ATTR
@@ -259,9 +258,17 @@
         cmdline->dev_mode = 0;
     }
 
+    // warn_default_encoding
+    if (_Py_get_xoption(&cmdline->xoptions, L"warn_default_encoding")
+            || _Py_GetEnv(cmdline->use_environment, "PYTHONWARNDEFAULTENCODING"))
+    {
+        cmdline->warn_default_encoding = 1;
+    }
+
     assert(cmdline->use_environment >= 0);
     assert(cmdline->isolated >= 0);
     assert(cmdline->dev_mode >= 0);
+    assert(cmdline->warn_default_encoding >= 0);
 
     return _PyStatus_OK();
 }
@@ -291,7 +298,17 @@
     config->coerce_c_locale_warn = 0;
 
     config->dev_mode = -1;
+#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+    /* bpo-40512: pymalloc is not compatible with subinterpreters,
+       force usage of libc malloc() which is thread-safe. */
+#ifdef Py_DEBUG
+    config->allocator = PYMEM_ALLOCATOR_MALLOC_DEBUG;
+#else
+    config->allocator = PYMEM_ALLOCATOR_MALLOC;
+#endif
+#else
     config->allocator = PYMEM_ALLOCATOR_NOT_SET;
+#endif
 #ifdef MS_WINDOWS
     config->legacy_windows_fs_encoding = -1;
 #endif
@@ -819,13 +836,6 @@
     int init_legacy_encoding = Py_LegacyWindowsFSEncodingFlag;
 #endif
 
-    if (args) {
-        status = _PyPreCmdline_SetArgv(&cmdline, args);
-        if (_PyStatus_EXCEPTION(status)) {
-            goto done;
-        }
-    }
-
     int locale_coerced = 0;
     int loops = 0;
 
@@ -836,7 +846,7 @@
         loops++;
         if (loops == 3) {
             status = _PyStatus_ERR("Encoding changed twice while "
-                               "reading the configuration");
+                                   "reading the configuration");
             goto done;
         }
 
@@ -847,6 +857,15 @@
         Py_LegacyWindowsFSEncodingFlag = config->legacy_windows_fs_encoding;
 #endif
 
+        if (args) {
+            // Set command line arguments at each iteration. If they are bytes
+            // strings, they are decoded from the new encoding.
+            status = _PyPreCmdline_SetArgv(&cmdline, args);
+            if (_PyStatus_EXCEPTION(status)) {
+                goto done;
+            }
+        }
+
         status = preconfig_read(config, &cmdline);
         if (_PyStatus_EXCEPTION(status)) {
             goto done;
@@ -886,7 +905,7 @@
         }
 
         /* Reset the configuration before reading again the configuration,
-           just keep UTF-8 Mode value. */
+           just keep UTF-8 Mode and coerce C locale value. */
         int new_utf8_mode = config->utf8_mode;
         int new_coerce_c_locale = config->coerce_c_locale;
         preconfig_copy(config, &save_config);
diff --git a/Python/pyarena.c b/Python/pyarena.c
index aefb787..ead0337 100644
--- a/Python/pyarena.c
+++ b/Python/pyarena.c
@@ -1,4 +1,5 @@
 #include "Python.h"
+#include "pycore_pyarena.h"       // PyArena
 
 /* A simple arena block structure.
 
@@ -125,7 +126,7 @@
 }
 
 PyArena *
-PyArena_New()
+_PyArena_New(void)
 {
     PyArena* arena = (PyArena *)PyMem_Malloc(sizeof(PyArena));
     if (!arena)
@@ -154,7 +155,7 @@
 }
 
 void
-PyArena_Free(PyArena *arena)
+_PyArena_Free(PyArena *arena)
 {
     assert(arena);
 #if defined(Py_DEBUG)
@@ -177,7 +178,7 @@
 }
 
 void *
-PyArena_Malloc(PyArena *arena, size_t size)
+_PyArena_Malloc(PyArena *arena, size_t size)
 {
     void *p = block_alloc(arena->a_cur, size);
     if (!p)
@@ -200,7 +201,7 @@
 }
 
 int
-PyArena_AddPyObject(PyArena *arena, PyObject *obj)
+_PyArena_AddPyObject(PyArena *arena, PyObject *obj)
 {
     int r = PyList_Append(arena->a_objects, obj);
     if (r >= 0) {
diff --git a/Python/pyhash.c b/Python/pyhash.c
index 3843079..f0c8235 100644
--- a/Python/pyhash.c
+++ b/Python/pyhash.c
@@ -56,8 +56,12 @@
    If the result of the reduction is infinity (this is impossible for
    integers, floats and Decimals) then use the predefined hash value
    _PyHASH_INF for x >= 0, or -_PyHASH_INF for x < 0, instead.
-   _PyHASH_INF, -_PyHASH_INF and _PyHASH_NAN are also used for the
-   hashes of float and Decimal infinities and nans.
+   _PyHASH_INF and -_PyHASH_INF are also used for the
+   hashes of float and Decimal infinities.
+
+   NaNs hash with a pointer hash.  Having distinct hash values prevents
+   catastrophic pileups from distinct NaN instances which used to always
+   have the same hash value but would compare unequal.
 
    A selling point for the above strategy is that it makes it possible
    to compute hashes of decimal and binary floating-point numbers
@@ -82,8 +86,10 @@
 
    */
 
+Py_hash_t _Py_HashPointer(const void *);
+
 Py_hash_t
-_Py_HashDouble(double v)
+_Py_HashDouble(PyObject *inst, double v)
 {
     int e, sign;
     double m;
@@ -93,7 +99,7 @@
         if (Py_IS_INFINITY(v))
             return v > 0 ? _PyHASH_INF : -_PyHASH_INF;
         else
-            return _PyHASH_NAN;
+            return _Py_HashPointer(inst);
     }
 
     m = frexp(v, &e);
@@ -200,18 +206,14 @@
 _PyHash_Fini(void)
 {
 #ifdef Py_HASH_STATS
-    int i;
-    Py_ssize_t total = 0;
-    const char *fmt = "%2i %8" PY_FORMAT_SIZE_T "d %8" PY_FORMAT_SIZE_T "d\n";
-
     fprintf(stderr, "len   calls    total\n");
-    for (i = 1; i <= Py_HASH_STATS_MAX; i++) {
+    Py_ssize_t total = 0;
+    for (int i = 1; i <= Py_HASH_STATS_MAX; i++) {
         total += hashstats[i];
-        fprintf(stderr, fmt, i, hashstats[i], total);
+        fprintf(stderr, "%2i %8zd %8zd\n", i, hashstats[i], total);
     }
     total += hashstats[0];
-    fprintf(stderr, ">  %8" PY_FORMAT_SIZE_T "d %8" PY_FORMAT_SIZE_T "d\n",
-            hashstats[0], total);
+    fprintf(stderr, ">  %8zd %8zd\n", hashstats[0], total);
 #endif
 }
 
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 60f091c..eeaf20b 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -2,13 +2,10 @@
 
 #include "Python.h"
 
-#include "Python-ast.h"
-#undef Yield   /* undefine macro conflicting with <winbase.h> */
-
 #include "pycore_ceval.h"         // _PyEval_FiniGIL()
 #include "pycore_context.h"       // _PyContext_Init()
 #include "pycore_fileutils.h"     // _Py_ResetForceASCII()
-#include "pycore_import.h"        // _PyImport_Cleanup()
+#include "pycore_import.h"        // _PyImport_BootstrapImp()
 #include "pycore_initconfig.h"    // _PyStatus_OK()
 #include "pycore_object.h"        // _PyDebug_PrintTotalRefs()
 #include "pycore_pathconfig.h"    // _PyConfig_WritePathConfig()
@@ -18,9 +15,12 @@
 #include "pycore_sysmodule.h"     // _PySys_ClearAuditHooks()
 #include "pycore_traceback.h"     // _Py_DumpTracebackThreads()
 
-#include "grammar.h"              // PyGrammar_RemoveAccelerators()
 #include <locale.h>               // setlocale()
 
+#if defined(__APPLE__)
+#include <mach-o/loader.h>
+#endif
+
 #ifdef HAVE_SIGNAL_H
 #  include <signal.h>             // SIG_IGN
 #endif
@@ -38,6 +38,8 @@
        (PyObject_TypeCheck((op), &PyWindowsConsoleIO_Type))
 #endif
 
+#define PUTS(fd, str) _Py_write_noraise(fd, str, (int)strlen(str))
+
 
 _Py_IDENTIFIER(flush);
 _Py_IDENTIFIER(name);
@@ -50,19 +52,40 @@
 extern "C" {
 #endif
 
-extern grammar _PyParser_Grammar; /* From graminit.c */
 
 /* Forward declarations */
 static PyStatus add_main_module(PyInterpreterState *interp);
 static PyStatus init_import_site(void);
 static PyStatus init_set_builtins_open(void);
 static PyStatus init_sys_streams(PyThreadState *tstate);
-static void call_py_exitfuncs(PyThreadState *tstate);
 static void wait_for_thread_shutdown(PyThreadState *tstate);
 static void call_ll_exitfuncs(_PyRuntimeState *runtime);
 
 int _Py_UnhandledKeyboardInterrupt = 0;
-_PyRuntimeState _PyRuntime = _PyRuntimeState_INIT;
+
+/* The following places the `_PyRuntime` structure in a location that can be
+ * found without any external information. This is meant to ease access to the
+ * interpreter state for various runtime debugging tools, but is *not* an
+ * officially supported feature */
+
+#if defined(MS_WINDOWS)
+
+#pragma section("PyRuntime", read, write)
+__declspec(allocate("PyRuntime"))
+
+#elif defined(__APPLE__)
+
+__attribute__((
+    section(SEG_DATA ",PyRuntime")
+))
+
+#endif
+
+_PyRuntimeState _PyRuntime
+#if defined(__linux__) && (defined(__GNUC__) || defined(__clang__))
+__attribute__ ((section (".PyRuntime")))
+#endif
+= _PyRuntimeState_INIT;
 static int runtime_initialized = 0;
 
 PyStatus
@@ -99,14 +122,6 @@
 int (*_PyOS_mystrnicmp_hack)(const char *, const char *, Py_ssize_t) = \
     PyOS_mystrnicmp; /* Python/pystrcmp.o */
 
-/* PyModule_GetWarningsModule is no longer necessary as of 2.6
-since _warnings is builtin.  This API should not be used. */
-PyObject *
-PyModule_GetWarningsModule(void)
-{
-    return PyImport_ImportModule("warnings");
-}
-
 
 /* APIs to access the initialization flags
  *
@@ -137,59 +152,54 @@
    having the lock, but you cannot use multiple threads.)
 
 */
-
-static PyStatus
+static int
 init_importlib(PyThreadState *tstate, PyObject *sysmod)
 {
-    PyObject *importlib;
-    PyObject *impmod;
-    PyObject *value;
+    assert(!_PyErr_Occurred(tstate));
+
     PyInterpreterState *interp = tstate->interp;
     int verbose = _PyInterpreterState_GetConfig(interp)->verbose;
 
-    /* Import _importlib through its frozen version, _frozen_importlib. */
-    if (PyImport_ImportFrozenModule("_frozen_importlib") <= 0) {
-        return _PyStatus_ERR("can't import _frozen_importlib");
-    }
-    else if (verbose) {
+    // Import _importlib through its frozen version, _frozen_importlib.
+    if (verbose) {
         PySys_FormatStderr("import _frozen_importlib # frozen\n");
     }
-    importlib = PyImport_AddModule("_frozen_importlib");
+    if (PyImport_ImportFrozenModule("_frozen_importlib") <= 0) {
+        return -1;
+    }
+    PyObject *importlib = PyImport_AddModule("_frozen_importlib"); // borrowed
     if (importlib == NULL) {
-        return _PyStatus_ERR("couldn't get _frozen_importlib from sys.modules");
+        return -1;
     }
-    interp->importlib = importlib;
-    Py_INCREF(interp->importlib);
+    interp->importlib = Py_NewRef(importlib);
 
-    interp->import_func = PyDict_GetItemString(interp->builtins, "__import__");
-    if (interp->import_func == NULL)
-        return _PyStatus_ERR("__import__ not found");
-    Py_INCREF(interp->import_func);
-
-    /* Import the _imp module */
-    impmod = PyInit__imp();
-    if (impmod == NULL) {
-        return _PyStatus_ERR("can't import _imp");
-    }
-    else if (verbose) {
+    // Import the _imp module
+    if (verbose) {
         PySys_FormatStderr("import _imp # builtin\n");
     }
-    if (_PyImport_SetModuleString("_imp", impmod) < 0) {
-        return _PyStatus_ERR("can't save _imp to sys.modules");
+    PyObject *imp_mod = _PyImport_BootstrapImp(tstate);
+    if (imp_mod == NULL) {
+        return -1;
+    }
+    if (_PyImport_SetModuleString("_imp", imp_mod) < 0) {
+        Py_DECREF(imp_mod);
+        return -1;
     }
 
-    /* Install importlib as the implementation of import */
-    value = PyObject_CallMethod(importlib, "_install", "OO", sysmod, impmod);
+    // Install importlib as the implementation of import
+    PyObject *value = PyObject_CallMethod(importlib, "_install",
+                                          "OO", sysmod, imp_mod);
+    Py_DECREF(imp_mod);
     if (value == NULL) {
-        _PyErr_Print(tstate);
-        return _PyStatus_ERR("importlib install failed");
+        return -1;
     }
     Py_DECREF(value);
-    Py_DECREF(impmod);
 
-    return _PyStatus_OK();
+    assert(!_PyErr_Occurred(tstate));
+    return 0;
 }
 
+
 static PyStatus
 init_importlib_external(PyThreadState *tstate)
 {
@@ -430,6 +440,69 @@
 }
 
 
+static int
+interpreter_update_config(PyThreadState *tstate, int only_update_path_config)
+{
+    const PyConfig *config = &tstate->interp->config;
+
+    if (!only_update_path_config) {
+        PyStatus status = _PyConfig_Write(config, tstate->interp->runtime);
+        if (_PyStatus_EXCEPTION(status)) {
+            _PyErr_SetFromPyStatus(status);
+            return -1;
+        }
+    }
+
+    if (_Py_IsMainInterpreter(tstate->interp)) {
+        PyStatus status = _PyConfig_WritePathConfig(config);
+        if (_PyStatus_EXCEPTION(status)) {
+            _PyErr_SetFromPyStatus(status);
+            return -1;
+        }
+    }
+
+    // Update the sys module for the new configuration
+    if (_PySys_UpdateConfig(tstate) < 0) {
+        return -1;
+    }
+    return 0;
+}
+
+
+int
+_PyInterpreterState_SetConfig(const PyConfig *src_config)
+{
+    PyThreadState *tstate = PyThreadState_Get();
+    int res = -1;
+
+    PyConfig config;
+    PyConfig_InitPythonConfig(&config);
+    PyStatus status = _PyConfig_Copy(&config, src_config);
+    if (_PyStatus_EXCEPTION(status)) {
+        _PyErr_SetFromPyStatus(status);
+        goto done;
+    }
+
+    status = PyConfig_Read(&config);
+    if (_PyStatus_EXCEPTION(status)) {
+        _PyErr_SetFromPyStatus(status);
+        goto done;
+    }
+
+    status = _PyConfig_Copy(&tstate->interp->config, &config);
+    if (_PyStatus_EXCEPTION(status)) {
+        _PyErr_SetFromPyStatus(status);
+        goto done;
+    }
+
+    res = interpreter_update_config(tstate, 0);
+
+done:
+    PyConfig_Clear(&config);
+    return res;
+}
+
+
 /* Global initializations.  Can be undone by Py_Finalize().  Don't
    call this twice without an intervening Py_Finalize() call.
 
@@ -464,7 +537,7 @@
         return status;
     }
 
-    status = _PyInterpreterState_SetConfig(interp, config);
+    status = _PyConfig_Copy(&interp->config, config);
     if (_PyStatus_EXCEPTION(status)) {
         return status;
     }
@@ -524,10 +597,10 @@
 
     /* finalize_interp_delete() comment explains why _PyEval_FiniGIL() is
        only called here. */
-    _PyEval_FiniGIL(tstate);
+    _PyEval_FiniGIL(tstate->interp);
 
     /* Auto-thread-state API */
-    status = _PyGILState_Init(tstate);
+    status = _PyGILState_SetTstate(tstate);
     if (_PyStatus_EXCEPTION(status)) {
         return status;
     }
@@ -547,12 +620,19 @@
                           const PyConfig *config,
                           PyThreadState **tstate_p)
 {
+    /* Auto-thread-state API */
+    PyStatus status = _PyGILState_Init(runtime);
+    if (_PyStatus_EXCEPTION(status)) {
+        return status;
+    }
+
     PyInterpreterState *interp = PyInterpreterState_New();
     if (interp == NULL) {
         return _PyStatus_ERR("can't make main interpreter");
     }
+    assert(_Py_IsMainInterpreter(interp));
 
-    PyStatus status = _PyInterpreterState_SetConfig(interp, config);
+    status = _PyConfig_Copy(&interp->config, config);
     if (_PyStatus_EXCEPTION(status)) {
         return status;
     }
@@ -574,51 +654,75 @@
 
 
 static PyStatus
-pycore_init_types(PyThreadState *tstate)
+pycore_init_singletons(PyInterpreterState *interp)
 {
     PyStatus status;
-    int is_main_interp = _Py_IsMainInterpreter(tstate);
 
-    status = _PyGC_Init(tstate);
+    if (_PyLong_Init(interp) < 0) {
+        return _PyStatus_ERR("can't init longs");
+    }
+
+    if (_Py_IsMainInterpreter(interp)) {
+        _PyFloat_Init();
+    }
+
+    status = _PyBytes_Init(interp);
     if (_PyStatus_EXCEPTION(status)) {
         return status;
     }
 
+    status = _PyUnicode_Init(interp);
+    if (_PyStatus_EXCEPTION(status)) {
+        return status;
+    }
+
+    status = _PyTuple_Init(interp);
+    if (_PyStatus_EXCEPTION(status)) {
+        return status;
+    }
+
+    return _PyStatus_OK();
+}
+
+
+static PyStatus
+pycore_init_types(PyInterpreterState *interp)
+{
+    PyStatus status;
+    int is_main_interp = _Py_IsMainInterpreter(interp);
+
     if (is_main_interp) {
+        if (_PyStructSequence_Init() < 0) {
+            return _PyStatus_ERR("can't initialize structseq");
+        }
+
         status = _PyTypes_Init();
         if (_PyStatus_EXCEPTION(status)) {
             return status;
         }
-    }
 
+        if (_PyLong_InitTypes() < 0) {
+            return _PyStatus_ERR("can't init int type");
+        }
 
-    if (!_PyLong_Init(tstate)) {
-        return _PyStatus_ERR("can't init longs");
-    }
-
-    if (is_main_interp) {
-        status = _PyUnicode_Init();
+        status = _PyUnicode_InitTypes();
         if (_PyStatus_EXCEPTION(status)) {
             return status;
         }
     }
 
-    status = _PyExc_Init();
+    if (is_main_interp) {
+        if (_PyFloat_InitTypes() < 0) {
+            return _PyStatus_ERR("can't init float");
+        }
+    }
+
+    status = _PyExc_Init(interp);
     if (_PyStatus_EXCEPTION(status)) {
         return status;
     }
 
-    if (is_main_interp) {
-        if (!_PyFloat_Init()) {
-            return _PyStatus_ERR("can't init float");
-        }
-
-        if (_PyStructSequence_Init() < 0) {
-            return _PyStatus_ERR("can't initialize structseq");
-        }
-    }
-
-    status = _PyErr_Init();
+    status = _PyErr_InitTypes();
     if (_PyStatus_EXCEPTION(status)) {
         return status;
     }
@@ -636,14 +740,13 @@
 static PyStatus
 pycore_init_builtins(PyThreadState *tstate)
 {
-    assert(!_PyErr_Occurred(tstate));
+    PyInterpreterState *interp = tstate->interp;
 
-    PyObject *bimod = _PyBuiltin_Init(tstate);
+    PyObject *bimod = _PyBuiltin_Init(interp);
     if (bimod == NULL) {
         goto error;
     }
 
-    PyInterpreterState *interp = tstate->interp;
     if (_PyImport_FixupBuiltin(bimod, "builtins", interp->modules) < 0) {
         goto error;
     }
@@ -666,8 +769,15 @@
     }
     Py_DECREF(bimod);
 
-    assert(!_PyErr_Occurred(tstate));
+    // Get the __import__ function
+    PyObject *import_func = _PyDict_GetItemStringWithError(interp->builtins,
+                                                           "__import__");
+    if (import_func == NULL) {
+        goto error;
+    }
+    interp->import_func = Py_NewRef(import_func);
 
+    assert(!_PyErr_Occurred(tstate));
     return _PyStatus_OK();
 
 error:
@@ -677,56 +787,40 @@
 
 
 static PyStatus
-pycore_init_import_warnings(PyThreadState *tstate, PyObject *sysmod)
+pycore_interp_init(PyThreadState *tstate)
 {
-    assert(!_PyErr_Occurred(tstate));
+    PyInterpreterState *interp = tstate->interp;
+    PyStatus status;
+    PyObject *sysmod = NULL;
 
-    PyStatus status = _PyImportHooks_Init(tstate);
+    // Create singletons before the first PyType_Ready() call, since
+    // PyType_Ready() uses singletons like the Unicode empty string (tp_doc)
+    // and the empty tuple singletons (tp_bases).
+    status = pycore_init_singletons(interp);
     if (_PyStatus_EXCEPTION(status)) {
         return status;
     }
 
-    const PyConfig *config = _PyInterpreterState_GetConfig(tstate->interp);
-    if (_Py_IsMainInterpreter(tstate)) {
-        /* Initialize _warnings. */
-        status = _PyWarnings_InitState(tstate);
-        if (_PyStatus_EXCEPTION(status)) {
-            return status;
-        }
-
-        if (config->_install_importlib) {
-            status = _PyConfig_WritePathConfig(config);
-            if (_PyStatus_EXCEPTION(status)) {
-                return status;
-            }
-        }
+    // The GC must be initialized before the first GC collection.
+    status = _PyGC_Init(interp);
+    if (_PyStatus_EXCEPTION(status)) {
+        return status;
     }
 
-    /* This call sets up builtin and frozen import support */
-    if (config->_install_importlib) {
-        status = init_importlib(tstate, sysmod);
-        if (_PyStatus_EXCEPTION(status)) {
-            return status;
-        }
-    }
-
-    assert(!_PyErr_Occurred(tstate));
-
-    return _PyStatus_OK();
-}
-
-
-static PyStatus
-pycore_interp_init(PyThreadState *tstate)
-{
-    PyStatus status;
-    PyObject *sysmod = NULL;
-
-    status = pycore_init_types(tstate);
+    status = pycore_init_types(interp);
     if (_PyStatus_EXCEPTION(status)) {
         goto done;
     }
 
+    if (_PyWarnings_InitState(interp) < 0) {
+        return _PyStatus_ERR("can't initialize warnings");
+    }
+
+    status = _PyAtExit_Init(interp);
+    if (_PyStatus_EXCEPTION(status)) {
+        return status;
+    }
+
     status = _PySys_Create(tstate, &sysmod);
     if (_PyStatus_EXCEPTION(status)) {
         goto done;
@@ -737,7 +831,13 @@
         goto done;
     }
 
-    status = pycore_init_import_warnings(tstate, sysmod);
+    const PyConfig *config = _PyInterpreterState_GetConfig(interp);
+    if (config->_install_importlib) {
+        /* This call sets up builtin and frozen import support */
+        if (init_importlib(tstate, sysmod) < 0) {
+            return _PyStatus_ERR("failed to initialize importlib");
+        }
+    }
 
 done:
     /* sys.modules['sys'] contains a strong reference to the module */
@@ -911,14 +1011,16 @@
     }
 
     PyConfig config;
-    _PyConfig_InitCompatConfig(&config);
+    PyConfig_InitPythonConfig(&config);
 
     status = _PyConfig_Copy(&config, src_config);
     if (_PyStatus_EXCEPTION(status)) {
         goto done;
     }
 
-    status = PyConfig_Read(&config);
+    // Read the configuration, but don't compute the path configuration
+    // (it is computed in the main init).
+    status = _PyConfig_Read(&config, 0);
     if (_PyStatus_EXCEPTION(status)) {
         goto done;
     }
@@ -943,19 +1045,10 @@
    configuration. Example of bpo-34008: Py_Main() called after
    Py_Initialize(). */
 static PyStatus
-_Py_ReconfigureMainInterpreter(PyThreadState *tstate)
+pyinit_main_reconfigure(PyThreadState *tstate)
 {
-    const PyConfig *config = _PyInterpreterState_GetConfig(tstate->interp);
-
-    PyObject *argv = _PyWideStringList_AsList(&config->argv);
-    if (argv == NULL) {
-        return _PyStatus_NO_MEMORY(); \
-    }
-
-    int res = PyDict_SetItemString(tstate->interp->sysdict, "argv", argv);
-    Py_DECREF(argv);
-    if (res < 0) {
-        return _PyStatus_ERR("fail to set sys.argv");
+    if (interpreter_update_config(tstate, 0) < 0) {
+        return _PyStatus_ERR("fail to reconfigure Python");
     }
     return _PyStatus_OK();
 }
@@ -964,10 +1057,12 @@
 static PyStatus
 init_interp_main(PyThreadState *tstate)
 {
+    extern void _PyThread_debug_deprecation(void);
+
     assert(!_PyErr_Occurred(tstate));
 
     PyStatus status;
-    int is_main_interp = _Py_IsMainInterpreter(tstate);
+    int is_main_interp = _Py_IsMainInterpreter(tstate->interp);
     PyInterpreterState *interp = tstate->interp;
     const PyConfig *config = _PyInterpreterState_GetConfig(interp);
 
@@ -983,14 +1078,14 @@
         return _PyStatus_OK();
     }
 
-    if (is_main_interp) {
-        if (_PyTime_Init() < 0) {
-            return _PyStatus_ERR("can't initialize time");
-        }
+    // Compute the path configuration
+    status = _PyConfig_InitPathConfig(&interp->config, 1);
+    if (_PyStatus_EXCEPTION(status)) {
+        return status;
     }
 
-    if (_PySys_InitMain(tstate) < 0) {
-        return _PyStatus_ERR("can't finish initializing sys");
+    if (interpreter_update_config(tstate, 1) < 0) {
+        return _PyStatus_ERR("failed to update the Python config");
     }
 
     status = init_importlib_external(tstate);
@@ -1065,6 +1160,9 @@
 #endif
     }
 
+    // Warn about PYTHONTHREADDEBUG deprecation
+    _PyThread_debug_deprecation();
+
     assert(!_PyErr_Occurred(tstate));
 
     return _PyStatus_OK();
@@ -1091,7 +1189,7 @@
     }
 
     if (interp->runtime->initialized) {
-        return _Py_ReconfigureMainInterpreter(tstate);
+        return pyinit_main_reconfigure(tstate);
     }
 
     PyStatus status = init_interp_main(tstate);
@@ -1103,19 +1201,6 @@
 
 
 PyStatus
-_Py_InitializeMain(void)
-{
-    PyStatus status = _PyRuntime_Initialize();
-    if (_PyStatus_EXCEPTION(status)) {
-        return status;
-    }
-    _PyRuntimeState *runtime = &_PyRuntime;
-    PyThreadState *tstate = _PyRuntimeState_GetThreadState(runtime);
-    return pyinit_main(tstate);
-}
-
-
-PyStatus
 Py_InitializeFromConfig(const PyConfig *config)
 {
     if (config == NULL) {
@@ -1182,6 +1267,305 @@
 }
 
 
+PyStatus
+_Py_InitializeMain(void)
+{
+    PyStatus status = _PyRuntime_Initialize();
+    if (_PyStatus_EXCEPTION(status)) {
+        return status;
+    }
+    _PyRuntimeState *runtime = &_PyRuntime;
+    PyThreadState *tstate = _PyRuntimeState_GetThreadState(runtime);
+    return pyinit_main(tstate);
+}
+
+
+static void
+finalize_modules_delete_special(PyThreadState *tstate, int verbose)
+{
+    // List of names to clear in sys
+    static const char * const sys_deletes[] = {
+        "path", "argv", "ps1", "ps2",
+        "last_type", "last_value", "last_traceback",
+        "path_hooks", "path_importer_cache", "meta_path",
+        "__interactivehook__",
+        NULL
+    };
+
+    static const char * const sys_files[] = {
+        "stdin", "__stdin__",
+        "stdout", "__stdout__",
+        "stderr", "__stderr__",
+        NULL
+    };
+
+    PyInterpreterState *interp = tstate->interp;
+    if (verbose) {
+        PySys_WriteStderr("# clear builtins._\n");
+    }
+    if (PyDict_SetItemString(interp->builtins, "_", Py_None) < 0) {
+        PyErr_WriteUnraisable(NULL);
+    }
+
+    const char * const *p;
+    for (p = sys_deletes; *p != NULL; p++) {
+        if (verbose) {
+            PySys_WriteStderr("# clear sys.%s\n", *p);
+        }
+        if (PyDict_SetItemString(interp->sysdict, *p, Py_None) < 0) {
+            PyErr_WriteUnraisable(NULL);
+        }
+    }
+    for (p = sys_files; *p != NULL; p+=2) {
+        const char *name = p[0];
+        const char *orig_name = p[1];
+        if (verbose) {
+            PySys_WriteStderr("# restore sys.%s\n", name);
+        }
+        PyObject *value = _PyDict_GetItemStringWithError(interp->sysdict,
+                                                         orig_name);
+        if (value == NULL) {
+            if (_PyErr_Occurred(tstate)) {
+                PyErr_WriteUnraisable(NULL);
+            }
+            value = Py_None;
+        }
+        if (PyDict_SetItemString(interp->sysdict, name, value) < 0) {
+            PyErr_WriteUnraisable(NULL);
+        }
+    }
+}
+
+
+static PyObject*
+finalize_remove_modules(PyObject *modules, int verbose)
+{
+    PyObject *weaklist = PyList_New(0);
+    if (weaklist == NULL) {
+        PyErr_WriteUnraisable(NULL);
+    }
+
+#define STORE_MODULE_WEAKREF(name, mod) \
+        if (weaklist != NULL) { \
+            PyObject *wr = PyWeakref_NewRef(mod, NULL); \
+            if (wr) { \
+                PyObject *tup = PyTuple_Pack(2, name, wr); \
+                if (!tup || PyList_Append(weaklist, tup) < 0) { \
+                    PyErr_WriteUnraisable(NULL); \
+                } \
+                Py_XDECREF(tup); \
+                Py_DECREF(wr); \
+            } \
+            else { \
+                PyErr_WriteUnraisable(NULL); \
+            } \
+        }
+
+#define CLEAR_MODULE(name, mod) \
+        if (PyModule_Check(mod)) { \
+            if (verbose && PyUnicode_Check(name)) { \
+                PySys_FormatStderr("# cleanup[2] removing %U\n", name); \
+            } \
+            STORE_MODULE_WEAKREF(name, mod); \
+            if (PyObject_SetItem(modules, name, Py_None) < 0) { \
+                PyErr_WriteUnraisable(NULL); \
+            } \
+        }
+
+    if (PyDict_CheckExact(modules)) {
+        Py_ssize_t pos = 0;
+        PyObject *key, *value;
+        while (PyDict_Next(modules, &pos, &key, &value)) {
+            CLEAR_MODULE(key, value);
+        }
+    }
+    else {
+        PyObject *iterator = PyObject_GetIter(modules);
+        if (iterator == NULL) {
+            PyErr_WriteUnraisable(NULL);
+        }
+        else {
+            PyObject *key;
+            while ((key = PyIter_Next(iterator))) {
+                PyObject *value = PyObject_GetItem(modules, key);
+                if (value == NULL) {
+                    PyErr_WriteUnraisable(NULL);
+                    continue;
+                }
+                CLEAR_MODULE(key, value);
+                Py_DECREF(value);
+                Py_DECREF(key);
+            }
+            if (PyErr_Occurred()) {
+                PyErr_WriteUnraisable(NULL);
+            }
+            Py_DECREF(iterator);
+        }
+    }
+#undef CLEAR_MODULE
+#undef STORE_MODULE_WEAKREF
+
+    return weaklist;
+}
+
+
+static void
+finalize_clear_modules_dict(PyObject *modules)
+{
+    if (PyDict_CheckExact(modules)) {
+        PyDict_Clear(modules);
+    }
+    else {
+        _Py_IDENTIFIER(clear);
+        if (_PyObject_CallMethodIdNoArgs(modules, &PyId_clear) == NULL) {
+            PyErr_WriteUnraisable(NULL);
+        }
+    }
+}
+
+
+static void
+finalize_restore_builtins(PyThreadState *tstate)
+{
+    PyInterpreterState *interp = tstate->interp;
+    PyObject *dict = PyDict_Copy(interp->builtins);
+    if (dict == NULL) {
+        PyErr_WriteUnraisable(NULL);
+    }
+    PyDict_Clear(interp->builtins);
+    if (PyDict_Update(interp->builtins, interp->builtins_copy)) {
+        _PyErr_Clear(tstate);
+    }
+    Py_XDECREF(dict);
+}
+
+
+static void
+finalize_modules_clear_weaklist(PyInterpreterState *interp,
+                                PyObject *weaklist, int verbose)
+{
+    // First clear modules imported later
+    for (Py_ssize_t i = PyList_GET_SIZE(weaklist) - 1; i >= 0; i--) {
+        PyObject *tup = PyList_GET_ITEM(weaklist, i);
+        PyObject *name = PyTuple_GET_ITEM(tup, 0);
+        PyObject *mod = PyWeakref_GET_OBJECT(PyTuple_GET_ITEM(tup, 1));
+        if (mod == Py_None) {
+            continue;
+        }
+        assert(PyModule_Check(mod));
+        PyObject *dict = PyModule_GetDict(mod);
+        if (dict == interp->builtins || dict == interp->sysdict) {
+            continue;
+        }
+        Py_INCREF(mod);
+        if (verbose && PyUnicode_Check(name)) {
+            PySys_FormatStderr("# cleanup[3] wiping %U\n", name);
+        }
+        _PyModule_Clear(mod);
+        Py_DECREF(mod);
+    }
+}
+
+
+static void
+finalize_clear_sys_builtins_dict(PyInterpreterState *interp, int verbose)
+{
+    // Clear sys dict
+    if (verbose) {
+        PySys_FormatStderr("# cleanup[3] wiping sys\n");
+    }
+    _PyModule_ClearDict(interp->sysdict);
+
+    // Clear builtins dict
+    if (verbose) {
+        PySys_FormatStderr("# cleanup[3] wiping builtins\n");
+    }
+    _PyModule_ClearDict(interp->builtins);
+}
+
+
+/* Clear modules, as good as we can */
+static void
+finalize_modules(PyThreadState *tstate)
+{
+    PyInterpreterState *interp = tstate->interp;
+    PyObject *modules = interp->modules;
+    if (modules == NULL) {
+        // Already done
+        return;
+    }
+    int verbose = _PyInterpreterState_GetConfig(interp)->verbose;
+
+    // Delete some special builtins._ and sys attributes first.  These are
+    // common places where user values hide and people complain when their
+    // destructors fail.  Since the modules containing them are
+    // deleted *last* of all, they would come too late in the normal
+    // destruction order.  Sigh.
+    //
+    // XXX Perhaps these precautions are obsolete. Who knows?
+    finalize_modules_delete_special(tstate, verbose);
+
+    // Remove all modules from sys.modules, hoping that garbage collection
+    // can reclaim most of them: set all sys.modules values to None.
+    //
+    // We prepare a list which will receive (name, weakref) tuples of
+    // modules when they are removed from sys.modules.  The name is used
+    // for diagnosis messages (in verbose mode), while the weakref helps
+    // detect those modules which have been held alive.
+    PyObject *weaklist = finalize_remove_modules(modules, verbose);
+
+    // Clear the modules dict
+    finalize_clear_modules_dict(modules);
+
+    // Restore the original builtins dict, to ensure that any
+    // user data gets cleared.
+    finalize_restore_builtins(tstate);
+
+    // Collect garbage
+    _PyGC_CollectNoFail(tstate);
+
+    // Dump GC stats before it's too late, since it uses the warnings
+    // machinery.
+    _PyGC_DumpShutdownStats(interp);
+
+    if (weaklist != NULL) {
+        // Now, if there are any modules left alive, clear their globals to
+        // minimize potential leaks.  All C extension modules actually end
+        // up here, since they are kept alive in the interpreter state.
+        //
+        // The special treatment of "builtins" here is because even
+        // when it's not referenced as a module, its dictionary is
+        // referenced by almost every module's __builtins__.  Since
+        // deleting a module clears its dictionary (even if there are
+        // references left to it), we need to delete the "builtins"
+        // module last.  Likewise, we don't delete sys until the very
+        // end because it is implicitly referenced (e.g. by print).
+        //
+        // Since dict is ordered in CPython 3.6+, modules are saved in
+        // importing order.  First clear modules imported later.
+        finalize_modules_clear_weaklist(interp, weaklist, verbose);
+        Py_DECREF(weaklist);
+    }
+
+    // Clear sys and builtins modules dict
+    finalize_clear_sys_builtins_dict(interp, verbose);
+
+    // Clear module dict copies stored in the interpreter state:
+    // clear PyInterpreterState.modules_by_index and
+    // clear PyModuleDef.m_base.m_copy (of extensions not using the multi-phase
+    // initialization API)
+    _PyInterpreterState_ClearModules(interp);
+
+    // Clear and delete the modules directory.  Actual modules will
+    // still be there only if imported during the execution of some
+    // destructor.
+    Py_SETREF(interp->modules, NULL);
+
+    // Collect garbage once more
+    _PyGC_CollectNoFail(tstate);
+}
+
+
 /* Flush stdout and stderr */
 
 static int
@@ -1200,6 +1584,7 @@
     return r > 0;
 }
 
+
 static int
 flush_std_files(void)
 {
@@ -1247,56 +1632,37 @@
 
 
 static void
-finalize_interp_types(PyThreadState *tstate, int is_main_interp)
+finalize_interp_types(PyInterpreterState *interp)
 {
-    if (is_main_interp) {
-        /* Sundry finalizers */
-        _PyAST_Fini();
-        _PyFrame_Fini();
-        _PyTuple_Fini();
-        _PyList_Fini();
-        _PySet_Fini();
-        _PyBytes_Fini();
-    }
+    _PyExc_Fini(interp);
+    _PyFrame_Fini(interp);
+    _PyAsyncGen_Fini(interp);
+    _PyContext_Fini(interp);
+    _PyType_Fini(interp);
+    // Call _PyUnicode_ClearInterned() before _PyDict_Fini() since it uses
+    // a dict internally.
+    _PyUnicode_ClearInterned(interp);
 
-    _PyLong_Fini(tstate);
+    _PyDict_Fini(interp);
+    _PyList_Fini(interp);
+    _PyTuple_Fini(interp);
 
-    if (is_main_interp) {
-        _PyFloat_Fini();
-        _PyDict_Fini();
-        _PySlice_Fini();
-    }
+    _PySlice_Fini(interp);
 
-    _PyWarnings_Fini(tstate->interp);
-
-    if (is_main_interp) {
-        _Py_HashRandomization_Fini();
-        _PyArg_Fini();
-        _PyAsyncGen_Fini();
-        _PyContext_Fini();
-    }
-
-    /* Cleanup Unicode implementation */
-    _PyUnicode_Fini(tstate);
-
-    if (is_main_interp) {
-        _Py_ClearFileSystemEncoding();
-    }
+    _PyBytes_Fini(interp);
+    _PyUnicode_Fini(interp);
+    _PyFloat_Fini(interp);
+    _PyLong_Fini(interp);
 }
 
 
 static void
 finalize_interp_clear(PyThreadState *tstate)
 {
-    int is_main_interp = _Py_IsMainInterpreter(tstate);
+    int is_main_interp = _Py_IsMainInterpreter(tstate->interp);
 
     /* Clear interpreter state and all thread states */
-    PyInterpreterState_Clear(tstate->interp);
-
-    /* Trigger a GC collection on subinterpreters*/
-    if (!is_main_interp) {
-        _PyGC_CollectNoFail();
-    }
+    _PyInterpreterState_Clear(tstate);
 
     /* Clear all loghooks */
     /* Both _PySys_Audit function and users still need PyObject, such as tuple.
@@ -1305,30 +1671,22 @@
         _PySys_ClearAuditHooks(tstate);
     }
 
-    finalize_interp_types(tstate, is_main_interp);
-
     if (is_main_interp) {
-        /* XXX Still allocated:
-           - various static ad-hoc pointers to interned strings
-           - int and float free list blocks
-           - whatever various modules and libraries allocate
-        */
-
-        PyGrammar_RemoveAccelerators(&_PyParser_Grammar);
-
-        _PyExc_Fini();
+        _Py_HashRandomization_Fini();
+        _PyArg_Fini();
+        _Py_ClearFileSystemEncoding();
     }
 
-    _PyGC_Fini(tstate);
+    finalize_interp_types(tstate->interp);
 }
 
 
 static void
-finalize_interp_delete(PyThreadState *tstate)
+finalize_interp_delete(PyInterpreterState *interp)
 {
-    if (_Py_IsMainInterpreter(tstate)) {
+    if (_Py_IsMainInterpreter(interp)) {
         /* Cleanup auto-thread-state */
-        _PyGILState_Fini(tstate);
+        _PyGILState_Fini(interp);
     }
 
     /* We can't call _PyEval_FiniGIL() here because destroying the GIL lock can
@@ -1337,7 +1695,7 @@
        created GIL, which ensures that Py_Initialize / Py_FinalizeEx can be
        called multiple times. */
 
-    PyInterpreterState_Delete(tstate->interp);
+    PyInterpreterState_Delete(interp);
 }
 
 
@@ -1370,7 +1728,7 @@
      * the threads created via Threading.
      */
 
-    call_py_exitfuncs(tstate);
+    _PyAtExit_Call(tstate->interp);
 
     /* Copy the core config, PyInterpreterState_Delete() free
        the core config memory */
@@ -1406,7 +1764,7 @@
     }
 
     /* Disable signal handling */
-    PyOS_FiniInterrupts();
+    _PySignal_Fini();
 
     /* Collect garbage.  This may call finalizers; it's nice to call these
      * before all modules are destroyed.
@@ -1420,10 +1778,10 @@
      * XXX but I'm unclear on exactly how that one happens.  In any case,
      * XXX I haven't seen a real-life report of either of these.
      */
-    _PyGC_CollectIfEnabled();
+    PyGC_Collect();
 
     /* Destroy all modules */
-    _PyImport_Cleanup(tstate);
+    finalize_modules(tstate);
 
     /* Print debug stats if any */
     _PyEval_Fini();
@@ -1459,9 +1817,6 @@
     /* Destroy the database used by _PyImport_{Fixup,Find}Extension */
     _PyImport_Fini();
 
-    /* Cleanup typeobject.c's internal caches. */
-    _PyType_Fini();
-
     /* unload faulthandler module */
     _PyFaulthandler_Fini();
 
@@ -1486,7 +1841,7 @@
 #endif /* Py_TRACE_REFS */
 
     finalize_interp_clear(tstate);
-    finalize_interp_delete(tstate);
+    finalize_interp_delete(tstate->interp);
 
 #ifdef Py_TRACE_REFS
     /* Display addresses (& refcnts) of all objects still alive.
@@ -1565,17 +1920,20 @@
 
     /* Copy the current interpreter config into the new interpreter */
     const PyConfig *config;
+#ifndef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
     if (save_tstate != NULL) {
         config = _PyInterpreterState_GetConfig(save_tstate->interp);
     }
     else
+#endif
     {
         /* No current thread state, copy from the main interpreter */
         PyInterpreterState *main_interp = PyInterpreterState_Main();
         config = _PyInterpreterState_GetConfig(main_interp);
     }
 
-    status = _PyInterpreterState_SetConfig(interp, config);
+
+    status = _PyConfig_Copy(&interp->config, config);
     if (_PyStatus_EXCEPTION(status)) {
         goto error;
     }
@@ -1658,15 +2016,16 @@
     // Wrap up existing "threading"-module-created, non-daemon threads.
     wait_for_thread_shutdown(tstate);
 
-    call_py_exitfuncs(tstate);
+    _PyAtExit_Call(tstate->interp);
 
     if (tstate != interp->tstate_head || tstate->next != NULL) {
         Py_FatalError("not the last thread");
     }
 
-    _PyImport_Cleanup(tstate);
+    finalize_modules(tstate);
+
     finalize_interp_clear(tstate);
-    finalize_interp_delete(tstate);
+    finalize_interp_delete(tstate->interp);
 }
 
 /* Add the __main__ module */
@@ -1687,7 +2046,10 @@
     }
     Py_DECREF(ann_dict);
 
-    if (PyDict_GetItemString(d, "__builtins__") == NULL) {
+    if (_PyDict_GetItemStringWithError(d, "__builtins__") == NULL) {
+        if (PyErr_Occurred()) {
+            return _PyStatus_ERR("Failed to test __main__.__builtins__");
+        }
         PyObject *bimod = PyImport_ImportModule("builtins");
         if (bimod == NULL) {
             return _PyStatus_ERR("Failed to retrieve builtins module");
@@ -1704,8 +2066,11 @@
      * be set if __main__ gets further initialized later in the startup
      * process.
      */
-    loader = PyDict_GetItemString(d, "__loader__");
+    loader = _PyDict_GetItemStringWithError(d, "__loader__");
     if (loader == NULL || loader == Py_None) {
+        if (PyErr_Occurred()) {
+            return _PyStatus_ERR("Failed to test __main__.__loader__");
+        }
         PyObject *loader = PyObject_GetAttrString(interp->importlib,
                                                   "BuiltinImporter");
         if (loader == NULL) {
@@ -1907,7 +2272,7 @@
     return NULL;
 }
 
-/* Set builtins.open to io.OpenWrapper */
+/* Set builtins.open to io.open */
 static PyStatus
 init_set_builtins_open(void)
 {
@@ -1923,7 +2288,7 @@
         goto error;
     }
 
-    if (!(wrapper = PyObject_GetAttrString(iomod, "OpenWrapper"))) {
+    if (!(wrapper = PyObject_GetAttrString(iomod, "open"))) {
         goto error;
     }
 
@@ -1945,12 +2310,11 @@
 }
 
 
-/* Initialize sys.stdin, stdout, stderr and builtins.open */
+/* Create sys.stdin, sys.stdout and sys.stderr */
 static PyStatus
 init_sys_streams(PyThreadState *tstate)
 {
     PyObject *iomod = NULL;
-    PyObject *m;
     PyObject *std = NULL;
     int fd;
     PyObject * encoding_attr;
@@ -1970,18 +2334,6 @@
     }
 #endif
 
-    /* Hack to avoid a nasty recursion issue when Python is invoked
-       in verbose mode: pre-import the Latin-1 and UTF-8 codecs */
-    if ((m = PyImport_ImportModule("encodings.utf_8")) == NULL) {
-        goto error;
-    }
-    Py_DECREF(m);
-
-    if (!(m = PyImport_ImportModule("encodings.latin_1"))) {
-        goto error;
-    }
-    Py_DECREF(m);
-
     if (!(iomod = PyImport_ImportModule("io"))) {
         goto error;
     }
@@ -2061,8 +2413,7 @@
 _Py_FatalError_DumpTracebacks(int fd, PyInterpreterState *interp,
                               PyThreadState *tstate)
 {
-    fputc('\n', stderr);
-    fflush(stderr);
+    PUTS(fd, "\n");
 
     /* display the current Python stack */
     _Py_DumpTracebackThreads(fd, interp, tstate);
@@ -2164,30 +2515,31 @@
 
 
 static void
-fatal_error_dump_runtime(FILE *stream, _PyRuntimeState *runtime)
+fatal_error_dump_runtime(int fd, _PyRuntimeState *runtime)
 {
-    fprintf(stream, "Python runtime state: ");
+    PUTS(fd, "Python runtime state: ");
     PyThreadState *finalizing = _PyRuntimeState_GetFinalizing(runtime);
     if (finalizing) {
-        fprintf(stream, "finalizing (tstate=%p)", finalizing);
+        PUTS(fd, "finalizing (tstate=0x");
+        _Py_DumpHexadecimal(fd, (uintptr_t)finalizing, sizeof(finalizing) * 2);
+        PUTS(fd, ")");
     }
     else if (runtime->initialized) {
-        fprintf(stream, "initialized");
+        PUTS(fd, "initialized");
     }
     else if (runtime->core_initialized) {
-        fprintf(stream, "core initialized");
+        PUTS(fd, "core initialized");
     }
     else if (runtime->preinitialized) {
-        fprintf(stream, "preinitialized");
+        PUTS(fd, "preinitialized");
     }
     else if (runtime->preinitializing) {
-        fprintf(stream, "preinitializing");
+        PUTS(fd, "preinitializing");
     }
     else {
-        fprintf(stream, "unknown");
+        PUTS(fd, "unknown");
     }
-    fprintf(stream, "\n");
-    fflush(stream);
+    PUTS(fd, "\n");
 }
 
 
@@ -2206,11 +2558,104 @@
 }
 
 
+// Dump the list of extension modules of sys.modules, excluding stdlib modules
+// (sys.stdlib_module_names), into fd file descriptor.
+//
+// This function is called by a signal handler in faulthandler: avoid memory
+// allocations and keep the implementation simple. For example, the list is not
+// sorted on purpose.
+void
+_Py_DumpExtensionModules(int fd, PyInterpreterState *interp)
+{
+    if (interp == NULL) {
+        return;
+    }
+    PyObject *modules = interp->modules;
+    if (modules == NULL || !PyDict_Check(modules)) {
+        return;
+    }
+
+    Py_ssize_t pos;
+    PyObject *key, *value;
+
+    // Avoid PyDict_GetItemString() which calls PyUnicode_FromString(),
+    // memory cannot be allocated on the heap in a signal handler.
+    // Iterate on the dict instead.
+    PyObject *stdlib_module_names = NULL;
+    if (interp->sysdict != NULL) {
+        pos = 0;
+        while (PyDict_Next(interp->sysdict, &pos, &key, &value)) {
+            if (PyUnicode_Check(key)
+               && PyUnicode_CompareWithASCIIString(key, "stdlib_module_names") == 0) {
+                stdlib_module_names = value;
+                break;
+            }
+        }
+    }
+    // If we failed to get sys.stdlib_module_names or it's not a frozenset,
+    // don't exclude stdlib modules.
+    if (stdlib_module_names != NULL && !PyFrozenSet_Check(stdlib_module_names)) {
+        stdlib_module_names = NULL;
+    }
+
+    // List extensions
+    int header = 1;
+    Py_ssize_t count = 0;
+    pos = 0;
+    while (PyDict_Next(modules, &pos, &key, &value)) {
+        if (!PyUnicode_Check(key)) {
+            continue;
+        }
+        if (!_PyModule_IsExtension(value)) {
+            continue;
+        }
+        // Use the module name from the sys.modules key,
+        // don't attempt to get the module object name.
+        if (stdlib_module_names != NULL) {
+            int is_stdlib_ext = 0;
+
+            Py_ssize_t i = 0;
+            PyObject *item;
+            Py_hash_t hash;
+            while (_PySet_NextEntry(stdlib_module_names, &i, &item, &hash)) {
+                if (PyUnicode_Check(item)
+                    && PyUnicode_Compare(key, item) == 0)
+                {
+                    is_stdlib_ext = 1;
+                    break;
+                }
+            }
+            if (is_stdlib_ext) {
+                // Ignore stdlib extension
+                continue;
+            }
+        }
+
+        if (header) {
+            PUTS(fd, "\nExtension modules: ");
+            header = 0;
+        }
+        else {
+            PUTS(fd, ", ");
+        }
+
+        _Py_DumpASCII(fd, key);
+        count++;
+    }
+
+    if (count) {
+        PUTS(fd, " (total: ");
+        _Py_DumpDecimal(fd, count);
+        PUTS(fd, ")");
+        PUTS(fd, "\n");
+    }
+}
+
+
 static void _Py_NO_RETURN
-fatal_error(FILE *stream, int header, const char *prefix, const char *msg,
+fatal_error(int fd, int header, const char *prefix, const char *msg,
             int status)
 {
-    const int fd = fileno(stream);
     static int reentrant = 0;
 
     if (reentrant) {
@@ -2221,29 +2666,22 @@
     reentrant = 1;
 
     if (header) {
-        fprintf(stream, "Fatal Python error: ");
+        PUTS(fd, "Fatal Python error: ");
         if (prefix) {
-            fputs(prefix, stream);
-            fputs(": ", stream);
+            PUTS(fd, prefix);
+            PUTS(fd, ": ");
         }
         if (msg) {
-            fputs(msg, stream);
+            PUTS(fd, msg);
         }
         else {
-            fprintf(stream, "<message not set>");
+            PUTS(fd, "<message not set>");
         }
-        fputs("\n", stream);
-        fflush(stream);
+        PUTS(fd, "\n");
     }
 
     _PyRuntimeState *runtime = &_PyRuntime;
-    fatal_error_dump_runtime(stream, runtime);
-
-    PyThreadState *tstate = _PyRuntimeState_GetThreadState(runtime);
-    PyInterpreterState *interp = NULL;
-    if (tstate != NULL) {
-        interp = tstate->interp;
-    }
+    fatal_error_dump_runtime(fd, runtime);
 
     /* Check if the current thread has a Python thread state
        and holds the GIL.
@@ -2253,8 +2691,17 @@
 
        tss_tstate != tstate if the current Python thread does not hold the GIL.
        */
+    PyThreadState *tstate = _PyRuntimeState_GetThreadState(runtime);
+    PyInterpreterState *interp = NULL;
     PyThreadState *tss_tstate = PyGILState_GetThisThreadState();
+    if (tstate != NULL) {
+        interp = tstate->interp;
+    }
+    else if (tss_tstate != NULL) {
+        interp = tss_tstate->interp;
+    }
     int has_tstate_and_gil = (tss_tstate != NULL && tss_tstate == tstate);
+
     if (has_tstate_and_gil) {
         /* If an exception is set, print the exception with its traceback */
         if (!_Py_FatalError_PrintExc(tss_tstate)) {
@@ -2266,6 +2713,8 @@
         _Py_FatalError_DumpTracebacks(fd, interp, tss_tstate);
     }
 
+    _Py_DumpExtensionModules(fd, interp);
+
     /* The main purpose of faulthandler is to display the traceback.
        This function already did its best to display a traceback.
        Disable faulthandler to prevent writing a second traceback
@@ -2291,14 +2740,14 @@
 void _Py_NO_RETURN
 Py_FatalError(const char *msg)
 {
-    fatal_error(stderr, 1, NULL, msg, -1);
+    fatal_error(fileno(stderr), 1, NULL, msg, -1);
 }
 
 
 void _Py_NO_RETURN
 _Py_FatalErrorFunc(const char *func, const char *msg)
 {
-    fatal_error(stderr, 1, func, msg, -1);
+    fatal_error(fileno(stderr), 1, func, msg, -1);
 }
 
 
@@ -2313,12 +2762,12 @@
     reentrant = 1;
 
     FILE *stream = stderr;
-    fprintf(stream, "Fatal Python error: ");
+    const int fd = fileno(stream);
+    PUTS(fd, "Fatal Python error: ");
     if (func) {
-        fputs(func, stream);
-        fputs(": ", stream);
+        PUTS(fd, func);
+        PUTS(fd, ": ");
     }
-    fflush(stream);
 
     va_list vargs;
 #ifdef HAVE_STDARG_PROTOTYPES
@@ -2332,7 +2781,7 @@
     fputs("\n", stream);
     fflush(stream);
 
-    fatal_error(stream, 0, NULL, NULL, -1);
+    fatal_error(fd, 0, NULL, NULL, -1);
 }
 
 
@@ -2343,37 +2792,13 @@
         exit(status.exitcode);
     }
     else if (_PyStatus_IS_ERROR(status)) {
-        fatal_error(stderr, 1, status.func, status.err_msg, 1);
+        fatal_error(fileno(stderr), 1, status.func, status.err_msg, 1);
     }
     else {
         Py_FatalError("Py_ExitStatusException() must not be called on success");
     }
 }
 
-/* Clean up and exit */
-
-/* For the atexit module. */
-void _Py_PyAtExit(void (*func)(PyObject *), PyObject *module)
-{
-    PyInterpreterState *is = _PyInterpreterState_GET();
-
-    /* Guard against API misuse (see bpo-17852) */
-    assert(is->pyexitfunc == NULL || is->pyexitfunc == func);
-
-    is->pyexitfunc = func;
-    is->pyexitmodule = module;
-}
-
-static void
-call_py_exitfuncs(PyThreadState *tstate)
-{
-    PyInterpreterState *interp = tstate->interp;
-    if (interp->pyexitfunc == NULL)
-        return;
-
-    (*interp->pyexitfunc)(interp->pyexitmodule);
-    _PyErr_Clear(tstate);
-}
 
 /* Wait until threading._shutdown completes, provided
    the threading module was imported in the first place.
@@ -2438,29 +2863,6 @@
 }
 
 
-/* Restore signals that the interpreter has called SIG_IGN on to SIG_DFL.
- *
- * All of the code in this function must only use async-signal-safe functions,
- * listed at `man 7 signal` or
- * http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html.
- *
- * If this function is updated, update also _posix_spawn() of subprocess.py.
- */
-void
-_Py_RestoreSignals(void)
-{
-#ifdef SIGPIPE
-    PyOS_setsig(SIGPIPE, SIG_DFL);
-#endif
-#ifdef SIGXFZ
-    PyOS_setsig(SIGXFZ, SIG_DFL);
-#endif
-#ifdef SIGXFSZ
-    PyOS_setsig(SIGXFSZ, SIG_DFL);
-#endif
-}
-
-
 /*
  * The file descriptor fd is considered ``interactive'' if either
  *   a) isatty(fd) is TRUE, or
@@ -2480,6 +2882,21 @@
 }
 
 
+int
+_Py_FdIsInteractive(FILE *fp, PyObject *filename)
+{
+    if (isatty((int)fileno(fp))) {
+        return 1;
+    }
+    if (!Py_InteractiveFlag) {
+        return 0;
+    }
+    return (filename == NULL) ||
+           (PyUnicode_CompareWithASCIIString(filename, "<stdin>") == 0) ||
+           (PyUnicode_CompareWithASCIIString(filename, "???") == 0);
+}
+
+
 /* Wrappers around sigaction() or signal(). */
 
 PyOS_sighandler_t
@@ -2532,7 +2949,10 @@
     struct sigaction context, ocontext;
     context.sa_handler = handler;
     sigemptyset(&context.sa_mask);
-    context.sa_flags = 0;
+    /* Using SA_ONSTACK is friendlier to other C/C++/Golang-VM code that
+     * extension module or embedding code may use where tiny thread stacks
+     * are used.  https://bugs.python.org/issue43390 */
+    context.sa_flags = SA_ONSTACK;
     if (sigaction(sig, &context, &ocontext) == -1)
         return SIG_ERR;
     return ocontext.sa_handler;
diff --git a/Python/pymath.c b/Python/pymath.c
index a08a0e7..24b8042 100644
--- a/Python/pymath.c
+++ b/Python/pymath.c
@@ -79,18 +79,3 @@
     return copysign(y, x);
 }
 #endif /* HAVE_ROUND */
-
-static const unsigned int BitLengthTable[32] = {
-    0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
-    5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
-};
-
-unsigned int _Py_bit_length(unsigned long d) {
-   unsigned int d_bits = 0;
-   while (d >= 32) {
-       d_bits += 6;
-       d >>= 6;
-   }
-   d_bits += BitLengthTable[d];
-   return d_bits;
-}
diff --git a/Python/pystate.c b/Python/pystate.c
index 9beefa8..df98eb1 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -4,6 +4,7 @@
 #include "Python.h"
 #include "pycore_ceval.h"
 #include "pycore_initconfig.h"
+#include "pycore_object.h"        // _PyType_InitCache()
 #include "pycore_pyerrors.h"
 #include "pycore_pylifecycle.h"
 #include "pycore_pymem.h"         // _PyMem_SetDefaultAllocator()
@@ -53,6 +54,9 @@
     void *open_code_hook = runtime->open_code_hook;
     void *open_code_userdata = runtime->open_code_userdata;
     _Py_AuditHookEntry *audit_hook_head = runtime->audit_hook_head;
+    // bpo-42882: Preserve next_index value if Py_Initialize()/Py_Finalize()
+    // is called multiple times.
+    Py_ssize_t unicode_next_index = runtime->unicode_ids.next_index;
 
     memset(runtime, 0, sizeof(*runtime));
 
@@ -73,18 +77,24 @@
 
     runtime->interpreters.mutex = PyThread_allocate_lock();
     if (runtime->interpreters.mutex == NULL) {
-        return _PyStatus_ERR("Can't initialize threads for interpreter");
+        return _PyStatus_NO_MEMORY();
     }
     runtime->interpreters.next_id = -1;
 
     runtime->xidregistry.mutex = PyThread_allocate_lock();
     if (runtime->xidregistry.mutex == NULL) {
-        return _PyStatus_ERR("Can't initialize threads for cross-interpreter data registry");
+        return _PyStatus_NO_MEMORY();
     }
 
     // Set it to the ID of the main thread of the main interpreter.
     runtime->main_thread = PyThread_get_thread_ident();
 
+    runtime->unicode_ids.lock = PyThread_allocate_lock();
+    if (runtime->unicode_ids.lock == NULL) {
+        return _PyStatus_NO_MEMORY();
+    }
+    runtime->unicode_ids.next_index = unicode_next_index;
+
     return _PyStatus_OK();
 }
 
@@ -108,26 +118,24 @@
     /* Force the allocator used by _PyRuntimeState_Init(). */
     PyMemAllocatorEx old_alloc;
     _PyMem_SetDefaultAllocator(PYMEM_DOMAIN_RAW, &old_alloc);
-
-    if (runtime->interpreters.mutex != NULL) {
-        PyThread_free_lock(runtime->interpreters.mutex);
-        runtime->interpreters.mutex = NULL;
+#define FREE_LOCK(LOCK) \
+    if (LOCK != NULL) { \
+        PyThread_free_lock(LOCK); \
+        LOCK = NULL; \
     }
 
-    if (runtime->xidregistry.mutex != NULL) {
-        PyThread_free_lock(runtime->xidregistry.mutex);
-        runtime->xidregistry.mutex = NULL;
-    }
+    FREE_LOCK(runtime->interpreters.mutex);
+    FREE_LOCK(runtime->xidregistry.mutex);
+    FREE_LOCK(runtime->unicode_ids.lock);
 
+#undef FREE_LOCK
     PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc);
 }
 
 #ifdef HAVE_FORK
 /* This function is called from PyOS_AfterFork_Child to ensure that
- * newly created child processes do not share locks with the parent.
- */
-
-void
+   newly created child processes do not share locks with the parent. */
+PyStatus
 _PyRuntimeState_ReInitThreads(_PyRuntimeState *runtime)
 {
     // This was initially set in _PyRuntimeState_Init().
@@ -138,23 +146,25 @@
     PyMemAllocatorEx old_alloc;
     _PyMem_SetDefaultAllocator(PYMEM_DOMAIN_RAW, &old_alloc);
 
-    int interp_mutex = _PyThread_at_fork_reinit(&runtime->interpreters.mutex);
-    int main_interp_id_mutex = _PyThread_at_fork_reinit(&runtime->interpreters.main->id_mutex);
-    int xidregistry_mutex = _PyThread_at_fork_reinit(&runtime->xidregistry.mutex);
+    int reinit_interp = _PyThread_at_fork_reinit(&runtime->interpreters.mutex);
+    int reinit_xidregistry = _PyThread_at_fork_reinit(&runtime->xidregistry.mutex);
+    int reinit_unicode_ids = _PyThread_at_fork_reinit(&runtime->unicode_ids.lock);
 
     PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc);
 
-    if (interp_mutex < 0) {
-        Py_FatalError("Can't initialize lock for runtime interpreters");
-    }
+    /* bpo-42540: id_mutex is freed by _PyInterpreterState_Delete, which does
+     * not force the default allocator. */
+    int reinit_main_id = _PyThread_at_fork_reinit(&runtime->interpreters.main->id_mutex);
 
-    if (main_interp_id_mutex < 0) {
-        Py_FatalError("Can't initialize ID lock for main interpreter");
-    }
+    if (reinit_interp < 0
+        || reinit_main_id < 0
+        || reinit_xidregistry < 0
+        || reinit_unicode_ids < 0)
+    {
+        return _PyStatus_ERR("Failed to reinitialize runtime locks");
 
-    if (xidregistry_mutex < 0) {
-        Py_FatalError("Can't initialize lock for cross-interpreter data registry");
     }
+    return _PyStatus_OK();
 }
 #endif
 
@@ -220,6 +230,7 @@
 
     _PyGC_InitState(&interp->gc);
     PyConfig_InitPythonConfig(&interp->config);
+    _PyType_InitCache(interp);
 
     interp->eval_frame = _PyEval_EvalFrameDefault;
 #ifdef HAVE_DLOPEN
@@ -273,14 +284,11 @@
 }
 
 
-void
-PyInterpreterState_Clear(PyInterpreterState *interp)
+static void
+interpreter_clear(PyInterpreterState *interp, PyThreadState *tstate)
 {
     _PyRuntimeState *runtime = interp->runtime;
 
-    /* Use the current Python thread state to call audit hooks,
-       not the current Python thread state of 'interp'. */
-    PyThreadState *tstate = _PyThreadState_GET();
     if (_PySys_Audit(tstate, "cpython.PyInterpreterState_Clear", NULL) < 0) {
         _PyErr_Clear(tstate);
     }
@@ -299,8 +307,6 @@
     Py_CLEAR(interp->codec_error_registry);
     Py_CLEAR(interp->modules);
     Py_CLEAR(interp->modules_by_index);
-    Py_CLEAR(interp->sysdict);
-    Py_CLEAR(interp->builtins);
     Py_CLEAR(interp->builtins_copy);
     Py_CLEAR(interp->importlib);
     Py_CLEAR(interp->import_func);
@@ -310,15 +316,52 @@
     Py_CLEAR(interp->after_forkers_parent);
     Py_CLEAR(interp->after_forkers_child);
 #endif
-    if (_PyRuntimeState_GetFinalizing(runtime) == NULL) {
-        _PyWarnings_Fini(interp);
-    }
+
+    _PyAST_Fini(interp);
+    _PyWarnings_Fini(interp);
+    _PyAtExit_Fini(interp);
+
+    // All Python types must be destroyed before the last GC collection. Python
+    // types create a reference cycle to themselves in their in their
+    // PyTypeObject.tp_mro member (the tuple contains the type).
+
+    /* Last garbage collection on this interpreter */
+    _PyGC_CollectNoFail(tstate);
+    _PyGC_Fini(interp);
+
+    /* We don't clear sysdict and builtins until the end of this function.
+       Because clearing other attributes can execute arbitrary Python code
+       which requires sysdict and builtins. */
+    PyDict_Clear(interp->sysdict);
+    PyDict_Clear(interp->builtins);
+    Py_CLEAR(interp->sysdict);
+    Py_CLEAR(interp->builtins);
+
     // XXX Once we have one allocator per interpreter (i.e.
     // per-interpreter GC) we must ensure that all of the interpreter's
     // objects have been cleaned up at the point.
 }
 
 
+void
+PyInterpreterState_Clear(PyInterpreterState *interp)
+{
+    // Use the current Python thread state to call audit hooks and to collect
+    // garbage. It can be different than the current Python thread state
+    // of 'interp'.
+    PyThreadState *current_tstate = _PyThreadState_GET();
+
+    interpreter_clear(interp, current_tstate);
+}
+
+
+void
+_PyInterpreterState_Clear(PyThreadState *tstate)
+{
+    interpreter_clear(tstate->interp, tstate);
+}
+
+
 static void
 zapthreads(PyInterpreterState *interp, int check_current)
 {
@@ -373,11 +416,12 @@
 }
 
 
+#ifdef HAVE_FORK
 /*
  * Delete all interpreter states except the main interpreter.  If there
  * is a current interpreter state, it *must* be the main interpreter.
  */
-void
+PyStatus
 _PyInterpreterState_DeleteExceptMain(_PyRuntimeState *runtime)
 {
     struct _gilstate_runtime_state *gilstate = &runtime->gilstate;
@@ -385,7 +429,7 @@
 
     PyThreadState *tstate = _PyThreadState_Swap(gilstate, NULL);
     if (tstate != NULL && tstate->interp != interpreters->main) {
-        Py_FatalError("not main interpreter");
+        return _PyStatus_ERR("not main interpreter");
     }
 
     HEAD_LOCK(runtime);
@@ -411,10 +455,12 @@
     HEAD_UNLOCK(runtime);
 
     if (interpreters->head == NULL) {
-        Py_FatalError("missing main interpreter");
+        return _PyStatus_ERR("missing main interpreter");
     }
     _PyThreadState_Swap(gilstate, tstate);
+    return _PyStatus_OK();
 }
+#endif
 
 
 PyInterpreterState *
@@ -493,24 +539,25 @@
 }
 
 
-void
+int
 _PyInterpreterState_IDIncref(PyInterpreterState *interp)
 {
-    if (interp->id_mutex == NULL) {
-        return;
+    if (_PyInterpreterState_IDInitref(interp) < 0) {
+        return -1;
     }
+
     PyThread_acquire_lock(interp->id_mutex, WAIT_LOCK);
     interp->id_refcount += 1;
     PyThread_release_lock(interp->id_mutex);
+    return 0;
 }
 
 
 void
 _PyInterpreterState_IDDecref(PyInterpreterState *interp)
 {
-    if (interp->id_mutex == NULL) {
-        return;
-    }
+    assert(interp->id_mutex != NULL);
+
     struct _gilstate_runtime_state *gilstate = &_PyRuntime.gilstate;
     PyThread_acquire_lock(interp->id_mutex, WAIT_LOCK);
     assert(interp->id_refcount != 0);
@@ -576,11 +623,11 @@
 
     tstate->frame = NULL;
     tstate->recursion_depth = 0;
-    tstate->overflowed = 0;
-    tstate->recursion_critical = 0;
+    tstate->recursion_headroom = 0;
     tstate->stackcheck_counter = 0;
     tstate->tracing = 0;
-    tstate->use_tracing = 0;
+    tstate->root_cframe.use_tracing = 0;
+    tstate->cframe = &tstate->root_cframe;
     tstate->gilstate_counter = 0;
     tstate->async_exc = NULL;
     tstate->thread_id = PyThread_get_thread_ident();
@@ -750,7 +797,7 @@
     return PyList_SetItem(interp->modules_by_index, index, Py_None);
 }
 
-/* Used by PyImport_Cleanup() */
+// Used by finalize_modules()
 void
 _PyInterpreterState_ClearModules(PyInterpreterState *interp)
 {
@@ -946,6 +993,14 @@
 }
 
 
+#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+PyThreadState*
+_PyThreadState_GetTSS(void) {
+    return PyThread_tss_get(&_PyRuntime.gilstate.autoTSSkey);
+}
+#endif
+
+
 PyThreadState *
 _PyThreadState_UncheckedGet(void)
 {
@@ -965,7 +1020,11 @@
 PyThreadState *
 _PyThreadState_Swap(struct _gilstate_runtime_state *gilstate, PyThreadState *newts)
 {
+#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+    PyThreadState *oldts = _PyThreadState_GetTSS();
+#else
     PyThreadState *oldts = _PyRuntimeGILState_GetThreadState(gilstate);
+#endif
 
     _PyRuntimeGILState_SetThreadState(gilstate, newts);
     /* It should not be possible for more than one thread state
@@ -984,6 +1043,9 @@
         errno = err;
     }
 #endif
+#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+    PyThread_tss_set(&gilstate->autoTSSkey, newts);
+#endif
     return oldts;
 }
 
@@ -1089,7 +1151,7 @@
         HEAD_UNLOCK(runtime);
 
         Py_XDECREF(old_exc);
-        _PyEval_SignalAsyncExc(tstate);
+        _PyEval_SignalAsyncExc(tstate->interp);
         return 1;
     }
     HEAD_UNLOCK(runtime);
@@ -1182,6 +1244,69 @@
     return result;
 }
 
+PyObject *
+_PyThread_CurrentExceptions(void)
+{
+    PyThreadState *tstate = _PyThreadState_GET();
+
+    _Py_EnsureTstateNotNULL(tstate);
+
+    if (_PySys_Audit(tstate, "sys._current_exceptions", NULL) < 0) {
+        return NULL;
+    }
+
+    PyObject *result = PyDict_New();
+    if (result == NULL) {
+        return NULL;
+    }
+
+    /* for i in all interpreters:
+     *     for t in all of i's thread states:
+     *          if t's frame isn't NULL, map t's id to its frame
+     * Because these lists can mutate even when the GIL is held, we
+     * need to grab head_mutex for the duration.
+     */
+    _PyRuntimeState *runtime = tstate->interp->runtime;
+    HEAD_LOCK(runtime);
+    PyInterpreterState *i;
+    for (i = runtime->interpreters.head; i != NULL; i = i->next) {
+        PyThreadState *t;
+        for (t = i->tstate_head; t != NULL; t = t->next) {
+            _PyErr_StackItem *err_info = _PyErr_GetTopmostException(t);
+            if (err_info == NULL) {
+                continue;
+            }
+            PyObject *id = PyLong_FromUnsignedLong(t->thread_id);
+            if (id == NULL) {
+                goto fail;
+            }
+            PyObject *exc_info = PyTuple_Pack(
+                3,
+                err_info->exc_type != NULL ? err_info->exc_type : Py_None,
+                err_info->exc_value != NULL ? err_info->exc_value : Py_None,
+                err_info->exc_traceback != NULL ? err_info->exc_traceback : Py_None);
+            if (exc_info == NULL) {
+                Py_DECREF(id);
+                goto fail;
+            }
+            int stat = PyDict_SetItem(result, id, exc_info);
+            Py_DECREF(id);
+            Py_DECREF(exc_info);
+            if (stat < 0) {
+                goto fail;
+            }
+        }
+    }
+    goto done;
+
+fail:
+    Py_CLEAR(result);
+
+done:
+    HEAD_UNLOCK(runtime);
+    return result;
+}
+
 /* Python "auto thread state" API. */
 
 /* Keep this as a static, as it is not reliable!  It can only
@@ -1205,9 +1330,23 @@
    Py_Initialize/Py_FinalizeEx
 */
 PyStatus
-_PyGILState_Init(PyThreadState *tstate)
+_PyGILState_Init(_PyRuntimeState *runtime)
 {
-    if (!_Py_IsMainInterpreter(tstate)) {
+    struct _gilstate_runtime_state *gilstate = &runtime->gilstate;
+    if (PyThread_tss_create(&gilstate->autoTSSkey) != 0) {
+        return _PyStatus_NO_MEMORY();
+    }
+    // PyThreadState_New() calls _PyGILState_NoteThreadState() which does
+    // nothing before autoInterpreterState is set.
+    assert(gilstate->autoInterpreterState == NULL);
+    return _PyStatus_OK();
+}
+
+
+PyStatus
+_PyGILState_SetTstate(PyThreadState *tstate)
+{
+    if (!_Py_IsMainInterpreter(tstate->interp)) {
         /* Currently, PyGILState is shared by all interpreters. The main
          * interpreter is responsible to initialize it. */
         return _PyStatus_OK();
@@ -1219,9 +1358,6 @@
 
     struct _gilstate_runtime_state *gilstate = &tstate->interp->runtime->gilstate;
 
-    if (PyThread_tss_create(&gilstate->autoTSSkey) != 0) {
-        return _PyStatus_NO_MEMORY();
-    }
     gilstate->autoInterpreterState = tstate->interp;
     assert(PyThread_tss_get(&gilstate->autoTSSkey) == NULL);
     assert(tstate->gilstate_counter == 0);
@@ -1237,18 +1373,19 @@
 }
 
 void
-_PyGILState_Fini(PyThreadState *tstate)
+_PyGILState_Fini(PyInterpreterState *interp)
 {
-    struct _gilstate_runtime_state *gilstate = &tstate->interp->runtime->gilstate;
+    struct _gilstate_runtime_state *gilstate = &interp->runtime->gilstate;
     PyThread_tss_delete(&gilstate->autoTSSkey);
     gilstate->autoInterpreterState = NULL;
 }
 
+#ifdef HAVE_FORK
 /* Reset the TSS key - called by PyOS_AfterFork_Child().
  * This should not be necessary, but some - buggy - pthread implementations
  * don't reset TSS upon fork(), see issue #10517.
  */
-void
+PyStatus
 _PyGILState_Reinit(_PyRuntimeState *runtime)
 {
     struct _gilstate_runtime_state *gilstate = &runtime->gilstate;
@@ -1256,7 +1393,7 @@
 
     PyThread_tss_delete(&gilstate->autoTSSkey);
     if (PyThread_tss_create(&gilstate->autoTSSkey) != 0) {
-        Py_FatalError("Could not allocate TSS entry");
+        return _PyStatus_NO_MEMORY();
     }
 
     /* If the thread had an associated auto thread state, reassociate it with
@@ -1264,9 +1401,11 @@
     if (tstate &&
         PyThread_tss_set(&gilstate->autoTSSkey, (void *)tstate) != 0)
     {
-        Py_FatalError("Couldn't create autoTSSkey mapping");
+        return _PyStatus_ERR("failed to set autoTSSkey");
     }
+    return _PyStatus_OK();
 }
+#endif
 
 /* When a thread state is created for a thread by some mechanism other than
    PyGILState_Ensure, it's important that the GILState machinery knows about
@@ -1353,7 +1492,9 @@
 
     /* Ensure that _PyEval_InitThreads() and _PyGILState_Init() have been
        called by Py_Initialize() */
+#ifndef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
     assert(_PyEval_ThreadsInitialized(runtime));
+#endif
     assert(gilstate->autoInterpreterState);
 
     PyThreadState *tcur = (PyThreadState *)PyThread_tss_get(&gilstate->autoTSSkey);
@@ -1809,11 +1950,17 @@
 }
 
 
-PyStatus
-_PyInterpreterState_SetConfig(PyInterpreterState *interp,
-                              const PyConfig *config)
+int
+_PyInterpreterState_GetConfigCopy(PyConfig *config)
 {
-    return _PyConfig_Copy(&interp->config, config);
+    PyInterpreterState *interp = PyInterpreterState_Get();
+
+    PyStatus status = _PyConfig_Copy(config, &interp->config);
+    if (PyStatus_Exception(status)) {
+        _PyErr_SetFromPyStatus(status);
+        return -1;
+    }
+    return 0;
 }
 
 
diff --git a/Python/pystrtod.c b/Python/pystrtod.c
index 1c8202c..9145d4e 100644
--- a/Python/pystrtod.c
+++ b/Python/pystrtod.c
@@ -255,7 +255,7 @@
         char *copy, *c;
         /* Create a copy of the input, with the '.' converted to the
            locale-specific decimal point */
-        copy = (char *)PyMem_MALLOC(end - digits_pos +
+        copy = (char *)PyMem_Malloc(end - digits_pos +
                                     1 + decimal_point_len);
         if (copy == NULL) {
             *endptr = (char *)nptr;
@@ -286,7 +286,7 @@
                     (fail_pos - copy);
         }
 
-        PyMem_FREE(copy);
+        PyMem_Free(copy);
 
     }
     else {
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 70748dc..0f1794a 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -2,7 +2,7 @@
 /* Top level execution of Python code (including in __main__) */
 
 /* To help control the interfaces between the startup, execution and
- * shutdown code, the phases are split across separate modules (boostrap,
+ * shutdown code, the phases are split across separate modules (bootstrap,
  * pythonrun, shutdown)
  */
 
@@ -10,27 +10,22 @@
 
 #include "Python.h"
 
-#include "Python-ast.h"
-#undef Yield   /* undefine macro conflicting with <winbase.h> */
-
+#include "pycore_ast.h"           // PyAST_mod2obj
+#include "pycore_compile.h"       // _PyAST_Compile()
 #include "pycore_interp.h"        // PyInterpreterState.importlib
-#include "pycore_object.h"        // _PyDebug_PrintTotalRefs()
-#include "pycore_pyerrors.h"      // _PyErr_Fetch
+#include "pycore_object.h"        // _PyDebug_PrintTotalRefs(),
+                                  // _PyType_GetQualName()
+#include "pycore_parser.h"        // _PyParser_ASTFromString()
+#include "pycore_pyerrors.h"      // _PyErr_Fetch, _Py_Offer_Suggestions
 #include "pycore_pylifecycle.h"   // _Py_UnhandledKeyboardInterrupt
 #include "pycore_pystate.h"       // _PyInterpreterState_GET()
 #include "pycore_sysmodule.h"     // _PySys_Audit()
 
-#include "node.h"                 // node
 #include "token.h"                // INDENT
-#include "parsetok.h"             // perrdetail
 #include "errcode.h"              // E_EOF
 #include "code.h"                 // PyCodeObject
-#include "symtable.h"             // PySymtable_BuildObject()
-#include "ast.h"                  // PyAST_FromNodeObject()
 #include "marshal.h"              // PyMarshal_ReadLongFromFile()
 
-#include "pegen_interface.h"      // PyPegen_ASTFrom*
-
 #ifdef MS_WINDOWS
 #  include "malloc.h"             // alloca()
 #endif
@@ -58,56 +53,81 @@
 extern "C" {
 #endif
 
-extern Py_EXPORTED_SYMBOL grammar _PyParser_Grammar; /* From graminit.c */
-
 /* Forward */
 static void flush_io(void);
 static PyObject *run_mod(mod_ty, PyObject *, PyObject *, PyObject *,
                           PyCompilerFlags *, PyArena *);
-static PyObject *run_pyc_file(FILE *, const char *, PyObject *, PyObject *,
+static PyObject *run_pyc_file(FILE *, PyObject *, PyObject *,
                               PyCompilerFlags *);
-static void err_input(perrdetail *);
-static void err_free(perrdetail *);
 static int PyRun_InteractiveOneObjectEx(FILE *, PyObject *, PyCompilerFlags *);
+static PyObject* pyrun_file(FILE *fp, PyObject *filename, int start,
+                            PyObject *globals, PyObject *locals, int closeit,
+                            PyCompilerFlags *flags);
+
+
+int
+_PyRun_AnyFileObject(FILE *fp, PyObject *filename, int closeit,
+                     PyCompilerFlags *flags)
+{
+    int decref_filename = 0;
+    if (filename == NULL) {
+        filename = PyUnicode_FromString("???");
+        if (filename == NULL) {
+            PyErr_Print();
+            return -1;
+        }
+        decref_filename = 1;
+    }
+
+    int res;
+    if (_Py_FdIsInteractive(fp, filename)) {
+        res = _PyRun_InteractiveLoopObject(fp, filename, flags);
+        if (closeit) {
+            fclose(fp);
+        }
+    }
+    else {
+        res = _PyRun_SimpleFileObject(fp, filename, closeit, flags);
+    }
+
+    if (decref_filename) {
+        Py_DECREF(filename);
+    }
+    return res;
+}
+
 
 /* Parse input from a file and execute it */
 int
 PyRun_AnyFileExFlags(FILE *fp, const char *filename, int closeit,
                      PyCompilerFlags *flags)
 {
-    if (filename == NULL)
-        filename = "???";
-    if (Py_FdIsInteractive(fp, filename)) {
-        int err = PyRun_InteractiveLoopFlags(fp, filename, flags);
-        if (closeit)
-            fclose(fp);
-        return err;
+    PyObject *filename_obj;
+    if (filename != NULL) {
+        filename_obj = PyUnicode_DecodeFSDefault(filename);
+        if (filename_obj == NULL) {
+            PyErr_Print();
+            return -1;
+        }
     }
-    else
-        return PyRun_SimpleFileExFlags(fp, filename, closeit, flags);
+    else {
+        filename_obj = NULL;
+    }
+    int res = _PyRun_AnyFileObject(fp, filename_obj, closeit, flags);
+    Py_XDECREF(filename_obj);
+    return res;
 }
 
+
 int
-PyRun_InteractiveLoopFlags(FILE *fp, const char *filename_str, PyCompilerFlags *flags)
+_PyRun_InteractiveLoopObject(FILE *fp, PyObject *filename, PyCompilerFlags *flags)
 {
-    PyObject *filename, *v;
-    int ret, err;
     PyCompilerFlags local_flags = _PyCompilerFlags_INIT;
-    int nomem_count = 0;
-#ifdef Py_REF_DEBUG
-    int show_ref_count = _Py_GetConfig()->show_ref_count;
-#endif
-
-    filename = PyUnicode_DecodeFSDefault(filename_str);
-    if (filename == NULL) {
-        PyErr_Print();
-        return -1;
-    }
-
     if (flags == NULL) {
         flags = &local_flags;
     }
-    v = _PySys_GetObjectId(&PyId_ps1);
+
+    PyObject *v = _PySys_GetObjectId(&PyId_ps1);
     if (v == NULL) {
         _PySys_SetObjectId(&PyId_ps1, v = PyUnicode_FromString(">>> "));
         Py_XDECREF(v);
@@ -117,7 +137,13 @@
         _PySys_SetObjectId(&PyId_ps2, v = PyUnicode_FromString("... "));
         Py_XDECREF(v);
     }
-    err = 0;
+
+#ifdef Py_REF_DEBUG
+    int show_ref_count = _Py_GetConfig()->show_ref_count;
+#endif
+    int err = 0;
+    int ret;
+    int nomem_count = 0;
     do {
         ret = PyRun_InteractiveOneObjectEx(fp, filename, flags);
         if (ret == -1 && PyErr_Occurred()) {
@@ -144,35 +170,25 @@
         }
 #endif
     } while (ret != E_EOF);
-    Py_DECREF(filename);
     return err;
 }
 
-/* compute parser flags based on compiler flags */
-static int PARSER_FLAGS(PyCompilerFlags *flags)
+
+int
+PyRun_InteractiveLoopFlags(FILE *fp, const char *filename, PyCompilerFlags *flags)
 {
-    int parser_flags = 0;
-    if (!flags)
-        return 0;
-    if (flags->cf_flags & PyCF_DONT_IMPLY_DEDENT)
-        parser_flags |= PyPARSE_DONT_IMPLY_DEDENT;
-    if (flags->cf_flags & PyCF_IGNORE_COOKIE)
-        parser_flags |= PyPARSE_IGNORE_COOKIE;
-    if (flags->cf_flags & CO_FUTURE_BARRY_AS_BDFL)
-        parser_flags |= PyPARSE_BARRY_AS_BDFL;
-    if (flags->cf_flags & PyCF_TYPE_COMMENTS)
-        parser_flags |= PyPARSE_TYPE_COMMENTS;
-    return parser_flags;
+    PyObject *filename_obj = PyUnicode_DecodeFSDefault(filename);
+    if (filename_obj == NULL) {
+        PyErr_Print();
+        return -1;
+    }
+
+    int err = _PyRun_InteractiveLoopObject(fp, filename_obj, flags);
+    Py_DECREF(filename_obj);
+    return err;
+
 }
 
-#if 0
-/* Keep an example of flags with future keyword support. */
-#define PARSER_FLAGS(flags) \
-    ((flags) ? ((((flags)->cf_flags & PyCF_DONT_IMPLY_DEDENT) ? \
-                  PyPARSE_DONT_IMPLY_DEDENT : 0) \
-                | ((flags)->cf_flags & CO_FUTURE_WITH_STATEMENT ? \
-                   PyPARSE_WITH_IS_KEYWORD : 0)) : 0)
-#endif
 
 /* A PyRun_InteractiveOneObject() auxiliary function that does not print the
  * error on failure. */
@@ -185,7 +201,6 @@
     PyArena *arena;
     const char *ps1 = "", *ps2 = "", *enc = NULL;
     int errcode = 0;
-    int use_peg = _PyInterpreterState_GET()->config._use_peg_parser;
     _Py_IDENTIFIER(encoding);
     _Py_IDENTIFIER(__main__);
 
@@ -231,7 +246,7 @@
             }
         }
     }
-    arena = PyArena_New();
+    arena = _PyArena_New();
     if (arena == NULL) {
         Py_XDECREF(v);
         Py_XDECREF(w);
@@ -239,21 +254,14 @@
         return -1;
     }
 
-    if (use_peg) {
-        mod = PyPegen_ASTFromFileObject(fp, filename, Py_single_input,
-                                        enc, ps1, ps2, flags, &errcode, arena);
-    }
-    else {
-        mod = PyParser_ASTFromFileObject(fp, filename, enc,
-                                         Py_single_input, ps1, ps2,
-                                         flags, &errcode, arena);
-    }
+    mod = _PyParser_ASTFromFile(fp, filename, enc, Py_single_input,
+                                ps1, ps2, flags, &errcode, arena);
 
     Py_XDECREF(v);
     Py_XDECREF(w);
     Py_XDECREF(oenc);
     if (mod == NULL) {
-        PyArena_Free(arena);
+        _PyArena_Free(arena);
         if (errcode == E_EOF) {
             PyErr_Clear();
             return E_EOF;
@@ -262,12 +270,12 @@
     }
     m = PyImport_AddModuleObject(mod_name);
     if (m == NULL) {
-        PyArena_Free(arena);
+        _PyArena_Free(arena);
         return -1;
     }
     d = PyModule_GetDict(m);
     v = run_mod(mod, filename, d, d, flags, arena);
-    PyArena_Free(arena);
+    _PyArena_Free(arena);
     if (v == NULL) {
         return -1;
     }
@@ -310,112 +318,122 @@
    the file type, and, if we may close it, at the first few bytes. */
 
 static int
-maybe_pyc_file(FILE *fp, const char* filename, const char* ext, int closeit)
+maybe_pyc_file(FILE *fp, PyObject *filename, int closeit)
 {
-    if (strcmp(ext, ".pyc") == 0)
+    PyObject *ext = PyUnicode_FromString(".pyc");
+    if (ext == NULL) {
+        return -1;
+    }
+    Py_ssize_t endswith = PyUnicode_Tailmatch(filename, ext, 0, PY_SSIZE_T_MAX, +1);
+    Py_DECREF(ext);
+    if (endswith) {
         return 1;
+    }
 
     /* Only look into the file if we are allowed to close it, since
        it then should also be seekable. */
-    if (closeit) {
-        /* Read only two bytes of the magic. If the file was opened in
-           text mode, the bytes 3 and 4 of the magic (\r\n) might not
-           be read as they are on disk. */
-        unsigned int halfmagic = PyImport_GetMagicNumber() & 0xFFFF;
-        unsigned char buf[2];
-        /* Mess:  In case of -x, the stream is NOT at its start now,
-           and ungetc() was used to push back the first newline,
-           which makes the current stream position formally undefined,
-           and a x-platform nightmare.
-           Unfortunately, we have no direct way to know whether -x
-           was specified.  So we use a terrible hack:  if the current
-           stream position is not 0, we assume -x was specified, and
-           give up.  Bug 132850 on SourceForge spells out the
-           hopelessness of trying anything else (fseek and ftell
-           don't work predictably x-platform for text-mode files).
-        */
-        int ispyc = 0;
-        if (ftell(fp) == 0) {
-            if (fread(buf, 1, 2, fp) == 2 &&
-                ((unsigned int)buf[1]<<8 | buf[0]) == halfmagic)
-                ispyc = 1;
-            rewind(fp);
-        }
-        return ispyc;
+    if (!closeit) {
+        return 0;
     }
-    return 0;
+
+    /* Read only two bytes of the magic. If the file was opened in
+       text mode, the bytes 3 and 4 of the magic (\r\n) might not
+       be read as they are on disk. */
+    unsigned int halfmagic = PyImport_GetMagicNumber() & 0xFFFF;
+    unsigned char buf[2];
+    /* Mess:  In case of -x, the stream is NOT at its start now,
+       and ungetc() was used to push back the first newline,
+       which makes the current stream position formally undefined,
+       and a x-platform nightmare.
+       Unfortunately, we have no direct way to know whether -x
+       was specified.  So we use a terrible hack:  if the current
+       stream position is not 0, we assume -x was specified, and
+       give up.  Bug 132850 on SourceForge spells out the
+       hopelessness of trying anything else (fseek and ftell
+       don't work predictably x-platform for text-mode files).
+    */
+    int ispyc = 0;
+    if (ftell(fp) == 0) {
+        if (fread(buf, 1, 2, fp) == 2 &&
+            ((unsigned int)buf[1]<<8 | buf[0]) == halfmagic)
+            ispyc = 1;
+        rewind(fp);
+    }
+    return ispyc;
 }
 
-static int
-set_main_loader(PyObject *d, const char *filename, const char *loader_name)
-{
-    PyObject *filename_obj, *bootstrap, *loader_type = NULL, *loader;
-    int result = 0;
 
-    filename_obj = PyUnicode_DecodeFSDefault(filename);
-    if (filename_obj == NULL)
-        return -1;
+static int
+set_main_loader(PyObject *d, PyObject *filename, const char *loader_name)
+{
     PyInterpreterState *interp = _PyInterpreterState_GET();
-    bootstrap = PyObject_GetAttrString(interp->importlib,
-                                       "_bootstrap_external");
-    if (bootstrap != NULL) {
-        loader_type = PyObject_GetAttrString(bootstrap, loader_name);
-        Py_DECREF(bootstrap);
-    }
-    if (loader_type == NULL) {
-        Py_DECREF(filename_obj);
+    PyObject *bootstrap = PyObject_GetAttrString(interp->importlib,
+                                                 "_bootstrap_external");
+    if (bootstrap == NULL) {
         return -1;
     }
-    loader = PyObject_CallFunction(loader_type, "sN", "__main__", filename_obj);
+
+    PyObject *loader_type = PyObject_GetAttrString(bootstrap, loader_name);
+    Py_DECREF(bootstrap);
+    if (loader_type == NULL) {
+        return -1;
+    }
+
+    PyObject *loader = PyObject_CallFunction(loader_type,
+                                             "sO", "__main__", filename);
     Py_DECREF(loader_type);
     if (loader == NULL) {
         return -1;
     }
+
     if (PyDict_SetItemString(d, "__loader__", loader) < 0) {
-        result = -1;
+        Py_DECREF(loader);
+        return -1;
     }
     Py_DECREF(loader);
-    return result;
+    return 0;
 }
 
+
 int
-PyRun_SimpleFileExFlags(FILE *fp, const char *filename, int closeit,
+_PyRun_SimpleFileObject(FILE *fp, PyObject *filename, int closeit,
                         PyCompilerFlags *flags)
 {
     PyObject *m, *d, *v;
-    const char *ext;
     int set_file_name = 0, ret = -1;
-    size_t len;
 
     m = PyImport_AddModule("__main__");
     if (m == NULL)
         return -1;
     Py_INCREF(m);
     d = PyModule_GetDict(m);
-    if (PyDict_GetItemString(d, "__file__") == NULL) {
-        PyObject *f;
-        f = PyUnicode_DecodeFSDefault(filename);
-        if (f == NULL)
+    if (_PyDict_GetItemStringWithError(d, "__file__") == NULL) {
+        if (PyErr_Occurred()) {
             goto done;
-        if (PyDict_SetItemString(d, "__file__", f) < 0) {
-            Py_DECREF(f);
+        }
+        if (PyDict_SetItemString(d, "__file__", filename) < 0) {
             goto done;
         }
         if (PyDict_SetItemString(d, "__cached__", Py_None) < 0) {
-            Py_DECREF(f);
             goto done;
         }
         set_file_name = 1;
-        Py_DECREF(f);
     }
-    len = strlen(filename);
-    ext = filename + len - (len > 4 ? 4 : 0);
-    if (maybe_pyc_file(fp, filename, ext, closeit)) {
+
+    int pyc = maybe_pyc_file(fp, filename, closeit);
+    if (pyc < 0) {
+        goto done;
+    }
+
+    if (pyc) {
         FILE *pyc_fp;
         /* Try to run a pyc file. First, re-open in binary */
-        if (closeit)
+        if (closeit) {
             fclose(fp);
-        if ((pyc_fp = _Py_fopen(filename, "rb")) == NULL) {
+        }
+
+        pyc_fp = _Py_fopen_obj(filename, "rb");
+        if (pyc_fp == NULL) {
             fprintf(stderr, "python: Can't reopen .pyc file\n");
             goto done;
         }
@@ -426,17 +444,17 @@
             fclose(pyc_fp);
             goto done;
         }
-        v = run_pyc_file(pyc_fp, filename, d, d, flags);
+        v = run_pyc_file(pyc_fp, d, d, flags);
     } else {
         /* When running from stdin, leave __main__.__loader__ alone */
-        if (strcmp(filename, "<stdin>") != 0 &&
+        if (PyUnicode_CompareWithASCIIString(filename, "<stdin>") != 0 &&
             set_main_loader(d, filename, "SourceFileLoader") < 0) {
             fprintf(stderr, "python: failed to set __main__.__loader__\n");
             ret = -1;
             goto done;
         }
-        v = PyRun_FileExFlags(fp, filename, Py_file_input, d, d,
-                              closeit, flags);
+        v = pyrun_file(fp, filename, Py_file_input, d, d,
+                       closeit, flags);
     }
     flush_io();
     if (v == NULL) {
@@ -459,6 +477,21 @@
     return ret;
 }
 
+
+int
+PyRun_SimpleFileExFlags(FILE *fp, const char *filename, int closeit,
+                        PyCompilerFlags *flags)
+{
+    PyObject *filename_obj = PyUnicode_DecodeFSDefault(filename);
+    if (filename_obj == NULL) {
+        return -1;
+    }
+    int res = _PyRun_SimpleFileObject(fp, filename_obj, closeit, flags);
+    Py_DECREF(filename_obj);
+    return res;
+}
+
+
 int
 PyRun_SimpleStringFlags(const char *command, PyCompilerFlags *flags)
 {
@@ -478,7 +511,9 @@
 
 static int
 parse_syntax_error(PyObject *err, PyObject **message, PyObject **filename,
-                   Py_ssize_t *lineno, Py_ssize_t *offset, PyObject **text)
+                   Py_ssize_t *lineno, Py_ssize_t *offset,
+                   Py_ssize_t* end_lineno, Py_ssize_t* end_offset,
+                   PyObject **text)
 {
     Py_ssize_t hold;
     PyObject *v;
@@ -486,6 +521,8 @@
     _Py_IDENTIFIER(filename);
     _Py_IDENTIFIER(lineno);
     _Py_IDENTIFIER(offset);
+    _Py_IDENTIFIER(end_lineno);
+    _Py_IDENTIFIER(end_offset);
     _Py_IDENTIFIER(text);
 
     *message = NULL;
@@ -533,6 +570,44 @@
         *offset = hold;
     }
 
+    if (Py_TYPE(err) == (PyTypeObject*)PyExc_SyntaxError) {
+        v = _PyObject_GetAttrId(err, &PyId_end_lineno);
+        if (!v) {
+            PyErr_Clear();
+            *end_lineno = *lineno;
+        }
+        else if (v == Py_None) {
+            *end_lineno = *lineno;
+            Py_DECREF(v);
+        } else {
+            hold = PyLong_AsSsize_t(v);
+            Py_DECREF(v);
+            if (hold < 0 && PyErr_Occurred())
+                goto finally;
+            *end_lineno = hold;
+        }
+
+        v = _PyObject_GetAttrId(err, &PyId_end_offset);
+        if (!v) {
+            PyErr_Clear();
+            *end_offset = -1;
+        }
+        else if (v == Py_None) {
+            *end_offset = -1;
+            Py_DECREF(v);
+        } else {
+            hold = PyLong_AsSsize_t(v);
+            Py_DECREF(v);
+            if (hold < 0 && PyErr_Occurred())
+                goto finally;
+            *end_offset = hold;
+        }
+    } else {
+        // SyntaxError subclasses
+        *end_lineno = *lineno;
+        *end_offset = -1;
+    }
+
     v = _PyObject_GetAttrId(err, &PyId_text);
     if (!v)
         goto finally;
@@ -552,8 +627,9 @@
 }
 
 static void
-print_error_text(PyObject *f, Py_ssize_t offset, PyObject *text_obj)
+print_error_text(PyObject *f, Py_ssize_t offset, Py_ssize_t end_offset, PyObject *text_obj)
 {
+    size_t caret_repetitions = (end_offset > 0 && end_offset > offset) ? end_offset - offset : 1;
     /* Convert text to a char pointer; return if error */
     const char *text = PyUnicode_AsUTF8(text_obj);
     if (text == NULL)
@@ -613,7 +689,10 @@
     while (--offset >= 0) {
         PyFile_WriteString(" ", f);
     }
-    PyFile_WriteString("^\n", f);
+    for (size_t caret_iter=0; caret_iter < caret_repetitions ; caret_iter++) {
+        PyFile_WriteString("^", f);
+    }
+    PyFile_WriteString("\n", f);
 }
 
 
@@ -811,7 +890,7 @@
 print_exception(PyObject *f, PyObject *value)
 {
     int err = 0;
-    PyObject *type, *tb;
+    PyObject *type, *tb, *tmp;
     _Py_IDENTIFIER(print_file_and_line);
 
     if (!PyExceptionInstance_Check(value)) {
@@ -830,12 +909,15 @@
     if (tb && tb != Py_None)
         err = PyTraceBack_Print(tb, f);
     if (err == 0 &&
-        _PyObject_HasAttrId(value, &PyId_print_file_and_line))
+        (err = _PyObject_LookupAttrId(value, &PyId_print_file_and_line, &tmp)) > 0)
     {
         PyObject *message, *filename, *text;
-        Py_ssize_t lineno, offset;
+        Py_ssize_t lineno, offset, end_lineno, end_offset;
+        err = 0;
+        Py_DECREF(tmp);
         if (!parse_syntax_error(value, &message, &filename,
-                                &lineno, &offset, &text))
+                                &lineno, &offset,
+                                &end_lineno, &end_offset, &text))
             PyErr_Clear();
         else {
             PyObject *line;
@@ -852,7 +934,21 @@
             }
 
             if (text != NULL) {
-                print_error_text(f, offset, text);
+                Py_ssize_t line_size;
+                const char* error_line = PyUnicode_AsUTF8AndSize(text, &line_size);
+                // If the location of the error spawn multiple lines, we want
+                // to just print the first one and highlight everything until
+                // the end of that one since we don't support multi-line error
+                // messages.
+                if (end_lineno > lineno) {
+                    end_offset = (error_line != NULL) ? line_size : -1;
+                }
+                // Limit the amount of '^' that we can display to
+                // the size of the text in the source line.
+                if (error_line != NULL && end_offset > line_size + 1) {
+                    end_offset = line_size + 1;
+                }
+                print_error_text(f, offset, end_offset, text);
                 Py_DECREF(text);
             }
 
@@ -866,36 +962,37 @@
         /* Don't do anything else */
     }
     else {
-        PyObject* moduleName;
-        const char *className;
+        PyObject* modulename;
+
         _Py_IDENTIFIER(__module__);
         assert(PyExceptionClass_Check(type));
-        className = PyExceptionClass_Name(type);
-        if (className != NULL) {
-            const char *dot = strrchr(className, '.');
-            if (dot != NULL)
-                className = dot+1;
-        }
 
-        moduleName = _PyObject_GetAttrId(type, &PyId___module__);
-        if (moduleName == NULL || !PyUnicode_Check(moduleName))
+        modulename = _PyObject_GetAttrId(type, &PyId___module__);
+        if (modulename == NULL || !PyUnicode_Check(modulename))
         {
-            Py_XDECREF(moduleName);
-            err = PyFile_WriteString("<unknown>", f);
+            Py_XDECREF(modulename);
+            PyErr_Clear();
+            err = PyFile_WriteString("<unknown>.", f);
         }
         else {
-            if (!_PyUnicode_EqualToASCIIId(moduleName, &PyId_builtins))
+            if (!_PyUnicode_EqualToASCIIId(modulename, &PyId_builtins))
             {
-                err = PyFile_WriteObject(moduleName, f, Py_PRINT_RAW);
+                err = PyFile_WriteObject(modulename, f, Py_PRINT_RAW);
                 err += PyFile_WriteString(".", f);
             }
-            Py_DECREF(moduleName);
+            Py_DECREF(modulename);
         }
         if (err == 0) {
-            if (className == NULL)
-                      err = PyFile_WriteString("<unknown>", f);
-            else
-                      err = PyFile_WriteString(className, f);
+            PyObject* qualname = _PyType_GetQualName((PyTypeObject *)type);
+            if (qualname == NULL || !PyUnicode_Check(qualname)) {
+                Py_XDECREF(qualname);
+                PyErr_Clear();
+                err = PyFile_WriteString("<unknown>", f);
+            }
+            else {
+                err = PyFile_WriteObject(qualname, f, Py_PRINT_RAW);
+                Py_DECREF(qualname);
+            }
         }
     }
     if (err == 0 && (value != Py_None)) {
@@ -919,6 +1016,18 @@
     if (err < 0) {
         PyErr_Clear();
     }
+    PyObject* suggestions = _Py_Offer_Suggestions(value);
+    if (suggestions) {
+        // Add a trailer ". Did you mean: (...)?"
+        err = PyFile_WriteString(". Did you mean: '", f);
+        if (err == 0) {
+            err = PyFile_WriteObject(suggestions, f, Py_PRINT_RAW);
+            err += PyFile_WriteString("'?", f);
+        }
+        Py_DECREF(suggestions);
+    } else if (PyErr_Occurred()) {
+        PyErr_Clear();
+    }
     err += PyFile_WriteString("\n", f);
     Py_XDECREF(tb);
     Py_DECREF(value);
@@ -1046,8 +1155,9 @@
     if (file == Py_None) {
         return;
     }
-
+    Py_INCREF(file);
     _PyErr_Display(file, exception, value, tb);
+    Py_DECREF(file);
 }
 
 PyObject *
@@ -1058,70 +1168,71 @@
     mod_ty mod;
     PyArena *arena;
     PyObject *filename;
-    int use_peg = _PyInterpreterState_GET()->config._use_peg_parser;
 
     filename = _PyUnicode_FromId(&PyId_string); /* borrowed */
     if (filename == NULL)
         return NULL;
 
-    arena = PyArena_New();
+    arena = _PyArena_New();
     if (arena == NULL)
         return NULL;
 
-    if (use_peg) {
-        mod = PyPegen_ASTFromStringObject(str, filename, start, flags, arena);
-    }
-    else {
-        mod = PyParser_ASTFromStringObject(str, filename, start, flags, arena);
-    }
+    mod = _PyParser_ASTFromString(str, filename, start, flags, arena);
 
     if (mod != NULL)
         ret = run_mod(mod, filename, globals, locals, flags, arena);
-    PyArena_Free(arena);
+    _PyArena_Free(arena);
     return ret;
 }
 
-PyObject *
-PyRun_FileExFlags(FILE *fp, const char *filename_str, int start, PyObject *globals,
-                  PyObject *locals, int closeit, PyCompilerFlags *flags)
+
+static PyObject *
+pyrun_file(FILE *fp, PyObject *filename, int start, PyObject *globals,
+           PyObject *locals, int closeit, PyCompilerFlags *flags)
 {
-    PyObject *ret = NULL;
+    PyArena *arena = _PyArena_New();
+    if (arena == NULL) {
+        return NULL;
+    }
+
     mod_ty mod;
-    PyArena *arena = NULL;
-    PyObject *filename;
-    int use_peg = _PyInterpreterState_GET()->config._use_peg_parser;
+    mod = _PyParser_ASTFromFile(fp, filename, NULL, start, NULL, NULL,
+                                flags, NULL, arena);
 
-    filename = PyUnicode_DecodeFSDefault(filename_str);
-    if (filename == NULL)
-        goto exit;
+    if (closeit) {
+        fclose(fp);
+    }
 
-    arena = PyArena_New();
-    if (arena == NULL)
-        goto exit;
-
-    if (use_peg) {
-        mod = PyPegen_ASTFromFileObject(fp, filename, start, NULL, NULL, NULL,
-                                        flags, NULL, arena);
+    PyObject *ret;
+    if (mod != NULL) {
+        ret = run_mod(mod, filename, globals, locals, flags, arena);
     }
     else {
-        mod = PyParser_ASTFromFileObject(fp, filename, NULL, start, 0, 0,
-                                         flags, NULL, arena);
+        ret = NULL;
     }
+    _PyArena_Free(arena);
 
-    if (closeit)
-        fclose(fp);
-    if (mod == NULL) {
-        goto exit;
-    }
-    ret = run_mod(mod, filename, globals, locals, flags, arena);
-
-exit:
-    Py_XDECREF(filename);
-    if (arena != NULL)
-        PyArena_Free(arena);
     return ret;
 }
 
+
+PyObject *
+PyRun_FileExFlags(FILE *fp, const char *filename, int start, PyObject *globals,
+                  PyObject *locals, int closeit, PyCompilerFlags *flags)
+{
+    PyObject *filename_obj = PyUnicode_DecodeFSDefault(filename);
+    if (filename_obj == NULL) {
+        return NULL;
+    }
+
+    PyObject *res = pyrun_file(fp, filename_obj, start, globals,
+                               locals, closeit, flags);
+    Py_DECREF(filename_obj);
+    return res;
+
+}
+
+
 static void
 flush_io(void)
 {
@@ -1168,9 +1279,11 @@
     _Py_UnhandledKeyboardInterrupt = 0;
 
     /* Set globals['__builtins__'] if it doesn't exist */
-    if (globals != NULL && PyDict_GetItemString(globals, "__builtins__") == NULL) {
-        if (PyDict_SetItemString(globals, "__builtins__",
-                                 tstate->interp->builtins) < 0) {
+    if (globals != NULL && _PyDict_GetItemStringWithError(globals, "__builtins__") == NULL) {
+        if (PyErr_Occurred() ||
+            PyDict_SetItemString(globals, "__builtins__",
+                                 tstate->interp->builtins) < 0)
+        {
             return NULL;
         }
     }
@@ -1187,7 +1300,7 @@
             PyCompilerFlags *flags, PyArena *arena)
 {
     PyThreadState *tstate = _PyThreadState_GET();
-    PyCodeObject *co = PyAST_CompileObject(mod, filename, flags, -1, arena);
+    PyCodeObject *co = _PyAST_Compile(mod, filename, flags, -1, arena);
     if (co == NULL)
         return NULL;
 
@@ -1202,8 +1315,8 @@
 }
 
 static PyObject *
-run_pyc_file(FILE *fp, const char *filename, PyObject *globals,
-             PyObject *locals, PyCompilerFlags *flags)
+run_pyc_file(FILE *fp, PyObject *globals, PyObject *locals,
+             PyCompilerFlags *flags)
 {
     PyThreadState *tstate = _PyThreadState_GET();
     PyCodeObject *co;
@@ -1250,28 +1363,22 @@
 {
     PyCodeObject *co;
     mod_ty mod;
-    int use_peg = _PyInterpreterState_GET()->config._use_peg_parser;
-    PyArena *arena = PyArena_New();
+    PyArena *arena = _PyArena_New();
     if (arena == NULL)
         return NULL;
 
-    if (use_peg) {
-        mod = PyPegen_ASTFromStringObject(str, filename, start, flags, arena);
-    }
-    else {
-        mod = PyParser_ASTFromStringObject(str, filename, start, flags, arena);
-    }
+    mod = _PyParser_ASTFromString(str, filename, start, flags, arena);
     if (mod == NULL) {
-        PyArena_Free(arena);
+        _PyArena_Free(arena);
         return NULL;
     }
     if (flags && (flags->cf_flags & PyCF_ONLY_AST)) {
         PyObject *result = PyAST_mod2obj(mod);
-        PyArena_Free(arena);
+        _PyArena_Free(arena);
         return result;
     }
-    co = PyAST_CompileObject(mod, filename, flags, optimize, arena);
-    PyArena_Free(arena);
+    co = _PyAST_Compile(mod, filename, flags, optimize, arena);
+    _PyArena_Free(arena);
     return (PyObject *)co;
 }
 
@@ -1288,14 +1395,6 @@
     return co;
 }
 
-/* For use in Py_LIMITED_API */
-#undef Py_CompileString
-PyObject *
-PyCompileString(const char *str, const char *filename, int start)
-{
-    return Py_CompileStringFlags(str, filename, start, NULL);
-}
-
 const char *
 _Py_SourceAsString(PyObject *cmd, const char *funcname, const char *what, PyCompilerFlags *cf, PyObject **cmd_copy)
 {
@@ -1345,339 +1444,6 @@
     return str;
 }
 
-struct symtable *
-Py_SymtableStringObject(const char *str, PyObject *filename, int start)
-{
-    PyCompilerFlags flags = _PyCompilerFlags_INIT;
-    return _Py_SymtableStringObjectFlags(str, filename, start, &flags);
-}
-
-struct symtable *
-_Py_SymtableStringObjectFlags(const char *str, PyObject *filename, int start, PyCompilerFlags *flags)
-{
-    struct symtable *st;
-    mod_ty mod;
-    int use_peg = _PyInterpreterState_GET()->config._use_peg_parser;
-    PyArena *arena;
-
-    arena = PyArena_New();
-    if (arena == NULL)
-        return NULL;
-
-    if (use_peg) {
-        mod = PyPegen_ASTFromStringObject(str, filename, start, flags, arena);
-    }
-    else {
-        mod = PyParser_ASTFromStringObject(str, filename, start, flags, arena);
-    }
-    if (mod == NULL) {
-        PyArena_Free(arena);
-        return NULL;
-    }
-    st = PySymtable_BuildObject(mod, filename, 0);
-    PyArena_Free(arena);
-    return st;
-}
-
-struct symtable *
-Py_SymtableString(const char *str, const char *filename_str, int start)
-{
-    PyObject *filename;
-    struct symtable *st;
-
-    filename = PyUnicode_DecodeFSDefault(filename_str);
-    if (filename == NULL)
-        return NULL;
-    st = Py_SymtableStringObject(str, filename, start);
-    Py_DECREF(filename);
-    return st;
-}
-
-/* Preferred access to parser is through AST. */
-mod_ty
-PyParser_ASTFromStringObject(const char *s, PyObject *filename, int start,
-                             PyCompilerFlags *flags, PyArena *arena)
-{
-    mod_ty mod;
-    PyCompilerFlags localflags = _PyCompilerFlags_INIT;
-    perrdetail err;
-    int iflags = PARSER_FLAGS(flags);
-    if (flags && (flags->cf_flags & PyCF_ONLY_AST) && flags->cf_feature_version < 7)
-        iflags |= PyPARSE_ASYNC_HACKS;
-
-    node *n = PyParser_ParseStringObject(s, filename,
-                                         &_PyParser_Grammar, start, &err,
-                                         &iflags);
-    if (flags == NULL) {
-        flags = &localflags;
-    }
-    if (n) {
-        flags->cf_flags |= iflags & PyCF_MASK;
-        mod = PyAST_FromNodeObject(n, flags, filename, arena);
-        PyNode_Free(n);
-    }
-    else {
-        err_input(&err);
-        mod = NULL;
-    }
-    err_free(&err);
-    return mod;
-}
-
-mod_ty
-PyParser_ASTFromString(const char *s, const char *filename_str, int start,
-                       PyCompilerFlags *flags, PyArena *arena)
-{
-    PyObject *filename;
-    mod_ty mod;
-    filename = PyUnicode_DecodeFSDefault(filename_str);
-    if (filename == NULL)
-        return NULL;
-    mod = PyParser_ASTFromStringObject(s, filename, start, flags, arena);
-    Py_DECREF(filename);
-    return mod;
-}
-
-mod_ty
-PyParser_ASTFromFileObject(FILE *fp, PyObject *filename, const char* enc,
-                           int start, const char *ps1,
-                           const char *ps2, PyCompilerFlags *flags, int *errcode,
-                           PyArena *arena)
-{
-    mod_ty mod;
-    PyCompilerFlags localflags = _PyCompilerFlags_INIT;
-    perrdetail err;
-    int iflags = PARSER_FLAGS(flags);
-
-    node *n = PyParser_ParseFileObject(fp, filename, enc,
-                                       &_PyParser_Grammar,
-                                       start, ps1, ps2, &err, &iflags);
-    if (flags == NULL) {
-        flags = &localflags;
-    }
-    if (n) {
-        flags->cf_flags |= iflags & PyCF_MASK;
-        mod = PyAST_FromNodeObject(n, flags, filename, arena);
-        PyNode_Free(n);
-    }
-    else {
-        err_input(&err);
-        if (errcode)
-            *errcode = err.error;
-        mod = NULL;
-    }
-    err_free(&err);
-    return mod;
-}
-
-mod_ty
-PyParser_ASTFromFile(FILE *fp, const char *filename_str, const char* enc,
-                     int start, const char *ps1,
-                     const char *ps2, PyCompilerFlags *flags, int *errcode,
-                     PyArena *arena)
-{
-    mod_ty mod;
-    PyObject *filename;
-    filename = PyUnicode_DecodeFSDefault(filename_str);
-    if (filename == NULL)
-        return NULL;
-    mod = PyParser_ASTFromFileObject(fp, filename, enc, start, ps1, ps2,
-                                     flags, errcode, arena);
-    Py_DECREF(filename);
-    return mod;
-}
-
-/* Simplified interface to parsefile -- return node or set exception */
-
-node *
-PyParser_SimpleParseFileFlags(FILE *fp, const char *filename, int start, int flags)
-{
-    perrdetail err;
-    node *n = PyParser_ParseFileFlags(fp, filename, NULL,
-                                      &_PyParser_Grammar,
-                                      start, NULL, NULL, &err, flags);
-    if (n == NULL)
-        err_input(&err);
-    err_free(&err);
-
-    return n;
-}
-
-/* Simplified interface to parsestring -- return node or set exception */
-
-node *
-PyParser_SimpleParseStringFlags(const char *str, int start, int flags)
-{
-    perrdetail err;
-    node *n = PyParser_ParseStringFlags(str, &_PyParser_Grammar,
-                                        start, &err, flags);
-    if (n == NULL)
-        err_input(&err);
-    err_free(&err);
-    return n;
-}
-
-node *
-PyParser_SimpleParseStringFlagsFilename(const char *str, const char *filename,
-                                        int start, int flags)
-{
-    perrdetail err;
-    node *n = PyParser_ParseStringFlagsFilename(str, filename,
-                            &_PyParser_Grammar, start, &err, flags);
-    if (n == NULL)
-        err_input(&err);
-    err_free(&err);
-    return n;
-}
-
-/* May want to move a more generalized form of this to parsetok.c or
-   even parser modules. */
-
-void
-PyParser_ClearError(perrdetail *err)
-{
-    err_free(err);
-}
-
-void
-PyParser_SetError(perrdetail *err)
-{
-    err_input(err);
-}
-
-static void
-err_free(perrdetail *err)
-{
-    Py_CLEAR(err->filename);
-}
-
-/* Set the error appropriate to the given input error code (see errcode.h) */
-
-static void
-err_input(perrdetail *err)
-{
-    PyObject *v, *w, *errtype, *errtext;
-    PyObject *msg_obj = NULL;
-    const char *msg = NULL;
-    int offset = err->offset;
-
-    errtype = PyExc_SyntaxError;
-    switch (err->error) {
-    case E_ERROR:
-        goto cleanup;
-    case E_SYNTAX:
-        errtype = PyExc_IndentationError;
-        if (err->expected == INDENT)
-            msg = "expected an indented block";
-        else if (err->token == INDENT)
-            msg = "unexpected indent";
-        else if (err->token == DEDENT)
-            msg = "unexpected unindent";
-        else if (err->expected == NOTEQUAL) {
-            errtype = PyExc_SyntaxError;
-            msg = "with Barry as BDFL, use '<>' instead of '!='";
-        }
-        else {
-            errtype = PyExc_SyntaxError;
-            msg = "invalid syntax";
-        }
-        break;
-    case E_TOKEN:
-        msg = "invalid token";
-        break;
-    case E_EOFS:
-        msg = "EOF while scanning triple-quoted string literal";
-        break;
-    case E_EOLS:
-        msg = "EOL while scanning string literal";
-        break;
-    case E_INTR:
-        if (!PyErr_Occurred())
-            PyErr_SetNone(PyExc_KeyboardInterrupt);
-        goto cleanup;
-    case E_NOMEM:
-        PyErr_NoMemory();
-        goto cleanup;
-    case E_EOF:
-        msg = "unexpected EOF while parsing";
-        break;
-    case E_TABSPACE:
-        errtype = PyExc_TabError;
-        msg = "inconsistent use of tabs and spaces in indentation";
-        break;
-    case E_OVERFLOW:
-        msg = "expression too long";
-        break;
-    case E_DEDENT:
-        errtype = PyExc_IndentationError;
-        msg = "unindent does not match any outer indentation level";
-        break;
-    case E_TOODEEP:
-        errtype = PyExc_IndentationError;
-        msg = "too many levels of indentation";
-        break;
-    case E_DECODE: {
-        PyObject *type, *value, *tb;
-        PyErr_Fetch(&type, &value, &tb);
-        msg = "unknown decode error";
-        if (value != NULL)
-            msg_obj = PyObject_Str(value);
-        Py_XDECREF(type);
-        Py_XDECREF(value);
-        Py_XDECREF(tb);
-        break;
-    }
-    case E_LINECONT:
-        msg = "unexpected character after line continuation character";
-        break;
-
-    case E_BADSINGLE:
-        msg = "multiple statements found while compiling a single statement";
-        break;
-    default:
-        fprintf(stderr, "error=%d\n", err->error);
-        msg = "unknown parsing error";
-        break;
-    }
-    /* err->text may not be UTF-8 in case of decoding errors.
-       Explicitly convert to an object. */
-    if (!err->text) {
-        errtext = Py_None;
-        Py_INCREF(Py_None);
-    } else {
-        errtext = PyUnicode_DecodeUTF8(err->text, err->offset,
-                                       "replace");
-        if (errtext != NULL) {
-            Py_ssize_t len = strlen(err->text);
-            offset = (int)PyUnicode_GET_LENGTH(errtext);
-            if (len != err->offset) {
-                Py_DECREF(errtext);
-                errtext = PyUnicode_DecodeUTF8(err->text, len,
-                                               "replace");
-            }
-        }
-    }
-    v = Py_BuildValue("(OiiN)", err->filename,
-                      err->lineno, offset, errtext);
-    if (v != NULL) {
-        if (msg_obj)
-            w = Py_BuildValue("(OO)", msg_obj, v);
-        else
-            w = Py_BuildValue("(sO)", msg, v);
-    } else
-        w = NULL;
-    Py_XDECREF(v);
-    PyErr_SetObject(errtype, w);
-    Py_XDECREF(w);
-cleanup:
-    Py_XDECREF(msg_obj);
-    if (err->text != NULL) {
-        PyObject_FREE(err->text);
-        err->text = NULL;
-    }
-}
-
-
 #if defined(USE_STACKCHECK)
 #if defined(WIN32) && defined(_MSC_VER)
 
@@ -1717,20 +1483,6 @@
 
 /* Deprecated C API functions still provided for binary compatibility */
 
-#undef PyParser_SimpleParseFile
-PyAPI_FUNC(node *)
-PyParser_SimpleParseFile(FILE *fp, const char *filename, int start)
-{
-    return PyParser_SimpleParseFileFlags(fp, filename, start, 0);
-}
-
-#undef PyParser_SimpleParseString
-PyAPI_FUNC(node *)
-PyParser_SimpleParseString(const char *str, int start)
-{
-    return PyParser_SimpleParseStringFlags(str, start, 0);
-}
-
 #undef PyRun_AnyFile
 PyAPI_FUNC(int)
 PyRun_AnyFile(FILE *fp, const char *name)
diff --git a/Python/pytime.c b/Python/pytime.c
index 89d63e0..1ef99ae 100644
--- a/Python/pytime.c
+++ b/Python/pytime.c
@@ -6,7 +6,7 @@
 #if defined(__APPLE__)
 #include <mach/mach_time.h>   /* mach_absolute_time(), mach_timebase_info() */
 
-#if defined(__APPLE__) && defined(__has_builtin) 
+#if defined(__APPLE__) && defined(__has_builtin)
 #  if __has_builtin(__builtin_available)
 #    define HAVE_CLOCK_GETTIME_RUNTIME __builtin_available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *)
 #  endif
@@ -304,8 +304,8 @@
     if (_PyTime_check_mul_overflow(t, SEC_TO_NS)) {
         if (raise) {
             _PyTime_overflow();
+            res = -1;
         }
-        res = -1;
         t = (t > 0) ? _PyTime_MAX : _PyTime_MIN;
     }
     else {
@@ -318,8 +318,8 @@
     if (t > _PyTime_MAX - nsec) {
         if (raise) {
             _PyTime_overflow();
+            res = -1;
         }
-        res = -1;
         t = _PyTime_MAX;
     }
     else {
@@ -350,8 +350,8 @@
     if (_PyTime_check_mul_overflow(t, SEC_TO_NS)) {
         if (raise) {
             _PyTime_overflow();
+            res = -1;
         }
-        res = -1;
         t = (t > 0) ? _PyTime_MAX : _PyTime_MIN;
     }
     else {
@@ -364,8 +364,8 @@
     if (t > _PyTime_MAX - usec) {
         if (raise) {
             _PyTime_overflow();
+            res = -1;
         }
-        res = -1;
         t = _PyTime_MAX;
     }
     else {
@@ -656,7 +656,7 @@
 #endif
 
 static int
-pygettimeofday(_PyTime_t *tp, _Py_clock_info_t *info, int raise)
+py_get_system_clock(_PyTime_t *tp, _Py_clock_info_t *info, int raise)
 {
 #ifdef MS_WINDOWS
     FILETIME system_time;
@@ -730,7 +730,7 @@
     }
 
 #ifdef HAVE_CLOCK_GETTIME_RUNTIME
-    } else { 
+    } else {
 #endif
 
 #endif
@@ -769,9 +769,10 @@
 _PyTime_GetSystemClock(void)
 {
     _PyTime_t t;
-    if (pygettimeofday(&t, NULL, 0) < 0) {
-        /* should not happen, _PyTime_Init() checked the clock at startup */
-        Py_FatalError("pygettimeofday() failed");
+    if (py_get_system_clock(&t, NULL, 0) < 0) {
+        // If clock_gettime(CLOCK_REALTIME) or gettimeofday() fails:
+        // silently ignore the failure and return 0.
+        t = 0;
     }
     return t;
 }
@@ -779,11 +780,61 @@
 int
 _PyTime_GetSystemClockWithInfo(_PyTime_t *t, _Py_clock_info_t *info)
 {
-    return pygettimeofday(t, info, 1);
+    return py_get_system_clock(t, info, 1);
 }
 
+#if __APPLE__
 static int
-pymonotonic(_PyTime_t *tp, _Py_clock_info_t *info, int raise)
+py_mach_timebase_info(_PyTime_t *pnumer, _PyTime_t *pdenom, int raise)
+{
+    static mach_timebase_info_data_t timebase;
+    /* According to the Technical Q&A QA1398, mach_timebase_info() cannot
+       fail: https://developer.apple.com/library/mac/#qa/qa1398/ */
+    (void)mach_timebase_info(&timebase);
+
+    /* Sanity check: should never occur in practice */
+    if (timebase.numer < 1 || timebase.denom < 1) {
+        if (raise) {
+            PyErr_SetString(PyExc_RuntimeError,
+                            "invalid mach_timebase_info");
+        }
+        return -1;
+    }
+
+    /* Check that timebase.numer and timebase.denom can be casted to
+       _PyTime_t. In practice, timebase uses uint32_t, so casting cannot
+       overflow. At the end, only make sure that the type is uint32_t
+       (_PyTime_t is 64-bit long). */
+    Py_BUILD_ASSERT(sizeof(timebase.numer) < sizeof(_PyTime_t));
+    Py_BUILD_ASSERT(sizeof(timebase.denom) < sizeof(_PyTime_t));
+
+    /* Make sure that (ticks * timebase.numer) cannot overflow in
+       _PyTime_MulDiv(), with ticks < timebase.denom.
+
+       Known time bases:
+
+       * always (1, 1) on Intel
+       * (1000000000, 33333335) or (1000000000, 25000000) on PowerPC
+
+       None of these time bases can overflow with 64-bit _PyTime_t, but
+       check for overflow, just in case. */
+    if ((_PyTime_t)timebase.numer > _PyTime_MAX / (_PyTime_t)timebase.denom) {
+        if (raise) {
+            PyErr_SetString(PyExc_OverflowError,
+                            "mach_timebase_info is too large");
+        }
+        return -1;
+    }
+
+    *pnumer = (_PyTime_t)timebase.numer;
+    *pdenom = (_PyTime_t)timebase.denom;
+    return 0;
+}
+#endif
+
+
+static int
+py_get_monotonic_clock(_PyTime_t *tp, _Py_clock_info_t *info, int raise)
 {
 #if defined(MS_WINDOWS)
     ULONGLONG ticks;
@@ -800,10 +851,12 @@
             _PyTime_overflow();
             return -1;
         }
-        /* Hello, time traveler! */
-        Py_FatalError("pymonotonic: integer overflow");
+        // Truncate to _PyTime_MAX silently.
+        *tp = _PyTime_MAX;
     }
-    *tp = t * MS_TO_NS;
+    else {
+        *tp = t * MS_TO_NS;
+    }
 
     if (info) {
         DWORD timeAdjustment, timeIncrement;
@@ -821,62 +874,23 @@
     }
 
 #elif defined(__APPLE__)
-    static mach_timebase_info_data_t timebase;
-    static uint64_t t0 = 0;
-    uint64_t ticks;
-
-    if (timebase.denom == 0) {
-        /* According to the Technical Q&A QA1398, mach_timebase_info() cannot
-           fail: https://developer.apple.com/library/mac/#qa/qa1398/ */
-        (void)mach_timebase_info(&timebase);
-
-        /* Sanity check: should never occur in practice */
-        if (timebase.numer < 1 || timebase.denom < 1) {
-            PyErr_SetString(PyExc_RuntimeError,
-                            "invalid mach_timebase_info");
+    static _PyTime_t timebase_numer = 0;
+    static _PyTime_t timebase_denom = 0;
+    if (timebase_denom == 0) {
+        if (py_mach_timebase_info(&timebase_numer, &timebase_denom, raise) < 0) {
             return -1;
         }
-
-        /* Check that timebase.numer and timebase.denom can be casted to
-           _PyTime_t. In practice, timebase uses uint32_t, so casting cannot
-           overflow. At the end, only make sure that the type is uint32_t
-           (_PyTime_t is 64-bit long). */
-        assert(sizeof(timebase.numer) < sizeof(_PyTime_t));
-        assert(sizeof(timebase.denom) < sizeof(_PyTime_t));
-
-        /* Make sure that (ticks * timebase.numer) cannot overflow in
-           _PyTime_MulDiv(), with ticks < timebase.denom.
-
-           Known time bases:
-
-           * always (1, 1) on Intel
-           * (1000000000, 33333335) or (1000000000, 25000000) on PowerPC
-
-           None of these time bases can overflow with 64-bit _PyTime_t, but
-           check for overflow, just in case. */
-        if ((_PyTime_t)timebase.numer > _PyTime_MAX / (_PyTime_t)timebase.denom) {
-            PyErr_SetString(PyExc_OverflowError,
-                            "mach_timebase_info is too large");
-            return -1;
-        }
-
-        t0 = mach_absolute_time();
     }
 
     if (info) {
         info->implementation = "mach_absolute_time()";
-        info->resolution = (double)timebase.numer / (double)timebase.denom * 1e-9;
+        info->resolution = (double)timebase_numer / (double)timebase_denom * 1e-9;
         info->monotonic = 1;
         info->adjustable = 0;
     }
 
-    ticks = mach_absolute_time();
-    /* Use a "time zero" to reduce precision loss when converting time
-       to floatting point number, as in time.monotonic(). */
-    ticks -= t0;
-    *tp = _PyTime_MulDiv(ticks,
-                         (_PyTime_t)timebase.numer,
-                         (_PyTime_t)timebase.denom);
+    uint64_t ticks = mach_absolute_time();
+    *tp = _PyTime_MulDiv((_PyTime_t)ticks, timebase_numer, timebase_denom);
 
 #elif defined(__hpux)
     hrtime_t time;
@@ -940,10 +954,10 @@
 _PyTime_GetMonotonicClock(void)
 {
     _PyTime_t t;
-    if (pymonotonic(&t, NULL, 0) < 0) {
-        /* should not happen, _PyTime_Init() checked that monotonic clock at
-           startup */
-        Py_FatalError("pymonotonic() failed");
+    if (py_get_monotonic_clock(&t, NULL, 0) < 0) {
+        // If mach_timebase_info(), clock_gettime() or gethrtime() fails:
+        // silently ignore the failure and return 0.
+        t = 0;
     }
     return t;
 }
@@ -951,56 +965,69 @@
 int
 _PyTime_GetMonotonicClockWithInfo(_PyTime_t *tp, _Py_clock_info_t *info)
 {
-    return pymonotonic(tp, info, 1);
+    return py_get_monotonic_clock(tp, info, 1);
 }
 
 
 #ifdef MS_WINDOWS
 static int
-win_perf_counter(_PyTime_t *tp, _Py_clock_info_t *info)
+win_perf_counter_frequency(LONGLONG *pfrequency, int raise)
 {
-    static LONGLONG frequency = 0;
-    static LONGLONG t0 = 0;
-    LARGE_INTEGER now;
-    LONGLONG ticksll;
-    _PyTime_t ticks;
+    LONGLONG frequency;
 
-    if (frequency == 0) {
-        LARGE_INTEGER freq;
-        if (!QueryPerformanceFrequency(&freq)) {
+    LARGE_INTEGER freq;
+    if (!QueryPerformanceFrequency(&freq)) {
+        if (raise) {
             PyErr_SetFromWindowsErr(0);
-            return -1;
         }
-        frequency = freq.QuadPart;
+        return -1;
+    }
+    frequency = freq.QuadPart;
 
-        /* Sanity check: should never occur in practice */
-        if (frequency < 1) {
+    /* Sanity check: should never occur in practice */
+    if (frequency < 1) {
+        if (raise) {
             PyErr_SetString(PyExc_RuntimeError,
                             "invalid QueryPerformanceFrequency");
-            return -1;
         }
+        return -1;
+    }
 
-        /* Check that frequency can be casted to _PyTime_t.
+    /* Check that frequency can be casted to _PyTime_t.
 
-           Make also sure that (ticks * SEC_TO_NS) cannot overflow in
-           _PyTime_MulDiv(), with ticks < frequency.
+       Make also sure that (ticks * SEC_TO_NS) cannot overflow in
+       _PyTime_MulDiv(), with ticks < frequency.
 
-           Known QueryPerformanceFrequency() values:
+       Known QueryPerformanceFrequency() values:
 
-           * 10,000,000 (10 MHz): 100 ns resolution
-           * 3,579,545 Hz (3.6 MHz): 279 ns resolution
+       * 10,000,000 (10 MHz): 100 ns resolution
+       * 3,579,545 Hz (3.6 MHz): 279 ns resolution
 
-           None of these frequencies can overflow with 64-bit _PyTime_t, but
-           check for overflow, just in case. */
-        if (frequency > _PyTime_MAX
-            || frequency > (LONGLONG)_PyTime_MAX / (LONGLONG)SEC_TO_NS) {
+       None of these frequencies can overflow with 64-bit _PyTime_t, but
+       check for overflow, just in case. */
+    if (frequency > _PyTime_MAX
+        || frequency > (LONGLONG)_PyTime_MAX / (LONGLONG)SEC_TO_NS)
+    {
+        if (raise) {
             PyErr_SetString(PyExc_OverflowError,
                             "QueryPerformanceFrequency is too large");
+        }
+        return -1;
+    }
+
+    *pfrequency = frequency;
+    return 0;
+}
+
+
+static int
+py_get_win_perf_counter(_PyTime_t *tp, _Py_clock_info_t *info, int raise)
+{
+    static LONGLONG frequency = 0;
+    if (frequency == 0) {
+        if (win_perf_counter_frequency(&frequency, raise) < 0) {
             return -1;
         }
-
-        QueryPerformanceCounter(&now);
-        t0 = now.QuadPart;
     }
 
     if (info) {
@@ -1010,15 +1037,13 @@
         info->adjustable = 0;
     }
 
+    LARGE_INTEGER now;
     QueryPerformanceCounter(&now);
-    ticksll = now.QuadPart;
-
-    /* Use a "time zero" to reduce precision loss when converting time
-       to floatting point number, as in time.perf_counter(). */
-    ticksll -= t0;
+    LONGLONG ticksll = now.QuadPart;
 
     /* Make sure that casting LONGLONG to _PyTime_t cannot overflow,
        both types are signed */
+    _PyTime_t ticks;
     Py_BUILD_ASSERT(sizeof(ticksll) <= sizeof(ticks));
     ticks = (_PyTime_t)ticksll;
 
@@ -1032,7 +1057,7 @@
 _PyTime_GetPerfCounterWithInfo(_PyTime_t *t, _Py_clock_info_t *info)
 {
 #ifdef MS_WINDOWS
-    return win_perf_counter(t, info);
+    return py_get_win_perf_counter(t, info, 1);
 #else
     return _PyTime_GetMonotonicClockWithInfo(t, info);
 #endif
@@ -1043,33 +1068,22 @@
 _PyTime_GetPerfCounter(void)
 {
     _PyTime_t t;
-    if (_PyTime_GetPerfCounterWithInfo(&t, NULL)) {
-        Py_FatalError("_PyTime_GetPerfCounterWithInfo() failed");
+    int res;
+#ifdef MS_WINDOWS
+    res = py_get_win_perf_counter(&t, NULL, 0);
+#else
+    res = py_get_monotonic_clock(&t, NULL, 0);
+#endif
+    if (res  < 0) {
+        // If win_perf_counter_frequency() or py_get_monotonic_clock() fails:
+        // silently ignore the failure and return 0.
+        t = 0;
     }
     return t;
 }
 
 
 int
-_PyTime_Init(void)
-{
-    /* check that time.time(), time.monotonic() and time.perf_counter() clocks
-       are working properly to not have to check for exceptions at runtime. If
-       a clock works once, it cannot fail in next calls. */
-    _PyTime_t t;
-    if (_PyTime_GetSystemClockWithInfo(&t, NULL) < 0) {
-        return -1;
-    }
-    if (_PyTime_GetMonotonicClockWithInfo(&t, NULL) < 0) {
-        return -1;
-    }
-    if (_PyTime_GetPerfCounterWithInfo(&t, NULL) < 0) {
-        return -1;
-    }
-    return 0;
-}
-
-int
 _PyTime_localtime(time_t t, struct tm *tm)
 {
 #ifdef MS_WINDOWS
diff --git a/Python/stdlib_module_names.h b/Python/stdlib_module_names.h
new file mode 100644
index 0000000..50cf340
--- /dev/null
+++ b/Python/stdlib_module_names.h
@@ -0,0 +1,308 @@
+// Auto-generated by Tools/scripts/generate_stdlib_module_names.py.
+// List used to create sys.stdlib_module_names.
+
+static const char* _Py_stdlib_module_names[] = {
+"__future__",
+"_abc",
+"_aix_support",
+"_ast",
+"_asyncio",
+"_bisect",
+"_blake2",
+"_bootsubprocess",
+"_bz2",
+"_codecs",
+"_codecs_cn",
+"_codecs_hk",
+"_codecs_iso2022",
+"_codecs_jp",
+"_codecs_kr",
+"_codecs_tw",
+"_collections",
+"_collections_abc",
+"_compat_pickle",
+"_compression",
+"_contextvars",
+"_crypt",
+"_csv",
+"_ctypes",
+"_curses",
+"_curses_panel",
+"_datetime",
+"_dbm",
+"_decimal",
+"_elementtree",
+"_frozen_importlib",
+"_frozen_importlib_external",
+"_functools",
+"_gdbm",
+"_hashlib",
+"_heapq",
+"_imp",
+"_io",
+"_json",
+"_locale",
+"_lsprof",
+"_lzma",
+"_markupbase",
+"_md5",
+"_msi",
+"_multibytecodec",
+"_multiprocessing",
+"_opcode",
+"_operator",
+"_osx_support",
+"_overlapped",
+"_pickle",
+"_posixshmem",
+"_posixsubprocess",
+"_py_abc",
+"_pydecimal",
+"_pyio",
+"_queue",
+"_random",
+"_scproxy",
+"_sha1",
+"_sha256",
+"_sha3",
+"_sha512",
+"_signal",
+"_sitebuiltins",
+"_socket",
+"_sqlite3",
+"_sre",
+"_ssl",
+"_stat",
+"_statistics",
+"_string",
+"_strptime",
+"_struct",
+"_symtable",
+"_thread",
+"_threading_local",
+"_tkinter",
+"_tracemalloc",
+"_uuid",
+"_warnings",
+"_weakref",
+"_weakrefset",
+"_winapi",
+"_zoneinfo",
+"abc",
+"aifc",
+"antigravity",
+"argparse",
+"array",
+"ast",
+"asynchat",
+"asyncio",
+"asyncore",
+"atexit",
+"audioop",
+"base64",
+"bdb",
+"binascii",
+"binhex",
+"bisect",
+"builtins",
+"bz2",
+"cProfile",
+"calendar",
+"cgi",
+"cgitb",
+"chunk",
+"cmath",
+"cmd",
+"code",
+"codecs",
+"codeop",
+"collections",
+"colorsys",
+"compileall",
+"concurrent",
+"configparser",
+"contextlib",
+"contextvars",
+"copy",
+"copyreg",
+"crypt",
+"csv",
+"ctypes",
+"curses",
+"dataclasses",
+"datetime",
+"dbm",
+"decimal",
+"difflib",
+"dis",
+"distutils",
+"doctest",
+"email",
+"encodings",
+"ensurepip",
+"enum",
+"errno",
+"faulthandler",
+"fcntl",
+"filecmp",
+"fileinput",
+"fnmatch",
+"fractions",
+"ftplib",
+"functools",
+"gc",
+"genericpath",
+"getopt",
+"getpass",
+"gettext",
+"glob",
+"graphlib",
+"grp",
+"gzip",
+"hashlib",
+"heapq",
+"hmac",
+"html",
+"http",
+"idlelib",
+"imaplib",
+"imghdr",
+"imp",
+"importlib",
+"inspect",
+"io",
+"ipaddress",
+"itertools",
+"json",
+"keyword",
+"lib2to3",
+"linecache",
+"locale",
+"logging",
+"lzma",
+"mailbox",
+"mailcap",
+"marshal",
+"math",
+"mimetypes",
+"mmap",
+"modulefinder",
+"msilib",
+"msvcrt",
+"multiprocessing",
+"netrc",
+"nis",
+"nntplib",
+"nt",
+"ntpath",
+"nturl2path",
+"numbers",
+"opcode",
+"operator",
+"optparse",
+"os",
+"ossaudiodev",
+"pathlib",
+"pdb",
+"pickle",
+"pickletools",
+"pipes",
+"pkgutil",
+"platform",
+"plistlib",
+"poplib",
+"posix",
+"posixpath",
+"pprint",
+"profile",
+"pstats",
+"pty",
+"pwd",
+"py_compile",
+"pyclbr",
+"pydoc",
+"pydoc_data",
+"pyexpat",
+"queue",
+"quopri",
+"random",
+"re",
+"readline",
+"reprlib",
+"resource",
+"rlcompleter",
+"runpy",
+"sched",
+"secrets",
+"select",
+"selectors",
+"shelve",
+"shlex",
+"shutil",
+"signal",
+"site",
+"smtpd",
+"smtplib",
+"sndhdr",
+"socket",
+"socketserver",
+"spwd",
+"sqlite3",
+"sre_compile",
+"sre_constants",
+"sre_parse",
+"ssl",
+"stat",
+"statistics",
+"string",
+"stringprep",
+"struct",
+"subprocess",
+"sunau",
+"symtable",
+"sys",
+"sysconfig",
+"syslog",
+"tabnanny",
+"tarfile",
+"telnetlib",
+"tempfile",
+"termios",
+"textwrap",
+"this",
+"threading",
+"time",
+"timeit",
+"tkinter",
+"token",
+"tokenize",
+"trace",
+"traceback",
+"tracemalloc",
+"tty",
+"turtle",
+"turtledemo",
+"types",
+"typing",
+"unicodedata",
+"unittest",
+"urllib",
+"uu",
+"uuid",
+"venv",
+"warnings",
+"wave",
+"weakref",
+"webbrowser",
+"winreg",
+"winsound",
+"wsgiref",
+"xdrlib",
+"xml",
+"xmlrpc",
+"zipapp",
+"zipfile",
+"zipimport",
+"zlib",
+"zoneinfo",
+};
diff --git a/Python/strdup.c b/Python/strdup.c
deleted file mode 100644
index 6ce171b..0000000
--- a/Python/strdup.c
+++ /dev/null
@@ -1,12 +0,0 @@
-/* strdup() replacement (from stdwin, if you must know) */
-
-char *
-strdup(const char *str)
-{
-    if (str != NULL) {
-        char *copy = malloc(strlen(str) + 1);
-        if (copy != NULL)
-            return strcpy(copy, str);
-    }
-    return NULL;
-}
diff --git a/Python/structmember.c b/Python/structmember.c
index ba88e15..c7e3188 100644
--- a/Python/structmember.c
+++ b/Python/structmember.c
@@ -5,11 +5,11 @@
 #include "structmember.h"         // PyMemberDef
 
 PyObject *
-PyMember_GetOne(const char *addr, PyMemberDef *l)
+PyMember_GetOne(const char *obj_addr, PyMemberDef *l)
 {
     PyObject *v;
 
-    addr += l->offset;
+    const char* addr = obj_addr + l->offset;
     switch (l->type) {
     case T_BOOL:
         v = PyBool_FromLong(*(char*)addr);
@@ -69,8 +69,13 @@
         break;
     case T_OBJECT_EX:
         v = *(PyObject **)addr;
-        if (v == NULL)
-            PyErr_SetString(PyExc_AttributeError, l->name);
+        if (v == NULL) {
+            PyObject *obj = (PyObject *)obj_addr;
+            PyTypeObject *tp = Py_TYPE(obj);
+            PyErr_Format(PyExc_AttributeError,
+                         "'%.200s' object has no attribute '%s'",
+                         tp->tp_name, l->name);
+       }
         Py_XINCREF(v);
         break;
     case T_LONGLONG:
diff --git a/Python/suggestions.c b/Python/suggestions.c
new file mode 100644
index 0000000..4e2f905
--- /dev/null
+++ b/Python/suggestions.c
@@ -0,0 +1,289 @@
+#include "Python.h"
+#include "frameobject.h"
+
+#include "pycore_pyerrors.h"
+
+#define MAX_CANDIDATE_ITEMS 750
+#define MAX_STRING_SIZE 40
+
+#define MOVE_COST 2
+#define CASE_COST 1
+
+#define LEAST_FIVE_BITS(n) ((n) & 31)
+
+static inline int
+substitution_cost(char a, char b)
+{
+    if (LEAST_FIVE_BITS(a) != LEAST_FIVE_BITS(b)) {
+        // Not the same, not a case flip.
+        return MOVE_COST;
+    }
+    if (a == b) {
+        return 0;
+    }
+    if ('A' <= a && a <= 'Z') {
+        a += ('a' - 'A');
+    }
+    if ('A' <= b && b <= 'Z') {
+        b += ('a' - 'A');
+    }
+    if (a == b) {
+        return CASE_COST;
+    }
+    return MOVE_COST;
+}
+
+/* Calculate the Levenshtein distance between string1 and string2 */
+static Py_ssize_t
+levenshtein_distance(const char *a, size_t a_size,
+                     const char *b, size_t b_size,
+                     size_t max_cost)
+{
+    static size_t buffer[MAX_STRING_SIZE];
+
+    // Both strings are the same (by identity)
+    if (a == b) {
+        return 0;
+    }
+
+    // Trim away common affixes.
+    while (a_size && b_size && a[0] == b[0]) {
+        a++; a_size--;
+        b++; b_size--;
+    }
+    while (a_size && b_size && a[a_size-1] == b[b_size-1]) {
+        a_size--;
+        b_size--;
+    }
+    if (a_size == 0 || b_size == 0) {
+        return (a_size + b_size) * MOVE_COST;
+    }
+    if (a_size > MAX_STRING_SIZE || b_size > MAX_STRING_SIZE) {
+        return max_cost + 1;
+    }
+
+    // Prefer shorter buffer
+    if (b_size < a_size) {
+        const char *t = a; a = b; b = t;
+        size_t t_size = a_size; a_size = b_size; b_size = t_size;
+    }
+
+    // quick fail when a match is impossible.
+    if ((b_size - a_size) * MOVE_COST > max_cost) {
+        return max_cost + 1;
+    }
+
+    // Instead of producing the whole traditional len(a)-by-len(b)
+    // matrix, we can update just one row in place.
+    // Initialize the buffer row
+    for (size_t i = 0; i < a_size; i++) {
+        // cost from b[:0] to a[:i+1]
+        buffer[i] = (i + 1) * MOVE_COST;
+    }
+
+    size_t result = 0;
+    for (size_t b_index = 0; b_index < b_size; b_index++) {
+        char code = b[b_index];
+        // cost(b[:b_index], a[:0]) == b_index * MOVE_COST
+        size_t distance = result = b_index * MOVE_COST;
+        size_t minimum = SIZE_MAX;
+        for (size_t index = 0; index < a_size; index++) {
+
+            // cost(b[:b_index+1], a[:index+1]) = min(
+            //     // 1) substitute
+            //     cost(b[:b_index], a[:index])
+            //         + substitution_cost(b[b_index], a[index]),
+            //     // 2) delete from b
+            //     cost(b[:b_index], a[:index+1]) + MOVE_COST,
+            //     // 3) delete from a
+            //     cost(b[:b_index+1], a[index]) + MOVE_COST
+            // )
+
+            // 1) Previous distance in this row is cost(b[:b_index], a[:index])
+            size_t substitute = distance + substitution_cost(code, a[index]);
+            // 2) cost(b[:b_index], a[:index+1]) from previous row
+            distance = buffer[index];
+            // 3) existing result is cost(b[:b_index+1], a[index])
+
+            size_t insert_delete = Py_MIN(result, distance) + MOVE_COST;
+            result = Py_MIN(insert_delete, substitute);
+
+            // cost(b[:b_index+1], a[:index+1])
+            buffer[index] = result;
+            if (result < minimum) {
+                minimum = result;
+            }
+        }
+        if (minimum > max_cost) {
+            // Everything in this row is too big, so bail early.
+            return max_cost + 1;
+        }
+    }
+    return result;
+}
+
+static inline PyObject *
+calculate_suggestions(PyObject *dir,
+                      PyObject *name)
+{
+    assert(!PyErr_Occurred());
+    assert(PyList_CheckExact(dir));
+
+    Py_ssize_t dir_size = PyList_GET_SIZE(dir);
+    if (dir_size >= MAX_CANDIDATE_ITEMS) {
+        return NULL;
+    }
+
+    Py_ssize_t suggestion_distance = PY_SSIZE_T_MAX;
+    PyObject *suggestion = NULL;
+    Py_ssize_t name_size;
+    const char *name_str = PyUnicode_AsUTF8AndSize(name, &name_size);
+    if (name_str == NULL) {
+        return NULL;
+    }
+
+    for (int i = 0; i < dir_size; ++i) {
+        PyObject *item = PyList_GET_ITEM(dir, i);
+        Py_ssize_t item_size;
+        const char *item_str = PyUnicode_AsUTF8AndSize(item, &item_size);
+        if (item_str == NULL) {
+            return NULL;
+        }
+        if (PyUnicode_CompareWithASCIIString(name, item_str) == 0) {
+            continue;
+        }
+        // No more than 1/3 of the involved characters should need changed.
+        Py_ssize_t max_distance = (name_size + item_size + 3) * MOVE_COST / 6;
+        // Don't take matches we've already beaten.
+        max_distance = Py_MIN(max_distance, suggestion_distance - 1);
+        Py_ssize_t current_distance =
+            levenshtein_distance(name_str, name_size,
+                                 item_str, item_size, max_distance);
+        if (current_distance > max_distance) {
+            continue;
+        }
+        if (!suggestion || current_distance < suggestion_distance) {
+            suggestion = item;
+            suggestion_distance = current_distance;
+        }
+    }
+    Py_XINCREF(suggestion);
+    return suggestion;
+}
+
+static PyObject *
+offer_suggestions_for_attribute_error(PyAttributeErrorObject *exc)
+{
+    PyObject *name = exc->name; // borrowed reference
+    PyObject *obj = exc->obj; // borrowed reference
+
+    // Abort if we don't have an attribute name or we have an invalid one
+    if (name == NULL || obj == NULL || !PyUnicode_CheckExact(name)) {
+        return NULL;
+    }
+
+    PyObject *dir = PyObject_Dir(obj);
+    if (dir == NULL) {
+        return NULL;
+    }
+
+    PyObject *suggestions = calculate_suggestions(dir, name);
+    Py_DECREF(dir);
+    return suggestions;
+}
+
+
+static PyObject *
+offer_suggestions_for_name_error(PyNameErrorObject *exc)
+{
+    PyObject *name = exc->name; // borrowed reference
+    PyTracebackObject *traceback = (PyTracebackObject *) exc->traceback; // borrowed reference
+    // Abort if we don't have a variable name or we have an invalid one
+    // or if we don't have a traceback to work with
+    if (name == NULL || !PyUnicode_CheckExact(name) ||
+        traceback == NULL || !Py_IS_TYPE(traceback, &PyTraceBack_Type)
+    ) {
+        return NULL;
+    }
+
+    // Move to the traceback of the exception
+    while (1) {
+        PyTracebackObject *next = traceback->tb_next;
+        if (next == NULL || !Py_IS_TYPE(next, &PyTraceBack_Type)) {
+            break;
+        }
+        else {
+            traceback = next;
+        }
+    }
+
+    PyFrameObject *frame = traceback->tb_frame;
+    assert(frame != NULL);
+    PyCodeObject *code = frame->f_code;
+    assert(code != NULL && code->co_varnames != NULL);
+    PyObject *dir = PySequence_List(code->co_varnames);
+    if (dir == NULL) {
+        return NULL;
+    }
+
+    PyObject *suggestions = calculate_suggestions(dir, name);
+    Py_DECREF(dir);
+    if (suggestions != NULL) {
+        return suggestions;
+    }
+
+    dir = PySequence_List(frame->f_globals);
+    if (dir == NULL) {
+        return NULL;
+    }
+    suggestions = calculate_suggestions(dir, name);
+    Py_DECREF(dir);
+    if (suggestions != NULL) {
+        return suggestions;
+    }
+
+    dir = PySequence_List(frame->f_builtins);
+    if (dir == NULL) {
+        return NULL;
+    }
+    suggestions = calculate_suggestions(dir, name);
+    Py_DECREF(dir);
+
+    return suggestions;
+}
+
+// Offer suggestions for a given exception. Returns a python string object containing the
+// suggestions. This function returns NULL if no suggestion was found or if an exception happened,
+// users must call PyErr_Occurred() to disambiguate.
+PyObject *
+_Py_Offer_Suggestions(PyObject *exception)
+{
+    PyObject *result = NULL;
+    assert(!PyErr_Occurred());
+    if (Py_IS_TYPE(exception, (PyTypeObject*)PyExc_AttributeError)) {
+        result = offer_suggestions_for_attribute_error((PyAttributeErrorObject *) exception);
+    } else if (Py_IS_TYPE(exception, (PyTypeObject*)PyExc_NameError)) {
+        result = offer_suggestions_for_name_error((PyNameErrorObject *) exception);
+    }
+    return result;
+}
+
+Py_ssize_t
+_Py_UTF8_Edit_Cost(PyObject *a, PyObject *b, Py_ssize_t max_cost)
+{
+    assert(PyUnicode_Check(a) && PyUnicode_Check(b));
+    Py_ssize_t size_a, size_b;
+    const char *utf8_a = PyUnicode_AsUTF8AndSize(a, &size_a);
+    if (utf8_a == NULL) {
+        return -1;
+    }
+    const char *utf8_b = PyUnicode_AsUTF8AndSize(b, &size_b);
+    if (utf8_b == NULL) {
+        return -1;
+    }
+    if (max_cost == -1) {
+        max_cost = MOVE_COST * Py_MAX(size_a, size_b);
+    }
+    return levenshtein_distance(utf8_a, size_a, utf8_b, size_b, max_cost);
+}
+
diff --git a/Python/symtable.c b/Python/symtable.c
index d192f31..07f9d11 100644
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -1,7 +1,9 @@
 #include "Python.h"
-#include "pycore_pystate.h"   // _PyThreadState_GET()
-#include "symtable.h"
-#undef Yield   /* undefine macro conflicting with <winbase.h> */
+#include "pycore_ast.h"           // identifier, stmt_ty
+#include "pycore_compile.h"       // _Py_Mangle(), _PyFuture_FromAST()
+#include "pycore_parser.h"        // _PyParser_ASTFromString()
+#include "pycore_pystate.h"       // _PyThreadState_GET()
+#include "pycore_symtable.h"      // PySTEntryObject
 #include "structmember.h"         // PyMemberDef
 
 /* error strings used for warnings */
@@ -43,9 +45,20 @@
 #define NAMED_EXPR_COMP_ITER_EXPR \
 "assignment expression cannot be used in a comprehension iterable expression"
 
+#define ANNOTATION_NOT_ALLOWED \
+"'%s' can not be used within an annotation"
+
+
+#define LOCATION(x) \
+ (x)->lineno, (x)->col_offset, (x)->end_lineno, (x)->end_col_offset
+
+#define ST_LOCATION(x) \
+ (x)->ste_lineno, (x)->ste_col_offset, (x)->ste_end_lineno, (x)->ste_end_col_offset
+
 static PySTEntryObject *
 ste_new(struct symtable *st, identifier name, _Py_block_ty block,
-        void *key, int lineno, int col_offset)
+        void *key, int lineno, int col_offset,
+        int end_lineno, int end_col_offset)
 {
     PySTEntryObject *ste = NULL;
     PyObject *k = NULL;
@@ -79,6 +92,8 @@
     ste->ste_opt_col_offset = 0;
     ste->ste_lineno = lineno;
     ste->ste_col_offset = col_offset;
+    ste->ste_end_lineno = end_lineno;
+    ste->ste_end_col_offset = end_col_offset;
 
     if (st->st_cur != NULL &&
         (st->st_cur->ste_nested ||
@@ -87,7 +102,7 @@
     ste->ste_child_free = 0;
     ste->ste_generator = 0;
     ste->ste_coroutine = 0;
-    ste->ste_comprehension = 0;
+    ste->ste_comprehension = NoComprehension;
     ste->ste_returns_value = 0;
     ste->ste_needs_class_closure = 0;
     ste->ste_comp_iter_target = 0;
@@ -128,7 +143,7 @@
     Py_XDECREF(ste->ste_varnames);
     Py_XDECREF(ste->ste_children);
     Py_XDECREF(ste->ste_directives);
-    PyObject_Del(ste);
+    PyObject_Free(ste);
 }
 
 #define OFF(x) offsetof(PySTEntryObject, x)
@@ -188,8 +203,9 @@
 
 static int symtable_analyze(struct symtable *st);
 static int symtable_enter_block(struct symtable *st, identifier name,
-                                _Py_block_ty block, void *ast, int lineno,
-                                int col_offset);
+                                _Py_block_ty block, void *ast,
+                                int lineno, int col_offset,
+                                int end_lineno, int end_col_offset);
 static int symtable_exit_block(struct symtable *st);
 static int symtable_visit_stmt(struct symtable *st, stmt_ty s);
 static int symtable_visit_expr(struct symtable *st, expr_ty s);
@@ -202,16 +218,21 @@
 static int symtable_visit_alias(struct symtable *st, alias_ty);
 static int symtable_visit_comprehension(struct symtable *st, comprehension_ty);
 static int symtable_visit_keyword(struct symtable *st, keyword_ty);
-static int symtable_visit_params(struct symtable *st, asdl_seq *args);
-static int symtable_visit_argannotations(struct symtable *st, asdl_seq *args);
+static int symtable_visit_params(struct symtable *st, asdl_arg_seq *args);
+static int symtable_visit_annotation(struct symtable *st, expr_ty annotation);
+static int symtable_visit_argannotations(struct symtable *st, asdl_arg_seq *args);
 static int symtable_implicit_arg(struct symtable *st, int pos);
-static int symtable_visit_annotations(struct symtable *st, arguments_ty, expr_ty);
+static int symtable_visit_annotations(struct symtable *st, stmt_ty, arguments_ty, expr_ty);
 static int symtable_visit_withitem(struct symtable *st, withitem_ty item);
+static int symtable_visit_match_case(struct symtable *st, match_case_ty m);
+static int symtable_visit_pattern(struct symtable *st, pattern_ty s);
+static int symtable_raise_if_annotation_block(struct symtable *st, const char *, expr_ty);
+static int symtable_raise_if_comprehension_block(struct symtable *st, expr_ty);
 
 
 static identifier top = NULL, lambda = NULL, genexpr = NULL,
     listcomp = NULL, setcomp = NULL, dictcomp = NULL,
-    __class__ = NULL;
+    __class__ = NULL, _annotation = NULL;
 
 #define GET_IDENTIFIER(VAR) \
     ((VAR) ? (VAR) : ((VAR) = PyUnicode_InternFromString(# VAR)))
@@ -241,7 +262,7 @@
     st->st_private = NULL;
     return st;
  fail:
-    PySymtable_Free(st);
+    _PySymtable_Free(st);
     return NULL;
 }
 
@@ -258,10 +279,10 @@
 #define COMPILER_STACK_FRAME_SCALE 3
 
 struct symtable *
-PySymtable_BuildObject(mod_ty mod, PyObject *filename, PyFutureFeatures *future)
+_PySymtable_Build(mod_ty mod, PyObject *filename, PyFutureFeatures *future)
 {
     struct symtable *st = symtable_new();
-    asdl_seq *seq;
+    asdl_stmt_seq *seq;
     int i;
     PyThreadState *tstate;
     int recursion_limit = Py_GetRecursionLimit();
@@ -270,7 +291,7 @@
     if (st == NULL)
         return NULL;
     if (filename == NULL) {
-        PySymtable_Free(st);
+        _PySymtable_Free(st);
         return NULL;
     }
     Py_INCREF(filename);
@@ -280,7 +301,7 @@
     /* Setup recursion depth check counters */
     tstate = _PyThreadState_GET();
     if (!tstate) {
-        PySymtable_Free(st);
+        _PySymtable_Free(st);
         return NULL;
     }
     /* Be careful here to prevent overflow. */
@@ -292,8 +313,8 @@
 
     /* Make the initial symbol information gathering pass */
     if (!GET_IDENTIFIER(top) ||
-        !symtable_enter_block(st, top, ModuleBlock, (void *)mod, 0, 0)) {
-        PySymtable_Free(st);
+        !symtable_enter_block(st, top, ModuleBlock, (void *)mod, 0, 0, 0, 0)) {
+        _PySymtable_Free(st);
         return NULL;
     }
 
@@ -323,7 +344,7 @@
         goto error;
     }
     if (!symtable_exit_block(st)) {
-        PySymtable_Free(st);
+        _PySymtable_Free(st);
         return NULL;
     }
     /* Check that the recursion depth counting balanced correctly */
@@ -331,35 +352,23 @@
         PyErr_Format(PyExc_SystemError,
             "symtable analysis recursion depth mismatch (before=%d, after=%d)",
             starting_recursion_depth, st->recursion_depth);
-        PySymtable_Free(st);
+        _PySymtable_Free(st);
         return NULL;
     }
     /* Make the second symbol analysis pass */
     if (symtable_analyze(st))
         return st;
-    PySymtable_Free(st);
+    _PySymtable_Free(st);
     return NULL;
  error:
     (void) symtable_exit_block(st);
-    PySymtable_Free(st);
+    _PySymtable_Free(st);
     return NULL;
 }
 
-struct symtable *
-PySymtable_Build(mod_ty mod, const char *filename_str, PyFutureFeatures *future)
-{
-    PyObject *filename;
-    struct symtable *st;
-    filename = PyUnicode_DecodeFSDefault(filename_str);
-    if (filename == NULL)
-        return NULL;
-    st = PySymtable_BuildObject(mod, filename, future);
-    Py_DECREF(filename);
-    return st;
-}
 
 void
-PySymtable_Free(struct symtable *st)
+_PySymtable_Free(struct symtable *st)
 {
     Py_XDECREF(st->st_filename);
     Py_XDECREF(st->st_blocks);
@@ -392,7 +401,7 @@
 static long
 _PyST_GetSymbol(PySTEntryObject *ste, PyObject *name)
 {
-    PyObject *v = PyDict_GetItem(ste->ste_symbols, name);
+    PyObject *v = PyDict_GetItemWithError(ste->ste_symbols, name);
     if (!v)
         return 0;
     assert(PyLong_Check(v));
@@ -400,7 +409,7 @@
 }
 
 int
-PyST_GetScope(PySTEntryObject *ste, PyObject *name)
+_PyST_GetScope(PySTEntryObject *ste, PyObject *name)
 {
     long symbol = _PyST_GetSymbol(ste, name);
     return (symbol >> SCOPE_OFFSET) & SCOPE_MASK;
@@ -417,9 +426,11 @@
         assert(PyTuple_CheckExact(data));
         assert(PyUnicode_CheckExact(PyTuple_GET_ITEM(data, 0)));
         if (PyUnicode_Compare(PyTuple_GET_ITEM(data, 0), name) == 0) {
-            PyErr_SyntaxLocationObject(ste->ste_table->st_filename,
-                                       PyLong_AsLong(PyTuple_GET_ITEM(data, 1)),
-                                       PyLong_AsLong(PyTuple_GET_ITEM(data, 2)) + 1);
+            PyErr_RangedSyntaxLocationObject(ste->ste_table->st_filename,
+                                             PyLong_AsLong(PyTuple_GET_ITEM(data, 1)),
+                                             PyLong_AsLong(PyTuple_GET_ITEM(data, 2)) + 1,
+                                             PyLong_AsLong(PyTuple_GET_ITEM(data, 3)),
+                                             PyLong_AsLong(PyTuple_GET_ITEM(data, 4)) + 1);
 
             return 0;
         }
@@ -634,7 +645,7 @@
         long scope, flags;
         assert(PyLong_Check(v));
         flags = PyLong_AS_LONG(v);
-        v_scope = PyDict_GetItem(scopes, name);
+        v_scope = PyDict_GetItemWithError(scopes, name);
         assert(v_scope && PyLong_Check(v_scope));
         scope = PyLong_AS_LONG(v_scope);
         flags |= (scope << SCOPE_OFFSET);
@@ -966,11 +977,12 @@
 
 static int
 symtable_enter_block(struct symtable *st, identifier name, _Py_block_ty block,
-                     void *ast, int lineno, int col_offset)
+                     void *ast, int lineno, int col_offset,
+                     int end_lineno, int end_col_offset)
 {
     PySTEntryObject *prev = NULL, *ste;
 
-    ste = ste_new(st, name, block, ast, lineno, col_offset);
+    ste = ste_new(st, name, block, ast, lineno, col_offset, end_lineno, end_col_offset);
     if (ste == NULL)
         return 0;
     if (PyList_Append(st->st_stack, (PyObject *)ste) < 0) {
@@ -988,8 +1000,17 @@
     /* The entry is owned by the stack. Borrow it for st_cur. */
     Py_DECREF(ste);
     st->st_cur = ste;
+
+    /* Annotation blocks shouldn't have any affect on the symbol table since in
+     * the compilation stage, they will all be transformed to strings. They are
+     * only created if future 'annotations' feature is activated. */
+    if (block == AnnotationBlock) {
+        return 1;
+    }
+
     if (block == ModuleBlock)
         st->st_global = st->st_cur->ste_symbols;
+
     if (prev) {
         if (PyList_Append(prev->ste_children, (PyObject *)ste) < 0) {
             return 0;
@@ -1010,7 +1031,8 @@
 }
 
 static int
-symtable_add_def_helper(struct symtable *st, PyObject *name, int flag, struct _symtable_entry *ste)
+symtable_add_def_helper(struct symtable *st, PyObject *name, int flag, struct _symtable_entry *ste,
+                        int lineno, int col_offset, int end_lineno, int end_col_offset)
 {
     PyObject *o;
     PyObject *dict;
@@ -1026,9 +1048,9 @@
         if ((flag & DEF_PARAM) && (val & DEF_PARAM)) {
             /* Is it better to use 'mangled' or 'name' here? */
             PyErr_Format(PyExc_SyntaxError, DUPLICATE_ARGUMENT, name);
-            PyErr_SyntaxLocationObject(st->st_filename,
-                                       ste->ste_lineno,
-                                       ste->ste_col_offset + 1);
+            PyErr_RangedSyntaxLocationObject(st->st_filename,
+                                             lineno, col_offset + 1,
+                                             end_lineno, end_col_offset + 1);
             goto error;
         }
         val |= flag;
@@ -1048,9 +1070,9 @@
         if (val & (DEF_GLOBAL | DEF_NONLOCAL)) {
             PyErr_Format(PyExc_SyntaxError,
                 NAMED_EXPR_COMP_INNER_LOOP_CONFLICT, name);
-            PyErr_SyntaxLocationObject(st->st_filename,
-                                       ste->ste_lineno,
-                                       ste->ste_col_offset + 1);
+            PyErr_RangedSyntaxLocationObject(st->st_filename,
+                                             lineno, col_offset + 1,
+                                             end_lineno, end_col_offset + 1);
             goto error;
         }
         val |= DEF_COMP_ITER;
@@ -1071,9 +1093,12 @@
         /* XXX need to update DEF_GLOBAL for other flags too;
            perhaps only DEF_FREE_GLOBAL */
         val = flag;
-        if ((o = PyDict_GetItem(st->st_global, mangled))) {
+        if ((o = PyDict_GetItemWithError(st->st_global, mangled))) {
             val |= PyLong_AS_LONG(o);
         }
+        else if (PyErr_Occurred()) {
+            goto error;
+        }
         o = PyLong_FromLong(val);
         if (o == NULL)
             goto error;
@@ -1092,8 +1117,11 @@
 }
 
 static int
-symtable_add_def(struct symtable *st, PyObject *name, int flag) {
-    return symtable_add_def_helper(st, name, flag, st->st_cur);
+symtable_add_def(struct symtable *st, PyObject *name, int flag,
+                 int lineno, int col_offset, int end_lineno, int end_col_offset)
+{
+    return symtable_add_def_helper(st, name, flag, st->st_cur, 
+                        lineno, col_offset, end_lineno, end_col_offset);
 }
 
 /* VISIT, VISIT_SEQ and VIST_SEQ_TAIL take an ASDL type as their second argument.
@@ -1116,7 +1144,7 @@
 
 #define VISIT_SEQ(ST, TYPE, SEQ) { \
     int i; \
-    asdl_seq *seq = (SEQ); /* avoid variable capture */ \
+    asdl_ ## TYPE ## _seq *seq = (SEQ); /* avoid variable capture */ \
     for (i = 0; i < asdl_seq_LEN(seq); i++) { \
         TYPE ## _ty elt = (TYPE ## _ty)asdl_seq_GET(seq, i); \
         if (!symtable_visit_ ## TYPE((ST), elt)) \
@@ -1126,7 +1154,7 @@
 
 #define VISIT_SEQ_TAIL(ST, TYPE, SEQ, START) { \
     int i; \
-    asdl_seq *seq = (SEQ); /* avoid variable capture */ \
+    asdl_ ## TYPE ## _seq *seq = (SEQ); /* avoid variable capture */ \
     for (i = (START); i < asdl_seq_LEN(seq); i++) { \
         TYPE ## _ty elt = (TYPE ## _ty)asdl_seq_GET(seq, i); \
         if (!symtable_visit_ ## TYPE((ST), elt)) \
@@ -1136,7 +1164,7 @@
 
 #define VISIT_SEQ_WITH_NULL(ST, TYPE, SEQ) {     \
     int i = 0; \
-    asdl_seq *seq = (SEQ); /* avoid variable capture */ \
+    asdl_ ## TYPE ## _seq *seq = (SEQ); /* avoid variable capture */ \
     for (i = 0; i < asdl_seq_LEN(seq); i++) { \
         TYPE ## _ty elt = (TYPE ## _ty)asdl_seq_GET(seq, i); \
         if (!elt) continue; /* can be NULL */ \
@@ -1146,7 +1174,8 @@
 }
 
 static int
-symtable_record_directive(struct symtable *st, identifier name, int lineno, int col_offset)
+symtable_record_directive(struct symtable *st, identifier name, int lineno,
+                          int col_offset, int end_lineno, int end_col_offset)
 {
     PyObject *data, *mangled;
     int res;
@@ -1158,7 +1187,7 @@
     mangled = _Py_Mangle(st->st_private, name);
     if (!mangled)
         return 0;
-    data = Py_BuildValue("(Nii)", mangled, lineno, col_offset);
+    data = Py_BuildValue("(Niiii)", mangled, lineno, col_offset, end_lineno, end_col_offset);
     if (!data)
         return 0;
     res = PyList_Append(st->st_cur->ste_directives, data);
@@ -1177,20 +1206,20 @@
     }
     switch (s->kind) {
     case FunctionDef_kind:
-        if (!symtable_add_def(st, s->v.FunctionDef.name, DEF_LOCAL))
+        if (!symtable_add_def(st, s->v.FunctionDef.name, DEF_LOCAL, LOCATION(s)))
             VISIT_QUIT(st, 0);
         if (s->v.FunctionDef.args->defaults)
             VISIT_SEQ(st, expr, s->v.FunctionDef.args->defaults);
         if (s->v.FunctionDef.args->kw_defaults)
             VISIT_SEQ_WITH_NULL(st, expr, s->v.FunctionDef.args->kw_defaults);
-        if (!symtable_visit_annotations(st, s->v.FunctionDef.args,
+        if (!symtable_visit_annotations(st, s, s->v.FunctionDef.args,
                                         s->v.FunctionDef.returns))
             VISIT_QUIT(st, 0);
         if (s->v.FunctionDef.decorator_list)
             VISIT_SEQ(st, expr, s->v.FunctionDef.decorator_list);
         if (!symtable_enter_block(st, s->v.FunctionDef.name,
-                                  FunctionBlock, (void *)s, s->lineno,
-                                  s->col_offset))
+                                  FunctionBlock, (void *)s,
+                                  LOCATION(s)))
             VISIT_QUIT(st, 0);
         VISIT(st, arguments, s->v.FunctionDef.args);
         VISIT_SEQ(st, stmt, s->v.FunctionDef.body);
@@ -1199,14 +1228,15 @@
         break;
     case ClassDef_kind: {
         PyObject *tmp;
-        if (!symtable_add_def(st, s->v.ClassDef.name, DEF_LOCAL))
+        if (!symtable_add_def(st, s->v.ClassDef.name, DEF_LOCAL, LOCATION(s)))
             VISIT_QUIT(st, 0);
         VISIT_SEQ(st, expr, s->v.ClassDef.bases);
         VISIT_SEQ(st, keyword, s->v.ClassDef.keywords);
         if (s->v.ClassDef.decorator_list)
             VISIT_SEQ(st, expr, s->v.ClassDef.decorator_list);
         if (!symtable_enter_block(st, s->v.ClassDef.name, ClassBlock,
-                                  (void *)s, s->lineno, s->col_offset))
+                                  (void *)s, s->lineno, s->col_offset,
+                                  s->end_lineno, s->end_col_offset))
             VISIT_QUIT(st, 0);
         tmp = st->st_private;
         st->st_private = s->v.ClassDef.name;
@@ -1242,19 +1272,21 @@
                 PyErr_Format(PyExc_SyntaxError,
                              cur & DEF_GLOBAL ? GLOBAL_ANNOT : NONLOCAL_ANNOT,
                              e_name->v.Name.id);
-                PyErr_SyntaxLocationObject(st->st_filename,
-                                           s->lineno,
-                                           s->col_offset + 1);
+                PyErr_RangedSyntaxLocationObject(st->st_filename,
+                                                 s->lineno,
+                                                 s->col_offset + 1,
+                                                 s->end_lineno,
+                                                 s->end_col_offset + 1);
                 VISIT_QUIT(st, 0);
             }
             if (s->v.AnnAssign.simple &&
                 !symtable_add_def(st, e_name->v.Name.id,
-                                  DEF_ANNOT | DEF_LOCAL)) {
+                                  DEF_ANNOT | DEF_LOCAL, LOCATION(e_name))) {
                 VISIT_QUIT(st, 0);
             }
             else {
                 if (s->v.AnnAssign.value
-                    && !symtable_add_def(st, e_name->v.Name.id, DEF_LOCAL)) {
+                    && !symtable_add_def(st, e_name->v.Name.id, DEF_LOCAL, LOCATION(e_name))) {
                     VISIT_QUIT(st, 0);
                 }
             }
@@ -1262,7 +1294,10 @@
         else {
             VISIT(st, expr, s->v.AnnAssign.target);
         }
-        VISIT(st, expr, s->v.AnnAssign.annotation);
+        if (!symtable_visit_annotation(st, s->v.AnnAssign.annotation)) {
+            VISIT_QUIT(st, 0);
+        }
+
         if (s->v.AnnAssign.value) {
             VISIT(st, expr, s->v.AnnAssign.value);
         }
@@ -1291,6 +1326,10 @@
         if (s->v.If.orelse)
             VISIT_SEQ(st, stmt, s->v.If.orelse);
         break;
+    case Match_kind:
+        VISIT(st, expr, s->v.Match.subject);
+        VISIT_SEQ(st, match_case, s->v.Match.cases);
+        break;
     case Raise_kind:
         if (s->v.Raise.exc) {
             VISIT(st, expr, s->v.Raise.exc);
@@ -1318,7 +1357,7 @@
         break;
     case Global_kind: {
         int i;
-        asdl_seq *seq = s->v.Global.names;
+        asdl_identifier_seq *seq = s->v.Global.names;
         for (i = 0; i < asdl_seq_LEN(seq); i++) {
             identifier name = (identifier)asdl_seq_GET(seq, i);
             long cur = symtable_lookup(st, name);
@@ -1337,21 +1376,24 @@
                 }
                 PyErr_Format(PyExc_SyntaxError,
                              msg, name);
-                PyErr_SyntaxLocationObject(st->st_filename,
-                                           s->lineno,
-                                           s->col_offset + 1);
+                PyErr_RangedSyntaxLocationObject(st->st_filename,
+                                                 s->lineno,
+                                                 s->col_offset + 1,
+                                                 s->end_lineno,
+                                                 s->end_col_offset + 1);
                 VISIT_QUIT(st, 0);
             }
-            if (!symtable_add_def(st, name, DEF_GLOBAL))
+            if (!symtable_add_def(st, name, DEF_GLOBAL, LOCATION(s)))
                 VISIT_QUIT(st, 0);
-            if (!symtable_record_directive(st, name, s->lineno, s->col_offset))
+            if (!symtable_record_directive(st, name, s->lineno, s->col_offset,
+                                           s->end_lineno, s->end_col_offset))
                 VISIT_QUIT(st, 0);
         }
         break;
     }
     case Nonlocal_kind: {
         int i;
-        asdl_seq *seq = s->v.Nonlocal.names;
+        asdl_identifier_seq *seq = s->v.Nonlocal.names;
         for (i = 0; i < asdl_seq_LEN(seq); i++) {
             identifier name = (identifier)asdl_seq_GET(seq, i);
             long cur = symtable_lookup(st, name);
@@ -1369,14 +1411,17 @@
                     msg = NONLOCAL_AFTER_ASSIGN;
                 }
                 PyErr_Format(PyExc_SyntaxError, msg, name);
-                PyErr_SyntaxLocationObject(st->st_filename,
-                                           s->lineno,
-                                           s->col_offset + 1);
+                PyErr_RangedSyntaxLocationObject(st->st_filename,
+                                                 s->lineno,
+                                                 s->col_offset + 1,
+                                                 s->end_lineno,
+                                                 s->end_col_offset + 1);
                 VISIT_QUIT(st, 0);
             }
-            if (!symtable_add_def(st, name, DEF_NONLOCAL))
+            if (!symtable_add_def(st, name, DEF_NONLOCAL, LOCATION(s)))
                 VISIT_QUIT(st, 0);
-            if (!symtable_record_directive(st, name, s->lineno, s->col_offset))
+            if (!symtable_record_directive(st, name, s->lineno, s->col_offset,
+                                           s->end_lineno, s->end_col_offset))
                 VISIT_QUIT(st, 0);
         }
         break;
@@ -1394,21 +1439,22 @@
         VISIT_SEQ(st, stmt, s->v.With.body);
         break;
     case AsyncFunctionDef_kind:
-        if (!symtable_add_def(st, s->v.AsyncFunctionDef.name, DEF_LOCAL))
+        if (!symtable_add_def(st, s->v.AsyncFunctionDef.name, DEF_LOCAL, LOCATION(s)))
             VISIT_QUIT(st, 0);
         if (s->v.AsyncFunctionDef.args->defaults)
             VISIT_SEQ(st, expr, s->v.AsyncFunctionDef.args->defaults);
         if (s->v.AsyncFunctionDef.args->kw_defaults)
             VISIT_SEQ_WITH_NULL(st, expr,
                                 s->v.AsyncFunctionDef.args->kw_defaults);
-        if (!symtable_visit_annotations(st, s->v.AsyncFunctionDef.args,
+        if (!symtable_visit_annotations(st, s, s->v.AsyncFunctionDef.args,
                                         s->v.AsyncFunctionDef.returns))
             VISIT_QUIT(st, 0);
         if (s->v.AsyncFunctionDef.decorator_list)
             VISIT_SEQ(st, expr, s->v.AsyncFunctionDef.decorator_list);
         if (!symtable_enter_block(st, s->v.AsyncFunctionDef.name,
-                                  FunctionBlock, (void *)s, s->lineno,
-                                  s->col_offset))
+                                  FunctionBlock, (void *)s,
+                                  s->lineno, s->col_offset,
+                                  s->end_lineno, s->end_col_offset))
             VISIT_QUIT(st, 0);
         st->st_cur->ste_coroutine = 1;
         VISIT(st, arguments, s->v.AsyncFunctionDef.args);
@@ -1454,9 +1500,11 @@
             long target_in_scope = _PyST_GetSymbol(ste, target_name);
             if (target_in_scope & DEF_COMP_ITER) {
                 PyErr_Format(PyExc_SyntaxError, NAMED_EXPR_COMP_CONFLICT, target_name);
-                PyErr_SyntaxLocationObject(st->st_filename,
-                                            e->lineno,
-                                            e->col_offset);
+                PyErr_RangedSyntaxLocationObject(st->st_filename,
+                                                  e->lineno,
+                                                  e->col_offset + 1,
+                                                  e->end_lineno,
+                                                  e->end_col_offset + 1);
                 VISIT_QUIT(st, 0);
             }
             continue;
@@ -1466,32 +1514,34 @@
         if (ste->ste_type == FunctionBlock) {
             long target_in_scope = _PyST_GetSymbol(ste, target_name);
             if (target_in_scope & DEF_GLOBAL) {
-                if (!symtable_add_def(st, target_name, DEF_GLOBAL))
+                if (!symtable_add_def(st, target_name, DEF_GLOBAL, LOCATION(e)))
                     VISIT_QUIT(st, 0);
             } else {
-                if (!symtable_add_def(st, target_name, DEF_NONLOCAL))
+                if (!symtable_add_def(st, target_name, DEF_NONLOCAL, LOCATION(e)))
                     VISIT_QUIT(st, 0);
             }
-            if (!symtable_record_directive(st, target_name, e->lineno, e->col_offset))
+            if (!symtable_record_directive(st, target_name, LOCATION(e)))
                 VISIT_QUIT(st, 0);
 
-            return symtable_add_def_helper(st, target_name, DEF_LOCAL, ste);
+            return symtable_add_def_helper(st, target_name, DEF_LOCAL, ste, LOCATION(e));
         }
         /* If we find a ModuleBlock entry, add as GLOBAL */
         if (ste->ste_type == ModuleBlock) {
-            if (!symtable_add_def(st, target_name, DEF_GLOBAL))
+            if (!symtable_add_def(st, target_name, DEF_GLOBAL, LOCATION(e)))
                 VISIT_QUIT(st, 0);
-            if (!symtable_record_directive(st, target_name, e->lineno, e->col_offset))
+            if (!symtable_record_directive(st, target_name, LOCATION(e)))
                 VISIT_QUIT(st, 0);
 
-            return symtable_add_def_helper(st, target_name, DEF_GLOBAL, ste);
+            return symtable_add_def_helper(st, target_name, DEF_GLOBAL, ste, LOCATION(e));
         }
         /* Disallow usage in ClassBlock */
         if (ste->ste_type == ClassBlock) {
             PyErr_Format(PyExc_SyntaxError, NAMED_EXPR_COMP_IN_CLASS);
-            PyErr_SyntaxLocationObject(st->st_filename,
-                                        e->lineno,
-                                        e->col_offset);
+            PyErr_RangedSyntaxLocationObject(st->st_filename,
+                                              e->lineno,
+                                              e->col_offset + 1,
+                                              e->end_lineno,
+                                              e->end_col_offset + 1);
             VISIT_QUIT(st, 0);
         }
     }
@@ -1509,9 +1559,11 @@
     if (st->st_cur->ste_comp_iter_expr > 0) {
         /* Assignment isn't allowed in a comprehension iterable expression */
         PyErr_Format(PyExc_SyntaxError, NAMED_EXPR_COMP_ITER_EXPR);
-        PyErr_SyntaxLocationObject(st->st_filename,
-                                    e->lineno,
-                                    e->col_offset);
+        PyErr_RangedSyntaxLocationObject(st->st_filename,
+                                          e->lineno,
+                                          e->col_offset + 1,
+                                          e->end_lineno,
+                                          e->end_col_offset + 1);
         return 0;
     }
     if (st->st_cur->ste_comprehension) {
@@ -1534,6 +1586,9 @@
     }
     switch (e->kind) {
     case NamedExpr_kind:
+        if (!symtable_raise_if_annotation_block(st, "named expression", e)) {
+            VISIT_QUIT(st, 0);
+        }
         if(!symtable_handle_namedexpr(st, e))
             VISIT_QUIT(st, 0);
         break;
@@ -1555,8 +1610,9 @@
         if (e->v.Lambda.args->kw_defaults)
             VISIT_SEQ_WITH_NULL(st, expr, e->v.Lambda.args->kw_defaults);
         if (!symtable_enter_block(st, lambda,
-                                  FunctionBlock, (void *)e, e->lineno,
-                                  e->col_offset))
+                                  FunctionBlock, (void *)e,
+                                  e->lineno, e->col_offset,
+                                  e->end_lineno, e->end_col_offset))
             VISIT_QUIT(st, 0);
         VISIT(st, arguments, e->v.Lambda.args);
         VISIT(st, expr, e->v.Lambda.body);
@@ -1593,15 +1649,30 @@
             VISIT_QUIT(st, 0);
         break;
     case Yield_kind:
+        if (!symtable_raise_if_annotation_block(st, "yield expression", e)) {
+            VISIT_QUIT(st, 0);
+        }
         if (e->v.Yield.value)
             VISIT(st, expr, e->v.Yield.value);
         st->st_cur->ste_generator = 1;
+        if (st->st_cur->ste_comprehension) {
+            return symtable_raise_if_comprehension_block(st, e);
+        }
         break;
     case YieldFrom_kind:
+        if (!symtable_raise_if_annotation_block(st, "yield expression", e)) {
+            VISIT_QUIT(st, 0);
+        }
         VISIT(st, expr, e->v.YieldFrom.value);
         st->st_cur->ste_generator = 1;
+        if (st->st_cur->ste_comprehension) {
+            return symtable_raise_if_comprehension_block(st, e);
+        }
         break;
     case Await_kind:
+        if (!symtable_raise_if_annotation_block(st, "await expression", e)) {
+            VISIT_QUIT(st, 0);
+        }
         VISIT(st, expr, e->v.Await.value);
         st->st_cur->ste_coroutine = 1;
         break;
@@ -1646,14 +1717,14 @@
         break;
     case Name_kind:
         if (!symtable_add_def(st, e->v.Name.id,
-                              e->v.Name.ctx == Load ? USE : DEF_LOCAL))
+                              e->v.Name.ctx == Load ? USE : DEF_LOCAL, LOCATION(e)))
             VISIT_QUIT(st, 0);
         /* Special-case super: it counts as a use of __class__ */
         if (e->v.Name.ctx == Load &&
             st->st_cur->ste_type == FunctionBlock &&
             _PyUnicode_EqualToASCIIString(e->v.Name.id, "super")) {
             if (!GET_IDENTIFIER(__class__) ||
-                !symtable_add_def(st, __class__, USE))
+                !symtable_add_def(st, __class__, USE, LOCATION(e)))
                 VISIT_QUIT(st, 0);
         }
         break;
@@ -1669,12 +1740,62 @@
 }
 
 static int
+symtable_visit_pattern(struct symtable *st, pattern_ty p)
+{
+    if (++st->recursion_depth > st->recursion_limit) {
+        PyErr_SetString(PyExc_RecursionError,
+                        "maximum recursion depth exceeded during compilation");
+        VISIT_QUIT(st, 0);
+    }
+    switch (p->kind) {
+    case MatchValue_kind:
+        VISIT(st, expr, p->v.MatchValue.value);
+        break;
+    case MatchSingleton_kind:
+        /* Nothing to do here. */
+        break;
+    case MatchSequence_kind:
+        VISIT_SEQ(st, pattern, p->v.MatchSequence.patterns);
+        break;
+    case MatchStar_kind:
+        if (p->v.MatchStar.name) {
+            symtable_add_def(st, p->v.MatchStar.name, DEF_LOCAL, LOCATION(p));
+        }
+        break;
+    case MatchMapping_kind:
+        VISIT_SEQ(st, expr, p->v.MatchMapping.keys);
+        VISIT_SEQ(st, pattern, p->v.MatchMapping.patterns);
+        if (p->v.MatchMapping.rest) {
+            symtable_add_def(st, p->v.MatchMapping.rest, DEF_LOCAL, LOCATION(p));
+        }
+        break;
+    case MatchClass_kind:
+        VISIT(st, expr, p->v.MatchClass.cls);
+        VISIT_SEQ(st, pattern, p->v.MatchClass.patterns);
+        VISIT_SEQ(st, pattern, p->v.MatchClass.kwd_patterns);
+        break;
+    case MatchAs_kind:
+        if (p->v.MatchAs.pattern) {
+            VISIT(st, pattern, p->v.MatchAs.pattern);
+        }
+        if (p->v.MatchAs.name) {
+            symtable_add_def(st, p->v.MatchAs.name, DEF_LOCAL, LOCATION(p));
+        }
+        break;
+    case MatchOr_kind:
+        VISIT_SEQ(st, pattern, p->v.MatchOr.patterns);
+        break;
+    }
+    VISIT_QUIT(st, 1);
+}
+
+static int
 symtable_implicit_arg(struct symtable *st, int pos)
 {
     PyObject *id = PyUnicode_FromFormat(".%d", pos);
     if (id == NULL)
         return 0;
-    if (!symtable_add_def(st, id, DEF_PARAM)) {
+    if (!symtable_add_def(st, id, DEF_PARAM, ST_LOCATION(st->st_cur))) {
         Py_DECREF(id);
         return 0;
     }
@@ -1683,7 +1804,7 @@
 }
 
 static int
-symtable_visit_params(struct symtable *st, asdl_seq *args)
+symtable_visit_params(struct symtable *st, asdl_arg_seq *args)
 {
     int i;
 
@@ -1692,7 +1813,7 @@
 
     for (i = 0; i < asdl_seq_LEN(args); i++) {
         arg_ty arg = (arg_ty)asdl_seq_GET(args, i);
-        if (!symtable_add_def(st, arg->arg, DEF_PARAM))
+        if (!symtable_add_def(st, arg->arg, DEF_PARAM, LOCATION(arg)))
             return 0;
     }
 
@@ -1700,7 +1821,25 @@
 }
 
 static int
-symtable_visit_argannotations(struct symtable *st, asdl_seq *args)
+symtable_visit_annotation(struct symtable *st, expr_ty annotation)
+{
+    int future_annotations = st->st_future->ff_features & CO_FUTURE_ANNOTATIONS;
+    if (future_annotations &&
+        !symtable_enter_block(st, GET_IDENTIFIER(_annotation), AnnotationBlock,
+                              (void *)annotation, annotation->lineno,
+                              annotation->col_offset, annotation->end_lineno,
+                              annotation->end_col_offset)) {
+        VISIT_QUIT(st, 0);
+    }
+    VISIT(st, expr, annotation);
+    if (future_annotations && !symtable_exit_block(st)) {
+        VISIT_QUIT(st, 0);
+    }
+    return 1;
+}
+
+static int
+symtable_visit_argannotations(struct symtable *st, asdl_arg_seq *args)
 {
     int i;
 
@@ -1717,8 +1856,15 @@
 }
 
 static int
-symtable_visit_annotations(struct symtable *st, arguments_ty a, expr_ty returns)
+symtable_visit_annotations(struct symtable *st, stmt_ty o, arguments_ty a, expr_ty returns)
 {
+    int future_annotations = st->st_future->ff_features & CO_FUTURE_ANNOTATIONS;
+    if (future_annotations &&
+        !symtable_enter_block(st, GET_IDENTIFIER(_annotation), AnnotationBlock,
+                              (void *)o, o->lineno, o->col_offset, o->end_lineno,
+                              o->end_col_offset)) {
+        VISIT_QUIT(st, 0);
+    }
     if (a->posonlyargs && !symtable_visit_argannotations(st, a->posonlyargs))
         return 0;
     if (a->args && !symtable_visit_argannotations(st, a->args))
@@ -1729,8 +1875,12 @@
         VISIT(st, expr, a->kwarg->annotation);
     if (a->kwonlyargs && !symtable_visit_argannotations(st, a->kwonlyargs))
         return 0;
-    if (returns)
-        VISIT(st, expr, returns);
+    if (future_annotations && !symtable_exit_block(st)) {
+        VISIT_QUIT(st, 0);
+    }
+    if (returns && !symtable_visit_annotation(st, returns)) {
+        VISIT_QUIT(st, 0);
+    }
     return 1;
 }
 
@@ -1747,12 +1897,12 @@
     if (a->kwonlyargs && !symtable_visit_params(st, a->kwonlyargs))
         return 0;
     if (a->vararg) {
-        if (!symtable_add_def(st, a->vararg->arg, DEF_PARAM))
+        if (!symtable_add_def(st, a->vararg->arg, DEF_PARAM, LOCATION(a->vararg)))
             return 0;
         st->st_cur->ste_varargs = 1;
     }
     if (a->kwarg) {
-        if (!symtable_add_def(st, a->kwarg->arg, DEF_PARAM))
+        if (!symtable_add_def(st, a->kwarg->arg, DEF_PARAM, LOCATION(a->kwarg)))
             return 0;
         st->st_cur->ste_varkeywords = 1;
     }
@@ -1766,7 +1916,7 @@
     if (eh->v.ExceptHandler.type)
         VISIT(st, expr, eh->v.ExceptHandler.type);
     if (eh->v.ExceptHandler.name)
-        if (!symtable_add_def(st, eh->v.ExceptHandler.name, DEF_LOCAL))
+        if (!symtable_add_def(st, eh->v.ExceptHandler.name, DEF_LOCAL, LOCATION(eh)))
             return 0;
     VISIT_SEQ(st, stmt, eh->v.ExceptHandler.body);
     return 1;
@@ -1782,6 +1932,16 @@
     return 1;
 }
 
+static int
+symtable_visit_match_case(struct symtable *st, match_case_ty m)
+{
+    VISIT(st, pattern, m->pattern);
+    if (m->guard) {
+        VISIT(st, expr, m->guard);
+    }
+    VISIT_SEQ(st, stmt, m->body);
+    return 1;
+}
 
 static int
 symtable_visit_alias(struct symtable *st, alias_ty a)
@@ -1804,16 +1964,20 @@
         Py_INCREF(store_name);
     }
     if (!_PyUnicode_EqualToASCIIString(name, "*")) {
-        int r = symtable_add_def(st, store_name, DEF_IMPORT);
+        int r = symtable_add_def(st, store_name, DEF_IMPORT, LOCATION(a));
         Py_DECREF(store_name);
         return r;
     }
     else {
         if (st->st_cur->ste_type != ModuleBlock) {
-            int lineno = st->st_cur->ste_lineno;
-            int col_offset = st->st_cur->ste_col_offset;
+            int lineno = a->lineno;
+            int col_offset = a->col_offset;
+            int end_lineno = a->end_lineno;
+            int end_col_offset = a->end_col_offset;
             PyErr_SetString(PyExc_SyntaxError, IMPORT_STAR_WARNING);
-            PyErr_SyntaxLocationObject(st->st_filename, lineno, col_offset + 1);
+            PyErr_RangedSyntaxLocationObject(st->st_filename,
+                                             lineno, col_offset + 1,
+                                             end_lineno, end_col_offset + 1);
             Py_DECREF(store_name);
             return 0;
         }
@@ -1850,7 +2014,7 @@
 
 static int
 symtable_handle_comprehension(struct symtable *st, expr_ty e,
-                              identifier scope_name, asdl_seq *generators,
+                              identifier scope_name, asdl_comprehension_seq *generators,
                               expr_ty elt, expr_ty value)
 {
     int is_generator = (e->kind == GeneratorExp_kind);
@@ -1863,13 +2027,27 @@
     /* Create comprehension scope for the rest */
     if (!scope_name ||
         !symtable_enter_block(st, scope_name, FunctionBlock, (void *)e,
-                              e->lineno, e->col_offset)) {
+                              e->lineno, e->col_offset,
+                              e->end_lineno, e->end_col_offset)) {
         return 0;
     }
+    switch(e->kind) {
+        case ListComp_kind:
+            st->st_cur->ste_comprehension = ListComprehension;
+            break;
+        case SetComp_kind:
+            st->st_cur->ste_comprehension = SetComprehension;
+            break;
+        case DictComp_kind:
+            st->st_cur->ste_comprehension = DictComprehension;
+            break;
+        default:
+            st->st_cur->ste_comprehension = GeneratorExpression;
+            break;
+    }
     if (outermost->is_async) {
         st->st_cur->ste_coroutine = 1;
     }
-    st->st_cur->ste_comprehension = 1;
 
     /* Outermost iter is received as an argument */
     if (!symtable_implicit_arg(st, 0)) {
@@ -1886,18 +2064,6 @@
     if (value)
         VISIT(st, expr, value);
     VISIT(st, expr, elt);
-    if (st->st_cur->ste_generator) {
-        PyErr_SetString(PyExc_SyntaxError,
-            (e->kind == ListComp_kind) ? "'yield' inside list comprehension" :
-            (e->kind == SetComp_kind) ? "'yield' inside set comprehension" :
-            (e->kind == DictComp_kind) ? "'yield' inside dict comprehension" :
-            "'yield' inside generator expression");
-        PyErr_SyntaxLocationObject(st->st_filename,
-                                   st->st_cur->ste_lineno,
-                                   st->st_cur->ste_col_offset + 1);
-        symtable_exit_block(st);
-        return 0;
-    }
     st->st_cur->ste_generator = is_generator;
     return symtable_exit_block(st);
 }
@@ -1934,3 +2100,62 @@
                                          e->v.DictComp.key,
                                          e->v.DictComp.value);
 }
+
+static int
+symtable_raise_if_annotation_block(struct symtable *st, const char *name, expr_ty e)
+{
+    if (st->st_cur->ste_type != AnnotationBlock) {
+        return 1;
+    }
+
+    PyErr_Format(PyExc_SyntaxError, ANNOTATION_NOT_ALLOWED, name);
+    PyErr_RangedSyntaxLocationObject(st->st_filename,
+                                     e->lineno,
+                                     e->col_offset + 1,
+                                     e->end_lineno,
+                                     e->end_col_offset + 1);
+    return 0;
+}
+
+static int
+symtable_raise_if_comprehension_block(struct symtable *st, expr_ty e) {
+    _Py_comprehension_ty type = st->st_cur->ste_comprehension;
+    PyErr_SetString(PyExc_SyntaxError, 
+            (type == ListComprehension) ? "'yield' inside list comprehension" :
+            (type == SetComprehension) ? "'yield' inside set comprehension" :
+            (type == DictComprehension) ? "'yield' inside dict comprehension" :
+            "'yield' inside generator expression");
+    PyErr_RangedSyntaxLocationObject(st->st_filename,
+                                     e->lineno, e->col_offset + 1,
+                                     e->end_lineno, e->end_col_offset + 1);
+    VISIT_QUIT(st, 0);
+}
+
+struct symtable *
+_Py_SymtableStringObjectFlags(const char *str, PyObject *filename,
+                              int start, PyCompilerFlags *flags)
+{
+    struct symtable *st;
+    mod_ty mod;
+    PyArena *arena;
+
+    arena = _PyArena_New();
+    if (arena == NULL)
+        return NULL;
+
+    mod = _PyParser_ASTFromString(str, filename, start, flags, arena);
+    if (mod == NULL) {
+        _PyArena_Free(arena);
+        return NULL;
+    }
+    PyFutureFeatures *future = _PyFuture_FromAST(mod, filename);
+    if (future == NULL) {
+        _PyArena_Free(arena);
+        return NULL;
+    }
+    future->ff_features |= flags->cf_flags;
+    st = _PySymtable_Build(mod, filename, future);
+    PyObject_Free((void *)future);
+    _PyArena_Free(arena);
+    return st;
+}
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 3e4115f..ac49f78 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -15,20 +15,22 @@
 */
 
 #include "Python.h"
-#include "code.h"
-#include "frameobject.h"          // PyFrame_GetBack()
 #include "pycore_ceval.h"         // _Py_RecursionLimitLowerWaterMark()
-#include "pycore_initconfig.h"
-#include "pycore_object.h"
-#include "pycore_pathconfig.h"
-#include "pycore_pyerrors.h"
-#include "pycore_pylifecycle.h"
+#include "pycore_initconfig.h"    // _PyStatus_EXCEPTION()
+#include "pycore_object.h"        // _PyObject_IS_GC()
+#include "pycore_pathconfig.h"    // _PyPathConfig_ComputeSysPath0()
+#include "pycore_pyerrors.h"      // _PyErr_Fetch()
+#include "pycore_pylifecycle.h"   // _PyErr_WriteUnraisableDefaultHook()
 #include "pycore_pymem.h"         // _PyMem_SetDefaultAllocator()
 #include "pycore_pystate.h"       // _PyThreadState_GET()
-#include "pycore_tupleobject.h"
+#include "pycore_tuple.h"         // _PyTuple_FromArray()
+#include "pycore_structseq.h"     // PyStructSequence_InitType()
 
+#include "code.h"
+#include "frameobject.h"          // PyFrame_GetBack()
 #include "pydtrace.h"
 #include "osdefs.h"               // DELIM
+#include "stdlib_module_names.h"  // _Py_stdlib_module_names
 #include <locale.h>
 
 #ifdef MS_WINDOWS
@@ -68,7 +70,13 @@
     if (sd == NULL) {
         return NULL;
     }
-    return _PyDict_GetItemId(sd, key);
+    PyObject *exc_type, *exc_value, *exc_tb;
+    _PyErr_Fetch(tstate, &exc_type, &exc_value, &exc_tb);
+    PyObject *value = _PyDict_GetItemIdWithError(sd, key);
+    /* XXX Suppress a new exception if it was raised and restore
+     * the old one. */
+    _PyErr_Restore(tstate, exc_type, exc_value, exc_tb);
+    return value;
 }
 
 PyObject *
@@ -78,77 +86,91 @@
     return sys_get_object_id(tstate, key);
 }
 
+static PyObject *
+_PySys_GetObject(PyInterpreterState *interp, const char *name)
+{
+    PyObject *sysdict = interp->sysdict;
+    if (sysdict == NULL) {
+        return NULL;
+    }
+    return _PyDict_GetItemStringWithError(sysdict, name);
+}
+
 PyObject *
 PySys_GetObject(const char *name)
 {
     PyThreadState *tstate = _PyThreadState_GET();
-    PyObject *sd = tstate->interp->sysdict;
-    if (sd == NULL) {
-        return NULL;
-    }
-    return PyDict_GetItemString(sd, name);
+
+    PyObject *exc_type, *exc_value, *exc_tb;
+    _PyErr_Fetch(tstate, &exc_type, &exc_value, &exc_tb);
+    PyObject *value = _PySys_GetObject(tstate->interp, name);
+    /* XXX Suppress a new exception if it was raised and restore
+     * the old one. */
+    _PyErr_Restore(tstate, exc_type, exc_value, exc_tb);
+    return value;
 }
 
 static int
-sys_set_object_id(PyThreadState *tstate, _Py_Identifier *key, PyObject *v)
+sys_set_object(PyInterpreterState *interp, PyObject *key, PyObject *v)
 {
-    PyObject *sd = tstate->interp->sysdict;
+    if (key == NULL) {
+        return -1;
+    }
+    PyObject *sd = interp->sysdict;
     if (v == NULL) {
-        if (_PyDict_GetItemId(sd, key) == NULL) {
-            return 0;
+        v = _PyDict_Pop(sd, key, Py_None);
+        if (v == NULL) {
+            return -1;
         }
-        else {
-            return _PyDict_DelItemId(sd, key);
-        }
+        Py_DECREF(v);
+        return 0;
     }
     else {
-        return _PyDict_SetItemId(sd, key, v);
+        return PyDict_SetItem(sd, key, v);
     }
 }
 
+static int
+sys_set_object_id(PyInterpreterState *interp, _Py_Identifier *key, PyObject *v)
+{
+    return sys_set_object(interp, _PyUnicode_FromId(key), v);
+}
+
 int
 _PySys_SetObjectId(_Py_Identifier *key, PyObject *v)
 {
-    PyThreadState *tstate = _PyThreadState_GET();
-    return sys_set_object_id(tstate, key, v);
+    PyInterpreterState *interp = _PyInterpreterState_GET();
+    return sys_set_object_id(interp, key, v);
 }
 
 static int
-sys_set_object(PyThreadState *tstate, const char *name, PyObject *v)
+sys_set_object_str(PyInterpreterState *interp, const char *name, PyObject *v)
 {
-    PyObject *sd = tstate->interp->sysdict;
-    if (v == NULL) {
-        if (PyDict_GetItemString(sd, name) == NULL) {
-            return 0;
-        }
-        else {
-            return PyDict_DelItemString(sd, name);
-        }
-    }
-    else {
-        return PyDict_SetItemString(sd, name, v);
-    }
+    PyObject *key = v ? PyUnicode_InternFromString(name)
+                      : PyUnicode_FromString(name);
+    int r = sys_set_object(interp, key, v);
+    Py_XDECREF(key);
+    return r;
 }
 
 int
 PySys_SetObject(const char *name, PyObject *v)
 {
-    PyThreadState *tstate = _PyThreadState_GET();
-    return sys_set_object(tstate, name, v);
+    PyInterpreterState *interp = _PyInterpreterState_GET();
+    return sys_set_object_str(interp, name, v);
 }
 
 
 static int
-should_audit(PyInterpreterState *is)
+should_audit(PyInterpreterState *interp)
 {
-    /* tstate->interp cannot be NULL, but test it just in case
-       for extra safety */
-    assert(is != NULL);
-    if (!is) {
+    /* interp must not be NULL, but test it just in case for extra safety */
+    assert(interp != NULL);
+    if (!interp) {
         return 0;
     }
-    return (is->runtime->audit_hook_head
-            || is->audit_hooks
+    return (interp->runtime->audit_hook_head
+            || interp->audit_hooks
             || PyDTrace_AUDIT_ENABLED());
 }
 
@@ -231,7 +253,7 @@
 
         /* Disallow tracing in hooks unless explicitly enabled */
         ts->tracing++;
-        ts->use_tracing = 0;
+        ts->cframe->use_tracing = 0;
         while ((hook = PyIter_Next(hooks)) != NULL) {
             _Py_IDENTIFIER(__cantrace__);
             PyObject *o;
@@ -244,14 +266,14 @@
                 break;
             }
             if (canTrace) {
-                ts->use_tracing = (ts->c_tracefunc || ts->c_profilefunc);
+                ts->cframe->use_tracing = (ts->c_tracefunc || ts->c_profilefunc);
                 ts->tracing--;
             }
             PyObject* args[2] = {eventName, eventArgs};
             o = _PyObject_FastCallTstate(ts, hook, args, 2);
             if (canTrace) {
                 ts->tracing++;
-                ts->use_tracing = 0;
+                ts->cframe->use_tracing = 0;
             }
             if (!o) {
                 break;
@@ -259,7 +281,7 @@
             Py_DECREF(o);
             Py_CLEAR(hook);
         }
-        ts->use_tracing = (ts->c_tracefunc || ts->c_profilefunc);
+        ts->cframe->use_tracing = (ts->c_tracefunc || ts->c_profilefunc);
         ts->tracing--;
         if (_PyErr_Occurred(ts)) {
             goto exit;
@@ -433,15 +455,15 @@
         return NULL;
     }
 
-    PyInterpreterState *is = tstate->interp;
-    if (is->audit_hooks == NULL) {
-        is->audit_hooks = PyList_New(0);
-        if (is->audit_hooks == NULL) {
+    PyInterpreterState *interp = tstate->interp;
+    if (interp->audit_hooks == NULL) {
+        interp->audit_hooks = PyList_New(0);
+        if (interp->audit_hooks == NULL) {
             return NULL;
         }
     }
 
-    if (PyList_Append(is->audit_hooks, hook) < 0) {
+    if (PyList_Append(interp->audit_hooks, hook) < 0) {
         return NULL;
     }
 
@@ -816,8 +838,7 @@
 /*[clinic end generated code: output=13870986c1ab2ec0 input=b86ca9497baa94f2]*/
 {
     /* Raise SystemExit so callers may catch it or clean up. */
-    PyThreadState *tstate = _PyThreadState_GET();
-    _PyErr_SetObject(tstate, PyExc_SystemExit, status);
+    PyErr_SetObject(PyExc_SystemExit, status);
     return NULL;
 }
 
@@ -883,15 +904,14 @@
 sys_intern_impl(PyObject *module, PyObject *s)
 /*[clinic end generated code: output=be680c24f5c9e5d6 input=849483c006924e2f]*/
 {
-    PyThreadState *tstate = _PyThreadState_GET();
     if (PyUnicode_CheckExact(s)) {
         Py_INCREF(s);
         PyUnicode_InternInPlace(&s);
         return s;
     }
     else {
-        _PyErr_Format(tstate, PyExc_TypeError,
-                      "can't intern %.400s", Py_TYPE(s)->tp_name);
+        PyErr_Format(PyExc_TypeError,
+                     "can't intern %.400s", Py_TYPE(s)->tp_name);
         return NULL;
     }
 }
@@ -1119,10 +1139,9 @@
 sys_setswitchinterval_impl(PyObject *module, double interval)
 /*[clinic end generated code: output=65a19629e5153983 input=561b477134df91d9]*/
 {
-    PyThreadState *tstate = _PyThreadState_GET();
     if (interval <= 0.0) {
-        _PyErr_SetString(tstate, PyExc_ValueError,
-                         "switch interval must be strictly positive");
+        PyErr_SetString(PyExc_ValueError,
+                        "switch interval must be strictly positive");
         return NULL;
     }
     _PyEval_SetSwitchInterval((unsigned long) (1e6 * interval));
@@ -1160,7 +1179,6 @@
 sys_setrecursionlimit_impl(PyObject *module, int new_limit)
 /*[clinic end generated code: output=35e1c64754800ace input=b0f7a23393924af3]*/
 {
-    int mark;
     PyThreadState *tstate = _PyThreadState_GET();
 
     if (new_limit < 1) {
@@ -1178,8 +1196,7 @@
        Reject too low new limit if the current recursion depth is higher than
        the new low-water mark. Otherwise it may not be possible anymore to
        reset the overflowed flag to 0. */
-    mark = _Py_RecursionLimitLowerWaterMark(new_limit);
-    if (tstate->recursion_depth >= mark) {
+    if (tstate->recursion_depth >= new_limit) {
         _PyErr_Format(tstate, PyExc_RecursionError,
                       "cannot set the recursion limit to %i at "
                       "the recursion depth %i: the limit is too low",
@@ -1257,7 +1274,6 @@
     static char *keywords[] = {"firstiter", "finalizer", NULL};
     PyObject *firstiter = NULL;
     PyObject *finalizer = NULL;
-    PyThreadState *tstate = _PyThreadState_GET();
 
     if (!PyArg_ParseTupleAndKeywords(
             args, kw, "|OO", keywords,
@@ -1267,9 +1283,9 @@
 
     if (finalizer && finalizer != Py_None) {
         if (!PyCallable_Check(finalizer)) {
-            _PyErr_Format(tstate, PyExc_TypeError,
-                          "callable finalizer expected, got %.50s",
-                          Py_TYPE(finalizer)->tp_name);
+            PyErr_Format(PyExc_TypeError,
+                         "callable finalizer expected, got %.50s",
+                         Py_TYPE(finalizer)->tp_name);
             return NULL;
         }
         if (_PyEval_SetAsyncGenFinalizer(finalizer) < 0) {
@@ -1282,9 +1298,9 @@
 
     if (firstiter && firstiter != Py_None) {
         if (!PyCallable_Check(firstiter)) {
-            _PyErr_Format(tstate, PyExc_TypeError,
-                          "callable firstiter expected, got %.50s",
-                          Py_TYPE(firstiter)->tp_name);
+            PyErr_Format(PyExc_TypeError,
+                         "callable firstiter expected, got %.50s",
+                         Py_TYPE(firstiter)->tp_name);
             return NULL;
         }
         if (_PyEval_SetAsyncGenFirstiter(firstiter) < 0) {
@@ -1390,7 +1406,7 @@
     PyStructSequence_SET_ITEM(hash_info, field++,
                               PyLong_FromLong(_PyHASH_INF));
     PyStructSequence_SET_ITEM(hash_info, field++,
-                              PyLong_FromLong(_PyHASH_NAN));
+                              PyLong_FromLong(0));  // This is no longer used
     PyStructSequence_SET_ITEM(hash_info, field++,
                               PyLong_FromLong(_PyHASH_IMAG));
     PyStructSequence_SET_ITEM(hash_info, field++,
@@ -1485,7 +1501,6 @@
     wchar_t kernel32_path[MAX_PATH];
     LPVOID verblock;
     DWORD verblock_size;
-    PyThreadState *tstate = _PyThreadState_GET();
 
     ver.dwOSVersionInfoSize = sizeof(ver);
     if (!GetVersionExW((OSVERSIONINFOW*) &ver))
@@ -1536,11 +1551,10 @@
         realBuild
     ));
 
-    if (_PyErr_Occurred(tstate)) {
+    if (PyErr_Occurred()) {
         Py_DECREF(version);
         return NULL;
     }
-
     return version;
 }
 
@@ -1593,8 +1607,8 @@
 sys_setdlopenflags_impl(PyObject *module, int new_val)
 /*[clinic end generated code: output=ec918b7fe0a37281 input=4c838211e857a77f]*/
 {
-    PyThreadState *tstate = _PyThreadState_GET();
-    tstate->interp->dlopenflags = new_val;
+    PyInterpreterState *interp = _PyInterpreterState_GET();
+    interp->dlopenflags = new_val;
     Py_RETURN_NONE;
 }
 
@@ -1611,8 +1625,8 @@
 sys_getdlopenflags_impl(PyObject *module)
 /*[clinic end generated code: output=e92cd1bc5005da6e input=dc4ea0899c53b4b6]*/
 {
-    PyThreadState *tstate = _PyThreadState_GET();
-    return PyLong_FromLong(tstate->interp->dlopenflags);
+    PyInterpreterState *interp = _PyInterpreterState_GET();
+    return PyLong_FromLong(interp->dlopenflags);
 }
 
 #endif  /* HAVE_DLOPEN */
@@ -1824,6 +1838,21 @@
 }
 
 /*[clinic input]
+sys._current_exceptions
+
+Return a dict mapping each thread's identifier to its current raised exception.
+
+This function should be used for specialized purposes only.
+[clinic start generated code]*/
+
+static PyObject *
+sys__current_exceptions_impl(PyObject *module)
+/*[clinic end generated code: output=2ccfd838c746f0ba input=0e91818fbf2edc1f]*/
+{
+    return _PyThread_CurrentExceptions();
+}
+
+/*[clinic input]
 sys.call_tracing
 
     func: object
@@ -1873,12 +1902,12 @@
 }
 
 #ifdef Py_TRACE_REFS
-/* Defined in objects.c because it uses static globals if that file */
+/* Defined in objects.c because it uses static globals in that file */
 extern PyObject *_Py_GetObjects(PyObject *, PyObject *);
 #endif
 
 #ifdef DYNAMIC_EXECUTION_PROFILE
-/* Defined in ceval.c because it uses static globals if that file */
+/* Defined in ceval.c because it uses static globals in that file */
 extern PyObject *_Py_GetDXProfile(PyObject *,  PyObject *);
 #endif
 
@@ -1930,6 +1959,20 @@
 #endif   /* ANDROID_API_LEVEL */
 
 
+/*[clinic input]
+sys._deactivate_opcache
+
+Deactivate the opcode cache permanently
+[clinic start generated code]*/
+
+static PyObject *
+sys__deactivate_opcache_impl(PyObject *module)
+/*[clinic end generated code: output=00e20982bd012122 input=501eac146735ccf9]*/
+{
+    _PyEval_DeactivateOpCache();
+    Py_RETURN_NONE;
+}
+
 
 static PyMethodDef sys_methods[] = {
     /* Might as well keep this in alphabetic order */
@@ -1939,6 +1982,7 @@
      METH_FASTCALL | METH_KEYWORDS, breakpointhook_doc},
     SYS__CLEAR_TYPE_CACHE_METHODDEF
     SYS__CURRENT_FRAMES_METHODDEF
+    SYS__CURRENT_EXCEPTIONS_METHODDEF
     SYS_DISPLAYHOOK_METHODDEF
     SYS_EXC_INFO_METHODDEF
     SYS_EXCEPTHOOK_METHODDEF
@@ -1982,36 +2026,67 @@
     SYS_GET_ASYNCGEN_HOOKS_METHODDEF
     SYS_GETANDROIDAPILEVEL_METHODDEF
     SYS_UNRAISABLEHOOK_METHODDEF
+    SYS__DEACTIVATE_OPCACHE_METHODDEF
     {NULL,              NULL}           /* sentinel */
 };
 
+
 static PyObject *
 list_builtin_module_names(void)
 {
     PyObject *list = PyList_New(0);
-    int i;
-    if (list == NULL)
+    if (list == NULL) {
         return NULL;
-    for (i = 0; PyImport_Inittab[i].name != NULL; i++) {
-        PyObject *name = PyUnicode_FromString(
-            PyImport_Inittab[i].name);
-        if (name == NULL)
-            break;
-        PyList_Append(list, name);
+    }
+    for (Py_ssize_t i = 0; PyImport_Inittab[i].name != NULL; i++) {
+        PyObject *name = PyUnicode_FromString(PyImport_Inittab[i].name);
+        if (name == NULL) {
+            goto error;
+        }
+        if (PyList_Append(list, name) < 0) {
+            Py_DECREF(name);
+            goto error;
+        }
         Py_DECREF(name);
     }
     if (PyList_Sort(list) != 0) {
-        Py_DECREF(list);
-        list = NULL;
+        goto error;
     }
-    if (list) {
-        PyObject *v = PyList_AsTuple(list);
-        Py_DECREF(list);
-        list = v;
-    }
-    return list;
+    PyObject *tuple = PyList_AsTuple(list);
+    Py_DECREF(list);
+    return tuple;
+
+error:
+    Py_DECREF(list);
+    return NULL;
 }
 
+
+static PyObject *
+list_stdlib_module_names(void)
+{
+    Py_ssize_t len = Py_ARRAY_LENGTH(_Py_stdlib_module_names);
+    PyObject *names = PyTuple_New(len);
+    if (names == NULL) {
+        return NULL;
+    }
+
+    for (Py_ssize_t i = 0; i < len; i++) {
+        PyObject *name = PyUnicode_FromString(_Py_stdlib_module_names[i]);
+        if (name == NULL) {
+            Py_DECREF(names);
+            return NULL;
+        }
+        PyTuple_SET_ITEM(names, i, name);
+    }
+
+    PyObject *set = PyObject_CallFunction((PyObject *)&PyFrozenSet_Type,
+                                          "(O)", names);
+    Py_DECREF(names);
+    return set;
+}
+
+
 /* Pre-initialization support for sys.warnoptions and sys._xoptions
  *
  * Modern internal code paths:
@@ -2157,7 +2232,7 @@
         if (warnoptions == NULL) {
             return NULL;
         }
-        if (sys_set_object_id(tstate, &PyId_warnoptions, warnoptions)) {
+        if (sys_set_object_id(tstate->interp, &PyId_warnoptions, warnoptions)) {
             Py_DECREF(warnoptions);
             return NULL;
         }
@@ -2250,7 +2325,7 @@
         if (xoptions == NULL) {
             return NULL;
         }
-        if (sys_set_object_id(tstate, &PyId__xoptions, xoptions)) {
+        if (sys_set_object_id(tstate->interp, &PyId__xoptions, xoptions)) {
             Py_DECREF(xoptions);
             return NULL;
         }
@@ -2434,14 +2509,13 @@
     {"no_site",                 "-S"},
     {"ignore_environment",      "-E"},
     {"verbose",                 "-v"},
-    /* {"unbuffered",                   "-u"}, */
-    /* {"skip_first",                   "-x"}, */
     {"bytes_warning",           "-b"},
     {"quiet",                   "-q"},
     {"hash_randomization",      "-R"},
     {"isolated",                "-I"},
     {"dev_mode",                "-X dev"},
     {"utf8_mode",               "-X utf8"},
+    {"warn_default_encoding",   "-X warn_default_encoding"},
     {0}
 };
 
@@ -2449,24 +2523,29 @@
     "sys.flags",        /* name */
     flags__doc__,       /* doc */
     flags_fields,       /* fields */
-    15
+    16
 };
 
-static PyObject*
-make_flags(PyThreadState *tstate)
+static int
+set_flags_from_config(PyInterpreterState *interp, PyObject *flags)
 {
-    PyInterpreterState *interp = tstate->interp;
     const PyPreConfig *preconfig = &interp->runtime->preconfig;
     const PyConfig *config = _PyInterpreterState_GetConfig(interp);
 
-    PyObject *seq = PyStructSequence_New(&FlagsType);
-    if (seq == NULL) {
-        return NULL;
-    }
-
-    int pos = 0;
-#define SetFlag(flag) \
-    PyStructSequence_SET_ITEM(seq, pos++, PyLong_FromLong(flag))
+    // _PySys_UpdateConfig() modifies sys.flags in-place:
+    // Py_XDECREF() is needed in this case.
+    Py_ssize_t pos = 0;
+#define SetFlagObj(expr) \
+    do { \
+        PyObject *value = (expr); \
+        if (value == NULL) { \
+            return -1; \
+        } \
+        Py_XDECREF(PyStructSequence_GET_ITEM(flags, pos)); \
+        PyStructSequence_SET_ITEM(flags, pos, value); \
+        pos++; \
+    } while (0)
+#define SetFlag(expr) SetFlagObj(PyLong_FromLong(expr))
 
     SetFlag(config->parser_debug);
     SetFlag(config->inspect);
@@ -2477,23 +2556,35 @@
     SetFlag(!config->site_import);
     SetFlag(!config->use_environment);
     SetFlag(config->verbose);
-    /* SetFlag(saw_unbuffered_flag); */
-    /* SetFlag(skipfirstline); */
     SetFlag(config->bytes_warning);
     SetFlag(config->quiet);
     SetFlag(config->use_hash_seed == 0 || config->hash_seed != 0);
     SetFlag(config->isolated);
-    PyStructSequence_SET_ITEM(seq, pos++, PyBool_FromLong(config->dev_mode));
+    SetFlagObj(PyBool_FromLong(config->dev_mode));
     SetFlag(preconfig->utf8_mode);
+    SetFlag(config->warn_default_encoding);
+#undef SetFlagObj
 #undef SetFlag
+    return 0;
+}
 
-    if (_PyErr_Occurred(tstate)) {
-        Py_DECREF(seq);
+
+static PyObject*
+make_flags(PyInterpreterState *interp)
+{
+    PyObject *flags = PyStructSequence_New(&FlagsType);
+    if (flags == NULL) {
         return NULL;
     }
-    return seq;
+
+    if (set_flags_from_config(interp, flags) < 0) {
+        Py_DECREF(flags);
+        return NULL;
+    }
+    return flags;
 }
 
+
 PyDoc_STRVAR(version_info__doc__,
 "sys.version_info\n\
 \n\
@@ -2649,18 +2740,7 @@
 };
 
 /* Updating the sys namespace, returning NULL pointer on error */
-#define SET_SYS_FROM_STRING_BORROW(key, value)             \
-    do {                                                   \
-        PyObject *v = (value);                             \
-        if (v == NULL) {                                   \
-            goto err_occurred;                             \
-        }                                                  \
-        res = PyDict_SetItemString(sysdict, key, v);       \
-        if (res < 0) {                                     \
-            goto err_occurred;                             \
-        }                                                  \
-    } while (0)
-#define SET_SYS_FROM_STRING(key, value)                    \
+#define SET_SYS(key, value)                                \
     do {                                                   \
         PyObject *v = (value);                             \
         if (v == NULL) {                                   \
@@ -2673,6 +2753,9 @@
         }                                                  \
     } while (0)
 
+#define SET_SYS_FROM_STRING(key, value) \
+        SET_SYS(key, PyUnicode_FromString(value))
+
 static PyStatus
 _PySys_InitCore(PyThreadState *tstate, PyObject *sysdict)
 {
@@ -2681,123 +2764,93 @@
 
     /* stdin/stdout/stderr are set in pylifecycle.c */
 
-    SET_SYS_FROM_STRING_BORROW("__displayhook__",
-                               PyDict_GetItemString(sysdict, "displayhook"));
-    SET_SYS_FROM_STRING_BORROW("__excepthook__",
-                               PyDict_GetItemString(sysdict, "excepthook"));
-    SET_SYS_FROM_STRING_BORROW(
-        "__breakpointhook__",
-        PyDict_GetItemString(sysdict, "breakpointhook"));
-    SET_SYS_FROM_STRING_BORROW("__unraisablehook__",
-                               PyDict_GetItemString(sysdict, "unraisablehook"));
+#define COPY_SYS_ATTR(tokey, fromkey) \
+        SET_SYS(tokey, PyMapping_GetItemString(sysdict, fromkey))
 
-    SET_SYS_FROM_STRING("version",
-                         PyUnicode_FromString(Py_GetVersion()));
-    SET_SYS_FROM_STRING("hexversion",
-                         PyLong_FromLong(PY_VERSION_HEX));
-    SET_SYS_FROM_STRING("_git",
-                        Py_BuildValue("(szz)", "CPython", _Py_gitidentifier(),
-                                      _Py_gitversion()));
-    SET_SYS_FROM_STRING("_framework", PyUnicode_FromString(_PYTHONFRAMEWORK));
-    SET_SYS_FROM_STRING("api_version",
-                        PyLong_FromLong(PYTHON_API_VERSION));
-    SET_SYS_FROM_STRING("copyright",
-                        PyUnicode_FromString(Py_GetCopyright()));
-    SET_SYS_FROM_STRING("platform",
-                        PyUnicode_FromString(Py_GetPlatform()));
-    SET_SYS_FROM_STRING("maxsize",
-                        PyLong_FromSsize_t(PY_SSIZE_T_MAX));
-    SET_SYS_FROM_STRING("float_info",
-                        PyFloat_GetInfo());
-    SET_SYS_FROM_STRING("int_info",
-                        PyLong_GetInfo());
+    COPY_SYS_ATTR("__displayhook__", "displayhook");
+    COPY_SYS_ATTR("__excepthook__", "excepthook");
+    COPY_SYS_ATTR("__breakpointhook__", "breakpointhook");
+    COPY_SYS_ATTR("__unraisablehook__", "unraisablehook");
+
+#undef COPY_SYS_ATTR
+
+    SET_SYS_FROM_STRING("version", Py_GetVersion());
+    SET_SYS("hexversion", PyLong_FromLong(PY_VERSION_HEX));
+    SET_SYS("_git", Py_BuildValue("(szz)", "CPython", _Py_gitidentifier(),
+                                  _Py_gitversion()));
+    SET_SYS_FROM_STRING("_framework", _PYTHONFRAMEWORK);
+    SET_SYS("api_version", PyLong_FromLong(PYTHON_API_VERSION));
+    SET_SYS_FROM_STRING("copyright", Py_GetCopyright());
+    SET_SYS_FROM_STRING("platform", Py_GetPlatform());
+    SET_SYS("maxsize", PyLong_FromSsize_t(PY_SSIZE_T_MAX));
+    SET_SYS("float_info", PyFloat_GetInfo());
+    SET_SYS("int_info", PyLong_GetInfo());
     /* initialize hash_info */
     if (Hash_InfoType.tp_name == NULL) {
         if (PyStructSequence_InitType2(&Hash_InfoType, &hash_info_desc) < 0) {
             goto type_init_failed;
         }
     }
-    SET_SYS_FROM_STRING("hash_info",
-                        get_hash_info(tstate));
-    SET_SYS_FROM_STRING("maxunicode",
-                        PyLong_FromLong(0x10FFFF));
-    SET_SYS_FROM_STRING("builtin_module_names",
-                        list_builtin_module_names());
+    SET_SYS("hash_info", get_hash_info(tstate));
+    SET_SYS("maxunicode", PyLong_FromLong(0x10FFFF));
+    SET_SYS("builtin_module_names", list_builtin_module_names());
+    SET_SYS("stdlib_module_names", list_stdlib_module_names());
 #if PY_BIG_ENDIAN
-    SET_SYS_FROM_STRING("byteorder",
-                        PyUnicode_FromString("big"));
+    SET_SYS_FROM_STRING("byteorder", "big");
 #else
-    SET_SYS_FROM_STRING("byteorder",
-                        PyUnicode_FromString("little"));
+    SET_SYS_FROM_STRING("byteorder", "little");
 #endif
 
 #ifdef MS_COREDLL
-    SET_SYS_FROM_STRING("dllhandle",
-                        PyLong_FromVoidPtr(PyWin_DLLhModule));
-    SET_SYS_FROM_STRING("winver",
-                        PyUnicode_FromString(PyWin_DLLVersionString));
+    SET_SYS("dllhandle", PyLong_FromVoidPtr(PyWin_DLLhModule));
+    SET_SYS_FROM_STRING("winver", PyWin_DLLVersionString);
 #endif
 #ifdef ABIFLAGS
-    SET_SYS_FROM_STRING("abiflags",
-                        PyUnicode_FromString(ABIFLAGS));
+    SET_SYS_FROM_STRING("abiflags", ABIFLAGS);
 #endif
 
     /* version_info */
     if (VersionInfoType.tp_name == NULL) {
-        if (PyStructSequence_InitType2(&VersionInfoType,
-                                       &version_info_desc) < 0) {
+        if (_PyStructSequence_InitType(&VersionInfoType,
+                                       &version_info_desc,
+                                       Py_TPFLAGS_DISALLOW_INSTANTIATION) < 0) {
             goto type_init_failed;
         }
     }
     version_info = make_version_info(tstate);
-    SET_SYS_FROM_STRING("version_info", version_info);
-    /* prevent user from creating new instances */
-    VersionInfoType.tp_init = NULL;
-    VersionInfoType.tp_new = NULL;
-    res = PyDict_DelItemString(VersionInfoType.tp_dict, "__new__");
-    if (res < 0 && _PyErr_ExceptionMatches(tstate, PyExc_KeyError)) {
-        _PyErr_Clear(tstate);
-    }
+    SET_SYS("version_info", version_info);
 
     /* implementation */
-    SET_SYS_FROM_STRING("implementation", make_impl_info(version_info));
+    SET_SYS("implementation", make_impl_info(version_info));
 
-    /* flags */
+    // sys.flags: updated in-place later by _PySys_UpdateConfig()
     if (FlagsType.tp_name == 0) {
-        if (PyStructSequence_InitType2(&FlagsType, &flags_desc) < 0) {
+        if (_PyStructSequence_InitType(&FlagsType, &flags_desc,
+                                       Py_TPFLAGS_DISALLOW_INSTANTIATION) < 0) {
             goto type_init_failed;
         }
     }
-    /* Set flags to their default values (updated by _PySys_InitMain()) */
-    SET_SYS_FROM_STRING("flags", make_flags(tstate));
+    SET_SYS("flags", make_flags(tstate->interp));
 
 #if defined(MS_WINDOWS)
     /* getwindowsversion */
-    if (WindowsVersionType.tp_name == 0)
-        if (PyStructSequence_InitType2(&WindowsVersionType,
-                                       &windows_version_desc) < 0) {
+    if (WindowsVersionType.tp_name == 0) {
+        if (_PyStructSequence_InitType(&WindowsVersionType,
+                                       &windows_version_desc,
+                                       Py_TPFLAGS_DISALLOW_INSTANTIATION) < 0) {
             goto type_init_failed;
         }
-    /* prevent user from creating new instances */
-    WindowsVersionType.tp_init = NULL;
-    WindowsVersionType.tp_new = NULL;
-    assert(!_PyErr_Occurred(tstate));
-    res = PyDict_DelItemString(WindowsVersionType.tp_dict, "__new__");
-    if (res < 0 && _PyErr_ExceptionMatches(tstate, PyExc_KeyError)) {
-        _PyErr_Clear(tstate);
     }
 #endif
 
     /* float repr style: 0.03 (short) vs 0.029999999999999999 (legacy) */
 #ifndef PY_NO_SHORT_FLOAT_REPR
-    SET_SYS_FROM_STRING("float_repr_style",
-                        PyUnicode_FromString("short"));
+    SET_SYS_FROM_STRING("float_repr_style", "short");
 #else
-    SET_SYS_FROM_STRING("float_repr_style",
-                        PyUnicode_FromString("legacy"));
+    SET_SYS_FROM_STRING("float_repr_style", "legacy");
 #endif
 
-    SET_SYS_FROM_STRING("thread_info", PyThread_GetInfo());
+    SET_SYS("thread_info", PyThread_GetInfo());
 
     /* initialize asyncgen_hooks */
     if (AsyncGenHooksType.tp_name == NULL) {
@@ -2807,6 +2860,11 @@
         }
     }
 
+    /* adding sys.path_hooks and sys.path_importer_cache */
+    SET_SYS("meta_path", PyList_New(0));
+    SET_SYS("path_importer_cache", PyDict_New());
+    SET_SYS("path_hooks", PyList_New(0));
+
     if (_PyErr_Occurred(tstate)) {
         goto err_occurred;
     }
@@ -2819,20 +2877,6 @@
     return _PyStatus_ERR("can't initialize sys module");
 }
 
-/* Updating the sys namespace, returning integer error codes */
-#define SET_SYS_FROM_STRING_INT_RESULT(key, value)         \
-    do {                                                   \
-        PyObject *v = (value);                             \
-        if (v == NULL)                                     \
-            return -1;                                     \
-        res = PyDict_SetItemString(sysdict, key, v);       \
-        Py_DECREF(v);                                      \
-        if (res < 0) {                                     \
-            return res;                                    \
-        }                                                  \
-    } while (0)
-
-
 static int
 sys_add_xoption(PyObject *opts, const wchar_t *s)
 {
@@ -2887,42 +2931,38 @@
 }
 
 
+// Update sys attributes for a new PyConfig configuration.
+// This function also adds attributes that _PySys_InitCore() didn't add.
 int
-_PySys_InitMain(PyThreadState *tstate)
+_PySys_UpdateConfig(PyThreadState *tstate)
 {
-    PyObject *sysdict = tstate->interp->sysdict;
-    const PyConfig *config = _PyInterpreterState_GetConfig(tstate->interp);
+    PyInterpreterState *interp = tstate->interp;
+    PyObject *sysdict = interp->sysdict;
+    const PyConfig *config = _PyInterpreterState_GetConfig(interp);
     int res;
 
 #define COPY_LIST(KEY, VALUE) \
-    do { \
-        PyObject *list = _PyWideStringList_AsList(&(VALUE)); \
-        if (list == NULL) { \
-            return -1; \
-        } \
-        SET_SYS_FROM_STRING_BORROW(KEY, list); \
-        Py_DECREF(list); \
-    } while (0)
+        SET_SYS(KEY, _PyWideStringList_AsList(&(VALUE)));
 
 #define SET_SYS_FROM_WSTR(KEY, VALUE) \
-    do { \
-        PyObject *str = PyUnicode_FromWideChar(VALUE, -1); \
-        if (str == NULL) { \
-            return -1; \
-        } \
-        SET_SYS_FROM_STRING_BORROW(KEY, str); \
-        Py_DECREF(str); \
-    } while (0)
+        SET_SYS(KEY, PyUnicode_FromWideChar(VALUE, -1));
 
-    COPY_LIST("path", config->module_search_paths);
+#define COPY_WSTR(SYS_ATTR, WSTR) \
+    if (WSTR != NULL) { \
+        SET_SYS_FROM_WSTR(SYS_ATTR, WSTR); \
+    }
 
-    SET_SYS_FROM_WSTR("executable", config->executable);
-    SET_SYS_FROM_WSTR("_base_executable", config->base_executable);
-    SET_SYS_FROM_WSTR("prefix", config->prefix);
-    SET_SYS_FROM_WSTR("base_prefix", config->base_prefix);
-    SET_SYS_FROM_WSTR("exec_prefix", config->exec_prefix);
-    SET_SYS_FROM_WSTR("base_exec_prefix", config->base_exec_prefix);
-    SET_SYS_FROM_WSTR("platlibdir", config->platlibdir);
+    if (config->module_search_paths_set) {
+        COPY_LIST("path", config->module_search_paths);
+    }
+
+    COPY_WSTR("executable", config->executable);
+    COPY_WSTR("_base_executable", config->base_executable);
+    COPY_WSTR("prefix", config->prefix);
+    COPY_WSTR("base_prefix", config->base_prefix);
+    COPY_WSTR("exec_prefix", config->exec_prefix);
+    COPY_WSTR("base_exec_prefix", config->base_exec_prefix);
+    COPY_WSTR("platlibdir", config->platlibdir);
 
     if (config->pycache_prefix != NULL) {
         SET_SYS_FROM_WSTR("pycache_prefix", config->pycache_prefix);
@@ -2931,41 +2971,25 @@
     }
 
     COPY_LIST("argv", config->argv);
+    COPY_LIST("orig_argv", config->orig_argv);
     COPY_LIST("warnoptions", config->warnoptions);
 
-    PyObject *xoptions = sys_create_xoptions_dict(config);
-    if (xoptions == NULL) {
-        return -1;
-    }
-    SET_SYS_FROM_STRING_BORROW("_xoptions", xoptions);
-    Py_DECREF(xoptions);
+    SET_SYS("_xoptions", sys_create_xoptions_dict(config));
 
-#undef COPY_LIST
 #undef SET_SYS_FROM_WSTR
+#undef COPY_LIST
+#undef COPY_WSTR
 
-
-    /* Set flags to their final values */
-    SET_SYS_FROM_STRING_INT_RESULT("flags", make_flags(tstate));
-    /* prevent user from creating new instances */
-    FlagsType.tp_init = NULL;
-    FlagsType.tp_new = NULL;
-    res = PyDict_DelItemString(FlagsType.tp_dict, "__new__");
-    if (res < 0) {
-        if (!_PyErr_ExceptionMatches(tstate, PyExc_KeyError)) {
-            return res;
-        }
-        _PyErr_Clear(tstate);
+    // sys.flags
+    PyObject *flags = _PySys_GetObject(interp, "flags"); // borrowed ref
+    if (flags == NULL) {
+        return -1;
     }
-
-    SET_SYS_FROM_STRING_INT_RESULT("dont_write_bytecode",
-                         PyBool_FromLong(!config->write_bytecode));
-
-    if (get_warnoptions(tstate) == NULL) {
+    if (set_flags_from_config(interp, flags) < 0) {
         return -1;
     }
 
-    if (get_xoptions(tstate) == NULL)
-        return -1;
+    SET_SYS("dont_write_bytecode", PyBool_FromLong(!config->write_bytecode));
 
     if (_PyErr_Occurred(tstate)) {
         goto err_occurred;
@@ -2977,15 +3001,14 @@
     return -1;
 }
 
+#undef SET_SYS
 #undef SET_SYS_FROM_STRING
-#undef SET_SYS_FROM_STRING_BORROW
-#undef SET_SYS_FROM_STRING_INT_RESULT
 
 
 /* Set up a preliminary stderr printer until we have enough
    infrastructure for the io module in place.
 
-   Use UTF-8/surrogateescape and ignore EAGAIN errors. */
+   Use UTF-8/backslashreplace and ignore EAGAIN errors. */
 static PyStatus
 _PySys_SetPreliminaryStderr(PyObject *sysdict)
 {
@@ -3008,8 +3031,8 @@
 }
 
 
-/* Create sys module without all attributes: _PySys_InitMain() should be called
-   later to add remaining attributes. */
+/* Create sys module without all attributes.
+   _PySys_UpdateConfig() should be called later to add remaining attributes. */
 PyStatus
 _PySys_Create(PyThreadState *tstate, PyObject **sysmod_p)
 {
@@ -3102,8 +3125,8 @@
     PyObject *v;
     if ((v = makepathobject(path, DELIM)) == NULL)
         Py_FatalError("can't create sys.path");
-    PyThreadState *tstate = _PyThreadState_GET();
-    if (sys_set_object_id(tstate, &PyId_path, v) != 0) {
+    PyInterpreterState *interp = _PyInterpreterState_GET();
+    if (sys_set_object_id(interp, &PyId_path, v) != 0) {
         Py_FatalError("can't assign sys.path");
     }
     Py_DECREF(v);
@@ -3144,7 +3167,7 @@
     if (av == NULL) {
         Py_FatalError("no mem for sys.argv");
     }
-    if (sys_set_object(tstate, "argv", av) != 0) {
+    if (sys_set_object_str(tstate->interp, "argv", av) != 0) {
         Py_DECREF(av);
         Py_FatalError("can't assign sys.argv");
     }
diff --git a/Python/thread.c b/Python/thread.c
index eae60e9..5907f5c 100644
--- a/Python/thread.c
+++ b/Python/thread.c
@@ -79,6 +79,25 @@
     PyThread__init_thread();
 }
 
+void
+_PyThread_debug_deprecation(void)
+{
+#ifdef Py_DEBUG
+    if (thread_debug) {
+        // Flush previous dprintf() logs
+        fflush(stdout);
+        if (PyErr_WarnEx(PyExc_DeprecationWarning,
+                         "The threading debug (PYTHONTHREADDEBUG environment "
+                         "variable) is deprecated and will be removed "
+                         "in Python 3.12",
+                         0))
+        {
+            _PyErr_WriteUnraisableMsg("at Python startup", NULL);
+        }
+    }
+#endif
+}
+
 #if defined(_POSIX_THREADS)
 #   define PYTHREAD_NAME "pthread"
 #   include "thread_pthread.h"
diff --git a/Python/thread_nt.h b/Python/thread_nt.h
index 05b982d..0ce5e94 100644
--- a/Python/thread_nt.h
+++ b/Python/thread_nt.h
@@ -76,16 +76,22 @@
         }
     } else if (milliseconds != 0) {
         /* wait at least until the target */
-        ULONGLONG now, target = GetTickCount64() + milliseconds;
+        _PyTime_t now = _PyTime_GetPerfCounter();
+        if (now <= 0) {
+            Py_FatalError("_PyTime_GetPerfCounter() == 0");
+        }
+        _PyTime_t nanoseconds = _PyTime_FromNanoseconds((_PyTime_t)milliseconds * 1000000);
+        _PyTime_t target = now + nanoseconds;
         while (mutex->locked) {
-            if (PyCOND_TIMEDWAIT(&mutex->cv, &mutex->cs, (long long)milliseconds*1000) < 0) {
+            _PyTime_t microseconds = _PyTime_AsMicroseconds(nanoseconds, _PyTime_ROUND_TIMEOUT);
+            if (PyCOND_TIMEDWAIT(&mutex->cv, &mutex->cs, microseconds) < 0) {
                 result = WAIT_FAILED;
                 break;
             }
-            now = GetTickCount64();
+            now = _PyTime_GetPerfCounter();
             if (target <= now)
                 break;
-            milliseconds = (DWORD)(target-now);
+            nanoseconds = target - now;
         }
     }
     if (!mutex->locked) {
diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h
index e6910b3..35b9810 100644
--- a/Python/thread_pthread.h
+++ b/Python/thread_pthread.h
@@ -32,18 +32,17 @@
 #define THREAD_STACK_SIZE       0       /* use default stack size */
 #endif
 
-/* The default stack size for new threads on OSX and BSD is small enough that
+/* The default stack size for new threads on BSD is small enough that
  * we'll get hard crashes instead of 'maximum recursion depth exceeded'
  * exceptions.
  *
- * The default stack sizes below are the empirically determined minimal stack
+ * The default stack size below is the empirically determined minimal stack
  * sizes where a simple recursive function doesn't cause a hard crash.
+ *
+ * For macOS the value of THREAD_STACK_SIZE is determined in configure.ac
+ * as it also depends on the other configure options like chosen sanitizer
+ * runtimes.
  */
-#if defined(__APPLE__) && defined(THREAD_STACK_SIZE) && THREAD_STACK_SIZE == 0
-#undef  THREAD_STACK_SIZE
-/* Note: This matches the value of -Wl,-stack_size in configure.ac */
-#define THREAD_STACK_SIZE       0x1000000
-#endif
 #if defined(__FreeBSD__) && defined(THREAD_STACK_SIZE) && THREAD_STACK_SIZE == 0
 #undef  THREAD_STACK_SIZE
 #define THREAD_STACK_SIZE       0x400000
@@ -62,6 +61,10 @@
 #   define THREAD_STACK_SIZE    0x800000
 #   endif
 #endif
+#if defined(__VXWORKS__) && defined(THREAD_STACK_SIZE) && THREAD_STACK_SIZE == 0
+#undef  THREAD_STACK_SIZE
+#define THREAD_STACK_SIZE       0x100000
+#endif
 /* for safety, ensure a viable minimum stacksize */
 #define THREAD_STACK_MIN        0x8000  /* 32 KiB */
 #else  /* !_POSIX_THREAD_ATTR_STACKSIZE */
@@ -89,12 +92,17 @@
  * mutexes and condition variables:
  */
 #if (defined(_POSIX_SEMAPHORES) && !defined(HAVE_BROKEN_POSIX_SEMAPHORES) && \
-     defined(HAVE_SEM_TIMEDWAIT))
+     (defined(HAVE_SEM_TIMEDWAIT) || defined(HAVE_SEM_CLOCKWAIT)))
 #  define USE_SEMAPHORES
 #else
 #  undef USE_SEMAPHORES
 #endif
 
+#if defined(HAVE_PTHREAD_CONDATTR_SETCLOCK) && defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
+// monotonic is supported statically.  It doesn't mean it works on runtime.
+#define CONDATTR_MONOTONIC
+#endif
+
 
 /* On platforms that don't use standard POSIX threads pthread_sigmask()
  * isn't present.  DEC threads uses sigprocmask() instead as do most
@@ -120,16 +128,23 @@
     ts.tv_nsec = tv.tv_usec * 1000; \
 } while(0)
 
+#if defined(CONDATTR_MONOTONIC) || defined(HAVE_SEM_CLOCKWAIT)
+static void
+monotonic_abs_timeout(long long us, struct timespec *abs)
+{
+    clock_gettime(CLOCK_MONOTONIC, abs);
+    abs->tv_sec  += us / 1000000;
+    abs->tv_nsec += (us % 1000000) * 1000;
+    abs->tv_sec  += abs->tv_nsec / 1000000000;
+    abs->tv_nsec %= 1000000000;
+}
+#endif
+
 
 /*
  * pthread_cond support
  */
 
-#if defined(HAVE_PTHREAD_CONDATTR_SETCLOCK) && defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
-// monotonic is supported statically.  It doesn't mean it works on runtime.
-#define CONDATTR_MONOTONIC
-#endif
-
 // NULL when pthread_condattr_setclock(CLOCK_MONOTONIC) is not supported.
 static pthread_condattr_t *condattr_monotonic = NULL;
 
@@ -151,16 +166,13 @@
     return pthread_cond_init(cond, condattr_monotonic);
 }
 
+
 void
 _PyThread_cond_after(long long us, struct timespec *abs)
 {
 #ifdef CONDATTR_MONOTONIC
     if (condattr_monotonic) {
-        clock_gettime(CLOCK_MONOTONIC, abs);
-        abs->tv_sec  += us / 1000000;
-        abs->tv_nsec += (us % 1000000) * 1000;
-        abs->tv_sec  += abs->tv_nsec / 1000000000;
-        abs->tv_nsec %= 1000000000;
+        monotonic_abs_timeout(us, abs);
         return;
     }
 #endif
@@ -431,7 +443,9 @@
     sem_t *thelock = (sem_t *)lock;
     int status, error = 0;
     struct timespec ts;
+#ifndef HAVE_SEM_CLOCKWAIT
     _PyTime_t deadline = 0;
+#endif
 
     (void) error; /* silence unused-but-set-variable warning */
     dprintf(("PyThread_acquire_lock_timed(%p, %lld, %d) called\n",
@@ -442,6 +456,9 @@
     }
 
     if (microseconds > 0) {
+#ifdef HAVE_SEM_CLOCKWAIT
+        monotonic_abs_timeout(microseconds, &ts);
+#else
         MICROSECONDS_TO_TIMESPEC(microseconds, ts);
 
         if (!intr_flag) {
@@ -450,11 +467,17 @@
             _PyTime_t timeout = _PyTime_FromNanoseconds(microseconds * 1000);
             deadline = _PyTime_GetMonotonicClock() + timeout;
         }
+#endif
     }
 
     while (1) {
         if (microseconds > 0) {
+#ifdef HAVE_SEM_CLOCKWAIT
+            status = fix_status(sem_clockwait(thelock, CLOCK_MONOTONIC,
+                                              &ts));
+#else
             status = fix_status(sem_timedwait(thelock, &ts));
+#endif
         }
         else if (microseconds == 0) {
             status = fix_status(sem_trywait(thelock));
@@ -469,6 +492,9 @@
             break;
         }
 
+        // sem_clockwait() uses an absolute timeout, there is no need
+        // to recompute the relative timeout.
+#ifndef HAVE_SEM_CLOCKWAIT
         if (microseconds > 0) {
             /* wait interrupted by a signal (EINTR): recompute the timeout */
             _PyTime_t dt = deadline - _PyTime_GetMonotonicClock();
@@ -490,13 +516,19 @@
                 microseconds = 0;
             }
         }
+#endif
     }
 
     /* Don't check the status if we're stopping because of an interrupt.  */
     if (!(intr_flag && status == EINTR)) {
         if (microseconds > 0) {
-            if (status != ETIMEDOUT)
+            if (status != ETIMEDOUT) {
+#ifdef HAVE_SEM_CLOCKWAIT
+                CHECK_STATUS("sem_clockwait");
+#else
                 CHECK_STATUS("sem_timedwait");
+#endif
+            }
         }
         else if (microseconds == 0) {
             if (status != EAGAIN)
diff --git a/Python/traceback.c b/Python/traceback.c
index 99b63af..7d6f7f4 100644
--- a/Python/traceback.c
+++ b/Python/traceback.c
@@ -4,6 +4,7 @@
 #include "Python.h"
 
 #include "code.h"
+#include "pycore_interp.h"        // PyInterpreterState.gc
 #include "frameobject.h"          // PyFrame_GetBack()
 #include "structmember.h"         // PyMemberDef
 #include "osdefs.h"               // SEP
@@ -147,7 +148,7 @@
 };
 
 static PyMemberDef tb_memberlist[] = {
-    {"tb_frame",        T_OBJECT,       OFF(tb_frame),  READONLY},
+    {"tb_frame",        T_OBJECT,       OFF(tb_frame),  READONLY|PY_AUDIT_READ},
     {"tb_lasti",        T_INT,          OFF(tb_lasti),  READONLY},
     {"tb_lineno",       T_INT,          OFF(tb_lineno), READONLY},
     {NULL}      /* Sentinel */
@@ -233,7 +234,7 @@
     assert(tb_next == NULL || PyTraceBack_Check(tb_next));
     assert(frame != NULL);
 
-    return tb_create_raw((PyTracebackObject *)tb_next, frame, frame->f_lasti,
+    return tb_create_raw((PyTracebackObject *)tb_next, frame, frame->f_lasti*sizeof(_Py_CODEUNIT),
                          PyFrame_GetLineNumber(frame));
 }
 
@@ -419,12 +420,12 @@
     if (lseek(fd, 0, SEEK_SET) == (off_t)-1) {
         Py_DECREF(io);
         Py_DECREF(binary);
-        PyMem_FREE(found_encoding);
+        PyMem_Free(found_encoding);
         return 0;
     }
     fob = _PyObject_CallMethodId(io, &PyId_TextIOWrapper, "Os", binary, encoding);
     Py_DECREF(io);
-    PyMem_FREE(found_encoding);
+    PyMem_Free(found_encoding);
 
     if (fob == NULL) {
         PyErr_Clear();
@@ -622,17 +623,18 @@
     return err;
 }
 
-/* Reverse a string. For example, "abcd" becomes "dcba".
+/* Format an integer in range [0; 0xffffffff] to decimal and write it
+   into the file fd.
 
    This function is signal safe. */
 
 void
-_Py_DumpDecimal(int fd, unsigned long value)
+_Py_DumpDecimal(int fd, size_t value)
 {
     /* maximum number of characters required for output of %lld or %p.
        We need at most ceil(log10(256)*SIZEOF_LONG_LONG) digits,
        plus 1 for the null byte.  53/22 is an upper bound for log10(256). */
-    char buffer[1 + (sizeof(unsigned long)*53-1) / 22 + 1];
+    char buffer[1 + (sizeof(size_t)*53-1) / 22 + 1];
     char *ptr, *end;
 
     end = &buffer[Py_ARRAY_LENGTH(buffer) - 1];
@@ -648,15 +650,12 @@
     _Py_write_noraise(fd, ptr, end - ptr);
 }
 
-/* Format an integer in range [0; 0xffffffff] to hexadecimal of 'width' digits,
-   and write it into the file fd.
-
-   This function is signal safe. */
-
+/* Format an integer as hexadecimal with width digits into fd file descriptor.
+   The function is signal safe. */
 void
-_Py_DumpHexadecimal(int fd, unsigned long value, Py_ssize_t width)
+_Py_DumpHexadecimal(int fd, uintptr_t value, Py_ssize_t width)
 {
-    char buffer[sizeof(unsigned long) * 2 + 1], *ptr, *end;
+    char buffer[sizeof(uintptr_t) * 2 + 1], *ptr, *end;
     const Py_ssize_t size = Py_ARRAY_LENGTH(buffer) - 1;
 
     if (width > size)
@@ -718,6 +717,26 @@
         truncated = 0;
     }
 
+    // Is an ASCII string?
+    if (ascii->state.ascii) {
+        assert(kind == PyUnicode_1BYTE_KIND);
+        char *str = data;
+
+        int need_escape = 0;
+        for (i=0; i < size; i++) {
+            ch = str[i];
+            if (!(' ' <= ch && ch <= 126)) {
+                need_escape = 1;
+                break;
+            }
+        }
+        if (!need_escape) {
+            // The string can be written with a single write() syscall
+            _Py_write_noraise(fd, str, size);
+            goto done;
+        }
+    }
+
     for (i=0; i < size; i++) {
         if (kind != PyUnicode_WCHAR_KIND)
             ch = PyUnicode_READ(kind, data, i);
@@ -741,6 +760,8 @@
             _Py_DumpHexadecimal(fd, ch, 8);
         }
     }
+
+done:
     if (truncated) {
         PUTS(fd, "...");
     }
@@ -765,11 +786,10 @@
         PUTS(fd, "???");
     }
 
-    /* PyFrame_GetLineNumber() was introduced in Python 2.7.0 and 3.2.0 */
-    int lineno = PyCode_Addr2Line(code, frame->f_lasti);
+    int lineno = PyFrame_GetLineNumber(frame);
     PUTS(fd, ", line ");
     if (lineno >= 0) {
-        _Py_DumpDecimal(fd, (unsigned long)lineno);
+        _Py_DumpDecimal(fd, (size_t)lineno);
     }
     else {
         PUTS(fd, "???");
@@ -798,26 +818,26 @@
         PUTS(fd, "Stack (most recent call first):\n");
     }
 
-    frame = PyThreadState_GetFrame(tstate);
+    // Use a borrowed reference. Avoid Py_INCREF/Py_DECREF, since this function
+    // can be called in a signal handler by the faulthandler module which must
+    // not modify Python objects.
+    frame = tstate->frame;
     if (frame == NULL) {
-        PUTS(fd, "<no Python frame>\n");
+        PUTS(fd, "  <no Python frame>\n");
         return;
     }
 
     depth = 0;
     while (1) {
         if (MAX_FRAME_DEPTH <= depth) {
-            Py_DECREF(frame);
             PUTS(fd, "  ...\n");
             break;
         }
         if (!PyFrame_Check(frame)) {
-            Py_DECREF(frame);
             break;
         }
         dump_frame(fd, frame);
-        PyFrameObject *back = PyFrame_GetBack(frame);
-        Py_DECREF(frame);
+        PyFrameObject *back = frame->f_back;
 
         if (back == NULL) {
             break;
@@ -917,6 +937,9 @@
             break;
         }
         write_thread_id(fd, tstate, tstate == current_tstate);
+        if (tstate == current_tstate && tstate->interp->gc.collecting) {
+            PUTS(fd, "  Garbage-collecting\n");
+        }
         dump_traceback(fd, tstate, 0);
         tstate = PyThreadState_Next(tstate);
         nthreads++;
diff --git a/README.rst b/README.rst
index a9ab260..9b708f1 100644
--- a/README.rst
+++ b/README.rst
@@ -1,28 +1,24 @@
-This is Python version 3.9.1
-============================
+This is Python version 3.10.3
+=============================
 
-.. image:: https://travis-ci.org/python/cpython.svg?branch=3.9
+.. image:: https://travis-ci.com/python/cpython.svg?branch=master
    :alt: CPython build status on Travis CI
-   :target: https://travis-ci.org/python/cpython
+   :target: https://travis-ci.com/python/cpython
 
 .. image:: https://github.com/python/cpython/workflows/Tests/badge.svg
    :alt: CPython build status on GitHub Actions
    :target: https://github.com/python/cpython/actions
 
-.. image:: https://dev.azure.com/python/cpython/_apis/build/status/Azure%20Pipelines%20CI?branchName=3.9
+.. image:: https://dev.azure.com/python/cpython/_apis/build/status/Azure%20Pipelines%20CI?branchName=master
    :alt: CPython build status on Azure DevOps
-   :target: https://dev.azure.com/python/cpython/_build/latest?definitionId=4&branchName=3.9
+   :target: https://dev.azure.com/python/cpython/_build/latest?definitionId=4&branchName=master
 
-.. image:: https://codecov.io/gh/python/cpython/branch/3.9/graph/badge.svg
-   :alt: CPython code coverage on Codecov
-   :target: https://codecov.io/gh/python/cpython
-
-.. image:: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
-   :alt: Python Zulip chat
-   :target: https://python.zulipchat.com
+.. image:: https://img.shields.io/badge/discourse-join_chat-brightgreen.svg
+   :alt: Python Discourse chat
+   :target: https://discuss.python.org/
 
 
-Copyright (c) 2001-2020 Python Software Foundation.  All rights reserved.
+Copyright (c) 2001-2022 Python Software Foundation.  All rights reserved.
 
 See the end of this file for further copyright and license information.
 
@@ -79,10 +75,10 @@
 
 On macOS, there are additional configure and build options related
 to macOS framework and universal builds.  Refer to `Mac/README.rst
-<https://github.com/python/cpython/blob/3.9/Mac/README.rst>`_.
+<https://github.com/python/cpython/blob/master/Mac/README.rst>`_.
 
 On Windows, see `PCbuild/readme.txt
-<https://github.com/python/cpython/blob/3.9/PCbuild/readme.txt>`_.
+<https://github.com/python/cpython/blob/master/PCbuild/readme.txt>`_.
 
 If you wish, you can create a subdirectory and invoke configure from there.
 For example::
@@ -114,12 +110,12 @@
 resulted from a previous compilation.
 
 An instrumented version of the interpreter is built, using suitable compiler
-flags for each flavour. Note that this is just an intermediary step.  The
-binary resulting from this step is not good for real life workloads as it has
+flags for each flavor. Note that this is just an intermediary step.  The
+binary resulting from this step is not good for real-life workloads as it has
 profiling instructions embedded inside.
 
 After the instrumented interpreter is built, the Makefile will run a training
-workload.  This is necessary in order to profile the interpreter execution.
+workload.  This is necessary in order to profile the interpreter's execution.
 Note also that any output, both stdout and stderr, that may appear at this step
 is suppressed.
 
@@ -141,11 +137,11 @@
 ----------
 
 We have a comprehensive overview of the changes in the `What's New in Python
-3.9 <https://docs.python.org/3.9/whatsnew/3.9.html>`_ document.  For a more
+3.10 <https://docs.python.org/3.10/whatsnew/3.10.html>`_ document.  For a more
 detailed change log, read `Misc/NEWS
-<https://github.com/python/cpython/blob/3.9/Misc/NEWS.d>`_, but a full
+<https://github.com/python/cpython/blob/master/Misc/NEWS.d>`_, but a full
 accounting of changes can only be gleaned from the `commit history
-<https://github.com/python/cpython/commits/3.9>`_.
+<https://github.com/python/cpython/commits/master>`_.
 
 If you want to install multiple versions of Python, see the section below
 entitled "Installing multiple versions".
@@ -154,7 +150,7 @@
 Documentation
 -------------
 
-`Documentation for Python 3.9 <https://docs.python.org/3.9/>`_ is online,
+`Documentation for Python 3.10 <https://docs.python.org/3.10/>`_ is online,
 updated daily.
 
 It can also be downloaded in many formats for faster access.  The documentation
@@ -163,7 +159,7 @@
 formatting requirements.
 
 For information about building Python's documentation, refer to `Doc/README.rst
-<https://github.com/python/cpython/blob/3.9/Doc/README.rst>`_.
+<https://github.com/python/cpython/blob/master/Doc/README.rst>`_.
 
 
 Converting From Python 2.x to 3.x
@@ -213,8 +209,8 @@
 version (if any) is your "primary" version.  Install that version using ``make
 install``.  Install all other versions using ``make altinstall``.
 
-For example, if you want to install Python 2.7, 3.6, and 3.9 with 3.9 being the
-primary version, you would execute ``make install`` in your 3.9 build directory
+For example, if you want to install Python 2.7, 3.6, and 3.10 with 3.10 being the
+primary version, you would execute ``make install`` in your 3.10 build directory
 and ``make altinstall`` in the others.
 
 
@@ -233,24 +229,25 @@
 -------------------------
 
 If you have a proposal to change Python, you may want to send an email to the
-comp.lang.python or `python-ideas`_ mailing lists for initial feedback.  A
+`comp.lang.python`_ or `python-ideas`_ mailing lists for initial feedback.  A
 Python Enhancement Proposal (PEP) may be submitted if your idea gains ground.
 All current PEPs, as well as guidelines for submitting a new PEP, are listed at
 `python.org/dev/peps/ <https://www.python.org/dev/peps/>`_.
 
 .. _python-ideas: https://mail.python.org/mailman/listinfo/python-ideas/
+.. _comp.lang.python: https://mail.python.org/mailman/listinfo/python-list
 
 
 Release Schedule
 ----------------
 
-See :pep:`596` for Python 3.9 release details.
+See :pep:`619` for Python 3.10 release details.
 
 
 Copyright and License Information
 ---------------------------------
 
-Copyright (c) 2001-2020 Python Software Foundation.  All rights reserved.
+Copyright (c) 2001-2022 Python Software Foundation.  All rights reserved.
 
 Copyright (c) 2000 BeOpen.com.  All rights reserved.
 
@@ -259,8 +256,9 @@
 
 Copyright (c) 1991-1995 Stichting Mathematisch Centrum.  All rights reserved.
 
-See the file "LICENSE" for information on the history of this software, terms &
-conditions for usage, and a DISCLAIMER OF ALL WARRANTIES.
+See the `LICENSE <https://github.com/python/cpython/blob/master/LICENSE>`_ for
+information on the history of this software, terms & conditions for usage, and a
+DISCLAIMER OF ALL WARRANTIES.
 
 This Python distribution contains *no* GNU General Public License (GPL) code,
 so it may be used in proprietary projects.  There are interfaces to some GNU
diff --git a/Tools/c-analyzer/README b/Tools/c-analyzer/README
index 8cf20e2..86bf1e7 100644
--- a/Tools/c-analyzer/README
+++ b/Tools/c-analyzer/README
@@ -36,6 +36,10 @@
 
   python3 Tools/c-analyzer/check-c-globals.py
 
+You can also use the more generic tool:
+
+  python3 Tools/c-analyzer/c-analyzer.py
+
 If it reports any globals then they should be resolved.  If the globals
 are runtime state then they should be folded into _PyRuntimeState.
 Otherwise they should be added to ignored-globals.txt.
diff --git a/Tools/c-analyzer/TODO b/Tools/c-analyzer/TODO
index 829daba..1fd8052 100644
--- a/Tools/c-analyzer/TODO
+++ b/Tools/c-analyzer/TODO
@@ -64,11 +64,8 @@
 Objects/tupleobject.c:_Py_fast_tuple_allocs                      Py_ssize_t _Py_fast_tuple_allocs
 Objects/tupleobject.c:_Py_tuple_zero_allocs                      Py_ssize_t _Py_tuple_zero_allocs
 Objects/typeobject.c:next_version_tag                            static unsigned int next_version_tag
-Parser/listnode.c:atbol                                          static int atbol
-Parser/listnode.c:level                                          static int level
 Python/Python-ast.c:init_types():initialized                     static int initialized
 Python/bootstrap_hash.c:urandom_cache                            static struct { int fd; dev_t st_dev; ino_t st_ino; } urandom_cache
-Python/ceval.c:_Py_CheckRecursionLimit                           int _Py_CheckRecursionLimit
 Python/ceval.c:lltrace                                           static int lltrace
 Python/ceval.c:make_pending_calls():busy                         static int busy
 Python/dynload_shlib.c:handles                                   static struct { dev_t dev; ino_t ino; void *handle; } handles[128]
@@ -157,8 +154,6 @@
 Objects/codeobject.c:PyCode_NewEmpty():nulltuple                 static PyObject *nulltuple
 Objects/dictobject.c:empty_values                                static PyObject *empty_values[1]
 Objects/listobject.c:indexerr                                    static PyObject *indexerr
-Objects/longobject.c:_PyLong_One                                 PyObject *_PyLong_One
-Objects/longobject.c:_PyLong_Zero                                PyObject *_PyLong_Zero
 Objects/longobject.c:small_ints                                  static PyLongObject small_ints[NSMALLNEGINTS + NSMALLPOSINTS]
 Objects/setobject.c:emptyfrozenset                               static PyObject *emptyfrozenset
 Python/context.c:_token_missing                                  static PyObject *_token_missing
diff --git a/Tools/c-analyzer/c-analyzer.py b/Tools/c-analyzer/c-analyzer.py
new file mode 100644
index 0000000..4a5e88c
--- /dev/null
+++ b/Tools/c-analyzer/c-analyzer.py
@@ -0,0 +1,7 @@
+from cpython.__main__ import parse_args, main, configure_logger
+
+
+cmd, cmd_kwargs, verbosity, traceback_cm = parse_args()
+configure_logger(verbosity)
+with traceback_cm:
+    main(cmd, cmd_kwargs)
diff --git a/Tools/c-analyzer/c-globals.py b/Tools/c-analyzer/c-globals.py
deleted file mode 100644
index b36b791..0000000
--- a/Tools/c-analyzer/c-globals.py
+++ /dev/null
@@ -1,9 +0,0 @@
-# This is a script equivalent of running "python -m test.test_c_globals.cg".
-
-from cpython.__main__ import parse_args, main
-
-
-# This is effectively copied from cg/__main__.py:
-if __name__ == '__main__':
-    cmd, cmdkwargs = parse_args()
-    main(cmd, cmdkwargs)
diff --git a/Tools/c-analyzer/c_analyzer/__init__.py b/Tools/c-analyzer/c_analyzer/__init__.py
index e69de29..171fa25 100644
--- a/Tools/c-analyzer/c_analyzer/__init__.py
+++ b/Tools/c-analyzer/c_analyzer/__init__.py
@@ -0,0 +1,105 @@
+from c_parser import (
+    parse_files as _parse_files,
+)
+from c_parser.info import (
+    KIND,
+    TypeDeclaration,
+    resolve_parsed,
+)
+from c_parser.match import (
+    filter_by_kind,
+    group_by_kinds,
+)
+from . import (
+    analyze as _analyze,
+    datafiles as _datafiles,
+)
+from .info import Analysis
+
+
+def analyze(filenmes, **kwargs):
+    results = iter_analyis_results(filenames, **kwargs)
+    return Analysis.from_results(results)
+
+
+def iter_analysis_results(filenmes, *,
+                          known=None,
+                          **kwargs
+                          ):
+    decls = iter_decls(filenames, **kwargs)
+    yield from analyze_decls(decls, known)
+
+
+def iter_decls(filenames, *,
+               kinds=None,
+               parse_files=_parse_files,
+               **kwargs
+               ):
+    kinds = KIND.DECLS if kinds is None else (KIND.DECLS & set(kinds))
+    parse_files = parse_files or _parse_files
+
+    parsed = parse_files(filenames, **kwargs)
+    parsed = filter_by_kind(parsed, kinds)
+    for item in parsed:
+        yield resolve_parsed(item)
+
+
+def analyze_decls(decls, known, *,
+                  analyze_resolved=None,
+                  handle_unresolved=True,
+                  relroot=None,
+                  ):
+    knowntypes, knowntypespecs = _datafiles.get_known(
+        known,
+        handle_unresolved=handle_unresolved,
+        analyze_resolved=analyze_resolved,
+        relroot=relroot,
+    )
+
+    decls = list(decls)
+    collated = group_by_kinds(decls)
+
+    types = {decl: None for decl in collated['type']}
+    typespecs = _analyze.get_typespecs(types)
+
+    def analyze_decl(decl):
+        return _analyze.analyze_decl(
+            decl,
+            typespecs,
+            knowntypespecs,
+            types,
+            knowntypes,
+            analyze_resolved=analyze_resolved,
+        )
+    _analyze.analyze_type_decls(types, analyze_decl, handle_unresolved)
+    for decl in decls:
+        if decl in types:
+            resolved = types[decl]
+        else:
+            resolved = analyze_decl(decl)
+            if resolved and handle_unresolved:
+                typedeps, _ = resolved
+                if not isinstance(typedeps, TypeDeclaration):
+                    if not typedeps or None in typedeps:
+                        raise NotImplementedError((decl, resolved))
+
+        yield decl, resolved
+
+
+#######################################
+# checks
+
+def check_all(analysis, checks, *, failfast=False):
+    for check in checks or ():
+        for data, failure in check(analysis):
+            if failure is None:
+                continue
+
+            yield data, failure
+            if failfast:
+                yield None, None
+                break
+        else:
+            continue
+        # We failed fast.
+        break
diff --git a/Tools/c-analyzer/c_analyzer/__main__.py b/Tools/c-analyzer/c_analyzer/__main__.py
new file mode 100644
index 0000000..5d89b29
--- /dev/null
+++ b/Tools/c-analyzer/c_analyzer/__main__.py
@@ -0,0 +1,540 @@
+import io
+import logging
+import os
+import os.path
+import re
+import sys
+
+from c_common import fsutil
+from c_common.logging import VERBOSITY, Printer
+from c_common.scriptutil import (
+    add_verbosity_cli,
+    add_traceback_cli,
+    add_sepval_cli,
+    add_progress_cli,
+    add_files_cli,
+    add_commands_cli,
+    process_args_by_key,
+    configure_logger,
+    get_prog,
+    filter_filenames,
+    iter_marks,
+)
+from c_parser.info import KIND
+from c_parser.match import is_type_decl
+from .match import filter_forward
+from . import (
+    analyze as _analyze,
+    datafiles as _datafiles,
+    check_all as _check_all,
+)
+
+
+KINDS = [
+    KIND.TYPEDEF,
+    KIND.STRUCT,
+    KIND.UNION,
+    KIND.ENUM,
+    KIND.FUNCTION,
+    KIND.VARIABLE,
+    KIND.STATEMENT,
+]
+
+logger = logging.getLogger(__name__)
+
+
+#######################################
+# table helpers
+
+TABLE_SECTIONS = {
+    'types': (
+        ['kind', 'name', 'data', 'file'],
+        KIND.is_type_decl,
+        (lambda v: (v.kind.value, v.filename or '', v.name)),
+    ),
+    'typedefs': 'types',
+    'structs': 'types',
+    'unions': 'types',
+    'enums': 'types',
+    'functions': (
+        ['name', 'data', 'file'],
+        (lambda kind: kind is KIND.FUNCTION),
+        (lambda v: (v.filename or '', v.name)),
+    ),
+    'variables': (
+        ['name', 'parent', 'data', 'file'],
+        (lambda kind: kind is KIND.VARIABLE),
+        (lambda v: (v.filename or '', str(v.parent) if v.parent else '', v.name)),
+    ),
+    'statements': (
+        ['file', 'parent', 'data'],
+        (lambda kind: kind is KIND.STATEMENT),
+        (lambda v: (v.filename or '', str(v.parent) if v.parent else '', v.name)),
+    ),
+    KIND.TYPEDEF: 'typedefs',
+    KIND.STRUCT: 'structs',
+    KIND.UNION: 'unions',
+    KIND.ENUM: 'enums',
+    KIND.FUNCTION: 'functions',
+    KIND.VARIABLE: 'variables',
+    KIND.STATEMENT: 'statements',
+}
+
+
+def _render_table(items, columns, relroot=None):
+    # XXX improve this
+    header = '\t'.join(columns)
+    div = '--------------------'
+    yield header
+    yield div
+    total = 0
+    for item in items:
+        rowdata = item.render_rowdata(columns)
+        row = [rowdata[c] for c in columns]
+        if relroot and 'file' in columns:
+            index = columns.index('file')
+            row[index] = os.path.relpath(row[index], relroot)
+        yield '\t'.join(row)
+        total += 1
+    yield div
+    yield f'total: {total}'
+
+
+def build_section(name, groupitems, *, relroot=None):
+    info = TABLE_SECTIONS[name]
+    while type(info) is not tuple:
+        if name in KINDS:
+            name = info
+        info = TABLE_SECTIONS[info]
+
+    columns, match_kind, sortkey = info
+    items = (v for v in groupitems if match_kind(v.kind))
+    items = sorted(items, key=sortkey)
+    def render():
+        yield ''
+        yield f'{name}:'
+        yield ''
+        for line in _render_table(items, columns, relroot):
+            yield line
+    return items, render
+
+
+#######################################
+# the checks
+
+CHECKS = {
+    #'globals': _check_globals,
+}
+
+
+def add_checks_cli(parser, checks=None, *, add_flags=None):
+    default = False
+    if not checks:
+        checks = list(CHECKS)
+        default = True
+    elif isinstance(checks, str):
+        checks = [checks]
+    if (add_flags is None and len(checks) > 1) or default:
+        add_flags = True
+
+    process_checks = add_sepval_cli(parser, '--check', 'checks', checks)
+    if add_flags:
+        for check in checks:
+            parser.add_argument(f'--{check}', dest='checks',
+                                action='append_const', const=check)
+    return [
+        process_checks,
+    ]
+
+
+def _get_check_handlers(fmt, printer, verbosity=VERBOSITY):
+    div = None
+    def handle_after():
+        pass
+    if not fmt:
+        div = ''
+        def handle_failure(failure, data):
+            data = repr(data)
+            if verbosity >= 3:
+                logger.info(f'failure: {failure}')
+                logger.info(f'data:    {data}')
+            else:
+                logger.warn(f'failure: {failure} (data: {data})')
+    elif fmt == 'raw':
+        def handle_failure(failure, data):
+            print(f'{failure!r} {data!r}')
+    elif fmt == 'brief':
+        def handle_failure(failure, data):
+            parent = data.parent or ''
+            funcname = parent if isinstance(parent, str) else parent.name
+            name = f'({funcname}).{data.name}' if funcname else data.name
+            failure = failure.split('\t')[0]
+            print(f'{data.filename}:{name} - {failure}')
+    elif fmt == 'summary':
+        def handle_failure(failure, data):
+            print(_fmt_one_summary(data, failure))
+    elif fmt == 'full':
+        div = ''
+        def handle_failure(failure, data):
+            name = data.shortkey if data.kind is KIND.VARIABLE else data.name
+            parent = data.parent or ''
+            funcname = parent if isinstance(parent, str) else parent.name
+            known = 'yes' if data.is_known else '*** NO ***'
+            print(f'{data.kind.value} {name!r} failed ({failure})')
+            print(f'  file:         {data.filename}')
+            print(f'  func:         {funcname or "-"}')
+            print(f'  name:         {data.name}')
+            print(f'  data:         ...')
+            print(f'  type unknown: {known}')
+    else:
+        if fmt in FORMATS:
+            raise NotImplementedError(fmt)
+        raise ValueError(f'unsupported fmt {fmt!r}')
+    return handle_failure, handle_after, div
+
+
+#######################################
+# the formats
+
+def fmt_raw(analysis):
+    for item in analysis:
+        yield from item.render('raw')
+
+
+def fmt_brief(analysis):
+    # XXX Support sorting.
+    items = sorted(analysis)
+    for kind in KINDS:
+        if kind is KIND.STATEMENT:
+            continue
+        for item in items:
+            if item.kind is not kind:
+                continue
+            yield from item.render('brief')
+    yield f'  total: {len(items)}'
+
+
+def fmt_summary(analysis):
+    # XXX Support sorting and grouping.
+    items = list(analysis)
+    total = len(items)
+
+    def section(name):
+        _, render = build_section(name, items)
+        yield from render()
+
+    yield from section('types')
+    yield from section('functions')
+    yield from section('variables')
+    yield from section('statements')
+
+    yield ''
+#    yield f'grand total: {len(supported) + len(unsupported)}'
+    yield f'grand total: {total}'
+
+
+def _fmt_one_summary(item, extra=None):
+    parent = item.parent or ''
+    funcname = parent if isinstance(parent, str) else parent.name
+    if extra:
+        return f'{item.filename:35}\t{funcname or "-":35}\t{item.name:40}\t{extra}'
+    else:
+        return f'{item.filename:35}\t{funcname or "-":35}\t{item.name}'
+
+
+def fmt_full(analysis):
+    # XXX Support sorting.
+    items = sorted(analysis, key=lambda v: v.key)
+    yield ''
+    for item in items:
+        yield from item.render('full')
+        yield ''
+    yield f'total: {len(items)}'
+
+
+FORMATS = {
+    'raw': fmt_raw,
+    'brief': fmt_brief,
+    'summary': fmt_summary,
+    'full': fmt_full,
+}
+
+
+def add_output_cli(parser, *, default='summary'):
+    parser.add_argument('--format', dest='fmt', default=default, choices=tuple(FORMATS))
+
+    def process_args(args, *, argv=None):
+        pass
+    return process_args
+
+
+#######################################
+# the commands
+
+def _cli_check(parser, checks=None, **kwargs):
+    if isinstance(checks, str):
+        checks = [checks]
+    if checks is False:
+        process_checks = None
+    elif checks is None:
+        process_checks = add_checks_cli(parser)
+    elif len(checks) == 1 and type(checks) is not dict and re.match(r'^<.*>$', checks[0]):
+        check = checks[0][1:-1]
+        def process_checks(args, *, argv=None):
+            args.checks = [check]
+    else:
+        process_checks = add_checks_cli(parser, checks=checks)
+    process_progress = add_progress_cli(parser)
+    process_output = add_output_cli(parser, default=None)
+    process_files = add_files_cli(parser, **kwargs)
+    return [
+        process_checks,
+        process_progress,
+        process_output,
+        process_files,
+    ]
+
+
+def cmd_check(filenames, *,
+              checks=None,
+              ignored=None,
+              fmt=None,
+              failfast=False,
+              iter_filenames=None,
+              relroot=fsutil.USE_CWD,
+              track_progress=None,
+              verbosity=VERBOSITY,
+              _analyze=_analyze,
+              _CHECKS=CHECKS,
+              **kwargs
+              ):
+    if not checks:
+        checks = _CHECKS
+    elif isinstance(checks, str):
+        checks = [checks]
+    checks = [_CHECKS[c] if isinstance(c, str) else c
+              for c in checks]
+    printer = Printer(verbosity)
+    (handle_failure, handle_after, div
+     ) = _get_check_handlers(fmt, printer, verbosity)
+
+    filenames, relroot = fsutil.fix_filenames(filenames, relroot=relroot)
+    filenames = filter_filenames(filenames, iter_filenames, relroot)
+    if track_progress:
+        filenames = track_progress(filenames)
+
+    logger.info('analyzing files...')
+    analyzed = _analyze(filenames, **kwargs)
+    analyzed.fix_filenames(relroot, normalize=False)
+    decls = filter_forward(analyzed, markpublic=True)
+
+    logger.info('checking analysis results...')
+    failed = []
+    for data, failure in _check_all(decls, checks, failfast=failfast):
+        if data is None:
+            printer.info('stopping after one failure')
+            break
+        if div is not None and len(failed) > 0:
+            printer.info(div)
+        failed.append(data)
+        handle_failure(failure, data)
+    handle_after()
+
+    printer.info('-------------------------')
+    logger.info(f'total failures: {len(failed)}')
+    logger.info('done checking')
+
+    if fmt == 'summary':
+        print('Categorized by storage:')
+        print()
+        from .match import group_by_storage
+        grouped = group_by_storage(failed, ignore_non_match=False)
+        for group, decls in grouped.items():
+            print()
+            print(group)
+            for decl in decls:
+                print(' ', _fmt_one_summary(decl))
+            print(f'subtotal: {len(decls)}')
+
+    if len(failed) > 0:
+        sys.exit(len(failed))
+
+
+def _cli_analyze(parser, **kwargs):
+    process_progress = add_progress_cli(parser)
+    process_output = add_output_cli(parser)
+    process_files = add_files_cli(parser, **kwargs)
+    return [
+        process_progress,
+        process_output,
+        process_files,
+    ]
+
+
+# XXX Support filtering by kind.
+def cmd_analyze(filenames, *,
+                fmt=None,
+                iter_filenames=None,
+                relroot=fsutil.USE_CWD,
+                track_progress=None,
+                verbosity=None,
+                _analyze=_analyze,
+                formats=FORMATS,
+                **kwargs
+                ):
+    verbosity = verbosity if verbosity is not None else 3
+
+    try:
+        do_fmt = formats[fmt]
+    except KeyError:
+        raise ValueError(f'unsupported fmt {fmt!r}')
+
+    filenames, relroot = fsutil.fix_filenames(filenames, relroot=relroot)
+    filenames = filter_filenames(filenames, iter_filenames, relroot)
+    if track_progress:
+        filenames = track_progress(filenames)
+
+    logger.info('analyzing files...')
+    analyzed = _analyze(filenames, **kwargs)
+    analyzed.fix_filenames(relroot, normalize=False)
+    decls = filter_forward(analyzed, markpublic=True)
+
+    for line in do_fmt(decls):
+        print(line)
+
+
+def _cli_data(parser, filenames=None, known=None):
+    ArgumentParser = type(parser)
+    common = ArgumentParser(add_help=False)
+    # These flags will get processed by the top-level parse_args().
+    add_verbosity_cli(common)
+    add_traceback_cli(common)
+
+    subs = parser.add_subparsers(dest='datacmd')
+
+    sub = subs.add_parser('show', parents=[common])
+    if known is None:
+        sub.add_argument('--known', required=True)
+    if filenames is None:
+        sub.add_argument('filenames', metavar='FILE', nargs='+')
+
+    sub = subs.add_parser('dump', parents=[common])
+    if known is None:
+        sub.add_argument('--known')
+    sub.add_argument('--show', action='store_true')
+    process_progress = add_progress_cli(sub)
+
+    sub = subs.add_parser('check', parents=[common])
+    if known is None:
+        sub.add_argument('--known', required=True)
+
+    def process_args(args, *, argv):
+        if args.datacmd == 'dump':
+            process_progress(args, argv)
+    return process_args
+
+
+def cmd_data(datacmd, filenames, known=None, *,
+             _analyze=_analyze,
+             formats=FORMATS,
+             extracolumns=None,
+             relroot=fsutil.USE_CWD,
+             track_progress=None,
+             **kwargs
+             ):
+    kwargs.pop('verbosity', None)
+    usestdout = kwargs.pop('show', None)
+    if datacmd == 'show':
+        do_fmt = formats['summary']
+        if isinstance(known, str):
+            known, _ = _datafiles.get_known(known, extracolumns, relroot)
+        for line in do_fmt(known):
+            print(line)
+    elif datacmd == 'dump':
+        filenames, relroot = fsutil.fix_filenames(filenames, relroot=relroot)
+        if track_progress:
+            filenames = track_progress(filenames)
+        analyzed = _analyze(filenames, **kwargs)
+        analyzed.fix_filenames(relroot, normalize=False)
+        if known is None or usestdout:
+            outfile = io.StringIO()
+            _datafiles.write_known(analyzed, outfile, extracolumns,
+                                   relroot=relroot)
+            print(outfile.getvalue())
+        else:
+            _datafiles.write_known(analyzed, known, extracolumns,
+                                   relroot=relroot)
+    elif datacmd == 'check':
+        raise NotImplementedError(datacmd)
+    else:
+        raise ValueError(f'unsupported data command {datacmd!r}')
+
+
+COMMANDS = {
+    'check': (
+        'analyze and fail if the given C source/header files have any problems',
+        [_cli_check],
+        cmd_check,
+    ),
+    'analyze': (
+        'report on the state of the given C source/header files',
+        [_cli_analyze],
+        cmd_analyze,
+    ),
+    'data': (
+        'check/manage local data (e.g. known types, ignored vars, caches)',
+        [_cli_data],
+        cmd_data,
+    ),
+}
+
+
+#######################################
+# the script
+
+def parse_args(argv=sys.argv[1:], prog=sys.argv[0], *, subset=None):
+    import argparse
+    parser = argparse.ArgumentParser(
+        prog=prog or get_prog(),
+    )
+
+    processors = add_commands_cli(
+        parser,
+        commands={k: v[1] for k, v in COMMANDS.items()},
+        commonspecs=[
+            add_verbosity_cli,
+            add_traceback_cli,
+        ],
+        subset=subset,
+    )
+
+    args = parser.parse_args(argv)
+    ns = vars(args)
+
+    cmd = ns.pop('cmd')
+
+    verbosity, traceback_cm = process_args_by_key(
+        args,
+        argv,
+        processors[cmd],
+        ['verbosity', 'traceback_cm'],
+    )
+    # "verbosity" is sent to the commands, so we put it back.
+    args.verbosity = verbosity
+
+    return cmd, ns, verbosity, traceback_cm
+
+
+def main(cmd, cmd_kwargs):
+    try:
+        run_cmd = COMMANDS[cmd][0]
+    except KeyError:
+        raise ValueError(f'unsupported cmd {cmd!r}')
+    run_cmd(**cmd_kwargs)
+
+
+if __name__ == '__main__':
+    cmd, cmd_kwargs, verbosity, traceback_cm = parse_args()
+    configure_logger(verbosity)
+    with traceback_cm:
+        main(cmd, cmd_kwargs)
diff --git a/Tools/c-analyzer/c_analyzer/analyze.py b/Tools/c-analyzer/c_analyzer/analyze.py
new file mode 100644
index 0000000..267d058
--- /dev/null
+++ b/Tools/c-analyzer/c_analyzer/analyze.py
@@ -0,0 +1,311 @@
+from c_parser.info import (
+    KIND,
+    TypeDeclaration,
+    POTSType,
+    FuncPtr,
+)
+from c_parser.match import (
+    is_pots,
+    is_funcptr,
+)
+from .info import (
+    IGNORED,
+    UNKNOWN,
+    SystemType,
+)
+from .match import (
+    is_system_type,
+)
+
+
+def get_typespecs(typedecls):
+    typespecs = {}
+    for decl in typedecls:
+        if decl.shortkey not in typespecs:
+            typespecs[decl.shortkey] = [decl]
+        else:
+            typespecs[decl.shortkey].append(decl)
+    return typespecs
+
+
+def analyze_decl(decl, typespecs, knowntypespecs, types, knowntypes, *,
+                 analyze_resolved=None):
+    resolved = resolve_decl(decl, typespecs, knowntypespecs, types)
+    if resolved is None:
+        # The decl is supposed to be skipped or ignored.
+        return None
+    if analyze_resolved is None:
+        return resolved, None
+    return analyze_resolved(resolved, decl, types, knowntypes)
+
+# This alias helps us avoid name collisions.
+_analyze_decl = analyze_decl
+
+
+def analyze_type_decls(types, analyze_decl, handle_unresolved=True):
+    unresolved = set(types)
+    while unresolved:
+        updated = []
+        for decl in unresolved:
+            resolved = analyze_decl(decl)
+            if resolved is None:
+                # The decl should be skipped or ignored.
+                types[decl] = IGNORED
+                updated.append(decl)
+                continue
+            typedeps, _ = resolved
+            if typedeps is None:
+                raise NotImplementedError(decl)
+            if UNKNOWN in typedeps:
+                # At least one dependency is unknown, so this decl
+                # is not resolvable.
+                types[decl] = UNKNOWN
+                updated.append(decl)
+                continue
+            if None in typedeps:
+                # XXX
+                # Handle direct recursive types first.
+                nonrecursive = 1
+                if decl.kind is KIND.STRUCT or decl.kind is KIND.UNION:
+                    nonrecursive = 0
+                    i = 0
+                    for member, dep in zip(decl.members, typedeps):
+                        if dep is None:
+                            if member.vartype.typespec != decl.shortkey:
+                                nonrecursive += 1
+                            else:
+                                typedeps[i] = decl
+                        i += 1
+                if nonrecursive:
+                    # We don't have all dependencies resolved yet.
+                    continue
+            types[decl] = resolved
+            updated.append(decl)
+        if updated:
+            for decl in updated:
+                unresolved.remove(decl)
+        else:
+            # XXX
+            # Handle indirect recursive types.
+            ...
+            # We couldn't resolve the rest.
+            # Let the caller deal with it!
+            break
+    if unresolved and handle_unresolved:
+        if handle_unresolved is True:
+            handle_unresolved = _handle_unresolved
+        handle_unresolved(unresolved, types, analyze_decl)
+
+
+def resolve_decl(decl, typespecs, knowntypespecs, types):
+    if decl.kind is KIND.ENUM:
+        typedeps = []
+    else:
+        if decl.kind is KIND.VARIABLE:
+            vartypes = [decl.vartype]
+        elif decl.kind is KIND.FUNCTION:
+            vartypes = [decl.signature.returntype]
+        elif decl.kind is KIND.TYPEDEF:
+            vartypes = [decl.vartype]
+        elif decl.kind is KIND.STRUCT or decl.kind is KIND.UNION:
+            vartypes = [m.vartype for m in decl.members]
+        else:
+            # Skip this one!
+            return None
+
+        typedeps = []
+        for vartype in vartypes:
+            typespec = vartype.typespec
+            if is_pots(typespec):
+                typedecl = POTSType(typespec)
+            elif is_system_type(typespec):
+                typedecl = SystemType(typespec)
+            elif is_funcptr(vartype):
+                typedecl = FuncPtr(vartype)
+            else:
+                typedecl = find_typedecl(decl, typespec, typespecs)
+                if typedecl is None:
+                    typedecl = find_typedecl(decl, typespec, knowntypespecs)
+                elif not isinstance(typedecl, TypeDeclaration):
+                    raise NotImplementedError(repr(typedecl))
+                if typedecl is None:
+                    # We couldn't find it!
+                    typedecl = UNKNOWN
+                elif typedecl not in types:
+                    # XXX How can this happen?
+                    typedecl = UNKNOWN
+                elif types[typedecl] is UNKNOWN:
+                    typedecl = UNKNOWN
+                elif types[typedecl] is IGNORED:
+                    # We don't care if it didn't resolve.
+                    pass
+                elif types[typedecl] is None:
+                    # The typedecl for the typespec hasn't been resolved yet.
+                    typedecl = None
+            typedeps.append(typedecl)
+    return typedeps
+
+
+def find_typedecl(decl, typespec, typespecs):
+    specdecls = typespecs.get(typespec)
+    if not specdecls:
+        return None
+
+    filename = decl.filename
+
+    if len(specdecls) == 1:
+        typedecl, = specdecls
+        if '-' in typespec and typedecl.filename != filename:
+            # Inlined types are always in the same file.
+            return None
+        return typedecl
+
+    # Decide which one to return.
+    candidates = []
+    samefile = None
+    for typedecl in specdecls:
+        type_filename = typedecl.filename
+        if type_filename == filename:
+            if samefile is not None:
+                # We expect type names to be unique in a file.
+                raise NotImplementedError((decl, samefile, typedecl))
+            samefile = typedecl
+        elif filename.endswith('.c') and not type_filename.endswith('.h'):
+            # If the decl is in a source file then we expect the
+            # type to be in the same file or in a header file.
+            continue
+        candidates.append(typedecl)
+    if not candidates:
+        return None
+    elif len(candidates) == 1:
+        winner, = candidates
+        # XXX Check for inline?
+    elif '-' in typespec:
+        # Inlined types are always in the same file.
+        winner = samefile
+    elif samefile is not None:
+        # Favor types in the same file.
+        winner = samefile
+    else:
+        # We don't know which to return.
+        raise NotImplementedError((decl, candidates))
+
+    return winner
+
+
+#############################
+# handling unresolved decls
+
+class Skipped(TypeDeclaration):
+    def __init__(self):
+        _file = _name = _data = _parent = None
+        super().__init__(_file, _name, _data, _parent, _shortkey='<skipped>')
+_SKIPPED = Skipped()
+del Skipped
+
+
+def _handle_unresolved(unresolved, types, analyze_decl):
+    #raise NotImplementedError(unresolved)
+
+    dump = True
+    dump = False
+    if dump:
+        print()
+    for decl in types:  # Preserve the original order.
+        if decl not in unresolved:
+            assert types[decl] is not None, decl
+            if types[decl] in (UNKNOWN, IGNORED):
+                unresolved.add(decl)
+                if dump:
+                    _dump_unresolved(decl, types, analyze_decl)
+                    print()
+            else:
+                assert types[decl][0] is not None, (decl, types[decl])
+                assert None not in types[decl][0], (decl, types[decl])
+        else:
+            assert types[decl] is None
+            if dump:
+                _dump_unresolved(decl, types, analyze_decl)
+                print()
+    #raise NotImplementedError
+
+    for decl in unresolved:
+        types[decl] = ([_SKIPPED], None)
+
+    for decl in types:
+        assert types[decl]
+
+
+def _dump_unresolved(decl, types, analyze_decl):
+    if isinstance(decl, str):
+        typespec = decl
+        decl, = (d for d in types if d.shortkey == typespec)
+    elif type(decl) is tuple:
+        filename, typespec = decl
+        if '-' in typespec:
+            found = [d for d in types
+                     if d.shortkey == typespec and d.filename == filename]
+            #if not found:
+            #    raise NotImplementedError(decl)
+            decl, = found
+        else:
+            found = [d for d in types if d.shortkey == typespec]
+            if not found:
+                print(f'*** {typespec} ???')
+                return
+                #raise NotImplementedError(decl)
+            else:
+                decl, = found
+    resolved = analyze_decl(decl)
+    if resolved:
+        typedeps, _ = resolved or (None, None)
+
+    if decl.kind is KIND.STRUCT or decl.kind is KIND.UNION:
+        print(f'*** {decl.shortkey} {decl.filename}')
+        for member, mtype in zip(decl.members, typedeps):
+            typespec = member.vartype.typespec
+            if typespec == decl.shortkey:
+                print(f'     ~~~~: {typespec:20} - {member!r}')
+                continue
+            status = None
+            if is_pots(typespec):
+                mtype = typespec
+                status = 'okay'
+            elif is_system_type(typespec):
+                mtype = typespec
+                status = 'okay'
+            elif mtype is None:
+                if '-' in member.vartype.typespec:
+                    mtype, = [d for d in types
+                              if d.shortkey == member.vartype.typespec
+                              and d.filename == decl.filename]
+                else:
+                    found = [d for d in types
+                             if d.shortkey == typespec]
+                    if not found:
+                        print(f' ???: {typespec:20}')
+                        continue
+                    mtype, = found
+            if status is None:
+                status = 'okay' if types.get(mtype) else 'oops'
+            if mtype is _SKIPPED:
+                status = 'okay'
+                mtype = '<skipped>'
+            elif isinstance(mtype, FuncPtr):
+                status = 'okay'
+                mtype = str(mtype.vartype)
+            elif not isinstance(mtype, str):
+                if hasattr(mtype, 'vartype'):
+                    if is_funcptr(mtype.vartype):
+                        status = 'okay'
+                mtype = str(mtype).rpartition('(')[0].rstrip()
+            status = '    okay' if status == 'okay' else f'--> {status}'
+            print(f' {status}: {typespec:20} - {member!r} ({mtype})')
+    else:
+        print(f'*** {decl} ({decl.vartype!r})')
+        if decl.vartype.typespec.startswith('struct ') or is_funcptr(decl):
+            _dump_unresolved(
+                (decl.filename, decl.vartype.typespec),
+                types,
+                analyze_decl,
+            )
diff --git a/Tools/c-analyzer/c_analyzer/common/files.py b/Tools/c-analyzer/c_analyzer/common/files.py
deleted file mode 100644
index a8a0447..0000000
--- a/Tools/c-analyzer/c_analyzer/common/files.py
+++ /dev/null
@@ -1,124 +0,0 @@
-import glob
-import os
-import os.path
-
-# XXX need tests:
-# * walk_tree()
-# * glob_tree()
-# * iter_files_by_suffix()
-
-
-C_SOURCE_SUFFIXES = ('.c', '.h')
-
-
-def _walk_tree(root, *,
-               _walk=os.walk,
-               ):
-    # A wrapper around os.walk that resolves the filenames.
-    for parent, _, names in _walk(root):
-        for name in names:
-            yield os.path.join(parent, name)
-
-
-def walk_tree(root, *,
-              suffix=None,
-              walk=_walk_tree,
-              ):
-    """Yield each file in the tree under the given directory name.
-
-    If "suffix" is provided then only files with that suffix will
-    be included.
-    """
-    if suffix and not isinstance(suffix, str):
-        raise ValueError('suffix must be a string')
-
-    for filename in walk(root):
-        if suffix and not filename.endswith(suffix):
-            continue
-        yield filename
-
-
-def glob_tree(root, *,
-              suffix=None,
-              _glob=glob.iglob,
-              _escape=glob.escape,
-              _join=os.path.join,
-              ):
-    """Yield each file in the tree under the given directory name.
-
-    If "suffix" is provided then only files with that suffix will
-    be included.
-    """
-    suffix = suffix or ''
-    if not isinstance(suffix, str):
-        raise ValueError('suffix must be a string')
-
-    for filename in _glob(_join(_escape(root), f'*{suffix}')):
-        yield filename
-    for filename in _glob(_join(_escape(root), f'**/*{suffix}')):
-        yield filename
-
-
-def iter_files(root, suffix=None, relparent=None, *,
-               get_files=None,
-               _glob=glob_tree,
-               _walk=walk_tree,
-               ):
-    """Yield each file in the tree under the given directory name.
-
-    If "root" is a non-string iterable then do the same for each of
-    those trees.
-
-    If "suffix" is provided then only files with that suffix will
-    be included.
-
-    if "relparent" is provided then it is used to resolve each
-    filename as a relative path.
-    """
-    if get_files is None:
-        get_files = os.walk
-    if not isinstance(root, str):
-        roots = root
-        for root in roots:
-            yield from iter_files(root, suffix, relparent,
-                                  get_files=get_files,
-                                  _glob=_glob, _walk=_walk)
-        return
-
-    # Use the right "walk" function.
-    if get_files in (glob.glob, glob.iglob, glob_tree):
-        get_files = _glob
-    else:
-        _files = _walk_tree if get_files in (os.walk, walk_tree) else get_files
-        get_files = (lambda *a, **k: _walk(*a, walk=_files, **k))
-
-    # Handle a single suffix.
-    if suffix and not isinstance(suffix, str):
-        filenames = get_files(root)
-        suffix = tuple(suffix)
-    else:
-        filenames = get_files(root, suffix=suffix)
-        suffix = None
-
-    for filename in filenames:
-        if suffix and not isinstance(suffix, str):  # multiple suffixes
-            if not filename.endswith(suffix):
-                continue
-        if relparent:
-            filename = os.path.relpath(filename, relparent)
-        yield filename
-
-
-def iter_files_by_suffix(root, suffixes, relparent=None, *,
-                         walk=walk_tree,
-                         _iter_files=iter_files,
-                         ):
-    """Yield each file in the tree that has the given suffixes.
-
-    Unlike iter_files(), the results are in the original suffix order.
-    """
-    if isinstance(suffixes, str):
-        suffixes = [suffixes]
-    # XXX Ignore repeated suffixes?
-    for suffix in suffixes:
-        yield from _iter_files(root, suffix, relparent)
diff --git a/Tools/c-analyzer/c_analyzer/common/info.py b/Tools/c-analyzer/c_analyzer/common/info.py
deleted file mode 100644
index 3f3f8c5..0000000
--- a/Tools/c-analyzer/c_analyzer/common/info.py
+++ /dev/null
@@ -1,138 +0,0 @@
-from collections import namedtuple
-import re
-
-from .util import classonly, _NTBase
-
-# XXX need tests:
-# * ID.match()
-
-
-UNKNOWN = '???'
-
-NAME_RE = re.compile(r'^([a-zA-Z]|_\w*[a-zA-Z]\w*|[a-zA-Z]\w*)$')
-
-
-class ID(_NTBase, namedtuple('ID', 'filename funcname name')):
-    """A unique ID for a single symbol or declaration."""
-
-    __slots__ = ()
-    # XXX Add optional conditions (tuple of strings) field.
-    #conditions = Slot()
-
-    @classonly
-    def from_raw(cls, raw):
-        if not raw:
-            return None
-        if isinstance(raw, str):
-            return cls(None, None, raw)
-        try:
-            name, = raw
-            filename = None
-        except ValueError:
-            try:
-                filename, name = raw
-            except ValueError:
-                return super().from_raw(raw)
-        return cls(filename, None, name)
-
-    def __new__(cls, filename, funcname, name):
-        self = super().__new__(
-                cls,
-                filename=str(filename) if filename else None,
-                funcname=str(funcname) if funcname else None,
-                name=str(name) if name else None,
-                )
-        #cls.conditions.set(self, tuple(str(s) if s else None
-        #                               for s in conditions or ()))
-        return self
-
-    def validate(self):
-        """Fail if the object is invalid (i.e. init with bad data)."""
-        if not self.name:
-            raise TypeError('missing name')
-        else:
-            if not NAME_RE.match(self.name):
-                raise ValueError(
-                        f'name must be an identifier, got {self.name!r}')
-
-        # Symbols from a binary might not have filename/funcname info.
-
-        if self.funcname:
-            if not self.filename:
-                raise TypeError('missing filename')
-            if not NAME_RE.match(self.funcname) and self.funcname != UNKNOWN:
-                raise ValueError(
-                        f'name must be an identifier, got {self.funcname!r}')
-
-        # XXX Require the filename (at least UNKONWN)?
-        # XXX Check the filename?
-
-    @property
-    def islocal(self):
-        return self.funcname is not None
-
-    def match(self, other, *,
-              match_files=(lambda f1, f2: f1 == f2),
-              ):
-        """Return True if the two match.
-
-        At least one of the two must be completely valid (no UNKNOWN
-        anywhere).  Otherwise False is returned.  The remaining one
-        *may* have UNKNOWN for both funcname and filename.  It must
-        have a valid name though.
-
-        The caller is responsible for knowing which of the two is valid
-        (and which to use if both are valid).
-        """
-        # First check the name.
-        if self.name is None:
-            return False
-        if other.name != self.name:
-            return False
-
-        # Then check the filename.
-        if self.filename is None:
-            return False
-        if other.filename is None:
-            return False
-        if self.filename == UNKNOWN:
-            # "other" must be the valid one.
-            if other.funcname == UNKNOWN:
-                return False
-            elif self.funcname != UNKNOWN:
-                # XXX Try matching funcname even though we don't
-                # know the filename?
-                raise NotImplementedError
-            else:
-                return True
-        elif other.filename == UNKNOWN:
-            # "self" must be the valid one.
-            if self.funcname == UNKNOWN:
-                return False
-            elif other.funcname != UNKNOWN:
-                # XXX Try matching funcname even though we don't
-                # know the filename?
-                raise NotImplementedError
-            else:
-                return True
-        elif not match_files(self.filename, other.filename):
-            return False
-
-        # Finally, check the funcname.
-        if self.funcname == UNKNOWN:
-            # "other" must be the valid one.
-            if other.funcname == UNKNOWN:
-                return False
-            else:
-                return other.funcname is not None
-        elif other.funcname == UNKNOWN:
-            # "self" must be the valid one.
-            if self.funcname == UNKNOWN:
-                return False
-            else:
-                return self.funcname is not None
-        elif self.funcname == other.funcname:
-            # Both are valid.
-            return True
-
-        return False
diff --git a/Tools/c-analyzer/c_analyzer/common/show.py b/Tools/c-analyzer/c_analyzer/common/show.py
deleted file mode 100644
index 5f3cb1c..0000000
--- a/Tools/c-analyzer/c_analyzer/common/show.py
+++ /dev/null
@@ -1,11 +0,0 @@
-
-def basic(variables, *,
-          _print=print):
-    """Print each row simply."""
-    for var in variables:
-        if var.funcname:
-            line = f'{var.filename}:{var.funcname}():{var.name}'
-        else:
-            line = f'{var.filename}:{var.name}'
-        line = f'{line:<64} {var.vartype}'
-        _print(line)
diff --git a/Tools/c-analyzer/c_analyzer/common/util.py b/Tools/c-analyzer/c_analyzer/common/util.py
deleted file mode 100644
index 43d0bb6..0000000
--- a/Tools/c-analyzer/c_analyzer/common/util.py
+++ /dev/null
@@ -1,243 +0,0 @@
-import csv
-import subprocess
-
-
-_NOT_SET = object()
-
-
-def run_cmd(argv, **kwargs):
-    proc = subprocess.run(
-            argv,
-            #capture_output=True,
-            #stderr=subprocess.STDOUT,
-            stdout=subprocess.PIPE,
-            text=True,
-            check=True,
-            **kwargs
-            )
-    return proc.stdout
-
-
-def read_tsv(infile, header, *,
-             _open=open,
-             _get_reader=csv.reader,
-             ):
-    """Yield each row of the given TSV (tab-separated) file."""
-    if isinstance(infile, str):
-        with _open(infile, newline='') as infile:
-            yield from read_tsv(infile, header,
-                                _open=_open,
-                                _get_reader=_get_reader,
-                                )
-            return
-    lines = iter(infile)
-
-    # Validate the header.
-    try:
-        actualheader = next(lines).strip()
-    except StopIteration:
-        actualheader = ''
-    if actualheader != header:
-        raise ValueError(f'bad header {actualheader!r}')
-
-    for row in _get_reader(lines, delimiter='\t'):
-        yield tuple(v.strip() for v in row)
-
-
-def write_tsv(outfile, header, rows, *,
-             _open=open,
-             _get_writer=csv.writer,
-             ):
-    """Write each of the rows to the given TSV (tab-separated) file."""
-    if isinstance(outfile, str):
-        with _open(outfile, 'w', newline='') as outfile:
-            return write_tsv(outfile, header, rows,
-                            _open=_open,
-                            _get_writer=_get_writer,
-                            )
-
-    if isinstance(header, str):
-        header = header.split('\t')
-    writer = _get_writer(outfile, delimiter='\t')
-    writer.writerow(header)
-    for row in rows:
-        writer.writerow('' if v is None else str(v)
-                        for v in row)
-
-
-class Slot:
-    """A descriptor that provides a slot.
-
-    This is useful for types that can't have slots via __slots__,
-    e.g. tuple subclasses.
-    """
-
-    __slots__ = ('initial', 'default', 'readonly', 'instances', 'name')
-
-    def __init__(self, initial=_NOT_SET, *,
-                 default=_NOT_SET,
-                 readonly=False,
-                 ):
-        self.initial = initial
-        self.default = default
-        self.readonly = readonly
-
-        # The instance cache is not inherently tied to the normal
-        # lifetime of the instances.  So must do something in order to
-        # avoid keeping the instances alive by holding a reference here.
-        # Ideally we would use weakref.WeakValueDictionary to do this.
-        # However, most builtin types do not support weakrefs.  So
-        # instead we monkey-patch __del__ on the attached class to clear
-        # the instance.
-        self.instances = {}
-        self.name = None
-
-    def __set_name__(self, cls, name):
-        if self.name is not None:
-            raise TypeError('already used')
-        self.name = name
-        try:
-            slotnames = cls.__slot_names__
-        except AttributeError:
-            slotnames = cls.__slot_names__ = []
-        slotnames.append(name)
-        self._ensure___del__(cls, slotnames)
-
-    def __get__(self, obj, cls):
-        if obj is None:  # called on the class
-            return self
-        try:
-            value = self.instances[id(obj)]
-        except KeyError:
-            if self.initial is _NOT_SET:
-                value = self.default
-            else:
-                value = self.initial
-            self.instances[id(obj)] = value
-        if value is _NOT_SET:
-            raise AttributeError(self.name)
-        # XXX Optionally make a copy?
-        return value
-
-    def __set__(self, obj, value):
-        if self.readonly:
-            raise AttributeError(f'{self.name} is readonly')
-        # XXX Optionally coerce?
-        self.instances[id(obj)] = value
-
-    def __delete__(self, obj):
-        if self.readonly:
-            raise AttributeError(f'{self.name} is readonly')
-        self.instances[id(obj)] = self.default  # XXX refleak?
-
-    def _ensure___del__(self, cls, slotnames):  # See the comment in __init__().
-        try:
-            old___del__ = cls.__del__
-        except AttributeError:
-            old___del__ = (lambda s: None)
-        else:
-            if getattr(old___del__, '_slotted', False):
-                return
-
-        def __del__(_self):
-            for name in slotnames:
-                delattr(_self, name)
-            old___del__(_self)
-        __del__._slotted = True
-        cls.__del__ = __del__
-
-    def set(self, obj, value):
-        """Update the cached value for an object.
-
-        This works even if the descriptor is read-only.  This is
-        particularly useful when initializing the object (e.g. in
-        its __new__ or __init__).
-        """
-        self.instances[id(obj)] = value
-
-
-class classonly:
-    """A non-data descriptor that makes a value only visible on the class.
-
-    This is like the "classmethod" builtin, but does not show up on
-    instances of the class.  It may be used as a decorator.
-    """
-
-    def __init__(self, value):
-        self.value = value
-        self.getter = classmethod(value).__get__
-        self.name = None
-
-    def __set_name__(self, cls, name):
-        if self.name is not None:
-            raise TypeError('already used')
-        self.name = name
-
-    def __get__(self, obj, cls):
-        if obj is not None:
-            raise AttributeError(self.name)
-        # called on the class
-        return self.getter(None, cls)
-
-
-class _NTBase:
-
-    __slots__ = ()
-
-    @classonly
-    def from_raw(cls, raw):
-        if not raw:
-            return None
-        elif isinstance(raw, cls):
-            return raw
-        elif isinstance(raw, str):
-            return cls.from_string(raw)
-        else:
-            if hasattr(raw, 'items'):
-                return cls(**raw)
-            try:
-                args = tuple(raw)
-            except TypeError:
-                pass
-            else:
-                return cls(*args)
-        raise NotImplementedError
-
-    @classonly
-    def from_string(cls, value):
-        """Return a new instance based on the given string."""
-        raise NotImplementedError
-
-    @classmethod
-    def _make(cls, iterable):  # The default _make() is not subclass-friendly.
-        return cls.__new__(cls, *iterable)
-
-    # XXX Always validate?
-    #def __init__(self, *args, **kwargs):
-    #    self.validate()
-
-    # XXX The default __repr__() is not subclass-friendly (where the name changes).
-    #def __repr__(self):
-    #    _, _, sig = super().__repr__().partition('(')
-    #    return f'{self.__class__.__name__}({sig}'
-
-    # To make sorting work with None:
-    def __lt__(self, other):
-        try:
-            return super().__lt__(other)
-        except TypeError:
-            if None in self:
-                return True
-            elif None in other:
-                return False
-            else:
-                raise
-
-    def validate(self):
-        return
-
-    # XXX Always validate?
-    #def _replace(self, **kwargs):
-    #    obj = super()._replace(**kwargs)
-    #    obj.validate()
-    #    return obj
diff --git a/Tools/c-analyzer/c_analyzer/datafiles.py b/Tools/c-analyzer/c_analyzer/datafiles.py
new file mode 100644
index 0000000..d5db3bd
--- /dev/null
+++ b/Tools/c-analyzer/c_analyzer/datafiles.py
@@ -0,0 +1,125 @@
+import os.path
+
+from c_common import fsutil
+import c_common.tables as _tables
+import c_parser.info as _info
+import c_parser.match as _match
+import c_parser.datafiles as _parser
+from . import analyze as _analyze
+
+
+#############################
+# "known" decls
+
+EXTRA_COLUMNS = [
+    #'typedecl',
+]
+
+
+def get_known(known, extracolumns=None, *,
+              analyze_resolved=None,
+              handle_unresolved=True,
+              relroot=fsutil.USE_CWD,
+              ):
+    if isinstance(known, str):
+        known = read_known(known, extracolumns, relroot)
+    return analyze_known(
+        known,
+        handle_unresolved=handle_unresolved,
+        analyze_resolved=analyze_resolved,
+    )
+
+
+def read_known(infile, extracolumns=None, relroot=fsutil.USE_CWD):
+    extracolumns = EXTRA_COLUMNS + (
+        list(extracolumns) if extracolumns else []
+    )
+    known = {}
+    for decl, extra in _parser.iter_decls_tsv(infile, extracolumns, relroot):
+        known[decl] = extra
+    return known
+
+
+def analyze_known(known, *,
+                  analyze_resolved=None,
+                  handle_unresolved=True,
+                  ):
+    knowntypes = knowntypespecs = {}
+    collated = _match.group_by_kinds(known)
+    types = {decl: None for decl in collated['type']}
+    typespecs = _analyze.get_typespecs(types)
+    def analyze_decl(decl):
+        return _analyze.analyze_decl(
+            decl,
+            typespecs,
+            knowntypespecs,
+            types,
+            knowntypes,
+            analyze_resolved=analyze_resolved,
+        )
+    _analyze.analyze_type_decls(types, analyze_decl, handle_unresolved)
+    return types, typespecs
+
+
+def write_known(rows, outfile, extracolumns=None, *,
+                relroot=fsutil.USE_CWD,
+                backup=True,
+                ):
+    extracolumns = EXTRA_COLUMNS + (
+        list(extracolumns) if extracolumns else []
+    )
+    _parser.write_decls_tsv(
+        rows,
+        outfile,
+        extracolumns,
+        relroot=relroot,
+        backup=backup,
+    )
+
+
+#############################
+# ignored vars
+
+IGNORED_COLUMNS = [
+    'filename',
+    'funcname',
+    'name',
+    'reason',
+]
+IGNORED_HEADER = '\t'.join(IGNORED_COLUMNS)
+
+
+def read_ignored(infile, relroot=fsutil.USE_CWD):
+    return dict(_iter_ignored(infile, relroot))
+
+
+def _iter_ignored(infile, relroot):
+    if relroot and relroot is not fsutil.USE_CWD:
+        relroot = os.path.abspath(relroot)
+    bogus = {_tables.EMPTY, _tables.UNKNOWN}
+    for row in _tables.read_table(infile, IGNORED_HEADER, sep='\t'):
+        *varidinfo, reason = row
+        if _tables.EMPTY in varidinfo or _tables.UNKNOWN in varidinfo:
+            varidinfo = tuple(None if v in bogus else v
+                              for v in varidinfo)
+        if reason in bogus:
+            reason = None
+        varid = _info.DeclID.from_row(varidinfo)
+        varid = varid.fix_filename(relroot, formatted=False, fixroot=False)
+        yield varid, reason
+
+
+def write_ignored(variables, outfile, relroot=fsutil.USE_CWD):
+    raise NotImplementedError
+    if relroot and relroot is not fsutil.USE_CWD:
+        relroot = os.path.abspath(relroot)
+    reason = '???'
+    #if not isinstance(varid, DeclID):
+    #    varid = getattr(varid, 'parsed', varid).id
+    decls = (d.fix_filename(relroot, fixroot=False) for d in decls)
+    _tables.write_table(
+        outfile,
+        IGNORED_HEADER,
+        sep='\t',
+        rows=(r.render_rowdata() + (reason,) for r in decls),
+    )
diff --git a/Tools/c-analyzer/c_analyzer/info.py b/Tools/c-analyzer/c_analyzer/info.py
new file mode 100644
index 0000000..27c3a5a
--- /dev/null
+++ b/Tools/c-analyzer/c_analyzer/info.py
@@ -0,0 +1,324 @@
+from collections import namedtuple
+import os.path
+
+from c_common import fsutil
+from c_common.clsutil import classonly
+import c_common.misc as _misc
+from c_parser.info import (
+    KIND,
+    HighlevelParsedItem,
+    Declaration,
+    TypeDeclaration,
+)
+from c_parser.match import (
+    is_type_decl,
+)
+from .match import (
+    is_process_global,
+)
+
+
+IGNORED = _misc.Labeled('IGNORED')
+UNKNOWN = _misc.Labeled('UNKNOWN')
+
+
+class SystemType(TypeDeclaration):
+
+    def __init__(self, name):
+        super().__init__(None, name, None, None, _shortkey=name)
+
+
+class Analyzed:
+    _locked = False
+
+    @classonly
+    def is_target(cls, raw):
+        if isinstance(raw, HighlevelParsedItem):
+            return True
+        else:
+            return False
+
+    @classonly
+    def from_raw(cls, raw, **extra):
+        if isinstance(raw, cls):
+            if extra:
+                # XXX ?
+                raise NotImplementedError((raw, extra))
+                #return cls(raw.item, raw.typedecl, **raw._extra, **extra)
+            else:
+                return info
+        elif cls.is_target(raw):
+            return cls(raw, **extra)
+        else:
+            raise NotImplementedError((raw, extra))
+
+    @classonly
+    def from_resolved(cls, item, resolved, **extra):
+        if isinstance(resolved, TypeDeclaration):
+            return cls(item, typedecl=resolved, **extra)
+        else:
+            typedeps, extra = cls._parse_raw_resolved(item, resolved, extra)
+            if item.kind is KIND.ENUM:
+                if typedeps:
+                    raise NotImplementedError((item, resolved, extra))
+            elif not typedeps:
+                raise NotImplementedError((item, resolved, extra))
+            return cls(item, typedeps, **extra or {})
+
+    @classonly
+    def _parse_raw_resolved(cls, item, resolved, extra_extra):
+        if resolved in (UNKNOWN, IGNORED):
+            return resolved, None
+        try:
+            typedeps, extra = resolved
+        except (TypeError, ValueError):
+            typedeps = extra = None
+        if extra:
+            # The resolved data takes precedence.
+            extra = dict(extra_extra, **extra)
+        if isinstance(typedeps, TypeDeclaration):
+            return typedeps, extra
+        elif typedeps in (None, UNKNOWN):
+            # It is still effectively unresolved.
+            return UNKNOWN, extra
+        elif None in typedeps or UNKNOWN in typedeps:
+            # It is still effectively unresolved.
+            return typedeps, extra
+        elif any(not isinstance(td, TypeDeclaration) for td in typedeps):
+            raise NotImplementedError((item, typedeps, extra))
+        return typedeps, extra
+
+    def __init__(self, item, typedecl=None, **extra):
+        assert item is not None
+        self.item = item
+        if typedecl in (UNKNOWN, IGNORED):
+            pass
+        elif item.kind is KIND.STRUCT or item.kind is KIND.UNION:
+            if isinstance(typedecl, TypeDeclaration):
+                raise NotImplementedError(item, typedecl)
+            elif typedecl is None:
+                typedecl = UNKNOWN
+            else:
+                typedecl = [UNKNOWN if d is None else d for d in typedecl]
+        elif typedecl is None:
+            typedecl = UNKNOWN
+        elif typedecl and not isinstance(typedecl, TypeDeclaration):
+            # All the other decls have a single type decl.
+            typedecl, = typedecl
+            if typedecl is None:
+                typedecl = UNKNOWN
+        self.typedecl = typedecl
+        self._extra = extra
+        self._locked = True
+
+        self._validate()
+
+    def _validate(self):
+        item = self.item
+        extra = self._extra
+        # Check item.
+        if not isinstance(item, HighlevelParsedItem):
+            raise ValueError(f'"item" must be a high-level parsed item, got {item!r}')
+        # Check extra.
+        for key, value in extra.items():
+            if key.startswith('_'):
+                raise ValueError(f'extra items starting with {"_"!r} not allowed, got {extra!r}')
+            if hasattr(item, key) and not callable(getattr(item, key)):
+                raise ValueError(f'extra cannot override item, got {value!r} for key {key!r}')
+
+    def __repr__(self):
+        kwargs = [
+            f'item={self.item!r}',
+            f'typedecl={self.typedecl!r}',
+            *(f'{k}={v!r}' for k, v in self._extra.items())
+        ]
+        return f'{type(self).__name__}({", ".join(kwargs)})'
+
+    def __str__(self):
+        try:
+            return self._str
+        except AttributeError:
+            self._str, = self.render('line')
+            return self._str
+
+    def __hash__(self):
+        return hash(self.item)
+
+    def __eq__(self, other):
+        if isinstance(other, Analyzed):
+            return self.item == other.item
+        elif isinstance(other, HighlevelParsedItem):
+            return self.item == other
+        elif type(other) is tuple:
+            return self.item == other
+        else:
+            return NotImplemented
+
+    def __gt__(self, other):
+        if isinstance(other, Analyzed):
+            return self.item > other.item
+        elif isinstance(other, HighlevelParsedItem):
+            return self.item > other
+        elif type(other) is tuple:
+            return self.item > other
+        else:
+            return NotImplemented
+
+    def __dir__(self):
+        names = set(super().__dir__())
+        names.update(self._extra)
+        names.remove('_locked')
+        return sorted(names)
+
+    def __getattr__(self, name):
+        if name.startswith('_'):
+            raise AttributeError(name)
+        # The item takes precedence over the extra data (except if callable).
+        try:
+            value = getattr(self.item, name)
+            if callable(value):
+                raise AttributeError(name)
+        except AttributeError:
+            try:
+                value = self._extra[name]
+            except KeyError:
+                pass
+            else:
+                # Speed things up the next time.
+                self.__dict__[name] = value
+                return value
+            raise  # re-raise
+        else:
+            return value
+
+    def __setattr__(self, name, value):
+        if self._locked and name != '_str':
+            raise AttributeError(f'readonly ({name})')
+        super().__setattr__(name, value)
+
+    def __delattr__(self, name):
+        if self._locked:
+            raise AttributeError(f'readonly ({name})')
+        super().__delattr__(name)
+
+    @property
+    def decl(self):
+        if not isinstance(self.item, Declaration):
+            raise AttributeError('decl')
+        return self.item
+
+    @property
+    def signature(self):
+        # XXX vartype...
+        ...
+
+    @property
+    def istype(self):
+        return is_type_decl(self.item.kind)
+
+    @property
+    def is_known(self):
+        if self.typedecl in (UNKNOWN, IGNORED):
+            return False
+        elif isinstance(self.typedecl, TypeDeclaration):
+            return True
+        else:
+            return UNKNOWN not in self.typedecl
+
+    def fix_filename(self, relroot=fsutil.USE_CWD, **kwargs):
+        self.item.fix_filename(relroot, **kwargs)
+        return self
+
+    def as_rowdata(self, columns=None):
+        # XXX finish!
+        return self.item.as_rowdata(columns)
+
+    def render_rowdata(self, columns=None):
+        # XXX finish!
+        return self.item.render_rowdata(columns)
+
+    def render(self, fmt='line', *, itemonly=False):
+        if fmt == 'raw':
+            yield repr(self)
+            return
+        rendered = self.item.render(fmt)
+        if itemonly or not self._extra:
+            yield from rendered
+            return
+        extra = self._render_extra(fmt)
+        if not extra:
+            yield from rendered
+        elif fmt in ('brief', 'line'):
+            rendered, = rendered
+            extra, = extra
+            yield f'{rendered}\t{extra}'
+        elif fmt == 'summary':
+            raise NotImplementedError(fmt)
+        elif fmt == 'full':
+            yield from rendered
+            for line in extra:
+                yield f'\t{line}'
+        else:
+            raise NotImplementedError(fmt)
+
+    def _render_extra(self, fmt):
+        if fmt in ('brief', 'line'):
+            yield str(self._extra)
+        else:
+            raise NotImplementedError(fmt)
+
+
+class Analysis:
+
+    _item_class = Analyzed
+
+    @classonly
+    def build_item(cls, info, resolved=None, **extra):
+        if resolved is None:
+            return cls._item_class.from_raw(info, **extra)
+        else:
+            return cls._item_class.from_resolved(info, resolved, **extra)
+
+    @classmethod
+    def from_results(cls, results):
+        self = cls()
+        for info, resolved in results:
+            self._add_result(info, resolved)
+        return self
+
+    def __init__(self, items=None):
+        self._analyzed = {type(self).build_item(item): None
+                          for item in items or ()}
+
+    def __repr__(self):
+        return f'{type(self).__name__}({list(self._analyzed.keys())})'
+
+    def __iter__(self):
+        #yield from self.types
+        #yield from self.functions
+        #yield from self.variables
+        yield from self._analyzed
+
+    def __len__(self):
+        return len(self._analyzed)
+
+    def __getitem__(self, key):
+        if type(key) is int:
+            for i, val in enumerate(self._analyzed):
+                if i == key:
+                    return val
+            else:
+                raise IndexError(key)
+        else:
+            return self._analyzed[key]
+
+    def fix_filenames(self, relroot=fsutil.USE_CWD, **kwargs):
+        if relroot and relroot is not fsutil.USE_CWD:
+            relroot = os.path.abspath(relroot)
+        for item in self._analyzed:
+            item.fix_filename(relroot, fixroot=False, **kwargs)
+
+    def _add_result(self, info, resolved):
+        analyzed = type(self).build_item(info, resolved)
+        self._analyzed[analyzed] = None
+        return analyzed
diff --git a/Tools/c-analyzer/c_analyzer/match.py b/Tools/c-analyzer/c_analyzer/match.py
new file mode 100644
index 0000000..5c27e4a
--- /dev/null
+++ b/Tools/c-analyzer/c_analyzer/match.py
@@ -0,0 +1,212 @@
+import os.path
+
+from c_parser import (
+    info as _info,
+    match as _match,
+)
+
+
+_KIND = _info.KIND
+
+
+# XXX Use known.tsv for these?
+SYSTEM_TYPES = {
+    'int8_t',
+    'uint8_t',
+    'int16_t',
+    'uint16_t',
+    'int32_t',
+    'uint32_t',
+    'int64_t',
+    'uint64_t',
+    'size_t',
+    'ssize_t',
+    'intptr_t',
+    'uintptr_t',
+    'wchar_t',
+    '',
+    # OS-specific
+    'pthread_cond_t',
+    'pthread_mutex_t',
+    'pthread_key_t',
+    'atomic_int',
+    'atomic_uintptr_t',
+    '',
+    # lib-specific
+    'WINDOW',  # curses
+    'XML_LChar',
+    'XML_Size',
+    'XML_Parser',
+    'enum XML_Error',
+    'enum XML_Status',
+    '',
+}
+
+
+def is_system_type(typespec):
+    return typespec in SYSTEM_TYPES
+
+
+##################################
+# decl matchers
+
+def is_public(decl):
+    if not decl.filename.endswith('.h'):
+        return False
+    if 'Include' not in decl.filename.split(os.path.sep):
+        return False
+    return True
+
+
+def is_process_global(vardecl):
+    kind, storage, _, _, _ = _info.get_parsed_vartype(vardecl)
+    if kind is not _KIND.VARIABLE:
+        raise NotImplementedError(vardecl)
+    if 'static' in (storage or ''):
+        return True
+
+    if hasattr(vardecl, 'parent'):
+        parent = vardecl.parent
+    else:
+        parent = vardecl.get('parent')
+    return not parent
+
+
+def is_fixed_type(vardecl):
+    if not vardecl:
+        return None
+    _, _, _, typespec, abstract = _info.get_parsed_vartype(vardecl)
+    if 'typeof' in typespec:
+        raise NotImplementedError(vardecl)
+    elif not abstract:
+        return True
+
+    if '*' not in abstract:
+        # XXX What about []?
+        return True
+    elif _match._is_funcptr(abstract):
+        return True
+    else:
+        for after in abstract.split('*')[1:]:
+            if not after.lstrip().startswith('const'):
+                return False
+        else:
+            return True
+
+
+def is_immutable(vardecl):
+    if not vardecl:
+        return None
+    if not is_fixed_type(vardecl):
+        return False
+    _, _, typequal, _, _ = _info.get_parsed_vartype(vardecl)
+    # If there, it can only be "const" or "volatile".
+    return typequal == 'const'
+
+
+def is_public_api(decl):
+    if not is_public(decl):
+        return False
+    if decl.kind is _KIND.TYPEDEF:
+        return True
+    elif _match.is_type_decl(decl):
+        return not _match.is_forward_decl(decl)
+    else:
+        return _match.is_external_reference(decl)
+
+
+def is_public_declaration(decl):
+    if not is_public(decl):
+        return False
+    if decl.kind is _KIND.TYPEDEF:
+        return True
+    elif _match.is_type_decl(decl):
+        return _match.is_forward_decl(decl)
+    else:
+        return _match.is_external_reference(decl)
+
+
+def is_public_definition(decl):
+    if not is_public(decl):
+        return False
+    if decl.kind is _KIND.TYPEDEF:
+        return True
+    elif _match.is_type_decl(decl):
+        return not _match.is_forward_decl(decl)
+    else:
+        return not _match.is_external_reference(decl)
+
+
+def is_public_impl(decl):
+    if not _KIND.is_decl(decl.kind):
+        return False
+    # See filter_forward() about "is_public".
+    return getattr(decl, 'is_public', False)
+
+
+def is_module_global_decl(decl):
+    if is_public_impl(decl):
+        return False
+    if _match.is_forward_decl(decl):
+        return False
+    return not _match.is_local_var(decl)
+
+
+##################################
+# filtering with matchers
+
+def filter_forward(items, *, markpublic=False):
+    if markpublic:
+        public = set()
+        actual = []
+        for item in items:
+            if is_public_api(item):
+                public.add(item.id)
+            elif not _match.is_forward_decl(item):
+                actual.append(item)
+            else:
+                # non-public duplicate!
+                # XXX
+                raise Exception(item)
+        for item in actual:
+            _info.set_flag(item, 'is_public', item.id in public)
+            yield item
+    else:
+        for item in items:
+            if _match.is_forward_decl(item):
+                continue
+            yield item
+
+
+##################################
+# grouping with matchers
+
+def group_by_storage(decls, **kwargs):
+    def is_module_global(decl):
+        if not is_module_global_decl(decl):
+            return False
+        if decl.kind == _KIND.VARIABLE:
+            if _info.get_effective_storage(decl) == 'static':
+                # This is covered by is_static_module_global().
+                return False
+        return True
+    def is_static_module_global(decl):
+        if not _match.is_global_var(decl):
+            return False
+        return _info.get_effective_storage(decl) == 'static'
+    def is_static_local(decl):
+        if not _match.is_local_var(decl):
+            return False
+        return _info.get_effective_storage(decl) == 'static'
+    #def is_local(decl):
+    #    if not _match.is_local_var(decl):
+    #        return False
+    #    return _info.get_effective_storage(decl) != 'static'
+    categories = {
+        #'extern': is_extern,
+        'published': is_public_impl,
+        'module-global': is_module_global,
+        'static-module-global': is_static_module_global,
+        'static-local': is_static_local,
+    }
+    return _match.group_by_category(decls, categories, **kwargs)
diff --git a/Tools/c-analyzer/c_analyzer/parser/__init__.py b/Tools/c-analyzer/c_analyzer/parser/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/Tools/c-analyzer/c_analyzer/parser/__init__.py
+++ /dev/null
diff --git a/Tools/c-analyzer/c_analyzer/parser/declarations.py b/Tools/c-analyzer/c_analyzer/parser/declarations.py
deleted file mode 100644
index f37072c..0000000
--- a/Tools/c-analyzer/c_analyzer/parser/declarations.py
+++ /dev/null
@@ -1,339 +0,0 @@
-import re
-import shlex
-import subprocess
-
-from ..common.info import UNKNOWN
-
-from . import source
-
-
-IDENTIFIER = r'(?:[a-zA-z]|_+[a-zA-Z0-9]\w*)'
-
-TYPE_QUAL = r'(?:const|volatile)'
-
-VAR_TYPE_SPEC = r'''(?:
-        void |
-        (?:
-         (?:(?:un)?signed\s+)?
-         (?:
-          char |
-          short |
-          int |
-          long |
-          long\s+int |
-          long\s+long
-          ) |
-         ) |
-        float |
-        double |
-        {IDENTIFIER} |
-        (?:struct|union)\s+{IDENTIFIER}
-        )'''
-
-POINTER = rf'''(?:
-        (?:\s+const)?\s*[*]
-        )'''
-
-#STRUCT = r'''(?:
-#        (?:struct|(struct\s+%s))\s*[{]
-#            [^}]*
-#        [}]
-#        )''' % (IDENTIFIER)
-#UNION = r'''(?:
-#        (?:union|(union\s+%s))\s*[{]
-#            [^}]*
-#        [}]
-#        )''' % (IDENTIFIER)
-#DECL_SPEC = rf'''(?:
-#        ({VAR_TYPE_SPEC}) |
-#        ({STRUCT}) |
-#        ({UNION})
-#        )'''
-
-FUNC_START = rf'''(?:
-        (?:
-          (?:
-            extern |
-            static |
-            static\s+inline
-           )\s+
-         )?
-        #(?:const\s+)?
-        {VAR_TYPE_SPEC}
-        )'''
-#GLOBAL_VAR_START = rf'''(?:
-#        (?:
-#          (?:
-#            extern |
-#            static
-#           )\s+
-#         )?
-#        (?:
-#           {TYPE_QUAL}
-#           (?:\s+{TYPE_QUAL})?
-#         )?\s+
-#        {VAR_TYPE_SPEC}
-#        )'''
-GLOBAL_DECL_START_RE = re.compile(rf'''
-        ^
-        (?:
-            ({FUNC_START})
-         )
-        ''', re.VERBOSE)
-
-LOCAL_VAR_START = rf'''(?:
-        (?:
-          (?:
-            register |
-            static
-           )\s+
-         )?
-        (?:
-          (?:
-            {TYPE_QUAL}
-            (?:\s+{TYPE_QUAL})?
-           )\s+
-         )?
-        {VAR_TYPE_SPEC}
-        {POINTER}?
-        )'''
-LOCAL_STMT_START_RE = re.compile(rf'''
-        ^
-        (?:
-            ({LOCAL_VAR_START})
-         )
-        ''', re.VERBOSE)
-
-
-def iter_global_declarations(lines):
-    """Yield (decl, body) for each global declaration in the given lines.
-
-    For function definitions the header is reduced to one line and
-    the body is provided as-is.  For other compound declarations (e.g.
-    struct) the entire declaration is reduced to one line and "body"
-    is None.  Likewise for simple declarations (e.g. variables).
-
-    Declarations inside function bodies are ignored, though their text
-    is provided in the function body.
-    """
-    # XXX Bail out upon bogus syntax.
-    lines = source.iter_clean_lines(lines)
-    for line in lines:
-        if not GLOBAL_DECL_START_RE.match(line):
-            continue
-        # We only need functions here, since we only need locals for now.
-        if line.endswith(';'):
-            continue
-        if line.endswith('{') and '(' not in line:
-            continue
-
-        # Capture the function.
-        # (assume no func is a one-liner)
-        decl = line
-        while '{' not in line:  # assume no inline structs, etc.
-            try:
-                line = next(lines)
-            except StopIteration:
-                return
-            decl += ' ' + line
-
-        body, end = _extract_block(lines)
-        if end is None:
-            return
-        assert end == '}'
-        yield (f'{decl}\n{body}\n{end}', body)
-
-
-def iter_local_statements(lines):
-    """Yield (lines, blocks) for each statement in the given lines.
-
-    For simple statements, "blocks" is None and the statement is reduced
-    to a single line.  For compound statements, "blocks" is a pair of
-    (header, body) for each block in the statement.  The headers are
-    reduced to a single line each, but the bpdies are provided as-is.
-    """
-    # XXX Bail out upon bogus syntax.
-    lines = source.iter_clean_lines(lines)
-    for line in lines:
-        if not LOCAL_STMT_START_RE.match(line):
-            continue
-
-        stmt = line
-        blocks = None
-        if not line.endswith(';'):
-            # XXX Support compound & multiline simple statements.
-            #blocks = []
-            continue
-
-        yield (stmt, blocks)
-
-
-def _extract_block(lines):
-    end = None
-    depth = 1
-    body = []
-    for line in lines:
-        depth += line.count('{') - line.count('}')
-        if depth == 0:
-            end = line
-            break
-        body.append(line)
-    return '\n'.join(body), end
-
-
-def parse_func(stmt, body):
-    """Return (name, signature) for the given function definition."""
-    header, _, end = stmt.partition(body)
-    assert end.strip() == '}'
-    assert header.strip().endswith('{')
-    header, _, _= header.rpartition('{')
-
-    signature = ' '.join(header.strip().splitlines())
-
-    _, _, name = signature.split('(')[0].strip().rpartition(' ')
-    assert name
-
-    return name, signature
-
-
-#TYPE_SPEC = rf'''(?:
-#        )'''
-#VAR_DECLARATOR = rf'''(?:
-#        )'''
-#VAR_DECL = rf'''(?:
-#            {TYPE_SPEC}+
-#            {VAR_DECLARATOR}
-#            \s*
-#        )'''
-#VAR_DECLARATION = rf'''(?:
-#            {VAR_DECL}
-#            (?: = [^=] [^;]* )?
-#            ;
-#        )'''
-#
-#
-#def parse_variable(decl, *, inFunc=False):
-#    """Return [(name, storage, vartype)] for the given variable declaration."""
-#    ...
-
-
-def _parse_var(stmt):
-    """Return (name, vartype) for the given variable declaration."""
-    stmt = stmt.rstrip(';')
-    m = LOCAL_STMT_START_RE.match(stmt)
-    assert m
-    vartype = m.group(0)
-    name = stmt[len(vartype):].partition('=')[0].strip()
-
-    if name.startswith('('):
-        name, _, after = name[1:].partition(')')
-        assert after
-        name = name.replace('*', '* ')
-        inside, _, name = name.strip().rpartition(' ')
-        vartype = f'{vartype} ({inside.strip()}){after}'
-    else:
-        name = name.replace('*', '* ')
-        before, _, name = name.rpartition(' ')
-        vartype = f'{vartype} {before}'
-
-    vartype = vartype.strip()
-    while '  ' in vartype:
-        vartype = vartype.replace('  ', ' ')
-
-    return name, vartype
-
-
-def extract_storage(decl, *, infunc=None):
-    """Return (storage, vartype) based on the given declaration.
-
-    The default storage is "implicit" (or "local" if infunc is True).
-    """
-    if decl == UNKNOWN:
-        return decl
-    if decl.startswith('static '):
-        return 'static'
-        #return 'static', decl.partition(' ')[2].strip()
-    elif decl.startswith('extern '):
-        return 'extern'
-        #return 'extern', decl.partition(' ')[2].strip()
-    elif re.match('.*\b(static|extern)\b', decl):
-        raise NotImplementedError
-    elif infunc:
-        return 'local'
-    else:
-        return 'implicit'
-
-
-def parse_compound(stmt, blocks):
-    """Return (headers, bodies) for the given compound statement."""
-    # XXX Identify declarations inside compound statements
-    # (if/switch/for/while).
-    raise NotImplementedError
-
-
-def iter_variables(filename, *,
-                   preprocessed=False,
-                   _iter_source_lines=source.iter_lines,
-                   _iter_global=iter_global_declarations,
-                   _iter_local=iter_local_statements,
-                   _parse_func=parse_func,
-                   _parse_var=_parse_var,
-                   _parse_compound=parse_compound,
-                   ):
-    """Yield (funcname, name, vartype) for every variable in the given file."""
-    if preprocessed:
-        raise NotImplementedError
-    lines = _iter_source_lines(filename)
-    for stmt, body in _iter_global(lines):
-        # At the file top-level we only have to worry about vars & funcs.
-        if not body:
-            name, vartype = _parse_var(stmt)
-            if name:
-                yield (None, name, vartype)
-        else:
-            funcname, _ = _parse_func(stmt, body)
-            localvars = _iter_locals(body,
-                                     _iter_statements=_iter_local,
-                                     _parse_var=_parse_var,
-                                     _parse_compound=_parse_compound,
-                                     )
-            for name, vartype in localvars:
-                yield (funcname, name, vartype)
-
-
-def _iter_locals(lines, *,
-                 _iter_statements=iter_local_statements,
-                 _parse_var=_parse_var,
-                 _parse_compound=parse_compound,
-                 ):
-    compound = [lines]
-    while compound:
-        body = compound.pop(0)
-        bodylines = body.splitlines()
-        for stmt, blocks in _iter_statements(bodylines):
-            if not blocks:
-                name, vartype = _parse_var(stmt)
-                if name:
-                    yield (name, vartype)
-            else:
-                headers, bodies = _parse_compound(stmt, blocks)
-                for header in headers:
-                    for line in header:
-                        name, vartype = _parse_var(line)
-                        if name:
-                            yield (name, vartype)
-                compound.extend(bodies)
-
-
-def iter_all(filename, *,
-             preprocessed=False,
-             ):
-    """Yield a Declaration for each one found.
-
-    If there are duplicates, due to preprocessor conditionals, then
-    they are checked to make sure they are the same.
-    """
-    # XXX For the moment we cheat.
-    for funcname, name, decl in iter_variables(filename,
-                                               preprocessed=preprocessed):
-        yield 'variable', funcname, name, decl
diff --git a/Tools/c-analyzer/c_analyzer/parser/find.py b/Tools/c-analyzer/c_analyzer/parser/find.py
deleted file mode 100644
index 3860d3d..0000000
--- a/Tools/c-analyzer/c_analyzer/parser/find.py
+++ /dev/null
@@ -1,107 +0,0 @@
-from ..common.info import UNKNOWN, ID
-
-from . import declarations
-
-# XXX need tests:
-# * variables
-# * variable
-# * variable_from_id
-
-
-def _iter_vars(filenames, preprocessed, *,
-               handle_id=None,
-               _iter_decls=declarations.iter_all,
-               ):
-    if handle_id is None:
-        handle_id = ID
-
-    for filename in filenames or ():
-        for kind, funcname, name, decl in _iter_decls(filename,
-                                                      preprocessed=preprocessed,
-                                                      ):
-            if kind != 'variable':
-                continue
-            varid = handle_id(filename, funcname, name)
-            yield varid, decl
-
-
-# XXX Add a "handle_var" arg like we did for get_resolver()?
-
-def variables(*filenames,
-              perfilecache=None,
-              preprocessed=False,
-              known=None,  # for types
-              handle_id=None,
-              _iter_vars=_iter_vars,
-              ):
-    """Yield (varid, decl) for each variable found in the given files.
-
-    If "preprocessed" is provided (and not False/None) then it is used
-    to decide which tool to use to parse the source code after it runs
-    through the C preprocessor.  Otherwise the raw
-    """
-    if len(filenames) == 1 and not (filenames[0], str):
-        filenames, = filenames
-
-    if perfilecache is None:
-        yield from _iter_vars(filenames, preprocessed)
-    else:
-        # XXX Cache per-file variables (e.g. `{filename: [(varid, decl)]}`).
-        raise NotImplementedError
-
-
-def variable(name, filenames, *,
-             local=False,
-             perfilecache=None,
-             preprocessed=False,
-             handle_id=None,
-             _iter_vars=variables,
-             ):
-    """Return (varid, decl) for the first found variable that matches.
-
-    If "local" is True then the first matching local variable in the
-    file will always be returned.  To avoid that, pass perfilecache and
-    pop each variable from the cache after using it.
-    """
-    for varid, decl in _iter_vars(filenames,
-                                  perfilecache=perfilecache,
-                                  preprocessed=preprocessed,
-                                  ):
-        if varid.name != name:
-            continue
-        if local:
-            if varid.funcname:
-                if varid.funcname == UNKNOWN:
-                    raise NotImplementedError
-                return varid, decl
-        elif not varid.funcname:
-            return varid, decl
-    else:
-        return None, None  # No matching variable was found.
-
-
-def variable_from_id(id, filenames, *,
-                     perfilecache=None,
-                     preprocessed=False,
-                     handle_id=None,
-                     _get_var=variable,
-                     ):
-    """Return (varid, decl) for the first found variable that matches."""
-    local = False
-    if isinstance(id, str):
-        name = id
-    else:
-        if id.funcname == UNKNOWN:
-            local = True
-        elif id.funcname:
-            raise NotImplementedError
-
-        name = id.name
-        if id.filename and id.filename != UNKNOWN:
-            filenames = [id.filename]
-    return _get_var(name, filenames,
-                    local=local,
-                    perfilecache=perfilecache,
-                    preprocessed=preprocessed,
-                    handle_id=handle_id,
-                    )
diff --git a/Tools/c-analyzer/c_analyzer/parser/naive.py b/Tools/c-analyzer/c_analyzer/parser/naive.py
deleted file mode 100644
index 4a4822d..0000000
--- a/Tools/c-analyzer/c_analyzer/parser/naive.py
+++ /dev/null
@@ -1,179 +0,0 @@
-import re
-
-from ..common.info import UNKNOWN, ID
-
-from .preprocessor import _iter_clean_lines
-
-
-_NOT_SET = object()
-
-
-def get_srclines(filename, *,
-                 cache=None,
-                 _open=open,
-                 _iter_lines=_iter_clean_lines,
-                 ):
-    """Return the file's lines as a list.
-
-    Each line will have trailing whitespace removed (including newline).
-
-    If a cache is given the it is used.
-    """
-    if cache is not None:
-        try:
-            return cache[filename]
-        except KeyError:
-            pass
-
-    with _open(filename) as srcfile:
-        srclines = [line
-                    for _, line in _iter_lines(srcfile)
-                    if not line.startswith('#')]
-    for i, line in enumerate(srclines):
-        srclines[i] = line.rstrip()
-
-    if cache is not None:
-        cache[filename] = srclines
-    return srclines
-
-
-def parse_variable_declaration(srcline):
-    """Return (name, decl) for the given declaration line."""
-    # XXX possible false negatives...
-    decl, sep, _ = srcline.partition('=')
-    if not sep:
-        if not srcline.endswith(';'):
-            return None, None
-        decl = decl.strip(';')
-    decl = decl.strip()
-    m = re.match(r'.*\b(\w+)\s*(?:\[[^\]]*\])?$', decl)
-    if not m:
-        return None, None
-    name = m.group(1)
-    return name, decl
-
-
-def parse_variable(srcline, funcname=None):
-    """Return (varid, decl) for the variable declared on the line (or None)."""
-    line = srcline.strip()
-
-    # XXX Handle more than just static variables.
-    if line.startswith('static '):
-        if '(' in line and '[' not in line:
-            # a function
-            return None, None
-        return parse_variable_declaration(line)
-    else:
-        return None, None
-
-
-def iter_variables(filename, *,
-                   srccache=None,
-                   parse_variable=None,
-                   _get_srclines=get_srclines,
-                   _default_parse_variable=parse_variable,
-                   ):
-    """Yield (varid, decl) for each variable in the given source file."""
-    if parse_variable is None:
-        parse_variable = _default_parse_variable
-
-    indent = ''
-    prev = ''
-    funcname = None
-    for line in _get_srclines(filename, cache=srccache):
-        # remember current funcname
-        if funcname:
-            if line == indent + '}':
-                funcname = None
-                continue
-        else:
-            if '(' in prev and line == indent + '{':
-                if not prev.startswith('__attribute__'):
-                    funcname = prev.split('(')[0].split()[-1]
-                    prev = ''
-                    continue
-            indent = line[:-len(line.lstrip())]
-            prev = line
-
-        info = parse_variable(line, funcname)
-        if isinstance(info, list):
-            for name, _funcname, decl in info:
-                yield ID(filename, _funcname, name), decl
-            continue
-        name, decl = info
-
-        if name is None:
-            continue
-        yield ID(filename, funcname, name), decl
-
-
-def _match_varid(variable, name, funcname, ignored=None):
-    if ignored and variable in ignored:
-        return False
-
-    if variable.name != name:
-        return False
-
-    if funcname == UNKNOWN:
-        if not variable.funcname:
-            return False
-    elif variable.funcname != funcname:
-        return False
-
-    return True
-
-
-def find_variable(filename, funcname, name, *,
-                  ignored=None,
-                  srccache=None,  # {filename: lines}
-                  parse_variable=None,
-                  _iter_variables=iter_variables,
-                  ):
-    """Return the matching variable.
-
-    Return None if the variable is not found.
-    """
-    for varid, decl in _iter_variables(filename,
-                                    srccache=srccache,
-                                    parse_variable=parse_variable,
-                                    ):
-        if _match_varid(varid, name, funcname, ignored):
-            return varid, decl
-    else:
-        return None
-
-
-def find_variables(varids, filenames=None, *,
-                   srccache=_NOT_SET,
-                   parse_variable=None,
-                   _find_symbol=find_variable,
-                   ):
-    """Yield (varid, decl) for each ID.
-
-    If the variable is not found then its decl will be UNKNOWN.  That
-    way there will be one resulting variable per given ID.
-    """
-    if srccache is _NOT_SET:
-        srccache = {}
-
-    used = set()
-    for varid in varids:
-        if varid.filename and varid.filename != UNKNOWN:
-            srcfiles = [varid.filename]
-        else:
-            if not filenames:
-                yield varid, UNKNOWN
-                continue
-            srcfiles = filenames
-        for filename in srcfiles:
-            varid, decl = _find_varid(filename, varid.funcname, varid.name,
-                                      ignored=used,
-                                      srccache=srccache,
-                                      parse_variable=parse_variable,
-                                      )
-            if varid:
-                yield varid, decl
-                used.add(varid)
-                break
-        else:
-            yield varid, UNKNOWN
diff --git a/Tools/c-analyzer/c_analyzer/parser/preprocessor.py b/Tools/c-analyzer/c_analyzer/parser/preprocessor.py
deleted file mode 100644
index 41f306e..0000000
--- a/Tools/c-analyzer/c_analyzer/parser/preprocessor.py
+++ /dev/null
@@ -1,511 +0,0 @@
-from collections import namedtuple
-import shlex
-import os
-import re
-
-from ..common import util, info
-
-
-CONTINUATION = '\\' + os.linesep
-
-IDENTIFIER = r'(?:\w*[a-zA-Z]\w*)'
-IDENTIFIER_RE = re.compile('^' + IDENTIFIER + '$')
-
-
-def _coerce_str(value):
-    if not value:
-        return ''
-    return str(value).strip()
-
-
-#############################
-# directives
-
-DIRECTIVE_START = r'''
-    (?:
-      ^ \s*
-      [#] \s*
-      )'''
-DIRECTIVE_TEXT = r'''
-    (?:
-      (?: \s+ ( .*\S ) )?
-      \s* $
-      )'''
-DIRECTIVE = rf'''
-    (?:
-      {DIRECTIVE_START}
-      (
-        include |
-        error | warning |
-        pragma |
-        define | undef |
-        if | ifdef | ifndef | elseif | else | endif |
-        __FILE__ | __LINE__ | __DATE __ | __TIME__ | __TIMESTAMP__
-        )
-      {DIRECTIVE_TEXT}
-      )'''
-#       (?:
-#        [^\\\n] |
-#        \\ [^\n] |
-#        \\ \n
-#        )+
-#      ) \n
-#     )'''
-DIRECTIVE_RE = re.compile(DIRECTIVE, re.VERBOSE)
-
-DEFINE = rf'''
-    (?:
-      {DIRECTIVE_START} define \s+
-      (?:
-        ( \w*[a-zA-Z]\w* )
-        (?: \s* [(] ([^)]*) [)] )?
-        )
-      {DIRECTIVE_TEXT}
-      )'''
-DEFINE_RE = re.compile(DEFINE, re.VERBOSE)
-
-
-def parse_directive(line):
-    """Return the appropriate directive for the given line."""
-    line = line.strip()
-    if line.startswith('#'):
-        line = line[1:].lstrip()
-        line = '#' + line
-    directive = line
-    #directive = '#' + line
-    while '  ' in directive:
-        directive = directive.replace('  ', ' ')
-    return _parse_directive(directive)
-
-
-def _parse_directive(line):
-    m = DEFINE_RE.match(line)
-    if m:
-        name, args, text = m.groups()
-        if args:
-            args = [a.strip() for a in args.split(',')]
-            return Macro(name, args, text)
-        else:
-            return Constant(name, text)
-
-    m = DIRECTIVE_RE.match(line)
-    if not m:
-        raise ValueError(f'unsupported directive {line!r}')
-    kind, text = m.groups()
-    if not text:
-        if kind not in ('else', 'endif'):
-            raise ValueError(f'missing text in directive {line!r}')
-    elif kind in ('else', 'endif', 'define'):
-        raise ValueError(f'unexpected text in directive {line!r}')
-    if kind == 'include':
-        directive = Include(text)
-    elif kind in IfDirective.KINDS:
-        directive = IfDirective(kind, text)
-    else:
-        directive = OtherDirective(kind, text)
-    directive.validate()
-    return directive
-
-
-class PreprocessorDirective(util._NTBase):
-    """The base class for directives."""
-
-    __slots__ = ()
-
-    KINDS = frozenset([
-            'include',
-            'pragma',
-            'error', 'warning',
-            'define', 'undef',
-            'if', 'ifdef', 'ifndef', 'elseif', 'else', 'endif',
-            '__FILE__', '__DATE__', '__LINE__', '__TIME__', '__TIMESTAMP__',
-            ])
-
-    @property
-    def text(self):
-        return ' '.join(v for v in self[1:] if v and v.strip()) or None
-
-    def validate(self):
-        """Fail if the object is invalid (i.e. init with bad data)."""
-        super().validate()
-
-        if not self.kind:
-            raise TypeError('missing kind')
-        elif self.kind not in self.KINDS:
-            raise ValueError
-
-        # text can be anything, including None.
-
-
-class Constant(PreprocessorDirective,
-               namedtuple('Constant', 'kind name value')):
-    """A single "constant" directive ("define")."""
-
-    __slots__ = ()
-
-    def __new__(cls, name, value=None):
-        self = super().__new__(
-                cls,
-                'define',
-                name=_coerce_str(name) or None,
-                value=_coerce_str(value) or None,
-                )
-        return self
-
-    def validate(self):
-        """Fail if the object is invalid (i.e. init with bad data)."""
-        super().validate()
-
-        if not self.name:
-            raise TypeError('missing name')
-        elif not IDENTIFIER_RE.match(self.name):
-            raise ValueError(f'name must be identifier, got {self.name!r}')
-
-        # value can be anything, including None
-
-
-class Macro(PreprocessorDirective,
-            namedtuple('Macro', 'kind name args body')):
-    """A single "macro" directive ("define")."""
-
-    __slots__ = ()
-
-    def __new__(cls, name, args, body=None):
-        # "args" must be a string or an iterable of strings (or "empty").
-        if isinstance(args, str):
-            args = [v.strip() for v in args.split(',')]
-        if args:
-            args = tuple(_coerce_str(a) or None for a in args)
-        self = super().__new__(
-                cls,
-                kind='define',
-                name=_coerce_str(name) or None,
-                args=args if args else (),
-                body=_coerce_str(body) or None,
-                )
-        return self
-
-    @property
-    def text(self):
-        if self.body:
-            return f'{self.name}({", ".join(self.args)}) {self.body}'
-        else:
-            return f'{self.name}({", ".join(self.args)})'
-
-    def validate(self):
-        """Fail if the object is invalid (i.e. init with bad data)."""
-        super().validate()
-
-        if not self.name:
-            raise TypeError('missing name')
-        elif not IDENTIFIER_RE.match(self.name):
-            raise ValueError(f'name must be identifier, got {self.name!r}')
-
-        for arg in self.args:
-            if not arg:
-                raise ValueError(f'missing arg in {self.args}')
-            elif not IDENTIFIER_RE.match(arg):
-                raise ValueError(f'arg must be identifier, got {arg!r}')
-
-        # body can be anything, including None
-
-
-class IfDirective(PreprocessorDirective,
-                  namedtuple('IfDirective', 'kind condition')):
-    """A single conditional directive (e.g. "if", "ifdef").
-
-    This only includes directives that actually provide conditions.  The
-    related directives "else" and "endif" are covered by OtherDirective
-    instead.
-    """
-
-    __slots__ = ()
-
-    KINDS = frozenset([
-            'if',
-            'ifdef',
-            'ifndef',
-            'elseif',
-            ])
-
-    @classmethod
-    def _condition_from_raw(cls, raw, kind):
-        #return Condition.from_raw(raw, _kind=kind)
-        condition = _coerce_str(raw)
-        if not condition:
-            return None
-
-        if kind == 'ifdef':
-            condition = f'defined({condition})'
-        elif kind == 'ifndef':
-            condition = f'! defined({condition})'
-
-        return condition
-
-    def __new__(cls, kind, condition):
-        kind = _coerce_str(kind)
-        self = super().__new__(
-                cls,
-                kind=kind or None,
-                condition=cls._condition_from_raw(condition, kind),
-                )
-        return self
-
-    @property
-    def text(self):
-        if self.kind == 'ifdef':
-            return self.condition[8:-1]  # strip "defined("
-        elif self.kind == 'ifndef':
-            return self.condition[10:-1]  # strip "! defined("
-        else:
-            return self.condition
-        #return str(self.condition)
-
-    def validate(self):
-        """Fail if the object is invalid (i.e. init with bad data)."""
-        super().validate()
-
-        if not self.condition:
-            raise TypeError('missing condition')
-        #else:
-        #    for cond in self.condition:
-        #        if not cond:
-        #            raise ValueError(f'missing condition in {self.condition}')
-        #        cond.validate()
-        #    if self.kind in ('ifdef', 'ifndef'):
-        #        if len(self.condition) != 1:
-        #            raise ValueError('too many condition')
-        #        if self.kind == 'ifdef':
-        #            if not self.condition[0].startswith('defined '):
-        #                raise ValueError('bad condition')
-        #        else:
-        #            if not self.condition[0].startswith('! defined '):
-        #                raise ValueError('bad condition')
-
-
-class Include(PreprocessorDirective,
-              namedtuple('Include', 'kind file')):
-    """A single "include" directive.
-
-    Supported "file" values are either follow the bracket style
-    (<stdio>) or double quotes ("spam.h").
-    """
-
-    __slots__ = ()
-
-    def __new__(cls, file):
-        self = super().__new__(
-                cls,
-                kind='include',
-                file=_coerce_str(file) or None,
-                )
-        return self
-
-    def validate(self):
-        """Fail if the object is invalid (i.e. init with bad data)."""
-        super().validate()
-
-        if not self.file:
-            raise TypeError('missing file')
-
-
-class OtherDirective(PreprocessorDirective,
-                     namedtuple('OtherDirective', 'kind text')):
-    """A single directive not covered by another class.
-
-    This includes the "else", "endif", and "undef" directives, which are
-    otherwise inherently related to the directives covered by the
-    Constant, Macro, and IfCondition classes.
-
-    Note that all directives must have a text value, except for "else"
-    and "endif" (which must have no text).
-    """
-
-    __slots__ = ()
-
-    KINDS = PreprocessorDirective.KINDS - {'include', 'define'} - IfDirective.KINDS
-
-    def __new__(cls, kind, text):
-        self = super().__new__(
-                cls,
-                kind=_coerce_str(kind) or None,
-                text=_coerce_str(text) or None,
-                )
-        return self
-
-    def validate(self):
-        """Fail if the object is invalid (i.e. init with bad data)."""
-        super().validate()
-
-        if self.text:
-            if self.kind in ('else', 'endif'):
-                raise ValueError('unexpected text in directive')
-        elif self.kind not in ('else', 'endif'):
-            raise TypeError('missing text')
-
-
-#############################
-# iterating lines
-
-def _recompute_conditions(directive, ifstack):
-    if directive.kind in ('if', 'ifdef', 'ifndef'):
-        ifstack.append(
-                ([], directive.condition))
-    elif directive.kind == 'elseif':
-        if ifstack:
-            negated, active = ifstack.pop()
-            if active:
-                negated.append(active)
-        else:
-            negated = []
-        ifstack.append(
-                (negated, directive.condition))
-    elif directive.kind == 'else':
-        if ifstack:
-            negated, active = ifstack.pop()
-            if active:
-                negated.append(active)
-            ifstack.append(
-                    (negated, None))
-    elif directive.kind == 'endif':
-        if ifstack:
-            ifstack.pop()
-
-    conditions = []
-    for negated, active in ifstack:
-        for condition in negated:
-            conditions.append(f'! ({condition})')
-        if active:
-            conditions.append(active)
-    return tuple(conditions)
-
-
-def _iter_clean_lines(lines):
-    lines = iter(enumerate(lines, 1))
-    for lno, line in lines:
-        # Handle line continuations.
-        while line.endswith(CONTINUATION):
-            try:
-                lno, _line = next(lines)
-            except StopIteration:
-                break
-            line = line[:-len(CONTINUATION)] + ' ' + _line
-
-        # Deal with comments.
-        after = line
-        line = ''
-        while True:
-            # Look for a comment.
-            before, begin, remainder = after.partition('/*')
-            if '//' in before:
-                before, _, _ = before.partition('//')
-                line += before + ' '  # per the C99 spec
-                break
-            line += before
-            if not begin:
-                break
-            line += ' '  # per the C99 spec
-
-            # Go until we find the end of the comment.
-            _, end, after = remainder.partition('*/')
-            while not end:
-                try:
-                    lno, remainder = next(lines)
-                except StopIteration:
-                    raise Exception('unterminated comment')
-                _, end, after = remainder.partition('*/')
-
-        yield lno, line
-
-
-def iter_lines(lines, *,
-                   _iter_clean_lines=_iter_clean_lines,
-                   _parse_directive=_parse_directive,
-                   _recompute_conditions=_recompute_conditions,
-                   ):
-    """Yield (lno, line, directive, active conditions) for each given line.
-
-    This is effectively a subset of the operations taking place in
-    translation phases 2-4 from the C99 spec (ISO/IEC 9899:TC2); see
-    section 5.1.1.2.  Line continuations are removed and comments
-    replaced with a single space.  (In both cases "lno" will be the last
-    line involved.)  Otherwise each line is returned as-is.
-
-    "lno" is the (1-indexed) line number for the line.
-
-    "directive" will be a PreprocessorDirective or None, depending on
-    whether or not there is a directive on the line.
-
-    "active conditions" is the set of preprocessor conditions (e.g.
-    "defined()") under which the current line of code will be included
-    in compilation.  That set is derived from every conditional
-    directive block (e.g. "if defined()", "ifdef", "else") containing
-    that line.  That includes nested directives.  Note that the
-    current line does not affect the active conditions for iteself.
-    It only impacts subsequent lines.  That applies to directives
-    that close blocks (e.g. "endif") just as much as conditional
-    directvies.  Also note that "else" and "elseif" directives
-    update the active conditions (for later lines), rather than
-    adding to them.
-    """
-    ifstack = []
-    conditions = ()
-    for lno, line in _iter_clean_lines(lines):
-        stripped = line.strip()
-        if not stripped.startswith('#'):
-            yield lno, line, None, conditions
-            continue
-
-        directive = '#' + stripped[1:].lstrip()
-        while '  ' in directive:
-            directive = directive.replace('  ', ' ')
-        directive = _parse_directive(directive)
-        yield lno, line, directive, conditions
-
-        if directive.kind in ('else', 'endif'):
-            conditions = _recompute_conditions(directive, ifstack)
-        elif isinstance(directive, IfDirective):
-            conditions = _recompute_conditions(directive, ifstack)
-
-
-#############################
-# running (platform-specific?)
-
-def _gcc(filename, *,
-         _get_argv=(lambda: _get_gcc_argv()),
-         _run=util.run_cmd,
-         ):
-    argv = _get_argv()
-    argv.extend([
-            '-E', filename,
-            ])
-    output = _run(argv)
-    return output
-
-
-def _get_gcc_argv(*,
-                  _open=open,
-                  _run=util.run_cmd,
-                  ):
-    with _open('/tmp/print.mk', 'w') as tmpfile:
-        tmpfile.write('print-%:\n')
-        #tmpfile.write('\t@echo $* = $($*)\n')
-        tmpfile.write('\t@echo $($*)\n')
-    argv = ['/usr/bin/make',
-            '-f', 'Makefile',
-            '-f', '/tmp/print.mk',
-            'print-CC',
-            'print-PY_CORE_CFLAGS',
-            ]
-    output = _run(argv)
-    gcc, cflags = output.strip().splitlines()
-    argv = shlex.split(gcc.strip())
-    cflags = shlex.split(cflags.strip())
-    return argv + cflags
-
-
-def run(filename, *,
-        _gcc=_gcc,
-        ):
-    """Return the text of the given file after running the preprocessor."""
-    return _gcc(filename)
diff --git a/Tools/c-analyzer/c_analyzer/parser/source.py b/Tools/c-analyzer/c_analyzer/parser/source.py
deleted file mode 100644
index f8998c8..0000000
--- a/Tools/c-analyzer/c_analyzer/parser/source.py
+++ /dev/null
@@ -1,34 +0,0 @@
-from . import preprocessor
-
-
-def iter_clean_lines(lines):
-    incomment = False
-    for line in lines:
-        # Deal with comments.
-        if incomment:
-            _, sep, line = line.partition('*/')
-            if sep:
-                incomment = False
-            continue
-        line, _, _ = line.partition('//')
-        line, sep, remainder = line.partition('/*')
-        if sep:
-            _, sep, after = remainder.partition('*/')
-            if not sep:
-                incomment = True
-                continue
-            line += ' ' + after
-
-        # Ignore blank lines and leading/trailing whitespace.
-        line = line.strip()
-        if not line:
-            continue
-
-        yield line
-
-
-def iter_lines(filename, *,
-               preprocess=preprocessor.run,
-               ):
-    content = preprocess(filename)
-    return iter(content.splitlines())
diff --git a/Tools/c-analyzer/c_analyzer/symbols/__init__.py b/Tools/c-analyzer/c_analyzer/symbols/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/Tools/c-analyzer/c_analyzer/symbols/__init__.py
+++ /dev/null
diff --git a/Tools/c-analyzer/c_analyzer/symbols/_nm.py b/Tools/c-analyzer/c_analyzer/symbols/_nm.py
deleted file mode 100644
index f3a75a6..0000000
--- a/Tools/c-analyzer/c_analyzer/symbols/_nm.py
+++ /dev/null
@@ -1,117 +0,0 @@
-import os.path
-import shutil
-
-from c_analyzer.common import util, info
-
-from .info import Symbol
-
-
-# XXX need tests:
-# * iter_symbols
-
-NM_KINDS = {
-        'b': Symbol.KIND.VARIABLE,  # uninitialized
-        'd': Symbol.KIND.VARIABLE,  # initialized
-        #'g': Symbol.KIND.VARIABLE,  # uninitialized
-        #'s': Symbol.KIND.VARIABLE,  # initialized
-        't': Symbol.KIND.FUNCTION,
-        }
-
-SPECIAL_SYMBOLS = {
-        # binary format (e.g. ELF)
-        '__bss_start',
-        '__data_start',
-        '__dso_handle',
-        '_DYNAMIC',
-        '_edata',
-        '_end',
-        '__environ@@GLIBC_2.2.5',
-        '_GLOBAL_OFFSET_TABLE_',
-        '__JCR_END__',
-        '__JCR_LIST__',
-        '__TMC_END__',
-        }
-
-
-def _is_special_symbol(name):
-    if name in SPECIAL_SYMBOLS:
-        return True
-    if '@@GLIBC' in name:
-        return True
-    return False
-
-
-def iter_symbols(binfile, *,
-                 nm=None,
-                 handle_id=None,
-                 _which=shutil.which,
-                 _run=util.run_cmd,
-                 ):
-    """Yield a Symbol for each relevant entry reported by the "nm" command."""
-    if nm is None:
-        nm = _which('nm')
-        if not nm:
-            raise NotImplementedError
-    if handle_id is None:
-        handle_id = info.ID
-
-    argv = [nm,
-            '--line-numbers',
-            binfile,
-            ]
-    try:
-        output = _run(argv)
-    except Exception:
-        if nm is None:
-            # XXX Use dumpbin.exe /SYMBOLS on Windows.
-            raise NotImplementedError
-        raise
-    for line in output.splitlines():
-        (name, kind, external, filename, funcname,
-         ) = _parse_nm_line(line)
-        if kind != Symbol.KIND.VARIABLE:
-            continue
-        elif _is_special_symbol(name):
-            continue
-        yield Symbol(
-                id=handle_id(filename, funcname, name),
-                kind=kind,
-                external=external,
-                )
-
-
-def _parse_nm_line(line):
-    _origline = line
-    _, _, line = line.partition(' ')  # strip off the address
-    line = line.strip()
-
-    kind, _, line = line.partition(' ')
-    line = line.strip()
-    external = kind.isupper()
-    kind = NM_KINDS.get(kind.lower(), Symbol.KIND.OTHER)
-
-    name, _, filename = line.partition('\t')
-    name = name.strip()
-    if filename:
-        filename = os.path.relpath(filename.partition(':')[0])
-    else:
-        filename = info.UNKNOWN
-
-    name, islocal = _parse_nm_name(name, kind)
-    funcname = info.UNKNOWN if islocal else None
-    return name, kind, external, filename, funcname
-
-
-def _parse_nm_name(name, kind):
-    if kind != Symbol.KIND.VARIABLE:
-        return name, None
-    if _is_special_symbol(name):
-        return name, None
-
-    actual, sep, digits = name.partition('.')
-    if not sep:
-        return name, False
-
-    if not digits.isdigit():
-        raise Exception(f'got bogus name {name}')
-    return actual, True
diff --git a/Tools/c-analyzer/c_analyzer/symbols/find.py b/Tools/c-analyzer/c_analyzer/symbols/find.py
deleted file mode 100644
index 8564652..0000000
--- a/Tools/c-analyzer/c_analyzer/symbols/find.py
+++ /dev/null
@@ -1,175 +0,0 @@
-import os
-import os.path
-import shutil
-
-from ..common import files
-from ..common.info import UNKNOWN, ID
-from ..parser import find as p_find
-
-from . import _nm
-from .info import Symbol
-
-# XXX need tests:
-# * get_resolver()
-# * get_resolver_from_dirs()
-# * symbol()
-# * symbols()
-# * variables()
-
-
-def _resolve_known(symbol, knownvars):
-    for varid in knownvars:
-        if symbol.match(varid):
-            break
-    else:
-        return None
-    return knownvars.pop(varid)
-
-
-def get_resolver(filenames=None, known=None, *,
-                 handle_var,
-                 check_filename=None,
-                 perfilecache=None,
-                 preprocessed=False,
-                 _from_source=p_find.variable_from_id,
-                 ):
-    """Return a "resolver" func for the given known vars/types and filenames.
-
-    "handle_var" is a callable that takes (ID, decl) and returns a
-    Variable.  Variable.from_id is a suitable callable.
-
-    The returned func takes a single Symbol and returns a corresponding
-    Variable.  If the symbol was located then the variable will be
-    valid, populated with the corresponding information.  Otherwise None
-    is returned.
-    """
-    knownvars = (known or {}).get('variables')
-    if knownvars:
-        knownvars = dict(knownvars)  # a copy
-        if filenames:
-            if check_filename is None:
-                filenames = list(filenames)
-                def check_filename(filename):
-                    return filename in filenames
-            def resolve(symbol):
-                # XXX Check "found" instead?
-                if not check_filename(symbol.filename):
-                    return None
-                found = _resolve_known(symbol, knownvars)
-                if found is None:
-                    #return None
-                    varid, decl = _from_source(symbol, filenames,
-                                               perfilecache=perfilecache,
-                                               preprocessed=preprocessed,
-                                               )
-                    found = handle_var(varid, decl)
-                return found
-        else:
-            def resolve(symbol):
-                return _resolve_known(symbol, knownvars)
-    elif filenames:
-        def resolve(symbol):
-            varid, decl = _from_source(symbol, filenames,
-                                       perfilecache=perfilecache,
-                                       preprocessed=preprocessed,
-                                       )
-            return handle_var(varid, decl)
-    else:
-        def resolve(symbol):
-            return None
-    return resolve
-
-
-def get_resolver_from_dirs(dirnames, known=None, *,
-                           handle_var,
-                           suffixes=('.c',),
-                           perfilecache=None,
-                           preprocessed=False,
-                           _iter_files=files.iter_files_by_suffix,
-                           _get_resolver=get_resolver,
-                           ):
-    """Return a "resolver" func for the given known vars/types and filenames.
-
-    "dirnames" should be absolute paths.  If not then they will be
-    resolved relative to CWD.
-
-    See get_resolver().
-    """
-    dirnames = [d if d.endswith(os.path.sep) else d + os.path.sep
-                for d in dirnames]
-    filenames = _iter_files(dirnames, suffixes)
-    def check_filename(filename):
-        for dirname in dirnames:
-            if filename.startswith(dirname):
-                return True
-        else:
-            return False
-    return _get_resolver(filenames, known,
-                         handle_var=handle_var,
-                         check_filename=check_filename,
-                         perfilecache=perfilecache,
-                         preprocessed=preprocessed,
-                         )
-
-
-def symbol(symbol, filenames, known=None, *,
-           perfilecache=None,
-           preprocessed=False,
-           handle_id=None,
-           _get_resolver=get_resolver,
-           ):
-    """Return a Variable for the one matching the given symbol.
-
-    "symbol" can be one of several objects:
-
-    * Symbol - use the contained info
-    * name (str) - look for a global variable with that name
-    * (filename, name) - look for named global in file
-    * (filename, funcname, name) - look for named local in file
-
-    A name is always required.  If the filename is None, "", or
-    "UNKNOWN" then all files will be searched.  If the funcname is
-    "" or "UNKNOWN" then only local variables will be searched for.
-    """
-    resolve = _get_resolver(known, filenames,
-                            handle_id=handle_id,
-                            perfilecache=perfilecache,
-                            preprocessed=preprocessed,
-                            )
-    return resolve(symbol)
-
-
-def _get_platform_tool():
-    if os.name == 'nt':
-        # XXX Support this.
-        raise NotImplementedError
-    elif nm := shutil.which('nm'):
-        return lambda b, hi: _nm.iter_symbols(b, nm=nm, handle_id=hi)
-    else:
-        raise NotImplementedError
-
-
-def symbols(binfile, *,
-            handle_id=None,
-            _file_exists=os.path.exists,
-            _get_platform_tool=_get_platform_tool,
-            ):
-    """Yield a Symbol for each one found in the binary."""
-    if not _file_exists(binfile):
-        raise Exception('executable missing (need to build it first?)')
-
-    _iter_symbols = _get_platform_tool()
-    yield from _iter_symbols(binfile, handle_id)
-
-
-def variables(binfile, *,
-              resolve,
-              handle_id=None,
-              _iter_symbols=symbols,
-              ):
-    """Yield (Variable, Symbol) for each found symbol."""
-    for symbol in _iter_symbols(binfile, handle_id=handle_id):
-        if symbol.kind != Symbol.KIND.VARIABLE:
-            continue
-        var = resolve(symbol) or None
-        yield var, symbol
diff --git a/Tools/c-analyzer/c_analyzer/symbols/info.py b/Tools/c-analyzer/c_analyzer/symbols/info.py
deleted file mode 100644
index 96a251a..0000000
--- a/Tools/c-analyzer/c_analyzer/symbols/info.py
+++ /dev/null
@@ -1,51 +0,0 @@
-from collections import namedtuple
-
-from c_analyzer.common.info import ID
-from c_analyzer.common.util import classonly, _NTBase
-
-
-class Symbol(_NTBase, namedtuple('Symbol', 'id kind external')):
-    """Info for a single compilation symbol."""
-
-    __slots__ = ()
-
-    class KIND:
-        VARIABLE = 'variable'
-        FUNCTION = 'function'
-        OTHER = 'other'
-
-    @classonly
-    def from_name(cls, name, filename=None, kind=KIND.VARIABLE, external=None):
-        """Return a new symbol based on the given name."""
-        id = ID(filename, None, name)
-        return cls(id, kind, external)
-
-    def __new__(cls, id, kind=KIND.VARIABLE, external=None):
-        self = super().__new__(
-                cls,
-                id=ID.from_raw(id),
-                kind=str(kind) if kind else None,
-                external=bool(external) if external is not None else None,
-                )
-        return self
-
-    def __hash__(self):
-        return hash(self.id)
-
-    def __getattr__(self, name):
-        return getattr(self.id, name)
-
-    def validate(self):
-        """Fail if the object is invalid (i.e. init with bad data)."""
-        if not self.id:
-            raise TypeError('missing id')
-        else:
-            self.id.validate()
-
-        if not self.kind:
-            raise TypeError('missing kind')
-        elif self.kind not in vars(self.KIND).values():
-            raise ValueError(f'unsupported kind {self.kind}')
-
-        if self.external is None:
-            raise TypeError('missing external')
diff --git a/Tools/c-analyzer/c_analyzer/variables/__init__.py b/Tools/c-analyzer/c_analyzer/variables/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/Tools/c-analyzer/c_analyzer/variables/__init__.py
+++ /dev/null
diff --git a/Tools/c-analyzer/c_analyzer/variables/find.py b/Tools/c-analyzer/c_analyzer/variables/find.py
deleted file mode 100644
index 3fe7284..0000000
--- a/Tools/c-analyzer/c_analyzer/variables/find.py
+++ /dev/null
@@ -1,75 +0,0 @@
-from ..common import files
-from ..common.info import UNKNOWN
-from ..parser import (
-        find as p_find,
-        )
-from ..symbols import (
-        info as s_info,
-        find as s_find,
-        )
-from .info import Variable
-
-# XXX need tests:
-# * vars_from_source
-
-
-def _remove_cached(cache, var):
-    if not cache:
-        return
-    try:
-        cached = cache[var.filename]
-        cached.remove(var)
-    except (KeyError, IndexError):
-        pass
-
-
-def vars_from_binary(binfile, *,
-                     known=None,
-                     filenames=None,
-                     handle_id=None,
-                     check_filename=None,
-                     handle_var=Variable.from_id,
-                     _iter_vars=s_find.variables,
-                     _get_symbol_resolver=s_find.get_resolver,
-                     ):
-    """Yield a Variable for each found Symbol.
-
-    Details are filled in from the given "known" variables and types.
-    """
-    cache = {}
-    resolve = _get_symbol_resolver(filenames, known,
-                                   handle_var=handle_var,
-                                   check_filename=check_filename,
-                                   perfilecache=cache,
-                                   )
-    for var, symbol in _iter_vars(binfile,
-                                  resolve=resolve,
-                                  handle_id=handle_id,
-                                  ):
-        if var is None:
-            var = Variable(symbol.id, UNKNOWN, UNKNOWN)
-        yield var
-        _remove_cached(cache, var)
-
-
-def vars_from_source(filenames, *,
-                     preprocessed=None,
-                     known=None,
-                     handle_id=None,
-                     handle_var=Variable.from_id,
-                     iter_vars=p_find.variables,
-                     ):
-    """Yield a Variable for each declaration in the raw source code.
-
-    Details are filled in from the given "known" variables and types.
-    """
-    cache = {}
-    for varid, decl in iter_vars(filenames or (),
-                                 perfilecache=cache,
-                                 preprocessed=preprocessed,
-                                 known=known,
-                                 handle_id=handle_id,
-                                 ):
-        var = handle_var(varid, decl)
-        yield var
-        _remove_cached(cache, var)
diff --git a/Tools/c-analyzer/c_analyzer/variables/info.py b/Tools/c-analyzer/c_analyzer/variables/info.py
deleted file mode 100644
index 336a523..0000000
--- a/Tools/c-analyzer/c_analyzer/variables/info.py
+++ /dev/null
@@ -1,93 +0,0 @@
-from collections import namedtuple
-
-from ..common.info import ID, UNKNOWN
-from ..common.util import classonly, _NTBase
-
-
-def normalize_vartype(vartype):
-    """Return the canonical form for a variable type (or func signature)."""
-    # We allow empty strring through for semantic reasons.
-    if vartype is None:
-        return None
-
-    # XXX finish!
-    # XXX Return (modifiers, type, pointer)?
-    return str(vartype)
-
-
-# XXX Variable.vartype -> decl (Declaration).
-
-class Variable(_NTBase,
-               namedtuple('Variable', 'id storage vartype')):
-    """Information about a single variable declaration."""
-
-    __slots__ = ()
-
-    STORAGE = (
-            'static',
-            'extern',
-            'implicit',
-            'local',
-            )
-
-    @classonly
-    def from_parts(cls, filename, funcname, name, decl, storage=None):
-        varid = ID(filename, funcname, name)
-        if storage is None:
-            self = cls.from_id(varid, decl)
-        else:
-            self = cls(varid, storage, decl)
-        return self
-
-    @classonly
-    def from_id(cls, varid, decl):
-        from ..parser.declarations import extract_storage
-        storage = extract_storage(decl, infunc=varid.funcname)
-        return cls(varid, storage, decl)
-
-    def __new__(cls, id, storage, vartype):
-        self = super().__new__(
-                cls,
-                id=ID.from_raw(id),
-                storage=str(storage) if storage else None,
-                vartype=normalize_vartype(vartype) if vartype else None,
-                )
-        return self
-
-    def __hash__(self):
-        return hash(self.id)
-
-    def __getattr__(self, name):
-        return getattr(self.id, name)
-
-    def _validate_id(self):
-        if not self.id:
-            raise TypeError('missing id')
-
-        if not self.filename or self.filename == UNKNOWN:
-            raise TypeError(f'id missing filename ({self.id})')
-
-        if self.funcname and self.funcname == UNKNOWN:
-            raise TypeError(f'id missing funcname ({self.id})')
-
-        self.id.validate()
-
-    def validate(self):
-        """Fail if the object is invalid (i.e. init with bad data)."""
-        self._validate_id()
-
-        if self.storage is None or self.storage == UNKNOWN:
-            raise TypeError('missing storage')
-        elif self.storage not in self.STORAGE:
-            raise ValueError(f'unsupported storage {self.storage:r}')
-
-        if self.vartype is None or self.vartype == UNKNOWN:
-            raise TypeError('missing vartype')
-
-    @property
-    def isglobal(self):
-        return self.storage != 'local'
-
-    @property
-    def isconst(self):
-        return 'const' in self.vartype.split()
diff --git a/Tools/c-analyzer/c_analyzer/variables/known.py b/Tools/c-analyzer/c_analyzer/variables/known.py
deleted file mode 100644
index aa2934a..0000000
--- a/Tools/c-analyzer/c_analyzer/variables/known.py
+++ /dev/null
@@ -1,91 +0,0 @@
-import csv
-
-from ..common.info import ID, UNKNOWN
-from ..common.util import read_tsv
-from .info import Variable
-
-
-# XXX need tests:
-# * read_file()
-# * look_up_variable()
-
-
-COLUMNS = ('filename', 'funcname', 'name', 'kind', 'declaration')
-HEADER = '\t'.join(COLUMNS)
-
-
-def read_file(infile, *,
-              _read_tsv=read_tsv,
-              ):
-    """Yield (kind, id, decl) for each row in the data file.
-
-    The caller is responsible for validating each row.
-    """
-    for row in _read_tsv(infile, HEADER):
-        filename, funcname, name, kind, declaration = row
-        if not funcname or funcname == '-':
-            funcname = None
-        id = ID(filename, funcname, name)
-        yield kind, id, declaration
-
-
-def from_file(infile, *,
-              handle_var=Variable.from_id,
-              _read_file=read_file,
-              ):
-    """Return the info for known declarations in the given file."""
-    known = {
-        'variables': {},
-        #'types': {},
-        #'constants': {},
-        #'macros': {},
-        }
-    for kind, id, decl in _read_file(infile):
-        if kind == 'variable':
-            values = known['variables']
-            value = handle_var(id, decl)
-        else:
-            raise ValueError(f'unsupported kind in row {row}')
-        value.validate()
-        values[id] = value
-    return known
-
-
-def look_up_variable(varid, knownvars, *,
-                     match_files=(lambda f1, f2: f1 == f2),
-                     ):
-    """Return the known Variable matching the given ID.
-
-    "knownvars" is a mapping of ID to Variable.
-
-    "match_files" is used to verify if two filenames point to
-    the same file.
-
-    If no match is found then None is returned.
-    """
-    if not knownvars:
-        return None
-
-    if varid.funcname == UNKNOWN:
-        if not varid.filename or varid.filename == UNKNOWN:
-            for varid in knownvars:
-                if not varid.funcname:
-                    continue
-                if varid.name == varid.name:
-                    return knownvars[varid]
-            else:
-                return None
-        else:
-            for varid in knownvars:
-                if not varid.funcname:
-                    continue
-                if not match_files(varid.filename, varid.filename):
-                    continue
-                if varid.name == varid.name:
-                    return knownvars[varid]
-            else:
-                return None
-    elif not varid.filename or varid.filename == UNKNOWN:
-        raise NotImplementedError
-    else:
-        return knownvars.get(varid.id)
diff --git a/Tools/c-analyzer/c_common/__init__.py b/Tools/c-analyzer/c_common/__init__.py
new file mode 100644
index 0000000..a4c3bb2
--- /dev/null
+++ b/Tools/c-analyzer/c_common/__init__.py
@@ -0,0 +1,2 @@
+
+NOT_SET = object()
diff --git a/Tools/c-analyzer/c_common/clsutil.py b/Tools/c-analyzer/c_common/clsutil.py
new file mode 100644
index 0000000..aa5f6b9
--- /dev/null
+++ b/Tools/c-analyzer/c_common/clsutil.py
@@ -0,0 +1,117 @@
+
+_NOT_SET = object()
+
+
+class Slot:
+    """A descriptor that provides a slot.
+
+    This is useful for types that can't have slots via __slots__,
+    e.g. tuple subclasses.
+    """
+
+    __slots__ = ('initial', 'default', 'readonly', 'instances', 'name')
+
+    def __init__(self, initial=_NOT_SET, *,
+                 default=_NOT_SET,
+                 readonly=False,
+                 ):
+        self.initial = initial
+        self.default = default
+        self.readonly = readonly
+
+        # The instance cache is not inherently tied to the normal
+        # lifetime of the instances.  So must do something in order to
+        # avoid keeping the instances alive by holding a reference here.
+        # Ideally we would use weakref.WeakValueDictionary to do this.
+        # However, most builtin types do not support weakrefs.  So
+        # instead we monkey-patch __del__ on the attached class to clear
+        # the instance.
+        self.instances = {}
+        self.name = None
+
+    def __set_name__(self, cls, name):
+        if self.name is not None:
+            raise TypeError('already used')
+        self.name = name
+        try:
+            slotnames = cls.__slot_names__
+        except AttributeError:
+            slotnames = cls.__slot_names__ = []
+        slotnames.append(name)
+        self._ensure___del__(cls, slotnames)
+
+    def __get__(self, obj, cls):
+        if obj is None:  # called on the class
+            return self
+        try:
+            value = self.instances[id(obj)]
+        except KeyError:
+            if self.initial is _NOT_SET:
+                value = self.default
+            else:
+                value = self.initial
+            self.instances[id(obj)] = value
+        if value is _NOT_SET:
+            raise AttributeError(self.name)
+        # XXX Optionally make a copy?
+        return value
+
+    def __set__(self, obj, value):
+        if self.readonly:
+            raise AttributeError(f'{self.name} is readonly')
+        # XXX Optionally coerce?
+        self.instances[id(obj)] = value
+
+    def __delete__(self, obj):
+        if self.readonly:
+            raise AttributeError(f'{self.name} is readonly')
+        self.instances[id(obj)] = self.default  # XXX refleak?
+
+    def _ensure___del__(self, cls, slotnames):  # See the comment in __init__().
+        try:
+            old___del__ = cls.__del__
+        except AttributeError:
+            old___del__ = (lambda s: None)
+        else:
+            if getattr(old___del__, '_slotted', False):
+                return
+
+        def __del__(_self):
+            for name in slotnames:
+                delattr(_self, name)
+            old___del__(_self)
+        __del__._slotted = True
+        cls.__del__ = __del__
+
+    def set(self, obj, value):
+        """Update the cached value for an object.
+
+        This works even if the descriptor is read-only.  This is
+        particularly useful when initializing the object (e.g. in
+        its __new__ or __init__).
+        """
+        self.instances[id(obj)] = value
+
+
+class classonly:
+    """A non-data descriptor that makes a value only visible on the class.
+
+    This is like the "classmethod" builtin, but does not show up on
+    instances of the class.  It may be used as a decorator.
+    """
+
+    def __init__(self, value):
+        self.value = value
+        self.getter = classmethod(value).__get__
+        self.name = None
+
+    def __set_name__(self, cls, name):
+        if self.name is not None:
+            raise TypeError('already used')
+        self.name = name
+
+    def __get__(self, obj, cls):
+        if obj is not None:
+            raise AttributeError(self.name)
+        # called on the class
+        return self.getter(None, cls)
diff --git a/Tools/c-analyzer/c_common/fsutil.py b/Tools/c-analyzer/c_common/fsutil.py
new file mode 100644
index 0000000..120a140
--- /dev/null
+++ b/Tools/c-analyzer/c_common/fsutil.py
@@ -0,0 +1,458 @@
+import fnmatch
+import glob
+import os
+import os.path
+import shutil
+import stat
+
+from .iterutil import iter_many
+
+
+USE_CWD = object()
+
+
+C_SOURCE_SUFFIXES = ('.c', '.h')
+
+
+def create_backup(old, backup=None):
+    if isinstance(old, str):
+        filename = old
+    else:
+        filename = getattr(old, 'name', None)
+    if not filename:
+        return None
+    if not backup or backup is True:
+        backup = f'{filename}.bak'
+    try:
+        shutil.copyfile(filename, backup)
+    except FileNotFoundError as exc:
+        if exc.filename != filename:
+            raise   # re-raise
+        backup = None
+    return backup
+
+
+##################################
+# filenames
+
+def fix_filename(filename, relroot=USE_CWD, *,
+                 fixroot=True,
+                 _badprefix=f'..{os.path.sep}',
+                 ):
+    """Return a normalized, absolute-path copy of the given filename."""
+    if not relroot or relroot is USE_CWD:
+        return os.path.abspath(filename)
+    if fixroot:
+        relroot = os.path.abspath(relroot)
+    return _fix_filename(filename, relroot)
+
+
+def _fix_filename(filename, relroot, *,
+                  _badprefix=f'..{os.path.sep}',
+                  ):
+    orig = filename
+
+    # First we normalize.
+    filename = os.path.normpath(filename)
+    if filename.startswith(_badprefix):
+        raise ValueError(f'bad filename {orig!r} (resolves beyond relative root')
+
+    # Now make sure it is absolute (relative to relroot).
+    if not os.path.isabs(filename):
+        filename = os.path.join(relroot, filename)
+    else:
+        relpath = os.path.relpath(filename, relroot)
+        if os.path.join(relroot, relpath) != filename:
+            raise ValueError(f'expected {relroot!r} as lroot, got {orig!r}')
+
+    return filename
+
+
+def fix_filenames(filenames, relroot=USE_CWD):
+    if not relroot or relroot is USE_CWD:
+        filenames = (os.path.abspath(v) for v in filenames)
+    else:
+        relroot = os.path.abspath(relroot)
+        filenames = (_fix_filename(v, relroot) for v in filenames)
+    return filenames, relroot
+
+
+def format_filename(filename, relroot=USE_CWD, *,
+                    fixroot=True,
+                    normalize=True,
+                    _badprefix=f'..{os.path.sep}',
+                    ):
+    """Return a consistent relative-path representation of the filename."""
+    orig = filename
+    if normalize:
+        filename = os.path.normpath(filename)
+    if relroot is None:
+        # Otherwise leave it as-is.
+        return filename
+    elif relroot is USE_CWD:
+        # Make it relative to CWD.
+        filename = os.path.relpath(filename)
+    else:
+        # Make it relative to "relroot".
+        if fixroot:
+            relroot = os.path.abspath(relroot)
+        elif not relroot:
+            raise ValueError('missing relroot')
+        filename = os.path.relpath(filename, relroot)
+    if filename.startswith(_badprefix):
+        raise ValueError(f'bad filename {orig!r} (resolves beyond relative root')
+    return filename
+
+
+##################################
+# find files
+
+def match_glob(filename, pattern):
+    if fnmatch.fnmatch(filename, pattern):
+        return True
+
+    # fnmatch doesn't handle ** quite right.  It will not match the
+    # following:
+    #
+    #  ('x/spam.py', 'x/**/*.py')
+    #  ('spam.py', '**/*.py')
+    #
+    # though it *will* match the following:
+    #
+    #  ('x/y/spam.py', 'x/**/*.py')
+    #  ('x/spam.py', '**/*.py')
+
+    if '**/' not in pattern:
+        return False
+
+    # We only accommodate the single-"**" case.
+    return fnmatch.fnmatch(filename, pattern.replace('**/', '', 1))
+
+
+def process_filenames(filenames, *,
+                      start=None,
+                      include=None,
+                      exclude=None,
+                      relroot=USE_CWD,
+                      ):
+    if relroot and relroot is not USE_CWD:
+        relroot = os.path.abspath(relroot)
+    if start:
+        start = fix_filename(start, relroot, fixroot=False)
+    if include:
+        include = set(fix_filename(v, relroot, fixroot=False)
+                      for v in include)
+    if exclude:
+        exclude = set(fix_filename(v, relroot, fixroot=False)
+                      for v in exclude)
+
+    onempty = Exception('no filenames provided')
+    for filename, solo in iter_many(filenames, onempty):
+        filename = fix_filename(filename, relroot, fixroot=False)
+        relfile = format_filename(filename, relroot, fixroot=False, normalize=False)
+        check, start = _get_check(filename, start, include, exclude)
+        yield filename, relfile, check, solo
+
+
+def expand_filenames(filenames):
+    for filename in filenames:
+        # XXX Do we need to use glob.escape (a la commit 9355868458, GH-20994)?
+        if '**/' in filename:
+            yield from glob.glob(filename.replace('**/', ''))
+        yield from glob.glob(filename)
+
+
+def _get_check(filename, start, include, exclude):
+    if start and filename != start:
+        return (lambda: '<skipped>'), start
+    else:
+        def check():
+            if _is_excluded(filename, exclude, include):
+                return '<excluded>'
+            return None
+        return check, None
+
+
+def _is_excluded(filename, exclude, include):
+    if include:
+        for included in include:
+            if match_glob(filename, included):
+                return False
+        return True
+    elif exclude:
+        for excluded in exclude:
+            if match_glob(filename, excluded):
+                return True
+        return False
+    else:
+        return False
+
+
+def _walk_tree(root, *,
+               _walk=os.walk,
+               ):
+    # A wrapper around os.walk that resolves the filenames.
+    for parent, _, names in _walk(root):
+        for name in names:
+            yield os.path.join(parent, name)
+
+
+def walk_tree(root, *,
+              suffix=None,
+              walk=_walk_tree,
+              ):
+    """Yield each file in the tree under the given directory name.
+
+    If "suffix" is provided then only files with that suffix will
+    be included.
+    """
+    if suffix and not isinstance(suffix, str):
+        raise ValueError('suffix must be a string')
+
+    for filename in walk(root):
+        if suffix and not filename.endswith(suffix):
+            continue
+        yield filename
+
+
+def glob_tree(root, *,
+              suffix=None,
+              _glob=glob.iglob,
+              ):
+    """Yield each file in the tree under the given directory name.
+
+    If "suffix" is provided then only files with that suffix will
+    be included.
+    """
+    suffix = suffix or ''
+    if not isinstance(suffix, str):
+        raise ValueError('suffix must be a string')
+
+    for filename in _glob(f'{root}/*{suffix}'):
+        yield filename
+    for filename in _glob(f'{root}/**/*{suffix}'):
+        yield filename
+
+
+def iter_files(root, suffix=None, relparent=None, *,
+               get_files=os.walk,
+               _glob=glob_tree,
+               _walk=walk_tree,
+               ):
+    """Yield each file in the tree under the given directory name.
+
+    If "root" is a non-string iterable then do the same for each of
+    those trees.
+
+    If "suffix" is provided then only files with that suffix will
+    be included.
+
+    if "relparent" is provided then it is used to resolve each
+    filename as a relative path.
+    """
+    if not isinstance(root, str):
+        roots = root
+        for root in roots:
+            yield from iter_files(root, suffix, relparent,
+                                  get_files=get_files,
+                                  _glob=_glob, _walk=_walk)
+        return
+
+    # Use the right "walk" function.
+    if get_files in (glob.glob, glob.iglob, glob_tree):
+        get_files = _glob
+    else:
+        _files = _walk_tree if get_files in (os.walk, walk_tree) else get_files
+        get_files = (lambda *a, **k: _walk(*a, walk=_files, **k))
+
+    # Handle a single suffix.
+    if suffix and not isinstance(suffix, str):
+        filenames = get_files(root)
+        suffix = tuple(suffix)
+    else:
+        filenames = get_files(root, suffix=suffix)
+        suffix = None
+
+    for filename in filenames:
+        if suffix and not isinstance(suffix, str):  # multiple suffixes
+            if not filename.endswith(suffix):
+                continue
+        if relparent:
+            filename = os.path.relpath(filename, relparent)
+        yield filename
+
+
+def iter_files_by_suffix(root, suffixes, relparent=None, *,
+                         walk=walk_tree,
+                         _iter_files=iter_files,
+                         ):
+    """Yield each file in the tree that has the given suffixes.
+
+    Unlike iter_files(), the results are in the original suffix order.
+    """
+    if isinstance(suffixes, str):
+        suffixes = [suffixes]
+    # XXX Ignore repeated suffixes?
+    for suffix in suffixes:
+        yield from _iter_files(root, suffix, relparent)
+
+
+##################################
+# file info
+
+# XXX posix-only?
+
+S_IRANY = stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH
+S_IWANY = stat.S_IWUSR | stat.S_IWGRP | stat.S_IWOTH
+S_IXANY = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH
+
+
+def is_readable(file, *, user=None, check=False):
+    filename, st, mode = _get_file_info(file)
+    if check:
+        try:
+            okay = _check_file(filename, S_IRANY)
+        except NotImplementedError:
+            okay = NotImplemented
+        if okay is not NotImplemented:
+            return okay
+        # Fall back to checking the mode.
+    return _check_mode(st, mode, S_IRANY, user)
+
+
+def is_writable(file, *, user=None, check=False):
+    filename, st, mode = _get_file_info(file)
+    if check:
+        try:
+            okay = _check_file(filename, S_IWANY)
+        except NotImplementedError:
+            okay = NotImplemented
+        if okay is not NotImplemented:
+            return okay
+        # Fall back to checking the mode.
+    return _check_mode(st, mode, S_IWANY, user)
+
+
+def is_executable(file, *, user=None, check=False):
+    filename, st, mode = _get_file_info(file)
+    if check:
+        try:
+            okay = _check_file(filename, S_IXANY)
+        except NotImplementedError:
+            okay = NotImplemented
+        if okay is not NotImplemented:
+            return okay
+        # Fall back to checking the mode.
+    return _check_mode(st, mode, S_IXANY, user)
+
+
+def _get_file_info(file):
+    filename = st = mode = None
+    if isinstance(file, int):
+        mode = file
+    elif isinstance(file, os.stat_result):
+        st = file
+    else:
+        if isinstance(file, str):
+            filename = file
+        elif hasattr(file, 'name') and os.path.exists(file.name):
+            filename = file.name
+        else:
+            raise NotImplementedError(file)
+        st = os.stat(filename)
+    return filename, st, mode or st.st_mode
+
+
+def _check_file(filename, check):
+    if not isinstance(filename, str):
+        raise Exception(f'filename required to check file, got {filename}')
+    if check & S_IRANY:
+        flags = os.O_RDONLY
+    elif check & S_IWANY:
+        flags = os.O_WRONLY
+    elif check & S_IXANY:
+        # We can worry about S_IXANY later
+        return NotImplemented
+    else:
+        raise NotImplementedError(check)
+
+    try:
+        fd = os.open(filename, flags)
+    except PermissionError:
+        return False
+    # We do not ignore other exceptions.
+    else:
+        os.close(fd)
+        return True
+
+
+def _get_user_info(user):
+    import pwd
+    username = uid = gid = groups = None
+    if user is None:
+        uid = os.geteuid()
+        #username = os.getlogin()
+        username = pwd.getpwuid(uid)[0]
+        gid = os.getgid()
+        groups = os.getgroups()
+    else:
+        if isinstance(user, int):
+            uid = user
+            entry = pwd.getpwuid(uid)
+            username = entry.pw_name
+        elif isinstance(user, str):
+            username = user
+            entry = pwd.getpwnam(username)
+            uid = entry.pw_uid
+        else:
+            raise NotImplementedError(user)
+        gid = entry.pw_gid
+        os.getgrouplist(username, gid)
+    return username, uid, gid, groups
+
+
+def _check_mode(st, mode, check, user):
+    orig = check
+    _, uid, gid, groups = _get_user_info(user)
+    if check & S_IRANY:
+        check -= S_IRANY
+        matched = False
+        if mode & stat.S_IRUSR:
+            if st.st_uid == uid:
+                matched = True
+        if mode & stat.S_IRGRP:
+            if st.st_uid == gid or st.st_uid in groups:
+                matched = True
+        if mode & stat.S_IROTH:
+            matched = True
+        if not matched:
+            return False
+    if check & S_IWANY:
+        check -= S_IWANY
+        matched = False
+        if mode & stat.S_IWUSR:
+            if st.st_uid == uid:
+                matched = True
+        if mode & stat.S_IWGRP:
+            if st.st_uid == gid or st.st_uid in groups:
+                matched = True
+        if mode & stat.S_IWOTH:
+            matched = True
+        if not matched:
+            return False
+    if check & S_IXANY:
+        check -= S_IXANY
+        matched = False
+        if mode & stat.S_IXUSR:
+            if st.st_uid == uid:
+                matched = True
+        if mode & stat.S_IXGRP:
+            if st.st_uid == gid or st.st_uid in groups:
+                matched = True
+        if mode & stat.S_IXOTH:
+            matched = True
+        if not matched:
+            return False
+    if check:
+        raise NotImplementedError((orig, check))
+    return True
diff --git a/Tools/c-analyzer/c_analyzer/common/__init__.py b/Tools/c-analyzer/c_common/info.py
similarity index 100%
rename from Tools/c-analyzer/c_analyzer/common/__init__.py
rename to Tools/c-analyzer/c_common/info.py
diff --git a/Tools/c-analyzer/c_common/iterutil.py b/Tools/c-analyzer/c_common/iterutil.py
new file mode 100644
index 0000000..6ded105
--- /dev/null
+++ b/Tools/c-analyzer/c_common/iterutil.py
@@ -0,0 +1,48 @@
+
+_NOT_SET = object()
+
+
+def peek_and_iter(items):
+    if not items:
+        return None, None
+    items = iter(items)
+    try:
+        peeked = next(items)
+    except StopIteration:
+        return None, None
+    def chain():
+        yield peeked
+        yield from items
+    return chain(), peeked
+
+
+def iter_many(items, onempty=None):
+    if not items:
+        if onempty is None:
+            return
+        if not callable(onempty):
+            raise onEmpty
+        items = onempty(items)
+        yield from iter_many(items, onempty=None)
+        return
+    items = iter(items)
+    try:
+        first = next(items)
+    except StopIteration:
+        if onempty is None:
+            return
+        if not callable(onempty):
+            raise onEmpty
+        items = onempty(items)
+        yield from iter_many(items, onempty=None)
+    else:
+        try:
+            second = next(items)
+        except StopIteration:
+            yield first, False
+            return
+        else:
+            yield first, True
+            yield second, True
+        for item in items:
+            yield item, True
diff --git a/Tools/c-analyzer/c_common/logging.py b/Tools/c-analyzer/c_common/logging.py
new file mode 100644
index 0000000..10af852
--- /dev/null
+++ b/Tools/c-analyzer/c_common/logging.py
@@ -0,0 +1,63 @@
+import logging
+import sys
+
+
+VERBOSITY = 3
+
+
+# The root logger for the whole top-level package:
+_logger = logging.getLogger(__name__.rpartition('.')[0])
+
+
+def configure_logger(logger, verbosity=VERBOSITY, *,
+                     logfile=None,
+                     maxlevel=logging.CRITICAL,
+                     ):
+    level = max(1,  # 0 disables it, so we use the next lowest.
+                min(maxlevel,
+                    maxlevel - verbosity * 10))
+    logger.setLevel(level)
+    #logger.propagate = False
+
+    if not logger.handlers:
+        if logfile:
+            handler = logging.FileHandler(logfile)
+        else:
+            handler = logging.StreamHandler(sys.stdout)
+        handler.setLevel(level)
+        #handler.setFormatter(logging.Formatter())
+        logger.addHandler(handler)
+
+    # In case the provided logger is in a sub-package...
+    if logger is not _logger:
+        configure_logger(
+            _logger,
+            verbosity,
+            logfile=logfile,
+            maxlevel=maxlevel,
+        )
+
+
+def hide_emit_errors():
+    """Ignore errors while emitting log entries.
+
+    Rather than printing a message describing the error, we show nothing.
+    """
+    # For now we simply ignore all exceptions.  If we wanted to ignore
+    # specific ones (e.g. BrokenPipeError) then we would need to use
+    # a Handler subclass with a custom handleError() method.
+    orig = logging.raiseExceptions
+    logging.raiseExceptions = False
+    def restore():
+        logging.raiseExceptions = orig
+    return restore
+
+
+class Printer:
+    def __init__(self, verbosity=VERBOSITY):
+        self.verbosity = verbosity
+
+    def info(self, *args, **kwargs):
+        if self.verbosity < 3:
+            return
+        print(*args, **kwargs)
diff --git a/Tools/c-analyzer/c_common/misc.py b/Tools/c-analyzer/c_common/misc.py
new file mode 100644
index 0000000..bfd503a
--- /dev/null
+++ b/Tools/c-analyzer/c_common/misc.py
@@ -0,0 +1,7 @@
+
+class Labeled:
+    __slots__ = ('_label',)
+    def __init__(self, label):
+        self._label = label
+    def __repr__(self):
+        return f'<{self._label}>'
diff --git a/Tools/c-analyzer/c_common/scriptutil.py b/Tools/c-analyzer/c_common/scriptutil.py
new file mode 100644
index 0000000..ce69af2
--- /dev/null
+++ b/Tools/c-analyzer/c_common/scriptutil.py
@@ -0,0 +1,628 @@
+import argparse
+import contextlib
+import fnmatch
+import logging
+import os
+import os.path
+import shutil
+import sys
+
+from . import fsutil, strutil, iterutil, logging as loggingutil
+
+
+_NOT_SET = object()
+
+
+def get_prog(spec=None, *, absolute=False, allowsuffix=True):
+    if spec is None:
+        _, spec = _find_script()
+        # This is more natural for prog than __file__ would be.
+        filename = sys.argv[0]
+    elif isinstance(spec, str):
+        filename = os.path.normpath(spec)
+        spec = None
+    else:
+        filename = spec.origin
+    if _is_standalone(filename):
+        # Check if "installed".
+        if allowsuffix or not filename.endswith('.py'):
+            basename = os.path.basename(filename)
+            found = shutil.which(basename)
+            if found:
+                script = os.path.abspath(filename)
+                found = os.path.abspath(found)
+                if os.path.normcase(script) == os.path.normcase(found):
+                    return basename
+        # It is only "standalone".
+        if absolute:
+            filename = os.path.abspath(filename)
+        return filename
+    elif spec is not None:
+        module = spec.name
+        if module.endswith('.__main__'):
+            module = module[:-9]
+        return f'{sys.executable} -m {module}'
+    else:
+        if absolute:
+            filename = os.path.abspath(filename)
+        return f'{sys.executable} {filename}'
+
+
+def _find_script():
+    frame = sys._getframe(2)
+    while frame.f_globals['__name__'] != '__main__':
+        frame = frame.f_back
+
+    # This should match sys.argv[0].
+    filename = frame.f_globals['__file__']
+    # This will be None if -m wasn't used..
+    spec = frame.f_globals['__spec__']
+    return filename, spec
+
+
+def is_installed(filename, *, allowsuffix=True):
+    if not allowsuffix and filename.endswith('.py'):
+        return False
+    filename = os.path.abspath(os.path.normalize(filename))
+    found = shutil.which(os.path.basename(filename))
+    if not found:
+        return False
+    if found != filename:
+        return False
+    return _is_standalone(filename)
+
+
+def is_standalone(filename):
+    filename = os.path.abspath(os.path.normalize(filename))
+    return _is_standalone(filename)
+
+
+def _is_standalone(filename):
+    return fsutil.is_executable(filename)
+
+
+##################################
+# logging
+
+VERBOSITY = 3
+
+TRACEBACK = os.environ.get('SHOW_TRACEBACK', '').strip()
+TRACEBACK = bool(TRACEBACK and TRACEBACK.upper() not in ('0', 'FALSE', 'NO'))
+
+
+logger = logging.getLogger(__name__)
+
+
+def configure_logger(verbosity, logger=None, **kwargs):
+    if logger is None:
+        # Configure the root logger.
+        logger = logging.getLogger()
+    loggingutil.configure_logger(logger, verbosity, **kwargs)
+
+
+##################################
+# selections
+
+class UnsupportedSelectionError(Exception):
+    def __init__(self, values, possible):
+        self.values = tuple(values)
+        self.possible = tuple(possible)
+        super().__init__(f'unsupported selections {self.unique}')
+
+    @property
+    def unique(self):
+        return tuple(sorted(set(self.values)))
+
+
+def normalize_selection(selected: str, *, possible=None):
+    if selected in (None, True, False):
+        return selected
+    elif isinstance(selected, str):
+        selected = [selected]
+    elif not selected:
+        return ()
+
+    unsupported = []
+    _selected = set()
+    for item in selected:
+        if not item:
+            continue
+        for value in item.strip().replace(',', ' ').split():
+            if not value:
+                continue
+            # XXX Handle subtraction (leading "-").
+            if possible and value not in possible and value != 'all':
+                unsupported.append(value)
+            _selected.add(value)
+    if unsupported:
+        raise UnsupportedSelectionError(unsupported, tuple(possible))
+    if 'all' in _selected:
+        return True
+    return frozenset(selected)
+
+
+##################################
+# CLI parsing helpers
+
+class CLIArgSpec(tuple):
+    def __new__(cls, *args, **kwargs):
+        return super().__new__(cls, (args, kwargs))
+
+    def __repr__(self):
+        args, kwargs = self
+        args = [repr(arg) for arg in args]
+        for name, value in kwargs.items():
+            args.append(f'{name}={value!r}')
+        return f'{type(self).__name__}({", ".join(args)})'
+
+    def __call__(self, parser, *, _noop=(lambda a: None)):
+        self.apply(parser)
+        return _noop
+
+    def apply(self, parser):
+        args, kwargs = self
+        parser.add_argument(*args, **kwargs)
+
+
+def apply_cli_argspecs(parser, specs):
+    processors = []
+    for spec in specs:
+        if callable(spec):
+            procs = spec(parser)
+            _add_procs(processors, procs)
+        else:
+            args, kwargs = spec
+            parser.add_argument(args, kwargs)
+    return processors
+
+
+def _add_procs(flattened, procs):
+    # XXX Fail on non-empty, non-callable procs?
+    if not procs:
+        return
+    if callable(procs):
+        flattened.append(procs)
+    else:
+        #processors.extend(p for p in procs if callable(p))
+        for proc in procs:
+            _add_procs(flattened, proc)
+
+
+def add_verbosity_cli(parser):
+    parser.add_argument('-q', '--quiet', action='count', default=0)
+    parser.add_argument('-v', '--verbose', action='count', default=0)
+
+    def process_args(args, *, argv=None):
+        ns = vars(args)
+        key = 'verbosity'
+        if key in ns:
+            parser.error(f'duplicate arg {key!r}')
+        ns[key] = max(0, VERBOSITY + ns.pop('verbose') - ns.pop('quiet'))
+        return key
+    return process_args
+
+
+def add_traceback_cli(parser):
+    parser.add_argument('--traceback', '--tb', action='store_true',
+                        default=TRACEBACK)
+    parser.add_argument('--no-traceback', '--no-tb', dest='traceback',
+                        action='store_const', const=False)
+
+    def process_args(args, *, argv=None):
+        ns = vars(args)
+        key = 'traceback_cm'
+        if key in ns:
+            parser.error(f'duplicate arg {key!r}')
+        showtb = ns.pop('traceback')
+
+        @contextlib.contextmanager
+        def traceback_cm():
+            restore = loggingutil.hide_emit_errors()
+            try:
+                yield
+            except BrokenPipeError:
+                # It was piped to "head" or something similar.
+                pass
+            except NotImplementedError:
+                raise  # re-raise
+            except Exception as exc:
+                if not showtb:
+                    sys.exit(f'ERROR: {exc}')
+                raise  # re-raise
+            except KeyboardInterrupt:
+                if not showtb:
+                    sys.exit('\nINTERRUPTED')
+                raise  # re-raise
+            except BaseException as exc:
+                if not showtb:
+                    sys.exit(f'{type(exc).__name__}: {exc}')
+                raise  # re-raise
+            finally:
+                restore()
+        ns[key] = traceback_cm()
+        return key
+    return process_args
+
+
+def add_sepval_cli(parser, opt, dest, choices, *, sep=',', **kwargs):
+#    if opt is True:
+#        parser.add_argument(f'--{dest}', action='append', **kwargs)
+#    elif isinstance(opt, str) and opt.startswith('-'):
+#        parser.add_argument(opt, dest=dest, action='append', **kwargs)
+#    else:
+#        arg = dest if not opt else opt
+#        kwargs.setdefault('nargs', '+')
+#        parser.add_argument(arg, dest=dest, action='append', **kwargs)
+    if not isinstance(opt, str):
+        parser.error(f'opt must be a string, got {opt!r}')
+    elif opt.startswith('-'):
+        parser.add_argument(opt, dest=dest, action='append', **kwargs)
+    else:
+        kwargs.setdefault('nargs', '+')
+        #kwargs.setdefault('metavar', opt.upper())
+        parser.add_argument(opt, dest=dest, action='append', **kwargs)
+
+    def process_args(args, *, argv=None):
+        ns = vars(args)
+
+        # XXX Use normalize_selection()?
+        if isinstance(ns[dest], str):
+            ns[dest] = [ns[dest]]
+        selections = []
+        for many in ns[dest] or ():
+            for value in many.split(sep):
+                if value not in choices:
+                    parser.error(f'unknown {dest} {value!r}')
+                selections.append(value)
+        ns[dest] = selections
+    return process_args
+
+
+def add_files_cli(parser, *, excluded=None, nargs=None):
+    process_files = add_file_filtering_cli(parser, excluded=excluded)
+    parser.add_argument('filenames', nargs=nargs or '+', metavar='FILENAME')
+    return [
+        process_files,
+    ]
+
+
+def add_file_filtering_cli(parser, *, excluded=None):
+    parser.add_argument('--start')
+    parser.add_argument('--include', action='append')
+    parser.add_argument('--exclude', action='append')
+
+    excluded = tuple(excluded or ())
+
+    def process_args(args, *, argv=None):
+        ns = vars(args)
+        key = 'iter_filenames'
+        if key in ns:
+            parser.error(f'duplicate arg {key!r}')
+
+        _include = tuple(ns.pop('include') or ())
+        _exclude = excluded + tuple(ns.pop('exclude') or ())
+        kwargs = dict(
+            start=ns.pop('start'),
+            include=tuple(_parse_files(_include)),
+            exclude=tuple(_parse_files(_exclude)),
+            # We use the default for "show_header"
+        )
+        def process_filenames(filenames, relroot=None):
+            return fsutil.process_filenames(filenames, relroot=relroot, **kwargs)
+        ns[key] = process_filenames
+    return process_args
+
+
+def _parse_files(filenames):
+    for filename, _ in strutil.parse_entries(filenames):
+        yield filename.strip()
+
+
+def add_progress_cli(parser, *, threshold=VERBOSITY, **kwargs):
+    parser.add_argument('--progress', dest='track_progress', action='store_const', const=True)
+    parser.add_argument('--no-progress', dest='track_progress', action='store_false')
+    parser.set_defaults(track_progress=True)
+
+    def process_args(args, *, argv=None):
+        if args.track_progress:
+            ns = vars(args)
+            verbosity = ns.get('verbosity', VERBOSITY)
+            if verbosity <= threshold:
+                args.track_progress = track_progress_compact
+            else:
+                args.track_progress = track_progress_flat
+    return process_args
+
+
+def add_failure_filtering_cli(parser, pool, *, default=False):
+    parser.add_argument('--fail', action='append',
+                        metavar=f'"{{all|{"|".join(sorted(pool))}}},..."')
+    parser.add_argument('--no-fail', dest='fail', action='store_const', const=())
+
+    def process_args(args, *, argv=None):
+        ns = vars(args)
+
+        fail = ns.pop('fail')
+        try:
+            fail = normalize_selection(fail, possible=pool)
+        except UnsupportedSelectionError as exc:
+            parser.error(f'invalid --fail values: {", ".join(exc.unique)}')
+        else:
+            if fail is None:
+                fail = default
+
+            if fail is True:
+                def ignore_exc(_exc):
+                    return False
+            elif fail is False:
+                def ignore_exc(_exc):
+                    return True
+            else:
+                def ignore_exc(exc):
+                    for err in fail:
+                        if type(exc) == pool[err]:
+                            return False
+                    else:
+                        return True
+            args.ignore_exc = ignore_exc
+    return process_args
+
+
+def add_kind_filtering_cli(parser, *, default=None):
+    parser.add_argument('--kinds', action='append')
+
+    def process_args(args, *, argv=None):
+        ns = vars(args)
+
+        kinds = []
+        for kind in ns.pop('kinds') or default or ():
+            kinds.extend(kind.strip().replace(',', ' ').split())
+
+        if not kinds:
+            match_kind = (lambda k: True)
+        else:
+            included = set()
+            excluded = set()
+            for kind in kinds:
+                if kind.startswith('-'):
+                    kind = kind[1:]
+                    excluded.add(kind)
+                    if kind in included:
+                        included.remove(kind)
+                else:
+                    included.add(kind)
+                    if kind in excluded:
+                        excluded.remove(kind)
+            if excluded:
+                if included:
+                    ...  # XXX fail?
+                def match_kind(kind, *, _excluded=excluded):
+                    return kind not in _excluded
+            else:
+                def match_kind(kind, *, _included=included):
+                    return kind in _included
+        args.match_kind = match_kind
+    return process_args
+
+
+COMMON_CLI = [
+    add_verbosity_cli,
+    add_traceback_cli,
+    #add_dryrun_cli,
+]
+
+
+def add_commands_cli(parser, commands, *, commonspecs=COMMON_CLI, subset=None):
+    arg_processors = {}
+    if isinstance(subset, str):
+        cmdname = subset
+        try:
+            _, argspecs, _ = commands[cmdname]
+        except KeyError:
+            raise ValueError(f'unsupported subset {subset!r}')
+        parser.set_defaults(cmd=cmdname)
+        arg_processors[cmdname] = _add_cmd_cli(parser, commonspecs, argspecs)
+    else:
+        if subset is None:
+            cmdnames = subset = list(commands)
+        elif not subset:
+            raise NotImplementedError
+        elif isinstance(subset, set):
+            cmdnames = [k for k in commands if k in subset]
+            subset = sorted(subset)
+        else:
+            cmdnames = [n for n in subset if n in commands]
+        if len(cmdnames) < len(subset):
+            bad = tuple(n for n in subset if n not in commands)
+            raise ValueError(f'unsupported subset {bad}')
+
+        common = argparse.ArgumentParser(add_help=False)
+        common_processors = apply_cli_argspecs(common, commonspecs)
+        subs = parser.add_subparsers(dest='cmd')
+        for cmdname in cmdnames:
+            description, argspecs, _ = commands[cmdname]
+            sub = subs.add_parser(
+                cmdname,
+                description=description,
+                parents=[common],
+            )
+            cmd_processors = _add_cmd_cli(sub, (), argspecs)
+            arg_processors[cmdname] = common_processors + cmd_processors
+    return arg_processors
+
+
+def _add_cmd_cli(parser, commonspecs, argspecs):
+    processors = []
+    argspecs = list(commonspecs or ()) + list(argspecs or ())
+    for argspec in argspecs:
+        if callable(argspec):
+            procs = argspec(parser)
+            _add_procs(processors, procs)
+        else:
+            if not argspec:
+                raise NotImplementedError
+            args = list(argspec)
+            if not isinstance(args[-1], str):
+                kwargs = args.pop()
+                if not isinstance(args[0], str):
+                    try:
+                        args, = args
+                    except (TypeError, ValueError):
+                        parser.error(f'invalid cmd args {argspec!r}')
+            else:
+                kwargs = {}
+            parser.add_argument(*args, **kwargs)
+            # There will be nothing to process.
+    return processors
+
+
+def _flatten_processors(processors):
+    for proc in processors:
+        if proc is None:
+            continue
+        if callable(proc):
+            yield proc
+        else:
+            yield from _flatten_processors(proc)
+
+
+def process_args(args, argv, processors, *, keys=None):
+    processors = _flatten_processors(processors)
+    ns = vars(args)
+    extracted = {}
+    if keys is None:
+        for process_args in processors:
+            for key in process_args(args, argv=argv):
+                extracted[key] = ns.pop(key)
+    else:
+        remainder = set(keys)
+        for process_args in processors:
+            hanging = process_args(args, argv=argv)
+            if isinstance(hanging, str):
+                hanging = [hanging]
+            for key in hanging or ():
+                if key not in remainder:
+                    raise NotImplementedError(key)
+                extracted[key] = ns.pop(key)
+                remainder.remove(key)
+        if remainder:
+            raise NotImplementedError(sorted(remainder))
+    return extracted
+
+
+def process_args_by_key(args, argv, processors, keys):
+    extracted = process_args(args, argv, processors, keys=keys)
+    return [extracted[key] for key in keys]
+
+
+##################################
+# commands
+
+def set_command(name, add_cli):
+    """A decorator factory to set CLI info."""
+    def decorator(func):
+        if hasattr(func, '__cli__'):
+            raise Exception(f'already set')
+        func.__cli__ = (name, add_cli)
+        return func
+    return decorator
+
+
+##################################
+# main() helpers
+
+def filter_filenames(filenames, process_filenames=None, relroot=fsutil.USE_CWD):
+    # We expect each filename to be a normalized, absolute path.
+    for filename, _, check, _ in _iter_filenames(filenames, process_filenames, relroot):
+        if (reason := check()):
+            logger.debug(f'{filename}: {reason}')
+            continue
+        yield filename
+
+
+def main_for_filenames(filenames, process_filenames=None, relroot=fsutil.USE_CWD):
+    filenames, relroot = fsutil.fix_filenames(filenames, relroot=relroot)
+    for filename, relfile, check, show in _iter_filenames(filenames, process_filenames, relroot):
+        if show:
+            print()
+            print(relfile)
+            print('-------------------------------------------')
+        if (reason := check()):
+            print(reason)
+            continue
+        yield filename, relfile
+
+
+def _iter_filenames(filenames, process, relroot):
+    if process is None:
+        yield from fsutil.process_filenames(filenames, relroot=relroot)
+        return
+
+    onempty = Exception('no filenames provided')
+    items = process(filenames, relroot=relroot)
+    items, peeked = iterutil.peek_and_iter(items)
+    if not items:
+        raise onempty
+    if isinstance(peeked, str):
+        if relroot and relroot is not fsutil.USE_CWD:
+            relroot = os.path.abspath(relroot)
+        check = (lambda: True)
+        for filename, ismany in iterutil.iter_many(items, onempty):
+            relfile = fsutil.format_filename(filename, relroot, fixroot=False)
+            yield filename, relfile, check, ismany
+    elif len(peeked) == 4:
+        yield from items
+    else:
+        raise NotImplementedError
+
+
+def track_progress_compact(items, *, groups=5, **mark_kwargs):
+    last = os.linesep
+    marks = iter_marks(groups=groups, **mark_kwargs)
+    for item in items:
+        last = next(marks)
+        print(last, end='', flush=True)
+        yield item
+    if not last.endswith(os.linesep):
+        print()
+
+
+def track_progress_flat(items, fmt='<{}>'):
+    for item in items:
+        print(fmt.format(item), flush=True)
+        yield item
+
+
+def iter_marks(mark='.', *, group=5, groups=2, lines=_NOT_SET, sep=' '):
+    mark = mark or ''
+    group = group if group and group > 1 else 1
+    groups = groups if groups and groups > 1 else 1
+
+    sep = f'{mark}{sep}' if sep else mark
+    end = f'{mark}{os.linesep}'
+    div = os.linesep
+    perline = group * groups
+    if lines is _NOT_SET:
+        # By default we try to put about 100 in each line group.
+        perlines = 100 // perline * perline
+    elif not lines or lines < 0:
+        perlines = None
+    else:
+        perlines = perline * lines
+
+    if perline == 1:
+        yield end
+    elif group == 1:
+        yield sep
+
+    count = 1
+    while True:
+        if count % perline == 0:
+            yield end
+            if perlines and count % perlines == 0:
+                yield div
+        elif count % group == 0:
+            yield sep
+        else:
+            yield mark
+        count += 1
diff --git a/Tools/c-analyzer/c_analyzer/common/__init__.py b/Tools/c-analyzer/c_common/show.py
similarity index 100%
copy from Tools/c-analyzer/c_analyzer/common/__init__.py
copy to Tools/c-analyzer/c_common/show.py
diff --git a/Tools/c-analyzer/c_common/strutil.py b/Tools/c-analyzer/c_common/strutil.py
new file mode 100644
index 0000000..07193c0
--- /dev/null
+++ b/Tools/c-analyzer/c_common/strutil.py
@@ -0,0 +1,42 @@
+import logging
+
+
+logger = logging.getLogger(__name__)
+
+
+def unrepr(value):
+    raise NotImplementedError
+
+
+def parse_entries(entries, *, ignoresep=None):
+    for entry in entries:
+        if ignoresep and ignoresep in entry:
+            subentries = [entry]
+        else:
+            subentries = entry.strip().replace(',', ' ').split()
+        for item in subentries:
+            if item.startswith('+'):
+                filename = item[1:]
+                try:
+                    infile = open(filename)
+                except FileNotFoundError:
+                    logger.debug(f'ignored in parse_entries(): +{filename}')
+                    return
+                with infile:
+                    # We read the entire file here to ensure the file
+                    # gets closed sooner rather than later.  Note that
+                    # the file would stay open if this iterator is never
+                    # exhausted.
+                    lines = infile.read().splitlines()
+                for line in _iter_significant_lines(lines):
+                    yield line, filename
+            else:
+                yield item, None
+
+
+def _iter_significant_lines(lines):
+    for line in lines:
+        line = line.partition('#')[0]
+        if not line.strip():
+            continue
+        yield line
diff --git a/Tools/c-analyzer/c_common/tables.py b/Tools/c-analyzer/c_common/tables.py
new file mode 100644
index 0000000..130be6b
--- /dev/null
+++ b/Tools/c-analyzer/c_common/tables.py
@@ -0,0 +1,390 @@
+import csv
+import re
+import textwrap
+
+from . import NOT_SET, strutil, fsutil
+
+
+EMPTY = '-'
+UNKNOWN = '???'
+
+
+def parse_markers(markers, default=None):
+    if markers is NOT_SET:
+        return default
+    if not markers:
+        return None
+    if type(markers) is not str:
+        return markers
+    if markers == markers[0] * len(markers):
+        return [markers]
+    return list(markers)
+
+
+def fix_row(row, **markers):
+    if isinstance(row, str):
+        raise NotImplementedError(row)
+    empty = parse_markers(markers.pop('empty', ('-',)))
+    unknown = parse_markers(markers.pop('unknown', ('???',)))
+    row = (val if val else None for val in row)
+    if not empty:
+        if unknown:
+            row = (UNKNOWN if val in unknown else val for val in row)
+    elif not unknown:
+        row = (EMPTY if val in empty else val for val in row)
+    else:
+        row = (EMPTY if val in empty else (UNKNOWN if val in unknown else val)
+               for val in row)
+    return tuple(row)
+
+
+def _fix_read_default(row):
+    for value in row:
+        yield value.strip()
+
+
+def _fix_write_default(row, empty=''):
+    for value in row:
+        yield empty if value is None else str(value)
+
+
+def _normalize_fix_read(fix):
+    if fix is None:
+        fix = ''
+    if callable(fix):
+        def fix_row(row):
+            values = fix(row)
+            return _fix_read_default(values)
+    elif isinstance(fix, str):
+        def fix_row(row):
+            values = _fix_read_default(row)
+            return (None if v == fix else v
+                    for v in values)
+    else:
+        raise NotImplementedError(fix)
+    return fix_row
+
+
+def _normalize_fix_write(fix, empty=''):
+    if fix is None:
+        fix = empty
+    if callable(fix):
+        def fix_row(row):
+            values = fix(row)
+            return _fix_write_default(values, empty)
+    elif isinstance(fix, str):
+        def fix_row(row):
+            return _fix_write_default(row, fix)
+    else:
+        raise NotImplementedError(fix)
+    return fix_row
+
+
+def read_table(infile, header, *,
+               sep='\t',
+               fix=None,
+               _open=open,
+               _get_reader=csv.reader,
+               ):
+    """Yield each row of the given ???-separated (e.g. tab) file."""
+    if isinstance(infile, str):
+        with _open(infile, newline='') as infile:
+            yield from read_table(
+                infile,
+                header,
+                sep=sep,
+                fix=fix,
+                _open=_open,
+                _get_reader=_get_reader,
+            )
+            return
+    lines = strutil._iter_significant_lines(infile)
+
+    # Validate the header.
+    if not isinstance(header, str):
+        header = sep.join(header)
+    try:
+        actualheader = next(lines).strip()
+    except StopIteration:
+        actualheader = ''
+    if actualheader != header:
+        raise ValueError(f'bad header {actualheader!r}')
+
+    fix_row = _normalize_fix_read(fix)
+    for row in _get_reader(lines, delimiter=sep or '\t'):
+        yield tuple(fix_row(row))
+
+
+def write_table(outfile, header, rows, *,
+                sep='\t',
+                fix=None,
+                backup=True,
+                _open=open,
+                _get_writer=csv.writer,
+                ):
+    """Write each of the rows to the given ???-separated (e.g. tab) file."""
+    if backup:
+        fsutil.create_backup(outfile, backup)
+    if isinstance(outfile, str):
+        with _open(outfile, 'w', newline='') as outfile:
+            return write_table(
+                outfile,
+                header,
+                rows,
+                sep=sep,
+                fix=fix,
+                backup=backup,
+                _open=_open,
+                _get_writer=_get_writer,
+            )
+
+    if isinstance(header, str):
+        header = header.split(sep or '\t')
+    fix_row = _normalize_fix_write(fix)
+    writer = _get_writer(outfile, delimiter=sep or '\t')
+    writer.writerow(header)
+    for row in rows:
+        writer.writerow(
+            tuple(fix_row(row))
+        )
+
+
+def parse_table(entries, sep, header=None, rawsep=None, *,
+                default=NOT_SET,
+                strict=True,
+                ):
+    header, sep = _normalize_table_file_props(header, sep)
+    if not sep:
+        raise ValueError('missing "sep"')
+
+    ncols = None
+    if header:
+        if strict:
+            ncols = len(header.split(sep))
+        cur_file = None
+    for line, filename in strutil.parse_entries(entries, ignoresep=sep):
+        _sep = sep
+        if filename:
+            if header and cur_file != filename:
+                cur_file = filename
+                # Skip the first line if it's the header.
+                if line.strip() == header:
+                    continue
+                else:
+                    # We expected the header.
+                    raise NotImplementedError((header, line))
+        elif rawsep and sep not in line:
+            _sep = rawsep
+
+        row = _parse_row(line, _sep, ncols, default)
+        if strict and not ncols:
+            ncols = len(row)
+        yield row, filename
+
+
+def parse_row(line, sep, *, ncols=None, default=NOT_SET):
+    if not sep:
+        raise ValueError('missing "sep"')
+    return _parse_row(line, sep, ncols, default)
+
+
+def _parse_row(line, sep, ncols, default):
+    row = tuple(v.strip() for v in line.split(sep))
+    if (ncols or 0) > 0:
+        diff = ncols - len(row)
+        if diff:
+            if default is NOT_SET or diff < 0:
+                raise Exception(f'bad row (expected {ncols} columns, got {row!r})')
+            row += (default,) * diff
+    return row
+
+
+def _normalize_table_file_props(header, sep):
+    if not header:
+        return None, sep
+
+    if not isinstance(header, str):
+        if not sep:
+            raise NotImplementedError(header)
+        header = sep.join(header)
+    elif not sep:
+        for sep in ('\t', ',', ' '):
+            if sep in header:
+                break
+        else:
+            sep = None
+    return header, sep
+
+
+##################################
+# stdout tables
+
+WIDTH = 20
+
+
+def resolve_columns(specs):
+    if isinstance(specs, str):
+        specs = specs.replace(',', ' ').strip().split()
+    return _resolve_colspecs(specs)
+
+
+def build_table(specs, *, sep=' ', defaultwidth=None):
+    columns = resolve_columns(specs)
+    return _build_table(columns, sep=sep, defaultwidth=defaultwidth)
+
+
+_COLSPEC_RE = re.compile(textwrap.dedent(r'''
+    ^
+    (?:
+        \[
+        (
+            (?: [^\s\]] [^\]]* )?
+            [^\s\]]
+        )  # <label>
+        ]
+    )?
+    ( \w+ )  # <field>
+    (?:
+        (?:
+            :
+            ( [<^>] )  # <align>
+            ( \d+ )  # <width1>
+        )
+        |
+        (?:
+            (?:
+                :
+                ( \d+ )  # <width2>
+            )?
+            (?:
+                :
+                ( .*? )  # <fmt>
+            )?
+        )
+    )?
+    $
+'''), re.VERBOSE)
+
+
+def _parse_fmt(fmt):
+    if fmt.startswith(tuple('<^>')):
+        align = fmt[0]
+        width = fmt[1:]
+        if width.isdigit():
+            return int(width), align
+    return None, None
+
+
+def _parse_colspec(raw):
+    m = _COLSPEC_RE.match(raw)
+    if not m:
+        return None
+    label, field, align, width1, width2, fmt = m.groups()
+    if not label:
+        label = field
+    if width1:
+        width = None
+        fmt = f'{align}{width1}'
+    elif width2:
+        width = int(width2)
+        if fmt:
+            _width, _ = _parse_fmt(fmt)
+            if _width == width:
+                width = None
+    else:
+        width = None
+    return field, label, width, fmt
+
+
+def _normalize_colspec(spec):
+    if len(spec) == 1:
+        raw, = spec
+        return _resolve_column(raw)
+
+    if len(spec) == 4:
+        label, field, width, fmt = spec
+        if width:
+            fmt = f'{width}:{fmt}' if fmt else width
+    elif len(raw) == 3:
+        label, field, fmt = spec
+        if not field:
+            label, field = None, label
+        elif not isinstance(field, str) or not field.isidentifier():
+            fmt = f'{field}:{fmt}' if fmt else field
+            label, field = None, label
+    elif len(raw) == 2:
+        label = None
+        field, fmt = raw
+        if not field:
+            field, fmt = fmt, None
+        elif not field.isidentifier() or fmt.isidentifier():
+            label, field = field, fmt
+    else:
+        raise NotImplementedError
+
+    fmt = f':{fmt}' if fmt else ''
+    if label:
+        return _parse_colspec(f'[{label}]{field}{fmt}')
+    else:
+        return _parse_colspec(f'{field}{fmt}')
+
+
+def _resolve_colspec(raw):
+    if isinstance(raw, str):
+        spec = _parse_colspec(raw)
+    else:
+        spec = _normalize_colspec(raw)
+    if spec is None:
+        raise ValueError(f'unsupported column spec {raw!r}')
+    return spec
+
+
+def _resolve_colspecs(columns):
+    parsed = []
+    for raw in columns:
+        column = _resolve_colspec(raw)
+        parsed.append(column)
+    return parsed
+
+
+def _resolve_width(spec, defaultwidth):
+    _, label, width, fmt = spec
+    if width:
+        if not isinstance(width, int):
+            raise NotImplementedError
+        return width
+    elif width and fmt:
+        width, _ = _parse_fmt(fmt)
+        if width:
+            return width
+
+    if not defaultwidth:
+        return WIDTH
+    elif not hasattr(defaultwidth, 'get'):
+        return defaultwidth or WIDTH
+
+    defaultwidths = defaultwidth
+    defaultwidth = defaultwidths.get(None) or WIDTH
+    return defaultwidths.get(label) or defaultwidth
+
+
+def _build_table(columns, *, sep=' ', defaultwidth=None):
+    header = []
+    div = []
+    rowfmt = []
+    for spec in columns:
+        label, field, _, colfmt = spec
+        width = _resolve_width(spec, defaultwidth)
+        if colfmt:
+            colfmt = f':{colfmt}'
+        else:
+            colfmt = f':{width}'
+
+        header.append(f' {{:^{width}}} '.format(label))
+        div.append('-' * (width + 2))
+        rowfmt.append(f' {{{field}{colfmt}}} ')
+    return (
+        sep.join(header),
+        sep.join(div),
+        sep.join(rowfmt),
+    )
diff --git a/Tools/c-analyzer/c_parser/__init__.py b/Tools/c-analyzer/c_parser/__init__.py
new file mode 100644
index 0000000..39455dd
--- /dev/null
+++ b/Tools/c-analyzer/c_parser/__init__.py
@@ -0,0 +1,46 @@
+from .parser import parse as _parse
+from .preprocessor import get_preprocessor as _get_preprocessor
+
+
+def parse_file(filename, *,
+               match_kind=None,
+               get_file_preprocessor=None,
+               ):
+    if get_file_preprocessor is None:
+        get_file_preprocessor = _get_preprocessor()
+    yield from _parse_file(filename, match_kind, get_file_preprocessor)
+
+
+def parse_files(filenames, *,
+                match_kind=None,
+                get_file_preprocessor=None,
+                ):
+    if get_file_preprocessor is None:
+        get_file_preprocessor = _get_preprocessor()
+    for filename in filenames:
+        yield from _parse_file(filename, match_kind, get_file_preprocessor)
+
+
+def _parse_file(filename, match_kind, get_file_preprocessor):
+    # Preprocess the file.
+    preprocess = get_file_preprocessor(filename)
+    preprocessed = preprocess()
+    if preprocessed is None:
+        return
+
+    # Parse the lines.
+    srclines = ((l.file, l.data) for l in preprocessed if l.kind == 'source')
+    for item in _parse(srclines):
+        if match_kind is not None and not match_kind(item.kind):
+            continue
+        if not item.filename:
+            raise NotImplementedError(repr(item))
+        yield item
+
+
+def parse_signature(text):
+    raise NotImplementedError
+
+
+# aliases
+from .info import resolve_parsed
diff --git a/Tools/c-analyzer/c_parser/__main__.py b/Tools/c-analyzer/c_parser/__main__.py
new file mode 100644
index 0000000..78f47a1
--- /dev/null
+++ b/Tools/c-analyzer/c_parser/__main__.py
@@ -0,0 +1,266 @@
+import logging
+import os.path
+import sys
+
+from c_common import fsutil
+from c_common.scriptutil import (
+    CLIArgSpec as Arg,
+    add_verbosity_cli,
+    add_traceback_cli,
+    add_kind_filtering_cli,
+    add_files_cli,
+    add_commands_cli,
+    process_args_by_key,
+    configure_logger,
+    get_prog,
+    main_for_filenames,
+)
+from .preprocessor import get_preprocessor
+from .preprocessor.__main__ import (
+    add_common_cli as add_preprocessor_cli,
+)
+from .info import KIND
+from . import parse_file as _iter_parsed
+
+
+logger = logging.getLogger(__name__)
+
+
+def _format_vartype(vartype):
+    if isinstance(vartype, str):
+        return vartype
+
+    data = vartype
+    try:
+        vartype = data['vartype']
+    except KeyError:
+        storage, typequal, typespec, abstract = vartype.values()
+    else:
+        storage = data.get('storage')
+        if storage:
+            _, typequal, typespec, abstract = vartype.values()
+        else:
+            storage, typequal, typespec, abstract = vartype.values()
+
+    vartype = f'{typespec} {abstract}'
+    if typequal:
+        vartype = f'{typequal} {vartype}'
+    if storage:
+        vartype = f'{storage} {vartype}'
+    return vartype
+
+
+def _get_preprocessor(filename, **kwargs):
+    return get_processor(filename,
+                         log_err=print,
+                         **kwargs
+                         )
+
+
+#######################################
+# the formats
+
+def fmt_raw(filename, item, *, showfwd=None):
+    yield str(tuple(item))
+
+
+def fmt_summary(filename, item, *, showfwd=None):
+    if item.filename != filename:
+        yield f'> {item.filename}'
+
+    if showfwd is None:
+        LINE = ' {lno:>5} {kind:10} {funcname:40} {fwd:1} {name:40} {data}'
+    else:
+        LINE = ' {lno:>5} {kind:10} {funcname:40} {name:40} {data}'
+    lno = kind = funcname = fwd = name = data = ''
+    MIN_LINE = len(LINE.format(**locals()))
+
+    fileinfo, kind, funcname, name, data = item
+    lno = fileinfo.lno if fileinfo and fileinfo.lno >= 0 else ''
+    funcname = funcname or ' --'
+    name = name or ' --'
+    isforward = False
+    if kind is KIND.FUNCTION:
+        storage, inline, params, returntype, isforward = data.values()
+        returntype = _format_vartype(returntype)
+        data = returntype + params
+        if inline:
+            data = f'inline {data}'
+        if storage:
+            data = f'{storage} {data}'
+    elif kind is KIND.VARIABLE:
+        data = _format_vartype(data)
+    elif kind is KIND.STRUCT or kind is KIND.UNION:
+        if data is None:
+            isforward = True
+        else:
+            fields = data
+            data = f'({len(data)}) {{ '
+            indent = ',\n' + ' ' * (MIN_LINE + len(data))
+            data += ', '.join(f.name for f in fields[:5])
+            fields = fields[5:]
+            while fields:
+                data = f'{data}{indent}{", ".join(f.name for f in fields[:5])}'
+                fields = fields[5:]
+            data += ' }'
+    elif kind is KIND.ENUM:
+        if data is None:
+            isforward = True
+        else:
+            names = [d if isinstance(d, str) else d.name
+                     for d in data]
+            data = f'({len(data)}) {{ '
+            indent = ',\n' + ' ' * (MIN_LINE + len(data))
+            data += ', '.join(names[:5])
+            names = names[5:]
+            while names:
+                data = f'{data}{indent}{", ".join(names[:5])}'
+                names = names[5:]
+            data += ' }'
+    elif kind is KIND.TYPEDEF:
+        data = f'typedef {data}'
+    elif kind == KIND.STATEMENT:
+        pass
+    else:
+        raise NotImplementedError(item)
+    if isforward:
+        fwd = '*'
+        if not showfwd and showfwd is not None:
+            return
+    elif showfwd:
+        return
+    kind = kind.value
+    yield LINE.format(**locals())
+
+
+def fmt_full(filename, item, *, showfwd=None):
+    raise NotImplementedError
+
+
+FORMATS = {
+    'raw': fmt_raw,
+    'summary': fmt_summary,
+    'full': fmt_full,
+}
+
+
+def add_output_cli(parser):
+    parser.add_argument('--format', dest='fmt', default='summary', choices=tuple(FORMATS))
+    parser.add_argument('--showfwd', action='store_true', default=None)
+    parser.add_argument('--no-showfwd', dest='showfwd', action='store_false', default=None)
+
+    def process_args(args, *, argv=None):
+        pass
+    return process_args
+
+
+#######################################
+# the commands
+
+def _cli_parse(parser, excluded=None, **prepr_kwargs):
+    process_output = add_output_cli(parser)
+    process_kinds = add_kind_filtering_cli(parser)
+    process_preprocessor = add_preprocessor_cli(parser, **prepr_kwargs)
+    process_files = add_files_cli(parser, excluded=excluded)
+    return [
+        process_output,
+        process_kinds,
+        process_preprocessor,
+        process_files,
+    ]
+
+
+def cmd_parse(filenames, *,
+              fmt='summary',
+              showfwd=None,
+              iter_filenames=None,
+              relroot=None,
+              **kwargs
+              ):
+    if 'get_file_preprocessor' not in kwargs:
+        kwargs['get_file_preprocessor'] = _get_preprocessor()
+    try:
+        do_fmt = FORMATS[fmt]
+    except KeyError:
+        raise ValueError(f'unsupported fmt {fmt!r}')
+    for filename, relfile in main_for_filenames(filenames, iter_filenames, relroot):
+        for item in _iter_parsed(filename, **kwargs):
+            item = item.fix_filename(relroot, fixroot=False, normalize=False)
+            for line in do_fmt(relfile, item, showfwd=showfwd):
+                print(line)
+
+
+def _cli_data(parser):
+    ...
+
+    return []
+
+
+def cmd_data(filenames,
+             **kwargs
+             ):
+    # XXX
+    raise NotImplementedError
+
+
+COMMANDS = {
+    'parse': (
+        'parse the given C source & header files',
+        [_cli_parse],
+        cmd_parse,
+    ),
+    'data': (
+        'check/manage local data (e.g. excludes, macros)',
+        [_cli_data],
+        cmd_data,
+    ),
+}
+
+
+#######################################
+# the script
+
+def parse_args(argv=sys.argv[1:], prog=sys.argv[0], *, subset='parse'):
+    import argparse
+    parser = argparse.ArgumentParser(
+        prog=prog or get_prog,
+    )
+
+    processors = add_commands_cli(
+        parser,
+        commands={k: v[1] for k, v in COMMANDS.items()},
+        commonspecs=[
+            add_verbosity_cli,
+            add_traceback_cli,
+        ],
+        subset=subset,
+    )
+
+    args = parser.parse_args(argv)
+    ns = vars(args)
+
+    cmd = ns.pop('cmd')
+
+    verbosity, traceback_cm = process_args_by_key(
+        args,
+        argv,
+        processors[cmd],
+        ['verbosity', 'traceback_cm'],
+    )
+
+    return cmd, ns, verbosity, traceback_cm
+
+
+def main(cmd, cmd_kwargs):
+    try:
+        run_cmd = COMMANDS[cmd][0]
+    except KeyError:
+        raise ValueError(f'unsupported cmd {cmd!r}')
+    run_cmd(**cmd_kwargs)
+
+
+if __name__ == '__main__':
+    cmd, cmd_kwargs, verbosity, traceback_cm = parse_args()
+    configure_logger(verbosity)
+    with traceback_cm:
+        main(cmd, cmd_kwargs)
diff --git a/Tools/c-analyzer/c_parser/_state_machine.py b/Tools/c-analyzer/c_parser/_state_machine.py
new file mode 100644
index 0000000..53cbb13
--- /dev/null
+++ b/Tools/c-analyzer/c_parser/_state_machine.py
@@ -0,0 +1,244 @@
+
+f'''
+    struct {ANON_IDENTIFIER};
+    struct {{ ... }}
+    struct {IDENTIFIER} {{ ... }}
+
+    union {ANON_IDENTIFIER};
+    union {{ ... }}
+    union {IDENTIFIER} {{ ... }}
+
+    enum {ANON_IDENTIFIER};
+    enum {{ ... }}
+    enum {IDENTIFIER} {{ ... }}
+
+    typedef {VARTYPE} {IDENTIFIER};
+    typedef {IDENTIFIER};
+    typedef {IDENTIFIER};
+    typedef {IDENTIFIER};
+'''
+
+
+def parse(srclines):
+    if isinstance(srclines, str):  # a filename
+        raise NotImplementedError
+
+
+
+# This only handles at most 10 nested levels.
+#MATCHED_PARENS = textwrap.dedent(rf'''
+#    # matched parens
+#    (?:
+#        [(]  # level 0
+#        (?:
+#            [^()]*
+#            [(]  # level 1
+#            (?:
+#                [^()]*
+#                [(]  # level 2
+#                (?:
+#                    [^()]*
+#                    [(]  # level 3
+#                    (?:
+#                        [^()]*
+#                        [(]  # level 4
+#                        (?:
+#                            [^()]*
+#                            [(]  # level 5
+#                            (?:
+#                                [^()]*
+#                                [(]  # level 6
+#                                (?:
+#                                    [^()]*
+#                                    [(]  # level 7
+#                                    (?:
+#                                        [^()]*
+#                                        [(]  # level 8
+#                                        (?:
+#                                            [^()]*
+#                                            [(]  # level 9
+#                                            (?:
+#                                                [^()]*
+#                                                [(]  # level 10
+#                                                [^()]*
+#                                                [)]
+#                                             )*
+#                                            [^()]*
+#                                            [)]
+#                                         )*
+#                                        [^()]*
+#                                        [)]
+#                                     )*
+#                                    [^()]*
+#                                    [)]
+#                                 )*
+#                                [^()]*
+#                                [)]
+#                             )*
+#                            [^()]*
+#                            [)]
+#                         )*
+#                        [^()]*
+#                        [)]
+#                     )*
+#                    [^()]*
+#                    [)]
+#                 )*
+#                [^()]*
+#                [)]
+#             )*
+#            [^()]*
+#            [)]
+#         )*
+#        [^()]*
+#        [)]
+#     )
+#    # end matched parens
+#    ''')
+
+'''
+        # for loop
+        (?:
+            \s* \b for
+            \s* [(]
+            (
+                [^;]* ;
+                [^;]* ;
+                .*?
+             )  # <header>
+            [)]
+            \s*
+            (?:
+                (?:
+                    (
+                        {_ind(SIMPLE_STMT, 6)}
+                     )  # <stmt>
+                    ;
+                 )
+                |
+                ( {{ )  # <open>
+             )
+         )
+        |
+
+
+
+            (
+                (?:
+                    (?:
+                        (?:
+                            {_ind(SIMPLE_STMT, 6)}
+                         )?
+                        return \b \s*
+                        {_ind(INITIALIZER, 5)}
+                     )
+                    |
+                    (?:
+                        (?:
+                            {IDENTIFIER} \s*
+                            (?: . | -> ) \s*
+                         )*
+                        {IDENTIFIER}
+                        \s* = \s*
+                        {_ind(INITIALIZER, 5)}
+                     )
+                    |
+                    (?:
+                        {_ind(SIMPLE_STMT, 5)}
+                     )
+                 )
+                |
+                # cast compound literal
+                (?:
+                    (?:
+                        [^'"{{}};]*
+                        {_ind(STRING_LITERAL, 5)}
+                     )*
+                    [^'"{{}};]*?
+                    [^'"{{}};=]
+                    =
+                    \s* [(] [^)]* [)]
+                    \s* {{ [^;]* }}
+                 )
+             )  # <stmt>
+
+
+
+        # compound statement
+        (?:
+            (
+                (?:
+
+                    # "for" statements are handled separately above.
+                    (?: (?: else \s+ )? if | switch | while ) \s*
+                    {_ind(COMPOUND_HEAD, 5)}
+                 )
+                |
+                (?: else | do )
+                # We do not worry about compound statements for labels,
+                # "case", or "default".
+             )?  # <header>
+            \s*
+            ( {{ )  # <open>
+         )
+
+
+
+            (
+                (?:
+                    [^'"{{}};]*
+                    {_ind(STRING_LITERAL, 5)}
+                 )*
+                [^'"{{}};]*
+                # Presumably we will not see "== {{".
+                [^\s='"{{}};]
+             )?  # <header>
+
+
+
+            (
+                \b
+                (?:
+                    # We don't worry about labels with a compound statement.
+                    (?:
+                        switch \s* [(] [^{{]* [)]
+                     )
+                    |
+                    (?:
+                        case \b \s* [^:]+ [:]
+                     )
+                    |
+                    (?:
+                        default \s* [:]
+                     )
+                    |
+                    (?:
+                        do
+                     )
+                    |
+                    (?:
+                        while \s* [(] [^{{]* [)]
+                     )
+                    |
+                    #(?:
+                    #    for \s* [(] [^{{]* [)]
+                    # )
+                    #|
+                    (?:
+                        if \s* [(]
+                        (?: [^{{]* [^)] \s* {{ )* [^{{]*
+                        [)]
+                     )
+                    |
+                    (?:
+                        else
+                        (?:
+                            \s*
+                            if \s* [(]
+                            (?: [^{{]* [^)] \s* {{ )* [^{{]*
+                            [)]
+                         )?
+                     )
+                 )
+             )?  # <header>
+'''
diff --git a/Tools/c-analyzer/c_parser/datafiles.py b/Tools/c-analyzer/c_parser/datafiles.py
new file mode 100644
index 0000000..f053056
--- /dev/null
+++ b/Tools/c-analyzer/c_parser/datafiles.py
@@ -0,0 +1,153 @@
+import os.path
+
+from c_common import fsutil
+import c_common.tables as _tables
+import c_parser.info as _info
+
+
+BASE_COLUMNS = [
+    'filename',
+    'funcname',
+    'name',
+    'kind',
+]
+END_COLUMNS = {
+    'parsed': 'data',
+    'decls': 'declaration',
+}
+
+
+def _get_columns(group, extra=None):
+    return BASE_COLUMNS + list(extra or ()) + [END_COLUMNS[group]]
+    #return [
+    #    *BASE_COLUMNS,
+    #    *extra or (),
+    #    END_COLUMNS[group],
+    #]
+
+
+#############################
+# high-level
+
+def read_parsed(infile):
+    # XXX Support other formats than TSV?
+    columns = _get_columns('parsed')
+    for row in _tables.read_table(infile, columns, sep='\t', fix='-'):
+        yield _info.ParsedItem.from_row(row, columns)
+
+
+def write_parsed(items, outfile):
+    # XXX Support other formats than TSV?
+    columns = _get_columns('parsed')
+    rows = (item.as_row(columns) for item in items)
+    _tables.write_table(outfile, columns, rows, sep='\t', fix='-')
+
+
+def read_decls(infile, fmt=None):
+    if fmt is None:
+        fmt = _get_format(infile)
+    read_all, _ = _get_format_handlers('decls', fmt)
+    for decl, _ in read_all(infile):
+        yield decl
+
+
+def write_decls(decls, outfile, fmt=None, *, backup=False):
+    if fmt is None:
+        fmt = _get_format(infile)
+    _, write_all = _get_format_handlers('decls', fmt)
+    write_all(decls, outfile, backup=backup)
+
+
+#############################
+# formats
+
+def _get_format(file, default='tsv'):
+    if isinstance(file, str):
+        filename = file
+    else:
+        filename = getattr(file, 'name', '')
+    _, ext = os.path.splitext(filename)
+    return ext[1:] if ext else default
+
+
+def _get_format_handlers(group, fmt):
+    # XXX Use a registry.
+    if group != 'decls':
+        raise NotImplementedError(group)
+    if fmt == 'tsv':
+        return (_iter_decls_tsv, _write_decls_tsv)
+    else:
+        raise NotImplementedError(fmt)
+
+
+# tsv
+
+def iter_decls_tsv(infile, extracolumns=None, relroot=fsutil.USE_CWD):
+    if relroot and relroot is not fsutil.USE_CWD:
+        relroot = os.path.abspath(relroot)
+    for info, extra in _iter_decls_tsv(infile, extracolumns):
+        decl = _info.Declaration.from_row(info)
+        decl = decl.fix_filename(relroot, formatted=False, fixroot=False)
+        yield decl, extra
+
+
+def write_decls_tsv(decls, outfile, extracolumns=None, *,
+                    relroot=fsutil.USE_CWD,
+                    **kwargs
+                    ):
+    if relroot and relroot is not fsutil.USE_CWD:
+        relroot = os.path.abspath(relroot)
+    decls = (d.fix_filename(relroot, fixroot=False) for d in decls)
+    # XXX Move the row rendering here.
+    _write_decls_tsv(decls, outfile, extracolumns, kwargs)
+
+
+def _iter_decls_tsv(infile, extracolumns=None):
+    columns = _get_columns('decls', extracolumns)
+    for row in _tables.read_table(infile, columns, sep='\t'):
+        if extracolumns:
+            declinfo = row[:4] + row[-1:]
+            extra = row[4:-1]
+        else:
+            declinfo = row
+            extra = None
+        # XXX Use something like tables.fix_row() here.
+        declinfo = [None if v == '-' else v
+                    for v in declinfo]
+        yield declinfo, extra
+
+
+def _write_decls_tsv(decls, outfile, extracolumns, kwargs):
+    columns = _get_columns('decls', extracolumns)
+    if extracolumns:
+        def render_decl(decl):
+            if type(row) is tuple:
+                decl, *extra = decl
+            else:
+                extra = ()
+            extra += ('???',) * (len(extraColumns) - len(extra))
+            *row, declaration = _render_known_row(decl)
+            row += extra + (declaration,)
+            return row
+    else:
+        render_decl = _render_known_decl
+    _tables.write_table(
+        outfile,
+        header='\t'.join(columns),
+        rows=(render_decl(d) for d in decls),
+        sep='\t',
+        **kwargs
+    )
+
+
+def _render_known_decl(decl, *,
+                       # These match BASE_COLUMNS + END_COLUMNS[group].
+                       _columns = 'filename parent name kind data'.split(),
+                       ):
+    if not isinstance(decl, _info.Declaration):
+        # e.g. Analyzed
+        decl = decl.decl
+    rowdata = decl.render_rowdata(_columns)
+    return [rowdata[c] or '-' for c in _columns]
+    # XXX
+    #return _tables.fix_row(rowdata[c] for c in columns)
diff --git a/Tools/c-analyzer/c_parser/info.py b/Tools/c-analyzer/c_parser/info.py
new file mode 100644
index 0000000..697b1f2
--- /dev/null
+++ b/Tools/c-analyzer/c_parser/info.py
@@ -0,0 +1,1604 @@
+from collections import namedtuple
+import enum
+import os.path
+import re
+
+from c_common import fsutil
+from c_common.clsutil import classonly
+import c_common.misc as _misc
+import c_common.strutil as _strutil
+import c_common.tables as _tables
+from .parser._regexes import SIMPLE_TYPE, _STORAGE
+
+
+FIXED_TYPE = _misc.Labeled('FIXED_TYPE')
+
+STORAGE = frozenset(_STORAGE)
+
+
+#############################
+# kinds
+
+@enum.unique
+class KIND(enum.Enum):
+
+    # XXX Use these in the raw parser code.
+    TYPEDEF = 'typedef'
+    STRUCT = 'struct'
+    UNION = 'union'
+    ENUM = 'enum'
+    FUNCTION = 'function'
+    VARIABLE = 'variable'
+    STATEMENT = 'statement'
+
+    @classonly
+    def _from_raw(cls, raw):
+        if raw is None:
+            return None
+        elif isinstance(raw, cls):
+            return raw
+        elif type(raw) is str:
+            # We could use cls[raw] for the upper-case form,
+            # but there's no need to go to the trouble.
+            return cls(raw.lower())
+        else:
+            raise NotImplementedError(raw)
+
+    @classonly
+    def by_priority(cls, group=None):
+        if group is None:
+            return cls._ALL_BY_PRIORITY.copy()
+        elif group == 'type':
+            return cls._TYPE_DECLS_BY_PRIORITY.copy()
+        elif group == 'decl':
+            return cls._ALL_DECLS_BY_PRIORITY.copy()
+        elif isinstance(group, str):
+            raise NotImplementedError(group)
+        else:
+            # XXX Treat group as a set of kinds & return in priority order?
+            raise NotImplementedError(group)
+
+    @classonly
+    def is_type_decl(cls, kind):
+        if kind in cls.TYPES:
+            return True
+        if not isinstance(kind, cls):
+            raise TypeError(f'expected KIND, got {kind!r}')
+        return False
+
+    @classonly
+    def is_decl(cls, kind):
+        if kind in cls.DECLS:
+            return True
+        if not isinstance(kind, cls):
+            raise TypeError(f'expected KIND, got {kind!r}')
+        return False
+
+    @classonly
+    def get_group(cls, kind, *, groups=None):
+        if not isinstance(kind, cls):
+            raise TypeError(f'expected KIND, got {kind!r}')
+        if groups is None:
+            groups = ['type']
+        elif not groups:
+            groups = ()
+        elif isinstance(groups, str):
+            group = groups
+            if group not in cls._GROUPS:
+                raise ValueError(f'unsupported group {group!r}')
+            groups = [group]
+        else:
+            unsupported = [g for g in groups if g not in cls._GROUPS]
+            if unsupported:
+                raise ValueError(f'unsupported groups {", ".join(repr(unsupported))}')
+        for group in groups:
+            if kind in cls._GROUPS[group]:
+                return group
+        else:
+            return kind.value
+
+    @classonly
+    def resolve_group(cls, group):
+        if isinstance(group, cls):
+            return {group}
+        elif isinstance(group, str):
+            try:
+                return cls._GROUPS[group].copy()
+            except KeyError:
+                raise ValueError(f'unsupported group {group!r}')
+        else:
+            resolved = set()
+            for gr in group:
+                resolve.update(cls.resolve_group(gr))
+            return resolved
+            #return {*cls.resolve_group(g) for g in group}
+
+
+KIND._TYPE_DECLS_BY_PRIORITY = [
+    # These are in preferred order.
+    KIND.TYPEDEF,
+    KIND.STRUCT,
+    KIND.UNION,
+    KIND.ENUM,
+]
+KIND._ALL_DECLS_BY_PRIORITY = [
+    # These are in preferred order.
+    *KIND._TYPE_DECLS_BY_PRIORITY,
+    KIND.FUNCTION,
+    KIND.VARIABLE,
+]
+KIND._ALL_BY_PRIORITY = [
+    # These are in preferred order.
+    *KIND._ALL_DECLS_BY_PRIORITY,
+    KIND.STATEMENT,
+]
+
+KIND.TYPES = frozenset(KIND._TYPE_DECLS_BY_PRIORITY)
+KIND.DECLS = frozenset(KIND._ALL_DECLS_BY_PRIORITY)
+KIND._GROUPS = {
+    'type': KIND.TYPES,
+    'decl': KIND.DECLS,
+}
+KIND._GROUPS.update((k.value, {k}) for k in KIND)
+
+
+def get_kind_group(item):
+    return KIND.get_group(item.kind)
+
+
+#############################
+# low-level
+
+def _fix_filename(filename, relroot, *,
+                  formatted=True,
+                  **kwargs):
+    if formatted:
+        fix = fsutil.format_filename
+    else:
+        fix = fsutil.fix_filename
+    return fix(filename, relroot=relroot, **kwargs)
+
+
+class FileInfo(namedtuple('FileInfo', 'filename lno')):
+    @classmethod
+    def from_raw(cls, raw):
+        if isinstance(raw, cls):
+            return raw
+        elif isinstance(raw, tuple):
+            return cls(*raw)
+        elif not raw:
+            return None
+        elif isinstance(raw, str):
+            return cls(raw, -1)
+        else:
+            raise TypeError(f'unsupported "raw": {raw:!r}')
+
+    def __str__(self):
+        return self.filename
+
+    def fix_filename(self, relroot=fsutil.USE_CWD, **kwargs):
+        filename = _fix_filename(self.filename, relroot, **kwargs)
+        if filename == self.filename:
+            return self
+        return self._replace(filename=filename)
+
+
+class SourceLine(namedtuple('Line', 'file kind data conditions')):
+    KINDS = (
+        #'directive',  # data is ...
+        'source',  # "data" is the line
+        #'comment',  # "data" is the text, including comment markers
+    )
+
+    @property
+    def filename(self):
+        return self.file.filename
+
+    @property
+    def lno(self):
+        return self.file.lno
+
+
+class DeclID(namedtuple('DeclID', 'filename funcname name')):
+    """The globally-unique identifier for a declaration."""
+
+    @classmethod
+    def from_row(cls, row, **markers):
+        row = _tables.fix_row(row, **markers)
+        return cls(*row)
+
+    # We have to provde _make() becaose we implemented __new__().
+
+    @classmethod
+    def _make(cls, iterable):
+        try:
+            return cls(*iterable)
+        except Exception:
+            super()._make(iterable)
+            raise  # re-raise
+
+    def __new__(cls, filename, funcname, name):
+        self = super().__new__(
+            cls,
+            filename=str(filename) if filename else None,
+            funcname=str(funcname) if funcname else None,
+            name=str(name) if name else None,
+        )
+        self._compare = tuple(v or '' for v in self)
+        return self
+
+    def __hash__(self):
+        return super().__hash__()
+
+    def __eq__(self, other):
+        try:
+            other = tuple(v or '' for v in other)
+        except TypeError:
+            return NotImplemented
+        return self._compare == other
+
+    def __gt__(self, other):
+        try:
+            other = tuple(v or '' for v in other)
+        except TypeError:
+            return NotImplemented
+        return self._compare > other
+
+    def fix_filename(self, relroot=fsutil.USE_CWD, **kwargs):
+        filename = _fix_filename(self.filename, relroot, **kwargs)
+        if filename == self.filename:
+            return self
+        return self._replace(filename=filename)
+
+
+class ParsedItem(namedtuple('ParsedItem', 'file kind parent name data')):
+
+    @classmethod
+    def from_raw(cls, raw):
+        if isinstance(raw, cls):
+            return raw
+        elif isinstance(raw, tuple):
+            return cls(*raw)
+        else:
+            raise TypeError(f'unsupported "raw": {raw:!r}')
+
+    @classmethod
+    def from_row(cls, row, columns=None):
+        if not columns:
+            colnames = 'filename funcname name kind data'.split()
+        else:
+            colnames = list(columns)
+            for i, column in enumerate(colnames):
+                if column == 'file':
+                    colnames[i] = 'filename'
+                elif column == 'funcname':
+                    colnames[i] = 'parent'
+        if len(row) != len(set(colnames)):
+            raise NotImplementedError(columns, row)
+        kwargs = {}
+        for column, value in zip(colnames, row):
+            if column == 'filename':
+                kwargs['file'] = FileInfo.from_raw(value)
+            elif column == 'kind':
+                kwargs['kind'] = KIND(value)
+            elif column in cls._fields:
+                kwargs[column] = value
+            else:
+                raise NotImplementedError(column)
+        return cls(**kwargs)
+
+    @property
+    def id(self):
+        try:
+            return self._id
+        except AttributeError:
+            if self.kind is KIND.STATEMENT:
+                self._id = None
+            else:
+                self._id = DeclID(str(self.file), self.funcname, self.name)
+            return self._id
+
+    @property
+    def filename(self):
+        if not self.file:
+            return None
+        return self.file.filename
+
+    @property
+    def lno(self):
+        if not self.file:
+            return -1
+        return self.file.lno
+
+    @property
+    def funcname(self):
+        if not self.parent:
+            return None
+        if type(self.parent) is str:
+            return self.parent
+        else:
+            return self.parent.name
+
+    def fix_filename(self, relroot=fsutil.USE_CWD, **kwargs):
+        fixed = self.file.fix_filename(relroot, **kwargs)
+        if fixed == self.file:
+            return self
+        return self._replace(file=fixed)
+
+    def as_row(self, columns=None):
+        if not columns:
+            columns = self._fields
+        row = []
+        for column in columns:
+            if column == 'file':
+                value = self.filename
+            elif column == 'kind':
+                value = self.kind.value
+            elif column == 'data':
+                value = self._render_data()
+            else:
+                value = getattr(self, column)
+            row.append(value)
+        return row
+
+    def _render_data(self):
+        if not self.data:
+            return None
+        elif isinstance(self.data, str):
+            return self.data
+        else:
+            # XXX
+            raise NotImplementedError
+
+
+def _get_vartype(data):
+    try:
+        vartype = dict(data['vartype'])
+    except KeyError:
+        vartype = dict(data)
+        storage = data.get('storage')
+    else:
+        storage = data.get('storage') or vartype.get('storage')
+    del vartype['storage']
+    return storage, vartype
+
+
+def get_parsed_vartype(decl):
+    kind = getattr(decl, 'kind', None)
+    if isinstance(decl, ParsedItem):
+        storage, vartype = _get_vartype(decl.data)
+        typequal = vartype['typequal']
+        typespec = vartype['typespec']
+        abstract = vartype['abstract']
+    elif isinstance(decl, dict):
+        kind = decl.get('kind')
+        storage, vartype = _get_vartype(decl)
+        typequal = vartype['typequal']
+        typespec = vartype['typespec']
+        abstract = vartype['abstract']
+    elif isinstance(decl, VarType):
+        storage = None
+        typequal, typespec, abstract = decl
+    elif isinstance(decl, TypeDef):
+        storage = None
+        typequal, typespec, abstract = decl.vartype
+    elif isinstance(decl, Variable):
+        storage = decl.storage
+        typequal, typespec, abstract = decl.vartype
+    elif isinstance(decl, Function):
+        storage = decl.storage
+        typequal, typespec, abstract = decl.signature.returntype
+    elif isinstance(decl, str):
+        vartype, storage = VarType.from_str(decl)
+        typequal, typespec, abstract = vartype
+    else:
+        raise NotImplementedError(decl)
+    return kind, storage, typequal, typespec, abstract
+
+
+def get_default_storage(decl):
+    if decl.kind not in (KIND.VARIABLE, KIND.FUNCTION):
+        return None
+    return 'extern' if decl.parent is None else 'auto'
+
+
+def get_effective_storage(decl, *, default=None):
+    # Note that "static" limits access to just that C module
+    # and "extern" (the default for module-level) allows access
+    # outside the C module.
+    if default is None:
+        default = get_default_storage(decl)
+        if default is None:
+            return None
+    try:
+        storage = decl.storage
+    except AttributeError:
+        storage, _ = _get_vartype(decl.data)
+    return storage or default
+
+
+#############################
+# high-level
+
+class HighlevelParsedItem:
+
+    kind = None
+
+    FIELDS = ('file', 'parent', 'name', 'data')
+
+    @classmethod
+    def from_parsed(cls, parsed):
+        if parsed.kind is not cls.kind:
+            raise TypeError(f'kind mismatch ({parsed.kind.value} != {cls.kind.value})')
+        data, extra = cls._resolve_data(parsed.data)
+        self = cls(
+            cls._resolve_file(parsed),
+            parsed.name,
+            data,
+            cls._resolve_parent(parsed) if parsed.parent else None,
+            **extra or {}
+        )
+        self._parsed = parsed
+        return self
+
+    @classmethod
+    def _resolve_file(cls, parsed):
+        fileinfo = FileInfo.from_raw(parsed.file)
+        if not fileinfo:
+            raise NotImplementedError(parsed)
+        return fileinfo
+
+    @classmethod
+    def _resolve_data(cls, data):
+        return data, None
+
+    @classmethod
+    def _raw_data(cls, data, extra):
+        if isinstance(data, str):
+            return data
+        else:
+            raise NotImplementedError(data)
+
+    @classmethod
+    def _data_as_row(cls, data, extra, colnames):
+        row = {}
+        for colname in colnames:
+            if colname in row:
+                continue
+            rendered = cls._render_data_row_item(colname, data, extra)
+            if rendered is iter(rendered):
+                rendered, = rendered
+            row[colname] = rendered
+        return row
+
+    @classmethod
+    def _render_data_row_item(cls, colname, data, extra):
+        if colname == 'data':
+            return str(data)
+        else:
+            return None
+
+    @classmethod
+    def _render_data_row(cls, fmt, data, extra, colnames):
+        if fmt != 'row':
+            raise NotImplementedError
+        datarow = cls._data_as_row(data, extra, colnames)
+        unresolved = [c for c, v in datarow.items() if v is None]
+        if unresolved:
+            raise NotImplementedError(unresolved)
+        for colname, value in datarow.items():
+            if type(value) != str:
+                if colname == 'kind':
+                    datarow[colname] = value.value
+                else:
+                    datarow[colname] = str(value)
+        return datarow
+
+    @classmethod
+    def _render_data(cls, fmt, data, extra):
+        row = cls._render_data_row(fmt, data, extra, ['data'])
+        yield ' '.join(row.values())
+
+    @classmethod
+    def _resolve_parent(cls, parsed, *, _kind=None):
+        fileinfo = FileInfo(parsed.file.filename, -1)
+        if isinstance(parsed.parent, str):
+            if parsed.parent.isidentifier():
+                name = parsed.parent
+            else:
+                # XXX It could be something like "<kind> <name>".
+                raise NotImplementedError(repr(parsed.parent))
+            parent = ParsedItem(fileinfo, _kind, None, name, None)
+        elif type(parsed.parent) is tuple:
+            # XXX It could be something like (kind, name).
+            raise NotImplementedError(repr(parsed.parent))
+        else:
+            return parsed.parent
+        Parent = KIND_CLASSES.get(_kind, Declaration)
+        return Parent.from_parsed(parent)
+
+    @classmethod
+    def _parse_columns(cls, columns):
+        colnames = {}  # {requested -> actual}
+        columns = list(columns or cls.FIELDS)
+        datacolumns = []
+        for i, colname in enumerate(columns):
+            if colname == 'file':
+                columns[i] = 'filename'
+                colnames['file'] = 'filename'
+            elif colname == 'lno':
+                columns[i] = 'line'
+                colnames['lno'] = 'line'
+            elif colname in ('filename', 'line'):
+                colnames[colname] = colname
+            elif colname == 'data':
+                datacolumns.append(colname)
+                colnames[colname] = None
+            elif colname in cls.FIELDS or colname == 'kind':
+                colnames[colname] = colname
+            else:
+                datacolumns.append(colname)
+                colnames[colname] = None
+        return columns, datacolumns, colnames
+
+    def __init__(self, file, name, data, parent=None, *,
+                 _extra=None,
+                 _shortkey=None,
+                 _key=None,
+                 ):
+        self.file = file
+        self.parent = parent or None
+        self.name = name
+        self.data = data
+        self._extra = _extra or {}
+        self._shortkey = _shortkey
+        self._key = _key
+
+    def __repr__(self):
+        args = [f'{n}={getattr(self, n)!r}'
+                for n in ['file', 'name', 'data', 'parent', *(self._extra or ())]]
+        return f'{type(self).__name__}({", ".join(args)})'
+
+    def __str__(self):
+        try:
+            return self._str
+        except AttributeError:
+            self._str = next(self.render())
+            return self._str
+
+    def __getattr__(self, name):
+        try:
+            return self._extra[name]
+        except KeyError:
+            raise AttributeError(name)
+
+    def __hash__(self):
+        return hash(self._key)
+
+    def __eq__(self, other):
+        if isinstance(other, HighlevelParsedItem):
+            return self._key == other._key
+        elif type(other) is tuple:
+            return self._key == other
+        else:
+            return NotImplemented
+
+    def __gt__(self, other):
+        if isinstance(other, HighlevelParsedItem):
+            return self._key > other._key
+        elif type(other) is tuple:
+            return self._key > other
+        else:
+            return NotImplemented
+
+    @property
+    def id(self):
+        return self.parsed.id
+
+    @property
+    def shortkey(self):
+        return self._shortkey
+
+    @property
+    def key(self):
+        return self._key
+
+    @property
+    def filename(self):
+        if not self.file:
+            return None
+        return self.file.filename
+
+    @property
+    def parsed(self):
+        try:
+            return self._parsed
+        except AttributeError:
+            parent = self.parent
+            if parent is not None and not isinstance(parent, str):
+                parent = parent.name
+            self._parsed = ParsedItem(
+                self.file,
+                self.kind,
+                parent,
+                self.name,
+                self._raw_data(),
+            )
+            return self._parsed
+
+    def fix_filename(self, relroot=fsutil.USE_CWD, **kwargs):
+        if self.file:
+            self.file = self.file.fix_filename(relroot, **kwargs)
+        return self
+
+    def as_rowdata(self, columns=None):
+        columns, datacolumns, colnames = self._parse_columns(columns)
+        return self._as_row(colnames, datacolumns, self._data_as_row)
+
+    def render_rowdata(self, columns=None):
+        columns, datacolumns, colnames = self._parse_columns(columns)
+        def data_as_row(data, ext, cols):
+            return self._render_data_row('row', data, ext, cols)
+        rowdata = self._as_row(colnames, datacolumns, data_as_row)
+        for column, value in rowdata.items():
+            colname = colnames.get(column)
+            if not colname:
+                continue
+            if column == 'kind':
+                value = value.value
+            else:
+                if column == 'parent':
+                    if self.parent:
+                        value = f'({self.parent.kind.value} {self.parent.name})'
+                if not value:
+                    value = '-'
+                elif type(value) is VarType:
+                    value = repr(str(value))
+                else:
+                    value = str(value)
+            rowdata[column] = value
+        return rowdata
+
+    def _as_row(self, colnames, datacolumns, data_as_row):
+        try:
+            data = data_as_row(self.data, self._extra, datacolumns)
+        except NotImplementedError:
+            data = None
+        row = data or {}
+        for column, colname in colnames.items():
+            if colname == 'filename':
+                value = self.file.filename if self.file else None
+            elif colname == 'line':
+                value = self.file.lno if self.file else None
+            elif colname is None:
+                value = getattr(self, column, None)
+            else:
+                value = getattr(self, colname, None)
+            row.setdefault(column, value)
+        return row
+
+    def render(self, fmt='line'):
+        fmt = fmt or 'line'
+        try:
+            render = _FORMATS[fmt]
+        except KeyError:
+            raise TypeError(f'unsupported fmt {fmt!r}')
+        try:
+            data = self._render_data(fmt, self.data, self._extra)
+        except NotImplementedError:
+            data = '-'
+        yield from render(self, data)
+
+
+### formats ###
+
+def _fmt_line(parsed, data=None):
+    parts = [
+        f'<{parsed.kind.value}>',
+    ]
+    parent = ''
+    if parsed.parent:
+        parent = parsed.parent
+        if not isinstance(parent, str):
+            if parent.kind is KIND.FUNCTION:
+                parent = f'{parent.name}()'
+            else:
+                parent = parent.name
+        name = f'<{parent}>.{parsed.name}'
+    else:
+        name = parsed.name
+    if data is None:
+        data = parsed.data
+    elif data is iter(data):
+        data, = data
+    parts.extend([
+        name,
+        f'<{data}>' if data else '-',
+        f'({str(parsed.file or "<unknown file>")})',
+    ])
+    yield '\t'.join(parts)
+
+
+def _fmt_full(parsed, data=None):
+    if parsed.kind is KIND.VARIABLE and parsed.parent:
+        prefix = 'local '
+        suffix = f' ({parsed.parent.name})'
+    else:
+        # XXX Show other prefixes (e.g. global, public)
+        prefix = suffix = ''
+    yield f'{prefix}{parsed.kind.value} {parsed.name!r}{suffix}'
+    for column, info in parsed.render_rowdata().items():
+        if column == 'kind':
+            continue
+        if column == 'name':
+            continue
+        if column == 'parent' and parsed.kind is not KIND.VARIABLE:
+            continue
+        if column == 'data':
+            if parsed.kind in (KIND.STRUCT, KIND.UNION):
+                column = 'members'
+            elif parsed.kind is KIND.ENUM:
+                column = 'enumerators'
+            elif parsed.kind is KIND.STATEMENT:
+                column = 'text'
+                data, = data
+            else:
+                column = 'signature'
+                data, = data
+            if not data:
+#                yield f'\t{column}:\t-'
+                continue
+            elif isinstance(data, str):
+                yield f'\t{column}:\t{data!r}'
+            else:
+                yield f'\t{column}:'
+                for line in data:
+                    yield f'\t\t- {line}'
+        else:
+            yield f'\t{column}:\t{info}'
+
+
+_FORMATS = {
+    'raw': (lambda v, _d: [repr(v)]),
+    'brief': _fmt_line,
+    'line': _fmt_line,
+    'full': _fmt_full,
+}
+
+
+### declarations ##
+
+class Declaration(HighlevelParsedItem):
+
+    @classmethod
+    def from_row(cls, row, **markers):
+        fixed = tuple(_tables.fix_row(row, **markers))
+        if cls is Declaration:
+            _, _, _, kind, _ = fixed
+            sub = KIND_CLASSES.get(KIND(kind))
+            if not sub or not issubclass(sub, Declaration):
+                raise TypeError(f'unsupported kind, got {row!r}')
+        else:
+            sub = cls
+        return sub._from_row(fixed)
+
+    @classmethod
+    def _from_row(cls, row):
+        filename, funcname, name, kind, data = row
+        kind = KIND._from_raw(kind)
+        if kind is not cls.kind:
+            raise TypeError(f'expected kind {cls.kind.value!r}, got {row!r}')
+        fileinfo = FileInfo.from_raw(filename)
+        if isinstance(data, str):
+            data, extra = cls._parse_data(data, fmt='row')
+        if extra:
+            return cls(fileinfo, name, data, funcname, _extra=extra)
+        else:
+            return cls(fileinfo, name, data, funcname)
+
+    @classmethod
+    def _resolve_parent(cls, parsed, *, _kind=None):
+        if _kind is None:
+            raise TypeError(f'{cls.kind.value} declarations do not have parents ({parsed})')
+        return super()._resolve_parent(parsed, _kind=_kind)
+
+    @classmethod
+    def _render_data(cls, fmt, data, extra):
+        if not data:
+            # XXX There should be some!  Forward?
+            yield '???'
+        else:
+            yield from cls._format_data(fmt, data, extra)
+
+    @classmethod
+    def _render_data_row_item(cls, colname, data, extra):
+        if colname == 'data':
+            return cls._format_data('row', data, extra)
+        else:
+            return None
+
+    @classmethod
+    def _format_data(cls, fmt, data, extra):
+        raise NotImplementedError(fmt)
+
+    @classmethod
+    def _parse_data(cls, datastr, fmt=None):
+        """This is the reverse of _render_data."""
+        if not datastr or datastr is _tables.UNKNOWN or datastr == '???':
+            return None, None
+        elif datastr is _tables.EMPTY or datastr == '-':
+            # All the kinds have *something* even it is unknown.
+            raise TypeError('all declarations have data of some sort, got none')
+        else:
+            return cls._unformat_data(datastr, fmt)
+
+    @classmethod
+    def _unformat_data(cls, datastr, fmt=None):
+        raise NotImplementedError(fmt)
+
+
+class VarType(namedtuple('VarType', 'typequal typespec abstract')):
+
+    @classmethod
+    def from_str(cls, text):
+        orig = text
+        storage, sep, text = text.strip().partition(' ')
+        if not sep:
+            text = storage
+            storage = None
+        elif storage not in ('auto', 'register', 'static', 'extern'):
+            text = orig
+            storage = None
+        return cls._from_str(text), storage
+
+    @classmethod
+    def _from_str(cls, text):
+        orig = text
+        if text.startswith(('const ', 'volatile ')):
+            typequal, _, text = text.partition(' ')
+        else:
+            typequal = None
+
+        # Extract a series of identifiers/keywords.
+        m = re.match(r"^ *'?([a-zA-Z_]\w*(?:\s+[a-zA-Z_]\w*)*)\s*(.*?)'?\s*$", text)
+        if not m:
+            raise ValueError(f'invalid vartype text {orig!r}')
+        typespec, abstract = m.groups()
+
+        return cls(typequal, typespec, abstract or None)
+
+    def __str__(self):
+        parts = []
+        if self.qualifier:
+            parts.append(self.qualifier)
+        parts.append(self.spec + (self.abstract or ''))
+        return ' '.join(parts)
+
+    @property
+    def qualifier(self):
+        return self.typequal
+
+    @property
+    def spec(self):
+        return self.typespec
+
+
+class Variable(Declaration):
+    kind = KIND.VARIABLE
+
+    @classmethod
+    def _resolve_parent(cls, parsed):
+        return super()._resolve_parent(parsed, _kind=KIND.FUNCTION)
+
+    @classmethod
+    def _resolve_data(cls, data):
+        if not data:
+            return None, None
+        storage, vartype = _get_vartype(data)
+        return VarType(**vartype), {'storage': storage}
+
+    @classmethod
+    def _raw_data(self, data, extra):
+        vartype = data._asdict()
+        return {
+            'storage': extra['storage'],
+            'vartype': vartype,
+        }
+
+    @classmethod
+    def _format_data(cls, fmt, data, extra):
+        storage = extra.get('storage')
+        text = f'{storage} {data}' if storage else str(data)
+        if fmt in ('line', 'brief'):
+            yield text
+        #elif fmt == 'full':
+        elif fmt == 'row':
+            yield text
+        else:
+            raise NotImplementedError(fmt)
+
+    @classmethod
+    def _unformat_data(cls, datastr, fmt=None):
+        if fmt in ('line', 'brief'):
+            vartype, storage = VarType.from_str(datastr)
+            return vartype, {'storage': storage}
+        #elif fmt == 'full':
+        elif fmt == 'row':
+            vartype, storage = VarType.from_str(datastr)
+            return vartype, {'storage': storage}
+        else:
+            raise NotImplementedError(fmt)
+
+    def __init__(self, file, name, data, parent=None, storage=None):
+        super().__init__(file, name, data, parent,
+                         _extra={'storage': storage or None},
+                         _shortkey=f'({parent.name}).{name}' if parent else name,
+                         _key=(str(file),
+                               # Tilde comes after all other ascii characters.
+                               f'~{parent or ""}~',
+                               name,
+                               ),
+                         )
+        if storage:
+            if storage not in STORAGE:
+                # The parser must need an update.
+                raise NotImplementedError(storage)
+            # Otherwise we trust the compiler to have validated it.
+
+    @property
+    def vartype(self):
+        return self.data
+
+
+class Signature(namedtuple('Signature', 'params returntype inline isforward')):
+
+    @classmethod
+    def from_str(cls, text):
+        orig = text
+        storage, sep, text = text.strip().partition(' ')
+        if not sep:
+            text = storage
+            storage = None
+        elif storage not in ('auto', 'register', 'static', 'extern'):
+            text = orig
+            storage = None
+        return cls._from_str(text), storage
+
+    @classmethod
+    def _from_str(cls, text):
+        orig = text
+        inline, sep, text = text.partition('|')
+        if not sep:
+            text = inline
+            inline = None
+
+        isforward = False
+        if text.endswith(';'):
+            text = text[:-1]
+            isforward = True
+        elif text.endswith('{}'):
+            text = text[:-2]
+
+        index = text.rindex('(')
+        if index < 0:
+            raise ValueError(f'bad signature text {orig!r}')
+        params = text[index:]
+        while params.count('(') <= params.count(')'):
+            index = text.rindex('(', 0, index)
+            if index < 0:
+                raise ValueError(f'bad signature text {orig!r}')
+            params = text[index:]
+        text = text[:index]
+
+        returntype = VarType._from_str(text.rstrip())
+
+        return cls(params, returntype, inline, isforward)
+
+    def __str__(self):
+        parts = []
+        if self.inline:
+            parts.extend([
+                self.inline,
+                '|',
+            ])
+        parts.extend([
+            str(self.returntype),
+            self.params,
+            ';' if self.isforward else '{}',
+        ])
+        return ' '.join(parts)
+
+    @property
+    def returns(self):
+        return self.returntype
+
+
+class Function(Declaration):
+    kind = KIND.FUNCTION
+
+    @classmethod
+    def _resolve_data(cls, data):
+        if not data:
+            return None, None
+        kwargs = dict(data)
+        returntype = dict(data['returntype'])
+        del returntype['storage']
+        kwargs['returntype'] = VarType(**returntype)
+        storage = kwargs.pop('storage')
+        return Signature(**kwargs), {'storage': storage}
+
+    @classmethod
+    def _raw_data(self, data):
+        # XXX finish!
+        return data
+
+    @classmethod
+    def _format_data(cls, fmt, data, extra):
+        storage = extra.get('storage')
+        text = f'{storage} {data}' if storage else str(data)
+        if fmt in ('line', 'brief'):
+            yield text
+        #elif fmt == 'full':
+        elif fmt == 'row':
+            yield text
+        else:
+            raise NotImplementedError(fmt)
+
+    @classmethod
+    def _unformat_data(cls, datastr, fmt=None):
+        if fmt in ('line', 'brief'):
+            sig, storage = Signature.from_str(sig)
+            return sig, {'storage': storage}
+        #elif fmt == 'full':
+        elif fmt == 'row':
+            sig, storage = Signature.from_str(sig)
+            return sig, {'storage': storage}
+        else:
+            raise NotImplementedError(fmt)
+
+    def __init__(self, file, name, data, parent=None, storage=None):
+        super().__init__(file, name, data, parent, _extra={'storage': storage})
+        self._shortkey = f'~{name}~ {self.data}'
+        self._key = (
+            str(file),
+            self._shortkey,
+        )
+
+    @property
+    def signature(self):
+        return self.data
+
+
+class TypeDeclaration(Declaration):
+
+    def __init__(self, file, name, data, parent=None, *, _shortkey=None):
+        if not _shortkey:
+            _shortkey = f'{self.kind.value} {name}'
+        super().__init__(file, name, data, parent,
+                         _shortkey=_shortkey,
+                         _key=(
+                             str(file),
+                             _shortkey,
+                             ),
+                         )
+
+
+class POTSType(TypeDeclaration):
+
+    def __init__(self, name):
+        _file = _data = _parent = None
+        super().__init__(_file, name, _data, _parent, _shortkey=name)
+
+
+class FuncPtr(TypeDeclaration):
+
+    def __init__(self, vartype):
+        _file = _name = _parent = None
+        data = vartype
+        self.vartype = vartype
+        super().__init__(_file, _name, data, _parent, _shortkey=f'<{vartype}>')
+
+
+class TypeDef(TypeDeclaration):
+    kind = KIND.TYPEDEF
+
+    @classmethod
+    def _resolve_data(cls, data):
+        if not data:
+            raise NotImplementedError(data)
+        vartype = dict(data)
+        del vartype['storage']
+        return VarType(**vartype), None
+
+    @classmethod
+    def _raw_data(self, data):
+        # XXX finish!
+        return data
+
+    @classmethod
+    def _format_data(cls, fmt, data, extra):
+        text = str(data)
+        if fmt in ('line', 'brief'):
+            yield text
+        elif fmt == 'full':
+            yield text
+        elif fmt == 'row':
+            yield text
+        else:
+            raise NotImplementedError(fmt)
+
+    @classmethod
+    def _unformat_data(cls, datastr, fmt=None):
+        if fmt in ('line', 'brief'):
+            vartype, _ = VarType.from_str(datastr)
+            return vartype, None
+        #elif fmt == 'full':
+        elif fmt == 'row':
+            vartype, _ = VarType.from_str(datastr)
+            return vartype, None
+        else:
+            raise NotImplementedError(fmt)
+
+    def __init__(self, file, name, data, parent=None):
+        super().__init__(file, name, data, parent, _shortkey=name)
+
+    @property
+    def vartype(self):
+        return self.data
+
+
+class Member(namedtuple('Member', 'name vartype size')):
+
+    @classmethod
+    def from_data(cls, raw, index):
+        name = raw.name if raw.name else index
+        vartype = size = None
+        if type(raw.data) is int:
+            size = raw.data
+        elif isinstance(raw.data, str):
+            size = int(raw.data)
+        elif raw.data:
+            vartype = dict(raw.data)
+            del vartype['storage']
+            if 'size' in vartype:
+                size = int(vartype.pop('size'))
+            vartype = VarType(**vartype)
+        return cls(name, vartype, size)
+
+    @classmethod
+    def from_str(cls, text):
+        name, _, vartype = text.partition(': ')
+        if name.startswith('#'):
+            name = int(name[1:])
+        if vartype.isdigit():
+            size = int(vartype)
+            vartype = None
+        else:
+            vartype, _ = VarType.from_str(vartype)
+            size = None
+        return cls(name, vartype, size)
+
+    def __str__(self):
+        name = self.name if isinstance(self.name, str) else f'#{self.name}'
+        return f'{name}: {self.vartype or self.size}'
+
+
+class _StructUnion(TypeDeclaration):
+
+    @classmethod
+    def _resolve_data(cls, data):
+        if not data:
+            # XXX There should be some!  Forward?
+            return None, None
+        return [Member.from_data(v, i) for i, v in enumerate(data)], None
+
+    @classmethod
+    def _raw_data(self, data):
+        # XXX finish!
+        return data
+
+    @classmethod
+    def _format_data(cls, fmt, data, extra):
+        if fmt in ('line', 'brief'):
+            members = ', '.join(f'<{m}>' for m in data)
+            yield f'[{members}]'
+        elif fmt == 'full':
+            for member in data:
+                yield f'{member}'
+        elif fmt == 'row':
+            members = ', '.join(f'<{m}>' for m in data)
+            yield f'[{members}]'
+        else:
+            raise NotImplementedError(fmt)
+
+    @classmethod
+    def _unformat_data(cls, datastr, fmt=None):
+        if fmt in ('line', 'brief'):
+            members = [Member.from_str(m[1:-1])
+                       for m in datastr[1:-1].split(', ')]
+            return members, None
+        #elif fmt == 'full':
+        elif fmt == 'row':
+            members = [Member.from_str(m.rstrip('>').lstrip('<'))
+                       for m in datastr[1:-1].split('>, <')]
+            return members, None
+        else:
+            raise NotImplementedError(fmt)
+
+    def __init__(self, file, name, data, parent=None):
+        super().__init__(file, name, data, parent)
+
+    @property
+    def members(self):
+        return self.data
+
+
+class Struct(_StructUnion):
+    kind = KIND.STRUCT
+
+
+class Union(_StructUnion):
+    kind = KIND.UNION
+
+
+class Enum(TypeDeclaration):
+    kind = KIND.ENUM
+
+    @classmethod
+    def _resolve_data(cls, data):
+        if not data:
+            # XXX There should be some!  Forward?
+            return None, None
+        enumerators = [e if isinstance(e, str) else e.name
+                       for e in data]
+        return enumerators, None
+
+    @classmethod
+    def _raw_data(self, data):
+        # XXX finish!
+        return data
+
+    @classmethod
+    def _format_data(cls, fmt, data, extra):
+        if fmt in ('line', 'brief'):
+            yield repr(data)
+        elif fmt == 'full':
+            for enumerator in data:
+                yield f'{enumerator}'
+        elif fmt == 'row':
+            # XXX This won't work with CSV...
+            yield ','.join(data)
+        else:
+            raise NotImplementedError(fmt)
+
+    @classmethod
+    def _unformat_data(cls, datastr, fmt=None):
+        if fmt in ('line', 'brief'):
+            return _strutil.unrepr(datastr), None
+        #elif fmt == 'full':
+        elif fmt == 'row':
+            return datastr.split(','), None
+        else:
+            raise NotImplementedError(fmt)
+
+    def __init__(self, file, name, data, parent=None):
+        super().__init__(file, name, data, parent)
+
+    @property
+    def enumerators(self):
+        return self.data
+
+
+### statements ###
+
+class Statement(HighlevelParsedItem):
+    kind = KIND.STATEMENT
+
+    @classmethod
+    def _resolve_data(cls, data):
+        # XXX finish!
+        return data, None
+
+    @classmethod
+    def _raw_data(self, data):
+        # XXX finish!
+        return data
+
+    @classmethod
+    def _render_data(cls, fmt, data, extra):
+        # XXX Handle other formats?
+        return repr(data)
+
+    @classmethod
+    def _parse_data(self, datastr, fmt=None):
+        # XXX Handle other formats?
+        return _strutil.unrepr(datastr), None
+
+    def __init__(self, file, name, data, parent=None):
+        super().__init__(file, name, data, parent,
+                         _shortkey=data or '',
+                         _key=(
+                             str(file),
+                             file.lno,
+                             # XXX Only one stmt per line?
+                             ),
+                         )
+
+    @property
+    def text(self):
+        return self.data
+
+
+###
+
+KIND_CLASSES = {cls.kind: cls for cls in [
+    Variable,
+    Function,
+    TypeDef,
+    Struct,
+    Union,
+    Enum,
+    Statement,
+]}
+
+
+def resolve_parsed(parsed):
+    if isinstance(parsed, HighlevelParsedItem):
+        return parsed
+    try:
+        cls = KIND_CLASSES[parsed.kind]
+    except KeyError:
+        raise ValueError(f'unsupported kind in {parsed!r}')
+    return cls.from_parsed(parsed)
+
+
+def set_flag(item, name, value):
+    try:
+        setattr(item, name, value)
+    except AttributeError:
+        object.__setattr__(item, name, value)
+
+
+#############################
+# composite
+
+class Declarations:
+
+    @classmethod
+    def from_decls(cls, decls):
+        return cls(decls)
+
+    @classmethod
+    def from_parsed(cls, items):
+        decls = (resolve_parsed(item)
+                 for item in items
+                 if item.kind is not KIND.STATEMENT)
+        return cls.from_decls(decls)
+
+    @classmethod
+    def _resolve_key(cls, raw):
+        if isinstance(raw, str):
+            raw = [raw]
+        elif isinstance(raw, Declaration):
+            raw = (
+                raw.filename if cls._is_public(raw) else None,
+                # `raw.parent` is always None for types and functions.
+                raw.parent if raw.kind is KIND.VARIABLE else None,
+                raw.name,
+            )
+
+        extra = None
+        if len(raw) == 1:
+            name, = raw
+            if name:
+                name = str(name)
+                if name.endswith(('.c', '.h')):
+                    # This is only legit as a query.
+                    key = (name, None, None)
+                else:
+                    key = (None, None, name)
+            else:
+                key = (None, None, None)
+        elif len(raw) == 2:
+            parent, name = raw
+            name = str(name)
+            if isinstance(parent, Declaration):
+                key = (None, parent.name, name)
+            elif not parent:
+                key = (None, None, name)
+            else:
+                parent = str(parent)
+                if parent.endswith(('.c', '.h')):
+                    key = (parent, None, name)
+                else:
+                    key = (None, parent, name)
+        else:
+            key, extra = raw[:3], raw[3:]
+            filename, funcname, name = key
+            filename = str(filename) if filename else None
+            if isinstance(funcname, Declaration):
+                funcname = funcname.name
+            else:
+                funcname = str(funcname) if funcname else None
+            name = str(name) if name else None
+            key = (filename, funcname, name)
+        return key, extra
+
+    @classmethod
+    def _is_public(cls, decl):
+        # For .c files don't we need info from .h files to make this decision?
+        # XXX Check for "extern".
+        # For now we treat all decls a "private" (have filename set).
+        return False
+
+    def __init__(self, decls):
+        # (file, func, name) -> decl
+        # "public":
+        #   * (None, None, name)
+        # "private", "global":
+        #   * (file, None, name)
+        # "private", "local":
+        #   * (file, func, name)
+        if hasattr(decls, 'items'):
+            self._decls = decls
+        else:
+            self._decls = {}
+            self._extend(decls)
+
+        # XXX always validate?
+
+    def validate(self):
+        for key, decl in self._decls.items():
+            if type(key) is not tuple or len(key) != 3:
+                raise ValueError(f'expected 3-tuple key, got {key!r} (for decl {decl!r})')
+            filename, funcname, name = key
+            if not name:
+                raise ValueError(f'expected name in key, got {key!r} (for decl {decl!r})')
+            elif type(name) is not str:
+                raise ValueError(f'expected name in key to be str, got {key!r} (for decl {decl!r})')
+            # XXX Check filename type?
+            # XXX Check funcname type?
+
+            if decl.kind is KIND.STATEMENT:
+                raise ValueError(f'expected a declaration, got {decl!r}')
+
+    def __repr__(self):
+        return f'{type(self).__name__}({list(self)})'
+
+    def __len__(self):
+        return len(self._decls)
+
+    def __iter__(self):
+        yield from self._decls
+
+    def __getitem__(self, key):
+        # XXX Be more exact for the 3-tuple case?
+        if type(key) not in (str, tuple):
+            raise KeyError(f'unsupported key {key!r}')
+        resolved, extra = self._resolve_key(key)
+        if extra:
+            raise KeyError(f'key must have at most 3 parts, got {key!r}')
+        if not resolved[2]:
+            raise ValueError(f'expected name in key, got {key!r}')
+        try:
+            return self._decls[resolved]
+        except KeyError:
+            if type(key) is tuple and len(key) == 3:
+                filename, funcname, name = key
+            else:
+                filename, funcname, name = resolved
+            if filename and not filename.endswith(('.c', '.h')):
+                raise KeyError(f'invalid filename in key {key!r}')
+            elif funcname and funcname.endswith(('.c', '.h')):
+                raise KeyError(f'invalid funcname in key {key!r}')
+            elif name and name.endswith(('.c', '.h')):
+                raise KeyError(f'invalid name in key {key!r}')
+            else:
+                raise  # re-raise
+
+    @property
+    def types(self):
+        return self._find(kind=KIND.TYPES)
+
+    @property
+    def functions(self):
+        return self._find(None, None, None, KIND.FUNCTION)
+
+    @property
+    def variables(self):
+        return self._find(None, None, None, KIND.VARIABLE)
+
+    def iter_all(self):
+        yield from self._decls.values()
+
+    def get(self, key, default=None):
+        try:
+           return self[key]
+        except KeyError:
+            return default
+
+    #def add_decl(self, decl, key=None):
+    #    decl = _resolve_parsed(decl)
+    #    self._add_decl(decl, key)
+
+    def find(self, *key, **explicit):
+        if not key:
+            if not explicit:
+                return iter(self)
+            return self._find(**explicit)
+
+        resolved, extra = self._resolve_key(key)
+        filename, funcname, name = resolved
+        if not extra:
+            kind = None
+        elif len(extra) == 1:
+            kind, = extra
+        else:
+            raise KeyError(f'key must have at most 4 parts, got {key!r}')
+
+        implicit= {}
+        if filename:
+            implicit['filename'] = filename
+        if funcname:
+            implicit['funcname'] = funcname
+        if name:
+            implicit['name'] = name
+        if kind:
+            implicit['kind'] = kind
+        return self._find(**implicit, **explicit)
+
+    def _find(self, filename=None, funcname=None, name=None, kind=None):
+        for decl in self._decls.values():
+            if filename and decl.filename != filename:
+                continue
+            if funcname:
+                if decl.kind is not KIND.VARIABLE:
+                    continue
+                if decl.parent.name != funcname:
+                    continue
+            if name and decl.name != name:
+                continue
+            if kind:
+                kinds = KIND.resolve_group(kind)
+                if decl.kind not in kinds:
+                    continue
+            yield decl
+
+    def _add_decl(self, decl, key=None):
+        if key:
+            if type(key) not in (str, tuple):
+                raise NotImplementedError((key, decl))
+            # Any partial key will be turned into a full key, but that
+            # same partial key will still match a key lookup.
+            resolved, _ = self._resolve_key(key)
+            if not resolved[2]:
+                raise ValueError(f'expected name in key, got {key!r}')
+            key = resolved
+            # XXX Also add with the decl-derived key if not the same?
+        else:
+            key, _ = self._resolve_key(decl)
+        self._decls[key] = decl
+
+    def _extend(self, decls):
+        decls = iter(decls)
+        # Check only the first item.
+        for decl in decls:
+            if isinstance(decl, Declaration):
+                self._add_decl(decl)
+                # Add the rest without checking.
+                for decl in decls:
+                    self._add_decl(decl)
+            elif isinstance(decl, HighlevelParsedItem):
+                raise NotImplementedError(decl)
+            else:
+                try:
+                    key, decl = decl
+                except ValueError:
+                    raise NotImplementedError(decl)
+                if not isinstance(decl, Declaration):
+                    raise NotImplementedError(decl)
+                self._add_decl(decl, key)
+                # Add the rest without checking.
+                for key, decl in decls:
+                    self._add_decl(decl, key)
+            # The iterator will be exhausted at this point.
diff --git a/Tools/c-analyzer/c_parser/match.py b/Tools/c-analyzer/c_parser/match.py
new file mode 100644
index 0000000..3b5068f
--- /dev/null
+++ b/Tools/c-analyzer/c_parser/match.py
@@ -0,0 +1,177 @@
+import re
+
+from . import info as _info
+from .parser._regexes import SIMPLE_TYPE
+
+
+_KIND = _info.KIND
+
+
+def match_storage(decl, expected):
+    default = _info.get_default_storage(decl)
+    #assert default
+    if expected is None:
+        expected = {default}
+    elif isinstance(expected, str):
+        expected = {expected or default}
+    elif not expected:
+        expected = _info.STORAGE
+    else:
+        expected = {v or default for v in expected}
+    storage = _info.get_effective_storage(decl, default=default)
+    return storage in expected
+
+
+##################################
+# decl matchers
+
+def is_type_decl(item):
+    return _KIND.is_type_decl(item.kind)
+
+
+def is_decl(item):
+    return _KIND.is_decl(item.kind)
+
+
+def is_pots(typespec, *,
+            _regex=re.compile(rf'^{SIMPLE_TYPE}$', re.VERBOSE),
+            ):
+
+    if not typespec:
+        return None
+    if type(typespec) is not str:
+        _, _, _, typespec, _ = _info.get_parsed_vartype(typespec)
+    return _regex.match(typespec) is not None
+
+
+def is_funcptr(vartype):
+    if not vartype:
+        return None
+    _, _, _, _, abstract = _info.get_parsed_vartype(vartype)
+    return _is_funcptr(abstract)
+
+
+def _is_funcptr(declstr):
+    if not declstr:
+        return None
+    # XXX Support "(<name>*)(".
+    return '(*)(' in declstr.replace(' ', '')
+
+
+def is_forward_decl(decl):
+    if decl.kind is _KIND.TYPEDEF:
+        return False
+    elif is_type_decl(decl):
+        return not decl.data
+    elif decl.kind is _KIND.FUNCTION:
+        # XXX This doesn't work with ParsedItem.
+        return decl.signature.isforward
+    elif decl.kind is _KIND.VARIABLE:
+        # No var decls are considered forward (or all are...).
+        return False
+    else:
+        raise NotImplementedError(decl)
+
+
+def can_have_symbol(decl):
+    return decl.kind in (_KIND.VARIABLE, _KIND.FUNCTION)
+
+
+def has_external_symbol(decl):
+    if not can_have_symbol(decl):
+        return False
+    if _info.get_effective_storage(decl) != 'extern':
+        return False
+    if decl.kind is _KIND.FUNCTION:
+        return not decl.signature.isforward
+    else:
+        # It must be a variable, which can only be implicitly extern here.
+        return decl.storage != 'extern'
+
+
+def has_internal_symbol(decl):
+    if not can_have_symbol(decl):
+        return False
+    return _info.get_actual_storage(decl) == 'static'
+
+
+def is_external_reference(decl):
+    if not can_have_symbol(decl):
+        return False
+    # We have to check the declared storage rather tnan the effective.
+    if decl.storage != 'extern':
+        return False
+    if decl.kind is _KIND.FUNCTION:
+        return decl.signature.isforward
+    # Otherwise it's a variable.
+    return True
+
+
+def is_local_var(decl):
+    if not decl.kind is _KIND.VARIABLE:
+        return False
+    return True if decl.parent else False
+
+
+def is_global_var(decl):
+    if not decl.kind is _KIND.VARIABLE:
+        return False
+    return False if decl.parent else True
+
+
+##################################
+# filtering with matchers
+
+def filter_by_kind(items, kind):
+    if kind == 'type':
+        kinds = _KIND._TYPE_DECLS
+    elif kind == 'decl':
+        kinds = _KIND._TYPE_DECLS
+    try:
+        okay = kind in _KIND
+    except TypeError:
+        kinds = set(kind)
+    else:
+        kinds = {kind} if okay else set(kind)
+    for item in items:
+        if item.kind in kinds:
+            yield item
+
+
+##################################
+# grouping with matchers
+
+def group_by_category(decls, categories, *, ignore_non_match=True):
+    collated = {}
+    for decl in decls:
+        # Matchers should be mutually exclusive.  (First match wins.)
+        for category, match in categories.items():
+            if match(decl):
+                if category not in collated:
+                    collated[category] = [decl]
+                else:
+                    collated[category].append(decl)
+                break
+        else:
+            if not ignore_non_match:
+                raise Exception(f'no match for {decl!r}')
+    return collated
+
+
+def group_by_kind(items):
+    collated = {kind: [] for kind in _KIND}
+    for item in items:
+        try:
+            collated[item.kind].append(item)
+        except KeyError:
+            raise ValueError(f'unsupported kind in {item!r}')
+    return collated
+
+
+def group_by_kinds(items):
+    # Collate into kind groups (decl, type, etc.).
+    collated = {_KIND.get_group(k): [] for k in _KIND}
+    for item in items:
+        group = _KIND.get_group(item.kind)
+        collated[group].append(item)
+    return collated
diff --git a/Tools/c-analyzer/c_parser/parser/__init__.py b/Tools/c-analyzer/c_parser/parser/__init__.py
new file mode 100644
index 0000000..df70aae
--- /dev/null
+++ b/Tools/c-analyzer/c_parser/parser/__init__.py
@@ -0,0 +1,212 @@
+"""A simple non-validating parser for C99.
+
+The functions and regex patterns here are not entirely suitable for
+validating C syntax.  Please rely on a proper compiler for that.
+Instead our goal here is merely matching and extracting information from
+valid C code.
+
+Furthermore, the grammar rules for the C syntax (particularly as
+described in the K&R book) actually describe a superset, of which the
+full C language is a proper subset.  Here are some of the extra
+conditions that must be applied when parsing C code:
+
+* ...
+
+(see: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf)
+
+We have taken advantage of the elements of the C grammar that are used
+only in a few limited contexts, mostly as delimiters.  They allow us to
+focus the regex patterns confidently.  Here are the relevant tokens and
+in which grammar rules they are used:
+
+separators:
+* ";"
+   + (decl) struct/union:  at end of each member decl
+   + (decl) declaration:  at end of each (non-compound) decl
+   + (stmt) expr stmt:  at end of each stmt
+   + (stmt) for:  between exprs in "header"
+   + (stmt) goto:  at end
+   + (stmt) continue:  at end
+   + (stmt) break:  at end
+   + (stmt) return:  at end
+* ","
+   + (decl) struct/union:  between member declators
+   + (decl) param-list:  between params
+   + (decl) enum: between enumerators
+   + (decl) initializer (compound):  between initializers
+   + (expr) postfix:  between func call args
+   + (expr) expression:  between "assignment" exprs
+* ":"
+   + (decl) struct/union:  in member declators
+   + (stmt) label:  between label and stmt
+   + (stmt) case:  between expression and stmt
+   + (stmt) default:  between "default" and stmt
+* "="
+   + (decl) delaration:  between decl and initializer
+   + (decl) enumerator:  between identifier and "initializer"
+   + (expr) assignment:  between "var" and expr
+
+wrappers:
+* "(...)"
+   + (decl) declarator (func ptr):  to wrap ptr/name
+   + (decl) declarator (func ptr):  around params
+   + (decl) declarator:  around sub-declarator (for readability)
+   + (expr) postfix (func call):  around args
+   + (expr) primary:  around sub-expr
+   + (stmt) if:  around condition
+   + (stmt) switch:  around source expr
+   + (stmt) while:  around condition
+   + (stmt) do-while:  around condition
+   + (stmt) for:  around "header"
+* "{...}"
+   + (decl) enum:  around enumerators
+   + (decl) func:  around body
+   + (stmt) compound:  around stmts
+* "[...]"
+   * (decl) declarator:  for arrays
+   * (expr) postfix:  array access
+
+other:
+* "*"
+   + (decl) declarator:  for pointer types
+   + (expr) unary:  for pointer deref
+
+
+To simplify the regular expressions used here, we've takens some
+shortcuts and made certain assumptions about the code we are parsing.
+Some of these allow us to skip context-sensitive matching (e.g. braces)
+or otherwise still match arbitrary C code unambiguously.  However, in
+some cases there are certain corner cases where the patterns are
+ambiguous relative to arbitrary C code.  However, they are still
+unambiguous in the specific code we are parsing.
+
+Here are the cases where we've taken shortcuts or made assumptions:
+
+* there is no overlap syntactically between the local context (func
+  bodies) and the global context (other than variable decls), so we
+  do not need to worry about ambiguity due to the overlap:
+   + the global context has no expressions or statements
+   + the local context has no function definitions or type decls
+* no "inline" type declarations (struct, union, enum) in function
+  parameters ~(including function pointers)~
+* no "inline" type decls in function return types
+* no superfluous parentheses in declarators
+* var decls in for loops are always "simple" (e.g. no inline types)
+* only inline struct/union/enum decls may be anonymouns (without a name)
+* no function pointers in function pointer parameters
+* for loop "headers" do not have curly braces (e.g. compound init)
+* syntactically, variable decls do not overlap with stmts/exprs, except
+  in the following case:
+    spam (*eggs) (...)
+  This could be either a function pointer variable named "eggs"
+  or a call to a function named "spam", which returns a function
+  pointer that gets called.  The only differentiator is the
+  syntax used in the "..." part.  It will be comma-separated
+  parameters for the former and comma-separated expressions for
+  the latter.  Thus, if we expect such decls or calls then we must
+  parse the decl params.
+"""
+
+"""
+TODO:
+* extract CPython-specific code
+* drop include injection (or only add when needed)
+* track position instead of slicing "text"
+* Parser class instead of the _iter_source() mess
+* alt impl using a state machine (& tokenizer or split on delimiters)
+"""
+
+from ..info import ParsedItem
+from ._info import SourceInfo
+
+
+def parse(srclines):
+    if isinstance(srclines, str):  # a filename
+        raise NotImplementedError
+
+    anon_name = anonymous_names()
+    for result in _parse(srclines, anon_name):
+        yield ParsedItem.from_raw(result)
+
+
+# XXX Later: Add a separate function to deal with preprocessor directives
+# parsed out of raw source.
+
+
+def anonymous_names():
+    counter = 1
+    def anon_name(prefix='anon-'):
+        nonlocal counter
+        name = f'{prefix}{counter}'
+        counter += 1
+        return name
+    return anon_name
+
+
+#############################
+# internal impl
+
+import logging
+
+
+_logger = logging.getLogger(__name__)
+
+
+def _parse(srclines, anon_name):
+    from ._global import parse_globals
+
+    source = _iter_source(srclines)
+    #source = _iter_source(srclines, showtext=True)
+    for result in parse_globals(source, anon_name):
+        # XXX Handle blocks here instead of in parse_globals().
+        yield result
+
+
+def _iter_source(lines, *, maxtext=20_000, maxlines=700, showtext=False):
+    maxtext = maxtext if maxtext and maxtext > 0 else None
+    maxlines = maxlines if maxlines and maxlines > 0 else None
+    filestack = []
+    allinfo = {}
+    # "lines" should be (fileinfo, data), as produced by the preprocessor code.
+    for fileinfo, line in lines:
+        if fileinfo.filename in filestack:
+            while fileinfo.filename != filestack[-1]:
+                filename = filestack.pop()
+                del allinfo[filename]
+            filename = fileinfo.filename
+            srcinfo = allinfo[filename]
+        else:
+            filename = fileinfo.filename
+            srcinfo = SourceInfo(filename)
+            filestack.append(filename)
+            allinfo[filename] = srcinfo
+
+        _logger.debug(f'-> {line}')
+        srcinfo._add_line(line, fileinfo.lno)
+        if srcinfo.too_much(maxtext, maxlines):
+            break
+        while srcinfo._used():
+            yield srcinfo
+            if showtext:
+                _logger.debug(f'=> {srcinfo.text}')
+    else:
+        if not filestack:
+            srcinfo = SourceInfo('???')
+        else:
+            filename = filestack[-1]
+            srcinfo = allinfo[filename]
+            while srcinfo._used():
+                yield srcinfo
+                if showtext:
+                    _logger.debug(f'=> {srcinfo.text}')
+        yield srcinfo
+        if showtext:
+            _logger.debug(f'=> {srcinfo.text}')
+        if not srcinfo._ready:
+            return
+    # At this point either the file ended prematurely
+    # or there's "too much" text.
+    filename, lno, text = srcinfo.filename, srcinfo._start, srcinfo.text
+    if len(text) > 500:
+        text = text[:500] + '...'
+    raise Exception(f'unmatched text ({filename} starting at line {lno}):\n{text}')
diff --git a/Tools/c-analyzer/c_parser/parser/_alt.py b/Tools/c-analyzer/c_parser/parser/_alt.py
new file mode 100644
index 0000000..05a9101
--- /dev/null
+++ b/Tools/c-analyzer/c_parser/parser/_alt.py
@@ -0,0 +1,6 @@
+
+def _parse(srclines, anon_name):
+    text = ' '.join(l for _, l in srclines)
+
+    from ._delim import parse
+    yield from parse(text, anon_name)
diff --git a/Tools/c-analyzer/c_parser/parser/_common.py b/Tools/c-analyzer/c_parser/parser/_common.py
new file mode 100644
index 0000000..40c3603
--- /dev/null
+++ b/Tools/c-analyzer/c_parser/parser/_common.py
@@ -0,0 +1,115 @@
+import re
+
+from ._regexes import (
+    _ind,
+    STRING_LITERAL,
+    VAR_DECL as _VAR_DECL,
+)
+
+
+def log_match(group, m):
+    from . import _logger
+    _logger.debug(f'matched <{group}> ({m.group(0)})')
+
+
+#############################
+# regex utils
+
+def set_capture_group(pattern, group, *, strict=True):
+    old = f'(?:  # <{group}>'
+    if strict and f'(?:  # <{group}>' not in pattern:
+        raise ValueError(f'{old!r} not found in pattern')
+    return pattern.replace(old, f'(  # <{group}>', 1)
+
+
+def set_capture_groups(pattern, groups, *, strict=True):
+    for group in groups:
+        pattern = set_capture_group(pattern, group, strict=strict)
+    return pattern
+
+
+#############################
+# syntax-related utils
+
+_PAREN_RE = re.compile(rf'''
+    (?:
+        (?:
+            [^'"()]*
+            {_ind(STRING_LITERAL, 3)}
+         )*
+        [^'"()]*
+        (?:
+            ( [(] )
+            |
+            ( [)] )
+         )
+     )
+    ''', re.VERBOSE)
+
+
+def match_paren(text, depth=0):
+    pos = 0
+    while (m := _PAREN_RE.match(text, pos)):
+        pos = m.end()
+        _open, _close = m.groups()
+        if _open:
+            depth += 1
+        else:  # _close
+            depth -= 1
+            if depth == 0:
+                return pos
+    else:
+        raise ValueError(f'could not find matching parens for {text!r}')
+
+
+VAR_DECL = set_capture_groups(_VAR_DECL, (
+    'STORAGE',
+    'TYPE_QUAL',
+    'TYPE_SPEC',
+    'DECLARATOR',
+    'IDENTIFIER',
+    'WRAPPED_IDENTIFIER',
+    'FUNC_IDENTIFIER',
+))
+
+
+def parse_var_decl(decl):
+    m = re.match(VAR_DECL, decl, re.VERBOSE)
+    (storage, typequal, typespec, declarator,
+     name,
+     wrappedname,
+     funcptrname,
+     ) = m.groups()
+    if name:
+        kind = 'simple'
+    elif wrappedname:
+        kind = 'wrapped'
+        name = wrappedname
+    elif funcptrname:
+        kind = 'funcptr'
+        name = funcptrname
+    else:
+        raise NotImplementedError
+    abstract = declarator.replace(name, '')
+    vartype = {
+        'storage': storage,
+        'typequal': typequal,
+        'typespec': typespec,
+        'abstract': abstract,
+    }
+    return (kind, name, vartype)
+
+
+#############################
+# parser state utils
+
+# XXX Drop this or use it!
+def iter_results(results):
+    if not results:
+        return
+    if callable(results):
+        results = results()
+
+    for result, text in results():
+        if result:
+            yield result, text
diff --git a/Tools/c-analyzer/c_parser/parser/_compound_decl_body.py b/Tools/c-analyzer/c_parser/parser/_compound_decl_body.py
new file mode 100644
index 0000000..eb5bc67
--- /dev/null
+++ b/Tools/c-analyzer/c_parser/parser/_compound_decl_body.py
@@ -0,0 +1,158 @@
+import re
+
+from ._regexes import (
+    STRUCT_MEMBER_DECL as _STRUCT_MEMBER_DECL,
+    ENUM_MEMBER_DECL as _ENUM_MEMBER_DECL,
+)
+from ._common import (
+    log_match,
+    parse_var_decl,
+    set_capture_groups,
+)
+
+
+#############################
+# struct / union
+
+STRUCT_MEMBER_DECL = set_capture_groups(_STRUCT_MEMBER_DECL, (
+    'COMPOUND_TYPE_KIND',
+    'COMPOUND_TYPE_NAME',
+    'SPECIFIER_QUALIFIER',
+    'DECLARATOR',
+    'SIZE',
+    'ENDING',
+    'CLOSE',
+))
+STRUCT_MEMBER_RE = re.compile(rf'^ \s* {STRUCT_MEMBER_DECL}', re.VERBOSE)
+
+
+def parse_struct_body(source, anon_name, parent):
+    done = False
+    while not done:
+        done = True
+        for srcinfo in source:
+            m = STRUCT_MEMBER_RE.match(srcinfo.text)
+            if m:
+                break
+        else:
+            # We ran out of lines.
+            if srcinfo is not None:
+                srcinfo.done()
+            return
+        for item in _parse_struct_next(m, srcinfo, anon_name, parent):
+            if callable(item):
+                parse_body = item
+                yield from parse_body(source)
+            else:
+                yield item
+            done = False
+
+
+def _parse_struct_next(m, srcinfo, anon_name, parent):
+    (inline_kind, inline_name,
+     qualspec, declarator,
+     size,
+     ending,
+     close,
+     ) = m.groups()
+    remainder = srcinfo.text[m.end():]
+
+    if close:
+        log_match('compound close', m)
+        srcinfo.advance(remainder)
+
+    elif inline_kind:
+        log_match('compound inline', m)
+        kind = inline_kind
+        name = inline_name or anon_name('inline-')
+        # Immediately emit a forward declaration.
+        yield srcinfo.resolve(kind, name=name, data=None)
+
+        # un-inline the decl.  Note that it might not actually be inline.
+        # We handle the case in the "maybe_inline_actual" branch.
+        srcinfo.nest(
+            remainder,
+            f'{kind} {name}',
+        )
+        def parse_body(source):
+            _parse_body = DECL_BODY_PARSERS[kind]
+
+            data = []  # members
+            ident = f'{kind} {name}'
+            for item in _parse_body(source, anon_name, ident):
+                if item.kind == 'field':
+                    data.append(item)
+                else:
+                    yield item
+            # XXX Should "parent" really be None for inline type decls?
+            yield srcinfo.resolve(kind, data, name, parent=None)
+
+            srcinfo.resume()
+        yield parse_body
+
+    else:
+        # not inline (member)
+        log_match('compound member', m)
+        if qualspec:
+            _, name, data = parse_var_decl(f'{qualspec} {declarator}')
+            if not name:
+                name = anon_name('struct-field-')
+            if size:
+#                data = (data, size)
+                data['size'] = int(size)
+        else:
+            # This shouldn't happen (we expect each field to have a name).
+            raise NotImplementedError
+            name = sized_name or anon_name('struct-field-')
+            data = int(size)
+
+        yield srcinfo.resolve('field', data, name, parent)  # XXX Restart?
+        if ending == ',':
+            remainder = rf'{qualspec} {remainder}'
+        srcinfo.advance(remainder)
+
+
+#############################
+# enum
+
+ENUM_MEMBER_DECL = set_capture_groups(_ENUM_MEMBER_DECL, (
+    'CLOSE',
+    'NAME',
+    'INIT',
+    'ENDING',
+))
+ENUM_MEMBER_RE = re.compile(rf'{ENUM_MEMBER_DECL}', re.VERBOSE)
+
+
+def parse_enum_body(source, _anon_name, _parent):
+    ending = None
+    while ending != '}':
+        for srcinfo in source:
+            m = ENUM_MEMBER_RE.match(srcinfo.text)
+            if m:
+                break
+        else:
+            # We ran out of lines.
+            if srcinfo is not None:
+                srcinfo.done()
+            return
+        remainder = srcinfo.text[m.end():]
+
+        (close,
+         name, init, ending,
+         ) = m.groups()
+        if close:
+            ending = '}'
+        else:
+            data = init
+            yield srcinfo.resolve('field', data, name, _parent)
+        srcinfo.advance(remainder)
+
+
+#############################
+
+DECL_BODY_PARSERS = {
+    'struct': parse_struct_body,
+    'union': parse_struct_body,
+    'enum': parse_enum_body,
+}
diff --git a/Tools/c-analyzer/c_parser/parser/_delim.py b/Tools/c-analyzer/c_parser/parser/_delim.py
new file mode 100644
index 0000000..51433a6
--- /dev/null
+++ b/Tools/c-analyzer/c_parser/parser/_delim.py
@@ -0,0 +1,54 @@
+import re
+import textwrap
+
+from ._regexes import _ind, STRING_LITERAL
+
+
+def parse(text, anon_name):
+    context = None
+    data = None
+    for m in DELIMITER_RE.find_iter(text):
+        before, opened, closed = m.groups()
+        delim = opened or closed
+
+        handle_segment = HANDLERS[context][delim]
+        result, context, data = handle_segment(before, delim, data)
+        if result:
+            yield result
+
+
+DELIMITER = textwrap.dedent(rf'''
+    (
+        (?:
+            [^'"()\[\]{};]*
+            {_ind(STRING_LITERAL, 3)}
+        }*
+        [^'"()\[\]{};]+
+     )?  # <before>
+    (?:
+        (
+            [(\[{]
+         )  # <open>
+        |
+        (
+            [)\]};]
+         )  # <close>
+     )?
+    ''')
+DELIMITER_RE = re.compile(DELIMITER, re.VERBOSE)
+
+_HANDLERS = {
+    None: {  # global
+        # opened
+        '{': ...,
+        '[': None,
+        '(': None,
+        # closed
+        '}': None,
+        ']': None,
+        ')': None,
+        ';': ...,
+    },
+    '': {
+    },
+}
diff --git a/Tools/c-analyzer/c_parser/parser/_func_body.py b/Tools/c-analyzer/c_parser/parser/_func_body.py
new file mode 100644
index 0000000..42fd459
--- /dev/null
+++ b/Tools/c-analyzer/c_parser/parser/_func_body.py
@@ -0,0 +1,278 @@
+import re
+
+from ._regexes import (
+    LOCAL as _LOCAL,
+    LOCAL_STATICS as _LOCAL_STATICS,
+)
+from ._common import (
+    log_match,
+    parse_var_decl,
+    set_capture_groups,
+    match_paren,
+)
+from ._compound_decl_body import DECL_BODY_PARSERS
+
+
+LOCAL = set_capture_groups(_LOCAL, (
+    'EMPTY',
+    'INLINE_LEADING',
+    'INLINE_PRE',
+    'INLINE_KIND',
+    'INLINE_NAME',
+    'STORAGE',
+    'VAR_DECL',
+    'VAR_INIT',
+    'VAR_ENDING',
+    'COMPOUND_BARE',
+    'COMPOUND_LABELED',
+    'COMPOUND_PAREN',
+    'BLOCK_LEADING',
+    'BLOCK_OPEN',
+    'SIMPLE_STMT',
+    'SIMPLE_ENDING',
+    'BLOCK_CLOSE',
+))
+LOCAL_RE = re.compile(rf'^ \s* {LOCAL}', re.VERBOSE)
+
+
+# Note that parse_function_body() still has trouble with a few files
+# in the CPython codebase.
+
+def parse_function_body(source, name, anon_name):
+    # XXX
+    raise NotImplementedError
+
+
+def parse_function_body(name, text, resolve, source, anon_name, parent):
+    raise NotImplementedError
+    # For now we do not worry about locals declared in for loop "headers".
+    depth = 1;
+    while depth > 0:
+        m = LOCAL_RE.match(text)
+        while not m:
+            text, resolve = continue_text(source, text or '{', resolve)
+            m = LOCAL_RE.match(text)
+        text = text[m.end():]
+        (
+         empty,
+         inline_leading, inline_pre, inline_kind, inline_name,
+         storage, decl,
+         var_init, var_ending,
+         compound_bare, compound_labeled, compound_paren,
+         block_leading, block_open,
+         simple_stmt, simple_ending,
+         block_close,
+         ) = m.groups()
+
+        if empty:
+            log_match('', m)
+            resolve(None, None, None, text)
+            yield None, text
+        elif inline_kind:
+            log_match('', m)
+            kind = inline_kind
+            name = inline_name or anon_name('inline-')
+            data = []  # members
+            # We must set the internal "text" from _iter_source() to the
+            # start of the inline compound body,
+            # Note that this is effectively like a forward reference that
+            # we do not emit.
+            resolve(kind, None, name, text, None)
+            _parse_body = DECL_BODY_PARSERS[kind]
+            before = []
+            ident = f'{kind} {name}'
+            for member, inline, text in _parse_body(text, resolve, source, anon_name, ident):
+                if member:
+                    data.append(member)
+                if inline:
+                    yield from inline
+            # un-inline the decl.  Note that it might not actually be inline.
+            # We handle the case in the "maybe_inline_actual" branch.
+            text = f'{inline_leading or ""} {inline_pre or ""} {kind} {name} {text}'
+            # XXX Should "parent" really be None for inline type decls?
+            yield resolve(kind, data, name, text, None), text
+        elif block_close:
+            log_match('', m)
+            depth -= 1
+            resolve(None, None, None, text)
+            # XXX This isn't great.  Calling resolve() should have
+            # cleared the closing bracket.  However, some code relies
+            # on the yielded value instead of the resolved one.  That
+            # needs to be fixed.
+            yield None, text
+        elif compound_bare:
+            log_match('', m)
+            yield resolve('statement', compound_bare, None, text, parent), text
+        elif compound_labeled:
+            log_match('', m)
+            yield resolve('statement', compound_labeled, None, text, parent), text
+        elif compound_paren:
+            log_match('', m)
+            try:
+                pos = match_paren(text)
+            except ValueError:
+                text = f'{compound_paren} {text}'
+                #resolve(None, None, None, text)
+                text, resolve = continue_text(source, text, resolve)
+                yield None, text
+            else:
+                head = text[:pos]
+                text = text[pos:]
+                if compound_paren == 'for':
+                    # XXX Parse "head" as a compound statement.
+                    stmt1, stmt2, stmt3 = head.split(';', 2)
+                    data = {
+                        'compound': compound_paren,
+                        'statements': (stmt1, stmt2, stmt3),
+                    }
+                else:
+                    data = {
+                        'compound': compound_paren,
+                        'statement': head,
+                    }
+                yield resolve('statement', data, None, text, parent), text
+        elif block_open:
+            log_match('', m)
+            depth += 1
+            if block_leading:
+                # An inline block: the last evaluated expression is used
+                # in place of the block.
+                # XXX Combine it with the remainder after the block close.
+                stmt = f'{block_open}{{<expr>}}...;'
+                yield resolve('statement', stmt, None, text, parent), text
+            else:
+                resolve(None, None, None, text)
+                yield None, text
+        elif simple_ending:
+            log_match('', m)
+            yield resolve('statement', simple_stmt, None, text, parent), text
+        elif var_ending:
+            log_match('', m)
+            kind = 'variable'
+            _, name, vartype = parse_var_decl(decl)
+            data = {
+                'storage': storage,
+                'vartype': vartype,
+            }
+            after = ()
+            if var_ending == ',':
+                # It was a multi-declaration, so queue up the next one.
+                _, qual, typespec, _ = vartype.values()
+                text = f'{storage or ""} {qual or ""} {typespec} {text}'
+            yield resolve(kind, data, name, text, parent), text
+            if var_init:
+                _data = f'{name} = {var_init.strip()}'
+                yield resolve('statement', _data, None, text, parent), text
+        else:
+            # This should be unreachable.
+            raise NotImplementedError
+
+
+#############################
+# static local variables
+
+LOCAL_STATICS = set_capture_groups(_LOCAL_STATICS, (
+    'INLINE_LEADING',
+    'INLINE_PRE',
+    'INLINE_KIND',
+    'INLINE_NAME',
+    'STATIC_DECL',
+    'STATIC_INIT',
+    'STATIC_ENDING',
+    'DELIM_LEADING',
+    'BLOCK_OPEN',
+    'BLOCK_CLOSE',
+    'STMT_END',
+))
+LOCAL_STATICS_RE = re.compile(rf'^ \s* {LOCAL_STATICS}', re.VERBOSE)
+
+
+def parse_function_statics(source, func, anon_name):
+    # For now we do not worry about locals declared in for loop "headers".
+    depth = 1;
+    while depth > 0:
+        for srcinfo in source:
+            m = LOCAL_STATICS_RE.match(srcinfo.text)
+            if m:
+                break
+        else:
+            # We ran out of lines.
+            if srcinfo is not None:
+                srcinfo.done()
+            return
+        for item, depth in _parse_next_local_static(m, srcinfo,
+                                                    anon_name, func, depth):
+            if callable(item):
+                parse_body = item
+                yield from parse_body(source)
+            elif item is not None:
+                yield item
+
+
+def _parse_next_local_static(m, srcinfo, anon_name, func, depth):
+    (inline_leading, inline_pre, inline_kind, inline_name,
+     static_decl, static_init, static_ending,
+     _delim_leading,
+     block_open,
+     block_close,
+     stmt_end,
+     ) = m.groups()
+    remainder = srcinfo.text[m.end():]
+
+    if inline_kind:
+        log_match('func inline', m)
+        kind = inline_kind
+        name = inline_name or anon_name('inline-')
+        # Immediately emit a forward declaration.
+        yield srcinfo.resolve(kind, name=name, data=None), depth
+
+        # un-inline the decl.  Note that it might not actually be inline.
+        # We handle the case in the "maybe_inline_actual" branch.
+        srcinfo.nest(
+            remainder,
+            f'{inline_leading or ""} {inline_pre or ""} {kind} {name}'
+        )
+        def parse_body(source):
+            _parse_body = DECL_BODY_PARSERS[kind]
+
+            data = []  # members
+            ident = f'{kind} {name}'
+            for item in _parse_body(source, anon_name, ident):
+                if item.kind == 'field':
+                    data.append(item)
+                else:
+                    yield item
+            # XXX Should "parent" really be None for inline type decls?
+            yield srcinfo.resolve(kind, data, name, parent=None)
+
+            srcinfo.resume()
+        yield parse_body, depth
+
+    elif static_decl:
+        log_match('local variable', m)
+        _, name, data = parse_var_decl(static_decl)
+
+        yield srcinfo.resolve('variable', data, name, parent=func), depth
+
+        if static_init:
+            srcinfo.advance(f'{name} {static_init} {remainder}')
+        elif static_ending == ',':
+            # It was a multi-declaration, so queue up the next one.
+            _, qual, typespec, _ = data.values()
+            srcinfo.advance(f'static {qual or ""} {typespec} {remainder}')
+        else:
+            srcinfo.advance('')
+
+    else:
+        log_match('func other', m)
+        if block_open:
+            depth += 1
+        elif block_close:
+            depth -= 1
+        elif stmt_end:
+            pass
+        else:
+            # This should be unreachable.
+            raise NotImplementedError
+        srcinfo.advance(remainder)
+        yield None, depth
diff --git a/Tools/c-analyzer/c_parser/parser/_global.py b/Tools/c-analyzer/c_parser/parser/_global.py
new file mode 100644
index 0000000..35947c1
--- /dev/null
+++ b/Tools/c-analyzer/c_parser/parser/_global.py
@@ -0,0 +1,179 @@
+import re
+
+from ._regexes import (
+    GLOBAL as _GLOBAL,
+)
+from ._common import (
+    log_match,
+    parse_var_decl,
+    set_capture_groups,
+)
+from ._compound_decl_body import DECL_BODY_PARSERS
+#from ._func_body import parse_function_body
+from ._func_body import parse_function_statics as parse_function_body
+
+
+GLOBAL = set_capture_groups(_GLOBAL, (
+    'EMPTY',
+    'COMPOUND_LEADING',
+    'COMPOUND_KIND',
+    'COMPOUND_NAME',
+    'FORWARD_KIND',
+    'FORWARD_NAME',
+    'MAYBE_INLINE_ACTUAL',
+    'TYPEDEF_DECL',
+    'TYPEDEF_FUNC_PARAMS',
+    'VAR_STORAGE',
+    'FUNC_INLINE',
+    'VAR_DECL',
+    'FUNC_PARAMS',
+    'FUNC_DELIM',
+    'FUNC_LEGACY_PARAMS',
+    'VAR_INIT',
+    'VAR_ENDING',
+))
+GLOBAL_RE = re.compile(rf'^ \s* {GLOBAL}', re.VERBOSE)
+
+
+def parse_globals(source, anon_name):
+    for srcinfo in source:
+        m = GLOBAL_RE.match(srcinfo.text)
+        if not m:
+            # We need more text.
+            continue
+        for item in _parse_next(m, srcinfo, anon_name):
+            if callable(item):
+                parse_body = item
+                yield from parse_body(source)
+            else:
+                yield item
+    else:
+        # We ran out of lines.
+        if srcinfo is not None:
+            srcinfo.done()
+        return
+
+
+def _parse_next(m, srcinfo, anon_name):
+    (
+     empty,
+     # compound type decl (maybe inline)
+     compound_leading, compound_kind, compound_name,
+     forward_kind, forward_name, maybe_inline_actual,
+     # typedef
+     typedef_decl, typedef_func_params,
+     # vars and funcs
+     storage, func_inline, decl,
+     func_params, func_delim, func_legacy_params,
+     var_init, var_ending,
+     ) = m.groups()
+    remainder = srcinfo.text[m.end():]
+
+    if empty:
+        log_match('global empty', m)
+        srcinfo.advance(remainder)
+
+    elif maybe_inline_actual:
+        log_match('maybe_inline_actual', m)
+        # Ignore forward declarations.
+        # XXX Maybe return them too (with an "isforward" flag)?
+        if not maybe_inline_actual.strip().endswith(';'):
+            remainder = maybe_inline_actual + remainder
+        yield srcinfo.resolve(forward_kind, None, forward_name)
+        if maybe_inline_actual.strip().endswith('='):
+            # We use a dummy prefix for a fake typedef.
+            # XXX Ideally this case would not be caught by MAYBE_INLINE_ACTUAL.
+            _, name, data = parse_var_decl(f'{forward_kind} {forward_name} fake_typedef_{forward_name}')
+            yield srcinfo.resolve('typedef', data, name, parent=None)
+            remainder = f'{name} {remainder}'
+        srcinfo.advance(remainder)
+
+    elif compound_kind:
+        kind = compound_kind
+        name = compound_name or anon_name('inline-')
+        # Immediately emit a forward declaration.
+        yield srcinfo.resolve(kind, name=name, data=None)
+
+        # un-inline the decl.  Note that it might not actually be inline.
+        # We handle the case in the "maybe_inline_actual" branch.
+        srcinfo.nest(
+            remainder,
+            f'{compound_leading or ""} {compound_kind} {name}',
+        )
+        def parse_body(source):
+            _parse_body = DECL_BODY_PARSERS[compound_kind]
+
+            data = []  # members
+            ident = f'{kind} {name}'
+            for item in _parse_body(source, anon_name, ident):
+                if item.kind == 'field':
+                    data.append(item)
+                else:
+                    yield item
+            # XXX Should "parent" really be None for inline type decls?
+            yield srcinfo.resolve(kind, data, name, parent=None)
+
+            srcinfo.resume()
+        yield parse_body
+
+    elif typedef_decl:
+        log_match('typedef', m)
+        kind = 'typedef'
+        _, name, data = parse_var_decl(typedef_decl)
+        if typedef_func_params:
+            return_type = data
+            # This matches the data for func declarations.
+            data = {
+                'storage': None,
+                'inline': None,
+                'params': f'({typedef_func_params})',
+                'returntype': return_type,
+                'isforward': True,
+            }
+        yield srcinfo.resolve(kind, data, name, parent=None)
+        srcinfo.advance(remainder)
+
+    elif func_delim or func_legacy_params:
+        log_match('function', m)
+        kind = 'function'
+        _, name, return_type = parse_var_decl(decl)
+        func_params = func_params or func_legacy_params
+        data = {
+            'storage': storage,
+            'inline': func_inline,
+            'params': f'({func_params})',
+            'returntype': return_type,
+            'isforward': func_delim == ';',
+        }
+
+        yield srcinfo.resolve(kind, data, name, parent=None)
+        srcinfo.advance(remainder)
+
+        if func_delim == '{' or func_legacy_params:
+            def parse_body(source):
+                yield from parse_function_body(source, name, anon_name)
+            yield parse_body
+
+    elif var_ending:
+        log_match('global variable', m)
+        kind = 'variable'
+        _, name, vartype = parse_var_decl(decl)
+        data = {
+            'storage': storage,
+            'vartype': vartype,
+        }
+        yield srcinfo.resolve(kind, data, name, parent=None)
+
+        if var_ending == ',':
+            # It was a multi-declaration, so queue up the next one.
+            _, qual, typespec, _ = vartype.values()
+            remainder = f'{storage or ""} {qual or ""} {typespec} {remainder}'
+        srcinfo.advance(remainder)
+
+        if var_init:
+            _data = f'{name} = {var_init.strip()}'
+            yield srcinfo.resolve('statement', _data, name=None)
+
+    else:
+        # This should be unreachable.
+        raise NotImplementedError
diff --git a/Tools/c-analyzer/c_parser/parser/_info.py b/Tools/c-analyzer/c_parser/parser/_info.py
new file mode 100644
index 0000000..cc21931
--- /dev/null
+++ b/Tools/c-analyzer/c_parser/parser/_info.py
@@ -0,0 +1,183 @@
+import re
+
+from ..info import KIND, ParsedItem, FileInfo
+
+
+class TextInfo:
+
+    def __init__(self, text, start=None, end=None):
+        # immutable:
+        if not start:
+            start = 1
+        self.start = start
+
+        # mutable:
+        lines = text.splitlines() or ['']
+        self.text = text.strip()
+        if not end:
+            end = start + len(lines) - 1
+        self.end = end
+        self.line = lines[-1]
+
+    def __repr__(self):
+        args = (f'{a}={getattr(self, a)!r}'
+                for a in ['text', 'start', 'end'])
+        return f'{type(self).__name__}({", ".join(args)})'
+
+    def add_line(self, line, lno=None):
+        if lno is None:
+            lno = self.end + 1
+        else:
+            if isinstance(lno, FileInfo):
+                fileinfo = lno
+                if fileinfo.filename != self.filename:
+                    raise NotImplementedError((fileinfo, self.filename))
+                lno = fileinfo.lno
+            # XXX
+            #if lno < self.end:
+            #    raise NotImplementedError((lno, self.end))
+        line = line.lstrip()
+        self.text += ' ' + line
+        self.line = line
+        self.end = lno
+
+
+class SourceInfo:
+
+    _ready = False
+
+    def __init__(self, filename, _current=None):
+        # immutable:
+        self.filename = filename
+        # mutable:
+        if isinstance(_current, str):
+            _current = TextInfo(_current)
+        self._current = _current
+        start = -1
+        self._start = _current.start if _current else -1
+        self._nested = []
+        self._set_ready()
+
+    def __repr__(self):
+        args = (f'{a}={getattr(self, a)!r}'
+                for a in ['filename', '_current'])
+        return f'{type(self).__name__}({", ".join(args)})'
+
+    @property
+    def start(self):
+        if self._current is None:
+            return self._start
+        return self._current.start
+
+    @property
+    def end(self):
+        if self._current is None:
+            return self._start
+        return self._current.end
+
+    @property
+    def text(self):
+        if self._current is None:
+            return ''
+        return self._current.text
+
+    def nest(self, text, before, start=None):
+        if self._current is None:
+            raise Exception('nesting requires active source text')
+        current = self._current
+        current.text = before
+        self._nested.append(current)
+        self._replace(text, start)
+
+    def resume(self, remainder=None):
+        if not self._nested:
+            raise Exception('no nested text to resume')
+        if self._current is None:
+            raise Exception('un-nesting requires active source text')
+        if remainder is None:
+            remainder = self._current.text
+        self._clear()
+        self._current = self._nested.pop()
+        self._current.text += ' ' + remainder
+        self._set_ready()
+
+    def advance(self, remainder, start=None):
+        if self._current is None:
+            raise Exception('advancing requires active source text')
+        if remainder.strip():
+            self._replace(remainder, start, fixnested=True)
+        else:
+            if self._nested:
+                self._replace('', start, fixnested=True)
+                #raise Exception('cannot advance while nesting')
+            else:
+                self._clear(start)
+
+    def resolve(self, kind, data, name, parent=None):
+        # "field" isn't a top-level kind, so we leave it as-is.
+        if kind and kind != 'field':
+            kind = KIND._from_raw(kind)
+        fileinfo = FileInfo(self.filename, self._start)
+        return ParsedItem(fileinfo, kind, parent, name, data)
+
+    def done(self):
+        self._set_ready()
+
+    def too_much(self, maxtext, maxlines):
+        if maxtext and len(self.text) > maxtext:
+            pass
+        elif maxlines and self.end - self.start > maxlines:
+            pass
+        else:
+            return False
+
+        #if re.fullmatch(r'[^;]+\[\][ ]*=[ ]*[{]([ ]*\d+,)*([ ]*\d+,?)\s*',
+        #                self._current.text):
+        #    return False
+        return True
+
+    def _set_ready(self):
+        if self._current is None:
+            self._ready = False
+        else:
+            self._ready = self._current.text.strip() != ''
+
+    def _used(self):
+        ready = self._ready
+        self._ready = False
+        return ready
+
+    def _clear(self, start=None):
+        old = self._current
+        if self._current is not None:
+            # XXX Fail if self._current wasn't used up?
+            if start is None:
+                start = self._current.end
+            self._current = None
+        if start is not None:
+            self._start = start
+        self._set_ready()
+        return old
+
+    def _replace(self, text, start=None, *, fixnested=False):
+        end = self._current.end
+        old = self._clear(start)
+        self._current = TextInfo(text, self._start, end)
+        if fixnested and self._nested and self._nested[-1] is old:
+            self._nested[-1] = self._current
+        self._set_ready()
+
+    def _add_line(self, line, lno=None):
+        if not line.strip():
+            # We don't worry about multi-line string literals.
+            return
+        if self._current is None:
+            self._start = lno
+            self._current = TextInfo(line, lno)
+        else:
+            # XXX
+            #if lno < self._current.end:
+            #    # A circular include?
+            #    raise NotImplementedError((lno, self))
+            self._current.add_line(line, lno)
+        self._ready = True
diff --git a/Tools/c-analyzer/c_parser/parser/_regexes.py b/Tools/c-analyzer/c_parser/parser/_regexes.py
new file mode 100644
index 0000000..cb85a59
--- /dev/null
+++ b/Tools/c-analyzer/c_parser/parser/_regexes.py
@@ -0,0 +1,797 @@
+# Regular expression patterns for C syntax.
+#
+# None of these patterns has any capturing.  However, a number of them
+# have capturing markers compatible with utils.set_capture_groups().
+
+import textwrap
+
+
+def _ind(text, level=1, edges='both'):
+    indent = '    ' * level
+    text = textwrap.indent(text, indent)
+    if edges == 'pre' or edges == 'both':
+        text = '\n' + indent + text.lstrip()
+    if edges == 'post' or edges == 'both':
+        text = text.rstrip() + '\n' + '    ' * (level - 1)
+    return text
+
+
+#######################################
+# general
+
+HEX = r'(?: [0-9a-zA-Z] )'
+
+STRING_LITERAL = textwrap.dedent(rf'''
+    (?:
+        # character literal
+        (?:
+            ['] [^'] [']
+            |
+            ['] \\ . [']
+            |
+            ['] \\x{HEX}{HEX} [']
+            |
+            ['] \\0\d\d [']
+            |
+            (?:
+                ['] \\o[01]\d\d [']
+                |
+                ['] \\o2[0-4]\d [']
+                |
+                ['] \\o25[0-5] [']
+             )
+         )
+        |
+        # string literal
+        (?:
+            ["] (?: [^"\\]* \\ . )* [^"\\]* ["]
+         )
+        # end string literal
+     )
+    ''')
+
+_KEYWORD = textwrap.dedent(r'''
+    (?:
+        \b
+        (?:
+            auto |
+            extern |
+            register |
+            static |
+            typedef |
+
+            const |
+            volatile |
+
+            signed |
+            unsigned |
+            char |
+            short |
+            int |
+            long |
+            float |
+            double |
+            void |
+
+            struct |
+            union |
+            enum |
+
+            goto |
+            return |
+            sizeof |
+            break |
+            continue |
+            if |
+            else |
+            for |
+            do |
+            while |
+            switch |
+            case |
+            default |
+            entry
+         )
+        \b
+     )
+    ''')
+KEYWORD = rf'''
+    # keyword
+    {_KEYWORD}
+    # end keyword
+    '''
+_KEYWORD = ''.join(_KEYWORD.split())
+
+IDENTIFIER = r'(?: [a-zA-Z_][a-zA-Z0-9_]* )'
+# We use a negative lookahead to filter out keywords.
+STRICT_IDENTIFIER = rf'(?: (?! {_KEYWORD} ) \b {IDENTIFIER} \b )'
+ANON_IDENTIFIER = rf'(?: (?! {_KEYWORD} ) \b {IDENTIFIER} (?: - \d+ )? \b )'
+
+
+#######################################
+# types
+
+SIMPLE_TYPE = textwrap.dedent(rf'''
+    # simple type
+    (?:
+        \b
+        (?:
+            void
+            |
+            (?: signed | unsigned )  # implies int
+            |
+            (?:
+                (?: (?: signed | unsigned ) \s+ )?
+                (?: (?: long | short ) \s+ )?
+                (?: char | short | int | long | float | double )
+             )
+         )
+        \b
+     )
+    # end simple type
+    ''')
+
+COMPOUND_TYPE_KIND = r'(?: \b (?: struct | union | enum ) \b )'
+
+
+#######################################
+# variable declarations
+
+_STORAGE = 'auto register static extern'.split()
+STORAGE_CLASS = rf'(?: \b (?: {" | ".join(_STORAGE)} ) \b )'
+TYPE_QUALIFIER = r'(?: \b (?: const | volatile ) \b )'
+PTR_QUALIFIER = rf'(?: [*] (?: \s* {TYPE_QUALIFIER} )? )'
+
+TYPE_SPEC = textwrap.dedent(rf'''
+    # type spec
+    (?:
+        {_ind(SIMPLE_TYPE, 2)}
+        |
+        (?:
+            [_]*typeof[_]*
+            \s* [(]
+            (?: \s* [*&] )*
+            \s* {STRICT_IDENTIFIER}
+            \s* [)]
+         )
+        |
+        # reference to a compound type
+        (?:
+            {COMPOUND_TYPE_KIND}
+            (?: \s* {ANON_IDENTIFIER} )?
+         )
+        |
+        # reference to a typedef
+        {STRICT_IDENTIFIER}
+     )
+    # end type spec
+    ''')
+
+DECLARATOR = textwrap.dedent(rf'''
+    # declarator  (possibly abstract)
+    (?:
+        (?: {PTR_QUALIFIER} \s* )*
+        (?:
+            (?:
+                (?:  # <IDENTIFIER>
+                    {STRICT_IDENTIFIER}
+                )
+                (?: \s* \[ (?: \s* [^\]]+ \s* )? [\]] )*  # arrays
+             )
+            |
+            (?:
+                [(] \s*
+                (?:  # <WRAPPED_IDENTIFIER>
+                    {STRICT_IDENTIFIER}
+                )
+                (?: \s* \[ (?: \s* [^\]]+ \s* )? [\]] )*  # arrays
+                \s* [)]
+             )
+            |
+            # func ptr
+            (?:
+                [(] (?: \s* {PTR_QUALIFIER} )? \s*
+                (?:  # <FUNC_IDENTIFIER>
+                    {STRICT_IDENTIFIER}
+                )
+                (?: \s* \[ (?: \s* [^\]]+ \s* )? [\]] )*  # arrays
+                \s* [)]
+                # We allow for a single level of paren nesting in parameters.
+                \s* [(] (?: [^()]* [(] [^)]* [)] )* [^)]* [)]
+             )
+         )
+     )
+    # end declarator
+    ''')
+
+VAR_DECL = textwrap.dedent(rf'''
+    # var decl (and typedef and func return type)
+    (?:
+        (?:
+            (?:  # <STORAGE>
+                {STORAGE_CLASS}
+            )
+            \s*
+        )?
+        (?:
+            (?:  # <TYPE_QUAL>
+                {TYPE_QUALIFIER}
+            )
+            \s*
+         )?
+        (?:
+            (?:  # <TYPE_SPEC>
+                {_ind(TYPE_SPEC, 4)}
+            )
+         )
+        \s*
+        (?:
+            (?:  # <DECLARATOR>
+                {_ind(DECLARATOR, 4)}
+            )
+         )
+     )
+    # end var decl
+    ''')
+
+INITIALIZER = textwrap.dedent(rf'''
+    # initializer
+    (?:
+        (?:
+            [(]
+            # no nested parens (e.g. func ptr)
+            [^)]*
+            [)]
+            \s*
+         )?
+        (?:
+            # a string literal
+            (?:
+                (?: {_ind(STRING_LITERAL, 4)} \s* )*
+                {_ind(STRING_LITERAL, 4)}
+             )
+            |
+
+            # a simple initializer
+            (?:
+                (?:
+                    [^'",;{{]*
+                    {_ind(STRING_LITERAL, 4)}
+                 )*
+                [^'",;{{]*
+             )
+            |
+
+            # a struct/array literal
+            (?:
+                # We only expect compound initializers with
+                # single-variable declarations.
+                {{
+                (?:
+                    [^'";]*?
+                    {_ind(STRING_LITERAL, 5)}
+                 )*
+                [^'";]*?
+                }}
+                (?= \s* ; )  # Note this lookahead.
+             )
+         )
+     )
+    # end initializer
+    ''')
+
+
+#######################################
+# compound type declarations
+
+STRUCT_MEMBER_DECL = textwrap.dedent(rf'''
+    (?:
+        # inline compound type decl
+        (?:
+            (?:  # <COMPOUND_TYPE_KIND>
+                {COMPOUND_TYPE_KIND}
+             )
+            (?:
+                \s+
+                (?:  # <COMPOUND_TYPE_NAME>
+                    {STRICT_IDENTIFIER}
+                 )
+             )?
+            \s* {{
+         )
+        |
+        (?:
+            # typed member
+            (?:
+                # Technically it doesn't have to have a type...
+                (?:  # <SPECIFIER_QUALIFIER>
+                    (?: {TYPE_QUALIFIER} \s* )?
+                    {_ind(TYPE_SPEC, 5)}
+                 )
+                (?:
+                    # If it doesn't have a declarator then it will have
+                    # a size and vice versa.
+                    \s*
+                    (?:  # <DECLARATOR>
+                        {_ind(DECLARATOR, 6)}
+                     )
+                 )?
+            )
+
+            # sized member
+            (?:
+                \s* [:] \s*
+                (?:  # <SIZE>
+                    \d+
+                 )
+             )?
+            \s*
+            (?:  # <ENDING>
+                [,;]
+             )
+         )
+        |
+        (?:
+            \s*
+            (?:  # <CLOSE>
+                }}
+             )
+         )
+     )
+    ''')
+
+ENUM_MEMBER_DECL = textwrap.dedent(rf'''
+    (?:
+        (?:
+            \s*
+            (?:  # <CLOSE>
+                }}
+             )
+         )
+        |
+        (?:
+            \s*
+            (?:  # <NAME>
+                {IDENTIFIER}
+             )
+            (?:
+                \s* = \s*
+                (?:  # <INIT>
+                    {_ind(STRING_LITERAL, 4)}
+                    |
+                    [^'",}}]+
+                 )
+             )?
+            \s*
+            (?:  # <ENDING>
+                , | }}
+             )
+         )
+     )
+    ''')
+
+
+#######################################
+# statements
+
+SIMPLE_STMT_BODY = textwrap.dedent(rf'''
+    # simple statement body
+    (?:
+        (?:
+            [^'"{{}};]*
+            {_ind(STRING_LITERAL, 3)}
+         )*
+        [^'"{{}};]*
+        #(?= [;{{] )  # Note this lookahead.
+     )
+    # end simple statement body
+    ''')
+SIMPLE_STMT = textwrap.dedent(rf'''
+    # simple statement
+    (?:
+        (?:  # <SIMPLE_STMT>
+            # stmt-inline "initializer"
+            (?:
+                return \b
+                (?:
+                    \s*
+                    {_ind(INITIALIZER, 5)}
+                )?
+             )
+            |
+            # variable assignment
+            (?:
+                (?: [*] \s* )?
+                (?:
+                    {STRICT_IDENTIFIER} \s*
+                    (?: . | -> ) \s*
+                 )*
+                {STRICT_IDENTIFIER}
+                (?: \s* \[ \s* \d+ \s* \] )?
+                \s* = \s*
+                {_ind(INITIALIZER, 4)}
+             )
+            |
+            # catchall return statement
+            (?:
+                return \b
+                (?:
+                    (?:
+                        [^'";]*
+                        {_ind(STRING_LITERAL, 6)}
+                     )*
+                    \s* [^'";]*
+                 )?
+             )
+            |
+            # simple statement
+            (?:
+                {_ind(SIMPLE_STMT_BODY, 4)}
+             )
+         )
+        \s*
+        (?:  # <SIMPLE_ENDING>
+            ;
+         )
+     )
+    # end simple statement
+    ''')
+COMPOUND_STMT = textwrap.dedent(rf'''
+    # compound statement
+    (?:
+        \b
+        (?:
+            (?:
+                (?:  # <COMPOUND_BARE>
+                    else | do
+                 )
+                \b
+             )
+            |
+            (?:
+                (?:  # <COMPOUND_LABELED>
+                    (?:
+                        case \b
+                        (?:
+                            [^'":]*
+                            {_ind(STRING_LITERAL, 7)}
+                         )*
+                        \s* [^'":]*
+                     )
+                    |
+                    default
+                    |
+                    {STRICT_IDENTIFIER}
+                 )
+                \s* [:]
+             )
+            |
+            (?:
+                (?:  # <COMPOUND_PAREN>
+                    for | while | if | switch
+                 )
+                \s* (?= [(] )  # Note this lookahead.
+             )
+         )
+        \s*
+     )
+    # end compound statement
+    ''')
+
+
+#######################################
+# function bodies
+
+LOCAL = textwrap.dedent(rf'''
+    (?:
+        # an empty statement
+        (?:  # <EMPTY>
+            ;
+         )
+        |
+        # inline type decl
+        (?:
+            (?:
+                (?:  # <INLINE_LEADING>
+                    [^;{{}}]+?
+                 )
+                \s*
+             )?
+            (?:  # <INLINE_PRE>
+                (?: {STORAGE_CLASS} \s* )?
+                (?: {TYPE_QUALIFIER} \s* )?
+             )?  # </INLINE_PRE>
+            (?:  # <INLINE_KIND>
+                {COMPOUND_TYPE_KIND}
+             )
+            (?:
+                \s+
+                (?:  # <INLINE_NAME>
+                    {STRICT_IDENTIFIER}
+                 )
+             )?
+            \s* {{
+         )
+        |
+        # var decl
+        (?:
+            (?:  # <STORAGE>
+                {STORAGE_CLASS}
+             )?  # </STORAGE>
+            (?:
+                \s*
+                (?:  # <VAR_DECL>
+                    {_ind(VAR_DECL, 5)}
+                 )
+             )
+            (?:
+                (?:
+                    # initializer
+                    # We expect only basic initializers.
+                    \s* = \s*
+                    (?:  # <VAR_INIT>
+                        {_ind(INITIALIZER, 6)}
+                     )
+                 )?
+                (?:
+                    \s*
+                    (?:  # <VAR_ENDING>
+                        [,;]
+                     )
+                 )
+             )
+         )
+        |
+        {_ind(COMPOUND_STMT, 2)}
+        |
+        # start-of-block
+        (?:
+            (?:  # <BLOCK_LEADING>
+                (?:
+                    [^'"{{}};]*
+                    {_ind(STRING_LITERAL, 5)}
+                 )*
+                [^'"{{}};]*
+                # Presumably we will not see "== {{".
+                [^\s='"{{}});]
+                \s*
+             )?  # </BLOCK_LEADING>
+            (?:  # <BLOCK_OPEN>
+                {{
+             )
+         )
+        |
+        {_ind(SIMPLE_STMT, 2)}
+        |
+        # end-of-block
+        (?:  # <BLOCK_CLOSE>
+            }}
+         )
+     )
+    ''')
+
+LOCAL_STATICS = textwrap.dedent(rf'''
+    (?:
+        # inline type decl
+        (?:
+            (?:
+                (?:  # <INLINE_LEADING>
+                    [^;{{}}]+?
+                 )
+                \s*
+             )?
+            (?:  # <INLINE_PRE>
+                (?: {STORAGE_CLASS} \s* )?
+                (?: {TYPE_QUALIFIER} \s* )?
+             )?
+            (?:  # <INLINE_KIND>
+                {COMPOUND_TYPE_KIND}
+             )
+            (?:
+                \s+
+                (?:  # <INLINE_NAME>
+                    {STRICT_IDENTIFIER}
+                 )
+             )?
+            \s* {{
+         )
+        |
+        # var decl
+        (?:
+            # We only look for static variables.
+            (?:  # <STATIC_DECL>
+                static \b
+                (?: \s* {TYPE_QUALIFIER} )?
+                \s* {_ind(TYPE_SPEC, 4)}
+                \s* {_ind(DECLARATOR, 4)}
+             )
+            \s*
+            (?:
+                (?:  # <STATIC_INIT>
+                    = \s*
+                    {_ind(INITIALIZER, 4)}
+                    \s*
+                    [,;{{]
+                 )
+                |
+                (?:  # <STATIC_ENDING>
+                    [,;]
+                 )
+             )
+         )
+        |
+        # everything else
+        (?:
+            (?:  # <DELIM_LEADING>
+                (?:
+                    [^'"{{}};]*
+                    {_ind(STRING_LITERAL, 4)}
+                 )*
+                \s* [^'"{{}};]*
+             )
+            (?:
+                (?:  # <BLOCK_OPEN>
+                    {{
+                 )
+                |
+                (?:  # <BLOCK_CLOSE>
+                    }}
+                 )
+                |
+                (?:  # <STMT_END>
+                    ;
+                 )
+             )
+         )
+     )
+    ''')
+
+
+#######################################
+# global declarations
+
+GLOBAL = textwrap.dedent(rf'''
+    (?:
+        # an empty statement
+        (?:  # <EMPTY>
+            ;
+         )
+        |
+
+        # compound type decl (maybe inline)
+        (?:
+            (?:
+                (?:  # <COMPOUND_LEADING>
+                    [^;{{}}]+?
+                 )
+                 \s*
+             )?
+            (?:  # <COMPOUND_KIND>
+                {COMPOUND_TYPE_KIND}
+             )
+            (?:
+                \s+
+                (?:  # <COMPOUND_NAME>
+                    {STRICT_IDENTIFIER}
+                 )
+             )?
+            \s* {{
+         )
+        |
+        # bogus inline decl artifact
+        # This simplifies resolving the relative syntactic ambiguity of
+        # inline structs.
+        (?:
+            (?:  # <FORWARD_KIND>
+                {COMPOUND_TYPE_KIND}
+             )
+            \s*
+            (?:  # <FORWARD_NAME>
+                {ANON_IDENTIFIER}
+             )
+            (?:  # <MAYBE_INLINE_ACTUAL>
+                [^=,;({{[*\]]*
+                [=,;({{]
+             )
+         )
+        |
+
+        # typedef
+        (?:
+            \b typedef \b \s*
+            (?:  # <TYPEDEF_DECL>
+                {_ind(VAR_DECL, 4)}
+             )
+            (?:
+                # We expect no inline type definitions in the parameters.
+                \s* [(] \s*
+                (?:  # <TYPEDEF_FUNC_PARAMS>
+                    [^{{;]*
+                 )
+                \s* [)]
+             )?
+            \s* ;
+         )
+        |
+
+        # func decl/definition & var decls
+        # XXX dedicated pattern for funcs (more restricted)?
+        (?:
+            (?:
+                (?:  # <VAR_STORAGE>
+                    {STORAGE_CLASS}
+                 )
+                \s*
+             )?
+            (?:
+                (?:  # <FUNC_INLINE>
+                    \b inline \b
+                 )
+                \s*
+             )?
+            (?:  # <VAR_DECL>
+                {_ind(VAR_DECL, 4)}
+             )
+            (?:
+                # func decl / definition
+                (?:
+                    (?:
+                        # We expect no inline type definitions in the parameters.
+                        \s* [(] \s*
+                        (?:  # <FUNC_PARAMS>
+                            [^{{;]*
+                         )
+                        \s* [)] \s*
+                        (?:  # <FUNC_DELIM>
+                            [{{;]
+                         )
+                     )
+                    |
+                    (?:
+                        # This is some old-school syntax!
+                        \s* [(] \s*
+                        # We throw away the bare names:
+                        {STRICT_IDENTIFIER}
+                        (?: \s* , \s* {STRICT_IDENTIFIER} )*
+                        \s* [)] \s*
+
+                        # We keep the trailing param declarations:
+                        (?:  # <FUNC_LEGACY_PARAMS>
+                            # There's at least one!
+                            (?: {TYPE_QUALIFIER} \s* )?
+                            {_ind(TYPE_SPEC, 7)}
+                            \s*
+                            {_ind(DECLARATOR, 7)}
+                            \s* ;
+                            (?:
+                                \s*
+                                (?: {TYPE_QUALIFIER} \s* )?
+                                {_ind(TYPE_SPEC, 8)}
+                                \s*
+                                {_ind(DECLARATOR, 8)}
+                                \s* ;
+                             )*
+                         )
+                        \s* {{
+                     )
+                 )
+                |
+                # var / typedef
+                (?:
+                    (?:
+                        # initializer
+                        # We expect only basic initializers.
+                        \s* = \s*
+                        (?:  # <VAR_INIT>
+                            {_ind(INITIALIZER, 6)}
+                         )
+                     )?
+                    \s*
+                    (?:  # <VAR_ENDING>
+                        [,;]
+                     )
+                 )
+             )
+         )
+     )
+    ''')
diff --git a/Tools/c-analyzer/c_parser/preprocessor/__init__.py b/Tools/c-analyzer/c_parser/preprocessor/__init__.py
new file mode 100644
index 0000000..e38176f
--- /dev/null
+++ b/Tools/c-analyzer/c_parser/preprocessor/__init__.py
@@ -0,0 +1,190 @@
+import contextlib
+import distutils.ccompiler
+import logging
+import os.path
+
+from c_common.fsutil import match_glob as _match_glob
+from c_common.tables import parse_table as _parse_table
+from ..source import (
+    resolve as _resolve_source,
+    good_file as _good_file,
+)
+from . import errors as _errors
+from . import (
+    pure as _pure,
+    gcc as _gcc,
+)
+
+
+logger = logging.getLogger(__name__)
+
+
+# Supported "source":
+#  * filename (string)
+#  * lines (iterable)
+#  * text (string)
+# Supported return values:
+#  * iterator of SourceLine
+#  * sequence of SourceLine
+#  * text (string)
+#  * something that combines all those
+# XXX Add the missing support from above.
+# XXX Add more low-level functions to handle permutations?
+
+def preprocess(source, *,
+               incldirs=None,
+               macros=None,
+               samefiles=None,
+               filename=None,
+               tool=True,
+               ):
+    """...
+
+    CWD should be the project root and "source" should be relative.
+    """
+    if tool:
+        logger.debug(f'CWD: {os.getcwd()!r}')
+        logger.debug(f'incldirs: {incldirs!r}')
+        logger.debug(f'macros: {macros!r}')
+        logger.debug(f'samefiles: {samefiles!r}')
+        _preprocess = _get_preprocessor(tool)
+        with _good_file(source, filename) as source:
+            return _preprocess(source, incldirs, macros, samefiles) or ()
+    else:
+        source, filename = _resolve_source(source, filename)
+        # We ignore "includes", "macros", etc.
+        return _pure.preprocess(source, filename)
+
+    # if _run() returns just the lines:
+#    text = _run(source)
+#    lines = [line + os.linesep for line in text.splitlines()]
+#    lines[-1] = lines[-1].splitlines()[0]
+#
+#    conditions = None
+#    for lno, line in enumerate(lines, 1):
+#        kind = 'source'
+#        directive = None
+#        data = line
+#        yield lno, kind, data, conditions
+
+
+def get_preprocessor(*,
+                     file_macros=None,
+                     file_incldirs=None,
+                     file_same=None,
+                     ignore_exc=False,
+                     log_err=None,
+                     ):
+    _preprocess = preprocess
+    if file_macros:
+        file_macros = tuple(_parse_macros(file_macros))
+    if file_incldirs:
+        file_incldirs = tuple(_parse_incldirs(file_incldirs))
+    if file_same:
+        file_same = tuple(file_same)
+    if not callable(ignore_exc):
+        ignore_exc = (lambda exc, _ig=ignore_exc: _ig)
+
+    def get_file_preprocessor(filename):
+        filename = filename.strip()
+        if file_macros:
+            macros = list(_resolve_file_values(filename, file_macros))
+        if file_incldirs:
+            incldirs = [v for v, in _resolve_file_values(filename, file_incldirs)]
+
+        def preprocess(**kwargs):
+            if file_macros and 'macros' not in kwargs:
+                kwargs['macros'] = macros
+            if file_incldirs and 'incldirs' not in kwargs:
+                kwargs['incldirs'] = [v for v, in _resolve_file_values(filename, file_incldirs)]
+            if file_same and 'file_same' not in kwargs:
+                kwargs['samefiles'] = file_same
+            kwargs.setdefault('filename', filename)
+            with handling_errors(ignore_exc, log_err=log_err):
+                return _preprocess(filename, **kwargs)
+        return preprocess
+    return get_file_preprocessor
+
+
+def _resolve_file_values(filename, file_values):
+    # We expect the filename and all patterns to be absolute paths.
+    for pattern, *value in file_values or ():
+        if _match_glob(filename, pattern):
+            yield value
+
+
+def _parse_macros(macros):
+    for row, srcfile in _parse_table(macros, '\t', 'glob\tname\tvalue', rawsep='=', default=None):
+        yield row
+
+
+def _parse_incldirs(incldirs):
+    for row, srcfile in _parse_table(incldirs, '\t', 'glob\tdirname', default=None):
+        glob, dirname = row
+        if dirname is None:
+            # Match all files.
+            dirname = glob
+            row = ('*', dirname.strip())
+        yield row
+
+
+@contextlib.contextmanager
+def handling_errors(ignore_exc=None, *, log_err=None):
+    try:
+        yield
+    except _errors.OSMismatchError as exc:
+        if not ignore_exc(exc):
+            raise  # re-raise
+        if log_err is not None:
+            log_err(f'<OS mismatch (expected {" or ".join(exc.expected)})>')
+        return None
+    except _errors.MissingDependenciesError as exc:
+        if not ignore_exc(exc):
+            raise  # re-raise
+        if log_err is not None:
+            log_err(f'<missing dependency {exc.missing}')
+        return None
+    except _errors.ErrorDirectiveError as exc:
+        if not ignore_exc(exc):
+            raise  # re-raise
+        if log_err is not None:
+            log_err(exc)
+        return None
+
+
+##################################
+# tools
+
+_COMPILERS = {
+    # matching distutils.ccompiler.compiler_class:
+    'unix': _gcc.preprocess,
+    'msvc': None,
+    'cygwin': None,
+    'mingw32': None,
+    'bcpp': None,
+    # aliases/extras:
+    'gcc': _gcc.preprocess,
+    'clang': None,
+}
+
+
+def _get_preprocessor(tool):
+    if tool is True:
+        tool = distutils.ccompiler.get_default_compiler()
+    preprocess = _COMPILERS.get(tool)
+    if preprocess is None:
+        raise ValueError(f'unsupported tool {tool}')
+    return preprocess
+
+
+##################################
+# aliases
+
+from .errors import (
+    PreprocessorError,
+    PreprocessorFailure,
+    ErrorDirectiveError,
+    MissingDependenciesError,
+    OSMismatchError,
+)
+from .common import FileInfo, SourceLine
diff --git a/Tools/c-analyzer/c_parser/preprocessor/__main__.py b/Tools/c-analyzer/c_parser/preprocessor/__main__.py
new file mode 100644
index 0000000..bfc6194
--- /dev/null
+++ b/Tools/c-analyzer/c_parser/preprocessor/__main__.py
@@ -0,0 +1,197 @@
+import logging
+import sys
+
+from c_common.scriptutil import (
+    CLIArgSpec as Arg,
+    add_verbosity_cli,
+    add_traceback_cli,
+    add_kind_filtering_cli,
+    add_files_cli,
+    add_failure_filtering_cli,
+    add_commands_cli,
+    process_args_by_key,
+    configure_logger,
+    get_prog,
+    main_for_filenames,
+)
+from . import (
+    errors as _errors,
+    get_preprocessor as _get_preprocessor,
+)
+
+
+FAIL = {
+    'err': _errors.ErrorDirectiveError,
+    'deps': _errors.MissingDependenciesError,
+    'os': _errors.OSMismatchError,
+}
+FAIL_DEFAULT = tuple(v for v in FAIL if v != 'os')
+
+
+logger = logging.getLogger(__name__)
+
+
+##################################
+# CLI helpers
+
+def add_common_cli(parser, *, get_preprocessor=_get_preprocessor):
+    parser.add_argument('--macros', action='append')
+    parser.add_argument('--incldirs', action='append')
+    parser.add_argument('--same', action='append')
+    process_fail_arg = add_failure_filtering_cli(parser, FAIL)
+
+    def process_args(args, *, argv):
+        ns = vars(args)
+
+        process_fail_arg(args, argv)
+        ignore_exc = ns.pop('ignore_exc')
+        # We later pass ignore_exc to _get_preprocessor().
+
+        args.get_file_preprocessor = get_preprocessor(
+            file_macros=ns.pop('macros'),
+            file_incldirs=ns.pop('incldirs'),
+            file_same=ns.pop('same'),
+            ignore_exc=ignore_exc,
+            log_err=print,
+        )
+    return process_args
+
+
+def _iter_preprocessed(filename, *,
+                       get_preprocessor,
+                       match_kind=None,
+                       pure=False,
+                       ):
+    preprocess = get_preprocessor(filename)
+    for line in preprocess(tool=not pure) or ():
+        if match_kind is not None and not match_kind(line.kind):
+            continue
+        yield line
+
+
+#######################################
+# the commands
+
+def _cli_preprocess(parser, excluded=None, **prepr_kwargs):
+    parser.add_argument('--pure', action='store_true')
+    parser.add_argument('--no-pure', dest='pure', action='store_const', const=False)
+    process_kinds = add_kind_filtering_cli(parser)
+    process_common = add_common_cli(parser, **prepr_kwargs)
+    parser.add_argument('--raw', action='store_true')
+    process_files = add_files_cli(parser, excluded=excluded)
+
+    return [
+        process_kinds,
+        process_common,
+        process_files,
+    ]
+
+
+def cmd_preprocess(filenames, *,
+                   raw=False,
+                   iter_filenames=None,
+                   **kwargs
+                   ):
+    if 'get_file_preprocessor' not in kwargs:
+        kwargs['get_file_preprocessor'] = _get_preprocessor()
+    if raw:
+        def show_file(filename, lines):
+            for line in lines:
+                print(line)
+                #print(line.raw)
+    else:
+        def show_file(filename, lines):
+            for line in lines:
+                linefile = ''
+                if line.filename != filename:
+                    linefile = f' ({line.filename})'
+                text = line.data
+                if line.kind == 'comment':
+                    text = '/* ' + line.data.splitlines()[0]
+                    text += ' */' if '\n' in line.data else r'\n... */'
+                print(f' {line.lno:>4} {line.kind:10} | {text}')
+
+    filenames = main_for_filenames(filenames, iter_filenames)
+    for filename in filenames:
+        lines = _iter_preprocessed(filename, **kwargs)
+        show_file(filename, lines)
+
+
+def _cli_data(parser):
+    ...
+
+    return None
+
+
+def cmd_data(filenames,
+             **kwargs
+             ):
+    # XXX
+    raise NotImplementedError
+
+
+COMMANDS = {
+    'preprocess': (
+        'preprocess the given C source & header files',
+        [_cli_preprocess],
+        cmd_preprocess,
+    ),
+    'data': (
+        'check/manage local data (e.g. excludes, macros)',
+        [_cli_data],
+        cmd_data,
+    ),
+}
+
+
+#######################################
+# the script
+
+def parse_args(argv=sys.argv[1:], prog=sys.argv[0], *,
+               subset='preprocess',
+               excluded=None,
+               **prepr_kwargs
+               ):
+    import argparse
+    parser = argparse.ArgumentParser(
+        prog=prog or get_prog(),
+    )
+
+    processors = add_commands_cli(
+        parser,
+        commands={k: v[1] for k, v in COMMANDS.items()},
+        commonspecs=[
+            add_verbosity_cli,
+            add_traceback_cli,
+        ],
+        subset=subset,
+    )
+
+    args = parser.parse_args(argv)
+    ns = vars(args)
+
+    cmd = ns.pop('cmd')
+
+    verbosity, traceback_cm = process_args_by_key(
+        args,
+        argv,
+        processors[cmd],
+        ['verbosity', 'traceback_cm'],
+    )
+
+    return cmd, ns, verbosity, traceback_cm
+
+
+def main(cmd, cmd_kwargs):
+    try:
+        run_cmd = COMMANDS[cmd][0]
+    except KeyError:
+        raise ValueError(f'unsupported cmd {cmd!r}')
+    run_cmd(**cmd_kwargs)
+
+
+if __name__ == '__main__':
+    cmd, cmd_kwargs, verbosity, traceback_cm = parse_args()
+    configure_logger(verbosity)
+    with traceback_cm:
+        main(cmd, cmd_kwargs)
diff --git a/Tools/c-analyzer/c_parser/preprocessor/common.py b/Tools/c-analyzer/c_parser/preprocessor/common.py
new file mode 100644
index 0000000..6368102
--- /dev/null
+++ b/Tools/c-analyzer/c_parser/preprocessor/common.py
@@ -0,0 +1,173 @@
+import contextlib
+import distutils.ccompiler
+import logging
+import shlex
+import subprocess
+import sys
+
+from ..info import FileInfo, SourceLine
+from .errors import (
+    PreprocessorFailure,
+    ErrorDirectiveError,
+    MissingDependenciesError,
+    OSMismatchError,
+)
+
+
+logger = logging.getLogger(__name__)
+
+
+# XXX Add aggregate "source" class(es)?
+#  * expose all lines as single text string
+#  * expose all lines as sequence
+#  * iterate all lines
+
+
+def run_cmd(argv, *,
+            #capture_output=True,
+            stdout=subprocess.PIPE,
+            #stderr=subprocess.STDOUT,
+            stderr=subprocess.PIPE,
+            text=True,
+            check=True,
+            **kwargs
+            ):
+    if isinstance(stderr, str) and stderr.lower() == 'stdout':
+        stderr = subprocess.STDOUT
+
+    kw = dict(locals())
+    kw.pop('argv')
+    kw.pop('kwargs')
+    kwargs.update(kw)
+
+    proc = subprocess.run(argv, **kwargs)
+    return proc.stdout
+
+
+def preprocess(tool, filename, **kwargs):
+    argv = _build_argv(tool, filename, **kwargs)
+    logger.debug(' '.join(shlex.quote(v) for v in argv))
+
+    # Make sure the OS is supported for this file.
+    if (_expected := is_os_mismatch(filename)):
+        error = None
+        raise OSMismatchError(filename, _expected, argv, error, TOOL)
+
+    # Run the command.
+    with converted_error(tool, argv, filename):
+        # We use subprocess directly here, instead of calling the
+        # distutil compiler object's preprocess() method, since that
+        # one writes to stdout/stderr and it's simpler to do it directly
+        # through subprocess.
+        return run_cmd(argv)
+
+
+def _build_argv(
+    tool,
+    filename,
+    incldirs=None,
+    macros=None,
+    preargs=None,
+    postargs=None,
+    executable=None,
+    compiler=None,
+):
+    compiler = distutils.ccompiler.new_compiler(
+        compiler=compiler or tool,
+    )
+    if executable:
+        compiler.set_executable('preprocessor', executable)
+
+    argv = None
+    def _spawn(_argv):
+        nonlocal argv
+        argv = _argv
+    compiler.spawn = _spawn
+    compiler.preprocess(
+        filename,
+        macros=[tuple(v) for v in macros or ()],
+        include_dirs=incldirs or (),
+        extra_preargs=preargs or (),
+        extra_postargs=postargs or (),
+    )
+    return argv
+
+
+@contextlib.contextmanager
+def converted_error(tool, argv, filename):
+    try:
+        yield
+    except subprocess.CalledProcessError as exc:
+        convert_error(
+            tool,
+            argv,
+            filename,
+            exc.stderr,
+            exc.returncode,
+        )
+
+
+def convert_error(tool, argv, filename, stderr, rc):
+    error = (stderr.splitlines()[0], rc)
+    if (_expected := is_os_mismatch(filename, stderr)):
+        logger.debug(stderr.strip())
+        raise OSMismatchError(filename, _expected, argv, error, tool)
+    elif (_missing := is_missing_dep(stderr)):
+        logger.debug(stderr.strip())
+        raise MissingDependenciesError(filename, (_missing,), argv, error, tool)
+    elif '#error' in stderr:
+        # XXX Ignore incompatible files.
+        error = (stderr.splitlines()[1], rc)
+        logger.debug(stderr.strip())
+        raise ErrorDirectiveError(filename, argv, error, tool)
+    else:
+        # Try one more time, with stderr written to the terminal.
+        try:
+            output = run_cmd(argv, stderr=None)
+        except subprocess.CalledProcessError:
+            raise PreprocessorFailure(filename, argv, error, tool)
+
+
+def is_os_mismatch(filename, errtext=None):
+    # See: https://docs.python.org/3/library/sys.html#sys.platform
+    actual = sys.platform
+    if actual == 'unknown':
+        raise NotImplementedError
+
+    if errtext is not None:
+        if (missing := is_missing_dep(errtext)):
+            matching = get_matching_oses(missing, filename)
+            if actual not in matching:
+                return matching
+    return False
+
+
+def get_matching_oses(missing, filename):
+    # OSX
+    if 'darwin' in filename or 'osx' in filename:
+        return ('darwin',)
+    elif missing == 'SystemConfiguration/SystemConfiguration.h':
+        return ('darwin',)
+
+    # Windows
+    elif missing in ('windows.h', 'winsock2.h'):
+        return ('win32',)
+
+    # other
+    elif missing == 'sys/ldr.h':
+        return ('aix',)
+    elif missing == 'dl.h':
+        # XXX The existence of Python/dynload_dl.c implies others...
+        # Note that hpux isn't actual supported any more.
+        return ('hpux', '???')
+
+    # unrecognized
+    else:
+        return ()
+
+
+def is_missing_dep(errtext):
+    if 'No such file or directory' in errtext:
+        missing = errtext.split(': No such file or directory')[0].split()[-1]
+        return missing
+    return False
diff --git a/Tools/c-analyzer/c_parser/preprocessor/errors.py b/Tools/c-analyzer/c_parser/preprocessor/errors.py
new file mode 100644
index 0000000..9b66801
--- /dev/null
+++ b/Tools/c-analyzer/c_parser/preprocessor/errors.py
@@ -0,0 +1,110 @@
+import sys
+
+
+OS = sys.platform
+
+
+def _as_tuple(items):
+    if isinstance(items, str):
+        return tuple(items.strip().replace(',', ' ').split())
+    elif items:
+        return tuple(items)
+    else:
+        return ()
+
+
+class PreprocessorError(Exception):
+    """Something preprocessor-related went wrong."""
+
+    @classmethod
+    def _msg(cls, filename, reason, **ignored):
+        msg = 'failure while preprocessing'
+        if reason:
+            msg = f'{msg} ({reason})'
+        return msg
+
+    def __init__(self, filename, preprocessor=None, reason=None):
+        if isinstance(reason, str):
+            reason = reason.strip()
+
+        self.filename = filename
+        self.preprocessor = preprocessor or None
+        self.reason = str(reason) if reason else None
+
+        msg = self._msg(**vars(self))
+        msg = f'({filename}) {msg}'
+        if preprocessor:
+            msg = f'[{preprocessor}] {msg}'
+        super().__init__(msg)
+
+
+class PreprocessorFailure(PreprocessorError):
+    """The preprocessor command failed."""
+
+    @classmethod
+    def _msg(cls, error, **ignored):
+        msg = 'preprocessor command failed'
+        if error:
+            msg = f'{msg} {error}'
+        return msg
+
+    def __init__(self, filename, argv, error=None, preprocessor=None):
+        exitcode = -1
+        if isinstance(error, tuple):
+            if len(error) == 2:
+                error, exitcode = error
+            else:
+                error = str(error)
+        if isinstance(error, str):
+            error = error.strip()
+
+        self.argv = _as_tuple(argv) or None
+        self.error = error if error else None
+        self.exitcode = exitcode
+
+        reason = str(self.error)
+        super().__init__(filename, preprocessor, reason)
+
+
+class ErrorDirectiveError(PreprocessorFailure):
+    """The file hit a #error directive."""
+
+    @classmethod
+    def _msg(cls, error, **ignored):
+        return f'#error directive hit ({error})'
+
+    def __init__(self, filename, argv, error, *args, **kwargs):
+        super().__init__(filename, argv, error, *args, **kwargs)
+
+
+class MissingDependenciesError(PreprocessorFailure):
+    """The preprocessor did not have access to all the target's dependencies."""
+
+    @classmethod
+    def _msg(cls, missing, **ignored):
+        msg = 'preprocessing failed due to missing dependencies'
+        if missing:
+            msg = f'{msg} ({", ".join(missing)})'
+        return msg
+
+    def __init__(self, filename, missing=None, *args, **kwargs):
+        self.missing = _as_tuple(missing) or None
+
+        super().__init__(filename, *args, **kwargs)
+
+
+class OSMismatchError(MissingDependenciesError):
+    """The target is not compatible with the host OS."""
+
+    @classmethod
+    def _msg(cls, expected, **ignored):
+        return f'OS is {OS} but expected {expected or "???"}'
+
+    def __init__(self, filename, expected=None, *args, **kwargs):
+        if isinstance(expected, str):
+            expected = expected.strip()
+
+        self.actual = OS
+        self.expected = expected if expected else None
+
+        super().__init__(filename, None, *args, **kwargs)
diff --git a/Tools/c-analyzer/c_parser/preprocessor/gcc.py b/Tools/c-analyzer/c_parser/preprocessor/gcc.py
new file mode 100644
index 0000000..bb404a4
--- /dev/null
+++ b/Tools/c-analyzer/c_parser/preprocessor/gcc.py
@@ -0,0 +1,123 @@
+import os.path
+import re
+
+from . import common as _common
+
+
+TOOL = 'gcc'
+
+# https://gcc.gnu.org/onlinedocs/cpp/Preprocessor-Output.html
+LINE_MARKER_RE = re.compile(r'^# (\d+) "([^"]+)"(?: [1234])*$')
+PREPROC_DIRECTIVE_RE = re.compile(r'^\s*#\s*(\w+)\b.*')
+COMPILER_DIRECTIVE_RE = re.compile(r'''
+    ^
+    (.*?)  # <before>
+    (__\w+__)  # <directive>
+    \s*
+    [(] [(]
+    (
+        [^()]*
+        (?:
+            [(]
+            [^()]*
+            [)]
+            [^()]*
+         )*
+     )  # <args>
+    ( [)] [)] )?  # <closed>
+''', re.VERBOSE)
+
+POST_ARGS = (
+    '-pthread',
+    '-std=c99',
+    #'-g',
+    #'-Og',
+    #'-Wno-unused-result',
+    #'-Wsign-compare',
+    #'-Wall',
+    #'-Wextra',
+    '-E',
+)
+
+
+def preprocess(filename, incldirs=None, macros=None, samefiles=None):
+    text = _common.preprocess(
+        TOOL,
+        filename,
+        incldirs=incldirs,
+        macros=macros,
+        #preargs=PRE_ARGS,
+        postargs=POST_ARGS,
+        executable=['gcc'],
+        compiler='unix',
+    )
+    return _iter_lines(text, filename, samefiles)
+
+
+def _iter_lines(text, filename, samefiles, *, raw=False):
+    lines = iter(text.splitlines())
+
+    # Build the lines and filter out directives.
+    partial = 0  # depth
+    origfile = None
+    for line in lines:
+        m = LINE_MARKER_RE.match(line)
+        if m:
+            lno, origfile = m.groups()
+            lno = int(lno)
+        elif _filter_orig_file(origfile, filename, samefiles):
+            if (m := PREPROC_DIRECTIVE_RE.match(line)):
+                name, = m.groups()
+                if name != 'pragma':
+                    raise Exception(line)
+            else:
+                if not raw:
+                    line, partial = _strip_directives(line, partial=partial)
+                yield _common.SourceLine(
+                    _common.FileInfo(filename, lno),
+                    'source',
+                    line or '',
+                    None,
+                )
+            lno += 1
+
+
+def _strip_directives(line, partial=0):
+    # We assume there are no string literals with parens in directive bodies.
+    while partial > 0:
+        if not (m := re.match(r'[^{}]*([()])', line)):
+            return None, partial
+        delim, = m.groups()
+        partial += 1 if delim == '(' else -1  # opened/closed
+        line = line[m.end():]
+
+    line = re.sub(r'__extension__', '', line)
+
+    while (m := COMPILER_DIRECTIVE_RE.match(line)):
+        before, _, _, closed = m.groups()
+        if closed:
+            line = f'{before} {line[m.end():]}'
+        else:
+            after, partial = _strip_directives(line[m.end():], 2)
+            line = f'{before} {after or ""}'
+            if partial:
+                break
+
+    return line, partial
+
+
+def _filter_orig_file(origfile, current, samefiles):
+    if origfile == current:
+        return True
+    if origfile == '<stdin>':
+        return True
+    if os.path.isabs(origfile):
+        return False
+
+    for filename in samefiles or ():
+        if filename.endswith(os.path.sep):
+            filename += os.path.basename(current)
+        if origfile == filename:
+            return True
+
+    return False
diff --git a/Tools/c-analyzer/c_parser/preprocessor/pure.py b/Tools/c-analyzer/c_parser/preprocessor/pure.py
new file mode 100644
index 0000000..e971389
--- /dev/null
+++ b/Tools/c-analyzer/c_parser/preprocessor/pure.py
@@ -0,0 +1,23 @@
+from ..source import (
+    opened as _open_source,
+)
+from . import common as _common
+
+
+def preprocess(lines, filename=None):
+    if isinstance(lines, str):
+        with _open_source(lines, filename) as (lines, filename):
+            yield from preprocess(lines, filename)
+        return
+
+    # XXX actually preprocess...
+    for lno, line in enumerate(lines, 1):
+        kind = 'source'
+        data = line
+        conditions = None
+        yield _common.SourceLine(
+            _common.FileInfo(filename, lno),
+            kind,
+            data,
+            conditions,
+        )
diff --git a/Tools/c-analyzer/c_parser/source.py b/Tools/c-analyzer/c_parser/source.py
new file mode 100644
index 0000000..30a09ee
--- /dev/null
+++ b/Tools/c-analyzer/c_parser/source.py
@@ -0,0 +1,64 @@
+import contextlib
+import os.path
+
+
+def resolve(source, filename):
+    if _looks_like_filename(source):
+        return _resolve_filename(source, filename)
+
+    if isinstance(source, str):
+        source = source.splitlines()
+
+    # At this point "source" is not a str.
+    if not filename:
+        filename = None
+    elif not isinstance(filename, str):
+        raise TypeError(f'filename should be str (or None), got {filename!r}')
+    else:
+        filename, _ = _resolve_filename(filename)
+    return source, filename
+
+
+@contextlib.contextmanager
+def good_file(filename, alt=None):
+    if not _looks_like_filename(filename):
+        raise ValueError(f'expected a filename, got {filename}')
+    filename, _ = _resolve_filename(filename, alt)
+    try:
+        yield filename
+    except Exception:
+        if not os.path.exists(filename):
+            raise FileNotFoundError(f'file not found: {filename}')
+        raise  # re-raise
+
+
+def _looks_like_filename(value):
+    if not isinstance(value, str):
+        return False
+    return value.endswith(('.c', '.h'))
+
+
+def _resolve_filename(filename, alt=None):
+    if os.path.isabs(filename):
+        ...
+#        raise NotImplementedError
+    else:
+        filename = os.path.join('.', filename)
+
+    if not alt:
+        alt = filename
+    elif os.path.abspath(filename) == os.path.abspath(alt):
+        alt = filename
+    else:
+        raise ValueError(f'mismatch: {filename} != {alt}')
+    return filename, alt
+
+
+@contextlib.contextmanager
+def opened(source, filename=None):
+    source, filename = resolve(source, filename)
+    if isinstance(source, str):
+        with open(source) as srcfile:
+            yield srcfile, filename
+    else:
+        yield source, filename
diff --git a/Tools/c-analyzer/check-c-globals.py b/Tools/c-analyzer/check-c-globals.py
index 1371f92..b1364a6 100644
--- a/Tools/c-analyzer/check-c-globals.py
+++ b/Tools/c-analyzer/check-c-globals.py
@@ -1,448 +1,36 @@
+from cpython.__main__ import main, configure_logger
 
-from collections import namedtuple
-import glob
-import os.path
-import re
-import shutil
-import sys
-import subprocess
 
-
-VERBOSITY = 2
-
-C_GLOBALS_DIR = os.path.abspath(os.path.dirname(__file__))
-TOOLS_DIR = os.path.dirname(C_GLOBALS_DIR)
-ROOT_DIR = os.path.dirname(TOOLS_DIR)
-GLOBALS_FILE = os.path.join(C_GLOBALS_DIR, 'ignored-globals.txt')
-
-SOURCE_DIRS = ['Include', 'Objects', 'Modules', 'Parser', 'Python']
-
-CAPI_REGEX = re.compile(r'^ *PyAPI_DATA\([^)]*\) \W*(_?Py\w+(?:, \w+)*\w).*;.*$')
-
-
-IGNORED_VARS = {
-        '_DYNAMIC',
-        '_GLOBAL_OFFSET_TABLE_',
-        '__JCR_LIST__',
-        '__JCR_END__',
-        '__TMC_END__',
-        '__bss_start',
-        '__data_start',
-        '__dso_handle',
-        '_edata',
-        '_end',
-        }
-
-
-def find_capi_vars(root):
-    capi_vars = {}
-    for dirname in SOURCE_DIRS:
-        for filename in glob.glob(os.path.join(
-                                  glob.escape(os.path.join(ROOT_DIR, dirname)),
-                                  '**/*.[hc]'),
-                                  recursive=True):
-            with open(filename) as file:
-                for name in _find_capi_vars(file):
-                    if name in capi_vars:
-                        assert not filename.endswith('.c')
-                        assert capi_vars[name].endswith('.c')
-                    capi_vars[name] = filename
-    return capi_vars
-
-
-def _find_capi_vars(lines):
-    for line in lines:
-        if not line.startswith('PyAPI_DATA'):
-            continue
-        assert '{' not in line
-        match = CAPI_REGEX.match(line)
-        assert match
-        names, = match.groups()
-        for name in names.split(', '):
-            yield name
-
-
-def _read_global_names(filename):
-    # These variables are shared between all interpreters in the process.
-    with open(filename) as file:
-        return {line.partition('#')[0].strip()
-                for line in file
-                if line.strip() and not line.startswith('#')}
-
-
-def _is_global_var(name, globalnames):
-    if _is_autogen_var(name):
-        return True
-    if _is_type_var(name):
-        return True
-    if _is_module(name):
-        return True
-    if _is_exception(name):
-        return True
-    if _is_compiler(name):
-        return True
-    return name in globalnames
-
-
-def _is_autogen_var(name):
-    return (
-        name.startswith('PyId_') or
-        '.' in name or
-        # Objects/typeobject.c
-        name.startswith('op_id.') or
-        name.startswith('rop_id.') or
-        # Python/graminit.c
-        name.startswith('arcs_') or
-        name.startswith('states_')
-        )
-
-
-def _is_type_var(name):
-    if name.endswith(('Type', '_Type', '_type')):  # XXX Always a static type?
-        return True
-    if name.endswith('_desc'):  # for structseq types
-        return True
-    return (
-        name.startswith('doc_') or
-        name.endswith(('_doc', '__doc__', '_docstring')) or
-        name.endswith('_methods') or
-        name.endswith('_fields') or
-        name.endswith(('_memberlist', '_members')) or
-        name.endswith('_slots') or
-        name.endswith(('_getset', '_getsets', '_getsetlist')) or
-        name.endswith('_as_mapping') or
-        name.endswith('_as_number') or
-        name.endswith('_as_sequence') or
-        name.endswith('_as_buffer') or
-        name.endswith('_as_async')
-        )
-
-
-def _is_module(name):
-    if name.endswith(('_functions', 'Methods', '_Methods')):
-        return True
-    if name == 'module_def':
-        return True
-    if name == 'initialized':
-        return True
-    return name.endswith(('module', '_Module'))
-
-
-def _is_exception(name):
-    # Other vars are enumerated in globals-core.txt.
-    if not name.startswith(('PyExc_', '_PyExc_')):
-        return False
-    return name.endswith(('Error', 'Warning'))
-
-
-def _is_compiler(name):
-    return (
-        # Python/Python-ast.c
-        name.endswith('_type') or
-        name.endswith('_singleton') or
-        name.endswith('_attributes')
-        )
-
-
-class Var(namedtuple('Var', 'name kind scope capi filename')):
-
-    @classmethod
-    def parse_nm(cls, line, expected, ignored, capi_vars, globalnames):
-        _, _, line = line.partition(' ')  # strip off the address
-        line = line.strip()
-        kind, _, line = line.partition(' ')
-        if kind in ignored or ():
-            return None
-        elif kind not in expected or ():
-            raise RuntimeError('unsupported NM type {!r}'.format(kind))
-
-        name, _, filename = line.partition('\t')
-        name = name.strip()
-        if _is_autogen_var(name):
-            return None
-        if _is_global_var(name, globalnames):
-            scope = 'global'
-        else:
-            scope = None
-        capi = (name in capi_vars or ())
-        if filename:
-            filename = os.path.relpath(filename.partition(':')[0])
-        return cls(name, kind, scope, capi, filename or '~???~')
-
-    @property
-    def external(self):
-        return self.kind.isupper()
-
-
-def find_vars(root, globals_filename=GLOBALS_FILE):
-    python = os.path.join(root, 'python')
-    if not os.path.exists(python):
-        raise RuntimeError('python binary missing (need to build it first?)')
-    capi_vars = find_capi_vars(root)
-    globalnames = _read_global_names(globals_filename)
-
-    nm = shutil.which('nm')
-    if nm is None:
-        # XXX Use dumpbin.exe /SYMBOLS on Windows.
-        raise NotImplementedError
-    else:
-        yield from (var
-                    for var in _find_var_symbols(python, nm, capi_vars,
-                                                 globalnames)
-                    if var.name not in IGNORED_VARS)
-
-
-NM_FUNCS = set('Tt')
-NM_PUBLIC_VARS = set('BD')
-NM_PRIVATE_VARS = set('bd')
-NM_VARS = NM_PUBLIC_VARS | NM_PRIVATE_VARS
-NM_DATA = set('Rr')
-NM_OTHER = set('ACGgiINpSsuUVvWw-?')
-NM_IGNORED = NM_FUNCS | NM_DATA | NM_OTHER
-
-
-def _find_var_symbols(python, nm, capi_vars, globalnames):
-    args = [nm,
-            '--line-numbers',
-            python]
-    out = subprocess.check_output(args)
-    for line in out.decode('utf-8').splitlines():
-        var = Var.parse_nm(line, NM_VARS, NM_IGNORED, capi_vars, globalnames)
-        if var is None:
-            continue
-        yield var
-
-
-#######################################
-
-class Filter(namedtuple('Filter', 'name op value action')):
-
-    @classmethod
-    def parse(cls, raw):
-        action = '+'
-        if raw.startswith(('+', '-')):
-            action = raw[0]
-            raw = raw[1:]
-        # XXX Support < and >?
-        name, op, value = raw.partition('=')
-        return cls(name, op, value, action)
-
-    def check(self, var):
-        value = getattr(var, self.name, None)
-        if not self.op:
-            matched = bool(value)
-        elif self.op == '=':
-            matched = (value == self.value)
-        else:
-            raise NotImplementedError
-
-        if self.action == '+':
-            return matched
-        elif self.action == '-':
-            return not matched
-        else:
-            raise NotImplementedError
-
-
-def filter_var(var, filters):
-    for filter in filters:
-        if not filter.check(var):
-            return False
-    return True
-
-
-def make_sort_key(spec):
-    columns = [(col.strip('_'), '_' if col.startswith('_') else '')
-               for col in spec]
-    def sort_key(var):
-        return tuple(getattr(var, col).lstrip(prefix)
-                     for col, prefix in columns)
-    return sort_key
-
-
-def make_groups(allvars, spec):
-    group = spec
-    groups = {}
-    for var in allvars:
-        value = getattr(var, group)
-        key = '{}: {}'.format(group, value)
-        try:
-            groupvars = groups[key]
-        except KeyError:
-            groupvars = groups[key] = []
-        groupvars.append(var)
-    return groups
-
-
-def format_groups(groups, columns, fmts, widths):
-    for group in sorted(groups):
-        groupvars = groups[group]
-        yield '', 0
-        yield '  # {}'.format(group), 0
-        yield from format_vars(groupvars, columns, fmts, widths)
-
-
-def format_vars(allvars, columns, fmts, widths):
-    fmt = ' '.join(fmts[col] for col in columns)
-    fmt = ' ' + fmt.replace(' ', '   ') + ' '  # for div margin
-    header = fmt.replace(':', ':^').format(*(col.upper() for col in columns))
-    yield header, 0
-    div = ' '.join('-'*(widths[col]+2) for col in columns)
-    yield div, 0
-    for var in allvars:
-        values = (getattr(var, col) for col in columns)
-        row = fmt.format(*('X' if val is True else val or ''
-                           for val in values))
-        yield row, 1
-    yield div, 0
-
-
-#######################################
-
-COLUMNS = 'name,external,capi,scope,filename'
-COLUMN_NAMES = COLUMNS.split(',')
-
-COLUMN_WIDTHS = {col: len(col)
-                 for col in COLUMN_NAMES}
-COLUMN_WIDTHS.update({
-        'name': 50,
-        'scope': 7,
-        'filename': 40,
-        })
-COLUMN_FORMATS = {col: '{:%s}' % width
-                  for col, width in COLUMN_WIDTHS.items()}
-for col in COLUMN_FORMATS:
-    if COLUMN_WIDTHS[col] == len(col):
-        COLUMN_FORMATS[col] = COLUMN_FORMATS[col].replace(':', ':^')
-
-
-def _parse_filters_arg(raw, error):
-    filters = []
-    for value in raw.split(','):
-        value=value.strip()
-        if not value:
-            continue
-        try:
-            filter = Filter.parse(value)
-            if filter.name not in COLUMN_NAMES:
-                raise Exception('unsupported column {!r}'.format(filter.name))
-        except Exception as e:
-            error('bad filter {!r}: {}'.format(raw, e))
-        filters.append(filter)
-    return filters
-
-
-def _parse_columns_arg(raw, error):
-    columns = raw.split(',')
-    for column in columns:
-        if column not in COLUMN_NAMES:
-            error('unsupported column {!r}'.format(column))
-    return columns
-
-
-def _parse_sort_arg(raw, error):
-    sort = raw.split(',')
-    for column in sort:
-        if column.lstrip('_') not in COLUMN_NAMES:
-            error('unsupported column {!r}'.format(column))
-    return sort
-
-
-def _parse_group_arg(raw, error):
-    if not raw:
-        return raw
-    group = raw
-    if group not in COLUMN_NAMES:
-        error('unsupported column {!r}'.format(group))
-    if group != 'filename':
-        error('unsupported group {!r}'.format(group))
-    return group
-
-
-def parse_args(argv=None):
-    if argv is None:
-        argv = sys.argv[1:]
-
+def parse_args():
     import argparse
+    from c_common.scriptutil import (
+        add_verbosity_cli,
+        add_traceback_cli,
+        process_args_by_key,
+    )
+    from cpython.__main__ import _cli_check
     parser = argparse.ArgumentParser()
+    processors = [
+        add_verbosity_cli(parser),
+        add_traceback_cli(parser),
+        _cli_check(parser, checks='<globals>'),
+    ]
 
-    parser.add_argument('-v', '--verbose', action='count', default=0)
-    parser.add_argument('-q', '--quiet', action='count', default=0)
+    args = parser.parse_args()
+    ns = vars(args)
 
-    parser.add_argument('--filters', default='-scope',
-                        help='[[-]<COLUMN>[=<GLOB>]] ...')
+    cmd = 'check'
+    verbosity, traceback_cm = process_args_by_key(
+        args,
+        argv,
+        processors,
+        ['verbosity', 'traceback_cm'],
+    )
 
-    parser.add_argument('--columns', default=COLUMNS,
-                        help='a comma-separated list of columns to show')
-    parser.add_argument('--sort', default='filename,_name',
-                        help='a comma-separated list of columns to sort')
-    parser.add_argument('--group',
-                        help='group by the given column name (- to not group)')
-
-    parser.add_argument('--rc-on-match', dest='rc', type=int)
-
-    parser.add_argument('filename', nargs='?', default=GLOBALS_FILE)
-
-    args = parser.parse_args(argv)
-
-    verbose = vars(args).pop('verbose', 0)
-    quiet = vars(args).pop('quiet', 0)
-    args.verbosity = max(0, VERBOSITY + verbose - quiet)
-
-    if args.sort.startswith('filename') and not args.group:
-        args.group = 'filename'
-
-    if args.rc is None:
-        if '-scope=core' in args.filters or 'core' not in args.filters:
-            args.rc = 0
-        else:
-            args.rc = 1
-
-    args.filters = _parse_filters_arg(args.filters, parser.error)
-    args.columns = _parse_columns_arg(args.columns, parser.error)
-    args.sort = _parse_sort_arg(args.sort, parser.error)
-    args.group = _parse_group_arg(args.group, parser.error)
-
-    return args
+    return cmd, ns, verbosity, traceback_cm
 
 
-def main(root=ROOT_DIR, filename=GLOBALS_FILE,
-         filters=None, columns=COLUMN_NAMES, sort=None, group=None,
-         verbosity=VERBOSITY, rc=1):
-
-    log = lambda msg: ...
-    if verbosity >= 2:
-        log = lambda msg: print(msg)
-
-    allvars = (var
-               for var in find_vars(root, filename)
-               if filter_var(var, filters))
-    if sort:
-        allvars = sorted(allvars, key=make_sort_key(sort))
-
-    if group:
-        try:
-            columns.remove(group)
-        except ValueError:
-            pass
-        grouped = make_groups(allvars, group)
-        lines = format_groups(grouped, columns, COLUMN_FORMATS, COLUMN_WIDTHS)
-    else:
-        lines = format_vars(allvars, columns, COLUMN_FORMATS, COLUMN_WIDTHS)
-
-    total = 0
-    for line, count in lines:
-        total += count
-        log(line)
-    log('\ntotal: {}'.format(total))
-
-    if total and rc:
-        print('ERROR: found unsafe globals', file=sys.stderr)
-        return rc
-    return 0
-
-
-if __name__ == '__main__':
-    args = parse_args()
-    sys.exit(
-            main(**vars(args)))
+(cmd, cmd_kwargs, verbosity, traceback_cm) = parse_args()
+configure_logger(verbosity)
+with traceback_cm:
+    main(cmd, cmd_kwargs)
diff --git a/Tools/c-analyzer/cpython/README b/Tools/c-analyzer/cpython/README
deleted file mode 100644
index 772b8be..0000000
--- a/Tools/c-analyzer/cpython/README
+++ /dev/null
@@ -1,72 +0,0 @@
-#######################################
-# C Globals and CPython Runtime State.
-
-CPython's C code makes extensive use of global variables (whether static
-globals or static locals).  Each such variable falls into one of several
-categories:
-
-* strictly const data
-* used exclusively in main or in the REPL
-* process-global state (e.g. managing process-level resources
-  like signals and file descriptors)
-* Python "global" runtime state
-* per-interpreter runtime state
-
-The last one can be a problem as soon as anyone creates a second
-interpreter (AKA "subinterpreter") in a process.  It is definitely a
-problem under subinterpreters if they are no longer sharing the GIL,
-since the GIL protects us from a lot of race conditions.  Keep in mind
-that ultimately *all* objects (PyObject) should be treated as
-per-interpreter state.  This includes "static types", freelists,
-_PyIdentifier, and singletons.  Take that in for a second.  It has
-significant implications on where we use static variables!
-
-Be aware that module-global state (stored in C statics) is a kind of
-per-interpreter state.  There have been efforts across many years, and
-still going, to provide extension module authors mechanisms to store
-that state safely (see PEPs 3121, 489, etc.).
-
-(Note that there has been discussion around support for running multiple
-Python runtimes in the same process.  That would ends up with the same
-problems, relative to static variables, that subinterpreters have.)
-
-Historically we have been bad at keeping per-interpreter state out of
-static variables, mostly because until recently subinterpreters were
-not widely used nor even factored in to solutions.  However, the
-feature is growing in popularity and use in the community.
-
-Mandate: "Eliminate use of static variables for per-interpreter state."
-
-The "c-statics.py" script in this directory, along with its accompanying
-data files, are part of the effort to resolve existing problems with
-our use of static variables and to prevent future problems.
-
-#-------------------------
-## statics for actually-global state (and runtime state consolidation)
-
-In general, holding any kind of state in static variables
-increases maintenance burden and increases the complexity of code (e.g.
-we use TSS to identify the active thread state).  So it is a good idea
-to avoid using statics for state even if for the "global" runtime or
-for process-global state.
-
-Relative to maintenance burden, one problem is where the runtime
-state is spread throughout the codebase in dozens of individual
-globals.  Unlike the other globals, the runtime state represents a set
-of values that are constantly shifting in a complex way.  When they are
-spread out it's harder to get a clear picture of what the runtime
-involves.  Furthermore, when they are spread out it complicates efforts
-that change the runtime.
-
-Consequently, the globals for Python's runtime state have been
-consolidated under a single top-level _PyRuntime global. No new globals
-should be added for runtime state.  Instead, they should be added to
-_PyRuntimeState or one of its sub-structs.  The tools in this directory
-are run as part of the test suite to ensure that no new globals have
-been added.  The script can be run manually as well:
-
-  ./python Lib/test/test_c_statics/c-statics.py check
-
-If it reports any globals then they should be resolved.  If the globals
-are runtime state then they should be folded into _PyRuntimeState.
-Otherwise they should be marked as ignored.
diff --git a/Tools/c-analyzer/cpython/__init__.py b/Tools/c-analyzer/cpython/__init__.py
index ae45b42..d0b3eff 100644
--- a/Tools/c-analyzer/cpython/__init__.py
+++ b/Tools/c-analyzer/cpython/__init__.py
@@ -1,29 +1,20 @@
 import os.path
-import sys
 
 
-TOOL_ROOT = os.path.abspath(
+TOOL_ROOT = os.path.normcase(
+    os.path.abspath(
         os.path.dirname(  # c-analyzer/
-            os.path.dirname(__file__)))  # cpython/
-DATA_DIR = TOOL_ROOT
+            os.path.dirname(__file__))))  # cpython/
 REPO_ROOT = (
         os.path.dirname(  # ..
             os.path.dirname(TOOL_ROOT)))  # Tools/
 
 INCLUDE_DIRS = [os.path.join(REPO_ROOT, name) for name in [
-        'Include',
-        ]]
+    'Include',
+]]
 SOURCE_DIRS = [os.path.join(REPO_ROOT, name) for name in [
-        'Python',
-        'Parser',
-        'Objects',
-        'Modules',
-        ]]
-
-#PYTHON = os.path.join(REPO_ROOT, 'python')
-PYTHON = sys.executable
-
-
-# Clean up the namespace.
-del sys
-del os
+    'Python',
+    'Parser',
+    'Objects',
+    'Modules',
+]]
diff --git a/Tools/c-analyzer/cpython/__main__.py b/Tools/c-analyzer/cpython/__main__.py
index 6b0f9bc..06ec871 100644
--- a/Tools/c-analyzer/cpython/__main__.py
+++ b/Tools/c-analyzer/cpython/__main__.py
@@ -1,212 +1,412 @@
-import argparse
-import re
+import logging
 import sys
 
-from c_analyzer.common import show
-from c_analyzer.common.info import UNKNOWN
-
-from . import SOURCE_DIRS
-from .find import supported_vars
-from .known import (
-    from_file as known_from_file,
-    DATA_FILE as KNOWN_FILE,
-    )
-from .supported import IGNORED_FILE
+from c_common.fsutil import expand_filenames, iter_files_by_suffix
+from c_common.scriptutil import (
+    VERBOSITY,
+    add_verbosity_cli,
+    add_traceback_cli,
+    add_commands_cli,
+    add_kind_filtering_cli,
+    add_files_cli,
+    add_progress_cli,
+    main_for_filenames,
+    process_args_by_key,
+    configure_logger,
+    get_prog,
+)
+from c_parser.info import KIND
+import c_parser.__main__ as c_parser
+import c_analyzer.__main__ as c_analyzer
+import c_analyzer as _c_analyzer
+from c_analyzer.info import UNKNOWN
+from . import _analyzer, _capi, _files, _parser, REPO_ROOT
 
 
-def _check_results(unknown, knownvars, used):
-    def _match_unused_global(variable):
-        found = []
-        for varid in knownvars:
-            if varid in used:
-                continue
-            if varid.funcname is not None:
-                continue
-            if varid.name != variable.name:
-                continue
-            if variable.filename and variable.filename != UNKNOWN:
-                if variable.filename == varid.filename:
-                    found.append(varid)
-            else:
-                found.append(varid)
-        return found
-
-    badknown = set()
-    for variable in sorted(unknown):
-        msg = None
-        if variable.funcname != UNKNOWN:
-            msg = f'could not find global symbol {variable.id}'
-        elif m := _match_unused_global(variable):
-            assert isinstance(m, list)
-            badknown.update(m)
-        elif variable.name in ('completed', 'id'):  # XXX Figure out where these variables are.
-            unknown.remove(variable)
-        else:
-            msg = f'could not find local symbol {variable.id}'
-        if msg:
-            #raise Exception(msg)
-            print(msg)
-    if badknown:
-        print('---')
-        print(f'{len(badknown)} globals in known.tsv, but may actually be local:')
-        for varid in sorted(badknown):
-            print(f'{varid.filename:30} {varid.name}')
-    unused = sorted(varid
-                    for varid in set(knownvars) - used
-                    if varid.name != 'id')  # XXX Figure out where these variables are.
-    if unused:
-        print('---')
-        print(f'did not use {len(unused)} known vars:')
-        for varid in unused:
-            print(f'{varid.filename:30} {varid.funcname or "-":20} {varid.name}')
-        raise Exception('not all known symbols used')
-    if unknown:
-        print('---')
-        raise Exception('could not find all symbols')
+logger = logging.getLogger(__name__)
 
 
-# XXX Move this check to its own command.
-def cmd_check_cache(cmd, *,
-                    known=KNOWN_FILE,
-                    ignored=IGNORED_FILE,
-                    _known_from_file=known_from_file,
-                    _find=supported_vars,
-                    ):
-    known = _known_from_file(known)
-
-    used = set()
-    unknown = set()
-    for var, supported in _find(known=known, ignored=ignored):
-        if supported is None:
-            unknown.add(var)
-            continue
-        used.add(var.id)
-    _check_results(unknown, known['variables'], used)
+def _resolve_filenames(filenames):
+    if filenames:
+        resolved = (_files.resolve_filename(f) for f in filenames)
+    else:
+        resolved = _files.iter_filenames()
+    return resolved
 
 
-def cmd_check(cmd, *,
-              known=KNOWN_FILE,
-              ignored=IGNORED_FILE,
-              _find=supported_vars,
-              _show=show.basic,
-              _print=print,
-              ):
-    """
-    Fail if there are unsupported globals variables.
+#######################################
+# the formats
 
-    In the failure case, the list of unsupported variables
-    will be printed out.
-    """
+def fmt_summary(analysis):
+    # XXX Support sorting and grouping.
+    supported = []
     unsupported = []
-    for var, supported in _find(known=known, ignored=ignored):
-        if not supported:
-            unsupported.append(var)
+    for item in analysis:
+        if item.supported:
+            supported.append(item)
+        else:
+            unsupported.append(item)
+    total = 0
 
-    if not unsupported:
-        #_print('okay')
-        return
+    def section(name, groupitems):
+        nonlocal total
+        items, render = c_analyzer.build_section(name, groupitems,
+                                                 relroot=REPO_ROOT)
+        yield from render()
+        total += len(items)
 
-    _print('ERROR: found unsupported global variables')
-    _print()
-    _show(sorted(unsupported))
-    _print(f' ({len(unsupported)} total)')
-    sys.exit(1)
+    yield ''
+    yield '===================='
+    yield 'supported'
+    yield '===================='
+
+    yield from section('types', supported)
+    yield from section('variables', supported)
+
+    yield ''
+    yield '===================='
+    yield 'unsupported'
+    yield '===================='
+
+    yield from section('types', unsupported)
+    yield from section('variables', unsupported)
+
+    yield ''
+    yield f'grand total: {total}'
 
 
-def cmd_show(cmd, *,
-             known=KNOWN_FILE,
-             ignored=IGNORED_FILE,
-             skip_objects=False,
-              _find=supported_vars,
-             _show=show.basic,
-             _print=print,
+#######################################
+# the checks
+
+CHECKS = dict(c_analyzer.CHECKS, **{
+    'globals': _analyzer.check_globals,
+})
+
+#######################################
+# the commands
+
+FILES_KWARGS = dict(excluded=_parser.EXCLUDED, nargs='*')
+
+
+def _cli_parse(parser):
+    process_output = c_parser.add_output_cli(parser)
+    process_kind = add_kind_filtering_cli(parser)
+    process_preprocessor = c_parser.add_preprocessor_cli(
+        parser,
+        get_preprocessor=_parser.get_preprocessor,
+    )
+    process_files = add_files_cli(parser, **FILES_KWARGS)
+    return [
+        process_output,
+        process_kind,
+        process_preprocessor,
+        process_files,
+    ]
+
+
+def cmd_parse(filenames=None, **kwargs):
+    filenames = _resolve_filenames(filenames)
+    if 'get_file_preprocessor' not in kwargs:
+        kwargs['get_file_preprocessor'] = _parser.get_preprocessor()
+    c_parser.cmd_parse(
+        filenames,
+        relroot=REPO_ROOT,
+        **kwargs
+    )
+
+
+def _cli_check(parser, **kwargs):
+    return c_analyzer._cli_check(parser, CHECKS, **kwargs, **FILES_KWARGS)
+
+
+def cmd_check(filenames=None, **kwargs):
+    filenames = _resolve_filenames(filenames)
+    kwargs['get_file_preprocessor'] = _parser.get_preprocessor(log_err=print)
+    c_analyzer.cmd_check(
+        filenames,
+        relroot=REPO_ROOT,
+        _analyze=_analyzer.analyze,
+        _CHECKS=CHECKS,
+        **kwargs
+    )
+
+
+def cmd_analyze(filenames=None, **kwargs):
+    formats = dict(c_analyzer.FORMATS)
+    formats['summary'] = fmt_summary
+    filenames = _resolve_filenames(filenames)
+    kwargs['get_file_preprocessor'] = _parser.get_preprocessor(log_err=print)
+    c_analyzer.cmd_analyze(
+        filenames,
+        relroot=REPO_ROOT,
+        _analyze=_analyzer.analyze,
+        formats=formats,
+        **kwargs
+    )
+
+
+def _cli_data(parser):
+    filenames = False
+    known = True
+    return c_analyzer._cli_data(parser, filenames, known)
+
+
+def cmd_data(datacmd, **kwargs):
+    formats = dict(c_analyzer.FORMATS)
+    formats['summary'] = fmt_summary
+    filenames = (file
+                 for file in _resolve_filenames(None)
+                 if file not in _parser.EXCLUDED)
+    kwargs['get_file_preprocessor'] = _parser.get_preprocessor(log_err=print)
+    if datacmd == 'show':
+        types = _analyzer.read_known()
+        results = []
+        for decl, info in types.items():
+            if info is UNKNOWN:
+                if decl.kind in (KIND.STRUCT, KIND.UNION):
+                    extra = {'unsupported': ['type unknown'] * len(decl.members)}
+                else:
+                    extra = {'unsupported': ['type unknown']}
+                info = (info, extra)
+            results.append((decl, info))
+            if decl.shortkey == 'struct _object':
+                tempinfo = info
+        known = _analyzer.Analysis.from_results(results)
+        analyze = None
+    elif datacmd == 'dump':
+        known = _analyzer.KNOWN_FILE
+        def analyze(files, **kwargs):
+            decls = []
+            for decl in _analyzer.iter_decls(files, **kwargs):
+                if not KIND.is_type_decl(decl.kind):
+                    continue
+                if not decl.filename.endswith('.h'):
+                    if decl.shortkey not in _analyzer.KNOWN_IN_DOT_C:
+                        continue
+                decls.append(decl)
+            results = _c_analyzer.analyze_decls(
+                decls,
+                known={},
+                analyze_resolved=_analyzer.analyze_resolved,
+            )
+            return _analyzer.Analysis.from_results(results)
+    else:  # check
+        known = _analyzer.read_known()
+        def analyze(files, **kwargs):
+            return _analyzer.iter_decls(files, **kwargs)
+    extracolumns = None
+    c_analyzer.cmd_data(
+        datacmd,
+        filenames,
+        known,
+        _analyze=analyze,
+        formats=formats,
+        extracolumns=extracolumns,
+        relroot=REPO_ROOT,
+        **kwargs
+    )
+
+
+def _cli_capi(parser):
+    parser.add_argument('--levels', action='append', metavar='LEVEL[,...]')
+    parser.add_argument(f'--public', dest='levels',
+                        action='append_const', const='public')
+    parser.add_argument(f'--no-public', dest='levels',
+                        action='append_const', const='no-public')
+    for level in _capi.LEVELS:
+        parser.add_argument(f'--{level}', dest='levels',
+                            action='append_const', const=level)
+    def process_levels(args, *, argv=None):
+        levels = []
+        for raw in args.levels or ():
+            for level in raw.replace(',', ' ').strip().split():
+                if level == 'public':
+                    levels.append('stable')
+                    levels.append('cpython')
+                elif level == 'no-public':
+                    levels.append('private')
+                    levels.append('internal')
+                elif level in _capi.LEVELS:
+                    levels.append(level)
+                else:
+                    parser.error(f'expected LEVEL to be one of {sorted(_capi.LEVELS)}, got {level!r}')
+        args.levels = set(levels)
+
+    parser.add_argument('--kinds', action='append', metavar='KIND[,...]')
+    for kind in _capi.KINDS:
+        parser.add_argument(f'--{kind}', dest='kinds',
+                            action='append_const', const=kind)
+    def process_kinds(args, *, argv=None):
+        kinds = []
+        for raw in args.kinds or ():
+            for kind in raw.replace(',', ' ').strip().split():
+                if kind in _capi.KINDS:
+                    kinds.append(kind)
+                else:
+                    parser.error(f'expected KIND to be one of {sorted(_capi.KINDS)}, got {kind!r}')
+        args.kinds = set(kinds)
+
+    parser.add_argument('--group-by', dest='groupby',
+                        choices=['level', 'kind'])
+
+    parser.add_argument('--format', default='table')
+    parser.add_argument('--summary', dest='format',
+                        action='store_const', const='summary')
+    def process_format(args, *, argv=None):
+        orig = args.format
+        args.format = _capi.resolve_format(args.format)
+        if isinstance(args.format, str):
+            if args.format not in _capi._FORMATS:
+                parser.error(f'unsupported format {orig!r}')
+
+    parser.add_argument('--show-empty', dest='showempty', action='store_true')
+    parser.add_argument('--no-show-empty', dest='showempty', action='store_false')
+    parser.set_defaults(showempty=None)
+
+    # XXX Add --sort-by, --sort and --no-sort.
+
+    parser.add_argument('--ignore', dest='ignored', action='append')
+    def process_ignored(args, *, argv=None):
+        ignored = []
+        for raw in args.ignored or ():
+            ignored.extend(raw.replace(',', ' ').strip().split())
+        args.ignored = ignored or None
+
+    parser.add_argument('filenames', nargs='*', metavar='FILENAME')
+    process_progress = add_progress_cli(parser)
+
+    return [
+        process_levels,
+        process_kinds,
+        process_format,
+        process_ignored,
+        process_progress,
+    ]
+
+
+def cmd_capi(filenames=None, *,
+             levels=None,
+             kinds=None,
+             groupby='kind',
+             format='table',
+             showempty=None,
+             ignored=None,
+             track_progress=None,
+             verbosity=VERBOSITY,
+             **kwargs
              ):
-    """
-    Print out the list of found global variables.
+    render = _capi.get_renderer(format)
 
-    The variables will be distinguished as "supported" or "unsupported".
-    """
-    allsupported = []
-    allunsupported = []
-    for found, supported in _find(known=known,
-                                  ignored=ignored,
-                                  skip_objects=skip_objects,
-                                  ):
-        if supported is None:
-            continue
-        (allsupported if supported else allunsupported
-         ).append(found)
+    filenames = _files.iter_header_files(filenames, levels=levels)
+    #filenames = (file for file, _ in main_for_filenames(filenames))
+    if track_progress:
+        filenames = track_progress(filenames)
+    items = _capi.iter_capi(filenames)
+    if levels:
+        items = (item for item in items if item.level in levels)
+    if kinds:
+        items = (item for item in items if item.kind in kinds)
 
-    _print('supported:')
-    _print('----------')
-    _show(sorted(allsupported))
-    _print(f' ({len(allsupported)} total)')
-    _print()
-    _print('unsupported:')
-    _print('------------')
-    _show(sorted(allunsupported))
-    _print(f' ({len(allunsupported)} total)')
+    filter = _capi.resolve_filter(ignored)
+    if filter:
+        items = (item for item in items if filter(item, log=lambda msg: logger.log(1, msg)))
+
+    lines = render(
+        items,
+        groupby=groupby,
+        showempty=showempty,
+        verbose=verbosity > VERBOSITY,
+    )
+    print()
+    for line in lines:
+        print(line)
 
 
-#############################
-# the script
+# We do not define any other cmd_*() handlers here,
+# favoring those defined elsewhere.
 
 COMMANDS = {
-        'check': cmd_check,
-        'show': cmd_show,
-        }
-
-PROG = sys.argv[0]
-PROG = 'c-globals.py'
+    'check': (
+        'analyze and fail if the CPython source code has any problems',
+        [_cli_check],
+        cmd_check,
+    ),
+    'analyze': (
+        'report on the state of the CPython source code',
+        [(lambda p: c_analyzer._cli_analyze(p, **FILES_KWARGS))],
+        cmd_analyze,
+    ),
+    'parse': (
+        'parse the CPython source files',
+        [_cli_parse],
+        cmd_parse,
+    ),
+    'data': (
+        'check/manage local data (e.g. known types, ignored vars, caches)',
+        [_cli_data],
+        cmd_data,
+    ),
+    'capi': (
+        'inspect the C-API',
+        [_cli_capi],
+        cmd_capi,
+    ),
+}
 
 
-def parse_args(prog=PROG, argv=sys.argv[1:], *, _fail=None):
-    common = argparse.ArgumentParser(add_help=False)
-    common.add_argument('--ignored', metavar='FILE',
-                        default=IGNORED_FILE,
-                        help='path to file that lists ignored vars')
-    common.add_argument('--known', metavar='FILE',
-                        default=KNOWN_FILE,
-                        help='path to file that lists known types')
-    #common.add_argument('dirs', metavar='DIR', nargs='*',
-    #                    default=SOURCE_DIRS,
-    #                    help='a directory to check')
+#######################################
+# the script
 
+def parse_args(argv=sys.argv[1:], prog=None, *, subset=None):
+    import argparse
     parser = argparse.ArgumentParser(
-            prog=prog,
-            )
-    subs = parser.add_subparsers(dest='cmd')
+        prog=prog or get_prog(),
+    )
 
-    check = subs.add_parser('check', parents=[common])
+#    if subset == 'check' or subset == ['check']:
+#        if checks is not None:
+#            commands = dict(COMMANDS)
+#            commands['check'] = list(commands['check'])
+#            cli = commands['check'][1][0]
+#            commands['check'][1][0] = (lambda p: cli(p, checks=checks))
+    processors = add_commands_cli(
+        parser,
+        commands=COMMANDS,
+        commonspecs=[
+            add_verbosity_cli,
+            add_traceback_cli,
+        ],
+        subset=subset,
+    )
 
-    show = subs.add_parser('show', parents=[common])
-    show.add_argument('--skip-objects', action='store_true')
-
-    if _fail is None:
-        def _fail(msg):
-            parser.error(msg)
-
-    # Now parse the args.
     args = parser.parse_args(argv)
     ns = vars(args)
 
     cmd = ns.pop('cmd')
-    if not cmd:
-        _fail('missing command')
 
-    return cmd, ns
+    verbosity, traceback_cm = process_args_by_key(
+        args,
+        argv,
+        processors[cmd],
+        ['verbosity', 'traceback_cm'],
+    )
+    if cmd != 'parse':
+        # "verbosity" is sent to the commands, so we put it back.
+        args.verbosity = verbosity
+
+    return cmd, ns, verbosity, traceback_cm
 
 
-def main(cmd, cmdkwargs=None, *, _COMMANDS=COMMANDS):
+def main(cmd, cmd_kwargs):
     try:
-        cmdfunc = _COMMANDS[cmd]
+        run_cmd = COMMANDS[cmd][-1]
     except KeyError:
-        raise ValueError(
-            f'unsupported cmd {cmd!r}' if cmd else 'missing cmd')
-
-    cmdfunc(cmd, **cmdkwargs or {})
+        raise ValueError(f'unsupported cmd {cmd!r}')
+    run_cmd(**cmd_kwargs)
 
 
 if __name__ == '__main__':
-    cmd, cmdkwargs = parse_args()
-    main(cmd, cmdkwargs)
+    cmd, cmd_kwargs, verbosity, traceback_cm = parse_args()
+    configure_logger(verbosity)
+    with traceback_cm:
+        main(cmd, cmd_kwargs)
diff --git a/Tools/c-analyzer/cpython/_analyzer.py b/Tools/c-analyzer/cpython/_analyzer.py
new file mode 100644
index 0000000..0990423
--- /dev/null
+++ b/Tools/c-analyzer/cpython/_analyzer.py
@@ -0,0 +1,353 @@
+import os.path
+import re
+
+from c_common.clsutil import classonly
+from c_parser.info import (
+    KIND,
+    DeclID,
+    Declaration,
+    TypeDeclaration,
+    TypeDef,
+    Struct,
+    Member,
+    FIXED_TYPE,
+)
+from c_parser.match import (
+    is_type_decl,
+    is_pots,
+    is_funcptr,
+)
+from c_analyzer.match import (
+    is_system_type,
+    is_process_global,
+    is_fixed_type,
+    is_immutable,
+)
+import c_analyzer as _c_analyzer
+import c_analyzer.info as _info
+import c_analyzer.datafiles as _datafiles
+from . import _parser, REPO_ROOT
+
+
+_DATA_DIR = os.path.dirname(__file__)
+KNOWN_FILE = os.path.join(_DATA_DIR, 'known.tsv')
+IGNORED_FILE = os.path.join(_DATA_DIR, 'ignored.tsv')
+KNOWN_IN_DOT_C = {
+    'struct _odictobject': False,
+    'PyTupleObject': False,
+    'struct _typeobject': False,
+    'struct _arena': True,  # ???
+    'struct _frame': False,
+    'struct _ts': True,  # ???
+    'struct PyCodeObject': False,
+    'struct _is': True,  # ???
+    'PyWideStringList': True,  # ???
+    # recursive
+    'struct _dictkeysobject': False,
+}
+# These are loaded from the respective .tsv files upon first use.
+_KNOWN = {
+    # {(file, ID) | ID => info | bool}
+    #'PyWideStringList': True,
+}
+#_KNOWN = {(Struct(None, typeid.partition(' ')[-1], None)
+#           if typeid.startswith('struct ')
+#           else TypeDef(None, typeid, None)
+#           ): ([], {'unsupported': None if supported else True})
+#          for typeid, supported in _KNOWN_IN_DOT_C.items()}
+_IGNORED = {
+    # {ID => reason}
+}
+
+KINDS = frozenset((*KIND.TYPES, KIND.VARIABLE))
+
+
+def read_known():
+    if not _KNOWN:
+        # Cache a copy the first time.
+        extracols = None  # XXX
+        #extracols = ['unsupported']
+        known = _datafiles.read_known(KNOWN_FILE, extracols, REPO_ROOT)
+        # For now we ignore known.values() (i.e. "extra").
+        types, _ = _datafiles.analyze_known(
+            known,
+            analyze_resolved=analyze_resolved,
+        )
+        _KNOWN.update(types)
+    return _KNOWN.copy()
+
+
+def write_known():
+    raise NotImplementedError
+    datafiles.write_known(decls, IGNORED_FILE, ['unsupported'], relroot=REPO_ROOT)
+
+
+def read_ignored():
+    if not _IGNORED:
+        _IGNORED.update(_datafiles.read_ignored(IGNORED_FILE, relroot=REPO_ROOT))
+    return dict(_IGNORED)
+
+
+def write_ignored():
+    raise NotImplementedError
+    _datafiles.write_ignored(variables, IGNORED_FILE, relroot=REPO_ROOT)
+
+
+def analyze(filenames, *,
+            skip_objects=False,
+            **kwargs
+            ):
+    if skip_objects:
+        # XXX Set up a filter.
+        raise NotImplementedError
+
+    known = read_known()
+
+    decls = iter_decls(filenames)
+    results = _c_analyzer.analyze_decls(
+        decls,
+        known,
+        analyze_resolved=analyze_resolved,
+    )
+    analysis = Analysis.from_results(results)
+
+    return analysis
+
+
+def iter_decls(filenames, **kwargs):
+    decls = _c_analyzer.iter_decls(
+        filenames,
+        # We ignore functions (and statements).
+        kinds=KINDS,
+        parse_files=_parser.parse_files,
+        **kwargs
+    )
+    for decl in decls:
+        if not decl.data:
+            # Ignore forward declarations.
+            continue
+        yield decl
+
+
+def analyze_resolved(resolved, decl, types, knowntypes, extra=None):
+    if decl.kind not in KINDS:
+        # Skip it!
+        return None
+
+    typedeps = resolved
+    if typedeps is _info.UNKNOWN:
+        if decl.kind in (KIND.STRUCT, KIND.UNION):
+            typedeps = [typedeps] * len(decl.members)
+        else:
+            typedeps = [typedeps]
+    #assert isinstance(typedeps, (list, TypeDeclaration)), typedeps
+
+    if extra is None:
+        extra = {}
+    elif 'unsupported' in extra:
+        raise NotImplementedError((decl, extra))
+
+    unsupported = _check_unsupported(decl, typedeps, types, knowntypes)
+    extra['unsupported'] = unsupported
+
+    return typedeps, extra
+
+
+def _check_unsupported(decl, typedeps, types, knowntypes):
+    if typedeps is None:
+        raise NotImplementedError(decl)
+
+    if decl.kind in (KIND.STRUCT, KIND.UNION):
+        return _check_members(decl, typedeps, types, knowntypes)
+    elif decl.kind is KIND.ENUM:
+        if typedeps:
+            raise NotImplementedError((decl, typedeps))
+        return None
+    else:
+        return _check_typedep(decl, typedeps, types, knowntypes)
+
+
+def _check_members(decl, typedeps, types, knowntypes):
+    if isinstance(typedeps, TypeDeclaration):
+        raise NotImplementedError((decl, typedeps))
+
+    #members = decl.members or ()  # A forward decl has no members.
+    members = decl.members
+    if not members:
+        # A forward decl has no members, but that shouldn't surface here..
+        raise NotImplementedError(decl)
+    if len(members) != len(typedeps):
+        raise NotImplementedError((decl, typedeps))
+
+    unsupported = []
+    for member, typedecl in zip(members, typedeps):
+        checked = _check_typedep(member, typedecl, types, knowntypes)
+        unsupported.append(checked)
+    if any(None if v is FIXED_TYPE else v for v in unsupported):
+        return unsupported
+    elif FIXED_TYPE in unsupported:
+        return FIXED_TYPE
+    else:
+        return None
+
+
+def _check_typedep(decl, typedecl, types, knowntypes):
+    if not isinstance(typedecl, TypeDeclaration):
+        if hasattr(type(typedecl), '__len__'):
+            if len(typedecl) == 1:
+                typedecl, = typedecl
+    if typedecl is None:
+        # XXX Fail?
+        return 'typespec (missing)'
+    elif typedecl is _info.UNKNOWN:
+        # XXX Is this right?
+        return 'typespec (unknown)'
+    elif not isinstance(typedecl, TypeDeclaration):
+        raise NotImplementedError((decl, typedecl))
+
+    if isinstance(decl, Member):
+        return _check_vartype(decl, typedecl, types, knowntypes)
+    elif not isinstance(decl, Declaration):
+        raise NotImplementedError(decl)
+    elif decl.kind is KIND.TYPEDEF:
+        return _check_vartype(decl, typedecl, types, knowntypes)
+    elif decl.kind is KIND.VARIABLE:
+        if not is_process_global(decl):
+            return None
+        checked = _check_vartype(decl, typedecl, types, knowntypes)
+        return 'mutable' if checked is FIXED_TYPE else checked
+    else:
+        raise NotImplementedError(decl)
+
+
+def _check_vartype(decl, typedecl, types, knowntypes):
+    """Return failure reason."""
+    checked = _check_typespec(decl, typedecl, types, knowntypes)
+    if checked:
+        return checked
+    if is_immutable(decl.vartype):
+        return None
+    if is_fixed_type(decl.vartype):
+        return FIXED_TYPE
+    return 'mutable'
+
+
+def _check_typespec(decl, typedecl, types, knowntypes):
+    typespec = decl.vartype.typespec
+    if typedecl is not None:
+        found = types.get(typedecl)
+        if found is None:
+            found = knowntypes.get(typedecl)
+
+        if found is not None:
+            _, extra = found
+            if extra is None:
+                # XXX Under what circumstances does this happen?
+                extra = {}
+            unsupported = extra.get('unsupported')
+            if unsupported is FIXED_TYPE:
+                unsupported = None
+            return 'typespec' if unsupported else None
+    # Fall back to default known types.
+    if is_pots(typespec):
+        return None
+    elif is_system_type(typespec):
+        return None
+    elif is_funcptr(decl.vartype):
+        return None
+    return 'typespec'
+
+
+class Analyzed(_info.Analyzed):
+
+    @classonly
+    def is_target(cls, raw):
+        if not super().is_target(raw):
+            return False
+        if raw.kind not in KINDS:
+            return False
+        return True
+
+    #@classonly
+    #def _parse_raw_result(cls, result, extra):
+    #    typedecl, extra = super()._parse_raw_result(result, extra)
+    #    if typedecl is None:
+    #        return None, extra
+    #    raise NotImplementedError
+
+    def __init__(self, item, typedecl=None, *, unsupported=None, **extra):
+        if 'unsupported' in extra:
+            raise NotImplementedError((item, typedecl, unsupported, extra))
+        if not unsupported:
+            unsupported = None
+        elif isinstance(unsupported, (str, TypeDeclaration)):
+            unsupported = (unsupported,)
+        elif unsupported is not FIXED_TYPE:
+            unsupported = tuple(unsupported)
+        self.unsupported = unsupported
+        extra['unsupported'] = self.unsupported  # ...for __repr__(), etc.
+        if self.unsupported is None:
+            #self.supported = None
+            self.supported = True
+        elif self.unsupported is FIXED_TYPE:
+            if item.kind is KIND.VARIABLE:
+                raise NotImplementedError(item, typedecl, unsupported)
+            self.supported = True
+        else:
+            self.supported = not self.unsupported
+        super().__init__(item, typedecl, **extra)
+
+    def render(self, fmt='line', *, itemonly=False):
+        if fmt == 'raw':
+            yield repr(self)
+            return
+        rendered = super().render(fmt, itemonly=itemonly)
+        # XXX ???
+        #if itemonly:
+        #    yield from rendered
+        supported = self._supported
+        if fmt in ('line', 'brief'):
+            rendered, = rendered
+            parts = [
+                '+' if supported else '-' if supported is False else '',
+                rendered,
+            ]
+            yield '\t'.join(parts)
+        elif fmt == 'summary':
+            raise NotImplementedError(fmt)
+        elif fmt == 'full':
+            yield from rendered
+            if supported:
+                yield f'\tsupported:\t{supported}'
+        else:
+            raise NotImplementedError(fmt)
+
+
+class Analysis(_info.Analysis):
+    _item_class = Analyzed
+
+    @classonly
+    def build_item(cls, info, result=None):
+        if not isinstance(info, Declaration) or info.kind not in KINDS:
+            raise NotImplementedError((info, result))
+        return super().build_item(info, result)
+
+
+def check_globals(analysis):
+    # yield (data, failure)
+    ignored = read_ignored()
+    for item in analysis:
+        if item.kind != KIND.VARIABLE:
+            continue
+        if item.supported:
+            continue
+        if item.id in ignored:
+            continue
+        reason = item.unsupported
+        if not reason:
+            reason = '???'
+        elif not isinstance(reason, str):
+            if len(reason) == 1:
+                reason, = reason
+        reason = f'({reason})'
+        yield item, f'not supported {reason:20}\t{item.storage or ""} {item.vartype}'
diff --git a/Tools/c-analyzer/cpython/_capi.py b/Tools/c-analyzer/cpython/_capi.py
new file mode 100644
index 0000000..df8159a
--- /dev/null
+++ b/Tools/c-analyzer/cpython/_capi.py
@@ -0,0 +1,665 @@
+from collections import namedtuple
+import logging
+import os
+import os.path
+import re
+import textwrap
+
+from c_common.tables import build_table, resolve_columns
+from c_parser.parser._regexes import _ind
+from ._files import iter_header_files, resolve_filename
+from . import REPO_ROOT
+
+
+logger = logging.getLogger(__name__)
+
+
+INCLUDE_ROOT = os.path.join(REPO_ROOT, 'Include')
+INCLUDE_CPYTHON = os.path.join(INCLUDE_ROOT, 'cpython')
+INCLUDE_INTERNAL = os.path.join(INCLUDE_ROOT, 'internal')
+
+_MAYBE_NESTED_PARENS = textwrap.dedent(r'''
+    (?:
+        (?: [^(]* [(] [^()]* [)] )* [^(]*
+    )
+''')
+
+CAPI_FUNC = textwrap.dedent(rf'''
+    (?:
+        ^
+        \s*
+        PyAPI_FUNC \s*
+        [(]
+        {_ind(_MAYBE_NESTED_PARENS, 2)}
+        [)] \s*
+        (\w+)  # <func>
+        \s* [(]
+    )
+''')
+CAPI_DATA = textwrap.dedent(rf'''
+    (?:
+        ^
+        \s*
+        PyAPI_DATA \s*
+        [(]
+        {_ind(_MAYBE_NESTED_PARENS, 2)}
+        [)] \s*
+        (\w+)  # <data>
+        \b [^(]
+    )
+''')
+CAPI_INLINE = textwrap.dedent(r'''
+    (?:
+        ^
+        \s*
+        static \s+ inline \s+
+        .*?
+        \s+
+        ( \w+ )  # <inline>
+        \s* [(]
+    )
+''')
+CAPI_MACRO = textwrap.dedent(r'''
+    (?:
+        (\w+)  # <macro>
+        [(]
+    )
+''')
+CAPI_CONSTANT = textwrap.dedent(r'''
+    (?:
+        (\w+)  # <constant>
+        \s+ [^(]
+    )
+''')
+CAPI_DEFINE = textwrap.dedent(rf'''
+    (?:
+        ^
+        \s* [#] \s* define \s+
+        (?:
+            {_ind(CAPI_MACRO, 3)}
+            |
+            {_ind(CAPI_CONSTANT, 3)}
+            |
+            (?:
+                # ignored
+                \w+   # <defined_name>
+                \s*
+                $
+            )
+        )
+    )
+''')
+CAPI_RE = re.compile(textwrap.dedent(rf'''
+    (?:
+        {_ind(CAPI_FUNC, 2)}
+        |
+        {_ind(CAPI_DATA, 2)}
+        |
+        {_ind(CAPI_INLINE, 2)}
+        |
+        {_ind(CAPI_DEFINE, 2)}
+    )
+'''), re.VERBOSE)
+
+KINDS = [
+    'func',
+    'data',
+    'inline',
+    'macro',
+    'constant',
+]
+
+
+def _parse_line(line, prev=None):
+    last = line
+    if prev:
+        if not prev.endswith(os.linesep):
+            prev += os.linesep
+        line = prev + line
+    m = CAPI_RE.match(line)
+    if not m:
+        if not prev and line.startswith('static inline '):
+            return line  # the new "prev"
+        #if 'PyAPI_' in line or '#define ' in line or ' define ' in line:
+        #    print(line)
+        return None
+    results = zip(KINDS, m.groups())
+    for kind, name in results:
+        if name:
+            clean = last.split('//')[0].rstrip()
+            if clean.endswith('*/'):
+                clean = clean.split('/*')[0].rstrip()
+
+            if kind == 'macro' or kind == 'constant':
+                if not clean.endswith('\\'):
+                    return name, kind
+            elif kind == 'inline':
+                if clean.endswith('}'):
+                    if not prev or clean == '}':
+                        return name, kind
+            elif kind == 'func' or kind == 'data':
+                if clean.endswith(';'):
+                    return name, kind
+            else:
+                # This should not be reached.
+                raise NotImplementedError
+            return line  # the new "prev"
+    # It was a plain #define.
+    return None
+
+
+LEVELS = [
+    'stable',
+    'cpython',
+    'private',
+    'internal',
+]
+
+def _get_level(filename, name, *,
+               _cpython=INCLUDE_CPYTHON + os.path.sep,
+               _internal=INCLUDE_INTERNAL + os.path.sep,
+               ):
+    if filename.startswith(_internal):
+        return 'internal'
+    elif name.startswith('_'):
+        return 'private'
+    elif os.path.dirname(filename) == INCLUDE_ROOT:
+        return 'stable'
+    elif filename.startswith(_cpython):
+        return 'cpython'
+    else:
+        raise NotImplementedError
+    #return '???'
+
+
+GROUPINGS = {
+    'kind': KINDS,
+    'level': LEVELS,
+}
+
+
+class CAPIItem(namedtuple('CAPIItem', 'file lno name kind level')):
+
+    @classmethod
+    def from_line(cls, line, filename, lno, prev=None):
+        parsed = _parse_line(line, prev)
+        if not parsed:
+            return None, None
+        if isinstance(parsed, str):
+            # incomplete
+            return None, parsed
+        name, kind = parsed
+        level = _get_level(filename, name)
+        self = cls(filename, lno, name, kind, level)
+        if prev:
+            self._text = (prev + line).rstrip().splitlines()
+        else:
+            self._text = [line.rstrip()]
+        return self, None
+
+    @property
+    def relfile(self):
+        return self.file[len(REPO_ROOT) + 1:]
+
+    @property
+    def text(self):
+        try:
+            return self._text
+        except AttributeError:
+            # XXX Actually ready the text from disk?.
+            self._text = []
+            if self.kind == 'data':
+                self._text = [
+                    f'PyAPI_DATA(...) {self.name}',
+                ]
+            elif self.kind == 'func':
+                self._text = [
+                    f'PyAPI_FUNC(...) {self.name}(...);',
+                ]
+            elif self.kind == 'inline':
+                self._text = [
+                    f'static inline {self.name}(...);',
+                ]
+            elif self.kind == 'macro':
+                self._text = [
+                    f'#define {self.name}(...) \\',
+                    f'    ...',
+                ]
+            elif self.kind == 'constant':
+                self._text = [
+                    f'#define {self.name} ...',
+                ]
+            else:
+                raise NotImplementedError
+
+            return self._text
+
+
+def _parse_groupby(raw):
+    if not raw:
+        raw = 'kind'
+
+    if isinstance(raw, str):
+        groupby = raw.replace(',', ' ').strip().split()
+    else:
+        raise NotImplementedError
+
+    if not all(v in GROUPINGS for v in groupby):
+        raise ValueError(f'invalid groupby value {raw!r}')
+    return groupby
+
+
+def _resolve_full_groupby(groupby):
+    if isinstance(groupby, str):
+        groupby = [groupby]
+    groupings = []
+    for grouping in groupby + list(GROUPINGS):
+        if grouping not in groupings:
+            groupings.append(grouping)
+    return groupings
+
+
+def summarize(items, *, groupby='kind', includeempty=True, minimize=None):
+    if minimize is None:
+        if includeempty is None:
+            minimize = True
+            includeempty = False
+        else:
+            minimize = includeempty
+    elif includeempty is None:
+        includeempty = minimize
+    elif minimize and includeempty:
+        raise ValueError(f'cannot minimize and includeempty at the same time')
+
+    groupby = _parse_groupby(groupby)[0]
+    _outer, _inner = _resolve_full_groupby(groupby)
+    outers = GROUPINGS[_outer]
+    inners = GROUPINGS[_inner]
+
+    summary = {
+        'totals': {
+            'all': 0,
+            'subs': {o: 0 for o in outers},
+            'bygroup': {o: {i: 0 for i in inners}
+                        for o in outers},
+        },
+    }
+
+    for item in items:
+        outer = getattr(item, _outer)
+        inner = getattr(item, _inner)
+        # Update totals.
+        summary['totals']['all'] += 1
+        summary['totals']['subs'][outer] += 1
+        summary['totals']['bygroup'][outer][inner] += 1
+
+    if not includeempty:
+        subtotals = summary['totals']['subs']
+        bygroup = summary['totals']['bygroup']
+        for outer in outers:
+            if subtotals[outer] == 0:
+                del subtotals[outer]
+                del bygroup[outer]
+                continue
+
+            for inner in inners:
+                if bygroup[outer][inner] == 0:
+                    del bygroup[outer][inner]
+            if minimize:
+                if len(bygroup[outer]) == 1:
+                    del bygroup[outer]
+
+    return summary
+
+
+def _parse_capi(lines, filename):
+    if isinstance(lines, str):
+        lines = lines.splitlines()
+    prev = None
+    for lno, line in enumerate(lines, 1):
+        parsed, prev = CAPIItem.from_line(line, filename, lno, prev)
+        if parsed:
+            yield parsed
+    if prev:
+        parsed, prev = CAPIItem.from_line('', filename, lno, prev)
+        if parsed:
+            yield parsed
+        if prev:
+            print('incomplete match:')
+            print(filename)
+            print(prev)
+            raise Exception
+
+
+def iter_capi(filenames=None):
+    for filename in iter_header_files(filenames):
+        with open(filename) as infile:
+            for item in _parse_capi(infile, filename):
+                yield item
+
+
+def resolve_filter(ignored):
+    if not ignored:
+        return None
+    ignored = set(_resolve_ignored(ignored))
+    def filter(item, *, log=None):
+        if item.name not in ignored:
+            return True
+        if log is not None:
+            log(f'ignored {item.name!r}')
+        return False
+    return filter
+
+
+def _resolve_ignored(ignored):
+    if isinstance(ignored, str):
+        ignored = [ignored]
+    for raw in ignored:
+        if isinstance(raw, str):
+            if raw.startswith('|'):
+                yield raw[1:]
+            elif raw.startswith('<') and raw.endswith('>'):
+                filename = raw[1:-1]
+                try:
+                    infile = open(filename)
+                except Exception as exc:
+                    logger.error(f'ignore file failed: {exc}')
+                    continue
+                logger.log(1, f'reading ignored names from {filename!r}')
+                with infile:
+                    for line in infile:
+                        if not line:
+                            continue
+                        if line[0].isspace():
+                            continue
+                        line = line.partition('#')[0].rstrip()
+                        if line:
+                            # XXX Recurse?
+                            yield line
+            else:
+                raw = raw.strip()
+                if raw:
+                    yield raw
+        else:
+            raise NotImplementedError
+
+
+def _collate(items, groupby, includeempty):
+    groupby = _parse_groupby(groupby)[0]
+    maxfilename = maxname = maxkind = maxlevel = 0
+
+    collated = {}
+    groups = GROUPINGS[groupby]
+    for group in groups:
+        collated[group] = []
+
+    for item in items:
+        key = getattr(item, groupby)
+        collated[key].append(item)
+        maxfilename = max(len(item.relfile), maxfilename)
+        maxname = max(len(item.name), maxname)
+        maxkind = max(len(item.kind), maxkind)
+        maxlevel = max(len(item.level), maxlevel)
+    if not includeempty:
+        for group in groups:
+            if not collated[group]:
+                del collated[group]
+    maxextra = {
+        'kind': maxkind,
+        'level': maxlevel,
+    }
+    return collated, groupby, maxfilename, maxname, maxextra
+
+
+def _get_sortkey(sort, _groupby, _columns):
+    if sort is True or sort is None:
+        # For now:
+        def sortkey(item):
+            return (
+                item.level == 'private',
+                LEVELS.index(item.level),
+                KINDS.index(item.kind),
+                os.path.dirname(item.file),
+                os.path.basename(item.file),
+                item.name,
+            )
+        return sortkey
+
+        sortfields = 'not-private level kind dirname basename name'.split()
+    elif isinstance(sort, str):
+        sortfields = sort.replace(',', ' ').strip().split()
+    elif callable(sort):
+        return sort
+    else:
+        raise NotImplementedError
+
+    # XXX Build a sortkey func from sortfields.
+    raise NotImplementedError
+
+
+##################################
+# CLI rendering
+
+_MARKERS = {
+    'level': {
+        'S': 'stable',
+        'C': 'cpython',
+        'P': 'private',
+        'I': 'internal',
+    },
+    'kind': {
+        'F': 'func',
+        'D': 'data',
+        'I': 'inline',
+        'M': 'macro',
+        'C': 'constant',
+    },
+}
+
+
+def resolve_format(format):
+    if not format:
+        return 'table'
+    elif isinstance(format, str) and format in _FORMATS:
+        return format
+    else:
+        return resolve_columns(format)
+
+
+def get_renderer(format):
+    format = resolve_format(format)
+    if isinstance(format, str):
+        try:
+            return _FORMATS[format]
+        except KeyError:
+            raise ValueError(f'unsupported format {format!r}')
+    else:
+        def render(items, **kwargs):
+            return render_table(items, columns=format, **kwargs)
+        return render
+
+
+def render_table(items, *,
+                 columns=None,
+                 groupby='kind',
+                 sort=True,
+                 showempty=False,
+                 verbose=False,
+                 ):
+    if groupby is None:
+        groupby = 'kind'
+    if showempty is None:
+        showempty = False
+
+    if groupby:
+        (collated, groupby, maxfilename, maxname, maxextra,
+         ) = _collate(items, groupby, showempty)
+        for grouping in GROUPINGS:
+            maxextra[grouping] = max(len(g) for g in GROUPINGS[grouping])
+
+        _, extra = _resolve_full_groupby(groupby)
+        extras = [extra]
+        markers = {extra: _MARKERS[extra]}
+
+        groups = GROUPINGS[groupby]
+    else:
+        # XXX Support no grouping?
+        raise NotImplementedError
+
+    if columns:
+        def get_extra(item):
+            return {extra: getattr(item, extra)
+                    for extra in ('kind', 'level')}
+    else:
+        if verbose:
+            extracols = [f'{extra}:{maxextra[extra]}'
+                         for extra in extras]
+            def get_extra(item):
+                return {extra: getattr(item, extra)
+                        for extra in extras}
+        elif len(extras) == 1:
+            extra, = extras
+            extracols = [f'{m}:1' for m in markers[extra]]
+            def get_extra(item):
+                return {m: m if getattr(item, extra) == markers[extra][m] else ''
+                        for m in markers[extra]}
+        else:
+            raise NotImplementedError
+            #extracols = [[f'{m}:1' for m in markers[extra]]
+            #             for extra in extras]
+            #def get_extra(item):
+            #    values = {}
+            #    for extra in extras:
+            #        cur = markers[extra]
+            #        for m in cur:
+            #            values[m] = m if getattr(item, m) == cur[m] else ''
+            #    return values
+        columns = [
+            f'filename:{maxfilename}',
+            f'name:{maxname}',
+            *extracols,
+        ]
+    header, div, fmt = build_table(columns)
+
+    if sort:
+        sortkey = _get_sortkey(sort, groupby, columns)
+
+    total = 0
+    for group, grouped in collated.items():
+        if not showempty and group not in collated:
+            continue
+        yield ''
+        yield f' === {group} ==='
+        yield ''
+        yield header
+        yield div
+        if grouped:
+            if sort:
+                grouped = sorted(grouped, key=sortkey)
+            for item in grouped:
+                yield fmt.format(
+                    filename=item.relfile,
+                    name=item.name,
+                    **get_extra(item),
+                )
+        yield div
+        subtotal = len(grouped)
+        yield f'  sub-total: {subtotal}'
+        total += subtotal
+    yield ''
+    yield f'total: {total}'
+
+
+def render_full(items, *,
+                groupby='kind',
+                sort=None,
+                showempty=None,
+                verbose=False,
+                ):
+    if groupby is None:
+        groupby = 'kind'
+    if showempty is None:
+        showempty = False
+
+    if sort:
+        sortkey = _get_sortkey(sort, groupby, None)
+
+    if groupby:
+        collated, groupby, _, _, _ = _collate(items, groupby, showempty)
+        for group, grouped in collated.items():
+            yield '#' * 25
+            yield f'# {group} ({len(grouped)})'
+            yield '#' * 25
+            yield ''
+            if not grouped:
+                continue
+            if sort:
+                grouped = sorted(grouped, key=sortkey)
+            for item in grouped:
+                yield from _render_item_full(item, groupby, verbose)
+                yield ''
+    else:
+        if sort:
+            items = sorted(items, key=sortkey)
+        for item in items:
+            yield from _render_item_full(item, None, verbose)
+            yield ''
+
+
+def _render_item_full(item, groupby, verbose):
+    yield item.name
+    yield f'  {"filename:":10} {item.relfile}'
+    for extra in ('kind', 'level'):
+        #if groupby != extra:
+            yield f'  {extra+":":10} {getattr(item, extra)}'
+    if verbose:
+        print('  ---------------------------------------')
+        for lno, line in enumerate(item.text, item.lno):
+            print(f'  | {lno:3} {line}')
+        print('  ---------------------------------------')
+
+
+def render_summary(items, *,
+                   groupby='kind',
+                   sort=None,
+                   showempty=None,
+                   verbose=False,
+                   ):
+    if groupby is None:
+        groupby = 'kind'
+    summary = summarize(
+        items,
+        groupby=groupby,
+        includeempty=showempty,
+        minimize=None if showempty else not verbose,
+    )
+
+    subtotals = summary['totals']['subs']
+    bygroup = summary['totals']['bygroup']
+    lastempty = False
+    for outer, subtotal in subtotals.items():
+        if bygroup:
+            subtotal = f'({subtotal})'
+            yield f'{outer + ":":20} {subtotal:>8}'
+        else:
+            yield f'{outer + ":":10} {subtotal:>8}'
+        if outer in bygroup:
+            for inner, count in bygroup[outer].items():
+                yield f'   {inner + ":":9} {count}'
+            lastempty = False
+        else:
+            lastempty = True
+
+    total = f'*{summary["totals"]["all"]}*'
+    label = '*total*:'
+    if bygroup:
+        yield f'{label:20} {total:>8}'
+    else:
+        yield f'{label:10} {total:>9}'
+
+
+_FORMATS = {
+    'table': render_table,
+    'full': render_full,
+    'summary': render_summary,
+}
diff --git a/Tools/c-analyzer/cpython/_files.py b/Tools/c-analyzer/cpython/_files.py
new file mode 100644
index 0000000..3e39788
--- /dev/null
+++ b/Tools/c-analyzer/cpython/_files.py
@@ -0,0 +1,69 @@
+import os.path
+
+from c_common.fsutil import expand_filenames, iter_files_by_suffix
+from . import REPO_ROOT, INCLUDE_DIRS, SOURCE_DIRS
+
+
+GLOBS = [
+    'Include/*.h',
+    'Include/internal/*.h',
+    'Modules/**/*.h',
+    'Modules/**/*.c',
+    'Objects/**/*.h',
+    'Objects/**/*.c',
+    'Python/**/*.h',
+    'Parser/**/*.c',
+    'Python/**/*.h',
+    'Parser/**/*.c',
+]
+LEVEL_GLOBS = {
+    'stable': 'Include/*.h',
+    'cpython': 'Include/cpython/*.h',
+    'internal': 'Include/internal/*.h',
+}
+
+
+def resolve_filename(filename):
+    orig = filename
+    filename = os.path.normcase(os.path.normpath(filename))
+    if os.path.isabs(filename):
+        if os.path.relpath(filename, REPO_ROOT).startswith('.'):
+            raise Exception(f'{orig!r} is outside the repo ({REPO_ROOT})')
+        return filename
+    else:
+        return os.path.join(REPO_ROOT, filename)
+
+
+def iter_filenames(*, search=False):
+    if search:
+        yield from iter_files_by_suffix(INCLUDE_DIRS, ('.h',))
+        yield from iter_files_by_suffix(SOURCE_DIRS, ('.c',))
+    else:
+        globs = (os.path.join(REPO_ROOT, file) for file in GLOBS)
+        yield from expand_filenames(globs)
+
+
+def iter_header_files(filenames=None, *, levels=None):
+    if not filenames:
+        if levels:
+            levels = set(levels)
+            if 'private' in levels:
+                levels.add('stable')
+                levels.add('cpython')
+            for level, glob in LEVEL_GLOBS.items():
+                if level in levels:
+                    yield from expand_filenames([glob])
+        else:
+            yield from iter_files_by_suffix(INCLUDE_DIRS, ('.h',))
+        return
+
+    for filename in filenames:
+        orig = filename
+        filename = resolve_filename(filename)
+        if filename.endswith(os.path.sep):
+            yield from iter_files_by_suffix(INCLUDE_DIRS, ('.h',))
+        elif filename.endswith('.h'):
+            yield filename
+        else:
+            # XXX Log it and continue instead?
+            raise ValueError(f'expected .h file, got {orig!r}')
diff --git a/Tools/c-analyzer/cpython/_generate.py b/Tools/c-analyzer/cpython/_generate.py
deleted file mode 100644
index 4c340ac..0000000
--- a/Tools/c-analyzer/cpython/_generate.py
+++ /dev/null
@@ -1,329 +0,0 @@
-# The code here consists of hacks for pre-populating the known.tsv file.
-
-from c_analyzer.parser.preprocessor import _iter_clean_lines
-from c_analyzer.parser.naive import (
-        iter_variables, parse_variable_declaration, find_variables,
-        )
-from c_analyzer.common.known import HEADER as KNOWN_HEADER
-from c_analyzer.common.info import UNKNOWN, ID
-from c_analyzer.variables import Variable
-from c_analyzer.util import write_tsv
-
-from . import SOURCE_DIRS, REPO_ROOT
-from .known import DATA_FILE as KNOWN_FILE
-from .files import iter_cpython_files
-
-
-POTS = ('char ', 'wchar_t ', 'int ', 'Py_ssize_t ')
-POTS += tuple('const ' + v for v in POTS)
-STRUCTS = ('PyTypeObject', 'PyObject', 'PyMethodDef', 'PyModuleDef', 'grammar')
-
-
-def _parse_global(line, funcname=None):
-    line = line.strip()
-    if line.startswith('static '):
-        if '(' in line and '[' not in line and ' = ' not in line:
-            return None, None
-        name, decl = parse_variable_declaration(line)
-    elif line.startswith(('Py_LOCAL(', 'Py_LOCAL_INLINE(')):
-        name, decl = parse_variable_declaration(line)
-    elif line.startswith('_Py_static_string('):
-        decl = line.strip(';').strip()
-        name = line.split('(')[1].split(',')[0].strip()
-    elif line.startswith('_Py_IDENTIFIER('):
-        decl = line.strip(';').strip()
-        name = 'PyId_' + line.split('(')[1].split(')')[0].strip()
-    elif funcname:
-        return None, None
-
-    # global-only
-    elif line.startswith('PyAPI_DATA('):  # only in .h files
-        name, decl = parse_variable_declaration(line)
-    elif line.startswith('extern '):  # only in .h files
-        name, decl = parse_variable_declaration(line)
-    elif line.startswith('PyDoc_VAR('):
-        decl = line.strip(';').strip()
-        name = line.split('(')[1].split(')')[0].strip()
-    elif line.startswith(POTS):  # implied static
-        if '(' in line and '[' not in line and ' = ' not in line:
-            return None, None
-        name, decl = parse_variable_declaration(line)
-    elif line.startswith(STRUCTS) and line.endswith(' = {'):  # implied static
-        name, decl = parse_variable_declaration(line)
-    elif line.startswith(STRUCTS) and line.endswith(' = NULL;'):  # implied static
-        name, decl = parse_variable_declaration(line)
-    elif line.startswith('struct '):
-        if not line.endswith(' = {'):
-            return None, None
-        if not line.partition(' ')[2].startswith(STRUCTS):
-            return None, None
-        # implied static
-        name, decl = parse_variable_declaration(line)
-
-    # file-specific
-    elif line.startswith(('SLOT1BINFULL(', 'SLOT1BIN(')):
-        # Objects/typeobject.c
-        funcname = line.split('(')[1].split(',')[0]
-        return [
-                ('op_id', funcname, '_Py_static_string(op_id, OPSTR)'),
-                ('rop_id', funcname, '_Py_static_string(op_id, OPSTR)'),
-                ]
-    elif line.startswith('WRAP_METHOD('):
-        # Objects/weakrefobject.c
-        funcname, name = (v.strip() for v in line.split('(')[1].split(')')[0].split(','))
-        return [
-                ('PyId_' + name, funcname, f'_Py_IDENTIFIER({name})'),
-                ]
-
-    else:
-        return None, None
-    return name, decl
-
-
-def _pop_cached(varcache, filename, funcname, name, *,
-                _iter_variables=iter_variables,
-                ):
-    # Look for the file.
-    try:
-        cached = varcache[filename]
-    except KeyError:
-        cached = varcache[filename] = {}
-        for variable in _iter_variables(filename,
-                                        parse_variable=_parse_global,
-                                        ):
-            variable._isglobal = True
-            cached[variable.id] = variable
-        for var in cached:
-            print(' ', var)
-
-    # Look for the variable.
-    if funcname == UNKNOWN:
-        for varid in cached:
-            if varid.name == name:
-                break
-        else:
-            return None
-        return cached.pop(varid)
-    else:
-        return cached.pop((filename, funcname, name), None)
-
-
-def find_matching_variable(varid, varcache, allfilenames, *,
-                           _pop_cached=_pop_cached,
-                           ):
-    if varid.filename and varid.filename != UNKNOWN:
-        filenames = [varid.filename]
-    else:
-        filenames = allfilenames
-    for filename in filenames:
-        variable = _pop_cached(varcache, filename, varid.funcname, varid.name)
-        if variable is not None:
-            return variable
-    else:
-        if varid.filename and varid.filename != UNKNOWN and varid.funcname is None:
-            for filename in allfilenames:
-                if not filename.endswith('.h'):
-                    continue
-                variable = _pop_cached(varcache, filename, None, varid.name)
-                if variable is not None:
-                    return variable
-        return None
-
-
-MULTILINE = {
-    # Python/Python-ast.c
-    'Load_singleton': 'PyObject *',
-    'Store_singleton': 'PyObject *',
-    'Del_singleton': 'PyObject *',
-    'AugLoad_singleton': 'PyObject *',
-    'AugStore_singleton': 'PyObject *',
-    'Param_singleton': 'PyObject *',
-    'And_singleton': 'PyObject *',
-    'Or_singleton': 'PyObject *',
-    'Add_singleton': 'static PyObject *',
-    'Sub_singleton': 'static PyObject *',
-    'Mult_singleton': 'static PyObject *',
-    'MatMult_singleton': 'static PyObject *',
-    'Div_singleton': 'static PyObject *',
-    'Mod_singleton': 'static PyObject *',
-    'Pow_singleton': 'static PyObject *',
-    'LShift_singleton': 'static PyObject *',
-    'RShift_singleton': 'static PyObject *',
-    'BitOr_singleton': 'static PyObject *',
-    'BitXor_singleton': 'static PyObject *',
-    'BitAnd_singleton': 'static PyObject *',
-    'FloorDiv_singleton': 'static PyObject *',
-    'Invert_singleton': 'static PyObject *',
-    'Not_singleton': 'static PyObject *',
-    'UAdd_singleton': 'static PyObject *',
-    'USub_singleton': 'static PyObject *',
-    'Eq_singleton': 'static PyObject *',
-    'NotEq_singleton': 'static PyObject *',
-    'Lt_singleton': 'static PyObject *',
-    'LtE_singleton': 'static PyObject *',
-    'Gt_singleton': 'static PyObject *',
-    'GtE_singleton': 'static PyObject *',
-    'Is_singleton': 'static PyObject *',
-    'IsNot_singleton': 'static PyObject *',
-    'In_singleton': 'static PyObject *',
-    'NotIn_singleton': 'static PyObject *',
-    # Python/symtable.c
-    'top': 'static identifier ',
-    'lambda': 'static identifier ',
-    'genexpr': 'static identifier ',
-    'listcomp': 'static identifier ',
-    'setcomp': 'static identifier ',
-    'dictcomp': 'static identifier ',
-    '__class__': 'static identifier ',
-    # Python/compile.c
-    '__doc__': 'static PyObject *',
-    '__annotations__': 'static PyObject *',
-    # Objects/floatobject.c
-    'double_format': 'static float_format_type ',
-    'float_format': 'static float_format_type ',
-    'detected_double_format': 'static float_format_type ',
-    'detected_float_format': 'static float_format_type ',
-    # Parser/listnode.c
-    'level': 'static int ',
-    'atbol': 'static int ',
-    # Python/dtoa.c
-    'private_mem': 'static double private_mem[PRIVATE_mem]',
-    'pmem_next': 'static double *',
-    # Modules/_weakref.c
-    'weakref_functions': 'static PyMethodDef ',
-}
-INLINE = {
-    # Modules/_tracemalloc.c
-    'allocators': 'static struct { PyMemAllocatorEx mem; PyMemAllocatorEx raw; PyMemAllocatorEx obj; } ',
-    # Modules/faulthandler.c
-    'fatal_error': 'static struct { int enabled; PyObject *file; int fd; int all_threads; PyInterpreterState *interp; void *exc_handler; } ',
-    'thread': 'static struct { PyObject *file; int fd; PY_TIMEOUT_T timeout_us; int repeat; PyInterpreterState *interp; int exit; char *header; size_t header_len; PyThread_type_lock cancel_event; PyThread_type_lock running; } ',
-    # Modules/signalmodule.c
-    'Handlers': 'static volatile struct { _Py_atomic_int tripped; PyObject *func; } Handlers[NSIG]',
-    'wakeup': 'static volatile struct { SOCKET_T fd; int warn_on_full_buffer; int use_send; } ',
-    # Python/dynload_shlib.c
-    'handles': 'static struct { dev_t dev; ino_t ino; void *handle; } handles[128]',
-    # Objects/obmalloc.c
-    '_PyMem_Debug': 'static struct { debug_alloc_api_t raw; debug_alloc_api_t mem; debug_alloc_api_t obj; } ',
-    # Python/bootstrap_hash.c
-    'urandom_cache': 'static struct { int fd; dev_t st_dev; ino_t st_ino; } ',
-    }
-FUNC = {
-    # Objects/object.c
-    '_Py_abstract_hack': 'Py_ssize_t (*_Py_abstract_hack)(PyObject *)',
-    # Parser/myreadline.c
-    'PyOS_InputHook': 'int (*PyOS_InputHook)(void)',
-    # Python/pylifecycle.c
-    '_PyOS_mystrnicmp_hack': 'int (*_PyOS_mystrnicmp_hack)(const char *, const char *, Py_ssize_t)',
-    # Parser/myreadline.c
-    'PyOS_ReadlineFunctionPointer': 'char *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, const char *)',
-    }
-IMPLIED = {
-    # Objects/boolobject.c
-    '_Py_FalseStruct': 'static struct _longobject ',
-    '_Py_TrueStruct': 'static struct _longobject ',
-    # Modules/config.c
-    '_PyImport_Inittab': 'struct _inittab _PyImport_Inittab[]',
-    }
-GLOBALS = {}
-GLOBALS.update(MULTILINE)
-GLOBALS.update(INLINE)
-GLOBALS.update(FUNC)
-GLOBALS.update(IMPLIED)
-
-LOCALS = {
-    'buildinfo': ('Modules/getbuildinfo.c',
-                  'Py_GetBuildInfo',
-                  'static char buildinfo[50 + sizeof(GITVERSION) + ((sizeof(GITTAG) > sizeof(GITBRANCH)) ?  sizeof(GITTAG) : sizeof(GITBRANCH))]'),
-    'methods': ('Python/codecs.c',
-                '_PyCodecRegistry_Init',
-                'static struct { char *name; PyMethodDef def; } methods[]'),
-    }
-
-
-def _known(symbol):
-    if symbol.funcname:
-        if symbol.funcname != UNKNOWN or symbol.filename != UNKNOWN:
-            raise KeyError(symbol.name)
-        filename, funcname, decl = LOCALS[symbol.name]
-        varid = ID(filename, funcname, symbol.name)
-    elif not symbol.filename or symbol.filename == UNKNOWN:
-        raise KeyError(symbol.name)
-    else:
-        varid = symbol.id
-        try:
-            decl = GLOBALS[symbol.name]
-        except KeyError:
-
-            if symbol.name.endswith('_methods'):
-                decl = 'static PyMethodDef '
-            elif symbol.filename == 'Objects/exceptions.c' and symbol.name.startswith(('PyExc_', '_PyExc_')):
-                decl = 'static PyTypeObject '
-            else:
-                raise
-    if symbol.name not in decl:
-        decl = decl + symbol.name
-    return Variable(varid, 'static', decl)
-
-
-def known_row(varid, decl):
-    return (
-            varid.filename,
-            varid.funcname or '-',
-            varid.name,
-            'variable',
-            decl,
-            )
-
-
-def known_rows(symbols, *,
-               cached=True,
-               _get_filenames=iter_cpython_files,
-               _find_match=find_matching_variable,
-               _find_symbols=find_variables,
-               _as_known=known_row,
-               ):
-    filenames = list(_get_filenames())
-    cache = {}
-    if cached:
-        for symbol in symbols:
-            try:
-                found = _known(symbol)
-            except KeyError:
-                found = _find_match(symbol, cache, filenames)
-                if found is None:
-                    found = Variable(symbol.id, UNKNOWN, UNKNOWN)
-            yield _as_known(found.id, found.vartype)
-    else:
-        raise NotImplementedError  # XXX incorporate KNOWN
-        for variable in _find_symbols(symbols, filenames,
-                                      srccache=cache,
-                                      parse_variable=_parse_global,
-                                      ):
-            #variable = variable._replace(
-            #    filename=os.path.relpath(variable.filename, REPO_ROOT))
-            if variable.funcname == UNKNOWN:
-                print(variable)
-            if variable.vartype== UNKNOWN:
-                print(variable)
-            yield _as_known(variable.id, variable.vartype)
-
-
-def generate(symbols, filename=None, *,
-             _generate_rows=known_rows,
-             _write_tsv=write_tsv,
-             ):
-    if not filename:
-        filename = KNOWN_FILE + '.new'
-
-    rows = _generate_rows(symbols)
-    _write_tsv(filename, KNOWN_HEADER, rows)
-
-
-if __name__ == '__main__':
-    from c_symbols import binary
-    symbols = binary.iter_symbols(
-            binary.PYTHON,
-            find_local_symbol=None,
-            )
-    generate(symbols)
diff --git a/Tools/c-analyzer/cpython/_parser.py b/Tools/c-analyzer/cpython/_parser.py
new file mode 100644
index 0000000..ef06a9f
--- /dev/null
+++ b/Tools/c-analyzer/cpython/_parser.py
@@ -0,0 +1,322 @@
+import os.path
+import re
+
+from c_parser.preprocessor import (
+    get_preprocessor as _get_preprocessor,
+)
+from c_parser import (
+    parse_file as _parse_file,
+    parse_files as _parse_files,
+)
+from . import REPO_ROOT
+
+
+GLOB_ALL = '**/*'
+
+
+def clean_lines(text):
+    """Clear out comments, blank lines, and leading/trailing whitespace."""
+    lines = (line.strip() for line in text.splitlines())
+    lines = (line.partition('#')[0].rstrip()
+             for line in lines
+             if line and not line.startswith('#'))
+    glob_all = f'{GLOB_ALL} '
+    lines = (re.sub(r'^[*] ', glob_all, line) for line in lines)
+    lines = (os.path.join(REPO_ROOT, line) for line in lines)
+    return list(lines)
+
+
+'''
+@begin=sh@
+./python ../c-parser/cpython.py
+    --exclude '+../c-parser/EXCLUDED'
+    --macros '+../c-parser/MACROS'
+    --incldirs '+../c-parser/INCL_DIRS'
+    --same './Include/cpython/'
+    Include/*.h
+    Include/internal/*.h
+    Modules/**/*.c
+    Objects/**/*.c
+    Parser/**/*.c
+    Python/**/*.c
+@end=sh@
+'''
+
+EXCLUDED = clean_lines('''
+# @begin=conf@
+
+# Rather than fixing for this one, we manually make sure it's okay.
+Modules/_sha3/kcp/KeccakP-1600-opt64.c
+
+# OSX
+#Modules/_ctypes/darwin/*.c
+#Modules/_ctypes/libffi_osx/*.c
+Modules/_scproxy.c                # SystemConfiguration/SystemConfiguration.h
+
+# Windows
+Modules/_winapi.c               # windows.h
+Modules/overlapped.c            # winsock.h
+Python/dynload_win.c            # windows.h
+Modules/expat/winconfig.h
+Python/thread_nt.h
+
+# other OS-dependent
+Python/dynload_dl.c             # dl.h
+Python/dynload_hpux.c           # dl.h
+Python/dynload_aix.c            # sys/ldr.h
+Python/thread_pthread.h
+
+# only huge constants (safe but parsing is slow)
+Modules/_ssl_data.h
+Modules/unicodedata_db.h
+Modules/unicodename_db.h
+Modules/cjkcodecs/mappings_*.h
+Objects/unicodetype_db.h
+Python/importlib.h
+Python/importlib_external.h
+Python/importlib_zipimport.h
+
+# @end=conf@
+''')
+
+# XXX Fix the parser.
+EXCLUDED += clean_lines('''
+# The tool should be able to parse these...
+
+Modules/hashlib.h
+Objects/stringlib/codecs.h
+Objects/stringlib/count.h
+Objects/stringlib/ctype.h
+Objects/stringlib/fastsearch.h
+Objects/stringlib/find.h
+Objects/stringlib/find_max_char.h
+Objects/stringlib/partition.h
+Objects/stringlib/replace.h
+Objects/stringlib/split.h
+
+Modules/_dbmmodule.c
+Modules/cjkcodecs/_codecs_*.c
+Modules/expat/xmlrole.c
+Modules/expat/xmlparse.c
+Python/initconfig.c
+''')
+
+INCL_DIRS = clean_lines('''
+# @begin=tsv@
+
+glob	dirname
+*	.
+*	./Include
+*	./Include/internal
+
+Modules/_tkinter.c	/usr/include/tcl8.6
+Modules/tkappinit.c	/usr/include/tcl
+Modules/_decimal/**/*.c	Modules/_decimal/libmpdec
+
+# @end=tsv@
+''')[1:]
+
+MACROS = clean_lines('''
+# @begin=tsv@
+
+glob	name	value
+
+Include/internal/*.h	Py_BUILD_CORE	1
+Python/**/*.c	Py_BUILD_CORE	1
+Parser/**/*.c	Py_BUILD_CORE	1
+Objects/**/*.c	Py_BUILD_CORE	1
+
+Modules/faulthandler.c	Py_BUILD_CORE	1
+Modules/_functoolsmodule.c	Py_BUILD_CORE	1
+Modules/gcmodule.c	Py_BUILD_CORE	1
+Modules/getpath.c	Py_BUILD_CORE	1
+Modules/_io/*.c	Py_BUILD_CORE	1
+Modules/itertoolsmodule.c	Py_BUILD_CORE	1
+Modules/_localemodule.c	Py_BUILD_CORE	1
+Modules/main.c	Py_BUILD_CORE	1
+Modules/posixmodule.c	Py_BUILD_CORE	1
+Modules/signalmodule.c	Py_BUILD_CORE	1
+Modules/_threadmodule.c	Py_BUILD_CORE	1
+Modules/_tracemalloc.c	Py_BUILD_CORE	1
+Modules/_asynciomodule.c	Py_BUILD_CORE	1
+Modules/mathmodule.c	Py_BUILD_CORE	1
+Modules/cmathmodule.c	Py_BUILD_CORE	1
+Modules/_weakref.c	Py_BUILD_CORE	1
+Modules/sha256module.c	Py_BUILD_CORE	1
+Modules/sha512module.c	Py_BUILD_CORE	1
+Modules/_datetimemodule.c	Py_BUILD_CORE	1
+Modules/_ctypes/cfield.c	Py_BUILD_CORE	1
+Modules/_heapqmodule.c	Py_BUILD_CORE	1
+Modules/_posixsubprocess.c	Py_BUILD_CORE	1
+Modules/_sre.c	Py_BUILD_CORE	1
+Modules/_collectionsmodule.c	Py_BUILD_CORE	1
+Modules/_zoneinfo.c	Py_BUILD_CORE	1
+Modules/unicodedata.c	Py_BUILD_CORE	1
+Modules/_cursesmodule.c	Py_BUILD_CORE	1
+Modules/_ctypes/_ctypes.c	Py_BUILD_CORE	1
+Objects/stringlib/codecs.h	Py_BUILD_CORE	1
+Python/ceval_gil.h	Py_BUILD_CORE	1
+Python/condvar.h	Py_BUILD_CORE	1
+
+Modules/_json.c	Py_BUILD_CORE_BUILTIN	1
+Modules/_pickle.c	Py_BUILD_CORE_BUILTIN	1
+Modules/_testinternalcapi.c	Py_BUILD_CORE_BUILTIN	1
+
+Include/cpython/abstract.h	Py_CPYTHON_ABSTRACTOBJECT_H	1
+Include/cpython/bytearrayobject.h	Py_CPYTHON_BYTEARRAYOBJECT_H	1
+Include/cpython/bytesobject.h	Py_CPYTHON_BYTESOBJECT_H	1
+Include/cpython/ceval.h	Py_CPYTHON_CEVAL_H	1
+Include/cpython/code.h	Py_CPYTHON_CODE_H	1
+Include/cpython/dictobject.h	Py_CPYTHON_DICTOBJECT_H	1
+Include/cpython/fileobject.h	Py_CPYTHON_FILEOBJECT_H	1
+Include/cpython/fileutils.h	Py_CPYTHON_FILEUTILS_H	1
+Include/cpython/frameobject.h	Py_CPYTHON_FRAMEOBJECT_H	1
+Include/cpython/import.h	Py_CPYTHON_IMPORT_H	1
+Include/cpython/interpreteridobject.h	Py_CPYTHON_INTERPRETERIDOBJECT_H	1
+Include/cpython/listobject.h	Py_CPYTHON_LISTOBJECT_H	1
+Include/cpython/methodobject.h	Py_CPYTHON_METHODOBJECT_H	1
+Include/cpython/object.h	Py_CPYTHON_OBJECT_H	1
+Include/cpython/objimpl.h	Py_CPYTHON_OBJIMPL_H	1
+Include/cpython/pyerrors.h	Py_CPYTHON_ERRORS_H	1
+Include/cpython/pylifecycle.h	Py_CPYTHON_PYLIFECYCLE_H	1
+Include/cpython/pymem.h	Py_CPYTHON_PYMEM_H	1
+Include/cpython/pystate.h	Py_CPYTHON_PYSTATE_H	1
+Include/cpython/sysmodule.h	Py_CPYTHON_SYSMODULE_H	1
+Include/cpython/traceback.h	Py_CPYTHON_TRACEBACK_H	1
+Include/cpython/tupleobject.h	Py_CPYTHON_TUPLEOBJECT_H	1
+Include/cpython/unicodeobject.h	Py_CPYTHON_UNICODEOBJECT_H	1
+
+# implied include of pyport.h
+Include/**/*.h	PyAPI_DATA(RTYPE)	extern RTYPE
+Include/**/*.h	PyAPI_FUNC(RTYPE)	RTYPE
+Include/**/*.h	Py_DEPRECATED(VER)	/* */
+Include/**/*.h	_Py_NO_RETURN	/* */
+Include/**/*.h	PYLONG_BITS_IN_DIGIT	30
+Modules/**/*.c	PyMODINIT_FUNC	PyObject*
+Objects/unicodeobject.c	PyMODINIT_FUNC	PyObject*
+Python/marshal.c	PyMODINIT_FUNC	PyObject*
+Python/_warnings.c	PyMODINIT_FUNC	PyObject*
+Python/Python-ast.c	PyMODINIT_FUNC	PyObject*
+Python/import.c	PyMODINIT_FUNC	PyObject*
+Modules/_testcapimodule.c	PyAPI_FUNC(RTYPE)	RTYPE
+Python/getargs.c	PyAPI_FUNC(RTYPE)	RTYPE
+Objects/stringlib/unicode_format.h	Py_LOCAL_INLINE(type)	static inline type
+
+# implied include of pymacro.h
+*/clinic/*.c.h	PyDoc_VAR(name)	static const char name[]
+*/clinic/*.c.h	PyDoc_STR(str)	str
+*/clinic/*.c.h	PyDoc_STRVAR(name,str)	PyDoc_VAR(name) = PyDoc_STR(str)
+
+# implied include of exports.h
+#Modules/_io/bytesio.c	Py_EXPORTED_SYMBOL	/* */
+
+# implied include of object.h
+Include/**/*.h	PyObject_HEAD	PyObject ob_base;
+Include/**/*.h	PyObject_VAR_HEAD	PyVarObject ob_base;
+
+# implied include of pyconfig.h
+Include/**/*.h	SIZEOF_WCHAR_T	4
+
+# implied include of <unistd.h>
+Include/**/*.h	_POSIX_THREADS	1
+
+# from Makefile
+Modules/getpath.c	PYTHONPATH	1
+Modules/getpath.c	PREFIX	...
+Modules/getpath.c	EXEC_PREFIX	...
+Modules/getpath.c	VERSION	...
+Modules/getpath.c	VPATH	...
+
+# from Modules/_sha3/sha3module.c
+Modules/_sha3/kcp/KeccakP-1600-inplace32BI.c	PLATFORM_BYTE_ORDER	4321  # force big-endian
+Modules/_sha3/kcp/*.c	KeccakOpt	64
+Modules/_sha3/kcp/*.c	KeccakP200_excluded	1
+Modules/_sha3/kcp/*.c	KeccakP400_excluded	1
+Modules/_sha3/kcp/*.c	KeccakP800_excluded	1
+
+# See: setup.py
+Modules/_decimal/**/*.c	CONFIG_64	1
+Modules/_decimal/**/*.c	ASM	1
+Modules/expat/xmlparse.c	HAVE_EXPAT_CONFIG_H	1
+Modules/expat/xmlparse.c	XML_POOR_ENTROPY	1
+Modules/_dbmmodule.c	HAVE_GDBM_DASH_NDBM_H	1
+
+# others
+Modules/sre_lib.h	LOCAL(type)	static inline type
+Modules/sre_lib.h	SRE(F)	sre_ucs2_##F
+Objects/stringlib/codecs.h	STRINGLIB_IS_UNICODE	1
+
+# @end=tsv@
+''')[1:]
+
+# -pthread
+# -Wno-unused-result
+# -Wsign-compare
+# -g
+# -Og
+# -Wall
+# -std=c99
+# -Wextra
+# -Wno-unused-result -Wno-unused-parameter
+# -Wno-missing-field-initializers
+# -Werror=implicit-function-declaration
+
+SAME = [
+    './Include/cpython/',
+]
+
+
+def get_preprocessor(*,
+                     file_macros=None,
+                     file_incldirs=None,
+                     file_same=None,
+                     **kwargs
+                     ):
+    macros = tuple(MACROS)
+    if file_macros:
+        macros += tuple(file_macros)
+    incldirs = tuple(INCL_DIRS)
+    if file_incldirs:
+        incldirs += tuple(file_incldirs)
+    return _get_preprocessor(
+        file_macros=macros,
+        file_incldirs=incldirs,
+        file_same=file_same,
+        **kwargs
+    )
+
+
+def parse_file(filename, *,
+               match_kind=None,
+               ignore_exc=None,
+               log_err=None,
+               ):
+    get_file_preprocessor = get_preprocessor(
+        ignore_exc=ignore_exc,
+        log_err=log_err,
+    )
+    yield from _parse_file(
+        filename,
+        match_kind=match_kind,
+        get_file_preprocessor=get_file_preprocessor,
+    )
+
+
+def parse_files(filenames=None, *,
+                match_kind=None,
+                ignore_exc=None,
+                log_err=None,
+                get_file_preprocessor=None,
+                **file_kwargs
+                ):
+    if get_file_preprocessor is None:
+        get_file_preprocessor = get_preprocessor(
+            ignore_exc=ignore_exc,
+            log_err=log_err,
+        )
+    yield from _parse_files(
+        filenames,
+        match_kind=match_kind,
+        get_file_preprocessor=get_file_preprocessor,
+        **file_kwargs
+    )
diff --git a/Tools/c-analyzer/cpython/files.py b/Tools/c-analyzer/cpython/files.py
deleted file mode 100644
index 543097a..0000000
--- a/Tools/c-analyzer/cpython/files.py
+++ /dev/null
@@ -1,29 +0,0 @@
-from c_analyzer.common.files import (
-        C_SOURCE_SUFFIXES, walk_tree, iter_files_by_suffix,
-        )
-
-from . import SOURCE_DIRS, REPO_ROOT
-
-# XXX need tests:
-# * iter_files()
-
-
-def iter_files(*,
-               walk=walk_tree,
-               _files=iter_files_by_suffix,
-               ):
-    """Yield each file in the tree for each of the given directory names."""
-    excludedtrees = [
-        os.path.join('Include', 'cpython', ''),
-        ]
-    def is_excluded(filename):
-        for root in excludedtrees:
-            if filename.startswith(root):
-                return True
-        return False
-    for filename in _files(SOURCE_DIRS, C_SOURCE_SUFFIXES, REPO_ROOT,
-                           walk=walk,
-                           ):
-        if is_excluded(filename):
-            continue
-        yield filename
diff --git a/Tools/c-analyzer/cpython/find.py b/Tools/c-analyzer/cpython/find.py
deleted file mode 100644
index a7bc0b4..0000000
--- a/Tools/c-analyzer/cpython/find.py
+++ /dev/null
@@ -1,101 +0,0 @@
-import os.path
-
-from c_analyzer.common import files
-from c_analyzer.common.info import UNKNOWN, ID
-from c_analyzer.variables import find as _common
-
-from . import SOURCE_DIRS, PYTHON, REPO_ROOT
-from .known import (
-    from_file as known_from_file,
-    DATA_FILE as KNOWN_FILE,
-    )
-from .supported import (
-        ignored_from_file, IGNORED_FILE, is_supported, _is_object,
-        )
-
-# XXX need tests:
-# * vars_from_binary()
-# * vars_from_source()
-# * supported_vars()
-
-
-def _handle_id(filename, funcname, name, *,
-               _relpath=os.path.relpath,
-               ):
-    filename = _relpath(filename, REPO_ROOT)
-    return ID(filename, funcname, name)
-
-
-def vars_from_binary(*,
-                     known=KNOWN_FILE,
-                     _known_from_file=known_from_file,
-                     _iter_files=files.iter_files_by_suffix,
-                     _iter_vars=_common.vars_from_binary,
-                     ):
-    """Yield a Variable for each found Symbol.
-
-    Details are filled in from the given "known" variables and types.
-    """
-    if isinstance(known, str):
-        known = _known_from_file(known)
-    dirnames = SOURCE_DIRS
-    suffixes = ('.c',)
-    filenames = _iter_files(dirnames, suffixes)
-    # XXX For now we only use known variables (no source lookup).
-    filenames = None
-    yield from _iter_vars(PYTHON,
-                          known=known,
-                          filenames=filenames,
-                          handle_id=_handle_id,
-                          check_filename=(lambda n: True),
-                          )
-
-
-def vars_from_source(*,
-                     preprocessed=None,
-                     known=KNOWN_FILE,
-                     _known_from_file=known_from_file,
-                     _iter_files=files.iter_files_by_suffix,
-                     _iter_vars=_common.vars_from_source,
-                     ):
-    """Yield a Variable for each declaration in the raw source code.
-
-    Details are filled in from the given "known" variables and types.
-    """
-    if isinstance(known, str):
-        known = _known_from_file(known)
-    dirnames = SOURCE_DIRS
-    suffixes = ('.c',)
-    filenames = _iter_files(dirnames, suffixes)
-    yield from _iter_vars(filenames,
-                          preprocessed=preprocessed,
-                          known=known,
-                          handle_id=_handle_id,
-                          )
-
-
-def supported_vars(*,
-                   known=KNOWN_FILE,
-                   ignored=IGNORED_FILE,
-                   skip_objects=False,
-                   _known_from_file=known_from_file,
-                   _ignored_from_file=ignored_from_file,
-                   _iter_vars=vars_from_binary,
-                   _is_supported=is_supported,
-                   ):
-    """Yield (var, is supported) for each found variable."""
-    if isinstance(known, str):
-        known = _known_from_file(known)
-    if isinstance(ignored, str):
-        ignored = _ignored_from_file(ignored)
-
-    for var in _iter_vars(known=known):
-        if not var.isglobal:
-            continue
-        elif var.vartype == UNKNOWN:
-            yield var, None
-        # XXX Support proper filters instead.
-        elif skip_objects and _is_object(found.vartype):
-            continue
-        else:
-            yield var, _is_supported(var, ignored, known)
diff --git a/Tools/c-analyzer/cpython/ignored.tsv b/Tools/c-analyzer/cpython/ignored.tsv
new file mode 100644
index 0000000..91867ca
--- /dev/null
+++ b/Tools/c-analyzer/cpython/ignored.tsv
@@ -0,0 +1,2938 @@
+filename	funcname	name	reason
+#???	-	somevar	???
+
+# XXX The analyzer should have ignored these (forward/extern references):
+Include/py_curses.h	-	PyCurses_API	-
+Include/pydecimal.h	-	_decimal_api	-
+Modules/_blake2/blake2module.c	-	blake2b_type_spec	-
+Modules/_blake2/blake2module.c	-	blake2s_type_spec	-
+Modules/_io/fileio.c	-	_Py_open_cloexec_works	-
+Modules/_io/_iomodule.h	-	PyIOBase_Type	-
+Modules/_io/_iomodule.h	-	PyRawIOBase_Type	-
+Modules/_io/_iomodule.h	-	PyBufferedIOBase_Type	-
+Modules/_io/_iomodule.h	-	PyTextIOBase_Type	-
+Modules/_io/_iomodule.h	-	PyFileIO_Type	-
+Modules/_io/_iomodule.h	-	PyBytesIO_Type	-
+Modules/_io/_iomodule.h	-	PyStringIO_Type	-
+Modules/_io/_iomodule.h	-	PyBufferedReader_Type	-
+Modules/_io/_iomodule.h	-	PyBufferedWriter_Type	-
+Modules/_io/_iomodule.h	-	PyBufferedRWPair_Type	-
+Modules/_io/_iomodule.h	-	PyBufferedRandom_Type	-
+Modules/_io/_iomodule.h	-	PyTextIOWrapper_Type	-
+Modules/_io/_iomodule.h	-	PyIncrementalNewlineDecoder_Type	-
+Modules/_io/_iomodule.h	-	_PyBytesIOBuffer_Type	-
+Modules/_io/_iomodule.h	-	_PyIO_str_close	-
+Modules/_io/_iomodule.h	-	_PyIO_str_closed	-
+Modules/_io/_iomodule.h	-	_PyIO_str_decode	-
+Modules/_io/_iomodule.h	-	_PyIO_str_encode	-
+Modules/_io/_iomodule.h	-	_PyIO_str_fileno	-
+Modules/_io/_iomodule.h	-	_PyIO_str_flush	-
+Modules/_io/_iomodule.h	-	_PyIO_str_getstate	-
+Modules/_io/_iomodule.h	-	_PyIO_str_isatty	-
+Modules/_io/_iomodule.h	-	_PyIO_str_newlines	-
+Modules/_io/_iomodule.h	-	_PyIO_str_nl	-
+Modules/_io/_iomodule.h	-	_PyIO_str_peek	-
+Modules/_io/_iomodule.h	-	_PyIO_str_read	-
+Modules/_io/_iomodule.h	-	_PyIO_str_read1	-
+Modules/_io/_iomodule.h	-	_PyIO_str_readable	-
+Modules/_io/_iomodule.h	-	_PyIO_str_readall	-
+Modules/_io/_iomodule.h	-	_PyIO_str_readinto	-
+Modules/_io/_iomodule.h	-	_PyIO_str_readline	-
+Modules/_io/_iomodule.h	-	_PyIO_str_reset	-
+Modules/_io/_iomodule.h	-	_PyIO_str_seek	-
+Modules/_io/_iomodule.h	-	_PyIO_str_seekable	-
+Modules/_io/_iomodule.h	-	_PyIO_str_setstate	-
+Modules/_io/_iomodule.h	-	_PyIO_str_tell	-
+Modules/_io/_iomodule.h	-	_PyIO_str_truncate	-
+Modules/_io/_iomodule.h	-	_PyIO_str_writable	-
+Modules/_io/_iomodule.h	-	_PyIO_str_write	-
+Modules/_io/_iomodule.h	-	_PyIO_empty_str	-
+Modules/_io/_iomodule.h	-	_PyIO_empty_bytes	-
+Modules/_multiprocessing/multiprocessing.h	-	_PyMp_SemLockType	-
+Modules/_sqlite/cache.h	-	pysqlite_NodeType	-
+Modules/_sqlite/cache.h	-	pysqlite_CacheType	-
+Modules/_sqlite/cursor.h	-	pysqlite_CursorType	-
+Modules/_sqlite/row.h	-	pysqlite_RowType	-
+Modules/_sqlite/prepare_protocol.h	-	pysqlite_PrepareProtocolType	-
+Modules/_sqlite/statement.h	-	pysqlite_StatementType	-
+Modules/_sqlite/connection.h	-	pysqlite_ConnectionType	-
+Modules/_sqlite/module.c	-	pysqlite_Error	-
+Modules/_sqlite/module.c	-	pysqlite_Warning	-
+Modules/_sqlite/module.c	-	pysqlite_InterfaceError	-
+Modules/_sqlite/module.c	-	pysqlite_DatabaseError	-
+Modules/_sqlite/module.c	-	pysqlite_InternalError	-
+Modules/_sqlite/module.c	-	pysqlite_OperationalError	-
+Modules/_sqlite/module.c	-	pysqlite_ProgrammingError	-
+Modules/_sqlite/module.c	-	pysqlite_IntegrityError	-
+Modules/_sqlite/module.c	-	pysqlite_DataError	-
+Modules/_sqlite/module.c	-	pysqlite_NotSupportedError	-
+Modules/_sqlite/module.c	-	_pysqlite_converters	-
+Modules/_sqlite/module.c	-	_pysqlite_enable_callback_tracebacks	-
+Modules/_sqlite/module.c	-	pysqlite_BaseTypeAdapted	-
+Modules/_testcapimodule.c	-	_PyBytesIOBuffer_Type	-
+Modules/posixmodule.c	-	_Py_open_cloexec_works	-
+Python/importdl.h	-	_PyImport_DynLoadFiletab	-
+
+
+##################################
+# test code
+# []
+
+Modules/_ctypes/_ctypes_test.c	-	_ctypes_test_slots	-
+Modules/_ctypes/_ctypes_test.c	-	module_methods	-
+Modules/_ctypes/_ctypes_test.c	-	my_spams	-
+Modules/_ctypes/_ctypes_test.c	-	my_eggs	-
+Modules/_ctypes/_ctypes_test.c	-	an_integer	-
+Modules/_ctypes/_ctypes_test.c	-	_xxx_lib	-
+Modules/_ctypes/_ctypes_test.c	-	left	-
+Modules/_ctypes/_ctypes_test.c	-	top	-
+Modules/_ctypes/_ctypes_test.c	-	right	-
+Modules/_ctypes/_ctypes_test.c	-	bottom	-
+Modules/_ctypes/_ctypes_test.c	-	_ctypes_testmodule	-
+Modules/_ctypes/_ctypes_test.c	-	last_tfrsuv_arg	-
+Modules/_ctypes/_ctypes_test.c	-	last_tf_arg_s	-
+Modules/_ctypes/_ctypes_test.c	-	last_tf_arg_u	-
+Modules/_testbuffer.c	-	simple_format	-
+Modules/_testbuffer.c	-	static_mem	-
+Modules/_testbuffer.c	-	static_shape	-
+Modules/_testbuffer.c	-	static_strides	-
+Modules/_testbuffer.c	-	NDArray_Type	-
+Modules/_testbuffer.c	-	StaticArray_Type	-
+Modules/_testbuffer.c	ndarray_init	kwlist	-
+Modules/_testbuffer.c	ndarray_push	kwlist	-
+Modules/_testbuffer.c	staticarray_init	kwlist	-
+Modules/_testbuffer.c	-	ndarray_methods	-
+Modules/_testbuffer.c	-	_testbuffer_functions	-
+Modules/_testbuffer.c	-	ndarray_getset	-
+Modules/_testbuffer.c	-	ndarray_as_buffer	-
+Modules/_testbuffer.c	-	staticarray_as_buffer	-
+Modules/_testbuffer.c	-	ndarray_as_sequence	-
+Modules/_testbuffer.c	-	ndarray_as_mapping	-
+Modules/_testbuffer.c	-	structmodule	-
+Modules/_testbuffer.c	-	_testbuffermodule	-
+Modules/_testbuffer.c	-	Struct	-
+Modules/_testbuffer.c	-	calcsize	-
+Modules/_testbuffer.c	-	simple_fmt	-
+Modules/_testbuffer.c	-	static_buffer	-
+Modules/_testbuffer.c	ndarray_memoryview_from_buffer	format	-
+Modules/_testbuffer.c	ndarray_memoryview_from_buffer	shape	-
+Modules/_testbuffer.c	ndarray_memoryview_from_buffer	strides	-
+Modules/_testbuffer.c	ndarray_memoryview_from_buffer	suboffsets	-
+Modules/_testbuffer.c	ndarray_memoryview_from_buffer	info	-
+Modules/_testbuffer.c	-	infobuf	-
+Modules/_testcapimodule.c	-	TestError	-
+Modules/_testcapimodule.c	test_capsule	buffer	-
+Modules/_testcapimodule.c	-	decimal_initialized	-
+Modules/_testcapimodule.c	-	thread_done	-
+Modules/_testcapimodule.c	-	capsule_error	-
+Modules/_testcapimodule.c	-	capsule_destructor_call_count	-
+Modules/_testcapimodule.c	-	str1	-
+Modules/_testcapimodule.c	-	str2	-
+Modules/_testcapimodule.c	-	test_run_counter	-
+Modules/_testcapimodule.c	-	FmHook	-
+Modules/_testcapimodule.c	-	FmData	-
+Modules/_testcapimodule.c	-	_testcapimodule	-
+Modules/_testcapimodule.c	-	_HashInheritanceTester_Type	-
+Modules/_testcapimodule.c	-	test_structmembersType	-
+Modules/_testcapimodule.c	-	matmulType	-
+Modules/_testcapimodule.c	-	ipowType	-
+Modules/_testcapimodule.c	-	awaitType	-
+Modules/_testcapimodule.c	-	PyRecursingInfinitelyError_Type	-
+Modules/_testcapimodule.c	-	MyList_Type	-
+Modules/_testcapimodule.c	-	GenericAlias_Type	-
+Modules/_testcapimodule.c	-	Generic_Type	-
+Modules/_testcapimodule.c	-	MethodDescriptorBase_Type	-
+Modules/_testcapimodule.c	-	MethodDescriptorDerived_Type	-
+Modules/_testcapimodule.c	-	MethodDescriptorNopGet_Type	-
+Modules/_testcapimodule.c	-	MethodDescriptor2_Type	-
+Modules/_testcapimodule.c	-	MethInstance_Type	-
+Modules/_testcapimodule.c	-	MethClass_Type	-
+Modules/_testcapimodule.c	-	MethStatic_Type	-
+Modules/_testcapimodule.c	-	ContainerNoGC_type	-
+Modules/_testcapimodule.c	slot_tp_del	PyId___tp_del__	-
+Modules/_testcapimodule.c	raise_SIGINT_then_send_None	PyId_send	-
+Modules/_testcapimodule.c	-	HeapDocCType_spec	-
+Modules/_testcapimodule.c	-	HeapGcCType_spec	-
+Modules/_testcapimodule.c	-	HeapCType_spec	-
+Modules/_testcapimodule.c	-	HeapCTypeSubclass_spec	-
+Modules/_testcapimodule.c	-	HeapCTypeWithBuffer_spec	-
+Modules/_testcapimodule.c	-	HeapCTypeSubclassWithFinalizer_spec	-
+Modules/_testcapimodule.c	-	HeapCTypeWithDict_spec	-
+Modules/_testcapimodule.c	-	HeapCTypeWithNegativeDict_spec	-
+Modules/_testcapimodule.c	-	HeapCTypeWithWeakref_spec	-
+Modules/_testcapimodule.c	-	HeapCTypeSetattr_spec	-
+Modules/_testcapimodule.c	-	capsule_name	-
+Modules/_testcapimodule.c	-	capsule_pointer	-
+Modules/_testcapimodule.c	-	capsule_context	-
+Modules/_testcapimodule.c	-	x	-
+Modules/_testcapimodule.c	getargs_keyword_only	keywords	-
+Modules/_testcapimodule.c	getargs_keywords	keywords	-
+Modules/_testcapimodule.c	getargs_positional_only_and_keywords	keywords	-
+Modules/_testcapimodule.c	make_exception_with_doc	kwlist	-
+Modules/_testcapimodule.c	test_empty_argparse	kwlist	-
+Modules/_testcapimodule.c	test_structmembers_new	keywords	-
+Modules/_testcapimodule.c	-	ml	-
+Modules/_testcapimodule.c	-	TestMethods	-
+Modules/_testcapimodule.c	-	generic_alias_methods	-
+Modules/_testcapimodule.c	-	generic_methods	-
+Modules/_testcapimodule.c	-	meth_instance_methods	-
+Modules/_testcapimodule.c	-	meth_class_methods	-
+Modules/_testcapimodule.c	-	meth_static_methods	-
+Modules/_testcapimodule.c	-	test_members	-
+Modules/_testcapimodule.c	-	heapctype_members	-
+Modules/_testcapimodule.c	-	heapctypesubclass_members	-
+Modules/_testcapimodule.c	-	heapctypewithdict_members	-
+Modules/_testcapimodule.c	-	heapctypewithnegativedict_members	-
+Modules/_testcapimodule.c	-	heapctypewithweakref_members	-
+Modules/_testcapimodule.c	-	heapctypesetattr_members	-
+Modules/_testcapimodule.c	-	ContainerNoGC_members	-
+Modules/_testcapimodule.c	-	matmulType_as_number	-
+Modules/_testcapimodule.c	-	ipowType_as_number	-
+Modules/_testcapimodule.c	-	awaitType_as_async	-
+Modules/_testcapimodule.c	-	heapctypewithdict_getsetlist	-
+Modules/_testcapimodule.c	-	HeapDocCType_slots	-
+Modules/_testcapimodule.c	-	HeapGcCType_slots	-
+Modules/_testcapimodule.c	-	HeapCType_slots	-
+Modules/_testcapimodule.c	-	HeapCTypeSubclass_slots	-
+Modules/_testcapimodule.c	-	HeapCTypeWithBuffer_slots	-
+Modules/_testcapimodule.c	-	HeapCTypeSubclassWithFinalizer_slots	-
+Modules/_testcapimodule.c	-	HeapCTypeWithDict_slots	-
+Modules/_testcapimodule.c	-	HeapCTypeWithNegativeDict_slots	-
+Modules/_testcapimodule.c	-	HeapCTypeWithWeakref_slots	-
+Modules/_testcapimodule.c	-	HeapCTypeSetattr_slots	-
+Modules/_testimportmultiple.c	-	_foomodule	-
+Modules/_testimportmultiple.c	-	_barmodule	-
+Modules/_testimportmultiple.c	-	_testimportmultiple	-
+Modules/_testinternalcapi.c	-	_testcapimodule	-
+Modules/_testinternalcapi.c	-	TestMethods	-
+Modules/_testmultiphase.c	-	slots_create_nonmodule	-
+Modules/_testmultiphase.c	-	def_nonmodule	-
+Modules/_testmultiphase.c	-	main_def	-
+Modules/_testmultiphase.c	-	def_nonmodule_with_methods	-
+Modules/_testmultiphase.c	-	def_nonascii_latin	-
+Modules/_testmultiphase.c	-	def_nonascii_kana	-
+Modules/_testmultiphase.c	-	null_slots_def	-
+Modules/_testmultiphase.c	-	def_bad_large	-
+Modules/_testmultiphase.c	-	def_bad_negative	-
+Modules/_testmultiphase.c	-	def_create_int_with_state	-
+Modules/_testmultiphase.c	-	def_negative_size	-
+Modules/_testmultiphase.c	-	uninitialized_def	-
+Modules/_testmultiphase.c	-	def_create_null	-
+Modules/_testmultiphase.c	-	def_create_raise	-
+Modules/_testmultiphase.c	-	def_create_unreported_exception	-
+Modules/_testmultiphase.c	-	def_nonmodule_with_exec_slots	-
+Modules/_testmultiphase.c	-	def_exec_err	-
+Modules/_testmultiphase.c	-	def_exec_raise	-
+Modules/_testmultiphase.c	-	def_exec_unreported_exception	-
+Modules/_testmultiphase.c	-	def_meth_state_access	-
+Modules/_testmultiphase.c	-	imp_dummy_def	-
+Modules/_testmultiphase.c	-	Example_Type_slots	-
+Modules/_testmultiphase.c	-	StateAccessType_Type_slots	-
+Modules/_testmultiphase.c	-	Str_Type_slots	-
+Modules/_testmultiphase.c	-	main_slots	-
+Modules/_testmultiphase.c	-	slots_create_nonmodule	-
+Modules/_testmultiphase.c	-	slots_bad_large	-
+Modules/_testmultiphase.c	-	slots_bad_negative	-
+Modules/_testmultiphase.c	-	slots_create_null	-
+Modules/_testmultiphase.c	-	slots_create_raise	-
+Modules/_testmultiphase.c	-	slots_create_unreported_exception	-
+Modules/_testmultiphase.c	-	slots_nonmodule_with_exec_slots	-
+Modules/_testmultiphase.c	-	slots_exec_err	-
+Modules/_testmultiphase.c	-	slots_exec_raise	-
+Modules/_testmultiphase.c	-	slots_exec_unreported_exception	-
+Modules/_testmultiphase.c	-	meth_state_access_slots	-
+Modules/_testmultiphase.c	-	Example_methods	-
+Modules/_testmultiphase.c	-	StateAccessType_methods	-
+Modules/_testmultiphase.c	-	testexport_methods	-
+Modules/_testmultiphase.c	-	nonmodule_methods	-
+Modules/_testmultiphase.c	-	Example_Type_spec	-
+Modules/_testmultiphase.c	-	StateAccessType_spec	-
+Modules/_testmultiphase.c	-	Str_Type_spec	-
+Modules/_xxtestfuzz/_xxtestfuzz.c	-	module_methods	-
+Modules/_xxtestfuzz/_xxtestfuzz.c	-	_fuzzmodule	-
+Modules/_xxtestfuzz/fuzzer.c	-	csv_module	-
+Modules/_xxtestfuzz/fuzzer.c	-	regex_patterns	-
+Modules/_xxtestfuzz/fuzzer.c	-	struct_unpack_method	-
+Modules/_xxtestfuzz/fuzzer.c	-	struct_error	-
+Modules/_xxtestfuzz/fuzzer.c	-	json_loads_method	-
+Modules/_xxtestfuzz/fuzzer.c	-	sre_compile_method	-
+Modules/_xxtestfuzz/fuzzer.c	-	sre_error_exception	-
+Modules/_xxtestfuzz/fuzzer.c	-	compiled_patterns	-
+Modules/_xxtestfuzz/fuzzer.c	-	csv_error	-
+Modules/_xxtestfuzz/fuzzer.c	-	SRE_FLAG_DEBUG	-
+Modules/_xxtestfuzz/fuzzer.c	LLVMFuzzerTestOneInput	STRUCT_UNPACK_INITIALIZED	-
+Modules/_xxtestfuzz/fuzzer.c	LLVMFuzzerTestOneInput	JSON_LOADS_INITIALIZED	-
+Modules/_xxtestfuzz/fuzzer.c	LLVMFuzzerTestOneInput	SRE_COMPILE_INITIALIZED	-
+Modules/_xxtestfuzz/fuzzer.c	LLVMFuzzerTestOneInput	SRE_MATCH_INITIALIZED	-
+Modules/_xxtestfuzz/fuzzer.c	LLVMFuzzerTestOneInput	CSV_READER_INITIALIZED	-
+
+
+##################################
+# temporary whitelist - should be const
+
+# These are all variables that we will be making non-global.
+
+#-----------------------
+# keywords for PyArg_ParseTupleAndKeywords()
+# "static char *name[]" -> "static const char * const name[]"
+# []
+
+Modules/cjkcodecs/multibytecodec.c	-	incnewkwarglist	-
+Modules/cjkcodecs/multibytecodec.c	-	streamkwarglist	-
+Modules/_csv.c	-	dialect_kws	-
+Modules/_datetimemodule.c	date_fromisocalendar	keywords	-
+Modules/_datetimemodule.c	-	date_kws	-
+Modules/_datetimemodule.c	date_strftime	keywords	-
+Modules/_datetimemodule.c	datetime_astimezone	keywords	-
+Modules/_datetimemodule.c	datetime_combine	keywords	-
+Modules/_datetimemodule.c	datetime_fromtimestamp	keywords	-
+Modules/_datetimemodule.c	datetime_isoformat	keywords	-
+Modules/_datetimemodule.c	-	datetime_kws	-
+Modules/_datetimemodule.c	delta_new	keywords	-
+Modules/_datetimemodule.c	time_isoformat	keywords	-
+Modules/_datetimemodule.c	-	time_kws	-
+Modules/_datetimemodule.c	time_strftime	keywords	-
+Modules/_datetimemodule.c	-	timezone_kws	-
+Modules/_decimal/_decimal.c	context_init	kwlist	-
+Modules/_decimal/_decimal.c	ctxmanager_new	kwlist	-
+Modules/_decimal/_decimal.c	ctx_mpd_qpow	kwlist	-
+Modules/_decimal/_decimal.c	dec_mpd_class	kwlist	-
+Modules/_decimal/_decimal.c	dec_mpd_compare_total	kwlist	-
+Modules/_decimal/_decimal.c	dec_mpd_compare_total_mag	kwlist	-
+Modules/_decimal/_decimal.c	dec_mpd_isnormal	kwlist	-
+Modules/_decimal/_decimal.c	dec_mpd_issubnormal	kwlist	-
+Modules/_decimal/_decimal.c	dec_mpd_qand	kwlist	-
+Modules/_decimal/_decimal.c	dec_mpd_qcompare	kwlist	-
+Modules/_decimal/_decimal.c	dec_mpd_qcompare_signal	kwlist	-
+Modules/_decimal/_decimal.c	dec_mpd_qcopy_sign	kwlist	-
+Modules/_decimal/_decimal.c	dec_mpd_qexp	kwlist	-
+Modules/_decimal/_decimal.c	dec_mpd_qfma	kwlist	-
+Modules/_decimal/_decimal.c	dec_mpd_qinvert	kwlist	-
+Modules/_decimal/_decimal.c	dec_mpd_qln	kwlist	-
+Modules/_decimal/_decimal.c	dec_mpd_qlog10	kwlist	-
+Modules/_decimal/_decimal.c	dec_mpd_qlogb	kwlist	-
+Modules/_decimal/_decimal.c	dec_mpd_qmax	kwlist	-
+Modules/_decimal/_decimal.c	dec_mpd_qmax_mag	kwlist	-
+Modules/_decimal/_decimal.c	dec_mpd_qmin	kwlist	-
+Modules/_decimal/_decimal.c	dec_mpd_qmin_mag	kwlist	-
+Modules/_decimal/_decimal.c	dec_mpd_qnext_minus	kwlist	-
+Modules/_decimal/_decimal.c	dec_mpd_qnext_plus	kwlist	-
+Modules/_decimal/_decimal.c	dec_mpd_qnext_toward	kwlist	-
+Modules/_decimal/_decimal.c	dec_mpd_qor	kwlist	-
+Modules/_decimal/_decimal.c	dec_mpd_qquantize	kwlist	-
+Modules/_decimal/_decimal.c	dec_mpd_qreduce	kwlist	-
+Modules/_decimal/_decimal.c	dec_mpd_qrem_near	kwlist	-
+Modules/_decimal/_decimal.c	dec_mpd_qrotate	kwlist	-
+Modules/_decimal/_decimal.c	dec_mpd_qscaleb	kwlist	-
+Modules/_decimal/_decimal.c	dec_mpd_qshift	kwlist	-
+Modules/_decimal/_decimal.c	dec_mpd_qsqrt	kwlist	-
+Modules/_decimal/_decimal.c	dec_mpd_qxor	kwlist	-
+Modules/_decimal/_decimal.c	dec_mpd_same_quantum	kwlist	-
+Modules/_decimal/_decimal.c	dec_mpd_to_eng	kwlist	-
+Modules/_decimal/_decimal.c	dec_new	kwlist	-
+Modules/_decimal/_decimal.c	PyDec_ToIntegralExact	kwlist	-
+Modules/_decimal/_decimal.c	PyDec_ToIntegralValue	kwlist	-
+Modules/_elementtree.c	element_setstate_from_Python	kwlist	-
+Modules/faulthandler.c	faulthandler_dump_traceback_later	kwlist	-
+Modules/faulthandler.c	faulthandler_dump_traceback_py	kwlist	-
+Modules/faulthandler.c	faulthandler_py_enable	kwlist	-
+Modules/faulthandler.c	faulthandler_register_py	kwlist	-
+Modules/_functoolsmodule.c	functools_cmp_to_key	kwargs	-
+Modules/_functoolsmodule.c	keyobject_call	kwargs	-
+Modules/_functoolsmodule.c	lru_cache_new	keywords	-
+Modules/itertoolsmodule.c	repeat_new	kwargs	-
+Modules/_json.c	encoder_call	kwlist	-
+Modules/_json.c	encoder_new	kwlist	-
+Modules/_json.c	scanner_call	kwlist	-
+Modules/_json.c	scanner_new	kwlist	-
+Modules/_lsprof.c	profiler_enable	kwlist	-
+Modules/_lsprof.c	profiler_init	kwlist	-
+Modules/_lzmamodule.c	Compressor_init	arg_names	-
+Modules/_lzmamodule.c	parse_filter_spec_bcj	optnames	-
+Modules/_lzmamodule.c	parse_filter_spec_delta	optnames	-
+Modules/_lzmamodule.c	parse_filter_spec_lzma	optnames	-
+Modules/mmapmodule.c	new_mmap_object	keywords	-
+Modules/nismodule.c	nis_cat	kwlist	-
+Modules/nismodule.c	nis_maps	kwlist	-
+Modules/nismodule.c	nis_match	kwlist	-
+Modules/signalmodule.c	signal_set_wakeup_fd	kwlist	-
+Modules/socketmodule.c	sock_initobj	keywords	-
+Modules/socketmodule.c	sock_recvfrom_into	kwlist	-
+Modules/socketmodule.c	sock_recv_into	kwlist	-
+Modules/socketmodule.c	sock_sendmsg_afalg	keywords	-
+Modules/socketmodule.c	socket_getaddrinfo	kwnames	-
+Modules/_sqlite/connection.c	pysqlite_connection_backup	keywords	-
+Modules/_sqlite/connection.c	pysqlite_connection_create_aggregate	kwlist	-
+Modules/_sqlite/connection.c	pysqlite_connection_create_function	kwlist	-
+Modules/_sqlite/connection.c	pysqlite_connection_cursor	kwlist	-
+Modules/_sqlite/connection.c	pysqlite_connection_init	kwlist	-
+Modules/_sqlite/connection.c	pysqlite_connection_set_authorizer	kwlist	-
+Modules/_sqlite/connection.c	pysqlite_connection_set_progress_handler	kwlist	-
+Modules/_sqlite/connection.c	pysqlite_connection_set_trace_callback	kwlist	-
+Modules/_sqlite/cursor.c	pysqlite_cursor_fetchmany	kwlist	-
+Modules/_sqlite/module.c	module_complete	kwlist	-
+Modules/_sqlite/module.c	module_connect	kwlist	-
+Modules/_sqlite/module.c	module_enable_shared_cache	kwlist	-
+Modules/syslogmodule.c	syslog_openlog	keywords	-
+Modules/_xxsubinterpretersmodule.c	channel_close	kwlist	-
+Modules/_xxsubinterpretersmodule.c	channel_destroy	kwlist	-
+Modules/_xxsubinterpretersmodule.c	channelid_new	kwlist	-
+Modules/_xxsubinterpretersmodule.c	channel_list_interpreters	kwlist	-
+Modules/_xxsubinterpretersmodule.c	channel_recv	kwlist	-
+Modules/_xxsubinterpretersmodule.c	channel_release	kwlist	-
+Modules/_xxsubinterpretersmodule.c	channel_send	kwlist	-
+Modules/_xxsubinterpretersmodule.c	interp_create	kwlist	-
+Modules/_xxsubinterpretersmodule.c	interp_destroy	kwlist	-
+Modules/_xxsubinterpretersmodule.c	interp_is_running	kwlist	-
+Modules/_xxsubinterpretersmodule.c	interp_run_string	kwlist	-
+Modules/_xxsubinterpretersmodule.c	object_is_shareable	kwlist	-
+Modules/_zoneinfo.c	zoneinfo_clear_cache	kwlist	-
+Modules/_zoneinfo.c	zoneinfo_from_file	kwlist	-
+Modules/_zoneinfo.c	zoneinfo_new	kwlist	-
+Modules/_zoneinfo.c	zoneinfo_no_cache	kwlist	-
+Objects/exceptions.c	ImportError_init	kwlist	-
+Objects/interpreteridobject.c	interpid_new	kwlist	-
+Objects/weakrefobject.c	weakref_call	kwlist	-
+
+#-----------------------
+# PyModuleDef_Slot
+# []
+
+Modules/_abc.c	-	_abcmodule_slots	-
+Modules/arraymodule.c	-	arrayslots	-
+Modules/atexitmodule.c	-	atexit_slots	-
+Modules/audioop.c	-	audioop_slots	-
+Modules/binascii.c	-	binascii_slots	-
+Modules/_blake2/blake2module.c	-	_blake2_slots	-
+Modules/cmathmodule.c	-	cmath_slots	-
+Modules/_codecsmodule.c	-	_codecs_slots	-
+Modules/_cryptmodule.c	-	_crypt_slots	-
+Modules/_curses_panel.c	-	_curses_slots	-
+Modules/_dbmmodule.c	-	_dbmmodule_slots	-
+Modules/errnomodule.c	-	errno_slots	-
+Modules/faulthandler.c	-	faulthandler_slots	-
+Modules/fcntlmodule.c	-	fcntl_slots	-
+Modules/_gdbmmodule.c	-	_gdbm_module_slots	-
+Modules/_hashopenssl.c	-	hashlib_slots	-
+Modules/_json.c	-	_json_slots	-
+Modules/_lsprof.c	-	_lsprofslots	-
+Modules/_lzmamodule.c	-	lzma_slots	-
+Modules/mathmodule.c	-	math_slots	-
+Modules/md5module.c	-	_md5_slots	-
+Modules/mmapmodule.c	-	mmap_slots	-
+Modules/_multiprocessing/multiprocessing.c	-	multiprocessing_slots	-
+Modules/nismodule.c	-	nis_slots	-
+Modules/overlapped.c	-	overlapped_slots	-
+Modules/posixmodule.c	-	posixmodile_slots	-
+Modules/_scproxy.c	-	_scproxy_slots	-
+Modules/sha1module.c	-	_sha1_slots	-
+Modules/sha256module.c	-	_sha256_slots	-
+Modules/_sha3/sha3module.c	-	_sha3_slots	-
+Modules/sha512module.c	-	_sha512_slots	-
+Modules/_stat.c	-	stat_slots	-
+Modules/syslogmodule.c	-	syslog_slots	-
+Modules/termios.c	-	termios_slots	-
+Modules/unicodedata.c	-	unicodedata_slots	-
+Modules/_uuidmodule.c	-	uuid_slots	-
+Modules/_winapi.c	-	winapi_slots	-
+Modules/xxlimited.c	-	xx_slots	-
+Modules/zlibmodule.c	-	zlib_slots	-
+Modules/_zoneinfo.c	-	zoneinfomodule_slots	-
+Python/marshal.c	-	marshalmodule_slots	-
+Python/Python-ast.c	-	astmodule_slots	-
+Modules/_bz2module.c	-	_bz2_slots	-
+Modules/_collectionsmodule.c	-	collections_slots	-
+Modules/_contextvarsmodule.c	-	_contextvars_slots	-
+Modules/_functoolsmodule.c	-	_functools_slots	-
+Modules/_heapqmodule.c	-	heapq_slots	-
+Modules/itertoolsmodule.c	-	itertoolsmodule_slots	-
+Modules/_localemodule.c	-	_locale_slots	-
+Modules/_operator.c	-	operator_slots	-
+Modules/resource.c	-	resource_slots	-
+Modules/_statisticsmodule.c	-	_statisticsmodule_slots	-
+Modules/timemodule.c	-	time_slots	-
+Modules/_weakref.c	-	weakref_slots	-
+Modules/xxmodule.c	-	xx_slots	-
+Modules/xxsubtype.c	-	xxsubtype_slots	-
+
+#-----------------------
+# PyMethodDef and PyMethodDef[], for static types and modules
+# []
+
+Modules/_abc.c	-	_destroy_def	-
+Modules/_abc.c	-	_abcmodule_methods	-
+Modules/arraymodule.c	-	array_methods	-
+Modules/arraymodule.c	-	arrayiter_methods	-
+Modules/arraymodule.c	-	a_methods	-
+Modules/_asynciomodule.c	-	FutureType_methods	-
+Modules/_asynciomodule.c	-	FutureIter_methods	-
+Modules/_asynciomodule.c	-	TaskType_methods	-
+Modules/_asynciomodule.c	-	asyncio_methods	-
+Modules/_asynciomodule.c	-	TaskWakeupDef	-
+Modules/atexitmodule.c	-	atexit_methods	-
+Modules/audioop.c	-	audioop_methods	-
+Modules/binascii.c	-	binascii_module_methods	-
+Modules/_bisectmodule.c	-	bisect_methods	-
+Modules/_blake2/blake2b_impl.c	-	py_blake2b_methods	-
+Modules/_blake2/blake2module.c	-	blake2mod_functions	-
+Modules/_blake2/blake2s_impl.c	-	py_blake2s_methods	-
+Modules/_bz2module.c	-	BZ2Compressor_methods	-
+Modules/_bz2module.c	-	BZ2Decompressor_methods	-
+Modules/cjkcodecs/multibytecodec.c	-	multibytecodec_methods	-
+Modules/cjkcodecs/multibytecodec.c	-	mbiencoder_methods	-
+Modules/cjkcodecs/multibytecodec.c	-	mbidecoder_methods	-
+Modules/cjkcodecs/multibytecodec.c	-	mbstreamreader_methods	-
+Modules/cjkcodecs/multibytecodec.c	-	mbstreamwriter_methods	-
+Modules/cjkcodecs/multibytecodec.c	-	__methods	-
+Modules/cmathmodule.c	-	cmath_methods	-
+Modules/_codecsmodule.c	-	_codecs_functions	-
+Modules/_collectionsmodule.c	-	deque_methods	-
+Modules/_collectionsmodule.c	-	dequeiter_methods	-
+Modules/_collectionsmodule.c	-	defdict_methods	-
+Modules/_collectionsmodule.c	-	tuplegetter_methods	-
+Modules/_collectionsmodule.c	-	collections_methods	-
+Modules/_contextvarsmodule.c	-	_contextvars_methods	-
+Modules/_cryptmodule.c	-	crypt_methods	-
+Modules/_csv.c	-	Reader_methods	-
+Modules/_csv.c	-	Writer_methods	-
+Modules/_csv.c	-	csv_methods	-
+Modules/_ctypes/callproc.c	-	_ctypes_module_methods	-
+Modules/_ctypes/_ctypes.c	-	CDataType_methods	-
+Modules/_ctypes/_ctypes.c	-	PyCPointerType_methods	-
+Modules/_ctypes/_ctypes.c	-	c_void_p_method	-
+Modules/_ctypes/_ctypes.c	-	c_char_p_method	-
+Modules/_ctypes/_ctypes.c	-	c_wchar_p_method	-
+Modules/_ctypes/_ctypes.c	-	PyCSimpleType_methods	-
+Modules/_ctypes/_ctypes.c	-	PyCData_methods	-
+Modules/_ctypes/_ctypes.c	-	Array_methods	-
+Modules/_ctypes/_ctypes.c	-	Simple_methods	-
+Modules/_ctypes/stgdict.c	-	PyCStgDict_methods	-
+Modules/_cursesmodule.c	-	PyCursesWindow_Methods	-
+Modules/_cursesmodule.c	-	PyCurses_methods	-
+Modules/_curses_panel.c	-	PyCursesPanel_Methods	-
+Modules/_curses_panel.c	-	PyCurses_methods	-
+Modules/_datetimemodule.c	-	delta_methods	-
+Modules/_datetimemodule.c	-	iso_calendar_date_methods	-
+Modules/_datetimemodule.c	-	date_methods	-
+Modules/_datetimemodule.c	-	tzinfo_methods	-
+Modules/_datetimemodule.c	-	timezone_methods	-
+Modules/_datetimemodule.c	-	time_methods	-
+Modules/_datetimemodule.c	-	datetime_methods	-
+Modules/_datetimemodule.c	-	module_methods	-
+Modules/_dbmmodule.c	-	dbm_methods	-
+Modules/_dbmmodule.c	-	dbmmodule_methods	-
+Modules/_decimal/_decimal.c	-	signaldict_methods	-
+Modules/_decimal/_decimal.c	-	ctxmanager_methods	-
+Modules/_decimal/_decimal.c	-	dec_methods	-
+Modules/_decimal/_decimal.c	-	context_methods	-
+Modules/_decimal/_decimal.c	-	_decimal_methods	-
+Modules/_elementtree.c	-	element_methods	-
+Modules/_elementtree.c	-	treebuilder_methods	-
+Modules/_elementtree.c	-	xmlparser_methods	-
+Modules/_elementtree.c	-	_functions	-
+Modules/errnomodule.c	-	errno_methods	-
+Modules/faulthandler.c	-	module_methods	-
+Modules/fcntlmodule.c	-	fcntl_methods	-
+Modules/_functoolsmodule.c	-	partial_methods	-
+Modules/_functoolsmodule.c	-	lru_cache_methods	-
+Modules/_functoolsmodule.c	-	_functools_methods	-
+Modules/gcmodule.c	-	GcMethods	-
+Modules/_gdbmmodule.c	-	gdbm_methods	-
+Modules/_gdbmmodule.c	-	_gdbm_module_methods	-
+Modules/grpmodule.c	-	grp_methods	-
+Modules/_hashopenssl.c	-	EVP_methods	-
+Modules/_hashopenssl.c	-	EVPXOF_methods	-
+Modules/_hashopenssl.c	-	HMAC_methods	-
+Modules/_hashopenssl.c	-	EVP_functions	-
+Modules/_heapqmodule.c	-	heapq_methods	-
+Modules/_io/bufferedio.c	-	bufferediobase_methods	-
+Modules/_io/bufferedio.c	-	bufferedreader_methods	-
+Modules/_io/bufferedio.c	-	bufferedwriter_methods	-
+Modules/_io/bufferedio.c	-	bufferedrwpair_methods	-
+Modules/_io/bufferedio.c	-	bufferedrandom_methods	-
+Modules/_io/bytesio.c	-	bytesio_methods	-
+Modules/_io/fileio.c	-	fileio_methods	-
+Modules/_io/iobase.c	-	iobase_methods	-
+Modules/_io/iobase.c	-	rawiobase_methods	-
+Modules/_io/_iomodule.c	-	module_methods	-
+Modules/_io/stringio.c	-	stringio_methods	-
+Modules/_io/textio.c	-	textiobase_methods	-
+Modules/_io/textio.c	-	incrementalnewlinedecoder_methods	-
+Modules/_io/textio.c	-	textiowrapper_methods	-
+Modules/_io/winconsoleio.c	-	winconsoleio_methods	-
+Modules/itertoolsmodule.c	-	groupby_methods	-
+Modules/itertoolsmodule.c	-	_grouper_methods	-
+Modules/itertoolsmodule.c	-	teedataobject_methods	-
+Modules/itertoolsmodule.c	-	tee_methods	-
+Modules/itertoolsmodule.c	-	cycle_methods	-
+Modules/itertoolsmodule.c	-	dropwhile_methods	-
+Modules/itertoolsmodule.c	-	takewhile_reduce_methods	-
+Modules/itertoolsmodule.c	-	islice_methods	-
+Modules/itertoolsmodule.c	-	starmap_methods	-
+Modules/itertoolsmodule.c	-	chain_methods	-
+Modules/itertoolsmodule.c	-	product_methods	-
+Modules/itertoolsmodule.c	-	combinations_methods	-
+Modules/itertoolsmodule.c	-	cwr_methods	-
+Modules/itertoolsmodule.c	-	permuations_methods	-
+Modules/itertoolsmodule.c	-	accumulate_methods	-
+Modules/itertoolsmodule.c	-	compress_methods	-
+Modules/itertoolsmodule.c	-	filterfalse_methods	-
+Modules/itertoolsmodule.c	-	count_methods	-
+Modules/itertoolsmodule.c	-	repeat_methods	-
+Modules/itertoolsmodule.c	-	zip_longest_methods	-
+Modules/itertoolsmodule.c	-	module_methods	-
+Modules/_json.c	-	speedups_methods	-
+Modules/_localemodule.c	-	PyLocale_Methods	-
+Modules/_lsprof.c	-	profiler_methods	-
+Modules/_lsprof.c	-	moduleMethods	-
+Modules/_lzmamodule.c	-	Compressor_methods	-
+Modules/_lzmamodule.c	-	Decompressor_methods	-
+Modules/_lzmamodule.c	-	lzma_methods	-
+Modules/mathmodule.c	-	math_methods	-
+Modules/md5module.c	-	MD5_methods	-
+Modules/md5module.c	-	MD5_functions	-
+Modules/mmapmodule.c	-	mmap_object_methods	-
+Modules/_multiprocessing/multiprocessing.c	-	module_methods	-
+Modules/_multiprocessing/posixshmem.c	-	module_methods	-
+Modules/_multiprocessing/semaphore.c	-	semlock_methods	-
+Modules/nismodule.c	-	nis_methods	-
+Modules/_opcode.c	-	opcode_functions	-
+Modules/_operator.c	-	operator_methods	-
+Modules/_operator.c	-	itemgetter_methods	-
+Modules/_operator.c	-	attrgetter_methods	-
+Modules/_operator.c	-	methodcaller_methods	-
+Modules/ossaudiodev.c	-	oss_methods	-
+Modules/ossaudiodev.c	-	oss_mixer_methods	-
+Modules/ossaudiodev.c	-	ossaudiodev_methods	-
+Modules/overlapped.c	-	Overlapped_methods	-
+Modules/overlapped.c	-	overlapped_functions	-
+Modules/_pickle.c	-	Pickler_methods	-
+Modules/_pickle.c	-	picklerproxy_methods	-
+Modules/_pickle.c	-	Unpickler_methods	-
+Modules/_pickle.c	-	unpicklerproxy_methods	-
+Modules/_pickle.c	-	pickle_methods	-
+Modules/posixmodule.c	-	DirEntry_methods	-
+Modules/posixmodule.c	-	ScandirIterator_methods	-
+Modules/posixmodule.c	-	posix_methods	-
+Modules/_posixsubprocess.c	-	module_methods	-
+Modules/pwdmodule.c	-	pwd_methods	-
+Modules/pyexpat.c	-	xmlparse_methods	-
+Modules/pyexpat.c	-	pyexpat_methods	-
+Modules/_queuemodule.c	-	simplequeue_methods	-
+Modules/_randommodule.c	-	random_methods	-
+Modules/readline.c	-	readline_methods	-
+Modules/resource.c	-	resource_methods	-
+Modules/_scproxy.c	-	mod_methods	-
+Modules/selectmodule.c	-	poll_methods	-
+Modules/selectmodule.c	-	devpoll_methods	-
+Modules/selectmodule.c	-	pyepoll_methods	-
+Modules/selectmodule.c	-	kqueue_queue_methods	-
+Modules/selectmodule.c	-	select_methods	-
+Modules/sha1module.c	-	SHA1_methods	-
+Modules/sha1module.c	-	SHA1_functions	-
+Modules/sha256module.c	-	SHA_methods	-
+Modules/sha256module.c	-	SHA_functions	-
+Modules/_sha3/sha3module.c	-	SHA3_methods	-
+Modules/_sha3/sha3module.c	-	SHAKE_methods	-
+Modules/sha512module.c	-	SHA_methods	-
+Modules/sha512module.c	-	SHA_functions	-
+Modules/signalmodule.c	-	signal_methods	-
+Modules/socketmodule.c	-	sock_methods	-
+Modules/socketmodule.c	-	socket_methods	-
+Modules/spwdmodule.c	-	spwd_methods	-
+Modules/_sqlite/cache.c	-	cache_methods	-
+Modules/_sqlite/connection.c	-	connection_methods	-
+Modules/_sqlite/cursor.c	-	cursor_methods	-
+Modules/_sqlite/module.c	-	module_methods	-
+Modules/_sqlite/row.c	-	row_methods	-
+Modules/_sre.c	-	pattern_methods	-
+Modules/_sre.c	-	match_methods	-
+Modules/_sre.c	-	scanner_methods	-
+Modules/_sre.c	-	_functions	-
+Modules/_ssl.c	-	PySSLMethods	-
+Modules/_ssl.c	-	context_methods	-
+Modules/_ssl.c	-	memory_bio_methods	-
+Modules/_ssl.c	-	PySSL_methods	-
+Modules/_stat.c	-	stat_methods	-
+Modules/_statisticsmodule.c	-	statistics_methods	-
+Modules/_struct.c	-	unpackiter_methods	-
+Modules/_struct.c	-	s_methods	-
+Modules/_struct.c	-	module_functions	-
+Modules/symtablemodule.c	-	symtable_methods	-
+Modules/syslogmodule.c	-	syslog_methods	-
+Modules/termios.c	-	termios_methods	-
+Modules/_threadmodule.c	-	lock_methods	-
+Modules/_threadmodule.c	-	rlock_methods	-
+Modules/_threadmodule.c	local_new	wr_callback_def	-
+Modules/_threadmodule.c	-	thread_methods	-
+Modules/timemodule.c	-	time_methods	-
+Modules/_tkinter.c	-	Tktt_methods	-
+Modules/_tkinter.c	-	Tkapp_methods	-
+Modules/_tkinter.c	-	moduleMethods	-
+Modules/_tracemalloc.c	-	module_methods	-
+Modules/unicodedata.c	-	unicodedata_functions	-
+Modules/_uuidmodule.c	-	uuid_methods	-
+Modules/_weakref.c	-	weakref_functions	-
+Modules/_winapi.c	-	overlapped_methods	-
+Modules/_winapi.c	-	winapi_functions	-
+Modules/xxlimited.c	-	Xxo_methods	-
+Modules/xxlimited.c	-	xx_methods	-
+Modules/xxmodule.c	-	Xxo_methods	-
+Modules/xxmodule.c	-	xx_methods	-
+Modules/_xxsubinterpretersmodule.c	-	module_functions	-
+Modules/xxsubtype.c	-	spamlist_methods	-
+Modules/xxsubtype.c	-	spamdict_methods	-
+Modules/xxsubtype.c	-	xxsubtype_functions	-
+Modules/zlibmodule.c	-	comp_methods	-
+Modules/zlibmodule.c	-	Decomp_methods	-
+Modules/zlibmodule.c	-	zlib_methods	-
+Modules/_zoneinfo.c	-	zoneinfo_methods	-
+Modules/_zoneinfo.c	-	module_methods	-
+Modules/cjkcodecs/cjkcodecs.h	-	__methods	-
+Objects/bytearrayobject.c	-	bytearray_methods	-
+Objects/bytearrayobject.c	-	bytearrayiter_methods	-
+Objects/bytesobject.c	-	bytes_methods	-
+Objects/bytesobject.c	-	striter_methods	-
+Objects/classobject.c	-	method_methods	-
+Objects/codeobject.c	-	code_methods	-
+Objects/complexobject.c	-	complex_methods	-
+Objects/descrobject.c	-	descr_methods	-
+Objects/descrobject.c	-	mappingproxy_methods	-
+Objects/descrobject.c	-	wrapper_methods	-
+Objects/descrobject.c	-	property_methods	-
+Objects/dictobject.c	-	mapp_methods	-
+Objects/dictobject.c	-	dictiter_methods	-
+Objects/dictobject.c	-	dictkeys_methods	-
+Objects/dictobject.c	-	dictitems_methods	-
+Objects/dictobject.c	-	dictvalues_methods	-
+Objects/enumobject.c	-	enum_methods	-
+Objects/enumobject.c	-	reversediter_methods	-
+Objects/exceptions.c	-	BaseException_methods	-
+Objects/exceptions.c	-	ImportError_methods	-
+Objects/exceptions.c	-	OSError_methods	-
+Objects/fileobject.c	-	stdprinter_methods	-
+Objects/floatobject.c	-	float_methods	-
+Objects/frameobject.c	-	frame_methods	-
+Objects/genericaliasobject.c	-	ga_methods	-
+Objects/genobject.c	-	gen_methods	-
+Objects/genobject.c	-	coro_methods	-
+Objects/genobject.c	-	coro_wrapper_methods	-
+Objects/genobject.c	-	async_gen_methods	-
+Objects/genobject.c	-	async_gen_asend_methods	-
+Objects/genobject.c	-	async_gen_athrow_methods	-
+Objects/iterobject.c	-	seqiter_methods	-
+Objects/iterobject.c	-	calliter_methods	-
+Objects/listobject.c	-	list_methods	-
+Objects/listobject.c	-	listiter_methods	-
+Objects/listobject.c	-	listreviter_methods	-
+Objects/longobject.c	-	long_methods	-
+Objects/memoryobject.c	-	memory_methods	-
+Objects/methodobject.c	-	meth_methods	-
+Objects/moduleobject.c	-	module_methods	-
+Objects/namespaceobject.c	-	namespace_methods	-
+Objects/object.c	-	notimplemented_methods	-
+Objects/odictobject.c	-	odict_methods	-
+Objects/odictobject.c	-	odictiter_methods	-
+Objects/odictobject.c	-	odictkeys_methods	-
+Objects/odictobject.c	-	odictitems_methods	-
+Objects/odictobject.c	-	odictvalues_methods	-
+Objects/picklebufobject.c	-	picklebuf_methods	-
+Objects/rangeobject.c	-	range_methods	-
+Objects/rangeobject.c	-	rangeiter_methods	-
+Objects/rangeobject.c	-	longrangeiter_methods	-
+Objects/setobject.c	-	setiter_methods	-
+Objects/setobject.c	-	set_methods	-
+Objects/setobject.c	-	frozenset_methods	-
+Objects/sliceobject.c	-	ellipsis_methods	-
+Objects/sliceobject.c	-	slice_methods	-
+Objects/structseq.c	-	structseq_methods	-
+Objects/tupleobject.c	-	tuple_methods	-
+Objects/tupleobject.c	-	tupleiter_methods	-
+Objects/typeobject.c	-	type_methods	-
+Objects/typeobject.c	-	object_methods	-
+Objects/typeobject.c	-	tp_new_methoddef	-
+Objects/unicodeobject.c	-	encoding_map_methods	-
+Objects/unicodeobject.c	-	unicode_methods	-
+Objects/unicodeobject.c	-	unicodeiter_methods	-
+Objects/unicodeobject.c	-	_string_methods	-
+Objects/unionobject.c	-	union_methods	-
+Objects/weakrefobject.c	-	weakref_methods	-
+Objects/weakrefobject.c	-	proxy_methods	-
+Objects/stringlib/unicode_format.h	-	formatteriter_methods	-
+Objects/stringlib/unicode_format.h	-	fieldnameiter_methods	-
+Python/bltinmodule.c	-	filter_methods	-
+Python/bltinmodule.c	-	map_methods	-
+Python/bltinmodule.c	-	zip_methods	-
+Python/bltinmodule.c	-	builtin_methods	-
+Python/context.c	-	PyContext_methods	-
+Python/context.c	-	PyContextVar_methods	-
+Python/context.c	-	PyContextTokenType_methods	-
+Python/hamt.c	-	PyHamt_methods	-
+Python/import.c	-	imp_methods	-
+Python/marshal.c	-	marshal_methods	-
+Python/Python-ast.c	-	ast_type_methods	-
+Python/sysmodule.c	-	sys_methods	-
+Python/traceback.c	-	tb_methods	-
+Python/_warnings.c	-	warnings_functions	-
+
+#-----------------------
+# PyMemberDef[], for static types and strucseq
+# []
+
+Modules/_bz2module.c	-	BZ2Decompressor_members	-
+Modules/cjkcodecs/multibytecodec.c	-	mbstreamreader_members	-
+Modules/cjkcodecs/multibytecodec.c	-	mbstreamwriter_members	-
+Modules/_collectionsmodule.c	-	defdict_members	-
+Modules/_collectionsmodule.c	-	tuplegetter_members	-
+Modules/_csv.c	-	Dialect_memberlist	-
+Modules/_csv.c	-	Reader_memberlist	-
+Modules/_csv.c	-	Writer_memberlist	-
+Modules/_ctypes/callproc.c	-	PyCArgType_members	-
+Modules/_ctypes/_ctypes.c	-	PyCData_members	-
+Modules/_datetimemodule.c	-	delta_members	-
+Modules/_elementtree.c	-	xmlparser_members	-
+Modules/_functoolsmodule.c	-	partial_memberlist	-
+Modules/_functoolsmodule.c	-	keyobject_members	-
+Modules/_io/bufferedio.c	-	bufferedreader_members	-
+Modules/_io/bufferedio.c	-	bufferedwriter_members	-
+Modules/_io/bufferedio.c	-	bufferedrandom_members	-
+Modules/_io/fileio.c	-	fileio_members	-
+Modules/_io/textio.c	-	textiowrapper_members	-
+Modules/_io/winconsoleio.c	-	winconsoleio_members	-
+Modules/_json.c	-	scanner_members	-
+Modules/_json.c	-	encoder_members	-
+Modules/_lzmamodule.c	-	Decompressor_members	-
+Modules/_multiprocessing/semaphore.c	-	semlock_members	-
+Modules/ossaudiodev.c	-	oss_members	-
+Modules/overlapped.c	-	Overlapped_members	-
+Modules/_pickle.c	-	Pickler_members	-
+Modules/posixmodule.c	-	DirEntry_members	-
+Modules/pyexpat.c	-	xmlparse_members	-
+Modules/selectmodule.c	-	kqueue_event_members	-
+Modules/sha256module.c	-	SHA_members	-
+Modules/sha512module.c	-	SHA_members	-
+Modules/socketmodule.c	-	sock_memberlist	-
+Modules/_sqlite/connection.c	-	connection_members	-
+Modules/_sqlite/cursor.c	-	cursor_members	-
+Modules/_sqlite/statement.c	-	stmt_members	-
+Modules/_sre.c	-	pattern_members	-
+Modules/_sre.c	-	match_members	-
+Modules/_sre.c	-	scanner_members	-
+Modules/_struct.c	-	s_members	-
+Modules/unicodedata.c	-	DB_members	-
+Modules/_winapi.c	-	overlapped_members	-
+Modules/xxsubtype.c	-	spamdict_members	-
+Modules/zlibmodule.c	-	Decomp_members	-
+Modules/_zoneinfo.c	-	zoneinfo_members	-
+Objects/classobject.c	-	method_memberlist	-
+Objects/classobject.c	-	instancemethod_memberlist	-
+Objects/codeobject.c	-	code_memberlist	-
+Objects/complexobject.c	-	complex_members	-
+Objects/descrobject.c	-	descr_members	-
+Objects/descrobject.c	-	wrapper_members	-
+Objects/descrobject.c	-	property_members	-
+Objects/exceptions.c	-	BaseException_members	-
+Objects/exceptions.c	-	StopIteration_members	-
+Objects/exceptions.c	-	SystemExit_members	-
+Objects/exceptions.c	-	ImportError_members	-
+Objects/exceptions.c	-	OSError_members	-
+Objects/exceptions.c	-	SyntaxError_members	-
+Objects/exceptions.c	-	UnicodeError_members	-
+Objects/frameobject.c	-	frame_memberlist	-
+Objects/funcobject.c	-	func_memberlist	-
+Objects/funcobject.c	-	cm_memberlist	-
+Objects/funcobject.c	-	sm_memberlist	-
+Objects/genericaliasobject.c	-	ga_members	-
+Objects/genobject.c	-	gen_memberlist	-
+Objects/genobject.c	-	coro_memberlist	-
+Objects/genobject.c	-	async_gen_memberlist	-
+Objects/methodobject.c	-	meth_members	-
+Objects/moduleobject.c	-	module_members	-
+Objects/namespaceobject.c	-	namespace_members	-
+Objects/rangeobject.c	-	range_members	-
+Objects/sliceobject.c	-	slice_members	-
+Objects/typeobject.c	-	type_members	-
+Objects/typeobject.c	-	super_members	-
+Objects/unionobject.c	-	union_members	-
+Objects/weakrefobject.c	-	weakref_members	-
+Python/context.c	-	PyContextVar_members	-
+Python/Python-ast.c	-	ast_type_members	-
+Python/symtable.c	-	ste_memberlist	-
+Python/traceback.c	-	tb_memberlist	-
+
+#-----------------------
+# for static types
+# []
+
+# PyNumberMethods  []
+Modules/_collectionsmodule.c	-	deque_as_number	-
+Modules/_collectionsmodule.c	-	defdict_as_number	-
+Modules/_ctypes/_ctypes.c	-	PyCFuncPtr_as_number	-
+Modules/_ctypes/_ctypes.c	-	Simple_as_number	-
+Modules/_ctypes/_ctypes.c	-	Pointer_as_number	-
+Modules/_datetimemodule.c	-	delta_as_number	-
+Modules/_datetimemodule.c	-	date_as_number	-
+Modules/_datetimemodule.c	-	datetime_as_number	-
+Modules/_decimal/_decimal.c	-	dec_number_methods	-
+Modules/_xxsubinterpretersmodule.c	-	channelid_as_number	-
+Objects/boolobject.c	-	bool_as_number	-
+Objects/bytearrayobject.c	-	bytearray_as_number	-
+Objects/bytesobject.c	-	bytes_as_number	-
+Objects/complexobject.c	-	complex_as_number	-
+Objects/descrobject.c	-	mappingproxy_as_number	-
+Objects/dictobject.c	-	dict_as_number	-
+Objects/dictobject.c	-	dictviews_as_number	-
+Objects/floatobject.c	-	float_as_number	-
+Objects/interpreteridobject.c	-	interpid_as_number	-
+Objects/longobject.c	-	long_as_number	-
+Objects/object.c	-	none_as_number	-
+Objects/object.c	-	notimplemented_as_number	-
+Objects/odictobject.c	-	odict_as_number	-
+Objects/rangeobject.c	-	range_as_number	-
+Objects/setobject.c	-	set_as_number	-
+Objects/setobject.c	-	frozenset_as_number	-
+Objects/typeobject.c	-	type_as_number	-
+Objects/unicodeobject.c	-	unicode_as_number	-
+Objects/unionobject.c	-	union_as_number	-
+Objects/weakrefobject.c	-	proxy_as_number	-
+
+# PySequenceMethods  []
+Modules/arraymodule.c	-	array_as_sequence	-
+Modules/_collectionsmodule.c	-	deque_as_sequence	-
+Modules/_ctypes/_ctypes.c	-	CDataType_as_sequence	-
+Modules/_ctypes/_ctypes.c	-	Array_as_sequence	-
+Modules/_ctypes/_ctypes.c	-	Pointer_as_sequence	-
+Modules/_elementtree.c	-	element_as_sequence	-
+Modules/mmapmodule.c	-	mmap_as_sequence	-
+Objects/bytearrayobject.c	-	bytearray_as_sequence	-
+Objects/bytesobject.c	-	bytes_as_sequence	-
+Objects/descrobject.c	-	mappingproxy_as_sequence	-
+Objects/dictobject.c	-	dict_as_sequence	-
+Objects/dictobject.c	-	dictkeys_as_sequence	-
+Objects/dictobject.c	-	dictitems_as_sequence	-
+Objects/dictobject.c	-	dictvalues_as_sequence	-
+Objects/listobject.c	-	list_as_sequence	-
+Objects/memoryobject.c	-	memory_as_sequence	-
+Objects/rangeobject.c	-	range_as_sequence	-
+Objects/setobject.c	-	set_as_sequence	-
+Objects/tupleobject.c	-	tuple_as_sequence	-
+Objects/unicodeobject.c	-	unicode_as_sequence	-
+Objects/weakrefobject.c	-	proxy_as_sequence	-
+Python/context.c	-	PyContext_as_sequence	-
+Python/hamt.c	-	PyHamt_as_sequence	-
+
+# PyMappingMethods  []
+Modules/arraymodule.c	-	array_as_mapping	-
+Modules/_ctypes/_ctypes.c	-	Array_as_mapping	-
+Modules/_ctypes/_ctypes.c	-	Pointer_as_mapping	-
+Modules/_decimal/_decimal.c	-	signaldict_as_mapping	-
+Modules/_elementtree.c	-	element_as_mapping	-
+Modules/mmapmodule.c	-	mmap_as_mapping	-
+Modules/_sre.c	-	match_as_mapping	-
+Objects/bytearrayobject.c	-	bytearray_as_mapping	-
+Objects/bytesobject.c	-	bytes_as_mapping	-
+Objects/descrobject.c	-	mappingproxy_as_mapping	-
+Objects/dictobject.c	-	dict_as_mapping	-
+Objects/genericaliasobject.c	-	ga_as_mapping	-
+Objects/listobject.c	-	list_as_mapping	-
+Objects/memoryobject.c	-	memory_as_mapping	-
+Objects/odictobject.c	-	odict_as_mapping	-
+Objects/rangeobject.c	-	range_as_mapping	-
+Objects/tupleobject.c	-	tuple_as_mapping	-
+Objects/unicodeobject.c	-	unicode_as_mapping	-
+Objects/weakrefobject.c	-	proxy_as_mapping	-
+Python/context.c	-	PyContext_as_mapping	-
+Python/hamt.c	-	PyHamtIterator_as_mapping	-
+Python/hamt.c	-	PyHamt_as_mapping	-
+
+# PyAsyncMethods  []
+Modules/_asynciomodule.c	-	FutureType_as_async	-
+Objects/genobject.c	-	coro_as_async	-
+Objects/genobject.c	-	async_gen_as_async	-
+Objects/genobject.c	-	async_gen_asend_as_async	-
+Objects/genobject.c	-	async_gen_athrow_as_async	-
+
+# PyBufferProcs  []
+Modules/arraymodule.c	-	array_as_buffer	-
+Modules/_ctypes/_ctypes.c	-	PyCData_as_buffer	-
+Modules/_io/bytesio.c	-	bytesiobuf_as_buffer	-
+Modules/mmapmodule.c	-	mmap_as_buffer	-
+Objects/bytearrayobject.c	-	bytearray_as_buffer	-
+Objects/bytesobject.c	-	bytes_as_buffer	-
+Objects/memoryobject.c	-	memory_as_buffer	-
+Objects/picklebufobject.c	-	picklebuf_as_buffer	-
+
+# PyGetSetDef  []
+Modules/arraymodule.c	-	array_getsets	-
+Modules/_asynciomodule.c	-	FutureType_getsetlist	-
+Modules/_asynciomodule.c	-	TaskStepMethWrapper_getsetlist	-
+Modules/_asynciomodule.c	-	TaskType_getsetlist	-
+Modules/_blake2/blake2b_impl.c	-	py_blake2b_getsetters	-
+Modules/_blake2/blake2s_impl.c	-	py_blake2s_getsetters	-
+Modules/cjkcodecs/multibytecodec.c	-	codecctx_getsets	-
+Modules/_collectionsmodule.c	-	deque_getset	-
+Modules/_csv.c	-	Dialect_getsetlist	-
+Modules/_ctypes/cfield.c	-	PyCField_getset	-
+Modules/_ctypes/_ctypes.c	-	CharArray_getsets	-
+Modules/_ctypes/_ctypes.c	-	WCharArray_getsets	-
+Modules/_ctypes/_ctypes.c	-	PyCFuncPtr_getsets	-
+Modules/_ctypes/_ctypes.c	-	Simple_getsets	-
+Modules/_ctypes/_ctypes.c	-	Pointer_getsets	-
+Modules/_cursesmodule.c	-	PyCursesWindow_getsets	-
+Modules/_datetimemodule.c	-	date_getset	-
+Modules/_datetimemodule.c	-	iso_calendar_date_getset	-
+Modules/_datetimemodule.c	-	time_getset	-
+Modules/_datetimemodule.c	-	datetime_getset	-
+Modules/_decimal/_decimal.c	-	context_getsets	-
+Modules/_decimal/_decimal.c	-	dec_getsets	-
+Modules/_elementtree.c	-	xmlparser_getsetlist	-
+Modules/_elementtree.c	-	element_getsetlist	-
+Modules/_functoolsmodule.c	-	partial_getsetlist	-
+Modules/_functoolsmodule.c	-	lru_cache_getsetlist	-
+Modules/_hashopenssl.c	-	EVP_getseters	-
+Modules/_hashopenssl.c	-	EVPXOF_getseters	-
+Modules/_hashopenssl.c	-	HMAC_getset	-
+Modules/_io/bufferedio.c	-	bufferedreader_getset	-
+Modules/_io/bufferedio.c	-	bufferedwriter_getset	-
+Modules/_io/bufferedio.c	-	bufferedrwpair_getset	-
+Modules/_io/bufferedio.c	-	bufferedrandom_getset	-
+Modules/_io/bytesio.c	-	bytesio_getsetlist	-
+Modules/_io/fileio.c	-	fileio_getsetlist	-
+Modules/_io/iobase.c	-	iobase_getset	-
+Modules/_io/stringio.c	-	stringio_getset	-
+Modules/_io/textio.c	-	textiobase_getset	-
+Modules/_io/textio.c	-	incrementalnewlinedecoder_getset	-
+Modules/_io/textio.c	-	textiowrapper_getset	-
+Modules/_io/winconsoleio.c	-	winconsoleio_getsetlist	-
+Modules/md5module.c	-	MD5_getseters	-
+Modules/mmapmodule.c	-	mmap_object_getset	-
+Modules/ossaudiodev.c	-	oss_getsetlist	-
+Modules/overlapped.c	-	Overlapped_getsets	-
+Modules/_pickle.c	-	Pickler_getsets	-
+Modules/_pickle.c	-	Unpickler_getsets	-
+Modules/pyexpat.c	-	xmlparse_getsetlist	-
+Modules/selectmodule.c	-	devpoll_getsetlist	-
+Modules/selectmodule.c	-	pyepoll_getsetlist	-
+Modules/selectmodule.c	-	kqueue_queue_getsetlist	-
+Modules/sha1module.c	-	SHA1_getseters	-
+Modules/sha256module.c	-	SHA_getseters	-
+Modules/_sha3/sha3module.c	-	SHA3_getseters	-
+Modules/sha512module.c	-	SHA_getseters	-
+Modules/socketmodule.c	-	sock_getsetlist	-
+Modules/_sqlite/connection.c	-	connection_getset	-
+Modules/_sre.c	-	pattern_getset	-
+Modules/_sre.c	-	match_getset	-
+Modules/_ssl.c	-	ssl_getsetlist	-
+Modules/_ssl.c	-	context_getsetlist	-
+Modules/_ssl.c	-	memory_bio_getsetlist	-
+Modules/_ssl.c	-	PySSLSession_getsetlist	-
+Modules/_struct.c	-	s_getsetlist	-
+Modules/_tkinter.c	-	PyTclObject_getsetlist	-
+Modules/_xxsubinterpretersmodule.c	-	channelid_getsets	-
+Modules/xxsubtype.c	-	spamlist_getsets	-
+Objects/cellobject.c	-	cell_getsetlist	-
+Objects/classobject.c	-	method_getset	-
+Objects/classobject.c	-	instancemethod_getset	-
+Objects/descrobject.c	-	method_getset	-
+Objects/descrobject.c	-	member_getset	-
+Objects/descrobject.c	-	getset_getset	-
+Objects/descrobject.c	-	wrapperdescr_getset	-
+Objects/descrobject.c	-	wrapper_getsets	-
+Objects/descrobject.c	-	property_getsetlist	-
+Objects/dictobject.c	-	dictview_getset	-
+Objects/exceptions.c	-	BaseException_getset	-
+Objects/exceptions.c	-	OSError_getset	-
+Objects/fileobject.c	-	stdprinter_getsetlist	-
+Objects/floatobject.c	-	float_getset	-
+Objects/frameobject.c	-	frame_getsetlist	-
+Objects/funcobject.c	-	func_getsetlist	-
+Objects/funcobject.c	-	cm_getsetlist	-
+Objects/funcobject.c	-	sm_getsetlist	-
+Objects/genericaliasobject.c	-	ga_properties	-
+Objects/genobject.c	-	gen_getsetlist	-
+Objects/genobject.c	-	coro_getsetlist	-
+Objects/genobject.c	-	async_gen_getsetlist	-
+Objects/longobject.c	-	long_getset	-
+Objects/memoryobject.c	-	memory_getsetlist	-
+Objects/methodobject.c	-	meth_getsets	-
+Objects/odictobject.c	-	odict_getset	-
+Objects/typeobject.c	-	type_getsets	-
+Objects/typeobject.c	-	subtype_getsets_full	-
+Objects/typeobject.c	-	subtype_getsets_dict_only	-
+Objects/typeobject.c	-	subtype_getsets_weakref_only	-
+Objects/typeobject.c	-	object_getsets	-
+Python/context.c	-	PyContextTokenType_getsetlist	-
+Python/Python-ast.c	-	ast_type_getsets	-
+Python/traceback.c	-	tb_getsetters	-
+
+#-----------------------
+# for heap types
+# []
+
+# PyType_Slot  []
+Modules/_abc.c	-	_abc_data_type_spec_slots	-
+Modules/_blake2/blake2b_impl.c	-	blake2b_type_slots	-
+Modules/_blake2/blake2s_impl.c	-	blake2s_type_slots	-
+Modules/_bz2module.c	-	bz2_compressor_type_slots	-
+Modules/_bz2module.c	-	bz2_decompressor_type_slots	-
+Modules/_curses_panel.c	-	PyCursesPanel_Type_slots	-
+Modules/_dbmmodule.c	-	dbmtype_spec_slots	-
+Modules/_gdbmmodule.c	-	gdbmtype_spec_slots	-
+Modules/_hashopenssl.c	-	EVPtype_slots	-
+Modules/_hashopenssl.c	-	EVPXOFtype_slots	-
+Modules/_hashopenssl.c	-	HMACtype_slots	-
+Modules/_json.c	-	PyScannerType_slots	-
+Modules/_json.c	-	PyEncoderType_slots	-
+Modules/_lsprof.c	-	_lsprof_profiler_type_spec_slots	-
+Modules/_lzmamodule.c	-	lzma_compressor_type_slots	-
+Modules/_lzmamodule.c	-	lzma_decompressor_type_slots	-
+Modules/md5module.c	-	md5_type_slots	-
+Modules/_operator.c	-	itemgetter_type_slots	-
+Modules/_operator.c	-	attrgetter_type_slots	-
+Modules/_operator.c	-	methodcaller_type_slots	-
+Modules/overlapped.c	-	overlapped_type_slots	-
+Modules/posixmodule.c	-	DirEntryType_slots	-
+Modules/posixmodule.c	-	ScandirIteratorType_slots	-
+Modules/_randommodule.c	-	Random_Type_slots	-
+Modules/selectmodule.c	-	devpoll_Type_slots	-
+Modules/selectmodule.c	-	kqueue_event_Type_slots	-
+Modules/selectmodule.c	-	poll_Type_slots	-
+Modules/selectmodule.c	-	pyEpoll_Type_slots	-
+Modules/selectmodule.c	-	kqueue_queue_Type_slots	-
+Modules/sha1module.c	-	sha1_type_slots	-
+Modules/sha256module.c	-	sha256_types_slots	-
+Modules/_sha3/sha3module.c	-	sha3_224_slots	-
+Modules/_sha3/sha3module.c	-	sha3_256_slots	-
+Modules/_sha3/sha3module.c	-	sha3_384_slots	-
+Modules/_sha3/sha3module.c	-	sha3_512_slots	-
+Modules/_sha3/sha3module.c	-	SHAKE128slots	-
+Modules/_sha3/sha3module.c	-	SHAKE256slots	-
+Modules/_sha3/sha3module.c	-	type_slots_obj	-
+Modules/sha512module.c	-	sha512_sha384_type_slots	-
+Modules/sha512module.c	-	sha512_sha512_type_slots	-
+Modules/_sqlite/cache.c	-	pysqlite_NodeType_slots	-
+Modules/_sqlite/cache.c	-	pysqlite_CacheType_slots	-
+Modules/_sqlite/connection.c	-	connection_slots	-
+Modules/_sqlite/cursor.c	-	cursor_slots	-
+Modules/_sqlite/prepare_protocol.c	-	type_slots	-
+Modules/_sqlite/row.c	-	row_slots	-
+Modules/_sqlite/statement.c	-	stmt_slots	-
+Modules/_ssl.c	-	sslerror_type_slots	-
+Modules/_struct.c	-	unpackiter_type_slots	-
+Modules/_struct.c	-	PyStructType_slots	-
+Modules/_tkinter.c	-	PyTclObject_Type_slots	-
+Modules/_tkinter.c	-	Tktt_Type_slots	-
+Modules/_tkinter.c	-	Tkapp_Type_slots	-
+Modules/unicodedata.c	-	ucd_type_slots	-
+Modules/_winapi.c	-	winapi_overlapped_type_slots	-
+Modules/xxlimited.c	-	Xxo_Type_slots	-
+Modules/xxlimited.c	-	Str_Type_slots	-
+Modules/xxlimited.c	-	Null_Type_slots	-
+Modules/zlibmodule.c	-	Comptype_slots	-
+Modules/zlibmodule.c	-	Decomptype_slots	-
+Python/Python-ast.c	-	AST_type_slots	-
+
+# PyType_Spec  []
+Modules/_abc.c	-	_abc_data_type_spec	-
+Modules/_blake2/blake2b_impl.c	-	blake2b_type_spec	-
+Modules/_blake2/blake2s_impl.c	-	blake2s_type_spec	-
+Modules/_bz2module.c	-	bz2_compressor_type_spec	-
+Modules/_bz2module.c	-	bz2_decompressor_type_spec	-
+Modules/_curses_panel.c	-	PyCursesPanel_Type_spec	-
+Modules/_dbmmodule.c	-	dbmtype_spec	-
+Modules/_gdbmmodule.c	-	gdbmtype_spec	-
+Modules/_hashopenssl.c	-	EVPtype_spec	-
+Modules/_hashopenssl.c	-	EVPXOFtype_spec	-
+Modules/_hashopenssl.c	-	HMACtype_spec	-
+Modules/_json.c	-	PyScannerType_spec	-
+Modules/_json.c	-	PyEncoderType_spec	-
+Modules/_lsprof.c	-	_lsprof_profiler_type_spec	-
+Modules/_lzmamodule.c	-	lzma_compressor_type_spec	-
+Modules/_lzmamodule.c	-	lzma_decompressor_type_spec	-
+Modules/_operator.c	-	itemgetter_type_spec	-
+Modules/_operator.c	-	attrgetter_type_spec	-
+Modules/_operator.c	-	methodcaller_type_spec	-
+Modules/_randommodule.c	-	Random_Type_spec	-
+Modules/_sha3/sha3module.c	-	sha3_224_spec	-
+Modules/_sha3/sha3module.c	-	sha3_256_spec	-
+Modules/_sha3/sha3module.c	-	sha3_384_spec	-
+Modules/_sha3/sha3module.c	-	sha3_512_spec	-
+Modules/_sha3/sha3module.c	-	SHAKE128_spec	-
+Modules/_sha3/sha3module.c	-	SHAKE256_spec	-
+Modules/_sha3/sha3module.c	-	type_spec_obj	-
+Modules/_sqlite/cache.c	-	pysqlite_NodeType_spec	-
+Modules/_sqlite/cache.c	-	pysqlite_CacheType_spec	-
+Modules/_sqlite/connection.c	-	connection_spec	-
+Modules/_sqlite/cursor.c	-	cursor_spec	-
+Modules/_sqlite/prepare_protocol.c	-	type_spec	-
+Modules/_sqlite/row.c	-	row_spec	-
+Modules/_sqlite/statement.c	-	stmt_spec	-
+Modules/_ssl.c	-	sslerror_type_spec	-
+Modules/_struct.c	-	unpackiter_type_spec	-
+Modules/_struct.c	-	PyStructType_spec	-
+Modules/_tkinter.c	-	PyTclObject_Type_spec	-
+Modules/_tkinter.c	-	Tktt_Type_spec	-
+Modules/_tkinter.c	-	Tkapp_Type_spec	-
+Modules/_winapi.c	-	winapi_overlapped_type_spec	-
+Modules/_zoneinfo.c	-	DAYS_IN_MONTH	-
+Modules/_zoneinfo.c	-	DAYS_BEFORE_MONTH	-
+Modules/md5module.c	-	md5_type_spec	-
+Modules/overlapped.c	-	overlapped_type_spec	-
+Modules/posixmodule.c	-	DirEntryType_spec	-
+Modules/posixmodule.c	-	ScandirIteratorType_spec	-
+Modules/selectmodule.c	-	devpoll_Type_spec	-
+Modules/selectmodule.c	-	kqueue_event_Type_spec	-
+Modules/selectmodule.c	-	poll_Type_spec	-
+Modules/selectmodule.c	-	pyEpoll_Type_spec	-
+Modules/selectmodule.c	-	kqueue_queue_Type_spec	-
+Modules/sha1module.c	-	sha1_type_spec	-
+Modules/sha256module.c	-	sha224_type_spec	-
+Modules/sha256module.c	-	sha256_type_spec	-
+Modules/sha512module.c	-	sha512_sha384_type_spec	-
+Modules/sha512module.c	-	sha512_sha512_type_spec	-
+Modules/unicodedata.c	-	ucd_type_spec	-
+Modules/xxlimited.c	-	Xxo_Type_spec	-
+Modules/xxlimited.c	-	Str_Type_spec	-
+Modules/xxlimited.c	-	Null_Type_spec	-
+Modules/zlibmodule.c	-	Comptype_spec	-
+Modules/zlibmodule.c	-	Decomptype_spec	-
+Python/Python-ast.c	-	AST_type_spec	-
+
+#-----------------------
+# for structseq
+# []
+
+# PyStructSequence_Field[]  []
+Modules/_cursesmodule.c	-	ncurses_version_fields	-
+Modules/grpmodule.c	-	struct_group_type_fields	-
+Modules/_lsprof.c	-	profiler_entry_fields	-
+Modules/_lsprof.c	-	profiler_subentry_fields	-
+Modules/posixmodule.c	-	stat_result_fields	-
+Modules/posixmodule.c	-	statvfs_result_fields	-
+Modules/posixmodule.c	-	waitid_result_fields	-
+Modules/posixmodule.c	-	uname_result_fields	-
+Modules/posixmodule.c	-	sched_param_fields	-
+Modules/posixmodule.c	-	times_result_fields	-
+Modules/posixmodule.c	-	TerminalSize_fields	-
+Modules/pwdmodule.c	-	struct_pwd_type_fields	-
+Modules/resource.c	-	struct_rusage_fields	-
+Modules/signalmodule.c	-	struct_siginfo_fields	-
+Modules/spwdmodule.c	-	struct_spwd_type_fields	-
+Modules/_threadmodule.c	-	ExceptHookArgs_fields	-
+Modules/timemodule.c	-	struct_time_type_fields	-
+Objects/floatobject.c	-	floatinfo_fields	-
+Objects/longobject.c	-	int_info_fields	-
+Python/errors.c	-	UnraisableHookArgs_fields	-
+Python/sysmodule.c	-	asyncgen_hooks_fields	-
+Python/sysmodule.c	-	hash_info_fields	-
+Python/sysmodule.c	-	windows_version_fields	-
+Python/sysmodule.c	-	flags_fields	-
+Python/sysmodule.c	-	version_info_fields	-
+Python/thread.c	-	threadinfo_fields	-
+
+# PyStructSequence_Desc  []
+Modules/_cursesmodule.c	-	ncurses_version_desc	-
+Modules/grpmodule.c	-	struct_group_type_desc	-
+Modules/_lsprof.c	-	profiler_entry_desc	-
+Modules/_lsprof.c	-	profiler_subentry_desc	-
+Modules/posixmodule.c	-	stat_result_desc	-
+Modules/posixmodule.c	-	statvfs_result_desc	-
+Modules/posixmodule.c	-	waitid_result_desc	-
+Modules/posixmodule.c	-	uname_result_desc	-
+Modules/posixmodule.c	-	sched_param_desc	-
+Modules/posixmodule.c	-	times_result_desc	-
+Modules/posixmodule.c	-	TerminalSize_desc	-
+Modules/pwdmodule.c	-	struct_pwd_type_desc	-
+Modules/resource.c	-	struct_rusage_desc	-
+Modules/signalmodule.c	-	struct_siginfo_desc	-
+Modules/spwdmodule.c	-	struct_spwd_type_desc	-
+Modules/_threadmodule.c	-	ExceptHookArgs_desc	-
+Modules/timemodule.c	-	struct_time_type_desc	-
+Objects/floatobject.c	-	floatinfo_desc	-
+Objects/longobject.c	-	int_info_desc	-
+Python/errors.c	-	UnraisableHookArgs_desc	-
+Python/sysmodule.c	-	asyncgen_hooks_desc	-
+Python/sysmodule.c	-	hash_info_desc	-
+Python/sysmodule.c	-	windows_version_desc	-
+Python/sysmodule.c	-	flags_desc	-
+Python/sysmodule.c	-	version_info_desc	-
+Python/thread.c	-	threadinfo_desc	-
+
+#-----------------------
+# _PyArg_Parser
+# []
+
+Modules/clinic/md5module.c.h	MD5Type_copy	_parser	-
+Modules/clinic/md5module.c.h	_md5_md5	_parser	-
+Modules/clinic/_dbmmodule.c.h	_dbm_dbm_keys	_parser	-
+Modules/clinic/_dbmmodule.c.h	_dbm_dbm_get	_parser	-
+Modules/clinic/_dbmmodule.c.h	_dbm_dbm_setdefault	_parser	-
+Modules/clinic/posixmodule.c.h	os_stat	_parser	-
+Modules/clinic/posixmodule.c.h	os_lstat	_parser	-
+Modules/clinic/posixmodule.c.h	os_access	_parser	-
+Modules/clinic/posixmodule.c.h	os_chdir	_parser	-
+Modules/clinic/posixmodule.c.h	os_chmod	_parser	-
+Modules/clinic/posixmodule.c.h	os_listdir	_parser	-
+Modules/clinic/posixmodule.c.h	os_mkdir	_parser	-
+Modules/clinic/posixmodule.c.h	os_rename	_parser	-
+Modules/clinic/posixmodule.c.h	os_replace	_parser	-
+Modules/clinic/posixmodule.c.h	os_rmdir	_parser	-
+Modules/clinic/posixmodule.c.h	os_unlink	_parser	-
+Modules/clinic/posixmodule.c.h	os_remove	_parser	-
+Modules/clinic/posixmodule.c.h	os_utime	_parser	-
+Modules/clinic/posixmodule.c.h	os__exit	_parser	-
+Modules/clinic/posixmodule.c.h	os_open	_parser	-
+Modules/clinic/posixmodule.c.h	os_close	_parser	-
+Modules/clinic/posixmodule.c.h	os_dup2	_parser	-
+Modules/clinic/posixmodule.c.h	os_fstat	_parser	-
+Modules/clinic/posixmodule.c.h	os_device_encoding	_parser	-
+Modules/clinic/posixmodule.c.h	os_DirEntry_is_symlink	_parser	-
+Modules/clinic/posixmodule.c.h	os_DirEntry_stat	_parser	-
+Modules/clinic/posixmodule.c.h	os_DirEntry_is_dir	_parser	-
+Modules/clinic/posixmodule.c.h	os_DirEntry_is_file	_parser	-
+Modules/clinic/posixmodule.c.h	os_scandir	_parser	-
+Modules/clinic/posixmodule.c.h	os_fspath	_parser	-
+Modules/clinic/cmathmodule.c.h	cmath_isclose	_parser	-
+Modules/clinic/sha256module.c.h	SHA256Type_copy	_parser	-
+Modules/clinic/sha256module.c.h	_sha256_sha256	_parser	-
+Modules/clinic/sha256module.c.h	_sha256_sha224	_parser	-
+Modules/clinic/_hashopenssl.c.h	EVP_new	_parser	-
+Modules/clinic/_hashopenssl.c.h	_hashlib_openssl_md5	_parser	-
+Modules/clinic/_hashopenssl.c.h	_hashlib_openssl_sha1	_parser	-
+Modules/clinic/_hashopenssl.c.h	_hashlib_openssl_sha224	_parser	-
+Modules/clinic/_hashopenssl.c.h	_hashlib_openssl_sha256	_parser	-
+Modules/clinic/_hashopenssl.c.h	_hashlib_openssl_sha384	_parser	-
+Modules/clinic/_hashopenssl.c.h	_hashlib_openssl_sha512	_parser	-
+Modules/clinic/_hashopenssl.c.h	pbkdf2_hmac	_parser	-
+Modules/clinic/_hashopenssl.c.h	_hashlib_hmac_singleshot	_parser	-
+Modules/clinic/_hashopenssl.c.h	_hashlib_hmac_new	_parser	-
+Modules/clinic/_hashopenssl.c.h	_hashlib_HMAC_update	_parser	-
+Modules/clinic/_ssl.c.h	_ssl__SSLSocket_get_channel_binding	_parser	-
+Modules/clinic/_ssl.c.h	_ssl__SSLContext_load_cert_chain	_parser	-
+Modules/clinic/_ssl.c.h	_ssl__SSLContext_load_verify_locations	_parser	-
+Modules/clinic/_ssl.c.h	_ssl__SSLContext__wrap_socket	_parser	-
+Modules/clinic/_ssl.c.h	_ssl__SSLContext__wrap_bio	_parser	-
+Modules/clinic/_ssl.c.h	_ssl__SSLContext_get_ca_certs	_parser	-
+Modules/clinic/_ssl.c.h	_ssl_txt2obj	_parser	-
+Modules/clinic/_queuemodule.c.h	_queue_SimpleQueue_put	_parser	-
+Modules/clinic/_queuemodule.c.h	_queue_SimpleQueue_put_nowait	_parser	-
+Modules/clinic/_queuemodule.c.h	_queue_SimpleQueue_get	_parser	-
+Modules/clinic/_lsprof.c.h	_lsprof_Profiler_getstats	_parser	-
+Modules/clinic/_datetimemodule.c.h	iso_calendar_date_new	_parser	-
+Modules/clinic/_datetimemodule.c.h	datetime_datetime_now	_parser	-
+Modules/clinic/_opcode.c.h	_opcode_stack_effect	_parser	-
+Modules/clinic/_lzmamodule.c.h	_lzma_LZMADecompressor_decompress	_parser	-
+Modules/clinic/_lzmamodule.c.h	_lzma_LZMADecompressor___init__	_parser	-
+Modules/clinic/pyexpat.c.h	pyexpat_ParserCreate	_parser	-
+Modules/clinic/mathmodule.c.h	math_isclose	_parser	-
+Modules/clinic/mathmodule.c.h	math_prod	_parser	-
+Modules/clinic/_curses_panel.c.h	_curses_panel_panel_bottom	_parser	-
+Modules/clinic/_curses_panel.c.h	_curses_panel_panel_hide	_parser	-
+Modules/clinic/_curses_panel.c.h	_curses_panel_panel_show	_parser	-
+Modules/clinic/_curses_panel.c.h	_curses_panel_panel_top	_parser	-
+Modules/clinic/_curses_panel.c.h	_curses_panel_panel_move	_parser	-
+Modules/clinic/_curses_panel.c.h	_curses_panel_panel_replace	_parser	-
+Modules/clinic/_curses_panel.c.h	_curses_panel_panel_set_userptr	_parser	-
+Modules/clinic/_curses_panel.c.h	_curses_panel_panel_userptr	_parser	-
+Modules/clinic/_elementtree.c.h	_elementtree_Element_find	_parser	-
+Modules/clinic/_elementtree.c.h	_elementtree_Element_findtext	_parser	-
+Modules/clinic/_elementtree.c.h	_elementtree_Element_findall	_parser	-
+Modules/clinic/_elementtree.c.h	_elementtree_Element_iterfind	_parser	-
+Modules/clinic/_elementtree.c.h	_elementtree_Element_get	_parser	-
+Modules/clinic/_elementtree.c.h	_elementtree_Element_iter	_parser	-
+Modules/clinic/_elementtree.c.h	_elementtree_TreeBuilder___init__	_parser	-
+Modules/clinic/_elementtree.c.h	_elementtree_XMLParser___init__	_parser	-
+Modules/clinic/_asynciomodule.c.h	_asyncio_Future___init__	_parser	-
+Modules/clinic/_asynciomodule.c.h	_asyncio_Future_add_done_callback	_parser	-
+Modules/clinic/_asynciomodule.c.h	_asyncio_Future_cancel	_parser	-
+Modules/clinic/_asynciomodule.c.h	_asyncio_Task___init__	_parser	-
+Modules/clinic/_asynciomodule.c.h	_asyncio_Task_cancel	_parser	-
+Modules/clinic/_asynciomodule.c.h	_asyncio_Task_get_stack	_parser	-
+Modules/clinic/_asynciomodule.c.h	_asyncio_Task_print_stack	_parser	-
+Modules/clinic/_asynciomodule.c.h	_asyncio__register_task	_parser	-
+Modules/clinic/_asynciomodule.c.h	_asyncio__unregister_task	_parser	-
+Modules/clinic/_asynciomodule.c.h	_asyncio__enter_task	_parser	-
+Modules/clinic/_asynciomodule.c.h	_asyncio__leave_task	_parser	-
+Modules/clinic/gcmodule.c.h	gc_collect	_parser	-
+Modules/clinic/gcmodule.c.h	gc_get_objects	_parser	-
+Modules/clinic/grpmodule.c.h	grp_getgrgid	_parser	-
+Modules/clinic/grpmodule.c.h	grp_getgrnam	_parser	-
+Modules/clinic/_pickle.c.h	_pickle_Pickler___init__	_parser	-
+Modules/clinic/_pickle.c.h	_pickle_Unpickler___init__	_parser	-
+Modules/clinic/_pickle.c.h	_pickle_dump	_parser	-
+Modules/clinic/_pickle.c.h	_pickle_dumps	_parser	-
+Modules/clinic/_pickle.c.h	_pickle_load	_parser	-
+Modules/clinic/_pickle.c.h	_pickle_loads	_parser	-
+Modules/clinic/_struct.c.h	Struct___init__	_parser	-
+Modules/clinic/_struct.c.h	Struct_unpack_from	_parser	-
+Modules/clinic/_struct.c.h	unpack_from	_parser	-
+Modules/clinic/_testmultiphase.c.h	_testmultiphase_StateAccessType_get_defining_module	_parser	-
+Modules/clinic/_testmultiphase.c.h	_testmultiphase_StateAccessType_increment_count_clinic	_parser	-
+Modules/clinic/_testmultiphase.c.h	_testmultiphase_StateAccessType_get_count	_parser	-
+Modules/clinic/_gdbmmodule.c.h	_gdbm_gdbm_keys	_parser	-
+Modules/clinic/_gdbmmodule.c.h	_gdbm_gdbm_firstkey	_parser	-
+Modules/clinic/_gdbmmodule.c.h	_gdbm_gdbm_nextkey	_parser	-
+Modules/clinic/_gdbmmodule.c.h	_gdbm_gdbm_reorganize	_parser	-
+Modules/clinic/_gdbmmodule.c.h	_gdbm_gdbm_sync	_parser	-
+Modules/clinic/_sre.c.h	_sre_SRE_Pattern_match	_parser	-
+Modules/clinic/_sre.c.h	_sre_SRE_Pattern_fullmatch	_parser	-
+Modules/clinic/_sre.c.h	_sre_SRE_Pattern_search	_parser	-
+Modules/clinic/_sre.c.h	_sre_SRE_Pattern_findall	_parser	-
+Modules/clinic/_sre.c.h	_sre_SRE_Pattern_finditer	_parser	-
+Modules/clinic/_sre.c.h	_sre_SRE_Pattern_scanner	_parser	-
+Modules/clinic/_sre.c.h	_sre_SRE_Pattern_split	_parser	-
+Modules/clinic/_sre.c.h	_sre_SRE_Pattern_sub	_parser	-
+Modules/clinic/_sre.c.h	_sre_SRE_Pattern_subn	_parser	-
+Modules/clinic/_sre.c.h	_sre_compile	_parser	-
+Modules/clinic/_sre.c.h	_sre_SRE_Match_expand	_parser	-
+Modules/clinic/_sre.c.h	_sre_SRE_Match_groups	_parser	-
+Modules/clinic/_sre.c.h	_sre_SRE_Match_groupdict	_parser	-
+Modules/clinic/overlapped.c.h	_overlapped_Overlapped	_parser	-
+Modules/clinic/_bisectmodule.c.h	_bisect_bisect_right	_parser	-
+Modules/clinic/_bisectmodule.c.h	_bisect_insort_right	_parser	-
+Modules/clinic/_bisectmodule.c.h	_bisect_bisect_left	_parser	-
+Modules/clinic/_bisectmodule.c.h	_bisect_insort_left	_parser	-
+Modules/clinic/zlibmodule.c.h	zlib_compress	_parser	-
+Modules/clinic/zlibmodule.c.h	zlib_decompress	_parser	-
+Modules/clinic/zlibmodule.c.h	zlib_compressobj	_parser	-
+Modules/clinic/zlibmodule.c.h	zlib_decompressobj	_parser	-
+Modules/clinic/zlibmodule.c.h	zlib_Compress_compress	_parser	-
+Modules/clinic/zlibmodule.c.h	zlib_Decompress_decompress	_parser	-
+Modules/clinic/zlibmodule.c.h	zlib_Compress_flush	_parser	-
+Modules/clinic/zlibmodule.c.h	zlib_Decompress_flush	_parser	-
+Modules/clinic/sha512module.c.h	SHA512Type_copy	_parser	-
+Modules/clinic/sha512module.c.h	_sha512_sha512	_parser	-
+Modules/clinic/sha512module.c.h	_sha512_sha384	_parser	-
+Modules/clinic/_bz2module.c.h	_bz2_BZ2Decompressor_decompress	_parser	-
+Modules/clinic/sha1module.c.h	SHA1Type_copy	_parser	-
+Modules/clinic/sha1module.c.h	_sha1_sha1	_parser	-
+Modules/clinic/_winapi.c.h	_winapi_ConnectNamedPipe	_parser	-
+Modules/clinic/_winapi.c.h	_winapi_ReadFile	_parser	-
+Modules/clinic/_winapi.c.h	_winapi_WriteFile	_parser	-
+Modules/clinic/_winapi.c.h	_winapi_GetFileType	_parser	-
+Modules/clinic/_codecsmodule.c.h	_codecs_encode	_parser	-
+Modules/clinic/_codecsmodule.c.h	_codecs_decode	_parser	-
+Modules/clinic/_cursesmodule.c.h	_curses_setupterm	_parser	-
+Modules/clinic/itertoolsmodule.c.h	itertools_groupby	_parser	-
+Modules/clinic/itertoolsmodule.c.h	itertools_combinations	_parser	-
+Modules/clinic/itertoolsmodule.c.h	itertools_combinations_with_replacement	_parser	-
+Modules/clinic/itertoolsmodule.c.h	itertools_permutations	_parser	-
+Modules/clinic/itertoolsmodule.c.h	itertools_accumulate	_parser	-
+Modules/clinic/itertoolsmodule.c.h	itertools_compress	_parser	-
+Modules/clinic/itertoolsmodule.c.h	itertools_count	_parser	-
+Modules/clinic/binascii.c.h	binascii_b2a_uu	_parser	-
+Modules/clinic/binascii.c.h	binascii_b2a_base64	_parser	-
+Modules/clinic/binascii.c.h	binascii_b2a_hex	_parser	-
+Modules/clinic/binascii.c.h	binascii_hexlify	_parser	-
+Modules/clinic/binascii.c.h	binascii_a2b_qp	_parser	-
+Modules/clinic/binascii.c.h	binascii_b2a_qp	_parser	-
+Objects/clinic/enumobject.c.h	enum_new	_parser	-
+Objects/clinic/bytearrayobject.c.h	bytearray___init__	_parser	-
+Objects/clinic/bytearrayobject.c.h	bytearray_translate	_parser	-
+Objects/clinic/bytearrayobject.c.h	bytearray_split	_parser	-
+Objects/clinic/bytearrayobject.c.h	bytearray_rsplit	_parser	-
+Objects/clinic/bytearrayobject.c.h	bytearray_decode	_parser	-
+Objects/clinic/bytearrayobject.c.h	bytearray_splitlines	_parser	-
+Objects/clinic/bytearrayobject.c.h	bytearray_hex	_parser	-
+Objects/clinic/descrobject.c.h	mappingproxy_new	_parser	-
+Objects/clinic/descrobject.c.h	property_init	_parser	-
+Objects/clinic/longobject.c.h	long_new	_parser	-
+Objects/clinic/longobject.c.h	int_to_bytes	_parser	-
+Objects/clinic/longobject.c.h	int_from_bytes	_parser	-
+Objects/clinic/moduleobject.c.h	module___init__	_parser	-
+Objects/clinic/structseq.c.h	structseq_new	_parser	-
+Objects/clinic/memoryobject.c.h	memoryview	_parser	-
+Objects/clinic/memoryobject.c.h	memoryview_cast	_parser	-
+Objects/clinic/memoryobject.c.h	memoryview_tobytes	_parser	-
+Objects/clinic/memoryobject.c.h	memoryview_hex	_parser	-
+Objects/clinic/listobject.c.h	list_sort	_parser	-
+Objects/clinic/odictobject.c.h	OrderedDict_fromkeys	_parser	-
+Objects/clinic/odictobject.c.h	OrderedDict_setdefault	_parser	-
+Objects/clinic/odictobject.c.h	OrderedDict_pop	_parser	-
+Objects/clinic/odictobject.c.h	OrderedDict_popitem	_parser	-
+Objects/clinic/odictobject.c.h	OrderedDict_move_to_end	_parser	-
+Objects/clinic/complexobject.c.h	complex_new	_parser	-
+Objects/clinic/unicodeobject.c.h	unicode_encode	_parser	-
+Objects/clinic/unicodeobject.c.h	unicode_expandtabs	_parser	-
+Objects/clinic/unicodeobject.c.h	unicode_split	_parser	-
+Objects/clinic/unicodeobject.c.h	unicode_rsplit	_parser	-
+Objects/clinic/unicodeobject.c.h	unicode_splitlines	_parser	-
+Objects/clinic/unicodeobject.c.h	unicode_new	_parser	-
+Objects/clinic/bytesobject.c.h	bytes_split	_parser	-
+Objects/clinic/bytesobject.c.h	bytes_rsplit	_parser	-
+Objects/clinic/bytesobject.c.h	bytes_translate	_parser	-
+Objects/clinic/bytesobject.c.h	bytes_decode	_parser	-
+Objects/clinic/bytesobject.c.h	bytes_splitlines	_parser	-
+Objects/clinic/bytesobject.c.h	bytes_hex	_parser	-
+Objects/clinic/bytesobject.c.h	bytes_new	_parser	-
+Objects/clinic/funcobject.c.h	func_new	_parser	-
+Objects/clinic/codeobject.c.h	code_replace	_parser	-
+Python/clinic/traceback.c.h	tb_new	_parser	-
+Python/clinic/bltinmodule.c.h	builtin_compile	_parser	-
+Python/clinic/bltinmodule.c.h	builtin_pow	_parser	-
+Python/clinic/bltinmodule.c.h	builtin_round	_parser	-
+Python/clinic/bltinmodule.c.h	builtin_sum	_parser	-
+Python/clinic/import.c.h	_imp_source_hash	_parser	-
+Python/clinic/sysmodule.c.h	sys_addaudithook	_parser	-
+Python/clinic/sysmodule.c.h	sys_set_coroutine_origin_tracking_depth	_parser	-
+Python/clinic/_warnings.c.h	warnings_warn	_parser	-
+
+#-----------------------
+# other vars that are actually constant
+# []
+
+Modules/_csv.c	-	quote_styles	-
+Modules/_ctypes/cfield.c	-	ffi_type_void	-
+Modules/_ctypes/cfield.c	-	ffi_type_uint8	-
+Modules/_ctypes/cfield.c	-	ffi_type_sint8	-
+Modules/_ctypes/cfield.c	-	ffi_type_uint16	-
+Modules/_ctypes/cfield.c	-	ffi_type_sint16	-
+Modules/_ctypes/cfield.c	-	ffi_type_uint32	-
+Modules/_ctypes/cfield.c	-	ffi_type_sint32	-
+Modules/_ctypes/cfield.c	-	ffi_type_uint64	-
+Modules/_ctypes/cfield.c	-	ffi_type_sint64	-
+Modules/_ctypes/cfield.c	-	ffi_type_float	-
+Modules/_ctypes/cfield.c	-	ffi_type_double	-
+Modules/_ctypes/cfield.c	-	ffi_type_longdouble	-
+Modules/_ctypes/cfield.c	-	ffi_type_pointer	-
+Modules/_datetimemodule.c	-	epoch	-
+Modules/_datetimemodule.c	-	max_fold_seconds	-
+Modules/_datetimemodule.c	datetime_isoformat	specs	-
+Modules/_datetimemodule.c	time_isoformat	specs	-
+Modules/_decimal/_decimal.c	-	cond_map	-
+Modules/_decimal/_decimal.c	-	dec_signal_string	-
+Modules/_decimal/_decimal.c	-	dflt_ctx	-
+Modules/_decimal/_decimal.c	-	int_constants	-
+Modules/_decimal/_decimal.c	-	invalid_rounding_err	-
+Modules/_decimal/_decimal.c	-	invalid_signals_err	-
+Modules/_decimal/_decimal.c	-	signal_map	-
+Modules/_decimal/_decimal.c	-	ssize_constants	-
+Modules/_elementtree.c	-	ExpatMemoryHandler	-
+Modules/_io/textio.c	-	encodefuncs	-
+Modules/_localemodule.c	-	langinfo_constants	-
+Modules/_sre.c	pattern_repr	flag_names	-
+Modules/_struct.c	-	bigendian_table	-
+Modules/_struct.c	-	lilendian_table	-
+Modules/_tkinter.c	-	state_key	-
+Modules/_xxsubinterpretersmodule.c	-	_channelid_end_send	-
+Modules/_xxsubinterpretersmodule.c	-	_channelid_end_recv	-
+Modules/arraymodule.c	-	descriptors	-
+Modules/arraymodule.c	-	emptybuf	-
+Modules/cjkcodecs/cjkcodecs.h	-	__methods	-
+Modules/cmathmodule.c	-	acos_special_values	-
+Modules/cmathmodule.c	-	acosh_special_values	-
+Modules/cmathmodule.c	-	asinh_special_values	-
+Modules/cmathmodule.c	-	atanh_special_values	-
+Modules/cmathmodule.c	-	cosh_special_values	-
+Modules/cmathmodule.c	-	exp_special_values	-
+Modules/cmathmodule.c	-	log_special_values	-
+Modules/cmathmodule.c	-	sinh_special_values	-
+Modules/cmathmodule.c	-	sqrt_special_values	-
+Modules/cmathmodule.c	-	tanh_special_values	-
+Modules/cmathmodule.c	-	rect_special_values	-
+Modules/config.c	-	_PyImport_Inittab	-
+Modules/faulthandler.c	-	faulthandler_handlers	-
+Modules/getnameinfo.c	-	gni_afdl	-
+Modules/ossaudiodev.c	-	control_labels	-
+Modules/ossaudiodev.c	-	control_names	-
+Modules/nismodule.c	-	aliases	-
+Modules/nismodule.c	-	TIMEOUT	-
+Modules/posixmodule.c	-	posix_constants_pathconf	-
+Modules/posixmodule.c	-	posix_constants_confstr	-
+Modules/posixmodule.c	-	posix_constants_sysconf	-
+Modules/pyexpat.c	-	ExpatMemoryHandler	-
+Modules/pyexpat.c	-	handler_info	-
+Modules/termios.c	-	termios_constants	-
+Modules/timemodule.c	init_timezone	YEAR	-
+Objects/bytearrayobject.c	-	_PyByteArray_empty_string	-
+Objects/complexobject.c	-	c_1	-
+Objects/genobject.c	-	NON_INIT_CORO_MSG	-
+Objects/genobject.c	-	ASYNC_GEN_IGNORED_EXIT_MSG	-
+Objects/longobject.c	-	_PyLong_DigitValue	-
+Objects/object.c	-	_Py_abstract_hack	-
+Objects/object.c	-	_Py_SwappedOp	-
+Objects/obmalloc.c	-	_PyMem	-
+Objects/obmalloc.c	-	_PyMem_Debug	-
+Objects/obmalloc.c	-	_PyMem_Raw	-
+Objects/obmalloc.c	-	_PyObject	-
+Objects/obmalloc.c	-	usedpools	-
+Objects/unicodeobject.c	unicode_decode_call_errorhandler_wchar	argparse	-
+Objects/unicodeobject.c	unicode_decode_call_errorhandler_writer	argparse	-
+Objects/unicodeobject.c	unicode_encode_call_errorhandler	argparse	-
+Objects/unicodeobject.c	unicode_translate_call_errorhandler	argparse	-
+Objects/unicodeobject.c	-	stripfuncnames	-
+Objects/unicodeobject.c	-	utf7_category	-
+Parser/parser.c	-	reserved_keywords	-
+Parser/tokenizer.c	-	type_comment_prefix	-
+Python/opcode_targets.h	-	opcode_targets	-
+
+
+##################################
+# temporary whitelist - globals to fix
+
+# These are all variables that we will be making non-global.
+
+#-----------------------
+# runtime static types
+# []
+
+Objects/floatobject.c	-	FloatInfoType	-
+Objects/floatobject.c	-	PyFloat_Type	-
+Objects/listobject.c	-	PyList_Type	-
+Objects/listobject.c	-	PyListIter_Type	-
+Objects/listobject.c	-	PyListRevIter_Type	-
+Objects/setobject.c	-	_PySetDummy_Type	-
+Objects/setobject.c	-	PySetIter_Type	-
+Objects/setobject.c	-	PySet_Type	-
+Objects/setobject.c	-	PyFrozenSet_Type	-
+Objects/genobject.c	-	PyGen_Type	-
+Objects/genobject.c	-	PyCoro_Type	-
+Objects/genobject.c	-	_PyCoroWrapper_Type	-
+Objects/genobject.c	-	PyAsyncGen_Type	-
+Objects/genobject.c	-	_PyAsyncGenASend_Type	-
+Objects/genobject.c	-	_PyAsyncGenWrappedValue_Type	-
+Objects/genobject.c	-	_PyAsyncGenAThrow_Type	-
+Objects/classobject.c	-	PyMethod_Type	-
+Objects/classobject.c	-	PyInstanceMethod_Type	-
+Objects/complexobject.c	-	PyComplex_Type	-
+Objects/sliceobject.c	-	PyEllipsis_Type	-
+Objects/sliceobject.c	-	PySlice_Type	-
+Objects/bytesobject.c	-	PyBytes_Type	-
+Objects/bytesobject.c	-	PyBytesIter_Type	-
+Objects/descrobject.c	-	PyMethodDescr_Type	-
+Objects/descrobject.c	-	PyClassMethodDescr_Type	-
+Objects/descrobject.c	-	PyMemberDescr_Type	-
+Objects/descrobject.c	-	PyGetSetDescr_Type	-
+Objects/descrobject.c	-	PyWrapperDescr_Type	-
+Objects/descrobject.c	-	_PyMethodWrapper_Type	-
+Objects/descrobject.c	-	PyDictProxy_Type	-
+Objects/descrobject.c	-	PyProperty_Type	-
+Objects/unicodeobject.c	-	EncodingMapType	-
+Objects/unicodeobject.c	-	PyUnicode_Type	-
+Objects/unicodeobject.c	-	PyUnicodeIter_Type	-
+Objects/unionobject.c	-	_Py_UnionType	-
+Objects/moduleobject.c	-	PyModuleDef_Type	-
+Objects/moduleobject.c	-	PyModule_Type	-
+Objects/capsule.c	-	PyCapsule_Type	-
+Objects/methodobject.c	-	PyCFunction_Type	-
+Objects/methodobject.c	-	PyCMethod_Type	-
+Objects/bytearrayobject.c	-	PyByteArray_Type	-
+Objects/bytearrayobject.c	-	PyByteArrayIter_Type	-
+Objects/interpreteridobject.c	-	_PyInterpreterID_Type	-
+Objects/enumobject.c	-	PyEnum_Type	-
+Objects/enumobject.c	-	PyReversed_Type	-
+Objects/picklebufobject.c	-	PyPickleBuffer_Type	-
+Objects/object.c	-	_PyNone_Type	-
+Objects/object.c	-	_PyNotImplemented_Type	-
+Objects/fileobject.c	-	PyStdPrinter_Type	-
+Objects/weakrefobject.c	-	_PyWeakref_RefType	-
+Objects/weakrefobject.c	-	_PyWeakref_ProxyType	-
+Objects/weakrefobject.c	-	_PyWeakref_CallableProxyType	-
+Objects/genericaliasobject.c	-	Py_GenericAliasType	-
+Objects/rangeobject.c	-	PyRange_Type	-
+Objects/rangeobject.c	-	PyRangeIter_Type	-
+Objects/rangeobject.c	-	PyLongRangeIter_Type	-
+Objects/namespaceobject.c	-	_PyNamespace_Type	-
+Objects/iterobject.c	-	PySeqIter_Type	-
+Objects/iterobject.c	-	PyCallIter_Type	-
+Objects/boolobject.c	-	PyBool_Type	-
+Objects/frameobject.c	-	PyFrame_Type	-
+Objects/longobject.c	-	Int_InfoType	-
+Objects/longobject.c	-	PyLong_Type	-
+Objects/funcobject.c	-	PyFunction_Type	-
+Objects/funcobject.c	-	PyClassMethod_Type	-
+Objects/funcobject.c	-	PyStaticMethod_Type	-
+Objects/typeobject.c	-	PyType_Type	-
+Objects/typeobject.c	-	PyBaseObject_Type	-
+Objects/typeobject.c	-	PySuper_Type	-
+Objects/cellobject.c	-	PyCell_Type	-
+Objects/odictobject.c	-	PyODict_Type	-
+Objects/odictobject.c	-	PyODictIter_Type	-
+Objects/odictobject.c	-	PyODictKeys_Type	-
+Objects/odictobject.c	-	PyODictItems_Type	-
+Objects/odictobject.c	-	PyODictValues_Type	-
+Objects/dictobject.c	-	PyDict_Type	-
+Objects/dictobject.c	-	PyDictIterKey_Type	-
+Objects/dictobject.c	-	PyDictIterValue_Type	-
+Objects/dictobject.c	-	PyDictIterItem_Type	-
+Objects/dictobject.c	-	PyDictRevIterKey_Type	-
+Objects/dictobject.c	-	PyDictRevIterItem_Type	-
+Objects/dictobject.c	-	PyDictRevIterValue_Type	-
+Objects/dictobject.c	-	PyDictKeys_Type	-
+Objects/dictobject.c	-	PyDictItems_Type	-
+Objects/dictobject.c	-	PyDictValues_Type	-
+Objects/memoryobject.c	-	PyMemoryIter_Type	-
+Objects/memoryobject.c	-	_PyManagedBuffer_Type	-
+Objects/memoryobject.c	-	PyMemoryView_Type	-
+Objects/tupleobject.c	-	PyTuple_Type	-
+Objects/tupleobject.c	-	PyTupleIter_Type	-
+Objects/codeobject.c	-	PyCode_Type	-
+
+#-----------------------
+# builtin exception types
+# []
+
+Objects/exceptions.c	-	_PyExc_BaseException	-
+Objects/exceptions.c	-	_PyExc_UnicodeEncodeError	-
+Objects/exceptions.c	-	_PyExc_UnicodeDecodeError	-
+Objects/exceptions.c	-	_PyExc_UnicodeTranslateError	-
+Objects/exceptions.c	-	_PyExc_MemoryError	-
+Objects/exceptions.c	-	_PyExc_Exception	-
+Objects/exceptions.c	-	_PyExc_TypeError	-
+Objects/exceptions.c	-	_PyExc_StopAsyncIteration	-
+Objects/exceptions.c	-	_PyExc_StopIteration	-
+Objects/exceptions.c	-	_PyExc_GeneratorExit	-
+Objects/exceptions.c	-	_PyExc_SystemExit	-
+Objects/exceptions.c	-	_PyExc_KeyboardInterrupt	-
+Objects/exceptions.c	-	_PyExc_ImportError	-
+Objects/exceptions.c	-	_PyExc_ModuleNotFoundError	-
+Objects/exceptions.c	-	_PyExc_OSError	-
+Objects/exceptions.c	-	_PyExc_BlockingIOError	-
+Objects/exceptions.c	-	_PyExc_ConnectionError	-
+Objects/exceptions.c	-	_PyExc_ChildProcessError	-
+Objects/exceptions.c	-	_PyExc_BrokenPipeError	-
+Objects/exceptions.c	-	_PyExc_ConnectionAbortedError	-
+Objects/exceptions.c	-	_PyExc_ConnectionRefusedError	-
+Objects/exceptions.c	-	_PyExc_ConnectionResetError	-
+Objects/exceptions.c	-	_PyExc_FileExistsError	-
+Objects/exceptions.c	-	_PyExc_FileNotFoundError	-
+Objects/exceptions.c	-	_PyExc_IsADirectoryError	-
+Objects/exceptions.c	-	_PyExc_NotADirectoryError	-
+Objects/exceptions.c	-	_PyExc_InterruptedError	-
+Objects/exceptions.c	-	_PyExc_PermissionError	-
+Objects/exceptions.c	-	_PyExc_ProcessLookupError	-
+Objects/exceptions.c	-	_PyExc_TimeoutError	-
+Objects/exceptions.c	-	_PyExc_EOFError	-
+Objects/exceptions.c	-	_PyExc_RuntimeError	-
+Objects/exceptions.c	-	_PyExc_RecursionError	-
+Objects/exceptions.c	-	_PyExc_NotImplementedError	-
+Objects/exceptions.c	-	_PyExc_NameError	-
+Objects/exceptions.c	-	_PyExc_UnboundLocalError	-
+Objects/exceptions.c	-	_PyExc_AttributeError	-
+Objects/exceptions.c	-	_PyExc_SyntaxError	-
+Objects/exceptions.c	-	_PyExc_IndentationError	-
+Objects/exceptions.c	-	_PyExc_TabError	-
+Objects/exceptions.c	-	_PyExc_LookupError	-
+Objects/exceptions.c	-	_PyExc_IndexError	-
+Objects/exceptions.c	-	_PyExc_KeyError	-
+Objects/exceptions.c	-	_PyExc_ValueError	-
+Objects/exceptions.c	-	_PyExc_UnicodeError	-
+Objects/exceptions.c	-	_PyExc_AssertionError	-
+Objects/exceptions.c	-	_PyExc_ArithmeticError	-
+Objects/exceptions.c	-	_PyExc_FloatingPointError	-
+Objects/exceptions.c	-	_PyExc_OverflowError	-
+Objects/exceptions.c	-	_PyExc_ZeroDivisionError	-
+Objects/exceptions.c	-	_PyExc_SystemError	-
+Objects/exceptions.c	-	_PyExc_ReferenceError	-
+Objects/exceptions.c	-	_PyExc_BufferError	-
+Objects/exceptions.c	-	_PyExc_Warning	-
+Objects/exceptions.c	-	_PyExc_UserWarning	-
+Objects/exceptions.c	-	_PyExc_DeprecationWarning	-
+Objects/exceptions.c	-	_PyExc_PendingDeprecationWarning	-
+Objects/exceptions.c	-	_PyExc_SyntaxWarning	-
+Objects/exceptions.c	-	_PyExc_RuntimeWarning	-
+Objects/exceptions.c	-	_PyExc_FutureWarning	-
+Objects/exceptions.c	-	_PyExc_ImportWarning	-
+Objects/exceptions.c	-	_PyExc_UnicodeWarning	-
+Objects/exceptions.c	-	_PyExc_BytesWarning	-
+Objects/exceptions.c	-	_PyExc_ResourceWarning	-
+Objects/exceptions.c	-	PyExc_EnvironmentError	-
+Objects/exceptions.c	-	PyExc_IOError	-
+Objects/exceptions.c	-	PyExc_BaseException	-
+Objects/exceptions.c	-	PyExc_Exception	-
+Objects/exceptions.c	-	PyExc_TypeError	-
+Objects/exceptions.c	-	PyExc_StopAsyncIteration	-
+Objects/exceptions.c	-	PyExc_StopIteration	-
+Objects/exceptions.c	-	PyExc_GeneratorExit	-
+Objects/exceptions.c	-	PyExc_SystemExit	-
+Objects/exceptions.c	-	PyExc_KeyboardInterrupt	-
+Objects/exceptions.c	-	PyExc_ImportError	-
+Objects/exceptions.c	-	PyExc_ModuleNotFoundError	-
+Objects/exceptions.c	-	PyExc_OSError	-
+Objects/exceptions.c	-	PyExc_BlockingIOError	-
+Objects/exceptions.c	-	PyExc_ConnectionError	-
+Objects/exceptions.c	-	PyExc_ChildProcessError	-
+Objects/exceptions.c	-	PyExc_BrokenPipeError	-
+Objects/exceptions.c	-	PyExc_ConnectionAbortedError	-
+Objects/exceptions.c	-	PyExc_ConnectionRefusedError	-
+Objects/exceptions.c	-	PyExc_ConnectionResetError	-
+Objects/exceptions.c	-	PyExc_FileExistsError	-
+Objects/exceptions.c	-	PyExc_FileNotFoundError	-
+Objects/exceptions.c	-	PyExc_IsADirectoryError	-
+Objects/exceptions.c	-	PyExc_NotADirectoryError	-
+Objects/exceptions.c	-	PyExc_InterruptedError	-
+Objects/exceptions.c	-	PyExc_PermissionError	-
+Objects/exceptions.c	-	PyExc_ProcessLookupError	-
+Objects/exceptions.c	-	PyExc_TimeoutError	-
+Objects/exceptions.c	-	PyExc_EOFError	-
+Objects/exceptions.c	-	PyExc_RuntimeError	-
+Objects/exceptions.c	-	PyExc_RecursionError	-
+Objects/exceptions.c	-	PyExc_NotImplementedError	-
+Objects/exceptions.c	-	PyExc_NameError	-
+Objects/exceptions.c	-	PyExc_UnboundLocalError	-
+Objects/exceptions.c	-	PyExc_AttributeError	-
+Objects/exceptions.c	-	PyExc_SyntaxError	-
+Objects/exceptions.c	-	PyExc_IndentationError	-
+Objects/exceptions.c	-	PyExc_TabError	-
+Objects/exceptions.c	-	PyExc_LookupError	-
+Objects/exceptions.c	-	PyExc_IndexError	-
+Objects/exceptions.c	-	PyExc_KeyError	-
+Objects/exceptions.c	-	PyExc_ValueError	-
+Objects/exceptions.c	-	PyExc_UnicodeError	-
+Objects/exceptions.c	-	PyExc_UnicodeEncodeError	-
+Objects/exceptions.c	-	PyExc_UnicodeDecodeError	-
+Objects/exceptions.c	-	PyExc_UnicodeTranslateError	-
+Objects/exceptions.c	-	PyExc_AssertionError	-
+Objects/exceptions.c	-	PyExc_ArithmeticError	-
+Objects/exceptions.c	-	PyExc_FloatingPointError	-
+Objects/exceptions.c	-	PyExc_OverflowError	-
+Objects/exceptions.c	-	PyExc_ZeroDivisionError	-
+Objects/exceptions.c	-	PyExc_SystemError	-
+Objects/exceptions.c	-	PyExc_ReferenceError	-
+Objects/exceptions.c	-	PyExc_MemoryError	-
+Objects/exceptions.c	-	PyExc_BufferError	-
+Objects/exceptions.c	-	PyExc_Warning	-
+Objects/exceptions.c	-	PyExc_UserWarning	-
+Objects/exceptions.c	-	PyExc_DeprecationWarning	-
+Objects/exceptions.c	-	PyExc_PendingDeprecationWarning	-
+Objects/exceptions.c	-	PyExc_SyntaxWarning	-
+Objects/exceptions.c	-	PyExc_RuntimeWarning	-
+Objects/exceptions.c	-	PyExc_FutureWarning	-
+Objects/exceptions.c	-	PyExc_ImportWarning	-
+Objects/exceptions.c	-	PyExc_UnicodeWarning	-
+Objects/exceptions.c	-	PyExc_BytesWarning	-
+Objects/exceptions.c	-	PyExc_ResourceWarning	-
+
+#-----------------------
+# singletons
+# []
+
+Objects/boolobject.c	-	_Py_FalseStruct	-
+Objects/boolobject.c	-	_Py_TrueStruct	-
+Objects/dictobject.c	-	empty_keys_struct	-
+Objects/dictobject.c	-	empty_values	-
+Objects/object.c	-	_Py_NoneStruct	-
+Objects/object.c	-	_Py_NotImplementedStruct	-
+Objects/setobject.c	-	_dummy_struct	-
+Objects/setobject.c	-	_PySet_Dummy	-
+Objects/sliceobject.c	-	_Py_EllipsisObject	-
+
+#-----------------------
+# runtime initialized once - cached PyUnicode
+# []
+
+# Py_IDENTIFIER (global)  []
+Objects/classobject.c	-	PyId___name__	-
+Objects/classobject.c	-	PyId___qualname__	-
+Objects/structseq.c	-	PyId_n_sequence_fields	-
+Objects/structseq.c	-	PyId_n_fields	-
+Objects/structseq.c	-	PyId_n_unnamed_fields	-
+Objects/bytesobject.c	-	PyId___bytes__	-
+Objects/descrobject.c	-	PyId_getattr	-
+Objects/moduleobject.c	-	PyId___doc__	-
+Objects/moduleobject.c	-	PyId___name__	-
+Objects/moduleobject.c	-	PyId___spec__	-
+Objects/object.c	-	PyId_Py_Repr	-
+Objects/object.c	-	PyId___bytes__	-
+Objects/object.c	-	PyId___dir__	-
+Objects/object.c	-	PyId___isabstractmethod__	-
+Objects/fileobject.c	-	PyId_open	-
+Objects/rangeobject.c	-	PyId_iter	-
+Objects/iterobject.c	-	PyId_iter	-
+Objects/frameobject.c	-	PyId___builtins__	-
+Objects/longobject.c	-	PyId_little	-
+Objects/longobject.c	-	PyId_big	-
+Objects/typeobject.c	-	PyId___abstractmethods__	-
+Objects/typeobject.c	-	PyId___class__	-
+Objects/typeobject.c	-	PyId___class_getitem__	-
+Objects/typeobject.c	-	PyId___delitem__	-
+Objects/typeobject.c	-	PyId___dict__	-
+Objects/typeobject.c	-	PyId___doc__	-
+Objects/typeobject.c	-	PyId___getattribute__	-
+Objects/typeobject.c	-	PyId___getitem__	-
+Objects/typeobject.c	-	PyId___hash__	-
+Objects/typeobject.c	-	PyId___init_subclass__	-
+Objects/typeobject.c	-	PyId___len__	-
+Objects/typeobject.c	-	PyId___module__	-
+Objects/typeobject.c	-	PyId___name__	-
+Objects/typeobject.c	-	PyId___new__	-
+Objects/typeobject.c	-	PyId___set_name__	-
+Objects/typeobject.c	-	PyId___setitem__	-
+Objects/typeobject.c	-	PyId_builtins	-
+Objects/typeobject.c	-	PyId_mro	-
+Objects/odictobject.c	-	PyId_items	-
+
+# Py_IDENTIFIER (local)  []
+Objects/listobject.c	listiter_reduce_general	PyId_iter	-
+Objects/listobject.c	listiter_reduce_general	PyId_reversed	-
+Objects/setobject.c	setiter_reduce	PyId_iter	-
+Objects/setobject.c	set_reduce	PyId___dict__	-
+Objects/abstract.c	PyObject_LengthHint	PyId___length_hint__	-
+Objects/abstract.c	PyObject_GetItem	PyId___class_getitem__	-
+Objects/abstract.c	PyObject_Format	PyId___format__	-
+Objects/abstract.c	PyNumber_Long	PyId___trunc__	-
+Objects/abstract.c	PyMapping_Keys	PyId_keys	-
+Objects/abstract.c	PyMapping_Items	PyId_items	-
+Objects/abstract.c	PyMapping_Values	PyId_values	-
+Objects/abstract.c	abstract_get_bases	PyId___bases__	-
+Objects/abstract.c	object_isinstance	PyId___class__	-
+Objects/abstract.c	object_recursive_isinstance	PyId___instancecheck__	-
+Objects/abstract.c	object_issubclass	PyId___subclasscheck__	-
+Objects/genobject.c	PyIter_Send	PyId_send	-
+Objects/genobject.c	gen_close_iter	PyId_close	-
+Objects/genobject.c	_gen_throw	PyId_throw	-
+Objects/classobject.c	method_reduce	PyId_getattr	-
+Objects/complexobject.c	try_complex_special_method	PyId___complex__	-
+Objects/bytesobject.c	striter_reduce	PyId_iter	-
+Objects/descrobject.c	calculate_qualname	PyId___qualname__	-
+Objects/descrobject.c	mappingproxy_get	PyId_get	-
+Objects/descrobject.c	mappingproxy_keys	PyId_keys	-
+Objects/descrobject.c	mappingproxy_values	PyId_values	-
+Objects/descrobject.c	mappingproxy_items	PyId_items	-
+Objects/descrobject.c	mappingproxy_copy	PyId_copy	-
+Objects/descrobject.c	mappingproxy_reversed	PyId___reversed__	-
+Objects/descrobject.c	property_init_impl	PyId___doc__	-
+Objects/unicodeobject.c	unicodeiter_reduce	PyId_iter	-
+Objects/unionobject.c	union_repr_item	PyId___module__	-
+Objects/unionobject.c	union_repr_item	PyId___qualname__	-
+Objects/unionobject.c	union_repr_item	PyId___origin__	-
+Objects/unionobject.c	union_repr_item	PyId___args__	-
+Objects/moduleobject.c	module_init_dict	PyId___package__	-
+Objects/moduleobject.c	module_init_dict	PyId___loader__	-
+Objects/moduleobject.c	PyModule_GetFilenameObject	PyId___file__	-
+Objects/moduleobject.c	_PyModuleSpec_IsInitializing	PyId__initializing	-
+Objects/moduleobject.c	module_getattro	PyId___getattr__	-
+Objects/moduleobject.c	module_dir	PyId___dict__	-
+Objects/moduleobject.c	module_dir	PyId___dir__	-
+Objects/methodobject.c	meth_reduce	PyId_getattr	-
+Objects/methodobject.c	meth_get__qualname__	PyId___qualname__	-
+Objects/bytearrayobject.c	_common_reduce	PyId___dict__	-
+Objects/bytearrayobject.c	bytearrayiter_reduce	PyId_iter	-
+Objects/enumobject.c	reversed_new_impl	PyId___reversed__	-
+Objects/object.c	_PyObject_FunctionStr	PyId___module__	-
+Objects/object.c	_PyObject_FunctionStr	PyId___qualname__	-
+Objects/object.c	_PyObject_FunctionStr	PyId_builtins	-
+Objects/fileobject.c	PyFile_GetLine	PyId_readline	-
+Objects/fileobject.c	PyFile_WriteObject	PyId_write	-
+Objects/fileobject.c	PyObject_AsFileDescriptor	PyId_fileno	-
+Objects/weakrefobject.c	weakref_repr	PyId___name__	-
+Objects/weakrefobject.c	proxy_bytes	PyId___bytes__	-
+Objects/weakrefobject.c	proxy_reversed	PyId___reversed__	-
+Objects/genericaliasobject.c	ga_repr_item	PyId___module__	-
+Objects/genericaliasobject.c	ga_repr_item	PyId___qualname__	-
+Objects/genericaliasobject.c	ga_repr_item	PyId___origin__	-
+Objects/genericaliasobject.c	ga_repr_item	PyId___args__	-
+Objects/genericaliasobject.c	make_parameters	PyId___parameters__	-
+Objects/genericaliasobject.c	subs_tvars	PyId___parameters__	-
+Objects/exceptions.c	ImportError_getstate	PyId_name	-
+Objects/exceptions.c	ImportError_getstate	PyId_path	-
+Objects/typeobject.c	type_new	PyId___qualname__	-
+Objects/typeobject.c	type_new	PyId___slots__	-
+Objects/typeobject.c	type_new	PyId___classcell__	-
+Objects/typeobject.c	type_new	PyId___mro_entries__	-
+Objects/typeobject.c	merge_class_dict	PyId___bases__	-
+Objects/typeobject.c	import_copyreg	PyId_copyreg	-
+Objects/typeobject.c	_PyType_GetSlotNames	PyId___slotnames__	-
+Objects/typeobject.c	_PyType_GetSlotNames	PyId__slotnames	-
+Objects/typeobject.c	_PyObject_GetState	PyId___getstate__	-
+Objects/typeobject.c	_PyObject_GetNewArguments	PyId___getnewargs_ex__	-
+Objects/typeobject.c	_PyObject_GetNewArguments	PyId___getnewargs__	-
+Objects/typeobject.c	_PyObject_GetItemsIter	PyId_items	-
+Objects/typeobject.c	reduce_newobj	PyId___newobj__	-
+Objects/typeobject.c	reduce_newobj	PyId___newobj_ex__	-
+Objects/typeobject.c	object___reduce_ex___impl	PyId___reduce__	-
+Objects/typeobject.c	overrides_hash	PyId___eq__	-
+Objects/typeobject.c	slot_sq_contains	PyId___contains__	-
+Objects/typeobject.c	slot_nb_power	PyId___pow__	-
+Objects/typeobject.c	slot_nb_bool	PyId___bool__	-
+Objects/typeobject.c	slot_nb_index	PyId___index__	-
+Objects/typeobject.c	slot_nb_inplace_power	PyId___ipow__	-
+Objects/typeobject.c	slot_tp_repr	PyId___repr__	-
+Objects/typeobject.c	slot_tp_call	PyId___call__	-
+Objects/typeobject.c	slot_tp_getattr_hook	PyId___getattr__	-
+Objects/typeobject.c	slot_tp_setattro	PyId___delattr__	-
+Objects/typeobject.c	slot_tp_setattro	PyId___setattr__	-
+Objects/typeobject.c	slot_tp_iter	PyId___iter__	-
+Objects/typeobject.c	slot_tp_iternext	PyId___next__	-
+Objects/typeobject.c	slot_tp_descr_get	PyId___get__	-
+Objects/typeobject.c	slot_tp_descr_set	PyId___delete__	-
+Objects/typeobject.c	slot_tp_descr_set	PyId___set__	-
+Objects/typeobject.c	slot_tp_init	PyId___init__	-
+Objects/typeobject.c	slot_tp_finalize	PyId___del__	-
+Objects/typeobject.c	slot_am_await	PyId___await__	-
+Objects/typeobject.c	slot_am_aiter	PyId___aiter__	-
+Objects/typeobject.c	slot_am_anext	PyId___anext__	-
+Objects/odictobject.c	odict_reduce	PyId___dict__	-
+Objects/odictobject.c	odictiter_reduce	PyId_iter	-
+Objects/odictobject.c	mutablemapping_update_arg	PyId_keys	-
+Objects/dictobject.c	dict_subscript	PyId___missing__	-
+Objects/dictobject.c	dict_update_arg	PyId_keys	-
+Objects/dictobject.c	dictiter_reduce	PyId_iter	-
+Objects/dictobject.c	dictviews_sub	PyId_difference_update	-
+Objects/dictobject.c	_PyDictView_Intersect	PyId_intersection	-
+Objects/dictobject.c	dictitems_xor	PyId_items	-
+Objects/dictobject.c	dictviews_xor	PyId_symmetric_difference_update	-
+Objects/tupleobject.c	tupleiter_reduce	PyId_iter	-
+Parser/tokenizer.c	fp_setreadl	PyId_open	-
+Parser/tokenizer.c	fp_setreadl	PyId_readline	-
+
+# _Py_static_string  []
+Objects/typeobject.c	-	name_op	-
+Objects/typeobject.c	object_new	comma_id	-
+Objects/typeobject.c	slot_mp_subscript	id	-
+Objects/typeobject.c	slot_nb_add	op_id	-
+Objects/typeobject.c	slot_nb_add	rop_id	-
+Objects/typeobject.c	slot_nb_subtract	op_id	-
+Objects/typeobject.c	slot_nb_subtract	rop_id	-
+Objects/typeobject.c	slot_nb_multiply	op_id	-
+Objects/typeobject.c	slot_nb_multiply	rop_id	-
+Objects/typeobject.c	slot_nb_matrix_multiply	op_id	-
+Objects/typeobject.c	slot_nb_matrix_multiply	rop_id	-
+Objects/typeobject.c	slot_nb_remainder	op_id	-
+Objects/typeobject.c	slot_nb_remainder	rop_id	-
+Objects/typeobject.c	slot_nb_divmod	op_id	-
+Objects/typeobject.c	slot_nb_divmod	rop_id	-
+Objects/typeobject.c	slot_nb_power_binary	op_id	-
+Objects/typeobject.c	slot_nb_power_binary	rop_id	-
+Objects/typeobject.c	slot_nb_negative	id	-
+Objects/typeobject.c	slot_nb_positive	id	-
+Objects/typeobject.c	slot_nb_absolute	id	-
+Objects/typeobject.c	slot_nb_invert	id	-
+Objects/typeobject.c	slot_nb_lshift	op_id	-
+Objects/typeobject.c	slot_nb_lshift	rop_id	-
+Objects/typeobject.c	slot_nb_rshift	op_id	-
+Objects/typeobject.c	slot_nb_rshift	rop_id	-
+Objects/typeobject.c	slot_nb_and	op_id	-
+Objects/typeobject.c	slot_nb_and	rop_id	-
+Objects/typeobject.c	slot_nb_xor	op_id	-
+Objects/typeobject.c	slot_nb_xor	rop_id	-
+Objects/typeobject.c	slot_nb_or	op_id	-
+Objects/typeobject.c	slot_nb_or	rop_id	-
+Objects/typeobject.c	slot_nb_int	id	-
+Objects/typeobject.c	slot_nb_float	id	-
+Objects/typeobject.c	slot_nb_inplace_add	id	-
+Objects/typeobject.c	slot_nb_inplace_subtract	id	-
+Objects/typeobject.c	slot_nb_inplace_multiply	id	-
+Objects/typeobject.c	slot_nb_inplace_matrix_multiply	id	-
+Objects/typeobject.c	slot_nb_inplace_remainder	id	-
+Objects/typeobject.c	slot_nb_inplace_lshift	id	-
+Objects/typeobject.c	slot_nb_inplace_rshift	id	-
+Objects/typeobject.c	slot_nb_inplace_and	id	-
+Objects/typeobject.c	slot_nb_inplace_xor	id	-
+Objects/typeobject.c	slot_nb_inplace_or	id	-
+Objects/typeobject.c	slot_nb_floor_divide	op_id	-
+Objects/typeobject.c	slot_nb_floor_divide	rop_id	-
+Objects/typeobject.c	slot_nb_true_divide	op_id	-
+Objects/typeobject.c	slot_nb_true_divide	rop_id	-
+Objects/typeobject.c	slot_nb_inplace_floor_divide	id	-
+Objects/typeobject.c	slot_nb_inplace_true_divide	id	-
+Objects/typeobject.c	slot_tp_str	id	-
+Python/compile.c	compiler_set_qualname	dot	-
+Python/compile.c	compiler_set_qualname	dot_locals	-
+
+# manually cached PyUnicodeOjbect  []
+Objects/boolobject.c	-	false_str	-
+Objects/boolobject.c	-	true_str	-
+Objects/classobject.c	method_get_doc	docstr	-
+Objects/classobject.c	instancemethod_get_doc	docstr	-
+Objects/codeobject.c	PyCode_NewEmpty	emptystring	-
+Objects/exceptions.c	_check_for_legacy_statements	print_prefix	-
+Objects/exceptions.c	_check_for_legacy_statements	exec_prefix	-
+Objects/funcobject.c	PyFunction_NewWithQualName	__name__	-
+Objects/listobject.c	-	indexerr	-
+Objects/typeobject.c	object___reduce_ex___impl	objreduce	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/ast_unparse.c	-	_str_close_br	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/ast_unparse.c	-	_str_dbl_close_br	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/ast_unparse.c	-	_str_dbl_open_br	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/ast_unparse.c	-	_str_inf	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/ast_unparse.c	-	_str_open_br	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/ast_unparse.c	-	_str_replace_inf	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/compile.c	-	__annotations__	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/compile.c	-	__doc__	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/compile.c	compiler_dictcomp	name	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/compile.c	compiler_from_import	empty_string	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/compile.c	compiler_genexp	name	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/compile.c	compiler_lambda	name	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/compile.c	compiler_listcomp	name	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/compile.c	compiler_setcomp	name	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/compile.c	compiler_visit_annotations	return_str	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/import.c	PyImport_Import	builtins_str	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/import.c	PyImport_Import	import_str	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/sysmodule.c	-	whatstrings	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/sysmodule.c	sys_displayhook	newline	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/_warnings.c	is_internal_frame	bootstrap_string	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/_warnings.c	is_internal_frame	importlib_string	-
+
+#-----------------------
+# runtime initialized once - other PyObject
+# []
+
+# cache  []
+Objects/unicodeobject.c	-	interned	-
+Objects/unicodeobject.c	-	static_strings	-
+Objects/typeobject.c	-	method_cache	-
+
+# other  []
+# XXX This should have been found by the analyzer but wasn't:
+Python/context.c	-	_token_missing	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/hamt.c	-	_empty_bitmap_node	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/hamt.c	-	_empty_hamt	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/import.c	PyImport_Import	silly_list	-
+
+#-----------------------
+# runtime initialized once - non-PyObject
+# []
+
+# during init  []
+Parser/parser.c	-	Py_DebugFlag	-
+
+# other  []
+Objects/codeobject.c	PyCode_NewEmpty	nulltuple	-
+Objects/longobject.c	PyLong_FromString	log_base_BASE	-
+Objects/longobject.c	PyLong_FromString	convwidth_base	-
+Objects/longobject.c	PyLong_FromString	convmultmax_base	-
+Objects/typeobject.c	-	slotdefs	-
+Objects/typeobject.c	-	slotdefs_initialized	-
+Objects/unicodeobject.c	-	bloom_linebreak	-
+Objects/unicodeobject.c	-	ucnhash_capi	-
+Parser/pegen.c	_PyPegen_dummy_name	cache	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/import.c	-	import_lock	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/import.c	import_find_and_load	header	-
+
+#-----------------------
+# runtime state
+
+# (look at the bottom of the file)
+
+#-----------------------
+# modules
+# [119]
+
+Modules/pwdmodule.c	-	pwdmodule	-
+Modules/grpmodule.c	-	grpmodule	-
+Modules/_ssl.c	-	PySocketModule	-
+Modules/_ssl.c	-	_sslmodule	-
+Modules/_struct.c	-	_structmodule	-
+Modules/_sre.c	-	sremodule	-
+Modules/timemodule.c	-	timemodule	-
+Modules/xxmodule.c	-	xxmodule	-
+Modules/itertoolsmodule.c	-	itertoolsmodule	-
+Modules/_tkinter.c	-	_tkintermodule	-
+Modules/gcmodule.c	-	gcmodule	-
+Modules/mmapmodule.c	-	mmapmodule	-
+Modules/errnomodule.c	-	errnomodule	-
+Modules/_gdbmmodule.c	-	_gdbmmodule	-
+Modules/xxlimited.c	-	xxmodule	-
+Modules/arraymodule.c	-	arraymodule	-
+Modules/_uuidmodule.c	-	uuidmodule	-
+Modules/_collectionsmodule.c	-	_collectionsmodule	-
+Modules/_csv.c	-	_csvmodule	-
+Modules/_json.c	-	jsonmodule	-
+Modules/zlibmodule.c	-	zlibmodule	-
+Modules/readline.c	-	readlinemodule	-
+Modules/faulthandler.c	-	module_def	-
+Modules/_codecsmodule.c	-	codecsmodule	-
+Modules/_asynciomodule.c	-	_asynciomodule	-
+Modules/signalmodule.c	-	signalmodule	-
+Modules/binascii.c	-	binasciimodule	-
+Modules/mathmodule.c	-	mathmodule	-
+Modules/_stat.c	-	statmodule	-
+Modules/_opcode.c	-	opcodemodule	-
+Modules/_operator.c	-	operatormodule	-
+Modules/_cryptmodule.c	-	cryptmodule	-
+Modules/cmathmodule.c	-	cmathmodule	-
+Modules/_lzmamodule.c	-	_lzmamodule	-
+Modules/_zoneinfo.c	-	zoneinfomodule	-
+Modules/posixmodule.c	-	posixmodule	-
+Modules/_bz2module.c	-	_bz2module	-
+Modules/_functoolsmodule.c	-	_functools_module	-
+Modules/_abc.c	-	_abcmodule	-
+Modules/_heapqmodule.c	-	_heapqmodule	-
+Modules/_bisectmodule.c	-	_bisectmodule	-
+Modules/_tracemalloc.c	-	module_def	-
+Modules/pyexpat.c	-	pyexpatmodule	-
+Modules/_randommodule.c	-	_randommodule	-
+Modules/atexitmodule.c	-	atexitmodule	-
+Modules/syslogmodule.c	-	syslogmodule	-
+Modules/_queuemodule.c	-	queuemodule	-
+Modules/_threadmodule.c	-	threadmodule	-
+Modules/_weakref.c	-	weakrefmodule	-
+Modules/spwdmodule.c	-	spwdmodule	-
+Modules/_contextvarsmodule.c	-	_contextvarsmodule	-
+Modules/_posixsubprocess.c	-	_posixsubprocessmodule	-
+Modules/_xxsubinterpretersmodule.c	-	interpretersmodule	-
+Modules/_curses_panel.c	-	_curses_panelmodule	-
+Modules/audioop.c	-	audioopmodule	-
+Modules/nismodule.c	-	nismodule	-
+Modules/_elementtree.c	-	elementtreemodule	-
+Modules/sha256module.c	-	_sha256module	-
+Modules/resource.c	-	resourcemodule	-
+Modules/symtablemodule.c	-	symtablemodule	-
+Modules/sha1module.c	-	_sha1module	-
+Modules/selectmodule.c	-	selectmodule	-
+Modules/_pickle.c	-	_picklemodule	-
+Modules/_localemodule.c	-	_localemodule	-
+Modules/unicodedata.c	-	unicodedata_module	-
+Modules/_statisticsmodule.c	-	statisticsmodule	-
+Modules/termios.c	-	termiosmodule	-
+Modules/xxsubtype.c	-	xxsubtypemodule	-
+Modules/sha512module.c	-	_sha512module	-
+Modules/_cursesmodule.c	-	_cursesmodule	-
+Modules/md5module.c	-	_md5module	-
+Modules/socketmodule.c	-	socketmodule	-
+Modules/_datetimemodule.c	-	datetimemodule	-
+Modules/_hashopenssl.c	-	_hashlibmodule	-
+Modules/fcntlmodule.c	-	fcntlmodule	-
+Modules/ossaudiodev.c	-	ossaudiodevmodule	-
+Modules/_lsprof.c	-	_lsprofmodule	-
+Modules/_blake2/blake2module.c	-	blake2_module	-
+Modules/_multiprocessing/multiprocessing.c	-	multiprocessing_module	-
+Modules/_multiprocessing/posixshmem.c	-	this_module	-
+Modules/_sqlite/module.c	-	_sqlite3module	-
+Modules/_sha3/sha3module.c	-	_sha3module	-
+Modules/cjkcodecs/multibytecodec.c	-	_multibytecodecmodule	-
+Modules/_decimal/_decimal.c	-	_decimal_module	-
+Modules/_ctypes/_ctypes.c	-	_ctypesmodule	-
+Objects/unicodeobject.c	-	_string_module	-
+Modules/_io/_iomodule.h	-	_PyIO_Module	-
+Modules/_io/_iomodule.c	-	_PyIO_Module	-
+
+#-----------------------
+# module static types
+# []
+
+Modules/arraymodule.c	-	Arraytype	-
+Modules/arraymodule.c	-	PyArrayIter_Type	-
+Modules/_asynciomodule.c	-	FutureType	-
+Modules/_asynciomodule.c	-	FutureIterType	-
+Modules/_asynciomodule.c	-	TaskStepMethWrapper_Type	-
+Modules/_asynciomodule.c	-	TaskType	-
+Modules/_asynciomodule.c	-	PyRunningLoopHolder_Type	-
+Modules/cjkcodecs/multibytecodec.c	-	MultibyteCodec_Type	-
+Modules/cjkcodecs/multibytecodec.c	-	MultibyteIncrementalEncoder_Type	-
+Modules/cjkcodecs/multibytecodec.c	-	MultibyteIncrementalDecoder_Type	-
+Modules/cjkcodecs/multibytecodec.c	-	MultibyteStreamReader_Type	-
+Modules/cjkcodecs/multibytecodec.c	-	MultibyteStreamWriter_Type	-
+Modules/_collectionsmodule.c	-	deque_type	-
+Modules/_collectionsmodule.c	-	dequeiter_type	-
+Modules/_collectionsmodule.c	-	dequereviter_type	-
+Modules/_collectionsmodule.c	-	defdict_type	-
+Modules/_collectionsmodule.c	-	tuplegetter_type	-
+Modules/_csv.c	-	Dialect_Type	-
+Modules/_csv.c	-	Reader_Type	-
+Modules/_csv.c	-	Writer_Type	-
+Modules/_ctypes/callbacks.c	-	PyCThunk_Type	-
+Modules/_ctypes/callproc.c	-	PyCArg_Type	-
+Modules/_ctypes/cfield.c	-	PyCField_Type	-
+Modules/_ctypes/_ctypes.c	-	DictRemover_Type	-
+Modules/_ctypes/_ctypes.c	-	StructParam_Type	-
+Modules/_ctypes/_ctypes.c	-	PyCStructType_Type	-
+Modules/_ctypes/_ctypes.c	-	UnionType_Type	-
+Modules/_ctypes/_ctypes.c	-	PyCPointerType_Type	-
+Modules/_ctypes/_ctypes.c	-	PyCArrayType_Type	-
+Modules/_ctypes/_ctypes.c	-	PyCSimpleType_Type	-
+Modules/_ctypes/_ctypes.c	-	PyCFuncPtrType_Type	-
+Modules/_ctypes/_ctypes.c	-	PyCData_Type	-
+Modules/_ctypes/_ctypes.c	-	PyCFuncPtr_Type	-
+Modules/_ctypes/_ctypes.c	-	Struct_Type	-
+Modules/_ctypes/_ctypes.c	-	Union_Type	-
+Modules/_ctypes/_ctypes.c	-	PyCArray_Type	-
+Modules/_ctypes/_ctypes.c	-	Simple_Type	-
+Modules/_ctypes/_ctypes.c	-	PyCPointer_Type	-
+Modules/_ctypes/_ctypes.c	-	PyComError_Type	-
+Modules/_ctypes/stgdict.c	-	PyCStgDict_Type	-
+Modules/_cursesmodule.c	-	PyCursesWindow_Type	-
+Modules/_datetimemodule.c	-	PyDateTime_DeltaType	-
+Modules/_datetimemodule.c	-	PyDateTime_IsoCalendarDateType	-
+Modules/_datetimemodule.c	-	PyDateTime_DateType	-
+Modules/_datetimemodule.c	-	PyDateTime_TZInfoType	-
+Modules/_datetimemodule.c	-	PyDateTime_TimeZoneType	-
+Modules/_datetimemodule.c	-	PyDateTime_TimeType	-
+Modules/_datetimemodule.c	-	PyDateTime_DateTimeType	-
+Modules/_decimal/_decimal.c	-	PyDecSignalDictMixin_Type	-
+Modules/_decimal/_decimal.c	-	PyDecContextManager_Type	-
+Modules/_decimal/_decimal.c	-	PyDec_Type	-
+Modules/_decimal/_decimal.c	-	PyDecContext_Type	-
+Modules/_elementtree.c	-	ElementIter_Type	-
+Modules/_elementtree.c	-	Element_Type	-
+Modules/_elementtree.c	-	TreeBuilder_Type	-
+Modules/_elementtree.c	-	XMLParser_Type	-
+Modules/_functoolsmodule.c	-	partial_type	-
+Modules/_functoolsmodule.c	-	keyobject_type	-
+Modules/_functoolsmodule.c	-	lru_list_elem_type	-
+Modules/_functoolsmodule.c	-	lru_cache_type	-
+Modules/_io/bufferedio.c	-	PyBufferedIOBase_Type	-
+Modules/_io/bufferedio.c	-	PyBufferedReader_Type	-
+Modules/_io/bufferedio.c	-	PyBufferedWriter_Type	-
+Modules/_io/bufferedio.c	-	PyBufferedRWPair_Type	-
+Modules/_io/bufferedio.c	-	PyBufferedRandom_Type	-
+Modules/_io/bytesio.c	-	PyBytesIO_Type	-
+Modules/_io/bytesio.c	-	_PyBytesIOBuffer_Type	-
+Modules/_io/fileio.c	-	PyFileIO_Type	-
+Modules/_io/iobase.c	-	PyIOBase_Type	-
+Modules/_io/iobase.c	-	PyRawIOBase_Type	-
+Modules/_io/stringio.c	-	PyStringIO_Type	-
+Modules/_io/textio.c	-	PyTextIOBase_Type	-
+Modules/_io/textio.c	-	PyIncrementalNewlineDecoder_Type	-
+Modules/_io/textio.c	-	PyTextIOWrapper_Type	-
+Modules/_io/winconsoleio.c	-	PyWindowsConsoleIO_Type	-
+Modules/itertoolsmodule.c	-	groupby_type	-
+Modules/itertoolsmodule.c	-	_grouper_type	-
+Modules/itertoolsmodule.c	-	teedataobject_type	-
+Modules/itertoolsmodule.c	-	tee_type	-
+Modules/itertoolsmodule.c	-	cycle_type	-
+Modules/itertoolsmodule.c	-	dropwhile_type	-
+Modules/itertoolsmodule.c	-	takewhile_type	-
+Modules/itertoolsmodule.c	-	islice_type	-
+Modules/itertoolsmodule.c	-	starmap_type	-
+Modules/itertoolsmodule.c	-	chain_type	-
+Modules/itertoolsmodule.c	-	product_type	-
+Modules/itertoolsmodule.c	-	combinations_type	-
+Modules/itertoolsmodule.c	-	cwr_type	-
+Modules/itertoolsmodule.c	-	permutations_type	-
+Modules/itertoolsmodule.c	-	accumulate_type	-
+Modules/itertoolsmodule.c	-	compress_type	-
+Modules/itertoolsmodule.c	-	filterfalse_type	-
+Modules/itertoolsmodule.c	-	count_type	-
+Modules/itertoolsmodule.c	-	repeat_type	-
+Modules/itertoolsmodule.c	-	ziplongest_type	-
+Modules/mmapmodule.c	-	mmap_object_type	-
+Modules/_multiprocessing/semaphore.c	-	_PyMp_SemLockType	-
+Modules/ossaudiodev.c	-	OSSAudioType	-
+Modules/ossaudiodev.c	-	OSSMixerType	-
+Modules/_pickle.c	-	Pdata_Type	-
+Modules/_pickle.c	-	PicklerMemoProxyType	-
+Modules/_pickle.c	-	Pickler_Type	-
+Modules/_pickle.c	-	UnpicklerMemoProxyType	-
+Modules/_pickle.c	-	Unpickler_Type	-
+Modules/pyexpat.c	-	Xmlparsetype	-
+Modules/_queuemodule.c	-	PySimpleQueueType	-
+Modules/socketmodule.c	-	sock_type	-
+Modules/_sre.c	-	Pattern_Type	-
+Modules/_sre.c	-	Match_Type	-
+Modules/_sre.c	-	Scanner_Type	-
+Modules/_ssl.c	-	PySSLSocket_Type	-
+Modules/_ssl.c	-	PySSLContext_Type	-
+Modules/_ssl.c	-	PySSLMemoryBIO_Type	-
+Modules/_ssl.c	-	PySSLSession_Type	-
+Modules/_threadmodule.c	-	Locktype	-
+Modules/_threadmodule.c	-	RLocktype	-
+Modules/_threadmodule.c	-	localdummytype	-
+Modules/_threadmodule.c	-	localtype	-
+Modules/xxmodule.c	-	Xxo_Type	-
+Modules/xxmodule.c	-	Str_Type	-
+Modules/xxmodule.c	-	Null_Type	-
+Modules/_xxsubinterpretersmodule.c	-	ChannelIDtype	-
+Modules/xxsubtype.c	-	spamlist_type	-
+Modules/xxsubtype.c	-	spamdict_type	-
+Modules/_zoneinfo.c	-	PyZoneInfo_ZoneInfoType	-
+
+#-----------------------
+# module initialized once - non-static types
+# []
+
+# structseq types  [6]
+Modules/timemodule.c	-	StructTimeType	-
+Modules/signalmodule.c	-	SiginfoType	-
+Modules/_threadmodule.c	-	ExceptHookArgsType	-
+Modules/spwdmodule.c	-	StructSpwdType	-
+Modules/resource.c	-	StructRUsageType	-
+Modules/_cursesmodule.c	-	NcursesVersionType	-
+
+# heap types  [12]
+Modules/_tkinter.c	-	Tkapp_Type	-
+Modules/_tkinter.c	-	PyTclObject_Type	-
+Modules/_tkinter.c	-	Tktt_Type	-
+Modules/xxlimited.c	-	Xxo_Type	-
+Modules/_decimal/_decimal.c	-	DecimalTuple	-
+Modules/_decimal/_decimal.c	-	PyDecSignalDict_Type	-
+Modules/_sqlite/connection.c	-	pysqlite_ConnectionType	-
+Modules/_sqlite/statement.c	-	pysqlite_StatementType	-
+Modules/_sqlite/cache.c	-	pysqlite_NodeType	-
+Modules/_sqlite/cache.c	-	pysqlite_CacheType	-
+Modules/_sqlite/row.c	-	pysqlite_RowType	-
+Modules/_sqlite/prepare_protocol.c	-	pysqlite_PrepareProtocolType	-
+Modules/_sqlite/cursor.c	-	pysqlite_CursorType	-
+
+# exception types  []
+Modules/_ctypes/_ctypes.c	-	PyExc_ArgError	-
+Modules/_cursesmodule.c	-	PyCursesError	-
+Modules/_decimal/_decimal.c	-	DecimalException	-
+Modules/_queuemodule.c	-	EmptyError	-
+Modules/_sqlite/module.h	-	pysqlite_Error	-
+Modules/_sqlite/module.h	-	pysqlite_Warning	-
+Modules/_sqlite/module.h	-	pysqlite_InterfaceError	-
+Modules/_sqlite/module.h	-	pysqlite_DatabaseError	-
+Modules/_sqlite/module.h	-	pysqlite_InternalError	-
+Modules/_sqlite/module.h	-	pysqlite_OperationalError	-
+Modules/_sqlite/module.h	-	pysqlite_ProgrammingError	-
+Modules/_sqlite/module.h	-	pysqlite_IntegrityError	-
+Modules/_sqlite/module.h	-	pysqlite_DataError	-
+Modules/_sqlite/module.h	-	pysqlite_NotSupportedError	-
+Modules/_ssl.c	-	PySSLErrorObject	-
+Modules/_ssl.c	-	PySSLCertVerificationErrorObject	-
+Modules/_ssl.c	-	PySSLZeroReturnErrorObject	-
+Modules/_ssl.c	-	PySSLWantReadErrorObject	-
+Modules/_ssl.c	-	PySSLWantWriteErrorObject	-
+Modules/_ssl.c	-	PySSLSyscallErrorObject	-
+Modules/_ssl.c	-	PySSLEOFErrorObject	-
+Modules/_threadmodule.c	-	ThreadError	-
+Modules/_tkinter.c	-	Tkinter_TclError	-
+Modules/_xxsubinterpretersmodule.c	-	ChannelError	-
+Modules/_xxsubinterpretersmodule.c	-	ChannelNotFoundError	-
+Modules/_xxsubinterpretersmodule.c	-	ChannelClosedError	-
+Modules/_xxsubinterpretersmodule.c	-	ChannelEmptyError	-
+Modules/_xxsubinterpretersmodule.c	-	ChannelNotEmptyError	-
+Modules/_xxsubinterpretersmodule.c	-	RunFailedError	-
+Modules/ossaudiodev.c	-	OSSAudioError	-
+Modules/pyexpat.c	-	ErrorObject	-
+Modules/signalmodule.c	-	ItimerError	-
+Modules/socketmodule.c	-	socket_herror	-
+Modules/socketmodule.c	-	socket_gaierror	-
+Modules/socketmodule.c	-	socket_timeout	-
+Modules/xxlimited.c	-	ErrorObject	-
+Modules/xxmodule.c	-	ErrorObject	-
+
+#-----------------------
+# module initialized once - cached PyUnicode
+# []
+
+# Py_IDENTIFIER (global)  []
+Modules/faulthandler.c	-	PyId_enable	-
+Modules/faulthandler.c	-	PyId_fileno	-
+Modules/faulthandler.c	-	PyId_flush	-
+Modules/faulthandler.c	-	PyId_stderr	-
+Modules/_asynciomodule.c	-	PyId___asyncio_running_event_loop__	-
+Modules/_asynciomodule.c	-	PyId__asyncio_future_blocking	-
+Modules/_asynciomodule.c	-	PyId_add_done_callback	-
+Modules/_asynciomodule.c	-	PyId_call_soon	-
+Modules/_asynciomodule.c	-	PyId_cancel	-
+Modules/_asynciomodule.c	-	PyId_get_event_loop	-
+Modules/_asynciomodule.c	-	PyId_throw	-
+Modules/posixmodule.c	-	PyId___fspath__	-
+Modules/_abc.c	-	PyId___abstractmethods__	-
+Modules/_abc.c	-	PyId___class__	-
+Modules/_abc.c	-	PyId___dict__	-
+Modules/_abc.c	-	PyId___bases__	-
+Modules/_abc.c	-	PyId__abc_impl	-
+Modules/_abc.c	-	PyId___subclasscheck__	-
+Modules/_abc.c	-	PyId___subclasshook__	-
+Modules/_bisectmodule.c	-	PyId_insert	-
+Modules/_threadmodule.c	-	PyId_stderr	-
+Modules/_threadmodule.c	-	PyId_flush	-
+Modules/unicodedata.c	-	PyId_NFC	-
+Modules/unicodedata.c	-	PyId_NFD	-
+Modules/unicodedata.c	-	PyId_NFKC	-
+Modules/unicodedata.c	-	PyId_NFKD	-
+Modules/_datetimemodule.c	-	PyId_as_integer_ratio	-
+Modules/_datetimemodule.c	-	PyId_fromutc	-
+Modules/_datetimemodule.c	-	PyId_isoformat	-
+Modules/_datetimemodule.c	-	PyId_strftime	-
+Modules/_sqlite/connection.c	-	PyId_cursor	-
+Modules/cjkcodecs/multibytecodec.c	-	PyId_write	-
+Modules/_io/textio.c	-	PyId_close	-
+Modules/_io/textio.c	-	PyId__dealloc_warn	-
+Modules/_io/textio.c	-	PyId_decode	-
+Modules/_io/textio.c	-	PyId_fileno	-
+Modules/_io/textio.c	-	PyId_flush	-
+Modules/_io/textio.c	-	PyId_getpreferredencoding	-
+Modules/_io/textio.c	-	PyId_isatty	-
+Modules/_io/textio.c	-	PyId_mode	-
+Modules/_io/textio.c	-	PyId_name	-
+Modules/_io/textio.c	-	PyId_raw	-
+Modules/_io/textio.c	-	PyId_read	-
+Modules/_io/textio.c	-	PyId_readable	-
+Modules/_io/textio.c	-	PyId_replace	-
+Modules/_io/textio.c	-	PyId_reset	-
+Modules/_io/textio.c	-	PyId_seek	-
+Modules/_io/textio.c	-	PyId_seekable	-
+Modules/_io/textio.c	-	PyId_setstate	-
+Modules/_io/textio.c	-	PyId_strict	-
+Modules/_io/textio.c	-	PyId_tell	-
+Modules/_io/textio.c	-	PyId_writable	-
+Modules/_io/fileio.c	-	PyId_name	-
+Modules/_io/bufferedio.c	-	PyId_close	-
+Modules/_io/bufferedio.c	-	PyId__dealloc_warn	-
+Modules/_io/bufferedio.c	-	PyId_flush	-
+Modules/_io/bufferedio.c	-	PyId_isatty	-
+Modules/_io/bufferedio.c	-	PyId_mode	-
+Modules/_io/bufferedio.c	-	PyId_name	-
+Modules/_io/bufferedio.c	-	PyId_peek	-
+Modules/_io/bufferedio.c	-	PyId_read	-
+Modules/_io/bufferedio.c	-	PyId_read1	-
+Modules/_io/bufferedio.c	-	PyId_readable	-
+Modules/_io/bufferedio.c	-	PyId_readinto	-
+Modules/_io/bufferedio.c	-	PyId_readinto1	-
+Modules/_io/bufferedio.c	-	PyId_writable	-
+Modules/_io/bufferedio.c	-	PyId_write	-
+Modules/_io/iobase.c	-	PyId___IOBase_closed	-
+Modules/_io/iobase.c	-	PyId_read	-
+
+# Py_IDENTIFIER (local)  []
+Modules/_ssl.c	fill_and_set_sslerror	PyId_reason	-
+Modules/_ssl.c	fill_and_set_sslerror	PyId_library	-
+Modules/_ssl.c	fill_and_set_sslerror	PyId_verify_message	-
+Modules/_ssl.c	fill_and_set_sslerror	PyId_verify_code	-
+Modules/timemodule.c	time_strptime	PyId__strptime_time	-
+Modules/itertoolsmodule.c	_grouper_reduce	PyId_iter	-
+Modules/itertoolsmodule.c	itertools_tee_impl	PyId___copy__	-
+Modules/itertoolsmodule.c	cycle_reduce	PyId___setstate__	-
+Modules/itertoolsmodule.c	zip_longest_new	PyId_fillvalue	-
+Modules/mmapmodule.c	mmap__exit__method	PyId_close	-
+Modules/_gdbmmodule.c	gdbm__exit__	PyId_close	-
+Modules/arraymodule.c	array_array_fromfile_impl	PyId_read	-
+Modules/arraymodule.c	array_array_tofile	PyId_write	-
+Modules/arraymodule.c	array_array___reduce_ex__	PyId__array_reconstructor	-
+Modules/arraymodule.c	array_array___reduce_ex__	PyId___dict__	-
+Modules/arraymodule.c	array_arrayiterator___reduce___impl	PyId_iter	-
+Modules/_collectionsmodule.c	deque_reduce	PyId___dict__	-
+Modules/_collectionsmodule.c	defdict_reduce	PyId_items	-
+Modules/_collectionsmodule.c	_collections__count_elements_impl	PyId_get	-
+Modules/_collectionsmodule.c	_collections__count_elements_impl	PyId___setitem__	-
+Modules/_csv.c	csv_writer	PyId_write	-
+Modules/_asynciomodule.c	get_future_loop	PyId_get_loop	-
+Modules/_asynciomodule.c	get_future_loop	PyId__loop	-
+Modules/_asynciomodule.c	future_init	PyId_get_debug	-
+Modules/_asynciomodule.c	FutureObj_get_state	PyId_PENDING	-
+Modules/_asynciomodule.c	FutureObj_get_state	PyId_CANCELLED	-
+Modules/_asynciomodule.c	FutureObj_get_state	PyId_FINISHED	-
+Modules/_asynciomodule.c	FutureObj_repr	PyId__repr_info	-
+Modules/_asynciomodule.c	FutureObj_finalize	PyId_call_exception_handler	-
+Modules/_asynciomodule.c	FutureObj_finalize	PyId_message	-
+Modules/_asynciomodule.c	FutureObj_finalize	PyId_exception	-
+Modules/_asynciomodule.c	FutureObj_finalize	PyId_future	-
+Modules/_asynciomodule.c	FutureObj_finalize	PyId_source_traceback	-
+Modules/_asynciomodule.c	register_task	PyId_add	-
+Modules/_asynciomodule.c	unregister_task	PyId_discard	-
+Modules/_asynciomodule.c	TaskObj_finalize	PyId_call_exception_handler	-
+Modules/_asynciomodule.c	TaskObj_finalize	PyId_task	-
+Modules/_asynciomodule.c	TaskObj_finalize	PyId_message	-
+Modules/_asynciomodule.c	TaskObj_finalize	PyId_source_traceback	-
+Modules/mathmodule.c	math_ceil	PyId___ceil__	-
+Modules/mathmodule.c	math_floor	PyId___floor__	-
+Modules/mathmodule.c	math_trunc	PyId___trunc__	-
+Modules/_operator.c	methodcaller_reduce	PyId_partial	-
+Modules/_lzmamodule.c	build_filter_spec	PyId_id	-
+Modules/_lzmamodule.c	build_filter_spec	PyId_lc	-
+Modules/_lzmamodule.c	build_filter_spec	PyId_lp	-
+Modules/_lzmamodule.c	build_filter_spec	PyId_pb	-
+Modules/_lzmamodule.c	build_filter_spec	PyId_dict_size	-
+Modules/_lzmamodule.c	build_filter_spec	PyId_dist	-
+Modules/_lzmamodule.c	build_filter_spec	PyId_start_offset	-
+Modules/pyexpat.c	pyexpat_xmlparser_ParseFile	PyId_read	-
+Modules/_threadmodule.c	thread_excepthook_file	PyId_name	-
+Modules/_elementtree.c	_elementtree_Element_find_impl	PyId_find	-
+Modules/_elementtree.c	_elementtree_Element_findtext_impl	PyId_findtext	-
+Modules/_elementtree.c	_elementtree_Element_findall_impl	PyId_findall	-
+Modules/_elementtree.c	_elementtree_Element_iterfind_impl	PyId_iterfind	-
+Modules/_elementtree.c	treebuilder_flush_data	PyId_text	-
+Modules/_elementtree.c	treebuilder_flush_data	PyId_tail	-
+Modules/_elementtree.c	treebuilder_add_subelement	PyId_append	-
+Modules/_elementtree.c	expat_start_doctype_handler	PyId_doctype	-
+Modules/_pickle.c	_Pickle_InitState	PyId_getattr	-
+Modules/_pickle.c	_Pickler_SetOutputStream	PyId_write	-
+Modules/_pickle.c	_Unpickler_SetInputStream	PyId_peek	-
+Modules/_pickle.c	_Unpickler_SetInputStream	PyId_read	-
+Modules/_pickle.c	_Unpickler_SetInputStream	PyId_readinto	-
+Modules/_pickle.c	_Unpickler_SetInputStream	PyId_readline	-
+Modules/_pickle.c	whichmodule	PyId___module__	-
+Modules/_pickle.c	whichmodule	PyId_modules	-
+Modules/_pickle.c	whichmodule	PyId___main__	-
+Modules/_pickle.c	save_bytes	PyId_latin1	-
+Modules/_pickle.c	save_dict	PyId_items	-
+Modules/_pickle.c	save_global	PyId___name__	-
+Modules/_pickle.c	save_global	PyId___qualname__	-
+Modules/_pickle.c	get_class	PyId___class__	-
+Modules/_pickle.c	save_reduce	PyId___name__	-
+Modules/_pickle.c	save_reduce	PyId___newobj_ex__	-
+Modules/_pickle.c	save_reduce	PyId___newobj__	-
+Modules/_pickle.c	save_reduce	PyId___new__	-
+Modules/_pickle.c	save	PyId___reduce__	-
+Modules/_pickle.c	save	PyId___reduce_ex__	-
+Modules/_pickle.c	dump	PyId_reducer_override	-
+Modules/_pickle.c	_pickle_Pickler___init___impl	PyId_persistent_id	-
+Modules/_pickle.c	_pickle_Pickler___init___impl	PyId_dispatch_table	-
+Modules/_pickle.c	find_class	PyId_find_class	-
+Modules/_pickle.c	instantiate	PyId___getinitargs__	-
+Modules/_pickle.c	instantiate	PyId___new__	-
+Modules/_pickle.c	do_append	PyId_extend	-
+Modules/_pickle.c	do_append	PyId_append	-
+Modules/_pickle.c	load_additems	PyId_add	-
+Modules/_pickle.c	load_build	PyId___setstate__	-
+Modules/_pickle.c	load_build	PyId___dict__	-
+Modules/_pickle.c	_pickle_Unpickler___init___impl	PyId_persistent_load	-
+Modules/_cursesmodule.c	_curses_window_putwin	PyId_write	-
+Modules/_cursesmodule.c	_curses_getwin	PyId_read	-
+Modules/_cursesmodule.c	update_lines_cols	PyId_LINES	-
+Modules/_cursesmodule.c	update_lines_cols	PyId_COLS	-
+Modules/_datetimemodule.c	call_tzname	PyId_tzname	-
+Modules/_datetimemodule.c	make_Zreplacement	PyId_replace	-
+Modules/_datetimemodule.c	time_time	PyId_time	-
+Modules/_datetimemodule.c	build_struct_time	PyId_struct_time	-
+Modules/_datetimemodule.c	date_today	PyId_fromtimestamp	-
+Modules/_datetimemodule.c	date_strftime	PyId_timetuple	-
+Modules/_datetimemodule.c	tzinfo_reduce	PyId___getinitargs__	-
+Modules/_datetimemodule.c	tzinfo_reduce	PyId___getstate__	-
+Modules/_datetimemodule.c	datetime_strptime	PyId__strptime_datetime	-
+Modules/ossaudiodev.c	oss_exit	PyId_close	-
+Modules/main.c	pymain_sys_path_add_path0	PyId_path	-
+Modules/_sqlite/microprotocols.c	pysqlite_microprotocols_adapt	PyId___adapt__	-
+Modules/_sqlite/microprotocols.c	pysqlite_microprotocols_adapt	PyId___conform__	-
+Modules/_sqlite/connection.c	_pysqlite_final_callback	PyId_finalize	-
+Modules/_sqlite/connection.c	pysqlite_connection_set_isolation_level	PyId_upper	-
+Modules/_sqlite/connection.c	pysqlite_connection_iterdump	PyId__iterdump	-
+Modules/_sqlite/connection.c	pysqlite_connection_create_collation	PyId_upper	-
+Modules/_sqlite/module.c	module_register_converter	PyId_upper	-
+Modules/_sqlite/cursor.c	_pysqlite_get_converter	PyId_upper	-
+Modules/_io/_iomodule.c	_io_open_impl	PyId__blksize	-
+Modules/_io/_iomodule.c	_io_open_impl	PyId_isatty	-
+Modules/_io/_iomodule.c	_io_open_impl	PyId_mode	-
+Modules/_io/_iomodule.c	_io_open_impl	PyId_close	-
+Modules/_io/fileio.c	_io_FileIO_close_impl	PyId_close	-
+Modules/_io/iobase.c	_io__IOBase_tell_impl	PyId_seek	-
+Modules/_io/iobase.c	iobase_finalize	PyId__finalizing	-
+Modules/_io/iobase.c	_io__IOBase_readlines_impl	PyId_extend	-
+Modules/_io/iobase.c	_io__RawIOBase_read_impl	PyId_readall	-
+Modules/_ctypes/stgdict.c	MakeAnonFields	PyId__anonymous_	-
+Modules/_ctypes/stgdict.c	PyCStructUnionType_update_stgdict	PyId__swappedbytes_	-
+Modules/_ctypes/stgdict.c	PyCStructUnionType_update_stgdict	PyId__use_broken_old_ctypes_structure_semantics_	-
+Modules/_ctypes/stgdict.c	PyCStructUnionType_update_stgdict	PyId__pack_	-
+Modules/_ctypes/callproc.c	ConvParam	PyId__as_parameter_	-
+Modules/_ctypes/callproc.c	unpickle	PyId___new__	-
+Modules/_ctypes/callproc.c	unpickle	PyId___setstate__	-
+Modules/_ctypes/_ctypes.c	StructUnionType_new	PyId__abstract_	-
+Modules/_ctypes/_ctypes.c	StructUnionType_new	PyId__fields_	-
+Modules/_ctypes/_ctypes.c	CDataType_from_param	PyId__as_parameter_	-
+Modules/_ctypes/_ctypes.c	PyCPointerType_new	PyId__type_	-
+Modules/_ctypes/_ctypes.c	PyCPointerType_set_type	PyId__type_	-
+Modules/_ctypes/_ctypes.c	PyCArrayType_new	PyId__length_	-
+Modules/_ctypes/_ctypes.c	PyCArrayType_new	PyId__type_	-
+Modules/_ctypes/_ctypes.c	c_wchar_p_from_param	PyId__as_parameter_	-
+Modules/_ctypes/_ctypes.c	c_char_p_from_param	PyId__as_parameter_	-
+Modules/_ctypes/_ctypes.c	c_void_p_from_param	PyId__as_parameter_	-
+Modules/_ctypes/_ctypes.c	PyCSimpleType_new	PyId__type_	-
+Modules/_ctypes/_ctypes.c	PyCSimpleType_from_param	PyId__as_parameter_	-
+Modules/_ctypes/_ctypes.c	converters_from_argtypes	PyId_from_param	-
+Modules/_ctypes/_ctypes.c	make_funcptrtype_dict	PyId__flags_	-
+Modules/_ctypes/_ctypes.c	make_funcptrtype_dict	PyId__argtypes_	-
+Modules/_ctypes/_ctypes.c	make_funcptrtype_dict	PyId__restype_	-
+Modules/_ctypes/_ctypes.c	make_funcptrtype_dict	PyId__check_retval_	-
+Modules/_ctypes/_ctypes.c	PyCFuncPtr_set_restype	PyId__check_retval_	-
+Modules/_ctypes/_ctypes.c	_build_result	PyId___ctypes_from_outparam__	-
+Modules/_ctypes/_ctypes.c	_init_pos_args	PyId__fields_	-
+
+# _Py_static_string  []
+Modules/_pickle.c	get_dotted_path	PyId_dot	-
+
+# manually cached PyUnicodeOjbect  []
+Modules/_asynciomodule.c	-	context_kwname	-
+Modules/_ctypes/callproc.c	_ctypes_get_errobj	error_object_name	-
+Modules/_ctypes/_ctypes.c	CreateSwappedType	suffix	-
+Modules/_io/_iomodule.c	-	_PyIO_str_close	-
+Modules/_io/_iomodule.c	-	_PyIO_str_closed	-
+Modules/_io/_iomodule.c	-	_PyIO_str_decode	-
+Modules/_io/_iomodule.c	-	_PyIO_str_encode	-
+Modules/_io/_iomodule.c	-	_PyIO_str_fileno	-
+Modules/_io/_iomodule.c	-	_PyIO_str_flush	-
+Modules/_io/_iomodule.c	-	_PyIO_str_getstate	-
+Modules/_io/_iomodule.c	-	_PyIO_str_isatty	-
+Modules/_io/_iomodule.c	-	_PyIO_str_newlines	-
+Modules/_io/_iomodule.c	-	_PyIO_str_nl	-
+Modules/_io/_iomodule.c	-	_PyIO_str_peek	-
+Modules/_io/_iomodule.c	-	_PyIO_str_read	-
+Modules/_io/_iomodule.c	-	_PyIO_str_read1	-
+Modules/_io/_iomodule.c	-	_PyIO_str_readable	-
+Modules/_io/_iomodule.c	-	_PyIO_str_readall	-
+Modules/_io/_iomodule.c	-	_PyIO_str_readinto	-
+Modules/_io/_iomodule.c	-	_PyIO_str_readline	-
+Modules/_io/_iomodule.c	-	_PyIO_str_reset	-
+Modules/_io/_iomodule.c	-	_PyIO_str_seek	-
+Modules/_io/_iomodule.c	-	_PyIO_str_seekable	-
+Modules/_io/_iomodule.c	-	_PyIO_str_setstate	-
+Modules/_io/_iomodule.c	-	_PyIO_str_tell	-
+Modules/_io/_iomodule.c	-	_PyIO_str_truncate	-
+Modules/_io/_iomodule.c	-	_PyIO_str_writable	-
+Modules/_io/_iomodule.c	-	_PyIO_str_write	-
+Modules/_io/_iomodule.c	-	_PyIO_empty_str	-
+Modules/_json.c	_encoded_const	s_null	-
+Modules/_json.c	_encoded_const	s_true	-
+Modules/_json.c	_encoded_const	s_false	-
+Modules/_json.c	encoder_listencode_dict	open_dict	-
+Modules/_json.c	encoder_listencode_dict	close_dict	-
+Modules/_json.c	encoder_listencode_dict	empty_dict	-
+Modules/_json.c	encoder_listencode_list	open_array	-
+Modules/_json.c	encoder_listencode_list	close_array	-
+Modules/_json.c	encoder_listencode_list	empty_array	-
+Modules/_threadmodule.c	-	str_dict	-
+Modules/_tracemalloc.c	-	unknown_filename	-
+
+#-----------------------
+# module initialized once - other PyObject
+# []
+
+# cached during module init  []
+Modules/_asynciomodule.c	-	asyncio_mod	-
+Modules/_asynciomodule.c	-	traceback_extract_stack	-
+Modules/_asynciomodule.c	-	asyncio_get_event_loop_policy	-
+Modules/_asynciomodule.c	-	asyncio_future_repr_info_func	-
+Modules/_asynciomodule.c	-	asyncio_iscoroutine_func	-
+Modules/_asynciomodule.c	-	asyncio_task_get_stack_func	-
+Modules/_asynciomodule.c	-	asyncio_task_print_stack_func	-
+Modules/_asynciomodule.c	-	asyncio_task_repr_info_func	-
+Modules/_asynciomodule.c	-	asyncio_InvalidStateError	-
+Modules/_asynciomodule.c	-	asyncio_CancelledError	-
+Modules/_zoneinfo.c	-	io_open	-
+Modules/_zoneinfo.c	-	_tzpath_find_tzfile	-
+Modules/_zoneinfo.c	-	_common_mod	-
+
+# other  []
+Modules/_ctypes/_ctypes.c	-	_unpickle	-
+Modules/_ctypes/_ctypes.c	PyCArrayType_from_ctype	cache	-
+Modules/_cursesmodule.c	-	ModDict	-
+Modules/_datetimemodule.c	datetime_strptime	module	-
+Modules/_datetimemodule.c	-	PyDateTime_TimeZone_UTC	-
+Modules/_datetimemodule.c	-	PyDateTime_Epoch	-
+Modules/_datetimemodule.c	-	us_per_ms	-
+Modules/_datetimemodule.c	-	us_per_second	-
+Modules/_datetimemodule.c	-	us_per_minute	-
+Modules/_datetimemodule.c	-	us_per_hour	-
+Modules/_datetimemodule.c	-	us_per_day	-
+Modules/_datetimemodule.c	-	us_per_week	-
+Modules/_datetimemodule.c	-	seconds_per_day	-
+Modules/_decimal/_decimal.c	PyInit__decimal	capsule	-
+Modules/_decimal/_decimal.c	-	basic_context_template	-
+Modules/_decimal/_decimal.c	-	current_context_var	-
+Modules/_decimal/_decimal.c	-	default_context_template	-
+Modules/_decimal/_decimal.c	-	extended_context_template	-
+Modules/_decimal/_decimal.c	-	round_map	-
+Modules/_decimal/_decimal.c	-	Rational	-
+Modules/_decimal/_decimal.c	-	SignalTuple	-
+Modules/_functoolsmodule.c	-	kwd_mark	-
+Modules/_io/_iomodule.c	-	_PyIO_empty_bytes	-
+Modules/_json.c	raise_errmsg	JSONDecodeError	-
+Modules/_sqlite/microprotocols.c	-	psyco_adapters	-
+Modules/_sqlite/module.h	-	_pysqlite_converters	-
+Modules/_ssl.c	-	err_codes_to_names	-
+Modules/_ssl.c	-	err_names_to_codes	-
+Modules/_ssl.c	-	lib_codes_to_names	-
+# XXX This should have been found by the analyzer but wasn't:
+Modules/_ssl.c	-	_ssl_locks	-
+Modules/_struct.c	-	cache	-
+Modules/_tracemalloc.c	-	tracemalloc_empty_traceback	-
+Modules/arraymodule.c	array_array___reduce_ex__	array_reconstructor	-
+Modules/cjkcodecs/cjkcodecs.h	getmultibytecodec	cofunc	-
+Modules/signalmodule.c	-	DefaultHandler	-
+Modules/signalmodule.c	-	IgnoreHandler	-
+Modules/signalmodule.c	-	IntHandler	-
+
+#-----------------------
+# module initialized once - non-PyObject
+# []
+
+# pre-allocated buffer  []
+Modules/getbuildinfo.c	Py_GetBuildInfo	buildinfo	-
+Modules/nismodule.c	nisproc_maplist_2	res	-
+Modules/pyexpat.c	PyUnknownEncodingHandler	template_buffer	-
+
+# other  []
+Include/datetime.h	-	PyDateTimeAPI	-
+Modules/_asynciomodule.c	-	module_initialized	-
+Modules/_ctypes/cfield.c	_ctypes_get_fielddesc	initialized	-
+Modules/_ctypes/malloc_closure.c	-	_pagesize	-
+Modules/_cursesmodule.c	-	initialised	-
+Modules/_cursesmodule.c	-	initialised_setupterm	-
+Modules/_cursesmodule.c	-	initialisedcolors	-
+Modules/_cursesmodule.c	-	screen_encoding	-
+Modules/_cursesmodule.c	PyInit__curses	PyCurses_API	-
+Modules/_datetimemodule.c	-	CAPI	-
+Modules/_decimal/_decimal.c	PyInit__decimal	initialized	-
+Modules/_decimal/_decimal.c	-	_py_long_multiply	-
+Modules/_decimal/_decimal.c	-	_py_long_floor_divide	-
+Modules/_decimal/_decimal.c	-	_py_long_power	-
+Modules/_decimal/_decimal.c	-	_py_float_abs	-
+Modules/_decimal/_decimal.c	-	_py_long_bit_length	-
+Modules/_decimal/_decimal.c	-	_py_float_as_integer_ratio	-
+Modules/_decimal/_decimal.c	-	_decimal_api	-
+Modules/_elementtree.c	-	expat_capi	-
+Modules/_io/bufferedio.c	_PyIO_trap_eintr	eintr_int	-
+Modules/_sqlite/module.h	-	_pysqlite_enable_callback_tracebacks	-
+Modules/_sqlite/module.h	-	pysqlite_BaseTypeAdapted	-
+Modules/_ssl.c	-	_ssl_locks_count	-
+Modules/cjkcodecs/cjkcodecs.h	-	codec_list	-
+Modules/cjkcodecs/cjkcodecs.h	-	mapping_list	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/fileutils.c	-	_Py_open_cloexec_works	-
+Modules/getaddrinfo.c	-	gai_afdl	-
+Modules/posixmodule.c	os_dup2_impl	dup3_works	-
+Modules/posixmodule.c	-	structseq_new	-
+Modules/posixmodule.c	-	ticks_per_second	-
+Modules/pyexpat.c	PyInit_pyexpat	capi	-
+Modules/readline.c	-	using_libedit_emulation	-
+Modules/readline.c	-	libedit_history_start	-
+Modules/resource.c	-	initialized	-
+Modules/signalmodule.c	-	initialized	-
+Modules/socketmodule.c	-	accept4_works	-
+Modules/socketmodule.c	-	sock_cloexec_works	-
+Modules/socketmodule.c	-	PySocketModuleAPI	-
+Modules/spwdmodule.c	-	initialized	-
+Modules/timemodule.c	-	initialized	-
+Modules/timemodule.c	_PyTime_GetClockWithInfo	initialized	-
+Modules/timemodule.c	_PyTime_GetProcessTimeWithInfo	ticks_per_second	-
+
+#-----------------------
+# module state
+# []
+
+Modules/posixmodule.c	-	environ	-
+
+# PyObject  []
+Modules/_asynciomodule.c	-	cached_running_holder	-
+Modules/_asynciomodule.c	-	fi_freelist	-
+Modules/_asynciomodule.c	-	fi_freelist_len	-
+Modules/_asynciomodule.c	-	all_tasks	-
+Modules/_asynciomodule.c	-	current_tasks	-
+Modules/_asynciomodule.c	-	iscoroutine_typecache	-
+Modules/_ctypes/_ctypes.c	-	_ctypes_ptrtype_cache	-
+Modules/_tkinter.c	-	tcl_lock	-
+Modules/_tkinter.c	-	excInCmd	-
+Modules/_tkinter.c	-	valInCmd	-
+Modules/_tkinter.c	-	trbInCmd	-
+Modules/_zoneinfo.c	-	TIMEDELTA_CACHE	-
+Modules/_zoneinfo.c	-	ZONEINFO_WEAK_CACHE	-
+Modules/faulthandler.c	-	fatal_error	-
+Modules/faulthandler.c	-	thread	-
+Modules/faulthandler.c	-	user_signals	-
+Modules/faulthandler.c	-	stack	-
+Modules/faulthandler.c	-	old_stack	-
+Modules/signalmodule.c	-	Handlers	-
+Modules/syslogmodule.c	-	S_ident_o	-
+
+# other  []
+Modules/_asynciomodule.c	-	cached_running_holder_tsid	-
+Modules/_asynciomodule.c	-	task_name_counter	-
+Modules/_ctypes/cfield.c	-	formattable	-
+Modules/_ctypes/malloc_closure.c	-	free_list	-
+Modules/_curses_panel.c	-	lop	-
+Modules/_tkinter.c	-	quitMainLoop	-
+Modules/_tkinter.c	-	errorInCmd	-
+Modules/_tkinter.c	-	Tkinter_busywaitinterval	-
+Modules/_tkinter.c	-	call_mutex	-
+Modules/_tkinter.c	-	var_mutex	-
+Modules/_tkinter.c	-	command_mutex	-
+Modules/_tkinter.c	-	HeadFHCD	-
+Modules/_tkinter.c	-	stdin_ready	-
+Modules/_tkinter.c	-	event_tstate	-
+Modules/_tracemalloc.c	-	allocators	-
+Modules/_tracemalloc.c	-	tables_lock	-
+Modules/_tracemalloc.c	-	tracemalloc_traced_memory	-
+Modules/_tracemalloc.c	-	tracemalloc_peak_traced_memory	-
+Modules/_tracemalloc.c	-	tracemalloc_filenames	-
+Modules/_tracemalloc.c	-	tracemalloc_traceback	-
+Modules/_tracemalloc.c	-	tracemalloc_tracebacks	-
+Modules/_tracemalloc.c	-	tracemalloc_traces	-
+Modules/_tracemalloc.c	-	tracemalloc_domains	-
+Modules/_tracemalloc.c	-	tracemalloc_reentrant_key	-
+Modules/_xxsubinterpretersmodule.c	-	_globals	-
+Modules/_zoneinfo.c	-	ZONEINFO_STRONG_CACHE	-
+Modules/_zoneinfo.c	-	ZONEINFO_STRONG_CACHE_MAX_SIZE	-
+Modules/_zoneinfo.c	-	NO_TTINFO	-
+Modules/faulthandler.c	faulthandler_dump_traceback	reentrant	-
+Modules/readline.c	-	completer_word_break_characters	-
+Modules/readline.c	-	_history_length	-
+Modules/readline.c	-	should_auto_add_history	-
+Modules/readline.c	-	sigwinch_received	-
+Modules/readline.c	-	sigwinch_ohandler	-
+Modules/readline.c	-	completed_input_string	-
+Modules/rotatingtree.c	-	random_stream	-
+Modules/rotatingtree.c	-	random_value	-
+Modules/signalmodule.c	-	is_tripped	-
+Modules/signalmodule.c	-	wakeup	-
+Modules/socketmodule.c	-	defaulttimeout	-
+Modules/syslogmodule.c	-	S_log_open	-
+
+#-----------------------
+# runtime state
+# []
+
+# PyObject  []
+Objects/typeobject.c	resolve_slotdups	pname	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/import.c	-	extensions	-
+
+# allocator  []
+Objects/obmalloc.c	-	_Py_tracemalloc_config	-
+Objects/obmalloc.c	-	_PyObject_Arena	-
+Objects/obmalloc.c	-	arenas	-
+Objects/obmalloc.c	-	maxarenas	-
+Objects/obmalloc.c	-	unused_arena_objects	-
+Objects/obmalloc.c	-	usable_arenas	-
+Objects/obmalloc.c	-	nfp2lasta	-
+Objects/obmalloc.c	-	narenas_currently_allocated	-
+Objects/obmalloc.c	-	ntimes_arena_allocated	-
+Objects/obmalloc.c	-	narenas_highwater	-
+Objects/obmalloc.c	-	raw_allocated_blocks	-
+Objects/obmalloc.c	new_arena	debug_stats	-
+
+# REPL []
+Parser/myreadline.c	-	_PyOS_ReadlineLock	-
+Parser/myreadline.c	-	_PyOS_ReadlineTState	-
+Parser/myreadline.c	-	PyOS_InputHook	-
+Parser/myreadline.c	-	PyOS_ReadlineFunctionPointer	-
+
+# other  []
+Objects/dictobject.c	-	pydict_global_version	-
+Objects/floatobject.c	-	double_format	-
+Objects/floatobject.c	-	float_format	-
+Objects/floatobject.c	-	detected_double_format	-
+Objects/floatobject.c	-	detected_float_format	-
+Objects/moduleobject.c	-	max_module_number	-
+Objects/object.c	-	_Py_RefTotal	-
+Objects/typeobject.c	-	next_version_tag	-
+Objects/typeobject.c	resolve_slotdups	ptrs	-
+Parser/pegen.c	-	memo_statistics	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/bootstrap_hash.c	-	urandom_cache	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/ceval.c	-	lltrace	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/ceval.c	make_pending_calls	busy	-
+Python/dynload_shlib.c	-	handles	-
+Python/dynload_shlib.c	-	nhandles	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/import.c	-	import_lock_level	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/import.c	-	import_lock_thread	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/import.c	import_find_and_load	accumulated	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/import.c	import_find_and_load	import_level	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/pylifecycle.c	-	_Py_UnhandledKeyboardInterrupt	-
+# XXX This should have been found by the analyzer but wasn't:
+Python/pylifecycle.c	fatal_error	reentrant	-
diff --git a/Tools/c-analyzer/cpython/known.py b/Tools/c-analyzer/cpython/known.py
deleted file mode 100644
index c3cc2c0..0000000
--- a/Tools/c-analyzer/cpython/known.py
+++ /dev/null
@@ -1,66 +0,0 @@
-import csv
-import os.path
-
-from c_analyzer.parser.declarations import extract_storage
-from c_analyzer.variables import known as _common
-from c_analyzer.variables.info import Variable
-
-from . import DATA_DIR
-
-
-# XXX need tests:
-# * from_file()
-# * look_up_variable()
-
-
-DATA_FILE = os.path.join(DATA_DIR, 'known.tsv')
-
-
-def _get_storage(decl, infunc):
-    # statics
-    if decl.startswith(('Py_LOCAL(', 'Py_LOCAL_INLINE(')):
-        return 'static'
-    if decl.startswith(('_Py_IDENTIFIER(', '_Py_static_string(')):
-        return 'static'
-    if decl.startswith('PyDoc_VAR('):
-        return 'static'
-    if decl.startswith(('SLOT1BINFULL(', 'SLOT1BIN(')):
-        return 'static'
-    if decl.startswith('WRAP_METHOD('):
-        return 'static'
-    # public extern
-    if decl.startswith('PyAPI_DATA('):
-        return 'extern'
-    # Fall back to the normal handler.
-    return extract_storage(decl, infunc=infunc)
-
-
-def _handle_var(varid, decl):
-#    if varid.name == 'id' and decl == UNKNOWN:
-#        # None of these are variables.
-#        decl = 'int id';
-    storage = _get_storage(decl, varid.funcname)
-    return Variable(varid, storage, decl)
-
-
-def from_file(infile=DATA_FILE, *,
-              _from_file=_common.from_file,
-              _handle_var=_handle_var,
-              ):
-    """Return the info for known declarations in the given file."""
-    return _from_file(infile, handle_var=_handle_var)
-
-
-def look_up_variable(varid, knownvars, *,
-                     _lookup=_common.look_up_variable,
-                     ):
-    """Return the known variable matching the given ID.
-
-    "knownvars" is a mapping of ID to Variable.
-
-    "match_files" is used to verify if two filenames point to
-    the same file.
-
-    If no match is found then None is returned.
-    """
-    return _lookup(varid, knownvars)
diff --git a/Tools/c-analyzer/cpython/known.tsv b/Tools/c-analyzer/cpython/known.tsv
new file mode 100644
index 0000000..a48ef02
--- /dev/null
+++ b/Tools/c-analyzer/cpython/known.tsv
@@ -0,0 +1,3 @@
+filename	funcname	name	kind	declaration
+#filename	funcname	name	kind	is_supported	declaration
+#???	-	PyWideStringList	typedef	???
diff --git a/Tools/c-analyzer/cpython/supported.py b/Tools/c-analyzer/cpython/supported.py
deleted file mode 100644
index 18786ee..0000000
--- a/Tools/c-analyzer/cpython/supported.py
+++ /dev/null
@@ -1,398 +0,0 @@
-import os.path
-import re
-
-from c_analyzer.common.info import ID
-from c_analyzer.common.util import read_tsv, write_tsv
-
-from . import DATA_DIR
-
-# XXX need tests:
-# * generate / script
-
-
-IGNORED_FILE = os.path.join(DATA_DIR, 'ignored.tsv')
-
-IGNORED_COLUMNS = ('filename', 'funcname', 'name', 'kind', 'reason')
-IGNORED_HEADER = '\t'.join(IGNORED_COLUMNS)
-
-# XXX Move these to ignored.tsv.
-IGNORED = {
-        # global
-        'PyImport_FrozenModules': 'process-global',
-        'M___hello__': 'process-global',
-        'inittab_copy': 'process-global',
-        'PyHash_Func': 'process-global',
-        '_Py_HashSecret_Initialized': 'process-global',
-        '_TARGET_LOCALES': 'process-global',
-
-        # startup (only changed before/during)
-        '_PyRuntime': 'runtime startup',
-        'runtime_initialized': 'runtime startup',
-        'static_arg_parsers': 'runtime startup',
-        'orig_argv': 'runtime startup',
-        'opt_ptr': 'runtime startup',
-        '_preinit_warnoptions': 'runtime startup',
-        '_Py_StandardStreamEncoding': 'runtime startup',
-        'Py_FileSystemDefaultEncoding': 'runtime startup',
-        '_Py_StandardStreamErrors': 'runtime startup',
-        'Py_FileSystemDefaultEncodeErrors': 'runtime startup',
-        'Py_BytesWarningFlag': 'runtime startup',
-        'Py_DebugFlag': 'runtime startup',
-        'Py_DontWriteBytecodeFlag': 'runtime startup',
-        'Py_FrozenFlag': 'runtime startup',
-        'Py_HashRandomizationFlag': 'runtime startup',
-        'Py_IgnoreEnvironmentFlag': 'runtime startup',
-        'Py_InspectFlag': 'runtime startup',
-        'Py_InteractiveFlag': 'runtime startup',
-        'Py_IsolatedFlag': 'runtime startup',
-        'Py_NoSiteFlag': 'runtime startup',
-        'Py_NoUserSiteDirectory': 'runtime startup',
-        'Py_OptimizeFlag': 'runtime startup',
-        'Py_QuietFlag': 'runtime startup',
-        'Py_UTF8Mode': 'runtime startup',
-        'Py_UnbufferedStdioFlag': 'runtime startup',
-        'Py_VerboseFlag': 'runtime startup',
-        '_Py_path_config': 'runtime startup',
-        '_PyOS_optarg': 'runtime startup',
-        '_PyOS_opterr': 'runtime startup',
-        '_PyOS_optind': 'runtime startup',
-        '_Py_HashSecret': 'runtime startup',
-
-        # REPL
-        '_PyOS_ReadlineLock': 'repl',
-        '_PyOS_ReadlineTState': 'repl',
-
-        # effectively const
-        'tracemalloc_empty_traceback': 'const',
-        '_empty_bitmap_node': 'const',
-        'posix_constants_pathconf': 'const',
-        'posix_constants_confstr': 'const',
-        'posix_constants_sysconf': 'const',
-        '_PySys_ImplCacheTag': 'const',
-        '_PySys_ImplName': 'const',
-        'PyImport_Inittab': 'const',
-        '_PyImport_DynLoadFiletab': 'const',
-        '_PyParser_Grammar': 'const',
-        'Py_hexdigits': 'const',
-        '_PyImport_Inittab': 'const',
-        '_PyByteArray_empty_string': 'const',
-        '_PyLong_DigitValue': 'const',
-        '_Py_SwappedOp': 'const',
-        'PyStructSequence_UnnamedField': 'const',
-
-        # signals are main-thread only
-        'faulthandler_handlers': 'signals are main-thread only',
-        'user_signals': 'signals are main-thread only',
-        'wakeup': 'signals are main-thread only',
-
-        # hacks
-        '_PySet_Dummy': 'only used as a placeholder',
-        }
-
-BENIGN = 'races here are benign and unlikely'
-
-
-def is_supported(variable, ignored=None, known=None, *,
-                 _ignored=(lambda *a, **k: _is_ignored(*a, **k)),
-                 _vartype_okay=(lambda *a, **k: _is_vartype_okay(*a, **k)),
-                 ):
-    """Return True if the given global variable is okay in CPython."""
-    if _ignored(variable,
-                ignored and ignored.get('variables')):
-        return True
-    elif _vartype_okay(variable.vartype,
-                       ignored.get('types')):
-        return True
-    else:
-        return False
-
-
-def _is_ignored(variable, ignoredvars=None, *,
-                _IGNORED=IGNORED,
-                ):
-    """Return the reason if the variable is a supported global.
-
-    Return None if the variable is not a supported global.
-    """
-    if ignoredvars and (reason := ignoredvars.get(variable.id)):
-        return reason
-
-    if variable.funcname is None:
-        if reason := _IGNORED.get(variable.name):
-            return reason
-
-    # compiler
-    if variable.filename == 'Python/graminit.c':
-        if variable.vartype.startswith('static state '):
-            return 'compiler'
-    if variable.filename == 'Python/symtable.c':
-        if variable.vartype.startswith('static identifier '):
-            return 'compiler'
-    if variable.filename == 'Python/Python-ast.c':
-        # These should be const.
-        if variable.name.endswith('_field'):
-            return 'compiler'
-        if variable.name.endswith('_attribute'):
-            return 'compiler'
-
-    # other
-    if variable.filename == 'Python/dtoa.c':
-        # guarded by lock?
-        if variable.name in ('p5s', 'freelist'):
-            return 'dtoa is thread-safe?'
-        if variable.name in ('private_mem', 'pmem_next'):
-            return 'dtoa is thread-safe?'
-    if variable.filename == 'Python/thread.c':
-        # Threads do not become an issue until after these have been set
-        # and these never get changed after that.
-        if variable.name in ('initialized', 'thread_debug'):
-            return 'thread-safe'
-    if variable.filename == 'Python/getversion.c':
-        if variable.name == 'version':
-            # Races are benign here, as well as unlikely.
-            return BENIGN
-    if variable.filename == 'Python/fileutils.c':
-        if variable.name == 'force_ascii':
-            return BENIGN
-        if variable.name == 'ioctl_works':
-            return BENIGN
-        if variable.name == '_Py_open_cloexec_works':
-            return BENIGN
-    if variable.filename == 'Python/codecs.c':
-        if variable.name == 'ucnhash_CAPI':
-            return BENIGN
-    if variable.filename == 'Python/bootstrap_hash.c':
-        if variable.name == 'getrandom_works':
-            return BENIGN
-    if variable.filename == 'Objects/unicodeobject.c':
-        if variable.name == 'ucnhash_CAPI':
-            return BENIGN
-        if variable.name == 'bloom_linebreak':
-            # *mostly* benign
-            return BENIGN
-    if variable.filename == 'Modules/getbuildinfo.c':
-        if variable.name == 'buildinfo':
-            # The static is used for pre-allocation.
-            return BENIGN
-    if variable.filename == 'Modules/posixmodule.c':
-        if variable.name == 'ticks_per_second':
-            return BENIGN
-        if variable.name == 'dup3_works':
-            return BENIGN
-    if variable.filename == 'Modules/timemodule.c':
-        if variable.name == 'ticks_per_second':
-            return BENIGN
-    if variable.filename == 'Objects/longobject.c':
-        if variable.name == 'log_base_BASE':
-            return BENIGN
-        if variable.name == 'convwidth_base':
-            return BENIGN
-        if variable.name == 'convmultmax_base':
-            return BENIGN
-
-    return None
-
-
-def _is_vartype_okay(vartype, ignoredtypes=None):
-    if _is_object(vartype):
-        return None
-
-    if vartype.startswith('static const '):
-        return 'const'
-    if vartype.startswith('const '):
-        return 'const'
-
-    # components for TypeObject definitions
-    for name in ('PyMethodDef', 'PyGetSetDef', 'PyMemberDef'):
-        if name in vartype:
-            return 'const'
-    for name in ('PyNumberMethods', 'PySequenceMethods', 'PyMappingMethods',
-                 'PyBufferProcs', 'PyAsyncMethods'):
-        if name in vartype:
-            return 'const'
-    for name in ('slotdef', 'newfunc'):
-        if name in vartype:
-            return 'const'
-
-    # structseq
-    for name in ('PyStructSequence_Desc', 'PyStructSequence_Field'):
-        if name in vartype:
-            return 'const'
-
-    # other definiitions
-    if 'PyModuleDef' in vartype:
-        return 'const'
-
-    # thread-safe
-    if '_Py_atomic_int' in vartype:
-        return 'thread-safe'
-    if 'pthread_condattr_t' in vartype:
-        return 'thread-safe'
-
-    # startup
-    if '_Py_PreInitEntry' in vartype:
-        return 'startup'
-
-    # global
-#    if 'PyMemAllocatorEx' in vartype:
-#        return True
-
-    # others
-#    if 'PyThread_type_lock' in vartype:
-#        return True
-
-    # XXX ???
-    # _Py_tss_t
-    # _Py_hashtable_t
-    # stack_t
-    # _PyUnicode_Name_CAPI
-
-    # functions
-    if '(' in vartype and '[' not in vartype:
-        return 'function pointer'
-
-    # XXX finish!
-    # * allow const values?
-    #raise NotImplementedError
-    return None
-
-
-PYOBJECT_RE = re.compile(r'''
-        ^
-        (
-            # must start with "static "
-            static \s+
-            (
-                identifier
-            )
-            \b
-        ) |
-        (
-            # may start with "static "
-            ( static \s+ )?
-            (
-                .*
-                (
-                    PyObject |
-                    PyTypeObject |
-                    _? Py \w+ Object |
-                    _PyArg_Parser |
-                    _Py_Identifier |
-                    traceback_t |
-                    PyAsyncGenASend |
-                    _PyAsyncGenWrappedValue |
-                    PyContext |
-                    method_cache_entry
-                )
-                \b
-            ) |
-            (
-                (
-                    _Py_IDENTIFIER |
-                    _Py_static_string
-                )
-                [(]
-            )
-        )
-        ''', re.VERBOSE)
-
-
-def _is_object(vartype):
-    if 'PyDictKeysObject' in vartype:
-        return False
-    if PYOBJECT_RE.match(vartype):
-        return True
-    if vartype.endswith((' _Py_FalseStruct', ' _Py_TrueStruct')):
-        return True
-
-    # XXX Add more?
-
-    #for part in vartype.split():
-    #    # XXX const is automatic True?
-    #    if part == 'PyObject' or part.startswith('PyObject['):
-    #        return True
-    return False
-
-
-def ignored_from_file(infile, *,
-                      _read_tsv=read_tsv,
-                      ):
-    """Yield a Variable for each ignored var in the file."""
-    ignored = {
-        'variables': {},
-        #'types': {},
-        #'constants': {},
-        #'macros': {},
-        }
-    for row in _read_tsv(infile, IGNORED_HEADER):
-        filename, funcname, name, kind, reason = row
-        if not funcname or funcname == '-':
-            funcname = None
-        id = ID(filename, funcname, name)
-        if kind == 'variable':
-            values = ignored['variables']
-        else:
-            raise ValueError(f'unsupported kind in row {row}')
-        values[id] = reason
-    return ignored
-
-
-##################################
-# generate
-
-def _get_row(varid, reason):
-    return (
-            varid.filename,
-            varid.funcname or '-',
-            varid.name,
-            'variable',
-            str(reason),
-            )
-
-
-def _get_rows(variables, ignored=None, *,
-              _as_row=_get_row,
-              _is_ignored=_is_ignored,
-              _vartype_okay=_is_vartype_okay,
-              ):
-    count = 0
-    for variable in variables:
-        reason = _is_ignored(variable,
-                             ignored and ignored.get('variables'),
-                             )
-        if not reason:
-            reason = _vartype_okay(variable.vartype,
-                                   ignored and ignored.get('types'))
-        if not reason:
-            continue
-
-        print(' ', variable, repr(reason))
-        yield _as_row(variable.id, reason)
-        count += 1
-    print(f'total: {count}')
-
-
-def _generate_ignored_file(variables, filename=None, *,
-                           _generate_rows=_get_rows,
-                           _write_tsv=write_tsv,
-                           ):
-    if not filename:
-        filename = IGNORED_FILE + '.new'
-    rows = _generate_rows(variables)
-    _write_tsv(filename, IGNORED_HEADER, rows)
-
-
-if __name__ == '__main__':
-    from cpython import SOURCE_DIRS
-    from cpython.known import (
-        from_file as known_from_file,
-        DATA_FILE as KNOWN_FILE,
-        )
-    # XXX This is wrong!
-    from . import find
-    known = known_from_file(KNOWN_FILE)
-    knownvars = (known or {}).get('variables')
-    variables = find.globals_from_binary(knownvars=knownvars,
-                                         dirnames=SOURCE_DIRS)
-
-    _generate_ignored_file(variables)
diff --git a/Tools/c-analyzer/ignored-globals.txt b/Tools/c-analyzer/ignored-globals.txt
deleted file mode 100644
index ce6d1d8..0000000
--- a/Tools/c-analyzer/ignored-globals.txt
+++ /dev/null
@@ -1,492 +0,0 @@
-# All variables declared here are shared between all interpreters
-# in a single process.  That means that they must not be changed
-# unless that change should apply to all interpreters.
-#
-# See check-c-globals.py.
-#
-# Many generic names are handled via the script:
-#
-# * most exceptions and all warnings handled via _is_exception()
-# * for builtin modules, generic names are handled via _is_module()
-# * generic names for static types handled via _is_type_var()
-# * AST vars handled via _is_compiler()
-
-
-#######################################
-# main
-
-# Modules/getpath.c
-exec_prefix
-module_search_path
-prefix
-progpath
-
-# Modules/main.c
-orig_argc
-orig_argv
-
-# Python/getopt.c
-opt_ptr
-_PyOS_optarg
-_PyOS_opterr
-_PyOS_optind
-
-
-#######################################
-# REPL
-
-# Parser/myreadline.c
-PyOS_InputHook
-PyOS_ReadlineFunctionPointer
-_PyOS_ReadlineLock
-_PyOS_ReadlineTState
-
-
-#######################################
-# state
-
-# Python/dtoa.c
-p5s
-pmem_next  # very slight race
-private_mem  # very slight race
-
-# Python/import.c
-# For the moment the import lock stays global.  Ultimately there should
-# be a global lock for extension modules and a per-interpreter lock.
-import_lock
-import_lock_level
-import_lock_thread
-
-# Python/pylifecycle.c
-_PyRuntime
-
-
-#---------------------------------
-# module globals (PyObject)
-
-# Modules/_functoolsmodule.c
-kwd_mark
-
-# Modules/_localemodule.c
-Error
-
-# Modules/_threadmodule.c
-ThreadError
-
-# Modules/_tracemalloc.c
-unknown_filename
-
-# Modules/gcmodule.c
-gc_str
-
-# Modules/posixmodule.c
-billion
-posix_putenv_garbage
-
-# Modules/signalmodule.c
-DefaultHandler
-IgnoreHandler
-IntHandler
-ItimerError
-
-# Modules/zipimport.c
-ZipImportError
-zip_directory_cache
-
-
-#---------------------------------
-# module globals (other)
-
-# Modules/_tracemalloc.c
-allocators
-tables_lock
-tracemalloc_config
-tracemalloc_empty_traceback
-tracemalloc_filenames
-tracemalloc_peak_traced_memory
-tracemalloc_reentrant_key
-tracemalloc_traceback
-tracemalloc_tracebacks
-tracemalloc_traced_memory
-tracemalloc_traces
-
-# Modules/faulthandler.c
-fatal_error
-faulthandler_handlers
-old_stack
-stack
-thread
-user_signals
-
-# Modules/posixmodule.c
-posix_constants_confstr
-posix_constants_pathconf
-posix_constants_sysconf
-structseq_new
-ticks_per_second
-
-# Modules/signalmodule.c
-Handlers  # main thread only
-is_tripped  # main thread only
-main_pid
-main_thread
-old_siginthandler
-wakeup_fd  # main thread only
-
-# Modules/zipimport.c
-zip_searchorder
-
-# Python/bltinmodule.c
-Py_FileSystemDefaultEncodeErrors
-Py_FileSystemDefaultEncoding
-Py_HasFileSystemDefaultEncoding
-
-# Python/sysmodule.c
-_PySys_ImplCacheTag
-_PySys_ImplName
-
-
-#---------------------------------
-# freelists
-
-# Modules/_collectionsmodule.c
-freeblocks
-numfreeblocks
-
-# Objects/classobject.c
-free_list
-numfree
-
-# Objects/dictobject.c
-free_list
-keys_free_list
-numfree
-numfreekeys
-
-# Objects/exceptions.c
-memerrors_freelist
-memerrors_numfree
-
-# Objects/floatobject.c
-free_list
-numfree
-
-# Objects/frameobject.c
-free_list
-numfree
-
-# Objects/genobject.c
-ag_asend_freelist
-ag_asend_freelist_free
-ag_value_freelist
-ag_value_freelist_free
-
-# Objects/listobject.c
-free_list
-numfree
-
-# Objects/methodobject.c
-free_list
-numfree
-
-# Objects/sliceobject.c
-slice_cache  # slight race
-
-# Objects/tupleobject.c
-free_list
-numfree
-
-# Python/dtoa.c
-freelist  # very slight race
-
-
-#---------------------------------
-# caches (PyObject)
-
-# Objects/typeobject.c
-method_cache  # only for static types
-next_version_tag  # only for static types
-
-# Python/dynload_shlib.c
-handles  # slight race during import
-nhandles  # slight race during import
-
-# Python/import.c
-extensions  # slight race on init during import
-
-
-#---------------------------------
-# caches (other)
-
-# Python/bootstrap_hash.c
-urandom_cache
-
-# Python/modsupport.c
-_Py_PackageContext  # Slight race during import!  Move to PyThreadState?
-
-
-#---------------------------------
-# counters
-
-# Objects/bytesobject.c
-null_strings
-one_strings
-
-# Objects/dictobject.c
-pydict_global_version
-
-# Objects/moduleobject.c
-max_module_number  # slight race during import
-
-
-#######################################
-# constants
-
-#---------------------------------
-# singletons
-
-# Objects/boolobject.c
-_Py_FalseStruct
-_Py_TrueStruct
-
-# Objects/object.c
-_Py_NoneStruct
-_Py_NotImplementedStruct
-
-# Objects/sliceobject.c
-_Py_EllipsisObject
-
-
-#---------------------------------
-# constants (other)
-
-# Modules/config.c
-_PyImport_Inittab
-
-# Objects/bytearrayobject.c
-_PyByteArray_empty_string
-
-# Objects/dictobject.c
-empty_keys_struct
-empty_values
-
-# Objects/floatobject.c
-detected_double_format
-detected_float_format
-double_format
-float_format
-
-# Objects/longobject.c
-_PyLong_DigitValue
-
-# Objects/object.c
-_Py_SwappedOp
-
-# Objects/obmalloc.c
-_PyMem_Debug
-
-# Objects/setobject.c
-_dummy_struct
-
-# Objects/structseq.c
-PyStructSequence_UnnamedField
-
-# Objects/typeobject.c
-name_op
-slotdefs  # almost
-slotdefs_initialized  # almost
-subtype_getsets_dict_only
-subtype_getsets_full
-subtype_getsets_weakref_only
-tp_new_methoddef
-
-# Objects/unicodeobject.c
-bloom_linebreak
-static_strings  # slight race
-
-# Parser/tokenizer.c
-_PyParser_TokenNames
-
-# Python/Python-ast.c
-alias_fields
-
-# Python/codecs.c
-Py_hexdigits
-ucnhash_CAPI  # slight performance-only race
-
-# Python/dynload_shlib.c
-_PyImport_DynLoadFiletab
-
-# Python/fileutils.c
-_Py_open_cloexec_works
-force_ascii
-
-# Python/frozen.c
-M___hello__
-PyImport_FrozenModules
-
-# Python/graminit.c
-_PyParser_Grammar
-dfas
-labels
-
-# Python/import.c
-PyImport_Inittab
-
-# Python/pylifecycle.c
-_TARGET_LOCALES
-
-
-#---------------------------------
-# initialized (PyObject)
-
-# Objects/bytesobject.c
-characters
-nullstring
-
-# Objects/exceptions.c
-PyExc_RecursionErrorInst
-errnomap
-
-# Objects/longobject.c
-_PyLong_One
-_PyLong_Zero
-small_ints
-
-# Objects/setobject.c
-emptyfrozenset
-
-# Objects/unicodeobject.c
-interned  # slight race on init in PyUnicode_InternInPlace()
-unicode_empty
-unicode_latin1
-
-
-#---------------------------------
-# initialized (other)
-
-# Python/getargs.c
-static_arg_parsers
-
-# Python/pyhash.c
-PyHash_Func
-_Py_HashSecret
-_Py_HashSecret_Initialized
-
-# Python/pylifecycle.c
-_Py_StandardStreamEncoding
-_Py_StandardStreamErrors
-default_home
-env_home
-progname
-Py_BytesWarningFlag
-Py_DebugFlag
-Py_DontWriteBytecodeFlag
-Py_FrozenFlag
-Py_HashRandomizationFlag
-Py_IgnoreEnvironmentFlag
-Py_InspectFlag
-Py_InteractiveFlag
-Py_IsolatedFlag
-Py_NoSiteFlag
-Py_NoUserSiteDirectory
-Py_OptimizeFlag
-Py_QuietFlag
-Py_UnbufferedStdioFlag
-Py_VerboseFlag
-
-
-#---------------------------------
-# types
-
-# Modules/_threadmodule.c
-Locktype
-RLocktype
-localdummytype
-localtype
-
-# Objects/exceptions.c
-PyExc_BaseException
-PyExc_Exception
-PyExc_GeneratorExit
-PyExc_KeyboardInterrupt
-PyExc_StopAsyncIteration
-PyExc_StopIteration
-PyExc_SystemExit
-_PyExc_BaseException
-_PyExc_Exception
-_PyExc_GeneratorExit
-_PyExc_KeyboardInterrupt
-_PyExc_StopAsyncIteration
-_PyExc_StopIteration
-_PyExc_SystemExit
-
-# Objects/structseq.c
-_struct_sequence_template
-
-
-#---------------------------------
-# interned strings/bytes
-
-# Modules/_io/_iomodule.c
-_PyIO_empty_bytes
-_PyIO_empty_str
-_PyIO_str_close
-_PyIO_str_closed
-_PyIO_str_decode
-_PyIO_str_encode
-_PyIO_str_fileno
-_PyIO_str_flush
-_PyIO_str_getstate
-_PyIO_str_isatty
-_PyIO_str_newlines
-_PyIO_str_nl
-_PyIO_str_read
-_PyIO_str_read1
-_PyIO_str_readable
-_PyIO_str_readall
-_PyIO_str_readinto
-_PyIO_str_readline
-_PyIO_str_reset
-_PyIO_str_seek
-_PyIO_str_seekable
-_PyIO_str_setstate
-_PyIO_str_tell
-_PyIO_str_truncate
-_PyIO_str_writable
-_PyIO_str_write
-
-# Modules/_threadmodule.c
-str_dict
-
-# Objects/boolobject.c
-false_str
-true_str
-
-# Objects/listobject.c
-indexerr
-
-# Python/symtable.c
-__class__
-dictcomp
-genexpr
-lambda
-listcomp
-setcomp
-top
-
-# Python/sysmodule.c
-whatstrings
-
-
-#######################################
-# hacks
-
-# Objects/object.c
-_Py_abstract_hack
-
-# Objects/setobject.c
-_PySet_Dummy
-
-# Python/pylifecycle.c
-_PyOS_mystrnicmp_hack
diff --git a/Tools/c-analyzer/ignored.tsv b/Tools/c-analyzer/ignored.tsv
deleted file mode 100644
index a0e0e50..0000000
--- a/Tools/c-analyzer/ignored.tsv
+++ /dev/null
@@ -1 +0,0 @@
-filename	funcname	name	kind	reason
diff --git a/Tools/c-analyzer/known.tsv b/Tools/c-analyzer/known.tsv
deleted file mode 100644
index db44080..0000000
--- a/Tools/c-analyzer/known.tsv
+++ /dev/null
@@ -1,1930 +0,0 @@
-filename	funcname	name	kind	declaration
-Modules/_abc.c	-	_abc_data_type	variable	static PyTypeObject _abc_data_type
-Modules/_abc.c	-	abc_invalidation_counter	variable	static unsigned long long abc_invalidation_counter
-Modules/_abc.c	-	_abcmodule	variable	static struct PyModuleDef _abcmodule
-Python/import.c	import_find_and_load	accumulated	variable	static _PyTime_t accumulated
-Modules/itertoolsmodule.c	-	accumulate_methods	variable	static PyMethodDef accumulate_methods
-Modules/itertoolsmodule.c	-	accumulate_type	variable	static PyTypeObject accumulate_type
-Python/Python-ast.c	-	Add_singleton	variable	static PyObject *Add_singleton
-Python/Python-ast.c	-	Add_type	variable	static PyTypeObject *Add_type
-Objects/genobject.c	-	ag_asend_freelist	variable	static PyAsyncGenASend *ag_asend_freelist[_PyAsyncGen_MAXFREELIST]
-Objects/genobject.c	-	ag_asend_freelist_free	variable	static int ag_asend_freelist_free
-Objects/genobject.c	-	ag_value_freelist	variable	static _PyAsyncGenWrappedValue *ag_value_freelist[_PyAsyncGen_MAXFREELIST]
-Objects/genobject.c	-	ag_value_freelist_free	variable	static int ag_value_freelist_free
-Python/Python-ast.c	-	alias_fields	variable	static const char *alias_fields[]
-Python/Python-ast.c	-	alias_type	variable	static PyTypeObject *alias_type
-Modules/_tracemalloc.c	-	allocators	variable	static struct { PyMemAllocatorEx mem; PyMemAllocatorEx raw; PyMemAllocatorEx obj; } allocators
-Python/Python-ast.c	-	And_singleton	variable	static PyObject *And_singleton
-Python/Python-ast.c	-	And_type	variable	static PyTypeObject *And_type
-Python/Python-ast.c	-	AnnAssign_fields	variable	static const char *AnnAssign_fields[]
-Python/Python-ast.c	-	AnnAssign_type	variable	static PyTypeObject *AnnAssign_type
-Python/compile.c	-	__annotations__	variable	static PyObject *__annotations__
-Objects/obmalloc.c	-	arenas	variable	static struct arena_object* arenas
-Python/Python-ast.c	-	arg_attributes	variable	static const char *arg_attributes[]
-Python/Python-ast.c	-	arg_fields	variable	static const char *arg_fields[]
-Python/Python-ast.c	-	arg_type	variable	static PyTypeObject *arg_type
-Python/Python-ast.c	-	arguments_fields	variable	static const char *arguments_fields[]
-Python/Python-ast.c	-	arguments_type	variable	static PyTypeObject *arguments_type
-Python/Python-ast.c	-	Assert_fields	variable	static const char *Assert_fields[]
-Python/compile.c	compiler_assert	assertion_error	variable	static PyObject *assertion_error
-Python/Python-ast.c	-	Assert_type	variable	static PyTypeObject *Assert_type
-Python/Python-ast.c	-	Assign_fields	variable	static const char *Assign_fields[]
-Python/Python-ast.c	-	Assign_type	variable	static PyTypeObject *Assign_type
-Python/Python-ast.c	-	_astmodule	variable	static struct PyModuleDef _astmodule
-Python/Python-ast.c	-	AST_type	variable	static PyTypeObject AST_type
-Python/Python-ast.c	-	ast_type_getsets	variable	static PyGetSetDef ast_type_getsets[]
-Python/Python-ast.c	-	ast_type_methods	variable	static PyMethodDef ast_type_methods
-Python/Python-ast.c	-	AsyncFor_fields	variable	static const char *AsyncFor_fields[]
-Python/Python-ast.c	-	AsyncFor_type	variable	static PyTypeObject *AsyncFor_type
-Python/Python-ast.c	-	AsyncFunctionDef_fields	variable	static const char *AsyncFunctionDef_fields[]
-Python/Python-ast.c	-	AsyncFunctionDef_type	variable	static PyTypeObject *AsyncFunctionDef_type
-Objects/genobject.c	-	async_gen_as_async	variable	static PyAsyncMethods async_gen_as_async
-Objects/genobject.c	-	async_gen_asend_as_async	variable	static PyAsyncMethods async_gen_asend_as_async
-Objects/genobject.c	-	async_gen_asend_methods	variable	static PyMethodDef async_gen_asend_methods
-Objects/genobject.c	-	async_gen_athrow_as_async	variable	static PyAsyncMethods async_gen_athrow_as_async
-Objects/genobject.c	-	async_gen_athrow_methods	variable	static PyMethodDef async_gen_athrow_methods
-Objects/genobject.c	-	async_gen_getsetlist	variable	static PyGetSetDef async_gen_getsetlist[]
-Python/sysmodule.c	-	asyncgen_hooks_desc	variable	static PyStructSequence_Desc asyncgen_hooks_desc
-Python/sysmodule.c	-	asyncgen_hooks_fields	variable	static PyStructSequence_Field asyncgen_hooks_fields[]
-Python/sysmodule.c	-	AsyncGenHooksType	variable	static PyTypeObject AsyncGenHooksType
-Objects/genobject.c	-	async_gen_memberlist	variable	static PyMemberDef async_gen_memberlist[]
-Objects/genobject.c	-	async_gen_methods	variable	static PyMethodDef async_gen_methods
-Python/Python-ast.c	-	AsyncWith_fields	variable	static const char *AsyncWith_fields[]
-Python/Python-ast.c	-	AsyncWith_type	variable	static PyTypeObject *AsyncWith_type
-Parser/listnode.c	-	atbol	variable	static int atbol
-Modules/atexitmodule.c	-	atexit_methods	variable	static PyMethodDef atexit_methods
-Modules/atexitmodule.c	-	atexitmodule	variable	static struct PyModuleDef atexitmodule
-Modules/atexitmodule.c	-	atexit_slots	variable	static PyModuleDef_Slot atexit_slots[]
-Modules/_operator.c	-	attrgetter_methods	variable	static PyMethodDef attrgetter_methods
-Modules/_operator.c	-	attrgetter_type	variable	static PyTypeObject attrgetter_type
-Python/Python-ast.c	-	Attribute_fields	variable	static const char *Attribute_fields[]
-Python/Python-ast.c	-	Attribute_type	variable	static PyTypeObject *Attribute_type
-Python/Python-ast.c	-	AugAssign_fields	variable	static const char *AugAssign_fields[]
-Python/Python-ast.c	-	AugAssign_type	variable	static PyTypeObject *AugAssign_type
-Python/Python-ast.c	-	AugLoad_singleton	variable	static PyObject *AugLoad_singleton
-Python/Python-ast.c	-	AugLoad_type	variable	static PyTypeObject *AugLoad_type
-Python/Python-ast.c	-	AugStore_singleton	variable	static PyObject *AugStore_singleton
-Python/Python-ast.c	-	AugStore_type	variable	static PyTypeObject *AugStore_type
-Python/Python-ast.c	-	Await_fields	variable	static const char *Await_fields[]
-Python/Python-ast.c	-	Await_type	variable	static PyTypeObject *Await_type
-Objects/exceptions.c	-	BaseException_getset	variable	static PyGetSetDef BaseException_getset[]
-Objects/exceptions.c	-	BaseException_members	variable	static struct PyMemberDef BaseException_members[]
-Objects/exceptions.c	-	BaseException_methods	variable	static PyMethodDef BaseException_methods
-Modules/posixmodule.c	-	billion	variable	static PyObject *billion
-Python/Python-ast.c	-	BinOp_fields	variable	static const char *BinOp_fields[]
-Python/Python-ast.c	-	BinOp_type	variable	static PyTypeObject *BinOp_type
-Python/Python-ast.c	-	BitAnd_singleton	variable	static PyObject *BitAnd_singleton
-Python/Python-ast.c	-	BitAnd_type	variable	static PyTypeObject *BitAnd_type
-Python/Python-ast.c	-	BitOr_singleton	variable	static PyObject *BitOr_singleton
-Python/Python-ast.c	-	BitOr_type	variable	static PyTypeObject *BitOr_type
-Python/Python-ast.c	-	BitXor_singleton	variable	static PyObject *BitXor_singleton
-Python/Python-ast.c	-	BitXor_type	variable	static PyTypeObject *BitXor_type
-Objects/unicodeobject.c	-	bloom_linebreak	variable	static BLOOM_MASK bloom_linebreak
-Objects/boolobject.c	-	bool_as_number	variable	static PyNumberMethods bool_as_number
-Python/Python-ast.c	-	BoolOp_fields	variable	static const char *BoolOp_fields[]
-Python/Python-ast.c	-	boolop_type	variable	static PyTypeObject *boolop_type
-Python/Python-ast.c	-	BoolOp_type	variable	static PyTypeObject *BoolOp_type
-Python/_warnings.c	is_internal_frame	bootstrap_string	variable	static PyObject *bootstrap_string
-Python/Python-ast.c	-	Break_type	variable	static PyTypeObject *Break_type
-Modules/_io/bufferedio.c	-	bufferediobase_methods	variable	static PyMethodDef bufferediobase_methods
-Modules/_io/bufferedio.c	-	bufferedrandom_getset	variable	static PyGetSetDef bufferedrandom_getset[]
-Modules/_io/bufferedio.c	-	bufferedrandom_members	variable	static PyMemberDef bufferedrandom_members[]
-Modules/_io/bufferedio.c	-	bufferedrandom_methods	variable	static PyMethodDef bufferedrandom_methods
-Modules/_io/bufferedio.c	-	bufferedreader_getset	variable	static PyGetSetDef bufferedreader_getset[]
-Modules/_io/bufferedio.c	-	bufferedreader_members	variable	static PyMemberDef bufferedreader_members[]
-Modules/_io/bufferedio.c	-	bufferedreader_methods	variable	static PyMethodDef bufferedreader_methods
-Modules/_io/bufferedio.c	-	bufferedrwpair_getset	variable	static PyGetSetDef bufferedrwpair_getset[]
-Modules/_io/bufferedio.c	-	bufferedrwpair_methods	variable	static PyMethodDef bufferedrwpair_methods
-Modules/_io/bufferedio.c	-	bufferedwriter_getset	variable	static PyGetSetDef bufferedwriter_getset[]
-Modules/_io/bufferedio.c	-	bufferedwriter_members	variable	static PyMemberDef bufferedwriter_members[]
-Modules/_io/bufferedio.c	-	bufferedwriter_methods	variable	static PyMethodDef bufferedwriter_methods
-Modules/getbuildinfo.c	Py_GetBuildInfo	buildinfo	variable	static char buildinfo[50 + sizeof(GITVERSION) + ((sizeof(GITTAG) > sizeof(GITBRANCH)) ?  sizeof(GITTAG) : sizeof(GITBRANCH))]
-Python/bltinmodule.c	-	builtin_methods	variable	static PyMethodDef builtin_methods
-Python/bltinmodule.c	-	builtinsmodule	variable	static struct PyModuleDef builtinsmodule
-Python/import.c	PyImport_Import	builtins_str	variable	static PyObject *builtins_str
-Python/ceval.c	make_pending_calls	busy	variable	static int busy
-Objects/bytearrayobject.c	-	bytearray_as_buffer	variable	static PyBufferProcs bytearray_as_buffer
-Objects/bytearrayobject.c	-	bytearray_as_mapping	variable	static PyMappingMethods bytearray_as_mapping
-Objects/bytearrayobject.c	-	bytearray_as_number	variable	static PyNumberMethods bytearray_as_number
-Objects/bytearrayobject.c	-	bytearray_as_sequence	variable	static PySequenceMethods bytearray_as_sequence
-Objects/bytearrayobject.c	-	bytearrayiter_methods	variable	static PyMethodDef bytearrayiter_methods
-Objects/bytearrayobject.c	-	bytearray_methods	variable	static PyMethodDef bytearray_methods
-Objects/bytesobject.c	-	bytes_as_buffer	variable	static PyBufferProcs bytes_as_buffer
-Objects/bytesobject.c	-	bytes_as_mapping	variable	static PyMappingMethods bytes_as_mapping
-Objects/bytesobject.c	-	bytes_as_number	variable	static PyNumberMethods bytes_as_number
-Objects/bytesobject.c	-	bytes_as_sequence	variable	static PySequenceMethods bytes_as_sequence
-Modules/_io/bytesio.c	-	bytesiobuf_as_buffer	variable	static PyBufferProcs bytesiobuf_as_buffer
-Modules/_io/bytesio.c	-	bytesio_getsetlist	variable	static PyGetSetDef bytesio_getsetlist[]
-Modules/_io/bytesio.c	-	bytesio_methods	variable	static PyMethodDef bytesio_methods
-Objects/bytesobject.c	-	bytes_methods	variable	static PyMethodDef bytes_methods
-Python/thread_pthread.h	init_condattr	ca	variable	static pthread_condattr_t ca
-Python/Python-ast.c	-	Call_fields	variable	static const char *Call_fields[]
-Objects/iterobject.c	-	calliter_methods	variable	static PyMethodDef calliter_methods
-Python/Python-ast.c	-	Call_type	variable	static PyTypeObject *Call_type
-Objects/cellobject.c	-	cell_getsetlist	variable	static PyGetSetDef cell_getsetlist[]
-Modules/itertoolsmodule.c	-	chain_methods	variable	static PyMethodDef chain_methods
-Modules/itertoolsmodule.c	-	chain_type	variable	static PyTypeObject chain_type
-Objects/bytesobject.c	-	characters	variable	static PyBytesObject *characters[UCHAR_MAX + 1]
-Python/symtable.c	-	__class__	variable	static identifier __class__
-Python/Python-ast.c	-	ClassDef_fields	variable	static const char *ClassDef_fields[]
-Python/Python-ast.c	-	ClassDef_type	variable	static PyTypeObject *ClassDef_type
-Objects/funcobject.c	-	cm_getsetlist	variable	static PyGetSetDef cm_getsetlist[]
-Objects/funcobject.c	-	cm_memberlist	variable	static PyMemberDef cm_memberlist[]
-Python/Python-ast.c	-	cmpop_type	variable	static PyTypeObject *cmpop_type
-Modules/_codecsmodule.c	-	_codecs_functions	variable	static PyMethodDef _codecs_functions[]
-Modules/_codecsmodule.c	-	codecsmodule	variable	static struct PyModuleDef codecsmodule
-Objects/codeobject.c	-	code_memberlist	variable	static PyMemberDef code_memberlist[]
-Objects/codeobject.c	-	code_methods	variable	static PyMethodDef code_methods
-Modules/_collectionsmodule.c	-	_collectionsmodule	variable	static struct PyModuleDef _collectionsmodule
-Modules/itertoolsmodule.c	-	combinations_methods	variable	static PyMethodDef combinations_methods
-Modules/itertoolsmodule.c	-	combinations_type	variable	static PyTypeObject combinations_type
-Objects/typeobject.c	object_new	comma_id	variable	_Py_static_string(comma_id, "", "")
-Python/Python-ast.c	-	Compare_fields	variable	static const char *Compare_fields[]
-Python/Python-ast.c	-	Compare_type	variable	static PyTypeObject *Compare_type
-Objects/complexobject.c	-	complex_as_number	variable	static PyNumberMethods complex_as_number
-Objects/complexobject.c	-	complex_members	variable	static PyMemberDef complex_members[]
-Objects/complexobject.c	-	complex_methods	variable	static PyMethodDef complex_methods
-Python/Python-ast.c	-	comprehension_fields	variable	static const char *comprehension_fields[]
-Python/Python-ast.c	-	comprehension_type	variable	static PyTypeObject *comprehension_type
-Modules/itertoolsmodule.c	-	compress_methods	variable	static PyMethodDef compress_methods
-Modules/itertoolsmodule.c	-	compress_type	variable	static PyTypeObject compress_type
-Python/thread_pthread.h	-	condattr_monotonic	variable	static pthread_condattr_t *condattr_monotonic
-Python/Python-ast.c	-	Constant_fields	variable	static const char *Constant_fields[]
-Python/Python-ast.c	-	Constant_type	variable	static PyTypeObject *Constant_type
-Python/Python-ast.c	-	Continue_type	variable	static PyTypeObject *Continue_type
-Objects/longobject.c	PyLong_FromString	convmultmax_base	variable	static twodigits convmultmax_base[37]
-Objects/longobject.c	PyLong_FromString	convwidth_base	variable	static int convwidth_base[37]
-Objects/genobject.c	-	coro_as_async	variable	static PyAsyncMethods coro_as_async
-Objects/genobject.c	-	coro_getsetlist	variable	static PyGetSetDef coro_getsetlist[]
-Objects/genobject.c	-	coro_memberlist	variable	static PyMemberDef coro_memberlist[]
-Objects/genobject.c	-	coro_methods	variable	static PyMethodDef coro_methods
-Objects/genobject.c	-	coro_wrapper_methods	variable	static PyMethodDef coro_wrapper_methods
-Modules/itertoolsmodule.c	-	count_methods	variable	static PyMethodDef count_methods
-Modules/itertoolsmodule.c	-	count_type	variable	static PyTypeObject count_type
-Python/context.c	-	ctx_freelist	variable	static PyContext *ctx_freelist
-Python/context.c	-	ctx_freelist_len	variable	static int ctx_freelist_len
-Modules/itertoolsmodule.c	-	cwr_methods	variable	static PyMethodDef cwr_methods
-Modules/itertoolsmodule.c	-	cwr_type	variable	static PyTypeObject cwr_type
-Modules/itertoolsmodule.c	-	cycle_methods	variable	static PyMethodDef cycle_methods
-Modules/itertoolsmodule.c	-	cycle_type	variable	static PyTypeObject cycle_type
-Objects/obmalloc.c	new_arena	debug_stats	variable	static int debug_stats
-Modules/signalmodule.c	-	DefaultHandler	variable	static PyObject *DefaultHandler
-Modules/_collectionsmodule.c	-	defdict_members	variable	static PyMemberDef defdict_members[]
-Modules/_collectionsmodule.c	-	defdict_methods	variable	static PyMethodDef defdict_methods
-Modules/_collectionsmodule.c	-	defdict_type	variable	static PyTypeObject defdict_type
-Python/Python-ast.c	-	Delete_fields	variable	static const char *Delete_fields[]
-Python/Python-ast.c	-	Delete_type	variable	static PyTypeObject *Delete_type
-Python/Python-ast.c	-	Del_singleton	variable	static PyObject *Del_singleton
-Python/Python-ast.c	-	Del_type	variable	static PyTypeObject *Del_type
-Modules/_collectionsmodule.c	-	deque_as_number	variable	static PyNumberMethods deque_as_number
-Modules/_collectionsmodule.c	-	deque_as_sequence	variable	static PySequenceMethods deque_as_sequence
-Modules/_collectionsmodule.c	-	deque_getset	variable	static PyGetSetDef deque_getset[]
-Modules/_collectionsmodule.c	-	dequeiter_methods	variable	static PyMethodDef dequeiter_methods
-Modules/_collectionsmodule.c	-	dequeiter_type	variable	static PyTypeObject dequeiter_type
-Modules/_collectionsmodule.c	-	deque_methods	variable	static PyMethodDef deque_methods
-Modules/_collectionsmodule.c	-	dequereviter_type	variable	static PyTypeObject dequereviter_type
-Modules/_collectionsmodule.c	-	deque_type	variable	static PyTypeObject deque_type
-Objects/descrobject.c	-	descr_members	variable	static PyMemberDef descr_members[]
-Objects/descrobject.c	-	descr_methods	variable	static PyMethodDef descr_methods
-Modules/_abc.c	-	_destroy_def	variable	static PyMethodDef _destroy_def
-Objects/floatobject.c	-	detected_double_format	variable	static float_format_type detected_double_format
-Objects/floatobject.c	-	detected_float_format	variable	static float_format_type detected_float_format
-Objects/dictobject.c	-	dict_as_mapping	variable	static PyMappingMethods dict_as_mapping
-Objects/dictobject.c	-	dict_as_sequence	variable	static PySequenceMethods dict_as_sequence
-Python/symtable.c	-	dictcomp	variable	static identifier dictcomp
-Python/Python-ast.c	-	DictComp_fields	variable	static const char *DictComp_fields[]
-Python/Python-ast.c	-	DictComp_type	variable	static PyTypeObject *DictComp_type
-Python/Python-ast.c	-	Dict_fields	variable	static const char *Dict_fields[]
-Objects/dictobject.c	-	dictitems_as_sequence	variable	static PySequenceMethods dictitems_as_sequence
-Objects/dictobject.c	-	dictitems_methods	variable	static PyMethodDef dictitems_methods
-Objects/dictobject.c	-	dictiter_methods	variable	static PyMethodDef dictiter_methods
-Objects/dictobject.c	-	dictkeys_as_sequence	variable	static PySequenceMethods dictkeys_as_sequence
-Objects/dictobject.c	-	dictkeys_methods	variable	static PyMethodDef dictkeys_methods
-Python/Python-ast.c	-	Dict_type	variable	static PyTypeObject *Dict_type
-Objects/dictobject.c	-	dictvalues_as_sequence	variable	static PySequenceMethods dictvalues_as_sequence
-Objects/dictobject.c	-	dictvalues_methods	variable	static PyMethodDef dictvalues_methods
-Objects/dictobject.c	-	dictviews_as_number	variable	static PyNumberMethods dictviews_as_number
-Modules/posixmodule.c	-	DirEntry_members	variable	static PyMemberDef DirEntry_members[]
-Modules/posixmodule.c	-	DirEntry_methods	variable	static PyMethodDef DirEntry_methods
-Modules/posixmodule.c	-	DirEntryType	variable	static PyTypeObject DirEntryType
-Python/Python-ast.c	-	Div_singleton	variable	static PyObject *Div_singleton
-Python/Python-ast.c	-	Div_type	variable	static PyTypeObject *Div_type
-Python/compile.c	-	__doc__	variable	static PyObject *__doc__
-Objects/classobject.c	method_get_doc	docstr	variable	static PyObject *docstr
-Objects/classobject.c	instancemethod_get_doc	docstr	variable	static PyObject *docstr
-Python/compile.c	compiler_set_qualname	dot	variable	_Py_static_string(dot, ""."")
-Python/compile.c	compiler_set_qualname	dot_locals	variable	_Py_static_string(dot_locals, "".<locals>"")
-Objects/floatobject.c	-	double_format	variable	static float_format_type double_format
-Modules/itertoolsmodule.c	-	dropwhile_methods	variable	static PyMethodDef dropwhile_methods
-Modules/itertoolsmodule.c	-	dropwhile_type	variable	static PyTypeObject dropwhile_type
-Objects/setobject.c	-	_dummy_struct	variable	static PyObject _dummy_struct
-Modules/posixmodule.c	os_dup2_impl	dup3_works	variable	static int dup3_works
-Modules/_io/bufferedio.c	_PyIO_trap_eintr	eintr_int	variable	static PyObject *eintr_int
-Objects/sliceobject.c	-	ellipsis_methods	variable	static PyMethodDef ellipsis_methods
-Python/hamt.c	-	_empty_bitmap_node	variable	static PyHamtNode_Bitmap *_empty_bitmap_node
-Objects/setobject.c	-	emptyfrozenset	variable	static PyObject *emptyfrozenset
-Python/hamt.c	-	_empty_hamt	variable	static PyHamtObject *_empty_hamt
-Objects/dictobject.c	-	empty_keys_struct	variable	static PyDictKeysObject empty_keys_struct
-Objects/codeobject.c	PyCode_NewEmpty	emptystring	variable	static PyObject *emptystring
-Python/compile.c	compiler_from_import	empty_string	variable	static PyObject *empty_string
-Objects/dictobject.c	-	empty_values	variable	static PyObject *empty_values[1]
-Objects/unicodeobject.c	-	encoding_map_methods	variable	static PyMethodDef encoding_map_methods
-Objects/unicodeobject.c	-	EncodingMapType	variable	static PyTypeObject EncodingMapType
-Objects/enumobject.c	-	enum_methods	variable	static PyMethodDef enum_methods
-Python/Python-ast.c	-	Eq_singleton	variable	static PyObject *Eq_singleton
-Python/Python-ast.c	-	Eq_type	variable	static PyTypeObject *Eq_type
-Objects/exceptions.c	-	errnomap	variable	static PyObject *errnomap
-Modules/errnomodule.c	-	errno_methods	variable	static PyMethodDef errno_methods
-Modules/errnomodule.c	-	errnomodule	variable	static struct PyModuleDef errnomodule
-Modules/_localemodule.c	-	Error	variable	static PyObject *Error
-Python/Python-ast.c	-	excepthandler_attributes	variable	static const char *excepthandler_attributes[]
-Python/Python-ast.c	-	ExceptHandler_fields	variable	static const char *ExceptHandler_fields[]
-Python/Python-ast.c	-	excepthandler_type	variable	static PyTypeObject *excepthandler_type
-Python/Python-ast.c	-	ExceptHandler_type	variable	static PyTypeObject *ExceptHandler_type
-Modules/_threadmodule.c	-	ExceptHookArgs_desc	variable	static PyStructSequence_Desc ExceptHookArgs_desc
-Modules/_threadmodule.c	-	ExceptHookArgs_fields	variable	static PyStructSequence_Field ExceptHookArgs_fields[]
-Modules/_threadmodule.c	-	ExceptHookArgsType	variable	static PyTypeObject ExceptHookArgsType
-Objects/exceptions.c	_check_for_legacy_statements	exec_prefix	variable	static PyObject *exec_prefix
-Python/Python-ast.c	-	expr_attributes	variable	static const char *expr_attributes[]
-Python/Python-ast.c	-	expr_context_type	variable	static PyTypeObject *expr_context_type
-Python/Python-ast.c	-	Expression_fields	variable	static const char *Expression_fields[]
-Python/Python-ast.c	-	Expression_type	variable	static PyTypeObject *Expression_type
-Python/Python-ast.c	-	Expr_fields	variable	static const char *Expr_fields[]
-Python/Python-ast.c	-	expr_type	variable	static PyTypeObject *expr_type
-Python/Python-ast.c	-	Expr_type	variable	static PyTypeObject *Expr_type
-Python/import.c	-	extensions	variable	static PyObject *extensions
-Python/Python-ast.c	-	ExtSlice_fields	variable	static const char *ExtSlice_fields[]
-Python/Python-ast.c	-	ExtSlice_type	variable	static PyTypeObject *ExtSlice_type
-Objects/boolobject.c	-	false_str	variable	static PyObject *false_str
-Modules/faulthandler.c	-	fatal_error	variable	static struct { int enabled; PyObject *file; int fd; int all_threads; PyInterpreterState *interp; void *exc_handler; } fatal_error
-Modules/faulthandler.c	-	faulthandler_handlers	variable	static fault_handler_t faulthandler_handlers[]
-Objects/stringlib/unicode_format.h	-	fieldnameiter_methods	variable	static PyMethodDef fieldnameiter_methods
-Modules/_io/fileio.c	-	fileio_getsetlist	variable	static PyGetSetDef fileio_getsetlist[]
-Modules/_io/fileio.c	-	fileio_members	variable	static PyMemberDef fileio_members[]
-Modules/_io/fileio.c	-	fileio_methods	variable	static PyMethodDef fileio_methods
-Modules/itertoolsmodule.c	-	filterfalse_methods	variable	static PyMethodDef filterfalse_methods
-Modules/itertoolsmodule.c	-	filterfalse_type	variable	static PyTypeObject filterfalse_type
-Python/bltinmodule.c	-	filter_methods	variable	static PyMethodDef filter_methods
-Python/sysmodule.c	-	flags_desc	variable	static PyStructSequence_Desc flags_desc
-Python/sysmodule.c	-	flags_fields	variable	static PyStructSequence_Field flags_fields[]
-Python/sysmodule.c	-	FlagsType	variable	static PyTypeObject FlagsType
-Objects/floatobject.c	-	float_as_number	variable	static PyNumberMethods float_as_number
-Objects/floatobject.c	-	float_format	variable	static float_format_type 
-Objects/floatobject.c	-	float_getset	variable	static PyGetSetDef float_getset[]
-Objects/floatobject.c	-	floatinfo_desc	variable	static PyStructSequence_Desc floatinfo_desc
-Objects/floatobject.c	-	floatinfo_fields	variable	static PyStructSequence_Field floatinfo_fields[]
-Objects/floatobject.c	-	FloatInfoType	variable	static PyTypeObject FloatInfoType
-Objects/floatobject.c	-	float_methods	variable	static PyMethodDef float_methods
-Python/Python-ast.c	-	FloorDiv_singleton	variable	static PyObject *FloorDiv_singleton
-Python/Python-ast.c	-	FloorDiv_type	variable	static PyTypeObject *FloorDiv_type
-Python/fileutils.c	-	force_ascii	variable	static int force_ascii
-Python/Python-ast.c	-	For_fields	variable	static const char *For_fields[]
-Python/Python-ast.c	-	FormattedValue_fields	variable	static const char *FormattedValue_fields[]
-Python/Python-ast.c	-	FormattedValue_type	variable	static PyTypeObject *FormattedValue_type
-Objects/stringlib/unicode_format.h	-	formatteriter_methods	variable	static PyMethodDef formatteriter_methods
-Python/Python-ast.c	-	For_type	variable	static PyTypeObject *For_type
-Objects/frameobject.c	-	frame_getsetlist	variable	static PyGetSetDef frame_getsetlist[]
-Objects/frameobject.c	-	frame_memberlist	variable	static PyMemberDef frame_memberlist[]
-Objects/frameobject.c	-	frame_methods	variable	static PyMethodDef frame_methods
-Modules/_collectionsmodule.c	-	freeblocks	variable	static block *freeblocks[MAXFREEBLOCKS]
-Python/dtoa.c	-	freelist	variable	static Bigint *freelist[Kmax+1]
-Objects/floatobject.c	-	free_list	variable	static PyFloatObject *free_list
-Objects/frameobject.c	-	free_list	variable	static PyFrameObject *free_list
-Objects/listobject.c	-	free_list	variable	static PyListObject *free_list[PyList_MAXFREELIST]
-Objects/dictobject.c	-	free_list	variable	static PyDictObject *free_list[PyDict_MAXFREELIST]
-Objects/methodobject.c	-	free_list	variable	static PyCFunctionObject *free_list
-Objects/tupleobject.c	-	free_list	variable	static PyTupleObject *free_list[PyTuple_MAXSAVESIZE]
-Objects/classobject.c	-	free_list	variable	static PyMethodObject *free_list
-Objects/setobject.c	-	frozenset_as_number	variable	static PyNumberMethods frozenset_as_number
-Objects/setobject.c	-	frozenset_methods	variable	static PyMethodDef frozenset_methods
-Objects/funcobject.c	-	func_getsetlist	variable	static PyGetSetDef func_getsetlist[]
-Objects/funcobject.c	-	func_memberlist	variable	static PyMemberDef func_memberlist[]
-Python/Python-ast.c	-	FunctionDef_fields	variable	static const char *FunctionDef_fields[]
-Python/Python-ast.c	-	FunctionDef_type	variable	static PyTypeObject *FunctionDef_type
-Modules/_sre.c	-	_functions	variable	static PyMethodDef _functions[]
-Python/Python-ast.c	-	FunctionType_fields	variable	static const char *FunctionType_fields[]
-Python/Python-ast.c	-	FunctionType_type	variable	static PyTypeObject *FunctionType_type
-Modules/_functoolsmodule.c	-	_functoolsmodule	variable	static struct PyModuleDef _functoolsmodule
-Modules/gcmodule.c	-	GcMethods	variable	static PyMethodDef GcMethods[]
-Modules/gcmodule.c	-	gcmodule	variable	static struct PyModuleDef gcmodule
-Modules/gcmodule.c	-	gc_str	variable	static PyObject *gc_str
-Python/Python-ast.c	-	GeneratorExp_fields	variable	static const char *GeneratorExp_fields[]
-Python/Python-ast.c	-	GeneratorExp_type	variable	static PyTypeObject *GeneratorExp_type
-Python/symtable.c	-	genexpr	variable	static identifier genexpr
-Objects/genobject.c	-	gen_getsetlist	variable	static PyGetSetDef gen_getsetlist[]
-Objects/genobject.c	-	gen_memberlist	variable	static PyMemberDef gen_memberlist[]
-Objects/genobject.c	-	gen_methods	variable	static PyMethodDef gen_methods
-Python/bootstrap_hash.c	py_getrandom	getrandom_works	variable	static int getrandom_works
-Objects/descrobject.c	-	getset_getset	variable	static PyGetSetDef getset_getset[]
-Python/Python-ast.c	-	Global_fields	variable	static const char *Global_fields[]
-Python/Python-ast.c	-	Global_type	variable	static PyTypeObject *Global_type
-Modules/itertoolsmodule.c	-	groupby_methods	variable	static PyMethodDef groupby_methods
-Modules/itertoolsmodule.c	-	groupby_type	variable	static PyTypeObject groupby_type
-Modules/itertoolsmodule.c	-	_grouper_methods	variable	static PyMethodDef _grouper_methods
-Modules/itertoolsmodule.c	-	_grouper_type	variable	static PyTypeObject _grouper_type
-Python/Python-ast.c	-	GtE_singleton	variable	static PyObject *GtE_singleton
-Python/Python-ast.c	-	GtE_type	variable	static PyTypeObject *GtE_type
-Python/Python-ast.c	-	Gt_singleton	variable	static PyObject *Gt_singleton
-Python/Python-ast.c	-	Gt_type	variable	static PyTypeObject *Gt_type
-Modules/signalmodule.c	-	Handlers	variable	static volatile struct { _Py_atomic_int tripped; PyObject *func; } Handlers[NSIG]
-Python/dynload_shlib.c	-	handles	variable	static struct { dev_t dev; ino_t ino; void *handle; } handles[128]
-Python/sysmodule.c	-	hash_info_desc	variable	static PyStructSequence_Desc hash_info_desc
-Python/sysmodule.c	-	hash_info_fields	variable	static PyStructSequence_Field hash_info_fields[]
-Python/sysmodule.c	-	Hash_InfoType	variable	static PyTypeObject Hash_InfoType
-Python/import.c	import_find_and_load	header	variable	static int header
-Python/Python-ast.c	-	IfExp_fields	variable	static const char *IfExp_fields[]
-Python/Python-ast.c	-	IfExp_type	variable	static PyTypeObject *IfExp_type
-Python/Python-ast.c	-	If_fields	variable	static const char *If_fields[]
-Python/Python-ast.c	-	If_type	variable	static PyTypeObject *If_type
-Modules/signalmodule.c	-	IgnoreHandler	variable	static PyObject *IgnoreHandler
-Python/import.c	-	imp_methods	variable	static PyMethodDef imp_methods
-Python/import.c	-	impmodule	variable	static struct PyModuleDef impmodule
-Objects/exceptions.c	-	ImportError_members	variable	static PyMemberDef ImportError_members[]
-Objects/exceptions.c	-	ImportError_methods	variable	static PyMethodDef ImportError_methods
-Python/Python-ast.c	-	Import_fields	variable	static const char *Import_fields[]
-Python/Python-ast.c	-	ImportFrom_fields	variable	static const char *ImportFrom_fields[]
-Python/Python-ast.c	-	ImportFrom_type	variable	static PyTypeObject *ImportFrom_type
-Python/import.c	import_find_and_load	import_level	variable	static int import_level
-Python/_warnings.c	is_internal_frame	importlib_string	variable	static PyObject *importlib_string
-Python/import.c	-	import_lock	variable	static PyThread_type_lock import_lock
-Python/import.c	-	import_lock_level	variable	static int import_lock_level
-Python/import.c	-	import_lock_thread	variable	static unsigned long import_lock_thread
-Python/import.c	PyImport_Import	import_str	variable	static PyObject *import_str
-Python/Python-ast.c	-	Import_type	variable	static PyTypeObject *Import_type
-Modules/_io/textio.c	-	incrementalnewlinedecoder_getset	variable	static PyGetSetDef incrementalnewlinedecoder_getset[]
-Modules/_io/textio.c	-	incrementalnewlinedecoder_methods	variable	static PyMethodDef incrementalnewlinedecoder_methods
-Objects/listobject.c	-	indexerr	variable	static PyObject *indexerr
-Python/Python-ast.c	-	Index_fields	variable	static const char *Index_fields[]
-Python/Python-ast.c	-	Index_type	variable	static PyTypeObject *Index_type
-Python/thread.c	-	initialized	variable	static int initialized
-Modules/posixmodule.c	-	initialized	variable	static int initialized
-Modules/pwdmodule.c	-	initialized	variable	static int initialized
-Modules/signalmodule.c	-	initialized	variable	static int initialized
-Modules/timemodule.c	-	initialized	variable	static int initialized
-Python/Python-ast.c	init_types	initialized	variable	static int initialized
-Objects/listobject.c	PyList_New	initialized	variable	static int initialized
-Python/import.c	-	inittab_copy	variable	static struct _inittab *inittab_copy
-Python/Python-ast.c	-	In_singleton	variable	static PyObject *In_singleton
-Objects/classobject.c	-	instancemethod_getset	variable	static PyGetSetDef instancemethod_getset[]
-Objects/classobject.c	-	instancemethod_memberlist	variable	static PyMemberDef instancemethod_memberlist[]
-Python/Python-ast.c	-	Interactive_fields	variable	static const char *Interactive_fields[]
-Python/Python-ast.c	-	Interactive_type	variable	static PyTypeObject *Interactive_type
-Objects/unicodeobject.c	-	interned	variable	static PyObject *interned
-Objects/interpreteridobject.c	-	interpid_as_number	variable	static PyNumberMethods interpid_as_number
-Modules/signalmodule.c	-	IntHandler	variable	static PyObject *IntHandler
-Objects/longobject.c	-	int_info_desc	variable	static PyStructSequence_Desc int_info_desc
-Objects/longobject.c	-	int_info_fields	variable	static PyStructSequence_Field int_info_fields[]
-Objects/longobject.c	-	Int_InfoType	variable	static PyTypeObject Int_InfoType
-Python/Python-ast.c	-	In_type	variable	static PyTypeObject *In_type
-Python/Python-ast.c	-	Invert_singleton	variable	static PyObject *Invert_singleton
-Python/Python-ast.c	-	Invert_type	variable	static PyTypeObject *Invert_type
-Modules/_io/iobase.c	-	iobase_getset	variable	static PyGetSetDef iobase_getset[]
-Modules/_io/iobase.c	-	iobase_methods	variable	static PyMethodDef iobase_methods
-Python/fileutils.c	set_inheritable	ioctl_works	variable	static int ioctl_works
-Modules/itertoolsmodule.c	-	islice_methods	variable	static PyMethodDef islice_methods
-Modules/itertoolsmodule.c	-	islice_type	variable	static PyTypeObject islice_type
-Python/Python-ast.c	-	IsNot_singleton	variable	static PyObject *IsNot_singleton
-Python/Python-ast.c	-	IsNot_type	variable	static PyTypeObject *IsNot_type
-Python/Python-ast.c	-	Is_singleton	variable	static PyObject *Is_singleton
-Modules/signalmodule.c	-	is_tripped	variable	static _Py_atomic_int is_tripped
-Python/Python-ast.c	-	Is_type	variable	static PyTypeObject *Is_type
-Modules/_operator.c	-	itemgetter_methods	variable	static PyMethodDef itemgetter_methods
-Modules/_operator.c	-	itemgetter_type	variable	static PyTypeObject itemgetter_type
-Modules/itertoolsmodule.c	-	itertoolsmodule	variable	static struct PyModuleDef itertoolsmodule
-Modules/signalmodule.c	-	ItimerError	variable	static PyObject *ItimerError
-Python/Python-ast.c	-	JoinedStr_fields	variable	static const char *JoinedStr_fields[]
-Python/Python-ast.c	-	JoinedStr_type	variable	static PyTypeObject *JoinedStr_type
-Modules/_functoolsmodule.c	-	keyobject_members	variable	static PyMemberDef keyobject_members[]
-Modules/_functoolsmodule.c	-	keyobject_type	variable	static PyTypeObject keyobject_type
-Objects/dictobject.c	-	keys_free_list	variable	static PyDictKeysObject *keys_free_list[PyDict_MAXFREELIST]
-Python/Python-ast.c	-	keyword_fields	variable	static const char *keyword_fields[]
-Python/sysmodule.c	sys_set_asyncgen_hooks	keywords	variable	static const char *keywords[]
-Modules/_bisectmodule.c	bisect_right	keywords	variable	static const char *keywords[]
-Modules/_bisectmodule.c	insort_right	keywords	variable	static const char *keywords[]
-Python/Python-ast.c	-	keyword_type	variable	static PyTypeObject *keyword_type
-Modules/_functoolsmodule.c	keyobject_call	kwargs	variable	static const char *kwargs[]
-Modules/_functoolsmodule.c	functools_cmp_to_key	kwargs	variable	static const char *kwargs[]
-Modules/itertoolsmodule.c	repeat_new	kwargs	variable	static const char *kwargs[]
-Python/_warnings.c	warnings_warn_explicit	kwd_list	variable	static const char *kwd_list[]
-Modules/_functoolsmodule.c	-	kwd_mark	variable	static PyObject *kwd_mark
-Python/bltinmodule.c	builtin___import__	kwlist	variable	static const char *kwlist[]
-Python/bltinmodule.c	min_max	kwlist	variable	static const char *kwlist[]
-Python/context.c	contextvar_tp_new	kwlist	variable	static const char *kwlist[]
-Python/sysmodule.c	sys_getsizeof	kwlist	variable	static const char *kwlist[]
-Objects/bytearrayobject.c	bytearray_init	kwlist	variable	static const char *kwlist[]
-Objects/bytesobject.c	bytes_new	kwlist	variable	static const char *kwlist[]
-Objects/exceptions.c	ImportError_init	kwlist	variable	static const char *kwlist[]
-Objects/interpreteridobject.c	interpid_new	kwlist	variable	static const char *kwlist[]
-Objects/memoryobject.c	memory_new	kwlist	variable	static const char *kwlist[]
-Objects/memoryobject.c	memory_cast	kwlist	variable	static const char *kwlist[]
-Objects/memoryobject.c	memory_tobytes	kwlist	variable	static const char *kwlist[]
-Objects/odictobject.c	odict_pop	kwlist	variable	static const char *kwlist[]
-Objects/unicodeobject.c	unicode_new	kwlist	variable	static const char *kwlist[]
-Objects/weakrefobject.c	weakref_call	kwlist	variable	static const char *kwlist[]
-Modules/_elementtree.c	element_setstate_from_Python	kwlist	variable	static const char *kwlist[]
-Modules/_json.c	scanner_call	kwlist	variable	static const char *kwlist[]
-Modules/_json.c	scanner_new	kwlist	variable	static const char *kwlist[]
-Modules/_json.c	encoder_new	kwlist	variable	static const char *kwlist[]
-Modules/_json.c	encoder_call	kwlist	variable	static const char *kwlist[]
-Python/symtable.c	-	lambda	variable	static identifier lambda
-Python/Python-ast.c	-	Lambda_fields	variable	static const char *Lambda_fields[]
-Python/Python-ast.c	-	Lambda_type	variable	static PyTypeObject *Lambda_type
-Parser/listnode.c	-	level	variable	static int level
-Objects/listobject.c	-	list_as_mapping	variable	static PyMappingMethods list_as_mapping
-Objects/listobject.c	-	list_as_sequence	variable	static PySequenceMethods list_as_sequence
-Python/symtable.c	-	listcomp	variable	static identifier listcomp
-Python/Python-ast.c	-	ListComp_fields	variable	static const char *ListComp_fields[]
-Python/Python-ast.c	-	ListComp_type	variable	static PyTypeObject *ListComp_type
-Python/Python-ast.c	-	List_fields	variable	static const char *List_fields[]
-Objects/listobject.c	-	listiter_methods	variable	static PyMethodDef listiter_methods
-Objects/listobject.c	-	list_methods	variable	static PyMethodDef list_methods
-Objects/listobject.c	-	listreviter_methods	variable	static PyMethodDef listreviter_methods
-Python/Python-ast.c	-	List_type	variable	static PyTypeObject *List_type
-Python/ceval.c	-	lltrace	variable	static int lltrace
-Python/Python-ast.c	-	Load_singleton	variable	static PyObject *Load_singleton
-Python/Python-ast.c	-	Load_type	variable	static PyTypeObject *Load_type
-Modules/_threadmodule.c	-	localdummytype	variable	static PyTypeObject localdummytype
-Modules/_localemodule.c	-	_localemodule	variable	static struct PyModuleDef _localemodule
-Modules/_threadmodule.c	-	localtype	variable	static PyTypeObject localtype
-Modules/_threadmodule.c	-	lock_methods	variable	static PyMethodDef lock_methods
-Modules/_threadmodule.c	-	Locktype	variable	static PyTypeObject Locktype
-Objects/longobject.c	PyLong_FromString	log_base_BASE	variable	static double log_base_BASE[37]
-Objects/longobject.c	-	long_as_number	variable	static PyNumberMethods long_as_number
-Objects/longobject.c	-	long_getset	variable	static PyGetSetDef long_getset[]
-Objects/longobject.c	-	long_methods	variable	static PyMethodDef long_methods
-Objects/rangeobject.c	-	longrangeiter_methods	variable	static PyMethodDef longrangeiter_methods
-Modules/_functoolsmodule.c	-	lru_cache_getsetlist	variable	static PyGetSetDef lru_cache_getsetlist[]
-Modules/_functoolsmodule.c	-	lru_cache_methods	variable	static PyMethodDef lru_cache_methods
-Modules/_functoolsmodule.c	-	lru_cache_type	variable	static PyTypeObject lru_cache_type
-Modules/_functoolsmodule.c	-	lru_list_elem_type	variable	static PyTypeObject lru_list_elem_type
-Python/Python-ast.c	-	LShift_singleton	variable	static PyObject *LShift_singleton
-Python/Python-ast.c	-	LShift_type	variable	static PyTypeObject *LShift_type
-Python/Python-ast.c	-	LtE_singleton	variable	static PyObject *LtE_singleton
-Python/Python-ast.c	-	LtE_type	variable	static PyTypeObject *LtE_type
-Python/Python-ast.c	-	Lt_singleton	variable	static PyObject *Lt_singleton
-Python/Python-ast.c	-	Lt_type	variable	static PyTypeObject *Lt_type
-Python/bltinmodule.c	-	map_methods	variable	static PyMethodDef map_methods
-Objects/descrobject.c	-	mappingproxy_as_mapping	variable	static PyMappingMethods mappingproxy_as_mapping
-Objects/descrobject.c	-	mappingproxy_as_sequence	variable	static PySequenceMethods mappingproxy_as_sequence
-Objects/descrobject.c	-	mappingproxy_methods	variable	static PyMethodDef mappingproxy_methods
-Objects/dictobject.c	-	mapp_methods	variable	static PyMethodDef mapp_methods
-Python/marshal.c	-	marshal_methods	variable	static PyMethodDef marshal_methods
-Python/marshal.c	-	marshalmodule	variable	static struct PyModuleDef marshalmodule
-Modules/_sre.c	-	match_as_mapping	variable	static PyMappingMethods match_as_mapping
-Modules/_sre.c	-	match_getset	variable	static PyGetSetDef match_getset[]
-Modules/_sre.c	-	match_members	variable	static PyMemberDef match_members[]
-Modules/_sre.c	-	match_methods	variable	static PyMethodDef match_methods
-Modules/_sre.c	-	Match_Type	variable	static PyTypeObject Match_Type
-Python/Python-ast.c	-	MatMult_singleton	variable	static PyObject *MatMult_singleton
-Python/Python-ast.c	-	MatMult_type	variable	static PyTypeObject *MatMult_type
-Objects/obmalloc.c	-	maxarenas	variable	static uint maxarenas
-Objects/moduleobject.c	-	max_module_number	variable	static Py_ssize_t max_module_number
-Objects/descrobject.c	-	member_getset	variable	static PyGetSetDef member_getset[]
-Objects/exceptions.c	-	memerrors_freelist	variable	static PyBaseExceptionObject *memerrors_freelist
-Objects/exceptions.c	-	memerrors_numfree	variable	static int memerrors_numfree
-Objects/memoryobject.c	-	memory_as_buffer	variable	static PyBufferProcs memory_as_buffer
-Objects/memoryobject.c	-	memory_as_mapping	variable	static PyMappingMethods memory_as_mapping
-Objects/memoryobject.c	-	memory_as_sequence	variable	static PySequenceMethods memory_as_sequence
-Objects/memoryobject.c	-	memory_getsetlist	variable	static PyGetSetDef memory_getsetlist[]
-Objects/memoryobject.c	-	memory_methods	variable	static PyMethodDef memory_methods
-Objects/methodobject.c	-	meth_getsets	variable	static PyGetSetDef meth_getsets []
-Objects/methodobject.c	-	meth_members	variable	static PyMemberDef meth_members[]
-Objects/methodobject.c	-	meth_methods	variable	static PyMethodDef meth_methods
-Objects/typeobject.c	-	method_cache	variable	static struct method_cache_entry method_cache[1 << MCACHE_SIZE_EXP]
-Modules/_operator.c	-	methodcaller_methods	variable	static PyMethodDef methodcaller_methods
-Modules/_operator.c	-	methodcaller_type	variable	static PyTypeObject methodcaller_type
-Objects/classobject.c	-	method_getset	variable	static PyGetSetDef method_getset[]
-Objects/descrobject.c	-	method_getset	variable	static PyGetSetDef method_getset[]
-Objects/classobject.c	-	method_memberlist	variable	static PyMemberDef method_memberlist[]
-Objects/classobject.c	-	method_methods	variable	static PyMethodDef method_methods
-Python/codecs.c	_PyCodecRegistry_Init	methods	variable	static struct { char *name; PyMethodDef def; } methods[]
-Python/frozen.c	-	M___hello__	variable	static unsigned char M___hello__[]
-Python/Python-ast.c	-	Mod_singleton	variable	static PyObject *Mod_singleton
-Python/Python-ast.c	-	mod_type	variable	static PyTypeObject *mod_type
-Python/Python-ast.c	-	Mod_type	variable	static PyTypeObject *Mod_type
-Modules/faulthandler.c	-	module_def	variable	static struct PyModuleDef module_def
-Modules/_tracemalloc.c	-	module_def	variable	static struct PyModuleDef module_def
-Python/Python-ast.c	-	Module_fields	variable	static const char *Module_fields[]
-Modules/_collectionsmodule.c	-	module_functions	variable	static struct PyMethodDef module_functions[]
-Modules/_abc.c	-	module_functions	variable	static struct PyMethodDef module_functions[]
-Objects/moduleobject.c	-	module_members	variable	static PyMemberDef module_members[]
-Objects/moduleobject.c	-	module_methods	variable	static PyMethodDef module_methods
-Modules/_functoolsmodule.c	-	module_methods	variable	static PyMethodDef module_methods
-Modules/itertoolsmodule.c	-	module_methods	variable	static PyMethodDef module_methods
-Modules/_io/_iomodule.c	-	module_methods	variable	static PyMethodDef module_methods
-Modules/faulthandler.c	-	module_methods	variable	static PyMethodDef module_methods
-Modules/_tracemalloc.c	-	module_methods	variable	static PyMethodDef module_methods
-Python/Python-ast.c	-	Module_type	variable	static PyTypeObject *Module_type
-Python/Python-ast.c	-	Mult_singleton	variable	static PyObject *Mult_singleton
-Python/Python-ast.c	-	Mult_type	variable	static PyTypeObject *Mult_type
-Objects/funcobject.c	PyFunction_NewWithQualName	__name__	variable	static PyObject *__name__
-Python/compile.c	compiler_lambda	name	variable	static identifier name
-Python/compile.c	compiler_genexp	name	variable	static identifier name
-Python/compile.c	compiler_listcomp	name	variable	static identifier name
-Python/compile.c	compiler_setcomp	name	variable	static identifier name
-Python/compile.c	compiler_dictcomp	name	variable	static identifier name
-Python/Python-ast.c	-	NamedExpr_fields	variable	static const char *NamedExpr_fields[]
-Python/Python-ast.c	-	NamedExpr_type	variable	static PyTypeObject *NamedExpr_type
-Python/Python-ast.c	-	Name_fields	variable	static const char *Name_fields[]
-Objects/typeobject.c	-	name_op	variable	static _Py_Identifier name_op[]
-Objects/namespaceobject.c	-	namespace_members	variable	static PyMemberDef namespace_members[]
-Objects/namespaceobject.c	-	namespace_methods	variable	static PyMethodDef namespace_methods
-Python/Python-ast.c	-	Name_type	variable	static PyTypeObject *Name_type
-Objects/obmalloc.c	-	narenas_currently_allocated	variable	static size_t narenas_currently_allocated
-Objects/obmalloc.c	-	narenas_highwater	variable	static size_t narenas_highwater
-Python/sysmodule.c	sys_displayhook	newline	variable	static PyObject *newline
-Objects/typeobject.c	-	next_version_tag	variable	static unsigned int next_version_tag
-Objects/obmalloc.c	-	nfp2lasta	variable	static struct arena_object* nfp2lasta[MAX_POOLS_IN_ARENA + 1]
-Python/dynload_shlib.c	-	nhandles	variable	static int nhandles
-Objects/object.c	-	none_as_number	variable	static PyNumberMethods none_as_number
-Python/Python-ast.c	-	Nonlocal_fields	variable	static const char *Nonlocal_fields[]
-Python/Python-ast.c	-	Nonlocal_type	variable	static PyTypeObject *Nonlocal_type
-Python/Python-ast.c	-	NotEq_singleton	variable	static PyObject *NotEq_singleton
-Python/Python-ast.c	-	NotEq_type	variable	static PyTypeObject *NotEq_type
-Objects/object.c	-	notimplemented_methods	variable	static PyMethodDef notimplemented_methods
-Python/Python-ast.c	-	NotIn_singleton	variable	static PyObject *NotIn_singleton
-Python/Python-ast.c	-	NotIn_type	variable	static PyTypeObject *NotIn_type
-Python/Python-ast.c	-	Not_singleton	variable	static PyObject *Not_singleton
-Python/Python-ast.c	-	Not_type	variable	static PyTypeObject *Not_type
-Objects/obmalloc.c	-	ntimes_arena_allocated	variable	static size_t ntimes_arena_allocated
-Objects/bytesobject.c	-	nullstring	variable	static PyBytesObject *nullstring
-Objects/codeobject.c	PyCode_NewEmpty	nulltuple	variable	static PyObject *nulltuple
-Objects/floatobject.c	-	numfree	variable	static int numfree
-Objects/frameobject.c	-	numfree	variable	static int numfree
-Objects/listobject.c	-	numfree	variable	static int numfree
-Objects/dictobject.c	-	numfree	variable	static int numfree
-Objects/methodobject.c	-	numfree	variable	static int numfree
-Objects/tupleobject.c	-	numfree	variable	static int numfree[PyTuple_MAXSAVESIZE]
-Objects/classobject.c	-	numfree	variable	static int numfree
-Modules/_collectionsmodule.c	-	numfreeblocks	variable	static Py_ssize_t numfreeblocks
-Objects/dictobject.c	-	numfreekeys	variable	static int numfreekeys
-Objects/typeobject.c	-	object_getsets	variable	static PyGetSetDef object_getsets[]
-Objects/typeobject.c	-	object_methods	variable	static PyMethodDef object_methods
-Objects/typeobject.c	object___reduce_ex___impl	objreduce	variable	static PyObject *objreduce
-Objects/odictobject.c	-	odict_as_mapping	variable	static PyMappingMethods odict_as_mapping
-Objects/odictobject.c	-	odict_getset	variable	static PyGetSetDef odict_getset[]
-Objects/odictobject.c	-	odictitems_methods	variable	static PyMethodDef odictitems_methods
-Objects/odictobject.c	-	odictiter_methods	variable	static PyMethodDef odictiter_methods
-Objects/odictobject.c	-	odictkeys_methods	variable	static PyMethodDef odictkeys_methods
-Objects/odictobject.c	-	odict_methods	variable	static PyMethodDef odict_methods
-Objects/odictobject.c	-	odictvalues_methods	variable	static PyMethodDef odictvalues_methods
-Modules/faulthandler.c	-	old_stack	variable	static stack_t old_stack
-Modules/_operator.c	-	operator_methods	variable	static PyMethodDef operator_methods
-Modules/_operator.c	-	operatormodule	variable	static struct PyModuleDef operatormodule
-Python/Python-ast.c	-	operator_type	variable	static PyTypeObject *operator_type
-Objects/typeobject.c	slot_nb_add	op_id	variable	_Py_static_string(op_id, OPSTR)
-Objects/typeobject.c	slot_nb_subtract	op_id	variable	_Py_static_string(op_id, OPSTR)
-Objects/typeobject.c	slot_nb_multiply	op_id	variable	_Py_static_string(op_id, OPSTR)
-Objects/typeobject.c	slot_nb_matrix_multiply	op_id	variable	_Py_static_string(op_id, OPSTR)
-Objects/typeobject.c	slot_nb_remainder	op_id	variable	_Py_static_string(op_id, OPSTR)
-Objects/typeobject.c	slot_nb_divmod	op_id	variable	_Py_static_string(op_id, OPSTR)
-Objects/typeobject.c	slot_nb_power_binary	op_id	variable	_Py_static_string(op_id, OPSTR)
-Objects/typeobject.c	slot_nb_lshift	op_id	variable	_Py_static_string(op_id, OPSTR)
-Objects/typeobject.c	slot_nb_rshift	op_id	variable	_Py_static_string(op_id, OPSTR)
-Objects/typeobject.c	slot_nb_and	op_id	variable	_Py_static_string(op_id, OPSTR)
-Objects/typeobject.c	slot_nb_xor	op_id	variable	_Py_static_string(op_id, OPSTR)
-Objects/typeobject.c	slot_nb_or	op_id	variable	_Py_static_string(op_id, OPSTR)
-Objects/typeobject.c	slot_nb_floor_divide	op_id	variable	_Py_static_string(op_id, OPSTR)
-Objects/typeobject.c	slot_nb_true_divide	op_id	variable	_Py_static_string(op_id, OPSTR)
-Python/getopt.c	-	opt_ptr	variable	static const wchar_t *opt_ptr
-Python/initconfig.c	-	orig_argv	variable	static PyWideStringList orig_argv
-Python/Python-ast.c	-	Or_singleton	variable	static PyObject *Or_singleton
-Python/Python-ast.c	-	Or_type	variable	static PyTypeObject *Or_type
-Objects/exceptions.c	-	OSError_getset	variable	static PyGetSetDef OSError_getset[]
-Objects/exceptions.c	-	OSError_members	variable	static PyMemberDef OSError_members[]
-Objects/exceptions.c	-	OSError_methods	variable	static PyMethodDef OSError_methods
-Python/dtoa.c	-	p5s	variable	static Bigint *p5s
-Python/Python-ast.c	-	Param_singleton	variable	static PyObject *Param_singleton
-Python/Python-ast.c	-	Param_type	variable	static PyTypeObject *Param_type
-Python/bltinmodule.c	builtin_print	_parser	variable	static struct _PyArg_Parser _parser
-Python/clinic/_warnings.c.h	warnings_warn	_parser	variable	static _PyArg_Parser _parser
-Python/clinic/bltinmodule.c.h	builtin_compile	_parser	variable	static _PyArg_Parser _parser
-Python/clinic/bltinmodule.c.h	builtin_round	_parser	variable	static _PyArg_Parser _parser
-Python/clinic/bltinmodule.c.h	builtin_sum	_parser	variable	static _PyArg_Parser _parser
-Python/clinic/import.c.h	_imp_source_hash	_parser	variable	static _PyArg_Parser _parser
-Python/clinic/sysmodule.c.h	sys_addaudithook	_parser	variable	static _PyArg_Parser _parser
-Python/clinic/sysmodule.c.h	sys_set_coroutine_origin_tracking_depth	_parser	variable	static _PyArg_Parser _parser
-Python/clinic/traceback.c.h	tb_new	_parser	variable	static _PyArg_Parser _parser
-Objects/clinic/bytearrayobject.c.h	bytearray_translate	_parser	variable	static _PyArg_Parser _parser
-Objects/clinic/bytearrayobject.c.h	bytearray_split	_parser	variable	static _PyArg_Parser _parser
-Objects/clinic/bytearrayobject.c.h	bytearray_rsplit	_parser	variable	static _PyArg_Parser _parser
-Objects/clinic/bytearrayobject.c.h	bytearray_decode	_parser	variable	static _PyArg_Parser _parser
-Objects/clinic/bytearrayobject.c.h	bytearray_splitlines	_parser	variable	static _PyArg_Parser _parser
-Objects/clinic/bytearrayobject.c.h	bytearray_hex	_parser	variable	static _PyArg_Parser _parser
-Objects/clinic/bytesobject.c.h	bytes_split	_parser	variable	static _PyArg_Parser _parser
-Objects/clinic/bytesobject.c.h	bytes_rsplit	_parser	variable	static _PyArg_Parser _parser
-Objects/clinic/bytesobject.c.h	bytes_translate	_parser	variable	static _PyArg_Parser _parser
-Objects/clinic/bytesobject.c.h	bytes_decode	_parser	variable	static _PyArg_Parser _parser
-Objects/clinic/bytesobject.c.h	bytes_splitlines	_parser	variable	static _PyArg_Parser _parser
-Objects/clinic/bytesobject.c.h	bytes_hex	_parser	variable	static _PyArg_Parser _parser
-Objects/clinic/codeobject.c.h	code_replace	_parser	variable	static _PyArg_Parser _parser
-Objects/clinic/complexobject.c.h	complex_new	_parser	variable	static _PyArg_Parser _parser
-Objects/clinic/descrobject.c.h	mappingproxy_new	_parser	variable	static _PyArg_Parser _parser
-Objects/clinic/descrobject.c.h	property_init	_parser	variable	static _PyArg_Parser _parser
-Objects/clinic/enumobject.c.h	enum_new	_parser	variable	static _PyArg_Parser _parser
-Objects/clinic/funcobject.c.h	func_new	_parser	variable	static _PyArg_Parser _parser
-Objects/clinic/listobject.c.h	list_sort	_parser	variable	static _PyArg_Parser _parser
-Objects/clinic/longobject.c.h	long_new	_parser	variable	static _PyArg_Parser _parser
-Objects/clinic/longobject.c.h	int_to_bytes	_parser	variable	static _PyArg_Parser _parser
-Objects/clinic/longobject.c.h	int_from_bytes	_parser	variable	static _PyArg_Parser _parser
-Objects/clinic/memoryobject.c.h	memoryview_hex	_parser	variable	static _PyArg_Parser _parser
-Objects/clinic/moduleobject.c.h	module___init__	_parser	variable	static _PyArg_Parser _parser
-Objects/clinic/odictobject.c.h	OrderedDict_fromkeys	_parser	variable	static _PyArg_Parser _parser
-Objects/clinic/odictobject.c.h	OrderedDict_setdefault	_parser	variable	static _PyArg_Parser _parser
-Objects/clinic/odictobject.c.h	OrderedDict_popitem	_parser	variable	static _PyArg_Parser _parser
-Objects/clinic/odictobject.c.h	OrderedDict_move_to_end	_parser	variable	static _PyArg_Parser _parser
-Objects/clinic/structseq.c.h	structseq_new	_parser	variable	static _PyArg_Parser _parser
-Objects/clinic/unicodeobject.c.h	unicode_encode	_parser	variable	static _PyArg_Parser _parser
-Objects/clinic/unicodeobject.c.h	unicode_expandtabs	_parser	variable	static _PyArg_Parser _parser
-Objects/clinic/unicodeobject.c.h	unicode_split	_parser	variable	static _PyArg_Parser _parser
-Objects/clinic/unicodeobject.c.h	unicode_rsplit	_parser	variable	static _PyArg_Parser _parser
-Objects/clinic/unicodeobject.c.h	unicode_splitlines	_parser	variable	static _PyArg_Parser _parser
-Objects/stringlib/clinic/transmogrify.h.h	stringlib_expandtabs	_parser	variable	static _PyArg_Parser _parser
-Modules/_blake2/clinic/blake2b_impl.c.h	py_blake2b_new	_parser	variable	static _PyArg_Parser _parser
-Modules/_blake2/clinic/blake2s_impl.c.h	py_blake2s_new	_parser	variable	static _PyArg_Parser _parser
-Modules/_io/clinic/_iomodule.c.h	_io_open	_parser	variable	static _PyArg_Parser _parser
-Modules/_io/clinic/_iomodule.c.h	_io_open_code	_parser	variable	static _PyArg_Parser _parser
-Modules/_io/clinic/bufferedio.c.h	_io_BufferedReader___init__	_parser	variable	static _PyArg_Parser _parser
-Modules/_io/clinic/bufferedio.c.h	_io_BufferedWriter___init__	_parser	variable	static _PyArg_Parser _parser
-Modules/_io/clinic/bufferedio.c.h	_io_BufferedRandom___init__	_parser	variable	static _PyArg_Parser _parser
-Modules/_io/clinic/bytesio.c.h	_io_BytesIO___init__	_parser	variable	static _PyArg_Parser _parser
-Modules/_io/clinic/fileio.c.h	_io_FileIO___init__	_parser	variable	static _PyArg_Parser _parser
-Modules/_io/clinic/stringio.c.h	_io_StringIO___init__	_parser	variable	static _PyArg_Parser _parser
-Modules/_io/clinic/textio.c.h	_io_IncrementalNewlineDecoder___init__	_parser	variable	static _PyArg_Parser _parser
-Modules/_io/clinic/textio.c.h	_io_IncrementalNewlineDecoder_decode	_parser	variable	static _PyArg_Parser _parser
-Modules/_io/clinic/textio.c.h	_io_TextIOWrapper___init__	_parser	variable	static _PyArg_Parser _parser
-Modules/_io/clinic/textio.c.h	_io_TextIOWrapper_reconfigure	_parser	variable	static _PyArg_Parser _parser
-Modules/_io/clinic/winconsoleio.c.h	_io__WindowsConsoleIO___init__	_parser	variable	static _PyArg_Parser _parser
-Modules/_multiprocessing/clinic/posixshmem.c.h	_posixshmem_shm_open	_parser	variable	static _PyArg_Parser _parser
-Modules/_multiprocessing/clinic/posixshmem.c.h	_posixshmem_shm_unlink	_parser	variable	static _PyArg_Parser _parser
-Modules/cjkcodecs/clinic/multibytecodec.c.h	_multibytecodec_MultibyteCodec_encode	_parser	variable	static _PyArg_Parser _parser
-Modules/cjkcodecs/clinic/multibytecodec.c.h	_multibytecodec_MultibyteCodec_decode	_parser	variable	static _PyArg_Parser _parser
-Modules/cjkcodecs/clinic/multibytecodec.c.h	_multibytecodec_MultibyteIncrementalEncoder_encode	_parser	variable	static _PyArg_Parser _parser
-Modules/cjkcodecs/clinic/multibytecodec.c.h	_multibytecodec_MultibyteIncrementalDecoder_decode	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_asynciomodule.c.h	_asyncio_Future___init__	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_asynciomodule.c.h	_asyncio_Future_add_done_callback	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_asynciomodule.c.h	_asyncio_Task___init__	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_asynciomodule.c.h	_asyncio_Task_current_task	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_asynciomodule.c.h	_asyncio_Task_all_tasks	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_asynciomodule.c.h	_asyncio_Task_get_stack	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_asynciomodule.c.h	_asyncio_Task_print_stack	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_asynciomodule.c.h	_asyncio__register_task	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_asynciomodule.c.h	_asyncio__unregister_task	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_asynciomodule.c.h	_asyncio__enter_task	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_asynciomodule.c.h	_asyncio__leave_task	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_bz2module.c.h	_bz2_BZ2Decompressor_decompress	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_codecsmodule.c.h	_codecs_encode	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_codecsmodule.c.h	_codecs_decode	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_cursesmodule.c.h	_curses_setupterm	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_datetimemodule.c.h	datetime_datetime_now	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_elementtree.c.h	_elementtree_Element_find	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_elementtree.c.h	_elementtree_Element_findtext	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_elementtree.c.h	_elementtree_Element_findall	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_elementtree.c.h	_elementtree_Element_iterfind	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_elementtree.c.h	_elementtree_Element_get	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_elementtree.c.h	_elementtree_Element_iter	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_elementtree.c.h	_elementtree_Element_getiterator	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_elementtree.c.h	_elementtree_TreeBuilder___init__	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_elementtree.c.h	_elementtree_XMLParser___init__	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_hashopenssl.c.h	EVP_new	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_hashopenssl.c.h	pbkdf2_hmac	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_hashopenssl.c.h	_hashlib_scrypt	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_hashopenssl.c.h	_hashlib_hmac_digest	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_lzmamodule.c.h	_lzma_LZMADecompressor_decompress	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_lzmamodule.c.h	_lzma_LZMADecompressor___init__	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_opcode.c.h	_opcode_stack_effect	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_pickle.c.h	_pickle_Pickler___init__	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_pickle.c.h	_pickle_Unpickler___init__	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_pickle.c.h	_pickle_dump	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_pickle.c.h	_pickle_dumps	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_pickle.c.h	_pickle_load	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_pickle.c.h	_pickle_loads	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_queuemodule.c.h	_queue_SimpleQueue_put	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_queuemodule.c.h	_queue_SimpleQueue_put_nowait	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_queuemodule.c.h	_queue_SimpleQueue_get	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_sre.c.h	_sre_SRE_Pattern_match	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_sre.c.h	_sre_SRE_Pattern_fullmatch	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_sre.c.h	_sre_SRE_Pattern_search	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_sre.c.h	_sre_SRE_Pattern_findall	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_sre.c.h	_sre_SRE_Pattern_finditer	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_sre.c.h	_sre_SRE_Pattern_scanner	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_sre.c.h	_sre_SRE_Pattern_split	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_sre.c.h	_sre_SRE_Pattern_sub	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_sre.c.h	_sre_SRE_Pattern_subn	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_sre.c.h	_sre_compile	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_sre.c.h	_sre_SRE_Match_expand	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_sre.c.h	_sre_SRE_Match_groups	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_sre.c.h	_sre_SRE_Match_groupdict	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_ssl.c.h	_ssl__SSLSocket_get_channel_binding	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_ssl.c.h	_ssl__SSLContext_load_cert_chain	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_ssl.c.h	_ssl__SSLContext_load_verify_locations	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_ssl.c.h	_ssl__SSLContext__wrap_socket	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_ssl.c.h	_ssl__SSLContext__wrap_bio	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_ssl.c.h	_ssl__SSLContext_get_ca_certs	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_ssl.c.h	_ssl_txt2obj	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_ssl.c.h	_ssl_enum_certificates	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_ssl.c.h	_ssl_enum_crls	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_struct.c.h	Struct___init__	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_struct.c.h	Struct_unpack_from	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_struct.c.h	unpack_from	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_winapi.c.h	_winapi_ConnectNamedPipe	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_winapi.c.h	_winapi_ReadFile	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_winapi.c.h	_winapi_WriteFile	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/_winapi.c.h	_winapi_GetFileType	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/binascii.c.h	binascii_b2a_uu	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/binascii.c.h	binascii_b2a_base64	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/binascii.c.h	binascii_b2a_hex	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/binascii.c.h	binascii_hexlify	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/binascii.c.h	binascii_a2b_qp	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/binascii.c.h	binascii_b2a_qp	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/cmathmodule.c.h	cmath_isclose	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/gcmodule.c.h	gc_collect	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/gcmodule.c.h	gc_get_objects	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/grpmodule.c.h	grp_getgrgid	_parser	variable	static _PyArg_Parser _parser
-Modules/clinic/grpmodule.c.h	grp_getgrnam	_parser	variable	static _PyArg_Parser _parser
-Modules/_functoolsmodule.c	-	partial_getsetlist	variable	static PyGetSetDef partial_getsetlist[]
-Modules/_functoolsmodule.c	-	partial_memberlist	variable	static PyMemberDef partial_memberlist[]
-Modules/_functoolsmodule.c	-	partial_methods	variable	static PyMethodDef partial_methods
-Modules/_functoolsmodule.c	-	partial_type	variable	static PyTypeObject partial_type
-Python/Python-ast.c	-	Pass_type	variable	static PyTypeObject *Pass_type
-Modules/_sre.c	-	pattern_getset	variable	static PyGetSetDef pattern_getset[]
-Modules/_sre.c	-	pattern_members	variable	static PyMemberDef pattern_members[]
-Modules/_sre.c	-	pattern_methods	variable	static PyMethodDef pattern_methods
-Modules/_sre.c	-	Pattern_Type	variable	static PyTypeObject Pattern_Type
-Modules/itertoolsmodule.c	-	permuations_methods	variable	static PyMethodDef permuations_methods
-Modules/itertoolsmodule.c	-	permutations_type	variable	static PyTypeObject permutations_type
-Objects/picklebufobject.c	-	picklebuf_as_buffer	variable	static PyBufferProcs picklebuf_as_buffer
-Objects/picklebufobject.c	-	picklebuf_methods	variable	static PyMethodDef picklebuf_methods
-Python/dtoa.c	-	pmem_next	variable	static double *pmem_next
-Objects/typeobject.c	resolve_slotdups	pname	variable	static PyObject *pname
-Modules/posixmodule.c	-	posix_constants_confstr	variable	static struct constdef posix_constants_confstr[]
-Modules/posixmodule.c	-	posix_constants_pathconf	variable	static struct constdef  posix_constants_pathconf[]
-Modules/posixmodule.c	-	posix_constants_sysconf	variable	static struct constdef posix_constants_sysconf[]
-Modules/posixmodule.c	-	posix_methods	variable	static PyMethodDef posix_methods
-Modules/posixmodule.c	-	posixmodule	variable	static struct PyModuleDef posixmodule
-Modules/posixmodule.c	-	posix_putenv_garbage	variable	static PyObject *posix_putenv_garbage
-Python/Python-ast.c	-	Pow_singleton	variable	static PyObject *Pow_singleton
-Python/Python-ast.c	-	Pow_type	variable	static PyTypeObject *Pow_type
-Python/sysmodule.c	-	_preinit_warnoptions	variable	static _Py_PreInitEntry _preinit_warnoptions
-Python/sysmodule.c	-	_preinit_xoptions	variable	static _Py_PreInitEntry _preinit_xoptions
-Objects/exceptions.c	_check_for_legacy_statements	print_prefix	variable	static PyObject *print_prefix
-Python/dtoa.c	-	private_mem	variable	static double private_mem[PRIVATE_mem]
-Modules/itertoolsmodule.c	-	product_methods	variable	static PyMethodDef product_methods
-Modules/itertoolsmodule.c	-	product_type	variable	static PyTypeObject product_type
-Objects/descrobject.c	-	property_getsetlist	variable	static PyGetSetDef property_getsetlist[]
-Objects/descrobject.c	-	property_members	variable	static PyMemberDef property_members[]
-Objects/descrobject.c	-	property_methods	variable	static PyMethodDef property_methods
-Objects/weakrefobject.c	-	proxy_as_mapping	variable	static PyMappingMethods proxy_as_mapping
-Objects/weakrefobject.c	-	proxy_as_number	variable	static PyNumberMethods proxy_as_number
-Objects/weakrefobject.c	-	proxy_as_sequence	variable	static PySequenceMethods proxy_as_sequence
-Objects/weakrefobject.c	-	proxy_methods	variable	static PyMethodDef proxy_methods
-Objects/typeobject.c	resolve_slotdups	ptrs	variable	static slotdef *ptrs[MAX_EQUIV]
-Modules/pwdmodule.c	-	pwd_methods	variable	static PyMethodDef pwd_methods
-Modules/pwdmodule.c	-	pwdmodule	variable	static struct PyModuleDef pwdmodule
-Objects/obmalloc.c	-	_Py_AllocatedBlocks	variable	static Py_ssize_t _Py_AllocatedBlocks
-Objects/genobject.c	-	_PyAsyncGenASend_Type	variable	PyTypeObject _PyAsyncGenASend_Type
-Objects/genobject.c	-	_PyAsyncGenAThrow_Type	variable	PyTypeObject _PyAsyncGenAThrow_Type
-Objects/genobject.c	-	PyAsyncGen_Type	variable	PyTypeObject PyAsyncGen_Type
-Objects/genobject.c	-	_PyAsyncGenWrappedValue_Type	variable	PyTypeObject _PyAsyncGenWrappedValue_Type
-Objects/typeobject.c	-	PyBaseObject_Type	variable	PyTypeObject PyBaseObject_Type
-Modules/_blake2/blake2b_impl.c	-	PyBlake2_BLAKE2bType	variable	PyTypeObject PyBlake2_BLAKE2bType
-Modules/_blake2/blake2s_impl.c	-	PyBlake2_BLAKE2sType	variable	PyTypeObject PyBlake2_BLAKE2sType
-Objects/boolobject.c	-	PyBool_Type	variable	PyTypeObject PyBool_Type
-Modules/_io/bufferedio.c	-	PyBufferedIOBase_Type	variable	PyTypeObject PyBufferedIOBase_Type
-Modules/_io/bufferedio.c	-	PyBufferedRandom_Type	variable	PyTypeObject PyBufferedRandom_Type
-Modules/_io/bufferedio.c	-	PyBufferedReader_Type	variable	PyTypeObject PyBufferedReader_Type
-Modules/_io/bufferedio.c	-	PyBufferedRWPair_Type	variable	PyTypeObject PyBufferedRWPair_Type
-Modules/_io/bufferedio.c	-	PyBufferedWriter_Type	variable	PyTypeObject PyBufferedWriter_Type
-Objects/bytearrayobject.c	-	_PyByteArray_empty_string	variable	char _PyByteArray_empty_string[]
-Objects/bytearrayobject.c	-	PyByteArrayIter_Type	variable	PyTypeObject PyByteArrayIter_Type
-Objects/bytearrayobject.c	-	PyByteArray_Type	variable	PyTypeObject PyByteArray_Type
-Modules/_io/bytesio.c	-	_PyBytesIOBuffer_Type	variable	PyTypeObject _PyBytesIOBuffer_Type
-Modules/_io/bytesio.c	-	PyBytesIO_Type	variable	PyTypeObject PyBytesIO_Type
-Objects/bytesobject.c	-	PyBytesIter_Type	variable	PyTypeObject PyBytesIter_Type
-Objects/bytesobject.c	-	PyBytes_Type	variable	PyTypeObject PyBytes_Type
-Python/initconfig.c	-	Py_BytesWarningFlag	variable	int Py_BytesWarningFlag
-Objects/iterobject.c	-	PyCallIter_Type	variable	PyTypeObject PyCallIter_Type
-Objects/capsule.c	-	PyCapsule_Type	variable	PyTypeObject PyCapsule_Type
-Objects/cellobject.c	-	PyCell_Type	variable	PyTypeObject PyCell_Type
-Objects/methodobject.c	-	PyCFunction_Type	variable	PyTypeObject PyCFunction_Type
-Python/ceval.c	-	_Py_CheckRecursionLimit	variable	int _Py_CheckRecursionLimit
-Objects/descrobject.c	-	PyClassMethodDescr_Type	variable	PyTypeObject PyClassMethodDescr_Type
-Objects/funcobject.c	-	PyClassMethod_Type	variable	PyTypeObject PyClassMethod_Type
-Objects/codeobject.c	-	PyCode_Type	variable	PyTypeObject PyCode_Type
-Objects/complexobject.c	-	PyComplex_Type	variable	PyTypeObject PyComplex_Type
-Python/context.c	-	PyContext_as_mapping	variable	static PyMappingMethods PyContext_as_mapping
-Python/context.c	-	PyContext_as_sequence	variable	static PySequenceMethods PyContext_as_sequence
-Python/context.c	-	PyContext_methods	variable	static PyMethodDef PyContext_methods
-Python/context.c	-	PyContextTokenMissing_Type	variable	PyTypeObject PyContextTokenMissing_Type
-Python/context.c	-	PyContextToken_Type	variable	PyTypeObject PyContextToken_Type
-Python/context.c	-	PyContextTokenType_getsetlist	variable	static PyGetSetDef PyContextTokenType_getsetlist[]
-Python/context.c	-	PyContext_Type	variable	PyTypeObject PyContext_Type
-Python/context.c	-	PyContextVar_members	variable	static PyMemberDef PyContextVar_members[]
-Python/context.c	-	PyContextVar_methods	variable	static PyMethodDef PyContextVar_methods
-Python/context.c	-	PyContextVar_Type	variable	PyTypeObject PyContextVar_Type
-Objects/genobject.c	-	PyCoro_Type	variable	PyTypeObject PyCoro_Type
-Objects/genobject.c	-	_PyCoroWrapper_Type	variable	PyTypeObject _PyCoroWrapper_Type
-Python/initconfig.c	-	Py_DebugFlag	variable	int Py_DebugFlag
-Objects/dictobject.c	-	pydict_global_version	variable	static uint64_t pydict_global_version
-Objects/dictobject.c	-	PyDictItems_Type	variable	PyTypeObject PyDictItems_Type
-Objects/dictobject.c	-	PyDictIterItem_Type	variable	PyTypeObject PyDictIterItem_Type
-Objects/dictobject.c	-	PyDictIterKey_Type	variable	PyTypeObject PyDictIterKey_Type
-Objects/dictobject.c	-	PyDictIterValue_Type	variable	PyTypeObject PyDictIterValue_Type
-Objects/dictobject.c	-	PyDictKeys_Type	variable	PyTypeObject PyDictKeys_Type
-Objects/descrobject.c	-	PyDictProxy_Type	variable	PyTypeObject PyDictProxy_Type
-Objects/dictobject.c	-	PyDictRevIterItem_Type	variable	PyTypeObject PyDictRevIterItem_Type
-Objects/dictobject.c	-	PyDictRevIterKey_Type	variable	PyTypeObject PyDictRevIterKey_Type
-Objects/dictobject.c	-	PyDictRevIterValue_Type	variable	PyTypeObject PyDictRevIterValue_Type
-Objects/dictobject.c	-	PyDict_Type	variable	PyTypeObject PyDict_Type
-Objects/dictobject.c	-	PyDictValues_Type	variable	PyTypeObject PyDictValues_Type
-Python/initconfig.c	-	Py_DontWriteBytecodeFlag	variable	int Py_DontWriteBytecodeFlag
-Objects/sliceobject.c	-	_Py_EllipsisObject	variable	PyObject _Py_EllipsisObject
-Objects/sliceobject.c	-	PyEllipsis_Type	variable	PyTypeObject PyEllipsis_Type
-Objects/enumobject.c	-	PyEnum_Type	variable	PyTypeObject PyEnum_Type
-Objects/exceptions.c	-	_PyExc_ArithmeticError	variable	static PyTypeObject _PyExc_ArithmeticError
-Objects/exceptions.c	-	PyExc_ArithmeticError	variable	static PyTypeObject PyExc_ArithmeticError
-Objects/exceptions.c	-	_PyExc_AssertionError	variable	static PyTypeObject _PyExc_AssertionError
-Objects/exceptions.c	-	PyExc_AssertionError	variable	static PyTypeObject PyExc_AssertionError
-Objects/exceptions.c	-	_PyExc_AttributeError	variable	static PyTypeObject _PyExc_AttributeError
-Objects/exceptions.c	-	PyExc_AttributeError	variable	static PyTypeObject PyExc_AttributeError
-Objects/exceptions.c	-	_PyExc_BaseException	variable	static PyTypeObject _PyExc_BaseException
-Objects/exceptions.c	-	PyExc_BaseException	variable	static PyTypeObject PyExc_BaseException
-Objects/exceptions.c	-	_PyExc_BlockingIOError	variable	static PyTypeObject _PyExc_BlockingIOError
-Objects/exceptions.c	-	PyExc_BlockingIOError	variable	static PyTypeObject PyExc_BlockingIOError
-Objects/exceptions.c	-	_PyExc_BrokenPipeError	variable	static PyTypeObject _PyExc_BrokenPipeError
-Objects/exceptions.c	-	PyExc_BrokenPipeError	variable	static PyTypeObject PyExc_BrokenPipeError
-Objects/exceptions.c	-	_PyExc_BufferError	variable	static PyTypeObject _PyExc_BufferError
-Objects/exceptions.c	-	PyExc_BufferError	variable	static PyTypeObject PyExc_BufferError
-Objects/exceptions.c	-	_PyExc_BytesWarning	variable	static PyTypeObject _PyExc_BytesWarning
-Objects/exceptions.c	-	PyExc_BytesWarning	variable	static PyTypeObject PyExc_BytesWarning
-Objects/exceptions.c	-	_PyExc_ChildProcessError	variable	static PyTypeObject _PyExc_ChildProcessError
-Objects/exceptions.c	-	PyExc_ChildProcessError	variable	static PyTypeObject PyExc_ChildProcessError
-Objects/exceptions.c	-	_PyExc_ConnectionAbortedError	variable	static PyTypeObject _PyExc_ConnectionAbortedError
-Objects/exceptions.c	-	PyExc_ConnectionAbortedError	variable	static PyTypeObject PyExc_ConnectionAbortedError
-Objects/exceptions.c	-	_PyExc_ConnectionError	variable	static PyTypeObject _PyExc_ConnectionError
-Objects/exceptions.c	-	PyExc_ConnectionError	variable	static PyTypeObject PyExc_ConnectionError
-Objects/exceptions.c	-	_PyExc_ConnectionRefusedError	variable	static PyTypeObject _PyExc_ConnectionRefusedError
-Objects/exceptions.c	-	PyExc_ConnectionRefusedError	variable	static PyTypeObject PyExc_ConnectionRefusedError
-Objects/exceptions.c	-	_PyExc_ConnectionResetError	variable	static PyTypeObject _PyExc_ConnectionResetError
-Objects/exceptions.c	-	PyExc_ConnectionResetError	variable	static PyTypeObject PyExc_ConnectionResetError
-Objects/exceptions.c	-	_PyExc_DeprecationWarning	variable	static PyTypeObject _PyExc_DeprecationWarning
-Objects/exceptions.c	-	PyExc_DeprecationWarning	variable	static PyTypeObject PyExc_DeprecationWarning
-Objects/exceptions.c	-	PyExc_EnvironmentError	variable	static PyTypeObject PyExc_EnvironmentError
-Objects/exceptions.c	-	_PyExc_EOFError	variable	static PyTypeObject _PyExc_EOFError
-Objects/exceptions.c	-	PyExc_EOFError	variable	static PyTypeObject PyExc_EOFError
-Objects/exceptions.c	-	_PyExc_Exception	variable	static PyTypeObject _PyExc_Exception
-Objects/exceptions.c	-	PyExc_Exception	variable	static PyTypeObject PyExc_Exception
-Objects/exceptions.c	-	_PyExc_FileExistsError	variable	static PyTypeObject _PyExc_FileExistsError
-Objects/exceptions.c	-	PyExc_FileExistsError	variable	static PyTypeObject PyExc_FileExistsError
-Objects/exceptions.c	-	_PyExc_FileNotFoundError	variable	static PyTypeObject _PyExc_FileNotFoundError
-Objects/exceptions.c	-	PyExc_FileNotFoundError	variable	static PyTypeObject PyExc_FileNotFoundError
-Objects/exceptions.c	-	_PyExc_FloatingPointError	variable	static PyTypeObject _PyExc_FloatingPointError
-Objects/exceptions.c	-	PyExc_FloatingPointError	variable	static PyTypeObject PyExc_FloatingPointError
-Objects/exceptions.c	-	_PyExc_FutureWarning	variable	static PyTypeObject _PyExc_FutureWarning
-Objects/exceptions.c	-	PyExc_FutureWarning	variable	static PyTypeObject PyExc_FutureWarning
-Objects/exceptions.c	-	_PyExc_GeneratorExit	variable	static PyTypeObject _PyExc_GeneratorExit
-Objects/exceptions.c	-	PyExc_GeneratorExit	variable	static PyTypeObject PyExc_GeneratorExit
-Objects/exceptions.c	-	_PyExc_ImportError	variable	static PyTypeObject _PyExc_ImportError
-Objects/exceptions.c	-	PyExc_ImportError	variable	static PyTypeObject PyExc_ImportError
-Objects/exceptions.c	-	_PyExc_ImportWarning	variable	static PyTypeObject _PyExc_ImportWarning
-Objects/exceptions.c	-	PyExc_ImportWarning	variable	static PyTypeObject PyExc_ImportWarning
-Objects/exceptions.c	-	_PyExc_IndentationError	variable	static PyTypeObject _PyExc_IndentationError
-Objects/exceptions.c	-	PyExc_IndentationError	variable	static PyTypeObject PyExc_IndentationError
-Objects/exceptions.c	-	_PyExc_IndexError	variable	static PyTypeObject _PyExc_IndexError
-Objects/exceptions.c	-	PyExc_IndexError	variable	static PyTypeObject PyExc_IndexError
-Objects/exceptions.c	-	_PyExc_InterruptedError	variable	static PyTypeObject _PyExc_InterruptedError
-Objects/exceptions.c	-	PyExc_InterruptedError	variable	static PyTypeObject PyExc_InterruptedError
-Objects/exceptions.c	-	PyExc_IOError	variable	static PyTypeObject PyExc_IOError
-Objects/exceptions.c	-	_PyExc_IsADirectoryError	variable	static PyTypeObject _PyExc_IsADirectoryError
-Objects/exceptions.c	-	PyExc_IsADirectoryError	variable	static PyTypeObject PyExc_IsADirectoryError
-Objects/exceptions.c	-	_PyExc_KeyboardInterrupt	variable	static PyTypeObject _PyExc_KeyboardInterrupt
-Objects/exceptions.c	-	PyExc_KeyboardInterrupt	variable	static PyTypeObject PyExc_KeyboardInterrupt
-Objects/exceptions.c	-	_PyExc_KeyError	variable	static PyTypeObject _PyExc_KeyError
-Objects/exceptions.c	-	PyExc_KeyError	variable	static PyTypeObject PyExc_KeyError
-Objects/exceptions.c	-	_PyExc_LookupError	variable	static PyTypeObject _PyExc_LookupError
-Objects/exceptions.c	-	PyExc_LookupError	variable	static PyTypeObject PyExc_LookupError
-Objects/exceptions.c	-	_PyExc_MemoryError	variable	static PyTypeObject _PyExc_MemoryError
-Objects/exceptions.c	-	PyExc_MemoryError	variable	static PyTypeObject PyExc_MemoryError
-Objects/exceptions.c	-	_PyExc_ModuleNotFoundError	variable	static PyTypeObject _PyExc_ModuleNotFoundError
-Objects/exceptions.c	-	PyExc_ModuleNotFoundError	variable	static PyTypeObject PyExc_ModuleNotFoundError
-Objects/exceptions.c	-	_PyExc_NameError	variable	static PyTypeObject _PyExc_NameError
-Objects/exceptions.c	-	PyExc_NameError	variable	static PyTypeObject PyExc_NameError
-Objects/exceptions.c	-	_PyExc_NotADirectoryError	variable	static PyTypeObject _PyExc_NotADirectoryError
-Objects/exceptions.c	-	PyExc_NotADirectoryError	variable	static PyTypeObject PyExc_NotADirectoryError
-Objects/exceptions.c	-	_PyExc_NotImplementedError	variable	static PyTypeObject _PyExc_NotImplementedError
-Objects/exceptions.c	-	PyExc_NotImplementedError	variable	static PyTypeObject PyExc_NotImplementedError
-Objects/exceptions.c	-	_PyExc_OSError	variable	static PyTypeObject _PyExc_OSError
-Objects/exceptions.c	-	PyExc_OSError	variable	static PyTypeObject PyExc_OSError
-Objects/exceptions.c	-	_PyExc_OverflowError	variable	static PyTypeObject _PyExc_OverflowError
-Objects/exceptions.c	-	PyExc_OverflowError	variable	static PyTypeObject PyExc_OverflowError
-Objects/exceptions.c	-	_PyExc_PendingDeprecationWarning	variable	static PyTypeObject _PyExc_PendingDeprecationWarning
-Objects/exceptions.c	-	PyExc_PendingDeprecationWarning	variable	static PyTypeObject PyExc_PendingDeprecationWarning
-Objects/exceptions.c	-	_PyExc_PermissionError	variable	static PyTypeObject _PyExc_PermissionError
-Objects/exceptions.c	-	PyExc_PermissionError	variable	static PyTypeObject PyExc_PermissionError
-Objects/exceptions.c	-	_PyExc_ProcessLookupError	variable	static PyTypeObject _PyExc_ProcessLookupError
-Objects/exceptions.c	-	PyExc_ProcessLookupError	variable	static PyTypeObject PyExc_ProcessLookupError
-Objects/exceptions.c	-	_PyExc_RecursionError	variable	static PyTypeObject _PyExc_RecursionError
-Objects/exceptions.c	-	PyExc_RecursionError	variable	static PyTypeObject PyExc_RecursionError
-Objects/exceptions.c	-	_PyExc_ReferenceError	variable	static PyTypeObject _PyExc_ReferenceError
-Objects/exceptions.c	-	PyExc_ReferenceError	variable	static PyTypeObject PyExc_ReferenceError
-Objects/exceptions.c	-	_PyExc_ResourceWarning	variable	static PyTypeObject _PyExc_ResourceWarning
-Objects/exceptions.c	-	PyExc_ResourceWarning	variable	static PyTypeObject PyExc_ResourceWarning
-Objects/exceptions.c	-	_PyExc_RuntimeError	variable	static PyTypeObject _PyExc_RuntimeError
-Objects/exceptions.c	-	PyExc_RuntimeError	variable	static PyTypeObject PyExc_RuntimeError
-Objects/exceptions.c	-	_PyExc_RuntimeWarning	variable	static PyTypeObject _PyExc_RuntimeWarning
-Objects/exceptions.c	-	PyExc_RuntimeWarning	variable	static PyTypeObject PyExc_RuntimeWarning
-Objects/exceptions.c	-	_PyExc_StopAsyncIteration	variable	static PyTypeObject _PyExc_StopAsyncIteration
-Objects/exceptions.c	-	PyExc_StopAsyncIteration	variable	static PyTypeObject PyExc_StopAsyncIteration
-Objects/exceptions.c	-	_PyExc_StopIteration	variable	static PyTypeObject _PyExc_StopIteration
-Objects/exceptions.c	-	PyExc_StopIteration	variable	static PyTypeObject PyExc_StopIteration
-Objects/exceptions.c	-	_PyExc_SyntaxError	variable	static PyTypeObject _PyExc_SyntaxError
-Objects/exceptions.c	-	PyExc_SyntaxError	variable	static PyTypeObject PyExc_SyntaxError
-Objects/exceptions.c	-	_PyExc_SyntaxWarning	variable	static PyTypeObject _PyExc_SyntaxWarning
-Objects/exceptions.c	-	PyExc_SyntaxWarning	variable	static PyTypeObject PyExc_SyntaxWarning
-Objects/exceptions.c	-	_PyExc_SystemError	variable	static PyTypeObject _PyExc_SystemError
-Objects/exceptions.c	-	PyExc_SystemError	variable	static PyTypeObject PyExc_SystemError
-Objects/exceptions.c	-	_PyExc_SystemExit	variable	static PyTypeObject _PyExc_SystemExit
-Objects/exceptions.c	-	PyExc_SystemExit	variable	static PyTypeObject PyExc_SystemExit
-Objects/exceptions.c	-	_PyExc_TabError	variable	static PyTypeObject _PyExc_TabError
-Objects/exceptions.c	-	PyExc_TabError	variable	static PyTypeObject PyExc_TabError
-Objects/exceptions.c	-	_PyExc_TargetScopeError	variable	static PyTypeObject _PyExc_TargetScopeError
-Objects/exceptions.c	-	PyExc_TargetScopeError	variable	static PyTypeObject PyExc_TargetScopeError
-Objects/exceptions.c	-	_PyExc_TimeoutError	variable	static PyTypeObject _PyExc_TimeoutError
-Objects/exceptions.c	-	PyExc_TimeoutError	variable	static PyTypeObject PyExc_TimeoutError
-Objects/exceptions.c	-	_PyExc_TypeError	variable	static PyTypeObject _PyExc_TypeError
-Objects/exceptions.c	-	PyExc_TypeError	variable	static PyTypeObject PyExc_TypeError
-Objects/exceptions.c	-	_PyExc_UnboundLocalError	variable	static PyTypeObject _PyExc_UnboundLocalError
-Objects/exceptions.c	-	PyExc_UnboundLocalError	variable	static PyTypeObject PyExc_UnboundLocalError
-Objects/exceptions.c	-	_PyExc_UnicodeDecodeError	variable	static PyTypeObject _PyExc_UnicodeDecodeError
-Objects/exceptions.c	-	PyExc_UnicodeDecodeError	variable	static PyTypeObject PyExc_UnicodeDecodeError
-Objects/exceptions.c	-	_PyExc_UnicodeEncodeError	variable	static PyTypeObject _PyExc_UnicodeEncodeError
-Objects/exceptions.c	-	PyExc_UnicodeEncodeError	variable	static PyTypeObject PyExc_UnicodeEncodeError
-Objects/exceptions.c	-	_PyExc_UnicodeError	variable	static PyTypeObject _PyExc_UnicodeError
-Objects/exceptions.c	-	PyExc_UnicodeError	variable	static PyTypeObject PyExc_UnicodeError
-Objects/exceptions.c	-	_PyExc_UnicodeTranslateError	variable	static PyTypeObject _PyExc_UnicodeTranslateError
-Objects/exceptions.c	-	PyExc_UnicodeTranslateError	variable	static PyTypeObject PyExc_UnicodeTranslateError
-Objects/exceptions.c	-	_PyExc_UnicodeWarning	variable	static PyTypeObject _PyExc_UnicodeWarning
-Objects/exceptions.c	-	PyExc_UnicodeWarning	variable	static PyTypeObject PyExc_UnicodeWarning
-Objects/exceptions.c	-	_PyExc_UserWarning	variable	static PyTypeObject _PyExc_UserWarning
-Objects/exceptions.c	-	PyExc_UserWarning	variable	static PyTypeObject PyExc_UserWarning
-Objects/exceptions.c	-	_PyExc_ValueError	variable	static PyTypeObject _PyExc_ValueError
-Objects/exceptions.c	-	PyExc_ValueError	variable	static PyTypeObject PyExc_ValueError
-Objects/exceptions.c	-	_PyExc_Warning	variable	static PyTypeObject _PyExc_Warning
-Objects/exceptions.c	-	PyExc_Warning	variable	static PyTypeObject PyExc_Warning
-Objects/exceptions.c	-	_PyExc_ZeroDivisionError	variable	static PyTypeObject _PyExc_ZeroDivisionError
-Objects/exceptions.c	-	PyExc_ZeroDivisionError	variable	static PyTypeObject PyExc_ZeroDivisionError
-Objects/boolobject.c	-	_Py_FalseStruct	variable	static struct _longobject _Py_FalseStruct
-Objects/tupleobject.c	-	_Py_fast_tuple_allocs	variable	Py_ssize_t _Py_fast_tuple_allocs
-Objects/stringlib/unicode_format.h	-	PyFieldNameIter_Type	variable	static PyTypeObject PyFieldNameIter_Type
-Modules/_io/fileio.c	-	PyFileIO_Type	variable	PyTypeObject PyFileIO_Type
-Python/preconfig.c	-	Py_FileSystemDefaultEncodeErrors	variable	const char *Py_FileSystemDefaultEncodeErrors
-Python/preconfig.c	-	Py_FileSystemDefaultEncoding	variable	const char * Py_FileSystemDefaultEncoding
-Python/bltinmodule.c	-	PyFilter_Type	variable	PyTypeObject PyFilter_Type
-Objects/floatobject.c	-	PyFloat_Type	variable	PyTypeObject PyFloat_Type
-Objects/stringlib/unicode_format.h	-	PyFormatterIter_Type	variable	static PyTypeObject PyFormatterIter_Type
-Objects/frameobject.c	-	PyFrame_Type	variable	PyTypeObject PyFrame_Type
-Python/initconfig.c	-	Py_FrozenFlag	variable	int Py_FrozenFlag
-Objects/setobject.c	-	PyFrozenSet_Type	variable	PyTypeObject PyFrozenSet_Type
-Objects/funcobject.c	-	PyFunction_Type	variable	PyTypeObject PyFunction_Type
-Objects/genobject.c	-	PyGen_Type	variable	PyTypeObject PyGen_Type
-Objects/descrobject.c	-	PyGetSetDescr_Type	variable	PyTypeObject PyGetSetDescr_Type
-Python/hamt.c	-	_PyHamt_ArrayNode_Type	variable	PyTypeObject _PyHamt_ArrayNode_Type
-Python/hamt.c	-	PyHamt_as_mapping	variable	static PyMappingMethods PyHamt_as_mapping
-Python/hamt.c	-	PyHamt_as_sequence	variable	static PySequenceMethods PyHamt_as_sequence
-Python/hamt.c	-	_PyHamt_BitmapNode_Type	variable	PyTypeObject _PyHamt_BitmapNode_Type
-Python/hamt.c	-	_PyHamt_CollisionNode_Type	variable	PyTypeObject _PyHamt_CollisionNode_Type
-Python/hamt.c	-	_PyHamtItems_Type	variable	PyTypeObject _PyHamtItems_Type
-Python/hamt.c	-	PyHamtIterator_as_mapping	variable	static PyMappingMethods PyHamtIterator_as_mapping
-Python/hamt.c	-	_PyHamtKeys_Type	variable	PyTypeObject _PyHamtKeys_Type
-Python/hamt.c	-	PyHamt_methods	variable	static PyMethodDef PyHamt_methods
-Python/hamt.c	-	_PyHamt_Type	variable	PyTypeObject _PyHamt_Type
-Python/hamt.c	-	_PyHamtValues_Type	variable	PyTypeObject _PyHamtValues_Type
-Python/preconfig.c	-	_Py_HasFileSystemDefaultEncodeErrors	variable	const(int) _Py_HasFileSystemDefaultEncodeErrors
-Python/preconfig.c	-	Py_HasFileSystemDefaultEncoding	variable	const(int) Py_HasFileSystemDefaultEncoding
-Python/pyhash.c	-	PyHash_Func	variable	static PyHash_FuncDef PyHash_Func
-Python/initconfig.c	-	Py_HashRandomizationFlag	variable	int Py_HashRandomizationFlag
-Python/pyhash.c	-	_Py_HashSecret	variable	_Py_HashSecret_t _Py_HashSecret
-Python/bootstrap_hash.c	-	_Py_HashSecret_Initialized	variable	static int _Py_HashSecret_Initialized
-Python/codecs.c	-	Py_hexdigits	variable	const char * Py_hexdigits
-Python/sysmodule.c	-	PyId__	variable	_Py_IDENTIFIER(_)
-Modules/_abc.c	-	PyId__abc_impl	variable	_Py_IDENTIFIER(_abc_impl)
-Objects/typeobject.c	-	PyId___abstractmethods__	variable	_Py_IDENTIFIER(__abstractmethods__)
-Modules/_abc.c	-	PyId___abstractmethods__	variable	_Py_IDENTIFIER(__abstractmethods__)
-Python/ceval.c	_PyEval_EvalFrameDefault	PyId___aenter__	variable	_Py_IDENTIFIER(__aenter__)
-Python/ceval.c	_PyEval_EvalFrameDefault	PyId___aexit__	variable	_Py_IDENTIFIER(__aexit__)
-Objects/typeobject.c	slot_am_aiter	PyId___aiter__	variable	_Py_IDENTIFIER(__aiter__)
-Python/ceval.c	import_all_from	PyId___all__	variable	_Py_IDENTIFIER(__all__)
-Objects/typeobject.c	slot_am_anext	PyId___anext__	variable	_Py_IDENTIFIER(__anext__)
-Python/Python-ast.c	-	PyId_annotation	variable	_Py_IDENTIFIER(annotation)
-Python/ceval.c	_PyEval_EvalFrameDefault	PyId___annotations__	variable	_Py_IDENTIFIER(__annotations__)
-Python/Python-ast.c	-	PyId_arg	variable	_Py_IDENTIFIER(arg)
-Python/Python-ast.c	-	PyId_args	variable	_Py_IDENTIFIER(args)
-Python/Python-ast.c	-	PyId_argtypes	variable	_Py_IDENTIFIER(argtypes)
-Python/Python-ast.c	-	PyId_asname	variable	_Py_IDENTIFIER(asname)
-Python/Python-ast.c	make_type	PyId__ast	variable	_Py_IDENTIFIER(_ast)
-Python/Python-ast.c	-	PyId_attr	variable	_Py_IDENTIFIER(attr)
-Python/Python-ast.c	-	PyId__attributes	variable	_Py_IDENTIFIER(_attributes)
-Objects/typeobject.c	slot_am_await	PyId___await__	variable	_Py_IDENTIFIER(__await__)
-Python/Python-ast.c	-	PyId_bases	variable	_Py_IDENTIFIER(bases)
-Modules/_abc.c	-	PyId___bases__	variable	_Py_IDENTIFIER(__bases__)
-Objects/abstract.c	abstract_get_bases	PyId___bases__	variable	_Py_IDENTIFIER(__bases__)
-Objects/typeobject.c	merge_class_dict	PyId___bases__	variable	_Py_IDENTIFIER(__bases__)
-Objects/longobject.c	-	PyId_big	variable	_Py_IDENTIFIER(big)
-Modules/_io/_iomodule.c	_io_open_impl	PyId__blksize	variable	_Py_IDENTIFIER(_blksize)
-Python/Python-ast.c	-	PyId_body	variable	_Py_IDENTIFIER(body)
-Objects/typeobject.c	slot_nb_bool	PyId___bool__	variable	_Py_IDENTIFIER(__bool__)
-Python/sysmodule.c	-	PyId_buffer	variable	_Py_IDENTIFIER(buffer)
-Python/ceval.c	_PyEval_EvalFrameDefault	PyId___build_class__	variable	_Py_IDENTIFIER(__build_class__)
-Objects/typeobject.c	-	PyId_builtins	variable	_Py_IDENTIFIER(builtins)
-Python/errors.c	-	PyId_builtins	variable	_Py_IDENTIFIER(builtins)
-Python/pythonrun.c	-	PyId_builtins	variable	_Py_IDENTIFIER(builtins)
-Python/sysmodule.c	-	PyId_builtins	variable	_Py_IDENTIFIER(builtins)
-Objects/frameobject.c	-	PyId___builtins__	variable	_Py_IDENTIFIER(__builtins__)
-Python/bltinmodule.c	-	PyId___builtins__	variable	_Py_IDENTIFIER(__builtins__)
-Python/import.c	module_dict_for_exec	PyId___builtins__	variable	_Py_IDENTIFIER(__builtins__)
-Objects/object.c	-	PyId___bytes__	variable	_Py_IDENTIFIER(__bytes__)
-Objects/bytesobject.c	format_obj	PyId___bytes__	variable	_Py_IDENTIFIER(__bytes__)
-Objects/bytesobject.c	bytes_new	PyId___bytes__	variable	_Py_IDENTIFIER(__bytes__)
-Objects/weakrefobject.c	proxy_bytes	PyId___bytes__	variable	_Py_IDENTIFIER(__bytes__)
-Objects/typeobject.c	slot_tp_call	PyId___call__	variable	_Py_IDENTIFIER(__call__)
-Python/Python-ast.c	-	PyId_cause	variable	_Py_IDENTIFIER(cause)
-Objects/typeobject.c	-	PyId___class__	variable	_Py_IDENTIFIER(__class__)
-Modules/_abc.c	-	PyId___class__	variable	_Py_IDENTIFIER(__class__)
-Python/compile.c	compiler_enter_scope	PyId___class__	variable	_Py_IDENTIFIER(__class__)
-Objects/abstract.c	recursive_isinstance	PyId___class__	variable	_Py_IDENTIFIER(__class__)
-Objects/typeobject.c	type_new	PyId___classcell__	variable	_Py_IDENTIFIER(__classcell__)
-Objects/typeobject.c	-	PyId___class_getitem__	variable	_Py_IDENTIFIER(__class_getitem__)
-Objects/abstract.c	PyObject_GetItem	PyId___class_getitem__	variable	_Py_IDENTIFIER(__class_getitem__)
-Python/import.c	PyImport_Cleanup	PyId_clear	variable	_Py_IDENTIFIER(clear)
-Python/traceback.c	-	PyId_close	variable	_Py_IDENTIFIER(close)
-Modules/_io/bufferedio.c	-	PyId_close	variable	_Py_IDENTIFIER(close)
-Modules/_io/textio.c	-	PyId_close	variable	_Py_IDENTIFIER(close)
-Objects/genobject.c	gen_close_iter	PyId_close	variable	_Py_IDENTIFIER(close)
-Modules/_dbmmodule.c	dbm__exit__	PyId_close	variable	_Py_IDENTIFIER(close)
-Modules/_gdbmmodule.c	dbm__exit__	PyId_close	variable	_Py_IDENTIFIER(close)
-Python/pythonrun.c	_Py_HandleSystemExit	PyId_code	variable	_Py_IDENTIFIER(code)
-Python/Python-ast.c	-	PyId_col_offset	variable	_Py_IDENTIFIER(col_offset)
-Python/Python-ast.c	-	PyId_comparators	variable	_Py_IDENTIFIER(comparators)
-Objects/complexobject.c	try_complex_special_method	PyId___complex__	variable	_Py_IDENTIFIER(__complex__)
-Objects/typeobject.c	slot_sq_contains	PyId___contains__	variable	_Py_IDENTIFIER(__contains__)
-Python/Python-ast.c	-	PyId_context_expr	variable	_Py_IDENTIFIER(context_expr)
-Python/Python-ast.c	-	PyId_conversion	variable	_Py_IDENTIFIER(conversion)
-Modules/itertoolsmodule.c	itertools_tee_impl	PyId___copy__	variable	_Py_IDENTIFIER(__copy__)
-Objects/descrobject.c	mappingproxy_copy	PyId_copy	variable	_Py_IDENTIFIER(copy)
-Objects/typeobject.c	import_copyreg	PyId_copyreg	variable	_Py_IDENTIFIER(copyreg)
-Python/Python-ast.c	-	PyId_ctx	variable	_Py_IDENTIFIER(ctx)
-Modules/_io/bufferedio.c	-	PyId__dealloc_warn	variable	_Py_IDENTIFIER(_dealloc_warn)
-Modules/_io/textio.c	-	PyId__dealloc_warn	variable	_Py_IDENTIFIER(_dealloc_warn)
-Modules/_io/textio.c	-	PyId_decode	variable	_Py_IDENTIFIER(decode)
-Python/Python-ast.c	-	PyId_decorator_list	variable	_Py_IDENTIFIER(decorator_list)
-Python/_warnings.c	get_default_action	PyId_defaultaction	variable	_Py_IDENTIFIER(defaultaction)
-Python/Python-ast.c	-	PyId_defaults	variable	_Py_IDENTIFIER(defaults)
-Objects/typeobject.c	slot_tp_finalize	PyId___del__	variable	_Py_IDENTIFIER(__del__)
-Objects/typeobject.c	slot_tp_setattro	PyId___delattr__	variable	_Py_IDENTIFIER(__delattr__)
-Objects/typeobject.c	slot_tp_descr_set	PyId___delete__	variable	_Py_IDENTIFIER(__delete__)
-Objects/typeobject.c	-	PyId___delitem__	variable	_Py_IDENTIFIER(__delitem__)
-Objects/typeobject.c	-	PyId___dict__	variable	_Py_IDENTIFIER(__dict__)
-Modules/_abc.c	-	PyId___dict__	variable	_Py_IDENTIFIER(__dict__)
-Python/bltinmodule.c	-	PyId___dict__	variable	_Py_IDENTIFIER(__dict__)
-Python/Python-ast.c	ast_type_reduce	PyId___dict__	variable	_Py_IDENTIFIER(__dict__)
-Python/ceval.c	import_all_from	PyId___dict__	variable	_Py_IDENTIFIER(__dict__)
-Objects/bytearrayobject.c	_common_reduce	PyId___dict__	variable	_Py_IDENTIFIER(__dict__)
-Objects/moduleobject.c	module_dir	PyId___dict__	variable	_Py_IDENTIFIER(__dict__)
-Objects/odictobject.c	odict_reduce	PyId___dict__	variable	_Py_IDENTIFIER(__dict__)
-Objects/setobject.c	set_reduce	PyId___dict__	variable	_Py_IDENTIFIER(__dict__)
-Modules/_collectionsmodule.c	deque_reduce	PyId___dict__	variable	_Py_IDENTIFIER(__dict__)
-Objects/dictobject.c	dictviews_sub	PyId_difference_update	variable	_Py_IDENTIFIER(difference_update)
-Python/Python-ast.c	-	PyId_dims	variable	_Py_IDENTIFIER(dims)
-Objects/object.c	-	PyId___dir__	variable	_Py_IDENTIFIER(__dir__)
-Objects/moduleobject.c	module_dir	PyId___dir__	variable	_Py_IDENTIFIER(__dir__)
-Python/ceval.c	_PyEval_EvalFrameDefault	PyId_displayhook	variable	_Py_IDENTIFIER(displayhook)
-Objects/typeobject.c	-	PyId___doc__	variable	_Py_IDENTIFIER(__doc__)
-Objects/descrobject.c	property_init_impl	PyId___doc__	variable	_Py_IDENTIFIER(__doc__)
-Objects/moduleobject.c	module_init_dict	PyId___doc__	variable	_Py_IDENTIFIER(__doc__)
-Objects/moduleobject.c	PyModule_SetDocString	PyId___doc__	variable	_Py_IDENTIFIER(__doc__)
-Python/Python-ast.c	-	PyId_elt	variable	_Py_IDENTIFIER(elt)
-Python/Python-ast.c	-	PyId_elts	variable	_Py_IDENTIFIER(elts)
-Modules/faulthandler.c	-	PyId_enable	variable	_Py_IDENTIFIER(enable)
-Python/sysmodule.c	-	PyId_encoding	variable	_Py_IDENTIFIER(encoding)
-Python/bltinmodule.c	-	PyId_encoding	variable	_Py_IDENTIFIER(encoding)
-Python/pythonrun.c	PyRun_InteractiveOneObjectEx	PyId_encoding	variable	_Py_IDENTIFIER(encoding)
-Python/Python-ast.c	-	PyId_end_col_offset	variable	_Py_IDENTIFIER(end_col_offset)
-Python/Python-ast.c	-	PyId_end_lineno	variable	_Py_IDENTIFIER(end_lineno)
-Python/ceval.c	_PyEval_EvalFrameDefault	PyId___enter__	variable	_Py_IDENTIFIER(__enter__)
-Objects/typeobject.c	overrides_hash	PyId___eq__	variable	_Py_IDENTIFIER(__eq__)
-Python/bltinmodule.c	-	PyId_errors	variable	_Py_IDENTIFIER(errors)
-Python/Python-ast.c	-	PyId_exc	variable	_Py_IDENTIFIER(exc)
-Python/pythonrun.c	-	PyId_excepthook	variable	_Py_IDENTIFIER(excepthook)
-Python/ceval.c	_PyEval_EvalFrameDefault	PyId___exit__	variable	_Py_IDENTIFIER(__exit__)
-Modules/_pickle.c	do_append	PyId_extend	variable	_Py_IDENTIFIER(extend)
-Python/Python-ast.c	-	PyId__fields	variable	_Py_IDENTIFIER(_fields)
-Objects/moduleobject.c	PyModule_GetFilenameObject	PyId___file__	variable	_Py_IDENTIFIER(__file__)
-Python/errors.c	PyErr_SyntaxLocationObject	PyId_filename	variable	_Py_IDENTIFIER(filename)
-Python/pythonrun.c	parse_syntax_error	PyId_filename	variable	_Py_IDENTIFIER(filename)
-Modules/_io/textio.c	-	PyId_fileno	variable	_Py_IDENTIFIER(fileno)
-Modules/faulthandler.c	-	PyId_fileno	variable	_Py_IDENTIFIER(fileno)
-Python/bltinmodule.c	-	PyId_fileno	variable	_Py_IDENTIFIER(fileno)
-Objects/fileobject.c	PyObject_AsFileDescriptor	PyId_fileno	variable	_Py_IDENTIFIER(fileno)
-Modules/itertoolsmodule.c	zip_longest_new	PyId_fillvalue	variable	_Py_IDENTIFIER(fillvalue)
-Python/_warnings.c	get_filter	PyId_filters	variable	_Py_IDENTIFIER(filters)
-Python/Python-ast.c	-	PyId_finalbody	variable	_Py_IDENTIFIER(finalbody)
-Modules/_io/iobase.c	iobase_finalize	PyId__finalizing	variable	_Py_IDENTIFIER(_finalizing)
-Python/import.c	import_find_and_load	PyId__find_and_load	variable	_Py_IDENTIFIER(_find_and_load)
-Python/import.c	PyImport_ExecCodeModuleObject	PyId__fix_up_module	variable	_Py_IDENTIFIER(_fix_up_module)
-Python/errors.c	-	PyId_flush	variable	_Py_IDENTIFIER(flush)
-Python/pylifecycle.c	-	PyId_flush	variable	_Py_IDENTIFIER(flush)
-Python/pythonrun.c	-	PyId_flush	variable	_Py_IDENTIFIER(flush)
-Modules/_threadmodule.c	-	PyId_flush	variable	_Py_IDENTIFIER(flush)
-Modules/_io/bufferedio.c	-	PyId_flush	variable	_Py_IDENTIFIER(flush)
-Modules/_io/textio.c	-	PyId_flush	variable	_Py_IDENTIFIER(flush)
-Modules/faulthandler.c	-	PyId_flush	variable	_Py_IDENTIFIER(flush)
-Python/bltinmodule.c	-	PyId_flush	variable	_Py_IDENTIFIER(flush)
-Objects/abstract.c	PyObject_Format	PyId___format__	variable	_Py_IDENTIFIER(__format__)
-Python/Python-ast.c	-	PyId_format_spec	variable	_Py_IDENTIFIER(format_spec)
-Modules/posixmodule.c	path_converter	PyId___fspath__	variable	_Py_IDENTIFIER(__fspath__)
-Modules/posixmodule.c	PyOS_FSPath	PyId___fspath__	variable	_Py_IDENTIFIER(__fspath__)
-Python/Python-ast.c	-	PyId_func	variable	_Py_IDENTIFIER(func)
-Python/Python-ast.c	-	PyId_generators	variable	_Py_IDENTIFIER(generators)
-Objects/descrobject.c	mappingproxy_get	PyId_get	variable	_Py_IDENTIFIER(get)
-Modules/_collectionsmodule.c	_count_elements	PyId_get	variable	_Py_IDENTIFIER(get)
-Objects/typeobject.c	slot_tp_descr_get	PyId___get__	variable	_Py_IDENTIFIER(__get__)
-Objects/classobject.c	method_reduce	PyId_getattr	variable	_Py_IDENTIFIER(getattr)
-Objects/descrobject.c	descr_reduce	PyId_getattr	variable	_Py_IDENTIFIER(getattr)
-Objects/descrobject.c	wrapper_reduce	PyId_getattr	variable	_Py_IDENTIFIER(getattr)
-Objects/moduleobject.c	module_getattro	PyId___getattr__	variable	_Py_IDENTIFIER(__getattr__)
-Objects/methodobject.c	meth_reduce	PyId_getattr	variable	_Py_IDENTIFIER(getattr)
-Objects/typeobject.c	slot_tp_getattr_hook	PyId___getattr__	variable	_Py_IDENTIFIER(__getattr__)
-Objects/typeobject.c	-	PyId___getattribute__	variable	_Py_IDENTIFIER(__getattribute__)
-Objects/typeobject.c	-	PyId___getitem__	variable	_Py_IDENTIFIER(__getitem__)
-Objects/typeobject.c	_PyObject_GetNewArguments	PyId___getnewargs__	variable	_Py_IDENTIFIER(__getnewargs__)
-Objects/typeobject.c	_PyObject_GetNewArguments	PyId___getnewargs_ex__	variable	_Py_IDENTIFIER(__getnewargs_ex__)
-Modules/_io/textio.c	-	PyId_getpreferredencoding	variable	_Py_IDENTIFIER(getpreferredencoding)
-Python/_warnings.c	get_source_line	PyId_get_source	variable	_Py_IDENTIFIER(get_source)
-Python/import.c	PyImport_ExecCodeModuleWithPathnames	PyId__get_sourcefile	variable	_Py_IDENTIFIER(_get_sourcefile)
-Objects/typeobject.c	_PyObject_GetState	PyId___getstate__	variable	_Py_IDENTIFIER(__getstate__)
-Python/import.c	PyImport_ImportModuleLevelObject	PyId__handle_fromlist	variable	_Py_IDENTIFIER(_handle_fromlist)
-Python/Python-ast.c	-	PyId_handlers	variable	_Py_IDENTIFIER(handlers)
-Objects/typeobject.c	-	PyId___hash__	variable	_Py_IDENTIFIER(__hash__)
-Python/Python-ast.c	-	PyId_id	variable	_Py_IDENTIFIER(id)
-Python/Python-ast.c	-	PyId_ifs	variable	_Py_IDENTIFIER(ifs)
-Python/import.c	PyImport_ReloadModule	PyId_imp	variable	_Py_IDENTIFIER(imp)
-Python/ceval.c	import_name	PyId___import__	variable	_Py_IDENTIFIER(__import__)
-Objects/typeobject.c	slot_nb_index	PyId___index__	variable	_Py_IDENTIFIER(__index__)
-Objects/typeobject.c	slot_tp_init	PyId___init__	variable	_Py_IDENTIFIER(__init__)
-Objects/moduleobject.c	_PyModuleSpec_IsInitializing	PyId__initializing	variable	_Py_IDENTIFIER(_initializing)
-Objects/typeobject.c	-	PyId___init_subclass__	variable	_Py_IDENTIFIER(__init_subclass__)
-Objects/abstract.c	PyObject_IsInstance	PyId___instancecheck__	variable	_Py_IDENTIFIER(__instancecheck__)
-Objects/dictobject.c	_PyDictView_Intersect	PyId_intersection_update	variable	_Py_IDENTIFIER(intersection_update)
-Modules/_io/iobase.c	-	PyId___IOBase_closed	variable	_Py_IDENTIFIER(__IOBase_closed)
-Objects/typeobject.c	slot_nb_inplace_power	PyId___ipow__	variable	_Py_IDENTIFIER(__ipow__)
-Objects/object.c	-	PyId___isabstractmethod__	variable	_Py_IDENTIFIER(__isabstractmethod__)
-Python/Python-ast.c	-	PyId_is_async	variable	_Py_IDENTIFIER(is_async)
-Modules/_io/bufferedio.c	-	PyId_isatty	variable	_Py_IDENTIFIER(isatty)
-Modules/_io/textio.c	-	PyId_isatty	variable	_Py_IDENTIFIER(isatty)
-Python/pylifecycle.c	create_stdio	PyId_isatty	variable	_Py_IDENTIFIER(isatty)
-Modules/_io/_iomodule.c	_io_open_impl	PyId_isatty	variable	_Py_IDENTIFIER(isatty)
-Python/codecs.c	_PyCodec_LookupTextEncoding	PyId__is_text_encoding	variable	_Py_IDENTIFIER(_is_text_encoding)
-Python/Python-ast.c	-	PyId_items	variable	_Py_IDENTIFIER(items)
-Objects/abstract.c	PyMapping_Items	PyId_items	variable	_Py_IDENTIFIER(items)
-Objects/descrobject.c	mappingproxy_items	PyId_items	variable	_Py_IDENTIFIER(items)
-Objects/odictobject.c	odict_reduce	PyId_items	variable	_Py_IDENTIFIER(items)
-Objects/odictobject.c	odict_repr	PyId_items	variable	_Py_IDENTIFIER(items)
-Objects/odictobject.c	mutablemapping_update	PyId_items	variable	_Py_IDENTIFIER(items)
-Objects/typeobject.c	_PyObject_GetItemsIter	PyId_items	variable	_Py_IDENTIFIER(items)
-Modules/_collectionsmodule.c	defdict_reduce	PyId_items	variable	_Py_IDENTIFIER(items)
-Python/Python-ast.c	-	PyId_iter	variable	_Py_IDENTIFIER(iter)
-Objects/bytearrayobject.c	bytearrayiter_reduce	PyId_iter	variable	_Py_IDENTIFIER(iter)
-Objects/bytesobject.c	striter_reduce	PyId_iter	variable	_Py_IDENTIFIER(iter)
-Objects/dictobject.c	dictiter_reduce	PyId_iter	variable	_Py_IDENTIFIER(iter)
-Objects/iterobject.c	iter_reduce	PyId_iter	variable	_Py_IDENTIFIER(iter)
-Objects/iterobject.c	calliter_reduce	PyId_iter	variable	_Py_IDENTIFIER(iter)
-Objects/listobject.c	listiter_reduce_general	PyId_iter	variable	_Py_IDENTIFIER(iter)
-Objects/odictobject.c	odictiter_reduce	PyId_iter	variable	_Py_IDENTIFIER(iter)
-Objects/rangeobject.c	rangeiter_reduce	PyId_iter	variable	_Py_IDENTIFIER(iter)
-Objects/rangeobject.c	longrangeiter_reduce	PyId_iter	variable	_Py_IDENTIFIER(iter)
-Objects/setobject.c	setiter_reduce	PyId_iter	variable	_Py_IDENTIFIER(iter)
-Objects/tupleobject.c	tupleiter_reduce	PyId_iter	variable	_Py_IDENTIFIER(iter)
-Objects/unicodeobject.c	unicodeiter_reduce	PyId_iter	variable	_Py_IDENTIFIER(iter)
-Objects/typeobject.c	slot_tp_iter	PyId___iter__	variable	_Py_IDENTIFIER(__iter__)
-Modules/arraymodule.c	array_arrayiterator___reduce___impl	PyId_iter	variable	_Py_IDENTIFIER(iter)
-Python/Python-ast.c	-	PyId_key	variable	_Py_IDENTIFIER(key)
-Python/Python-ast.c	-	PyId_keys	variable	_Py_IDENTIFIER(keys)
-Objects/abstract.c	PyMapping_Keys	PyId_keys	variable	_Py_IDENTIFIER(keys)
-Objects/descrobject.c	mappingproxy_keys	PyId_keys	variable	_Py_IDENTIFIER(keys)
-Objects/dictobject.c	dict_update_common	PyId_keys	variable	_Py_IDENTIFIER(keys)
-Objects/odictobject.c	mutablemapping_update	PyId_keys	variable	_Py_IDENTIFIER(keys)
-Python/Python-ast.c	-	PyId_keywords	variable	_Py_IDENTIFIER(keywords)
-Python/Python-ast.c	-	PyId_kind	variable	_Py_IDENTIFIER(kind)
-Python/Python-ast.c	-	PyId_kwarg	variable	_Py_IDENTIFIER(kwarg)
-Python/Python-ast.c	-	PyId_kw_defaults	variable	_Py_IDENTIFIER(kw_defaults)
-Python/Python-ast.c	-	PyId_kwonlyargs	variable	_Py_IDENTIFIER(kwonlyargs)
-Python/pythonrun.c	-	PyId_last_traceback	variable	_Py_IDENTIFIER(last_traceback)
-Python/pythonrun.c	-	PyId_last_type	variable	_Py_IDENTIFIER(last_type)
-Python/pythonrun.c	-	PyId_last_value	variable	_Py_IDENTIFIER(last_value)
-Python/Python-ast.c	-	PyId_left	variable	_Py_IDENTIFIER(left)
-Objects/typeobject.c	-	PyId___len__	variable	_Py_IDENTIFIER(__len__)
-Objects/abstract.c	PyObject_LengthHint	PyId___length_hint__	variable	_Py_IDENTIFIER(__length_hint__)
-Python/Python-ast.c	-	PyId_level	variable	_Py_IDENTIFIER(level)
-Python/Python-ast.c	-	PyId_lineno	variable	_Py_IDENTIFIER(lineno)
-Python/errors.c	PyErr_SyntaxLocationObject	PyId_lineno	variable	_Py_IDENTIFIER(lineno)
-Python/pythonrun.c	parse_syntax_error	PyId_lineno	variable	_Py_IDENTIFIER(lineno)
-Objects/longobject.c	-	PyId_little	variable	_Py_IDENTIFIER(little)
-Python/_warnings.c	get_source_line	PyId___loader__	variable	_Py_IDENTIFIER(__loader__)
-Objects/moduleobject.c	module_init_dict	PyId___loader__	variable	_Py_IDENTIFIER(__loader__)
-Python/import.c	PyImport_ImportModuleLevelObject	PyId__lock_unlock_module	variable	_Py_IDENTIFIER(_lock_unlock_module)
-Python/Python-ast.c	-	PyId_lower	variable	_Py_IDENTIFIER(lower)
-Python/ceval.c	_PyEval_EvalFrameDefault	PyId___ltrace__	variable	_Py_IDENTIFIER(__ltrace__)
-Python/pythonrun.c	PyRun_InteractiveOneObjectEx	PyId___main__	variable	_Py_IDENTIFIER(__main__)
-Python/_warnings.c	check_matched	PyId_match	variable	_Py_IDENTIFIER(match)
-Python/bltinmodule.c	-	PyId_metaclass	variable	_Py_IDENTIFIER(metaclass)
-Objects/dictobject.c	dict_subscript	PyId___missing__	variable	_Py_IDENTIFIER(__missing__)
-Modules/_io/bufferedio.c	-	PyId_mode	variable	_Py_IDENTIFIER(mode)
-Modules/_io/textio.c	-	PyId_mode	variable	_Py_IDENTIFIER(mode)
-Python/pylifecycle.c	create_stdio	PyId_mode	variable	_Py_IDENTIFIER(mode)
-Modules/_io/_iomodule.c	_io_open_impl	PyId_mode	variable	_Py_IDENTIFIER(mode)
-Python/Python-ast.c	-	PyId_module	variable	_Py_IDENTIFIER(module)
-Objects/typeobject.c	-	PyId___module__	variable	_Py_IDENTIFIER(__module__)
-Python/Python-ast.c	make_type	PyId___module__	variable	_Py_IDENTIFIER(__module__)
-Python/errors.c	PyErr_NewException	PyId___module__	variable	_Py_IDENTIFIER(__module__)
-Python/errors.c	PyErr_NewException	PyId___module__	variable	_Py_IDENTIFIER(__module__)
-Python/pythonrun.c	print_exception	PyId___module__	variable	_Py_IDENTIFIER(__module__)
-Modules/_pickle.c	whichmodule	PyId___module__	variable	_Py_IDENTIFIER(__module__)
-Objects/typeobject.c	type_mro_modified	PyId_mro	variable	_Py_IDENTIFIER(mro)
-Objects/typeobject.c	mro_invoke	PyId_mro	variable	_Py_IDENTIFIER(mro)
-Python/bltinmodule.c	-	PyId___mro_entries__	variable	_Py_IDENTIFIER(__mro_entries__)
-Objects/typeobject.c	type_new	PyId___mro_entries__	variable	_Py_IDENTIFIER(__mro_entries__)
-Python/Python-ast.c	-	PyId_msg	variable	_Py_IDENTIFIER(msg)
-Python/errors.c	PyErr_SyntaxLocationObject	PyId_msg	variable	_Py_IDENTIFIER(msg)
-Python/pythonrun.c	parse_syntax_error	PyId_msg	variable	_Py_IDENTIFIER(msg)
-Python/pylifecycle.c	-	PyId_name	variable	_Py_IDENTIFIER(name)
-Modules/_io/fileio.c	-	PyId_name	variable	_Py_IDENTIFIER(name)
-Modules/_io/bufferedio.c	-	PyId_name	variable	_Py_IDENTIFIER(name)
-Modules/_io/textio.c	-	PyId_name	variable	_Py_IDENTIFIER(name)
-Python/Python-ast.c	-	PyId_name	variable	_Py_IDENTIFIER(name)
-Objects/exceptions.c	ImportError_getstate	PyId_name	variable	_Py_IDENTIFIER(name)
-Objects/typeobject.c	-	PyId___name__	variable	_Py_IDENTIFIER(__name__)
-Objects/classobject.c	-	PyId___name__	variable	_Py_IDENTIFIER(__name__)
-Python/_warnings.c	setup_context	PyId___name__	variable	_Py_IDENTIFIER(__name__)
-Python/_warnings.c	get_source_line	PyId___name__	variable	_Py_IDENTIFIER(__name__)
-Python/_warnings.c	show_warning	PyId___name__	variable	_Py_IDENTIFIER(__name__)
-Python/ceval.c	import_from	PyId___name__	variable	_Py_IDENTIFIER(__name__)
-Python/ceval.c	import_all_from	PyId___name__	variable	_Py_IDENTIFIER(__name__)
-Python/import.c	resolve_name	PyId___name__	variable	_Py_IDENTIFIER(__name__)
-Objects/moduleobject.c	module_init_dict	PyId___name__	variable	_Py_IDENTIFIER(__name__)
-Objects/moduleobject.c	PyModule_GetNameObject	PyId___name__	variable	_Py_IDENTIFIER(__name__)
-Objects/moduleobject.c	module_getattro	PyId___name__	variable	_Py_IDENTIFIER(__name__)
-Objects/weakrefobject.c	weakref_repr	PyId___name__	variable	_Py_IDENTIFIER(__name__)
-Modules/_pickle.c	save_global	PyId___name__	variable	_Py_IDENTIFIER(__name__)
-Modules/_pickle.c	save_reduce	PyId___name__	variable	_Py_IDENTIFIER(__name__)
-Python/Python-ast.c	-	PyId_names	variable	_Py_IDENTIFIER(names)
-Objects/typeobject.c	-	PyId___new__	variable	_Py_IDENTIFIER(__new__)
-Objects/typeobject.c	reduce_newobj	PyId___newobj__	variable	_Py_IDENTIFIER(__newobj__)
-Objects/typeobject.c	reduce_newobj	PyId___newobj_ex__	variable	_Py_IDENTIFIER(__newobj_ex__)
-Objects/typeobject.c	slot_tp_iternext	PyId___next__	variable	_Py_IDENTIFIER(__next__)
-Objects/structseq.c	-	PyId_n_fields	variable	_Py_IDENTIFIER(n_fields)
-Python/ast.c	new_identifier	PyId_NFKC	variable	_Py_IDENTIFIER(NFKC)
-Objects/structseq.c	-	PyId_n_sequence_fields	variable	_Py_IDENTIFIER(n_sequence_fields)
-Objects/structseq.c	-	PyId_n_unnamed_fields	variable	_Py_IDENTIFIER(n_unnamed_fields)
-Python/errors.c	PyErr_SyntaxLocationObject	PyId_offset	variable	_Py_IDENTIFIER(offset)
-Python/pythonrun.c	parse_syntax_error	PyId_offset	variable	_Py_IDENTIFIER(offset)
-Python/_warnings.c	get_once_registry	PyId_onceregistry	variable	_Py_IDENTIFIER(onceregistry)
-Python/Python-ast.c	-	PyId_op	variable	_Py_IDENTIFIER(op)
-Python/traceback.c	-	PyId_open	variable	_Py_IDENTIFIER(open)
-Python/pylifecycle.c	create_stdio	PyId_open	variable	_Py_IDENTIFIER(open)
-Parser/tokenizer.c	fp_setreadl	PyId_open	variable	_Py_IDENTIFIER(open)
-Objects/fileobject.c	PyFile_FromFd	PyId_open	variable	_Py_IDENTIFIER(open)
-Objects/fileobject.c	PyFile_OpenCodeObject	PyId_open	variable	_Py_IDENTIFIER(open)
-Python/Python-ast.c	-	PyId_operand	variable	_Py_IDENTIFIER(operand)
-Python/Python-ast.c	-	PyId_ops	variable	_Py_IDENTIFIER(ops)
-Python/Python-ast.c	-	PyId_optional_vars	variable	_Py_IDENTIFIER(optional_vars)
-Python/Python-ast.c	-	PyId_orelse	variable	_Py_IDENTIFIER(orelse)
-Python/import.c	resolve_name	PyId___package__	variable	_Py_IDENTIFIER(__package__)
-Objects/moduleobject.c	module_init_dict	PyId___package__	variable	_Py_IDENTIFIER(__package__)
-Python/import.c	resolve_name	PyId_parent	variable	_Py_IDENTIFIER(parent)
-Modules/_operator.c	methodcaller_reduce	PyId_partial	variable	_Py_IDENTIFIER(partial)
-Python/sysmodule.c	-	PyId_path	variable	_Py_IDENTIFIER(path)
-Python/traceback.c	-	PyId_path	variable	_Py_IDENTIFIER(path)
-Objects/exceptions.c	ImportError_getstate	PyId_path	variable	_Py_IDENTIFIER(path)
-Modules/main.c	pymain_sys_path_add_path0	PyId_path	variable	_Py_IDENTIFIER(path)
-Python/import.c	resolve_name	PyId___path__	variable	_Py_IDENTIFIER(__path__)
-Python/import.c	PyImport_ImportModuleLevelObject	PyId___path__	variable	_Py_IDENTIFIER(__path__)
-Modules/_io/bufferedio.c	-	PyId_peek	variable	_Py_IDENTIFIER(peek)
-Python/Python-ast.c	-	PyId_posonlyargs	variable	_Py_IDENTIFIER(posonlyargs)
-Objects/typeobject.c	slot_nb_power	PyId___pow__	variable	_Py_IDENTIFIER(__pow__)
-Python/bltinmodule.c	-	PyId___prepare__	variable	_Py_IDENTIFIER(__prepare__)
-Python/errors.c	PyErr_SyntaxLocationObject	PyId_print_file_and_line	variable	_Py_IDENTIFIER(print_file_and_line)
-Python/pythonrun.c	print_exception	PyId_print_file_and_line	variable	_Py_IDENTIFIER(print_file_and_line)
-Python/pythonrun.c	-	PyId_ps1	variable	_Py_IDENTIFIER(ps1)
-Python/pythonrun.c	-	PyId_ps2	variable	_Py_IDENTIFIER(ps2)
-Objects/object.c	-	PyId_Py_Repr	variable	_Py_IDENTIFIER(Py_Repr)
-Objects/classobject.c	-	PyId___qualname__	variable	_Py_IDENTIFIER(__qualname__)
-Objects/descrobject.c	calculate_qualname	PyId___qualname__	variable	_Py_IDENTIFIER(__qualname__)
-Objects/methodobject.c	meth_get__qualname__	PyId___qualname__	variable	_Py_IDENTIFIER(__qualname__)
-Objects/typeobject.c	type_new	PyId___qualname__	variable	_Py_IDENTIFIER(__qualname__)
-Modules/_io/textio.c	-	PyId_raw	variable	_Py_IDENTIFIER(raw)
-Python/pylifecycle.c	create_stdio	PyId_raw	variable	_Py_IDENTIFIER(raw)
-Modules/_io/iobase.c	-	PyId_read	variable	_Py_IDENTIFIER(read)
-Modules/_io/bufferedio.c	-	PyId_read	variable	_Py_IDENTIFIER(read)
-Modules/_io/textio.c	-	PyId_read	variable	_Py_IDENTIFIER(read)
-Modules/_io/bufferedio.c	-	PyId_read1	variable	_Py_IDENTIFIER(read1)
-Python/marshal.c	marshal_load	PyId_read	variable	_Py_IDENTIFIER(read)
-Modules/_io/bufferedio.c	-	PyId_readable	variable	_Py_IDENTIFIER(readable)
-Modules/_io/textio.c	-	PyId_readable	variable	_Py_IDENTIFIER(readable)
-Modules/_io/iobase.c	_io__RawIOBase_read_impl	PyId_readall	variable	_Py_IDENTIFIER(readall)
-Modules/_io/bufferedio.c	-	PyId_readinto	variable	_Py_IDENTIFIER(readinto)
-Modules/_io/bufferedio.c	-	PyId_readinto1	variable	_Py_IDENTIFIER(readinto1)
-Python/marshal.c	r_string	PyId_readinto	variable	_Py_IDENTIFIER(readinto)
-Parser/tokenizer.c	fp_setreadl	PyId_readline	variable	_Py_IDENTIFIER(readline)
-Objects/fileobject.c	PyFile_GetLine	PyId_readline	variable	_Py_IDENTIFIER(readline)
-Objects/typeobject.c	object___reduce_ex___impl	PyId___reduce__	variable	_Py_IDENTIFIER(__reduce__)
-Python/import.c	PyImport_ReloadModule	PyId_reload	variable	_Py_IDENTIFIER(reload)
-Modules/_io/textio.c	-	PyId_replace	variable	_Py_IDENTIFIER(replace)
-Python/importdl.c	get_encoded_name	PyId_replace	variable	_Py_IDENTIFIER(replace)
-Objects/typeobject.c	slot_tp_repr	PyId___repr__	variable	_Py_IDENTIFIER(__repr__)
-Modules/_io/textio.c	-	PyId_reset	variable	_Py_IDENTIFIER(reset)
-Python/Python-ast.c	-	PyId_returns	variable	_Py_IDENTIFIER(returns)
-Objects/enumobject.c	reversed_new_impl	PyId___reversed__	variable	_Py_IDENTIFIER(__reversed__)
-Objects/listobject.c	listiter_reduce_general	PyId_reversed	variable	_Py_IDENTIFIER(reversed)
-Python/Python-ast.c	-	PyId_right	variable	_Py_IDENTIFIER(right)
-Python/bltinmodule.c	-	PyId___round__	variable	_Py_IDENTIFIER(__round__)
-Modules/_io/textio.c	-	PyId_seek	variable	_Py_IDENTIFIER(seek)
-Modules/_io/iobase.c	_io__IOBase_tell_impl	PyId_seek	variable	_Py_IDENTIFIER(seek)
-Modules/_io/textio.c	-	PyId_seekable	variable	_Py_IDENTIFIER(seekable)
-Python/ceval.c	_PyEval_EvalFrameDefault	PyId_send	variable	_Py_IDENTIFIER(send)
-Objects/typeobject.c	slot_tp_descr_set	PyId___set__	variable	_Py_IDENTIFIER(__set__)
-Objects/typeobject.c	slot_tp_setattro	PyId___setattr__	variable	_Py_IDENTIFIER(__setattr__)
-Objects/typeobject.c	-	PyId___setitem__	variable	_Py_IDENTIFIER(__setitem__)
-Modules/_collectionsmodule.c	_count_elements	PyId___setitem__	variable	_Py_IDENTIFIER(__setitem__)
-Objects/typeobject.c	-	PyId___set_name__	variable	_Py_IDENTIFIER(__set_name__)
-Modules/_io/textio.c	-	PyId_setstate	variable	_Py_IDENTIFIER(setstate)
-Modules/_pickle.c	load_build	PyId___setstate__	variable	_Py_IDENTIFIER(__setstate__)
-Python/_warnings.c	call_show_warning	PyId__showwarnmsg	variable	_Py_IDENTIFIER(_showwarnmsg)
-Python/pylifecycle.c	wait_for_thread_shutdown	PyId__shutdown	variable	_Py_IDENTIFIER(_shutdown)
-Python/Python-ast.c	-	PyId_simple	variable	_Py_IDENTIFIER(simple)
-Python/sysmodule.c	-	PyId___sizeof__	variable	_Py_IDENTIFIER(__sizeof__)
-Python/Python-ast.c	-	PyId_slice	variable	_Py_IDENTIFIER(slice)
-Objects/typeobject.c	_PyType_GetSlotNames	PyId___slotnames__	variable	_Py_IDENTIFIER(__slotnames__)
-Objects/typeobject.c	_PyType_GetSlotNames	PyId__slotnames	variable	_Py_IDENTIFIER(_slotnames)
-Objects/typeobject.c	type_new	PyId___slots__	variable	_Py_IDENTIFIER(__slots__)
-Python/bltinmodule.c	-	PyId_sort	variable	_Py_IDENTIFIER(sort)
-Python/import.c	resolve_name	PyId___spec__	variable	_Py_IDENTIFIER(__spec__)
-Python/import.c	PyImport_ImportModuleLevelObject	PyId___spec__	variable	_Py_IDENTIFIER(__spec__)
-Objects/moduleobject.c	module_init_dict	PyId___spec__	variable	_Py_IDENTIFIER(__spec__)
-Objects/moduleobject.c	module_getattro	PyId___spec__	variable	_Py_IDENTIFIER(__spec__)
-Python/_warnings.c	-	PyId_stderr	variable	_Py_IDENTIFIER(stderr)
-Python/errors.c	-	PyId_stderr	variable	_Py_IDENTIFIER(stderr)
-Python/pylifecycle.c	-	PyId_stderr	variable	_Py_IDENTIFIER(stderr)
-Python/pythonrun.c	-	PyId_stderr	variable	_Py_IDENTIFIER(stderr)
-Python/sysmodule.c	-	PyId_stderr	variable	_Py_IDENTIFIER(stderr)
-Modules/_threadmodule.c	-	PyId_stderr	variable	_Py_IDENTIFIER(stderr)
-Modules/faulthandler.c	-	PyId_stderr	variable	_Py_IDENTIFIER(stderr)
-Python/bltinmodule.c	-	PyId_stderr	variable	_Py_IDENTIFIER(stderr)
-Python/pylifecycle.c	-	PyId_stdin	variable	_Py_IDENTIFIER(stdin)
-Python/pythonrun.c	-	PyId_stdin	variable	_Py_IDENTIFIER(stdin)
-Python/bltinmodule.c	-	PyId_stdin	variable	_Py_IDENTIFIER(stdin)
-Python/pylifecycle.c	-	PyId_stdout	variable	_Py_IDENTIFIER(stdout)
-Python/pythonrun.c	-	PyId_stdout	variable	_Py_IDENTIFIER(stdout)
-Python/sysmodule.c	-	PyId_stdout	variable	_Py_IDENTIFIER(stdout)
-Python/bltinmodule.c	-	PyId_stdout	variable	_Py_IDENTIFIER(stdout)
-Python/Python-ast.c	-	PyId_step	variable	_Py_IDENTIFIER(step)
-Modules/posixmodule.c	DirEntry_test_mode	PyId_st_mode	variable	_Py_IDENTIFIER(st_mode)
-Modules/_io/textio.c	-	PyId_strict	variable	_Py_IDENTIFIER(strict)
-Python/pythonrun.c	-	PyId_string	variable	_Py_static_string(PyId_string, ""<string>"")
-Modules/timemodule.c	time_strptime	PyId__strptime_time	variable	_Py_IDENTIFIER(_strptime_time)
-Modules/posixmodule.c	wait_helper	PyId_struct_rusage	variable	_Py_IDENTIFIER(struct_rusage)
-Modules/_abc.c	-	PyId___subclasscheck__	variable	_Py_IDENTIFIER(__subclasscheck__)
-Objects/abstract.c	PyObject_IsSubclass	PyId___subclasscheck__	variable	_Py_IDENTIFIER(__subclasscheck__)
-Modules/_abc.c	-	PyId___subclasshook__	variable	_Py_IDENTIFIER(__subclasshook__)
-Objects/dictobject.c	dictviews_xor	PyId_symmetric_difference_update	variable	_Py_IDENTIFIER(symmetric_difference_update)
-Python/Python-ast.c	-	PyId_tag	variable	_Py_IDENTIFIER(tag)
-Python/Python-ast.c	-	PyId_target	variable	_Py_IDENTIFIER(target)
-Python/Python-ast.c	-	PyId_targets	variable	_Py_IDENTIFIER(targets)
-Modules/_io/textio.c	-	PyId_tell	variable	_Py_IDENTIFIER(tell)
-Python/Python-ast.c	-	PyId_test	variable	_Py_IDENTIFIER(test)
-Python/errors.c	PyErr_SyntaxLocationObject	PyId_text	variable	_Py_IDENTIFIER(text)
-Python/pythonrun.c	parse_syntax_error	PyId_text	variable	_Py_IDENTIFIER(text)
-Python/traceback.c	-	PyId_TextIOWrapper	variable	_Py_IDENTIFIER(TextIOWrapper)
-Python/pylifecycle.c	create_stdio	PyId_TextIOWrapper	variable	_Py_IDENTIFIER(TextIOWrapper)
-Python/pylifecycle.c	-	PyId_threading	variable	_Py_IDENTIFIER(threading)
-Objects/genobject.c	_gen_throw	PyId_throw	variable	_Py_IDENTIFIER(throw)
-Objects/abstract.c	PyNumber_Long	PyId___trunc__	variable	_Py_IDENTIFIER(__trunc__)
-Python/Python-ast.c	-	PyId_type	variable	_Py_IDENTIFIER(type)
-Python/Python-ast.c	-	PyId_type_comment	variable	_Py_IDENTIFIER(type_comment)
-Python/Python-ast.c	-	PyId_type_ignores	variable	_Py_IDENTIFIER(type_ignores)
-Python/errors.c	_PyErr_WriteUnraisableMsg	PyId_unraisablehook	variable	_Py_IDENTIFIER(unraisablehook)
-Objects/dictobject.c	dictviews_or	PyId_update	variable	_Py_IDENTIFIER(update)
-Python/Python-ast.c	-	PyId_upper	variable	_Py_IDENTIFIER(upper)
-Python/Python-ast.c	-	PyId_value	variable	_Py_IDENTIFIER(value)
-Python/Python-ast.c	-	PyId_values	variable	_Py_IDENTIFIER(values)
-Objects/abstract.c	PyMapping_Values	PyId_values	variable	_Py_IDENTIFIER(values)
-Objects/descrobject.c	mappingproxy_values	PyId_values	variable	_Py_IDENTIFIER(values)
-Python/Python-ast.c	-	PyId_vararg	variable	_Py_IDENTIFIER(vararg)
-Python/_warnings.c	already_warned	PyId_version	variable	_Py_IDENTIFIER(version)
-Python/_warnings.c	call_show_warning	PyId_WarningMessage	variable	_Py_IDENTIFIER(WarningMessage)
-Python/_warnings.c	setup_context	PyId___warningregistry__	variable	_Py_IDENTIFIER(__warningregistry__)
-Python/_warnings.c	get_warnings_attr	PyId_warnings	variable	_Py_IDENTIFIER(warnings)
-Python/sysmodule.c	-	PyId_warnoptions	variable	_Py_IDENTIFIER(warnoptions)
-Python/_warnings.c	_PyErr_WarnUnawaitedCoroutine	PyId__warn_unawaited_coroutine	variable	_Py_IDENTIFIER(_warn_unawaited_coroutine)
-Modules/_io/bufferedio.c	-	PyId_writable	variable	_Py_IDENTIFIER(writable)
-Modules/_io/textio.c	-	PyId_writable	variable	_Py_IDENTIFIER(writable)
-Python/sysmodule.c	-	PyId_write	variable	_Py_IDENTIFIER(write)
-Modules/_io/bufferedio.c	-	PyId_write	variable	_Py_IDENTIFIER(write)
-Python/marshal.c	marshal_dump_impl	PyId_write	variable	_Py_IDENTIFIER(write)
-Objects/fileobject.c	PyFile_WriteObject	PyId_write	variable	_Py_IDENTIFIER(write)
-Python/sysmodule.c	-	PyId__xoptions	variable	_Py_IDENTIFIER(_xoptions)
-Python/import.c	_PyImportZip_Init	PyId_zipimporter	variable	_Py_IDENTIFIER(zipimporter)
-Python/initconfig.c	-	Py_IgnoreEnvironmentFlag	variable	int Py_IgnoreEnvironmentFlag
-Python/dynload_shlib.c	-	_PyImport_DynLoadFiletab	variable	const char *_PyImport_DynLoadFiletab[]
-Python/frozen.c	-	PyImport_FrozenModules	variable	const struct _frozen * PyImport_FrozenModules
-Modules/config.c	-	_PyImport_Inittab	variable	struct _inittab _PyImport_Inittab[]
-Python/import.c	-	PyImport_Inittab	variable	struct _inittab * PyImport_Inittab
-Modules/_io/textio.c	-	PyIncrementalNewlineDecoder_Type	variable	PyTypeObject PyIncrementalNewlineDecoder_Type
-Python/initconfig.c	-	Py_InspectFlag	variable	int Py_InspectFlag
-Objects/classobject.c	-	PyInstanceMethod_Type	variable	PyTypeObject PyInstanceMethod_Type
-Python/initconfig.c	-	Py_InteractiveFlag	variable	int Py_InteractiveFlag
-Objects/interpreteridobject.c	-	_PyInterpreterID_Type	variable	PyTypeObject _PyInterpreterID_Type
-Modules/_io/iobase.c	-	PyIOBase_Type	variable	PyTypeObject PyIOBase_Type
-Modules/_io/_iomodule.c	-	_PyIO_empty_bytes	variable	PyObject *_PyIO_empty_bytes
-Modules/_io/_iomodule.c	-	_PyIO_empty_str	variable	PyObject *_PyIO_empty_str
-Modules/_io/_iomodule.c	-	_PyIO_Module	variable	struct PyModuleDef _PyIO_Module
-Modules/_io/_iomodule.c	-	_PyIO_str_close	variable	PyObject *_PyIO_str_close
-Modules/_io/_iomodule.c	-	_PyIO_str_closed	variable	PyObject *_PyIO_str_closed
-Modules/_io/_iomodule.c	-	_PyIO_str_decode	variable	PyObject *_PyIO_str_decode
-Modules/_io/_iomodule.c	-	_PyIO_str_encode	variable	PyObject *_PyIO_str_encode
-Modules/_io/_iomodule.c	-	_PyIO_str_fileno	variable	PyObject *_PyIO_str_fileno
-Modules/_io/_iomodule.c	-	_PyIO_str_flush	variable	PyObject *_PyIO_str_flush
-Modules/_io/_iomodule.c	-	_PyIO_str_getstate	variable	PyObject *_PyIO_str_getstate
-Modules/_io/_iomodule.c	-	_PyIO_str_isatty	variable	PyObject *_PyIO_str_isatty
-Modules/_io/_iomodule.c	-	_PyIO_str_newlines	variable	PyObject *_PyIO_str_newlines
-Modules/_io/_iomodule.c	-	_PyIO_str_nl	variable	PyObject *_PyIO_str_nl
-Modules/_io/_iomodule.c	-	_PyIO_str_peek	variable	PyObject *_PyIO_str_peek
-Modules/_io/_iomodule.c	-	_PyIO_str_read	variable	PyObject *_PyIO_str_read
-Modules/_io/_iomodule.c	-	_PyIO_str_read1	variable	PyObject *_PyIO_str_read1
-Modules/_io/_iomodule.c	-	_PyIO_str_readable	variable	PyObject *_PyIO_str_readable
-Modules/_io/_iomodule.c	-	_PyIO_str_readall	variable	PyObject *_PyIO_str_readall
-Modules/_io/_iomodule.c	-	_PyIO_str_readinto	variable	PyObject *_PyIO_str_readinto
-Modules/_io/_iomodule.c	-	_PyIO_str_readline	variable	PyObject *_PyIO_str_readline
-Modules/_io/_iomodule.c	-	_PyIO_str_reset	variable	PyObject *_PyIO_str_reset
-Modules/_io/_iomodule.c	-	_PyIO_str_seek	variable	PyObject *_PyIO_str_seek
-Modules/_io/_iomodule.c	-	_PyIO_str_seekable	variable	PyObject *_PyIO_str_seekable
-Modules/_io/_iomodule.c	-	_PyIO_str_setstate	variable	PyObject *_PyIO_str_setstate
-Modules/_io/_iomodule.c	-	_PyIO_str_tell	variable	PyObject *_PyIO_str_tell
-Modules/_io/_iomodule.c	-	_PyIO_str_truncate	variable	PyObject *_PyIO_str_truncate
-Modules/_io/_iomodule.c	-	_PyIO_str_writable	variable	PyObject *_PyIO_str_writable
-Modules/_io/_iomodule.c	-	_PyIO_str_write	variable	PyObject *_PyIO_str_write
-Python/initconfig.c	-	Py_IsolatedFlag	variable	int Py_IsolatedFlag
-Objects/listobject.c	-	PyListIter_Type	variable	PyTypeObject PyListIter_Type
-Objects/listobject.c	-	PyListRevIter_Type	variable	PyTypeObject PyListRevIter_Type
-Objects/listobject.c	-	PyList_Type	variable	PyTypeObject PyList_Type
-Modules/_localemodule.c	-	PyLocale_Methods	variable	static struct PyMethodDef PyLocale_Methods[]
-Objects/longobject.c	-	_PyLong_DigitValue	variable	unsigned char _PyLong_DigitValue[256]
-Objects/longobject.c	-	_PyLong_One	variable	PyObject *_PyLong_One
-Objects/rangeobject.c	-	PyLongRangeIter_Type	variable	PyTypeObject PyLongRangeIter_Type
-Objects/longobject.c	-	PyLong_Type	variable	PyTypeObject PyLong_Type
-Objects/longobject.c	-	_PyLong_Zero	variable	PyObject *_PyLong_Zero
-Objects/memoryobject.c	-	_PyManagedBuffer_Type	variable	PyTypeObject _PyManagedBuffer_Type
-Python/bltinmodule.c	-	PyMap_Type	variable	PyTypeObject PyMap_Type
-Objects/obmalloc.c	-	_PyMem	variable	static PyMemAllocatorEx _PyMem
-Objects/descrobject.c	-	PyMemberDescr_Type	variable	PyTypeObject PyMemberDescr_Type
-Objects/obmalloc.c	-	_PyMem_Debug	variable	static struct { debug_alloc_api_t raw; debug_alloc_api_t mem; debug_alloc_api_t obj; } _PyMem_Debug
-Objects/memoryobject.c	-	PyMemoryView_Type	variable	PyTypeObject PyMemoryView_Type
-Objects/obmalloc.c	-	_PyMem_Raw	variable	static PyMemAllocatorEx _PyMem_Raw
-Objects/descrobject.c	-	PyMethodDescr_Type	variable	PyTypeObject PyMethodDescr_Type
-Objects/classobject.c	-	PyMethod_Type	variable	PyTypeObject PyMethod_Type
-Objects/descrobject.c	-	_PyMethodWrapper_Type	variable	PyTypeObject _PyMethodWrapper_Type
-Objects/moduleobject.c	-	PyModuleDef_Type	variable	PyTypeObject PyModuleDef_Type
-Objects/moduleobject.c	-	PyModule_Type	variable	PyTypeObject PyModule_Type
-Objects/namespaceobject.c	-	_PyNamespace_Type	variable	PyTypeObject _PyNamespace_Type
-Objects/object.c	-	_Py_NoneStruct	variable	PyObject _Py_NoneStruct
-Objects/object.c	-	_PyNone_Type	variable	PyTypeObject _PyNone_Type
-Python/initconfig.c	-	Py_NoSiteFlag	variable	int Py_NoSiteFlag
-Objects/object.c	-	_Py_NotImplementedStruct	variable	PyObject _Py_NotImplementedStruct
-Objects/object.c	-	_PyNotImplemented_Type	variable	PyTypeObject _PyNotImplemented_Type
-Python/initconfig.c	-	Py_NoUserSiteDirectory	variable	int Py_NoUserSiteDirectory
-Objects/bytesobject.c	-	_Py_null_strings	variable	Py_ssize_t _Py_null_strings
-Objects/obmalloc.c	-	_PyObject	variable	static PyMemAllocatorEx _PyObject
-Objects/obmalloc.c	-	_PyObject_Arena	variable	static PyObjectArenaAllocator _PyObject_Arena
-Objects/odictobject.c	-	PyODictItems_Type	variable	PyTypeObject PyODictItems_Type
-Objects/odictobject.c	-	PyODictIter_Type	variable	PyTypeObject PyODictIter_Type
-Objects/odictobject.c	-	PyODictKeys_Type	variable	PyTypeObject PyODictKeys_Type
-Objects/odictobject.c	-	PyODict_Type	variable	PyTypeObject PyODict_Type
-Objects/odictobject.c	-	PyODictValues_Type	variable	PyTypeObject PyODictValues_Type
-Python/fileutils.c	-	_Py_open_cloexec_works	variable	int _Py_open_cloexec_works
-Objects/bytesobject.c	-	_Py_one_strings	variable	Py_ssize_t _Py_one_strings
-Python/initconfig.c	-	Py_OptimizeFlag	variable	int Py_OptimizeFlag
-Parser/myreadline.c	-	PyOS_InputHook	variable	int (*PyOS_InputHook)(void)
-Python/pylifecycle.c	-	_PyOS_mystrnicmp_hack	variable	int (*_PyOS_mystrnicmp_hack)(const char *, const char *, Py_ssize_t)
-Python/getopt.c	-	_PyOS_optarg	variable	const wchar_t *_PyOS_optarg
-Python/getopt.c	-	_PyOS_opterr	variable	int _PyOS_opterr
-Python/getopt.c	-	_PyOS_optind	variable	Py_ssize_t _PyOS_optind
-Parser/myreadline.c	-	PyOS_ReadlineFunctionPointer	variable	char *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, const char *)
-Parser/myreadline.c	-	_PyOS_ReadlineLock	variable	static PyThread_type_lock _PyOS_ReadlineLock
-Parser/myreadline.c	-	_PyOS_ReadlineTState	variable	PyThreadState* _PyOS_ReadlineTState
-Python/modsupport.c	-	_Py_PackageContext	variable	const char *_Py_PackageContext
-Python/graminit.c	-	_PyParser_Grammar	variable	grammar _PyParser_Grammar
-Python/pathconfig.c	-	_Py_path_config	variable	_PyPathConfig _Py_path_config
-Objects/picklebufobject.c	-	PyPickleBuffer_Type	variable	PyTypeObject PyPickleBuffer_Type
-Objects/descrobject.c	-	PyProperty_Type	variable	PyTypeObject PyProperty_Type
-Python/initconfig.c	-	Py_QuietFlag	variable	int Py_QuietFlag
-Objects.longobject.c	-	_Py_quick_int_allocs	variable	Py_ssize_t _Py_quick_int_allocs
-Objects.longobject.c	-	_Py_quick_new_int_allocs	variable	Py_ssize_t _Py_quick_new_int_allocs
-Objects/rangeobject.c	-	PyRangeIter_Type	variable	PyTypeObject PyRangeIter_Type
-Objects/rangeobject.c	-	PyRange_Type	variable	PyTypeObject PyRange_Type
-Modules/_io/iobase.c	-	PyRawIOBase_Type	variable	PyTypeObject PyRawIOBase_Type
-Objects/object.c	-	_Py_RefTotal	variable	Py_ssize_t _Py_RefTotal
-Objects/enumobject.c	-	PyReversed_Type	variable	PyTypeObject PyReversed_Type
-Python/pylifecycle.c	-	_PyRuntime	variable	_PyRuntimeState _PyRuntime
-Objects/iterobject.c	-	PySeqIter_Type	variable	PyTypeObject PySeqIter_Type
-Objects/setobject.c	-	_PySet_Dummy	variable	PyObject * _PySet_Dummy
-Objects/setobject.c	-	_PySetDummy_Type	variable	static PyTypeObject _PySetDummy_Type
-Objects/setobject.c	-	PySetIter_Type	variable	PyTypeObject PySetIter_Type
-Objects/setobject.c	-	PySet_Type	variable	PyTypeObject PySet_Type
-Objects/sliceobject.c	-	PySlice_Type	variable	PyTypeObject PySlice_Type
-Python/initconfig.c	-	_Py_StandardStreamEncoding	variable	static char *_Py_StandardStreamEncoding
-Python/initconfig.c	-	_Py_StandardStreamErrors	variable	static char *_Py_StandardStreamErrors
-Objects/funcobject.c	-	PyStaticMethod_Type	variable	PyTypeObject PyStaticMethod_Type
-Objects/fileobject.c	-	PyStdPrinter_Type	variable	PyTypeObject PyStdPrinter_Type
-Python/symtable.c	-	PySTEntry_Type	variable	PyTypeObject PySTEntry_Type
-Modules/_io/stringio.c	-	PyStringIO_Type	variable	PyTypeObject PyStringIO_Type
-Objects/structseq.c	-	PyStructSequence_UnnamedField	variable	char *PyStructSequence_UnnamedField
-Objects/typeobject.c	-	PySuper_Type	variable	PyTypeObject PySuper_Type
-Objects/object.c	-	_Py_SwappedOp	variable	int _Py_SwappedOp[]
-Python/sysmodule.c	-	_PySys_ImplCacheTag	variable	const char *_PySys_ImplCacheTag
-Python/sysmodule.c	-	_PySys_ImplName	variable	const char *_PySys_ImplName
-Modules/_io/textio.c	-	PyTextIOBase_Type	variable	PyTypeObject PyTextIOBase_Type
-Modules/_io/textio.c	-	PyTextIOWrapper_Type	variable	PyTypeObject PyTextIOWrapper_Type
-Python/traceback.c	-	PyTraceBack_Type	variable	PyTypeObject PyTraceBack_Type
-Objects/obmalloc.c	-	_Py_tracemalloc_config	variable	struct _PyTraceMalloc_Config _Py_tracemalloc_config
-Objects/boolobject.c	-	_Py_TrueStruct	variable	static struct _longobject _Py_TrueStruct
-Objects/tupleobject.c	-	PyTupleIter_Type	variable	PyTypeObject PyTupleIter_Type
-Objects/tupleobject.c	-	PyTuple_Type	variable	PyTypeObject PyTuple_Type
-Objects/tupleobject.c	-	_Py_tuple_zero_allocs	variable	Py_ssize_t _Py_tuple_zero_allocs
-Objects/typeobject.c	-	PyType_Type	variable	PyTypeObject PyType_Type
-Python/initconfig.c	-	Py_UnbufferedStdioFlag	variable	int Py_UnbufferedStdioFlag
-Python/pylifecycle.c	-	_Py_UnhandledKeyboardInterrupt	variable	int _Py_UnhandledKeyboardInterrupt
-Objects/unicodeobject.c	-	PyUnicodeIter_Type	variable	PyTypeObject PyUnicodeIter_Type
-Objects/unicodeobject.c	-	PyUnicode_Type	variable	PyTypeObject PyUnicode_Type
-Python/initconfig.c	-	Py_UTF8Mode	variable	int Py_UTF8Mode
-Python/initconfig.c	-	Py_VerboseFlag	variable	int Py_VerboseFlag
-Objects/weakrefobject.c	-	_PyWeakref_CallableProxyType	variable	PyTypeObject _PyWeakref_CallableProxyType
-Objects/weakrefobject.c	-	_PyWeakref_ProxyType	variable	PyTypeObject _PyWeakref_ProxyType
-Objects/weakrefobject.c	-	_PyWeakref_RefType	variable	PyTypeObject _PyWeakref_RefType
-Objects/weakrefobject.c	-	_PyWeakref_RefType	variable	PyTypeObject _PyWeakref_RefType
-Objects/descrobject.c	-	PyWrapperDescr_Type	variable	PyTypeObject PyWrapperDescr_Type
-Python/bltinmodule.c	-	PyZip_Type	variable	PyTypeObject PyZip_Type
-Python/Python-ast.c	-	Raise_fields	variable	static const char *Raise_fields[]
-Python/Python-ast.c	-	Raise_type	variable	static PyTypeObject *Raise_type
-Objects/rangeobject.c	-	range_as_mapping	variable	static PyMappingMethods range_as_mapping
-Objects/rangeobject.c	-	range_as_number	variable	static PyNumberMethods range_as_number
-Objects/rangeobject.c	-	range_as_sequence	variable	static PySequenceMethods range_as_sequence
-Objects/rangeobject.c	-	rangeiter_methods	variable	static PyMethodDef rangeiter_methods
-Objects/rangeobject.c	-	range_members	variable	static PyMemberDef range_members[]
-Objects/rangeobject.c	-	range_methods	variable	static PyMethodDef range_methods
-Modules/_io/iobase.c	-	rawiobase_methods	variable	static PyMethodDef rawiobase_methods
-Python/pylifecycle.c	fatal_error	reentrant	variable	static int reentrant
-Modules/faulthandler.c	faulthandler_dump_traceback	reentrant	variable	static volatile int reentrant
-Modules/itertoolsmodule.c	-	repeat_methods	variable	static PyMethodDef repeat_methods
-Modules/itertoolsmodule.c	-	repeat_type	variable	static PyTypeObject repeat_type
-Python/Python-ast.c	-	Return_fields	variable	static const char *Return_fields[]
-Python/compile.c	compiler_visit_annotations	return_str	variable	static identifier return_str
-Python/Python-ast.c	-	Return_type	variable	static PyTypeObject *Return_type
-Objects/enumobject.c	-	reversediter_methods	variable	static PyMethodDef reversediter_methods
-Modules/_threadmodule.c	-	rlock_methods	variable	static PyMethodDef rlock_methods
-Modules/_threadmodule.c	-	RLocktype	variable	static PyTypeObject RLocktype
-Objects/typeobject.c	slot_nb_add	rop_id	variable	_Py_static_string(op_id, OPSTR)
-Objects/typeobject.c	slot_nb_subtract	rop_id	variable	_Py_static_string(op_id, OPSTR)
-Objects/typeobject.c	slot_nb_multiply	rop_id	variable	_Py_static_string(op_id, OPSTR)
-Objects/typeobject.c	slot_nb_matrix_multiply	rop_id	variable	_Py_static_string(op_id, OPSTR)
-Objects/typeobject.c	slot_nb_remainder	rop_id	variable	_Py_static_string(op_id, OPSTR)
-Objects/typeobject.c	slot_nb_divmod	rop_id	variable	_Py_static_string(op_id, OPSTR)
-Objects/typeobject.c	slot_nb_power_binary	rop_id	variable	_Py_static_string(op_id, OPSTR)
-Objects/typeobject.c	slot_nb_lshift	rop_id	variable	_Py_static_string(op_id, OPSTR)
-Objects/typeobject.c	slot_nb_rshift	rop_id	variable	_Py_static_string(op_id, OPSTR)
-Objects/typeobject.c	slot_nb_and	rop_id	variable	_Py_static_string(op_id, OPSTR)
-Objects/typeobject.c	slot_nb_xor	rop_id	variable	_Py_static_string(op_id, OPSTR)
-Objects/typeobject.c	slot_nb_or	rop_id	variable	_Py_static_string(op_id, OPSTR)
-Objects/typeobject.c	slot_nb_floor_divide	rop_id	variable	_Py_static_string(op_id, OPSTR)
-Objects/typeobject.c	slot_nb_true_divide	rop_id	variable	_Py_static_string(op_id, OPSTR)
-Python/Python-ast.c	-	RShift_singleton	variable	static PyObject *RShift_singleton
-Python/Python-ast.c	-	RShift_type	variable	static PyTypeObject *RShift_type
-Python/pylifecycle.c	-	runtime_initialized	variable	static int runtime_initialized
-Modules/posixmodule.c	-	ScandirIterator_methods	variable	static PyMethodDef ScandirIterator_methods
-Modules/posixmodule.c	-	ScandirIteratorType	variable	static PyTypeObject ScandirIteratorType
-Modules/_sre.c	-	scanner_members	variable	static PyMemberDef scanner_members[]
-Modules/_sre.c	-	scanner_methods	variable	static PyMethodDef scanner_methods
-Modules/_sre.c	-	Scanner_Type	variable	static PyTypeObject Scanner_Type
-Modules/posixmodule.c	-	sched_param_desc	variable	static PyStructSequence_Desc sched_param_desc
-Modules/posixmodule.c	-	sched_param_fields	variable	static PyStructSequence_Field sched_param_fields[]
-Modules/posixmodule.c	-	SchedParamType	variable	static PyTypeObject* SchedParamType
-Objects/iterobject.c	-	seqiter_methods	variable	static PyMethodDef seqiter_methods
-Objects/setobject.c	-	set_as_number	variable	static PyNumberMethods set_as_number
-Objects/setobject.c	-	set_as_sequence	variable	static PySequenceMethods set_as_sequence
-Python/symtable.c	-	setcomp	variable	static identifier setcomp
-Python/Python-ast.c	-	SetComp_fields	variable	static const char *SetComp_fields[]
-Python/Python-ast.c	-	SetComp_type	variable	static PyTypeObject *SetComp_type
-Python/Python-ast.c	-	Set_fields	variable	static const char *Set_fields[]
-Objects/setobject.c	-	setiter_methods	variable	static PyMethodDef setiter_methods
-Objects/setobject.c	-	set_methods	variable	static PyMethodDef set_methods
-Python/Python-ast.c	-	Set_type	variable	static PyTypeObject *Set_type
-Modules/signalmodule.c	-	SiginfoType	variable	static PyTypeObject SiginfoType
-Modules/signalmodule.c	-	signal_methods	variable	static PyMethodDef signal_methods
-Modules/signalmodule.c	-	signalmodule	variable	static struct PyModuleDef signalmodule
-Python/import.c	PyImport_Import	silly_list	variable	static PyObject *silly_list
-Objects/sliceobject.c	-	slice_cache	variable	static PySliceObject *slice_cache
-Python/Python-ast.c	-	Slice_fields	variable	static const char *Slice_fields[]
-Objects/sliceobject.c	-	slice_members	variable	static PyMemberDef slice_members[]
-Objects/sliceobject.c	-	slice_methods	variable	static PyMethodDef slice_methods
-Python/Python-ast.c	-	slice_type	variable	static PyTypeObject *slice_type
-Python/Python-ast.c	-	Slice_type	variable	static PyTypeObject *Slice_type
-Objects/typeobject.c	-	slotdefs	variable	static slotdef slotdefs[]
-Objects/typeobject.c	-	slotdefs_initialized	variable	static int slotdefs_initialized
-Objects/longobject.c	-	small_ints	variable	static PyLongObject small_ints[NSMALLNEGINTS + NSMALLPOSINTS]
-Objects/funcobject.c	-	sm_getsetlist	variable	static PyGetSetDef sm_getsetlist[]
-Objects/funcobject.c	-	sm_memberlist	variable	static PyMemberDef sm_memberlist[]
-Modules/xxsubtype.c	-	spamdict_members	variable	static PyMemberDef spamdict_members[]
-Modules/xxsubtype.c	-	spamdict_methods	variable	static PyMethodDef spamdict_methods
-Modules/xxsubtype.c	-	spamdict_type	variable	static PyTypeObject spamdict_type
-Modules/xxsubtype.c	-	spamlist_getsets	variable	static PyGetSetDef spamlist_getsets[]
-Modules/xxsubtype.c	-	spamlist_methods	variable	static PyMethodDef spamlist_methods
-Modules/xxsubtype.c	-	spamlist_type	variable	static PyTypeObject spamlist_type
-Modules/_sre.c	-	sremodule	variable	static struct PyModuleDef sremodule
-Modules/faulthandler.c	-	stack	variable	static stack_t stack
-Modules/itertoolsmodule.c	-	starmap_methods	variable	static PyMethodDef starmap_methods
-Modules/itertoolsmodule.c	-	starmap_type	variable	static PyTypeObject starmap_type
-Python/Python-ast.c	-	Starred_fields	variable	static const char *Starred_fields[]
-Python/Python-ast.c	-	Starred_type	variable	static PyTypeObject *Starred_type
-Python/graminit.c	-	states_0	variable	static state states_0[3]
-Python/graminit.c	-	states_1	variable	static state states_1[2]
-Python/graminit.c	-	states_10	variable	static state states_10[4]
-Python/graminit.c	-	states_11	variable	static state states_11[34]
-Python/graminit.c	-	states_12	variable	static state states_12[2]
-Python/graminit.c	-	states_13	variable	static state states_13[2]
-Python/graminit.c	-	states_14	variable	static state states_14[4]
-Python/graminit.c	-	states_15	variable	static state states_15[2]
-Python/graminit.c	-	states_16	variable	static state states_16[6]
-Python/graminit.c	-	states_17	variable	static state states_17[5]
-Python/graminit.c	-	states_18	variable	static state states_18[3]
-Python/graminit.c	-	states_19	variable	static state states_19[2]
-Python/graminit.c	-	states_2	variable	static state states_2[3]
-Python/graminit.c	-	states_20	variable	static state states_20[3]
-Python/graminit.c	-	states_21	variable	static state states_21[2]
-Python/graminit.c	-	states_22	variable	static state states_22[2]
-Python/graminit.c	-	states_23	variable	static state states_23[2]
-Python/graminit.c	-	states_24	variable	static state states_24[2]
-Python/graminit.c	-	states_25	variable	static state states_25[3]
-Python/graminit.c	-	states_26	variable	static state states_26[2]
-Python/graminit.c	-	states_27	variable	static state states_27[5]
-Python/graminit.c	-	states_28	variable	static state states_28[2]
-Python/graminit.c	-	states_29	variable	static state states_29[3]
-Python/graminit.c	-	states_3	variable	static state states_3[7]
-Python/graminit.c	-	states_30	variable	static state states_30[8]
-Python/graminit.c	-	states_31	variable	static state states_31[4]
-Python/graminit.c	-	states_32	variable	static state states_32[4]
-Python/graminit.c	-	states_33	variable	static state states_33[3]
-Python/graminit.c	-	states_34	variable	static state states_34[2]
-Python/graminit.c	-	states_35	variable	static state states_35[2]
-Python/graminit.c	-	states_36	variable	static state states_36[3]
-Python/graminit.c	-	states_37	variable	static state states_37[3]
-Python/graminit.c	-	states_38	variable	static state states_38[5]
-Python/graminit.c	-	states_39	variable	static state states_39[2]
-Python/graminit.c	-	states_4	variable	static state states_4[2]
-Python/graminit.c	-	states_40	variable	static state states_40[3]
-Python/graminit.c	-	states_41	variable	static state states_41[8]
-Python/graminit.c	-	states_42	variable	static state states_42[8]
-Python/graminit.c	-	states_43	variable	static state states_43[11]
-Python/graminit.c	-	states_44	variable	static state states_44[13]
-Python/graminit.c	-	states_45	variable	static state states_45[6]
-Python/graminit.c	-	states_46	variable	static state states_46[4]
-Python/graminit.c	-	states_47	variable	static state states_47[5]
-Python/graminit.c	-	states_48	variable	static state states_48[5]
-Python/graminit.c	-	states_49	variable	static state states_49[4]
-Python/graminit.c	-	states_5	variable	static state states_5[3]
-Python/graminit.c	-	states_50	variable	static state states_50[6]
-Python/graminit.c	-	states_51	variable	static state states_51[2]
-Python/graminit.c	-	states_52	variable	static state states_52[5]
-Python/graminit.c	-	states_53	variable	static state states_53[5]
-Python/graminit.c	-	states_54	variable	static state states_54[2]
-Python/graminit.c	-	states_55	variable	static state states_55[2]
-Python/graminit.c	-	states_56	variable	static state states_56[3]
-Python/graminit.c	-	states_57	variable	static state states_57[2]
-Python/graminit.c	-	states_58	variable	static state states_58[4]
-Python/graminit.c	-	states_59	variable	static state states_59[3]
-Python/graminit.c	-	states_6	variable	static state states_6[3]
-Python/graminit.c	-	states_60	variable	static state states_60[2]
-Python/graminit.c	-	states_61	variable	static state states_61[2]
-Python/graminit.c	-	states_62	variable	static state states_62[2]
-Python/graminit.c	-	states_63	variable	static state states_63[2]
-Python/graminit.c	-	states_64	variable	static state states_64[2]
-Python/graminit.c	-	states_65	variable	static state states_65[2]
-Python/graminit.c	-	states_66	variable	static state states_66[3]
-Python/graminit.c	-	states_67	variable	static state states_67[4]
-Python/graminit.c	-	states_68	variable	static state states_68[3]
-Python/graminit.c	-	states_69	variable	static state states_69[9]
-Python/graminit.c	-	states_7	variable	static state states_7[9]
-Python/graminit.c	-	states_70	variable	static state states_70[5]
-Python/graminit.c	-	states_71	variable	static state states_71[7]
-Python/graminit.c	-	states_72	variable	static state states_72[3]
-Python/graminit.c	-	states_73	variable	static state states_73[5]
-Python/graminit.c	-	states_74	variable	static state states_74[3]
-Python/graminit.c	-	states_75	variable	static state states_75[3]
-Python/graminit.c	-	states_76	variable	static state states_76[3]
-Python/graminit.c	-	states_77	variable	static state states_77[14]
-Python/graminit.c	-	states_78	variable	static state states_78[8]
-Python/graminit.c	-	states_79	variable	static state states_79[3]
-Python/graminit.c	-	states_8	variable	static state states_8[4]
-Python/graminit.c	-	states_80	variable	static state states_80[4]
-Python/graminit.c	-	states_81	variable	static state states_81[2]
-Python/graminit.c	-	states_82	variable	static state states_82[6]
-Python/graminit.c	-	states_83	variable	static state states_83[3]
-Python/graminit.c	-	states_84	variable	static state states_84[4]
-Python/graminit.c	-	states_85	variable	static state states_85[2]
-Python/graminit.c	-	states_86	variable	static state states_86[3]
-Python/graminit.c	-	states_87	variable	static state states_87[3]
-Python/graminit.c	-	states_88	variable	static state states_88[7]
-Python/graminit.c	-	states_89	variable	static state states_89[3]
-Python/graminit.c	-	states_9	variable	static state states_9[42]
-Python/graminit.c	-	states_90	variable	static state states_90[6]
-Python/graminit.c	-	states_91	variable	static state states_91[11]
-Python/getargs.c	-	static_arg_parsers	variable	static struct _PyArg_Parser *static_arg_parsers
-Objects/unicodeobject.c	-	static_strings	variable	static _Py_Identifier *static_strings
-Modules/_stat.c	-	stat_methods	variable	static PyMethodDef stat_methods
-Modules/_stat.c	-	statmodule	variable	static struct PyModuleDef statmodule
-Modules/posixmodule.c	-	stat_result_desc	variable	static PyStructSequence_Desc stat_result_desc
-Modules/posixmodule.c	-	stat_result_fields	variable	static PyStructSequence_Field stat_result_fields[]
-Modules/posixmodule.c	-	StatResultType	variable	static PyTypeObject* StatResultType
-Modules/posixmodule.c	-	statvfs_result_desc	variable	static PyStructSequence_Desc statvfs_result_desc
-Modules/posixmodule.c	-	statvfs_result_fields	variable	static PyStructSequence_Field statvfs_result_fields[]
-Modules/posixmodule.c	-	StatVFSResultType	variable	static PyTypeObject* StatVFSResultType
-Objects/fileobject.c	-	stdprinter_getsetlist	variable	static PyGetSetDef stdprinter_getsetlist[]
-Objects/fileobject.c	-	stdprinter_methods	variable	static PyMethodDef stdprinter_methods
-Python/symtable.c	-	ste_memberlist	variable	static PyMemberDef ste_memberlist[]
-Python/Python-ast.c	-	stmt_attributes	variable	static const char *stmt_attributes[]
-Python/Python-ast.c	-	stmt_type	variable	static PyTypeObject *stmt_type
-Objects/exceptions.c	-	StopIteration_members	variable	static PyMemberDef StopIteration_members[]
-Python/Python-ast.c	-	Store_singleton	variable	static PyObject *Store_singleton
-Python/Python-ast.c	-	Store_type	variable	static PyTypeObject *Store_type
-Python/ast_unparse.c	-	_str_close_br	variable	static PyObject *_str_close_br
-Python/ast_unparse.c	-	_str_dbl_close_br	variable	static PyObject *_str_dbl_close_br
-Python/ast_unparse.c	-	_str_dbl_open_br	variable	static PyObject *_str_dbl_open_br
-Modules/_threadmodule.c	-	str_dict	variable	static PyObject *str_dict
-Modules/_io/stringio.c	-	stringio_getset	variable	static PyGetSetDef stringio_getset[]
-Modules/_io/stringio.c	-	stringio_methods	variable	static PyMethodDef stringio_methods
-Objects/unicodeobject.c	-	_string_methods	variable	static PyMethodDef _string_methods
-Objects/unicodeobject.c	-	_string_module	variable	static struct PyModuleDef _string_module
-Objects/bytesobject.c	-	striter_methods	variable	static PyMethodDef striter_methods
-Python/ast_unparse.c	-	_str_open_br	variable	static PyObject *_str_open_br
-Modules/pwdmodule.c	-	StructPwdType	variable	static PyTypeObject StructPwdType
-Modules/pwdmodule.c	-	struct_pwd_type_desc	variable	static PyStructSequence_Desc struct_pwd_type_desc
-Modules/pwdmodule.c	-	struct_pwd_type_fields	variable	static PyStructSequence_Field struct_pwd_type_fields[]
-Modules/posixmodule.c	wait_helper	struct_rusage	variable	static PyObject *struct_rusage
-Objects/structseq.c	-	structseq_methods	variable	static PyMethodDef structseq_methods
-Modules/posixmodule.c	-	structseq_new	variable	static newfunc structseq_new
-Modules/signalmodule.c	-	struct_siginfo_desc	variable	static PyStructSequence_Desc struct_siginfo_desc
-Modules/signalmodule.c	-	struct_siginfo_fields	variable	static PyStructSequence_Field struct_siginfo_fields[]
-Modules/timemodule.c	-	StructTimeType	variable	static PyTypeObject StructTimeType
-Modules/timemodule.c	-	struct_time_type_desc	variable	static PyStructSequence_Desc struct_time_type_desc
-Modules/timemodule.c	-	struct_time_type_fields	variable	static PyStructSequence_Field struct_time_type_fields[]
-Python/Python-ast.c	-	Subscript_fields	variable	static const char *Subscript_fields[]
-Python/Python-ast.c	-	Subscript_type	variable	static PyTypeObject *Subscript_type
-Python/Python-ast.c	-	Sub_singleton	variable	static PyObject *Sub_singleton
-Python/Python-ast.c	-	Sub_type	variable	static PyTypeObject *Sub_type
-Objects/typeobject.c	-	subtype_getsets_dict_only	variable	static PyGetSetDef subtype_getsets_dict_only[]
-Objects/typeobject.c	-	subtype_getsets_full	variable	static PyGetSetDef subtype_getsets_full[]
-Objects/typeobject.c	-	subtype_getsets_weakref_only	variable	static PyGetSetDef subtype_getsets_weakref_only[]
-Python/Python-ast.c	-	Suite_fields	variable	static const char *Suite_fields[]
-Python/Python-ast.c	-	Suite_type	variable	static PyTypeObject *Suite_type
-Objects/typeobject.c	-	super_members	variable	static PyMemberDef super_members[]
-Modules/symtablemodule.c	-	symtable_methods	variable	static PyMethodDef symtable_methods
-Modules/symtablemodule.c	-	symtablemodule	variable	static struct PyModuleDef symtablemodule
-Objects/exceptions.c	-	SyntaxError_members	variable	static PyMemberDef SyntaxError_members[]
-Python/sysmodule.c	-	sys_methods	variable	static PyMethodDef sys_methods
-Python/sysmodule.c	-	sysmodule	variable	static struct PyModuleDef sysmodule
-Objects/exceptions.c	-	SystemExit_members	variable	static PyMemberDef SystemExit_members[]
-Modules/_tracemalloc.c	-	tables_lock	variable	static PyThread_type_lock tables_lock
-Modules/itertoolsmodule.c	-	takewhile_reduce_methods	variable	static PyMethodDef takewhile_reduce_methods
-Modules/itertoolsmodule.c	-	takewhile_type	variable	static PyTypeObject takewhile_type
-Python/pylifecycle.c	-	_TARGET_LOCALES	variable	static _LocaleCoercionTarget _TARGET_LOCALES[]
-Python/traceback.c	-	tb_getsetters	variable	static PyGetSetDef tb_getsetters[]
-Python/traceback.c	-	tb_memberlist	variable	static PyMemberDef tb_memberlist[]
-Python/traceback.c	-	tb_methods	variable	static PyMethodDef tb_methods
-Modules/itertoolsmodule.c	-	teedataobject_methods	variable	static PyMethodDef teedataobject_methods
-Modules/itertoolsmodule.c	-	teedataobject_type	variable	static PyTypeObject teedataobject_type
-Modules/itertoolsmodule.c	-	tee_methods	variable	static PyMethodDef tee_methods
-Modules/itertoolsmodule.c	-	tee_type	variable	static PyTypeObject tee_type
-Modules/posixmodule.c	-	TerminalSize_desc	variable	static PyStructSequence_Desc TerminalSize_desc
-Modules/posixmodule.c	-	TerminalSize_fields	variable	static PyStructSequence_Field TerminalSize_fields[]
-Modules/posixmodule.c	-	TerminalSizeType	variable	static PyTypeObject* TerminalSizeType
-Modules/_io/textio.c	-	textiobase_getset	variable	static PyGetSetDef textiobase_getset[]
-Modules/_io/textio.c	-	textiobase_methods	variable	static PyMethodDef textiobase_methods
-Modules/_io/textio.c	-	textiowrapper_getset	variable	static PyGetSetDef textiowrapper_getset[]
-Modules/_io/textio.c	-	textiowrapper_members	variable	static PyMemberDef textiowrapper_members[]
-Modules/_io/textio.c	-	textiowrapper_methods	variable	static PyMethodDef textiowrapper_methods
-Modules/faulthandler.c	-	thread	variable	static struct { PyObject *file; int fd; PY_TIMEOUT_T timeout_us; int repeat; PyInterpreterState *interp; int exit; char *header; size_t header_len; PyThread_type_lock cancel_event; PyThread_type_lock running; } thread
-Python/thread.c	-	thread_debug	variable	static int thread_debug
-Modules/_threadmodule.c	-	ThreadError	variable	static PyObject *ThreadError
-Python/thread.c	-	threadinfo_desc	variable	static PyStructSequence_Desc threadinfo_desc
-Python/thread.c	-	threadinfo_fields	variable	static PyStructSequence_Field threadinfo_fields[]
-Python/thread.c	-	ThreadInfoType	variable	static PyTypeObject ThreadInfoType
-Modules/_threadmodule.c	-	thread_methods	variable	static PyMethodDef thread_methods
-Modules/_threadmodule.c	-	threadmodule	variable	static struct PyModuleDef threadmodule
-Modules/posixmodule.c	-	ticks_per_second	variable	static long ticks_per_second
-Modules/timemodule.c	_PyTime_GetProcessTimeWithInfo	ticks_per_second	variable	static long ticks_per_second
-Modules/timemodule.c	-	time_methods	variable	static PyMethodDef time_methods
-Modules/timemodule.c	-	timemodule	variable	static struct PyModuleDef timemodule
-Modules/posixmodule.c	-	times_result_desc	variable	static PyStructSequence_Desc times_result_desc
-Modules/posixmodule.c	-	times_result_fields	variable	static PyStructSequence_Field times_result_fields[]
-Modules/posixmodule.c	-	TimesResultType	variable	static PyTypeObject* TimesResultType
-Python/context.c	-	_token_missing	variable	static PyObject *_token_missing
-Python/symtable.c	-	top	variable	static identifier top
-Objects/typeobject.c	-	tp_new_methoddef	variable	static struct PyMethodDef tp_new_methoddef[]
-Modules/_tracemalloc.c	-	tracemalloc_empty_traceback	variable	static traceback_t tracemalloc_empty_traceback
-Modules/_tracemalloc.c	-	tracemalloc_filenames	variable	static _Py_hashtable_t *tracemalloc_filenames
-Modules/_tracemalloc.c	-	tracemalloc_peak_traced_memory	variable	static size_t tracemalloc_peak_traced_memory
-Modules/_tracemalloc.c	-	tracemalloc_reentrant_key	variable	static Py_tss_t tracemalloc_reentrant_key
-Modules/_tracemalloc.c	-	tracemalloc_traceback	variable	static traceback_t *tracemalloc_traceback
-Modules/_tracemalloc.c	-	tracemalloc_tracebacks	variable	static _Py_hashtable_t *tracemalloc_tracebacks
-Modules/_tracemalloc.c	-	tracemalloc_traced_memory	variable	static size_t tracemalloc_traced_memory
-Modules/_tracemalloc.c	-	tracemalloc_traces	variable	static _Py_hashtable_t *tracemalloc_traces
-Objects/boolobject.c	-	true_str	variable	static PyObject *true_str
-Python/Python-ast.c	-	Try_fields	variable	static const char *Try_fields[]
-Python/Python-ast.c	-	Try_type	variable	static PyTypeObject *Try_type
-Objects/tupleobject.c	-	tuple_as_mapping	variable	static PyMappingMethods tuple_as_mapping
-Objects/tupleobject.c	-	tuple_as_sequence	variable	static PySequenceMethods tuple_as_sequence
-Python/Python-ast.c	-	Tuple_fields	variable	static const char *Tuple_fields[]
-Modules/_collectionsmodule.c	-	tuplegetter_members	variable	static PyMemberDef tuplegetter_members[]
-Modules/_collectionsmodule.c	-	tuplegetter_methods	variable	static PyMethodDef tuplegetter_methods
-Modules/_collectionsmodule.c	-	tuplegetter_type	variable	static PyTypeObject tuplegetter_type
-Objects/tupleobject.c	-	tupleiter_methods	variable	static PyMethodDef tupleiter_methods
-Objects/tupleobject.c	-	tuple_methods	variable	static PyMethodDef tuple_methods
-Python/Python-ast.c	-	Tuple_type	variable	static PyTypeObject *Tuple_type
-Objects/typeobject.c	-	type_getsets	variable	static PyGetSetDef type_getsets[]
-Python/Python-ast.c	-	TypeIgnore_fields	variable	static const char *TypeIgnore_fields[]
-Python/Python-ast.c	-	type_ignore_type	variable	static PyTypeObject *type_ignore_type
-Python/Python-ast.c	-	TypeIgnore_type	variable	static PyTypeObject *TypeIgnore_type
-Objects/typeobject.c	-	type_members	variable	static PyMemberDef type_members[]
-Objects/typeobject.c	-	type_methods	variable	static PyMethodDef type_methods
-Python/Python-ast.c	-	UAdd_singleton	variable	static PyObject *UAdd_singleton
-Python/Python-ast.c	-	UAdd_type	variable	static PyTypeObject *UAdd_type
-Objects/unicodeobject.c	-	ucnhash_CAPI	variable	static _PyUnicode_Name_CAPI *ucnhash_CAPI
-Python/codecs.c	-	ucnhash_CAPI	variable	static _PyUnicode_Name_CAPI *ucnhash_CAPI
-Python/ast.c	-	u_kind	variable	static PyObject *u_kind
-Modules/posixmodule.c	-	uname_result_desc	variable	static PyStructSequence_Desc uname_result_desc
-Modules/posixmodule.c	-	uname_result_fields	variable	static PyStructSequence_Field uname_result_fields[]
-Modules/posixmodule.c	-	UnameResultType	variable	static PyTypeObject* UnameResultType
-Python/Python-ast.c	-	UnaryOp_fields	variable	static const char *UnaryOp_fields[]
-Python/Python-ast.c	-	unaryop_type	variable	static PyTypeObject *unaryop_type
-Python/Python-ast.c	-	UnaryOp_type	variable	static PyTypeObject *UnaryOp_type
-Objects/unicodeobject.c	-	unicode_as_mapping	variable	static PyMappingMethods unicode_as_mapping
-Objects/unicodeobject.c	-	unicode_as_number	variable	static PyNumberMethods unicode_as_number
-Objects/unicodeobject.c	-	unicode_as_sequence	variable	static PySequenceMethods unicode_as_sequence
-Objects/unicodeobject.c	-	unicode_empty	variable	static PyObject *unicode_empty
-Objects/exceptions.c	-	UnicodeError_members	variable	static PyMemberDef UnicodeError_members[]
-Objects/unicodeobject.c	-	unicodeiter_methods	variable	static PyMethodDef unicodeiter_methods
-Objects/unicodeobject.c	-	unicode_latin1	variable	static PyObject *unicode_latin1[256]
-Objects/unicodeobject.c	-	unicode_methods	variable	static PyMethodDef unicode_methods
-Modules/_tracemalloc.c	-	unknown_filename	variable	static PyObject *unknown_filename
-Python/errors.c	-	UnraisableHookArgs_desc	variable	static PyStructSequence_Desc UnraisableHookArgs_desc
-Python/errors.c	-	UnraisableHookArgs_fields	variable	static PyStructSequence_Field UnraisableHookArgs_fields[]
-Python/errors.c	-	UnraisableHookArgsType	variable	static PyTypeObject UnraisableHookArgsType
-Objects/obmalloc.c	-	unused_arena_objects	variable	static struct arena_object* unused_arena_objects
-Python/bootstrap_hash.c	-	urandom_cache	variable	static struct { int fd; dev_t st_dev; ino_t st_ino; } urandom_cache
-Objects/obmalloc.c	-	usable_arenas	variable	static struct arena_object* usable_arenas
-Objects/obmalloc.c	-	usedpools	variable	static poolp usedpools[2 * ((NB_SMALL_SIZE_CLASSES + 7) / 8) * 8]
-Modules/faulthandler.c	-	user_signals	variable	static user_signal_t *user_signals
-Python/Python-ast.c	-	USub_singleton	variable	static PyObject *USub_singleton
-Python/Python-ast.c	-	USub_type	variable	static PyTypeObject *USub_type
-Python/getversion.c	Py_GetVersion	version	variable	static char version[250]
-Python/sysmodule.c	-	version_info_desc	variable	static PyStructSequence_Desc version_info_desc
-Python/sysmodule.c	-	version_info_fields	variable	static PyStructSequence_Field version_info_fields[]
-Python/sysmodule.c	-	VersionInfoType	variable	static PyTypeObject VersionInfoType
-Modules/posixmodule.c	-	waitid_result_desc	variable	static PyStructSequence_Desc waitid_result_desc
-Modules/posixmodule.c	-	waitid_result_fields	variable	static PyStructSequence_Field waitid_result_fields[]
-Modules/posixmodule.c	-	WaitidResultType	variable	static PyTypeObject* WaitidResultType
-Modules/signalmodule.c	-	wakeup	variable	static volatile struct { SOCKET_T fd; int warn_on_full_buffer; int use_send; } wakeup
-Python/_warnings.c	-	warnings_functions	variable	static PyMethodDef warnings_functions[]
-Python/_warnings.c	-	warningsmodule	variable	static struct PyModuleDef warningsmodule
-Modules/_weakref.c	-	weakref_functions	variable	static PyMethodDef weakref_functions
-Objects/weakrefobject.c	-	weakref_members	variable	static PyMemberDef weakref_members[]
-Modules/_weakref.c	-	weakrefmodule	variable	static struct PyModuleDef weakrefmodule
-Python/sysmodule.c	-	whatstrings	variable	static PyObject *whatstrings[8]
-Python/Python-ast.c	-	While_fields	variable	static const char *While_fields[]
-Python/Python-ast.c	-	While_type	variable	static PyTypeObject *While_type
-Python/Python-ast.c	-	With_fields	variable	static const char *With_fields[]
-Python/Python-ast.c	-	withitem_fields	variable	static const char *withitem_fields[]
-Python/Python-ast.c	-	withitem_type	variable	static PyTypeObject *withitem_type
-Python/Python-ast.c	-	With_type	variable	static PyTypeObject *With_type
-Objects/descrobject.c	-	wrapperdescr_getset	variable	static PyGetSetDef wrapperdescr_getset[]
-Objects/descrobject.c	-	wrapper_getsets	variable	static PyGetSetDef wrapper_getsets[]
-Objects/descrobject.c	-	wrapper_members	variable	static PyMemberDef wrapper_members[]
-Objects/descrobject.c	-	wrapper_methods	variable	static PyMethodDef wrapper_methods
-Modules/_threadmodule.c	local_new	wr_callback_def	variable	static PyMethodDef wr_callback_def
-Modules/xxsubtype.c	-	xxsubtype_functions	variable	static PyMethodDef xxsubtype_functions[]
-Modules/xxsubtype.c	-	xxsubtypemodule	variable	static struct PyModuleDef xxsubtypemodule
-Modules/xxsubtype.c	-	xxsubtype_slots	variable	static struct PyModuleDef_Slot xxsubtype_slots[]
-Python/Python-ast.c	-	Yield_fields	variable	static const char *Yield_fields[]
-Python/Python-ast.c	-	YieldFrom_fields	variable	static const char *YieldFrom_fields[]
-Python/Python-ast.c	-	YieldFrom_type	variable	static PyTypeObject *YieldFrom_type
-Python/Python-ast.c	-	Yield_type	variable	static PyTypeObject *Yield_type
-Modules/itertoolsmodule.c	-	zip_longest_methods	variable	static PyMethodDef zip_longest_methods
-Modules/itertoolsmodule.c	-	ziplongest_type	variable	static PyTypeObject ziplongest_type
-Python/bltinmodule.c	-	zip_methods	variable	static PyMethodDef zip_methods
diff --git a/Tools/c-analyzer/must-resolve.sh b/Tools/c-analyzer/must-resolve.sh
new file mode 100755
index 0000000..191e422
--- /dev/null
+++ b/Tools/c-analyzer/must-resolve.sh
@@ -0,0 +1,75 @@
+#!/usr/bin/env bash
+
+# Any PyObject exposed via the public API is problematic since it must
+# be made per-interpreter.  This involves the following:
+#
+# singletons:
+#  - None
+#  - True
+#  - False
+#  - NotImplemented
+#  - Ellipsis
+# PyTypeObject:
+#  - PyExc*  [97]
+#  - static types  [81]
+#
+# In the non-stable API we could use #defines to do the conversion
+# transparently (though Py_None is perhaps problematic for performance
+# reasons).  However, we can't take that approach with the stable API.
+# That means we must find all functions (& macros) in the stable API
+# (and probably the full public API, for sanity sake) and adjust them.
+# This will involve internally converting from the public object to the
+# corresponding per-interpreter object.
+#
+# Note that the only place this solution fails is with direct pointer
+# equality checks with the public objects.
+
+# XXX What about saying that the stable API is not sub-interpreter
+# compatible?
+
+
+function run_capi() {
+    ./python Tools/c-analyzer/c-analyzer.py capi \
+        --no-progress \
+        --group-by kind \
+        --func --inline --macro \
+        --no-show-empty \
+        --ignore '<must-resolve.ignored>' \
+        $@
+}
+
+echo ''
+echo '#################################################'
+echo '# All API'
+echo '#################################################'
+run_capi --format summary Include/*.h Include/cpython/*.h
+run_capi --format table Include/*.h Include/cpython/*.h
+echo ''
+echo ''
+echo '#################################################'
+echo '# stable API'
+echo '#################################################'
+echo ''
+echo '# public:'
+run_capi --format summary --public --no-show-empty Include/*.h
+echo ''
+echo '# private:'
+run_capi --format summary --private --no-show-empty Include/*.h
+echo ''
+run_capi --format full -v Include/*.h
+#run_capi --format full -v --public Include/*.h
+#run_capi --format full -v --private Include/*.h
+echo ''
+echo '#################################################'
+echo '# cpython API'
+echo '#################################################'
+echo ''
+echo '# public:'
+run_capi --format summary --public --no-show-empty Include/cpython/*.h
+echo ''
+echo '# private:'
+run_capi --format summary --private --no-show-empty Include/cpython/*.h
+echo ''
+run_capi --format full -v Include/cpython/*.h
+#run_capi --format full -v --public Include/cpython/*.h
+#run_capi --format full -v --private Include/cpython/*.h
diff --git a/Tools/ccbench/ccbench.py b/Tools/ccbench/ccbench.py
index ab1465a..d52701a 100644
--- a/Tools/ccbench/ccbench.py
+++ b/Tools/ccbench/ccbench.py
@@ -221,7 +221,7 @@
     for i in range(nthreads):
         threads.append(threading.Thread(target=run))
     for t in threads:
-        t.setDaemon(True)
+        t.daemon = True
         t.start()
     # We don't want measurements to include thread startup overhead,
     # so we arrange for timing to start after all threads are ready.
@@ -328,7 +328,7 @@
         for i in range(nthreads):
             threads.append(threading.Thread(target=run))
         for t in threads:
-            t.setDaemon(True)
+            t.daemon = True
             t.start()
         # Wait for threads to be ready
         with ready_cond:
@@ -460,7 +460,7 @@
             for i in range(nthreads):
                 threads.append(threading.Thread(target=run))
             for t in threads:
-                t.setDaemon(True)
+                t.daemon = True
                 t.start()
             # Wait for threads to be ready
             with ready_cond:
diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py
index 34b5807..969008a 100755
--- a/Tools/clinic/clinic.py
+++ b/Tools/clinic/clinic.py
@@ -1632,7 +1632,7 @@
         dsl_name = block.dsl_name
         write = self.f.write
 
-        assert not ((dsl_name == None) ^ (output == None)), "you must specify dsl_name and output together, dsl_name " + repr(dsl_name)
+        assert not ((dsl_name is None) ^ (output is None)), "you must specify dsl_name and output together, dsl_name " + repr(dsl_name)
 
         if not dsl_name:
             write(input)
@@ -2159,7 +2159,6 @@
 __mod__
 __mul__
 __neg__
-__new__
 __next__
 __or__
 __pos__
@@ -2752,11 +2751,6 @@
             # XXX PyFloat_Check can be removed after the end of the
             # deprecation in _PyLong_FromNbIndexOrNbInt.
             return """
-                if (PyFloat_Check({argname})) {{{{
-                    PyErr_SetString(PyExc_TypeError,
-                                    "integer argument expected, got float" );
-                    goto exit;
-                }}}}
                 {paramname} = _PyLong_AsInt({argname});
                 if ({paramname} == -1 && PyErr_Occurred()) {{{{
                     goto exit;
@@ -2837,11 +2831,6 @@
     def parse_arg(self, argname, displayname):
         if self.format_unit == 'b':
             return """
-                if (PyFloat_Check({argname})) {{{{
-                    PyErr_SetString(PyExc_TypeError,
-                                    "integer argument expected, got float" );
-                    goto exit;
-                }}}}
                 {{{{
                     long ival = PyLong_AsLong({argname});
                     if (ival == -1 && PyErr_Occurred()) {{{{
@@ -2864,14 +2853,9 @@
                 """.format(argname=argname, paramname=self.name)
         elif self.format_unit == 'B':
             return """
-                if (PyFloat_Check({argname})) {{{{
-                    PyErr_SetString(PyExc_TypeError,
-                                    "integer argument expected, got float" );
-                    goto exit;
-                }}}}
                 {{{{
-                    long ival = PyLong_AsUnsignedLongMask({argname});
-                    if (ival == -1 && PyErr_Occurred()) {{{{
+                    unsigned long ival = PyLong_AsUnsignedLongMask({argname});
+                    if (ival == (unsigned long)-1 && PyErr_Occurred()) {{{{
                         goto exit;
                     }}}}
                     else {{{{
@@ -2892,11 +2876,6 @@
     def parse_arg(self, argname, displayname):
         if self.format_unit == 'h':
             return """
-                if (PyFloat_Check({argname})) {{{{
-                    PyErr_SetString(PyExc_TypeError,
-                                    "integer argument expected, got float" );
-                    goto exit;
-                }}}}
                 {{{{
                     long ival = PyLong_AsLong({argname});
                     if (ival == -1 && PyErr_Occurred()) {{{{
@@ -2933,11 +2912,6 @@
     def parse_arg(self, argname, displayname):
         if self.format_unit == 'H':
             return """
-                if (PyFloat_Check({argname})) {{{{
-                    PyErr_SetString(PyExc_TypeError,
-                                    "integer argument expected, got float" );
-                    goto exit;
-                }}}}
                 {paramname} = (unsigned short)PyLong_AsUnsignedLongMask({argname});
                 if ({paramname} == (unsigned short)-1 && PyErr_Occurred()) {{{{
                     goto exit;
@@ -2957,17 +2931,12 @@
             self.format_unit = 'C'
         elif accept != {int}:
             fail("int_converter: illegal 'accept' argument " + repr(accept))
-        if type != None:
+        if type is not None:
             self.type = type
 
     def parse_arg(self, argname, displayname):
         if self.format_unit == 'i':
             return """
-                if (PyFloat_Check({argname})) {{{{
-                    PyErr_SetString(PyExc_TypeError,
-                                    "integer argument expected, got float" );
-                    goto exit;
-                }}}}
                 {paramname} = _PyLong_AsInt({argname});
                 if ({paramname} == -1 && PyErr_Occurred()) {{{{
                     goto exit;
@@ -3005,11 +2974,6 @@
     def parse_arg(self, argname, displayname):
         if self.format_unit == 'I':
             return """
-                if (PyFloat_Check({argname})) {{{{
-                    PyErr_SetString(PyExc_TypeError,
-                                    "integer argument expected, got float" );
-                    goto exit;
-                }}}}
                 {paramname} = (unsigned int)PyLong_AsUnsignedLongMask({argname});
                 if ({paramname} == (unsigned int)-1 && PyErr_Occurred()) {{{{
                     goto exit;
@@ -3026,11 +2990,6 @@
     def parse_arg(self, argname, displayname):
         if self.format_unit == 'l':
             return """
-                if (PyFloat_Check({argname})) {{{{
-                    PyErr_SetString(PyExc_TypeError,
-                                    "integer argument expected, got float" );
-                    goto exit;
-                }}}}
                 {paramname} = PyLong_AsLong({argname});
                 if ({paramname} == -1 && PyErr_Occurred()) {{{{
                     goto exit;
@@ -3070,11 +3029,6 @@
     def parse_arg(self, argname, displayname):
         if self.format_unit == 'L':
             return """
-                if (PyFloat_Check({argname})) {{{{
-                    PyErr_SetString(PyExc_TypeError,
-                                    "integer argument expected, got float" );
-                    goto exit;
-                }}}}
                 {paramname} = PyLong_AsLongLong({argname});
                 if ({paramname} == -1 && PyErr_Occurred()) {{{{
                     goto exit;
@@ -3121,14 +3075,9 @@
     def parse_arg(self, argname, displayname):
         if self.format_unit == 'n':
             return """
-                if (PyFloat_Check({argname})) {{{{
-                    PyErr_SetString(PyExc_TypeError,
-                                    "integer argument expected, got float" );
-                    goto exit;
-                }}}}
                 {{{{
                     Py_ssize_t ival = -1;
-                    PyObject *iobj = PyNumber_Index({argname});
+                    PyObject *iobj = _PyNumber_Index({argname});
                     if (iobj != NULL) {{{{
                         ival = PyLong_AsSsize_t(iobj);
                         Py_DECREF(iobj);
@@ -3169,6 +3118,19 @@
         return super().parse_arg(argname, displayname)
 
 
+class fildes_converter(CConverter):
+    type = 'int'
+    converter = '_PyLong_FileDescriptor_Converter'
+
+    def _parse_arg(self, argname, displayname):
+        return """
+            {paramname} = PyObject_AsFileDescriptor({argname});
+            if ({paramname} == -1) {{{{
+                goto exit;
+            }}}}
+            """.format(argname=argname, paramname=self.name)
+
+
 class float_converter(CConverter):
     type = 'float'
     default_type = float
@@ -3440,20 +3402,75 @@
                            displayname=displayname)
         return super().parse_arg(argname, displayname)
 
+@add_legacy_c_converter('u')
 @add_legacy_c_converter('u#', zeroes=True)
 @add_legacy_c_converter('Z', accept={str, NoneType})
 @add_legacy_c_converter('Z#', accept={str, NoneType}, zeroes=True)
 class Py_UNICODE_converter(CConverter):
     type = 'const Py_UNICODE *'
     default_type = (str, Null, NoneType)
-    format_unit = 'u'
 
     def converter_init(self, *, accept={str}, zeroes=False):
         format_unit = 'Z' if accept=={str, NoneType} else 'u'
         if zeroes:
             format_unit += '#'
             self.length = True
-        self.format_unit = format_unit
+            self.format_unit = format_unit
+        else:
+            self.accept = accept
+            if accept == {str}:
+                self.converter = '_PyUnicode_WideCharString_Converter'
+            elif accept == {str, NoneType}:
+                self.converter = '_PyUnicode_WideCharString_Opt_Converter'
+            else:
+                fail("Py_UNICODE_converter: illegal 'accept' argument " + repr(accept))
+
+    def cleanup(self):
+        if not self.length:
+            return """\
+#if !USE_UNICODE_WCHAR_CACHE
+PyMem_Free((void *){name});
+#endif /* USE_UNICODE_WCHAR_CACHE */
+""".format(name=self.name)
+
+    def parse_arg(self, argname, argnum):
+        if not self.length:
+            if self.accept == {str}:
+                return """
+                    if (!PyUnicode_Check({argname})) {{{{
+                        _PyArg_BadArgument("{{name}}", {argnum}, "str", {argname});
+                        goto exit;
+                    }}}}
+                    #if USE_UNICODE_WCHAR_CACHE
+                    {paramname} = _PyUnicode_AsUnicode({argname});
+                    #else /* USE_UNICODE_WCHAR_CACHE */
+                    {paramname} = PyUnicode_AsWideCharString({argname}, NULL);
+                    #endif /* USE_UNICODE_WCHAR_CACHE */
+                    if ({paramname} == NULL) {{{{
+                        goto exit;
+                    }}}}
+                    """.format(argname=argname, paramname=self.name, argnum=argnum)
+            elif self.accept == {str, NoneType}:
+                return """
+                    if ({argname} == Py_None) {{{{
+                        {paramname} = NULL;
+                    }}}}
+                    else if (PyUnicode_Check({argname})) {{{{
+                        #if USE_UNICODE_WCHAR_CACHE
+                        {paramname} = _PyUnicode_AsUnicode({argname});
+                        #else /* USE_UNICODE_WCHAR_CACHE */
+                        {paramname} = PyUnicode_AsWideCharString({argname}, NULL);
+                        #endif /* USE_UNICODE_WCHAR_CACHE */
+                        if ({paramname} == NULL) {{{{
+                            goto exit;
+                        }}}}
+                    }}}}
+                    else {{{{
+                        _PyArg_BadArgument("{{name}}", {argnum}, "str or None", {argname});
+                        goto exit;
+                    }}}}
+                    """.format(argname=argname, paramname=self.name, argnum=argnum)
+        return super().parse_arg(argname, argnum)
 
 @add_legacy_c_converter('s*', accept={str, buffer})
 @add_legacy_c_converter('z*', accept={str, buffer, NoneType})
@@ -4209,6 +4226,9 @@
         module, cls = self.clinic._module_and_class(fields)
 
         fields = full_name.split('.')
+        if fields[-1] in unsupported_special_methods:
+            fail(f"{fields[-1]} is a special method and cannot be converted to Argument Clinic!  (Yet.)")
+
         if fields[-1] == '__new__':
             if (self.kind != CLASS_METHOD) or (not cls):
                 fail("__new__ must be a class method!")
@@ -4219,8 +4239,6 @@
             self.kind = METHOD_INIT
             if not return_converter:
                 return_converter = init_return_converter()
-        elif fields[-1] in unsupported_special_methods:
-            fail(fields[-1] + " is a special method and cannot be converted to Argument Clinic!  (Yet.)")
 
         if not return_converter:
             return_converter = CReturnConverter()
@@ -4444,7 +4462,7 @@
 
                 if 'c_default' not in kwargs:
                     # we can only represent very simple data values in C.
-                    # detect whether default is okay, via a blacklist
+                    # detect whether default is okay, via a denylist
                     # of disallowed ast nodes.
                     class DetectBadNodes(ast.NodeVisitor):
                         bad = False
@@ -4467,9 +4485,9 @@
                         # "starred": "a = [1, 2, 3]; *a"
                         visit_Starred = bad_node
 
-                    blacklist = DetectBadNodes()
-                    blacklist.visit(module)
-                    bad = blacklist.bad
+                    denylist = DetectBadNodes()
+                    denylist.visit(module)
+                    bad = denylist.bad
                 else:
                     # if they specify a c_default, we can be more lenient about the default value.
                     # but at least make an attempt at ensuring it's a valid expression.
diff --git a/Tools/demo/rpythond.py b/Tools/demo/rpythond.py
index a18de13..4e47fb9 100755
--- a/Tools/demo/rpythond.py
+++ b/Tools/demo/rpythond.py
@@ -5,7 +5,7 @@
 Execute Python commands remotely and send output back.
 
 WARNING: This version has a gaping security hole -- it accepts requests
-from any host on the Internet!
+from any host on the internet!
 """
 
 import sys
diff --git a/Tools/demo/vector.py b/Tools/demo/vector.py
index da5b389..6df1f50 100755
--- a/Tools/demo/vector.py
+++ b/Tools/demo/vector.py
@@ -27,7 +27,17 @@
     or on the right
     >>> a * 3.0
     Vec(3.0, 6.0, 9.0)
+
+    and dot product
+    >>> a.dot(b)
+    10
+
+    and printed in vector notation
+    >>> print(a)
+    <1 2 3>
+
     """
+
     def __init__(self, *v):
         self.v = list(v)
 
@@ -40,8 +50,12 @@
         return inst
 
     def __repr__(self):
-        args = ', '.join(repr(x) for x in self.v)
-        return 'Vec({})'.format(args)
+        args = ', '.join([repr(x) for x in self.v])
+        return f'{type(self).__name__}({args})'
+
+    def __str__(self):
+        components = ' '.join([str(x) for x in self.v])
+        return f'<{components}>'
 
     def __len__(self):
         return len(self.v)
@@ -50,22 +64,28 @@
         return self.v[i]
 
     def __add__(self, other):
-        # Element-wise addition
+        "Element-wise addition"
         v = [x + y for x, y in zip(self.v, other.v)]
         return Vec.fromlist(v)
 
     def __sub__(self, other):
-        # Element-wise subtraction
+        "Element-wise subtraction"
         v = [x - y for x, y in zip(self.v, other.v)]
         return Vec.fromlist(v)
 
     def __mul__(self, scalar):
-        # Multiply by scalar
+        "Multiply by scalar"
         v = [x * scalar for x in self.v]
         return Vec.fromlist(v)
 
     __rmul__ = __mul__
 
+    def dot(self, other):
+        "Vector dot product"
+        if not isinstance(other, Vec):
+            raise TypeError
+        return sum(x_i * y_i for (x_i, y_i) in zip(self, other))
+
 
 def test():
     import doctest
diff --git a/Tools/freeze/README b/Tools/freeze/README
index 5bc5b04..098107c 100644
--- a/Tools/freeze/README
+++ b/Tools/freeze/README
@@ -293,4 +293,4 @@
 
 
 
---Guido van Rossum (home page: http://www.python.org/~guido/)
+--Guido van Rossum (home page: https://www.python.org/~guido/)
diff --git a/Tools/freeze/freeze.py b/Tools/freeze/freeze.py
index 83aa508..d66e1e2 100755
--- a/Tools/freeze/freeze.py
+++ b/Tools/freeze/freeze.py
@@ -93,6 +93,7 @@
 import getopt
 import os
 import sys
+import sysconfig
 
 
 # Import the freeze-private modules
@@ -226,7 +227,7 @@
         extensions_c = 'frozen_extensions.c'
     if ishome:
         print("(Using Python source directory)")
-        binlib = exec_prefix
+        configdir = exec_prefix
         incldir = os.path.join(prefix, 'Include')
         config_h_dir = exec_prefix
         config_c_in = os.path.join(prefix, 'Modules', 'config.c.in')
@@ -235,22 +236,21 @@
         if win:
             frozendllmain_c = os.path.join(exec_prefix, 'Pc\\frozen_dllmain.c')
     else:
-        binlib = os.path.join(exec_prefix,
-                              'lib', 'python%s' % version,
-                              'config-%s' % flagged_version)
+        configdir = sysconfig.get_config_var('LIBPL')
         incldir = os.path.join(prefix, 'include', 'python%s' % flagged_version)
         config_h_dir = os.path.join(exec_prefix, 'include',
                                     'python%s' % flagged_version)
-        config_c_in = os.path.join(binlib, 'config.c.in')
-        frozenmain_c = os.path.join(binlib, 'frozenmain.c')
-        makefile_in = os.path.join(binlib, 'Makefile')
-        frozendllmain_c = os.path.join(binlib, 'frozen_dllmain.c')
+        config_c_in = os.path.join(configdir, 'config.c.in')
+        frozenmain_c = os.path.join(configdir, 'frozenmain.c')
+        makefile_in = os.path.join(configdir, 'Makefile')
+        frozendllmain_c = os.path.join(configdir, 'frozen_dllmain.c')
+    libdir = sysconfig.get_config_var('LIBDIR')
     supp_sources = []
     defines = []
     includes = ['-I' + incldir, '-I' + config_h_dir]
 
     # sanity check of directories and files
-    check_dirs = [prefix, exec_prefix, binlib, incldir]
+    check_dirs = [prefix, exec_prefix, configdir, incldir]
     if not win:
         # These are not directories on Windows.
         check_dirs = check_dirs + extensions
@@ -457,7 +457,7 @@
 
     cflags = ['$(OPT)']
     cppflags = defines + includes
-    libs = [os.path.join(binlib, '$(LDLIBRARY)')]
+    libs = [os.path.join(libdir, '$(LDLIBRARY)')]
 
     somevars = {}
     if os.path.exists(makefile_in):
diff --git a/Tools/freeze/regen_frozen.py b/Tools/freeze/regen_frozen.py
new file mode 100644
index 0000000..391182a
--- /dev/null
+++ b/Tools/freeze/regen_frozen.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python3
+import sys
+import os
+import marshal
+
+
+DIR = os.path.dirname(sys.argv[0])
+# source code for module to freeze
+FILE = os.path.join(DIR, 'flag.py')
+# C symbol to use for array holding frozen bytes
+SYMBOL = 'M___hello__'
+
+
+def get_module_code(filename):
+    """Compile 'filename' and return the module code as a marshalled byte
+    string.
+    """
+    with open(filename, 'r') as fp:
+        src = fp.read()
+    co = compile(src, 'none', 'exec')
+    co_bytes = marshal.dumps(co)
+    return co_bytes
+
+
+def gen_c_code(fp, co_bytes):
+    """Generate C code for the module code in 'co_bytes', write it to 'fp'.
+    """
+    def write(*args, **kwargs):
+        print(*args, **kwargs, file=fp)
+    write('/* Generated with Tools/freeze/regen_frozen.py */')
+    write('static unsigned char %s[] = {' % SYMBOL, end='')
+    bytes_per_row = 13
+    for i, opcode in enumerate(co_bytes):
+        if (i % bytes_per_row) == 0:
+            # start a new row
+            write()
+            write('    ', end='')
+        write('%d,' % opcode, end='')
+    write()
+    write('};')
+
+
+def main():
+    out_filename = sys.argv[1]
+    co_bytes = get_module_code(FILE)
+    with open(out_filename, 'w') as fp:
+        gen_c_code(fp, co_bytes)
+
+
+if __name__ == '__main__':
+    main()
diff --git a/Tools/gdb/libpython.py b/Tools/gdb/libpython.py
index 33bf5ac..270aeb4 100755
--- a/Tools/gdb/libpython.py
+++ b/Tools/gdb/libpython.py
@@ -468,7 +468,7 @@
     def __repr__(self):
         if isinstance(self.attrdict, dict):
             kwargs = ', '.join(["%s=%r" % (arg, val)
-                                for arg, val in self.attrdict.iteritems()])
+                                for arg, val in self.attrdict.items()])
             return '<%s(%s) at remote 0x%x>' % (self.cl_name,
                                                 kwargs, self.address)
         else:
@@ -648,19 +648,28 @@
         Analogous to PyCode_Addr2Line; translated from pseudocode in
         Objects/lnotab_notes.txt
         '''
-        co_lnotab = self.pyop_field('co_lnotab').proxyval(set())
+        co_linetable = self.pyop_field('co_linetable').proxyval(set())
 
         # Initialize lineno to co_firstlineno as per PyCode_Addr2Line
         # not 0, as lnotab_notes.txt has it:
         lineno = int_from_int(self.field('co_firstlineno'))
 
+        if addrq < 0:
+            return lineno
         addr = 0
-        for addr_incr, line_incr in zip(co_lnotab[::2], co_lnotab[1::2]):
+        for addr_incr, line_incr in zip(co_linetable[::2], co_linetable[1::2]):
+            if addr_incr == 255:
+                break
             addr += ord(addr_incr)
+            line_delta = ord(line_incr)
+            if line_delta == 128:
+                line_delta = 0
+            elif line_delta > 128:
+                line_delta -= 256
+            lineno += line_delta
             if addr > addrq:
                 return lineno
-            lineno += ord(line_incr)
-        return lineno
+        assert False, "Unreachable"
 
 
 class PyDictObjectPtr(PyObjectPtr):
@@ -938,7 +947,7 @@
             return self.f_lineno
 
         try:
-            return self.co.addr2line(self.f_lasti)
+            return self.co.addr2line(self.f_lasti*2)
         except Exception:
             # bpo-34989: addr2line() is a complex function, it can fail in many
             # ways. For example, it fails with a TypeError on "FakeRepr" if
@@ -1605,8 +1614,8 @@
             return (name == 'take_gil')
 
     def is_gc_collect(self):
-        '''Is this frame "collect" within the garbage-collector?'''
-        return self._gdbframe.name() == 'collect'
+        '''Is this frame gc_collect_main() within the garbage-collector?'''
+        return self._gdbframe.name() in ('collect', 'gc_collect_main')
 
     def get_pyop(self):
         try:
diff --git a/Tools/i18n/pygettext.py b/Tools/i18n/pygettext.py
index b1d281d..6f889adf 100755
--- a/Tools/i18n/pygettext.py
+++ b/Tools/i18n/pygettext.py
@@ -52,8 +52,8 @@
 pygettext searches only for _() by default, but see the -k/--keyword flag
 below for how to augment this.
 
- [1] http://www.python.org/workshops/1997-10/proceedings/loewis.html
- [2] http://www.gnu.org/software/gettext/gettext.html
+ [1] https://www.python.org/workshops/1997-10/proceedings/loewis.html
+ [2] https://www.gnu.org/software/gettext/gettext.html
 
 NOTE: pygettext attempts to be option and feature compatible with GNU
 xgettext where ever possible. However some options are still missing or are
@@ -162,6 +162,7 @@
 import glob
 import time
 import getopt
+import ast
 import token
 import tokenize
 
@@ -343,6 +344,58 @@
                 return
         if ttype == tokenize.NAME and tstring in opts.keywords:
             self.__state = self.__keywordseen
+            return
+        if ttype == tokenize.STRING:
+            maybe_fstring = ast.parse(tstring, mode='eval').body
+            if not isinstance(maybe_fstring, ast.JoinedStr):
+                return
+            for value in filter(lambda node: isinstance(node, ast.FormattedValue),
+                                maybe_fstring.values):
+                for call in filter(lambda node: isinstance(node, ast.Call),
+                                   ast.walk(value)):
+                    func = call.func
+                    if isinstance(func, ast.Name):
+                        func_name = func.id
+                    elif isinstance(func, ast.Attribute):
+                        func_name = func.attr
+                    else:
+                        continue
+
+                    if func_name not in opts.keywords:
+                        continue
+                    if len(call.args) != 1:
+                        print(_(
+                            '*** %(file)s:%(lineno)s: Seen unexpected amount of'
+                            ' positional arguments in gettext call: %(source_segment)s'
+                            ) % {
+                            'source_segment': ast.get_source_segment(tstring, call) or tstring,
+                            'file': self.__curfile,
+                            'lineno': lineno
+                            }, file=sys.stderr)
+                        continue
+                    if call.keywords:
+                        print(_(
+                            '*** %(file)s:%(lineno)s: Seen unexpected keyword arguments'
+                            ' in gettext call: %(source_segment)s'
+                            ) % {
+                            'source_segment': ast.get_source_segment(tstring, call) or tstring,
+                            'file': self.__curfile,
+                            'lineno': lineno
+                            }, file=sys.stderr)
+                        continue
+                    arg = call.args[0]
+                    if not isinstance(arg, ast.Constant):
+                        print(_(
+                            '*** %(file)s:%(lineno)s: Seen unexpected argument type'
+                            ' in gettext call: %(source_segment)s'
+                            ) % {
+                            'source_segment': ast.get_source_segment(tstring, call) or tstring,
+                            'file': self.__curfile,
+                            'lineno': lineno
+                            }, file=sys.stderr)
+                        continue
+                    if isinstance(arg.value, str):
+                        self.__addentry(arg.value, lineno)
 
     def __suiteseen(self, ttype, tstring, lineno):
         # skip over any enclosure pairs until we see the colon
diff --git a/Tools/msi/README.txt b/Tools/msi/README.txt
index 82635f3..0a4382f 100644
--- a/Tools/msi/README.txt
+++ b/Tools/msi/README.txt
@@ -167,7 +167,7 @@
     by providing a unique URI for this property. It does not need to be an
     active internet address. Defaults to $(ComputerName).
 
-    Official releases use http://www.python.org/(architecture name)
+    Official releases use https://www.python.org/(architecture name)
 
   /p:DownloadUrlBase=(any URI)
     Specifies the base of a URL where missing parts of the installer layout
@@ -363,6 +363,8 @@
 Within this install directory is the following approximate layout:
 
 .\python[w].exe The core executable files
+.\python3x.dll  The core interpreter
+.\python3.dll   The stable ABI reference
 .\DLLs          Stdlib extensions (*.pyd) and dependencies
 .\Doc           Documentation (*.chm)
 .\include       Development headers (*.h)
@@ -374,20 +376,13 @@
 .\Tools         Tool scripts (*.py)
 
 When installed for all users, the following files are installed to
-either "%SystemRoot%\System32" or "%SystemRoot%\SysWOW64" as
-appropriate. For the current user, they are installed in the Python
-install directory.
-
-.\python3x.dll      The core interpreter
-.\python3.dll       The stable ABI reference
-
-When installed for all users, the following files are installed to
 "%SystemRoot%" (typically "C:\Windows") to ensure they are always
 available on PATH. (See Launching Python below.) For the current user,
 they are installed in "%LocalAppData%\Programs\Python\PyLauncher".
 
 .\py[w].exe         PEP 397 launcher
 
+
 System Settings
 ===============
 
diff --git a/Tools/msi/build.bat b/Tools/msi/build.bat
index 532cebc..2bdaca2 100644
--- a/Tools/msi/build.bat
+++ b/Tools/msi/build.bat
@@ -27,25 +27,26 @@
 if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2)
 
 if defined BUILDX86 (
-    call "%PCBUILD%build.bat" -d -e %REBUILD% %BUILDTEST%
-    if errorlevel 1 goto :eof
-    call "%PCBUILD%build.bat" -e %REBUILD% %BUILDTEST%
-    if errorlevel 1 goto :eof
+    call "%PCBUILD%build.bat" -p Win32 -d -e %REBUILD% %BUILDTEST%
+    if errorlevel 1 exit /B %ERRORLEVEL%
+    call "%PCBUILD%build.bat" -p Win32 -e %REBUILD% %BUILDTEST%
+    if errorlevel 1 exit /B %ERRORLEVEL%
 )
 if defined BUILDX64 (
     call "%PCBUILD%build.bat" -p x64 -d -e %REBUILD% %BUILDTEST%
-    if errorlevel 1 goto :eof
+    if errorlevel 1 exit /B %ERRORLEVEL%
     call "%PCBUILD%build.bat" -p x64 -e %REBUILD% %BUILDTEST%
-    if errorlevel 1 goto :eof
+    if errorlevel 1 exit /B %ERRORLEVEL%
 )
 
 if defined BUILDDOC (
     call "%PCBUILD%..\Doc\make.bat" htmlhelp
-    if errorlevel 1 goto :eof
+    if errorlevel 1 exit /B %ERRORLEVEL%
 )
 
 rem Build the launcher MSI separately
 %MSBUILD% "%D%launcher\launcher.wixproj" /p:Platform=x86
+if errorlevel 1 exit /B %ERRORLEVEL%
 
 set BUILD_CMD="%D%bundle\snapshot.wixproj"
 if defined BUILDTEST (
@@ -59,12 +60,12 @@
 )
 
 if defined BUILDX86 (
-    %MSBUILD% %BUILD_CMD%
-    if errorlevel 1 goto :eof
+    %MSBUILD% /p:Platform=x86 %BUILD_CMD%
+    if errorlevel 1 exit /B %ERRORLEVEL%
 )
 if defined BUILDX64 (
     %MSBUILD% /p:Platform=x64 %BUILD_CMD%
-    if errorlevel 1 goto :eof
+    if errorlevel 1 exit /B %ERRORLEVEL%
 )
 
 exit /B 0
diff --git a/Tools/msi/buildrelease.bat b/Tools/msi/buildrelease.bat
index b72eede..69dd145 100644
--- a/Tools/msi/buildrelease.bat
+++ b/Tools/msi/buildrelease.bat
@@ -12,7 +12,7 @@
 rem The following substitutions will be applied to the release URI:
 rem     Variable        Description         Example
 rem     {arch}          architecture        amd64, win32
-set RELEASE_URI=http://www.python.org/{arch}
+set RELEASE_URI=https://www.python.org/{arch}
 
 rem This is the URL that will be used to download installation files.
 rem The files available from the default URL *will* conflict with your
@@ -80,7 +80,7 @@
 if "%SKIPDOC%" EQU "1" goto skipdoc
 
 call "%D%..\..\doc\make.bat" htmlhelp
-if errorlevel 1 goto :eof
+if errorlevel 1 exit /B %ERRORLEVEL%
 :skipdoc
 
 where dlltool /q && goto skipdlltoolsearch
@@ -93,16 +93,17 @@
 
 if defined BUILDX86 (
     call :build x86
-    if errorlevel 1 exit /B
+    if errorlevel 1 exit /B %ERRORLEVEL%
 )
 
 if defined BUILDX64 (
     call :build x64 "%PGO%"
-    if errorlevel 1 exit /B
+    if errorlevel 1 exit /B %ERRORLEVEL%
 )
 
 if defined TESTTARGETDIR (
     call "%D%testrelease.bat" -t "%TESTTARGETDIR%"
+    if errorlevel 1 exit /B %ERRORLEVEL%
 )
 
 exit /B 0
@@ -128,19 +129,19 @@
 if exist "%BUILD%en-us" (
     echo Deleting %BUILD%en-us
     rmdir /q/s "%BUILD%en-us"
-    if errorlevel 1 exit /B
+    if errorlevel 1 exit /B %ERRORLEVEL%
 )
 
 if exist "%D%obj\Debug_%OBJDIR_PLAT%" (
     echo Deleting "%D%obj\Debug_%OBJDIR_PLAT%"
     rmdir /q/s "%D%obj\Debug_%OBJDIR_PLAT%"
-    if errorlevel 1 exit /B
+    if errorlevel 1 exit /B %ERRORLEVEL%
 )
 
 if exist "%D%obj\Release_%OBJDIR_PLAT%" (
     echo Deleting "%D%obj\Release_%OBJDIR_PLAT%"
     rmdir /q/s "%D%obj\Release_%OBJDIR_PLAT%"
-    if errorlevel 1 exit /B
+    if errorlevel 1 exit /B %ERRORLEVEL%
 )
 
 if not "%CERTNAME%" EQU "" (
@@ -156,41 +157,41 @@
 if not "%SKIPBUILD%" EQU "1" (
     @echo call "%PCBUILD%build.bat" -e -p %BUILD_PLAT% -t %TARGET% %PGOOPTS% %CERTOPTS%
     @call "%PCBUILD%build.bat" -e -p %BUILD_PLAT% -t %TARGET% %PGOOPTS% %CERTOPTS%
-    @if errorlevel 1 exit /B
+    @if errorlevel 1 exit /B %ERRORLEVEL%
     @rem build.bat turns echo back on, so we disable it again
     @echo off
 
     @echo call "%PCBUILD%build.bat" -d -e -p %BUILD_PLAT% -t %TARGET%
     @call "%PCBUILD%build.bat" -d -e -p %BUILD_PLAT% -t %TARGET%
-    @if errorlevel 1 exit /B
+    @if errorlevel 1 exit /B %ERRORLEVEL%
     @rem build.bat turns echo back on, so we disable it again
     @echo off
 )
 
 if "%OUTDIR_PLAT%" EQU "win32" (
     %MSBUILD% "%D%launcher\launcher.wixproj" /p:Platform=x86 %CERTOPTS% /p:ReleaseUri=%RELEASE_URI%
-    if errorlevel 1 exit /B
+    if errorlevel 1 exit /B %ERRORLEVEL%
 ) else if not exist "%Py_OutDir%win32\en-us\launcher.msi" (
     %MSBUILD% "%D%launcher\launcher.wixproj" /p:Platform=x86 %CERTOPTS% /p:ReleaseUri=%RELEASE_URI%
-    if errorlevel 1 exit /B
+    if errorlevel 1 exit /B %ERRORLEVEL%
 )
 
 set BUILDOPTS=/p:Platform=%1 /p:BuildForRelease=true /p:DownloadUrl=%DOWNLOAD_URL% /p:DownloadUrlBase=%DOWNLOAD_URL_BASE% /p:ReleaseUri=%RELEASE_URI%
 if defined BUILDMSI (
     %MSBUILD% "%D%bundle\releaselocal.wixproj" /t:Rebuild %BUILDOPTS% %CERTOPTS% /p:RebuildAll=true
-    if errorlevel 1 exit /B
+    if errorlevel 1 exit /B %ERRORLEVEL%
     %MSBUILD% "%D%bundle\releaseweb.wixproj" /t:Rebuild %BUILDOPTS% %CERTOPTS% /p:RebuildAll=false
-    if errorlevel 1 exit /B
+    if errorlevel 1 exit /B %ERRORLEVEL%
 )
 
 if defined BUILDZIP (
     %MSBUILD% "%D%make_zip.proj" /t:Build %BUILDOPTS% %CERTOPTS% /p:OutputPath="%BUILD%en-us"
-    if errorlevel 1 exit /B
+    if errorlevel 1 exit /B %ERRORLEVEL%
 )
 
 if defined BUILDNUGET (
     %MSBUILD% "%D%..\nuget\make_pkg.proj" /t:Build /p:Configuration=Release /p:Platform=%1 /p:OutputPath="%BUILD%en-us"
-    if errorlevel 1 exit /B
+    if errorlevel 1 exit /B %ERRORLEVEL%
 )
 
 if not "%OUTDIR%" EQU "" (
diff --git a/Tools/msi/bundle/SideBar.png b/Tools/msi/bundle/SideBar.png
index a23ce5e..52f15dd 100644
--- a/Tools/msi/bundle/SideBar.png
+++ b/Tools/msi/bundle/SideBar.png
Binary files differ
diff --git a/Tools/msi/bundle/bootstrap/pythonba.vcxproj b/Tools/msi/bundle/bootstrap/pythonba.vcxproj
index 75aad44..ef71fe7 100644
--- a/Tools/msi/bundle/bootstrap/pythonba.vcxproj
+++ b/Tools/msi/bundle/bootstrap/pythonba.vcxproj
@@ -21,6 +21,9 @@
   <PropertyGroup Label="Globals">
     <Configuration Condition="'$(Configuration)' == ''">Release</Configuration>
     <Platform Condition="'$(Platform)' == ''">Win32</Platform>
+    <PlatformToolset Condition="'$(PlatformToolset)' == '' and ('$(MSBuildToolsVersion)' == '16.0' or '$(VisualStudioVersion)' == '16.0')">v142</PlatformToolset>
+    <PlatformToolset Condition="'$(PlatformToolset)' == '' and ('$(MSBuildToolsVersion)' == '15.0' or '$(VisualStudioVersion)' == '15.0')">v141</PlatformToolset>
+    <PlatformToolset Condition="'$(PlatformToolset)' == '' and '$(VCTargetsPath14)' != ''">v140</PlatformToolset>
     <PlatformToolset Condition="'$(PlatformToolset)' == '' and '$(VCTargetsPath14)' != ''">v140</PlatformToolset>
     <PlatformToolset Condition="'$(PlatformToolset)' == '' and '$(VCTargetsPath12)' != ''">v120</PlatformToolset>
     <ProjectGuid>{7A09B132-B3EE-499B-A700-A4B2157FEA3D}</ProjectGuid>
@@ -47,6 +50,8 @@
     </ClCompile>
     <Link>
       <AdditionalDependencies>comctl32.lib;gdiplus.lib;msimg32.lib;shlwapi.lib;wininet.lib;dutil.lib;balutil.lib;version.lib;uxtheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories Condition="'$(PlatformToolset)' == 'v142'">$(WixInstallPath)sdk\vs2017\lib\x86</AdditionalLibraryDirectories>
+      <AdditionalLibraryDirectories Condition="'$(PlatformToolset)' == 'v141'">$(WixInstallPath)sdk\vs2017\lib\x86</AdditionalLibraryDirectories>
       <AdditionalLibraryDirectories Condition="'$(PlatformToolset)' == 'v140'">$(WixInstallPath)sdk\vs2015\lib\x86</AdditionalLibraryDirectories>
       <AdditionalLibraryDirectories Condition="'$(PlatformToolset)' == 'v120'">$(WixInstallPath)sdk\vs2013\lib\x86</AdditionalLibraryDirectories>
       <ModuleDefinitionFile>pythonba.def</ModuleDefinitionFile>
diff --git a/Tools/msi/bundle/bundle.wxs b/Tools/msi/bundle/bundle.wxs
index ddd6870..0c28db6 100644
--- a/Tools/msi/bundle/bundle.wxs
+++ b/Tools/msi/bundle/bundle.wxs
@@ -7,7 +7,7 @@
           Version="$(var.Version)"
           IconSourceFile="..\..\..\PC\icons\setup.ico"
           Manufacturer="!(loc.Manufacturer)"
-          AboutUrl="http://www.python.org/"
+          AboutUrl="https://www.python.org/"
           Compressed="no"
           dep:ProviderKey="CPython-$(var.MajorVersionNumber).$(var.MinorVersionNumber)$(var.PyArchExt)$(var.PyTestExt)">
     <BootstrapperApplication Id="PythonBA" SourceFile="$(var.BootstrapApp)">
@@ -95,8 +95,8 @@
     <Chain ParallelCache="yes">
       <PackageGroupRef Id="crt" />
       <PackageGroupRef Id="core" />
-      <PackageGroupRef Id="dev" />
       <PackageGroupRef Id="exe" />
+      <PackageGroupRef Id="dev" />
       <PackageGroupRef Id="lib" />
       <PackageGroupRef Id="test" />
       <PackageGroupRef Id="doc" />
diff --git a/Tools/msi/common.wxs b/Tools/msi/common.wxs
index 398d94a..4554e80 100644
--- a/Tools/msi/common.wxs
+++ b/Tools/msi/common.wxs
@@ -53,11 +53,25 @@
     </Fragment>
     
     <Fragment>
-    <?ifdef InstallDirectoryGuidSeed ?>
         <Directory Id="TARGETDIR" Name="SourceDir">
+        <?ifdef InstallDirectoryGuidSeed ?>
             <Directory Id="InstallDirectory" ComponentGuidGenerationSeed="$(var.InstallDirectoryGuidSeed)" />
+        <?endif ?>
         </Directory>
-    <?endif ?>
+    </Fragment>
+
+    <Fragment>
+        <?ifdef PythonExeComponentGuid ?>
+        <!-- Locate TARGETDIR automatically assuming we have executables installed -->
+        <Property Id="TARGETDIR">
+            <ComponentSearch Id="PythonExe_Directory" Guid="$(var.PythonExeComponentGuid)">
+                <DirectorySearch Id="PythonExe_Directory" AssignToProperty="yes" Path=".">
+                    <FileSearch Id="PythonExe_DirectoryFile" Name="python.exe" />
+                </DirectorySearch>
+            </ComponentSearch>
+        </Property>
+        <?endif ?>
+        <Property Id="DetectTargetDir" Value="1" />
     </Fragment>
     
     <!-- Top-level directories -->
diff --git a/Tools/msi/common_en-US.wxl_template b/Tools/msi/common_en-US.wxl_template
index c95c271..adb8f40 100644
--- a/Tools/msi/common_en-US.wxl_template
+++ b/Tools/msi/common_en-US.wxl_template
@@ -14,5 +14,5 @@
     <String Id="NoDowngrade">A newer version of !(loc.ProductName) is already installed.</String>
     <String Id="IncorrectCore">An incorrect version of a prerequisite package is installed. Please uninstall any other versions of !(loc.ProductName) and try installing this again.</String>
     <String Id="NoTargetDir">The TARGETDIR variable must be provided when invoking this installer.</String>
-    <String Id="ManufacturerSupportUrl">http://www.python.org/</String>
+    <String Id="ManufacturerSupportUrl">https://www.python.org/</String>
 </WixLocalization>
diff --git a/Tools/msi/dev/dev.wxs b/Tools/msi/dev/dev.wxs
index 23a710d..2ddeb31 100644
--- a/Tools/msi/dev/dev.wxs
+++ b/Tools/msi/dev/dev.wxs
@@ -4,6 +4,7 @@
         <Package InstallerVersion="300" Compressed="yes" InstallScope="perUser" Platform="$(var.Platform)" />
         <MediaTemplate EmbedCab="yes" CompressionLevel="high" />
         
+        <PropertyRef Id="DetectTargetDir" />
         <PropertyRef Id="UpgradeTable" />
         
         <Feature Id="DefaultFeature" AllowAdvertise="no" Title="!(loc.Title)" Description="!(loc.Description)">
diff --git a/Tools/msi/distutils.command.bdist_wininst.py b/Tools/msi/distutils.command.bdist_wininst.py
deleted file mode 100644
index 548fdd0..0000000
--- a/Tools/msi/distutils.command.bdist_wininst.py
+++ /dev/null
@@ -1,23 +0,0 @@
-"""distutils.command.bdist_wininst
-
-Suppresses the 'bdist_wininst' command, while still allowing
-setuptools to import it without breaking."""
-
-from distutils.core import Command
-from distutils.errors import DistutilsPlatformError
-
-class bdist_wininst(Command):
-    description = "create an executable installer for MS Windows"
-
-    # Marker for tests that we have the unsupported bdist_wininst
-    _unsupported = True
-
-    def initialize_options(self):
-        pass
-
-    def finalize_options(self):
-        pass
-
-    def run(self):
-        raise DistutilsPlatformError("bdist_wininst is not supported "
-            "in this Python distribution")
diff --git a/Tools/msi/doc/doc.wxs b/Tools/msi/doc/doc.wxs
index cd1a68c..cc5bdb4 100644
--- a/Tools/msi/doc/doc.wxs
+++ b/Tools/msi/doc/doc.wxs
@@ -4,6 +4,7 @@
         <Package InstallerVersion="300" Compressed="yes" InstallScope="perUser" Platform="$(var.Platform)" />
         <MediaTemplate EmbedCab="yes" CompressionLevel="high" />
         
+        <PropertyRef Id="DetectTargetDir" />
         <PropertyRef Id="UpgradeTable" />
         <PropertyRef Id="REGISTRYKEY" />
         
diff --git a/Tools/msi/exe/exe_en-US.wxl_template b/Tools/msi/exe/exe_en-US.wxl_template
index 1f9e290..4cd9e3e 100644
--- a/Tools/msi/exe/exe_en-US.wxl_template
+++ b/Tools/msi/exe/exe_en-US.wxl_template
@@ -4,5 +4,5 @@
     <String Id="ShortDescriptor">executable</String>
     <String Id="ShortcutName">Python {{ShortVersion}} ({{Bitness}})</String>
     <String Id="ShortcutDescription">Launches the !(loc.ProductName) interpreter.</String>
-    <String Id="SupportUrl">http://www.python.org/</String>
+    <String Id="SupportUrl">https://www.python.org/</String>
 </WixLocalization>
diff --git a/Tools/msi/lib/lib.wxs b/Tools/msi/lib/lib.wxs
index 2a3b9ec..b38cd91 100644
--- a/Tools/msi/lib/lib.wxs
+++ b/Tools/msi/lib/lib.wxs
@@ -4,6 +4,7 @@
         <Package InstallerVersion="300" Compressed="yes" InstallScope="perUser" Platform="$(var.Platform)" />
         <MediaTemplate EmbedCab="yes" CompressionLevel="high" />
         
+        <PropertyRef Id="DetectTargetDir" />
         <PropertyRef Id="UpgradeTable" />
         <PropertyRef Id="REGISTRYKEY" />
         
diff --git a/Tools/msi/msi.props b/Tools/msi/msi.props
index 3f14501..cb9221f 100644
--- a/Tools/msi/msi.props
+++ b/Tools/msi/msi.props
@@ -28,7 +28,7 @@
         that intend to bundle Python should rebuild these modules with their
         own URI to avoid conflicting with the official releases.
         
-        The official releases use "http://www.python.org/$(ArchName)"
+        The official releases use "https://www.python.org/$(ArchName)"
         
         This is not the same as the DownloadUrl property used in the bundle
         projects.
diff --git a/Tools/msi/path/path.wxs b/Tools/msi/path/path.wxs
index 8b37936..017b812 100644
--- a/Tools/msi/path/path.wxs
+++ b/Tools/msi/path/path.wxs
@@ -2,7 +2,8 @@
 <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
     <Product Id="*" Language="!(loc.LCID)" Name="!(loc.Title)" Version="$(var.Version)" Manufacturer="!(loc.Manufacturer)" UpgradeCode="$(var.UpgradeCode)">
         <Package InstallerVersion="300" Compressed="yes" InstallScope="perUser" Platform="$(var.Platform)" />
-        
+
+        <PropertyRef Id="DetectTargetDir" />
         <PropertyRef Id="UpgradeTable" />
         <PropertyRef Id="REGISTRYKEY" />
         
diff --git a/Tools/msi/purge.py b/Tools/msi/purge.py
index a8b8f4d..41be069 100644
--- a/Tools/msi/purge.py
+++ b/Tools/msi/purge.py
@@ -12,7 +12,7 @@
 
 from urllib.request import *
 
-VERSION_RE = re.compile(r'(\d+\.\d+\.\d+)(\w+\d+)?$')
+VERSION_RE = re.compile(r'(\d+\.\d+\.\d+)([A-Za-z_]+\d+)?$')
 
 try:
     m = VERSION_RE.match(sys.argv[1])
@@ -65,7 +65,10 @@
     "python-{}-webinstall.exe".format(m.group(0)),
     "python-{}-amd64.exe".format(m.group(0)),
     "python-{}-amd64-webinstall.exe".format(m.group(0)),
+    "python-{}-embed-amd64.zip".format(m.group(0)),
+    "python-{}-embed-win32.zip".format(m.group(0)),
 ] + ["win32{}/{}".format(REL, f) for f in FILES] + ["amd64{}/{}".format(REL, f) for f in FILES]
+PATHS = PATHS + [p + ".asc" for p in PATHS]
 
 print('Purged:')
 for n in PATHS:
diff --git a/Tools/msi/tcltk/tcltk.wxs b/Tools/msi/tcltk/tcltk.wxs
index eeae8e8..bbf6ac7 100644
--- a/Tools/msi/tcltk/tcltk.wxs
+++ b/Tools/msi/tcltk/tcltk.wxs
@@ -4,6 +4,7 @@
         <Package InstallerVersion="300" Compressed="yes" InstallScope="perUser" Platform="$(var.Platform)" />
         <MediaTemplate EmbedCab="yes" CompressionLevel="high" />
         
+        <PropertyRef Id="DetectTargetDir" />
         <PropertyRef Id="UpgradeTable" />
         <PropertyRef Id="REGISTRYKEY" />
         
diff --git a/Tools/msi/test/test.wxs b/Tools/msi/test/test.wxs
index f2ed64f..e8f514a 100644
--- a/Tools/msi/test/test.wxs
+++ b/Tools/msi/test/test.wxs
@@ -4,6 +4,7 @@
         <Package InstallerVersion="300" Compressed="yes" InstallScope="perUser" Platform="$(var.Platform)" />
         <MediaTemplate EmbedCab="yes" CompressionLevel="high" />
         
+        <PropertyRef Id="DetectTargetDir" />
         <PropertyRef Id="UpgradeTable" />
         <PropertyRef Id="REGISTRYKEY" />
         
diff --git a/Tools/msi/tools/tools.wxs b/Tools/msi/tools/tools.wxs
index 7a805d0..133a743 100644
--- a/Tools/msi/tools/tools.wxs
+++ b/Tools/msi/tools/tools.wxs
@@ -4,6 +4,7 @@
         <Package InstallerVersion="300" Compressed="yes" InstallScope="perUser" Platform="$(var.Platform)" />
         <MediaTemplate EmbedCab="yes" CompressionLevel="high" />
         
+        <PropertyRef Id="DetectTargetDir" />
         <PropertyRef Id="UpgradeTable" />
         
         <Feature Id="DefaultFeature" AllowAdvertise="no" Title="!(loc.Title)" Description="!(loc.Description)">
diff --git a/Tools/msi/ucrt/ucrt.wxs b/Tools/msi/ucrt/ucrt.wxs
index 76e5682..94fd3f0 100644
--- a/Tools/msi/ucrt/ucrt.wxs
+++ b/Tools/msi/ucrt/ucrt.wxs
@@ -4,6 +4,7 @@
         <Package InstallerVersion="300" Compressed="yes" InstallScope="perUser" Platform="$(var.Platform)" />
         <MediaTemplate EmbedCab="yes" CompressionLevel="high" />
         
+        <PropertyRef Id="DetectTargetDir" />
         <PropertyRef Id="UpgradeTable" />
         <PropertyRef Id="REGISTRYKEY" />
         
diff --git a/Tools/msi/uploadrelease.ps1 b/Tools/msi/uploadrelease.ps1
index d3673b4..7c825c4 100644
--- a/Tools/msi/uploadrelease.ps1
+++ b/Tools/msi/uploadrelease.ps1
@@ -90,7 +90,7 @@
     $d = "$target/$($p[0])/"
     & $plink -batch $user@$server mkdir $d
     & $plink -batch $user@$server chgrp downloads $d
-    & $plink -batch $user@$server chmod g-x,o+rx $d
+    & $plink -batch $user@$server chmod o+rx $d
     & $pscp -batch $chm.FullName "$user@${server}:$d"
     if (-not $?) { throw "Failed to upload $chm" }
 
@@ -115,7 +115,7 @@
             $sd = "$d$($a.Name)$($p[1])/"
             & $plink -batch $user@$server mkdir $sd
             & $plink -batch $user@$server chgrp downloads $sd
-            & $plink -batch $user@$server chmod g-x,o+rx $sd
+            & $plink -batch $user@$server chmod o+rx $sd
             & $pscp -batch $msi.FullName "$user@${server}:$sd"
             if (-not $?) { throw "Failed to upload $msi" }
             & $plink -batch $user@$server chgrp downloads $sd*
diff --git a/Tools/peg_generator/Makefile b/Tools/peg_generator/Makefile
index fb727c0..6ad9c91 100644
--- a/Tools/peg_generator/Makefile
+++ b/Tools/peg_generator/Makefile
@@ -22,7 +22,7 @@
 
 build: peg_extension/parse.c
 
-peg_extension/parse.c: $(GRAMMAR) $(TOKENS) pegen/*.py peg_extension/peg_extension.c ../../Parser/pegen/pegen.c ../../Parser/pegen/parse_string.c ../../Parser/pegen/*.h pegen/grammar_parser.py
+peg_extension/parse.c: $(GRAMMAR) $(TOKENS) pegen/*.py peg_extension/peg_extension.c ../../Parser/pegen.c ../../Parser/string_parser.c ../../Parser/*.h pegen/grammar_parser.py
 	$(PYTHON) -m pegen -q c $(GRAMMAR) $(TOKENS) -o peg_extension/parse.c --compile-extension
 
 clean:
@@ -70,18 +70,10 @@
 time: time_compile
 
 time_compile: venv data/xxl.py
-	$(VENVPYTHON) scripts/benchmark.py --parser=new --target=xxl compile
+	$(VENVPYTHON) scripts/benchmark.py --target=xxl compile
 
 time_parse: venv data/xxl.py
-	$(VENVPYTHON) scripts/benchmark.py --parser=new --target=xxl parse
-
-time_old: time_old_compile
-
-time_old_compile: venv data/xxl.py
-	$(VENVPYTHON) scripts/benchmark.py --parser=old --target=xxl compile
-
-time_old_parse: venv data/xxl.py
-	$(VENVPYTHON) scripts/benchmark.py --parser=old --target=xxl parse
+	$(VENVPYTHON) scripts/benchmark.py --target=xxl parse
 
 time_peg_dir: venv
 	$(VENVPYTHON) scripts/test_parse_directory.py \
diff --git a/Tools/peg_generator/peg_extension/peg_extension.c b/Tools/peg_generator/peg_extension/peg_extension.c
index 96d3a52..bb4c1b0 100644
--- a/Tools/peg_generator/peg_extension/peg_extension.c
+++ b/Tools/peg_generator/peg_extension/peg_extension.c
@@ -1,4 +1,6 @@
 #include "pegen.h"
+#include "pycore_compile.h"       // _PyAST_Compile()
+
 
 PyObject *
 _build_return_object(mod_ty module, int mode, PyObject *filename_ob, PyArena *arena)
@@ -6,7 +8,7 @@
     PyObject *result = NULL;
 
     if (mode == 2) {
-        result = (PyObject *)PyAST_CompileObject(module, filename_ob, NULL, -1, arena);
+        result = (PyObject *)_PyAST_Compile(module, filename_ob, NULL, -1, arena);
     } else if (mode == 1) {
         result = PyAST_mod2obj(module);
     } else {
@@ -30,7 +32,7 @@
         return PyErr_Format(PyExc_ValueError, "Bad mode, must be 0 <= mode <= 2");
     }
 
-    PyArena *arena = PyArena_New();
+    PyArena *arena = _PyArena_New();
     if (arena == NULL) {
         return NULL;
     }
@@ -42,8 +44,17 @@
         goto error;
     }
 
+    FILE *fp = fopen(filename, "rb");
+    if (fp == NULL) {
+        PyErr_SetFromErrnoWithFilename(PyExc_OSError, filename);
+        goto error;
+    }
+
     PyCompilerFlags flags = _PyCompilerFlags_INIT;
-    mod_ty res = _PyPegen_run_parser_from_file(filename, Py_file_input, filename_ob, &flags, arena);
+    mod_ty res = _PyPegen_run_parser_from_file_pointer(
+                        fp, Py_file_input, filename_ob,
+                        NULL, NULL, NULL, &flags, NULL, arena);
+    fclose(fp);
     if (res == NULL) {
         goto error;
     }
@@ -52,7 +63,7 @@
 
 error:
     Py_XDECREF(filename_ob);
-    PyArena_Free(arena);
+    _PyArena_Free(arena);
     return result;
 }
 
@@ -69,7 +80,7 @@
         return PyErr_Format(PyExc_ValueError, "Bad mode, must be 0 <= mode <= 2");
     }
 
-    PyArena *arena = PyArena_New();
+    PyArena *arena = _PyArena_New();
     if (arena == NULL) {
         return NULL;
     }
@@ -91,27 +102,34 @@
 
 error:
     Py_XDECREF(filename_ob);
-    PyArena_Free(arena);
+    _PyArena_Free(arena);
     return result;
 }
 
 static PyObject *
 clear_memo_stats(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(ignored))
 {
+#if defined(PY_DEBUG)
     _PyPegen_clear_memo_statistics();
+#endif
     Py_RETURN_NONE;
 }
 
 static PyObject *
 get_memo_stats(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(ignored))
 {
+#if defined(PY_DEBUG)
     return _PyPegen_get_memo_statistics();
+#else
+    Py_RETURN_NONE;
+#endif
 }
 
 // TODO: Write to Python's sys.stdout instead of C's stdout.
 static PyObject *
 dump_memo_stats(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(ignored))
 {
+#if defined(PY_DEBUG)
     PyObject *list = _PyPegen_get_memo_statistics();
     if (list == NULL) {
         return NULL;
@@ -128,6 +146,7 @@
         }
     }
     Py_DECREF(list);
+#endif
     Py_RETURN_NONE;
 }
 
diff --git a/Tools/peg_generator/pegen/__main__.py b/Tools/peg_generator/pegen/__main__.py
index 1dcbaad..c0f3b68 100755
--- a/Tools/peg_generator/pegen/__main__.py
+++ b/Tools/peg_generator/pegen/__main__.py
@@ -14,6 +14,7 @@
 from typing import Tuple
 
 from pegen.build import Grammar, Parser, Tokenizer, ParserGenerator
+from pegen.validator import validate_grammar
 
 
 def generate_c_code(
@@ -128,6 +129,8 @@
     grammar, parser, tokenizer, gen = args.func(args)
     t1 = time.time()
 
+    validate_grammar(grammar)
+
     if not args.quiet:
         if args.verbose:
             print("Raw Grammar:")
diff --git a/Tools/peg_generator/pegen/build.py b/Tools/peg_generator/pegen/build.py
index 931ffc7..61a48d5 100644
--- a/Tools/peg_generator/pegen/build.py
+++ b/Tools/peg_generator/pegen/build.py
@@ -1,6 +1,7 @@
 import pathlib
 import shutil
 import tokenize
+import sys
 import sysconfig
 import tempfile
 import itertools
@@ -33,6 +34,7 @@
     build_dir: Optional[str] = None,
     verbose: bool = False,
     keep_asserts: bool = True,
+    disable_optimization: bool = True,  # Significant test_peg_generator speedup.
 ) -> str:
     """Compile the generated source for a parser generator into an extension module.
 
@@ -56,9 +58,20 @@
     source_file_path = pathlib.Path(generated_source_path)
     extension_name = source_file_path.stem
     extra_compile_args = get_extra_flags("CFLAGS", "PY_CFLAGS_NODIST")
+    extra_compile_args.append("-DPy_BUILD_CORE_MODULE")
+    # Define _Py_TEST_PEGEN to not call PyAST_Validate() in Parser/pegen.c
+    extra_compile_args.append('-D_Py_TEST_PEGEN')
     extra_link_args = get_extra_flags("LDFLAGS", "PY_LDFLAGS_NODIST")
     if keep_asserts:
         extra_compile_args.append("-UNDEBUG")
+    if disable_optimization:
+        if sys.platform == 'win32':
+            extra_compile_args.append("/Od")
+            extra_link_args.append("/LTCG:OFF")
+        else:
+            extra_compile_args.append("-O0")
+            if sysconfig.get_config_var("GNULD") == "yes":
+                extra_link_args.append("-fno-lto")
     extension = [
         Extension(
             extension_name,
@@ -66,15 +79,14 @@
                 str(MOD_DIR.parent.parent.parent / "Python" / "Python-ast.c"),
                 str(MOD_DIR.parent.parent.parent / "Python" / "asdl.c"),
                 str(MOD_DIR.parent.parent.parent / "Parser" / "tokenizer.c"),
-                str(MOD_DIR.parent.parent.parent / "Parser" / "pegen" / "pegen.c"),
-                str(MOD_DIR.parent.parent.parent / "Parser" / "pegen" / "parse_string.c"),
+                str(MOD_DIR.parent.parent.parent / "Parser" / "pegen.c"),
+                str(MOD_DIR.parent.parent.parent / "Parser" / "string_parser.c"),
                 str(MOD_DIR.parent / "peg_extension" / "peg_extension.c"),
                 generated_source_path,
             ],
             include_dirs=[
                 str(MOD_DIR.parent.parent.parent / "Include" / "internal"),
                 str(MOD_DIR.parent.parent.parent / "Parser"),
-                str(MOD_DIR.parent.parent.parent / "Parser" / "pegen"),
             ],
             extra_compile_args=extra_compile_args,
             extra_link_args=extra_link_args,
diff --git a/Tools/peg_generator/pegen/c_generator.py b/Tools/peg_generator/pegen/c_generator.py
index b4d6a0b..2f0d829 100644
--- a/Tools/peg_generator/pegen/c_generator.py
+++ b/Tools/peg_generator/pegen/c_generator.py
@@ -1,5 +1,6 @@
 import ast
 from dataclasses import field, dataclass
+import os.path
 import re
 from typing import Any, Dict, IO, Optional, List, Text, Tuple, Set
 from enum import Enum
@@ -8,6 +9,7 @@
 from pegen.grammar import (
     Alt,
     Cut,
+    Forced,
     Gather,
     GrammarVisitor,
     Group,
@@ -30,12 +32,13 @@
 #include "pegen.h"
 
 #if defined(Py_DEBUG) && defined(Py_BUILD_CORE)
-extern int Py_DebugFlag;
-#define D(x) if (Py_DebugFlag) x;
+#  define D(x) if (Py_DebugFlag) x;
 #else
-#define D(x)
+#  define D(x)
 #endif
 
+# define MAXSTACK 6000
+
 """
 
 
@@ -46,6 +49,7 @@
     // Initialize keywords
     p->keywords = reserved_keywords;
     p->n_keyword_lists = n_keyword_lists;
+    p->soft_keywords = soft_keywords;
 
     return start_rule(p);
 }
@@ -66,6 +70,7 @@
     "NAME": NodeTypes.NAME_TOKEN,
     "NUMBER": NodeTypes.NUMBER_TOKEN,
     "STRING": NodeTypes.STRING_TOKEN,
+    "SOFT_KEYWORD": NodeTypes.SOFT_KEYWORD,
 }
 
 
@@ -74,6 +79,7 @@
     function: str
     arguments: List[Any] = field(default_factory=list)
     assigned_variable: Optional[str] = None
+    assigned_variable_type: Optional[str] = None
     return_type: Optional[str] = None
     nodetype: Optional[NodeTypes] = None
     force_true: bool = False
@@ -85,9 +91,12 @@
         if self.arguments:
             parts.append(f"({', '.join(map(str, self.arguments))})")
         if self.force_true:
-            parts.append(", 1")
+            parts.append(", !p->error_indicator")
         if self.assigned_variable:
-            parts = ["(", self.assigned_variable, " = ", *parts, ")"]
+            if self.assigned_variable_type:
+                parts = ["(", self.assigned_variable, " = ", '(', self.assigned_variable_type, ')', *parts, ")"]
+            else:
+                parts = ["(", self.assigned_variable, " = ", *parts, ")"]
         if self.comment:
             parts.append(f"  // {self.comment}")
         return "".join(parts)
@@ -106,6 +115,7 @@
         self.cache: Dict[Any, FunctionCall] = {}
         self.keyword_cache: Dict[str, int] = {}
         self.soft_keywords: Set[str] = set()
+        self.cleanup_statements: List[str] = []
 
     def keyword_helper(self, keyword: str) -> FunctionCall:
         if keyword not in self.keyword_cache:
@@ -210,6 +220,8 @@
         call = self.generate_call(node.item)
         if node.name:
             call.assigned_variable = node.name
+        if node.type:
+            call.assigned_variable_type = node.type
         return call
 
     def lookahead_call_helper(self, node: Lookahead, positive: int) -> FunctionCall:
@@ -246,6 +258,24 @@
     def visit_NegativeLookahead(self, node: NegativeLookahead) -> FunctionCall:
         return self.lookahead_call_helper(node, 0)
 
+    def visit_Forced(self, node: Forced) -> FunctionCall:
+        call = self.generate_call(node.node)
+        if call.nodetype == NodeTypes.GENERIC_TOKEN:
+            val = ast.literal_eval(node.node.value)
+            assert val in self.exact_tokens, f"{node.value} is not a known literal"
+            type = self.exact_tokens[val]
+            return FunctionCall(
+                assigned_variable="_literal",
+                function=f"_PyPegen_expect_forced_token",
+                arguments=["p", type, f'"{val}"'],
+                nodetype=NodeTypes.GENERIC_TOKEN,
+                return_type="Token *",
+                comment=f"forced_token='{val}'",
+            )
+        else:
+            raise NotImplementedError(
+                    f"Forced tokens don't work with {call.nodetype} tokens")
+
     def visit_Opt(self, node: Opt) -> FunctionCall:
         call = self.generate_call(node.node)
         return FunctionCall(
@@ -328,14 +358,21 @@
         self._varname_counter = 0
         self.debug = debug
         self.skip_actions = skip_actions
+        self.cleanup_statements: List[str] = []
 
     def add_level(self) -> None:
-        self.print("D(p->level++);")
+        self.print("if (p->level++ == MAXSTACK) {")
+        with self.indent():
+            self.print("p->error_indicator = 1;")
+            self.print("PyErr_NoMemory();")
+        self.print("}")
 
     def remove_level(self) -> None:
-        self.print("D(p->level--);")
+        self.print("p->level--;")
 
     def add_return(self, ret_val: str) -> None:
+        for stmt in self.cleanup_statements:
+            self.print(stmt)
         self.remove_level()
         self.print(f"return {ret_val};")
 
@@ -379,7 +416,8 @@
 
     def generate(self, filename: str) -> None:
         self.collect_todo()
-        self.print(f"// @generated by pegen.py from {filename}")
+        basename = os.path.basename(filename)
+        self.print(f"// @generated by pegen.py from {basename}")
         header = self.grammar.metas.get("header", EXTENSION_PREFIX)
         if header:
             self.print(header.rstrip("\n"))
@@ -387,6 +425,7 @@
         if subheader:
             self.print(subheader)
         self._setup_keywords()
+        self._setup_soft_keywords()
         for i, (rulename, rule) in enumerate(self.todo.items(), 1000):
             comment = "  // Left-recursive" if rule.left_recursive else ""
             self.print(f"#define {rulename}_type {i}{comment}")
@@ -450,6 +489,15 @@
                     self.print("},")
         self.print("};")
 
+    def _setup_soft_keywords(self) -> None:
+        soft_keywords = sorted(self.callmakervisitor.soft_keywords)
+        self.print("static char *soft_keywords[] = {")
+        with self.indent():
+            for keyword in soft_keywords:
+                self.print(f'"{keyword}",')
+            self.print("NULL,")
+        self.print("};")
+
     def _set_up_token_start_metadata_extraction(self) -> None:
         self.print("if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {")
         with self.indent():
@@ -496,9 +544,10 @@
                 )
                 self.print("p->mark = _mark;")
                 self.print(f"void *_raw = {node.name}_raw(p);")
-                self.print("if (p->error_indicator)")
+                self.print("if (p->error_indicator) {")
                 with self.indent():
-                    self.print("return NULL;")
+                    self.add_return("NULL")
+                self.print("}")
                 self.print("if (_raw == NULL || p->mark <= _resmark)")
                 with self.indent():
                     self.print("break;")
@@ -558,8 +607,8 @@
             self.print("int _start_mark = p->mark;")
             self.print("void **_children = PyMem_Malloc(sizeof(void *));")
             self.out_of_memory_return(f"!_children")
-            self.print("ssize_t _children_capacity = 1;")
-            self.print("ssize_t _n = 0;")
+            self.print("Py_ssize_t _children_capacity = 1;")
+            self.print("Py_ssize_t _n = 0;")
             if any(alt.action and "EXTRA" in alt.action for alt in rhs.alts):
                 self._set_up_token_start_metadata_extraction()
             self.visit(
@@ -571,9 +620,9 @@
                     self.print("PyMem_Free(_children);")
                     self.add_return("NULL")
                 self.print("}")
-            self.print("asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);")
+            self.print("asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);")
             self.out_of_memory_return(f"!_seq", cleanup_code="PyMem_Free(_children);")
-            self.print("for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);")
+            self.print("for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);")
             self.print("PyMem_Free(_children);")
             if node.name:
                 self.print(f"_PyPegen_insert_memo(p, _start_mark, {node.name}_type, _seq);")
@@ -602,10 +651,21 @@
             self._set_up_rule_memoization(node, result_type)
 
         self.print("{")
+
+        if node.name.endswith("without_invalid"):
+            with self.indent():
+                self.print("int _prev_call_invalid = p->call_invalid_rules;")
+                self.print("p->call_invalid_rules = 0;")
+                self.cleanup_statements.append("p->call_invalid_rules = _prev_call_invalid;")
+
         if is_loop:
             self._handle_loop_rule_body(node, rhs)
         else:
             self._handle_default_rule_body(node, rhs, result_type)
+
+        if node.name.endswith("without_invalid"):
+            self.cleanup_statements.pop()
+
         self.print("}")
 
     def visit_NamedItem(self, node: NamedItem) -> None:
@@ -685,7 +745,7 @@
             self.print(
                 f'D(fprintf(stderr, "%*c+ {rulename}[%d-%d]: %s succeeded!\\n", p->level, \' \', _mark, p->mark, "{node_str}"));'
             )
-            # Prepare to emmit the rule action and do so
+            # Prepare to emit the rule action and do so
             if node.action and "EXTRA" in node.action:
                 self._set_up_token_end_metadata_extraction()
             if self.skip_actions:
@@ -788,4 +848,5 @@
         name = node.name if node.name else call.assigned_variable
         if name is not None:
             name = self.dedupe(name)
-        return name, call.return_type
+        return_type = call.return_type if node.type is None else node.type
+        return name, return_type
diff --git a/Tools/peg_generator/pegen/first_sets.py b/Tools/peg_generator/pegen/first_sets.py
index 71be5a2..ce80bb5 100755
--- a/Tools/peg_generator/pegen/first_sets.py
+++ b/Tools/peg_generator/pegen/first_sets.py
@@ -59,7 +59,7 @@
                 result -= to_remove
 
             # If the set of new terminals can start with the empty string,
-            # it means that the item is completelly nullable and we should
+            # it means that the item is completely nullable and we should
             # also considering at least the next item in case the current
             # one fails to parse.
 
diff --git a/Tools/peg_generator/pegen/grammar.py b/Tools/peg_generator/pegen/grammar.py
index 78edf41..66fd5b3 100644
--- a/Tools/peg_generator/pegen/grammar.py
+++ b/Tools/peg_generator/pegen/grammar.py
@@ -259,9 +259,10 @@
 
 
 class NamedItem:
-    def __init__(self, name: Optional[str], item: Item):
+    def __init__(self, name: Optional[str], item: Item, type: Optional[str] = None):
         self.name = name
         self.item = item
+        self.type = type
         self.nullable = False
 
     def __str__(self) -> str:
@@ -287,6 +288,23 @@
         gen.callmakervisitor.visit(self.item)
 
 
+class Forced:
+    def __init__(self, node: Plain):
+        self.node = node
+
+    def __str__(self) -> str:
+        return f"&&{self.node}"
+
+    def __iter__(self) -> Iterator[Plain]:
+        yield self.node
+
+    def nullable_visit(self, rules: Dict[str, Rule]) -> bool:
+        return True
+
+    def initial_names(self) -> AbstractSet[str]:
+        return set()
+
+
 class Lookahead:
     def __init__(self, node: Plain, sign: str):
         self.node = node
@@ -458,7 +476,7 @@
 
 
 Plain = Union[Leaf, Group]
-Item = Union[Plain, Opt, Repeat, Lookahead, Rhs, Cut]
+Item = Union[Plain, Opt, Repeat, Forced, Lookahead, Rhs, Cut]
 RuleName = Tuple[str, str]
 MetaTuple = Tuple[str, Optional[str]]
 MetaList = List[MetaTuple]
diff --git a/Tools/peg_generator/pegen/grammar_parser.py b/Tools/peg_generator/pegen/grammar_parser.py
index c784cfd..892df5c 100644
--- a/Tools/peg_generator/pegen/grammar_parser.py
+++ b/Tools/peg_generator/pegen/grammar_parser.py
@@ -1,11 +1,8 @@
 #!/usr/bin/env python3.8
-# @generated by pegen from ./Tools/peg_generator/pegen/metagrammar.gram
+# @generated by pegen from metagrammar.gram
 
 import ast
-import sys
-import tokenize
-
-from typing import Any, Optional
+from typing import Optional, Any
 
 from pegen.parser import memoize, memoize_left_rec, logger, Parser
 from ast import literal_eval
@@ -13,6 +10,7 @@
 from pegen.grammar import (
     Alt,
     Cut,
+    Forced,
     Gather,
     Group,
     Item,
@@ -402,12 +400,52 @@
 
     @memoize
     def named_item(self) -> Optional[NamedItem]:
-        # named_item: NAME '=' ~ item | item | lookahead
+        # named_item: NAME '[' NAME '*' ']' '=' ~ item | NAME '[' NAME ']' '=' ~ item | NAME '=' ~ item | item | forced_atom | lookahead
         mark = self.mark()
         cut = False
         if (
             (name := self.name())
             and
+            (literal := self.expect('['))
+            and
+            (type := self.name())
+            and
+            (literal_1 := self.expect('*'))
+            and
+            (literal_2 := self.expect(']'))
+            and
+            (literal_3 := self.expect('='))
+            and
+            (cut := True)
+            and
+            (item := self.item())
+        ):
+            return NamedItem ( name . string , item , f"{type.string}*" )
+        self.reset(mark)
+        if cut: return None
+        cut = False
+        if (
+            (name := self.name())
+            and
+            (literal := self.expect('['))
+            and
+            (type := self.name())
+            and
+            (literal_1 := self.expect(']'))
+            and
+            (literal_2 := self.expect('='))
+            and
+            (cut := True)
+            and
+            (item := self.item())
+        ):
+            return NamedItem ( name . string , item , type . string )
+        self.reset(mark)
+        if cut: return None
+        cut = False
+        if (
+            (name := self.name())
+            and
             (literal := self.expect('='))
             and
             (cut := True)
@@ -426,6 +464,13 @@
         if cut: return None
         cut = False
         if (
+            (it := self.forced_atom())
+        ):
+            return NamedItem ( None , it )
+        self.reset(mark)
+        if cut: return None
+        cut = False
+        if (
             (it := self.lookahead())
         ):
             return NamedItem ( None , it )
@@ -434,6 +479,25 @@
         return None
 
     @memoize
+    def forced_atom(self) -> Optional[NamedItem]:
+        # forced_atom: '&' '&' ~ atom
+        mark = self.mark()
+        cut = False
+        if (
+            (literal := self.expect('&'))
+            and
+            (literal_1 := self.expect('&'))
+            and
+            (cut := True)
+            and
+            (atom := self.atom())
+        ):
+            return Forced ( atom )
+        self.reset(mark)
+        if cut: return None
+        return None
+
+    @memoize
     def lookahead(self) -> Optional[LookaheadOrCut]:
         # lookahead: '&' ~ atom | '!' ~ atom | '~'
         mark = self.mark()
diff --git a/Tools/peg_generator/pegen/keywordgen.py b/Tools/peg_generator/pegen/keywordgen.py
index fa57770..2937ddb 100644
--- a/Tools/peg_generator/pegen/keywordgen.py
+++ b/Tools/peg_generator/pegen/keywordgen.py
@@ -14,7 +14,7 @@
 the python source tree and run:
 
     PYTHONPATH=Tools/peg_generator python3 -m pegen.keywordgen \
-        Grammar/Grammar \
+        Grammar/python.gram \
         Grammar/Tokens \
         Lib/keyword.py
 
@@ -46,9 +46,7 @@
         "grammar", type=str, help="The file with the grammar definition in PEG format"
     )
     parser.add_argument(
-        "tokens_file",
-        type=argparse.FileType("r"),
-        help="The file with the token definitions"
+        "tokens_file", type=argparse.FileType("r"), help="The file with the token definitions"
     )
     parser.add_argument(
         "keyword_file",
diff --git a/Tools/peg_generator/pegen/metagrammar.gram b/Tools/peg_generator/pegen/metagrammar.gram
index f0c5ac3..bb4355f 100644
--- a/Tools/peg_generator/pegen/metagrammar.gram
+++ b/Tools/peg_generator/pegen/metagrammar.gram
@@ -4,6 +4,7 @@
 from pegen.grammar import (
     Alt,
     Cut,
+    Forced,
     Gather,
     Group,
     Item,
@@ -83,10 +84,16 @@
     | named_item { [named_item] }
 
 named_item[NamedItem]:
+    | NAME '[' type=NAME '*' ']' '=' ~ item {NamedItem(name.string, item, f"{type.string}*")}
+    | NAME '[' type=NAME ']' '=' ~ item {NamedItem(name.string, item, type.string)}
     | NAME '=' ~ item {NamedItem(name.string, item)}
     | item {NamedItem(None, item)}
+    | it=forced_atom {NamedItem(None, it)}
     | it=lookahead {NamedItem(None, it)}
 
+forced_atom[NamedItem]:
+    | '&''&' ~ atom {Forced(atom)}
+
 lookahead[LookaheadOrCut]:
     | '&' ~ atom {PositiveLookahead(atom)}
     | '!' ~ atom {NegativeLookahead(atom)}
diff --git a/Tools/peg_generator/pegen/python_generator.py b/Tools/peg_generator/pegen/python_generator.py
index b786de7..4b270aa 100644
--- a/Tools/peg_generator/pegen/python_generator.py
+++ b/Tools/peg_generator/pegen/python_generator.py
@@ -1,3 +1,4 @@
+import os.path
 import token
 from typing import Any, Dict, Optional, IO, Text, Tuple
 
@@ -27,10 +28,7 @@
 # @generated by pegen from {filename}
 
 import ast
-import sys
-import tokenize
-
-from typing import Any, Optional
+from typing import Optional, Any
 
 from pegen.parser import memoize, memoize_left_rec, logger, Parser
 
@@ -142,7 +140,8 @@
     def generate(self, filename: str) -> None:
         header = self.grammar.metas.get("header", MODULE_PREFIX)
         if header is not None:
-            self.print(header.rstrip("\n").format(filename=filename))
+            basename = os.path.basename(filename)
+            self.print(header.rstrip("\n").format(filename=basename))
         subheader = self.grammar.metas.get("subheader", "")
         if subheader:
             self.print(subheader.format(filename=filename))
diff --git a/Tools/peg_generator/pegen/validator.py b/Tools/peg_generator/pegen/validator.py
new file mode 100644
index 0000000..0e3dd41
--- /dev/null
+++ b/Tools/peg_generator/pegen/validator.py
@@ -0,0 +1,52 @@
+from pegen import grammar
+from pegen.grammar import (
+    Alt,
+    Cut,
+    Gather,
+    GrammarVisitor,
+    Group,
+    Lookahead,
+    NamedItem,
+    NameLeaf,
+    NegativeLookahead,
+    Opt,
+    PositiveLookahead,
+    Repeat0,
+    Repeat1,
+    Rhs,
+    Rule,
+    StringLeaf,
+)
+
+class ValidationError(Exception):
+    pass
+
+class GrammarValidator(GrammarVisitor):
+    def __init__(self, grammar: grammar.Grammar):
+        self.grammar = grammar
+        self.rulename = None
+
+    def validate_rule(self, rulename: str, node: Rule):
+        self.rulename = rulename
+        self.visit(node)
+        self.rulename = None
+
+
+class SubRuleValidator(GrammarValidator):
+    def visit_Rhs(self, node: Rule):
+        for index, alt in enumerate(node.alts):
+            alts_to_consider = node.alts[index+1:]
+            for other_alt in alts_to_consider:
+                self.check_intersection(alt, other_alt)
+
+    def check_intersection(self, first_alt: Alt, second_alt: Alt) -> bool:
+        if str(second_alt).startswith(str(first_alt)):
+            raise ValidationError(
+                    f"In {self.rulename} there is an alternative that will "
+                    f"never be visited:\n{second_alt}")
+
+def validate_grammar(the_grammar: grammar.Grammar):
+    for validator_cls in GrammarValidator.__subclasses__():
+        validator = validator_cls(the_grammar)
+        for rule_name, rule in the_grammar.rules.items():
+            validator.validate_rule(rule_name, rule)
diff --git a/Tools/peg_generator/scripts/benchmark.py b/Tools/peg_generator/scripts/benchmark.py
index af356be..5fbedaa 100644
--- a/Tools/peg_generator/scripts/benchmark.py
+++ b/Tools/peg_generator/scripts/benchmark.py
@@ -6,13 +6,13 @@
 import os
 from time import time
 
-import _peg_parser
-
 try:
     import memory_profiler
 except ModuleNotFoundError:
-    print("Please run `make venv` to create a virtual environment and install"
-          " all the dependencies, before running this script.")
+    print(
+        "Please run `make venv` to create a virtual environment and install"
+        " all the dependencies, before running this script."
+    )
     sys.exit(1)
 
 sys.path.insert(0, os.getcwd())
@@ -22,13 +22,6 @@
     prog="benchmark", description="Reproduce the various pegen benchmarks"
 )
 argparser.add_argument(
-    "--parser",
-    action="store",
-    choices=["new", "old"],
-    default="pegen",
-    help="Which parser to benchmark (default is pegen)",
-)
-argparser.add_argument(
     "--target",
     action="store",
     choices=["xxl", "stdlib"],
@@ -40,12 +33,7 @@
 command_compile = subcommands.add_parser(
     "compile", help="Benchmark parsing and compiling to bytecode"
 )
-command_parse = subcommands.add_parser(
-    "parse", help="Benchmark parsing and generating an ast.AST"
-)
-command_notree = subcommands.add_parser(
-    "notree", help="Benchmark parsing and dumping the tree"
-)
+command_parse = subcommands.add_parser("parse", help="Benchmark parsing and generating an ast.AST")
 
 
 def benchmark(func):
@@ -66,59 +54,37 @@
 
 
 @benchmark
-def time_compile(source, parser):
-    if parser == "old":
-        return _peg_parser.compile_string(
-            source,
-            oldparser=True,
-        )
-    else:
-        return _peg_parser.compile_string(source)
+def time_compile(source):
+    return compile(source, "<string>", "exec")
 
 
 @benchmark
-def time_parse(source, parser):
-    if parser == "old":
-        return _peg_parser.parse_string(source, oldparser=True)
-    else:
-        return _peg_parser.parse_string(source)
+def time_parse(source):
+    return ast.parse(source)
 
 
-@benchmark
-def time_notree(source, parser):
-    if parser == "old":
-        return _peg_parser.parse_string(source, oldparser=True, ast=False)
-    else:
-        return _peg_parser.parse_string(source, ast=False)
-
-
-def run_benchmark_xxl(subcommand, parser, source):
+def run_benchmark_xxl(subcommand, source):
     if subcommand == "compile":
-        time_compile(source, parser)
+        time_compile(source)
     elif subcommand == "parse":
-        time_parse(source, parser)
-    elif subcommand == "notree":
-        time_notree(source, parser)
+        time_parse(source)
 
 
-def run_benchmark_stdlib(subcommand, parser):
-    modes = {"compile": 2, "parse": 1, "notree": 0}
+def run_benchmark_stdlib(subcommand):
+    modes = {"compile": 2, "parse": 1}
     for _ in range(3):
         parse_directory(
             "../../Lib",
             verbose=False,
             excluded_files=["*/bad*", "*/lib2to3/tests/data/*",],
-            tree_arg=0,
             short=True,
             mode=modes[subcommand],
-            oldparser=(parser == "old"),
         )
 
 
 def main():
     args = argparser.parse_args()
     subcommand = args.subcommand
-    parser = args.parser
     target = args.target
 
     if subcommand is None:
@@ -127,9 +93,9 @@
     if target == "xxl":
         with open(os.path.join("data", "xxl.py"), "r") as f:
             source = f.read()
-            run_benchmark_xxl(subcommand, parser, source)
+            run_benchmark_xxl(subcommand, source)
     elif target == "stdlib":
-        run_benchmark_stdlib(subcommand, parser)
+        run_benchmark_stdlib(subcommand)
 
 
 if __name__ == "__main__":
diff --git a/Tools/peg_generator/scripts/download_pypi_packages.py b/Tools/peg_generator/scripts/download_pypi_packages.py
index 9874202..ca12160 100755
--- a/Tools/peg_generator/scripts/download_pypi_packages.py
+++ b/Tools/peg_generator/scripts/download_pypi_packages.py
@@ -72,7 +72,7 @@
 
         package_json = load_json(package_name)
         try:
-            print(f"Dowloading and compressing package {package_name} ... ", end="")
+            print(f"Downloading and compressing package {package_name} ... ", end="")
             download_package_code(package_name, package_json)
             print("Done")
         except (IndexError, KeyError):
diff --git a/Tools/peg_generator/scripts/find_max_nesting.py b/Tools/peg_generator/scripts/find_max_nesting.py
index f2fdd00..92045c9 100755
--- a/Tools/peg_generator/scripts/find_max_nesting.py
+++ b/Tools/peg_generator/scripts/find_max_nesting.py
@@ -14,8 +14,7 @@
 Usage: python -m scripts.find_max_nesting
 """
 import sys
-
-from _peg_parser import parse_string
+import ast
 
 GRAMMAR_FILE = "data/python.gram"
 INITIAL_NESTING_DEPTH = 10
@@ -28,9 +27,8 @@
 
 def check_nested_expr(nesting_depth: int) -> bool:
     expr = f"{'(' * nesting_depth}0{')' * nesting_depth}"
-
     try:
-        parse_string(expr)
+        ast.parse(expr)
         print(f"Nesting depth of {nesting_depth} is successful")
         return True
     except Exception as err:
diff --git a/Tools/peg_generator/scripts/grammar_grapher.py b/Tools/peg_generator/scripts/grammar_grapher.py
index 4afdbce..c527e19 100755
--- a/Tools/peg_generator/scripts/grammar_grapher.py
+++ b/Tools/peg_generator/scripts/grammar_grapher.py
@@ -29,6 +29,7 @@
 from pegen.grammar import (
     Alt,
     Cut,
+    Forced,
     Grammar,
     Group,
     Leaf,
@@ -57,6 +58,8 @@
         return [_ref for _item in item.items for _ref in references_for_item(_item)]
     elif isinstance(item, Cut):
         return []
+    elif isinstance(item, Forced):
+        return references_for_item(item.node)
     elif isinstance(item, Group):
         return references_for_item(item.rhs)
     elif isinstance(item, Lookahead):
diff --git a/Tools/peg_generator/scripts/show_parse.py b/Tools/peg_generator/scripts/show_parse.py
deleted file mode 100755
index b4ee5a1..0000000
--- a/Tools/peg_generator/scripts/show_parse.py
+++ /dev/null
@@ -1,121 +0,0 @@
-#!/usr/bin/env python3.8
-
-"""Show the parse tree for a given program, nicely formatted.
-
-Example:
-
-$ scripts/show_parse.py a+b
-Module(
-    body=[
-        Expr(
-            value=BinOp(
-                left=Name(id="a", ctx=Load()), op=Add(), right=Name(id="b", ctx=Load())
-            )
-        )
-    ],
-    type_ignores=[],
-)
-$
-
-Use -v to show line numbers and column offsets.
-
-The formatting is done using black.  You can also import this module
-and call one of its functions.
-"""
-
-import argparse
-import ast
-import difflib
-import os
-import sys
-import tempfile
-
-import _peg_parser
-
-from typing import List
-
-sys.path.insert(0, os.getcwd())
-from pegen.ast_dump import ast_dump
-
-parser = argparse.ArgumentParser()
-parser.add_argument(
-    "-d", "--diff", action="store_true", help="show diff between grammar and ast (requires -g)"
-)
-parser.add_argument(
-    "-p",
-    "--parser",
-    choices=["new", "old"],
-    default="new",
-    help="choose the parser to use"
-)
-parser.add_argument(
-    "-m",
-    "--multiline",
-    action="store_true",
-    help="concatenate program arguments using newline instead of space",
-)
-parser.add_argument("-v", "--verbose", action="store_true", help="show line/column numbers")
-parser.add_argument("program", nargs="+", help="program to parse (will be concatenated)")
-
-
-def format_tree(tree: ast.AST, verbose: bool = False) -> str:
-    with tempfile.NamedTemporaryFile("w+") as tf:
-        tf.write(ast_dump(tree, include_attributes=verbose))
-        tf.write("\n")
-        tf.flush()
-        cmd = f"black -q {tf.name}"
-        sts = os.system(cmd)
-        if sts:
-            raise RuntimeError(f"Command {cmd!r} failed with status 0x{sts:x}")
-        tf.seek(0)
-        return tf.read()
-
-
-def diff_trees(a: ast.AST, b: ast.AST, verbose: bool = False) -> List[str]:
-    sa = format_tree(a, verbose)
-    sb = format_tree(b, verbose)
-    la = sa.splitlines()
-    lb = sb.splitlines()
-    return list(difflib.unified_diff(la, lb, "a", "b", lineterm=""))
-
-
-def show_parse(source: str, verbose: bool = False) -> str:
-    tree = _peg_parser.parse_string(source, oldparser=True)
-    return format_tree(tree, verbose).rstrip("\n")
-
-
-def print_parse(source: str, verbose: bool = False) -> None:
-    print(show_parse(source, verbose))
-
-
-def main() -> None:
-    args = parser.parse_args()
-    new_parser = args.parser == "new"
-    if args.multiline:
-        sep = "\n"
-    else:
-        sep = " "
-    program = sep.join(args.program)
-    if new_parser:
-        tree = _peg_parser.parse_string(program)
-
-        if args.diff:
-            a = _peg_parser.parse_string(program, oldparser=True)
-            b = tree
-            diff = diff_trees(a, b, args.verbose)
-            if diff:
-                for line in diff:
-                    print(line)
-            else:
-                print("# Trees are the same")
-        else:
-            print("# Parsed using the new parser")
-            print(format_tree(tree, args.verbose))
-    else:
-        tree = _peg_parser.parse_string(program, oldparser=True)
-        print("# Parsed using the old parser")
-        print(format_tree(tree, args.verbose))
-
-
-if __name__ == "__main__":
-    main()
diff --git a/Tools/peg_generator/scripts/test_parse_directory.py b/Tools/peg_generator/scripts/test_parse_directory.py
index 6dfdbb9..a5e26f0 100755
--- a/Tools/peg_generator/scripts/test_parse_directory.py
+++ b/Tools/peg_generator/scripts/test_parse_directory.py
@@ -5,8 +5,8 @@
 import os
 import sys
 import time
+import traceback
 import tokenize
-import _peg_parser
 from glob import glob, escape
 from pathlib import PurePath
 
@@ -15,7 +15,6 @@
 sys.path.insert(0, os.getcwd())
 from pegen.ast_dump import ast_dump
 from pegen.testutil import print_memstats
-from scripts import show_parse
 
 SUCCESS = "\033[92m"
 FAIL = "\033[91m"
@@ -39,9 +38,6 @@
 argparser.add_argument(
     "-v", "--verbose", action="store_true", help="Display detailed errors for failures"
 )
-argparser.add_argument(
-    "-t", "--tree", action="count", help="Compare parse tree to official AST", default=0
-)
 
 
 def report_status(
@@ -78,66 +74,13 @@
             print(f"  {str(error.__class__.__name__)}: {error}")
 
 
-def compare_trees(
-    actual_tree: ast.AST, file: str, verbose: bool, include_attributes: bool = False,
-) -> int:
-    with open(file) as f:
-        expected_tree = _peg_parser.parse_string(f.read(), oldparser=True)
-
-    expected_text = ast_dump(expected_tree, include_attributes=include_attributes)
-    actual_text = ast_dump(actual_tree, include_attributes=include_attributes)
-    if actual_text == expected_text:
-        if verbose:
-            print("Tree for {file}:")
-            print(show_parse.format_tree(actual_tree, include_attributes))
-        return 0
-
-    print(f"Diffing ASTs for {file} ...")
-
-    expected = show_parse.format_tree(expected_tree, include_attributes)
-    actual = show_parse.format_tree(actual_tree, include_attributes)
-
-    if verbose:
-        print("Expected for {file}:")
-        print(expected)
-        print("Actual for {file}:")
-        print(actual)
-        print(f"Diff for {file}:")
-
-    diff = show_parse.diff_trees(expected_tree, actual_tree, include_attributes)
-    for line in diff:
-        print(line)
-
-    return 1
-
-
-def parse_file(source: str, file: str, mode: int, oldparser: bool) -> Tuple[Any, float]:
+def parse_file(source: str, file: str) -> Tuple[Any, float]:
     t0 = time.time()
-    if mode == COMPILE:
-        result = _peg_parser.compile_string(
-            source,
-            filename=file,
-            oldparser=oldparser,
-        )
-    else:
-        result = _peg_parser.parse_string(
-            source,
-            filename=file,
-            oldparser=oldparser,
-            ast=(mode == PARSE),
-        )
+    result = ast.parse(source, filename=file)
     t1 = time.time()
     return result, t1 - t0
 
 
-def is_parsing_failure(source: str) -> bool:
-    try:
-        _peg_parser.parse_string(source, mode="exec", oldparser=True)
-    except SyntaxError:
-        return False
-    return True
-
-
 def generate_time_stats(files, total_seconds) -> None:
     total_files = len(files)
     total_bytes = 0
@@ -159,27 +102,11 @@
         )
 
 
-def parse_directory(
-    directory: str,
-    verbose: bool,
-    excluded_files: List[str],
-    tree_arg: int,
-    short: bool,
-    mode: int,
-    oldparser: bool,
-) -> int:
-    if tree_arg:
-        assert mode == PARSE, "Mode should be 1 (parse), when comparing the generated trees"
-
-    if oldparser and tree_arg:
-        print("Cannot specify tree argument with the cpython parser.", file=sys.stderr)
-        return 1
-
+def parse_directory(directory: str, verbose: bool, excluded_files: List[str], short: bool) -> int:
     # For a given directory, traverse files and attempt to parse each one
     # - Output success/failure for each file
     errors = 0
     files = []
-    trees = {}  # Trees to compare (after everything else is done)
     total_seconds = 0
 
     for file in sorted(glob(os.path.join(escape(directory), f"**/*.py"), recursive=True)):
@@ -191,39 +118,20 @@
             source = f.read()
 
         try:
-            result, dt = parse_file(source, file, mode, oldparser)
+            result, dt = parse_file(source, file)
             total_seconds += dt
-            if tree_arg:
-                trees[file] = result
             report_status(succeeded=True, file=file, verbose=verbose, short=short)
         except SyntaxError as error:
-            if is_parsing_failure(source):
-                print(f"File {file} cannot be parsed by either parser.")
-            else:
-                report_status(
-                    succeeded=False, file=file, verbose=verbose, error=error, short=short
-                )
-                errors += 1
+            report_status(succeeded=False, file=file, verbose=verbose, error=error, short=short)
+            errors += 1
         files.append(file)
 
-    t1 = time.time()
-
     generate_time_stats(files, total_seconds)
     if short:
         print_memstats()
 
     if errors:
         print(f"Encountered {errors} failures.", file=sys.stderr)
-
-    # Compare trees (the dict is empty unless -t is given)
-    compare_trees_errors = 0
-    for file, tree in trees.items():
-        if not short:
-            print("Comparing ASTs for", file)
-        if compare_trees(tree, file, verbose, tree_arg >= 2) == 1:
-            compare_trees_errors += 1
-
-    if errors or compare_trees_errors:
         return 1
 
     return 0
@@ -234,20 +142,8 @@
     directory = args.directory
     verbose = args.verbose
     excluded_files = args.exclude
-    tree = args.tree
     short = args.short
-    mode = 1 if args.tree else 2
-    sys.exit(
-        parse_directory(
-            directory,
-            verbose,
-            excluded_files,
-            tree,
-            short,
-            mode,
-            oldparser=False,
-        )
-    )
+    sys.exit(parse_directory(directory, verbose, excluded_files, short))
 
 
 if __name__ == "__main__":
diff --git a/Tools/pynche/ColorDB.py b/Tools/pynche/ColorDB.py
index eb76d40..c013a60 100644
--- a/Tools/pynche/ColorDB.py
+++ b/Tools/pynche/ColorDB.py
@@ -9,7 +9,7 @@
 trouble reading the file, None is returned.  You can pass get_colordb() an
 optional filetype argument.
 
-Supporte file types are:
+Supported file types are:
 
     X_RGB_TXT -- X Consortium rgb.txt format files.  Three columns of numbers
                  from 0 .. 255 separated by whitespace.  Arbitrary trailing
diff --git a/Tools/pynche/PyncheWidget.py b/Tools/pynche/PyncheWidget.py
index ef12198..ea456e5 100644
--- a/Tools/pynche/PyncheWidget.py
+++ b/Tools/pynche/PyncheWidget.py
@@ -36,15 +36,11 @@
         else:
             # Is there already a default root for Tk, say because we're
             # running under Guido's IDE? :-) Two conditions say no, either the
-            # import fails or _default_root is None.
-            tkroot = None
-            try:
-                from Tkinter import _default_root
-                tkroot = self.__tkroot = _default_root
-            except ImportError:
-                pass
+            # _default_root is None or it is unset.
+            tkroot = getattr(tkinter, '_default_root', None)
             if not tkroot:
-                tkroot = self.__tkroot = Tk(className='Pynche')
+                tkroot = Tk(className='Pynche')
+            self.__tkroot = tkroot
             # but this isn't our top level widget, so make it invisible
             tkroot.withdraw()
         # create the menubar
diff --git a/Tools/pynche/README b/Tools/pynche/README
index e026159..ae8183f 100644
--- a/Tools/pynche/README
+++ b/Tools/pynche/README
@@ -27,7 +27,7 @@
     Pynche must find a text database of colors names in order to
     provide `nearest' color matching.  Pynche is distributed with an
     rgb.txt file from the X11R6.4 distribution for this reason, along
-    with other "Web related" database (see below).  You can use a
+    with other "web related" database (see below).  You can use a
     different file with the -d option.  The file xlicense.txt contains
     the license only for rgb.txt and both files are in the X/
     subdirectory.
@@ -356,7 +356,7 @@
 
     html40colors.txt -- the HTML 4.0 guaranteed color names
 
-    websafe.txt -- the 216 "Web-safe" colors that Netscape and MSIE
+    websafe.txt -- the 216 "web-safe" colors that Netscape and MSIE
     guarantee will not be dithered.  These are specified in #rrggbb
     format for both values and names
 
diff --git a/Tools/scripts/README b/Tools/scripts/README
index 7fc51a1..ba0f662 100644
--- a/Tools/scripts/README
+++ b/Tools/scripts/README
@@ -58,6 +58,7 @@
 rgrep.py                  Reverse grep through a file (useful for big logfiles)
 run_tests.py              Run the test suite with more sensible default options
 serve.py                  Small wsgiref-based web server, used in make serve in Doc
+stable_abi.py             Stable ABI checks and file generators.
 suff.py                   Sort a list of files by suffix
 texi2html.py              Convert GNU texinfo files into HTML
 untabify.py               Replace tabs with spaces in argument files
diff --git a/Tools/scripts/combinerefs.py b/Tools/scripts/combinerefs.py
index 49ccca7..848bae5 100755
--- a/Tools/scripts/combinerefs.py
+++ b/Tools/scripts/combinerefs.py
@@ -33,7 +33,7 @@
 
 if the refcount changed.
 
-typename is object->ob_type->tp_name, extracted from the second PYTHONDUMPREFS
+typename is Py_TYPE(object)->tp_name, extracted from the second PYTHONDUMPREFS
 output block.
 
 repr is repr(object), extracted from the first PYTHONDUMPREFS output block.
diff --git a/Tools/scripts/dutree.doc b/Tools/scripts/dutree.doc
index 97bd2e2..490126b 100644
--- a/Tools/scripts/dutree.doc
+++ b/Tools/scripts/dutree.doc
@@ -15,7 +15,7 @@
 :And Perl is definitely awkward with data types.  I haven't yet found a
 :pleasant way of shoving non-trivial data types into Perl's grammar.
 
-Yes, it's pretty aweful at that, alright.  Sometimes I write perl programs
+Yes, it's pretty awful at that, alright.  Sometimes I write perl programs
 that need them, and sometimes it just takes a little creativity.  But
 sometimes it's not worth it.  I actually wrote a C program the other day
 (gasp) because I didn't want to deal with a game matrix with six links per node.
diff --git a/Tools/scripts/generate_opcode_h.py b/Tools/scripts/generate_opcode_h.py
index 873f821..cba13b2 100644
--- a/Tools/scripts/generate_opcode_h.py
+++ b/Tools/scripts/generate_opcode_h.py
@@ -30,6 +30,18 @@
 #endif /* !Py_OPCODE_H */
 """
 
+UINT32_MASK = (1<<32)-1
+
+def write_int_array_from_ops(name, ops, out):
+    bits = 0
+    for op in ops:
+        bits |= 1<<op
+    out.write(f"static uint32_t {name}[8] = {{\n")
+    for i in range(8):
+        out.write(f"    {bits & UINT32_MASK}U,\n")
+        bits >>= 32
+    assert bits == 0
+    out.write(f"}};\n")
 
 def main(opcode_py, outfile='Include/opcode.h'):
     opcode = {}
@@ -41,6 +53,8 @@
         code = fp.read()
     exec(code, opcode)
     opmap = opcode['opmap']
+    hasjrel = opcode['hasjrel']
+    hasjabs = opcode['hasjabs']
     with open(outfile, 'w') as fobj:
         fobj.write(header)
         for name in opcode['opname']:
@@ -49,8 +63,13 @@
             if name == 'POP_EXCEPT': # Special entry for HAVE_ARGUMENT
                 fobj.write("#define %-23s %3d\n" %
                             ('HAVE_ARGUMENT', opcode['HAVE_ARGUMENT']))
+        fobj.write("#ifdef NEED_OPCODE_JUMP_TABLES\n")
+        write_int_array_from_ops("_PyOpcode_RelativeJump", opcode['hasjrel'], fobj)
+        write_int_array_from_ops("_PyOpcode_Jump", opcode['hasjrel'] + opcode['hasjabs'], fobj)
+        fobj.write("#endif /* OPCODE_TABLES */\n")
         fobj.write(footer)
 
+
     print("%s regenerated from %s" % (outfile, opcode_py))
 
 
diff --git a/Tools/scripts/generate_stdlib_module_names.py b/Tools/scripts/generate_stdlib_module_names.py
new file mode 100644
index 0000000..dc6a074
--- /dev/null
+++ b/Tools/scripts/generate_stdlib_module_names.py
@@ -0,0 +1,174 @@
+# This script lists the names of standard library modules
+# to update Python/stdlib_mod_names.h
+import os.path
+import re
+import subprocess
+import sys
+import sysconfig
+
+
+SRC_DIR = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
+STDLIB_PATH = os.path.join(SRC_DIR, 'Lib')
+MODULES_SETUP = os.path.join(SRC_DIR, 'Modules', 'Setup')
+SETUP_PY = os.path.join(SRC_DIR, 'setup.py')
+TEST_EMBED = os.path.join(SRC_DIR, 'Programs', '_testembed')
+
+IGNORE = {
+    '__init__',
+    '__pycache__',
+    'site-packages',
+
+    # Test modules and packages
+    '__hello__',
+    '__phello__',
+    '_ctypes_test',
+    '_testbuffer',
+    '_testcapi',
+    '_testconsole',
+    '_testimportmultiple',
+    '_testinternalcapi',
+    '_testmultiphase',
+    '_xxsubinterpreters',
+    '_xxtestfuzz',
+    'distutils.tests',
+    'idlelib.idle_test',
+    'lib2to3.tests',
+    'test',
+    'xxlimited',
+    'xxlimited_35',
+    'xxsubtype',
+}
+
+# Windows extension modules
+WINDOWS_MODULES = (
+    '_msi',
+    '_overlapped',
+    '_testconsole',
+    '_winapi',
+    'msvcrt',
+    'nt',
+    'winreg',
+    'winsound'
+)
+
+# macOS extension modules
+MACOS_MODULES = (
+    '_scproxy',
+)
+
+# Pure Python modules (Lib/*.py)
+def list_python_modules(names):
+    for filename in os.listdir(STDLIB_PATH):
+        if not filename.endswith(".py"):
+            continue
+        name = filename.removesuffix(".py")
+        names.add(name)
+
+
+# Packages in Lib/
+def list_packages(names):
+    for name in os.listdir(STDLIB_PATH):
+        if name in IGNORE:
+            continue
+        package_path = os.path.join(STDLIB_PATH, name)
+        if not os.path.isdir(package_path):
+            continue
+        if any(package_file.endswith(".py")
+               for package_file in os.listdir(package_path)):
+            names.add(name)
+
+
+# Extension modules built by setup.py
+def list_setup_extensions(names):
+    cmd = [sys.executable, SETUP_PY, "-q", "build", "--list-module-names"]
+    output = subprocess.check_output(cmd)
+    output = output.decode("utf8")
+    extensions = output.splitlines()
+    names |= set(extensions)
+
+
+# Built-in and extension modules built by Modules/Setup
+def list_modules_setup_extensions(names):
+    assign_var = re.compile("^[A-Z]+=")
+
+    with open(MODULES_SETUP, encoding="utf-8") as modules_fp:
+        for line in modules_fp:
+            # Strip comment
+            line = line.partition("#")[0]
+            line = line.rstrip()
+            if not line:
+                continue
+            if assign_var.match(line):
+                # Ignore "VAR=VALUE"
+                continue
+            if line in ("*disabled*", "*shared*"):
+                continue
+            parts = line.split()
+            if len(parts) < 2:
+                continue
+            # "errno errnomodule.c" => write "errno"
+            name = parts[0]
+            names.add(name)
+
+
+# List frozen modules of the PyImport_FrozenModules list (Python/frozen.c).
+# Use the "./Programs/_testembed list_frozen" command.
+def list_frozen(names):
+    args = [TEST_EMBED, 'list_frozen']
+    proc = subprocess.run(args, stdout=subprocess.PIPE, text=True)
+    exitcode = proc.returncode
+    if exitcode:
+        cmd = ' '.join(args)
+        print(f"{cmd} failed with exitcode {exitcode}")
+        sys.exit(exitcode)
+    for line in proc.stdout.splitlines():
+        name = line.strip()
+        names.add(name)
+
+
+def list_modules():
+    names = set(sys.builtin_module_names) | set(WINDOWS_MODULES) | set(MACOS_MODULES)
+    list_modules_setup_extensions(names)
+    list_setup_extensions(names)
+    list_packages(names)
+    list_python_modules(names)
+    list_frozen(names)
+
+    # Remove ignored packages and modules
+    for name in list(names):
+        package_name = name.split('.')[0]
+        # package_name can be equal to name
+        if package_name in IGNORE:
+            names.discard(name)
+
+    for name in names:
+        if "." in name:
+            raise Exception("sub-modules must not be listed")
+
+    return names
+
+
+def write_modules(fp, names):
+    print("// Auto-generated by Tools/scripts/generate_stdlib_module_names.py.",
+          file=fp)
+    print("// List used to create sys.stdlib_module_names.", file=fp)
+    print(file=fp)
+    print("static const char* _Py_stdlib_module_names[] = {", file=fp)
+    for name in sorted(names):
+        print(f'"{name}",', file=fp)
+    print("};", file=fp)
+
+
+def main():
+    if not sysconfig.is_python_build():
+        print(f"ERROR: {sys.executable} is not a Python build",
+              file=sys.stderr)
+        sys.exit(1)
+
+    fp = sys.stdout
+    names = list_modules()
+    write_modules(fp, names)
+
+
+if __name__ == "__main__":
+    main()
diff --git a/Tools/scripts/generate_symbol_py.py b/Tools/scripts/generate_symbol_py.py
deleted file mode 100755
index 9219b09..0000000
--- a/Tools/scripts/generate_symbol_py.py
+++ /dev/null
@@ -1,53 +0,0 @@
-#! /usr/bin/env python3
-# This script generates the symbol.py source file.
-
-import sys
-import re
-
-def main(inFileName="Include/graminit.h", outFileName="Lib/symbol.py"):
-    try:
-        fp = open(inFileName)
-    except OSError as err:
-        sys.stderr.write("I/O error: %s\n" % str(err))
-        sys.exit(1)
-    with fp:
-        lines = fp.read().split("\n")
-    prog = re.compile(
-        "#define[ \t][ \t]*([A-Z0-9][A-Z0-9_]*)[ \t][ \t]*([0-9][0-9]*)",
-        re.IGNORECASE)
-    tokens = {}
-    for line in lines:
-        match = prog.match(line)
-        if match:
-            name, val = match.group(1, 2)
-            val = int(val)
-            tokens[val] = name          # reverse so we can sort them...
-    keys = sorted(tokens.keys())
-    # load the output skeleton from the target:
-    try:
-        fp = open(outFileName)
-    except OSError as err:
-        sys.stderr.write("I/O error: %s\n" % str(err))
-        sys.exit(2)
-    with fp:
-        format = fp.read().split("\n")
-    try:
-        start = format.index("#--start constants--") + 1
-        end = format.index("#--end constants--")
-    except ValueError:
-        sys.stderr.write("target does not contain format markers")
-        sys.exit(3)
-    lines = []
-    for val in keys:
-        lines.append("%s = %d" % (tokens[val], val))
-    format[start:end] = lines
-    try:
-        fp = open(outFileName, 'w')
-    except OSError as err:
-        sys.stderr.write("I/O error: %s\n" % str(err))
-        sys.exit(4)
-    with fp:
-        fp.write("\n".join(format))
-
-if __name__ == '__main__':
-    main(*sys.argv[1:])
diff --git a/Tools/scripts/patchcheck.py b/Tools/scripts/patchcheck.py
index 8a8480a..8e59c78 100755
--- a/Tools/scripts/patchcheck.py
+++ b/Tools/scripts/patchcheck.py
@@ -50,7 +50,8 @@
     try:
         return subprocess.check_output(cmd,
                                        stderr=subprocess.DEVNULL,
-                                       cwd=SRCDIR)
+                                       cwd=SRCDIR,
+                                       encoding='UTF-8')
     except subprocess.CalledProcessError:
         return None
 
@@ -64,28 +65,52 @@
     try:
         subprocess.check_output(cmd,
                                 stderr=subprocess.DEVNULL,
-                                cwd=SRCDIR)
+                                cwd=SRCDIR,
+                                encoding='UTF-8')
     except subprocess.CalledProcessError:
         return "origin"
     return "upstream"
 
 
+def get_git_remote_default_branch(remote_name):
+    """Get the name of the default branch for the given remote
+
+    It is typically called 'main', but may differ
+    """
+    cmd = "git remote show {}".format(remote_name).split()
+    env = os.environ.copy()
+    env['LANG'] = 'C'
+    try:
+        remote_info = subprocess.check_output(cmd,
+                                              stderr=subprocess.DEVNULL,
+                                              cwd=SRCDIR,
+                                              encoding='UTF-8',
+                                              env=env)
+    except subprocess.CalledProcessError:
+        return None
+    for line in remote_info.splitlines():
+        if "HEAD branch:" in line:
+            base_branch = line.split(":")[1].strip()
+            return base_branch
+    return None
+
+
 @status("Getting base branch for PR",
         info=lambda x: x if x is not None else "not a PR branch")
 def get_base_branch():
     if not os.path.exists(os.path.join(SRCDIR, '.git')):
         # Not a git checkout, so there's no base branch
         return None
+    upstream_remote = get_git_upstream_remote()
     version = sys.version_info
     if version.releaselevel == 'alpha':
-        base_branch = "master"
+        base_branch = get_git_remote_default_branch(upstream_remote)
     else:
         base_branch = "{0.major}.{0.minor}".format(version)
     this_branch = get_git_branch()
     if this_branch is None or this_branch == base_branch:
         # Not on a git PR branch, so there's no base branch
         return None
-    upstream_remote = get_git_upstream_remote()
     return upstream_remote + "/" + base_branch
 
 
diff --git a/Tools/scripts/pdeps.py b/Tools/scripts/pdeps.py
index 4e8e930..ab0040f 100755
--- a/Tools/scripts/pdeps.py
+++ b/Tools/scripts/pdeps.py
@@ -64,7 +64,7 @@
 # Collect data from one file
 #
 def process(filename, table):
-    with open(filename) as fp:
+    with open(filename, encoding='utf-8') as fp:
         mod = os.path.basename(filename)
         if mod[-3:] == '.py':
             mod = mod[:-3]
diff --git a/Tools/scripts/pep384_macrocheck.py b/Tools/scripts/pep384_macrocheck.py
index 142d248..ab9dd7c 100644
--- a/Tools/scripts/pep384_macrocheck.py
+++ b/Tools/scripts/pep384_macrocheck.py
@@ -1,9 +1,9 @@
 """
 pep384_macrocheck.py
 
-This programm tries to locate errors in the relevant Python header
+This program tries to locate errors in the relevant Python header
 files where macros access type fields when they are reachable from
-the limided API.
+the limited API.
 
 The idea is to search macros with the string "->tp_" in it.
 When the macro name does not begin with an underscore,
diff --git a/Tools/scripts/run_tests.py b/Tools/scripts/run_tests.py
index bcfa5e9..48feb3f 100644
--- a/Tools/scripts/run_tests.py
+++ b/Tools/scripts/run_tests.py
@@ -25,9 +25,8 @@
             '-u',                 # Unbuffered stdout and stderr
             '-W', 'default',      # Warnings set to 'default'
             '-bb',                # Warnings about bytes/bytearray
+            '-E',                 # Ignore environment variables
             ]
-    if 'PYTHONOLDPARSER' not in os.environ:
-        args.append('-E')         # Ignore environment variables
 
     # Allow user-specified interpreter options to override our defaults.
     args.extend(test.support.args_from_interpreter_flags())
diff --git a/Tools/scripts/smelly.py b/Tools/scripts/smelly.py
index 43d0916..276a5ab 100755
--- a/Tools/scripts/smelly.py
+++ b/Tools/scripts/smelly.py
@@ -1,17 +1,47 @@
 #!/usr/bin/env python
 # Script checking that all symbols exported by libpython start with Py or _Py
 
+import os.path
 import subprocess
 import sys
 import sysconfig
 
 
-def get_exported_symbols():
-    LIBRARY = sysconfig.get_config_var('LIBRARY')
-    if not LIBRARY:
-        raise Exception("failed to get LIBRARY")
+ALLOWED_PREFIXES = ('Py', '_Py')
+if sys.platform == 'darwin':
+    ALLOWED_PREFIXES += ('__Py',)
 
-    args = ('nm', '-p', LIBRARY)
+IGNORED_EXTENSION = "_ctypes_test"
+# Ignore constructor and destructor functions
+IGNORED_SYMBOLS = {'_init', '_fini'}
+
+
+def is_local_symbol_type(symtype):
+    # Ignore local symbols.
+
+    # If lowercase, the symbol is usually local; if uppercase, the symbol
+    # is global (external).  There are however a few lowercase symbols that
+    # are shown for special global symbols ("u", "v" and "w").
+    if symtype.islower() and symtype not in "uvw":
+        return True
+
+    # Ignore the initialized data section (d and D) and the BSS data
+    # section. For example, ignore "__bss_start (type: B)"
+    # and "_edata (type: D)".
+    if symtype in "bBdD":
+        return True
+
+    return False
+
+
+def get_exported_symbols(library, dynamic=False):
+    print(f"Check that {library} only exports symbols starting with Py or _Py")
+
+    # Only look at dynamic symbols
+    args = ['nm', '--no-sort']
+    if dynamic:
+        args.append('--dynamic')
+    args.append(library)
     print("+ %s" % ' '.join(args))
     proc = subprocess.run(args, stdout=subprocess.PIPE, universal_newlines=True)
     if proc.returncode:
@@ -25,12 +55,9 @@
 
 
 def get_smelly_symbols(stdout):
-    symbols = []
-    ignored_symtypes = set()
-
-    allowed_prefixes = ('Py', '_Py')
-    if sys.platform == 'darwin':
-        allowed_prefixes += ('__Py',)
+    smelly_symbols = []
+    python_symbols = []
+    local_symbols = []
 
     for line in stdout.splitlines():
         # Split line '0000000000001b80 D PyTextIOWrapper_Type'
@@ -42,41 +69,104 @@
             continue
 
         symtype = parts[1].strip()
-        # Ignore private symbols.
-        #
-        # If lowercase, the symbol is usually local; if uppercase, the symbol
-        # is global (external).  There are however a few lowercase symbols that
-        # are shown for special global symbols ("u", "v" and "w").
-        if symtype.islower() and symtype not in "uvw":
-            ignored_symtypes.add(symtype)
-            continue
-
         symbol = parts[-1]
-        if symbol.startswith(allowed_prefixes):
-            continue
-        symbol = '%s (type: %s)' % (symbol, symtype)
-        symbols.append(symbol)
+        result = '%s (type: %s)' % (symbol, symtype)
 
-    if ignored_symtypes:
-        print("Ignored symbol types: %s" % ', '.join(sorted(ignored_symtypes)))
+        if symbol.startswith(ALLOWED_PREFIXES):
+            python_symbols.append(result)
+            continue
+
+        if is_local_symbol_type(symtype):
+            local_symbols.append(result)
+        elif symbol in IGNORED_SYMBOLS:
+            local_symbols.append(result)
+        else:
+            smelly_symbols.append(result)
+
+    if local_symbols:
+        print(f"Ignore {len(local_symbols)} local symbols")
+    return smelly_symbols, python_symbols
+
+
+def check_library(library, dynamic=False):
+    nm_output = get_exported_symbols(library, dynamic)
+    smelly_symbols, python_symbols = get_smelly_symbols(nm_output)
+
+    if not smelly_symbols:
+        print(f"OK: no smelly symbol found ({len(python_symbols)} Python symbols)")
+        return 0
+
+    print()
+    smelly_symbols.sort()
+    for symbol in smelly_symbols:
+        print("Smelly symbol: %s" % symbol)
+
+    print()
+    print("ERROR: Found %s smelly symbols!" % len(smelly_symbols))
+    return len(smelly_symbols)
+
+
+def check_extensions():
+    print(__file__)
+    # This assumes pybuilddir.txt is in same directory as pyconfig.h.
+    # In the case of out-of-tree builds, we can't assume pybuilddir.txt is
+    # in the source folder.
+    config_dir = os.path.dirname(sysconfig.get_config_h_filename())
+    filename = os.path.join(config_dir, "pybuilddir.txt")
+    try:
+        with open(filename, encoding="utf-8") as fp:
+            pybuilddir = fp.readline()
+    except FileNotFoundError:
+        print(f"Cannot check extensions because {filename} does not exist")
+        return True
+
+    print(f"Check extension modules from {pybuilddir} directory")
+    builddir = os.path.join(config_dir, pybuilddir)
+    nsymbol = 0
+    for name in os.listdir(builddir):
+        if not name.endswith(".so"):
+            continue
+        if IGNORED_EXTENSION in name:
+            print()
+            print(f"Ignore extension: {name}")
+            continue
+
         print()
-    return symbols
+        filename = os.path.join(builddir, name)
+        nsymbol += check_library(filename, dynamic=True)
+
+    return nsymbol
 
 
 def main():
-    nm_output = get_exported_symbols()
-    symbols = get_smelly_symbols(nm_output)
+    nsymbol = 0
 
-    if not symbols:
-        print("OK: no smelly symbol found")
-        sys.exit(0)
+    # static library
+    LIBRARY = sysconfig.get_config_var('LIBRARY')
+    if not LIBRARY:
+        raise Exception("failed to get LIBRARY variable from sysconfig")
+    if os.path.exists(LIBRARY):
+        nsymbol += check_library(LIBRARY)
 
-    symbols.sort()
-    for symbol in symbols:
-        print("Smelly symbol: %s" % symbol)
+    # dynamic library
+    LDLIBRARY = sysconfig.get_config_var('LDLIBRARY')
+    if not LDLIBRARY:
+        raise Exception("failed to get LDLIBRARY variable from sysconfig")
+    if LDLIBRARY != LIBRARY:
+        print()
+        nsymbol += check_library(LDLIBRARY, dynamic=True)
+
+    # Check extension modules like _ssl.cpython-310d-x86_64-linux-gnu.so
+    nsymbol += check_extensions()
+
+    if nsymbol:
+        print()
+        print(f"ERROR: Found {nsymbol} smelly symbols in total!")
+        sys.exit(1)
+
     print()
-    print("ERROR: Found %s smelly symbols!" % len(symbols))
-    sys.exit(1)
+    print(f"OK: all exported symbols of all libraries "
+          f"are prefixed with {' or '.join(map(repr, ALLOWED_PREFIXES))}")
 
 
 if __name__ == "__main__":
diff --git a/Tools/scripts/stable_abi.py b/Tools/scripts/stable_abi.py
new file mode 100755
index 0000000..6d70340
--- /dev/null
+++ b/Tools/scripts/stable_abi.py
@@ -0,0 +1,626 @@
+"""Check the stable ABI manifest or generate files from it
+
+By default, the tool only checks existing files/libraries.
+Pass --generate to recreate auto-generated files instead.
+
+For actions that take a FILENAME, the filename can be left out to use a default
+(relative to the manifest file, as they appear in the CPython codebase).
+"""
+
+from functools import partial
+from pathlib import Path
+import dataclasses
+import subprocess
+import sysconfig
+import argparse
+import textwrap
+import difflib
+import shutil
+import sys
+import os
+import os.path
+import io
+import re
+import csv
+
+MISSING = object()
+
+EXCLUDED_HEADERS = {
+    "bytes_methods.h",
+    "cellobject.h",
+    "classobject.h",
+    "code.h",
+    "compile.h",
+    "datetime.h",
+    "dtoa.h",
+    "frameobject.h",
+    "funcobject.h",
+    "genobject.h",
+    "longintrepr.h",
+    "parsetok.h",
+    "pyatomic.h",
+    "pytime.h",
+    "token.h",
+    "ucnhash.h",
+}
+MACOS = (sys.platform == "darwin")
+UNIXY = MACOS or (sys.platform == "linux")  # XXX should this be "not Windows"?
+
+IFDEF_DOC_NOTES = {
+    'MS_WINDOWS': 'on Windows',
+    'HAVE_FORK': 'on platforms with fork()',
+    'USE_STACKCHECK': 'on platforms with USE_STACKCHECK',
+}
+
+# The stable ABI manifest (Misc/stable_abi.txt) exists only to fill the
+# following dataclasses.
+# Feel free to change its syntax (and the `parse_manifest` function)
+# to better serve that purpose (while keeping it human-readable).
+
+@dataclasses.dataclass
+class Manifest:
+    """Collection of `ABIItem`s forming the stable ABI/limited API."""
+
+    kind = 'manifest'
+    contents: dict = dataclasses.field(default_factory=dict)
+
+    def add(self, item):
+        if item.name in self.contents:
+            # We assume that stable ABI items do not share names,
+            # even if they're different kinds (e.g. function vs. macro).
+            raise ValueError(f'duplicate ABI item {item.name}')
+        self.contents[item.name] = item
+
+    @property
+    def feature_defines(self):
+        """Return all feature defines which affect what's available
+
+        These are e.g. HAVE_FORK and MS_WINDOWS.
+        """
+        return set(item.ifdef for item in self.contents.values()) - {None}
+
+    def select(self, kinds, *, include_abi_only=True, ifdef=None):
+        """Yield selected items of the manifest
+
+        kinds: set of requested kinds, e.g. {'function', 'macro'}
+        include_abi_only: if True (default), include all items of the
+            stable ABI.
+            If False, include only items from the limited API
+            (i.e. items people should use today)
+        ifdef: set of feature defines (e.g. {'HAVE_FORK', 'MS_WINDOWS'}).
+            If None (default), items are not filtered by this. (This is
+            different from the empty set, which filters out all such
+            conditional items.)
+        """
+        for name, item in sorted(self.contents.items()):
+            if item.kind not in kinds:
+                continue
+            if item.abi_only and not include_abi_only:
+                continue
+            if (ifdef is not None
+                    and item.ifdef is not None
+                    and item.ifdef not in ifdef):
+                continue
+            yield item
+
+    def dump(self):
+        """Yield lines to recreate the manifest file (sans comments/newlines)"""
+        # Recursive in preparation for struct member & function argument nodes
+        for item in self.contents.values():
+            yield from item.dump(indent=0)
+
+@dataclasses.dataclass
+class ABIItem:
+    """Information on one item (function, macro, struct, etc.)"""
+
+    kind: str
+    name: str
+    added: str = None
+    contents: list = dataclasses.field(default_factory=list)
+    abi_only: bool = False
+    ifdef: str = None
+
+    KINDS = frozenset({
+        'struct', 'function', 'macro', 'data', 'const', 'typedef',
+    })
+
+    def dump(self, indent=0):
+        yield f"{'    ' * indent}{self.kind} {self.name}"
+        if self.added:
+            yield f"{'    ' * (indent+1)}added {self.added}"
+        if self.ifdef:
+            yield f"{'    ' * (indent+1)}ifdef {self.ifdef}"
+        if self.abi_only:
+            yield f"{'    ' * (indent+1)}abi_only"
+
+def parse_manifest(file):
+    """Parse the given file (iterable of lines) to a Manifest"""
+
+    LINE_RE = re.compile('(?P<indent>[ ]*)(?P<kind>[^ ]+)[ ]*(?P<content>.*)')
+    manifest = Manifest()
+
+    # parents of currently processed line, each with its indentation level
+    levels = [(manifest, -1)]
+
+    def raise_error(msg):
+        raise SyntaxError(f'line {lineno}: {msg}')
+
+    for lineno, line in enumerate(file, start=1):
+        line, sep, comment = line.partition('#')
+        line = line.rstrip()
+        if not line:
+            continue
+        match = LINE_RE.fullmatch(line)
+        if not match:
+            raise_error(f'invalid syntax: {line}')
+        level = len(match['indent'])
+        kind = match['kind']
+        content = match['content']
+        while level <= levels[-1][1]:
+            levels.pop()
+        parent = levels[-1][0]
+        entry = None
+        if kind in ABIItem.KINDS:
+            if parent.kind not in {'manifest'}:
+                raise_error(f'{kind} cannot go in {parent.kind}')
+            entry = ABIItem(kind, content)
+            parent.add(entry)
+        elif kind in {'added', 'ifdef'}:
+            if parent.kind not in ABIItem.KINDS:
+                raise_error(f'{kind} cannot go in {parent.kind}')
+            setattr(parent, kind, content)
+        elif kind in {'abi_only'}:
+            if parent.kind not in {'function', 'data'}:
+                raise_error(f'{kind} cannot go in {parent.kind}')
+            parent.abi_only = True
+        else:
+            raise_error(f"unknown kind {kind!r}")
+        levels.append((entry, level))
+    return manifest
+
+# The tool can run individual "actions".
+# Most actions are "generators", which generate a single file from the
+# manifest. (Checking works by generating a temp file & comparing.)
+# Other actions, like "--unixy-check", don't work on a single file.
+
+generators = []
+def generator(var_name, default_path):
+    """Decorates a file generator: function that writes to a file"""
+    def _decorator(func):
+        func.var_name = var_name
+        func.arg_name = '--' + var_name.replace('_', '-')
+        func.default_path = default_path
+        generators.append(func)
+        return func
+    return _decorator
+
+
+@generator("python3dll", 'PC/python3dll.c')
+def gen_python3dll(manifest, args, outfile):
+    """Generate/check the source for the Windows stable ABI library"""
+    write = partial(print, file=outfile)
+    write(textwrap.dedent(r"""
+        /* Re-export stable Python ABI */
+
+        /* Generated by Tools/scripts/stable_abi.py */
+
+        #ifdef _M_IX86
+        #define DECORATE "_"
+        #else
+        #define DECORATE
+        #endif
+
+        #define EXPORT_FUNC(name) \
+            __pragma(comment(linker, "/EXPORT:" DECORATE #name "=" PYTHON_DLL_NAME "." #name))
+        #define EXPORT_DATA(name) \
+            __pragma(comment(linker, "/EXPORT:" DECORATE #name "=" PYTHON_DLL_NAME "." #name ",DATA"))
+    """))
+
+    def sort_key(item):
+        return item.name.lower()
+
+    for item in sorted(
+            manifest.select(
+                {'function'}, include_abi_only=True, ifdef={'MS_WINDOWS'}),
+            key=sort_key):
+        write(f'EXPORT_FUNC({item.name})')
+
+    write()
+
+    for item in sorted(
+            manifest.select(
+                {'data'}, include_abi_only=True, ifdef={'MS_WINDOWS'}),
+            key=sort_key):
+        write(f'EXPORT_DATA({item.name})')
+
+REST_ROLES = {
+    'function': 'function',
+    'data': 'var',
+    'struct': 'type',
+    'macro': 'macro',
+    # 'const': 'const',  # all undocumented
+    'typedef': 'type',
+}
+
+@generator("doc_list", 'Doc/data/stable_abi.dat')
+def gen_doc_annotations(manifest, args, outfile):
+    """Generate/check the stable ABI list for documentation annotations"""
+    writer = csv.DictWriter(
+        outfile, ['role', 'name', 'added', 'ifdef_note'], lineterminator='\n')
+    writer.writeheader()
+    for item in manifest.select(REST_ROLES.keys(), include_abi_only=False):
+        if item.ifdef:
+            ifdef_note = IFDEF_DOC_NOTES[item.ifdef]
+        else:
+            ifdef_note = None
+        writer.writerow({
+            'role': REST_ROLES[item.kind],
+            'name': item.name,
+            'added': item.added,
+            'ifdef_note': ifdef_note})
+
+def generate_or_check(manifest, args, path, func):
+    """Generate/check a file with a single generator
+
+    Return True if successful; False if a comparison failed.
+    """
+
+    outfile = io.StringIO()
+    func(manifest, args, outfile)
+    generated = outfile.getvalue()
+    existing = path.read_text()
+
+    if generated != existing:
+        if args.generate:
+            path.write_text(generated)
+        else:
+            print(f'File {path} differs from expected!')
+            diff = difflib.unified_diff(
+                generated.splitlines(), existing.splitlines(),
+                str(path), '<expected>',
+                lineterm='',
+            )
+            for line in diff:
+                print(line)
+            return False
+    return True
+
+
+def do_unixy_check(manifest, args):
+    """Check headers & library using "Unixy" tools (GCC/clang, binutils)"""
+    okay = True
+
+    # Get all macros first: we'll need feature macros like HAVE_FORK and
+    # MS_WINDOWS for everything else
+    present_macros = gcc_get_limited_api_macros(['Include/Python.h'])
+    feature_defines = manifest.feature_defines & present_macros
+
+    # Check that we have all needed macros
+    expected_macros = set(
+        item.name for item in manifest.select({'macro'})
+    )
+    missing_macros = expected_macros - present_macros
+    okay &= _report_unexpected_items(
+        missing_macros,
+        'Some macros from are not defined from "Include/Python.h"'
+        + 'with Py_LIMITED_API:')
+
+    expected_symbols = set(item.name for item in manifest.select(
+        {'function', 'data'}, include_abi_only=True, ifdef=feature_defines,
+    ))
+
+    # Check the static library (*.a)
+    LIBRARY = sysconfig.get_config_var("LIBRARY")
+    if not LIBRARY:
+        raise Exception("failed to get LIBRARY variable from sysconfig")
+    if os.path.exists(LIBRARY):
+        okay &= binutils_check_library(
+            manifest, LIBRARY, expected_symbols, dynamic=False)
+
+    # Check the dynamic library (*.so)
+    LDLIBRARY = sysconfig.get_config_var("LDLIBRARY")
+    if not LDLIBRARY:
+        raise Exception("failed to get LDLIBRARY variable from sysconfig")
+    okay &= binutils_check_library(
+            manifest, LDLIBRARY, expected_symbols, dynamic=False)
+
+    # Check definitions in the header files
+    expected_defs = set(item.name for item in manifest.select(
+        {'function', 'data'}, include_abi_only=False, ifdef=feature_defines,
+    ))
+    found_defs = gcc_get_limited_api_definitions(['Include/Python.h'])
+    missing_defs = expected_defs - found_defs
+    okay &= _report_unexpected_items(
+        missing_defs,
+        'Some expected declarations were not declared in '
+        + '"Include/Python.h" with Py_LIMITED_API:')
+
+    # Some Limited API macros are defined in terms of private symbols.
+    # These are not part of Limited API (even though they're defined with
+    # Py_LIMITED_API). They must be part of the Stable ABI, though.
+    private_symbols = {n for n in expected_symbols if n.startswith('_')}
+    extra_defs = found_defs - expected_defs - private_symbols
+    okay &= _report_unexpected_items(
+        extra_defs,
+        'Some extra declarations were found in "Include/Python.h" '
+        + 'with Py_LIMITED_API:')
+
+    return okay
+
+
+def _report_unexpected_items(items, msg):
+    """If there are any `items`, report them using "msg" and return false"""
+    if items:
+        print(msg, file=sys.stderr)
+        for item in sorted(items):
+            print(' -', item, file=sys.stderr)
+        return False
+    return True
+
+
+def binutils_get_exported_symbols(library, dynamic=False):
+    """Retrieve exported symbols using the nm(1) tool from binutils"""
+    # Only look at dynamic symbols
+    args = ["nm", "--no-sort"]
+    if dynamic:
+        args.append("--dynamic")
+    args.append(library)
+    proc = subprocess.run(args, stdout=subprocess.PIPE, universal_newlines=True)
+    if proc.returncode:
+        sys.stdout.write(proc.stdout)
+        sys.exit(proc.returncode)
+
+    stdout = proc.stdout.rstrip()
+    if not stdout:
+        raise Exception("command output is empty")
+
+    for line in stdout.splitlines():
+        # Split line '0000000000001b80 D PyTextIOWrapper_Type'
+        if not line:
+            continue
+
+        parts = line.split(maxsplit=2)
+        if len(parts) < 3:
+            continue
+
+        symbol = parts[-1]
+        if MACOS and symbol.startswith("_"):
+            yield symbol[1:]
+        else:
+            yield symbol
+
+
+def binutils_check_library(manifest, library, expected_symbols, dynamic):
+    """Check that library exports all expected_symbols"""
+    available_symbols = set(binutils_get_exported_symbols(library, dynamic))
+    missing_symbols = expected_symbols - available_symbols
+    if missing_symbols:
+        print(textwrap.dedent(f"""\
+            Some symbols from the limited API are missing from {library}:
+                {', '.join(missing_symbols)}
+
+            This error means that there are some missing symbols among the
+            ones exported in the library.
+            This normally means that some symbol, function implementation or
+            a prototype belonging to a symbol in the limited API has been
+            deleted or is missing.
+        """), file=sys.stderr)
+        return False
+    return True
+
+
+def gcc_get_limited_api_macros(headers):
+    """Get all limited API macros from headers.
+
+    Runs the preprocessor over all the header files in "Include" setting
+    "-DPy_LIMITED_API" to the correct value for the running version of the
+    interpreter and extracting all macro definitions (via adding -dM to the
+    compiler arguments).
+
+    Requires Python built with a GCC-compatible compiler. (clang might work)
+    """
+
+    api_hexversion = sys.version_info.major << 24 | sys.version_info.minor << 16
+
+    preprocesor_output_with_macros = subprocess.check_output(
+        sysconfig.get_config_var("CC").split()
+        + [
+            # Prevent the expansion of the exported macros so we can
+            # capture them later
+            "-DSIZEOF_WCHAR_T=4",  # The actual value is not important
+            f"-DPy_LIMITED_API={api_hexversion}",
+            "-I.",
+            "-I./Include",
+            "-dM",
+            "-E",
+        ]
+        + [str(file) for file in headers],
+        text=True,
+    )
+
+    return {
+        target
+        for target in re.findall(
+            r"#define (\w+)", preprocesor_output_with_macros
+        )
+    }
+
+
+def gcc_get_limited_api_definitions(headers):
+    """Get all limited API definitions from headers.
+
+    Run the preprocessor over all the header files in "Include" setting
+    "-DPy_LIMITED_API" to the correct value for the running version of the
+    interpreter.
+
+    The limited API symbols will be extracted from the output of this command
+    as it includes the prototypes and definitions of all the exported symbols
+    that are in the limited api.
+
+    This function does *NOT* extract the macros defined on the limited API
+
+    Requires Python built with a GCC-compatible compiler. (clang might work)
+    """
+    api_hexversion = sys.version_info.major << 24 | sys.version_info.minor << 16
+    preprocesor_output = subprocess.check_output(
+        sysconfig.get_config_var("CC").split()
+        + [
+            # Prevent the expansion of the exported macros so we can capture
+            # them later
+            "-DPyAPI_FUNC=__PyAPI_FUNC",
+            "-DPyAPI_DATA=__PyAPI_DATA",
+            "-DEXPORT_DATA=__EXPORT_DATA",
+            "-D_Py_NO_RETURN=",
+            "-DSIZEOF_WCHAR_T=4",  # The actual value is not important
+            f"-DPy_LIMITED_API={api_hexversion}",
+            "-I.",
+            "-I./Include",
+            "-E",
+        ]
+        + [str(file) for file in headers],
+        text=True,
+        stderr=subprocess.DEVNULL,
+    )
+    stable_functions = set(
+        re.findall(r"__PyAPI_FUNC\(.*?\)\s*(.*?)\s*\(", preprocesor_output)
+    )
+    stable_exported_data = set(
+        re.findall(r"__EXPORT_DATA\((.*?)\)", preprocesor_output)
+    )
+    stable_data = set(
+        re.findall(r"__PyAPI_DATA\(.*?\)[\s\*\(]*([^);]*)\)?.*;", preprocesor_output)
+    )
+    return stable_data | stable_exported_data | stable_functions
+
+def check_private_names(manifest):
+    """Ensure limited API doesn't contain private names
+
+    Names prefixed by an underscore are private by definition.
+    """
+    for name, item in manifest.contents.items():
+        if name.startswith('_') and not item.abi_only:
+            raise ValueError(
+                f'`{name}` is private (underscore-prefixed) and should be '
+                + 'removed from the stable ABI list or or marked `abi_only`')
+
+def main():
+    parser = argparse.ArgumentParser(
+        description=__doc__,
+        formatter_class=argparse.RawDescriptionHelpFormatter,
+    )
+    parser.add_argument(
+        "file", type=Path, metavar='FILE',
+        help="file with the stable abi manifest",
+    )
+    parser.add_argument(
+        "--generate", action='store_true',
+        help="generate file(s), rather than just checking them",
+    )
+    parser.add_argument(
+        "--generate-all", action='store_true',
+        help="as --generate, but generate all file(s) using default filenames."
+            + " (unlike --all, does not run any extra checks)",
+    )
+    parser.add_argument(
+        "-a", "--all", action='store_true',
+        help="run all available checks using default filenames",
+    )
+    parser.add_argument(
+        "-l", "--list", action='store_true',
+        help="list available generators and their default filenames; then exit",
+    )
+    parser.add_argument(
+        "--dump", action='store_true',
+        help="dump the manifest contents (used for debugging the parser)",
+    )
+
+    actions_group = parser.add_argument_group('actions')
+    for gen in generators:
+        actions_group.add_argument(
+            gen.arg_name, dest=gen.var_name,
+            type=str, nargs="?", default=MISSING,
+            metavar='FILENAME',
+            help=gen.__doc__,
+        )
+    actions_group.add_argument(
+        '--unixy-check', action='store_true',
+        help=do_unixy_check.__doc__,
+    )
+    args = parser.parse_args()
+
+    base_path = args.file.parent.parent
+
+    if args.list:
+        for gen in generators:
+            print(f'{gen.arg_name}: {base_path / gen.default_path}')
+        sys.exit(0)
+
+    run_all_generators = args.generate_all
+
+    if args.generate_all:
+        args.generate = True
+
+    if args.all:
+        run_all_generators = True
+        args.unixy_check = True
+
+    with args.file.open() as file:
+        manifest = parse_manifest(file)
+
+    check_private_names(manifest)
+
+    # Remember results of all actions (as booleans).
+    # At the end we'll check that at least one action was run,
+    # and also fail if any are false.
+    results = {}
+
+    if args.dump:
+        for line in manifest.dump():
+            print(line)
+        results['dump'] = True
+
+    for gen in generators:
+        filename = getattr(args, gen.var_name)
+        if filename is None or (run_all_generators and filename is MISSING):
+            filename = base_path / gen.default_path
+        elif filename is MISSING:
+            continue
+
+        results[gen.var_name] = generate_or_check(manifest, args, filename, gen)
+
+    if args.unixy_check:
+        results['unixy_check'] = do_unixy_check(manifest, args)
+
+    if not results:
+        if args.generate:
+            parser.error('No file specified. Use --help for usage.')
+        parser.error('No check specified. Use --help for usage.')
+
+    failed_results = [name for name, result in results.items() if not result]
+
+    if failed_results:
+        raise Exception(f"""
+        These checks related to the stable ABI did not succeed:
+            {', '.join(failed_results)}
+
+        If you see diffs in the output, files derived from the stable
+        ABI manifest the were not regenerated.
+        Run `make regen-limited-abi` to fix this.
+
+        Otherwise, see the error(s) above.
+
+        The stable ABI manifest is at: {args.file}
+        Note that there is a process to follow when modifying it.
+
+        You can read more about the limited API and its contracts at:
+
+        https://docs.python.org/3/c-api/stable.html
+
+        And in PEP 384:
+
+        https://www.python.org/dev/peps/pep-0384/
+        """)
+
+
+if __name__ == "__main__":
+    main()
diff --git a/Tools/ssl/make_ssl_data.py b/Tools/ssl/make_ssl_data.py
index 1dc234f..ab1134e 100755
--- a/Tools/ssl/make_ssl_data.py
+++ b/Tools/ssl/make_ssl_data.py
@@ -6,95 +6,129 @@
 
 It takes two arguments:
 - the path to the OpenSSL source tree (e.g. git checkout)
-- the path to the C file to be generated
-  (probably Modules/_ssl_data.h)
+- the path to the header file to be generated Modules/_ssl_data_{version}.h
+- error codes are version specific
 """
 
+import argparse
 import datetime
-import glob
+import operator
 import os
 import re
 import sys
-import _ssl
 
 
-def parse_error_codes(h_file, prefix, libcode):
-    pat = re.compile(r"#\s*define\W+(%s([\w]+))\W+(\d+)\b" % re.escape(prefix))
-    codes = []
-    with open(h_file, "r", encoding="latin1") as f:
+parser = argparse.ArgumentParser(
+    description="Generate ssl_data.h from OpenSSL sources"
+)
+parser.add_argument("srcdir", help="OpenSSL source directory")
+parser.add_argument(
+    "output", nargs="?", type=argparse.FileType("w"), default=sys.stdout
+)
+
+
+def _file_search(fname, pat):
+    with open(fname, encoding="utf-8") as f:
         for line in f:
             match = pat.search(line)
-            if match:
-                code, name, num = match.groups()
-                num = int(num)
-                # e.g. ("SSL_R_BAD_DATA", ("ERR_LIB_SSL", "BAD_DATA", 390))
-                codes.append((code, (libcode, name, num)))
-    assert codes, f"no codes found in {h_file}"
-    return codes
+            if match is not None:
+                yield match
+
+
+def parse_err_h(args):
+    """Parse err codes, e.g. ERR_LIB_X509: 11"""
+    pat = re.compile(r"#\s*define\W+ERR_LIB_(\w+)\s+(\d+)")
+    lib2errnum = {}
+    for match in _file_search(args.err_h, pat):
+        libname, num = match.groups()
+        lib2errnum[libname] = int(num)
+
+    return lib2errnum
+
+
+def parse_openssl_error_text(args):
+    """Parse error reasons, X509_R_AKID_MISMATCH"""
+    # ignore backslash line continuation for now
+    pat = re.compile(r"^((\w+?)_R_(\w+)):(\d+):")
+    for match in _file_search(args.errtxt, pat):
+        reason, libname, errname, num = match.groups()
+        if "_F_" in reason:
+            # ignore function codes
+            continue
+        num = int(num)
+        yield reason, libname, errname, num
+
+
+def parse_extra_reasons(args):
+    """Parse extra reasons from openssl.ec"""
+    pat = re.compile(r"^R\s+((\w+)_R_(\w+))\s+(\d+)")
+    for match in _file_search(args.errcodes, pat):
+        reason, libname, errname, num = match.groups()
+        num = int(num)
+        yield reason, libname, errname, num
+
+
+def gen_library_codes(args):
+    """Generate table short libname to numeric code"""
+    yield "static struct py_ssl_library_code library_codes[] = {"
+    for libname in sorted(args.lib2errnum):
+        yield f"#ifdef ERR_LIB_{libname}"
+        yield f'    {{"{libname}", ERR_LIB_{libname}}},'
+        yield "#endif"
+    yield "    { NULL }"
+    yield "};"
+    yield ""
+
+
+def gen_error_codes(args):
+    """Generate error code table for error reasons"""
+    yield "static struct py_ssl_error_code error_codes[] = {"
+    for reason, libname, errname, num in args.reasons:
+        yield f"  #ifdef {reason}"
+        yield f'    {{"{errname}", ERR_LIB_{libname}, {reason}}},'
+        yield "  #else"
+        yield f'    {{"{errname}", {args.lib2errnum[libname]}, {num}}},'
+        yield "  #endif"
+
+    yield "    { NULL }"
+    yield "};"
+    yield ""
+
+
+def main():
+    args = parser.parse_args()
+
+    args.err_h = os.path.join(args.srcdir, "include", "openssl", "err.h")
+    if not os.path.isfile(args.err_h):
+        # Fall back to infile for OpenSSL 3.0.0
+        args.err_h += ".in"
+    args.errcodes = os.path.join(args.srcdir, "crypto", "err", "openssl.ec")
+    args.errtxt = os.path.join(args.srcdir, "crypto", "err", "openssl.txt")
+
+    if not os.path.isfile(args.errtxt):
+        parser.error(f"File {args.errtxt} not found in srcdir\n.")
+
+    # {X509: 11, ...}
+    args.lib2errnum = parse_err_h(args)
+
+    # [('X509_R_AKID_MISMATCH', 'X509', 'AKID_MISMATCH', 110), ...]
+    reasons = []
+    reasons.extend(parse_openssl_error_text(args))
+    reasons.extend(parse_extra_reasons(args))
+    # sort by libname, numeric error code
+    args.reasons = sorted(reasons, key=operator.itemgetter(0, 3))
+
+    lines = [
+        "/* File generated by Tools/ssl/make_ssl_data.py */"
+        f"/* Generated on {datetime.datetime.utcnow().isoformat()} */"
+    ]
+    lines.extend(gen_library_codes(args))
+    lines.append("")
+    lines.extend(gen_error_codes(args))
+
+    for line in lines:
+        args.output.write(line + "\n")
+
 
 if __name__ == "__main__":
-    openssl_inc = sys.argv[1]
-    outfile = sys.argv[2]
-    use_stdout = outfile == '-'
-    f = sys.stdout if use_stdout else open(outfile, "w")
-    # mnemonic -> (library code, error prefix, header file)
-    error_libraries = {}
-    for error_header in glob.glob(os.path.join(glob.escape(openssl_inc), 'include/openssl/*err.h')):
-        base = os.path.basename(error_header)
-        if base in ('buffererr.h', 'objectserr.h', 'storeerr.h'):
-            # Deprecated in 3.0.
-            continue
-        mnemonic = base[:-5].upper()
-        if mnemonic == "":
-            # err.h
-            lib_codes = {
-                code: num
-                for (code, (_, _, num)) in parse_error_codes(error_header, 'ERR_LIB_', None)
-            }
-        else:
-            error_libraries[mnemonic] = (f'ERR_LIB_{mnemonic}', f'{mnemonic}_R_', error_header)
-
-    # Read codes from libraries
-    new_codes = []
-    for libcode, prefix, h_file in sorted(error_libraries.values()):
-        new_codes += parse_error_codes(h_file, prefix, libcode)
-    new_code_nums = set((libcode, num)
-                        for (code, (libcode, name, num)) in new_codes)
-
-    # Merge with existing codes (in case some old codes disappeared).
-    codes = {}
-    for errname, (libnum, errnum) in _ssl.err_names_to_codes.items():
-        lib = error_libraries[_ssl.lib_codes_to_names[libnum]]
-        libcode = lib[0]              # e.g. ERR_LIB_PEM
-        errcode = lib[1] + errname    # e.g. SSL_R_BAD_SSL_SESSION_ID_LENGTH
-        # Only keep it if the numeric codes weren't reused
-        if (libcode, errnum) not in new_code_nums:
-            codes[errcode] = libcode, errname, errnum
-    codes.update(dict(new_codes))
-
-    def w(l):
-        f.write(l + "\n")
-    w("/* File generated by Tools/ssl/make_ssl_data.py */")
-    w("/* Generated on %s */" % datetime.datetime.now().isoformat())
-    w("")
-
-    w("static struct py_ssl_library_code library_codes[] = {")
-    for mnemo, (libcode, _, _) in sorted(error_libraries.items()):
-        w(f'#ifdef {libcode}')
-        w('    {"%s", %s},' % (mnemo, libcode))
-        w('#endif')
-    w('    { NULL }')
-    w('};')
-    w("")
-
-    w("static struct py_ssl_error_code error_codes[] = {")
-    for errcode, (libcode, name, num) in sorted(codes.items()):
-        w('  #ifdef %s' % (errcode))
-        w('    {"%s", %s, %s},' % (name, libcode, errcode))
-        w('  #else')
-        w('    {"%s", %s, %d},' % (name, lib_codes[libcode], num))
-        w('  #endif')
-    w('    { NULL }')
-    w('};')
-    if not use_stdout:
-        f.close()
+    main()
diff --git a/Tools/ssl/multissltests.py b/Tools/ssl/multissltests.py
index 3818165..8207680 100755
--- a/Tools/ssl/multissltests.py
+++ b/Tools/ssl/multissltests.py
@@ -33,6 +33,7 @@
     from urllib.error import HTTPError
 except ImportError:
     from urllib2 import urlopen, HTTPError
+import re
 import shutil
 import string
 import subprocess
@@ -43,21 +44,17 @@
 log = logging.getLogger("multissl")
 
 OPENSSL_OLD_VERSIONS = [
-    "1.0.2u",
-    "1.1.0l",
 ]
 
 OPENSSL_RECENT_VERSIONS = [
-    "1.1.1g",
-    # "3.0.0-alpha2"
+    "1.1.1n",
+    "3.0.2"
 ]
 
 LIBRESSL_OLD_VERSIONS = [
-    "2.9.2",
 ]
 
 LIBRESSL_RECENT_VERSIONS = [
-    "3.1.0",
 ]
 
 # store files in ../multissl
@@ -146,33 +143,20 @@
     help="Keep original sources for debugging."
 )
 
-OPENSSL_FIPS_CNF = """\
-openssl_conf = openssl_init
-
-.include {self.install_dir}/ssl/fipsinstall.cnf
-# .include {self.install_dir}/ssl/openssl.cnf
-
-[openssl_init]
-providers = provider_sect
-
-[provider_sect]
-fips = fips_sect
-default = default_sect
-
-[default_sect]
-activate = 1
-"""
-
 
 class AbstractBuilder(object):
     library = None
     url_templates = None
     src_template = None
     build_template = None
+    depend_target = None
     install_target = 'install'
+    jobs = os.cpu_count()
 
-    module_files = ("Modules/_ssl.c",
-                    "Modules/_hashopenssl.c")
+    module_files = (
+        os.path.join(PYTHONROOT, "Modules/_ssl.c"),
+        os.path.join(PYTHONROOT, "Modules/_hashopenssl.c"),
+    )
     module_libs = ("_ssl", "_hashlib")
 
     def __init__(self, version, args):
@@ -305,12 +289,12 @@
         log.info("Unpacking files to {}".format(self.build_dir))
         tf.extractall(self.build_dir, members)
 
-    def _build_src(self):
+    def _build_src(self, config_args=()):
         """Now build openssl"""
         log.info("Running build in {}".format(self.build_dir))
         cwd = self.build_dir
         cmd = [
-            "./config",
+            "./config", *config_args,
             "shared", "--debug",
             "--prefix={}".format(self.install_dir)
         ]
@@ -321,8 +305,11 @@
         if self.system:
             env['SYSTEM'] = self.system
         self._subprocess_call(cmd, cwd=cwd, env=env)
-        # Old OpenSSL versions do not support parallel builds.
-        self._subprocess_call(["make", "-j1"], cwd=cwd, env=env)
+        if self.depend_target:
+            self._subprocess_call(
+                ["make", "-j1", self.depend_target], cwd=cwd, env=env
+            )
+        self._subprocess_call(["make", f"-j{self.jobs}"], cwd=cwd, env=env)
 
     def _make_install(self):
         self._subprocess_call(
@@ -372,7 +359,7 @@
         env["LD_RUN_PATH"] = self.lib_dir
 
         log.info("Rebuilding Python modules")
-        cmd = [sys.executable, "setup.py", "build"]
+        cmd = [sys.executable, os.path.join(PYTHONROOT, "setup.py"), "build"]
         self._subprocess_call(cmd, env=env)
         self.check_imports()
 
@@ -387,7 +374,11 @@
 
     def run_python_tests(self, tests, network=True):
         if not tests:
-            cmd = [sys.executable, 'Lib/test/ssltests.py', '-j0']
+            cmd = [
+                sys.executable,
+                os.path.join(PYTHONROOT, 'Lib/test/ssltests.py'),
+                '-j0'
+            ]
         elif sys.version_info < (3, 3):
             cmd = [sys.executable, '-m', 'test.regrtest']
         else:
@@ -409,48 +400,40 @@
     build_template = "openssl-{}"
     # only install software, skip docs
     install_target = 'install_sw'
+    depend_target = 'depend'
 
     def _post_install(self):
         if self.version.startswith("3.0"):
             self._post_install_300()
 
+    def _build_src(self, config_args=()):
+        if self.version.startswith("3.0"):
+            config_args += ("enable-fips",)
+        super()._build_src(config_args)
+
     def _post_install_300(self):
         # create ssl/ subdir with example configs
+        # Install FIPS module
         self._subprocess_call(
-            ["make", "-j1", "install_ssldirs"],
+            ["make", "-j1", "install_ssldirs", "install_fips"],
             cwd=self.build_dir
         )
-        # Install FIPS module
-        # https://wiki.openssl.org/index.php/OpenSSL_3.0#Completing_the_installation_of_the_FIPS_Module
-        fipsinstall_cnf = os.path.join(
-            self.install_dir, "ssl", "fipsinstall.cnf"
-        )
-        openssl_fips_cnf = os.path.join(
-            self.install_dir, "ssl", "openssl-fips.cnf"
-        )
-        fips_mod = os.path.join(self.lib_dir, "ossl-modules/fips.so")
-        self._subprocess_call(
-            [
-                self.openssl_cli, "fipsinstall",
-                "-out", fipsinstall_cnf,
-                "-module", fips_mod,
-                "-provider_name", "fips",
-                "-mac_name", "HMAC",
-                "-macopt", "digest:SHA256",
-                "-macopt", "hexkey:00",
-                "-section_name", "fips_sect"
-            ]
-        )
-        with open(openssl_fips_cnf, "w") as f:
-            f.write(OPENSSL_FIPS_CNF.format(self=self))
+        if not os.path.isdir(self.lib_dir):
+            # 3.0.0-beta2 uses lib64 on 64 bit platforms
+            lib64 = self.lib_dir + "64"
+            os.symlink(lib64, self.lib_dir)
+
     @property
     def short_version(self):
         """Short version for OpenSSL download URL"""
-        short_version = self.version.rstrip(string.ascii_letters)
-        if short_version.startswith("0.9"):
-            short_version = "0.9.x"
-        return short_version
-
+        mo = re.search(r"^(\d+)\.(\d+)\.(\d+)", self.version)
+        parsed = tuple(int(m) for m in mo.groups())
+        if parsed < (1, 0, 0):
+            return "0.9.x"
+        if parsed >= (3, 0, 0):
+            # OpenSSL 3.0.0 -> /old/3.0/
+            parsed = parsed[:2]
+        return ".".join(str(i) for i in parsed)
 
 class BuildLibreSSL(AbstractBuilder):
     library = "LibreSSL"
diff --git a/Tools/stringbench/stringbench.py b/Tools/stringbench/stringbench.py
index 5abc25a..5d2b414 100644
--- a/Tools/stringbench/stringbench.py
+++ b/Tools/stringbench/stringbench.py
@@ -730,7 +730,7 @@
     for x in _RANGE_1000:
         sep_join(s2)
 
-@bench('"A".join(["Bob"]*100))',
+@bench('"A".join(["Bob"]*100)',
        "join list of 100 words, with 1 character sep", 1000)
 def join_100_words_single(STR):
     sep = STR("A")
diff --git a/Tools/unittestgui/unittestgui.py b/Tools/unittestgui/unittestgui.py
index c3b5fa4..4fc5930 100755
--- a/Tools/unittestgui/unittestgui.py
+++ b/Tools/unittestgui/unittestgui.py
@@ -54,7 +54,6 @@
     def __init__(self, *args, **kwargs):
         self.currentResult = None
         self.running = 0
-        self.__rollbackImporter = None
         self.__rollbackImporter = RollbackImporter()
         self.test_suite = None
 
diff --git a/aclocal.m4 b/aclocal.m4
index b5f9cb0..2f1bd37 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,4 +1,4 @@
-# generated automatically by aclocal 1.16.2 -*- Autoconf -*-
+# generated automatically by aclocal 1.16.3 -*- Autoconf -*-
 
 # Copyright (C) 1996-2020 Free Software Foundation, Inc.
 
@@ -12,6 +12,269 @@
 # PARTICULAR PURPOSE.
 
 m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
+# ===============================================================================
+#  https://www.gnu.org/software/autoconf-archive/ax_c_float_words_bigendian.html
+# ===============================================================================
+#
+# SYNOPSIS
+#
+#   AX_C_FLOAT_WORDS_BIGENDIAN([ACTION-IF-TRUE], [ACTION-IF-FALSE], [ACTION-IF-UNKNOWN])
+#
+# DESCRIPTION
+#
+#   Checks the ordering of words within a multi-word float. This check is
+#   necessary because on some systems (e.g. certain ARM systems), the float
+#   word ordering can be different from the byte ordering. In a multi-word
+#   float context, "big-endian" implies that the word containing the sign
+#   bit is found in the memory location with the lowest address. This
+#   implementation was inspired by the AC_C_BIGENDIAN macro in autoconf.
+#
+#   The endianness is detected by first compiling C code that contains a
+#   special double float value, then grepping the resulting object file for
+#   certain strings of ASCII values. The double is specially crafted to have
+#   a binary representation that corresponds with a simple string. In this
+#   implementation, the string "noonsees" was selected because the
+#   individual word values ("noon" and "sees") are palindromes, thus making
+#   this test byte-order agnostic. If grep finds the string "noonsees" in
+#   the object file, the target platform stores float words in big-endian
+#   order. If grep finds "seesnoon", float words are in little-endian order.
+#   If neither value is found, the user is instructed to specify the
+#   ordering.
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Daniel Amelang <dan@amelang.net>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 11
+
+AC_DEFUN([AX_C_FLOAT_WORDS_BIGENDIAN],
+  [AC_CACHE_CHECK(whether float word ordering is bigendian,
+                  ax_cv_c_float_words_bigendian, [
+
+ax_cv_c_float_words_bigendian=unknown
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+
+double d = 90904234967036810337470478905505011476211692735615632014797120844053488865816695273723469097858056257517020191247487429516932130503560650002327564517570778480236724525140520121371739201496540132640109977779420565776568942592.0;
+
+]])], [
+
+if grep noonsees conftest.$ac_objext >/dev/null ; then
+  ax_cv_c_float_words_bigendian=yes
+fi
+if grep seesnoon conftest.$ac_objext >/dev/null ; then
+  if test "$ax_cv_c_float_words_bigendian" = unknown; then
+    ax_cv_c_float_words_bigendian=no
+  else
+    ax_cv_c_float_words_bigendian=unknown
+  fi
+fi
+
+])])
+
+case $ax_cv_c_float_words_bigendian in
+  yes)
+    m4_default([$1],
+      [AC_DEFINE([FLOAT_WORDS_BIGENDIAN], 1,
+                 [Define to 1 if your system stores words within floats
+                  with the most significant word first])]) ;;
+  no)
+    $2 ;;
+  *)
+    m4_default([$3],
+      [AC_MSG_ERROR([
+
+Unknown float word ordering. You need to manually preset
+ax_cv_c_float_words_bigendian=no (or yes) according to your system.
+
+    ])]) ;;
+esac
+
+])# AX_C_FLOAT_WORDS_BIGENDIAN
+
+# ===========================================================================
+#  https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
+#
+# DESCRIPTION
+#
+#   Check whether the given FLAG works with the current language's compiler
+#   or gives an error.  (Warnings, however, are ignored)
+#
+#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
+#   success/failure.
+#
+#   If EXTRA-FLAGS is defined, it is added to the current language's default
+#   flags (e.g. CFLAGS) when the check is done.  The check is thus made with
+#   the flags: "CFLAGS EXTRA-FLAGS FLAG".  This can for example be used to
+#   force the compiler to issue an error when a bad flag is given.
+#
+#   INPUT gives an alternative input source to AC_COMPILE_IFELSE.
+#
+#   NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
+#   macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
+#   Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved.  This file is offered as-is, without any
+#   warranty.
+
+#serial 6
+
+AC_DEFUN([AX_CHECK_COMPILE_FLAG],
+[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
+AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
+AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
+  ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
+  _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
+  AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
+    [AS_VAR_SET(CACHEVAR,[yes])],
+    [AS_VAR_SET(CACHEVAR,[no])])
+  _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
+AS_VAR_IF(CACHEVAR,yes,
+  [m4_default([$2], :)],
+  [m4_default([$3], :)])
+AS_VAR_POPDEF([CACHEVAR])dnl
+])dnl AX_CHECK_COMPILE_FLAGS
+
+# ===========================================================================
+#     https://www.gnu.org/software/autoconf-archive/ax_check_openssl.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_CHECK_OPENSSL([action-if-found[, action-if-not-found]])
+#
+# DESCRIPTION
+#
+#   Look for OpenSSL in a number of default spots, or in a user-selected
+#   spot (via --with-openssl).  Sets
+#
+#     OPENSSL_INCLUDES to the include directives required
+#     OPENSSL_LIBS to the -l directives required
+#     OPENSSL_LDFLAGS to the -L or -R flags required
+#
+#   and calls ACTION-IF-FOUND or ACTION-IF-NOT-FOUND appropriately
+#
+#   This macro sets OPENSSL_INCLUDES such that source files should use the
+#   openssl/ directory in include directives:
+#
+#     #include <openssl/hmac.h>
+#
+# LICENSE
+#
+#   Copyright (c) 2009,2010 Zmanda Inc. <http://www.zmanda.com/>
+#   Copyright (c) 2009,2010 Dustin J. Mitchell <dustin@zmanda.com>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 10
+
+AU_ALIAS([CHECK_SSL], [AX_CHECK_OPENSSL])
+AC_DEFUN([AX_CHECK_OPENSSL], [
+    found=false
+    AC_ARG_WITH([openssl],
+        [AS_HELP_STRING([--with-openssl=DIR],
+            [root of the OpenSSL directory])],
+        [
+            case "$withval" in
+            "" | y | ye | yes | n | no)
+            AC_MSG_ERROR([Invalid --with-openssl value])
+              ;;
+            *) ssldirs="$withval"
+              ;;
+            esac
+        ], [
+            # if pkg-config is installed and openssl has installed a .pc file,
+            # then use that information and don't search ssldirs
+            AC_CHECK_TOOL([PKG_CONFIG], [pkg-config])
+            if test x"$PKG_CONFIG" != x""; then
+                OPENSSL_LDFLAGS=`$PKG_CONFIG openssl --libs-only-L 2>/dev/null`
+                if test $? = 0; then
+                    OPENSSL_LIBS=`$PKG_CONFIG openssl --libs-only-l 2>/dev/null`
+                    OPENSSL_INCLUDES=`$PKG_CONFIG openssl --cflags-only-I 2>/dev/null`
+                    found=true
+                fi
+            fi
+
+            # no such luck; use some default ssldirs
+            if ! $found; then
+                ssldirs="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr"
+            fi
+        ]
+        )
+
+
+    # note that we #include <openssl/foo.h>, so the OpenSSL headers have to be in
+    # an 'openssl' subdirectory
+
+    if ! $found; then
+        OPENSSL_INCLUDES=
+        for ssldir in $ssldirs; do
+            AC_MSG_CHECKING([for openssl/ssl.h in $ssldir])
+            if test -f "$ssldir/include/openssl/ssl.h"; then
+                OPENSSL_INCLUDES="-I$ssldir/include"
+                OPENSSL_LDFLAGS="-L$ssldir/lib"
+                OPENSSL_LIBS="-lssl -lcrypto"
+                found=true
+                AC_MSG_RESULT([yes])
+                break
+            else
+                AC_MSG_RESULT([no])
+            fi
+        done
+
+        # if the file wasn't found, well, go ahead and try the link anyway -- maybe
+        # it will just work!
+    fi
+
+    # try the preprocessor and linker with our new flags,
+    # being careful not to pollute the global LIBS, LDFLAGS, and CPPFLAGS
+
+    AC_MSG_CHECKING([whether compiling and linking against OpenSSL works])
+    echo "Trying link with OPENSSL_LDFLAGS=$OPENSSL_LDFLAGS;" \
+        "OPENSSL_LIBS=$OPENSSL_LIBS; OPENSSL_INCLUDES=$OPENSSL_INCLUDES" >&AS_MESSAGE_LOG_FD
+
+    save_LIBS="$LIBS"
+    save_LDFLAGS="$LDFLAGS"
+    save_CPPFLAGS="$CPPFLAGS"
+    LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
+    LIBS="$OPENSSL_LIBS $LIBS"
+    CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS"
+    AC_LINK_IFELSE(
+        [AC_LANG_PROGRAM([#include <openssl/ssl.h>], [SSL_new(NULL)])],
+        [
+            AC_MSG_RESULT([yes])
+            $1
+        ], [
+            AC_MSG_RESULT([no])
+            $2
+        ])
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+
+    AC_SUBST([OPENSSL_INCLUDES])
+    AC_SUBST([OPENSSL_LIBS])
+    AC_SUBST([OPENSSL_LDFLAGS])
+])
+
 # pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
 # serial 11 (pkg-config-0.29.1)
 
@@ -356,5 +619,3 @@
         [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
 ])dnl PKG_HAVE_DEFINE_WITH_MODULES
 
-m4_include([m4/ax_c_float_words_bigendian.m4])
-m4_include([m4/ax_check_openssl.m4])
diff --git a/android/Setup.local b/android/Setup.local
index f374c50..0113ebb 100644
--- a/android/Setup.local
+++ b/android/Setup.local
@@ -11,7 +11,6 @@
 _bisect _bisectmodule.c
 _heapq _heapqmodule.c
 _pickle _pickle.c
-atexit atexitmodule.c
 _json _json.c
 _lsprof _lsprof.c rotatingtree.c
 unicodedata unicodedata.c
@@ -24,7 +23,6 @@
 pwd pwdmodule.c
 grp grpmodule.c
 select selectmodule.c
-parser parsermodule.c
 mmap mmapmodule.c
 syslog syslogmodule.c
 _xxsubinterpreters _xxsubinterpretersmodule.c
diff --git a/android/bionic/config.c b/android/bionic/config.c
index 393913d..8cdc768 100644
--- a/android/bionic/config.c
+++ b/android/bionic/config.c
@@ -34,7 +34,6 @@
 extern PyObject* PyInit__bisect(void);
 extern PyObject* PyInit__heapq(void);
 extern PyObject* PyInit__pickle(void);
-extern PyObject* PyInit_atexit(void);
 extern PyObject* PyInit__json(void);
 extern PyObject* PyInit__lsprof(void);
 extern PyObject* PyInit_unicodedata(void);
@@ -47,7 +46,6 @@
 extern PyObject* PyInit_pwd(void);
 extern PyObject* PyInit_grp(void);
 extern PyObject* PyInit_select(void);
-extern PyObject* PyInit_parser(void);
 extern PyObject* PyInit_mmap(void);
 extern PyObject* PyInit_syslog(void);
 extern PyObject* PyInit__xxsubinterpreters(void);
@@ -95,7 +93,6 @@
 extern PyObject* PyInit__io(void);
 extern PyObject* PyInit_faulthandler(void);
 extern PyObject* PyInit__tracemalloc(void);
-extern PyObject* PyInit__peg_parser(void);
 extern PyObject* PyInit__symtable(void);
 extern PyObject* PyInit_xxsubtype(void);
 
@@ -121,7 +118,6 @@
     {"_bisect", PyInit__bisect},
     {"_heapq", PyInit__heapq},
     {"_pickle", PyInit__pickle},
-    {"atexit", PyInit_atexit},
     {"_json", PyInit__json},
     {"_lsprof", PyInit__lsprof},
     {"unicodedata", PyInit_unicodedata},
@@ -134,7 +130,6 @@
     {"pwd", PyInit_pwd},
     {"grp", PyInit_grp},
     {"select", PyInit_select},
-    {"parser", PyInit_parser},
     {"mmap", PyInit_mmap},
     {"syslog", PyInit_syslog},
     {"_xxsubinterpreters", PyInit__xxsubinterpreters},
@@ -182,7 +177,6 @@
     {"_io", PyInit__io},
     {"faulthandler", PyInit_faulthandler},
     {"_tracemalloc", PyInit__tracemalloc},
-    {"_peg_parser", PyInit__peg_parser},
     {"_symtable", PyInit__symtable},
     {"xxsubtype", PyInit_xxsubtype},
 
diff --git a/android/bionic/pyconfig/pyconfig.h b/android/bionic/pyconfig/pyconfig.h
index 8974547..7e51e76 100644
--- a/android/bionic/pyconfig/pyconfig.h
+++ b/android/bionic/pyconfig/pyconfig.h
@@ -17,6 +17,12 @@
    support for AIX C++ shared extension modules. */
 /* #undef AIX_GENUINE_CPLUSPLUS */
 
+/* The normal alignment of `long', in bytes. */
+#define ALIGNOF_LONG 8
+
+/* The normal alignment of `size_t', in bytes. */
+#define ALIGNOF_SIZE_T 8
+
 /* Alternative SOABI used in debug build to load C extensions built in release
    mode */
 /* #undef ALT_SOABI */
@@ -39,6 +45,9 @@
 /* Define if --enable-ipv6 is specified */
 #define ENABLE_IPV6 1
 
+/* Better isolate subinterpreters, experimental build mode. */
+/* #undef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS */
+
 /* Define to 1 if your system stores words within floats with the most
    significant word first */
 /* #undef FLOAT_WORDS_BIGENDIAN */
@@ -113,7 +122,7 @@
 /* Define if `unsetenv` does not return an int. */
 /* #undef HAVE_BROKEN_UNSETENV */
 
-/* Has builtin atomics */
+/* Has builtin __atomic_load_n() and __atomic_store_n() functions */
 #define HAVE_BUILTIN_ATOMIC 1
 
 /* Define to 1 if you have the 'chflags' function. */
@@ -137,6 +146,9 @@
 /* Define to 1 if you have the `clock_settime' function. */
 #define HAVE_CLOCK_SETTIME 1
 
+/* Define to 1 if you have the `close_range' function. */
+/* #undef HAVE_CLOSE_RANGE */
+
 /* Define if the C compiler supports computed gotos. */
 #define HAVE_COMPUTED_GOTOS 1
 
@@ -282,6 +294,9 @@
 /* Define to 1 if you have the `dup3' function. */
 #define HAVE_DUP3 1
 
+/* Define if you have the '_dyld_shared_cache_contains_path' function. */
+/* #undef HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH */
+
 /* Defined when any dynamic module loading is enabled. */
 #define HAVE_DYNAMIC_LOADING 1
 
@@ -303,6 +318,9 @@
 /* Define to 1 if you have the <errno.h> header file. */
 #define HAVE_ERRNO_H 1
 
+/* Define if you have the 'eventfd' function. */
+#define HAVE_EVENTFD 1
+
 /* Define to 1 if you have the `execv' function. */
 #define HAVE_EXECV 1
 
@@ -601,7 +619,7 @@
 /* Define to 1 if you have the <libintl.h> header file. */
 /* #undef HAVE_LIBINTL_H */
 
-/* Define if you have the readline library (-lreadline). */
+/* Define to build the readline module. */
 /* #undef HAVE_LIBREADLINE */
 
 /* Define to 1 if you have the `resolv' library (-lresolv). */
@@ -613,12 +631,18 @@
 /* Define to 1 if you have the <libutil.h> header file. */
 /* #undef HAVE_LIBUTIL_H */
 
+/* Define to 1 if you have the `uuid' library (-luuid). */
+/* #undef HAVE_LIBUUID */
+
 /* Define if you have the 'link' function. */
 #define HAVE_LINK 1
 
 /* Define to 1 if you have the `linkat' function. */
 #define HAVE_LINKAT 1
 
+/* Define to 1 if you have the <linux/auxvec.h> header file. */
+#define HAVE_LINUX_AUXVEC_H 1
+
 /* Define to 1 if you have the <linux/can/bcm.h> header file. */
 #define HAVE_LINUX_CAN_BCM_H 1
 
@@ -733,6 +757,10 @@
 /* Define to 1 if you have the `nice' function. */
 #define HAVE_NICE 1
 
+/* Define if the internal form of wchar_t in non-Unicode locales is not
+   Unicode. */
+/* #undef HAVE_NON_UNICODE_WCHAR_T_REPRESENTATION */
+
 /* Define to 1 if you have the `openat' function. */
 #define HAVE_OPENAT 1
 
@@ -781,9 +809,6 @@
 /* Define if you have the 'prlimit' functions. */
 #define HAVE_PRLIMIT 1
 
-/* Define if you have the '_dyld_shared_cache_contains_path' function. */
-/* #undef HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH */
-
 /* Define to 1 if you have the <process.h> header file. */
 /* #undef HAVE_PROCESS_H */
 
@@ -842,10 +867,10 @@
 /* #undef HAVE_RL_APPEND_HISTORY */
 
 /* Define if you can turn off readline's signal handling. */
-#define HAVE_RL_CATCH_SIGNAL 1
+/* #undef HAVE_RL_CATCH_SIGNAL */
 
 /* Define if you have readline 2.2 */
-#define HAVE_RL_COMPLETION_APPEND_CHARACTER 1
+/* #undef HAVE_RL_COMPLETION_APPEND_CHARACTER */
 
 /* Define if you have readline 4.0 */
 /* #undef HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK */
@@ -854,7 +879,7 @@
 /* #undef HAVE_RL_COMPLETION_MATCHES */
 
 /* Define if you have rl_completion_suppress_append */
-#define HAVE_RL_COMPLETION_SUPPRESS_APPEND 1
+/* #undef HAVE_RL_COMPLETION_SUPPRESS_APPEND */
 
 /* Define if you have readline 4.0 */
 /* #undef HAVE_RL_PRE_INPUT_HOOK */
@@ -886,6 +911,9 @@
 /* Define to 1 if you have the `sched_setscheduler' function. */
 #define HAVE_SCHED_SETSCHEDULER 1
 
+/* Define to 1 if you have the `sem_clockwait' function. */
+/* #undef HAVE_SEM_CLOCKWAIT */
+
 /* Define to 1 if you have the `sem_getvalue' function. */
 #define HAVE_SEM_GETVALUE 1
 
@@ -1012,6 +1040,9 @@
 /* Define to 1 if you have the <spawn.h> header file. */
 #define HAVE_SPAWN_H 1
 
+/* Define to 1 if you have the `splice' function. */
+#define HAVE_SPLICE 1
+
 /* Define if your compiler provides ssize_t */
 #define HAVE_SSIZE_T 1
 
@@ -1037,9 +1068,6 @@
 /* Has stdatomic.h with atomic_int and atomic_uintptr_t */
 #define HAVE_STD_ATOMIC 1
 
-/* Define to 1 if you have the `strdup' function. */
-#define HAVE_STRDUP 1
-
 /* Define to 1 if you have the `strftime' function. */
 #define HAVE_STRFTIME 1
 
@@ -1119,6 +1147,9 @@
 /* Define to 1 if you have the <sys/epoll.h> header file. */
 #define HAVE_SYS_EPOLL_H 1
 
+/* Define to 1 if you have the <sys/eventfd.h> header file. */
+#define HAVE_SYS_EVENTFD_H 1
+
 /* Define to 1 if you have the <sys/event.h> header file. */
 /* #undef HAVE_SYS_EVENT_H */
 
@@ -1304,6 +1335,9 @@
 /* Define to 1 if you have the <uuid/uuid.h> header file. */
 /* #undef HAVE_UUID_UUID_H */
 
+/* Define to 1 if you have the `vfork' function. */
+#define HAVE_VFORK 1
+
 /* Define to 1 if you have the `wait3' function. */
 /* #undef HAVE_WAIT3 */
 
@@ -1338,9 +1372,6 @@
 /* Define to 1 if you have the `writev' function. */
 #define HAVE_WRITEV 1
 
-/* Define if libssl has X509_VERIFY_PARAM_set1_host and related function */
-/* #undef HAVE_X509_VERIFY_PARAM_SET1_HOST */
-
 /* Define if the zlib library has inflateCopy */
 #define HAVE_ZLIB_COPY 1
 
@@ -1494,6 +1525,9 @@
    (which you can't on SCO ODT 3.0). */
 #define SYS_SELECT_WITH_SYS_TIME 1
 
+/* Custom thread stack size depending on chosen sanitizer runtimes. */
+/* #undef THREAD_STACK_SIZE */
+
 /* Library needed by timemodule.c: librt may be needed for clock_gettime() */
 /* #undef TIMEMODULE_LIB */
 
@@ -1546,6 +1580,9 @@
    Dyld is necessary to support frameworks. */
 /* #undef WITH_DYLD */
 
+/* Define to build the readline module against Editline. */
+/* #undef WITH_EDITLINE */
+
 /* Define to 1 if libintl is needed for locale functions. */
 /* #undef WITH_LIBINTL */
 
@@ -1629,11 +1666,6 @@
 /* Define on FreeBSD to activate all library features */
 #define __BSD_VISIBLE 1
 
-/* Define to 1 if type `char' is unsigned and you are not using gcc.  */
-#ifndef __CHAR_UNSIGNED__
-/* # undef __CHAR_UNSIGNED__ */
-#endif
-
 /* Define to 'long' if <time.h> doesn't define. */
 /* #undef clock_t */
 
diff --git a/android/darwin_x86_64/config.c b/android/darwin_x86_64/config.c
index 5badcb8..a120f36 100644
--- a/android/darwin_x86_64/config.c
+++ b/android/darwin_x86_64/config.c
@@ -38,7 +38,6 @@
 extern PyObject* PyInit__bisect(void);
 extern PyObject* PyInit__heapq(void);
 extern PyObject* PyInit__pickle(void);
-extern PyObject* PyInit_atexit(void);
 extern PyObject* PyInit__json(void);
 extern PyObject* PyInit__lsprof(void);
 extern PyObject* PyInit_unicodedata(void);
@@ -51,7 +50,6 @@
 extern PyObject* PyInit_pwd(void);
 extern PyObject* PyInit_grp(void);
 extern PyObject* PyInit_select(void);
-extern PyObject* PyInit_parser(void);
 extern PyObject* PyInit_mmap(void);
 extern PyObject* PyInit_syslog(void);
 extern PyObject* PyInit__xxsubinterpreters(void);
@@ -99,7 +97,6 @@
 extern PyObject* PyInit__io(void);
 extern PyObject* PyInit_faulthandler(void);
 extern PyObject* PyInit__tracemalloc(void);
-extern PyObject* PyInit__peg_parser(void);
 extern PyObject* PyInit__symtable(void);
 extern PyObject* PyInit_xxsubtype(void);
 
@@ -129,7 +126,6 @@
     {"_bisect", PyInit__bisect},
     {"_heapq", PyInit__heapq},
     {"_pickle", PyInit__pickle},
-    {"atexit", PyInit_atexit},
     {"_json", PyInit__json},
     {"_lsprof", PyInit__lsprof},
     {"unicodedata", PyInit_unicodedata},
@@ -142,7 +138,6 @@
     {"pwd", PyInit_pwd},
     {"grp", PyInit_grp},
     {"select", PyInit_select},
-    {"parser", PyInit_parser},
     {"mmap", PyInit_mmap},
     {"syslog", PyInit_syslog},
     {"_xxsubinterpreters", PyInit__xxsubinterpreters},
@@ -190,7 +185,6 @@
     {"_io", PyInit__io},
     {"faulthandler", PyInit_faulthandler},
     {"_tracemalloc", PyInit__tracemalloc},
-    {"_peg_parser", PyInit__peg_parser},
     {"_symtable", PyInit__symtable},
     {"xxsubtype", PyInit_xxsubtype},
 
diff --git a/android/darwin_x86_64/pyconfig/pyconfig.h b/android/darwin_x86_64/pyconfig/pyconfig.h
index 4deb9a0..60c2c91 100644
--- a/android/darwin_x86_64/pyconfig/pyconfig.h
+++ b/android/darwin_x86_64/pyconfig/pyconfig.h
@@ -17,6 +17,12 @@
    support for AIX C++ shared extension modules. */
 /* #undef AIX_GENUINE_CPLUSPLUS */
 
+/* The normal alignment of `long', in bytes. */
+#define ALIGNOF_LONG 8
+
+/* The normal alignment of `size_t', in bytes. */
+#define ALIGNOF_SIZE_T 8
+
 /* Alternative SOABI used in debug build to load C extensions built in release
    mode */
 /* #undef ALT_SOABI */
@@ -39,6 +45,9 @@
 /* Define if --enable-ipv6 is specified */
 #define ENABLE_IPV6 1
 
+/* Better isolate subinterpreters, experimental build mode. */
+/* #undef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS */
+
 /* Define to 1 if your system stores words within floats with the most
    significant word first */
 /* #undef FLOAT_WORDS_BIGENDIAN */
@@ -113,7 +122,7 @@
 /* Define if `unsetenv` does not return an int. */
 /* #undef HAVE_BROKEN_UNSETENV */
 
-/* Has builtin atomics */
+/* Has builtin __atomic_load_n() and __atomic_store_n() functions */
 #define HAVE_BUILTIN_ATOMIC 1
 
 /* Define to 1 if you have the 'chflags' function. */
@@ -137,6 +146,9 @@
 /* Define to 1 if you have the `clock_settime' function. */
 #define HAVE_CLOCK_SETTIME 1
 
+/* Define to 1 if you have the `close_range' function. */
+/* #undef HAVE_CLOSE_RANGE */
+
 /* Define if the C compiler supports computed gotos. */
 #define HAVE_COMPUTED_GOTOS 1
 
@@ -282,6 +294,9 @@
 /* Define to 1 if you have the `dup3' function. */
 /* #undef HAVE_DUP3 */
 
+/* Define if you have the '_dyld_shared_cache_contains_path' function. */
+#define HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH 1
+
 /* Defined when any dynamic module loading is enabled. */
 #define HAVE_DYNAMIC_LOADING 1
 
@@ -303,6 +318,9 @@
 /* Define to 1 if you have the <errno.h> header file. */
 #define HAVE_ERRNO_H 1
 
+/* Define if you have the 'eventfd' function. */
+/* #undef HAVE_EVENTFD */
+
 /* Define to 1 if you have the `execv' function. */
 #define HAVE_EXECV 1
 
@@ -391,7 +409,7 @@
 #define HAVE_FTRUNCATE 1
 
 /* Define to 1 if you have the `futimens' function. */
-/* #undef HAVE_FUTIMENS */
+#define HAVE_FUTIMENS 1
 
 /* Define to 1 if you have the `futimes' function. */
 #define HAVE_FUTIMES 1
@@ -425,7 +443,7 @@
 #define HAVE_GETC_UNLOCKED 1
 
 /* Define to 1 if you have the `getentropy' function. */
-/* #undef HAVE_GETENTROPY */
+#define HAVE_GETENTROPY 1
 
 /* Define to 1 if you have the `getgrgid_r' function. */
 #define HAVE_GETGRGID_R 1
@@ -599,7 +617,7 @@
 /* Define to 1 if you have the <libintl.h> header file. */
 /* #undef HAVE_LIBINTL_H */
 
-/* Define if you have the readline library (-lreadline). */
+/* Define to build the readline module. */
 #define HAVE_LIBREADLINE 1
 
 /* Define to 1 if you have the `resolv' library (-lresolv). */
@@ -611,12 +629,18 @@
 /* Define to 1 if you have the <libutil.h> header file. */
 /* #undef HAVE_LIBUTIL_H */
 
+/* Define to 1 if you have the `uuid' library (-luuid). */
+/* #undef HAVE_LIBUUID */
+
 /* Define if you have the 'link' function. */
 #define HAVE_LINK 1
 
 /* Define to 1 if you have the `linkat' function. */
 #define HAVE_LINKAT 1
 
+/* Define to 1 if you have the <linux/auxvec.h> header file. */
+/* #undef HAVE_LINUX_AUXVEC_H */
+
 /* Define to 1 if you have the <linux/can/bcm.h> header file. */
 /* #undef HAVE_LINUX_CAN_BCM_H */
 
@@ -731,6 +755,10 @@
 /* Define to 1 if you have the `nice' function. */
 #define HAVE_NICE 1
 
+/* Define if the internal form of wchar_t in non-Unicode locales is not
+   Unicode. */
+/* #undef HAVE_NON_UNICODE_WCHAR_T_REPRESENTATION */
+
 /* Define to 1 if you have the `openat' function. */
 #define HAVE_OPENAT 1
 
@@ -779,9 +807,6 @@
 /* Define if you have the 'prlimit' functions. */
 /* #undef HAVE_PRLIMIT */
 
-/* Define if you have the '_dyld_shared_cache_contains_path' function. */
-/* #undef HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH */
-
 /* Define to 1 if you have the <process.h> header file. */
 /* #undef HAVE_PROCESS_H */
 
@@ -884,6 +909,9 @@
 /* Define to 1 if you have the `sched_setscheduler' function. */
 /* #undef HAVE_SCHED_SETSCHEDULER */
 
+/* Define to 1 if you have the `sem_clockwait' function. */
+/* #undef HAVE_SEM_CLOCKWAIT */
+
 /* Define to 1 if you have the `sem_getvalue' function. */
 #define HAVE_SEM_GETVALUE 1
 
@@ -1010,6 +1038,9 @@
 /* Define to 1 if you have the <spawn.h> header file. */
 #define HAVE_SPAWN_H 1
 
+/* Define to 1 if you have the `splice' function. */
+/* #undef HAVE_SPLICE */
+
 /* Define if your compiler provides ssize_t */
 #define HAVE_SSIZE_T 1
 
@@ -1035,9 +1066,6 @@
 /* Has stdatomic.h with atomic_int and atomic_uintptr_t */
 #define HAVE_STD_ATOMIC 1
 
-/* Define to 1 if you have the `strdup' function. */
-#define HAVE_STRDUP 1
-
 /* Define to 1 if you have the `strftime' function. */
 #define HAVE_STRFTIME 1
 
@@ -1117,6 +1145,9 @@
 /* Define to 1 if you have the <sys/epoll.h> header file. */
 /* #undef HAVE_SYS_EPOLL_H */
 
+/* Define to 1 if you have the <sys/eventfd.h> header file. */
+/* #undef HAVE_SYS_EVENTFD_H */
+
 /* Define to 1 if you have the <sys/event.h> header file. */
 #define HAVE_SYS_EVENT_H 1
 
@@ -1273,13 +1304,13 @@
 /* Define if you have a useable wchar_t type defined in wchar.h; useable means
    wchar_t must be an unsigned type with at least 16 bits. (see
    Include/unicodeobject.h). */
-#define HAVE_USABLE_WCHAR_T 1
+/* #undef HAVE_USABLE_WCHAR_T */
 
 /* Define to 1 if you have the <util.h> header file. */
 #define HAVE_UTIL_H 1
 
 /* Define to 1 if you have the `utimensat' function. */
-/* #undef HAVE_UTIMENSAT */
+#define HAVE_UTIMENSAT 1
 
 /* Define to 1 if you have the `utimes' function. */
 #define HAVE_UTIMES 1
@@ -1302,6 +1333,9 @@
 /* Define to 1 if you have the <uuid/uuid.h> header file. */
 #define HAVE_UUID_UUID_H 1
 
+/* Define to 1 if you have the `vfork' function. */
+#define HAVE_VFORK 1
+
 /* Define to 1 if you have the `wait3' function. */
 #define HAVE_WAIT3 1
 
@@ -1336,9 +1370,6 @@
 /* Define to 1 if you have the `writev' function. */
 #define HAVE_WRITEV 1
 
-/* Define if libssl has X509_VERIFY_PARAM_set1_host and related function */
-/* #undef HAVE_X509_VERIFY_PARAM_SET1_HOST */
-
 /* Define if the zlib library has inflateCopy */
 #define HAVE_ZLIB_COPY 1
 
@@ -1381,7 +1412,7 @@
 /* #undef PTHREAD_KEY_T_IS_COMPATIBLE_WITH_INT */
 
 /* Defined if PTHREAD_SCOPE_SYSTEM supported. */
-/* #undef PTHREAD_SYSTEM_SCHED_SUPPORTED */
+#define PTHREAD_SYSTEM_SCHED_SUPPORTED 1
 
 /* Define as the preferred size in bits of long digits */
 /* #undef PYLONG_BITS_IN_DIGIT */
@@ -1425,7 +1456,7 @@
 /* #undef SHM_NEEDS_LIBRT */
 
 /* Define if i>>j for signed int i does not extend the sign bit when i < 0 */
-#define SIGNED_RIGHT_SHIFT_ZERO_FILLS 1
+/* #undef SIGNED_RIGHT_SHIFT_ZERO_FILLS */
 
 /* The size of `double', as computed by sizeof. */
 #define SIZEOF_DOUBLE 8
@@ -1488,6 +1519,9 @@
    (which you can't on SCO ODT 3.0). */
 #define SYS_SELECT_WITH_SYS_TIME 1
 
+/* Custom thread stack size depending on chosen sanitizer runtimes. */
+#define THREAD_STACK_SIZE 0x1000000
+
 /* Library needed by timemodule.c: librt may be needed for clock_gettime() */
 /* #undef TIMEMODULE_LIB */
 
@@ -1540,6 +1574,9 @@
    Dyld is necessary to support frameworks. */
 #define WITH_DYLD 1
 
+/* Define to build the readline module against Editline. */
+/* #undef WITH_EDITLINE */
+
 /* Define to 1 if libintl is needed for locale functions. */
 /* #undef WITH_LIBINTL */
 
@@ -1623,11 +1660,6 @@
 /* Define on FreeBSD to activate all library features */
 #define __BSD_VISIBLE 1
 
-/* Define to 1 if type `char' is unsigned and you are not using gcc.  */
-#ifndef __CHAR_UNSIGNED__
-/* # undef __CHAR_UNSIGNED__ */
-#endif
-
 /* Define to 'long' if <time.h> doesn't define. */
 /* #undef clock_t */
 
diff --git a/android/linux_x86_64/config.c b/android/linux_x86_64/config.c
index be62f9a..7889efe 100644
--- a/android/linux_x86_64/config.c
+++ b/android/linux_x86_64/config.c
@@ -37,7 +37,6 @@
 extern PyObject* PyInit__bisect(void);
 extern PyObject* PyInit__heapq(void);
 extern PyObject* PyInit__pickle(void);
-extern PyObject* PyInit_atexit(void);
 extern PyObject* PyInit__json(void);
 extern PyObject* PyInit__lsprof(void);
 extern PyObject* PyInit_unicodedata(void);
@@ -50,7 +49,6 @@
 extern PyObject* PyInit_pwd(void);
 extern PyObject* PyInit_grp(void);
 extern PyObject* PyInit_select(void);
-extern PyObject* PyInit_parser(void);
 extern PyObject* PyInit_mmap(void);
 extern PyObject* PyInit_syslog(void);
 extern PyObject* PyInit__xxsubinterpreters(void);
@@ -98,7 +96,6 @@
 extern PyObject* PyInit__io(void);
 extern PyObject* PyInit_faulthandler(void);
 extern PyObject* PyInit__tracemalloc(void);
-extern PyObject* PyInit__peg_parser(void);
 extern PyObject* PyInit__symtable(void);
 extern PyObject* PyInit_xxsubtype(void);
 
@@ -127,7 +124,6 @@
     {"_bisect", PyInit__bisect},
     {"_heapq", PyInit__heapq},
     {"_pickle", PyInit__pickle},
-    {"atexit", PyInit_atexit},
     {"_json", PyInit__json},
     {"_lsprof", PyInit__lsprof},
     {"unicodedata", PyInit_unicodedata},
@@ -140,7 +136,6 @@
     {"pwd", PyInit_pwd},
     {"grp", PyInit_grp},
     {"select", PyInit_select},
-    {"parser", PyInit_parser},
     {"mmap", PyInit_mmap},
     {"syslog", PyInit_syslog},
     {"_xxsubinterpreters", PyInit__xxsubinterpreters},
@@ -188,7 +183,6 @@
     {"_io", PyInit__io},
     {"faulthandler", PyInit_faulthandler},
     {"_tracemalloc", PyInit__tracemalloc},
-    {"_peg_parser", PyInit__peg_parser},
     {"_symtable", PyInit__symtable},
     {"xxsubtype", PyInit_xxsubtype},
 
diff --git a/android/linux_x86_64/pyconfig/pyconfig.h b/android/linux_x86_64/pyconfig/pyconfig.h
index c97c280..9ea733b 100644
--- a/android/linux_x86_64/pyconfig/pyconfig.h
+++ b/android/linux_x86_64/pyconfig/pyconfig.h
@@ -17,6 +17,12 @@
    support for AIX C++ shared extension modules. */
 /* #undef AIX_GENUINE_CPLUSPLUS */
 
+/* The normal alignment of `long', in bytes. */
+#define ALIGNOF_LONG 8
+
+/* The normal alignment of `size_t', in bytes. */
+#define ALIGNOF_SIZE_T 8
+
 /* Alternative SOABI used in debug build to load C extensions built in release
    mode */
 /* #undef ALT_SOABI */
@@ -39,6 +45,9 @@
 /* Define if --enable-ipv6 is specified */
 #define ENABLE_IPV6 1
 
+/* Better isolate subinterpreters, experimental build mode. */
+/* #undef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS */
+
 /* Define to 1 if your system stores words within floats with the most
    significant word first */
 /* #undef FLOAT_WORDS_BIGENDIAN */
@@ -113,7 +122,7 @@
 /* Define if `unsetenv` does not return an int. */
 /* #undef HAVE_BROKEN_UNSETENV */
 
-/* Has builtin atomics */
+/* Has builtin __atomic_load_n() and __atomic_store_n() functions */
 #define HAVE_BUILTIN_ATOMIC 1
 
 /* Define to 1 if you have the 'chflags' function. */
@@ -137,6 +146,9 @@
 /* Define to 1 if you have the `clock_settime' function. */
 #define HAVE_CLOCK_SETTIME 1
 
+/* Define to 1 if you have the `close_range' function. */
+/* #undef HAVE_CLOSE_RANGE */
+
 /* Define if the C compiler supports computed gotos. */
 #define HAVE_COMPUTED_GOTOS 1
 
@@ -215,7 +227,6 @@
 /* Define to 1 if you have the declaration of `RTLD_DEEPBIND', and to 0 if you
    don't. */
 #ifdef __GLIBC__
-// musl doesn't have RTLD_DEEPBIND
 #define HAVE_DECL_RTLD_DEEPBIND 1
 #endif
 
@@ -285,6 +296,9 @@
 /* Define to 1 if you have the `dup3' function. */
 #define HAVE_DUP3 1
 
+/* Define if you have the '_dyld_shared_cache_contains_path' function. */
+/* #undef HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH */
+
 /* Defined when any dynamic module loading is enabled. */
 #define HAVE_DYNAMIC_LOADING 1
 
@@ -306,6 +320,9 @@
 /* Define to 1 if you have the <errno.h> header file. */
 #define HAVE_ERRNO_H 1
 
+/* Define if you have the 'eventfd' function. */
+#define HAVE_EVENTFD 1
+
 /* Define to 1 if you have the `execv' function. */
 #define HAVE_EXECV 1
 
@@ -602,7 +619,7 @@
 /* Define to 1 if you have the <libintl.h> header file. */
 #define HAVE_LIBINTL_H 1
 
-/* Define if you have the readline library (-lreadline). */
+/* Define to build the readline module. */
 /* #undef HAVE_LIBREADLINE */
 
 /* Define to 1 if you have the `resolv' library (-lresolv). */
@@ -614,12 +631,18 @@
 /* Define to 1 if you have the <libutil.h> header file. */
 /* #undef HAVE_LIBUTIL_H */
 
+/* Define to 1 if you have the `uuid' library (-luuid). */
+/* #undef HAVE_LIBUUID */
+
 /* Define if you have the 'link' function. */
 #define HAVE_LINK 1
 
 /* Define to 1 if you have the `linkat' function. */
 #define HAVE_LINKAT 1
 
+/* Define to 1 if you have the <linux/auxvec.h> header file. */
+#define HAVE_LINUX_AUXVEC_H 1
+
 /* Define to 1 if you have the <linux/can/bcm.h> header file. */
 #define HAVE_LINUX_CAN_BCM_H 1
 
@@ -734,6 +757,10 @@
 /* Define to 1 if you have the `nice' function. */
 #define HAVE_NICE 1
 
+/* Define if the internal form of wchar_t in non-Unicode locales is not
+   Unicode. */
+/* #undef HAVE_NON_UNICODE_WCHAR_T_REPRESENTATION */
+
 /* Define to 1 if you have the `openat' function. */
 #define HAVE_OPENAT 1
 
@@ -782,9 +809,6 @@
 /* Define if you have the 'prlimit' functions. */
 #define HAVE_PRLIMIT 1
 
-/* Define if you have the '_dyld_shared_cache_contains_path' function. */
-/* #undef HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH */
-
 /* Define to 1 if you have the <process.h> header file. */
 /* #undef HAVE_PROCESS_H */
 
@@ -843,10 +867,10 @@
 /* #undef HAVE_RL_APPEND_HISTORY */
 
 /* Define if you can turn off readline's signal handling. */
-#define HAVE_RL_CATCH_SIGNAL 1
+/* #undef HAVE_RL_CATCH_SIGNAL */
 
 /* Define if you have readline 2.2 */
-#define HAVE_RL_COMPLETION_APPEND_CHARACTER 1
+/* #undef HAVE_RL_COMPLETION_APPEND_CHARACTER */
 
 /* Define if you have readline 4.0 */
 /* #undef HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK */
@@ -855,7 +879,7 @@
 /* #undef HAVE_RL_COMPLETION_MATCHES */
 
 /* Define if you have rl_completion_suppress_append */
-#define HAVE_RL_COMPLETION_SUPPRESS_APPEND 1
+/* #undef HAVE_RL_COMPLETION_SUPPRESS_APPEND */
 
 /* Define if you have readline 4.0 */
 /* #undef HAVE_RL_PRE_INPUT_HOOK */
@@ -887,6 +911,9 @@
 /* Define to 1 if you have the `sched_setscheduler' function. */
 #define HAVE_SCHED_SETSCHEDULER 1
 
+/* Define to 1 if you have the `sem_clockwait' function. */
+/* #undef HAVE_SEM_CLOCKWAIT */
+
 /* Define to 1 if you have the `sem_getvalue' function. */
 #define HAVE_SEM_GETVALUE 1
 
@@ -1013,6 +1040,9 @@
 /* Define to 1 if you have the <spawn.h> header file. */
 #define HAVE_SPAWN_H 1
 
+/* Define to 1 if you have the `splice' function. */
+#define HAVE_SPLICE 1
+
 /* Define if your compiler provides ssize_t */
 #define HAVE_SSIZE_T 1
 
@@ -1038,9 +1068,6 @@
 /* Has stdatomic.h with atomic_int and atomic_uintptr_t */
 #define HAVE_STD_ATOMIC 1
 
-/* Define to 1 if you have the `strdup' function. */
-#define HAVE_STRDUP 1
-
 /* Define to 1 if you have the `strftime' function. */
 #define HAVE_STRFTIME 1
 
@@ -1120,6 +1147,9 @@
 /* Define to 1 if you have the <sys/epoll.h> header file. */
 #define HAVE_SYS_EPOLL_H 1
 
+/* Define to 1 if you have the <sys/eventfd.h> header file. */
+#define HAVE_SYS_EVENTFD_H 1
+
 /* Define to 1 if you have the <sys/event.h> header file. */
 /* #undef HAVE_SYS_EVENT_H */
 
@@ -1305,6 +1335,9 @@
 /* Define to 1 if you have the <uuid/uuid.h> header file. */
 /* #undef HAVE_UUID_UUID_H */
 
+/* Define to 1 if you have the `vfork' function. */
+#define HAVE_VFORK 1
+
 /* Define to 1 if you have the `wait3' function. */
 #define HAVE_WAIT3 1
 
@@ -1339,9 +1372,6 @@
 /* Define to 1 if you have the `writev' function. */
 #define HAVE_WRITEV 1
 
-/* Define if libssl has X509_VERIFY_PARAM_set1_host and related function */
-/* #undef HAVE_X509_VERIFY_PARAM_SET1_HOST */
-
 /* Define if the zlib library has inflateCopy */
 #define HAVE_ZLIB_COPY 1
 
@@ -1491,6 +1521,9 @@
    (which you can't on SCO ODT 3.0). */
 #define SYS_SELECT_WITH_SYS_TIME 1
 
+/* Custom thread stack size depending on chosen sanitizer runtimes. */
+/* #undef THREAD_STACK_SIZE */
+
 /* Library needed by timemodule.c: librt may be needed for clock_gettime() */
 /* #undef TIMEMODULE_LIB */
 
@@ -1543,6 +1576,9 @@
    Dyld is necessary to support frameworks. */
 /* #undef WITH_DYLD */
 
+/* Define to build the readline module against Editline. */
+/* #undef WITH_EDITLINE */
+
 /* Define to 1 if libintl is needed for locale functions. */
 /* #undef WITH_LIBINTL */
 
@@ -1626,11 +1662,6 @@
 /* Define on FreeBSD to activate all library features */
 #define __BSD_VISIBLE 1
 
-/* Define to 1 if type `char' is unsigned and you are not using gcc.  */
-#ifndef __CHAR_UNSIGNED__
-/* # undef __CHAR_UNSIGNED__ */
-#endif
-
 /* Define to 'long' if <time.h> doesn't define. */
 /* #undef clock_t */
 
diff --git a/android/regen.sh b/android/regen.sh
index 1c0e235..ea04076 100755
--- a/android/regen.sh
+++ b/android/regen.sh
@@ -24,8 +24,10 @@
 mkdir -p $DIR/pyconfig
 cd $DIR
 
+export CLANG_VERSION=$(cd $ANDROID_BUILD_TOP; build/soong/scripts/get_clang_version.py)
+
 if [ $DIR == "linux_x86_64" ]; then
-  export CC="$ANDROID_BUILD_TOP/prebuilts/clang/host/linux-x86/clang-r399163b/bin/clang"
+  export CC="$ANDROID_BUILD_TOP/prebuilts/clang/host/linux-x86/$CLANG_VERSION/bin/clang"
   export CFLAGS="--sysroot=$ANDROID_BUILD_TOP/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/sysroot"
   export LDFLAGS="--sysroot=$ANDROID_BUILD_TOP/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/sysroot -B$ANDROID_BUILD_TOP/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/lib/gcc/x86_64-linux/4.8.3 -L$ANDROID_BUILD_TOP/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/lib/gcc/x86_64-linux/4.8.3 -L$ANDROID_BUILD_TOP/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/x86_64-linux/lib64"
 fi
@@ -39,20 +41,11 @@
 ../../../configure
 
 if [ $DIR == "darwin_x86_64" ]; then
-  # getentropy is not safe on <10.12, which we still target
-  sed -ibak "s%#define HAVE_GETENTROPY 1%/* #undef HAVE_GETENTROPY */%" pyconfig.h
-  # utimensat and futimens are not safe on <10.13, which we still target
-  sed -ibak "s%#define HAVE_UTIMENSAT 1%/* #undef HAVE_UTIMENSAT */%" pyconfig.h
-  sed -ibak "s%#define HAVE_FUTIMENS 1%/* #undef HAVE_FUTIMENS */%" pyconfig.h
   # preadv and pwritev are not safe on <11, which we still target
   sed -ibak "s%#define HAVE_PREADV 1%/* #undef HAVE_PREADV */%" pyconfig.h
   sed -ibak "s%#define HAVE_PWRITEV 1%/* #undef HAVE_PWRITEV */%" pyconfig.h
-  # _dyld_shared_cache_contains_path is not safe on <11, which we still target
-  sed -ibak "s%#define HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH 1%/* #undef HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH */%" pyconfig.h
 fi
 
-cp pyconfig.h ../pyconfig/
-
 if [ $DIR == "linux_x86_64" ]; then
   mkdir -p ../../bionic/pyconfig
   cp pyconfig.h ../../bionic/pyconfig/
@@ -75,8 +68,13 @@
   sed -i 's%#define SIZEOF_TIME_T .*%#define SIZEOF_TIME_T SIZEOF_LONG%' $bionic_pyconfig
   sed -i 's%#define SIZEOF_UINTPTR_T .*%#define SIZEOF_UINTPTR_T SIZEOF_LONG%' $bionic_pyconfig
   sed -i 's%#define SIZEOF_VOID_P .*%#define SIZEOF_VOID_P SIZEOF_LONG%' $bionic_pyconfig
+
+  # Changes to support musl
+  sed -i "s%#define HAVE_DECL_RTLD_DEEPBIND 1%#ifdef __GLIBC__\n#define HAVE_DECL_RTLD_DEEPBIND 1\n#endif%" pyconfig.h
 fi
 
+cp pyconfig.h ../pyconfig/
+
 function generate_srcs() {
   #
   # Generate config.c
diff --git a/config.guess b/config.guess
index 256083a..e81d3ae 100755
--- a/config.guess
+++ b/config.guess
@@ -1,8 +1,10 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright 1992-2018 Free Software Foundation, Inc.
+#   Copyright 1992-2021 Free Software Foundation, Inc.
 
-timestamp='2018-03-08'
+# shellcheck disable=SC2006,SC2268 # see below for rationale
+
+timestamp='2021-06-03'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -27,11 +29,19 @@
 # Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
 #
 # You can get the latest version of this script from:
-# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
+# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
 #
 # Please send patches to <config-patches@gnu.org>.
 
 
+# The "shellcheck disable" line above the timestamp inhibits complaints
+# about features and limitations of the classic Bourne shell that were
+# superseded or lifted in POSIX.  However, this script identifies a wide
+# variety of pre-POSIX systems that do not have POSIX shells at all, and
+# even some reasonably current systems (Solaris 10 as case-in-point) still
+# have a pre-POSIX /bin/sh.
+
+
 me=`echo "$0" | sed -e 's,.*/,,'`
 
 usage="\
@@ -50,7 +60,7 @@
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright 1992-2018 Free Software Foundation, Inc.
+Copyright 1992-2021 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -84,7 +94,8 @@
   exit 1
 fi
 
-trap 'exit 1' 1 2 15
+# Just in case it came from the environment.
+GUESS=
 
 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a
 # compiler to aid in system detection is discouraged as it requires
@@ -96,73 +107,90 @@
 
 # Portable tmp directory creation inspired by the Autoconf team.
 
-set_cc_for_build='
-trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
-trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
-: ${TMPDIR=/tmp} ;
- { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
- { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
- { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
- { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
-dummy=$tmp/dummy ;
-tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
-case $CC_FOR_BUILD,$HOST_CC,$CC in
- ,,)    echo "int x;" > "$dummy.c" ;
-	for c in cc gcc c89 c99 ; do
-	  if ($c -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
-	     CC_FOR_BUILD="$c"; break ;
-	  fi ;
-	done ;
-	if test x"$CC_FOR_BUILD" = x ; then
-	  CC_FOR_BUILD=no_compiler_found ;
-	fi
-	;;
- ,,*)   CC_FOR_BUILD=$CC ;;
- ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
-esac ; set_cc_for_build= ;'
+tmp=
+# shellcheck disable=SC2172
+trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
+
+set_cc_for_build() {
+    # prevent multiple calls if $tmp is already set
+    test "$tmp" && return 0
+    : "${TMPDIR=/tmp}"
+    # shellcheck disable=SC2039,SC3028
+    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
+	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
+    dummy=$tmp/dummy
+    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
+	,,)    echo "int x;" > "$dummy.c"
+	       for driver in cc gcc c89 c99 ; do
+		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
+		       CC_FOR_BUILD=$driver
+		       break
+		   fi
+	       done
+	       if test x"$CC_FOR_BUILD" = x ; then
+		   CC_FOR_BUILD=no_compiler_found
+	       fi
+	       ;;
+	,,*)   CC_FOR_BUILD=$CC ;;
+	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+    esac
+}
 
 # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
 # (ghazi@noc.rutgers.edu 1994-08-24)
-if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+if test -f /.attbin/uname ; then
 	PATH=$PATH:/.attbin ; export PATH
 fi
 
 UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
 UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
 
-case "$UNAME_SYSTEM" in
+case $UNAME_SYSTEM in
 Linux|GNU|GNU/*)
-	# If the system lacks a compiler, then just pick glibc.
-	# We could probably try harder.
-	LIBC=gnu
+	LIBC=unknown
 
-	eval "$set_cc_for_build"
+	set_cc_for_build
 	cat <<-EOF > "$dummy.c"
 	#include <features.h>
 	#if defined(__UCLIBC__)
 	LIBC=uclibc
 	#elif defined(__dietlibc__)
 	LIBC=dietlibc
-	#else
+	#elif defined(__GLIBC__)
 	LIBC=gnu
+	#else
+	#include <stdarg.h>
+	/* First heuristic to detect musl libc.  */
+	#ifdef __DEFINED_va_list
+	LIBC=musl
+	#endif
 	#endif
 	EOF
-	eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`"
+	cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
+	eval "$cc_set_libc"
 
-	# If ldd exists, use it to detect musl libc.
-	if command -v ldd >/dev/null && \
-		ldd --version 2>&1 | grep -q ^musl
-	then
-	    LIBC=musl
+	# Second heuristic to detect musl libc.
+	if [ "$LIBC" = unknown ] &&
+	   command -v ldd >/dev/null &&
+	   ldd --version 2>&1 | grep -q ^musl; then
+		LIBC=musl
+	fi
+
+	# If the system lacks a compiler, then just pick glibc.
+	# We could probably try harder.
+	if [ "$LIBC" = unknown ]; then
+		LIBC=gnu
 	fi
 	;;
 esac
 
 # Note: order is significant - the case branches are not exclusive.
 
-case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
+case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
     *:NetBSD:*:*)
 	# NetBSD (nbsd) targets should (where applicable) match one or
 	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
@@ -174,12 +202,12 @@
 	#
 	# Note: NetBSD doesn't particularly care about the vendor
 	# portion of the name.  We always set it to "unknown".
-	sysctl="sysctl -n hw.machine_arch"
 	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
-	    "/sbin/$sysctl" 2>/dev/null || \
-	    "/usr/sbin/$sysctl" 2>/dev/null || \
+	    /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
+	    /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
 	    echo unknown)`
-	case "$UNAME_MACHINE_ARCH" in
+	case $UNAME_MACHINE_ARCH in
+	    aarch64eb) machine=aarch64_be-unknown ;;
 	    armeb) machine=armeb-unknown ;;
 	    arm*) machine=arm-unknown ;;
 	    sh3el) machine=shl-unknown ;;
@@ -188,18 +216,18 @@
 	    earmv*)
 		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
 		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
-		machine="${arch}${endian}"-unknown
+		machine=${arch}${endian}-unknown
 		;;
-	    *) machine="$UNAME_MACHINE_ARCH"-unknown ;;
+	    *) machine=$UNAME_MACHINE_ARCH-unknown ;;
 	esac
 	# The Operating System including object format, if it has switched
 	# to ELF recently (or will in the future) and ABI.
-	case "$UNAME_MACHINE_ARCH" in
+	case $UNAME_MACHINE_ARCH in
 	    earm*)
 		os=netbsdelf
 		;;
 	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
-		eval "$set_cc_for_build"
+		set_cc_for_build
 		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
 			| grep -q __ELF__
 		then
@@ -215,7 +243,7 @@
 		;;
 	esac
 	# Determine ABI tags.
-	case "$UNAME_MACHINE_ARCH" in
+	case $UNAME_MACHINE_ARCH in
 	    earm*)
 		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
 		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
@@ -226,7 +254,7 @@
 	# thus, need a distinct triplet. However, they do not need
 	# kernel version information, so it can be replaced with a
 	# suitable tag, in the style of linux-gnu.
-	case "$UNAME_VERSION" in
+	case $UNAME_VERSION in
 	    Debian*)
 		release='-gnu'
 		;;
@@ -237,45 +265,57 @@
 	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
 	# contains redundant information, the shorter form:
 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
-	echo "$machine-${os}${release}${abi}"
-	exit ;;
+	GUESS=$machine-${os}${release}${abi-}
+	;;
     *:Bitrig:*:*)
 	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
-	echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
+	;;
     *:OpenBSD:*:*)
 	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
-	echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
+	;;
+    *:SecBSD:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
+	GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
+	;;
     *:LibertyBSD:*:*)
 	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
-	echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
+	;;
     *:MidnightBSD:*:*)
-	echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
+	;;
     *:ekkoBSD:*:*)
-	echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
+	;;
     *:SolidBSD:*:*)
-	echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
+	;;
+    *:OS108:*:*)
+	GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
+	;;
     macppc:MirBSD:*:*)
-	echo powerpc-unknown-mirbsd"$UNAME_RELEASE"
-	exit ;;
+	GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
+	;;
     *:MirBSD:*:*)
-	echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
+	;;
     *:Sortix:*:*)
-	echo "$UNAME_MACHINE"-unknown-sortix
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-sortix
+	;;
+    *:Twizzler:*:*)
+	GUESS=$UNAME_MACHINE-unknown-twizzler
+	;;
     *:Redox:*:*)
-	echo "$UNAME_MACHINE"-unknown-redox
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-redox
+	;;
     mips:OSF1:*.*)
-        echo mips-dec-osf1
-        exit ;;
+	GUESS=mips-dec-osf1
+	;;
     alpha:OSF1:*:*)
+	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
+	trap '' 0
 	case $UNAME_RELEASE in
 	*4.0)
 		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
@@ -289,7 +329,7 @@
 	# covers most systems running today.  This code pipes the CPU
 	# types through head -n 1, so we only detect the type of CPU 0.
 	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
-	case "$ALPHA_CPU_TYPE" in
+	case $ALPHA_CPU_TYPE in
 	    "EV4 (21064)")
 		UNAME_MACHINE=alpha ;;
 	    "EV4.5 (21064)")
@@ -326,75 +366,76 @@
 	# A Tn.n version is a released field test version.
 	# A Xn.n version is an unreleased experimental baselevel.
 	# 1.2 uses "1.2" for uname -r.
-	echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`"
-	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
-	exitcode=$?
-	trap '' 0
-	exit $exitcode ;;
+	OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
+	GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
+	;;
     Amiga*:UNIX_System_V:4.0:*)
-	echo m68k-unknown-sysv4
-	exit ;;
+	GUESS=m68k-unknown-sysv4
+	;;
     *:[Aa]miga[Oo][Ss]:*:*)
-	echo "$UNAME_MACHINE"-unknown-amigaos
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-amigaos
+	;;
     *:[Mm]orph[Oo][Ss]:*:*)
-	echo "$UNAME_MACHINE"-unknown-morphos
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-morphos
+	;;
     *:OS/390:*:*)
-	echo i370-ibm-openedition
-	exit ;;
+	GUESS=i370-ibm-openedition
+	;;
     *:z/VM:*:*)
-	echo s390-ibm-zvmoe
-	exit ;;
+	GUESS=s390-ibm-zvmoe
+	;;
     *:OS400:*:*)
-	echo powerpc-ibm-os400
-	exit ;;
+	GUESS=powerpc-ibm-os400
+	;;
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
-	echo arm-acorn-riscix"$UNAME_RELEASE"
-	exit ;;
+	GUESS=arm-acorn-riscix$UNAME_RELEASE
+	;;
     arm*:riscos:*:*|arm*:RISCOS:*:*)
-	echo arm-unknown-riscos
-	exit ;;
+	GUESS=arm-unknown-riscos
+	;;
     SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
-	echo hppa1.1-hitachi-hiuxmpp
-	exit ;;
+	GUESS=hppa1.1-hitachi-hiuxmpp
+	;;
     Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
 	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
-	if test "`(/bin/universe) 2>/dev/null`" = att ; then
-		echo pyramid-pyramid-sysv3
-	else
-		echo pyramid-pyramid-bsd
-	fi
-	exit ;;
+	case `(/bin/universe) 2>/dev/null` in
+	    att) GUESS=pyramid-pyramid-sysv3 ;;
+	    *)   GUESS=pyramid-pyramid-bsd   ;;
+	esac
+	;;
     NILE*:*:*:dcosx)
-	echo pyramid-pyramid-svr4
-	exit ;;
+	GUESS=pyramid-pyramid-svr4
+	;;
     DRS?6000:unix:4.0:6*)
-	echo sparc-icl-nx6
-	exit ;;
+	GUESS=sparc-icl-nx6
+	;;
     DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
 	case `/usr/bin/uname -p` in
-	    sparc) echo sparc-icl-nx7; exit ;;
-	esac ;;
+	    sparc) GUESS=sparc-icl-nx7 ;;
+	esac
+	;;
     s390x:SunOS:*:*)
-	echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
-	exit ;;
+	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+	GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
+	;;
     sun4H:SunOS:5.*:*)
-	echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
-	exit ;;
+	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+	GUESS=sparc-hal-solaris2$SUN_REL
+	;;
     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
-	echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
-	exit ;;
+	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+	GUESS=sparc-sun-solaris2$SUN_REL
+	;;
     i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
-	echo i386-pc-auroraux"$UNAME_RELEASE"
-	exit ;;
+	GUESS=i386-pc-auroraux$UNAME_RELEASE
+	;;
     i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
-	eval "$set_cc_for_build"
+	set_cc_for_build
 	SUN_ARCH=i386
 	# If there is a compiler, see if it is configured for 64-bit objects.
 	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
 	# This test works for both compilers.
-	if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
+	if test "$CC_FOR_BUILD" != no_compiler_found; then
 	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
 		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
 		grep IS_64BIT_ARCH >/dev/null
@@ -402,41 +443,44 @@
 		SUN_ARCH=x86_64
 	    fi
 	fi
-	echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
-	exit ;;
+	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+	GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
+	;;
     sun4*:SunOS:6*:*)
 	# According to config.sub, this is the proper way to canonicalize
 	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
 	# it's likely to be more like Solaris than SunOS4.
-	echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
-	exit ;;
+	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+	GUESS=sparc-sun-solaris3$SUN_REL
+	;;
     sun4*:SunOS:*:*)
-	case "`/usr/bin/arch -k`" in
+	case `/usr/bin/arch -k` in
 	    Series*|S4*)
 		UNAME_RELEASE=`uname -v`
 		;;
 	esac
 	# Japanese Language versions have a version number like `4.1.3-JL'.
-	echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`"
-	exit ;;
+	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
+	GUESS=sparc-sun-sunos$SUN_REL
+	;;
     sun3*:SunOS:*:*)
-	echo m68k-sun-sunos"$UNAME_RELEASE"
-	exit ;;
+	GUESS=m68k-sun-sunos$UNAME_RELEASE
+	;;
     sun*:*:4.2BSD:*)
 	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
 	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
-	case "`/bin/arch`" in
+	case `/bin/arch` in
 	    sun3)
-		echo m68k-sun-sunos"$UNAME_RELEASE"
+		GUESS=m68k-sun-sunos$UNAME_RELEASE
 		;;
 	    sun4)
-		echo sparc-sun-sunos"$UNAME_RELEASE"
+		GUESS=sparc-sun-sunos$UNAME_RELEASE
 		;;
 	esac
-	exit ;;
+	;;
     aushp:SunOS:*:*)
-	echo sparc-auspex-sunos"$UNAME_RELEASE"
-	exit ;;
+	GUESS=sparc-auspex-sunos$UNAME_RELEASE
+	;;
     # The situation for MiNT is a little confusing.  The machine name
     # can be virtually everything (everything which is not
     # "atarist" or "atariste" at least should have a processor
@@ -446,43 +490,43 @@
     # MiNT.  But MiNT is downward compatible to TOS, so this should
     # be no problem.
     atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
-	echo m68k-atari-mint"$UNAME_RELEASE"
-	exit ;;
+	GUESS=m68k-atari-mint$UNAME_RELEASE
+	;;
     atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
-	echo m68k-atari-mint"$UNAME_RELEASE"
-	exit ;;
+	GUESS=m68k-atari-mint$UNAME_RELEASE
+	;;
     *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
-	echo m68k-atari-mint"$UNAME_RELEASE"
-	exit ;;
+	GUESS=m68k-atari-mint$UNAME_RELEASE
+	;;
     milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
-	echo m68k-milan-mint"$UNAME_RELEASE"
-	exit ;;
+	GUESS=m68k-milan-mint$UNAME_RELEASE
+	;;
     hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
-	echo m68k-hades-mint"$UNAME_RELEASE"
-	exit ;;
+	GUESS=m68k-hades-mint$UNAME_RELEASE
+	;;
     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
-	echo m68k-unknown-mint"$UNAME_RELEASE"
-	exit ;;
+	GUESS=m68k-unknown-mint$UNAME_RELEASE
+	;;
     m68k:machten:*:*)
-	echo m68k-apple-machten"$UNAME_RELEASE"
-	exit ;;
+	GUESS=m68k-apple-machten$UNAME_RELEASE
+	;;
     powerpc:machten:*:*)
-	echo powerpc-apple-machten"$UNAME_RELEASE"
-	exit ;;
+	GUESS=powerpc-apple-machten$UNAME_RELEASE
+	;;
     RISC*:Mach:*:*)
-	echo mips-dec-mach_bsd4.3
-	exit ;;
+	GUESS=mips-dec-mach_bsd4.3
+	;;
     RISC*:ULTRIX:*:*)
-	echo mips-dec-ultrix"$UNAME_RELEASE"
-	exit ;;
+	GUESS=mips-dec-ultrix$UNAME_RELEASE
+	;;
     VAX*:ULTRIX*:*:*)
-	echo vax-dec-ultrix"$UNAME_RELEASE"
-	exit ;;
+	GUESS=vax-dec-ultrix$UNAME_RELEASE
+	;;
     2020:CLIX:*:* | 2430:CLIX:*:*)
-	echo clipper-intergraph-clix"$UNAME_RELEASE"
-	exit ;;
+	GUESS=clipper-intergraph-clix$UNAME_RELEASE
+	;;
     mips:*:*:UMIPS | mips:*:*:RISCos)
-	eval "$set_cc_for_build"
+	set_cc_for_build
 	sed 's/^	//' << EOF > "$dummy.c"
 #ifdef __cplusplus
 #include <stdio.h>  /* for printf() prototype */
@@ -508,78 +552,79 @@
 	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
 	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
 	    { echo "$SYSTEM_NAME"; exit; }
-	echo mips-mips-riscos"$UNAME_RELEASE"
-	exit ;;
+	GUESS=mips-mips-riscos$UNAME_RELEASE
+	;;
     Motorola:PowerMAX_OS:*:*)
-	echo powerpc-motorola-powermax
-	exit ;;
+	GUESS=powerpc-motorola-powermax
+	;;
     Motorola:*:4.3:PL8-*)
-	echo powerpc-harris-powermax
-	exit ;;
+	GUESS=powerpc-harris-powermax
+	;;
     Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
-	echo powerpc-harris-powermax
-	exit ;;
+	GUESS=powerpc-harris-powermax
+	;;
     Night_Hawk:Power_UNIX:*:*)
-	echo powerpc-harris-powerunix
-	exit ;;
+	GUESS=powerpc-harris-powerunix
+	;;
     m88k:CX/UX:7*:*)
-	echo m88k-harris-cxux7
-	exit ;;
+	GUESS=m88k-harris-cxux7
+	;;
     m88k:*:4*:R4*)
-	echo m88k-motorola-sysv4
-	exit ;;
+	GUESS=m88k-motorola-sysv4
+	;;
     m88k:*:3*:R3*)
-	echo m88k-motorola-sysv3
-	exit ;;
+	GUESS=m88k-motorola-sysv3
+	;;
     AViiON:dgux:*:*)
 	# DG/UX returns AViiON for all architectures
 	UNAME_PROCESSOR=`/usr/bin/uname -p`
-	if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ]
+	if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
 	then
-	    if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \
-	       [ "$TARGET_BINARY_INTERFACE"x = x ]
+	    if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
+	       test "$TARGET_BINARY_INTERFACE"x = x
 	    then
-		echo m88k-dg-dgux"$UNAME_RELEASE"
+		GUESS=m88k-dg-dgux$UNAME_RELEASE
 	    else
-		echo m88k-dg-dguxbcs"$UNAME_RELEASE"
+		GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
 	    fi
 	else
-	    echo i586-dg-dgux"$UNAME_RELEASE"
+	    GUESS=i586-dg-dgux$UNAME_RELEASE
 	fi
-	exit ;;
+	;;
     M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
-	echo m88k-dolphin-sysv3
-	exit ;;
+	GUESS=m88k-dolphin-sysv3
+	;;
     M88*:*:R3*:*)
 	# Delta 88k system running SVR3
-	echo m88k-motorola-sysv3
-	exit ;;
+	GUESS=m88k-motorola-sysv3
+	;;
     XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
-	echo m88k-tektronix-sysv3
-	exit ;;
+	GUESS=m88k-tektronix-sysv3
+	;;
     Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
-	echo m68k-tektronix-bsd
-	exit ;;
+	GUESS=m68k-tektronix-bsd
+	;;
     *:IRIX*:*:*)
-	echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`"
-	exit ;;
+	IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
+	GUESS=mips-sgi-irix$IRIX_REL
+	;;
     ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
-	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
-	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
+	GUESS=romp-ibm-aix    # uname -m gives an 8 hex-code CPU id
+	;;                    # Note that: echo "'`uname -s`'" gives 'AIX '
     i*86:AIX:*:*)
-	echo i386-ibm-aix
-	exit ;;
+	GUESS=i386-ibm-aix
+	;;
     ia64:AIX:*:*)
-	if [ -x /usr/bin/oslevel ] ; then
+	if test -x /usr/bin/oslevel ; then
 		IBM_REV=`/usr/bin/oslevel`
 	else
-		IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
+		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
 	fi
-	echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV"
-	exit ;;
+	GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
+	;;
     *:AIX:2:3)
 	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
-		eval "$set_cc_for_build"
+		set_cc_for_build
 		sed 's/^		//' << EOF > "$dummy.c"
 		#include <sys/systemcfg.h>
 
@@ -593,16 +638,16 @@
 EOF
 		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
 		then
-			echo "$SYSTEM_NAME"
+			GUESS=$SYSTEM_NAME
 		else
-			echo rs6000-ibm-aix3.2.5
+			GUESS=rs6000-ibm-aix3.2.5
 		fi
 	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
-		echo rs6000-ibm-aix3.2.4
+		GUESS=rs6000-ibm-aix3.2.4
 	else
-		echo rs6000-ibm-aix3.2
+		GUESS=rs6000-ibm-aix3.2
 	fi
-	exit ;;
+	;;
     *:AIX:*:[4567])
 	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
 	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
@@ -610,57 +655,57 @@
 	else
 		IBM_ARCH=powerpc
 	fi
-	if [ -x /usr/bin/lslpp ] ; then
-		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
+	if test -x /usr/bin/lslpp ; then
+		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
 			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
 	else
-		IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
+		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
 	fi
-	echo "$IBM_ARCH"-ibm-aix"$IBM_REV"
-	exit ;;
+	GUESS=$IBM_ARCH-ibm-aix$IBM_REV
+	;;
     *:AIX:*:*)
-	echo rs6000-ibm-aix
-	exit ;;
+	GUESS=rs6000-ibm-aix
+	;;
     ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
-	echo romp-ibm-bsd4.4
-	exit ;;
+	GUESS=romp-ibm-bsd4.4
+	;;
     ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
-	echo romp-ibm-bsd"$UNAME_RELEASE"   # 4.3 with uname added to
-	exit ;;                             # report: romp-ibm BSD 4.3
+	GUESS=romp-ibm-bsd$UNAME_RELEASE    # 4.3 with uname added to
+	;;                                  # report: romp-ibm BSD 4.3
     *:BOSX:*:*)
-	echo rs6000-bull-bosx
-	exit ;;
+	GUESS=rs6000-bull-bosx
+	;;
     DPX/2?00:B.O.S.:*:*)
-	echo m68k-bull-sysv3
-	exit ;;
+	GUESS=m68k-bull-sysv3
+	;;
     9000/[34]??:4.3bsd:1.*:*)
-	echo m68k-hp-bsd
-	exit ;;
+	GUESS=m68k-hp-bsd
+	;;
     hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
-	echo m68k-hp-bsd4.4
-	exit ;;
+	GUESS=m68k-hp-bsd4.4
+	;;
     9000/[34678]??:HP-UX:*:*)
-	HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
-	case "$UNAME_MACHINE" in
+	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
+	case $UNAME_MACHINE in
 	    9000/31?)            HP_ARCH=m68000 ;;
 	    9000/[34]??)         HP_ARCH=m68k ;;
 	    9000/[678][0-9][0-9])
-		if [ -x /usr/bin/getconf ]; then
+		if test -x /usr/bin/getconf; then
 		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
 		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
-		    case "$sc_cpu_version" in
+		    case $sc_cpu_version in
 		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
 		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
 		      532)                      # CPU_PA_RISC2_0
-			case "$sc_kernel_bits" in
+			case $sc_kernel_bits in
 			  32) HP_ARCH=hppa2.0n ;;
 			  64) HP_ARCH=hppa2.0w ;;
 			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
 			esac ;;
 		    esac
 		fi
-		if [ "$HP_ARCH" = "" ]; then
-		    eval "$set_cc_for_build"
+		if test "$HP_ARCH" = ""; then
+		    set_cc_for_build
 		    sed 's/^		//' << EOF > "$dummy.c"
 
 		#define _HPUX_SOURCE
@@ -698,9 +743,9 @@
 		    test -z "$HP_ARCH" && HP_ARCH=hppa
 		fi ;;
 	esac
-	if [ "$HP_ARCH" = hppa2.0w ]
+	if test "$HP_ARCH" = hppa2.0w
 	then
-	    eval "$set_cc_for_build"
+	    set_cc_for_build
 
 	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
 	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
@@ -719,14 +764,14 @@
 		HP_ARCH=hppa64
 	    fi
 	fi
-	echo "$HP_ARCH"-hp-hpux"$HPUX_REV"
-	exit ;;
+	GUESS=$HP_ARCH-hp-hpux$HPUX_REV
+	;;
     ia64:HP-UX:*:*)
-	HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
-	echo ia64-hp-hpux"$HPUX_REV"
-	exit ;;
+	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
+	GUESS=ia64-hp-hpux$HPUX_REV
+	;;
     3050*:HI-UX:*:*)
-	eval "$set_cc_for_build"
+	set_cc_for_build
 	sed 's/^	//' << EOF > "$dummy.c"
 	#include <unistd.h>
 	int
@@ -754,36 +799,36 @@
 EOF
 	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
 		{ echo "$SYSTEM_NAME"; exit; }
-	echo unknown-hitachi-hiuxwe2
-	exit ;;
+	GUESS=unknown-hitachi-hiuxwe2
+	;;
     9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
-	echo hppa1.1-hp-bsd
-	exit ;;
+	GUESS=hppa1.1-hp-bsd
+	;;
     9000/8??:4.3bsd:*:*)
-	echo hppa1.0-hp-bsd
-	exit ;;
+	GUESS=hppa1.0-hp-bsd
+	;;
     *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
-	echo hppa1.0-hp-mpeix
-	exit ;;
+	GUESS=hppa1.0-hp-mpeix
+	;;
     hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
-	echo hppa1.1-hp-osf
-	exit ;;
+	GUESS=hppa1.1-hp-osf
+	;;
     hp8??:OSF1:*:*)
-	echo hppa1.0-hp-osf
-	exit ;;
+	GUESS=hppa1.0-hp-osf
+	;;
     i*86:OSF1:*:*)
-	if [ -x /usr/sbin/sysversion ] ; then
-	    echo "$UNAME_MACHINE"-unknown-osf1mk
+	if test -x /usr/sbin/sysversion ; then
+	    GUESS=$UNAME_MACHINE-unknown-osf1mk
 	else
-	    echo "$UNAME_MACHINE"-unknown-osf1
+	    GUESS=$UNAME_MACHINE-unknown-osf1
 	fi
-	exit ;;
+	;;
     parisc*:Lites*:*:*)
-	echo hppa1.1-hp-lites
-	exit ;;
+	GUESS=hppa1.1-hp-lites
+	;;
     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
-	echo c1-convex-bsd
-	exit ;;
+	GUESS=c1-convex-bsd
+	;;
     C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
 	if getsysinfo -f scalar_acc
 	then echo c32-convex-bsd
@@ -791,17 +836,18 @@
 	fi
 	exit ;;
     C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
-	echo c34-convex-bsd
-	exit ;;
+	GUESS=c34-convex-bsd
+	;;
     C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
-	echo c38-convex-bsd
-	exit ;;
+	GUESS=c38-convex-bsd
+	;;
     C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
-	echo c4-convex-bsd
-	exit ;;
+	GUESS=c4-convex-bsd
+	;;
     CRAY*Y-MP:*:*:*)
-	echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
-	exit ;;
+	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
+	GUESS=ymp-cray-unicos$CRAY_REL
+	;;
     CRAY*[A-Z]90:*:*:*)
 	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
 	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
@@ -809,103 +855,126 @@
 	      -e 's/\.[^.]*$/.X/'
 	exit ;;
     CRAY*TS:*:*:*)
-	echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
-	exit ;;
+	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
+	GUESS=t90-cray-unicos$CRAY_REL
+	;;
     CRAY*T3E:*:*:*)
-	echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
-	exit ;;
+	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
+	GUESS=alphaev5-cray-unicosmk$CRAY_REL
+	;;
     CRAY*SV1:*:*:*)
-	echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
-	exit ;;
+	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
+	GUESS=sv1-cray-unicos$CRAY_REL
+	;;
     *:UNICOS/mp:*:*)
-	echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
-	exit ;;
+	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
+	GUESS=craynv-cray-unicosmp$CRAY_REL
+	;;
     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
 	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
 	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
 	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
-	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
-	exit ;;
+	GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
+	;;
     5000:UNIX_System_V:4.*:*)
 	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
 	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
-	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
-	exit ;;
+	GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
+	;;
     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
-	echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
+	;;
     sparc*:BSD/OS:*:*)
-	echo sparc-unknown-bsdi"$UNAME_RELEASE"
-	exit ;;
+	GUESS=sparc-unknown-bsdi$UNAME_RELEASE
+	;;
     *:BSD/OS:*:*)
-	echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
+	;;
+    arm:FreeBSD:*:*)
+	UNAME_PROCESSOR=`uname -p`
+	set_cc_for_build
+	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
+	    | grep -q __ARM_PCS_VFP
+	then
+	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
+	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
+	else
+	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
+	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
+	fi
+	;;
     *:FreeBSD:*:*)
 	UNAME_PROCESSOR=`/usr/bin/uname -p`
-	case "$UNAME_PROCESSOR" in
+	case $UNAME_PROCESSOR in
 	    amd64)
 		UNAME_PROCESSOR=x86_64 ;;
 	    i386)
 		UNAME_PROCESSOR=i586 ;;
 	esac
-	echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
-	exit ;;
+	FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
+	GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
+	;;
     i*:CYGWIN*:*)
-	echo "$UNAME_MACHINE"-pc-cygwin
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-cygwin
+	;;
     *:MINGW64*:*)
-	echo "$UNAME_MACHINE"-pc-mingw64
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-mingw64
+	;;
     *:MINGW*:*)
-	echo "$UNAME_MACHINE"-pc-mingw32
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-mingw32
+	;;
     *:MSYS*:*)
-	echo "$UNAME_MACHINE"-pc-msys
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-msys
+	;;
     i*:PW*:*)
-	echo "$UNAME_MACHINE"-pc-pw32
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-pw32
+	;;
     *:Interix*:*)
-	case "$UNAME_MACHINE" in
+	case $UNAME_MACHINE in
 	    x86)
-		echo i586-pc-interix"$UNAME_RELEASE"
-		exit ;;
+		GUESS=i586-pc-interix$UNAME_RELEASE
+		;;
 	    authenticamd | genuineintel | EM64T)
-		echo x86_64-unknown-interix"$UNAME_RELEASE"
-		exit ;;
+		GUESS=x86_64-unknown-interix$UNAME_RELEASE
+		;;
 	    IA64)
-		echo ia64-unknown-interix"$UNAME_RELEASE"
-		exit ;;
+		GUESS=ia64-unknown-interix$UNAME_RELEASE
+		;;
 	esac ;;
     i*:UWIN*:*)
-	echo "$UNAME_MACHINE"-pc-uwin
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-uwin
+	;;
     amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
-	echo x86_64-unknown-cygwin
-	exit ;;
+	GUESS=x86_64-pc-cygwin
+	;;
     prep*:SunOS:5.*:*)
-	echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
-	exit ;;
+	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+	GUESS=powerpcle-unknown-solaris2$SUN_REL
+	;;
     *:GNU:*:*)
 	# the GNU system
-	echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`"
-	exit ;;
+	GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
+	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
+	GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
+	;;
     *:GNU/*:*:*)
 	# other systems with GNU libc and userland
-	echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC"
-	exit ;;
-    i*86:Minix:*:*)
-	echo "$UNAME_MACHINE"-pc-minix
-	exit ;;
+	GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
+	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
+	GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
+	;;
+    *:Minix:*:*)
+	GUESS=$UNAME_MACHINE-unknown-minix
+	;;
     aarch64:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     aarch64_be:Linux:*:*)
 	UNAME_MACHINE=aarch64_be
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     alpha:Linux:*:*)
-	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
 	  EV5)   UNAME_MACHINE=alphaev5 ;;
 	  EV56)  UNAME_MACHINE=alphaev56 ;;
 	  PCA56) UNAME_MACHINE=alphapca56 ;;
@@ -916,183 +985,225 @@
 	esac
 	objdump --private-headers /bin/sh | grep -q ld.so.1
 	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
-    arc:Linux:*:* | arceb:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
+    arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     arm*:Linux:*:*)
-	eval "$set_cc_for_build"
+	set_cc_for_build
 	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
 	    | grep -q __ARM_EABI__
 	then
-	    echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
+	    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
 	else
 	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
 		| grep -q __ARM_PCS_VFP
 	    then
-		echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi
+		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
 	    else
-		echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf
+		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
 	    fi
 	fi
-	exit ;;
+	;;
     avr32*:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     cris:Linux:*:*)
-	echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
+	;;
     crisv32:Linux:*:*)
-	echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
+	;;
     e2k:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     frv:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     hexagon:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     i*86:Linux:*:*)
-	echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-linux-$LIBC
+	;;
     ia64:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     k1om:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
+    loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*)
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     m32r*:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     m68*:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     mips:Linux:*:* | mips64:Linux:*:*)
-	eval "$set_cc_for_build"
+	set_cc_for_build
+	IS_GLIBC=0
+	test x"${LIBC}" = xgnu && IS_GLIBC=1
 	sed 's/^	//' << EOF > "$dummy.c"
 	#undef CPU
-	#undef ${UNAME_MACHINE}
-	#undef ${UNAME_MACHINE}el
+	#undef mips
+	#undef mipsel
+	#undef mips64
+	#undef mips64el
+	#if ${IS_GLIBC} && defined(_ABI64)
+	LIBCABI=gnuabi64
+	#else
+	#if ${IS_GLIBC} && defined(_ABIN32)
+	LIBCABI=gnuabin32
+	#else
+	LIBCABI=${LIBC}
+	#endif
+	#endif
+
+	#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
+	CPU=mipsisa64r6
+	#else
+	#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
+	CPU=mipsisa32r6
+	#else
+	#if defined(__mips64)
+	CPU=mips64
+	#else
+	CPU=mips
+	#endif
+	#endif
+	#endif
+
 	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
-	CPU=${UNAME_MACHINE}el
+	MIPS_ENDIAN=el
 	#else
 	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
-	CPU=${UNAME_MACHINE}
+	MIPS_ENDIAN=
 	#else
-	CPU=
+	MIPS_ENDIAN=
 	#endif
 	#endif
 EOF
-	eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`"
-	test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; }
+	cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
+	eval "$cc_set_vars"
+	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
 	;;
     mips64el:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     openrisc*:Linux:*:*)
-	echo or1k-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=or1k-unknown-linux-$LIBC
+	;;
     or32:Linux:*:* | or1k*:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     padre:Linux:*:*)
-	echo sparc-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=sparc-unknown-linux-$LIBC
+	;;
     parisc64:Linux:*:* | hppa64:Linux:*:*)
-	echo hppa64-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=hppa64-unknown-linux-$LIBC
+	;;
     parisc:Linux:*:* | hppa:Linux:*:*)
 	# Look for CPU level
 	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
-	  PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;;
-	  PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;;
-	  *)    echo hppa-unknown-linux-"$LIBC" ;;
+	  PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
+	  PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
+	  *)    GUESS=hppa-unknown-linux-$LIBC ;;
 	esac
-	exit ;;
+	;;
     ppc64:Linux:*:*)
-	echo powerpc64-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=powerpc64-unknown-linux-$LIBC
+	;;
     ppc:Linux:*:*)
-	echo powerpc-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=powerpc-unknown-linux-$LIBC
+	;;
     ppc64le:Linux:*:*)
-	echo powerpc64le-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=powerpc64le-unknown-linux-$LIBC
+	;;
     ppcle:Linux:*:*)
-	echo powerpcle-unknown-linux-"$LIBC"
-	exit ;;
-    riscv32:Linux:*:* | riscv64:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=powerpcle-unknown-linux-$LIBC
+	;;
+    riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     s390:Linux:*:* | s390x:Linux:*:*)
-	echo "$UNAME_MACHINE"-ibm-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
+	;;
     sh64*:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     sh*:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     sparc:Linux:*:* | sparc64:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     tile*:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     vax:Linux:*:*)
-	echo "$UNAME_MACHINE"-dec-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-dec-linux-$LIBC
+	;;
     x86_64:Linux:*:*)
-	echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
-	exit ;;
+	set_cc_for_build
+	LIBCABI=$LIBC
+	if test "$CC_FOR_BUILD" != no_compiler_found; then
+	    if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
+		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+		grep IS_X32 >/dev/null
+	    then
+		LIBCABI=${LIBC}x32
+	    fi
+	fi
+	GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI
+	;;
     xtensa*:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     i*86:DYNIX/ptx:4*:*)
 	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
 	# earlier versions are messed up and put the nodename in both
 	# sysname and nodename.
-	echo i386-sequent-sysv4
-	exit ;;
+	GUESS=i386-sequent-sysv4
+	;;
     i*86:UNIX_SV:4.2MP:2.*)
 	# Unixware is an offshoot of SVR4, but it has its own version
 	# number series starting with 2...
 	# I am not positive that other SVR4 systems won't match this,
 	# I just have to hope.  -- rms.
 	# Use sysv4.2uw... so that sysv4* matches it.
-	echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION"
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
+	;;
     i*86:OS/2:*:*)
 	# If we were able to find `uname', then EMX Unix compatibility
 	# is probably installed.
-	echo "$UNAME_MACHINE"-pc-os2-emx
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-os2-emx
+	;;
     i*86:XTS-300:*:STOP)
-	echo "$UNAME_MACHINE"-unknown-stop
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-stop
+	;;
     i*86:atheos:*:*)
-	echo "$UNAME_MACHINE"-unknown-atheos
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-atheos
+	;;
     i*86:syllable:*:*)
-	echo "$UNAME_MACHINE"-pc-syllable
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-syllable
+	;;
     i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
-	echo i386-unknown-lynxos"$UNAME_RELEASE"
-	exit ;;
+	GUESS=i386-unknown-lynxos$UNAME_RELEASE
+	;;
     i*86:*DOS:*:*)
-	echo "$UNAME_MACHINE"-pc-msdosdjgpp
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-msdosdjgpp
+	;;
     i*86:*:4.*:*)
 	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
 	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
-		echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL"
+		GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
 	else
-		echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL"
+		GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
 	fi
-	exit ;;
+	;;
     i*86:*:5:[678]*)
 	# UnixWare 7.x, OpenUNIX and OpenServer 6.
 	case `/bin/uname -X | grep "^Machine"` in
@@ -1100,12 +1211,12 @@
 	    *Pentium)	     UNAME_MACHINE=i586 ;;
 	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
 	esac
-	echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+	;;
     i*86:*:3.2:*)
 	if test -f /usr/options/cb.name; then
 		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
-		echo "$UNAME_MACHINE"-pc-isc"$UNAME_REL"
+		GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
 	elif /bin/uname -X 2>/dev/null >/dev/null ; then
 		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
 		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
@@ -1115,11 +1226,11 @@
 			&& UNAME_MACHINE=i686
 		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
 			&& UNAME_MACHINE=i686
-		echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL"
+		GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
 	else
-		echo "$UNAME_MACHINE"-pc-sysv32
+		GUESS=$UNAME_MACHINE-pc-sysv32
 	fi
-	exit ;;
+	;;
     pc:*:*:*)
 	# Left here for compatibility:
 	# uname -m prints for DJGPP always 'pc', but it prints nothing about
@@ -1127,31 +1238,31 @@
 	# Note: whatever this is, it MUST be the same as what config.sub
 	# prints for the "djgpp" host, or else GDB configure will decide that
 	# this is a cross-build.
-	echo i586-pc-msdosdjgpp
-	exit ;;
+	GUESS=i586-pc-msdosdjgpp
+	;;
     Intel:Mach:3*:*)
-	echo i386-pc-mach3
-	exit ;;
+	GUESS=i386-pc-mach3
+	;;
     paragon:*:*:*)
-	echo i860-intel-osf1
-	exit ;;
+	GUESS=i860-intel-osf1
+	;;
     i860:*:4.*:*) # i860-SVR4
 	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
-	  echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4
+	  GUESS=i860-stardent-sysv$UNAME_RELEASE    # Stardent Vistra i860-SVR4
 	else # Add other i860-SVR4 vendors below as they are discovered.
-	  echo i860-unknown-sysv"$UNAME_RELEASE"  # Unknown i860-SVR4
+	  GUESS=i860-unknown-sysv$UNAME_RELEASE     # Unknown i860-SVR4
 	fi
-	exit ;;
+	;;
     mini*:CTIX:SYS*5:*)
 	# "miniframe"
-	echo m68010-convergent-sysv
-	exit ;;
+	GUESS=m68010-convergent-sysv
+	;;
     mc68k:UNIX:SYSTEM5:3.51m)
-	echo m68k-convergent-sysv
-	exit ;;
+	GUESS=m68k-convergent-sysv
+	;;
     M680?0:D-NIX:5.3:*)
-	echo m68k-diab-dnix
-	exit ;;
+	GUESS=m68k-diab-dnix
+	;;
     M68*:*:R3V[5678]*:*)
 	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
     3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
@@ -1176,249 +1287,401 @@
 	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
 	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
     m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
-	echo m68k-unknown-lynxos"$UNAME_RELEASE"
-	exit ;;
+	GUESS=m68k-unknown-lynxos$UNAME_RELEASE
+	;;
     mc68030:UNIX_System_V:4.*:*)
-	echo m68k-atari-sysv4
-	exit ;;
+	GUESS=m68k-atari-sysv4
+	;;
     TSUNAMI:LynxOS:2.*:*)
-	echo sparc-unknown-lynxos"$UNAME_RELEASE"
-	exit ;;
+	GUESS=sparc-unknown-lynxos$UNAME_RELEASE
+	;;
     rs6000:LynxOS:2.*:*)
-	echo rs6000-unknown-lynxos"$UNAME_RELEASE"
-	exit ;;
+	GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
+	;;
     PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
-	echo powerpc-unknown-lynxos"$UNAME_RELEASE"
-	exit ;;
+	GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
+	;;
     SM[BE]S:UNIX_SV:*:*)
-	echo mips-dde-sysv"$UNAME_RELEASE"
-	exit ;;
+	GUESS=mips-dde-sysv$UNAME_RELEASE
+	;;
     RM*:ReliantUNIX-*:*:*)
-	echo mips-sni-sysv4
-	exit ;;
+	GUESS=mips-sni-sysv4
+	;;
     RM*:SINIX-*:*:*)
-	echo mips-sni-sysv4
-	exit ;;
+	GUESS=mips-sni-sysv4
+	;;
     *:SINIX-*:*:*)
 	if uname -p 2>/dev/null >/dev/null ; then
 		UNAME_MACHINE=`(uname -p) 2>/dev/null`
-		echo "$UNAME_MACHINE"-sni-sysv4
+		GUESS=$UNAME_MACHINE-sni-sysv4
 	else
-		echo ns32k-sni-sysv
+		GUESS=ns32k-sni-sysv
 	fi
-	exit ;;
+	;;
     PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
 			# says <Richard.M.Bartel@ccMail.Census.GOV>
-	echo i586-unisys-sysv4
-	exit ;;
+	GUESS=i586-unisys-sysv4
+	;;
     *:UNIX_System_V:4*:FTX*)
 	# From Gerald Hewes <hewes@openmarket.com>.
 	# How about differentiating between stratus architectures? -djm
-	echo hppa1.1-stratus-sysv4
-	exit ;;
+	GUESS=hppa1.1-stratus-sysv4
+	;;
     *:*:*:FTX*)
 	# From seanf@swdc.stratus.com.
-	echo i860-stratus-sysv4
-	exit ;;
+	GUESS=i860-stratus-sysv4
+	;;
     i*86:VOS:*:*)
 	# From Paul.Green@stratus.com.
-	echo "$UNAME_MACHINE"-stratus-vos
-	exit ;;
+	GUESS=$UNAME_MACHINE-stratus-vos
+	;;
     *:VOS:*:*)
 	# From Paul.Green@stratus.com.
-	echo hppa1.1-stratus-vos
-	exit ;;
+	GUESS=hppa1.1-stratus-vos
+	;;
     mc68*:A/UX:*:*)
-	echo m68k-apple-aux"$UNAME_RELEASE"
-	exit ;;
+	GUESS=m68k-apple-aux$UNAME_RELEASE
+	;;
     news*:NEWS-OS:6*:*)
-	echo mips-sony-newsos6
-	exit ;;
+	GUESS=mips-sony-newsos6
+	;;
     R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
-	if [ -d /usr/nec ]; then
-		echo mips-nec-sysv"$UNAME_RELEASE"
+	if test -d /usr/nec; then
+		GUESS=mips-nec-sysv$UNAME_RELEASE
 	else
-		echo mips-unknown-sysv"$UNAME_RELEASE"
+		GUESS=mips-unknown-sysv$UNAME_RELEASE
 	fi
-	exit ;;
+	;;
     BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
-	echo powerpc-be-beos
-	exit ;;
+	GUESS=powerpc-be-beos
+	;;
     BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
-	echo powerpc-apple-beos
-	exit ;;
+	GUESS=powerpc-apple-beos
+	;;
     BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
-	echo i586-pc-beos
-	exit ;;
+	GUESS=i586-pc-beos
+	;;
     BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
-	echo i586-pc-haiku
-	exit ;;
+	GUESS=i586-pc-haiku
+	;;
     x86_64:Haiku:*:*)
-	echo x86_64-unknown-haiku
-	exit ;;
+	GUESS=x86_64-unknown-haiku
+	;;
     SX-4:SUPER-UX:*:*)
-	echo sx4-nec-superux"$UNAME_RELEASE"
-	exit ;;
+	GUESS=sx4-nec-superux$UNAME_RELEASE
+	;;
     SX-5:SUPER-UX:*:*)
-	echo sx5-nec-superux"$UNAME_RELEASE"
-	exit ;;
+	GUESS=sx5-nec-superux$UNAME_RELEASE
+	;;
     SX-6:SUPER-UX:*:*)
-	echo sx6-nec-superux"$UNAME_RELEASE"
-	exit ;;
+	GUESS=sx6-nec-superux$UNAME_RELEASE
+	;;
     SX-7:SUPER-UX:*:*)
-	echo sx7-nec-superux"$UNAME_RELEASE"
-	exit ;;
+	GUESS=sx7-nec-superux$UNAME_RELEASE
+	;;
     SX-8:SUPER-UX:*:*)
-	echo sx8-nec-superux"$UNAME_RELEASE"
-	exit ;;
+	GUESS=sx8-nec-superux$UNAME_RELEASE
+	;;
     SX-8R:SUPER-UX:*:*)
-	echo sx8r-nec-superux"$UNAME_RELEASE"
-	exit ;;
+	GUESS=sx8r-nec-superux$UNAME_RELEASE
+	;;
     SX-ACE:SUPER-UX:*:*)
-	echo sxace-nec-superux"$UNAME_RELEASE"
-	exit ;;
+	GUESS=sxace-nec-superux$UNAME_RELEASE
+	;;
     Power*:Rhapsody:*:*)
-	echo powerpc-apple-rhapsody"$UNAME_RELEASE"
-	exit ;;
+	GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
+	;;
     *:Rhapsody:*:*)
-	echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
+	;;
+    arm64:Darwin:*:*)
+	GUESS=aarch64-apple-darwin$UNAME_RELEASE
+	;;
     *:Darwin:*:*)
-	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
-	eval "$set_cc_for_build"
-	if test "$UNAME_PROCESSOR" = unknown ; then
-	    UNAME_PROCESSOR=powerpc
+	UNAME_PROCESSOR=`uname -p`
+	case $UNAME_PROCESSOR in
+	    unknown) UNAME_PROCESSOR=powerpc ;;
+	esac
+	if command -v xcode-select > /dev/null 2> /dev/null && \
+		! xcode-select --print-path > /dev/null 2> /dev/null ; then
+	    # Avoid executing cc if there is no toolchain installed as
+	    # cc will be a stub that puts up a graphical alert
+	    # prompting the user to install developer tools.
+	    CC_FOR_BUILD=no_compiler_found
+	else
+	    set_cc_for_build
 	fi
-	if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then
-	    if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
-		if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
-		       (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
-		       grep IS_64BIT_ARCH >/dev/null
-		then
-		    case $UNAME_PROCESSOR in
-			i386) UNAME_PROCESSOR=x86_64 ;;
-			powerpc) UNAME_PROCESSOR=powerpc64 ;;
-		    esac
-		fi
-		# On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
-		if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
-		       (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
-		       grep IS_PPC >/dev/null
-		then
-		    UNAME_PROCESSOR=powerpc
-		fi
+	if test "$CC_FOR_BUILD" != no_compiler_found; then
+	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+		   grep IS_64BIT_ARCH >/dev/null
+	    then
+		case $UNAME_PROCESSOR in
+		    i386) UNAME_PROCESSOR=x86_64 ;;
+		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
+		esac
+	    fi
+	    # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
+	    if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
+		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+		   grep IS_PPC >/dev/null
+	    then
+		UNAME_PROCESSOR=powerpc
 	    fi
 	elif test "$UNAME_PROCESSOR" = i386 ; then
-	    # Avoid executing cc on OS X 10.9, as it ships with a stub
-	    # that puts up a graphical alert prompting to install
-	    # developer tools.  Any system running Mac OS X 10.7 or
-	    # later (Darwin 11 and later) is required to have a 64-bit
-	    # processor. This is not true of the ARM version of Darwin
-	    # that Apple uses in portable devices.
-	    UNAME_PROCESSOR=x86_64
+	    # uname -m returns i386 or x86_64
+	    UNAME_PROCESSOR=$UNAME_MACHINE
 	fi
-	echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
+	;;
     *:procnto*:*:* | *:QNX:[0123456789]*:*)
 	UNAME_PROCESSOR=`uname -p`
 	if test "$UNAME_PROCESSOR" = x86; then
 		UNAME_PROCESSOR=i386
 		UNAME_MACHINE=pc
 	fi
-	echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
+	;;
     *:QNX:*:4*)
-	echo i386-pc-qnx
-	exit ;;
+	GUESS=i386-pc-qnx
+	;;
     NEO-*:NONSTOP_KERNEL:*:*)
-	echo neo-tandem-nsk"$UNAME_RELEASE"
-	exit ;;
+	GUESS=neo-tandem-nsk$UNAME_RELEASE
+	;;
     NSE-*:NONSTOP_KERNEL:*:*)
-	echo nse-tandem-nsk"$UNAME_RELEASE"
-	exit ;;
+	GUESS=nse-tandem-nsk$UNAME_RELEASE
+	;;
     NSR-*:NONSTOP_KERNEL:*:*)
-	echo nsr-tandem-nsk"$UNAME_RELEASE"
-	exit ;;
+	GUESS=nsr-tandem-nsk$UNAME_RELEASE
+	;;
     NSV-*:NONSTOP_KERNEL:*:*)
-	echo nsv-tandem-nsk"$UNAME_RELEASE"
-	exit ;;
+	GUESS=nsv-tandem-nsk$UNAME_RELEASE
+	;;
     NSX-*:NONSTOP_KERNEL:*:*)
-	echo nsx-tandem-nsk"$UNAME_RELEASE"
-	exit ;;
+	GUESS=nsx-tandem-nsk$UNAME_RELEASE
+	;;
     *:NonStop-UX:*:*)
-	echo mips-compaq-nonstopux
-	exit ;;
+	GUESS=mips-compaq-nonstopux
+	;;
     BS2000:POSIX*:*:*)
-	echo bs2000-siemens-sysv
-	exit ;;
+	GUESS=bs2000-siemens-sysv
+	;;
     DS/*:UNIX_System_V:*:*)
-	echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
+	;;
     *:Plan9:*:*)
 	# "uname -m" is not consistent, so use $cputype instead. 386
 	# is converted to i386 for consistency with other x86
 	# operating systems.
-	if test "$cputype" = 386; then
+	if test "${cputype-}" = 386; then
 	    UNAME_MACHINE=i386
-	else
-	    UNAME_MACHINE="$cputype"
+	elif test "x${cputype-}" != x; then
+	    UNAME_MACHINE=$cputype
 	fi
-	echo "$UNAME_MACHINE"-unknown-plan9
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-plan9
+	;;
     *:TOPS-10:*:*)
-	echo pdp10-unknown-tops10
-	exit ;;
+	GUESS=pdp10-unknown-tops10
+	;;
     *:TENEX:*:*)
-	echo pdp10-unknown-tenex
-	exit ;;
+	GUESS=pdp10-unknown-tenex
+	;;
     KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
-	echo pdp10-dec-tops20
-	exit ;;
+	GUESS=pdp10-dec-tops20
+	;;
     XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
-	echo pdp10-xkl-tops20
-	exit ;;
+	GUESS=pdp10-xkl-tops20
+	;;
     *:TOPS-20:*:*)
-	echo pdp10-unknown-tops20
-	exit ;;
+	GUESS=pdp10-unknown-tops20
+	;;
     *:ITS:*:*)
-	echo pdp10-unknown-its
-	exit ;;
+	GUESS=pdp10-unknown-its
+	;;
     SEI:*:*:SEIUX)
-	echo mips-sei-seiux"$UNAME_RELEASE"
-	exit ;;
+	GUESS=mips-sei-seiux$UNAME_RELEASE
+	;;
     *:DragonFly:*:*)
-	echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
-	exit ;;
+	DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
+	GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
+	;;
     *:*VMS:*:*)
 	UNAME_MACHINE=`(uname -p) 2>/dev/null`
-	case "$UNAME_MACHINE" in
-	    A*) echo alpha-dec-vms ; exit ;;
-	    I*) echo ia64-dec-vms ; exit ;;
-	    V*) echo vax-dec-vms ; exit ;;
+	case $UNAME_MACHINE in
+	    A*) GUESS=alpha-dec-vms ;;
+	    I*) GUESS=ia64-dec-vms ;;
+	    V*) GUESS=vax-dec-vms ;;
 	esac ;;
     *:XENIX:*:SysV)
-	echo i386-pc-xenix
-	exit ;;
+	GUESS=i386-pc-xenix
+	;;
     i*86:skyos:*:*)
-	echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`"
-	exit ;;
+	SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
+	GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
+	;;
     i*86:rdos:*:*)
-	echo "$UNAME_MACHINE"-pc-rdos
-	exit ;;
-    i*86:AROS:*:*)
-	echo "$UNAME_MACHINE"-pc-aros
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-rdos
+	;;
+    *:AROS:*:*)
+	GUESS=$UNAME_MACHINE-unknown-aros
+	;;
     x86_64:VMkernel:*:*)
-	echo "$UNAME_MACHINE"-unknown-esx
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-esx
+	;;
     amd64:Isilon\ OneFS:*:*)
-	echo x86_64-unknown-onefs
-	exit ;;
+	GUESS=x86_64-unknown-onefs
+	;;
+    *:Unleashed:*:*)
+	GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
+	;;
 esac
 
+# Do we have a guess based on uname results?
+if test "x$GUESS" != x; then
+    echo "$GUESS"
+    exit
+fi
+
+# No uname command or uname output not recognized.
+set_cc_for_build
+cat > "$dummy.c" <<EOF
+#ifdef _SEQUENT_
+#include <sys/types.h>
+#include <sys/utsname.h>
+#endif
+#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
+#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
+#include <signal.h>
+#if defined(_SIZE_T_) || defined(SIGLOST)
+#include <sys/utsname.h>
+#endif
+#endif
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
+     I don't know....  */
+  printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+  printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+  "4"
+#else
+  ""
+#endif
+  ); exit (0);
+#endif
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+  int version;
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+  exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+  printf ("ns32k-encore-mach\n"); exit (0);
+#else
+  printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+  printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+  printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+  printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+  struct utsname un;
+
+  uname(&un);
+  if (strncmp(un.version, "V2", 2) == 0) {
+    printf ("i386-sequent-ptx2\n"); exit (0);
+  }
+  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+    printf ("i386-sequent-ptx1\n"); exit (0);
+  }
+  printf ("i386-sequent-ptx\n"); exit (0);
+#endif
+
+#if defined (vax)
+#if !defined (ultrix)
+#include <sys/param.h>
+#if defined (BSD)
+#if BSD == 43
+  printf ("vax-dec-bsd4.3\n"); exit (0);
+#else
+#if BSD == 199006
+  printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#else
+  printf ("vax-dec-bsd\n"); exit (0);
+#endif
+#endif
+#else
+  printf ("vax-dec-bsd\n"); exit (0);
+#endif
+#else
+#if defined(_SIZE_T_) || defined(SIGLOST)
+  struct utsname un;
+  uname (&un);
+  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
+#else
+  printf ("vax-dec-ultrix\n"); exit (0);
+#endif
+#endif
+#endif
+#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
+#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
+#if defined(_SIZE_T_) || defined(SIGLOST)
+  struct utsname *un;
+  uname (&un);
+  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
+#else
+  printf ("mips-dec-ultrix\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (alliant) && defined (i860)
+  printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+  exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
+	{ echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
+
 echo "$0: unable to guess system type" >&2
 
-case "$UNAME_MACHINE:$UNAME_SYSTEM" in
+case $UNAME_MACHINE:$UNAME_SYSTEM in
     mips:Linux | mips64:Linux)
 	# If we got here on MIPS GNU/Linux, output extra information.
 	cat >&2 <<EOF
@@ -1435,9 +1698,17 @@
 operating system you are using. If your script is old, overwrite *all*
 copies of config.guess and config.sub with the latest versions from:
 
-  https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
+  https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
 and
-  https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
+  https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
+EOF
+
+our_year=`echo $timestamp | sed 's,-.*,,'`
+thisyear=`date +%Y`
+# shellcheck disable=SC2003
+script_age=`expr "$thisyear" - "$our_year"`
+if test "$script_age" -lt 3 ; then
+   cat >&2 <<EOF
 
 If $0 has already been updated, send the following data and any
 information you think might be pertinent to config-patches@gnu.org to
@@ -1465,6 +1736,7 @@
 UNAME_SYSTEM  = "$UNAME_SYSTEM"
 UNAME_VERSION = "$UNAME_VERSION"
 EOF
+fi
 
 exit 1
 
diff --git a/config.sub b/config.sub
index ba37cf9..d74fb6d 100755
--- a/config.sub
+++ b/config.sub
@@ -1,8 +1,10 @@
 #! /bin/sh
 # Configuration validation subroutine script.
-#   Copyright 1992-2018 Free Software Foundation, Inc.
+#   Copyright 1992-2021 Free Software Foundation, Inc.
 
-timestamp='2018-04-24'
+# shellcheck disable=SC2006,SC2268 # see below for rationale
+
+timestamp='2021-08-14'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -33,7 +35,7 @@
 # Otherwise, we print the canonical config type on stdout and succeed.
 
 # You can get the latest version of this script from:
-# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
+# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
 
 # This file is supposed to be the same for all GNU packages
 # and recognize all the CPU types, system types and aliases
@@ -50,6 +52,13 @@
 #	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
 # It is wrong to echo any other type of specification.
 
+# The "shellcheck disable" line above the timestamp inhibits complaints
+# about features and limitations of the classic Bourne shell that were
+# superseded or lifted in POSIX.  However, this script identifies a wide
+# variety of pre-POSIX systems that do not have POSIX shells at all, and
+# even some reasonably current systems (Solaris 10 as case-in-point) still
+# have a pre-POSIX /bin/sh.
+
 me=`echo "$0" | sed -e 's,.*/,,'`
 
 usage="\
@@ -67,7 +76,7 @@
 version="\
 GNU config.sub ($timestamp)
 
-Copyright 1992-2018 Free Software Foundation, Inc.
+Copyright 1992-2021 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -89,7 +98,7 @@
     - )	# Use stdin as input.
        break ;;
     -* )
-       echo "$me: invalid option $1$help"
+       echo "$me: invalid option $1$help" >&2
        exit 1 ;;
 
     *local*)
@@ -110,1227 +119,1181 @@
     exit 1;;
 esac
 
-# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
-# Here we must recognize all the valid KERNEL-OS combinations.
-maybe_os=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
-case $maybe_os in
-  nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
-  linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
-  knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
-  kopensolaris*-gnu* | cloudabi*-eabi* | \
-  storm-chaos* | os2-emx* | rtmk-nova*)
-    os=-$maybe_os
-    basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
-    ;;
-  android-linux)
-    os=-linux-android
-    basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
-    ;;
-  *)
-    basic_machine=`echo "$1" | sed 's/-[^-]*$//'`
-    if [ "$basic_machine" != "$1" ]
-    then os=`echo "$1" | sed 's/.*-/-/'`
-    else os=; fi
-    ;;
-esac
+# Split fields of configuration type
+# shellcheck disable=SC2162
+saved_IFS=$IFS
+IFS="-" read field1 field2 field3 field4 <<EOF
+$1
+EOF
+IFS=$saved_IFS
 
-### Let's recognize common machines as not being operating systems so
-### that things like config.sub decstation-3100 work.  We also
-### recognize some manufacturers as not being operating systems, so we
-### can provide default operating systems below.
-case $os in
-	-sun*os*)
-		# Prevent following clause from handling this invalid input.
+# Separate into logical components for further validation
+case $1 in
+	*-*-*-*-*)
+		echo Invalid configuration \`"$1"\': more than four components >&2
+		exit 1
 		;;
-	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
-	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
-	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
-	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-	-apple | -axis | -knuth | -cray | -microblaze*)
-		os=
-		basic_machine=$1
+	*-*-*-*)
+		basic_machine=$field1-$field2
+		basic_os=$field3-$field4
 		;;
-	-bluegene*)
-		os=-cnk
+	*-*-*)
+		# Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two
+		# parts
+		maybe_os=$field2-$field3
+		case $maybe_os in
+			nto-qnx* | linux-* | uclinux-uclibc* \
+			| uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \
+			| netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
+			| storm-chaos* | os2-emx* | rtmk-nova*)
+				basic_machine=$field1
+				basic_os=$maybe_os
+				;;
+			android-linux)
+				basic_machine=$field1-unknown
+				basic_os=linux-android
+				;;
+			*)
+				basic_machine=$field1-$field2
+				basic_os=$field3
+				;;
+		esac
 		;;
-	-sim | -cisco | -oki | -wec | -winbond)
-		os=
-		basic_machine=$1
+	*-*)
+		# A lone config we happen to match not fitting any pattern
+		case $field1-$field2 in
+			decstation-3100)
+				basic_machine=mips-dec
+				basic_os=
+				;;
+			*-*)
+				# Second component is usually, but not always the OS
+				case $field2 in
+					# Prevent following clause from handling this valid os
+					sun*os*)
+						basic_machine=$field1
+						basic_os=$field2
+						;;
+					zephyr*)
+						basic_machine=$field1-unknown
+						basic_os=$field2
+						;;
+					# Manufacturers
+					dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \
+					| att* | 7300* | 3300* | delta* | motorola* | sun[234]* \
+					| unicom* | ibm* | next | hp | isi* | apollo | altos* \
+					| convergent* | ncr* | news | 32* | 3600* | 3100* \
+					| hitachi* | c[123]* | convex* | sun | crds | omron* | dg \
+					| ultra | tti* | harris | dolphin | highlevel | gould \
+					| cbm | ns | masscomp | apple | axis | knuth | cray \
+					| microblaze* | sim | cisco \
+					| oki | wec | wrs | winbond)
+						basic_machine=$field1-$field2
+						basic_os=
+						;;
+					*)
+						basic_machine=$field1
+						basic_os=$field2
+						;;
+				esac
+			;;
+		esac
 		;;
-	-scout)
-		;;
-	-wrs)
-		os=-vxworks
-		basic_machine=$1
-		;;
-	-chorusos*)
-		os=-chorusos
-		basic_machine=$1
-		;;
-	-chorusrdb)
-		os=-chorusrdb
-		basic_machine=$1
-		;;
-	-hiux*)
-		os=-hiuxwe2
-		;;
-	-sco6)
-		os=-sco5v6
-		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
-		;;
-	-sco5)
-		os=-sco3.2v5
-		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
-		;;
-	-sco4)
-		os=-sco3.2v4
-		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
-		;;
-	-sco3.2.[4-9]*)
-		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
-		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
-		;;
-	-sco3.2v[4-9]*)
-		# Don't forget version if it is 3.2v4 or newer.
-		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
-		;;
-	-sco5v6*)
-		# Don't forget version if it is 3.2v4 or newer.
-		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
-		;;
-	-sco*)
-		os=-sco3.2v2
-		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
-		;;
-	-udk*)
-		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
-		;;
-	-isc)
-		os=-isc2.2
-		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
-		;;
-	-clix*)
-		basic_machine=clipper-intergraph
-		;;
-	-isc*)
-		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
-		;;
-	-lynx*178)
-		os=-lynxos178
-		;;
-	-lynx*5)
-		os=-lynxos5
-		;;
-	-lynx*)
-		os=-lynxos
-		;;
-	-ptx*)
-		basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'`
-		;;
-	-psos*)
-		os=-psos
-		;;
-	-mint | -mint[0-9]*)
-		basic_machine=m68k-atari
-		os=-mint
+	*)
+		# Convert single-component short-hands not valid as part of
+		# multi-component configurations.
+		case $field1 in
+			386bsd)
+				basic_machine=i386-pc
+				basic_os=bsd
+				;;
+			a29khif)
+				basic_machine=a29k-amd
+				basic_os=udi
+				;;
+			adobe68k)
+				basic_machine=m68010-adobe
+				basic_os=scout
+				;;
+			alliant)
+				basic_machine=fx80-alliant
+				basic_os=
+				;;
+			altos | altos3068)
+				basic_machine=m68k-altos
+				basic_os=
+				;;
+			am29k)
+				basic_machine=a29k-none
+				basic_os=bsd
+				;;
+			amdahl)
+				basic_machine=580-amdahl
+				basic_os=sysv
+				;;
+			amiga)
+				basic_machine=m68k-unknown
+				basic_os=
+				;;
+			amigaos | amigados)
+				basic_machine=m68k-unknown
+				basic_os=amigaos
+				;;
+			amigaunix | amix)
+				basic_machine=m68k-unknown
+				basic_os=sysv4
+				;;
+			apollo68)
+				basic_machine=m68k-apollo
+				basic_os=sysv
+				;;
+			apollo68bsd)
+				basic_machine=m68k-apollo
+				basic_os=bsd
+				;;
+			aros)
+				basic_machine=i386-pc
+				basic_os=aros
+				;;
+			aux)
+				basic_machine=m68k-apple
+				basic_os=aux
+				;;
+			balance)
+				basic_machine=ns32k-sequent
+				basic_os=dynix
+				;;
+			blackfin)
+				basic_machine=bfin-unknown
+				basic_os=linux
+				;;
+			cegcc)
+				basic_machine=arm-unknown
+				basic_os=cegcc
+				;;
+			convex-c1)
+				basic_machine=c1-convex
+				basic_os=bsd
+				;;
+			convex-c2)
+				basic_machine=c2-convex
+				basic_os=bsd
+				;;
+			convex-c32)
+				basic_machine=c32-convex
+				basic_os=bsd
+				;;
+			convex-c34)
+				basic_machine=c34-convex
+				basic_os=bsd
+				;;
+			convex-c38)
+				basic_machine=c38-convex
+				basic_os=bsd
+				;;
+			cray)
+				basic_machine=j90-cray
+				basic_os=unicos
+				;;
+			crds | unos)
+				basic_machine=m68k-crds
+				basic_os=
+				;;
+			da30)
+				basic_machine=m68k-da30
+				basic_os=
+				;;
+			decstation | pmax | pmin | dec3100 | decstatn)
+				basic_machine=mips-dec
+				basic_os=
+				;;
+			delta88)
+				basic_machine=m88k-motorola
+				basic_os=sysv3
+				;;
+			dicos)
+				basic_machine=i686-pc
+				basic_os=dicos
+				;;
+			djgpp)
+				basic_machine=i586-pc
+				basic_os=msdosdjgpp
+				;;
+			ebmon29k)
+				basic_machine=a29k-amd
+				basic_os=ebmon
+				;;
+			es1800 | OSE68k | ose68k | ose | OSE)
+				basic_machine=m68k-ericsson
+				basic_os=ose
+				;;
+			gmicro)
+				basic_machine=tron-gmicro
+				basic_os=sysv
+				;;
+			go32)
+				basic_machine=i386-pc
+				basic_os=go32
+				;;
+			h8300hms)
+				basic_machine=h8300-hitachi
+				basic_os=hms
+				;;
+			h8300xray)
+				basic_machine=h8300-hitachi
+				basic_os=xray
+				;;
+			h8500hms)
+				basic_machine=h8500-hitachi
+				basic_os=hms
+				;;
+			harris)
+				basic_machine=m88k-harris
+				basic_os=sysv3
+				;;
+			hp300 | hp300hpux)
+				basic_machine=m68k-hp
+				basic_os=hpux
+				;;
+			hp300bsd)
+				basic_machine=m68k-hp
+				basic_os=bsd
+				;;
+			hppaosf)
+				basic_machine=hppa1.1-hp
+				basic_os=osf
+				;;
+			hppro)
+				basic_machine=hppa1.1-hp
+				basic_os=proelf
+				;;
+			i386mach)
+				basic_machine=i386-mach
+				basic_os=mach
+				;;
+			isi68 | isi)
+				basic_machine=m68k-isi
+				basic_os=sysv
+				;;
+			m68knommu)
+				basic_machine=m68k-unknown
+				basic_os=linux
+				;;
+			magnum | m3230)
+				basic_machine=mips-mips
+				basic_os=sysv
+				;;
+			merlin)
+				basic_machine=ns32k-utek
+				basic_os=sysv
+				;;
+			mingw64)
+				basic_machine=x86_64-pc
+				basic_os=mingw64
+				;;
+			mingw32)
+				basic_machine=i686-pc
+				basic_os=mingw32
+				;;
+			mingw32ce)
+				basic_machine=arm-unknown
+				basic_os=mingw32ce
+				;;
+			monitor)
+				basic_machine=m68k-rom68k
+				basic_os=coff
+				;;
+			morphos)
+				basic_machine=powerpc-unknown
+				basic_os=morphos
+				;;
+			moxiebox)
+				basic_machine=moxie-unknown
+				basic_os=moxiebox
+				;;
+			msdos)
+				basic_machine=i386-pc
+				basic_os=msdos
+				;;
+			msys)
+				basic_machine=i686-pc
+				basic_os=msys
+				;;
+			mvs)
+				basic_machine=i370-ibm
+				basic_os=mvs
+				;;
+			nacl)
+				basic_machine=le32-unknown
+				basic_os=nacl
+				;;
+			ncr3000)
+				basic_machine=i486-ncr
+				basic_os=sysv4
+				;;
+			netbsd386)
+				basic_machine=i386-pc
+				basic_os=netbsd
+				;;
+			netwinder)
+				basic_machine=armv4l-rebel
+				basic_os=linux
+				;;
+			news | news700 | news800 | news900)
+				basic_machine=m68k-sony
+				basic_os=newsos
+				;;
+			news1000)
+				basic_machine=m68030-sony
+				basic_os=newsos
+				;;
+			necv70)
+				basic_machine=v70-nec
+				basic_os=sysv
+				;;
+			nh3000)
+				basic_machine=m68k-harris
+				basic_os=cxux
+				;;
+			nh[45]000)
+				basic_machine=m88k-harris
+				basic_os=cxux
+				;;
+			nindy960)
+				basic_machine=i960-intel
+				basic_os=nindy
+				;;
+			mon960)
+				basic_machine=i960-intel
+				basic_os=mon960
+				;;
+			nonstopux)
+				basic_machine=mips-compaq
+				basic_os=nonstopux
+				;;
+			os400)
+				basic_machine=powerpc-ibm
+				basic_os=os400
+				;;
+			OSE68000 | ose68000)
+				basic_machine=m68000-ericsson
+				basic_os=ose
+				;;
+			os68k)
+				basic_machine=m68k-none
+				basic_os=os68k
+				;;
+			paragon)
+				basic_machine=i860-intel
+				basic_os=osf
+				;;
+			parisc)
+				basic_machine=hppa-unknown
+				basic_os=linux
+				;;
+			psp)
+				basic_machine=mipsallegrexel-sony
+				basic_os=psp
+				;;
+			pw32)
+				basic_machine=i586-unknown
+				basic_os=pw32
+				;;
+			rdos | rdos64)
+				basic_machine=x86_64-pc
+				basic_os=rdos
+				;;
+			rdos32)
+				basic_machine=i386-pc
+				basic_os=rdos
+				;;
+			rom68k)
+				basic_machine=m68k-rom68k
+				basic_os=coff
+				;;
+			sa29200)
+				basic_machine=a29k-amd
+				basic_os=udi
+				;;
+			sei)
+				basic_machine=mips-sei
+				basic_os=seiux
+				;;
+			sequent)
+				basic_machine=i386-sequent
+				basic_os=
+				;;
+			sps7)
+				basic_machine=m68k-bull
+				basic_os=sysv2
+				;;
+			st2000)
+				basic_machine=m68k-tandem
+				basic_os=
+				;;
+			stratus)
+				basic_machine=i860-stratus
+				basic_os=sysv4
+				;;
+			sun2)
+				basic_machine=m68000-sun
+				basic_os=
+				;;
+			sun2os3)
+				basic_machine=m68000-sun
+				basic_os=sunos3
+				;;
+			sun2os4)
+				basic_machine=m68000-sun
+				basic_os=sunos4
+				;;
+			sun3)
+				basic_machine=m68k-sun
+				basic_os=
+				;;
+			sun3os3)
+				basic_machine=m68k-sun
+				basic_os=sunos3
+				;;
+			sun3os4)
+				basic_machine=m68k-sun
+				basic_os=sunos4
+				;;
+			sun4)
+				basic_machine=sparc-sun
+				basic_os=
+				;;
+			sun4os3)
+				basic_machine=sparc-sun
+				basic_os=sunos3
+				;;
+			sun4os4)
+				basic_machine=sparc-sun
+				basic_os=sunos4
+				;;
+			sun4sol2)
+				basic_machine=sparc-sun
+				basic_os=solaris2
+				;;
+			sun386 | sun386i | roadrunner)
+				basic_machine=i386-sun
+				basic_os=
+				;;
+			sv1)
+				basic_machine=sv1-cray
+				basic_os=unicos
+				;;
+			symmetry)
+				basic_machine=i386-sequent
+				basic_os=dynix
+				;;
+			t3e)
+				basic_machine=alphaev5-cray
+				basic_os=unicos
+				;;
+			t90)
+				basic_machine=t90-cray
+				basic_os=unicos
+				;;
+			toad1)
+				basic_machine=pdp10-xkl
+				basic_os=tops20
+				;;
+			tpf)
+				basic_machine=s390x-ibm
+				basic_os=tpf
+				;;
+			udi29k)
+				basic_machine=a29k-amd
+				basic_os=udi
+				;;
+			ultra3)
+				basic_machine=a29k-nyu
+				basic_os=sym1
+				;;
+			v810 | necv810)
+				basic_machine=v810-nec
+				basic_os=none
+				;;
+			vaxv)
+				basic_machine=vax-dec
+				basic_os=sysv
+				;;
+			vms)
+				basic_machine=vax-dec
+				basic_os=vms
+				;;
+			vsta)
+				basic_machine=i386-pc
+				basic_os=vsta
+				;;
+			vxworks960)
+				basic_machine=i960-wrs
+				basic_os=vxworks
+				;;
+			vxworks68)
+				basic_machine=m68k-wrs
+				basic_os=vxworks
+				;;
+			vxworks29k)
+				basic_machine=a29k-wrs
+				basic_os=vxworks
+				;;
+			xbox)
+				basic_machine=i686-pc
+				basic_os=mingw32
+				;;
+			ymp)
+				basic_machine=ymp-cray
+				basic_os=unicos
+				;;
+			*)
+				basic_machine=$1
+				basic_os=
+				;;
+		esac
 		;;
 esac
 
-# Decode aliases for certain CPU-COMPANY combinations.
+# Decode 1-component or ad-hoc basic machines
 case $basic_machine in
-	# Recognize the basic CPU types without company name.
-	# Some are omitted here because they have special meanings below.
-	1750a | 580 \
-	| a29k \
-	| aarch64 | aarch64_be \
-	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
-	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
-	| am33_2.0 \
-	| arc | arceb \
-	| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv6m | armv[78][arm] \
-	| avr | avr32 \
-	| ba \
-	| be32 | be64 \
-	| bfin \
-	| c4x | c8051 | clipper | csky \
-	| d10v | d30v | dlx | dsp16xx \
-	| e2k | epiphany \
-	| fido | fr30 | frv | ft32 \
-	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
-	| hexagon \
-	| i370 | i860 | i960 | ia16 | ia64 \
-	| ip2k | iq2000 \
-	| k1om \
-	| le32 | le64 \
-	| lm32 \
-	| m32c | m32r | m32rle | m68000 | m68k | m88k \
-	| maxq | mb | microblaze | microblazeel | mcore | mep | metag \
-	| mips | mipsbe | mipseb | mipsel | mipsle \
-	| mips16 \
-	| mips64 | mips64el \
-	| mips64octeon | mips64octeonel \
-	| mips64orion | mips64orionel \
-	| mips64r5900 | mips64r5900el \
-	| mips64vr | mips64vrel \
-	| mips64vr4100 | mips64vr4100el \
-	| mips64vr4300 | mips64vr4300el \
-	| mips64vr5000 | mips64vr5000el \
-	| mips64vr5900 | mips64vr5900el \
-	| mipsisa32 | mipsisa32el \
-	| mipsisa32r2 | mipsisa32r2el \
-	| mipsisa32r6 | mipsisa32r6el \
-	| mipsisa64 | mipsisa64el \
-	| mipsisa64r2 | mipsisa64r2el \
-	| mipsisa64r6 | mipsisa64r6el \
-	| mipsisa64sb1 | mipsisa64sb1el \
-	| mipsisa64sr71k | mipsisa64sr71kel \
-	| mipsr5900 | mipsr5900el \
-	| mipstx39 | mipstx39el \
-	| mn10200 | mn10300 \
-	| moxie \
-	| mt \
-	| msp430 \
-	| nds32 | nds32le | nds32be \
-	| nios | nios2 | nios2eb | nios2el \
-	| ns16k | ns32k \
-	| open8 | or1k | or1knd | or32 \
-	| pdp10 | pj | pjl \
-	| powerpc | powerpc64 | powerpc64le | powerpcle \
-	| pru \
-	| pyramid \
-	| riscv32 | riscv64 \
-	| rl78 | rx \
-	| score \
-	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
-	| sh64 | sh64le \
-	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
-	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
-	| spu \
-	| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
-	| ubicom32 \
-	| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
-	| visium \
-	| wasm32 \
-	| x86 | xc16x | xstormy16 | xtensa \
-	| z8k | z80)
-		basic_machine=$basic_machine-unknown
+	# Here we handle the default manufacturer of certain CPU types.  It is in
+	# some cases the only manufacturer, in others, it is the most popular.
+	w89k)
+		cpu=hppa1.1
+		vendor=winbond
 		;;
-	c54x)
-		basic_machine=tic54x-unknown
+	op50n)
+		cpu=hppa1.1
+		vendor=oki
 		;;
-	c55x)
-		basic_machine=tic55x-unknown
+	op60c)
+		cpu=hppa1.1
+		vendor=oki
 		;;
-	c6x)
-		basic_machine=tic6x-unknown
+	ibm*)
+		cpu=i370
+		vendor=ibm
+		;;
+	orion105)
+		cpu=clipper
+		vendor=highlevel
+		;;
+	mac | mpw | mac-mpw)
+		cpu=m68k
+		vendor=apple
+		;;
+	pmac | pmac-mpw)
+		cpu=powerpc
+		vendor=apple
+		;;
+
+	# Recognize the various machine names and aliases which stand
+	# for a CPU type and a company and sometimes even an OS.
+	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+		cpu=m68000
+		vendor=att
+		;;
+	3b*)
+		cpu=we32k
+		vendor=att
+		;;
+	bluegene*)
+		cpu=powerpc
+		vendor=ibm
+		basic_os=cnk
+		;;
+	decsystem10* | dec10*)
+		cpu=pdp10
+		vendor=dec
+		basic_os=tops10
+		;;
+	decsystem20* | dec20*)
+		cpu=pdp10
+		vendor=dec
+		basic_os=tops20
+		;;
+	delta | 3300 | motorola-3300 | motorola-delta \
+	      | 3300-motorola | delta-motorola)
+		cpu=m68k
+		vendor=motorola
+		;;
+	dpx2*)
+		cpu=m68k
+		vendor=bull
+		basic_os=sysv3
+		;;
+	encore | umax | mmax)
+		cpu=ns32k
+		vendor=encore
+		;;
+	elxsi)
+		cpu=elxsi
+		vendor=elxsi
+		basic_os=${basic_os:-bsd}
+		;;
+	fx2800)
+		cpu=i860
+		vendor=alliant
+		;;
+	genix)
+		cpu=ns32k
+		vendor=ns
+		;;
+	h3050r* | hiux*)
+		cpu=hppa1.1
+		vendor=hitachi
+		basic_os=hiuxwe2
+		;;
+	hp3k9[0-9][0-9] | hp9[0-9][0-9])
+		cpu=hppa1.0
+		vendor=hp
+		;;
+	hp9k2[0-9][0-9] | hp9k31[0-9])
+		cpu=m68000
+		vendor=hp
+		;;
+	hp9k3[2-9][0-9])
+		cpu=m68k
+		vendor=hp
+		;;
+	hp9k6[0-9][0-9] | hp6[0-9][0-9])
+		cpu=hppa1.0
+		vendor=hp
+		;;
+	hp9k7[0-79][0-9] | hp7[0-79][0-9])
+		cpu=hppa1.1
+		vendor=hp
+		;;
+	hp9k78[0-9] | hp78[0-9])
+		# FIXME: really hppa2.0-hp
+		cpu=hppa1.1
+		vendor=hp
+		;;
+	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+		# FIXME: really hppa2.0-hp
+		cpu=hppa1.1
+		vendor=hp
+		;;
+	hp9k8[0-9][13679] | hp8[0-9][13679])
+		cpu=hppa1.1
+		vendor=hp
+		;;
+	hp9k8[0-9][0-9] | hp8[0-9][0-9])
+		cpu=hppa1.0
+		vendor=hp
+		;;
+	i*86v32)
+		cpu=`echo "$1" | sed -e 's/86.*/86/'`
+		vendor=pc
+		basic_os=sysv32
+		;;
+	i*86v4*)
+		cpu=`echo "$1" | sed -e 's/86.*/86/'`
+		vendor=pc
+		basic_os=sysv4
+		;;
+	i*86v)
+		cpu=`echo "$1" | sed -e 's/86.*/86/'`
+		vendor=pc
+		basic_os=sysv
+		;;
+	i*86sol2)
+		cpu=`echo "$1" | sed -e 's/86.*/86/'`
+		vendor=pc
+		basic_os=solaris2
+		;;
+	j90 | j90-cray)
+		cpu=j90
+		vendor=cray
+		basic_os=${basic_os:-unicos}
+		;;
+	iris | iris4d)
+		cpu=mips
+		vendor=sgi
+		case $basic_os in
+		    irix*)
+			;;
+		    *)
+			basic_os=irix4
+			;;
+		esac
+		;;
+	miniframe)
+		cpu=m68000
+		vendor=convergent
+		;;
+	*mint | mint[0-9]* | *MiNT | *MiNT[0-9]*)
+		cpu=m68k
+		vendor=atari
+		basic_os=mint
+		;;
+	news-3600 | risc-news)
+		cpu=mips
+		vendor=sony
+		basic_os=newsos
+		;;
+	next | m*-next)
+		cpu=m68k
+		vendor=next
+		case $basic_os in
+		    openstep*)
+		        ;;
+		    nextstep*)
+			;;
+		    ns2*)
+		      basic_os=nextstep2
+			;;
+		    *)
+		      basic_os=nextstep3
+			;;
+		esac
+		;;
+	np1)
+		cpu=np1
+		vendor=gould
+		;;
+	op50n-* | op60c-*)
+		cpu=hppa1.1
+		vendor=oki
+		basic_os=proelf
+		;;
+	pa-hitachi)
+		cpu=hppa1.1
+		vendor=hitachi
+		basic_os=hiuxwe2
+		;;
+	pbd)
+		cpu=sparc
+		vendor=tti
+		;;
+	pbb)
+		cpu=m68k
+		vendor=tti
+		;;
+	pc532)
+		cpu=ns32k
+		vendor=pc532
+		;;
+	pn)
+		cpu=pn
+		vendor=gould
+		;;
+	power)
+		cpu=power
+		vendor=ibm
+		;;
+	ps2)
+		cpu=i386
+		vendor=ibm
+		;;
+	rm[46]00)
+		cpu=mips
+		vendor=siemens
+		;;
+	rtpc | rtpc-*)
+		cpu=romp
+		vendor=ibm
+		;;
+	sde)
+		cpu=mipsisa32
+		vendor=sde
+		basic_os=${basic_os:-elf}
+		;;
+	simso-wrs)
+		cpu=sparclite
+		vendor=wrs
+		basic_os=vxworks
+		;;
+	tower | tower-32)
+		cpu=m68k
+		vendor=ncr
+		;;
+	vpp*|vx|vx-*)
+		cpu=f301
+		vendor=fujitsu
+		;;
+	w65)
+		cpu=w65
+		vendor=wdc
+		;;
+	w89k-*)
+		cpu=hppa1.1
+		vendor=winbond
+		basic_os=proelf
+		;;
+	none)
+		cpu=none
+		vendor=none
 		;;
 	leon|leon[3-9])
-		basic_machine=sparc-$basic_machine
+		cpu=sparc
+		vendor=$basic_machine
 		;;
-	m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
-		basic_machine=$basic_machine-unknown
-		os=-none
-		;;
-	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65)
-		;;
-	m9s12z | m68hcs12z | hcs12z | s12z)
-		basic_machine=s12z-unknown
-		os=-none
-		;;
-	ms1)
-		basic_machine=mt-unknown
+	leon-*|leon[3-9]-*)
+		cpu=sparc
+		vendor=`echo "$basic_machine" | sed 's/-.*//'`
 		;;
 
-	strongarm | thumb | xscale)
-		basic_machine=arm-unknown
+	*-*)
+		# shellcheck disable=SC2162
+		saved_IFS=$IFS
+		IFS="-" read cpu vendor <<EOF
+$basic_machine
+EOF
+		IFS=$saved_IFS
 		;;
-	xgate)
-		basic_machine=$basic_machine-unknown
-		os=-none
-		;;
-	xscaleeb)
-		basic_machine=armeb-unknown
-		;;
-
-	xscaleel)
-		basic_machine=armel-unknown
-		;;
-
 	# We use `pc' rather than `unknown'
 	# because (1) that's what they normally are, and
 	# (2) the word "unknown" tends to confuse beginning users.
 	i*86 | x86_64)
-	  basic_machine=$basic_machine-pc
-	  ;;
-	# Object if more than one company name word.
-	*-*-*)
-		echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2
-		exit 1
+		cpu=$basic_machine
+		vendor=pc
 		;;
-	# Recognize the basic CPU types with company name.
-	580-* \
-	| a29k-* \
-	| aarch64-* | aarch64_be-* \
-	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
-	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
-	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
-	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
-	| avr-* | avr32-* \
-	| ba-* \
-	| be32-* | be64-* \
-	| bfin-* | bs2000-* \
-	| c[123]* | c30-* | [cjt]90-* | c4x-* \
-	| c8051-* | clipper-* | craynv-* | csky-* | cydra-* \
-	| d10v-* | d30v-* | dlx-* \
-	| e2k-* | elxsi-* \
-	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
-	| h8300-* | h8500-* \
-	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
-	| hexagon-* \
-	| i*86-* | i860-* | i960-* | ia16-* | ia64-* \
-	| ip2k-* | iq2000-* \
-	| k1om-* \
-	| le32-* | le64-* \
-	| lm32-* \
-	| m32c-* | m32r-* | m32rle-* \
-	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
-	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
-	| microblaze-* | microblazeel-* \
-	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
-	| mips16-* \
-	| mips64-* | mips64el-* \
-	| mips64octeon-* | mips64octeonel-* \
-	| mips64orion-* | mips64orionel-* \
-	| mips64r5900-* | mips64r5900el-* \
-	| mips64vr-* | mips64vrel-* \
-	| mips64vr4100-* | mips64vr4100el-* \
-	| mips64vr4300-* | mips64vr4300el-* \
-	| mips64vr5000-* | mips64vr5000el-* \
-	| mips64vr5900-* | mips64vr5900el-* \
-	| mipsisa32-* | mipsisa32el-* \
-	| mipsisa32r2-* | mipsisa32r2el-* \
-	| mipsisa32r6-* | mipsisa32r6el-* \
-	| mipsisa64-* | mipsisa64el-* \
-	| mipsisa64r2-* | mipsisa64r2el-* \
-	| mipsisa64r6-* | mipsisa64r6el-* \
-	| mipsisa64sb1-* | mipsisa64sb1el-* \
-	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
-	| mipsr5900-* | mipsr5900el-* \
-	| mipstx39-* | mipstx39el-* \
-	| mmix-* \
-	| mt-* \
-	| msp430-* \
-	| nds32-* | nds32le-* | nds32be-* \
-	| nios-* | nios2-* | nios2eb-* | nios2el-* \
-	| none-* | np1-* | ns16k-* | ns32k-* \
-	| open8-* \
-	| or1k*-* \
-	| orion-* \
-	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
-	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
-	| pru-* \
-	| pyramid-* \
-	| riscv32-* | riscv64-* \
-	| rl78-* | romp-* | rs6000-* | rx-* \
-	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
-	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
-	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
-	| sparclite-* \
-	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
-	| tahoe-* \
-	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
-	| tile*-* \
-	| tron-* \
-	| ubicom32-* \
-	| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
-	| vax-* \
-	| visium-* \
-	| wasm32-* \
-	| we32k-* \
-	| x86-* | x86_64-* | xc16x-* | xps100-* \
-	| xstormy16-* | xtensa*-* \
-	| ymp-* \
-	| z8k-* | z80-*)
-		;;
-	# Recognize the basic CPU types without company name, with glob match.
-	xtensa*)
-		basic_machine=$basic_machine-unknown
-		;;
-	# Recognize the various machine names and aliases which stand
-	# for a CPU type and a company and sometimes even an OS.
-	386bsd)
-		basic_machine=i386-pc
-		os=-bsd
-		;;
-	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
-		basic_machine=m68000-att
-		;;
-	3b*)
-		basic_machine=we32k-att
-		;;
-	a29khif)
-		basic_machine=a29k-amd
-		os=-udi
-		;;
-	abacus)
-		basic_machine=abacus-unknown
-		;;
-	adobe68k)
-		basic_machine=m68010-adobe
-		os=-scout
-		;;
-	alliant | fx80)
-		basic_machine=fx80-alliant
-		;;
-	altos | altos3068)
-		basic_machine=m68k-altos
-		;;
-	am29k)
-		basic_machine=a29k-none
-		os=-bsd
-		;;
-	amd64)
-		basic_machine=x86_64-pc
-		;;
-	amd64-*)
-		basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'`
-		;;
-	amdahl)
-		basic_machine=580-amdahl
-		os=-sysv
-		;;
-	amiga | amiga-*)
-		basic_machine=m68k-unknown
-		;;
-	amigaos | amigados)
-		basic_machine=m68k-unknown
-		os=-amigaos
-		;;
-	amigaunix | amix)
-		basic_machine=m68k-unknown
-		os=-sysv4
-		;;
-	apollo68)
-		basic_machine=m68k-apollo
-		os=-sysv
-		;;
-	apollo68bsd)
-		basic_machine=m68k-apollo
-		os=-bsd
-		;;
-	aros)
-		basic_machine=i386-pc
-		os=-aros
-		;;
-	asmjs)
-		basic_machine=asmjs-unknown
-		;;
-	aux)
-		basic_machine=m68k-apple
-		os=-aux
-		;;
-	balance)
-		basic_machine=ns32k-sequent
-		os=-dynix
-		;;
-	blackfin)
-		basic_machine=bfin-unknown
-		os=-linux
-		;;
-	blackfin-*)
-		basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'`
-		os=-linux
-		;;
-	bluegene*)
-		basic_machine=powerpc-ibm
-		os=-cnk
-		;;
-	c54x-*)
-		basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
-		;;
-	c55x-*)
-		basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
-		;;
-	c6x-*)
-		basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
-		;;
-	c90)
-		basic_machine=c90-cray
-		os=-unicos
-		;;
-	cegcc)
-		basic_machine=arm-unknown
-		os=-cegcc
-		;;
-	convex-c1)
-		basic_machine=c1-convex
-		os=-bsd
-		;;
-	convex-c2)
-		basic_machine=c2-convex
-		os=-bsd
-		;;
-	convex-c32)
-		basic_machine=c32-convex
-		os=-bsd
-		;;
-	convex-c34)
-		basic_machine=c34-convex
-		os=-bsd
-		;;
-	convex-c38)
-		basic_machine=c38-convex
-		os=-bsd
-		;;
-	cray | j90)
-		basic_machine=j90-cray
-		os=-unicos
-		;;
-	craynv)
-		basic_machine=craynv-cray
-		os=-unicosmp
-		;;
-	cr16 | cr16-*)
-		basic_machine=cr16-unknown
-		os=-elf
-		;;
-	crds | unos)
-		basic_machine=m68k-crds
-		;;
-	crisv32 | crisv32-* | etraxfs*)
-		basic_machine=crisv32-axis
-		;;
-	cris | cris-* | etrax*)
-		basic_machine=cris-axis
-		;;
-	crx)
-		basic_machine=crx-unknown
-		os=-elf
-		;;
-	da30 | da30-*)
-		basic_machine=m68k-da30
-		;;
-	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
-		basic_machine=mips-dec
-		;;
-	decsystem10* | dec10*)
-		basic_machine=pdp10-dec
-		os=-tops10
-		;;
-	decsystem20* | dec20*)
-		basic_machine=pdp10-dec
-		os=-tops20
-		;;
-	delta | 3300 | motorola-3300 | motorola-delta \
-	      | 3300-motorola | delta-motorola)
-		basic_machine=m68k-motorola
-		;;
-	delta88)
-		basic_machine=m88k-motorola
-		os=-sysv3
-		;;
-	dicos)
-		basic_machine=i686-pc
-		os=-dicos
-		;;
-	djgpp)
-		basic_machine=i586-pc
-		os=-msdosdjgpp
-		;;
-	dpx20 | dpx20-*)
-		basic_machine=rs6000-bull
-		os=-bosx
-		;;
-	dpx2*)
-		basic_machine=m68k-bull
-		os=-sysv3
-		;;
-	e500v[12])
-		basic_machine=powerpc-unknown
-		os=$os"spe"
-		;;
-	e500v[12]-*)
-		basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'`
-		os=$os"spe"
-		;;
-	ebmon29k)
-		basic_machine=a29k-amd
-		os=-ebmon
-		;;
-	elxsi)
-		basic_machine=elxsi-elxsi
-		os=-bsd
-		;;
-	encore | umax | mmax)
-		basic_machine=ns32k-encore
-		;;
-	es1800 | OSE68k | ose68k | ose | OSE)
-		basic_machine=m68k-ericsson
-		os=-ose
-		;;
-	fx2800)
-		basic_machine=i860-alliant
-		;;
-	genix)
-		basic_machine=ns32k-ns
-		;;
-	gmicro)
-		basic_machine=tron-gmicro
-		os=-sysv
-		;;
-	go32)
-		basic_machine=i386-pc
-		os=-go32
-		;;
-	h3050r* | hiux*)
-		basic_machine=hppa1.1-hitachi
-		os=-hiuxwe2
-		;;
-	h8300hms)
-		basic_machine=h8300-hitachi
-		os=-hms
-		;;
-	h8300xray)
-		basic_machine=h8300-hitachi
-		os=-xray
-		;;
-	h8500hms)
-		basic_machine=h8500-hitachi
-		os=-hms
-		;;
-	harris)
-		basic_machine=m88k-harris
-		os=-sysv3
-		;;
-	hp300-*)
-		basic_machine=m68k-hp
-		;;
-	hp300bsd)
-		basic_machine=m68k-hp
-		os=-bsd
-		;;
-	hp300hpux)
-		basic_machine=m68k-hp
-		os=-hpux
-		;;
-	hp3k9[0-9][0-9] | hp9[0-9][0-9])
-		basic_machine=hppa1.0-hp
-		;;
-	hp9k2[0-9][0-9] | hp9k31[0-9])
-		basic_machine=m68000-hp
-		;;
-	hp9k3[2-9][0-9])
-		basic_machine=m68k-hp
-		;;
-	hp9k6[0-9][0-9] | hp6[0-9][0-9])
-		basic_machine=hppa1.0-hp
-		;;
-	hp9k7[0-79][0-9] | hp7[0-79][0-9])
-		basic_machine=hppa1.1-hp
-		;;
-	hp9k78[0-9] | hp78[0-9])
-		# FIXME: really hppa2.0-hp
-		basic_machine=hppa1.1-hp
-		;;
-	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
-		# FIXME: really hppa2.0-hp
-		basic_machine=hppa1.1-hp
-		;;
-	hp9k8[0-9][13679] | hp8[0-9][13679])
-		basic_machine=hppa1.1-hp
-		;;
-	hp9k8[0-9][0-9] | hp8[0-9][0-9])
-		basic_machine=hppa1.0-hp
-		;;
-	hppaosf)
-		basic_machine=hppa1.1-hp
-		os=-osf
-		;;
-	hppro)
-		basic_machine=hppa1.1-hp
-		os=-proelf
-		;;
-	i370-ibm* | ibm*)
-		basic_machine=i370-ibm
-		;;
-	i*86v32)
-		basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
-		os=-sysv32
-		;;
-	i*86v4*)
-		basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
-		os=-sysv4
-		;;
-	i*86v)
-		basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
-		os=-sysv
-		;;
-	i*86sol2)
-		basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
-		os=-solaris2
-		;;
-	i386mach)
-		basic_machine=i386-mach
-		os=-mach
-		;;
-	vsta)
-		basic_machine=i386-unknown
-		os=-vsta
-		;;
-	iris | iris4d)
-		basic_machine=mips-sgi
-		case $os in
-		    -irix*)
-			;;
-		    *)
-			os=-irix4
-			;;
-		esac
-		;;
-	isi68 | isi)
-		basic_machine=m68k-isi
-		os=-sysv
-		;;
-	leon-*|leon[3-9]-*)
-		basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'`
-		;;
-	m68knommu)
-		basic_machine=m68k-unknown
-		os=-linux
-		;;
-	m68knommu-*)
-		basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'`
-		os=-linux
-		;;
-	magnum | m3230)
-		basic_machine=mips-mips
-		os=-sysv
-		;;
-	merlin)
-		basic_machine=ns32k-utek
-		os=-sysv
-		;;
-	microblaze*)
-		basic_machine=microblaze-xilinx
-		;;
-	mingw64)
-		basic_machine=x86_64-pc
-		os=-mingw64
-		;;
-	mingw32)
-		basic_machine=i686-pc
-		os=-mingw32
-		;;
-	mingw32ce)
-		basic_machine=arm-unknown
-		os=-mingw32ce
-		;;
-	miniframe)
-		basic_machine=m68000-convergent
-		;;
-	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
-		basic_machine=m68k-atari
-		os=-mint
-		;;
-	mips3*-*)
-		basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`
-		;;
-	mips3*)
-		basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown
-		;;
-	monitor)
-		basic_machine=m68k-rom68k
-		os=-coff
-		;;
-	morphos)
-		basic_machine=powerpc-unknown
-		os=-morphos
-		;;
-	moxiebox)
-		basic_machine=moxie-unknown
-		os=-moxiebox
-		;;
-	msdos)
-		basic_machine=i386-pc
-		os=-msdos
-		;;
-	ms1-*)
-		basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'`
-		;;
-	msys)
-		basic_machine=i686-pc
-		os=-msys
-		;;
-	mvs)
-		basic_machine=i370-ibm
-		os=-mvs
-		;;
-	nacl)
-		basic_machine=le32-unknown
-		os=-nacl
-		;;
-	ncr3000)
-		basic_machine=i486-ncr
-		os=-sysv4
-		;;
-	netbsd386)
-		basic_machine=i386-unknown
-		os=-netbsd
-		;;
-	netwinder)
-		basic_machine=armv4l-rebel
-		os=-linux
-		;;
-	news | news700 | news800 | news900)
-		basic_machine=m68k-sony
-		os=-newsos
-		;;
-	news1000)
-		basic_machine=m68030-sony
-		os=-newsos
-		;;
-	news-3600 | risc-news)
-		basic_machine=mips-sony
-		os=-newsos
-		;;
-	necv70)
-		basic_machine=v70-nec
-		os=-sysv
-		;;
-	next | m*-next)
-		basic_machine=m68k-next
-		case $os in
-		    -nextstep* )
-			;;
-		    -ns2*)
-		      os=-nextstep2
-			;;
-		    *)
-		      os=-nextstep3
-			;;
-		esac
-		;;
-	nh3000)
-		basic_machine=m68k-harris
-		os=-cxux
-		;;
-	nh[45]000)
-		basic_machine=m88k-harris
-		os=-cxux
-		;;
-	nindy960)
-		basic_machine=i960-intel
-		os=-nindy
-		;;
-	mon960)
-		basic_machine=i960-intel
-		os=-mon960
-		;;
-	nonstopux)
-		basic_machine=mips-compaq
-		os=-nonstopux
-		;;
-	np1)
-		basic_machine=np1-gould
-		;;
-	neo-tandem)
-		basic_machine=neo-tandem
-		;;
-	nse-tandem)
-		basic_machine=nse-tandem
-		;;
-	nsr-tandem)
-		basic_machine=nsr-tandem
-		;;
-	nsv-tandem)
-		basic_machine=nsv-tandem
-		;;
-	nsx-tandem)
-		basic_machine=nsx-tandem
-		;;
-	op50n-* | op60c-*)
-		basic_machine=hppa1.1-oki
-		os=-proelf
-		;;
-	openrisc | openrisc-*)
-		basic_machine=or32-unknown
-		;;
-	os400)
-		basic_machine=powerpc-ibm
-		os=-os400
-		;;
-	OSE68000 | ose68000)
-		basic_machine=m68000-ericsson
-		os=-ose
-		;;
-	os68k)
-		basic_machine=m68k-none
-		os=-os68k
-		;;
-	pa-hitachi)
-		basic_machine=hppa1.1-hitachi
-		os=-hiuxwe2
-		;;
-	paragon)
-		basic_machine=i860-intel
-		os=-osf
-		;;
-	parisc)
-		basic_machine=hppa-unknown
-		os=-linux
-		;;
-	parisc-*)
-		basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'`
-		os=-linux
-		;;
-	pbd)
-		basic_machine=sparc-tti
-		;;
-	pbb)
-		basic_machine=m68k-tti
-		;;
-	pc532 | pc532-*)
-		basic_machine=ns32k-pc532
-		;;
+	# These rules are duplicated from below for sake of the special case above;
+	# i.e. things that normalized to x86 arches should also default to "pc"
 	pc98)
-		basic_machine=i386-pc
+		cpu=i386
+		vendor=pc
 		;;
-	pc98-*)
-		basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+	x64 | amd64)
+		cpu=x86_64
+		vendor=pc
 		;;
-	pentium | p5 | k5 | k6 | nexgen | viac3)
-		basic_machine=i586-pc
+	# Recognize the basic CPU types without company name.
+	*)
+		cpu=$basic_machine
+		vendor=unknown
 		;;
-	pentiumpro | p6 | 6x86 | athlon | athlon_*)
-		basic_machine=i686-pc
+esac
+
+unset -v basic_machine
+
+# Decode basic machines in the full and proper CPU-Company form.
+case $cpu-$vendor in
+	# Here we handle the default manufacturer of certain CPU types in canonical form. It is in
+	# some cases the only manufacturer, in others, it is the most popular.
+	craynv-unknown)
+		vendor=cray
+		basic_os=${basic_os:-unicosmp}
 		;;
-	pentiumii | pentium2 | pentiumiii | pentium3)
-		basic_machine=i686-pc
+	c90-unknown | c90-cray)
+		vendor=cray
+		basic_os=${Basic_os:-unicos}
 		;;
-	pentium4)
-		basic_machine=i786-pc
+	fx80-unknown)
+		vendor=alliant
 		;;
-	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
-		basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+	romp-unknown)
+		vendor=ibm
 		;;
-	pentiumpro-* | p6-* | 6x86-* | athlon-*)
-		basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+	mmix-unknown)
+		vendor=knuth
 		;;
-	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
-		basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+	microblaze-unknown | microblazeel-unknown)
+		vendor=xilinx
 		;;
-	pentium4-*)
-		basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+	rs6000-unknown)
+		vendor=ibm
 		;;
-	pn)
-		basic_machine=pn-gould
+	vax-unknown)
+		vendor=dec
 		;;
-	power)	basic_machine=power-ibm
+	pdp11-unknown)
+		vendor=dec
 		;;
-	ppc | ppcbe)	basic_machine=powerpc-unknown
+	we32k-unknown)
+		vendor=att
 		;;
-	ppc-* | ppcbe-*)
-		basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+	cydra-unknown)
+		vendor=cydrome
 		;;
-	ppcle | powerpclittle)
-		basic_machine=powerpcle-unknown
+	i370-ibm*)
+		vendor=ibm
 		;;
-	ppcle-* | powerpclittle-*)
-		basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+	orion-unknown)
+		vendor=highlevel
 		;;
-	ppc64)	basic_machine=powerpc64-unknown
-		;;
-	ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'`
-		;;
-	ppc64le | powerpc64little)
-		basic_machine=powerpc64le-unknown
-		;;
-	ppc64le-* | powerpc64little-*)
-		basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'`
-		;;
-	ps2)
-		basic_machine=i386-ibm
-		;;
-	pw32)
-		basic_machine=i586-unknown
-		os=-pw32
-		;;
-	rdos | rdos64)
-		basic_machine=x86_64-pc
-		os=-rdos
-		;;
-	rdos32)
-		basic_machine=i386-pc
-		os=-rdos
-		;;
-	rom68k)
-		basic_machine=m68k-rom68k
-		os=-coff
-		;;
-	rm[46]00)
-		basic_machine=mips-siemens
-		;;
-	rtpc | rtpc-*)
-		basic_machine=romp-ibm
-		;;
-	s390 | s390-*)
-		basic_machine=s390-ibm
-		;;
-	s390x | s390x-*)
-		basic_machine=s390x-ibm
-		;;
-	sa29200)
-		basic_machine=a29k-amd
-		os=-udi
-		;;
-	sb1)
-		basic_machine=mipsisa64sb1-unknown
-		;;
-	sb1el)
-		basic_machine=mipsisa64sb1el-unknown
-		;;
-	sde)
-		basic_machine=mipsisa32-sde
-		os=-elf
-		;;
-	sei)
-		basic_machine=mips-sei
-		os=-seiux
-		;;
-	sequent)
-		basic_machine=i386-sequent
-		;;
-	sh5el)
-		basic_machine=sh5le-unknown
-		;;
-	simso-wrs)
-		basic_machine=sparclite-wrs
-		os=-vxworks
-		;;
-	sps7)
-		basic_machine=m68k-bull
-		os=-sysv2
-		;;
-	spur)
-		basic_machine=spur-unknown
-		;;
-	st2000)
-		basic_machine=m68k-tandem
-		;;
-	stratus)
-		basic_machine=i860-stratus
-		os=-sysv4
-		;;
-	strongarm-* | thumb-*)
-		basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'`
-		;;
-	sun2)
-		basic_machine=m68000-sun
-		;;
-	sun2os3)
-		basic_machine=m68000-sun
-		os=-sunos3
-		;;
-	sun2os4)
-		basic_machine=m68000-sun
-		os=-sunos4
-		;;
-	sun3os3)
-		basic_machine=m68k-sun
-		os=-sunos3
-		;;
-	sun3os4)
-		basic_machine=m68k-sun
-		os=-sunos4
-		;;
-	sun4os3)
-		basic_machine=sparc-sun
-		os=-sunos3
-		;;
-	sun4os4)
-		basic_machine=sparc-sun
-		os=-sunos4
-		;;
-	sun4sol2)
-		basic_machine=sparc-sun
-		os=-solaris2
-		;;
-	sun3 | sun3-*)
-		basic_machine=m68k-sun
-		;;
-	sun4)
-		basic_machine=sparc-sun
-		;;
-	sun386 | sun386i | roadrunner)
-		basic_machine=i386-sun
-		;;
-	sv1)
-		basic_machine=sv1-cray
-		os=-unicos
-		;;
-	symmetry)
-		basic_machine=i386-sequent
-		os=-dynix
-		;;
-	t3e)
-		basic_machine=alphaev5-cray
-		os=-unicos
-		;;
-	t90)
-		basic_machine=t90-cray
-		os=-unicos
-		;;
-	tile*)
-		basic_machine=$basic_machine-unknown
-		os=-linux-gnu
-		;;
-	tx39)
-		basic_machine=mipstx39-unknown
-		;;
-	tx39el)
-		basic_machine=mipstx39el-unknown
-		;;
-	toad1)
-		basic_machine=pdp10-xkl
-		os=-tops20
-		;;
-	tower | tower-32)
-		basic_machine=m68k-ncr
-		;;
-	tpf)
-		basic_machine=s390x-ibm
-		os=-tpf
-		;;
-	udi29k)
-		basic_machine=a29k-amd
-		os=-udi
-		;;
-	ultra3)
-		basic_machine=a29k-nyu
-		os=-sym1
-		;;
-	v810 | necv810)
-		basic_machine=v810-nec
-		os=-none
-		;;
-	vaxv)
-		basic_machine=vax-dec
-		os=-sysv
-		;;
-	vms)
-		basic_machine=vax-dec
-		os=-vms
-		;;
-	vpp*|vx|vx-*)
-		basic_machine=f301-fujitsu
-		;;
-	vxworks960)
-		basic_machine=i960-wrs
-		os=-vxworks
-		;;
-	vxworks68)
-		basic_machine=m68k-wrs
-		os=-vxworks
-		;;
-	vxworks29k)
-		basic_machine=a29k-wrs
-		os=-vxworks
-		;;
-	w65*)
-		basic_machine=w65-wdc
-		os=-none
-		;;
-	w89k-*)
-		basic_machine=hppa1.1-winbond
-		os=-proelf
-		;;
-	x64)
-		basic_machine=x86_64-pc
-		;;
-	xbox)
-		basic_machine=i686-pc
-		os=-mingw32
-		;;
-	xps | xps100)
-		basic_machine=xps100-honeywell
-		;;
-	xscale-* | xscalee[bl]-*)
-		basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'`
-		;;
-	ymp)
-		basic_machine=ymp-cray
-		os=-unicos
-		;;
-	none)
-		basic_machine=none-none
-		os=-none
+	xps-unknown | xps100-unknown)
+		cpu=xps100
+		vendor=honeywell
 		;;
 
-# Here we handle the default manufacturer of certain CPU types.  It is in
-# some cases the only manufacturer, in others, it is the most popular.
-	w89k)
-		basic_machine=hppa1.1-winbond
+	# Here we normalize CPU types with a missing or matching vendor
+	dpx20-unknown | dpx20-bull)
+		cpu=rs6000
+		vendor=bull
+		basic_os=${basic_os:-bosx}
 		;;
-	op50n)
-		basic_machine=hppa1.1-oki
+
+	# Here we normalize CPU types irrespective of the vendor
+	amd64-*)
+		cpu=x86_64
 		;;
-	op60c)
-		basic_machine=hppa1.1-oki
+	blackfin-*)
+		cpu=bfin
+		basic_os=linux
 		;;
-	romp)
-		basic_machine=romp-ibm
+	c54x-*)
+		cpu=tic54x
 		;;
-	mmix)
-		basic_machine=mmix-knuth
+	c55x-*)
+		cpu=tic55x
 		;;
-	rs6000)
-		basic_machine=rs6000-ibm
+	c6x-*)
+		cpu=tic6x
 		;;
-	vax)
-		basic_machine=vax-dec
+	e500v[12]-*)
+		cpu=powerpc
+		basic_os=${basic_os}"spe"
 		;;
-	pdp11)
-		basic_machine=pdp11-dec
+	mips3*-*)
+		cpu=mips64
 		;;
-	we32k)
-		basic_machine=we32k-att
+	ms1-*)
+		cpu=mt
 		;;
-	sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
-		basic_machine=sh-unknown
+	m68knommu-*)
+		cpu=m68k
+		basic_os=linux
 		;;
-	cydra)
-		basic_machine=cydra-cydrome
+	m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*)
+		cpu=s12z
 		;;
-	orion)
-		basic_machine=orion-highlevel
+	openrisc-*)
+		cpu=or32
 		;;
-	orion105)
-		basic_machine=clipper-highlevel
+	parisc-*)
+		cpu=hppa
+		basic_os=linux
 		;;
-	mac | mpw | mac-mpw)
-		basic_machine=m68k-apple
+	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+		cpu=i586
 		;;
-	pmac | pmac-mpw)
-		basic_machine=powerpc-apple
+	pentiumpro-* | p6-* | 6x86-* | athlon-* | athalon_*-*)
+		cpu=i686
 		;;
-	*-unknown)
-		# Make sure to match an already-canonicalized machine name.
+	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+		cpu=i686
 		;;
+	pentium4-*)
+		cpu=i786
+		;;
+	pc98-*)
+		cpu=i386
+		;;
+	ppc-* | ppcbe-*)
+		cpu=powerpc
+		;;
+	ppcle-* | powerpclittle-*)
+		cpu=powerpcle
+		;;
+	ppc64-*)
+		cpu=powerpc64
+		;;
+	ppc64le-* | powerpc64little-*)
+		cpu=powerpc64le
+		;;
+	sb1-*)
+		cpu=mipsisa64sb1
+		;;
+	sb1el-*)
+		cpu=mipsisa64sb1el
+		;;
+	sh5e[lb]-*)
+		cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'`
+		;;
+	spur-*)
+		cpu=spur
+		;;
+	strongarm-* | thumb-*)
+		cpu=arm
+		;;
+	tx39-*)
+		cpu=mipstx39
+		;;
+	tx39el-*)
+		cpu=mipstx39el
+		;;
+	x64-*)
+		cpu=x86_64
+		;;
+	xscale-* | xscalee[bl]-*)
+		cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
+		;;
+	arm64-*)
+		cpu=aarch64
+		;;
+
+	# Recognize the canonical CPU Types that limit and/or modify the
+	# company names they are paired with.
+	cr16-*)
+		basic_os=${basic_os:-elf}
+		;;
+	crisv32-* | etraxfs*-*)
+		cpu=crisv32
+		vendor=axis
+		;;
+	cris-* | etrax*-*)
+		cpu=cris
+		vendor=axis
+		;;
+	crx-*)
+		basic_os=${basic_os:-elf}
+		;;
+	neo-tandem)
+		cpu=neo
+		vendor=tandem
+		;;
+	nse-tandem)
+		cpu=nse
+		vendor=tandem
+		;;
+	nsr-tandem)
+		cpu=nsr
+		vendor=tandem
+		;;
+	nsv-tandem)
+		cpu=nsv
+		vendor=tandem
+		;;
+	nsx-tandem)
+		cpu=nsx
+		vendor=tandem
+		;;
+	mipsallegrexel-sony)
+		cpu=mipsallegrexel
+		vendor=sony
+		;;
+	tile*-*)
+		basic_os=${basic_os:-linux-gnu}
+		;;
+
 	*)
-		echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2
-		exit 1
+		# Recognize the canonical CPU types that are allowed with any
+		# company name.
+		case $cpu in
+			1750a | 580 \
+			| a29k \
+			| aarch64 | aarch64_be \
+			| abacus \
+			| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \
+			| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \
+			| alphapca5[67] | alpha64pca5[67] \
+			| am33_2.0 \
+			| amdgcn \
+			| arc | arceb | arc32 | arc64 \
+			| arm | arm[lb]e | arme[lb] | armv* \
+			| avr | avr32 \
+			| asmjs \
+			| ba \
+			| be32 | be64 \
+			| bfin | bpf | bs2000 \
+			| c[123]* | c30 | [cjt]90 | c4x \
+			| c8051 | clipper | craynv | csky | cydra \
+			| d10v | d30v | dlx | dsp16xx \
+			| e2k | elxsi | epiphany \
+			| f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \
+			| h8300 | h8500 \
+			| hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+			| hexagon \
+			| i370 | i*86 | i860 | i960 | ia16 | ia64 \
+			| ip2k | iq2000 \
+			| k1om \
+			| le32 | le64 \
+			| lm32 \
+			| loongarch32 | loongarch64 | loongarchx32 \
+			| m32c | m32r | m32rle \
+			| m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \
+			| m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \
+			| m88110 | m88k | maxq | mb | mcore | mep | metag \
+			| microblaze | microblazeel \
+			| mips | mipsbe | mipseb | mipsel | mipsle \
+			| mips16 \
+			| mips64 | mips64eb | mips64el \
+			| mips64octeon | mips64octeonel \
+			| mips64orion | mips64orionel \
+			| mips64r5900 | mips64r5900el \
+			| mips64vr | mips64vrel \
+			| mips64vr4100 | mips64vr4100el \
+			| mips64vr4300 | mips64vr4300el \
+			| mips64vr5000 | mips64vr5000el \
+			| mips64vr5900 | mips64vr5900el \
+			| mipsisa32 | mipsisa32el \
+			| mipsisa32r2 | mipsisa32r2el \
+			| mipsisa32r3 | mipsisa32r3el \
+			| mipsisa32r5 | mipsisa32r5el \
+			| mipsisa32r6 | mipsisa32r6el \
+			| mipsisa64 | mipsisa64el \
+			| mipsisa64r2 | mipsisa64r2el \
+			| mipsisa64r3 | mipsisa64r3el \
+			| mipsisa64r5 | mipsisa64r5el \
+			| mipsisa64r6 | mipsisa64r6el \
+			| mipsisa64sb1 | mipsisa64sb1el \
+			| mipsisa64sr71k | mipsisa64sr71kel \
+			| mipsr5900 | mipsr5900el \
+			| mipstx39 | mipstx39el \
+			| mmix \
+			| mn10200 | mn10300 \
+			| moxie \
+			| mt \
+			| msp430 \
+			| nds32 | nds32le | nds32be \
+			| nfp \
+			| nios | nios2 | nios2eb | nios2el \
+			| none | np1 | ns16k | ns32k | nvptx \
+			| open8 \
+			| or1k* \
+			| or32 \
+			| orion \
+			| picochip \
+			| pdp10 | pdp11 | pj | pjl | pn | power \
+			| powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \
+			| pru \
+			| pyramid \
+			| riscv | riscv32 | riscv32be | riscv64 | riscv64be \
+			| rl78 | romp | rs6000 | rx \
+			| s390 | s390x \
+			| score \
+			| sh | shl \
+			| sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \
+			| sh[1234]e[lb] |  sh[12345][lb]e | sh[23]ele | sh64 | sh64le \
+			| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \
+			| sparclite \
+			| sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \
+			| spu \
+			| tahoe \
+			| thumbv7* \
+			| tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \
+			| tron \
+			| ubicom32 \
+			| v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \
+			| vax \
+			| visium \
+			| w65 \
+			| wasm32 | wasm64 \
+			| we32k \
+			| x86 | x86_64 | xc16x | xgate | xps100 \
+			| xstormy16 | xtensa* \
+			| ymp \
+			| z8k | z80)
+				;;
+
+			*)
+				echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2
+				exit 1
+				;;
+		esac
 		;;
 esac
 
 # Here we canonicalize certain aliases for manufacturers.
-case $basic_machine in
-	*-digital*)
-		basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'`
+case $vendor in
+	digital*)
+		vendor=dec
 		;;
-	*-commodore*)
-		basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'`
+	commodore*)
+		vendor=cbm
 		;;
 	*)
 		;;
@@ -1338,203 +1301,215 @@
 
 # Decode manufacturer-specific aliases for certain operating systems.
 
-if [ x"$os" != x"" ]
+if test x$basic_os != x
 then
+
+# First recognize some ad-hoc caes, or perhaps split kernel-os, or else just
+# set os.
+case $basic_os in
+	gnu/linux*)
+		kernel=linux
+		os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'`
+		;;
+	os2-emx)
+		kernel=os2
+		os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'`
+		;;
+	nto-qnx*)
+		kernel=nto
+		os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'`
+		;;
+	*-*)
+		# shellcheck disable=SC2162
+		saved_IFS=$IFS
+		IFS="-" read kernel os <<EOF
+$basic_os
+EOF
+		IFS=$saved_IFS
+		;;
+	# Default OS when just kernel was specified
+	nto*)
+		kernel=nto
+		os=`echo "$basic_os" | sed -e 's|nto|qnx|'`
+		;;
+	linux*)
+		kernel=linux
+		os=`echo "$basic_os" | sed -e 's|linux|gnu|'`
+		;;
+	*)
+		kernel=
+		os=$basic_os
+		;;
+esac
+
+# Now, normalize the OS (knowing we just have one component, it's not a kernel,
+# etc.)
 case $os in
 	# First match some system type aliases that might get confused
 	# with valid system types.
-	# -solaris* is a basic system type, with this one exception.
-	-auroraux)
-		os=-auroraux
+	# solaris* is a basic system type, with this one exception.
+	auroraux)
+		os=auroraux
 		;;
-	-solaris1 | -solaris1.*)
-		os=`echo $os | sed -e 's|solaris1|sunos4|'`
+	bluegene*)
+		os=cnk
 		;;
-	-solaris)
-		os=-solaris2
+	solaris1 | solaris1.*)
+		os=`echo "$os" | sed -e 's|solaris1|sunos4|'`
 		;;
-	-unixware*)
-		os=-sysv4.2uw
+	solaris)
+		os=solaris2
 		;;
-	-gnu/linux*)
-		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+	unixware*)
+		os=sysv4.2uw
 		;;
 	# es1800 is here to avoid being matched by es* (a different OS)
-	-es1800*)
-		os=-ose
+	es1800*)
+		os=ose
 		;;
-	# Now accept the basic system types.
-	# The portable systems comes first.
-	# Each alternative MUST end in a * to match a version number.
-	# -sysv* is not here because it comes later, after sysvr4.
-	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
-	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
-	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
-	      | -sym* | -kopensolaris* | -plan9* \
-	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
-	      | -aos* | -aros* | -cloudabi* | -sortix* \
-	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
-	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
-	      | -hiux* | -knetbsd* | -mirbsd* | -netbsd* \
-	      | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
-	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
-	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
-	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
-	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* | -hcos* \
-	      | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \
-	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-	      | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
-	      | -linux-newlib* | -linux-musl* | -linux-uclibc* \
-	      | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
-	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* \
-	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
-	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
-	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
-	      | -morphos* | -superux* | -rtmk* | -windiss* \
-	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
-	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
-	      | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme* \
-	      | -midnightbsd*)
-	# Remember, each alternative MUST END IN *, to match a version number.
+	# Some version numbers need modification
+	chorusos*)
+		os=chorusos
 		;;
-	-qnx*)
-		case $basic_machine in
-		    x86-* | i*86-*)
-			;;
-		    *)
-			os=-nto$os
-			;;
-		esac
+	isc)
+		os=isc2.2
 		;;
-	-nto-qnx*)
+	sco6)
+		os=sco5v6
 		;;
-	-nto*)
-		os=`echo $os | sed -e 's|nto|nto-qnx|'`
+	sco5)
+		os=sco3.2v5
 		;;
-	-sim | -xray | -os68k* | -v88r* \
-	      | -windows* | -osx | -abug | -netware* | -os9* \
-	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+	sco4)
+		os=sco3.2v4
 		;;
-	-mac*)
+	sco3.2.[4-9]*)
+		os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'`
+		;;
+	sco*v* | scout)
+		# Don't match below
+		;;
+	sco*)
+		os=sco3.2v2
+		;;
+	psos*)
+		os=psos
+		;;
+	qnx*)
+		os=qnx
+		;;
+	hiux*)
+		os=hiuxwe2
+		;;
+	lynx*178)
+		os=lynxos178
+		;;
+	lynx*5)
+		os=lynxos5
+		;;
+	lynxos*)
+		# don't get caught up in next wildcard
+		;;
+	lynx*)
+		os=lynxos
+		;;
+	mac[0-9]*)
 		os=`echo "$os" | sed -e 's|mac|macos|'`
 		;;
-	-linux-dietlibc)
-		os=-linux-dietlibc
+	opened*)
+		os=openedition
 		;;
-	-linux*)
-		os=`echo $os | sed -e 's|linux|linux-gnu|'`
+	os400*)
+		os=os400
 		;;
-	-sunos5*)
+	sunos5*)
 		os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
 		;;
-	-sunos6*)
+	sunos6*)
 		os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
 		;;
-	-opened*)
-		os=-openedition
+	wince*)
+		os=wince
 		;;
-	-os400*)
-		os=-os400
+	utek*)
+		os=bsd
 		;;
-	-wince*)
-		os=-wince
+	dynix*)
+		os=bsd
 		;;
-	-utek*)
-		os=-bsd
+	acis*)
+		os=aos
 		;;
-	-dynix*)
-		os=-bsd
+	atheos*)
+		os=atheos
 		;;
-	-acis*)
-		os=-aos
+	syllable*)
+		os=syllable
 		;;
-	-atheos*)
-		os=-atheos
+	386bsd)
+		os=bsd
 		;;
-	-syllable*)
-		os=-syllable
+	ctix* | uts*)
+		os=sysv
 		;;
-	-386bsd)
-		os=-bsd
+	nova*)
+		os=rtmk-nova
 		;;
-	-ctix* | -uts*)
-		os=-sysv
-		;;
-	-nova*)
-		os=-rtmk-nova
-		;;
-	-ns2)
-		os=-nextstep2
-		;;
-	-nsk*)
-		os=-nsk
+	ns2)
+		os=nextstep2
 		;;
 	# Preserve the version number of sinix5.
-	-sinix5.*)
-		os=`echo $os | sed -e 's|sinix|sysv|'`
+	sinix5.*)
+		os=`echo "$os" | sed -e 's|sinix|sysv|'`
 		;;
-	-sinix*)
-		os=-sysv4
+	sinix*)
+		os=sysv4
 		;;
-	-tpf*)
-		os=-tpf
+	tpf*)
+		os=tpf
 		;;
-	-triton*)
-		os=-sysv3
+	triton*)
+		os=sysv3
 		;;
-	-oss*)
-		os=-sysv3
+	oss*)
+		os=sysv3
 		;;
-	-svr4*)
-		os=-sysv4
+	svr4*)
+		os=sysv4
 		;;
-	-svr3)
-		os=-sysv3
+	svr3)
+		os=sysv3
 		;;
-	-sysvr4)
-		os=-sysv4
+	sysvr4)
+		os=sysv4
 		;;
-	# This must come after -sysvr4.
-	-sysv*)
+	ose*)
+		os=ose
 		;;
-	-ose*)
-		os=-ose
+	*mint | mint[0-9]* | *MiNT | MiNT[0-9]*)
+		os=mint
 		;;
-	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
-		os=-mint
+	dicos*)
+		os=dicos
 		;;
-	-zvmoe)
-		os=-zvmoe
-		;;
-	-dicos*)
-		os=-dicos
-		;;
-	-pikeos*)
+	pikeos*)
 		# Until real need of OS specific support for
 		# particular features comes up, bare metal
 		# configurations are quite functional.
-		case $basic_machine in
+		case $cpu in
 		    arm*)
-			os=-eabi
+			os=eabi
 			;;
 		    *)
-			os=-elf
+			os=elf
 			;;
 		esac
 		;;
-	-nacl*)
-		;;
-	-ios)
-		;;
-	-none)
-		;;
 	*)
-		# Get rid of the `-' at the beginning of $os.
-		os=`echo $os | sed 's/[^-]*-//'`
-		echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2
-		exit 1
+		# No normalization, but not necessarily accepted, that comes below.
 		;;
 esac
+
 else
 
 # Here we handle the default operating systems that come with various machines.
@@ -1547,254 +1522,358 @@
 # will signal an error saying that MANUFACTURER isn't an operating
 # system, and we'll never get to this point.
 
-case $basic_machine in
+kernel=
+case $cpu-$vendor in
 	score-*)
-		os=-elf
+		os=elf
 		;;
 	spu-*)
-		os=-elf
+		os=elf
 		;;
 	*-acorn)
-		os=-riscix1.2
+		os=riscix1.2
 		;;
 	arm*-rebel)
-		os=-linux
+		kernel=linux
+		os=gnu
 		;;
 	arm*-semi)
-		os=-aout
+		os=aout
 		;;
 	c4x-* | tic4x-*)
-		os=-coff
+		os=coff
 		;;
 	c8051-*)
-		os=-elf
+		os=elf
+		;;
+	clipper-intergraph)
+		os=clix
 		;;
 	hexagon-*)
-		os=-elf
+		os=elf
 		;;
 	tic54x-*)
-		os=-coff
+		os=coff
 		;;
 	tic55x-*)
-		os=-coff
+		os=coff
 		;;
 	tic6x-*)
-		os=-coff
+		os=coff
 		;;
 	# This must come before the *-dec entry.
 	pdp10-*)
-		os=-tops20
+		os=tops20
 		;;
 	pdp11-*)
-		os=-none
+		os=none
 		;;
 	*-dec | vax-*)
-		os=-ultrix4.2
+		os=ultrix4.2
 		;;
 	m68*-apollo)
-		os=-domain
+		os=domain
 		;;
 	i386-sun)
-		os=-sunos4.0.2
+		os=sunos4.0.2
 		;;
 	m68000-sun)
-		os=-sunos3
+		os=sunos3
 		;;
 	m68*-cisco)
-		os=-aout
+		os=aout
 		;;
 	mep-*)
-		os=-elf
+		os=elf
 		;;
 	mips*-cisco)
-		os=-elf
+		os=elf
 		;;
 	mips*-*)
-		os=-elf
+		os=elf
 		;;
 	or32-*)
-		os=-coff
+		os=coff
 		;;
 	*-tti)	# must be before sparc entry or we get the wrong os.
-		os=-sysv3
+		os=sysv3
 		;;
 	sparc-* | *-sun)
-		os=-sunos4.1.1
+		os=sunos4.1.1
 		;;
 	pru-*)
-		os=-elf
+		os=elf
 		;;
 	*-be)
-		os=-beos
+		os=beos
 		;;
 	*-ibm)
-		os=-aix
+		os=aix
 		;;
 	*-knuth)
-		os=-mmixware
+		os=mmixware
 		;;
 	*-wec)
-		os=-proelf
+		os=proelf
 		;;
 	*-winbond)
-		os=-proelf
+		os=proelf
 		;;
 	*-oki)
-		os=-proelf
+		os=proelf
 		;;
 	*-hp)
-		os=-hpux
+		os=hpux
 		;;
 	*-hitachi)
-		os=-hiux
+		os=hiux
 		;;
 	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
-		os=-sysv
+		os=sysv
 		;;
 	*-cbm)
-		os=-amigaos
+		os=amigaos
 		;;
 	*-dg)
-		os=-dgux
+		os=dgux
 		;;
 	*-dolphin)
-		os=-sysv3
+		os=sysv3
 		;;
 	m68k-ccur)
-		os=-rtu
+		os=rtu
 		;;
 	m88k-omron*)
-		os=-luna
+		os=luna
 		;;
 	*-next)
-		os=-nextstep
+		os=nextstep
 		;;
 	*-sequent)
-		os=-ptx
+		os=ptx
 		;;
 	*-crds)
-		os=-unos
+		os=unos
 		;;
 	*-ns)
-		os=-genix
+		os=genix
 		;;
 	i370-*)
-		os=-mvs
+		os=mvs
 		;;
 	*-gould)
-		os=-sysv
+		os=sysv
 		;;
 	*-highlevel)
-		os=-bsd
+		os=bsd
 		;;
 	*-encore)
-		os=-bsd
+		os=bsd
 		;;
 	*-sgi)
-		os=-irix
+		os=irix
 		;;
 	*-siemens)
-		os=-sysv4
+		os=sysv4
 		;;
 	*-masscomp)
-		os=-rtu
+		os=rtu
 		;;
 	f30[01]-fujitsu | f700-fujitsu)
-		os=-uxpv
+		os=uxpv
 		;;
 	*-rom68k)
-		os=-coff
+		os=coff
 		;;
 	*-*bug)
-		os=-coff
+		os=coff
 		;;
 	*-apple)
-		os=-macos
+		os=macos
 		;;
 	*-atari*)
-		os=-mint
+		os=mint
+		;;
+	*-wrs)
+		os=vxworks
 		;;
 	*)
-		os=-none
+		os=none
 		;;
 esac
+
 fi
 
+# Now, validate our (potentially fixed-up) OS.
+case $os in
+	# Sometimes we do "kernel-libc", so those need to count as OSes.
+	musl* | newlib* | relibc* | uclibc*)
+		;;
+	# Likewise for "kernel-abi"
+	eabi* | gnueabi*)
+		;;
+	# VxWorks passes extra cpu info in the 4th filed.
+	simlinux | simwindows | spe)
+		;;
+	# Now accept the basic system types.
+	# The portable systems comes first.
+	# Each alternative MUST end in a * to match a version number.
+	gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \
+	     | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \
+	     | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
+	     | sym* |  plan9* | psp* | sim* | xray* | os68k* | v88r* \
+	     | hiux* | abug | nacl* | netware* | windows* \
+	     | os9* | macos* | osx* | ios* \
+	     | mpw* | magic* | mmixware* | mon960* | lnews* \
+	     | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
+	     | aos* | aros* | cloudabi* | sortix* | twizzler* \
+	     | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
+	     | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \
+	     | mirbsd* | netbsd* | dicos* | openedition* | ose* \
+	     | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \
+	     | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \
+	     | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
+	     | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
+	     | udi* | lites* | ieee* | go32* | aux* | hcos* \
+	     | chorusrdb* | cegcc* | glidix* | serenity* \
+	     | cygwin* | msys* | pe* | moss* | proelf* | rtems* \
+	     | midipix* | mingw32* | mingw64* | mint* \
+	     | uxpv* | beos* | mpeix* | udk* | moxiebox* \
+	     | interix* | uwin* | mks* | rhapsody* | darwin* \
+	     | openstep* | oskit* | conix* | pw32* | nonstopux* \
+	     | storm-chaos* | tops10* | tenex* | tops20* | its* \
+	     | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \
+	     | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \
+	     | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \
+	     | skyos* | haiku* | rdos* | toppers* | drops* | es* \
+	     | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
+	     | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
+	     | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr*)
+		;;
+	# This one is extra strict with allowed versions
+	sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
+		# Don't forget version if it is 3.2v4 or newer.
+		;;
+	none)
+		;;
+	*)
+		echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2
+		exit 1
+		;;
+esac
+
+# As a final step for OS-related things, validate the OS-kernel combination
+# (given a valid OS), if there is a kernel.
+case $kernel-$os in
+	linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \
+		   | linux-musl* | linux-relibc* | linux-uclibc* )
+		;;
+	uclinux-uclibc* )
+		;;
+	-dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* )
+		# These are just libc implementations, not actual OSes, and thus
+		# require a kernel.
+		echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2
+		exit 1
+		;;
+	kfreebsd*-gnu* | kopensolaris*-gnu*)
+		;;
+	vxworks-simlinux | vxworks-simwindows | vxworks-spe)
+		;;
+	nto-qnx*)
+		;;
+	os2-emx)
+		;;
+	*-eabi* | *-gnueabi*)
+		;;
+	-*)
+		# Blank kernel with real OS is always fine.
+		;;
+	*-*)
+		echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2
+		exit 1
+		;;
+esac
+
 # Here we handle the case where we know the os, and the CPU type, but not the
 # manufacturer.  We pick the logical manufacturer.
-vendor=unknown
-case $basic_machine in
-	*-unknown)
-		case $os in
-			-riscix*)
+case $vendor in
+	unknown)
+		case $cpu-$os in
+			*-riscix*)
 				vendor=acorn
 				;;
-			-sunos*)
+			*-sunos*)
 				vendor=sun
 				;;
-			-cnk*|-aix*)
+			*-cnk* | *-aix*)
 				vendor=ibm
 				;;
-			-beos*)
+			*-beos*)
 				vendor=be
 				;;
-			-hpux*)
+			*-hpux*)
 				vendor=hp
 				;;
-			-mpeix*)
+			*-mpeix*)
 				vendor=hp
 				;;
-			-hiux*)
+			*-hiux*)
 				vendor=hitachi
 				;;
-			-unos*)
+			*-unos*)
 				vendor=crds
 				;;
-			-dgux*)
+			*-dgux*)
 				vendor=dg
 				;;
-			-luna*)
+			*-luna*)
 				vendor=omron
 				;;
-			-genix*)
+			*-genix*)
 				vendor=ns
 				;;
-			-mvs* | -opened*)
+			*-clix*)
+				vendor=intergraph
+				;;
+			*-mvs* | *-opened*)
 				vendor=ibm
 				;;
-			-os400*)
+			*-os400*)
 				vendor=ibm
 				;;
-			-ptx*)
+			s390-* | s390x-*)
+				vendor=ibm
+				;;
+			*-ptx*)
 				vendor=sequent
 				;;
-			-tpf*)
+			*-tpf*)
 				vendor=ibm
 				;;
-			-vxsim* | -vxworks* | -windiss*)
+			*-vxsim* | *-vxworks* | *-windiss*)
 				vendor=wrs
 				;;
-			-aux*)
+			*-aux*)
 				vendor=apple
 				;;
-			-hms*)
+			*-hms*)
 				vendor=hitachi
 				;;
-			-mpw* | -macos*)
+			*-mpw* | *-macos*)
 				vendor=apple
 				;;
-			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+			*-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*)
 				vendor=atari
 				;;
-			-vos*)
+			*-vos*)
 				vendor=stratus
 				;;
 		esac
-		basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"`
 		;;
 esac
 
-echo "$basic_machine$os"
+echo "$cpu-$vendor-${kernel:+$kernel-}$os"
 exit
 
 # Local variables:
diff --git a/configure b/configure
index 2d379fe..0cc86f9 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for python 3.9.
+# Generated by GNU Autoconf 2.69 for python 3.10.
 #
 # Report bugs to <https://bugs.python.org/>.
 #
@@ -580,8 +580,8 @@
 # Identity of this package.
 PACKAGE_NAME='python'
 PACKAGE_TARNAME='python'
-PACKAGE_VERSION='3.9'
-PACKAGE_STRING='python 3.9'
+PACKAGE_VERSION='3.10'
+PACKAGE_STRING='python 3.10'
 PACKAGE_BUGREPORT='https://bugs.python.org/'
 PACKAGE_URL=''
 
@@ -623,12 +623,17 @@
 #endif"
 
 ac_subst_vars='LTLIBOBJS
+TEST_MODULES
+LIBRARY_DEPS
+STATIC_LIBPYTHON
+OPENSSL_RPATH
 OPENSSL_LDFLAGS
 OPENSSL_LIBS
 OPENSSL_INCLUDES
 ENSUREPIP
 SRCDIRS
 THREADHEADERS
+WHEEL_PKG_DIR
 LIBPL
 PY_ENABLE_SHARED
 PLATLIBDIR
@@ -747,6 +752,7 @@
 PYTHONFRAMEWORKDIR
 PYTHONFRAMEWORKIDENTIFIER
 PYTHONFRAMEWORK
+LIPO_INTEL64_FLAGS
 LIPO_32BIT_FLAGS
 ARCH_RUN_32BIT
 UNIVERSALSDK
@@ -787,6 +793,7 @@
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -822,11 +829,11 @@
 with_assertions
 enable_optimizations
 with_lto
-with_hash_algorithm
-with_tzpath
 with_address_sanitizer
 with_memory_sanitizer
 with_undefined_behavior_sanitizer
+with_hash_algorithm
+with_tzpath
 with_libs
 with_system_expat
 with_system_ffi
@@ -846,11 +853,17 @@
 with_libc
 enable_big_digits
 with_platlibdir
+with_wheel_pkg_dir
+with_readline
 with_computed_gotos
 with_ensurepip
 with_openssl
+with_openssl_rpath
 with_ssl_default_suites
 with_builtin_hashlib_hashes
+with_experimental_isolated_subinterpreters
+with_static_libpython
+enable_test_modules
 '
       ac_precious_vars='build_alias
 host_alias
@@ -904,6 +917,7 @@
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1156,6 +1170,15 @@
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1293,7 +1316,7 @@
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
+		libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1406,7 +1429,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures python 3.9 to adapt to many kinds of systems.
+\`configure' configures python 3.10 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1446,6 +1469,7 @@
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
@@ -1471,7 +1495,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of python 3.9:";;
+     short | recursive ) echo "Configuration of python 3.10:";;
    esac
   cat <<\_ACEOF
 
@@ -1502,16 +1526,18 @@
   --enable-big-digits[=15|30]
                           use big digits (30 or 15 bits) for Python longs
                           (default is system-dependent)]
+  --disable-test-modules  don't build nor install test modules
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
   --with-universal-archs=ARCH
-                          specify the kind of universal binary that should be
-                          created. this option is only valid when
+                          specify the kind of macOS universal binary that
+                          should be created. This option is only valid when
                           --enable-universalsdk is set; options are:
-                          ("universal2", "32-bit", "64-bit", "3-way", "intel",
-                          "intel-32", "intel-64", or "all") see Mac/README.rst
+                          ("universal2", "intel-64", "intel-32", "intel",
+                          "32-bit", "64-bit", "3-way", or "all") see
+                          Mac/README.rst
   --with-framework-name=FRAMEWORK
                           specify the name for the python framework on macOS
                           only valid when --enable-framework is set. see
@@ -1526,12 +1552,6 @@
   --with-assertions       build with C assertions enabled (default is no)
   --with-lto              enable Link-Time-Optimization in any build (default
                           is no)
-  --with-hash-algorithm=[fnv|siphash24]
-                          select hash algorithm for use in Python/pyhash.c
-                          (default is SipHash24)
-  --with-tzpath=<list of absolute paths separated by pathsep>
-                           Select the default time zone search path for zoneinfo.TZPATH
-
   --with-address-sanitizer
                           enable AddressSanitizer memory error detector,
                           'asan' (default is no)
@@ -1540,6 +1560,12 @@
   --with-undefined-behavior-sanitizer
                           enable UndefinedBehaviorSanitizer undefined
                           behaviour detector, 'ubsan' (default is no)
+  --with-hash-algorithm=[fnv|siphash24]
+                          select hash algorithm for use in Python/pyhash.c
+                          (default is SipHash24)
+  --with-tzpath=<list of absolute paths separated by pathsep>
+                           Select the default time zone search path for zoneinfo.TZPATH
+
   --with-libs='lib1 ...'  link against additional libs (default is no)
   --with-system-expat     build pyexpat module using an installed expat
                           library, see Doc/library/pyexpat.rst (default is no)
@@ -1572,21 +1598,37 @@
                           system-dependent)
   --with-platlibdir=DIRNAME
                           Python library directory name (default is "lib")
+  --with-wheel-pkg-dir=PATH
+                          Directory of wheel packages used by ensurepip
+                          (default: none)
+  --with(out)-readline[=editline]
+                          use Editline for backend or disable readline module
   --with-computed-gotos   enable computed gotos in evaluation loop (enabled by
                           default on supported compilers)
   --with-ensurepip[=install|upgrade|no]
                           "install" or "upgrade" using bundled pip (default is
                           upgrade)
-  --with-openssl=DIR      override root of the OpenSSL directory to DIR
+  --with-openssl=DIR      root of the OpenSSL directory
+  --with-openssl-rpath=[DIR|auto|no]
+                          Set runtime library directory (rpath) for OpenSSL
+                          libraries, no (default): don't set rpath, auto:
+                          auto-detect rpath from --with-openssl and
+                          pkg-config, DIR: set an explicit rpath
   --with-ssl-default-suites=[python|openssl|STRING]
                           override default cipher suites string, python: use
                           Python's preferred selection (default), openssl:
                           leave OpenSSL's defaults untouched, STRING: use a
-                          custom string, PROTOCOL_SSLv2 ignores the setting,
-                          see Doc/library/ssl.rst
+                          custom string, python and STRING also set TLS 1.2 as
+                          minimum TLS version
   --with-builtin-hashlib-hashes=md5,sha1,sha256,sha512,sha3,blake2
                           builtin hash modules, md5, sha1, sha256, sha512,
                           sha3 (with shake), blake2
+  --with-experimental-isolated-subinterpreters
+                          better isolate subinterpreters, experimental build
+                          mode (default is no)
+  --without-static-libpython
+                          do not build libpythonMAJOR.MINOR.a and do not
+                          install python.o (default is yes)
 
 Some influential environment variables:
   MACHDEP     name for machine-dependent library files
@@ -1672,7 +1714,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-python configure 3.9
+python configure 3.10
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2381,7 +2423,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by python $as_me 3.9, which was
+It was created by python $as_me 3.10, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2737,7 +2779,7 @@
     # If we're building out-of-tree, we need to make sure the following
     # resources get picked up before their $srcdir counterparts.
     #   Objects/ -> typeslots.inc
-    #   Include/ -> Python-ast.h, graminit.h
+    #   Include/ -> Python.h
     #   Python/  -> importlib.h
     # (A side effect of this is that these resources will automatically be
     #  regenerated when building out-of-tree, regardless of whether or not
@@ -3001,7 +3043,7 @@
 mv confdefs.h.new confdefs.h
 
 
-VERSION=3.9
+VERSION=3.10
 
 # Version number of Python's own shared library file.
 
@@ -3111,6 +3153,7 @@
 fi
 
 
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-universal-archs" >&5
 $as_echo_n "checking for --with-universal-archs... " >&6; }
 
@@ -3426,16 +3469,6 @@
     define_xopen_source=no;;
   Darwin/[12][0-9].*)
     define_xopen_source=no;;
-  # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
-  # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
-  # or has another value. By not (re)defining it, the defaults come in place.
-  AIX/4)
-    define_xopen_source=no;;
-  AIX/5)
-    if test `uname -r` -eq 1; then
-      define_xopen_source=no
-    fi
-    ;;
   # On QNX 6.3.2, defining _XOPEN_SOURCE prevents netdb.h from
   # defining NI_NUMERICHOST.
   QNX/6.3.2)
@@ -5193,9 +5226,6 @@
 fi
 
 
-MULTIARCH=$($CC --print-multiarch 2>/dev/null)
-
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the platform triplet based on compiler characteristics" >&5
 $as_echo_n "checking for the platform triplet based on compiler characteristics... " >&6; }
 cat >> conftest.c <<EOF
@@ -5354,6 +5384,21 @@
 fi
 rm -f conftest.c conftest.out
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for multiarch" >&5
+$as_echo_n "checking for multiarch... " >&6; }
+case $ac_sys_system in #(
+  Darwin*) :
+    MULTIARCH="" ;; #(
+  FreeBSD*) :
+    MULTIARCH="" ;; #(
+  *) :
+    MULTIARCH=$($CC --print-multiarch 2>/dev/null)
+ ;;
+esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MULTIARCH" >&5
+$as_echo "$MULTIARCH" >&6; }
+
 if test x$PLATFORM_TRIPLET != x && test x$MULTIARCH != x; then
   if test x$PLATFORM_TRIPLET != x$MULTIARCH; then
     as_fn_error $? "internal configure error for the platform triplet, please file a bug report" "$LINENO" 5
@@ -5362,6 +5407,7 @@
   MULTIARCH=$PLATFORM_TRIPLET
 fi
 
+
 if test x$MULTIARCH != x; then
   MULTIARCH_CPPFLAGS="-DMULTIARCH=\\\"$MULTIARCH\\\""
 fi
@@ -5824,10 +5870,7 @@
 case $ac_sys_system in
 AIX*)
 	EXPORTSYMS="Modules/python.exp"
-	if test $ac_sys_release -ge 5 -o \
-		$ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
-	    EXPORTSFROM=. # the main executable
-	fi
+	EXPORTSFROM=. # the main executable
 	;;
 esac
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $EXPORTSYMS" >&5
@@ -5946,7 +5989,7 @@
 	      PY3LIBRARY=libpython3.so
 	  fi
           ;;
-    Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*)
+    Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*|VxWorks*)
 	  LDLIBRARY='libpython$(LDVERSION).so'
 	  BLDLIBRARY='-L. -lpython$(LDVERSION)'
 	  RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
@@ -6478,6 +6521,50 @@
   DEF_MAKE_ALL_RULE="profile-opt"
   REQUIRE_PGO="yes"
   DEF_MAKE_RULE="build_all"
+  case $CC in
+    *gcc*)
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fno-semantic-interposition" >&5
+$as_echo_n "checking whether C compiler accepts -fno-semantic-interposition... " >&6; }
+if ${ax_cv_check_cflags___fno_semantic_interposition+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+  ax_check_save_flags=$CFLAGS
+  CFLAGS="$CFLAGS  -fno-semantic-interposition"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ax_cv_check_cflags___fno_semantic_interposition=yes
+else
+  ax_cv_check_cflags___fno_semantic_interposition=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CFLAGS=$ax_check_save_flags
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fno_semantic_interposition" >&5
+$as_echo "$ax_cv_check_cflags___fno_semantic_interposition" >&6; }
+if test "x$ax_cv_check_cflags___fno_semantic_interposition" = xyes; then :
+
+      CFLAGS_NODIST="$CFLAGS_NODIST -fno-semantic-interposition"
+      LDFLAGS_NODIST="$LDFLAGS_NODIST -fno-semantic-interposition"
+
+else
+  :
+fi
+
+      ;;
+  esac
+
+
 else
   DEF_MAKE_ALL_RULE="build_all"
   REQUIRE_PGO="no"
@@ -6489,7 +6576,7 @@
 $as_echo_n "checking PROFILE_TASK... " >&6; }
 if test -z "$PROFILE_TASK"
 then
-	PROFILE_TASK='-m test --pgo'
+	PROFILE_TASK='-m test --pgo --timeout=$(TESTTIMEOUT)'
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PROFILE_TASK" >&5
 $as_echo "$PROFILE_TASK" >&6; }
@@ -6647,10 +6734,11 @@
       fi
       if test "$ac_sys_system" = "Darwin" -a "${LLVM_AR_FOUND}" = "not-found"
       then
-        found_llvm_ar=`/usr/bin/xcrun -find llvm-ar 2>/dev/null`
+        # The Apple-supplied ar in Xcode or the Command Line Tools is apparently sufficient
+        found_llvm_ar=`/usr/bin/xcrun -find ar 2>/dev/null`
         if test -n "${found_llvm_ar}"
         then
-          LLVM_AR='/usr/bin/xcrun llvm-ar'
+          LLVM_AR='/usr/bin/xcrun ar'
           LLVM_AR_FOUND=found
           { $as_echo "$as_me:${as_lineno-$LINENO}: llvm-ar found via xcrun: ${LLVM_AR}" >&5
 $as_echo "$as_me: llvm-ar found via xcrun: ${LLVM_AR}" >&6;}
@@ -6668,6 +6756,7 @@
         Darwin*)
           # Any changes made here should be reflected in the GCC+Darwin case below
           LTOFLAGS="-flto -Wl,-export_dynamic"
+          LTOCFLAGS="-flto"
           ;;
         *)
           LTOFLAGS="-flto"
@@ -6678,6 +6767,7 @@
       case $ac_sys_system in
         Darwin*)
           LTOFLAGS="-flto -Wl,-export_dynamic"
+          LTOCFLAGS="-flto"
           ;;
         *)
           LTOFLAGS="-flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none"
@@ -6693,7 +6783,7 @@
       LTOFLAGS="$LTOFLAGS -g"
   fi
 
-  CFLAGS_NODIST="$CFLAGS_NODIST $LTOFLAGS"
+  CFLAGS_NODIST="$CFLAGS_NODIST ${LTOCFLAGS-$LTOFLAGS}"
   LDFLAGS_NODIST="$LDFLAGS_NODIST $LTOFLAGS"
 fi
 
@@ -7463,6 +7553,7 @@
 $as_echo "$CC" >&6; }
         fi
 
+        LIPO_INTEL64_FLAGS=""
         if test "${enable_universalsdk}"
         then
             case "$UNIVERSAL_ARCHS" in
@@ -7484,8 +7575,9 @@
             universal2)
                UNIVERSAL_ARCH_FLAGS="-arch arm64 -arch x86_64"
                LIPO_32BIT_FLAGS=""
+               LIPO_INTEL64_FLAGS="-extract x86_64"
                ARCH_RUN_32BIT="true"
-		;;
+               ;;
             intel)
                UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
                LIPO_32BIT_FLAGS="-extract i386"
@@ -8009,7 +8101,8 @@
 sys/times.h sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h pty.h \
 libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
 linux/tipc.h linux/random.h spawn.h util.h alloca.h endian.h \
-sys/endian.h sys/sysmacros.h linux/memfd.h linux/wait.h sys/memfd.h sys/mman.h
+sys/endian.h sys/sysmacros.h linux/auxvec.h linux/memfd.h linux/wait.h sys/memfd.h \
+sys/mman.h sys/eventfd.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -8584,7 +8677,7 @@
 fi
 
 
-# Sizes of various common basic types
+# Sizes and alignments of various common basic types
 # ANSI C requires sizeof(char) == 1, so no need to check it
 # The cast to long int works around a bug in the HP C Compiler
 # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
@@ -8652,6 +8745,41 @@
 _ACEOF
 
 
+# The cast to long int works around a bug in the HP C Compiler,
+# see AC_CHECK_SIZEOF for more information.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking alignment of long" >&5
+$as_echo_n "checking alignment of long... " >&6; }
+if ${ac_cv_alignof_long+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_c_compute_int "$LINENO" "(long int) offsetof (ac__type_alignof_, y)" "ac_cv_alignof_long"        "$ac_includes_default
+#ifndef offsetof
+# define offsetof(type, member) ((char *) &((type *) 0)->member - (char *) 0)
+#endif
+typedef struct { char x; long y; } ac__type_alignof_;"; then :
+
+else
+  if test "$ac_cv_type_long" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute alignment of long
+See \`config.log' for more details" "$LINENO" 5; }
+   else
+     ac_cv_alignof_long=0
+   fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_alignof_long" >&5
+$as_echo "$ac_cv_alignof_long" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define ALIGNOF_LONG $ac_cv_alignof_long
+_ACEOF
+
+
 # The cast to long int works around a bug in the HP C Compiler
 # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
 # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
@@ -8883,6 +9011,41 @@
 _ACEOF
 
 
+# The cast to long int works around a bug in the HP C Compiler,
+# see AC_CHECK_SIZEOF for more information.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking alignment of size_t" >&5
+$as_echo_n "checking alignment of size_t... " >&6; }
+if ${ac_cv_alignof_size_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_c_compute_int "$LINENO" "(long int) offsetof (ac__type_alignof_, y)" "ac_cv_alignof_size_t"        "$ac_includes_default
+#ifndef offsetof
+# define offsetof(type, member) ((char *) &((type *) 0)->member - (char *) 0)
+#endif
+typedef struct { char x; size_t y; } ac__type_alignof_;"; then :
+
+else
+  if test "$ac_cv_type_size_t" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute alignment of size_t
+See \`config.log' for more details" "$LINENO" 5; }
+   else
+     ac_cv_alignof_size_t=0
+   fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_alignof_size_t" >&5
+$as_echo "$ac_cv_alignof_size_t" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define ALIGNOF_SIZE_T $ac_cv_alignof_size_t
+_ACEOF
+
+
 # The cast to long int works around a bug in the HP C Compiler
 # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
 # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
@@ -9426,6 +9589,101 @@
 	;;
 esac
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-address-sanitizer" >&5
+$as_echo_n "checking for --with-address-sanitizer... " >&6; }
+
+# Check whether --with-address_sanitizer was given.
+if test "${with_address_sanitizer+set}" = set; then :
+  withval=$with_address_sanitizer;
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $withval" >&5
+$as_echo "$withval" >&6; }
+BASECFLAGS="-fsanitize=address -fno-omit-frame-pointer $BASECFLAGS"
+LDFLAGS="-fsanitize=address $LDFLAGS"
+# ASan works by controlling memory allocation, our own malloc interferes.
+with_pymalloc="no"
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-memory-sanitizer" >&5
+$as_echo_n "checking for --with-memory-sanitizer... " >&6; }
+
+# Check whether --with-memory_sanitizer was given.
+if test "${with_memory_sanitizer+set}" = set; then :
+  withval=$with_memory_sanitizer;
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $withval" >&5
+$as_echo "$withval" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fsanitize=memory" >&5
+$as_echo_n "checking whether C compiler accepts -fsanitize=memory... " >&6; }
+if ${ax_cv_check_cflags___fsanitize_memory+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+  ax_check_save_flags=$CFLAGS
+  CFLAGS="$CFLAGS  -fsanitize=memory"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ax_cv_check_cflags___fsanitize_memory=yes
+else
+  ax_cv_check_cflags___fsanitize_memory=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CFLAGS=$ax_check_save_flags
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fsanitize_memory" >&5
+$as_echo "$ax_cv_check_cflags___fsanitize_memory" >&6; }
+if test "x$ax_cv_check_cflags___fsanitize_memory" = xyes; then :
+
+BASECFLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer $BASECFLAGS"
+LDFLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2 $LDFLAGS"
+
+else
+  as_fn_error $? "The selected compiler doesn't support memory sanitizer" "$LINENO" 5
+fi
+
+# MSan works by controlling memory allocation, our own malloc interferes.
+with_pymalloc="no"
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-undefined-behavior-sanitizer" >&5
+$as_echo_n "checking for --with-undefined-behavior-sanitizer... " >&6; }
+
+# Check whether --with-undefined_behavior_sanitizer was given.
+if test "${with_undefined_behavior_sanitizer+set}" = set; then :
+  withval=$with_undefined_behavior_sanitizer;
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $withval" >&5
+$as_echo "$withval" >&6; }
+BASECFLAGS="-fsanitize=undefined $BASECFLAGS"
+LDFLAGS="-fsanitize=undefined $LDFLAGS"
+with_ubsan="yes"
+
+else
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+with_ubsan="no"
+
+fi
+
+
 # Set info about shared libraries.
 
 
@@ -9521,19 +9779,7 @@
 		   test ${dep_target_minor} -le 2
 		then
 			# building for OS X 10.0 through 10.2
-			LDSHARED='$(CC) -bundle'
-			LDCXXSHARED='$(CXX) -bundle'
-			if test "$enable_framework" ; then
-				# Link against the framework. All externals should be defined.
-				BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
-				LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
-				LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
-			else
-				# No framework, use the Python app as bundle-loader
-				BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
-				LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
-				LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
-			fi
+			as_fn_error $? "MACOSX_DEPLOYMENT_TARGET too old ($MACOSX_DEPLOYMENT_TARGET), only 10.3 or later is supported" "$LINENO" 5
 		else
 			# building for OS X 10.3 and later
 			LDSHARED='$(CC) -bundle -undefined dynamic_lookup'
@@ -9648,9 +9894,20 @@
 		# Issue #18075: the default maximum stack size (8MBytes) is too
 		# small for the default recursion limit. Increase the stack size
 		# to ensure that tests don't crash
-		# Note: This matches the value of THREAD_STACK_SIZE in
-		# thread_pthread.h
-		LINKFORSHARED="-Wl,-stack_size,1000000 $LINKFORSHARED"
+    stack_size="1000000"  # 16 MB
+    if test "$with_ubsan" = "yes"
+    then
+        # Undefined behavior sanitizer requires an even deeper stack
+        stack_size="4000000"  # 64 MB
+    fi
+
+    LINKFORSHARED="-Wl,-stack_size,$stack_size $LINKFORSHARED"
+
+
+cat >>confdefs.h <<_ACEOF
+#define THREAD_STACK_SIZE 0x$stack_size
+_ACEOF
+
 
 		if test "$enable_framework"
 		then
@@ -9685,7 +9942,7 @@
 		# when running test_compile.py.
 		LINKFORSHARED='-Wl,-E -N 2048K';;
 	VxWorks*)
-		LINKFORSHARED='--export-dynamic';;
+		LINKFORSHARED='-Wl,-export-dynamic';;
 	esac
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LINKFORSHARED" >&5
@@ -9910,8 +10167,57 @@
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
+# check for libuuid from util-linux
+save_LIBS=$LIBS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid_generate_time in -luuid" >&5
+$as_echo_n "checking for uuid_generate_time in -luuid... " >&6; }
+if ${ac_cv_lib_uuid_uuid_generate_time+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-luuid  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char uuid_generate_time ();
+int
+main ()
+{
+return uuid_generate_time ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_uuid_uuid_generate_time=yes
+else
+  ac_cv_lib_uuid_uuid_generate_time=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_uuid_uuid_generate_time" >&5
+$as_echo "$ac_cv_lib_uuid_uuid_generate_time" >&6; }
+if test "x$ac_cv_lib_uuid_uuid_generate_time" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBUUID 1
+_ACEOF
+
+  LIBS="-luuid $LIBS"
+
+fi
+
+LIBS=$save_LIBS
+
 # AIX provides support for RFC4122 (uuid) in libc.a starting with AIX 6.1 (anno 2007)
-# FreeBSD and OpenBSD provides support as well
+# FreeBSD and OpenBSD provides support in libc as well.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid_create" >&5
 $as_echo_n "checking for uuid_create... " >&6; }
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -10213,7 +10519,7 @@
     fi
 
     # Bad paths are those that don't start with /
-        if ( echo $1 | grep -qE '(^|:)([^/]|$)' ); then
+        if ( echo $1 | grep '\(^\|:\)\([^/]\|$\)' > /dev/null); then
         as_fn_error $? "--with-tzpath must contain only absolute paths, not $1" "$LINENO" 5
         return 1;
     fi
@@ -10246,61 +10552,6 @@
 
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-address-sanitizer" >&5
-$as_echo_n "checking for --with-address-sanitizer... " >&6; }
-
-# Check whether --with-address_sanitizer was given.
-if test "${with_address_sanitizer+set}" = set; then :
-  withval=$with_address_sanitizer;
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $withval" >&5
-$as_echo "$withval" >&6; }
-BASECFLAGS="-fsanitize=address -fno-omit-frame-pointer $BASECFLAGS"
-LDFLAGS="-fsanitize=address $LDFLAGS"
-# ASan works by controlling memory allocation, our own malloc interferes.
-with_pymalloc="no"
-
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-memory-sanitizer" >&5
-$as_echo_n "checking for --with-memory-sanitizer... " >&6; }
-
-# Check whether --with-memory_sanitizer was given.
-if test "${with_memory_sanitizer+set}" = set; then :
-  withval=$with_memory_sanitizer;
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $withval" >&5
-$as_echo "$withval" >&6; }
-BASECFLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer $BASECFLAGS"
-LDFLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2 $LDFLAGS"
-# MSan works by controlling memory allocation, our own malloc interferes.
-with_pymalloc="no"
-
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-undefined-behavior-sanitizer" >&5
-$as_echo_n "checking for --with-undefined-behavior-sanitizer... " >&6; }
-
-# Check whether --with-undefined_behavior_sanitizer was given.
-if test "${with_undefined_behavior_sanitizer+set}" = set; then :
-  withval=$with_undefined_behavior_sanitizer;
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $withval" >&5
-$as_echo "$withval" >&6; }
-BASECFLAGS="-fsanitize=undefined $BASECFLAGS"
-LDFLAGS="-fsanitize=undefined $LDFLAGS"
-
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
 # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for t_open in -lnsl" >&5
 $as_echo_n "checking for t_open in -lnsl... " >&6; }
@@ -10661,8 +10912,13 @@
   then
     as_fn_error $? "use both --with-tcltk-includes='...' and --with-tcltk-libs='...' or neither" "$LINENO" 5
   fi
-  TCLTK_INCLUDES=""
-  TCLTK_LIBS=""
+  if test -n "$PKG_CONFIG" && "$PKG_CONFIG" --exists tcl tk; then
+    TCLTK_INCLUDES="`"$PKG_CONFIG" tcl tk --cflags-only-I 2>/dev/null`"
+    TCLTK_LIBS="`"$PKG_CONFIG" tcl tk --libs 2>/dev/null`"
+  else
+    TCLTK_INCLUDES=""
+    TCLTK_LIBS=""
+  fi
 else
   TCLTK_INCLUDES="$with_tcltk_includes"
   TCLTK_LIBS="$with_tcltk_libs"
@@ -11072,10 +11328,10 @@
       main() {
         pthread_attr_t attr;
         pthread_t id;
-        if (pthread_attr_init(&attr)) exit(-1);
-        if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
-        if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
-        exit(0);
+        if (pthread_attr_init(&attr)) return (-1);
+        if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) return (-1);
+        if (pthread_create(&id, &attr, foo, NULL)) return (-1);
+        return (0);
       }
 _ACEOF
 if ac_fn_c_try_run "$LINENO"; then :
@@ -11633,7 +11889,7 @@
 DLINCLDIR=.
 
 # the dlopen() function means we might want to use dynload_shlib.o. some
-# platforms, such as AIX, have dlopen(), but don't want to use it.
+# platforms have dlopen(), but don't want to use it.
 for ac_func in dlopen
 do :
   ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
@@ -11654,12 +11910,6 @@
 if test -z "$DYNLOADFILE"
 then
 	case $ac_sys_system/$ac_sys_release in
-	AIX*) # Use dynload_shlib.c and dlopen() if we have it; otherwise dynload_aix.c
-	if test "$ac_cv_func_dlopen" = yes
-	then DYNLOADFILE="dynload_shlib.o"
-	else DYNLOADFILE="dynload_aix.o"
-	fi
-	;;
 	hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
 	*)
 	# use dynload_shlib.c and dlopen() if we have it; otherwise stub
@@ -11701,8 +11951,8 @@
 
 # checks for library functions
 for ac_func in alarm accept4 setitimer getitimer bind_textdomain_codeset chown \
- clock confstr copy_file_range ctermid dup3 execv explicit_bzero explicit_memset \
- faccessat fchmod fchmodat fchown fchownat \
+ clock confstr close_range copy_file_range ctermid dup3 execv explicit_bzero \
+ explicit_memset faccessat fchmod fchmodat fchown fchownat \
  fdwalk fexecve fdopendir fork fpathconf fstatat ftime ftruncate futimesat \
  futimens futimes gai_strerror getentropy \
  getgrgid_r getgrnam_r \
@@ -11715,15 +11965,15 @@
  posix_fallocate posix_fadvise posix_spawn posix_spawnp pread preadv preadv2 \
  pthread_condattr_setclock pthread_init pthread_kill pwrite pwritev pwritev2 \
  readlink readlinkat readv realpath renameat \
- sem_open sem_timedwait sem_getvalue sem_unlink sendfile setegid seteuid \
+ sem_open sem_timedwait sem_clockwait sem_getvalue sem_unlink sendfile setegid seteuid \
  setgid sethostname \
  setlocale setregid setreuid setresuid setresgid setsid setpgid setpgrp setpriority setuid setvbuf \
  sched_get_priority_max sched_setaffinity sched_setscheduler sched_setparam \
  sched_rr_get_interval \
  sigaction sigaltstack sigfillset siginterrupt sigpending sigrelse \
- sigtimedwait sigwait sigwaitinfo snprintf strftime strlcpy strsignal symlinkat sync \
+ sigtimedwait sigwait sigwaitinfo snprintf splice strftime strlcpy strsignal symlinkat sync \
  sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
- truncate uname unlinkat utimensat utimes waitid waitpid wait3 wait4 \
+ truncate uname unlinkat utimensat utimes vfork waitid waitpid wait3 wait4 \
  wcscoll wcsftime wcsxfrm wmemcmp writev _getpty rtpSpawn
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
@@ -12081,6 +12331,36 @@
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for eventfd" >&5
+$as_echo_n "checking for eventfd... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#ifdef HAVE_SYS_EVENTFD_H
+#include <sys/eventfd.h>
+#endif
+
+int
+main ()
+{
+int x = eventfd(0, EFD_CLOEXEC)
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+$as_echo "#define HAVE_EVENTFD 1" >>confdefs.h
+
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
 # On some systems (eg. FreeBSD 5), we would find a definition of the
 # functions ctermid_r, setgroups in the library, but no prototype
 # (e.g. because we use _XOPEN_SOURCE). See whether we can take their
@@ -12899,19 +13179,6 @@
 
 fi
 
-ac_fn_c_check_func "$LINENO" "strdup" "ac_cv_func_strdup"
-if test "x$ac_cv_func_strdup" = xyes; then :
-  $as_echo "#define HAVE_STRDUP 1" >>confdefs.h
-
-else
-  case " $LIBOBJS " in
-  *" strdup.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS strdup.$ac_objext"
- ;;
-esac
-
-fi
-
 
 for ac_func in getpgrp
 do :
@@ -13916,39 +14183,6 @@
 
 # checks for compiler characteristics
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether char is unsigned" >&5
-$as_echo_n "checking whether char is unsigned... " >&6; }
-if ${ac_cv_c_char_unsigned+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((char) -1) < 0)];
-test_array [0] = 0;
-return test_array [0];
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_c_char_unsigned=no
-else
-  ac_cv_c_char_unsigned=yes
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_char_unsigned" >&5
-$as_echo "$ac_cv_c_char_unsigned" >&6; }
-if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then
-  $as_echo "#define __CHAR_UNSIGNED__ 1" >>confdefs.h
-
-fi
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
 $as_echo_n "checking for an ANSI C-conforming const... " >&6; }
 if ${ac_cv_c_const+:} false; then :
@@ -14495,10 +14729,10 @@
 if ac_fn_c_try_compile "$LINENO"; then :
 
 
-if $GREP noonsees conftest.$ac_objext >/dev/null ; then
+if grep noonsees conftest.$ac_objext >/dev/null ; then
   ax_cv_c_float_words_bigendian=yes
 fi
-if $GREP seesnoon conftest.$ac_objext >/dev/null ; then
+if grep seesnoon conftest.$ac_objext >/dev/null ; then
   if test "$ax_cv_c_float_words_bigendian" = unknown; then
     ax_cv_c_float_words_bigendian=no
   else
@@ -15083,7 +15317,7 @@
   int main()
   {
 	/* Success: exit code 0 */
-        exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
+        return ((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
   }
 
 _ACEOF
@@ -15118,6 +15352,22 @@
 $as_echo "no" >&6; }
 fi
 
+case $ac_sys_system/$ac_sys_release in
+SunOS/*)
+  if test -f /etc/os-release; then
+    OS_NAME=$(awk -F= '/^NAME=/ {print substr($2,2,length($2)-2)}' /etc/os-release)
+    if test "x$OS_NAME" = "xOracle Solaris"; then
+      # bpo-43667: In Oracle Solaris, the internal form of wchar_t in
+      # non-Unicode locales is not Unicode and hence cannot be used directly.
+      # https://docs.oracle.com/cd/E37838_01/html/E61053/gmwke.html
+
+$as_echo "#define HAVE_NON_UNICODE_WCHAR_T_REPRESENTATION 1" >>confdefs.h
+
+    fi
+  fi
+  ;;
+esac
+
 # check for endianness
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5
 $as_echo_n "checking whether byte ordering is bigendian... " >&6; }
@@ -15383,12 +15633,7 @@
 fi
 
 
-case $ac_sys_system in
-    Linux*|GNU*|Darwin|VxWorks)
-	EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX};;
-    *)
-	EXT_SUFFIX=${SHLIB_SUFFIX};;
-esac
+EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX}
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking LDVERSION" >&5
 $as_echo_n "checking LDVERSION... " >&6; }
@@ -15448,6 +15693,29 @@
 fi
 
 
+# Check for --with-wheel-pkg-dir=PATH
+
+WHEEL_PKG_DIR=""
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-wheel-pkg-dir" >&5
+$as_echo_n "checking for --with-wheel-pkg-dir... " >&6; }
+
+# Check whether --with-wheel-pkg-dir was given.
+if test "${with_wheel_pkg_dir+set}" = set; then :
+  withval=$with_wheel_pkg_dir;
+if test -n "$withval"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+  WHEEL_PKG_DIR="$withval"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
 # Check whether right shifting a negative integer extends the sign bit
 # or fills with zeros (like the Cray J90, according to Tim Peters).
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether right shift extends the sign bit" >&5
@@ -15464,7 +15732,7 @@
 
 int main()
 {
-	exit(((-1)>>3 == -1) ? 0 : 1);
+	return (((-1)>>3 == -1) ? 0 : 1);
 }
 
 _ACEOF
@@ -15529,24 +15797,49 @@
 
 fi
 
+
+# Check whether --with-readline was given.
+if test "${with_readline+set}" = set; then :
+  withval=$with_readline;
+else
+  with_readline=yes
+fi
+
+
 # check where readline lives
+py_cv_lib_readline=no
 # save the value of LIBS so we don't actually link Python with readline
 LIBS_no_readline=$LIBS
 
-# On some systems we need to link readline to a termcap compatible
-# library.  NOTE: Keep the precedence of listed libraries synchronised
-# with setup.py.
-py_cv_lib_readline=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link readline libs" >&5
+if test "$with_readline" != no; then
+  case "$with_readline" in
+  editline|edit)
+    LIBREADLINE=edit
+
+$as_echo "#define WITH_EDITLINE 1" >>confdefs.h
+
+    ;;
+  yes|readline)
+    LIBREADLINE=readline
+    ;;
+  *)
+    as_fn_error $? "proper usage is --with(out)-readline[=editline]" "$LINENO" 5
+    ;;
+  esac
+
+  # On some systems we need to link readline to a termcap compatible
+  # library.  NOTE: Keep the precedence of listed libraries synchronised
+  # with setup.py.
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link readline libs" >&5
 $as_echo_n "checking how to link readline libs... " >&6; }
-for py_libtermcap in "" tinfo ncursesw ncurses curses termcap; do
-  if test -z "$py_libtermcap"; then
-    READLINE_LIBS="-lreadline"
-  else
-    READLINE_LIBS="-lreadline -l$py_libtermcap"
-  fi
-  LIBS="$READLINE_LIBS $LIBS_no_readline"
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  for py_libtermcap in "" tinfo ncursesw ncurses curses termcap; do
+    if test -z "$py_libtermcap"; then
+      READLINE_LIBS="-l$LIBREADLINE"
+    else
+      READLINE_LIBS="-l$LIBREADLINE -l$py_libtermcap"
+    fi
+    LIBS="$READLINE_LIBS $LIBS_no_readline"
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -15569,73 +15862,67 @@
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-  if test $py_cv_lib_readline = yes; then
-    break
-  fi
-done
-# Uncomment this line if you want to use READINE_LIBS in Makefile or scripts
-#AC_SUBST([READLINE_LIBS])
-if test $py_cv_lib_readline = no; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
+    if test $py_cv_lib_readline = yes; then
+      break
+    fi
+  done
+
+  # Uncomment this line if you want to use READLINE_LIBS in Makefile or scripts
+  #AC_SUBST([READLINE_LIBS])
+  if test $py_cv_lib_readline = no; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
 $as_echo "none" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $READLINE_LIBS" >&5
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $READLINE_LIBS" >&5
 $as_echo "$READLINE_LIBS" >&6; }
 
 $as_echo "#define HAVE_LIBREADLINE 1" >>confdefs.h
 
+  fi
 fi
 
-# check for readline 2.2
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <readline/readline.h>
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-  have_readline=yes
-else
-  have_readline=no
+if test "$py_cv_lib_readline" = yes; then
+  # check for readline 2.2
+  ac_fn_c_check_decl "$LINENO" "rl_completion_append_character" "ac_cv_have_decl_rl_completion_append_character" "
+#include <stdio.h> /* Must be first for Gnu Readline */
+#ifdef WITH_EDITLINE
+# include <editline/readline.h>
+#else
+# include <readline/readline.h>
+#endif
 
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-if test $have_readline = yes
-then
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <readline/readline.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "extern int rl_completion_append_character;" >/dev/null 2>&1; then :
+"
+if test "x$ac_cv_have_decl_rl_completion_append_character" = xyes; then :
 
 $as_echo "#define HAVE_RL_COMPLETION_APPEND_CHARACTER 1" >>confdefs.h
 
 fi
-rm -f conftest*
 
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <readline/readline.h>
+  ac_fn_c_check_decl "$LINENO" "rl_completion_suppress_append" "ac_cv_have_decl_rl_completion_suppress_append" "
+#include <stdio.h> /* Must be first for Gnu Readline */
+#ifdef WITH_EDITLINE
+# include <editline/readline.h>
+#else
+# include <readline/readline.h>
+#endif
 
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "extern int rl_completion_suppress_append;" >/dev/null 2>&1; then :
+"
+if test "x$ac_cv_have_decl_rl_completion_suppress_append" = xyes; then :
 
 $as_echo "#define HAVE_RL_COMPLETION_SUPPRESS_APPEND 1" >>confdefs.h
 
 fi
-rm -f conftest*
 
-fi
 
-# check for readline 4.0
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_pre_input_hook in -lreadline" >&5
-$as_echo_n "checking for rl_pre_input_hook in -lreadline... " >&6; }
-if ${ac_cv_lib_readline_rl_pre_input_hook+:} false; then :
+  # check for readline 4.0
+  as_ac_Lib=`$as_echo "ac_cv_lib_$LIBREADLINE''_rl_pre_input_hook" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_pre_input_hook in -l$LIBREADLINE" >&5
+$as_echo_n "checking for rl_pre_input_hook in -l$LIBREADLINE... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lreadline $READLINE_LIBS $LIBS"
+LIBS="-l$LIBREADLINE $READLINE_LIBS $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -15655,31 +15942,33 @@
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_readline_rl_pre_input_hook=yes
+  eval "$as_ac_Lib=yes"
 else
-  ac_cv_lib_readline_rl_pre_input_hook=no
+  eval "$as_ac_Lib=no"
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_pre_input_hook" >&5
-$as_echo "$ac_cv_lib_readline_rl_pre_input_hook" >&6; }
-if test "x$ac_cv_lib_readline_rl_pre_input_hook" = xyes; then :
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
 
 $as_echo "#define HAVE_RL_PRE_INPUT_HOOK 1" >>confdefs.h
 
 fi
 
 
-# also in 4.0
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_display_matches_hook in -lreadline" >&5
-$as_echo_n "checking for rl_completion_display_matches_hook in -lreadline... " >&6; }
-if ${ac_cv_lib_readline_rl_completion_display_matches_hook+:} false; then :
+  # also in 4.0
+  as_ac_Lib=`$as_echo "ac_cv_lib_$LIBREADLINE''_rl_completion_display_matches_hook" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_display_matches_hook in -l$LIBREADLINE" >&5
+$as_echo_n "checking for rl_completion_display_matches_hook in -l$LIBREADLINE... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lreadline $READLINE_LIBS $LIBS"
+LIBS="-l$LIBREADLINE $READLINE_LIBS $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -15699,31 +15988,33 @@
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_readline_rl_completion_display_matches_hook=yes
+  eval "$as_ac_Lib=yes"
 else
-  ac_cv_lib_readline_rl_completion_display_matches_hook=no
+  eval "$as_ac_Lib=no"
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_completion_display_matches_hook" >&5
-$as_echo "$ac_cv_lib_readline_rl_completion_display_matches_hook" >&6; }
-if test "x$ac_cv_lib_readline_rl_completion_display_matches_hook" = xyes; then :
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
 
 $as_echo "#define HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK 1" >>confdefs.h
 
 fi
 
 
-# also in 4.0, but not in editline
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_resize_terminal in -lreadline" >&5
-$as_echo_n "checking for rl_resize_terminal in -lreadline... " >&6; }
-if ${ac_cv_lib_readline_rl_resize_terminal+:} false; then :
+  # also in 4.0, but not in editline
+  as_ac_Lib=`$as_echo "ac_cv_lib_$LIBREADLINE''_rl_resize_terminal" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_resize_terminal in -l$LIBREADLINE" >&5
+$as_echo_n "checking for rl_resize_terminal in -l$LIBREADLINE... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lreadline $READLINE_LIBS $LIBS"
+LIBS="-l$LIBREADLINE $READLINE_LIBS $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -15743,31 +16034,33 @@
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_readline_rl_resize_terminal=yes
+  eval "$as_ac_Lib=yes"
 else
-  ac_cv_lib_readline_rl_resize_terminal=no
+  eval "$as_ac_Lib=no"
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_resize_terminal" >&5
-$as_echo "$ac_cv_lib_readline_rl_resize_terminal" >&6; }
-if test "x$ac_cv_lib_readline_rl_resize_terminal" = xyes; then :
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
 
 $as_echo "#define HAVE_RL_RESIZE_TERMINAL 1" >>confdefs.h
 
 fi
 
 
-# check for readline 4.2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_matches in -lreadline" >&5
-$as_echo_n "checking for rl_completion_matches in -lreadline... " >&6; }
-if ${ac_cv_lib_readline_rl_completion_matches+:} false; then :
+  # check for readline 4.2
+  as_ac_Lib=`$as_echo "ac_cv_lib_$LIBREADLINE''_rl_completion_matches" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_matches in -l$LIBREADLINE" >&5
+$as_echo_n "checking for rl_completion_matches in -l$LIBREADLINE... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lreadline $READLINE_LIBS $LIBS"
+LIBS="-l$LIBREADLINE $READLINE_LIBS $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -15787,59 +16080,49 @@
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_readline_rl_completion_matches=yes
+  eval "$as_ac_Lib=yes"
 else
-  ac_cv_lib_readline_rl_completion_matches=no
+  eval "$as_ac_Lib=no"
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_completion_matches" >&5
-$as_echo "$ac_cv_lib_readline_rl_completion_matches" >&6; }
-if test "x$ac_cv_lib_readline_rl_completion_matches" = xyes; then :
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
 
 $as_echo "#define HAVE_RL_COMPLETION_MATCHES 1" >>confdefs.h
 
 fi
 
 
-# also in readline 4.2
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <readline/readline.h>
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-  have_readline=yes
-else
-  have_readline=no
+  # also in readline 4.2
+  ac_fn_c_check_decl "$LINENO" "rl_catch_signals" "ac_cv_have_decl_rl_catch_signals" "
+#include <stdio.h> /* Must be first for Gnu Readline */
+#ifdef WITH_EDITLINE
+# include <editline/readline.h>
+#else
+# include <readline/readline.h>
+#endif
 
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-if test $have_readline = yes
-then
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <readline/readline.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "extern int rl_catch_signals;" >/dev/null 2>&1; then :
+"
+if test "x$ac_cv_have_decl_rl_catch_signals" = xyes; then :
 
 $as_echo "#define HAVE_RL_CATCH_SIGNAL 1" >>confdefs.h
 
 fi
-rm -f conftest*
 
-fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for append_history in -lreadline" >&5
-$as_echo_n "checking for append_history in -lreadline... " >&6; }
-if ${ac_cv_lib_readline_append_history+:} false; then :
+  as_ac_Lib=`$as_echo "ac_cv_lib_$LIBREADLINE''_append_history" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for append_history in -l$LIBREADLINE" >&5
+$as_echo_n "checking for append_history in -l$LIBREADLINE... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lreadline $READLINE_LIBS $LIBS"
+LIBS="-l$LIBREADLINE $READLINE_LIBS $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -15859,22 +16142,24 @@
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_readline_append_history=yes
+  eval "$as_ac_Lib=yes"
 else
-  ac_cv_lib_readline_append_history=no
+  eval "$as_ac_Lib=no"
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_append_history" >&5
-$as_echo "$ac_cv_lib_readline_append_history" >&6; }
-if test "x$ac_cv_lib_readline_append_history" = xyes; then :
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
 
 $as_echo "#define HAVE_RL_APPEND_HISTORY 1" >>confdefs.h
 
 fi
 
+fi
 
 # End of readline checks: restore LIBS
 LIBS=$LIBS_no_readline
@@ -15934,6 +16219,7 @@
 /* end confdefs.h.  */
 
 #include <poll.h>
+#include <unistd.h>
 
 int main()
 {
@@ -16876,7 +17162,7 @@
 done
 
 
-SRCDIRS="Parser Parser/pegen Objects Python Modules Modules/_io Programs"
+SRCDIRS="Parser Objects Python Modules Modules/_io Programs"
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for build directories" >&5
 $as_echo_n "checking for build directories... " >&6; }
 for dir in $SRCDIRS; do
@@ -17053,16 +17339,17 @@
 
 fi
 
-# Check for GCC >= 4.7 __atomic builtins
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC >= 4.7 __atomic builtins" >&5
-$as_echo_n "checking for GCC >= 4.7 __atomic builtins... " >&6; }
+# Check for GCC >= 4.7 and clang __atomic builtin functions
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for builtin __atomic_load_n and __atomic_store_n functions" >&5
+$as_echo_n "checking for builtin __atomic_load_n and __atomic_store_n functions... " >&6; }
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 
-    volatile int val = 1;
+    int val;
     int main() {
-      __atomic_load_n(&val, __ATOMIC_SEQ_CST);
+      __atomic_store_n(&val, 1, __ATOMIC_SEQ_CST);
+      (void)__atomic_load_n(&val, __ATOMIC_SEQ_CST);
       return 0;
     }
 
@@ -17524,59 +17811,95 @@
 
 
 
-if test "$have_openssl" = yes; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for X509_VERIFY_PARAM_set1_host in libssl" >&5
-$as_echo_n "checking for X509_VERIFY_PARAM_set1_host in libssl... " >&6; }
+# rpath to libssl and libcrypto
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-openssl-rpath" >&5
+$as_echo_n "checking for --with-openssl-rpath... " >&6; }
 
-    save_LIBS="$LIBS"
-    save_LDFLAGS="$LDFLAGS"
-    save_CPPFLAGS="$CPPFLAGS"
-    LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
-    LIBS="$OPENSSL_LIBS $LIBS"
-    CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS"
+# Check whether --with-openssl-rpath was given.
+if test "${with_openssl_rpath+set}" = set; then :
+  withval=$with_openssl_rpath;
+else
+  with_openssl_rpath=no
 
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+fi
+
+case $with_openssl_rpath in #(
+  auto|yes) :
+    OPENSSL_RPATH=auto ;; #(
+  no) :
+    OPENSSL_RPATH= ;; #(
+  *) :
+    if test -d "$with_openssl_rpath"; then :
+  OPENSSL_RPATH="$with_openssl_rpath"
+else
+  as_fn_error $? "--with-openssl-rpath \"$with_openssl_rpath\" is not a directory" "$LINENO" 5
+fi
+
+ ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $OPENSSL_RPATH" >&5
+$as_echo "$OPENSSL_RPATH" >&6; }
+
+
+# check if OpenSSL libraries work as expected
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether OpenSSL provides required APIs" >&5
+$as_echo_n "checking whether OpenSSL provides required APIs... " >&6; }
+save_LIBS="$LIBS"
+save_CFLAGS="$CFLAGS"
+save_LDFLAGS="$LDFLAGS"
+LIBS="$LIBS $OPENSSL_LIBS"
+CFLAGS="$CFLAGS_NODIST $OPENSSL_INCLUDES"
+LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-        #include <openssl/x509_vfy.h>
+#include <openssl/opensslv.h>
+#include <openssl/evp.h>
+#include <openssl/ssl.h>
+
+#if OPENSSL_VERSION_NUMBER < 0x10101000L
+#error "OpenSSL >= 1.1.1 is required"
+#endif
+
+static void keylog_cb(const SSL *ssl, const char *line) {}
 
 int
 main ()
 {
 
-        X509_VERIFY_PARAM *p = X509_VERIFY_PARAM_new();
-        X509_VERIFY_PARAM_set1_host(p, "localhost", 0);
-        X509_VERIFY_PARAM_set1_ip_asc(p, "127.0.0.1");
-        X509_VERIFY_PARAM_set_hostflags(p, 0);
+/* SSL APIs */
+SSL_CTX *ctx = SSL_CTX_new(TLS_client_method());
+SSL_CTX_set_keylog_callback(ctx, keylog_cb);
+SSL *ssl = SSL_new(ctx);
+X509_VERIFY_PARAM *param = SSL_get0_param(ssl);
+X509_VERIFY_PARAM_set1_host(param, "python.org", 0);
+SSL_free(ssl);
+SSL_CTX_free(ctx);
+
+/* hashlib APIs */
+OBJ_nid2sn(NID_md5);
+OBJ_nid2sn(NID_sha1);
+OBJ_nid2sn(NID_sha3_512);
+OBJ_nid2sn(NID_blake2b512);
+EVP_PBE_scrypt(NULL, 0, NULL, 0, 2, 8, 1, 0, NULL, 0);
 
   ;
   return 0;
 }
-
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-
-        ac_cv_has_x509_verify_param_set1_host=yes
-
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 else
-
-        ac_cv_has_x509_verify_param_set1_host=no
-
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_has_x509_verify_param_set1_host" >&5
-$as_echo "$ac_cv_has_x509_verify_param_set1_host" >&6; }
-    if test "$ac_cv_has_x509_verify_param_set1_host" = "yes"; then
-
-$as_echo "#define HAVE_X509_VERIFY_PARAM_SET1_HOST 1" >>confdefs.h
-
-    fi
-
-    CPPFLAGS="$save_CPPFLAGS"
-    LDFLAGS="$save_LDFLAGS"
-    LIBS="$save_LIBS"
-fi
+LIBS="$save_LIBS"
+CFLAGS="$save_CFLAGS"
+LDFLAGS="$save_LDFLAGS"
 
 # ssl module default cipher suite string
 
@@ -17657,6 +17980,85 @@
 fi
 
 
+# --with-experimental-isolated-subinterpreters
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-experimental-isolated-subinterpreters" >&5
+$as_echo_n "checking for --with-experimental-isolated-subinterpreters... " >&6; }
+
+# Check whether --with-experimental-isolated-subinterpreters was given.
+if test "${with_experimental_isolated_subinterpreters+set}" = set; then :
+  withval=$with_experimental_isolated_subinterpreters;
+if test "$withval" != no
+then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; };
+  $as_echo "#define EXPERIMENTAL_ISOLATED_SUBINTERPRETERS 1" >>confdefs.h
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; };
+fi
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+# --with-static-libpython
+STATIC_LIBPYTHON=1
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-static-libpython" >&5
+$as_echo_n "checking for --with-static-libpython... " >&6; }
+
+# Check whether --with-static-libpython was given.
+if test "${with_static_libpython+set}" = set; then :
+  withval=$with_static_libpython;
+if test "$withval" = no
+then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; };
+  STATIC_LIBPYTHON=0
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; };
+fi
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+fi
+
+LIBRARY_DEPS='$(PY3LIBRARY) $(EXPORTSYMS)'
+if test "$PY_ENABLE_SHARED" = 1 || test "$enable_framework" ; then
+    LIBRARY_DEPS="\$(LDLIBRARY) $LIBRARY_DEPS"
+    if test "$STATIC_LIBPYTHON" = 1; then
+        LIBRARY_DEPS="\$(LIBRARY) $LIBRARY_DEPS"
+    fi
+else
+    LIBRARY_DEPS="\$(LIBRARY) $LIBRARY_DEPS"
+fi
+
+
+
+# Check whether to disable test modules. Once set, setup.py will not build
+# test extension modules and "make install" will not install test suites.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --disable-test-modules" >&5
+$as_echo_n "checking for --disable-test-modules... " >&6; }
+# Check whether --enable-test-modules was given.
+if test "${enable_test_modules+set}" = set; then :
+  enableval=$enable_test_modules;
+fi
+
+if test "$enable_test_modules" = no; then
+    TEST_MODULES=no
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+    TEST_MODULES=yes
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
 # generate output files
 ac_config_files="$ac_config_files Makefile.pre Misc/python.pc Misc/python-embed.pc Misc/python-config.sh"
 
@@ -18169,7 +18571,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by python $as_me 3.9, which was
+This file was extended by python $as_me 3.10, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -18231,7 +18633,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-python config.status 3.9
+python config.status 3.10
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
@@ -18982,4 +19384,3 @@
     echo "" >&6
     echo "" >&6
 fi
-
diff --git a/configure.ac b/configure.ac
index c968d14..547255f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,22 +1,29 @@
-dnl ***********************************************
-dnl * Please run autoreconf to test your changes! *
-dnl ***********************************************
+dnl ***************************************************
+dnl * Please run autoreconf -if to test your changes! *
+dnl ***************************************************
+dnl
+dnl Python's configure script requires autoconf 2.69 and autoconf-archive.
+dnl
 
 # Set VERSION so we only need to edit in one place (i.e., here)
-m4_define(PYTHON_VERSION, 3.9)
+m4_define(PYTHON_VERSION, 3.10)
 
 AC_PREREQ([2.69])
 
 AC_INIT([python],[PYTHON_VERSION],[https://bugs.python.org/])
 
-AC_CONFIG_MACRO_DIR(m4)
+m4_ifdef(
+    [AX_C_FLOAT_WORDS_BIGENDIAN],
+    [],
+    [AC_MSG_ERROR([Please install autoconf-archive package and re-run autoreconf])]
+)
 
 AC_SUBST(BASECPPFLAGS)
 if test "$srcdir" != . -a "$srcdir" != "$(pwd)"; then
     # If we're building out-of-tree, we need to make sure the following
     # resources get picked up before their $srcdir counterparts.
     #   Objects/ -> typeslots.inc
-    #   Include/ -> Python-ast.h, graminit.h
+    #   Include/ -> Python.h
     #   Python/  -> importlib.h
     # (A side effect of this is that these resources will automatically be
     #  regenerated when building out-of-tree, regardless of whether or not
@@ -213,12 +220,14 @@
 fi
 
 AC_SUBST(LIPO_32BIT_FLAGS)
+AC_SUBST(LIPO_INTEL64_FLAGS)
 AC_MSG_CHECKING(for --with-universal-archs)
 AC_ARG_WITH(universal-archs,
     AS_HELP_STRING([--with-universal-archs=ARCH],
-                   [specify the kind of universal binary that should be created. this option is
-                    only valid when --enable-universalsdk is set; options are:
-                    ("universal2", "32-bit", "64-bit", "3-way", "intel", "intel-32", "intel-64", or "all")
+                   [specify the kind of macOS universal binary that should be created.
+                    This option is only valid when --enable-universalsdk is set; options are:
+                    ("universal2", "intel-64", "intel-32", "intel", "32-bit",
+                    "64-bit", "3-way", or "all")
                     see Mac/README.rst]),
 [
 	UNIVERSAL_ARCHS="$withval"
@@ -512,16 +521,6 @@
     define_xopen_source=no;;
   Darwin/@<:@[12]@:>@@<:@0-9@:>@.*)
     define_xopen_source=no;;
-  # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
-  # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
-  # or has another value. By not (re)defining it, the defaults come in place.
-  AIX/4)
-    define_xopen_source=no;;
-  AIX/5)
-    if test `uname -r` -eq 1; then
-      define_xopen_source=no
-    fi
-    ;;
   # On QNX 6.3.2, defining _XOPEN_SOURCE prevents netdb.h from
   # defining NI_NUMERICHOST.
   QNX/6.3.2)
@@ -718,9 +717,6 @@
 fi
 
 
-MULTIARCH=$($CC --print-multiarch 2>/dev/null)
-AC_SUBST(MULTIARCH)
-
 AC_MSG_CHECKING([for the platform triplet based on compiler characteristics])
 cat >> conftest.c <<EOF
 #undef bfin
@@ -876,6 +872,15 @@
 fi
 rm -f conftest.c conftest.out
 
+AC_MSG_CHECKING([for multiarch])
+AS_CASE([$ac_sys_system],
+  [Darwin*], [MULTIARCH=""],
+  [FreeBSD*], [MULTIARCH=""],
+  [MULTIARCH=$($CC --print-multiarch 2>/dev/null)]
+)
+AC_SUBST([MULTIARCH])
+AC_MSG_RESULT([$MULTIARCH])
+
 if test x$PLATFORM_TRIPLET != x && test x$MULTIARCH != x; then
   if test x$PLATFORM_TRIPLET != x$MULTIARCH; then
     AC_MSG_ERROR([internal configure error for the platform triplet, please file a bug report])
@@ -884,6 +889,7 @@
   MULTIARCH=$PLATFORM_TRIPLET
 fi
 AC_SUBST(PLATFORM_TRIPLET)
+
 if test x$MULTIARCH != x; then
   MULTIARCH_CPPFLAGS="-DMULTIARCH=\\\"$MULTIARCH\\\""
 fi
@@ -1048,10 +1054,7 @@
 case $ac_sys_system in
 AIX*)
 	EXPORTSYMS="Modules/python.exp"
-	if test $ac_sys_release -ge 5 -o \
-		$ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
-	    EXPORTSFROM=. # the main executable
-	fi
+	EXPORTSFROM=. # the main executable
 	;;
 esac
 AC_MSG_RESULT($EXPORTSYMS)
@@ -1146,7 +1149,7 @@
 	      PY3LIBRARY=libpython3.so
 	  fi
           ;;
-    Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*)
+    Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*|VxWorks*)
 	  LDLIBRARY='libpython$(LDVERSION).so'
 	  BLDLIBRARY='-L. -lpython$(LDVERSION)'
 	  RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
@@ -1318,6 +1321,16 @@
   DEF_MAKE_ALL_RULE="profile-opt"
   REQUIRE_PGO="yes"
   DEF_MAKE_RULE="build_all"
+  case $CC in
+    *gcc*)
+      AX_CHECK_COMPILE_FLAG([-fno-semantic-interposition],[
+      CFLAGS_NODIST="$CFLAGS_NODIST -fno-semantic-interposition"
+      LDFLAGS_NODIST="$LDFLAGS_NODIST -fno-semantic-interposition"
+      ])
+      ;;
+  esac
+
+
 else
   DEF_MAKE_ALL_RULE="build_all"
   REQUIRE_PGO="no"
@@ -1328,7 +1341,7 @@
 AC_MSG_CHECKING(PROFILE_TASK)
 if test -z "$PROFILE_TASK"
 then
-	PROFILE_TASK='-m test --pgo'
+	PROFILE_TASK='-m test --pgo --timeout=$(TESTTIMEOUT)'
 fi
 AC_MSG_RESULT($PROFILE_TASK)
 
@@ -1379,10 +1392,11 @@
       fi
       if test "$ac_sys_system" = "Darwin" -a "${LLVM_AR_FOUND}" = "not-found"
       then
-        found_llvm_ar=`/usr/bin/xcrun -find llvm-ar 2>/dev/null`
+        # The Apple-supplied ar in Xcode or the Command Line Tools is apparently sufficient
+        found_llvm_ar=`/usr/bin/xcrun -find ar 2>/dev/null`
         if test -n "${found_llvm_ar}"
         then
-          LLVM_AR='/usr/bin/xcrun llvm-ar'
+          LLVM_AR='/usr/bin/xcrun ar'
           LLVM_AR_FOUND=found
           AC_MSG_NOTICE([llvm-ar found via xcrun: ${LLVM_AR}])
         fi
@@ -1399,6 +1413,7 @@
         Darwin*)
           # Any changes made here should be reflected in the GCC+Darwin case below
           LTOFLAGS="-flto -Wl,-export_dynamic"
+          LTOCFLAGS="-flto"
           ;;
         *)
           LTOFLAGS="-flto"
@@ -1409,6 +1424,7 @@
       case $ac_sys_system in
         Darwin*)
           LTOFLAGS="-flto -Wl,-export_dynamic"
+          LTOCFLAGS="-flto"
           ;;
         *)
           LTOFLAGS="-flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none"
@@ -1424,7 +1440,7 @@
       LTOFLAGS="$LTOFLAGS -g"
   fi
 
-  CFLAGS_NODIST="$CFLAGS_NODIST $LTOFLAGS"
+  CFLAGS_NODIST="$CFLAGS_NODIST ${LTOCFLAGS-$LTOFLAGS}"
   LDFLAGS_NODIST="$LDFLAGS_NODIST $LTOFLAGS"
 fi
 
@@ -1870,6 +1886,7 @@
             AC_MSG_RESULT($CC)
         fi
 
+        LIPO_INTEL64_FLAGS=""
         if test "${enable_universalsdk}"
         then
             case "$UNIVERSAL_ARCHS" in
@@ -1891,8 +1908,9 @@
             universal2)
                UNIVERSAL_ARCH_FLAGS="-arch arm64 -arch x86_64"
                LIPO_32BIT_FLAGS=""
+               LIPO_INTEL64_FLAGS="-extract x86_64"
                ARCH_RUN_32BIT="true"
-		;;
+               ;;
             intel)
                UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
                LIPO_32BIT_FLAGS="-extract i386"
@@ -2207,7 +2225,8 @@
 sys/times.h sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h pty.h \
 libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
 linux/tipc.h linux/random.h spawn.h util.h alloca.h endian.h \
-sys/endian.h sys/sysmacros.h linux/memfd.h linux/wait.h sys/memfd.h sys/mman.h)
+sys/endian.h sys/sysmacros.h linux/auxvec.h linux/memfd.h linux/wait.h sys/memfd.h \
+sys/mman.h sys/eventfd.h)
 AC_HEADER_DIRENT
 AC_HEADER_MAJOR
 
@@ -2349,10 +2368,11 @@
 AC_CHECK_TYPE(__uint128_t,
   AC_DEFINE(HAVE_GCC_UINT128_T, 1, [Define if your compiler provides __uint128_t]),,)
 
-# Sizes of various common basic types
+# Sizes and alignments of various common basic types
 # ANSI C requires sizeof(char) == 1, so no need to check it
 AC_CHECK_SIZEOF(int, 4)
 AC_CHECK_SIZEOF(long, 4)
+AC_CHECK_ALIGNOF(long)
 AC_CHECK_SIZEOF(long long, 8)
 AC_CHECK_SIZEOF(void *, 4)
 AC_CHECK_SIZEOF(short, 2)
@@ -2360,6 +2380,7 @@
 AC_CHECK_SIZEOF(double, 8)
 AC_CHECK_SIZEOF(fpos_t, 4)
 AC_CHECK_SIZEOF(size_t, 4)
+AC_CHECK_ALIGNOF(size_t)
 AC_CHECK_SIZEOF(pid_t, 4)
 AC_CHECK_SIZEOF(uintptr_t)
 
@@ -2548,6 +2569,49 @@
 	;;
 esac
 
+AC_MSG_CHECKING(for --with-address-sanitizer)
+AC_ARG_WITH(address_sanitizer,
+            AS_HELP_STRING([--with-address-sanitizer],
+                           [enable AddressSanitizer memory error detector, 'asan' (default is no)]),
+[
+AC_MSG_RESULT($withval)
+BASECFLAGS="-fsanitize=address -fno-omit-frame-pointer $BASECFLAGS"
+LDFLAGS="-fsanitize=address $LDFLAGS"
+# ASan works by controlling memory allocation, our own malloc interferes.
+with_pymalloc="no"
+],
+[AC_MSG_RESULT(no)])
+
+AC_MSG_CHECKING(for --with-memory-sanitizer)
+AC_ARG_WITH(memory_sanitizer,
+            AS_HELP_STRING([--with-memory-sanitizer],
+                           [enable MemorySanitizer allocation error detector, 'msan' (default is no)]),
+[
+AC_MSG_RESULT($withval)
+AX_CHECK_COMPILE_FLAG([-fsanitize=memory],[
+BASECFLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer $BASECFLAGS"
+LDFLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2 $LDFLAGS"
+],[AC_MSG_ERROR([The selected compiler doesn't support memory sanitizer])])
+# MSan works by controlling memory allocation, our own malloc interferes.
+with_pymalloc="no"
+],
+[AC_MSG_RESULT(no)])
+
+AC_MSG_CHECKING(for --with-undefined-behavior-sanitizer)
+AC_ARG_WITH(undefined_behavior_sanitizer,
+            AS_HELP_STRING([--with-undefined-behavior-sanitizer],
+                           [enable UndefinedBehaviorSanitizer undefined behaviour detector, 'ubsan' (default is no)]),
+[
+AC_MSG_RESULT($withval)
+BASECFLAGS="-fsanitize=undefined $BASECFLAGS"
+LDFLAGS="-fsanitize=undefined $LDFLAGS"
+with_ubsan="yes"
+],
+[
+AC_MSG_RESULT(no)
+with_ubsan="no"
+])
+
 # Set info about shared libraries.
 AC_SUBST(SHLIB_SUFFIX)
 AC_SUBST(LDSHARED)
@@ -2640,19 +2704,7 @@
 		   test ${dep_target_minor} -le 2
 		then
 			# building for OS X 10.0 through 10.2
-			LDSHARED='$(CC) -bundle'
-			LDCXXSHARED='$(CXX) -bundle'
-			if test "$enable_framework" ; then
-				# Link against the framework. All externals should be defined.
-				BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
-				LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
-				LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
-			else
-				# No framework, use the Python app as bundle-loader
-				BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
-				LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
-				LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
-			fi
+			AC_MSG_ERROR([MACOSX_DEPLOYMENT_TARGET too old ($MACOSX_DEPLOYMENT_TARGET), only 10.3 or later is supported])
 		else
 			# building for OS X 10.3 and later
 			LDSHARED='$(CC) -bundle -undefined dynamic_lookup'
@@ -2763,9 +2815,18 @@
 		# Issue #18075: the default maximum stack size (8MBytes) is too
 		# small for the default recursion limit. Increase the stack size
 		# to ensure that tests don't crash
-		# Note: This matches the value of THREAD_STACK_SIZE in
-		# thread_pthread.h
-		LINKFORSHARED="-Wl,-stack_size,1000000 $LINKFORSHARED"
+    stack_size="1000000"  # 16 MB
+    if test "$with_ubsan" = "yes"
+    then
+        # Undefined behavior sanitizer requires an even deeper stack
+        stack_size="4000000"  # 64 MB
+    fi
+
+    LINKFORSHARED="-Wl,-stack_size,$stack_size $LINKFORSHARED"
+
+    AC_DEFINE_UNQUOTED(THREAD_STACK_SIZE,
+        0x$stack_size,
+        [Custom thread stack size depending on chosen sanitizer runtimes.])
 
 		if test "$enable_framework"
 		then
@@ -2800,7 +2861,7 @@
 		# when running test_compile.py.
 		LINKFORSHARED='-Wl,-E -N 2048K';;
 	VxWorks*)
-		LINKFORSHARED='--export-dynamic';;
+		LINKFORSHARED='-Wl,-export-dynamic';;
 	esac
 fi
 AC_MSG_RESULT($LINKFORSHARED)
@@ -2857,8 +2918,13 @@
   [AC_MSG_RESULT(no)]
 )
 
+# check for libuuid from util-linux
+save_LIBS=$LIBS
+AC_CHECK_LIB([uuid], [uuid_generate_time])
+LIBS=$save_LIBS
+
 # AIX provides support for RFC4122 (uuid) in libc.a starting with AIX 6.1 (anno 2007)
-# FreeBSD and OpenBSD provides support as well
+# FreeBSD and OpenBSD provides support in libc as well.
 AC_MSG_CHECKING(for uuid_create)
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <uuid.h>]], [[
 #ifndef uuid_create
@@ -2982,7 +3048,7 @@
 
     # Bad paths are those that don't start with /
     dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
-    if ( echo $1 | grep -qE '(^|:)(@<:@^/@:>@|$)' ); then
+    if ( echo $1 | grep '\(^\|:\)\(@<:@^/@:>@\|$\)' > /dev/null); then
         AC_MSG_ERROR([--with-tzpath must contain only absolute paths, not $1])
         return 1;
     fi
@@ -3009,43 +3075,6 @@
  AC_MSG_RESULT("$TZPATH")])
 AC_SUBST(TZPATH)
 
-AC_MSG_CHECKING(for --with-address-sanitizer)
-AC_ARG_WITH(address_sanitizer,
-            AS_HELP_STRING([--with-address-sanitizer],
-                           [enable AddressSanitizer memory error detector, 'asan' (default is no)]),
-[
-AC_MSG_RESULT($withval)
-BASECFLAGS="-fsanitize=address -fno-omit-frame-pointer $BASECFLAGS"
-LDFLAGS="-fsanitize=address $LDFLAGS"
-# ASan works by controlling memory allocation, our own malloc interferes.
-with_pymalloc="no"
-],
-[AC_MSG_RESULT(no)])
-
-AC_MSG_CHECKING(for --with-memory-sanitizer)
-AC_ARG_WITH(memory_sanitizer,
-            AS_HELP_STRING([--with-memory-sanitizer],
-                           [enable MemorySanitizer allocation error detector, 'msan' (default is no)]),
-[
-AC_MSG_RESULT($withval)
-BASECFLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer $BASECFLAGS"
-LDFLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2 $LDFLAGS"
-# MSan works by controlling memory allocation, our own malloc interferes.
-with_pymalloc="no"
-],
-[AC_MSG_RESULT(no)])
-
-AC_MSG_CHECKING(for --with-undefined-behavior-sanitizer)
-AC_ARG_WITH(undefined_behavior_sanitizer,
-            AS_HELP_STRING([--with-undefined-behavior-sanitizer],
-                           [enable UndefinedBehaviorSanitizer undefined behaviour detector, 'ubsan' (default is no)]),
-[
-AC_MSG_RESULT($withval)
-BASECFLAGS="-fsanitize=undefined $BASECFLAGS"
-LDFLAGS="-fsanitize=undefined $LDFLAGS"
-],
-[AC_MSG_RESULT(no)])
-
 # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
 AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
 AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
@@ -3159,8 +3188,13 @@
   then
     AC_MSG_ERROR([use both --with-tcltk-includes='...' and --with-tcltk-libs='...' or neither])
   fi
-  TCLTK_INCLUDES=""
-  TCLTK_LIBS=""
+  if test -n "$PKG_CONFIG" && "$PKG_CONFIG" --exists tcl tk; then
+    TCLTK_INCLUDES="`"$PKG_CONFIG" tcl tk --cflags-only-I 2>/dev/null`"
+    TCLTK_LIBS="`"$PKG_CONFIG" tcl tk --libs 2>/dev/null`"
+  else
+    TCLTK_INCLUDES=""
+    TCLTK_LIBS=""
+  fi
 else
   TCLTK_INCLUDES="$with_tcltk_includes"
   TCLTK_LIBS="$with_tcltk_libs"
@@ -3313,10 +3347,10 @@
       main() {
         pthread_attr_t attr;
         pthread_t id;
-        if (pthread_attr_init(&attr)) exit(-1);
-        if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
-        if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
-        exit(0);
+        if (pthread_attr_init(&attr)) return (-1);
+        if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) return (-1);
+        if (pthread_create(&id, &attr, foo, NULL)) return (-1);
+        return (0);
       }]])],
       [ac_cv_pthread_system_supported=yes],
       [ac_cv_pthread_system_supported=no],
@@ -3627,7 +3661,7 @@
 DLINCLDIR=.
 
 # the dlopen() function means we might want to use dynload_shlib.o. some
-# platforms, such as AIX, have dlopen(), but don't want to use it.
+# platforms have dlopen(), but don't want to use it.
 AC_CHECK_FUNCS(dlopen)
 
 # DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
@@ -3637,12 +3671,6 @@
 if test -z "$DYNLOADFILE"
 then
 	case $ac_sys_system/$ac_sys_release in
-	AIX*) # Use dynload_shlib.c and dlopen() if we have it; otherwise dynload_aix.c
-	if test "$ac_cv_func_dlopen" = yes
-	then DYNLOADFILE="dynload_shlib.o"
-	else DYNLOADFILE="dynload_aix.o"
-	fi
-	;;
 	hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
 	*)
 	# use dynload_shlib.c and dlopen() if we have it; otherwise stub
@@ -3679,8 +3707,8 @@
 
 # checks for library functions
 AC_CHECK_FUNCS(alarm accept4 setitimer getitimer bind_textdomain_codeset chown \
- clock confstr copy_file_range ctermid dup3 execv explicit_bzero explicit_memset \
- faccessat fchmod fchmodat fchown fchownat \
+ clock confstr close_range copy_file_range ctermid dup3 execv explicit_bzero \
+ explicit_memset faccessat fchmod fchmodat fchown fchownat \
  fdwalk fexecve fdopendir fork fpathconf fstatat ftime ftruncate futimesat \
  futimens futimes gai_strerror getentropy \
  getgrgid_r getgrnam_r \
@@ -3693,15 +3721,15 @@
  posix_fallocate posix_fadvise posix_spawn posix_spawnp pread preadv preadv2 \
  pthread_condattr_setclock pthread_init pthread_kill pwrite pwritev pwritev2 \
  readlink readlinkat readv realpath renameat \
- sem_open sem_timedwait sem_getvalue sem_unlink sendfile setegid seteuid \
+ sem_open sem_timedwait sem_clockwait sem_getvalue sem_unlink sendfile setegid seteuid \
  setgid sethostname \
  setlocale setregid setreuid setresuid setresgid setsid setpgid setpgrp setpriority setuid setvbuf \
  sched_get_priority_max sched_setaffinity sched_setscheduler sched_setparam \
  sched_rr_get_interval \
  sigaction sigaltstack sigfillset siginterrupt sigpending sigrelse \
- sigtimedwait sigwait sigwaitinfo snprintf strftime strlcpy strsignal symlinkat sync \
+ sigtimedwait sigwait sigwaitinfo snprintf splice strftime strlcpy strsignal symlinkat sync \
  sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
- truncate uname unlinkat utimensat utimes waitid waitpid wait3 wait4 \
+ truncate uname unlinkat utimensat utimes vfork waitid waitpid wait3 wait4 \
  wcscoll wcsftime wcsxfrm wmemcmp writev _getpty rtpSpawn)
 
 # Force lchmod off for Linux. Linux disallows changing the mode of symbolic
@@ -3806,6 +3834,17 @@
   [AC_MSG_RESULT(no)
 ])
 
+AC_MSG_CHECKING(for eventfd)
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#ifdef HAVE_SYS_EVENTFD_H
+#include <sys/eventfd.h>
+#endif
+]], [[int x = eventfd(0, EFD_CLOEXEC)]])],
+  [AC_DEFINE(HAVE_EVENTFD, 1, Define if you have the 'eventfd' function.)
+   AC_MSG_RESULT(yes)],
+  [AC_MSG_RESULT(no)
+])
+
 # On some systems (eg. FreeBSD 5), we would find a definition of the
 # functions ctermid_r, setgroups in the library, but no prototype
 # (e.g. because we use _XOPEN_SOURCE). See whether we can take their
@@ -4003,7 +4042,7 @@
 # check for long file support functions
 AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
 
-AC_REPLACE_FUNCS(dup2 strdup)
+AC_REPLACE_FUNCS(dup2)
 AC_CHECK_FUNCS(getpgrp,
   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[getpgrp(0);]])],
     [AC_DEFINE(GETPGRP_HAVE_ARG, 1, [Define if getpgrp() must be called as getpgrp(0).])],
@@ -4283,7 +4322,6 @@
 
 # checks for compiler characteristics
 
-AC_C_CHAR_UNSIGNED
 AC_C_CONST
 
 works=no
@@ -4725,7 +4763,7 @@
   int main()
   {
 	/* Success: exit code 0 */
-        exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
+        return ((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
   }
   ]])],
   [ac_cv_wchar_t_signed=yes],
@@ -4748,6 +4786,22 @@
   AC_MSG_RESULT(no)
 fi
 
+case $ac_sys_system/$ac_sys_release in
+SunOS/*)
+  if test -f /etc/os-release; then
+    OS_NAME=$(awk -F= '/^NAME=/ {print substr($2,2,length($2)-2)}' /etc/os-release)
+    if test "x$OS_NAME" = "xOracle Solaris"; then
+      # bpo-43667: In Oracle Solaris, the internal form of wchar_t in
+      # non-Unicode locales is not Unicode and hence cannot be used directly.
+      # https://docs.oracle.com/cd/E37838_01/html/E61053/gmwke.html
+      AC_DEFINE(HAVE_NON_UNICODE_WCHAR_T_REPRESENTATION, 1,
+      [Define if the internal form of wchar_t in non-Unicode locales
+       is not Unicode.])
+    fi
+  fi
+  ;;
+esac
+
 # check for endianness
 AC_C_BIGENDIAN
 
@@ -4783,12 +4837,7 @@
 fi
 
 AC_SUBST(EXT_SUFFIX)
-case $ac_sys_system in
-    Linux*|GNU*|Darwin|VxWorks)
-	EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX};;
-    *)
-	EXT_SUFFIX=${SHLIB_SUFFIX};;
-esac
+EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX}
 
 AC_MSG_CHECKING(LDVERSION)
 LDVERSION='$(VERSION)$(ABIFLAGS)'
@@ -4840,6 +4889,22 @@
 fi
 AC_SUBST(LIBPL)
 
+# Check for --with-wheel-pkg-dir=PATH
+AC_SUBST(WHEEL_PKG_DIR)
+WHEEL_PKG_DIR=""
+AC_MSG_CHECKING(for --with-wheel-pkg-dir)
+AC_ARG_WITH(wheel-pkg-dir,
+            AS_HELP_STRING([--with-wheel-pkg-dir=PATH],
+            [Directory of wheel packages used by ensurepip (default: none)]),
+[
+if test -n "$withval"; then
+  AC_MSG_RESULT(yes)
+  WHEEL_PKG_DIR="$withval"
+else
+  AC_MSG_RESULT(no)
+fi],
+[AC_MSG_RESULT(no)])
+
 # Check whether right shifting a negative integer extends the sign bit
 # or fills with zeros (like the Cray J90, according to Tim Peters).
 AC_MSG_CHECKING(whether right shift extends the sign bit)
@@ -4847,7 +4912,7 @@
 AC_RUN_IFELSE([AC_LANG_SOURCE([[
 int main()
 {
-	exit(((-1)>>3 == -1) ? 0 : 1);
+	return (((-1)>>3 == -1) ? 0 : 1);
 }
 ]])],
 [ac_cv_rshift_extends_sign=yes],
@@ -4877,93 +4942,125 @@
   [Define this if you have flockfile(), getc_unlocked(), and funlockfile()])
 fi
 
+AC_ARG_WITH([readline],
+  [AS_HELP_STRING([--with(out)-readline@<:@=editline@:>@],
+    [use Editline for backend or disable readline module])],
+    [],
+    [with_readline=yes])
+
 # check where readline lives
+py_cv_lib_readline=no
 # save the value of LIBS so we don't actually link Python with readline
 LIBS_no_readline=$LIBS
 
-# On some systems we need to link readline to a termcap compatible
-# library.  NOTE: Keep the precedence of listed libraries synchronised
-# with setup.py.
-py_cv_lib_readline=no
-AC_MSG_CHECKING([how to link readline libs])
-for py_libtermcap in "" tinfo ncursesw ncurses curses termcap; do
-  if test -z "$py_libtermcap"; then
-    READLINE_LIBS="-lreadline"
+if test "$with_readline" != no; then
+  case "$with_readline" in
+  editline|edit)
+    LIBREADLINE=edit
+    AC_DEFINE(WITH_EDITLINE, 1,
+      [Define to build the readline module against Editline.])
+    ;;
+  yes|readline)
+    LIBREADLINE=readline
+    ;;
+  *)
+    AC_MSG_ERROR([proper usage is --with(out)-readline@<:@=editline@:>@])
+    ;;
+  esac
+
+  # On some systems we need to link readline to a termcap compatible
+  # library.  NOTE: Keep the precedence of listed libraries synchronised
+  # with setup.py.
+  AC_MSG_CHECKING([how to link readline libs])
+  for py_libtermcap in "" tinfo ncursesw ncurses curses termcap; do
+    if test -z "$py_libtermcap"; then
+      READLINE_LIBS="-l$LIBREADLINE"
+    else
+      READLINE_LIBS="-l$LIBREADLINE -l$py_libtermcap"
+    fi
+    LIBS="$READLINE_LIBS $LIBS_no_readline"
+    AC_LINK_IFELSE(
+      [AC_LANG_CALL([],[readline])],
+      [py_cv_lib_readline=yes])
+    if test $py_cv_lib_readline = yes; then
+      break
+    fi
+  done
+
+  # Uncomment this line if you want to use READLINE_LIBS in Makefile or scripts
+  #AC_SUBST([READLINE_LIBS])
+  if test $py_cv_lib_readline = no; then
+    AC_MSG_RESULT([none])
   else
-    READLINE_LIBS="-lreadline -l$py_libtermcap"
+    AC_MSG_RESULT([$READLINE_LIBS])
+    AC_DEFINE(HAVE_LIBREADLINE, 1,
+      [Define to build the readline module.])
   fi
-  LIBS="$READLINE_LIBS $LIBS_no_readline"
-  AC_LINK_IFELSE(
-    [AC_LANG_CALL([],[readline])],
-    [py_cv_lib_readline=yes])
-  if test $py_cv_lib_readline = yes; then
-    break
-  fi
-done
-# Uncomment this line if you want to use READINE_LIBS in Makefile or scripts
-#AC_SUBST([READLINE_LIBS])
-if test $py_cv_lib_readline = no; then
-  AC_MSG_RESULT([none])
-else
-  AC_MSG_RESULT([$READLINE_LIBS])
-  AC_DEFINE(HAVE_LIBREADLINE, 1,
-    [Define if you have the readline library (-lreadline).])
 fi
 
-# check for readline 2.2
-AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <readline/readline.h>]])],
-  [have_readline=yes],
-  [have_readline=no]
-)
-if test $have_readline = yes
-then
-  AC_EGREP_HEADER([extern int rl_completion_append_character;],
-  [readline/readline.h],
-  AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
-  [Define if you have readline 2.2]), )
-  AC_EGREP_HEADER([extern int rl_completion_suppress_append;],
-  [readline/readline.h],
-  AC_DEFINE(HAVE_RL_COMPLETION_SUPPRESS_APPEND, 1,
-  [Define if you have rl_completion_suppress_append]), )
+if test "$py_cv_lib_readline" = yes; then
+  # check for readline 2.2
+  AC_CHECK_DECL(rl_completion_append_character,
+    AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
+      [Define if you have readline 2.2]),,
+    [
+#include <stdio.h> /* Must be first for Gnu Readline */
+#ifdef WITH_EDITLINE
+# include <editline/readline.h>
+#else
+# include <readline/readline.h>
+#endif
+    ])
+  AC_CHECK_DECL(rl_completion_suppress_append,
+    AC_DEFINE(HAVE_RL_COMPLETION_SUPPRESS_APPEND, 1,
+      [Define if you have rl_completion_suppress_append]),,
+    [
+#include <stdio.h> /* Must be first for Gnu Readline */
+#ifdef WITH_EDITLINE
+# include <editline/readline.h>
+#else
+# include <readline/readline.h>
+#endif
+    ])
+
+  # check for readline 4.0
+  AC_CHECK_LIB($LIBREADLINE, rl_pre_input_hook,
+    AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
+      [Define if you have readline 4.0]),,$READLINE_LIBS)
+
+  # also in 4.0
+  AC_CHECK_LIB($LIBREADLINE, rl_completion_display_matches_hook,
+    AC_DEFINE(HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK, 1,
+      [Define if you have readline 4.0]),,$READLINE_LIBS)
+
+  # also in 4.0, but not in editline
+  AC_CHECK_LIB($LIBREADLINE, rl_resize_terminal,
+    AC_DEFINE(HAVE_RL_RESIZE_TERMINAL, 1,
+      [Define if you have readline 4.0]),,$READLINE_LIBS)
+
+  # check for readline 4.2
+  AC_CHECK_LIB($LIBREADLINE, rl_completion_matches,
+    AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
+      [Define if you have readline 4.2]),,$READLINE_LIBS)
+
+  # also in readline 4.2
+  AC_CHECK_DECL(rl_catch_signals,
+    AC_DEFINE(HAVE_RL_CATCH_SIGNAL, 1,
+      [Define if you can turn off readline's signal handling.]),,
+    [
+#include <stdio.h> /* Must be first for Gnu Readline */
+#ifdef WITH_EDITLINE
+# include <editline/readline.h>
+#else
+# include <readline/readline.h>
+#endif
+    ])
+
+  AC_CHECK_LIB($LIBREADLINE, append_history,
+    AC_DEFINE(HAVE_RL_APPEND_HISTORY, 1,
+      [Define if readline supports append_history]),,$READLINE_LIBS)
 fi
 
-# check for readline 4.0
-AC_CHECK_LIB(readline, rl_pre_input_hook,
-	AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
-        [Define if you have readline 4.0]), ,$READLINE_LIBS)
-
-# also in 4.0
-AC_CHECK_LIB(readline, rl_completion_display_matches_hook,
-	AC_DEFINE(HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK, 1,
-        [Define if you have readline 4.0]), ,$READLINE_LIBS)
-
-# also in 4.0, but not in editline
-AC_CHECK_LIB(readline, rl_resize_terminal,
-	AC_DEFINE(HAVE_RL_RESIZE_TERMINAL, 1,
-        [Define if you have readline 4.0]), ,$READLINE_LIBS)
-
-# check for readline 4.2
-AC_CHECK_LIB(readline, rl_completion_matches,
-	AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
-        [Define if you have readline 4.2]), ,$READLINE_LIBS)
-
-# also in readline 4.2
-AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <readline/readline.h>]])],
-  [have_readline=yes],
-  [have_readline=no]
-)
-if test $have_readline = yes
-then
-  AC_EGREP_HEADER([extern int rl_catch_signals;],
-  [readline/readline.h],
-  AC_DEFINE(HAVE_RL_CATCH_SIGNAL, 1,
-  [Define if you can turn off readline's signal handling.]), )
-fi
-
-AC_CHECK_LIB(readline, append_history,
-	AC_DEFINE(HAVE_RL_APPEND_HISTORY, 1,
-        [Define if readline supports append_history]), ,$READLINE_LIBS)
-
 # End of readline checks: restore LIBS
 LIBS=$LIBS_no_readline
 
@@ -4994,6 +5091,7 @@
 AC_CACHE_VAL(ac_cv_broken_poll,
 AC_RUN_IFELSE([AC_LANG_SOURCE([[
 #include <poll.h>
+#include <unistd.h>
 
 int main()
 {
@@ -5471,7 +5569,7 @@
 done
 
 AC_SUBST(SRCDIRS)
-SRCDIRS="Parser Parser/pegen Objects Python Modules Modules/_io Programs"
+SRCDIRS="Parser Objects Python Modules Modules/_io Programs"
 AC_MSG_CHECKING(for build directories)
 for dir in $SRCDIRS; do
     if test ! -d $dir; then
@@ -5587,14 +5685,15 @@
               [Has stdatomic.h with atomic_int and atomic_uintptr_t])
 fi
 
-# Check for GCC >= 4.7 __atomic builtins
-AC_MSG_CHECKING(for GCC >= 4.7 __atomic builtins)
+# Check for GCC >= 4.7 and clang __atomic builtin functions
+AC_MSG_CHECKING(for builtin __atomic_load_n and __atomic_store_n functions)
 AC_LINK_IFELSE(
 [
   AC_LANG_SOURCE([[
-    volatile int val = 1;
+    int val;
     int main() {
-      __atomic_load_n(&val, __ATOMIC_SEQ_CST);
+      __atomic_store_n(&val, 1, __ATOMIC_SEQ_CST);
+      (void)__atomic_load_n(&val, __ATOMIC_SEQ_CST);
       return 0;
     }
   ]])
@@ -5603,7 +5702,7 @@
 AC_MSG_RESULT($have_builtin_atomic)
 
 if test "$have_builtin_atomic" = yes; then
-    AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Has builtin atomics])
+    AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Has builtin __atomic_load_n() and __atomic_store_n() functions])
 fi
 
 # ensurepip option
@@ -5719,41 +5818,71 @@
 # Check for usable OpenSSL
 AX_CHECK_OPENSSL([have_openssl=yes],[have_openssl=no])
 
-if test "$have_openssl" = yes; then
-    AC_MSG_CHECKING([for X509_VERIFY_PARAM_set1_host in libssl])
+# rpath to libssl and libcrypto
+AC_MSG_CHECKING(for --with-openssl-rpath)
+AC_ARG_WITH(openssl-rpath,
+    AS_HELP_STRING([--with-openssl-rpath=@<:@DIR|auto|no@:>@],
+                   [Set runtime library directory (rpath) for OpenSSL libraries,
+                    no (default): don't set rpath,
+                    auto: auto-detect rpath from --with-openssl and pkg-config,
+                    DIR: set an explicit rpath
+                   ]),
+    [],
+    [with_openssl_rpath=no]
+)
+AS_CASE($with_openssl_rpath,
+    [auto|yes],[OPENSSL_RPATH=auto],
+    [no],[OPENSSL_RPATH=],
+    [AS_IF(
+        [test -d "$with_openssl_rpath"],
+        [OPENSSL_RPATH="$with_openssl_rpath"],
+        AC_MSG_ERROR([--with-openssl-rpath "$with_openssl_rpath" is not a directory]))
+    ]
+)
+AC_MSG_RESULT($OPENSSL_RPATH)
+AC_SUBST([OPENSSL_RPATH])
 
-    save_LIBS="$LIBS"
-    save_LDFLAGS="$LDFLAGS"
-    save_CPPFLAGS="$CPPFLAGS"
-    LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
-    LIBS="$OPENSSL_LIBS $LIBS"
-    CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS"
+# check if OpenSSL libraries work as expected
+AC_MSG_CHECKING(whether OpenSSL provides required APIs)
+save_LIBS="$LIBS"
+save_CFLAGS="$CFLAGS"
+save_LDFLAGS="$LDFLAGS"
+LIBS="$LIBS $OPENSSL_LIBS"
+CFLAGS="$CFLAGS_NODIST $OPENSSL_INCLUDES"
+LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
 
-    AC_LINK_IFELSE([AC_LANG_PROGRAM([
-        [#include <openssl/x509_vfy.h>]
-    ], [
-        [X509_VERIFY_PARAM *p = X509_VERIFY_PARAM_new();]
-        [X509_VERIFY_PARAM_set1_host(p, "localhost", 0);]
-        [X509_VERIFY_PARAM_set1_ip_asc(p, "127.0.0.1");]
-        [X509_VERIFY_PARAM_set_hostflags(p, 0);]
-    ])
-    ],
-    [
-        ac_cv_has_x509_verify_param_set1_host=yes
-    ],
-    [
-        ac_cv_has_x509_verify_param_set1_host=no
-    ])
-    AC_MSG_RESULT($ac_cv_has_x509_verify_param_set1_host)
-    if test "$ac_cv_has_x509_verify_param_set1_host" = "yes"; then
-        AC_DEFINE(HAVE_X509_VERIFY_PARAM_SET1_HOST, 1,
-        [Define if libssl has X509_VERIFY_PARAM_set1_host and related function])
-    fi
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#include <openssl/opensslv.h>
+#include <openssl/evp.h>
+#include <openssl/ssl.h>
 
-    CPPFLAGS="$save_CPPFLAGS"
-    LDFLAGS="$save_LDFLAGS"
-    LIBS="$save_LIBS"
-fi
+#if OPENSSL_VERSION_NUMBER < 0x10101000L
+#error "OpenSSL >= 1.1.1 is required"
+#endif
+
+static void keylog_cb(const SSL *ssl, const char *line) {}
+]], [[
+/* SSL APIs */
+SSL_CTX *ctx = SSL_CTX_new(TLS_client_method());
+SSL_CTX_set_keylog_callback(ctx, keylog_cb);
+SSL *ssl = SSL_new(ctx);
+X509_VERIFY_PARAM *param = SSL_get0_param(ssl);
+X509_VERIFY_PARAM_set1_host(param, "python.org", 0);
+SSL_free(ssl);
+SSL_CTX_free(ctx);
+
+/* hashlib APIs */
+OBJ_nid2sn(NID_md5);
+OBJ_nid2sn(NID_sha1);
+OBJ_nid2sn(NID_sha3_512);
+OBJ_nid2sn(NID_blake2b512);
+EVP_PBE_scrypt(NULL, 0, NULL, 0, 2, 8, 1, 0, NULL, 0);
+]])],
+  [AC_MSG_RESULT(yes)],
+  [AC_MSG_RESULT(no)])
+LIBS="$save_LIBS"
+CFLAGS="$save_CFLAGS"
+LDFLAGS="$save_LDFLAGS"
 
 # ssl module default cipher suite string
 AH_TEMPLATE(PY_SSL_DEFAULT_CIPHERS,
@@ -5770,7 +5899,7 @@
                             python: use Python's preferred selection (default),
                             openssl: leave OpenSSL's defaults untouched,
                             STRING: use a custom string,
-                            PROTOCOL_SSLv2 ignores the setting, see Doc/library/ssl.rst]),
+                            python and STRING also set TLS 1.2 as minimum TLS version]),
 [
 AC_MSG_RESULT($withval)
 case "$withval" in
@@ -5817,6 +5946,65 @@
 AC_DEFINE_UNQUOTED(PY_BUILTIN_HASHLIB_HASHES, "$default_hashlib_hashes")
 ])
 
+# --with-experimental-isolated-subinterpreters
+AH_TEMPLATE(EXPERIMENTAL_ISOLATED_SUBINTERPRETERS,
+            [Better isolate subinterpreters, experimental build mode.])
+AC_MSG_CHECKING(for --with-experimental-isolated-subinterpreters)
+AC_ARG_WITH(experimental-isolated-subinterpreters,
+  AS_HELP_STRING([--with-experimental-isolated-subinterpreters],
+                 [better isolate subinterpreters, experimental build mode (default is no)]),
+[
+if test "$withval" != no
+then
+  AC_MSG_RESULT(yes);
+  AC_DEFINE(EXPERIMENTAL_ISOLATED_SUBINTERPRETERS)
+else
+  AC_MSG_RESULT(no);
+fi],
+[AC_MSG_RESULT(no)])
+
+# --with-static-libpython
+STATIC_LIBPYTHON=1
+AC_MSG_CHECKING(for --with-static-libpython)
+AC_ARG_WITH(static-libpython,
+  AS_HELP_STRING([--without-static-libpython],
+                 [do not build libpythonMAJOR.MINOR.a and do not install python.o (default is yes)]),
+[
+if test "$withval" = no
+then
+  AC_MSG_RESULT(no);
+  STATIC_LIBPYTHON=0
+else
+  AC_MSG_RESULT(yes);
+fi],
+[AC_MSG_RESULT(yes)])
+LIBRARY_DEPS='$(PY3LIBRARY) $(EXPORTSYMS)'
+if test "$PY_ENABLE_SHARED" = 1 || test "$enable_framework" ; then
+    LIBRARY_DEPS="\$(LDLIBRARY) $LIBRARY_DEPS"
+    if test "$STATIC_LIBPYTHON" = 1; then
+        LIBRARY_DEPS="\$(LIBRARY) $LIBRARY_DEPS"
+    fi
+else
+    LIBRARY_DEPS="\$(LIBRARY) $LIBRARY_DEPS"
+fi
+AC_SUBST(STATIC_LIBPYTHON)
+AC_SUBST(LIBRARY_DEPS)
+
+# Check whether to disable test modules. Once set, setup.py will not build
+# test extension modules and "make install" will not install test suites.
+AC_MSG_CHECKING(for --disable-test-modules)
+AC_ARG_ENABLE(test-modules,
+              AS_HELP_STRING([--disable-test-modules], [don't build nor install test modules]))
+if test "$enable_test_modules" = no; then
+    TEST_MODULES=no
+    AC_MSG_RESULT(yes)
+else
+    TEST_MODULES=yes
+    AC_MSG_RESULT(no)
+fi
+AC_SUBST(TEST_MODULES)
+
+
 # generate output files
 AC_CONFIG_FILES(Makefile.pre Misc/python.pc Misc/python-embed.pc Misc/python-config.sh)
 AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix])
@@ -5842,4 +6030,3 @@
     echo "" >&AS_MESSAGE_FD
     echo "" >&AS_MESSAGE_FD
 fi
-
diff --git a/kokoro/build.py b/kokoro/build.py
index 1f06124..cde1a8d 100755
--- a/kokoro/build.py
+++ b/kokoro/build.py
@@ -53,7 +53,7 @@
             config_cmd.append('--enable-universalsdk')
         config_cmd.append('--with-universal-archs=universal2')
 
-        MAC_MIN_VERSION = '10.9'
+        MAC_MIN_VERSION = '10.14'
         cflags.append('-mmacosx-version-min={}'.format(MAC_MIN_VERSION))
         cflags.append('-DMACOSX_DEPLOYMENT_TARGET={}'.format(MAC_MIN_VERSION))
         cflags.extend(['-arch', 'arm64'])
@@ -64,17 +64,10 @@
         # Disable functions to support old macOS. See https://bugs.python.org/issue31359
         # Fails the build if any new API is used.
         cflags.append('-Werror=unguarded-availability')
-        # Disables unavailable functions.
-        disable_funcs = [
-            # New in 10.13
-            'utimensat', 'futimens',
-            # New in 10.12
-            'getentropy', 'clock_getres', 'clock_gettime', 'clock_settime',
-            # New in 10.10
-            'fstatat', 'faccessat', 'fchmodat', 'fchownat', 'linkat', 'fdopendir',
-            'mkdirat', 'renameat', 'unlinkat', 'readlinkat', 'symlinkat', 'openat',
-        ]
-        config_cmd.extend('ac_cv_func_{}=no'.format(f) for f in disable_funcs)
+        # We're building with a macOS 11+ SDK, so this should be set, but
+        # configure doesn't find it because of the unguarded-availability error
+        # combined with and older -mmacosx-version-min
+        cflags.append('-DHAVE_DYLD_SHARED_CACHE_CONTAINS_PATH=1')
     elif host == Host.Linux:
         # Quoting for -Wl,-rpath,$ORIGIN:
         #  - To link some binaries, make passes -Wl,-rpath,\$ORIGIN to shell.
@@ -98,7 +91,7 @@
         # Linker will embed this path to all binaries linking this library.
         # Since configure does not give us a chance to set -install_name, we have
         # to edit the library afterwards.
-        libpython = 'libpython3.9.dylib'
+        libpython = 'libpython3.10.dylib'
         subprocess.check_call(['make',
                                '-j{}'.format(multiprocessing.cpu_count()),
                                libpython],
diff --git a/kokoro/prepare_windows_externals.py b/kokoro/prepare_windows_externals.py
index 0065de1..75efe68 100644
--- a/kokoro/prepare_windows_externals.py
+++ b/kokoro/prepare_windows_externals.py
@@ -68,18 +68,18 @@
     node.data = new_text
 
 
-def patch_python_vcxproj_for_licenses():
+def patch_python_for_licenses():
     # Python already handles bzip2 and libffi itself.
     notice_files = [
         TOP / 'external/zlib/LICENSE',
         TOP / 'toolchain/xz/COPYING',
     ]
 
-    xml_path = PYTHON_SRC / 'PCbuild/python.vcxproj'
+    xml_path = PYTHON_SRC / 'PCbuild/regen.targets'
     proj = read_xml_file(xml_path)
 
-    # Pick the unconditional <LicenseFiles> element and add extra notices to the end.
-    elements = proj.getElementsByTagName('LicenseFiles')
+    # Pick the unconditional <_LicenseSources> element and add extra notices to the end.
+    elements = proj.getElementsByTagName('_LicenseSources')
     (element,) = [e for e in elements if not e.hasAttribute('Condition')]
     includes = element.getAttribute('Include').split(';')
     for notice in notice_files:
@@ -177,7 +177,7 @@
     shutil.copy2(xz / 'windows/vs2017/config.h',
                  xz / 'windows/config.h')
 
-    patch_python_vcxproj_for_licenses()
+    patch_python_for_licenses()
     remove_modules_from_pcbuild_proj()
     build_using_cmake(TOP / 'out/libffi', TOP / 'external/libffi')
     build_using_cmake(TOP / 'out/zlib', TOP / 'external/zlib')
diff --git a/m4/ax_c_float_words_bigendian.m4 b/m4/ax_c_float_words_bigendian.m4
deleted file mode 100644
index 746228c..0000000
--- a/m4/ax_c_float_words_bigendian.m4
+++ /dev/null
@@ -1,83 +0,0 @@
-# ===============================================================================
-#  https://www.gnu.org/software/autoconf-archive/ax_c_float_words_bigendian.html
-# ===============================================================================
-#
-# SYNOPSIS
-#
-#   AX_C_FLOAT_WORDS_BIGENDIAN([ACTION-IF-TRUE], [ACTION-IF-FALSE], [ACTION-IF-UNKNOWN])
-#
-# DESCRIPTION
-#
-#   Checks the ordering of words within a multi-word float. This check is
-#   necessary because on some systems (e.g. certain ARM systems), the float
-#   word ordering can be different from the byte ordering. In a multi-word
-#   float context, "big-endian" implies that the word containing the sign
-#   bit is found in the memory location with the lowest address. This
-#   implementation was inspired by the AC_C_BIGENDIAN macro in autoconf.
-#
-#   The endianness is detected by first compiling C code that contains a
-#   special double float value, then grepping the resulting object file for
-#   certain strings of ASCII values. The double is specially crafted to have
-#   a binary representation that corresponds with a simple string. In this
-#   implementation, the string "noonsees" was selected because the
-#   individual word values ("noon" and "sees") are palindromes, thus making
-#   this test byte-order agnostic. If grep finds the string "noonsees" in
-#   the object file, the target platform stores float words in big-endian
-#   order. If grep finds "seesnoon", float words are in little-endian order.
-#   If neither value is found, the user is instructed to specify the
-#   ordering.
-#
-# LICENSE
-#
-#   Copyright (c) 2008 Daniel Amelang <dan@amelang.net>
-#
-#   Copying and distribution of this file, with or without modification, are
-#   permitted in any medium without royalty provided the copyright notice
-#   and this notice are preserved. This file is offered as-is, without any
-#   warranty.
-
-#serial 11
-
-AC_DEFUN([AX_C_FLOAT_WORDS_BIGENDIAN],
-  [AC_CACHE_CHECK(whether float word ordering is bigendian,
-                  ax_cv_c_float_words_bigendian, [
-
-ax_cv_c_float_words_bigendian=unknown
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
-
-double d = 90904234967036810337470478905505011476211692735615632014797120844053488865816695273723469097858056257517020191247487429516932130503560650002327564517570778480236724525140520121371739201496540132640109977779420565776568942592.0;
-
-]])], [
-
-if $GREP noonsees conftest.$ac_objext >/dev/null ; then
-  ax_cv_c_float_words_bigendian=yes
-fi
-if $GREP seesnoon conftest.$ac_objext >/dev/null ; then
-  if test "$ax_cv_c_float_words_bigendian" = unknown; then
-    ax_cv_c_float_words_bigendian=no
-  else
-    ax_cv_c_float_words_bigendian=unknown
-  fi
-fi
-
-])])
-
-case $ax_cv_c_float_words_bigendian in
-  yes)
-    m4_default([$1],
-      [AC_DEFINE([FLOAT_WORDS_BIGENDIAN], 1,
-                 [Define to 1 if your system stores words within floats
-                  with the most significant word first])]) ;;
-  no)
-    $2 ;;
-  *)
-    m4_default([$3],
-      [AC_MSG_ERROR([
-
-Unknown float word ordering. You need to manually preset
-ax_cv_c_float_words_bigendian=no (or yes) according to your system.
-
-    ])]) ;;
-esac
-
-])# AX_C_FLOAT_WORDS_BIGENDIAN
diff --git a/m4/ax_check_openssl.m4 b/m4/ax_check_openssl.m4
deleted file mode 100644
index 2846fd1..0000000
--- a/m4/ax_check_openssl.m4
+++ /dev/null
@@ -1,124 +0,0 @@
-# ===========================================================================
-#     https://www.gnu.org/software/autoconf-archive/ax_check_openssl.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-#   AX_CHECK_OPENSSL([action-if-found[, action-if-not-found]])
-#
-# DESCRIPTION
-#
-#   Look for OpenSSL in a number of default spots, or in a user-selected
-#   spot (via --with-openssl).  Sets
-#
-#     OPENSSL_INCLUDES to the include directives required
-#     OPENSSL_LIBS to the -l directives required
-#     OPENSSL_LDFLAGS to the -L or -R flags required
-#
-#   and calls ACTION-IF-FOUND or ACTION-IF-NOT-FOUND appropriately
-#
-#   This macro sets OPENSSL_INCLUDES such that source files should use the
-#   openssl/ directory in include directives:
-#
-#     #include <openssl/hmac.h>
-#
-# LICENSE
-#
-#   Copyright (c) 2009,2010 Zmanda Inc. <http://www.zmanda.com/>
-#   Copyright (c) 2009,2010 Dustin J. Mitchell <dustin@zmanda.com>
-#
-#   Copying and distribution of this file, with or without modification, are
-#   permitted in any medium without royalty provided the copyright notice
-#   and this notice are preserved. This file is offered as-is, without any
-#   warranty.
-
-#serial 10
-
-AU_ALIAS([CHECK_SSL], [AX_CHECK_OPENSSL])
-AC_DEFUN([AX_CHECK_OPENSSL], [
-    found=false
-    AC_ARG_WITH([openssl],
-        [AS_HELP_STRING([--with-openssl=DIR],
-            [override root of the OpenSSL directory to DIR])],
-        [
-            case "$withval" in
-            "" | y | ye | yes | n | no)
-            AC_MSG_ERROR([Invalid --with-openssl value])
-              ;;
-            *) ssldirs="$withval"
-              ;;
-            esac
-        ], [
-            # if pkg-config is installed and openssl has installed a .pc file,
-            # then use that information and don't search ssldirs
-            AC_CHECK_TOOL([PKG_CONFIG], [pkg-config])
-            if test x"$PKG_CONFIG" != x""; then
-                OPENSSL_LDFLAGS=`$PKG_CONFIG openssl --libs-only-L 2>/dev/null`
-                if test $? = 0; then
-                    OPENSSL_LIBS=`$PKG_CONFIG openssl --libs-only-l 2>/dev/null`
-                    OPENSSL_INCLUDES=`$PKG_CONFIG openssl --cflags-only-I 2>/dev/null`
-                    found=true
-                fi
-            fi
-
-            # no such luck; use some default ssldirs
-            if ! $found; then
-                ssldirs="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr"
-            fi
-        ]
-        )
-
-
-    # note that we #include <openssl/foo.h>, so the OpenSSL headers have to be in
-    # an 'openssl' subdirectory
-
-    if ! $found; then
-        OPENSSL_INCLUDES=
-        for ssldir in $ssldirs; do
-            AC_MSG_CHECKING([for openssl/ssl.h in $ssldir])
-            if test -f "$ssldir/include/openssl/ssl.h"; then
-                OPENSSL_INCLUDES="-I$ssldir/include"
-                OPENSSL_LDFLAGS="-L$ssldir/lib"
-                OPENSSL_LIBS="-lssl -lcrypto"
-                found=true
-                AC_MSG_RESULT([yes])
-                break
-            else
-                AC_MSG_RESULT([no])
-            fi
-        done
-
-        # if the file wasn't found, well, go ahead and try the link anyway -- maybe
-        # it will just work!
-    fi
-
-    # try the preprocessor and linker with our new flags,
-    # being careful not to pollute the global LIBS, LDFLAGS, and CPPFLAGS
-
-    AC_MSG_CHECKING([whether compiling and linking against OpenSSL works])
-    echo "Trying link with OPENSSL_LDFLAGS=$OPENSSL_LDFLAGS;" \
-        "OPENSSL_LIBS=$OPENSSL_LIBS; OPENSSL_INCLUDES=$OPENSSL_INCLUDES" >&AS_MESSAGE_LOG_FD
-
-    save_LIBS="$LIBS"
-    save_LDFLAGS="$LDFLAGS"
-    save_CPPFLAGS="$CPPFLAGS"
-    LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
-    LIBS="$OPENSSL_LIBS $LIBS"
-    CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS"
-    AC_LINK_IFELSE(
-        [AC_LANG_PROGRAM([#include <openssl/ssl.h>], [SSL_new(NULL)])],
-        [
-            AC_MSG_RESULT([yes])
-            $1
-        ], [
-            AC_MSG_RESULT([no])
-            $2
-        ])
-    CPPFLAGS="$save_CPPFLAGS"
-    LDFLAGS="$save_LDFLAGS"
-    LIBS="$save_LIBS"
-
-    AC_SUBST([OPENSSL_INCLUDES])
-    AC_SUBST([OPENSSL_LIBS])
-    AC_SUBST([OPENSSL_LDFLAGS])
-])
diff --git a/pyconfig.h.in b/pyconfig.h.in
index f39858d..b0948e9 100644
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -16,6 +16,12 @@
    support for AIX C++ shared extension modules. */
 #undef AIX_GENUINE_CPLUSPLUS
 
+/* The normal alignment of `long', in bytes. */
+#undef ALIGNOF_LONG
+
+/* The normal alignment of `size_t', in bytes. */
+#undef ALIGNOF_SIZE_T
+
 /* Alternative SOABI used in debug build to load C extensions built in release
    mode */
 #undef ALT_SOABI
@@ -38,6 +44,9 @@
 /* Define if --enable-ipv6 is specified */
 #undef ENABLE_IPV6
 
+/* Better isolate subinterpreters, experimental build mode. */
+#undef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
+
 /* Define to 1 if your system stores words within floats with the most
    significant word first */
 #undef FLOAT_WORDS_BIGENDIAN
@@ -112,7 +121,7 @@
 /* Define if `unsetenv` does not return an int. */
 #undef HAVE_BROKEN_UNSETENV
 
-/* Has builtin atomics */
+/* Has builtin __atomic_load_n() and __atomic_store_n() functions */
 #undef HAVE_BUILTIN_ATOMIC
 
 /* Define to 1 if you have the 'chflags' function. */
@@ -136,6 +145,9 @@
 /* Define to 1 if you have the `clock_settime' function. */
 #undef HAVE_CLOCK_SETTIME
 
+/* Define to 1 if you have the `close_range' function. */
+#undef HAVE_CLOSE_RANGE
+
 /* Define if the C compiler supports computed gotos. */
 #undef HAVE_COMPUTED_GOTOS
 
@@ -281,6 +293,9 @@
 /* Define to 1 if you have the `dup3' function. */
 #undef HAVE_DUP3
 
+/* Define if you have the '_dyld_shared_cache_contains_path' function. */
+#undef HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH
+
 /* Defined when any dynamic module loading is enabled. */
 #undef HAVE_DYNAMIC_LOADING
 
@@ -302,6 +317,9 @@
 /* Define to 1 if you have the <errno.h> header file. */
 #undef HAVE_ERRNO_H
 
+/* Define if you have the 'eventfd' function. */
+#undef HAVE_EVENTFD
+
 /* Define to 1 if you have the `execv' function. */
 #undef HAVE_EXECV
 
@@ -598,7 +616,7 @@
 /* Define to 1 if you have the <libintl.h> header file. */
 #undef HAVE_LIBINTL_H
 
-/* Define if you have the readline library (-lreadline). */
+/* Define to build the readline module. */
 #undef HAVE_LIBREADLINE
 
 /* Define to 1 if you have the `resolv' library (-lresolv). */
@@ -610,12 +628,18 @@
 /* Define to 1 if you have the <libutil.h> header file. */
 #undef HAVE_LIBUTIL_H
 
+/* Define to 1 if you have the `uuid' library (-luuid). */
+#undef HAVE_LIBUUID
+
 /* Define if you have the 'link' function. */
 #undef HAVE_LINK
 
 /* Define to 1 if you have the `linkat' function. */
 #undef HAVE_LINKAT
 
+/* Define to 1 if you have the <linux/auxvec.h> header file. */
+#undef HAVE_LINUX_AUXVEC_H
+
 /* Define to 1 if you have the <linux/can/bcm.h> header file. */
 #undef HAVE_LINUX_CAN_BCM_H
 
@@ -730,6 +754,10 @@
 /* Define to 1 if you have the `nice' function. */
 #undef HAVE_NICE
 
+/* Define if the internal form of wchar_t in non-Unicode locales is not
+   Unicode. */
+#undef HAVE_NON_UNICODE_WCHAR_T_REPRESENTATION
+
 /* Define to 1 if you have the `openat' function. */
 #undef HAVE_OPENAT
 
@@ -778,9 +806,6 @@
 /* Define if you have the 'prlimit' functions. */
 #undef HAVE_PRLIMIT
 
-/* Define if you have the '_dyld_shared_cache_contains_path' function. */
-#undef HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH
-
 /* Define to 1 if you have the <process.h> header file. */
 #undef HAVE_PROCESS_H
 
@@ -883,6 +908,9 @@
 /* Define to 1 if you have the `sched_setscheduler' function. */
 #undef HAVE_SCHED_SETSCHEDULER
 
+/* Define to 1 if you have the `sem_clockwait' function. */
+#undef HAVE_SEM_CLOCKWAIT
+
 /* Define to 1 if you have the `sem_getvalue' function. */
 #undef HAVE_SEM_GETVALUE
 
@@ -1009,6 +1037,9 @@
 /* Define to 1 if you have the <spawn.h> header file. */
 #undef HAVE_SPAWN_H
 
+/* Define to 1 if you have the `splice' function. */
+#undef HAVE_SPLICE
+
 /* Define if your compiler provides ssize_t */
 #undef HAVE_SSIZE_T
 
@@ -1034,9 +1065,6 @@
 /* Has stdatomic.h with atomic_int and atomic_uintptr_t */
 #undef HAVE_STD_ATOMIC
 
-/* Define to 1 if you have the `strdup' function. */
-#undef HAVE_STRDUP
-
 /* Define to 1 if you have the `strftime' function. */
 #undef HAVE_STRFTIME
 
@@ -1116,6 +1144,9 @@
 /* Define to 1 if you have the <sys/epoll.h> header file. */
 #undef HAVE_SYS_EPOLL_H
 
+/* Define to 1 if you have the <sys/eventfd.h> header file. */
+#undef HAVE_SYS_EVENTFD_H
+
 /* Define to 1 if you have the <sys/event.h> header file. */
 #undef HAVE_SYS_EVENT_H
 
@@ -1301,6 +1332,9 @@
 /* Define to 1 if you have the <uuid/uuid.h> header file. */
 #undef HAVE_UUID_UUID_H
 
+/* Define to 1 if you have the `vfork' function. */
+#undef HAVE_VFORK
+
 /* Define to 1 if you have the `wait3' function. */
 #undef HAVE_WAIT3
 
@@ -1335,9 +1369,6 @@
 /* Define to 1 if you have the `writev' function. */
 #undef HAVE_WRITEV
 
-/* Define if libssl has X509_VERIFY_PARAM_set1_host and related function */
-#undef HAVE_X509_VERIFY_PARAM_SET1_HOST
-
 /* Define if the zlib library has inflateCopy */
 #undef HAVE_ZLIB_COPY
 
@@ -1487,6 +1518,9 @@
    (which you can't on SCO ODT 3.0). */
 #undef SYS_SELECT_WITH_SYS_TIME
 
+/* Custom thread stack size depending on chosen sanitizer runtimes. */
+#undef THREAD_STACK_SIZE
+
 /* Library needed by timemodule.c: librt may be needed for clock_gettime() */
 #undef TIMEMODULE_LIB
 
@@ -1539,6 +1573,9 @@
    Dyld is necessary to support frameworks. */
 #undef WITH_DYLD
 
+/* Define to build the readline module against Editline. */
+#undef WITH_EDITLINE
+
 /* Define to 1 if libintl is needed for locale functions. */
 #undef WITH_LIBINTL
 
@@ -1622,11 +1659,6 @@
 /* Define on FreeBSD to activate all library features */
 #undef __BSD_VISIBLE
 
-/* Define to 1 if type `char' is unsigned and you are not using gcc.  */
-#ifndef __CHAR_UNSIGNED__
-# undef __CHAR_UNSIGNED__
-#endif
-
 /* Define to 'long' if <time.h> doesn't define. */
 #undef clock_t
 
diff --git a/setup.py b/setup.py
index bd5f736..e74a275 100644
--- a/setup.py
+++ b/setup.py
@@ -4,10 +4,12 @@
 import importlib._bootstrap
 import importlib.machinery
 import importlib.util
+import logging
 import os
 import re
 import sys
 import sysconfig
+import warnings
 from glob import glob, escape
 import _osx_support
 
@@ -30,22 +32,41 @@
     SUBPROCESS_BOOTSTRAP = True
 
 
-from distutils import log
-from distutils.command.build_ext import build_ext
-from distutils.command.build_scripts import build_scripts
-from distutils.command.install import install
-from distutils.command.install_lib import install_lib
-from distutils.core import Extension, setup
-from distutils.errors import CCompilerError, DistutilsError
-from distutils.spawn import find_executable
+with warnings.catch_warnings():
+    # bpo-41282 (PEP 632) deprecated distutils but setup.py still uses it
+    warnings.filterwarnings(
+        "ignore",
+        "The distutils package is deprecated",
+        DeprecationWarning
+    )
+    warnings.filterwarnings(
+        "ignore",
+        "The distutils.sysconfig module is deprecated, use sysconfig instead",
+        DeprecationWarning
+    )
+
+    from distutils.command.build_ext import build_ext
+    from distutils.command.build_scripts import build_scripts
+    from distutils.command.install import install
+    from distutils.command.install_lib import install_lib
+    from distutils.core import Extension, setup
+    from distutils.errors import CCompilerError, DistutilsError
+    from distutils.spawn import find_executable
 
 
 # Compile extensions used to test Python?
-TEST_EXTENSIONS = True
+TEST_EXTENSIONS = (sysconfig.get_config_var('TEST_MODULES') == 'yes')
 
 # This global variable is used to hold the list of modules to be disabled.
 DISABLED_MODULE_LIST = []
 
+# --list-module-names option used by Tools/scripts/generate_module_names.py
+LIST_MODULE_NAMES = False
+
+
+logging.basicConfig(format='%(message)s', level=logging.INFO)
+log = logging.getLogger('setup')
+
 
 def get_platform():
     # Cross compiling
@@ -65,6 +86,9 @@
 MACOS = (HOST_PLATFORM == 'darwin')
 AIX = (HOST_PLATFORM.startswith('aix'))
 VXWORKS = ('vxworks' in HOST_PLATFORM)
+CC = os.environ.get("CC")
+if not CC:
+    CC = sysconfig.get_config_var("CC")
 
 
 SUMMARY = """
@@ -210,11 +234,11 @@
 
 def is_macosx_sdk_path(path):
     """
-    Returns True if 'path' can be located in an OSX SDK
+    Returns True if 'path' can be located in a macOS SDK
     """
     return ( (path.startswith('/usr/') and not path.startswith('/usr/local'))
-                or path.startswith('/System/')
-                or path.startswith('/Library/') )
+                or path.startswith('/System/Library')
+                or path.startswith('/System/iOSSupport') )
 
 
 def grep_headers_for(function, headers):
@@ -224,6 +248,7 @@
                 return True
     return False
 
+
 def find_file(filename, std_dirs, paths):
     """Searches for the directory where a given file is located,
     and returns a possibly-empty list of additional directories, or None
@@ -242,23 +267,23 @@
         sysroot = macosx_sdk_root()
 
     # Check the standard locations
-    for dir in std_dirs:
-        f = os.path.join(dir, filename)
+    for dir_ in std_dirs:
+        f = os.path.join(dir_, filename)
 
-        if MACOS and is_macosx_sdk_path(dir):
-            f = os.path.join(sysroot, dir[1:], filename)
+        if MACOS and is_macosx_sdk_path(dir_):
+            f = os.path.join(sysroot, dir_[1:], filename)
 
         if os.path.exists(f): return []
 
     # Check the additional directories
-    for dir in paths:
-        f = os.path.join(dir, filename)
+    for dir_ in paths:
+        f = os.path.join(dir_, filename)
 
-        if MACOS and is_macosx_sdk_path(dir):
-            f = os.path.join(sysroot, dir[1:], filename)
+        if MACOS and is_macosx_sdk_path(dir_):
+            f = os.path.join(sysroot, dir_[1:], filename)
 
         if os.path.exists(f):
-            return [dir]
+            return [dir_]
 
     # Not found anywhere
     return None
@@ -316,6 +341,7 @@
     else:
         assert False, "Internal error: Path not found in std_dirs or paths"
 
+
 def validate_tzpath():
     base_tzpath = sysconfig.get_config_var('TZPATH')
     if not base_tzpath:
@@ -328,15 +354,16 @@
                          + f'found:\n{tzpaths!r}\nwith invalid paths:\n'
                          + f'{bad_paths!r}')
 
+
 def find_module_file(module, dirlist):
     """Find a module in a set of possible folders. If it is not found
     return the unadorned filename"""
-    list = find_file(module, [], dirlist)
-    if not list:
+    dirs = find_file(module, [], dirlist)
+    if not dirs:
         return module
-    if len(list) > 1:
-        log.info("WARNING: multiple copies of %s found", module)
-    return os.path.join(list[0], module)
+    if len(dirs) > 1:
+        log.info(f"WARNING: multiple copies of {module} found")
+    return os.path.join(dirs[0], module)
 
 
 class PyBuildExt(build_ext):
@@ -443,15 +470,25 @@
 
     def build_extensions(self):
         self.set_srcdir()
+        self.set_compiler_executables()
+        self.configure_compiler()
+        self.init_inc_lib_dirs()
 
         # Detect which modules should be compiled
         self.detect_modules()
 
-        self.remove_disabled()
+        if not LIST_MODULE_NAMES:
+            self.remove_disabled()
 
         self.update_sources_depends()
         mods_built, mods_disabled = self.remove_configured_extensions()
-        self.set_compiler_executables()
+
+        if LIST_MODULE_NAMES:
+            for ext in self.extensions:
+                print(ext.name)
+            for name in self.missing:
+                print(name)
+            return
 
         build_ext.build_extensions(self)
 
@@ -534,12 +571,14 @@
                for l in (self.missing, self.failed, self.failed_on_import)):
             print()
             print("Could not build the ssl module!")
-            print("Python requires an OpenSSL 1.0.2 or 1.1 compatible "
-                  "libssl with X509_VERIFY_PARAM_set1_host().")
-            print("LibreSSL 2.6.4 and earlier do not provide the necessary "
-                  "APIs, https://github.com/libressl-portable/portable/issues/381")
+            print("Python requires a OpenSSL 1.1.1 or newer")
+            if sysconfig.get_config_var("OPENSSL_LDFLAGS"):
+                print("Custom linker flags may require --with-openssl-rpath=auto")
             print()
 
+        if os.environ.get("PYTHONSTRICTEXTENSIONBUILD") and (self.failed or self.failed_on_import):
+            raise RuntimeError("Failed to build some stdlib modules")
+
     def build_extension(self, ext):
 
         if ext.name == '_ctypes':
@@ -628,12 +667,11 @@
     def add_multiarch_paths(self):
         # Debian/Ubuntu multiarch support.
         # https://wiki.ubuntu.com/MultiarchSpec
-        cc = sysconfig.get_config_var('CC')
         tmpfile = os.path.join(self.build_temp, 'multiarch')
         if not os.path.exists(self.build_temp):
             os.makedirs(self.build_temp)
         ret = run_command(
-            '%s -print-multiarch > %s 2> /dev/null' % (cc, tmpfile))
+            '%s -print-multiarch > %s 2> /dev/null' % (CC, tmpfile))
         multiarch_path_component = ''
         try:
             if ret == 0:
@@ -671,12 +709,57 @@
         finally:
             os.unlink(tmpfile)
 
+    def add_wrcc_search_dirs(self):
+        # add library search path by wr-cc, the compiler wrapper
+
+        def convert_mixed_path(path):
+            # convert path like C:\folder1\folder2/folder3/folder4
+            # to msys style /c/folder1/folder2/folder3/folder4
+            drive = path[0].lower()
+            left = path[2:].replace("\\", "/")
+            return "/" + drive + left
+
+        def add_search_path(line):
+            # On Windows building machine, VxWorks does
+            # cross builds under msys2 environment.
+            pathsep = (";" if sys.platform == "msys" else ":")
+            for d in line.strip().split("=")[1].split(pathsep):
+                d = d.strip()
+                if sys.platform == "msys":
+                    # On Windows building machine, compiler
+                    # returns mixed style path like:
+                    # C:\folder1\folder2/folder3/folder4
+                    d = convert_mixed_path(d)
+                d = os.path.normpath(d)
+                add_dir_to_list(self.compiler.library_dirs, d)
+
+        tmpfile = os.path.join(self.build_temp, 'wrccpaths')
+        os.makedirs(self.build_temp, exist_ok=True)
+        try:
+            ret = run_command('%s --print-search-dirs >%s' % (CC, tmpfile))
+            if ret:
+                return
+            with open(tmpfile) as fp:
+                # Parse paths in libraries line. The line is like:
+                # On Linux, "libraries: = path1:path2:path3"
+                # On Windows, "libraries: = path1;path2;path3"
+                for line in fp:
+                    if not line.startswith("libraries"):
+                        continue
+                    add_search_path(line)
+        finally:
+            try:
+                os.unlink(tmpfile)
+            except OSError:
+                pass
+
     def add_cross_compiling_paths(self):
-        cc = sysconfig.get_config_var('CC')
         tmpfile = os.path.join(self.build_temp, 'ccpaths')
         if not os.path.exists(self.build_temp):
             os.makedirs(self.build_temp)
-        ret = run_command('%s -E -v - </dev/null 2>%s 1>/dev/null' % (cc, tmpfile))
+        # bpo-38472: With a German locale, GCC returns "gcc-Version 9.1.0
+        # (GCC)", whereas it returns "gcc version 9.1.0" with the C locale.
+        ret = run_command('LC_ALL=C %s -E -v - </dev/null 2>%s 1>/dev/null' % (CC, tmpfile))
         is_gcc = False
         is_clang = False
         in_incdirs = False
@@ -704,6 +787,9 @@
         finally:
             os.unlink(tmpfile)
 
+        if VXWORKS:
+            self.add_wrcc_search_dirs()
+
     def add_ldflags_cppflags(self):
         # Add paths specified in the environment variables LDFLAGS and
         # CPPFLAGS for header and library files.
@@ -719,6 +805,18 @@
             if env_val:
                 parser = argparse.ArgumentParser()
                 parser.add_argument(arg_name, dest="dirs", action="append")
+
+                # To prevent argparse from raising an exception about any
+                # options in env_val that it mistakes for known option, we
+                # strip out all double dashes and any dashes followed by a
+                # character that is not for the option we are dealing with.
+                #
+                # Please note that order of the regex is important!  We must
+                # strip out double-dashes first so that we don't end up with
+                # substituting "--Long" to "-Long" and thus lead to "ong" being
+                # used for a library directory.
+                env_val = re.sub(r'(^|\s+)-(-|(?!%s))' % arg_name[1],
+                                 ' ', env_val)
                 options, _ = parser.parse_known_args(env_val.split())
                 if options.dirs:
                     for directory in reversed(options.dirs):
@@ -805,7 +903,8 @@
         #
 
         # array objects
-        self.add(Extension('array', ['arraymodule.c']))
+        self.add(Extension('array', ['arraymodule.c'],
+                           extra_compile_args=['-DPy_BUILD_CORE_MODULE']))
 
         # Context Variables
         self.add(Extension('_contextvars', ['_contextvarsmodule.c']))
@@ -838,21 +937,22 @@
         # libm is needed by delta_new() that uses round() and by accum() that
         # uses modf().
         self.add(Extension('_datetime', ['_datetimemodule.c'],
-                           libraries=['m']))
+                           libraries=['m'],
+                           extra_compile_args=['-DPy_BUILD_CORE_MODULE']))
         # zoneinfo module
-        self.add(Extension('_zoneinfo', ['_zoneinfo.c'])),
+        self.add(Extension('_zoneinfo', ['_zoneinfo.c'],
+                           extra_compile_args=['-DPy_BUILD_CORE_MODULE']))
         # random number generator implemented in C
         self.add(Extension("_random", ["_randommodule.c"],
                            extra_compile_args=['-DPy_BUILD_CORE_MODULE']))
         # bisect
         self.add(Extension("_bisect", ["_bisectmodule.c"]))
         # heapq
-        self.add(Extension("_heapq", ["_heapqmodule.c"]))
+        self.add(Extension("_heapq", ["_heapqmodule.c"],
+                           extra_compile_args=['-DPy_BUILD_CORE_MODULE']))
         # C-optimized pickle replacement
         self.add(Extension("_pickle", ["_pickle.c"],
                            extra_compile_args=['-DPy_BUILD_CORE_MODULE']))
-        # atexit
-        self.add(Extension("atexit", ["atexitmodule.c"]))
         # _json speedups
         self.add(Extension("_json", ["_json.c"],
                            extra_compile_args=['-DPy_BUILD_CORE_MODULE']))
@@ -861,16 +961,19 @@
         self.add(Extension('_lsprof', ['_lsprof.c', 'rotatingtree.c']))
         # static Unicode character database
         self.add(Extension('unicodedata', ['unicodedata.c'],
-                           depends=['unicodedata_db.h', 'unicodename_db.h']))
+                           depends=['unicodedata_db.h', 'unicodename_db.h'],
+                           extra_compile_args=['-DPy_BUILD_CORE_MODULE']))
         # _opcode module
         self.add(Extension('_opcode', ['_opcode.c']))
         # asyncio speedups
         self.add(Extension("_asyncio", ["_asynciomodule.c"],
                            extra_compile_args=['-DPy_BUILD_CORE_MODULE']))
         # _abc speedups
-        self.add(Extension("_abc", ["_abc.c"]))
+        self.add(Extension("_abc", ["_abc.c"],
+                           extra_compile_args=['-DPy_BUILD_CORE_MODULE']))
         # _queue module
-        self.add(Extension("_queue", ["_queuemodule.c"]))
+        self.add(Extension("_queue", ["_queuemodule.c"],
+                           extra_compile_args=['-DPy_BUILD_CORE_MODULE']))
         # _statistics module
         self.add(Extension("_statistics", ["_statisticsmodule.c"]))
 
@@ -902,9 +1005,6 @@
         # select(2); not on ancient System V
         self.add(Extension('select', ['selectmodule.c']))
 
-        # Fred Drake's interface to the Python parser
-        self.add(Extension('parser', ['parsermodule.c']))
-
         # Memory-mapped files (also works on Win32).
         self.add(Extension('mmap', ['mmapmodule.c']))
 
@@ -936,7 +1036,8 @@
         self.add(Extension('_csv', ['_csv.c']))
 
         # POSIX subprocess module helper.
-        self.add(Extension('_posixsubprocess', ['_posixsubprocess.c']))
+        self.add(Extension('_posixsubprocess', ['_posixsubprocess.c'],
+                           extra_compile_args=['-DPy_BUILD_CORE_MODULE']))
 
     def detect_test_extensions(self):
         # Python C API test module
@@ -950,7 +1051,7 @@
         # Python PEP-3118 (buffer protocol) test module
         self.add(Extension('_testbuffer', ['_testbuffer.c']))
 
-        # Test loading multiple modules from one compiled file (http://bugs.python.org/issue16421)
+        # Test loading multiple modules from one compiled file (https://bugs.python.org/issue16421)
         self.add(Extension('_testimportmultiple', ['_testimportmultiple.c']))
 
         # Test multi-phase extension module init (PEP 489)
@@ -963,7 +1064,6 @@
 
     def detect_readline_curses(self):
         # readline
-        do_readline = self.compiler.find_library_file(self.lib_dirs, 'readline')
         readline_termcap_library = ""
         curses_library = ""
         # Cannot use os.popen here in py3k.
@@ -971,7 +1071,13 @@
         if not os.path.exists(self.build_temp):
             os.makedirs(self.build_temp)
         # Determine if readline is already linked against curses or tinfo.
-        if do_readline:
+        if sysconfig.get_config_var('HAVE_LIBREADLINE'):
+            if sysconfig.get_config_var('WITH_EDITLINE'):
+                readline_lib = 'edit'
+            else:
+                readline_lib = 'readline'
+            do_readline = self.compiler.find_library_file(self.lib_dirs,
+                readline_lib)
             if CROSS_COMPILING:
                 ret = run_command("%s -d %s | grep '(NEEDED)' > %s"
                                 % (sysconfig.get_config_var('READELF'),
@@ -994,6 +1100,8 @@
                             break
             if os.path.exists(tmpfile):
                 os.unlink(tmpfile)
+        else:
+            do_readline = False
         # Issue 7384: If readline is already linked against curses,
         # use the same library for the readline and curses modules.
         if 'curses' in readline_termcap_library:
@@ -1013,7 +1121,7 @@
             os_release = int(os.uname()[2].split('.')[0])
             dep_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
             if (dep_target and
-                    (tuple(int(n) for n in str(dep_target).split('.')[0:2])
+                    (tuple(int(n) for n in dep_target.split('.')[0:2])
                         < (10, 5) ) ):
                 os_release = 8
             if os_release < 9:
@@ -1033,7 +1141,7 @@
             else:
                 readline_extra_link_args = ()
 
-            readline_libs = ['readline']
+            readline_libs = [readline_lib]
             if readline_termcap_library:
                 pass # Issue 7384: Already linked against curses or tinfo.
             elif curses_library:
@@ -1078,6 +1186,7 @@
         if curses_library.startswith('ncurses'):
             curses_libs = [curses_library]
             self.add(Extension('_curses', ['_cursesmodule.c'],
+                               extra_compile_args=['-DPy_BUILD_CORE_MODULE'],
                                include_dirs=curses_includes,
                                define_macros=curses_defines,
                                libraries=curses_libs))
@@ -1092,6 +1201,7 @@
                 curses_libs = ['curses']
 
             self.add(Extension('_curses', ['_cursesmodule.c'],
+                               extra_compile_args=['-DPy_BUILD_CORE_MODULE'],
                                define_macros=curses_defines,
                                libraries=curses_libs))
         else:
@@ -1116,6 +1226,7 @@
             # bpo-31904: crypt() function is not provided by VxWorks.
             # DES_crypt() OpenSSL provides is too weak to implement
             # the encryption.
+            self.missing.append('_crypt')
             return
 
         if self.compiler.find_library_file(self.lib_dirs, 'crypt'):
@@ -1123,23 +1234,16 @@
         else:
             libs = []
 
-        self.add(Extension('_crypt', ['_cryptmodule.c'],
-                               libraries=libs))
+        self.add(Extension('_crypt', ['_cryptmodule.c'], libraries=libs))
 
     def detect_socket(self):
         # socket(2)
-        if not VXWORKS:
-            kwargs = {'depends': ['socketmodule.h']}
-            if MACOS:
-                # Issue #35569: Expose RFC 3542 socket options.
-                kwargs['extra_compile_args'] = ['-D__APPLE_USE_RFC_3542']
+        kwargs = {'depends': ['socketmodule.h']}
+        if MACOS:
+            # Issue #35569: Expose RFC 3542 socket options.
+            kwargs['extra_compile_args'] = ['-D__APPLE_USE_RFC_3542']
 
-            self.add(Extension('_socket', ['socketmodule.c'], **kwargs))
-        elif self.compiler.find_library_file(self.lib_dirs, 'net'):
-            libs = ['net']
-            self.add(Extension('_socket', ['socketmodule.c'],
-                               depends=['socketmodule.h'],
-                               libraries=libs))
+        self.add(Extension('_socket', ['socketmodule.c'], **kwargs))
 
     def detect_dbm_gdbm(self):
         # Modules that provide persistent dictionary-like semantics.  You will
@@ -1150,7 +1254,7 @@
         # similar functionality (but slower of course) implemented in Python.
 
         # Sleepycat^WOracle Berkeley DB interface.
-        #  http://www.oracle.com/database/berkeley-db/db/index.html
+        #  https://www.oracle.com/database/technologies/related/berkeleydb.html
         #
         # This requires the Sleepycat^WOracle DB code. The supported versions
         # are set below.  Visit the URL above to download
@@ -1192,7 +1296,7 @@
             '/usr/include/db3',
             '/usr/local/include/db3',
             '/opt/sfw/include/db3',
-            # Fink defaults (http://fink.sourceforge.net/)
+            # Fink defaults (https://www.finkproject.org/)
             '/sw/include/db4',
             '/sw/include/db3',
         ]
@@ -1204,7 +1308,7 @@
             db_inc_paths.append('/usr/local/include/db4%d' % x)
             db_inc_paths.append('/pkg/db-4.%d/include' % x)
             db_inc_paths.append('/opt/db-4.%d/include' % x)
-            # MacPorts default (http://www.macports.org/)
+            # MacPorts default (https://www.macports.org/)
             db_inc_paths.append('/opt/local/include/db4%d' % x)
         # 3.x minor number specific paths
         for x in gen_db_minor_ver_nums(3):
@@ -1438,7 +1542,6 @@
         sqlite_setup_debug = False   # verbose debug prints from this script?
 
         # We hunt for #define SQLITE_VERSION "n.n.n"
-        # We need to find >= sqlite version 3.3.9, for sqlite3_prepare_v2
         sqlite_incdir = sqlite_libdir = None
         sqlite_inc_paths = [ '/usr/include',
                              '/usr/include/sqlite',
@@ -1449,7 +1552,7 @@
                              ]
         if CROSS_COMPILING:
             sqlite_inc_paths = []
-        MIN_SQLITE_VERSION_NUMBER = (3, 7, 2)
+        MIN_SQLITE_VERSION_NUMBER = (3, 7, 15)  # Issue 40810
         MIN_SQLITE_VERSION = ".".join([str(x)
                                     for x in MIN_SQLITE_VERSION_NUMBER])
 
@@ -1510,17 +1613,14 @@
                 '_sqlite/row.c',
                 '_sqlite/statement.c',
                 '_sqlite/util.c', ]
-
             sqlite_defines = []
-            if not MS_WINDOWS:
-                sqlite_defines.append(('MODULE_NAME', '"sqlite3"'))
-            else:
-                sqlite_defines.append(('MODULE_NAME', '\\"sqlite3\\"'))
 
             # Enable support for loadable extensions in the sqlite3 module
             # if --enable-loadable-sqlite-extensions configure option is used.
             if '--enable-loadable-sqlite-extensions' not in sysconfig.get_config_var("CONFIG_ARGS"):
                 sqlite_defines.append(("SQLITE_OMIT_LOAD_EXTENSION", "1"))
+            elif MACOS and sqlite_incdir == os.path.join(MACOS_SDK_ROOT, "usr/include"):
+                raise DistutilsError("System version of SQLite does not support loadable extensions")
 
             if MACOS:
                 # In every directory on the search path search for a dynamic
@@ -1681,7 +1781,9 @@
                 ('XML_POOR_ENTROPY', '1'),
             ]
             extra_compile_args = []
-            expat_lib = []
+            # bpo-44394: libexpat uses isnan() of math.h and needs linkage
+            # against the libm
+            expat_lib = ['m']
             expat_sources = ['expat/xmlparse.c',
                              'expat/xmlrole.c',
                              'expat/xmltok.c']
@@ -1740,45 +1842,44 @@
         if MS_WINDOWS:
             multiprocessing_srcs = ['_multiprocessing/multiprocessing.c',
                                     '_multiprocessing/semaphore.c']
-
         else:
             multiprocessing_srcs = ['_multiprocessing/multiprocessing.c']
             if (sysconfig.get_config_var('HAVE_SEM_OPEN') and not
                 sysconfig.get_config_var('POSIX_SEMAPHORES_NOT_ENABLED')):
                 multiprocessing_srcs.append('_multiprocessing/semaphore.c')
-            if (sysconfig.get_config_var('HAVE_SHM_OPEN') and
-                sysconfig.get_config_var('HAVE_SHM_UNLINK')):
-                posixshmem_srcs = ['_multiprocessing/posixshmem.c']
-                libs = []
-                if sysconfig.get_config_var('SHM_NEEDS_LIBRT'):
-                    # need to link with librt to get shm_open()
-                    libs.append('rt')
-                self.add(Extension('_posixshmem', posixshmem_srcs,
-                                   define_macros={},
-                                   libraries=libs,
-                                   include_dirs=["Modules/_multiprocessing"]))
-
         self.add(Extension('_multiprocessing', multiprocessing_srcs,
                            include_dirs=["Modules/_multiprocessing"]))
 
+        if (not MS_WINDOWS and
+           sysconfig.get_config_var('HAVE_SHM_OPEN') and
+           sysconfig.get_config_var('HAVE_SHM_UNLINK')):
+            posixshmem_srcs = ['_multiprocessing/posixshmem.c']
+            libs = []
+            if sysconfig.get_config_var('SHM_NEEDS_LIBRT'):
+                # need to link with librt to get shm_open()
+                libs.append('rt')
+            self.add(Extension('_posixshmem', posixshmem_srcs,
+                               define_macros={},
+                               libraries=libs,
+                               include_dirs=["Modules/_multiprocessing"]))
+        else:
+            self.missing.append('_posixshmem')
+
     def detect_uuid(self):
         # Build the _uuid module if possible
-        uuid_incs = find_file("uuid.h", self.inc_dirs, ["/usr/include/uuid"])
-        if uuid_incs is not None:
-            if self.compiler.find_library_file(self.lib_dirs, 'uuid'):
-                uuid_libs = ['uuid']
+        uuid_h = sysconfig.get_config_var("HAVE_UUID_H")
+        uuid_uuid_h = sysconfig.get_config_var("HAVE_UUID_UUID_H")
+        if uuid_h or uuid_uuid_h:
+            if sysconfig.get_config_var("HAVE_LIBUUID"):
+                uuid_libs = ["uuid"]
             else:
                 uuid_libs = []
             self.add(Extension('_uuid', ['_uuidmodule.c'],
-                               libraries=uuid_libs,
-                               include_dirs=uuid_incs))
+                               libraries=uuid_libs))
         else:
             self.missing.append('_uuid')
 
     def detect_modules(self):
-        self.configure_compiler()
-        self.init_inc_lib_dirs()
-
         self.detect_simple_extensions()
         if TEST_EXTENSIONS:
             self.detect_test_extensions()
@@ -1804,22 +1905,39 @@
 ##         # Uncomment these lines if you want to play with xxmodule.c
 ##         self.add(Extension('xx', ['xxmodule.c']))
 
-        if 'd' not in sysconfig.get_config_var('ABIFLAGS'):
-            self.add(Extension('xxlimited', ['xxlimited.c'],
-                               define_macros=[('Py_LIMITED_API', '0x03050000')]))
+        # The limited C API is not compatible with the Py_TRACE_REFS macro.
+        if not sysconfig.get_config_var('Py_TRACE_REFS'):
+            self.add(Extension('xxlimited', ['xxlimited.c']))
+            self.add(Extension('xxlimited_35', ['xxlimited_35.c']))
 
-    def detect_tkinter_explicitly(self):
-        # Build _tkinter using explicit locations for Tcl/Tk.
+    def detect_tkinter_fromenv(self):
+        # Build _tkinter using the Tcl/Tk locations specified by
+        # the _TCLTK_INCLUDES and _TCLTK_LIBS environment variables.
+        # This method is meant to be invoked by detect_tkinter().
         #
-        # This is enabled when both arguments are given to ./configure:
+        # The variables can be set via one of the following ways.
         #
+        # - Automatically, at configuration time, by using pkg-config.
+        #   The tool is called by the configure script.
+        #   Additional pkg-config configuration paths can be set via the
+        #   PKG_CONFIG_PATH environment variable.
+        #
+        #     PKG_CONFIG_PATH=".../lib/pkgconfig" ./configure ...
+        #
+        # - Explicitly, at configuration time by setting both
+        #   --with-tcltk-includes and --with-tcltk-libs.
+        #
+        #     ./configure ... \
         #     --with-tcltk-includes="-I/path/to/tclincludes \
         #                            -I/path/to/tkincludes"
         #     --with-tcltk-libs="-L/path/to/tcllibs -ltclm.n \
         #                        -L/path/to/tklibs -ltkm.n"
         #
-        # These values can also be specified or overridden via make:
-        #    make TCLTK_INCLUDES="..." TCLTK_LIBS="..."
+        #  - Explicitly, at compile time, by passing TCLTK_INCLUDES and
+        #    TCLTK_LIBS to the make target.
+        #    This will override any configuration-time option.
+        #
+        #      make TCLTK_INCLUDES="..." TCLTK_LIBS="..."
         #
         # This can be useful for building and testing tkinter with multiple
         # versions of Tcl/Tk.  Note that a build of Tk depends on a particular
@@ -1843,6 +1961,7 @@
 
     def detect_tkinter_darwin(self):
         # Build default _tkinter on macOS using Tcl and Tk frameworks.
+        # This method is meant to be invoked by detect_tkinter().
         #
         # The macOS native Tk (AKA Aqua Tk) and Tcl are most commonly
         # built and installed as macOS framework bundles.  However,
@@ -1861,16 +1980,20 @@
         #    search only the SDK's /Library/Frameworks (normally empty)
         #    and /System/Library/Frameworks.
         #
-        # Any other use case should be able to be handled explicitly by
-        # using the options described above in detect_tkinter_explicitly().
-        # In particular it would be good to handle here the case where
+        # Any other use cases are handled either by detect_tkinter_fromenv(),
+        # or detect_tkinter(). The former handles non-standard locations of
+        # Tcl/Tk, defined via the _TCLTK_INCLUDES and _TCLTK_LIBS environment
+        # variables. The latter handles any Tcl/Tk versions installed in
+        # standard Unix directories.
+        #
+        # It would be desirable to also handle here the case where
         # you want to build and link with a framework build of Tcl and Tk
         # that is not in /Library/Frameworks, say, in your private
         # $HOME/Library/Frameworks directory or elsewhere. It turns
         # out to be difficult to make that work automatically here
         # without bringing into play more tools and magic. That case
         # can be handled using a recipe with the right arguments
-        # to detect_tkinter_explicitly().
+        # to detect_tkinter_fromenv().
         #
         # Note also that the fallback case here is to try to use the
         # Apple-supplied Tcl and Tk frameworks in /System/Library but
@@ -1970,12 +2093,17 @@
 
     def detect_tkinter(self):
         # The _tkinter module.
+        #
+        # Detection of Tcl/Tk is attempted in the following order:
+        #   - Through environment variables.
+        #   - Platform specific detection of Tcl/Tk (currently only macOS).
+        #   - Search of various standard Unix header/library paths.
+        #
+        # Detection stops at the first successful method.
 
-        # Check whether --with-tcltk-includes and --with-tcltk-libs were
-        # configured or passed into the make target.  If so, use these values
-        # to build tkinter and bypass the searches for Tcl and TK in standard
-        # locations.
-        if self.detect_tkinter_explicitly():
+        # Check for Tcl and Tk at the locations indicated by _TCLTK_INCLUDES
+        # and _TCLTK_LIBS environment variables.
+        if self.detect_tkinter_fromenv():
             return True
 
         # Rather than complicate the code below, detecting and building
@@ -2196,7 +2324,7 @@
         undef_macros = []
         if '--with-system-libmpdec' in sysconfig.get_config_var("CONFIG_ARGS"):
             include_dirs = []
-            libraries = [':libmpdec.so.2']
+            libraries = ['mpdec']
             sources = ['_decimal/_decimal.c']
             depends = ['_decimal/docstrings.h']
         else:
@@ -2287,12 +2415,12 @@
         # Workarounds for toolchain bugs:
         if sysconfig.get_config_var('HAVE_IPA_PURE_CONST_BUG'):
             # Some versions of gcc miscompile inline asm:
-            # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46491
-            # http://gcc.gnu.org/ml/gcc/2010-11/msg00366.html
+            # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46491
+            # https://gcc.gnu.org/ml/gcc/2010-11/msg00366.html
             extra_compile_args.append('-fno-ipa-pure-const')
         if sysconfig.get_config_var('HAVE_GLIBC_MEMMOVE_BUG'):
             # _FORTIFY_SOURCE wrappers for memmove and bcopy are incorrect:
-            # http://sourceware.org/ml/libc-alpha/2010-12/msg00009.html
+            # https://sourceware.org/ml/libc-alpha/2010-12/msg00009.html
             undef_macros.append('_FORTIFY_SOURCE')
 
         # Uncomment for extra functionality:
@@ -2324,6 +2452,7 @@
         openssl_includes = split_var('OPENSSL_INCLUDES', '-I')
         openssl_libdirs = split_var('OPENSSL_LDFLAGS', '-L')
         openssl_libs = split_var('OPENSSL_LIBS', '-l')
+        openssl_rpath = config_vars.get('OPENSSL_RPATH')
         if not openssl_libs:
             # libssl and libcrypto not found
             self.missing.extend(['_ssl', '_hashlib'])
@@ -2337,30 +2466,58 @@
             self.missing.extend(['_ssl', '_hashlib'])
             return None, None
 
-        # OpenSSL 1.0.2 uses Kerberos for KRB5 ciphers
-        krb5_h = find_file(
-            'krb5.h', self.inc_dirs,
-            ['/usr/kerberos/include']
-        )
-        if krb5_h:
-            ssl_incs.extend(krb5_h)
-
-        if config_vars.get("HAVE_X509_VERIFY_PARAM_SET1_HOST"):
-            self.add(Extension(
-                '_ssl', ['_ssl.c'],
-                include_dirs=openssl_includes,
-                library_dirs=openssl_libdirs,
-                libraries=openssl_libs,
-                depends=['socketmodule.h', '_ssl/debughelpers.c'])
-            )
+        if openssl_rpath == 'auto':
+            runtime_library_dirs = openssl_libdirs[:]
+        elif not openssl_rpath:
+            runtime_library_dirs = []
         else:
-            self.missing.append('_ssl')
+            runtime_library_dirs = [openssl_rpath]
 
-        self.add(Extension('_hashlib', ['_hashopenssl.c'],
-                           depends=['hashlib.h'],
-                           include_dirs=openssl_includes,
-                           library_dirs=openssl_libdirs,
-                           libraries=openssl_libs))
+        openssl_extension_kwargs = dict(
+            include_dirs=openssl_includes,
+            library_dirs=openssl_libdirs,
+            libraries=openssl_libs,
+            runtime_library_dirs=runtime_library_dirs,
+        )
+
+        # This static linking is NOT OFFICIALLY SUPPORTED.
+        # Requires static OpenSSL build with position-independent code. Some
+        # features like DSO engines or external OSSL providers don't work.
+        # Only tested on GCC and clang on X86_64.
+        if os.environ.get("PY_UNSUPPORTED_OPENSSL_BUILD") == "static":
+            extra_linker_args = []
+            for lib in openssl_extension_kwargs["libraries"]:
+                # link statically
+                extra_linker_args.append(f"-l:lib{lib}.a")
+                # don't export symbols
+                extra_linker_args.append(f"-Wl,--exclude-libs,lib{lib}.a")
+            openssl_extension_kwargs["extra_link_args"] = extra_linker_args
+            # don't link OpenSSL shared libraries.
+            # include libz for OpenSSL build flavors with compression support
+            openssl_extension_kwargs["libraries"] = ["z"]
+
+        self.add(
+            Extension(
+                '_ssl',
+                ['_ssl.c'],
+                depends=[
+                    'socketmodule.h',
+                    '_ssl.h',
+                    '_ssl/debughelpers.c',
+                    '_ssl/misc.c',
+                    '_ssl/cert.c',
+                ],
+                **openssl_extension_kwargs
+            )
+        )
+        self.add(
+            Extension(
+                '_hashlib',
+                ['_hashopenssl.c'],
+                depends=['hashlib.h'],
+                **openssl_extension_kwargs,
+            )
+        )
 
     def detect_hash_builtins(self):
         # By default we always compile these even when OpenSSL is available
@@ -2537,7 +2694,7 @@
                 newfilename = filename + fullversion
             else:
                 newfilename = filename + minoronly
-            log.info('renaming %s to %s', filename, newfilename)
+            log.info(f'renaming {filename} to {newfilename}')
             os.rename(filename, newfilename)
             newoutfiles.append(newfilename)
             if filename in updated_files:
@@ -2546,6 +2703,12 @@
 
 
 def main():
+    global LIST_MODULE_NAMES
+
+    if "--list-module-names" in sys.argv:
+        LIST_MODULE_NAMES = True
+        sys.argv.remove("--list-module-names")
+
     set_compiler_flags('CFLAGS', 'PY_CFLAGS_NODIST')
     set_compiler_flags('LDFLAGS', 'PY_LDFLAGS_NODIST')
 
@@ -2562,7 +2725,7 @@
     setup(# PyPI Metadata (PEP 301)
           name = "Python",
           version = sys.version.split()[0],
-          url = "http://www.python.org/%d.%d" % sys.version_info[:2],
+          url = "https://www.python.org/%d.%d" % sys.version_info[:2],
           maintainer = "Guido van Rossum and the Python community",
           maintainer_email = "python-dev@python.org",
           description = "A high-level object-oriented programming language",
@@ -2578,7 +2741,8 @@
                       'install_lib': PyBuildInstallLib},
           # The struct module is defined here, because build_ext won't be
           # called unless there's at least one extension module defined.
-          ext_modules=[Extension('_struct', ['_struct.c'])],
+          ext_modules=[Extension('_struct', ['_struct.c'],
+                                 extra_compile_args=['-DPy_BUILD_CORE_MODULE'])],
 
           # If you change the scripts installed here, you also need to
           # check the PyBuildScripts command above, and change the links